diff --git a/.gitignore b/.gitignore index 5cdd4b63b..1377554eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,69 +1 @@ -*.a -*.bin -*.hex -*.map -*.png -*.log -*.elf -*.zip -*.d -*.o -*.e -*.ihex -*.pyc -*~ -build/* -Makefile.target -Makefile.*.defines -tools/doxygen/html -tools/readthedocs/_build -patches-* -tools/serial-io/tunslip6 -tools/serial-io/serialdump -serialdump-* -build -tools/coffee-manager/build/ -tools/coffee-manager/coffee.jar -COOJA.testlog - -# platform build artifacts -*.cc2538dk -*.cooja -*.jn516x -*.native -*.nrf52dk -*.openmote-cc2538 -*.simplelink -*.sky -*.firmware -*.cc26x0-cc13x0 -*.zoul - -# do not ignore platform makefiles -!Makefile.cc2538dk -!Makefile.cooja -!Makefile.jn516x -!Makefile.native -!Makefile.nrf52dk -!Makefile.openmote-cc2538 -!Makefile.sky -!Makefile.cc26x0-cc13x0 -!Makefile.zoul - -# other nRF52 build artifacts -*.jlink - -#test artifacts -*.testlog -*.scriptlog -*.coojalog -*.summary -*.err -summary -tests/[0-9][0-9]-*/org/ -tests/18-coap-lwm2m/Californium.properties -tests/18-coap-lwm2m/leshan-server-demo*.jar - -# x86 UEFI files -cpu/x86/uefi/Makefile.uefi -cpu/x86/uefi/edk2 +*.swp diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index b6fb5d01f..000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,3 +0,0 @@ -For contribution guidelines, see [doc:contributing]. - -[doc:contributing]: https://github.com/contiki-ng/contiki-ng/wiki/Contributing diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index f4b1a054c..000000000 --- a/LICENSE.md +++ /dev/null @@ -1,30 +0,0 @@ -Copyright (c) (Year), (Name of copyright holder) -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. diff --git a/Makefile.embedded b/Makefile.embedded deleted file mode 100644 index e6841926b..000000000 --- a/Makefile.embedded +++ /dev/null @@ -1,47 +0,0 @@ -# This Makefile contains make variables and rules that are only applicable -# to builds for embedded devices (i.e. excluding platforms native and cooja). -# Future extensions to the build system that are of a similar nature (for -# embedded devices only), can be achieved by extending this Makefile here. - -### -### Targets using the tools/serial-io -### -RLWRAPGOALS = login serialdump serialview - -.PHONY: $(RLWRAPGOALS) - -BAUDRATE ?= 115200 -SERIALDUMP_TIME_FMT ?= - -ifeq ($(HOST_OS),Windows) - SERIALDUMP = $(SERIAL_DUMP_BIN) -else - RLWRAP = $(notdir $(shell which rlwrap)) - ifeq ($(RLWRAP),) - ifneq ($(filter $(RLWRAPGOALS),$(MAKECMDGOALS)),) - $(info Running serialdump without rlwrap support.) - $(info Consider installing rlwarp in order to be able to use command history) - endif - endif - SERIALDUMP = $(RLWRAP) $(SERIAL_DUMP_BIN) -endif - -serialdump: $(SERIAL_DUMP_BIN) - $(SERIALDUMP) -b$(BAUDRATE) -T$(SERIALDUMP_TIME_FMT) $(PORT) | tee serialdump-`date +%Y%m%d-%H%M` - -serialview: $(SERIAL_DUMP_BIN) - $(SERIALDUMP) -b$(BAUDRATE) -T$(SERIALDUMP_TIME_FMT) $(PORT) - -login: $(SERIAL_DUMP_BIN) - $(SERIALDUMP) -b$(BAUDRATE) $(PORT) - -### -### Targets using tools/motelist -### -CONTIKI_NG_MOTELIST_DIR = $(TOOLS_DIR)/motelist -CONTIKI_NG_MOTELIST = python $(CONTIKI_NG_MOTELIST_DIR)/motelist.py - -.PHONY: motelist-all - -motelist-all: - $(CONTIKI_NG_MOTELIST) diff --git a/Makefile.help b/Makefile.help deleted file mode 100644 index d8de20c00..000000000 --- a/Makefile.help +++ /dev/null @@ -1,29 +0,0 @@ -usage: - @echo "Usage:" - @echo " make [TARGET=(TARGET)] [BOARD=(BOARD)] [DEFINES=(DEFINES)] [PORT=(PORT)] [target]" - @echo "" - @echo "Typical usage:" - @echo " make [TARGET=(TARGET)] [BOARD=(BOARD)] [all]" - @echo "" - @echo " Will build Contiki-NG firmware(s) from the current example dir" - @echo " for platform TARGET, board BOARD." - @echo "" - @echo "Miscellaneous targets:" - @echo " targets Prints list of supported platforms" - @echo " boards Prints a list of supported boards for TARGET" - @echo " savetarget Saves TARGET and BOARD for future invocations of make" - @echo " savedefines Saves DEFINES for future invocations of make" - @echo " clean Removes all compiled files for TARGET" - @echo " distclean Removes all compiled files for all TARGETs" - @echo " viewconf Prints Contiki-NG build configuration for TARGET" - @echo " %.flashprof Shows a Flash/ROM profile of a given firmware (e.g. hello-world.flashprof)" - @echo " %.ramprof Shows a RAM profile of a given firmware (e.g. hello-world.ramprof)" - @echo " %.o Produces an object file from a given source file (e.g. hello-world.o)" - @echo " %.e Produces the pre-processed version of a given source file (e.g. hello-world.e)" - @echo " %.s Produces an assembly file from a given source file (e.g. hello-world.s)" - @echo " login View the serial output of the device connected to PORT" - @echo " serialview Same as login, but prepend serial output with a unix timestamp" - @echo " serialdump same as serialview, but also save the output to a file" - @echo " motelist-all Prints a list of connected devices" - -help: usage diff --git a/Makefile.identify-target b/Makefile.identify-target deleted file mode 100644 index 86e06c093..000000000 --- a/Makefile.identify-target +++ /dev/null @@ -1,14 +0,0 @@ -# This Makefile can be used to identify the selected TARGET used for a -# specific build. It can be included by example Makefiles that need to take -# decisions based on TARGET. It is also automatically included by the -# top-level Makefile.include. - -ifeq ($(TARGET),) - -include Makefile.target - ifeq ($(TARGET),) - ${info TARGET not defined, using target 'native'} - TARGET=native - else - ${info using saved target '$(TARGET)'} - endif -endif diff --git a/Makefile.include b/Makefile.include deleted file mode 100644 index 930378c01..000000000 --- a/Makefile.include +++ /dev/null @@ -1,490 +0,0 @@ -# -*- makefile -*- - -ifndef CONTIKI - ${error CONTIKI not defined! You must specify where Contiki resides} -endif - -# Enable Werror by default. To disable from command line, use make WERROR=0. -# Setting this option is also important for tests on Cooja motes to check for warnings. -WERROR ?= 1 - -include $(CONTIKI)/Makefile.identify-target - -### Include Makefile.tools to pull in targets that allow us to build tools dir -include $(CONTIKI)/Makefile.tools - -ifeq ($(DEFINES),) - -include Makefile.$(TARGET).defines - ifneq ($(DEFINES),) - ${info using saved defines '$(DEFINES)'} - endif -endif - -ifndef HOST_OS - ifeq ($(OS),Windows_NT) - ## TODO: detect more specific Windows set-ups, - ## e.g. CygWin, MingW, VisualC, Watcom, Interix - HOST_OS := Windows - else - HOST_OS := $(shell uname) - endif -endif - -#More debug information when running in CI -ifdef CI - ifeq ($(CI),true) - V = 1 - endif -endif - -BUILD_DIR = build -BUILD_DIR_TARGET = $(BUILD_DIR)/$(TARGET) -BUILD_DIR_BOARD = $(BUILD_DIR_TARGET)/$(BOARD)/$(BUILD_DIR_CONFIG) -OBJECTDIR = $(BUILD_DIR_BOARD)/obj - -CONTIKI_NG_TARGET_LIB = $(BUILD_DIR_BOARD)/contiki-ng-$(TARGET).a - -LOWERCASE = -abcdefghijklmnopqrstuvwxyz/ -UPPERCASE = _ABCDEFGHIJKLMNOPQRSTUVWXYZ_ -TARGET_UPPERCASE := ${strip ${shell echo $(TARGET) | sed y!$(LOWERCASE)!$(UPPERCASE)!}} -CFLAGS += -DCONTIKI=1 -DCONTIKI_TARGET_$(TARGET_UPPERCASE)=1 -CFLAGS += -DCONTIKI_TARGET_STRING=\"$(TARGET)\" - -CFLAGS += -Wno-unused-const-variable - -LDFLAGS_WERROR ?= -Wl,--fatal-warnings - -ifeq ($(WERROR),1) - LDFLAGS += $(LDFLAGS_WERROR) -endif - -MODULES += os os/sys os/dev os/lib os/services - -# Automatically include project-conf.h if found -ifneq ("$(wildcard project-conf.h)","") -CFLAGS += -DPROJECT_CONF_PATH=\"project-conf.h\" -endif - -MODULES += os os/net os/net/mac os/net/mac/framer os/net/routing os/storage - -define oname -${patsubst %.c,%.o, \ -${patsubst %.S,%.o, \ -${patsubst %.s,%.o, \ -$(1) \ -}}} -endef - -CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFILES)}} -PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}} - -uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))) - -### Include target makefile (TODO Unsafe?) - -# Configurable arch path -ARCH_PATH ?= $(CONTIKI)/arch - -target_makefile := $(wildcard $(ARCH_PATH)/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)}) - -# Check if the target makefile exists, and create the object directory if necessary. -ifeq ($(strip $(target_makefile)),) - ${error The target platform "$(TARGET)" does not exist (maybe it was misspelled?)} -else - ifneq (1, ${words $(target_makefile)}) - ${error More than one TARGET Makefile found: $(target_makefile)} - endif - include $(target_makefile) -endif - -# Decide whether to build or to skip this target for this platform -ifneq ("", "$(PLATFORMS_ONLY)") - ifeq ("","$(filter $(TARGET), $(PLATFORMS_ONLY))") - PLATFORM_ACTION = skip - endif -endif - -ifneq ("", "$(PLATFORMS_EXCLUDE)") - ifneq ("","$(filter $(TARGET), $(PLATFORMS_EXCLUDE))") - PLATFORM_ACTION = skip - endif -endif - -ifneq ($(BOARD),) -ifneq ("", "$(BOARDS_ONLY)") - ifeq ("","$(filter $(BOARD), $(BOARDS_ONLY))") - PLATFORM_ACTION = skip - endif -endif - -ifneq ("", "$(BOARDS_EXCLUDE)") - ifneq ("","$(filter $(BOARD), $(BOARDS_EXCLUDE))") - PLATFORM_ACTION = skip - endif -endif -endif # $(BOARD) not empty - -PLATFORM_ACTION ?= build - -# Provide way to create $(OBJECTDIR) if it has been removed by make clean -$(OBJECTDIR): - $(TRACE_MKDIR) - $(Q)mkdir -p $@ - -ifneq ($(BOARD),) - TARGET_BOARD_UPPERCASE := ${strip ${shell echo $(BOARD) | sed y!$(LOWERCASE)!$(UPPERCASE)!}} - CFLAGS += -DCONTIKI_BOARD_$(TARGET_BOARD_UPPERCASE)=1 - CFLAGS += -DCONTIKI_BOARD_STRING=\"$(BOARD)\" -endif - -# Configure MAC layer - -# The different options -MAKE_MAC_NULLMAC = 0 -MAKE_MAC_CSMA = 1 -MAKE_MAC_TSCH = 2 -MAKE_MAC_BLE = 3 -MAKE_MAC_OTHER = 4 - -# Make CSMA the default MAC -MAKE_MAC ?= MAKE_MAC_CSMA - -ifeq ($(MAKE_MAC),MAKE_MAC_NULLMAC) - MODULES+=os/net/mac/nullmac - CFLAGS += -DMAC_CONF_WITH_NULLMAC=1 -endif - -ifeq ($(MAKE_MAC),MAKE_MAC_CSMA) - MODULES += os/net/mac/csma - CFLAGS += -DMAC_CONF_WITH_CSMA=1 -endif - -ifeq ($(MAKE_MAC),MAKE_MAC_TSCH) - MODULES += os/net/mac/tsch - CFLAGS += -DMAC_CONF_WITH_TSCH=1 -endif - -ifeq ($(MAKE_MAC),MAKE_MAC_BLE) - MODULES += os/net/mac/ble - CFLAGS += -DMAC_CONF_WITH_BLE=1 -endif - -ifeq ($(MAKE_MAC),MAKE_MAC_OTHER) - CFLAGS += -DMAC_CONF_WITH_OTHER=1 -endif - -# Configure Network layer - -MAKE_NET_NULLNET = 0 -MAKE_NET_IPV6 = 1 -MAKE_NET_OTHER = 2 - -# Make IPv6 the default stack -MAKE_NET ?= MAKE_NET_IPV6 - -ifeq ($(MAKE_NET),MAKE_NET_NULLNET) - CFLAGS += -DNETSTACK_CONF_WITH_NULLNET=1 - MODULES += os/net/nullnet -endif - -ifeq ($(MAKE_NET),MAKE_NET_IPV6) - CFLAGS += -DNETSTACK_CONF_WITH_IPV6=1 - MODULES += os/net/ipv6 -endif - -ifeq ($(MAKE_NET),MAKE_NET_OTHER) - CFLAGS += -DNETSTACK_CONF_WITH_OTHER=1 -endif - -ifeq ($(WITH_IP64),1) - MODULES += os/services/ip64 -endif - -# Configure Routing protocol -MAKE_ROUTING_NULLROUTING = 0 -MAKE_ROUTING_RPL_CLASSIC = 1 -MAKE_ROUTING_RPL_LITE = 2 - -# Default routing protocol: RPL for IPv6, None otherwise -ifeq ($(MAKE_NET),MAKE_NET_IPV6) -MAKE_ROUTING ?= MAKE_ROUTING_RPL_LITE -else -MAKE_ROUTING ?= MAKE_ROUTING_NULLROUTING -endif - -ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_CLASSIC) - CFLAGS += -DROUTING_CONF_RPL_CLASSIC=1 - MODULES += os/net/routing/rpl-classic -else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_LITE) - CFLAGS += -DROUTING_CONF_RPL_LITE=1 - MODULES += os/net/routing/rpl-lite -else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_NULLROUTING) - CFLAGS += -DROUTING_CONF_NULLROUTING=1 - MODULES += os/net/routing/nullrouting -endif - -MODULEDIRS = $(MODULES_REL) ${wildcard ${addprefix $(CONTIKI)/, $(MODULES)}} -UNIQUEMODULES = $(call uniq,$(MODULEDIRS)) -MODULES_SOURCES = ${foreach d, $(MODULEDIRS), ${subst ${d}/,,${wildcard $(d)/*.c}}} -CONTIKI_SOURCEFILES += $(MODULES_SOURCES) - -# Include module-specific makefiles -MODULES_INCLUDES = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/Makefile.${notdir $(d)}}} -include $(MODULES_INCLUDES) -# Iterate once more: include the modules added from the previous include. -# Only works with one level of nested module inclusion. -include $(MODULES_INCLUDES) - -# C-include module-specific macros using -imacros -MODULES_IMACROS = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/module-macros.h}} -ifneq ($(MODULES_IMACROS),) - CFLAGS += ${foreach d, $(MODULES_IMACROS), -imacros $(d)} -endif - -### Verbosity control. Use make V=1 to get verbose builds. - -ifeq ($(V),1) - TRACE_CC = - TRACE_LD = - TRACE_AR = - TRACE_AS = - TRACE_OBJCOPY = - TRACE_OBJDUMP = - TRACE_MKDIR = - TRACE_CP = - Q= -else - TRACE_CC = @echo " CC " $< - TRACE_LD = @echo " LD " $@ - TRACE_AR = @echo " AR " $@ - TRACE_AS = @echo " AS " $< - TRACE_OBJCOPY = @echo " OBJCOPY " $< "-->" $@ - TRACE_OBJDUMP = @echo " OBJDUMP " $< "-->" $@ - TRACE_MKDIR = @echo " MKDIR " $@ - TRACE_CP = @echo " CP " $< "-->" $@ - Q=@ -endif - -### Forward comma-separated list of arbitrary defines to the compiler - -COMMA := , -CFLAGS += ${addprefix -D,${subst $(COMMA), ,$(DEFINES)}} - -### Setup directory search path for source and header files - -CONTIKI_TARGET_DIRS_CONCAT = ${addprefix ${dir $(target_makefile)}, \ - $(CONTIKI_TARGET_DIRS)} -CONTIKI_CPU_DIRS_CONCAT = ${addprefix $(CONTIKI_CPU)/, \ - $(CONTIKI_CPU_DIRS)} -CONTIKI_ARCH_DIRS = ${addprefix $(CONTIKI)/, arch} - -SOURCEDIRS = . $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) $(CONTIKI_ARCH_DIRS) \ - $(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(MODULEDIRS) $(EXTERNALDIRS) ${dir $(target_makefile)} - -vpath %.c $(SOURCEDIRS) -vpath %.S $(SOURCEDIRS) -vpath %.s $(SOURCEDIRS) - -CFLAGS += ${addprefix -I,$(SOURCEDIRS) $(CONTIKI)} - -### Check for a git repo and pass version if found -### git.exe in Windows cmd shells may require no stderr redirection -ifndef RELSTR -RELSTR:=${shell git --git-dir ${CONTIKI}/.git --work-tree ${CONTIKI} describe \ - --tags --always --dirty} -endif - -ifneq ($(RELSTR),) -CFLAGS += -DCONTIKI_VERSION_STRING=\"Contiki-NG-$(RELSTR)\" -else -CFLAGS += -DCONTIKI_VERSION_STRING=\"Contiki-NG\" -endif - -### Automatic dependency generation - -ifneq ($(MAKECMDGOALS),clean) --include ${addprefix $(OBJECTDIR)/,$(CONTIKI_SOURCEFILES:.c=.d) \ - $(PROJECT_SOURCEFILES:.c=.d)} -endif - -### See http://make.paulandlesley.org/autodep.html#advanced - -define FINALIZE_DEPENDENCY -cp $(@:.o=.d) $(@:.o=.$$$$); \ -sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(@:.o=.$$$$) >> $(@:.o=.d); \ -rm -f $(@:.o=.$$$$) -endef - -### Harmonize filename of a .map file, if the platform's build system wants -### to create one -CONTIKI_NG_PROJECT_MAP = $(BUILD_DIR_BOARD)/$(basename $(notdir $@)).map - -.PHONY: clean distclean usage help targets boards savetarget savedefines viewconf - -clean: - -$(Q)rm -f *.d *.e *.o $(CLEAN) - -$(Q)rm -rf $(BUILD_DIR_TARGET) - -$(Q)rm -f $(addsuffix .$(TARGET), $(CONTIKI_PROJECT)) - @echo Target $(TARGET) cleaned - -distclean: - @for TARG in `ls $(ARCH_PATH)/platform $(TARGETDIRS)`; do \ - echo Running: $(MAKE) TARGET=$$TARG clean; \ - $(MAKE) TARGET=$$TARG clean; \ - done - -$(Q)rm -rf $(BUILD_DIR) - --include $(ARCH_PATH)/platform/$(TARGET)/Makefile.customrules-$(TARGET) - -ifndef CUSTOM_RULE_C_TO_OBJECTDIR_O -$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -MMD -c $< -o $@ - @$(FINALIZE_DEPENDENCY) -endif - -ifndef CUSTOM_RULE_S_TO_OBJECTDIR_O -$(OBJECTDIR)/%.o: %.S | $(OBJECTDIR) - $(TRACE_AS) - $(Q)$(AS) $(ASFLAGS) -o $@ $< -$(OBJECTDIR)/%.o: %.s | $(OBJECTDIR) - $(TRACE_AS) - $(Q)$(AS) $(ASFLAGS) -o $@ $< -endif - -ifndef CUSTOM_RULE_C_TO_OBJECTDIR_S -$(OBJECTDIR)/%.s: %.c | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -S $< -o $@ -endif - -ifndef CUSTOM_RULE_C_TO_OBJECTDIR_E -$(OBJECTDIR)/%.e: %.c | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -E $< -o $@ -endif - -ifndef CUSTOM_RULE_C_TO_O -%.o: %.c - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -c $< -o $@ -endif - -ifndef CUSTOM_RULE_C_TO_S -%.s: %.c - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -S $< -o $@ -endif - -ifndef CUSTOM_RULE_C_TO_E -%.e: %.c - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -E $< -o $@ -endif - -ifndef AROPTS - AROPTS = rcf -endif - -ifndef CUSTOM_RULE_ALLOBJS_TO_TARGETLIB -$(CONTIKI_NG_TARGET_LIB): $(CONTIKI_OBJECTFILES) - $(TRACE_AR) - $(Q)$(AR) $(AROPTS) $@ $^ -endif - -ifndef LD - LD = $(CC) -endif - -ifndef CUSTOM_RULE_LINK -$(BUILD_DIR_BOARD)/%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB) - $(TRACE_LD) - $(Q)$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} \ - ${filter %.a,$^} $(TARGET_LIBFILES) -o $@ -endif - -%.$(TARGET): $(BUILD_DIR_BOARD)/%.$(TARGET) - $(TRACE_CP) - $(Q)cp $< $@ - -%.ramprof: %.$(TARGET) - $(NM) -S -td --size-sort $< | grep -i " [abdrw] " | cut -d' ' -f2,4 - -%.flashprof: %.$(TARGET) - $(NM) -S -td --size-sort $< | grep -i " [t] " | cut -d' ' -f2,4 - -include $(CONTIKI)/Makefile.help - -targets: - @ls $(ARCH_PATH)/platform $(TARGETDIRS) - -boards: -ifdef BOARD - @echo "$(BOARDS) (current: $(BOARD))" -else - @echo "Platform has no boards" -endif - -savetarget: - -@rm -f Makefile.target - @echo "saving Makefile.target" - @echo >Makefile.target "TARGET = $(TARGET)" -ifneq ($(BOARD),) - @echo >>Makefile.target "BOARD = $(BOARD)" -endif - -savedefines: - -@rm -f Makefile.$(TARGET).defines - @echo "saving Makefile.$(TARGET).defines" - @echo >Makefile.$(TARGET).defines "DEFINES = $(DEFINES)" - -VIEWCONF = $(CONTIKI)/tools/viewconf/viewconf.c -viewconf: - @echo "----------------- Make variables: --------------" - @echo "##### \"TARGET\": ________________________________ $(TARGET)" - @echo "##### \"BOARD\": _________________________________ $(BOARD)" - @echo "##### \"MAKE_MAC\": ______________________________ $(MAKE_MAC)" - @echo "##### \"MAKE_NET\": ______________________________ $(MAKE_NET)" - @echo "##### \"MAKE_ROUTING\": __________________________ $(MAKE_ROUTING)" -ifdef MAKE_COAP_DTLS_KEYSTORE - @echo "##### \"MAKE_COAP_DTLS_KEYSTORE\": _______________ $(MAKE_COAP_DTLS_KEYSTORE)" -endif - @echo "----------------- C variables: -----------------" - $(Q)$(CC) $(CFLAGS) -E $(VIEWCONF) | grep \#\#\#\#\# - @echo "------------------------------------------------" - @echo "'==' Means the flag is set to a given a value" - @echo "'->' Means the flag is unset, but will default to a given value" - @echo "'><' Means the flag is unset and has no default value" - @echo "To view more Make variables, edit $(CONTIKI)/Makefile.include, rule 'viewconf'" - @echo "To view more C variables, edit $(VIEWCONF)" - -### Include Makefile.embedded for relevant platforms, in order to pull in -### rules for login, serialview etc -ifeq ($(findstring $(TARGET),native cooja),) - include $(CONTIKI)/Makefile.embedded -endif - -# Don't treat $(BUILD_DIR_BOARD)/%.$(TARGET) and $(TARGET) as intermediate -# files because for many platforms they are in fact the primary target. -.PRECIOUS: $(BUILD_DIR_BOARD)/%.$(TARGET) %.$(TARGET) - -# Cancel the predefined implict rule for compiling and linking -# a single C source into a binary to force GNU make to consider -# the match-anything rule below instead. -%: %.c - -ifeq ($(PLATFORM_ACTION),skip) -# Skip this target. -$(CONTIKI_PROJECT): - @echo "Skipping $@: not for the '$(TARGET)/$(BOARD)' platform!" -%.$(TARGET): - @echo "Skipping $@: not for the '$(TARGET)/$(BOARD)' platform!" -else -# Build this target. -# Match-anything pattern rule to allow the project makefiles to -# abstract from the actual binary name. It needs to contain some -# command in order to be a rule, not just a prerequisite. -%: %.$(TARGET) - @ -endif diff --git a/Makefile.tools b/Makefile.tools deleted file mode 100644 index 81653cde6..000000000 --- a/Makefile.tools +++ /dev/null @@ -1,17 +0,0 @@ -# Some make rules in the main build system depend on the presence of utilities -# under the tools/ dir. For those dependencies, we use this makefile here to -# recursively invoke the respective build under tools/. - -TOOLS_DIR = $(CONTIKI)/tools -SERIAL_IO_TOOL_DIR = $(TOOLS_DIR)/serial-io - -SERIAL_IO_TOOL_DEPS = $(addprefix $(SERIAL_IO_TOOL_DIR)/, tools-utils.c tools-utils.h) - -TUNSLIP6 = $(SERIAL_IO_TOOL_DIR)/tunslip6 -SERIAL_DUMP_BIN = $(SERIAL_IO_TOOL_DIR)/serialdump - -$(SERIAL_DUMP_BIN): $(SERIAL_IO_TOOL_DIR)/serialdump.c $(SERIAL_IO_TOOL_DEPS) - $(MAKE) -C $(SERIAL_IO_TOOL_DIR) serialdump - -$(TUNSLIP6): $(SERIAL_IO_TOOL_DIR)/tunslip6.c $(SERIAL_IO_TOOL_DEPS) - $(MAKE) -C $(SERIAL_IO_TOOL_DIR) tunslip6 diff --git a/README.md b/README.md deleted file mode 100644 index 68837c24f..000000000 --- a/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Contiki-NG: The OS for Next Generation IoT Devices - -[![Build Status](https://travis-ci.org/contiki-ng/contiki-ng.svg?branch=master)](https://travis-ci.org/contiki-ng/contiki-ng/branches) -[![license](https://img.shields.io/badge/license-3--clause%20bsd-brightgreen.svg)](https://github.com/contiki-ng/contiki-ng/blob/master/LICENSE.md) -[![Latest release](https://img.shields.io/github/release/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/releases/latest) -[![GitHub Release Date](https://img.shields.io/github/release-date/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/releases/latest) -[![Last commit](https://img.shields.io/github/last-commit/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/commit/HEAD) - -Contiki-NG is an open-source, cross-platform operating system for Next-Generation IoT devices. It focuses on dependable (secure and reliable) low-power communication and standard protocols, such as IPv6/6LoWPAN, 6TiSCH, RPL, and CoAP. Contiki-NG comes with extensive documentation, tutorials, a roadmap, release cycle, and well-defined development flow for smooth integration of community contributions. - -Unless explicitly stated otherwise, Contiki-NG sources are distributed under -the terms of the [3-clause BSD license](LICENSE.md). This license gives -everyone the right to use and distribute the code, either in binary or -source code format, as long as the copyright license is retained in -the source code. - -Contiki-NG started as a fork of the Contiki OS and retains some of its original features. - -Find out more: - -* GitHub repository: https://github.com/contiki-ng/contiki-ng -* Documentation: https://github.com/contiki-ng/contiki-ng/wiki -* Web site: http://contiki-ng.org - -Engage with the community: - -* Gitter: https://gitter.im/contiki-ng -* Twitter: https://twitter.com/contiki_ng - diff --git a/arch/cpu/arm/Makefile.arm b/arch/cpu/arm/Makefile.arm deleted file mode 100644 index e8befdb86..000000000 --- a/arch/cpu/arm/Makefile.arm +++ /dev/null @@ -1,82 +0,0 @@ -### Verbosity control. Use make V=1 to get verbose builds. -### Extends what we already have in the top-level Makefile -ifeq ($(V),1) - TRACE_SREC_CAT = -else - TRACE_SREC_CAT = @echo " SREC_CAT " $< "-->" $@ -endif - -CC = arm-none-eabi-gcc -CPP = arm-none-eabi-cpp -LD = arm-none-eabi-gcc -AR = arm-none-eabi-ar -OBJCOPY = arm-none-eabi-objcopy -OBJDUMP = arm-none-eabi-objdump -NM = arm-none-eabi-nm -SIZE = arm-none-eabi-size -SREC_CAT = srec_cat - -CFLAGS += -mthumb -mabi=aapcs -mlittle-endian -CFLAGS += -Wall -CFLAGS += -std=c99 -CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing -CFLAGS += -fshort-enums -fomit-frame-pointer -fno-builtin -ifeq ($(WERROR),1) - CFLAGS += -Werror -endif - -LDFLAGS += -mthumb -mlittle-endian - -OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb - -### Are we building with code size optimisations? -SMALL ?= 1 -ifeq ($(SMALL),1) - CFLAGS += -Os -else - CFLAGS += -O2 -endif - -### Use CMSIS from arch/cpu/arm/common -CONTIKI_ARM_DIRS += . -CONTIKI_CPU_DIRS += $(addprefix ../arm/, $(CONTIKI_ARM_DIRS)) - -### Default to use os/lib/dbg-io unless configured to do otherwise -MAKE_WITH_LIB_DBG_IO ?= 1 - -ifeq ($(MAKE_WITH_LIB_DBG_IO),1) - MODULES += os/lib/dbg-io -endif - -### CPU-dependent cleanup files -CLEAN += *.elf *.bin *.lst *.hex *.i16hex - -OUT_HEX = $(BUILD_DIR_BOARD)/%.hex -OUT_I16HEX = $(BUILD_DIR_BOARD)/%.i16hex -OUT_BIN = $(BUILD_DIR_BOARD)/%.bin -OUT_LST = $(BUILD_DIR_BOARD)/%.lst - -### Don't treat the following files as intermediate -.PRECIOUS: $(OUT_ELF) $(OUT_HEX) $(OUT_BIN) - -$(OUT_I16HEX): $(OUT_ELF) - $(TRACE_OBJCOPY) - $(Q)$(OBJCOPY) -O ihex $< $@ - -$(OUT_HEX): $(OUT_I16HEX) - $(TRACE_SREC_CAT) - $(Q)$(SREC_CAT) $< -intel -o $@ -intel - -$(OUT_BIN): $(OUT_ELF) - $(TRACE_OBJCOPY) - $(Q)$(OBJCOPY) -O binary $(OBJCOPY_FLAGS) $< $@ - -$(OUT_LST): $(OUT_ELF) - $(TRACE_OBJDUMP) - $(Q)$(OBJDUMP) $(OBJDUMP_FLAGS) $< > $@ - -### We don't really need the .hex and .bin for the .$(TARGET) but let's make -### sure they get built -$(BUILD_DIR_BOARD)/%.$(TARGET): $(OUT_ELF) $(OUT_HEX) $(OUT_BIN) - $(TRACE_CP) - $(Q)cp $< $@ diff --git a/arch/cpu/arm/arm-def.h b/arch/cpu/arm/arm-def.h deleted file mode 100644 index c83cfd3fc..000000000 --- a/arch/cpu/arm/arm-def.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup arm - * @{ - * - * \file - * Compiler and data type definitions for all ARM-based CPUs - */ -/*---------------------------------------------------------------------------*/ -#ifndef ARM_DEF_ -#define ARM_DEF_ -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -/** - * \name Macros and typedefs - * - * Those values are not meant to be modified by the user - * @{ - */ -#define CLOCK_CONF_SECOND 128 - -/* Clock (time) comparison macro */ -#define CLOCK_LT(a, b) ((signed long)((a) - (b)) < 0) - -/* Platform typedefs */ -typedef uint32_t clock_time_t; -typedef uint32_t uip_stats_t; - -/** @} */ - -/* - * The stdio.h that ships with the arm-gcc toolchain does this: - * - * int _EXFUN(putchar, (int)); - * [...] - * #define putchar(x) putc(x, stdout) - * - * This causes us a lot of trouble: For platforms using this toolchain, every - * time we use putchar we need to first #undef putchar. What we do here is to - * #undef putchar across the board. The resulting code will cause the linker - * to search for a symbol named putchar and this allows us to use the - * implementation under os/lib/dbg-io. - * - * This will fail if stdio.h is included before contiki.h, but it is common - * practice to include contiki.h first - */ -#include -#undef putchar -/*---------------------------------------------------------------------------*/ -#endif /* ARM_DEF_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/arm/common/SD-card/Makefile.sdcard b/arch/cpu/arm/common/SD-card/Makefile.sdcard deleted file mode 100644 index 0c1137127..000000000 --- a/arch/cpu/arm/common/SD-card/Makefile.sdcard +++ /dev/null @@ -1,10 +0,0 @@ - -ifdef SDCARD -EFSL_DIR=/home/ksb/packages/efsl/efsl-0.2.8 -EFSL_SRC= efs.c fat.c sd.c fat.c partition.c ioman.c disc.c fs.c file.c plibc.c extract.c dir.c time.c ls.c ui.c -CONTIKI_CPU_DIRS += ../common/SD-card -CONTIKIDIRS += $(EFSL_DIR)/src $(EFSL_DIR)/src/interfaces -CONTIKI_TARGET_SOURCEFILES += $(EFSL_SRC) cfs-sdcard.c efs-sdcard-arch.c -CFLAGS+= -I $(EFSL_DIR)/inc -I $(CONTIKI_CPU_ARM_COMMON)/SD-card - -endif \ No newline at end of file diff --git a/arch/cpu/arm/common/SD-card/cfs-sdcard.c b/arch/cpu/arm/common/SD-card/cfs-sdcard.c deleted file mode 100644 index 4c44e3e6b..000000000 --- a/arch/cpu/arm/common/SD-card/cfs-sdcard.c +++ /dev/null @@ -1,187 +0,0 @@ -#include -#include -#include - -#include - - - -process_event_t sdcard_inserted_event; - -process_event_t sdcard_removed_event; - - - -#define MAX_FDS 4 - -static File file_descriptors[MAX_FDS]; - -static int -find_free_fd() -{ - int fd; - for (fd = 0; fd < MAX_FDS; fd++) { - if (!file_getAttr(&file_descriptors[fd], FILE_STATUS_OPEN)) { - return fd; - } - } - return -1; -} - -static File * -get_file(int fd) -{ - if (!sdcard_ready()) return 0; - if (fd >= MAX_FDS || fd < 0) return NULL; - if (!file_getAttr(&file_descriptors[fd], FILE_STATUS_OPEN)) return NULL; - return &file_descriptors[fd]; -} - -int -cfs_open (const char *name, int flags) -{ - static int initialized = 0; - eint8 mode; - int fd; - if (!initialized) { - int fd; - /* Mark all file descriptors as free */ - for (fd = 0; fd < MAX_FDS; fd++) { - file_setAttr(&file_descriptors[fd], FILE_STATUS_OPEN,0); - } - } - if (!sdcard_ready()) return -1; - fd = find_free_fd(); - if (fd < 0) return -1; - if (flags == CFS_READ) { - mode = MODE_READ; - } else { - mode = MODE_APPEND; - } - if (file_fopen(&file_descriptors[fd], efs_sdcard_get_fs(), - (char*)name, mode) < 0) { - return -1; - } - return fd; -} - -void -cfs_close(int fd) -{ - File *file = get_file(fd); - if (!file) return; - file_fclose(file); - fs_flushFs(efs_sdcard_get_fs()); -} - -int -cfs_read (int fd, void *buf, unsigned int len) -{ - File *file = get_file(fd); - if (!file) return 0; - return file_read(file, len, (euint8*)buf); -} - -int -cfs_write (int fd, const void *buf, unsigned int len) -{ - File *file = get_file(fd); - if (!file) return 0; - return file_write(file, len, (euint8*)buf); -} - -cfs_offset_t -cfs_seek (int fd, cfs_offset_t offset, int whence) -{ - File *file; - if (whence != CFS_SEEK_SET) return -1; - file = get_file(fd); - if (!file) return 0; - if (file_setpos(file, offset) != 0) return -1; - return file->FilePtr; -} - - -/* Cause a compile time error if expr is false */ -#ifdef __GNUC__ -#define COMPILE_TIME_CHECK(expr) \ -(void) (__builtin_choose_expr ((expr), 0, ((void)0))+3) -#else -#define COMPILE_TIME_CHECK(expr) -#endif - -#define MAX_DIR_LISTS 4 -DirList dir_lists[MAX_DIR_LISTS]; - -static DirList * -find_free_dir_list() -{ - unsigned int l; - for(l = 0; l < MAX_DIR_LISTS; l++) { - if (dir_lists[l].fs == NULL) { - return &dir_lists[l]; - } - } - return NULL; -} - -int -cfs_opendir (struct cfs_dir *dirp, const char *name) -{ - DirList *dirs; - COMPILE_TIME_CHECK(sizeof(DirList*) <= sizeof(struct cfs_dir)); - if (!sdcard_ready()) return -1; - dirs = find_free_dir_list(); - if (!dirs) return -1; - if (ls_openDir(dirs, efs_sdcard_get_fs(), (eint8*)name) != 0) { - dirs->fs = NULL; - return -1; - } - *(DirList**)dirp = dirs; - return 0; -} - -int -cfs_readdir (struct cfs_dir *dirp, struct cfs_dirent *dirent) -{ - euint8 *start; - euint8 *end; - char *to = dirent->name; - DirList *dirs = *(DirList**)dirp; - if (!sdcard_ready()) return 1; - if (ls_getNext(dirs) != 0) return 1; - start = dirs->currentEntry.FileName; - end = start + 7; - while(end > start) { - if (*end > ' ') { - end++; - break; - } - end--; - } - while(start < end) { - *to++ = *start++; - } - start = dirs->currentEntry.FileName + 8; - end = start + 3; - if (*start > ' ') { - *to++ = '.'; - *to++ = *start++; - while(start < end && *start > ' ') { - *to++ = *start++; - } - } - *to = '\0'; - if (dirs->currentEntry.Attribute & ATTR_DIRECTORY) { - dirent->size = 0; - } else { - dirent->size = dirs->currentEntry.FileSize; - } - return 0; -} - -void -cfs_closedir (struct cfs_dir *dirp) -{ - (*(DirList**)dirp)->fs = NULL; -} diff --git a/arch/cpu/arm/common/SD-card/config.h b/arch/cpu/arm/common/SD-card/config.h deleted file mode 100644 index d942669ce..000000000 --- a/arch/cpu/arm/common/SD-card/config.h +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef EFSL_CONFIG_H_ -#define EFSL_CONFIG_H_ - -/* Close enough */ -#define HW_ENDPOINT_LPC2000_SD - -/* Memory configuration - -------------------- - - * Here you must configure wheter your processor can access memory byte - * oriented. All x86 processors can do it, AVR's can do it to. Some DSP - * or other microcontrollers can't. If you have an 8 bit system you're safe. - * If you are really unsure, leave the setting commented out, it will be slower - * but it will work for sure. -*/ - - /* disabled for ARM (mt): #define BYTE_ALIGNMENT */ - -/* Cache configuration - ------------------- - - * Here you must configure how much memory of cache you can/want to use. - * The number you put at IOMAN_NUMBUFFER is multiplied by 512. So 1 means - * 512 bytes cache, 4 means 2048 bytes cache. More is better. - * The number after IOMAN_NUMITERATIONS should be untouched. - * The last field (IOMAN_DO_MEMALLOC) is to tell ioman to allocate it's - * own memory in it's structure, or not. If you choose to do it yourself - * you will have to pass a pointer to the memory as the last argument of - * ioman_init. -*/ - /*#define IOMAN_NUMBUFFER 1*/ - #define IOMAN_NUMBUFFER 6 - #define IOMAN_NUMITERATIONS 3 - #define IOMAN_DO_MEMALLOC - -/* Cluster pre-allocation - ---------------------- - - * When writing files, the function that performs the actual write has to - * calculate how many clusters it will need for that request. It then allocates - * that number of new clusters to the file. Since this involves some calculations - * and writing of the FAT, you might find it beneficial to limit the number of - * allocations, and allow fwrite to pre-allocate a number of clusters extra. - * This setting determines how many clusters will be extra allocated whenever - * this is required. - * Take in carefull consideration how large your clustersize is, putting 10 here - * with a clustersize of 32kb means you might waste 320 kb. - * The first option is for preallocating files, the other is used when enlarging - * a directory to accomodate more files -*/ - /*#define CLUSTER_PREALLOC_FILE 0*/ - #define CLUSTER_PREALLOC_FILE 2 - #define CLUSTER_PREALLOC_DIRECTORY 0 - - -/* Endianess configuration - ----------------------- - - * Here you can configure wheter your architecture is little or big endian. This - * is important since all FAT structures are stored in intel little endian order. - * So if you have a big endian system the library has to convert all figures to - * big endian in order to work. - */ - #define LITTLE_ENDIAN - - -/* Date and Time support - --------------------- - - * Here you can enable or disable date and time support. If you enable - * it you will have to create 6 functions, that are described in the - * EFSL manual. If the functions are not present when linking your - * program with the library you will get unresolved dependencies. - */ - /*#define DATE_TIME_SUPPORT*/ - -/* Error reporting support - ----------------------- - - * When you receive an error in userland, it usually only gives limited - * information (most likely, fail or success). If error detection and - * reporting is important for you, you can enable more detailed error - * reporting here. This is optional, the costs are 1 byte per object, - * and a small increase in code size. - * You can enable error recording for all object, or you can select the - * object manually. - * For full error reporting use FULL_ERROR_SUPPORT - * For only the base-core of the library use BASE_ERROR_SUPPORT - * For IO/Man use ERRSUP_IOMAN - * For Disc use ERRSUP_IOMAN - * For Part use ERRSUP_PARTITION - * For Fs use ERRSUP_FILESYSTEM - * For File use ERRSUP_FILE -*/ - - #define FULL_ERROR_SUPPORT - /*#define BASE_ERROR_SUPPORT*/ - -/* List options - ------------ - - * In this section youcan configure what kind of data you will get from - * directory listing requests. Please refer to the documentation for - * more information -*/ - -#define LIST_MAXLENFILENAME 12 - - - - -/* Debugging configuration - ----------------------- - - * Here you can configure the debugging behaviour. Debugging is different - * on every platform (see debug.h for more information). - * If your hardware has no means of output (printf) dont define any anything, - * and nothing will happen. For real world use debugging should be turned off. -*/ - -/* #define DEBUG */ - -#define lpc2000_debug_printf dbg_blocking_printf - -#endif diff --git a/arch/cpu/arm/common/SD-card/efs-sdcard.h b/arch/cpu/arm/common/SD-card/efs-sdcard.h deleted file mode 100644 index d4659abf0..000000000 --- a/arch/cpu/arm/common/SD-card/efs-sdcard.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef SDCARD_H_KJBBKS6O57__ -#define SDCARD_H_KJBBKS6O57__ - -#include -#include -#include - -PROCESS_NAME(sdcard_process); - -void -efs_sdcard_init(); - -FileSystem * -efs_sdcard_get_fs(); - -/* True if a card is ready to read or write */ -int -sdcard_ready(); - -extern process_event_t sdcard_inserted_event; - -extern process_event_t sdcard_removed_event; - -void -sdcard_event_process(struct process *p); - -#endif /* SDCARD_H_KJBBKS6O57__ */ diff --git a/arch/cpu/arm/common/SD-card/efsl_spi.h b/arch/cpu/arm/common/SD-card/efsl_spi.h deleted file mode 100644 index f51b088ca..000000000 --- a/arch/cpu/arm/common/SD-card/efsl_spi.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef EFSL_SPI_H_6B6MX40N68__ -#define EFSL_SPI_H_6B6MX40N68__ - -#include - -struct hwInterface{ - eint32 sectorCount; -}; -typedef struct hwInterface hwInterface; - -esint8 if_initInterface(hwInterface* file,eint8* opts); -esint8 if_readBuf(hwInterface* file,euint32 address,euint8* buf); -esint8 if_writeBuf(hwInterface* file,euint32 address,euint8* buf); -esint8 if_setPos(hwInterface* file,euint32 address); - -void if_spiInit(hwInterface *iface); -void if_spiSetSpeed(euint8 speed); -euint8 if_spiSend(hwInterface *iface, euint8 outgoing); - - -#endif /* EFSL_SPI_H_6B6MX40N68__ */ diff --git a/arch/cpu/arm/common/SD-card/sdcard.h b/arch/cpu/arm/common/SD-card/sdcard.h deleted file mode 100644 index 1f8a88bde..000000000 --- a/arch/cpu/arm/common/SD-card/sdcard.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef SDCARD_H_KJBBKS6O57__ -#define SDCARD_H_KJBBKS6O57__ - -#include - -PROCESS_NAME(sdcard_process); - -void -sdcard_init(); - -/* True if a card is ready to read or write */ -int -sdcard_ready(); - -extern process_event_t sdcard_inserted_event; - -extern process_event_t sdcard_removed_event; - -void -sdcard_event_process(struct process *p); - -#endif /* SDCARD_H_KJBBKS6O57__ */ diff --git a/arch/cpu/arm/common/usb/Makefile.usb b/arch/cpu/arm/common/usb/Makefile.usb deleted file mode 100644 index 05266cf7b..000000000 --- a/arch/cpu/arm/common/usb/Makefile.usb +++ /dev/null @@ -1,60 +0,0 @@ -### Put generated sources in a separate directory -BUILTSRCDIR = src_$(TARGET) -ifeq (${wildcard $(BUILTSRCDIR)},) - DUMMY := ${shell mkdir $(BUILTSRCDIR)} -endif - -STRUCTGEN = structgen - -MODULES_REL += $(BUILTSRCDIR) - -USB_STRING_DESCRIPTORS ?= $(CONTIKI_CPU_ARM)/common/usb/cdc-acm/string-descriptors.xml - -XMLDIRS= - -USB = usb-arch.c usb-core.c - -ifdef USB_CDC_ACM_CLASS -CONTIKI_CPU_DIRS += ../common/usb/cdc-acm -USB += cdc-acm.c cdc-acm-descriptors.c cdc-acm-string-descriptors.c -XMLDIRS += $(CONTIKI_CPU_ARM)/common/usb/cdc-acm/ -endif - -ifdef USB_CDC_ETH_CLASS -CONTIKI_CPU_DIRS += ../common/usb/cdc-eth -USB += cdc-eth.c cdc-eth-descriptors.c cdc-eth-string-descriptors.c dhcps.c -XMLDIRS += $(CONTIKI_CPU_ARM)/common/usb/cdc-eth/ -endif - -ifdef USB_MASS_STORAGE_CLASS -CONTIKI_CPU_DIRS += ../common/usb/msc -USB += usb-msc-bulk.c usb-rbc.c msc-descriptors-consts.c msc-descriptors.c -XMLDIRS += $(CONTIKI_CPU_ARM)/common/usb/msc -endif - -ifdef USB_MSC_QIC157 -CONTIKI_CPU_DIRS += ../common/usb/msc -USB += usb-msc-bulk.c usb-qic157.c msc-qic157-descriptors.c msc-qic157-string-descriptors.c -XMLDIRS += $(CONTIKI_CPU_ARM)/common/usb/msc -endif - -ifdef USB_MSC_STREAMING -CONTIKI_CPU_DIRS += ../common/usb/msc -USB += usb-msc-bulk.c usb-streaming.c msc-scsi-streaming-descriptors-consts.c msc-scsi-streaming-descriptors.c -XMLDIRS += $(CONTIKI_CPU_ARM)/common/usb/msc -endif - -ifdef USB_MTP_CLASS -CONTIKI_CPU_DIRS += ../common/usb/mtp -USB += usb-mtp.c mtp-descriptors-consts.c mtp-descriptors.c -STRUCTGENDIRS += $(CONTIKI_CPU_ARM)/common/usb/mtp -endif - -vpath %.xml $(XMLDIRS) -vpath %.gen.c $(STRUCTGENDIRS) - -%.c: %.xml - $(XSLTPROC) $(CONTIKI_CPU_ARM)/common/usb/string-descriptors.xslt $^ >$(BUILTSRCDIR)/$@ - -%-consts.c: %.gen.c - $(CPP) -I$(CFLAGS) $< | $(STRUCTGEN) --output $(BUILTSRCDIR)/$*-consts.c \ No newline at end of file diff --git a/arch/cpu/arm/common/usb/cdc-acm/cdc-acm-descriptors.c b/arch/cpu/arm/common/usb/cdc-acm/cdc-acm-descriptors.c deleted file mode 100644 index 696f2e455..000000000 --- a/arch/cpu/arm/common/usb/cdc-acm/cdc-acm-descriptors.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "descriptors.h" -#include -#include -#include - -const struct usb_st_device_descriptor device_descriptor = - { - sizeof(struct usb_st_device_descriptor), - DEVICE, - 0x0210, - CDC, - 0, - 0, - CTRL_EP_SIZE, - 0xffff, - 0xffff, - 0x0030, - 2, - 1, - 3, - 1 - }; - -const struct configuration_st { - struct usb_st_configuration_descriptor configuration; - struct usb_st_interface_descriptor comm; - struct usb_cdc_header_func_descriptor header; - struct usb_cdc_abstract_ctrl_mgmnt_func_descriptor abstract_ctrl; - struct usb_cdc_union_func_descriptor union_descr; - struct usb_cdc_call_mgmnt_func_descriptor call_mgmt; -#if 1 - struct usb_st_endpoint_descriptor ep_notification; -#endif - struct usb_st_interface_descriptor data; - struct usb_st_endpoint_descriptor ep_in; - struct usb_st_endpoint_descriptor ep_out; -} BYTE_ALIGNED configuration_block = - { - /* Configuration */ - { - sizeof(configuration_block.configuration), - CONFIGURATION, - sizeof(configuration_block), - 2, - 1, - 0, - 0x80, - 50 - }, - { - sizeof(configuration_block.comm), - INTERFACE, - 0, - 0, - 1, - CDC, - ABSTRACT_CONTROL_MODEL, - V_25TER_PROTOCOL, - 0 - }, - { - sizeof(configuration_block.header), - CS_INTERFACE, - CDC_FUNC_DESCR_HEADER, - 0x0110 - }, - { - sizeof(configuration_block.abstract_ctrl), - CS_INTERFACE, - CDC_FUNC_DESCR_ABSTRACT_CTRL_MGMNT, - 0 - }, - { - sizeof(configuration_block.union_descr), - CS_INTERFACE, - CDC_FUNC_DESCR_UNION, - 0, /* Master */ - {1} /* Slave */ - }, - { - sizeof(configuration_block.call_mgmt), - CS_INTERFACE, - CDC_FUNC_DESCR_CALL_MGMNT, - 0x02, - 1 /* data interface */ - }, - { - sizeof(configuration_block.ep_notification), - ENDPOINT, - 0x83, - 0x03, - USB_EP3_SIZE, - 100 - }, - { - sizeof(configuration_block.data), - INTERFACE, - 1, - 0, - 2, - CDC_DATA, - 0, - TRANSPARENT_PROTOCOL, - 0 - }, - { - sizeof(configuration_block.ep_in), - ENDPOINT, - 0x81, - 0x02, - USB_EP1_SIZE, - 0 - }, - { - sizeof(configuration_block.ep_out), - ENDPOINT, - 0x02, - 0x02, - USB_EP2_SIZE, - 0 - } - - }; - -const struct usb_st_configuration_descriptor* const configuration_head = -(const struct usb_st_configuration_descriptor*)&configuration_block; diff --git a/arch/cpu/arm/common/usb/cdc-acm/cdc-acm-string-descriptors.xml b/arch/cpu/arm/common/usb/cdc-acm/cdc-acm-string-descriptors.xml deleted file mode 100644 index 01d14f2c4..000000000 --- a/arch/cpu/arm/common/usb/cdc-acm/cdc-acm-string-descriptors.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - 0x0409 - 0x041d - - - - Serial interface - Serieport - - - Fluffware - - - 0.01 - - - diff --git a/arch/cpu/arm/common/usb/cdc-acm/cdc-acm.c b/arch/cpu/arm/common/usb/cdc-acm/cdc-acm.c deleted file mode 100644 index 792313327..000000000 --- a/arch/cpu/arm/common/usb/cdc-acm/cdc-acm.c +++ /dev/null @@ -1,110 +0,0 @@ -#include -#include -#include -#include -#include - -static uint8_t usb_ctrl_data_buffer[32]; - -static void -encapsulated_command(uint8_t *data, unsigned int length) -{ - printf("Got CDC command: length %d\n", length); - usb_send_ctrl_status(); -} -static void -set_line_encoding(uint8_t *data, unsigned int length) -{ - if (length == 7) { - static const char parity_char[] = {'N', 'O', 'E', 'M', 'S'}; - static const char *stop_bits_str[] = {"1","1.5","2"}; - const struct usb_cdc_line_coding *coding = - (const struct usb_cdc_line_coding *)usb_ctrl_data_buffer; - char parity = ((coding->bParityType > 4) - ? '?' : parity_char[coding->bParityType]); - const char *stop_bits = ((coding->bCharFormat > 2) - ? "?" : stop_bits_str[coding->bCharFormat]); - printf("Got CDC line coding: %ld/%d/%c/%s\n", - coding->dwDTERate, coding->bDataBits, parity, stop_bits); - usb_send_ctrl_status(); - } else { - usb_error_stall(); - } -} - -static unsigned int -handle_cdc_acm_requests() -{ - printf("CDC request %02x %02x\n", usb_setup_buffer.bmRequestType, usb_setup_buffer.bRequest); - switch(usb_setup_buffer.bmRequestType) { - case 0x21: /* CDC interface OUT requests */ - /* Check if it's the right interface */ - if (usb_setup_buffer.wIndex != 0) return 0; - switch(usb_setup_buffer.bRequest) { - case SET_CONTROL_LINE_STATE: - if (usb_setup_buffer.wValue & 0x02) { - puts("Carrier on"); - } else { - puts("Carrier off"); - } - if (usb_setup_buffer.wValue & 0x01) { - puts("DTE on"); - } else { - puts("DTE off"); - } - usb_send_ctrl_status(); - return 1; - - case SEND_ENCAPSULATED_COMMAND: - { - unsigned int len = usb_setup_buffer.wLength; - if (len > sizeof(usb_ctrl_data_buffer)) - len = sizeof(usb_ctrl_data_buffer); - usb_get_ctrl_data(usb_ctrl_data_buffer, len, - encapsulated_command); - } - - return 1; - - - case SET_LINE_CODING: - { - unsigned int len = usb_setup_buffer.wLength; - if (len > sizeof(usb_ctrl_data_buffer)) - len = sizeof(usb_ctrl_data_buffer); - usb_get_ctrl_data(usb_ctrl_data_buffer, len, - set_line_encoding); - } - return 1; - } - break; - case 0xa1: /* CDC interface IN requests */ - if (usb_setup_buffer.wIndex != 0) return 0; - switch(usb_setup_buffer.bRequest) { - case GET_ENCAPSULATED_RESPONSE: - printf("CDC response"); - usb_send_ctrl_status(); - return 1; - } - } - return 0; -} - -static const struct USBRequestHandler cdc_acm_request_handler = - { - 0x21, 0x7f, - 0x00, 0x00, - handle_cdc_acm_requests - }; - -static struct USBRequestHandlerHook cdc_acm_request_hook = - { - NULL, - &cdc_acm_request_handler - }; - -void -usb_cdc_acm_setup() -{ - usb_register_request_handler(&cdc_acm_request_hook); -} diff --git a/arch/cpu/arm/common/usb/cdc-acm/cdc-acm.h b/arch/cpu/arm/common/usb/cdc-acm/cdc-acm.h deleted file mode 100644 index f4bb9b388..000000000 --- a/arch/cpu/arm/common/usb/cdc-acm/cdc-acm.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CDC_ACM_H_UFV6K50827__ -#define CDC_ACM_H_UFV6K50827__ - -void -usb_cdc_acm_setup(); - -#endif /* CDC_ACM_H_UFV6K50827__ */ diff --git a/arch/cpu/arm/common/usb/cdc-acm/cdc.h b/arch/cpu/arm/common/usb/cdc-acm/cdc.h deleted file mode 100644 index 7636dfdcc..000000000 --- a/arch/cpu/arm/common/usb/cdc-acm/cdc.h +++ /dev/null @@ -1,214 +0,0 @@ -#ifndef CDC_H_K1Q26ESJOC__ -#define CDC_H_K1Q26ESJOC__ -#include -/* Communication Class */ -/* Class code */ -#define CDC 0x02 - -/* Interface subclass codes */ -#define CDC_RESERVED 0x00 -#define DIRECT_LINE_CONTROL_MODEL 0x01 -#define ABSTRACT_CONTROL_MODEL 0x02 -#define TELEPHONE_CONTROL_MODEL 0x03 -#define MULTI_CHANNEL_CONTROL_MODEL 0x04 -#define CAPI_CONTROL_MODEL 0x05 -#define ETHERNET_NETWORKING_CONTROL_MODEL 0x06 -#define ATM_NETWORKING_CONTROL_MODEL 0x07 - -/* Protocols */ -#define V_25TER_PROTOCOL 0x01 - -/* Requests */ -#define SEND_ENCAPSULATED_COMMAND 0x00 -#define GET_ENCAPSULATED_RESPONSE 0x01 -#define SET_COMM_FEATURE 0x02 -#define GET_COMM_FEATURE 0x03 -#define CLEAR_COMM_FEATURE 0x04 - -#define SET_AUX_LINE_STATE 0x10 -#define SET_HOOK_STATE 0x11 -#define PULSE_SETUP 0x12 -#define SEND_PULSE 0x13 -#define SET_PULSE_TIME 0x14 -#define RING_AUX_JACK 0x15 - -#define SET_LINE_CODING 0x20 -#define GET_LINE_CODING 0x21 -#define SET_CONTROL_LINE_STATE 0x22 -#define SEND_BREAK 0x23 - -#define SET_RINGER_PARMS 0x30 -#define GET_RINGER_PARMS 0x31 -#define SET_OPERATION_PARMS 0x32 -#define GET_OPERATION_PARMS 0x33 -#define SET_LINE_PARMS 0x34 -#define GET_LINE_PARMS 0x35 -#define DIAL_DIGITS 0x36 - -#define SET_UNIT_PARAMETER 0x37 -#define GET_UNIT_PARAMETER 0x38 -#define CLEAR_UNIT_PARAMETER 0x39 - -#define GET_PROFILE 0x3a - -#define SET_ETHERNET_MULTICAST_FILTERS 0x40 -#define GET_ETHERNET_MULTICAST_FILTERS 0x41 -#define GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER 0x42 -#define SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER 0x43 -#define GET_ETHERNET_STATISTIC 0x44 - -#define SET_ATM_D ATA_FORMAT 0x50 -#define GET_ATM_DEVICE_STATISTICS 0x51 -#define SET_ATM_DEFAULT_VC 0x52 -#define GET_ATM_VC_STATISTICS 0x53 - - -/* Notifications */ -#define NETWORK_CONNECTION 0x00 -#define RESPONSE_AVAILABLE 0x01 - -#define AUX_JACK_HOOK_STATE 0x08 -#define RING_DETECT 0x09 - -#define SERIAL_STATE 0x20 - -#define CALL_STATE_CHANGE 0x28 -#define LINE_STATE_CHANGE 0x29 -#define CONNECTION_SPEED_CHANGE 0x2a - -/* Data interface */ - -/* Class code */ -#define CDC_DATA 0x0a - -/* Protocols */ -#define I_430_PROTOCOL 0x30 -#define ISO_IEC_3_1993_PROTOCOL 0x31 -#define TRANSPARENT_PROTOCOL 0x32 -#define Q_921M_PROTOCOL 0x50 -#define Q_921_PROTOCOL 0x51 -#define Q_921TM_PROTOCOL 0x52 -#define V_42BIS_PROTOCOL 0x90 -#define Q_931_PROTOCOL 0x91 -#define V_120_PROTOCOL 0x93 -#define CDC_PROTOCOL 0xfe - -/* Descriptor subtypes */ - -#define CDC_FUNC_DESCR_HEADER 0x00 -#define CDC_FUNC_DESCR_CALL_MGMNT 0x01 -#define CDC_FUNC_DESCR_ABSTRACT_CTRL_MGMNT 0x02 -#define CDC_FUNC_DESCR_DIRECT_LINE_MGMNT 0x03 -#define CDC_FUNC_DESCR_RINGER_MGMNT 0x04 -#define CDC_FUNC_DESCR_TEL_STATE 0x05 -#define CDC_FUNC_DESCR_UNION 0x06 -#define CDC_FUNC_DESCR_COUNTRY 0x07 -#define CDC_FUNC_DESCR_TEL_MODE 0x08 -#define CDC_FUNC_DESCR_USB_TERM 0x09 -#define CDC_FUNC_DESCR_NET_TERM 0x0a -#define CDC_FUNC_DESCR_PROTOCOL_UNIT 0x0b -#define CDC_FUNC_DESCR_EXTENSION_UNIT 0x0c -#define CDC_FUNC_DESCR_MULTICH_MGMNT 0x0d -#define CDC_FUNC_DESCR_CAPI_MGMNT 0x0e -#define CDC_FUNC_DESCR_ETHERNET 0x0f -#define CDC_FUNC_DESCR_ATM 0x10 - - - -struct usb_cdc_header_func_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_HEADER subtype */ - Uint16 bcdCDC; /* Revision of class specification */ -} BYTE_ALIGNED; - -struct usb_cdc_call_mgmnt_func_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_CALL_MGMNT subtype */ - Uchar bmCapabilities; /* Capabilities */ - Uchar bDataInterface; /* Management data interface */ -} BYTE_ALIGNED; - -struct usb_cdc_abstract_ctrl_mgmnt_func_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_ABSTRACT_CTRL_MGMNT subtype*/ - Uchar bmCapabilities; /* Capabilities */ -} BYTE_ALIGNED; - -struct usb_cdc_direct_line_mgmnt_func_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_DIRECT_LINE_MGMNT subtype*/ - Uchar bmCapabilities; /* Capabilities */ -} BYTE_ALIGNED; - -struct usb_cdc_ringer_mgmnt_func_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_RINGER_MGMNT subtype*/ - Uchar bRingerVolSteps; /* Ringer volume steps */ - Uchar bNumRingerPatterns; /* Number of ringer patterns supported */ -} BYTE_ALIGNED; - -struct usb_cdc_tel_mode_func_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_TEL_MODE subtype*/ - Uchar bmCapabilities; /* Capabilities */ -} BYTE_ALIGNED; - -struct usb_cdc_tel_state_func_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_TEL_STATE subtype*/ - Uchar bmCapabilities; /* Capabilities */ -} BYTE_ALIGNED; - -struct usb_cdc_union_func_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_UNION subtype*/ - Uchar bMasterInterface; /* Master interface for union */ - Uchar bSlaveInterface[1]; /* Slave interfaces in union */ -} BYTE_ALIGNED; - -struct usb_cdc_country_func_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_COUNTRY subtype*/ - Uchar iCountryCodeRelDate; /* Release date for country codes */ - Uint16 wCountryCode[1]; /* Country codes */ -} BYTE_ALIGNED; - -struct usb_cdc_ethernet_func_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_ETHERNET subtype*/ - Uchar iMACAddress; /* MAC address string descriptor */ - Uint32 bmEthernetStatistics; /* Supported statistics */ - Uint16 wMaxSegmentSize; - Uint16 wNumberMCFilters; /* Number of multicast filters */ - Uchar bNumberPowerFilters; /* Number of wake-up pattern filters */; -} BYTE_ALIGNED; - -struct usb_cdc_line_coding -{ - Uint32 dwDTERate; - Uchar bCharFormat; - Uchar bParityType; - Uchar bDataBits; -} BYTE_ALIGNED; - -#endif /* CDC_H_K1Q26ESJOC__ */ diff --git a/arch/cpu/arm/common/usb/descriptors.h b/arch/cpu/arm/common/usb/descriptors.h deleted file mode 100644 index 6c89f3c03..000000000 --- a/arch/cpu/arm/common/usb/descriptors.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef DESCRIPTORS_H_RPFUB8O7OV__ -#define DESCRIPTORS_H_RPFUB8O7OV__ - -#ifndef STRUCTGEN -#include "usb.h" -#endif - -extern const struct usb_st_device_descriptor device_descriptor; -extern const struct usb_st_configuration_descriptor* const configuration_head; -#endif /* DESCRIPTORS_H_RPFUB8O7OV__ */ diff --git a/arch/cpu/arm/common/usb/msc/msc-descriptors.c b/arch/cpu/arm/common/usb/msc/msc-descriptors.c deleted file mode 100644 index 0c75e7693..000000000 --- a/arch/cpu/arm/common/usb/msc/msc-descriptors.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "descriptors.h" -#include "usb-msc-bulk.h" -#include - -const struct usb_st_device_descriptor device_descriptor = - { - sizeof(struct usb_st_device_descriptor), - DEVICE, - 0x0210, - 0, - 0, - 0, - CTRL_EP_SIZE, - 0xffff, - 0xffff, - 0x0030, - 2, - 1, - 3, - 1 - }; - -const struct configuration_st { - struct usb_st_configuration_descriptor configuration; - struct usb_st_interface_descriptor massbulk; - struct usb_st_endpoint_descriptor ep_in; - struct usb_st_endpoint_descriptor ep_out; -} BYTE_ALIGNED configuration_block = - { - /* Configuration */ - { - sizeof(configuration_block.configuration), - CONFIGURATION, - sizeof(configuration_block), - 1, - 1, - 0, - 0x80, - 50 - }, - { - sizeof(configuration_block.massbulk), - INTERFACE, - 0, - 0, - 2, - MASS_STORAGE, - MASS_RBC, - MASS_BULK_ONLY, - 0 - }, - { - sizeof(configuration_block.ep_in), - ENDPOINT, - 0x81, - 0x02, - 64, - 0 - }, - { - sizeof(configuration_block.ep_out), - ENDPOINT, - 0x02, - 0x02, - 64, - 0 - } - - }; - -const struct usb_st_configuration_descriptor const *configuration_head = -(struct usb_st_configuration_descriptor const*)&configuration_block; diff --git a/arch/cpu/arm/common/usb/msc/msc-string-descriptors.xml b/arch/cpu/arm/common/usb/msc/msc-string-descriptors.xml deleted file mode 100644 index 6fda8d23c..000000000 --- a/arch/cpu/arm/common/usb/msc/msc-string-descriptors.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - 0x0409 - - - - USB mass storage test - - - Fluffware - - - F00000000001 - - - diff --git a/arch/cpu/arm/common/usb/msc/rbc_const.h b/arch/cpu/arm/common/usb/msc/rbc_const.h deleted file mode 100644 index 3e9afb99a..000000000 --- a/arch/cpu/arm/common/usb/msc/rbc_const.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef RBC_CONST_H_7YXZF39S33__ -#define RBC_CONST_H_7YXZF39S33__ - -#include - -/* SCSI operation codes */ -/* Additional commands for RBC */ - -#define SCSI_CMD_FORMAT_UNIT 0x04 -#define SCSI_CMD_READ_10 0x28 -#define SCSI_CMD_READ_CAPACITY 0x25 -#define SCSI_CMD_START_STOP_UNIT 0x1B -#define SCSI_CMD_SYNCHRONIZE_CACHE 0x35 -#define SCSI_CMD_TEST_UNIT_READY 0x00 -#define SCSI_CMD_VERIFY_10 0x2F -#define SCSI_CMD_WRITE_10 0x2A - -/* Status codes */ -/* From SAM-2 */ -#define SCSI_STATUS_GOOD 0x00 -#define SCSI_STATUS_CHECK_CONDITION 0x02 -#define SCSI_STATUS_CONDITION _MET 0x04 -#define SCSI_STATUS_BUSY 0x08 -#define SCSI_STATUS_INTERMEDIATE 0x10 -#define SCSI_STATUS_INTERMEDIATE_CONDITION_MET 0x14 -#define SCSI_STATUS_RESERVATION_CONFLICT 0x18 -#define SCSI_STATUS_TASK_SET_FULL 0x28 -#define SCSI_STATUS_ACA_ACTIVE 0x30 -#define SCSI_STATUS_TASK_ABORTED 0x40 - -/* Sense keys */ -#define SCSI_SENSE_KEY_NO_SENSE 0x0 -#define SCSI_SENSE_KEY_RECOVERED_ERROR 0x1 -#define SCSI_SENSE_KEY_NOT_READY 0x2 -#define SCSI_SENSE_KEY_MEDIUM_ERROR 0x3 -#define SCSI_SENSE_KEY_HARDWARE_ERROR 0x4 -#define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x5 -#define SCSI_SENSE_KEY_UNIT_ATTENTION 0x6 -#define SCSI_SENSE_KEY_DATA_PROTECT 0x7 -#define SCSI_SENSE_KEY_BLANK_CHECK 0x8 -#define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x9 -#define SCSI_SENSE_KEY_COPY_ABORTED 0xA -#define SCSI_SENSE_KEY_ABORTED_COMMAND 0xB -#define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0xD -#define SCSI_SENSE_KEY_MISCOMPARE 0xE - -/* Additional sense codes */ -#define SCSI_ASC_NO_SENSE 0x0000 -#define SCSI_ASC_INVALID_COMMAND_OPERATION 0x2000 -#define SCSI_ASC_INVALID_FIELD_IN_PARAMETER_LIST 0x2600 - -#define SCSI_ASC_INVALID_FIELD_IN_CDB 0x2400 - -/* RBC mode page */ -#define SCSI_MODE_RBC_DEVICE_PAGE 0x06 -#define SCSI_MODE_WCD 0x01 -#define SCSI_MODE_READD 0x08 -#define SCSI_MODE_WRITED 0x04 -#define SCSI_MODE_FORMATD 0x02 -#define SCSI_MODE_LOCKD 0x01 - -/* WRITE(10) command flags */ - -#define SCSI_WRITE_FUA 0x08 - -#endif /* RBC_CONST_H_7YXZF39S33__ */ diff --git a/arch/cpu/arm/common/usb/msc/rbc_struct.h b/arch/cpu/arm/common/usb/msc/rbc_struct.h deleted file mode 100644 index 73c296fc9..000000000 --- a/arch/cpu/arm/common/usb/msc/rbc_struct.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef RBC_STRUCT_H_10L0HKARRV__ -#define RBC_STRUCT_H_10L0HKARRV__ - -#include - -struct rbc_read_capacity_cmd -{ - uint8_t op_code; - uint8_t reserved1; - uint8_t reserved2; - uint8_t reserved3; - uint8_t reserved4; - uint8_t reserved5; - uint8_t reserved6; - uint8_t reserved7; - uint8_t reserved8; - uint8_t control; -} CC_BYTE_ALIGNED; - -struct rbc_read_capacity_data -{ - uint32_bytes last_logical_block; - uint32_bytes block_length; -} CC_BYTE_ALIGNED; - -struct rbc_device_parameters_page -{ - struct spc2_mode_page head; - uint8_t flags1; - uint16_bytes logical_block_size; - uint40_bytes num_logical_blocks; - uint8_t power_performance; - uint8_t flags2; - uint8_t reserved; -} CC_BYTE_ALIGNED; - -struct rbc_read_cmd -{ - uint8_t op_code; - uint8_t reserved1; - uint32_bytes logical_block_address; - uint8_t reserved2; - uint16_bytes transfer_length; - uint8_t control; -} CC_BYTE_ALIGNED; - -struct rbc_write_cmd -{ - uint8_t op_code; - uint8_t flags; - uint32_bytes logical_block_address; - uint8_t reserved; - uint16_bytes transfer_length; - uint8_t control; -} CC_BYTE_ALIGNED; - - -#endif /* RBC_STRUCT_H_10L0HKARRV__ */ diff --git a/arch/cpu/arm/common/usb/msc/scsi_command.h b/arch/cpu/arm/common/usb/msc/scsi_command.h deleted file mode 100644 index c475c3f63..000000000 --- a/arch/cpu/arm/common/usb/msc/scsi_command.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef SCSI_COMMAND_H_SR3ALQCZSH__ -#define SCSI_COMMAND_H_SR3ALQCZSH__ - -#define SCSI_CMD_CHANGE_DEFINITION 0x40 -#define SCSI_CMD_COMPARE 0x39 -#define SCSI_CMD_COPY 0x18 -#define SCSI_CMD_COPY_AND_VERIFY 0x3a -#define SCSI_CMD_ERASE 0x19 -#define SCSI_CMD_FORMAT 0x04 -#define SCSI_CMD_INQUIRY 0x12 -#define SCSI_CMD_LOAD_UNLOAD 0x1b -#define SCSI_CMD_LOCATE 0x2b -#define SCSI_CMD_LOCK_UNLOCK_CACHE 0x36 -#define SCSI_CMD_LOG_SELECT 0x4c -#define SCSI_CMD_LOG_SENSE 0x4d -#define SCSI_CMD_MODE_SELECT_6 0x15 -#define SCSI_CMD_MODE_SELECT_10 0x55 -#define SCSI_CMD_MODE_SENSE_6 0x1a -#define SCSI_CMD_MODE_SENSE_10 0x5a -#define SCSI_CMD_PREFETCH 0x34 -#define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e -#define SCSI_CMD_PRINT 0x0a -#define SCSI_CMD_READ_6 0x08 -#define SCSI_CMD_READ_10 0x28 -#define SCSI_CMD_READ_BLOCK_LIMITS 0x05 -#define SCSI_CMD_READ_BUFFER 0x3c -#define SCSI_CMD_READ_CAPACITY 0x25 -#define SCSI_CMD_READ_DEFECT_DATA 0x37 -#define SCSI_CMD_READ_LONG 0x3e -#define SCSI_CMD_READ_POSITION 0x34 -#define SCSI_CMD_READ_REVERSE 0x0f -#define SCSI_CMD_REASSIGN BLOCKS 0x07 -#define SCSI_CMD_RECEIVE_DIAGNOSTIC_RESULTS 0x1c -#define SCSI_CMD_RECOVER_BUFFERED_DATA 0x14 -#define SCSI_CMD_RELEASE_UNIT 0x17 -#define SCSI_CMD_REQUEST_SENSE 0x03 -#define SCSI_CMD_RESERVE_UNIT 0x16 -#define SCSI_CMD_REWIND 0x01 -#define SCSI_CMD_REZERO_UNIT 0x01 -#define SCSI_CMD_SEARCH_DATA_EQUAL_10 0x31 -#define SCSI_CMD_SEARCH_DATA_EQUAL_12 0xb1 -#define SCSI_CMD_SEARCH_DATA_HIGH_10 0x30 -#define SCSI_CMD_SEARCH_DATA_HIGH_12 0xb0 -#define SCSI_CMD_SEARCH_DATA_LOW_10 0x32 -#define SCSI_CMD_SEARCH_DATA_LOW_12 0xb2 -#define SCSI_CMD_SEEK_6 0x0B -#define SCSI_CMD_SEEK_10 0x2B -#define SCSI_CMD_SEND_DIAGNOSTIC 0x1d -#define SCSI_CMD_SET_LIMITS 0x33 -#define SCSI_CMD_SLEW_AND_PRINT 0x0b -#define SCSI_CMD_SPACE 0x11 -#define SCSI_CMD_START_STOP_UNIT 0x1B -#define SCSI_CMD_STOP_PRINT 0x1b -#define SCSI_CMD_SYNCHRONIZE_CACHE 0x35 -#define SCSI_CMD_SYNCHRONIZE_BUFFER 0x10 -#define SCSI_CMD_TEST_UNIT_READY 0x00 -#define SCSI_CMD_VERIFY 0x13 -#define SCSI_CMD_WRITE_6 0x0a -#define SCSI_CMD_WRITE_10 0x2a -#define SCSI_CMD_WRITE_12 0xaa -#define SCSI_CMD_WRITE_AND_VERIFY_10 0x2e -#define SCSI_CMD_WRITE_AND_VERIFY_12 0xae -#define SCSI_CMD_WRITE_BUFFER 0x3b -#define SCSI_CMD_WRITE_FILEMARKS 0x10 -#define SCSI_CMD_WRITE_LONG 0x3f -#define SCSI_CMD_WRITE_SAME 0x41 - - - -#endif /* SCSI_COMMAND_H_SR3ALQCZSH__ */ diff --git a/arch/cpu/arm/common/usb/msc/scsi_sense.h b/arch/cpu/arm/common/usb/msc/scsi_sense.h deleted file mode 100644 index 98364660c..000000000 --- a/arch/cpu/arm/common/usb/msc/scsi_sense.h +++ /dev/null @@ -1,116 +0,0 @@ -/* Sense keys */ -#define SCSI_SENSE_KEY_NO_SENSE 0x0 -#define SCSI_SENSE_KEY_RECOVERED_ERROR 0x1 -#define SCSI_SENSE_KEY_NOT_READY 0x2 -#define SCSI_SENSE_KEY_MEDIUM_ERROR 0x3 -#define SCSI_SENSE_KEY_HARDWARE_ERROR 0x4 -#define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x5 -#define SCSI_SENSE_KEY_UNIT_ATTENTION 0x6 -#define SCSI_SENSE_KEY_DATA_PROTECT 0x7 -#define SCSI_SENSE_KEY_BLANK_CHECK 0x8 -#define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x9 -#define SCSI_SENSE_KEY_COPY_ABORTED 0xA -#define SCSI_SENSE_KEY_ABORTED_COMMAND 0xB -#define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0xD -#define SCSI_SENSE_KEY_MISCOMPARE 0xE - -/* Additional sense codes */ -#define SCSI_ASC_NO_SENSE 0x0000 -#define SCSI_ASC_FILEMARK_DETECTED 0x0001 -#define SCSI_ASC_END_OF_MEDIUM_DETECTED 0x0002 -#define SCSI_ASC_BEGINNING_OF_MEDIUM_DETECTED 0x0004 -#define SCSI_ASC_END_OF_DATA_DETECTED 0x0005 -#define SCSI_ASC_PERIPHERAL_DEVICE_WRITE_FAULT 0x0300 -#define SCSI_ASC_NO_WRITE_CURRENT 0x0301 -#define SCSI_ASC_EXCESSIVE_WRITE_ERRORS 0x0302 -#define SCSI_ASC_NOT_READY_CAUSE_NOT_REPORTABLE 0x0400 -#define SCSI_ASC_IN_PROCESS_OF_BECOMING_READY 0x0401 -#define SCSI_ASC_NOT_READY_INITIALIZING_COMMAND_REQUIRED 0x0402 -#define SCSI_ASC_NOT_READY_MANUAL_INTERVENTION_REQUIRED 0x0403 -#define SCSI_ASC_NOT_READY_FORMAT_IN_PROGRESS 0x0404 -#define SCSI_ASC_COMMUNICATION_FAILURE 0x0800 -#define SCSI_ASC_COMMUNICATION_TIME_OUT 0x0801 -#define SCSI_ASC_COMMUNICATION_PARITY_ERROR 0x0802 -#define SCSI_ASC_TRACK_FOLLOWING_ERROR 0x0900 -#define SCSI_ASC_ERROR_LOG_OVERFLOW 0x0a00 -#define SCSI_ASC_WRITE_ERROR 0x0c00 -#define SCSI_ASC_UNRECOVERED_READ_ERROR 0x1100 -#define SCSI_ASC_READ_RETRIES_EXHAUSTED 0x1101 -#define SCSI_ASC_ERROR_TOO_LONG_TO_CORRECT 0x1102 -#define SCSI_ASC_MULTIPLE_READ_ERRORS 0x1103 -#define SCSI_ASC_INCOMPLETE_BLOCK_READ 0x1108 -#define SCSI_ASC_NO_GAP_FOUND 0x1109 -#define SCSI_ASC_MISCORRECTED_ERROR 0x110a -#define SCSI_ASC_RECORDED_ENTITY_NOT_FOUND 0x1400 -#define SCSI_ASC_RECORD_NOT_FOUND 0x1401 -#define SCSI_ASC_FILEMARK_NOT_FOUND 0x1402 -#define SCSI_ASC_END_OF_DATA_NOT_FOUND 0x1403 -#define SCSI_ASC_BLOCK_SEQUENCE_ERROR 0x1404 -#define SCSI_ASC_RANDOM_POSITIONING_ERROR 0x1500 -#define SCSI_ASC_MECHANICAL_POSITIONING_ERROR 0x1501 -#define SCSI_ASC_POSITIONING_ERROR_DETECTED_BY_READ OF_MEDIUM 0x1502 -#define SCSI_ASC_RECOVERED_DATA_WITH_NO_ERROR_CORRECTION_APPLIED 0x1700 -#define SCSI_ASC_RECOVERED_DATA_WITH_RETRIES 0x1701 -#define SCSI_ASC_RECOVERED_DATA_WITH_POSITIVE_HEAD_OFFSET 0x1702 -#define SCSI_ASC_RECOVERED_DATA_WITH_NEGATIVE_HEAD_OFFSET 0x1703 -#define SCSI_ASC_RECOVERED_DATA_WITH_ERROR_CORRECTION_APPLIED 0x1800 -#define SCSI_ASC_DEFECTLIST_ERROR 0x1900 -#define SCSI_ASC_PARAMETER_LIST_LENGTH_ERROR 0x1a00 -#define SCSI_ASC_INVALID_COMMAND_OPERATION_CODE 0x2000 -#define SCSI_ASC_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x2100 -#define SCSI_ASC_INVALID_FIELD_IN_CDB 0x2400 -#define SCSI_ASC_LOGICAL_UNIT_NOT_SUPPORTED 0x2500 -#define SCSI_ASC_INVALID_FIELD_IN_PARAMETER_LIST 0x2600 -#define SCSI_ASC_PARAMETER_NOT_SUPPORTED 0x2601 -#define SCSI_ASC_PARAMETER_VALUE_INVALID 0x2602 -#define SCSI_ASC_THRESHOLD_PARAMETERS_NOT_SUPPORTED 0x2603 -#define SCSI_ASC_WRITE_PROTECTED 0x2700 -#define SCSI_ASC_NOT_READY_TO_READY_TRANSITION 0x2800 -#define SCSI_ASC_PARAMETERS_CHANGED 0x2a00 -#define SCSI_ASC_MODE_PARAMETERS_CHANGED 0x2a01 -#define SCSI_ASC_OVERWRITE_ERROR_ON_UPDATE_IN_PLACE 0x2d00 -#define SCSI_ASC_POWERON_RESET_OR_DEVICE_RESET_OCCURRED 0x2900 -#define SCSI_ASC_INCOMPATIBLE_MEDIUM_INSTALLED 0x3000 -#define SCSI_ASC_CANNOT_READ_MEDIUM_UNKNOWN_FORMAT 0x3001 -#define SCSI_ASC_CANNOT_READ_MEDIUM_INCOMPATIBLE_FORMAT 0x3002 -#define SCSI_ASC_CLEANING_CARTRIDGE_INSTALLED 0x3003 -#define SCSI_ASC_MEDIUM_FORMAT_CORRUPTED 0x3100 -#define SCSI_ASC_TAPE_LENGTH_ERROR 0x3300 -#define SCSI_ASC_ROUNDED_PARAMETER 0x3700 -#define SCSI_ASC_SAVING_PARAMETERS_NOT_SUPPORTED 0x3900 -#define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3a00 -#define SCSI_ASC_SEQUENTIAL_POSITIONING_ERROR 0x3b00 -#define SCSI_ASC_TAPE_POSITION_ERROR_AT_BEGINNING_OF_MEDIUM 0x3b01 -#define SCSI_ASC_TAPE_POSITION_ERROR_AT_END_OF_MEDIUM 0x3b02 -#define SCSI_ASC_REPOSITION_ERROR 0x3b08 -#define SCSI_ASC_NOT_SELF_CONFIGURED_YET 0x3e00 -#define SCSI_ASC_OPERATING_CONDITIONS_HAVE_CHANGED 0x3f00 -#define SCSI_ASC_MICROCODE_HAS_BEEN_CHANGED 0x3f01 -#define SCSI_ASC_INQUIRY_DATA_HAS_CHANGED 0x3f03 -/* 40 NN DIAGNOSTIC FAILURE ON COMPONENT NN (80H-FF H) */ -#define SCSI_ASC_INTERNAL_FAILURE 0x4400 -#define SCSI_ASC_UNSUCCESSFUL_DEVICE_RESET 0x4600 -#define SCSI_ASC_FAILED_SELF_CONFIGURATION 0x4c00 -#define SCSI_ASC_OVERLAPPED_COMMANDS_ATTEMPTED 0x4e00 -#define SCSI_ASC_WRITE_APPEND_ERROR 0x5000 -#define SCSI_ASC_WRITE_APPEND_POSITION_ERROR 0x5001 -#define SCSI_ASC_POSITION_ERROR_RELATED_TO_TIMING 0x5002 -#define SCSI_ASC_ERASE_FAILURE 0x5100 -#define SCSI_ASC_CARTRIDGE_FAULT 0x5200 -#define SCSI_ASC_MEDIA_LOAD_EJECT_FAILED 0x5300 -#define SCSI_ASC_UNLOAD_TAPE_FAILURE 0x5301 -#define SCSI_ASC_MEDIUM_REMOVAL_PREVENTED 0x5302 -#define SCSI_ASC_OPERATOR_REQUEST_OR_STATE_CHANGE_INPUT 0x5a00 -#define SCSI_ASC_OPERATOR_MEDIUM_REMOVAL_REQUEST 0x5a01 -#define SCSI_ASC_OPERATOR_SELECTED_WRITE_PROTECT 0x5a01 -#define SCSI_ASC_OPERATOR_SELECTED_WRITE_PERMIT 0x5a03 -#define SCSI_ASC_LOG_EXCEPTION 0x5b00 -#define SCSI_ASC_THRESHOLD_CONDITION_MET 0x5b01 -#define SCSI_ASC_LOG_COUNTER_AT_MAXIMUM 0x5b02 -#define SCSI_ASC_LOG_LIST_CODES_EXHAUSTED 0x5b03 -/* -70 NN DECOMPRES S ION EXCEP TION SHORT ALGORITHM ID OF NN -71 00 DECOMPRES S ION EXCEP TION LONG ALGORITHM ID -*/ - - diff --git a/arch/cpu/arm/common/usb/msc/scsi_struct.h b/arch/cpu/arm/common/usb/msc/scsi_struct.h deleted file mode 100644 index 0214c7833..000000000 --- a/arch/cpu/arm/common/usb/msc/scsi_struct.h +++ /dev/null @@ -1,424 +0,0 @@ -#include -#include -#include - -#ifndef CC_BYTE_ALIGNED -#ifdef __GNUC__ -#define CC_BYTE_ALIGNED __attribute__ ((packed)) -#endif -#endif - -#ifndef CC_BYTE_ALIGNED -#define CC_BYTE_ALIGNED -#endif - -#define HOST16_TO_BE_BYTES(x) {(((x) >> 8) & 0xff), ((x) & 0xff)} -#define HOST24_TO_BE_BYTES(x) {(((x) >> 16) & 0xff), (((x) >> 8) & 0xff), \ - ((x) & 0xff)} -#define HOST32_TO_BE_BYTES(x) {(((x) >> 24) & 0xff), (((x) >> 16) & 0xff), \ - (((x) >> 8) & 0xff), ((x) & 0xff)} -#define HOST40_TO_BE_BYTES(x) {(((x) >> 32) & 0xff), (((x) >> 24) & 0xff), (((x) >> 16) & 0xff), \ - (((x) >> 8) & 0xff), ((x) & 0xff)} - -typedef uint8_t uint40_bytes[5]; -typedef uint8_t uint32_bytes[4]; -typedef uint8_t int24_bytes[3]; -typedef uint8_t uint24_bytes[3]; -typedef uint8_t uint16_bytes[2]; - -inline unsigned long -be16_to_host(uint16_bytes bytes) -{ - return bytes[0] << 8 | bytes[1]; -} - -inline unsigned long -be24_to_host(uint24_bytes bytes) -{ - return bytes[0] << 16 | bytes[1] << 8 | bytes[2]; -} - -inline long -signed_be24_to_host(int24_bytes bytes) -{ - return ((bytes[0] << 16 | bytes[1] << 8 | bytes[2]) ^ 0x800000) - 0x800000; -} - - -inline unsigned long -be32_to_host(uint32_bytes bytes) -{ - return (be16_to_host(bytes) << 16) | be16_to_host(bytes + 2); -} - - -#define BE16_TO_HOST(bytes) ((bytes)[0] << 8 | (bytes)[1]) -#define BE32_TO_HOST(bytes) \ -((BE16_TO_HOST(bytes) << 16) | BE16_TO_HOST((bytes)+2)) - -/* Flag field of INQUIRY command */ -#define SCSI_INQUIRY_FLAG_CMDDT 0x02 -#define SCSI_INQUIRY_FLAG_EVPD 0x01 -#define SCSI_INQUIRY_FLAG_LUN(a) ((a)<<5) - -struct scsi_inquiry_cmd -{ - uint8_t op_code; - uint8_t flags; - uint8_t page; - uint8_t reserved; - uint8_t allocation_length; - uint8_t control; -} CC_BYTE_ALIGNED; - -/* Constant for the standard inquiry data */ -#define SCSI_STD_INQUIRY_CONNECTED 0x00 -#define SCSI_STD_INQUIRY_NOT_CONNECTED 0x20 - -#define SCSI_STD_INQUIRY_VERSION_NONE 0x00 -#define SCSI_STD_INQUIRY_VERSION_SCSI1 0x01 -#define SCSI_STD_INQUIRY_VERSION_SCSI2 0x02 -#define SCSI_STD_INQUIRY_VERSION_SPC2 0x04 - -#define SCSI_STD_INQUIRY_RESPONSE_DATA_FORMAT_SCSI1 0x00 -#define SCSI_STD_INQUIRY_RESPONSE_DATA_FORMAT_SCSI2 0x02 - -#define SCSI_STD_INQUIRY_TYPE_DIRECT_ACCESS 0x00 -#define SCSI_STD_INQUIRY_TYPE_SEQUENTIAL 0x01 -#define SCSI_STD_INQUIRY_TYPE_PRINTER 0x02 -#define SCSI_STD_INQUIRY_TYPE_PROCESSOR 0x03 -#define SCSI_STD_INQUIRY_TYPE_WRITE_ONCE 0x04 -#define SCSI_STD_INQUIRY_TYPE_CD_ROM 0x05 -#define SCSI_STD_INQUIRY_TYPE_SCANNER 0x06 -#define SCSI_STD_INQUIRY_TYPE_OPTICAL 0x07 -#define SCSI_STD_INQUIRY_TYPE_CHANGER 0x08 -#define SCSI_STD_INQUIRY_TYPE_COMM 0x09 -#define SCSI_STD_INQUIRY_TYPE_RAID 0x0C -#define SCSI_STD_INQUIRY_TYPE_RBC 0x0E - -#define SCSI_STD_INQUIRY_FLAG1_RMB 0x80 - -#define SCSI_STD_INQUIRY_FLAG2_AERC 0x80 -#define SCSI_STD_INQUIRY_FLAG2_AENC 0x80 -#define SCSI_STD_INQUIRY_FLAG2_NORMACA 0x20 -#define SCSI_STD_INQUIRY_FLAG2_HISUP 0x10 -#define SCSI_STD_INQUIRY_FLAG2_RESPONSE_FORMAT 0x02 - -#define SCSI_STD_INQUIRY_FLAG3_SCCS 0x80 - -#define SCSI_STD_INQUIRY_FLAG4_BQUE 0x80 -#define SCSI_STD_INQUIRY_FLAG4_ENCSERV 0x40 -#define SCSI_STD_INQUIRY_FLAG4_VS 0x20 -#define SCSI_STD_INQUIRY_FLAG4_MULTIP 0x10 -#define SCSI_STD_INQUIRY_FLAG4_MCHNGR 0x08 -#define SCSI_STD_INQUIRY_FLAG4_ADDR16 0x01 - -#define SCSI_STD_INQUIRY_FLAG5_RELADR 0x80 -#define SCSI_STD_INQUIRY_FLAG5_WBUS 0x20 -#define SCSI_STD_INQUIRY_FLAG5_SYNC 0x10 -#define SCSI_STD_INQUIRY_FLAG5_LINKED 0x08 -#define SCSI_STD_INQUIRY_FLAG5_CMDQUE 0x02 - -struct scsi_std_inquiry_data -{ - uint8_t device; - uint8_t flags1; - uint8_t version; - uint8_t flags2; - uint8_t additional_length; - uint8_t flags3; - uint8_t flags4; - uint8_t flags5; - char vendor_id[8]; - char product_id[16]; - char product_rev[4]; -} CC_BYTE_ALIGNED; - -struct scsi_vital_product_data_head -{ - uint8_t device; - uint8_t page; - uint8_t reserved; - uint8_t page_length; -} CC_BYTE_ALIGNED; - -struct scsi_identification_descriptor -{ - uint8_t code_set; - uint8_t identifier_type; - uint8_t reserved; - uint8_t identifier_length; -}; - -struct scsi_request_sense_cmd -{ - uint8_t op_code; - uint8_t reserved1; - uint8_t reserved2; - uint8_t reserved3; - uint8_t allocation_length; - uint8_t control; -} CC_BYTE_ALIGNED; - -#define SCSI_SENSE_CURRENT_ERROR 0x70 -#define SCSI_SENSE_DEFERRED_ERROR 0x71 -#define SCSI_SENSE_INFORMATION_VALID 0x80 -#define SCSI_SENSE_FILEMARK 0x80 -#define SCSI_SENSE_EOM 0x40 -#define SCSI_SENSE_ILI 0x20 - -struct scsi_sense_data -{ - uint8_t response_code; - uint8_t obsolete; - uint8_t sense_key; - uint8_t information[4]; - uint8_t additional_length; - uint8_t command_specific[4]; - uint8_t asc; - uint8_t ascq; - uint8_t unit_code; - uint8_t sense_key_specific[3]; -} CC_BYTE_ALIGNED; - - -/* Flag field of INQUIRY command */ -#define SCSI_MODE_SENSE_FLAG_DBD 0x08 -#define SCSI_MODE_SENSE_FLAG_LUN(a) ((a)<<5) - -#define SCSI_MODE_SENSE_PC_CURRENT 0x00 -#define SCSI_MODE_SENSE_PC_CHANGEABLE 0x40 -#define SCSI_MODE_SENSE_PC_DEFAULT 0x80 -#define SCSI_MODE_SENSE_PC_SAVED 0xc0 - -struct scsi_mode_sence_6_cmd -{ - uint8_t op_code; - uint8_t flags; - uint8_t page_code; - uint8_t reserved; - uint8_t allocation_length; - uint8_t control; -} CC_BYTE_ALIGNED; - -struct scsi_mode_select_6_cmd -{ - uint8_t op_code; - uint8_t flags; - uint8_t reserved1; - uint8_t reserved2; - uint8_t parameter_list_length; - uint8_t control; -}; - -#define SCSI_MODE_PARAM_WP 0x80 -#define SCSI_MODE_PARAM_BUFFERED_MODE_SYNC 0x00 -#define SCSI_MODE_PARAM_BUFFERED_MODE_ASYNC 0x10 -#define SCSI_MODE_PARAM_BUFFERED_MODE_ALL_SYNC 0x10 -#define SCSI_MODE_PARAM_SPEED_DEFAULT 0x00 -#define SCSI_MODE_PARAM_SPEED_LOWEST 0x01 -#define SCSI_MODE_PARAM_SPEED_HIGHEST 0x0f - -struct scsi_mode_parameter_header_6 -{ - uint8_t mode_data_length; - uint8_t medium_type; - uint8_t device_specific_parameter; - uint8_t block_descriptor_length; -} CC_BYTE_ALIGNED; - -#define SCSI_DENSITY_9_800 0x01 -#define SCSI_DENSITY_9_1600 0x02 -#define SCSI_DENSITY_9_6250 0x03 -#define SCSI_DENSITY_4_9_8000 0x05 -#define SCSI_DENSITY_9_3200 0x06 -#define SCSI_DENSITY_4_6400 0x07 -#define SCSI_DENSITY_4_8000 0x08 -#define SCSI_DENSITY_18_37871 0x09 -#define SCSI_DENSITY_22_6667 0x0a -#define SCSI_DENSITY_4_1600 0x0b -#define SCSI_DENSITY_24_12690 0x0c -#define SCSI_DENSITY_24_25380 0xd -#define SCSI_DENSITY_15_10000 0x0f -#define SCSI_DENSITY_18_10000 0x10 -#define SCSI_DENSITY_26_16000 0x11 -#define SCSI_DENSITY_30_51667 0x12 -#define SCSI_DENSITY_1_2400 0x13 -#define SCSI_DENSITY_1_43245 0x14 -#define SCSI_DENSITY_1_45434 0x15 -#define SCSI_DENSITY_48_10000 0x16 -#define SCSI_DENSITY_48_42500 0x17 - - -struct scsi_mode_parameter_block_descriptor -{ - uint8_t density_code; - uint24_bytes number_of_blocks; - uint8_t reserved; - uint24_bytes block_length; -} CC_BYTE_ALIGNED; - - -#define SCSI_MODE_PAGE_PS 0x80 -#define SCSI_MODE_PAGE_CONTROL_MODE 0x0a -#define SCSI_MODE_PAGE_DEVICE_CONFIGURATION 0x10 -#define SCSI_MODE_PAGE_CONNECT 0x02 -#define SCSI_MODE_PAGE_MEDIUM_PARTITION_1 0x11 -#define SCSI_MODE_PAGE_MEDIUM_PARTITION_2 0x12 -#define SCSI_MODE_PAGE_MEDIUM_PARTITION_3 0x13 -#define SCSI_MODE_PAGE_MEDIUM_PARTITION_4 0x14 -#define SCSI_MODE_PAGE_PERIPHERIAL_DEVICE 0x09 -#define SCSI_MODE_PAGE_RW_ERROR_RECOVERY 0x01 -#define SCSI_MODE_PAGE_VENDOR_SPECIFIC 0x00 -#define SCSI_MODE_PAGE_ALL_PAGES 0x3f - -struct scsi_mode_page_header -{ - uint8_t page_code; - uint8_t page_length; -} CC_BYTE_ALIGNED; - -#define SCSI_MODE_PAGE_CONTROL_FLAGS1_RLEC 0x01 -#define SCSI_MODE_PAGE_CONTROL_FLAGS2_QERR 0x02 -#define SCSI_MODE_PAGE_CONTROL_FLAGS2_DQUE 0x02 -#define SCSI_MODE_PAGE_CONTROL_FLAGS2_RESTRICED_REORDERING 0x00 -#define SCSI_MODE_PAGE_CONTROL_FLAGS2_UNRESTRICED_REORDERING 0x01 -#define SCSI_MODE_PAGE_CONTROL_FLAGS3_EECA 0x80 -#define SCSI_MODE_PAGE_CONTROL_FLAGS3_UAAENP 0x02 -#define SCSI_MODE_PAGE_CONTROL_FLAGS3_EAENP 0x01 - -struct scsi_mode_page_control -{ - struct scsi_mode_page_header header; - uint8_t flags1; - uint8_t flags2; - uint8_t flags3; - uint8_t reserved; - uint16_bytes ready_AEN_holdoff_period; -} CC_BYTE_ALIGNED; - -#define SCSI_MODE_PAGE_CONNECT_FLAGS_DTDC_NONE 0x00 -#define SCSI_MODE_PAGE_CONNECT_FLAGS_DTDC_TRANSFERRED 0x01 -#define SCSI_MODE_PAGE_CONNECT_FLAGS_DTDC_COMPLETE 0x03 - -struct scsi_mode_page_connect -{ - struct scsi_mode_page_header header; - uint8_t buffer_full_ratio; - uint8_t buffer_empty_ratio; - uint16_bytes bus_inactivity_limit; - uint16_bytes disconnect_time_limit; - uint16_bytes connect_time_limit; - uint16_bytes maximum_burst_size; - uint8_t flags; - uint8_t reserved[3]; -} CC_BYTE_ALIGNED; - -struct scsi_mode_page_peripherial_device -{ - struct scsi_mode_page_header header; - uint16_bytes interface_identifier; - uint8_t reserved[4]; - uint16_bytes maximum_burst_size; -} CC_BYTE_ALIGNED; - -#define SCSI_MODE_PAGE_DEV_CONF_CAF 0x02 -#define SCSI_MODE_PAGE_DEV_CONF_CAP 0x04 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS1_REW 0x01 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS1_RBO 0x02 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS1_SOCF_IGNORE 0x00 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS1_SOCF_1 0x04 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS1_SOCF_2 0x08 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS1_SOCF_3 0xc0 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS1_AVC 0x10 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS1_RSMK 0x20 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS1_BIS 0x40 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS1_DBR 0x40 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS2_SEW 0x08 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS2_EEG 0x10 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS2_EOD_DEFAULT 0x00 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS2_EOD_ERASE_AREA 0x20 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS2_EOD_SOCF 0x40 -#define SCSI_MODE_PAGE_DEV_CONF_FLAGS2_EOD_NONE 0x60 - -#define SCSI_MODE_PAGE_DEV_CONF_COMPR_NONE 0x00 -#define SCSI_MODE_PAGE_DEV_CONF_COMPR_DEFAULT 0x01 - -struct scsi_mode_page_device_configuration -{ - struct scsi_mode_page_header header; - uint8_t active_format; - uint8_t active_partition; - uint8_t write_buffer_full_ratio; - uint8_t read_buffer_empty_ratio; - uint16_bytes write_delay_time; - uint8_t flags1; - uint8_t gap_size; - uint8_t flags2; - uint24_bytes buffer_size_at_early_warning; - uint8_t select_data_compression; - uint8_t reserved; -}; - -struct scsi_read_buffer_limits_cmd -{ - uint8_t op_code; - uint8_t lun; - uint8_t reserved[3]; - uint8_t control; -} CC_BYTE_ALIGNED; - -struct scsi_read_buffer_limits_data -{ - uint8_t reserved; - uint24_bytes maximum_block_length_limit; - uint16_bytes minimum_block_length_limit; -} CC_BYTE_ALIGNED; - -#define SCSI_READ_FLAGS_FIXED 0x01 -#define SCSI_READ_FLAGS_SILI 0x02 - -struct scsi_read_6_cmd -{ - uint8_t op_code; - uint8_t flags; - uint24_bytes transfer_length; - uint8_t control; -} CC_BYTE_ALIGNED; - -#define SCSI_WRITE_FLAGS_FIXED 0x01 - -struct scsi_write_6_cmd -{ - uint8_t op_code; - uint8_t flags; - uint24_bytes transfer_length; - uint8_t control; -} CC_BYTE_ALIGNED; - -#define SCSI_WRITE_FILEMARKS_FLAGS_IMMED 0x01 -#define SCSI_WRITE_FILEMARKS_FLAGS_WSMK 0x02 - -struct scsi_write_filemarks_6_cmd -{ - uint8_t op_code; - uint8_t flags; - int24_bytes transfer_length; - uint8_t control; -} CC_BYTE_ALIGNED; - -#define SCSI_SPACE_FLAGS_CODE 0x07 -#define SCSI_SPACE_FLAGS_CODE_BLOCKS 0x00 -#define SCSI_SPACE_FLAGS_CODE_FILEMARKS 0x01 -#define SCSI_SPACE_FLAGS_CODE_SEQ_FILEMARKS 0x02 -#define SCSI_SPACE_FLAGS_CODE_END_OF_DATA 0x03 -#define SCSI_SPACE_FLAGS_CODE_SETMARKS 0x04 -#define SCSI_SPACE_FLAGS_CODE_SEQ_SETMARKS 0x05 - -struct scsi_space_cmd -{ - uint8_t op_code; - uint8_t flags; - int24_bytes transfer_length; - uint8_t control; -} CC_BYTE_ALIGNED; diff --git a/arch/cpu/arm/common/usb/msc/spc2_const.h b/arch/cpu/arm/common/usb/msc/spc2_const.h deleted file mode 100644 index 3f62b86c0..000000000 --- a/arch/cpu/arm/common/usb/msc/spc2_const.h +++ /dev/null @@ -1,112 +0,0 @@ -/* SCSI operation codes */ -/* From SPC-2 */ -#define SCSI_CMD_EXTENDED_COPY 0x83 -#define SCSI_CMD_INQUIRY 0x12 -#define SCSI_CMD_LOG_SELECT 0x4C -#define SCSI_CMD_LOG_SENSE 0x4D -#define SCSI_CMD_MODE_SELECT_6 0x15 -#define SCSI_CMD_MODE_SELECT_10 0x55 -#define SCSI_CMD_MODE_SENSE_6 0x1A -#define SCSI_CMD_MODE_SENSE_10 0x5A -#define SCSI_CMD_MOVE_MEDIUM_ATTACHED 0xA7 -#define SCSI_CMD_PERSISTENT_RESERVE_IN 0x5E -#define SCSI_CMD_PERSISTENT RESERVE OUT 0x5F -#define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E -#define SCSI_CMD_READ_BUFFER 0x3C -#define SCSI_CMD_READ_ELEMENT_STATUS_ATTACHED 0xB4 -#define SCSI_CMD_RECEIVE_COPY_RESULTS 0x84 -#define SCSI_CMD_RECEIVE_DIAGNOSTIC_RESULTS 0x1C -#define SCSI_CMD_RELEASE_10 0x57 -#define SCSI_CMD_RELEASE_6 0x17 -#define SCSI_CMD_REPORT_DEVICE_IDENTIFIER 0xA3 -#define SCSI_CMD_REPORT_LUNS 0xA0 -#define SCSI_CMD_REQUEST_SENSE 0x03 -#define SCSI_CMD_RESERVE_10 0x56 -#define SCSI_CMD_RESERVE_6 0x16 -#define SCSI_CMD_SEND_DIAGNOSTIC 0x1D -#define SCSI_CMD_SET_DEVICE_IDENTIFIER 0xA4 -#define SCSI_CMD_TEST_UNIT_READY 0x00 -#define SCSI_CMD_WRITE_BUFFER 0x3B - -/* Flag field of INQUIRY command */ -#define SCSI_INQUIRY_FLAG_CMDDT 0x02 -#define SCSI_INQUIRY_FLAG_EVPD 0x01 - -/* Constant for the standard inquiry data */ -#define SCSI_STD_INQUIRY_CONNECTED 0x00 -#define SCSI_STD_INQUIRY_NOT_CONNECTED 0x20 - -#define SCSI_STD_INQUIRY_VERSION_NONE 0x00 -#define SCSI_STD_INQUIRY_VERSION_SPC2 0x04 - -#define SCSI_STD_INQUIRY_TYPE_DIRECT_ACCESS 0x00 -#define SCSI_STD_INQUIRY_TYPE_SEQUENTIAL 0x01 -#define SCSI_STD_INQUIRY_TYPE_PRINTER 0x02 -#define SCSI_STD_INQUIRY_TYPE_PROCESSOR 0x03 -#define SCSI_STD_INQUIRY_TYPE_WRITE_ONCE 0x04 -#define SCSI_STD_INQUIRY_TYPE_CD_ROM 0x05 -#define SCSI_STD_INQUIRY_TYPE_SCANNER 0x06 -#define SCSI_STD_INQUIRY_TYPE_OPTICAL 0x07 -#define SCSI_STD_INQUIRY_TYPE_CHANGER 0x08 -#define SCSI_STD_INQUIRY_TYPE_COMM 0x09 -#define SCSI_STD_INQUIRY_TYPE_RAID 0x0C -#define SCSI_STD_INQUIRY_TYPE_RBC 0x0E - -#define SCSI_STD_INQUIRY_FLAG1_RMB 0x80 - -#define SCSI_STD_INQUIRY_FLAG2_AERC 0x80 -#define SCSI_STD_INQUIRY_FLAG2_NORMACA 0x20 -#define SCSI_STD_INQUIRY_FLAG2_HISUP 0x10 -#define SCSI_STD_INQUIRY_FLAG2_RESPONSE_FORMAT 0x02 - -#define SCSI_STD_INQUIRY_FLAG3_SCCS 0x80 - -#define SCSI_STD_INQUIRY_FLAG4_BQUE 0x80 -#define SCSI_STD_INQUIRY_FLAG4_ENCSERV 0x40 -#define SCSI_STD_INQUIRY_FLAG4_VS 0x20 -#define SCSI_STD_INQUIRY_FLAG4_MULTIP 0x10 -#define SCSI_STD_INQUIRY_FLAG4_MCHNGR 0x08 -#define SCSI_STD_INQUIRY_FLAG4_ADDR16 0x01 - -#define SCSI_STD_INQUIRY_FLAG5_RELADR 0x80 -#define SCSI_STD_INQUIRY_FLAG5_WBUS 0x20 -#define SCSI_STD_INQUIRY_FLAG5_SYNC 0x10 -#define SCSI_STD_INQUIRY_FLAG5_LINKED 0x08 -#define SCSI_STD_INQUIRY_FLAG5_CMDQUE 0x02 - -#define SCSI_SENSE_CURRENT_ERROR 0x70 -#define SCSI_SENSE_DEFERRED_ERROR 0x71 -#define SCSI_SENSE_INFORMATION_VALID 0x80 -#define SCSI_SENSE_FILEMARK 0x80 -#define SCSI_SENSE_EOM 0x40 -#define SCSI_SENSE_ILI 0x20 - -#define SCSI_PAGE_DEVICE_IDENTIFICATION 0x83 -#define SCSI_PAGE_SUPPORTED_PAGES 0x00 -#define SCSI_PAGE_UNIT_SERIAL_NUMBER 0x80 - -#define SCSI_CODE_SET_BINARY 0x01 -#define SCSI_CODE_SET_ACSII 0x02 - -#define SCSI_ASSOCIATION_DEVICE 0x00 -#define SCSI_ASSOCIATION_PORT 0x10 - -#define SCSI_IDENTIFIER_TYPE_NON_UNIQUE 0x00 -#define SCSI_IDENTIFIER_TYPE_VENDORID 0x01 -#define SCSI_IDENTIFIER_TYPE_EUI_64 0x02 -#define SCSI_IDENTIFIER_TYPE_FC_FS 0x03 -#define SCSI_IDENTIFIER_TYPE_PORT 0x04 - -/* Mode parameters */ -#define SCSI_MODE_PAGE_SP 0x80 -#define SCSI_MODE_SELECT_PF 0x10 -#define SCSI_MODE_SELECT_SP 0x01 -#define SCSI_MODE_SENSE_DBD 0x08 -#define SCSI_MODE_SENSE_PAGE_CODE_MASK 0x3f -#define SCSI_MODE_SENSE_PC_CURRENT 0x00 -#define SCSI_MODE_SENSE_PC_CHANGEABLE 0x40 -#define SCSI_MODE_SENSE_PC_DEFAULT 0x80 -#define SCSI_MODE_SENSE_PC_SAVED 0xc0 -#define SCSI_MODE_SENSE_ALL_PAGES 0x3f - - diff --git a/arch/cpu/arm/common/usb/msc/spc2_struct.h b/arch/cpu/arm/common/usb/msc/spc2_struct.h deleted file mode 100644 index dcd51bb0a..000000000 --- a/arch/cpu/arm/common/usb/msc/spc2_struct.h +++ /dev/null @@ -1,139 +0,0 @@ -#ifndef SPC2_STRUCT_H_6R1KTJP0NJ__ -#define SPC2_STRUCT_H_6R1KTJP0NJ__ - -typedef uint8_t uint40_bytes[5]; -typedef uint8_t uint32_bytes[4]; -typedef uint8_t uint16_bytes[2]; - -#ifndef CC_BYTE_ALIGNED -#ifdef __GNUC__ -#define CC_BYTE_ALIGNED __attribute__ ((packed)) -#endif -#endif - -#ifndef CC_BYTE_ALIGNED -#define CC_BYTE_ALIGNED -#endif - -#define HOST16_TO_BE_BYTES(x) {(((x) >> 8) & 0xff), ((x) & 0xff)} -#define HOST32_TO_BE_BYTES(x) {(((x) >> 24) & 0xff), (((x) >> 16) & 0xff), \ - (((x) >> 8) & 0xff), ((x) & 0xff)} -#define HOST40_TO_BE_BYTES(x) {(((x) >> 32) & 0xff), (((x) >> 24) & 0xff), (((x) >> 16) & 0xff), \ - (((x) >> 8) & 0xff), ((x) & 0xff)} - -inline unsigned long -be16_to_host(uint16_bytes bytes) -{ - return bytes[0] << 8 | bytes[1]; -} - -inline unsigned long -be32_to_host(uint32_bytes bytes) -{ - return (be16_to_host(bytes) << 16) | be16_to_host(bytes + 2); -} - - -#define BE16_TO_HOST(bytes) ((bytes)[0] << 8 | (bytes)[1]) -#define BE32_TO_HOST(bytes) \ -((BE16_TO_HOST(bytes) << 16) | BE16_TO_HOST((bytes)+2)) -struct spc2_inquiry_cmd -{ - uint8_t op_code; - uint8_t flags; - uint8_t page; - uint8_t reserved; - uint8_t allocation_length; - uint8_t control; -} CC_BYTE_ALIGNED; - -struct spc2_std_inquiry_data -{ - uint8_t device; - uint8_t flags1; - uint8_t version; - uint8_t flags2; - uint8_t additional_length; - uint8_t flags3; - uint8_t flags4; - uint8_t flags5; - char vendor_id[8]; - char product_id[16]; - char product_rev[4]; -} CC_BYTE_ALIGNED; - -struct spc2_vital_product_data_head -{ - uint8_t device; - uint8_t page; - uint8_t reserved; - uint8_t page_length; -} CC_BYTE_ALIGNED; - -struct spc2_identification_descriptor -{ - uint8_t code_set; - uint8_t identifier_type; - uint8_t reserved; - uint8_t identifier_length; -}; - -struct spc2_request_sense_cmd -{ - uint8_t op_code; - uint8_t reserved1; - uint8_t reserved2; - uint8_t reserved3; - uint8_t allocation_length; - uint8_t control; -} CC_BYTE_ALIGNED; - -struct spc2_sense_data -{ - uint8_t response_code; - uint8_t obsolete; - uint8_t sense_key; - uint8_t information[4]; - uint8_t additional_length; - uint8_t command_specific[4]; - uint8_t asc; - uint8_t ascq; - uint8_t unit_code; - uint8_t sense_key_specific[3]; -} CC_BYTE_ALIGNED; - -struct spc2_mode_sence_6_cmd -{ - uint8_t op_code; - uint8_t flags; - uint8_t page_code; - uint8_t reserved; - uint8_t allocation_length; - uint8_t control; -} CC_BYTE_ALIGNED; - -struct spc2_mode_select_6_cmd -{ - uint8_t op_code; - uint8_t flags; - uint8_t reserved1; - uint8_t reserved2; - uint8_t parameter_list_length; - uint8_t control; -}; - -struct spc2_mode_parameter_header_6 -{ - uint8_t mode_data_length; - uint8_t medium_type; - uint8_t device_specific_parameter; - uint8_t block_descriptor_length; -} CC_BYTE_ALIGNED; - -struct spc2_mode_page -{ - uint8_t page_code; - uint8_t page_length; -} CC_BYTE_ALIGNED; - -#endif /* SPC2_STRUCT_H_6R1KTJP0NJ__ */ diff --git a/arch/cpu/arm/common/usb/msc/usb-msc-bulk.c b/arch/cpu/arm/common/usb/msc/usb-msc-bulk.c deleted file mode 100644 index fc62831c9..000000000 --- a/arch/cpu/arm/common/usb/msc/usb-msc-bulk.c +++ /dev/null @@ -1,531 +0,0 @@ -#include "usb-msc-bulk.h" -#include -#include -#include -#include -#include - -#define DEBUG - -#ifdef DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -static const uint8_t max_lun = 0; - -static USBBuffer data_usb_buffer[USB_MSC_BUFFERS]; -static unsigned int buffer_lengths[USB_MSC_BUFFERS]; - -static unsigned int buf_first = 0; /* First prepared buffer */ -static unsigned int buf_free = 0; /* First free buffer */ -static unsigned int buf_submitted = 0; /* Oldest submitted buffer */ - -#define USB_BUFFER_ID_UNUSED 0 -#define USB_BUFFER_ID_CBW 1 -#define USB_BUFFER_ID_CSW 2 -#define USB_BUFFER_ID_DATA 3 -#define USB_BUFFER_ID_DISCARD 4 -#define USB_BUFFER_ID_HALT 5 -#define USB_BUFFER_ID_MASK 0x07 - -static struct usb_msc_bulk_cbw cbw_buffer; -static struct usb_msc_bulk_csw csw_buffer; - -#define BULK_OUT 0x02 -#define BULK_IN 0x81 - -PROCESS(usb_mass_bulk_process, "USB mass storage bulk only process"); - -static process_event_t reset_event; - -static struct usb_msc_command_state state; - -/* Handle wrapping */ -#define PREV_BUF(x) (((x) == 0) ? USB_MSC_BUFFERS - 1 : (x) - 1) -#define NEXT_BUF(x) (((x) < (USB_MSC_BUFFERS-1)) ? (x) + 1 : 0) -void -usb_msc_send_data_buf_flags(const uint8_t *data, unsigned int len, - unsigned int flags, uint16_t buf_flags) -{ - USBBuffer *buffer = &data_usb_buffer[buf_free]; - if (buffer->id != USB_BUFFER_ID_UNUSED) { - printf("Data IN buffer busy\n"); - return; - } - buffer->flags = USB_BUFFER_NOTIFY | buf_flags; - buffer->next = NULL; - buffer->data = (uint8_t*)data; - buffer->left = len; - buffer_lengths[buf_free] = len; - buffer->id = USB_BUFFER_ID_DATA | flags; - if (buf_free != buf_first) { - data_usb_buffer[PREV_BUF(buf_free)].next = buffer; - } - state.cmd_data_submitted += len; - buf_free = NEXT_BUF(buf_free); - /* PRINTF("usb_msc_send_data: %d\n", len); */ - if (flags & USB_MSC_DATA_SEND) { - usb_submit_xmit_buffer(BULK_IN, &data_usb_buffer[buf_first]); - buf_first = buf_free; - /* PRINTF("usb_msc_send_data: sent\n"); */ - } else if (flags & USB_MSC_DATA_LAST) { - /* Cancel transmission */ - PRINTF("Send last\n"); - buf_first = buf_free; - process_poll(&usb_mass_bulk_process); - } -} - -void -usb_msc_send_data(const uint8_t *data, unsigned int len, unsigned int flags) -{ - usb_msc_send_data_buf_flags(data, len, flags,0); -} - -void -usb_msc_receive_data_buf_flags(uint8_t *data, unsigned int len, - unsigned int flags, uint16_t buf_flags) -{ - USBBuffer *buffer = &data_usb_buffer[buf_free]; - if (buffer->id != USB_BUFFER_ID_UNUSED) { - printf("Data OUT buffer busy\n"); - return; - } - buffer->flags = USB_BUFFER_NOTIFY | buf_flags; - buffer->next = NULL; - buffer->data = data; - buffer->left = len; - buffer_lengths[buf_free] = len; - buffer->id = USB_BUFFER_ID_DATA | flags; - if (buf_free != buf_first) { - data_usb_buffer[PREV_BUF(buf_free)].next = buffer; - } - state.cmd_data_submitted += len; - buf_free = NEXT_BUF(buf_free); - if (flags & USB_MSC_DATA_RECEIVE) { - usb_submit_recv_buffer(BULK_OUT, &data_usb_buffer[buf_first]); - buf_first = buf_free; - } else if (flags & USB_MSC_DATA_LAST) { - usb_discard_all_buffers(BULK_OUT); - /* Mark the discarded buffers as unused */ - while(buf_submitted != PREV_BUF(buf_free)) { - data_usb_buffer[buf_submitted].id = USB_BUFFER_ID_UNUSED; - buf_submitted = NEXT_BUF(buf_submitted); - } - buf_first = buf_free; - process_poll(&usb_mass_bulk_process); - } -} - -void -usb_msc_receive_data(uint8_t *data, unsigned int len, unsigned int flags) -{ - usb_msc_receive_data_buf_flags(data,len,flags, 0); -} - -static unsigned int -handle_mass_bulk_requests() -{ - switch(usb_setup_buffer.bmRequestType) { - case 0x21: /* interface OUT requests */ - switch(usb_setup_buffer.bRequest) { - case MASS_BULK_RESET: - PRINTF("Mass storage reset\n"); - process_post(&usb_mass_bulk_process, reset_event, NULL); - return 1; - } - break; - case 0xa1: /* interface IN requests */ - switch(usb_setup_buffer.bRequest) { - case MASS_BULK_GET_MAX_LUN: - PRINTF("Get LUN\n"); - usb_send_ctrl_response(&max_lun, sizeof(max_lun)); - return 1; - } - break; - } - return 0; -} - -static const struct USBRequestHandler mass_bulk_request_handler = - { - 0x21, 0x7f, - 0x00, 0x00, - handle_mass_bulk_requests - }; - -static struct USBRequestHandlerHook mass_bulk_request_hook = - { - NULL, - &mass_bulk_request_handler - }; - -static void -send_csw(void) -{ - USBBuffer *buffer = &data_usb_buffer[buf_free]; - if (buffer->id != USB_BUFFER_ID_UNUSED) { - printf("CSW buffer busy\n"); - return; - } - - csw_buffer.dCSWSignature = MASS_BULK_CSW_SIGNATURE; - csw_buffer.dCSWTag = cbw_buffer.dCBWTag; - csw_buffer.dCSWDataResidue = - cbw_buffer.dCBWDataTransferLength - state.cmd_data_submitted; - csw_buffer.bCSWStatus = state.status; - - buffer->flags = USB_BUFFER_NOTIFY; - buffer->next = NULL; - buffer->data =(uint8_t*)&csw_buffer ; - buffer->left = sizeof(csw_buffer); - buffer->id = USB_BUFFER_ID_CSW; - if (buf_free != buf_first) { - data_usb_buffer[PREV_BUF(buf_free)].next = buffer; - } - buf_free = NEXT_BUF(buf_free); - usb_submit_xmit_buffer(BULK_IN, &data_usb_buffer[buf_first]); - buf_first = buf_free; - - PRINTF("CSW sent: %ld\n", sizeof(csw_buffer)); -} - -static void -submit_cbw_buffer(void) -{ - USBBuffer *buffer = &data_usb_buffer[buf_free]; - if (buffer->id != USB_BUFFER_ID_UNUSED) { - printf("CBW buffer busy\n"); - return; - } - buffer->flags = USB_BUFFER_NOTIFY; - buffer->next = NULL; - buffer->data = (uint8_t*)&cbw_buffer; - buffer->left = sizeof(cbw_buffer); - buffer->id = USB_BUFFER_ID_CBW; - if (buf_free != buf_first) { - data_usb_buffer[PREV_BUF(buf_free)].next = buffer; - } - buf_free = NEXT_BUF(buf_free); - usb_submit_recv_buffer(BULK_OUT, &data_usb_buffer[buf_first]); - PRINTF("CBW submitted: %d\n", buf_first); - buf_first = buf_free; -} - -static void -submit_halt(uint8_t addr) -{ - USBBuffer *buffer = &data_usb_buffer[buf_free]; - if (buffer->id != USB_BUFFER_ID_UNUSED) { - printf("CBW buffer busy\n"); - return; - } - buffer->flags = USB_BUFFER_NOTIFY | USB_BUFFER_HALT; - buffer->next = NULL; - buffer->data = NULL; - buffer->left = 0; - buffer->id = USB_BUFFER_ID_HALT; - if (buf_free != buf_first) { - data_usb_buffer[PREV_BUF(buf_free)].next = buffer; - } - buf_free = NEXT_BUF(buf_free); - if (addr & 0x80) { - usb_submit_xmit_buffer(addr, &data_usb_buffer[buf_first]); - } else { - usb_submit_recv_buffer(addr, &data_usb_buffer[buf_first]); - } - PRINTF("HALT submitted %p\n",buffer); - buf_first = buf_free; -} - -static USBBuffer * -get_next_buffer(uint8_t addr, uint32_t id) -{ - unsigned int events; - events = usb_get_ep_events(addr); - if (events & USB_EP_EVENT_NOTIFICATION) { - USBBuffer *buffer = &data_usb_buffer[buf_submitted]; - if (!(buffer->flags & USB_BUFFER_SUBMITTED)) { -#ifdef DEBUG - if (id != (buffer->id & USB_BUFFER_ID_MASK)) { - printf("Wrong buffer ID expected %d, got %d\n", - (int)id, (int)buffer->id); - } -#endif - if ((buffer->id & USB_BUFFER_ID_MASK) == USB_BUFFER_ID_DATA) { - state.cmd_data_transfered += - buffer_lengths[buf_submitted] - buffer->left; - } - buffer->id = USB_BUFFER_ID_UNUSED; - buf_submitted =NEXT_BUF(buf_submitted); - return buffer; - } - } - return NULL; -} - -PROCESS(usb_mass_bulk_request_process, "USB mass storage request process"); - -PROCESS_THREAD(usb_mass_bulk_request_process, ev , data) -{ - PROCESS_BEGIN(); - reset_state: - usb_discard_all_buffers(BULK_OUT); - usb_discard_all_buffers(BULK_IN); - memset(data_usb_buffer, 0, sizeof(data_usb_buffer)); - buf_first = 0; - buf_free = 0; - buf_submitted = 0; - submit_cbw_buffer(); - receive_cbw_state: - PRINTF("receive_cbw_state\n"); - while(1) { - PROCESS_WAIT_EVENT(); - if (ev == reset_event) goto reset_state; - if (ev == PROCESS_EVENT_POLL) { - USBBuffer *buffer; - if ((buffer = get_next_buffer(BULK_OUT, USB_BUFFER_ID_CBW))) { - - /* CBW */ - if (cbw_buffer.dCBWSignature == MASS_BULK_CBW_SIGNATURE) { - usb_msc_handler_status ret; - PRINTF("Got CBW seq %d\n",(int)cbw_buffer.dCBWTag); - state.command = cbw_buffer.CBWCB; - state.command_length = cbw_buffer.bCBWCBLength; - state.status = MASS_BULK_CSW_STATUS_FAILED; - state.data_cb = NULL; - state.cmd_data_submitted = 0; - state.cmd_data_transfered = 0; - ret = usb_msc_handle_command(&state); - if (ret == USB_MSC_HANDLER_OK) { - state.status = MASS_BULK_CSW_STATUS_PASSED; - } else if (ret == USB_MSC_HANDLER_FAILED) { - state.status = MASS_BULK_CSW_STATUS_FAILED; - } - if (ret != USB_MSC_HANDLER_DELAYED - && buf_submitted == buf_free) { - if (cbw_buffer.dCBWDataTransferLength > 0) { - /* HALT the apropriate endpoint */ - if (cbw_buffer.bmCBWFlags & MASS_BULK_CBW_FLAG_IN) { - submit_halt(BULK_IN); - } else { - submit_halt(BULK_OUT); - } - /* Wait for HALT */ - while(1) { - PROCESS_WAIT_EVENT(); - if (ev == reset_event) goto reset_state; - if (ev == PROCESS_EVENT_POLL) { - USBBuffer *buffer = - get_next_buffer(BULK_IN, USB_BUFFER_ID_HALT); - if (buffer && (buffer->flags & USB_BUFFER_HALT)) break; - } - } - } - goto send_csw_state; - } - if (cbw_buffer.bmCBWFlags & MASS_BULK_CBW_FLAG_IN) { - goto send_data_state; - } else { - goto receive_data_state; - } - } else { - printf("Invalid CBW\n"); - submit_halt(BULK_IN); - submit_halt(BULK_OUT); - while(1) { - PROCESS_WAIT_EVENT(); - if (ev == reset_event) goto reset_state; - if (ev == PROCESS_EVENT_POLL) { - USBBuffer *buffer = get_next_buffer(BULK_IN, USB_BUFFER_ID_HALT); - if (buffer && (buffer->flags & USB_BUFFER_HALT)) break; - } - } - while(1) { - PROCESS_WAIT_EVENT(); - if (ev == reset_event) goto reset_state; - if (ev == PROCESS_EVENT_POLL) { - USBBuffer *buffer = get_next_buffer(BULK_OUT, USB_BUFFER_ID_HALT); - if (buffer && (buffer->flags & USB_BUFFER_HALT)) break; - } - } - /* CBW */ - goto receive_cbw_state; - } - } - } - } - - send_data_state: - PRINTF("send_data_state\n"); - while(1) { - uint8_t id = 0; - /* Wait for any data to be sent */ - while (buf_submitted == buf_free) { - PRINTF("Wait data\n"); - PROCESS_WAIT_EVENT(); - } -#if 0 - /* Send CSW early to improve throughput, unless we need to HALT - the endpoint due to short data */ - if ((data_usb_buffer[PREV_BUF(buf_free)].id & USB_MSC_DATA_LAST) - && state.cmd_data_submitted == cbw_buffer.dCBWDataTransferLength) { - send_csw(); - } -#endif - /* Wait until the current buffer is free */ - while (data_usb_buffer[buf_submitted].flags & USB_BUFFER_SUBMITTED) { - PROCESS_WAIT_EVENT(); - } - while (!(data_usb_buffer[buf_submitted].flags & USB_BUFFER_SUBMITTED)) { - id = data_usb_buffer[buf_submitted].id; - /* PRINTF("id: %02x\n", id); */ - if (id == USB_BUFFER_ID_UNUSED) break; - state.cmd_data_transfered += buffer_lengths[buf_submitted]; - data_usb_buffer[buf_submitted].id = USB_BUFFER_ID_UNUSED; - buf_submitted =NEXT_BUF(buf_submitted); - if (id & USB_MSC_DATA_DO_CALLBACK) { - if (state.data_cb) { - state.data_cb(&state); - } - } - - - if (id & USB_MSC_DATA_LAST) { - break; - } - } - if (id & USB_MSC_DATA_LAST) { - break; - } - } - if (state.cmd_data_submitted < cbw_buffer.dCBWDataTransferLength) { - submit_halt(BULK_IN); - while(1) { - PROCESS_WAIT_EVENT(); - if (ev == reset_event) goto reset_state; - if (ev == PROCESS_EVENT_POLL) { - USBBuffer *buffer = get_next_buffer(BULK_IN , USB_BUFFER_ID_HALT); - if (buffer) { - if (buffer->flags & USB_BUFFER_HALT) break; - } - } - } - } - goto send_csw_state; - - receive_data_state: - PRINTF("receive_data_state\n"); - while(1) { - uint8_t id = 0; - /* Wait for any buffers to be submitted */ - while (buf_submitted == buf_free) { - PROCESS_WAIT_EVENT(); - } - /* Wait until the current buffer is free */ - while (data_usb_buffer[buf_submitted].flags & USB_BUFFER_SUBMITTED) { - PROCESS_WAIT_EVENT(); - } - while (!(data_usb_buffer[buf_submitted].flags & USB_BUFFER_SUBMITTED)) { - id = data_usb_buffer[buf_submitted].id; - /* PRINTF("id: %02x\n", id); */ - state.cmd_data_transfered += buffer_lengths[buf_submitted]; - if (id == USB_BUFFER_ID_UNUSED) break; - data_usb_buffer[buf_submitted].id = USB_BUFFER_ID_UNUSED; - buf_submitted =NEXT_BUF(buf_submitted); - if (id & USB_MSC_DATA_DO_CALLBACK) { - if (state.data_cb) { - state.data_cb(&state); - } - } - - if (id & USB_MSC_DATA_LAST) { - break; - } - } - if (id & USB_MSC_DATA_LAST) { - break; - } - - } - - if (state.cmd_data_submitted < cbw_buffer.dCBWDataTransferLength) { - submit_halt(BULK_OUT); - while(1) { - PROCESS_WAIT_EVENT(); - if (ev == reset_event) goto reset_state; - if (ev == PROCESS_EVENT_POLL) { - USBBuffer *buffer = get_next_buffer(BULK_OUT, USB_BUFFER_ID_HALT); - if (buffer && (buffer->flags & USB_BUFFER_HALT)) break; - } - } - } - goto send_csw_state; - - - send_csw_state: - PRINTF("send_csw_state\n"); - if (data_usb_buffer[PREV_BUF(buf_free)].id != USB_BUFFER_ID_CSW) { - send_csw(); - } - submit_cbw_buffer(); - while(1) { - if (ev == reset_event) goto reset_state; - PROCESS_WAIT_EVENT(); - if (ev == PROCESS_EVENT_POLL) { - USBBuffer *buffer; - if ((buffer = get_next_buffer(BULK_IN, USB_BUFFER_ID_CSW))) { - goto receive_cbw_state; - } - } - } - goto receive_cbw_state; - PROCESS_END(); -} - -PROCESS_THREAD(usb_mass_bulk_process, ev , data) -{ - PROCESS_BEGIN(); - reset_event = process_alloc_event(); - usb_msc_command_handler_init(); - usb_setup(); - usb_set_ep_event_process(BULK_IN, &usb_mass_bulk_request_process); - usb_set_ep_event_process(BULK_OUT, &usb_mass_bulk_request_process); - usb_set_global_event_process(process_current); - usb_register_request_handler(&mass_bulk_request_hook); - while(1) { - PROCESS_WAIT_EVENT(); - if (ev == PROCESS_EVENT_EXIT) break; - if (ev == PROCESS_EVENT_POLL) { - unsigned int events = usb_get_global_events(); - if (events) { - if (events & USB_EVENT_CONFIG) { - if (usb_get_current_configuration() != 0) { - PRINTF("Configured\n"); - memset(data_usb_buffer, 0, sizeof(data_usb_buffer)); - usb_setup_bulk_endpoint(BULK_IN); - usb_setup_bulk_endpoint(BULK_OUT); - process_start(&usb_mass_bulk_request_process,NULL); - } else { - process_exit(&usb_mass_bulk_request_process); - usb_disable_endpoint(BULK_IN); - usb_disable_endpoint(BULK_OUT); - } - } - if (events & USB_EVENT_RESET) { - PRINTF("RESET\n"); - process_exit(&usb_mass_bulk_request_process); - } - } - } - } - PROCESS_END(); -} - -void -usb_msc_bulk_setup() -{ - process_start(&usb_mass_bulk_process, NULL); -} diff --git a/arch/cpu/arm/common/usb/msc/usb-msc-bulk.h b/arch/cpu/arm/common/usb/msc/usb-msc-bulk.h deleted file mode 100644 index 6ac8e7372..000000000 --- a/arch/cpu/arm/common/usb/msc/usb-msc-bulk.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef USB_MSC_BULK_H_SHSP6ONHDJ__ -#define USB_MSC_BULK_H_SHSP6ONHDJ__ - -#include -#include -#include - -#define USB_MSC_BUFFERS 16 - - -struct usb_msc_bulk_cbw -{ - uint32_t dCBWSignature; - uint32_t dCBWTag; - uint32_t dCBWDataTransferLength; - uint8_t bmCBWFlags; - uint8_t bCBWLUN; - uint8_t bCBWCBLength; - uint8_t CBWCB[16]; -} BYTE_ALIGNED; - -struct usb_msc_bulk_csw -{ - uint32_t dCSWSignature; - uint32_t dCSWTag; - uint32_t dCSWDataResidue; - uint8_t bCSWStatus; -} BYTE_ALIGNED; - -struct usb_msc_command_state -{ - const uint8_t *command; - unsigned int command_length; - unsigned int status; - /* Number of data bytes received or sent */ - unsigned int cmd_data_transfered; - /* Number of data bytes submitted for transmition or reception */ - unsigned int cmd_data_submitted; - /* Set by command handler or callback */ - void (*data_cb)(struct usb_msc_command_state *state); /* May be NULL */ -}; - -void -usb_msc_bulk_setup(); - -typedef enum { - USB_MSC_HANDLER_OK = 0, - USB_MSC_HANDLER_DELAYED, - USB_MSC_HANDLER_FAILED -} usb_msc_handler_status; - -usb_msc_handler_status -usb_msc_handle_command(struct usb_msc_command_state *state); - -void -usb_msc_command_handler_init(); - -/* Call data_cb when this data has been sent or received */ -#define USB_MSC_DATA_DO_CALLBACK 0x20 - -/* Actually send the data, not just buffer it */ -#define USB_MSC_DATA_SEND 0x40 - -/* Actually receive the data, not just queue buffers for it */ -#define USB_MSC_DATA_RECEIVE 0x40 - -/* The command don't want to send or receive anymore data */ -#define USB_MSC_DATA_LAST 0x80 - -/* Submit a buffer with data to send to the host. Use a callback to be - notified when data has been sent. Data is not copied so it must - remain constant while sending. */ -void -usb_msc_send_data(const uint8_t *data, unsigned int len, unsigned int flags); - -/* Same as usb_msc_send_data but allows one to set additional flags - in USBBuffer */ -void -usb_msc_send_data_buf_flags(const uint8_t *data, unsigned int len, - unsigned int flags, uint16_t buf_flags); - -#define USB_MSC_SEND_ABORT() \ -usb_msc_send_data_buf_flags(NULL, 0, USB_MSC_DATA_LAST, 0) - -/* Submit a buffer for receiving data from the host. Use a callback to - be notified when data has arrived. */ -void -usb_msc_receive_data(uint8_t *data, unsigned int len, unsigned int flags); - -/* Same as usb_msc_receive_data but allows one to set additional flags - in USBBuffer */ -void -usb_msc_receive_data_buf_flags(uint8_t *data, unsigned int len, - unsigned int flags, uint16_t buf_flags); -#define USB_MSC_RECEIVE_ABORT() \ - usb_msc_receive_data_buf_flags(NULL, 0, USB_MSC_DATA_LAST, 0) - -#define USB_MSC_DONE() \ - usb_msc_send_data_buf_flags(NULL, 0, USB_MSC_DATA_LAST, 0) - - - -#endif /* USB_MSC_BULK_H_SHSP6ONHDJ__ */ diff --git a/arch/cpu/arm/common/usb/msc/usb-rbc.c b/arch/cpu/arm/common/usb/msc/usb-rbc.c deleted file mode 100644 index ca79a1fa1..000000000 --- a/arch/cpu/arm/common/usb/msc/usb-rbc.c +++ /dev/null @@ -1,365 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#ifndef USB_RBC_NUM_BLOCKS -#define USB_RBC_NUM_BLOCKS 32 -#endif - -static struct spc2_sense_data sense_data = - { - SCSI_SENSE_CURRENT_ERROR, - 0, - 0, - {0}, - (sizeof(struct spc2_sense_data) - - offsetof(struct spc2_sense_data, command_specific)) - }; - -static void -scsi_error(unsigned int sense_key, unsigned int asc, int32_t info) -{ - sense_data.response_code = SCSI_SENSE_INFORMATION_VALID | SCSI_SENSE_CURRENT_ERROR; - sense_data.information[0] = (info >> 24) & 0xff; - sense_data.information[1] = (info >> 16) & 0xff; - sense_data.information[2] = (info >> 8) & 0xff; - sense_data.information[3] = info & 0xff; - sense_data.sense_key = sense_key; - sense_data.asc = (asc >> 8) & 0xff; - sense_data.ascq = asc & 0xff; -} - -static void -scsi_ok() -{ - sense_data.response_code = SCSI_SENSE_CURRENT_ERROR; - sense_data.sense_key = SCSI_SENSE_KEY_NO_SENSE; - sense_data.asc = 0x00; - sense_data.ascq = 0x00; -}; - -static const struct spc2_std_inquiry_data std_inquiry_data = - { - SCSI_STD_INQUIRY_CONNECTED | SCSI_STD_INQUIRY_TYPE_RBC, - 0, - SCSI_STD_INQUIRY_VERSION_SPC2, - 0, - (sizeof(struct spc2_std_inquiry_data) - - offsetof(struct spc2_std_inquiry_data, flags3)), - 0, - 0, - 0, - {'F','l','u','f','w','a','r','e'}, - {'T','e','s','t',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}, - {'0','.','1',' '} - }; - -#define UNIT_NAME {'F','l','u','f','f','w','a','r','e',' ', \ - 'P','s','e','u','d','o',' ','D','i','s','k'} -#define UNIT_NAME_LENGTH 21 - -static const struct -{ - struct spc2_vital_product_data_head head; - struct { - struct spc2_vital_product_data_head head; - char unit_name[UNIT_NAME_LENGTH]; - } descriptor; -} CC_BYTE_ALIGNED device_identification_data = - { - { - SCSI_STD_INQUIRY_CONNECTED | SCSI_STD_INQUIRY_TYPE_RBC, - SCSI_PAGE_DEVICE_IDENTIFICATION, - 0, - sizeof(device_identification_data.descriptor), - }, - { - { - SCSI_CODE_SET_ACSII, - SCSI_IDENTIFIER_TYPE_NON_UNIQUE, - 0, - sizeof(device_identification_data.descriptor.unit_name) - }, - UNIT_NAME - } - }; - - -static const struct -{ - struct spc2_vital_product_data_head head; - uint8_t supported[3]; -} CC_BYTE_ALIGNED supported_pages_data = - { - { - SCSI_STD_INQUIRY_CONNECTED | SCSI_STD_INQUIRY_TYPE_RBC, - SCSI_PAGE_SUPPORTED_PAGES, - 0, - sizeof(supported_pages_data.supported), - }, - {SCSI_PAGE_SUPPORTED_PAGES, SCSI_PAGE_UNIT_SERIAL_NUMBER, - SCSI_PAGE_DEVICE_IDENTIFICATION} - }; - -static const struct -{ - struct spc2_vital_product_data_head head; - uint8_t serial_number[8]; -} CC_BYTE_ALIGNED unit_serial_number_data = { - { - SCSI_STD_INQUIRY_CONNECTED | SCSI_STD_INQUIRY_TYPE_RBC, - SCSI_PAGE_SUPPORTED_PAGES, - 0, - sizeof(unit_serial_number_data.serial_number) - }, - {'1','2','3','4','5','6','7','8'} -}; - -static usb_msc_handler_status -handle_inquiry_cmd(struct usb_msc_command_state *state) -{ - struct spc2_inquiry_cmd *cmd = (struct spc2_inquiry_cmd*)state->command; - if (cmd->flags & SCSI_INQUIRY_FLAG_CMDDT) { - scsi_error(SCSI_SENSE_KEY_ILLEGAL_REQUEST,SCSI_ASC_INVALID_FIELD_IN_CDB, - cmd->allocation_length); - return USB_MSC_HANDLER_FAILED; - } - if (cmd->flags & SCSI_INQUIRY_FLAG_EVPD) { - PRINTF("Requested page %02x\n", cmd->page); - switch (cmd->page) { - case SCSI_PAGE_SUPPORTED_PAGES: - usb_msc_send_data((uint8_t *)&supported_pages_data, - sizeof(supported_pages_data), - USB_MSC_DATA_SEND | USB_MSC_DATA_LAST); - break; - case SCSI_PAGE_DEVICE_IDENTIFICATION: - usb_msc_send_data((uint8_t *)&device_identification_data, - sizeof(device_identification_data), - USB_MSC_DATA_SEND | USB_MSC_DATA_LAST); - break; - case SCSI_PAGE_UNIT_SERIAL_NUMBER: - usb_msc_send_data((uint8_t *)&unit_serial_number_data, - sizeof(unit_serial_number_data), - USB_MSC_DATA_SEND | USB_MSC_DATA_LAST); - break; - default: - scsi_error(SCSI_SENSE_KEY_ILLEGAL_REQUEST,SCSI_ASC_INVALID_FIELD_IN_CDB, - cmd->allocation_length); - return USB_MSC_HANDLER_FAILED; - } - return USB_MSC_HANDLER_OK; - } else { - if (cmd->page != 0) { - scsi_error(SCSI_SENSE_KEY_ILLEGAL_REQUEST,SCSI_ASC_INVALID_FIELD_IN_CDB, - cmd->allocation_length); - return USB_MSC_HANDLER_FAILED; - } - usb_msc_send_data((uint8_t *)&std_inquiry_data, - sizeof(std_inquiry_data), - USB_MSC_DATA_SEND | USB_MSC_DATA_LAST); - } - return USB_MSC_HANDLER_OK; -} - -static usb_msc_handler_status -handle_request_sense_cmd(struct usb_msc_command_state *state) -{ - usb_msc_send_data((uint8_t *)&sense_data, - sizeof(sense_data), - USB_MSC_DATA_SEND | USB_MSC_DATA_LAST); - return USB_MSC_HANDLER_OK; -} - -static usb_msc_handler_status -handle_test_unit_ready_cmd(struct usb_msc_command_state *state) -{ - scsi_ok(); - return USB_MSC_HANDLER_OK; -} - -static const struct rbc_read_capacity_data read_capacity_data = - { - HOST32_TO_BE_BYTES(USB_RBC_NUM_BLOCKS-1), - HOST32_TO_BE_BYTES(512) - }; - -static usb_msc_handler_status -handle_read_capacity(struct usb_msc_command_state *state) -{ - usb_msc_send_data((uint8_t *)&read_capacity_data, - sizeof(read_capacity_data), - USB_MSC_DATA_SEND | USB_MSC_DATA_LAST); - return USB_MSC_HANDLER_OK; -} - -static const struct mode_sense_data { - struct spc2_mode_parameter_header_6 header; - struct rbc_device_parameters_page page; -} CC_BYTE_ALIGNED mode_sense_data = - { - { - (sizeof(mode_sense_data) - - offsetof(struct mode_sense_data, header.medium_type)), - 0,0,0 - }, - { - {SCSI_MODE_RBC_DEVICE_PAGE | SCSI_MODE_PAGE_SP, - sizeof(mode_sense_data) - offsetof(struct mode_sense_data, page.flags1)}, - SCSI_MODE_WCD, - HOST16_TO_BE_BYTES(512), - HOST40_TO_BE_BYTES((long long)USB_RBC_NUM_BLOCKS), - 0x80, - (SCSI_MODE_FORMATD | SCSI_MODE_LOCKD), - 0 - } - }; - -static usb_msc_handler_status -handle_mode_sense(struct usb_msc_command_state *state) -{ - struct spc2_mode_sence_6_cmd *cmd = - (struct spc2_mode_sence_6_cmd*)state->command; - PRINTF("%ld - %ld - %ld\n", sizeof(struct mode_sense_data), offsetof(struct mode_sense_data, page.flags1),offsetof(struct mode_sense_data, page.reserved)); - switch(cmd->page_code) { - case SCSI_MODE_RBC_DEVICE_PAGE: - case SCSI_MODE_SENSE_ALL_PAGES: - usb_msc_send_data((uint8_t *)&mode_sense_data, - sizeof(mode_sense_data), - USB_MSC_DATA_SEND | USB_MSC_DATA_LAST); - break; - default: - scsi_error(SCSI_SENSE_KEY_ILLEGAL_REQUEST,SCSI_ASC_INVALID_FIELD_IN_CDB, - cmd->allocation_length); - return USB_MSC_HANDLER_FAILED; - } - return USB_MSC_HANDLER_OK; -} - -static usb_msc_handler_status -handle_mode_select(struct usb_msc_command_state *state) -{ - /* Can't change anything */ - return USB_MSC_HANDLER_OK; -} -static uint8_t disk_blocks[USB_RBC_NUM_BLOCKS][512]; - -static usb_msc_handler_status -handle_read(struct usb_msc_command_state *state) -{ - struct rbc_read_cmd *cmd = (struct rbc_read_cmd*)state->command; - unsigned long lba = be32_to_host(cmd->logical_block_address); - unsigned long blocks = be16_to_host(cmd->transfer_length); - PRINTF("Requested %ld blocks at %ld\n", blocks, lba); - if (lba >= USB_RBC_NUM_BLOCKS || lba + blocks > USB_RBC_NUM_BLOCKS) { - scsi_error(SCSI_SENSE_KEY_ILLEGAL_REQUEST,SCSI_ASC_INVALID_FIELD_IN_CDB, - blocks); - return USB_MSC_HANDLER_FAILED; - } - usb_msc_send_data((uint8_t *)&disk_blocks[lba], blocks * 512, - USB_MSC_DATA_SEND | USB_MSC_DATA_LAST); - scsi_ok(); - return USB_MSC_HANDLER_OK; -} - -static void -handle_write_done(struct usb_msc_command_state *state) -{ - PRINTF("Wrote data\n"); - state->status = MASS_BULK_CSW_STATUS_PASSED; - scsi_ok(); -} - -static usb_msc_handler_status -handle_write(struct usb_msc_command_state *state) -{ - struct rbc_write_cmd *cmd = (struct rbc_write_cmd*)state->command; - unsigned long lba = be32_to_host(cmd->logical_block_address); - unsigned long blocks = be16_to_host(cmd->transfer_length); - if (lba >= USB_RBC_NUM_BLOCKS || lba + blocks > USB_RBC_NUM_BLOCKS) { - scsi_error(SCSI_SENSE_KEY_ILLEGAL_REQUEST,SCSI_ASC_INVALID_FIELD_IN_CDB, - blocks); - return USB_MSC_HANDLER_FAILED; - } - PRINTF("Writing %ld blocks at %ld\n", blocks, lba); - usb_msc_receive_data(disk_blocks[lba], blocks * 512, - USB_MSC_DATA_RECEIVE | USB_MSC_DATA_LAST - | USB_MSC_DATA_DO_CALLBACK); - state->data_cb = handle_write_done; - return USB_MSC_HANDLER_DELAYED; -} - -static usb_msc_handler_status -handle_start_stop_unit(struct usb_msc_command_state *state) -{ - scsi_ok(); - return USB_MSC_HANDLER_OK; -} - -static usb_msc_handler_status -handle_verify(struct usb_msc_command_state *state) -{ - scsi_ok(); - return USB_MSC_HANDLER_OK; -} - -usb_msc_handler_status -usb_msc_handle_command(struct usb_msc_command_state *state) -{ - - usb_msc_handler_status ret; - PRINTF("Got CBW %02x\n", state->command[0]); - switch(state->command[0]) { - case SCSI_CMD_INQUIRY: - ret = handle_inquiry_cmd(state); - break; - case SCSI_CMD_REQUEST_SENSE: - ret = handle_request_sense_cmd(state); - break; - case SCSI_CMD_TEST_UNIT_READY: - ret = handle_test_unit_ready_cmd(state); - break; - case SCSI_CMD_READ_CAPACITY: - ret = handle_read_capacity(state); - break; - case SCSI_CMD_MODE_SENSE_6: - ret = handle_mode_sense(state); - break; - case SCSI_CMD_MODE_SELECT_6: - ret = handle_mode_select(state); - break; - case SCSI_CMD_READ_10: - ret = handle_read(state); - break; - case SCSI_CMD_WRITE_10: - ret = handle_write(state); - break; - case SCSI_CMD_VERIFY_10: - ret = handle_verify(state); - break; - case SCSI_CMD_START_STOP_UNIT: - ret = handle_start_stop_unit(state); - break; - default: - printf("Unhandled request: %02x\n", state->command[0]); - scsi_error(SCSI_SENSE_KEY_ILLEGAL_REQUEST, - SCSI_ASC_INVALID_COMMAND_OPERATION,0); - return USB_MSC_HANDLER_FAILED; - } - return ret; -} - -void -usb_msc_command_handler_init() -{ -} diff --git a/arch/cpu/arm/common/usb/string-descriptors.dtd b/arch/cpu/arm/common/usb/string-descriptors.dtd deleted file mode 100644 index 66f7469f3..000000000 --- a/arch/cpu/arm/common/usb/string-descriptors.dtd +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - diff --git a/arch/cpu/arm/common/usb/string-descriptors.h b/arch/cpu/arm/common/usb/string-descriptors.h deleted file mode 100644 index dac3ce535..000000000 --- a/arch/cpu/arm/common/usb/string-descriptors.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef STRUCTGEN -#include "usb.h" -#endif -#include - -struct usb_st_string_language_map -{ - uint16_t lang_id; - const struct usb_st_string_descriptor * const *descriptors; -}; - -struct usb_st_string_languages -{ - uint8_t num_lang; - uint8_t max_index; - const struct usb_st_language_descriptor *lang_descr; - const struct usb_st_string_language_map map[1]; -}; - -extern const struct usb_st_string_languages * const string_languages; - -const uint8_t * -usb_class_get_string_descriptor(uint16_t lang, uint8_t index); diff --git a/arch/cpu/arm/common/usb/string-descriptors.xslt b/arch/cpu/arm/common/usb/string-descriptors.xslt deleted file mode 100644 index eab453326..000000000 --- a/arch/cpu/arm/common/usb/string-descriptors.xslt +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - #include "string-descriptors.h" - - - - static const struct { - struct usb_st_string_descriptor base; - Uint16 chars[ - - ]; - } string_descriptor_ - - _ - - - - - - all - - - = {{ - - , 3, {' - - '}}, { - - - - }}; - - - - - - static const struct usb_st_string_descriptor * string_table_ - - [] = { - - &string_descriptor_ - - _ - - - - - - all - - - - No string found for index - - and language - - - - - .base, - - }; - - - - static const struct { - struct usb_st_language_descriptor base; - Uint16 langs[ - - ]; - } language_descriptor = { - { - - , 3, { - - }}, { - - - , - - }}; - - - static const struct { - struct usb_st_string_languages base; - struct usb_st_string_language_map map[ - - ]; } - string_languages_full={{ - - , - - , &language_descriptor.base - , {{ - - , string_table_ - - }}}, { - - { - - , string_table_ - - }, - - } }; - const struct usb_st_string_languages * const string_languages = &string_languages_full.base; - - - - - - ' - - ' - - , - - - - - - - - - diff --git a/arch/cpu/arm/common/usb/usb-api.h b/arch/cpu/arm/common/usb/usb-api.h deleted file mode 100644 index 9ad3563e8..000000000 --- a/arch/cpu/arm/common/usb/usb-api.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef USB_API_H_SYN81IFYBN__ -#define USB_API_H_SYN81IFYBN__ - -#include - -typedef struct _USBBuffer USBBuffer; - -struct _USBBuffer -{ - USBBuffer *next; /* Pointer to next buffer in chain */ - uint8_t *data; /* Where to read/write data next */ - uint16_t left; /* Remaining length of buffer. */ - uint16_t flags; - uint32_t id; /* User data */ -}; - -/* Buffer owned by the USB code, cleared when done */ -#define USB_BUFFER_SUBMITTED 0x01 - -/* Write a short packet at end of buffer or release buffer when a - short packet is received. */ -#define USB_BUFFER_SHORT_END 0x02 - -/* Release buffer as soon as any received data has been written in it. */ -#define USB_BUFFER_PACKET_END 0x04 - -/* Notify the user when the buffer is released */ -#define USB_BUFFER_NOTIFY 0x08 - -/* Packet should be sent to host. */ -#define USB_BUFFER_IN 0x40 - -/* Used for receiving SETUP packets. If a SETUP packet is received and - the next buffers doesn't have this flag set, they will be skipped - until one is found. The associated buffer must be at least 8 bytes */ -#define USB_BUFFER_SETUP 0x20 - -/* HALT the endpoint at this point. Only valid for bulk and interrupt - endpoints */ -#define USB_BUFFER_HALT 0x100 - -/* Flags set by system */ - -/* The last packet written to this buffer was short. */ -#define USB_BUFFER_SHORT_PACKET 0x10 - -/* The operation associated with this buffer failed. I.e. it was discarded since it didn't match the received SETUP packet. */ -#define USB_BUFFER_FAILED 0x80 - -/* Architecture specific flags */ -#define USB_BUFFER_ARCH_FLAG_1 0x1000 -#define USB_BUFFER_ARCH_FLAG_2 0x2000 -#define USB_BUFFER_ARCH_FLAG_3 0x4000 -#define USB_BUFFER_ARCH_FLAG_4 0x8000 - -void -usb_setup(void); - - -/* Read only */ -struct USBRequestHandler -{ - uint8_t request_type; - uint8_t request_type_mask; - uint8_t request; - uint8_t request_mask; - /* Returns true if it handled the request, if false let another handler try*/ - unsigned int (*handler_func)(); -}; - -/* Must be writeable */ -struct USBRequestHandlerHook -{ - struct USBRequestHandlerHook *next; - const struct USBRequestHandler * const handler; -}; - -void -usb_register_request_handler(struct USBRequestHandlerHook *hook); - -void -usb_prepend_request_handler(struct USBRequestHandlerHook *hook); - -void -usb_setup_bulk_endpoint(uint8_t addr); -void -usb_setup_interrupt_endpoint(uint8_t addr); - -/* Submit a chain of buffers to be filled with received data. Last - buffer must have next set to NULL. */ -void -usb_submit_recv_buffer(uint8_t ep_addr, USBBuffer *buffer); - -/* Submit a chain of buffers to be sent. Last buffer must have next - set to NULL. When submitting packets to receive or send data in on - a control enpoint, all packets in the data stage must be submitted - at the same time. */ -void -usb_submit_xmit_buffer(uint8_t ep_addr, USBBuffer *buffer); - -/* Return true if not all data has been sent to the host */ -int -usb_send_pending(uint8_t ep_addr); - -/* Release all buffers submitted to the endpoint and discard any - buffered data. */ -void -usb_discard_all_buffers(uint8_t ep_addr); - -void -usb_disable_endpoint(uint8_t addr); - -/* Set or remove a HALT condition on an endpoint */ -void -usb_halt_endpoint(uint8_t addr, int halt); - -/* Select what process should be polled when buffers with the - USB_BUFFER_NOTIFY flag set is released from the endpoint */ -void -usb_set_ep_event_process(uint8_t addr, struct process *p); - -/* Select what process should be polled when a global event occurs */ -void -usb_set_global_event_process(struct process *p); - -/* Global events */ -#define USB_EVENT_CONFIG 0x01 -#define USB_EVENT_SUSPEND 0x02 -#define USB_EVENT_RESUME 0x04 -#define USB_EVENT_RESET 0x08 - -/* Returns global events that has occured since last time this - function was called */ -unsigned int -usb_get_global_events(void); - - -#define USB_EP_EVENT_NOTIFICATION 0x01 -unsigned int -usb_get_ep_events(uint8_t addr); - -unsigned int -usb_get_current_configuration(void); - -#endif /* USB_API_H_SYN81IFYBN__ */ diff --git a/arch/cpu/arm/common/usb/usb-arch.h b/arch/cpu/arm/common/usb/usb-arch.h deleted file mode 100644 index 61fe5ca35..000000000 --- a/arch/cpu/arm/common/usb/usb-arch.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef USB_ARCH_H_0Z52ZDP0H6__ -#define USB_ARCH_H_0Z52ZDP0H6__ - -#include -#include - - -/* Includes control endpoint 0 */ -#ifndef USB_MAX_ENDPOINTS -#define USB_MAX_ENDPOINTS 4 -#endif - -#ifndef CTRL_EP_SIZE -#define CTRL_EP_SIZE 8 -#endif - -#ifndef USB_EP1_SIZE -#define USB_EP1_SIZE 8 -#endif -#ifndef USB_EP2_SIZE -#define USB_EP2_SIZE 8 -#endif -#ifndef USB_EP3_SIZE -#define USB_EP3_SIZE 8 -#endif -#ifndef USB_EP4_SIZE -#define USB_EP4_SIZE 0 -#endif -#ifndef USB_EP5_SIZE -#define USB_EP5_SIZE 0 -#endif -#ifndef USB_EP6_SIZE -#define USB_EP6_SIZE 0 -#endif -#ifndef USB_EP7_SIZE -#define USB_EP7_SIZE 0 -#endif - - -#ifndef MAX_CTRL_DATA -#define MAX_CTRL_DATA 128 -#endif - -void -usb_arch_setup(void); - -void -usb_arch_setup_control_endpoint(uint8_t addr); - -void -usb_arch_setup_bulk_endpoint(uint8_t addr); - -void -usb_arch_setup_interrupt_endpoint(uint8_t addr); - -void -usb_arch_disable_endpoint(uint8_t addr); - -void -usb_arch_discard_all_buffers(uint8_t addr); - -/* Stall a control endpoint. The stall will be cleared when the next - SETUP token arrives. */ -void -usb_arch_control_stall(uint8_t addr); - -/* Set or remove a HALT condition on an endpoint */ -void -usb_arch_halt_endpoint(uint8_t addr, int halt); - -void -usb_arch_set_configuration(uint8_t usb_configuration_value); - -uint16_t -usb_arch_get_ep_status(uint8_t addr); - -void -usb_arch_set_address(uint8_t addr); - - -/* Select what process should be polled when a global event occurs. Intended for the protocol handler. Applications should use usb_set_global_event_process */ -void -usb_arch_set_global_event_process(struct process *p); - -unsigned int -usb_arch_get_global_events(void); - -/* Return true if not all data has been sent to the host */ -int -usb_arch_send_pending(uint8_t ep_addr); - -#endif /* USB_ARCH_H_0Z52ZDP0H6__ */ diff --git a/arch/cpu/arm/common/usb/usb-core.c b/arch/cpu/arm/common/usb/usb-core.c deleted file mode 100644 index 662ec95a0..000000000 --- a/arch/cpu/arm/common/usb/usb-core.c +++ /dev/null @@ -1,614 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEBUG -#ifdef DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - - -struct USB_request_st usb_setup_buffer; -static USBBuffer ctrl_buffer; - -#define SETUP_ID 1 -#define OUT_ID 2 -#define IN_ID 3 -#define STATUS_OUT_ID 4 -#define STATUS_IN_ID 5 - -static uint16_t usb_device_status; -static uint8_t usb_configuration_value; - -static struct USBRequestHandlerHook *usb_request_handler_hooks = NULL; - -static const unsigned char zero_byte = 0; -static const unsigned short zero_word = 0; - -static unsigned char usb_flags = 0; -#define USB_FLAG_ADDRESS_PENDING 0x01 - -static struct process *global_user_event_pocess = NULL; -static unsigned int global_user_events = 0; - -void -usb_set_global_event_process(struct process *p) -{ - global_user_event_pocess = p; -} -unsigned int -usb_get_global_events(void) -{ - unsigned int e = global_user_events; - global_user_events = 0; - return e; -} - -static void -notify_user(unsigned int e) -{ - global_user_events |= e; - if (global_user_event_pocess) { - process_poll(global_user_event_pocess); - } -} - -void -usb_send_ctrl_response(const uint8_t *data, unsigned int len) -{ - if (ctrl_buffer.flags & USB_BUFFER_SUBMITTED) return; - if (len >= usb_setup_buffer.wLength) { - len = usb_setup_buffer.wLength; /* Truncate if too long */ - } - ctrl_buffer.flags = USB_BUFFER_NOTIFY | USB_BUFFER_IN; - if (len < usb_setup_buffer.wLength) { - ctrl_buffer.flags |= USB_BUFFER_SHORT_END; - } - ctrl_buffer.next = NULL; - ctrl_buffer.data = (uint8_t*)data; - ctrl_buffer.left = len; - ctrl_buffer.id = IN_ID; - usb_submit_xmit_buffer(0,&ctrl_buffer); -} - -static uint8_t error_stall = 0; - -void -usb_error_stall() -{ - error_stall = 1; - usb_arch_control_stall(0); -} - -void -usb_send_ctrl_status() -{ - if (ctrl_buffer.flags & USB_BUFFER_SUBMITTED) return; - ctrl_buffer.flags = USB_BUFFER_NOTIFY | USB_BUFFER_IN; - ctrl_buffer.next = NULL; - ctrl_buffer.data = NULL; - ctrl_buffer.left = 0; - ctrl_buffer.id = STATUS_IN_ID; - usb_submit_xmit_buffer(0,&ctrl_buffer); -} - -static usb_ctrl_data_callback data_callback = NULL; -static uint8_t *ctrl_data = NULL; -static unsigned int ctrl_data_len = 0; -void -usb_get_ctrl_data(uint8_t *data, unsigned int length, - usb_ctrl_data_callback cb) -{ - if (ctrl_buffer.flags & USB_BUFFER_SUBMITTED) return; - PRINTF("usb_get_ctrl_data: %d\n",length); - data_callback = cb; - ctrl_data = data; - ctrl_data_len = length; - ctrl_buffer.flags = USB_BUFFER_NOTIFY; - ctrl_buffer.next = NULL; - ctrl_buffer.data = data; - ctrl_buffer.left = length; - ctrl_buffer.id = OUT_ID; - usb_submit_recv_buffer(0,&ctrl_buffer); -} - -#if 0 - -void -usb_set_user_process(struct process *p) -{ - user_process = p; -} -#endif - -static void -get_device_descriptor() -{ - usb_send_ctrl_response((unsigned char*)&device_descriptor, sizeof(device_descriptor)); -} - -static void -get_string_descriptor() -{ -#if OLD_STRING_DESCR - if (LOW_BYTE(usb_setup_buffer.wValue) == 0) { - usb_send_ctrl_response((const unsigned char*)string_languages->lang_descr, - string_languages->lang_descr->bLength); - } else { - const struct usb_st_string_descriptor *descriptor; - unsigned char l; - const struct usb_st_string_descriptor * const *table; - const struct usb_st_string_language_map *map; - if (LOW_BYTE(usb_setup_buffer.wValue) > string_languages->max_index) { - usb_error_stall(); - return; - } - l = string_languages->num_lang; - map = string_languages->map; - table = map->descriptors; /* Use first table if language not found */ - while (l > 0) { - if (map->lang_id == usb_setup_buffer.wIndex) { - table = map->descriptors; - break; - } - map++; - l--; - } - PRINTF("Lang id %04x = table %p\n", usb_setup_buffer.wIndex, (void*)table); - descriptor = table[LOW_BYTE(usb_setup_buffer.wValue) - 1]; - usb_send_ctrl_response((const unsigned char*)descriptor, - descriptor->bLength); - } -#else - const struct usb_st_string_descriptor *descriptor; - descriptor = (struct usb_st_string_descriptor*) - usb_class_get_string_descriptor(usb_setup_buffer.wIndex, - LOW_BYTE(usb_setup_buffer.wValue)); - if (!descriptor) { - usb_error_stall(); - return; - } - usb_send_ctrl_response((const unsigned char*)descriptor, - descriptor->bLength); -#endif -} - -static void -get_configuration_descriptor() -{ - usb_send_ctrl_response((unsigned char*)configuration_head, - configuration_head->wTotalLength); -} - -static void -get_configuration() -{ - usb_send_ctrl_response((unsigned char*)&usb_configuration_value, - sizeof(usb_configuration_value)); -} - -/* Returns true if the configuration value changed */ -static int -set_configuration() -{ - notify_user(USB_EVENT_CONFIG); - if (usb_configuration_value != LOW_BYTE(usb_setup_buffer.wValue)) { - usb_configuration_value = LOW_BYTE(usb_setup_buffer.wValue); - usb_arch_set_configuration(usb_configuration_value); - usb_send_ctrl_status(); - return 1; - } else { - usb_send_ctrl_status(); - return 0; - } -} - -static void -get_device_status() -{ - PRINTF("get_device_status\n"); - usb_send_ctrl_response((const unsigned char*)&usb_device_status, - sizeof(usb_device_status)); -} - -static void -get_endpoint_status() -{ - static uint16_t status; - PRINTF("get_endpoint_status\n"); - if ((usb_setup_buffer.wIndex & 0x7f) == 0) { - usb_send_ctrl_response((const unsigned char*)&zero_word, - sizeof(zero_word)); - } else { - status = usb_arch_get_ep_status(usb_setup_buffer.wIndex); - usb_send_ctrl_response((uint8_t*)&status, sizeof(status)); - } -} - -static void -get_interface_status() -{ - PRINTF("get_interface_status\n"); - usb_send_ctrl_response((const unsigned char*)&zero_word, - sizeof(zero_word)); -} - -static void -get_interface() -{ - PRINTF("get_interface\n"); - if (usb_configuration_value == 0) usb_error_stall(); - else { - usb_send_ctrl_response(&zero_byte, - sizeof(zero_byte)); - } -} - - -static unsigned int -handle_standard_requests() -{ - switch(usb_setup_buffer.bmRequestType) { - case 0x80: /* standard device IN requests */ - switch(usb_setup_buffer.bRequest) { - case GET_DESCRIPTOR: - switch (HIGH_BYTE(usb_setup_buffer.wValue)) { - case DEVICE: - get_device_descriptor(); - break; - case CONFIGURATION: - get_configuration_descriptor(); - break; - case STRING: - get_string_descriptor(); - break; - default: - /* Unknown descriptor */ - return 0; - } - break; - case GET_CONFIGURATION: - get_configuration(); - break; - case GET_STATUS: - get_device_status(); - break; - case GET_INTERFACE: - get_interface(); - break; - default: - return 0; - } - break; - case 0x81: /* standard interface IN requests */ - switch(usb_setup_buffer.bRequest) { - case GET_STATUS: - get_interface_status(); - break; -#ifdef HID_ENABLED - case GET_DESCRIPTOR: - switch (USB_setup_buffer.wValue.byte.high) { - case REPORT: - get_report_descriptor(); - break; - } - break; -#endif - default: - return 0; - } - break; - case 0x82: /* standard endpoint IN requests */ - switch(usb_setup_buffer.bRequest) { - case GET_STATUS: - get_endpoint_status(); - break; - default: - return 0; - } - break; - case 0x00: /* standard device OUT requests */ - switch(usb_setup_buffer.bRequest) { - case SET_ADDRESS: - PRINTF("Address: %d\n", LOW_BYTE(usb_setup_buffer.wValue)); - usb_flags |= USB_FLAG_ADDRESS_PENDING; - /* The actual setting of the address is done when the status packet - is sent. */ - usb_send_ctrl_status(); - break; -#if SETABLE_STRING_DESCRIPTORS > 0 - case SET_DESCRIPTOR: - if (usb_setup_buffer.wValue.byte.high == STRING) { - set_string_descriptor(); - } else { - return 0; - } - break; -#endif - case SET_CONFIGURATION: - if (set_configuration()) { -#if 0 - config_msg.data.config = LOW_BYTE(usb_setup_buffer.wValue); - notify_user(&config_msg); -#endif - } - break; - default: - return 0; - } - break; - case 0x01: /* standard interface OUT requests */ - switch(usb_setup_buffer.bRequest) { - case SET_INTERFACE: - /* Change interface here if we support more than one */ - usb_send_ctrl_status(); - break; - default: - return 0; - } - break; - case 0x02: /* standard endpoint OUT requests */ - switch(usb_setup_buffer.bRequest) { - case SET_FEATURE: - case CLEAR_FEATURE: - if (usb_setup_buffer.wValue == ENDPOINT_HALT_FEATURE) { - usb_arch_halt_endpoint(usb_setup_buffer.wIndex, usb_setup_buffer.bRequest== SET_FEATURE); - usb_send_ctrl_status(); - } else { - usb_error_stall(); - } - break; - default: - return 0; - } - break; -#ifdef HID_ENABLED - case 0xa1: /* class specific interface IN request*/ - switch(USB_setup_buffer.bRequest) { - case GET_HID_REPORT: - PRINTF("Get report\n"); - send_ctrl_response((code u_int8_t*)&zero_byte, - sizeof(zero_byte)); - break; - case GET_HID_IDLE: - PRINTF("Get idle\n"); - send_ctrl_response((code u_int8_t*)&zero_byte, - sizeof(zero_byte)); - break; - default: - return 0; - } - break; - case 0x21: /* class specific interface OUT request*/ - switch(USB_setup_buffer.bRequest) { - case SET_HID_IDLE: - PRINTF("Set idle\n"); - send_ctrl_status(); - break; - default: - return 0; - } - break; -#endif - default: - return 0; - } - return 1; -} - -static const struct USBRequestHandler standard_request_handler = - { - 0x00, 0x60, - 0x00, 0x00, - handle_standard_requests - }; - -static struct USBRequestHandlerHook standard_request_hook = - { - NULL, - &standard_request_handler - }; - -static void -submit_setup(void) -{ - ctrl_buffer.next = NULL; - ctrl_buffer.data = (uint8_t*)&usb_setup_buffer; - ctrl_buffer.left = sizeof(usb_setup_buffer); - ctrl_buffer.flags = (USB_BUFFER_PACKET_END | USB_BUFFER_SETUP - | USB_BUFFER_NOTIFY); - ctrl_buffer.id = SETUP_ID; - usb_submit_recv_buffer(0, &ctrl_buffer); -} - -PROCESS(usb_process, "USB"); - -PROCESS_THREAD(usb_process, ev , data) -{ - PROCESS_BEGIN(); - PRINTF("USB process started\n"); - while(1) { - PROCESS_WAIT_EVENT(); - if (ev == PROCESS_EVENT_EXIT) break; - if (ev == PROCESS_EVENT_POLL) { - unsigned int events = usb_arch_get_global_events(); - if (events) { - if (events & USB_EVENT_RESET) { - submit_setup(); - usb_configuration_value = 0; - notify_user(USB_EVENT_RESET); - } - if (events & USB_EVENT_SUSPEND) { - notify_user(USB_EVENT_SUSPEND); - } - if (events & USB_EVENT_RESUME) { - notify_user(USB_EVENT_RESUME); - } - - } - events = usb_get_ep_events(0); - if (events) { - if ((events & USB_EP_EVENT_NOTIFICATION) - && !(ctrl_buffer.flags & USB_BUFFER_SUBMITTED)) { - /* PRINTF("Endpoint 0\n"); */ - if (ctrl_buffer.flags & USB_BUFFER_FAILED) { - /* Something went wrong with the buffer, just wait for a - new SETUP packet */ - PRINTF("Discarded\n"); - submit_setup(); - } else if (ctrl_buffer.flags & USB_BUFFER_SETUP) { - struct USBRequestHandlerHook *hook = usb_request_handler_hooks; - - PRINTF("Setup\n"); - { - unsigned int i; - for (i = 0; i< 8; i++) PRINTF(" %02x", ((unsigned char*)&usb_setup_buffer)[i]); - PRINTF("\n"); - } - - while(hook) { - const struct USBRequestHandler *handler = hook->handler; - /* Check if the handler matches the request */ - if (((handler->request_type ^ usb_setup_buffer.bmRequestType) - & handler->request_type_mask) == 0 - && ((handler->request ^ usb_setup_buffer.bRequest) - & handler->request_mask) == 0) { - if (handler->handler_func()) break; - } - hook = hook->next; - } - if (!hook) { - /* No handler found */ - usb_error_stall(); - PRINTF("Unhandled setup: %02x %02x %04x %04x %04x\n", - usb_setup_buffer.bmRequestType, usb_setup_buffer.bRequest, - usb_setup_buffer.wValue, usb_setup_buffer.wIndex, - usb_setup_buffer.wLength); - } - /* Check if any handler stalled the pipe, if so prepare for - next setup */ - if (error_stall) { - error_stall = 0; - submit_setup(); - } - } else { - if (ctrl_buffer.id == IN_ID) { - /* Receive status stage */ - PRINTF("Status OUT\n"); - ctrl_buffer.flags = USB_BUFFER_NOTIFY; - ctrl_buffer.next = NULL; - ctrl_buffer.data = NULL; - ctrl_buffer.left = 0; - ctrl_buffer.id = STATUS_OUT_ID; - usb_submit_recv_buffer(0,&ctrl_buffer); - } else if (ctrl_buffer.id == STATUS_OUT_ID) { - PRINTF("Status OUT done\n"); - submit_setup(); - } else if (ctrl_buffer.id == STATUS_IN_ID) { - PRINTF("Status IN done\n"); - if (usb_flags & USB_FLAG_ADDRESS_PENDING) { - while(usb_send_pending(0)); - usb_arch_set_address(LOW_BYTE(usb_setup_buffer.wValue)); - usb_flags &= ~USB_FLAG_ADDRESS_PENDING; - } - submit_setup(); - } else if (ctrl_buffer.id == OUT_ID) { - PRINTF("OUT\n"); - if (data_callback) { - data_callback(ctrl_data, ctrl_data_len- ctrl_buffer.left); - } else { - usb_send_ctrl_status(); - } - } - } - } - } - } - } - PROCESS_END(); -} - - -void -usb_setup(void) -{ - usb_arch_setup(); - process_start(&usb_process, NULL); - usb_arch_set_global_event_process(&usb_process); - usb_set_ep_event_process(0, &usb_process); - - usb_register_request_handler(&standard_request_hook); -} - -void -usb_register_request_handler(struct USBRequestHandlerHook *hook) -{ - struct USBRequestHandlerHook **prevp = &usb_request_handler_hooks; - /* Find last hook */ - while(*prevp) { - prevp = &(*prevp)->next; - } - /* Add last */ - *prevp = hook; - hook->next = NULL; -} - -void -usb_prepend_request_handler(struct USBRequestHandlerHook *hook) -{ - hook->next = usb_request_handler_hooks; - usb_request_handler_hooks = hook; -} - - -unsigned int -usb_get_current_configuration(void) -{ - return usb_configuration_value; -} - -void -usb_setup_bulk_endpoint(unsigned char addr) -{ - usb_arch_setup_bulk_endpoint(addr); -} - -void -usb_setup_interrupt_endpoint(unsigned char addr) -{ - usb_arch_setup_interrupt_endpoint(addr); -} - -void -usb_disable_endpoint(uint8_t addr) -{ - usb_arch_discard_all_buffers(addr); - usb_arch_disable_endpoint(addr); -} - -void -usb_discard_all_buffers(uint8_t addr) -{ - usb_arch_discard_all_buffers(addr); -} - -void -usb_halt_endpoint(uint8_t addr, int halt) -{ - usb_arch_halt_endpoint(addr, halt); -} - -int -usb_send_pending(uint8_t addr) -{ - return usb_arch_send_pending(addr); -} - diff --git a/arch/cpu/arm/common/usb/usb-core.h b/arch/cpu/arm/common/usb/usb-core.h deleted file mode 100644 index d35b064dd..000000000 --- a/arch/cpu/arm/common/usb/usb-core.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef USB_CORE_H_YIKJDA7S1X__ -#define USB_CORE_H_YIKJDA7S1X__ - -#include - -struct USB_request_st usb_setup_buffer; - -void -usb_send_ctrl_response(const uint8_t *data, unsigned int len); - -void -usb_error_stall(); - -void -usb_send_ctrl_status(); - -typedef void (*usb_ctrl_data_callback)(uint8_t *data, unsigned int length); - -void -usb_get_ctrl_data(uint8_t *data, unsigned int length, - usb_ctrl_data_callback cb); - -#endif /* USB_CORE_H_YIKJDA7S1X__ */ diff --git a/arch/cpu/arm/common/usb/usb.h b/arch/cpu/arm/common/usb/usb.h deleted file mode 100644 index a1d7dfb78..000000000 --- a/arch/cpu/arm/common/usb/usb.h +++ /dev/null @@ -1,185 +0,0 @@ -#ifndef USB_H_6PFTDPIMZM__ -#define USB_H_6PFTDPIMZM__ -#include - -/* Adapted from usb_kbd_enum.h in c5131-usb-kbd-light-1_0_2 package from - Atmel */ - -/* These definitions assume a little endian architecture */ - -#ifdef __GNUC__ -#define BYTE_ALIGNED __attribute__ ((__packed__)) -#else -#define BYTE_ALIGNED -#endif - -#define LOW_BYTE(x) ((unsigned char)x) -#define HIGH_BYTE(x) ((unsigned char)(x>>8)) - -typedef uint8_t Uchar; -typedef uint16_t Uint16; -typedef uint32_t Uint32; - -/*_____ S T A N D A R D R E Q U E S T S __________________________________*/ - -#define GET_STATUS 0x00 -#define GET_DEVICE 0x01 -#define CLEAR_FEATURE 0x01 /* see FEATURES below */ -#define GET_STRING 0x03 -#define SET_FEATURE 0x03 /* see FEATURES below */ -#define SET_ADDRESS 0x05 -#define GET_DESCRIPTOR 0x06 -#define SET_DESCRIPTOR 0x07 -#define GET_CONFIGURATION 0x08 -#define SET_CONFIGURATION 0x09 -#define GET_INTERFACE 0x0A -#define SET_INTERFACE 0x0B -#define SYNCH_FRAME 0x0C - -#define GET_DEVICE_DESCRIPTOR 1 -#define GET_CONFIGURATION_DESCRIPTOR 4 - -#define REQUEST_DEVICE_STATUS 0x80 -#define REQUEST_INTERFACE_STATUS 0x81 -#define REQUEST_ENDPOINT_STATUS 0x82 -#define ZERO_TYPE 0x00 -#define INTERFACE_TYPE 0x01 -#define ENDPOINT_TYPE 0x02 - -/*_____ D E S C R I P T O R T Y P E S ____________________________________*/ - -#define DEVICE 0x01 -#define CONFIGURATION 0x02 -#define STRING 0x03 -#define INTERFACE 0x04 -#define ENDPOINT 0x05 - -/* HID specific */ -#define HID 0x21 -#define REPORT 0x22 -/* *** */ - -/*_____ S T A N D A R D F E A T U R E S __________________________________*/ - -#define DEVICE_REMOTE_WAKEUP_FEATURE 0x01 -#define ENDPOINT_HALT_FEATURE 0x00 - -/*_____ D E V I C E S T A T U S ___________________________________________*/ - -#define SELF_POWERED 1 - -/*_____ D E V I C E S T A T E _____________________________________________*/ - -#define ATTACHED 0 -#define POWERED 1 -#define DEFAULT 2 -#define ADDRESSED 3 -#define CONFIGURED 4 -#define SUSPENDED 5 - -#define USB_CONFIG_BUSPOWERED 0x80 -#define USB_CONFIG_SELFPOWERED 0x40 -#define USB_CONFIG_REMOTEWAKEUP 0x20 - -/* Class specific */ -#define CS_INTERFACE 0x24 -#define CS_ENDPOINT 0x25 - -/*_________________________________________________________ S T R U C T _____*/ -/*_____ U S B D E V I C E R E Q U E S T _________________________________*/ - -struct USB_request_st -{ - Uchar bmRequestType; /* Characteristics of the request */ - Uchar bRequest; /* Specific request */ - Uint16 wValue; - Uint16 wIndex; /* field that varies according to request */ - Uint16 wLength; /* Number of bytes to transfer if Data */ -}; - - -/*_____ U S B D E V I C E D E S C R I P T O R ___________________________*/ - -struct usb_st_device_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* DEVICE descriptor type */ - Uint16 bscUSB; /* Binay Coded Decimal Spec. release */ - Uchar bDeviceClass; /* Class code assigned by the USB */ - Uchar bDeviceSubClass; /* Sub-class code assigned by the USB */ - Uchar bDeviceProtocol; /* Protocol code assigned by the USB */ - Uchar bMaxPacketSize0; /* Max packet size for EP0 */ - Uint16 idVendor; /* Vendor ID. ATMEL = 0x03EB */ - Uint16 idProduct; /* Product ID assigned by the manufacturer */ - Uint16 bcdDevice; /* Device release number */ - Uchar iManufacturer; /* Index of manu. string descriptor */ - Uchar iProduct; /* Index of prod. string descriptor */ - Uchar iSerialNumber; /* Index of S.N. string descriptor */ - Uchar bNumConfigurations; /* Number of possible configurations */ -} BYTE_ALIGNED; - - -/*_____ U S B C O N F I G U R A T I O N D E S C R I P T O R _____________*/ - -struct usb_st_configuration_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* CONFIGURATION descriptor type */ - Uint16 wTotalLength; /* total length of data returned */ - Uchar bNumInterfaces; /* number of interfaces for this conf. */ - Uchar bConfigurationValue; /* value for SetConfiguration resquest */ - Uchar iConfiguration; /* index of string descriptor */ - Uchar bmAttibutes; /* Configuration characteristics */ - Uchar MaxPower; /* maximum power consumption */ -} BYTE_ALIGNED; - - -/*_____ U S B I N T E R F A C E D E S C R I P T O R _____________________*/ - -struct usb_st_interface_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bInterfaceNumber; /* Number of interface */ - Uchar bAlternateSetting; /* value to select alternate setting */ - Uchar bNumEndpoints; /* Number of EP except EP 0 */ - Uchar bInterfaceClass; /* Class code assigned by the USB */ - Uchar bInterfaceSubClass; /* Sub-class code assigned by the USB */ - Uchar bInterfaceProtocol; /* Protocol code assigned by the USB */ - Uchar iInterface; /* Index of string descriptor */ -} BYTE_ALIGNED; - - -/*_____ U S B E N D P O I N T D E S C R I P T O R _______________________*/ - -struct usb_st_endpoint_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* ENDPOINT descriptor type */ - Uchar bEndpointAddress; /* Address of the endpoint */ - Uchar bmAttributes; /* Endpoint's attributes */ - Uint16 wMaxPacketSize; /* Maximum packet size for this EP */ - Uchar bInterval; /* Interval for polling EP in ms */ -/* Uchar bRefresh; */ -/* Uchar bSynchAddress; */ -} BYTE_ALIGNED; - - -/*_____ U S B S T R I N G D E S C R I P T O R _______________*/ - -struct usb_st_string_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[1];/* unicode characters */ -} BYTE_ALIGNED; - - -struct usb_st_language_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wlangid[1]; /* language id */ -} BYTE_ALIGNED; - -#endif /* USB_H_6PFTDPIMZM__ */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/cmsis_armcc.h b/arch/cpu/arm/cortex-m/CMSIS/cmsis_armcc.h deleted file mode 100644 index 74c49c67d..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/cmsis_armcc.h +++ /dev/null @@ -1,734 +0,0 @@ -/**************************************************************************//** - * @file cmsis_armcc.h - * @brief CMSIS Cortex-M Core Function/Instruction Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND 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 __CMSIS_ARMCC_H -#define __CMSIS_ARMCC_H - - -#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677) - #error "Please use ARM Compiler Toolchain V4.0.677 or later!" -#endif - -/* ########################### Core Function Access ########################### */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions - @{ - */ - -/* intrinsic void __enable_irq(); */ -/* intrinsic void __disable_irq(); */ - -/** - \brief Get Control Register - \details Returns the content of the Control Register. - \return Control Register value - */ -__STATIC_INLINE uint32_t __get_CONTROL(void) -{ - register uint32_t __regControl __ASM("control"); - return(__regControl); -} - - -/** - \brief Set Control Register - \details Writes the given value to the Control Register. - \param [in] control Control Register value to set - */ -__STATIC_INLINE void __set_CONTROL(uint32_t control) -{ - register uint32_t __regControl __ASM("control"); - __regControl = control; -} - - -/** - \brief Get IPSR Register - \details Returns the content of the IPSR Register. - \return IPSR Register value - */ -__STATIC_INLINE uint32_t __get_IPSR(void) -{ - register uint32_t __regIPSR __ASM("ipsr"); - return(__regIPSR); -} - - -/** - \brief Get APSR Register - \details Returns the content of the APSR Register. - \return APSR Register value - */ -__STATIC_INLINE uint32_t __get_APSR(void) -{ - register uint32_t __regAPSR __ASM("apsr"); - return(__regAPSR); -} - - -/** - \brief Get xPSR Register - \details Returns the content of the xPSR Register. - \return xPSR Register value - */ -__STATIC_INLINE uint32_t __get_xPSR(void) -{ - register uint32_t __regXPSR __ASM("xpsr"); - return(__regXPSR); -} - - -/** - \brief Get Process Stack Pointer - \details Returns the current value of the Process Stack Pointer (PSP). - \return PSP Register value - */ -__STATIC_INLINE uint32_t __get_PSP(void) -{ - register uint32_t __regProcessStackPointer __ASM("psp"); - return(__regProcessStackPointer); -} - - -/** - \brief Set Process Stack Pointer - \details Assigns the given value to the Process Stack Pointer (PSP). - \param [in] topOfProcStack Process Stack Pointer value to set - */ -__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) -{ - register uint32_t __regProcessStackPointer __ASM("psp"); - __regProcessStackPointer = topOfProcStack; -} - - -/** - \brief Get Main Stack Pointer - \details Returns the current value of the Main Stack Pointer (MSP). - \return MSP Register value - */ -__STATIC_INLINE uint32_t __get_MSP(void) -{ - register uint32_t __regMainStackPointer __ASM("msp"); - return(__regMainStackPointer); -} - - -/** - \brief Set Main Stack Pointer - \details Assigns the given value to the Main Stack Pointer (MSP). - \param [in] topOfMainStack Main Stack Pointer value to set - */ -__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - register uint32_t __regMainStackPointer __ASM("msp"); - __regMainStackPointer = topOfMainStack; -} - - -/** - \brief Get Priority Mask - \details Returns the current state of the priority mask bit from the Priority Mask Register. - \return Priority Mask value - */ -__STATIC_INLINE uint32_t __get_PRIMASK(void) -{ - register uint32_t __regPriMask __ASM("primask"); - return(__regPriMask); -} - - -/** - \brief Set Priority Mask - \details Assigns the given value to the Priority Mask Register. - \param [in] priMask Priority Mask - */ -__STATIC_INLINE void __set_PRIMASK(uint32_t priMask) -{ - register uint32_t __regPriMask __ASM("primask"); - __regPriMask = (priMask); -} - - -#if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) - -/** - \brief Enable FIQ - \details Enables FIQ interrupts by clearing the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -#define __enable_fault_irq __enable_fiq - - -/** - \brief Disable FIQ - \details Disables FIQ interrupts by setting the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -#define __disable_fault_irq __disable_fiq - - -/** - \brief Get Base Priority - \details Returns the current value of the Base Priority register. - \return Base Priority register value - */ -__STATIC_INLINE uint32_t __get_BASEPRI(void) -{ - register uint32_t __regBasePri __ASM("basepri"); - return(__regBasePri); -} - - -/** - \brief Set Base Priority - \details Assigns the given value to the Base Priority register. - \param [in] basePri Base Priority value to set - */ -__STATIC_INLINE void __set_BASEPRI(uint32_t basePri) -{ - register uint32_t __regBasePri __ASM("basepri"); - __regBasePri = (basePri & 0xFFU); -} - - -/** - \brief Set Base Priority with condition - \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, - or the new value increases the BASEPRI priority level. - \param [in] basePri Base Priority value to set - */ -__STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri) -{ - register uint32_t __regBasePriMax __ASM("basepri_max"); - __regBasePriMax = (basePri & 0xFFU); -} - - -/** - \brief Get Fault Mask - \details Returns the current value of the Fault Mask register. - \return Fault Mask register value - */ -__STATIC_INLINE uint32_t __get_FAULTMASK(void) -{ - register uint32_t __regFaultMask __ASM("faultmask"); - return(__regFaultMask); -} - - -/** - \brief Set Fault Mask - \details Assigns the given value to the Fault Mask register. - \param [in] faultMask Fault Mask value to set - */ -__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) -{ - register uint32_t __regFaultMask __ASM("faultmask"); - __regFaultMask = (faultMask & (uint32_t)1); -} - -#endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */ - - -#if (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) - -/** - \brief Get FPSCR - \details Returns the current value of the Floating Point Status/Control register. - \return Floating Point Status/Control register value - */ -__STATIC_INLINE uint32_t __get_FPSCR(void) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - register uint32_t __regfpscr __ASM("fpscr"); - return(__regfpscr); -#else - return(0U); -#endif -} - - -/** - \brief Set FPSCR - \details Assigns the given value to the Floating Point Status/Control register. - \param [in] fpscr Floating Point Status/Control value to set - */ -__STATIC_INLINE void __set_FPSCR(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - register uint32_t __regfpscr __ASM("fpscr"); - __regfpscr = (fpscr); -#endif -} - -#endif /* (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) */ - - - -/*@} end of CMSIS_Core_RegAccFunctions */ - - -/* ########################## Core Instruction Access ######################### */ -/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface - Access to dedicated instructions - @{ -*/ - -/** - \brief No Operation - \details No Operation does nothing. This instruction can be used for code alignment purposes. - */ -#define __NOP __nop - - -/** - \brief Wait For Interrupt - \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. - */ -#define __WFI __wfi - - -/** - \brief Wait For Event - \details Wait For Event is a hint instruction that permits the processor to enter - a low-power state until one of a number of events occurs. - */ -#define __WFE __wfe - - -/** - \brief Send Event - \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. - */ -#define __SEV __sev - - -/** - \brief Instruction Synchronization Barrier - \details Instruction Synchronization Barrier flushes the pipeline in the processor, - so that all instructions following the ISB are fetched from cache or memory, - after the instruction has been completed. - */ -#define __ISB() do {\ - __schedule_barrier();\ - __isb(0xF);\ - __schedule_barrier();\ - } while (0U) - -/** - \brief Data Synchronization Barrier - \details Acts as a special kind of Data Memory Barrier. - It completes when all explicit memory accesses before this instruction complete. - */ -#define __DSB() do {\ - __schedule_barrier();\ - __dsb(0xF);\ - __schedule_barrier();\ - } while (0U) - -/** - \brief Data Memory Barrier - \details Ensures the apparent order of the explicit memory operations before - and after the instruction, without ensuring their completion. - */ -#define __DMB() do {\ - __schedule_barrier();\ - __dmb(0xF);\ - __schedule_barrier();\ - } while (0U) - -/** - \brief Reverse byte order (32 bit) - \details Reverses the byte order in integer value. - \param [in] value Value to reverse - \return Reversed value - */ -#define __REV __rev - - -/** - \brief Reverse byte order (16 bit) - \details Reverses the byte order in two unsigned short values. - \param [in] value Value to reverse - \return Reversed value - */ -#ifndef __NO_EMBEDDED_ASM -__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value) -{ - rev16 r0, r0 - bx lr -} -#endif - -/** - \brief Reverse byte order in signed short value - \details Reverses the byte order in a signed short value with sign extension to integer. - \param [in] value Value to reverse - \return Reversed value - */ -#ifndef __NO_EMBEDDED_ASM -__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value) -{ - revsh r0, r0 - bx lr -} -#endif - - -/** - \brief Rotate Right in unsigned value (32 bit) - \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. - \param [in] value Value to rotate - \param [in] value Number of Bits to rotate - \return Rotated value - */ -#define __ROR __ror - - -/** - \brief Breakpoint - \details Causes the processor to enter Debug state. - Debug tools can use this to investigate system state when the instruction at a particular address is reached. - \param [in] value is ignored by the processor. - If required, a debugger can use it to store additional information about the breakpoint. - */ -#define __BKPT(value) __breakpoint(value) - - -/** - \brief Reverse bit order of value - \details Reverses the bit order of the given value. - \param [in] value Value to reverse - \return Reversed value - */ -#if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) - #define __RBIT __rbit -#else -__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) -{ - uint32_t result; - int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */ - - result = value; /* r will be reversed bits of v; first get LSB of v */ - for (value >>= 1U; value; value >>= 1U) - { - result <<= 1U; - result |= value & 1U; - s--; - } - result <<= s; /* shift when v's highest bits are zero */ - return(result); -} -#endif - - -/** - \brief Count leading zeros - \details Counts the number of leading zeros of a data value. - \param [in] value Value to count the leading zeros - \return number of leading zeros in value - */ -#define __CLZ __clz - - -#if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) - -/** - \brief LDR Exclusive (8 bit) - \details Executes a exclusive LDR instruction for 8 bit value. - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) - #define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr)) -#else - #define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop") -#endif - - -/** - \brief LDR Exclusive (16 bit) - \details Executes a exclusive LDR instruction for 16 bit values. - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) - #define __LDREXH(ptr) ((uint16_t) __ldrex(ptr)) -#else - #define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop") -#endif - - -/** - \brief LDR Exclusive (32 bit) - \details Executes a exclusive LDR instruction for 32 bit values. - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) - #define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr)) -#else - #define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop") -#endif - - -/** - \brief STR Exclusive (8 bit) - \details Executes a exclusive STR instruction for 8 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) - #define __STREXB(value, ptr) __strex(value, ptr) -#else - #define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") -#endif - - -/** - \brief STR Exclusive (16 bit) - \details Executes a exclusive STR instruction for 16 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) - #define __STREXH(value, ptr) __strex(value, ptr) -#else - #define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") -#endif - - -/** - \brief STR Exclusive (32 bit) - \details Executes a exclusive STR instruction for 32 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) - #define __STREXW(value, ptr) __strex(value, ptr) -#else - #define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") -#endif - - -/** - \brief Remove the exclusive lock - \details Removes the exclusive lock which is created by LDREX. - */ -#define __CLREX __clrex - - -/** - \brief Signed Saturate - \details Saturates a signed value. - \param [in] value Value to be saturated - \param [in] sat Bit position to saturate to (1..32) - \return Saturated value - */ -#define __SSAT __ssat - - -/** - \brief Unsigned Saturate - \details Saturates an unsigned value. - \param [in] value Value to be saturated - \param [in] sat Bit position to saturate to (0..31) - \return Saturated value - */ -#define __USAT __usat - - -/** - \brief Rotate Right with Extend (32 bit) - \details Moves each bit of a bitstring right by one bit. - The carry input is shifted in at the left end of the bitstring. - \param [in] value Value to rotate - \return Rotated value - */ -#ifndef __NO_EMBEDDED_ASM -__attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value) -{ - rrx r0, r0 - bx lr -} -#endif - - -/** - \brief LDRT Unprivileged (8 bit) - \details Executes a Unprivileged LDRT instruction for 8 bit value. - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -#define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr)) - - -/** - \brief LDRT Unprivileged (16 bit) - \details Executes a Unprivileged LDRT instruction for 16 bit values. - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -#define __LDRHT(ptr) ((uint16_t) __ldrt(ptr)) - - -/** - \brief LDRT Unprivileged (32 bit) - \details Executes a Unprivileged LDRT instruction for 32 bit values. - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -#define __LDRT(ptr) ((uint32_t ) __ldrt(ptr)) - - -/** - \brief STRT Unprivileged (8 bit) - \details Executes a Unprivileged STRT instruction for 8 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -#define __STRBT(value, ptr) __strt(value, ptr) - - -/** - \brief STRT Unprivileged (16 bit) - \details Executes a Unprivileged STRT instruction for 16 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -#define __STRHT(value, ptr) __strt(value, ptr) - - -/** - \brief STRT Unprivileged (32 bit) - \details Executes a Unprivileged STRT instruction for 32 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -#define __STRT(value, ptr) __strt(value, ptr) - -#endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */ - -/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ - - -/* ################### Compiler specific Intrinsics ########################### */ -/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics - Access to dedicated SIMD instructions - @{ -*/ - -#if (__CORTEX_M >= 0x04U) /* only for Cortex-M4 and above */ - -#define __SADD8 __sadd8 -#define __QADD8 __qadd8 -#define __SHADD8 __shadd8 -#define __UADD8 __uadd8 -#define __UQADD8 __uqadd8 -#define __UHADD8 __uhadd8 -#define __SSUB8 __ssub8 -#define __QSUB8 __qsub8 -#define __SHSUB8 __shsub8 -#define __USUB8 __usub8 -#define __UQSUB8 __uqsub8 -#define __UHSUB8 __uhsub8 -#define __SADD16 __sadd16 -#define __QADD16 __qadd16 -#define __SHADD16 __shadd16 -#define __UADD16 __uadd16 -#define __UQADD16 __uqadd16 -#define __UHADD16 __uhadd16 -#define __SSUB16 __ssub16 -#define __QSUB16 __qsub16 -#define __SHSUB16 __shsub16 -#define __USUB16 __usub16 -#define __UQSUB16 __uqsub16 -#define __UHSUB16 __uhsub16 -#define __SASX __sasx -#define __QASX __qasx -#define __SHASX __shasx -#define __UASX __uasx -#define __UQASX __uqasx -#define __UHASX __uhasx -#define __SSAX __ssax -#define __QSAX __qsax -#define __SHSAX __shsax -#define __USAX __usax -#define __UQSAX __uqsax -#define __UHSAX __uhsax -#define __USAD8 __usad8 -#define __USADA8 __usada8 -#define __SSAT16 __ssat16 -#define __USAT16 __usat16 -#define __UXTB16 __uxtb16 -#define __UXTAB16 __uxtab16 -#define __SXTB16 __sxtb16 -#define __SXTAB16 __sxtab16 -#define __SMUAD __smuad -#define __SMUADX __smuadx -#define __SMLAD __smlad -#define __SMLADX __smladx -#define __SMLALD __smlald -#define __SMLALDX __smlaldx -#define __SMUSD __smusd -#define __SMUSDX __smusdx -#define __SMLSD __smlsd -#define __SMLSDX __smlsdx -#define __SMLSLD __smlsld -#define __SMLSLDX __smlsldx -#define __SEL __sel -#define __QADD __qadd -#define __QSUB __qsub - -#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ - ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) - -#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ - ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) - -#define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \ - ((int64_t)(ARG3) << 32U) ) >> 32U)) - -#endif /* (__CORTEX_M >= 0x04) */ -/*@} end of group CMSIS_SIMD_intrinsics */ - - -#endif /* __CMSIS_ARMCC_H */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/cmsis_armcc_V6.h b/arch/cpu/arm/cortex-m/CMSIS/cmsis_armcc_V6.h deleted file mode 100644 index cd13240ce..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/cmsis_armcc_V6.h +++ /dev/null @@ -1,1800 +0,0 @@ -/**************************************************************************//** - * @file cmsis_armcc_V6.h - * @brief CMSIS Cortex-M Core Function/Instruction Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND 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 __CMSIS_ARMCC_V6_H -#define __CMSIS_ARMCC_V6_H - - -/* ########################### Core Function Access ########################### */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions - @{ - */ - -/** - \brief Enable IRQ Interrupts - \details Enables IRQ interrupts by clearing the I-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__((always_inline)) __STATIC_INLINE void __enable_irq(void) -{ - __ASM volatile ("cpsie i" : : : "memory"); -} - - -/** - \brief Disable IRQ Interrupts - \details Disables IRQ interrupts by setting the I-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__((always_inline)) __STATIC_INLINE void __disable_irq(void) -{ - __ASM volatile ("cpsid i" : : : "memory"); -} - - -/** - \brief Get Control Register - \details Returns the content of the Control Register. - \return Control Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_CONTROL(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, control" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get Control Register (non-secure) - \details Returns the content of the non-secure Control Register when in secure mode. - \return non-secure Control Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_CONTROL_NS(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, control_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Set Control Register - \details Writes the given value to the Control Register. - \param [in] control Control Register value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_CONTROL(uint32_t control) -{ - __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Set Control Register (non-secure) - \details Writes the given value to the non-secure Control Register when in secure state. - \param [in] control Control Register value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_CONTROL_NS(uint32_t control) -{ - __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory"); -} -#endif - - -/** - \brief Get IPSR Register - \details Returns the content of the IPSR Register. - \return IPSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_IPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get IPSR Register (non-secure) - \details Returns the content of the non-secure IPSR Register when in secure state. - \return IPSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_IPSR_NS(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, ipsr_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Get APSR Register - \details Returns the content of the APSR Register. - \return APSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_APSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, apsr" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get APSR Register (non-secure) - \details Returns the content of the non-secure APSR Register when in secure state. - \return APSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_APSR_NS(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, apsr_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Get xPSR Register - \details Returns the content of the xPSR Register. - \return xPSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_xPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get xPSR Register (non-secure) - \details Returns the content of the non-secure xPSR Register when in secure state. - \return xPSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_xPSR_NS(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, xpsr_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Get Process Stack Pointer - \details Returns the current value of the Process Stack Pointer (PSP). - \return PSP Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psp" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get Process Stack Pointer (non-secure) - \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state. - \return PSP Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSP_NS(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psp_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Set Process Stack Pointer - \details Assigns the given value to the Process Stack Pointer (PSP). - \param [in] topOfProcStack Process Stack Pointer value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) -{ - __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : "sp"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Set Process Stack Pointer (non-secure) - \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state. - \param [in] topOfProcStack Process Stack Pointer value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack) -{ - __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : "sp"); -} -#endif - - -/** - \brief Get Main Stack Pointer - \details Returns the current value of the Main Stack Pointer (MSP). - \return MSP Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msp" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get Main Stack Pointer (non-secure) - \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state. - \return MSP Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSP_NS(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msp_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Set Main Stack Pointer - \details Assigns the given value to the Main Stack Pointer (MSP). - \param [in] topOfMainStack Main Stack Pointer value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : "sp"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Set Main Stack Pointer (non-secure) - \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state. - \param [in] topOfMainStack Main Stack Pointer value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : "sp"); -} -#endif - - -/** - \brief Get Priority Mask - \details Returns the current state of the priority mask bit from the Priority Mask Register. - \return Priority Mask value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PRIMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, primask" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get Priority Mask (non-secure) - \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state. - \return Priority Mask value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PRIMASK_NS(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, primask_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Set Priority Mask - \details Assigns the given value to the Priority Mask Register. - \param [in] priMask Priority Mask - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) -{ - __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Set Priority Mask (non-secure) - \details Assigns the given value to the non-secure Priority Mask Register when in secure state. - \param [in] priMask Priority Mask - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PRIMASK_NS(uint32_t priMask) -{ - __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory"); -} -#endif - - -#if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=3 */ - -/** - \brief Enable FIQ - \details Enables FIQ interrupts by clearing the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__((always_inline)) __STATIC_INLINE void __enable_fault_irq(void) -{ - __ASM volatile ("cpsie f" : : : "memory"); -} - - -/** - \brief Disable FIQ - \details Disables FIQ interrupts by setting the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__((always_inline)) __STATIC_INLINE void __disable_fault_irq(void) -{ - __ASM volatile ("cpsid f" : : : "memory"); -} - - -/** - \brief Get Base Priority - \details Returns the current value of the Base Priority register. - \return Base Priority register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_BASEPRI(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, basepri" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get Base Priority (non-secure) - \details Returns the current value of the non-secure Base Priority register when in secure state. - \return Base Priority register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_BASEPRI_NS(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Set Base Priority - \details Assigns the given value to the Base Priority register. - \param [in] basePri Base Priority value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI(uint32_t value) -{ - __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Set Base Priority (non-secure) - \details Assigns the given value to the non-secure Base Priority register when in secure state. - \param [in] basePri Base Priority value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_NS(uint32_t value) -{ - __ASM volatile ("MSR basepri_ns, %0" : : "r" (value) : "memory"); -} -#endif - - -/** - \brief Set Base Priority with condition - \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, - or the new value increases the BASEPRI priority level. - \param [in] basePri Base Priority value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t value) -{ - __ASM volatile ("MSR basepri_max, %0" : : "r" (value) : "memory"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Set Base Priority with condition (non_secure) - \details Assigns the given value to the non-secure Base Priority register when in secure state only if BASEPRI masking is disabled, - or the new value increases the BASEPRI priority level. - \param [in] basePri Base Priority value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_MAX_NS(uint32_t value) -{ - __ASM volatile ("MSR basepri_max_ns, %0" : : "r" (value) : "memory"); -} -#endif - - -/** - \brief Get Fault Mask - \details Returns the current value of the Fault Mask register. - \return Fault Mask register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FAULTMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get Fault Mask (non-secure) - \details Returns the current value of the non-secure Fault Mask register when in secure state. - \return Fault Mask register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_FAULTMASK_NS(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Set Fault Mask - \details Assigns the given value to the Fault Mask register. - \param [in] faultMask Fault Mask value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) -{ - __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Set Fault Mask (non-secure) - \details Assigns the given value to the non-secure Fault Mask register when in secure state. - \param [in] faultMask Fault Mask value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask) -{ - __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory"); -} -#endif - - -#endif /* ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */ - - -#if (__ARM_ARCH_8M__ == 1U) - -/** - \brief Get Process Stack Pointer Limit - \details Returns the current value of the Process Stack Pointer Limit (PSPLIM). - \return PSPLIM Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSPLIM(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psplim" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */ -/** - \brief Get Process Stack Pointer Limit (non-secure) - \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. - \return PSPLIM Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSPLIM_NS(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Set Process Stack Pointer Limit - \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM). - \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit) -{ - __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit)); -} - - -#if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */ -/** - \brief Set Process Stack Pointer (non-secure) - \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. - \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit) -{ - __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit)); -} -#endif - - -/** - \brief Get Main Stack Pointer Limit - \details Returns the current value of the Main Stack Pointer Limit (MSPLIM). - \return MSPLIM Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSPLIM(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msplim" : "=r" (result) ); - - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */ -/** - \brief Get Main Stack Pointer Limit (non-secure) - \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state. - \return MSPLIM Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSPLIM_NS(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Set Main Stack Pointer Limit - \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM). - \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_MSPLIM(uint32_t MainStackPtrLimit) -{ - __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit)); -} - - -#if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */ -/** - \brief Set Main Stack Pointer Limit (non-secure) - \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state. - \param [in] MainStackPtrLimit Main Stack Pointer value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit) -{ - __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit)); -} -#endif - -#endif /* (__ARM_ARCH_8M__ == 1U) */ - - -#if ((__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=4 */ - -/** - \brief Get FPSCR - \details eturns the current value of the Floating Point Status/Control register. - \return Floating Point Status/Control register value - */ -#define __get_FPSCR __builtin_arm_get_fpscr -#if 0 -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FPSCR(void) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - uint32_t result; - - __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */ - __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); - __ASM volatile (""); - return(result); -#else - return(0); -#endif -} -#endif - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get FPSCR (non-secure) - \details Returns the current value of the non-secure Floating Point Status/Control register when in secure state. - \return Floating Point Status/Control register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_FPSCR_NS(void) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - uint32_t result; - - __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */ - __ASM volatile ("VMRS %0, fpscr_ns" : "=r" (result) ); - __ASM volatile (""); - return(result); -#else - return(0); -#endif -} -#endif - - -/** - \brief Set FPSCR - \details Assigns the given value to the Floating Point Status/Control register. - \param [in] fpscr Floating Point Status/Control value to set - */ -#define __set_FPSCR __builtin_arm_set_fpscr -#if 0 -__attribute__((always_inline)) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */ - __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); - __ASM volatile (""); -#endif -} -#endif - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Set FPSCR (non-secure) - \details Assigns the given value to the non-secure Floating Point Status/Control register when in secure state. - \param [in] fpscr Floating Point Status/Control value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FPSCR_NS(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */ - __ASM volatile ("VMSR fpscr_ns, %0" : : "r" (fpscr) : "vfpcc"); - __ASM volatile (""); -#endif -} -#endif - -#endif /* ((__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */ - - - -/*@} end of CMSIS_Core_RegAccFunctions */ - - -/* ########################## Core Instruction Access ######################### */ -/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface - Access to dedicated instructions - @{ -*/ - -/* Define macros for porting to both thumb1 and thumb2. - * For thumb1, use low register (r0-r7), specified by constraint "l" - * Otherwise, use general registers, specified by constraint "r" */ -#if defined (__thumb__) && !defined (__thumb2__) -#define __CMSIS_GCC_OUT_REG(r) "=l" (r) -#define __CMSIS_GCC_USE_REG(r) "l" (r) -#else -#define __CMSIS_GCC_OUT_REG(r) "=r" (r) -#define __CMSIS_GCC_USE_REG(r) "r" (r) -#endif - -/** - \brief No Operation - \details No Operation does nothing. This instruction can be used for code alignment purposes. - */ -#define __NOP __builtin_arm_nop - -/** - \brief Wait For Interrupt - \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. - */ -#define __WFI __builtin_arm_wfi - - -/** - \brief Wait For Event - \details Wait For Event is a hint instruction that permits the processor to enter - a low-power state until one of a number of events occurs. - */ -#define __WFE __builtin_arm_wfe - - -/** - \brief Send Event - \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. - */ -#define __SEV __builtin_arm_sev - - -/** - \brief Instruction Synchronization Barrier - \details Instruction Synchronization Barrier flushes the pipeline in the processor, - so that all instructions following the ISB are fetched from cache or memory, - after the instruction has been completed. - */ -#define __ISB() __builtin_arm_isb(0xF); - -/** - \brief Data Synchronization Barrier - \details Acts as a special kind of Data Memory Barrier. - It completes when all explicit memory accesses before this instruction complete. - */ -#define __DSB() __builtin_arm_dsb(0xF); - - -/** - \brief Data Memory Barrier - \details Ensures the apparent order of the explicit memory operations before - and after the instruction, without ensuring their completion. - */ -#define __DMB() __builtin_arm_dmb(0xF); - - -/** - \brief Reverse byte order (32 bit) - \details Reverses the byte order in integer value. - \param [in] value Value to reverse - \return Reversed value - */ -#define __REV __builtin_bswap32 - - -/** - \brief Reverse byte order (16 bit) - \details Reverses the byte order in two unsigned short values. - \param [in] value Value to reverse - \return Reversed value - */ -#define __REV16 __builtin_bswap16 /* ToDo: ARMCC_V6: check if __builtin_bswap16 could be used */ -#if 0 -__attribute__((always_inline)) __STATIC_INLINE uint32_t __REV16(uint32_t value) -{ - uint32_t result; - - __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -} -#endif - - -/** - \brief Reverse byte order in signed short value - \details Reverses the byte order in a signed short value with sign extension to integer. - \param [in] value Value to reverse - \return Reversed value - */ - /* ToDo: ARMCC_V6: check if __builtin_bswap16 could be used */ -__attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value) -{ - int32_t result; - - __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -} - - -/** - \brief Rotate Right in unsigned value (32 bit) - \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. - \param [in] op1 Value to rotate - \param [in] op2 Number of Bits to rotate - \return Rotated value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2) -{ - return (op1 >> op2) | (op1 << (32U - op2)); -} - - -/** - \brief Breakpoint - \details Causes the processor to enter Debug state. - Debug tools can use this to investigate system state when the instruction at a particular address is reached. - \param [in] value is ignored by the processor. - If required, a debugger can use it to store additional information about the breakpoint. - */ -#define __BKPT(value) __ASM volatile ("bkpt "#value) - - -/** - \brief Reverse bit order of value - \details Reverses the bit order of the given value. - \param [in] value Value to reverse - \return Reversed value - */ - /* ToDo: ARMCC_V6: check if __builtin_arm_rbit is supported */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) -{ - uint32_t result; - -#if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=3 */ - __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); -#else - int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */ - - result = value; /* r will be reversed bits of v; first get LSB of v */ - for (value >>= 1U; value; value >>= 1U) - { - result <<= 1U; - result |= value & 1U; - s--; - } - result <<= s; /* shift when v's highest bits are zero */ -#endif - return(result); -} - - -/** - \brief Count leading zeros - \details Counts the number of leading zeros of a data value. - \param [in] value Value to count the leading zeros - \return number of leading zeros in value - */ -#define __CLZ __builtin_clz - - -#if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=3 */ - -/** - \brief LDR Exclusive (8 bit) - \details Executes a exclusive LDR instruction for 8 bit value. - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -#define __LDREXB (uint8_t)__builtin_arm_ldrex - - -/** - \brief LDR Exclusive (16 bit) - \details Executes a exclusive LDR instruction for 16 bit values. - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -#define __LDREXH (uint16_t)__builtin_arm_ldrex - - -/** - \brief LDR Exclusive (32 bit) - \details Executes a exclusive LDR instruction for 32 bit values. - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -#define __LDREXW (uint32_t)__builtin_arm_ldrex - - -/** - \brief STR Exclusive (8 bit) - \details Executes a exclusive STR instruction for 8 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#define __STREXB (uint32_t)__builtin_arm_strex - - -/** - \brief STR Exclusive (16 bit) - \details Executes a exclusive STR instruction for 16 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#define __STREXH (uint32_t)__builtin_arm_strex - - -/** - \brief STR Exclusive (32 bit) - \details Executes a exclusive STR instruction for 32 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#define __STREXW (uint32_t)__builtin_arm_strex - - -/** - \brief Remove the exclusive lock - \details Removes the exclusive lock which is created by LDREX. - */ -#define __CLREX __builtin_arm_clrex - - -/** - \brief Signed Saturate - \details Saturates a signed value. - \param [in] value Value to be saturated - \param [in] sat Bit position to saturate to (1..32) - \return Saturated value - */ -/*#define __SSAT __builtin_arm_ssat*/ -#define __SSAT(ARG1,ARG2) \ -({ \ - int32_t __RES, __ARG1 = (ARG1); \ - __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - - -/** - \brief Unsigned Saturate - \details Saturates an unsigned value. - \param [in] value Value to be saturated - \param [in] sat Bit position to saturate to (0..31) - \return Saturated value - */ -#define __USAT __builtin_arm_usat -#if 0 -#define __USAT(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) -#endif - - -/** - \brief Rotate Right with Extend (32 bit) - \details Moves each bit of a bitstring right by one bit. - The carry input is shifted in at the left end of the bitstring. - \param [in] value Value to rotate - \return Rotated value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __RRX(uint32_t value) -{ - uint32_t result; - - __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -} - - -/** - \brief LDRT Unprivileged (8 bit) - \details Executes a Unprivileged LDRT instruction for 8 bit value. - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *ptr) -{ - uint32_t result; - - __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) ); - return ((uint8_t) result); /* Add explicit type cast here */ -} - - -/** - \brief LDRT Unprivileged (16 bit) - \details Executes a Unprivileged LDRT instruction for 16 bit values. - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *ptr) -{ - uint32_t result; - - __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) ); - return ((uint16_t) result); /* Add explicit type cast here */ -} - - -/** - \brief LDRT Unprivileged (32 bit) - \details Executes a Unprivileged LDRT instruction for 32 bit values. - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *ptr) -{ - uint32_t result; - - __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) ); - return(result); -} - - -/** - \brief STRT Unprivileged (8 bit) - \details Executes a Unprivileged STRT instruction for 8 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -__attribute__((always_inline)) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *ptr) -{ - __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); -} - - -/** - \brief STRT Unprivileged (16 bit) - \details Executes a Unprivileged STRT instruction for 16 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -__attribute__((always_inline)) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *ptr) -{ - __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); -} - - -/** - \brief STRT Unprivileged (32 bit) - \details Executes a Unprivileged STRT instruction for 32 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -__attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *ptr) -{ - __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) ); -} - -#endif /* ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */ - - -#if (__ARM_ARCH_8M__ == 1U) - -/** - \brief Load-Acquire (8 bit) - \details Executes a LDAB instruction for 8 bit value. - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDAB(volatile uint8_t *ptr) -{ - uint32_t result; - - __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) ); - return ((uint8_t) result); -} - - -/** - \brief Load-Acquire (16 bit) - \details Executes a LDAH instruction for 16 bit values. - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDAH(volatile uint16_t *ptr) -{ - uint32_t result; - - __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) ); - return ((uint16_t) result); -} - - -/** - \brief Load-Acquire (32 bit) - \details Executes a LDA instruction for 32 bit values. - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDA(volatile uint32_t *ptr) -{ - uint32_t result; - - __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) ); - return(result); -} - - -/** - \brief Store-Release (8 bit) - \details Executes a STLB instruction for 8 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -__attribute__((always_inline)) __STATIC_INLINE void __STLB(uint8_t value, volatile uint8_t *ptr) -{ - __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); -} - - -/** - \brief Store-Release (16 bit) - \details Executes a STLH instruction for 16 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -__attribute__((always_inline)) __STATIC_INLINE void __STLH(uint16_t value, volatile uint16_t *ptr) -{ - __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); -} - - -/** - \brief Store-Release (32 bit) - \details Executes a STL instruction for 32 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -__attribute__((always_inline)) __STATIC_INLINE void __STL(uint32_t value, volatile uint32_t *ptr) -{ - __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); -} - - -/** - \brief Load-Acquire Exclusive (8 bit) - \details Executes a LDAB exclusive instruction for 8 bit value. - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -#define __LDAEXB (uint8_t)__builtin_arm_ldaex - - -/** - \brief Load-Acquire Exclusive (16 bit) - \details Executes a LDAH exclusive instruction for 16 bit values. - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -#define __LDAEXH (uint16_t)__builtin_arm_ldaex - - -/** - \brief Load-Acquire Exclusive (32 bit) - \details Executes a LDA exclusive instruction for 32 bit values. - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -#define __LDAEX (uint32_t)__builtin_arm_ldaex - - -/** - \brief Store-Release Exclusive (8 bit) - \details Executes a STLB exclusive instruction for 8 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#define __STLEXB (uint32_t)__builtin_arm_stlex - - -/** - \brief Store-Release Exclusive (16 bit) - \details Executes a STLH exclusive instruction for 16 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#define __STLEXH (uint32_t)__builtin_arm_stlex - - -/** - \brief Store-Release Exclusive (32 bit) - \details Executes a STL exclusive instruction for 32 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#define __STLEX (uint32_t)__builtin_arm_stlex - -#endif /* (__ARM_ARCH_8M__ == 1U) */ - -/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ - - -/* ################### Compiler specific Intrinsics ########################### */ -/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics - Access to dedicated SIMD instructions - @{ -*/ - -#if (__ARM_FEATURE_DSP == 1U) /* ToDo: ARMCC_V6: This should be ARCH >= ARMv7-M + SIMD */ - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) -{ - uint32_t result; - - __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -#define __SSAT16(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - -#define __USAT16(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1) -{ - uint32_t result; - - __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1) -{ - uint32_t result; - - __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) -{ - uint32_t result; - - __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) -{ - uint32_t result; - - __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) -{ - union llreg_u{ - uint32_t w32[2]; - uint64_t w64; - } llr; - llr.w64 = acc; - -#ifndef __ARMEB__ /* Little endian */ - __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); -#else /* Big endian */ - __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); -#endif - - return(llr.w64); -} - -__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) -{ - union llreg_u{ - uint32_t w32[2]; - uint64_t w64; - } llr; - llr.w64 = acc; - -#ifndef __ARMEB__ /* Little endian */ - __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); -#else /* Big endian */ - __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); -#endif - - return(llr.w64); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) -{ - uint32_t result; - - __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) -{ - uint32_t result; - - __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) -{ - union llreg_u{ - uint32_t w32[2]; - uint64_t w64; - } llr; - llr.w64 = acc; - -#ifndef __ARMEB__ /* Little endian */ - __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); -#else /* Big endian */ - __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); -#endif - - return(llr.w64); -} - -__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) -{ - union llreg_u{ - uint32_t w32[2]; - uint64_t w64; - } llr; - llr.w64 = acc; - -#ifndef __ARMEB__ /* Little endian */ - __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); -#else /* Big endian */ - __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); -#endif - - return(llr.w64); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SEL (uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE int32_t __QADD( int32_t op1, int32_t op2) -{ - int32_t result; - - __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE int32_t __QSUB( int32_t op1, int32_t op2) -{ - int32_t result; - - __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -#define __PKHBT(ARG1,ARG2,ARG3) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ - __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ - __RES; \ - }) - -#define __PKHTB(ARG1,ARG2,ARG3) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ - if (ARG3 == 0) \ - __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ - else \ - __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ - __RES; \ - }) - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) -{ - int32_t result; - - __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -#endif /* (__ARM_FEATURE_DSP == 1U) */ -/*@} end of group CMSIS_SIMD_intrinsics */ - - -#endif /* __CMSIS_ARMCC_V6_H */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/cmsis_gcc.h b/arch/cpu/arm/cortex-m/CMSIS/cmsis_gcc.h deleted file mode 100644 index 2acdfb726..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/cmsis_gcc.h +++ /dev/null @@ -1,1373 +0,0 @@ -/**************************************************************************//** - * @file cmsis_gcc.h - * @brief CMSIS Cortex-M Core Function/Instruction Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND 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 __CMSIS_GCC_H -#define __CMSIS_GCC_H - -/* ignore some GCC warnings */ -#if defined ( __GNUC__ ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - - -/* ########################### Core Function Access ########################### */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions - @{ - */ - -/** - \brief Enable IRQ Interrupts - \details Enables IRQ interrupts by clearing the I-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void) -{ - __ASM volatile ("cpsie i" : : : "memory"); -} - - -/** - \brief Disable IRQ Interrupts - \details Disables IRQ interrupts by setting the I-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void) -{ - __ASM volatile ("cpsid i" : : : "memory"); -} - - -/** - \brief Get Control Register - \details Returns the content of the Control Register. - \return Control Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, control" : "=r" (result) ); - return(result); -} - - -/** - \brief Set Control Register - \details Writes the given value to the Control Register. - \param [in] control Control Register value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control) -{ - __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); -} - - -/** - \brief Get IPSR Register - \details Returns the content of the IPSR Register. - \return IPSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); - return(result); -} - - -/** - \brief Get APSR Register - \details Returns the content of the APSR Register. - \return APSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, apsr" : "=r" (result) ); - return(result); -} - - -/** - \brief Get xPSR Register - \details Returns the content of the xPSR Register. - - \return xPSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); - return(result); -} - - -/** - \brief Get Process Stack Pointer - \details Returns the current value of the Process Stack Pointer (PSP). - \return PSP Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psp\n" : "=r" (result) ); - return(result); -} - - -/** - \brief Set Process Stack Pointer - \details Assigns the given value to the Process Stack Pointer (PSP). - \param [in] topOfProcStack Process Stack Pointer value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) -{ - __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp"); -} - - -/** - \brief Get Main Stack Pointer - \details Returns the current value of the Main Stack Pointer (MSP). - \return MSP Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msp\n" : "=r" (result) ); - return(result); -} - - -/** - \brief Set Main Stack Pointer - \details Assigns the given value to the Main Stack Pointer (MSP). - - \param [in] topOfMainStack Main Stack Pointer value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp"); -} - - -/** - \brief Get Priority Mask - \details Returns the current state of the priority mask bit from the Priority Mask Register. - \return Priority Mask value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, primask" : "=r" (result) ); - return(result); -} - - -/** - \brief Set Priority Mask - \details Assigns the given value to the Priority Mask Register. - \param [in] priMask Priority Mask - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) -{ - __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); -} - - -#if (__CORTEX_M >= 0x03U) - -/** - \brief Enable FIQ - \details Enables FIQ interrupts by clearing the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void) -{ - __ASM volatile ("cpsie f" : : : "memory"); -} - - -/** - \brief Disable FIQ - \details Disables FIQ interrupts by setting the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void) -{ - __ASM volatile ("cpsid f" : : : "memory"); -} - - -/** - \brief Get Base Priority - \details Returns the current value of the Base Priority register. - \return Base Priority register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, basepri" : "=r" (result) ); - return(result); -} - - -/** - \brief Set Base Priority - \details Assigns the given value to the Base Priority register. - \param [in] basePri Base Priority value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value) -{ - __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory"); -} - - -/** - \brief Set Base Priority with condition - \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, - or the new value increases the BASEPRI priority level. - \param [in] basePri Base Priority value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t value) -{ - __ASM volatile ("MSR basepri_max, %0" : : "r" (value) : "memory"); -} - - -/** - \brief Get Fault Mask - \details Returns the current value of the Fault Mask register. - \return Fault Mask register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); - return(result); -} - - -/** - \brief Set Fault Mask - \details Assigns the given value to the Fault Mask register. - \param [in] faultMask Fault Mask value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) -{ - __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); -} - -#endif /* (__CORTEX_M >= 0x03U) */ - - -#if (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) - -/** - \brief Get FPSCR - \details Returns the current value of the Floating Point Status/Control register. - \return Floating Point Status/Control register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - uint32_t result; - - /* Empty asm statement works as a scheduling barrier */ - __ASM volatile (""); - __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); - __ASM volatile (""); - return(result); -#else - return(0); -#endif -} - - -/** - \brief Set FPSCR - \details Assigns the given value to the Floating Point Status/Control register. - \param [in] fpscr Floating Point Status/Control value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - /* Empty asm statement works as a scheduling barrier */ - __ASM volatile (""); - __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); - __ASM volatile (""); -#endif -} - -#endif /* (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) */ - - - -/*@} end of CMSIS_Core_RegAccFunctions */ - - -/* ########################## Core Instruction Access ######################### */ -/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface - Access to dedicated instructions - @{ -*/ - -/* Define macros for porting to both thumb1 and thumb2. - * For thumb1, use low register (r0-r7), specified by constraint "l" - * Otherwise, use general registers, specified by constraint "r" */ -#if defined (__thumb__) && !defined (__thumb2__) -#define __CMSIS_GCC_OUT_REG(r) "=l" (r) -#define __CMSIS_GCC_USE_REG(r) "l" (r) -#else -#define __CMSIS_GCC_OUT_REG(r) "=r" (r) -#define __CMSIS_GCC_USE_REG(r) "r" (r) -#endif - -/** - \brief No Operation - \details No Operation does nothing. This instruction can be used for code alignment purposes. - */ -__attribute__((always_inline)) __STATIC_INLINE void __NOP(void) -{ - __ASM volatile ("nop"); -} - - -/** - \brief Wait For Interrupt - \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. - */ -__attribute__((always_inline)) __STATIC_INLINE void __WFI(void) -{ - __ASM volatile ("wfi"); -} - - -/** - \brief Wait For Event - \details Wait For Event is a hint instruction that permits the processor to enter - a low-power state until one of a number of events occurs. - */ -__attribute__((always_inline)) __STATIC_INLINE void __WFE(void) -{ - __ASM volatile ("wfe"); -} - - -/** - \brief Send Event - \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. - */ -__attribute__((always_inline)) __STATIC_INLINE void __SEV(void) -{ - __ASM volatile ("sev"); -} - - -/** - \brief Instruction Synchronization Barrier - \details Instruction Synchronization Barrier flushes the pipeline in the processor, - so that all instructions following the ISB are fetched from cache or memory, - after the instruction has been completed. - */ -__attribute__((always_inline)) __STATIC_INLINE void __ISB(void) -{ - __ASM volatile ("isb 0xF":::"memory"); -} - - -/** - \brief Data Synchronization Barrier - \details Acts as a special kind of Data Memory Barrier. - It completes when all explicit memory accesses before this instruction complete. - */ -__attribute__((always_inline)) __STATIC_INLINE void __DSB(void) -{ - __ASM volatile ("dsb 0xF":::"memory"); -} - - -/** - \brief Data Memory Barrier - \details Ensures the apparent order of the explicit memory operations before - and after the instruction, without ensuring their completion. - */ -__attribute__((always_inline)) __STATIC_INLINE void __DMB(void) -{ - __ASM volatile ("dmb 0xF":::"memory"); -} - - -/** - \brief Reverse byte order (32 bit) - \details Reverses the byte order in integer value. - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __REV(uint32_t value) -{ -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) - return __builtin_bswap32(value); -#else - uint32_t result; - - __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -#endif -} - - -/** - \brief Reverse byte order (16 bit) - \details Reverses the byte order in two unsigned short values. - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __REV16(uint32_t value) -{ - uint32_t result; - - __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -} - - -/** - \brief Reverse byte order in signed short value - \details Reverses the byte order in a signed short value with sign extension to integer. - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value) -{ -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - return (short)__builtin_bswap16(value); -#else - int32_t result; - - __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -#endif -} - - -/** - \brief Rotate Right in unsigned value (32 bit) - \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. - \param [in] op1 Value to rotate - \param [in] op2 Number of Bits to rotate - \return Rotated value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2) -{ - return (op1 >> op2) | (op1 << (32U - op2)); -} - - -/** - \brief Breakpoint - \details Causes the processor to enter Debug state. - Debug tools can use this to investigate system state when the instruction at a particular address is reached. - \param [in] value is ignored by the processor. - If required, a debugger can use it to store additional information about the breakpoint. - */ -#define __BKPT(value) __ASM volatile ("bkpt "#value) - - -/** - \brief Reverse bit order of value - \details Reverses the bit order of the given value. - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) -{ - uint32_t result; - -#if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) - __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); -#else - int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */ - - result = value; /* r will be reversed bits of v; first get LSB of v */ - for (value >>= 1U; value; value >>= 1U) - { - result <<= 1U; - result |= value & 1U; - s--; - } - result <<= s; /* shift when v's highest bits are zero */ -#endif - return(result); -} - - -/** - \brief Count leading zeros - \details Counts the number of leading zeros of a data value. - \param [in] value Value to count the leading zeros - \return number of leading zeros in value - */ -#define __CLZ __builtin_clz - - -#if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) - -/** - \brief LDR Exclusive (8 bit) - \details Executes a exclusive LDR instruction for 8 bit value. - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr) -{ - uint32_t result; - -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) ); -#else - /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not - accepted by assembler. So has to use following less efficient pattern. - */ - __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); -#endif - return ((uint8_t) result); /* Add explicit type cast here */ -} - - -/** - \brief LDR Exclusive (16 bit) - \details Executes a exclusive LDR instruction for 16 bit values. - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr) -{ - uint32_t result; - -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) ); -#else - /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not - accepted by assembler. So has to use following less efficient pattern. - */ - __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); -#endif - return ((uint16_t) result); /* Add explicit type cast here */ -} - - -/** - \brief LDR Exclusive (32 bit) - \details Executes a exclusive LDR instruction for 32 bit values. - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr) -{ - uint32_t result; - - __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); - return(result); -} - - -/** - \brief STR Exclusive (8 bit) - \details Executes a exclusive STR instruction for 8 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) -{ - uint32_t result; - - __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); - return(result); -} - - -/** - \brief STR Exclusive (16 bit) - \details Executes a exclusive STR instruction for 16 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) -{ - uint32_t result; - - __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); - return(result); -} - - -/** - \brief STR Exclusive (32 bit) - \details Executes a exclusive STR instruction for 32 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) -{ - uint32_t result; - - __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); - return(result); -} - - -/** - \brief Remove the exclusive lock - \details Removes the exclusive lock which is created by LDREX. - */ -__attribute__((always_inline)) __STATIC_INLINE void __CLREX(void) -{ - __ASM volatile ("clrex" ::: "memory"); -} - - -/** - \brief Signed Saturate - \details Saturates a signed value. - \param [in] value Value to be saturated - \param [in] sat Bit position to saturate to (1..32) - \return Saturated value - */ -#define __SSAT(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - - -/** - \brief Unsigned Saturate - \details Saturates an unsigned value. - \param [in] value Value to be saturated - \param [in] sat Bit position to saturate to (0..31) - \return Saturated value - */ -#define __USAT(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - - -/** - \brief Rotate Right with Extend (32 bit) - \details Moves each bit of a bitstring right by one bit. - The carry input is shifted in at the left end of the bitstring. - \param [in] value Value to rotate - \return Rotated value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __RRX(uint32_t value) -{ - uint32_t result; - - __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -} - - -/** - \brief LDRT Unprivileged (8 bit) - \details Executes a Unprivileged LDRT instruction for 8 bit value. - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *addr) -{ - uint32_t result; - -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*addr) ); -#else - /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not - accepted by assembler. So has to use following less efficient pattern. - */ - __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); -#endif - return ((uint8_t) result); /* Add explicit type cast here */ -} - - -/** - \brief LDRT Unprivileged (16 bit) - \details Executes a Unprivileged LDRT instruction for 16 bit values. - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *addr) -{ - uint32_t result; - -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*addr) ); -#else - /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not - accepted by assembler. So has to use following less efficient pattern. - */ - __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); -#endif - return ((uint16_t) result); /* Add explicit type cast here */ -} - - -/** - \brief LDRT Unprivileged (32 bit) - \details Executes a Unprivileged LDRT instruction for 32 bit values. - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *addr) -{ - uint32_t result; - - __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*addr) ); - return(result); -} - - -/** - \brief STRT Unprivileged (8 bit) - \details Executes a Unprivileged STRT instruction for 8 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -__attribute__((always_inline)) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *addr) -{ - __ASM volatile ("strbt %1, %0" : "=Q" (*addr) : "r" ((uint32_t)value) ); -} - - -/** - \brief STRT Unprivileged (16 bit) - \details Executes a Unprivileged STRT instruction for 16 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -__attribute__((always_inline)) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *addr) -{ - __ASM volatile ("strht %1, %0" : "=Q" (*addr) : "r" ((uint32_t)value) ); -} - - -/** - \brief STRT Unprivileged (32 bit) - \details Executes a Unprivileged STRT instruction for 32 bit values. - \param [in] value Value to store - \param [in] ptr Pointer to location - */ -__attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *addr) -{ - __ASM volatile ("strt %1, %0" : "=Q" (*addr) : "r" (value) ); -} - -#endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */ - -/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ - - -/* ################### Compiler specific Intrinsics ########################### */ -/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics - Access to dedicated SIMD instructions - @{ -*/ - -#if (__CORTEX_M >= 0x04U) /* only for Cortex-M4 and above */ - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) -{ - uint32_t result; - - __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -#define __SSAT16(ARG1,ARG2) \ -({ \ - int32_t __RES, __ARG1 = (ARG1); \ - __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - -#define __USAT16(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1) -{ - uint32_t result; - - __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1) -{ - uint32_t result; - - __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) -{ - uint32_t result; - - __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) -{ - uint32_t result; - - __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) -{ - union llreg_u{ - uint32_t w32[2]; - uint64_t w64; - } llr; - llr.w64 = acc; - -#ifndef __ARMEB__ /* Little endian */ - __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); -#else /* Big endian */ - __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); -#endif - - return(llr.w64); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) -{ - union llreg_u{ - uint32_t w32[2]; - uint64_t w64; - } llr; - llr.w64 = acc; - -#ifndef __ARMEB__ /* Little endian */ - __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); -#else /* Big endian */ - __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); -#endif - - return(llr.w64); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) -{ - uint32_t result; - - __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) -{ - uint32_t result; - - __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) -{ - union llreg_u{ - uint32_t w32[2]; - uint64_t w64; - } llr; - llr.w64 = acc; - -#ifndef __ARMEB__ /* Little endian */ - __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); -#else /* Big endian */ - __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); -#endif - - return(llr.w64); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) -{ - union llreg_u{ - uint32_t w32[2]; - uint64_t w64; - } llr; - llr.w64 = acc; - -#ifndef __ARMEB__ /* Little endian */ - __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); -#else /* Big endian */ - __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); -#endif - - return(llr.w64); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SEL (uint32_t op1, uint32_t op2) -{ - uint32_t result; - - __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __QADD( int32_t op1, int32_t op2) -{ - int32_t result; - - __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __QSUB( int32_t op1, int32_t op2) -{ - int32_t result; - - __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); - return(result); -} - -#define __PKHBT(ARG1,ARG2,ARG3) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ - __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ - __RES; \ - }) - -#define __PKHTB(ARG1,ARG2,ARG3) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ - if (ARG3 == 0) \ - __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ - else \ - __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ - __RES; \ - }) - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) -{ - int32_t result; - - __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); - return(result); -} - -#endif /* (__CORTEX_M >= 0x04) */ -/*@} end of group CMSIS_SIMD_intrinsics */ - - -#if defined ( __GNUC__ ) -#pragma GCC diagnostic pop -#endif - -#endif /* __CMSIS_GCC_H */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/core_cm0.h b/arch/cpu/arm/cortex-m/CMSIS/core_cm0.h deleted file mode 100644 index 6d31eec8a..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/core_cm0.h +++ /dev/null @@ -1,811 +0,0 @@ -/**************************************************************************//** - * @file core_cm0.h - * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CM0_H_GENERIC -#define __CORE_CM0_H_GENERIC - -#include - -#ifdef __cplusplus - extern "C" { -#endif - -/** - CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions - CMSIS violates the following MISRA-C:2004 rules: - - \li Required Rule 8.5, object/function definition in header file.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup Cortex_M0 - @{ - */ - -/* CMSIS CM0 definitions */ -#define __CM0_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __CM0_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \ - __CM0_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_M (0x00U) /*!< Cortex-M Core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __FPU_USED indicates whether an FPU is used or not. - This core does not support an FPU at all -*/ -#define __FPU_USED 0U - -#if defined ( __CC_ARM ) - #if defined __TARGET_FPU_VFP - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #if defined __ARM_PCS_VFP - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __GNUC__ ) - #if defined (__VFP_FP__) && !defined(__SOFTFP__) - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __ICCARM__ ) - #if defined __ARMVFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TMS470__ ) - #if defined __TI_VFP_SUPPORT__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TASKING__ ) - #if defined __FPU_VFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __CSMC__ ) - #if ( __CSMC__ & 0x400U) - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#endif - -#include "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CM0_H_GENERIC */ - -#ifndef __CMSIS_GENERIC - -#ifndef __CORE_CM0_H_DEPENDANT -#define __CORE_CM0_H_DEPENDANT - -#ifdef __cplusplus - extern "C" { -#endif - -/* check device defines and use defaults */ -#if defined __CHECK_DEVICE_DEFINES - #ifndef __CM0_REV - #define __CM0_REV 0x0000U - #warning "__CM0_REV not defined in device header file; using default!" - #endif - - #ifndef __NVIC_PRIO_BITS - #define __NVIC_PRIO_BITS 2U - #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" - #endif - - #ifndef __Vendor_SysTickConfig - #define __Vendor_SysTickConfig 0U - #warning "__Vendor_SysTickConfig not defined in device header file; using default!" - #endif -#endif - -/* IO definitions (access restrictions to peripheral registers) */ -/** - \defgroup CMSIS_glob_defs CMSIS Global Defines - - IO Type Qualifiers are used - \li to specify the access to peripheral variables. - \li for automatic generation of peripheral register debug information. -*/ -#ifdef __cplusplus - #define __I volatile /*!< Defines 'read only' permissions */ -#else - #define __I volatile const /*!< Defines 'read only' permissions */ -#endif -#define __O volatile /*!< Defines 'write only' permissions */ -#define __IO volatile /*!< Defines 'read / write' permissions */ - -/* following defines should be used for structure members */ -#define __IM volatile const /*! Defines 'read only' structure member permissions */ -#define __OM volatile /*! Defines 'write only' structure member permissions */ -#define __IOM volatile /*! Defines 'read / write' structure member permissions */ - -/*@} end of group Cortex_M0 */ - - - -/******************************************************************************* - * Register Abstraction - Core Register contain: - - Core Register - - Core NVIC Register - - Core SCB Register - - Core SysTick Register - ******************************************************************************/ -/** - \defgroup CMSIS_core_register Defines and Type Definitions - \brief Type definitions and defines for Cortex-M processor based devices. -*/ - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CORE Status and Control Registers - \brief Core Register type definitions. - @{ - */ - -/** - \brief Union type to access the Application Program Status Register (APSR). - */ -typedef union -{ - struct - { - uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} APSR_Type; - -/* APSR Register Definitions */ -#define APSR_N_Pos 31U /*!< APSR: N Position */ -#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ - -#define APSR_Z_Pos 30U /*!< APSR: Z Position */ -#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ - -#define APSR_C_Pos 29U /*!< APSR: C Position */ -#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ - -#define APSR_V_Pos 28U /*!< APSR: V Position */ -#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ - - -/** - \brief Union type to access the Interrupt Program Status Register (IPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} IPSR_Type; - -/* IPSR Register Definitions */ -#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ -#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ - - -/** - \brief Union type to access the Special-Purpose Program Status Registers (xPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ - uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ - uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} xPSR_Type; - -/* xPSR Register Definitions */ -#define xPSR_N_Pos 31U /*!< xPSR: N Position */ -#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ - -#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ -#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ - -#define xPSR_C_Pos 29U /*!< xPSR: C Position */ -#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ - -#define xPSR_V_Pos 28U /*!< xPSR: V Position */ -#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ - -#define xPSR_T_Pos 24U /*!< xPSR: T Position */ -#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ - -#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ -#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ - - -/** - \brief Union type to access the Control Registers (CONTROL). - */ -typedef union -{ - struct - { - uint32_t _reserved0:1; /*!< bit: 0 Reserved */ - uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ - uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} CONTROL_Type; - -/* CONTROL Register Definitions */ -#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ -#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ - -/*@} end of group CMSIS_CORE */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) - \brief Type definitions for the NVIC Registers - @{ - */ - -/** - \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). - */ -typedef struct -{ - __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ - uint32_t RESERVED0[31U]; - __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ - uint32_t RSERVED1[31U]; - __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ - uint32_t RESERVED2[31U]; - __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ - uint32_t RESERVED3[31U]; - uint32_t RESERVED4[64U]; - __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ -} NVIC_Type; - -/*@} end of group CMSIS_NVIC */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCB System Control Block (SCB) - \brief Type definitions for the System Control Block Registers - @{ - */ - -/** - \brief Structure type to access the System Control Block (SCB). - */ -typedef struct -{ - __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ - __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ - uint32_t RESERVED0; - __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ - __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ - __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ - uint32_t RESERVED1; - __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ - __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ -} SCB_Type; - -/* SCB CPUID Register Definitions */ -#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ -#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ - -#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ -#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ - -#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ -#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ - -#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ -#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ - -#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ -#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ - -/* SCB Interrupt Control State Register Definitions */ -#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ -#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ - -#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ -#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ - -#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ -#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ - -#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ -#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ - -#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ -#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ - -#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ -#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ - -#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ -#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ - -#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ -#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ - -#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ -#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ - -/* SCB Application Interrupt and Reset Control Register Definitions */ -#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ -#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ - -#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ -#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ - -#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ -#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ - -#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ -#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ - -#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ -#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ - -/* SCB System Control Register Definitions */ -#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ -#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ - -#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ -#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ - -#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ -#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ - -/* SCB Configuration Control Register Definitions */ -#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ -#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ - -#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ -#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ - -/* SCB System Handler Control and State Register Definitions */ -#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ -#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ - -/*@} end of group CMSIS_SCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SysTick System Tick Timer (SysTick) - \brief Type definitions for the System Timer Registers. - @{ - */ - -/** - \brief Structure type to access the System Timer (SysTick). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ - __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ - __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ - __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ -} SysTick_Type; - -/* SysTick Control / Status Register Definitions */ -#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ -#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ - -#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ -#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ - -#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ -#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ - -#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ -#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ - -/* SysTick Reload Register Definitions */ -#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ -#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ - -/* SysTick Current Register Definitions */ -#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ -#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ - -/* SysTick Calibration Register Definitions */ -#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ -#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ - -#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ -#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ - -#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ -#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ - -/*@} end of group CMSIS_SysTick */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) - \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. - Therefore they are not covered by the Cortex-M0 header file. - @{ - */ -/*@} end of group CMSIS_CoreDebug */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_bitfield Core register bit field macros - \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). - @{ - */ - -/** - \brief Mask and shift a bit field value for use in a register bit range. - \param[in] field Name of the register bit field. - \param[in] value Value of the bit field. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk) - -/** - \brief Mask and shift a register value to extract a bit filed value. - \param[in] field Name of the register bit field. - \param[in] value Value of register. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos) - -/*@} end of group CMSIS_core_bitfield */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_base Core Definitions - \brief Definitions for base addresses, unions, and structures. - @{ - */ - -/* Memory mapping of Cortex-M0 Hardware */ -#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ -#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ -#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ -#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ - -#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ -#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ -#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ - - -/*@} */ - - - -/******************************************************************************* - * Hardware Abstraction Layer - Core Function Interface contains: - - Core NVIC Functions - - Core SysTick Functions - - Core Register Access Functions - ******************************************************************************/ -/** - \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference -*/ - - - -/* ########################## NVIC functions #################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_NVICFunctions NVIC Functions - \brief Functions that manage interrupts and exceptions via the NVIC. - @{ - */ - -/* Interrupt Priorities are WORD accessible only under ARMv6M */ -/* The following MACROS handle generation of the register offset and byte masks */ -#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) -#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) -#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) - - -/** - \brief Get External Interrupt Enable State - \details Returns whether a device-specific interrupt is enabled in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - \return 0 Interrupt is disabled. - \return 1 Interrupt is enabled. - */ -__STATIC_INLINE uint32_t NVIC_IsIRQEnabled(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Enable External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | - (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); - } - else - { - NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | - (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \param [in] IRQn Interrupt number. - \return Interrupt Priority. - Value is aligned automatically to the implemented priority bits of the microcontroller. - */ -__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) -{ - - if ((int32_t)(IRQn) < 0) - { - return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } -} - - -/** - \brief System Reset - \details Initiates a system reset request to reset the MCU. - */ -__STATIC_INLINE void NVIC_SystemReset(void) -{ - __DSB(); /* Ensure all outstanding memory accesses included - buffered write are completed before reset */ - SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - SCB_AIRCR_SYSRESETREQ_Msk); - __DSB(); /* Ensure completion of memory access */ - - for(;;) /* wait until reset */ - { - __NOP(); - } -} - -/*@} end of CMSIS_Core_NVICFunctions */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__Vendor_SysTickConfig == 0U) - -/** - \brief System Tick Configuration - \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. - Counter is in free running mode to generate periodic interrupts. - \param [in] ticks Number of ticks between two interrupts. - \return 0 Function succeeded. - \return 1 Function failed. - \note When the variable __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - must contain a vendor-specific implementation of this function. - */ -__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) -{ - if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) - { - return (1UL); /* Reload value impossible */ - } - - SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ - NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ - SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ - SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | - SysTick_CTRL_TICKINT_Msk | - SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ - return (0UL); /* Function successful */ -} - -#endif - -/*@} end of CMSIS_Core_SysTickFunctions */ - - - - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CM0_H_DEPENDANT */ - -#endif /* __CMSIS_GENERIC */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/core_cm0plus.h b/arch/cpu/arm/cortex-m/CMSIS/core_cm0plus.h deleted file mode 100644 index 773eec6ee..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/core_cm0plus.h +++ /dev/null @@ -1,927 +0,0 @@ -/**************************************************************************//** - * @file core_cm0plus.h - * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CM0PLUS_H_GENERIC -#define __CORE_CM0PLUS_H_GENERIC - -#include - -#ifdef __cplusplus - extern "C" { -#endif - -/** - CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions - CMSIS violates the following MISRA-C:2004 rules: - - \li Required Rule 8.5, object/function definition in header file.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup Cortex_M0_plus - @{ - */ - -/* CMSIS CM0+ definitions */ -#define __CM0PLUS_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __CM0PLUS_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16U) | \ - __CM0PLUS_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_M (0x00U) /*!< Cortex-M Core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __FPU_USED indicates whether an FPU is used or not. - This core does not support an FPU at all -*/ -#define __FPU_USED 0U - -#if defined ( __CC_ARM ) - #if defined __TARGET_FPU_VFP - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #if defined __ARM_PCS_VFP - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __GNUC__ ) - #if defined (__VFP_FP__) && !defined(__SOFTFP__) - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __ICCARM__ ) - #if defined __ARMVFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TMS470__ ) - #if defined __TI_VFP_SUPPORT__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TASKING__ ) - #if defined __FPU_VFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __CSMC__ ) - #if ( __CSMC__ & 0x400U) - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#endif - -#include "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CM0PLUS_H_GENERIC */ - -#ifndef __CMSIS_GENERIC - -#ifndef __CORE_CM0PLUS_H_DEPENDANT -#define __CORE_CM0PLUS_H_DEPENDANT - -#ifdef __cplusplus - extern "C" { -#endif - -/* check device defines and use defaults */ -#if defined __CHECK_DEVICE_DEFINES - #ifndef __CM0PLUS_REV - #define __CM0PLUS_REV 0x0000U - #warning "__CM0PLUS_REV not defined in device header file; using default!" - #endif - - #ifndef __MPU_PRESENT - #define __MPU_PRESENT 0U - #warning "__MPU_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __VTOR_PRESENT - #define __VTOR_PRESENT 0U - #warning "__VTOR_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __NVIC_PRIO_BITS - #define __NVIC_PRIO_BITS 2U - #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" - #endif - - #ifndef __Vendor_SysTickConfig - #define __Vendor_SysTickConfig 0U - #warning "__Vendor_SysTickConfig not defined in device header file; using default!" - #endif -#endif - -/* IO definitions (access restrictions to peripheral registers) */ -/** - \defgroup CMSIS_glob_defs CMSIS Global Defines - - IO Type Qualifiers are used - \li to specify the access to peripheral variables. - \li for automatic generation of peripheral register debug information. -*/ -#ifdef __cplusplus - #define __I volatile /*!< Defines 'read only' permissions */ -#else - #define __I volatile const /*!< Defines 'read only' permissions */ -#endif -#define __O volatile /*!< Defines 'write only' permissions */ -#define __IO volatile /*!< Defines 'read / write' permissions */ - -/* following defines should be used for structure members */ -#define __IM volatile const /*! Defines 'read only' structure member permissions */ -#define __OM volatile /*! Defines 'write only' structure member permissions */ -#define __IOM volatile /*! Defines 'read / write' structure member permissions */ - -/*@} end of group Cortex-M0+ */ - - - -/******************************************************************************* - * Register Abstraction - Core Register contain: - - Core Register - - Core NVIC Register - - Core SCB Register - - Core SysTick Register - - Core MPU Register - ******************************************************************************/ -/** - \defgroup CMSIS_core_register Defines and Type Definitions - \brief Type definitions and defines for Cortex-M processor based devices. -*/ - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CORE Status and Control Registers - \brief Core Register type definitions. - @{ - */ - -/** - \brief Union type to access the Application Program Status Register (APSR). - */ -typedef union -{ - struct - { - uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} APSR_Type; - -/* APSR Register Definitions */ -#define APSR_N_Pos 31U /*!< APSR: N Position */ -#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ - -#define APSR_Z_Pos 30U /*!< APSR: Z Position */ -#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ - -#define APSR_C_Pos 29U /*!< APSR: C Position */ -#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ - -#define APSR_V_Pos 28U /*!< APSR: V Position */ -#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ - - -/** - \brief Union type to access the Interrupt Program Status Register (IPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} IPSR_Type; - -/* IPSR Register Definitions */ -#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ -#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ - - -/** - \brief Union type to access the Special-Purpose Program Status Registers (xPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ - uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ - uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} xPSR_Type; - -/* xPSR Register Definitions */ -#define xPSR_N_Pos 31U /*!< xPSR: N Position */ -#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ - -#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ -#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ - -#define xPSR_C_Pos 29U /*!< xPSR: C Position */ -#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ - -#define xPSR_V_Pos 28U /*!< xPSR: V Position */ -#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ - -#define xPSR_T_Pos 24U /*!< xPSR: T Position */ -#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ - -#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ -#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ - - -/** - \brief Union type to access the Control Registers (CONTROL). - */ -typedef union -{ - struct - { - uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ - uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ - uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} CONTROL_Type; - -/* CONTROL Register Definitions */ -#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ -#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ - -#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ -#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ - -/*@} end of group CMSIS_CORE */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) - \brief Type definitions for the NVIC Registers - @{ - */ - -/** - \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). - */ -typedef struct -{ - __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ - uint32_t RESERVED0[31U]; - __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ - uint32_t RSERVED1[31U]; - __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ - uint32_t RESERVED2[31U]; - __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ - uint32_t RESERVED3[31U]; - uint32_t RESERVED4[64U]; - __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ -} NVIC_Type; - -/*@} end of group CMSIS_NVIC */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCB System Control Block (SCB) - \brief Type definitions for the System Control Block Registers - @{ - */ - -/** - \brief Structure type to access the System Control Block (SCB). - */ -typedef struct -{ - __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ - __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ -#if (__VTOR_PRESENT == 1U) - __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ -#else - uint32_t RESERVED0; -#endif - __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ - __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ - __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ - uint32_t RESERVED1; - __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ - __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ -} SCB_Type; - -/* SCB CPUID Register Definitions */ -#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ -#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ - -#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ -#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ - -#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ -#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ - -#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ -#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ - -#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ -#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ - -/* SCB Interrupt Control State Register Definitions */ -#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ -#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ - -#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ -#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ - -#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ -#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ - -#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ -#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ - -#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ -#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ - -#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ -#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ - -#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ -#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ - -#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ -#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ - -#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ -#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ - -#if (__VTOR_PRESENT == 1U) -/* SCB Interrupt Control State Register Definitions */ -#define SCB_VTOR_TBLOFF_Pos 8U /*!< SCB VTOR: TBLOFF Position */ -#define SCB_VTOR_TBLOFF_Msk (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ -#endif - -/* SCB Application Interrupt and Reset Control Register Definitions */ -#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ -#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ - -#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ -#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ - -#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ -#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ - -#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ -#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ - -#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ -#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ - -/* SCB System Control Register Definitions */ -#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ -#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ - -#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ -#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ - -#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ -#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ - -/* SCB Configuration Control Register Definitions */ -#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ -#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ - -#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ -#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ - -/* SCB System Handler Control and State Register Definitions */ -#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ -#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ - -/*@} end of group CMSIS_SCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SysTick System Tick Timer (SysTick) - \brief Type definitions for the System Timer Registers. - @{ - */ - -/** - \brief Structure type to access the System Timer (SysTick). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ - __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ - __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ - __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ -} SysTick_Type; - -/* SysTick Control / Status Register Definitions */ -#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ -#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ - -#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ -#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ - -#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ -#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ - -#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ -#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ - -/* SysTick Reload Register Definitions */ -#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ -#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ - -/* SysTick Current Register Definitions */ -#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ -#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ - -/* SysTick Calibration Register Definitions */ -#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ -#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ - -#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ -#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ - -#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ -#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ - -/*@} end of group CMSIS_SysTick */ - -#if (__MPU_PRESENT == 1U) -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_MPU Memory Protection Unit (MPU) - \brief Type definitions for the Memory Protection Unit (MPU) - @{ - */ - -/** - \brief Structure type to access the Memory Protection Unit (MPU). - */ -typedef struct -{ - __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ - __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ - __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ - __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ - __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ -} MPU_Type; - -/* MPU Type Register Definitions */ -#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ -#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ - -#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ -#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ - -#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ -#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ - -/* MPU Control Register Definitions */ -#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ -#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ - -#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ -#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ - -#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ -#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ - -/* MPU Region Number Register Definitions */ -#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ -#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ - -/* MPU Region Base Address Register Definitions */ -#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */ -#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ - -#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ -#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ - -#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ -#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ - -/* MPU Region Attribute and Size Register Definitions */ -#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ -#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ - -#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ -#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ - -#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ -#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ - -#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ -#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ - -#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ -#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ - -#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ -#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ - -#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ -#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ - -#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ -#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ - -#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ -#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ - -#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ -#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ - -/*@} end of group CMSIS_MPU */ -#endif - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) - \brief Cortex-M0+ Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. - Therefore they are not covered by the Cortex-M0+ header file. - @{ - */ -/*@} end of group CMSIS_CoreDebug */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_bitfield Core register bit field macros - \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). - @{ - */ - -/** - \brief Mask and shift a bit field value for use in a register bit range. - \param[in] field Name of the register bit field. - \param[in] value Value of the bit field. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk) - -/** - \brief Mask and shift a register value to extract a bit filed value. - \param[in] field Name of the register bit field. - \param[in] value Value of register. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos) - -/*@} end of group CMSIS_core_bitfield */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_base Core Definitions - \brief Definitions for base addresses, unions, and structures. - @{ - */ - -/* Memory mapping of Cortex-M0+ Hardware */ -#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ -#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ -#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ -#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ - -#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ -#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ -#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ - -#if (__MPU_PRESENT == 1U) - #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ - #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ -#endif - -/*@} */ - - - -/******************************************************************************* - * Hardware Abstraction Layer - Core Function Interface contains: - - Core NVIC Functions - - Core SysTick Functions - - Core Register Access Functions - ******************************************************************************/ -/** - \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference -*/ - - - -/* ########################## NVIC functions #################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_NVICFunctions NVIC Functions - \brief Functions that manage interrupts and exceptions via the NVIC. - @{ - */ - -/* Interrupt Priorities are WORD accessible only under ARMv6M */ -/* The following MACROS handle generation of the register offset and byte masks */ -#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) -#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) -#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) - - -/** - \brief Get External Interrupt Enable State - \details Returns whether a device-specific interrupt is enabled in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - \return 0 Interrupt is disabled. - \return 1 Interrupt is enabled. - */ -__STATIC_INLINE uint32_t NVIC_IsIRQEnabled(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Enable External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | - (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); - } - else - { - NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | - (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \param [in] IRQn Interrupt number. - \return Interrupt Priority. - Value is aligned automatically to the implemented priority bits of the microcontroller. - */ -__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) -{ - - if ((int32_t)(IRQn) < 0) - { - return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } -} - - -/** - \brief System Reset - \details Initiates a system reset request to reset the MCU. - */ -__STATIC_INLINE void NVIC_SystemReset(void) -{ - __DSB(); /* Ensure all outstanding memory accesses included - buffered write are completed before reset */ - SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - SCB_AIRCR_SYSRESETREQ_Msk); - __DSB(); /* Ensure completion of memory access */ - - for(;;) /* wait until reset */ - { - __NOP(); - } -} - -/*@} end of CMSIS_Core_NVICFunctions */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__Vendor_SysTickConfig == 0U) - -/** - \brief System Tick Configuration - \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. - Counter is in free running mode to generate periodic interrupts. - \param [in] ticks Number of ticks between two interrupts. - \return 0 Function succeeded. - \return 1 Function failed. - \note When the variable __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - must contain a vendor-specific implementation of this function. - */ -__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) -{ - if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) - { - return (1UL); /* Reload value impossible */ - } - - SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ - NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ - SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ - SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | - SysTick_CTRL_TICKINT_Msk | - SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ - return (0UL); /* Function successful */ -} - -#endif - -/*@} end of CMSIS_Core_SysTickFunctions */ - - - - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CM0PLUS_H_DEPENDANT */ - -#endif /* __CMSIS_GENERIC */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/core_cm3.h b/arch/cpu/arm/cortex-m/CMSIS/core_cm3.h deleted file mode 100644 index 9e66eca9e..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/core_cm3.h +++ /dev/null @@ -1,1776 +0,0 @@ -/**************************************************************************//** - * @file core_cm3.h - * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CM3_H_GENERIC -#define __CORE_CM3_H_GENERIC - -#include - -#ifdef __cplusplus - extern "C" { -#endif - -/** - CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions - CMSIS violates the following MISRA-C:2004 rules: - - \li Required Rule 8.5, object/function definition in header file.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup Cortex_M3 - @{ - */ - -/* CMSIS CM3 definitions */ -#define __CM3_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __CM3_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16U) | \ - __CM3_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_M (0x03U) /*!< Cortex-M Core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __FPU_USED indicates whether an FPU is used or not. - This core does not support an FPU at all -*/ -#define __FPU_USED 0U - -#if defined ( __CC_ARM ) - #if defined __TARGET_FPU_VFP - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #if defined __ARM_PCS_VFP - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __GNUC__ ) - #if defined (__VFP_FP__) && !defined(__SOFTFP__) - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __ICCARM__ ) - #if defined __ARMVFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TMS470__ ) - #if defined __TI_VFP_SUPPORT__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TASKING__ ) - #if defined __FPU_VFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __CSMC__ ) - #if ( __CSMC__ & 0x400U) - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#endif - -#include "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CM3_H_GENERIC */ - -#ifndef __CMSIS_GENERIC - -#ifndef __CORE_CM3_H_DEPENDANT -#define __CORE_CM3_H_DEPENDANT - -#ifdef __cplusplus - extern "C" { -#endif - -/* check device defines and use defaults */ -#if defined __CHECK_DEVICE_DEFINES - #ifndef __CM3_REV - #define __CM3_REV 0x0200U - #warning "__CM3_REV not defined in device header file; using default!" - #endif - - #ifndef __MPU_PRESENT - #define __MPU_PRESENT 0U - #warning "__MPU_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __NVIC_PRIO_BITS - #define __NVIC_PRIO_BITS 4U - #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" - #endif - - #ifndef __Vendor_SysTickConfig - #define __Vendor_SysTickConfig 0U - #warning "__Vendor_SysTickConfig not defined in device header file; using default!" - #endif -#endif - -/* IO definitions (access restrictions to peripheral registers) */ -/** - \defgroup CMSIS_glob_defs CMSIS Global Defines - - IO Type Qualifiers are used - \li to specify the access to peripheral variables. - \li for automatic generation of peripheral register debug information. -*/ -#ifdef __cplusplus - #define __I volatile /*!< Defines 'read only' permissions */ -#else - #define __I volatile const /*!< Defines 'read only' permissions */ -#endif -#define __O volatile /*!< Defines 'write only' permissions */ -#define __IO volatile /*!< Defines 'read / write' permissions */ - -/* following defines should be used for structure members */ -#define __IM volatile const /*! Defines 'read only' structure member permissions */ -#define __OM volatile /*! Defines 'write only' structure member permissions */ -#define __IOM volatile /*! Defines 'read / write' structure member permissions */ - -/*@} end of group Cortex_M3 */ - - - -/******************************************************************************* - * Register Abstraction - Core Register contain: - - Core Register - - Core NVIC Register - - Core SCB Register - - Core SysTick Register - - Core Debug Register - - Core MPU Register - ******************************************************************************/ -/** - \defgroup CMSIS_core_register Defines and Type Definitions - \brief Type definitions and defines for Cortex-M processor based devices. -*/ - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CORE Status and Control Registers - \brief Core Register type definitions. - @{ - */ - -/** - \brief Union type to access the Application Program Status Register (APSR). - */ -typedef union -{ - struct - { - uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ - uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} APSR_Type; - -/* APSR Register Definitions */ -#define APSR_N_Pos 31U /*!< APSR: N Position */ -#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ - -#define APSR_Z_Pos 30U /*!< APSR: Z Position */ -#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ - -#define APSR_C_Pos 29U /*!< APSR: C Position */ -#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ - -#define APSR_V_Pos 28U /*!< APSR: V Position */ -#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ - -#define APSR_Q_Pos 27U /*!< APSR: Q Position */ -#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ - - -/** - \brief Union type to access the Interrupt Program Status Register (IPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} IPSR_Type; - -/* IPSR Register Definitions */ -#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ -#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ - - -/** - \brief Union type to access the Special-Purpose Program Status Registers (xPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ - uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ - uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ - uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} xPSR_Type; - -/* xPSR Register Definitions */ -#define xPSR_N_Pos 31U /*!< xPSR: N Position */ -#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ - -#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ -#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ - -#define xPSR_C_Pos 29U /*!< xPSR: C Position */ -#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ - -#define xPSR_V_Pos 28U /*!< xPSR: V Position */ -#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ - -#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ -#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ - -#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */ -#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */ - -#define xPSR_T_Pos 24U /*!< xPSR: T Position */ -#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ - -#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ -#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ - - -/** - \brief Union type to access the Control Registers (CONTROL). - */ -typedef union -{ - struct - { - uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ - uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ - uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} CONTROL_Type; - -/* CONTROL Register Definitions */ -#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ -#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ - -#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ -#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ - -/*@} end of group CMSIS_CORE */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) - \brief Type definitions for the NVIC Registers - @{ - */ - -/** - \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). - */ -typedef struct -{ - __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ - uint32_t RESERVED0[24U]; - __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ - uint32_t RSERVED1[24U]; - __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ - uint32_t RESERVED2[24U]; - __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ - uint32_t RESERVED3[24U]; - __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ - uint32_t RESERVED4[56U]; - __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ - uint32_t RESERVED5[644U]; - __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ -} NVIC_Type; - -/* Software Triggered Interrupt Register Definitions */ -#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ -#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ - -/*@} end of group CMSIS_NVIC */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCB System Control Block (SCB) - \brief Type definitions for the System Control Block Registers - @{ - */ - -/** - \brief Structure type to access the System Control Block (SCB). - */ -typedef struct -{ - __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ - __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ - __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ - __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ - __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ - __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ - __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ - __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ - __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ - __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ - __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ - __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ - __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ - __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ - __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ - __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ - __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ - __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ - __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ - uint32_t RESERVED0[5U]; - __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ -} SCB_Type; - -/* SCB CPUID Register Definitions */ -#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ -#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ - -#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ -#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ - -#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ -#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ - -#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ -#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ - -#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ -#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ - -/* SCB Interrupt Control State Register Definitions */ -#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ -#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ - -#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ -#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ - -#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ -#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ - -#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ -#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ - -#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ -#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ - -#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ -#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ - -#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ -#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ - -#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ -#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ - -#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ -#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ - -#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ -#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ - -/* SCB Vector Table Offset Register Definitions */ -#if (__CM3_REV < 0x0201U) /* core r2p1 */ -#define SCB_VTOR_TBLBASE_Pos 29U /*!< SCB VTOR: TBLBASE Position */ -#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */ - -#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ -#define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ -#else -#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ -#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ -#endif - -/* SCB Application Interrupt and Reset Control Register Definitions */ -#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ -#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ - -#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ -#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ - -#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ -#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ - -#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ -#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ - -#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ -#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ - -#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ -#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ - -#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ -#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ - -/* SCB System Control Register Definitions */ -#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ -#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ - -#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ -#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ - -#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ -#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ - -/* SCB Configuration Control Register Definitions */ -#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ -#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ - -#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ -#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ - -#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ -#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ - -#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ -#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ - -#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ -#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ - -#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ -#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ - -/* SCB System Handler Control and State Register Definitions */ -#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ -#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ - -#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ -#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ - -#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ -#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ - -#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ -#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ - -#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ -#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ - -#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ -#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ - -#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ -#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ - -#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ -#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ - -#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ -#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ - -#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ -#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ - -#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ -#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ - -#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ -#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ - -#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ -#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ - -#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ -#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ - -/* SCB Configurable Fault Status Register Definitions */ -#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ -#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ - -#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ -#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ - -#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ -#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ - -/* SCB Hard Fault Status Register Definitions */ -#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ -#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ - -#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ -#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ - -#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ -#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ - -/* SCB Debug Fault Status Register Definitions */ -#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ -#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ - -#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ -#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ - -#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ -#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ - -#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ -#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ - -#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ -#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ - -/*@} end of group CMSIS_SCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) - \brief Type definitions for the System Control and ID Register not in the SCB - @{ - */ - -/** - \brief Structure type to access the System Control and ID Register not in the SCB. - */ -typedef struct -{ - uint32_t RESERVED0[1U]; - __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ -#if ((defined __CM3_REV) && (__CM3_REV >= 0x200U)) - __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ -#else - uint32_t RESERVED1[1U]; -#endif -} SCnSCB_Type; - -/* Interrupt Controller Type Register Definitions */ -#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ -#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ - -/* Auxiliary Control Register Definitions */ - -#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */ -#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ - -#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */ -#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */ - -#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ -#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ - -/*@} end of group CMSIS_SCnotSCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SysTick System Tick Timer (SysTick) - \brief Type definitions for the System Timer Registers. - @{ - */ - -/** - \brief Structure type to access the System Timer (SysTick). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ - __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ - __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ - __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ -} SysTick_Type; - -/* SysTick Control / Status Register Definitions */ -#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ -#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ - -#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ -#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ - -#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ -#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ - -#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ -#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ - -/* SysTick Reload Register Definitions */ -#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ -#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ - -/* SysTick Current Register Definitions */ -#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ -#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ - -/* SysTick Calibration Register Definitions */ -#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ -#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ - -#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ -#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ - -#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ -#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ - -/*@} end of group CMSIS_SysTick */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) - \brief Type definitions for the Instrumentation Trace Macrocell (ITM) - @{ - */ - -/** - \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). - */ -typedef struct -{ - __OM union - { - __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ - __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ - __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ - } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ - uint32_t RESERVED0[864U]; - __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ - uint32_t RESERVED1[15U]; - __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ - uint32_t RESERVED2[15U]; - __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ - uint32_t RESERVED3[29U]; - __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ - __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ - __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ - uint32_t RESERVED4[43U]; - __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ - __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ - uint32_t RESERVED5[6U]; - __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ - __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ - __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ - __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ - __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ - __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ - __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ - __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ - __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ - __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ - __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ - __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ -} ITM_Type; - -/* ITM Trace Privilege Register Definitions */ -#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ -#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ - -/* ITM Trace Control Register Definitions */ -#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ -#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ - -#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ -#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ - -#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ -#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ - -#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ -#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ - -#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ -#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ - -#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ -#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ - -#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ -#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ - -#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ -#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ - -#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ -#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ - -/* ITM Integration Write Register Definitions */ -#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ -#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ - -/* ITM Integration Read Register Definitions */ -#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ -#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ - -/* ITM Integration Mode Control Register Definitions */ -#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ -#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ - -/* ITM Lock Status Register Definitions */ -#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ -#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ - -#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ -#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ - -#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ -#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ - -/*@}*/ /* end of group CMSIS_ITM */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) - \brief Type definitions for the Data Watchpoint and Trace (DWT) - @{ - */ - -/** - \brief Structure type to access the Data Watchpoint and Trace Register (DWT). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ - __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ - __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ - __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ - __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ - __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ - __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ - __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ - __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ - __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ - __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ - uint32_t RESERVED0[1U]; - __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ - __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ - __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ - uint32_t RESERVED1[1U]; - __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ - __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ - __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ - uint32_t RESERVED2[1U]; - __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ - __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ - __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ -} DWT_Type; - -/* DWT Control Register Definitions */ -#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ -#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ - -#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ -#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ - -#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ -#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ - -#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ -#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ - -#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ -#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ - -#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ -#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ - -#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ -#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ - -#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ -#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ - -#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ -#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ - -#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ -#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ - -#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ -#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ - -#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ -#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ - -#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ -#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ - -#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ -#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ - -#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ -#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ - -#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ -#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ - -#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ -#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ - -#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ -#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ - -/* DWT CPI Count Register Definitions */ -#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ -#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ - -/* DWT Exception Overhead Count Register Definitions */ -#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ -#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ - -/* DWT Sleep Count Register Definitions */ -#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ -#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ - -/* DWT LSU Count Register Definitions */ -#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ -#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ - -/* DWT Folded-instruction Count Register Definitions */ -#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ -#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ - -/* DWT Comparator Mask Register Definitions */ -#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ -#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ - -/* DWT Comparator Function Register Definitions */ -#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ -#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ - -#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ -#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ - -#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ -#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ - -#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ -#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ - -#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ -#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ - -#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ -#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ - -#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ -#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ - -#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ -#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ - -#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ -#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ - -/*@}*/ /* end of group CMSIS_DWT */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_TPI Trace Port Interface (TPI) - \brief Type definitions for the Trace Port Interface (TPI) - @{ - */ - -/** - \brief Structure type to access the Trace Port Interface Register (TPI). - */ -typedef struct -{ - __IOM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ - __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ - uint32_t RESERVED0[2U]; - __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ - uint32_t RESERVED1[55U]; - __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ - uint32_t RESERVED2[131U]; - __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ - __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ - __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ - uint32_t RESERVED3[759U]; - __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */ - __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ - __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ - uint32_t RESERVED4[1U]; - __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ - __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ - __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ - uint32_t RESERVED5[39U]; - __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ - __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ - uint32_t RESERVED7[8U]; - __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ - __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ -} TPI_Type; - -/* TPI Asynchronous Clock Prescaler Register Definitions */ -#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ -#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ - -/* TPI Selected Pin Protocol Register Definitions */ -#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ -#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ - -/* TPI Formatter and Flush Status Register Definitions */ -#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ -#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ - -#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ -#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ - -#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ -#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ - -#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ -#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ - -/* TPI Formatter and Flush Control Register Definitions */ -#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ -#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ - -#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ -#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ - -/* TPI TRIGGER Register Definitions */ -#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ -#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ - -/* TPI Integration ETM Data Register Definitions (FIFO0) */ -#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ -#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ - -#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ -#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ - -#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ -#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ - -#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ -#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ - -#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ -#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ - -#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ -#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ - -#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ -#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ - -/* TPI ITATBCTR2 Register Definitions */ -#define TPI_ITATBCTR2_ATREADY_Pos 0U /*!< TPI ITATBCTR2: ATREADY Position */ -#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */ - -/* TPI Integration ITM Data Register Definitions (FIFO1) */ -#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ -#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ - -#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ -#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ - -#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ -#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ - -#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ -#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ - -#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ -#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ - -#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ -#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ - -#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ -#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ - -/* TPI ITATBCTR0 Register Definitions */ -#define TPI_ITATBCTR0_ATREADY_Pos 0U /*!< TPI ITATBCTR0: ATREADY Position */ -#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */ - -/* TPI Integration Mode Control Register Definitions */ -#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ -#define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ - -/* TPI DEVID Register Definitions */ -#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ -#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ - -#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ -#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ - -#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ -#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ - -#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ -#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ - -#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ -#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ - -#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ -#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ - -/* TPI DEVTYPE Register Definitions */ -#define TPI_DEVTYPE_MajorType_Pos 4U /*!< TPI DEVTYPE: MajorType Position */ -#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ - -#define TPI_DEVTYPE_SubType_Pos 0U /*!< TPI DEVTYPE: SubType Position */ -#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ - -/*@}*/ /* end of group CMSIS_TPI */ - - -#if (__MPU_PRESENT == 1U) -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_MPU Memory Protection Unit (MPU) - \brief Type definitions for the Memory Protection Unit (MPU) - @{ - */ - -/** - \brief Structure type to access the Memory Protection Unit (MPU). - */ -typedef struct -{ - __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ - __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ - __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ - __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ - __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ - __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ - __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ - __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ - __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ - __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ - __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ -} MPU_Type; - -/* MPU Type Register Definitions */ -#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ -#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ - -#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ -#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ - -#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ -#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ - -/* MPU Control Register Definitions */ -#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ -#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ - -#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ -#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ - -#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ -#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ - -/* MPU Region Number Register Definitions */ -#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ -#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ - -/* MPU Region Base Address Register Definitions */ -#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ -#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ - -#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ -#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ - -#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ -#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ - -/* MPU Region Attribute and Size Register Definitions */ -#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ -#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ - -#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ -#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ - -#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ -#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ - -#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ -#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ - -#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ -#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ - -#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ -#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ - -#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ -#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ - -#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ -#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ - -#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ -#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ - -#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ -#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ - -/*@} end of group CMSIS_MPU */ -#endif - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) - \brief Type definitions for the Core Debug Registers - @{ - */ - -/** - \brief Structure type to access the Core Debug Register (CoreDebug). - */ -typedef struct -{ - __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ - __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ - __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ - __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ -} CoreDebug_Type; - -/* Debug Halting Control and Status Register Definitions */ -#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ -#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ - -#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ -#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ - -#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ -#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ - -#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ -#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ - -#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ -#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ - -#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ -#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ - -#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ -#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ - -#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ -#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ - -#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ -#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ - -#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ -#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ - -#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ -#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ - -#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ -#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ - -/* Debug Core Register Selector Register Definitions */ -#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ -#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ - -#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ -#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ - -/* Debug Exception and Monitor Control Register Definitions */ -#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ -#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ - -#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ -#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ - -#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ -#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ - -#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ -#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ - -#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ -#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ - -#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ -#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ - -#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ -#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ - -#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ -#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ - -#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ -#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ - -#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ -#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ - -#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ -#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ - -#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ -#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ - -#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ -#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ - -/*@} end of group CMSIS_CoreDebug */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_bitfield Core register bit field macros - \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). - @{ - */ - -/** - \brief Mask and shift a bit field value for use in a register bit range. - \param[in] field Name of the register bit field. - \param[in] value Value of the bit field. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk) - -/** - \brief Mask and shift a register value to extract a bit filed value. - \param[in] field Name of the register bit field. - \param[in] value Value of register. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos) - -/*@} end of group CMSIS_core_bitfield */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_base Core Definitions - \brief Definitions for base addresses, unions, and structures. - @{ - */ - -/* Memory mapping of Cortex-M3 Hardware */ -#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ -#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ -#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ -#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ -#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ -#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ -#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ -#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ - -#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ -#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ -#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ -#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ -#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ -#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ -#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ -#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ - -#if (__MPU_PRESENT == 1U) - #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ - #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ -#endif - -/*@} */ - - - -/******************************************************************************* - * Hardware Abstraction Layer - Core Function Interface contains: - - Core NVIC Functions - - Core SysTick Functions - - Core Debug Functions - - Core Register Access Functions - ******************************************************************************/ -/** - \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference -*/ - - - -/* ########################## NVIC functions #################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_NVICFunctions NVIC Functions - \brief Functions that manage interrupts and exceptions via the NVIC. - @{ - */ - -/** - \brief Set Priority Grouping - \details Sets the priority grouping field using the required unlock sequence. - The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. - Only values from 0..7 are used. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. - \param [in] PriorityGroup Priority grouping field. - */ -__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) -{ - uint32_t reg_value; - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - - reg_value = SCB->AIRCR; /* read old register configuration */ - reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ - reg_value = (reg_value | - ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */ - SCB->AIRCR = reg_value; -} - - -/** - \brief Get Priority Grouping - \details Reads the priority grouping field from the NVIC Interrupt Controller. - \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). - */ -__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void) -{ - return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); -} - - -/** - \brief Get External Interrupt Enable State - \details Returns whether a device-specific interrupt is enabled in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - \return 0 Interrupt is disabled. - \return 1 Interrupt is enabled. - */ -__STATIC_INLINE uint32_t NVIC_IsIRQEnabled(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Enable External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Active Interrupt - \details Reads the active register in NVIC and returns the active bit. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not active. - \return 1 Interrupt status is active. - */ -__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); - } - else - { - NVIC->IP[((uint32_t)(int32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \param [in] IRQn Interrupt number. - \return Interrupt Priority. - Value is aligned automatically to the implemented priority bits of the microcontroller. - */ -__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) -{ - - if ((int32_t)(IRQn) < 0) - { - return(((uint32_t)SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); - } -} - - -/** - \brief Encode Priority - \details Encodes the priority for an interrupt with the given priority group, - preemptive priority value, and subpriority value. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. - \param [in] PriorityGroup Used priority group. - \param [in] PreemptPriority Preemptive priority value (starting from 0). - \param [in] SubPriority Subpriority value (starting from 0). - \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). - */ -__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) -{ - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - uint32_t PreemptPriorityBits; - uint32_t SubPriorityBits; - - PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); - SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); - - return ( - ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | - ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) - ); -} - - -/** - \brief Decode Priority - \details Decodes an interrupt priority value with a given priority group to - preemptive priority value and subpriority value. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. - \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). - \param [in] PriorityGroup Used priority group. - \param [out] pPreemptPriority Preemptive priority value (starting from 0). - \param [out] pSubPriority Subpriority value (starting from 0). - */ -__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) -{ - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - uint32_t PreemptPriorityBits; - uint32_t SubPriorityBits; - - PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); - SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); - - *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); - *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); -} - - -/** - \brief System Reset - \details Initiates a system reset request to reset the MCU. - */ -__STATIC_INLINE void NVIC_SystemReset(void) -{ - __DSB(); /* Ensure all outstanding memory accesses included - buffered write are completed before reset */ - SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | - SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ - __DSB(); /* Ensure completion of memory access */ - - for(;;) /* wait until reset */ - { - __NOP(); - } -} - -/*@} end of CMSIS_Core_NVICFunctions */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__Vendor_SysTickConfig == 0U) - -/** - \brief System Tick Configuration - \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. - Counter is in free running mode to generate periodic interrupts. - \param [in] ticks Number of ticks between two interrupts. - \return 0 Function succeeded. - \return 1 Function failed. - \note When the variable __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - must contain a vendor-specific implementation of this function. - */ -__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) -{ - if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) - { - return (1UL); /* Reload value impossible */ - } - - SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ - NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ - SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ - SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | - SysTick_CTRL_TICKINT_Msk | - SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ - return (0UL); /* Function successful */ -} - -#endif - -/*@} end of CMSIS_Core_SysTickFunctions */ - - - -/* ##################################### Debug In/Output function ########################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_core_DebugFunctions ITM Functions - \brief Functions that access the ITM debug interface. - @{ - */ - -extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ -#define ITM_RXBUFFER_EMPTY 0x5AA55AA5U /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ - - -/** - \brief ITM Send Character - \details Transmits a character via the ITM channel 0, and - \li Just returns when no debugger is connected that has booked the output. - \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. - \param [in] ch Character to transmit. - \returns Character to transmit. - */ -__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) -{ - if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ - ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ - { - while (ITM->PORT[0U].u32 == 0UL) - { - __NOP(); - } - ITM->PORT[0U].u8 = (uint8_t)ch; - } - return (ch); -} - - -/** - \brief ITM Receive Character - \details Inputs a character via the external variable \ref ITM_RxBuffer. - \return Received character. - \return -1 No character pending. - */ -__STATIC_INLINE int32_t ITM_ReceiveChar (void) -{ - int32_t ch = -1; /* no character available */ - - if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) - { - ch = ITM_RxBuffer; - ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ - } - - return (ch); -} - - -/** - \brief ITM Check Character - \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. - \return 0 No character available. - \return 1 Character available. - */ -__STATIC_INLINE int32_t ITM_CheckChar (void) -{ - - if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) - { - return (0); /* no character available */ - } - else - { - return (1); /* character available */ - } -} - -/*@} end of CMSIS_core_DebugFunctions */ - - - - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CM3_H_DEPENDANT */ - -#endif /* __CMSIS_GENERIC */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/core_cm4.h b/arch/cpu/arm/cortex-m/CMSIS/core_cm4.h deleted file mode 100644 index 2594f821f..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/core_cm4.h +++ /dev/null @@ -1,1950 +0,0 @@ -/**************************************************************************//** - * @file core_cm4.h - * @brief CMSIS Cortex-M4 Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CM4_H_GENERIC -#define __CORE_CM4_H_GENERIC - -#include - -#ifdef __cplusplus - extern "C" { -#endif - -/** - CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions - CMSIS violates the following MISRA-C:2004 rules: - - \li Required Rule 8.5, object/function definition in header file.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup Cortex_M4 - @{ - */ - -/* CMSIS CM4 definitions */ -#define __CM4_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __CM4_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __CM4_CMSIS_VERSION ((__CM4_CMSIS_VERSION_MAIN << 16U) | \ - __CM4_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_M (0x04U) /*!< Cortex-M Core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __FPU_USED indicates whether an FPU is used or not. - For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. -*/ -#if defined ( __CC_ARM ) - #if defined __TARGET_FPU_VFP - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #if defined __ARM_PCS_VFP - #if (__FPU_PRESENT == 1) - #define __FPU_USED 1U - #else - #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined ( __GNUC__ ) - #if defined (__VFP_FP__) && !defined(__SOFTFP__) - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined ( __ICCARM__ ) - #if defined __ARMVFP__ - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined ( __TMS470__ ) - #if defined __TI_VFP_SUPPORT__ - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined ( __TASKING__ ) - #if defined __FPU_VFP__ - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined ( __CSMC__ ) - #if ( __CSMC__ & 0x400U) - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#endif - -#include "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ -#include "core_cmSimd.h" /* Compiler specific SIMD Intrinsics */ - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CM4_H_GENERIC */ - -#ifndef __CMSIS_GENERIC - -#ifndef __CORE_CM4_H_DEPENDANT -#define __CORE_CM4_H_DEPENDANT - -#ifdef __cplusplus - extern "C" { -#endif - -/* check device defines and use defaults */ -#if defined __CHECK_DEVICE_DEFINES - #ifndef __CM4_REV - #define __CM4_REV 0x0000U - #warning "__CM4_REV not defined in device header file; using default!" - #endif - - #ifndef __FPU_PRESENT - #define __FPU_PRESENT 0U - #warning "__FPU_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __MPU_PRESENT - #define __MPU_PRESENT 0U - #warning "__MPU_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __NVIC_PRIO_BITS - #define __NVIC_PRIO_BITS 4U - #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" - #endif - - #ifndef __Vendor_SysTickConfig - #define __Vendor_SysTickConfig 0U - #warning "__Vendor_SysTickConfig not defined in device header file; using default!" - #endif -#endif - -/* IO definitions (access restrictions to peripheral registers) */ -/** - \defgroup CMSIS_glob_defs CMSIS Global Defines - - IO Type Qualifiers are used - \li to specify the access to peripheral variables. - \li for automatic generation of peripheral register debug information. -*/ -#ifdef __cplusplus - #define __I volatile /*!< Defines 'read only' permissions */ -#else - #define __I volatile const /*!< Defines 'read only' permissions */ -#endif -#define __O volatile /*!< Defines 'write only' permissions */ -#define __IO volatile /*!< Defines 'read / write' permissions */ - -/* following defines should be used for structure members */ -#define __IM volatile const /*! Defines 'read only' structure member permissions */ -#define __OM volatile /*! Defines 'write only' structure member permissions */ -#define __IOM volatile /*! Defines 'read / write' structure member permissions */ - -/*@} end of group Cortex_M4 */ - - - -/******************************************************************************* - * Register Abstraction - Core Register contain: - - Core Register - - Core NVIC Register - - Core SCB Register - - Core SysTick Register - - Core Debug Register - - Core MPU Register - - Core FPU Register - ******************************************************************************/ -/** - \defgroup CMSIS_core_register Defines and Type Definitions - \brief Type definitions and defines for Cortex-M processor based devices. -*/ - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CORE Status and Control Registers - \brief Core Register type definitions. - @{ - */ - -/** - \brief Union type to access the Application Program Status Register (APSR). - */ -typedef union -{ - struct - { - uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ - uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ - uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ - uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} APSR_Type; - -/* APSR Register Definitions */ -#define APSR_N_Pos 31U /*!< APSR: N Position */ -#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ - -#define APSR_Z_Pos 30U /*!< APSR: Z Position */ -#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ - -#define APSR_C_Pos 29U /*!< APSR: C Position */ -#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ - -#define APSR_V_Pos 28U /*!< APSR: V Position */ -#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ - -#define APSR_Q_Pos 27U /*!< APSR: Q Position */ -#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ - -#define APSR_GE_Pos 16U /*!< APSR: GE Position */ -#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ - - -/** - \brief Union type to access the Interrupt Program Status Register (IPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} IPSR_Type; - -/* IPSR Register Definitions */ -#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ -#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ - - -/** - \brief Union type to access the Special-Purpose Program Status Registers (xPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ - uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ - uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ - uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ - uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ - uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} xPSR_Type; - -/* xPSR Register Definitions */ -#define xPSR_N_Pos 31U /*!< xPSR: N Position */ -#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ - -#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ -#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ - -#define xPSR_C_Pos 29U /*!< xPSR: C Position */ -#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ - -#define xPSR_V_Pos 28U /*!< xPSR: V Position */ -#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ - -#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ -#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ - -#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */ -#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */ - -#define xPSR_T_Pos 24U /*!< xPSR: T Position */ -#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ - -#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ -#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ - -#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ -#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ - - -/** - \brief Union type to access the Control Registers (CONTROL). - */ -typedef union -{ - struct - { - uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ - uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ - uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ - uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} CONTROL_Type; - -/* CONTROL Register Definitions */ -#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ -#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ - -#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ -#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ - -#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ -#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ - -/*@} end of group CMSIS_CORE */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) - \brief Type definitions for the NVIC Registers - @{ - */ - -/** - \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). - */ -typedef struct -{ - __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ - uint32_t RESERVED0[24U]; - __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ - uint32_t RSERVED1[24U]; - __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ - uint32_t RESERVED2[24U]; - __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ - uint32_t RESERVED3[24U]; - __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ - uint32_t RESERVED4[56U]; - __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ - uint32_t RESERVED5[644U]; - __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ -} NVIC_Type; - -/* Software Triggered Interrupt Register Definitions */ -#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ -#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ - -/*@} end of group CMSIS_NVIC */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCB System Control Block (SCB) - \brief Type definitions for the System Control Block Registers - @{ - */ - -/** - \brief Structure type to access the System Control Block (SCB). - */ -typedef struct -{ - __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ - __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ - __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ - __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ - __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ - __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ - __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ - __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ - __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ - __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ - __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ - __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ - __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ - __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ - __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ - __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ - __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ - __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ - __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ - uint32_t RESERVED0[5U]; - __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ -} SCB_Type; - -/* SCB CPUID Register Definitions */ -#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ -#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ - -#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ -#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ - -#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ -#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ - -#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ -#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ - -#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ -#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ - -/* SCB Interrupt Control State Register Definitions */ -#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ -#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ - -#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ -#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ - -#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ -#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ - -#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ -#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ - -#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ -#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ - -#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ -#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ - -#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ -#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ - -#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ -#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ - -#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ -#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ - -#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ -#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ - -/* SCB Vector Table Offset Register Definitions */ -#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ -#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ - -/* SCB Application Interrupt and Reset Control Register Definitions */ -#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ -#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ - -#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ -#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ - -#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ -#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ - -#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ -#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ - -#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ -#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ - -#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ -#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ - -#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ -#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ - -/* SCB System Control Register Definitions */ -#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ -#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ - -#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ -#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ - -#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ -#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ - -/* SCB Configuration Control Register Definitions */ -#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ -#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ - -#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ -#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ - -#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ -#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ - -#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ -#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ - -#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ -#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ - -#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ -#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ - -/* SCB System Handler Control and State Register Definitions */ -#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ -#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ - -#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ -#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ - -#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ -#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ - -#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ -#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ - -#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ -#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ - -#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ -#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ - -#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ -#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ - -#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ -#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ - -#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ -#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ - -#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ -#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ - -#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ -#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ - -#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ -#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ - -#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ -#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ - -#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ -#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ - -/* SCB Configurable Fault Status Register Definitions */ -#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ -#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ - -#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ -#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ - -#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ -#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ - -/* SCB Hard Fault Status Register Definitions */ -#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ -#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ - -#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ -#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ - -#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ -#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ - -/* SCB Debug Fault Status Register Definitions */ -#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ -#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ - -#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ -#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ - -#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ -#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ - -#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ -#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ - -#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ -#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ - -/*@} end of group CMSIS_SCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) - \brief Type definitions for the System Control and ID Register not in the SCB - @{ - */ - -/** - \brief Structure type to access the System Control and ID Register not in the SCB. - */ -typedef struct -{ - uint32_t RESERVED0[1U]; - __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ - __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ -} SCnSCB_Type; - -/* Interrupt Controller Type Register Definitions */ -#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ -#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ - -/* Auxiliary Control Register Definitions */ -#define SCnSCB_ACTLR_DISOOFP_Pos 9U /*!< ACTLR: DISOOFP Position */ -#define SCnSCB_ACTLR_DISOOFP_Msk (1UL << SCnSCB_ACTLR_DISOOFP_Pos) /*!< ACTLR: DISOOFP Mask */ - -#define SCnSCB_ACTLR_DISFPCA_Pos 8U /*!< ACTLR: DISFPCA Position */ -#define SCnSCB_ACTLR_DISFPCA_Msk (1UL << SCnSCB_ACTLR_DISFPCA_Pos) /*!< ACTLR: DISFPCA Mask */ - -#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */ -#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ - -#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */ -#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */ - -#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ -#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ - -/*@} end of group CMSIS_SCnotSCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SysTick System Tick Timer (SysTick) - \brief Type definitions for the System Timer Registers. - @{ - */ - -/** - \brief Structure type to access the System Timer (SysTick). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ - __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ - __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ - __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ -} SysTick_Type; - -/* SysTick Control / Status Register Definitions */ -#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ -#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ - -#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ -#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ - -#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ -#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ - -#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ -#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ - -/* SysTick Reload Register Definitions */ -#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ -#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ - -/* SysTick Current Register Definitions */ -#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ -#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ - -/* SysTick Calibration Register Definitions */ -#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ -#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ - -#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ -#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ - -#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ -#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ - -/*@} end of group CMSIS_SysTick */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) - \brief Type definitions for the Instrumentation Trace Macrocell (ITM) - @{ - */ - -/** - \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). - */ -typedef struct -{ - __OM union - { - __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ - __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ - __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ - } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ - uint32_t RESERVED0[864U]; - __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ - uint32_t RESERVED1[15U]; - __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ - uint32_t RESERVED2[15U]; - __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ - uint32_t RESERVED3[29U]; - __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ - __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ - __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ - uint32_t RESERVED4[43U]; - __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ - __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ - uint32_t RESERVED5[6U]; - __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ - __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ - __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ - __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ - __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ - __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ - __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ - __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ - __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ - __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ - __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ - __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ -} ITM_Type; - -/* ITM Trace Privilege Register Definitions */ -#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ -#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ - -/* ITM Trace Control Register Definitions */ -#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ -#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ - -#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ -#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ - -#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ -#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ - -#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ -#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ - -#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ -#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ - -#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ -#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ - -#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ -#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ - -#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ -#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ - -#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ -#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ - -/* ITM Integration Write Register Definitions */ -#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ -#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ - -/* ITM Integration Read Register Definitions */ -#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ -#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ - -/* ITM Integration Mode Control Register Definitions */ -#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ -#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ - -/* ITM Lock Status Register Definitions */ -#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ -#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ - -#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ -#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ - -#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ -#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ - -/*@}*/ /* end of group CMSIS_ITM */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) - \brief Type definitions for the Data Watchpoint and Trace (DWT) - @{ - */ - -/** - \brief Structure type to access the Data Watchpoint and Trace Register (DWT). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ - __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ - __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ - __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ - __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ - __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ - __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ - __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ - __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ - __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ - __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ - uint32_t RESERVED0[1U]; - __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ - __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ - __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ - uint32_t RESERVED1[1U]; - __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ - __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ - __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ - uint32_t RESERVED2[1U]; - __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ - __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ - __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ -} DWT_Type; - -/* DWT Control Register Definitions */ -#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ -#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ - -#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ -#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ - -#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ -#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ - -#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ -#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ - -#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ -#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ - -#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ -#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ - -#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ -#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ - -#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ -#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ - -#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ -#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ - -#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ -#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ - -#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ -#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ - -#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ -#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ - -#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ -#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ - -#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ -#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ - -#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ -#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ - -#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ -#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ - -#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ -#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ - -#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ -#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ - -/* DWT CPI Count Register Definitions */ -#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ -#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ - -/* DWT Exception Overhead Count Register Definitions */ -#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ -#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ - -/* DWT Sleep Count Register Definitions */ -#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ -#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ - -/* DWT LSU Count Register Definitions */ -#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ -#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ - -/* DWT Folded-instruction Count Register Definitions */ -#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ -#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ - -/* DWT Comparator Mask Register Definitions */ -#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ -#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ - -/* DWT Comparator Function Register Definitions */ -#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ -#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ - -#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ -#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ - -#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ -#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ - -#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ -#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ - -#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ -#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ - -#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ -#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ - -#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ -#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ - -#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ -#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ - -#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ -#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ - -/*@}*/ /* end of group CMSIS_DWT */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_TPI Trace Port Interface (TPI) - \brief Type definitions for the Trace Port Interface (TPI) - @{ - */ - -/** - \brief Structure type to access the Trace Port Interface Register (TPI). - */ -typedef struct -{ - __IOM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ - __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ - uint32_t RESERVED0[2U]; - __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ - uint32_t RESERVED1[55U]; - __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ - uint32_t RESERVED2[131U]; - __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ - __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ - __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ - uint32_t RESERVED3[759U]; - __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */ - __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ - __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ - uint32_t RESERVED4[1U]; - __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ - __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ - __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ - uint32_t RESERVED5[39U]; - __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ - __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ - uint32_t RESERVED7[8U]; - __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ - __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ -} TPI_Type; - -/* TPI Asynchronous Clock Prescaler Register Definitions */ -#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ -#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ - -/* TPI Selected Pin Protocol Register Definitions */ -#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ -#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ - -/* TPI Formatter and Flush Status Register Definitions */ -#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ -#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ - -#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ -#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ - -#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ -#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ - -#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ -#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ - -/* TPI Formatter and Flush Control Register Definitions */ -#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ -#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ - -#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ -#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ - -/* TPI TRIGGER Register Definitions */ -#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ -#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ - -/* TPI Integration ETM Data Register Definitions (FIFO0) */ -#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ -#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ - -#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ -#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ - -#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ -#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ - -#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ -#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ - -#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ -#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ - -#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ -#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ - -#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ -#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ - -/* TPI ITATBCTR2 Register Definitions */ -#define TPI_ITATBCTR2_ATREADY_Pos 0U /*!< TPI ITATBCTR2: ATREADY Position */ -#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */ - -/* TPI Integration ITM Data Register Definitions (FIFO1) */ -#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ -#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ - -#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ -#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ - -#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ -#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ - -#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ -#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ - -#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ -#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ - -#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ -#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ - -#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ -#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ - -/* TPI ITATBCTR0 Register Definitions */ -#define TPI_ITATBCTR0_ATREADY_Pos 0U /*!< TPI ITATBCTR0: ATREADY Position */ -#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */ - -/* TPI Integration Mode Control Register Definitions */ -#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ -#define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ - -/* TPI DEVID Register Definitions */ -#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ -#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ - -#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ -#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ - -#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ -#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ - -#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ -#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ - -#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ -#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ - -#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ -#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ - -/* TPI DEVTYPE Register Definitions */ -#define TPI_DEVTYPE_MajorType_Pos 4U /*!< TPI DEVTYPE: MajorType Position */ -#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ - -#define TPI_DEVTYPE_SubType_Pos 0U /*!< TPI DEVTYPE: SubType Position */ -#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ - -/*@}*/ /* end of group CMSIS_TPI */ - - -#if (__MPU_PRESENT == 1U) -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_MPU Memory Protection Unit (MPU) - \brief Type definitions for the Memory Protection Unit (MPU) - @{ - */ - -/** - \brief Structure type to access the Memory Protection Unit (MPU). - */ -typedef struct -{ - __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ - __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ - __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ - __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ - __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ - __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ - __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ - __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ - __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ - __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ - __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ -} MPU_Type; - -/* MPU Type Register Definitions */ -#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ -#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ - -#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ -#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ - -#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ -#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ - -/* MPU Control Register Definitions */ -#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ -#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ - -#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ -#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ - -#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ -#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ - -/* MPU Region Number Register Definitions */ -#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ -#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ - -/* MPU Region Base Address Register Definitions */ -#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ -#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ - -#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ -#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ - -#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ -#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ - -/* MPU Region Attribute and Size Register Definitions */ -#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ -#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ - -#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ -#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ - -#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ -#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ - -#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ -#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ - -#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ -#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ - -#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ -#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ - -#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ -#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ - -#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ -#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ - -#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ -#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ - -#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ -#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ - -/*@} end of group CMSIS_MPU */ -#endif - - -#if (__FPU_PRESENT == 1U) -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_FPU Floating Point Unit (FPU) - \brief Type definitions for the Floating Point Unit (FPU) - @{ - */ - -/** - \brief Structure type to access the Floating Point Unit (FPU). - */ -typedef struct -{ - uint32_t RESERVED0[1U]; - __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ - __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ - __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ - __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ - __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ -} FPU_Type; - -/* Floating-Point Context Control Register Definitions */ -#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ -#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ - -#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ -#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ - -#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ -#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ - -#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ -#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ - -#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ -#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ - -#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ -#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ - -#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ -#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ - -#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ -#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ - -#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ -#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ - -/* Floating-Point Context Address Register Definitions */ -#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ -#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ - -/* Floating-Point Default Status Control Register Definitions */ -#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ -#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ - -#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ -#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ - -#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ -#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ - -#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ -#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ - -/* Media and FP Feature Register 0 Definitions */ -#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ -#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ - -#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ -#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ - -#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ -#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ - -#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ -#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ - -#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ -#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ - -#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ -#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ - -#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ -#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ - -#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ -#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ - -/* Media and FP Feature Register 1 Definitions */ -#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ -#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ - -#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ -#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ - -#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ -#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ - -#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ -#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ - -/*@} end of group CMSIS_FPU */ -#endif - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) - \brief Type definitions for the Core Debug Registers - @{ - */ - -/** - \brief Structure type to access the Core Debug Register (CoreDebug). - */ -typedef struct -{ - __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ - __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ - __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ - __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ -} CoreDebug_Type; - -/* Debug Halting Control and Status Register Definitions */ -#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ -#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ - -#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ -#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ - -#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ -#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ - -#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ -#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ - -#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ -#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ - -#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ -#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ - -#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ -#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ - -#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ -#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ - -#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ -#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ - -#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ -#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ - -#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ -#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ - -#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ -#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ - -/* Debug Core Register Selector Register Definitions */ -#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ -#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ - -#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ -#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ - -/* Debug Exception and Monitor Control Register Definitions */ -#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ -#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ - -#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ -#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ - -#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ -#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ - -#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ -#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ - -#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ -#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ - -#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ -#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ - -#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ -#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ - -#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ -#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ - -#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ -#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ - -#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ -#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ - -#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ -#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ - -#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ -#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ - -#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ -#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ - -/*@} end of group CMSIS_CoreDebug */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_bitfield Core register bit field macros - \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). - @{ - */ - -/** - \brief Mask and shift a bit field value for use in a register bit range. - \param[in] field Name of the register bit field. - \param[in] value Value of the bit field. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk) - -/** - \brief Mask and shift a register value to extract a bit filed value. - \param[in] field Name of the register bit field. - \param[in] value Value of register. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos) - -/*@} end of group CMSIS_core_bitfield */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_base Core Definitions - \brief Definitions for base addresses, unions, and structures. - @{ - */ - -/* Memory mapping of Cortex-M4 Hardware */ -#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ -#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ -#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ -#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ -#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ -#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ -#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ -#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ - -#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ -#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ -#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ -#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ -#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ -#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ -#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ -#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ - -#if (__MPU_PRESENT == 1U) - #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ - #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ -#endif - -#if (__FPU_PRESENT == 1U) - #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ - #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ -#endif - -/*@} */ - - - -/******************************************************************************* - * Hardware Abstraction Layer - Core Function Interface contains: - - Core NVIC Functions - - Core SysTick Functions - - Core Debug Functions - - Core Register Access Functions - ******************************************************************************/ -/** - \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference -*/ - - - -/* ########################## NVIC functions #################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_NVICFunctions NVIC Functions - \brief Functions that manage interrupts and exceptions via the NVIC. - @{ - */ - -/** - \brief Set Priority Grouping - \details Sets the priority grouping field using the required unlock sequence. - The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. - Only values from 0..7 are used. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. - \param [in] PriorityGroup Priority grouping field. - */ -__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) -{ - uint32_t reg_value; - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - - reg_value = SCB->AIRCR; /* read old register configuration */ - reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ - reg_value = (reg_value | - ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */ - SCB->AIRCR = reg_value; -} - - -/** - \brief Get Priority Grouping - \details Reads the priority grouping field from the NVIC Interrupt Controller. - \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). - */ -__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void) -{ - return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); -} - - -/** - \brief Get External Interrupt Enable State - \details Returns whether a device-specific interrupt is enabled in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - \return 0 Interrupt is disabled. - \return 1 Interrupt is enabled. - */ -__STATIC_INLINE uint32_t NVIC_IsIRQEnabled(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Enable External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Active Interrupt - \details Reads the active register in NVIC and returns the active bit. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not active. - \return 1 Interrupt status is active. - */ -__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); - } - else - { - NVIC->IP[((uint32_t)(int32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \param [in] IRQn Interrupt number. - \return Interrupt Priority. - Value is aligned automatically to the implemented priority bits of the microcontroller. - */ -__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) -{ - - if ((int32_t)(IRQn) < 0) - { - return(((uint32_t)SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); - } -} - - -/** - \brief Encode Priority - \details Encodes the priority for an interrupt with the given priority group, - preemptive priority value, and subpriority value. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. - \param [in] PriorityGroup Used priority group. - \param [in] PreemptPriority Preemptive priority value (starting from 0). - \param [in] SubPriority Subpriority value (starting from 0). - \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). - */ -__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) -{ - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - uint32_t PreemptPriorityBits; - uint32_t SubPriorityBits; - - PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); - SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); - - return ( - ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | - ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) - ); -} - - -/** - \brief Decode Priority - \details Decodes an interrupt priority value with a given priority group to - preemptive priority value and subpriority value. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. - \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). - \param [in] PriorityGroup Used priority group. - \param [out] pPreemptPriority Preemptive priority value (starting from 0). - \param [out] pSubPriority Subpriority value (starting from 0). - */ -__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) -{ - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - uint32_t PreemptPriorityBits; - uint32_t SubPriorityBits; - - PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); - SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); - - *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); - *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); -} - - -/** - \brief System Reset - \details Initiates a system reset request to reset the MCU. - */ -__STATIC_INLINE void NVIC_SystemReset(void) -{ - __DSB(); /* Ensure all outstanding memory accesses included - buffered write are completed before reset */ - SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | - SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ - __DSB(); /* Ensure completion of memory access */ - - for(;;) /* wait until reset */ - { - __NOP(); - } -} - -/*@} end of CMSIS_Core_NVICFunctions */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__Vendor_SysTickConfig == 0U) - -/** - \brief System Tick Configuration - \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. - Counter is in free running mode to generate periodic interrupts. - \param [in] ticks Number of ticks between two interrupts. - \return 0 Function succeeded. - \return 1 Function failed. - \note When the variable __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - must contain a vendor-specific implementation of this function. - */ -__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) -{ - if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) - { - return (1UL); /* Reload value impossible */ - } - - SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ - NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ - SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ - SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | - SysTick_CTRL_TICKINT_Msk | - SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ - return (0UL); /* Function successful */ -} - -#endif - -/*@} end of CMSIS_Core_SysTickFunctions */ - - - -/* ##################################### Debug In/Output function ########################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_core_DebugFunctions ITM Functions - \brief Functions that access the ITM debug interface. - @{ - */ - -extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ -#define ITM_RXBUFFER_EMPTY 0x5AA55AA5U /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ - - -/** - \brief ITM Send Character - \details Transmits a character via the ITM channel 0, and - \li Just returns when no debugger is connected that has booked the output. - \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. - \param [in] ch Character to transmit. - \returns Character to transmit. - */ -__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) -{ - if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ - ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ - { - while (ITM->PORT[0U].u32 == 0UL) - { - __NOP(); - } - ITM->PORT[0U].u8 = (uint8_t)ch; - } - return (ch); -} - - -/** - \brief ITM Receive Character - \details Inputs a character via the external variable \ref ITM_RxBuffer. - \return Received character. - \return -1 No character pending. - */ -__STATIC_INLINE int32_t ITM_ReceiveChar (void) -{ - int32_t ch = -1; /* no character available */ - - if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) - { - ch = ITM_RxBuffer; - ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ - } - - return (ch); -} - - -/** - \brief ITM Check Character - \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. - \return 0 No character available. - \return 1 Character available. - */ -__STATIC_INLINE int32_t ITM_CheckChar (void) -{ - - if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) - { - return (0); /* no character available */ - } - else - { - return (1); /* character available */ - } -} - -/*@} end of CMSIS_core_DebugFunctions */ - - - - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CM4_H_DEPENDANT */ - -#endif /* __CMSIS_GENERIC */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/core_cm7.h b/arch/cpu/arm/cortex-m/CMSIS/core_cm7.h deleted file mode 100644 index a1517671c..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/core_cm7.h +++ /dev/null @@ -1,2525 +0,0 @@ -/**************************************************************************//** - * @file core_cm7.h - * @brief CMSIS Cortex-M7 Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CM7_H_GENERIC -#define __CORE_CM7_H_GENERIC - -#include - -#ifdef __cplusplus - extern "C" { -#endif - -/** - CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions - CMSIS violates the following MISRA-C:2004 rules: - - \li Required Rule 8.5, object/function definition in header file.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup Cortex_M7 - @{ - */ - -/* CMSIS CM7 definitions */ -#define __CM7_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __CM7_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __CM7_CMSIS_VERSION ((__CM7_CMSIS_VERSION_MAIN << 16U) | \ - __CM7_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_M (0x07U) /*!< Cortex-M Core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __FPU_USED indicates whether an FPU is used or not. - For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. -*/ -#if defined ( __CC_ARM ) - #if defined __TARGET_FPU_VFP - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #if defined __ARM_PCS_VFP - #if (__FPU_PRESENT == 1) - #define __FPU_USED 1U - #else - #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined ( __GNUC__ ) - #if defined (__VFP_FP__) && !defined(__SOFTFP__) - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined ( __ICCARM__ ) - #if defined __ARMVFP__ - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined ( __TMS470__ ) - #if defined __TI_VFP_SUPPORT__ - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined ( __TASKING__ ) - #if defined __FPU_VFP__ - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#elif defined ( __CSMC__ ) - #if ( __CSMC__ & 0x400U) - #if (__FPU_PRESENT == 1U) - #define __FPU_USED 1U - #else - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #define __FPU_USED 0U - #endif - #else - #define __FPU_USED 0U - #endif - -#endif - -#include "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ -#include "core_cmSimd.h" /* Compiler specific SIMD Intrinsics */ - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CM7_H_GENERIC */ - -#ifndef __CMSIS_GENERIC - -#ifndef __CORE_CM7_H_DEPENDANT -#define __CORE_CM7_H_DEPENDANT - -#ifdef __cplusplus - extern "C" { -#endif - -/* check device defines and use defaults */ -#if defined __CHECK_DEVICE_DEFINES - #ifndef __CM7_REV - #define __CM7_REV 0x0000U - #warning "__CM7_REV not defined in device header file; using default!" - #endif - - #ifndef __FPU_PRESENT - #define __FPU_PRESENT 0U - #warning "__FPU_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __MPU_PRESENT - #define __MPU_PRESENT 0U - #warning "__MPU_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __ICACHE_PRESENT - #define __ICACHE_PRESENT 0U - #warning "__ICACHE_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __DCACHE_PRESENT - #define __DCACHE_PRESENT 0U - #warning "__DCACHE_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __DTCM_PRESENT - #define __DTCM_PRESENT 0U - #warning "__DTCM_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __NVIC_PRIO_BITS - #define __NVIC_PRIO_BITS 3U - #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" - #endif - - #ifndef __Vendor_SysTickConfig - #define __Vendor_SysTickConfig 0U - #warning "__Vendor_SysTickConfig not defined in device header file; using default!" - #endif -#endif - -/* IO definitions (access restrictions to peripheral registers) */ -/** - \defgroup CMSIS_glob_defs CMSIS Global Defines - - IO Type Qualifiers are used - \li to specify the access to peripheral variables. - \li for automatic generation of peripheral register debug information. -*/ -#ifdef __cplusplus - #define __I volatile /*!< Defines 'read only' permissions */ -#else - #define __I volatile const /*!< Defines 'read only' permissions */ -#endif -#define __O volatile /*!< Defines 'write only' permissions */ -#define __IO volatile /*!< Defines 'read / write' permissions */ - -/* following defines should be used for structure members */ -#define __IM volatile const /*! Defines 'read only' structure member permissions */ -#define __OM volatile /*! Defines 'write only' structure member permissions */ -#define __IOM volatile /*! Defines 'read / write' structure member permissions */ - -/*@} end of group Cortex_M7 */ - - - -/******************************************************************************* - * Register Abstraction - Core Register contain: - - Core Register - - Core NVIC Register - - Core SCB Register - - Core SysTick Register - - Core Debug Register - - Core MPU Register - - Core FPU Register - ******************************************************************************/ -/** - \defgroup CMSIS_core_register Defines and Type Definitions - \brief Type definitions and defines for Cortex-M processor based devices. -*/ - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CORE Status and Control Registers - \brief Core Register type definitions. - @{ - */ - -/** - \brief Union type to access the Application Program Status Register (APSR). - */ -typedef union -{ - struct - { - uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ - uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ - uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ - uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} APSR_Type; - -/* APSR Register Definitions */ -#define APSR_N_Pos 31U /*!< APSR: N Position */ -#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ - -#define APSR_Z_Pos 30U /*!< APSR: Z Position */ -#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ - -#define APSR_C_Pos 29U /*!< APSR: C Position */ -#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ - -#define APSR_V_Pos 28U /*!< APSR: V Position */ -#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ - -#define APSR_Q_Pos 27U /*!< APSR: Q Position */ -#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ - -#define APSR_GE_Pos 16U /*!< APSR: GE Position */ -#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ - - -/** - \brief Union type to access the Interrupt Program Status Register (IPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} IPSR_Type; - -/* IPSR Register Definitions */ -#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ -#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ - - -/** - \brief Union type to access the Special-Purpose Program Status Registers (xPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ - uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ - uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ - uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ - uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ - uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} xPSR_Type; - -/* xPSR Register Definitions */ -#define xPSR_N_Pos 31U /*!< xPSR: N Position */ -#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ - -#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ -#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ - -#define xPSR_C_Pos 29U /*!< xPSR: C Position */ -#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ - -#define xPSR_V_Pos 28U /*!< xPSR: V Position */ -#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ - -#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ -#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ - -#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */ -#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */ - -#define xPSR_T_Pos 24U /*!< xPSR: T Position */ -#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ - -#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ -#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ - -#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ -#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ - - -/** - \brief Union type to access the Control Registers (CONTROL). - */ -typedef union -{ - struct - { - uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ - uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ - uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ - uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} CONTROL_Type; - -/* CONTROL Register Definitions */ -#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ -#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ - -#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ -#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ - -#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ -#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ - -/*@} end of group CMSIS_CORE */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) - \brief Type definitions for the NVIC Registers - @{ - */ - -/** - \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). - */ -typedef struct -{ - __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ - uint32_t RESERVED0[24U]; - __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ - uint32_t RSERVED1[24U]; - __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ - uint32_t RESERVED2[24U]; - __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ - uint32_t RESERVED3[24U]; - __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ - uint32_t RESERVED4[56U]; - __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ - uint32_t RESERVED5[644U]; - __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ -} NVIC_Type; - -/* Software Triggered Interrupt Register Definitions */ -#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ -#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ - -/*@} end of group CMSIS_NVIC */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCB System Control Block (SCB) - \brief Type definitions for the System Control Block Registers - @{ - */ - -/** - \brief Structure type to access the System Control Block (SCB). - */ -typedef struct -{ - __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ - __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ - __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ - __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ - __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ - __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ - __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ - __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ - __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ - __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ - __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ - __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ - __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ - __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ - __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ - __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ - __IM uint32_t ID_AFR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ - __IM uint32_t ID_MFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ - __IM uint32_t ID_ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ - uint32_t RESERVED0[1U]; - __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */ - __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */ - __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */ - __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */ - __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ - uint32_t RESERVED3[93U]; - __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */ - uint32_t RESERVED4[15U]; - __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */ - __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */ - __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 1 */ - uint32_t RESERVED5[1U]; - __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */ - uint32_t RESERVED6[1U]; - __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */ - __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */ - __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */ - __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */ - __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */ - __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */ - __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */ - __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */ - uint32_t RESERVED7[6U]; - __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */ - __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */ - __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */ - __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */ - __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */ - uint32_t RESERVED8[1U]; - __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */ -} SCB_Type; - -/* SCB CPUID Register Definitions */ -#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ -#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ - -#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ -#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ - -#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ -#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ - -#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ -#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ - -#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ -#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ - -/* SCB Interrupt Control State Register Definitions */ -#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ -#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ - -#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ -#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ - -#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ -#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ - -#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ -#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ - -#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ -#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ - -#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ -#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ - -#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ -#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ - -#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ -#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ - -#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ -#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ - -#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ -#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ - -/* SCB Vector Table Offset Register Definitions */ -#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ -#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ - -/* SCB Application Interrupt and Reset Control Register Definitions */ -#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ -#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ - -#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ -#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ - -#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ -#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ - -#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ -#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ - -#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ -#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ - -#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ -#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ - -#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ -#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ - -/* SCB System Control Register Definitions */ -#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ -#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ - -#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ -#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ - -#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ -#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ - -/* SCB Configuration Control Register Definitions */ -#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: Branch prediction enable bit Position */ -#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: Branch prediction enable bit Mask */ - -#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: Instruction cache enable bit Position */ -#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: Instruction cache enable bit Mask */ - -#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: Cache enable bit Position */ -#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: Cache enable bit Mask */ - -#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ -#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ - -#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ -#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ - -#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ -#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ - -#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ -#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ - -#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ -#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ - -#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ -#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ - -/* SCB System Handler Control and State Register Definitions */ -#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ -#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ - -#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ -#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ - -#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ -#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ - -#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ -#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ - -#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ -#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ - -#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ -#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ - -#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ -#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ - -#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ -#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ - -#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ -#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ - -#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ -#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ - -#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ -#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ - -#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ -#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ - -#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ -#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ - -#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ -#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ - -/* SCB Configurable Fault Status Register Definitions */ -#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ -#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ - -#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ -#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ - -#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ -#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ - -/* SCB Hard Fault Status Register Definitions */ -#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ -#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ - -#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ -#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ - -#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ -#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ - -/* SCB Debug Fault Status Register Definitions */ -#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ -#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ - -#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ -#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ - -#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ -#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ - -#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ -#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ - -#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ -#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ - -/* SCB Cache Level ID Register Definitions */ -#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */ -#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */ - -#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */ -#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */ - -/* SCB Cache Type Register Definitions */ -#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */ -#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */ - -#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */ -#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */ - -#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */ -#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */ - -#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */ -#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */ - -#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */ -#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */ - -/* SCB Cache Size ID Register Definitions */ -#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */ -#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */ - -#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */ -#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */ - -#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */ -#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */ - -#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */ -#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */ - -#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */ -#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */ - -#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */ -#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */ - -#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */ -#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */ - -/* SCB Cache Size Selection Register Definitions */ -#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */ -#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */ - -#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */ -#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */ - -/* SCB Software Triggered Interrupt Register Definitions */ -#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */ -#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */ - -/* SCB D-Cache Invalidate by Set-way Register Definitions */ -#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */ -#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */ - -#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */ -#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */ - -/* SCB D-Cache Clean by Set-way Register Definitions */ -#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */ -#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */ - -#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */ -#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */ - -/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */ -#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */ -#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */ - -#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */ -#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */ - -/* Instruction Tightly-Coupled Memory Control Register Definitions */ -#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */ -#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */ - -#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */ -#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */ - -#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */ -#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */ - -#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */ -#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */ - -/* Data Tightly-Coupled Memory Control Register Definitions */ -#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */ -#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */ - -#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */ -#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */ - -#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */ -#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */ - -#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */ -#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */ - -/* AHBP Control Register Definitions */ -#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */ -#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */ - -#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */ -#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */ - -/* L1 Cache Control Register Definitions */ -#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */ -#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */ - -#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */ -#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */ - -#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */ -#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */ - -/* AHBS Control Register Definitions */ -#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */ -#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */ - -#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */ -#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */ - -#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/ -#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */ - -/* Auxiliary Bus Fault Status Register Definitions */ -#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/ -#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */ - -#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/ -#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */ - -#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/ -#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */ - -#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/ -#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */ - -#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/ -#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */ - -#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/ -#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */ - -/*@} end of group CMSIS_SCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) - \brief Type definitions for the System Control and ID Register not in the SCB - @{ - */ - -/** - \brief Structure type to access the System Control and ID Register not in the SCB. - */ -typedef struct -{ - uint32_t RESERVED0[1U]; - __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ - __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ -} SCnSCB_Type; - -/* Interrupt Controller Type Register Definitions */ -#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ -#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ - -/* Auxiliary Control Register Definitions */ -#define SCnSCB_ACTLR_DISITMATBFLUSH_Pos 12U /*!< ACTLR: DISITMATBFLUSH Position */ -#define SCnSCB_ACTLR_DISITMATBFLUSH_Msk (1UL << SCnSCB_ACTLR_DISITMATBFLUSH_Pos) /*!< ACTLR: DISITMATBFLUSH Mask */ - -#define SCnSCB_ACTLR_DISRAMODE_Pos 11U /*!< ACTLR: DISRAMODE Position */ -#define SCnSCB_ACTLR_DISRAMODE_Msk (1UL << SCnSCB_ACTLR_DISRAMODE_Pos) /*!< ACTLR: DISRAMODE Mask */ - -#define SCnSCB_ACTLR_FPEXCODIS_Pos 10U /*!< ACTLR: FPEXCODIS Position */ -#define SCnSCB_ACTLR_FPEXCODIS_Msk (1UL << SCnSCB_ACTLR_FPEXCODIS_Pos) /*!< ACTLR: FPEXCODIS Mask */ - -#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */ -#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ - -#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ -#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ - -/*@} end of group CMSIS_SCnotSCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SysTick System Tick Timer (SysTick) - \brief Type definitions for the System Timer Registers. - @{ - */ - -/** - \brief Structure type to access the System Timer (SysTick). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ - __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ - __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ - __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ -} SysTick_Type; - -/* SysTick Control / Status Register Definitions */ -#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ -#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ - -#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ -#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ - -#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ -#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ - -#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ -#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ - -/* SysTick Reload Register Definitions */ -#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ -#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ - -/* SysTick Current Register Definitions */ -#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ -#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ - -/* SysTick Calibration Register Definitions */ -#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ -#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ - -#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ -#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ - -#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ -#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ - -/*@} end of group CMSIS_SysTick */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) - \brief Type definitions for the Instrumentation Trace Macrocell (ITM) - @{ - */ - -/** - \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). - */ -typedef struct -{ - __OM union - { - __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ - __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ - __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ - } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ - uint32_t RESERVED0[864U]; - __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ - uint32_t RESERVED1[15U]; - __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ - uint32_t RESERVED2[15U]; - __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ - uint32_t RESERVED3[29U]; - __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ - __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ - __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ - uint32_t RESERVED4[43U]; - __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ - __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ - uint32_t RESERVED5[6U]; - __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ - __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ - __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ - __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ - __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ - __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ - __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ - __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ - __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ - __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ - __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ - __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ -} ITM_Type; - -/* ITM Trace Privilege Register Definitions */ -#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ -#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ - -/* ITM Trace Control Register Definitions */ -#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ -#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ - -#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ -#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ - -#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ -#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ - -#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ -#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ - -#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ -#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ - -#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ -#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ - -#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ -#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ - -#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ -#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ - -#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ -#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ - -/* ITM Integration Write Register Definitions */ -#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ -#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ - -/* ITM Integration Read Register Definitions */ -#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ -#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ - -/* ITM Integration Mode Control Register Definitions */ -#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ -#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ - -/* ITM Lock Status Register Definitions */ -#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ -#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ - -#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ -#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ - -#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ -#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ - -/*@}*/ /* end of group CMSIS_ITM */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) - \brief Type definitions for the Data Watchpoint and Trace (DWT) - @{ - */ - -/** - \brief Structure type to access the Data Watchpoint and Trace Register (DWT). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ - __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ - __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ - __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ - __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ - __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ - __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ - __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ - __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ - __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ - __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ - uint32_t RESERVED0[1U]; - __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ - __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ - __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ - uint32_t RESERVED1[1U]; - __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ - __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ - __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ - uint32_t RESERVED2[1U]; - __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ - __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ - __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ - uint32_t RESERVED3[981U]; - __OM uint32_t LAR; /*!< Offset: 0xFB0 ( W) Lock Access Register */ - __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */ -} DWT_Type; - -/* DWT Control Register Definitions */ -#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ -#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ - -#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ -#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ - -#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ -#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ - -#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ -#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ - -#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ -#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ - -#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ -#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ - -#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ -#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ - -#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ -#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ - -#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ -#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ - -#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ -#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ - -#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ -#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ - -#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ -#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ - -#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ -#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ - -#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ -#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ - -#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ -#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ - -#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ -#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ - -#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ -#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ - -#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ -#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ - -/* DWT CPI Count Register Definitions */ -#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ -#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ - -/* DWT Exception Overhead Count Register Definitions */ -#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ -#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ - -/* DWT Sleep Count Register Definitions */ -#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ -#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ - -/* DWT LSU Count Register Definitions */ -#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ -#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ - -/* DWT Folded-instruction Count Register Definitions */ -#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ -#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ - -/* DWT Comparator Mask Register Definitions */ -#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ -#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ - -/* DWT Comparator Function Register Definitions */ -#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ -#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ - -#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ -#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ - -#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ -#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ - -#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ -#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ - -#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ -#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ - -#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ -#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ - -#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ -#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ - -#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ -#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ - -#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ -#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ - -/*@}*/ /* end of group CMSIS_DWT */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_TPI Trace Port Interface (TPI) - \brief Type definitions for the Trace Port Interface (TPI) - @{ - */ - -/** - \brief Structure type to access the Trace Port Interface Register (TPI). - */ -typedef struct -{ - __IOM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ - __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ - uint32_t RESERVED0[2U]; - __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ - uint32_t RESERVED1[55U]; - __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ - uint32_t RESERVED2[131U]; - __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ - __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ - __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ - uint32_t RESERVED3[759U]; - __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */ - __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ - __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ - uint32_t RESERVED4[1U]; - __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ - __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ - __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ - uint32_t RESERVED5[39U]; - __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ - __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ - uint32_t RESERVED7[8U]; - __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ - __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ -} TPI_Type; - -/* TPI Asynchronous Clock Prescaler Register Definitions */ -#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ -#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ - -/* TPI Selected Pin Protocol Register Definitions */ -#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ -#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ - -/* TPI Formatter and Flush Status Register Definitions */ -#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ -#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ - -#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ -#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ - -#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ -#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ - -#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ -#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ - -/* TPI Formatter and Flush Control Register Definitions */ -#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ -#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ - -#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ -#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ - -/* TPI TRIGGER Register Definitions */ -#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ -#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ - -/* TPI Integration ETM Data Register Definitions (FIFO0) */ -#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ -#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ - -#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ -#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ - -#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ -#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ - -#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ -#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ - -#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ -#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ - -#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ -#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ - -#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ -#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ - -/* TPI ITATBCTR2 Register Definitions */ -#define TPI_ITATBCTR2_ATREADY_Pos 0U /*!< TPI ITATBCTR2: ATREADY Position */ -#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */ - -/* TPI Integration ITM Data Register Definitions (FIFO1) */ -#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ -#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ - -#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ -#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ - -#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ -#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ - -#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ -#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ - -#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ -#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ - -#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ -#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ - -#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ -#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ - -/* TPI ITATBCTR0 Register Definitions */ -#define TPI_ITATBCTR0_ATREADY_Pos 0U /*!< TPI ITATBCTR0: ATREADY Position */ -#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */ - -/* TPI Integration Mode Control Register Definitions */ -#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ -#define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ - -/* TPI DEVID Register Definitions */ -#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ -#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ - -#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ -#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ - -#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ -#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ - -#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ -#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ - -#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ -#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ - -#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ -#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ - -/* TPI DEVTYPE Register Definitions */ -#define TPI_DEVTYPE_MajorType_Pos 4U /*!< TPI DEVTYPE: MajorType Position */ -#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ - -#define TPI_DEVTYPE_SubType_Pos 0U /*!< TPI DEVTYPE: SubType Position */ -#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ - -/*@}*/ /* end of group CMSIS_TPI */ - - -#if (__MPU_PRESENT == 1U) -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_MPU Memory Protection Unit (MPU) - \brief Type definitions for the Memory Protection Unit (MPU) - @{ - */ - -/** - \brief Structure type to access the Memory Protection Unit (MPU). - */ -typedef struct -{ - __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ - __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ - __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ - __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ - __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ - __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ - __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ - __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ - __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ - __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ - __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ -} MPU_Type; - -/* MPU Type Register Definitions */ -#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ -#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ - -#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ -#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ - -#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ -#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ - -/* MPU Control Register Definitions */ -#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ -#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ - -#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ -#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ - -#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ -#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ - -/* MPU Region Number Register Definitions */ -#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ -#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ - -/* MPU Region Base Address Register Definitions */ -#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ -#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ - -#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ -#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ - -#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ -#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ - -/* MPU Region Attribute and Size Register Definitions */ -#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ -#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ - -#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ -#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ - -#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ -#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ - -#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ -#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ - -#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ -#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ - -#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ -#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ - -#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ -#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ - -#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ -#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ - -#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ -#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ - -#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ -#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ - -/*@} end of group CMSIS_MPU */ -#endif - - -#if (__FPU_PRESENT == 1U) -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_FPU Floating Point Unit (FPU) - \brief Type definitions for the Floating Point Unit (FPU) - @{ - */ - -/** - \brief Structure type to access the Floating Point Unit (FPU). - */ -typedef struct -{ - uint32_t RESERVED0[1U]; - __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ - __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ - __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ - __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ - __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ - __IM uint32_t MVFR2; /*!< Offset: 0x018 (R/ ) Media and FP Feature Register 2 */ -} FPU_Type; - -/* Floating-Point Context Control Register Definitions */ -#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ -#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ - -#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ -#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ - -#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ -#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ - -#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ -#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ - -#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ -#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ - -#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ -#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ - -#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ -#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ - -#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ -#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ - -#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ -#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ - -/* Floating-Point Context Address Register Definitions */ -#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ -#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ - -/* Floating-Point Default Status Control Register Definitions */ -#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ -#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ - -#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ -#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ - -#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ -#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ - -#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ -#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ - -/* Media and FP Feature Register 0 Definitions */ -#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ -#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ - -#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ -#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ - -#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ -#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ - -#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ -#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ - -#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ -#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ - -#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ -#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ - -#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ -#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ - -#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ -#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ - -/* Media and FP Feature Register 1 Definitions */ -#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ -#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ - -#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ -#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ - -#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ -#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ - -#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ -#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ - -/* Media and FP Feature Register 2 Definitions */ - -/*@} end of group CMSIS_FPU */ -#endif - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) - \brief Type definitions for the Core Debug Registers - @{ - */ - -/** - \brief Structure type to access the Core Debug Register (CoreDebug). - */ -typedef struct -{ - __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ - __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ - __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ - __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ -} CoreDebug_Type; - -/* Debug Halting Control and Status Register Definitions */ -#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ -#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ - -#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ -#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ - -#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ -#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ - -#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ -#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ - -#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ -#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ - -#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ -#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ - -#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ -#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ - -#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ -#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ - -#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ -#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ - -#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ -#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ - -#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ -#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ - -#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ -#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ - -/* Debug Core Register Selector Register Definitions */ -#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ -#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ - -#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ -#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ - -/* Debug Exception and Monitor Control Register Definitions */ -#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ -#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ - -#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ -#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ - -#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ -#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ - -#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ -#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ - -#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ -#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ - -#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ -#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ - -#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ -#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ - -#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ -#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ - -#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ -#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ - -#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ -#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ - -#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ -#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ - -#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ -#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ - -#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ -#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ - -/*@} end of group CMSIS_CoreDebug */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_bitfield Core register bit field macros - \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). - @{ - */ - -/** - \brief Mask and shift a bit field value for use in a register bit range. - \param[in] field Name of the register bit field. - \param[in] value Value of the bit field. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk) - -/** - \brief Mask and shift a register value to extract a bit filed value. - \param[in] field Name of the register bit field. - \param[in] value Value of register. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos) - -/*@} end of group CMSIS_core_bitfield */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_base Core Definitions - \brief Definitions for base addresses, unions, and structures. - @{ - */ - -/* Memory mapping of Cortex-M4 Hardware */ -#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ -#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ -#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ -#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ -#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ -#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ -#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ -#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ - -#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ -#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ -#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ -#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ -#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ -#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ -#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ -#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ - -#if (__MPU_PRESENT == 1U) - #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ - #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ -#endif - -#if (__FPU_PRESENT == 1U) - #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ - #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ -#endif - -/*@} */ - - - -/******************************************************************************* - * Hardware Abstraction Layer - Core Function Interface contains: - - Core NVIC Functions - - Core SysTick Functions - - Core Debug Functions - - Core Register Access Functions - ******************************************************************************/ -/** - \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference -*/ - - - -/* ########################## NVIC functions #################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_NVICFunctions NVIC Functions - \brief Functions that manage interrupts and exceptions via the NVIC. - @{ - */ - -/** - \brief Set Priority Grouping - \details Sets the priority grouping field using the required unlock sequence. - The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. - Only values from 0..7 are used. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. - \param [in] PriorityGroup Priority grouping field. - */ -__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) -{ - uint32_t reg_value; - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - - reg_value = SCB->AIRCR; /* read old register configuration */ - reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ - reg_value = (reg_value | - ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */ - SCB->AIRCR = reg_value; -} - - -/** - \brief Get Priority Grouping - \details Reads the priority grouping field from the NVIC Interrupt Controller. - \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). - */ -__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void) -{ - return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); -} - - -/** - \brief Get External Interrupt Enable State - \details Returns whether a device-specific interrupt is enabled in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - \return 0 Interrupt is disabled. - \return 1 Interrupt is enabled. - */ -__STATIC_INLINE uint32_t NVIC_IsIRQEnabled(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Enable External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Active Interrupt - \details Reads the active register in NVIC and returns the active bit. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not active. - \return 1 Interrupt status is active. - */ -__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - SCB->SHPR[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); - } - else - { - NVIC->IP[((uint32_t)(int32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \param [in] IRQn Interrupt number. - \return Interrupt Priority. - Value is aligned automatically to the implemented priority bits of the microcontroller. - */ -__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) -{ - - if ((int32_t)(IRQn) < 0) - { - return(((uint32_t)SCB->SHPR[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); - } -} - - -/** - \brief Encode Priority - \details Encodes the priority for an interrupt with the given priority group, - preemptive priority value, and subpriority value. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. - \param [in] PriorityGroup Used priority group. - \param [in] PreemptPriority Preemptive priority value (starting from 0). - \param [in] SubPriority Subpriority value (starting from 0). - \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). - */ -__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) -{ - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - uint32_t PreemptPriorityBits; - uint32_t SubPriorityBits; - - PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); - SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); - - return ( - ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | - ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) - ); -} - - -/** - \brief Decode Priority - \details Decodes an interrupt priority value with a given priority group to - preemptive priority value and subpriority value. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. - \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). - \param [in] PriorityGroup Used priority group. - \param [out] pPreemptPriority Preemptive priority value (starting from 0). - \param [out] pSubPriority Subpriority value (starting from 0). - */ -__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) -{ - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - uint32_t PreemptPriorityBits; - uint32_t SubPriorityBits; - - PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); - SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); - - *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); - *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); -} - - -/** - \brief System Reset - \details Initiates a system reset request to reset the MCU. - */ -__STATIC_INLINE void NVIC_SystemReset(void) -{ - __DSB(); /* Ensure all outstanding memory accesses included - buffered write are completed before reset */ - SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | - SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ - __DSB(); /* Ensure completion of memory access */ - - for(;;) /* wait until reset */ - { - __NOP(); - } -} - -/*@} end of CMSIS_Core_NVICFunctions */ - - -/* ########################## FPU functions #################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_FpuFunctions FPU Functions - \brief Function that provides FPU type. - @{ - */ - -/** - \brief get FPU type - \details returns the FPU type - \returns - - \b 0: No FPU - - \b 1: Single precision FPU - - \b 2: Double + Single precision FPU - */ -__STATIC_INLINE uint32_t SCB_GetFPUType(void) -{ - uint32_t mvfr0; - - mvfr0 = SCB->MVFR0; - if ((mvfr0 & 0x00000FF0UL) == 0x220UL) - { - return 2UL; /* Double + Single precision FPU */ - } - else if ((mvfr0 & 0x00000FF0UL) == 0x020UL) - { - return 1UL; /* Single precision FPU */ - } - else - { - return 0UL; /* No FPU */ - } -} - - -/*@} end of CMSIS_Core_FpuFunctions */ - - - -/* ########################## Cache functions #################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_CacheFunctions Cache Functions - \brief Functions that configure Instruction and Data cache. - @{ - */ - -/* Cache Size ID Register Macros */ -#define CCSIDR_WAYS(x) (((x) & SCB_CCSIDR_ASSOCIATIVITY_Msk) >> SCB_CCSIDR_ASSOCIATIVITY_Pos) -#define CCSIDR_SETS(x) (((x) & SCB_CCSIDR_NUMSETS_Msk ) >> SCB_CCSIDR_NUMSETS_Pos ) - - -/** - \brief Enable I-Cache - \details Turns on I-Cache - */ -__STATIC_INLINE void SCB_EnableICache (void) -{ - #if (__ICACHE_PRESENT == 1U) - __DSB(); - __ISB(); - SCB->ICIALLU = 0UL; /* invalidate I-Cache */ - SCB->CCR |= (uint32_t)SCB_CCR_IC_Msk; /* enable I-Cache */ - __DSB(); - __ISB(); - #endif -} - - -/** - \brief Disable I-Cache - \details Turns off I-Cache - */ -__STATIC_INLINE void SCB_DisableICache (void) -{ - #if (__ICACHE_PRESENT == 1U) - __DSB(); - __ISB(); - SCB->CCR &= ~(uint32_t)SCB_CCR_IC_Msk; /* disable I-Cache */ - SCB->ICIALLU = 0UL; /* invalidate I-Cache */ - __DSB(); - __ISB(); - #endif -} - - -/** - \brief Invalidate I-Cache - \details Invalidates I-Cache - */ -__STATIC_INLINE void SCB_InvalidateICache (void) -{ - #if (__ICACHE_PRESENT == 1U) - __DSB(); - __ISB(); - SCB->ICIALLU = 0UL; - __DSB(); - __ISB(); - #endif -} - - -/** - \brief Enable D-Cache - \details Turns on D-Cache - */ -__STATIC_INLINE void SCB_EnableDCache (void) -{ - #if (__DCACHE_PRESENT == 1U) - uint32_t ccsidr; - uint32_t sets; - uint32_t ways; - - SCB->CSSELR = (0U << 1U) | 0U; /* Level 1 data cache */ - __DSB(); - - ccsidr = SCB->CCSIDR; - - /* invalidate D-Cache */ - sets = (uint32_t)(CCSIDR_SETS(ccsidr)); - do { - ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); - do { - SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) | - ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) ); - #if defined ( __CC_ARM ) - __schedule_barrier(); - #endif - } while (ways--); - } while(sets--); - __DSB(); - - SCB->CCR |= (uint32_t)SCB_CCR_DC_Msk; /* enable D-Cache */ - - __DSB(); - __ISB(); - #endif -} - - -/** - \brief Disable D-Cache - \details Turns off D-Cache - */ -__STATIC_INLINE void SCB_DisableDCache (void) -{ - #if (__DCACHE_PRESENT == 1U) - uint32_t ccsidr; - uint32_t sets; - uint32_t ways; - - SCB->CSSELR = (0U << 1U) | 0U; /* Level 1 data cache */ - __DSB(); - - ccsidr = SCB->CCSIDR; - - SCB->CCR &= ~(uint32_t)SCB_CCR_DC_Msk; /* disable D-Cache */ - - /* clean & invalidate D-Cache */ - sets = (uint32_t)(CCSIDR_SETS(ccsidr)); - do { - ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); - do { - SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) | - ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) ); - #if defined ( __CC_ARM ) - __schedule_barrier(); - #endif - } while (ways--); - } while(sets--); - - __DSB(); - __ISB(); - #endif -} - - -/** - \brief Invalidate D-Cache - \details Invalidates D-Cache - */ -__STATIC_INLINE void SCB_InvalidateDCache (void) -{ - #if (__DCACHE_PRESENT == 1U) - uint32_t ccsidr; - uint32_t sets; - uint32_t ways; - - SCB->CSSELR = (0U << 1U) | 0U; /* Level 1 data cache */ - __DSB(); - - ccsidr = SCB->CCSIDR; - - /* invalidate D-Cache */ - sets = (uint32_t)(CCSIDR_SETS(ccsidr)); - do { - ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); - do { - SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) | - ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) ); - #if defined ( __CC_ARM ) - __schedule_barrier(); - #endif - } while (ways--); - } while(sets--); - - __DSB(); - __ISB(); - #endif -} - - -/** - \brief Clean D-Cache - \details Cleans D-Cache - */ -__STATIC_INLINE void SCB_CleanDCache (void) -{ - #if (__DCACHE_PRESENT == 1U) - uint32_t ccsidr; - uint32_t sets; - uint32_t ways; - - SCB->CSSELR = (0U << 1U) | 0U; /* Level 1 data cache */ - __DSB(); - - ccsidr = SCB->CCSIDR; - - /* clean D-Cache */ - sets = (uint32_t)(CCSIDR_SETS(ccsidr)); - do { - ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); - do { - SCB->DCCSW = (((sets << SCB_DCCSW_SET_Pos) & SCB_DCCSW_SET_Msk) | - ((ways << SCB_DCCSW_WAY_Pos) & SCB_DCCSW_WAY_Msk) ); - #if defined ( __CC_ARM ) - __schedule_barrier(); - #endif - } while (ways--); - } while(sets--); - - __DSB(); - __ISB(); - #endif -} - - -/** - \brief Clean & Invalidate D-Cache - \details Cleans and Invalidates D-Cache - */ -__STATIC_INLINE void SCB_CleanInvalidateDCache (void) -{ - #if (__DCACHE_PRESENT == 1U) - uint32_t ccsidr; - uint32_t sets; - uint32_t ways; - - SCB->CSSELR = (0U << 1U) | 0U; /* Level 1 data cache */ - __DSB(); - - ccsidr = SCB->CCSIDR; - - /* clean & invalidate D-Cache */ - sets = (uint32_t)(CCSIDR_SETS(ccsidr)); - do { - ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); - do { - SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) | - ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) ); - #if defined ( __CC_ARM ) - __schedule_barrier(); - #endif - } while (ways--); - } while(sets--); - - __DSB(); - __ISB(); - #endif -} - - -/** - \brief D-Cache Invalidate by address - \details Invalidates D-Cache for the given address - \param[in] addr address (aligned to 32-byte boundary) - \param[in] dsize size of memory block (in number of bytes) -*/ -__STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize) -{ - #if (__DCACHE_PRESENT == 1U) - int32_t op_size = dsize; - uint32_t op_addr = (uint32_t)addr; - int32_t linesize = 32U; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ - - __DSB(); - - while (op_size > 0) { - SCB->DCIMVAC = op_addr; - op_addr += linesize; - op_size -= linesize; - } - - __DSB(); - __ISB(); - #endif -} - - -/** - \brief D-Cache Clean by address - \details Cleans D-Cache for the given address - \param[in] addr address (aligned to 32-byte boundary) - \param[in] dsize size of memory block (in number of bytes) -*/ -__STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize) -{ - #if (__DCACHE_PRESENT == 1) - int32_t op_size = dsize; - uint32_t op_addr = (uint32_t) addr; - int32_t linesize = 32U; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ - - __DSB(); - - while (op_size > 0) { - SCB->DCCMVAC = op_addr; - op_addr += linesize; - op_size -= linesize; - } - - __DSB(); - __ISB(); - #endif -} - - -/** - \brief D-Cache Clean and Invalidate by address - \details Cleans and invalidates D_Cache for the given address - \param[in] addr address (aligned to 32-byte boundary) - \param[in] dsize size of memory block (in number of bytes) -*/ -__STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize) -{ - #if (__DCACHE_PRESENT == 1U) - int32_t op_size = dsize; - uint32_t op_addr = (uint32_t) addr; - int32_t linesize = 32U; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ - - __DSB(); - - while (op_size > 0) { - SCB->DCCIMVAC = op_addr; - op_addr += linesize; - op_size -= linesize; - } - - __DSB(); - __ISB(); - #endif -} - - -/*@} end of CMSIS_Core_CacheFunctions */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__Vendor_SysTickConfig == 0U) - -/** - \brief System Tick Configuration - \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. - Counter is in free running mode to generate periodic interrupts. - \param [in] ticks Number of ticks between two interrupts. - \return 0 Function succeeded. - \return 1 Function failed. - \note When the variable __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - must contain a vendor-specific implementation of this function. - */ -__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) -{ - if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) - { - return (1UL); /* Reload value impossible */ - } - - SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ - NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ - SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ - SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | - SysTick_CTRL_TICKINT_Msk | - SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ - return (0UL); /* Function successful */ -} - -#endif - -/*@} end of CMSIS_Core_SysTickFunctions */ - - - -/* ##################################### Debug In/Output function ########################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_core_DebugFunctions ITM Functions - \brief Functions that access the ITM debug interface. - @{ - */ - -extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ -#define ITM_RXBUFFER_EMPTY 0x5AA55AA5U /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ - - -/** - \brief ITM Send Character - \details Transmits a character via the ITM channel 0, and - \li Just returns when no debugger is connected that has booked the output. - \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. - \param [in] ch Character to transmit. - \returns Character to transmit. - */ -__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) -{ - if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ - ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ - { - while (ITM->PORT[0U].u32 == 0UL) - { - __NOP(); - } - ITM->PORT[0U].u8 = (uint8_t)ch; - } - return (ch); -} - - -/** - \brief ITM Receive Character - \details Inputs a character via the external variable \ref ITM_RxBuffer. - \return Received character. - \return -1 No character pending. - */ -__STATIC_INLINE int32_t ITM_ReceiveChar (void) -{ - int32_t ch = -1; /* no character available */ - - if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) - { - ch = ITM_RxBuffer; - ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ - } - - return (ch); -} - - -/** - \brief ITM Check Character - \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. - \return 0 No character available. - \return 1 Character available. - */ -__STATIC_INLINE int32_t ITM_CheckChar (void) -{ - - if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) - { - return (0); /* no character available */ - } - else - { - return (1); /* character available */ - } -} - -/*@} end of CMSIS_core_DebugFunctions */ - - - - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CM7_H_DEPENDANT */ - -#endif /* __CMSIS_GENERIC */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/core_cmFunc.h b/arch/cpu/arm/cortex-m/CMSIS/core_cmFunc.h deleted file mode 100644 index 652a48af0..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/core_cmFunc.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************//** - * @file core_cmFunc.h - * @brief CMSIS Cortex-M Core Function Access Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CMFUNC_H -#define __CORE_CMFUNC_H - - -/* ########################### Core Function Access ########################### */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions - @{ -*/ - -/*------------------ RealView Compiler -----------------*/ -#if defined ( __CC_ARM ) - #include "cmsis_armcc.h" - -/*------------------ ARM Compiler V6 -------------------*/ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #include "cmsis_armcc_V6.h" - -/*------------------ GNU Compiler ----------------------*/ -#elif defined ( __GNUC__ ) - #include "cmsis_gcc.h" - -/*------------------ ICC Compiler ----------------------*/ -#elif defined ( __ICCARM__ ) - #include - -/*------------------ TI CCS Compiler -------------------*/ -#elif defined ( __TMS470__ ) - #include - -/*------------------ TASKING Compiler ------------------*/ -#elif defined ( __TASKING__ ) - /* - * The CMSIS functions have been implemented as intrinsics in the compiler. - * Please use "carm -?i" to get an up to date list of all intrinsics, - * Including the CMSIS ones. - */ - -/*------------------ COSMIC Compiler -------------------*/ -#elif defined ( __CSMC__ ) - #include - -#endif - -/*@} end of CMSIS_Core_RegAccFunctions */ - -#endif /* __CORE_CMFUNC_H */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/core_cmInstr.h b/arch/cpu/arm/cortex-m/CMSIS/core_cmInstr.h deleted file mode 100644 index f474b0e6f..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/core_cmInstr.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************//** - * @file core_cmInstr.h - * @brief CMSIS Cortex-M Core Instruction Access Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CMINSTR_H -#define __CORE_CMINSTR_H - - -/* ########################## Core Instruction Access ######################### */ -/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface - Access to dedicated instructions - @{ -*/ - -/*------------------ RealView Compiler -----------------*/ -#if defined ( __CC_ARM ) - #include "cmsis_armcc.h" - -/*------------------ ARM Compiler V6 -------------------*/ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #include "cmsis_armcc_V6.h" - -/*------------------ GNU Compiler ----------------------*/ -#elif defined ( __GNUC__ ) - #include "cmsis_gcc.h" - -/*------------------ ICC Compiler ----------------------*/ -#elif defined ( __ICCARM__ ) - #include - -/*------------------ TI CCS Compiler -------------------*/ -#elif defined ( __TMS470__ ) - #include - -/*------------------ TASKING Compiler ------------------*/ -#elif defined ( __TASKING__ ) - /* - * The CMSIS functions have been implemented as intrinsics in the compiler. - * Please use "carm -?i" to get an up to date list of all intrinsics, - * Including the CMSIS ones. - */ - -/*------------------ COSMIC Compiler -------------------*/ -#elif defined ( __CSMC__ ) - #include - -#endif - -/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ - -#endif /* __CORE_CMINSTR_H */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/core_cmSimd.h b/arch/cpu/arm/cortex-m/CMSIS/core_cmSimd.h deleted file mode 100644 index 66bf5c2a7..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/core_cmSimd.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************//** - * @file core_cmSimd.h - * @brief CMSIS Cortex-M SIMD Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CMSIMD_H -#define __CORE_CMSIMD_H - -#ifdef __cplusplus - extern "C" { -#endif - - -/* ################### Compiler specific Intrinsics ########################### */ -/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics - Access to dedicated SIMD instructions - @{ -*/ - -/*------------------ RealView Compiler -----------------*/ -#if defined ( __CC_ARM ) - #include "cmsis_armcc.h" - -/*------------------ ARM Compiler V6 -------------------*/ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #include "cmsis_armcc_V6.h" - -/*------------------ GNU Compiler ----------------------*/ -#elif defined ( __GNUC__ ) - #include "cmsis_gcc.h" - -/*------------------ ICC Compiler ----------------------*/ -#elif defined ( __ICCARM__ ) - #include - -/*------------------ TI CCS Compiler -------------------*/ -#elif defined ( __TMS470__ ) - #include - -/*------------------ TASKING Compiler ------------------*/ -#elif defined ( __TASKING__ ) - /* - * The CMSIS functions have been implemented as intrinsics in the compiler. - * Please use "carm -?i" to get an up to date list of all intrinsics, - * Including the CMSIS ones. - */ - -/*------------------ COSMIC Compiler -------------------*/ -#elif defined ( __CSMC__ ) - #include - -#endif - -/*@} end of group CMSIS_SIMD_intrinsics */ - - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CMSIMD_H */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/core_sc000.h b/arch/cpu/arm/cortex-m/CMSIS/core_sc000.h deleted file mode 100644 index 7604ba198..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/core_sc000.h +++ /dev/null @@ -1,926 +0,0 @@ -/**************************************************************************//** - * @file core_sc000.h - * @brief CMSIS SC000 Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_SC000_H_GENERIC -#define __CORE_SC000_H_GENERIC - -#include - -#ifdef __cplusplus - extern "C" { -#endif - -/** - CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions - CMSIS violates the following MISRA-C:2004 rules: - - \li Required Rule 8.5, object/function definition in header file.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup SC000 - @{ - */ - -/* CMSIS SC000 definitions */ -#define __SC000_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __SC000_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \ - __SC000_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_SC (000U) /*!< Cortex secure core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __FPU_USED indicates whether an FPU is used or not. - This core does not support an FPU at all -*/ -#define __FPU_USED 0U - -#if defined ( __CC_ARM ) - #if defined __TARGET_FPU_VFP - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #if defined __ARM_PCS_VFP - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __GNUC__ ) - #if defined (__VFP_FP__) && !defined(__SOFTFP__) - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __ICCARM__ ) - #if defined __ARMVFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TMS470__ ) - #if defined __TI_VFP_SUPPORT__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TASKING__ ) - #if defined __FPU_VFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __CSMC__ ) - #if ( __CSMC__ & 0x400U) - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#endif - -#include "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_SC000_H_GENERIC */ - -#ifndef __CMSIS_GENERIC - -#ifndef __CORE_SC000_H_DEPENDANT -#define __CORE_SC000_H_DEPENDANT - -#ifdef __cplusplus - extern "C" { -#endif - -/* check device defines and use defaults */ -#if defined __CHECK_DEVICE_DEFINES - #ifndef __SC000_REV - #define __SC000_REV 0x0000U - #warning "__SC000_REV not defined in device header file; using default!" - #endif - - #ifndef __MPU_PRESENT - #define __MPU_PRESENT 0U - #warning "__MPU_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __NVIC_PRIO_BITS - #define __NVIC_PRIO_BITS 2U - #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" - #endif - - #ifndef __Vendor_SysTickConfig - #define __Vendor_SysTickConfig 0U - #warning "__Vendor_SysTickConfig not defined in device header file; using default!" - #endif -#endif - -/* IO definitions (access restrictions to peripheral registers) */ -/** - \defgroup CMSIS_glob_defs CMSIS Global Defines - - IO Type Qualifiers are used - \li to specify the access to peripheral variables. - \li for automatic generation of peripheral register debug information. -*/ -#ifdef __cplusplus - #define __I volatile /*!< Defines 'read only' permissions */ -#else - #define __I volatile const /*!< Defines 'read only' permissions */ -#endif -#define __O volatile /*!< Defines 'write only' permissions */ -#define __IO volatile /*!< Defines 'read / write' permissions */ - -/* following defines should be used for structure members */ -#define __IM volatile const /*! Defines 'read only' structure member permissions */ -#define __OM volatile /*! Defines 'write only' structure member permissions */ -#define __IOM volatile /*! Defines 'read / write' structure member permissions */ - -/*@} end of group SC000 */ - - - -/******************************************************************************* - * Register Abstraction - Core Register contain: - - Core Register - - Core NVIC Register - - Core SCB Register - - Core SysTick Register - - Core MPU Register - ******************************************************************************/ -/** - \defgroup CMSIS_core_register Defines and Type Definitions - \brief Type definitions and defines for Cortex-M processor based devices. -*/ - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CORE Status and Control Registers - \brief Core Register type definitions. - @{ - */ - -/** - \brief Union type to access the Application Program Status Register (APSR). - */ -typedef union -{ - struct - { - uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} APSR_Type; - -/* APSR Register Definitions */ -#define APSR_N_Pos 31U /*!< APSR: N Position */ -#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ - -#define APSR_Z_Pos 30U /*!< APSR: Z Position */ -#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ - -#define APSR_C_Pos 29U /*!< APSR: C Position */ -#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ - -#define APSR_V_Pos 28U /*!< APSR: V Position */ -#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ - - -/** - \brief Union type to access the Interrupt Program Status Register (IPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} IPSR_Type; - -/* IPSR Register Definitions */ -#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ -#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ - - -/** - \brief Union type to access the Special-Purpose Program Status Registers (xPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ - uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ - uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} xPSR_Type; - -/* xPSR Register Definitions */ -#define xPSR_N_Pos 31U /*!< xPSR: N Position */ -#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ - -#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ -#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ - -#define xPSR_C_Pos 29U /*!< xPSR: C Position */ -#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ - -#define xPSR_V_Pos 28U /*!< xPSR: V Position */ -#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ - -#define xPSR_T_Pos 24U /*!< xPSR: T Position */ -#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ - -#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ -#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ - - -/** - \brief Union type to access the Control Registers (CONTROL). - */ -typedef union -{ - struct - { - uint32_t _reserved0:1; /*!< bit: 0 Reserved */ - uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ - uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} CONTROL_Type; - -/* CONTROL Register Definitions */ -#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ -#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ - -/*@} end of group CMSIS_CORE */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) - \brief Type definitions for the NVIC Registers - @{ - */ - -/** - \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). - */ -typedef struct -{ - __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ - uint32_t RESERVED0[31U]; - __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ - uint32_t RSERVED1[31U]; - __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ - uint32_t RESERVED2[31U]; - __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ - uint32_t RESERVED3[31U]; - uint32_t RESERVED4[64U]; - __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ -} NVIC_Type; - -/*@} end of group CMSIS_NVIC */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCB System Control Block (SCB) - \brief Type definitions for the System Control Block Registers - @{ - */ - -/** - \brief Structure type to access the System Control Block (SCB). - */ -typedef struct -{ - __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ - __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ - __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ - __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ - __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ - __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ - uint32_t RESERVED0[1U]; - __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ - __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ - uint32_t RESERVED1[154U]; - __IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */ -} SCB_Type; - -/* SCB CPUID Register Definitions */ -#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ -#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ - -#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ -#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ - -#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ -#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ - -#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ -#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ - -#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ -#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ - -/* SCB Interrupt Control State Register Definitions */ -#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ -#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ - -#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ -#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ - -#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ -#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ - -#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ -#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ - -#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ -#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ - -#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ -#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ - -#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ -#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ - -#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ -#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ - -#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ -#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ - -/* SCB Interrupt Control State Register Definitions */ -#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ -#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ - -/* SCB Application Interrupt and Reset Control Register Definitions */ -#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ -#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ - -#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ -#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ - -#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ -#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ - -#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ -#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ - -#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ -#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ - -/* SCB System Control Register Definitions */ -#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ -#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ - -#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ -#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ - -#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ -#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ - -/* SCB Configuration Control Register Definitions */ -#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ -#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ - -#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ -#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ - -/* SCB System Handler Control and State Register Definitions */ -#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ -#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ - -/*@} end of group CMSIS_SCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) - \brief Type definitions for the System Control and ID Register not in the SCB - @{ - */ - -/** - \brief Structure type to access the System Control and ID Register not in the SCB. - */ -typedef struct -{ - uint32_t RESERVED0[2U]; - __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ -} SCnSCB_Type; - -/* Auxiliary Control Register Definitions */ -#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ -#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ - -/*@} end of group CMSIS_SCnotSCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SysTick System Tick Timer (SysTick) - \brief Type definitions for the System Timer Registers. - @{ - */ - -/** - \brief Structure type to access the System Timer (SysTick). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ - __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ - __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ - __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ -} SysTick_Type; - -/* SysTick Control / Status Register Definitions */ -#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ -#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ - -#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ -#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ - -#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ -#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ - -#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ -#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ - -/* SysTick Reload Register Definitions */ -#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ -#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ - -/* SysTick Current Register Definitions */ -#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ -#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ - -/* SysTick Calibration Register Definitions */ -#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ -#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ - -#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ -#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ - -#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ -#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ - -/*@} end of group CMSIS_SysTick */ - -#if (__MPU_PRESENT == 1U) -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_MPU Memory Protection Unit (MPU) - \brief Type definitions for the Memory Protection Unit (MPU) - @{ - */ - -/** - \brief Structure type to access the Memory Protection Unit (MPU). - */ -typedef struct -{ - __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ - __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ - __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ - __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ - __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ -} MPU_Type; - -/* MPU Type Register Definitions */ -#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ -#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ - -#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ -#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ - -#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ -#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ - -/* MPU Control Register Definitions */ -#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ -#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ - -#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ -#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ - -#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ -#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ - -/* MPU Region Number Register Definitions */ -#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ -#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ - -/* MPU Region Base Address Register Definitions */ -#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */ -#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ - -#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ -#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ - -#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ -#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ - -/* MPU Region Attribute and Size Register Definitions */ -#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ -#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ - -#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ -#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ - -#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ -#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ - -#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ -#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ - -#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ -#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ - -#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ -#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ - -#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ -#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ - -#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ -#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ - -#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ -#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ - -#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ -#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ - -/*@} end of group CMSIS_MPU */ -#endif - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) - \brief SC000 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. - Therefore they are not covered by the SC000 header file. - @{ - */ -/*@} end of group CMSIS_CoreDebug */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_bitfield Core register bit field macros - \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). - @{ - */ - -/** - \brief Mask and shift a bit field value for use in a register bit range. - \param[in] field Name of the register bit field. - \param[in] value Value of the bit field. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk) - -/** - \brief Mask and shift a register value to extract a bit filed value. - \param[in] field Name of the register bit field. - \param[in] value Value of register. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos) - -/*@} end of group CMSIS_core_bitfield */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_base Core Definitions - \brief Definitions for base addresses, unions, and structures. - @{ - */ - -/* Memory mapping of SC000 Hardware */ -#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ -#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ -#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ -#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ - -#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ -#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ -#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ -#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ - -#if (__MPU_PRESENT == 1U) - #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ - #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ -#endif - -/*@} */ - - - -/******************************************************************************* - * Hardware Abstraction Layer - Core Function Interface contains: - - Core NVIC Functions - - Core SysTick Functions - - Core Register Access Functions - ******************************************************************************/ -/** - \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference -*/ - - - -/* ########################## NVIC functions #################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_NVICFunctions NVIC Functions - \brief Functions that manage interrupts and exceptions via the NVIC. - @{ - */ - -/* Interrupt Priorities are WORD accessible only under ARMv6M */ -/* The following MACROS handle generation of the register offset and byte masks */ -#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) -#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) -#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) - - -/** - \brief Enable External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | - (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); - } - else - { - NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | - (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \param [in] IRQn Interrupt number. - \return Interrupt Priority. - Value is aligned automatically to the implemented priority bits of the microcontroller. - */ -__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) -{ - - if ((int32_t)(IRQn) < 0) - { - return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } -} - - -/** - \brief System Reset - \details Initiates a system reset request to reset the MCU. - */ -__STATIC_INLINE void NVIC_SystemReset(void) -{ - __DSB(); /* Ensure all outstanding memory accesses included - buffered write are completed before reset */ - SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - SCB_AIRCR_SYSRESETREQ_Msk); - __DSB(); /* Ensure completion of memory access */ - - for(;;) /* wait until reset */ - { - __NOP(); - } -} - -/*@} end of CMSIS_Core_NVICFunctions */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__Vendor_SysTickConfig == 0U) - -/** - \brief System Tick Configuration - \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. - Counter is in free running mode to generate periodic interrupts. - \param [in] ticks Number of ticks between two interrupts. - \return 0 Function succeeded. - \return 1 Function failed. - \note When the variable __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - must contain a vendor-specific implementation of this function. - */ -__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) -{ - if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) - { - return (1UL); /* Reload value impossible */ - } - - SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ - NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ - SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ - SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | - SysTick_CTRL_TICKINT_Msk | - SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ - return (0UL); /* Function successful */ -} - -#endif - -/*@} end of CMSIS_Core_SysTickFunctions */ - - - - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_SC000_H_DEPENDANT */ - -#endif /* __CMSIS_GENERIC */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/core_sc300.h b/arch/cpu/arm/cortex-m/CMSIS/core_sc300.h deleted file mode 100644 index 52886c653..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/core_sc300.h +++ /dev/null @@ -1,1745 +0,0 @@ -/**************************************************************************//** - * @file core_sc300.h - * @brief CMSIS SC300 Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 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. - - Neither the name of ARM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_SC300_H_GENERIC -#define __CORE_SC300_H_GENERIC - -#include - -#ifdef __cplusplus - extern "C" { -#endif - -/** - CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions - CMSIS violates the following MISRA-C:2004 rules: - - \li Required Rule 8.5, object/function definition in header file.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup SC3000 - @{ - */ - -/* CMSIS SC300 definitions */ -#define __SC300_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __SC300_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __SC300_CMSIS_VERSION ((__SC300_CMSIS_VERSION_MAIN << 16U) | \ - __SC300_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_SC (300U) /*!< Cortex secure core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __FPU_USED indicates whether an FPU is used or not. - This core does not support an FPU at all -*/ -#define __FPU_USED 0U - -#if defined ( __CC_ARM ) - #if defined __TARGET_FPU_VFP - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #if defined __ARM_PCS_VFP - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __GNUC__ ) - #if defined (__VFP_FP__) && !defined(__SOFTFP__) - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __ICCARM__ ) - #if defined __ARMVFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TMS470__ ) - #if defined __TI_VFP_SUPPORT__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TASKING__ ) - #if defined __FPU_VFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __CSMC__ ) - #if ( __CSMC__ & 0x400U) - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#endif - -#include "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_SC300_H_GENERIC */ - -#ifndef __CMSIS_GENERIC - -#ifndef __CORE_SC300_H_DEPENDANT -#define __CORE_SC300_H_DEPENDANT - -#ifdef __cplusplus - extern "C" { -#endif - -/* check device defines and use defaults */ -#if defined __CHECK_DEVICE_DEFINES - #ifndef __SC300_REV - #define __SC300_REV 0x0000U - #warning "__SC300_REV not defined in device header file; using default!" - #endif - - #ifndef __MPU_PRESENT - #define __MPU_PRESENT 0U - #warning "__MPU_PRESENT not defined in device header file; using default!" - #endif - - #ifndef __NVIC_PRIO_BITS - #define __NVIC_PRIO_BITS 4U - #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" - #endif - - #ifndef __Vendor_SysTickConfig - #define __Vendor_SysTickConfig 0U - #warning "__Vendor_SysTickConfig not defined in device header file; using default!" - #endif -#endif - -/* IO definitions (access restrictions to peripheral registers) */ -/** - \defgroup CMSIS_glob_defs CMSIS Global Defines - - IO Type Qualifiers are used - \li to specify the access to peripheral variables. - \li for automatic generation of peripheral register debug information. -*/ -#ifdef __cplusplus - #define __I volatile /*!< Defines 'read only' permissions */ -#else - #define __I volatile const /*!< Defines 'read only' permissions */ -#endif -#define __O volatile /*!< Defines 'write only' permissions */ -#define __IO volatile /*!< Defines 'read / write' permissions */ - -/* following defines should be used for structure members */ -#define __IM volatile const /*! Defines 'read only' structure member permissions */ -#define __OM volatile /*! Defines 'write only' structure member permissions */ -#define __IOM volatile /*! Defines 'read / write' structure member permissions */ - -/*@} end of group SC300 */ - - - -/******************************************************************************* - * Register Abstraction - Core Register contain: - - Core Register - - Core NVIC Register - - Core SCB Register - - Core SysTick Register - - Core Debug Register - - Core MPU Register - ******************************************************************************/ -/** - \defgroup CMSIS_core_register Defines and Type Definitions - \brief Type definitions and defines for Cortex-M processor based devices. -*/ - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CORE Status and Control Registers - \brief Core Register type definitions. - @{ - */ - -/** - \brief Union type to access the Application Program Status Register (APSR). - */ -typedef union -{ - struct - { - uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ - uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} APSR_Type; - -/* APSR Register Definitions */ -#define APSR_N_Pos 31U /*!< APSR: N Position */ -#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ - -#define APSR_Z_Pos 30U /*!< APSR: Z Position */ -#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ - -#define APSR_C_Pos 29U /*!< APSR: C Position */ -#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ - -#define APSR_V_Pos 28U /*!< APSR: V Position */ -#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ - -#define APSR_Q_Pos 27U /*!< APSR: Q Position */ -#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ - - -/** - \brief Union type to access the Interrupt Program Status Register (IPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} IPSR_Type; - -/* IPSR Register Definitions */ -#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ -#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ - - -/** - \brief Union type to access the Special-Purpose Program Status Registers (xPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ - uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ - uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ - uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} xPSR_Type; - -/* xPSR Register Definitions */ -#define xPSR_N_Pos 31U /*!< xPSR: N Position */ -#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ - -#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ -#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ - -#define xPSR_C_Pos 29U /*!< xPSR: C Position */ -#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ - -#define xPSR_V_Pos 28U /*!< xPSR: V Position */ -#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ - -#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ -#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ - -#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */ -#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */ - -#define xPSR_T_Pos 24U /*!< xPSR: T Position */ -#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ - -#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ -#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ - - -/** - \brief Union type to access the Control Registers (CONTROL). - */ -typedef union -{ - struct - { - uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ - uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ - uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} CONTROL_Type; - -/* CONTROL Register Definitions */ -#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ -#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ - -#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ -#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ - -/*@} end of group CMSIS_CORE */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) - \brief Type definitions for the NVIC Registers - @{ - */ - -/** - \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). - */ -typedef struct -{ - __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ - uint32_t RESERVED0[24U]; - __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ - uint32_t RSERVED1[24U]; - __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ - uint32_t RESERVED2[24U]; - __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ - uint32_t RESERVED3[24U]; - __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ - uint32_t RESERVED4[56U]; - __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ - uint32_t RESERVED5[644U]; - __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ -} NVIC_Type; - -/* Software Triggered Interrupt Register Definitions */ -#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ -#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ - -/*@} end of group CMSIS_NVIC */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCB System Control Block (SCB) - \brief Type definitions for the System Control Block Registers - @{ - */ - -/** - \brief Structure type to access the System Control Block (SCB). - */ -typedef struct -{ - __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ - __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ - __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ - __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ - __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ - __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ - __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ - __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ - __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ - __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ - __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ - __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ - __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ - __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ - __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ - __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ - __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ - __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ - __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ - uint32_t RESERVED0[5U]; - __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ - uint32_t RESERVED1[129U]; - __IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */ -} SCB_Type; - -/* SCB CPUID Register Definitions */ -#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ -#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ - -#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ -#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ - -#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ -#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ - -#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ -#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ - -#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ -#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ - -/* SCB Interrupt Control State Register Definitions */ -#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ -#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ - -#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ -#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ - -#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ -#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ - -#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ -#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ - -#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ -#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ - -#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ -#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ - -#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ -#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ - -#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ -#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ - -#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ -#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ - -#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ -#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ - -/* SCB Vector Table Offset Register Definitions */ -#define SCB_VTOR_TBLBASE_Pos 29U /*!< SCB VTOR: TBLBASE Position */ -#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */ - -#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ -#define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ - -/* SCB Application Interrupt and Reset Control Register Definitions */ -#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ -#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ - -#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ -#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ - -#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ -#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ - -#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ -#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ - -#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ -#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ - -#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ -#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ - -#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ -#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ - -/* SCB System Control Register Definitions */ -#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ -#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ - -#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ -#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ - -#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ -#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ - -/* SCB Configuration Control Register Definitions */ -#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ -#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ - -#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ -#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ - -#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ -#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ - -#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ -#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ - -#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ -#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ - -#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ -#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ - -/* SCB System Handler Control and State Register Definitions */ -#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ -#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ - -#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ -#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ - -#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ -#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ - -#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ -#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ - -#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ -#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ - -#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ -#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ - -#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ -#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ - -#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ -#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ - -#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ -#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ - -#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ -#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ - -#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ -#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ - -#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ -#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ - -#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ -#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ - -#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ -#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ - -/* SCB Configurable Fault Status Register Definitions */ -#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ -#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ - -#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ -#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ - -#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ -#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ - -/* SCB Hard Fault Status Register Definitions */ -#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ -#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ - -#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ -#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ - -#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ -#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ - -/* SCB Debug Fault Status Register Definitions */ -#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ -#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ - -#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ -#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ - -#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ -#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ - -#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ -#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ - -#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ -#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ - -/*@} end of group CMSIS_SCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) - \brief Type definitions for the System Control and ID Register not in the SCB - @{ - */ - -/** - \brief Structure type to access the System Control and ID Register not in the SCB. - */ -typedef struct -{ - uint32_t RESERVED0[1U]; - __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ - uint32_t RESERVED1[1U]; -} SCnSCB_Type; - -/* Interrupt Controller Type Register Definitions */ -#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ -#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ - -/*@} end of group CMSIS_SCnotSCB */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_SysTick System Tick Timer (SysTick) - \brief Type definitions for the System Timer Registers. - @{ - */ - -/** - \brief Structure type to access the System Timer (SysTick). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ - __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ - __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ - __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ -} SysTick_Type; - -/* SysTick Control / Status Register Definitions */ -#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ -#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ - -#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ -#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ - -#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ -#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ - -#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ -#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ - -/* SysTick Reload Register Definitions */ -#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ -#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ - -/* SysTick Current Register Definitions */ -#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ -#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ - -/* SysTick Calibration Register Definitions */ -#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ -#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ - -#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ -#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ - -#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ -#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ - -/*@} end of group CMSIS_SysTick */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) - \brief Type definitions for the Instrumentation Trace Macrocell (ITM) - @{ - */ - -/** - \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). - */ -typedef struct -{ - __OM union - { - __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ - __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ - __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ - } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ - uint32_t RESERVED0[864U]; - __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ - uint32_t RESERVED1[15U]; - __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ - uint32_t RESERVED2[15U]; - __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ - uint32_t RESERVED3[29U]; - __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ - __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ - __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ - uint32_t RESERVED4[43U]; - __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ - __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ - uint32_t RESERVED5[6U]; - __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ - __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ - __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ - __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ - __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ - __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ - __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ - __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ - __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ - __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ - __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ - __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ -} ITM_Type; - -/* ITM Trace Privilege Register Definitions */ -#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ -#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ - -/* ITM Trace Control Register Definitions */ -#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ -#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ - -#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ -#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ - -#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ -#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ - -#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ -#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ - -#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ -#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ - -#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ -#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ - -#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ -#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ - -#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ -#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ - -#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ -#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ - -/* ITM Integration Write Register Definitions */ -#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ -#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ - -/* ITM Integration Read Register Definitions */ -#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ -#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ - -/* ITM Integration Mode Control Register Definitions */ -#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ -#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ - -/* ITM Lock Status Register Definitions */ -#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ -#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ - -#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ -#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ - -#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ -#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ - -/*@}*/ /* end of group CMSIS_ITM */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) - \brief Type definitions for the Data Watchpoint and Trace (DWT) - @{ - */ - -/** - \brief Structure type to access the Data Watchpoint and Trace Register (DWT). - */ -typedef struct -{ - __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ - __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ - __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ - __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ - __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ - __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ - __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ - __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ - __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ - __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ - __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ - uint32_t RESERVED0[1U]; - __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ - __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ - __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ - uint32_t RESERVED1[1U]; - __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ - __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ - __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ - uint32_t RESERVED2[1U]; - __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ - __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ - __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ -} DWT_Type; - -/* DWT Control Register Definitions */ -#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ -#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ - -#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ -#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ - -#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ -#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ - -#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ -#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ - -#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ -#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ - -#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ -#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ - -#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ -#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ - -#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ -#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ - -#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ -#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ - -#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ -#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ - -#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ -#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ - -#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ -#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ - -#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ -#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ - -#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ -#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ - -#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ -#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ - -#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ -#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ - -#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ -#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ - -#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ -#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ - -/* DWT CPI Count Register Definitions */ -#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ -#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ - -/* DWT Exception Overhead Count Register Definitions */ -#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ -#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ - -/* DWT Sleep Count Register Definitions */ -#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ -#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ - -/* DWT LSU Count Register Definitions */ -#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ -#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ - -/* DWT Folded-instruction Count Register Definitions */ -#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ -#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ - -/* DWT Comparator Mask Register Definitions */ -#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ -#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ - -/* DWT Comparator Function Register Definitions */ -#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ -#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ - -#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ -#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ - -#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ -#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ - -#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ -#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ - -#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ -#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ - -#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ -#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ - -#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ -#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ - -#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ -#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ - -#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ -#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ - -/*@}*/ /* end of group CMSIS_DWT */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_TPI Trace Port Interface (TPI) - \brief Type definitions for the Trace Port Interface (TPI) - @{ - */ - -/** - \brief Structure type to access the Trace Port Interface Register (TPI). - */ -typedef struct -{ - __IOM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ - __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ - uint32_t RESERVED0[2U]; - __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ - uint32_t RESERVED1[55U]; - __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ - uint32_t RESERVED2[131U]; - __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ - __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ - __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ - uint32_t RESERVED3[759U]; - __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */ - __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ - __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ - uint32_t RESERVED4[1U]; - __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ - __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ - __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ - uint32_t RESERVED5[39U]; - __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ - __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ - uint32_t RESERVED7[8U]; - __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ - __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ -} TPI_Type; - -/* TPI Asynchronous Clock Prescaler Register Definitions */ -#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ -#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ - -/* TPI Selected Pin Protocol Register Definitions */ -#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ -#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ - -/* TPI Formatter and Flush Status Register Definitions */ -#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ -#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ - -#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ -#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ - -#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ -#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ - -#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ -#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ - -/* TPI Formatter and Flush Control Register Definitions */ -#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ -#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ - -#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ -#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ - -/* TPI TRIGGER Register Definitions */ -#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ -#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ - -/* TPI Integration ETM Data Register Definitions (FIFO0) */ -#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ -#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ - -#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ -#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ - -#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ -#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ - -#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ -#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ - -#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ -#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ - -#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ -#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ - -#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ -#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ - -/* TPI ITATBCTR2 Register Definitions */ -#define TPI_ITATBCTR2_ATREADY_Pos 0U /*!< TPI ITATBCTR2: ATREADY Position */ -#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */ - -/* TPI Integration ITM Data Register Definitions (FIFO1) */ -#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ -#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ - -#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ -#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ - -#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ -#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ - -#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ -#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ - -#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ -#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ - -#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ -#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ - -#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ -#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ - -/* TPI ITATBCTR0 Register Definitions */ -#define TPI_ITATBCTR0_ATREADY_Pos 0U /*!< TPI ITATBCTR0: ATREADY Position */ -#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */ - -/* TPI Integration Mode Control Register Definitions */ -#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ -#define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ - -/* TPI DEVID Register Definitions */ -#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ -#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ - -#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ -#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ - -#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ -#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ - -#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ -#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ - -#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ -#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ - -#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ -#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ - -/* TPI DEVTYPE Register Definitions */ -#define TPI_DEVTYPE_MajorType_Pos 4U /*!< TPI DEVTYPE: MajorType Position */ -#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ - -#define TPI_DEVTYPE_SubType_Pos 0U /*!< TPI DEVTYPE: SubType Position */ -#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ - -/*@}*/ /* end of group CMSIS_TPI */ - - -#if (__MPU_PRESENT == 1U) -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_MPU Memory Protection Unit (MPU) - \brief Type definitions for the Memory Protection Unit (MPU) - @{ - */ - -/** - \brief Structure type to access the Memory Protection Unit (MPU). - */ -typedef struct -{ - __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ - __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ - __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ - __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ - __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ - __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ - __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ - __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ - __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ - __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ - __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ -} MPU_Type; - -/* MPU Type Register Definitions */ -#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ -#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ - -#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ -#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ - -#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ -#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ - -/* MPU Control Register Definitions */ -#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ -#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ - -#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ -#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ - -#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ -#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ - -/* MPU Region Number Register Definitions */ -#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ -#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ - -/* MPU Region Base Address Register Definitions */ -#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ -#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ - -#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ -#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ - -#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ -#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ - -/* MPU Region Attribute and Size Register Definitions */ -#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ -#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ - -#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ -#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ - -#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ -#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ - -#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ -#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ - -#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ -#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ - -#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ -#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ - -#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ -#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ - -#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ -#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ - -#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ -#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ - -#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ -#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ - -/*@} end of group CMSIS_MPU */ -#endif - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) - \brief Type definitions for the Core Debug Registers - @{ - */ - -/** - \brief Structure type to access the Core Debug Register (CoreDebug). - */ -typedef struct -{ - __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ - __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ - __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ - __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ -} CoreDebug_Type; - -/* Debug Halting Control and Status Register Definitions */ -#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ -#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ - -#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ -#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ - -#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ -#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ - -#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ -#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ - -#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ -#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ - -#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ -#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ - -#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ -#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ - -#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ -#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ - -#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ -#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ - -#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ -#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ - -#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ -#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ - -#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ -#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ - -/* Debug Core Register Selector Register Definitions */ -#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ -#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ - -#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ -#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ - -/* Debug Exception and Monitor Control Register Definitions */ -#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ -#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ - -#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ -#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ - -#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ -#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ - -#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ -#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ - -#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ -#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ - -#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ -#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ - -#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ -#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ - -#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ -#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ - -#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ -#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ - -#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ -#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ - -#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ -#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ - -#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ -#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ - -#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ -#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ - -/*@} end of group CMSIS_CoreDebug */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_bitfield Core register bit field macros - \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). - @{ - */ - -/** - \brief Mask and shift a bit field value for use in a register bit range. - \param[in] field Name of the register bit field. - \param[in] value Value of the bit field. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk) - -/** - \brief Mask and shift a register value to extract a bit filed value. - \param[in] field Name of the register bit field. - \param[in] value Value of register. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos) - -/*@} end of group CMSIS_core_bitfield */ - - -/** - \ingroup CMSIS_core_register - \defgroup CMSIS_core_base Core Definitions - \brief Definitions for base addresses, unions, and structures. - @{ - */ - -/* Memory mapping of Cortex-M3 Hardware */ -#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ -#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ -#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ -#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ -#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ -#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ -#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ -#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ - -#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ -#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ -#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ -#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ -#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ -#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ -#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ -#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ - -#if (__MPU_PRESENT == 1U) - #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ - #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ -#endif - -/*@} */ - - - -/******************************************************************************* - * Hardware Abstraction Layer - Core Function Interface contains: - - Core NVIC Functions - - Core SysTick Functions - - Core Debug Functions - - Core Register Access Functions - ******************************************************************************/ -/** - \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference -*/ - - - -/* ########################## NVIC functions #################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_NVICFunctions NVIC Functions - \brief Functions that manage interrupts and exceptions via the NVIC. - @{ - */ - -/** - \brief Set Priority Grouping - \details Sets the priority grouping field using the required unlock sequence. - The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. - Only values from 0..7 are used. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. - \param [in] PriorityGroup Priority grouping field. - */ -__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) -{ - uint32_t reg_value; - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - - reg_value = SCB->AIRCR; /* read old register configuration */ - reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ - reg_value = (reg_value | - ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */ - SCB->AIRCR = reg_value; -} - - -/** - \brief Get Priority Grouping - \details Reads the priority grouping field from the NVIC Interrupt Controller. - \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). - */ -__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void) -{ - return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); -} - - -/** - \brief Enable External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Active Interrupt - \details Reads the active register in NVIC and returns the active bit. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not active. - \return 1 Interrupt status is active. - */ -__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); - } - else - { - NVIC->IP[((uint32_t)(int32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \param [in] IRQn Interrupt number. - \return Interrupt Priority. - Value is aligned automatically to the implemented priority bits of the microcontroller. - */ -__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) -{ - - if ((int32_t)(IRQn) < 0) - { - return(((uint32_t)SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); - } -} - - -/** - \brief Encode Priority - \details Encodes the priority for an interrupt with the given priority group, - preemptive priority value, and subpriority value. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. - \param [in] PriorityGroup Used priority group. - \param [in] PreemptPriority Preemptive priority value (starting from 0). - \param [in] SubPriority Subpriority value (starting from 0). - \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). - */ -__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) -{ - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - uint32_t PreemptPriorityBits; - uint32_t SubPriorityBits; - - PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); - SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); - - return ( - ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | - ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) - ); -} - - -/** - \brief Decode Priority - \details Decodes an interrupt priority value with a given priority group to - preemptive priority value and subpriority value. - In case of a conflict between priority grouping and available - priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. - \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). - \param [in] PriorityGroup Used priority group. - \param [out] pPreemptPriority Preemptive priority value (starting from 0). - \param [out] pSubPriority Subpriority value (starting from 0). - */ -__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) -{ - uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ - uint32_t PreemptPriorityBits; - uint32_t SubPriorityBits; - - PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); - SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); - - *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); - *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); -} - - -/** - \brief System Reset - \details Initiates a system reset request to reset the MCU. - */ -__STATIC_INLINE void NVIC_SystemReset(void) -{ - __DSB(); /* Ensure all outstanding memory accesses included - buffered write are completed before reset */ - SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | - SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ - __DSB(); /* Ensure completion of memory access */ - - for(;;) /* wait until reset */ - { - __NOP(); - } -} - -/*@} end of CMSIS_Core_NVICFunctions */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__Vendor_SysTickConfig == 0U) - -/** - \brief System Tick Configuration - \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. - Counter is in free running mode to generate periodic interrupts. - \param [in] ticks Number of ticks between two interrupts. - \return 0 Function succeeded. - \return 1 Function failed. - \note When the variable __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - must contain a vendor-specific implementation of this function. - */ -__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) -{ - if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) - { - return (1UL); /* Reload value impossible */ - } - - SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ - NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ - SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ - SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | - SysTick_CTRL_TICKINT_Msk | - SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ - return (0UL); /* Function successful */ -} - -#endif - -/*@} end of CMSIS_Core_SysTickFunctions */ - - - -/* ##################################### Debug In/Output function ########################################### */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_core_DebugFunctions ITM Functions - \brief Functions that access the ITM debug interface. - @{ - */ - -extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ -#define ITM_RXBUFFER_EMPTY 0x5AA55AA5U /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ - - -/** - \brief ITM Send Character - \details Transmits a character via the ITM channel 0, and - \li Just returns when no debugger is connected that has booked the output. - \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. - \param [in] ch Character to transmit. - \returns Character to transmit. - */ -__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) -{ - if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ - ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ - { - while (ITM->PORT[0U].u32 == 0UL) - { - __NOP(); - } - ITM->PORT[0U].u8 = (uint8_t)ch; - } - return (ch); -} - - -/** - \brief ITM Receive Character - \details Inputs a character via the external variable \ref ITM_RxBuffer. - \return Received character. - \return -1 No character pending. - */ -__STATIC_INLINE int32_t ITM_ReceiveChar (void) -{ - int32_t ch = -1; /* no character available */ - - if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) - { - ch = ITM_RxBuffer; - ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ - } - - return (ch); -} - - -/** - \brief ITM Check Character - \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. - \return 0 No character available. - \return 1 Character available. - */ -__STATIC_INLINE int32_t ITM_CheckChar (void) -{ - - if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) - { - return (0); /* no character available */ - } - else - { - return (1); /* character available */ - } -} - -/*@} end of CMSIS_core_DebugFunctions */ - - - - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_SC300_H_DEPENDANT */ - -#endif /* __CMSIS_GENERIC */ diff --git a/arch/cpu/arm/cortex-m/CMSIS/doxygen-group.txt b/arch/cpu/arm/cortex-m/CMSIS/doxygen-group.txt deleted file mode 100644 index 4b4bdd0eb..000000000 --- a/arch/cpu/arm/cortex-m/CMSIS/doxygen-group.txt +++ /dev/null @@ -1,64 +0,0 @@ -/** - * \defgroup cmsis CMSIS (Cortex Microcontroller Software Interface Standard) - * \ingroup arm - */ - -/** - * \addtogroup CMSIS_Core_FunctionInterface - * \ingroup cmsis - */ - -/** - * \addtogroup CMSIS_core_register - * \ingroup cmsis - */ - -/** - * \addtogroup CMSIS_glob_defs - * \ingroup cmsis - */ - -/** - * \addtogroup CMSIS_MISRA_Exceptions - * \ingroup cmsis - */ - -/** - * \addtogroup CMSIS_core_definitions - * \ingroup cmsis - */ - -/** - * \addtogroup CMSIS_SIMD_intrinsics - * \ingroup cmsis - */ - -/** - * \addtogroup CMSIS_Core_InstructionInterface - * \ingroup cmsis - */ - -/** - * \defgroup Cortex_M0 Cortex-M0 - * \ingroup cmsis - */ - -/** - * \defgroup Cortex_M0_plus Cortex-M0+ - * \ingroup cmsis - */ - -/** - * \defgroup Cortex_M3 Cortex-M3 - * \ingroup cmsis - */ - -/** - * \defgroup Cortex_M4 Cortex-M4 - * \ingroup cmsis - */ - -/** - * \defgroup Cortex_M7 Cortex-M7 - * \ingroup cmsis - */ diff --git a/arch/cpu/arm/cortex-m/Makefile.cortex-m b/arch/cpu/arm/cortex-m/Makefile.cortex-m deleted file mode 100644 index 3f14ead41..000000000 --- a/arch/cpu/arm/cortex-m/Makefile.cortex-m +++ /dev/null @@ -1,28 +0,0 @@ -CONTIKI_ARM_DIRS += cortex-m cortex-m/CMSIS - -### Build syscalls for newlib -MODULES += os/lib/newlib - -LDFLAGS += -T $(LDSCRIPT) -LDFLAGS += -Wl,--gc-sections,--sort-section=alignment -LDFLAGS += -Wl,-Map=$(CONTIKI_NG_PROJECT_MAP),--cref,--no-warn-mismatch - -OBJCOPY_FLAGS += --gap-fill 0xff - -CPU_STARTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CPU_START_SOURCEFILES)}} - -### Resolve any potential circular dependencies between the linked libraries -### See: https://stackoverflow.com/questions/5651869/gcc-what-are-the-start-group-and-end-group-command-line-options/5651895 -TARGET_LIBFLAGS := -Wl,--start-group $(TARGET_LIBFILES) -Wl,--end-group - -CUSTOM_RULE_LINK = 1 - -OUT_ELF = $(BUILD_DIR_BOARD)/%.elf - -.SECONDEXPANSION: - -$(OUT_ELF): $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(LDSCRIPT) $(TARGET_LIBS) - $(TRACE_LD) - $(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFLAGS) -o $@ - -include $(ARCH_PATH)/cpu/arm/Makefile.arm diff --git a/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 b/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 deleted file mode 100644 index 35051a0f7..000000000 --- a/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 +++ /dev/null @@ -1,9 +0,0 @@ -CONTIKI_ARM_DIRS += cortex-m/cm3 - -CFLAGS += -mcpu=cortex-m3 - -LDFLAGS += -mcpu=cortex-m3 -nostartfiles - -TARGET_LIBFILES += -lm - -include $(ARCH_PATH)/cpu/arm/cortex-m/Makefile.cortex-m diff --git a/arch/cpu/arm/cortex-m/cm3/cm3-def.h b/arch/cpu/arm/cortex-m/cm3/cm3-def.h deleted file mode 100644 index 041bb3d71..000000000 --- a/arch/cpu/arm/cortex-m/cm3/cm3-def.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup arm - * @{ - * - * \defgroup cm3 Arm Cortex-M3 - * @{ - * - * \file - * Compiler and data type definitions for all CM3-based CPUs - */ -/*---------------------------------------------------------------------------*/ -#ifndef CM3_DEF_H_ -#define CM3_DEF_H_ -/*---------------------------------------------------------------------------*/ -#include "arm-def.h" -/*---------------------------------------------------------------------------*/ -#endif /* CM3_DEF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 b/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 deleted file mode 100644 index dc470601f..000000000 --- a/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 +++ /dev/null @@ -1,7 +0,0 @@ -CONTIKI_ARM_DIRS += cortex-m/cm4 - -CFLAGS += -mcpu=cortex-m4 - -LDFLAGS += -mcpu=cortex-m4 - -include $(ARCH_PATH)/cpu/arm/cortex-m/Makefile.cortex-m diff --git a/arch/cpu/arm/cortex-m/cm4/cm4-def.h b/arch/cpu/arm/cortex-m/cm4/cm4-def.h deleted file mode 100644 index 1144d9798..000000000 --- a/arch/cpu/arm/cortex-m/cm4/cm4-def.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup arm - * @{ - * - * \defgroup cm4 Arm Cortex-M4 - * @{ - * - * \file - * Compiler and data type definitions for all CM4-based CPUs - */ -/*---------------------------------------------------------------------------*/ -#ifndef CM4_DEF_H_ -#define CM4_DEF_H_ -/*---------------------------------------------------------------------------*/ -#include "arm-def.h" -/*---------------------------------------------------------------------------*/ -#endif /* CM4_DEF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/arm/cortex-m/memory-barrier-cortex.h b/arch/cpu/arm/cortex-m/memory-barrier-cortex.h deleted file mode 100644 index ae0177cf1..000000000 --- a/arch/cpu/arm/cortex-m/memory-barrier-cortex.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 MEMORY_BARRIER_CORTEX_H_ -#define MEMORY_BARRIER_CORTEX_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#ifdef CMSIS_CONF_HEADER_PATH -#include CMSIS_CONF_HEADER_PATH -#endif -/*---------------------------------------------------------------------------*/ -#define memory_barrier() __DMB() -/*---------------------------------------------------------------------------*/ -#endif /* MEMORY_BARRIER_CORTEX_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/arm/cortex-m/mutex-cortex.h b/arch/cpu/arm/cortex-m/mutex-cortex.h deleted file mode 100644 index 562a0528c..000000000 --- a/arch/cpu/arm/cortex-m/mutex-cortex.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup arm - * - * Arm Cortex-M implementation of mutexes using the LDREX, STREX and DMB - * instructions. - * - * @{ - */ -/*---------------------------------------------------------------------------*/ -#ifndef MUTEX_CORTEX_H_ -#define MUTEX_CORTEX_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#ifdef CMSIS_CONF_HEADER_PATH -#include CMSIS_CONF_HEADER_PATH -#endif - -#include -#include -/*---------------------------------------------------------------------------*/ -#define mutex_try_lock(m) mutex_cortex_try_lock(m) -#define mutex_unlock(m) mutex_cortex_unlock(m) -/*---------------------------------------------------------------------------*/ -#define MUTEX_CONF_HAS_MUTEX_T 1 -typedef uint8_t mutex_t; -/*---------------------------------------------------------------------------*/ -static inline bool -mutex_cortex_try_lock(volatile mutex_t *mutex) -{ - int status = 1; - - if(__LDREXB(mutex) == 0) { - status = __STREXB(1, mutex); - } - - __DMB(); - - return status == 0 ? true : false; -} -/*---------------------------------------------------------------------------*/ -static inline void -mutex_cortex_unlock(volatile mutex_t *mutex) -{ - __DMB(); - *mutex = 0; -} -/*---------------------------------------------------------------------------*/ -#endif /* MUTEX_CORTEX_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/arm/doxygen-group.txt b/arch/cpu/arm/doxygen-group.txt deleted file mode 100644 index 8e6f29468..000000000 --- a/arch/cpu/arm/doxygen-group.txt +++ /dev/null @@ -1,4 +0,0 @@ -/** - * \defgroup arm Support for Arm CPUs - * \ingroup cpu - */ diff --git a/arch/cpu/arm/openocd/arm7_wig.cfg b/arch/cpu/arm/openocd/arm7_wig.cfg deleted file mode 100644 index 5d6a4b597..000000000 --- a/arch/cpu/arm/openocd/arm7_wig.cfg +++ /dev/null @@ -1,19 +0,0 @@ - - -# Change the default telnet port... -telnet_port 4444 -# GDB connects here -gdb_port 3333 -# GDB can also flash my flash! -gdb_memory_map enable -gdb_flash_program enable - -# Wiggler interface -interface parport -parport_port 0 -parport_cable wiggler_ntrst_inverted -jtag_speed 0 -set CPUTAPID 0x3BA00477 -set BSTAPID 0x16410041 -source [find target/stm32F10xxx.cfg] - diff --git a/arch/cpu/arm/openocd/target/stm32F10xxx.cfg b/arch/cpu/arm/openocd/target/stm32F10xxx.cfg deleted file mode 100644 index ee6e79fb5..000000000 --- a/arch/cpu/arm/openocd/target/stm32F10xxx.cfg +++ /dev/null @@ -1,49 +0,0 @@ -# STM32 Cortex M3 - -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - set _CHIPNAME stm32F10xxx -} - -if { [info exists ENDIAN] } { - set _ENDIAN $ENDIAN -} else { - set _ENDIAN little -} - -if { [info exists CPUTAPID ] } { - set _CPUTAPID $CPUTAPID -} else { - # force an error till we get a good number - set _CPUTAPID 0xffffffff -} - -#use combined on interfaces or targets that can't set TRST/SRST separately -reset_config trst_and_srst -jtag_nsrst_delay 1 - -#jtag scan chain -jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID - -# The target -set _TARGETNAME [format "%s.cpu" $_CHIPNAME] -target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME -variant cortex_m3 - -$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 0x4000 -work-area-backup 0 - - -if { [info exists BSTAPID ] } { - set _BSTAPID $BSTAPID -} else { - # force an error till we get a good number - set _BSTAPID 0xffffffff -} - -#jtag scan chain -jtag newtap $_CHIPNAME bs -irlen 5 -ircapture 0x1 -irmask 0xf -expected-id $_BSTAPID - -flash bank stm32x 0 0 0 0 0 - - - diff --git a/arch/cpu/cc2538/Makefile.cc2538 b/arch/cpu/cc2538/Makefile.cc2538 deleted file mode 100644 index 85f435320..000000000 --- a/arch/cpu/cc2538/Makefile.cc2538 +++ /dev/null @@ -1,55 +0,0 @@ -ifndef SOURCE_LDSCRIPT -SOURCE_LDSCRIPT = $(CONTIKI_CPU)/cc2538.lds -endif -LDSCRIPT = $(OBJECTDIR)/cc2538.ld - -CFLAGS += -DCMSIS_DEV_HDR=\"cc2538_cm3.h\" - -### If the user-specified a Node ID, pass a define -ifdef NODEID - CFLAGS += -DIEEE_ADDR_NODE_ID=$(NODEID) -endif - -### CPU-dependent directories -CONTIKI_CPU_DIRS = . dev usb usb/common usb/common/cdc-acm - -### CPU-dependent source files -CONTIKI_CPU_SOURCEFILES += soc.c clock.c rtimer-arch.c uart.c watchdog.c -CONTIKI_CPU_SOURCEFILES += nvic.c sys-ctrl.c gpio.c ioc.c spi-legacy.c adc.c -CONTIKI_CPU_SOURCEFILES += spi-arch.c -CONTIKI_CPU_SOURCEFILES += crypto.c aes.c ecb.c cbc.c ctr.c cbc-mac.c gcm.c -CONTIKI_CPU_SOURCEFILES += ccm.c sha256.c gpio-hal-arch.c -CONTIKI_CPU_SOURCEFILES += cc2538-aes-128.c cc2538-ccm-star.c -CONTIKI_CPU_SOURCEFILES += cc2538-rf.c udma.c lpm.c int-master.c -CONTIKI_CPU_SOURCEFILES += pka.c bignum-driver.c ecc-driver.c ecc-algorithm.c -CONTIKI_CPU_SOURCEFILES += ecc-curve.c -CONTIKI_CPU_SOURCEFILES += dbg.c ieee-addr.c -CONTIKI_CPU_SOURCEFILES += slip-arch.c slip.c -CONTIKI_CPU_SOURCEFILES += i2c.c cc2538-temp-sensor.c vdd3-sensor.c -CONTIKI_CPU_SOURCEFILES += cfs-coffee.c cfs-coffee-arch.c pwm.c - -USB_SOURCEFILES += usb-core.c cdc-acm.c usb-arch.c usb-serial.c cdc-acm-descriptors.c - -CPU_START_SOURCEFILES = startup-gcc.c - -CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(USB_SOURCEFILES) - -### Always re-build ieee-addr.o in case the command line passes a new NODEID -FORCE: - -$(OBJECTDIR)/ieee-addr.o: ieee-addr.c FORCE | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -c $< -o $@ - -### This rule is used to generate the correct linker script -LDGENFLAGS += $(CFLAGS) -LDGENFLAGS += -imacros "contiki-conf.h" -imacros "dev/cc2538-dev.h" -LDGENFLAGS += -imacros "dev/flash.h" -imacros "cfs-coffee-arch.h" -LDGENFLAGS += -x c -P -E - -# NB: Assumes LDSCRIPT was not overridden and is in $(OBJECTDIR) -$(LDSCRIPT): $(SOURCE_LDSCRIPT) FORCE | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(LDGENFLAGS) $< | grep -v '^\s*#\s*pragma\>' > $@ - -include $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3 diff --git a/arch/cpu/cc2538/cc2538-conf.h b/arch/cpu/cc2538/cc2538-conf.h deleted file mode 100644 index d34c3dee5..000000000 --- a/arch/cpu/cc2538/cc2538-conf.h +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538 - * @{ - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC2538_CONF_H_ -#define CC2538_CONF_H_ -/*---------------------------------------------------------------------------*/ -/** - * \name CFS configuration - * - * @{ - */ -#ifndef COFFEE_CONF_SIZE -#define COFFEE_CONF_SIZE (4 * COFFEE_SECTOR_SIZE) -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name CC2538 System Control configuration - * - * @{ - */ -#ifndef SYS_CTRL_CONF_OSC32K_USE_XTAL -#define SYS_CTRL_CONF_OSC32K_USE_XTAL 0 /**< Use the on-board 32.768-kHz crystal */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Watchdog Timer configuration - * - * @{ - */ -#ifndef WATCHDOG_CONF_ENABLE -#define WATCHDOG_CONF_ENABLE 1 /**< Enable the watchdog timer */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB 'core' configuration - * - * Those values are not meant to be modified by the user, except where stated - * otherwise - * @{ - */ -#define CTRL_EP_SIZE 8 -#define USB_EP1_SIZE 32 -#define USB_EP2_SIZE 64 -#define USB_EP3_SIZE 64 -#define USB_ARCH_WRITE_NOTIFY 0 - -#ifndef USB_ARCH_CONF_DMA -#define USB_ARCH_CONF_DMA 1 /**< Change to Enable/Disable USB DMA */ - -#endif -/** @} */ -/** - * \name uDMA Configuration and channel allocations - * - * @{ - */ -#define USB_ARCH_CONF_RX_DMA_CHAN 0 /**< USB -> RAM DMA channel */ -#define USB_ARCH_CONF_TX_DMA_CHAN 1 /**< RAM -> USB DMA channel */ -#define CC2538_RF_CONF_TX_DMA_CHAN 2 /**< RF -> RAM DMA channel */ -#define CC2538_RF_CONF_RX_DMA_CHAN 3 /**< RAM -> RF DMA channel */ -#define UDMA_CONF_MAX_CHANNEL CC2538_RF_CONF_RX_DMA_CHAN -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Character I/O Configuration - * - * @{ - */ -#ifndef UART_CONF_ENABLE -#define UART_CONF_ENABLE 1 /**< Enable/Disable UART I/O */ -#endif - -#ifndef UART0_CONF_BAUD_RATE -#define UART0_CONF_BAUD_RATE 115200 /**< Default UART0 baud rate */ -#endif - -#ifndef UART1_CONF_BAUD_RATE -#define UART1_CONF_BAUD_RATE 115200 /**< Default UART1 baud rate */ -#endif - -#ifndef SLIP_ARCH_CONF_USB -#define SLIP_ARCH_CONF_USB 0 /**< SLIP over UART by default */ -#endif - -#ifndef DBG_CONF_USB -#define DBG_CONF_USB 0 /**< All debugging over UART by default */ -#endif - -#ifndef SERIAL_LINE_CONF_UART -#define SERIAL_LINE_CONF_UART 0 /**< UART to use with serial line */ -#endif - -#if !SLIP_ARCH_CONF_USB -#ifndef SLIP_ARCH_CONF_UART -#define SLIP_ARCH_CONF_UART 0 /**< UART to use with SLIP */ -#endif -#endif - -#if !DBG_CONF_USB -#ifndef DBG_CONF_UART -#define DBG_CONF_UART 0 /**< UART to use for debugging */ -#endif -#endif - -#ifndef UART1_CONF_UART -#define UART1_CONF_UART 0 /**< UART to use for examples relying on - the uart1_* API */ -#endif - -#ifndef SLIP_ARCH_CONF_ENABLED -/* - * Determine whether we need SLIP - * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT - * keep using SLIP - */ -#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT) -#define SLIP_ARCH_CONF_ENABLED 1 -#endif -#endif - -/** - * \brief Define this as 1 to build a headless node. - * - * The UART will not be initialised its clock will be gated, offering some - * energy savings. The USB will not be initialised either - */ -#ifndef CC2538_CONF_QUIET -#define CC2538_CONF_QUIET 0 -#endif - -/* CC2538_CONF_QUIET is hard and overrides all other related defines */ -#if CC2538_CONF_QUIET -#undef USB_SERIAL_CONF_ENABLE -#define USB_SERIAL_CONF_ENABLE 0 - -#undef UART_CONF_ENABLE -#define UART_CONF_ENABLE 0 -#endif /* CC2538_CONF_QUIET */ - -/** - * \brief Enable the USB core only if we need it - */ -#ifndef USB_SERIAL_CONF_ENABLE -#define USB_SERIAL_CONF_ENABLE \ - ((SLIP_ARCH_CONF_USB && SLIP_ARCH_CONF_ENABLED) || \ - (MAC_CONF_WITH_TSCH && (SLIP_ARCH_CONF_ENABLED || BUILD_WITH_SHELL)) || \ - DBG_CONF_USB) -#endif - -/* - * If debugging and SLIP use the same peripheral, this will be 1. Don't modify - * this - */ -#if SLIP_ARCH_CONF_ENABLED -#define DBG_CONF_SLIP_MUX (SLIP_ARCH_CONF_USB == DBG_CONF_USB && \ - (SLIP_ARCH_CONF_USB || \ - SLIP_ARCH_CONF_UART == DBG_CONF_UART)) -#endif - -/* - * Automatic detection of whether a specific UART is in use - */ -#define UART_IN_USE_BY_SERIAL_LINE(u) (SERIAL_LINE_CONF_UART == (u)) -#define UART_IN_USE_BY_SLIP(u) (SLIP_ARCH_CONF_ENABLED && \ - !SLIP_ARCH_CONF_USB && \ - SLIP_ARCH_CONF_UART == (u)) -#define UART_IN_USE_BY_DBG(u) (!DBG_CONF_USB && DBG_CONF_UART == (u)) -#define UART_IN_USE_BY_UART1(u) (UART1_CONF_UART == (u)) - -#define UART_IN_USE(u) ( \ - UART_CONF_ENABLE && \ - (UART_IN_USE_BY_SERIAL_LINE(u) || \ - UART_IN_USE_BY_SLIP(u) || \ - UART_IN_USE_BY_DBG(u) || \ - UART_IN_USE_BY_UART1(u)) \ -) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name RF configuration - * - * @{ - */ -/* RF Config */ - -#ifndef CC2538_RF_CONF_AUTOACK -#define CC2538_RF_CONF_AUTOACK 1 /**< RF H/W generates ACKs */ -#endif /* CC2538_CONF_AUTOACK */ - -#ifndef CC2538_RF_CONF_TX_USE_DMA -#define CC2538_RF_CONF_TX_USE_DMA 1 /**< RF TX over DMA */ -#endif - -#ifndef CC2538_RF_CONF_RX_USE_DMA -#define CC2538_RF_CONF_RX_USE_DMA 1 /**< RF RX over DMA */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LPM configuration - * @{ - */ -#ifndef LPM_CONF_ENABLE -#define LPM_CONF_ENABLE 1 /**< Set to 0 to disable LPM entirely */ -#endif - -/** - * \brief Maximum PM - * - * The SoC will never drop to a Power Mode deeper than the one specified here. - * 0 for PM0, 1 for PM1 and 2 for PM2 - */ -#ifndef LPM_CONF_MAX_PM -#define LPM_CONF_MAX_PM 1 -#endif - -#ifndef LPM_CONF_STATS -#define LPM_CONF_STATS 0 /**< Set to 1 to enable LPM-related stats */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Radio Configuration - * - * @{ - */ -#ifndef NETSTACK_CONF_RADIO -#define NETSTACK_CONF_RADIO cc2538_rf_driver -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name IEEE address configuration - * - * Used to generate our link-layer & IPv6 address - * @{ - */ -/** - * \brief Location of the IEEE address - * 0 => Read from InfoPage, - * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS - */ -#ifndef IEEE_ADDR_CONF_HARDCODED -#define IEEE_ADDR_CONF_HARDCODED 0 -#endif - -/** - * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED - * is defined as 1 - */ -#ifndef IEEE_ADDR_CONF_ADDRESS -#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF } -#endif - -/** - * \brief Location of the IEEE address in the InfoPage when - * IEEE_ADDR_CONF_HARDCODED is defined as 0 - * 0 => Use the primary address location - * 1 => Use the secondary address location - */ -#ifndef IEEE_ADDR_CONF_USE_SECONDARY_LOCATION -#define IEEE_ADDR_CONF_USE_SECONDARY_LOCATION 0 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Security - * - * @{ - */ -#ifndef CRYPTO_CONF_INIT -#define CRYPTO_CONF_INIT 1 /**< Whether to init cryptoprocessor */ -#endif - -#ifndef AES_128_CONF -#define AES_128_CONF cc2538_aes_128_driver /**< AES-128 driver */ -#endif - -#ifndef CCM_STAR_CONF -#define CCM_STAR_CONF cc2538_ccm_star_driver /**< AES-CCM* driver */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* CC2538_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc2538/cc2538-def.h b/arch/cpu/cc2538/cc2538-def.h deleted file mode 100644 index defa4ecb0..000000000 --- a/arch/cpu/cc2538/cc2538-def.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 CC2538_DEF_H_ -#define CC2538_DEF_H_ -/*---------------------------------------------------------------------------*/ -#include "cm3/cm3-def.h" -/*---------------------------------------------------------------------------*/ -#define RTIMER_ARCH_SECOND 32768 -/*---------------------------------------------------------------------------*/ -#define CC2538_PHY_OVERHEAD 3 -#define CC2538_BYTE_AIR_TIME 32 -/* 352us from calling transmit() until the SFD byte has been sent */ -#define CC2538_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(352)) -/* 192us as in datasheet but ACKs are not always received, so adjusted to 250us */ -#define CC2538_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(250)) -#define CC2538_DELAY_BEFORE_DETECT 0 -/* Frame filtering done in software */ -#define TSCH_CONF_HW_FRAME_FILTERING 0 - -#ifndef TSCH_CONF_BASE_DRIFT_PPM -/* The drift compared to "true" 10ms slots. - * Enable adaptive sync to enable compensation for this. - * Slot length 10000 usec - * 328 ticks - * Tick duration 30.517578125 usec - * Real slot duration 10009.765625 usec - * Target - real duration = -9.765625 usec - * TSCH_CONF_BASE_DRIFT_PPM -977 - */ -#define TSCH_CONF_BASE_DRIFT_PPM -977 -#endif - -/*---------------------------------------------------------------------------*/ -#define SPI_CONF_CONTROLLER_COUNT 2 -/*---------------------------------------------------------------------------*/ -/* Path to CMSIS header */ -#define CMSIS_CONF_HEADER_PATH "cc2538_cm3.h" - -/* Path to headers with implementation of mutexes and memory barriers */ -#define MUTEX_CONF_ARCH_HEADER_PATH "mutex-cortex.h" -#define MEMORY_BARRIER_CONF_ARCH_HEADER_PATH "memory-barrier-cortex.h" - -#define GPIO_HAL_CONF_ARCH_HDR_PATH "dev/gpio-hal-arch.h" -/*---------------------------------------------------------------------------*/ -#endif /* CC2538_DEF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc2538/cc2538.lds b/arch/cpu/cc2538/cc2538.lds deleted file mode 100644 index 4d5031f15..000000000 --- a/arch/cpu/cc2538/cc2538.lds +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2013, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/* - * cc2538 linker configuration file. This is not the actual file used at link - * stage. Rather, it is used as input for the auto-generation of the actual - * ld script, which is called cc2538.ld and will be in the project directory - */ -MEMORY -{ - FLASH_FW (rx) : ORIGIN = FLASH_FW_ADDR, LENGTH = FLASH_FW_SIZE - FLASH_CCA (RX) : ORIGIN = FLASH_CCA_ADDR, LENGTH = FLASH_CCA_SIZE - - /* - * If PM2 is enabled, then the PM2 SRAM limitations apply, i.e. the - * regular-leakage SRAM is a non-retention SRAM and the low-leakage SRAM is - * a full-retention SRAM. - * Else, the data in the regular-leakage SRAM is always retained, so there - * are virtually a non-retention SRAM with a size of 0 bytes and a - * full-retention SRAM spanning the whole SRAM, which is more convenient to - * use. - */ -#if LPM_CONF_ENABLE && LPM_CONF_MAX_PM >= 2 - NRSRAM (RWX) : ORIGIN = CC2538_DEV_RLSRAM_ADDR, - LENGTH = CC2538_DEV_RLSRAM_SIZE - FRSRAM (RWX) : ORIGIN = CC2538_DEV_LLSRAM_ADDR, - LENGTH = CC2538_DEV_LLSRAM_SIZE -#else - NRSRAM (RWX) : ORIGIN = CC2538_DEV_RLSRAM_ADDR, LENGTH = 0 - FRSRAM (RWX) : ORIGIN = CC2538_DEV_SRAM_ADDR, LENGTH = CC2538_DEV_SRAM_SIZE -#endif -} - -ENTRY(flash_cca_lock_page) -SECTIONS -{ - .text : - { - _text = .; - *(.vectors) - *(.text*) - *(.rodata*) - _etext = .; - } > FLASH_FW= 0 - - .socdata (NOLOAD) : - { - *(.udma_channel_control_table) - } > FRSRAM - - .data : ALIGN(4) - { - _data = .; - *(.data*) - _edata = .; - } > FRSRAM AT > FLASH_FW - _ldata = LOADADDR(.data); - - .ARM.exidx : - { - *(.ARM.exidx*) - } > FLASH_FW - - .bss : - { - _bss = .; - *(.bss*) - *(COMMON) - _ebss = .; - } > FRSRAM - - _end = .; /* End of the .bss segment. */ - - /* This symbol is used by the stack check library. */ - _stack = .; - - .stack (NOLOAD) : - { - *(.stack) - } > FRSRAM - - /* This symbol is used by the stack check library. */ - _stack_origin = .; - _heap = .; - _eheap = ORIGIN(FRSRAM) + LENGTH(FRSRAM); - - .nrdata (NOLOAD) : - { - _nrdata = .; - *(.nrdata*) - _enrdata = .; - } > NRSRAM - - .flashcca : - { - *(.flashcca) - } > FLASH_CCA -} diff --git a/arch/cpu/cc2538/cc2538_cm3.h b/arch/cpu/cc2538/cc2538_cm3.h deleted file mode 100644 index 986725b08..000000000 --- a/arch/cpu/cc2538/cc2538_cm3.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Template: - * Copyright (c) 2012 ARM LIMITED - * All rights reserved. - * - * CC2538: - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-cm3 CC2538 Cortex-M3 - * - * CC2538 Cortex-M3 CMSIS definitions - * @{ - * - * \file - * CMSIS Cortex-M3 core peripheral access layer header file for CC2538 - */ -#ifndef CC2538_CM3_H -#define CC2538_CM3_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** \defgroup CC2538_CMSIS CC2538 CMSIS Definitions - * Configuration of the Cortex-M3 Processor and Core Peripherals - * @{ - */ - -/** \name Interrupt Number Definition - * @{ - */ - -typedef enum IRQn -{ - /****** Cortex-M3 Processor Exceptions Numbers ****************************/ - NonMaskableInt_IRQn = -14, /**< 2 Non Maskable Interrupt */ - HardFault_IRQn = -13, /**< 3 HardFault Interrupt */ - MemoryManagement_IRQn = -12, /**< 4 Memory Management Interrupt */ - BusFault_IRQn = -11, /**< 5 Bus Fault Interrupt */ - UsageFault_IRQn = -10, /**< 6 Usage Fault Interrupt */ - SVCall_IRQn = -5, /**< 11 SV Call Interrupt */ - DebugMonitor_IRQn = -4, /**< 12 Debug Monitor Interrupt */ - PendSV_IRQn = -2, /**< 14 Pend SV Interrupt */ - SysTick_IRQn = -1, /**< 15 System Tick Interrupt */ - - /****** CC2538-Specific Interrupt Numbers *********************************/ - GPIO_A_IRQn = 0, /**< GPIO port A Interrupt */ - GPIO_B_IRQn = 1, /**< GPIO port B Interrupt */ - GPIO_C_IRQn = 2, /**< GPIO port C Interrupt */ - GPIO_D_IRQn = 3, /**< GPIO port D Interrupt */ - UART0_IRQn = 5, /**< UART0 Interrupt */ - UART1_IRQn = 6, /**< UART1 Interrupt */ - SSI0_IRQn = 7, /**< SSI0 Interrupt */ - I2C_IRQn = 8, /**< I²C Interrupt */ - ADC_IRQn = 14, /**< ADC Interrupt */ - WDT_IRQn = 18, /**< Watchdog Timer Interrupt */ - GPT0A_IRQn = 19, /**< GPTimer 0A Interrupt */ - GPT0B_IRQn = 20, /**< GPTimer 0B Interrupt */ - GPT1A_IRQn = 21, /**< GPTimer 1A Interrupt */ - GPT1B_IRQn = 22, /**< GPTimer 1B Interrupt */ - GPT2A_IRQn = 23, /**< GPTimer 2A Interrupt */ - GPT2B_IRQn = 24, /**< GPTimer 2B Interrupt */ - ADC_CMP_IRQn = 25, /**< Analog Comparator Interrupt */ - RF_TX_RX_ALT_IRQn = 26, /**< RF Tx/Rx (Alternate) Interrupt */ - RF_ERR_ALT_IRQn = 27, /**< RF Error (Alternate) Interrupt */ - SYS_CTRL_IRQn = 28, /**< System Control Interrupt */ - FLASH_CTRL_IRQn = 29, /**< Flash memory Control Interrupt */ - AES_ALT_IRQn = 30, /**< AES (Alternate) Interrupt */ - PKA_ALT_IRQn = 31, /**< PKA (Alternate) Interrupt */ - SMT_ALT_IRQn = 32, /**< SM Timer (Alternate) Interrupt */ - MACT_ALT_IRQn = 33, /**< MAC Timer (Alternate) Interrupt */ - SSI1_IRQn = 34, /**< SSI1 Interrupt */ - GPT3A_IRQn = 35, /**< GPTimer 3A Interrupt */ - GPT3B_IRQn = 36, /**< GPTimer 3B Interrupt */ - UDMA_SW_IRQn = 46, /**< µDMA Software Interrupt */ - UDMA_ERR_IRQn = 47, /**< µDMA Error Interrupt */ - USB_IRQn = 140, /**< USB Interrupt */ - RF_TX_RX_IRQn = 141, /**< RF Tx/Rx Interrupt */ - RF_ERR_IRQn = 142, /**< RF Error Interrupt */ - AES_IRQn = 143, /**< AES Interrupt */ - PKA_IRQn = 144, /**< PKA Interrupt */ - SMT_IRQn = 145, /**< SM Timer Interrupt */ - MACT_IRQn = 146 /**< MAC Timer Interrupt */ -} IRQn_Type; - -/** @} */ - -/** \name Processor and Core Peripheral Section - * @{ - */ - -/* Configuration of the Cortex-M3 Processor and Core Peripherals */ -#define __CM3_REV 0x0200 /**< Core Revision r2p0 */ -#define __MPU_PRESENT 1 /**< MPU present or not */ -#define __NVIC_PRIO_BITS 3 /**< Number of Bits used for Priority Levels */ -#define __Vendor_SysTickConfig 0 /**< Set to 1 if different SysTick Config is used */ - -/** @} */ - -/** @} */ /* CC2538_CMSIS */ - -#include /* Cortex-M3 processor and core peripherals */ - -#ifdef __cplusplus -} -#endif - -#endif /* CC2538_CM3_H */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/cfs-coffee-arch.c b/arch/cpu/cc2538/cfs-coffee-arch.c deleted file mode 100644 index e727a9512..000000000 --- a/arch/cpu/cc2538/cfs-coffee-arch.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538-cfs-coffee-arch - * @{ - * - * \file - * Module for the cc2538 Coffee port - */ -#include "contiki.h" -#include "sys/cc.h" -#include "cfs/cfs-coffee.h" -#include "dev/cc2538-dev.h" -#include "dev/rom-util.h" -#include "dev/flash.h" -#include "dev/watchdog.h" -#include "cpu.h" -#include "cfs-coffee-arch.h" - -#include - -#ifndef COFFEE_CONF_CUSTOM_PORT -/*---------------------------------------------------------------------------*/ -#if !COFFEE_SECTOR_SIZE || COFFEE_SECTOR_SIZE % FLASH_PAGE_SIZE -#error COFFEE_SECTOR_SIZE must be a non-zero multiple of the flash page size -#endif -#if !COFFEE_PAGE_SIZE || COFFEE_SECTOR_SIZE % COFFEE_PAGE_SIZE -#error COFFEE_PAGE_SIZE must be a divisor of COFFEE_SECTOR_SIZE -#endif -#if COFFEE_PAGE_SIZE % FLASH_WORD_SIZE -#error COFFEE_PAGE_SIZE must be a multiple of the flash word size -#endif -#if COFFEE_START % FLASH_PAGE_SIZE -#error COFFEE_START must be aligned with a flash page boundary -#endif -#if COFFEE_SIZE % COFFEE_SECTOR_SIZE -#error COFFEE_SIZE must be a multiple of COFFEE_SECTOR_SIZE -#endif -#if COFFEE_SIZE / COFFEE_PAGE_SIZE > INT16_MAX -#error Too many Coffee pages for coffee_page_t -#endif -#if COFFEE_START < CC2538_DEV_FLASH_ADDR || \ - COFFEE_START + COFFEE_SIZE > FLASH_CCA_ADDR -#error Coffee does not fit in flash -#endif -/*---------------------------------------------------------------------------*/ -void -cfs_coffee_arch_erase(uint16_t sector) -{ - watchdog_periodic(); - INTERRUPTS_DISABLE(); - rom_util_page_erase(COFFEE_START + sector * COFFEE_SECTOR_SIZE, - COFFEE_SECTOR_SIZE); - INTERRUPTS_ENABLE(); -} -/*---------------------------------------------------------------------------*/ -void -cfs_coffee_arch_write(const void *buf, unsigned int size, cfs_offset_t offset) -{ - const uint32_t *src = buf; - uint32_t flash_addr = COFFEE_START + offset; - unsigned int align; - uint32_t word, len; - uint32_t page_buf[COFFEE_PAGE_SIZE / FLASH_WORD_SIZE]; - unsigned int i; - - if(size && (align = flash_addr & (FLASH_WORD_SIZE - 1))) { - len = MIN(FLASH_WORD_SIZE - align, size); - word = ~((*src & ((1 << (len << 3)) - 1)) << (align << 3)); - watchdog_periodic(); - INTERRUPTS_DISABLE(); - rom_util_program_flash(&word, flash_addr & ~(FLASH_WORD_SIZE - 1), - FLASH_WORD_SIZE); - INTERRUPTS_ENABLE(); - *(const uint8_t **)&src += len; - size -= len; - flash_addr += len; - } - - while(size >= FLASH_WORD_SIZE) { - len = MIN(size & ~(FLASH_WORD_SIZE - 1), COFFEE_PAGE_SIZE); - for(i = 0; i < len / FLASH_WORD_SIZE; i++) { - page_buf[i] = ~*src++; - } - watchdog_periodic(); - INTERRUPTS_DISABLE(); - rom_util_program_flash(page_buf, flash_addr, len); - INTERRUPTS_ENABLE(); - size -= len; - flash_addr += len; - } - - if(size) { - word = ~(*src & ((1 << (size << 3)) - 1)); - watchdog_periodic(); - INTERRUPTS_DISABLE(); - rom_util_program_flash(&word, flash_addr, FLASH_WORD_SIZE); - INTERRUPTS_ENABLE(); - } -} -/*---------------------------------------------------------------------------*/ -void -cfs_coffee_arch_read(void *buf, unsigned int size, cfs_offset_t offset) -{ - const uint8_t *src; - uint8_t *dst; - - watchdog_periodic(); - for(src = (const void *)(COFFEE_START + offset), dst = buf; size; size--) { - *dst++ = ~*src++; - } -} - -#endif /* COFFEE_CONF_CUSTOM_PORT */ - -/** @} */ diff --git a/arch/cpu/cc2538/cfs-coffee-arch.h b/arch/cpu/cc2538/cfs-coffee-arch.h deleted file mode 100644 index 807ca8f58..000000000 --- a/arch/cpu/cc2538/cfs-coffee-arch.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-cfs-coffee-arch cc2538 Coffee port module - * - * Module for the cc2538 Coffee port - * @{ - * - * \file - * Header file for the cc2538 Coffee port module - */ -#ifndef CFS_COFFEE_ARCH_H_ -#define CFS_COFFEE_ARCH_H_ - -#include "contiki.h" -#include "cfs/cfs-coffee.h" -#include "dev/cc2538-dev.h" -#include "dev/flash.h" - -#include - -#ifdef COFFEE_CONF_CUSTOM_PORT -#include COFFEE_CONF_CUSTOM_PORT -#else -/*---------------------------------------------------------------------------*/ -/** \name Coffee port constants - * @{ - */ -/** Logical sector size */ -#ifdef COFFEE_CONF_SECTOR_SIZE -#define COFFEE_SECTOR_SIZE COFFEE_CONF_SECTOR_SIZE -#else -#define COFFEE_SECTOR_SIZE FLASH_PAGE_SIZE -#endif -/** Logical page size */ -#ifdef COFFEE_CONF_PAGE_SIZE -#define COFFEE_PAGE_SIZE COFFEE_CONF_PAGE_SIZE -#else -#define COFFEE_PAGE_SIZE (COFFEE_SECTOR_SIZE / 8) -#endif -/** Start offset of the file system */ -#ifdef COFFEE_CONF_START -#define COFFEE_START COFFEE_CONF_START -#else -#define COFFEE_START CC2538_DEV_FLASH_ADDR -#endif -/** Total size in bytes of the file system */ -#ifdef COFFEE_CONF_SIZE -#define COFFEE_SIZE COFFEE_CONF_SIZE -#else -#define COFFEE_SIZE 0 -#endif -/** Maximal filename length */ -#ifdef COFFEE_CONF_NAME_LENGTH -#define COFFEE_NAME_LENGTH COFFEE_CONF_NAME_LENGTH -#else -#define COFFEE_NAME_LENGTH 40 -#endif -/** Number of file cache entries */ -#ifdef COFFEE_CONF_MAX_OPEN_FILES -#define COFFEE_MAX_OPEN_FILES COFFEE_CONF_MAX_OPEN_FILES -#else -#define COFFEE_MAX_OPEN_FILES 5 -#endif -/** Number of file descriptor entries */ -#ifdef COFFEE_CONF_FD_SET_SIZE -#define COFFEE_FD_SET_SIZE COFFEE_CONF_FD_SET_SIZE -#else -#define COFFEE_FD_SET_SIZE 5 -#endif -/** Maximal amount of log table entries read in one batch */ -#ifdef COFFEE_CONF_LOG_TABLE_LIMIT -#define COFFEE_LOG_TABLE_LIMIT COFFEE_CONF_LOG_TABLE_LIMIT -#else -#define COFFEE_LOG_TABLE_LIMIT 16 -#endif -/** Default reserved file size */ -#ifdef COFFEE_CONF_DYN_SIZE -#define COFFEE_DYN_SIZE COFFEE_CONF_DYN_SIZE -#else -#define COFFEE_DYN_SIZE (COFFEE_SECTOR_SIZE - 50) -#endif -/** Default micro-log size */ -#ifdef COFFEE_CONF_LOG_SIZE -#define COFFEE_LOG_SIZE COFFEE_CONF_LOG_SIZE -#else -#define COFFEE_LOG_SIZE (4 * COFFEE_PAGE_SIZE) -#endif -/** Whether Coffee will use micro logs */ -#ifdef COFFEE_CONF_MICRO_LOGS -#define COFFEE_MICRO_LOGS COFFEE_CONF_MICRO_LOGS -#else -#define COFFEE_MICRO_LOGS 0 -#endif -/** Whether files are expected to be appended to only */ -#ifdef COFFEE_CONF_APPEND_ONLY -#define COFFEE_APPEND_ONLY COFFEE_CONF_APPEND_ONLY -#else -#define COFFEE_APPEND_ONLY 1 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Coffee port macros - * @{ - */ -/** Erase */ -#define COFFEE_ERASE(sector) \ - cfs_coffee_arch_erase(sector) -/** Write */ -#define COFFEE_WRITE(buf, size, offset) \ - cfs_coffee_arch_write((buf), (size), (offset)) -/** Read */ -#define COFFEE_READ(buf, size, offset) \ - cfs_coffee_arch_read((buf), (size), (offset)) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Coffee port types - * @{ - */ -typedef int16_t coffee_page_t; /**< Page */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Coffee port functions - * @{ - */ - -/** \brief Erases a device sector - * \param sector Sector to erase - */ -void cfs_coffee_arch_erase(uint16_t sector); - -/** \brief Writes a buffer to the device - * \param buf Pointer to the buffer - * \param size Byte size of the buffer - * \param offset Device offset to write to - */ -void cfs_coffee_arch_write(const void *buf, unsigned int size, - cfs_offset_t offset); - -/** \brief Reads from the device to a buffer - * \param buf Pointer to the buffer - * \param size Byte size of the buffer - * \param offset Device offset to read from - */ -void cfs_coffee_arch_read(void *buf, unsigned int size, cfs_offset_t offset); - -/** @} */ - -#endif /* COFFEE_CONF_CUSTOM_PORT */ -#endif /* CFS_COFFEE_ARCH_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/clock.c b/arch/cpu/cc2538/clock.c deleted file mode 100644 index 839c72242..000000000 --- a/arch/cpu/cc2538/clock.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-clock cc2538 Clock - * - * Implementation of the clock module for the cc2538 - * - * To implement the clock functionality, we use the SysTick peripheral on the - * cortex-M3. We run the system clock at a configurable speed and set the - * SysTick to give us 128 interrupts / sec. However, the Sleep Timer counter - * value is used for the number of elapsed ticks in order to avoid a - * significant time drift caused by PM1/2. Contrary to the Sleep Timer, the - * SysTick peripheral is indeed frozen during PM1/2, so adjusting upon wake-up - * a tick counter based on this peripheral would hardly be accurate. - * @{ - * - * \file - * Clock driver implementation for the TI cc2538 - */ -#include "contiki.h" -#include "cc2538_cm3.h" -#include "reg.h" -#include "cpu.h" -#include "dev/gptimer.h" -#include "dev/sys-ctrl.h" - -#include "sys/energest.h" -#include "sys/etimer.h" -#include "sys/rtimer.h" - -#include -/*---------------------------------------------------------------------------*/ -#define RTIMER_CLOCK_TICK_RATIO (RTIMER_SECOND / CLOCK_SECOND) - -/* Prescaler for GPT0:Timer A used for clock_delay_usec(). */ -#if SYS_CTRL_SYS_CLOCK < SYS_CTRL_1MHZ -#error System clock speeds below 1MHz are not supported -#endif -#define PRESCALER_VALUE (SYS_CTRL_SYS_CLOCK / SYS_CTRL_1MHZ - 1) - -/* Period of the SysTick counter expressed as a number of ticks */ -#if SYS_CTRL_SYS_CLOCK % CLOCK_SECOND -/* Too low clock speeds will lead to reduced accurracy */ -#error System clock speed too slow for CLOCK_SECOND, accuracy reduced -#endif -#define SYSTICK_PERIOD (SYS_CTRL_SYS_CLOCK / CLOCK_SECOND) - -static volatile uint64_t rt_ticks_startup = 0, rt_ticks_epoch = 0; -/*---------------------------------------------------------------------------*/ -/** - * \brief Arch-specific implementation of clock_init for the cc2538 - * - * We initialise the SysTick to fire 128 interrupts per second, giving us a - * value of 128 for CLOCK_SECOND - * - * We also initialise GPT0:Timer A, which is used by clock_delay_usec(). - * We use 16-bit range (individual), count-down, one-shot, no interrupts. - * The prescaler is computed according to the system clock in order to get 1 - * tick per usec. - */ -void -clock_init(void) -{ - SysTick_Config(SYSTICK_PERIOD); - - /* - * Remove the clock gate to enable GPT0 and then initialise it - * We only use GPT0 for clock_delay_usec. We initialise it here so we can - * have it ready when it's needed - */ - REG(SYS_CTRL_RCGCGPT) |= SYS_CTRL_RCGCGPT_GPT0; - - /* Make sure GPT0 is off */ - REG(GPT_0_BASE + GPTIMER_CTL) = 0; - - /* 16-bit */ - REG(GPT_0_BASE + GPTIMER_CFG) = 0x04; - - /* One-Shot, Count Down, No Interrupts */ - REG(GPT_0_BASE + GPTIMER_TAMR) = GPTIMER_TAMR_TAMR_ONE_SHOT; - - /* Prescale depending on system clock used */ - REG(GPT_0_BASE + GPTIMER_TAPR) = PRESCALER_VALUE; -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - return rt_ticks_startup / RTIMER_CLOCK_TICK_RATIO; -} -/*---------------------------------------------------------------------------*/ -void -clock_set_seconds(unsigned long sec) -{ - rt_ticks_epoch = (uint64_t)sec * RTIMER_SECOND; -} -/*---------------------------------------------------------------------------*/ -unsigned long -clock_seconds(void) -{ - return rt_ticks_epoch / RTIMER_SECOND; -} -/*---------------------------------------------------------------------------*/ -void -clock_wait(clock_time_t i) -{ - clock_time_t start; - - start = clock_time(); - while(clock_time() - start < (clock_time_t)i); -} -/*---------------------------------------------------------------------------*/ -/* - * Arch-specific implementation of clock_delay_usec for the cc2538 - * - * See clock_init() for GPT0 Timer A's configuration - */ -void -clock_delay_usec(uint16_t dt) -{ - REG(GPT_0_BASE + GPTIMER_TAILR) = dt; - REG(GPT_0_BASE + GPTIMER_CTL) |= GPTIMER_CTL_TAEN; - - /* One-Shot mode: TAEN will be cleared when the timer reaches 0 */ - while(REG(GPT_0_BASE + GPTIMER_CTL) & GPTIMER_CTL_TAEN); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Obsolete delay function but we implement it here since some code - * still uses it - */ -void -clock_delay(unsigned int i) -{ - clock_delay_usec(i); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Update the software clock ticks and seconds - * - * This function is used to update the software tick counters whenever the - * system clock might have changed, which can occur upon a SysTick ISR or upon - * wake-up from PM1/2. - * - * For the software clock ticks counter, the Sleep Timer counter value is used - * as the base tick value, and extended to a 64-bit value thanks to a detection - * of wraparounds. - * - * For the seconds counter, the changes of the Sleep Timer counter value are - * added to the reference time, which is either the startup time or the value - * passed to clock_set_seconds(). - * - * This function polls the etimer process if an etimer has expired. - */ -static void -update_ticks(void) -{ - rtimer_clock_t now; - uint64_t prev_rt_ticks_startup, cur_rt_ticks_startup; - uint32_t cur_rt_ticks_startup_hi; - - now = RTIMER_NOW(); - prev_rt_ticks_startup = rt_ticks_startup; - - cur_rt_ticks_startup_hi = prev_rt_ticks_startup >> 32; - if(now < (rtimer_clock_t)prev_rt_ticks_startup) { - cur_rt_ticks_startup_hi++; - } - cur_rt_ticks_startup = (uint64_t)cur_rt_ticks_startup_hi << 32 | now; - rt_ticks_startup = cur_rt_ticks_startup; - - rt_ticks_epoch += cur_rt_ticks_startup - prev_rt_ticks_startup; - - /* - * Inform the etimer library that the system clock has changed and that an - * etimer might have expired. - */ - if(etimer_pending()) { - etimer_request_poll(); - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Adjust the clock following missed SysTick ISRs - * - * This function is useful when coming out of PM1/2, during which the system - * clock is stopped. We adjust the clock counters like after any SysTick ISR. - * - * \note This function is only meant to be used by lpm_exit(). Applications - * should really avoid calling this - */ -void -clock_adjust(void) -{ - /* Halt the SysTick while adjusting */ - SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; - - update_ticks(); - - /* Re-Start the SysTick */ - SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief The clock Interrupt Service Routine - * - * It polls the etimer process if an etimer has expired. It also updates the - * software clock tick and seconds counter. - */ -void -clock_isr(void) -{ - update_ticks(); -} -/*---------------------------------------------------------------------------*/ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/cpu.h b/arch/cpu/cc2538/cpu.h deleted file mode 100644 index 4ed9aa56f..000000000 --- a/arch/cpu/cc2538/cpu.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-cpu cc2538 CPU - * - * CPU-specific functions for the cc2538 core - * @{ - * - * \file - * Header file with prototypes for interrupt control on the cc2538 - * Cortex-M3 micro - * - */ -#ifndef CPU_H_ -#define CPU_H_ - -#include "cc2538_cm3.h" - -/** \brief Enables all CPU interrupts */ -#define INTERRUPTS_ENABLE() __enable_irq() - -/** \brief Disables all CPU interrupts. */ -#define INTERRUPTS_DISABLE() __disable_irq() - -#endif /* CPU_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dbg.c b/arch/cpu/cc2538/dbg.c deleted file mode 100644 index 7b33bc471..000000000 --- a/arch/cpu/cc2538/dbg.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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 "contiki.h" - -#include "dev/uart.h" -#include "usb/usb-serial.h" - -#include -/*---------------------------------------------------------------------------*/ -#ifndef DBG_CONF_USB -#define DBG_CONF_USB 0 -#endif - -#if DBG_CONF_USB -#define write_byte(b) usb_serial_writeb(b) -#define flush() usb_serial_flush() -#else -#define write_byte(b) uart_write_byte(DBG_CONF_UART, b) -#define flush() -#endif -/*---------------------------------------------------------------------------*/ -#define SLIP_END 0300 -/*---------------------------------------------------------------------------*/ -int -dbg_putchar(int c) -{ -#if DBG_CONF_SLIP_MUX - static char debug_frame = 0; - - if(!debug_frame) { - write_byte(SLIP_END); - write_byte('\r'); - debug_frame = 1; - } -#endif - - write_byte(c); - - if(c == '\n') { -#if DBG_CONF_SLIP_MUX - write_byte(SLIP_END); - debug_frame = 0; -#endif - flush(); - } - return c; -} -/*---------------------------------------------------------------------------*/ -unsigned int -dbg_send_bytes(const unsigned char *s, unsigned int len) -{ - unsigned int i = 0; - - while(s && *s != 0) { - if(i >= len) { - break; - } - putchar(*s++); - i++; - } - return i; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc2538/dev/adc.c b/arch/cpu/cc2538/dev/adc.c deleted file mode 100644 index 0cd2f5da8..000000000 --- a/arch/cpu/cc2538/dev/adc.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-adc - * @{ - * - * \file - * Implementation of the cc2538 ADC driver - */ -#include "contiki.h" -#include "dev/soc-adc.h" -#include "dev/cctest.h" -#include "dev/rfcore-xreg.h" -#include "dev/adc.h" -#include "reg.h" - -#include - -/*---------------------------------------------------------------------------*/ -void -adc_init(void) -{ - /* Start conversions only manually */ - REG(SOC_ADC_ADCCON1) |= SOC_ADC_ADCCON1_STSEL; -} -/*---------------------------------------------------------------------------*/ -int16_t -adc_get(uint8_t channel, uint8_t ref, uint8_t div) -{ - uint32_t cctest_tr0, rfcore_xreg_atest; - int16_t res; - - /* On-chip temperature sensor */ - if(channel == SOC_ADC_ADCCON_CH_TEMP) { - /* Connect the temperature sensor to the ADC */ - cctest_tr0 = REG(CCTEST_TR0); - REG(CCTEST_TR0) = cctest_tr0 | CCTEST_TR0_ADCTM; - - /* Enable the temperature sensor */ - rfcore_xreg_atest = REG(RFCORE_XREG_ATEST); - REG(RFCORE_XREG_ATEST) = (rfcore_xreg_atest & ~RFCORE_XREG_ATEST_ATEST_CTRL) | - RFCORE_XREG_ATEST_ATEST_CTRL_TEMP; - } - - /* Start a single extra conversion with the given parameters */ - REG(SOC_ADC_ADCCON3) = (REG(SOC_ADC_ADCCON3) & - ~(SOC_ADC_ADCCON3_EREF | SOC_ADC_ADCCON3_EDIV | SOC_ADC_ADCCON3_ECH)) | - ref | div | channel; - - /* Poll until end of conversion */ - while(!(REG(SOC_ADC_ADCCON1) & SOC_ADC_ADCCON1_EOC)); - - /* Read conversion result, reading SOC_ADC_ADCH last to clear - * SOC_ADC_ADCCON1.EOC */ - res = REG(SOC_ADC_ADCL) & 0xfc; - res |= REG(SOC_ADC_ADCH) << 8; - - /* On-chip temperature sensor */ - if(channel == SOC_ADC_ADCCON_CH_TEMP) { - /* Restore the initial temperature sensor state and connection (better for - * power consumption) */ - REG(RFCORE_XREG_ATEST) = rfcore_xreg_atest; - REG(CCTEST_TR0) = cctest_tr0; - } - - /* Return conversion result */ - return res; -} - -/** @} */ diff --git a/arch/cpu/cc2538/dev/adc.h b/arch/cpu/cc2538/dev/adc.h deleted file mode 100644 index 4610be4ae..000000000 --- a/arch/cpu/cc2538/dev/adc.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-adc cc2538 ADC - * - * Driver for the cc2538 ADC controller - * @{ - * - * \file - * Header file for the cc2538 ADC driver - */ -#ifndef ADC_H_ -#define ADC_H_ - -#include "contiki.h" -#include "dev/soc-adc.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \name ADC functions - * @{ - */ - -/** \brief Initializes the ADC controller */ -void adc_init(void); - -/** \brief Performs a single conversion on a given ADC channel - * \param channel The channel used for the conversion: \c SOC_ADC_ADCCON_CH_x - * \param ref The reference voltage used for the conversion: \c SOC_ADC_ADCCON_REF_x - * \param div The decimation rate used for the conversion: \c SOC_ADC_ADCCON_DIV_x - * \return Signed 16-bit conversion result: 2's complement, ENOBs in MSBs - * \note PD[5:4] are not usable when the temperature sensor is selected. - */ -int16_t adc_get(uint8_t channel, uint8_t ref, uint8_t div); - -/** @} */ - -#endif /* ADC_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/aes.c b/arch/cpu/cc2538/dev/aes.c deleted file mode 100644 index 29b3977c5..000000000 --- a/arch/cpu/cc2538/dev/aes.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Original file: - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538-aes - * @{ - * - * \file - * Implementation of the cc2538 AES driver - */ -#include "contiki.h" -#include "dev/rom-util.h" -#include "dev/nvic.h" -#include "dev/aes.h" -#include "reg.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -uint8_t -aes_load_keys(const void *keys, uint8_t key_size, uint8_t count, - uint8_t start_area) -{ - uint32_t aes_key_store_size; - uint32_t areas; - uint64_t aligned_keys[AES_KEY_AREAS * 128 / 8 / sizeof(uint64_t)]; - int i; - - if(REG(AES_CTRL_ALG_SEL) != 0x00000000) { - return CRYPTO_RESOURCE_IN_USE; - } - - /* 192-bit keys must be padded to 256 bits */ - if(key_size == AES_KEY_STORE_SIZE_KEY_SIZE_192) { - for(i = 0; i < count; i++) { - rom_util_memcpy(&aligned_keys[i << 2], &((const uint64_t *)keys)[i * 3], - 192 / 8); - aligned_keys[(i << 2) + 3] = 0; - } - } - - /* Change count to the number of 128-bit key areas */ - if(key_size != AES_KEY_STORE_SIZE_KEY_SIZE_128) { - count <<= 1; - } - - /* The keys base address needs to be 4-byte aligned */ - if(key_size != AES_KEY_STORE_SIZE_KEY_SIZE_192) { - rom_util_memcpy(aligned_keys, keys, count << 4); - } - - /* Workaround for AES registers not retained after PM2 */ - REG(AES_CTRL_INT_CFG) = AES_CTRL_INT_CFG_LEVEL; - REG(AES_CTRL_INT_EN) = AES_CTRL_INT_EN_DMA_IN_DONE | - AES_CTRL_INT_EN_RESULT_AV; - - /* Configure master control module */ - REG(AES_CTRL_ALG_SEL) = AES_CTRL_ALG_SEL_KEYSTORE; - - /* Clear any outstanding events */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE | - AES_CTRL_INT_CLR_RESULT_AV; - - /* Configure key store module (areas, size) - * Note that writing AES_KEY_STORE_SIZE deletes all stored keys */ - aes_key_store_size = REG(AES_KEY_STORE_SIZE); - if((aes_key_store_size & AES_KEY_STORE_SIZE_KEY_SIZE_M) != key_size) { - REG(AES_KEY_STORE_SIZE) = (aes_key_store_size & - ~AES_KEY_STORE_SIZE_KEY_SIZE_M) | key_size; - } - - /* Free possibly already occupied key areas */ - areas = ((0x00000001 << count) - 1) << start_area; - REG(AES_KEY_STORE_WRITTEN_AREA) = areas; - - /* Enable key areas to write */ - REG(AES_KEY_STORE_WRITE_AREA) = areas; - - /* Configure DMAC - * Enable DMA channel 0 */ - REG(AES_DMAC_CH0_CTRL) = AES_DMAC_CH_CTRL_EN; - - /* Base address of the keys in ext. memory */ - REG(AES_DMAC_CH0_EXTADDR) = (uint32_t)aligned_keys; - - /* Total keys length in bytes (e.g. 16 for 1 x 128-bit key) */ - REG(AES_DMAC_CH0_DMALENGTH) = (REG(AES_DMAC_CH0_DMALENGTH) & - ~AES_DMAC_CH_DMALENGTH_DMALEN_M) | - (count << (4 + AES_DMAC_CH_DMALENGTH_DMALEN_S)); - - /* Wait for operation to complete */ - while(!(REG(AES_CTRL_INT_STAT) & AES_CTRL_INT_STAT_RESULT_AV)); - - /* Check for absence of errors in DMA and key store */ - if(REG(AES_CTRL_INT_STAT) & AES_CTRL_INT_STAT_DMA_BUS_ERR) { - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_BUS_ERR; - /* Disable master control / DMA clock */ - REG(AES_CTRL_ALG_SEL) = 0x00000000; - return CRYPTO_DMA_BUS_ERROR; - } - if(REG(AES_CTRL_INT_STAT) & AES_CTRL_INT_STAT_KEY_ST_WR_ERR) { - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_KEY_ST_WR_ERR; - /* Disable master control / DMA clock */ - REG(AES_CTRL_ALG_SEL) = 0x00000000; - return AES_KEYSTORE_WRITE_ERROR; - } - - /* Acknowledge the interrupt */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE | - AES_CTRL_INT_CLR_RESULT_AV; - - /* Disable master control / DMA clock */ - REG(AES_CTRL_ALG_SEL) = 0x00000000; - - /* Check status, if error return error code */ - if((REG(AES_KEY_STORE_WRITTEN_AREA) & areas) != areas) { - return AES_KEYSTORE_WRITE_ERROR; - } - - return CRYPTO_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -aes_auth_crypt_start(uint32_t ctrl, uint8_t key_area, const void *iv, - const void *adata, uint16_t adata_len, - const void *data_in, void *data_out, uint16_t data_len, - struct process *process) -{ - if(REG(AES_CTRL_ALG_SEL) != 0x00000000) { - return CRYPTO_RESOURCE_IN_USE; - } - - /* Workaround for AES registers not retained after PM2 */ - REG(AES_CTRL_INT_CFG) = AES_CTRL_INT_CFG_LEVEL; - REG(AES_CTRL_INT_EN) = AES_CTRL_INT_EN_DMA_IN_DONE | - AES_CTRL_INT_EN_RESULT_AV; - - REG(AES_CTRL_ALG_SEL) = AES_CTRL_ALG_SEL_AES; - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE | - AES_CTRL_INT_CLR_RESULT_AV; - - REG(AES_KEY_STORE_READ_AREA) = key_area; - - /* Wait until key is loaded to the AES module */ - while(REG(AES_KEY_STORE_READ_AREA) & AES_KEY_STORE_READ_AREA_BUSY); - - /* Check for Key Store read error */ - if(REG(AES_CTRL_INT_STAT) & AES_CTRL_INT_STAT_KEY_ST_RD_ERR) { - /* Clear the Keystore Read error bit */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_KEY_ST_RD_ERR; - /* Disable the master control / DMA clock */ - REG(AES_CTRL_ALG_SEL) = 0x00000000; - return AES_KEYSTORE_READ_ERROR; - } - - if(iv != NULL) { - /* Write initialization vector */ - REG(AES_AES_IV_0) = ((const uint32_t *)iv)[0]; - REG(AES_AES_IV_1) = ((const uint32_t *)iv)[1]; - REG(AES_AES_IV_2) = ((const uint32_t *)iv)[2]; - REG(AES_AES_IV_3) = ((const uint32_t *)iv)[3]; - } - - /* Program AES authentication/crypto operation */ - REG(AES_AES_CTRL) = ctrl; - - /* Write the length of the payload block (lo) */ - REG(AES_AES_C_LENGTH_0) = data_len; - /* Write the length of the payload block (hi) */ - REG(AES_AES_C_LENGTH_1) = 0; - - /* For combined modes only (CCM or GCM) */ - if(ctrl & (AES_AES_CTRL_CCM | AES_AES_CTRL_GCM)) { - /* Write the length of the AAD data block (may be non-block size-aligned) */ - REG(AES_AES_AUTH_LENGTH) = adata_len; - - if(adata_len != 0) { - /* Configure DMAC to fetch the AAD data - * Enable DMA channel 0 */ - REG(AES_DMAC_CH0_CTRL) = AES_DMAC_CH_CTRL_EN; - /* Base address of the AAD data buffer */ - REG(AES_DMAC_CH0_EXTADDR) = (uint32_t)adata; - /* AAD data length in bytes */ - REG(AES_DMAC_CH0_DMALENGTH) = adata_len; - - /* Wait for completion of the AAD data transfer, DMA_IN_DONE */ - while(!(REG(AES_CTRL_INT_STAT) & AES_CTRL_INT_STAT_DMA_IN_DONE)); - - /* Check for the absence of error */ - if(REG(AES_CTRL_INT_STAT) & AES_CTRL_INT_STAT_DMA_BUS_ERR) { - /* Clear the DMA error */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_BUS_ERR; - /* Disable the master control / DMA clock */ - REG(AES_CTRL_ALG_SEL) = 0x00000000; - return CRYPTO_DMA_BUS_ERROR; - } - - /* Clear interrupt status */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE; - } - } - - /* Enable result available bit in interrupt enable */ - REG(AES_CTRL_INT_EN) = AES_CTRL_INT_EN_RESULT_AV; - - if(process != NULL) { - crypto_register_process_notification(process); - NVIC_ClearPendingIRQ(AES_IRQn); - NVIC_EnableIRQ(AES_IRQn); - } - - if(data_len != 0) { - /* Configure DMAC - * Enable DMA channel 0 */ - REG(AES_DMAC_CH0_CTRL) = AES_DMAC_CH_CTRL_EN; - /* Base address of the input payload data buffer */ - REG(AES_DMAC_CH0_EXTADDR) = (uint32_t)data_in; - /* Input payload data length in bytes */ - REG(AES_DMAC_CH0_DMALENGTH) = data_len; - - if(data_out != NULL) { - /* Enable DMA channel 1 */ - REG(AES_DMAC_CH1_CTRL) = AES_DMAC_CH_CTRL_EN; - /* Base address of the output payload data buffer */ - REG(AES_DMAC_CH1_EXTADDR) = (uint32_t)data_out; - /* Output payload data length in bytes */ - REG(AES_DMAC_CH1_DMALENGTH) = data_len; - } - } - - return CRYPTO_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -aes_auth_crypt_check_status(void) -{ - return !!(REG(AES_CTRL_INT_STAT) & - (AES_CTRL_INT_STAT_DMA_BUS_ERR | AES_CTRL_INT_STAT_KEY_ST_WR_ERR | - AES_CTRL_INT_STAT_KEY_ST_RD_ERR | AES_CTRL_INT_STAT_RESULT_AV)); -} -/*---------------------------------------------------------------------------*/ -uint8_t -aes_auth_crypt_get_result(void *iv, void *tag) -{ - uint32_t aes_ctrl_int_stat; - - aes_ctrl_int_stat = REG(AES_CTRL_INT_STAT); - /* Clear the error bits */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_BUS_ERR | - AES_CTRL_INT_CLR_KEY_ST_WR_ERR | - AES_CTRL_INT_CLR_KEY_ST_RD_ERR; - - NVIC_DisableIRQ(AES_IRQn); - crypto_register_process_notification(NULL); - - /* Disable the master control / DMA clock */ - REG(AES_CTRL_ALG_SEL) = 0x00000000; - - if(aes_ctrl_int_stat & AES_CTRL_INT_STAT_DMA_BUS_ERR) { - return CRYPTO_DMA_BUS_ERROR; - } - if(aes_ctrl_int_stat & AES_CTRL_INT_STAT_KEY_ST_WR_ERR) { - return AES_KEYSTORE_WRITE_ERROR; - } - if(aes_ctrl_int_stat & AES_CTRL_INT_STAT_KEY_ST_RD_ERR) { - return AES_KEYSTORE_READ_ERROR; - } - - if(iv != NULL || tag != NULL) { - /* Read result - * Wait for the context ready bit */ - while(!(REG(AES_AES_CTRL) & AES_AES_CTRL_SAVED_CONTEXT_READY)); - - if(iv != NULL) { - /* Read the initialization vector registers */ - ((uint32_t *)iv)[0] = REG(AES_AES_IV_0); - ((uint32_t *)iv)[1] = REG(AES_AES_IV_1); - ((uint32_t *)iv)[2] = REG(AES_AES_IV_2); - ((uint32_t *)iv)[3] = REG(AES_AES_IV_3); - } - - if(tag != NULL) { - /* Read the tag registers */ - ((uint32_t *)tag)[0] = REG(AES_AES_TAG_OUT_0); - ((uint32_t *)tag)[1] = REG(AES_AES_TAG_OUT_1); - ((uint32_t *)tag)[2] = REG(AES_AES_TAG_OUT_2); - ((uint32_t *)tag)[3] = REG(AES_AES_TAG_OUT_3); - } - } - - /* Clear the interrupt status */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE | - AES_CTRL_INT_CLR_RESULT_AV; - - return CRYPTO_SUCCESS; -} - -/** @} */ diff --git a/arch/cpu/cc2538/dev/aes.h b/arch/cpu/cc2538/dev/aes.h deleted file mode 100644 index 19366e680..000000000 --- a/arch/cpu/cc2538/dev/aes.h +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Original file: - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538-crypto - * @{ - * - * \defgroup cc2538-aes cc2538 AES - * - * Driver for the cc2538 AES modes of the security core - * @{ - * - * \file - * Header file for the cc2538 AES driver - */ -#ifndef AES_H_ -#define AES_H_ - -#include "contiki.h" -#include "dev/crypto.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/** \name AES register offsets - * @{ - */ -#define AES_DMAC_CH0_CTRL 0x4008B000 /**< Channel 0 control */ -#define AES_DMAC_CH0_EXTADDR 0x4008B004 /**< Channel 0 external address */ -#define AES_DMAC_CH0_DMALENGTH 0x4008B00C /**< Channel 0 DMA length */ -#define AES_DMAC_STATUS 0x4008B018 /**< DMAC status */ -#define AES_DMAC_SWRES 0x4008B01C /**< DMAC software reset */ -#define AES_DMAC_CH1_CTRL 0x4008B020 /**< Channel 1 control */ -#define AES_DMAC_CH1_EXTADDR 0x4008B024 /**< Channel 1 external address */ -#define AES_DMAC_CH1_DMALENGTH 0x4008B02C /**< Channel 1 DMA length */ -#define AES_DMAC_MST_RUNPARAMS 0x4008B078 /**< DMAC master run-time parameters */ -#define AES_DMAC_PERSR 0x4008B07C /**< DMAC port error raw status */ -#define AES_DMAC_OPTIONS 0x4008B0F8 /**< DMAC options */ -#define AES_DMAC_VERSION 0x4008B0FC /**< DMAC version */ -#define AES_KEY_STORE_WRITE_AREA \ - 0x4008B400 /**< Key store write area */ -#define AES_KEY_STORE_WRITTEN_AREA \ - 0x4008B404 /**< Key store written area */ -#define AES_KEY_STORE_SIZE 0x4008B408 /**< Key store size */ -#define AES_KEY_STORE_READ_AREA 0x4008B40C /**< Key store read area */ -#define AES_AES_KEY2_0 0x4008B500 /**< AES_KEY2_0 / AES_GHASH_H_IN_0 */ -#define AES_AES_KEY2_1 0x4008B504 /**< AES_KEY2_1 / AES_GHASH_H_IN_1 */ -#define AES_AES_KEY2_2 0x4008B508 /**< AES_KEY2_2 / AES_GHASH_H_IN_2 */ -#define AES_AES_KEY2_3 0x4008B50C /**< AES_KEY2_3 / AES_GHASH_H_IN_3 */ -#define AES_AES_KEY3_0 0x4008B510 /**< AES_KEY3_0 / AES_KEY2_4 */ -#define AES_AES_KEY3_1 0x4008B514 /**< AES_KEY3_1 / AES_KEY2_5 */ -#define AES_AES_KEY3_2 0x4008B518 /**< AES_KEY3_2 / AES_KEY2_6 */ -#define AES_AES_KEY3_3 0x4008B51C /**< AES_KEY3_3 / AES_KEY2_7 */ -#define AES_AES_IV_0 0x4008B540 /**< AES initialization vector */ -#define AES_AES_IV_1 0x4008B544 /**< AES initialization vector */ -#define AES_AES_IV_2 0x4008B548 /**< AES initialization vector */ -#define AES_AES_IV_3 0x4008B54C /**< AES initialization vector */ -#define AES_AES_CTRL 0x4008B550 /**< AES input/output buffer control and mode */ -#define AES_AES_C_LENGTH_0 0x4008B554 /**< AES crypto length (LSW) */ -#define AES_AES_C_LENGTH_1 0x4008B558 /**< AES crypto length (MSW) */ -#define AES_AES_AUTH_LENGTH 0x4008B55C /**< Authentication length */ -#define AES_AES_DATA_IN_OUT_0 0x4008B560 /**< Data input/output */ -#define AES_AES_DATA_IN_OUT_1 0x4008B564 /**< Data Input/Output */ -#define AES_AES_DATA_IN_OUT_2 0x4008B568 /**< Data Input/Output */ -#define AES_AES_DATA_IN_OUT_3 0x4008B56C /**< Data Input/Output */ -#define AES_AES_TAG_OUT_0 0x4008B570 /**< TAG */ -#define AES_AES_TAG_OUT_1 0x4008B574 /**< TAG */ -#define AES_AES_TAG_OUT_2 0x4008B578 /**< TAG */ -#define AES_AES_TAG_OUT_3 0x4008B57C /**< TAG */ -#define AES_HASH_DATA_IN_0 0x4008B600 /**< HASH data input */ -#define AES_HASH_DATA_IN_1 0x4008B604 /**< HASH data input */ -#define AES_HASH_DATA_IN_2 0x4008B608 /**< HASH data input */ -#define AES_HASH_DATA_IN_3 0x4008B60C /**< HASH data input */ -#define AES_HASH_DATA_IN_4 0x4008B610 /**< HASH data input */ -#define AES_HASH_DATA_IN_5 0x4008B614 /**< HASH data input */ -#define AES_HASH_DATA_IN_6 0x4008B618 /**< HASH data input */ -#define AES_HASH_DATA_IN_7 0x4008B61C /**< HASH data input */ -#define AES_HASH_DATA_IN_8 0x4008B620 /**< HASH data input */ -#define AES_HASH_DATA_IN_9 0x4008B624 /**< HASH data input */ -#define AES_HASH_DATA_IN_10 0x4008B628 /**< HASH data input */ -#define AES_HASH_DATA_IN_11 0x4008B62C /**< HASH data input */ -#define AES_HASH_DATA_IN_12 0x4008B630 /**< HASH data input */ -#define AES_HASH_DATA_IN_13 0x4008B634 /**< HASH data input */ -#define AES_HASH_DATA_IN_14 0x4008B638 /**< HASH data input */ -#define AES_HASH_DATA_IN_15 0x4008B63C /**< HASH data input */ -#define AES_HASH_IO_BUF_CTRL 0x4008B640 /**< Input/output buffer control and status */ -#define AES_HASH_MODE_IN 0x4008B644 /**< Hash mode */ -#define AES_HASH_LENGTH_IN_L 0x4008B648 /**< Hash length */ -#define AES_HASH_LENGTH_IN_H 0x4008B64C /**< Hash length */ -#define AES_HASH_DIGEST_A 0x4008B650 /**< Hash digest */ -#define AES_HASH_DIGEST_B 0x4008B654 /**< Hash digest */ -#define AES_HASH_DIGEST_C 0x4008B658 /**< Hash digest */ -#define AES_HASH_DIGEST_D 0x4008B65C /**< Hash digest */ -#define AES_HASH_DIGEST_E 0x4008B660 /**< Hash digest */ -#define AES_HASH_DIGEST_F 0x4008B664 /**< Hash digest */ -#define AES_HASH_DIGEST_G 0x4008B668 /**< Hash digest */ -#define AES_HASH_DIGEST_H 0x4008B66C /**< Hash digest */ -#define AES_CTRL_ALG_SEL 0x4008B700 /**< Algorithm select */ -#define AES_CTRL_PROT_EN 0x4008B704 /**< Master PROT privileged access enable */ -#define AES_CTRL_SW_RESET 0x4008B740 /**< Software reset */ -#define AES_CTRL_INT_CFG 0x4008B780 /**< Interrupt configuration */ -#define AES_CTRL_INT_EN 0x4008B784 /**< Interrupt enable */ -#define AES_CTRL_INT_CLR 0x4008B788 /**< Interrupt clear */ -#define AES_CTRL_INT_SET 0x4008B78C /**< Interrupt set */ -#define AES_CTRL_INT_STAT 0x4008B790 /**< Interrupt status */ -#define AES_CTRL_OPTIONS 0x4008B7F8 /**< Options */ -#define AES_CTRL_VERSION 0x4008B7FC /**< Version */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_DMAC_CHx_CTRL registers bit fields - * @{ - */ -#define AES_DMAC_CH_CTRL_PRIO 0x00000002 /**< Channel priority 0: Low 1: High */ -#define AES_DMAC_CH_CTRL_EN 0x00000001 /**< Channel enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_DMAC_CHx_DMALENGTH registers bit fields - * @{ - */ -#define AES_DMAC_CH_DMALENGTH_DMALEN_M \ - 0x0000FFFF /**< Channel DMA length in bytes mask */ -#define AES_DMAC_CH_DMALENGTH_DMALEN_S 0 /**< Channel DMA length in bytes shift */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_DMAC_STATUS register bit fields - * @{ - */ -#define AES_DMAC_STATUS_PORT_ERR \ - 0x00020000 /**< AHB port transfer errors */ -#define AES_DMAC_STATUS_CH1_ACT 0x00000002 /**< Channel 1 active (DMA transfer on-going) */ -#define AES_DMAC_STATUS_CH0_ACT 0x00000001 /**< Channel 0 active (DMA transfer on-going) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_DMAC_SWRES register bit fields - * @{ - */ -#define AES_DMAC_SWRES_SWRES 0x00000001 /**< Software reset enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_DMAC_MST_RUNPARAMS register bit fields - * @{ - */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_BURST_SIZE_4 \ - (2 << 12) /**< Maximum burst size: 4 bytes */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_BURST_SIZE_8 \ - (3 << 12) /**< Maximum burst size: 8 bytes */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_BURST_SIZE_16 \ - (4 << 12) /**< Maximum burst size: 16 bytes */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_BURST_SIZE_32 \ - (5 << 12) /**< Maximum burst size: 32 bytes */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_BURST_SIZE_64 \ - (6 << 12) /**< Maximum burst size: 64 bytes */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_BURST_SIZE_M \ - 0x0000F000 /**< Maximum burst size mask */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_BURST_SIZE_S \ - 12 /**< Maximum burst size shift */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_IDLE_EN \ - 0x00000800 /**< Idle insertion between bursts */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_INCR_EN \ - 0x00000400 /**< Fixed-length burst or single transfers */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_LOCK_EN \ - 0x00000200 /**< Locked transfers */ -#define AES_DMAC_MST_RUNPARAMS_AHB_MST1_BIGEND \ - 0x00000100 /**< Big endian AHB master */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_DMAC_PERSR register bit fields - * @{ - */ -#define AES_DMAC_PERSR_PORT1_AHB_ERROR \ - 0x00001000 /**< AHB bus error */ -#define AES_DMAC_PERSR_PORT1_CHANNEL \ - 0x00000200 /**< Last serviced channel (0 or 1) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_DMAC_OPTIONS register bit fields - * @{ - */ -#define AES_DMAC_OPTIONS_NR_OF_CHANNELS_M \ - 0x00000F00 /**< Number of channels implemented mask */ -#define AES_DMAC_OPTIONS_NR_OF_CHANNELS_S \ - 8 /**< Number of channels implemented shift */ -#define AES_DMAC_OPTIONS_NR_OF_PORTS_M \ - 0x00000007 /**< Number of ports implemented mask */ -#define AES_DMAC_OPTIONS_NR_OF_PORTS_S 0 /**< Number of ports implemented shift */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_DMAC_VERSION register bit fields - * @{ - */ -#define AES_DMAC_VERSION_HW_MAJOR_VERSION_M \ - 0x0F000000 /**< Major version number mask */ -#define AES_DMAC_VERSION_HW_MAJOR_VERSION_S \ - 24 /**< Major version number shift */ -#define AES_DMAC_VERSION_HW_MINOR_VERSION_M \ - 0x00F00000 /**< Minor version number mask */ -#define AES_DMAC_VERSION_HW_MINOR_VERSION_S \ - 20 /**< Minor version number shift */ -#define AES_DMAC_VERSION_HW_PATCH_LEVEL_M \ - 0x000F0000 /**< Patch level mask */ -#define AES_DMAC_VERSION_HW_PATCH_LEVEL_S \ - 16 /**< Patch level shift */ -#define AES_DMAC_VERSION_EIP_NUMBER_COMPL_M \ - 0x0000FF00 /**< EIP_NUMBER 1's complement mask */ -#define AES_DMAC_VERSION_EIP_NUMBER_COMPL_S \ - 8 /**< EIP_NUMBER 1's complement shift */ -#define AES_DMAC_VERSION_EIP_NUMBER_M \ - 0x000000FF /**< DMAC EIP-number mask */ -#define AES_DMAC_VERSION_EIP_NUMBER_S 0 /**< DMAC EIP-number shift */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_KEY_STORE_SIZE register bit fields - * @{ - */ -#define AES_KEY_STORE_SIZE_KEY_SIZE_128 1 /**< Key size: 128 bits */ -#define AES_KEY_STORE_SIZE_KEY_SIZE_192 2 /**< Key size: 192 bits */ -#define AES_KEY_STORE_SIZE_KEY_SIZE_256 3 /**< Key size: 256 bits */ -#define AES_KEY_STORE_SIZE_KEY_SIZE_M \ - 0x00000003 /**< Key size mask */ -#define AES_KEY_STORE_SIZE_KEY_SIZE_S 0 /**< Key size shift */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_KEY_STORE_READ_AREA register bit fields - * @{ - */ -#define AES_KEY_STORE_READ_AREA_BUSY \ - 0x80000000 /**< Key store operation busy */ -#define AES_KEY_STORE_READ_AREA_RAM_AREA_M \ - 0x0000000F /**< Key store RAM area select mask */ -#define AES_KEY_STORE_READ_AREA_RAM_AREA_S \ - 0 /**< Key store RAM area select shift */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_AES_CTRL register bit fields - * @{ - */ -#define AES_AES_CTRL_CONTEXT_READY \ - 0x80000000 /**< Context data registers can be overwritten */ -#define AES_AES_CTRL_SAVED_CONTEXT_READY \ - 0x40000000 /**< AES auth. TAG and/or IV block(s) available */ -#define AES_AES_CTRL_SAVE_CONTEXT \ - 0x20000000 /**< Auth. TAG or result IV needs to be stored */ -#define AES_AES_CTRL_CCM_M_M 0x01C00000 /**< CCM auth. field length mask */ -#define AES_AES_CTRL_CCM_M_S 22 /**< CCM auth. field length shift */ -#define AES_AES_CTRL_CCM_L_M 0x00380000 /**< CCM length field width mask */ -#define AES_AES_CTRL_CCM_L_S 19 /**< CCM length field width shift */ -#define AES_AES_CTRL_CCM 0x00040000 /**< AES-CCM mode */ -#define AES_AES_CTRL_GCM 0x00030000 /**< AES-GCM mode */ -#define AES_AES_CTRL_CBC_MAC 0x00008000 /**< AES-CBC MAC mode */ -#define AES_AES_CTRL_CTR_WIDTH_32 (0 << 7) /**< CTR counter width: 32 bits */ -#define AES_AES_CTRL_CTR_WIDTH_64 (1 << 7) /**< CTR counter width: 64 bits */ -#define AES_AES_CTRL_CTR_WIDTH_96 (2 << 7) /**< CTR counter width: 96 bits */ -#define AES_AES_CTRL_CTR_WIDTH_128 \ - (3 << 7) /**< CTR counter width: 128 bits */ -#define AES_AES_CTRL_CTR_WIDTH_M \ - 0x00000180 /**< CTR counter width mask */ -#define AES_AES_CTRL_CTR_WIDTH_S 7 /**< CTR counter width shift */ -#define AES_AES_CTRL_CTR 0x00000040 /**< AES-CTR mode */ -#define AES_AES_CTRL_CBC 0x00000020 /**< AES-CBC mode */ -#define AES_AES_CTRL_KEY_SIZE_128 (1 << 3) /**< Key size: 128 bits */ -#define AES_AES_CTRL_KEY_SIZE_192 (2 << 3) /**< Key size: 192 bits */ -#define AES_AES_CTRL_KEY_SIZE_256 (3 << 3) /**< Key size: 256 bits */ -#define AES_AES_CTRL_KEY_SIZE_M 0x00000018 /**< Key size mask */ -#define AES_AES_CTRL_KEY_SIZE_S 3 /**< Key size shift */ -#define AES_AES_CTRL_DIRECTION_ENCRYPT \ - 0x00000004 /**< Encrypt */ -#define AES_AES_CTRL_INPUT_READY \ - 0x00000002 /**< AES input buffer empty */ -#define AES_AES_CTRL_OUTPUT_READY \ - 0x00000001 /**< AES output block available */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_AES_C_LENGTH_1 register bit fields - * @{ - */ -#define AES_AES_C_LENGTH_1_C_LENGTH_M \ - 0x1FFFFFFF /**< Crypto length bits [60:32] mask */ -#define AES_AES_C_LENGTH_1_C_LENGTH_S 0 /**< Crypto length bits [60:32] shift */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_HASH_IO_BUF_CTRL register bit fields - * @{ - */ -#define AES_HASH_IO_BUF_CTRL_PAD_DMA_MESSAGE \ - 0x00000080 /**< Hash engine message padding required */ -#define AES_HASH_IO_BUF_CTRL_GET_DIGEST \ - 0x00000040 /**< Hash engine digest requested */ -#define AES_HASH_IO_BUF_CTRL_PAD_MESSAGE \ - 0x00000020 /**< Last message data in HASH_DATA_IN, apply hash padding */ -#define AES_HASH_IO_BUF_CTRL_RFD_IN \ - 0x00000004 /**< Hash engine input buffer can accept new data */ -#define AES_HASH_IO_BUF_CTRL_DATA_IN_AV \ - 0x00000002 /**< Start processing HASH_DATA_IN data */ -#define AES_HASH_IO_BUF_CTRL_OUTPUT_FULL \ - 0x00000001 /**< Output buffer registers available */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_HASH_MODE_IN register bit fields - * @{ - */ -#define AES_HASH_MODE_IN_SHA256_MODE \ - 0x00000008 /**< Hash mode */ -#define AES_HASH_MODE_IN_NEW_HASH \ - 0x00000001 /**< New hash session */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_CTRL_ALG_SEL register bit fields - * @{ - */ -#define AES_CTRL_ALG_SEL_TAG 0x80000000 /**< DMA operation includes TAG */ -#define AES_CTRL_ALG_SEL_HASH 0x00000004 /**< Select hash engine as DMA destination */ -#define AES_CTRL_ALG_SEL_AES 0x00000002 /**< Select AES engine as DMA source/destination */ -#define AES_CTRL_ALG_SEL_KEYSTORE \ - 0x00000001 /**< Select Key Store as DMA destination */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_CTRL_PROT_EN register bit fields - * @{ - */ -#define AES_CTRL_PROT_EN_PROT_EN \ - 0x00000001 /**< m_h_prot[1] asserted for DMA reads towards key store */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_CTRL_SW_RESET register bit fields - * @{ - */ -#define AES_CTRL_SW_RESET_SW_RESET \ - 0x00000001 /**< Reset master control and key store */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_CTRL_INT_CFG register bit fields - * @{ - */ -#define AES_CTRL_INT_CFG_LEVEL 0x00000001 /**< Level interrupt type */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_CTRL_INT_EN register bit fields - * @{ - */ -#define AES_CTRL_INT_EN_DMA_IN_DONE \ - 0x00000002 /**< DMA input done interrupt enabled */ -#define AES_CTRL_INT_EN_RESULT_AV \ - 0x00000001 /**< Result available interrupt enabled */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_CTRL_INT_CLR register bit fields - * @{ - */ -#define AES_CTRL_INT_CLR_DMA_BUS_ERR \ - 0x80000000 /**< Clear DMA bus error status */ -#define AES_CTRL_INT_CLR_KEY_ST_WR_ERR \ - 0x40000000 /**< Clear key store write error status */ -#define AES_CTRL_INT_CLR_KEY_ST_RD_ERR \ - 0x20000000 /**< Clear key store read error status */ -#define AES_CTRL_INT_CLR_DMA_IN_DONE \ - 0x00000002 /**< Clear DMA in done interrupt */ -#define AES_CTRL_INT_CLR_RESULT_AV \ - 0x00000001 /**< Clear result available interrupt */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_CTRL_INT_SET register bit fields - * @{ - */ -#define AES_CTRL_INT_SET_DMA_IN_DONE \ - 0x00000002 /**< Set DMA data in done interrupt */ -#define AES_CTRL_INT_SET_RESULT_AV \ - 0x00000001 /**< Set result available interrupt */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_CTRL_INT_STAT register bit fields - * @{ - */ -#define AES_CTRL_INT_STAT_DMA_BUS_ERR \ - 0x80000000 /**< DMA bus error detected */ -#define AES_CTRL_INT_STAT_KEY_ST_WR_ERR \ - 0x40000000 /**< Write error detected */ -#define AES_CTRL_INT_STAT_KEY_ST_RD_ERR \ - 0x20000000 /**< Read error detected */ -#define AES_CTRL_INT_STAT_DMA_IN_DONE \ - 0x00000002 /**< DMA data in done interrupt status */ -#define AES_CTRL_INT_STAT_RESULT_AV \ - 0x00000001 /**< Result available interrupt status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_CTRL_OPTIONS register bit fields - * @{ - */ -#define AES_CTRL_OPTIONS_TYPE_M 0xFF000000 /**< Device type mask */ -#define AES_CTRL_OPTIONS_TYPE_S 24 /**< Device type shift */ -#define AES_CTRL_OPTIONS_AHBINTERFACE \ - 0x00010000 /**< AHB interface available */ -#define AES_CTRL_OPTIONS_SHA_256 \ - 0x00000100 /**< The HASH core supports SHA-256 */ -#define AES_CTRL_OPTIONS_AES_CCM \ - 0x00000080 /**< AES-CCM available as single operation */ -#define AES_CTRL_OPTIONS_AES_GCM \ - 0x00000040 /**< AES-GCM available as single operation */ -#define AES_CTRL_OPTIONS_AES_256 \ - 0x00000020 /**< AES core supports 256-bit keys */ -#define AES_CTRL_OPTIONS_AES_128 \ - 0x00000010 /**< AES core supports 128-bit keys */ -#define AES_CTRL_OPTIONS_HASH 0x00000004 /**< HASH Core available */ -#define AES_CTRL_OPTIONS_AES 0x00000002 /**< AES core available */ -#define AES_CTRL_OPTIONS_KEYSTORE \ - 0x00000001 /**< KEY STORE available */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES_CTRL_VERSION register bit fields - * @{ - */ -#define AES_CTRL_VERSION_MAJOR_VERSION_M \ - 0x0F000000 /**< Major version number mask */ -#define AES_CTRL_VERSION_MAJOR_VERSION_S \ - 24 /**< Major version number shift */ -#define AES_CTRL_VERSION_MINOR_VERSION_M \ - 0x00F00000 /**< Minor version number mask */ -#define AES_CTRL_VERSION_MINOR_VERSION_S \ - 20 /**< Minor version number shift */ -#define AES_CTRL_VERSION_PATCH_LEVEL_M \ - 0x000F0000 /**< Patch level mask */ -#define AES_CTRL_VERSION_PATCH_LEVEL_S 16 /**< Patch level shift */ -#define AES_CTRL_VERSION_EIP_NUMBER_COMPL_M \ - 0x0000FF00 /**< EIP_NUMBER 1's complement mask */ -#define AES_CTRL_VERSION_EIP_NUMBER_COMPL_S \ - 8 /**< EIP_NUMBER 1's complement shift */ -#define AES_CTRL_VERSION_EIP_NUMBER_M \ - 0x000000FF /**< EIP-120t EIP-number mask */ -#define AES_CTRL_VERSION_EIP_NUMBER_S 0 /**< EIP-120t EIP-number shift */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES drivers return codes - * @{ - */ -#define AES_KEYSTORE_READ_ERROR 5 -#define AES_KEYSTORE_WRITE_ERROR 6 -#define AES_AUTHENTICATION_FAILED 7 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES constants - * @{ - */ -#define AES_KEY_AREAS 8 -#define AES_BLOCK_LEN (128 / 8) -#define AES_IV_LEN AES_BLOCK_LEN -#define AES_TAG_LEN AES_BLOCK_LEN -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES functions - * @{ - */ - -/** \brief Writes keys into the Key RAM - * \param keys Pointer to AES Keys - * \param key_size Key size: \c AES_KEY_STORE_SIZE_KEY_SIZE_x - * \param count Number of keys (1 to \c AES_KEY_AREAS - \p start_area for - * 128-bit keys, 1 to (\c AES_KEY_AREAS - \p start_area) / 2 for 192- and - * 256-bit keys) - * \param start_area Start area in Key RAM where to store the keys (0 to - * \c AES_KEY_AREAS - 1, must be even for 192- and 256-bit keys) - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES error code - * \note Calling this function with a value of \p key_size different from the - * one passed for the previous calls causes the deletion of all previously - * stored keys. - */ -uint8_t aes_load_keys(const void *keys, uint8_t key_size, uint8_t count, - uint8_t start_area); - -/** \brief Starts an AES authentication/crypto operation - * \param ctrl Contents of the \c AES_AES_CTRL register - * \param key_area Area in Key RAM where the key is stored (0 to - * \c AES_KEY_AREAS - 1) - * \param iv Pointer to 128-bit initialization vector, or \c NULL - * \param adata Pointer to additional authenticated data in SRAM, or \c NULL - * \param adata_len Length of additional authenticated data in octets, or \c 0 - * \param data_in Pointer to input payload data in SRAM, or \c NULL - * \param data_out Pointer to output payload data in SRAM (may be \p data_in), - * or \c NULL - * \param data_len Length of payload data in octets, or \c 0 - * \param process Process to be polled upon completion of the operation, or - * \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES error code - * \note This function is only supposed to be called by the AES drivers. - */ -uint8_t aes_auth_crypt_start(uint32_t ctrl, uint8_t key_area, const void *iv, - const void *adata, uint16_t adata_len, - const void *data_in, void *data_out, - uint16_t data_len, struct process *process); - -/** \brief Checks the status of the AES authentication/crypto operation - * \retval false Result not yet available, and no error occurred - * \retval true Result available, or error occurred - * \note This function is only supposed to be called by the AES drivers. - */ -uint8_t aes_auth_crypt_check_status(void); - -/** \brief Gets the result of the AES authentication/crypto operation - * \param iv Pointer to 128-bit result initialization vector, or \c NULL - * \param tag Pointer to 128-bit result tag, or \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES error code - * \note This function must be called only after \c aes_auth_crypt_start(). - * \note This function is only supposed to be called by the AES drivers. - */ -uint8_t aes_auth_crypt_get_result(void *iv, void *tag); - -/** @} */ - -#endif /* AES_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/ana-regs.h b/arch/cpu/cc2538/dev/ana-regs.h deleted file mode 100644 index e8f84a46a..000000000 --- a/arch/cpu/cc2538/dev/ana-regs.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-rfcore - * @{ - * - * \file - * Header with declarations of ANA_REGS module registers. - */ -#ifndef ANA_REGS_H -#define ANA_REGS_H - -/*---------------------------------------------------------------------------*/ -/** - * \name ANA_REGS register offsets - * @{ - */ -#define ANA_REGS_IVCTRL 0x400D6004 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ANA_REGS_IVCTRL register bit masks - * @{ - */ -#define ANA_REGS_IVCTRL_DAC_CURR_CTRL 0x00000030 /**< Controls bias current to DAC */ -#define ANA_REGS_IVCTRL_LODIV_BIAS_CTRL 0x00000008 /**< Controls bias current to LODIV */ -#define ANA_REGS_IVCTRL_TXMIX_DC_CTRL 0x00000004 /**< Controls DC bias in TXMIX */ -#define ANA_REGS_IVCTRL_PA_BIAS_CTRL 0x00000003 /**< Controls bias current to PA */ -/** @} */ - -#endif /* ANA_REGS_H */ -/** @} */ diff --git a/arch/cpu/cc2538/dev/bignum-driver.c b/arch/cpu/cc2538/dev/bignum-driver.c deleted file mode 100644 index 5cff006bb..000000000 --- a/arch/cpu/cc2538/dev/bignum-driver.c +++ /dev/null @@ -1,1064 +0,0 @@ -/* - * Original file: - * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Authors: Andreas Dröscher - * Hu Luo - * Hossein Shafagh - * - * 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. - */ -/** - * \addtogroup cc2538-bignum - * @{ - * - * \file - * Implementation of the cc2538 BigNum driver - * - * bignum_subtract_start bignum_subtract_get_result (subtraction) - * bignum_add_start bignum_add_get_result (addition) - * bignum_mod_start bignum_mod_get_result (modulo) - * bignum_exp_mod_start bignum_exp_mod_get_result (modular exponentiation operation) - * bignum_inv_mod_start bignum_inv_mod_get_result (inverse modulo operation) - * bignum_mul_start bignum_mul_get_result (multiplication) - * bignum_divide_start bignum_divide_get_result (division) - * bignum_cmp_start bignum_cmp_get_result (comparison) - */ -#include "dev/bignum-driver.h" - -#include - -#include "reg.h" -#include "dev/nvic.h" - -#define ASSERT(IF) if(!(IF)) { return PKA_STATUS_INVALID_PARAM; } - -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_mod_start(const uint32_t *number, - const uint8_t number_size, - const uint32_t *modulus, - const uint8_t modulus_size, - uint32_t *result_vector, - struct process *process) -{ - - uint8_t extraBuf; - uint32_t offset; - int i; - - /* Check the arguments. */ - ASSERT(NULL != number); - ASSERT(NULL != modulus); - ASSERT(NULL != result_vector); - - /* make sure no operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* calculate the extra buffer requirement. */ - extraBuf = 2 + modulus_size % 2; - - offset = 0; - - /* Update the A ptr with the offset address of the PKA RAM location - * where the number will be stored. */ - REG(PKA_APTR) = offset >> 2; - - /* Load the number in PKA RAM */ - for(i = 0; i < number_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = number[i]; - } - - /* determine the offset for the next data input. */ - offset += 4 * (i + number_size % 2); - - /* Update the B ptr with the offset address of the PKA RAM location - * where the divisor will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Load the divisor in PKA RAM. */ - for(i = 0; i < modulus_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = modulus[i]; - } - - /* determine the offset for the next data. */ - offset += 4 * (i + extraBuf); - - /* Copy the result vector address location. */ - *result_vector = PKA_RAM_BASE + offset; - - /* Load C ptr with the result location in PKA RAM */ - REG(PKA_CPTR) = offset >> 2; - - /* Load A length registers with Big number length in 32 bit words. */ - REG(PKA_ALENGTH) = number_size; - - /* Load B length registers Divisor length in 32-bit words. */ - REG(PKA_BLENGTH) = modulus_size; - - /* Start the PKCP modulo operation by setting the PKA Function register. */ - REG(PKA_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_MODULO); - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_mod_get_result(uint32_t *buffer, - const uint8_t buffer_size, - const uint32_t result_vector) -{ - - uint32_t regMSWVal; - uint32_t len; - int i; - - /* Check the arguments. */ - ASSERT(NULL != buffer); - ASSERT(result_vector > PKA_RAM_BASE); - ASSERT(result_vector < (PKA_RAM_BASE + PKA_RAM_SIZE)); - - /* verify that the operation is complete. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - /* Get the MSW register value. */ - regMSWVal = REG(PKA_DIVMSW); - - /* Check to make sure that the result vector is not all zeroes. */ - if(regMSWVal & PKA_DIVMSW_RESULT_IS_ZERO) { - return PKA_STATUS_RESULT_0; - } - - /* Get the length of the result. */ - len = ((regMSWVal & PKA_DIVMSW_MSW_ADDRESS_M) + 1) - - ((result_vector - PKA_RAM_BASE) >> 2); - - /* If the size of the buffer provided is less than the result length than - * return error. */ - if(buffer_size < len) { - return PKA_STATUS_BUF_UNDERFLOW; - } - /* copy the result from vector C into the pResult. */ - for(i = 0; i < len; i++) { - buffer[i] = REG(result_vector + 4 * i); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_cmp_start(const uint32_t *number1, - const uint32_t *number2, - const uint8_t size, - struct process *process) -{ - - uint32_t offset; - int i; - - /* Check the arguments. */ - ASSERT(NULL != number1); - ASSERT(NULL != number2); - - offset = 0; - - /* Make sure no operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Update the A ptr with the offset address of the PKA RAM location - * where the first big number will be stored. */ - REG(PKA_APTR) = offset >> 2; - - /* Load the first big number in PKA RAM. */ - for(i = 0; i < size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = number1[i]; - } - - /* Determine the offset in PKA RAM for the next pointer. */ - offset += 4 * (i + size % 2); - - /* Update the B ptr with the offset address of the PKA RAM location - * where the second big number will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Load the second big number in PKA RAM. */ - for(i = 0; i < size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = number2[i]; - } - - /* Load length registers in 32 bit word size. */ - REG(PKA_ALENGTH) = size; - - /* Set the PKA Function register for the compare operation - * and start the operation. */ - REG(PKA_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_COMPARE); - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_cmp_get_result(void) -{ - uint8_t status; - - /* verify that the operation is complete. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - status = PKA_STATUS_OPERATION_INPRG; - return status; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - /* Check the compare register. */ - switch(REG(PKA_COMPARE)) { - case PKA_COMPARE_A_EQUALS_B: - status = PKA_STATUS_SUCCESS; - break; - - case PKA_COMPARE_A_GREATER_THAN_B: - status = PKA_STATUS_A_GR_B; - break; - - case PKA_COMPARE_A_LESS_THAN_B: - status = PKA_STATUS_A_LT_B; - break; - - default: - status = PKA_STATUS_FAILURE; - break; - } - - return status; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_inv_mod_start(const uint32_t *number, - const uint8_t number_size, - const uint32_t *modulus, - const uint8_t modulus_size, - uint32_t *result_vector, - struct process *process) -{ - - uint32_t offset; - int i; - - /* Check the arguments. */ - ASSERT(NULL != number); - ASSERT(NULL != modulus); - ASSERT(NULL != result_vector); - - offset = 0; - - /* Make sure no operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Update the A ptr with the offset address of the PKA RAM location - * where the number will be stored. */ - REG(PKA_APTR) = offset >> 2; - - /* Load the \e number number in PKA RAM. */ - for(i = 0; i < number_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = number[i]; - } - - /* Determine the offset for next data. */ - offset += 4 * (i + number_size % 2); - - /* Update the B ptr with the offset address of the PKA RAM location - * where the modulus will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Load the \e modulus divisor in PKA RAM. */ - for(i = 0; i < modulus_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = modulus[i]; - } - - /* Determine the offset for result data. */ - offset += 4 * (i + modulus_size % 2); - - /* Copy the result vector address location. */ - *result_vector = PKA_RAM_BASE + offset; - - /* Load D ptr with the result location in PKA RAM. */ - REG(PKA_DPTR) = offset >> 2; - - /* Load the respective length registers. */ - REG(PKA_ALENGTH) = number_size; - REG(PKA_BLENGTH) = modulus_size; - - /* set the PKA function to InvMod operation and the start the operation. */ - REG(PKA_FUNCTION) = 0x0000F000; - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_inv_mod_get_result(uint32_t *buffer, - const uint8_t buffer_size, - const uint32_t result_vector) -{ - - uint32_t regMSWVal; - uint32_t len; - int i; - - /* Check the arguments. */ - ASSERT(NULL != buffer); - ASSERT(result_vector > PKA_RAM_BASE); - ASSERT(result_vector < (PKA_RAM_BASE + PKA_RAM_SIZE)); - - /* Verify that the operation is complete. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - /* Get the MSW register value. */ - regMSWVal = REG(PKA_MSW); - - /* Check to make sure that the result vector is not all zeroes. */ - if(regMSWVal & PKA_MSW_RESULT_IS_ZERO) { - return PKA_STATUS_RESULT_0; - } - - /* Get the length of the result */ - len = ((regMSWVal & PKA_MSW_MSW_ADDRESS_M) + 1) - - ((result_vector - PKA_RAM_BASE) >> 2); - - /* Check if the provided buffer length is adequate to store the result - * data. */ - if(buffer_size < len) { - return PKA_STATUS_BUF_UNDERFLOW; - } - - /* Copy the result from vector C into the \e buffer. */ - for(i = 0; i < len; i++) { - buffer[i] = REG(result_vector + 4 * i); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_mul_start(const uint32_t *multiplicand, - const uint8_t multiplicand_size, - const uint32_t *multiplier, - const uint8_t multiplier_size, - uint32_t *result_vector, - struct process *process) -{ - - uint32_t offset; - int i; - - /* Check for the arguments. */ - ASSERT(NULL != multiplicand); - ASSERT(NULL != multiplier); - ASSERT(NULL != result_vector); - - offset = 0; - - /* Make sure no operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Update the A ptr with the offset address of the PKA RAM location - * where the multiplicand will be stored. */ - REG(PKA_APTR) = offset >> 2; - - /* Load the multiplicand in PKA RAM. */ - for(i = 0; i < multiplicand_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = *multiplicand; - multiplicand++; - } - - /* Determine the offset for the next data. */ - offset += 4 * (i + (multiplicand_size % 2)); - - /* Update the B ptr with the offset address of the PKA RAM location - * where the multiplier will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Load the multiplier in PKA RAM. */ - for(i = 0; i < multiplier_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = *multiplier; - multiplier++; - } - - /* Determine the offset for the next data. */ - offset += 4 * (i + (multiplier_size % 2)); - - /* Copy the result vector address location. */ - *result_vector = PKA_RAM_BASE + offset; - - /* Load C ptr with the result location in PKA RAM. */ - REG(PKA_CPTR) = offset >> 2; - - /* Load the respective length registers. */ - REG(PKA_ALENGTH) = multiplicand_size; - REG(PKA_BLENGTH) = multiplier_size; - - /* Set the PKA function to the multiplication and start it. */ - REG(PKA_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_MULTIPLY); - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_mul_get_result(uint32_t *buffer, - uint32_t *buffer_size, - const uint32_t result_vector) -{ - - uint32_t regMSWVal; - uint32_t len; - int i; - - /* Check for arguments. */ - ASSERT(NULL != buffer); - ASSERT(NULL != buffer_size); - ASSERT(result_vector > PKA_RAM_BASE); - ASSERT(result_vector < (PKA_RAM_BASE + PKA_RAM_SIZE)); - - /* Verify that the operation is complete. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - /* Get the MSW register value. */ - regMSWVal = REG(PKA_MSW); - - /* Check to make sure that the result vector is not all zeroes. */ - if(regMSWVal & PKA_MSW_RESULT_IS_ZERO) { - return PKA_STATUS_RESULT_0; - } - - /* Get the length of the result. */ - len = ((regMSWVal & PKA_MSW_MSW_ADDRESS_M) + 1) - - ((result_vector - PKA_RAM_BASE) >> 2); - - /* Make sure that the length of the supplied result buffer is adequate - * to store the resultant. */ - if(*buffer_size < len) { - return PKA_STATUS_BUF_UNDERFLOW; - } - - /* Copy the resultant length. */ - *buffer_size = len; - - /* Copy the result from vector C into the pResult. */ - for(i = 0; i < *buffer_size; i++) { - buffer[i] = REG(result_vector + 4 * i); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_add_start(const uint32_t *number1, - const uint8_t number1_size, - const uint32_t *number2, - const uint8_t number2_size, - uint32_t *result_vector, - struct process *process) -{ - - uint32_t offset; - int i; - - /* Check for arguments. */ - ASSERT(NULL != number1); - ASSERT(NULL != number2); - ASSERT(NULL != result_vector); - - offset = 0; - - /* Make sure no operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Update the A ptr with the offset address of the PKA RAM location - * where the big number 1 will be stored. */ - REG(PKA_APTR) = offset >> 2; - - /* Load the big number 1 in PKA RAM. */ - for(i = 0; i < number1_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = number1[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + (number1_size % 2)); - - /* Update the B ptr with the offset address of the PKA RAM location - * where the big number 2 will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Load the big number 2 in PKA RAM. */ - for(i = 0; i < number2_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = number2[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + (number2_size % 2)); - - /* Copy the result vector address location. */ - *result_vector = PKA_RAM_BASE + offset; - - /* Load C ptr with the result location in PKA RAM. */ - REG(PKA_CPTR) = offset >> 2; - - /* Load respective length registers. */ - REG(PKA_ALENGTH) = number1_size; - REG(PKA_BLENGTH) = number2_size; - - /* Set the function for the add operation and start the operation. */ - REG(PKA_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_ADD); - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_add_get_result(uint32_t *buffer, - uint32_t *buffer_size, - const uint32_t result_vector) -{ - - uint32_t regMSWVal; - uint32_t len; - int i; - - /* Check for the arguments. */ - ASSERT(NULL != buffer); - ASSERT(NULL != buffer_size); - ASSERT(result_vector > PKA_RAM_BASE); - ASSERT(result_vector < (PKA_RAM_BASE + PKA_RAM_SIZE)); - - /* Verify that the operation is complete. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - /* Get the MSW register value. */ - regMSWVal = REG(PKA_MSW); - - /* Check to make sure that the result vector is not all zeroes. */ - if(regMSWVal & PKA_MSW_RESULT_IS_ZERO) { - return PKA_STATUS_RESULT_0; - } - - /* Get the length of the result. */ - len = ((regMSWVal & PKA_MSW_MSW_ADDRESS_M) + 1) - - ((result_vector - PKA_RAM_BASE) >> 2); - - /* Make sure that the supplied result buffer is adequate to store the - * resultant data. */ - if(*buffer_size < len) { - return PKA_STATUS_BUF_UNDERFLOW; - } - - /* Copy the length. */ - *buffer_size = len; - - /* Copy the result from vector C into the provided buffer. */ - for(i = 0; i < *buffer_size; i++) { - buffer[i] = REG(result_vector + 4 * i); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -/* below functions are added by hu luo */ -uint8_t -bignum_subtract_start(const uint32_t *number1, - const uint8_t number1_size, - const uint32_t *number2, - const uint8_t number2_size, - uint32_t *result_vector, - struct process *process) -{ - - uint32_t offset; - int i; - - /* Check for arguments. */ - ASSERT(NULL != number1); - ASSERT(NULL != number2); - ASSERT(NULL != result_vector); - - offset = 0; - - /* Make sure no operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Update the A ptr with the offset address of the PKA RAM location - * where the big number 1 will be stored. */ - REG(PKA_APTR) = offset >> 2; - - /* Load the big number 1 in PKA RAM. */ - for(i = 0; i < number1_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = number1[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + (number1_size % 2)); - - /* Update the B ptr with the offset address of the PKA RAM location - * where the big number 2 will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Load the big number 2 in PKA RAM. */ - for(i = 0; i < number2_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = number2[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + (number2_size % 2)); - - /* Copy the result vector address location. */ - *result_vector = PKA_RAM_BASE + offset; - - /* Load C ptr with the result location in PKA RAM. */ - REG(PKA_CPTR) = offset >> 2; - - /* Load respective length registers. */ - REG(PKA_ALENGTH) = number1_size; - REG(PKA_BLENGTH) = number2_size; - - /* Set the function for the add operation and start the operation. */ - REG(PKA_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_SUBTRACT); - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_subtract_get_result(uint32_t *buffer, - uint32_t *buffer_size, - const uint32_t result_vector) -{ - - uint32_t regMSWVal; - uint32_t len; - int i; - - /* Check for the arguments. */ - ASSERT(NULL != buffer); - ASSERT(NULL != buffer_size); - ASSERT(result_vector > PKA_RAM_BASE); - ASSERT(result_vector < (PKA_RAM_BASE + PKA_RAM_SIZE)); - - /* Verify that the operation is complete. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - /* Get the MSW register value. */ - regMSWVal = REG(PKA_MSW); - - /* Check to make sure that the result vector is not all zeroes. */ - if(regMSWVal & PKA_MSW_RESULT_IS_ZERO) { - return PKA_STATUS_RESULT_0; - } - - /* Get the length of the result. */ - len = ((regMSWVal & PKA_MSW_MSW_ADDRESS_M) + 1) - - ((result_vector - PKA_RAM_BASE) >> 2); - - /* Make sure that the supplied result buffer is adequate to store the - * resultant data. */ - if(*buffer_size < len) { - return PKA_STATUS_BUF_UNDERFLOW; - } - - /* Copy the length. */ - *buffer_size = len; - - /* Copy the result from vector C into the provided buffer. */ - for(i = 0; i < *buffer_size; i++) { - buffer[i] = REG(result_vector + 4 * i); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_exp_mod_start(const uint32_t *number, - const uint8_t number_size, - const uint32_t *modulus, - const uint8_t modulus_size, - const uint32_t *base, - const uint8_t base_size, - uint32_t *result_vector, - struct process *process) -{ - uint32_t offset; - int i; - - /* Check for the arguments. */ - ASSERT(NULL != number); - ASSERT(NULL != modulus); - ASSERT(NULL != base); - ASSERT(NULL != result_vector); - ASSERT(modulus != base); - - offset = 0; - - /* Make sure no PKA operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Update the A ptr with the offset address of the PKA RAM location - * where the exponent will be stored. */ - REG(PKA_APTR) = offset >> 2; - - /* Load the Exponent in PKA RAM. */ - for(i = 0; i < number_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = number[i]; - } - - /* Determine the offset for the next data(BPTR). */ - offset += 4 * (i + number_size % 2); - /* Update the B ptr with the offset address of the PKA RAM location - * where the divisor will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Load the Modulus in PKA RAM. */ - for(i = 0; i < modulus_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = modulus[i]; - } - - /* Determine the offset for the next data(CPTR). */ - offset += 4 * (i + modulus_size % 2 + 2); - /* Update the C ptr with the offset address of the PKA RAM location - * where the Base will be stored. */ - REG(PKA_CPTR) = offset >> 2; - - /* Write Base to the Vector C in PKA RAM */ - - for(i = 0; i < base_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = base[i]; - } - - /* Determine the offset for the next data. - * INFO D and B can share the same memory area! - * offset += 4 * (i + extraBuf + 2); */ - - /* Copy the result vector address location. */ - *result_vector = PKA_RAM_BASE + offset; - - /* Load D ptr with the result location in PKA RAM */ - REG(PKA_DPTR) = offset >> 2; - - /* Load A length registers with Big number length in 32 bit words. */ - REG(PKA_ALENGTH) = number_size; - - /* Load B length registers Divisor length in 32-bit words. */ - REG(PKA_BLENGTH) = modulus_size; - /* REG(PKA_SHIFT) = 0x00000001; - * Required for (EXPMod-variable): 0x0000A000 - * Start the PKCP modulo exponentiation operation(EXPMod-ACT2) - * by setting the PKA Function register. */ - REG(PKA_FUNCTION) = 0x0000C000; - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_exp_mod_get_result(uint32_t *buffer, - const uint8_t buffer_size, - const uint32_t result_vector) -{ - - uint32_t regMSWVal; - uint32_t len; - int i; - - /* Check the arguments. */ - ASSERT(NULL != buffer); - ASSERT(result_vector > PKA_RAM_BASE); - ASSERT(result_vector < (PKA_RAM_BASE + PKA_RAM_SIZE)); - - /* verify that the operation is complete. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - /* Get the MSW register value. */ - regMSWVal = REG(PKA_MSW); - - /* Check to make sure that the result vector is not all zeroes. */ - if(regMSWVal & PKA_MSW_RESULT_IS_ZERO) { - return PKA_STATUS_RESULT_0; - } - - /* Get the length of the result */ - len = ((regMSWVal & PKA_MSW_MSW_ADDRESS_M) + 1) - - ((result_vector - PKA_RAM_BASE) >> 2); - /* If the size of the buffer provided is less than the result length than - * return error. */ - if(buffer_size < len) { - return PKA_STATUS_BUF_UNDERFLOW; - } - - /* copy the result from vector C into the pResult. */ - for(i = 0; i < len; i++) { - buffer[i] = REG(result_vector + 4 * i); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_divide_start(const uint32_t *dividend, - const uint8_t dividend_size, - const uint32_t *divisor, - const uint8_t divisor_size, - uint32_t *result_vector, - struct process *process) -{ - - uint32_t offset; - uint32_t spacing; - int i; - - /* We use largest len for spacing */ - if(dividend_size > divisor_size) { - spacing = dividend_size; - } else { - spacing = divisor_size; - } - spacing += 2 + spacing % 2; - - /* Check for the arguments. */ - ASSERT(NULL != dividend); - ASSERT(NULL != divisor); - ASSERT(NULL != result_vector); - - /* Make sure no operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Update the A ptr with the offset address of the PKA RAM location - * where the multiplicand will be stored. */ - offset = 0; - REG(PKA_APTR) = offset >> 2; - - /* Load the multiplicand in PKA RAM. */ - for(i = 0; i < dividend_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = *dividend; - dividend++; - } - - /* Determine the offset for the next data. */ - offset += 4 * spacing; - - /* Update the B ptr with the offset address of the PKA RAM location - * where the multiplier will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Load the multiplier in PKA RAM. */ - for(i = 0; i < divisor_size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = *divisor; - divisor++; - } - - /* Determine the offset for the reminder. */ - offset += 4 * spacing; - - /* Load C ptr with the result location in PKA RAM. */ - REG(PKA_CPTR) = offset >> 2; - - /* Determine the offset for the quotient. */ - offset += 4 * spacing; - - /* Copy the quotient vector address location. */ - *result_vector = PKA_RAM_BASE + offset; - - /* Load D ptr with the result location in PKA RAM. */ - REG(PKA_DPTR) = offset >> 2; - - /* Load the respective length registers. */ - REG(PKA_ALENGTH) = dividend_size; - REG(PKA_BLENGTH) = divisor_size; - - /* Set the PKA function to the multiplication and start it. */ - REG(PKA_FUNCTION) = (PKA_FUNCTION_RUN | PKA_FUNCTION_DIVIDE); - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -bignum_divide_get_result(uint32_t *buffer, - uint32_t *buffer_size, - const uint32_t result_vector) -{ - - uint32_t regMSWVal; - uint32_t len; - int i; - - /* Check for arguments. */ - ASSERT(NULL != buffer); - ASSERT(NULL != buffer_size); - ASSERT(result_vector > PKA_RAM_BASE); - ASSERT(result_vector < (PKA_RAM_BASE + PKA_RAM_SIZE)); - - /* Verify that the operation is complete. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - /* Get the MSW register value. */ - regMSWVal = REG(PKA_MSW); - - /* Check to make sure that the result vector is not all zeroes. */ - if(regMSWVal & PKA_MSW_RESULT_IS_ZERO) { - return PKA_STATUS_RESULT_0; - } - - /* Get the length of the result. */ - len = ((regMSWVal & PKA_MSW_MSW_ADDRESS_M) + 1) - - ((result_vector - PKA_RAM_BASE) >> 2); - - /* Make sure that the length of the supplied result buffer is adequate - * to store the resultant. */ - if(*buffer_size < len) { - return PKA_STATUS_BUF_UNDERFLOW; - } - - /* Copy the resultant length. */ - *buffer_size = len; - - /* Copy the result from vector C into the pResult. */ - for(i = 0; i < *buffer_size; i++) { - buffer[i] = REG(result_vector + 4 * i); - } - - return PKA_STATUS_SUCCESS; -} -/** @} */ - diff --git a/arch/cpu/cc2538/dev/bignum-driver.h b/arch/cpu/cc2538/dev/bignum-driver.h deleted file mode 100644 index dd83a3058..000000000 --- a/arch/cpu/cc2538/dev/bignum-driver.h +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Original file: - * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Authors: Andreas Dröscher - * Hu Luo - * Hossein Shafagh - * - * 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. - */ -/** - * \addtogroup cc2538-pka - * @{ - * - * \defgroup cc2538-bignum cc2538 BigNum math function driver - * - * Driver for the cc2538 BigNum math functions of the PKC engine - * @{ - * - * \file - * Header file for the cc2538 BigNum driver - * - * bignum_subtract_start bignum_subtract_get_result (subtraction) - * bignum_add_start bignum_add_get_result (addition) - * bignum_mod_start bignum_mod_get_result (modulo) - * bignum_exp_mod_start bignum_exp_mod_get_result (modular exponentiation operation) - * bignum_inv_mod_start bignum_inv_mod_get_result (inverse modulo operation) - * bignum_mul_start bignum_mul_get_result (multiplication) - * bignum_divide_start bignum_divide_get_result (division) - * bignum_cmp_start bignum_cmp_get_result (comparison) - */ -#ifndef BIGNUM_DRIVER_H_ -#define BIGNUM_DRIVER_H_ - -#include "contiki.h" -#include "dev/pka.h" - -#include - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \brief Starts the big number modulus operation. - * - * \param number Pointer to the big number on which modulo operation - * needs to be carried out. - * \param number_size Size of the big number \sa number in 32-bit word. - * \param modulus Pointer to the divisor. - * \param modulus_size Size of the divisor \sa modulus. - * \param result_vector Pointer to the result vector location - * which will be set by this function. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the modulo operation on the big num \sa number - * using the divisor \sa modulus. The PKA RAM location where the result - * will be available is stored in \sa result_vector. - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t bignum_mod_start(const uint32_t *number, - const uint8_t number_size, - const uint32_t *modulus, - const uint8_t modulus_size, - uint32_t *result_vector, - struct process *process); - -/** \brief Gets the result of the big number modulus operation. - * - * \param buffer Pointer to buffer where the result needs to - * be stored. - * \param buffer_size Size of the provided buffer in 32 bit size word. - * \param result_vector Address of the result location which - * was provided by the start function \sa PKABigNumModStart(). - * - * This function gets the result of the big number modulus operation which was - * previously started using the function \sa PKABigNumModStart(). - * - * \retval PKA_STATUS_SUCCESS if successful. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * the operation. - * \retval PKA_STATUS_RESULT_0 if the result is all zeroes. - * \retval PKA_STATUS_BUF_UNDERFLOW if the \e size is less than the length - * of the result. - */ -uint8_t bignum_mod_get_result(uint32_t *buffer, - const uint8_t buffer_size, - const uint32_t result_vector); - -/** \brief Starts the comparison of two big numbers. - * - * \param number1 Pointer to the first big number. - * \param number2 Pointer to the second big number. - * \param size Size of the big number in 32 bit size word. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the comparison of two big numbers pointed by - * \e number1 and \e number2. - * Note this function expects the size of the two big numbers equal. - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t bignum_cmp_start(const uint32_t *number1, - const uint32_t *number2, - uint8_t size, - struct process *process); - -/** \brief Gets the result of the comparison operation of two big numbers. - * - * This function provides the results of the comparison of two big numbers - * which was started using the \sa PKABigNumCmpStart(). - * - * \retval PKA_STATUS_OPERATION_INPRG if the operation is in progress. - * \retval PKA_STATUS_SUCCESS if the two big numbers are equal. - * \retval PKA_STATUS_A_GR_B if the first number is greater than the second. - * \retval PKA_STATUS_A_LT_B if the first number is less than the second. - */ -uint8_t bignum_cmp_get_result(void); - -/** \brief Starts the big number inverse modulo operation. - * - * \param number Pointer to the buffer containing the big number - * (dividend). - * \param number_size Size of the \e number in 32 bit word. - * \param modulus Pointer to the buffer containing the modulus. - * \param modulus_size Size of the modulus in 32 bit word. - * \param result_vector Pointer to the result vector location - * which will be set by this function. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the the inverse modulo operation on \e number - * using the divisor \e modulus. - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t bignum_inv_mod_start(const uint32_t *number, - const uint8_t number_size, - const uint32_t *modulus, - const uint8_t modulus_size, - uint32_t *result_vector, - struct process *process); - -/** \brief Gets the result of the big number inverse modulo operation. - * - * \param buffer Pointer to buffer where the result needs to be - * stored. - * \param buffer_size Size of the provided buffer in 32 bit size - * word. - * \param result_vector Address of the result location which - * was provided by the start function \sa PKABigNumInvModStart(). - * - * This function gets the result of the big number inverse modulo operation - * previously started using the function \sa PKABigNumInvModStart(). - * - * \retval PKA_STATUS_SUCCESS if the operation is successful. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy performing - * the operation. - * \retval PKA_STATUS_RESULT_0 if the result is all zeroes. - * \retval PKA_STATUS_BUF_UNDERFLOW if the length of the provided buffer is less - * then the result. - */ -uint8_t bignum_inv_mod_get_result(uint32_t *buffer, - const uint8_t buffer_size, - const uint32_t result_vector); - -/** \brief Starts the big number multiplication. - * - * \param multiplicand Pointer to the buffer containing the big - * number multiplicand. - * \param multiplicand_size Size of the multiplicand in 32-bit word. - * \param multiplier Pointer to the buffer containing the big - * number multiplier. - * \param multiplier_size Size of the multiplier in 32-bit word. - * \param result_vector Pointer to the result vector location - * which will be set by this function. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the multiplication of the two big numbers. - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t bignum_mul_start(const uint32_t *multiplicand, - const uint8_t multiplicand_size, - const uint32_t *multiplier, - const uint8_t multiplier_size, - uint32_t *result_vector, - struct process *process); - -/** \brief Gets the results of the big number multiplication. - * - * \param buffer Pointer to buffer where the result needs to be stored. - * \param buffer_size Address of the variable containing the length of the - * buffer. After the operation, the actual length of the resultant is - * stored at this address. - * \param result_vector Address of the result location which - * was provided by the start function \sa PKABigNumMultiplyStart(). - * - * This function gets the result of the multiplication of two big numbers - * operation previously started using the function \sa - * PKABigNumMultiplyStart(). - * - * \retval PKA_STATUS_SUCCESS if the operation is successful. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy performing - * the operation. - * \retval PKA_STATUS_RESULT_0 if the result is all zeroes. - * \retval PKA_STATUS_FAILURE if the operation is not successful. - * \retval PKA_STATUS_BUF_UNDERFLOW if the length of the provided buffer is less - * then the length of the result. - */ -uint8_t bignum_mul_get_result(uint32_t *buffer, - uint32_t *buffer_size, - const uint32_t result_vector); - -/** \brief Starts the addition of two big number. - * - * \param number1 Pointer to the buffer containing the first big mumber. - * \param number1_size Size of the first big number in 32-bit word. - * \param number2 Pointer to the buffer containing the second big number. - * \param number2_size Size of the second big number in 32-bit word. - * \param result_vector Pointer to the result vector location - * which will be set by this function. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the addition of the two big numbers. - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t bignum_add_start(const uint32_t *number1, - const uint8_t number1_size, - const uint32_t *number2, - const uint8_t number2_size, - uint32_t *result_vector, - struct process *process); - -/** \brief Gets the result of the addition operation on two big number. - * - * \param buffer Pointer to buffer where the result - * needs to be stored. - * \param buffer_size Address of the variable containing the length of - * the buffer. After the operation the actual length of the - * resultant is stored at this address. - * \param result_vector Address of the result location which - * was provided by the start function \sa PKABigNumAddStart(). - * - * This function gets the result of the addition operation on two big numbers, - * previously started using the function \sa PKABigNumAddStart(). - * - * \retval PKA_STATUS_SUCCESS if the operation is successful. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy performing - * the operation. - * \retval PKA_STATUS_RESULT_0 if the result is all zeroes. - * \retval PKA_STATUS_FAILURE if the operation is not successful. - * \retval PKA_STATUS_BUF_UNDERFLOW if the length of the provided buffer is less - * then the length of the result. - */ -uint8_t bignum_add_get_result(uint32_t *buffer, - uint32_t *buffer_size, - const uint32_t result_vector); - -/** \brief Starts the substract of two big number. - * - * \param number1 Pointer to the buffer containing the first big mumber. - * \param number1_size Size of the first big number in 32-bit word. - * \param number2 Pointer to the buffer containing the second big number. - * \param number2_size Size of the second big number in 32-bit word. - * \param result_vector Pointer to the result vector location - * which will be set by this function. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the substraction of the two big numbers. - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t bignum_subtract_start(const uint32_t *number1, - const uint8_t number1_size, - const uint32_t *number2, - const uint8_t number2_size, - uint32_t *result_vector, - struct process *process); - -/** \brief Gets the result of big number subtract. - * - * \param buffer Pointer to store the result of subtraction. - * \param buffer_size Address of the variable containing the length of the - * buffer. After the operation, the actual length of the resultant is - * stored at this address. - * \param result_vector Address of the result location which - * was provided by the start function PKABigNumSubtractStart(). - * - * This function gets the result of PKABigNumSubtractStart(). - * - * \retval PKA_STATUS_SUCCESS if the operation is successful. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy performing - * the operation. - * \retval PKA_STATUS_RESULT_0 if the result is all zeroes. - * \retval PKA_STATUS_FAILURE if the operation is not successful. - */ -uint8_t bignum_subtract_get_result(uint32_t *buffer, - uint32_t *buffer_size, - const uint32_t result_vector); - -/** \brief Starts the big number moduluar Exponentiation operation. - * - * \param number Pointer to the Exponent on which moduluar Exponentiation operation - * needs to be carried out. - * \param number_size Size of the the Exponent number number in 32-bit word. - * \param modulus Pointer to the divisor. - * \param modulus_size Size of the divisor modulus. - * \param base Pointer to the Base. - * \param base_size Size of the divisor base. - * \param result_vector Pointer to the result vector location - * which will be set by this function. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the moduluar Exponentiation operation on the base num base - * using the Exponent number and the Modulus num modulus. The PKA RAM location where the result - * will be available is stored in \sa result_vector. - * IMPORTANT = Modulus and Based should have buffers of the same length! - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t bignum_exp_mod_start(const uint32_t *number, - const uint8_t number_size, - const uint32_t *modulus, - const uint8_t modulus_size, - const uint32_t *base, - const uint8_t base_size, - uint32_t *result_vector, - struct process *process); - -/** \brief Gets the result of the big number modulus operation result. - * - * \param buffer Pointer to buffer where the result needs to - * be stored. - * \param buffer_size Size of the provided buffer in 32 bit size word. - * \param result_vector Address of the result location which - * was provided by the start function \sa PKABigNumExpModStart(). - * - * This function gets the result of the big number modulus operation which was - * previously started using the function \sa PKABigNumExpModStart(). - * - * \retval PKA_STATUS_SUCCESS if successful. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * the operation. - * \retval PKA_STATUS_RESULT_0 if the result is all zeroes. - * \retval PKA_STATUS_BUF_UNDERFLOW if the \e size is less than the length - * of the result. - * - * \note - * - 0 < number_size <= Max_Len - * - 1 < modulus_size <=Max_Len - * - modulus must be odd and modulus > 232 - * - base < modulus - */ -uint8_t bignum_exp_mod_get_result(uint32_t *buffer, - const uint8_t buffer_size, - const uint32_t result_vector); - -/** \brief Starts the big number Divide. - * - * \param dividend Pointer to the buffer containing the big - * number dividend. - * \param dividend_size Size of the dividend in 32-bit word. - * \param divisor Pointer to the buffer containing the big - * number divisor. - * \param divisor_size Size of the divisor in 32-bit word. - * \param result_vector Pointer to the result vector location - * which will be set by this function. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the divide of the two big numbers. - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t bignum_divide_start(const uint32_t *dividend, - const uint8_t dividend_size, - const uint32_t *divisor, - const uint8_t divisor_size, - uint32_t *result_vector, - struct process *process); - -/** \brief Gets the results of the big number Divide. - * - * \param buffer Pointer to buffer where the result needs to be stored. - * \param buffer_size Address of the variable containing the length of the - * buffer. After the operation, the actual length of the resultant is - * stored at this address. - * \param result_vector Address of the result location which - * was provided by the start function \sa PKABigNumMultiplyStart(). - * - * This function gets the result of the Divide of two big numbers - * operation previously started using the function \sa - * PKABigNumDivideStart(). - * - * \retval PKA_STATUS_SUCCESS if the operation is successful. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy performing - * the operation. - * \retval PKA_STATUS_RESULT_0 if the result is all zeroes. - * \retval PKA_STATUS_FAILURE if the operation is not successful. - * \retval PKA_STATUS_BUF_UNDERFLOW if the length of the provided buffer is less - * then the length of the result. - */ -uint8_t bignum_divide_get_result(uint32_t *buffer, - uint32_t *buffer_size, - const uint32_t result_vector); - -/** @} */ - -#endif /* BIGNUM_DRIVER_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/cbc-mac.c b/arch/cpu/cc2538/dev/cbc-mac.c deleted file mode 100644 index 0635e4f53..000000000 --- a/arch/cpu/cc2538/dev/cbc-mac.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-cbc-mac - * @{ - * - * \file - * Implementation of the cc2538 AES-CBC-MAC driver - */ -#include "contiki.h" -#include "dev/rom-util.h" -#include "dev/cbc-mac.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -uint8_t -cbc_mac_auth_start(uint8_t key_area, const void *mdata, uint16_t mdata_len, - struct process *process) -{ - uint32_t ctrl; - uint32_t iv[AES_IV_LEN / sizeof(uint32_t)]; - - /* Program AES-CBC-MAC authentication operation */ - ctrl = AES_AES_CTRL_SAVE_CONTEXT | /* Save context */ - AES_AES_CTRL_CBC_MAC | /* CBC-MAC */ - AES_AES_CTRL_DIRECTION_ENCRYPT; /* Encryption */ - - /* Prepare the crypto initialization vector - * Set initialization vector to 0 */ - rom_util_memset(iv, 0, AES_IV_LEN); - - return aes_auth_crypt_start(ctrl, key_area, iv, NULL, 0, - mdata, NULL, mdata_len, process); -} -/*---------------------------------------------------------------------------*/ -uint8_t -cbc_mac_auth_get_result(const void *mac_in, void *mac_out) -{ - uint32_t tag[AES_TAG_LEN / sizeof(uint32_t)]; - uint8_t ret; - - ret = aes_auth_crypt_get_result(NULL, tag); - if(ret != CRYPTO_SUCCESS) { - return ret; - } - - if(mac_in != NULL) { - /* Check MAC */ - if(rom_util_memcmp(tag, mac_in, CBC_MAC_MAC_LEN)) { - ret = AES_AUTHENTICATION_FAILED; - } - } - - if(mac_out != NULL) { - /* Copy tag to MAC */ - rom_util_memcpy(mac_out, tag, CBC_MAC_MAC_LEN); - } - - return ret; -} - -/** @} */ diff --git a/arch/cpu/cc2538/dev/cbc-mac.h b/arch/cpu/cc2538/dev/cbc-mac.h deleted file mode 100644 index 76b750bf5..000000000 --- a/arch/cpu/cc2538/dev/cbc-mac.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-aes - * @{ - * - * \defgroup cc2538-cbc-mac cc2538 AES-CBC-MAC - * - * Driver for the cc2538 AES-CBC-MAC mode of the security core - * @{ - * - * \file - * Header file for the cc2538 AES-CBC-MAC driver - */ -#ifndef CBC_MAC_H_ -#define CBC_MAC_H_ - -#include "contiki.h" -#include "dev/aes.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/** \name AES-CBC-MAC constants - * @{ - */ -#define CBC_MAC_MAC_LEN AES_TAG_LEN -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES-CBC-MAC functions - * @{ - */ - -/** \brief Starts a CBC-MAC authentication operation - * \param key_area Area in Key RAM where the key is stored (0 to - * \c AES_KEY_AREAS - 1) - * \param mdata Pointer to message to authenticate in SRAM - * \param mdata_len Length of message to authenticate in octets - * \param process Process to be polled upon completion of the operation, or - * \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/CBC-MAC error code - * \warning CBC-MAC is not secure for variable-length messages. There are a few - * workarounds that can be implemented by the caller, like prepending the - * message length to the first block of the message before passing it. - */ -uint8_t cbc_mac_auth_start(uint8_t key_area, const void *mdata, - uint16_t mdata_len, struct process *process); - -/** \brief Checks the status of the CBC-MAC authentication operation - * \retval false Result not yet available, and no error occurred - * \retval true Result available, or error occurred - */ -#define cbc_mac_auth_check_status aes_auth_crypt_check_status - -/** \brief Gets the result of the CBC-MAC authentication operation - * \param mac_in Pointer to 128-bit input MAC, or \c NULL - * \param mac_out Pointer to 128-bit output MAC, or \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/CBC-MAC error code - * \note This function must be called only after \c cbc_mac_auth_start(). - */ -uint8_t cbc_mac_auth_get_result(const void *mac_in, void *mac_out); - -/** @} */ - -#endif /* CBC_MAC_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/cbc.c b/arch/cpu/cc2538/dev/cbc.c deleted file mode 100644 index c73a0f416..000000000 --- a/arch/cpu/cc2538/dev/cbc.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-cbc - * @{ - * - * \file - * Implementation of the cc2538 AES-CBC driver - */ -#include "contiki.h" -#include "dev/cbc.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -uint8_t -cbc_crypt_start(uint8_t encrypt, uint8_t key_area, const void *iv, - const void *mdata_in, void *mdata_out, uint16_t mdata_len, - struct process *process) -{ - uint32_t ctrl; - - /* Program AES-CBC crypto operation */ - ctrl = AES_AES_CTRL_CBC | /* CBC */ - (encrypt ? AES_AES_CTRL_DIRECTION_ENCRYPT : 0); /* En/decryption */ - - return aes_auth_crypt_start(ctrl, key_area, iv, NULL, 0, - mdata_in, mdata_out, mdata_len, process); -} -/*---------------------------------------------------------------------------*/ -int8_t -cbc_crypt_check_status(void) -{ - return aes_auth_crypt_check_status() ? aes_auth_crypt_get_result(NULL, NULL) : - CRYPTO_PENDING; -} - -/** @} */ diff --git a/arch/cpu/cc2538/dev/cbc.h b/arch/cpu/cc2538/dev/cbc.h deleted file mode 100644 index 920708af3..000000000 --- a/arch/cpu/cc2538/dev/cbc.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-aes - * @{ - * - * \defgroup cc2538-cbc cc2538 AES-CBC - * - * Driver for the cc2538 AES-CBC mode of the security core - * @{ - * - * \file - * Header file for the cc2538 AES-CBC driver - */ -#ifndef CBC_H_ -#define CBC_H_ - -#include "contiki.h" -#include "dev/aes.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/** \name AES-CBC constants - * @{ - */ -#define CBC_IV_LEN AES_IV_LEN -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES-CBC functions - * @{ - */ - -/** \brief Starts a CBC crypto operation - * \param encrypt \c true to encrypt, or \c false to decrypt - * \param key_area Area in Key RAM where the key is stored (0 to - * \c AES_KEY_AREAS - 1) - * \param iv Pointer to 128-bit initialization vector - * \param mdata_in Pointer to input message in SRAM - * \param mdata_out Pointer to output message in SRAM (may be \p mdata_in) - * \param mdata_len Length of message in octets - * \param process Process to be polled upon completion of the operation, or - * \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/CBC error code - */ -uint8_t cbc_crypt_start(uint8_t encrypt, uint8_t key_area, const void *iv, - const void *mdata_in, void *mdata_out, - uint16_t mdata_len, struct process *process); - -/** \brief Checks the status of the CBC crypto operation - * \return \c CRYPTO_PENDING if operation still pending, \c CRYPTO_SUCCESS if - * successful, or CRYPTO/AES/CBC error code - * \note This function must be called only after \c cbc_crypt_start(). - */ -int8_t cbc_crypt_check_status(void); - -/** @} */ - -#endif /* CBC_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/cc2538-aes-128.c b/arch/cpu/cc2538/dev/cc2538-aes-128.c deleted file mode 100644 index aa5b5e8e6..000000000 --- a/arch/cpu/cc2538/dev/cc2538-aes-128.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2015, Hasso-Plattner-Institut. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ -/** - * \addtogroup cc2538-aes-128 - * @{ - * - * \file - * Implementation of the AES-128 driver for the CC2538 SoC - * \author - * Konrad Krentz - */ -#include "contiki.h" -#include "dev/ecb.h" -#include "dev/cc2538-aes-128.h" -#include "dev/sys-ctrl.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define MODULE_NAME "cc2538-aes-128" - -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -static uint8_t -enable_crypto(void) -{ - uint8_t enabled = CRYPTO_IS_ENABLED(); - if(!enabled) { - crypto_enable(); - } - return enabled; -} -/*---------------------------------------------------------------------------*/ -static void -restore_crypto(uint8_t enabled) -{ - if(!enabled) { - crypto_disable(); - } -} -/*---------------------------------------------------------------------------*/ -static void -set_key(const uint8_t *key) -{ - uint8_t crypto_enabled, ret; - - crypto_enabled = enable_crypto(); - - ret = aes_load_keys(key, AES_KEY_STORE_SIZE_KEY_SIZE_128, 1, - CC2538_AES_128_KEY_AREA); - if(ret != CRYPTO_SUCCESS) { - PRINTF("%s: aes_load_keys() error %u\n", MODULE_NAME, ret); - sys_ctrl_reset(); - } - - restore_crypto(crypto_enabled); -} -/*---------------------------------------------------------------------------*/ -static void -encrypt(uint8_t *plaintext_and_result) -{ - uint8_t crypto_enabled, ret; - int8_t res; - - crypto_enabled = enable_crypto(); - - ret = ecb_crypt_start(true, CC2538_AES_128_KEY_AREA, plaintext_and_result, - plaintext_and_result, AES_128_BLOCK_SIZE, NULL); - if(ret != CRYPTO_SUCCESS) { - PRINTF("%s: ecb_crypt_start() error %u\n", MODULE_NAME, ret); - sys_ctrl_reset(); - } - - while((res = ecb_crypt_check_status()) == CRYPTO_PENDING); - if(res != CRYPTO_SUCCESS) { - PRINTF("%s: ecb_crypt_check_status() error %d\n", MODULE_NAME, res); - sys_ctrl_reset(); - } - - restore_crypto(crypto_enabled); -} -/*---------------------------------------------------------------------------*/ -const struct aes_128_driver cc2538_aes_128_driver = { - set_key, - encrypt -}; - -/** @} */ diff --git a/arch/cpu/cc2538/dev/cc2538-aes-128.h b/arch/cpu/cc2538/dev/cc2538-aes-128.h deleted file mode 100644 index 20615fc55..000000000 --- a/arch/cpu/cc2538/dev/cc2538-aes-128.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2015, Hasso-Plattner-Institut. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ -/** - * \addtogroup cc2538-aes - * @{ - * - * \defgroup cc2538-aes-128 CC2538 AES-128 - * - * AES-128 driver for the CC2538 SoC - * @{ - * - * \file - * Header file of the AES-128 driver for the CC2538 SoC - * \author - * Konrad Krentz - */ -#ifndef CC2538_AES_128_H_ -#define CC2538_AES_128_H_ - -#include "lib/aes-128.h" -/*---------------------------------------------------------------------------*/ -#ifdef CC2538_AES_128_CONF_KEY_AREA -#define CC2538_AES_128_KEY_AREA CC2538_AES_128_CONF_KEY_AREA -#else -#define CC2538_AES_128_KEY_AREA 0 -#endif -/*---------------------------------------------------------------------------*/ -extern const struct aes_128_driver cc2538_aes_128_driver; - -#endif /* CC2538_AES_128_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/cc2538-ccm-star.c b/arch/cpu/cc2538/dev/cc2538-ccm-star.c deleted file mode 100644 index 754b0548e..000000000 --- a/arch/cpu/cc2538/dev/cc2538-ccm-star.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-ccm-star - * @{ - * - * \file - * Implementation of the AES-CCM* driver for the CC2538 SoC - */ -#include "contiki.h" -#include "dev/ccm.h" -#include "dev/cc2538-aes-128.h" -#include "dev/cc2538-ccm-star.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define MODULE_NAME "cc2538-ccm-star" - -#define CCM_STAR_LEN_LEN (CCM_NONCE_LEN_LEN - CCM_STAR_NONCE_LENGTH) - -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -static uint8_t -enable_crypto(void) -{ - uint8_t enabled = CRYPTO_IS_ENABLED(); - if(!enabled) { - crypto_enable(); - } - return enabled; -} -/*---------------------------------------------------------------------------*/ -static void -restore_crypto(uint8_t enabled) -{ - if(!enabled) { - crypto_disable(); - } -} -/*---------------------------------------------------------------------------*/ -static void -set_key(const uint8_t *key) -{ - cc2538_aes_128_driver.set_key(key); -} -/*---------------------------------------------------------------------------*/ -static void -aead(const uint8_t *nonce, uint8_t *m, uint8_t m_len, const uint8_t *a, - uint8_t a_len, uint8_t *result, uint8_t mic_len, int forward) -{ - uint16_t cdata_len; - uint8_t crypto_enabled, ret; - - crypto_enabled = enable_crypto(); - - if(forward) { - ret = ccm_auth_encrypt_start(CCM_STAR_LEN_LEN, CC2538_AES_128_KEY_AREA, - nonce, a, a_len, m, m_len, m, mic_len, NULL); - if(ret != CRYPTO_SUCCESS) { - PRINTF("%s: ccm_auth_encrypt_start() error %u\n", MODULE_NAME, ret); - restore_crypto(crypto_enabled); - return; - } - - while(!ccm_auth_encrypt_check_status()); - ret = ccm_auth_encrypt_get_result(result, mic_len); - if(ret != CRYPTO_SUCCESS) { - PRINTF("%s: ccm_auth_encrypt_get_result() error %u\n", MODULE_NAME, ret); - } - } else { - cdata_len = m_len + mic_len; - ret = ccm_auth_decrypt_start(CCM_STAR_LEN_LEN, CC2538_AES_128_KEY_AREA, - nonce, a, a_len, m, cdata_len, m, mic_len, - NULL); - if(ret != CRYPTO_SUCCESS) { - PRINTF("%s: ccm_auth_decrypt_start() error %u\n", MODULE_NAME, ret); - restore_crypto(crypto_enabled); - return; - } - - while(!ccm_auth_decrypt_check_status()); - ret = ccm_auth_decrypt_get_result(m, cdata_len, result, mic_len); - if(ret != CRYPTO_SUCCESS) { - PRINTF("%s: ccm_auth_decrypt_get_result() error %u\n", MODULE_NAME, ret); - } - } - - restore_crypto(crypto_enabled); -} -/*---------------------------------------------------------------------------*/ -const struct ccm_star_driver cc2538_ccm_star_driver = { - set_key, - aead -}; - -/** @} */ diff --git a/arch/cpu/cc2538/dev/cc2538-ccm-star.h b/arch/cpu/cc2538/dev/cc2538-ccm-star.h deleted file mode 100644 index a608444ce..000000000 --- a/arch/cpu/cc2538/dev/cc2538-ccm-star.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-aes - * @{ - * - * \defgroup cc2538-ccm-star CC2538 AES-CCM* - * - * AES-CCM* driver for the CC2538 SoC - * @{ - * - * \file - * Header file of the AES-CCM* driver for the CC2538 SoC - */ -#ifndef CC2538_CCM_STAR_H_ -#define CC2538_CCM_STAR_H_ - -#include "lib/ccm-star.h" -/*---------------------------------------------------------------------------*/ -extern const struct ccm_star_driver cc2538_ccm_star_driver; - -#endif /* CC2538_CCM_STAR_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/cc2538-dev.h b/arch/cpu/cc2538/dev/cc2538-dev.h deleted file mode 100644 index 0fdee63f3..000000000 --- a/arch/cpu/cc2538/dev/cc2538-dev.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-devices cc2538 family of devices - * - * Definitions for the cc2538 family of devices - * @{ - * - * \file - * Header file for the cc2538 devices definitions - */ -#ifndef CC2538_DEV_H_ -#define CC2538_DEV_H_ - -#include "contiki.h" -#include "sys/cc.h" -/*----------------------------------------------------------------------------*/ -/** \name Bit-fields for the CC2538 devices features - * @{ - */ -#define CC2538_DEV_ID_M 0x0000000F /**< ID mask */ -#define CC2538_DEV_ID_S 0 /**< ID shift */ -#define CC2538_DEV_FLASH_SIZE_KB_M 0x0000FFF0 /**< kiB flash size mask */ -#define CC2538_DEV_FLASH_SIZE_KB_S 4 /**< kiB flash size shift */ -#define CC2538_DEV_SRAM_SIZE_KB_M 0x00FF0000 /**< kiB SRAM size mask */ -#define CC2538_DEV_SRAM_SIZE_KB_S 16 /**< kiB SRAM size shift */ -#define CC2538_DEV_AES_SHA_M 0x01000000 /**< Security HW AES/SHA */ -#define CC2538_DEV_ECC_RSA_M 0x02000000 /**< Security HW ECC/RSA */ -/** @} */ -/*----------------------------------------------------------------------------*/ -/** \name Macro defining a CC2538 device from its features - * @{ - */ -#define CC2538_DEV_DEF(id, flash_size_kb, sram_size_kb, aes_sha, ecc_rsa) \ - ((id) << CC2538_DEV_ID_S | (flash_size_kb) << CC2538_DEV_FLASH_SIZE_KB_S | \ - (sram_size_kb) << CC2538_DEV_SRAM_SIZE_KB_S | \ - ((aes_sha) ? CC2538_DEV_AES_SHA_M : 0) | \ - ((ecc_rsa) ? CC2538_DEV_ECC_RSA_M : 0)) -/** @} */ -/*----------------------------------------------------------------------------*/ -/** \name Available CC2538 devices - * @{ - */ -#define CC2538_DEV_CC2538SF53 CC2538_DEV_DEF(0, 512, 32, 1, 1) -#define CC2538_DEV_CC2538SF23 CC2538_DEV_DEF(1, 256, 32, 1, 1) -#define CC2538_DEV_CC2538NF53 CC2538_DEV_DEF(2, 512, 32, 1, 0) -#define CC2538_DEV_CC2538NF23 CC2538_DEV_DEF(3, 256, 32, 1, 0) -#define CC2538_DEV_CC2538NF11 CC2538_DEV_DEF(4, 128, 16, 1, 0) -/** @} */ -/*----------------------------------------------------------------------------*/ -/** \name CC2538 device used by Contiki - * @{ - */ -#ifdef CC2538_DEV_CONF -#define CC2538_DEV CC2538_DEV_CONF -#else -#define CC2538_DEV CC2538_DEV_CC2538SF53 -#endif -/** @} */ -/*----------------------------------------------------------------------------*/ -/** \name Features of the CC2538 device used by Contiki - * @{ - */ -/** Flash address */ -#define CC2538_DEV_FLASH_ADDR 0x00200000 -/** Flash size in bytes */ -#define CC2538_DEV_FLASH_SIZE (((CC2538_DEV & CC2538_DEV_FLASH_SIZE_KB_M) >> \ - CC2538_DEV_FLASH_SIZE_KB_S) << 10) -/** SRAM (non-retention + low-leakage) address */ -#define CC2538_DEV_SRAM_ADDR (CC2538_DEV_RLSRAM_SIZE ? \ - CC2538_DEV_RLSRAM_ADDR : \ - CC2538_DEV_LLSRAM_ADDR) -/** SRAM (non-retention + low-leakage) size in bytes */ -#define CC2538_DEV_SRAM_SIZE (((CC2538_DEV & CC2538_DEV_SRAM_SIZE_KB_M) >> \ - CC2538_DEV_SRAM_SIZE_KB_S) << 10) -/** Regular-leakage SRAM address */ -#define CC2538_DEV_RLSRAM_ADDR 0x20000000 -/** Regular-leakage SRAM size in bytes */ -#define CC2538_DEV_RLSRAM_SIZE (CC2538_DEV_SRAM_SIZE - CC2538_DEV_LLSRAM_SIZE) -/** Low-leakage SRAM address */ -#define CC2538_DEV_LLSRAM_ADDR 0x20004000 -/** Low-leakage SRAM size in bytes */ -#define CC2538_DEV_LLSRAM_SIZE MIN(CC2538_DEV_SRAM_SIZE, 16384) -/** Security HW AES/SHA */ -#define CC2538_DEV_AES_SHA (!!(CC2538_DEV & CC2538_DEV_AES_SHA_M)) -/** Security HW ECC/RSA */ -#define CC2538_DEV_ECC_RSA (!!(CC2538_DEV & CC2538_DEV_ECC_RSA_M)) -/** @} */ - -#endif /* CC2538_DEV_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/cc2538-rf.c b/arch/cpu/cc2538/dev/cc2538-rf.c deleted file mode 100644 index 7fd40afdc..000000000 --- a/arch/cpu/cc2538/dev/cc2538-rf.c +++ /dev/null @@ -1,1182 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-rf - * @{ - * - * \file - * Implementation of the cc2538 RF driver - */ -#include "contiki.h" -#include "dev/radio.h" -#include "sys/clock.h" -#include "sys/rtimer.h" -#include "net/packetbuf.h" -#include "net/linkaddr.h" -#include "net/netstack.h" -#include "net/mac/tsch/tsch.h" -#include "sys/energest.h" -#include "dev/cc2538-rf.h" -#include "dev/rfcore.h" -#include "dev/sys-ctrl.h" -#include "dev/udma.h" -#include "reg.h" - -#include -/*---------------------------------------------------------------------------*/ -#define CHECKSUM_LEN 2 - -/* uDMA channel control persistent flags */ -#define UDMA_TX_FLAGS (UDMA_CHCTL_ARBSIZE_128 | UDMA_CHCTL_XFERMODE_AUTO \ - | UDMA_CHCTL_SRCSIZE_8 | UDMA_CHCTL_DSTSIZE_8 \ - | UDMA_CHCTL_SRCINC_8 | UDMA_CHCTL_DSTINC_NONE) - -#define UDMA_RX_FLAGS (UDMA_CHCTL_ARBSIZE_128 | UDMA_CHCTL_XFERMODE_AUTO \ - | UDMA_CHCTL_SRCSIZE_8 | UDMA_CHCTL_DSTSIZE_8 \ - | UDMA_CHCTL_SRCINC_NONE | UDMA_CHCTL_DSTINC_8) - -/* - * uDMA transfer threshold. DMA will only be used to read an incoming frame - * if its size is above this threshold - */ -#define UDMA_RX_SIZE_THRESHOLD 3 -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "cc2538-rf" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -/* Local RF Flags */ -#define RX_ACTIVE 0x80 -#define RF_MUST_RESET 0x40 -#define RF_ON 0x01 - -/* Bit Masks for the last byte in the RX FIFO */ -#define CRC_BIT_MASK 0x80 -#define LQI_BIT_MASK 0x7F -/* RSSI Offset */ -#define RSSI_OFFSET 73 -#define RSSI_INVALID -128 - -/* 192 usec off -> on interval (RX Callib -> SFD Wait). We wait a bit more */ -#define ONOFF_TIME RTIMER_ARCH_SECOND / 3125 -/*---------------------------------------------------------------------------*/ -#ifdef CC2538_RF_CONF_AUTOACK -#define CC2538_RF_AUTOACK CC2538_RF_CONF_AUTOACK -#else -#define CC2538_RF_AUTOACK 1 -#endif -/*--------------------------------------------------------------------------- - * MAC timer - *---------------------------------------------------------------------------*/ -/* Timer conversion */ -#define RADIO_TO_RTIMER(X) ((uint32_t)((uint64_t)(X) * RTIMER_ARCH_SECOND / SYS_CTRL_32MHZ)) - -#define CLOCK_STABLE() do { \ - while ( !(REG(SYS_CTRL_CLOCK_STA) & (SYS_CTRL_CLOCK_STA_XOSC_STB))); \ - } while(0) -/*---------------------------------------------------------------------------*/ -/* Are we currently in poll mode? Disabled by default */ -static uint8_t volatile poll_mode = 0; -/* Do we perform a CCA before sending? Enabled by default. */ -static uint8_t send_on_cca = 1; -static int8_t rssi; -static uint8_t crc_corr; -/*---------------------------------------------------------------------------*/ -static uint8_t rf_flags; -static uint8_t rf_channel = IEEE802154_DEFAULT_CHANNEL; - -static int on(void); -static int off(void); -/*---------------------------------------------------------------------------*/ -/* TX Power dBm lookup table. Values from SmartRF Studio v1.16.0 */ -typedef struct output_config { - radio_value_t power; - uint8_t txpower_val; -} output_config_t; - -static const output_config_t output_power[] = { - { 7, 0xFF }, - { 5, 0xED }, - { 3, 0xD5 }, - { 1, 0xC5 }, - { 0, 0xB6 }, - { -1, 0xB0 }, - { -3, 0xA1 }, - { -5, 0x91 }, - { -7, 0x88 }, - { -9, 0x72 }, - {-11, 0x62 }, - {-13, 0x58 }, - {-15, 0x42 }, - {-24, 0x00 }, -}; - -static radio_result_t get_value(radio_param_t param, radio_value_t *value); - -#define OUTPUT_CONFIG_COUNT (sizeof(output_power) / sizeof(output_config_t)) - -/* Max and Min Output Power in dBm */ -#define OUTPUT_POWER_MIN (output_power[OUTPUT_CONFIG_COUNT - 1].power) -#define OUTPUT_POWER_MAX (output_power[0].power) -/*---------------------------------------------------------------------------*/ -PROCESS(cc2538_rf_process, "cc2538 RF driver"); -/*---------------------------------------------------------------------------*/ -/** - * \brief Get the current operating channel - * \return Returns a value in [11,26] representing the current channel - */ -static uint8_t -get_channel() -{ - return rf_channel; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Set the current operating channel - * \param channel The desired channel as a value in [11,26] - */ -static void -set_channel(uint8_t channel) -{ - uint8_t was_on = 0; - - LOG_INFO("Set Channel\n"); - - /* Changes to FREQCTRL take effect after the next recalibration */ - - /* If we are off, save state, otherwise switch off and save state */ - if((REG(RFCORE_XREG_FSMSTAT0) & RFCORE_XREG_FSMSTAT0_FSM_FFCTRL_STATE) != 0) { - was_on = 1; - off(); - } - REG(RFCORE_XREG_FREQCTRL) = CC2538_RF_CHANNEL_MIN + - (channel - CC2538_RF_CHANNEL_MIN) * CC2538_RF_CHANNEL_SPACING; - - /* switch radio back on only if radio was on before - otherwise will turn on radio foor sleepy nodes */ - if(was_on) { - on(); - } - - rf_channel = channel; -} -/*---------------------------------------------------------------------------*/ -static radio_value_t -get_pan_id(void) -{ - return (radio_value_t)(REG(RFCORE_FFSM_PAN_ID1) << 8 | REG(RFCORE_FFSM_PAN_ID0)); -} -/*---------------------------------------------------------------------------*/ -static void -set_pan_id(uint16_t pan) -{ - REG(RFCORE_FFSM_PAN_ID0) = pan & 0xFF; - REG(RFCORE_FFSM_PAN_ID1) = pan >> 8; -} -/*---------------------------------------------------------------------------*/ -static radio_value_t -get_short_addr(void) -{ - return (radio_value_t)(REG(RFCORE_FFSM_SHORT_ADDR1) << 8 | REG(RFCORE_FFSM_SHORT_ADDR0)); -} -/*---------------------------------------------------------------------------*/ -static void -set_short_addr(uint16_t addr) -{ - REG(RFCORE_FFSM_SHORT_ADDR0) = addr & 0xFF; - REG(RFCORE_FFSM_SHORT_ADDR1) = addr >> 8; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Reads the current signal strength (RSSI) - * \return The current RSSI in dBm - * - * This function reads the current RSSI on the currently configured - * channel. - */ -static radio_value_t -get_rssi(void) -{ - int8_t rssi; - uint8_t was_off = 0; - - /* If we are off, turn on first */ - if((REG(RFCORE_XREG_FSMSTAT0) & RFCORE_XREG_FSMSTAT0_FSM_FFCTRL_STATE) == 0) { - was_off = 1; - on(); - } - - /* Wait for a valid RSSI reading */ - do { - rssi = REG(RFCORE_XREG_RSSI); - } while(rssi == RSSI_INVALID); - rssi -= RSSI_OFFSET; - - /* If we were off, turn back off */ - if(was_off) { - off(); - } - - return rssi; -} -/*---------------------------------------------------------------------------*/ -/* Returns the current CCA threshold in dBm */ -static radio_value_t -get_cca_threshold(void) -{ - return (int8_t)(REG(RFCORE_XREG_CCACTRL0) & RFCORE_XREG_CCACTRL0_CCA_THR) - RSSI_OFFSET; -} -/*---------------------------------------------------------------------------*/ -/* Sets the CCA threshold in dBm */ -static void -set_cca_threshold(radio_value_t value) -{ - REG(RFCORE_XREG_CCACTRL0) = (value & 0xFF) + RSSI_OFFSET; -} -/*---------------------------------------------------------------------------*/ -/* Returns the current TX power in dBm */ -static radio_value_t -get_tx_power(void) -{ - int i; - uint8_t reg_val = REG(RFCORE_XREG_TXPOWER) & 0xFF; - - /* - * Find the TXPOWER value in the lookup table - * If the value has been written with set_tx_power, we should be able to - * find the exact value. However, in case the register has been written in - * a different fashion, we return the immediately lower value of the lookup - */ - for(i = 0; i < OUTPUT_CONFIG_COUNT; i++) { - if(reg_val >= output_power[i].txpower_val) { - return output_power[i].power; - } - } - return OUTPUT_POWER_MIN; -} -/*---------------------------------------------------------------------------*/ -/* - * Set TX power to 'at least' power dBm - * This works with a lookup table. If the value of 'power' does not exist in - * the lookup table, TXPOWER will be set to the immediately higher available - * value - */ -static void -set_tx_power(radio_value_t power) -{ - int i; - - for(i = OUTPUT_CONFIG_COUNT - 1; i >= 0; --i) { - if(power <= output_power[i].power) { - REG(RFCORE_XREG_TXPOWER) = output_power[i].txpower_val; - return; - } - } -} -/*---------------------------------------------------------------------------*/ -static void -set_frame_filtering(uint8_t enable) -{ - if(enable) { - REG(RFCORE_XREG_FRMFILT0) |= RFCORE_XREG_FRMFILT0_FRAME_FILTER_EN; - } else { - REG(RFCORE_XREG_FRMFILT0) &= ~RFCORE_XREG_FRMFILT0_FRAME_FILTER_EN; - } -} -/*---------------------------------------------------------------------------*/ -static void -set_shr_search(int enable) -{ - if(enable) { - REG(RFCORE_XREG_FRMCTRL0) &= ~RFCORE_XREG_FRMCTRL0_RX_MODE; - } else { - REG(RFCORE_XREG_FRMCTRL0) |= RFCORE_XREG_FRMCTRL0_RX_MODE; - } -} -/*---------------------------------------------------------------------------*/ -static void -mac_timer_init(void) -{ - CLOCK_STABLE(); - REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_SYNC; - REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_RUN; - while(!(REG(RFCORE_SFR_MTCTRL) & RFCORE_SFR_MTCTRL_STATE)); - REG(RFCORE_SFR_MTCTRL) &= ~RFCORE_SFR_MTCTRL_RUN; - while(REG(RFCORE_SFR_MTCTRL) & RFCORE_SFR_MTCTRL_STATE); - REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_SYNC; - REG(RFCORE_SFR_MTCTRL) |= (RFCORE_SFR_MTCTRL_RUN); - while(!(REG(RFCORE_SFR_MTCTRL) & RFCORE_SFR_MTCTRL_STATE)); -} -/*---------------------------------------------------------------------------*/ -static void -set_poll_mode(uint8_t enable) -{ - poll_mode = enable; - - if(enable) { - mac_timer_init(); - REG(RFCORE_XREG_RFIRQM0) &= ~RFCORE_XREG_RFIRQM0_FIFOP; /* mask out FIFOP interrupt source */ - REG(RFCORE_SFR_RFIRQF0) &= ~RFCORE_SFR_RFIRQF0_FIFOP; /* clear pending FIFOP interrupt */ - NVIC_DisableIRQ(RF_TX_RX_IRQn); /* disable RF interrupts */ - } else { - REG(RFCORE_XREG_RFIRQM0) |= RFCORE_XREG_RFIRQM0_FIFOP; /* enable FIFOP interrupt source */ - NVIC_EnableIRQ(RF_TX_RX_IRQn); /* enable RF interrupts */ - } -} -/*---------------------------------------------------------------------------*/ -static void -set_send_on_cca(uint8_t enable) -{ - send_on_cca = enable; -} -/*---------------------------------------------------------------------------*/ -static void -set_auto_ack(uint8_t enable) -{ - if(enable) { - REG(RFCORE_XREG_FRMCTRL0) |= RFCORE_XREG_FRMCTRL0_AUTOACK; - } else { - REG(RFCORE_XREG_FRMCTRL0) &= ~RFCORE_XREG_FRMCTRL0_AUTOACK; - } -} -/*---------------------------------------------------------------------------*/ -static uint32_t -get_sfd_timestamp(void) -{ - uint64_t sfd, timer_val, buffer; - - REG(RFCORE_SFR_MTMSEL) = (REG(RFCORE_SFR_MTMSEL) & ~RFCORE_SFR_MTMSEL_MTMSEL) | 0x00000000; - REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_LATCH_MODE; - timer_val = REG(RFCORE_SFR_MTM0) & RFCORE_SFR_MTM0_MTM0; - timer_val |= ((REG(RFCORE_SFR_MTM1) & RFCORE_SFR_MTM1_MTM1) << 8); - REG(RFCORE_SFR_MTMSEL) = (REG(RFCORE_SFR_MTMSEL) & ~RFCORE_SFR_MTMSEL_MTMOVFSEL) | 0x00000000; - timer_val |= ((REG(RFCORE_SFR_MTMOVF0) & RFCORE_SFR_MTMOVF0_MTMOVF0) << 16); - timer_val |= ((REG(RFCORE_SFR_MTMOVF1) & RFCORE_SFR_MTMOVF1_MTMOVF1) << 24); - buffer = REG(RFCORE_SFR_MTMOVF2) & RFCORE_SFR_MTMOVF2_MTMOVF2; - timer_val |= (buffer << 32); - - REG(RFCORE_SFR_MTMSEL) = (REG(RFCORE_SFR_MTMSEL) & ~RFCORE_SFR_MTMSEL_MTMSEL) | 0x00000001; - REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_LATCH_MODE; - sfd = REG(RFCORE_SFR_MTM0) & RFCORE_SFR_MTM0_MTM0; - sfd |= ((REG(RFCORE_SFR_MTM1) & RFCORE_SFR_MTM1_MTM1) << 8); - REG(RFCORE_SFR_MTMSEL) = (REG(RFCORE_SFR_MTMSEL) & ~RFCORE_SFR_MTMSEL_MTMOVFSEL) | 0x00000010; - sfd |= ((REG(RFCORE_SFR_MTMOVF0) & RFCORE_SFR_MTMOVF0_MTMOVF0) << 16); - sfd |= ((REG(RFCORE_SFR_MTMOVF1) & RFCORE_SFR_MTMOVF1_MTMOVF1) << 24); - buffer = REG(RFCORE_SFR_MTMOVF2) & RFCORE_SFR_MTMOVF2_MTMOVF2; - sfd |= (buffer << 32); - - return RTIMER_NOW() - RADIO_TO_RTIMER(timer_val - sfd); -} -/*---------------------------------------------------------------------------*/ -/* Enable or disable radio test mode emmiting modulated or unmodulated - * (carrier) signal. See User's Guide pages 719 and 741. - */ -static uint32_t prev_FRMCTRL0, prev_MDMTEST1; -static uint8_t was_on; - -static void -set_test_mode(uint8_t enable, uint8_t modulated) -{ - radio_value_t mode; - get_value(RADIO_PARAM_POWER_MODE, &mode); - - if(enable) { - if(mode == RADIO_POWER_MODE_CARRIER_ON) { - return; - } - was_on = (mode == RADIO_POWER_MODE_ON); - off(); - prev_FRMCTRL0 = REG(RFCORE_XREG_FRMCTRL0); - /* This constantly transmits random data */ - REG(RFCORE_XREG_FRMCTRL0) = 0x00000042; - if(!modulated) { - prev_MDMTEST1 = REG(RFCORE_XREG_MDMTEST1); - /* ...adding this we send an unmodulated carrier instead */ - REG(RFCORE_XREG_MDMTEST1) = 0x00000018; - } - CC2538_RF_CSP_ISTXON(); - } else { - if(mode != RADIO_POWER_MODE_CARRIER_ON) { - return; - } - CC2538_RF_CSP_ISRFOFF(); - REG(RFCORE_XREG_FRMCTRL0) = prev_FRMCTRL0; - if(!modulated) { - REG(RFCORE_XREG_MDMTEST1) = prev_MDMTEST1; - } - if(was_on) { - on(); - } - } -} -/*---------------------------------------------------------------------------*/ -/* Netstack API radio driver functions */ -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - int cca; - uint8_t was_off = 0; - - LOG_INFO("CCA\n"); - - /* If we are off, turn on first */ - if((REG(RFCORE_XREG_FSMSTAT0) & RFCORE_XREG_FSMSTAT0_FSM_FFCTRL_STATE) == 0) { - was_off = 1; - on(); - } - - /* Wait on RSSI_VALID */ - while((REG(RFCORE_XREG_RSSISTAT) & RFCORE_XREG_RSSISTAT_RSSI_VALID) == 0); - - if(REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_CCA) { - cca = CC2538_RF_CCA_CLEAR; - } else { - cca = CC2538_RF_CCA_BUSY; - } - - /* If we were off, turn back off */ - if(was_off) { - off(); - } - - return cca; -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - LOG_INFO("On\n"); - - if(!(rf_flags & RX_ACTIVE)) { - CC2538_RF_CSP_ISFLUSHRX(); - CC2538_RF_CSP_ISRXON(); - - rf_flags |= RX_ACTIVE; - } - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - LOG_INFO("Off\n"); - - /* Wait for ongoing TX to complete (e.g. this could be an outgoing ACK) */ - while(REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE); - - if(!(REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_FIFOP)) { - CC2538_RF_CSP_ISFLUSHRX(); - } - - /* Don't turn off if we are off as this will trigger a Strobe Error */ - if(REG(RFCORE_XREG_RXENABLE) != 0) { - CC2538_RF_CSP_ISRFOFF(); - } - - rf_flags &= ~RX_ACTIVE; - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -init(void) -{ - LOG_INFO("Init\n"); - - if(rf_flags & RF_ON) { - return 0; - } - - /* Enable clock for the RF Core while Running, in Sleep and Deep Sleep */ - REG(SYS_CTRL_RCGCRFC) = 1; - REG(SYS_CTRL_SCGCRFC) = 1; - REG(SYS_CTRL_DCGCRFC) = 1; - - REG(RFCORE_XREG_CCACTRL0) = CC2538_RF_CCA_THRES; - - /* - * Changes from default values - * See User Guide, section "Register Settings Update" - */ - REG(RFCORE_XREG_TXFILTCFG) = 0x09; /** TX anti-aliasing filter bandwidth */ - REG(RFCORE_XREG_AGCCTRL1) = 0x15; /** AGC target value */ - REG(ANA_REGS_IVCTRL) = 0x0B; /** Bias currents */ - REG(RFCORE_XREG_FSCAL1) = 0x01; /** Tune frequency calibration */ - - /* - * Defaults: - * Auto CRC; Append RSSI, CRC-OK and Corr. Val.; CRC calculation; - * RX and TX modes with FIFOs - */ - REG(RFCORE_XREG_FRMCTRL0) = RFCORE_XREG_FRMCTRL0_AUTOCRC; - -#if CC2538_RF_AUTOACK - REG(RFCORE_XREG_FRMCTRL0) |= RFCORE_XREG_FRMCTRL0_AUTOACK; -#endif - - /* Disable source address matching and autopend */ - REG(RFCORE_XREG_SRCMATCH) = 0; - - /* MAX FIFOP threshold */ - REG(RFCORE_XREG_FIFOPCTRL) = CC2538_RF_MAX_PACKET_LEN; - - /* Set TX Power */ - REG(RFCORE_XREG_TXPOWER) = CC2538_RF_TX_POWER; - - set_channel(rf_channel); - - /* Enable SHR search */ - set_shr_search(1); - - /* Acknowledge all RF Error interrupts */ - REG(RFCORE_XREG_RFERRM) = RFCORE_XREG_RFERRM_RFERRM; - NVIC_EnableIRQ(RF_ERR_IRQn); - - if(CC2538_RF_CONF_TX_USE_DMA) { - /* Disable peripheral triggers for the channel */ - udma_channel_mask_set(CC2538_RF_CONF_TX_DMA_CHAN); - - /* - * Set the channel's DST. SRC can not be set yet since it will change for - * each transfer - */ - udma_set_channel_dst(CC2538_RF_CONF_TX_DMA_CHAN, RFCORE_SFR_RFDATA); - } - - if(CC2538_RF_CONF_RX_USE_DMA) { - /* Disable peripheral triggers for the channel */ - udma_channel_mask_set(CC2538_RF_CONF_RX_DMA_CHAN); - - /* - * Set the channel's SRC. DST can not be set yet since it will change for - * each transfer - */ - udma_set_channel_src(CC2538_RF_CONF_RX_DMA_CHAN, RFCORE_SFR_RFDATA); - } - - set_poll_mode(poll_mode); - - process_start(&cc2538_rf_process, NULL); - - rf_flags |= RF_ON; - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -prepare(const void *payload, unsigned short payload_len) -{ - uint8_t i; - - LOG_INFO("Prepare 0x%02x bytes\n", payload_len + CHECKSUM_LEN); - - /* - * When we transmit in very quick bursts, make sure previous transmission - * is not still in progress before re-writing to the TX FIFO - */ - while(REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE); - - if((rf_flags & RX_ACTIVE) == 0) { - on(); - } - - CC2538_RF_CSP_ISFLUSHTX(); - - LOG_INFO("data = "); - /* Send the phy length byte first */ - REG(RFCORE_SFR_RFDATA) = payload_len + CHECKSUM_LEN; - - if(CC2538_RF_CONF_TX_USE_DMA) { - LOG_INFO_(""); - - /* Set the transfer source's end address */ - udma_set_channel_src(CC2538_RF_CONF_TX_DMA_CHAN, - (uint32_t)(payload) + payload_len - 1); - - /* Configure the control word */ - udma_set_channel_control_word(CC2538_RF_CONF_TX_DMA_CHAN, - UDMA_TX_FLAGS | udma_xfer_size(payload_len)); - - /* Enabled the RF TX uDMA channel */ - udma_channel_enable(CC2538_RF_CONF_TX_DMA_CHAN); - - /* Trigger the uDMA transfer */ - udma_channel_sw_request(CC2538_RF_CONF_TX_DMA_CHAN); - - /* - * No need to wait for this to end. Even if transmit() gets called - * immediately, the uDMA controller will stream the frame to the TX FIFO - * faster than transmit() can empty it - */ - } else { - for(i = 0; i < payload_len; i++) { - REG(RFCORE_SFR_RFDATA) = ((unsigned char *)(payload))[i]; - LOG_INFO_("%02x", ((unsigned char *)(payload))[i]); - } - } - LOG_INFO_("\n"); - - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -transmit(unsigned short transmit_len) -{ - uint8_t counter; - int ret = RADIO_TX_ERR; - rtimer_clock_t t0; - uint8_t was_off = 0; - - LOG_INFO("Transmit\n"); - - if(!(rf_flags & RX_ACTIVE)) { - t0 = RTIMER_NOW(); - on(); - was_off = 1; - while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + ONOFF_TIME)); - } - - if(send_on_cca) { - if(channel_clear() == CC2538_RF_CCA_BUSY) { - return RADIO_TX_COLLISION; - } - } - - /* - * prepare() double checked that TX_ACTIVE is low. If SFD is high we are - * receiving. Abort transmission and bail out with RADIO_TX_COLLISION - */ - if(REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_SFD) { - return RADIO_TX_COLLISION; - } - - /* Start the transmission */ - ENERGEST_SWITCH(ENERGEST_TYPE_LISTEN, ENERGEST_TYPE_TRANSMIT); - - CC2538_RF_CSP_ISTXON(); - - counter = 0; - while(!((REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE)) - && (counter++ < 3)) { - clock_delay_usec(6); - } - - if(!(REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE)) { - LOG_ERR("TX never active.\n"); - CC2538_RF_CSP_ISFLUSHTX(); - ret = RADIO_TX_ERR; - } else { - /* Wait for the transmission to finish */ - while(REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE); - ret = RADIO_TX_OK; - } - ENERGEST_SWITCH(ENERGEST_TYPE_TRANSMIT, ENERGEST_TYPE_LISTEN); - - if(was_off) { - off(); - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -send(const void *payload, unsigned short payload_len) -{ - prepare(payload, payload_len); - return transmit(payload_len); -} -/*---------------------------------------------------------------------------*/ -static int -read(void *buf, unsigned short bufsize) -{ - uint8_t i; - uint8_t len; - - LOG_INFO("Read\n"); - - if((REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_FIFOP) == 0) { - return 0; - } - - /* Check the length */ - len = REG(RFCORE_SFR_RFDATA); - - /* Check for validity */ - if(len > CC2538_RF_MAX_PACKET_LEN) { - /* Oops, we must be out of sync. */ - LOG_ERR("RF: bad sync\n"); - - CC2538_RF_CSP_ISFLUSHRX(); - return 0; - } - - if(len <= CC2538_RF_MIN_PACKET_LEN) { - LOG_ERR("RF: too short\n"); - - CC2538_RF_CSP_ISFLUSHRX(); - return 0; - } - - if(len - CHECKSUM_LEN > bufsize) { - LOG_ERR("RF: too long\n"); - - CC2538_RF_CSP_ISFLUSHRX(); - return 0; - } - - /* If we reach here, chances are the FIFO is holding a valid frame */ - LOG_INFO("read (0x%02x bytes) = ", len); - len -= CHECKSUM_LEN; - - /* Don't bother with uDMA for short frames (e.g. ACKs) */ - if(CC2538_RF_CONF_RX_USE_DMA && len > UDMA_RX_SIZE_THRESHOLD) { - LOG_INFO_(""); - - /* Set the transfer destination's end address */ - udma_set_channel_dst(CC2538_RF_CONF_RX_DMA_CHAN, - (uint32_t)(buf) + len - 1); - - /* Configure the control word */ - udma_set_channel_control_word(CC2538_RF_CONF_RX_DMA_CHAN, - UDMA_RX_FLAGS | udma_xfer_size(len)); - - /* Enabled the RF RX uDMA channel */ - udma_channel_enable(CC2538_RF_CONF_RX_DMA_CHAN); - - /* Trigger the uDMA transfer */ - udma_channel_sw_request(CC2538_RF_CONF_RX_DMA_CHAN); - - /* Wait for the transfer to complete. */ - while(udma_channel_get_mode(CC2538_RF_CONF_RX_DMA_CHAN)); - } else { - for(i = 0; i < len; ++i) { - ((unsigned char *)(buf))[i] = REG(RFCORE_SFR_RFDATA); - LOG_INFO_("%02x", ((unsigned char *)(buf))[i]); - } - } - - /* Read the RSSI and CRC/Corr bytes */ - rssi = ((int8_t)REG(RFCORE_SFR_RFDATA)) - RSSI_OFFSET; - crc_corr = REG(RFCORE_SFR_RFDATA); - - LOG_INFO_("%02x%02x\n", (uint8_t)rssi, crc_corr); - - /* MS bit CRC OK/Not OK, 7 LS Bits, Correlation value */ - if(crc_corr & CRC_BIT_MASK) { - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, rssi); - packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, crc_corr & LQI_BIT_MASK); - } else { - LOG_ERR("Bad CRC\n"); - CC2538_RF_CSP_ISFLUSHRX(); - return 0; - } - - if(!poll_mode) { - /* If FIFOP==1 and FIFO==0 then we had a FIFO overflow at some point. */ - if(REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_FIFOP) { - if(REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_FIFO) { - process_poll(&cc2538_rf_process); - } else { - CC2538_RF_CSP_ISFLUSHRX(); - } - } - } - - return len; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - LOG_INFO("Receiving\n"); - - /* - * SFD high while transmitting and receiving. - * TX_ACTIVE high only when transmitting - * - * FSMSTAT1 & (TX_ACTIVE | SFD) == SFD <=> receiving - */ - return (REG(RFCORE_XREG_FSMSTAT1) - & (RFCORE_XREG_FSMSTAT1_TX_ACTIVE | RFCORE_XREG_FSMSTAT1_SFD)) - == RFCORE_XREG_FSMSTAT1_SFD; -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - LOG_INFO("Pending\n"); - - return REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_FIFOP; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - if(!value) { - return RADIO_RESULT_INVALID_VALUE; - } - - switch(param) { - case RADIO_PARAM_POWER_MODE: - if((REG(RFCORE_XREG_RXENABLE) & RFCORE_XREG_RXENABLE_RXENMASK) == 0) { - *value = RADIO_POWER_MODE_OFF; - } else { - *value = (REG(RFCORE_XREG_FRMCTRL0) & RFCORE_XREG_FRMCTRL0_TX_MODE) == 0 - ? RADIO_POWER_MODE_ON : RADIO_POWER_MODE_CARRIER_ON; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_CHANNEL: - *value = (radio_value_t)get_channel(); - return RADIO_RESULT_OK; - case RADIO_PARAM_PAN_ID: - *value = get_pan_id(); - return RADIO_RESULT_OK; - case RADIO_PARAM_16BIT_ADDR: - *value = get_short_addr(); - return RADIO_RESULT_OK; - case RADIO_PARAM_RX_MODE: - *value = 0; - if(REG(RFCORE_XREG_FRMFILT0) & RFCORE_XREG_FRMFILT0_FRAME_FILTER_EN) { - *value |= RADIO_RX_MODE_ADDRESS_FILTER; - } - if(REG(RFCORE_XREG_FRMCTRL0) & RFCORE_XREG_FRMCTRL0_AUTOACK) { - *value |= RADIO_RX_MODE_AUTOACK; - } - if(poll_mode) { - *value |= RADIO_RX_MODE_POLL_MODE; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_TX_MODE: - *value = 0; - if(send_on_cca) { - *value |= RADIO_TX_MODE_SEND_ON_CCA; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_TXPOWER: - *value = get_tx_power(); - return RADIO_RESULT_OK; - case RADIO_PARAM_CCA_THRESHOLD: - *value = get_cca_threshold(); - return RADIO_RESULT_OK; - case RADIO_PARAM_RSSI: - *value = get_rssi(); - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_RSSI: - *value = rssi; - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_LINK_QUALITY: - *value = crc_corr & LQI_BIT_MASK; - return RADIO_RESULT_OK; - case RADIO_CONST_CHANNEL_MIN: - *value = CC2538_RF_CHANNEL_MIN; - return RADIO_RESULT_OK; - case RADIO_CONST_CHANNEL_MAX: - *value = CC2538_RF_CHANNEL_MAX; - return RADIO_RESULT_OK; - case RADIO_CONST_TXPOWER_MIN: - *value = OUTPUT_POWER_MIN; - return RADIO_RESULT_OK; - case RADIO_CONST_TXPOWER_MAX: - *value = OUTPUT_POWER_MAX; - return RADIO_RESULT_OK; - case RADIO_CONST_PHY_OVERHEAD: - *value = (radio_value_t)3; /* 1 len byte, 2 bytes CRC */ - return RADIO_RESULT_OK; - case RADIO_CONST_BYTE_AIR_TIME: - *value = (radio_value_t)32; /* 250kbps data rate. One byte = 32us.*/ - return RADIO_RESULT_OK; - case RADIO_CONST_DELAY_BEFORE_TX: - *value = (radio_value_t)CC2538_DELAY_BEFORE_TX; - return RADIO_RESULT_OK; - case RADIO_CONST_DELAY_BEFORE_RX: - *value = (radio_value_t)CC2538_DELAY_BEFORE_RX; - return RADIO_RESULT_OK; - case RADIO_CONST_DELAY_BEFORE_DETECT: - *value = (radio_value_t)CC2538_DELAY_BEFORE_DETECT; - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - switch(param) { - case RADIO_PARAM_POWER_MODE: - if(value == RADIO_POWER_MODE_ON) { - on(); - return RADIO_RESULT_OK; - } - if(value == RADIO_POWER_MODE_OFF) { - off(); - return RADIO_RESULT_OK; - } - if(value == RADIO_POWER_MODE_CARRIER_ON || - value == RADIO_POWER_MODE_CARRIER_OFF) { - set_test_mode((value == RADIO_POWER_MODE_CARRIER_ON), 0); - return RADIO_RESULT_OK; - } - return RADIO_RESULT_INVALID_VALUE; - case RADIO_PARAM_CHANNEL: - if(value < CC2538_RF_CHANNEL_MIN || - value > CC2538_RF_CHANNEL_MAX) { - return RADIO_RESULT_INVALID_VALUE; - } - set_channel(value); - return RADIO_RESULT_OK; - case RADIO_PARAM_PAN_ID: - set_pan_id(value & 0xffff); - return RADIO_RESULT_OK; - case RADIO_PARAM_16BIT_ADDR: - set_short_addr(value & 0xffff); - return RADIO_RESULT_OK; - case RADIO_PARAM_RX_MODE: - if(value & ~(RADIO_RX_MODE_ADDRESS_FILTER | - RADIO_RX_MODE_AUTOACK | - RADIO_RX_MODE_POLL_MODE)) { - return RADIO_RESULT_INVALID_VALUE; - } - - set_frame_filtering((value & RADIO_RX_MODE_ADDRESS_FILTER) != 0); - set_auto_ack((value & RADIO_RX_MODE_AUTOACK) != 0); - set_poll_mode((value & RADIO_RX_MODE_POLL_MODE) != 0); - - return RADIO_RESULT_OK; - case RADIO_PARAM_TX_MODE: - if(value & ~(RADIO_TX_MODE_SEND_ON_CCA)) { - return RADIO_RESULT_INVALID_VALUE; - } - set_send_on_cca((value & RADIO_TX_MODE_SEND_ON_CCA) != 0); - return RADIO_RESULT_OK; - case RADIO_PARAM_TXPOWER: - if(value < OUTPUT_POWER_MIN || value > OUTPUT_POWER_MAX) { - return RADIO_RESULT_INVALID_VALUE; - } - - set_tx_power(value); - return RADIO_RESULT_OK; - case RADIO_PARAM_CCA_THRESHOLD: - set_cca_threshold(value); - return RADIO_RESULT_OK; - case RADIO_PARAM_SHR_SEARCH: - set_shr_search(value); - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - uint8_t *target; - int i; - - if(param == RADIO_PARAM_64BIT_ADDR) { - if(size != 8 || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - - target = dest; - for(i = 0; i < 8; i++) { - target[i] = ((uint32_t *)RFCORE_FFSM_EXT_ADDR0)[7 - i] & 0xFF; - } - - return RADIO_RESULT_OK; - } - - if(param == RADIO_PARAM_LAST_PACKET_TIMESTAMP) { - if(size != sizeof(rtimer_clock_t) || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - *(rtimer_clock_t *)dest = get_sfd_timestamp(); - return RADIO_RESULT_OK; - } - -#if MAC_CONF_WITH_TSCH - if(param == RADIO_CONST_TSCH_TIMING) { - if(size != sizeof(uint16_t *) || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - /* Assigned value: a pointer to the TSCH timing in usec */ - *(const uint16_t **)dest = tsch_timeslot_timing_us_10000; - return RADIO_RESULT_OK; - } -#endif /* MAC_CONF_WITH_TSCH */ - - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - int i; - - if(param == RADIO_PARAM_64BIT_ADDR) { - if(size != 8 || !src) { - return RADIO_RESULT_INVALID_VALUE; - } - - for(i = 0; i < 8; i++) { - ((uint32_t *)RFCORE_FFSM_EXT_ADDR0)[i] = ((uint8_t *)src)[7 - i]; - } - - return RADIO_RESULT_OK; - } - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -const struct radio_driver cc2538_rf_driver = { - init, - prepare, - transmit, - send, - read, - channel_clear, - receiving_packet, - pending_packet, - on, - off, - get_value, - set_value, - get_object, - set_object -}; -/*---------------------------------------------------------------------------*/ -/** - * \brief Implementation of the cc2538 RF driver process - * - * This process is started by init(). It simply sits there waiting for - * an event. Upon frame reception, the RX ISR will poll this process. - * Subsequently, the contiki core will generate an event which will - * call this process so that the received frame can be picked up from - * the RF RX FIFO - * - */ -PROCESS_THREAD(cc2538_rf_process, ev, data) -{ - int len; - PROCESS_BEGIN(); - - while(1) { - /* Only if we are not in poll mode oder we are in poll mode and transceiver has to be reset */ - PROCESS_YIELD_UNTIL((!poll_mode || (poll_mode && (rf_flags & RF_MUST_RESET))) && (ev == PROCESS_EVENT_POLL)); - - if(!poll_mode) { - packetbuf_clear(); - len = read(packetbuf_dataptr(), PACKETBUF_SIZE); - - if(len > 0) { - packetbuf_set_datalen(len); - - NETSTACK_MAC.input(); - } - } - - /* If we were polled due to an RF error, reset the transceiver */ - if(rf_flags & RF_MUST_RESET) { - uint8_t was_on; - rf_flags = 0; - - /* save state so we know if to switch on again after re-init */ - if((REG(RFCORE_XREG_FSMSTAT0) & RFCORE_XREG_FSMSTAT0_FSM_FFCTRL_STATE) == 0) { - was_on = 0; - } else { - was_on = 1; - } - off(); - init(); - if(was_on) { - /* switch back on */ - on(); - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief The cc2538 RF RX/TX ISR - * - * This is the interrupt service routine for all RF interrupts relating - * to RX and TX. Error conditions are handled by cc2538_rf_err_isr(). - * Currently, we only acknowledge the FIFOP interrupt source. - */ -void -cc2538_rf_rx_tx_isr(void) -{ - if(!poll_mode) { - process_poll(&cc2538_rf_process); - } - - /* We only acknowledge FIFOP so we can safely wipe out the entire SFR */ - REG(RFCORE_SFR_RFIRQF0) = 0; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief The cc2538 RF Error ISR - * - * This is the interrupt service routine for all RF errors. We - * acknowledge every error type and instead of trying to be smart and - * act differently depending on error condition, we simply reset the - * transceiver. RX FIFO overflow is an exception, we ignore this error - * since read() handles it anyway. - * - * However, we don't want to reset within this ISR. If the error occurs - * while we are reading a frame out of the FIFO, trashing the FIFO in - * the middle of read(), would result in further errors (RX underflows). - * - * Instead, we set a flag and poll the driver process. The process will - * reset the transceiver without any undesirable consequences. - */ -void -cc2538_rf_err_isr(void) -{ - LOG_ERR("Error 0x%08lx occurred\n", REG(RFCORE_SFR_RFERRF)); - - /* If the error is not an RX FIFO overflow, set a flag */ - if(REG(RFCORE_SFR_RFERRF) != RFCORE_SFR_RFERRF_RXOVERF) { - rf_flags |= RF_MUST_RESET; - } - - REG(RFCORE_SFR_RFERRF) = 0; - - process_poll(&cc2538_rf_process); -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/arch/cpu/cc2538/dev/cc2538-rf.h b/arch/cpu/cc2538/dev/cc2538-rf.h deleted file mode 100644 index 958221783..000000000 --- a/arch/cpu/cc2538/dev/cc2538-rf.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-rf cc2538 RF Driver - * - * Driver implementation for the cc2538 RF transceiver - * @{ - * - * \file - * Header file for the cc2538 RF driver - */ -#ifndef CC2538_RF_H__ -#define CC2538_RF_H__ - -#include "contiki.h" -#include "dev/radio.h" -#include "dev/rfcore.h" -#include "reg.h" -/*--------------------------------------------------------------------------- - * RF Config - *---------------------------------------------------------------------------*/ -/* Constants */ -#define CC2538_RF_CCA_THRES_USER_GUIDE 0xF8 -#define CC2538_RF_TX_POWER_RECOMMENDED 0xD5 /* ToDo: Determine value */ -#define CC2538_RF_CHANNEL_MIN 11 -#define CC2538_RF_CHANNEL_MAX 26 -#define CC2538_RF_CHANNEL_SPACING 5 -#define CC2538_RF_MAX_PACKET_LEN 127 -#define CC2538_RF_MIN_PACKET_LEN 4 -#define CC2538_RF_CCA_CLEAR 1 -#define CC2538_RF_CCA_BUSY 0 -/*---------------------------------------------------------------------------*/ -#ifdef CC2538_RF_CONF_TX_POWER -#define CC2538_RF_TX_POWER CC2538_RF_CONF_TX_POWER -#else -#define CC2538_RF_TX_POWER CC2538_RF_TX_POWER_RECOMMENDED -#endif /* CC2538_RF_CONF_TX_POWER */ - -#ifdef CC2538_RF_CONF_CCA_THRES -#define CC2538_RF_CCA_THRES CC2538_RF_CONF_CCA_THRES -#else -#define CC2538_RF_CCA_THRES CC2538_RF_CCA_THRES_USER_GUIDE -#endif /* CC2538_RF_CONF_CCA_THRES */ - -#ifdef CC2538_RF_CONF_AUTOACK -#define CC2538_RF_AUTOACK CC2538_RF_CONF_AUTOACK -#else -#define CC2538_RF_AUTOACK 1 -#endif /* CC2538_RF_CONF_AUTOACK */ -/*--------------------------------------------------------------------------- - * Command Strobe Processor - *---------------------------------------------------------------------------*/ -/* OPCODES */ -#define CC2538_RF_CSP_OP_ISRXON 0xE3 -#define CC2538_RF_CSP_OP_ISTXON 0xE9 -#define CC2538_RF_CSP_OP_ISTXONCCA 0xEA -#define CC2538_RF_CSP_OP_ISRFOFF 0xEF -#define CC2538_RF_CSP_OP_ISFLUSHRX 0xED -#define CC2538_RF_CSP_OP_ISFLUSHTX 0xEE - -/** - * \brief Send an RX ON command strobe to the CSP - */ -#define CC2538_RF_CSP_ISRXON() \ - do { REG(RFCORE_SFR_RFST) = CC2538_RF_CSP_OP_ISRXON; } while(0) - -/** - * \brief Send a TX ON command strobe to the CSP - */ -#define CC2538_RF_CSP_ISTXON() \ - do { REG(RFCORE_SFR_RFST) = CC2538_RF_CSP_OP_ISTXON; } while(0) - -/** - * \brief Send a RF OFF command strobe to the CSP - */ -#define CC2538_RF_CSP_ISRFOFF() \ - do { REG(RFCORE_SFR_RFST) = CC2538_RF_CSP_OP_ISRFOFF; } while(0) - -/** - * \brief Flush the RX FIFO - */ -#define CC2538_RF_CSP_ISFLUSHRX() do { \ - REG(RFCORE_SFR_RFST) = CC2538_RF_CSP_OP_ISFLUSHRX; \ -} while(0) - -/** - * \brief Flush the TX FIFO - */ -#define CC2538_RF_CSP_ISFLUSHTX() do { \ - REG(RFCORE_SFR_RFST) = CC2538_RF_CSP_OP_ISFLUSHTX; \ -} while(0) -/*---------------------------------------------------------------------------*/ -/** The NETSTACK data structure for the cc2538 RF driver */ -extern const struct radio_driver cc2538_rf_driver; -/*---------------------------------------------------------------------------*/ -/** - * \brief Sets addresses and PAN identifier to the relevant RF hardware - * registers - * \param pan The PAN Identifier - * - * Values for short and extended addresses are not needed as parameters - * since they exist in the linkaddr buffer in the contiki core. They - * are thus simply copied over from there. - */ -void cc2538_rf_set_addr(uint16_t pan); - -/*---------------------------------------------------------------------------*/ -#endif /* CC2538_RF_H__ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/cc2538-sensors.h b/arch/cpu/cc2538/dev/cc2538-sensors.h deleted file mode 100644 index b4d3ada91..000000000 --- a/arch/cpu/cc2538/dev/cc2538-sensors.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-sensors CC2538 Built-In Sensors - * - * Module controlling sensors on the CC2538 SoC (Tmp and VDD3) - * @{ - * - * \file - * Generic header usable by all CC2538 sensor drivers - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC2538_SENSORS_H_ -#define CC2538_SENSORS_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -#include "dev/cc2538-temp-sensor.h" -#include "dev/vdd3-sensor.h" -/*---------------------------------------------------------------------------*/ -/** - * \name CC2538 sensor constants - * - * These constants are used by various sensors on the CC2538. They can be used - * to differentiate between raw and converted readings, to configure ADC - * decimation rate (where applicable). - * @{ - */ -#define CC2538_SENSORS_VALUE_TYPE_RAW 0 /**< Request the raw reading */ -#define CC2538_SENSORS_VALUE_TYPE_CONVERTED 1 /**< Request the converted reading */ - -#define CC2538_SENSORS_ERROR 0x80000000 /**< Generic Error */ -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* CC2538_SENSORS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/cc2538-temp-sensor.c b/arch/cpu/cc2538/dev/cc2538-temp-sensor.c deleted file mode 100644 index dd5dcba6c..000000000 --- a/arch/cpu/cc2538/dev/cc2538-temp-sensor.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538-temp-sensor - * @{ - * - * \file - * Driver for the CC2538 On-Chip temperature sensor - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/adc.h" -#include "dev/cc2538-sensors.h" - -#include -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - int raw = adc_get(SOC_ADC_ADCCON_CH_TEMP, SOC_ADC_ADCCON_REF_INT, - SOC_ADC_ADCCON_DIV_512); - - if(type == CC2538_SENSORS_VALUE_TYPE_RAW) { - return raw; - } else if(type == CC2538_SENSORS_VALUE_TYPE_CONVERTED) { - return 25000 + ((raw >> 4) - 1422) * 10000 / 42; - } - - return CC2538_SENSORS_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(cc2538_temp_sensor, TEMP_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc2538/dev/cc2538-temp-sensor.h b/arch/cpu/cc2538/dev/cc2538-temp-sensor.h deleted file mode 100644 index b515c5042..000000000 --- a/arch/cpu/cc2538/dev/cc2538-temp-sensor.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538-sensors - * @{ - * - * \defgroup cc2538-temp-sensor CC2538 on-chip temperature Sensor - * - * Driver for the CC2538 on-chip temperature sensor - * - * This driver can return the raw as well as the converted value of the sensor - * reading. This is controlled by the type argument of the sensor driver's - * value() function. The choices for the type argument are: - * - CC2538_SENSORS_VALUE_TYPE_RAW (value() returns the raw reading) - * - CC2538_SENSORS_VALUE_TYPE_CONVERTED (value() returns degrees mC) - * @{ - * - * \file - * Header file for the CC2538 on-chip temperature Sensor Driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC2538_TEMP_SENSOR_H_ -#define CC2538_TEMP_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -/** - * \name temperature sensor - * @{ - */ -#define TEMP_SENSOR "On-Chip Temperature" -/** @} */ -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor cc2538_temp_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* CC2538_TEMP_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/ccm.c b/arch/cpu/cc2538/dev/ccm.c deleted file mode 100644 index 7559fbe76..000000000 --- a/arch/cpu/cc2538/dev/ccm.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Original file: - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538-ccm - * @{ - * - * \file - * Implementation of the cc2538 AES-CCM driver - */ -#include "contiki.h" -#include "sys/cc.h" -#include "dev/rom-util.h" -#include "dev/ccm.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -static uint8_t -ccm_auth_crypt_start(uint8_t encrypt, uint8_t len_len, uint8_t key_area, - const void *nonce, const void *adata, uint16_t adata_len, - const void *data_in, void *data_out, uint16_t data_len, - uint8_t mic_len, struct process *process) -{ - uint32_t ctrl; - uint32_t iv[AES_IV_LEN / sizeof(uint32_t)]; - - /* Program AES-CCM authentication/crypto operation */ - ctrl = AES_AES_CTRL_SAVE_CONTEXT | /* Save context */ - (((MAX(mic_len, 2) - 2) >> 1) << AES_AES_CTRL_CCM_M_S) | /* M */ - ((len_len - 1) << AES_AES_CTRL_CCM_L_S) | /* L */ - AES_AES_CTRL_CCM | /* CCM */ - AES_AES_CTRL_CTR_WIDTH_128 | /* CTR width 128 */ - AES_AES_CTRL_CTR | /* CTR */ - (encrypt ? AES_AES_CTRL_DIRECTION_ENCRYPT : 0); /* En/decryption */ - - /* Prepare the crypto initialization vector - * Flags: L' = L - 1 */ - ((uint8_t *)iv)[0] = len_len - 1; - /* Nonce */ - rom_util_memcpy(&((uint8_t *)iv)[CCM_FLAGS_LEN], nonce, - CCM_NONCE_LEN_LEN - len_len); - /* Initialize counter to 0 */ - rom_util_memset(&((uint8_t *)iv)[AES_IV_LEN - len_len], 0, len_len); - - return aes_auth_crypt_start(ctrl, key_area, iv, adata, adata_len, - data_in, data_out, data_len, process); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -ccm_auth_crypt_get_result(const void *cdata, uint16_t cdata_len, - void *mic, uint8_t mic_len) -{ - uint32_t tag[AES_TAG_LEN / sizeof(uint32_t)]; - uint16_t data_len; - uint8_t ret; - - ret = aes_auth_crypt_get_result(NULL, tag); - if(ret != CRYPTO_SUCCESS) { - return ret; - } - - if(cdata != NULL) { - /* Check MIC */ - data_len = cdata_len - mic_len; - if(rom_util_memcmp(tag, &((const uint8_t *)cdata)[data_len], mic_len)) { - ret = AES_AUTHENTICATION_FAILED; - } - } - - /* Copy tag to MIC */ - rom_util_memcpy(mic, tag, mic_len); - - return ret; -} -/*---------------------------------------------------------------------------*/ -uint8_t -ccm_auth_encrypt_start(uint8_t len_len, uint8_t key_area, const void *nonce, - const void *adata, uint16_t adata_len, const void *pdata, - uint16_t pdata_len, void *cdata, uint8_t mic_len, - struct process *process) -{ - return ccm_auth_crypt_start(true, len_len, key_area, nonce, adata, adata_len, - pdata, cdata, pdata_len, mic_len, process); -} -/*---------------------------------------------------------------------------*/ -uint8_t -ccm_auth_encrypt_get_result(void *mic, uint8_t mic_len) -{ - return ccm_auth_crypt_get_result(NULL, 0, mic, mic_len); -} -/*---------------------------------------------------------------------------*/ -uint8_t -ccm_auth_decrypt_start(uint8_t len_len, uint8_t key_area, const void *nonce, - const void *adata, uint16_t adata_len, const void *cdata, - uint16_t cdata_len, void *pdata, uint8_t mic_len, - struct process *process) -{ - uint16_t data_len = cdata_len - mic_len; - - return ccm_auth_crypt_start(false, len_len, key_area, nonce, adata, adata_len, - cdata, pdata, data_len, mic_len, process); -} -/*---------------------------------------------------------------------------*/ -uint8_t -ccm_auth_decrypt_get_result(const void *cdata, uint16_t cdata_len, - void *mic, uint8_t mic_len) -__attribute__ ((alias("ccm_auth_crypt_get_result"))); - -/** @} */ diff --git a/arch/cpu/cc2538/dev/ccm.h b/arch/cpu/cc2538/dev/ccm.h deleted file mode 100644 index 156cd1a6f..000000000 --- a/arch/cpu/cc2538/dev/ccm.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Original file: - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538-aes - * @{ - * - * \defgroup cc2538-ccm cc2538 AES-CCM - * - * Driver for the cc2538 AES-CCM mode of the security core - * @{ - * - * \file - * Header file for the cc2538 AES-CCM driver - */ -#ifndef CCM_H_ -#define CCM_H_ - -#include "contiki.h" -#include "dev/aes.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/** \name AES-CCM constants - * @{ - */ -#define CCM_FLAGS_LEN 1 -#define CCM_NONCE_LEN_LEN (AES_IV_LEN - CCM_FLAGS_LEN) -#define CCM_MIC_MAX_LEN AES_TAG_LEN -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES-CCM functions - * @{ - */ - -/** \brief Starts a CCM authentication and encryption operation - * \param len_len Number of octets in length field (2, 4, or 8) - * \param key_area Area in Key RAM where the key is stored (0 to - * \c AES_KEY_AREAS - 1) - * \param nonce Pointer to nonce (\c CCM_NONCE_LEN_LEN - \p len_len octets) - * \param adata Pointer to additional authenticated data in SRAM, or \c NULL - * \param adata_len Length of additional authenticated data in octets, or \c 0 - * \param pdata Pointer to message to authenticate and encrypt in SRAM, or - * \c NULL - * \param pdata_len Length of message to authenticate and encrypt in octets, or - * \c 0 - * \param cdata Pointer to encrypted message in SRAM (may be \p pdata), or - * \c NULL - * \param mic_len Number of octets in authentication field (even value between 0 - * and \c CCM_MIC_MAX_LEN) - * \param process Process to be polled upon completion of the operation, or - * \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/CCM error code - */ -uint8_t ccm_auth_encrypt_start(uint8_t len_len, uint8_t key_area, - const void *nonce, const void *adata, - uint16_t adata_len, const void *pdata, - uint16_t pdata_len, void *cdata, uint8_t mic_len, - struct process *process); - -/** \brief Checks the status of the CCM authentication and encryption operation - * \retval false Result not yet available, and no error occurred - * \retval true Result available, or error occurred - */ -#define ccm_auth_encrypt_check_status aes_auth_crypt_check_status - -/** \brief Gets the result of the CCM authentication and encryption operation - * \param mic Pointer to authentication field, or \c NULL - * \param mic_len Number of octets in authentication field (even value between 0 - * and \c CCM_MIC_MAX_LEN) - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/CCM error code - * \note This function must be called only after \c ccm_auth_encrypt_start(). - */ -uint8_t ccm_auth_encrypt_get_result(void *mic, uint8_t mic_len); - -/** \brief Starts a CCM authentication checking and decryption operation - * \param len_len Number of octets in length field (2, 4, or 8) - * \param key_area Area in Key RAM where the key is stored (0 to - * \c AES_KEY_AREAS - 1) - * \param nonce Pointer to nonce (\c CCM_NONCE_LEN_LEN - \p len_len octets) - * \param adata Pointer to additional authenticated data in SRAM, or \c NULL - * \param adata_len Length of additional authenticated data in octets, or \c 0 - * \param cdata Pointer to encrypted and authenticated message in SRAM - * \param cdata_len Length of encrypted and authenticated message in octets - * \param pdata Pointer to decrypted message in SRAM (may be \p cdata), or - * \c NULL - * \param mic_len Number of octets in authentication field (even value between 0 - * and \c CCM_MIC_MAX_LEN) - * \param process Process to be polled upon completion of the operation, or - * \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/CCM error code - */ -uint8_t ccm_auth_decrypt_start(uint8_t len_len, uint8_t key_area, - const void *nonce, const void *adata, - uint16_t adata_len, const void *cdata, - uint16_t cdata_len, void *pdata, uint8_t mic_len, - struct process *process); - -/** \brief Checks the status of the CCM authentication checking and decryption - * operation - * \retval false Result not yet available, and no error occurred - * \retval true Result available, or error occurred - */ -#define ccm_auth_decrypt_check_status aes_auth_crypt_check_status - -/** \brief Gets the result of the CCM authentication checking and decryption - * operation - * \param cdata Pointer to encrypted and authenticated message - * \param cdata_len Length of encrypted and authenticated message in octets - * \param mic Pointer to authentication field, or \c NULL - * \param mic_len Number of octets in authentication field (even value between 0 - * and \c CCM_MIC_MAX_LEN) - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/CCM error code - * \note This function must be called only after \c ccm_auth_decrypt_start(). - */ -uint8_t ccm_auth_decrypt_get_result(const void *cdata, uint16_t cdata_len, - void *mic, uint8_t mic_len); - -/** @} */ - -#endif /* CCM_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/cctest.h b/arch/cpu/cc2538/dev/cctest.h deleted file mode 100644 index 4f540969a..000000000 --- a/arch/cpu/cc2538/dev/cctest.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Original file: - * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-rfcore - * @{ - * - * \file - * Header with declarations of CCTEST module registers. - */ -#ifndef CCTEST_H -#define CCTEST_H - -/*---------------------------------------------------------------------------*/ -/** - * \name CCTEST register offsets - * @{ - */ -#define CCTEST_IO 0x44010000 /**< Output strength control */ -#define CCTEST_OBSSEL0 0x44010014 /**< Observation output 0 */ -#define CCTEST_OBSSEL1 0x44010018 /**< Observation output 1 */ -#define CCTEST_OBSSEL2 0x4401001C /**< Observation output 2 */ -#define CCTEST_OBSSEL3 0x44010020 /**< Observation output 3 */ -#define CCTEST_OBSSEL4 0x44010024 /**< Observation output 4 */ -#define CCTEST_OBSSEL5 0x44010028 /**< Observation output 5 */ -#define CCTEST_OBSSEL6 0x4401002C /**< Observation output 6 */ -#define CCTEST_OBSSEL7 0x44010030 /**< Observation output 7 */ -#define CCTEST_TR0 0x44010034 /**< Test register 0 */ -#define CCTEST_USBCTRL 0x44010050 /**< USB PHY stand-by control */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name CCTEST_IO register bit fields - * @{ - */ -#define CCTEST_IO_SC 0x00000001 /**< I/O strength control */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name CCTEST_OBSSELx registers bit fields - * @{ - */ -#define CCTEST_OBSSEL_EN 0x00000080 /**< Observation output enable */ -#define CCTEST_OBSSEL_SEL_M 0x0000007F /**< n - obs_sigs[n] output selection mask */ -#define CCTEST_OBSSEL_SEL_S 0 /**< n - obs_sigs[n] output selection shift */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name CCTEST_TR0 register bit fields - * @{ - */ -#define CCTEST_TR0_ADCTM 0x00000002 /**< Connect temperature sensor to ADC */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name CCTEST_USBCTRL register bit fields - * @{ - */ -#define CCTEST_USBCTRL_USB_STB 0x00000001 /**< USB PHY stand-by override */ -/** @} */ - -#endif /* CCTEST_H */ -/** @} */ diff --git a/arch/cpu/cc2538/dev/crypto.c b/arch/cpu/cc2538/dev/crypto.c deleted file mode 100644 index 6b0240ec3..000000000 --- a/arch/cpu/cc2538/dev/crypto.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538-crypto - * @{ - * - * \file - * Implementation of the cc2538 AES/SHA cryptoprocessor driver - */ -#include "contiki.h" -#include "dev/sys-ctrl.h" -#include "dev/nvic.h" -#include "dev/crypto.h" -#include "dev/aes.h" -#include "reg.h" -#include "lpm.h" - -#include -/*---------------------------------------------------------------------------*/ -static volatile struct process *notification_process = NULL; -/*---------------------------------------------------------------------------*/ -/** \brief The AES/SHA cryptoprocessor ISR - * - * This is the interrupt service routine for the AES/SHA - * cryptoprocessor. - * - * This ISR is called at worst from PM0, so lpm_exit() does not need - * to be called. - */ -void -crypto_isr(void) -{ - NVIC_ClearPendingIRQ(AES_IRQn); - NVIC_DisableIRQ(AES_IRQn); - - if(notification_process != NULL) { - process_poll((struct process *)notification_process); - notification_process = NULL; - } -} -/*---------------------------------------------------------------------------*/ -static bool -permit_pm1(void) -{ - return REG(AES_CTRL_ALG_SEL) == 0; -} -/*---------------------------------------------------------------------------*/ -void -crypto_init(void) -{ - volatile int i; - - lpm_register_peripheral(permit_pm1); - - crypto_enable(); - - /* Reset the AES/SHA cryptoprocessor */ - REG(SYS_CTRL_SRSEC) |= SYS_CTRL_SRSEC_AES; - for(i = 0; i < 16; i++); - REG(SYS_CTRL_SRSEC) &= ~SYS_CTRL_SRSEC_AES; -} -/*---------------------------------------------------------------------------*/ -void -crypto_enable(void) -{ - /* Enable the clock for the AES/SHA cryptoprocessor */ - REG(SYS_CTRL_RCGCSEC) |= SYS_CTRL_RCGCSEC_AES; - REG(SYS_CTRL_SCGCSEC) |= SYS_CTRL_SCGCSEC_AES; - REG(SYS_CTRL_DCGCSEC) |= SYS_CTRL_DCGCSEC_AES; -} -/*---------------------------------------------------------------------------*/ -void -crypto_disable(void) -{ - /* Gate the clock for the AES/SHA cryptoprocessor */ - REG(SYS_CTRL_RCGCSEC) &= ~SYS_CTRL_RCGCSEC_AES; - REG(SYS_CTRL_SCGCSEC) &= ~SYS_CTRL_SCGCSEC_AES; - REG(SYS_CTRL_DCGCSEC) &= ~SYS_CTRL_DCGCSEC_AES; -} -/*---------------------------------------------------------------------------*/ -void -crypto_register_process_notification(struct process *p) -{ - notification_process = p; -} - -/** @} */ diff --git a/arch/cpu/cc2538/dev/crypto.h b/arch/cpu/cc2538/dev/crypto.h deleted file mode 100644 index 5d164a400..000000000 --- a/arch/cpu/cc2538/dev/crypto.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-crypto cc2538 AES/SHA cryptoprocessor - * - * Driver for the cc2538 AES/SHA cryptoprocessor - * @{ - * - * \file - * Header file for the cc2538 AES/SHA cryptoprocessor driver - */ -#ifndef CRYPTO_H_ -#define CRYPTO_H_ - -#include "contiki.h" -#include "dev/sys-ctrl.h" -#include "reg.h" -/*---------------------------------------------------------------------------*/ -/** \name Crypto drivers return codes - * @{ - */ -#define CRYPTO_PENDING (-1) -#define CRYPTO_SUCCESS 0 -#define CRYPTO_INVALID_PARAM 1 -#define CRYPTO_NULL_ERROR 2 -#define CRYPTO_RESOURCE_IN_USE 3 -#define CRYPTO_DMA_BUS_ERROR 4 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Crypto macros - * @{ - */ - -/** \brief Indicates whether the AES/SHA cryptoprocessor is enabled - * \return Boolean value indicating whether the AES/SHA cryptoprocessor is - * enabled - */ -#define CRYPTO_IS_ENABLED() (!!(REG(SYS_CTRL_RCGCSEC) & SYS_CTRL_RCGCSEC_AES)) - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Crypto functions - * @{ - */ - -/** \brief Enables and resets the AES/SHA cryptoprocessor - */ -void crypto_init(void); - -/** \brief Enables the AES/SHA cryptoprocessor - */ -void crypto_enable(void); - -/** \brief Disables the AES/SHA cryptoprocessor - * \note Call this function to save power when the cryptoprocessor is unused. - */ -void crypto_disable(void); - -/** \brief Registers a process to be notified of the completion of a crypto - * operation - * \param p Process to be polled upon IRQ - * \note This function is only supposed to be called by the crypto drivers. - */ -void crypto_register_process_notification(struct process *p); - -/** @} */ - -#endif /* CRYPTO_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/ctr.c b/arch/cpu/cc2538/dev/ctr.c deleted file mode 100644 index 0b0a88580..000000000 --- a/arch/cpu/cc2538/dev/ctr.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-ctr - * @{ - * - * \file - * Implementation of the cc2538 AES-CTR driver - */ -#include "contiki.h" -#include "dev/rom-util.h" -#include "dev/ctr.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -uint8_t -ctr_crypt_start(uint8_t encrypt, uint8_t key_area, const void *nonce, - const void *ictr, uint8_t ctr_len, const void *mdata_in, - void *mdata_out, uint16_t mdata_len, struct process *process) -{ - uint32_t ctrl; - uint32_t iv[AES_IV_LEN / sizeof(uint32_t)]; - uint8_t nonce_len; - - /* Program AES-CTR crypto operation */ - ctrl = (((ctr_len >> 2) - 1) << AES_AES_CTRL_CTR_WIDTH_S) | /* CTR width */ - AES_AES_CTRL_CTR | /* CTR */ - (encrypt ? AES_AES_CTRL_DIRECTION_ENCRYPT : 0); /* En/decryption */ - - /* Prepare the crypto initialization vector */ - nonce_len = AES_IV_LEN - ctr_len; - /* Nonce */ - rom_util_memcpy(&((uint8_t *)iv)[0], nonce, nonce_len); - /* Initial counter */ - rom_util_memcpy(&((uint8_t *)iv)[nonce_len], ictr, ctr_len); - - return aes_auth_crypt_start(ctrl, key_area, iv, NULL, 0, - mdata_in, mdata_out, mdata_len, process); -} -/*---------------------------------------------------------------------------*/ -int8_t -ctr_crypt_check_status(void) -{ - return aes_auth_crypt_check_status() ? aes_auth_crypt_get_result(NULL, NULL) : - CRYPTO_PENDING; -} - -/** @} */ diff --git a/arch/cpu/cc2538/dev/ctr.h b/arch/cpu/cc2538/dev/ctr.h deleted file mode 100644 index 491859d8f..000000000 --- a/arch/cpu/cc2538/dev/ctr.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-aes - * @{ - * - * \defgroup cc2538-ctr cc2538 AES-CTR - * - * Driver for the cc2538 AES-CTR mode of the security core - * @{ - * - * \file - * Header file for the cc2538 AES-CTR driver - */ -#ifndef CTR_H_ -#define CTR_H_ - -#include "contiki.h" -#include "dev/aes.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/** \name AES-CTR functions - * @{ - */ - -/** \brief Starts a CTR crypto operation - * \param encrypt \c true to encrypt, or \c false to decrypt - * \param key_area Area in Key RAM where the key is stored (0 to - * \c AES_KEY_AREAS - 1) - * \param nonce Pointer to nonce (\c AES_IV_LEN - \p ctr_len octets), or \c NULL - * \param ictr Pointer to initial counter - * \param ctr_len Length of counter in octets (4, 8, 12, or 16) - * \param mdata_in Pointer to input message in SRAM - * \param mdata_out Pointer to output message in SRAM (may be \p mdata_in) - * \param mdata_len Length of message in octets - * \param process Process to be polled upon completion of the operation, or - * \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/CTR error code - */ -uint8_t ctr_crypt_start(uint8_t encrypt, uint8_t key_area, const void *nonce, - const void *ictr, uint8_t ctr_len, const void *mdata_in, - void *mdata_out, uint16_t mdata_len, - struct process *process); - -/** \brief Checks the status of the CTR crypto operation - * \return \c CRYPTO_PENDING if operation still pending, \c CRYPTO_SUCCESS if - * successful, or CRYPTO/AES/CTR error code - * \note This function must be called only after \c ctr_crypt_start(). - */ -int8_t ctr_crypt_check_status(void); - -/** @} */ - -#endif /* CTR_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/ecb.c b/arch/cpu/cc2538/dev/ecb.c deleted file mode 100644 index ddbc0837b..000000000 --- a/arch/cpu/cc2538/dev/ecb.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-ecb - * @{ - * - * \file - * Implementation of the cc2538 AES-ECB driver - */ -#include "contiki.h" -#include "dev/ecb.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -uint8_t -ecb_crypt_start(uint8_t encrypt, uint8_t key_area, const void *mdata_in, - void *mdata_out, uint16_t mdata_len, struct process *process) -{ - uint32_t ctrl; - - /* Program AES-ECB crypto operation */ - ctrl = encrypt ? AES_AES_CTRL_DIRECTION_ENCRYPT : 0; /* En/decryption */ - - return aes_auth_crypt_start(ctrl, key_area, NULL, NULL, 0, - mdata_in, mdata_out, mdata_len, process); -} -/*---------------------------------------------------------------------------*/ -int8_t -ecb_crypt_check_status(void) -{ - return aes_auth_crypt_check_status() ? aes_auth_crypt_get_result(NULL, NULL) : - CRYPTO_PENDING; -} - -/** @} */ diff --git a/arch/cpu/cc2538/dev/ecb.h b/arch/cpu/cc2538/dev/ecb.h deleted file mode 100644 index 840ba4d57..000000000 --- a/arch/cpu/cc2538/dev/ecb.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-aes - * @{ - * - * \defgroup cc2538-ecb cc2538 AES-ECB - * - * Driver for the cc2538 AES-ECB mode of the security core - * @{ - * - * \file - * Header file for the cc2538 AES-ECB driver - */ -#ifndef ECB_H_ -#define ECB_H_ - -#include "contiki.h" -#include "dev/aes.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/** \name AES-ECB functions - * @{ - */ - -/** \brief Starts an ECB crypto operation - * \param encrypt \c true to encrypt, or \c false to decrypt - * \param key_area Area in Key RAM where the key is stored (0 to - * \c AES_KEY_AREAS - 1) - * \param mdata_in Pointer to input message in SRAM - * \param mdata_out Pointer to output message in SRAM (may be \p mdata_in) - * \param mdata_len Length of message in octets - * \param process Process to be polled upon completion of the operation, or - * \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/ECB error code - */ -uint8_t ecb_crypt_start(uint8_t encrypt, uint8_t key_area, const void *mdata_in, - void *mdata_out, uint16_t mdata_len, - struct process *process); - -/** \brief Checks the status of the ECB crypto operation - * \return \c CRYPTO_PENDING if operation still pending, \c CRYPTO_SUCCESS if - * successful, or CRYPTO/AES/ECB error code - * \note This function must be called only after \c ecb_crypt_start(). - */ -int8_t ecb_crypt_check_status(void); - -/** @} */ - -#endif /* ECB_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/ecc-algorithm.c b/arch/cpu/cc2538/dev/ecc-algorithm.c deleted file mode 100644 index b67f1220c..000000000 --- a/arch/cpu/cc2538/dev/ecc-algorithm.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2014, Institute for Pervasive Computing, ETH Zurich. - * All rights reserved. - * - * Author: Andreas Dröscher - * - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc2538-ecc-algo - * @{ - * - * \file - * Implementation of the cc2538 ECC Algorithms - */ -#include "contiki.h" -#include "sys/process.h" - -#include -#include -#include - -#include "dev/ecc-algorithm.h" -#include "dev/ecc-driver.h" -#include "dev/pka.h" - -#define CHECK_RESULT(...) \ - state->result = __VA_ARGS__; \ - if(state->result) { \ - printf("Line: %u Error: %u\n", __LINE__, (unsigned int)state->result); \ - PT_EXIT(&state->pt); \ - } - -PT_THREAD(ecc_compare(ecc_compare_state_t *state)) { - PT_BEGIN(&state->pt); - - CHECK_RESULT(bignum_cmp_start(state->a, state->b, state->size, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - state->result = bignum_cmp_get_result(); - - PT_END(&state->pt); -} - -PT_THREAD(ecc_multiply(ecc_multiply_state_t *state)) { - PT_BEGIN(&state->pt); - - CHECK_RESULT(ecc_mul_start(state->secret, &state->point_in, state->curve_info, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(ecc_mul_get_result(&state->point_out, state->rv)); - - PT_END(&state->pt); -} - -PT_THREAD(ecc_dsa_sign(ecc_dsa_sign_state_t *state)) { - /* Executed Every Time */ - uint8_t size = state->curve_info->size; - const uint32_t *ord = state->curve_info->n; - - ec_point_t point; - memcpy(point.x, state->curve_info->x, sizeof(point.x)); - memcpy(point.y, state->curve_info->y, sizeof(point.y)); - - PT_BEGIN(&state->pt); - - /* Invert k_e mod n */ - CHECK_RESULT(bignum_inv_mod_start(state->k_e, size, ord, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(bignum_inv_mod_get_result(state->k_e_inv, size, state->rv)); - - /* Calculate Point R = K_e * GeneratorPoint */ - CHECK_RESULT(ecc_mul_start(state->k_e, &point, state->curve_info, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(ecc_mul_get_result(&state->point_r, state->rv)); - - /* Calculate signature using big math functions - * d*r (r is the x coordinate of PointR) */ - CHECK_RESULT(bignum_mul_start(state->secret, size, state->point_r.x, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - state->len = 24; - CHECK_RESULT(bignum_mul_get_result(state->signature_s, &state->len, state->rv)); - - /* d*r mod n */ - CHECK_RESULT(bignum_mod_start(state->signature_s, state->len, ord, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(bignum_mod_get_result(state->signature_s, size, state->rv)); - - /* hash + d*r */ - CHECK_RESULT(bignum_add_start(state->hash, size, state->signature_s, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - state->len = 24; - CHECK_RESULT(bignum_add_get_result(state->signature_s, &state->len, state->rv)); - - /* hash + d*r mod n */ - CHECK_RESULT(bignum_mod_start(state->signature_s, state->len, ord, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(bignum_mod_get_result(state->signature_s, size, state->rv)); - - /* k_e_inv * (hash + d*r) */ - CHECK_RESULT(bignum_mul_start(state->k_e_inv, size, state->signature_s, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - state->len = 24; - CHECK_RESULT(bignum_mul_get_result(state->signature_s, &state->len, state->rv)); - - /* k_e_inv * (hash + d*r) mod n */ - CHECK_RESULT(bignum_mod_start(state->signature_s, state->len, ord, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(bignum_mod_get_result(state->signature_s, size, state->rv)); - - PT_END(&state->pt); -} - -PT_THREAD(ecc_dsa_verify(ecc_dsa_verify_state_t *state)) { - /* Executed Every Time */ - uint8_t size = state->curve_info->size; - const uint32_t *ord = state->curve_info->n; - - ec_point_t point; - memcpy(point.x, state->curve_info->x, sizeof(point.x)); - memcpy(point.y, state->curve_info->y, sizeof(point.y)); - - PT_BEGIN(&state->pt); - - /* Invert s mod n */ - CHECK_RESULT(bignum_inv_mod_start(state->signature_s, size, ord, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(bignum_inv_mod_get_result(state->s_inv, size, state->rv)); - - /* Calculate u1 = s_inv * hash */ - CHECK_RESULT(bignum_mul_start(state->s_inv, size, state->hash, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - state->len = 24; - CHECK_RESULT(bignum_mul_get_result(state->u1, &state->len, state->rv)); - - /* Calculate u1 = s_inv * hash mod n */ - CHECK_RESULT(bignum_mod_start(state->u1, state->len, ord, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(bignum_mod_get_result(state->u1, size, state->rv)); - - /* Calculate u2 = s_inv * r */ - CHECK_RESULT(bignum_mul_start(state->s_inv, size, state->signature_r, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - state->len = 24; - CHECK_RESULT(bignum_mul_get_result(state->u2, &state->len, state->rv)); - - /* Calculate u2 = s_inv * r mod n */ - CHECK_RESULT(bignum_mod_start(state->u2, state->len, ord, size, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(bignum_mod_get_result(state->u2, size, state->rv)); - - /* Calculate p1 = u1 * A */ - CHECK_RESULT(ecc_mul_start(state->u1, &point, state->curve_info, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(ecc_mul_get_result(&state->p1, state->rv)); - - /* Calculate p2 = u1 * B */ - CHECK_RESULT(ecc_mul_start(state->u2, &state->public, state->curve_info, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(ecc_mul_get_result(&state->p2, state->rv)); - - /* Calculate P = p1 + p2 */ - CHECK_RESULT(ecc_add_start(&state->p1, &state->p2, state->curve_info, &state->rv, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - CHECK_RESULT(ecc_add_get_result(&state->p1, state->rv)); - - /* Verify Result */ - CHECK_RESULT(bignum_cmp_start(state->signature_r, state->p1.x, size, state->process)); - PT_WAIT_UNTIL(&state->pt, pka_check_status()); - state->result = bignum_cmp_get_result(); - if((state->result == PKA_STATUS_A_GR_B) || (state->result == PKA_STATUS_A_LT_B)) { - state->result = PKA_STATUS_SIGNATURE_INVALID; - } - - PT_END(&state->pt); -} - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/ecc-algorithm.h b/arch/cpu/cc2538/dev/ecc-algorithm.h deleted file mode 100644 index 059f011ee..000000000 --- a/arch/cpu/cc2538/dev/ecc-algorithm.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2014, Institute for Pervasive Computing, ETH Zurich. - * All rights reserved. - * - * Author: Andreas Dröscher - * - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc2538-ecc - * @{ - * - * \defgroup cc2538-ecc-algo cc2538 ECC Algorithms - * - * This is a implementation of ECDH, ECDSA sign and ECDSA verify. It - * uses ecc-driver to communicate with the PKA. It uses continuations - * to free the main CPU / thread while the PKA is calculating. - * - * \note - * Only one request can be processed at a time. - * Maximal supported key length is 384bit (12 words). - * @{ - * - * \file - * Header file for the cc2538 ECC Algorithms - */ -#ifndef ECC_ALGORITHM_H_ -#define ECC_ALGORITHM_H_ - -#include "dev/bignum-driver.h" -#include "dev/ecc-driver.h" - -typedef struct { - /* Containers for the State */ - struct pt pt; - struct process *process; - - /* Input Variables */ - uint32_t a[12]; /**< Left Number */ - uint32_t b[12]; /**< Right Number */ - uint8_t size; /**< Length of a and b */ - - /* Output Variables */ - uint8_t result; /**< Result Code */ -} ecc_compare_state_t; - -/** - * \brief Do a compare of two big numbers - * - * This function can be used for ECDH as well as - * Calculating a Public Key for ECDSA - */ -PT_THREAD(ecc_compare(ecc_compare_state_t *state)); - -typedef struct { - /* Containers for the State */ - struct pt pt; - struct process *process; - - /* Input Variables */ - ecc_curve_info_t *curve_info; /**< Curve defining the CyclicGroup */ - ec_point_t point_in; /**< Generator Point */ - uint32_t secret[12]; /**< Secret */ - - /* Variables Holding intermediate data (initialized/used internally) */ - uint32_t rv; /**< Address of Next Result in PKA SRAM */ - - /* Output Variables */ - uint8_t result; /**< Result Code */ - ec_point_t point_out; /**< Generated Point */ -} ecc_multiply_state_t; - -/** - * \brief Do a Multiplication on a EC - * - * This function can be used for ECDH as well as - * Calculating a Public Key for ECDSA - */ -PT_THREAD(ecc_multiply(ecc_multiply_state_t *state)); - -typedef struct { - /* Containers for the State */ - struct pt pt; - struct process *process; - - /* Input Variables */ - ecc_curve_info_t *curve_info; /**< Curve defining the CyclicGroup */ - uint32_t secret[12]; /**< Secret Key */ - uint32_t k_e[12]; /**< Ephemeral Key */ - uint32_t hash[12]; /**< Hash to be signed */ - - /* Variables Holding intermediate data (initialized/used internally) */ - uint32_t rv; /**< Address of Next Result in PKA SRAM */ - uint32_t k_e_inv[12]; /**< Inverted ephemeral Key */ - uint32_t len; /**< Length of intermediate Result */ - - /* Output Variables */ - uint8_t result; /**< Result Code */ - ec_point_t point_r; /**< Signature R (x coordinate) */ - uint32_t signature_s[24]; /**< Signature S */ -} ecc_dsa_sign_state_t; - -/** - * \brief Sign a Hash - * - * This function has to be called several times until the - * pt state is EXIT - * If the result code is 0 (SUCCESS) the signature can be - * read from point_r and signature_s - */ -PT_THREAD(ecc_dsa_sign(ecc_dsa_sign_state_t *state)); - -typedef struct { - /* Containers for the State */ - struct pt pt; - struct process *process; - - /* Input Variables */ - ecc_curve_info_t *curve_info; /**< Curve defining the CyclicGroup */ - uint32_t signature_r[12]; /**< Signature R */ - uint32_t signature_s[12]; /**< Signature S */ - uint32_t hash[12]; /**< Hash to be signed */ - ec_point_t public; /**< Signature R (x coordinate) */ - - /* Variables Holding intermediate data (initialized/used internally) */ - uint32_t rv; /**< Address of Next Result in PKA SRAM */ - uint32_t s_inv[12]; /**< Inverted ephemeral Key */ - uint32_t u1[24]; /**< Intermediate result */ - uint32_t u2[24]; /**< Intermediate result */ - ec_point_t p1; /**< Intermediate result */ - ec_point_t p2; /**< Intermediate result */ - uint32_t len; /**< Length of intermediate Result */ - - /* Output Variables */ - uint8_t result; /**< Result Code */ -} ecc_dsa_verify_state_t; - -/** - * \brief Verify Signature - * - * This function has to be called several times until the - * pt state is EXIT - * If the result code is 0 (SUCCESS) the verification - * was success full. - * \note some error codes signal internal errors - * and others signal falls signatures. - */ -PT_THREAD(ecc_dsa_verify(ecc_dsa_verify_state_t *state)); - -#endif /* ECC_ALGORITHM_H_ */ - -/** - * @} - * @} - */ - diff --git a/arch/cpu/cc2538/dev/ecc-curve.c b/arch/cpu/cc2538/dev/ecc-curve.c deleted file mode 100644 index fa8408a4c..000000000 --- a/arch/cpu/cc2538/dev/ecc-curve.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2014, Institute for Pervasive Computing, ETH Zurich. - * All rights reserved. - * - * Author: Andreas Dröscher - * - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc2538-ecc-curves - * @{ - */ -#include "contiki.h" -#include "dev/ecc-driver.h" - -/* [NIST P-256, X9.62 prime256v1] */ -static const uint32_t nist_p_256_p[8] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0xFFFFFFFF }; -static const uint32_t nist_p_256_n[8] = { 0xFC632551, 0xF3B9CAC2, 0xA7179E84, 0xBCE6FAAD, - 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF }; -static const uint32_t nist_p_256_a[8] = { 0xFFFFFFFC, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0xFFFFFFFF }; -static const uint32_t nist_p_256_b[8] = { 0x27D2604B, 0x3BCE3C3E, 0xCC53B0F6, 0x651D06B0, - 0x769886BC, 0xB3EBBD55, 0xAA3A93E7, 0x5AC635D8 }; -static const uint32_t nist_p_256_x[8] = { 0xD898C296, 0xF4A13945, 0x2DEB33A0, 0x77037D81, - 0x63A440F2, 0xF8BCE6E5, 0xE12C4247, 0x6B17D1F2 }; -static const uint32_t nist_p_256_y[8] = { 0x37BF51F5, 0xCBB64068, 0x6B315ECE, 0x2BCE3357, - 0x7C0F9E16, 0x8EE7EB4A, 0xFE1A7F9B, 0x4FE342E2 }; - -ecc_curve_info_t nist_p_256 = { - .name = "NIST P-256", - .size = 8, - .prime = nist_p_256_p, - .n = nist_p_256_n, - .a = nist_p_256_a, - .b = nist_p_256_b, - .x = nist_p_256_x, - .y = nist_p_256_y -}; - -/* [NIST P-192, X9.62 prime192v1] */ -static const uint32_t nist_p_192_p[6] = { 0xffffffff, 0xffffffff, 0xfffffffe, 0xffffffff, - 0xffffffff, 0xffffffff }; -static const uint32_t nist_p_192_a[6] = { 0xfffffffc, 0xffffffff, 0xfffffffe, 0xffffffff, - 0xffffffff, 0xffffffff }; -static const uint32_t nist_p_192_b[6] = { 0xc146b9b1, 0xfeb8deec, 0x72243049, 0x0fa7e9ab, - 0xe59c80e7, 0x64210519 }; -static const uint32_t nist_p_192_x[6] = { 0x82ff1012, 0xf4ff0afd, 0x43a18800, 0x7cbf20eb, - 0xb03090f6, 0x188da80e }; -static const uint32_t nist_p_192_y[6] = { 0x1e794811, 0x73f977a1, 0x6b24cdd5, 0x631011ed, - 0xffc8da78, 0x07192b95 }; -static const uint32_t nist_p_192_n[6] = { 0xb4d22831, 0x146bc9b1, 0x99def836, 0xffffffff, - 0xffffffff, 0xffffffff }; - -ecc_curve_info_t nist_p_192 = { - .name = "NIST P-192", - .size = 6, - .prime = nist_p_192_p, - .n = nist_p_192_n, - .a = nist_p_192_a, - .b = nist_p_192_b, - .x = nist_p_192_x, - .y = nist_p_192_y -}; - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/ecc-curve.h b/arch/cpu/cc2538/dev/ecc-curve.h deleted file mode 100644 index 66c050a08..000000000 --- a/arch/cpu/cc2538/dev/ecc-curve.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Original file: - * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2014 Andreas Dröscher - * - * 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. - */ -/** - * \addtogroup cc2538-ecc - * @{ - * - * \defgroup cc2538-ecc-curves cc2538 NIST curves - * - * NIST curves for various key sizes - * @{ - * - * \file - * NIST curves for various key sizes - */ -#ifndef ECC_CURVE_H_ -#define ECC_CURVE_H_ - -/* - * NIST P-256, X9.62 prime256v1 - */ -ecc_curve_info_t nist_p_256; - -/* - * NIST P-192, X9.62 prime192v1 - */ -ecc_curve_info_t nist_p_192; - -#endif /* CURVE_INFO_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/ecc-driver.c b/arch/cpu/cc2538/dev/ecc-driver.c deleted file mode 100644 index 2eeda1ff7..000000000 --- a/arch/cpu/cc2538/dev/ecc-driver.c +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Original file: - * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2014 Andreas Dröscher - * - * 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. - */ -/** - * \addtogroup cc2538-ecc - * @{ - * - * \file - * Implementation of the cc2538 ECC driver - */ -#include "dev/ecc-driver.h" -#include "reg.h" -#include "dev/nvic.h" - -#define ASSERT(IF) if(!(IF)) { return PKA_STATUS_INVALID_PARAM; } - -/*---------------------------------------------------------------------------*/ -uint8_t -ecc_mul_start(uint32_t *scalar, ec_point_t *ec_point, - ecc_curve_info_t *curve, uint32_t *result_vector, - struct process *process) -{ - - uint8_t extraBuf; - uint32_t offset; - int i; - - /* Check for the arguments. */ - ASSERT(NULL != scalar); - ASSERT(NULL != ec_point); - ASSERT(NULL != ec_point->x); - ASSERT(NULL != ec_point->y); - ASSERT(NULL != curve); - ASSERT(curve->size <= PKA_MAX_CURVE_SIZE); - ASSERT(NULL != result_vector); - - offset = 0; - - /* Make sure no PKA operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Calculate the extra buffer requirement. */ - extraBuf = 2 + curve->size % 2; - - /* Update the A ptr with the offset address of the PKA RAM location - * where the scalar will be stored. */ - REG(PKA_APTR) = offset >> 2; - - /* Load the scalar in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = *scalar++; - } - - /* Determine the offset for the next data. */ - offset += 4 * (i + (curve->size % 2)); - - /* Update the B ptr with the offset address of the PKA RAM location - * where the curve parameters will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Write curve parameter 'p' as 1st part of vector B immediately - * following vector A at PKA RAM */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = (uint32_t)curve->prime[i]; - } - - /* Determine the offset for the next data. */ - offset += 4 * (i + extraBuf); - - /* Copy curve parameter 'a' in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = (uint32_t)curve->a[i]; - } - - /* Determine the offset for the next data. */ - offset += 4 * (i + extraBuf); - - /* Copy curve parameter 'b' in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = (uint32_t)curve->b[i]; - } - - /* Determine the offset for the next data. */ - offset += 4 * (i + extraBuf); - - /* Update the C ptr with the offset address of the PKA RAM location - * where the x, y will be stored. */ - REG(PKA_CPTR) = offset >> 2; - - /* Write elliptic curve point.x co-ordinate value. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = ec_point->x[i]; - } - - /* Determine the offset for the next data. */ - offset += 4 * (i + extraBuf); - - /* Write elliptic curve point.y co-ordinate value. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = ec_point->y[i]; - } - - /* Determine the offset for the next data. */ - offset += 4 * (i + extraBuf); - - /* Update the result location. */ - *result_vector = PKA_RAM_BASE + offset; - - /* Load D ptr with the result location in PKA RAM. */ - REG(PKA_DPTR) = offset >> 2; - - /* Load length registers. */ - REG(PKA_ALENGTH) = curve->size; - REG(PKA_BLENGTH) = curve->size; - - /* set the PKA function to ECC-MULT and start the operation. */ - REG(PKA_FUNCTION) = 0x0000D000; - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -ecc_mul_get_result(ec_point_t *ec_point, - uint32_t result_vector) -{ - int i; - uint32_t addr; - uint32_t regMSWVal; - uint32_t len; - - /* Check for the arguments. */ - ASSERT(NULL != ec_point); - ASSERT(NULL != ec_point->x); - ASSERT(NULL != ec_point->y); - ASSERT(result_vector > PKA_RAM_BASE); - ASSERT(result_vector < (PKA_RAM_BASE + PKA_RAM_SIZE)); - - /* Verify that the operation is completed. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - if(REG(PKA_SHIFT) == 0x00000000) { - /* Get the MSW register value. */ - regMSWVal = REG(PKA_MSW); - - /* Check to make sure that the result vector is not all zeroes. */ - if(regMSWVal & PKA_MSW_RESULT_IS_ZERO) { - return PKA_STATUS_RESULT_0; - } - - /* Get the length of the result */ - len = ((regMSWVal & PKA_MSW_MSW_ADDRESS_M) + 1) - - ((result_vector - PKA_RAM_BASE) >> 2); - - addr = result_vector; - - /* copy the x co-ordinate value of the result from vector D into - * the \e ec_point. */ - for(i = 0; i < len; i++) { - ec_point->x[i] = REG(addr + 4 * i); - } - - addr += 4 * (i + 2 + len % 2); - - /* copy the y co-ordinate value of the result from vector D into - * the \e ec_point. */ - for(i = 0; i < len; i++) { - ec_point->y[i] = REG(addr + 4 * i); - } - - return PKA_STATUS_SUCCESS; - } else { - return PKA_STATUS_FAILURE; - } -} -/*---------------------------------------------------------------------------*/ -uint8_t -ecc_mul_gen_pt_start(uint32_t *scalar, ecc_curve_info_t *curve, - uint32_t *result_vector, struct process *process) -{ - uint8_t extraBuf; - uint32_t offset; - int i; - - /* check for the arguments. */ - ASSERT(NULL != scalar); - ASSERT(NULL != curve); - ASSERT(curve->size <= PKA_MAX_CURVE_SIZE); - ASSERT(NULL != result_vector); - - offset = 0; - - /* Make sure no operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Calculate the extra buffer requirement. */ - extraBuf = 2 + curve->size % 2; - - /* Update the A ptr with the offset address of the PKA RAM location - * where the scalar will be stored. */ - REG(PKA_APTR) = offset >> 2; - - /* Load the scalar in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = *scalar++; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + (curve->size % 2)); - - /* Update the B ptr with the offset address of the PKA RAM location - * where the curve parameters will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Write curve parameter 'p' as 1st part of vector B. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = (uint32_t)curve->prime[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* Write curve parameter 'a' in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = (uint32_t)curve->a[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* write curve parameter 'b' in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = (uint32_t)curve->b[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* Update the C ptr with the offset address of the PKA RAM location - * where the x, y will be stored. */ - REG(PKA_CPTR) = offset >> 2; - - /* Write x co-ordinate value of the Generator point in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = (uint32_t)curve->x[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* Write y co-ordinate value of the Generator point in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = (uint32_t)curve->y[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* Update the result location. */ - *result_vector = PKA_RAM_BASE + offset; - - /* Load D ptr with the result location in PKA RAM. */ - REG(PKA_DPTR) = offset >> 2; - - /* Load length registers. */ - REG(PKA_ALENGTH) = curve->size; - REG(PKA_BLENGTH) = curve->size; - - /* Set the PKA function to ECC-MULT and start the operation. */ - REG(PKA_FUNCTION) = 0x0000D000; - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -ecc_mul_gen_pt_get_result(ec_point_t *ec_point, - uint32_t result_vector) -{ - - int i; - uint32_t regMSWVal; - uint32_t addr; - uint32_t len; - - /* Check for the arguments. */ - ASSERT(NULL != ec_point); - ASSERT(NULL != ec_point->x); - ASSERT(NULL != ec_point->y); - ASSERT(result_vector > PKA_RAM_BASE); - ASSERT(result_vector < (PKA_RAM_BASE + PKA_RAM_SIZE)); - - /* Verify that the operation is completed. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - if(REG(PKA_SHIFT) == 0x00000000) { - /* Get the MSW register value. */ - regMSWVal = REG(PKA_MSW); - - /* Check to make sure that the result vector is not all zeroes. */ - if(regMSWVal & PKA_MSW_RESULT_IS_ZERO) { - return PKA_STATUS_RESULT_0; - } - - /* Get the length of the result. */ - len = ((regMSWVal & PKA_MSW_MSW_ADDRESS_M) + 1) - - ((result_vector - PKA_RAM_BASE) >> 2); - - addr = result_vector; - - /* Copy the x co-ordinate value of the result from vector D into the - * EC point. */ - for(i = 0; i < len; i++) { - ec_point->x[i] = REG(addr + 4 * i); - } - - addr += 4 * (i + 2 + len % 2); - - /* Copy the y co-ordinate value of the result from vector D into the - * EC point. */ - for(i = 0; i < len; i++) { - ec_point->y[i] = REG(addr + 4 * i); - } - - return PKA_STATUS_SUCCESS; - } else { - return PKA_STATUS_FAILURE; - } -} -/*---------------------------------------------------------------------------*/ -uint8_t -ecc_add_start(ec_point_t *ec_point1, ec_point_t *ec_point2, - ecc_curve_info_t *curve, uint32_t *result_vector, - struct process *process) -{ - - uint8_t extraBuf; - uint32_t offset; - int i; - - /* Check for the arguments. */ - ASSERT(NULL != ec_point1); - ASSERT(NULL != ec_point1->x); - ASSERT(NULL != ec_point1->y); - ASSERT(NULL != ec_point2); - ASSERT(NULL != ec_point2->x); - ASSERT(NULL != ec_point2->y); - ASSERT(NULL != curve); - ASSERT(NULL != result_vector); - - offset = 0; - - /* Make sure no operation is in progress. */ - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Calculate the extra buffer requirement. */ - extraBuf = 2 + curve->size % 2; - - /* Update the A ptr with the offset address of the PKA RAM location - * where the first ecPt will be stored. */ - REG(PKA_APTR) = offset >> 2; - - /* Load the x co-ordinate value of the first EC point in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = ec_point1->x[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* Load the y co-ordinate value of the first EC point in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = ec_point1->y[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* Update the B ptr with the offset address of the PKA RAM location - * where the curve parameters will be stored. */ - REG(PKA_BPTR) = offset >> 2; - - /* Write curve parameter 'p' as 1st part of vector B */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = (uint32_t)curve->prime[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* Write curve parameter 'a'. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = (uint32_t)curve->a[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* Update the C ptr with the offset address of the PKA RAM location - * where the ecPt2 will be stored. */ - REG(PKA_CPTR) = offset >> 2; - - /* Load the x co-ordinate value of the second EC point in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = ec_point2->x[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* Load the y co-ordinate value of the second EC point in PKA RAM. */ - for(i = 0; i < curve->size; i++) { - REG(PKA_RAM_BASE + offset + 4 * i) = ec_point2->y[i]; - } - - /* Determine the offset in PKA RAM for the next data. */ - offset += 4 * (i + extraBuf); - - /* Copy the result vector location. */ - *result_vector = PKA_RAM_BASE + offset; - - /* Load D ptr with the result location in PKA RAM. */ - REG(PKA_DPTR) = offset >> 2; - - /* Load length registers. */ - REG(PKA_BLENGTH) = curve->size; - - /* Set the PKA Function to ECC-ADD and start the operation. */ - REG(PKA_FUNCTION) = 0x0000B000; - - /* Enable Interrupt */ - if(process != NULL) { - pka_register_process_notification(process); - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_EnableIRQ(PKA_IRQn); - } - - return PKA_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -ecc_add_get_result(ec_point_t *ec_point, uint32_t result_vector) -{ - uint32_t regMSWVal; - uint32_t addr; - int i; - uint32_t len; - - /* Check for the arguments. */ - ASSERT(NULL != ec_point); - ASSERT(NULL != ec_point->x); - ASSERT(NULL != ec_point->y); - ASSERT(result_vector > PKA_RAM_BASE); - ASSERT(result_vector < (PKA_RAM_BASE + PKA_RAM_SIZE)); - - if((REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) != 0) { - return PKA_STATUS_OPERATION_INPRG; - } - - /* Disable Interrupt */ - NVIC_DisableIRQ(PKA_IRQn); - pka_register_process_notification(NULL); - - if(REG(PKA_SHIFT) == 0x00000000) { - /* Get the MSW register value. */ - regMSWVal = REG(PKA_MSW); - - /* Check to make sure that the result vector is not all zeroes. */ - if(regMSWVal & PKA_MSW_RESULT_IS_ZERO) { - return PKA_STATUS_RESULT_0; - } - - /* Get the length of the result. */ - len = ((regMSWVal & PKA_MSW_MSW_ADDRESS_M) + 1) - - ((result_vector - PKA_RAM_BASE) >> 2); - - addr = result_vector; - - /* Copy the x co-ordinate value of result from vector D into the - * the output EC Point. */ - for(i = 0; i < len; i++) { - ec_point->x[i] = REG(addr + 4 * i); - } - - addr += 4 * (i + 2 + len % 2); - - /* Copy the y co-ordinate value of result from vector D into the - * the output EC Point. */ - for(i = 0; i < len; i++) { - ec_point->y[i] = REG(addr + 4 * i); - } - - return PKA_STATUS_SUCCESS; - } else { - return PKA_STATUS_FAILURE; - } -} -/** @} */ diff --git a/arch/cpu/cc2538/dev/ecc-driver.h b/arch/cpu/cc2538/dev/ecc-driver.h deleted file mode 100644 index 3f71153a9..000000000 --- a/arch/cpu/cc2538/dev/ecc-driver.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Original file: - * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2014 Andreas Dröscher - * - * 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. - */ -/** - * \addtogroup cc2538-pka - * @{ - * - * \defgroup cc2538-ecc cc2538 ECC driver - * - * Driver for the cc2538 ECC mode of the PKC engine - * @{ - * - * \file - * Header file for the cc2538 ECC driver - */ -#ifndef ECC_DRIVER_H_ -#define ECC_DRIVER_H_ - -#include "contiki.h" -#include "dev/pka.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \name ECC structures - * @{ - */ -typedef struct { - const char *name; /**< Name of the curve. */ - const uint8_t size; /**< Size of the curve in 32-bit word. */ - const uint32_t *prime; /**< The prime that defines the field of the curve. */ - const uint32_t *n; /**< Order of the curve. */ - const uint32_t *a; /**< Co-efficient a of the equation. */ - const uint32_t *b; /**< co-efficient b of the equation. */ - const uint32_t *x; /**< x co-ordinate value of the generator point. */ - const uint32_t *y; /**< y co-ordinate value of the generator point. */ -} ecc_curve_info_t; - -typedef struct { - uint32_t x[12]; /**< Pointer to value of the x co-ordinate. */ - uint32_t y[12]; /**< Pointer to value of the y co-ordinate. */ -} ec_point_t; - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name ECC functions - * \note Not all sequencer functions are implemented in this driver - * look at the CC2538 manual for a complete list. - * @{ - */ - -/** \brief Starts ECC Multiplication. - * - * \param scalar Pointer to the buffer containing the scalar - * value to be multiplied. - * \param ec_point Pointer to the structure containing the - * elliptic curve point to be multiplied. The point should be - * on the given curve. - * \param curve Pointer to the structure containing the curve - * info. - * \param result_vector Pointer to the result vector location - * which will be set by this function. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the Elliptical curve cryptography (ECC) point - * multiplication operation on the EC point and the scalar value. - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t ecc_mul_start(uint32_t *scalar, - ec_point_t *ec_point, - ecc_curve_info_t *curve, - uint32_t *result_vector, - struct process *process); - -/** \brief Gets the result of ECC Multiplication - * - * \param ec_point Pointer to the structure where the resultant EC - * point will be stored. The callee is responsible to allocate the - * space for the ec point structure and the x and y co-ordinate as well. - * \param result_vector Address of the result location which - * was provided by the start function \sa PKAECCMultiplyStart(). - * - * This function gets the result of ecc point multiplication operation on the - * ec point and the scalar value, previously started using the function - * \sa PKAECCMultiplyStart(). - * - * \retval PKA_STATUS_SUCCESS if the operation is successful. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy performing - * the operation. - * \retval PKA_STATUS_RESULT_0 if the result is all zeroes. - * \retval PKA_STATUS_FAILURE if the operation is not successful. - */ -uint8_t ecc_mul_get_result(ec_point_t *ec_point, - uint32_t result_vector); - -/** \brief Starts the ECC Multiplication with Generator point. - * - * \param scalar Pointer to the buffer containing the - * scalar value. - * \param curve Pointer to the structure containing the curve - * info. - * \param result_vector Pointer to the result vector location - * which will be set by this function. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the ecc point multiplication operation of the - * scalar value with the well known generator point of the given curve. - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t ecc_mul_gen_pt_start(uint32_t *scalar, - ecc_curve_info_t *curve, - uint32_t *result_vector, - struct process *process); - -/** \brief Gets the result of ECC Multiplication with Generator point. - * - * \param ec_point Pointer to the structure where the resultant EC - * point will be stored. The callee is responsible to allocate the - * space for the ec point structure and the x and y co-ordinate as well. - * \param result_vector Address of the result location which - * was provided by the start function \sa PKAECCMultGenPtStart(). - * - * This function gets the result of ecc point multiplication operation on the - * scalar point and the known generator point on the curve, previously started - * using the function \sa PKAECCMultGenPtStart(). - * - * \retval PKA_STATUS_SUCCESS if the operation is successful. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy performing - * the operation. - * \retval PKA_STATUS_RESULT_0 if the result is all zeroes. - * \retval PKA_STATUS_FAILURE if the operation is not successful. - */ -uint8_t ecc_mul_gen_pt_get_result(ec_point_t *ec_point, - uint32_t result_vector); - -/** \brief Starts the ECC Addition. - * - * \param ec_point1 Pointer to the structure containing the first - * ecc point. - * \param ec_point2 Pointer to the structure containing the - * second ecc point. - * \param curve Pointer to the structure containing the curve - * info. - * \param result_vector Pointer to the result vector location - * which will be set by this function. - * \param process Process to be polled upon completion of the - * operation, or \c NULL - * - * This function starts the ecc point addition operation on the - * two given ec points and generates the resultant ecc point. - * - * \retval PKA_STATUS_SUCCESS if successful in starting the operation. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy doing - * some other operation. - */ -uint8_t ecc_add_start(ec_point_t *ec_point1, ec_point_t *ec_point2, - ecc_curve_info_t *curve, - uint32_t *result_vector, - struct process *process); - -/** \brief Gets the result of the ECC Addition - * - * \param ptOutEcPt Pointer to the structure where the resultant - * point will be stored. The callee is responsible to allocate memory, - * for the ec point structure including the memory for x and y - * co-ordinate values. - * \param ui32ResultLoc Address of the result location which - * was provided by the function \sa PKAECCAddStart(). - * - * This function gets the result of ecc point addition operation on the - * on the two given ec points, previously started using the function \sa - * PKAECCAddStart(). - * - * \retval PKA_STATUS_SUCCESS if the operation is successful. - * \retval PKA_STATUS_OPERATION_INPRG if the PKA hw module is busy performing - * the operation. - * \retval PKA_STATUS_RESULT_0 if the result is all zeroes. - * \retval PKA_STATUS_FAILURE if the operation is not successful. - */ -uint8_t ecc_add_get_result(ec_point_t *ptOutEcPt, uint32_t ui32ResultLoc); - -/** @} */ - -#endif /* ECC_DRIVER_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/flash.h b/arch/cpu/cc2538/dev/flash.h deleted file mode 100644 index 49db85b20..000000000 --- a/arch/cpu/cc2538/dev/flash.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-flash cc2538 flash memory - * - * Definitions for the cc2538 flash memory - * @{ - * - * \file - * Header file for the flash memory definitions - */ -#ifndef FLASH_H_ -#define FLASH_H_ - -#include "dev/cc2538-dev.h" -#include "cfs-coffee-arch.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \name Flash memory organization - * @{ - */ -#define FLASH_PAGE_SIZE 2048 -#define FLASH_WORD_SIZE 4 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Flash lock bit page and CCA location - * @{ - */ -#define FLASH_CCA_ADDR (CC2538_DEV_FLASH_ADDR + CC2538_DEV_FLASH_SIZE - \ - FLASH_CCA_SIZE) /**< Address */ -#define FLASH_CCA_SIZE 0x0000002C /**< Size in bytes */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Bootloader backdoor configuration bit fields - * @{ - */ -#define FLASH_CCA_BOOTLDR_CFG_DISABLE 0xEFFFFFFF /**< Disable backdoor function */ -#define FLASH_CCA_BOOTLDR_CFG_ENABLE 0xF0FFFFFF /**< Enable backdoor function */ -#define FLASH_CCA_BOOTLDR_CFG_ACTIVE_HIGH 0x08000000 /**< Selected pin on pad A active high */ -#define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_M 0x07000000 /**< Selected pin on pad A mask */ -#define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S 24 /**< Selected pin on pad A shift */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Image valid definitions - * @{ - */ -#define FLASH_CCA_IMAGE_VALID 0x00000000 /**< Indicates valid image in flash */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Lock page / debug definitions - * @{ - */ -#define FLASH_CCA_LOCKED 0 /**< Page or debug locked if bit == 0 */ -#define FLASH_CCA_LOCK_DEBUG_BYTE 31 /**< Lock byte containing the debug lock bit */ -#define FLASH_CCA_LOCK_DEBUG_BIT 7 /**< Debug lock bit position in the corresponding lock byte */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Firmware location in flash memory - * @{ - */ -#ifdef FLASH_CONF_FW_ADDR -#define FLASH_FW_ADDR FLASH_CONF_FW_ADDR -#elif !defined(COFFEE_CONF_CUSTOM_PORT) -#define FLASH_FW_ADDR (COFFEE_START + COFFEE_SIZE) -#else -#define FLASH_FW_ADDR CC2538_DEV_FLASH_ADDR -#endif -#ifdef FLASH_CONF_FW_SIZE -#define FLASH_FW_SIZE FLASH_CONF_FW_SIZE -#else -#define FLASH_FW_SIZE (FLASH_CCA_ADDR - FLASH_FW_ADDR) -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Flash lock bit page and CCA layout - * @{ - */ -typedef struct { - uint32_t bootldr_cfg; /**< Bootloader backdoor configuration (page bytes 2004 - 2007) */ - uint32_t image_valid; /**< Image valid (page bytes 2008 - 2011) */ - const void *app_entry_point; /**< Flash vector table address (page bytes 2012 - 2015) */ - uint8_t lock[32]; /**< Page and debug lock bits (page bytes 2016 - 2047) */ -} flash_cca_lock_page_t; -/** @} */ - -#endif /* FLASH_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/gcm.c b/arch/cpu/cc2538/dev/gcm.c deleted file mode 100644 index 3108f00d0..000000000 --- a/arch/cpu/cc2538/dev/gcm.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-gcm - * @{ - * - * \file - * Implementation of the cc2538 AES-GCM driver - */ -#include "contiki.h" -#include "dev/rom-util.h" -#include "dev/gcm.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -static uint8_t -gcm_auth_crypt_start(uint8_t encrypt, uint8_t key_area, const void *iv, - const void *adata, uint16_t adata_len, - const void *data_in, void *data_out, uint16_t data_len, - struct process *process) -{ - uint32_t ctrl; - uint32_t aes_iv[AES_IV_LEN / sizeof(uint32_t)]; - - /* Program AES-GCM authentication/crypto operation */ - ctrl = AES_AES_CTRL_SAVE_CONTEXT | /* Save context */ - AES_AES_CTRL_GCM | /* GCM */ - AES_AES_CTRL_CTR_WIDTH_32 | /* CTR width 32 */ - AES_AES_CTRL_CTR | /* CTR */ - (encrypt ? AES_AES_CTRL_DIRECTION_ENCRYPT : 0); /* En/decryption */ - - /* Prepare the crypto initialization vector - * Initialization vector */ - rom_util_memcpy(aes_iv, iv, GCM_IV_LEN); - /* Initialize counter to 1 */ - aes_iv[GCM_IV_LEN / sizeof(aes_iv[0])] = 0x01000000; - - return aes_auth_crypt_start(ctrl, key_area, aes_iv, adata, adata_len, - data_in, data_out, data_len, process); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -gcm_auth_crypt_get_result(const void *tag_in, void *tag_out) -{ - uint32_t tag[AES_TAG_LEN / sizeof(uint32_t)]; - uint8_t ret; - - ret = aes_auth_crypt_get_result(NULL, tag); - if(ret != CRYPTO_SUCCESS) { - return ret; - } - - if(tag_in != NULL) { - /* Check tag */ - if(rom_util_memcmp(tag, tag_in, GCM_TAG_LEN)) { - ret = AES_AUTHENTICATION_FAILED; - } - } - - if(tag_out != NULL) { - /* Copy tag */ - rom_util_memcpy(tag_out, tag, GCM_TAG_LEN); - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -uint8_t -gcm_auth_encrypt_start(uint8_t key_area, const void *iv, const void *adata, - uint16_t adata_len, const void *pdata, - uint16_t pdata_len, void *cdata, struct process *process) -{ - return gcm_auth_crypt_start(true, key_area, iv, adata, adata_len, - pdata, cdata, pdata_len, process); -} -/*---------------------------------------------------------------------------*/ -uint8_t -gcm_auth_encrypt_get_result(void *tag) -{ - return gcm_auth_crypt_get_result(NULL, tag); -} -/*---------------------------------------------------------------------------*/ -uint8_t -gcm_auth_decrypt_start(uint8_t key_area, const void *iv, const void *adata, - uint16_t adata_len, const void *cdata, - uint16_t cdata_len, void *pdata, struct process *process) -{ - return gcm_auth_crypt_start(false, key_area, iv, adata, adata_len, - cdata, pdata, cdata_len, process); -} -/*---------------------------------------------------------------------------*/ -uint8_t -gcm_auth_decrypt_get_result(const void *tag_in, void *tag_out) -__attribute__ ((alias("gcm_auth_crypt_get_result"))); - -/** @} */ diff --git a/arch/cpu/cc2538/dev/gcm.h b/arch/cpu/cc2538/dev/gcm.h deleted file mode 100644 index 9633b6ff2..000000000 --- a/arch/cpu/cc2538/dev/gcm.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-aes - * @{ - * - * \defgroup cc2538-gcm cc2538 AES-GCM - * - * Driver for the cc2538 AES-GCM mode of the security core - * @{ - * - * \file - * Header file for the cc2538 AES-GCM driver - */ -#ifndef GCM_H_ -#define GCM_H_ - -#include "contiki.h" -#include "dev/aes.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/** \name AES-GCM constants - * @{ - */ -#define GCM_IV_LEN (96 / 8) -#define GCM_TAG_LEN AES_TAG_LEN -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name AES-GCM functions - * @{ - */ - -/** \brief Starts a GCM authentication and encryption operation - * \param key_area Area in Key RAM where the key is stored (0 to - * \c AES_KEY_AREAS - 1) - * \param iv Pointer to 96-bit initialization vector - * \param adata Pointer to additional authenticated data in SRAM, or \c NULL - * \param adata_len Length of additional authenticated data in octets, or \c 0 - * \param pdata Pointer to message to authenticate and encrypt in SRAM, or - * \c NULL - * \param pdata_len Length of message to authenticate and encrypt in octets, or - * \c 0 - * \param cdata Pointer to encrypted message in SRAM (may be \p pdata), or - * \c NULL - * \param process Process to be polled upon completion of the operation, or - * \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/GCM error code - */ -uint8_t gcm_auth_encrypt_start(uint8_t key_area, const void *iv, - const void *adata, uint16_t adata_len, - const void *pdata, uint16_t pdata_len, - void *cdata, struct process *process); - -/** \brief Checks the status of the GCM authentication and encryption operation - * \retval false Result not yet available, and no error occurred - * \retval true Result available, or error occurred - */ -#define gcm_auth_encrypt_check_status aes_auth_crypt_check_status - -/** \brief Gets the result of the GCM authentication and encryption operation - * \param tag Pointer to 128-bit authentication tag, or \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/GCM error code - * \note This function must be called only after \c gcm_auth_encrypt_start(). - */ -uint8_t gcm_auth_encrypt_get_result(void *tag); - -/** \brief Starts a GCM authentication checking and decryption operation - * \param key_area Area in Key RAM where the key is stored (0 to - * \c AES_KEY_AREAS - 1) - * \param iv Pointer to 96-bit initialization vector - * \param adata Pointer to additional authenticated data in SRAM, or \c NULL - * \param adata_len Length of additional authenticated data in octets, or \c 0 - * \param cdata Pointer to encrypted message in SRAM, or \c NULL - * \param cdata_len Length of encrypted message in octets, or \c 0 - * \param pdata Pointer to decrypted message in SRAM (may be \p cdata), or - * \c NULL - * \param process Process to be polled upon completion of the operation, or - * \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/GCM error code - */ -uint8_t gcm_auth_decrypt_start(uint8_t key_area, const void *iv, - const void *adata, uint16_t adata_len, - const void *cdata, uint16_t cdata_len, - void *pdata, struct process *process); - -/** \brief Checks the status of the GCM authentication checking and decryption - * operation - * \retval false Result not yet available, and no error occurred - * \retval true Result available, or error occurred - */ -#define gcm_auth_decrypt_check_status aes_auth_crypt_check_status - -/** \brief Gets the result of the GCM authentication checking and decryption - * operation - * \param tag_in Pointer to 128-bit input authentication tag, or \c NULL - * \param tag_out Pointer to 128-bit output authentication tag, or \c NULL - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/GCM error code - * \note This function must be called only after \c gcm_auth_decrypt_start(). - */ -uint8_t gcm_auth_decrypt_get_result(const void *tag_in, void *tag_out); - -/** @} */ - -#endif /* GCM_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/gpio-hal-arch.c b/arch/cpu/cc2538/dev/gpio-hal-arch.c deleted file mode 100644 index bd2dfb92d..000000000 --- a/arch/cpu/cc2538/dev/gpio-hal-arch.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538-gpio-hal - * @{ - * - * \file - * Implementation file for the CC2538 GPIO HAL functions - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" -#include "dev/gpio.h" -#include "dev/ioc.h" - -#include -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_pin_cfg_set(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg) -{ - uint8_t port, pin_num, pin_mask; - uint32_t port_base; - - port = PIN_TO_PORT(pin); - port_base = PIN_TO_PORT_BASE(pin); - pin_num = pin % 8; - pin_mask = GPIO_PIN_MASK(pin_num); - - gpio_hal_pin_cfg_t tmp; - - tmp = cfg & GPIO_HAL_PIN_CFG_EDGE_BOTH; - if(tmp == GPIO_HAL_PIN_CFG_EDGE_NONE) { - GPIO_DISABLE_INTERRUPT(port_base, pin_mask); - } else if(tmp == GPIO_HAL_PIN_CFG_EDGE_RISING) { - GPIO_DETECT_EDGE(port_base, pin_mask); - GPIO_TRIGGER_SINGLE_EDGE(port_base, pin_mask); - GPIO_DETECT_RISING(port_base, pin_mask); - } else if(tmp == GPIO_HAL_PIN_CFG_EDGE_FALLING) { - GPIO_DETECT_EDGE(port_base, pin_mask); - GPIO_TRIGGER_SINGLE_EDGE(port_base, pin_mask); - GPIO_DETECT_FALLING(port_base, pin_mask); - } else if(tmp == GPIO_HAL_PIN_CFG_EDGE_BOTH) { - GPIO_DETECT_EDGE(port_base, pin_mask); - GPIO_TRIGGER_BOTH_EDGES(port_base, pin_mask); - } - - tmp = cfg & GPIO_HAL_PIN_CFG_PULL_MASK; - if(tmp == GPIO_HAL_PIN_CFG_PULL_NONE) { - ioc_set_over(port, pin_num, IOC_OVERRIDE_DIS); - } else if(tmp == GPIO_HAL_PIN_CFG_PULL_DOWN) { - ioc_set_over(port, pin_num, IOC_OVERRIDE_PDE); - } else if(tmp == GPIO_HAL_PIN_CFG_PULL_UP) { - ioc_set_over(port, pin_num, IOC_OVERRIDE_PUE); - } - - tmp = cfg & GPIO_HAL_PIN_CFG_INT_MASK; - if(tmp == GPIO_HAL_PIN_CFG_INT_DISABLE) { - GPIO_DISABLE_INTERRUPT(port_base, pin_mask); - } else if(tmp == GPIO_HAL_PIN_CFG_INT_ENABLE) { - GPIO_ENABLE_INTERRUPT(port_base, pin_mask); - NVIC_EnableIRQ(port); - } - - GPIO_SOFTWARE_CONTROL(port_base, pin_mask); -} -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_cfg_t -gpio_hal_arch_pin_cfg_get(gpio_hal_pin_t pin) -{ - uint8_t port, pin_num, pin_mask; - uint32_t port_base; - gpio_hal_pin_cfg_t cfg; - uint32_t tmp; - - port = PIN_TO_PORT(pin); - port_base = PIN_TO_PORT_BASE(pin); - pin_num = pin % 8; - pin_mask = GPIO_PIN_MASK(pin_num); - - cfg = 0; - - /* Pull */ - tmp = ioc_get_over(port, pin_num); - if(tmp == IOC_OVERRIDE_PUE) { - cfg |= GPIO_HAL_PIN_CFG_PULL_UP; - } else if(tmp == IOC_OVERRIDE_PDE) { - cfg |= GPIO_HAL_PIN_CFG_PULL_DOWN; - } else { - cfg |= GPIO_HAL_PIN_CFG_PULL_NONE; - } - - /* Interrupt enable/disable */ - tmp = REG((port_base) + GPIO_IE) & pin_mask; - if(tmp == 0) { - cfg |= GPIO_HAL_PIN_CFG_INT_DISABLE; - } else { - cfg |= GPIO_HAL_PIN_CFG_INT_ENABLE; - } - - /* Edge detection */ - if(REG((port_base) + GPIO_IS) & pin_mask) { - cfg |= GPIO_HAL_PIN_CFG_EDGE_NONE; - } else { - if(REG((port_base) + GPIO_IBE) & pin_mask) { - cfg |= GPIO_HAL_PIN_CFG_EDGE_BOTH; - } else { - if(REG((port_base) + GPIO_IEV) & pin_mask) { - cfg |= GPIO_HAL_PIN_CFG_EDGE_RISING; - } else { - cfg |= GPIO_HAL_PIN_CFG_EDGE_FALLING; - } - } - } - - return cfg; -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_write_pin(gpio_hal_pin_t pin, uint8_t value) -{ - if(value == 1) { - gpio_hal_arch_set_pin(pin); - return; - } - gpio_hal_arch_clear_pin(pin); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_set_pins(gpio_hal_pin_mask_t pins) -{ - GPIO_SET_PIN(GPIO_A_BASE, pins & 0xFF); - GPIO_SET_PIN(GPIO_B_BASE, (pins >> 8) & 0xFF); - GPIO_SET_PIN(GPIO_C_BASE, (pins >> 16) & 0xFF); - GPIO_SET_PIN(GPIO_D_BASE, (pins >> 24) & 0xFF); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_clear_pins(gpio_hal_pin_mask_t pins) -{ - GPIO_CLR_PIN(GPIO_A_BASE, pins & 0xFF); - GPIO_CLR_PIN(GPIO_B_BASE, (pins >> 8) & 0xFF); - GPIO_CLR_PIN(GPIO_C_BASE, (pins >> 16) & 0xFF); - GPIO_CLR_PIN(GPIO_D_BASE, (pins >> 24) & 0xFF); -} -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_mask_t -gpio_hal_arch_read_pins(gpio_hal_pin_mask_t pins) -{ - gpio_hal_pin_mask_t rv = 0; - - rv |= GPIO_READ_PIN(GPIO_A_BASE, pins & 0xFF); - rv |= GPIO_READ_PIN(GPIO_B_BASE, (pins >> 8) & 0xFF) << 8; - rv |= GPIO_READ_PIN(GPIO_C_BASE, (pins >> 16) & 0xFF) << 16; - rv |= GPIO_READ_PIN(GPIO_D_BASE, (pins >> 24) & 0xFF) << 24; - - return rv; -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_write_pins(gpio_hal_pin_mask_t pins, gpio_hal_pin_mask_t value) -{ - GPIO_WRITE_PIN(GPIO_A_BASE, pins & 0xFF, value & 0xFF); - GPIO_WRITE_PIN(GPIO_B_BASE, (pins >> 8) & 0xFF, (value >> 8) & 0xFF); - GPIO_WRITE_PIN(GPIO_C_BASE, (pins >> 16) & 0xFF, (value >> 16) & 0xFF); - GPIO_WRITE_PIN(GPIO_D_BASE, (pins >> 24) & 0xFF, (value >> 24) & 0xFF); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc2538/dev/gpio-hal-arch.h b/arch/cpu/cc2538/dev/gpio-hal-arch.h deleted file mode 100644 index ad2f24219..000000000 --- a/arch/cpu/cc2538/dev/gpio-hal-arch.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-gpio-hal CC2538 GPIO HAL implementation - * - * @{ - * - * \file - * Header file for the CC2538 GPIO HAL functions - * - * \note - * Do not include this header directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef GPIO_HAL_ARCH_H_ -#define GPIO_HAL_ARCH_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio.h" - -#include -/*---------------------------------------------------------------------------*/ -#define PIN_TO_PORT(pin) (pin >> 3) -#define PIN_TO_NUM(pin) (pin % 8) -#define PIN_TO_PORT_BASE(pin) GPIO_PORT_TO_BASE(PIN_TO_PORT(pin)) -/*---------------------------------------------------------------------------*/ -#define gpio_hal_arch_init() do { /* Do nothing */ } while(0) - -#define gpio_hal_arch_interrupt_enable(p) do { \ - GPIO_ENABLE_INTERRUPT(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8)); \ - NVIC_EnableIRQ(PIN_TO_PORT(p)); \ -} while(0); - -#define gpio_hal_arch_interrupt_disable(p) \ - GPIO_DISABLE_INTERRUPT(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8)) - -#define gpio_hal_arch_pin_set_input(p) do { \ - GPIO_SOFTWARE_CONTROL(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8)); \ - GPIO_SET_INPUT(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8)); \ -} while(0); - -#define gpio_hal_arch_pin_set_output(p) do { \ - GPIO_SOFTWARE_CONTROL(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8)); \ - GPIO_SET_OUTPUT(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8)); \ -} while(0); - -#define gpio_hal_arch_set_pin(p) \ - GPIO_SET_PIN(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8)) - -#define gpio_hal_arch_clear_pin(p) \ - GPIO_CLR_PIN(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8)) - -#define gpio_hal_arch_read_pin(p) \ - (GPIO_READ_PIN(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8)) == 0 ? 0 : 1) -/*---------------------------------------------------------------------------*/ -#endif /* GPIO_HAL_ARCH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/gpio.c b/arch/cpu/cc2538/dev/gpio.c deleted file mode 100644 index c5c72594b..000000000 --- a/arch/cpu/cc2538/dev/gpio.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-gpio - * @{ - * - * \file - * Implementation of the cc2538 GPIO controller - */ -#include "contiki.h" -#include "dev/leds.h" -#include "dev/gpio-hal.h" -#include "dev/gpio.h" -#include "dev/nvic.h" -#include "reg.h" -#include "lpm.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \brief Interrupt service routine for Port \a port - * \param port Number between 0 and 3. Port A: 0, Port B: 1, etc. - */ -static void -gpio_port_isr(uint8_t port) -{ - uint32_t base; - uint8_t int_status, power_up_int_status; - - lpm_exit(); - - base = GPIO_PORT_TO_BASE(port); - int_status = GPIO_GET_MASKED_INT_STATUS(base); - power_up_int_status = GPIO_GET_POWER_UP_INT_STATUS(port); - - gpio_hal_event_handler((int_status | power_up_int_status) << (port << 3)); - - GPIO_CLEAR_INTERRUPT(base, int_status); - GPIO_CLEAR_POWER_UP_INTERRUPT(port, power_up_int_status); -} -/*---------------------------------------------------------------------------*/ -#define GPIO_PORT_ISR(lowercase_port, uppercase_port) \ -void \ -gpio_port_##lowercase_port##_isr(void) \ -{ \ - gpio_port_isr(GPIO_##uppercase_port##_NUM); \ -} -GPIO_PORT_ISR(a, A) -GPIO_PORT_ISR(b, B) -GPIO_PORT_ISR(c, C) -GPIO_PORT_ISR(d, D) -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc2538/dev/gpio.h b/arch/cpu/cc2538/dev/gpio.h deleted file mode 100644 index 67b28cf0d..000000000 --- a/arch/cpu/cc2538/dev/gpio.h +++ /dev/null @@ -1,613 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-gpio cc2538 General-Purpose I/O - * - * Driver for the cc2538 GPIO controller - * @{ - * - * \file - * Header file with register and macro declarations for the cc2538 GPIO module - */ -#ifndef GPIO_H_ -#define GPIO_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" -#include "reg.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \name Base addresses for the GPIO register instances - * @{ - */ -#define GPIO_A_BASE 0x400D9000 /**< GPIO_A */ -#define GPIO_B_BASE 0x400DA000 /**< GPIO_B */ -#define GPIO_C_BASE 0x400DB000 /**< GPIO_C */ -#define GPIO_D_BASE 0x400DC000 /**< GPIO_D */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Numeric representation of the four GPIO ports - * @{ - */ -#define GPIO_A_NUM 0 /**< GPIO_A: 0 */ -#define GPIO_B_NUM 1 /**< GPIO_B: 1 */ -#define GPIO_C_NUM 2 /**< GPIO_C: 2 */ -#define GPIO_D_NUM 3 /**< GPIO_D: 3 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name GPIO Manipulation macros - * @{ - */ -/** \brief Set pins with PIN_MASK of port with PORT_BASE to input. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_SET_INPUT(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_DIR) &= ~(PIN_MASK); } while(0) - -/** \brief Set pins with PIN_MASK of port with PORT_BASE to output. -* \param PORT_BASE GPIO Port register offset -* \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 -*/ -#define GPIO_SET_OUTPUT(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_DIR) |= (PIN_MASK); } while(0) - -/** \brief Return whether pins with PIN_MASK of port with PORT_BASE are set to - * output. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - * \return The direction of the pins specified by PIN_MASK - * - * This macro will \e not return 0 or 1. Instead, it will return the directions - * of the pins specified by PIN_MASK ORed together. Thus, if 0xC3 - * (0x80 | 0x40 | 0x02 | 0x01) is passed as the PIN_MASK and pins 7 and 0 are - * set to output, the macro will return 0x81. - */ -#define GPIO_IS_OUTPUT(PORT_BASE, PIN_MASK) \ - (REG((PORT_BASE) + GPIO_DIR) & (PIN_MASK)) - -/** \brief Set pins with PIN_MASK of port with PORT_BASE high. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_SET_PIN(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_DATA + ((PIN_MASK) << 2)) = 0xFF; } while(0) - -/** \brief Set pins with PIN_MASK of port with PORT_BASE low. -* \param PORT_BASE GPIO Port register offset -* \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 -*/ -#define GPIO_CLR_PIN(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_DATA + ((PIN_MASK) << 2)) = 0x00; } while(0) - -/** \brief Set pins with PIN_MASK of port with PORT_BASE to value. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - * \param value The new value to write to the register. Only pins specified - * by PIN_MASK will be set. - * - * \note The outcome of this macro invocation will be to write to the register - * a new value for multiple pins. For that reason, the value argument cannot be - * a simple 0 or 1. Instead, it must be the value corresponding to the pins that - * you wish to set. - * - * Thus, if you only want to set a single pin (e.g. pin 2), do \e not pass 1, - * but you must pass 0x04 instead (1 << 2). This may seem counter-intuitive at - * first glance, but it allows a single invocation of this macro to set - * multiple pins in one go if so desired. For example, you can set pins 3 and 1 - * and the same time clear pins 2 and 0. To do so, pass 0x0F as the PIN_MASK - * and then use 0x0A as the value ((1 << 3) | (1 << 1) for pins 3 and 1) - */ -#define GPIO_WRITE_PIN(PORT_BASE, PIN_MASK, value) \ - do { REG((PORT_BASE) + GPIO_DATA + ((PIN_MASK) << 2)) = (value); } while(0) - -/** \brief Read pins with PIN_MASK of port with PORT_BASE. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - * \return The value of the pins specified by PIN_MASK - * - * This macro will \e not return 0 or 1. Instead, it will return the values of - * the pins specified by PIN_MASK ORd together. Thus, if you pass 0xC3 - * (0x80 | 0x40 | 0x02 | 0x01) as the PIN_MASK and pins 7 and 0 are high, - * the macro will return 0x81. - */ -#define GPIO_READ_PIN(PORT_BASE, PIN_MASK) \ - REG((PORT_BASE) + GPIO_DATA + ((PIN_MASK) << 2)) - -/** \brief Set pins with PIN_MASK of port with PORT_BASE to detect edge. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_DETECT_EDGE(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_IS) &= ~(PIN_MASK); } while(0) - -/** \brief Set pins with PIN_MASK of port with PORT_BASE to detect level. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_DETECT_LEVEL(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_IS) |= (PIN_MASK); } while(0) - -/** \brief Set pins with PIN_MASK of port with PORT_BASE to trigger an - * interrupt on both edges. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_TRIGGER_BOTH_EDGES(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_IBE) |= (PIN_MASK); } while(0) - -/** \brief Set pins with PIN_MASK of port with PORT_BASE to trigger an - * interrupt on single edge (controlled by GPIO_IEV). - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_TRIGGER_SINGLE_EDGE(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_IBE) &= ~(PIN_MASK); } while(0) - -/** \brief Set pins with PIN_MASK of port with PORT_BASE to trigger an - * interrupt on rising edge. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_DETECT_RISING(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_IEV) |= (PIN_MASK); } while(0) - -/** \brief Set pins with PIN_MASK of port with PORT_BASE to trigger an - * interrupt on falling edge. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_DETECT_FALLING(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_IEV) &= ~(PIN_MASK); } while(0) - -/** \brief Enable interrupt triggering for pins with PIN_MASK of port with - * PORT_BASE. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_ENABLE_INTERRUPT(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_IE) |= (PIN_MASK); } while(0) - -/** \brief Disable interrupt triggering for pins with PIN_MASK of port with - * PORT_BASE. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_DISABLE_INTERRUPT(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_IE) &= ~(PIN_MASK); } while(0) - -/** \brief Get raw interrupt status of port with PORT_BASE. - * \param PORT_BASE GPIO Port register offset - * \return Bit-mask reflecting the raw interrupt status of all the port pins - * - * The bits set in the returned bit-mask reflect the status of the interrupts - * trigger conditions detected (raw, before interrupt masking), indicating that - * all the requirements are met, before they are finally allowed to trigger by - * the interrupt mask. The bits cleared indicate that corresponding input pins - * have not initiated an interrupt. - */ -#define GPIO_GET_RAW_INT_STATUS(PORT_BASE) \ - REG((PORT_BASE) + GPIO_RIS) - -/** \brief Get masked interrupt status of port with PORT_BASE. - * \param PORT_BASE GPIO Port register offset - * \return Bit-mask reflecting the masked interrupt status of all the port pins - * - * The bits set in the returned bit-mask reflect the status of input lines - * triggering an interrupt. The bits cleared indicate that either no interrupt - * has been generated, or the interrupt is masked. This is the state of the - * interrupt after interrupt masking. - */ -#define GPIO_GET_MASKED_INT_STATUS(PORT_BASE) \ - REG((PORT_BASE) + GPIO_MIS) - -/** \brief Clear interrupt triggering for pins with PIN_MASK of port with - * PORT_BASE. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_CLEAR_INTERRUPT(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_IC) = (PIN_MASK); } while(0) - -/** \brief Configure the pin to be under peripheral control with PIN_MASK of - * port with PORT_BASE. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_PERIPHERAL_CONTROL(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_AFSEL) |= (PIN_MASK); } while(0) - -/** \brief Configure the pin to be software controlled with PIN_MASK of port - * with PORT_BASE. - * \param PORT_BASE GPIO Port register offset - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_SOFTWARE_CONTROL(PORT_BASE, PIN_MASK) \ - do { REG((PORT_BASE) + GPIO_AFSEL) &= ~(PIN_MASK); } while(0) - -/** \brief Set pins with PIN_MASK of port PORT to trigger a power-up interrupt - * on rising edge. - * \param PORT GPIO Port (not port base address) - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_POWER_UP_ON_RISING(PORT, PIN_MASK) \ - do { REG(GPIO_PORT_TO_BASE(PORT) + GPIO_P_EDGE_CTRL) &= \ - ~((PIN_MASK) << ((PORT) << 3)); } while(0) - -/** \brief Set pins with PIN_MASK of port PORT to trigger a power-up interrupt - * on falling edge. - * \param PORT GPIO Port (not port base address) - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_POWER_UP_ON_FALLING(PORT, PIN_MASK) \ - do { REG(GPIO_PORT_TO_BASE(PORT) + GPIO_P_EDGE_CTRL) |= \ - (PIN_MASK) << ((PORT) << 3); } while(0) - -/** \brief Enable power-up interrupt triggering for pins with PIN_MASK of port - * PORT. - * \param PORT GPIO Port (not port base address) - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_ENABLE_POWER_UP_INTERRUPT(PORT, PIN_MASK) \ - do { REG(GPIO_PORT_TO_BASE(PORT) + GPIO_PI_IEN) |= \ - (PIN_MASK) << ((PORT) << 3); } while(0) - -/** \brief Disable power-up interrupt triggering for pins with PIN_MASK of port - * PORT. - * \param PORT GPIO Port (not port base address) - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_DISABLE_POWER_UP_INTERRUPT(PORT, PIN_MASK) \ - do { REG(GPIO_PORT_TO_BASE(PORT) + GPIO_PI_IEN) &= \ - ~((PIN_MASK) << ((PORT) << 3)); } while(0) - -/** \brief Get power-up interrupt status of port PORT. - * \param PORT GPIO Port (not port base address) - * \return Bit-mask reflecting the power-up interrupt status of all the port - * pins - */ -#define GPIO_GET_POWER_UP_INT_STATUS(PORT) \ - ((REG(GPIO_PORT_TO_BASE(PORT) + GPIO_IRQ_DETECT_ACK) >> ((PORT) << 3)) & 0xFF) - -/** \brief Clear power-up interrupt triggering for pins with PIN_MASK of port - * PORT. - * \param PORT GPIO Port (not port base address) - * \param PIN_MASK Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 - */ -#define GPIO_CLEAR_POWER_UP_INTERRUPT(PORT, PIN_MASK) \ - do { REG(GPIO_PORT_TO_BASE(PORT) + GPIO_IRQ_DETECT_ACK) = \ - (PIN_MASK) << ((PORT) << 3); } while(0) - -/** - * \brief Converts a pin number to a pin mask - * \param PIN The pin number in the range [0..7] - * \return A pin mask which can be used as the PIN_MASK argument of the macros - * in this category - */ -#define GPIO_PIN_MASK(PIN) (1 << (PIN)) - -/** - * \brief Converts a port number to the port base address - * \param PORT The port number in the range 0 - 3. Likely GPIO_X_NUM. - * \return The base address for the registers corresponding to that port - * number. - */ -#define GPIO_PORT_TO_BASE(PORT) (GPIO_A_BASE + ((PORT) << 12)) - -/** - * \brief Converts a port/pin pair to GPIO HAL pin number - * \param PORT The port number in the range 0 - 3 (GPIO_n_NUM). - * \param PIN The pin number in the range 0 - 7. - * \return The pin representation using GPIO HAL semantics - */ -#define GPIO_PORT_PIN_TO_GPIO_HAL_PIN(PORT, PIN) (((PORT) << 3) + (PIN)) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO Register offset declarations - * @{ - */ -#define GPIO_DATA 0x00000000 /**< Data register */ -#define GPIO_DIR 0x00000400 /**< Data direction register */ -#define GPIO_IS 0x00000404 /**< Interrupt sense */ -#define GPIO_IBE 0x00000408 /**< Interrupt both edges */ -#define GPIO_IEV 0x0000040C /**< Interrupt event */ -#define GPIO_IE 0x00000410 /**< Interrupt mask */ -#define GPIO_RIS 0x00000414 /**< Interrupt status - raw */ -#define GPIO_MIS 0x00000418 /**< Interrupt status - masked */ -#define GPIO_IC 0x0000041C /**< Interrupt clear */ -#define GPIO_AFSEL 0x00000420 /**< Mode control select */ -#define GPIO_GPIOLOCK 0x00000520 /**< GPIO commit unlock */ -#define GPIO_GPIOCR 0x00000524 /**< GPIO commit */ -#define GPIO_PMUX 0x00000700 /**< PMUX register */ -#define GPIO_P_EDGE_CTRL 0x00000704 /**< Port edge control */ -#define GPIO_USB_CTRL 0x00000708 /**< USB input power-up edge ctrl */ -#define GPIO_PI_IEN 0x00000710 /**< Power-up interrupt enable */ -#define GPIO_IRQ_DETECT_ACK 0x00000718 /**< IRQ detect ACK - I/O ports */ -#define GPIO_USB_IRQ_ACK 0x0000071C /**< IRQ detect ACK - USB */ -#define GPIO_IRQ_DETECT_UNMASK 0x00000720 /**< IRQ detect ACK - masked */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_DATA register bit masks - * @{ - */ -#define GPIO_DATA_DATA 0x000000FF /**< Input and output data */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_DIR register bit masks - * @{ - */ -#define GPIO_DIR_DIR 0x000000FF /**< Pin Input (0) / Output (1) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_IS register bit masks - * @{ - */ -#define GPIO_IS_IS 0x000000FF /**< Detect Edge (0) / Level (1) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_IBE register bit masks - * @{ - */ -#define GPIO_IBE_IBE 0x000000FF /**< Both Edges (1) / Single (0) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_IEV register bit masks - * @{ - */ -#define GPIO_IEV_IEV 0x000000FF /**< Rising (1) / Falling (0) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_IE register bit masks - * @{ - */ -#define GPIO_IE_IE 0x000000FF /**< Masked (0) / Not Masked (1) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_RIS register bit masks - * @{ - */ -#define GPIO_RIS_RIS 0x000000FF /**< Raw interrupt status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_MIS register bit masks - * @{ - */ -#define GPIO_MIS_MIS 0x000000FF /**< Masked interrupt status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_IC register bit masks - * @{ - */ -#define GPIO_IC_IC 0x000000FF /**< Clear edge detection (1) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_AFSEL register bit masks - * @{ - */ -#define GPIO_AFSEL_AFSEL 0x000000FF /**< Software (0) / Peripheral (1) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_GPIOLOCK register bit masks - * @{ - */ -#define GPIO_GPIOLOCK_LOCK 0xFFFFFFFF /**< Locked (1) / Unlocked (0) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_GPIOCR register bit masks - * @{ - */ -#define GPIO_GPIOCR_CR 0x000000FF /**< Allow alternate function (1) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_PMUX register bit masks - * @{ - */ -#define GPIO_PMUX_CKOEN 0x00000080 /**< Clock out enable */ -#define GPIO_PMUX_CKOPIN 0x00000010 /**< Decouple control pin select */ -#define GPIO_PMUX_DCEN 0x00000008 /**< Decouple control enable */ -#define GPIO_PMUX_DCPIN 0x00000001 /**< Decouple control pin select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_P_EDGE_CTRL register bit masks. - * \brief Rising (0) / Falling (1) - * @{ - */ -#define GPIO_P_EDGE_CTRL_PDIRC7 0x80000000 /**< Port D bit 7 */ -#define GPIO_P_EDGE_CTRL_PDIRC6 0x40000000 /**< Port D bit 6 */ -#define GPIO_P_EDGE_CTRL_PDIRC5 0x20000000 /**< Port D bit 5 */ -#define GPIO_P_EDGE_CTRL_PDIRC4 0x10000000 /**< Port D bit 4 */ -#define GPIO_P_EDGE_CTRL_PDIRC3 0x08000000 /**< Port D bit 3 */ -#define GPIO_P_EDGE_CTRL_PDIRC2 0x04000000 /**< Port D bit 2 */ -#define GPIO_P_EDGE_CTRL_PDIRC1 0x02000000 /**< Port D bit 1 */ -#define GPIO_P_EDGE_CTRL_PDIRC0 0x01000000 /**< Port D bit 0 */ -#define GPIO_P_EDGE_CTRL_PCIRC7 0x00800000 /**< Port C bit 7 */ -#define GPIO_P_EDGE_CTRL_PCIRC6 0x00400000 /**< Port C bit 6 */ -#define GPIO_P_EDGE_CTRL_PCIRC5 0x00200000 /**< Port C bit 5 */ -#define GPIO_P_EDGE_CTRL_PCIRC4 0x00100000 /**< Port C bit 4 */ -#define GPIO_P_EDGE_CTRL_PCIRC3 0x00080000 /**< Port C bit 3 */ -#define GPIO_P_EDGE_CTRL_PCIRC2 0x00040000 /**< Port C bit 2 */ -#define GPIO_P_EDGE_CTRL_PCIRC1 0x00020000 /**< Port C bit 1 */ -#define GPIO_P_EDGE_CTRL_PCIRC0 0x00010000 /**< Port C bit 0 */ -#define GPIO_P_EDGE_CTRL_PBIRC7 0x00008000 /**< Port B bit 7 */ -#define GPIO_P_EDGE_CTRL_PBIRC6 0x00004000 /**< Port B bit 6 */ -#define GPIO_P_EDGE_CTRL_PBIRC5 0x00002000 /**< Port B bit 5 */ -#define GPIO_P_EDGE_CTRL_PBIRC4 0x00001000 /**< Port B bit 4 */ -#define GPIO_P_EDGE_CTRL_PBIRC3 0x00000800 /**< Port B bit 3 */ -#define GPIO_P_EDGE_CTRL_PBIRC2 0x00000400 /**< Port B bit 2 */ -#define GPIO_P_EDGE_CTRL_PBIRC1 0x00000200 /**< Port B bit 1 */ -#define GPIO_P_EDGE_CTRL_PBIRC0 0x00000100 /**< Port B bit 0 */ -#define GPIO_P_EDGE_CTRL_PAIRC7 0x00000080 /**< Port A bit 7 */ -#define GPIO_P_EDGE_CTRL_PAIRC6 0x00000040 /**< Port A bit 6 */ -#define GPIO_P_EDGE_CTRL_PAIRC5 0x00000020 /**< Port A bit 5 */ -#define GPIO_P_EDGE_CTRL_PAIRC4 0x00000010 /**< Port A bit 4 */ -#define GPIO_P_EDGE_CTRL_PAIRC3 0x00000008 /**< Port A bit 3 */ -#define GPIO_P_EDGE_CTRL_PAIRC2 0x00000004 /**< Port A bit 2 */ -#define GPIO_P_EDGE_CTRL_PAIRC1 0x00000002 /**< Port A bit 1 */ -#define GPIO_P_EDGE_CTRL_PAIRC0 0x00000001 /**< Port A bit 0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_USB_CTRL register bit masks - * @{ - */ -#define GPIO_USB_CTRL_USB_EDGE_CTL 0x00000001 /**< Rising (0) / Falling (1) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_PI_IEN register bit masks. - * \brief Enabled (1) / Disabled (0) - * @{ - */ -#define GPIO_PI_IEN_PDIEN7 0x80000000 /**< Port D bit 7 */ -#define GPIO_PI_IEN_PDIEN6 0x40000000 /**< Port D bit 6 */ -#define GPIO_PI_IEN_PDIEN5 0x20000000 /**< Port D bit 5 */ -#define GPIO_PI_IEN_PDIEN4 0x10000000 /**< Port D bit 4 */ -#define GPIO_PI_IEN_PDIEN3 0x08000000 /**< Port D bit 3 */ -#define GPIO_PI_IEN_PDIEN2 0x04000000 /**< Port D bit 2 */ -#define GPIO_PI_IEN_PDIEN1 0x02000000 /**< Port D bit 1 */ -#define GPIO_PI_IEN_PDIEN0 0x01000000 /**< Port D bit 0 */ -#define GPIO_PI_IEN_PCIEN7 0x00800000 /**< Port C bit 7 */ -#define GPIO_PI_IEN_PCIEN6 0x00400000 /**< Port C bit 6 */ -#define GPIO_PI_IEN_PCIEN5 0x00200000 /**< Port C bit 5 */ -#define GPIO_PI_IEN_PCIEN4 0x00100000 /**< Port C bit 4 */ -#define GPIO_PI_IEN_PCIEN3 0x00080000 /**< Port C bit 3 */ -#define GPIO_PI_IEN_PCIEN2 0x00040000 /**< Port C bit 2 */ -#define GPIO_PI_IEN_PCIEN1 0x00020000 /**< Port C bit 1 */ -#define GPIO_PI_IEN_PCIEN0 0x00010000 /**< Port C bit 0 */ -#define GPIO_PI_IEN_PBIEN7 0x00008000 /**< Port B bit 7 */ -#define GPIO_PI_IEN_PBIEN6 0x00004000 /**< Port B bit 6 */ -#define GPIO_PI_IEN_PBIEN5 0x00002000 /**< Port B bit 5 */ -#define GPIO_PI_IEN_PBIEN4 0x00001000 /**< Port B bit 4 */ -#define GPIO_PI_IEN_PBIEN3 0x00000800 /**< Port B bit 3 */ -#define GPIO_PI_IEN_PBIEN2 0x00000400 /**< Port B bit 2 */ -#define GPIO_PI_IEN_PBIEN1 0x00000200 /**< Port B bit 1 */ -#define GPIO_PI_IEN_PBIEN0 0x00000100 /**< Port B bit 0 */ -#define GPIO_PI_IEN_PAIEN7 0x00000080 /**< Port A bit 7 */ -#define GPIO_PI_IEN_PAIEN6 0x00000040 /**< Port A bit 6 */ -#define GPIO_PI_IEN_PAIEN5 0x00000020 /**< Port A bit 5 */ -#define GPIO_PI_IEN_PAIEN4 0x00000010 /**< Port A bit 4 */ -#define GPIO_PI_IEN_PAIEN3 0x00000008 /**< Port A bit 3 */ -#define GPIO_PI_IEN_PAIEN2 0x00000004 /**< Port A bit 2 */ -#define GPIO_PI_IEN_PAIEN1 0x00000002 /**< Port A bit 1 */ -#define GPIO_PI_IEN_PAIEN0 0x00000001 /**< Port A bit 0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_IRQ_DETECT_ACK register bit masks - * \brief Detected (1) / Undetected (0) - * @{ - */ -#define GPIO_IRQ_DETECT_ACK_PDIACK7 0x80000000 /**< Port D bit 7 */ -#define GPIO_IRQ_DETECT_ACK_PDIACK6 0x40000000 /**< Port D bit 6 */ -#define GPIO_IRQ_DETECT_ACK_PDIACK5 0x20000000 /**< Port D bit 5 */ -#define GPIO_IRQ_DETECT_ACK_PDIACK4 0x10000000 /**< Port D bit 4 */ -#define GPIO_IRQ_DETECT_ACK_PDIACK3 0x08000000 /**< Port D bit 3 */ -#define GPIO_IRQ_DETECT_ACK_PDIACK2 0x04000000 /**< Port D bit 2 */ -#define GPIO_IRQ_DETECT_ACK_PDIACK1 0x02000000 /**< Port D bit 1 */ -#define GPIO_IRQ_DETECT_ACK_PDIACK0 0x01000000 /**< Port D bit 0 */ -#define GPIO_IRQ_DETECT_ACK_PCIACK7 0x00800000 /**< Port C bit 7 */ -#define GPIO_IRQ_DETECT_ACK_PCIACK6 0x00400000 /**< Port C bit 6 */ -#define GPIO_IRQ_DETECT_ACK_PCIACK5 0x00200000 /**< Port C bit 5 */ -#define GPIO_IRQ_DETECT_ACK_PCIACK4 0x00100000 /**< Port C bit 4 */ -#define GPIO_IRQ_DETECT_ACK_PCIACK3 0x00080000 /**< Port C bit 3 */ -#define GPIO_IRQ_DETECT_ACK_PCIACK2 0x00040000 /**< Port C bit 2 */ -#define GPIO_IRQ_DETECT_ACK_PCIACK1 0x00020000 /**< Port C bit 1 */ -#define GPIO_IRQ_DETECT_ACK_PCIACK0 0x00010000 /**< Port C bit 0 */ -#define GPIO_IRQ_DETECT_ACK_PBIACK7 0x00008000 /**< Port B bit 7 */ -#define GPIO_IRQ_DETECT_ACK_PBIACK6 0x00004000 /**< Port B bit 6 */ -#define GPIO_IRQ_DETECT_ACK_PBIACK5 0x00002000 /**< Port B bit 5 */ -#define GPIO_IRQ_DETECT_ACK_PBIACK4 0x00001000 /**< Port B bit 4 */ -#define GPIO_IRQ_DETECT_ACK_PBIACK3 0x00000800 /**< Port B bit 3 */ -#define GPIO_IRQ_DETECT_ACK_PBIACK2 0x00000400 /**< Port B bit 2 */ -#define GPIO_IRQ_DETECT_ACK_PBIACK1 0x00000200 /**< Port B bit 1 */ -#define GPIO_IRQ_DETECT_ACK_PBIACK0 0x00000100 /**< Port B bit 0 */ -#define GPIO_IRQ_DETECT_ACK_PAIACK7 0x00000080 /**< Port A bit 7 */ -#define GPIO_IRQ_DETECT_ACK_PAIACK6 0x00000040 /**< Port A bit 6 */ -#define GPIO_IRQ_DETECT_ACK_PAIACK5 0x00000020 /**< Port A bit 5 */ -#define GPIO_IRQ_DETECT_ACK_PAIACK4 0x00000010 /**< Port A bit 4 */ -#define GPIO_IRQ_DETECT_ACK_PAIACK3 0x00000008 /**< Port A bit 3 */ -#define GPIO_IRQ_DETECT_ACK_PAIACK2 0x00000004 /**< Port A bit 2 */ -#define GPIO_IRQ_DETECT_ACK_PAIACK1 0x00000002 /**< Port A bit 1 */ -#define GPIO_IRQ_DETECT_ACK_PAIACK0 0x00000001 /**< Port A bit 0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_USB_IRQ_ACK register bit masks - * @{ - */ -#define GPIO_USB_IRQ_ACK_USBACK 0x00000001 /**< Detected (1) / Not detected (0) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPIO_IRQ_DETECT_UNMASK register bit masks. - * \brief Detected (1) / Not detected (0) - * @{ - */ -#define GPIO_IRQ_DETECT_UNMASK_PDIACK7 0x80000000 /**< Port D bit 7 */ -#define GPIO_IRQ_DETECT_UNMASK_PDIACK6 0x40000000 /**< Port D bit 6 */ -#define GPIO_IRQ_DETECT_UNMASK_PDIACK5 0x20000000 /**< Port D bit 5 */ -#define GPIO_IRQ_DETECT_UNMASK_PDIACK4 0x10000000 /**< Port D bit 4 */ -#define GPIO_IRQ_DETECT_UNMASK_PDIACK3 0x08000000 /**< Port D bit 3 */ -#define GPIO_IRQ_DETECT_UNMASK_PDIACK2 0x04000000 /**< Port D bit 2 */ -#define GPIO_IRQ_DETECT_UNMASK_PDIACK1 0x02000000 /**< Port D bit 1 */ -#define GPIO_IRQ_DETECT_UNMASK_PDIACK0 0x01000000 /**< Port D bit 0 */ -#define GPIO_IRQ_DETECT_UNMASK_PCIACK7 0x00800000 /**< Port C bit 7 */ -#define GPIO_IRQ_DETECT_UNMASK_PCIACK6 0x00400000 /**< Port C bit 6 */ -#define GPIO_IRQ_DETECT_UNMASK_PCIACK5 0x00200000 /**< Port C bit 5 */ -#define GPIO_IRQ_DETECT_UNMASK_PCIACK4 0x00100000 /**< Port C bit 4 */ -#define GPIO_IRQ_DETECT_UNMASK_PCIACK3 0x00080000 /**< Port C bit 3 */ -#define GPIO_IRQ_DETECT_UNMASK_PCIACK2 0x00040000 /**< Port C bit 2 */ -#define GPIO_IRQ_DETECT_UNMASK_PCIACK1 0x00020000 /**< Port C bit 1 */ -#define GPIO_IRQ_DETECT_UNMASK_PCIACK0 0x00010000 /**< Port C bit 0 */ -#define GPIO_IRQ_DETECT_UNMASK_PBIACK7 0x00008000 /**< Port B bit 7 */ -#define GPIO_IRQ_DETECT_UNMASK_PBIACK6 0x00004000 /**< Port B bit 6 */ -#define GPIO_IRQ_DETECT_UNMASK_PBIACK5 0x00002000 /**< Port B bit 5 */ -#define GPIO_IRQ_DETECT_UNMASK_PBIACK4 0x00001000 /**< Port B bit 4 */ -#define GPIO_IRQ_DETECT_UNMASK_PBIACK3 0x00000800 /**< Port B bit 3 */ -#define GPIO_IRQ_DETECT_UNMASK_PBIACK2 0x00000400 /**< Port B bit 2 */ -#define GPIO_IRQ_DETECT_UNMASK_PBIACK1 0x00000200 /**< Port B bit 1 */ -#define GPIO_IRQ_DETECT_UNMASK_PBIACK0 0x00000100 /**< Port B bit 0 */ -#define GPIO_IRQ_DETECT_UNMASK_PAIACK7 0x00000080 /**< Port A bit 7 */ -#define GPIO_IRQ_DETECT_UNMASK_PAIACK6 0x00000040 /**< Port A bit 6 */ -#define GPIO_IRQ_DETECT_UNMASK_PAIACK5 0x00000020 /**< Port A bit 5 */ -#define GPIO_IRQ_DETECT_UNMASK_PAIACK4 0x00000010 /**< Port A bit 4 */ -#define GPIO_IRQ_DETECT_UNMASK_PAIACK3 0x00000008 /**< Port A bit 3 */ -#define GPIO_IRQ_DETECT_UNMASK_PAIACK2 0x00000004 /**< Port A bit 2 */ -#define GPIO_IRQ_DETECT_UNMASK_PAIACK1 0x00000002 /**< Port A bit 1 */ -#define GPIO_IRQ_DETECT_UNMASK_PAIACK0 0x00000001 /**< Port A bit 0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* GPIO_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/gptimer.h b/arch/cpu/cc2538/dev/gptimer.h deleted file mode 100644 index 4367c0451..000000000 --- a/arch/cpu/cc2538/dev/gptimer.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-gptimer cc2538 General-Purpose Timers - * - * Driver for the cc2538 General Purpose Timers - * @{ - * - * \file - * Header file for the cc2538 General Purpose Timers - */ -#ifndef GPTIMER_H_ -#define GPTIMER_H_ -/*---------------------------------------------------------------------------*/ -/** \name Base addresses for the GPT register instances - * @{ - */ -#define GPT_0_BASE 0x40030000 /**< GPTIMER0 */ -#define GPT_1_BASE 0x40031000 /**< GPTIMER1 */ -#define GPT_2_BASE 0x40032000 /**< GPTIMER2 */ -#define GPT_3_BASE 0x40033000 /**< GPTIMER3 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER Register offset declarations - * @{ - */ -#define GPTIMER_CFG 0x00000000 /**< GPTM configuration */ -#define GPTIMER_TAMR 0x00000004 /**< GPTM Timer A mode */ -#define GPTIMER_TBMR 0x00000008 /**< GPTM Timer B mode */ -#define GPTIMER_CTL 0x0000000C /**< GPTM control */ -#define GPTIMER_SYNC 0x00000010 /**< GPTM synchronize (0 only) */ -#define GPTIMER_IMR 0x00000018 /**< GPTM interrupt mask */ -#define GPTIMER_RIS 0x0000001C /**< GPTM raw interrupt status */ -#define GPTIMER_MIS 0x00000020 /**< GPTM masked interrupt status */ -#define GPTIMER_ICR 0x00000024 /**< GPTM interrupt clear */ -#define GPTIMER_TAILR 0x00000028 /**< GPTM Timer A interval load */ -#define GPTIMER_TBILR 0x0000002C /**< GPTM Timer B interval load */ -#define GPTIMER_TAMATCHR 0x00000030 /**< GPTM Timer A match */ -#define GPTIMER_TBMATCHR 0x00000034 /**< GPTM Timer B match */ -#define GPTIMER_TAPR 0x00000038 /**< GPTM Timer A prescale */ -#define GPTIMER_TBPR 0x0000003C /**< GPTM Timer B prescale */ -#define GPTIMER_TAPMR 0x00000040 /**< GPTM Timer A prescale match */ -#define GPTIMER_TBPMR 0x00000044 /**< GPTM Timer B prescale match */ -#define GPTIMER_TAR 0x00000048 /**< GPTM Timer A */ -#define GPTIMER_TBR 0x0000004C /**< GPTM Timer B */ -#define GPTIMER_TAV 0x00000050 /**< GPTM Timer A value */ -#define GPTIMER_TBV 0x00000054 /**< GPTM Timer B value */ -#define GPTIMER_RTCPD 0x00000058 /**< GPTM RTC predivide */ -#define GPTIMER_TAPS 0x0000005C /**< GPTM Timer A prescale snapshot */ -#define GPTIMER_TBPS 0x00000060 /**< GPTM Timer B prescale snapshot */ -#define GPTIMER_TAPV 0x00000064 /**< GPTM Timer A prescale value */ -#define GPTIMER_TBPV 0x00000068 /**< GPTM Timer B prescale value */ -#define GPTIMER_PP 0x00000FC0 /**< GPTM peripheral properties */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_CFG register bit masks - * @{ - */ -#define GPTIMER_CFG_GPTMCFG 0x00000007 /**< configuration */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TnMR bit values - * @{ - */ -#define GPTIMER_TAMR_TAMR_ONE_SHOT 0x00000001 -#define GPTIMER_TAMR_TAMR_PERIODIC 0x00000002 -#define GPTIMER_TAMR_TAMR_CAPTURE 0x00000003 -#define GPTIMER_TBMR_TBMR_ONE_SHOT 0x00000001 -#define GPTIMER_TBMR_TBMR_PERIODIC 0x00000002 -#define GPTIMER_TBMR_TBMR_CAPTURE 0x00000003 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TAMR register bit masks - * @{ - */ -#define GPTIMER_TAMR_TAPLO 0x00000800 /**< Legacy PWM operation */ -#define GPTIMER_TAMR_TAMRSU 0x00000400 /**< Timer A match register update mode */ -#define GPTIMER_TAMR_TAPWMIE 0x00000200 /**< Timer A PWM interrupt enable */ -#define GPTIMER_TAMR_TAILD 0x00000100 /**< Timer A PWM interval load write */ -#define GPTIMER_TAMR_TASNAPS 0x00000080 /**< Timer A snap-shot mode */ -#define GPTIMER_TAMR_TAWOT 0x00000040 /**< Timer A wait-on-trigger */ -#define GPTIMER_TAMR_TAMIE 0x00000020 /**< Timer A match interrupt enable */ -#define GPTIMER_TAMR_TACDIR 0x00000010 /**< Timer A count direction */ -#define GPTIMER_TAMR_TAAMS 0x00000008 /**< Timer A alternate mode */ -#define GPTIMER_TAMR_TACMR 0x00000004 /**< Timer A capture mode */ -#define GPTIMER_TAMR_TAMR 0x00000003 /**< Timer A mode */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TBMR register bit masks - * @{ - */ -#define GPTIMER_TBMR_TBPLO 0x00000800 /**< Legacy PWM operation */ -#define GPTIMER_TBMR_TBMRSU 0x00000400 /**< Timer B match register update mode */ -#define GPTIMER_TBMR_TBPWMIE 0x00000200 /**< Timer B PWM interrupt enable */ -#define GPTIMER_TBMR_TBILD 0x00000100 /**< Timer B PWM interval load write */ -#define GPTIMER_TBMR_TBSNAPS 0x00000080 /**< Timer B snap-shot mode */ -#define GPTIMER_TBMR_TBWOT 0x00000040 /**< Timer B wait-on-trigger */ -#define GPTIMER_TBMR_TBMIE 0x00000020 /**< Timer B match interrupt enable */ -#define GPTIMER_TBMR_TBCDIR 0x00000010 /**< Timer B count direction */ -#define GPTIMER_TBMR_TBAMS 0x00000008 /**< Timer B alternate mode */ -#define GPTIMER_TBMR_TBCMR 0x00000004 /**< Timer B capture mode */ -#define GPTIMER_TBMR_TBMR 0x00000003 /**< Timer B mode */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_CTL register bit masks - * @{ - */ -#define GPTIMER_CTL_TBPWML 0x00004000 /**< Timer B PWM output level */ -#define GPTIMER_CTL_TBOTE 0x00002000 /**< Timer B output trigger enable */ -#define GPTIMER_CTL_TBEVENT 0x00000C00 /**< Timer B event mode */ -#define GPTIMER_CTL_TBSTALL 0x00000200 /**< Timer B stall enable */ -#define GPTIMER_CTL_TBEN 0x00000100 /**< Timer B enable */ -#define GPTIMER_CTL_TAPWML 0x00000040 /**< Timer A PWM output level */ -#define GPTIMER_CTL_TAOTE 0x00000020 /**< Timer A output trigger enable */ -#define GPTIMER_CTL_RTCEN 0x00000010 /**< RTC enable */ -#define GPTIMER_CTL_TAEVENT 0x0000000C /**< Timer A event mode */ -#define GPTIMER_CTL_TASTALL 0x00000002 /**< Timer A stall enable */ -#define GPTIMER_CTL_TAEN 0x00000001 /**< Timer A enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_SYNC register bit masks - * @{ - */ -#define GPTIMER_SYNC_SYNC3 0x000000C0 /**< Synchronize GPTM3 */ -#define GPTIMER_SYNC_SYNC2 0x00000030 /**< Synchronize GPTM2 */ -#define GPTIMER_SYNC_SYNC1 0x0000000C /**< Synchronize GPTM1 */ -#define GPTIMER_SYNC_SYNC0 0x00000003 /**< Synchronize GPTM0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_IMR register bit masks - * @{ - */ -#define GPTIMER_IMR_TBMIM 0x00000800 /**< Timer B match int mask */ -#define GPTIMER_IMR_CBEIM 0x00000400 /**< Timer B capture event int mask */ -#define GPTIMER_IMR_CBMIM 0x00000200 /**< Timer B capture match int mask */ -#define GPTIMER_IMR_TBTOIM 0x00000100 /**< Timer B time-out int mask */ -#define GPTIMER_IMR_TAMIM 0x00000010 /**< Timer A match int mask */ -#define GPTIMER_IMR_RTCIM 0x00000008 /**< RTC int mask */ -#define GPTIMER_IMR_CAEIM 0x00000004 /**< Timer A capture event int mask */ -#define GPTIMER_IMR_CAMIM 0x00000002 /**< Timer A capture match int mask */ -#define GPTIMER_IMR_TATOIM 0x00000001 /**< Timer A time-out int mask */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_RIS register bit masks - * @{ - */ -#define GPTIMER_RIS_TBMRIS 0x00000800 /**< Timer B match raw status */ -#define GPTIMER_RIS_CBERIS 0x00000400 /**< Timer B capture event raw status */ -#define GPTIMER_RIS_CBMRIS 0x00000200 /**< Timer B capture match raw status */ -#define GPTIMER_RIS_TBTORIS 0x00000100 /**< Timer B time-out raw status */ -#define GPTIMER_RIS_TAMRIS 0x00000010 /**< Timer A match raw status */ -#define GPTIMER_RIS_RTCRIS 0x00000008 /**< RTC raw status */ -#define GPTIMER_RIS_CAERIS 0x00000004 /**< Timer A capture event raw status */ -#define GPTIMER_RIS_CAMRIS 0x00000002 /**< Timer A capture match raw status */ -#define GPTIMER_RIS_TATORIS 0x00000001 /**< Timer A time-out raw status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_MIS register bit masks - * @{ - */ -#define GPTIMER_MIS_TBMMIS 0x00000800 /**< Timer B match masked status */ -#define GPTIMER_MIS_CBEMIS 0x00000400 /**< Timer B capture event masked status */ -#define GPTIMER_MIS_CBMMIS 0x00000200 /**< Timer B capture match masked status */ -#define GPTIMER_MIS_TBTOMIS 0x00000100 /**< Timer B time-out masked status */ -#define GPTIMER_MIS_TAMRIS 0x00000010 /**< Timer A match masked status */ -#define GPTIMER_MIS_RTCMIS 0x00000008 /**< RTC masked status */ -#define GPTIMER_MIS_CAEMIS 0x00000004 /**< Timer A capture event masked status */ -#define GPTIMER_MIS_CAMMIS 0x00000002 /**< Timer A capture match masked status */ -#define GPTIMER_MIS_TATOMIS 0x00000001 /**< Timer A time-out masked status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_ICR register bit masks - * @{ - */ -#define GPTIMER_ICR_WUECINT 0x00010000 /**< write update error int clear */ -#define GPTIMER_ICR_TBMCINT 0x00000800 /**< Timer B match int clear */ -#define GPTIMER_ICR_CBECINT 0x00000400 /**< Timer B capture event int clear */ -#define GPTIMER_ICR_CBMCINT 0x00000200 /**< Timer B capture match int clear */ -#define GPTIMER_ICR_TBTOCINT 0x00000100 /**< Timer B time-out int clear */ -#define GPTIMER_ICR_TAMCINT 0x00000010 /**< Timer A match int clear */ -#define GPTIMER_ICR_RTCCINT 0x00000008 /**< RTC interrupt clear */ -#define GPTIMER_ICR_CAECINT 0x00000004 /**< Timer A capture event int clear */ -#define GPTIMER_ICR_CAMCINT 0x00000002 /**< Timer A capture match int clear */ -#define GPTIMER_ICR_TATOCINT 0x00000001 /**< Timer A time-out int clear */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TAILR register bit masks - * @{ - */ -#define GPTIMER_TAILR_TAILR 0xFFFFFFFF /**< A interval load register */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TBILR register bit masks - * @{ - */ -#define GPTIMER_TBILR_TBILR 0x0000FFFF /**< B interval load register */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TAMATCHR register bit masks - * @{ - */ -#define GPTIMER_TAMATCHR_TAMR 0xFFFFFFFF /**< Timer A match register */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TBMATCHR register bit masks - * @{ - */ -#define GPTIMER_TBMATCHR_TBMR 0x0000FFFF /**< Timer B match register */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TAPR register bit masks - * @{ - */ -#define GPTIMER_TAPR_TAPSR 0x000000FF /**< Timer A prescale */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TBPR register bit masks - * @{ - */ -#define GPTIMER_TBPR_TBPSR 0x000000FF /**< Timer B prescale */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TAPMR register bit masks - * @{ - */ -#define GPTIMER_TAPMR_TAPSR 0x000000FF /**< Timer A prescale match */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TBPMR register bit masks - * @{ - */ -#define GPTIMER_TBPMR_TBPSR 0x000000FF /**< Timer B prescale match */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TAR register bit masks - * @{ - */ -#define GPTIMER_TAR_TAR 0xFFFFFFFF /**< Timer A register */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TBR register bit masks - * @{ - */ -#define GPTIMER_TBR_TBR 0x0000FFFF /**< Timer B register */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TAV register bit masks - * @{ - */ -#define GPTIMER_TAV_TAV 0xFFFFFFFF /**< Timer A register */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TBV register bit masks - * @{ - */ -#define GPTIMER_TBV_PRE 0x00FF0000 /**< Timer B prescale register */ -#define GPTIMER_TBV_TBV 0x0000FFFF /**< Timer B register */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_RTCPD register bit masks - * @{ - */ -#define GPTIMER_RTCPD_RTCPD 0x0000FFFF /**< RTC predivider */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TAPS register bit masks - * @{ - */ -#define GPTIMER_TAPS_PSS 0x0000FFFF /**< Timer A prescaler */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TBPS register bit masks - * @{ - */ -#define GPTIMER_TBPS_PSS 0x0000FFFF /**< Timer B prescaler */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TAPV register bit masks - * @{ - */ -#define GPTIMER_TAPV_PSV 0x0000FFFF /**< Timer A prescaler value */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_TBPV register bit masks - * @{ - */ -#define GPTIMER_TBPV_PSV 0x0000FFFF /**< Timer B prescaler value */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name GPTIMER_PP register bit masks - * @{ - */ -#define GPTIMER_PP_ALTCLK 0x00000040 /**< Alternate clock source */ -#define GPTIMER_PP_SYNCNT 0x00000020 /**< Synchronized start */ -#define GPTIMER_PP_CHAIN 0x00000010 /**< Chain with other timers */ -#define GPTIMER_PP_SIZE 0x0000000F /**< Timer size */ -/** @} */ - -#endif /* GPTIMER_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/i2c.c b/arch/cpu/cc2538/dev/i2c.c deleted file mode 100644 index 34537a08f..000000000 --- a/arch/cpu/cc2538/dev/i2c.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2015, Mehdi Migault - * 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. - */ -/** - * \addtogroup cc2538-i2c cc2538 I2C Control - * @{ - * - * \file - * Implementation file of the I2C Control module - * - * \author - * Mehdi Migault - */ - -#include "i2c.h" - -#include -#include "clock.h" -#include "sys-ctrl.h" -/*---------------------------------------------------------------------------*/ -void -i2c_init(uint8_t port_sda, uint8_t pin_sda, uint8_t port_scl, uint8_t pin_scl, - uint32_t bus_speed) -{ - /* Enable I2C clock in different modes */ - REG(SYS_CTRL_RCGCI2C) |= 1; /* Run mode */ - - /* Reset I2C peripheral */ - REG(SYS_CTRL_SRI2C) |= 1; /* Reset position */ - - /* Delay for a little bit */ - clock_delay_usec(50); - - REG(SYS_CTRL_SRI2C) &= ~1; /* Normal position */ - - /* Set pins in input */ - GPIO_SET_INPUT(GPIO_PORT_TO_BASE(port_sda), GPIO_PIN_MASK(pin_sda)); - GPIO_SET_INPUT(GPIO_PORT_TO_BASE(port_scl), GPIO_PIN_MASK(pin_scl)); - - /* Set peripheral control for the pins */ - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(port_sda), GPIO_PIN_MASK(pin_sda)); - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(port_scl), GPIO_PIN_MASK(pin_scl)); - - /* Set the pad to no drive type */ - ioc_set_over(port_sda, pin_sda, IOC_OVERRIDE_DIS); - ioc_set_over(port_scl, pin_scl, IOC_OVERRIDE_DIS); - - /* Set pins as peripheral inputs */ - REG(IOC_I2CMSSDA) = ioc_input_sel(port_sda, pin_sda); - REG(IOC_I2CMSSCL) = ioc_input_sel(port_scl, pin_scl); - - /* Set pins as peripheral outputs */ - ioc_set_sel(port_sda, pin_sda, IOC_PXX_SEL_I2C_CMSSDA); - ioc_set_sel(port_scl, pin_scl, IOC_PXX_SEL_I2C_CMSSCL); - - /* Enable the I2C master module */ - i2c_master_enable(); - - /* t the master clock frequency */ - i2c_set_frequency(bus_speed); -} -/*---------------------------------------------------------------------------*/ -void -i2c_master_enable(void) -{ - REG(I2CM_CR) |= 0x10; /* Set MFE bit */ -} -/*---------------------------------------------------------------------------*/ -void -i2c_master_disable(void) -{ - REG(I2CM_CR) &= ~0x10; /* Reset MFE bit */ -} -/*---------------------------------------------------------------------------*/ -void -i2c_set_frequency(uint32_t freq) -{ - /* Peripheral clock setting, using the system clock */ - REG(I2CM_TPR) = ((SYS_CTRL_SYS_CLOCK + (2 * 10 * freq) - 1) / - (2 * 10 * freq)) - 1; -} -/*---------------------------------------------------------------------------*/ -void -i2c_master_set_slave_address(uint8_t slave_addr, uint8_t access_mode) -{ - if(access_mode) { - REG(I2CM_SA) = ((slave_addr << 1) | 1); - } else { - REG(I2CM_SA) = (slave_addr << 1); - } -} -/*---------------------------------------------------------------------------*/ -void -i2c_master_data_put(uint8_t data) -{ - REG(I2CM_DR) = data; -} -/*---------------------------------------------------------------------------*/ -uint8_t -i2c_master_data_get(void) -{ - return REG(I2CM_DR); -} -/*---------------------------------------------------------------------------*/ -void -i2c_master_command(uint8_t cmd) -{ - REG(I2CM_CTRL) = cmd; - /* Here we need a delay, otherwise the I2C module keep the receiver mode */ - clock_delay_usec(1); -} -/*---------------------------------------------------------------------------*/ -uint8_t -i2c_master_busy(void) -{ - return REG(I2CM_STAT) & I2CM_STAT_BUSY; -} -/*---------------------------------------------------------------------------*/ -uint8_t -i2c_master_error(void) -{ - uint8_t temp = REG(I2CM_STAT); /* Get all status */ - if(temp & I2CM_STAT_BUSY) { /* No valid if BUSY bit is set */ - return I2C_MASTER_ERR_NONE; - } else if(temp & (I2CM_STAT_ERROR | I2CM_STAT_ARBLST)) { - return temp; /* Compare later */ - } - return I2C_MASTER_ERR_NONE; -} -/*---------------------------------------------------------------------------*/ -uint8_t -i2c_single_send(uint8_t slave_addr, uint8_t data) -{ - i2c_master_set_slave_address(slave_addr, I2C_SEND); - i2c_master_data_put(data); - i2c_master_command(I2C_MASTER_CMD_SINGLE_SEND); - - while(i2c_master_busy()); - - /* Return the STAT register of I2C module if error occured, I2C_MASTER_ERR_NONE otherwise */ - return i2c_master_error(); -} -/*---------------------------------------------------------------------------*/ -uint8_t -i2c_single_receive(uint8_t slave_addr, uint8_t *data) -{ - uint8_t temp; - - i2c_master_set_slave_address(slave_addr, I2C_RECEIVE); - i2c_master_command(I2C_MASTER_CMD_SINGLE_RECEIVE); - - while(i2c_master_busy()); - temp = i2c_master_error(); - if(temp == I2C_MASTER_ERR_NONE) { - *data = i2c_master_data_get(); - } - return temp; -} -/*---------------------------------------------------------------------------*/ -uint8_t -i2c_burst_send(uint8_t slave_addr, uint8_t *data, uint8_t len) -{ - uint8_t sent; - if((len == 0) || (data == NULL)) { - return I2CM_STAT_INVALID; - } - if(len == 1) { - return i2c_single_send(slave_addr, data[0]); - } - i2c_master_set_slave_address(slave_addr, I2C_SEND); - i2c_master_data_put(data[0]); - i2c_master_command(I2C_MASTER_CMD_BURST_SEND_START); - while(i2c_master_busy()); - if(i2c_master_error() == I2C_MASTER_ERR_NONE) { - for(sent = 1; sent <= (len - 2); sent++) { - i2c_master_data_put(data[sent]); - i2c_master_command(I2C_MASTER_CMD_BURST_SEND_CONT); - while(i2c_master_busy()); - } - /* This should be the last byte, stop sending */ - i2c_master_data_put(data[len - 1]); - i2c_master_command(I2C_MASTER_CMD_BURST_SEND_FINISH); - while(i2c_master_busy()); - } - - /* Return the STAT register of I2C module if error occurred, I2C_MASTER_ERR_NONE otherwise */ - return i2c_master_error(); -} -/*---------------------------------------------------------------------------*/ -uint8_t -i2c_burst_receive(uint8_t slave_addr, uint8_t *data, uint8_t len) -{ - uint8_t recv = 0; - if((len == 0) || data == NULL) { - return I2CM_STAT_INVALID; - } - if(len == 1) { - return i2c_single_receive(slave_addr, &data[0]); - } - i2c_master_set_slave_address(slave_addr, I2C_RECEIVE); - i2c_master_command(I2C_MASTER_CMD_BURST_RECEIVE_START); - while(i2c_master_busy()); - if(i2c_master_error() == I2C_MASTER_ERR_NONE) { - data[0] = i2c_master_data_get(); - /* If we got 2 or more bytes pending to be received, keep going*/ - for(recv = 1; recv <= (len - 2); recv++) { - i2c_master_command(I2C_MASTER_CMD_BURST_RECEIVE_CONT); - while(i2c_master_busy()); - data[recv] = i2c_master_data_get(); - } - /* This should be the last byte, stop receiving */ - i2c_master_command(I2C_MASTER_CMD_BURST_RECEIVE_FINISH); - while(i2c_master_busy()); - data[len - 1] = i2c_master_data_get(); - } - return i2c_master_error(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc2538/dev/i2c.h b/arch/cpu/cc2538/dev/i2c.h deleted file mode 100644 index 6ec606167..000000000 --- a/arch/cpu/cc2538/dev/i2c.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2015, Mehdi Migault - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-i2c cc2538 I2C Control - * - * cc2538 I2C Control Module - * @{ - * - * \file - * Header file with declarations for the I2C Control module - * - * \author - * Mehdi Migault - */ -#ifndef I2C_H_ -#define I2C_H_ - -#include "reg.h" -#include "sys-ctrl.h" -#include "gpio.h" -#include "ioc.h" -#include /* For debug */ -#include "clock.h" /* For temporisation */ -/*---------------------------------------------------------------------------*/ -/** \name I2C Master commands - * @{ - */ -#define I2C_MASTER_CMD_SINGLE_SEND 0x00000007 -#define I2C_MASTER_CMD_SINGLE_RECEIVE 0x00000007 -#define I2C_MASTER_CMD_BURST_SEND_START 0x00000003 -#define I2C_MASTER_CMD_BURST_SEND_CONT 0x00000001 -#define I2C_MASTER_CMD_BURST_SEND_FINISH 0x00000005 -#define I2C_MASTER_CMD_BURST_SEND_ERROR_STOP 0x00000004 -#define I2C_MASTER_CMD_BURST_RECEIVE_START 0x0000000b -#define I2C_MASTER_CMD_BURST_RECEIVE_CONT 0x00000009 -#define I2C_MASTER_CMD_BURST_RECEIVE_FINISH 0x00000005 -#define I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP 0x00000004 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name I2C Master status flags - * @{ - */ -#define I2C_MASTER_ERR_NONE 0 -#define I2CM_STAT_BUSY 0x00000001 -#define I2CM_STAT_ERROR 0x00000002 -#define I2CM_STAT_ADRACK 0x00000004 -#define I2CM_STAT_DATACK 0x00000008 -#define I2CM_STAT_ARBLST 0x00000010 -#define I2CM_STAT_IDLE 0x00000020 -#define I2CM_STAT_BUSBSY 0x00000040 -#define I2CM_STAT_INVALID 0x00000080 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name I2C registers - * @{ - */ -#define I2CM_CR 0x40020020 /* I2C master config */ -#define I2CM_TPR 0x4002000C /* I2C master timer period */ -#define I2CM_SA 0x40020000 /* I2C master slave address */ -#define I2CM_DR 0x40020008 /* I2C master data */ -#define I2CM_CTRL 0x40020004 /* Master control in write */ -#define I2CM_STAT I2CM_CTRL /* Master status in read */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name I2C Miscellaneous - * @{ - */ -#define I2C_SCL_NORMAL_BUS_SPEED 100000 /* 100KHz I2C */ -#define I2C_SCL_FAST_BUS_SPEED 400000 /* 400KHz I2C */ -#define I2C_RECEIVE 0x01 /* Master receive */ -#define I2C_SEND 0x00 /* Master send */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name I2C Functions - * @{ - */ - -/** - * \brief Initialize the I2C peripheral and pins - * \param port_sda The GPIO number of the pin used fort SDA - * \param pin_sda The pin number used for SDA - * \param port_scl The GPIO number of the pin used fort SCL - * \param pin_scl The pin number used for SCL - * \param bus_speed The clock frequency used by I2C module - * - * \e bus_speed can take the following values: - * - * - I2C_SCL_NORMAL_BUS_SPEED : 100KHz - * - I2C_SCL_FAST_BUS_SPEED : 400KHz - */ -void i2c_init(uint8_t port_sda, uint8_t pin_sda, uint8_t port_scl, - uint8_t pin_scl, uint32_t bus_speed); - -/** \brief Enable master I2C module */ -void i2c_master_enable(void); - -/** \brief Disable master I2C module */ -void i2c_master_disable(void); - -/** - * \brief Initialize I2C peripheral clock with given frequency - * \param freq The desired frequency - * - * \e freq can take the following values: - * - * - I2C_SCL_NORMAL_BUS_SPEED : 100KHz - * - I2C_SCL_FAST_BUS_SPEED : 400KHz - */ -void i2c_set_frequency(uint32_t freq); - -/** - * \brief Set the address of slave and access mode for the next I2C communication - * \param slave_addr The receiver slave address on 7 bits - * \param access_mode The I2C access mode (send/receive) - * - * \e access_mode can take the following values: - * - * - I2C_RECEIVE : 1 - * - I2C_SEND : 0 - */ -void i2c_master_set_slave_address(uint8_t slave_addr, uint8_t access_mode); - -/** - * \brief Prepare data to be transmitted - * \param data The byte of data to be transmitted from the I2C master - */ -void i2c_master_data_put(uint8_t data); - -/** - * \brief Return received data from I2C - * \return The byte received by I2C after à receive command - */ -uint8_t i2c_master_data_get(void); - -/** - * \brief Control the state of the master module for send and receive operations - * \param cmd The operation to perform - * - * \e cmd can take the following values: - * - * - I2C_MASTER_CMD_SINGLE_SEND - * - I2C_MASTER_CMD_SINGLE_RECEIVE - * - I2C_MASTER_CMD_BURST_SEND_START - * - I2C_MASTER_CMD_BURST_SEND_CONT - * - I2C_MASTER_CMD_BURST_SEND_FINISH - * - I2C_MASTER_CMD_BURST_SEND_ERROR_STOP - * - I2C_MASTER_CMD_BURST_RECEIVE_START - * - I2C_MASTER_CMD_BURST_RECEIVE_CONT - * - I2C_MASTER_CMD_BURST_RECEIVE_FINISH - * - I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP - */ -void i2c_master_command(uint8_t cmd); - -/** - * \brief Return the busy state of I2C module - * \retval 0 The I2C module is not busy - * \retval 1 The I2C module is busy - */ -uint8_t i2c_master_busy(void); - -/** - * \brief Return the status register if error occurred during last communication - * \retval I2C_MASTER_ERR_NONE Return 0 if no error occurred - * - * If an error occurred, return the status register of the I2C module. - * Use the result with the I2CM_STAT_* flags to custom your processing - */ -uint8_t i2c_master_error(void); -/** - * \brief Perform all operations to send a byte to a slave - * \param slave_addr The adress of the slave to which data are sent - * \param data The data to send to the slave - * \return Return the value of i2c_master_error() after the I2C operation - */ -uint8_t i2c_single_send(uint8_t slave_addr, uint8_t data); - -/** - * \brief Perform all operations to receive a byte from a slave - * \param slave_addr The address of the slave from which data are received - * \param data A pointer to store the received data - * \return Return the value of i2c_master_error() after the I2C operation - */ -uint8_t i2c_single_receive(uint8_t slave_addr, uint8_t *data); -/** - * \brief Perform all operations to send multiple bytes to a slave - * \param slave_addr The address of the slave to which data are sent - * \param data A pointer to the data to send to the slave - * \param len Number of bytes to send - * \return Return the value of i2c_master_error() after the I2C operation - */ -uint8_t i2c_burst_send(uint8_t slave_addr, uint8_t *data, uint8_t len); - -/** - * \brief Perform all operations to receive multiple bytes from a slave - * \param slave_addr The address of the slave from which data are received - * \param data A pointer to store the received data - * \param len Number of bytes to receive - * \return Return the value of i2c_master_error() after the I2C operation - */ -uint8_t i2c_burst_receive(uint8_t slave_addr, uint8_t *data, uint8_t len); -/** @} */ - -#endif /* I2C_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/ioc.c b/arch/cpu/cc2538/dev/ioc.c deleted file mode 100644 index 5bb631c46..000000000 --- a/arch/cpu/cc2538/dev/ioc.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-ioc - * @{ - * - * \file - * Implementation of IOC functions - */ -#include "contiki.h" -#include "dev/ioc.h" - -#include - -static uint32_t *ioc_over; -static uint32_t *ioc_sel; -/*---------------------------------------------------------------------------*/ -void -ioc_init() -{ - ioc_over = (uint32_t *)IOC_PA0_OVER; - ioc_sel = (uint32_t *)IOC_PA0_SEL; -} -/*---------------------------------------------------------------------------*/ -void -ioc_set_over(uint8_t port, uint8_t pin, uint8_t over) -{ - ioc_over[(port << 3) + pin] = over; -} -/*---------------------------------------------------------------------------*/ -uint32_t -ioc_get_over(uint8_t port, uint8_t pin) -{ - return ioc_over[(port << 3) + pin] & 0x0F; -} -/*---------------------------------------------------------------------------*/ -void -ioc_set_sel(uint8_t port, uint8_t pin, uint8_t sel) -{ - ioc_sel[(port << 3) + pin] = sel; -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/arch/cpu/cc2538/dev/ioc.h b/arch/cpu/cc2538/dev/ioc.h deleted file mode 100644 index ae14a616f..000000000 --- a/arch/cpu/cc2538/dev/ioc.h +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-ioc cc2538 I/O Control - * - * Driver for the cc2538 I/O Control Module - * @{ - * - * \file - * Header file with declarations for the I/O Control module - */ -#ifndef IOC_H_ -#define IOC_H_ - -#include -/*---------------------------------------------------------------------------*/ -/** \name IOC Signal Select Registers - * @{ - */ -#define IOC_PA0_SEL 0x400D4000 -#define IOC_PA1_SEL 0x400D4004 -#define IOC_PA2_SEL 0x400D4008 -#define IOC_PA3_SEL 0x400D400C -#define IOC_PA4_SEL 0x400D4010 -#define IOC_PA5_SEL 0x400D4014 -#define IOC_PA6_SEL 0x400D4018 -#define IOC_PA7_SEL 0x400D401C -#define IOC_PB0_SEL 0x400D4020 -#define IOC_PB1_SEL 0x400D4024 -#define IOC_PB2_SEL 0x400D4028 -#define IOC_PB3_SEL 0x400D402C -#define IOC_PB4_SEL 0x400D4030 -#define IOC_PB5_SEL 0x400D4034 -#define IOC_PB6_SEL 0x400D4038 -#define IOC_PB7_SEL 0x400D403C -#define IOC_PC0_SEL 0x400D4040 -#define IOC_PC1_SEL 0x400D4044 -#define IOC_PC2_SEL 0x400D4048 -#define IOC_PC3_SEL 0x400D404C -#define IOC_PC4_SEL 0x400D4050 -#define IOC_PC5_SEL 0x400D4054 -#define IOC_PC6_SEL 0x400D4058 -#define IOC_PC7_SEL 0x400D405C -#define IOC_PD0_SEL 0x400D4060 -#define IOC_PD1_SEL 0x400D4064 -#define IOC_PD2_SEL 0x400D4068 -#define IOC_PD3_SEL 0x400D406C -#define IOC_PD4_SEL 0x400D4070 -#define IOC_PD5_SEL 0x400D4074 -#define IOC_PD6_SEL 0x400D4078 -#define IOC_PD7_SEL 0x400D407C -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name IOC Override Configuration Registers - * @{ - */ -#define IOC_PA0_OVER 0x400D4080 -#define IOC_PA1_OVER 0x400D4084 -#define IOC_PA2_OVER 0x400D4088 -#define IOC_PA3_OVER 0x400D408C -#define IOC_PA4_OVER 0x400D4090 -#define IOC_PA5_OVER 0x400D4094 -#define IOC_PA6_OVER 0x400D4098 -#define IOC_PA7_OVER 0x400D409C -#define IOC_PB0_OVER 0x400D40A0 -#define IOC_PB1_OVER 0x400D40A4 -#define IOC_PB2_OVER 0x400D40A8 -#define IOC_PB3_OVER 0x400D40AC -#define IOC_PB4_OVER 0x400D40B0 -#define IOC_PB5_OVER 0x400D40B4 -#define IOC_PB6_OVER 0x400D40B8 -#define IOC_PB7_OVER 0x400D40BC -#define IOC_PC0_OVER 0x400D40C0 -#define IOC_PC1_OVER 0x400D40C4 -#define IOC_PC2_OVER 0x400D40C8 -#define IOC_PC3_OVER 0x400D40CC -#define IOC_PC4_OVER 0x400D40D0 -#define IOC_PC5_OVER 0x400D40D4 -#define IOC_PC6_OVER 0x400D40D8 -#define IOC_PC7_OVER 0x400D40DC -#define IOC_PD0_OVER 0x400D40E0 -#define IOC_PD1_OVER 0x400D40E4 -#define IOC_PD2_OVER 0x400D40E8 -#define IOC_PD3_OVER 0x400D40EC -#define IOC_PD4_OVER 0x400D40F0 -#define IOC_PD5_OVER 0x400D40F4 -#define IOC_PD6_OVER 0x400D40F8 -#define IOC_PD7_OVER 0x400D40FC -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name IOC Input Pin Select Registers - * @{ - */ -#define IOC_UARTRXD_UART0 0x400D4100 /**< UART0 RX */ -#define IOC_UARTCTS_UART1 0x400D4104 /**< UART1 CTS */ -#define IOC_UARTRXD_UART1 0x400D4108 /**< UART1 RX */ -#define IOC_CLK_SSI_SSI0 0x400D410C /**< SSI0 Clock */ -#define IOC_SSIRXD_SSI0 0x400D4110 /**< SSI0 RX */ -#define IOC_SSIFSSIN_SSI0 0x400D4114 /**< SSI0 FSSIN */ -#define IOC_CLK_SSIIN_SSI0 0x400D4118 /**< SSI0 Clock SSIIN */ -#define IOC_CLK_SSI_SSI1 0x400D411C /**< SSI1 Clock */ -#define IOC_SSIRXD_SSI1 0x400D4120 /**< SSI1 RX */ -#define IOC_SSIFSSIN_SSI1 0x400D4124 /**< SSI1 FSSIN Select */ -#define IOC_CLK_SSIIN_SSI1 0x400D4128 /**< SSI1 Clock SSIIN */ -#define IOC_I2CMSSDA 0x400D412C /**< I2C SDA */ -#define IOC_I2CMSSCL 0x400D4130 /**< I2C SCL */ -#define IOC_GPT0OCP1 0x400D4134 /**< GPT0OCP1 */ -#define IOC_GPT0OCP2 0x400D4138 /**< GPT0OCP2 */ -#define IOC_GPT1OCP1 0x400D413C /**< GPT1OCP1 */ -#define IOC_GPT1OCP2 0x400D4140 /**< GPT1OCP2 */ -#define IOC_GPT2OCP1 0x400D4144 /**< GPT2OCP1 */ -#define IOC_GPT2OCP2 0x400D4148 /**< GPT2OCP2 */ -#define IOC_GPT3OCP1 0x400D414C /**< GPT3OCP1 */ -#define IOC_GPT3OCP2 0x400D4150 /**< GPT3OCP2 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name I/O Control Register Bit Masks - * @{ - */ -#define IOC_OVR_MASK 0x0000000F /**< IOC_Pxn_OVER registers */ -#define IOC_PXX_SEL_MASK 0x0000001F /**< IOC_Pxn_SEL registers */ -#define IOC_INPUT_SEL_MASK 0x0000001F /**< All other IOC registers */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name INPUT_SEL Values (For Pin Selection Registers) - * @{ - */ -#define IOC_INPUT_SEL_PA0 0x00000000 -#define IOC_INPUT_SEL_PA1 0x00000001 -#define IOC_INPUT_SEL_PA2 0x00000002 -#define IOC_INPUT_SEL_PA3 0x00000003 -#define IOC_INPUT_SEL_PA4 0x00000004 -#define IOC_INPUT_SEL_PA5 0x00000005 -#define IOC_INPUT_SEL_PA6 0x00000006 -#define IOC_INPUT_SEL_PA7 0x00000007 -#define IOC_INPUT_SEL_PB0 0x00000008 -#define IOC_INPUT_SEL_PB1 0x00000009 -#define IOC_INPUT_SEL_PB2 0x0000000A -#define IOC_INPUT_SEL_PB3 0x0000000B -#define IOC_INPUT_SEL_PB4 0x0000000C -#define IOC_INPUT_SEL_PB5 0x0000000D -#define IOC_INPUT_SEL_PB6 0x0000000E -#define IOC_INPUT_SEL_PB7 0x0000000F -#define IOC_INPUT_SEL_PC0 0x00000010 -#define IOC_INPUT_SEL_PC1 0x00000011 -#define IOC_INPUT_SEL_PC2 0x00000012 -#define IOC_INPUT_SEL_PC3 0x00000013 -#define IOC_INPUT_SEL_PC4 0x00000014 -#define IOC_INPUT_SEL_PC5 0x00000015 -#define IOC_INPUT_SEL_PC6 0x00000016 -#define IOC_INPUT_SEL_PC7 0x00000017 -#define IOC_INPUT_SEL_PD0 0x00000018 -#define IOC_INPUT_SEL_PD1 0x00000019 -#define IOC_INPUT_SEL_PD2 0x0000001A -#define IOC_INPUT_SEL_PD3 0x0000001B -#define IOC_INPUT_SEL_PD4 0x0000001C -#define IOC_INPUT_SEL_PD5 0x0000001D -#define IOC_INPUT_SEL_PD6 0x0000001E -#define IOC_INPUT_SEL_PD7 0x0000001F -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Peripheral Signal Select Values (for IOC_Pxx_SEL registers) - * @{ - */ -#define IOC_PXX_SEL_UART0_TXD 0x00000000 -#define IOC_PXX_SEL_UART1_RTS 0x00000001 -#define IOC_PXX_SEL_UART1_TXD 0x00000002 -#define IOC_PXX_SEL_SSI0_TXD 0x00000003 -#define IOC_PXX_SEL_SSI0_CLKOUT 0x00000004 -#define IOC_PXX_SEL_SSI0_FSSOUT 0x00000005 -#define IOC_PXX_SEL_SSI0_STXSER_EN 0x00000006 -#define IOC_PXX_SEL_SSI1_TXD 0x00000007 -#define IOC_PXX_SEL_SSI1_CLKOUT 0x00000008 -#define IOC_PXX_SEL_SSI1_FSSOUT 0x00000009 -#define IOC_PXX_SEL_SSI1_STXSER_EN 0x0000000A -#define IOC_PXX_SEL_I2C_CMSSDA 0x0000000B -#define IOC_PXX_SEL_I2C_CMSSCL 0x0000000C -#define IOC_PXX_SEL_GPT0_ICP1 0x0000000D -#define IOC_PXX_SEL_GPT0_ICP2 0x0000000E -#define IOC_PXX_SEL_GPT1_ICP1 0x0000000F -#define IOC_PXX_SEL_GPT1_ICP2 0x00000010 -#define IOC_PXX_SEL_GPT2_ICP1 0x00000011 -#define IOC_PXX_SEL_GPT2_ICP2 0x00000012 -#define IOC_PXX_SEL_GPT3_ICP1 0x00000013 -#define IOC_PXX_SEL_GPT3_ICP2 0x00000014 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Values for IOC_PXX_OVER - * @{ - */ -#define IOC_OVERRIDE_OE 0x00000008 /**< Output Enable */ -#define IOC_OVERRIDE_PUE 0x00000004 /**< Pull Up Enable */ -#define IOC_OVERRIDE_PDE 0x00000002 /**< Pull Down Enable */ -#define IOC_OVERRIDE_ANA 0x00000001 /**< Analog Enable */ -#define IOC_OVERRIDE_DIS 0x00000000 /**< Override Disabled */ -/** @} */ - -/*---------------------------------------------------------------------------*/ -/** \name IOC Functions - * @{ - */ -/** \brief Initialise the IOC driver */ -void ioc_init(); - -/** - * \brief Set Port:Pin override function - * \param port The port as a number (PA: 0, PB: 1 etc) - * \param pin The pin as a number - * \param over The desired override configuration - * - * \e over can take the following values: - * - * - IOC_OVERRIDE_OE: Output - * - IOC_OVERRIDE_PUE: Pull-Up - * - IOC_OVERRIDE_PDE: Pull-Down - * - IOC_OVERRIDE_ANA: Analog - * - IOC_OVERRIDE_DIS: Disabled - */ -void ioc_set_over(uint8_t port, uint8_t pin, uint8_t over); - -/** - * \brief Get Port:Pin override function - * \param port The port as a number (PA: 0, PB: 1 etc) - * \param pin The pin as a number - * \return The override function - * - * The return value can be one of - * - * - IOC_OVERRIDE_OE: Output - * - IOC_OVERRIDE_PUE: Pull-Up - * - IOC_OVERRIDE_PDE: Pull-Down - * - IOC_OVERRIDE_ANA: Analog - * - IOC_OVERRIDE_DIS: Disabled - */ -uint32_t ioc_get_over(uint8_t port, uint8_t pin); - -/** - * \brief Function select for Port:Pin - * \param port The port as a number (PA: 0, PB: 1 etc) - * \param pin The pin as a number - * \param sel The desired function - * - * The value of \e sel can be any of the IOC_PXX_SEL_xyz defines. For example - * IOC_PXX_SEL_UART0_TXD will set the port to act as UART0 TX - */ -void ioc_set_sel(uint8_t port, uint8_t pin, uint8_t sel); - -/** - * \brief Generates an IOC_INPUT_SEL_PXn value from a port/pin number - * \param port The port as a number (PA: 0, PB: 1 etc) - * \param pin The pin as a number - * \return A value which can be written in the INPUT_SEL bits of various IOC - * registers - */ -#define ioc_input_sel(port, pin) ((port << 3) | pin) - -/** @} */ -#endif /* IOC_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/nvic.c b/arch/cpu/cc2538/dev/nvic.c deleted file mode 100644 index 5f6a8f02e..000000000 --- a/arch/cpu/cc2538/dev/nvic.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-nvic - * @{ - * - * \file - * Driver for the cc2538 NVIC - * All interrupt-related functionality is implemented here - */ -#include "contiki.h" -#include "dev/nvic.h" -#include "cc2538_cm3.h" -/*---------------------------------------------------------------------------*/ -void -nvic_init() -{ - /* Provide our interrupt table to the NVIC */ - SCB->VTOR = NVIC_VTABLE_ADDRESS; -} -/** @} */ diff --git a/arch/cpu/cc2538/dev/nvic.h b/arch/cpu/cc2538/dev/nvic.h deleted file mode 100644 index 502916117..000000000 --- a/arch/cpu/cc2538/dev/nvic.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-nvic cc2538 Nested Vectored Interrupt Controller - * - * Driver for the cc2538 NVIC controller - * @{ - * - * \file - * Header file for the ARM Nested Vectored Interrupt Controller - */ -#ifndef NVIC_H_ -#define NVIC_H_ - -#include "cc2538_cm3.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \name NVIC Constants and Configuration - * @{ - */ -#ifdef NVIC_CONF_VTABLE_ADDRESS -#define NVIC_VTABLE_ADDRESS NVIC_CONF_VTABLE_ADDRESS -#else -extern void(*const vectors[])(void); -#define NVIC_VTABLE_ADDRESS ((uint32_t)&vectors) -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \brief Initialises the NVIC driver */ -void nvic_init(); - -#endif /* NVIC_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/pka.c b/arch/cpu/cc2538/dev/pka.c deleted file mode 100644 index 62e481dfd..000000000 --- a/arch/cpu/cc2538/dev/pka.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Original file: - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2014 Andreas Dröscher - * - * 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. - */ -/** - * \addtogroup cc2538-pka - * @{ - * - * \file - * Implementation of the cc2538 PKA engine driver - */ -#include "contiki.h" -#include "dev/pka.h" -#include "dev/sys-ctrl.h" -#include "dev/nvic.h" -#include "lpm.h" -#include "reg.h" - -#include -#include - -static volatile struct process *notification_process = NULL; -/*---------------------------------------------------------------------------*/ -/** \brief The PKA engine ISR - * - * This is the interrupt service routine for the PKA engine. - * - * This ISR is called at worst from PM0, so lpm_exit() does not need - * to be called. - */ -void -pka_isr(void) -{ - NVIC_ClearPendingIRQ(PKA_IRQn); - NVIC_DisableIRQ(PKA_IRQn); - - if(notification_process != NULL) { - process_poll((struct process *)notification_process); - notification_process = NULL; - } -} -/*---------------------------------------------------------------------------*/ -static bool -permit_pm1(void) -{ - return (REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) == 0; -} -/*---------------------------------------------------------------------------*/ -void -pka_init(void) -{ - volatile int i; - - lpm_register_peripheral(permit_pm1); - - pka_enable(); - - /* Reset the PKA engine */ - REG(SYS_CTRL_SRSEC) |= SYS_CTRL_SRSEC_PKA; - for(i = 0; i < 16; i++) { - REG(SYS_CTRL_SRSEC) &= ~SYS_CTRL_SRSEC_PKA; - } -} -/*---------------------------------------------------------------------------*/ -void -pka_enable(void) -{ - /* Enable the clock for the PKA engine */ - REG(SYS_CTRL_RCGCSEC) |= SYS_CTRL_RCGCSEC_PKA; - REG(SYS_CTRL_SCGCSEC) |= SYS_CTRL_SCGCSEC_PKA; - REG(SYS_CTRL_DCGCSEC) |= SYS_CTRL_DCGCSEC_PKA; -} -/*---------------------------------------------------------------------------*/ -void -pka_disable(void) -{ - /* Gate the clock for the PKA engine */ - REG(SYS_CTRL_RCGCSEC) &= ~SYS_CTRL_RCGCSEC_PKA; - REG(SYS_CTRL_SCGCSEC) &= ~SYS_CTRL_SCGCSEC_PKA; - REG(SYS_CTRL_DCGCSEC) &= ~SYS_CTRL_DCGCSEC_PKA; -} -/*---------------------------------------------------------------------------*/ -uint8_t -pka_check_status(void) -{ - return (REG(PKA_FUNCTION) & PKA_FUNCTION_RUN) == 0; -} -void -pka_register_process_notification(struct process *p) -{ - notification_process = p; -} -/** @} */ diff --git a/arch/cpu/cc2538/dev/pka.h b/arch/cpu/cc2538/dev/pka.h deleted file mode 100644 index 7a63a3d02..000000000 --- a/arch/cpu/cc2538/dev/pka.h +++ /dev/null @@ -1,871 +0,0 @@ -/* - * Original file: - * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2014 Andreas Dröscher - * - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-pka cc2538 PKA engine - * - * Driver for the cc2538 PKA engine - * @{ - * - * \file - * Header file for the cc2538 PKA engine driver - */ -#ifndef PKA_H_ -#define PKA_H_ - -#include "contiki.h" -#include - -/*---------------------------------------------------------------------------*/ -/** \name PKA memory - * @{ - */ -#define PKA_RAM_BASE 0x44006000 /**< PKA Memory Address */ -#define PKA_RAM_SIZE 0x800 /**< PKA Memory Size */ -#define PKA_MAX_CURVE_SIZE 12 /**< Define for the maximum curve - size supported by the PKA module - in 32 bit word. */ -#define PKA_MAX_LEN 12 /**< Define for the maximum length of - the big number supported by the - PKA module in 32 bit word. */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA register offsets - * @{ - */ -#define PKA_APTR 0x44004000 /**< PKA vector A address During - execution of basic PKCP - operations, this register is - double buffered and can be - written with a new value for the - next operation; when not - written, the value remains - intact. During the execution of - sequencer-controlled complex - operations, this register may - not be written and its value is - undefined at the conclusion of - the operation. The driver - software cannot rely on the - written value to remain intact. */ -#define PKA_BPTR 0x44004004 /**< PKA vector B address During - execution of basic PKCP - operations, this register is - double buffered and can be - written with a new value for the - next operation; when not - written, the value remains - intact. During the execution of - sequencer-controlled complex - operations, this register may - not be written and its value is - undefined at the conclusion of - the operation. The driver - software cannot rely on the - written value to remain intact. */ -#define PKA_CPTR 0x44004008 /**< PKA vector C address During - execution of basic PKCP - operations, this register is - double buffered and can be - written with a new value for the - next operation; when not - written, the value remains - intact. During the execution of - sequencer-controlled complex - operations, this register may - not be written and its value is - undefined at the conclusion of - the operation. The driver - software cannot rely on the - written value to remain intact. */ -#define PKA_DPTR 0x4400400C /**< PKA vector D address During - execution of basic PKCP - operations, this register is - double buffered and can be - written with a new value for the - next operation; when not - written, the value remains - intact. During the execution of - sequencer-controlled complex - operations, this register may - not be written and its value is - undefined at the conclusion of - the operation. The driver - software cannot rely on the - written value to remain intact. */ -#define PKA_ALENGTH 0x44004010 /**< PKA vector A length During - execution of basic PKCP - operations, this register is - double buffered and can be - written with a new value for the - next operation; when not - written, the value remains - intact. During the execution of - sequencer-controlled complex - operations, this register may - not be written and its value is - undefined at the conclusion of - the operation. The driver - software cannot rely on the - written value to remain intact. */ -#define PKA_BLENGTH 0x44004014 /**< PKA vector B length During - execution of basic PKCP - operations, this register is - double buffered and can be - written with a new value for the - next operation; when not - written, the value remains - intact. During the execution of - sequencer-controlled complex - operations, this register may - not be written and its value is - undefined at the conclusion of - the operation. The driver - software cannot rely on the - written value to remain intact. */ -#define PKA_SHIFT 0x44004018 /**< PKA bit shift value For basic - PKCP operations, modifying the - contents of this register is - made impossible while the - operation is being performed. - For the ExpMod-variable and - ExpMod-CRT operations, this - register is used to indicate the - number of odd powers to use - (directly as a value in the - range 1-16). For the ModInv and - ECC operations, this register is - used to hold a completion code. */ -#define PKA_FUNCTION 0x4400401C /**< PKA function This register - contains the control bits to - start basic PKCP as well as - complex sequencer operations. - The run bit can be used to poll - for the completion of the - operation. Modifying bits [11:0] - is made impossible during the - execution of a basic PKCP - operation. During the execution - of sequencer-controlled complex - operations, this register is - modified; the run and stall - result bits are set to zero at - the conclusion, but other bits - are undefined. Attention: - Continuously reading this - register to poll the run bit is - not allowed when executing - complex sequencer operations - (the sequencer cannot access the - PKCP when this is done). Leave - at least one sysclk cycle - between poll operations. */ -#define PKA_COMPARE 0x44004020 /**< PKA compare result This - register provides the result of - a basic PKCP compare operation. - It is updated when the run bit - in the PKA_FUNCTION register is - reset at the end of that - operation. Status after a - complex sequencer operation is - unknown */ -#define PKA_MSW 0x44004024 /**< PKA most-significant-word of - result vector This register - indicates the (word) address in - the PKA RAM where the most - significant nonzero 32-bit word - of the result is stored. Should - be ignored for modulo - operations. For basic PKCP - operations, this register is - updated when the run bit in the - PKA_FUNCTION register is reset - at the end of the operation. For - the complex-sequencer controlled - operations, updating of the - final value matching the actual - result is done near the end of - the operation; note that the - result is only meaningful if no - errors were detected and that - for ECC operations, the PKA_MSW - register will provide - information for the x-coordinate - of the result point only. */ -#define PKA_DIVMSW 0x44004028 /**< PKA most-significant-word of - divide remainder This register - indicates the (32-bit word) - address in the PKA RAM where the - most significant nonzero 32-bit - word of the remainder result for - the basic divide and modulo - operations is stored. Bits [4:0] - are loaded with the bit number - of the most-significant nonzero - bit in the most-significant - nonzero word when MS one control - bit is set. For divide, modulo, - and MS one reporting, this - register is updated when the RUN - bit in the PKA_FUNCTION register - is reset at the end of the - operation. For the complex - sequencer controlled operations, - updating of bits [4:0] of this - register with the - most-significant bit location of - the actual result is done near - the end of the operation. The - result is meaningful only if no - errors were detected and that - for ECC operations; the - PKA_DIVMSW register provides - information for the x-coordinate - of the result point only. */ -#define PKA_SEQ_CTRL 0x440040C8 /**< PKA sequencer control and - status register The sequencer is - interfaced with the outside - world through a single control - and status register. With the - exception of bit [31], the - actual use of bits in the - separate sub-fields of this - register is determined by the - sequencer firmware. This - register need only be accessed - when the sequencer program is - stored in RAM. The reset value - of the RESTE bit depends upon - the option chosen for sequencer - program storage. */ -#define PKA_OPTIONS 0x440040F4 /**< PKA hardware options register - This register provides the host - with a means to determine the - hardware configuration - implemented in this PKA engine, - focused on options that have an - effect on software interacting - with the module. Note: (32 x - (1st LNME nr. of PEs + 1st LNME - FIFO RAM depth - 10)) equals the - maximum modulus vector length - (in bits) that can be handled by - the modular exponentiation and - ECC operations executed on a PKA - engine that includes an LNME. */ -#define PKA_SW_REV 0x440040F8 /**< PKA firmware revision and - capabilities register This - register allows the host access - to the internal firmware - revision number of the PKA - Engine for software driver - matching and diagnostic - purposes. This register also - contains a field that encodes - the capabilities of the embedded - firmware. The PKA_SW_REV - register is written by the - firmware within a few clock - cycles after starting up that - firmware. The hardware reset - value is zero, indicating that - the information has not been - written yet. */ -#define PKA_REVISION 0x440040FC /**< PKA hardware revision register - This register allows the host - access to the hardware revision - number of the PKA engine for - software driver matching and - diagnostic purposes. It is - always located at the highest - address in the access space of - the module and contains an - encoding of the EIP number (with - its complement as signature) for - recognition of the hardware - module. */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_APTR register registers bit fields - * @{ - */ -#define PKA_APTR_APTR_M 0x000007FF /**< This register specifies the - location of vector A within the - PKA RAM. Vectors are identified - through the location of their - least-significant 32-bit word. - Note that bit [0] must be zero - to ensure that the vector starts - at an 8-byte boundary. */ -#define PKA_APTR_APTR_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_BPTR register registers bit fields - * @{ - */ -#define PKA_BPTR_BPTR_M 0x000007FF /**< This register specifies the - location of vector B within the - PKA RAM. Vectors are identified - through the location of their - least-significant 32-bit word. - Note that bit [0] must be zero - to ensure that the vector starts - at an 8-byte boundary. */ -#define PKA_BPTR_BPTR_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_CPTR register registers bit fields - * @{ - */ -#define PKA_CPTR_CPTR_M 0x000007FF /**< This register specifies the - location of vector C within the - PKA RAM. Vectors are identified - through the location of their - least-significant 32-bit word. - Note that bit [0] must be zero - to ensure that the vector starts - at an 8-byte boundary. */ -#define PKA_CPTR_CPTR_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_DPTR register registers bit fields - * @{ - */ -#define PKA_DPTR_DPTR_M 0x000007FF /**< This register specifies the - location of vector D within the - PKA RAM. Vectors are identified - through the location of their - least-significant 32-bit word. - Note that bit [0] must be zero - to ensure that the vector starts - at an 8-byte boundary. */ -#define PKA_DPTR_DPTR_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_ALENGTH register registers bit fields - * @{ - */ -#define PKA_ALENGTH_ALENGTH_M 0x000001FF /**< This register specifies the - length (in 32-bit words) of - Vector A. */ -#define PKA_ALENGTH_ALENGTH_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_BLENGTH register registers bit fields - * @{ - */ -#define PKA_BLENGTH_BLENGTH_M 0x000001FF /**< This register specifies the - length (in 32-bit words) of - Vector B. */ -#define PKA_BLENGTH_BLENGTH_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_SHIFT register registers bit fields - * @{ - */ -#define PKA_SHIFT_NUM_BITS_TO_SHIFT_M \ - 0x0000001F /**< This register specifies the - number of bits to shift the - input vector (in the range 0-31) - during a Rshift or Lshift - operation. */ - -#define PKA_SHIFT_NUM_BITS_TO_SHIFT_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_FUNCTION register registers bit fields - * @{ - */ -#define PKA_FUNCTION_STALL_RESULT \ - 0x01000000 /**< When written with a 1b, - updating of the PKA_COMPARE, - PKA_MSW and PKA_DIVMSW - registers, as well as resetting - the run bit is stalled beyond - the point that a running - operation is actually finished. - Use this to allow software - enough time to read results from - a previous operation when the - newly started operation is known - to take only a short amount of - time. If a result is waiting, - the result registers is updated - and the run bit is reset in the - clock cycle following writing - the stall result bit back to 0b. - The Stall result function may - only be used for basic PKCP - operations. */ - -#define PKA_FUNCTION_STALL_RESULT_M \ - 0x01000000 -#define PKA_FUNCTION_STALL_RESULT_S 24 -#define PKA_FUNCTION_RUN 0x00008000 /**< The host sets this bit to - instruct the PKA module to begin - processing the basic PKCP or - complex sequencer operation. - This bit is reset low - automatically when the operation - is complete. The complement of - this bit is output as - interrupts[1]. After a reset, - the run bit is always set to 1b. - Depending on the option, program - ROM or program RAM, the - following applies: Program ROM - - The first sequencer instruction - sets the bit to 0b. This is done - immediately after the hardware - reset is released. Program RAM - - The sequencer must set the bit - to 0b. As a valid firmware may - not have been loaded, the - sequencer is held in software - reset after the hardware reset - is released (the reset bit in - PKA_SEQ_CRTL is set to 1b). - After the FW image is loaded and - the Reset bit is cleared, the - sequencer starts to execute the - FW. The first instruction clears - the run bit. In both cases a few - clock cycles are needed before - the first instruction is - executed and the run bit state - has been propagated. */ -#define PKA_FUNCTION_RUN_M 0x00008000 -#define PKA_FUNCTION_RUN_S 15 -#define PKA_FUNCTION_SEQUENCER_OPERATIONS_M \ - 0x00007000 /**< These bits select the complex - sequencer operation to perform: - 000b: None 001b: ExpMod-CRT - 010b: ExpMod-ACT4 (compatible - with EIP2315) 011b: ECC-ADD (if - available in firmware, otherwise - reserved) 100b: ExpMod-ACT2 - (compatible with EIP2316) 101b: - ECC-MUL (if available in - firmware, otherwise reserved) - 110b: ExpMod-variable 111b: - ModInv (if available in - firmware, otherwise reserved) - The encoding of these operations - is determined by sequencer - firmware. */ - -#define PKA_FUNCTION_SEQUENCER_OPERATIONS_S 12 -#define PKA_FUNCTION_COPY 0x00000800 /**< Perform copy operation */ -#define PKA_FUNCTION_COPY_M 0x00000800 -#define PKA_FUNCTION_COPY_S 11 -#define PKA_FUNCTION_COMPARE 0x00000400 /**< Perform compare operation */ -#define PKA_FUNCTION_COMPARE_M 0x00000400 -#define PKA_FUNCTION_COMPARE_S 10 -#define PKA_FUNCTION_MODULO 0x00000200 /**< Perform modulo operation */ -#define PKA_FUNCTION_MODULO_M 0x00000200 -#define PKA_FUNCTION_MODULO_S 9 -#define PKA_FUNCTION_DIVIDE 0x00000100 /**< Perform divide operation */ -#define PKA_FUNCTION_DIVIDE_M 0x00000100 -#define PKA_FUNCTION_DIVIDE_S 8 -#define PKA_FUNCTION_LSHIFT 0x00000080 /**< Perform left shift operation */ -#define PKA_FUNCTION_LSHIFT_M 0x00000080 -#define PKA_FUNCTION_LSHIFT_S 7 -#define PKA_FUNCTION_RSHIFT 0x00000040 /**< Perform right shift operation */ -#define PKA_FUNCTION_RSHIFT_M 0x00000040 -#define PKA_FUNCTION_RSHIFT_S 6 -#define PKA_FUNCTION_SUBTRACT 0x00000020 /**< Perform subtract operation */ -#define PKA_FUNCTION_SUBTRACT_M 0x00000020 -#define PKA_FUNCTION_SUBTRACT_S 5 -#define PKA_FUNCTION_ADD 0x00000010 /**< Perform add operation */ -#define PKA_FUNCTION_ADD_M 0x00000010 -#define PKA_FUNCTION_ADD_S 4 -#define PKA_FUNCTION_MS_ONE 0x00000008 /**< Loads the location of the Most - Significant one bit within the - result word indicated in the - PKA_MSW register into bits [4:0] - of the PKA_DIVMSW register - can - only be used with basic PKCP - operations, except for Divide, - Modulo and Compare. */ -#define PKA_FUNCTION_MS_ONE_M 0x00000008 -#define PKA_FUNCTION_MS_ONE_S 3 -#define PKA_FUNCTION_ADDSUB 0x00000002 /**< Perform combined add/subtract - operation */ -#define PKA_FUNCTION_ADDSUB_M 0x00000002 -#define PKA_FUNCTION_ADDSUB_S 1 -#define PKA_FUNCTION_MULTIPLY 0x00000001 /**< Perform multiply operation */ -#define PKA_FUNCTION_MULTIPLY_M 0x00000001 -#define PKA_FUNCTION_MULTIPLY_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_COMPARE register registers bit fields - * @{ - */ -#define PKA_COMPARE_A_GREATER_THAN_B \ - 0x00000004 /**< Vector_A is greater than - Vector_B */ - -#define PKA_COMPARE_A_GREATER_THAN_B_M \ - 0x00000004 -#define PKA_COMPARE_A_GREATER_THAN_B_S 2 -#define PKA_COMPARE_A_LESS_THAN_B \ - 0x00000002 /**< Vector_A is less than Vector_B */ - -#define PKA_COMPARE_A_LESS_THAN_B_M \ - 0x00000002 -#define PKA_COMPARE_A_LESS_THAN_B_S 1 -#define PKA_COMPARE_A_EQUALS_B 0x00000001 /**< Vector_A is equal to Vector_B */ -#define PKA_COMPARE_A_EQUALS_B_M \ - 0x00000001 -#define PKA_COMPARE_A_EQUALS_B_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_MSW register registers bit fields - * @{ - */ -#define PKA_MSW_RESULT_IS_ZERO 0x00008000 /**< The result vector is all - zeroes, ignore the address - returned in bits [10:0] */ -#define PKA_MSW_RESULT_IS_ZERO_M \ - 0x00008000 -#define PKA_MSW_RESULT_IS_ZERO_S 15 -#define PKA_MSW_MSW_ADDRESS_M 0x000007FF /**< Address of the most-significant - nonzero 32-bit word of the - result vector in PKA RAM */ -#define PKA_MSW_MSW_ADDRESS_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_DIVMSW register registers bit fields - * @{ - */ -#define PKA_DIVMSW_RESULT_IS_ZERO \ - 0x00008000 /**< The result vector is all - zeroes, ignore the address - returned in bits [10:0] */ - -#define PKA_DIVMSW_RESULT_IS_ZERO_M \ - 0x00008000 -#define PKA_DIVMSW_RESULT_IS_ZERO_S 15 -#define PKA_DIVMSW_MSW_ADDRESS_M \ - 0x000007FF /**< Address of the most significant - nonzero 32-bit word of the - remainder result vector in PKA - RAM */ - -#define PKA_DIVMSW_MSW_ADDRESS_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_SEQ_CTRL register registers bit fields - * @{ - */ -#define PKA_SEQ_CTRL_RESET 0x80000000 /**< Option program ROM: Reset value - = 0. Read/Write, reset value 0b - (ZERO). Writing 1b resets the - sequencer, write to 0b to - restart operations again. As the - reset value is 0b, the sequencer - will automatically start - operations executing from - program ROM. This bit should - always be written with zero and - ignored when reading this - register. Option Program RAM: - Reset value =1. Read/Write, - reset value 1b (ONE). When 1b, - the sequencer is held in a reset - state and the PKA_PROGRAM area - is accessible for loading the - sequencer program (while the - PKA_DATA_RAM is inaccessible), - write to 0b to (re)start - sequencer operations and disable - PKA_PROGRAM area accessibility - (also enables the PKA_DATA_RAM - accesses). Resetting the - sequencer (in order to load - other firmware) should only be - done when the PKA Engine is not - performing any operations (i.e. - the run bit in the PKA_FUNCTION - register should be zero). */ -#define PKA_SEQ_CTRL_RESET_M 0x80000000 -#define PKA_SEQ_CTRL_RESET_S 31 -#define PKA_SEQ_CTRL_SEQUENCER_STATUS_M \ - 0x0000FF00 /**< These read-only bits can be - used by the sequencer to - communicate status to the - outside world. Bit [8] is also - used as sequencer interrupt, - with the complement of this bit - ORed into the run bit in - PKA_FUNCTION. This field should - always be written with zeroes - and ignored when reading this - register. */ - -#define PKA_SEQ_CTRL_SEQUENCER_STATUS_S 8 -#define PKA_SEQ_CTRL_SW_CONTROL_STATUS_M \ - 0x000000FF /**< These bits can be used by - software to trigger sequencer - operations. External logic can - set these bits by writing 1b, - cannot reset them by writing 0b. - The sequencer can reset these - bits by writing 0b, cannot set - them by writing 1b. Setting the - run bit in PKA_FUNCTION together - with a nonzero sequencer - operations field automatically - sets bit [0] here. This field - should always be written with - zeroes and ignored when reading - this register. */ - -#define PKA_SEQ_CTRL_SW_CONTROL_STATUS_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_OPTIONS register registers bit fields - * @{ - */ -#define PKA_OPTIONS_FIRST_LNME_FIFO_DEPTH_M \ - 0xFF000000 /**< Number of words in the first - LNME's FIFO RAM Should be - ignored if LNME configuration is - 0. The contents of this field - indicate the actual depth as - selected by the LNME FIFO RAM - size strap input, fifo_size_sel. - Note: Reset value is undefined */ - -#define PKA_OPTIONS_FIRST_LNME_FIFO_DEPTH_S 24 -#define PKA_OPTIONS_FIRST_LNME_NR_OF_PES_M \ - 0x003F0000 /**< Number of processing elements - in the pipeline of the first - LNME Should be ignored if LNME - configuration is 0. Note: Reset - value is undefined. */ - -#define PKA_OPTIONS_FIRST_LNME_NR_OF_PES_S 16 -#define PKA_OPTIONS_MMM3A 0x00001000 /**< Reserved for a future - functional extension to the LNME - Always 0b */ -#define PKA_OPTIONS_MMM3A_M 0x00001000 -#define PKA_OPTIONS_MMM3A_S 12 -#define PKA_OPTIONS_INT_MASKING 0x00000800 /**< Value 0b indicates that the - main interrupt output (bit [1] - of the interrupts output bus) is - the direct complement of the run - bit in the PKA_CONTROL register, - value 1b indicates that - interrupt masking logic is - present for this output. Note: - Reset value is undefined */ -#define PKA_OPTIONS_INT_MASKING_M \ - 0x00000800 -#define PKA_OPTIONS_INT_MASKING_S 11 -#define PKA_OPTIONS_PROTECTION_OPTION_M \ - 0x00000700 /**< Value 0 indicates no additional - protection against side channel - attacks, value 1 indicates the - SCAP option, value 3 indicates - the PROT option; other values - are reserved. Note: Reset value - is undefined */ - -#define PKA_OPTIONS_PROTECTION_OPTION_S 8 -#define PKA_OPTIONS_PROGRAM_RAM 0x00000080 /**< Value 1b indicates sequencer - program storage in RAM, value 0b - in ROM. Note: Reset value is - undefined */ -#define PKA_OPTIONS_PROGRAM_RAM_M \ - 0x00000080 -#define PKA_OPTIONS_PROGRAM_RAM_S 7 -#define PKA_OPTIONS_SEQUENCER_CONFIGURATION_M \ - 0x00000060 /**< Value 1 indicates a standard - sequencer; other values are - reserved. */ - -#define PKA_OPTIONS_SEQUENCER_CONFIGURATION_S 5 -#define PKA_OPTIONS_LNME_CONFIGURATION_M \ - 0x0000001C /**< Value 0 indicates NO LNME, - value 1 indicates one standard - LNME (with alpha = 32, beta = - 8); other values reserved. Note: - Reset value is undefined */ - -#define PKA_OPTIONS_LNME_CONFIGURATION_S 2 -#define PKA_OPTIONS_PKCP_CONFIGURATION_M \ - 0x00000003 /**< Value 1 indicates a PKCP with a - 16x16 multiplier, value 2 - indicates a PKCP with a 32x32 - multiplier, other values - reserved. Note: Reset value is - undefined. */ - -#define PKA_OPTIONS_PKCP_CONFIGURATION_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_SW_REV register registers bit fields - * @{ - */ -#define PKA_SW_REV_FW_CAPABILITIES_M \ - 0xF0000000 /**< 4-bit binary encoding for the - functionality implemented in the - firmware. Value 0 indicates - basic ModExp with/without CRT. - Value 1 adds Modular Inversion, - value 2 adds Modular Inversion - and ECC operations. Values 3-15 - are reserved. */ - -#define PKA_SW_REV_FW_CAPABILITIES_S 28 -#define PKA_SW_REV_MAJOR_FW_REVISION_M \ - 0x0F000000 /**< 4-bit binary encoding of the - major firmware revision number */ - -#define PKA_SW_REV_MAJOR_FW_REVISION_S 24 -#define PKA_SW_REV_MINOR_FW_REVISION_M \ - 0x00F00000 /**< 4-bit binary encoding of the - minor firmware revision number */ - -#define PKA_SW_REV_MINOR_FW_REVISION_S 20 -#define PKA_SW_REV_FW_PATCH_LEVEL_M \ - 0x000F0000 /**< 4-bit binary encoding of the - firmware patch level, initial - release will carry value zero - Patches are used to remove bugs - without changing the - functionality or interface of a - module. */ - -#define PKA_SW_REV_FW_PATCH_LEVEL_S 16 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA_REVISION register registers bit fields - * @{ - */ -#define PKA_REVISION_MAJOR_HW_REVISION_M \ - 0x0F000000 /**< 4-bit binary encoding of the - major hardware revision number */ - -#define PKA_REVISION_MAJOR_HW_REVISION_S 24 -#define PKA_REVISION_MINOR_HW_REVISION_M \ - 0x00F00000 /**< 4-bit binary encoding of the - minor hardware revision number */ - -#define PKA_REVISION_MINOR_HW_REVISION_S 20 -#define PKA_REVISION_HW_PATCH_LEVEL_M \ - 0x000F0000 /**< 4-bit binary encoding of the - hardware patch level, initial - release will carry value zero - Patches are used to remove bugs - without changing the - functionality or interface of a - module. */ - -#define PKA_REVISION_HW_PATCH_LEVEL_S 16 -#define PKA_REVISION_COMPLEMENT_OF_BASIC_EIP_NUMBER_M \ - 0x0000FF00 /**< Bit-by-bit logic complement of - bits [7:0], EIP-28 gives 0xE3 */ - -#define PKA_REVISION_COMPLEMENT_OF_BASIC_EIP_NUMBER_S 8 -#define PKA_REVISION_BASIC_EIP_NUMBER_M \ - 0x000000FF /**< 8-bit binary encoding of the - EIP number, EIP-28 gives 0x1C */ - -#define PKA_REVISION_BASIC_EIP_NUMBER_S 0 - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA driver return codes - * @{ - */ -#define PKA_STATUS_SUCCESS 0 /**< Success */ -#define PKA_STATUS_FAILURE 1 /**< Failure */ -#define PKA_STATUS_INVALID_PARAM 2 /**< Invalid parameter */ -#define PKA_STATUS_BUF_UNDERFLOW 3 /**< Buffer underflow */ -#define PKA_STATUS_RESULT_0 4 /**< Result is all zeros */ -#define PKA_STATUS_A_GR_B 5 /**< Big number compare return status if - the first big num is greater than - the second. */ -#define PKA_STATUS_A_LT_B 6 /**< Big number compare return status if - the first big num is less than the - second. */ -#define PKA_STATUS_OPERATION_INPRG 7 /**< PKA operation is in progress. */ -#define PKA_STATUS_OPERATION_NOT_INPRG 8 /**< No PKA operation is in progress. */ -#define PKA_STATUS_SIGNATURE_INVALID 9 /**< Signature is invalid. */ - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PKA functions - * @{ - */ - -/** \brief Enables and resets the PKA engine - */ -void pka_init(void); - -/** \brief Enables the PKA engine - */ -void pka_enable(void); - -/** \brief Disables the PKA engine - * \note Call this function to save power when the engine is unused. - */ -void pka_disable(void); - -/** \brief Checks the status of the PKA engine operation - * \retval false Result not yet available, and no error occurred - * \retval true Result available, or error occurred - */ -uint8_t pka_check_status(void); - -/** \brief Registers a process to be notified of the completion of a PKA - * operation - * \param p Process to be polled upon IRQ - * \note This function is only supposed to be called by the PKA drivers. - */ -void pka_register_process_notification(struct process *p); - -/** @} */ - -#endif /* PKA_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/pwm.c b/arch/cpu/cc2538/dev/pwm.c deleted file mode 100644 index 73440013b..000000000 --- a/arch/cpu/cc2538/dev/pwm.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538-pwm-driver - * @{ - * - * \file - * Driver for the CC2538 PWM - * - * \author - * Javier Sanchez - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/ioc.h" -#include "dev/gpio.h" -#include "dev/sys-ctrl.h" -#include "dev/pwm.h" -#include "lpm.h" -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define PWM_GPTIMER_NUM_TO_BASE(x) ((GPT_0_BASE) + ((x) << 12)) -/*---------------------------------------------------------------------------*/ -static uint8_t -pwm_configured(uint8_t timer, uint8_t ab) -{ - uint8_t offset; - uint32_t gpt_base; - gpt_base = PWM_GPTIMER_NUM_TO_BASE(timer); - offset = (ab) ? 4 : 0; - - if((REG(gpt_base + GPTIMER_TAMR + offset) & GPTIMER_TAMR_TAAMS) && - (REG(gpt_base + GPTIMER_TAMR + offset) & GPTIMER_TAMR_TAMR_PERIODIC)) { - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static bool -permit_pm1(void) -{ - uint8_t timer, ab; - - for(timer = PWM_TIMER_0; timer <= PWM_TIMER_3; timer++) - for(ab = PWM_TIMER_A; ab <= PWM_TIMER_B; ab++) - if(pwm_configured(timer, ab) && - REG(PWM_GPTIMER_NUM_TO_BASE(timer) + GPTIMER_CTL) & - (ab == PWM_TIMER_A ? GPTIMER_CTL_TAEN : GPTIMER_CTL_TBEN)) - return false; - - return true; -} -/*---------------------------------------------------------------------------*/ -int8_t -pwm_enable(uint32_t freq, uint8_t duty, uint32_t count, uint8_t timer, - uint8_t ab) -{ - uint8_t offset = 0; - uint32_t interval_load, duty_count, copy; - uint32_t gpt_base, gpt_en, gpt_dir; - - if((freq < PWM_FREQ_MIN) || (freq > PWM_FREQ_MAX) || - (duty < PWM_DUTY_MIN) || (duty > PWM_DUTY_MAX) || - (timer > PWM_TIMER_MAX) || (timer < PWM_TIMER_MIN)) { - PRINTF("PWM: Invalid PWM settings\n"); - return PWM_ERROR; - } - - /* GPT0 timer A is used for clock_delay_usec() in clock.c */ - if((ab == PWM_TIMER_A) && (timer == PWM_TIMER_0)) { - PRINTF("PWM: GPT0 (timer A) is reserved for clock_delay_usec()\n"); - return PWM_ERROR; - } - - PRINTF("PWM: F%08luHz: %u%%/%lu on GPT%u-%u\n", freq, duty, count, timer, ab); - - lpm_register_peripheral(permit_pm1); - - gpt_base = PWM_GPTIMER_NUM_TO_BASE(timer); - gpt_en = GPTIMER_CTL_TAEN; - gpt_dir = GPTIMER_CTL_TAPWML; - - if(ab == PWM_TIMER_B) { - offset = 4; - gpt_en = GPTIMER_CTL_TBEN; - gpt_dir = GPTIMER_CTL_TBPWML; - } - - PRINTF("PWM: GPT_x_BASE 0x%08lX (%u)\n", gpt_base, offset); - - /* Restore later, ensure GPTIMER_CTL_TxEN and GPTIMER_CTL_TxPWML are clear */ - copy = REG(gpt_base + GPTIMER_CTL); - copy &= ~(gpt_en | gpt_dir); - - /* Enable module clock for the GPTx in Active mode */ - REG(SYS_CTRL_RCGCGPT) |= (SYS_CTRL_RCGCGPT_GPT0 << timer); - /* Enable module clock for the GPTx in Sleep mode */ - REG(SYS_CTRL_SCGCGPT) |= (SYS_CTRL_SCGCGPT_GPT0 << timer); - /* Enable module clock for the GPTx in PM0, in PM1 and below this doesn't matter */ - REG(SYS_CTRL_DCGCGPT) |= (SYS_CTRL_DCGCGPT_GPT0 << timer); - - /* Stop the timer */ - REG(gpt_base + GPTIMER_CTL) = 0; - /* Use 16-bit timer */ - REG(gpt_base + GPTIMER_CFG) = PWM_GPTIMER_CFG_SPLIT_MODE; - /* Configure PWM mode */ - REG(gpt_base + GPTIMER_TAMR + offset) = 0; - REG(gpt_base + GPTIMER_TAMR + offset) |= GPTIMER_TAMR_TAAMS; - REG(gpt_base + GPTIMER_TAMR + offset) |= GPTIMER_TAMR_TAMR_PERIODIC; - - /* If the duty cycle is zero, leave the GPTIMER configured as PWM to pass a next - * configured check, but do nothing else */ - if((!duty) && (!count)) { - REG(gpt_base + GPTIMER_CTL) |= (copy | gpt_dir); - return PWM_SUCCESS; - } - - /* Get the peripheral clock and equivalent deassert count, depending on the - * value given by the user, either use the count number of the duty cycle in - * percentage - */ - interval_load = sys_ctrl_get_sys_clock() / freq; - if(duty) { - duty_count = ((interval_load * duty) + 1) / 100; - } else { - duty_count = count; - } - - PRINTF("PWM: sys %luHz: %lu %lu\n", sys_ctrl_get_sys_clock(), - interval_load, duty_count); - - /* Set the start value (period), count down */ - REG(gpt_base + GPTIMER_TAILR + offset) = ((uint16_t *)&interval_load)[0] - 1; - /* Set the deassert period */ - REG(gpt_base + GPTIMER_TAMATCHR + offset) = ((uint16_t *)&duty_count)[0] - 1; - /* Set the prescaler if required */ - REG(gpt_base + GPTIMER_TAPR + offset) = ((uint8_t *)&interval_load)[2]; - /* Set the prescaler match if required */ - REG(gpt_base + GPTIMER_TAPMR + offset) = ((uint8_t *)&duty_count)[2]; - /* Restore the register content */ - REG(gpt_base + GPTIMER_CTL) |= (copy | gpt_dir); - - PRINTF("PWM: TnILR %lu ", REG(gpt_base + (GPTIMER_TAILR + offset))); - PRINTF("TnMATCHR %lu ", REG(gpt_base + (GPTIMER_TAMATCHR + offset))); - PRINTF("TnPR %lu ", REG(gpt_base + (GPTIMER_TAPR + offset))); - PRINTF("TnPMR %lu\n", REG(gpt_base + (GPTIMER_TAPMR + offset))); - - return PWM_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int8_t -pwm_stop(uint8_t timer, uint8_t ab, uint8_t port, uint8_t pin, uint8_t state) -{ - uint32_t gpt_base, gpt_dis; - - if((ab > PWM_TIMER_B) || (timer < PWM_TIMER_MIN) || - (timer > PWM_TIMER_MAX)) { - PRINTF("PWM: Invalid PWM values\n"); - return PWM_ERROR; - } - - if(!pwm_configured(timer, ab)) { - PRINTF("PWM: GPTn not configured as PWM\n"); - return PWM_ERROR; - } - - /* CC2538 has 4 ports (A-D) and up to 8 pins (0-7) */ - if((port > GPIO_D_NUM) || (pin > 7)) { - PRINTF("PWM: Invalid pin/port settings\n"); - return PWM_ERROR; - } - - /* CC2538 has 4 ports (A-D) and up to 8 pins (0-7) */ - if((state != PWM_OFF_WHEN_STOP) && (state != PWM_ON_WHEN_STOP)) { - PRINTF("PWM: Invalid pin state when PWM is halt\n"); - return PWM_ERROR; - } - - gpt_base = PWM_GPTIMER_NUM_TO_BASE(timer); - gpt_dis = (ab == PWM_TIMER_B) ? GPTIMER_CTL_TBEN : GPTIMER_CTL_TAEN; - REG(gpt_base + GPTIMER_CTL) &= ~gpt_dis; - - /* Configure the port/pin as GPIO, input */ - ioc_set_over(port, pin, IOC_OVERRIDE_DIS); - GPIO_SOFTWARE_CONTROL(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - GPIO_SET_OUTPUT(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - if(state) { - GPIO_SET_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - } else { - GPIO_CLR_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - } - PRINTF("PWM: OFF -> Timer %u (%u)\n", timer, ab); - return PWM_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int8_t -pwm_start(uint8_t timer, uint8_t ab, uint8_t port, uint8_t pin) -{ - uint32_t gpt_base, gpt_en, gpt_sel; - - if((ab > PWM_TIMER_B) || (timer < PWM_TIMER_MIN) || - (timer > PWM_TIMER_MAX)) { - PRINTF("PWM: Invalid PWM values\n"); - return PWM_ERROR; - } - - if(!pwm_configured(timer, ab)) { - PRINTF("PWM: GPTn not configured as PWM\n"); - return PWM_ERROR; - } - - /* CC2538 has 4 ports (A-D) and up to 8 pins (0-7) */ - if((port > GPIO_D_NUM) || (pin > 7)) { - PRINTF("PWM: Invalid pin/port settings\n"); - return PWM_ERROR; - } - - /* Map to given port/pin */ - gpt_sel = IOC_PXX_SEL_GPT0_ICP1 + (timer * 2); - if(ab == PWM_TIMER_B) { - gpt_sel++; - } - ioc_set_sel(port, pin, gpt_sel); - ioc_set_over(port, pin, IOC_OVERRIDE_OE); - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - - gpt_base = PWM_GPTIMER_NUM_TO_BASE(timer); - gpt_en = (ab == PWM_TIMER_B) ? GPTIMER_CTL_TBEN : GPTIMER_CTL_TAEN; - REG(gpt_base + GPTIMER_CTL) |= gpt_en; - PRINTF("PWM: ON -> Timer %u (%u) IOC_PXX_SEL_GPTx_IPCx 0x%08lX\n", timer, ab, - gpt_sel); - return PWM_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int8_t -pwm_set_direction(uint8_t timer, uint8_t ab, uint8_t dir) -{ - uint32_t gpt_base, gpt_dir; - - if((ab > PWM_TIMER_B) || (timer < PWM_TIMER_MIN) || - (timer > PWM_TIMER_MAX) || (dir > PWM_SIGNAL_INVERTED)) { - PRINTF("PWM: Invalid PWM values\n"); - return PWM_ERROR; - } - - if(!pwm_configured(timer, ab)) { - PRINTF("PWM: GPTn not configured as PWM\n"); - return PWM_ERROR; - } - - gpt_base = PWM_GPTIMER_NUM_TO_BASE(timer); - gpt_dir = (ab == PWM_TIMER_B) ? GPTIMER_CTL_TBPWML : GPTIMER_CTL_TAPWML; - if(dir) { - REG(gpt_base + GPTIMER_CTL) |= gpt_dir; - } else { - REG(gpt_base + GPTIMER_CTL) &= ~gpt_dir; - } - - PRINTF("PWM: Signal direction (%u) -> Timer %u (%u)\n", dir, timer, ab); - return PWM_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int8_t -pwm_toggle_direction(uint8_t timer, uint8_t ab) -{ - uint32_t gpt_base, gpt_dir; - - if((ab > PWM_TIMER_B) || (timer < PWM_TIMER_MIN) || - (timer > PWM_TIMER_MAX)) { - PRINTF("PWM: Invalid PWM values\n"); - return PWM_ERROR; - } - - if(!pwm_configured(timer, ab)) { - PRINTF("PWM: GPTn not configured as PWM\n"); - return PWM_ERROR; - } - - gpt_base = PWM_GPTIMER_NUM_TO_BASE(timer); - gpt_dir = (ab == PWM_TIMER_B) ? GPTIMER_CTL_TBPWML : GPTIMER_CTL_TAPWML; - if(REG(gpt_base + GPTIMER_CTL) & gpt_dir) { - REG(gpt_base + GPTIMER_CTL) &= ~gpt_dir; - } else { - REG(gpt_base + GPTIMER_CTL) |= gpt_dir; - } - - PRINTF("PWM: direction toggled -> Timer %u (%u)\n", timer, ab); - return PWM_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int8_t -pwm_disable(uint8_t timer, uint8_t ab, uint8_t port, uint8_t pin) -{ - uint32_t gpt_base; - uint8_t offset = (ab == PWM_TIMER_B) ? 4 : 0; - gpt_base = PWM_GPTIMER_NUM_TO_BASE(timer); - - if((ab > PWM_TIMER_B) || (timer < PWM_TIMER_MIN) || - (timer > PWM_TIMER_MAX)) { - PRINTF("PWM: Invalid PWM values\n"); - return PWM_ERROR; - } - - /* CC2538 has 4 ports (A-D) and up to 8 pins (0-7) */ - if((port > GPIO_D_NUM) || (pin > 7)) { - PRINTF("PWM: Invalid pin/port settings\n"); - return PWM_ERROR; - } - - if(!pwm_configured(timer, ab)) { - PRINTF("PWM: GPTn not configured as PWM\n"); - return PWM_ERROR; - } - - /* Stop the PWM */ - pwm_stop(timer, ab, port, pin, PWM_OFF_WHEN_STOP); - /* Disable the PWM mode */ - REG(gpt_base + (GPTIMER_TAMR + offset)) = 0; - /* Restart the interval load and deassert values */ - REG(gpt_base + (GPTIMER_TAILR + offset)) = 0; - REG(gpt_base + (GPTIMER_TAMATCHR + offset)) = 0; - - /* Configure the port/pin as GPIO, input */ - ioc_set_over(port, pin, IOC_OVERRIDE_DIS); - GPIO_SOFTWARE_CONTROL(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - GPIO_SET_INPUT(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - - return PWM_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc2538/dev/pwm.h b/arch/cpu/cc2538/dev/pwm.h deleted file mode 100644 index 294ec3559..000000000 --- a/arch/cpu/cc2538/dev/pwm.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-pwm-driver CC2538 PWM driver - * - * Driver for the CC2538 PWM on GPTIMER - * - * The driver uses the timers A and B of the general purpose timers to create - * a PWM signal, allowing to set a duty cycle value from 1-100%. This - * implementation relies on having a peripheral clock of 16MHz, but it can be - * easily changed (see PWM_FREQ_MIN and PWM_FREQ_MAX values). The reason it is - * fixed to these frequencies is to have a consistent duty cycle - * implementation. - * - * Depending on the specific needs these limits can be changed to meet a given - * duty cycle and lower frequencies by using the prescaler (GPTIMER_TnPR). - * - * Running a PWM timer prevents the LPM driver from dropping to PM1+. - * - * @{ - * - * \file - * Header file for the CC2538 PWM driver - * - * \author - * Javier Sanchez - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#ifndef PWM_H_ -#define PWM_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/ioc.h" -#include "dev/gpio.h" -#include "dev/sys-ctrl.h" -/*---------------------------------------------------------------------------*/ -/** \name PWM return values - * @{ - */ -#define PWM_SUCCESS 0 -#define PWM_ERROR (-1) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PWM recommended values respect to peripheral clock frequency - * @{ - */ -/* Roughly 244 Hz with a 16-MHz system clock, no prescaler */ -#define PWM_SYS_16MHZ_NO_PRES_MIN 0xFFFF -#define PWM_SYS_16MHZ_NO_PRES_MIN_FREQ 244 -/* Roughly 1 Hz with a 16-MHz system clock, to keep frequency parameter in Hz */ -#define PWM_SYS_16MHZ_PRES_MIN 0x00F42400 -#define PWM_SYS_16MHZ_PRES_MIN_FREQ 1 -/* Yields 160 KHz at 16 MHz and allows down to 1% (integer) duty cycles */ -#define PWM_SYS_16MHZ_NO_PRES_MAX 100 -#define PWM_SYS_16MHZ_NO_PRES_MAX_FREQ 160000 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PWM driver definitions and configuration values - * @{ - */ -#define PWM_TIMER_A 0 -#define PWM_TIMER_B 1 -#define PWM_TIMER_0 0 -#define PWM_TIMER_1 1 -#define PWM_TIMER_2 2 -#define PWM_TIMER_3 3 -#define PWM_TIMER_MIN PWM_TIMER_0 -#define PWM_TIMER_MAX PWM_TIMER_3 -#define PWM_SIGNAL_STRAIGHT 1 -#define PWM_SIGNAL_INVERTED 0 -#define PWM_OFF_WHEN_STOP 0 -#define PWM_ON_WHEN_STOP 1 -#define PWM_GPTIMER_CFG_SPLIT_MODE 0x04 -#define PWM_DUTY_MAX 100 -#define PWM_DUTY_MIN 0 -#define PWM_FREQ_MIN PWM_SYS_16MHZ_PRES_MIN_FREQ -#define PWM_FREQ_MAX PWM_SYS_16MHZ_NO_PRES_MAX_FREQ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name PWM functions - * @{ - */ -/** \brief Configures the general purpose timer in PWM mode - * \param freq PWM frequency (in Hz) - * \param duty PWM duty cycle (percentage in integers) - * \param count PWM duty cycle (count number) - * \param timer General purpose timer to use [0-3] - * \param ab Select which timer to use (Timer A or B) - * \return \c PWM_SUCCESS if successful, else \c PWM_ERROR - */ -int8_t pwm_enable(uint32_t freq, uint8_t duty, uint32_t count, uint8_t timer, - uint8_t ab); -/*---------------------------------------------------------------------------*/ -/** \brief Disables a previously PWM configured GPTn - * \param timer General purpose timer to disable [0-3] - * \param ab Select which timer to disable (Timer A or B) - * \param port Port number used as PWM to disable (set as input GPIO) - * \param pin Pin number used as PWM to disable (set as input GPIO) - * \return \c PWM_SUCCESS if successful, else \c PWM_ERROR - * - * This function disables a specific timer (A or B) and reset related registers - * to default values. The user must explicitely pass the port/pin number of - * the pin to disable as PWM and to be configured as input GPIO. - * The module clock is not disabled with this function - */ -int8_t pwm_disable(uint8_t timer, uint8_t ab, uint8_t port, uint8_t pin); -/*---------------------------------------------------------------------------*/ -/** \brief Once configured, starts the PWM - * \param timer General purpose timer to start [0-3] - * \param ab Select which timer to start (Timer A or B) - * \param port Port number to use as PWM - * \param pin Pin number to use as PWM - * \return \c PWM_SUCCESS if successful, else \c PWM_ERROR - */ -int8_t pwm_start(uint8_t timer, uint8_t ab, uint8_t port, uint8_t pin); -/*---------------------------------------------------------------------------*/ -/** \brief Halts the PWM in a given GPT/timer - * \param timer General purpose timer to stop [0-3] - * \param ab Select which timer to stop (Timer A or B) - * \param port Port of the gpio port mapped to the PWM to stop - * \param pin Pin of the gpio port mapped to the PWM to stop - * \param state State to leave the pin once stopped, on (1) or off (0) - * \return \c PWM_SUCCESS if successful, else \c PWM_ERROR - */ -int8_t pwm_stop(uint8_t timer, uint8_t ab, uint8_t port, uint8_t pin, uint8_t state); -/*---------------------------------------------------------------------------*/ -/** \brief Sets the PWM duty cycle signal direction (high/low) - * \param timer General purpose timer [0-3] - * \param ab Select which timer to use (Timer A or B) - * \param dir Direction of the PWM signal, \c PWM_SIGNAL_INVERTED or - * \c PWM_SIGNAL_STRAIGHT - * \return \c PWM_SUCCESS if successful, else \c PWM_ERROR - */ -int8_t pwm_set_direction(uint8_t timer, uint8_t ab, uint8_t dir); -/*---------------------------------------------------------------------------*/ -/** \brief Toggle the PWM signal direction (inverts the current duty cycle) - * \param timer General purpose timer to use [0-3] - * \param ab Select which timer to use (Timer A or B) - * \return \c PWM_SUCCESS if successful, else \c PWM_ERROR - */ -int8_t pwm_toggle_direction(uint8_t timer, uint8_t ab); -/*---------------------------------------------------------------------------*/ -/** @} */ -#endif /* PWM_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/random.c b/arch/cpu/cc2538/dev/random.c deleted file mode 100644 index 2c8b1923c..000000000 --- a/arch/cpu/cc2538/dev/random.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-random cc2538 Random Number Generator - * - * Driver for the cc2538 Hardware Random Number Generator - * @{ - * - * \file - * Random number generator routines exploiting the cc2538 hardware - * capabilities. - * - * This file overrides os/lib/random.c. - */ -#include "contiki.h" -#include "dev/rfcore.h" -#include "dev/cc2538-rf.h" -#include "dev/soc-adc.h" -#include "dev/sys-ctrl.h" -#include "reg.h" -/*---------------------------------------------------------------------------*/ -/** - * \brief Generates a new random number using the cc2538 RNG. - * \return The random number. - */ -unsigned short -random_rand(void) -{ - uint32_t rv; - - /* Clock the RNG LSFR once */ - REG(SOC_ADC_ADCCON1) |= SOC_ADC_ADCCON1_RCTRL0; - - rv = REG(SOC_ADC_RNDL) | (REG(SOC_ADC_RNDH) << 8); - return ((unsigned short)rv); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Seed the cc2538 random number generator. - * \param seed Ignored. It's here because the function prototype is in core. - * - * We form a seed for the RNG by sampling IF_ADC as - * discussed in the user guide. - * Seeding with this method should not be done during - * normal radio operation. Thus, use this function before - * initialising the network. - * - * \note Must not be called after the RF driver has been initialised and is - * in normal operation. If it is absolutely necessary to do so, the - * radio will need re-initialised. - */ -void -random_init(unsigned short seed) -{ - int i; - unsigned short s = 0; - - /* Make sure the RNG is on */ - REG(SOC_ADC_ADCCON1) &= ~(SOC_ADC_ADCCON1_RCTRL1 | SOC_ADC_ADCCON1_RCTRL0); - - /* Enable clock for the RF Core */ - REG(SYS_CTRL_RCGCRFC) = 1; - - /* Wait for the clock ungating to take effect */ - while(REG(SYS_CTRL_RCGCRFC) != 1); - - /* Infinite RX - FRMCTRL0[3:2] = 10 - * This will mess with radio operation - see note above */ - REG(RFCORE_XREG_FRMCTRL0) = 0x00000008; - - /* Turn RF on */ - CC2538_RF_CSP_ISRXON(); - - /* - * Wait until "the chip has been in RX long enough for the transients to - * have died out. A convenient way to do this is to wait for the RSSI-valid - * signal to go high." - */ - while(!(REG(RFCORE_XREG_RSSISTAT) & RFCORE_XREG_RSSISTAT_RSSI_VALID)); - - /* - * Form the seed by concatenating bits from IF_ADC in the RF receive path. - * Keep sampling until we have read at least 16 bits AND the seed is valid - * - * Invalid seeds are 0x0000 and 0x8003 and should not be used. - */ - while(s == 0x0000 || s == 0x8003) { - for(i = 0; i < 16; i++) { - s |= (REG(RFCORE_XREG_RFRND) & RFCORE_XREG_RFRND_IRND); - s <<= 1; - } - } - - /* High byte first */ - REG(SOC_ADC_RNDL) = (s >> 8) & 0x00FF; - REG(SOC_ADC_RNDL) = s & 0xFF; - - /* RF Off. NETSTACK_RADIO.init() will sort out normal RF operation */ - CC2538_RF_CSP_ISRFOFF(); -} - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/rfcore-ffsm.h b/arch/cpu/cc2538/dev/rfcore-ffsm.h deleted file mode 100644 index 25ade123b..000000000 --- a/arch/cpu/cc2538/dev/rfcore-ffsm.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-rfcore - * @{ - * - * \file - * Header with declarations of the RF Core FFSM registers. - */ -#ifndef RFCORE_FFSM_H_ -#define RFCORE_FFSM_H_ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_FFSM register offsets - * @{ - */ -#define RFCORE_FFSM_SRCRESMASK0 0x40088580 /**< Src addr matching result */ -#define RFCORE_FFSM_SRCRESMASK1 0x40088584 /**< Src addr matching result */ -#define RFCORE_FFSM_SRCRESMASK2 0x40088588 /**< Src addr matching result */ -#define RFCORE_FFSM_SRCRESINDEX 0x4008858C /**< Src addr matching result */ -#define RFCORE_FFSM_SRCEXTPENDEN0 0x40088590 /**< Src addr matching control */ -#define RFCORE_FFSM_SRCEXTPENDEN1 0x40088594 /**< Src addr matching control */ -#define RFCORE_FFSM_SRCEXTPENDEN2 0x40088598 /**< Src addr matching control */ -#define RFCORE_FFSM_SRCSHORTPENDEN0 0x4008859C /**< Src addr matching control */ -#define RFCORE_FFSM_SRCSHORTPENDEN1 0x400885A0 /**< Src addr matching control */ -#define RFCORE_FFSM_SRCSHORTPENDEN2 0x400885A4 /**< Src addr matching control */ -#define RFCORE_FFSM_EXT_ADDR0 0x400885A8 /**< Local address information */ -#define RFCORE_FFSM_EXT_ADDR1 0x400885AC /**< Local address information */ -#define RFCORE_FFSM_EXT_ADDR2 0x400885B0 /**< Local address information */ -#define RFCORE_FFSM_EXT_ADDR3 0x400885B4 /**< Local address information */ -#define RFCORE_FFSM_EXT_ADDR4 0x400885B8 /**< Local address information */ -#define RFCORE_FFSM_EXT_ADDR5 0x400885BC /**< Local address information */ -#define RFCORE_FFSM_EXT_ADDR6 0x400885C0 /**< Local address information */ -#define RFCORE_FFSM_EXT_ADDR7 0x400885C4 /**< Local address information */ -#define RFCORE_FFSM_PAN_ID0 0x400885C8 /**< Local address information */ -#define RFCORE_FFSM_PAN_ID1 0x400885CC /**< Local address information */ -#define RFCORE_FFSM_SHORT_ADDR0 0x400885D0 /**< Local address information */ -#define RFCORE_FFSM_SHORT_ADDR1 0x400885D4 /**< Local address information */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_FFSM_SRCRESMASK[0:2] register bit masks - * @{ - */ -#define RFCORE_FFSM_SRCRESMASK0_SRCRESMASK0 0x000000FF /**< Ext addr match */ -#define RFCORE_FFSM_SRCRESMASK1_SRCRESMASK1 0x000000FF /**< Short addr match */ -#define RFCORE_FFSM_SRCRESMASK2_SRCRESMASK2 0x000000FF /**< 24-bit mask */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_FFSM_SRCRESINDEX register bit masks - * @{ - */ -#define RFCORE_FFSM_SRCRESINDEX_SRCRESINDEX 0x000000FF /**< LS Entry bit index */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_FFSM_SRCEXTPENDEN[0:2] register bit masks - * @{ - */ -#define RFCORE_FFSM_SRCEXTPENDEN0_SRCEXTPENDEN0 0x000000FF /**< 8 LSBs */ -#define RFCORE_FFSM_SRCEXTPENDEN1_SRCEXTPENDEN1 0x000000FF /**< 8 middle bits */ -#define RFCORE_FFSM_SRCEXTPENDEN2_SRCEXTPENDEN2 0x000000FF /**< 8 MSBs */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_FFSM_SRCSHORTPENDEN[0:2] register bit masks - * @{ - */ -#define RFCORE_FFSM_SRCSHORTPENDEN0_SRCSHORTPENDEN0 0x000000FF /**< 8 LSBs */ -#define RFCORE_FFSM_SRCSHORTPENDEN1_SRCSHORTPENDEN1 0x000000FF /**< 8 middle */ -#define RFCORE_FFSM_SRCSHORTPENDEN2_SRCSHORTPENDEN2 0x000000FF /**< 8 MSBs */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_FFSM_EXT_ADDR[0:7] register bit masks - * @{ - */ -#define RFCORE_FFSM_EXT_ADDR0_EXT_ADDR0 0x000000FF /**< EXT_ADDR[7:0] */ -#define RFCORE_FFSM_EXT_ADDR1_EXT_ADDR1 0x000000FF /**< EXT_ADDR[15:8] */ -#define RFCORE_FFSM_EXT_ADDR2_EXT_ADDR2 0x000000FF /**< EXT_ADDR[23:16] */ -#define RFCORE_FFSM_EXT_ADDR3_EXT_ADDR3 0x000000FF /**< EXT_ADDR[31:24] */ -#define RFCORE_FFSM_EXT_ADDR4_EXT_ADDR4 0x000000FF /**< EXT_ADDR[39:32] */ -#define RFCORE_FFSM_EXT_ADDR5_EXT_ADDR5 0x000000FF /**< EXT_ADDR[47:40] */ -#define RFCORE_FFSM_EXT_ADDR6_EXT_ADDR6 0x000000FF /**< EXT_ADDR[55:48] */ -#define RFCORE_FFSM_EXT_ADDR7_EXT_ADDR7 0x000000FF /**< EXT_ADDR[63:56] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_FFSM_PAN_ID[0:1] register bit masks - * @{ - */ -#define RFCORE_FFSM_PAN_ID0_PAN_ID0 0x000000FF /**< PAN_ID[7:0] */ -#define RFCORE_FFSM_PAN_ID1_PAN_ID1 0x000000FF /**< PAN_ID[15:8] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_FFSM_SHORT_ADDR[0:1] register bit masks - * @{ - */ -#define RFCORE_FFSM_SHORT_ADDR0_SHORT_ADDR0 0x000000FF /**< SHORT_ADDR[7:0] */ -#define RFCORE_FFSM_SHORT_ADDR1_SHORT_ADDR1 0x000000FF /**< SHORT_ADDR[15:8] */ -/** @} */ - -#endif /* RFCORE_FFSM_H_ */ -/** @} */ diff --git a/arch/cpu/cc2538/dev/rfcore-sfr.h b/arch/cpu/cc2538/dev/rfcore-sfr.h deleted file mode 100644 index 8199d8346..000000000 --- a/arch/cpu/cc2538/dev/rfcore-sfr.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-rfcore - * @{ - * - * \file - * Header with declarations of the RF Core SFR registers. Includes - * declarations of MAC timer registers. - */ -#ifndef RFCORE_SFR_H_ -#define RFCORE_SFR_H_ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR register offsets (MAC Timer) - * @{ - */ -#define RFCORE_SFR_MTCSPCFG 0x40088800 /**< MAC Timer event configuration */ -#define RFCORE_SFR_MTCTRL 0x40088804 /**< MAC Timer control register */ -#define RFCORE_SFR_MTIRQM 0x40088808 /**< MAC Timer interrupt mask */ -#define RFCORE_SFR_MTIRQF 0x4008880C /**< MAC Timer interrupt flags */ -#define RFCORE_SFR_MTMSEL 0x40088810 /**< MAC Timer multiplex select */ -#define RFCORE_SFR_MTM0 0x40088814 /**< MAC Timer MUX register 0 */ -#define RFCORE_SFR_MTM1 0x40088818 /**< MAC Timer MUX register 1 */ -#define RFCORE_SFR_MTMOVF2 0x4008881C /**< MAC Timer MUX overflow 2 */ -#define RFCORE_SFR_MTMOVF1 0x40088820 /**< MAC Timer MUX overflow 1 */ -#define RFCORE_SFR_MTMOVF0 0x40088824 /**< MAC Timer MUX overflow 0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR register offsets (RF) - * @{ - */ -#define RFCORE_SFR_RFDATA 0x40088828 /**< TX/RX FIFO data */ -#define RFCORE_SFR_RFERRF 0x4008882C /**< RF error interrupt flags */ -#define RFCORE_SFR_RFIRQF1 0x40088830 /**< RF interrupt flags */ -#define RFCORE_SFR_RFIRQF0 0x40088834 /**< RF interrupt flags */ -#define RFCORE_SFR_RFST 0x40088838 /**< RF CSMA-CA/strobe processor */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_MTCSPCFG register bit masks - * @{ - */ -#define RFCORE_SFR_MTCSPCFG_MACTIMER_EVENMT_CFG 0x00000070 /**< MT_EVENT2 pulse event trigger */ -#define RFCORE_SFR_MTCSPCFG_MACTIMER_EVENT1_CFG 0x00000007 /**< MT_EVENT1 pulse event trigger */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_MTCTRL register bit masks - * @{ - */ -#define RFCORE_SFR_MTCTRL_LATCH_MODE 0x00000008 /**< OVF counter latch mode */ -#define RFCORE_SFR_MTCTRL_STATE 0x00000004 /**< State of MAC Timer */ -#define RFCORE_SFR_MTCTRL_SYNC 0x00000002 /**< Timer start/stop timing */ -#define RFCORE_SFR_MTCTRL_RUN 0x00000001 /**< Timer start/stop */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_MTIRQM register bit masks - * @{ - */ -#define RFCORE_SFR_MTIRQM_MACTIMER_OVF_COMPARE2M 0x00000020 /**< MACTIMER_OVF_COMPARE2 mask */ -#define RFCORE_SFR_MTIRQM_MACTIMER_OVF_COMPARE1M 0x00000010 /**< MACTIMER_OVF_COMPARE1 mask */ -#define RFCORE_SFR_MTIRQM_MACTIMER_OVF_PERM 0x00000008 /**< MACTIMER_OVF_PER mask */ -#define RFCORE_SFR_MTIRQM_MACTIMER_COMPARE2M 0x00000004 /**< MACTIMER_COMPARE2 mask */ -#define RFCORE_SFR_MTIRQM_MACTIMER_COMPARE1M 0x00000002 /**< MACTIMER_COMPARE1 mask */ -#define RFCORE_SFR_MTIRQM_MACTIMER_PERM 0x00000001 /**< MACTIMER_PER mask */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_MTIRQF register bit masks - * @{ - */ -#define RFCORE_SFR_MTIRQF_MACTIMER_OVF_COMPARE2F 0x00000020 /**< MACTIMER_OVF_COMPARE2 flag */ -#define RFCORE_SFR_MTIRQF_MACTIMER_OVF_COMPARE1F 0x00000010 /**< MACTIMER_OVF_COMPARE1 flag */ -#define RFCORE_SFR_MTIRQF_MACTIMER_OVF_PERF 0x00000008 /**< MACTIMER_OVF_PER flag */ -#define RFCORE_SFR_MTIRQF_MACTIMER_COMPARE2F 0x00000004 /**< MACTIMER_COMPARE2 flag */ -#define RFCORE_SFR_MTIRQF_MACTIMER_COMPARE1F 0x00000002 /**< MACTIMER_COMPARE1 flag */ -#define RFCORE_SFR_MTIRQF_MACTIMER_PERF 0x00000001 /**< MACTIMER_PER flag */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_MTMSEL register bit masks - * @{ - */ -#define RFCORE_SFR_MTMSEL_MTMOVFSEL 0x00000070 /**< MTMOVF register select */ -#define RFCORE_SFR_MTMSEL_MTMSEL 0x00000007 /**< MTM register select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_MTM[0:2] register bit masks - * @{ - */ -#define RFCORE_SFR_MTM0_MTM0 0x000000FF /**< Register[7:0] */ -#define RFCORE_SFR_MTM1_MTM1 0x000000FF /**< Register[15:8] */ -#define RFCORE_SFR_MTMOVF2_MTMOVF2 0x000000FF /**< Register[23:16] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_MTMOVF[1:0] register bit masks - * @{ - */ -#define RFCORE_SFR_MTMOVF1_MTMOVF1 0x000000FF /**< Register[15:8] */ -#define RFCORE_SFR_MTMOVF0_MTMOVF0 0x000000FF /**< Register[7:0] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_RFDATA register bit masks - * @{ - */ -#define RFCORE_SFR_RFDATA_RFD 0x000000FF /**< Read/Write Data from RF FIFO */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_RFERRF register bit masks - * @{ - */ -#define RFCORE_SFR_RFERRF_STROBEERR 0x00000040 /**< Strobe error */ -#define RFCORE_SFR_RFERRF_TXUNDERF 0x00000020 /**< TX FIFO underflowed */ -#define RFCORE_SFR_RFERRF_TXOVERF 0x00000010 /**< TX FIFO overflowed */ -#define RFCORE_SFR_RFERRF_RXUNDERF 0x00000008 /**< RX FIFO underflowed */ -#define RFCORE_SFR_RFERRF_RXOVERF 0x00000004 /**< RX FIFO overflowed */ -#define RFCORE_SFR_RFERRF_RXABO 0x00000002 /**< Frame RX was aborted */ -#define RFCORE_SFR_RFERRF_NLOCK 0x00000001 /**< Frequency synthesizer lock error */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_RFIRQF1 register bit masks - * @{ - */ -#define RFCORE_SFR_RFIRQF1_CSP_WAIT 0x00000020 /**< CSP Execution continued */ -#define RFCORE_SFR_RFIRQF1_CSP_STOP 0x00000010 /**< CSP has stopped program */ -#define RFCORE_SFR_RFIRQF1_CSP_MANINT 0x00000008 /**< CSP Manual interrupt */ -#define RFCORE_SFR_RFIRQF1_RFIDLE 0x00000004 /**< IDLE state entered */ -#define RFCORE_SFR_RFIRQF1_TXDONE 0x00000002 /**< Complete frame TX finished */ -#define RFCORE_SFR_RFIRQF1_TXACKDONE 0x00000001 /**< ACK frame TX finished */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_RFIRQF0 register bit masks - * @{ - */ -#define RFCORE_SFR_RFIRQF0_RXMASKZERO 0x00000080 /**< RXENABLE gone all-zero */ -#define RFCORE_SFR_RFIRQF0_RXPKTDONE 0x00000040 /**< Complete frame RX */ -#define RFCORE_SFR_RFIRQF0_FRAME_ACCEPTED 0x00000020 /**< Frame has passed frame filter */ -#define RFCORE_SFR_RFIRQF0_SRC_MATCH_FOUND 0x00000010 /**< Source match is found */ -#define RFCORE_SFR_RFIRQF0_SRC_MATCH_DONE 0x00000008 /**< Source matching is complete */ -#define RFCORE_SFR_RFIRQF0_FIFOP 0x00000004 /**< RX FIFO exceeded threshold */ -#define RFCORE_SFR_RFIRQF0_SFD 0x00000002 /**< SFD TX or RX */ -#define RFCORE_SFR_RFIRQF0_ACT_UNUSED 0x00000001 /**< Reserved */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_SFR_RFST register bit masks - * @{ - */ -#define RFCORE_SFR_RFST_INSTR 0x000000FF /**< Data written to this register */ -/** @} */ - -#endif /* RFCORE_SFR_H_ */ -/** @} */ diff --git a/arch/cpu/cc2538/dev/rfcore-xreg.h b/arch/cpu/cc2538/dev/rfcore-xreg.h deleted file mode 100644 index 7dc9ee815..000000000 --- a/arch/cpu/cc2538/dev/rfcore-xreg.h +++ /dev/null @@ -1,673 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-rfcore - * @{ - * - * \file - * Header with declarations of the RF Core XREGs. - */ -#ifndef RFCORE_XREG_H_ -#define RFCORE_XREG_H_ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_FFSM register offsets - * @{ - */ -#define RFCORE_XREG_FRMFILT0 0x40088600 /**< Frame filtering control */ -#define RFCORE_XREG_FRMFILT1 0x40088604 /**< Frame filtering control */ -#define RFCORE_XREG_SRCMATCH 0x40088608 /**< Source address matching */ -#define RFCORE_XREG_SRCSHORTEN0 0x4008860C /**< Short address matching */ -#define RFCORE_XREG_SRCSHORTEN1 0x40088610 /**< Short address matching */ -#define RFCORE_XREG_SRCSHORTEN2 0x40088614 /**< Short address matching */ -#define RFCORE_XREG_SRCEXTEN0 0x40088618 /**< Extended address matching */ -#define RFCORE_XREG_SRCEXTEN1 0x4008861C /**< Extended address matching */ -#define RFCORE_XREG_SRCEXTEN2 0x40088620 /**< Extended address matching */ -#define RFCORE_XREG_FRMCTRL0 0x40088624 /**< Frame handling */ -#define RFCORE_XREG_FRMCTRL1 0x40088628 /**< Frame handling */ -#define RFCORE_XREG_RXENABLE 0x4008862C /**< RX enabling */ -#define RFCORE_XREG_RXMASKSET 0x40088630 /**< RX enabling */ -#define RFCORE_XREG_RXMASKCLR 0x40088634 /**< RX disabling */ -#define RFCORE_XREG_FREQTUNE 0x40088638 /**< Crystal oscillator freq tuning */ -#define RFCORE_XREG_FREQCTRL 0x4008863C /**< Controls the RF frequency */ -#define RFCORE_XREG_TXPOWER 0x40088640 /**< Controls the output power */ -#define RFCORE_XREG_TXCTRL 0x40088644 /**< Controls the TX settings */ -#define RFCORE_XREG_FSMSTAT0 0x40088648 /**< Radio status register */ -#define RFCORE_XREG_FSMSTAT1 0x4008864C /**< Radio status register */ -#define RFCORE_XREG_FIFOPCTRL 0x40088650 /**< FIFOP threshold */ -#define RFCORE_XREG_FSMCTRL 0x40088654 /**< FSM options */ -#define RFCORE_XREG_CCACTRL0 0x40088658 /**< CCA threshold */ -#define RFCORE_XREG_CCACTRL1 0x4008865C /**< Other CCA Options */ -#define RFCORE_XREG_RSSI 0x40088660 /**< RSSI status register */ -#define RFCORE_XREG_RSSISTAT 0x40088664 /**< RSSI valid status register */ -#define RFCORE_XREG_RXFIRST 0x40088668 /**< First byte in RX FIFO */ -#define RFCORE_XREG_RXFIFOCNT 0x4008866C /**< Number of bytes in RX FIFO */ -#define RFCORE_XREG_TXFIFOCNT 0x40088670 /**< Number of bytes in TX FIFO */ -#define RFCORE_XREG_RXFIRST_PTR 0x40088674 /**< RX FIFO pointer */ -#define RFCORE_XREG_RXLAST_PTR 0x40088678 /**< RX FIFO pointer */ -#define RFCORE_XREG_RXP1_PTR 0x4008867C /**< RX FIFO pointer */ -#define RFCORE_XREG_RXP2_PTR 0x40088680 /**< RX FIFO pointer */ -#define RFCORE_XREG_TXFIRST_PTR 0x40088684 /**< TX FIFO pointer */ -#define RFCORE_XREG_TXLAST_PTR 0x40088688 /**< TX FIFO pointer */ -#define RFCORE_XREG_RFIRQM0 0x4008868C /**< RF interrupt masks */ -#define RFCORE_XREG_RFIRQM1 0x40088690 /**< RF interrupt masks */ -#define RFCORE_XREG_RFERRM 0x40088694 /**< RF error interrupt mask */ -#define RFCORE_XREG_D18_SPARE_OPAMPMC 0x40088698 /**< Operational amp mode ctrl */ -#define RFCORE_XREG_RFRND 0x4008869C /**< Random data */ -#define RFCORE_XREG_MDMCTRL0 0x400886A0 /**< Controls modem */ -#define RFCORE_XREG_MDMCTRL1 0x400886A4 /**< Controls modem */ -#define RFCORE_XREG_FREQEST 0x400886A8 /**< Estimated RF frequency offset */ -#define RFCORE_XREG_RXCTRL 0x400886AC /**< Tune receive section */ -#define RFCORE_XREG_FSCTRL 0x400886B0 /**< Tune frequency synthesizer */ -#define RFCORE_XREG_FSCAL1 0x400886B8 /**< Tune frequency calibration */ -#define RFCORE_XREG_FSCAL2 0x400886BC /**< Tune frequency calibration */ -#define RFCORE_XREG_FSCAL3 0x400886C0 /**< Tune frequency calibration */ -#define RFCORE_XREG_AGCCTRL0 0x400886C4 /**< AGC dynamic range control */ -#define RFCORE_XREG_AGCCTRL1 0x400886C8 /**< AGC reference level */ -#define RFCORE_XREG_AGCCTRL2 0x400886CC /**< AGC gain override */ -#define RFCORE_XREG_AGCCTRL3 0x400886D0 /**< AGC control */ -#define RFCORE_XREG_ADCTEST0 0x400886D4 /**< ADC tuning */ -#define RFCORE_XREG_ADCTEST1 0x400886D8 /**< ADC tuning */ -#define RFCORE_XREG_ADCTEST2 0x400886DC /**< ADC tuning */ -#define RFCORE_XREG_MDMTEST0 0x400886E0 /**< Test register for modem */ -#define RFCORE_XREG_MDMTEST1 0x400886E4 /**< Test Register for Modem */ -#define RFCORE_XREG_DACTEST0 0x400886E8 /**< DAC override value */ -#define RFCORE_XREG_DACTEST1 0x400886EC /**< DAC override value */ -#define RFCORE_XREG_DACTEST2 0x400886F0 /**< DAC test setting */ -#define RFCORE_XREG_ATEST 0x400886F4 /**< Analog test control */ -#define RFCORE_XREG_PTEST0 0x400886F8 /**< Override power-down register */ -#define RFCORE_XREG_PTEST1 0x400886FC /**< Override power-down register */ -#define RFCORE_XREG_CSPPROG0 0x40088700 /**< CSP program */ -#define RFCORE_XREG_CSPPROG1 0x40088704 /**< CSP program */ -#define RFCORE_XREG_CSPPROG2 0x40088708 /**< CSP program */ -#define RFCORE_XREG_CSPPROG3 0x4008870C /**< CSP program */ -#define RFCORE_XREG_CSPPROG4 0x40088710 /**< CSP program */ -#define RFCORE_XREG_CSPPROG5 0x40088714 /**< CSP program */ -#define RFCORE_XREG_CSPPROG6 0x40088718 /**< CSP program */ -#define RFCORE_XREG_CSPPROG7 0x4008871C /**< CSP program */ -#define RFCORE_XREG_CSPPROG8 0x40088720 /**< CSP program */ -#define RFCORE_XREG_CSPPROG9 0x40088724 /**< CSP program */ -#define RFCORE_XREG_CSPPROG10 0x40088728 /**< CSP program */ -#define RFCORE_XREG_CSPPROG11 0x4008872C /**< CSP program */ -#define RFCORE_XREG_CSPPROG12 0x40088730 /**< CSP program */ -#define RFCORE_XREG_CSPPROG13 0x40088734 /**< CSP program */ -#define RFCORE_XREG_CSPPROG14 0x40088738 /**< CSP program */ -#define RFCORE_XREG_CSPPROG15 0x4008873C /**< CSP program */ -#define RFCORE_XREG_CSPPROG16 0x40088740 /**< CSP program */ -#define RFCORE_XREG_CSPPROG17 0x40088744 /**< CSP program */ -#define RFCORE_XREG_CSPPROG18 0x40088748 /**< CSP program */ -#define RFCORE_XREG_CSPPROG19 0x4008874C /**< CSP program */ -#define RFCORE_XREG_CSPPROG20 0x40088750 /**< CSP program */ -#define RFCORE_XREG_CSPPROG21 0x40088754 /**< CSP program */ -#define RFCORE_XREG_CSPPROG22 0x40088758 /**< CSP program */ -#define RFCORE_XREG_CSPPROG23 0x4008875C /**< CSP program */ -#define RFCORE_XREG_CSPCTRL 0x40088780 /**< CSP control bit */ -#define RFCORE_XREG_CSPSTAT 0x40088784 /**< CSP status register */ -#define RFCORE_XREG_CSPX 0x40088788 /**< CSP X data register */ -#define RFCORE_XREG_CSPY 0x4008878C /**< CSP Y data register */ -#define RFCORE_XREG_CSPZ 0x40088790 /**< CSP Z data register */ -#define RFCORE_XREG_CSPT 0x40088794 /**< CSP T data register */ -#define RFCORE_XREG_RFC_DUTY_CYCLE 0x400887A0 /**< RX duty cycle control */ -#define RFCORE_XREG_RFC_OBS_CTRL0 0x400887AC /**< RF observation mux control */ -#define RFCORE_XREG_RFC_OBS_CTRL1 0x400887B0 /**< RF observation mux control */ -#define RFCORE_XREG_RFC_OBS_CTRL2 0x400887B4 /**< RF observation mux control */ -#define RFCORE_XREG_TXFILTCFG 0x400887E8 /**< TX filter configuration */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FRMFILT0 register offsets - * @{ - */ -#define RFCORE_XREG_FRMFILT0_MAX_FRAME_VERSION 0x0000000C /**< Frame version filtering */ -#define RFCORE_XREG_FRMFILT0_PAN_COORDINATOR 0x00000002 /**< PAN coordinator */ -#define RFCORE_XREG_FRMFILT0_FRAME_FILTER_EN 0x00000001 /**< Enables frame filtering */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FRMFILT1 register offsets - * @{ - */ -#define RFCORE_XREG_FRMFILT1_ACCEPT_FT_3_MAC_CMD 0x00000040 /**< MAC command frame filt */ -#define RFCORE_XREG_FRMFILT1_ACCEPT_FT_2_ACK 0x00000020 /**< ack frame filt */ -#define RFCORE_XREG_FRMFILT1_ACCEPT_FT_1_DATA 0x00000010 /**< data frame filt */ -#define RFCORE_XREG_FRMFILT1_ACCEPT_FT_0_BEACON 0x00000008 /**< beacon frame filt */ -#define RFCORE_XREG_FRMFILT1_MODIFY_FT_FILTER 0x00000006 /**< Frame type modify */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_SRCMATCH register bit masks - * @{ - */ -#define RFCORE_XREG_SRCMATCH_PEND_DATAREQ_ONLY 0x00000004 /**< AUTOPEND function */ -#define RFCORE_XREG_SRCMATCH_AUTOPEND 0x00000002 /**< Automatic acknowledgment */ -#define RFCORE_XREG_SRCMATCH_SRC_MATCH_EN 0x00000001 /**< Source address matching enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_SRCSHORTEN0 register bit masks - * @{ - */ -#define RFCORE_XREG_SRCSHORTEN0_SHORT_ADDR_EN 0x000000FF /**< SHORT_ADDR_EN[7:0] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_SRCSHORTEN1 register bit masks - * @{ - */ -#define RFCORE_XREG_SRCSHORTEN1_SHORT_ADDR_EN 0x000000FF /**< SHORT_ADDR_EN[15:8] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_SRCSHORTEN2 register bit masks - * @{ - */ -#define RFCORE_XREG_SRCSHORTEN2_SHORT_ADDR_EN 0x000000FF /**< SHORT_ADDR_EN[23:16] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_SRCEXTEN0 register bit masks - * @{ - */ -#define RFCORE_XREG_SRCEXTEN0_EXT_ADDR_EN 0x000000FF /**< EXT_ADDR_EN[7:0] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_SRCEXTEN1 register bit masks - * @{ - */ -#define RFCORE_XREG_SRCEXTEN1_EXT_ADDR_EN 0x000000FF /**< EXT_ADDR_EN[15:8] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_SRCEXTEN2 register bit masks - * @{ - */ -#define RFCORE_XREG_SRCEXTEN2_EXT_ADDR_EN 0x000000FF /**< EXT_ADDR_EN[23:16] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FRMCTRL0 register bit masks - * @{ - */ -#define RFCORE_XREG_FRMCTRL0_APPEND_DATA_MODE 0x00000080 /**< Append data mode */ -#define RFCORE_XREG_FRMCTRL0_AUTOCRC 0x00000040 /**< Auto CRC generation / checking */ -#define RFCORE_XREG_FRMCTRL0_AUTOACK 0x00000020 /**< Transmit ACK frame enable */ -#define RFCORE_XREG_FRMCTRL0_ENERGY_SCAN 0x00000010 /**< RSSI register content control */ -#define RFCORE_XREG_FRMCTRL0_RX_MODE 0x0000000C /**< Set RX modes */ -#define RFCORE_XREG_FRMCTRL0_TX_MODE 0x00000003 /**< Set test modes for TX */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FRMCTRL1 register bit masks - * @{ - */ -#define RFCORE_XREG_FRMCTRL1_PENDING_OR 0x00000004 /**< Pending data bit control */ -#define RFCORE_XREG_FRMCTRL1_IGNORE_TX_UNDERF 0x00000002 /**< TX underflow ignore */ -#define RFCORE_XREG_FRMCTRL1_SET_RXENMASK_ON_TX 0x00000001 /**< RXENABLE control */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RXENABLE register bit masks - * @{ - */ -#define RFCORE_XREG_RXENABLE_RXENMASK 0x000000FF /**< Enables the receiver. */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RXMASKSET register bit masks - * @{ - */ -#define RFCORE_XREG_RXMASKSET_RXENMASKSET 0x000000FF /**< Write to RXENMASK (OR) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RXMASKCLR register bit masks - * @{ - */ -#define RFCORE_XREG_RXMASKCLR_RXENMASKCLR 0x000000FF /**< RXENMASK clear bits */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FREQTUNE register bit masks - * @{ - */ -#define RFCORE_XREG_FREQTUNE_XOSC32M_TUNE 0x0000000F /**< Tune crystal oscillator */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FREQCTRL register bit masks - * @{ - */ -#define RFCORE_XREG_FREQCTRL_FREQ 0x0000007F /**< Frequency control word */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_TXPOWER register bit masks - * @{ - */ -#define RFCORE_XREG_TXPOWER_PA_POWER 0x000000F0 /**< PA power control */ -#define RFCORE_XREG_TXPOWER_PA_BIAS 0x0000000F /**< PA bias control */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_TXCTRL register bit masks - * @{ - */ -#define RFCORE_XREG_TXCTRL_DAC_CURR 0x00000070 /**< Change the current in the DAC. */ -#define RFCORE_XREG_TXCTRL_DAC_DC 0x0000000C /**< Adjusts the DC level to the TX mixer */ -#define RFCORE_XREG_TXCTRL_TXMIX_CURRENT 0x00000003 /**< TX mixer core current */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FSMSTAT0 register bit masks - * @{ - */ -#define RFCORE_XREG_FSMSTAT0_CAL_DONE 0x00000080 /**< Calib has been performed */ -#define RFCORE_XREG_FSMSTAT0_CAL_RUNNING 0x00000040 /**< Calib status */ -#define RFCORE_XREG_FSMSTAT0_FSM_FFCTRL_STATE 0x0000003F /**< FIFO and FFCTRL status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FSMSTAT1 register bit masks - * @{ - */ -#define RFCORE_XREG_FSMSTAT1_FIFO 0x00000080 /**< FIFO status */ -#define RFCORE_XREG_FSMSTAT1_FIFOP 0x00000040 /**< FIFOP status */ -#define RFCORE_XREG_FSMSTAT1_SFD 0x00000020 /**< SFD was sent/received */ -#define RFCORE_XREG_FSMSTAT1_CCA 0x00000010 /**< Clear channel assessment */ -#define RFCORE_XREG_FSMSTAT1_SAMPLED_CCA 0x00000008 /**< CCA sample value */ -#define RFCORE_XREG_FSMSTAT1_LOCK_STATUS 0x00000004 /**< PLL lock status */ -#define RFCORE_XREG_FSMSTAT1_TX_ACTIVE 0x00000002 /**< Status signal - TX states */ -#define RFCORE_XREG_FSMSTAT1_RX_ACTIVE 0x00000001 /**< Status signal - RX states */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FIFOPCTRL register bit masks - * @{ - */ -#define RFCORE_XREG_FIFOPCTRL_FIFOP_THR 0x0000007F /**< FIFOP signal threshold */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FSMCTRL register bit masks - * @{ - */ -#define RFCORE_XREG_FSMCTRL_SLOTTED_ACK 0x00000002 /**< ACK frame TX timing */ -#define RFCORE_XREG_FSMCTRL_RX2RX_TIME_OFF 0x00000001 /**< 12-sym timeout after RX */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_CCACTRL0 register bit masks - * @{ - */ -#define RFCORE_XREG_CCACTRL0_CCA_THR 0x000000FF /**< Clear-channel-assessment */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_CCACTRL1 register bit masks - * @{ - */ -#define RFCORE_XREG_CCACTRL1_CCA_MODE 0x00000018 /**< CCA mode */ -#define RFCORE_XREG_CCACTRL1_CCA_HYST 0x00000007 /**< CCA hysteresis */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RSSI register bit masks - * @{ - */ -#define RFCORE_XREG_RSSI_RSSI_VAL 0x000000FF /**< RSSI estimate */ -#define RFCORE_XREG_RSSI_RSSI_VAL_S 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RSSISTAT register bit masks - * @{ - */ -#define RFCORE_XREG_RSSISTAT_RSSI_VALID 0x00000001 /**< RSSI value is valid */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RXFIRST register bit masks - * @{ - */ -#define RFCORE_XREG_RXFIRST_DATA 0x000000FF /**< First byte of the RX FIFO */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RXFIFOCNT register bit masks - * @{ - */ -#define RFCORE_XREG_RXFIFOCNT_RXFIFOCNT 0x000000FF /**< Number of bytes in the RX FIFO */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_TXFIFOCNT register bit masks - * @{ - */ -#define RFCORE_XREG_TXFIFOCNT_TXFIFOCNT 0x000000FF /**< Number of bytes in the TX FIFO */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RX FIFO pointers - * @{ - */ -#define RFCORE_XREG_RXFIRST_PTR_RXFIRST_PTR 0x000000FF /**< Byte 1 */ -#define RFCORE_XREG_RXLAST_PTR_RXLAST_PTR 0x000000FF /**< Last byte + 1 */ -#define RFCORE_XREG_RXP1_PTR_RXP1_PTR 0x000000FF /**< Frame 1, byte 1 */ -#define RFCORE_XREG_RXP2_PTR_RXP2_PTR 0x000000FF /**< Last frame, byte 1 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name TX FIFO pointers - * @{ - */ -#define RFCORE_XREG_TXFIRST_PTR_TXFIRST_PTR 0x000000FF /**< Next byte to be TXd */ -#define RFCORE_XREG_TXLAST_PTR_TXLAST_PTR 0x000000FF /**< Last byte + 1 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RFIRQM0 register bit masks - * @{ - */ -#define RFCORE_XREG_RFIRQM0_RFIRQM 0x000000FF /**< Interrupt source bit mask */ -#define RFCORE_XREG_RFIRQM0_RXMASKZERO 0x00000080 /**< RXENABLE gone all-zero */ -#define RFCORE_XREG_RFIRQM0_RXPKTDONE 0x00000040 /**< Complete frame RX */ -#define RFCORE_XREG_RFIRQM0_FRAME_ACCEPTED 0x00000020 /**< Frame has passed frame filter */ -#define RFCORE_XREG_RFIRQM0_SRC_MATCH_FOUND 0x00000010 /**< Source match is found */ -#define RFCORE_XREG_RFIRQM0_SRC_MATCH_DONE 0x00000008 /**< Source matching is complete */ -#define RFCORE_XREG_RFIRQM0_FIFOP 0x00000004 /**< RX FIFO exceeded threshold */ -#define RFCORE_XREG_RFIRQM0_SFD 0x00000002 /**< SFD TX or RX */ -#define RFCORE_XREG_RFIRQM0_ACT_UNUSED 0x00000001 /**< Reserved */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RFIRQM1 register bit masks - * @{ - */ -#define RFCORE_XREG_RFIRQM1_RFIRQM 0x0000003F /**< Interrupt source bit mask */ -#define RFCORE_XREG_RFIRQM1_CSP_WAIT 0x00000020 /**< CSP Execution continued */ -#define RFCORE_XREG_RFIRQM1_CSP_STOP 0x00000010 /**< CSP has stopped program */ -#define RFCORE_XREG_RFIRQM1_CSP_MANINT 0x00000008 /**< CSP Manual interrupt */ -#define RFCORE_XREG_RFIRQM1_RFIDLE 0x00000004 /**< IDLE state entered */ -#define RFCORE_XREG_RFIRQM1_TXDONE 0x00000002 /**< Complete frame TX finished */ -#define RFCORE_XREG_RFIRQM1_TXACKDONE 0x00000001 /**< ACK frame TX finished */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RFERRM register bit masks - * @{ - */ -#define RFCORE_XREG_RFERRM_RFERRM 0x0000007F /**< RF error interrupt mask */ -#define RFCORE_XREG_RFERRM_STROBEERR 0x00000040 /**< Strobe error */ -#define RFCORE_XREG_RFERRM_TXUNDERF 0x00000020 /**< TX FIFO underflowed */ -#define RFCORE_XREG_RFERRM_TXOVERF 0x00000010 /**< TX FIFO overflowed */ -#define RFCORE_XREG_RFERRM_RXUNDERF 0x00000008 /**< RX FIFO underflowed */ -#define RFCORE_XREG_RFERRM_RXOVERF 0x00000004 /**< RX FIFO overflowed */ -#define RFCORE_XREG_RFERRM_RXABO 0x00000002 /**< Frame RX was aborted */ -#define RFCORE_XREG_RFERRM_NLOCK 0x00000001 /**< Frequency synthesizer lock error */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_D18_SPARE_OPAMPMC register bit masks - * @{ - */ -#define RFCORE_XREG_D18_SPARE_OPAMPMC_MODE 0x00000003 /**< Operational amplifier mode */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RFRND register bit masks - * @{ - */ -#define RFCORE_XREG_RFRND_QRND 0x00000002 /**< Random bit from the Q channel */ -#define RFCORE_XREG_RFRND_IRND 0x00000001 /**< Random bit from the I channel */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_MDMCTRL0 register bit masks - * @{ - */ -#define RFCORE_XREG_MDMCTRL0_DEM_NUM_ZEROS 0x000000C0 /**< Num of zero symbols before sync word */ -#define RFCORE_XREG_MDMCTRL0_DEMOD_AVG_MODE 0x00000020 /**< Frequency offset averaging filter */ -#define RFCORE_XREG_MDMCTRL0_PREAMBLE_LENGTH 0x0000001E /**< Number of preamble bytes */ -#define RFCORE_XREG_MDMCTRL0_TX_FILTER 0x00000001 /**< TX filter type */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_MDMCTRL1 register bit masks - * @{ - */ -#define RFCORE_XREG_MDMCTRL1_CORR_THR_SFD 0x00000020 /**< SFD detection requirements */ -#define RFCORE_XREG_MDMCTRL1_CORR_THR 0x0000001F /**< Demodulator correlator threshold */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FREQEST register bit masks - * @{ - */ -#define RFCORE_XREG_FREQEST_FREQEST 0x000000FF -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RXCTRL register bit masks - * @{ - */ -#define RFCORE_XREG_RXCTRL_GBIAS_LNA2_REF 0x00000030 /**< LNA2/mixer PTAT current output */ -#define RFCORE_XREG_RXCTRL_GBIAS_LNA_REF 0x0000000C /**< LNA PTAT current output */ -#define RFCORE_XREG_RXCTRL_MIX_CURRENT 0x00000003 /**< Control of the output current */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FSCTRL register bit masks - * @{ - */ -#define RFCORE_XREG_FSCTRL_PRE_CURRENT 0x000000C0 /**< Prescaler current setting */ -#define RFCORE_XREG_FSCTRL_LODIV_BUF_CURRENT_TX 0x00000030 /**< Adjusts current in mixer and PA adjust */ -#define RFCORE_XREG_FSCTRL_LODIV_BUF_CURRENT_RX 0x0000000C /**< Adjusts current in mixer and PA adjust */ -#define RFCORE_XREG_FSCTRL_LODIV_CURRENT 0x00000003 /**< Adjusts divider currents */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FSCAL1 register bit masks - * @{ - */ -#define RFCORE_XREG_FSCAL1_VCO_CURR_CAL_OE 0x00000080 /**< Override current calibration */ -#define RFCORE_XREG_FSCAL1_VCO_CURR_CAL 0x0000007C /**< Calibration result */ -#define RFCORE_XREG_FSCAL1_VCO_CURR 0x00000003 /**< Defines current in VCO core */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FSCAL2 register bit masks - * @{ - */ -#define RFCORE_XREG_FSCAL2_VCO_CAPARR_OE 0x00000040 /**< Override the calibration result */ -#define RFCORE_XREG_FSCAL2_VCO_CAPARR 0x0000003F /**< VCO capacitor array setting */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_FSCAL3 register bit masks - * @{ - */ -#define RFCORE_XREG_FSCAL3_VCO_DAC_EN_OV 0x00000040 /**< VCO DAC Enable */ -#define RFCORE_XREG_FSCAL3_VCO_VC_DAC 0x0000003C /**< Varactor control voltage Bit vector */ -#define RFCORE_XREG_FSCAL3_VCO_CAPARR_CAL_CTRL 0x00000003 /**< Calibration accuracy setting */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_AGCCTRL0 register bit masks - * @{ - */ -#define RFCORE_XREG_AGCCTRL0_AGC_DR_XTND_EN 0x00000040 /**< AAF attenuation adjustment */ -#define RFCORE_XREG_AGCCTRL0_AGC_DR_XTND_THR 0x0000003F /**< Enable extra attenuation in front end */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_AGCCTRL1 register bit masks - * @{ - */ -#define RFCORE_XREG_AGCCTRL1_AGC_REF 0x0000003F /**< Target value for the AGC control loop */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_AGCCTRL2 register bit masks - * @{ - */ -#define RFCORE_XREG_AGCCTRL2_LNA1_CURRENT 0x000000C0 /**< Overrride value for LNA 1 */ -#define RFCORE_XREG_AGCCTRL2_LNA2_CURRENT 0x00000038 /**< Overrride value for LNA 2 */ -#define RFCORE_XREG_AGCCTRL2_LNA3_CURRENT 0x00000006 /**< Overrride value for LNA 3 */ -#define RFCORE_XREG_AGCCTRL2_LNA_CURRENT_OE 0x00000001 /**< AGC LNA override */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_AGCCTRL3 register bit masks - * @{ - */ -#define RFCORE_XREG_AGCCTRL3_AGC_SETTLE_WAIT 0x00000060 /**< AGC analog gain wait */ -#define RFCORE_XREG_AGCCTRL3_AGC_WIN_SIZE 0x00000018 /**< AGC accumulate-and-dump window size */ -#define RFCORE_XREG_AGCCTRL3_AAF_RP 0x00000006 /**< AGC to AAF control signal override */ -#define RFCORE_XREG_AGCCTRL3_AAF_RP_OE 0x00000001 /**< AAF control signal override */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_ADCTEST0 register bit masks - * @{ - */ -#define RFCORE_XREG_ADCTEST0_ADC_VREF_ADJ 0x000000C0 /**< Quantizer threshold control */ -#define RFCORE_XREG_ADCTEST0_ADC_QUANT_ADJ 0x00000030 /**< Quantizer threshold control */ -#define RFCORE_XREG_ADCTEST0_ADC_GM_ADJ 0x0000000E /**< Gm-control for test and debug */ -#define RFCORE_XREG_ADCTEST0_ADC_DAC2_EN 0x00000001 /**< Enables DAC2 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_ADCTEST1 register bit masks - * @{ - */ -#define RFCORE_XREG_ADCTEST1_ADC_TEST_CTRL 0x000000F0 /**< ADC test mode selector */ -#define RFCORE_XREG_ADCTEST1_ADC_C2_ADJ 0x0000000C /**< ADC capacitor value adjust */ -#define RFCORE_XREG_ADCTEST1_ADC_C3_ADJ 0x00000003 /**< ADC capacitor value adjust */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_ADCTEST2 register bit masks - * @{ - */ -#define RFCORE_XREG_ADCTEST2_ADC_TEST_MODE 0x00000060 /**< ADC data output test mode */ -#define RFCORE_XREG_ADCTEST2_AAF_RS 0x00000018 /**< AAF series resistance control */ -#define RFCORE_XREG_ADCTEST2_ADC_FF_ADJ 0x00000006 /**< Adjust feed forward */ -#define RFCORE_XREG_ADCTEST2_ADC_DAC_ROT 0x00000001 /**< Control of DAC DWA scheme */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_MDMTEST0 register bit masks - * @{ - */ -#define RFCORE_XREG_MDMTEST0_TX_TONE 0x000000F0 /**< Baseband tone TX enable */ -#define RFCORE_XREG_MDMTEST0_DC_WIN_SIZE 0x0000000C /**< Controls the numbers of samples */ -#define RFCORE_XREG_MDMTEST0_DC_BLOCK_MODE 0x00000003 /**< Mode of operation select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_MDMTEST1 register bit masks - * @{ - */ -#define RFCORE_XREG_MDMTEST1_USEMIRROR_IF 0x00000020 /**< IF frequency select */ -#define RFCORE_XREG_MDMTEST1_MOD_IF 0x00000010 /**< Modulation select */ -#define RFCORE_XREG_MDMTEST1_RAMP_AMP 0x00000008 /**< Ramping of DAC output enable */ -#define RFCORE_XREG_MDMTEST1_RFC_SNIFF_EN 0x00000004 /**< Packet sniffer module enable */ -#define RFCORE_XREG_MDMTEST1_MODULATION_MODE 0x00000002 /**< RF-modulation mode */ -#define RFCORE_XREG_MDMTEST1_LOOPBACK_EN 0x00000001 /**< Modulated data loopback enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_DACTEST0 register bit masks - * @{ - */ -#define RFCORE_XREG_DACTEST0_DAC_Q 0x400886FF /**< Q-branch DAC override value */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_DACTEST1 register bit masks - * @{ - */ -#define RFCORE_XREG_DACTEST1_DAC_I 0x400886FF /**< I-branch DAC override value */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_DACTEST2 register bit masks - * @{ - */ -#define RFCORE_XREG_DACTEST2_DAC_DEM_EN 0x00000020 /**< Dynamic element matching enable */ -#define RFCORE_XREG_DACTEST2_DAC_CASC_CTRL 0x00000018 /**< Adjustment of output stage */ -#define RFCORE_XREG_DACTEST2_DAC_SRC 0x00000007 /**< TX DAC data src select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_ATEST register bit masks - * @{ - */ -#define RFCORE_XREG_ATEST_ATEST_CTRL 0x0000003F /**< Controls the analog test mode */ -#define RFCORE_XREG_ATEST_ATEST_CTRL_DIS 0x00000000 /**< Analog test mode: disabled */ -#define RFCORE_XREG_ATEST_ATEST_CTRL_TEMP 0x00000001 /**< Analog test mode: enable temperature sensor */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_PTEST0 register bit masks - * @{ - */ -#define RFCORE_XREG_PTEST0_PRE_PD 0x00000080 /**< Prescaler power-down signal */ -#define RFCORE_XREG_PTEST0_CHP_PD 0x00000040 /**< Charge pump power-down signal */ -#define RFCORE_XREG_PTEST0_ADC_PD 0x00000020 /**< ADC power-down signal When */ -#define RFCORE_XREG_PTEST0_DAC_PD 0x00000010 /**< DAC power-down signal When */ -#define RFCORE_XREG_PTEST0_LNA_PD 0x0000000C /**< Low-noise amplifier power-down */ -#define RFCORE_XREG_PTEST0_TXMIX_PD 0x00000002 /**< Transmit mixer power-down */ -#define RFCORE_XREG_PTEST0_AAF_PD 0x00000001 /**< Antialiasing filter power-down */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_PTEST1 register bit masks - * @{ - */ -#define RFCORE_XREG_PTEST1_PD_OVERRIDE 0x00000008 /**< Override module enabling and disabling */ -#define RFCORE_XREG_PTEST1_PA_PD 0x00000004 /**< Power amplifier power-down signal */ -#define RFCORE_XREG_PTEST1_VCO_PD 0x00000002 /**< VCO power-down signal */ -#define RFCORE_XREG_PTEST1_LODIV_PD 0x00000001 /**< LO power-down signal */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_CSPPROG[0:24] register bit masks - * @{ - */ -#define RFCORE_XREG_CSPPROG_CSP_INSTR 0x000000FF /**< Byte N of the CSP program */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_CSPCTRL register bit masks - * @{ - */ -#define RFCORE_XREG_CSPCTRL_MCU_CTRL 0x00000001 /**< CSP MCU control input */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_CSPSTAT register bit masks - * @{ - */ -#define RFCORE_XREG_CSPSTAT_CSP_RUNNING 0x00000020 /**< CSP Running / Idle */ -#define RFCORE_XREG_CSPSTAT_CSP_PC 0x0000001F /**< CSP program counter */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_CSPX register bit masks - * @{ - */ -#define RFCORE_XREG_CSPX_CSPX 0x000000FF /**< CSP X data */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_CSPY register bit masks - * @{ - */ -#define RFCORE_XREG_CSPY_CSPY 0x000000FF /**< CSP Y data */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_CSPZ register bit masks - * @{ - */ -#define RFCORE_XREG_CSPZ_CSPZ 0x000000FF /**< CSP Z data */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_CSPT register bit masks - * @{ - */ -#define RFCORE_XREG_CSPT_CSPT 0x000000FF /**< CSP T data */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RFC_DUTY_CYCLE register bit masks - * @{ - */ -#define RFCORE_XREG_RFC_DUTY_CYCLE_SWD_EN 0x00000040 /**< Wire debug mode */ -#define RFCORE_XREG_RFC_DUTY_CYCLE_DTC_DCCAL_MODE 0x00000030 /**< Periodic DC-recalibration mode */ -#define RFCORE_XREG_RFC_DUTY_CYCLE_DUTYCYCLE_CNF 0x0000000E /**< Defines duty cycling */ -#define RFCORE_XREG_RFC_DUTY_CYCLE_DUTYCYCLE_EN 0x00000001 /**< Duty cycling mode enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_RFC_OBS_CTRL[0:2] register bit masks - * @{ - */ -#define RFCORE_XREG_RFC_OBS_CTRL0_RFC_OBS_POL0 0x00000040 /**< RFC_OBS_MUX0 XOR bit */ -#define RFCORE_XREG_RFC_OBS_CTRL0_RFC_OBS_MUX0 0x0000003F /**< RF Core MUX out control */ -#define RFCORE_XREG_RFC_OBS_CTRL1_RFC_OBS_POL1 0x00000040 /**< RFC_OBS_MUX0 XOR bit */ -#define RFCORE_XREG_RFC_OBS_CTRL1_RFC_OBS_MUX1 0x0000003F /**< RF Core MUX out control */ -#define RFCORE_XREG_RFC_OBS_CTRL2_RFC_OBS_POL2 0x00000040 /**< RFC_OBS_MUX0 XOR bit */ -#define RFCORE_XREG_RFC_OBS_CTRL2_RFC_OBS_MUX2 0x0000003F /**< RF Core MUX out control */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RFCORE_XREG_TXFILTCFG register bit masks - * @{ - */ -#define RFCORE_XREG_TXFILTCFG_FC 0x0000000F /**< Drives signal rfr_txfilt_fc */ -/** @} */ - -#endif /* RFCORE_XREG_H_ */ -/** @} */ diff --git a/arch/cpu/cc2538/dev/rfcore.h b/arch/cpu/cc2538/dev/rfcore.h deleted file mode 100644 index 19bd9e348..000000000 --- a/arch/cpu/cc2538/dev/rfcore.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-rfcore cc2538 RF Core - * - * Declarations of RF Core registers. Includes SFR, XREG and FFSM - * @{ - * - * \file - * Top-level header file for cc2538 RF Core registers. Includes the files - * where the actual declarations reside - */ -#ifndef RFCORE_H_ -#define RFCORE_H_ - -#include "dev/rfcore-ffsm.h" -#include "dev/rfcore-xreg.h" -#include "dev/rfcore-sfr.h" -#include "dev/ana-regs.h" - -#endif /* RFCORE_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/rom-util.h b/arch/cpu/cc2538/dev/rom-util.h deleted file mode 100644 index 2ab4bd82c..000000000 --- a/arch/cpu/cc2538/dev/rom-util.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Original file: - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-rom-util cc2538 ROM utility function library - * - * Driver for the cc2538 ROM utility function library - * @{ - * - * \file - * Header file for the cc2538 ROM utility function library driver - */ -#ifndef ROM_UTIL_H_ -#define ROM_UTIL_H_ - -#include "contiki.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/** \name ROM utility function library API access table structure - * @{ - */ -struct rom_util_api { - /** Calculate CRC32 over a given address range */ - uint32_t (*crc32)(uint8_t *data, uint32_t byte_count); - - /** Return the flash size */ - uint32_t (*get_flash_size)(void); - - /** Return the chip ID */ - uint32_t (*get_chip_id)(void); - - /** Erase flash pages */ - int32_t (*page_erase)(uint32_t flash_addr, uint32_t size); - - /** Program the flash */ - int32_t (*program_flash)(uint32_t *ram_data, uint32_t flash_addr, - uint32_t byte_count); - - /** Perform a system reset of the SoC */ - void (*reset_device)(void); - - /** Set a memory area to a specified value */ - void *(*memset)(void *s, int c, size_t n); - - /** Copy data from one memory area to another */ - void *(*memcpy)(void *dest, const void *src, size_t n); - - /** Compare two memory areas */ - int (*memcmp)(const void *s1, const void *s2, size_t n); - - /** Move a block of data from one memory area to another */ - void *(*memmove)(void *dest, const void *src, size_t n); -}; -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Pointer to the ROM utility function library API table - * @{ - */ -#define ROM_UTIL_API ((struct rom_util_api *)0x00000048) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name ROM utility function library API accessor macros - * @{ - */ -#define rom_util_crc32(data, byte_count) \ - (ROM_UTIL_API->crc32((data), (byte_count))) -#define rom_util_get_flash_size() \ - (ROM_UTIL_API->get_flash_size()) -#define rom_util_get_chip_id() \ - (ROM_UTIL_API->get_chip_id()) -#define rom_util_page_erase(flash_addr, size) \ - (ROM_UTIL_API->page_erase((flash_addr), (size))) -#define rom_util_program_flash(ram_data, flash_addr, byte_count) \ - (ROM_UTIL_API->program_flash((ram_data), (flash_addr), (byte_count))) -#define rom_util_reset_device() \ - (ROM_UTIL_API->reset_device()) -#define rom_util_memset(s, c, n) \ - (ROM_UTIL_API->memset((s), (c), (n))) -#define rom_util_memcpy(dest, src, n) \ - (ROM_UTIL_API->memcpy((dest), (src), (n))) -#define rom_util_memcmp(s1, s2, n) \ - (ROM_UTIL_API->memcmp((s1), (s2), (n))) -#define rom_util_memmove(dest, src, n) \ - (ROM_UTIL_API->memmove((dest), (src), (n))) -/** @} */ - -#endif /* ROM_UTIL_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/sha256.c b/arch/cpu/cc2538/dev/sha256.c deleted file mode 100644 index 347c54081..000000000 --- a/arch/cpu/cc2538/dev/sha256.c +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Original file: - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538-sha256 - * @{ - * - * \file - * Implementation of the cc2538 SHA-256 driver - */ -#include "contiki.h" -#include "sys/cc.h" -#include "dev/rom-util.h" -#include "dev/aes.h" -#include "dev/sha256.h" -#include "reg.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define BLOCK_SIZE 64 -#define OUTPUT_LEN 32 -/*---------------------------------------------------------------------------*/ -/** \brief Starts a new hash session in hardware - * \param state Hash state - * \param data Pointer to input message - * \param hash Destination of the hash (32 bytes) - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/SHA256 error code - */ -static uint8_t -new_hash(sha256_state_t *state, const void *data, void *hash) -{ - /* Workaround for AES registers not retained after PM2 */ - REG(AES_CTRL_INT_CFG) = AES_CTRL_INT_CFG_LEVEL; - REG(AES_CTRL_INT_EN) = AES_CTRL_INT_EN_DMA_IN_DONE | - AES_CTRL_INT_EN_RESULT_AV; - - /* Configure master control module and enable DMA path to the SHA-256 engine - * + Digest readout */ - REG(AES_CTRL_ALG_SEL) = AES_CTRL_ALG_SEL_TAG | AES_CTRL_ALG_SEL_HASH; - - /* Clear any outstanding events */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_RESULT_AV; - - /* Configure hash engine - * Indicate start of a new hash session and SHA-256 */ - REG(AES_HASH_MODE_IN) = AES_HASH_MODE_IN_SHA256_MODE | - AES_HASH_MODE_IN_NEW_HASH; - - /* If the final digest is required (pad the input DMA data), write the - * following register */ - if(state->final_digest) { - /* Write length of the message (lo) */ - REG(AES_HASH_LENGTH_IN_L) = (uint32_t)state->length; - /* Write length of the message (hi) */ - REG(AES_HASH_LENGTH_IN_H) = (uint32_t)(state->length >> 32); - /* Pad the DMA-ed data */ - REG(AES_HASH_IO_BUF_CTRL) = AES_HASH_IO_BUF_CTRL_PAD_DMA_MESSAGE; - } - - /* Enable DMA channel 0 for message data */ - REG(AES_DMAC_CH0_CTRL) = AES_DMAC_CH_CTRL_EN; - /* Base address of the data in ext. memory */ - REG(AES_DMAC_CH0_EXTADDR) = (uint32_t)data; - if(state->final_digest) { - /* Input data length in bytes, equal to the message */ - REG(AES_DMAC_CH0_DMALENGTH) = state->curlen; - } else { - REG(AES_DMAC_CH0_DMALENGTH) = BLOCK_SIZE; - } - - /* Enable DMA channel 1 for result digest */ - REG(AES_DMAC_CH1_CTRL) = AES_DMAC_CH_CTRL_EN; - /* Base address of the digest buffer */ - REG(AES_DMAC_CH1_EXTADDR) = (uint32_t)hash; - /* Length of the result digest */ - REG(AES_DMAC_CH1_DMALENGTH) = OUTPUT_LEN; - - /* Wait for completion of the operation */ - while(!(REG(AES_CTRL_INT_STAT) & AES_CTRL_INT_STAT_RESULT_AV)); - - if(REG(AES_CTRL_INT_STAT) & AES_CTRL_INT_STAT_DMA_BUS_ERR) { - /* Clear the DMA error */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_BUS_ERR; - /* Disable master control / DMA clock */ - REG(AES_CTRL_ALG_SEL) = 0x00000000; - return CRYPTO_DMA_BUS_ERROR; - } - - /* Clear the interrupt */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE | - AES_CTRL_INT_CLR_RESULT_AV; - /* Disable master control / DMA clock */ - REG(AES_CTRL_ALG_SEL) = 0x00000000; - /* Clear mode */ - REG(AES_AES_CTRL) = 0x00000000; - - return CRYPTO_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -/** \brief Resumes an already started hash session in hardware - * \param state Hash state - * \param data Pointer to the input message - * \param hash Pointer to the destination of the hash (32 bytes) - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/SHA256 error code - */ -static uint8_t -resume_hash(sha256_state_t *state, const void *data, void *hash) -{ - /* Workaround for AES registers not retained after PM2 */ - REG(AES_CTRL_INT_CFG) = AES_CTRL_INT_CFG_LEVEL; - REG(AES_CTRL_INT_EN) = AES_CTRL_INT_EN_DMA_IN_DONE | - AES_CTRL_INT_EN_RESULT_AV; - - /* Configure master control module and enable the DMA path to the SHA-256 - * engine */ - REG(AES_CTRL_ALG_SEL) = AES_CTRL_ALG_SEL_HASH; - - /* Clear any outstanding events */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_RESULT_AV; - - /* Configure hash engine - * Indicate the start of a resumed hash session and SHA-256 */ - REG(AES_HASH_MODE_IN) = AES_HASH_MODE_IN_SHA256_MODE; - - /* If the final digest is required (pad the input DMA data) */ - if(state->final_digest) { - /* Write length of the message (lo) */ - REG(AES_HASH_LENGTH_IN_L) = (uint32_t)state->length; - /* Write length of the message (hi) */ - REG(AES_HASH_LENGTH_IN_H) = (uint32_t)(state->length >> 32); - } - - /* Write the initial digest */ - REG(AES_HASH_DIGEST_A) = (uint32_t)state->state[0]; - REG(AES_HASH_DIGEST_B) = (uint32_t)state->state[1]; - REG(AES_HASH_DIGEST_C) = (uint32_t)state->state[2]; - REG(AES_HASH_DIGEST_D) = (uint32_t)state->state[3]; - REG(AES_HASH_DIGEST_E) = (uint32_t)state->state[4]; - REG(AES_HASH_DIGEST_F) = (uint32_t)state->state[5]; - REG(AES_HASH_DIGEST_G) = (uint32_t)state->state[6]; - REG(AES_HASH_DIGEST_H) = (uint32_t)state->state[7]; - - /* If final digest, pad the DMA-ed data */ - if(state->final_digest) { - REG(AES_HASH_IO_BUF_CTRL) = AES_HASH_IO_BUF_CTRL_PAD_DMA_MESSAGE; - } - - /* Enable DMA channel 0 for message data */ - REG(AES_DMAC_CH0_CTRL) = AES_DMAC_CH_CTRL_EN; - /* Base address of the data in ext. memory */ - REG(AES_DMAC_CH0_EXTADDR) = (uint32_t)data; - /* Input data length in bytes, equal to the message */ - if(state->final_digest) { - REG(AES_DMAC_CH0_DMALENGTH) = state->curlen; - } else { - REG(AES_DMAC_CH0_DMALENGTH) = BLOCK_SIZE; - } - - /* Wait for completion of the operation */ - while(!(REG(AES_CTRL_INT_STAT) & AES_CTRL_INT_STAT_RESULT_AV)); - - /* Check for any DMA Bus errors */ - if(REG(AES_CTRL_INT_STAT) & AES_CTRL_INT_STAT_DMA_BUS_ERR) { - /* Clear the DMA error */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_BUS_ERR; - /* Disable master control / DMA clock */ - REG(AES_CTRL_ALG_SEL) = 0x00000000; - return CRYPTO_DMA_BUS_ERROR; - } - - /* Read digest */ - ((uint32_t *)hash)[0] = REG(AES_HASH_DIGEST_A); - ((uint32_t *)hash)[1] = REG(AES_HASH_DIGEST_B); - ((uint32_t *)hash)[2] = REG(AES_HASH_DIGEST_C); - ((uint32_t *)hash)[3] = REG(AES_HASH_DIGEST_D); - ((uint32_t *)hash)[4] = REG(AES_HASH_DIGEST_E); - ((uint32_t *)hash)[5] = REG(AES_HASH_DIGEST_F); - ((uint32_t *)hash)[6] = REG(AES_HASH_DIGEST_G); - ((uint32_t *)hash)[7] = REG(AES_HASH_DIGEST_H); - - /* Acknowledge reading of the digest */ - REG(AES_HASH_IO_BUF_CTRL) = AES_HASH_IO_BUF_CTRL_OUTPUT_FULL; - - /* Clear the interrupt */ - REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE | - AES_CTRL_INT_CLR_RESULT_AV; - /* Disable master control / DMA clock */ - REG(AES_CTRL_ALG_SEL) = 0x00000000; - /* Clear mode */ - REG(AES_AES_CTRL) = 0x00000000; - - return CRYPTO_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -sha256_init(sha256_state_t *state) -{ - if(state == NULL) { - return CRYPTO_NULL_ERROR; - } - - state->curlen = 0; - state->length = 0; - state->new_digest = true; - state->final_digest = false; - return CRYPTO_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -sha256_process(sha256_state_t *state, const void *data, uint32_t len) -{ - uint32_t n; - uint8_t ret; - - if(state == NULL || data == NULL) { - return CRYPTO_NULL_ERROR; - } - - if(state->curlen > sizeof(state->buf)) { - return CRYPTO_INVALID_PARAM; - } - - if(REG(AES_CTRL_ALG_SEL) != 0x00000000) { - return CRYPTO_RESOURCE_IN_USE; - } - - if(len > 0 && state->new_digest) { - if(state->curlen == 0 && len > BLOCK_SIZE) { - rom_util_memcpy(state->buf, data, BLOCK_SIZE); - ret = new_hash(state, state->buf, state->state); - if(ret != CRYPTO_SUCCESS) { - return ret; - } - state->new_digest = false; - state->length += BLOCK_SIZE << 3; - data += BLOCK_SIZE; - len -= BLOCK_SIZE; - } else { - n = MIN(len, BLOCK_SIZE - state->curlen); - rom_util_memcpy(&state->buf[state->curlen], data, n); - state->curlen += n; - data += n; - len -= n; - if(state->curlen == BLOCK_SIZE && len > 0) { - ret = new_hash(state, state->buf, state->state); - if(ret != CRYPTO_SUCCESS) { - return ret; - } - state->new_digest = false; - state->length += BLOCK_SIZE << 3; - state->curlen = 0; - } - } - } - - while(len > 0 && !state->new_digest) { - if(state->curlen == 0 && len > BLOCK_SIZE) { - rom_util_memcpy(state->buf, data, BLOCK_SIZE); - ret = resume_hash(state, state->buf, state->state); - if(ret != CRYPTO_SUCCESS) { - return ret; - } - state->length += BLOCK_SIZE << 3; - data += BLOCK_SIZE; - len -= BLOCK_SIZE; - } else { - n = MIN(len, BLOCK_SIZE - state->curlen); - rom_util_memcpy(&state->buf[state->curlen], data, n); - state->curlen += n; - data += n; - len -= n; - if(state->curlen == BLOCK_SIZE && len > 0) { - ret = resume_hash(state, state->buf, state->state); - if(ret != CRYPTO_SUCCESS) { - return ret; - } - state->length += BLOCK_SIZE << 3; - state->curlen = 0; - } - } - } - - return CRYPTO_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -sha256_done(sha256_state_t *state, void *hash) -{ - uint8_t ret; - - if(state == NULL || hash == NULL) { - return CRYPTO_NULL_ERROR; - } - - if(state->curlen > sizeof(state->buf)) { - return CRYPTO_INVALID_PARAM; - } - - if(REG(AES_CTRL_ALG_SEL) != 0x00000000) { - return CRYPTO_RESOURCE_IN_USE; - } - - /* Increase the length of the message */ - state->length += state->curlen << 3; - state->final_digest = true; - if(state->new_digest) { - ret = new_hash(state, state->buf, hash); - if(ret != CRYPTO_SUCCESS) { - return ret; - } - } else { - ret = resume_hash(state, state->buf, hash); - if(ret != CRYPTO_SUCCESS) { - return ret; - } - } - state->new_digest = false; - state->final_digest = false; - - return CRYPTO_SUCCESS; -} - -/** @} */ diff --git a/arch/cpu/cc2538/dev/sha256.h b/arch/cpu/cc2538/dev/sha256.h deleted file mode 100644 index 86508e267..000000000 --- a/arch/cpu/cc2538/dev/sha256.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Original file: - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538-crypto - * @{ - * - * \defgroup cc2538-sha256 cc2538 SHA-256 - * - * Driver for the cc2538 SHA-256 mode of the security core - * @{ - * - * \file - * Header file for the cc2538 SHA-256 driver - */ -#ifndef SHA256_H_ -#define SHA256_H_ - -#include "contiki.h" -#include "dev/crypto.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \name SHA-256 structures - * @{ - */ -typedef struct { - uint64_t length; - uint32_t state[8]; - uint32_t curlen; - uint8_t buf[64]; - uint8_t new_digest; - uint8_t final_digest; -} sha256_state_t; -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SHA-256 functions - * @{ - */ - -/** \brief Initializes the hash state - * \param state Pointer to hash state to initialize - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/SHA256 error code - */ -uint8_t sha256_init(sha256_state_t *state); - -/** \brief Processes a block of memory through the hash - * \param state Pointer to hash state - * \param data Pointer to the data to hash - * \param len Length of the data to hash in bytes (octets) - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/SHA256 error code - * \note This function must be called only after \c sha256_init(). - */ -uint8_t sha256_process(sha256_state_t *state, const void *data, uint32_t len); - -/** \brief Terminates hash session to get the digest - * \param state Pointer to hash state - * \param hash Pointer to hash - * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/SHA256 error code - * \note This function must be called only after \c sha256_process(). - */ -uint8_t sha256_done(sha256_state_t *state, void *hash); - -/** @} */ - -#endif /* SHA256_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/smwdthrosc.h b/arch/cpu/cc2538/dev/smwdthrosc.h deleted file mode 100644 index 0e639c7e9..000000000 --- a/arch/cpu/cc2538/dev/smwdthrosc.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-smwdthrosc cc2538 Sleep Timer and Watchdog - * - * Register declarations for the cc2538 Sleep Timer and Watchdog - * @{ - * - * \file - * Header file with register declarations and bit masks for the cc2538 - * Sleep Timer and Watchdog - */ -#ifndef SMWDTHROSC_H_ -#define SMWDTHROSC_H_ -/*---------------------------------------------------------------------------*/ -/** \name ST and WDT Register offset declarations - * @{ - */ -#define SMWDTHROSC_WDCTL 0x400D5000 /**< Watchdog Control */ -#define SMWDTHROSC_ST0 0x400D5040 /**< ST count/compare value 0 */ -#define SMWDTHROSC_ST1 0x400D5044 /**< ST count/compare value 1 */ -#define SMWDTHROSC_ST2 0x400D5048 /**< ST count/compare value 2 */ -#define SMWDTHROSC_ST3 0x400D504C /**< ST count/compare value 3 */ -#define SMWDTHROSC_STLOAD 0x400D5050 /**< Compare value load status */ -#define SMWDTHROSC_STCC 0x400D5054 /**< ST capture control */ -#define SMWDTHROSC_STCS 0x400D5058 /**< ST capture status */ -#define SMWDTHROSC_STCV0 0x400D505C /**< ST capture value 0 */ -#define SMWDTHROSC_STCV1 0x400D5060 /**< ST capture value 1 */ -#define SMWDTHROSC_STCV2 0x400D5064 /**< ST capture value 2 */ -#define SMWDTHROSC_STCV3 0x400D5068 /**< ST capture value 3 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SMWDTHROSC_WDCTL register bit masks - * @{ - */ -#define SMWDTHROSC_WDCTL_CLR 0x000000F0 /**< Clear timer mask */ -#define SMWDTHROSC_WDCTL_CLR_3 0x00000080 /**< Clear timer mask[3] */ -#define SMWDTHROSC_WDCTL_CLR_2 0x00000040 /**< Clear timer mask[2] */ -#define SMWDTHROSC_WDCTL_CLR_1 0x00000020 /**< Clear timer mask[1] */ -#define SMWDTHROSC_WDCTL_CLR_0 0x00000010 /**< Clear timer mask[0] */ -#define SMWDTHROSC_WDCTL_EN 0x00000008 /**< Enable mask */ -#define SMWDTHROSC_WDCTL_MODE 0x00000004 /**< Mode select mask */ -#define SMWDTHROSC_WDCTL_INT 0x00000003 /**< Interval Select mask */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SMWDTHROSC_ST[0:3] register bit masks - * @{ - */ -#define SMWDTHROSC_ST0_ST0 0x000000FF /**< ST count/compare bits [7:0] */ -#define SMWDTHROSC_ST1_ST1 0x000000FF /**< ST count/compare bits [15:8] */ -#define SMWDTHROSC_ST2_ST2 0x000000FF /**< ST count/compare bits [23:16] */ -#define SMWDTHROSC_ST3_ST3 0x000000FF /**< ST count/compare bits [31:24] */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SMWDTHROSC_STLOAD register bit masks - * @{ - */ -#define SMWDTHROSC_STLOAD_STLOAD 0x00000001 /**< STx upload status signal */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SMWDTHROSC_STCC register bit masks - * @{ - */ -#define SMWDTHROSC_STCC_PORT 0x00000038 /**< Port select */ -#define SMWDTHROSC_STCC_PIN 0x00000007 /**< Pin select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SMWDTHROSC_STCS register bit masks - * @{ - */ -#define SMWDTHROSC_STCS_VALID 0x00000001 /**< Capture valid flag */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SMWDTHROSC_STCV[0:3] register bit masks - * @{ - */ -#define SMWDTHROSC_STCV0_STCV0 0x000000FF /**< ST capture bits [7:0] */ -#define SMWDTHROSC_STCV1_STCV1 0x000000FF /**< ST capture bits [15:8] */ -#define SMWDTHROSC_STCV2_STCV2 0x000000FF /**< ST capture bits [23:16] */ -#define SMWDTHROSC_STCV3_STCV3 0x000000FF /**< ST capture bits [32:24] */ -/** @} */ - -#endif /* SMWDTHROSC_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/soc-adc.h b/arch/cpu/cc2538/dev/soc-adc.h deleted file mode 100644 index 28bb508b3..000000000 --- a/arch/cpu/cc2538/dev/soc-adc.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-soc-adc cc2538 ADC and RNG - * - * Register declarations for the cc2538 ADC and H/W RNG - * @{ - * - * \file - * Header file with register declarations for the cc2538 ADC and H/W RNG - */ -#ifndef SOC_ADC_H_ -#define SOC_ADC_H_ -/*---------------------------------------------------------------------------*/ -/** \name ADC and RNG Register offset declarations - * @{ - */ -#define SOC_ADC_ADCCON1 0x400D7000 /**< ADC Control 1 */ -#define SOC_ADC_ADCCON2 0x400D7004 /**< ADC Control 2 */ -#define SOC_ADC_ADCCON3 0x400D7008 /**< ADC Control 3 */ -#define SOC_ADC_ADCL 0x400D700C /**< ADC Result, least significant part */ -#define SOC_ADC_ADCH 0x400D7010 /**< ADC Result, most significant part */ -#define SOC_ADC_RNDL 0x400D7014 /**< RNG low byte */ -#define SOC_ADC_RNDH 0x400D7018 /**< RNG high byte */ -#define SOC_ADC_CMPCTL 0x400D7024 /**< Analog comparator control and status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SOC_ADC_ADCCON1 register bit masks - * @{ - */ -#define SOC_ADC_ADCCON1_EOC 0x00000080 /**< End of conversion */ -#define SOC_ADC_ADCCON1_ST 0x00000040 /**< Start conversion */ -#define SOC_ADC_ADCCON1_STSEL 0x00000030 /**< Start select */ -#define SOC_ADC_ADCCON1_RCTRL 0x0000000C /**< Controls the 16-bit RNG */ -#define SOC_ADC_ADCCON1_RCTRL1 0x00000008 /**< RCTRL high bit */ -#define SOC_ADC_ADCCON1_RCTRL0 0x00000004 /**< RCTRL low bit */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SOC_ADC_ADCCON2 register bit masks - * @{ - */ -#define SOC_ADC_ADCCON2_SREF 0x000000C0 /**< Reference voltage for sequence */ -#define SOC_ADC_ADCCON2_SDIV 0x00000030 /**< Decimation rate for sequence */ -#define SOC_ADC_ADCCON2_SCH 0x0000000F /**< Sequence channel select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SOC_ADC_ADCCON3 register bit masks - * @{ - */ -#define SOC_ADC_ADCCON3_EREF 0x000000C0 /**< Reference voltage for extra */ -#define SOC_ADC_ADCCON3_EDIV 0x00000030 /**< Decimation rate for extra */ -#define SOC_ADC_ADCCON3_ECH 0x0000000F /**< Single channel select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SOC_ADC_ADCCONx registers field values - * @{ - */ -#define SOC_ADC_ADCCON_REF_INT (0 << 6) /**< Internal reference */ -#define SOC_ADC_ADCCON_REF_EXT_SINGLE (1 << 6) /**< External reference on AIN7 pin */ -#define SOC_ADC_ADCCON_REF_AVDD5 (2 << 6) /**< AVDD5 pin */ -#define SOC_ADC_ADCCON_REF_EXT_DIFF (3 << 6) /**< External reference on AIN6-AIN7 differential input */ -#define SOC_ADC_ADCCON_DIV_64 (0 << 4) /**< 64 decimation rate (7 bits ENOB) */ -#define SOC_ADC_ADCCON_DIV_128 (1 << 4) /**< 128 decimation rate (9 bits ENOB) */ -#define SOC_ADC_ADCCON_DIV_256 (2 << 4) /**< 256 decimation rate (10 bits ENOB) */ -#define SOC_ADC_ADCCON_DIV_512 (3 << 4) /**< 512 decimation rate (12 bits ENOB) */ -#define SOC_ADC_ADCCON_CH_AIN0 0x0 /**< AIN0 */ -#define SOC_ADC_ADCCON_CH_AIN1 0x1 /**< AIN1 */ -#define SOC_ADC_ADCCON_CH_AIN2 0x2 /**< AIN2 */ -#define SOC_ADC_ADCCON_CH_AIN3 0x3 /**< AIN3 */ -#define SOC_ADC_ADCCON_CH_AIN4 0x4 /**< AIN4 */ -#define SOC_ADC_ADCCON_CH_AIN5 0x5 /**< AIN5 */ -#define SOC_ADC_ADCCON_CH_AIN6 0x6 /**< AIN6 */ -#define SOC_ADC_ADCCON_CH_AIN7 0x7 /**< AIN7 */ -#define SOC_ADC_ADCCON_CH_AIN0_AIN1 0x8 /**< AIN0-AIN1 */ -#define SOC_ADC_ADCCON_CH_AIN2_AIN3 0x9 /**< AIN2-AIN3 */ -#define SOC_ADC_ADCCON_CH_AIN4_AIN5 0xA /**< AIN4-AIN5 */ -#define SOC_ADC_ADCCON_CH_AIN6_AIN7 0xB /**< AIN6-AIN7 */ -#define SOC_ADC_ADCCON_CH_GND 0xC /**< GND */ -#define SOC_ADC_ADCCON_CH_TEMP 0xE /**< Temperature sensor */ -#define SOC_ADC_ADCCON_CH_VDD_3 0xF /**< VDD/3 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SOC_ADC_ADC[L:H] register bit masks - * @{ - */ -#define SOC_ADC_ADCL_ADC 0x000000FC /**< ADC Result, least significant part */ -#define SOC_ADC_ADCH_ADC 0x000000FF /**< ADC Result, most significant part */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SOC_ADC_RND[L:H] register bit masks - * @{ - */ -#define SOC_ADC_RNDL_RNDL 0x000000FF /**< Random value/seed or CRC result low byte */ -#define SOC_ADC_RNDH_RNDH 0x000000FF /**< Random value or CRC result/input data, high byte */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SOC_ADC_CMPCTL register bit masks - * @{ - */ -#define SOC_ADC_CMPCTL_EN 0x00000002 /**< Comparator enable */ -#define SOC_ADC_CMPCTL_OUTPUT 0x00000001 /**< Comparator output */ -/** @} */ - -#endif /* SOC_ADC_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/spi-arch-legacy.h b/arch/cpu/cc2538/dev/spi-arch-legacy.h deleted file mode 100644 index 9608110ed..000000000 --- a/arch/cpu/cc2538/dev/spi-arch-legacy.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2013, University of Michigan. - * - * Copyright (c) 2015, Weptech elektronik GmbH - * Author: Ulf Knoblich, ulf.knoblich@weptech.de - * - * 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 University 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc2538-spi - * @{ - * - * \file - * Header file for the cc2538 SPI driver, including macros for the - * implementation of the low-level SPI primitives such as waiting for the TX - * FIFO to be ready, inserting into the TX FIFO, etc. - * - * It supports the usage of SSI_NUM_INSTANCES instances by providing new - * functions calls like - * - * - spix_init(uint8_t instance) - * - spix_enable(uint8_t instance) - * - spix_disable(uint8_t instance) - * - spix_set_mode(unit8_t instance, ...) - * - * and new macros like - * - * - SPIX_WAITFORTxREADY(x) - * - SPIX_WAITFOREOTx(x) - * - SPIX_WAITFOREORx(x) - * - SPIX_FLUSH(x) - * - * Some of the old functions and macros are still supported. - * When using these deprecated functions, the SSI module to use - * has to be be selected by means of the macro SPI_CONF_DEFAULT_INSTANCE. - * - * This SPI driver depends on the following defines: - * - * For the SSI0 module: - * - * - SPI0_CKL_PORT - * - SPI0_CLK_PIN - * - SPI0_TX_PORT - * - SPI0_TX_PIN - * - SPI0_RX_PORT - * - SPI0_RX_PIN - * - * For the SSI1 module: - * - * - SPI1_CKL_PORT - * - SPI1_CLK_PIN - * - SPI1_TX_PORT - * - SPI1_TX_PIN - * - SPI1_RX_PORT - * - SPI1_RX_PIN - */ -#ifndef SPI_ARCH_LEGACY_H_ -#define SPI_ARCH_LEGACY_H_ - -#include "contiki.h" - -#include "dev/ssi.h" -/*---------------------------------------------------------------------------*/ -/* The SPI instance to use when using the deprecated SPI API. */ -#ifdef SPI_CONF_DEFAULT_INSTANCE -#if SPI_CONF_DEFAULT_INSTANCE > (SSI_INSTANCE_COUNT - 1) -#error Invalid SPI_CONF_DEFAULT_INSTANCE: valid values are 0 and 1 -#else -#define SPI_DEFAULT_INSTANCE SPI_CONF_DEFAULT_INSTANCE -#endif -#endif -/*---------------------------------------------------------------------------*/ -/* Default values for the clock rate divider */ -#ifdef SPI0_CONF_CPRS_CPSDVSR -#define SPI0_CPRS_CPSDVSR SPI0_CONF_CPRS_CPSDVSR -#else -#define SPI0_CPRS_CPSDVSR 2 -#endif - -#ifdef SPI1_CONF_CPRS_CPSDVSR -#define SPI1_CPRS_CPSDVSR SPI1_CONF_CPRS_CPSDVSR -#else -#define SPI1_CPRS_CPSDVSR 2 -#endif -/*---------------------------------------------------------------------------*/ -/* New API macros */ -#define SPIX_WAITFORTxREADY(spi) do { \ - while(!(REG(SSI_BASE(spi) + SSI_SR) & SSI_SR_TNF)) ; \ -} while(0) -#define SPIX_BUF(spi) REG(SSI_BASE(spi) + SSI_DR) -#define SPIX_WAITFOREOTx(spi) do { \ - while(REG(SSI_BASE(spi) + SSI_SR) & SSI_SR_BSY) ; \ -} while(0) -#define SPIX_WAITFOREORx(spi) do { \ - while(!(REG(SSI_BASE(spi) + SSI_SR) & SSI_SR_RNE)) ; \ -} while(0) -#define SPIX_FLUSH(spi) do { \ - while(REG(SSI_BASE(spi) + SSI_SR) & SSI_SR_RNE) { \ - SPIX_BUF(spi); \ - } \ -} while(0) -#define SPIX_CS_CLR(port, pin) do { \ - GPIO_CLR_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); \ -} while(0) -#define SPIX_CS_SET(port, pin) do { \ - GPIO_SET_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); \ -} while(0) -/*---------------------------------------------------------------------------*/ -/* Deprecated macros provided for compatibility reasons */ -#ifdef SPI_DEFAULT_INSTANCE -#define SPI_WAITFORTxREADY() SPIX_WAITFORTxREADY(SPI_DEFAULT_INSTANCE) -#define SPI_TXBUF SPIX_BUF(SPI_DEFAULT_INSTANCE) -#define SPI_RXBUF SPI_TXBUF -#define SPI_WAITFOREOTx() SPIX_WAITFOREOTx(SPI_DEFAULT_INSTANCE) -#define SPI_WAITFOREORx() SPIX_WAITFOREORx(SPI_DEFAULT_INSTANCE) -#ifdef SPI_FLUSH -#error You must include spi-arch-legacy.h before spi-legacy.h for the CC2538 -#else -#define SPI_FLUSH() SPIX_FLUSH(SPI_DEFAULT_INSTANCE) -#endif -#define SPI_CS_CLR(port, pin) SPIX_CS_CLR(port, pin) -#define SPI_CS_SET(port, pin) SPIX_CS_SET(port, pin) -#endif /* #ifdef SPI_DEFAULT_INSTANCE */ -/*---------------------------------------------------------------------------*/ -/** \name Arch-specific SPI functions - * @{ - */ - -/** - * \brief Initialize the SPI bus for the instance given - * - * This sets the mode to Motorola SPI with the following format options: - * Clock phase: 1; data captured on second (rising) edge - * Clock polarity: 1; clock is high when idle - * Data size: 8 bits - * - * Use spix_set_mode() to change the spi mode. - */ -void spix_init(uint8_t spi); - -/** - * \brief Enables the SPI peripheral for the instance given - */ -void spix_enable(uint8_t spi); - -/** - * \brief Disables the SPI peripheral for the instance given - * \note Call this function to save power when the SPI is unused. - */ -void spix_disable(uint8_t spi); - -/** - * \brief Configure the SPI data and clock polarity and the data size for the - * instance given - * - * This function configures the SSI peripheral to use a particular SPI - * configuration that a slave device requires. It should always be called - * before using the SPI bus as another driver could have changed the settings. - * - * See section 19.4.4 in the CC2538 user guide for more information. - * - * \param spi The SSI instance to use. - * \param frame_format Set the SSI frame format. Use SSI_CR0_FRF_MOTOROLA, - * SSI_CR0_FRF_TI, or SSI_CR0_FRF_MICROWIRE. - * \param clock_polarity In Motorola mode, set whether the clock is high or low - * when idle. Use SSI_CR0_SPO or 0. - * \param clock_phase In Motorola mode, select whether data is valid on the - * first or second edge of the clock. Use SSI_CR0_SPH or 0. - * \param data_size The number of bits in each "byte" of data. Must be - * between 4 and 16, inclusive. - */ -void spix_set_mode(uint8_t spi, uint32_t frame_format, - uint32_t clock_polarity, uint32_t clock_phase, - uint32_t data_size); - -/** - * \brief Sets the SPI clock frequency of the given SSI instance. - * - * \param spi SSI instance - * \param freq Frequency (Hz) - */ -void spix_set_clock_freq(uint8_t spi, uint32_t freq); - -/** - * \brief Configure a GPIO to be the chip select pin. - * - * Even if this function does not depend on the SPI instance used, we rename - * it to reflect the new naming convention. - */ -void spix_cs_init(uint8_t port, uint8_t pin); - -/** @} */ - -#endif /* SPI_ARCH_LEGACY_H_ */ - -/** - * @} - */ diff --git a/arch/cpu/cc2538/dev/spi-arch.c b/arch/cpu/cc2538/dev/spi-arch.c deleted file mode 100644 index aae0ed797..000000000 --- a/arch/cpu/cc2538/dev/spi-arch.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (c) 2016-2017, Yanzi Networks. - * Copyright (c) 2018, University of Bristol. - * 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 HOLDER 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 -#include "contiki.h" -#include "reg.h" -#include "dev/spi.h" -#include "gpio-hal-arch.h" -#include "sys/cc.h" -#include "ioc.h" -#include "sys-ctrl.h" -#include "ssi.h" -#include "gpio.h" -#include "sys/log.h" -#include "sys/mutex.h" -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#define LOG_MODULE "spi-hal-arch" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -/* Default values for the clock rate divider */ -#ifdef SPI_ARCH_CONF_SPI0_CPRS_CPSDVSR -#define SPI_ARCH_SPI0_CPRS_CPSDVSR SPI_ARCH_CONF_SPI0_CPRS_CPSDVSR -#else -#define SPI_ARCH_SPI0_CPRS_CPSDVSR 2 -#endif - -#ifdef SPI_ARCH_CONF_SPI1_CPRS_CPSDVSR -#define SPI_ARCH_SPI1_CPRS_CPSDVSR SPI_ARCH_CONF_SPI1_CPRS_CPSDVSR -#else -#define SPI_ARCH_SPI1_CPRS_CPSDVSR 2 -#endif - -#if (SPI_ARCH_SPI0_CPRS_CPSDVSR & 1) == 1 || \ - SPI_ARCH_SPI0_CPRS_CPSDVSR < 2 || \ - SPI_ARCH_SPI0_CPRS_CPSDVSR > 254 -#error SPI_ARCH_SPI0_CPRS_CPSDVSR must be an even number between 2 and 254 -#endif - -#if (SPI_ARCH_SPI1_CPRS_CPSDVSR & 1) == 1 || \ - SPI_ARCH_SPI1_CPRS_CPSDVSR < 2 || \ - SPI_ARCH_SPI1_CPRS_CPSDVSR > 254 -#error SPI_ARCH_SPI1_CPRS_CPSDVSR must be an even number between 2 and 254 -#endif -/*---------------------------------------------------------------------------*/ -/* CS set and clear macros */ -#define SPIX_CS_CLR(port, pin) GPIO_CLR_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)) -#define SPIX_CS_SET(port, pin) GPIO_SET_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)) -/*---------------------------------------------------------------------------*/ -/* - * Clock source from which the baud clock is determined for the SSI, according - * to SSI_CC.CS. - */ -#define SSI_SYS_CLOCK SYS_CTRL_SYS_CLOCK -/*---------------------------------------------------------------------------*/ -typedef struct { - uint32_t base; - uint32_t ioc_ssirxd_ssi; - uint32_t ioc_pxx_sel_ssi_clkout; - uint32_t ioc_pxx_sel_ssi_txd; - uint8_t ssi_cprs_cpsdvsr; -} spi_regs_t; -/*---------------------------------------------------------------------------*/ -static const spi_regs_t spi_regs[SSI_INSTANCE_COUNT] = { - { - .base = SSI0_BASE, - .ioc_ssirxd_ssi = IOC_SSIRXD_SSI0, - .ioc_pxx_sel_ssi_clkout = IOC_PXX_SEL_SSI0_CLKOUT, - .ioc_pxx_sel_ssi_txd = IOC_PXX_SEL_SSI0_TXD, - .ssi_cprs_cpsdvsr = SPI_ARCH_SPI0_CPRS_CPSDVSR, - }, { - .base = SSI1_BASE, - .ioc_ssirxd_ssi = IOC_SSIRXD_SSI1, - .ioc_pxx_sel_ssi_clkout = IOC_PXX_SEL_SSI1_CLKOUT, - .ioc_pxx_sel_ssi_txd = IOC_PXX_SEL_SSI1_TXD, - .ssi_cprs_cpsdvsr = SPI_ARCH_SPI1_CPRS_CPSDVSR, - } -}; - -typedef struct spi_locks_s { - mutex_t lock; - const spi_device_t *owner; -} spi_locks_t; - -/* One lock per SPI controller */ -spi_locks_t board_spi_locks_spi[SPI_CONTROLLER_COUNT] = { { MUTEX_STATUS_UNLOCKED, NULL } }; - -/*---------------------------------------------------------------------------*/ -static void -spix_wait_tx_ready(const spi_device_t *dev) -{ - /* Infinite loop until SR_TNF - Transmit FIFO Not Full */ - while(!(REG(spi_regs[dev->spi_controller].base + SSI_SR) & SSI_SR_TNF)); -} -/*---------------------------------------------------------------------------*/ -static int -spix_read_buf(const spi_device_t *dev) -{ - return REG(spi_regs[dev->spi_controller].base + SSI_DR); -} -/*---------------------------------------------------------------------------*/ -static void -spix_write_buf(const spi_device_t *dev, int data) -{ - REG(spi_regs[dev->spi_controller].base + SSI_DR) = data; -} -/*---------------------------------------------------------------------------*/ -static void -spix_wait_eotx(const spi_device_t *dev) -{ - /* wait until not busy */ - while(REG(spi_regs[dev->spi_controller].base + SSI_SR) & SSI_SR_BSY); -} -/*---------------------------------------------------------------------------*/ -static void -spix_wait_eorx(const spi_device_t *dev) -{ - /* wait as long as receive is empty */ - while(!(REG(spi_regs[dev->spi_controller].base + SSI_SR) & SSI_SR_RNE)); -} -/*---------------------------------------------------------------------------*/ -bool -spi_arch_has_lock(const spi_device_t *dev) -{ - if(board_spi_locks_spi[dev->spi_controller].owner == dev) { - return true; - } - - return false; -} -/*---------------------------------------------------------------------------*/ -bool -spi_arch_is_bus_locked(const spi_device_t *dev) -{ - if(board_spi_locks_spi[dev->spi_controller].lock == MUTEX_STATUS_LOCKED) { - return true; - } - - return false; -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_arch_lock_and_open(const spi_device_t *dev) -{ - const spi_regs_t *regs; - uint32_t scr; - uint64_t div; - - uint32_t cs_port = PIN_TO_PORT(dev->pin_spi_cs); - uint32_t cs_pin = PIN_TO_NUM(dev->pin_spi_cs); - - uint32_t clk_port = PIN_TO_PORT(dev->pin_spi_sck); - uint32_t clk_pin = PIN_TO_NUM(dev->pin_spi_sck); - - uint32_t miso_port = PIN_TO_PORT(dev->pin_spi_miso); - uint32_t miso_pin = PIN_TO_NUM(dev->pin_spi_miso); - - uint32_t mosi_port = PIN_TO_PORT(dev->pin_spi_mosi); - uint32_t mosi_pin = PIN_TO_NUM(dev->pin_spi_mosi); - - uint32_t mode = 0; - - /* lock the SPI bus */ - if(mutex_try_lock(&board_spi_locks_spi[dev->spi_controller].lock) == false) { - return SPI_DEV_STATUS_BUS_LOCKED; - } - - board_spi_locks_spi[dev->spi_controller].owner = dev; - - /* Set SPI phase */ - if(dev->spi_pha != 0) { - mode = mode | SSI_CR0_SPH; - } - - /* Set SPI polarity */ - if(dev->spi_pol != 0) { - mode = mode | SSI_CR0_SPO; - } - - /* CS pin configuration */ - GPIO_SOFTWARE_CONTROL(GPIO_PORT_TO_BASE(cs_port), - GPIO_PIN_MASK(cs_pin)); - ioc_set_over(cs_port, cs_pin, IOC_OVERRIDE_DIS); - GPIO_SET_OUTPUT(GPIO_PORT_TO_BASE(cs_port), GPIO_PIN_MASK(cs_pin)); - GPIO_SET_PIN(GPIO_PORT_TO_BASE(cs_port), GPIO_PIN_MASK(cs_pin)); - - regs = &spi_regs[dev->spi_controller]; - - /* SSI Enable */ - REG(SYS_CTRL_RCGCSSI) |= (1 << dev->spi_controller); - - /* Start by disabling the peripheral before configuring it */ - REG(regs->base + SSI_CR1) = 0; - - /* Set the system clock as the SSI clock */ - REG(regs->base + SSI_CC) = 0; - - /* Set the mux correctly to connect the SSI pins to the correct GPIO pins */ - ioc_set_sel(clk_port, clk_pin, regs->ioc_pxx_sel_ssi_clkout); - ioc_set_sel(mosi_port, mosi_pin, regs->ioc_pxx_sel_ssi_txd); - REG(regs->ioc_ssirxd_ssi) = dev->pin_spi_miso; - - /* Put all the SSI gpios into peripheral mode */ - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(clk_port), - GPIO_PIN_MASK(clk_pin)); - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(mosi_port), - GPIO_PIN_MASK(mosi_pin)); - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(miso_port), - GPIO_PIN_MASK(miso_pin)); - - /* Disable any pull ups or the like */ - ioc_set_over(clk_port, clk_pin, IOC_OVERRIDE_DIS); - ioc_set_over(mosi_port, mosi_pin, IOC_OVERRIDE_DIS); - ioc_set_over(miso_port, miso_pin, IOC_OVERRIDE_DIS); - - /* Configure the clock */ - REG(regs->base + SSI_CPSR) = regs->ssi_cprs_cpsdvsr; - - /* Configure the mode */ - REG(regs->base + SSI_CR0) = mode | (0x07); - - /* Configure the SSI serial clock rate */ - if(!dev->spi_bit_rate) { - scr = 255; - } else { - div = (uint64_t)regs->ssi_cprs_cpsdvsr * dev->spi_bit_rate; - scr = (SSI_SYS_CLOCK + div - 1) / div; - scr = MIN(MAX(scr, 1), 256) - 1; - } - REG(regs->base + SSI_CR0) = (REG(regs->base + SSI_CR0) & ~SSI_CR0_SCR_M) | - scr << SSI_CR0_SCR_S; - - /* Enable the SSI */ - REG(regs->base + SSI_CR1) |= SSI_CR1_SSE; - - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_arch_close_and_unlock(const spi_device_t *dev) -{ - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_NOT_OWNED; - } - - /* Disable SSI */ - REG(SYS_CTRL_RCGCSSI) &= ~(1 << dev->spi_controller); - - /* Unlock the SPI bus */ - board_spi_locks_spi[dev->spi_controller].owner = NULL; - mutex_unlock(&board_spi_locks_spi[dev->spi_controller].lock); - - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -/* Assumes that checking dev and bus is not NULL before calling this */ -spi_status_t -spi_arch_transfer(const spi_device_t *dev, - const uint8_t *write_buf, int wlen, - uint8_t *inbuf, int rlen, int ignore_len) -{ - int i; - int totlen; - uint8_t c; - - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_NOT_OWNED; - } - - LOG_DBG("SPI: transfer (r:%d,w:%d) ", rlen, wlen); - - if(write_buf == NULL && wlen > 0) { - return SPI_DEV_STATUS_EINVAL; - } - if(inbuf == NULL && rlen > 0) { - return SPI_DEV_STATUS_EINVAL; - } - - totlen = MAX(rlen + ignore_len, wlen); - - if(totlen == 0) { - /* Nothing to do */ - return SPI_DEV_STATUS_OK; - } - - LOG_DBG_("%c%c%c: %u ", rlen > 0 ? 'R' : '-', wlen > 0 ? 'W' : '-', - ignore_len > 0 ? 'S' : '-', totlen); - - for(i = 0; i < totlen; i++) { - spix_wait_tx_ready(dev); - c = i < wlen ? write_buf[i] : 0; - spix_write_buf(dev, c); - LOG_DBG_("%c%02x->", i < rlen ? ' ' : '#', c); - spix_wait_eotx(dev); - spix_wait_eorx(dev); - c = spix_read_buf(dev); - if(i < rlen) { - inbuf[i] = c; - } - LOG_DBG_("%02x", c); - } - LOG_DBG_("\n"); - - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc2538/dev/spi-legacy.c b/arch/cpu/cc2538/dev/spi-legacy.c deleted file mode 100644 index 0070df6ef..000000000 --- a/arch/cpu/cc2538/dev/spi-legacy.c +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Copyright (c) 2013, University of Michigan. - * - * Copyright (c) 2015, Weptech elektronik GmbH - * Author: Ulf Knoblich, ulf.knoblich@weptech.de - * - * 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 University 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc2538-spi - * @{ - * - * \file - * Implementation of the cc2538 SPI peripheral driver - */ -#include "contiki.h" -#include "reg.h" -#include "dev/spi-arch-legacy.h" -#include "sys/cc.h" -#include "dev/ioc.h" -#include "dev/sys-ctrl.h" -#include "dev/spi-legacy.h" -#include "dev/ssi.h" -#include "dev/gpio.h" -/*---------------------------------------------------------------------------*/ -/* Check port / pin settings for SPI0 and provide default values for spi_cfg */ -#ifndef SPI0_CLK_PORT -#define SPI0_CLK_PORT (-1) -#endif -#ifndef SPI0_CLK_PIN -#define SPI0_CLK_PIN (-1) -#endif -#if SPI0_CLK_PORT >= 0 && SPI0_CLK_PIN < 0 || \ - SPI0_CLK_PORT < 0 && SPI0_CLK_PIN >= 0 -#error Both SPI0_CLK_PORT and SPI0_CLK_PIN must be valid or invalid -#endif - -#ifndef SPI0_TX_PORT -#define SPI0_TX_PORT (-1) -#endif -#ifndef SPI0_TX_PIN -#define SPI0_TX_PIN (-1) -#endif -#if SPI0_TX_PORT >= 0 && SPI0_TX_PIN < 0 || \ - SPI0_TX_PORT < 0 && SPI0_TX_PIN >= 0 -#error Both SPI0_TX_PORT and SPI0_TX_PIN must be valid or invalid -#endif - -#ifndef SPI0_RX_PORT -#define SPI0_RX_PORT (-1) -#endif -#ifndef SPI0_RX_PIN -#define SPI0_RX_PIN (-1) -#endif -#if SPI0_RX_PORT >= 0 && SPI0_RX_PIN < 0 || \ - SPI0_RX_PORT < 0 && SPI0_RX_PIN >= 0 -#error Both SPI0_RX_PORT and SPI0_RX_PIN must be valid or invalid -#endif - -/* Here we check that either all or none of the ports are defined. As - we did already check that both ports + pins are either defined or - not for every pin, this means that we can check for an incomplete - configuration by only looking at the port defines */ -/* If some SPI0 pads are valid */ -#if SPI0_CLK_PORT >= 0 || SPI0_TX_PORT >= 0 || SPI0_RX_PORT >= 0 -/* but not all */ -#if SPI0_CLK_PORT < 0 || SPI0_TX_PORT < 0 || SPI0_RX_PORT < 0 -#error Some SPI0 pad definitions are invalid -#endif -#define SPI0_PADS_VALID -#endif -/*---------------------------------------------------------------------------*/ -/* Check port / pin settings for SPI1 and provide default values for spi_cfg */ -#ifndef SPI1_CLK_PORT -#define SPI1_CLK_PORT (-1) -#endif -#ifndef SPI1_CLK_PIN -#define SPI1_CLK_PIN (-1) -#endif -#if SPI1_CLK_PORT >= 0 && SPI1_CLK_PIN < 0 || \ - SPI1_CLK_PORT < 0 && SPI1_CLK_PIN >= 0 -#error Both SPI1_CLK_PORT and SPI1_CLK_PIN must be valid or invalid -#endif - -#ifndef SPI1_TX_PORT -#define SPI1_TX_PORT (-1) -#endif -#ifndef SPI1_TX_PIN -#define SPI1_TX_PIN (-1) -#endif -#if SPI1_TX_PORT >= 0 && SPI1_TX_PIN < 0 || \ - SPI1_TX_PORT < 0 && SPI1_TX_PIN >= 0 -#error Both SPI1_TX_PORT and SPI1_TX_PIN must be valid or invalid -#endif - -#ifndef SPI1_RX_PORT -#define SPI1_RX_PORT (-1) -#endif -#ifndef SPI1_RX_PIN -#define SPI1_RX_PIN (-1) -#endif -#if SPI1_RX_PORT >= 0 && SPI1_RX_PIN < 0 || \ - SPI1_RX_PORT < 0 && SPI1_RX_PIN >= 0 -#error Both SPI1_RX_PORT and SPI1_RX_PIN must be valid or invalid -#endif - -/* If some SPI1 pads are valid */ -#if SPI1_CLK_PORT >= 0 || SPI1_TX_PORT >= 0 || SPI1_RX_PORT >= 0 -/* but not all */ -#if SPI1_CLK_PORT < 0 || SPI1_TX_PORT < 0 || SPI1_RX_PORT < 0 -#error Some SPI1 pad definitions are invalid -#endif -#define SPI1_PADS_VALID -#endif - -#ifdef SPI_DEFAULT_INSTANCE -#if SPI_DEFAULT_INSTANCE == 0 -#ifndef SPI0_PADS_VALID -#error SPI_DEFAULT_INSTANCE is set to SPI0, but its pads are not valid -#endif -#elif SPI_DEFAULT_INSTANCE == 1 -#ifndef SPI1_PADS_VALID -#error SPI_DEFAULT_INSTANCE is set to SPI1, but its pads are not valid -#endif -#endif -#endif - -#if (SPI0_CPRS_CPSDVSR & 1) == 1 || SPI0_CPRS_CPSDVSR < 2 || SPI0_CPRS_CPSDVSR > 254 -#error SPI0_CPRS_CPSDVSR must be an even number between 2 and 254 -#endif - -#if (SPI1_CPRS_CPSDVSR & 1) == 1 || SPI1_CPRS_CPSDVSR < 2 || SPI1_CPRS_CPSDVSR > 254 -#error SPI1_CPRS_CPSDVSR must be an even number between 2 and 254 -#endif -/*---------------------------------------------------------------------------*/ -/* - * Clock source from which the baud clock is determined for the SSI, according - * to SSI_CC.CS. - */ -#define SSI_SYS_CLOCK SYS_CTRL_SYS_CLOCK -/*---------------------------------------------------------------------------*/ -typedef struct { - int8_t port; - int8_t pin; -} spi_pad_t; -typedef struct { - uint32_t base; - uint32_t ioc_ssirxd_ssi; - uint32_t ioc_pxx_sel_ssi_clkout; - uint32_t ioc_pxx_sel_ssi_txd; - uint8_t ssi_cprs_cpsdvsr; - spi_pad_t clk; - spi_pad_t tx; - spi_pad_t rx; -} spi_regs_t; -/*---------------------------------------------------------------------------*/ -static const spi_regs_t spi_regs[SSI_INSTANCE_COUNT] = { - { - .base = SSI0_BASE, - .ioc_ssirxd_ssi = IOC_SSIRXD_SSI0, - .ioc_pxx_sel_ssi_clkout = IOC_PXX_SEL_SSI0_CLKOUT, - .ioc_pxx_sel_ssi_txd = IOC_PXX_SEL_SSI0_TXD, - .ssi_cprs_cpsdvsr = SPI0_CPRS_CPSDVSR, - .clk = { SPI0_CLK_PORT, SPI0_CLK_PIN }, - .tx = { SPI0_TX_PORT, SPI0_TX_PIN }, - .rx = { SPI0_RX_PORT, SPI0_RX_PIN } - }, { - .base = SSI1_BASE, - .ioc_ssirxd_ssi = IOC_SSIRXD_SSI1, - .ioc_pxx_sel_ssi_clkout = IOC_PXX_SEL_SSI1_CLKOUT, - .ioc_pxx_sel_ssi_txd = IOC_PXX_SEL_SSI1_TXD, - .ssi_cprs_cpsdvsr = SPI1_CPRS_CPSDVSR, - .clk = { SPI1_CLK_PORT, SPI1_CLK_PIN }, - .tx = { SPI1_TX_PORT, SPI1_TX_PIN }, - .rx = { SPI1_RX_PORT, SPI1_RX_PIN } - } -}; -/*---------------------------------------------------------------------------*/ -/* Deprecated function call provided for compatibility reasons */ -#ifdef SPI_DEFAULT_INSTANCE -void -spi_init(void) -{ - spix_init(SPI_DEFAULT_INSTANCE); -} -#endif /* #ifdef SPI_DEFAULT_INSTANCE */ -/*---------------------------------------------------------------------------*/ -void -spix_init(uint8_t spi) -{ - const spi_regs_t *regs; - - if(spi >= SSI_INSTANCE_COUNT) { - return; - } - - regs = &spi_regs[spi]; - - if(regs->clk.port < 0) { - /* Port / pin configuration invalid. We checked for completeness - above. If clk.port is < 0, this means that all other defines are - < 0 as well */ - return; - } - - spix_enable(spi); - - /* Start by disabling the peripheral before configuring it */ - REG(regs->base + SSI_CR1) = 0; - - /* Set the system clock as the SSI clock */ - REG(regs->base + SSI_CC) = 0; - - /* Set the mux correctly to connect the SSI pins to the correct GPIO pins */ - ioc_set_sel(regs->clk.port, - regs->clk.pin, - regs->ioc_pxx_sel_ssi_clkout); - ioc_set_sel(regs->tx.port, - regs->tx.pin, - regs->ioc_pxx_sel_ssi_txd); - REG(regs->ioc_ssirxd_ssi) = (regs->rx.port * 8) + regs->rx.pin; - - /* Put all the SSI gpios into peripheral mode */ - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(regs->clk.port), - GPIO_PIN_MASK(regs->clk.pin)); - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(regs->tx.port), - GPIO_PIN_MASK(regs->tx.pin)); - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(regs->rx.port), - GPIO_PIN_MASK(regs->rx.pin)); - - /* Disable any pull ups or the like */ - ioc_set_over(regs->clk.port, regs->clk.pin, IOC_OVERRIDE_DIS); - ioc_set_over(regs->tx.port, regs->tx.pin, IOC_OVERRIDE_DIS); - ioc_set_over(regs->rx.port, regs->rx.pin, IOC_OVERRIDE_DIS); - - /* Configure the clock */ - REG(regs->base + SSI_CPSR) = regs->ssi_cprs_cpsdvsr; - - /* - * Configure the default SPI options. - * mode: Motorola frame format - * clock: High when idle - * data: Valid on rising edges of the clock - * bits: 8 byte data - */ - REG(regs->base + SSI_CR0) = SSI_CR0_SPH | SSI_CR0_SPO | (0x07); - - /* Enable the SSI */ - REG(regs->base + SSI_CR1) |= SSI_CR1_SSE; -} -/*---------------------------------------------------------------------------*/ -void -spix_enable(uint8_t spi) -{ - if(spi >= SSI_INSTANCE_COUNT) { - return; - } - REG(SYS_CTRL_RCGCSSI) |= (1 << spi); -} -/*---------------------------------------------------------------------------*/ -void -spix_disable(uint8_t spi) -{ - if(spi >= SSI_INSTANCE_COUNT) { - return; - } - REG(SYS_CTRL_RCGCSSI) &= ~(1 << spi); -} -/*---------------------------------------------------------------------------*/ -void -spix_set_mode(uint8_t spi, - uint32_t frame_format, - uint32_t clock_polarity, - uint32_t clock_phase, - uint32_t data_size) -{ - const spi_regs_t *regs; - - if(spi >= SSI_INSTANCE_COUNT) { - return; - } - - regs = &spi_regs[spi]; - - /* Disable the SSI peripheral to configure it */ - REG(regs->base + SSI_CR1) = 0; - - /* Configure the SSI options */ - REG(regs->base + SSI_CR0) = clock_phase | - clock_polarity | - frame_format | - (data_size - 1); - - /* Re-enable the SSI */ - REG(regs->base + SSI_CR1) |= SSI_CR1_SSE; -} -/*---------------------------------------------------------------------------*/ -void -spix_set_clock_freq(uint8_t spi, uint32_t freq) -{ - const spi_regs_t *regs; - uint64_t div; - uint32_t scr; - - if(spi >= SSI_INSTANCE_COUNT) { - return; - } - - regs = &spi_regs[spi]; - - /* Disable the SSI peripheral to configure it */ - REG(regs->base + SSI_CR1) = 0; - - /* Configure the SSI serial clock rate */ - if(!freq) { - scr = 255; - } else { - div = (uint64_t)regs->ssi_cprs_cpsdvsr * freq; - scr = (SSI_SYS_CLOCK + div - 1) / div; - scr = MIN(MAX(scr, 1), 256) - 1; - } - REG(regs->base + SSI_CR0) = (REG(regs->base + SSI_CR0) & ~SSI_CR0_SCR_M) | - scr << SSI_CR0_SCR_S; - - /* Re-enable the SSI */ - REG(regs->base + SSI_CR1) |= SSI_CR1_SSE; -} -/*---------------------------------------------------------------------------*/ -void -spix_cs_init(uint8_t port, uint8_t pin) -{ - GPIO_SOFTWARE_CONTROL(GPIO_PORT_TO_BASE(port), - GPIO_PIN_MASK(pin)); - ioc_set_over(port, pin, IOC_OVERRIDE_DIS); - GPIO_SET_OUTPUT(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - GPIO_SET_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); -} -/** @} */ diff --git a/arch/cpu/cc2538/dev/ssi.h b/arch/cpu/cc2538/dev/ssi.h deleted file mode 100644 index 5f7abf0af..000000000 --- a/arch/cpu/cc2538/dev/ssi.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2013, University of Michigan. - * 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 University 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-spi cc2538 Synchronous Serial Interface - * - * Driver for the cc2538 SPI peripheral - * - * Register and bitmask definitions based on the Foundation Firmware from - * Texas Instruments. - * @{ - * - * \file - * Header file for the cc2538 Synchronous Serial Interface - */ - -#ifndef SSI_H_ -#define SSI_H_ - -/*---------------------------------------------------------------------------*/ -/** \name Number of SSI instances supported by this CPU. - * @{ - */ -#define SSI_INSTANCE_COUNT 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Base register memory locations. - * @{ - */ -#define SSI0_BASE 0x40008000 /**< Base address for SSI0 */ -#define SSI1_BASE 0x40009000 /**< Base address for SSI1 */ -/** Base address of the \c dev instance of the SSI */ -#define SSI_BASE(dev) (SSI0_BASE + (dev) * (SSI1_BASE - SSI0_BASE)) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SSI register offsets - * @{ - */ -#define SSI_CR0 0x00000000 /**< Control register 0 */ -#define SSI_CR1 0x00000004 /**< Control register 1 */ -#define SSI_DR 0x00000008 /**< Access the TX and RX FIFO */ -#define SSI_SR 0x0000000C /**< Meta information about FIFO */ -#define SSI_CPSR 0x00000010 /**< Clock divider */ -#define SSI_IM 0x00000014 /**< Interrupt mask */ -#define SSI_RIS 0x00000018 /**< Raw interrupt status */ -#define SSI_MIS 0x0000001C /**< Masked interrupt status */ -#define SSI_ICR 0x00000020 /**< Interrupt clear register */ -#define SSI_DMACTL 0x00000024 /**< DMA control register */ -#define SSI_CC 0x00000FC8 /**< Clock configuration */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SSI Bitmasks and shifts - * @{ - */ -#define SSI_CR0_SCR_M 0x0000FF00 /**< Serial clock rate mask */ -#define SSI_CR0_SCR_S 8 /**< Serial clock rate shift */ -#define SSI_CR0_SPH_M 0x00000080 /**< Serial clock phase (H) mask */ -#define SSI_CR0_SPH_S 7 /**< Serial clock phase (H) shift */ -#define SSI_CR0_SPO_M 0x00000040 /**< Serial clock phase (O) mask */ -#define SSI_CR0_SPO_S 6 /**< Serial clock phase (O) shift */ -#define SSI_CR0_FRF_M 0x00000030 /**< Frame format select mask */ -#define SSI_CR0_FRF_S 4 /**< Frame format select shift */ -#define SSI_CR0_DSS_M 0x0000000F /**< Data size select mask */ -#define SSI_CR0_DSS_S 0 /**< Data size select shift */ -#define SSI_CR1_SOD_M 0x00000008 /**< Slave mode output disable mask */ -#define SSI_CR1_SOD_S 3 /**< Slave mode output disable shift */ -#define SSI_CR1_MS_M 0x00000004 /**< Master and slave select mask */ -#define SSI_CR1_MS_S 2 /**< Master and slave select shift */ -#define SSI_CR1_SSE_M 0x00000002 /**< Synchronous serial port enable mask */ -#define SSI_CR1_SSE_S 1 /**< Synchronous serial port enable shift */ -#define SSI_CR1_LBM_M 0x00000001 /**< Loop-back mode mask */ -#define SSI_CR1_LBM_S 0 /**< Loop-back mode shift */ -#define SSI_DR_DATA_M 0x0000FFFF /**< FIFO data mask */ -#define SSI_DR_DATA_S 0 /**< FIFO data shift */ -#define SSI_SR_BSY_M 0x00000010 /**< Busy bit mask */ -#define SSI_SR_BSY_S 4 /**< Busy bit shift */ -#define SSI_SR_RFF_M 0x00000008 /**< Receive FIFO full mask */ -#define SSI_SR_RFF_S 3 /**< Receive FIFO full shift */ -#define SSI_SR_RNE_M 0x00000004 /**< Receive FIFO not empty mask */ -#define SSI_SR_RNE_S 2 /**< Receive FIFO not empty shift */ -#define SSI_SR_TNF_M 0x00000002 /**< Transmit FIFO not full mask */ -#define SSI_SR_TNF_S 1 /**< Transmit FIFO not full shift */ -#define SSI_SR_TFE_M 0x00000001 /**< Transmit FIFO empty mask */ -#define SSI_SR_TFE_S 0 /**< Transmit FIFO empty shift */ -#define SSI_CPSR_CPSDVSR_M 0x000000FF /**< Clock prescale divisor mask */ -#define SSI_CPSR_CPSDVSR_S 0 /**< Clock prescale divisor shift */ -#define SSI_IM_TXIM_M 0x00000008 /**< Transmit FIFO interrupt mask mask */ -#define SSI_IM_TXIM_S 3 /**< Transmit FIFO interrupt mask shift */ -#define SSI_IM_RXIM_M 0x00000004 /**< Receive FIFO interrupt mask mask */ -#define SSI_IM_RXIM_S 2 /**< Receive FIFO interrupt mask shift */ -#define SSI_IM_RTIM_M 0x00000002 /**< Receive time-out interrupt mask mask */ -#define SSI_IM_RTIM_S 1 /**< Receive time-out interrupt mask shift */ -#define SSI_IM_RORIM_M 0x00000001 /**< Receive overrun interrupt mask mask */ -#define SSI_IM_RORIM_S 0 /**< Receive overrun interrupt mask shift */ -#define SSI_RIS_TXRIS_M 0x00000008 /**< SSITXINTR raw state mask */ -#define SSI_RIS_TXRIS_S 3 /**< SSITXINTR raw state shift */ -#define SSI_RIS_RXRIS_M 0x00000004 /**< SSIRXINTR raw state mask */ -#define SSI_RIS_RXRIS_S 2 /**< SSIRXINTR raw state shift */ -#define SSI_RIS_RTRIS_M 0x00000002 /**< SSIRTINTR raw state mask */ -#define SSI_RIS_RTRIS_S 1 /**< SSIRTINTR raw state shift */ -#define SSI_RIS_RORRIS_M 0x00000001 /**< SSIRORINTR raw state mask */ -#define SSI_RIS_RORRIS_S 0 /**< SSIRORINTR raw state shift */ -#define SSI_MIS_TXMIS_M 0x00000008 /**< SSITXINTR masked state mask */ -#define SSI_MIS_TXMIS_S 3 /**< SSITXINTR masked state shift */ -#define SSI_MIS_RXMIS_M 0x00000004 /**< SSIRXINTR masked state mask */ -#define SSI_MIS_RXMIS_S 2 /**< SSIRXINTR masked state shift */ -#define SSI_MIS_RTMIS_M 0x00000002 /**< SSIRTINTR masked state mask */ -#define SSI_MIS_RTMIS_S 1 /**< SSIRTINTR masked state shift */ -#define SSI_MIS_RORMIS_M 0x00000001 /**< SSIRORINTR masked state mask */ -#define SSI_MIS_RORMIS_S 0 /**< SSIRORINTR masked state shift */ -#define SSI_ICR_RTIC_M 0x00000002 /**< Receive time-out interrupt clear mask */ -#define SSI_ICR_RTIC_S 1 /**< Receive time-out interrupt clear shift */ -#define SSI_ICR_RORIC_M 0x00000001 /**< Receive overrun interrupt clear mask */ -#define SSI_ICR_RORIC_S 0 /**< Receive overrun interrupt clear shift */ -#define SSI_DMACTL_TXDMAE_M 0x00000002 /**< Transmit DMA enable mask */ -#define SSI_DMACTL_TXDMAE_S 1 /**< Transmit DMA enable shift */ -#define SSI_DMACTL_RXDMAE_M 0x00000001 /**< Receive DMA enable mask */ -#define SSI_DMACTL_RXDMAE_S 0 /**< Receive DMA enable shift */ -#define SSI_CC_CS_M 0x00000007 /**< Baud and system clock source mask */ -#define SSI_CC_CS_S 0 /**< Baud and system clock source shift */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SSI Register Values - * @{ - */ -#define SSI_CR0_SPH 0x00000080 /**< Serial clock phase (H) */ -#define SSI_CR0_SPO 0x00000040 /**< Serial clock phase (O) */ -#define SSI_CR0_FRF_MOTOROLA 0x00000000 /**< Motorola frame format */ -#define SSI_CR0_FRF_TI 0x00000010 /**< Texas Instruments frame format */ -#define SSI_CR0_FRF_MICROWIRE 0x00000020 /**< National Microwire frame format */ -#define SSI_CR1_SOD 0x00000008 /**< Slave mode output disable */ -#define SSI_CR1_MS 0x00000004 /**< Master and slave select */ -#define SSI_CR1_SSE 0x00000002 /**< Synchronous serial port enable */ -#define SSI_CR1_LBM 0x00000001 /**< Loop-back mode */ -#define SSI_SR_BSY 0x00000010 /**< Busy bit */ -#define SSI_SR_RFF 0x00000008 /**< Receive FIFO full */ -#define SSI_SR_RNE 0x00000004 /**< Receive FIFO not empty */ -#define SSI_SR_TNF 0x00000002 /**< Transmit FIFO not full */ -#define SSI_SR_TFE 0x00000001 /**< Transmit FIFO empty */ -#define SSI_IM_TXIM 0x00000008 /**< Transmit FIFO interrupt mask */ -#define SSI_IM_RXIM 0x00000004 /**< Receive FIFO interrupt mask */ -#define SSI_IM_RTIM 0x00000002 /**< Receive time-out interrupt mask */ -#define SSI_IM_RORIM 0x00000001 /**< Receive overrun interrupt mask */ -#define SSI_RIS_TXRIS 0x00000008 /**< SSITXINTR raw state */ -#define SSI_RIS_RXRIS 0x00000004 /**< SSIRXINTR raw state */ -#define SSI_RIS_RTRIS 0x00000002 /**< SSIRTINTR raw state */ -#define SSI_RIS_RORRIS 0x00000001 /**< SSIRORINTR raw state */ -#define SSI_MIS_TXMIS 0x00000008 /**< SSITXINTR masked state */ -#define SSI_MIS_RXMIS 0x00000004 /**< SSIRXINTR masked state */ -#define SSI_MIS_RTMIS 0x00000002 /**< SSIRTINTR masked state */ -#define SSI_MIS_RORMIS 0x00000001 /**< SSIRORINTR masked state */ -#define SSI_ICR_RTIC 0x00000002 /**< Receive time-out interrupt clear */ -#define SSI_ICR_RORIC 0x00000001 /**< Receive overrun interrupt clear */ -#define SSI_DMACTL_TXDMAE 0x00000002 /**< Transmit DMA enable */ -#define SSI_DMACTL_RXDMAE 0x00000001 /**< Receive DMA enable */ -/** @} */ - -#endif -/** - * @} - * @} - */ - diff --git a/arch/cpu/cc2538/dev/sys-ctrl.c b/arch/cpu/cc2538/dev/sys-ctrl.c deleted file mode 100644 index 92592b942..000000000 --- a/arch/cpu/cc2538/dev/sys-ctrl.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-sys-ctrl - * @{ - * - * \file - * Implementation of the cc2538 System Control driver - */ -#include "contiki.h" -#include "reg.h" -#include "cpu.h" -#include "dev/sys-ctrl.h" -#include "dev/gpio.h" -#include "dev/ioc.h" - -#include - -#if SYS_CTRL_OSC32K_USE_XTAL -#define SYS_CTRL_OSCS 0 -#else -#define SYS_CTRL_OSCS SYS_CTRL_CLOCK_CTRL_OSC32K -#endif -/*---------------------------------------------------------------------------*/ -int -sys_ctrl_get_reset_cause(void) -{ - return (REG(SYS_CTRL_CLOCK_STA) & SYS_CTRL_CLOCK_STA_RST) >> - SYS_CTRL_CLOCK_STA_RST_S; -} -/*---------------------------------------------------------------------------*/ -const char * -sys_ctrl_get_reset_cause_str(void) -{ - static const char *reset_cause[] = { - "POR", - "External reset", - "WDT", - "CLD or software reset" - }; - - return reset_cause[sys_ctrl_get_reset_cause()]; -} -/*---------------------------------------------------------------------------*/ -void -sys_ctrl_init() -{ - uint32_t val; - -#if SYS_CTRL_OSC32K_USE_XTAL - /* Set the XOSC32K_Q pads to analog for crystal */ - GPIO_SOFTWARE_CONTROL(GPIO_PORT_TO_BASE(GPIO_D_NUM), GPIO_PIN_MASK(6)); - GPIO_SET_INPUT(GPIO_PORT_TO_BASE(GPIO_D_NUM), GPIO_PIN_MASK(6)); - ioc_set_over(GPIO_D_NUM, 6, IOC_OVERRIDE_ANA); - GPIO_SOFTWARE_CONTROL(GPIO_PORT_TO_BASE(GPIO_D_NUM), GPIO_PIN_MASK(7)); - GPIO_SET_INPUT(GPIO_PORT_TO_BASE(GPIO_D_NUM), GPIO_PIN_MASK(7)); - ioc_set_over(GPIO_D_NUM, 7, IOC_OVERRIDE_ANA); -#endif - - /* - * Desired Clock Ctrl configuration: - * 32KHz source: RC or crystal, according to SYS_CTRL_OSC32K_USE_XTAL - * System Clock: 32 MHz - * Power Down Unused - * I/O Div: according to SYS_CTRL_IO_DIV - * Sys Div: according to SYS_CTRL_SYS_DIV - * Rest: Don't care - */ - - val = SYS_CTRL_OSCS | SYS_CTRL_CLOCK_CTRL_OSC_PD - | SYS_CTRL_IO_DIV | SYS_CTRL_SYS_DIV; - REG(SYS_CTRL_CLOCK_CTRL) = val; - - while((REG(SYS_CTRL_CLOCK_STA) - & (SYS_CTRL_CLOCK_STA_OSC32K | SYS_CTRL_CLOCK_STA_OSC)) - != SYS_CTRL_OSCS); - -#if SYS_CTRL_OSC32K_USE_XTAL - /* Wait for the 32-kHz crystal oscillator to stabilize */ - while(REG(SYS_CTRL_CLOCK_STA) & SYS_CTRL_CLOCK_STA_SYNC_32K); - while(!(REG(SYS_CTRL_CLOCK_STA) & SYS_CTRL_CLOCK_STA_SYNC_32K)); -#endif -} -/*---------------------------------------------------------------------------*/ -void -sys_ctrl_reset() -{ - REG(SYS_CTRL_PWRDBG) = SYS_CTRL_PWRDBG_FORCE_WARM_RESET; -} -/*---------------------------------------------------------------------------*/ -uint32_t -sys_ctrl_get_sys_clock(void) -{ - return SYS_CTRL_32MHZ >> (REG(SYS_CTRL_CLOCK_STA) & - SYS_CTRL_CLOCK_STA_SYS_DIV); -} -/*---------------------------------------------------------------------------*/ -uint32_t -sys_ctrl_get_io_clock(void) -{ - return SYS_CTRL_32MHZ >> ((REG(SYS_CTRL_CLOCK_STA) & - SYS_CTRL_CLOCK_STA_IO_DIV) >> 8); -} -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/sys-ctrl.h b/arch/cpu/cc2538/dev/sys-ctrl.h deleted file mode 100644 index 22dece434..000000000 --- a/arch/cpu/cc2538/dev/sys-ctrl.h +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-sys-ctrl cc2538 System Control (SysCtrl) - * - * Driver for the cc2538 System Control Module - * @{ - * - * \file - * Header file for the cc2538 System Control driver - */ -#ifndef SYS_CTRL_H_ -#define SYS_CTRL_H_ - -#include -/*---------------------------------------------------------------------------*/ -/** \name SysCtrl Constants, used by the SYS_DIV and IO_DIV bits of the - * SYS_CTRL_CLOCK_CTRL register - * @{ - */ -#define SYS_CTRL_32MHZ 32000000 -#define SYS_CTRL_16MHZ 16000000 -#define SYS_CTRL_8MHZ 8000000 -#define SYS_CTRL_4MHZ 4000000 -#define SYS_CTRL_2MHZ 2000000 -#define SYS_CTRL_1MHZ 1000000 -#define SYS_CTRL_500KHZ 500000 -#define SYS_CTRL_250KHZ 250000 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Definitions of Sys Ctrl registers - * @{ - */ -#define SYS_CTRL_CLOCK_CTRL 0x400D2000 /**< Clock control register */ -#define SYS_CTRL_CLOCK_STA 0x400D2004 /**< Clock status register */ -#define SYS_CTRL_RCGCGPT 0x400D2008 /**< GPT[3:0] clocks - active mode */ -#define SYS_CTRL_SCGCGPT 0x400D200C /**< GPT[3:0] clocks - sleep mode */ -#define SYS_CTRL_DCGCGPT 0x400D2010 /**< GPT[3:0] clocks - PM0 */ -#define SYS_CTRL_SRGPT 0x400D2014 /**< GPT[3:0] reset control */ -#define SYS_CTRL_RCGCSSI 0x400D2018 /**< SSI[1:0] clocks - active mode */ -#define SYS_CTRL_SCGCSSI 0x400D201C /**< SSI[1:0] clocks - sleep mode */ -#define SYS_CTRL_DCGCSSI 0x400D2020 /**< SSI[1:0] clocks - PM0 mode */ -#define SYS_CTRL_SRSSI 0x400D2024 /**< SSI[1:0] reset control */ -#define SYS_CTRL_RCGCUART 0x400D2028 /**< UART[1:0] clocks - active mode */ -#define SYS_CTRL_SCGCUART 0x400D202C /**< UART[1:0] clocks - sleep mode */ -#define SYS_CTRL_DCGCUART 0x400D2030 /**< UART[1:0] clocks - PM0 */ -#define SYS_CTRL_SRUART 0x400D2034 /**< UART[1:0] reset control */ -#define SYS_CTRL_RCGCI2C 0x400D2038 /**< I2C clocks - active mode */ -#define SYS_CTRL_SCGCI2C 0x400D203C /**< I2C clocks - sleep mode */ -#define SYS_CTRL_DCGCI2C 0x400D2040 /**< I2C clocks - PM0 */ -#define SYS_CTRL_SRI2C 0x400D2044 /**< I2C clocks - reset control */ -#define SYS_CTRL_RCGCSEC 0x400D2048 /**< Sec Mod clocks - active mode */ -#define SYS_CTRL_SCGCSEC 0x400D204C /**< Sec Mod clocks - sleep mode */ -#define SYS_CTRL_DCGCSEC 0x400D2050 /**< Sec Mod clocks - PM0 */ -#define SYS_CTRL_SRSEC 0x400D2054 /**< Sec Mod reset control */ -#define SYS_CTRL_PMCTL 0x400D2058 /**< Power Mode Control */ -#define SYS_CTRL_SRCRC 0x400D205C /**< CRC on state retention */ -#define SYS_CTRL_PWRDBG 0x400D2074 /**< Power debug register */ -#define SYS_CTRL_CLD 0x400D2080 /**< clock loss detection feature */ -#define SYS_CTRL_IWE 0x400D2094 /**< interrupt wake-up. */ -#define SYS_CTRL_I_MAP 0x400D2098 /**< Interrupt map select */ -#define SYS_CTRL_RCGCRFC 0x400D20A8 /**< RF Core clocks - active mode */ -#define SYS_CTRL_SCGCRFC 0x400D20AC /**< RF Core clocks - Sleep mode */ -#define SYS_CTRL_DCGCRFC 0x400D20B0 /**< RF Core clocks - PM0 */ -#define SYS_CTRL_EMUOVR 0x400D20B4 /**< Emulator override */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_CLOCK_CTRL register bit masks - * @{ - */ -#define SYS_CTRL_CLOCK_CTRL_OSC32K_CALDIS 0x02000000 -#define SYS_CTRL_CLOCK_CTRL_OSC32K 0x01000000 -#define SYS_CTRL_CLOCK_CTRL_AMP_DET 0x00200000 -#define SYS_CTRL_CLOCK_CTRL_OSC_PD 0x00020000 -#define SYS_CTRL_CLOCK_CTRL_OSC 0x00010000 -#define SYS_CTRL_CLOCK_CTRL_IO_DIV 0x00000700 -#define SYS_CTRL_CLOCK_CTRL_SYS_DIV 0x00000007 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_CLOCK_STA register bit masks - * @{ - */ -#define SYS_CTRL_CLOCK_STA_SYNC_32K 0x04000000 -#define SYS_CTRL_CLOCK_STA_OSC32K_CALDIS 0x02000000 -#define SYS_CTRL_CLOCK_STA_OSC32K 0x01000000 -#define SYS_CTRL_CLOCK_STA_RST 0x00C00000 -#define SYS_CTRL_CLOCK_STA_RST_S 22 -#define SYS_CTRL_CLOCK_STA_RST_POR 0 -#define SYS_CTRL_CLOCK_STA_RST_EXT 1 -#define SYS_CTRL_CLOCK_STA_RST_WDT 2 -#define SYS_CTRL_CLOCK_STA_RST_CLD_SW 3 -#define SYS_CTRL_CLOCK_STA_SOURCE_CHANGE 0x00100000 -#define SYS_CTRL_CLOCK_STA_XOSC_STB 0x00080000 -#define SYS_CTRL_CLOCK_STA_HSOSC_STB 0x00040000 -#define SYS_CTRL_CLOCK_STA_OSC_PD 0x00020000 -#define SYS_CTRL_CLOCK_STA_OSC 0x00010000 -#define SYS_CTRL_CLOCK_STA_IO_DIV 0x00000700 -#define SYS_CTRL_CLOCK_STA_RTCLK_FREQ 0x00000018 -#define SYS_CTRL_CLOCK_STA_SYS_DIV 0x00000007 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_RCGCGPT register bit masks - * @{ - */ -#define SYS_CTRL_RCGCGPT_GPT3 0x00000008 /**< GPT3 clock enable, CPU running */ -#define SYS_CTRL_RCGCGPT_GPT2 0x00000004 /**< GPT2 clock enable, CPU running */ -#define SYS_CTRL_RCGCGPT_GPT1 0x00000002 /**< GPT1 clock enable, CPU running */ -#define SYS_CTRL_RCGCGPT_GPT0 0x00000001 /**< GPT0 clock enable, CPU running */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_SCGCGPT register bit masks - * @{ - */ -#define SYS_CTRL_SCGCGPT_GPT3 0x00000008 /**< GPT3 clock enable, CPU IDLE */ -#define SYS_CTRL_SCGCGPT_GPT2 0x00000004 /**< GPT2 clock enable, CPU IDLE */ -#define SYS_CTRL_SCGCGPT_GPT1 0x00000002 /**< GPT1 clock enable, CPU IDLE */ -#define SYS_CTRL_SCGCGPT_GPT0 0x00000001 /**< GPT0 clock enable, CPU IDLE */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_DCGCGPT register bit masks - * @{ - */ -#define SYS_CTRL_DCGCGPT_GPT3 0x00000008 /**< GPT3 clock enable, PM0 */ -#define SYS_CTRL_DCGCGPT_GPT2 0x00000004 /**< GPT2 clock enable, PM0 */ -#define SYS_CTRL_DCGCGPT_GPT1 0x00000002 /**< GPT1 clock enable, PM0 */ -#define SYS_CTRL_DCGCGPT_GPT0 0x00000001 /**< GPT0 clock enable, PM0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_SRGPT register bits - * @{ - */ -#define SYS_CTRL_SRGPT_GPT3 0x00000008 /**< GPT3 is reset */ -#define SYS_CTRL_SRGPT_GPT2 0x00000004 /**< GPT2 is reset */ -#define SYS_CTRL_SRGPT_GPT1 0x00000002 /**< GPT1 is reset */ -#define SYS_CTRL_SRGPT_GPT0 0x00000001 /**< GPT0 is reset */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_RCGCSEC register bit masks - * @{ - */ -#define SYS_CTRL_RCGCSEC_AES 0x00000002 /**< AES clock enable, CPU running */ -#define SYS_CTRL_RCGCSEC_PKA 0x00000001 /**< PKA clock enable, CPU running */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_SCGCSEC register bit masks - * @{ - */ -#define SYS_CTRL_SCGCSEC_AES 0x00000002 /**< AES clock enable, CPU IDLE */ -#define SYS_CTRL_SCGCSEC_PKA 0x00000001 /**< PKA clock enable, CPU IDLE */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_DCGCSEC register bit masks - * @{ - */ -#define SYS_CTRL_DCGCSEC_AES 0x00000002 /**< AES clock enable, PM0 */ -#define SYS_CTRL_DCGCSEC_PKA 0x00000001 /**< PKA clock enable, PM0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_SRSEC register bits - * @{ - */ -#define SYS_CTRL_SRSEC_AES 0x00000002 /**< AES is reset */ -#define SYS_CTRL_SRSEC_PKA 0x00000001 /**< PKA is reset */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_PWRDBG register bits - * @{ - */ -#define SYS_CTRL_PWRDBG_FORCE_WARM_RESET 0x00000008 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Possible values for the SYS_CTRL_CLOCK_CTRL_SYS_DIV bits - * @{ - */ -#define SYS_CTRL_CLOCK_CTRL_SYS_DIV_32MHZ 0x00000000 -#define SYS_CTRL_CLOCK_CTRL_SYS_DIV_16MHZ 0x00000001 -#define SYS_CTRL_CLOCK_CTRL_SYS_DIV_8MHZ 0x00000002 -#define SYS_CTRL_CLOCK_CTRL_SYS_DIV_4MHZ 0x00000003 -#define SYS_CTRL_CLOCK_CTRL_SYS_DIV_2MHZ 0x00000004 -#define SYS_CTRL_CLOCK_CTRL_SYS_DIV_1MHZ 0x00000005 -#define SYS_CTRL_CLOCK_CTRL_SYS_DIV_500KHZ 0x00000006 -#define SYS_CTRL_CLOCK_CTRL_SYS_DIV_250KHZ 0x00000007 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Possible values for the SYS_CTRL_CLOCK_CTRL_IO_DIV bits - * @{ - */ -#define SYS_CTRL_CLOCK_CTRL_IO_DIV_32MHZ 0x00000000 -#define SYS_CTRL_CLOCK_CTRL_IO_DIV_16MHZ 0x00000100 -#define SYS_CTRL_CLOCK_CTRL_IO_DIV_8MHZ 0x00000200 -#define SYS_CTRL_CLOCK_CTRL_IO_DIV_4MHZ 0x00000300 -#define SYS_CTRL_CLOCK_CTRL_IO_DIV_2MHZ 0x00000400 -#define SYS_CTRL_CLOCK_CTRL_IO_DIV_1MHZ 0x00000500 -#define SYS_CTRL_CLOCK_CTRL_IO_DIV_500KHZ 0x00000600 -#define SYS_CTRL_CLOCK_CTRL_IO_DIV_250KHZ 0x00000700 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_RCGCUART Register Bit-Masks - * @{ - */ -#define SYS_CTRL_RCGCUART_UART1 0x00000002 /**< UART1 Clock, CPU running */ -#define SYS_CTRL_RCGCUART_UART0 0x00000001 /**< UART0 Clock, CPU running */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_SCGCUART Register Bit-Masks - * @{ - */ -#define SYS_CTRL_SCGCUART_UART1 0x00000002 /**< UART1 Clock, CPU IDLE */ -#define SYS_CTRL_SCGCUART_UART0 0x00000001 /**< UART0 Clock, CPU IDLE */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_RCGCUART Register Bit-Masks - * @{ - */ -#define SYS_CTRL_DCGCUART_UART1 0x00000002 /**< UART1 Clock, PM0 */ -#define SYS_CTRL_DCGCUART_UART0 0x00000001 /**< UART0 Clock, PM0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_SRUART register bits - * @{ - */ -#define SYS_CTRL_SRUART_UART1 0x00000002 /**< UART1 module is reset */ -#define SYS_CTRL_SRUART_UART0 0x00000001 /**< UART0 module is reset */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SYS_CTRL_PMCTL register values - * @{ - */ -#define SYS_CTRL_PMCTL_PM3 0x00000003 /**< PM3 */ -#define SYS_CTRL_PMCTL_PM2 0x00000002 /**< PM2 */ -#define SYS_CTRL_PMCTL_PM1 0x00000001 /**< PM1 */ -#define SYS_CTRL_PMCTL_PM0 0x00000000 /**< PM0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SysCtrl 32-kHz oscillator selection - * - * Prefer the crystal oscillator for time accuracy, and the RC oscillator for - * cost and power consumption - * @{ - */ -/* Defaults to RC oscillator unless the configuration tells us otherwise */ -#ifdef SYS_CTRL_CONF_OSC32K_USE_XTAL -#define SYS_CTRL_OSC32K_USE_XTAL SYS_CTRL_CONF_OSC32K_USE_XTAL -#else -#define SYS_CTRL_OSC32K_USE_XTAL 0 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name System clock divisor selection - * @{ - */ -#ifdef SYS_CTRL_CONF_SYS_DIV -#if SYS_CTRL_CONF_SYS_DIV & ~SYS_CTRL_CLOCK_CTRL_SYS_DIV -#error Invalid system clock divisor -#endif -#define SYS_CTRL_SYS_DIV SYS_CTRL_CONF_SYS_DIV -#else -#define SYS_CTRL_SYS_DIV SYS_CTRL_CLOCK_CTRL_SYS_DIV_16MHZ -#endif - -#ifdef SYS_CTRL_CONF_IO_DIV -#if SYS_CTRL_CONF_IO_DIV & ~SYS_CTRL_CLOCK_CTRL_IO_DIV -#error Invalid I/O clock divisor -#endif -#define SYS_CTRL_IO_DIV SYS_CTRL_CONF_IO_DIV -#else -#define SYS_CTRL_IO_DIV SYS_CTRL_CLOCK_CTRL_IO_DIV_16MHZ -#endif - -/* Returns actual system clock in Hz */ -#define SYS_CTRL_SYS_CLOCK (SYS_CTRL_32MHZ >> SYS_CTRL_SYS_DIV) -/* Returns actual I/O clock in Hz */ -#define SYS_CTRL_IO_CLOCK (SYS_CTRL_32MHZ >> (SYS_CTRL_IO_DIV >> 8)) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SysCtrl functions - * @{ - */ - -/** \brief Gets the cause of the last reset - * \return A \c SYS_CTRL_CLOCK_STA_RST_x reset cause - */ -int sys_ctrl_get_reset_cause(void); - -/** \brief Gets a string describing the cause of the last reset - * \return Last reset cause as a string - */ -const char *sys_ctrl_get_reset_cause_str(void); - -/** \brief Initialises the System Control Driver. The main purpose of this - * function is to power up and select clocks and oscillators - * \note This function depends on ioc_init() having been called beforehand. */ -void sys_ctrl_init(); - -/** \brief Generates a warm reset through the SYS_CTRL_PWRDBG register */ -void sys_ctrl_reset(); - -/** \brief Returns the actual system clock in Hz */ -uint32_t sys_ctrl_get_sys_clock(); - -/** \brief Returns the actual io clock in Hz */ -uint32_t sys_ctrl_get_io_clock(); - -/** @} */ - -#endif /* SYS_CTRL_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/uart.c b/arch/cpu/cc2538/dev/uart.c deleted file mode 100644 index ff24733cd..000000000 --- a/arch/cpu/cc2538/dev/uart.c +++ /dev/null @@ -1,393 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-uart - * @{ - * - * \file - * Implementation of the cc2538 UART driver - */ -#include "contiki.h" -#include "dev/sys-ctrl.h" -#include "dev/ioc.h" -#include "dev/gpio.h" -#include "dev/uart.h" -#include "lpm.h" -#include "reg.h" - -#include -#include -#include - -#ifndef UART0_RX_PORT -#define UART0_RX_PORT (-1) -#endif -#ifndef UART0_RX_PIN -#define UART0_RX_PIN (-1) -#endif -#if UART0_RX_PORT >= 0 && UART0_RX_PIN < 0 || \ - UART0_RX_PORT < 0 && UART0_RX_PIN >= 0 -#error Both UART0_RX_PORT and UART0_RX_PIN must be valid or invalid -#endif - -#ifndef UART0_TX_PORT -#define UART0_TX_PORT (-1) -#endif -#ifndef UART0_TX_PIN -#define UART0_TX_PIN (-1) -#endif -#if UART0_TX_PORT >= 0 && UART0_TX_PIN < 0 || \ - UART0_TX_PORT < 0 && UART0_TX_PIN >= 0 -#error Both UART0_TX_PORT and UART0_TX_PIN must be valid or invalid -#endif - -#if UART0_RX_PORT >= 0 && UART0_TX_PORT < 0 || \ - UART0_RX_PORT < 0 && UART0_TX_PORT >= 0 -#error Both UART0_RX and UART0_TX pads must be valid or invalid -#endif - -#if UART_IN_USE(0) && UART0_RX_PORT < 0 -#error Contiki is configured to use UART0, but its pads are not valid -#endif - -#ifndef UART1_RX_PORT -#define UART1_RX_PORT (-1) -#endif -#ifndef UART1_RX_PIN -#define UART1_RX_PIN (-1) -#endif -#if UART1_RX_PORT >= 0 && UART1_RX_PIN < 0 || \ - UART1_RX_PORT < 0 && UART1_RX_PIN >= 0 -#error Both UART1_RX_PORT and UART1_RX_PIN must be valid or invalid -#endif - -#ifndef UART1_TX_PORT -#define UART1_TX_PORT (-1) -#endif -#ifndef UART1_TX_PIN -#define UART1_TX_PIN (-1) -#endif -#if UART1_TX_PORT >= 0 && UART1_TX_PIN < 0 || \ - UART1_TX_PORT < 0 && UART1_TX_PIN >= 0 -#error Both UART1_TX_PORT and UART1_TX_PIN must be valid or invalid -#endif - -#if UART1_RX_PORT >= 0 && UART1_TX_PORT < 0 || \ - UART1_RX_PORT < 0 && UART1_TX_PORT >= 0 -#error Both UART1_RX and UART1_TX pads must be valid or invalid -#endif - -#if UART_IN_USE(1) && UART1_RX_PORT < 0 -#error Contiki is configured to use UART1, but its pads are not valid -#endif - -#ifndef UART1_CTS_PORT -#define UART1_CTS_PORT (-1) -#endif -#ifndef UART1_CTS_PIN -#define UART1_CTS_PIN (-1) -#endif -#if UART1_CTS_PORT >= 0 && UART1_CTS_PIN < 0 || \ - UART1_CTS_PORT < 0 && UART1_CTS_PIN >= 0 -#error Both UART1_CTS_PORT and UART1_CTS_PIN must be valid or invalid -#endif - -#ifndef UART1_RTS_PORT -#define UART1_RTS_PORT (-1) -#endif -#ifndef UART1_RTS_PIN -#define UART1_RTS_PIN (-1) -#endif -#if UART1_RTS_PORT >= 0 && UART1_RTS_PIN < 0 || \ - UART1_RTS_PORT < 0 && UART1_RTS_PIN >= 0 -#error Both UART1_RTS_PORT and UART1_RTS_PIN must be valid or invalid -#endif -/*---------------------------------------------------------------------------*/ -/* - * Baud rate defines used in uart_init() to set the values of UART_IBRD and - * UART_FBRD in order to achieve the configured baud rates. - */ -#define UART_CLOCK_RATE SYS_CTRL_SYS_CLOCK -#define UART_CTL_HSE_VALUE 0 -#define UART_CTL_VALUE (UART_CTL_RXE | UART_CTL_TXE | (UART_CTL_HSE_VALUE << 5)) - -/* DIV_ROUND() divides integers while avoiding a rounding error: */ -#define DIV_ROUND(num, denom) (((num) + (denom) / 2) / (denom)) - -#define BAUD2BRD(baud) DIV_ROUND(UART_CLOCK_RATE << (UART_CTL_HSE_VALUE + 2), (baud)) -#define BAUD2IBRD(baud) (BAUD2BRD(baud) >> 6) -#define BAUD2FBRD(baud) (BAUD2BRD(baud) & 0x3f) -/*---------------------------------------------------------------------------*/ -typedef struct { - int8_t port; - int8_t pin; -} uart_pad_t; -typedef struct { - uint32_t sys_ctrl_rcgcuart_uart; - uint32_t sys_ctrl_scgcuart_uart; - uint32_t sys_ctrl_dcgcuart_uart; - uint32_t base; - uint32_t ioc_uartrxd_uart; - uint32_t ioc_pxx_sel_uart_txd; - uint32_t ibrd; - uint32_t fbrd; - uart_pad_t rx; - uart_pad_t tx; - uart_pad_t cts; - uart_pad_t rts; - uint8_t nvic_int; -} uart_regs_t; -/*---------------------------------------------------------------------------*/ -static const uart_regs_t uart_regs[UART_INSTANCE_COUNT] = { - { - .sys_ctrl_rcgcuart_uart = SYS_CTRL_RCGCUART_UART0, - .sys_ctrl_scgcuart_uart = SYS_CTRL_SCGCUART_UART0, - .sys_ctrl_dcgcuart_uart = SYS_CTRL_DCGCUART_UART0, - .base = UART_0_BASE, - .ioc_uartrxd_uart = IOC_UARTRXD_UART0, - .ioc_pxx_sel_uart_txd = IOC_PXX_SEL_UART0_TXD, - .ibrd = BAUD2IBRD(UART0_CONF_BAUD_RATE), - .fbrd = BAUD2FBRD(UART0_CONF_BAUD_RATE), - .rx = {UART0_RX_PORT, UART0_RX_PIN}, - .tx = {UART0_TX_PORT, UART0_TX_PIN}, - .cts = {-1, -1}, - .rts = {-1, -1}, - .nvic_int = UART0_IRQn - }, { - .sys_ctrl_rcgcuart_uart = SYS_CTRL_RCGCUART_UART1, - .sys_ctrl_scgcuart_uart = SYS_CTRL_SCGCUART_UART1, - .sys_ctrl_dcgcuart_uart = SYS_CTRL_DCGCUART_UART1, - .base = UART_1_BASE, - .ioc_uartrxd_uart = IOC_UARTRXD_UART1, - .ioc_pxx_sel_uart_txd = IOC_PXX_SEL_UART1_TXD, - .ibrd = BAUD2IBRD(UART1_CONF_BAUD_RATE), - .fbrd = BAUD2FBRD(UART1_CONF_BAUD_RATE), - .rx = {UART1_RX_PORT, UART1_RX_PIN}, - .tx = {UART1_TX_PORT, UART1_TX_PIN}, - .cts = {UART1_CTS_PORT, UART1_CTS_PIN}, - .rts = {UART1_RTS_PORT, UART1_RTS_PIN}, - .nvic_int = UART1_IRQn - } -}; -static int (* input_handler[UART_INSTANCE_COUNT])(unsigned char c); -/*---------------------------------------------------------------------------*/ -static void -reset(uint32_t uart_base) -{ - uint32_t lchr; - - /* Make sure the UART is disabled before trying to configure it */ - REG(uart_base + UART_CTL) = UART_CTL_VALUE; - - /* Clear error status */ - REG(uart_base + UART_ECR) = 0xFF; - - /* Store LCHR configuration */ - lchr = REG(uart_base + UART_LCRH); - - /* Flush FIFOs by clearing LCHR.FEN */ - REG(uart_base + UART_LCRH) = 0; - - /* Restore LCHR configuration */ - REG(uart_base + UART_LCRH) = lchr; - - /* UART Enable */ - REG(uart_base + UART_CTL) |= UART_CTL_UARTEN; -} -/*---------------------------------------------------------------------------*/ -static bool -permit_pm1(void) -{ - const uart_regs_t *regs; - - for(regs = &uart_regs[0]; regs < &uart_regs[UART_INSTANCE_COUNT]; regs++) { - if((REG(regs->base + UART_FR) & UART_FR_BUSY) != 0) { - return false; - } - } - - return true; -} -/*---------------------------------------------------------------------------*/ -void -uart_init(uint8_t uart) -{ - const uart_regs_t *regs; - - if(uart >= UART_INSTANCE_COUNT) { - return; - } - regs = &uart_regs[uart]; - if(regs->rx.port < 0 || regs->tx.port < 0) { - return; - } - - lpm_register_peripheral(permit_pm1); - - /* Enable clock for the UART while Running, in Sleep and Deep Sleep */ - REG(SYS_CTRL_RCGCUART) |= regs->sys_ctrl_rcgcuart_uart; - REG(SYS_CTRL_SCGCUART) |= regs->sys_ctrl_scgcuart_uart; - REG(SYS_CTRL_DCGCUART) |= regs->sys_ctrl_dcgcuart_uart; - - /* Run on SYS_DIV */ - REG(regs->base + UART_CC) = 0; - - /* - * Select the UARTx RX pin by writing to the IOC_UARTRXD_UARTn register - * - * The value to be written will be on of the IOC_INPUT_SEL_Pxn defines from - * ioc.h. The value can also be calculated as: - * - * (port << 3) + pin - */ - REG(regs->ioc_uartrxd_uart) = (regs->rx.port << 3) + regs->rx.pin; - - /* - * Pad Control for the TX pin: - * - Set function to UARTn TX - * - Output Enable - */ - ioc_set_sel(regs->tx.port, regs->tx.pin, regs->ioc_pxx_sel_uart_txd); - ioc_set_over(regs->tx.port, regs->tx.pin, IOC_OVERRIDE_OE); - - /* Set RX and TX pins to peripheral mode */ - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(regs->tx.port), - GPIO_PIN_MASK(regs->tx.pin)); - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(regs->rx.port), - GPIO_PIN_MASK(regs->rx.pin)); - - /* - * UART Interrupt Masks: - * Acknowledge RX and RX Timeout - * Acknowledge Framing, Overrun and Break Errors - */ - REG(regs->base + UART_IM) = UART_IM_RXIM | UART_IM_RTIM; - REG(regs->base + UART_IM) |= UART_IM_OEIM | UART_IM_BEIM | UART_IM_FEIM; - - REG(regs->base + UART_IFLS) = - UART_IFLS_RXIFLSEL_1_8 | UART_IFLS_TXIFLSEL_1_2; - - /* Make sure the UART is disabled before trying to configure it */ - REG(regs->base + UART_CTL) = UART_CTL_VALUE; - - /* Baud Rate Generation */ - REG(regs->base + UART_IBRD) = regs->ibrd; - REG(regs->base + UART_FBRD) = regs->fbrd; - - /* UART Control: 8N1 with FIFOs */ - REG(regs->base + UART_LCRH) = UART_LCRH_WLEN_8 | UART_LCRH_FEN; - - /* - * Enable hardware flow control (RTS/CTS) if requested. - * Note that hardware flow control is available only on UART1. - */ - if(regs->cts.port >= 0) { - REG(IOC_UARTCTS_UART1) = ioc_input_sel(regs->cts.port, regs->cts.pin); - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(regs->cts.port), GPIO_PIN_MASK(regs->cts.pin)); - ioc_set_over(regs->cts.port, regs->cts.pin, IOC_OVERRIDE_DIS); - REG(UART_1_BASE + UART_CTL) |= UART_CTL_CTSEN; - } - - if(regs->rts.port >= 0) { - ioc_set_sel(regs->rts.port, regs->rts.pin, IOC_PXX_SEL_UART1_RTS); - GPIO_PERIPHERAL_CONTROL(GPIO_PORT_TO_BASE(regs->rts.port), GPIO_PIN_MASK(regs->rts.pin)); - ioc_set_over(regs->rts.port, regs->rts.pin, IOC_OVERRIDE_OE); - REG(UART_1_BASE + UART_CTL) |= UART_CTL_RTSEN; - } - - /* UART Enable */ - REG(regs->base + UART_CTL) |= UART_CTL_UARTEN; - - /* Enable UART0 Interrupts */ - NVIC_EnableIRQ(regs->nvic_int); -} -/*---------------------------------------------------------------------------*/ -void -uart_set_input(uint8_t uart, int (* input)(unsigned char c)) -{ - if(uart >= UART_INSTANCE_COUNT) { - return; - } - - input_handler[uart] = input; -} -/*---------------------------------------------------------------------------*/ -void -uart_write_byte(uint8_t uart, uint8_t b) -{ - uint32_t uart_base; - - if(uart >= UART_INSTANCE_COUNT) { - return; - } - uart_base = uart_regs[uart].base; - - /* Block if the TX FIFO is full */ - while(REG(uart_base + UART_FR) & UART_FR_TXFF); - - REG(uart_base + UART_DR) = b; -} -/*---------------------------------------------------------------------------*/ -static void -uart_isr(uint8_t uart) -{ - uint32_t uart_base; - uint16_t mis; - - uart_base = uart_regs[uart].base; - - /* Store the current MIS and clear all flags early, except the RTM flag. - * This will clear itself when we read out the entire FIFO contents */ - mis = REG(uart_base + UART_MIS) & 0x0000FFFF; - - REG(uart_base + UART_ICR) = 0x0000FFBF; - - if(mis & (UART_MIS_RXMIS | UART_MIS_RTMIS)) { - while(!(REG(uart_base + UART_FR) & UART_FR_RXFE)) { - if(input_handler[uart] != NULL) { - input_handler[uart]((unsigned char)(REG(uart_base + UART_DR) & 0xFF)); - } else { - /* To prevent an Overrun Error, we need to flush the FIFO even if we - * don't have an input_handler. Use mis as a data trash can */ - mis = REG(uart_base + UART_DR); - } - } - } else if(mis & (UART_MIS_OEMIS | UART_MIS_BEMIS | UART_MIS_FEMIS)) { - /* ISR triggered due to some error condition */ - reset(uart_base); - } -} -/*---------------------------------------------------------------------------*/ -#define UART_ISR(u) void uart##u##_isr(void) { uart_isr(u); } -UART_ISR(0) -UART_ISR(1) - -/** @} */ diff --git a/arch/cpu/cc2538/dev/uart.h b/arch/cpu/cc2538/dev/uart.h deleted file mode 100644 index 3cde5b0af..000000000 --- a/arch/cpu/cc2538/dev/uart.h +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-uart cc2538 UART - * - * Driver for the cc2538 UART controller - * @{ - * - * \file - * Header file for the cc2538 UART driver - */ -#ifndef UART_H_ -#define UART_H_ - -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \name UART instance count - * @{ - */ -#define UART_INSTANCE_COUNT 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART base addresses - * @{ - */ -#define UART_0_BASE 0x4000C000 -#define UART_1_BASE 0x4000D000 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART Register Offsets - * @{ - */ -#define UART_DR 0x00000000 /**< UART data */ -#define UART_RSR 0x00000004 /**< UART RX status and err clear */ -#define UART_ECR 0x00000004 /**< UART RX status and err clear */ -#define UART_FR 0x00000018 /**< UART flag */ -#define UART_ILPR 0x00000020 /**< UART IrDA low-power */ -#define UART_IBRD 0x00000024 /**< UART BAUD divisor: integer */ -#define UART_FBRD 0x00000028 /**< UART BAUD divisor: fractional */ -#define UART_LCRH 0x0000002C /**< UART line control */ -#define UART_CTL 0x00000030 /**< UART control */ -#define UART_IFLS 0x00000034 /**< UART interrupt FIFO level */ -#define UART_IM 0x00000038 /**< UART interrupt mask */ -#define UART_RIS 0x0000003C /**< UART raw interrupt status */ -#define UART_MIS 0x00000040 /**< UART masked interrupt status */ -#define UART_ICR 0x00000044 /**< UART interrupt clear */ -#define UART_DMACTL 0x00000048 /**< UART DMA control */ -#define UART_LCTL 0x00000090 /**< UART LIN control */ -#define UART_LSS 0x00000094 /**< UART LIN snap shot */ -#define UART_LTIM 0x00000098 /**< UART LIN timer */ -#define UART_NINEBITADDR 0x000000A4 /**< UART 9-bit self address */ -#define UART_NINEBITAMASK 0x000000A8 /**< UART 9-bit self address mask */ -#define UART_PP 0x00000FC0 /**< UART peripheral properties */ -#define UART_CC 0x00000FC8 /**< UART clock configuration */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_DR Register Bit-Masks - * @{ - */ -#define UART_DR_OE 0x00000800 /**< UART overrun error */ -#define UART_DR_BE 0x00000400 /**< UART break error */ -#define UART_DR_PE 0x00000200 /**< UART parity error */ -#define UART_DR_FE 0x00000100 /**< UART framing error */ -#define UART_DR_DATA 0x000000FF /**< Data transmitted or received */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_RSR Register Bit-Masks - * @{ - */ -#define UART_RSR_OE 0x00000008 /**< UART overrun error */ -#define UART_RSR_BE 0x00000004 /**< UART break error */ -#define UART_RSR_PE 0x00000002 /**< UART parity error */ -#define UART_RSR_FE 0x00000001 /**< UART framing error */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_ECR Register Bit-Masks - * @{ - */ -#define UART_ECR_DATA 0x000000FF /**< Error clear */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_FR Register Bit-Masks - * @{ - */ -#define UART_FR_TXFE 0x00000080 /**< UART transmit FIFO empty */ -#define UART_FR_RXFF 0x00000040 /**< UART receive FIFO full */ -#define UART_FR_TXFF 0x00000020 /**< UART transmit FIFO full */ -#define UART_FR_RXFE 0x00000010 /**< UART receive FIFO empty */ -#define UART_FR_BUSY 0x00000008 /**< UART busy */ -#define UART_FR_CTS 0x00000001 /**< Clear to send */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_ILPR Register Bit-Masks - * @{ - */ -#define UART_ILPR_ILPDVSR 0x000000FF /**< IrDA low-power divisor */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_IBRD Register Bit-Masks - * @{ - */ -#define UART_IBRD_DIVINT 0x0000FFFF /**< Integer baud-rate divisor */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_FPRD Register Bit-Masks - * @{ - */ -#define UART_FBRD_DIVFRAC 0x0000003F /**< Fractional baud-rate divisor */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_LCRH Register Bit-Masks - * @{ - */ -#define UART_LCRH_SPS 0x00000080 /**< UART stick parity select */ -#define UART_LCRH_WLEN 0x00000060 /**< UART word length */ -#define UART_LCRH_FEN 0x00000010 /**< UART enable FIFOs */ -#define UART_LCRH_STP2 0x00000008 /**< UART two stop bits select */ -#define UART_LCRH_EPS 0x00000004 /**< UART even parity select */ -#define UART_LCRH_PEN 0x00000002 /**< UART parity enable */ -#define UART_LCRH_BRK 0x00000001 /**< UART send break */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_LCRH_WLEN Values - * @{ - */ -#define UART_LCRH_WLEN_8 0x00000060 -#define UART_LCRH_WLEN_7 0x00000040 -#define UART_LCRH_WLEN_6 0x00000020 -#define UART_LCRH_WLEN_5 0x00000000 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_CTL Register Bit-Masks - * @{ - */ -#define UART_CTL_CTSEN 0x00008000 /**< UART CTS flow-control enable (UART1 only) */ -#define UART_CTL_RTSEN 0x00004000 /**< UART RTS flow-control enable (UART1 only) */ -#define UART_CTL_RXE 0x00000200 /**< UART receive enable */ -#define UART_CTL_TXE 0x00000100 /**< UART transmit enable */ -#define UART_CTL_LBE 0x00000080 /**< UART loop back enable */ -#define UART_CTL_LIN 0x00000040 /**< LIN mode enable */ -#define UART_CTL_HSE 0x00000020 /**< High-speed enable */ -#define UART_CTL_EOT 0x00000010 /**< End of transmission */ -#define UART_CTL_SMART 0x00000008 /**< ISO 7816 Smart Card support */ -#define UART_CTL_SIRLP 0x00000004 /**< UART SIR low-power mode */ -#define UART_CTL_SIREN 0x00000002 /**< UART SIR enable */ -#define UART_CTL_UARTEN 0x00000001 /**< UART enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_IFLS Register Bit-Masks - * @{ - */ -#define UART_IFLS_RXIFLSEL 0x00000038 /**< UART RX FIFO level select */ -#define UART_IFLS_TXIFLSEL 0x00000007 /**< UART TX FIFO level select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_IFLS_RXIFLSEL Possible Values - * @{ - */ -#define UART_IFLS_RXIFLSEL_7_8 0x00000020 /**< UART RX FIFO >= 7/8 full */ -#define UART_IFLS_RXIFLSEL_3_4 0x00000018 /**< UART RX FIFO >= 3/4 full */ -#define UART_IFLS_RXIFLSEL_1_2 0x00000010 /**< UART RX FIFO >= 1/2 full */ -#define UART_IFLS_RXIFLSEL_1_4 0x00000008 /**< UART RX FIFO >= 1/4 full */ -#define UART_IFLS_RXIFLSEL_1_8 0x00000000 /**< UART RX FIFO >= 1/8 full */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_IFLS_TXIFLSEL Possible Values - * @{ - */ -#define UART_IFLS_TXIFLSEL_1_8 0x00000004 /**< UART TX FIFO >= 1/8 empty */ -#define UART_IFLS_TXIFLSEL_1_4 0x00000003 /**< UART TX FIFO >= 1/4 empty */ -#define UART_IFLS_TXIFLSEL_1_2 0x00000002 /**< UART TX FIFO >= 1/2 empty */ -#define UART_IFLS_TXIFLSEL_3_4 0x00000001 /**< UART TX FIFO >= 3/4 empty */ -#define UART_IFLS_TXIFLSEL_7_8 0x00000000 /**< UART TX FIFO >= 7/8 empty */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_IM Register Bit-Masks - * @{ - */ -#define UART_IM_LME5IM 0x00008000 /**< LIN mode edge 5 intr mask */ -#define UART_IM_LME1IM 0x00004000 /**< LIN mode edge 1 intr mask */ -#define UART_IM_LMSBIM 0x00002000 /**< LIN mode sync break mask */ -#define UART_IM_NINEBITIM 0x00001000 /**< 9-bit mode interrupt mask */ -#define UART_IM_OEIM 0x00000400 /**< UART overrun error mask */ -#define UART_IM_BEIM 0x00000200 /**< UART break error mask */ -#define UART_IM_PEIM 0x00000100 /**< UART parity error mask */ -#define UART_IM_FEIM 0x00000080 /**< UART framing error */ -#define UART_IM_RTIM 0x00000040 /**< UART receive time-out mask */ -#define UART_IM_TXIM 0x00000020 /**< UART transmit intr mask */ -#define UART_IM_RXIM 0x00000010 /**< UART receive interrupt mask */ -#define UART_IM_CTSIM 0x00000002 /**< UART CTS modem mask */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_RIS Register Bit-Masks - * @{ - */ -#define UART_RIS_LME5RIS 0x00008000 /**< LIN mode edge 5 raw */ -#define UART_RIS_LME1RIS 0x00004000 /**< LIN mode edge 1 raw */ -#define UART_RIS_LMSBRIS 0x00002000 /**< LIN mode sync break raw */ -#define UART_RIS_NINEBITRIS 0x00001000 /**< 9-bit mode raw intr */ -#define UART_RIS_OERIS 0x00000400 /**< UART overrun error raw */ -#define UART_RIS_BERIS 0x00000200 /**< UART break error raw */ -#define UART_RIS_PERIS 0x00000100 /**< UART parity error raw */ -#define UART_RIS_FERIS 0x00000080 /**< UART framing error raw */ -#define UART_RIS_RTRIS 0x00000040 /**< UART RX time-out raw */ -#define UART_RIS_TXRIS 0x00000020 /**< UART transmit raw */ -#define UART_RIS_RXRIS 0x00000010 /**< UART receive raw */ -#define UART_RIS_CTSRIS 0x00000002 /**< UART CTS modem */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_RIS Register Bit-Masks - * @{ - */ -#define UART_MIS_LME5MIS 0x00008000 /**< LIN mode edge 5 masked stat */ -#define UART_MIS_LME1MIS 0x00004000 /**< LIN mode edge 1 masked stat */ -#define UART_MIS_LMSBMIS 0x00002000 /**< LIN mode sync br masked stat */ -#define UART_MIS_NINEBITMIS 0x00001000 /**< 9-bit mode masked stat */ -#define UART_MIS_OEMIS 0x00000400 /**< UART overrun err masked stat */ -#define UART_MIS_BEMIS 0x00000200 /**< UART break err masked stat */ -#define UART_MIS_PEMIS 0x00000100 /**< UART parity err masked stat */ -#define UART_MIS_FEMIS 0x00000080 /**< UART framing err masked stat */ -#define UART_MIS_RTMIS 0x00000040 /**< UART RX time-out masked stat */ -#define UART_MIS_TXMIS 0x00000020 /**< UART TX masked intr stat */ -#define UART_MIS_RXMIS 0x00000010 /**< UART RX masked intr stat */ -#define UART_MIS_CTSMIS 0x00000002 /**< UART CTS modem masked stat */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_ICR Register Bit-Masks - * @{ - */ -#define UART_ICR_LME5IC 0x00008000 /**< LIN mode edge 5 intr clear */ -#define UART_ICR_LME1IC 0x00004000 /**< LIN mode edge 1 intr clear */ -#define UART_ICR_LMSBIC 0x00002000 /**< LIN mode sync br intr clear */ -#define UART_ICR_NINEBITIC 0x00001000 /**< 9-bit mode intr clear */ -#define UART_ICR_OEIC 0x00000400 /**< Overrun error intr clear */ -#define UART_ICR_BEIC 0x00000200 /**< Break error intr clear */ -#define UART_ICR_PEIC 0x00000100 /**< Parity error intr clear */ -#define UART_ICR_FEIC 0x00000080 /**< Framing error intr clear */ -#define UART_ICR_RTIC 0x00000040 /**< Receive time-out intr clear */ -#define UART_ICR_TXIC 0x00000020 /**< Transmit intr clear */ -#define UART_ICR_RXIC 0x00000010 /**< Receive intr clear */ -#define UART_ICR_CTSIC 0x00000002 /**< UART CTS modem intr clear */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_DMACTL Register Bit-Masks - * @{ - */ -#define UART_DMACTL_DMAERR 0x00000004 /**< DMA on error */ -#define UART_DMACTL_TXDMAE 0x00000002 /**< Transmit DMA enable */ -#define UART_DMACTL_RXDMAE 0x00000001 /**< Receive DMA enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_LCTL Register Bit-Masks - * @{ - */ -#define UART_LCTL_BLEN 0x00000030 /**< Sync break length */ -#define UART_LCTL_MASTER 0x00000001 /**< LIN master enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_LSS Register Bit-Masks - * @{ - */ -#define UART_LSS_TSS 0x0000FFFF /**< Timer snap shot */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_LTIM Register Bit-Masks - * @{ - */ -#define UART_LTIM_TIMER 0x0000FFFF /**< Timer value */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_O_NINEBITADDR Register Bit-Masks - * @{ - */ -#define UART_NINEBITADDR_NINEBITEN 0x00008000 /**< Enable 9-bit mode */ -#define UART_NINEBITADDR_ADDR 0x000000FF /**< Self address for 9-bit mode */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_O_NINEBITADDR Register Bit-Masks - * @{ - */ -#define UART_NINEBITAMASK_RANGE 0x0000FF00 /**< Self addr range, 9-bit mode */ -#define UART_NINEBITAMASK_MASK 0x000000FF /**< Self addr mask, 9-bit mode */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_PP Register Bit-Masks - * @{ - */ -#define UART_PP_NB 0x00000002 /**< 9-bit support */ -#define UART_PP_SC 0x00000001 /**< Smart card support */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART_CC Register Bit-Masks - * @{ - */ -#define UART_CC_CS 0x00000007 /**< UART BAUD & sys clock source */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART functions - * @{ - */ - -/** \brief Initialises the UART controller, configures I/O control - * and interrupts - * \param uart The UART instance to use (0 to \c UART_INSTANCE_COUNT - 1) - */ -void uart_init(uint8_t uart); - -/** \brief Sends a single character down the UART - * \param uart The UART instance to use (0 to \c UART_INSTANCE_COUNT - 1) - * \param b The character to transmit - */ -void uart_write_byte(uint8_t uart, uint8_t b); - -/** \brief Assigns a callback to be called when the UART receives a byte - * \param uart The UART instance to use (0 to \c UART_INSTANCE_COUNT - 1) - * \param input A pointer to the function - */ -void uart_set_input(uint8_t uart, int (* input)(unsigned char c)); - -/** @} */ - -#endif /* UART_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/udma.c b/arch/cpu/cc2538/dev/udma.c deleted file mode 100644 index 1302f0f44..000000000 --- a/arch/cpu/cc2538/dev/udma.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2013, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-udma - * @{ - * - * \file - * Implementation of the cc2538 micro-DMA driver - */ -#include "contiki.h" -#include "dev/udma.h" -#include "dev/nvic.h" -#include "reg.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -struct channel_ctrl { - uint32_t src_end_ptr; - uint32_t dst_end_ptr; - uint32_t ctrl_word; - uint32_t unused; -}; - -static volatile struct channel_ctrl channel_config[UDMA_CONF_MAX_CHANNEL + 1] - __attribute__ ((section(".udma_channel_control_table"))); -/*---------------------------------------------------------------------------*/ -void -udma_init() -{ - memset((void *)&channel_config, 0, sizeof(channel_config)); - - REG(UDMA_CFG) = UDMA_CFG_MASTEN; - - REG(UDMA_CTLBASE) = (uint32_t)(&channel_config); - - NVIC_EnableIRQ(UDMA_SW_IRQn); - NVIC_EnableIRQ(UDMA_ERR_IRQn); -} -/*---------------------------------------------------------------------------*/ -void -udma_set_channel_src(uint8_t channel, uint32_t src_end) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - channel_config[channel].src_end_ptr = src_end; -} -/*---------------------------------------------------------------------------*/ -void -udma_set_channel_dst(uint8_t channel, uint32_t dst_end) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - channel_config[channel].dst_end_ptr = dst_end; -} -/*---------------------------------------------------------------------------*/ -void -udma_set_channel_control_word(uint8_t channel, uint32_t ctrl) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - channel_config[channel].ctrl_word = ctrl; -} -/*---------------------------------------------------------------------------*/ -void -udma_set_channel_assignment(uint8_t channel, uint8_t enc) -{ - uint32_t base_chmap = UDMA_CHMAP0; - uint8_t shift; - - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - /* Calculate the address of the relevant CHMAP register */ - base_chmap += (channel >> 3) * 4; - - /* Calculate the shift value for the correct CHMAP register bits */ - shift = (channel & 0x07); - - /* Read CHMAPx value, zero out channel's bits and write the new value */ - REG(base_chmap) = (REG(base_chmap) & ~(0x0F << shift)) | (enc << shift); -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_enable(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - REG(UDMA_ENASET) |= 1 << channel; -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_disable(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - /* Writes of 0 have no effect, this no need for RMW */ - REG(UDMA_ENACLR) = 1 << channel; -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_use_alternate(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - REG(UDMA_ALTSET) |= 1 << channel; -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_use_primary(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - /* Writes of 0 have no effect, this no need for RMW */ - REG(UDMA_ALTCLR) = 1 << channel; -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_prio_set_high(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - REG(UDMA_PRIOSET) |= 1 << channel; -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_prio_set_default(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - /* Writes of 0 have no effect, this no need for RMW */ - REG(UDMA_PRIOCLR) = 1 << channel; -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_use_burst(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - REG(UDMA_USEBURSTSET) |= 1 << channel; -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_use_single(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - /* Writes of 0 have no effect, this no need for RMW */ - REG(UDMA_USEBURSTCLR) = 1 << channel; -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_mask_set(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - REG(UDMA_REQMASKSET) |= 1 << channel; -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_mask_clr(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - /* Writes of 0 have no effect, this no need for RMW */ - REG(UDMA_REQMASKCLR) = 1 << channel; -} -/*---------------------------------------------------------------------------*/ -void -udma_channel_sw_request(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return; - } - - REG(UDMA_SWREQ) |= 1 << channel; -} -/*---------------------------------------------------------------------------*/ -uint8_t -udma_channel_get_mode(uint8_t channel) -{ - if(channel > UDMA_CONF_MAX_CHANNEL) { - return 0; - } - - return (channel_config[channel].ctrl_word & 0x07); -} -/*---------------------------------------------------------------------------*/ -void -udma_isr() -{ - /* Simply clear Channel interrupt status for now */ - REG(UDMA_CHIS) = UDMA_CHIS_CHIS; -} -/*---------------------------------------------------------------------------*/ -void -udma_err_isr() -{ - /* Stub Implementation, just clear the error flag */ - REG(UDMA_ERRCLR) = 1; -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/arch/cpu/cc2538/dev/udma.h b/arch/cpu/cc2538/dev/udma.h deleted file mode 100644 index 103d58c11..000000000 --- a/arch/cpu/cc2538/dev/udma.h +++ /dev/null @@ -1,704 +0,0 @@ -/* - * Copyright (c) 2013, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-udma cc2538 micro-DMA - * - * Driver for the cc2538 uDMA controller - * @{ - * - * \file - * Header file with register, macro and function declarations for the cc2538 - * micro-DMA controller module - */ -#ifndef UDMA_H_ -#define UDMA_H_ - -#include "contiki.h" - -/* - * Enable all uDMA channels unless a conf file tells us to do otherwise. - * Using all 31 channels will consume a lot of RAM for the channel control - * data structure. Thus it's wise to set this define to the number of the - * highest channel in use - */ -#ifndef UDMA_CONF_MAX_CHANNEL -#define UDMA_CONF_MAX_CHANNEL 31 -#endif -/*---------------------------------------------------------------------------*/ -/** - * \name uDMA Register offset declarations - * @{ - */ -#define UDMA_STAT 0x400FF000 /**< DMA status */ -#define UDMA_CFG 0x400FF004 /**< DMA configuration */ -#define UDMA_CTLBASE 0x400FF008 /**< DMA channel control base pointer */ -#define UDMA_ALTBASE 0x400FF00C /**< DMA alternate channel control base pointer */ -#define UDMA_WAITSTAT 0x400FF010 /**< DMA channel wait-on-request status */ -#define UDMA_SWREQ 0x400FF014 /**< DMA channel software request */ -#define UDMA_USEBURSTSET 0x400FF018 /**< DMA channel useburst set */ -#define UDMA_USEBURSTCLR 0x400FF01C /**< DMA channel useburst clear */ -#define UDMA_REQMASKSET 0x400FF020 /**< DMA channel request mask set */ -#define UDMA_REQMASKCLR 0x400FF024 /**< DMA channel request mask clear */ -#define UDMA_ENASET 0x400FF028 /**< DMA channel enable set */ -#define UDMA_ENACLR 0x400FF02C /**< DMA channel enable clear */ -#define UDMA_ALTSET 0x400FF030 /**< DMA channel primary alternate set */ -#define UDMA_ALTCLR 0x400FF034 /**< DMA channel primary alternate clear */ -#define UDMA_PRIOSET 0x400FF038 /**< DMA channel priority set */ -#define UDMA_PRIOCLR 0x400FF03C /**< DMA channel priority clear */ -#define UDMA_ERRCLR 0x400FF04C /**< DMA bus error clear */ -#define UDMA_CHASGN 0x400FF500 /**< DMA channel assignment */ -#define UDMA_CHIS 0x400FF504 /**< DMA channel interrupt status */ -#define UDMA_CHMAP0 0x400FF510 /**< DMA channel map select 0 */ -#define UDMA_CHMAP1 0x400FF514 /**< DMA channel map select 1 */ -#define UDMA_CHMAP2 0x400FF518 /**< DMA channel map select 2 */ -#define UDMA_CHMAP3 0x400FF51C /**< DMA channel map select 3 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_STAT register bit masks - * @{ - */ -#define UDMA_STAT_DMACHANS 0x001F0000 /**< Available uDMA channels minus 1 */ -#define UDMA_STAT_STATE 0x000000F0 /**< Control state machine status */ -#define UDMA_STAT_MASTEN 0x00000001 /**< Master enable status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_CFG register bit masks - * @{ - */ -#define UDMA_CFG_MASTEN 0x00000001 /**< Controller master enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_CTLBASE register bit masks - * @{ - */ -#define UDMA_CTLBASE_ADDR 0xFFFFFC00 /**< Channel control base address */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_ALTBASE register bit masks - * @{ - */ -#define UDMA_ALTBASE_ADDR 0xFFFFFFFF /**< Alternate channel address pointer */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_WAITSTAT register bit masks - * @{ - */ -#define UDMA_WAITSTAT_WAITREQ 0xFFFFFFFF /**< Channel [n] wait status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_SWREQ register bit masks - * @{ - */ -#define UDMA_SWREQ_SWREQ 0xFFFFFFFF /**< Channel [n] software request */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_USEBURSTSET register bit masks - * @{ - */ -#define UDMA_USEBURSTSET_SET 0xFFFFFFFF /**< Channel [n] useburst set */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_USEBURSTCLR register bit masks - * @{ - */ -#define UDMA_USEBURSTCLR_CLR 0xFFFFFFFF /**< Channel [n] useburst clear */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_REQMASKSET register bit masks - * @{ - */ -#define UDMA_REQMASKSET_SET 0xFFFFFFFF /**< Channel [n] request mask set */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_REQMASKCLR register bit masks - * @{ - */ -#define UDMA_REQMASKCLR_CLR 0xFFFFFFFF /**< Channel [n] request mask clear */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_ENASET register bit masks - * @{ - */ -#define UDMA_ENASET_SET 0xFFFFFFFF /**< Channel [n] enable set */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_ENACLR register bit masks - * @{ - */ -#define UDMA_ENACLR_CLR 0xFFFFFFFF /**< Channel [n] enable clear */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_ALTSET register bit masks - * @{ - */ -#define UDMA_ALTSET_SET 0xFFFFFFFF /**< Channel [n] alternate set */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_ALTCLR register bit masks - * @{ - */ -#define UDMA_ALTCLR_CLR 0xFFFFFFFF /**< Channel [n] alternate clear */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_PRIOSET register bit masks - * @{ - */ -#define UDMA_PRIOSET_SET 0xFFFFFFFF /**< Channel [n] priority set */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_PRIOCLR register bit masks - * @{ - */ -#define UDMA_PRIOCLR_CLR 0xFFFFFFFF /**< Channel [n] priority clear */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_ERRCLR register bit masks - * @{ - */ -#define UDMA_ERRCLR_ERRCLR 0x00000001 /**< uDMA bus error status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_CHASGN register bit masks - * @{ - */ -#define UDMA_CHASGN_CHASGN 0xFFFFFFFF /**< Channel [n] assignment select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_CHIS register bit masks - * @{ - */ -#define UDMA_CHIS_CHIS 0xFFFFFFFF /**< Channel [n] interrupt status */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_CHMAP0 register bit masks - * @{ - */ -#define UDMA_CHMAP0_CH7SEL 0xF0000000 /**< uDMA channel 7 source select */ -#define UDMA_CHMAP0_CH6SEL 0x0F000000 /**< uDMA channel 6 source select */ -#define UDMA_CHMAP0_CH5SEL 0x00F00000 /**< uDMA channel 5 source select */ -#define UDMA_CHMAP0_CH4SEL 0x000F0000 /**< uDMA channel 4 source select */ -#define UDMA_CHMAP0_CH3SEL 0x0000F000 /**< uDMA channel 3 source select */ -#define UDMA_CHMAP0_CH2SEL 0x00000F00 /**< uDMA channel 2 source select */ -#define UDMA_CHMAP0_CH1SEL 0x000000F0 /**< uDMA channel 1 source select */ -#define UDMA_CHMAP0_CH0SEL 0x0000000F /**< uDMA channel 0 source select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UDMA_CHMAP1 register bit masks - * @{ - */ -#define UDMA_CHMAP1_CH15SEL 0xF0000000 /**< uDMA channel 15 source select */ -#define UDMA_CHMAP1_CH14SEL 0x0F000000 /**< uDMA channel 14 source select */ -#define UDMA_CHMAP1_CH13SEL 0x00F00000 /**< uDMA channel 13 source select */ -#define UDMA_CHMAP1_CH12SEL 0x000F0000 /**< uDMA channel 12 source select */ -#define UDMA_CHMAP1_CH11SEL 0x0000F000 /**< uDMA channel 11 source select */ -#define UDMA_CHMAP1_CH10SEL 0x00000F00 /**< uDMA channel 10 source select */ -#define UDMA_CHMAP1_CH9SEL 0x000000F0 /**< uDMA channel 9 source select */ -#define UDMA_CHMAP1_CH8SEL 0x0000000F /**< uDMA channel 8 source select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_CHMAP2 register bit masks - * @{ - */ -#define UDMA_CHMAP2_CH23SEL 0xF0000000 /**< uDMA channel 23 source select */ -#define UDMA_CHMAP2_CH22SEL 0x0F000000 /**< uDMA channel 22 source select */ -#define UDMA_CHMAP2_CH21SEL 0x00F00000 /**< uDMA channel 21 source select */ -#define UDMA_CHMAP2_CH20SEL 0x000F0000 /**< uDMA channel 20 source select */ -#define UDMA_CHMAP2_CH19SEL 0x0000F000 /**< uDMA channel 19 source select */ -#define UDMA_CHMAP2_CH18SEL 0x00000F00 /**< uDMA channel 18 source select */ -#define UDMA_CHMAP2_CH17SEL 0x000000F0 /**< uDMA channel 17 source select */ -#define UDMA_CHMAP2_CH16SEL 0x0000000F /**< uDMA channel 16 source select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UDMA_CHMAP3 register bit masks - * @{ - */ -#define UDMA_CHMAP3_CH31SEL 0xF0000000 /**< uDMA channel 31 source select */ -#define UDMA_CHMAP3_CH30SEL 0x0F000000 /**< uDMA channel 30 source select */ -#define UDMA_CHMAP3_CH29SEL 0x00F00000 /**< uDMA channel 29 source select */ -#define UDMA_CHMAP3_CH28SEL 0x000F0000 /**< uDMA channel 28 source select */ -#define UDMA_CHMAP3_CH27SEL 0x0000F000 /**< uDMA channel 27 source select */ -#define UDMA_CHMAP3_CH26SEL 0x00000F00 /**< uDMA channel 26 source select */ -#define UDMA_CHMAP3_CH25SEL 0x000000F0 /**< uDMA channel 25 source select */ -#define UDMA_CHMAP3_CH24SEL 0x0000000F /**< uDMA channel 24 source select */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name uDMA Channel encoding assignments - * @{ - */ -/* Channel 0 */ -#define UDMA_CH0_RESERVED0 0x00 -#define UDMA_CH0_RESERVED1 0x01 -#define UDMA_CH0_RESERVED2 0x02 -#define UDMA_CH0_RESERVED3 0x03 -#define UDMA_CH0_USB 0x04 - -/* Channel 1 */ -#define UDMA_CH1_RESERVED0 0x00 -#define UDMA_CH1_RESERVED1 0x01 -#define UDMA_CH1_RESERVED2 0x02 -#define UDMA_CH1_RESERVED3 0x03 -#define UDMA_CH1_ADC 0x04 - -/* Channel 2 */ -#define UDMA_CH2_RESERVED0 0x00 -#define UDMA_CH2_TIMER3A 0x01 -#define UDMA_CH2_RESERVED2 0x02 -#define UDMA_CH2_RESERVED3 0x03 -#define UDMA_CH2_FLASH 0x04 - -/* Channel 3 */ -#define UDMA_CH3_RESERVED0 0x00 -#define UDMA_CH3_TIMER3B 0x01 -#define UDMA_CH3_RESERVED2 0x02 -#define UDMA_CH3_RESERVED3 0x03 -#define UDMA_CH3_RFCORETRG1 0x04 - -/* Channel 4 */ -#define UDMA_CH4_RESERVED0 0x00 -#define UDMA_CH4_TIMER2A 0x01 -#define UDMA_CH4_RESERVED2 0x02 -#define UDMA_CH4_RESERVED3 0x03 -#define UDMA_CH4_RFCORETRG2 0x04 - -/* Channel 5 */ -#define UDMA_CH5_RESERVED0 0x00 -#define UDMA_CH5_TIMER2B 0x01 -#define UDMA_CH5_RESERVED2 0x02 -#define UDMA_CH5_RESERVED3 0x03 -#define UDMA_CH5_RESERVED4 0x04 - -/* Channel 6 */ -#define UDMA_CH6_RESERVED0 0x00 -#define UDMA_CH6_TIMER2A 0x01 -#define UDMA_CH6_RESERVED2 0x02 -#define UDMA_CH6_RESERVED3 0x03 -#define UDMA_CH6_RESERVED4 0x04 - -/* Channel 7 */ -#define UDMA_CH7_RESERVED0 0x00 -#define UDMA_CH7_TIMER2B 0x01 -#define UDMA_CH7_RESERVED2 0x02 -#define UDMA_CH7_RESERVED3 0x03 -#define UDMA_CH7_RESERVED4 0x04 - -/* Channel 8 */ -#define UDMA_CH8_UART0RX 0x00 -#define UDMA_CH8_UART1RX 0x01 -#define UDMA_CH8_RESERVED2 0x02 -#define UDMA_CH8_RESERVED3 0x03 -#define UDMA_CH8_RESERVED4 0x04 - -/* Channel 9 */ -#define UDMA_CH9_UART0TX 0x00 -#define UDMA_CH9_UART1TX 0x01 -#define UDMA_CH9_RESERVED2 0x02 -#define UDMA_CH9_RESERVED3 0x03 -#define UDMA_CH9_RESERVED4 0x04 - -/* Channel 10 */ -#define UDMA_CH10_SSI0RX 0x00 -#define UDMA_CH10_SSI1RX 0x01 -#define UDMA_CH10_RESERVED2 0x02 -#define UDMA_CH10_RESERVED3 0x03 -#define UDMA_CH10_RESERVED4 0x04 - -/* Channel 11 */ -#define UDMA_CH11_SSI0TX 0x00 -#define UDMA_CH11_SSI1TX 0x01 -#define UDMA_CH11_RESERVED2 0x02 -#define UDMA_CH11_RESERVED3 0x03 -#define UDMA_CH11_RESERVED4 0x04 - -/* Channel 12 */ -#define UDMA_CH12_RESERVED0 0x00 -#define UDMA_CH12_RESERVED1 0x01 -#define UDMA_CH12_RESERVED2 0x02 -#define UDMA_CH12_RESERVED3 0x03 -#define UDMA_CH12_RESERVED4 0x04 - -/* Channel 13 */ -#define UDMA_CH13_RESERVED0 0x00 -#define UDMA_CH13_RESERVED1 0x01 -#define UDMA_CH13_RESERVED2 0x02 -#define UDMA_CH13_RESERVED3 0x03 -#define UDMA_CH13_RESERVED4 0x04 - -/* Channel 14 */ -#define UDMA_CH14_ADC0 0x00 -#define UDMA_CH14_TIMER2A 0x01 -#define UDMA_CH14_RESERVED2 0x02 -#define UDMA_CH14_RESERVED3 0x03 -#define UDMA_CH14_RESERVED4 0x04 - -/* Channel 15 */ -#define UDMA_CH15_ADC1 0x00 -#define UDMA_CH15_TIMER2B 0x01 -#define UDMA_CH15_RESERVED2 0x02 -#define UDMA_CH15_RESERVED3 0x03 -#define UDMA_CH15_RESERVED4 0x04 - -/* Channel 16 */ -#define UDMA_CH16_ADC2 0x00 -#define UDMA_CH16_RESERVED1 0x01 -#define UDMA_CH16_RESERVED2 0x02 -#define UDMA_CH16_RESERVED3 0x03 -#define UDMA_CH16_RESERVED4 0x04 - -/* Channel 17 */ -#define UDMA_CH17_ADC3 0x00 -#define UDMA_CH17_RESERVED1 0x01 -#define UDMA_CH17_RESERVED2 0x02 -#define UDMA_CH17_RESERVED3 0x03 -#define UDMA_CH17_RESERVED4 0x04 - -/* Channel 18 */ -#define UDMA_CH18_TIMER0A 0x00 -#define UDMA_CH18_TIMER1A 0x01 -#define UDMA_CH18_RESERVED2 0x02 -#define UDMA_CH18_RESERVED3 0x03 -#define UDMA_CH18_RESERVED4 0x04 - -/* Channel 19 */ -#define UDMA_CH19_TIMER0B 0x00 -#define UDMA_CH19_TIMER1B 0x01 -#define UDMA_CH19_RESERVED2 0x02 -#define UDMA_CH19_RESERVED3 0x03 -#define UDMA_CH19_RESERVED4 0x04 - -/* Channel 20 */ -#define UDMA_CH20_TIMER1A 0x00 -#define UDMA_CH20_RESERVED1 0x01 -#define UDMA_CH20_RESERVED2 0x02 -#define UDMA_CH20_RESERVED3 0x03 -#define UDMA_CH20_RESERVED4 0x04 - -/* Channel 21 */ -#define UDMA_CH21_TIMER1B 0x00 -#define UDMA_CH21_RESERVED1 0x01 -#define UDMA_CH21_RESERVED2 0x02 -#define UDMA_CH21_RESERVED3 0x03 -#define UDMA_CH21_RESERVED4 0x04 - -/* Channel 22 */ -#define UDMA_CH22_UART1RX 0x00 -#define UDMA_CH22_RESERVED1 0x01 -#define UDMA_CH22_RESERVED2 0x02 -#define UDMA_CH22_RESERVED3 0x03 -#define UDMA_CH22_RESERVED4 0x04 - -/* Channel 23 */ -#define UDMA_CH23_UART1TX 0x00 -#define UDMA_CH23_RESERVED1 0x01 -#define UDMA_CH23_RESERVED2 0x02 -#define UDMA_CH23_RESERVED3 0x03 -#define UDMA_CH23_RESERVED4 0x04 - -/* Channel 24 */ -#define UDMA_CH24_SSI1RX 0x00 -#define UDMA_CH24_ADC4 0x01 -#define UDMA_CH24_RESERVED2 0x02 -#define UDMA_CH24_RESERVED3 0x03 -#define UDMA_CH24_RESERVED4 0x04 - -/* Channel 25 */ -#define UDMA_CH25_SSI1TX 0x00 -#define UDMA_CH25_ADC5 0x01 -#define UDMA_CH25_RESERVED2 0x02 -#define UDMA_CH25_RESERVED3 0x03 -#define UDMA_CH25_RESERVED4 0x04 - -/* Channel 26 */ -#define UDMA_CH26_RESERVED0 0x00 -#define UDMA_CH26_ADC6 0x01 -#define UDMA_CH26_RESERVED2 0x02 -#define UDMA_CH26_RESERVED3 0x03 -#define UDMA_CH26_RESERVED4 0x04 - -/* Channel 27 */ -#define UDMA_CH27_RESERVED0 0x00 -#define UDMA_CH27_ADC7 0x01 -#define UDMA_CH27_RESERVED2 0x02 -#define UDMA_CH27_RESERVED3 0x03 -#define UDMA_CH27_RESERVED4 0x04 - -/* Channel 28 */ -#define UDMA_CH28_RESERVED0 0x00 -#define UDMA_CH28_RESERVED1 0x01 -#define UDMA_CH28_RESERVED2 0x02 -#define UDMA_CH28_RESERVED3 0x03 -#define UDMA_CH28_RESERVED4 0x04 - -/* Channel 29 */ -#define UDMA_CH29_RESERVED0 0x00 -#define UDMA_CH29_RESERVED1 0x01 -#define UDMA_CH29_RESERVED2 0x02 -#define UDMA_CH29_RESERVED3 0x03 -#define UDMA_CH29_RFCORET2TRG1 0x04 - -/* Channel 30 */ -#define UDMA_CH30_SW 0x00 -#define UDMA_CH30_RESERVED1 0x01 -#define UDMA_CH30_RESERVED2 0x02 -#define UDMA_CH30_RESERVED3 0x03 -#define UDMA_CH30_RFCORET2TRG2 0x04 - -/* Channel 31 */ -#define UDMA_CH31_RESERVED0 0x00 -#define UDMA_CH31_RESERVED1 0x01 -#define UDMA_CH31_RESERVED2 0x02 -#define UDMA_CH31_RESERVED3 0x03 -#define UDMA_CH31_RESERVED4 0x04 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Values to ORd together as the ctrl argument of - * udma_set_channel_control_word() - * @{ - */ -#define UDMA_CHCTL_DSTINC_NONE 0xC0000000 /**< Dst address no increment */ -#define UDMA_CHCTL_DSTINC_32 0x80000000 /**< Dst address increment 32 bit */ -#define UDMA_CHCTL_DSTINC_16 0x40000000 /**< Dst address increment 16 bit */ -#define UDMA_CHCTL_DSTINC_8 0x00000000 /**< Dst address increment 8 bit */ - -#define UDMA_CHCTL_DSTSIZE_32 0x20000000 /**< Destination size 32 bit */ -#define UDMA_CHCTL_DSTSIZE_16 0x10000000 /**< Destination size 16 bit */ -#define UDMA_CHCTL_DSTSIZE_8 0x00000000 /**< Destination size 8 bit */ - -#define UDMA_CHCTL_SRCINC_NONE 0x0C000000 /**< Source address no increment */ -#define UDMA_CHCTL_SRCINC_32 0x08000000 /**< Source address increment 32 bit */ -#define UDMA_CHCTL_SRCINC_16 0x04000000 /**< Source address increment 16 bit */ -#define UDMA_CHCTL_SRCINC_8 0x00000000 /**< Source address increment 8 bit */ - -#define UDMA_CHCTL_SRCSIZE_32 0x02000000 /**< Source size 32 bit */ -#define UDMA_CHCTL_SRCSIZE_16 0x01000000 /**< Source size 16 bit */ -#define UDMA_CHCTL_SRCSIZE_8 0x00000000 /**< Source size 8 bit */ - -#define UDMA_CHCTL_ARBSIZE_1 0x00000000 /**< Arbitration size 1 Transfer */ -#define UDMA_CHCTL_ARBSIZE_2 0x00004000 /**< Arbitration size 2 Transfers */ -#define UDMA_CHCTL_ARBSIZE_4 0x00008000 /**< Arbitration size 4 Transfers */ -#define UDMA_CHCTL_ARBSIZE_8 0x0000C000 /**< Arbitration size 8 Transfers */ -#define UDMA_CHCTL_ARBSIZE_16 0x00010000 /**< Arbitration size 16 Transfers */ -#define UDMA_CHCTL_ARBSIZE_32 0x00014000 /**< Arbitration size 32 Transfers */ -#define UDMA_CHCTL_ARBSIZE_64 0x00018000 /**< Arbitration size 64 Transfers */ -#define UDMA_CHCTL_ARBSIZE_128 0x0001C000 /**< Arbitration size 128 Transfers */ -#define UDMA_CHCTL_ARBSIZE_256 0x00020000 /**< Arbitration size 256 Transfers */ -#define UDMA_CHCTL_ARBSIZE_512 0x00024000 /**< Arbitration size 512 Transfers */ -#define UDMA_CHCTL_ARBSIZE_1024 0x00028000 /**< Arbitration size 1024 Transfers */ - -#define UDMA_CHCTL_XFERMODE_STOP 0x00000000 /**< Stop */ -#define UDMA_CHCTL_XFERMODE_BASIC 0x00000001 /**< Basic */ -#define UDMA_CHCTL_XFERMODE_AUTO 0x00000002 /**< Auto-Request */ -#define UDMA_CHCTL_XFERMODE_PINGPONG 0x00000003 /**< Ping-Pong */ -#define UDMA_CHCTL_XFERMODE_MEM_SG 0x00000004 /**< Memory Scatter-Gather */ -#define UDMA_CHCTL_XFERMODE_MEM_SGA 0x00000005 /**< Memory Scatter-Gather Alt */ -#define UDMA_CHCTL_XFERMODE_PER_SG 0x00000006 /**< Peripheral Scatter-Gather */ -#define UDMA_CHCTL_XFERMODE_PER_SGA 0x00000007 /**< Peripheral Scatter-Gather Alt */ -/** @} */ -/*---------------------------------------------------------------------------*/ - -/** - * \brief Initialise the uDMA driver - * - * Prepares the channel control structure and enables the controller - */ -void udma_init(void); - -/** - * \brief Sets the channels source address - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - * \param src_end The source's end address - */ -void udma_set_channel_src(uint8_t channel, uint32_t src_end); - -/** - * \brief Sets the channel's destination address - * \param dst_end The destination's end address - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - */ -void udma_set_channel_dst(uint8_t channel, uint32_t dst_end); - -/** - * \brief Configure the channel's control word - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - * \param ctrl The value of the control word - * - * The value of the control word is generated by ORing the values defined as - * UDMA_CHCTL_xyz - * - * For example, to configure a channel with 8 bit source and destination size, - * 0 source increment and 8 bit destination increment, one would need to pass - * UDMA_CHCTL_DSTINC_8 | UDMA_CHCTL_SRCINC_NONE | UDMA_CHCTL_SRCSIZE_8 | - * UDMA_CHCTL_DSTSIZE_8 - * - * Macros defined as 0 can be omitted. - */ -void udma_set_channel_control_word(uint8_t channel, uint32_t ctrl); - -/** - * \brief Choose an encoding for a uDMA channel - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - * \param enc A value in [0 , 4] - * - * Possible values for the \e encoding param are defined as UDMA_CHnn_xyz - */ -void udma_set_channel_assignment(uint8_t channel, uint8_t enc); - -/** - * \brief Enables a uDMA channel - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - */ -void udma_channel_enable(uint8_t channel); - -/** - * \brief Disables a uDMA channel - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - */ -void udma_channel_disable(uint8_t channel); - -/** - * \brief Use the alternate control data structure for a channel - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - * - * \note Currently, the driver only reserves memory space for primary contrl - * data structures - */ -void udma_channel_use_alternate(uint8_t channel); - -/** - * \brief Use the primary control data structure for a channel - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - */ -void udma_channel_use_primary(uint8_t channel); - -/** - * \brief Set a uDMA channel to high priority - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - */ -void udma_channel_prio_set_high(uint8_t channel); - -/** - * \brief Set a uDMA channel to default priority - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - */ -void udma_channel_prio_set_default(uint8_t channel); - -/** - * \brief Configure a channel to only use burst transfers - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - * - * \note The uDMA controller may under certain conditions automatically disable - * burst mode, in which case this function will need to be called again to - * re-enable them - */ -void udma_channel_use_burst(uint8_t channel); - -/** - * \brief Configure a channel to use single as well as burst requests - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - */ -void udma_channel_use_single(uint8_t channel); - -/** - * \brief Disable peripheral triggers for a uDMA channel - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - * - * Calling this function will result in the uDMA controller not acknowledging - * peripheral-generated transfer triggers. Afterwards, the channel may be used - * with software triggers - */ -void udma_channel_mask_set(uint8_t channel); - -/** - * \brief Enable peripheral triggers for a uDMA channel - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - */ -void udma_channel_mask_clr(uint8_t channel); - -/** - * \brief Generate a software trigger to start a transfer - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - */ -void udma_channel_sw_request(uint8_t channel); - -/** - * \brief Retrieve the current mode for a channel - * \param channel The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] - * \return The channel's current mode - * - * The return value will be one of the UDMA_CHCTL_XFERMODE_xyz defines. This - * function is useful to determine whether a uDMA transfer has completed, in - * which case the return value will be UDMA_CHCTL_XFERMODE_STOP - */ -uint8_t udma_channel_get_mode(uint8_t channel); - -/** - * \brief Calculate the value of the xfersize field in the control structure - * \param len The number of items to be transferred - * \return The value to be written to the control structure to achieve the - * desired transfer size - * - * If we want to transfer \e len items, we will normally do something like - * udma_set_channel_control_word(OTHER_FLAGS | udma_xfer_size(len)) - */ -#define udma_xfer_size(len) ((len - 1) << 4) - -#endif /* UDMA_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/usb-regs.h b/arch/cpu/cc2538/dev/usb-regs.h deleted file mode 100644 index 5c82c4d21..000000000 --- a/arch/cpu/cc2538/dev/usb-regs.h +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-usb cc2538 USB controller - * - * Driver for the cc2538 USB controller. - * - * We use the USB core in cpu/cc253x/usb which is known to work on Linux as - * well as on OS X. - * @{ - * - * \file - * Header file with declarations for the cc2538 USB registers - */ -#ifndef USB_REGS_H_ -#define USB_REGS_H_ - -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -/** - * \name USB Register Offsets - * @{ - */ -#define USB_ADDR 0x40089000 /**< Function address */ -#define USB_POW 0x40089004 /**< Power/Control register */ -#define USB_IIF 0x40089008 /**< IN EPs and EP0 interrupt flags */ -#define USB_OIF 0x40089010 /**< OUT endpoint interrupt flags */ -#define USB_CIF 0x40089018 /**< Common USB interrupt flags */ -#define USB_IIE 0x4008901C /**< IN EPs and EP0 interrupt mask */ -#define USB_OIE 0x40089024 /**< Out EPs interrupt-enable mask */ -#define USB_CIE 0x4008902C /**< Common USB interrupt mask */ -#define USB_FRML 0x40089030 /**< Current frame number (low byte) */ -#define USB_FRMH 0x40089034 /**< Current frame number (high) */ -#define USB_INDEX 0x40089038 /**< Current endpoint index register */ -#define USB_CTRL 0x4008903C /**< USB control register */ -#define USB_MAXI 0x40089040 /**< MAX packet size for IN EPs{1-5} */ -#define USB_CS0_CSIL 0x40089044 /**< EP0 Control and Status or IN EPs - control and status (low) */ -#define USB_CS0 0x40089044 /**< EP0 Control and Status - (Alias for USB_CS0_CSIL) */ -#define USB_CSIL 0x40089044 /**< IN EPs control and status (low) - (Alias for USB_CS0_CSIL) */ -#define USB_CSIH 0x40089048 /**< IN EPs control and status (high) */ -#define USB_MAXO 0x4008904C /**< MAX packet size for OUT EPs */ -#define USB_CSOL 0x40089050 /**< OUT EPs control and status (low) */ -#define USB_CSOH 0x40089054 /**< OUT EPs control and status (high) */ -#define USB_CNT0_CNTL 0x40089058 /**< Number of RX bytes in EP0 FIFO - or number of bytes in EP{1-5} - OUT FIFO (low) */ -#define USB_CNT0 0x40089058 /**< Number of RX bytes in EP0 FIFO - (Alias for USB_CNT0_CNTL) */ -#define USB_CNTL 0x40089058 /**< Number of bytes in EP{1-5} - OUT FIFO (low) - (Alias for USB_CNT0_CNTL) */ -#define USB_CNTH 0x4008905C /**< Number of bytes in EP{1-5} - OUT FIFO (high) */ -#define USB_F0 0x40089080 /**< Endpoint-0 FIFO */ -#define USB_F1 0x40089088 /**< Endpoint-1 FIFO */ -#define USB_F2 0x40089090 /**< Endpoint-2 FIFO */ -#define USB_F3 0x40089098 /**< Endpoint-3 FIFO */ -#define USB_F4 0x400890A0 /**< Endpoint-4 FIFO */ -#define USB_F5 0x400890A8 /**< Endpoint-5 FIFO */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_ADDR Register Bit-Masks - * @{ - */ -#define USB_ADDR_UPDATE 0x00000080 /**< 1 while address updating */ -#define USB_ADDR_USBADDR 0x0000007F /**< Device address */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_POW Register Bit-Masks - * @{ - */ -#define USB_POW_ISO_WAIT_SOF 0x00000080 /**< 1 until SOF received - ISO only */ -#define USB_POW_RST 0x00000008 /**< 1 During reset signaling */ -#define USB_POW_RESUME 0x00000004 /**< Remote wakeup resume signalling */ -#define USB_POW_SUSPEND 0x00000002 /**< Suspend mode entered */ -#define USB_POW_SUSPEND_EN 0x00000001 /**< Suspend enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_IIF Register Bit-Masks - * @{ - */ -#define USB_IIF_INEP5IF 0x00000020 /**< IN EP5 Interrupt flag */ -#define USB_IIF_INEP4IF 0x00000010 /**< IN EP4 Interrupt flag */ -#define USB_IIF_INEP3IF 0x00000008 /**< IN EP3 Interrupt flag */ -#define USB_IIF_INEP2IF 0x00000004 /**< IN EP2 Interrupt flag */ -#define USB_IIF_INEP1IF 0x00000002 /**< IN EP1 Interrupt flag */ -#define USB_IIF_EP0IF 0x00000001 /**< EP0 Interrupt flag */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_OIF Register Bit-Masks - * @{ - */ -#define USB_OIF_OUTEP5IF 0x00000020 /**< OUT EP5 Interrupt flag */ -#define USB_OIF_OUTEP4IF 0x00000010 /**< OUT EP4 Interrupt flag */ -#define USB_OIF_OUTEP3IF 0x00000008 /**< OUT EP3 Interrupt flag */ -#define USB_OIF_OUTEP2IF 0x00000004 /**< OUT EP2 Interrupt flag */ -#define USB_OIF_OUTEP1IF 0x00000002 /**< OUT EP1 Interrupt flag */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_CIF Register Bit-Masks - * @{ - */ -#define USB_CIF_SOFIF 0x00000008 /**< Start-of-frame interrupt flag */ -#define USB_CIF_RSTIF 0x00000004 /**< Reset interrupt flag */ -#define USB_CIF_RESUMEIF 0x00000002 /**< Resume interrupt flag */ -#define USB_CIF_SUSPENDIF 0x00000001 /**< Suspend interrupt flag */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_IIE Register Bit-Masks - * @{ - */ -#define USB_IIE_INEP5IE 0x00000020 /**< IN EP5 interrupt enable */ -#define USB_IIE_INEP4IE 0x00000010 /**< IN EP4 interrupt enable */ -#define USB_IIE_INEP3IE 0x00000008 /**< IN EP3 interrupt enable */ -#define USB_IIE_INEP2IE 0x00000004 /**< IN EP2 interrupt enable */ -#define USB_IIE_INEP1IE 0x00000002 /**< IN EP1 interrupt enable */ -#define USB_IIE_EP0IE 0x00000001 /**< EP0 interrupt enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_OIE Register Bit-Masks - * @{ - */ -#define USB_OIE_OUTEP5IE 0x00000020 /**< OUT EP5 interrupt enable */ -#define USB_OIE_OUTEP4IE 0x00000010 /**< OUT EP4 interrupt enable */ -#define USB_OIE_OUTEP3IE 0x00000008 /**< OUT EP3 interrupt enable */ -#define USB_OIE_OUTEP2IE 0x00000004 /**< OUT EP2 interrupt enable */ -#define USB_OIE_OUTEP1IE 0x00000002 /**< OUT EP1 interrupt enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_CIE Register Bit-Masks - * @{ - */ -#define USB_CIE_SOFIE 0x00000008 /**< Start-of-frame interrupt enable */ -#define USB_CIE_RSTIE 0x00000004 /**< Reset interrupt enable */ -#define USB_CIE_RESUMEIE 0x00000002 /**< Resume interrupt enable */ -#define USB_CIE_SUSPENDIE 0x00000001 /**< Suspend interrupt enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_FRML Register Bit-Masks - * @{ - */ -#define USB_FRML_FRAME 0x000000FF /**< Low byte of 11-bit frame number */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_FRMH Register Bit-Masks - * @{ - */ -#define USB_FRMH_FRAME 0x00000007 /**< 3 MSBs of 11-bit frame number */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_INDEX Register Bit-Masks - * @{ - */ -#define USB_INDEX_USBINDEX 0x0000000F /**< Endpoint selected */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_CTRL Register Bit-Masks - * @{ - */ -#define USB_CTRL_PLL_LOCKED 0x00000080 /**< PLL locked status */ -#define USB_CTRL_PLL_EN 0x00000002 /**< 48-MHz USB PLL enable */ -#define USB_CTRL_USB_EN 0x00000001 /**< USB enable */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_MAXI Register Bit-Masks - * @{ - */ -#define USB_MAXI_USBMAXI 0x000000FF /**< Maximum packet size */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_CS0_CSIL Register Bit-Masks - * @{ - */ -/** Listed as reserved in the UG, is this right? */ -#define USB_CS0_CLR_SETUP_END 0x00000080 - -/** Deassert OUTPKT_RDY bit of this register or reset the data toggle to 0 */ -#define USB_CS0_CSIL_CLR_OUTPKT_RDY_or_CLR_DATA_TOG 0x00000040 -#define USB_CS0_CLR_OUTPKT_RDY 0x00000040 -#define USB_CSIL_CLR_DATA_TOG 0x00000040 - -/** - * Set this bit to 1 to terminate the current transaction or - * is set when a STALL handshake has been sent - */ -#define USB_CS0_CSIL_SEND_STALL_or_SENT_STALL 0x00000020 -#define USB_CS0_SEND_STALL 0x00000020 -#define USB_CSIL_SENT_STALL 0x00000020 - -/** - * Is set if the control transfer ends due to a premature end-of-control - * transfer or set to 1 to make the USB controller reply with a STALL handshake - * when receiving IN tokens - */ -#define USB_CS0_CSIL_SETUP_END_or_SEND_STALL 0x00000010 -#define USB_CS0_SETUP_END 0x00000010 -#define USB_CSIL_SEND_STALL 0x00000010 - -/** - * Signal the end of a data transfer or set to 1 to flush next packet that - * is ready to transfer from the IN FIFO - */ -#define USB_CS0_CSIL_DATA_END_or_FLUSH_PACKET 0x00000008 -#define USB_CS0_DATA_END 0x00000008 -#define USB_CSIL_FLUSH_PACKET 0x00000008 - -/** - * Set when a STALL handshake is sent or set if an IN token is received when - * INPKT_RDY = 0, and a zero-length data packet is transmitted in response to - * the IN token. In bulk/interrupt mode, this bit is set when a NAK is returned - * in response to an IN token - */ -#define USB_CS0_CSIL_SENT_STALL_or_UNDERRUN 0x00000004 -#define USB_CS0_SENT_STALL 0x00000004 -#define USB_CSIL_UNDERRUN 0x00000004 - -/** - * Data packet has been loaded into the EP0 FIFO or at least one packet in the - * IN FIFO - */ -#define USB_CS0_CSIL_INPKT_RDY_or_PKT_PRESENT 0x00000002 -#define USB_CS0_INPKT_RDY 0x00000002 -#define USB_CSIL_PKT_PRESENT 0x00000002 - -/** Data packet received or data packet has been loaded into the IN FIFO */ -#define USB_CS0_CSIL_OUTPKT_RDY_or_INPKT_RDY 0x00000001 -#define USB_CS0_OUTPKT_RDY 0x00000001 -#define USB_CSIL_INPKT_RDY 0x00000001 - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_CSIH Register Bit-Masks - * @{ - */ -#define USB_CSIH_AUTISET 0x00000080 /**< Auto-assert INPKT_RDY */ -#define USB_CSIH_ISO 0x00000040 /**< Selects IN endpoint type */ -#define USB_CSIH_FORCE_DATA_TOG 0x00000008 /**< IN EP force data toggle switch */ -#define USB_CSIH_IN_DBL_BUF 0x00000001 /**< Double buffering enable (IN FIFO) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_MAXO Register Bit-Masks - * @{ - */ -#define USB_MAXO_USBMAXO 0x000000FF /**< Maximum packet size */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_CSOL Register Bit-Masks - * @{ - */ -#define USB_CSOL_CLR_DATA_TOG 0x00000080 /**< Setting resets data toggle to 0 */ -#define USB_CSOL_SENT_STALL 0x00000040 /**< STALL handshake sent */ -#define USB_CSOL_SEND_STALL 0x00000020 /**< Reply with STALL to OUT tokens */ -#define USB_CSOL_FLUSH_PACKET 0x00000010 /**< Flush next packet read from OUT FIFO */ -#define USB_CSOL_DATA_ERROR 0x00000008 /**< CRC or bit-stuff error in RX packet */ -#define USB_CSOL_OVERRUN 0x00000004 /**< OUT packet can not be loaded into OUT FIFO */ -#define USB_CSOL_FIFO_FULL 0x00000002 /**< OUT FIFO full */ -#define USB_CSOL_OUTPKT_RDY 0x00000001 /**< OUT packet read in OUT FIFO */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_CSOH Register Bit-Masks - * @{ - */ -#define USB_CSOH_AUTOCLEAR 0x00000080 /**< Auto-clear OUTPKT_RDY */ -#define USB_CSOH_ISO 0x00000040 /**< Selects OUT endpoint type */ -#define USB_CSOH_OUT_DBL_BUF 0x00000001 /**< Double buffering enable (OUT FIFO) */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_CNT0_CNTL Register Bit-Masks - * @{ - */ -#define USB_CNT0_CNTL_USBCNT0 0x0000003F /**< Number of RX bytes in EP0 FIFO */ -#define USB_CNT0_USBCNT0 0x0000003F - -#define USB_CNT0_CNTL_USBCNT_5_0 0x0000003F /**< 6 LSBs of the number of RX - bytes in EP1-5 OUT FIFO */ -#define USB_CNTL_USBCNT_5_0 0x0000003F -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_CNTH Register Bit-Masks - * @{ - */ -#define USB_CNTH_USBCNT 0x00000007 /**< 3 MSBs of RX byte number */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB_F[0-5] Register Bit-Masks - * @{ - */ -#define USB_F0_USBF0 0x000000FF /**< Endpoint 0 FIFO mask */ -#define USB_F1_USBF1 0x000000FF /**< Endpoint 1 FIFO mask */ -#define USB_F2_USBF2 0x000000FF /**< Endpoint 2 FIFO mask */ -#define USB_F3_USBF3 0x000000FF /**< Endpoint 3 FIFO mask */ -#define USB_F4_USBF4 0x000000FF /**< Endpoint 4 FIFO mask */ -#define USB_F5_USBF5 0x000000FF /**< Endpoint 5 FIFO mask */ -/** @} */ - -#endif /* USB_REGS_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/vdd3-sensor.c b/arch/cpu/cc2538/dev/vdd3-sensor.c deleted file mode 100644 index 678c25b8e..000000000 --- a/arch/cpu/cc2538/dev/vdd3-sensor.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538-vdd3-sensor - * @{ - * - * \file - * Driver for the CC2538 VDD3 sensor - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/vdd3-sensor.h" -#include "dev/adc.h" -#include "dev/cc2538-sensors.h" - -#include -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - int raw = adc_get(SOC_ADC_ADCCON_CH_VDD_3, SOC_ADC_ADCCON_REF_INT, - SOC_ADC_ADCCON_DIV_512); - - if(type == CC2538_SENSORS_VALUE_TYPE_RAW) { - return raw; - } else if(type == CC2538_SENSORS_VALUE_TYPE_CONVERTED) { - return raw * (3 * 1190) / (2047 << 4); - } - - return CC2538_SENSORS_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(vdd3_sensor, VDD3_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc2538/dev/vdd3-sensor.h b/arch/cpu/cc2538/dev/vdd3-sensor.h deleted file mode 100644 index aa0fcf94c..000000000 --- a/arch/cpu/cc2538/dev/vdd3-sensor.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538-sensors - * @{ - * - * \defgroup cc2538-vdd3-sensor CC2538 VDD3 Sensor - * - * Driver for the CC2538 VDD3 sensor - * - * This driver can return the raw as well as the converted value of the sensor - * reading. This is controlled by the type argument of the sensor driver's - * value() function. The choices for the type argument are: - * - REMOTE_SENSORS_VALUE_TYPE_RAW (value() returns the raw reading) - * - REMOTE_SENSORS_VALUE_TYPE_CONVERTED (value() returns mV) - * @{ - * - * \file - * Header file for the CC2538 VDD3 Sensor Driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef VDD3_SENSOR_H_ -#define VDD3_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -/** - * \name VDD3 sensors - * @{ - */ -#define VDD3_SENSOR "VDD3" -/** @} */ -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor vdd3_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* VDD3_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/dev/watchdog.c b/arch/cpu/cc2538/dev/watchdog.c deleted file mode 100644 index 9f306e586..000000000 --- a/arch/cpu/cc2538/dev/watchdog.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-wdt cc2538 watchdog timer driver - * - * Driver for the cc2538 Watchdog Timer - * @{ - * - * \file - * Implementation of the cc2538 watchdog driver. The peripheral runs in - * watchdog mode. - */ -#include "contiki.h" -#include "reg.h" -#include "cpu.h" -#include "dev/smwdthrosc.h" -/*---------------------------------------------------------------------------*/ -/* Enabled by default */ -#ifndef WATCHDOG_CONF_ENABLE -#define WATCHDOG_CONF_ENABLE 1 -#endif - -#if WATCHDOG_CONF_ENABLE -#define WATCHDOG_ENABLE SMWDTHROSC_WDCTL_EN -#else -#define WATCHDOG_ENABLE 0 -#endif -/*---------------------------------------------------------------------------*/ -/** \brief Initialisation function for the WDT. Currently simply explicitly - * sets the WDT interval to max interval */ -void -watchdog_init(void) -{ - /* Max interval, don't enable yet */ - REG(SMWDTHROSC_WDCTL) = 0; -} -/*---------------------------------------------------------------------------*/ -/** \brief Starts the WDT in watchdog mode if enabled by user configuration, - * maximum interval */ -void -watchdog_start(void) -{ - /* Max interval (32768), watchdog mode, enable if configured to do so */ - REG(SMWDTHROSC_WDCTL) = WATCHDOG_ENABLE; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Writes the WDT clear sequence. - * - * Due to how the SMWDTHROSC_WDCTL works, it is OK to simply write these bits - * rather than use RMW operations. - */ -void -watchdog_periodic(void) -{ - REG(SMWDTHROSC_WDCTL) = (SMWDTHROSC_WDCTL_CLR_3 | SMWDTHROSC_WDCTL_CLR_1); - REG(SMWDTHROSC_WDCTL) = (SMWDTHROSC_WDCTL_CLR_2 | SMWDTHROSC_WDCTL_CLR_0); -} -/*---------------------------------------------------------------------------*/ -/** \brief Keeps control until the WDT throws a reset signal. Starts the WDT - * if not already started. */ -void -watchdog_reboot(void) -{ - INTERRUPTS_DISABLE(); - - /* - * If the WDT is not started, set minimum interval and start - * If the WDT is started, this will have no effect - */ - REG(SMWDTHROSC_WDCTL) = SMWDTHROSC_WDCTL_INT | SMWDTHROSC_WDCTL_EN; - - while(1); -} -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/doxygen-group.txt b/arch/cpu/cc2538/doxygen-group.txt deleted file mode 100644 index 6e88228b1..000000000 --- a/arch/cpu/cc2538/doxygen-group.txt +++ /dev/null @@ -1,14 +0,0 @@ -/** - * \defgroup cc2538 The TI CC2538 System-on-Chip - * - * CPU-Specific functionality - available to all cc2538-based platforms - * - * \ingroup cpu - */ - -/** - * \defgroup cc2538-platforms TI CC2538-powered platforms - * - * Documentation for all platforms powered by the TI cc2538 System-on-Chip - * \ingroup platform - */ diff --git a/arch/cpu/cc2538/ieee-addr.c b/arch/cpu/cc2538/ieee-addr.c deleted file mode 100644 index 6a676f4eb..000000000 --- a/arch/cpu/cc2538/ieee-addr.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-ieee-addr - * @{ - * - * \file - * Driver for the cc2538 IEEE addresses - */ -#include "contiki.h" -#include "net/linkaddr.h" -#include "ieee-addr.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -void -ieee_addr_cpy_to(uint8_t *dst, uint8_t len) -{ - if(IEEE_ADDR_CONF_HARDCODED) { - uint8_t ieee_addr_hc[8] = IEEE_ADDR_CONF_ADDRESS; - - memcpy(dst, &ieee_addr_hc[8 - len], len); - } else { - /* - * By default, we assume that the IEEE address is stored on flash using - * little-endian byte order. - * - * However, some SoCs ship with a different byte order, whereby the first - * four bytes are flipped with the four last ones. - * - * Using this address as an example: 00 12 4B 00 01 02 03 04 - * We expect it stored as: 04 03 02 01 00 4B 12 00 - * But it is also possible to encounter: 00 4B 12 00 04 03 02 01 - * - * Thus: read locations [3, 2, 1] and if we encounter the TI OUI, flip the - * order of the two 4-byte sequences. Each of the 4-byte sequences is still - * little-endian. - */ - int i; - uint8_t oui_ti[3] = IEEE_ADDR_OUI_TI; - if(((uint8_t *)IEEE_ADDR_LOCATION)[3] == oui_ti[0] - && ((uint8_t *)IEEE_ADDR_LOCATION)[2] == oui_ti[1] - && ((uint8_t *)IEEE_ADDR_LOCATION)[1] == oui_ti[2]) { - for(i = 0; i < len; i++) { - dst[len - i - 1] = ((uint8_t *)IEEE_ADDR_LOCATION)[i < 4 ? i + 4 : i - 4]; - } - } else { - for(i = 0; i < len; i++) { - dst[i] = ((uint8_t *)IEEE_ADDR_LOCATION)[len - 1 - i]; - } - } - } - -#if IEEE_ADDR_NODE_ID - dst[len - 1] = IEEE_ADDR_NODE_ID & 0xFF; - dst[len - 2] = IEEE_ADDR_NODE_ID >> 8; -#endif -} - -/** @} */ diff --git a/arch/cpu/cc2538/ieee-addr.h b/arch/cpu/cc2538/ieee-addr.h deleted file mode 100644 index 3f1d4728b..000000000 --- a/arch/cpu/cc2538/ieee-addr.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2013, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-ieee-addr cc2538 IEEE Address Control - * - * Driver for the retrieval of an IEEE address from flash - * @{ - * - * \file - * Header file with register and macro declarations for the cc2538 IEEE address - * driver - */ -#ifndef IEEE_ADDR_H_ -#define IEEE_ADDR_H_ - -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \name TI OUI - * @{ - */ -#define IEEE_ADDR_OUI_TI { 0x00, 0x12, 0x4B } /**< TI OUI */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name IEEE address locations - * - * The address of the secondary location can be configured by the platform - * or example - * - * @{ - */ -#define IEEE_ADDR_LOCATION_PRIMARY 0x00280028 /**< Primary IEEE address location */ - -#ifdef IEEE_ADDR_CONF_LOCATION_SECONDARY -#define IEEE_ADDR_LOCATION_SECONDARY IEEE_ADDR_CONF_LOCATION_SECONDARY -#else -#define IEEE_ADDR_LOCATION_SECONDARY 0x0027FFCC /**< Secondary IEEE address location */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Select which address location to use - * @{ - */ -#if IEEE_ADDR_CONF_USE_SECONDARY_LOCATION -#define IEEE_ADDR_LOCATION IEEE_ADDR_LOCATION_SECONDARY -#else -#define IEEE_ADDR_LOCATION IEEE_ADDR_LOCATION_PRIMARY -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/* - * \brief Copy the node's IEEE address to a destination memory area - * \param dst A pointer to the destination area where the IEEE address is to be - * written - * \param len The number of bytes to write to destination area - * - * The address will be read from an InfoPage location or a hard-coded address - * will be used, depending on the value of configuration parameter - * IEEE_ADDR_CONF_HARDCODED - * - * This function will copy \e len LS bytes - * - * The destination address will be populated with dst[0] holding the MSB and - * dst[len - 1] holding the LSB - */ -void ieee_addr_cpy_to(uint8_t *dst, uint8_t len); - -#endif /* IEEE_ADDR_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/int-master.c b/arch/cpu/cc2538/int-master.c deleted file mode 100644 index 57a031667..000000000 --- a/arch/cpu/cc2538/int-master.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-interrupts CC2538 master interrupt manipulation - * - * Master interrupt manipulation routines for the CC2538 CPU - * - * @{ - * - * \file - * Master interrupt manipulation implementation for the TI CC2538 - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/int-master.h" - -#include -/*---------------------------------------------------------------------------*/ -void -int_master_enable(void) -{ - __enable_irq(); -} -/*---------------------------------------------------------------------------*/ -int_master_status_t -int_master_read_and_disable(void) -{ - int_master_status_t primask = __get_PRIMASK(); - - __disable_irq(); - - return primask; -} -/*---------------------------------------------------------------------------*/ -void -int_master_status_set(int_master_status_t status) -{ - __set_PRIMASK(status); -} -/*---------------------------------------------------------------------------*/ -bool -int_master_is_enabled(void) -{ - return __get_PRIMASK() ? false : true; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/lpm.c b/arch/cpu/cc2538/lpm.c deleted file mode 100644 index 68cb42ae4..000000000 --- a/arch/cpu/cc2538/lpm.c +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Copyright (c) 2013, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-lpm - * @{ - * - * \file - * Implementation of low power modes ofr the cc2538 - */ -#include "contiki.h" -#include "sys/energest.h" -#include "sys/process.h" -#include "dev/sys-ctrl.h" -#include "dev/rfcore-xreg.h" -#include "rtimer-arch.h" -#include "lpm.h" -#include "cc2538_cm3.h" -#include "reg.h" - -#include -#include -#include - -#if LPM_CONF_ENABLE != 0 -/*---------------------------------------------------------------------------*/ -/* - * Deep Sleep thresholds in rtimer ticks (~30.5 usec) - * - * If Deep Sleep duration < DEEP_SLEEP_PM1_THRESHOLD, simply enter PM0 - * If duration < DEEP_SLEEP_PM2_THRESHOLD drop to PM1 - * else PM2. - */ -#define DEEP_SLEEP_PM1_THRESHOLD 10 -#define DEEP_SLEEP_PM2_THRESHOLD 100 -/*---------------------------------------------------------------------------*/ -#define assert_wfi() do { __asm("wfi"::); } while(0) -/*---------------------------------------------------------------------------*/ -#if LPM_CONF_STATS -rtimer_clock_t lpm_stats[3]; - -#define LPM_STATS_INIT() \ - do { memset(lpm_stats, 0, sizeof(lpm_stats)); } while(0) -#define LPM_STATS_ADD(pm, val) do { lpm_stats[pm] += val; } while(0) -#else -#define LPM_STATS_INIT() -#define LPM_STATS_ADD(stat, val) -#endif -/*---------------------------------------------------------------------------*/ -/* - * Remembers what time it was when went to deep sleep - * This is used when coming out of PM0/1/2 to keep stats - */ -static rtimer_clock_t sleep_enter_time; - -void clock_adjust(void); -/*---------------------------------------------------------------------------*/ -/* Stores the currently specified MAX allowed PM */ -static uint8_t max_pm; -/*---------------------------------------------------------------------------*/ -/* Buffer to store peripheral PM1+ permission FPs */ -#ifdef LPM_CONF_PERIPH_PERMIT_PM1_FUNCS_MAX -#define LPM_PERIPH_PERMIT_PM1_FUNCS_MAX LPM_CONF_PERIPH_PERMIT_PM1_FUNCS_MAX -#else -#define LPM_PERIPH_PERMIT_PM1_FUNCS_MAX 5 -#endif - -static lpm_periph_permit_pm1_func_t -periph_permit_pm1_funcs[LPM_PERIPH_PERMIT_PM1_FUNCS_MAX]; -/*---------------------------------------------------------------------------*/ -static bool -periph_permit_pm1(void) -{ - int i; - - for(i = 0; i < LPM_PERIPH_PERMIT_PM1_FUNCS_MAX && - periph_permit_pm1_funcs[i] != NULL; i++) { - if(!periph_permit_pm1_funcs[i]()) { - return false; - } - } - return true; -} -/*---------------------------------------------------------------------------*/ -/* - * Routine to put is in PM0. We also need to do some housekeeping if the stats - * or the energest module is enabled - */ -static void -enter_pm0(void) -{ - ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM); - - /* Remember the current time so we can keep stats when we wake up */ - if(LPM_CONF_STATS) { - sleep_enter_time = RTIMER_NOW(); - } - - assert_wfi(); - - /* We reach here when the interrupt context that woke us up has returned */ - LPM_STATS_ADD(0, RTIMER_NOW() - sleep_enter_time); - - ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU); -} -/*---------------------------------------------------------------------------*/ -static void -select_32_mhz_xosc(void) -{ - /* First, make sure there is no ongoing clock source change */ - while((REG(SYS_CTRL_CLOCK_STA) & SYS_CTRL_CLOCK_STA_SOURCE_CHANGE) != 0); - - /* Turn on the 32 MHz XOSC and source the system clock on it. */ - REG(SYS_CTRL_CLOCK_CTRL) &= ~SYS_CTRL_CLOCK_CTRL_OSC; - - /* Wait for the switch to take place */ - while((REG(SYS_CTRL_CLOCK_STA) & SYS_CTRL_CLOCK_STA_OSC) != 0); - - /* Power down the unused oscillator and restore divisors (silicon errata) */ - REG(SYS_CTRL_CLOCK_CTRL) = (REG(SYS_CTRL_CLOCK_CTRL) -#if SYS_CTRL_SYS_DIV == SYS_CTRL_CLOCK_CTRL_SYS_DIV_32MHZ - & ~SYS_CTRL_CLOCK_CTRL_SYS_DIV -#endif -#if SYS_CTRL_IO_DIV == SYS_CTRL_CLOCK_CTRL_IO_DIV_32MHZ - & ~SYS_CTRL_CLOCK_CTRL_IO_DIV -#endif - ) | SYS_CTRL_CLOCK_CTRL_OSC_PD; -} -/*---------------------------------------------------------------------------*/ -static void -select_16_mhz_rcosc(void) -{ - /* - * Power up both oscillators in order to speed up the transition to the 32-MHz - * XOSC after wake up. In addition, consider CC2538 silicon errata: - * "Possible Incorrect Value of Clock Dividers after PM2 and PM3" and - * set system clock divisor / I/O clock divisor to 16 MHz in case they run - * at full speed (=32 MHz) - */ - REG(SYS_CTRL_CLOCK_CTRL) = (REG(SYS_CTRL_CLOCK_CTRL) -#if SYS_CTRL_SYS_DIV == SYS_CTRL_CLOCK_CTRL_SYS_DIV_32MHZ - | SYS_CTRL_CLOCK_CTRL_SYS_DIV_16MHZ -#endif -#if SYS_CTRL_IO_DIV == SYS_CTRL_CLOCK_CTRL_IO_DIV_32MHZ - | SYS_CTRL_CLOCK_CTRL_IO_DIV_16MHZ -#endif - ) & ~SYS_CTRL_CLOCK_CTRL_OSC_PD; - - /*First, make sure there is no ongoing clock source change */ - while((REG(SYS_CTRL_CLOCK_STA) & SYS_CTRL_CLOCK_STA_SOURCE_CHANGE) != 0); - - /* Set the System Clock to use the 16MHz RC OSC */ - REG(SYS_CTRL_CLOCK_CTRL) |= SYS_CTRL_CLOCK_CTRL_OSC; - - /* Wait till it's happened */ - while((REG(SYS_CTRL_CLOCK_STA) & SYS_CTRL_CLOCK_STA_OSC) == 0); -} -/*---------------------------------------------------------------------------*/ -void -lpm_exit() -{ - if((REG(SYS_CTRL_PMCTL) & SYS_CTRL_PMCTL_PM3) == SYS_CTRL_PMCTL_PM0) { - /* We either just exited PM0 or we were not sleeping in the first place. - * We don't need to do anything clever */ - return; - } - - /* - * When returning from PM1/2, the sleep timer value (used by RTIMER_NOW()) is - * not up-to-date until a positive edge on the 32-kHz clock has been detected - * after the system clock restarted. To ensure an updated value is read, wait - * for a positive transition on the 32-kHz clock by polling the - * SYS_CTRL_CLOCK_STA.SYNC_32K bit, before reading the sleep timer value. - */ - while(REG(SYS_CTRL_CLOCK_STA) & SYS_CTRL_CLOCK_STA_SYNC_32K); - while(!(REG(SYS_CTRL_CLOCK_STA) & SYS_CTRL_CLOCK_STA_SYNC_32K)); - - LPM_STATS_ADD(REG(SYS_CTRL_PMCTL) & SYS_CTRL_PMCTL_PM3, - RTIMER_NOW() - sleep_enter_time); - - /* Adjust the system clock, since it was not counting while we were sleeping - * We need to convert sleep duration from rtimer ticks to clock ticks */ - clock_adjust(); - - /* Restore system clock to the 32 MHz XOSC */ - select_32_mhz_xosc(); - - if((REG(SYS_CTRL_PMCTL) & SYS_CTRL_PMCTL_PM3) == SYS_CTRL_PMCTL_PM1) { - ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU); - } else { - ENERGEST_SWITCH(ENERGEST_TYPE_DEEP_LPM, ENERGEST_TYPE_CPU); - } - - /* Restore PMCTL to PM0 for next pass */ - REG(SYS_CTRL_PMCTL) = SYS_CTRL_PMCTL_PM0; -} -/*---------------------------------------------------------------------------*/ -void -lpm_enter() -{ - rtimer_clock_t lpm_exit_time; - rtimer_clock_t duration; - - /* - * If either the RF or the registered peripherals are on, dropping to PM1/2 - * would equal pulling the rug (32MHz XOSC) from under their feet. Thus, we - * only drop to PM0. PM0 is also used if max_pm==0. - */ - if((REG(RFCORE_XREG_FSMSTAT0) & RFCORE_XREG_FSMSTAT0_FSM_FFCTRL_STATE) != 0 - || !periph_permit_pm1() || max_pm == 0) { - enter_pm0(); - - /* We reach here when the interrupt context that woke us up has returned */ - return; - } - - /* - * Registered peripherals were off. Radio was off: Some Duty Cycling in place. - * rtimers run on the Sleep Timer. Thus, if we have a scheduled rtimer - * task, a Sleep Timer interrupt will fire and will wake us up. - * Choose the most suitable PM based on anticipated deep sleep duration - */ - lpm_exit_time = rtimer_arch_next_trigger(); - duration = lpm_exit_time - RTIMER_NOW(); - - if(duration < DEEP_SLEEP_PM1_THRESHOLD || lpm_exit_time == 0) { - /* Anticipated duration too short or no scheduled rtimer task. Use PM0 */ - enter_pm0(); - - /* We reach here when the interrupt context that woke us up has returned */ - return; - } - - /* If we reach here, we -may- (but may as well not) be dropping to PM1+. We - * know the registered peripherals and RF are off so we can switch to the - * 16MHz RCOSC. */ - select_16_mhz_rcosc(); - - /* - * Switching the System Clock from the 32MHz XOSC to the 16MHz RC OSC may - * have taken a while. Re-estimate sleep duration. - */ - duration = lpm_exit_time - RTIMER_NOW(); - - if(duration < DEEP_SLEEP_PM1_THRESHOLD) { - /* - * oops... The clock switch took some time and now the remaining sleep - * duration is too short. Restore the clock source to the 32MHz XOSC and - * abort the LPM attempt altogether. We can't drop to PM0, - * we need to yield to main() since we may have events to service now. - */ - select_32_mhz_xosc(); - - return; - } else if(duration >= DEEP_SLEEP_PM2_THRESHOLD && max_pm == 2) { - /* Long sleep duration and PM2 is allowed. Use it */ - REG(SYS_CTRL_PMCTL) = SYS_CTRL_PMCTL_PM2; - } else { - /* - * Anticipated duration too short for PM2 but long enough for PM1 and we - * are allowed to use PM1 - */ - REG(SYS_CTRL_PMCTL) = SYS_CTRL_PMCTL_PM1; - } - - /* Remember the current time so we can keep stats when we wake up */ - if(LPM_CONF_STATS) { - sleep_enter_time = RTIMER_NOW(); - } - - /* - * Last chance to abort entering Deep Sleep. - * - * - There is the slight off-chance that a SysTick interrupt fired while we - * were trying to make up our mind. This may have raised an event. - * - The Sleep Timer may have fired - * - * Check if there is still a scheduled rtimer task and check for pending - * events before going to Deep Sleep - */ - if(process_nevents() || rtimer_arch_next_trigger() == 0) { - /* Event flag raised or rtimer inactive. - * Turn on the 32MHz XOSC, restore PMCTL and abort */ - select_32_mhz_xosc(); - - REG(SYS_CTRL_PMCTL) = SYS_CTRL_PMCTL_PM0; - - } else { - /* All clear. Assert WFI and drop to PM1/2. This is now un-interruptible */ - if((REG(SYS_CTRL_PMCTL) & SYS_CTRL_PMCTL_PM3) == SYS_CTRL_PMCTL_PM1) { - ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM); - } else { - ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_DEEP_LPM); - } - assert_wfi(); - } - - /* - * We reach here after coming back from PM1/2. The interrupt context that - * woke us up has returned. lpm_exit() has run, it has switched the system - * clock source back to the 32MHz XOSC, it has adjusted the system clock, - * it has restored PMCTL and it has done energest housekeeping - */ - return; -} -/*---------------------------------------------------------------------------*/ -void -lpm_set_max_pm(uint8_t pm) -{ - max_pm = pm > LPM_CONF_MAX_PM ? LPM_CONF_MAX_PM : pm; -} -/*---------------------------------------------------------------------------*/ -void -lpm_register_peripheral(lpm_periph_permit_pm1_func_t permit_pm1_func) -{ - int i; - - for(i = 0; i < LPM_PERIPH_PERMIT_PM1_FUNCS_MAX; i++) { - if(periph_permit_pm1_funcs[i] == permit_pm1_func) { - break; - } else if(periph_permit_pm1_funcs[i] == NULL) { - periph_permit_pm1_funcs[i] = permit_pm1_func; - break; - } - } -} -/*---------------------------------------------------------------------------*/ -void -lpm_init() -{ - /* - * The main loop calls lpm_enter() when we have no more events to service. - * By default, we will enter PM0 unless lpm_enter() decides otherwise - */ - REG(SYS_CTRL_PMCTL) = SYS_CTRL_PMCTL_PM0; - SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; - - max_pm = LPM_CONF_MAX_PM; - - LPM_STATS_INIT(); -} -/*---------------------------------------------------------------------------*/ -#endif /* LPM_CONF_ENABLE != 0 */ -/** @} */ diff --git a/arch/cpu/cc2538/lpm.h b/arch/cpu/cc2538/lpm.h deleted file mode 100644 index 16f9c3629..000000000 --- a/arch/cpu/cc2538/lpm.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2013, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-lpm cc2538 Low Power Modes - * - * Driver for the cc2538 power modes - * @{ - * - * \file - * Header file with register, macro and function declarations for the cc2538 - * low power module - */ -#ifndef LPM_H_ -#define LPM_H_ - -#include "contiki.h" -#include "rtimer.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/** - * \name LPM stats - * - * Maintains a record of how many rtimer ticks spent in each Power Mode. - * Mainly used for debugging the module - * @{ - */ -#if LPM_CONF_STATS -extern rtimer_clock_t lpm_stats[3]; - -/** - * \brief Read the time spent in a PM in rtimer ticks - * \param pm The pm as a value in [0,2] - */ -#define LPM_STATS_GET(pm) lpm_stats[pm] -#else -#define LPM_STATS_GET(pm) -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Constants to be used as arguments to lpm_set_max_pm() - * @{ - */ -#define LPM_PM0 0 -#define LPM_PM1 1 -#define LPM_PM2 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -typedef bool (*lpm_periph_permit_pm1_func_t)(void); - -#if LPM_CONF_ENABLE -/** - * \brief Initialise the LPM module - */ -void lpm_init(void); - -/** - * \brief Drop to Deep Sleep - * - * This function triggers a sequence to enter Deep Sleep. The sequence involves - * determining the most suitable PM and switching the system clock source to - * the 16MHz if required. If the energest module is enabled, the sequence also - * performs some simple energest calculations. - * - * Broadly speaking, this function will be called from the main loop when all - * events have been serviced. This functions aims to be clever enough in order - * to be able to choose between PMs 0/1/2 depending on chip status and - * anticipated sleep duration. This choice is made subject to configuration - * restrictions and subject to restrictions imposed by calls to - * lpm_set_max_pm(). - * - * This PM selection heuristic has the following primary criteria: - * - Is the RF off? - * - Are all registered peripherals permitting PM1+? - * - Is the Sleep Timer scheduled to fire an interrupt? - * - * If the answer to any of those questions is no, we will drop to PM0 and - * will wake up to any interrupt. Best case scenario (if nothing else happens), - * we will idle until the next SysTick in no more than 1000/CLOCK_SECOND ms - * (7.8125ms). - * - * If all can be answered with 'yes', we can drop to PM1/2 knowing that the - * Sleep Timer will wake us up. Depending on the estimated deep sleep duration - * and the max PM allowed by user configuration, we select the most efficient - * Power Mode to drop to. If the duration is too short, we simply IDLE in PM0. - * - * Dropping to PM1/2 requires a switch to the 16MHz OSC. We have the option of - * letting the SoC do this for us automatically. However, if an interrupt fires - * during this automatic switch, we will need to re-assert WFI. To avoid this - * complexity, we perform the switch to the 16MHz OSC manually in software and - * we assert WFI after the transition has been completed. This gives us a - * chance to bail out if an interrupt fires or an event is raised during the - * transition. If nothing happens, dropping to PM1+ is un-interruptible and - * with a deterministic duration. When we wake up, we switch back to the 32MHz - * OSC manually before handing control back to main. This is implemented in - * lpm_exit(), which will always be called from within the Sleep Timer ISR - * context. - * - * \note Dropping to PM2 means that data in the SRAM non-retention area will - * be lost. It is recommended to disable PM2 if the total RAM footprint is - * larger than what will fit in the retention area. - * .nrdata* sections can be used to place uninitialized data in the SRAM - * non-retention area. - * - * \sa main(), rtimer_arch_next_trigger(), lpm_exit(), lpm_set_max_pm() - */ -void lpm_enter(void); - -/** - * \brief Perform an 'Exit Deep Sleep' sequence - * - * This routine is called from within the context of the ISR that caused us to - * come out of PM1/2. It performs a wake up sequence to make sure the 32MHz OSC - * is back on and the system clock is sourced on it. - * - * While in PMs 1 and 2, the system clock stops ticking. This functions adjusts - * it when we wake up. - * - * We always exit PM1/2 as a result of a scheduled rtimer task or a GPIO - * interrupt. This may lead to other parts of the code trying to use the RF, - * so we need to switch the clock source \e before said code gets executed. - * - * This function also makes sure that the sleep timer value is up-to-date - * following wake-up from PM1/2 so that RTIMER_NOW() works. - * - * \note This function should be called at the very beginning of ISRs waking up - * the SoC in order to restore all clocks and timers. - * - * \sa lpm_enter(), rtimer_isr() - */ -void lpm_exit(void); - -/** - * \brief Prevent the SoC from dropping to a PM higher than \e max_pm - * \param pm The highest PM we are allowed to enter, specified as a - * number in [0, 2] - * - * Defines for the \e pm argument are LPM_PMx. - * - * This function can be used by software in situations where some power - * modes are undesirable. If, for example, an application needs to avoid PM2, - * it would call lpm_set_max_pm(LPM_PM1). - * If an application wants to avoid PM1 as well, it would call - * lpm_set_max_pm(LPM_PM0) - * - * PM0 can not be disabled at runtime. Use LPM_CONF_ENABLE to disable LPM - * support altogether - * - * \note If the value of argument \e pm is greater than the value of the - * LPM_CONF_MAX_PM configuration directive, LPM_CONF_MAX_PM is used. Thus - * if LPM_CONF_MAX_PM==1, calling lpm_set_max_pm(LPM_PM2) would - * result in a maximum PM set to 1 and all subsequent Deep Sleeps would - * be limited to either PM0 or PM1. - * - * \sa lpm_enter() - */ -void lpm_set_max_pm(uint8_t pm); - -/** - * \brief Register a peripheral function which will get called by the LPM - * module to get 'permission' to drop to PM1+ - * \param permit_pm1_func Pointer to the function - * - * Some peripherals are sensitive to PM changes. For instance, we don't want to - * drop to PM1+ if the USB PLL is active or if the UART TX FIFO is not clear. - * - * When changing power modes, the LPM driver will call all FPs registered with - * this function. The peripheral's function will return true or false to permit - * / prohibit PM1+ respectively. If at least one peripheral returns false, the - * SoC will drop to PM0 Deep Sleep instead. - * - * Registering several times the same function makes the LPM module behave as if - * the function had been registered once. - */ -void lpm_register_peripheral(lpm_periph_permit_pm1_func_t permit_pm1_func); -/*---------------------------------------------------------------------------*/ -/* Disable the entire module if required */ -#else -#define lpm_init() -#define lpm_enter() -#define lpm_exit() -static inline void -lpm_set_max_pm(uint8_t pm) -{ -} -static inline void -lpm_register_peripheral(lpm_periph_permit_pm1_func_t permit_pm1_func) -{ -} -#endif - -#endif /* LPM_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/reg.h b/arch/cpu/cc2538/reg.h deleted file mode 100644 index 09b8f3ab2..000000000 --- a/arch/cpu/cc2538/reg.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-reg cc2538 Register Manipulation - * - * Macros for hardware access, both direct and via the bit-band region. - * @{ - * - * \file - * Header file with register manipulation macro definitions - */ -#ifndef REG_H_ -#define REG_H_ - -#define REG(x) (*((volatile unsigned long *)(x))) -#define REG_H(x) (*((volatile unsigned short *)(x))) -#define REG_B(x) (*((volatile unsigned char *)(x))) -#define REG_BIT_W(x, b) \ - REG(((unsigned long)(x) & 0xF0000000) | 0x02000000 | \ - (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2)) -#define REG_BIT_H(x, b) \ - REG_H(((unsigned long)(x) & 0xF0000000) | 0x02000000 | \ - (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2)) -#define REG_BIT_B(x, b) \ - REG_B(((unsigned long)(x) & 0xF0000000) | 0x02000000 | \ - (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2)) - -#endif /* REG_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/rtimer-arch.c b/arch/cpu/cc2538/rtimer-arch.c deleted file mode 100644 index 4f9739902..000000000 --- a/arch/cpu/cc2538/rtimer-arch.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-rtimer - * @{ - * - * \file - * Implementation of the arch-specific rtimer functions for the cc2538 - * - */ -#include "contiki.h" -#include "sys/rtimer.h" -#include "dev/nvic.h" -#include "dev/smwdthrosc.h" -#include "cpu.h" -#include "lpm.h" - -#include -/*---------------------------------------------------------------------------*/ -static volatile rtimer_clock_t next_trigger; -/*---------------------------------------------------------------------------*/ -/** - * \brief We don't need to explicitly initialise anything but this - * routine is required by the API. - * - * The Sleep Timer starts ticking automatically as soon as the device - * turns on. We don't need to turn on interrupts before the first call - * to rtimer_arch_schedule() - */ -void -rtimer_arch_init(void) -{ - return; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Schedules an rtimer task to be triggered at time t - * \param t The time when the task will need executed. This is an absolute - * time, in other words the task will be executed AT time \e t, - * not IN \e t ticks - */ -void -rtimer_arch_schedule(rtimer_clock_t t) -{ - rtimer_clock_t now; - - /* STLOAD must be 1 */ - while((REG(SMWDTHROSC_STLOAD) & SMWDTHROSC_STLOAD_STLOAD) != 1); - - INTERRUPTS_DISABLE(); - - now = RTIMER_NOW(); - - /* - * New value must be 5 ticks in the future. The ST may tick once while we're - * writing the registers. We play it safe here and we add a bit of leeway - */ - if((int32_t)(t - now) < 7) { - t = now + 7; - } - - /* ST0 latches ST[1:3] and must be written last */ - REG(SMWDTHROSC_ST3) = (t >> 24) & 0x000000FF; - REG(SMWDTHROSC_ST2) = (t >> 16) & 0x000000FF; - REG(SMWDTHROSC_ST1) = (t >> 8) & 0x000000FF; - REG(SMWDTHROSC_ST0) = t & 0x000000FF; - - INTERRUPTS_ENABLE(); - - /* Store the value. The LPM module will query us for it */ - next_trigger = t; - - NVIC_EnableIRQ(SMT_IRQn); -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -rtimer_arch_next_trigger() -{ - return next_trigger; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the current real-time clock time - * \return The current rtimer time in ticks - */ -rtimer_clock_t -rtimer_arch_now() -{ - rtimer_clock_t rv; - - /* SMWDTHROSC_ST0 latches ST[1:3] and must be read first */ - rv = REG(SMWDTHROSC_ST0); - rv |= (REG(SMWDTHROSC_ST1) << 8); - rv |= (REG(SMWDTHROSC_ST2) << 16); - rv |= (REG(SMWDTHROSC_ST3) << 24); - - return rv; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief The rtimer ISR - * - * Interrupts are only turned on when we have an rtimer task to schedule - * Once the interrupt fires, the task is called and then interrupts no - * longer get acknowledged until the next task needs scheduled. - */ -void -rtimer_isr() -{ - /* - * If we were in PM1+, call the wake-up sequence first. This will make sure - * that the 32MHz OSC is selected as the clock source. We need to do this - * before calling the next rtimer_task, since the task may need the RF. - */ - lpm_exit(); - - next_trigger = 0; - - NVIC_ClearPendingIRQ(SMT_IRQn); - NVIC_DisableIRQ(SMT_IRQn); - - rtimer_run_next(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc2538/rtimer-arch.h b/arch/cpu/cc2538/rtimer-arch.h deleted file mode 100644 index 37aa102da..000000000 --- a/arch/cpu/cc2538/rtimer-arch.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-rtimer cc2538 rtimer - * - * Implementation of the rtimer module for the cc2538 - * - * The rtimer runs on the Sleep Timer. This is a design choice, as many parts - * of Contiki like rtimers with a value of RTIMER_ARCH_SECOND being a power of - * two. The ST runs on the 32kHz clock, which can provide us with an excellent - * value of 32768 for RTIMER_ARCH_SECOND. - * - * Additionally, since the ST keeps running in PM2, we can do things like drop - * to PM2 and schedule a wake-up time through the rtimer API. - * - * \note If the 32kHz clock is running on the 32kHz RC OSC, the rtimer is - * not 100% accurate (the RC OSC does not run at exactly 32.768 kHz). For - * applications requiring higher accuracy, the 32kHz clock should be changed to - * use the XOSC as its source. To see which low-frequency OSC the 32kHz clock - * is running on, see cpu/cc2538/clock.c. - * - * \sa cpu/cc2538/clock.c - * @{ - */ -/** - * \file - * Header file for the cc2538 rtimer driver - */ -#ifndef RTIMER_ARCH_H_ -#define RTIMER_ARCH_H_ - -#include "contiki.h" -#include "dev/gptimer.h" - -/* Do the math in 32bits to save precision. - * Round to nearest integer rather than truncate. */ -#define US_TO_RTIMERTICKS(US) ((US) >= 0 ? \ - (((int32_t)(US) * (RTIMER_ARCH_SECOND) + 500000) / 1000000L) : \ - ((int32_t)(US) * (RTIMER_ARCH_SECOND) - 500000) / 1000000L) - -#define RTIMERTICKS_TO_US(T) ((T) >= 0 ? \ - (((int32_t)(T) * 1000000L + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) : \ - ((int32_t)(T) * 1000000L - ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) - -/* A 64-bit version because the 32-bit one cannot handle T >= 4295 ticks. - Intended only for positive values of T. */ -#define RTIMERTICKS_TO_US_64(T) ((uint32_t)(((uint64_t)(T) * 1000000 + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND))) - -/** \sa RTIMER_NOW() */ -rtimer_clock_t rtimer_arch_now(void); - -/** - * \brief Get the time of the next scheduled rtimer trigger - * \return The time next rtimer ISR is scheduled for - */ -rtimer_clock_t rtimer_arch_next_trigger(void); - -#endif /* RTIMER_ARCH_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/slip-arch.c b/arch/cpu/cc2538/slip-arch.c deleted file mode 100644 index dee023a4f..000000000 --- a/arch/cpu/cc2538/slip-arch.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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 "contiki.h" -#include "dev/slip.h" -#include "dev/uart.h" -#include "usb/usb-serial.h" -/*---------------------------------------------------------------------------*/ -#ifndef SLIP_ARCH_CONF_USB -#define SLIP_ARCH_CONF_USB 0 -#endif - -#if SLIP_ARCH_CONF_USB -#define write_byte(b) usb_serial_writeb(b) -#define set_input(f) usb_serial_set_input(f) -#define flush() usb_serial_flush() -#else -#define write_byte(b) uart_write_byte(SLIP_ARCH_CONF_UART, b) -#define set_input(f) uart_set_input(SLIP_ARCH_CONF_UART, f) -#define flush() -#endif - -#define SLIP_END 0300 -/*---------------------------------------------------------------------------*/ -void -slip_arch_writeb(unsigned char c) -{ - write_byte(c); - if(c == SLIP_END) { - flush(); - } -} -/*---------------------------------------------------------------------------*/ -void -slip_arch_init() -{ - set_input(slip_input_byte); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc2538/soc.c b/arch/cpu/cc2538/soc.c deleted file mode 100644 index 1aa910095..000000000 --- a/arch/cpu/cc2538/soc.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-soc - * @{ - * - * \file - * Implementation of the cc2538 SoC driver - */ -#include "contiki.h" -#include "dev/rom-util.h" -#include "dev/sys-ctrl.h" -#include "dev/ioc.h" -#include "dev/nvic.h" -#include "dev/sys-ctrl.h" -#include "dev/gpio-hal.h" -#include "lpm.h" -#include "reg.h" -#include "soc.h" - -#include -#include -/*----------------------------------------------------------------------------*/ -#define DIECFG0 0x400d3014 -#define DIECFG0_SRAM_SIZE_OFS 7 -#define DIECFG0_SRAM_SIZE_SZ 3 -#define DIECFG0_SRAM_SIZE_MSK (((1 << DIECFG0_SRAM_SIZE_SZ) - 1) << \ - DIECFG0_SRAM_SIZE_OFS) -#define DIECFG2 0x400d301c -#define DIECFG2_DIE_REV_OFS 8 -#define DIECFG2_DIE_REV_SZ 8 -#define DIECFG2_DIE_REV_MSK (((1 << DIECFG2_DIE_REV_SZ) - 1) << \ - DIECFG2_DIE_REV_OFS) -#define DIECFG2_AES_EN 0x00000002 -#define DIECFG2_PKA_EN 0x00000001 -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "CC2538 SoC" -#define LOG_LEVEL LOG_LEVEL_NONE -/*----------------------------------------------------------------------------*/ -uint8_t -soc_get_rev(void) -{ - uint8_t rev = (REG(DIECFG2) & DIECFG2_DIE_REV_MSK) >> DIECFG2_DIE_REV_OFS; - - /* PG1.0 is encoded as 0x00. */ - if(!(rev >> 4)) - rev += 0x10; - return rev; -} -/*----------------------------------------------------------------------------*/ -uint32_t -soc_get_sram_size(void) -{ - uint32_t size_code = (REG(DIECFG0) & DIECFG0_SRAM_SIZE_MSK) >> - DIECFG0_SRAM_SIZE_OFS; - - return size_code <= 1 ? (2 - size_code) << 13 : 32 << 10; -} -/*----------------------------------------------------------------------------*/ -uint32_t -soc_get_features(void) -{ - return REG(DIECFG2) & (DIECFG2_AES_EN | DIECFG2_PKA_EN); -} -/*----------------------------------------------------------------------------*/ -void -soc_print_info(void) -{ - uint8_t rev = soc_get_rev(); - uint32_t features = soc_get_features(); - - LOG_DBG("CC2538: ID: 0x%04lx, rev.: PG%d.%d, Flash: %lu KiB, " - "SRAM: %lu KiB, AES/SHA: %u, ECC/RSA: %u\n" - "System clock: %lu Hz\n" - "I/O clock: %lu Hz\n" - "Reset cause: %s\n", - rom_util_get_chip_id(), - rev >> 4, rev & 0x0f, - rom_util_get_flash_size() >> 10, - soc_get_sram_size() >> 10, - !!(features & SOC_FEATURE_AES_SHA), - !!(features & SOC_FEATURE_ECC_RSA), - sys_ctrl_get_sys_clock(), - sys_ctrl_get_io_clock(), - sys_ctrl_get_reset_cause_str()); -} -/*----------------------------------------------------------------------------*/ -void -soc_init() -{ - nvic_init(); - ioc_init(); - sys_ctrl_init(); - clock_init(); - lpm_init(); - rtimer_init(); - gpio_hal_init(); -} -/*----------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc2538/soc.h b/arch/cpu/cc2538/soc.h deleted file mode 100644 index 4b1fad7ee..000000000 --- a/arch/cpu/cc2538/soc.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \defgroup cc2538-soc cc2538 SoC - * - * Driver for the cc2538 SoC - * @{ - * - * \file - * Header file with macro and function declarations for the cc2538 SoC - */ -#ifndef SOC_H_ -#define SOC_H_ - -#include "contiki.h" - -#include -/*----------------------------------------------------------------------------*/ -/** \name SoC features - * @{ - */ -#define SOC_FEATURE_AES_SHA 0x00000002 /**< Security HW AES/SHA */ -#define SOC_FEATURE_ECC_RSA 0x00000001 /**< Security HW ECC/RSA */ -/** @} */ -/*----------------------------------------------------------------------------*/ -/** \name SoC functions - * @{ - */ - -/** \brief Gets the SoC revision - * \return The SoC revision as a byte with nibbles representing the major and - * minor revisions - */ -uint8_t soc_get_rev(void); - -/** \brief Gets the SRAM size of the SoC - * \return The SRAM size in bytes - */ -uint32_t soc_get_sram_size(void); - -/** \brief Gets the hardware features of the SoC that are enabled - * \return The enabled hardware features as a bitmask of \c SOC_FEATURE_x values - */ -uint32_t soc_get_features(void); - -/** \brief Prints SoC information */ -void soc_print_info(void); - -/** \brief Common initialisation routine for all CC2538-based platforms */ -void soc_init(void); - -/** @} */ - -#endif /* SOC_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc2538/startup-gcc.c b/arch/cpu/cc2538/startup-gcc.c deleted file mode 100644 index bde8d1488..000000000 --- a/arch/cpu/cc2538/startup-gcc.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ - * - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 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. - * - * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** - * \addtogroup cc2538 - * @{ - * - * \file - * Startup code for the cc2538 chip, to be used when building with gcc - */ -#include "contiki.h" -#include "reg.h" -#include "flash.h" -#include "sys-ctrl.h" -#include "rom-util.h" - -#include -/*---------------------------------------------------------------------------*/ -extern int main(void); -/*---------------------------------------------------------------------------*/ -/* System handlers provided here */ -void reset_handler(void); -void nmi_handler(void); -void default_handler(void); - -/* System Handler and ISR prototypes implemented elsewhere */ -void clock_isr(void); /* SysTick Handler */ -void gpio_port_a_isr(void); -void gpio_port_b_isr(void); -void gpio_port_c_isr(void); -void gpio_port_d_isr(void); -void rtimer_isr(void); -void cc2538_rf_rx_tx_isr(void); -void cc2538_rf_err_isr(void); -void udma_isr(void); -void udma_err_isr(void); -void crypto_isr(void); -void pka_isr(void); - -/* Link in the USB ISR only if USB is enabled */ -#if USB_SERIAL_CONF_ENABLE -void usb_isr(void); -#else -#define usb_isr default_handler -#endif - -/* Likewise for the UART[01] ISRs */ -#if UART_CONF_ENABLE -void uart0_isr(void); -void uart1_isr(void); -#else /* UART_CONF_ENABLE */ -#define uart0_isr default_handler -#define uart1_isr default_handler -#endif /* UART_CONF_ENABLE */ - -/* Boot Loader Backdoor selection */ -#if FLASH_CCA_CONF_BOOTLDR_BACKDOOR -/* Backdoor enabled */ - -#if FLASH_CCA_CONF_BOOTLDR_BACKDOOR_ACTIVE_HIGH -#define FLASH_CCA_BOOTLDR_CFG_ACTIVE_LEVEL FLASH_CCA_BOOTLDR_CFG_ACTIVE_HIGH -#else -#define FLASH_CCA_BOOTLDR_CFG_ACTIVE_LEVEL 0 -#endif - -#if ((FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN < 0) || (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN > 7)) -#error Invalid boot loader backdoor pin. Please set FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN between 0 and 7 (indicating PA0 - PA7). -#endif - -#define FLASH_CCA_BOOTLDR_CFG (FLASH_CCA_BOOTLDR_CFG_ENABLE \ - | FLASH_CCA_BOOTLDR_CFG_ACTIVE_LEVEL \ - | (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN << FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S)) -#else -#define FLASH_CCA_BOOTLDR_CFG FLASH_CCA_BOOTLDR_CFG_DISABLE -#endif -/*---------------------------------------------------------------------------*/ -/* Allocate stack space */ -static uint64_t stack[256] __attribute__ ((section(".stack"))); -/*---------------------------------------------------------------------------*/ -__attribute__((__section__(".vectors"))) -void(*const vectors[])(void) = -{ - (void (*)(void))((unsigned long)stack + sizeof(stack)), /* Stack pointer */ - reset_handler, /* Reset handler */ - nmi_handler, /* The NMI handler */ - default_handler, /* The hard fault handler */ - default_handler, /* 4 The MPU fault handler */ - default_handler, /* 5 The bus fault handler */ - default_handler, /* 6 The usage fault handler */ - 0, /* 7 Reserved */ - 0, /* 8 Reserved */ - 0, /* 9 Reserved */ - 0, /* 10 Reserved */ - default_handler, /* 11 SVCall handler */ - default_handler, /* 12 Debug monitor handler */ - 0, /* 13 Reserved */ - default_handler, /* 14 The PendSV handler */ - clock_isr, /* 15 The SysTick handler */ - gpio_port_a_isr, /* 16 GPIO Port A */ - gpio_port_b_isr, /* 17 GPIO Port B */ - gpio_port_c_isr, /* 18 GPIO Port C */ - gpio_port_d_isr, /* 19 GPIO Port D */ - 0, /* 20 none */ - uart0_isr, /* 21 UART0 Rx and Tx */ - uart1_isr, /* 22 UART1 Rx and Tx */ - default_handler, /* 23 SSI0 Rx and Tx */ - default_handler, /* 24 I2C Master and Slave */ - 0, /* 25 Reserved */ - 0, /* 26 Reserved */ - 0, /* 27 Reserved */ - 0, /* 28 Reserved */ - 0, /* 29 Reserved */ - default_handler, /* 30 ADC Sequence 0 */ - 0, /* 31 Reserved */ - 0, /* 32 Reserved */ - 0, /* 33 Reserved */ - default_handler, /* 34 Watchdog timer, timer 0 */ - default_handler, /* 35 Timer 0 subtimer A */ - default_handler, /* 36 Timer 0 subtimer B */ - default_handler, /* 37 Timer 1 subtimer A */ - default_handler, /* 38 Timer 1 subtimer B */ - default_handler, /* 39 Timer 2 subtimer A */ - default_handler, /* 40 Timer 2 subtimer B */ - default_handler, /* 41 Analog Comparator 0 */ - default_handler, /* 42 RFCore Rx/Tx (Alternate) */ - default_handler, /* 43 RFCore Error (Alternate) */ - default_handler, /* 44 System Control */ - default_handler, /* 45 FLASH Control */ - default_handler, /* 46 AES (Alternate) */ - default_handler, /* 47 PKA (Alternate) */ - default_handler, /* 48 SM Timer (Alternate) */ - default_handler, /* 49 MacTimer (Alternate) */ - default_handler, /* 50 SSI1 Rx and Tx */ - default_handler, /* 51 Timer 3 subtimer A */ - default_handler, /* 52 Timer 3 subtimer B */ - 0, /* 53 Reserved */ - 0, /* 54 Reserved */ - 0, /* 55 Reserved */ - 0, /* 56 Reserved */ - 0, /* 57 Reserved */ - 0, /* 58 Reserved */ - 0, /* 59 Reserved */ - 0, /* 60 Reserved */ - 0, /* 61 Reserved */ - udma_isr, /* 62 uDMA */ - udma_err_isr, /* 63 uDMA Error */ - 0, /* 64 64-155 are not in use */ - 0, /* 65 */ - 0, /* 66 */ - 0, /* 67 */ - 0, /* 68 */ - 0, /* 69 */ - 0, /* 70 */ - 0, /* 71 */ - 0, /* 72 */ - 0, /* 73 */ - 0, /* 74 */ - 0, /* 75 */ - 0, /* 76 */ - 0, /* 77 */ - 0, /* 78 */ - 0, /* 79 */ - 0, /* 80 */ - 0, /* 81 */ - 0, /* 82 */ - 0, /* 83 */ - 0, /* 84 */ - 0, /* 85 */ - 0, /* 86 */ - 0, /* 87 */ - 0, /* 88 */ - 0, /* 89 */ - 0, /* 90 */ - 0, /* 91 */ - 0, /* 92 */ - 0, /* 93 */ - 0, /* 94 */ - 0, /* 95 */ - 0, /* 96 */ - 0, /* 97 */ - 0, /* 98 */ - 0, /* 99 */ - 0, /* 100 */ - 0, /* 101 */ - 0, /* 102 */ - 0, /* 103 */ - 0, /* 104 */ - 0, /* 105 */ - 0, /* 106 */ - 0, /* 107 */ - 0, /* 108 */ - 0, /* 109 */ - 0, /* 110 */ - 0, /* 111 */ - 0, /* 112 */ - 0, /* 113 */ - 0, /* 114 */ - 0, /* 115 */ - 0, /* 116 */ - 0, /* 117 */ - 0, /* 118 */ - 0, /* 119 */ - 0, /* 120 */ - 0, /* 121 */ - 0, /* 122 */ - 0, /* 123 */ - 0, /* 124 */ - 0, /* 125 */ - 0, /* 126 */ - 0, /* 127 */ - 0, /* 128 */ - 0, /* 129 */ - 0, /* 130 */ - 0, /* 131 */ - 0, /* 132 */ - 0, /* 133 */ - 0, /* 134 */ - 0, /* 135 */ - 0, /* 136 */ - 0, /* 137 */ - 0, /* 138 */ - 0, /* 139 */ - 0, /* 140 */ - 0, /* 141 */ - 0, /* 142 */ - 0, /* 143 */ - 0, /* 144 */ - 0, /* 145 */ - 0, /* 146 */ - 0, /* 147 */ - 0, /* 148 */ - 0, /* 149 */ - 0, /* 150 */ - 0, /* 151 */ - 0, /* 152 */ - 0, /* 153 */ - 0, /* 154 */ - 0, /* 155 */ - usb_isr, /* 156 USB */ - cc2538_rf_rx_tx_isr, /* 157 RFCORE RX/TX */ - cc2538_rf_err_isr, /* 158 RFCORE Error */ - crypto_isr, /* 159 AES */ - pka_isr, /* 160 PKA */ - rtimer_isr, /* 161 SM Timer */ - default_handler, /* 162 MACTimer */ -}; -/*---------------------------------------------------------------------------*/ -__attribute__((__section__(".flashcca"))) -const flash_cca_lock_page_t flash_cca_lock_page = { - FLASH_CCA_BOOTLDR_CFG, /* Boot loader backdoor configuration */ - FLASH_CCA_IMAGE_VALID, /* Image valid */ - &vectors, /* Vector table */ - /* Unlock all pages and debug */ - { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } -}; -/*---------------------------------------------------------------------------*/ -/* Linker constructs indicating .data and .bss segment locations */ -extern uint8_t _ldata; -extern uint8_t _data; -extern uint8_t _edata; -extern uint8_t _bss; -extern uint8_t _ebss; -/*---------------------------------------------------------------------------*/ -/* Weak interrupt handlers. */ -void -nmi_handler(void) -{ - reset_handler(); - while(1); -} -/*---------------------------------------------------------------------------*/ -void -default_handler(void) -{ - while(1); -} -/*---------------------------------------------------------------------------*/ -void -reset_handler(void) -{ - REG(SYS_CTRL_EMUOVR) = 0xFF; - - /* Copy the data segment initializers from flash to SRAM. */ - rom_util_memcpy(&_data, &_ldata, &_edata - &_data); - - /* Zero-fill the bss segment. */ - rom_util_memset(&_bss, 0, &_ebss - &_bss); - - /* call the application's entry point. */ - main(); - - /* End here if main () returns */ - while(1); -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/arch/cpu/cc2538/usb/cdc-acm-descriptors.c b/arch/cpu/cc2538/usb/cdc-acm-descriptors.c deleted file mode 100644 index fd56ed303..000000000 --- a/arch/cpu/cc2538/usb/cdc-acm-descriptors.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2009, Simon Berg - * 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. - */ -/** - * \addtogroup cc2538-usb - * @{ - * - * \file - * CDC-ACM mode USB descriptor for the cc2538 USB controller - * - * This file is a copy of cpu/arm/common/usb/cdc-acm/cdc-acm-descriptors.c - * with the only change being the values for VID and PID - */ -#include "descriptors.h" -#include "contiki.h" -#include "cdc.h" -#include "usb-arch.h" - -const struct usb_st_device_descriptor device_descriptor = - { - sizeof(struct usb_st_device_descriptor), - DEVICE, - 0x0200, - CDC, - 0, - 0, - CTRL_EP_SIZE, - 0x0451, /* Vendor: TI */ - 0x16C8, /* Product: cc2538EM ("CC2538 USB CDC") */ - 0x0000, - 1, - 2, - 3, - 1 - }; - -const struct configuration_st { - struct usb_st_configuration_descriptor configuration; - struct usb_st_interface_descriptor comm; - struct usb_cdc_header_func_descriptor header; - struct usb_cdc_abstract_ctrl_mgmnt_func_descriptor abstract_ctrl; - struct usb_cdc_union_func_descriptor union_descr; - struct usb_cdc_call_mgmnt_func_descriptor call_mgmt; -#if 1 - struct usb_st_endpoint_descriptor ep_notification; -#endif - struct usb_st_interface_descriptor data; - struct usb_st_endpoint_descriptor ep_in; - struct usb_st_endpoint_descriptor ep_out; -} configuration_block = - { - /* Configuration */ - { - sizeof(configuration_block.configuration), - CONFIGURATION, - sizeof(configuration_block), - 2, - 1, - 0, - 0x80, - 250 - }, - { - sizeof(configuration_block.comm), - INTERFACE, - 0, - 0, - 1, - CDC, - ABSTRACT_CONTROL_MODEL, - V_25TER_PROTOCOL, - 0 - }, - { - sizeof(configuration_block.header), - CS_INTERFACE, - CDC_FUNC_DESCR_HEADER, - 0x0110 - }, - { - sizeof(configuration_block.abstract_ctrl), - CS_INTERFACE, - CDC_FUNC_DESCR_ABSTRACT_CTRL_MGMNT, - 0x2, /** Set line coding */ - }, - { - sizeof(configuration_block.union_descr), - CS_INTERFACE, - CDC_FUNC_DESCR_UNION, - 0, /** Master */ - {1} /** Slave */ - }, - { - sizeof(configuration_block.call_mgmt), - CS_INTERFACE, - CDC_FUNC_DESCR_CALL_MGMNT, - 0x00, - 1 /** data interface */ - }, - { - sizeof(configuration_block.ep_notification), - ENDPOINT, - 0x81, - 0x03, - USB_EP1_SIZE, - 255 /** 255ms polling, not really used so maximum value used */ - }, - { - sizeof(configuration_block.data), - INTERFACE, - 1, - 0, - 2, - CDC_DATA, - 0, - 0, /** TRANSPARENT_PROTOCOL*/ - 0 - }, - { - sizeof(configuration_block.ep_in), - ENDPOINT, - 0x82, - 0x02, - USB_EP2_SIZE, - 0 - }, - { - sizeof(configuration_block.ep_out), - ENDPOINT, - 0x03, - 0x02, - USB_EP3_SIZE, - 0 - } - - }; - -const struct usb_st_configuration_descriptor* const configuration_head = -(const struct usb_st_configuration_descriptor*)&configuration_block; - -/** @} */ diff --git a/arch/cpu/cc2538/usb/common/cdc-acm/cdc-acm.c b/arch/cpu/cc2538/usb/common/cdc-acm/cdc-acm.c deleted file mode 100644 index 444d6b0e3..000000000 --- a/arch/cpu/cc2538/usb/common/cdc-acm/cdc-acm.c +++ /dev/null @@ -1,158 +0,0 @@ -#include "cdc-acm.h" -#include "cdc.h" -#include "usb-api.h" -#include "usb-core.h" - -#include -#include - -#ifdef DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -static uint8_t usb_ctrl_data_buffer[32]; - -static struct usb_cdc_line_coding usb_line_coding = { 9600, 0x00, 0x00, 0x08 }; // 9600 baud, 8N1 -static uint8_t line_state; -static uint8_t events; -static struct process *cdc_event_process = NULL; - -static void -notify_user(uint8_t e) -{ - events |= e; - if(cdc_event_process) { - process_poll(cdc_event_process); - } -} - -static void -encapsulated_command(uint8_t *data, unsigned int length) -{ - PRINTF("Got CDC command: length %d\n", length); - usb_send_ctrl_status(); -} -static void -set_line_encoding(uint8_t *data, unsigned int length) -{ - if(length == 7) { -#ifdef DEBUG - static const char parity_char[] = { 'N', 'O', 'E', 'M', 'S' }; - static const char *stop_bits_str[] = { "1", "1.5", "2" }; - const struct usb_cdc_line_coding *coding = - (const struct usb_cdc_line_coding *)usb_ctrl_data_buffer; - char parity = ((coding->bParityType > 4) - ? '?' : parity_char[coding->bParityType]); - - const char *stop_bits = ((coding->bCharFormat > 2) - ? "?" : stop_bits_str[coding->bCharFormat]); - - PRINTF("Got CDC line coding: %ld/%d/%c/%s\n", - coding->dwDTERate, coding->bDataBits, parity, stop_bits); -#endif - memcpy(&usb_line_coding, data, sizeof(usb_line_coding)); - notify_user(USB_CDC_ACM_LINE_CODING); - usb_send_ctrl_status(); - } else { - usb_error_stall(); - } -} - -static unsigned int -handle_cdc_acm_requests() -{ - PRINTF("CDC request %02x %02x\n", usb_setup_buffer.bmRequestType, - usb_setup_buffer.bRequest); - switch (usb_setup_buffer.bmRequestType) { - case 0x21: /* CDC interface OUT requests */ - /* Check if it's the right interface */ - if(usb_setup_buffer.wIndex != 0) - return 0; - switch (usb_setup_buffer.bRequest) { - case SET_CONTROL_LINE_STATE: - line_state = usb_setup_buffer.wValue; - notify_user(USB_CDC_ACM_LINE_STATE); - usb_send_ctrl_status(); - return 1; - - case SEND_ENCAPSULATED_COMMAND: - { - unsigned int len = usb_setup_buffer.wLength; - if(len > sizeof(usb_ctrl_data_buffer)) - len = sizeof(usb_ctrl_data_buffer); - usb_get_ctrl_data(usb_ctrl_data_buffer, len, encapsulated_command); - } - - return 1; - - - case SET_LINE_CODING: - { - unsigned int len = usb_setup_buffer.wLength; - if(len > sizeof(usb_ctrl_data_buffer)) - len = sizeof(usb_ctrl_data_buffer); - usb_get_ctrl_data(usb_ctrl_data_buffer, len, set_line_encoding); - } - return 1; - } - break; - case 0xa1: /* CDC interface IN requests */ - if(usb_setup_buffer.wIndex != 0) - return 0; - switch (usb_setup_buffer.bRequest) { - case GET_ENCAPSULATED_RESPONSE: - PRINTF("CDC response"); - usb_send_ctrl_status(); - return 1; - case GET_LINE_CODING: - usb_send_ctrl_response((uint8_t *) & usb_line_coding, 7); - return 1; - } - } - return 0; -} - -static const struct USBRequestHandler cdc_acm_request_handler = { - 0x21, 0x7f, - 0x00, 0x00, - handle_cdc_acm_requests -}; - -static struct USBRequestHandlerHook cdc_acm_request_hook = { - NULL, - &cdc_acm_request_handler -}; - -void -usb_cdc_acm_setup() -{ - usb_register_request_handler(&cdc_acm_request_hook); -} - -uint8_t -usb_cdc_acm_get_events(void) -{ - uint8_t r = events; - events = 0; - return r; -} - -uint8_t -usb_cdc_acm_get_line_state(void) -{ - return line_state; -} - -const struct usb_cdc_line_coding * -usb_cdc_acm_get_line_coding(void) -{ - return &usb_line_coding; -} - -void -usb_cdc_acm_set_event_process(struct process *p) -{ - cdc_event_process = p; -} diff --git a/arch/cpu/cc2538/usb/common/cdc-acm/cdc-acm.h b/arch/cpu/cc2538/usb/common/cdc-acm/cdc-acm.h deleted file mode 100644 index 4b084281d..000000000 --- a/arch/cpu/cc2538/usb/common/cdc-acm/cdc-acm.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef CDC_ACM_H_UFV6K50827__ -#define CDC_ACM_H_UFV6K50827__ - -#include "cdc.h" -#include "contiki.h" - -void usb_cdc_acm_setup(); - - -#define USB_CDC_ACM_LINE_CODING 0x1 -#define USB_CDC_ACM_LINE_STATE 0x2 -uint8_t usb_cdc_acm_get_events(void); - - -#define USB_CDC_ACM_DTE 0x1 -#define USB_CDC_ACM_RTS 0x2 -uint8_t usb_cdc_acm_get_line_state(void); - - -const struct usb_cdc_line_coding *usb_cdc_acm_get_line_coding(void); - -void usb_cdc_acm_set_event_process(struct process *p); - -#endif /* CDC_ACM_H_UFV6K50827__ */ diff --git a/arch/cpu/cc2538/usb/common/cdc-acm/cdc.h b/arch/cpu/cc2538/usb/common/cdc-acm/cdc.h deleted file mode 100644 index 8995e2f63..000000000 --- a/arch/cpu/cc2538/usb/common/cdc-acm/cdc.h +++ /dev/null @@ -1,203 +0,0 @@ -#ifndef CDC_H_K1Q26ESJOC__ -#define CDC_H_K1Q26ESJOC__ -#include "usb.h" -/* Communication Class */ -/* Class code */ -#define CDC 0x02 - -/* Interface subclass codes */ -#define CDC_RESERVED 0x00 -#define DIRECT_LINE_CONTROL_MODEL 0x01 -#define ABSTRACT_CONTROL_MODEL 0x02 -#define TELEPHONE_CONTROL_MODEL 0x03 -#define MULTI_CHANNEL_CONTROL_MODEL 0x04 -#define CAPI_CONTROL_MODEL 0x05 -#define ETHERNET_NETWORKING_CONTROL_MODEL 0x06 -#define ATM_NETWORKING_CONTROL_MODEL 0x07 - -/* Protocols */ -#define V_25TER_PROTOCOL 0x01 - -/* Requests */ -#define SEND_ENCAPSULATED_COMMAND 0x00 -#define GET_ENCAPSULATED_RESPONSE 0x01 -#define SET_COMM_FEATURE 0x02 -#define GET_COMM_FEATURE 0x03 -#define CLEAR_COMM_FEATURE 0x04 - -#define SET_AUX_LINE_STATE 0x10 -#define SET_HOOK_STATE 0x11 -#define PULSE_SETUP 0x12 -#define SEND_PULSE 0x13 -#define SET_PULSE_TIME 0x14 -#define RING_AUX_JACK 0x15 - -#define SET_LINE_CODING 0x20 -#define GET_LINE_CODING 0x21 -#define SET_CONTROL_LINE_STATE 0x22 -#define SEND_BREAK 0x23 - -#define SET_RINGER_PARMS 0x30 -#define GET_RINGER_PARMS 0x31 -#define SET_OPERATION_PARMS 0x32 -#define GET_OPERATION_PARMS 0x33 -#define SET_LINE_PARMS 0x34 -#define GET_LINE_PARMS 0x35 -#define DIAL_DIGITS 0x36 - -#define SET_UNIT_PARAMETER 0x37 -#define GET_UNIT_PARAMETER 0x38 -#define CLEAR_UNIT_PARAMETER 0x39 - -#define GET_PROFILE 0x3a - -#define SET_ETHERNET_MULTICAST_FILTERS 0x40 -#define GET_ETHERNET_MULTICAST_FILTERS 0x41 -#define GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER 0x42 -#define SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER 0x43 -#define GET_ETHERNET_STATISTIC 0x44 - -#define SET_ATM_D ATA_FORMAT 0x50 -#define GET_ATM_DEVICE_STATISTICS 0x51 -#define SET_ATM_DEFAULT_VC 0x52 -#define GET_ATM_VC_STATISTICS 0x53 - - -/* Notifications */ -#define NETWORK_CONNECTION 0x00 -#define RESPONSE_AVAILABLE 0x01 - -#define AUX_JACK_HOOK_STATE 0x08 -#define RING_DETECT 0x09 - -#define SERIAL_STATE 0x20 - -#define CALL_STATE_CHANGE 0x28 -#define LINE_STATE_CHANGE 0x29 -#define CONNECTION_SPEED_CHANGE 0x2a - -/* Data interface */ - -/* Class code */ -#define CDC_DATA 0x0a - -/* Protocols */ -#define I_430_PROTOCOL 0x30 -#define ISO_IEC_3_1993_PROTOCOL 0x31 -#define TRANSPARENT_PROTOCOL 0x32 -#define Q_921M_PROTOCOL 0x50 -#define Q_921_PROTOCOL 0x51 -#define Q_921TM_PROTOCOL 0x52 -#define V_42BIS_PROTOCOL 0x90 -#define Q_931_PROTOCOL 0x91 -#define V_120_PROTOCOL 0x93 -#define CDC_PROTOCOL 0xfe - -/* Descriptor subtypes */ - -#define CDC_FUNC_DESCR_HEADER 0x00 -#define CDC_FUNC_DESCR_CALL_MGMNT 0x01 -#define CDC_FUNC_DESCR_ABSTRACT_CTRL_MGMNT 0x02 -#define CDC_FUNC_DESCR_DIRECT_LINE_MGMNT 0x03 -#define CDC_FUNC_DESCR_RINGER_MGMNT 0x04 -#define CDC_FUNC_DESCR_TEL_STATE 0x05 -#define CDC_FUNC_DESCR_UNION 0x06 -#define CDC_FUNC_DESCR_COUNTRY 0x07 -#define CDC_FUNC_DESCR_TEL_MODE 0x08 -#define CDC_FUNC_DESCR_USB_TERM 0x09 -#define CDC_FUNC_DESCR_NET_TERM 0x0a -#define CDC_FUNC_DESCR_PROTOCOL_UNIT 0x0b -#define CDC_FUNC_DESCR_EXTENSION_UNIT 0x0c -#define CDC_FUNC_DESCR_MULTICH_MGMNT 0x0d -#define CDC_FUNC_DESCR_CAPI_MGMNT 0x0e -#define CDC_FUNC_DESCR_ETHERNET 0x0f -#define CDC_FUNC_DESCR_ATM 0x10 - - - -struct usb_cdc_header_func_descriptor { - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_HEADER subtype */ - Uint16 bcdCDC; /* Revision of class specification */ -} BYTE_ALIGNED; - -struct usb_cdc_call_mgmnt_func_descriptor { - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_CALL_MGMNT subtype */ - Uchar bmCapabilities; /* Capabilities */ - Uchar bDataInterface; /* Management data interface */ -} BYTE_ALIGNED; - -struct usb_cdc_abstract_ctrl_mgmnt_func_descriptor { - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_ABSTRACT_CTRL_MGMNT subtype */ - Uchar bmCapabilities; /* Capabilities */ -} BYTE_ALIGNED; - -struct usb_cdc_direct_line_mgmnt_func_descriptor { - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_DIRECT_LINE_MGMNT subtype */ - Uchar bmCapabilities; /* Capabilities */ -} BYTE_ALIGNED; - -struct usb_cdc_ringer_mgmnt_func_descriptor { - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_RINGER_MGMNT subtype */ - Uchar bRingerVolSteps; /* Ringer volume steps */ - Uchar bNumRingerPatterns; /* Number of ringer patterns supported */ -} BYTE_ALIGNED; - -struct usb_cdc_tel_mode_func_descriptor { - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_TEL_MODE subtype */ - Uchar bmCapabilities; /* Capabilities */ -} BYTE_ALIGNED; - -struct usb_cdc_tel_state_func_descriptor { - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_TEL_STATE subtype */ - Uchar bmCapabilities; /* Capabilities */ -} BYTE_ALIGNED; - -struct usb_cdc_union_func_descriptor { - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_UNION subtype */ - Uchar bMasterInterface; /* Master interface for union */ - Uchar bSlaveInterface[1]; /* Slave interfaces in union */ -} BYTE_ALIGNED; - -struct usb_cdc_country_func_descriptor { - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_COUNTRY subtype */ - Uchar iCountryCodeRelDate; /* Release date for country codes */ - Uint16 wCountryCode[1]; /* Country codes */ -} BYTE_ALIGNED; - -struct usb_cdc_ethernet_func_descriptor { - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* CS_INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_ETHERNET subtype */ - Uchar iMACAddress; /* MAC address string descriptor */ - Uint32 bmEthernetStatistics; /* Supported statistics */ - Uint16 wMaxSegmentSize; - Uint16 wNumberMCFilters; /* Number of multicast filters */ - Uchar bNumberPowerFilters; /* Number of wake-up pattern filters */ -} BYTE_ALIGNED; - -struct usb_cdc_line_coding { - Uint32 dwDTERate; - Uchar bCharFormat; - Uchar bParityType; - Uchar bDataBits; -} BYTE_ALIGNED; - -#endif /* CDC_H_K1Q26ESJOC__ */ diff --git a/arch/cpu/cc2538/usb/common/descriptors.h b/arch/cpu/cc2538/usb/common/descriptors.h deleted file mode 100644 index 6c89f3c03..000000000 --- a/arch/cpu/cc2538/usb/common/descriptors.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef DESCRIPTORS_H_RPFUB8O7OV__ -#define DESCRIPTORS_H_RPFUB8O7OV__ - -#ifndef STRUCTGEN -#include "usb.h" -#endif - -extern const struct usb_st_device_descriptor device_descriptor; -extern const struct usb_st_configuration_descriptor* const configuration_head; -#endif /* DESCRIPTORS_H_RPFUB8O7OV__ */ diff --git a/arch/cpu/cc2538/usb/common/string-descriptors.h b/arch/cpu/cc2538/usb/common/string-descriptors.h deleted file mode 100644 index 934d835b7..000000000 --- a/arch/cpu/cc2538/usb/common/string-descriptors.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef STRUCTGEN -#include "usb.h" -#endif -#include - -struct usb_st_string_language_map { - uint16_t lang_id; - const struct usb_st_string_descriptor *const *descriptors; -}; - -struct usb_st_string_languages { - uint8_t num_lang; - uint8_t max_index; - const struct usb_st_language_descriptor *lang_descr; - const struct usb_st_string_language_map map[1]; -}; - -extern const struct usb_st_string_languages *const string_languages; - -const uint8_t *usb_class_get_string_descriptor(uint16_t lang, uint8_t index); diff --git a/arch/cpu/cc2538/usb/common/usb-api.h b/arch/cpu/cc2538/usb/common/usb-api.h deleted file mode 100644 index b55cd4a5e..000000000 --- a/arch/cpu/cc2538/usb/common/usb-api.h +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef USB_API_H_SYN81IFYBN__ -#define USB_API_H_SYN81IFYBN__ - -#include "sys/process.h" - -typedef struct _USBBuffer USBBuffer; - -struct _USBBuffer { - USBBuffer *next; /* Pointer to next buffer in chain */ - uint8_t *data; /* Where to read/write data next */ - uint16_t left; /* Remaining length of buffer. */ - uint16_t flags; - uint32_t id; /* User data */ -}; - -/* Buffer owned by the USB code, cleared when done */ -#define USB_BUFFER_SUBMITTED 0x01 - -/* Write a short packet at end of buffer or release buffer when a - short packet is received. */ -#define USB_BUFFER_SHORT_END 0x02 - -/* Release buffer as soon as any received data has been written in it. */ -#define USB_BUFFER_PACKET_END 0x04 - -/* Notify the user when the buffer is released */ -#define USB_BUFFER_NOTIFY 0x08 - -/* Packet should be sent to host. */ -#define USB_BUFFER_IN 0x40 - -/* Used for receiving SETUP packets. If a SETUP packet is received and - the next buffers doesn't have this flag set, they will be skipped - until one is found. The associated buffer must be at least 8 bytes */ -#define USB_BUFFER_SETUP 0x20 - -/* HALT the endpoint at this point. Only valid for bulk and interrupt - endpoints */ -#define USB_BUFFER_HALT 0x100 - -/* Flags set by system */ - -/* The last packet written to this buffer was short. */ -#define USB_BUFFER_SHORT_PACKET 0x10 - -/* The operation associated with this buffer failed. I.e. it was discarded since it didn't match the received SETUP packet. */ -#define USB_BUFFER_FAILED 0x80 - -/* Architecture specific flags */ -#define USB_BUFFER_ARCH_FLAG_1 0x1000 -#define USB_BUFFER_ARCH_FLAG_2 0x2000 -#define USB_BUFFER_ARCH_FLAG_3 0x4000 -#define USB_BUFFER_ARCH_FLAG_4 0x8000 - -void usb_setup(void); - - -/* Read only */ -struct USBRequestHandler { - uint8_t request_type; - uint8_t request_type_mask; - uint8_t request; - uint8_t request_mask; - /* Returns true if it handled the request, if false let another handler try */ - unsigned int (*handler_func) (); -}; - -/* Must be writeable */ -struct USBRequestHandlerHook { - struct USBRequestHandlerHook *next; - const struct USBRequestHandler *const handler; -}; - -void usb_register_request_handler(struct USBRequestHandlerHook *hook); - -void usb_prepend_request_handler(struct USBRequestHandlerHook *hook); - -void usb_setup_bulk_endpoint(uint8_t addr); - -void usb_setup_interrupt_endpoint(uint8_t addr); - -/* Submit a chain of buffers to be filled with received data. Last - buffer must have next set to NULL. */ -void usb_submit_recv_buffer(uint8_t ep_addr, USBBuffer * buffer); - -/* Submit a chain of buffers to be sent. Last buffer must have next - set to NULL. When submitting packets to receive or send data in on - a control enpoint, all packets in the data stage must be submitted - at the same time. */ -void usb_submit_xmit_buffer(uint8_t ep_addr, USBBuffer * buffer); - -/* Return true if not all data has been sent to the host */ -int usb_send_pending(uint8_t ep_addr); - -/* Release all buffers submitted to the endpoint and discard any - buffered data. */ -void usb_discard_all_buffers(uint8_t ep_addr); - -void usb_disable_endpoint(uint8_t addr); - -/* Set or remove a HALT condition on an endpoint */ -void usb_halt_endpoint(uint8_t addr, int halt); - -/* Select what process should be polled when buffers with the - USB_BUFFER_NOTIFY flag set is released from the endpoint */ -void usb_set_ep_event_process(uint8_t addr, struct process *p); - -/* Select what process should be polled when a global event occurs */ -void usb_set_global_event_process(struct process *p); - -/* Global events */ -#define USB_EVENT_CONFIG 0x01 -#define USB_EVENT_SUSPEND 0x02 -#define USB_EVENT_RESUME 0x04 -#define USB_EVENT_RESET 0x08 - -/* Returns global events that has occured since last time this - function was called */ -unsigned int usb_get_global_events(void); - - -#define USB_EP_EVENT_NOTIFICATION 0x01 -unsigned int usb_get_ep_events(uint8_t addr); - -unsigned int usb_get_current_configuration(void); - -#endif /* USB_API_H_SYN81IFYBN__ */ diff --git a/arch/cpu/cc2538/usb/common/usb-arch.h b/arch/cpu/cc2538/usb/common/usb-arch.h deleted file mode 100644 index a9aae6e8c..000000000 --- a/arch/cpu/cc2538/usb/common/usb-arch.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef USB_ARCH_H_0Z52ZDP0H6__ -#define USB_ARCH_H_0Z52ZDP0H6__ - -#include "contiki.h" -#include "usb-api.h" - - -/* Includes control endpoint 0 */ -#ifndef USB_MAX_ENDPOINTS -#define USB_MAX_ENDPOINTS 4 -#endif - -#ifndef CTRL_EP_SIZE -#define CTRL_EP_SIZE 8 -#endif - -#ifndef USB_EP1_SIZE -#define USB_EP1_SIZE 8 -#endif -#ifndef USB_EP2_SIZE -#define USB_EP2_SIZE 8 -#endif -#ifndef USB_EP3_SIZE -#define USB_EP3_SIZE 8 -#endif -#ifndef USB_EP4_SIZE -#define USB_EP4_SIZE 0 -#endif -#ifndef USB_EP5_SIZE -#define USB_EP5_SIZE 0 -#endif -#ifndef USB_EP6_SIZE -#define USB_EP6_SIZE 0 -#endif -#ifndef USB_EP7_SIZE -#define USB_EP7_SIZE 0 -#endif - - -#ifndef MAX_CTRL_DATA -#define MAX_CTRL_DATA 128 -#endif - -void usb_arch_setup(void); - -void usb_arch_setup_control_endpoint(uint8_t addr); - -void usb_arch_setup_bulk_endpoint(uint8_t addr); - -void usb_arch_setup_interrupt_endpoint(uint8_t addr); - -void usb_arch_disable_endpoint(uint8_t addr); - -void usb_arch_discard_all_buffers(uint8_t addr); - -/* Stall a control endpoint. The stall will be cleared when the next - * SETUP token arrives. */ -void usb_arch_control_stall(uint8_t addr); - -/* Set or remove a HALT condition on an endpoint */ -void usb_arch_halt_endpoint(uint8_t addr, int halt); - -void usb_arch_set_configuration(uint8_t usb_configuration_value); - -uint16_t usb_arch_get_ep_status(uint8_t addr); - -void usb_arch_set_address(uint8_t addr); - -/* Select what process should be polled when a global event occurs. Intended for the protocol handler. Applications should use usb_set_global_event_process */ -void usb_arch_set_global_event_process(struct process *p); - -unsigned int usb_arch_get_global_events(void); - -/* Return true if not all data has been sent to the host */ -int usb_arch_send_pending(uint8_t ep_addr); - -#endif /* USB_ARCH_H_0Z52ZDP0H6__ */ diff --git a/arch/cpu/cc2538/usb/common/usb-core.c b/arch/cpu/cc2538/usb/common/usb-core.c deleted file mode 100644 index c5d3afa66..000000000 --- a/arch/cpu/cc2538/usb/common/usb-core.c +++ /dev/null @@ -1,631 +0,0 @@ -#include "usb-core.h" -#include "usb.h" -#include "usb-arch.h" -#include "usb-api.h" -#include "sys/process.h" -#include "descriptors.h" -#include "string-descriptors.h" - -#include - -#ifdef DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - - -struct USB_request_st usb_setup_buffer; -static USBBuffer ctrl_buffer; - -#define SETUP_ID 1 -#define OUT_ID 2 -#define IN_ID 3 -#define STATUS_OUT_ID 4 -#define STATUS_IN_ID 5 - -static uint16_t usb_device_status; -static uint8_t usb_configuration_value; - -static struct USBRequestHandlerHook *usb_request_handler_hooks = NULL; - -static const unsigned char zero_byte = 0; -static const unsigned short zero_word = 0; - -static unsigned char usb_flags = 0; -#define USB_FLAG_ADDRESS_PENDING 0x01 - -static struct process *global_user_event_pocess = NULL; -static unsigned int global_user_events = 0; - -void -usb_set_global_event_process(struct process *p) -{ - global_user_event_pocess = p; -} -unsigned int -usb_get_global_events(void) -{ - unsigned int e = global_user_events; - global_user_events = 0; - return e; -} - -static void -notify_user(unsigned int e) -{ - global_user_events |= e; - if(global_user_event_pocess) { - process_poll(global_user_event_pocess); - } -} - -void -usb_send_ctrl_response(const uint8_t * data, unsigned int len) -{ - if(ctrl_buffer.flags & USB_BUFFER_SUBMITTED) - return; - if(len >= usb_setup_buffer.wLength) { - len = usb_setup_buffer.wLength; /* Truncate if too long */ - } - ctrl_buffer.flags = USB_BUFFER_NOTIFY | USB_BUFFER_IN; - if(len < usb_setup_buffer.wLength) { - ctrl_buffer.flags |= USB_BUFFER_SHORT_END; - } - ctrl_buffer.next = NULL; - ctrl_buffer.data = (uint8_t *) data; - ctrl_buffer.left = len; - ctrl_buffer.id = IN_ID; - usb_submit_xmit_buffer(0, &ctrl_buffer); -} - -static uint8_t error_stall = 0; - -void -usb_error_stall() -{ - error_stall = 1; - usb_arch_control_stall(0); -} - -void -usb_send_ctrl_status() -{ - if(ctrl_buffer.flags & USB_BUFFER_SUBMITTED) - return; - ctrl_buffer.flags = USB_BUFFER_NOTIFY | USB_BUFFER_IN; - ctrl_buffer.next = NULL; - ctrl_buffer.data = NULL; - ctrl_buffer.left = 0; - ctrl_buffer.id = STATUS_IN_ID; - usb_submit_xmit_buffer(0, &ctrl_buffer); -} - -static usb_ctrl_data_callback data_callback = NULL; - -static uint8_t *ctrl_data = NULL; - -static unsigned int ctrl_data_len = 0; - -void -usb_get_ctrl_data(uint8_t * data, unsigned int length, - usb_ctrl_data_callback cb) -{ - if(ctrl_buffer.flags & USB_BUFFER_SUBMITTED) - return; - PRINTF("usb_get_ctrl_data: %d\n", length); - data_callback = cb; - ctrl_data = data; - ctrl_data_len = length; - ctrl_buffer.flags = USB_BUFFER_NOTIFY; - ctrl_buffer.next = NULL; - ctrl_buffer.data = data; - ctrl_buffer.left = length; - ctrl_buffer.id = OUT_ID; - usb_submit_recv_buffer(0, &ctrl_buffer); -} - -#if 0 - -void -usb_set_user_process(struct process *p) -{ - user_process = p; -} -#endif - -static void -get_device_descriptor() -{ - usb_send_ctrl_response((unsigned char *)&device_descriptor, - sizeof(device_descriptor)); -} - -static void -get_string_descriptor() -{ -#if OLD_STRING_DESCR - if(LOW_BYTE(usb_setup_buffer.wValue) == 0) { - usb_send_ctrl_response((const unsigned char *)string_languages-> - lang_descr, string_languages->lang_descr->bLength); - } else { - const struct usb_st_string_descriptor *descriptor; - - unsigned char l; - - const struct usb_st_string_descriptor *const *table; - - const struct usb_st_string_language_map *map; - - if(LOW_BYTE(usb_setup_buffer.wValue) > string_languages->max_index) { - usb_error_stall(); - return; - } - l = string_languages->num_lang; - map = string_languages->map; - table = map->descriptors; /* Use first table if language not found */ - while(l > 0) { - if(map->lang_id == usb_setup_buffer.wIndex) { - table = map->descriptors; - break; - } - map++; - l--; - } - PRINTF("Lang id %04x = table %p\n", usb_setup_buffer.wIndex, - (void *)table); - descriptor = table[LOW_BYTE(usb_setup_buffer.wValue) - 1]; - usb_send_ctrl_response((const unsigned char *)descriptor, - descriptor->bLength); - } -#else - const struct usb_st_string_descriptor *descriptor; - - descriptor = (struct usb_st_string_descriptor *) - usb_class_get_string_descriptor(usb_setup_buffer.wIndex, - LOW_BYTE(usb_setup_buffer.wValue)); - if(!descriptor) { - usb_error_stall(); - return; - } - usb_send_ctrl_response((const unsigned char *)descriptor, - descriptor->bLength); -#endif -} - -static void -get_configuration_descriptor() -{ - usb_send_ctrl_response((unsigned char *)configuration_head, - configuration_head->wTotalLength); -} - -static void -get_configuration() -{ - usb_send_ctrl_response((unsigned char *)&usb_configuration_value, - sizeof(usb_configuration_value)); -} - -/* Returns true if the configuration value changed */ -static int -set_configuration() -{ - notify_user(USB_EVENT_CONFIG); - if(usb_configuration_value != LOW_BYTE(usb_setup_buffer.wValue)) { - usb_configuration_value = LOW_BYTE(usb_setup_buffer.wValue); - usb_arch_set_configuration(usb_configuration_value); - usb_send_ctrl_status(); - return 1; - } else { - usb_send_ctrl_status(); - return 0; - } -} - -static void -get_device_status() -{ - PRINTF("get_device_status\n"); - usb_send_ctrl_response((const unsigned char *)&usb_device_status, - sizeof(usb_device_status)); -} - -static void -get_endpoint_status() -{ - static uint16_t status; - - PRINTF("get_endpoint_status\n"); - if((usb_setup_buffer.wIndex & 0x7f) == 0) { - usb_send_ctrl_response((const unsigned char *)&zero_word, - sizeof(zero_word)); - } else { - status = usb_arch_get_ep_status(usb_setup_buffer.wIndex); - usb_send_ctrl_response((uint8_t *) & status, sizeof(status)); - } -} - -static void -get_interface_status() -{ - PRINTF("get_interface_status\n"); - usb_send_ctrl_response((const unsigned char *)&zero_word, - sizeof(zero_word)); -} - -static void -get_interface() -{ - PRINTF("get_interface\n"); - if(usb_configuration_value == 0) - usb_error_stall(); - else { - usb_send_ctrl_response(&zero_byte, sizeof(zero_byte)); - } -} - - -static unsigned int -handle_standard_requests() -{ - switch (usb_setup_buffer.bmRequestType) { - case 0x80: /* standard device IN requests */ - switch (usb_setup_buffer.bRequest) { - case GET_DESCRIPTOR: - switch (HIGH_BYTE(usb_setup_buffer.wValue)) { - case DEVICE: - get_device_descriptor(); - break; - case CONFIGURATION: - get_configuration_descriptor(); - break; - case STRING: - get_string_descriptor(); - break; - default: - /* Unknown descriptor */ - return 0; - } - break; - case GET_CONFIGURATION: - get_configuration(); - break; - case GET_STATUS: - get_device_status(); - break; - case GET_INTERFACE: - get_interface(); - break; - default: - return 0; - } - break; - case 0x81: /* standard interface IN requests */ - switch (usb_setup_buffer.bRequest) { - case GET_STATUS: - get_interface_status(); - break; -#ifdef HID_ENABLED - case GET_DESCRIPTOR: - switch (USB_setup_buffer.wValue.byte.high) { - case REPORT: - get_report_descriptor(); - break; - } - break; -#endif - default: - return 0; - } - break; - case 0x82: /* standard endpoint IN requests */ - switch (usb_setup_buffer.bRequest) { - case GET_STATUS: - get_endpoint_status(); - break; - default: - return 0; - } - break; - case 0x00: /* standard device OUT requests */ - switch (usb_setup_buffer.bRequest) { - case SET_ADDRESS: - PRINTF("Address: %d\n", LOW_BYTE(usb_setup_buffer.wValue)); - usb_flags |= USB_FLAG_ADDRESS_PENDING; - /* The actual setting of the address is done when the status packet - is sent. */ - usb_send_ctrl_status(); - break; -#if SETABLE_STRING_DESCRIPTORS > 0 - case SET_DESCRIPTOR: - if(usb_setup_buffer.wValue.byte.high == STRING) { - set_string_descriptor(); - } else { - return 0; - } - break; -#endif - case SET_CONFIGURATION: - if(set_configuration()) { -#if 0 - config_msg.data.config = LOW_BYTE(usb_setup_buffer.wValue); - notify_user(&config_msg); -#endif - } - break; - default: - return 0; - } - break; - case 0x01: /* standard interface OUT requests */ - switch (usb_setup_buffer.bRequest) { - case SET_INTERFACE: - /* Change interface here if we support more than one */ - usb_send_ctrl_status(); - break; - default: - return 0; - } - break; - case 0x02: /* standard endpoint OUT requests */ - switch (usb_setup_buffer.bRequest) { - case SET_FEATURE: - case CLEAR_FEATURE: - if(usb_setup_buffer.wValue == ENDPOINT_HALT_FEATURE) { - usb_arch_halt_endpoint(usb_setup_buffer.wIndex, - usb_setup_buffer.bRequest == SET_FEATURE); - usb_send_ctrl_status(); - } else { - usb_error_stall(); - } - break; - default: - return 0; - } - break; -#ifdef HID_ENABLED - case 0xa1: /* class specific interface IN request */ - switch (USB_setup_buffer.bRequest) { - case GET_HID_REPORT: - PRINTF("Get report\n"); - send_ctrl_response((code u_int8_t *) & zero_byte, sizeof(zero_byte)); - break; - case GET_HID_IDLE: - PRINTF("Get idle\n"); - send_ctrl_response((code u_int8_t *) & zero_byte, sizeof(zero_byte)); - break; - default: - return 0; - } - break; - case 0x21: /* class specific interface OUT request */ - switch (USB_setup_buffer.bRequest) { - case SET_HID_IDLE: - PRINTF("Set idle\n"); - send_ctrl_status(); - break; - default: - return 0; - } - break; -#endif - default: - return 0; - } - return 1; -} - -static const struct USBRequestHandler standard_request_handler = { - 0x00, - 0x60, - 0x00, - 0x00, - handle_standard_requests -}; - -static struct USBRequestHandlerHook standard_request_hook = { - NULL, - &standard_request_handler -}; - -static void -submit_setup(void) -{ - ctrl_buffer.next = NULL; - ctrl_buffer.data = (uint8_t *) & usb_setup_buffer; - ctrl_buffer.left = sizeof(usb_setup_buffer); - ctrl_buffer.flags = (USB_BUFFER_PACKET_END | USB_BUFFER_SETUP - | USB_BUFFER_NOTIFY); - ctrl_buffer.id = SETUP_ID; - usb_submit_recv_buffer(0, &ctrl_buffer); -} - -PROCESS(usb_process, "USB"); - -PROCESS_THREAD(usb_process, ev, data) -{ - PROCESS_BEGIN(); - PRINTF("USB process started\n"); - while(1) { - PROCESS_WAIT_EVENT(); - if(ev == PROCESS_EVENT_EXIT) - break; - if(ev == PROCESS_EVENT_POLL) { - unsigned int events = usb_arch_get_global_events(); - - if(events) { - if(events & USB_EVENT_RESET) { - submit_setup(); - usb_configuration_value = 0; - notify_user(USB_EVENT_RESET); - } - if(events & USB_EVENT_SUSPEND) { - notify_user(USB_EVENT_SUSPEND); - } - if(events & USB_EVENT_RESUME) { - notify_user(USB_EVENT_RESUME); - } - - } - events = usb_get_ep_events(0); - if(events) { - if((events & USB_EP_EVENT_NOTIFICATION) - && !(ctrl_buffer.flags & USB_BUFFER_SUBMITTED)) { - /* PRINTF("Endpoint 0\n"); */ - if(ctrl_buffer.flags & USB_BUFFER_FAILED) { - /* Something went wrong with the buffer, just wait for a - new SETUP packet */ - PRINTF("Discarded\n"); - submit_setup(); - } else if(ctrl_buffer.flags & USB_BUFFER_SETUP) { - struct USBRequestHandlerHook *hook = usb_request_handler_hooks; - - PRINTF("Setup\n"); - { - unsigned int i; - - for(i = 0; i < 8; i++) - PRINTF(" %02x", ((unsigned char *)&usb_setup_buffer)[i]); - PRINTF("\n"); - } - - while(hook) { - const struct USBRequestHandler *handler = hook->handler; - - /* Check if the handler matches the request */ - if(((handler->request_type ^ usb_setup_buffer.bmRequestType) - & handler->request_type_mask) == 0 - && ((handler->request ^ usb_setup_buffer.bRequest) - & handler->request_mask) == 0) { - if(handler->handler_func()) - break; - } - hook = hook->next; - } - if(!hook) { - /* No handler found */ - usb_error_stall(); - PRINTF("Unhandled setup: %02x %02x %04x %04x %04x\n", - usb_setup_buffer.bmRequestType, - usb_setup_buffer.bRequest, usb_setup_buffer.wValue, - usb_setup_buffer.wIndex, usb_setup_buffer.wLength); - } - /* Check if any handler stalled the pipe, if so prepare for - next setup */ - if(error_stall) { - error_stall = 0; - submit_setup(); - } - } else { - if(ctrl_buffer.id == IN_ID) { - /* Receive status stage */ - PRINTF("Status OUT\n"); - ctrl_buffer.flags = USB_BUFFER_NOTIFY; - ctrl_buffer.next = NULL; - ctrl_buffer.data = NULL; - ctrl_buffer.left = 0; - ctrl_buffer.id = STATUS_OUT_ID; - usb_submit_recv_buffer(0, &ctrl_buffer); - } else if(ctrl_buffer.id == STATUS_OUT_ID) { - PRINTF("Status OUT done\n"); - submit_setup(); - } else if(ctrl_buffer.id == STATUS_IN_ID) { - PRINTF("Status IN done\n"); - if(usb_flags & USB_FLAG_ADDRESS_PENDING) { - while(usb_send_pending(0)); - usb_arch_set_address(LOW_BYTE(usb_setup_buffer.wValue)); - usb_flags &= ~USB_FLAG_ADDRESS_PENDING; - } - submit_setup(); - } else if(ctrl_buffer.id == OUT_ID) { - PRINTF("OUT\n"); - if(data_callback) { - data_callback(ctrl_data, ctrl_data_len - ctrl_buffer.left); - } else { - usb_send_ctrl_status(); - } - } - } - } - } - } - } - PROCESS_END(); -} - - -void -usb_setup(void) -{ - usb_arch_setup(); - process_start(&usb_process, NULL); - usb_arch_set_global_event_process(&usb_process); - usb_set_ep_event_process(0, &usb_process); - - usb_register_request_handler(&standard_request_hook); -} - -void -usb_register_request_handler(struct USBRequestHandlerHook *hook) -{ - struct USBRequestHandlerHook **prevp = &usb_request_handler_hooks; - /* Find last hook */ - while(*prevp) { - prevp = &(*prevp)->next; - } - /* Add last */ - *prevp = hook; - hook->next = NULL; -} - -void -usb_prepend_request_handler(struct USBRequestHandlerHook *hook) -{ - hook->next = usb_request_handler_hooks; - usb_request_handler_hooks = hook; -} - - -unsigned int -usb_get_current_configuration(void) -{ - return usb_configuration_value; -} - -void -usb_setup_bulk_endpoint(unsigned char addr) -{ - usb_arch_setup_bulk_endpoint(addr); -} - -void -usb_setup_interrupt_endpoint(unsigned char addr) -{ - usb_arch_setup_interrupt_endpoint(addr); -} - -void -usb_disable_endpoint(uint8_t addr) -{ - usb_arch_discard_all_buffers(addr); - usb_arch_disable_endpoint(addr); -} - -void -usb_discard_all_buffers(uint8_t addr) -{ - usb_arch_discard_all_buffers(addr); -} - -void -usb_halt_endpoint(uint8_t addr, int halt) -{ - usb_arch_halt_endpoint(addr, halt); -} - -int -usb_send_pending(uint8_t addr) -{ - return usb_arch_send_pending(addr); -} diff --git a/arch/cpu/cc2538/usb/common/usb-core.h b/arch/cpu/cc2538/usb/common/usb-core.h deleted file mode 100644 index ba6304ca2..000000000 --- a/arch/cpu/cc2538/usb/common/usb-core.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef USB_CORE_H_YIKJDA7S1X__ -#define USB_CORE_H_YIKJDA7S1X__ - -#include - -extern struct USB_request_st usb_setup_buffer; - -void usb_send_ctrl_response(const uint8_t *data, unsigned int len); - -void usb_error_stall(); - -void usb_send_ctrl_status(); - -typedef void (*usb_ctrl_data_callback)(uint8_t *data, unsigned int length); - -void usb_get_ctrl_data(uint8_t *data, unsigned int length, - usb_ctrl_data_callback cb); - -#endif /* USB_CORE_H_YIKJDA7S1X__ */ diff --git a/arch/cpu/cc2538/usb/common/usb.h b/arch/cpu/cc2538/usb/common/usb.h deleted file mode 100644 index a1d7dfb78..000000000 --- a/arch/cpu/cc2538/usb/common/usb.h +++ /dev/null @@ -1,185 +0,0 @@ -#ifndef USB_H_6PFTDPIMZM__ -#define USB_H_6PFTDPIMZM__ -#include - -/* Adapted from usb_kbd_enum.h in c5131-usb-kbd-light-1_0_2 package from - Atmel */ - -/* These definitions assume a little endian architecture */ - -#ifdef __GNUC__ -#define BYTE_ALIGNED __attribute__ ((__packed__)) -#else -#define BYTE_ALIGNED -#endif - -#define LOW_BYTE(x) ((unsigned char)x) -#define HIGH_BYTE(x) ((unsigned char)(x>>8)) - -typedef uint8_t Uchar; -typedef uint16_t Uint16; -typedef uint32_t Uint32; - -/*_____ S T A N D A R D R E Q U E S T S __________________________________*/ - -#define GET_STATUS 0x00 -#define GET_DEVICE 0x01 -#define CLEAR_FEATURE 0x01 /* see FEATURES below */ -#define GET_STRING 0x03 -#define SET_FEATURE 0x03 /* see FEATURES below */ -#define SET_ADDRESS 0x05 -#define GET_DESCRIPTOR 0x06 -#define SET_DESCRIPTOR 0x07 -#define GET_CONFIGURATION 0x08 -#define SET_CONFIGURATION 0x09 -#define GET_INTERFACE 0x0A -#define SET_INTERFACE 0x0B -#define SYNCH_FRAME 0x0C - -#define GET_DEVICE_DESCRIPTOR 1 -#define GET_CONFIGURATION_DESCRIPTOR 4 - -#define REQUEST_DEVICE_STATUS 0x80 -#define REQUEST_INTERFACE_STATUS 0x81 -#define REQUEST_ENDPOINT_STATUS 0x82 -#define ZERO_TYPE 0x00 -#define INTERFACE_TYPE 0x01 -#define ENDPOINT_TYPE 0x02 - -/*_____ D E S C R I P T O R T Y P E S ____________________________________*/ - -#define DEVICE 0x01 -#define CONFIGURATION 0x02 -#define STRING 0x03 -#define INTERFACE 0x04 -#define ENDPOINT 0x05 - -/* HID specific */ -#define HID 0x21 -#define REPORT 0x22 -/* *** */ - -/*_____ S T A N D A R D F E A T U R E S __________________________________*/ - -#define DEVICE_REMOTE_WAKEUP_FEATURE 0x01 -#define ENDPOINT_HALT_FEATURE 0x00 - -/*_____ D E V I C E S T A T U S ___________________________________________*/ - -#define SELF_POWERED 1 - -/*_____ D E V I C E S T A T E _____________________________________________*/ - -#define ATTACHED 0 -#define POWERED 1 -#define DEFAULT 2 -#define ADDRESSED 3 -#define CONFIGURED 4 -#define SUSPENDED 5 - -#define USB_CONFIG_BUSPOWERED 0x80 -#define USB_CONFIG_SELFPOWERED 0x40 -#define USB_CONFIG_REMOTEWAKEUP 0x20 - -/* Class specific */ -#define CS_INTERFACE 0x24 -#define CS_ENDPOINT 0x25 - -/*_________________________________________________________ S T R U C T _____*/ -/*_____ U S B D E V I C E R E Q U E S T _________________________________*/ - -struct USB_request_st -{ - Uchar bmRequestType; /* Characteristics of the request */ - Uchar bRequest; /* Specific request */ - Uint16 wValue; - Uint16 wIndex; /* field that varies according to request */ - Uint16 wLength; /* Number of bytes to transfer if Data */ -}; - - -/*_____ U S B D E V I C E D E S C R I P T O R ___________________________*/ - -struct usb_st_device_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* DEVICE descriptor type */ - Uint16 bscUSB; /* Binay Coded Decimal Spec. release */ - Uchar bDeviceClass; /* Class code assigned by the USB */ - Uchar bDeviceSubClass; /* Sub-class code assigned by the USB */ - Uchar bDeviceProtocol; /* Protocol code assigned by the USB */ - Uchar bMaxPacketSize0; /* Max packet size for EP0 */ - Uint16 idVendor; /* Vendor ID. ATMEL = 0x03EB */ - Uint16 idProduct; /* Product ID assigned by the manufacturer */ - Uint16 bcdDevice; /* Device release number */ - Uchar iManufacturer; /* Index of manu. string descriptor */ - Uchar iProduct; /* Index of prod. string descriptor */ - Uchar iSerialNumber; /* Index of S.N. string descriptor */ - Uchar bNumConfigurations; /* Number of possible configurations */ -} BYTE_ALIGNED; - - -/*_____ U S B C O N F I G U R A T I O N D E S C R I P T O R _____________*/ - -struct usb_st_configuration_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* CONFIGURATION descriptor type */ - Uint16 wTotalLength; /* total length of data returned */ - Uchar bNumInterfaces; /* number of interfaces for this conf. */ - Uchar bConfigurationValue; /* value for SetConfiguration resquest */ - Uchar iConfiguration; /* index of string descriptor */ - Uchar bmAttibutes; /* Configuration characteristics */ - Uchar MaxPower; /* maximum power consumption */ -} BYTE_ALIGNED; - - -/*_____ U S B I N T E R F A C E D E S C R I P T O R _____________________*/ - -struct usb_st_interface_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bInterfaceNumber; /* Number of interface */ - Uchar bAlternateSetting; /* value to select alternate setting */ - Uchar bNumEndpoints; /* Number of EP except EP 0 */ - Uchar bInterfaceClass; /* Class code assigned by the USB */ - Uchar bInterfaceSubClass; /* Sub-class code assigned by the USB */ - Uchar bInterfaceProtocol; /* Protocol code assigned by the USB */ - Uchar iInterface; /* Index of string descriptor */ -} BYTE_ALIGNED; - - -/*_____ U S B E N D P O I N T D E S C R I P T O R _______________________*/ - -struct usb_st_endpoint_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* ENDPOINT descriptor type */ - Uchar bEndpointAddress; /* Address of the endpoint */ - Uchar bmAttributes; /* Endpoint's attributes */ - Uint16 wMaxPacketSize; /* Maximum packet size for this EP */ - Uchar bInterval; /* Interval for polling EP in ms */ -/* Uchar bRefresh; */ -/* Uchar bSynchAddress; */ -} BYTE_ALIGNED; - - -/*_____ U S B S T R I N G D E S C R I P T O R _______________*/ - -struct usb_st_string_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[1];/* unicode characters */ -} BYTE_ALIGNED; - - -struct usb_st_language_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wlangid[1]; /* language id */ -} BYTE_ALIGNED; - -#endif /* USB_H_6PFTDPIMZM__ */ diff --git a/arch/cpu/cc2538/usb/usb-arch.c b/arch/cpu/cc2538/usb/usb-arch.c deleted file mode 100644 index 43da33946..000000000 --- a/arch/cpu/cc2538/usb/usb-arch.c +++ /dev/null @@ -1,1290 +0,0 @@ -/* - * Copyright (c) 2012, Philippe Retornaz - * Copyright (c) 2012, EPFL STI IMT LSRO1 -- Mobots group - * - * 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. - */ -/** - * \addtogroup cc2538-usb - * @{ - * - * \file - * Arch-specific routines for the cc2538 USB controller. Heavily based on - * the cc2530 driver written by Philippe Retornaz - */ -#include "contiki.h" -#include "usb-arch.h" -#include "usb-api.h" -#include "dev/usb-regs.h" -#include "dev/nvic.h" -#include "dev/gpio.h" -#include "dev/ioc.h" -#include "dev/udma.h" -#include "sys/clock.h" -#include "lpm.h" -#include "reg.h" - -#include "dev/watchdog.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#ifdef USB_PULLUP_PORT -#define USB_PULLUP_PORT_BASE GPIO_PORT_TO_BASE(USB_PULLUP_PORT) -#endif -#ifdef USB_PULLUP_PIN -#define USB_PULLUP_PIN_MASK GPIO_PIN_MASK(USB_PULLUP_PIN) -#endif -/*---------------------------------------------------------------------------*/ -/* EP max FIFO sizes without double buffering */ -#if CTRL_EP_SIZE > 32 -#error Control endpoint size too big -#endif - -#if USB_EP1_SIZE > 32 -#error Endpoint 1 size too big -#endif - -#if USB_EP2_SIZE > 64 -#error Endpoint 2 size too big -#endif - -#if USB_EP3_SIZE > 128 -#error Endpoint 3 size too big -#endif - -#if USB_EP4_SIZE > 256 -#error Endpoint 4 size too big -#endif - -#if USB_EP5_SIZE > 512 -#error Endpoint 5 size too big -#endif -/*---------------------------------------------------------------------------*/ -/* uDMA transfer threshold. Use DMA only for data size higher than this */ -#define UDMA_SIZE_THRESHOLD 8 - -/* uDMA channel control persistent flags */ -#define UDMA_TX_FLAGS (UDMA_CHCTL_ARBSIZE_128 | UDMA_CHCTL_XFERMODE_AUTO \ - | UDMA_CHCTL_SRCSIZE_8 | UDMA_CHCTL_DSTSIZE_8 \ - | UDMA_CHCTL_SRCINC_8 | UDMA_CHCTL_DSTINC_NONE) - -#define UDMA_RX_FLAGS (UDMA_CHCTL_ARBSIZE_128 | UDMA_CHCTL_XFERMODE_AUTO \ - | UDMA_CHCTL_SRCSIZE_8 | UDMA_CHCTL_DSTSIZE_8 \ - | UDMA_CHCTL_SRCINC_NONE | UDMA_CHCTL_DSTINC_8) -/*---------------------------------------------------------------------------*/ -static const uint16_t ep_xfer_size[] = { - CTRL_EP_SIZE, - USB_EP1_SIZE, - USB_EP2_SIZE, - USB_EP3_SIZE, - USB_EP4_SIZE, - USB_EP5_SIZE, -}; -/*---------------------------------------------------------------------------*/ -typedef struct _USBBuffer usb_buffer; -/*---------------------------------------------------------------------------*/ -struct usb_endpoint { - uint8_t halted; - uint8_t addr; - uint8_t flags; - usb_buffer *buffer; - struct process *event_process; - unsigned int events; - uint16_t xfer_size; -}; -typedef struct usb_endpoint usb_endpoint_t; -/*---------------------------------------------------------------------------*/ -#define EP_STATUS_IDLE 0 -#define EP_STATUS_RX 1 -#define EP_STATUS_TX 2 - -#define USB_EP_FLAGS_TYPE_MASK 0x03 -#define USB_EP_FLAGS_TYPE_BULK 0x00 -#define USB_EP_FLAGS_TYPE_CONTROL 0x01 -#define USB_EP_FLAGS_TYPE_ISO 0x02 -#define USB_EP_FLAGS_TYPE_INTERRUPT 0x03 -#define USB_EP_FLAGS_ENABLED 0x04 - -#define EP_TYPE(ep) ((ep)->flags & USB_EP_FLAGS_TYPE_MASK) -#define IS_EP_TYPE(ep, type) (EP_TYPE(ep) == (type)) -#define IS_CONTROL_EP(ep) IS_EP_TYPE(ep, USB_EP_FLAGS_TYPE_CONTROL) -#define IS_BULK_EP(ep) IS_EP_TYPE(ep, USB_EP_FLAGS_TYPE_BULK) -#define IS_INTERRUPT_EP(ep) IS_EP_TYPE(ep, USB_EP_FLAGS_TYPE_INTERRUPT) -#define IS_ISO_EP(ep) IS_EP_TYPE(ep, USB_EP_FLAGS_TYPE_ISO) - -#define USBIIE_INEPxIE(x) (1 << x) -#define USBOIE_OUEPxIE(x) (1 << x) -#define EPxIF(x) (1 << x) - -#define USB_READ_BLOCK 0x01 -#define USB_WRITE_NOTIFY 0x02 -#define USB_READ_NOTIFY 0x02 -#define USB_READ_FAIL 0x04 - -/* Index in endpoint array */ -#define EP_INDEX(addr) ((addr) & 0x7f) - -/* Get address of endpoint struct */ -#define EP_STRUCT(addr) &usb_endpoints[EP_INDEX(addr)]; - -/* Number of hardware endpoint */ -#define EP_HW_NUM(addr) ((addr) & 0x7f) -/*---------------------------------------------------------------------------*/ -static usb_endpoint_t usb_endpoints[USB_MAX_ENDPOINTS]; -struct process *event_process = 0; -volatile static unsigned int events = 0; -static uint8_t ep0status; -/*---------------------------------------------------------------------------*/ -static uint8_t ep0_tx(void); -static uint8_t ep_tx(uint8_t ep_hw); -static void in_ep_interrupt_handler(uint8_t ep_hw); -static void out_ep_interrupt_handler(uint8_t ep_hw); -static void ep0_interrupt_handler(void); -/*---------------------------------------------------------------------------*/ -static uint8_t -disable_irq(void) -{ - uint8_t enabled = NVIC_IsIRQEnabled(USB_IRQn); - if(enabled) { - NVIC_DisableIRQ(USB_IRQn); - } - return enabled; -} -/*---------------------------------------------------------------------------*/ -static void -restore_irq(uint8_t enabled) -{ - if(enabled) { - NVIC_EnableIRQ(USB_IRQn); - } -} -/*---------------------------------------------------------------------------*/ -static void -notify_process(unsigned int e) -{ - events |= e; - if(event_process) { - process_poll(event_process); - } -} -/*---------------------------------------------------------------------------*/ -static void -notify_ep_process(usb_endpoint_t *ep, unsigned int e) -{ - ep->events |= e; - if(ep->event_process) { - process_poll(ep->event_process); - } -} -/*---------------------------------------------------------------------------*/ -void -usb_set_ep_event_process(unsigned char addr, struct process *p) -{ - usb_endpoint_t *ep = EP_STRUCT(addr); - - ep->event_process = p; -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_set_global_event_process(struct process *p) -{ - event_process = p; -} -/*---------------------------------------------------------------------------*/ -unsigned int -usb_arch_get_global_events(void) -{ - uint8_t flag; - volatile unsigned int e; - - flag = disable_irq(); - - e = events; - events = 0; - - restore_irq(flag); - - return e; -} -/*---------------------------------------------------------------------------*/ -unsigned int -usb_get_ep_events(uint8_t addr) -{ - volatile unsigned int e; - uint8_t flag; - usb_endpoint_t *ep = EP_STRUCT(addr); - - flag = disable_irq(); - - e = ep->events; - ep->events = 0; - - restore_irq(flag); - - return e; -} -/*---------------------------------------------------------------------------*/ -static void -read_hw_buffer(uint8_t *to, uint8_t hw_ep, unsigned int len) -{ - uint32_t fifo_addr = USB_F0 + (hw_ep << 3); - - if(USB_ARCH_CONF_DMA && len > UDMA_SIZE_THRESHOLD) { - /* Set the transfer source and destination addresses */ - udma_set_channel_src(USB_ARCH_CONF_RX_DMA_CHAN, fifo_addr); - udma_set_channel_dst(USB_ARCH_CONF_RX_DMA_CHAN, - (uint32_t)(to) + len - 1); - - /* Configure the control word */ - udma_set_channel_control_word(USB_ARCH_CONF_RX_DMA_CHAN, - UDMA_RX_FLAGS | udma_xfer_size(len)); - - /* Enabled the RF RX uDMA channel */ - udma_channel_enable(USB_ARCH_CONF_RX_DMA_CHAN); - - /* Trigger the uDMA transfer */ - udma_channel_sw_request(USB_ARCH_CONF_RX_DMA_CHAN); - - /* Wait for the transfer to complete. */ - while(udma_channel_get_mode(USB_ARCH_CONF_RX_DMA_CHAN)); - } else { - while(len--) { - *to++ = REG(fifo_addr); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -write_hw_buffer(uint8_t hw_ep, uint8_t *from, unsigned int len) -{ - uint32_t fifo_addr = USB_F0 + (hw_ep << 3); - - if(USB_ARCH_CONF_DMA && len > UDMA_SIZE_THRESHOLD) { - /* Set the transfer source and destination addresses */ - udma_set_channel_src(USB_ARCH_CONF_TX_DMA_CHAN, - (uint32_t)(from) + len - 1); - udma_set_channel_dst(USB_ARCH_CONF_TX_DMA_CHAN, fifo_addr); - - /* Configure the control word */ - udma_set_channel_control_word(USB_ARCH_CONF_TX_DMA_CHAN, - UDMA_TX_FLAGS | udma_xfer_size(len)); - - /* Enabled the RF RX uDMA channel */ - udma_channel_enable(USB_ARCH_CONF_TX_DMA_CHAN); - - /* Trigger the uDMA transfer */ - udma_channel_sw_request(USB_ARCH_CONF_TX_DMA_CHAN); - - /* Wait for the transfer to complete. */ - while(udma_channel_get_mode(USB_ARCH_CONF_TX_DMA_CHAN)); - } else { - while(len--) { - REG(fifo_addr) = *from++; - } - } -} -/*---------------------------------------------------------------------------*/ -static void -reset(void) -{ - uint8_t e; - - for(e = 0; e < USB_MAX_ENDPOINTS; e++) { - if(usb_endpoints[e].flags & USB_EP_FLAGS_ENABLED) { - usb_buffer *buffer = usb_endpoints[e].buffer; - - usb_endpoints[e].flags = 0; - usb_disable_endpoint(e); - while(buffer) { - buffer->flags &= ~USB_BUFFER_SUBMITTED; - buffer = buffer->next; - } - } - } - usb_arch_setup_control_endpoint(0); -} -/*---------------------------------------------------------------------------*/ -static bool -permit_pm1(void) -{ - /* - * Note: USB Suspend/Resume/Remote Wake-Up are not supported. Once the PLL is - * on, it stays on. - */ - return REG(USB_CTRL) == 0; -} -/*---------------------------------------------------------------------------*/ -/* Init USB */ -void -usb_arch_setup(void) -{ - uint8_t i; - - lpm_register_peripheral(permit_pm1); - - /* Switch on USB PLL & USB module */ - REG(USB_CTRL) = USB_CTRL_USB_EN | USB_CTRL_PLL_EN; - - /* Wait until USB PLL is stable */ - while(!(REG(USB_CTRL) & USB_CTRL_PLL_LOCKED)); - - /* Enable pull-up on usb port if driven by GPIO */ -#if defined(USB_PULLUP_PORT_BASE) && defined(USB_PULLUP_PIN_MASK) - GPIO_SET_OUTPUT(USB_PULLUP_PORT_BASE, USB_PULLUP_PIN_MASK); - GPIO_SET_PIN(USB_PULLUP_PORT_BASE, USB_PULLUP_PIN_MASK); -#endif - - for(i = 0; i < USB_MAX_ENDPOINTS; i++) { - usb_endpoints[i].flags = 0; - usb_endpoints[i].event_process = 0; - } - - reset(); - - /* Disable all EP interrupts, EP0 interrupt will be enabled later */ - REG(USB_IIE) = 0; - REG(USB_OIE) = 0; - - /* Initialise the USB control structures */ - if(USB_ARCH_CONF_DMA) { - /* Disable peripheral triggers for our channels */ - udma_channel_mask_set(USB_ARCH_CONF_RX_DMA_CHAN); - udma_channel_mask_set(USB_ARCH_CONF_TX_DMA_CHAN); - } - - NVIC_EnableIRQ(USB_IRQn); -} -/*---------------------------------------------------------------------------*/ -void -usb_submit_recv_buffer(uint8_t addr, usb_buffer *buffer) -{ - usb_buffer **tailp; - uint8_t flag; - usb_endpoint_t *ep = EP_STRUCT(addr); - - if(!(ep->flags & USB_EP_FLAGS_ENABLED)) { - return; - } - - if(buffer->data == NULL && EP_HW_NUM(addr) == 0) { - if(buffer->flags & USB_BUFFER_NOTIFY) { - notify_ep_process(ep, USB_EP_EVENT_NOTIFICATION); - } - return; - } - - flag = disable_irq(); - - tailp = &ep->buffer; - while(*tailp) { - tailp = &(*tailp)->next; - } - *tailp = buffer; - while(buffer) { - buffer->flags |= USB_BUFFER_SUBMITTED; - buffer = buffer->next; - } - - REG(USB_INDEX) = EP_HW_NUM(addr); - if(!EP_HW_NUM(ep->addr)) { - if(REG(USB_CS0) & USB_CS0_OUTPKT_RDY) { - ep0_interrupt_handler(); - } - } else { - if(REG(USB_CSOL) & USB_CSOL_OUTPKT_RDY) { - out_ep_interrupt_handler(EP_HW_NUM(ep->addr)); - } - } - - restore_irq(flag); -} -/*---------------------------------------------------------------------------*/ -void -usb_submit_xmit_buffer(uint8_t addr, usb_buffer *buffer) -{ - usb_buffer **tailp; - uint8_t flag; - uint8_t res; - usb_endpoint_t *ep = EP_STRUCT(addr); - - if(!(ep->flags & USB_EP_FLAGS_ENABLED)) { - return; - } - - flag = disable_irq(); - - if(EP_HW_NUM(addr) == 0) { - if(buffer->data == NULL) { - /* We are asked to send a STATUS packet. - * But the USB hardware will do this automatically - * as soon as we release the HW FIFO. */ - REG(USB_INDEX) = 0; - REG(USB_CS0) = USB_CS0_CLR_OUTPKT_RDY | USB_CS0_DATA_END; - notify_ep_process(ep, USB_EP_EVENT_NOTIFICATION); - restore_irq(flag); - return; - } else { - /* Release the HW FIFO */ - REG(USB_INDEX) = 0; - REG(USB_CS0) = USB_CS0_CLR_OUTPKT_RDY; - } - } - - tailp = &ep->buffer; - while(*tailp) { - tailp = &(*tailp)->next; - } - *tailp = buffer; - while(buffer) { - buffer->flags |= USB_BUFFER_SUBMITTED | USB_BUFFER_IN; - buffer = buffer->next; - } - - REG(USB_INDEX) = EP_HW_NUM(ep->addr); - if(EP_HW_NUM(ep->addr)) { - res = ep_tx(EP_HW_NUM(ep->addr)); - } else { - res = ep0_tx(); - } - - restore_irq(flag); - - if(res & USB_WRITE_NOTIFY) { - notify_ep_process(ep, USB_EP_EVENT_NOTIFICATION); - } -} -/*---------------------------------------------------------------------------*/ -static void -ep0_setup(void) -{ - REG(USB_IIE) |= USB_IIE_EP0IE; -} -/*---------------------------------------------------------------------------*/ -static void -in_ep_setup(uint8_t addr) -{ - uint8_t ei = EP_HW_NUM(addr); - usb_endpoint_t *ep = EP_STRUCT(addr); - - /* Enable IN EP interrupt */ - REG(USB_IIE) |= USBIIE_INEPxIE(ei); - - /* Set internal FIFO size */ - REG(USB_MAXI) = ep->xfer_size / 8; - - if(IS_ISO_EP(ep)) { - REG(USB_CSIH) |= USB_CSOH_ISO; - } else { - REG(USB_CSIH) &= ~USB_CSOH_ISO; - } -} -/*---------------------------------------------------------------------------*/ -static void -out_ep_setup(uint8_t addr) -{ - uint8_t ei = EP_HW_NUM(addr); - usb_endpoint_t *ep = EP_STRUCT(addr); - - /* Enable OUT EP interrupt */ - REG(USB_OIE) |= USBOIE_OUEPxIE(ei); - - /* Set internal FIFO size */ - REG(USB_MAXO) = ep->xfer_size / 8; - - if(IS_ISO_EP(ep)) { - REG(USB_CSOH) |= USB_CSOH_ISO; - } else { - REG(USB_CSOH) &= ~USB_CSOH_ISO; - } -} -/*---------------------------------------------------------------------------*/ -static void -ep_setup(uint8_t addr) -{ - uint8_t ei = EP_HW_NUM(addr); - uint8_t flag; - usb_endpoint_t *ep = EP_STRUCT(addr); - - ep->halted = 0; - ep->flags |= USB_EP_FLAGS_ENABLED; - ep->buffer = 0; - ep->addr = addr; - ep->events = 0; - ep->xfer_size = ep_xfer_size[ei]; - - flag = disable_irq(); - - /* Select endpoint register */ - REG(USB_INDEX) = ei; - - /* EP0 requires special handing */ - if(ei == 0) { - ep0_setup(); - } else { - if(addr & 0x80) { - in_ep_setup(addr); - } else { - out_ep_setup(addr); - } - } - - restore_irq(flag); -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_setup_iso_endpoint(uint8_t addr) -{ - usb_endpoint_t *ep = EP_STRUCT(addr); - - ep->flags = USB_EP_FLAGS_TYPE_ISO; - - ep_setup(addr); -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_setup_control_endpoint(uint8_t addr) -{ - usb_endpoint_t *ep = EP_STRUCT(addr); - - ep->flags = USB_EP_FLAGS_TYPE_CONTROL; - - ep_setup(addr); -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_setup_bulk_endpoint(uint8_t addr) -{ - usb_endpoint_t *ep = EP_STRUCT(addr); - - ep->flags = USB_EP_FLAGS_TYPE_BULK; - - ep_setup(addr); -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_setup_interrupt_endpoint(uint8_t addr) -{ - usb_endpoint_t *ep = EP_STRUCT(addr); - - ep->flags = USB_EP_FLAGS_TYPE_INTERRUPT; - - ep_setup(addr); -} -/*---------------------------------------------------------------------------*/ -static void -ep0_dis(void) -{ - REG(USB_IIE) &= ~USB_IIE_EP0IE; - /* Clear any pending status flags */ - REG(USB_CS0) = 0xC0; -} -/*---------------------------------------------------------------------------*/ -static void -in_ep_dis(uint8_t addr) -{ - REG(USB_MAXI) = 0; - REG(USB_IIE) &= ~USBIIE_INEPxIE(EP_HW_NUM(addr)); - - /* Flush pending */ - REG(USB_CSIL) = USB_CSIL_FLUSH_PACKET; -} -/*---------------------------------------------------------------------------*/ -static void -out_ep_dis(uint8_t addr) -{ - REG(USB_MAXO) = 0; - REG(USB_OIE) &= ~USBOIE_OUEPxIE(EP_HW_NUM(addr)); - - /* Flush pending */ - REG(USB_CSOL) = USB_CSIL_FLUSH_PACKET; -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_disable_endpoint(uint8_t addr) -{ - uint8_t ei = EP_HW_NUM(addr); - uint8_t flag; - usb_endpoint_t *ep = EP_STRUCT(addr); - - ep->flags &= ~USB_EP_FLAGS_ENABLED; - - flag = disable_irq(); - - REG(USB_INDEX) = ei; - if(ei == 0) { - ep0_dis(); - } else { - if(addr & 0x80) { - in_ep_dis(addr); - } else { - out_ep_dis(addr); - } - } - restore_irq(flag); -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_discard_all_buffers(uint8_t addr) -{ - usb_buffer *buffer; - uint8_t flag; - volatile usb_endpoint_t *ep = EP_STRUCT(addr); - - flag = disable_irq(); - - buffer = ep->buffer; - ep->buffer = NULL; - restore_irq(flag); - - while(buffer) { - buffer->flags &= ~USB_BUFFER_SUBMITTED; - buffer = buffer->next; - } -} -/*---------------------------------------------------------------------------*/ -static void -set_stall(uint8_t addr, uint8_t stall) -{ - uint8_t ei = EP_HW_NUM(addr); - - REG(USB_INDEX) = ei; - if(ei == 0) { - /* Stall is automatically deasserted on EP0 */ - if(stall) { - ep0status = EP_STATUS_IDLE; - REG(USB_CS0) |= USB_CS0_SEND_STALL | USB_CS0_OUTPKT_RDY; - } - } else { - if(addr & 0x80) { - if(stall) { - REG(USB_CSIL) |= USB_CSIL_SEND_STALL; - } else { - REG(USB_CSIL) &= ~USB_CSIL_SEND_STALL; - } - } else { - if(stall) { - REG(USB_CSOL) |= USB_CSOL_SEND_STALL; - } else { - REG(USB_CSOL) &= ~USB_CSOL_SEND_STALL; - } - } - } -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_control_stall(uint8_t addr) -{ - uint8_t ei = EP_HW_NUM(addr); - uint8_t flag; - - if(ei > USB_MAX_ENDPOINTS) { - return; - } - - flag = disable_irq(); - - set_stall(addr, 1); - - restore_irq(flag); -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_halt_endpoint(uint8_t addr, int halt) -{ - uint8_t ei = EP_HW_NUM(addr); - uint8_t flag; - usb_endpoint_t *ep = EP_STRUCT(addr); - - if(ei > USB_MAX_ENDPOINTS) { - return; - } - - if(!(ep->flags & USB_EP_FLAGS_ENABLED)) { - return; - } - - flag = disable_irq(); - - if(halt) { - ep->halted = 0x1; - set_stall(addr, 1); - } else { - ep->halted = 0; - set_stall(addr, 0); - - if(ep->buffer && (ep->buffer->flags & USB_BUFFER_HALT)) { - ep->buffer->flags &= ~USB_BUFFER_SUBMITTED; - if(ep->buffer->flags & USB_BUFFER_NOTIFY) { - notify_ep_process(ep, USB_EP_EVENT_NOTIFICATION); - } - ep->buffer = ep->buffer->next; - } - if(ei) { - out_ep_interrupt_handler(EP_HW_NUM(addr)); - } - } - - restore_irq(flag); -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_set_configuration(uint8_t usb_configuration_value) -{ - return; -} -/*---------------------------------------------------------------------------*/ -uint16_t -usb_arch_get_ep_status(uint8_t addr) -{ - uint8_t ei = EP_INDEX(addr); - usb_endpoint_t *ep = EP_STRUCT(addr); - - if(ei > USB_MAX_ENDPOINTS) { - return 0; - } - - return ep->halted; -} -/*---------------------------------------------------------------------------*/ -void -usb_arch_set_address(uint8_t addr) -{ - REG(USB_ADDR) = addr; -} -/*---------------------------------------------------------------------------*/ -int -usb_arch_send_pending(uint8_t addr) -{ - uint8_t flag; - uint8_t ret; - uint8_t ei = EP_INDEX(addr); - - flag = disable_irq(); - - REG(USB_INDEX) = ei; - if(ei == 0) { - ret = REG(USB_CS0) & USB_CS0_INPKT_RDY; - } else { - ret = REG(USB_CSIL) & USB_CSIL_INPKT_RDY; - } - - restore_irq(flag); - - return ret; -} -/*---------------------------------------------------------------------------*/ -static unsigned int -get_receive_capacity(usb_buffer *buffer) -{ - unsigned int capacity = 0; - - while(buffer && - !(buffer->flags & (USB_BUFFER_IN | USB_BUFFER_SETUP | USB_BUFFER_HALT))) { - capacity += buffer->left; - buffer = buffer->next; - } - return capacity; -} -/*---------------------------------------------------------------------------*/ -static usb_buffer * -skip_buffers_until(usb_buffer *buffer, unsigned int mask, unsigned int flags, - uint8_t *resp) -{ - while(buffer && !((buffer->flags & mask) == flags)) { - buffer->flags &= ~USB_BUFFER_SUBMITTED; - buffer->flags |= USB_BUFFER_FAILED; - if(buffer->flags & USB_BUFFER_NOTIFY) { - *resp |= USB_READ_NOTIFY; - } - buffer = buffer->next; - } - return buffer; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -fill_buffers(usb_buffer *buffer, uint8_t hw_ep, unsigned int len, - uint8_t short_packet) -{ - unsigned int t; - uint8_t res = 0; - - do { - if(buffer->left < len) { - t = buffer->left; - } else { - t = len; - } - len -= t; - buffer->left -= t; - - read_hw_buffer(buffer->data, hw_ep, t); - - buffer->data += t; - - if(len == 0) { - break; - } - - buffer->flags &= ~(USB_BUFFER_SUBMITTED | USB_BUFFER_SHORT_PACKET); - if(buffer->flags & USB_BUFFER_NOTIFY) { - res |= USB_READ_NOTIFY; - } - buffer = buffer->next; - } while(1); - - if(short_packet) { - buffer->flags |= USB_BUFFER_SHORT_PACKET; - } - - if((buffer->left == 0) || (buffer->flags & USB_BUFFER_PACKET_END)) { - buffer->flags &= ~USB_BUFFER_SUBMITTED; - if(buffer->flags & USB_BUFFER_NOTIFY) { - res |= USB_READ_NOTIFY; - } - buffer = buffer->next; - } else { - if(short_packet) { - if(buffer->left && !(buffer->flags & USB_BUFFER_SHORT_END)) { - buffer->flags |= USB_BUFFER_FAILED; - res |= USB_READ_FAIL; - } - buffer->flags &= ~USB_BUFFER_SUBMITTED; - if(buffer->flags & USB_BUFFER_NOTIFY) { - res |= USB_READ_NOTIFY; - } - buffer = buffer->next; - } - } - - usb_endpoints[hw_ep].buffer = buffer; - - return res; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -ep0_get_setup_pkt(void) -{ - uint8_t res = 0; - usb_buffer *buffer = - skip_buffers_until(usb_endpoints[0].buffer, USB_BUFFER_SETUP, - USB_BUFFER_SETUP, &res); - - usb_endpoints[0].buffer = buffer; - - if(!buffer || buffer->left < 8) { - return USB_READ_BLOCK; - } - - read_hw_buffer(buffer->data, 0, 8); - buffer->left -= 8; - - buffer->flags &= ~USB_BUFFER_SUBMITTED; - if(buffer->flags & USB_BUFFER_NOTIFY) { - res |= USB_READ_NOTIFY; - } - - if(buffer->data[6] || buffer->data[7]) { - REG(USB_CS0) |= USB_CS0_CLR_OUTPKT_RDY; - ep0status = buffer->data[0] & 0x80 ? EP_STATUS_TX : EP_STATUS_RX; - } - - buffer->data += 8; - - usb_endpoints[0].buffer = buffer->next; - - return res; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -ep0_get_data_pkt(void) -{ - uint8_t res = 0; - uint8_t short_packet = 0; - usb_buffer *buffer = usb_endpoints[0].buffer; - uint8_t len = REG(USB_CNT0); - - if(!buffer) { - return USB_READ_BLOCK; - } - - if(buffer->flags & (USB_BUFFER_SETUP | USB_BUFFER_IN)) { - buffer->flags |= USB_BUFFER_FAILED; - buffer->flags &= ~USB_BUFFER_SUBMITTED; - if(buffer->flags & USB_BUFFER_NOTIFY) { - res |= USB_READ_NOTIFY; - } - /* Flush the fifo */ - while(len--) { - REG(USB_F0); - } - usb_endpoints[0].buffer = buffer->next; - /* Force data stage end */ - REG(USB_CS0) |= USB_CS0_CLR_OUTPKT_RDY | USB_CS0_DATA_END; - - ep0status = EP_STATUS_IDLE; - return res; - } - - if(get_receive_capacity(buffer) < len) { - /* Wait until we queue more buffers */ - return USB_READ_BLOCK; - } - - if(len < usb_endpoints[0].xfer_size) { - short_packet = 1; - } - - res = fill_buffers(buffer, 0, len, short_packet); - - if(short_packet) { - /* The usb-core will send a status packet, we will release the fifo at this stage */ - ep0status = EP_STATUS_IDLE; - } else { - REG(USB_CS0) |= USB_CS0_CLR_OUTPKT_RDY; - } - return res; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -ep0_tx(void) -{ - usb_buffer *buffer = usb_endpoints[0].buffer; - unsigned int len = usb_endpoints[0].xfer_size; - uint8_t data_end = 0; - uint8_t res = 0; - - /* If TX Fifo still busy or ep0 not in TX data stage don't do anything */ - if((REG(USB_CS0) & USB_CS0_INPKT_RDY) || (ep0status != EP_STATUS_TX)) { - return 0; - } - - if(!buffer) { - return 0; - } - - if(!(buffer->flags & USB_BUFFER_IN)) { - /* We should TX but queued buffer is in RX */ - return 0; - } - - while(buffer) { - unsigned int copy; - - if(buffer->left < len) { - copy = buffer->left; - } else { - copy = len; - } - - len -= copy; - buffer->left -= copy; - write_hw_buffer(0, buffer->data, copy); - buffer->data += copy; - if(buffer->left == 0) { - if(buffer->flags & USB_BUFFER_SHORT_END) { - if(len == 0) { - break; // We keep the buffer in queue so we will send a ZLP next time. - } else { - data_end = 1; - len = 0; // Stop looking for more data to send - } - } - buffer->flags &= ~USB_BUFFER_SUBMITTED; - if(buffer->flags & USB_BUFFER_NOTIFY) { - res |= USB_WRITE_NOTIFY; - } - buffer = buffer->next; - } - if(len == 0) { - break; // FIFO is full, send packet. - } - } - if(len) { - data_end = 1; - } - usb_endpoints[0].buffer = buffer; - - /* - * Workaround the fact that the usb controller do not like to have DATA_END - * set after INPKT_RDY for the last packet. Thus if no more is in the queue - * set DATA_END - */ - if(data_end || !buffer) { - ep0status = EP_STATUS_IDLE; - REG(USB_CS0) |= USB_CS0_INPKT_RDY | USB_CS0_DATA_END; - } else { - REG(USB_CS0) |= USB_CS0_INPKT_RDY; - } - - return res; -} -/*---------------------------------------------------------------------------*/ -static void -ep0_interrupt_handler(void) -{ - uint8_t cs0; - uint8_t res; - - REG(USB_INDEX) = 0; - cs0 = REG(USB_CS0); - if(cs0 & USB_CS0_SENT_STALL) { - /* Ack the stall */ - REG(USB_CS0) = 0; - ep0status = EP_STATUS_IDLE; - } - if(cs0 & USB_CS0_SETUP_END) { - /* Clear it */ - REG(USB_CS0) = USB_CS0_CLR_SETUP_END; - ep0status = EP_STATUS_IDLE; - } - - if(cs0 & USB_CS0_OUTPKT_RDY) { - if(ep0status == EP_STATUS_IDLE) { - res = ep0_get_setup_pkt(); - } else { - res = ep0_get_data_pkt(); - } - - if(res & USB_READ_NOTIFY) { - notify_ep_process(&usb_endpoints[0], USB_EP_EVENT_NOTIFICATION); - } - if(res & USB_READ_BLOCK) { - return; - } - } - - res = ep0_tx(); - - if(res & USB_WRITE_NOTIFY) { - notify_ep_process(&usb_endpoints[0], USB_EP_EVENT_NOTIFICATION); - } -} -/*---------------------------------------------------------------------------*/ -static uint8_t -ep_tx(uint8_t ep_hw) -{ - unsigned int len; - uint8_t res = 0; - usb_endpoint_t *ep = EP_STRUCT(ep_hw); - - len = ep->xfer_size; - - if(ep->halted) { - return 0; - } - - if(!ep->buffer || !(ep->buffer->flags & USB_BUFFER_IN)) { - return 0; - } - - while(ep->buffer) { - unsigned int copy; - - if(ep->buffer->left < len) { - copy = ep->buffer->left; - } else { - copy = len; - } - - len -= copy; - ep->buffer->left -= copy; - - /* - * Delay somewhat if the previous packet has not yet left the IN FIFO, - * making sure the dog doesn't bark while we're waiting - */ - while(REG(USB_CSIL) & USB_CSIL_INPKT_RDY) { - watchdog_periodic(); - } - - write_hw_buffer(EP_INDEX(ep_hw), ep->buffer->data, copy); - ep->buffer->data += copy; - - if(ep->buffer->left == 0) { - if(ep->buffer->flags & USB_BUFFER_SHORT_END) { - if(len == 0) { - /* We keep the buffer in queue so we will send a ZLP next */ - break; - } else { - /* Stop looking for more data to send */ - len = 0; - } - } - ep->buffer->flags &= ~USB_BUFFER_SUBMITTED; - if(ep->buffer->flags & USB_BUFFER_NOTIFY) { - res |= USB_WRITE_NOTIFY; - } - ep->buffer = ep->buffer->next; - } - if(len == 0) { - /* FIFO full, send */ - break; - } - } - - REG(USB_CSIL) |= USB_CSIL_INPKT_RDY; - - return res; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -ep_get_data_pkt(uint8_t ep_hw) -{ - uint16_t pkt_len; - uint8_t res; - uint8_t short_packet = 0; - usb_endpoint_t *ep = EP_STRUCT(ep_hw); - - if(!ep->buffer) { - return USB_READ_BLOCK; - } - - if(ep->buffer->flags & USB_BUFFER_HALT) { - ep->halted = 1; - if(!(REG(USB_CSOL) & USB_CSOL_SEND_STALL)) { - REG(USB_CSOL) |= USB_CSOL_SEND_STALL; - } - return 0; - } - - /* Disambiguate UG CNTL bits */ - pkt_len = REG(USB_CNTL) | (REG(USB_CNTH) << 8); - if(get_receive_capacity(ep->buffer) < pkt_len) { - return USB_READ_BLOCK; - } - - if(pkt_len < ep->xfer_size) { - short_packet = 1; - } - - res = fill_buffers(ep->buffer, ep_hw, pkt_len, short_packet); - - REG(USB_CSOL) &= ~USB_CSOL_OUTPKT_RDY; - - return res; -} -/*---------------------------------------------------------------------------*/ -static void -out_ep_interrupt_handler(uint8_t ep_hw) -{ - uint8_t csl; - uint8_t res; - usb_endpoint_t *ep = EP_STRUCT(ep_hw); - - - REG(USB_INDEX) = ep_hw; - csl = REG(USB_CSOL); - - if(csl & USB_CSOL_SENT_STALL) { - REG(USB_CSOL) &= ~USB_CSOL_SENT_STALL; - } - - if(csl & USB_CSOL_OVERRUN) { - /* We lost one isochronous packet */ - REG(USB_CSOL) &= ~USB_CSOL_OVERRUN; - } - - if(csl & USB_CSOL_OUTPKT_RDY) { - res = ep_get_data_pkt(ep_hw); - - if(res & USB_READ_NOTIFY) { - notify_ep_process(ep, USB_EP_EVENT_NOTIFICATION); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -in_ep_interrupt_handler(uint8_t ep_hw) -{ - uint8_t csl; -#if USB_ARCH_WRITE_NOTIFY - uint8_t res; - usb_endpoint_t *ep = EP_STRUCT(ep_hw); -#endif - - REG(USB_INDEX) = ep_hw; - csl = REG(USB_CSIL); - - if(csl & USB_CSIL_SENT_STALL) { - REG(USB_CSIL) &= ~USB_CSIL_SENT_STALL; - } - - if(csl & USB_CSIL_UNDERRUN) { - REG(USB_CSIL) &= ~USB_CSIL_UNDERRUN; - } - -#if USB_ARCH_WRITE_NOTIFY - if(!(csl & USB_CSIL_INPKT_RDY)) { - res = ep_tx(ep_hw); - if(res & USB_WRITE_NOTIFY) { - notify_ep_process(ep, USB_EP_EVENT_NOTIFICATION); - } - } -#endif -} -/*---------------------------------------------------------------------------*/ -void -usb_isr(void) -{ - uint8_t ep_in_if = REG(USB_IIF) & REG(USB_IIE); - uint8_t ep_out_if = REG(USB_OIF) & REG(USB_OIE); - uint8_t common_if = REG(USB_CIF) & REG(USB_CIE); - uint8_t i; - - if(ep_in_if) { - /* EP0 flag is in the IN Interrupt Flags register */ - if(ep_in_if & USB_IIF_EP0IF) { - ep0_interrupt_handler(); - } - for(i = 1; i < 6; i++) { - if(ep_in_if & EPxIF(i)) { - in_ep_interrupt_handler(i); - } - } - } - if(ep_out_if) { - for(i = 1; i < 6; i++) { - if(ep_out_if & EPxIF(i)) { - out_ep_interrupt_handler(i); - } - } - } - if(common_if & USB_CIF_RSTIF) { - reset(); - notify_process(USB_EVENT_RESET); - } - if(common_if & USB_CIF_RESUMEIF) { - notify_process(USB_EVENT_RESUME); - } - if(common_if & USB_CIF_SUSPENDIF) { - notify_process(USB_EVENT_SUSPEND); - } -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/arch/cpu/cc2538/usb/usb-serial.c b/arch/cpu/cc2538/usb/usb-serial.c deleted file mode 100644 index 218646635..000000000 --- a/arch/cpu/cc2538/usb/usb-serial.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 2012, Philippe Retornaz - * Copyright (c) 2012, EPFL STI IMT LSRO1 -- Mobots group - * 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. - */ -/** - * \addtogroup cc2538-usb - * @{ - * - * \file - * Platform process which implements a UART-like functionality over the - * cc2538's USB hardware. - * - * This has been ported over from platform/cc2530dk - * - * \author - * - Philippe Retornaz (EPFL) - Original code - * - George Oikonomou - - * Turned this to a 'serial over USB' platform process, ported for cc2538 - */ -#include "contiki.h" -#include "sys/process.h" -#include "net/linkaddr.h" -#include "usb-api.h" -#include "usb.h" -#include "usb-arch.h" -#include "cdc-acm/cdc-acm.h" -#include "ieee-addr.h" - -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 - -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -struct lang_id { - uint8_t size; - uint8_t type; - uint16_t langid; -}; -static const struct lang_id lang_id = { sizeof(lang_id), 3, 0x0409 }; -/*---------------------------------------------------------------------------*/ -struct serial_nr { - uint8_t size; - uint8_t type; - uint16_t string[16]; -}; -static struct serial_nr serial_nr = { - sizeof(serial_nr), - 3, { - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A' - } -}; -/*---------------------------------------------------------------------------*/ -struct manufacturer { - uint8_t size; - uint8_t type; - uint16_t string[17]; -}; -static const struct manufacturer manufacturer = { - sizeof(manufacturer), - 3, - { - 'T', 'e', 'x', 'a', 's', ' ', - 'I', 'n', 's', 't', 'r', 'u', 'm', 'e', 'n', 't', 's' - } -}; -/*---------------------------------------------------------------------------*/ -struct product { - uint8_t size; - uint8_t type; - uint16_t string[21]; -}; -static const struct product product = { - sizeof(product), - 3, - { - 'c', 'c', '2', '5', '3', '8', ' ', - 'S', 'y', 's', 't', 'e', 'm', '-', 'o', 'n', '-', 'C', 'h', 'i', 'p' - } -}; -/*---------------------------------------------------------------------------*/ -#define EPIN 0x82 -#define EPOUT 0x03 - -#define RX_BUFFER_SIZE USB_EP3_SIZE -#define TX_BUFFER_SIZE (USB_EP2_SIZE - 1) - -typedef struct _USBBuffer usb_buffer; - -static usb_buffer data_rx_urb; -static usb_buffer data_tx_urb; -static uint8_t usb_rx_data[RX_BUFFER_SIZE]; -static uint8_t enabled = 0; - -#define SLIP_END 0300 -static uint8_t usb_tx_data[TX_BUFFER_SIZE]; -static uint8_t buffered_data = 0; - -/* Callback to the input handler */ -static int (* input_handler)(unsigned char c); -/*---------------------------------------------------------------------------*/ -uint8_t * -usb_class_get_string_descriptor(uint16_t lang, uint8_t string) -{ - switch (string) { - case 0: - return (uint8_t *)&lang_id; - case 1: - return (uint8_t *)&manufacturer; - case 2: - return (uint8_t *)&product; - case 3: - return (uint8_t *)&serial_nr; - default: - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -static void -set_serial_number(void) -{ - uint8_t i; - uint8_t ieee[8]; - uint8_t lown, highn; - uint8_t c; - - ieee_addr_cpy_to(ieee, 8); - - for(i = 0; i < 8; i++) { - lown = ieee[i] & 0x0F; - highn = ieee[i] >> 4; - c = lown > 9 ? 'A' + lown - 0xA : lown + '0'; - serial_nr.string[i * 2 + 1] = c; - c = highn > 9 ? 'A' + highn - 0xA : highn + '0'; - serial_nr.string[i * 2] = c; - } -} -/*---------------------------------------------------------------------------*/ -static void -queue_rx_urb(void) -{ - data_rx_urb.flags = USB_BUFFER_PACKET_END; - data_rx_urb.flags |= USB_BUFFER_NOTIFY; - data_rx_urb.data = usb_rx_data; - data_rx_urb.left = RX_BUFFER_SIZE; - data_rx_urb.next = NULL; - usb_submit_recv_buffer(EPOUT, &data_rx_urb); -} -/*---------------------------------------------------------------------------*/ -static void -do_work(void) -{ - unsigned int events; - - events = usb_get_global_events(); - if(events & USB_EVENT_CONFIG) { - /* Configure EPs. Don't enable them yet, until the CDC line is up */ - usb_setup_bulk_endpoint(EPIN); - usb_setup_bulk_endpoint(EPOUT); - - queue_rx_urb(); - } - if(events & USB_EVENT_RESET) { - enabled = 0; - } - - events = usb_cdc_acm_get_events(); - if(events & USB_CDC_ACM_LINE_STATE) { - uint8_t line_state = usb_cdc_acm_get_line_state(); - PRINTF("CDC-ACM event 0x%04x, Line State = %u\n", events, line_state); - if(line_state & USB_CDC_ACM_DTE) { - enabled = 1; - } else { - enabled = 0; - } - } - - if(!enabled) { - return; - } - - events = usb_get_ep_events(EPOUT); - if((events & USB_EP_EVENT_NOTIFICATION) - && !(data_rx_urb.flags & USB_BUFFER_SUBMITTED)) { - if(!(data_rx_urb.flags & USB_BUFFER_FAILED)) { - if(input_handler) { - uint8_t len; - uint8_t i; - - len = RX_BUFFER_SIZE - data_rx_urb.left; - for(i = 0; i < len; i++) { - input_handler(usb_rx_data[i]); - } - } - } - queue_rx_urb(); - } -} -/*---------------------------------------------------------------------------*/ -void -usb_serial_flush() -{ - if(buffered_data == 0) { - return; - } - - data_tx_urb.flags = USB_BUFFER_SHORT_END; - data_tx_urb.flags |= USB_BUFFER_NOTIFY; - data_tx_urb.next = NULL; - data_tx_urb.data = usb_tx_data; - data_tx_urb.left = buffered_data; - buffered_data = 0; - usb_submit_xmit_buffer(EPIN, &data_tx_urb); -} -/*---------------------------------------------------------------------------*/ -void -usb_serial_writeb(uint8_t b) -{ - if(!enabled) { - buffered_data = 0; - return; - } - - usb_tx_data[buffered_data] = b; - buffered_data++; - - if(buffered_data == TX_BUFFER_SIZE) { - usb_serial_flush(); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS(usb_serial_process, "USB-Serial process"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(usb_serial_process, ev, data) -{ - - PROCESS_BEGIN(); - - set_serial_number(); - - usb_setup(); - usb_cdc_acm_setup(); - usb_set_global_event_process(&usb_serial_process); - usb_cdc_acm_set_event_process(&usb_serial_process); - usb_set_ep_event_process(EPIN, &usb_serial_process); - usb_set_ep_event_process(EPOUT, &usb_serial_process); - - while(1) { - PROCESS_WAIT_EVENT(); - if(ev == PROCESS_EVENT_EXIT) { - break; - } - if(ev == PROCESS_EVENT_POLL) { - do_work(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -usb_serial_set_input(int (* input)(unsigned char c)) -{ - input_handler = input; -} -/*---------------------------------------------------------------------------*/ -void -usb_serial_init() -{ - process_start(&usb_serial_process, NULL); -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/arch/cpu/cc2538/usb/usb-serial.h b/arch/cpu/cc2538/usb/usb-serial.h deleted file mode 100644 index 2a4d58707..000000000 --- a/arch/cpu/cc2538/usb/usb-serial.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-usb - * @{ - * - * \file - * Header file for cc2538's UART-like I/O over USB - */ -#ifndef USB_SERIAL_H_ -#define USB_SERIAL_H_ - -#include "contiki.h" - -/** - * \brief Initialise the Serial-over-USB process - */ -void usb_serial_init(void); - -/** - * \brief Write a byte over USB - * \param b The byte - * \sa usb_serial_flush() - * - * USB-Serial output is buffered. The buffer is actually submitted to the USB - * controller for transmission when: - * - It is full or - * - The code explicitly calls usb_serial_flush() - */ -void usb_serial_writeb(uint8_t b); - -/** - * \brief Set an input hook for bytes received over USB - * \param input A pointer to a function to be called when a byte is received - */ -void usb_serial_set_input(int (* input)(unsigned char c)); - -/** - * \brief Immediately transmit the content of Serial-over-USB TX buffers - * \sa usb_serial_writeb() - */ -void usb_serial_flush(void); - -#endif /* USB_SERIAL_H_ */ - -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/Makefile.cc13x0 b/arch/cpu/cc26x0-cc13x0/Makefile.cc13x0 deleted file mode 100644 index c29ee7270..000000000 --- a/arch/cpu/cc26x0-cc13x0/Makefile.cc13x0 +++ /dev/null @@ -1,7 +0,0 @@ -TI_XXWARE_PATH = lib/cc13xxware - -CONTIKI_CPU_SOURCEFILES += smartrf-settings.c prop-mode.c prop-mode-tx-power.c cc13xx-50kbps-tsch.c - -CFLAGS += -DCPU_FAMILY_CC13X0=1 -DCPU_FAMILY_CC13XX=1 - -include $(CONTIKI_CPU)/Makefile.cc26x0-cc13x0 diff --git a/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0 b/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0 deleted file mode 100644 index 51db3f205..000000000 --- a/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0 +++ /dev/null @@ -1,5 +0,0 @@ -TI_XXWARE_PATH = lib/cc26xxware - -CFLAGS += -DCPU_FAMILY_CC26X0=1 -DCPU_FAMILY_CC26XX=1 - -include $(CONTIKI_CPU)/Makefile.cc26x0-cc13x0 diff --git a/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 b/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 deleted file mode 100644 index d3900b9fb..000000000 --- a/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 +++ /dev/null @@ -1,100 +0,0 @@ -CPU_ABS_PATH = arch/cpu/cc26x0-cc13x0 -TI_XXWARE = $(CONTIKI_CPU)/$(TI_XXWARE_PATH) - -ifeq (,$(wildcard $(TI_XXWARE)/*)) - $(warning $(TI_XXWARE) does not exist or is empty.) - $(warning Did you run 'git submodule update --init' ?) - $(error "") -endif - -### cc26xxware / cc26x0r2fware sources under driverlib will be added to the -### MODULES list -TI_XXWARE_SRC = $(CPU_ABS_PATH)/$(TI_XXWARE_PATH)/driverlib - -### The directory with startup sources will be added to the CONTIKI_CPU_DIRS -### and the sources therein are added to the sources list explicitly. They are -### also listed explicitly in the linker command (through TARGET_STARTFILES), -### to make sure they always get linked in the image -TI_XXWARE_STARTUP_DIR = $(TI_XXWARE_PATH)/startup_files -TI_XXWARE_STARTUP_SRCS = ccfg.c startup_gcc.c - -### MODULES will add some of these to the include path, but we need to add -### them earlier to prevent filename clashes with Contiki core files -CFLAGS += -I$(TI_XXWARE) -I$(CONTIKI)/$(TI_XXWARE_SRC) -CFLAGS += -I$(TI_XXWARE)/inc -MODULES += $(TI_XXWARE_SRC) - -LDSCRIPT ?= $(CONTIKI_CPU)/cc26xx.ld - -### If the user-specified a Node ID, pass a define -ifdef NODEID - CFLAGS += -DIEEE_ADDR_NODE_ID=$(NODEID) -endif - -### CPU-dependent directories -CONTIKI_CPU_DIRS += . dev rf-core rf-core/api rf-core/ble-hal $(TI_XXWARE_STARTUP_DIR) - -### CPU-dependent source files -CONTIKI_CPU_SOURCEFILES += clock.c rtimer-arch.c soc-rtc.c uart.c -CONTIKI_CPU_SOURCEFILES += contiki-watchdog.c aux-ctrl.c -CONTIKI_CPU_SOURCEFILES += dbg.c ieee-addr.c batmon-sensor.c adc-sensor.c -CONTIKI_CPU_SOURCEFILES += slip-arch.c slip.c cc26xx-uart.c lpm.c -CONTIKI_CPU_SOURCEFILES += gpio-interrupt.c gpio-hal-arch.c oscillators.c -CONTIKI_CPU_SOURCEFILES += rf-core.c rf-ble.c ieee-mode.c -CONTIKI_CPU_SOURCEFILES += ble-cc2650.c ble-hal-cc26xx.c ble-addr.c rf-ble-cmd.c -CONTIKI_CPU_SOURCEFILES += random.c soc-trng.c int-master.c -CONTIKI_CPU_SOURCEFILES += spi-arch.c -CONTIKI_CPU_SOURCEFILES += cc26xx-aes.c - -CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) - -CPU_START_SOURCEFILES += fault-handlers.c $(TI_XXWARE_STARTUP_SRCS) - -PYTHON = python -BSL_FLAGS += -e -w -v - -ifdef PORT - BSL_FLAGS += -p $(PORT) -endif - -BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py - -### Always re-build ieee-addr.o in case the command line passes a new NODEID -FORCE: - -$(OBJECTDIR)/ieee-addr.o: ieee-addr.c FORCE | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -c $< -o $@ - -### Always re-build ccfg.c so changes to ccfg-conf.h will apply without having -### to make clean first -$(OBJECTDIR)/ccfg.o: ccfg.c FORCE | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -include "ccxxware-conf.h" -c $< -o $@ - -# a target that gives a user-friendly memory profile, taking into account the RAM -# that is statically occupied by the stack as defined in the linker script -# see $(LDSCRIPT) -RAM_SIZE = 0x00003E00 -FLASH_SIZE = 0x0001E000 -STACK_SIZE = 0 -%.size: %.$(TARGET) - @$(SIZE) -A $< | egrep "data|bss" | awk '{s+=$$2} END {s=s+$(STACK_SIZE); f=$(RAM_SIZE)-s; printf "[RAM] used %6d, free %6d\n",s,f;}' - @$(SIZE) -A $< | egrep "text|isr_vector" | awk '{s+=$$2} END {f=$(FLASH_SIZE)-s; printf "[Flash] used %6d, free %6d\n",s,f;}' - -include $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3 - -ifeq ($(BOARD_SUPPORTS_BSL),1) -%.upload: $(OUT_BIN) -ifeq ($(wildcard $(BSL)), ) - @echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?" -else - $(PYTHON) $(BSL) $(BSL_FLAGS) $< -endif -else -%.upload: - @echo "This board cannot be programmed through the ROM bootloader and therefore does not support the .upload target." -endif - -### For the login etc targets -BAUDRATE = 115200 diff --git a/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0r2f b/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0r2f deleted file mode 100644 index 5118cd6a8..000000000 --- a/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0r2f +++ /dev/null @@ -1,5 +0,0 @@ -TI_XXWARE_PATH = lib/cc2640r2-sdk - -CFLAGS += -DCPU_FAMILY_CC26X0R2=1 -DCPU_FAMILY_CC26XXR2=1 - -include $(CONTIKI_CPU)/Makefile.cc26x0-cc13x0 diff --git a/arch/cpu/cc26x0-cc13x0/ble-addr.c b/arch/cpu/cc26x0-cc13x0/ble-addr.c deleted file mode 100644 index 7617133cc..000000000 --- a/arch/cpu/cc26x0-cc13x0/ble-addr.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2016, Michael Spoerk - * 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 - * Driver for the retrieval of an BLE address from flash - * - * \author - * Michael Spoerk - */ -/*---------------------------------------------------------------------------*/ -#include "contiki-conf.h" -#include "net/linkaddr.h" -#include - -#include "ble-addr.h" -#include "os/dev/ble-hal.h" -/*---------------------------------------------------------------------------*/ -void -ble_addr_cpy_to(uint8_t *dst) -{ - int i; - uint8_t *location = (uint8_t *)BLE_ADDR_LOCATION; - - for(i = 0; i < BLE_ADDR_SIZE; i++) { - dst[i] = location[BLE_ADDR_SIZE - 1 - i]; - } -} -/*---------------------------------------------------------------------------*/ -void -ble_addr_to_eui64(uint8_t *dst, uint8_t *src) -{ - memcpy(dst, src, 3); - dst[3] = 0xFF; - dst[4] = 0xFE; - memcpy(&dst[5], &src[3], 3); -} -/*---------------------------------------------------------------------------*/ -void -ble_eui64_addr_cpy_to(uint8_t *dst) -{ - uint8_t ble_addr[BLE_ADDR_SIZE]; - ble_addr_cpy_to(ble_addr); - ble_addr_to_eui64(dst, ble_addr); -} diff --git a/arch/cpu/cc26x0-cc13x0/ble-addr.h b/arch/cpu/cc26x0-cc13x0/ble-addr.h deleted file mode 100644 index 4f61b0dd6..000000000 --- a/arch/cpu/cc26x0-cc13x0/ble-addr.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2016, Michael Spoerk - * 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 - * Driver for the retrieval of an BLE address from flash - * - * \author - * Michael Spoerk - */ -/*---------------------------------------------------------------------------*/ -#ifndef BLE_ADDR_H_ -#define BLE_ADDR_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki-conf.h" -#include -/*---------------------------------------------------------------------------*/ -/* primary BLE address location */ -#define BLE_ADDR_LOCATION 0x500012E8 - -/*---------------------------------------------------------------------------*/ -/** - * \brief Copy the node's factory BLE address to a destination memory area - * \param dst A pointer to the destination area where the BLE address is to be - * written - * - * This function will copy 6 bytes and it will invert byte order in - * the process. The factory address on devices is normally little-endian, - * therefore you should expect dst to store the address in a big-endian order. - */ -void ble_addr_cpy_to(uint8_t *dst); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Copy the node's BLE address to a destination memory area and converts - * it into a EUI64 address in the process - * \param dst A pointer to the destination area where the EUI64 address is to be - * written - * \param src A pointer to the BLE address that is to be copied - */ -void ble_addr_to_eui64(uint8_t *dst, uint8_t *src); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Copy the node's EUI64 address that is based on its factory BLE address - * to a destination memory area - * \param dst A pointer to the destination area where the EUI64 address is to be - * written - */ -void ble_eui64_addr_cpy_to(uint8_t *dst); -/*---------------------------------------------------------------------------*/ - -#endif /* BLE_ADDR_H_ */ diff --git a/arch/cpu/cc26x0-cc13x0/cc13x0-cc26x0-cm3.h b/arch/cpu/cc26x0-cc13x0/cc13x0-cc26x0-cm3.h deleted file mode 100644 index bda2e2b07..000000000 --- a/arch/cpu/cc26x0-cc13x0/cc13x0-cc26x0-cm3.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Template: - * Copyright (c) 2012 ARM LIMITED - * All rights reserved. - * - * CC13xx-CC26xx: - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-cm3 CC13xx/CC26xx CMSIS - * - * CC13xx/CC26xx Cortex-M3 CMSIS definitions - * @{ - * - * \file - * CMSIS Cortex-M3 core peripheral access layer header file for CC13xx/CC26xx - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC13XX_CC26XX_CM3_H_ -#define CC13XX_CC26XX_CM3_H_ -/*---------------------------------------------------------------------------*/ -/** - * \name Interrupt Number Definition - * @{ - */ -typedef enum cc13xx_cc26xx_cm3_irq_e { - /* Cortex-M3 Processor Exceptions */ - CC13XX_CC26XX_CM3_EXCEPTION_RESET = -15, /**< 1 Reset */ - CC13XX_CC26XX_CM3_EXCEPTION_NMI = -14, /**< 2 NMI */ - CC13XX_CC26XX_CM3_EXCEPTION_HARD_FAULT = -13, /**< 3 Hard fault */ - CC13XX_CC26XX_CM3_EXCEPTION_MPU_FAULT = -12, /**< 4 MPU fault */ - CC13XX_CC26XX_CM3_EXCEPTION_BUS_FAULT = -11, /**< 5 Bus fault */ - CC13XX_CC26XX_CM3_EXCEPTION_USAGE_FAULT = -10, /**< 6 Usage fault */ - CC13XX_CC26XX_CM3_EXCEPTION_SV_CALL = -5, /**< 11 SVCall */ - CC13XX_CC26XX_CM3_EXCEPTION_DEBUG_MON = -4, /**< 12 Debug monitor */ - CC13XX_CC26XX_CM3_EXCEPTION_PEND_SV = -2, /**< 14 PendSV */ - CC13XX_CC26XX_CM3_EXCEPTION_SYS_TICK = -1, /**< 15 SysTick */ - - /* CC13xx/CC26xx interrupts */ - CC13XX_CC26XX_CM3_IRQ_EDGE_DETECT = 0, /**< 16 AON edge detect */ - CC13XX_CC26XX_CM3_EXCEPTION_I2C = 1, /**< 17 I2C */ - CC13XX_CC26XX_CM3_EXCEPTION_RF_CPE1 = 2, /**< 18 RF Command and Packet Engine 1 */ - CC13XX_CC26XX_CM3_EXCEPTION_AON_SPI_SLAVE = 3, /**< 19 AON SpiSplave Rx, Tx and CS */ - CC13XX_CC26XX_CM3_EXCEPTION_AON_RTC = 4, /**< 20 AON RTC */ - CC13XX_CC26XX_CM3_EXCEPTION_UART0 = 5, /**< 21 UART0 Rx and Tx */ - CC13XX_CC26XX_CM3_EXCEPTION_AON_AUX_SWEV0 = 6, /**< 22 Sensor Controller software event 0, through AON domain*/ - CC13XX_CC26XX_CM3_EXCEPTION_SSI0 = 7, /**< 23 SSI0 Rx and Tx */ - CC13XX_CC26XX_CM3_EXCEPTION_SSI1 = 8, /**< 24 SSI1 Rx and Tx */ - CC13XX_CC26XX_CM3_EXCEPTION_RF_CPE0 = 9, /**< 25 RF Command and Packet Engine 0 */ - CC13XX_CC26XX_CM3_EXCEPTION_RF_HW = 10, /**< 26 RF Core Hardware */ - CC13XX_CC26XX_CM3_EXCEPTION_RF_CMD_ACK = 11, /**< 27 RF Core Command Acknowledge */ - CC13XX_CC26XX_CM3_EXCEPTION_I2S = 12, /**< 28 I2S */ - CC13XX_CC26XX_CM3_EXCEPTION_AON_AUX_SWEV1 = 13, /**< 29 Sensor Controller software event 1, through AON domain*/ - CC13XX_CC26XX_CM3_EXCEPTION_WATCHDOG = 14, /**< 30 Watchdog timer */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_0A = 15, /**< 31 Timer 0 subtimer A */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_0B = 16, /**< 32 Timer 0 subtimer B */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_1A = 17, /**< 33 Timer 1 subtimer A */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_1B = 18, /**< 34 Timer 1 subtimer B */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_2A = 19, /**< 35 Timer 2 subtimer A */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_2B = 20, /**< 36 Timer 2 subtimer B */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_3A = 21, /**< 37 Timer 3 subtimer A */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_3B = 22, /**< 38 Timer 3 subtimer B */ - CC13XX_CC26XX_CM3_EXCEPTION_CRYPTO = 23, /**< 39 Crypto Core Result available */ - CC13XX_CC26XX_CM3_EXCEPTION_UDMA = 24, /**< 40 uDMA Software */ - CC13XX_CC26XX_CM3_EXCEPTION_UDMA_ERR = 25, /**< 41 uDMA Error */ - CC13XX_CC26XX_CM3_EXCEPTION_FLASH_CTRL = 26, /**< 42 Flash controller */ - CC13XX_CC26XX_CM3_EXCEPTION_SW0 = 27, /**< 43 Software Event 0 */ - CC13XX_CC26XX_CM3_EXCEPTION_AUX_COM_EVENT = 28, /**< 44 AUX combined event, directly to MCU domain*/ - CC13XX_CC26XX_CM3_EXCEPTION_AON_PRG0 = 29, /**< 45 AON programmable 0 */ - CC13XX_CC26XX_CM3_EXCEPTION_PROG = 30, /**< 46 Dynamic Programmable interrupt (default source: PRCM)*/ - CC13XX_CC26XX_CM3_EXCEPTION_AUX_COMPA = 31, /**< 47 AUX Comparator A */ - CC13XX_CC26XX_CM3_EXCEPTION_AUX_ADC = 32, /**< 48 AUX ADC IRQ */ - CC13XX_CC26XX_CM3_EXCEPTION_TRNG = 33, /**< 49 TRNG event */ -} cc13xx_cc26xx_cm3_irq_t; - -typedef cc13xx_cc26xx_cm3_irq_t IRQn_Type; - -#define SysTick_IRQn CC13XX_CC26XX_CM3_EXCEPTION_SYS_TICK -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Processor and Core Peripheral Section - * @{ - */ -/* Configuration of the Cortex-M3 Processor and Core Peripherals */ -#define __MPU_PRESENT 1 /**< MPU present or not */ -#define __NVIC_PRIO_BITS 3 /**< Number of Bits used for Priority Levels */ -#define __Vendor_SysTickConfig 0 /**< Set to 1 if different SysTick Config is used */ -/** @} */ -/*---------------------------------------------------------------------------*/ -#include "core_cm3.h" /* Cortex-M3 processor and core peripherals */ -/*---------------------------------------------------------------------------*/ -#endif /* CC13XX_CC26XX_CM3_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/cc13xx-cc26xx-conf.h b/arch/cpu/cc26x0-cc13x0/cc13xx-cc26xx-conf.h deleted file mode 100644 index 0b553fb90..000000000 --- a/arch/cpu/cc26x0-cc13x0/cc13xx-cc26xx-conf.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \file - * Header with configuration defines common to all CC13xx/CC26xx platforms - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC13XX_CC26XX_CONF_H_ -#define CC13XX_CC26XX_CONF_H_ -/*---------------------------------------------------------------------------*/ -/** - * \name Network Stack Configuration - * - * @{ - */ - -/* - * If set, the systems keeps the HF crystal oscillator on even when the radio is off. - * You need to set this to 1 to use TSCH with its default 2.2ms or larger guard time. - */ -#ifndef CC2650_FAST_RADIO_STARTUP -#define CC2650_FAST_RADIO_STARTUP (MAC_CONF_WITH_TSCH) -#endif - -/* Number of Prop Mode RX buffers */ -#ifndef PROP_MODE_CONF_RX_BUF_CNT -#define PROP_MODE_CONF_RX_BUF_CNT 4 -#endif - -/* - * Auto-configure Prop-mode radio if we are running on CC13xx, unless the - * project has specified otherwise. Depending on the final mode, determine a - * default channel (again, if unspecified) and configure RDC params - */ -#if CPU_FAMILY_CC13X0 -#ifndef CC13XX_CONF_PROP_MODE -#define CC13XX_CONF_PROP_MODE 1 -#endif /* CC13XX_CONF_PROP_MODE */ -#endif /* CPU_FAMILY_CC13X0 */ - -#if CC13XX_CONF_PROP_MODE -#ifndef NETSTACK_CONF_RADIO -#define NETSTACK_CONF_RADIO prop_mode_driver -#endif /* NETSTACK_CONF_RADIO */ - -/* Channels count from 0 upwards in IEEE 802.15.4g */ -#ifndef IEEE802154_CONF_DEFAULT_CHANNEL -#define IEEE802154_CONF_DEFAULT_CHANNEL 0 -#endif /* IEEE802154_CONF_DEFAULT_CHANNEL */ - -#ifndef CSMA_CONF_ACK_WAIT_TIME -#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 400) -#endif /* CSMA_CONF_ACK_WAIT_TIME */ - -#ifndef CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME -#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000) -#endif /* CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME */ - -#ifndef CSMA_CONF_SEND_SOFT_ACK -#define CSMA_CONF_SEND_SOFT_ACK 1 -#endif /* CSMA_CONF_SEND_SOFT_ACK */ - -#else /* CC13XX_CONF_PROP_MODE */ -#ifndef NETSTACK_CONF_RADIO -#define NETSTACK_CONF_RADIO ieee_mode_driver -#endif - -#define CSMA_CONF_SEND_SOFT_ACK 0 -#endif /* CC13XX_CONF_PROP_MODE */ - -#define NETSTACK_RADIO_MAX_PAYLOAD_LEN 125 - -/* Platform-specific (H/W) AES implementation */ -#ifndef AES_128_CONF -#define AES_128_CONF cc26xx_aes_128_driver -#endif /* AES_128_CONF */ - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name IEEE address configuration - * - * Used to generate our link-local & IPv6 address - * @{ - */ -/** - * \brief Location of the IEEE address - * 0 => Read from InfoPage, - * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS - */ -#ifndef IEEE_ADDR_CONF_HARDCODED -#define IEEE_ADDR_CONF_HARDCODED 0 -#endif - -/** - * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED - * is defined as 1 - */ -#ifndef IEEE_ADDR_CONF_ADDRESS -#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF } -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name RF configuration - * - * @{ - */ -/* RF Config */ - -#ifndef IEEE_MODE_CONF_AUTOACK -#define IEEE_MODE_CONF_AUTOACK 1 /**< RF H/W generates ACKs */ -#endif - -#ifndef IEEE_MODE_CONF_PROMISCOUS -#define IEEE_MODE_CONF_PROMISCOUS 0 /**< 1 to enable promiscous mode */ -#endif - -#ifndef RF_BLE_CONF_ENABLED -#define RF_BLE_CONF_ENABLED 0 /**< 0 to disable BLE support */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Character I/O Configuration - * - * @{ - */ -#ifndef CC26XX_UART_CONF_ENABLE -#define CC26XX_UART_CONF_ENABLE 1 /**< Enable/Disable UART I/O */ -#endif - -#ifndef CC26XX_UART_CONF_BAUD_RATE -#define CC26XX_UART_CONF_BAUD_RATE 115200 /**< Default UART0 baud rate */ -#endif - -/* Enable I/O over the Debugger Devpack - Only relevant for the SensorTag */ -#ifndef BOARD_CONF_DEBUGGER_DEVPACK -#define BOARD_CONF_DEBUGGER_DEVPACK 1 -#endif - -#ifndef SLIP_ARCH_CONF_ENABLED -/* - * Determine whether we need SLIP - * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT - * keep using SLIP - */ -#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT) -#define SLIP_ARCH_CONF_ENABLED 1 -#endif -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name JTAG interface configuration - * - * Enable/Disable the JTAG DAP and TAP interfaces on the chip. - * Setting this to 0 will disable access to the debug interface - * to secure deployed images. - * @{ - */ -#ifndef CCXXWARE_CONF_JTAG_INTERFACE_ENABLE -#define CCXXWARE_CONF_JTAG_INTERFACE_ENABLE 1 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ROM Bootloader configuration - * - * Enable/Disable the ROM bootloader in your image, if the board supports it. - * Look in board.h to choose the DIO and corresponding level that will cause - * the chip to enter bootloader mode. - * @{ - */ - -/* Backward compatibility */ -#ifdef ROM_BOOTLOADER_ENABLE -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE ROM_BOOTLOADER_ENABLE -#endif - -#ifndef CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* CC13XX_CC26XX_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/cc13xx-cc26xx-def.h b/arch/cpu/cc26x0-cc13x0/cc13xx-cc26xx-def.h deleted file mode 100644 index 97b188e15..000000000 --- a/arch/cpu/cc26x0-cc13x0/cc13xx-cc26xx-def.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 CC13XX_CC26XX_DEF_H_ -#define CC13XX_CC26XX_DEF_H_ -/*---------------------------------------------------------------------------*/ -#include "cm3/cm3-def.h" -/*---------------------------------------------------------------------------*/ -/* TSCH related defines */ - -/* 2 bytes header, 4 bytes CRC */ -#define CC13XX_RADIO_PHY_OVERHEAD 6 -/* 3 bytes preamble, 3 bytes sync */ -#define CC13XX_RADIO_PHY_HEADER_LEN 6 -/* The default data rate is 50 kbps */ -#define CC13XX_RADIO_BIT_RATE 50000 - -/* 1 len byte, 2 bytes CRC */ -#define CC26XX_RADIO_PHY_OVERHEAD 3 -/* 4 bytes preamble, 1 byte sync */ -#define CC26XX_RADIO_PHY_HEADER_LEN 5 -/* The fixed data rate is 250 kbps */ -#define CC26XX_RADIO_BIT_RATE 250000 - -#if CPU_FAMILY_CC13XX -#define RADIO_PHY_HEADER_LEN CC13XX_RADIO_PHY_HEADER_LEN -#define RADIO_PHY_OVERHEAD CC13XX_RADIO_PHY_OVERHEAD -#define RADIO_BIT_RATE CC13XX_RADIO_BIT_RATE - -/* The TSCH default slot length of 10ms is too short, use custom one instead */ -#ifndef TSCH_CONF_DEFAULT_TIMESLOT_TIMING -#define TSCH_CONF_DEFAULT_TIMESLOT_TIMING tsch_timing_cc13xx_50kbps -#endif /* TSCH_CONF_DEFAULT_TIMESLOT_TIMING */ - -/* Symbol for the custom TSCH timeslot timing template */ -#define TSCH_CONF_ARCH_HDR_PATH "rf-core/cc13xx-50kbps-tsch.h" - -#else -#define RADIO_PHY_HEADER_LEN CC26XX_RADIO_PHY_HEADER_LEN -#define RADIO_PHY_OVERHEAD CC26XX_RADIO_PHY_OVERHEAD -#define RADIO_BIT_RATE CC26XX_RADIO_BIT_RATE -#endif - -#define RADIO_BYTE_AIR_TIME (1000000 / (RADIO_BIT_RATE / 8)) - -/* Delay between GO signal and SFD */ -#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(RADIO_PHY_HEADER_LEN * RADIO_BYTE_AIR_TIME)) -/* Delay between GO signal and start listening. - * This value is so small because the radio is constantly on within each timeslot. */ -#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(15)) -/* Delay between the SFD finishes arriving and it is detected in software. */ -#define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(352)) - -/* Timer conversion; radio is running at 4 MHz */ -#define RADIO_TIMER_SECOND 4000000u -#if (RTIMER_SECOND % 256) || (RADIO_TIMER_SECOND % 256) -#error RADIO_TO_RTIMER macro must be fixed! -#endif -#define RADIO_TO_RTIMER(X) ((uint32_t)(((uint64_t)(X) * (RTIMER_SECOND / 256)) / (RADIO_TIMER_SECOND / 256))) -#define USEC_TO_RADIO(X) ((X) * 4) - -/* Do not turn off TSCH within a timeslot: not enough time */ -#define TSCH_CONF_RADIO_ON_DURING_TIMESLOT 1 - -/* Disable TSCH frame filtering */ -#define TSCH_CONF_HW_FRAME_FILTERING 0 - -/* Use hardware timestamps */ -#ifndef TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS -#define TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS 1 -#define TSCH_CONF_TIMESYNC_REMOVE_JITTER 0 -#endif - -#ifndef TSCH_CONF_BASE_DRIFT_PPM -/* The drift compared to "true" 10ms slots. - * Enable adaptive sync to enable compensation for this. - * Slot length 10000 usec - * 328 ticks - * Tick duration 30.517578125 usec - * Real slot duration 10009.765625 usec - * Target - real duration = -9.765625 usec - * TSCH_CONF_BASE_DRIFT_PPM -977 - */ -#define TSCH_CONF_BASE_DRIFT_PPM -977 -#endif - -/* 10 times per second */ -#ifndef TSCH_CONF_CHANNEL_SCAN_DURATION -#define TSCH_CONF_CHANNEL_SCAN_DURATION (CLOCK_SECOND / 10) -#endif - -/* Increase this from the default 100 to improve TSCH association speed on this platform */ -#ifndef TSCH_CONF_ASSOCIATION_POLL_FREQUENCY -#define TSCH_CONF_ASSOCIATION_POLL_FREQUENCY 1000 -#endif - -/* Slightly reduce the TSCH guard time (from 2200 usec to 1800 usec) to make sure - * the CC26xx radio has sufficient time to start up. */ -#ifndef TSCH_CONF_RX_WAIT -#define TSCH_CONF_RX_WAIT 1800 -#endif -/*---------------------------------------------------------------------------*/ -#define RTIMER_ARCH_SECOND 65536 -/*---------------------------------------------------------------------------*/ -/* Path to CMSIS header */ -#define CMSIS_CONF_HEADER_PATH "cc13x0-cc26x0-cm3.h" - -/* Path to headers with implementation of mutexes and memory barriers */ -#define MUTEX_CONF_ARCH_HEADER_PATH "mutex-cortex.h" -#define MEMORY_BARRIER_CONF_ARCH_HEADER_PATH "memory-barrier-cortex.h" - -#define GPIO_HAL_CONF_ARCH_HDR_PATH "dev/gpio-hal-arch.h" -/*---------------------------------------------------------------------------*/ -#define GPIO_HAL_CONF_ARCH_SW_TOGGLE 0 -/*---------------------------------------------------------------------------*/ -#define SPI_CONF_CONTROLLER_COUNT 2 -/*---------------------------------------------------------------------------*/ -#endif /* CC13XX_CC26XX_DEF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc26x0-cc13x0/cc26xx.ld b/arch/cpu/cc26x0-cc13x0/cc26xx.ld deleted file mode 100644 index 4ea422558..000000000 --- a/arch/cpu/cc26x0-cc13x0/cc26xx.ld +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ - -/* CC26XX linker script */ - -/* Entry Point */ -ENTRY(ResetISR) - -MEMORY -{ - /* Flash Size 128 KB minus the CCA area below (88 bytes) */ - FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x0001FFA8 - - /* - * Customer Configuration Area and Bootloader Backdoor configuration - * in flash, up to 88 bytes - */ - FLASH_CCFG (RX) : ORIGIN = 0x0001FFA8, LENGTH = 88 - - /* RAM Size 20KB */ - SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00005000 - - /* Application can use GPRAM region as RAM if cache is disabled in CCFG */ - GPRAM (RWX) : ORIGIN = 0x11000000, LENGTH = 0x00002000 -} - -/*. Highest address of the stack. Used in startup file .*/ -_estack = ORIGIN(SRAM) + LENGTH(SRAM); /* End of SRAM */ - -/*. Generate a link error if heap and stack don’t fit into RAM .*/ -_Min_Heap_Size = 0; -_Min_Stack_Size = 0x400; - -SECTIONS -{ - .text : - { - _text = .; - KEEP(*(.vectors)) - *(.text*) - *(.rodata*) - _etext = .; - } > FLASH = 0 - - .data : - { - _data = .; - *(vtable) - *(.data*) - _edata = .; - } > SRAM AT > FLASH - _ldata = LOADADDR(.data); - - .ARM.exidx : - { - *(.ARM.exidx*) - } > FLASH - - .bss : - { - _bss = .; - *(.bss*) - *(COMMON) - _ebss = .; - } > SRAM - - _end = .; /* End of the .bss segment. */ - - /* These symbols are used by the stack check library. */ - _stack = .; - _stack_origin = ORIGIN(SRAM) + LENGTH(SRAM); - _heap = _stack; - _eheap = _stack_origin; - - .ccfg : - { - KEEP(*(.ccfg)) - } > FLASH_CCFG - - /* User_heap_stack section, used to check that there is enough RAM left */ - ._user_heap_stack : - { - . = ALIGN(4); - . = . + _Min_Heap_Size; - . = . + _Min_Stack_Size; - . = ALIGN(4); - } > SRAM - - .gpram : - { - } > GPRAM - -} diff --git a/arch/cpu/cc26x0-cc13x0/ccxxware-conf.h b/arch/cpu/cc26x0-cc13x0/ccxxware-conf.h deleted file mode 100644 index c101deb08..000000000 --- a/arch/cpu/cc26x0-cc13x0/ccxxware-conf.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2017, Alex Stanoev - * 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. - */ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-ccxxware-conf CCxxware-specific configuration - * - * @{ - * - * \file - * CCxxware-specific configuration for the cc26x0-cc13x0 CPU family - */ -#ifndef CCXXWARE_CONF_H_ -#define CCXXWARE_CONF_H_ - -#include "contiki-conf.h" - -/*---------------------------------------------------------------------------*/ -/** - * \brief JTAG interface configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#if CCXXWARE_CONF_JTAG_INTERFACE_ENABLE -#define SET_CCFG_CCFG_TI_OPTIONS_TI_FA_ENABLE 0xC5 -#define SET_CCFG_CCFG_TAP_DAP_0_CPU_DAP_ENABLE 0xC5 -#define SET_CCFG_CCFG_TAP_DAP_0_PRCM_TAP_ENABLE 0xC5 -#define SET_CCFG_CCFG_TAP_DAP_0_TEST_TAP_ENABLE 0xC5 -#define SET_CCFG_CCFG_TAP_DAP_1_PBIST2_TAP_ENABLE 0xC5 -#define SET_CCFG_CCFG_TAP_DAP_1_PBIST1_TAP_ENABLE 0xC5 -#define SET_CCFG_CCFG_TAP_DAP_1_WUC_TAP_ENABLE 0xC5 -#else -#define SET_CCFG_CCFG_TI_OPTIONS_TI_FA_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_0_CPU_DAP_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_0_PRCM_TAP_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_0_TEST_TAP_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_1_PBIST2_TAP_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_1_PBIST1_TAP_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_1_WUC_TAP_ENABLE 0x00 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief ROM bootloader configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#if CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 -#define SET_CCFG_BL_CONFIG_BL_LEVEL CCXXWARE_CONF_BL_LEVEL -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER CCXXWARE_CONF_BL_PIN_NUMBER -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 -#else -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0x00 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x01 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER IOID_UNUSED -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xFF -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* CCXXWARE_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/clock.c b/arch/cpu/cc26x0-cc13x0/clock.c deleted file mode 100644 index 172d1c3fd..000000000 --- a/arch/cpu/cc26x0-cc13x0/clock.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-clocks - * @{ - * - * \defgroup cc26xx-software-clock Software Clock - * - * Implementation of the clock module for the CC26xx and CC13xx. - * - * The software clock uses the facilities provided by the AON RTC driver - * @{ - * - * \file - * Software clock implementation for the TI CC13xx/CC26xx - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include "ti-lib.h" -/*---------------------------------------------------------------------------*/ -static volatile uint64_t count; -/*---------------------------------------------------------------------------*/ -static void -power_domain_on(void) -{ - ti_lib_prcm_power_domain_on(PRCM_DOMAIN_PERIPH); - while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) != - PRCM_DOMAIN_POWER_ON); -} -/*---------------------------------------------------------------------------*/ -void -clock_init(void) -{ - count = 0; - - /* - * Here, we configure GPT0 Timer A, which we subsequently use in - * clock_delay_usec - * - * We need to access registers, so firstly power up the PD and then enable - * the clock to GPT0. - */ - if(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) != - PRCM_DOMAIN_POWER_ON) { - power_domain_on(); - } - - ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_TIMER0); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - /* Disable both GPT0 timers */ - HWREG(GPT0_BASE + GPT_O_CTL) &= ~(GPT_CTL_TAEN | GPT_CTL_TBEN); - - /* - * We assume that the clock is running at 48MHz, we use GPT0 Timer A, - * one-shot, countdown, prescaled by 48 gives us 1 tick per usec - */ - ti_lib_timer_configure(GPT0_BASE, - TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_ONE_SHOT); - - /* Global config: split pair (2 x 16-bit wide) */ - HWREG(GPT0_BASE + GPT_O_CFG) = TIMER_CFG_SPLIT_PAIR >> 24; - - /* - * Pre-scale value 47 pre-scales by 48 - * - * ToDo: The theoretical value here should be 47 (to provide x48 prescale) - * However, 49 seems to give results much closer to the desired delay - */ - ti_lib_timer_prescale_set(GPT0_BASE, TIMER_B, 49); - - /* GPT0 / Timer B: One shot, PWM interrupt enable */ - HWREG(GPT0_BASE + GPT_O_TBMR) = - ((TIMER_CFG_B_ONE_SHOT >> 8) & 0xFF) | GPT_TBMR_TBPWMIE; - - /* enable sync with radio timer */ - HWREGBITW(AON_RTC_BASE + AON_RTC_O_CTL, AON_RTC_CTL_RTC_UPD_EN_BITN) = 1; -} -/*---------------------------------------------------------------------------*/ -static void -update_clock_variable(void) -{ - uint32_t aon_rtc_secs_now; - uint32_t aon_rtc_secs_now2; - uint16_t aon_rtc_ticks_now; - - do { - aon_rtc_secs_now = HWREG(AON_RTC_BASE + AON_RTC_O_SEC); - aon_rtc_ticks_now = HWREG(AON_RTC_BASE + AON_RTC_O_SUBSEC) >> 16; - aon_rtc_secs_now2 = HWREG(AON_RTC_BASE + AON_RTC_O_SEC); - } while(aon_rtc_secs_now != aon_rtc_secs_now2); - - /* Convert AON RTC ticks to clock tick counter */ - count = (aon_rtc_secs_now * CLOCK_SECOND) + (aon_rtc_ticks_now >> 9); -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - update_clock_variable(); - - return (clock_time_t)(count & 0xFFFFFFFF); -} -/*---------------------------------------------------------------------------*/ -void -clock_update(void) -{ - update_clock_variable(); - - if(etimer_pending()) { - etimer_request_poll(); - } -} -/*---------------------------------------------------------------------------*/ -unsigned long -clock_seconds(void) -{ - bool interrupts_disabled; - uint32_t secs_now; - - interrupts_disabled = ti_lib_int_master_disable(); - - secs_now = ti_lib_aon_rtc_sec_get(); - - /* Re-enable interrupts */ - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } - - return (unsigned long)secs_now; -} -/*---------------------------------------------------------------------------*/ -void -clock_wait(clock_time_t i) -{ - clock_time_t start; - - start = clock_time(); - while(clock_time() - start < (clock_time_t)i); -} -/*---------------------------------------------------------------------------*/ -void -clock_delay_usec(uint16_t len) -{ - uint32_t clock_status; - - if(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) != - PRCM_DOMAIN_POWER_ON) { - power_domain_on(); - } - - clock_status = HWREG(PRCM_BASE + PRCM_O_GPTCLKGR) & PRCM_GPIOCLKGR_CLK_EN; - - ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_TIMER0); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - ti_lib_timer_load_set(GPT0_BASE, TIMER_B, len); - ti_lib_timer_enable(GPT0_BASE, TIMER_B); - - /* - * Wait for TBEN to clear. CC26xxware does not provide us with a convenient - * function, hence the direct register access here - */ - while(HWREG(GPT0_BASE + GPT_O_CTL) & GPT_CTL_TBEN); - - if(clock_status == 0) { - ti_lib_prcm_peripheral_run_disable(PRCM_PERIPH_TIMER0); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Obsolete delay function but we implement it here since some code - * still uses it - */ -void -clock_delay(unsigned int i) -{ - clock_delay_usec(i); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dbg.c b/arch/cpu/cc26x0-cc13x0/dbg.c deleted file mode 100644 index bf03aade4..000000000 --- a/arch/cpu/cc26x0-cc13x0/dbg.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 "cc26xx-uart.h" -#include "ti-lib.h" - -#include -/*---------------------------------------------------------------------------*/ -int -dbg_putchar(int c) -{ - cc26xx_uart_write_byte(c); - return c; -} -/*---------------------------------------------------------------------------*/ -unsigned int -dbg_send_bytes(const unsigned char *s, unsigned int len) -{ - unsigned int i = 0; - - while(s && *s != 0) { - if(i >= len) { - break; - } - cc26xx_uart_write_byte(*s++); - i++; - } - - /* - * Wait for the buffer to go out. This is to prevent garbage when used - * between UART on/off cycles - */ - while(cc26xx_uart_busy() == UART_BUSY); - - return i; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc26x0-cc13x0/dev/adc-sensor.c b/arch/cpu/cc26x0-cc13x0/dev/adc-sensor.c deleted file mode 100644 index c88b2e5fe..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/adc-sensor.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-adc-sensor - * @{ - * - * \file - * Driver for the CC13xx/CC26xx ADC - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/adc-sensor.h" -#include "sys/timer.h" -#include "lpm.h" - -#include "ti-lib.h" -#include "driverlib/aux_adc.h" -#include "aux-ctrl.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -static uint8_t channel = ADC_COMPB_IN_AUXIO0; -static bool is_active = false; - -static aux_consumer_module_t adc_aux = { - .clocks = AUX_WUC_ADI_CLOCK | AUX_WUC_ANAIF_CLOCK | AUX_WUC_SMPH_CLOCK -}; -/*---------------------------------------------------------------------------*/ -static int -config(int type, int c) -{ - switch(type) { - case SENSORS_ACTIVE: - is_active = c; - - if(is_active) { - /* Request AUX access, with ADI and SMPH clocks */ - aux_ctrl_register_consumer(&adc_aux); - - ti_lib_aux_adc_select_input(channel); - } else { - aux_ctrl_unregister_consumer(&adc_aux); - } - break; - - case ADC_SENSOR_SET_CHANNEL: - channel = c; - if(is_active) { - ti_lib_aux_adc_select_input(channel); - } - break; - - default: - break; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - if(is_active) { - return 1; - } - break; - default: - break; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - if(type == ADC_SENSOR_VALUE) { - int val, adj_val, adj_mv; - - if(!is_active) { - puts("ADC not active"); - return 0; - } - - ti_lib_aux_adc_enable_sync(AUXADC_REF_FIXED, AUXADC_SAMPLE_TIME_2P7_US, - AUXADC_TRIGGER_MANUAL); - - ti_lib_aux_adc_gen_manual_trigger(); - val = ti_lib_aux_adc_read_fifo(); - adj_val = ti_lib_aux_adc_adjust_value_for_gain_and_offset( - val, - ti_lib_aux_adc_get_adjustment_gain(AUXADC_REF_FIXED), - ti_lib_aux_adc_get_adjustment_offset(AUXADC_REF_FIXED)); - adj_mv = ti_lib_aux_adc_value_to_microvolts(AUXADC_FIXED_REF_VOLTAGE_NORMAL, adj_val); - ti_lib_aux_adc_disable(); - - return adj_mv; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(adc_sensor, ADC_SENSOR, value, config, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/adc-sensor.h b/arch/cpu/cc26x0-cc13x0/dev/adc-sensor.h deleted file mode 100644 index fd8f71537..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/adc-sensor.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-adc-sensor CC13xx/CC26xx ADC Sensor - * @{ - * - * \file - * Header file for the CC13xx/CC26xx ADC driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef ADC_SENSOR_H_ -#define ADC_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define ADC_SENSOR "ADC" -/*---------------------------------------------------------------------------*/ -#define ADC_SENSOR_VALUE 0 -/*---------------------------------------------------------------------------*/ -/* configuration commands */ -#define ADC_SENSOR_SET_CHANNEL 1 /* takes ADC_COMPB_IN_AUXIxx as parameter */ -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor adc_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* ADC_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/aux-ctrl.c b/arch/cpu/cc26x0-cc13x0/dev/aux-ctrl.c deleted file mode 100644 index 48d2da460..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/aux-ctrl.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bris.ac.uk/ - * 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 "contiki.h" -#include "dev/aux-ctrl.h" -#include "lib/list.h" - -#include "ti-lib.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -LIST(consumers_list); -/*---------------------------------------------------------------------------*/ -void -aux_ctrl_register_consumer(aux_consumer_module_t *consumer) -{ - bool interrupts_disabled = ti_lib_int_master_disable(); - - list_add(consumers_list, consumer); - - aux_ctrl_power_up(); - - ti_lib_aux_wuc_clock_enable(consumer->clocks); - while(ti_lib_aux_wuc_clock_status(consumer->clocks) != AUX_WUC_CLOCK_READY); - - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } -} -/*---------------------------------------------------------------------------*/ -void -aux_ctrl_unregister_consumer(aux_consumer_module_t *consumer) -{ - bool interrupts_disabled = ti_lib_int_master_disable(); - - list_remove(consumers_list, consumer); - - aux_ctrl_power_down(false); - - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } -} -/*---------------------------------------------------------------------------*/ -void -aux_ctrl_power_up() -{ - /* Don't if we have no consumers */ - if(list_head(consumers_list) == NULL) { - return; - } - - ti_lib_aon_wuc_aux_wakeup_event(AONWUC_AUX_WAKEUP); - while(!(ti_lib_aon_wuc_power_status_get() & AONWUC_AUX_POWER_ON)); -} -/*---------------------------------------------------------------------------*/ -void -aux_ctrl_power_down(bool force) -{ - aux_consumer_module_t *consumer; - uint32_t clocks_in_use = 0; - - if(!force) { - /* Visit all modules and release clocks */ - for(consumer = list_head(consumers_list); consumer != NULL; - consumer = consumer->next) { - clocks_in_use |= consumer->clocks; - } - - /* If any clocks are still in use, AUX needs to stay powered and clocked */ - if(clocks_in_use) { - ti_lib_aon_wuc_aux_power_down_config(AONWUC_CLOCK_SRC_LF); - return; - } - } - - /* No clock for AUX in power down */ - ti_lib_aon_wuc_aux_power_down_config(AONWUC_NO_CLOCK); - - /* Disable retention */ - ti_lib_aon_wuc_aux_sram_config(false); - - /* Turn off AUX */ - ti_lib_aon_wuc_aux_wakeup_event(AONWUC_AUX_ALLOW_SLEEP); - ti_lib_aux_wuc_power_ctrl(AUX_WUC_POWER_OFF); - while(ti_lib_aon_wuc_power_status_get() & AONWUC_AUX_POWER_ON); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc26x0-cc13x0/dev/aux-ctrl.h b/arch/cpu/cc26x0-cc13x0/dev/aux-ctrl.h deleted file mode 100644 index 8e65a7844..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/aux-ctrl.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bris.ac.uk/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-aux-ctrl CC13xx/CC26xx AUX domain controller - * - * CC13xx/CC26xx AUX domain power management controller - * - * @{ - * - * \file - * Header file for the management of the CC13xx/CC26xx AUX domain - */ -/*---------------------------------------------------------------------------*/ -#ifndef AUX_CTRL_H_ -#define AUX_CTRL_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include "ti-lib.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief The data structure to be used for modules that require access to AUX - * - * The clocks field should specify the clocks (within AUX) that your module - * requires in order to perform its functionality. Those clocks are an ORd - * value of AUX_WUC_xxxx_CLOCK. For instance, the oscillators module specifies - * AUX_WUC_OSCCTRL_CLOCK | AUX_WUC_SMPH_CLOCK - */ -typedef struct aux_consumer_module { - struct aux_consumer_module *next; - uint32_t clocks; -} aux_consumer_module_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Register a module that no longer requires access to the AUX power domain - * \param consumer A pointer to the data structure of your AUX consumer - * - * Call this function if you are developing a module that requires access to - * hardware within the AUX PD. Calling this function will achieve a number of - * things: - * - * - It will power up the AUX PD - * - It will enable the AUX clocks that you require - * - * If you call this function, AUX will stay powered-on and clocked during deep - * sleep, and retention will be enabled (so that you can e.g. use the sensor - * controller to monitor peripherals while the main MCU in deep sleep). If you - * do not need AUX enabled during deep sleep, you must release it by calling - * aux_ctrl_unregister_consumer() - * - * \sa aux_ctrl_unregister_consumer - */ -void aux_ctrl_register_consumer(aux_consumer_module_t *consumer); - -/** - * \brief Deregister a module that no longer requires access to the AUX power domain - * \param consumer A pointer to the data structure of your AUX consumer - * - * When your module is finished using features provided from within the AUX - * domain, you should call this function to signal that AUX is no longer - * required, so that the LPM module can power it down in deep sleep. If there - * are no more registered consumers left, this function will also power down - * AUX. - * - * \sa aux_ctrl_register_consumer - * \sa aux_ctrl_power_down - */ -void aux_ctrl_unregister_consumer(aux_consumer_module_t *consumer); - -/** - * \brief Power-up the AUX power domain - * - * This function will power up the AUX power-domain, but only if there are - * registered consumers for it. If there are not, the PD will stay off. - * - * This function will automatically get called by the LPM module whenever the - * chip comes out of deep sleep. - * - * User applications will normally not need to call this function. if you are - * developing a user application that requires access, to AUX, you should - * normally call aux_ctrl_register_consumer(), which will automatically power - * up AUX for you, if it's not already powered. - */ -void aux_ctrl_power_up(void); - -/** - * \brief Power down the AUX power domain - * \param force Force the power down irrespective of registered consumers - * - * This function will shut down the AUX power-domain. - * - * The shutdown is unconditional if force is true. If force is false and there - * are registered consumers, the power-down will be suppressed. - * - * This function will automatically get called by the LPM module whenever the - * chip tries to enter deep sleep or shuts down. - * - * User applications will normally not need to call this function. if you are - * developing a user application that no longer requires access, to AUX, you - * should normally simply release it by calling aux_ctrl_unregister_consumer(). - * If no other consumers are using AUX, then the lpm module will shut it down. - */ -void aux_ctrl_power_down(bool force); -/*---------------------------------------------------------------------------*/ -#endif /* AUX_CTRL_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/batmon-sensor.c b/arch/cpu/cc26x0-cc13x0/dev/batmon-sensor.c deleted file mode 100644 index 423a9fbcc..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/batmon-sensor.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-batmon - * @{ - * - * \file - * Driver for the CC13xx/CC26xx AON battery monitor - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "batmon-sensor.h" - -#include "ti-lib.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define SENSOR_STATUS_DISABLED 0 -#define SENSOR_STATUS_ENABLED 1 - -static int enabled = SENSOR_STATUS_DISABLED; -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor - * \param type BATMON_SENSOR_TYPE_TEMP or BATMON_SENSOR_TYPE_VOLT - * - * \return The value as returned by the respective CC26xxware function - */ -static int -value(int type) -{ - if(enabled == SENSOR_STATUS_DISABLED) { - PRINTF("Sensor Disabled\n"); - return 0; - } - - if(type == BATMON_SENSOR_TYPE_TEMP) { - return (int)ti_lib_aon_batmon_temperature_get_deg_c(); - } else if(type == BATMON_SENSOR_TYPE_VOLT) { - return (int)ti_lib_aon_batmon_battery_voltage_get(); - } else { - PRINTF("Invalid type\n"); - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the battery monitor sensor. - * - * \param type Activate, enable or disable the sensor. See below - * \param enable If - * - * When type == SENSORS_HW_INIT we turn on the hardware - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor - */ -static int -configure(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - ti_lib_aon_batmon_enable(); - enabled = SENSOR_STATUS_ENABLED; - break; - case SENSORS_ACTIVE: - if(enable) { - ti_lib_aon_batmon_enable(); - enabled = SENSOR_STATUS_ENABLED; - } else { - ti_lib_aon_batmon_disable(); - enabled = SENSOR_STATUS_DISABLED; - } - break; - default: - break; - } - return enabled; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor - * \param type SENSORS_ACTIVE or SENSORS_READY - * \return 1 if the sensor is enabled - */ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - break; - default: - break; - } - return SENSOR_STATUS_DISABLED; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(batmon_sensor, "Battery Monitor", value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/batmon-sensor.h b/arch/cpu/cc26x0-cc13x0/dev/batmon-sensor.h deleted file mode 100644 index cde7abc8e..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/batmon-sensor.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-batmon CC13xx/CC26xx BatMon sensor driver - * - * Driver for the on-chip battery voltage and chip temperature sensor. - * @{ - * - * \file - * Header file for the CC13xx/CC26xx battery monitor - */ -/*---------------------------------------------------------------------------*/ -#ifndef BATMON_SENSOR_H_ -#define BATMON_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define BATMON_SENSOR_TYPE_TEMP 1 -#define BATMON_SENSOR_TYPE_VOLT 2 -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor batmon_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* BATMON_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/cc26xx-aes.c b/arch/cpu/cc26x0-cc13x0/dev/cc26xx-aes.c deleted file mode 100755 index cacdfc61f..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/cc26xx-aes.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bristol.ac.uk - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc26xx-aes - * @{ - * - * \file - * Implementation of the AES driver for the CC26x0/CC13x0 SoC - * \author - * Atis Elsts - */ -#include "contiki.h" -#include "dev/cc26xx-aes.h" -#include "ti-lib.h" -/*---------------------------------------------------------------------------*/ -#include "sys/log.h" -#define LOG_MODULE "cc26xx-aes" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -static uint32_t skey[AES_128_KEY_LENGTH / sizeof(uint32_t)]; - -/*---------------------------------------------------------------------------*/ -void -cc26xx_aes_set_key(const uint8_t *key) -{ - memcpy(skey, key, AES_128_KEY_LENGTH); -} -/*---------------------------------------------------------------------------*/ -static void -encrypt_decrypt(uint8_t *plaintext_and_result, bool do_encrypt) -{ - uint32_t result[AES_128_BLOCK_SIZE / sizeof(uint32_t)]; - unsigned status; - int i; - - /* First, make sure the PERIPH PD is on */ - ti_lib_prcm_power_domain_on(PRCM_DOMAIN_PERIPH); - while((ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) - != PRCM_DOMAIN_POWER_ON)); - - /* Enable CRYPTO peripheral */ - ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_CRYPTO); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - status = ti_lib_crypto_aes_load_key(skey, CRYPTO_KEY_AREA_0); - if(status != AES_SUCCESS) { - LOG_WARN("load key failed: %u\n", status); - } else { - - status = ti_lib_crypto_aes_ecb((uint32_t *)plaintext_and_result, result, CRYPTO_KEY_AREA_0, do_encrypt, false); - if(status != AES_SUCCESS) { - LOG_WARN("ecb failed: %u\n", status); - } else { - - for(i = 0; i < 100; ++i) { - ti_lib_cpu_delay(10); - status = ti_lib_crypto_aes_ecb_status(); - if(status != AES_DMA_BSY) { - break; - } - } - - ti_lib_crypto_aes_ecb_finish(); - - if(status != AES_SUCCESS) { - LOG_WARN("ecb get result failed: %u\n", status); - } - } - } - - ti_lib_prcm_peripheral_run_disable(PRCM_PERIPH_CRYPTO); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - if(status == AES_SUCCESS) { - memcpy(plaintext_and_result, result, AES_128_BLOCK_SIZE); - } else { - /* corrupt the result */ - plaintext_and_result[0] ^= 1; - } -} -/*---------------------------------------------------------------------------*/ -void -cc26xx_aes_encrypt(uint8_t *plaintext_and_result) -{ - encrypt_decrypt(plaintext_and_result, true); -} -/*---------------------------------------------------------------------------*/ -void -cc26xx_aes_decrypt(uint8_t *cyphertext_and_result) -{ - encrypt_decrypt(cyphertext_and_result, false); -} -/*---------------------------------------------------------------------------*/ -const struct aes_128_driver cc26xx_aes_128_driver = { - cc26xx_aes_set_key, - cc26xx_aes_encrypt -}; - -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/cc26xx-aes.h b/arch/cpu/cc26x0-cc13x0/dev/cc26xx-aes.h deleted file mode 100755 index a979cc562..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/cc26xx-aes.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bristol.ac.uk - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-aes CC26x0/CC13x0 AES-128 - * - * AES-128 driver for the CC26x0/CC13x0 SoC - * @{ - * - * \file - * Header file of the AES-128 driver for the CC26xx SoC - * \author - * Atis Elsts - */ -#ifndef CC2538_AES_H_ -#define CC2538_AES_H_ - -#include "lib/aes-128.h" - -/** - * \brief Set a key to use in subsequent encryption & decryption operations. - * \param key The key to use - * - * The size of the key must be AES_128_KEY_LENGTH. - */ -void cc26xx_aes_set_key(const uint8_t *key); - -/** - * \brief Encrypt a message using the SoC AES-128 hardware implementation - * \param plaintext_and_result In: message to encrypt, out: the encrypted message. - * - * The size of the message must be AES_128_BLOCK_SIZE. - * The key to use in the encryption must be set before calling this function. - */ -void cc26xx_aes_encrypt(uint8_t *plaintext_and_result); - -/** - * \brief Decrypt a message using the SoC AES-128 hardware implementation - * \param cyphertext_and_result In: message to decrypt, out: the decrypted message. - * - * The size of the message must be AES_128_BLOCK_SIZE. - * The key to use in the decryption must be set before calling this function. - */ -void cc26xx_aes_decrypt(uint8_t *cyphertext_and_result); - -extern const struct aes_128_driver cc26xx_aes_128_driver; - -#endif /* CC2538_AES_H_ */ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/cc26xx-uart.c b/arch/cpu/cc26x0-cc13x0/dev/cc26xx-uart.c deleted file mode 100644 index d466e9293..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/cc26xx-uart.c +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-uart - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx UART driver. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cc26xx-uart.h" -#include "hw_types.h" -#include "hw_memmap.h" -#include "sys_ctrl.h" -#include "prcm.h" -#include "ioc.h" -#include "uart.h" -#include "lpm.h" -#include "ti-lib.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Which events to trigger a UART interrupt */ -#define CC26XX_UART_RX_INTERRUPT_TRIGGERS (UART_INT_RX | UART_INT_RT) - -/* All interrupt masks */ -#define CC26XX_UART_INTERRUPT_ALL (UART_INT_OE | UART_INT_BE | UART_INT_PE | \ - UART_INT_FE | UART_INT_RT | UART_INT_TX | \ - UART_INT_RX | UART_INT_CTS) -/*---------------------------------------------------------------------------*/ -#define cc26xx_uart_isr UART0IntHandler -/*---------------------------------------------------------------------------*/ -static int (*input_handler)(unsigned char c); -/*---------------------------------------------------------------------------*/ -static bool -usable(void) -{ - if(BOARD_IOID_UART_RX == IOID_UNUSED || - BOARD_IOID_UART_TX == IOID_UNUSED || - CC26XX_UART_CONF_ENABLE == 0) { - return false; - } - - return true; -} -/*---------------------------------------------------------------------------*/ -static void -power_and_clock(void) -{ - /* Power on the SERIAL PD */ - ti_lib_prcm_power_domain_on(PRCM_DOMAIN_SERIAL); - while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_SERIAL) - != PRCM_DOMAIN_POWER_ON); - - /* Enable UART clock in active mode */ - ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_UART0); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); -} -/*---------------------------------------------------------------------------*/ -/* - * Returns 0 if either the SERIAL PD is off, or the PD is on but the run mode - * clock is gated. If this function would return 0, accessing UART registers - * will return a precise bus fault. If this function returns 1, it is safe to - * access UART registers. - * - * This function only checks the 'run mode' clock gate, since it can only ever - * be called with the MCU in run mode. - */ -static bool -accessible(void) -{ - /* First, check the PD */ - if(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_SERIAL) - != PRCM_DOMAIN_POWER_ON) { - return false; - } - - /* Then check the 'run mode' clock gate */ - if(!(HWREG(PRCM_BASE + PRCM_O_UARTCLKGR) & PRCM_UARTCLKGR_CLK_EN)) { - return false; - } - - return true; -} -/*---------------------------------------------------------------------------*/ -static void -disable_interrupts(void) -{ - /* Acknowledge UART interrupts */ - ti_lib_int_disable(INT_UART0_COMB); - - /* Disable all UART module interrupts */ - ti_lib_uart_int_disable(UART0_BASE, CC26XX_UART_INTERRUPT_ALL); - - /* Clear all UART interrupts */ - ti_lib_uart_int_clear(UART0_BASE, CC26XX_UART_INTERRUPT_ALL); -} -/*---------------------------------------------------------------------------*/ -static void -enable_interrupts(void) -{ - /* Clear all UART interrupts */ - ti_lib_uart_int_clear(UART0_BASE, CC26XX_UART_INTERRUPT_ALL); - - /* Enable RX-related interrupts only if we have an input handler */ - if(input_handler) { - /* Configure which interrupts to generate: FIFO level or after RX timeout */ - ti_lib_uart_int_enable(UART0_BASE, CC26XX_UART_RX_INTERRUPT_TRIGGERS); - - /* Acknowledge UART interrupts */ - ti_lib_int_enable(INT_UART0_COMB); - } -} -/*---------------------------------------------------------------------------*/ -static void -configure(void) -{ - uint32_t ctl_val = UART_CTL_UARTEN | UART_CTL_TXE; - /* - * Make sure the TX pin is output / high before assigning it to UART control - * to avoid falling edge glitches - */ - ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_UART_TX); - ti_lib_gpio_set_dio(BOARD_IOID_UART_TX); - - /* - * Map UART signals to the correct GPIO pins and configure them as - * hardware controlled. - */ - ti_lib_ioc_pin_type_uart(UART0_BASE, BOARD_IOID_UART_RX, BOARD_IOID_UART_TX, - BOARD_IOID_UART_CTS, BOARD_IOID_UART_RTS); - - /* Configure the UART for 115,200, 8-N-1 operation. */ - ti_lib_uart_config_set_exp_clk(UART0_BASE, ti_lib_sys_ctrl_clock_get(), - CC26XX_UART_CONF_BAUD_RATE, - (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | - UART_CONFIG_PAR_NONE)); - - /* - * Generate an RX interrupt at FIFO 1/2 full. - * We don't really care about the TX interrupt - */ - ti_lib_uart_fifo_level_set(UART0_BASE, UART_FIFO_TX7_8, UART_FIFO_RX4_8); - - /* Enable FIFOs */ - HWREG(UART0_BASE + UART_O_LCRH) |= UART_LCRH_FEN; - - if(input_handler) { - ctl_val += UART_CTL_RXE; - } - - /* Enable TX, RX (conditionally), and the UART. */ - HWREG(UART0_BASE + UART_O_CTL) = ctl_val; -} -/*---------------------------------------------------------------------------*/ -static void -lpm_drop_handler(uint8_t mode) -{ - /* - * First, wait for any outstanding TX to complete. If we have an input - * handler, the SERIAL PD will be kept on and the UART module clock will - * be enabled under sleep as well as deep sleep. In theory, this means that - * we shouldn't lose any outgoing bytes, but we actually do on occasion. - * This byte loss may (or may not) be related to the freezing of IO latches - * between MCU and AON when we drop to deep sleep. This here is essentially a - * workaround - */ - if(accessible() == true) { - while(ti_lib_uart_busy(UART0_BASE)); - } - - /* - * If we have a registered input_handler then we need to retain RX - * capability. Thus, if this is not a shutdown notification and we have an - * input handler, we do nothing - */ - if((mode != LPM_MODE_SHUTDOWN) && (input_handler != NULL)) { - return; - } - - /* - * If we reach here, we either don't care about staying awake or we have - * received a shutdown notification - * - * Only touch UART registers if the module is powered and clocked - */ - if(accessible() == true) { - /* Disable the module */ - ti_lib_uart_disable(UART0_BASE); - - /* Disable all UART interrupts and clear all flags */ - disable_interrupts(); - } - - /* - * Always stop the clock in run mode. Also stop in Sleep and Deep Sleep if - * this is a request for full shutdown - */ - ti_lib_prcm_peripheral_run_disable(PRCM_PERIPH_UART0); - if(mode == LPM_MODE_SHUTDOWN) { - ti_lib_prcm_peripheral_sleep_disable(PRCM_PERIPH_UART0); - ti_lib_prcm_peripheral_deep_sleep_disable(PRCM_PERIPH_UART0); - } - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - /* Set pins to low leakage configuration in preparation for deep sleep */ - lpm_pin_set_default_state(BOARD_IOID_UART_TX); - lpm_pin_set_default_state(BOARD_IOID_UART_RX); - lpm_pin_set_default_state(BOARD_IOID_UART_CTS); - lpm_pin_set_default_state(BOARD_IOID_UART_RTS); -} -/*---------------------------------------------------------------------------*/ -/* Declare a data structure to register with LPM. */ -LPM_MODULE(uart_module, NULL, lpm_drop_handler, NULL, LPM_DOMAIN_NONE); -/*---------------------------------------------------------------------------*/ -static void -enable(void) -{ - power_and_clock(); - - /* Make sure the peripheral is disabled */ - ti_lib_uart_disable(UART0_BASE); - - /* Disable all UART interrupts and clear all flags */ - disable_interrupts(); - - /* Setup pins, Baud rate and FIFO levels */ - configure(); - - /* Enable UART interrupts */ - enable_interrupts(); -} -/*---------------------------------------------------------------------------*/ -void -cc26xx_uart_init() -{ - bool interrupts_disabled; - - /* Return early if disabled by user conf or if ports are misconfigured */ - if(usable() == false) { - return; - } - - /* Disable Interrupts */ - interrupts_disabled = ti_lib_int_master_disable(); - - /* Register ourselves with the LPM module */ - lpm_register_module(&uart_module); - - /* Only TX and EN to start with. RX will be enabled only if needed */ - input_handler = NULL; - - /* - * init() won't actually fire up the UART. We turn it on only when (and if) - * it gets requested, either to enable input or to send out a character - * - * Thus, we simply re-enable processor interrupts here - */ - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } -} -/*---------------------------------------------------------------------------*/ -void -cc26xx_uart_write_byte(uint8_t c) -{ - /* Return early if disabled by user conf or if ports are misconfigured */ - if(usable() == false) { - return; - } - - if(accessible() == false) { - enable(); - } - - ti_lib_uart_char_put(UART0_BASE, c); -} -/*---------------------------------------------------------------------------*/ -void -cc26xx_uart_set_input(int (*input)(unsigned char c)) -{ - input_handler = input; - - /* Return early if disabled by user conf or if ports are misconfigured */ - if(usable() == false) { - return; - } - - if(input == NULL) { - /* Let the SERIAL PD power down */ - uart_module.domain_lock = LPM_DOMAIN_NONE; - - /* Disable module clocks under sleep and deep sleep */ - ti_lib_prcm_peripheral_sleep_disable(PRCM_PERIPH_UART0); - ti_lib_prcm_peripheral_deep_sleep_disable(PRCM_PERIPH_UART0); - } else { - /* Request the SERIAL PD to stay on during deep sleep */ - uart_module.domain_lock = LPM_DOMAIN_SERIAL; - - /* Enable module clocks under sleep and deep sleep */ - ti_lib_prcm_peripheral_sleep_enable(PRCM_PERIPH_UART0); - ti_lib_prcm_peripheral_deep_sleep_enable(PRCM_PERIPH_UART0); - } - - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - enable(); - - return; -} -/*---------------------------------------------------------------------------*/ -uint8_t -cc26xx_uart_busy(void) -{ - /* Return early if disabled by user conf or if ports are misconfigured */ - if(usable() == false) { - return UART_IDLE; - } - - /* If the UART is not accessible, it is not busy */ - if(accessible() == false) { - return UART_IDLE; - } - - return ti_lib_uart_busy(UART0_BASE); -} -/*---------------------------------------------------------------------------*/ -void -cc26xx_uart_isr(void) -{ - char the_char; - uint32_t flags; - - power_and_clock(); - - /* Read out the masked interrupt status */ - flags = ti_lib_uart_int_status(UART0_BASE, true); - - /* Clear all UART interrupt flags */ - ti_lib_uart_int_clear(UART0_BASE, CC26XX_UART_INTERRUPT_ALL); - - if((flags & CC26XX_UART_RX_INTERRUPT_TRIGGERS) != 0) { - /* - * If this was a FIFO RX or an RX timeout, read all bytes available in the - * RX FIFO. - */ - while(ti_lib_uart_chars_avail(UART0_BASE)) { - the_char = ti_lib_uart_char_get_non_blocking(UART0_BASE); - - if(input_handler != NULL) { - input_handler((unsigned char)the_char); - } - } - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/cc26xx-uart.h b/arch/cpu/cc26x0-cc13x0/dev/cc26xx-uart.h deleted file mode 100644 index 0e5a905c2..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/cc26xx-uart.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-uart CC13xx/CC26xx UARTs - * - * Driver for the CC13xx/CC26xx UART controller - * @{ - * - * \file - * Header file for the CC13xx/CC26xx UART driver - */ -#ifndef CC26XX_UART_H_ -#define CC26XX_UART_H_ - -#include -/*---------------------------------------------------------------------------*/ -/** \name UART functions - * @{ - */ - -/** - * \brief Initialises the UART controller, configures I/O control - * and interrupts - */ -void cc26xx_uart_init(); - -/** - * \brief Sends a single character down the UART - * \param b The character to transmit - */ -void cc26xx_uart_write_byte(uint8_t b); - -/** - * \brief Assigns a callback to be called when the UART receives a byte - * \param input A pointer to the function - * - * If \e input is NULL, the UART driver will assume that RX functionality is - * not required and it will be disabled. It will also disable the module's - * clocks under sleep and deep sleep and allow the SERIAL PD to be powered off. - * - * If \e input is not NULL, the UART driver will assume that RX is in fact - * required and it will be enabled. The module's clocks will be enabled under - * sleep and deep sleep and the driver will not allow the SERIAL PD to turn - * off during deep sleep, so that the UART can still receive bytes. - * - * \note This has a significant impact on overall energy consumption, so you - * should only enabled UART RX input when it's actually required. - */ -void cc26xx_uart_set_input(int (*input)(unsigned char c)); - -/** - * \brief Returns the UART busy status - * \return UART_IDLE or UART_BUSY - * - * ti_lib_uart_busy() will access UART registers. It is our responsibility - * to first make sure the UART is accessible before calling it. Hence this - * wrapper. - * - * Return values are defined in CC26xxware's uart.h - */ -uint8_t cc26xx_uart_busy(void); -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* CC26XX_UART_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/contiki-watchdog.c b/arch/cpu/cc26x0-cc13x0/dev/contiki-watchdog.c deleted file mode 100644 index f8eb4f666..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/contiki-watchdog.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26xx-clocks - * @{ - * - * \defgroup cc26xx-wdt CC13xx/CC26xx watchdog timer driver - * - * Driver for the CC13xx/CC26xx Watchdog Timer - * - * This file is not called watchdog.c because the filename is in use by - * TI CC26xxware/CC13xxware - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx watchdog driver. - */ -#include "contiki.h" -#include "dev/watchdog.h" -#include "ti-lib.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#ifdef CONTIKI_WATCHDOG_CONF_TIMER_TOP -#define CONTIKI_WATCHDOG_TIMER_TOP CONTIKI_WATCHDOG_CONF_TIMER_TOP -#else -#define CONTIKI_WATCHDOG_TIMER_TOP 0xFFFFF -#endif - -#ifdef CONTIKI_WATCHDOG_CONF_LOCK_CONFIG -#define CONTIKI_WATCHDOG_LOCK_CONFIG CONTIKI_WATCHDOG_CONF_LOCK_CONFIG -#else -#define CONTIKI_WATCHDOG_LOCK_CONFIG 1 -#endif - -#define LOCK_INTERRUPTS_DISABLED 0x01 -#define LOCK_REGISTERS_UNLOCKED 0x02 -/*---------------------------------------------------------------------------*/ -static uint32_t -unlock_config(void) -{ - uint32_t ret = 0; - bool int_status; - - if(CONTIKI_WATCHDOG_LOCK_CONFIG) { - int_status = ti_lib_int_master_disable(); - - if(ti_lib_watchdog_lock_state()) { - ret |= LOCK_REGISTERS_UNLOCKED; - ti_lib_watchdog_unlock(); - } - - ret |= (int_status) ? (0) : (LOCK_INTERRUPTS_DISABLED); - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static void -lock_config(uint32_t status) -{ - if(CONTIKI_WATCHDOG_LOCK_CONFIG) { - - if(status & LOCK_REGISTERS_UNLOCKED) { - ti_lib_watchdog_lock(); - } - if(status & LOCK_INTERRUPTS_DISABLED) { - ti_lib_int_master_enable(); - } - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialises the CC26xx WDT - * - * Simply sets the reload counter to a default value. The WDT is not started - * yet. To start it, watchdog_start() must be called. - */ -void -watchdog_init(void) -{ - ti_lib_watchdog_reload_set(CONTIKI_WATCHDOG_TIMER_TOP); - lock_config(LOCK_REGISTERS_UNLOCKED); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Starts the CC26xx WDT - */ -void -watchdog_start(void) -{ - uint32_t lock_status = unlock_config(); - - watchdog_periodic(); - ti_lib_watchdog_reset_enable(); - - lock_config(lock_status); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Refreshes the CC26xx WDT - */ -void -watchdog_periodic(void) -{ - ti_lib_watchdog_reload_set(CONTIKI_WATCHDOG_TIMER_TOP); - ti_lib_watchdog_int_clear(); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Stops the WDT such that it won't timeout and cause MCU reset - */ -void -watchdog_stop(void) -{ - uint32_t lock_status = unlock_config(); - - ti_lib_watchdog_reset_disable(); - - lock_config(lock_status); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Manually trigger a WDT reboot - */ -void -watchdog_reboot(void) -{ - watchdog_start(); - while(1); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/gpio-hal-arch.c b/arch/cpu/cc26x0-cc13x0/dev/gpio-hal-arch.c deleted file mode 100644 index 4fd4f7688..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/gpio-hal-arch.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-gpio-hal - * @{ - * - * \file - * Implementation file for the CC13xx/CC26xx GPIO HAL functions - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "ti-lib.h" -#include "dev/gpio-hal.h" - -#include -/*---------------------------------------------------------------------------*/ -#define CONFIG_MASK (IOC_IOPULL_M | IOC_INT_M | IOC_IOMODE_OPEN_SRC_INV) -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_pin_cfg_set(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg) -{ - uint32_t config; - gpio_hal_pin_cfg_t tmp; - - /* Clear settings that we are about to change, keep everything else */ - config = ti_lib_ioc_port_configure_get(pin); - config &= ~CONFIG_MASK; - - tmp = cfg & GPIO_HAL_PIN_CFG_EDGE_BOTH; - if(tmp == GPIO_HAL_PIN_CFG_EDGE_NONE) { - config |= IOC_NO_EDGE; - } else if(tmp == GPIO_HAL_PIN_CFG_EDGE_RISING) { - config |= IOC_RISING_EDGE; - } else if(tmp == GPIO_HAL_PIN_CFG_EDGE_FALLING) { - config |= IOC_FALLING_EDGE; - } else if(tmp == GPIO_HAL_PIN_CFG_EDGE_BOTH) { - config |= IOC_BOTH_EDGES; - } - - tmp = cfg & GPIO_HAL_PIN_CFG_PULL_MASK; - if(tmp == GPIO_HAL_PIN_CFG_PULL_NONE) { - config |= IOC_NO_IOPULL; - } else if(tmp == GPIO_HAL_PIN_CFG_PULL_DOWN) { - config |= IOC_IOPULL_DOWN; - } else if(tmp == GPIO_HAL_PIN_CFG_PULL_UP) { - config |= IOC_IOPULL_UP; - } - - tmp = cfg & GPIO_HAL_PIN_CFG_INT_MASK; - if(tmp == GPIO_HAL_PIN_CFG_INT_DISABLE) { - config |= IOC_INT_DISABLE; - } else if(tmp == GPIO_HAL_PIN_CFG_INT_ENABLE) { - config |= IOC_INT_ENABLE; - } - - ti_lib_ioc_port_configure_set(pin, IOC_PORT_GPIO, config); -} -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_cfg_t -gpio_hal_arch_pin_cfg_get(gpio_hal_pin_t pin) -{ - gpio_hal_pin_cfg_t cfg; - uint32_t tmp; - uint32_t config; - - cfg = 0; - config = ti_lib_ioc_port_configure_get(pin); - - /* Pull */ - tmp = config & IOC_IOPULL_M; - if(tmp == IOC_IOPULL_UP) { - cfg |= GPIO_HAL_PIN_CFG_PULL_UP; - } else if(tmp == IOC_IOPULL_DOWN) { - cfg |= GPIO_HAL_PIN_CFG_PULL_DOWN; - } else if(tmp == IOC_NO_IOPULL) { - cfg |= GPIO_HAL_PIN_CFG_PULL_NONE; - } - - /* Interrupt enable/disable */ - tmp = config & IOC_INT_ENABLE; - if(tmp == IOC_INT_DISABLE) { - cfg |= GPIO_HAL_PIN_CFG_INT_DISABLE; - } else if(tmp == IOC_INT_ENABLE) { - cfg |= GPIO_HAL_PIN_CFG_INT_ENABLE; - } - - /* Edge detection */ - tmp = config & IOC_BOTH_EDGES; - if(tmp == IOC_NO_EDGE) { - cfg |= GPIO_HAL_PIN_CFG_EDGE_NONE; - } else if(tmp == IOC_FALLING_EDGE) { - cfg |= GPIO_HAL_PIN_CFG_EDGE_FALLING; - } else if(tmp == IOC_RISING_EDGE) { - cfg |= GPIO_HAL_PIN_CFG_EDGE_RISING; - } else if(tmp == IOC_BOTH_EDGES) { - cfg |= GPIO_HAL_PIN_CFG_EDGE_BOTH; - } - - return cfg; -} -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_mask_t -gpio_hal_arch_read_pins(gpio_hal_pin_mask_t pins) -{ - gpio_hal_pin_mask_t oe_pins; - - /* For pins configured as output we need to read DOUT31_0 */ - oe_pins = ti_lib_gpio_get_output_enable_multi_dio(pins); - - pins &= ~oe_pins; - - return (HWREG(GPIO_BASE + GPIO_O_DOUT31_0) & oe_pins) | - ti_lib_gpio_read_multi_dio(pins); -} -/*---------------------------------------------------------------------------*/ -uint8_t -gpio_hal_arch_read_pin(gpio_hal_pin_t pin) -{ - if(ti_lib_gpio_get_output_enable_dio(pin)) { - return (HWREG(GPIO_BASE + GPIO_O_DOUT31_0) >> pin) & 1; - } - - return ti_lib_gpio_read_dio(pin); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/gpio-hal-arch.h b/arch/cpu/cc26x0-cc13x0/dev/gpio-hal-arch.h deleted file mode 100644 index 3997c1062..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/gpio-hal-arch.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-gpio-hal CC13xx/CC26xx GPIO HAL implementation - * - * @{ - * - * \file - * Header file for the CC13xx/CC26xx GPIO HAL functions - * - * \note - * Do not include this header directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef GPIO_HAL_ARCH_H_ -#define GPIO_HAL_ARCH_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "ti-lib.h" - -#include -/*---------------------------------------------------------------------------*/ -#define gpio_hal_arch_init() do { /* Do nothing */ } while(0) - -#define gpio_hal_arch_interrupt_enable(p) interrupt_enable(p) - -#define gpio_hal_arch_interrupt_disable(p) ti_lib_ioc_int_disable(p) -#define gpio_hal_arch_pin_set_input(p) ti_lib_ioc_pin_type_gpio_input(p) -#define gpio_hal_arch_pin_set_output(p) ti_lib_ioc_pin_type_gpio_output(p) - -#define gpio_hal_arch_set_pin(p) ti_lib_gpio_set_dio(p) -#define gpio_hal_arch_clear_pin(p) ti_lib_gpio_clear_dio(p) -#define gpio_hal_arch_toggle_pin(p) ti_lib_gpio_toggle_dio(p) -#define gpio_hal_arch_write_pin(p, v) ti_lib_gpio_write_dio(p, v) - -#define gpio_hal_arch_set_pins(p) ti_lib_gpio_set_multi_dio(p) -#define gpio_hal_arch_clear_pins(p) ti_lib_gpio_clear_multi_dio(p) -#define gpio_hal_arch_toggle_pins(p) ti_lib_gpio_toggle_multi_dio(p) -#define gpio_hal_arch_write_pins(p, v) ti_lib_gpio_write_multi_dio(p, v) -/*---------------------------------------------------------------------------*/ -static inline void -interrupt_enable(gpio_hal_pin_t pin) -{ - ti_lib_gpio_clear_event_dio(pin); - ti_lib_ioc_int_enable(pin); -} -/*---------------------------------------------------------------------------*/ -#endif /* GPIO_HAL_ARCH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/gpio-interrupt.c b/arch/cpu/cc26x0-cc13x0/dev/gpio-interrupt.c deleted file mode 100644 index 375e23a4a..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/gpio-interrupt.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \file - * CC13xx/CC26xx GPIO interrupt ISR. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" -#include "ti-lib.h" - -#include -/*---------------------------------------------------------------------------*/ -#define gpio_interrupt_isr GPIOIntHandler -/*---------------------------------------------------------------------------*/ -void -gpio_interrupt_isr(void) -{ - gpio_hal_pin_mask_t pin_mask; - - /* Read interrupt flags */ - pin_mask = (HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) & GPIO_DIO_ALL_MASK); - - /* Clear the interrupt flags */ - HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) = pin_mask; - - gpio_hal_event_handler(pin_mask); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/oscillators.c b/arch/cpu/cc26x0-cc13x0/dev/oscillators.c deleted file mode 100644 index 7890a8e55..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/oscillators.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-oscillators - * @{ - * - * \file - * Implementation of CC26xxware oscillator control wrappers. - */ -/*---------------------------------------------------------------------------*/ -#include "ti-lib.h" -#include "aux-ctrl.h" - -#include -/*---------------------------------------------------------------------------*/ -void -oscillators_select_lf_xosc(void) -{ - /* Request AUX access, with OSCCTRL and SMPH clocks */ - aux_consumer_module_t osc = { - .clocks = AUX_WUC_OSCCTRL_CLOCK | AUX_WUC_SMPH_CLOCK - }; - aux_ctrl_register_consumer(&osc); - - /* Switch LF clock source to the LF XOSC if required */ - if(ti_lib_osc_clock_source_get(OSC_SRC_CLK_LF) != OSC_XOSC_LF) { - ti_lib_osc_clock_source_set(OSC_SRC_CLK_LF, OSC_XOSC_LF); - - /* Wait for LF clock source to become XOSC_LF */ - while(ti_lib_osc_clock_source_get(OSC_SRC_CLK_LF) != OSC_XOSC_LF); - - /* Disable the LF clock qualifiers */ - ti_lib_ddi_16_bit_field_write(AUX_DDI0_OSC_BASE, DDI_0_OSC_O_CTL0, - DDI_0_OSC_CTL0_BYPASS_XOSC_LF_CLK_QUAL_M | - DDI_0_OSC_CTL0_BYPASS_RCOSC_LF_CLK_QUAL_M, - DDI_0_OSC_CTL0_BYPASS_RCOSC_LF_CLK_QUAL_S, - 0x3); - } - - /* Release the OSC AUX consumer */ - aux_ctrl_unregister_consumer(&osc); -} -/*---------------------------------------------------------------------------*/ -void -oscillators_select_lf_rcosc(void) -{ - /* Request AUX access, with OSCCTRL and SMPH clocks */ - aux_consumer_module_t osc = { - .clocks = AUX_WUC_OSCCTRL_CLOCK | AUX_WUC_SMPH_CLOCK - }; - aux_ctrl_register_consumer(&osc); - - /* Switch LF clock source to the LF XOSC if required */ - if(ti_lib_osc_clock_source_get(OSC_SRC_CLK_LF) != OSC_RCOSC_LF) { - ti_lib_osc_clock_source_set(OSC_SRC_CLK_LF, OSC_RCOSC_LF); - - /* Wait for LF clock source to become XOSC_LF */ - while(ti_lib_osc_clock_source_get(OSC_SRC_CLK_LF) != OSC_RCOSC_LF); - } - - /* Release the OSC AUX consumer */ - aux_ctrl_unregister_consumer(&osc); -} -/*---------------------------------------------------------------------------*/ -void -oscillators_request_hf_xosc(void) -{ - /* Request AUX access, with OSCCTRL and SMPH clocks */ - aux_consumer_module_t osc = { - .clocks = AUX_WUC_OSCCTRL_CLOCK | AUX_WUC_SMPH_CLOCK - }; - aux_ctrl_register_consumer(&osc); - - if(ti_lib_osc_clock_source_get(OSC_SRC_CLK_HF) != OSC_XOSC_HF) { - /* - * Request to switch to the crystal to enable radio operation. It takes a - * while for the XTAL to be ready so instead of performing the actual - * switch, we return and we do other stuff while the XOSC is getting ready. - */ - ti_lib_osc_clock_source_set(OSC_SRC_CLK_MF | OSC_SRC_CLK_HF, OSC_XOSC_HF); - } - - /* Release the OSC AUX consumer */ - aux_ctrl_unregister_consumer(&osc); -} -/*---------------------------------------------------------------------------*/ -void -oscillators_switch_to_hf_xosc(void) -{ - /* Request AUX access, with OSCCTRL and SMPH clocks */ - aux_consumer_module_t osc = { - .clocks = AUX_WUC_OSCCTRL_CLOCK | AUX_WUC_SMPH_CLOCK - }; - aux_ctrl_register_consumer(&osc); - - if(ti_lib_osc_clock_source_get(OSC_SRC_CLK_HF) != OSC_XOSC_HF) { - /* Switch the HF clock source (cc26xxware executes this from ROM) */ - ti_lib_osc_hf_source_switch(); - } - - /* Release the OSC AUX consumer */ - aux_ctrl_unregister_consumer(&osc); -} -/*---------------------------------------------------------------------------*/ -void -oscillators_switch_to_hf_rc(void) -{ - /* Request AUX access, with OSCCTRL and SMPH clocks */ - aux_consumer_module_t osc = { - .clocks = AUX_WUC_OSCCTRL_CLOCK | AUX_WUC_SMPH_CLOCK - }; - aux_ctrl_register_consumer(&osc); - - /* Set all clock sources to the HF RC Osc */ - ti_lib_osc_clock_source_set(OSC_SRC_CLK_MF | OSC_SRC_CLK_HF, OSC_RCOSC_HF); - - /* Check to not enable HF RC oscillator if already enabled */ - if(ti_lib_osc_clock_source_get(OSC_SRC_CLK_HF) != OSC_RCOSC_HF) { - /* Switch the HF clock source (cc26xxware executes this from ROM) */ - ti_lib_osc_hf_source_switch(); - } - - /* Release the OSC AUX consumer */ - aux_ctrl_unregister_consumer(&osc); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/oscillators.h b/arch/cpu/cc26x0-cc13x0/dev/oscillators.h deleted file mode 100644 index 47e95a311..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/oscillators.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-oscillators CC13xx/CC26xx oscillator control - * - * Wrapper around CC26xxware/CC13xxware OSC functions that we need in Contiki. - * - * All CC26xxware OSC control requires access to the semaphore module within - * AUX. Thus, in addition to enabling the oscillator interface, we need to - * start the clock to SMPH and restore it to its previous state when we are - * done. - * @{ - * - * \file - * Header file for the CC13xx/CC26xx oscillator control - */ -/*---------------------------------------------------------------------------*/ -#ifndef OSCILLATORS_H_ -#define OSCILLATORS_H_ -/*---------------------------------------------------------------------------*/ -/** - * \brief Set the LF clock source to be the LF XOSC - * - * This function is only called once as soon as the system starts. - * - * Do not switch the LF clock source to the RC OSC for normal system operation - * See CC26xx Errata (swrz058) - */ -void oscillators_select_lf_xosc(void); - -/** - * \brief Set the LF clock source to be the LF RCOSC - * - * This function is only called once, when the systen transitions to a full - * shutdown - * - * Do not switch the LF clock source to the RC OSC for normal system operation - * See CC26xx Errata (swrz058) - */ -void oscillators_select_lf_rcosc(void); - -/** - * \brief Requests the HF XOSC as the source for the HF clock, but does not - * perform the actual switch. - * - * This triggers the startup sequence of the HF XOSC and returns so the CPU - * can perform other tasks while the XOSC is starting. - * - * The XOSC is requested as the source for the HF as well as the MF clock. - */ -void oscillators_request_hf_xosc(void); - -/** - * \brief Performs the switch to the XOSC - * - * This function must be preceded by a call to oscillators_request_hf_xosc() - */ -void oscillators_switch_to_hf_xosc(void); - -/** - * \brief Switches MF and HF clock source to be the HF RC OSC - */ -void oscillators_switch_to_hf_rc(void); -/*---------------------------------------------------------------------------*/ -#endif /* OSCILLATORS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/soc-rtc.c b/arch/cpu/cc26x0-cc13x0/dev/soc-rtc.c deleted file mode 100644 index 2309026b6..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/soc-rtc.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc13xx-cc26xx-rtc - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx AON RTC driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "rtimer.h" -#include "lpm.h" - -#include "ti-lib.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define soc_rtc_isr(...) AONRTCIntHandler(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* Prototype of a function in clock.c. Called every time the handler fires */ -void clock_update(void); - -static rtimer_clock_t last_isr_time; -/*---------------------------------------------------------------------------*/ -#define COMPARE_INCREMENT (RTIMER_SECOND / CLOCK_SECOND) -#define MULTIPLE_512_MASK 0xFFFFFE00 -/*---------------------------------------------------------------------------*/ -/* - * Used to test timer wraparounds. - * - * Set to 0xFFFFFFFA to test AON RTC second counter wraparound - * Set to 0xFFFA to test AON RTC 16.16 format wraparound - */ -#ifdef SOC_RTC_CONF_START_TICK_COUNT -#define SOC_RTC_START_TICK_COUNT SOC_RTC_CONF_START_TICK_COUNT -#else -#define SOC_RTC_START_TICK_COUNT 0 -#endif -/*---------------------------------------------------------------------------*/ -void -soc_rtc_init(void) -{ - bool interrupts_disabled; - uint32_t next; - - /* Disable and clear interrupts */ - interrupts_disabled = ti_lib_int_master_disable(); - - ti_lib_aon_rtc_disable(); - - ti_lib_aon_rtc_event_clear(AON_RTC_CH0); - ti_lib_aon_rtc_event_clear(AON_RTC_CH1); - ti_lib_aon_rtc_event_clear(AON_RTC_CH2); - - /* Setup the wakeup event */ - ti_lib_aon_event_mcu_wake_up_set(AON_EVENT_MCU_WU0, AON_EVENT_RTC_CH0); - ti_lib_aon_event_mcu_wake_up_set(AON_EVENT_MCU_WU1, AON_EVENT_RTC_CH1); - ti_lib_aon_event_mcu_wake_up_set(AON_EVENT_MCU_WU2, AON_EVENT_RTC_CH2); - ti_lib_aon_rtc_combined_event_config(AON_RTC_CH0 | AON_RTC_CH1 | AON_RTC_CH2); - - HWREG(AON_RTC_BASE + AON_RTC_O_SEC) = SOC_RTC_START_TICK_COUNT; - - next = ti_lib_aon_rtc_current_compare_value_get() + COMPARE_INCREMENT; - - /* Configure channel 1 to start generating clock ticks. First tick at 512 */ - ti_lib_aon_rtc_compare_value_set(AON_RTC_CH1, next); - - /* Enable channel 1 and the RTC */ - ti_lib_aon_rtc_channel_enable(AON_RTC_CH1); - ti_lib_aon_rtc_enable(); - - ti_lib_int_enable(INT_AON_RTC_COMB); - - /* Re-enable interrupts */ - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -soc_rtc_get_next_trigger() -{ - rtimer_clock_t ch1 = ti_lib_aon_rtc_compare_value_get(AON_RTC_CH1); - - if(HWREG(AON_RTC_BASE + AON_RTC_O_CHCTL) & AON_RTC_CHCTL_CH0_EN) { - rtimer_clock_t ch0 = ti_lib_aon_rtc_compare_value_get(AON_RTC_CH0); - - return RTIMER_CLOCK_LT(ch0, ch1) ? ch0 : ch1; - } - - return ch1; -} -/*---------------------------------------------------------------------------*/ -void -soc_rtc_schedule_one_shot(uint32_t channel, uint32_t ticks) -{ - if((channel != AON_RTC_CH0) && (channel != AON_RTC_CH1) && (channel != AON_RTC_CH2)) { - return; - } - - /* Set the channel to fire a one-shot compare event at time==ticks */ - ti_lib_aon_rtc_compare_value_set(channel, ticks); - ti_lib_aon_rtc_channel_enable(channel); -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -soc_rtc_last_isr_time(void) -{ - return last_isr_time; -} -/*---------------------------------------------------------------------------*/ -/* The AON RTC interrupt handler */ -void -soc_rtc_isr(void) -{ - uint32_t next; - - last_isr_time = RTIMER_NOW(); - - /* Adjust the s/w tick counter irrespective of which event trigger this */ - clock_update(); - - if(ti_lib_aon_rtc_event_get(AON_RTC_CH1)) { - HWREG(AON_RTC_BASE + AON_RTC_O_EVFLAGS) = AON_RTC_EVFLAGS_CH1; - - /* - * We need to keep ticking while we are awake, so we schedule the next - * event on the next 512 tick boundary. If we drop to deep sleep before it - * happens, lpm_drop() will reschedule us in the 'distant' future - */ - next = ((ti_lib_aon_rtc_current_compare_value_get() + 5) + - COMPARE_INCREMENT) & MULTIPLE_512_MASK; - ti_lib_aon_rtc_compare_value_set(AON_RTC_CH1, next); - } - - if(ti_lib_aon_rtc_event_get(AON_RTC_CH0)) { - ti_lib_aon_rtc_channel_disable(AON_RTC_CH0); - HWREG(AON_RTC_BASE + AON_RTC_O_EVFLAGS) = AON_RTC_EVFLAGS_CH0; - rtimer_run_next(); - } - - if(ti_lib_aon_rtc_event_get(AON_RTC_CH2)) { - /* after sleep; since a rtimer is already scheduled, do nothing */ - ti_lib_aon_rtc_channel_disable(AON_RTC_CH2); - HWREG(AON_RTC_BASE + AON_RTC_O_EVFLAGS) = AON_RTC_EVFLAGS_CH2; - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/soc-rtc.h b/arch/cpu/cc26x0-cc13x0/dev/soc-rtc.h deleted file mode 100644 index cedf318c5..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/soc-rtc.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-clocks CC13xx/CC26xx clock and timer subsystem - * - * For the CC13xx/CC26xx cpu we use the AON RTC as the basis for all clocks and - * timers - * - * We use two of the aviable AON RTC channels. Channel 0 is used by the rtimer - * sub-system. Channel 1 is used by the system clock and the LPM module. - * - * The RTC runs in all power modes except 'shutdown' - * - * @{ - * - * \defgroup cc13xx-cc26xx-rtc CC13xx/CC26xx AON RTC driver - * - * Underpins the platform's software clocks and timers - * - * @{ - * \file - * Header file for the CC13xx/CC26xx AON RTC driver - */ -#ifndef SOC_RTC_H_ -#define SOC_RTC_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include "rtimer.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise the CC13XX/CC26XX AON RTC module - * - * This timer configures AON RTC channels. - * - * This function must be called before clock_init() and rtimer_init() - */ -void soc_rtc_init(void); - -/** - * \brief Return the time of the next scheduled rtimer event - * \return The time at which the next rtimer event is due to fire - * - * This function will check both AON RTC channels and will only take CH0's - * compare into account if the channel is actually enabled - */ -rtimer_clock_t soc_rtc_get_next_trigger(void); - -/** - * \brief Schedule an AON RTC channel 0 one-shot compare event - * \param channel AON_RTC_CH0 or AON_RTC_CH1 - * \param t The time when the event will be fired. This is an absolute - * time, in other words the event will fire AT time \e t, - * not IN \e t ticks - * - * Channel AON_RTC_CH0 is reserved for the rtimer. AON_RTC_CH1 is reserved - * for the system clock. - * - * User applications should not use this function. User applications should - * instead use Contiki's timer-related libraries - */ -void soc_rtc_schedule_one_shot(uint32_t channel, uint32_t t); - -rtimer_clock_t soc_rtc_last_isr_time(void); -/*---------------------------------------------------------------------------*/ -#endif /* SOC_RTC_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/soc-trng.c b/arch/cpu/cc26x0-cc13x0/dev/soc-trng.c deleted file mode 100644 index 30a558640..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/soc-trng.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-trng - * @{ - * - * \file - * - * Implementation of the CC13xx/CC26xx RNG driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lpm.h" -#include "sys/process.h" -#include "dev/soc-trng.h" -#include "ti-lib.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#ifdef SOC_TRNG_CONF_CACHE_LEN -#define SOC_TRNG_CACHE_LEN SOC_TRNG_CONF_CACHE_LEN -#else -/** Size of the random number cache. Each slot holds 4 16-bit numbers */ -#define SOC_TRNG_CACHE_LEN 4 -#endif -/*---------------------------------------------------------------------------*/ -#define MIN_REFILL_CYCLES_MAX 0x00000000 -/*---------------------------------------------------------------------------*/ -PROCESS(soc_trng_process, "CC13xx/CC26xx TRNG process"); -/*---------------------------------------------------------------------------*/ -static process_event_t rng_ready_event = PROCESS_EVENT_NONE; -/*---------------------------------------------------------------------------*/ -static soc_trng_callback_t notify_cb = NULL; -/*---------------------------------------------------------------------------*/ -#define soc_trng_isr TRNGIntHandler -/*---------------------------------------------------------------------------*/ -static uint64_t rands_cache[SOC_TRNG_CACHE_LEN]; -static bool rands_mask[SOC_TRNG_CACHE_LEN]; -/*---------------------------------------------------------------------------*/ -static void -disable_number_ready_interrupt(void) -{ - ti_lib_trng_int_disable(TRNG_NUMBER_READY); - ti_lib_int_disable(INT_TRNG_IRQ); -} -/*---------------------------------------------------------------------------*/ -static void -enable_number_ready_interrupt(void) -{ - ti_lib_trng_int_clear(TRNG_NUMBER_READY); - ti_lib_trng_int_enable(TRNG_NUMBER_READY); - ti_lib_int_enable(INT_TRNG_IRQ); -} -/*---------------------------------------------------------------------------*/ -static bool -accessible(void) -{ - /* First, check the PD */ - if(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) - != PRCM_DOMAIN_POWER_ON) { - return false; - } - - /* Then check the 'run mode' clock gate */ - if(!(HWREG(PRCM_BASE + PRCM_O_SECDMACLKGR) & - PRCM_SECDMACLKGDS_TRNG_CLK_EN_M)) { - return false; - } - - return true; -} -/*---------------------------------------------------------------------------*/ -static void -power_up(void) -{ - /* First, make sure the PERIPH PD is on */ - ti_lib_prcm_power_domain_on(PRCM_DOMAIN_PERIPH); - while((ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) - != PRCM_DOMAIN_POWER_ON)); - - /* Enable clock in active mode */ - ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_TRNG); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); -} -/*---------------------------------------------------------------------------*/ -static void -reset_synchronous(void) -{ - ti_lib_trng_reset(); - while(HWREG(TRNG_BASE + TRNG_O_SWRESET)); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -request(void) -{ - if(notify_cb) { - return LPM_MODE_SLEEP; - } - return LPM_MODE_MAX_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -LPM_MODULE(rng_module, request, NULL, NULL, LPM_DOMAIN_NONE); -/*---------------------------------------------------------------------------*/ -static uint64_t -read_number(void) -{ - uint64_t ran = (uint64_t)HWREG(TRNG_BASE + TRNG_O_OUT1) << 32; - ran += ti_lib_trng_number_get(TRNG_LOW_WORD); - - return ran; -} -/*---------------------------------------------------------------------------*/ -uint64_t -soc_trng_rand_synchronous() -{ - uint64_t ran; - bool interrupts_disabled; - int i; - - /* If the TRNG is gathering entropy, return a cached value */ - if(notify_cb) { - for(i = 0; i < SOC_TRNG_CACHE_LEN; i++) { - if(rands_mask[i]) { - rands_mask[i] = false; - return rands_cache[i]; - } - } - return 0; - } - - if(!accessible()) { - power_up(); - } - - /* - * If we were previously enabled, we either have a number already available, - * or we need clock, which means we are calculating. If neither is true then - * we need setup from scratch. - */ - if((ti_lib_trng_status_get() & (TRNG_NEED_CLOCK | TRNG_NUMBER_READY)) == 0) { - reset_synchronous(); - ti_lib_trng_configure(MIN_REFILL_CYCLES_MAX, SOC_TRNG_REFILL_CYCLES_MIN, 0); - ti_lib_trng_enable(); - } - - interrupts_disabled = ti_lib_int_master_disable(); - - while((ti_lib_trng_status_get() & TRNG_NUMBER_READY) == 0); - - ran = read_number(); - - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } - - return ran; -} -/*---------------------------------------------------------------------------*/ -uint8_t -soc_trng_rand_asynchronous(uint32_t samples, soc_trng_callback_t cb) -{ - int i; - bool interrupts_disabled; - - if(notify_cb != NULL) { - return SOC_TRNG_RAND_ASYNC_REQUEST_ERROR; - } - - if(!accessible()) { - power_up(); - } - - /* - * First we need to cache some random numbers for general use in case the - * application requests them while we are calculating. - * - * If we were previously enabled, we either have a number already available, - * or we need clock, which means we are calculating. If neither is true then - * we need setup from scratch. - */ - if((ti_lib_trng_status_get() & (TRNG_NEED_CLOCK | TRNG_NUMBER_READY)) == 0) { - reset_synchronous(); - } - - interrupts_disabled = ti_lib_int_master_disable(); - - ti_lib_trng_disable(); - ti_lib_trng_configure(MIN_REFILL_CYCLES_MAX, SOC_TRNG_REFILL_CYCLES_MIN, 0); - ti_lib_trng_enable(); - - /* Cache SOC_TRNG_CACHE_LEN min-entropy rands */ - for(i = 0; i < SOC_TRNG_CACHE_LEN; i++) { - while((ti_lib_trng_status_get() & TRNG_NUMBER_READY) == 0); - rands_mask[i] = true; - rands_cache[i] = read_number(); - } - - /* Configure the RNG to the required entropy */ - ti_lib_trng_disable(); - ti_lib_trng_configure(MIN_REFILL_CYCLES_MAX, samples, 0); - - /* - * Clear the TRNG_NUMBER_READY flag. This will trigger a new calculation - * as soon as the module gets enabled. - */ - ti_lib_trng_int_clear(TRNG_NUMBER_READY); - - /* Enable clock in sleep mode and register with LPM */ - ti_lib_prcm_peripheral_sleep_enable(PRCM_PERIPH_TRNG); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - lpm_register_module(&rng_module); - - notify_cb = cb; - - /* Enable the number ready interrupt and fire-up the module */ - enable_number_ready_interrupt(); - ti_lib_trng_enable(); - - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } - - return SOC_TRNG_RAND_ASYNC_REQUEST_OK; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(soc_trng_process, ev, data) -{ - PROCESS_BEGIN(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == rng_ready_event); - - if(notify_cb) { - uint64_t ran = read_number(); - - notify_cb(ran); - notify_cb = NULL; - } - - /* Disable clock in sleep mode */ - ti_lib_prcm_peripheral_sleep_disable(PRCM_PERIPH_TRNG); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - lpm_unregister_module(&rng_module); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -soc_trng_isr(void) -{ - ti_lib_trng_disable(); - - disable_number_ready_interrupt(); - - ti_lib_trng_configure(MIN_REFILL_CYCLES_MAX, SOC_TRNG_REFILL_CYCLES_MIN, 0); - ti_lib_trng_enable(); - - process_post(&soc_trng_process, rng_ready_event, NULL); -} -/*---------------------------------------------------------------------------*/ -void -soc_trng_init() -{ - if(rng_ready_event != PROCESS_EVENT_NONE) { - return; - } - - /* Register the RNG ready event */ - rng_ready_event = process_alloc_event(); - process_start(&soc_trng_process, NULL); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/soc-trng.h b/arch/cpu/cc26x0-cc13x0/dev/soc-trng.h deleted file mode 100644 index f84370168..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/soc-trng.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-trng CC13xx/CC26xx Random Number Generator - * - * Driver for the CC13xx/CC26xx Random Number Generator - * - * @{ - * - * \file - * - * Header file for the CC13xx/CC26xx TRNG driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef SOC_TRNG_H_ -#define SOC_TRNG_H_ -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#define SOC_TRNG_RAND_ASYNC_REQUEST_ERROR 0 /**< Async request rejected */ -#define SOC_TRNG_RAND_ASYNC_REQUEST_OK 1 /**< Async request accepted */ -/*---------------------------------------------------------------------------*/ -#define SOC_TRNG_REFILL_CYCLES_MIN 0x00000100 -#define SOC_TRNG_REFILL_CYCLES_MAX 0x00000000 -/*---------------------------------------------------------------------------*/ -/** - * \brief Pointer to a callback to be provided as an argument to - * soc_trng_rand_asynchronous() - */ -typedef void (*soc_trng_callback_t)(uint64_t rand); -/*---------------------------------------------------------------------------*/ -/** - * \name TRNG functions - * @{ - */ - -/** - * \brief Returns a minimum entropy random number - * \return The random number - * - * This function is synchronous. This function will make sure the PERIPH PD is - * powered and the TRNG is clocked. The function will then configure the TRNG - * to generate a random number of minimum entropy. These numbers are not - * suitable for cryptographic usage, but their generation is very fast. - * - * If a high-entropy random number is currently being generated, this function - * will return a cached random number. The cache is of configurable size and - * can hold a maximum SOC_TRNG_CONF_CACHE_LEN numbers. If the cache gets - * emptied while high-entropy generation is in progress (e.g. because a - * function requested many random numbers in a row), this function will return - * 0. Care must therefore be taken when the return value is 0, which can also - * be a valid random number. - * - * This function can be safely called from within an interrupt context. - */ -uint64_t soc_trng_rand_synchronous(); - -/** - * \brief Initialise the CC13xx/CC26xx TRNG driver - */ -void soc_trng_init(void); - -/** - * \brief Request a 64-bit, configurable-entropy random number - * \param samples Controls the entropy generated for the random number - * \param cb A callback function to be called when the generation is complete - * \retval SOC_TRNG_RAND_ASYNC_REQUEST_ERROR There was an error adding request. - * \retval SOC_TRNG_RAND_ASYNC_REQUEST_OK Request successfully registered - * - * This function is asynchronous, it will start generation of a random number - * and will return. The caller must provide a callback that will be called when - * the generation is complete. This callback must either use the random number - * immediately or store it, since it will not be possible to retrieve it again - * later form the soc-trng module. - * - * Only one generation can be active at any given point in time. If this - * function gets called when a generation is already in progress, it will - * return SOC_TRNG_RAND_ASYNC_REQUEST_ERROR. - * - * The function will configure the TRNG to generate entropy by sampling the - * FROs for a number clock cycles controlled by the samples argument. The 8 LS - * bits of this argument will be truncated by CC13xxware/CC26xxware and the - * resulting number of clock cycles will be (samples >> 8) * 2^8. Increasing - * the value of this argument increases entropy, but it also increases latency. - * Maximum entropy can be generated by passing SOC_TRNG_REFILL_CYCLES_MAX, but - * this will take approximately 350ms. Consult the chip's technical reference - * manual for advice on what would constitute sufficient entropy for random - * numbers meant to be used for crypto. - * - * While this function is executing, calls to soc_trng_rand_synchronous() will - * return cached random numbers. - * - * This function is not re-entrant and must not be called from an interrupt - * context. - */ -uint8_t soc_trng_rand_asynchronous(uint32_t samples, soc_trng_callback_t cb); -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* SOC_TRNG_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/dev/spi-arch.c b/arch/cpu/cc26x0-cc13x0/dev/spi-arch.c deleted file mode 100644 index 242cfa503..000000000 --- a/arch/cpu/cc26x0-cc13x0/dev/spi-arch.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2017, University of Bristol - http://www.bristol.ac.uk/ - * 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 HOLDER 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 "contiki.h" -#include "ti-lib.h" -#include "dev/spi.h" -#include "sys/mutex.h" - -#include -#include - -typedef struct spi_locks_s { - mutex_t lock; - const spi_device_t *owner; -} spi_locks_t; - -/* One lock per SPI controller */ -spi_locks_t board_spi_locks_spi[SPI_CONTROLLER_COUNT] = { { MUTEX_STATUS_UNLOCKED, NULL } }; - -/*---------------------------------------------------------------------------*/ -/* Arch-specific properties of each SPI controller */ -typedef struct board_spi_controller_s { - uint32_t ssi_base; - uint32_t power_domain; - uint32_t prcm_periph; - uint32_t ssi_clkgr_clk_en; -} board_spi_controller_t; - -static const board_spi_controller_t spi_controller[SPI_CONTROLLER_COUNT] = { - { - .ssi_base = SSI0_BASE, - .power_domain = PRCM_DOMAIN_SERIAL, - .prcm_periph = PRCM_PERIPH_SSI0, - .ssi_clkgr_clk_en = PRCM_SSICLKGR_CLK_EN_SSI0 - }, - { - .ssi_base = SSI1_BASE, - .power_domain = PRCM_DOMAIN_PERIPH, - .prcm_periph = PRCM_PERIPH_SSI1, - .ssi_clkgr_clk_en = PRCM_SSICLKGR_CLK_EN_SSI1 - } -}; -/*---------------------------------------------------------------------------*/ -bool -spi_arch_has_lock(const spi_device_t *dev) -{ - if(board_spi_locks_spi[dev->spi_controller].owner == dev) { - return true; - } - - return false; -} -/*---------------------------------------------------------------------------*/ -bool -spi_arch_is_bus_locked(const spi_device_t *dev) -{ - if(board_spi_locks_spi[dev->spi_controller].lock == MUTEX_STATUS_LOCKED) { - return true; - } - - return false; -} -/*---------------------------------------------------------------------------*/ -static uint32_t -get_mode(const spi_device_t *dev) -{ - /* Select the correct SPI mode */ - if(dev->spi_pha == 0 && dev->spi_pol == 0) { - return SSI_FRF_MOTO_MODE_0; - } else if(dev->spi_pha != 0 && dev->spi_pol == 0) { - return SSI_FRF_MOTO_MODE_1; - } else if(dev->spi_pha == 0 && dev->spi_pol != 0) { - return SSI_FRF_MOTO_MODE_2; - } else { - return SSI_FRF_MOTO_MODE_3; - } -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_arch_lock_and_open(const spi_device_t *dev) -{ - uint32_t c; - - /* Lock the SPI bus */ - if(mutex_try_lock(&board_spi_locks_spi[dev->spi_controller].lock) == false) { - return SPI_DEV_STATUS_BUS_LOCKED; - } - - board_spi_locks_spi[dev->spi_controller].owner = dev; - - /* CS pin configuration */ - ti_lib_ioc_pin_type_gpio_output(dev->pin_spi_cs); - - /* First, make sure the SERIAL PD is on */ - ti_lib_prcm_power_domain_on(spi_controller[dev->spi_controller].power_domain); - while((ti_lib_prcm_power_domain_status(spi_controller[dev->spi_controller].power_domain) - != PRCM_DOMAIN_POWER_ON)) ; - - /* Enable clock in active mode */ - ti_lib_prcm_peripheral_run_enable(spi_controller[dev->spi_controller].prcm_periph); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()) ; - - /* SPI configuration */ - ti_lib_ssi_int_disable(spi_controller[dev->spi_controller].ssi_base, SSI_RXOR | SSI_RXFF | SSI_RXTO | SSI_TXFF); - ti_lib_ssi_int_clear(spi_controller[dev->spi_controller].ssi_base, SSI_RXOR | SSI_RXTO); - - ti_lib_ssi_config_set_exp_clk(spi_controller[dev->spi_controller].ssi_base, - ti_lib_sys_ctrl_clock_get(), - get_mode(dev), SSI_MODE_MASTER, - dev->spi_bit_rate, 8); - ti_lib_ioc_pin_type_ssi_master(spi_controller[dev->spi_controller].ssi_base, - dev->pin_spi_miso, - dev->pin_spi_mosi, IOID_UNUSED, - dev->pin_spi_sck); - - ti_lib_ssi_enable(spi_controller[dev->spi_controller].ssi_base); - - /* Get rid of residual data from SSI port */ - while(ti_lib_ssi_data_get_non_blocking(spi_controller[dev->spi_controller].ssi_base, &c)) ; - - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_arch_close_and_unlock(const spi_device_t *dev) -{ - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_NOT_OWNED; - } - - /* Power down SSI */ - ti_lib_prcm_peripheral_run_disable(spi_controller[dev->spi_controller].prcm_periph); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()) ; - - /* Restore pins to a low-consumption state */ - ti_lib_ioc_pin_type_gpio_input(dev->pin_spi_miso); - ti_lib_ioc_io_port_pull_set(dev->pin_spi_miso, IOC_IOPULL_DOWN); - - ti_lib_ioc_pin_type_gpio_input(dev->pin_spi_mosi); - ti_lib_ioc_io_port_pull_set(dev->pin_spi_mosi, IOC_IOPULL_DOWN); - - ti_lib_ioc_pin_type_gpio_input(dev->pin_spi_sck); - ti_lib_ioc_io_port_pull_set(dev->pin_spi_sck, IOC_IOPULL_DOWN); - - /* Unlock the SPI bus */ - board_spi_locks_spi[dev->spi_controller].owner = NULL; - mutex_unlock(&board_spi_locks_spi[dev->spi_controller].lock); - - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_arch_transfer(const spi_device_t *dev, - const uint8_t *write_buf, int wlen, - uint8_t *inbuf, int rlen, int ignore_len) -{ - int i; - int totlen; - uint32_t c; - - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_NOT_OWNED; - } - - if(ti_lib_prcm_power_domain_status(spi_controller[dev->spi_controller].power_domain) - != PRCM_DOMAIN_POWER_ON) { - return SPI_DEV_STATUS_CLOSED; - } - - /* Then check the 'run mode' clock gate */ - if(!(HWREG(PRCM_BASE + PRCM_O_SSICLKGR) & spi_controller[dev->spi_controller].ssi_clkgr_clk_en)) { - return SPI_DEV_STATUS_CLOSED; - } - - totlen = MAX(rlen + ignore_len, wlen); - - if(totlen == 0) { - /* Nothing to do */ - return SPI_DEV_STATUS_OK; - } - - for(i = 0; i < totlen; i++) { - c = i < wlen ? write_buf[i] : 0; - ti_lib_ssi_data_put(spi_controller[dev->spi_controller].ssi_base, (uint8_t)c); - ti_lib_ssi_data_get(spi_controller[dev->spi_controller].ssi_base, &c); - if(i < rlen) { - inbuf[i] = (uint8_t)c; - } - } - while(ti_lib_ssi_data_get_non_blocking(spi_controller[dev->spi_controller].ssi_base, &c)) ; - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc26x0-cc13x0/doxygen-group.txt b/arch/cpu/cc26x0-cc13x0/doxygen-group.txt deleted file mode 100644 index 6dd3cd1f0..000000000 --- a/arch/cpu/cc26x0-cc13x0/doxygen-group.txt +++ /dev/null @@ -1,16 +0,0 @@ -/** - * \defgroup cc26xx The TI CC13xx and CC26xx Systems-on-Chip - * - * This group documents the TI CC26xx and CC13xx CPUs. The two CPU families are - * very similar, with the main difference being related to radio capability. - * - * Documentation in this group should be considered to be applicable to both - * families, unless explicitly stated otherwise. - * - * \ingroup cpu - */ - -/** - * \defgroup cc26xx-platforms TI CC26xx-powered platforms - * \ingroup platform - */ diff --git a/arch/cpu/cc26x0-cc13x0/fault-handlers.c b/arch/cpu/cc26x0-cc13x0/fault-handlers.c deleted file mode 100644 index 48dd9f204..000000000 --- a/arch/cpu/cc26x0-cc13x0/fault-handlers.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 "inc/hw_types.h" -#include "inc/hw_memmap.h" -#include "inc/hw_cpu_scs.h" -/*---------------------------------------------------------------------------*/ -#define fault_handlers_hard_fault_isr FaultISR -/*---------------------------------------------------------------------------*/ -void -fault_handlers_hard_fault_isr(void) -{ - /* - * Workaround for (Im)precise Bus Faults caused under unknown circumstances, - * likely by access to RFC registers while the RF PD is off (which is - * something that should never happen because we do in fact check before - * accessing) - */ - if((HWREG(CPU_SCS_BASE + CPU_SCS_O_CFSR) == CPU_SCS_CFSR_IMPRECISERR) || - (HWREG(CPU_SCS_BASE + CPU_SCS_O_CFSR) & CPU_SCS_CFSR_PRECISERR)){ - /* ToDo: Check BFARVALID and then BFAR to filter down even further */ - return; - } - - while(1); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc26x0-cc13x0/ieee-addr.c b/arch/cpu/cc26x0-cc13x0/ieee-addr.c deleted file mode 100644 index 144240cc4..000000000 --- a/arch/cpu/cc26x0-cc13x0/ieee-addr.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-ieee-addr - * @{ - * - * \file - * Driver for the CC13xx/CC26xx IEEE addresses - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "net/linkaddr.h" -#include "ieee-addr.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -void -ieee_addr_cpy_to(uint8_t *dst, uint8_t len) -{ - if(IEEE_ADDR_CONF_HARDCODED) { - uint8_t ieee_addr_hc[8] = IEEE_ADDR_CONF_ADDRESS; - - memcpy(dst, &ieee_addr_hc[8 - len], len); - } else { - int i; - - /* Reading from primary location... */ - uint8_t *location = (uint8_t *)IEEE_ADDR_LOCATION_PRIMARY; - - /* - * ...unless we can find a byte != 0xFF in secondary - * - * Intentionally checking all 8 bytes here instead of len, because we - * are checking validity of the entire IEEE address irrespective of the - * actual number of bytes the caller wants to copy over. - */ - for(i = 0; i < 8; i++) { - if(((uint8_t *)IEEE_ADDR_LOCATION_SECONDARY)[i] != 0xFF) { - /* A byte in the secondary location is not 0xFF. Use the secondary */ - location = (uint8_t *)IEEE_ADDR_LOCATION_SECONDARY; - break; - } - } - - /* - * We have chosen what address to read the IEEE address from. Do so, - * inverting byte order - */ - for(i = 0; i < len; i++) { - dst[i] = location[len - 1 - i]; - } - } - -#if IEEE_ADDR_NODE_ID - dst[len - 1] = IEEE_ADDR_NODE_ID & 0xFF; - dst[len - 2] = IEEE_ADDR_NODE_ID >> 8; -#endif -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/ieee-addr.h b/arch/cpu/cc26x0-cc13x0/ieee-addr.h deleted file mode 100644 index 017ed138e..000000000 --- a/arch/cpu/cc26x0-cc13x0/ieee-addr.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-ieee-addr CC13xx/CC26xx IEEE Address Control - * - * Driver for the retrieval of an IEEE address from flash - * - * The user can specify a hardcoded IEEE address through the - * IEEE_ADDR_CONF_HARDCODED configuration macro. - * - * If the user does not hard-code an address, then one will be read from either - * the primary location (InfoPage) or from the secondary location (on flash). - * - * In order to allow the user to easily program nodes with addresses, the - * secondary location is given priority: If it contains a valid address then - * it will be chosen in favour of the one on InfoPage. - * - * In this context, an address is valid if at least one of the 8 bytes does not - * equal 0xFF. If all 8 bytes are 0xFF, then the primary location will be used. - * - * In all cases, the address is assumed to be written little-endian. - * - * Lastly, it is possible to override the 2 LSB's of the address by using the - * NODE_ID make variable. - * @{ - * - * \file - * Header file with register and macro declarations for the cc26xx IEEE address - * driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef IEEE_ADDR_H_ -#define IEEE_ADDR_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \name IEEE address locations - * - * The address of the secondary location can be configured by the platform - * or example - * - * @{ - */ -#define IEEE_ADDR_LOCATION_PRIMARY 0x500012F0 /**< Primary IEEE address location */ - -#ifdef IEEE_ADDR_CONF_LOCATION_SECONDARY -#define IEEE_ADDR_LOCATION_SECONDARY IEEE_ADDR_CONF_LOCATION_SECONDARY -#else -#define IEEE_ADDR_LOCATION_SECONDARY 0x0001FFC8 /**< Secondary IEEE address location */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Copy the node's IEEE address to a destination memory area - * \param dst A pointer to the destination area where the IEEE address is to be - * written - * \param len The number of bytes to write to destination area - * - * This function will copy \e len LS bytes and it will invert byte order in - * the process. The factory address on devices is normally little-endian, - * therefore you should expect dst to store the address in a big-endian order. - */ -void ieee_addr_cpy_to(uint8_t *dst, uint8_t len); -/*---------------------------------------------------------------------------*/ -#endif /* IEEE_ADDR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/int-master.c b/arch/cpu/cc26x0-cc13x0/int-master.c deleted file mode 100644 index e6b513d63..000000000 --- a/arch/cpu/cc26x0-cc13x0/int-master.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-interrupts CC13xx-CC26xx master interrupt manipulation - * - * Master interrupt manipulation routines for the CC13xx and CC26xx CPUs - * - * @{ - * - * \file - * Master interrupt manipulation implementation for the TI CC13xx/CC26xx - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/int-master.h" -#include "cc13x0-cc26x0-cm3.h" - -#include "ti-lib.h" - -#include -/*---------------------------------------------------------------------------*/ -void -int_master_enable(void) -{ - ti_lib_int_master_enable(); -} -/*---------------------------------------------------------------------------*/ -int_master_status_t -int_master_read_and_disable(void) -{ - return ti_lib_int_master_disable(); -} -/*---------------------------------------------------------------------------*/ -void -int_master_status_set(int_master_status_t status) -{ - __set_PRIMASK(status); -} -/*---------------------------------------------------------------------------*/ -bool -int_master_is_enabled(void) -{ - return ti_lib_cpu_primask() ? false : true; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/lib/cc13xxware b/arch/cpu/cc26x0-cc13x0/lib/cc13xxware deleted file mode 160000 index 682cf5d60..000000000 --- a/arch/cpu/cc26x0-cc13x0/lib/cc13xxware +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 682cf5d60aa6b6be77c5519ff70fa18087fe3cf0 diff --git a/arch/cpu/cc26x0-cc13x0/lib/cc2640r2-sdk b/arch/cpu/cc26x0-cc13x0/lib/cc2640r2-sdk deleted file mode 160000 index 0c01cfd36..000000000 --- a/arch/cpu/cc26x0-cc13x0/lib/cc2640r2-sdk +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0c01cfd363fd421d43baaa52af551a4ce8bf9e2b diff --git a/arch/cpu/cc26x0-cc13x0/lib/cc26xxware b/arch/cpu/cc26x0-cc13x0/lib/cc26xxware deleted file mode 160000 index 568511d65..000000000 --- a/arch/cpu/cc26x0-cc13x0/lib/cc26xxware +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 568511d650601afdc80106d9b9d5c44882635d17 diff --git a/arch/cpu/cc26x0-cc13x0/lpm.c b/arch/cpu/cc26x0-cc13x0/lpm.c deleted file mode 100644 index 2337fb24f..000000000 --- a/arch/cpu/cc26x0-cc13x0/lpm.c +++ /dev/null @@ -1,573 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-lpm - * @{ - * - * Implementation of CC13xx/CC26xx low-power operation functionality - * - * @{ - * - * \file - * Driver for CC13xx/CC26xx low-power operation - */ -/*---------------------------------------------------------------------------*/ -#include "prcm.h" -#include "contiki.h" -#include "ti-lib.h" -#include "lpm.h" -#include "sys/energest.h" -#include "lib/list.h" -#include "dev/aux-ctrl.h" -#include "dev/leds.h" -#include "dev/watchdog.h" -#include "dev/soc-rtc.h" -#include "dev/oscillators.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -LIST(modules_list); -/*---------------------------------------------------------------------------*/ -/* PDs that may stay on in deep sleep */ -#define LOCKABLE_DOMAINS ((uint32_t)(PRCM_DOMAIN_SERIAL | PRCM_DOMAIN_PERIPH)) -/*---------------------------------------------------------------------------*/ -/* - * Don't consider standby mode if the next AON RTC event is scheduled to fire - * in less than STANDBY_MIN_DURATION rtimer ticks - */ -#define STANDBY_MIN_DURATION (RTIMER_SECOND / 100) /* 10.0 ms */ - -/* Wake up this much time earlier before the next rtimer */ -#define SLEEP_GUARD_TIME (RTIMER_SECOND / 1000) /* 1.0 ms */ - -#define MAX_SLEEP_TIME RTIMER_SECOND -#define MIN_SAFE_SCHEDULE 8u -/*---------------------------------------------------------------------------*/ -/* Prototype of a function in clock.c. Called every time we come out of DS */ -void clock_update(void); -/*---------------------------------------------------------------------------*/ -void -lpm_shutdown(uint32_t wakeup_pin, uint32_t io_pull, uint32_t wake_on) -{ - lpm_registered_module_t *module; - int i; - uint32_t io_cfg = (IOC_STD_INPUT & ~IOC_IOPULL_M) | io_pull | wake_on; - aux_consumer_module_t aux = { .clocks = AUX_WUC_OSCCTRL_CLOCK }; - - /* This procedure may not be interrupted */ - ti_lib_int_master_disable(); - - /* Disable the RTC */ - ti_lib_aon_rtc_disable(); - ti_lib_aon_rtc_event_clear(AON_RTC_CH0); - ti_lib_aon_rtc_event_clear(AON_RTC_CH1); - ti_lib_aon_rtc_event_clear(AON_RTC_CH2); - - /* Reset AON even fabric to default wakeup sources */ - for(i = AON_EVENT_MCU_WU0; i <= AON_EVENT_MCU_WU3; i++) { - ti_lib_aon_event_mcu_wake_up_set(i, AON_EVENT_NONE); - } - for(i = AON_EVENT_AUX_WU0; i <= AON_EVENT_AUX_WU2; i++) { - ti_lib_aon_event_aux_wake_up_set(i, AON_EVENT_NONE); - } - - ti_lib_sys_ctrl_aon_sync(); - - watchdog_periodic(); - - /* Notify all modules that we're shutting down */ - for(module = list_head(modules_list); module != NULL; - module = module->next) { - if(module->shutdown) { - module->shutdown(LPM_MODE_SHUTDOWN); - } - } - - /* Configure the wakeup trigger */ - if(wakeup_pin != IOID_UNUSED) { - ti_lib_gpio_set_output_enable_dio(wakeup_pin, GPIO_OUTPUT_DISABLE); - ti_lib_ioc_port_configure_set(wakeup_pin, IOC_PORT_GPIO, io_cfg); - } - - /* Freeze I/O latches in AON */ - ti_lib_aon_ioc_freeze_enable(); - - /* Turn off RFCORE, SERIAL and PERIPH PDs. This will happen immediately */ - ti_lib_prcm_power_domain_off(PRCM_DOMAIN_RFCORE | PRCM_DOMAIN_SERIAL | - PRCM_DOMAIN_PERIPH); - - /* Register an aux-ctrl consumer to avoid powercycling AUX twice in a row */ - aux_ctrl_register_consumer(&aux); - oscillators_switch_to_hf_rc(); - oscillators_select_lf_rcosc(); - - /* Configure clock sources for MCU: No clock */ - ti_lib_aon_wuc_mcu_power_down_config(AONWUC_NO_CLOCK); - - /* Disable SRAM retention */ - ti_lib_aon_wuc_mcu_sram_config(0); - - /* - * Request CPU, SYSBYS and VIMS PD off. - * This will only happen when the CM3 enters deep sleep - */ - ti_lib_prcm_power_domain_off(PRCM_DOMAIN_CPU | PRCM_DOMAIN_VIMS | - PRCM_DOMAIN_SYSBUS); - - /* Request JTAG domain power off */ - ti_lib_aon_wuc_jtag_power_off(); - - /* Turn off AUX */ - aux_ctrl_power_down(true); - ti_lib_aon_wuc_domain_power_down_enable(); - - /* - * Request MCU VD power off. - * This will only happen when the CM3 enters deep sleep - */ - ti_lib_prcm_mcu_power_off(); - - /* Set MCU wakeup to immediate and disable virtual power off */ - ti_lib_aon_wuc_mcu_wake_up_config(MCU_IMM_WAKE_UP); - ti_lib_aon_wuc_mcu_power_off_config(MCU_VIRT_PWOFF_DISABLE); - - /* Latch the IOs in the padring and enable I/O pad sleep mode */ - ti_lib_aon_ioc_freeze_enable(); - HWREG(AON_SYSCTL_BASE + AON_SYSCTL_O_SLEEPCTL) = 0; - ti_lib_sys_ctrl_aon_sync(); - - /* Turn off VIMS cache, CRAM and TRAM - possibly not required */ - ti_lib_prcm_cache_retention_disable(); - ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_OFF); - - /* Enable shutdown and sync AON */ - ti_lib_aon_wuc_shut_down_enable(); - ti_lib_sys_ctrl_aon_sync(); - - /* Deep Sleep */ - ti_lib_prcm_deep_sleep(); -} -/*---------------------------------------------------------------------------*/ -/* - * Notify all modules that we're back on and rely on them to restore clocks - * and power domains as required. - */ -static void -wake_up(void) -{ - lpm_registered_module_t *module; - - ENERGEST_SWITCH(ENERGEST_TYPE_DEEP_LPM, ENERGEST_TYPE_CPU); - - /* Sync so that we get the latest values before adjusting recharge settings */ - ti_lib_sys_ctrl_aon_sync(); - - /* Adjust recharge settings */ - ti_lib_sys_ctrl_adjust_recharge_after_power_down(); - - /* - * Release the request to the uLDO - * This is likely not required, since the switch to GLDO/DCDC is automatic - * when coming back from deep sleep - */ - ti_lib_prcm_mcu_uldo_configure(false); - - /* Turn on cache again */ - ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_ENABLED); - ti_lib_prcm_cache_retention_enable(); - - ti_lib_aon_ioc_freeze_disable(); - ti_lib_sys_ctrl_aon_sync(); - - /* Check operating conditions, optimally choose DCDC versus GLDO */ - ti_lib_sys_ctrl_dcdc_voltage_conditional_control(); - - /* Fire up AUX is the user has requested this */ - aux_ctrl_power_up(); - - /* - * We may or may not have been woken up by an AON RTC tick. If not, we need - * to adjust our software tick counter - */ - clock_update(); - - watchdog_periodic(); - - /* Notify all registered modules that we've just woken up */ - for(module = list_head(modules_list); module != NULL; - module = module->next) { - if(module->wakeup) { - module->wakeup(); - } - } - -#if CC2650_FAST_RADIO_STARTUP - /* - * Trigger a switch to the XOSC, so that we can subsequently use the RF FS - */ - oscillators_request_hf_xosc(); -#endif -} -/*---------------------------------------------------------------------------*/ -static uint8_t -check_next_rtimer(rtimer_clock_t now, rtimer_clock_t *next_rtimer, bool *next_rtimer_set) -{ - uint8_t max_pm = LPM_MODE_MAX_SUPPORTED; - - if(ti_lib_aon_rtc_channel_active(AON_RTC_CH0)) { - *next_rtimer_set = true; - - /* find out the timer of the next rtimer interrupt */ - *next_rtimer = ti_lib_aon_rtc_compare_value_get(AON_RTC_CH0); - - if(RTIMER_CLOCK_LT(*next_rtimer, now + 2)) { - max_pm = MIN(max_pm, LPM_MODE_AWAKE); - } else if(RTIMER_CLOCK_LT(*next_rtimer, now + STANDBY_MIN_DURATION)) { - max_pm = MIN(max_pm, LPM_MODE_SLEEP); - } - } else { - *next_rtimer_set = false; - } - - return max_pm; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -check_next_etimer(rtimer_clock_t now, rtimer_clock_t *next_etimer, bool *next_etimer_set) -{ - uint8_t max_pm = LPM_MODE_MAX_SUPPORTED; - - *next_etimer_set = false; - - /* Find out the time of the next etimer */ - if(etimer_pending()) { - int32_t until_next_etimer = (int32_t)etimer_next_expiration_time() - (int32_t)clock_time(); - if(until_next_etimer < 1) { - max_pm = MIN(max_pm, LPM_MODE_AWAKE); - } else { - *next_etimer_set = true; - *next_etimer = soc_rtc_last_isr_time() + (until_next_etimer * (RTIMER_SECOND / CLOCK_SECOND)); - if(RTIMER_CLOCK_LT(*next_etimer, now + STANDBY_MIN_DURATION)) { - max_pm = MIN(max_pm, LPM_MODE_SLEEP); - } - } - } - - return max_pm; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -setup_sleep_mode(void) -{ - lpm_registered_module_t *module; - uint8_t max_pm = LPM_MODE_MAX_SUPPORTED; - uint8_t pm; - - rtimer_clock_t now; - rtimer_clock_t next_rtimer = 0; - rtimer_clock_t next_etimer = 0; - bool next_rtimer_set = false; - bool next_etimer_set = false; - - /* Check if any events fired before we turned interrupts off. If so, abort */ - if(LPM_MODE_MAX_SUPPORTED == LPM_MODE_AWAKE || process_nevents()) { - return LPM_MODE_AWAKE; - } - - /* Collect max allowed PM permission from interested modules */ - for(module = list_head(modules_list); module != NULL; - module = module->next) { - if(module->request_max_pm) { - uint8_t module_pm = module->request_max_pm(); - if(module_pm < max_pm) { - max_pm = module_pm; - } - } - } - - now = RTIMER_NOW(); - - pm = check_next_rtimer(now, &next_rtimer, &next_rtimer_set); - if(pm < max_pm) { - max_pm = pm; - } - pm = check_next_etimer(now, &next_etimer, &next_etimer_set); - if(pm < max_pm) { - max_pm = pm; - } - - if(max_pm == LPM_MODE_SLEEP) { - if(next_etimer_set) { - /* Schedule the next system wakeup due to etimer */ - if(RTIMER_CLOCK_LT(next_etimer, now + MIN_SAFE_SCHEDULE)) { - /* Too soon in future, use this minimal interval instead */ - next_etimer = now + MIN_SAFE_SCHEDULE; - } else if(RTIMER_CLOCK_LT(now + MAX_SLEEP_TIME, next_etimer)) { - /* Too far in future, use MAX_SLEEP_TIME instead */ - next_etimer = now + MAX_SLEEP_TIME; - } - soc_rtc_schedule_one_shot(AON_RTC_CH1, next_etimer); - } else { - /* No etimers set. Since by default the CH1 RTC fires once every clock tick, - * need to explicitly schedule a wakeup in the future to save energy. - * But do not stay in this mode for too long, otherwise watchdog will be trigerred. */ - soc_rtc_schedule_one_shot(AON_RTC_CH1, now + MAX_SLEEP_TIME); - } - - } else if(max_pm == LPM_MODE_DEEP_SLEEP) { - /* Watchdog is not enabled, so deep sleep can continue an arbitrary long time. - * On the other hand, if `CC2650_FAST_RADIO_STARTUP` is defined, - * early wakeup before the next rtimer should be scheduled. */ - -#if CC2650_FAST_RADIO_STARTUP - if(next_rtimer_set) { - if(!next_etimer_set || RTIMER_CLOCK_LT(next_rtimer - SLEEP_GUARD_TIME, next_etimer)) { - /* schedule a wakeup briefly before the next rtimer to wake up the system */ - soc_rtc_schedule_one_shot(AON_RTC_CH2, next_rtimer - SLEEP_GUARD_TIME); - } - } -#endif - - if(next_etimer_set) { - /* Schedule the next system wakeup due to etimer. - * No need to compare the `next_etimer` to `now` here as this branch - * is only entered when there's sufficient time for deep sleeping. */ - soc_rtc_schedule_one_shot(AON_RTC_CH1, next_etimer); - } else { - /* Use the farthest possible wakeup time */ - soc_rtc_schedule_one_shot(AON_RTC_CH1, now - 1); - } - } - - return max_pm; -} -/*---------------------------------------------------------------------------*/ -void -lpm_sleep(void) -{ - ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM); - - /* Just to be on the safe side, explicitly disable Deep Sleep */ - HWREG(NVIC_SYS_CTRL) &= ~(NVIC_SYS_CTRL_SLEEPDEEP); - - ti_lib_prcm_sleep(); - - ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU); -} -/*---------------------------------------------------------------------------*/ -static void -deep_sleep(void) -{ - uint32_t domains = LOCKABLE_DOMAINS; - lpm_registered_module_t *module; - - /* - * Notify all registered modules that we are dropping to mode X. We do not - * need to do this for simple sleep. - * - * This is a chance for modules to delay us a little bit until an ongoing - * operation has finished (e.g. uart TX) or to configure themselves for - * deep sleep. - * - * At this stage, we also collect power domain locks, if any. - * The argument to PRCMPowerDomainOff() is a bitwise OR, so every time - * we encounter a lock we just clear the respective bits in the 'domains' - * variable as required by the lock. In the end the domains variable will - * just hold whatever has not been cleared - */ - for(module = list_head(modules_list); module != NULL; - module = module->next) { - if(module->shutdown) { - module->shutdown(LPM_MODE_DEEP_SLEEP); - } - - /* Clear the bits specified in the lock */ - domains &= ~module->domain_lock; - } - - /* Pat the dog: We don't want it to shout right after we wake up */ - watchdog_periodic(); - - /* Clear unacceptable bits, just in case a lock provided a bad value */ - domains &= LOCKABLE_DOMAINS; - - /* - * Freeze the IOs on the boundary between MCU and AON. We only do this if - * PERIPH is not needed - */ - if(domains & PRCM_DOMAIN_PERIPH) { - ti_lib_aon_ioc_freeze_enable(); - } - - /* - * Among LOCKABLE_DOMAINS, turn off those that are not locked - * - * If domains is != 0, pass it as-is - */ - if(domains) { - ti_lib_prcm_power_domain_off(domains); - } - - /* - * Before entering Deep Sleep, we must switch off the HF XOSC. The HF XOSC - * is predominantly controlled by the RF driver. In a build with radio - * cycling (e.g. ContikiMAC), the RF driver will request the XOSC before - * using the Freq. Synth, and switch back to the RC when it is about to - * turn back off. - * - * If the radio is on, we won't even reach here, and if it's off the HF - * clock source should already be the HF RC, unless CC2650_FAST_RADIO_STARTUP - * is defined. - * - * Nevertheless, request the switch to the HF RC explicitly here. - */ - oscillators_switch_to_hf_rc(); - - /* Shut Down the AUX if the user application is not using it */ - aux_ctrl_power_down(false); - - /* Configure clock sources for MCU: No clock */ - ti_lib_aon_wuc_mcu_power_down_config(AONWUC_NO_CLOCK); - - /* Full RAM retention. */ - ti_lib_aon_wuc_mcu_sram_config(MCU_RAM0_RETENTION | MCU_RAM1_RETENTION | - MCU_RAM2_RETENTION | MCU_RAM3_RETENTION); - - /* - * Always turn off RFCORE, CPU, SYSBUS and VIMS. RFCORE should be off - * already - */ - ti_lib_prcm_power_domain_off(PRCM_DOMAIN_RFCORE | PRCM_DOMAIN_CPU | - PRCM_DOMAIN_VIMS | PRCM_DOMAIN_SYSBUS); - - /* Request JTAG domain power off */ - ti_lib_aon_wuc_jtag_power_off(); - - /* Allow MCU and AUX powerdown */ - ti_lib_aon_wuc_domain_power_down_enable(); - - /* Configure the recharge controller */ - ti_lib_sys_ctrl_set_recharge_before_power_down(XOSC_IN_HIGH_POWER_MODE); - - /* - * If both PERIPH and SERIAL PDs are off, request the uLDO as the power - * source while in deep sleep. - */ - if(domains == LOCKABLE_DOMAINS) { - ti_lib_pwr_ctrl_source_set(PWRCTRL_PWRSRC_ULDO); - } - - ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_DEEP_LPM); - - /* Sync the AON interface to ensure all writes have gone through. */ - ti_lib_sys_ctrl_aon_sync(); - - /* - * Explicitly turn off VIMS cache, CRAM and TRAM. Needed because of - * retention mismatch between VIMS logic and cache. We wait to do this - * until right before deep sleep to be able to use the cache for as long - * as possible. - */ - ti_lib_prcm_cache_retention_disable(); - ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_OFF); - - /* Deep Sleep */ - ti_lib_prcm_deep_sleep(); - - /* - * When we reach here, some interrupt woke us up. The global interrupt - * flag is off, hence we have a chance to run things here. We will wake up - * the chip properly, and then we will enable the global interrupt without - * unpending events so the handlers can fire - */ - wake_up(); - - ti_lib_int_master_enable(); -} -/*---------------------------------------------------------------------------*/ -void -lpm_drop() -{ - uint8_t max_pm; - - /* Critical. Don't get interrupted! */ - ti_lib_int_master_disable(); - - max_pm = setup_sleep_mode(); - - /* Drop */ - if(max_pm == LPM_MODE_SLEEP) { - lpm_sleep(); - } else if(max_pm == LPM_MODE_DEEP_SLEEP) { - deep_sleep(); - } - - ti_lib_int_master_enable(); -} -/*---------------------------------------------------------------------------*/ -void -lpm_register_module(lpm_registered_module_t *module) -{ - list_add(modules_list, module); -} -/*---------------------------------------------------------------------------*/ -void -lpm_unregister_module(lpm_registered_module_t *module) -{ - list_remove(modules_list, module); -} -/*---------------------------------------------------------------------------*/ -void -lpm_init() -{ - list_init(modules_list); - - /* Always wake up on any DIO edge detection */ - ti_lib_aon_event_mcu_wake_up_set(AON_EVENT_MCU_WU3, AON_EVENT_IO); -} -/*---------------------------------------------------------------------------*/ -void -lpm_pin_set_default_state(uint32_t ioid) -{ - if(ioid == IOID_UNUSED) { - return; - } - - ti_lib_ioc_port_configure_set(ioid, IOC_PORT_GPIO, IOC_STD_OUTPUT); - ti_lib_gpio_set_output_enable_dio(ioid, GPIO_OUTPUT_DISABLE); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/lpm.h b/arch/cpu/cc26x0-cc13x0/lpm.h deleted file mode 100644 index 2d6f56d00..000000000 --- a/arch/cpu/cc26x0-cc13x0/lpm.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-lpm CC13xx/CC26xx Low-Power management - * - * CC13xx/CC26xx low-power operation - * - * @{ - * - * \file - * Header file for the management of CC13xx/CC26xx low-power operation - */ -/*---------------------------------------------------------------------------*/ -#ifndef LPM_H_ -#define LPM_H_ -/*---------------------------------------------------------------------------*/ -#include "pwr_ctrl.h" - -#include -/*---------------------------------------------------------------------------*/ -#define LPM_MODE_AWAKE 0 -#define LPM_MODE_SLEEP 1 -#define LPM_MODE_DEEP_SLEEP 2 -#define LPM_MODE_SHUTDOWN 3 - -#define LPM_MODE_MAX_SUPPORTED LPM_MODE_DEEP_SLEEP -/*---------------------------------------------------------------------------*/ -#define LPM_DOMAIN_NONE 0 -#define LPM_DOMAIN_SERIAL PRCM_DOMAIN_SERIAL -#define LPM_DOMAIN_PERIPH PRCM_DOMAIN_PERIPH -/*---------------------------------------------------------------------------*/ -typedef struct lpm_registered_module { - struct lpm_registered_module *next; - uint8_t (*request_max_pm)(void); - void (*shutdown)(uint8_t mode); - void (*wakeup)(void); - uint32_t domain_lock; -} lpm_registered_module_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Declare a variable to be used in order to get notifications from LPM - * \param n the variable name to be declared - * \param m A pointer to a function which will tell the LPM module the max - * PM this module is willing to handle. This function will return - * LPM_MODE_SLEEP, LPM_MODE_DEEP_SLEEP etc. The LPM module will ask all - * registered modules and will trigger the highest LPM permitted - * \param s A pointer to a function which will receive a notification just - * before entering the low power mode. The callee can prepare for the - * imminent LPM state. The argument to this function will be the - * upcoming low power mode. This function can e.g. turn off a - * peripheral before the LPM module shuts down the power domain. - * \param w A pointer to a function which will be called just after we have - * woken up. This can be used to e.g. turn a peripheral back on. This - * function is in charge of turning power domains back on. This - * function will normally be called within an interrupt context. - * \param l Power domain locks, if any are required. The module can request - * that the SERIAL or PERIPH PD be kept powered up at the transition - * to deep sleep. This field can be a bitwise OR of LPM_DOMAIN_x, so - * if required multiple domains can be kept powered. - */ -#define LPM_MODULE(n, m, s, w, l) static lpm_registered_module_t n = \ - { NULL, m, s, w, l } -/*---------------------------------------------------------------------------*/ -/** - * \brief Drop the cortex to sleep / deep sleep and shut down peripherals - * - * Whether the cortex will drop to sleep or deep sleep is configurable. The - * exact peripherals which will be shut down is also configurable - */ -void lpm_drop(void); - -/** - * \brief Enter sleep mode - */ -void lpm_sleep(void); - -/** - * \brief Put the chip in shutdown power mode - * \param wakeup_pin The GPIO pin which will wake us up. Must be IOID_0 etc... - * \param io_pull Pull configuration for the shutdown pin: IOC_NO_IOPULL, - * IOC_IOPULL_UP or IOC_IOPULL_DOWN - * \param wake_on High or Low (IOC_WAKE_ON_LOW or IOC_WAKE_ON_HIGH) - */ -void lpm_shutdown(uint32_t wakeup_pin, uint32_t io_pull, uint32_t wake_on); - -/** - * \brief Register a module for LPM notifications. - * \param module A pointer to the data structure with the module definition - * - * When the LPM module is about to drop to some low power mode, it will first - * notify all modules about this. - * - * This function must not be called before the module has been initialised - * with lpm_init(). The code does not perform checks: This is the caller's - * responsibility. - */ -void lpm_register_module(lpm_registered_module_t *module); - -/** - * \brief Unregister a module from LPM notifications. - * \param module A pointer to the data structure with the module definition - * - * When a previously registered module is no longer interested in LPM - * notifications, this function can be used to unregister it. - */ -void lpm_unregister_module(lpm_registered_module_t *module); - -/** - * \brief Initialise the low-power mode management module - */ -void lpm_init(void); - -/** - * \brief Sets an IOID to a default state - * \param ioid IOID_0... - * - * This will set ioid to sw control, input, no pull. Input buffer and output - * driver will both be disabled - * - * The function will do nothing if ioid == IOID_UNUSED, so the caller does not - * have to check board configuration before calling this. - */ -void lpm_pin_set_default_state(uint32_t ioid); -/*---------------------------------------------------------------------------*/ -#endif /* LPM_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/random.c b/arch/cpu/cc26x0-cc13x0/random.c deleted file mode 100644 index a3cc7f3a2..000000000 --- a/arch/cpu/cc26x0-cc13x0/random.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-trng - * @{ - * - * \file - * - * This file overrides os/lib/random.c and calls SoC-specific RNG functions - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/soc-trng.h" -/*---------------------------------------------------------------------------*/ -/** - * \brief Generates a new random number using the hardware TRNG. - * \return The random number. - */ -unsigned short -random_rand(void) -{ - return (unsigned short)soc_trng_rand_synchronous() & 0xFFFF; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Function required by the API - * \param seed Ignored. - */ -void -random_init(unsigned short seed) -{ - soc_trng_init(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/api/ieee_cmd.h b/arch/cpu/cc26x0-cc13x0/rf-core/api/ieee_cmd.h deleted file mode 100644 index 6cbaf24a2..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/api/ieee_cmd.h +++ /dev/null @@ -1,611 +0,0 @@ -/****************************************************************************** -* Filename: ieee_cmd.h -* Revised: $ $ -* Revision: $ $ -* -* Description: CC26xx/CC13xx API for IEEE 802.15.4 commands -* -* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ -* -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* -* 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. -* -* Neither the name of Texas Instruments Incorporated nor the names of -* its contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -******************************************************************************/ - -#ifndef IEEE_CMD_H_ -#define IEEE_CMD_H_ - -#ifndef __RFC_STRUCT -#ifdef __GNUC__ -#define __RFC_STRUCT __attribute__ ((aligned (4))) -#else -#define __RFC_STRUCT -#endif -#endif - -//! \addtogroup rfc -//! @{ - -//! \addtogroup ieee_cmd -//! @{ - -#include -#include "driverlib/rf_mailbox.h" -#include "driverlib/rf_common_cmd.h" - -typedef struct __RFC_STRUCT rfc_CMD_IEEE_RX_s rfc_CMD_IEEE_RX_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_ED_SCAN_s rfc_CMD_IEEE_ED_SCAN_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_TX_s rfc_CMD_IEEE_TX_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_CSMA_s rfc_CMD_IEEE_CSMA_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_RX_ACK_s rfc_CMD_IEEE_RX_ACK_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_BG_s rfc_CMD_IEEE_ABORT_BG_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_CCA_s rfc_CMD_IEEE_MOD_CCA_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_FILT_s rfc_CMD_IEEE_MOD_FILT_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_SRC_MATCH_s rfc_CMD_IEEE_MOD_SRC_MATCH_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_FG_s rfc_CMD_IEEE_ABORT_FG_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_STOP_FG_s rfc_CMD_IEEE_STOP_FG_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_CCA_REQ_s rfc_CMD_IEEE_CCA_REQ_t; -typedef struct __RFC_STRUCT rfc_ieeeRxOutput_s rfc_ieeeRxOutput_t; -typedef struct __RFC_STRUCT rfc_shortAddrEntry_s rfc_shortAddrEntry_t; -typedef struct __RFC_STRUCT rfc_ieeeRxCorrCrc_s rfc_ieeeRxCorrCrc_t; - -//! \addtogroup CMD_IEEE_RX -//! @{ -#define CMD_IEEE_RX 0x2801 -struct __RFC_STRUCT rfc_CMD_IEEE_RX_s { - uint16_t commandNo; //!< The command ID number 0x2801 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips if the rule involves skipping - } condition; - uint8_t channel; //!< \brief Channel to tune to in the start of the operation
- //!< 0: Use existing channel
- //!< 11–26: Use as IEEE 802.15.4 channel, i.e. frequency is (2405 + 5 × (channel - 11)) MHz
- //!< 60–207: Frequency is (2300 + channel) MHz
- //!< Others: Reserved - struct { - uint8_t bAutoFlushCrc:1; //!< If 1, automatically remove packets with CRC error from Rx queue - uint8_t bAutoFlushIgn:1; //!< If 1, automatically remove packets that can be ignored according to frame filtering from Rx queue - uint8_t bIncludePhyHdr:1; //!< If 1, include the received PHY header field in the stored packet; otherwise discard it - uint8_t bIncludeCrc:1; //!< If 1, include the received CRC field in the stored packet; otherwise discard it - uint8_t bAppendRssi:1; //!< If 1, append an RSSI byte to the packet in the Rx queue - uint8_t bAppendCorrCrc:1; //!< If 1, append a correlation value and CRC result byte to the packet in the Rx queue - uint8_t bAppendSrcInd:1; //!< If 1, append an index from the source matching algorithm - uint8_t bAppendTimestamp:1; //!< If 1, append a timestamp to the packet in the Rx queue - } rxConfig; - dataQueue_t* pRxQ; //!< Pointer to receive queue - rfc_ieeeRxOutput_t *pOutput; //!< Pointer to output structure (NULL: Do not store results) - struct { - uint16_t frameFiltEn:1; //!< \brief 0: Disable frame filtering
- //!< 1: Enable frame filtering - uint16_t frameFiltStop:1; //!< \brief 0: Receive all packets to the end
- //!< 1: Stop receiving frame once frame filtering has caused the frame to be rejected. - uint16_t autoAckEn:1; //!< \brief 0: Disable auto ACK
- //!< 1: Enable auto ACK. - uint16_t slottedAckEn:1; //!< \brief 0: Non-slotted ACK
- //!< 1: Slotted ACK. - uint16_t autoPendEn:1; //!< \brief 0: Auto-pend disabled
- //!< 1: Auto-pend enabled - uint16_t defaultPend:1; //!< The value of the pending data bit in auto ACK packets that are not subject to auto-pend - uint16_t bPendDataReqOnly:1; //!< \brief 0: Use auto-pend for any packet
- //!< 1: Use auto-pend for data request packets only - uint16_t bPanCoord:1; //!< \brief 0: Device is not PAN coordinator
- //!< 1: Device is PAN coordinator - uint16_t maxFrameVersion:2; //!< Reject frames where the frame version field in the FCF is greater than this value - uint16_t fcfReservedMask:3; //!< Value to be AND-ed with the reserved part of the FCF; frame rejected if result is non-zero - uint16_t modifyFtFilter:2; //!< \brief Treatment of MSB of frame type field before frame-type filtering:
- //!< 0: No modification
- //!< 1: Invert MSB
- //!< 2: Set MSB to 0
- //!< 3: Set MSB to 1 - uint16_t bStrictLenFilter:1; //!< \brief 0: Accept acknowledgement frames of any length >= 5
- //!< 1: Accept only acknowledgement frames of length 5 - } frameFiltOpt; //!< Frame filtering options - struct { - uint8_t bAcceptFt0Beacon:1; //!< \brief Treatment of frames with frame type 000 (beacon):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt1Data:1; //!< \brief Treatment of frames with frame type 001 (data):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt2Ack:1; //!< \brief Treatment of frames with frame type 010 (ACK):
- //!< 0: Reject, unless running ACK receive command
- //!< 1: Always accept - uint8_t bAcceptFt3MacCmd:1; //!< \brief Treatment of frames with frame type 011 (MAC command):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt4Reserved:1; //!< \brief Treatment of frames with frame type 100 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt5Reserved:1; //!< \brief Treatment of frames with frame type 101 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt6Reserved:1; //!< \brief Treatment of frames with frame type 110 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt7Reserved:1; //!< \brief Treatment of frames with frame type 111 (reserved):
- //!< 0: Reject
- //!< 1: Accept - } frameTypes; //!< Frame types to receive in frame filtering - struct { - uint8_t ccaEnEnergy:1; //!< Enable energy scan as CCA source - uint8_t ccaEnCorr:1; //!< Enable correlator based carrier sense as CCA source - uint8_t ccaEnSync:1; //!< Enable sync found based carrier sense as CCA source - uint8_t ccaCorrOp:1; //!< \brief Operator to use between energy based and correlator based CCA
- //!< 0: Report busy channel if either ccaEnergy or ccaCorr are busy
- //!< 1: Report busy channel if both ccaEnergy and ccaCorr are busy - uint8_t ccaSyncOp:1; //!< \brief Operator to use between sync found based CCA and the others
- //!< 0: Always report busy channel if ccaSync is busy
- //!< 1: Always report idle channel if ccaSync is idle - uint8_t ccaCorrThr:2; //!< Threshold for number of correlation peaks in correlator based carrier sense - } ccaOpt; //!< CCA options - int8_t ccaRssiThr; //!< RSSI threshold for CCA - uint8_t __dummy0; - uint8_t numExtEntries; //!< Number of extended address entries - uint8_t numShortEntries; //!< Number of short address entries - uint32_t* pExtEntryList; //!< Pointer to list of extended address entries - rfc_shortAddrEntry_t *pShortEntryList;//!< Pointer to list of short address entries - uint64_t localExtAddr; //!< The extended address of the local device - uint16_t localShortAddr; //!< The short address of the local device - uint16_t localPanID; //!< The PAN ID of the local device - uint16_t __dummy1; - uint8_t __dummy2; - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } endTrigger; //!< Trigger that causes the device to end the Rx operation - ratmr_t endTime; //!< \brief Time used together with endTrigger that causes the device to end the Rx - //!< operation -}; - -//! @} - -//! \addtogroup CMD_IEEE_ED_SCAN -//! @{ -#define CMD_IEEE_ED_SCAN 0x2802 -struct __RFC_STRUCT rfc_CMD_IEEE_ED_SCAN_s { - uint16_t commandNo; //!< The command ID number 0x2802 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips if the rule involves skipping - } condition; - uint8_t channel; //!< \brief Channel to tune to in the start of the operation
- //!< 0: Use existing channel
- //!< 11–26: Use as IEEE 802.15.4 channel, i.e. frequency is (2405 + 5 × (channel - 11)) MHz
- //!< 60–207: Frequency is (2300 + channel) MHz
- //!< Others: Reserved - struct { - uint8_t ccaEnEnergy:1; //!< Enable energy scan as CCA source - uint8_t ccaEnCorr:1; //!< Enable correlator based carrier sense as CCA source - uint8_t ccaEnSync:1; //!< Enable sync found based carrier sense as CCA source - uint8_t ccaCorrOp:1; //!< \brief Operator to use between energy based and correlator based CCA
- //!< 0: Report busy channel if either ccaEnergy or ccaCorr are busy
- //!< 1: Report busy channel if both ccaEnergy and ccaCorr are busy - uint8_t ccaSyncOp:1; //!< \brief Operator to use between sync found based CCA and the others
- //!< 0: Always report busy channel if ccaSync is busy
- //!< 1: Always report idle channel if ccaSync is idle - uint8_t ccaCorrThr:2; //!< Threshold for number of correlation peaks in correlator based carrier sense - } ccaOpt; //!< CCA options - int8_t ccaRssiThr; //!< RSSI threshold for CCA - uint8_t __dummy0; - int8_t maxRssi; //!< The maximum RSSI recorded during the ED scan - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } endTrigger; //!< Trigger that causes the device to end the Rx operation - ratmr_t endTime; //!< \brief Time used together with endTrigger that causes the device to end the Rx - //!< operation -}; - -//! @} - -//! \addtogroup CMD_IEEE_TX -//! @{ -#define CMD_IEEE_TX 0x2C01 -struct __RFC_STRUCT rfc_CMD_IEEE_TX_s { - uint16_t commandNo; //!< The command ID number 0x2C01 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips if the rule involves skipping - } condition; - struct { - uint8_t bIncludePhyHdr:1; //!< \brief 0: Find PHY header automatically
- //!< 1: Insert PHY header from the buffer - uint8_t bIncludeCrc:1; //!< \brief 0: Append automatically calculated CRC
- //!< 1: Insert FCS (CRC) from the buffer - uint8_t :1; - uint8_t payloadLenMsb:5; //!< \brief Most significant bits of payload length. Should only be non-zero to create long - //!< non-standard packets for test purposes - } txOpt; - uint8_t payloadLen; //!< Number of bytes in the payload - uint8_t* pPayload; //!< Pointer to payload buffer of size payloadLen - ratmr_t timeStamp; //!< Time stamp of transmitted frame -}; - -//! @} - -//! \addtogroup CMD_IEEE_CSMA -//! @{ -#define CMD_IEEE_CSMA 0x2C02 -struct __RFC_STRUCT rfc_CMD_IEEE_CSMA_s { - uint16_t commandNo; //!< The command ID number 0x2C02 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips if the rule involves skipping - } condition; - uint16_t randomState; //!< The state of the pseudo-random generator - uint8_t macMaxBE; //!< The IEEE 802.15.4 MAC parameter macMaxBE - uint8_t macMaxCSMABackoffs; //!< The IEEE 802.15.4 MAC parameter macMaxCSMABackoffs - struct { - uint8_t initCW:5; //!< The initialization value for the CW parameter - uint8_t bSlotted:1; //!< \brief 0: non-slotted CSMA
- //!< 1: slotted CSMA - uint8_t rxOffMode:2; //!< \brief 0: RX stays on during CSMA backoffs
- //!< 1: The CSMA-CA algorithm will suspend the receiver if no frame is being received
- //!< 2: The CSMA-CA algorithm will suspend the receiver if no frame is being received, - //!< or after finishing it (including auto ACK) otherwise
- //!< 3: The CSMA-CA algorithm will suspend the receiver immediately during back-offs - } csmaConfig; - uint8_t NB; //!< The NB parameter from the IEEE 802.15.4 CSMA-CA algorithm - uint8_t BE; //!< The BE parameter from the IEEE 802.15.4 CSMA-CA algorithm - uint8_t remainingPeriods; //!< The number of remaining periods from a paused backoff countdown - int8_t lastRssi; //!< RSSI measured at the last CCA operation - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } endTrigger; //!< Trigger that causes the device to end the CSMA-CA operation - ratmr_t lastTimeStamp; //!< Time of the last CCA operation - ratmr_t endTime; //!< \brief Time used together with endTrigger that causes the device to end the - //!< CSMA-CA operation -}; - -//! @} - -//! \addtogroup CMD_IEEE_RX_ACK -//! @{ -#define CMD_IEEE_RX_ACK 0x2C03 -struct __RFC_STRUCT rfc_CMD_IEEE_RX_ACK_s { - uint16_t commandNo; //!< The command ID number 0x2C03 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips if the rule involves skipping - } condition; - uint8_t seqNo; //!< Sequence number to expect - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } endTrigger; //!< Trigger that causes the device to give up acknowledgement reception - ratmr_t endTime; //!< \brief Time used together with endTrigger that causes the device to give up - //!< acknowledgement reception -}; - -//! @} - -//! \addtogroup CMD_IEEE_ABORT_BG -//! @{ -#define CMD_IEEE_ABORT_BG 0x2C04 -struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_BG_s { - uint16_t commandNo; //!< The command ID number 0x2C04 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips if the rule involves skipping - } condition; -}; - -//! @} - -//! \addtogroup CMD_IEEE_MOD_CCA -//! @{ -#define CMD_IEEE_MOD_CCA 0x2001 -struct __RFC_STRUCT rfc_CMD_IEEE_MOD_CCA_s { - uint16_t commandNo; //!< The command ID number 0x2001 - struct { - uint8_t ccaEnEnergy:1; //!< Enable energy scan as CCA source - uint8_t ccaEnCorr:1; //!< Enable correlator based carrier sense as CCA source - uint8_t ccaEnSync:1; //!< Enable sync found based carrier sense as CCA source - uint8_t ccaCorrOp:1; //!< \brief Operator to use between energy based and correlator based CCA
- //!< 0: Report busy channel if either ccaEnergy or ccaCorr are busy
- //!< 1: Report busy channel if both ccaEnergy and ccaCorr are busy - uint8_t ccaSyncOp:1; //!< \brief Operator to use between sync found based CCA and the others
- //!< 0: Always report busy channel if ccaSync is busy
- //!< 1: Always report idle channel if ccaSync is idle - uint8_t ccaCorrThr:2; //!< Threshold for number of correlation peaks in correlator based carrier sense - } newCcaOpt; //!< New value of ccaOpt for the running background level operation - int8_t newCcaRssiThr; //!< New value of ccaRssiThr for the running background level operation -}; - -//! @} - -//! \addtogroup CMD_IEEE_MOD_FILT -//! @{ -#define CMD_IEEE_MOD_FILT 0x2002 -struct __RFC_STRUCT rfc_CMD_IEEE_MOD_FILT_s { - uint16_t commandNo; //!< The command ID number 0x2002 - struct { - uint16_t frameFiltEn:1; //!< \brief 0: Disable frame filtering
- //!< 1: Enable frame filtering - uint16_t frameFiltStop:1; //!< \brief 0: Receive all packets to the end
- //!< 1: Stop receiving frame once frame filtering has caused the frame to be rejected. - uint16_t autoAckEn:1; //!< \brief 0: Disable auto ACK
- //!< 1: Enable auto ACK. - uint16_t slottedAckEn:1; //!< \brief 0: Non-slotted ACK
- //!< 1: Slotted ACK. - uint16_t autoPendEn:1; //!< \brief 0: Auto-pend disabled
- //!< 1: Auto-pend enabled - uint16_t defaultPend:1; //!< The value of the pending data bit in auto ACK packets that are not subject to auto-pend - uint16_t bPendDataReqOnly:1; //!< \brief 0: Use auto-pend for any packet
- //!< 1: Use auto-pend for data request packets only - uint16_t bPanCoord:1; //!< \brief 0: Device is not PAN coordinator
- //!< 1: Device is PAN coordinator - uint16_t maxFrameVersion:2; //!< Reject frames where the frame version field in the FCF is greater than this value - uint16_t fcfReservedMask:3; //!< Value to be AND-ed with the reserved part of the FCF; frame rejected if result is non-zero - uint16_t modifyFtFilter:2; //!< \brief Treatment of MSB of frame type field before frame-type filtering:
- //!< 0: No modification
- //!< 1: Invert MSB
- //!< 2: Set MSB to 0
- //!< 3: Set MSB to 1 - uint16_t bStrictLenFilter:1; //!< \brief 0: Accept acknowledgement frames of any length >= 5
- //!< 1: Accept only acknowledgement frames of length 5 - } newFrameFiltOpt; //!< New value of frameFiltOpt for the running background level operation - struct { - uint8_t bAcceptFt0Beacon:1; //!< \brief Treatment of frames with frame type 000 (beacon):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt1Data:1; //!< \brief Treatment of frames with frame type 001 (data):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt2Ack:1; //!< \brief Treatment of frames with frame type 010 (ACK):
- //!< 0: Reject, unless running ACK receive command
- //!< 1: Always accept - uint8_t bAcceptFt3MacCmd:1; //!< \brief Treatment of frames with frame type 011 (MAC command):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt4Reserved:1; //!< \brief Treatment of frames with frame type 100 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt5Reserved:1; //!< \brief Treatment of frames with frame type 101 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt6Reserved:1; //!< \brief Treatment of frames with frame type 110 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt7Reserved:1; //!< \brief Treatment of frames with frame type 111 (reserved):
- //!< 0: Reject
- //!< 1: Accept - } newFrameTypes; //!< New value of frameTypes for the running background level operation -}; - -//! @} - -//! \addtogroup CMD_IEEE_MOD_SRC_MATCH -//! @{ -#define CMD_IEEE_MOD_SRC_MATCH 0x2003 -struct __RFC_STRUCT rfc_CMD_IEEE_MOD_SRC_MATCH_s { - uint16_t commandNo; //!< The command ID number 0x2003 - struct { - uint8_t bEnable:1; //!< \brief 0: Disable entry
- //!< 1: Enable entry - uint8_t srcPend:1; //!< New value of the pending bit for the entry - uint8_t entryType:1; //!< \brief 0: Extended address
- //!< 1: Short address - } options; - uint8_t entryNo; //!< Index of entry to enable or disable -}; - -//! @} - -//! \addtogroup CMD_IEEE_ABORT_FG -//! @{ -#define CMD_IEEE_ABORT_FG 0x2401 -struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_FG_s { - uint16_t commandNo; //!< The command ID number 0x2401 -}; - -//! @} - -//! \addtogroup CMD_IEEE_STOP_FG -//! @{ -#define CMD_IEEE_STOP_FG 0x2402 -struct __RFC_STRUCT rfc_CMD_IEEE_STOP_FG_s { - uint16_t commandNo; //!< The command ID number 0x2402 -}; - -//! @} - -//! \addtogroup CMD_IEEE_CCA_REQ -//! @{ -#define CMD_IEEE_CCA_REQ 0x2403 -struct __RFC_STRUCT rfc_CMD_IEEE_CCA_REQ_s { - uint16_t commandNo; //!< The command ID number 0x2403 - int8_t currentRssi; //!< The RSSI currently observed on the channel - int8_t maxRssi; //!< The maximum RSSI observed on the channel since Rx was started - struct { - uint8_t ccaState:2; //!< \brief Value of the current CCA state
- //!< 0: Idle
- //!< 1: Busy
- //!< 2: Invalid - uint8_t ccaEnergy:2; //!< \brief Value of the current energy detect CCA state
- //!< 0: Idle
- //!< 1: Busy
- //!< 2: Invalid - uint8_t ccaCorr:2; //!< \brief Value of the current correlator based carrier sense CCA state
- //!< 0: Idle
- //!< 1: Busy
- //!< 2: Invalid - uint8_t ccaSync:1; //!< \brief Value of the current sync found based carrier sense CCA state
- //!< 0: Idle
- //!< 1: Busy - } ccaInfo; -}; - -//! @} - -//! \addtogroup ieeeRxOutput -//! @{ -//! Output structure for CMD_IEEE_RX - -struct __RFC_STRUCT rfc_ieeeRxOutput_s { - uint8_t nTxAck; //!< Total number of transmitted ACK frames - uint8_t nRxBeacon; //!< Number of received beacon frames - uint8_t nRxData; //!< Number of received data frames - uint8_t nRxAck; //!< Number of received acknowledgement frames - uint8_t nRxMacCmd; //!< Number of received MAC command frames - uint8_t nRxReserved; //!< Number of received frames with reserved frame type - uint8_t nRxNok; //!< Number of received frames with CRC error - uint8_t nRxIgnored; //!< Number of frames received that are to be ignored - uint8_t nRxBufFull; //!< Number of received frames discarded because the Rx buffer was full - int8_t lastRssi; //!< RSSI of last received frame - int8_t maxRssi; //!< Highest RSSI observed in the operation - uint8_t __dummy0; - ratmr_t beaconTimeStamp; //!< Time stamp of last received beacon frame -}; - -//! @} - -//! \addtogroup shortAddrEntry -//! @{ -//! Structure for short address entries - -struct __RFC_STRUCT rfc_shortAddrEntry_s { - uint16_t shortAddr; //!< Short address - uint16_t panId; //!< PAN ID -}; - -//! @} - -//! \addtogroup ieeeRxCorrCrc -//! @{ -//! Receive status byte that may be appended to message in receive buffer - -struct __RFC_STRUCT rfc_ieeeRxCorrCrc_s { - struct { - uint8_t corr:6; //!< The correlation value - uint8_t bIgnore:1; //!< 1 if the packet should be rejected by frame filtering, 0 otherwise - uint8_t bCrcErr:1; //!< 1 if the packet was received with CRC error, 0 otherwise - } status; -}; - -//! @} - -//! @} -//! @} -#endif /* IEEE_CMD_H_ */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/api/ieee_mailbox.h b/arch/cpu/cc26x0-cc13x0/rf-core/api/ieee_mailbox.h deleted file mode 100644 index f96c540ad..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/api/ieee_mailbox.h +++ /dev/null @@ -1,75 +0,0 @@ -/****************************************************************************** -* Filename: ieee_mailbox.h -* Revised: $ $ -* Revision: $ $ -* -* Description: Definitions for IEEE 802.15.4 interface -* -* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ -* -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* -* 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. -* -* Neither the name of Texas Instruments Incorporated nor the names of -* its contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -******************************************************************************/ - -#ifndef IEEE_MAILBOX_H_ -#define IEEE_MAILBOX_H_ - -#include "driverlib/rf_mailbox.h" - - -/// \name Radio operation status -///@{ -/// \name Operation not finished -///@{ -#define IEEE_SUSPENDED 0x2001 ///< Operation suspended -///@} -/// \name Operation finished normally -///@{ -#define IEEE_DONE_OK 0x2400 ///< Operation ended normally -#define IEEE_DONE_BUSY 0x2401 ///< CSMA-CA operation ended with failure -#define IEEE_DONE_STOPPED 0x2402 ///< Operation stopped after stop command -#define IEEE_DONE_ACK 0x2403 ///< ACK packet received with pending data bit cleared -#define IEEE_DONE_ACKPEND 0x2404 ///< ACK packet received with pending data bit set -#define IEEE_DONE_TIMEOUT 0x2405 ///< Operation ended due to timeout -#define IEEE_DONE_BGEND 0x2406 ///< FG operation ended because necessary background level - ///< operation ended -#define IEEE_DONE_ABORT 0x2407 ///< Operation aborted by command -///@} -/// \name Operation finished with error -///@{ -#define IEEE_ERROR_PAR 0x2800 ///< Illegal parameter -#define IEEE_ERROR_NO_SETUP 0x2801 ///< Operation using Rx or Tx attemted when not in 15.4 mode -#define IEEE_ERROR_NO_FS 0x2802 ///< Operation using Rx or Tx attemted without frequency synth configured -#define IEEE_ERROR_SYNTH_PROG 0x2803 ///< Synthesizer programming failed to complete on time -#define IEEE_ERROR_RXOVF 0x2804 ///< Receiver overflowed during operation -#define IEEE_ERROR_TXUNF 0x2805 ///< Transmitter underflowed during operation -///@} -///@} - -#endif /* IEEE_MAILBOX_H_ */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/ble-cc2650.c b/arch/cpu/cc26x0-cc13x0/rf-core/ble-cc2650.c deleted file mode 100644 index 6510ac50e..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/ble-cc2650.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 2017, Graz University of Technology - * 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 - * BLE radio for the TI CC26xx platform - * - * \author - * Michael Spoerk - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/radio.h" -#include "os/dev/ble-hal.h" -#include "rf-core/ble-hal/ble-hal-cc26xx.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#include "sys/log.h" -#define LOG_MODULE "RADIO" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -static uint16_t adv_interval; -static ble_adv_type_t adv_type; -static ble_addr_type_t adv_own_addr_type; -static uint8_t adv_channel_map; -static uint16_t buffer_size = 0; -/*---------------------------------------------------------------------------*/ -static uint16_t scan_interval; -static uint16_t scan_window; -static ble_scan_type_t scan_type; -static ble_addr_type_t scan_own_addr_type; -/*---------------------------------------------------------------------------*/ -static ble_addr_type_t initiator_peer_addr_type; -static uint8_t initiator_peer_addr[BLE_ADDR_SIZE]; -/*---------------------------------------------------------------------------*/ -static uint16_t connection_interval; -static uint16_t connection_latency; -static uint16_t connection_timeout; -/*---------------------------------------------------------------------------*/ -static int -init(void) -{ - int result = ble_hal.reset(); - return result == BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static int -send(const void *payload, unsigned short payload_len) -{ - uint8_t res; - res = ble_hal.send((void *)payload, payload_len); - LOG_DBG("ble-mode send() %d bytes\n", payload_len); - if(res == BLE_RESULT_OK) { - return RADIO_TX_OK; - } else { - LOG_ERR("ble-mode send() error: %d\n", res); - return RADIO_TX_ERR; - } -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - ble_hal.disconnect(0, 0); - return 1; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - unsigned int temp; - - if(!value) { - return RADIO_RESULT_INVALID_VALUE; - } - - switch(param) { - case RADIO_CONST_CHANNEL_MIN: - *value = BLE_DATA_CHANNEL_MIN; - return RADIO_RESULT_OK; - case RADIO_CONST_CHANNEL_MAX: - *value = BLE_DATA_CHANNEL_MAX; - return RADIO_RESULT_OK; - case RADIO_CONST_BLE_BUFFER_SIZE: - if(buffer_size == 0) { - ble_hal.read_buffer_size((unsigned int *)&buffer_size, &temp); - } - memcpy(value, &buffer_size, 2); - return RADIO_RESULT_OK; - case RADIO_CONST_BLE_BUFFER_AMOUNT: - ble_hal.read_buffer_size(&temp, (unsigned int *)value); - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_CONN_INTERVAL: - ble_hal.read_connection_interval(0, (unsigned int *)value); - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - switch(param) { - case RADIO_PARAM_BLE_ADV_INTERVAL: - if((value > BLE_ADV_INTERVAL_MAX) || (value < BLE_ADV_INTERVAL_MIN)) { - return RADIO_RESULT_INVALID_VALUE; - } - adv_interval = (uint16_t)value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_ADV_TYPE: - adv_type = value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_ADV_OWN_ADDR_TYPE: - adv_own_addr_type = value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_ADV_CHANNEL_MAP: - adv_channel_map = value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_ADV_ENABLE: - if(value) { - /* set the advertisement parameter before enabling */ - ble_hal.set_adv_param(adv_interval, adv_type, - adv_own_addr_type, adv_channel_map); - } - ble_hal.set_adv_enable(value); - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_SCAN_INTERVAL: - if((value > BLE_SCAN_INTERVAL_MAX) || (value < BLE_SCAN_INTERVAL_MIN)) { - return RADIO_RESULT_INVALID_VALUE; - } - scan_interval = (uint16_t)value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_SCAN_WINDOW: - if((value > BLE_SCAN_INTERVAL_MAX) || (value < BLE_SCAN_INTERVAL_MIN)) { - return RADIO_RESULT_INVALID_VALUE; - } - scan_window = (uint16_t)value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_SCAN_TYPE: - scan_type = value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_SCAN_OWN_ADDR_TYPE: - scan_own_addr_type = value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_SCAN_ENABLE: - if(value) { - ble_hal.set_scan_param(scan_type, scan_interval, - scan_window, scan_own_addr_type); - } - ble_hal.set_scan_enable(value, 0); - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_PEER_ADDR_TYPE: - initiator_peer_addr_type = value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_CONN_INTERVAL: - connection_interval = value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_CONN_LATENCY: - connection_latency = value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_CONN_SUPERVISION_TIMEOUT: - connection_timeout = value; - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_INITIATOR_ENABLE: - if(value) { - ble_hal.create_connection(scan_interval, scan_window, - initiator_peer_addr_type, - initiator_peer_addr, - scan_own_addr_type, - connection_interval, - connection_latency, - connection_timeout); - } else { - ble_hal.create_connection_cancel(); - } - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_CONN_UPDATE: - if(value) { - return ble_hal.connection_update(0, connection_interval, connection_latency, connection_timeout); - } else { - return RADIO_RESULT_INVALID_VALUE; - } - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - switch(param) { - case RADIO_CONST_BLE_BD_ADDR: - if(size != BLE_ADDR_SIZE || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - ble_hal.read_bd_addr(dest); - return RADIO_RESULT_OK; - } - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - switch(param) { - case RADIO_PARAM_BLE_ADV_PAYLOAD: - if(size <= 0 || size >= BLE_ADV_DATA_LEN || !src) { - return RADIO_RESULT_INVALID_VALUE; - } - ble_hal.set_adv_data((unsigned short)size, (char *)src); - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_ADV_SCAN_RESPONSE: - if(size <= 0 || size >= BLE_SCAN_RESP_DATA_LEN || !src) { - return RADIO_RESULT_INVALID_VALUE; - } - ble_hal.set_scan_resp_data((unsigned short)size, (char *)src); - return RADIO_RESULT_OK; - case RADIO_PARAM_BLE_PEER_ADDR: - if(size <= 0 || size > BLE_ADDR_SIZE || !src) { - return RADIO_RESULT_INVALID_VALUE; - } - memcpy(initiator_peer_addr, src, size); - return RADIO_RESULT_OK; - } - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -const struct radio_driver ble_cc2650_driver = { - init, - NULL, - NULL, - send, - NULL, - NULL, - NULL, - NULL, - on, - off, - get_value, - set_value, - get_object, - set_object, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/ble-hal-cc26xx.c b/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/ble-hal-cc26xx.c deleted file mode 100644 index 3245b9c4f..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/ble-hal-cc26xx.c +++ /dev/null @@ -1,1044 +0,0 @@ -/* - * Copyright (c) 2017, Graz University of Technology - * Copyright (c) 2018, University of Bristol - http://www.bristol.ac.uk/ - * 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 - * BLE radio hardware abstraction implementation for the TI CC26XX controller - * - * \author - * Michael Spoerk - * Jinyan BAI - */ -/*---------------------------------------------------------------------------*/ - -#include "lpm.h" - -#include "sys/rtimer.h" -#include "sys/process.h" - -#include "os/dev/ble-hal.h" -#include "dev/oscillators.h" - -#include "ble-addr.h" - -#include "net/netstack.h" -#include "net/packetbuf.h" - -#include "rf_data_entry.h" -#include "rf-core/rf-core.h" -#include "rf_ble_cmd.h" -#include "lib/random.h" - -#include "ioc.h" -#include "ti-lib.h" -#include "inc/hw_types.h" -#include "inc/hw_rfc_dbell.h" - -#include - -#include "rf-core/ble-hal/rf-ble-cmd.h" -#if RADIO_CONF_BLE5 -#include "rf_patches/rf_patch_cpe_bt5.h" -#endif -/*---------------------------------------------------------------------------*/ -#include "sys/log.h" -#define LOG_MODULE "BLE-RADIO" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -#define CMD_GET_STATUS(X) (((rfc_radioOp_t *)X)->status) -#define RX_ENTRY_STATUS(X) (((rfc_dataEntry_t *)X)->status) -#define RX_ENTRY_LENGTH(X) (((rfc_dataEntry_t *)X)->length) -#define RX_ENTRY_TYPE(X) (((rfc_dataEntry_t *)X)->config.type) -#define RX_ENTRY_NEXT_ENTRY(X) (((rfc_dataEntry_t *)X)->pNextEntry) -#define RX_ENTRY_DATA_LENGTH(X) ((X)[8]) -#define RX_ENTRY_DATA_PTR(X) (&(X)[9]) -#define TX_ENTRY_STATUS(X) RX_ENTRY_STATUS(X) -#define TX_ENTRY_LENGTH(X) RX_ENTRY_LENGTH(X) -#define TX_ENTRY_TYPE(X) RX_ENTRY_TYPE(X) -#define TX_ENTRY_NEXT_ENTRY(X) RX_ENTRY_NEXT_ENTRY(X) -#define TX_ENTRY_FRAME_TYPE(X) ((X)[8]) -#define TX_ENTRY_DATA_PTR(X) (&(X)[9]) -/*---------------------------------------------------------------------------*/ -/* LPM */ -/*---------------------------------------------------------------------------*/ -static uint8_t -request(void) -{ - if(rf_core_is_accessible()) { - return LPM_MODE_SLEEP; - } - - return LPM_MODE_MAX_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -LPM_MODULE(cc26xx_ble_lpm_module, request, NULL, NULL, LPM_DOMAIN_NONE); -/*---------------------------------------------------------------------------*/ -/* timing utilities */ -#define TIME_UNIT_MS 1000 /* 1000 times per second */ -#define TIME_UNIT_0_625_MS 1600 /* 1600 times per second */ -#define TIME_UNIT_1_25_MS 800 /* 800 times per second */ -#define TIME_UNIT_10_MS 100 /* 100 times per second */ -#define TIME_UNIT_RF_CORE 4000000 /* runs at 4 MHz */ -#define TIME_UNIT_RTIMER RTIMER_SECOND - -rtimer_clock_t -ticks_from_unit(uint32_t value, uint32_t unit) -{ - double temp = (((double)value) / unit) * RTIMER_SECOND; - return (rtimer_clock_t)temp; -} -uint32_t -ticks_to_unit(rtimer_clock_t value, uint32_t unit) -{ - double temp = (((double)value) / RTIMER_SECOND) * unit; - return (uint32_t)temp; -} -/*---------------------------------------------------------------------------*/ -#if RADIO_CONF_BLE5 -#define CMD_BUFFER_SIZE 28 -#define PARAM_BUFFER_SIZE 48 -#define OUTPUT_BUFFER_SIZE 24 -#else -#define CMD_BUFFER_SIZE 24 -#define PARAM_BUFFER_SIZE 36 -#define OUTPUT_BUFFER_SIZE 24 -#endif -/*---------------------------------------------------------------------------*/ -/* ADVERTISING data structures */ -#define ADV_RX_BUFFERS_OVERHEAD 8 -#define ADV_RX_BUFFERS_DATA_LEN 60 -#define ADV_RX_BUFFERS_LEN (ADV_RX_BUFFERS_OVERHEAD + ADV_RX_BUFFERS_DATA_LEN) -#define ADV_RX_BUFFERS_NUM 2 - -#define ADV_PREPROCESSING_TIME_TICKS 65 - -typedef struct { - /* PARAMETER */ - uint16_t adv_interval; - ble_adv_type_t adv_type; - ble_addr_type_t own_addr_type; - uint8_t channel_map; - uint8_t adv_data_len; - uint8_t adv_data[BLE_ADV_DATA_LEN]; - uint8_t scan_rsp_data_len; - uint8_t scan_rsp_data[BLE_ADV_DATA_LEN]; - /* STATE information */ - uint8_t active; - rtimer_clock_t start_rt; - struct rtimer timer; - /* utility */ - uint8_t cmd_buf[CMD_BUFFER_SIZE]; - uint8_t param_buf[PARAM_BUFFER_SIZE]; - uint8_t output_buf[OUTPUT_BUFFER_SIZE]; - dataQueue_t rx_queue; - uint8_t rx_buffers[ADV_RX_BUFFERS_NUM][ADV_RX_BUFFERS_LEN]; - uint8_t *rx_queue_current; -} ble_adv_param_t; - -static ble_adv_param_t adv_param; -static void advertising_event(struct rtimer *t, void *ptr); -/*---------------------------------------------------------------------------*/ -/* CONNECTION data structures */ -#define BLE_MODE_MAX_CONNECTIONS 1 - -/* maximum packet length that is transmitted during a single connection event*/ -#ifdef BLE_MODE_CONF_CONN_MAX_PACKET_SIZE -#define BLE_MODE_CONN_MAX_PACKET_SIZE BLE_MODE_CONF_CONN_MAX_PACKET_SIZE -#else -#define BLE_MODE_CONN_MAX_PACKET_SIZE 256 -#endif - -#define CONN_BLE_BUFFER_SIZE 27 /* maximum size of the data buffer */ - -#define CONN_RX_BUFFERS_OVERHEAD 8 -#define CONN_RX_BUFFERS_DATA_LEN 60 -#define CONN_RX_BUFFERS_LEN (CONN_RX_BUFFERS_OVERHEAD + CONN_RX_BUFFERS_DATA_LEN) -#define CONN_RX_BUFFERS_NUM 12 - -/* custom status used for tx buffers */ -#define DATA_ENTRY_FREE 5 -#define DATA_ENTRY_QUEUED 6 - -#define CONN_TX_BUFFERS_OVERHEAD 9 -#define CONN_TX_BUFFERS_DATA_LEN 27 -#define CONN_TX_BUFFERS_LEN (CONN_TX_BUFFERS_OVERHEAD + CONN_TX_BUFFERS_DATA_LEN) -#define CONN_TX_BUFFERS_NUM 12 - -#define CONN_WIN_SIZE 1 -#define CONN_WIN_OFFSET 20 - -#define CONN_EVENT_LATENCY_THRESHOLD 10 -#define CONN_WINDOW_WIDENING_TICKS 30 /* appr. 0.46 ms */ -#define CONN_PREPROCESSING_TIME_TICKS 100 /* 1.5 ms */ - -#define CONN_UPDATE_DELAY 6 - -typedef struct { - /* PARAMETER */ - uint8_t peer_address[BLE_ADDR_SIZE]; - uint32_t access_address; - uint8_t crc_init_0; - uint8_t crc_init_1; - uint8_t crc_init_2; - uint8_t win_size; - uint16_t win_offset; - uint16_t interval; - uint16_t latency; - uint16_t timeout; - uint64_t channel_map; - uint8_t num_used_channels; - uint8_t hop; - uint8_t sca; - rtimer_clock_t timestamp_rt; - /* STATE information */ - uint8_t active; - uint16_t counter; - uint8_t unmapped_channel; - uint8_t mapped_channel; - rtimer_clock_t start_rt; - uint16_t conn_handle; - struct rtimer timer; - /* utility */ - uint8_t cmd_buf[CMD_BUFFER_SIZE]; - uint8_t param_buf[PARAM_BUFFER_SIZE]; - uint8_t output_buf[OUTPUT_BUFFER_SIZE]; - dataQueue_t rx_queue; - uint8_t rx_buffers[CONN_RX_BUFFERS_NUM][CONN_RX_BUFFERS_LEN]; - uint8_t *rx_queue_current; - dataQueue_t tx_queue; - uint8_t tx_buffers[CONN_TX_BUFFERS_NUM][CONN_TX_BUFFERS_LEN]; - uint8_t tx_buffers_sent; - uint16_t skipped_events; - /* channel map update */ - uint64_t channel_update_channel_map; - uint16_t channel_update_counter; - uint8_t channel_update_num_used_channels; - /* connection parameter update */ - uint8_t conn_update_win_size; - uint16_t conn_update_win_offset; - uint16_t conn_update_interval; - uint16_t conn_update_latency; - uint16_t conn_update_timeout; - uint16_t conn_update_counter; -} ble_conn_param_t; - -static ble_conn_param_t conn_param[BLE_MODE_MAX_CONNECTIONS]; - -static uint16_t conn_counter = 0; - -static void connection_event_slave(struct rtimer *t, void *ptr); -/*---------------------------------------------------------------------------*/ -PROCESS(ble_hal_conn_rx_process, "BLE/CC26xx connection RX process"); -process_event_t rx_data_event; -/*---------------------------------------------------------------------------*/ -static void -setup_buffers(void) -{ - uint8_t conn_count; - ble_conn_param_t *conn; - uint8_t i; - rfc_dataEntry_t *entry; - - /* setup advertisement RX buffer (circular buffer) */ - memset(&adv_param, 0x00, sizeof(ble_adv_param_t)); - memset(&adv_param.rx_queue, 0x00, sizeof(adv_param.rx_queue)); - adv_param.rx_queue.pCurrEntry = adv_param.rx_buffers[0]; - adv_param.rx_queue.pLastEntry = NULL; - adv_param.rx_queue_current = adv_param.rx_buffers[0]; - for(i = 0; i < ADV_RX_BUFFERS_NUM; i++) { - memset(&adv_param.rx_buffers[i], 0x00, ADV_RX_BUFFERS_LEN); - entry = (rfc_dataEntry_t *)adv_param.rx_buffers[i]; - entry->pNextEntry = adv_param.rx_buffers[(i + 1) % ADV_RX_BUFFERS_NUM]; - entry->config.lenSz = 1; - entry->length = ADV_RX_BUFFERS_DATA_LEN; - } - - memset(conn_param, 0x00, sizeof(ble_conn_param_t) * BLE_MODE_MAX_CONNECTIONS); - for(conn_count = 0; conn_count < BLE_MODE_MAX_CONNECTIONS; conn_count++) { - /* setup connection RX buffer (circular buffer) */ - conn = &conn_param[conn_count]; - memset(&conn->rx_queue, 0x00, sizeof(conn->rx_queue)); - conn->rx_queue.pCurrEntry = conn->rx_buffers[0]; - conn->rx_queue.pLastEntry = NULL; - conn->rx_queue_current = conn->rx_buffers[0]; - - for(i = 0; i < CONN_RX_BUFFERS_NUM; i++) { - memset(&conn->rx_buffers[i], 0x00, CONN_RX_BUFFERS_LEN); - entry = (rfc_dataEntry_t *)conn->rx_buffers[i]; - entry->pNextEntry = conn->rx_buffers[(i + 1) % CONN_RX_BUFFERS_NUM]; - entry->config.lenSz = 1; - entry->length = CONN_RX_BUFFERS_DATA_LEN; - } - - /* setup connection TX buffer (buffers are added on demand to the queue) */ - memset(&conn->tx_queue, 0x00, sizeof(conn->tx_queue)); - conn->tx_queue.pCurrEntry = NULL; - conn->tx_queue.pLastEntry = NULL; - - for(i = 0; i < CONN_TX_BUFFERS_NUM; i++) { - memset(&conn->tx_buffers[i], 0x00, CONN_TX_BUFFERS_LEN); - entry = (rfc_dataEntry_t *)conn->tx_buffers[i]; - entry->config.lenSz = 1; - entry->status = DATA_ENTRY_FREE; - } - } -} -/*---------------------------------------------------------------------------*/ -static ble_conn_param_t * -get_connection_for_handle(uint8_t conn_handle) -{ - uint8_t i; - for(i = 0; i < BLE_MODE_MAX_CONNECTIONS; i++) { - if(conn_param[i].conn_handle == conn_handle) { - return &conn_param[i]; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static uint8_t * -tx_queue_get_buffer(ble_conn_param_t *param) -{ - uint8_t i; - rfc_dataEntry_t *entry; - for(i = 0; i < CONN_TX_BUFFERS_NUM; i++) { - entry = (rfc_dataEntry_t *)param->tx_buffers[i]; - if(entry->status == DATA_ENTRY_FREE) { - return (uint8_t *)entry; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -tx_queue_count_free_buffers(ble_conn_param_t *param) -{ - uint16_t i; - uint16_t free_bufs = 0; - for(i = 0; i < CONN_TX_BUFFERS_NUM; i++) { - if(TX_ENTRY_STATUS(param->tx_buffers[i]) == DATA_ENTRY_FREE) { - free_bufs++; - } - } - return free_bufs; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -tx_queue_data_to_transmit(ble_conn_param_t *param) -{ - uint16_t i; - for(i = 0; i < CONN_TX_BUFFERS_NUM; i++) { - if(TX_ENTRY_STATUS(param->tx_buffers[i]) == DATA_ENTRY_QUEUED) { - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -ble_result_t -on(void) -{ - oscillators_request_hf_xosc(); - if(!rf_core_is_accessible()) { - /* boot the rf core */ - - /* boot and apply Bluetooth 5 Patch */ - if(rf_core_power_up() != RF_CORE_CMD_OK) { - LOG_ERR("rf_core_boot: rf_core_power_up() failed\n"); - rf_core_power_down(); - return RF_CORE_CMD_ERROR; - } - -#if RADIO_CONF_BLE5 - /* Apply Bluetooth 5 patch, if applicable */ - rf_patch_cpe_bt5(); -#endif - if(rf_core_start_rat() != RF_CORE_CMD_OK) { - LOG_ERR("rf_core_boot: rf_core_start_rat() failed\n"); - rf_core_power_down(); - return RF_CORE_CMD_ERROR; - } - rf_core_setup_interrupts(); - oscillators_switch_to_hf_xosc(); - - if(rf_ble_cmd_setup_ble_mode() != RF_BLE_CMD_OK) { - LOG_ERR("could not setup rf-core to BLE mode\n"); - return BLE_RESULT_ERROR; - } - } - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -void -off(void) -{ - rf_core_power_down(); - oscillators_switch_to_hf_rc(); -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -reset(void) -{ - LOG_INFO("maximum connections: %4d\n", BLE_MODE_MAX_CONNECTIONS); - LOG_INFO("max. packet length: %4d\n", BLE_MODE_CONN_MAX_PACKET_SIZE); - lpm_register_module(&cc26xx_ble_lpm_module); - rf_core_set_modesel(); - setup_buffers(); - if(on() != BLE_RESULT_OK) { - return BLE_RESULT_ERROR; - } - off(); - if(!process_is_running(&ble_hal_conn_rx_process)) { - rx_data_event = process_alloc_event(); - process_start(&ble_hal_conn_rx_process, NULL); - } - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -read_bd_addr(uint8_t *addr) -{ - ble_addr_cpy_to(addr); - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -read_buffer_size(unsigned int *buf_len, unsigned int *num_buf) -{ - uint16_t i; - uint16_t ll_buffers = CONN_TX_BUFFERS_NUM; - uint16_t packet_buffers; - uint16_t buffer_size; - for(i = 0; i < conn_counter; i++) { - ll_buffers = MIN(ll_buffers, tx_queue_count_free_buffers(&conn_param[i])); - } - packet_buffers = ll_buffers / (BLE_MODE_CONN_MAX_PACKET_SIZE / CONN_BLE_BUFFER_SIZE); - buffer_size = BLE_MODE_CONN_MAX_PACKET_SIZE; - memcpy(buf_len, &buffer_size, 2); - memcpy(num_buf, &packet_buffers, 2); - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -set_adv_param(unsigned int adv_int, ble_adv_type_t type, - ble_addr_type_t own_type, unsigned short adv_map) -{ - adv_param.adv_interval = adv_int; - adv_param.adv_type = type; - adv_param.own_addr_type = own_type; - adv_param.channel_map = adv_map; - - LOG_INFO("advertising parameter: interval: %4d, channels: %2d\n", - adv_param.adv_interval, adv_param.channel_map); - - LOG_DBG("interval: %16u (ms)\n", adv_param.adv_interval); - LOG_DBG("type: %16u\n", adv_param.adv_type); - LOG_DBG("addr_type:%16u\n", adv_param.own_addr_type); - LOG_DBG("channels: %16u\n", adv_param.channel_map); - - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -read_adv_channel_tx_power(short *power) -{ - return BLE_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -set_adv_data(unsigned short data_len, char *data) -{ - if(data_len > BLE_ADV_DATA_LEN) { - LOG_WARN("BLE-HAL: adv_data too long\n"); - return BLE_RESULT_INVALID_PARAM; - } - adv_param.adv_data_len = data_len; - memcpy(adv_param.adv_data, data, data_len); - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -set_scan_resp_data(unsigned short data_len, char *data) -{ - if(data_len > BLE_SCAN_RESP_DATA_LEN) { - LOG_WARN("BLE-HAL: scan_resp_data too long\n"); - return BLE_RESULT_INVALID_PARAM; - } - adv_param.scan_rsp_data_len = data_len; - memcpy(adv_param.scan_rsp_data, data, data_len); - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -set_adv_enable(unsigned short enable) -{ - uint32_t now = RTIMER_NOW(); - if((enable) && (!adv_param.active)) { - adv_param.start_rt = now + ticks_from_unit(adv_param.adv_interval, - TIME_UNIT_1_25_MS); - rtimer_set(&adv_param.timer, adv_param.start_rt, - 0, advertising_event, (void *)&adv_param); - } - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -send_frame(ble_conn_param_t *conn, uint8_t *data, uint8_t data_len, uint8_t frame_type) -{ - uint8_t *tx_buffer = tx_queue_get_buffer(conn); - if(tx_buffer == NULL) { - LOG_WARN("BLE-HAL: send_frame: no TX buffer available (conn_handle: 0x%04X)\n", conn->conn_handle); - return BLE_RESULT_ERROR; - } - if(data_len > CONN_BLE_BUFFER_SIZE) { - LOG_WARN("BLE-HAL: send_frame: data too long (%d bytes)\n", data_len); - return BLE_RESULT_ERROR; - } - - memcpy(TX_ENTRY_DATA_PTR(tx_buffer), data, data_len); - TX_ENTRY_LENGTH(tx_buffer) = data_len + 1; - TX_ENTRY_STATUS(tx_buffer) = DATA_ENTRY_QUEUED; - TX_ENTRY_FRAME_TYPE(tx_buffer) = frame_type; - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -connection_update(unsigned int connection_handle, unsigned int conn_interval, - unsigned int conn_latency, unsigned int supervision_timeout) -{ - uint8_t len = 0; - uint8_t data[24]; - ble_conn_param_t *conn = get_connection_for_handle(connection_handle); - - if(conn == NULL) { - return BLE_RESULT_ERROR; - } - - LOG_INFO("connection_update: handle: 0x%04X, interval: %4d, latency: %2d, timeout: %4d\n", - connection_handle, conn_interval, conn_latency, supervision_timeout); -#if UIP_CONF_ROUTER - uint16_t instant = conn->counter + CONN_UPDATE_DELAY; - /* prepare connection update packet */ - data[0] = BLE_LL_CONN_UPDATE_REQ; - data[1] = conn->win_size; - data[2] = 0; - data[3] = 0; - memcpy(&data[4], &conn_interval, 2); - memcpy(&data[6], &conn_latency, 2); - memcpy(&data[8], &supervision_timeout, 2); - memcpy(&data[10], &instant, 2); - len = 12; - /* set new connection */ - conn->conn_update_win_size = conn->win_size; - conn->conn_update_interval = conn_interval; - conn->conn_update_latency = conn_latency; - conn->conn_update_timeout = supervision_timeout; - conn->conn_update_counter = instant; - - if(send_frame(conn, data, len, BLE_DATA_PDU_LLID_CONTROL) != BLE_RESULT_OK) { - LOG_ERR("connection_update: send frame was NOT successful\n"); - return BLE_RESULT_ERROR; - } -#else - data[0] = BLE_LL_CONN_PARAM_REQ; - memcpy(&data[1], &conn_interval, 2); /* interval min */ - memcpy(&data[3], &conn_interval, 2); /* interval max */ - memcpy(&data[5], &conn_latency, 2); /* latency */ - memcpy(&data[7], &supervision_timeout, 2); /* supervision timeout */ - memcpy(&data[9], &conn_interval, 1); /* preferred periodicity */ - memcpy(&data[10], &conn->counter, 2); /* referenc conn event count */ - memset(&data[12], 0xFF, 12); /* offset 0 to 5 */ - len = 24; - - if(send_frame(conn, data, len, BLE_DATA_PDU_LLID_CONTROL) != BLE_RESULT_OK) { - LOG_ERR("connection_update: send frame was NOT successful\n"); - return BLE_RESULT_ERROR; - } -#endif - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -send(void *buf, unsigned short buf_len) -{ - uint16_t loop_data; - uint16_t loop_conn; - ble_conn_param_t *conn; - uint8_t *data; - uint16_t data_len; - linkaddr_t dest_addr; - linkaddr_t conn_addr; - uint8_t result; - - linkaddr_copy(&dest_addr, packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - - LOG_DBG("ble-hal: sending %d bytes\n", buf_len); - - for(loop_conn = 0; loop_conn < conn_counter; loop_conn++) { - conn = &conn_param[loop_conn]; - ble_addr_to_eui64(conn_addr.u8, conn->peer_address); - if((linkaddr_cmp(&dest_addr, &linkaddr_null) != 0) || (linkaddr_cmp(&dest_addr, &conn_addr) != 0)) { - for(loop_data = 0; loop_data < buf_len; loop_data += CONN_BLE_BUFFER_SIZE) { - data = &((uint8_t *)buf)[loop_data]; - data_len = MIN((buf_len - loop_data), CONN_BLE_BUFFER_SIZE); - if(loop_data == 0) { - result = send_frame(conn, data, data_len, BLE_DATA_PDU_LLID_DATA_MESSAGE); - } else { - result = send_frame(conn, data, data_len, BLE_DATA_PDU_LLID_DATA_FRAGMENT); - } - if(result != BLE_RESULT_OK) { - LOG_WARN("ble-hal: send was unsuccessful\n"); - return result; - } - } - } - } - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static ble_result_t -read_connection_interval(unsigned int conn_handle, unsigned int *conn_interval) -{ - ble_conn_param_t *conn = get_connection_for_handle(conn_handle); - if(conn == NULL) { - memset(conn_interval, 0x00, sizeof(uint16_t)); - return BLE_RESULT_ERROR; - } - memcpy(conn_interval, &conn->interval, sizeof(uint16_t)); - return BLE_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -const struct ble_hal_driver ble_hal = -{ - reset, - read_bd_addr, - read_buffer_size, - set_adv_param, - read_adv_channel_tx_power, - set_adv_data, - set_scan_resp_data, - set_adv_enable, - NULL, - NULL, - NULL, - NULL, - connection_update, - NULL, - send, - NULL, - read_connection_interval -}; -/*---------------------------------------------------------------------------*/ -static void -advertising_rx(ble_adv_param_t *param) -{ - uint8_t i; - uint8_t offset = 14; - uint8_t *rx_data; - ble_conn_param_t *c_param = &conn_param[0]; - rtimer_clock_t wakeup; - - while(RX_ENTRY_STATUS(param->rx_queue_current) == DATA_ENTRY_FINISHED) { - rx_data = RX_ENTRY_DATA_PTR(param->rx_queue_current); - - if(CMD_GET_STATUS(param->cmd_buf) == RF_CORE_RADIO_OP_STATUS_BLE_DONE_CONNECT) { - /* parsing connection parameter */ - for(i = 0; i < BLE_ADDR_SIZE; i++) { - c_param->peer_address[i] = rx_data[BLE_ADDR_SIZE + 1 - i]; - } - memcpy(&c_param->access_address, &rx_data[offset], 4); - memcpy(&c_param->crc_init_0, &rx_data[offset + 4], 1); - memcpy(&c_param->crc_init_1, &rx_data[offset + 5], 1); - memcpy(&c_param->crc_init_2, &rx_data[offset + 6], 1); - memcpy(&c_param->win_size, &rx_data[offset + 7], 1); - memcpy(&c_param->win_offset, &rx_data[offset + 8], 2); - memcpy(&c_param->interval, &rx_data[offset + 10], 2); - memcpy(&c_param->latency, &rx_data[offset + 12], 2); - memcpy(&c_param->timeout, &rx_data[offset + 14], 2); - memcpy(&c_param->channel_map, &rx_data[offset + 16], 5); - memcpy(&c_param->hop, &rx_data[offset + 21], 1); - memcpy(&c_param->sca, &rx_data[offset + 21], 1); - memcpy(&c_param->timestamp_rt, &rx_data[offset + 24], 4); - - /* convert all received timing values to rtimer ticks */ - - c_param->timestamp_rt = ticks_from_unit(c_param->timestamp_rt, TIME_UNIT_RF_CORE); - c_param->hop = c_param->hop & 0x1F; - c_param->sca = (c_param->sca >> 5) & 0x07; - - LOG_INFO("connection created: conn_int: %4u, latency: %3u, channel_map: %8llX\n", - c_param->interval, c_param->latency, c_param->channel_map); - - LOG_DBG("access address: 0x%08lX\n", c_param->access_address); - LOG_DBG("crc0: 0x%02X\n", c_param->crc_init_0); - LOG_DBG("crc1: 0x%02X\n", c_param->crc_init_1); - LOG_DBG("crc2: 0x%02X\n", c_param->crc_init_2); - LOG_DBG("win_size: %4u\n", c_param->win_size); - LOG_DBG("win_offset: %4u\n", c_param->win_offset); - LOG_DBG("interval: %4u\n", c_param->interval); - LOG_DBG("latency: %4u\n", c_param->latency); - LOG_DBG("timeout: %4u\n", c_param->timeout); - LOG_DBG("channel_map: %llX\n", c_param->channel_map); - - /* calculate the first anchor point - * (add an interval, because we skip the first connection event ) */ - wakeup = c_param->timestamp_rt + ticks_from_unit(c_param->win_offset, TIME_UNIT_1_25_MS) - CONN_WINDOW_WIDENING_TICKS; - wakeup += ticks_from_unit(c_param->interval, TIME_UNIT_1_25_MS) - CONN_PREPROCESSING_TIME_TICKS; - rtimer_set(&c_param->timer, wakeup, 0, connection_event_slave, (void *)c_param); - - /* initialization for the connection */ - c_param->counter = 0; - c_param->unmapped_channel = 0; - c_param->conn_handle = conn_counter; - c_param->active = 1; - conn_counter++; - LOG_INFO("BLE-HAL: connection (0x%04X) created\n", c_param->conn_handle); - } - - /* free current entry (clear BLE data length & reset status) */ - RX_ENTRY_DATA_LENGTH(param->rx_queue_current) = 0; - RX_ENTRY_STATUS(param->rx_queue_current) = DATA_ENTRY_PENDING; - param->rx_queue_current = RX_ENTRY_NEXT_ENTRY(param->rx_queue_current); - } -} -/*---------------------------------------------------------------------------*/ -static void -advertising_event(struct rtimer *t, void *ptr) -{ - ble_adv_param_t *param = (ble_adv_param_t *)ptr; - uint32_t wakeup; - - if(on() != BLE_RESULT_OK) { - LOG_ERR("BLE-HAL: advertising event: could not enable rf core\n"); - return; - } - - rf_ble_cmd_create_adv_params(param->param_buf, ¶m->rx_queue, - param->adv_data_len, param->adv_data, - param->scan_rsp_data_len, param->scan_rsp_data, - param->own_addr_type, (uint8_t *)BLE_ADDR_LOCATION); - - /* advertising on advertisement channel 1*/ - if(param->channel_map & BLE_ADV_CHANNEL_1_MASK) { - rf_ble_cmd_create_adv_cmd(param->cmd_buf, BLE_ADV_CHANNEL_1, - param->param_buf, param->output_buf); - rf_ble_cmd_send(param->cmd_buf); - rf_ble_cmd_wait(param->cmd_buf); - } - - off(); - advertising_rx(param); - - if(conn_param[0].active == 1) { - LOG_INFO("stop advertising\n"); - return; - } - - param->start_rt = param->start_rt + ticks_from_unit(param->adv_interval, TIME_UNIT_MS); - wakeup = adv_param.start_rt - ADV_PREPROCESSING_TIME_TICKS; - rtimer_set(¶m->timer, wakeup, 0, advertising_event, (void *)param); -} -/*---------------------------------------------------------------------------*/ -static void -update_data_channel(ble_conn_param_t *param) -{ - uint8_t i; - uint8_t j; - uint8_t remap_index; - /* perform the data channel selection according to BLE standard */ - - /* calculate unmapped channel*/ - param->unmapped_channel = (param->unmapped_channel + param->hop) % (BLE_DATA_CHANNEL_MAX + 1); - - /* map the calculated channel */ - if(param->channel_map & (1ULL << param->unmapped_channel)) { - /* channel is marked as used */ - param->mapped_channel = param->unmapped_channel; - } else { - remap_index = param->unmapped_channel % param->num_used_channels; - j = 0; - for(i = 0; i < (BLE_DATA_CHANNEL_MAX + 1); i++) { - if(param->channel_map & (1ULL << i)) { - if(j == remap_index) { - param->mapped_channel = i; - } - j++; - } - } - } -} -/*---------------------------------------------------------------------------*/ -static void -process_ll_ctrl_msg(ble_conn_param_t *conn, uint8_t input_len, uint8_t *input, uint8_t *output_len, uint8_t *output) -{ - uint8_t op_code = input[0]; - uint16_t interval; - uint16_t latency; - uint16_t timeout; - uint64_t channel_map = 0; - uint16_t instant = 0; - uint8_t i; - - if(op_code == BLE_LL_CONN_UPDATE_REQ) { - LOG_INFO("BLE-HAL: connection update request received\n"); - memcpy(&conn->conn_update_win_size, &input[1], 1); - memcpy(&conn->conn_update_win_offset, &input[2], 2); - memcpy(&conn->conn_update_interval, &input[4], 2); - memcpy(&conn->conn_update_latency, &input[6], 2); - memcpy(&conn->conn_update_timeout, &input[8], 2); - memcpy(&conn->conn_update_counter, &input[10], 2); - } else if(op_code == BLE_LL_CHANNEL_MAP_REQ) { - LOG_INFO("BLE-HAL: channel map update received\n"); - memcpy(&channel_map, &input[1], 5); - memcpy(&instant, &input[6], 2); - - conn->channel_update_channel_map = channel_map; - conn->channel_update_counter = instant; - conn->channel_update_num_used_channels = 0; - for(i = 0; i <= BLE_DATA_CHANNEL_MAX; i++) { - if(channel_map & (1ULL << i)) { - conn->channel_update_num_used_channels++; - } - } - } else if(op_code == BLE_LL_FEATURE_REQ) { - LOG_INFO("BLE-HAL: feature request received\n"); - output[0] = BLE_LL_FEATURE_RSP; - memset(&output[1], 0x00, 8); - *output_len = 9; - } else if(op_code == BLE_LL_VERSION_IND) { - LOG_INFO("BLE-HAL: version request received\n"); - output[0] = BLE_LL_VERSION_IND; - output[1] = 7; - memset(&output[2], 0xAA, 4); - *output_len = 6; - } else if(op_code == BLE_LL_CONN_PARAM_REQ) { - LOG_INFO("BLE-HAL: connection parameter request received\n"); - memcpy(&interval, &input[1], 2); /* use interval min */ - memcpy(&latency, &input[5], 2); - memcpy(&timeout, &input[7], 2); - connection_update(conn->conn_handle, interval, latency, timeout); - } else { - LOG_WARN("BLE-HAL: unknown LL control code: %02X\n", op_code); - } -} -/*---------------------------------------------------------------------------*/ -static void -connection_rx(ble_conn_param_t *param) -{ - uint8_t header_offset = 2; - uint8_t *rx_data; - uint16_t len; - uint8_t channel; - uint8_t frame_type; - uint8_t more_data; - uint8_t rssi; - linkaddr_t sender_addr; - rfc_bleMasterSlaveOutput_t *out_buf = (rfc_bleMasterSlaveOutput_t *)param->output_buf; - - uint8_t output_len = 0; - uint8_t output[26]; - - while(RX_ENTRY_STATUS(param->rx_queue_current) == DATA_ENTRY_FINISHED) { - rx_data = RX_ENTRY_DATA_PTR(param->rx_queue_current); -#if RADIO_CONF_BLE5 - len = RX_ENTRY_DATA_LENGTH(param->rx_queue_current) - 7 - 2; /* last 9 bytes are status, timestamp, ... */ -#else - len = RX_ENTRY_DATA_LENGTH(param->rx_queue_current) - 6 - 2; /* last 8 bytes are status, timestamp, ... */ -#endif - channel = (rx_data[len + 3] & 0x3F); - frame_type = rx_data[0] & 0x03; - more_data = (rx_data[0] & 0x10) >> 4; - - if(frame_type == BLE_DATA_PDU_LLID_CONTROL) { - process_ll_ctrl_msg(param, (len - header_offset), &rx_data[header_offset], &output_len, output); - if(output_len > 0) { - send_frame(param, output, output_len, BLE_DATA_PDU_LLID_CONTROL); - } - } else if(frame_type == BLE_DATA_PDU_LLID_DATA_MESSAGE) { - packetbuf_clear(); - memcpy(packetbuf_dataptr(), &rx_data[header_offset], len); - packetbuf_set_datalen(len); - rssi = out_buf->lastRssi; - ble_addr_to_eui64(sender_addr.u8, param->peer_address); - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, rssi); - packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, channel); - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &linkaddr_node_addr); - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &sender_addr); - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME_BLE_RX_EVENT); - if((!more_data) || (len < CONN_BLE_BUFFER_SIZE)) { - NETSTACK_MAC.input(); - } - } else if(frame_type == BLE_DATA_PDU_LLID_DATA_FRAGMENT) { - memcpy((packetbuf_dataptr() + packetbuf_datalen()), &rx_data[header_offset], len); - packetbuf_set_datalen(packetbuf_datalen() + len); - if((!more_data) || (len < CONN_BLE_BUFFER_SIZE)) { - NETSTACK_MAC.input(); - } - } - - /* free current entry (clear BLE data length & reset status) */ - RX_ENTRY_DATA_LENGTH(param->rx_queue_current) = 0; - RX_ENTRY_STATUS(param->rx_queue_current) = DATA_ENTRY_PENDING; - param->rx_queue_current = RX_ENTRY_NEXT_ENTRY(param->rx_queue_current); - } -} -/*---------------------------------------------------------------------------*/ -static void -connection_event_slave(struct rtimer *t, void *ptr) -{ - - ble_conn_param_t *conn = (ble_conn_param_t *)ptr; - rfc_bleMasterSlaveOutput_t *output = (rfc_bleMasterSlaveOutput_t *)conn->output_buf; - uint8_t first_packet = 0; - rtimer_clock_t wakeup; - uint8_t i; - uint8_t tx_data = tx_queue_data_to_transmit(conn); - - if(conn->counter == 0) { - /* the slave skips connection event 0, because it is usually too early */ - conn->start_rt = conn->timestamp_rt + ticks_from_unit(conn->win_offset, TIME_UNIT_1_25_MS) - CONN_WINDOW_WIDENING_TICKS; - update_data_channel(conn); - first_packet = 1; - } - conn->counter++; - - /* connection timing */ - if(conn->counter == conn->conn_update_counter) { - conn->start_rt += ticks_from_unit(conn->interval + conn->conn_update_win_offset, TIME_UNIT_1_25_MS); - - conn->win_size = conn->conn_update_win_size; - conn->win_offset = conn->conn_update_win_offset; - conn->interval = conn->conn_update_interval; - conn->latency = conn->conn_update_latency; - conn->timeout = conn->conn_update_timeout; - conn->conn_update_win_size = 0; - conn->conn_update_win_offset = 0; - conn->conn_update_interval = 0; - conn->conn_update_latency = 0; - conn->conn_update_timeout = 0; - } else if(output->pktStatus.bTimeStampValid) { - conn->start_rt = ticks_from_unit(output->timeStamp, TIME_UNIT_RF_CORE) + - ticks_from_unit(conn->interval, TIME_UNIT_1_25_MS) - CONN_WINDOW_WIDENING_TICKS; - } else { - conn->start_rt += ticks_from_unit(conn->interval, TIME_UNIT_1_25_MS); - } - - /* connection channel */ - if(conn->channel_update_counter == conn->counter) { - conn->channel_map = conn->channel_update_channel_map; - conn->num_used_channels = conn->channel_update_num_used_channels; - conn->channel_update_counter = 0; - conn->channel_update_channel_map = 0; - conn->channel_update_num_used_channels = 0; - } - update_data_channel(conn); - - if(tx_data || (conn->skipped_events >= conn->latency) || (conn->counter < CONN_EVENT_LATENCY_THRESHOLD)) { - /* participating in the connection event */ - conn->skipped_events = 0; - rf_ble_cmd_create_slave_params(conn->param_buf, &conn->rx_queue, &conn->tx_queue, conn->access_address, - conn->crc_init_0, conn->crc_init_1, conn->crc_init_2, - ticks_to_unit(ticks_from_unit(conn->win_size, TIME_UNIT_1_25_MS), TIME_UNIT_RF_CORE), - ticks_to_unit(CONN_WINDOW_WIDENING_TICKS, TIME_UNIT_RF_CORE), first_packet); - - rf_ble_cmd_create_slave_cmd(conn->cmd_buf, conn->mapped_channel, conn->param_buf, conn->output_buf, - ticks_to_unit(conn->start_rt, TIME_UNIT_RF_CORE)); - - if(on() != BLE_RESULT_OK) { - LOG_ERR("connection_event: could not enable radio core\n"); - return; - } - - /* append TX buffers */ - for(i = 0; i < CONN_TX_BUFFERS_NUM; i++) { - if(TX_ENTRY_STATUS(conn->tx_buffers[i]) == DATA_ENTRY_QUEUED) { - TX_ENTRY_STATUS(conn->tx_buffers[i]) = DATA_ENTRY_PENDING; - rf_ble_cmd_add_data_queue_entry(&conn->tx_queue, conn->tx_buffers[i]); - } - } - rf_ble_cmd_send(conn->cmd_buf); - rf_ble_cmd_wait(conn->cmd_buf); - off(); - - if(CMD_GET_STATUS(conn->cmd_buf) != RF_CORE_RADIO_OP_STATUS_BLE_DONE_OK) { - LOG_DBG("command status: 0x%04X; connection event counter: %d, channel: %d\n", - CMD_GET_STATUS(conn->cmd_buf), conn->counter, conn->mapped_channel); - } - - /* free finished TX buffers */ - for(i = 0; i < CONN_TX_BUFFERS_NUM; i++) { - if(TX_ENTRY_STATUS(conn->tx_buffers[i]) == DATA_ENTRY_FINISHED) { - TX_ENTRY_STATUS(conn->tx_buffers[i]) = DATA_ENTRY_FREE; - TX_ENTRY_LENGTH(conn->tx_buffers[i]) = 0; - TX_ENTRY_NEXT_ENTRY(conn->tx_buffers[i]) = NULL; - } - } - } else { - /* skipping connection event */ - conn->skipped_events++; - output->pktStatus.bTimeStampValid = 0; - } - wakeup = conn->start_rt + ticks_from_unit(conn->interval, TIME_UNIT_1_25_MS) - CONN_PREPROCESSING_TIME_TICKS; - rtimer_set(&conn->timer, wakeup, 0, connection_event_slave, ptr); - process_post(&ble_hal_conn_rx_process, rx_data_event, ptr); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ble_hal_conn_rx_process, ev, data) { - ble_conn_param_t *conn = (ble_conn_param_t *)data; - rfc_bleMasterSlaveOutput_t *output = (rfc_bleMasterSlaveOutput_t *)conn->output_buf; - uint8_t tx_buffers_sent; - PROCESS_BEGIN(); - LOG_DBG("BLE-HAL: conn rx process start\n"); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == rx_data_event); - /* notify upper layers (L2CAP) when TX buffers were successfully transmitted */ - tx_buffers_sent = output->nTxEntryDone - conn->tx_buffers_sent; - if(tx_buffers_sent != 0) { - conn->tx_buffers_sent = output->nTxEntryDone; - packetbuf_set_datalen(0); - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME_BLE_TX_EVENT); - NETSTACK_MAC.input(); - } - - /* handle RX buffers */ - connection_rx(conn); - - /* generate an event if the connection parameter were updated */ - if(conn->counter == conn->conn_update_counter) { - packetbuf_set_datalen(0); - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME_BLE_CONNECTION_UPDATED); - NETSTACK_MAC.input(); - } - } - - PROCESS_END(); -} diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/ble-hal-cc26xx.h b/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/ble-hal-cc26xx.h deleted file mode 100644 index 41e71c684..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/ble-hal-cc26xx.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2017, Graz University of Technology - * 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 - * BLE radio hardware abstraction for the TI CC26XX controller - * - * \author - * Michael Spoerk - */ -/*---------------------------------------------------------------------------*/ - -#ifndef BLE_HAL_CC26XX_H_ -#define BLE_HAL_CC26XX_H_ - -#include "os/dev/ble-hal.h" - -extern const struct ble_hal_driver ble_hal; - -#endif /* BLE_HAL_CC26XX_H_ */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/rf-ble-cmd.c b/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/rf-ble-cmd.c deleted file mode 100644 index 3d427c9ef..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/rf-ble-cmd.c +++ /dev/null @@ -1,529 +0,0 @@ -/* - * Copyright (c) 2017, Graz University of Technology - * Copyright (c) 2018, University of Bristol - http://www.bristol.ac.uk/ - * 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 - * BLE commands for the TI CC26xx BLE radio. - * These functions are specific to the TI CC26xx and cannot be - * reused by other BLE radios. - * - * \author - * Michael Spoerk - * Jinyan BAI - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include "rf_ble_cmd.h" -#include "rf-core/rf-core.h" -#include "rf-core/ble-hal/rf-ble-cmd.h" - -/*---------------------------------------------------------------------------*/ -#include "sys/log.h" -#define LOG_MODULE "BLE-RADIO" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -#define CMD_GET_STATUS(X) (((rfc_radioOp_t *)X)->status) -/*---------------------------------------------------------------------------*/ -/* values for a selection of available TX powers (values from SmartRF Studio) */ -/*static uint16_t tx_power = 0x9330; / * +5 dBm * / */ -static uint16_t tx_power = 0x3161; /* 0 dBm */ -/*static uint16_t tx_power = 0x0CCB; / * -15 dBm * / */ -/*---------------------------------------------------------------------------*/ -/* BLE overrides */ -#if RADIO_CONF_BLE5 -uint32_t ble_overrides_common[] = -{ - /* Rx: Set LNA IB trim value based on the selected defaultPhy.mainMode setting. (NOTE: The value 0x8 is a placeholder. The value to use should be set during run-time by radio driver function.) */ - ADI_HALFREG_OVERRIDE(0,4,0xF,0x8), - /* Rx: Set LNA IB offset used for automatic software compensation to 0 */ - (uint32_t)0x00008883, - /* Synth: Use 24 MHz crystal, enable extra PLL filtering */ - (uint32_t)0x02010403, - /* Synth: Set fine top and bottom code to 127 and 0 */ - HW_REG_OVERRIDE(0x4020, 0x7F00), - /* Synth: Configure faster calibration */ - HW32_ARRAY_OVERRIDE(0x4004, 1), - /* Synth: Configure faster calibration */ - (uint32_t)0x1C0C0618, - /* Synth: Configure faster calibration */ - (uint32_t)0xC00401A1, - /* Synth: Configure faster calibration */ - (uint32_t)0x21010101, - /* Synth: Configure faster calibration */ - (uint32_t)0xC0040141, - /* Synth: Configure faster calibration */ - (uint32_t)0x00214AD3, - /* Synth: Decrease synth programming time-out by 90 us (0x0298 RAT ticks = 166 us) */ - (uint32_t)0x02980243, - /* Bluetooth 5: Set correct total clock accuracy for received AuxPtr assuming local sleep clock of 50 ppm */ - (uint32_t)0x0E490823, - /* override_frontend_id.xml */ - (uint32_t)0xFFFFFFFF, -}; - -uint32_t ble_overrides_1Mbps[] = -{ - /* Rx: Set LNA IB trim to normal trim value. (NOTE: The value 0x8 is a placeholder. The value to use should be set during run-time by radio driver function.) */ - ADI_HALFREG_OVERRIDE(0,4,0xF,0x8), - /* Rx: Configure AGC to use gain table for improved performance */ - HW_REG_OVERRIDE(0x6084, 0x05F8), - (uint32_t)0xFFFFFFFF, -}; - -uint32_t ble_overrides_2Mbps[] = -{ - /* Rx: Set LNA IB trim to normal trim value. (NOTE: The value 0x8 is a placeholder. The value to use should be set during run-time by radio driver function.) */ - ADI_HALFREG_OVERRIDE(0,4,0xF,0x8), - (uint32_t)0xFFFFFFFF, -}; - -uint32_t ble_overrides_coded[] = -{ - /* Rx: Set LNA IB trim to 0xF (maximum) */ - ADI_HALFREG_OVERRIDE(0,4,0xF,0xF), - /* Rx: Override AGC target gain to improve performance */ - HW_REG_OVERRIDE(0x6088, 0x0018), - (uint32_t)0xFFFFFFFF, -}; -#else -static uint32_t ble_overrides[] = { - 0x00364038, /* Synth: Set RTRIM (POTAILRESTRIM) to 6 */ - 0x000784A3, /* Synth: Set FREF = 3.43 MHz (24 MHz / 7) */ - 0xA47E0583, /* Synth: Set loop bandwidth after lock to 80 kHz (K2) */ - 0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, LSB) */ - 0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, MSB) */ - 0x00456088, /* Adjust AGC reference level */ - 0x008F88B3, /* GPIO mode: https://e2e.ti.com/support/wireless_connectivity/proprietary_sub_1_ghz_simpliciti/f/156/t/488244?*/ - 0xFFFFFFFF, /* End of override list */ -}; -#endif -/*---------------------------------------------------------------------------*/ -unsigned short -rf_ble_cmd_send(uint8_t *command) -{ - uint32_t cmdsta; - rfc_radioOp_t *cmd = (rfc_radioOp_t *)command; - - if(rf_core_send_cmd((uint32_t)cmd, &cmdsta) != RF_CORE_CMD_OK) { - LOG_ERR("rf_ble_cmd_send() could not send cmd. status: 0x%04X\n", - CMD_GET_STATUS(cmd)); - return RF_BLE_CMD_ERROR; - } - return RF_BLE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -unsigned short -rf_ble_cmd_wait(uint8_t *command) -{ - rfc_radioOp_t *cmd = (rfc_radioOp_t *)command; - if(rf_core_wait_cmd_done((void *)cmd) != RF_CORE_CMD_OK) { - LOG_ERR("rf_ble_cmd_wait() could not wait. status: 0x%04X\n", - CMD_GET_STATUS(cmd)); - return RF_BLE_CMD_ERROR; - } - return RF_BLE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -unsigned short -rf_ble_cmd_setup_ble_mode(void) -{ -#if RADIO_CONF_BLE5 - rfc_CMD_BLE5_RADIO_SETUP_t cmd; - - /* Create radio setup command */ - rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_BLE5_RADIO_SETUP); - - cmd.startTrigger.bEnaCmd = 0; - cmd.defaultPhy.mainMode = 1; - cmd.defaultPhy.coding = 1; - cmd.pRegOverrideCommon = ble_overrides_common; - cmd.pRegOverride1Mbps = ble_overrides_1Mbps; - cmd.pRegOverride2Mbps = ble_overrides_2Mbps; - cmd.pRegOverrideCoded = ble_overrides_coded; -#else - rfc_CMD_RADIO_SETUP_t cmd; - - /* Create radio setup command */ - rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_RADIO_SETUP); - - cmd.mode = 0; - cmd.pRegOverride = ble_overrides; -#endif - cmd.txPower = tx_power; - - /* Send Radio setup to RF Core */ - if(rf_ble_cmd_send((uint8_t *)&cmd) != RF_BLE_CMD_OK) { - return RF_BLE_CMD_ERROR; - } - - /* Wait until radio setup is done */ - return rf_ble_cmd_wait((uint8_t *)&cmd); -} -/*---------------------------------------------------------------------------*/ -/* ADVERTISING functions */ -/*---------------------------------------------------------------------------*/ -void -rf_ble_cmd_create_adv_cmd(uint8_t *command, uint8_t channel, - uint8_t *param, uint8_t *output) -{ -#if RADIO_CONF_BLE5 - rfc_CMD_BLE5_ADV_t *c = (rfc_CMD_BLE5_ADV_t *)command; - - memset(c, 0x00, sizeof(rfc_CMD_BLE5_ADV_t)); - - c->commandNo = CMD_BLE5_ADV; - c->rangeDelay = 0; - - c->txPower = tx_power; -#else - rfc_CMD_BLE_ADV_t *c = (rfc_CMD_BLE_ADV_t *)command; - - memset(c, 0x00, sizeof(rfc_CMD_BLE_ADV_t)); - c->commandNo = CMD_BLE_ADV; -#endif - c->condition.rule = COND_NEVER; - c->whitening.bOverride = 0; - c->channel = channel; - c->pParams = (rfc_bleAdvPar_t *)param; - c->startTrigger.triggerType = TRIG_NOW; - c->pOutput = (rfc_bleAdvOutput_t *)output; -} -/*---------------------------------------------------------------------------*/ -void -rf_ble_cmd_create_adv_params(uint8_t *param, dataQueue_t *rx_queue, - uint8_t adv_data_len, uint8_t *adv_data, - uint8_t scan_resp_data_len, uint8_t *scan_resp_data, - ble_addr_type_t own_addr_type, uint8_t *own_addr) -{ - rfc_bleAdvPar_t *p = (rfc_bleAdvPar_t *)param; - - memset(p, 0x00, sizeof(rfc_bleAdvPar_t)); - - p->pRxQ = rx_queue; - p->rxConfig.bAutoFlushIgnored = 1; - p->rxConfig.bAutoFlushCrcErr = 0; - p->rxConfig.bAutoFlushEmpty = 1; - p->rxConfig.bIncludeLenByte = 1; - p->rxConfig.bIncludeCrc = 0; - p->rxConfig.bAppendRssi = 1; - p->rxConfig.bAppendStatus = 1; - p->rxConfig.bAppendTimestamp = 1; - p->advConfig.advFilterPolicy = 0; - p->advConfig.bStrictLenFilter = 0; - p->advConfig.deviceAddrType = own_addr_type; - p->pDeviceAddress = (uint16_t *)own_addr; - p->advLen = adv_data_len; - p->scanRspLen = scan_resp_data_len; - p->pAdvData = adv_data; - p->pScanRspData = scan_resp_data; - p->endTrigger.triggerType = TRIG_NEVER; -} -/*---------------------------------------------------------------------------*/ -/* INITIATOR functions */ -/*---------------------------------------------------------------------------*/ -void -rf_ble_cmd_create_initiator_cmd(uint8_t *cmd, uint8_t channel, uint8_t *params, - uint8_t *output, uint32_t start_time) -{ -#if RADIO_CONF_BLE5 - rfc_CMD_BLE5_INITIATOR_t *c = (rfc_CMD_BLE5_INITIATOR_t *)cmd; - - memset(c, 0x00, sizeof(rfc_CMD_BLE5_INITIATOR_t)); - - c->commandNo = CMD_BLE5_INITIATOR; - c->condition.rule = COND_NEVER; - c->whitening.bOverride = 0; - c->channel = channel; - c->pParams = (rfc_ble5InitiatorPar_t *)params; - c->startTrigger.triggerType = TRIG_ABSTIME; - c->startTime = start_time; - c->pOutput = (rfc_ble5ScanInitOutput_t *)output; - - c->txPower = tx_power; - c->rangeDelay = 0; -#else - rfc_CMD_BLE_INITIATOR_t *c = (rfc_CMD_BLE_INITIATOR_t *)cmd; - - memset(c, 0x00, sizeof(rfc_CMD_BLE_INITIATOR_t)); - - c->commandNo = CMD_BLE_INITIATOR; - c->condition.rule = COND_NEVER; - c->whitening.bOverride = 0; - c->channel = channel; - c->pParams = (rfc_bleInitiatorPar_t *)params; - c->startTrigger.triggerType = TRIG_ABSTIME; - c->startTime = start_time; - c->pOutput = (rfc_bleInitiatorOutput_t *)output; -#endif -} -/*---------------------------------------------------------------------------*/ -void -rf_ble_cmd_create_initiator_params(uint8_t *param, dataQueue_t *rx_queue, - uint32_t initiator_time, - ble_addr_type_t own_addr_type, uint8_t *own_addr, - ble_addr_type_t peer_addr_type, uint8_t *peer_addr, - uint32_t connect_time, uint8_t *conn_req_data) -{ -#if RADIO_CONF_BLE5 - rfc_ble5InitiatorPar_t *p = (rfc_ble5InitiatorPar_t *)param; - p->backoffPar.bLastSucceeded = 0; - p->backoffPar.bLastFailed = 0; - p->maxWaitTimeForAuxCh = 0; - p->rxStartTime = 0; - p->rxListenTime = 0; -#else - rfc_bleInitiatorPar_t *p = (rfc_bleInitiatorPar_t *)param; -#endif - p->pRxQ = rx_queue; - p->rxConfig.bAutoFlushIgnored = 1; - p->rxConfig.bAutoFlushCrcErr = 0; - p->rxConfig.bAutoFlushEmpty = 1; - p->rxConfig.bIncludeLenByte = 1; - p->rxConfig.bIncludeCrc = 0; - p->rxConfig.bAppendRssi = 1; - p->rxConfig.bAppendStatus = 1; - p->rxConfig.bAppendTimestamp = 1; - - /* p->initConfig.bUseWhiteList = 0; */ - p->initConfig.bUseWhiteList = 1; - p->initConfig.bDynamicWinOffset = 0; - p->initConfig.deviceAddrType = own_addr_type; - p->initConfig.peerAddrType = peer_addr_type; - p->initConfig.bStrictLenFilter = 1; - - p->connectReqLen = 22; - p->pConnectReqData = conn_req_data; - p->pDeviceAddress = (uint16_t *)own_addr; - p->pWhiteList = (rfc_bleWhiteListEntry_t *)peer_addr; - p->connectTime = connect_time; - p->timeoutTrigger.triggerType = TRIG_REL_START; - p->timeoutTime = initiator_time; - p->endTrigger.triggerType = TRIG_NEVER; -} -/*---------------------------------------------------------------------------*/ -/* CONNECTION slave functions */ -/*---------------------------------------------------------------------------*/ -void -rf_ble_cmd_create_slave_cmd(uint8_t *cmd, uint8_t channel, uint8_t *params, - uint8_t *output, uint32_t start_time) -{ -#if RADIO_CONF_BLE5 - rfc_CMD_BLE5_SLAVE_t *c = (rfc_CMD_BLE5_SLAVE_t *)cmd; - - memset(c, 0x00, sizeof(rfc_CMD_BLE5_SLAVE_t)); - - c->commandNo = CMD_BLE5_SLAVE; - c->condition.rule = COND_NEVER; - c->whitening.bOverride = 0; - c->channel = channel; - c->pParams = (rfc_ble5SlavePar_t *)params; - c->startTrigger.triggerType = TRIG_ABSTIME; - c->startTime = start_time; - c->pOutput = (rfc_bleMasterSlaveOutput_t *)output; - - c->phyMode.mainMode = 1; - c->phyMode.coding = 1; - c->txPower = tx_power; - c->rangeDelay = 0; -#else - rfc_CMD_BLE_SLAVE_t *c = (rfc_CMD_BLE_SLAVE_t *)cmd; - - memset(c, 0x00, sizeof(rfc_CMD_BLE_SLAVE_t)); - - c->commandNo = CMD_BLE_SLAVE; - c->condition.rule = COND_NEVER; - c->whitening.bOverride = 0; - c->channel = channel; - c->pParams = (rfc_bleSlavePar_t *)params; - c->startTrigger.triggerType = TRIG_ABSTIME; - c->startTrigger.pastTrig = 0; - c->startTime = start_time; - c->pOutput = (rfc_bleMasterSlaveOutput_t *)output; -#endif -} -/*---------------------------------------------------------------------------*/ -void -rf_ble_cmd_create_slave_params(uint8_t *params, dataQueue_t *rx_queue, - dataQueue_t *tx_queue, uint32_t access_address, - uint8_t crc_init_0, uint8_t crc_init_1, - uint8_t crc_init_2, uint32_t win_size, - uint32_t window_widening, uint8_t first_packet) -{ -#if RADIO_CONF_BLE5 - rfc_ble5SlavePar_t *p = (rfc_ble5SlavePar_t *)params; - p->maxRxPktLen = 255; - p->maxLenLowRate = 0; -#else - rfc_bleSlavePar_t *p = (rfc_bleSlavePar_t *)params; -#endif - p->pRxQ = rx_queue; - p->pTxQ = tx_queue; - p->rxConfig.bAutoFlushIgnored = 1; - p->rxConfig.bAutoFlushCrcErr = 1; - p->rxConfig.bAutoFlushEmpty = 1; - p->rxConfig.bIncludeLenByte = 1; - p->rxConfig.bIncludeCrc = 0; - p->rxConfig.bAppendRssi = 1; - p->rxConfig.bAppendStatus = 1; - p->rxConfig.bAppendTimestamp = 1; - - if(first_packet) { - /* set parameters for first packet according to TI Technical Reference Manual */ - p->seqStat.lastRxSn = 1; - p->seqStat.lastTxSn = 1; - p->seqStat.nextTxSn = 0; - p->seqStat.bFirstPkt = 1; - p->seqStat.bAutoEmpty = 0; - p->seqStat.bLlCtrlTx = 0; - p->seqStat.bLlCtrlAckRx = 0; - p->seqStat.bLlCtrlAckPending = 0; - } - - p->maxNack = 0; - p->maxPkt = 0; - p->accessAddress = access_address; - p->crcInit0 = crc_init_0; - p->crcInit1 = crc_init_1; - p->crcInit2 = crc_init_2; - p->timeoutTrigger.triggerType = TRIG_REL_START; - if(first_packet) { - p->timeoutTime = (uint32_t)(10 * win_size); - } else { - p->timeoutTime = (uint32_t)(win_size + 2 * window_widening); - } - p->endTrigger.triggerType = TRIG_NEVER; -} -/*---------------------------------------------------------------------------*/ -/* CONNECTION master functions */ -/*---------------------------------------------------------------------------*/ -void -rf_ble_cmd_create_master_cmd(uint8_t *cmd, uint8_t channel, uint8_t *params, - uint8_t *output, uint32_t start_time) -{ -#if RADIO_CONF_BLE5 - rfc_CMD_BLE5_MASTER_t *c = (rfc_CMD_BLE5_MASTER_t *)cmd; - - memset(c, 0x00, sizeof(rfc_CMD_BLE5_MASTER_t)); - - c->commandNo = CMD_BLE5_MASTER; - c->condition.rule = COND_NEVER; - c->whitening.bOverride = 0; - c->channel = channel; - c->pParams = (rfc_ble5MasterPar_t *)params; - c->startTrigger.triggerType = TRIG_ABSTIME; - c->startTime = start_time; - c->pOutput = (rfc_bleMasterSlaveOutput_t *)output; - - c->phyMode.mainMode = 1; - c->phyMode.coding = 1; - c->txPower = tx_power; - c->rangeDelay = 0; -#else - rfc_CMD_BLE_MASTER_t *c = (rfc_CMD_BLE_MASTER_t *)cmd; - - memset(c, 0x00, sizeof(rfc_CMD_BLE_MASTER_t)); - - c->commandNo = CMD_BLE_MASTER; - c->condition.rule = COND_NEVER; - c->whitening.bOverride = 0; - c->channel = channel; - c->pParams = (rfc_bleMasterPar_t *)params; - c->startTrigger.triggerType = TRIG_ABSTIME; - c->startTime = start_time; - c->pOutput = (rfc_bleMasterSlaveOutput_t *)output; -#endif -} -/*---------------------------------------------------------------------------*/ -void -rf_ble_cmd_create_master_params(uint8_t *params, dataQueue_t *rx_queue, - dataQueue_t *tx_queue, uint32_t access_address, - uint8_t crc_init_0, uint8_t crc_init_1, - uint8_t crc_init_2, uint8_t first_packet) -{ -#if RADIO_CONF_BLE5 - rfc_ble5MasterPar_t *p = (rfc_ble5MasterPar_t *)params; - p->maxRxPktLen = 255; - p->maxLenLowRate = 0; -#else - rfc_bleMasterPar_t *p = (rfc_bleMasterPar_t *)params; -#endif - p->pRxQ = rx_queue; - p->pTxQ = tx_queue; - p->rxConfig.bAutoFlushIgnored = 1; - p->rxConfig.bAutoFlushCrcErr = 1; - p->rxConfig.bAutoFlushEmpty = 1; - p->rxConfig.bIncludeLenByte = 1; - p->rxConfig.bIncludeCrc = 0; - p->rxConfig.bAppendRssi = 1; - p->rxConfig.bAppendStatus = 1; - p->rxConfig.bAppendTimestamp = 1; - - if(first_packet) { - /* set parameters for first packet according to TI Technical Reference Manual */ - p->seqStat.lastRxSn = 1; - p->seqStat.lastTxSn = 1; - p->seqStat.nextTxSn = 0; - p->seqStat.bFirstPkt = 1; - p->seqStat.bAutoEmpty = 0; - p->seqStat.bLlCtrlTx = 0; - p->seqStat.bLlCtrlAckRx = 0; - p->seqStat.bLlCtrlAckPending = 0; - } - - p->maxPkt = 12; - p->accessAddress = access_address; - p->crcInit0 = crc_init_0; - p->crcInit1 = crc_init_1; - p->crcInit2 = crc_init_2; - p->endTrigger.triggerType = TRIG_REL_START; - p->endTime = (uint32_t)15 * 4000; /* a connection event must end after 10 ms */ -} -/*---------------------------------------------------------------------------*/ -/* DATA queue functions */ -/*---------------------------------------------------------------------------*/ -unsigned short -rf_ble_cmd_add_data_queue_entry(dataQueue_t *q, uint8_t *e) -{ - uint32_t cmdsta; - - rfc_CMD_ADD_DATA_ENTRY_t cmd; - cmd.commandNo = CMD_ADD_DATA_ENTRY; - cmd.pQueue = q; - cmd.pEntry = e; - - if(rf_core_send_cmd((uint32_t)&cmd, &cmdsta) != RF_CORE_CMD_OK) { - LOG_ERR("could not add entry to data queue. status: 0x%04X\n", - CMD_GET_STATUS(&cmd)); - return RF_BLE_CMD_ERROR; - } - return RF_BLE_CMD_OK; -} diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/rf-ble-cmd.h b/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/rf-ble-cmd.h deleted file mode 100644 index 798d1b879..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/rf-ble-cmd.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2017, Graz University of Technology - * 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 - * BLE commands for the TI CC26xx BLE radio. - * These functions are specific to the TI CC26xx and cannot be - * reused by other BLE radios. - * - * \author - * Michael Spoerk - */ -/*---------------------------------------------------------------------------*/ - -#ifndef RF_BLE_CMD_H_ -#define RF_BLE_CMD_H_ - -#include "os/dev/ble-hal.h" -#include "../../ble-addr.h" -#include "rf_common_cmd.h" - -#define RF_BLE_CMD_OK 1 -#define RF_BLE_CMD_ERROR 0 - -/*---------------------------------------------------------------------------*/ -/** - * \brief Sends a BLE radio command to the radio - * \param cmd A pointer to the command to be send - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - */ -unsigned short rf_ble_cmd_send(uint8_t *cmd); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Waits for a running BLE radio command to be finished - * \param cmd A pointer to the running command - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - */ -unsigned short rf_ble_cmd_wait(uint8_t *cmd); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Initializes the radio core to be used as a BLE radio - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - */ -unsigned short rf_ble_cmd_setup_ble_mode(void); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Creates a BLE radio command structure that enables - * BLE advertisement when sent to the radio core - * \param command A pointer to command that is created - * \param channel The BLE advertisement channel used for advertisement - * \param param A pointer to the radio command parameters - * \param output A pointer to the radio command output - */ -void rf_ble_cmd_create_adv_cmd(uint8_t *command, uint8_t channel, - uint8_t *param, uint8_t *output); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Creates BLE radio command parameters that are used to enable - * BLE advertisement on the radio core - * \param param A pointer to parameter structure that is created - * \param rx_queue A pointer to the RX queue that is used - * \param adv_data_len - * The length of the advertisement data - * \param adv_data A pointer to the advertisement data that is advertised - * \param scan_resp_data_len - * The length of the scan response data - * \param scan_resp_data - * A pointer to the scan response data - * \param own_addr_type - * Either BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM - * \param own_addr A pointer to the device address that is used as own address - */ -void rf_ble_cmd_create_adv_params(uint8_t *param, dataQueue_t *rx_queue, - uint8_t adv_data_len, uint8_t *adv_data, - uint8_t scan_resp_data_len, uint8_t *scan_resp_data, - ble_addr_type_t own_addr_type, uint8_t *own_addr); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Creates a BLE radio command structure that sets up - * BLE initiation event when sent to the radio core - * \param cmd A pointer to command that is created - * \param channel The BLE data channel used for the connection event - * \param params A pointer to the radio command parameters - * \param output A pointer to the radio command output - * \param start_time - * The time in rf_core_ticks when the connection event will start - */ -void rf_ble_cmd_create_initiator_cmd(uint8_t *cmd, uint8_t channel, uint8_t *params, - uint8_t *output, uint32_t start_time); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Creates BLE radio command parameters that are used to set up - * BLE initiation event on the radio core - * \param param A pointer to parameter structure that is created - * \param rx_queue A pointer to the RX queue that is used - * \param initiator_window - * T - * \param own_addr_type - * Either BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM - * \param own_addr A pointer to the device address that is used as own address - * \param peer_addr_type - * Either BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM - * \param peer_addr A pointer to the device address that is used as peer address - * \param connect_time - The first possible start time of the first connection event - * \param conn_req_data A pointer to the connect request data - */ -void rf_ble_cmd_create_initiator_params(uint8_t *param, dataQueue_t *rx_queue, - uint32_t initiator_window, - ble_addr_type_t own_addr_type, uint8_t *own_addr, - ble_addr_type_t peer_addr_type, uint8_t *peer_addr, - uint32_t connect_time, - uint8_t *conn_req_data); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Creates a BLE radio command structure that sets up a single - * BLE connection event when sent to the radio core - * \param cmd A pointer to command that is created - * \param channel The BLE data channel used for the connection event - * \param param A pointer to the radio command parameters - * \param output A pointer to the radio command output - * \param start_time - * The time in rf_core_ticks when the connection event will start - */ -void rf_ble_cmd_create_slave_cmd(uint8_t *cmd, uint8_t channel, uint8_t *param, - uint8_t *output, uint32_t start_time); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Creates BLE radio command parameters that are used to setup a single - * BLE connection event on the radio core - * \param param A pointer to parameter structure that is created - * \param rx_queue A pointer to the RX queue that is used - * \param tx_queue A pointer to the TX queue that is used - * \param access_address - * The access address of the used BLE connection - * \param crc_init_0 - * Part of the initialization of the CRC checksum - * \param crc_init_1 - * Part of the initialization of the CRC checksum - * \param crc_init_2 - * Part of the initialization of the CRC checksum - * \param win_size The window size parameter of the BLE connection event - * \param window_widening - * The window widening parameter used for this connection event - * \param first_packet - * 1 for the first packet of the BLE connection so that the - * connection is properly initialized - */ -void rf_ble_cmd_create_slave_params(uint8_t *param, dataQueue_t *rx_queue, - dataQueue_t *tx_queue, uint32_t access_address, - uint8_t crc_init_0, uint8_t crc_init_1, - uint8_t crc_init_2, uint32_t win_size, - uint32_t window_widening, uint8_t first_packet); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Creates a BLE radio command structure that sets up - * BLE connection event when sent to the radio core - * \param cmd A pointer to command that is created - * \param channel The BLE data channel used for the connection event - * \param params A pointer to the radio command parameters - * \param output A pointer to the radio command output - * \param start_time - * The time in rf_core_ticks when the connection event will start - */ -void rf_ble_cmd_create_master_cmd(uint8_t *cmd, uint8_t channel, uint8_t *params, - uint8_t *output, uint32_t start_time); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Creates BLE radio command parameters that are used to set up - * BLE connection event on the radio core - * \param params A pointer to parameter structure that is created - * \param rx_queue A pointer to the RX queue that is used - * \param tx_queue A pointer to the TX queue that is used - * \param access_address - * The access address of the used BLE connection - * \param crc_init_0 - * Part of the initialization of the CRC checksum - * \param crc_init_1 - * Part of the initialization of the CRC checksum - * \param crc_init_2 - * Part of the initialization of the CRC checksum - * \param first_packet - * 1 for the first packet of the BLE connection so that the - * connection is properly initialized - */ -void rf_ble_cmd_create_master_params(uint8_t *params, dataQueue_t *rx_queue, - dataQueue_t *tx_queue, uint32_t access_address, - uint8_t crc_init_0, uint8_t crc_init_1, - uint8_t crc_init_2, uint8_t first_packet); - -/*---------------------------------------------------------------------------*/ -/** - * \brief Adds a data buffer to a BLE transmission queue - * \param q A pointer to BLE transmission queue where the buffer - * should be added - * \param e A pointer to the data buffer that is added - */ -unsigned short rf_ble_cmd_add_data_queue_entry(dataQueue_t *q, uint8_t *e); - -#endif /* RF_BLE_CMD_H_ */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/cc13xx-50kbps-tsch.c b/arch/cpu/cc26x0-cc13x0/rf-core/cc13xx-50kbps-tsch.c deleted file mode 100644 index f2874fd03..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/cc13xx-50kbps-tsch.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, University of Bristol - http://www.bristol.ac.uk/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * IEEE 802.15.4 TSCH timeslot timings for CC13xx chips at 50kbps datarate - * \author - * Atis Elsts - * - */ - -#include "contiki.h" -#include "net/mac/tsch/tsch.h" - -#define CC13XX_TSCH_DEFAULT_TS_CCA_OFFSET 1800 -#define CC13XX_TSCH_DEFAULT_TS_CCA 128 -#define CC13XX_TSCH_DEFAULT_TS_TX_OFFSET 2500 -#define CC13XX_TSCH_DEFAULT_TS_RX_OFFSET (CC13XX_TSCH_DEFAULT_TS_TX_OFFSET - (TSCH_CONF_RX_WAIT / 2)) -#define CC13XX_TSCH_DEFAULT_TS_RX_ACK_DELAY 2000 -#define CC13XX_TSCH_DEFAULT_TS_TX_ACK_DELAY 3000 -#define CC13XX_TSCH_DEFAULT_TS_RX_WAIT TSCH_CONF_RX_WAIT -#define CC13XX_TSCH_DEFAULT_TS_ACK_WAIT 3000 -#define CC13XX_TSCH_DEFAULT_TS_RX_TX 192 -#define CC13XX_TSCH_DEFAULT_TS_MAX_ACK 10000 -#define CC13XX_TSCH_DEFAULT_TS_MAX_TX 21600 - -/* Timeslot length: 40000 usec */ -#define CC13XX_TSCH_DEFAULT_TS_TIMESLOT_LENGTH 40000 - -/* TSCH timeslot timing (microseconds) */ -const tsch_timeslot_timing_usec tsch_timing_cc13xx_50kbps = { - CC13XX_TSCH_DEFAULT_TS_CCA_OFFSET, - CC13XX_TSCH_DEFAULT_TS_CCA, - CC13XX_TSCH_DEFAULT_TS_TX_OFFSET, - CC13XX_TSCH_DEFAULT_TS_RX_OFFSET, - CC13XX_TSCH_DEFAULT_TS_RX_ACK_DELAY, - CC13XX_TSCH_DEFAULT_TS_TX_ACK_DELAY, - CC13XX_TSCH_DEFAULT_TS_RX_WAIT, - CC13XX_TSCH_DEFAULT_TS_ACK_WAIT, - CC13XX_TSCH_DEFAULT_TS_RX_TX, - CC13XX_TSCH_DEFAULT_TS_MAX_ACK, - CC13XX_TSCH_DEFAULT_TS_MAX_TX, - CC13XX_TSCH_DEFAULT_TS_TIMESLOT_LENGTH, -}; diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/cc13xx-50kbps-tsch.h b/arch/cpu/cc26x0-cc13x0/rf-core/cc13xx-50kbps-tsch.h deleted file mode 100644 index 5d4fdb376..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/cc13xx-50kbps-tsch.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2018, University of Bristol - http://www.bristol.ac.uk/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef CC13XX_50KBPS_TSCH_H_ -#define CC13XX_50KBPS_TSCH_H_ - -#include "contiki.h" - -/* TSCH timeslot timing (microseconds) */ -extern const uint16_t tsch_timing_cc13xx_50kbps[]; - -#endif /* CC13XX_50KBPS_TSCH_H_ */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/dot-15-4g.h b/arch/cpu/cc26x0-cc13x0/rf-core/dot-15-4g.h deleted file mode 100644 index 37c5d3e34..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/dot-15-4g.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rf-core - * @{ - * - * \defgroup rf-core-15-4g-modes IEEE 802.15.4g Frequency Bands and Modes - * - * @{ - * - * \file - * Header file with descriptors for the various modes of operation defined in - * IEEE 802.15.4g - */ -/*---------------------------------------------------------------------------*/ -#ifndef DOT_15_4G_H_ -#define DOT_15_4G_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include "driverlib/rf_mailbox.h" -/*---------------------------------------------------------------------------*/ -/* IEEE 802.15.4g frequency band identifiers (Table 68f) */ -#define DOT_15_4G_FREQUENCY_BAND_169 0 /* 169.400–169.475 (Europe) - 169 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_450 1 /* 450–470 (US FCC Part 22/90) - 450 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_470 2 /* 470–510 (China) - 470 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_780 3 /* 779–787 (China) - 780 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_863 4 /* 863–870 (Europe) - 863 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_896 5 /* 896–901 (US FCC Part 90) - 896 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_901 6 /* 901–902 (US FCC Part 24) - 901 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_915 7 /* 902–928 (US) - 915 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_917 8 /* 917–923.5 (Korea) - 917 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_920 9 /* 920–928 (Japan) - 920 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_928 10 /* 928–960 (US, non-contiguous) - 928 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_950 11 /* 950–958 (Japan) - 950 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_1427 12 /* 1427–1518 (US and Canada, non-contiguous) - 1427 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_2450 13 /* 2400–2483.5 2450 MHz band */ -#define DOT_15_4G_FREQUENCY_BAND_CUSTOM 14 /* For use with custom frequency band settings */ -/*---------------------------------------------------------------------------*/ -/* Default band selection to band 4 - 863MHz */ -#ifdef DOT_15_4G_CONF_FREQUENCY_BAND_ID -#define DOT_15_4G_FREQUENCY_BAND_ID DOT_15_4G_CONF_FREQUENCY_BAND_ID -#else -#define DOT_15_4G_FREQUENCY_BAND_ID DOT_15_4G_FREQUENCY_BAND_863 -#endif -/*---------------------------------------------------------------------------*/ -/* - * Channel count, spacing and other params relating to the selected band. We - * currently only support some of the bands defined in .15.4g and for those - * bands we only support operating mode #1 (Table 134). - * - * DOT_15_4G_CHAN0_FREQUENCY is specified here in KHz - * - * Custom bands and configuration can be used with DOT_15_4G_FREQUENCY_BAND_CUSTOM. - * - * Example of custom setup for the 868Mhz sub-band in Europe with 11 channels, - * center frequency at 868.050MHz and channel spacing at 100KHz. - * These should be put in project-config.h or similar. - * - * #define DOT_15_4G_FREQUENCY_BAND_ID DOT_15_4G_FREQUENCY_BAND_CUSTOM - * #define DOT_15_4G_CHAN0_FREQUENCY 868050 - * #define DOT_15_4G_CHANNEL_SPACING 100 - * #define DOT_15_4G_CHANNEL_MAX 11 - * #define PROP_MODE_CONF_LO_DIVIDER 0x05 - */ -#if DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_470 -#define DOT_15_4G_CHANNEL_MAX 198 -#define DOT_15_4G_CHANNEL_SPACING 200 -#define DOT_15_4G_CHAN0_FREQUENCY 470200 -#define PROP_MODE_CONF_LO_DIVIDER 0x0A -#define SMARTRF_SETTINGS_CONF_BAND_OVERRIDES HW32_ARRAY_OVERRIDE(0x405C,1), \ - (uint32_t)0x18000280, - -#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_780 -#define DOT_15_4G_CHANNEL_MAX 38 -#define DOT_15_4G_CHANNEL_SPACING 200 -#define DOT_15_4G_CHAN0_FREQUENCY 779200 -#define PROP_MODE_CONF_LO_DIVIDER 0x06 - -#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_863 -#define DOT_15_4G_CHANNEL_MAX 33 -#define DOT_15_4G_CHANNEL_SPACING 200 -#define DOT_15_4G_CHAN0_FREQUENCY 863125 -#define PROP_MODE_CONF_LO_DIVIDER 0x05 - -#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_915 -#define DOT_15_4G_CHANNEL_MAX 128 -#define DOT_15_4G_CHANNEL_SPACING 200 -#define DOT_15_4G_CHAN0_FREQUENCY 902200 -#define PROP_MODE_CONF_LO_DIVIDER 0x05 - -#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_920 -#define DOT_15_4G_CHANNEL_MAX 37 -#define DOT_15_4G_CHANNEL_SPACING 200 -#define DOT_15_4G_CHAN0_FREQUENCY 920600 -#define PROP_MODE_CONF_LO_DIVIDER 0x05 - -#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_950 -#define DOT_15_4G_CHANNEL_MAX 32 -#define DOT_15_4G_CHANNEL_SPACING 200 -#define DOT_15_4G_CHAN0_FREQUENCY 951000 -#define PROP_MODE_CONF_LO_DIVIDER 0x05 - -#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_CUSTOM -#ifndef DOT_15_4G_CHANNEL_MAX -#error DOT_15_4G_CHANNEL_MAX must be manually set when using custom frequency band -#endif - -#ifndef DOT_15_4G_CHANNEL_SPACING -#error DOT_15_4G_CHANNEL_SPACING must be manually set when using custom frequency band -#endif - -#ifndef DOT_15_4G_CHAN0_FREQUENCY -#error DOT_15_4G_CHAN0_FREQUENCY must be manually set when using custom frequency band -#endif - -#ifndef PROP_MODE_CONF_LO_DIVIDER -#error PROP_MODE_CONF_LO_DIVIDER must be manually set when using custom frequency band -#endif -#else -#error The selected frequency band is not supported -#endif -/*---------------------------------------------------------------------------*/ -#endif /* DOT_15_4G_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/ieee-mode.c b/arch/cpu/cc26x0-cc13x0/rf-core/ieee-mode.c deleted file mode 100644 index 9f4021d21..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/ieee-mode.c +++ /dev/null @@ -1,1502 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rf-core - * @{ - * - * \defgroup rf-core-ieee CC13xx/CC26xx IEEE mode driver - * - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx IEEE mode NETSTACK_RADIO driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/radio.h" -#include "dev/cc26xx-uart.h" -#include "dev/oscillators.h" -#include "net/packetbuf.h" -#include "net/linkaddr.h" -#include "net/netstack.h" -#include "sys/energest.h" -#include "sys/clock.h" -#include "sys/rtimer.h" -#include "sys/ctimer.h" -#include "sys/cc.h" -#include "lpm.h" -#include "ti-lib.h" -#include "rf-core/rf-core.h" -#include "rf-core/rf-switch.h" -#include "rf-core/rf-ble.h" -/*---------------------------------------------------------------------------*/ -/* RF core and RF HAL API */ -#include "hw_rfc_dbell.h" -#include "hw_rfc_pwr.h" -/*---------------------------------------------------------------------------*/ -/* RF Core Mailbox API */ -#include "rf-core/api/ieee_cmd.h" -#include "rf-core/api/ieee_mailbox.h" -#include "driverlib/rf_mailbox.h" -#include "driverlib/rf_common_cmd.h" -#include "driverlib/rf_data_entry.h" -/*---------------------------------------------------------------------------*/ -#include "smartrf-settings.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/* Configuration to enable/disable auto ACKs in IEEE mode */ -#ifdef IEEE_MODE_CONF_AUTOACK -#define IEEE_MODE_AUTOACK IEEE_MODE_CONF_AUTOACK -#else -#define IEEE_MODE_AUTOACK 1 -#endif /* IEEE_MODE_CONF_AUTOACK */ - -/* Configuration to enable/disable frame filtering in IEEE mode */ -#ifdef IEEE_MODE_CONF_PROMISCOUS -#define IEEE_MODE_PROMISCOUS IEEE_MODE_CONF_PROMISCOUS -#else -#define IEEE_MODE_PROMISCOUS 0 -#endif /* IEEE_MODE_CONF_PROMISCOUS */ - -#ifdef IEEE_MODE_CONF_RSSI_THRESHOLD -#define IEEE_MODE_RSSI_THRESHOLD IEEE_MODE_CONF_RSSI_THRESHOLD -#else -#define IEEE_MODE_RSSI_THRESHOLD 0xA6 -#endif /* IEEE_MODE_CONF_RSSI_THRESHOLD */ -/*---------------------------------------------------------------------------*/ -#define STATUS_CRC_FAIL 0x80 /* bit 7 */ -#define STATUS_REJECT_FRAME 0x40 /* bit 6 */ -#define STATUS_CORRELATION 0x3f /* bits 0-5 */ -/*---------------------------------------------------------------------------*/ -/* Data entry status field constants */ -#define DATA_ENTRY_STATUS_PENDING 0x00 /* Not in use by the Radio CPU */ -#define DATA_ENTRY_STATUS_ACTIVE 0x01 /* Open for r/w by the radio CPU */ -#define DATA_ENTRY_STATUS_BUSY 0x02 /* Ongoing r/w */ -#define DATA_ENTRY_STATUS_FINISHED 0x03 /* Free to use and to free */ -#define DATA_ENTRY_STATUS_UNFINISHED 0x04 /* Partial RX entry */ -/*---------------------------------------------------------------------------*/ -/* RF stats data structure */ -static uint8_t rf_stats[16] = { 0 }; -/*---------------------------------------------------------------------------*/ -/* The size of the RF commands buffer */ -#define RF_CMD_BUFFER_SIZE 128 -/*---------------------------------------------------------------------------*/ -#define RAT_TIMESTAMP_OFFSET_2_4_GHZ 0 -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the current status of a running Radio Op command - * \param a A pointer with the buffer used to initiate the command - * \return The value of the Radio Op buffer's status field - * - * This macro can be used to e.g. return the status of a previously - * initiated background operation, or of an immediate command - */ -#define RF_RADIO_OP_GET_STATUS(a) (((rfc_radioOp_t *)a)->status) -/*---------------------------------------------------------------------------*/ -#define IEEE_MODE_CHANNEL_MIN 11 -#define IEEE_MODE_CHANNEL_MAX 26 -/*---------------------------------------------------------------------------*/ -/* TX Power dBm lookup table - values from SmartRF Studio */ -typedef struct output_config { - radio_value_t dbm; - uint16_t tx_power; /* Value for the CMD_RADIO_SETUP.txPower field */ -} output_config_t; - -static const output_config_t output_power[] = { - { 5, 0x9330 }, - { 4, 0x9324 }, - { 3, 0x5a1c }, - { 2, 0x4e18 }, - { 1, 0x4214 }, - { 0, 0x3161 }, - { -3, 0x2558 }, - { -6, 0x1d52 }, - { -9, 0x194e }, - {-12, 0x144b }, - {-15, 0x0ccb }, - {-18, 0x0cc9 }, - {-21, 0x0cc7 }, -}; - -#define OUTPUT_CONFIG_COUNT (sizeof(output_power) / sizeof(output_config_t)) - -/* Max and Min Output Power in dBm */ -#define OUTPUT_POWER_MIN (output_power[OUTPUT_CONFIG_COUNT - 1].dbm) -#define OUTPUT_POWER_MAX (output_power[0].dbm) -#define OUTPUT_POWER_UNKNOWN 0xFFFF - -/* Default TX Power - position in output_power[] */ -static const output_config_t *tx_power_current = &output_power[0]; -/*---------------------------------------------------------------------------*/ -static rfc_CMD_IEEE_MOD_FILT_t filter_cmd; -/*---------------------------------------------------------------------------*/ -/* - * Buffers used to send commands to the RF core (generic and IEEE commands). - * Some of those buffers are re-usable, some are not. - * - * If you are uncertain, declare a new buffer. - */ -/* - * A buffer to send a CMD_IEEE_RX and to subsequently monitor its status - * Do not use this buffer for any commands other than CMD_IEEE_RX - */ -static uint8_t cmd_ieee_rx_buf[RF_CMD_BUFFER_SIZE] CC_ALIGN(4); -/*---------------------------------------------------------------------------*/ -#define DATA_ENTRY_LENSZ_NONE 0 -#define DATA_ENTRY_LENSZ_BYTE 1 -#define DATA_ENTRY_LENSZ_WORD 2 /* 2 bytes */ - -/* The size of the metadata (excluding the packet length field) */ -#define RX_BUF_METADATA_SIZE \ - (2 * RF_CORE_RX_BUF_INCLUDE_CRC \ - + RF_CORE_RX_BUF_INCLUDE_RSSI \ - + RF_CORE_RX_BUF_INCLUDE_CORR \ - + 4 * RF_CORE_RX_BUF_INCLUDE_TIMESTAMP) - -/* The offset of the packet length in a rx buffer */ -#define RX_BUF_LENGTH_OFFSET sizeof(rfc_dataEntry_t) -/* The offset of the packet data in a rx buffer */ -#define RX_BUF_DATA_OFFSET (RX_BUF_LENGTH_OFFSET + 1) - -#define RX_BUF_SIZE (RX_BUF_DATA_OFFSET \ - + NETSTACK_RADIO_MAX_PAYLOAD_LEN \ - + RX_BUF_METADATA_SIZE) - -/* Four receive buffers entries with room for 1 IEEE802.15.4 frame in each */ -static uint8_t rx_buf_0[RX_BUF_SIZE] CC_ALIGN(4); -static uint8_t rx_buf_1[RX_BUF_SIZE] CC_ALIGN(4); -static uint8_t rx_buf_2[RX_BUF_SIZE] CC_ALIGN(4); -static uint8_t rx_buf_3[RX_BUF_SIZE] CC_ALIGN(4); - -/* The RX Data Queue */ -static dataQueue_t rx_data_queue = { 0 }; - -/* Receive entry pointer to keep track of read items */ -volatile static uint8_t *rx_read_entry; -/*---------------------------------------------------------------------------*/ -/* The outgoing frame buffer */ -#define TX_BUF_PAYLOAD_LEN 180 -#define TX_BUF_HDR_LEN 2 - -static uint8_t tx_buf[TX_BUF_HDR_LEN + TX_BUF_PAYLOAD_LEN] CC_ALIGN(4); -/*---------------------------------------------------------------------------*/ -#ifdef IEEE_MODE_CONF_BOARD_OVERRIDES -#define IEEE_MODE_BOARD_OVERRIDES IEEE_MODE_CONF_BOARD_OVERRIDES -#else -#define IEEE_MODE_BOARD_OVERRIDES -#endif -/*---------------------------------------------------------------------------*/ -/* Overrides for IEEE 802.15.4, differential mode */ -static uint32_t ieee_overrides[] = { - 0x00354038, /* Synth: Set RTRIM (POTAILRESTRIM) to 5 */ - 0x4001402D, /* Synth: Correct CKVD latency setting (address) */ - 0x00608402, /* Synth: Correct CKVD latency setting (value) */ -// 0x4001405D, /* Synth: Set ANADIV DIV_BIAS_MODE to PG1 (address) */ -// 0x1801F800, /* Synth: Set ANADIV DIV_BIAS_MODE to PG1 (value) */ - 0x000784A3, /* Synth: Set FREF = 3.43 MHz (24 MHz / 7) */ - 0xA47E0583, /* Synth: Set loop bandwidth after lock to 80 kHz (K2) */ - 0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, LSB) */ - 0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, MSB) */ - 0x002B50DC, /* Adjust AGC DC filter */ - 0x05000243, /* Increase synth programming timeout */ - 0x002082C3, /* Increase synth programming timeout */ - IEEE_MODE_BOARD_OVERRIDES - 0xFFFFFFFF, /* End of override list */ -}; -/*---------------------------------------------------------------------------*/ -static int on(void); -static int off(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Checks whether the RFC domain is accessible and the RFC is in IEEE RX - * \return 1: RFC in RX mode (and therefore accessible too). 0 otherwise - */ -static uint8_t -rf_is_on(void) -{ - if(!rf_core_is_accessible()) { - return 0; - } - - return RF_RADIO_OP_GET_STATUS(cmd_ieee_rx_buf) == RF_CORE_RADIO_OP_STATUS_ACTIVE; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Check the RF's TX status - * \return 1 RF is transmitting - * \return 0 RF is not transmitting - * - * TX mode may be triggered either by a CMD_IEEE_TX or by the automatic - * transmission of an ACK frame. - */ -static uint8_t -transmitting(void) -{ - uint32_t cmd_status; - rfc_CMD_IEEE_CCA_REQ_t cmd; - - /* If we are off, we are not in TX */ - if(!rf_core_is_accessible()) { - return 0; - } - - memset(&cmd, 0x00, sizeof(cmd)); - - cmd.commandNo = CMD_IEEE_CCA_REQ; - - if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) == RF_CORE_CMD_ERROR) { - PRINTF("transmitting: CMDSTA=0x%08lx\n", cmd_status); - return 0; - } - - if((cmd.currentRssi == RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN) && - (cmd.ccaInfo.ccaEnergy == RF_CORE_CMD_CCA_REQ_CCA_STATE_BUSY)) { - return 1; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns CCA information - * \return RF_CORE_GET_CCA_INFO_ERROR if the RF was not on - * \return On success, the return value is formatted as per the ccaInfo field - * of CMD_IEEE_CCA_REQ - * - * It is the caller's responsibility to make sure the RF is on. This function - * will return RF_CORE_GET_CCA_INFO_ERROR if the RF is off - * - * This function will in fact wait for a valid CCA state - */ -static uint8_t -get_cca_info(void) -{ - uint32_t cmd_status; - rfc_CMD_IEEE_CCA_REQ_t cmd; - - if(!rf_is_on()) { - PRINTF("get_cca_info: Not on\n"); - return RF_CORE_GET_CCA_INFO_ERROR; - } - - memset(&cmd, 0x00, sizeof(cmd)); - cmd.ccaInfo.ccaState = RF_CORE_CMD_CCA_REQ_CCA_STATE_INVALID; - - while(cmd.ccaInfo.ccaState == RF_CORE_CMD_CCA_REQ_CCA_STATE_INVALID) { - memset(&cmd, 0x00, sizeof(cmd)); - cmd.commandNo = CMD_IEEE_CCA_REQ; - - if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) == RF_CORE_CMD_ERROR) { - PRINTF("get_cca_info: CMDSTA=0x%08lx\n", cmd_status); - - return RF_CORE_GET_CCA_INFO_ERROR; - } - } - - /* We have a valid CCA state. Return the CCA Info */ - return *((uint8_t *)&cmd.ccaInfo); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Reads the current signal strength (RSSI) - * \return The current RSSI in dBm or CMD_GET_RSSI_UNKNOWN - * - * This function reads the current RSSI on the currently configured - * channel. - */ -static radio_value_t -get_rssi(void) -{ - uint32_t cmd_status; - uint8_t was_off = 0; - rfc_CMD_IEEE_CCA_REQ_t cmd; - - /* If we are off, turn on first */ - if(!rf_is_on()) { - was_off = 1; - if(on() != RF_CORE_CMD_OK) { - PRINTF("get_rssi: on() failed\n"); - return RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN; - } - } - - memset(&cmd, 0x00, sizeof(cmd)); - cmd.ccaInfo.ccaEnergy = RF_CORE_CMD_CCA_REQ_CCA_STATE_INVALID; - - while(cmd.ccaInfo.ccaEnergy == RF_CORE_CMD_CCA_REQ_CCA_STATE_INVALID) { - memset(&cmd, 0x00, sizeof(cmd)); - cmd.commandNo = CMD_IEEE_CCA_REQ; - - if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) == RF_CORE_CMD_ERROR) { - PRINTF("get_rssi: CMDSTA=0x%08lx\n", cmd_status); - - /* Make sure to return RSSI unknown */ - cmd.currentRssi = RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN; - break; - } - } - - /* If we were off, turn back off */ - if(was_off) { - off(); - } - - return cmd.currentRssi; -} -/*---------------------------------------------------------------------------*/ -/* Returns the current TX power in dBm */ -static radio_value_t -get_tx_power(void) -{ - return tx_power_current->dbm; -} -/*---------------------------------------------------------------------------*/ -/* - * Set TX power to 'at least' power dBm - * This works with a lookup table. If the value of 'power' does not exist in - * the lookup table, TXPOWER will be set to the immediately higher available - * value - */ -static void -set_tx_power(radio_value_t power) -{ - uint32_t cmd_status; - int i; - rfc_CMD_SET_TX_POWER_t cmd; - - /* First, find the correct setting and save it */ - for(i = OUTPUT_CONFIG_COUNT - 1; i >= 0; --i) { - if(power <= output_power[i].dbm) { - tx_power_current = &output_power[i]; - break; - } - } - - /* - * If the core is not accessible, the new setting will be applied next - * time we send CMD_RADIO_SETUP, so we don't need to do anything further. - * If the core is accessible, we can apply the new setting immediately with - * CMD_SET_TX_POWER - */ - if(rf_core_is_accessible() == RF_CORE_NOT_ACCESSIBLE) { - return; - } - - memset(&cmd, 0x00, sizeof(cmd)); - cmd.commandNo = CMD_SET_TX_POWER; - cmd.txPower = output_power[i].tx_power; - - if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) == RF_CORE_CMD_ERROR) { - PRINTF("set_tx_power: CMDSTA=0x%08lx\n", cmd_status); - } -} -/*---------------------------------------------------------------------------*/ -static uint8_t -rf_radio_setup() -{ - uint32_t cmd_status; - rfc_CMD_RADIO_SETUP_t cmd; - - rf_switch_select_path(RF_SWITCH_PATH_2_4GHZ); - - /* Create radio setup command */ - rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_RADIO_SETUP); - - cmd.txPower = tx_power_current->tx_power; - cmd.pRegOverride = ieee_overrides; - cmd.config.frontEndMode = RF_CORE_RADIO_SETUP_FRONT_END_MODE; - cmd.config.biasMode = RF_CORE_RADIO_SETUP_BIAS_MODE; - cmd.mode = 1; - - /* Send Radio setup to RF Core */ - if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("rf_radio_setup: CMD_RADIO_SETUP, CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd.status); - return RF_CORE_CMD_ERROR; - } - - /* Wait until radio setup is done */ - if(rf_core_wait_cmd_done(&cmd) != RF_CORE_CMD_OK) { - PRINTF("rf_radio_setup: CMD_RADIO_SETUP wait, CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd.status); - return RF_CORE_CMD_ERROR; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Set up radio in IEEE802.15.4 RX mode - * - * \return RF_CORE_CMD_OK Succeeded - * \return RF_CORE_CMD_ERROR Failed - * - * This function assumes that cmd_ieee_rx_buf has been previously populated - * with correct values. This can be done through init_rf_params (sets defaults) - * or through Contiki's extended RF API (set_value, set_object) - */ -static uint8_t -rf_cmd_ieee_rx() -{ - uint32_t cmd_status; - int ret; - - ret = rf_core_send_cmd((uint32_t)cmd_ieee_rx_buf, &cmd_status); - - if(ret != RF_CORE_CMD_OK) { - PRINTF("rf_cmd_ieee_rx: ret=%d, CMDSTA=0x%08lx, status=0x%04x\n", - ret, cmd_status, RF_RADIO_OP_GET_STATUS(cmd_ieee_rx_buf)); - return RF_CORE_CMD_ERROR; - } - - RTIMER_BUSYWAIT_UNTIL(RF_RADIO_OP_GET_STATUS(cmd_ieee_rx_buf) == RF_CORE_RADIO_OP_STATUS_ACTIVE, - RF_CORE_ENTER_RX_TIMEOUT); - - /* Wait to enter RX */ - if(RF_RADIO_OP_GET_STATUS(cmd_ieee_rx_buf) != RF_CORE_RADIO_OP_STATUS_ACTIVE) { - PRINTF("rf_cmd_ieee_rx: CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, RF_RADIO_OP_GET_STATUS(cmd_ieee_rx_buf)); - return RF_CORE_CMD_ERROR; - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static void -init_rx_buffers(void) -{ - rfc_dataEntry_t *entry; - - entry = (rfc_dataEntry_t *)rx_buf_0; - entry->pNextEntry = rx_buf_1; - entry->config.lenSz = DATA_ENTRY_LENSZ_BYTE; - entry->length = sizeof(rx_buf_0) - sizeof(*entry); - - entry = (rfc_dataEntry_t *)rx_buf_1; - entry->pNextEntry = rx_buf_2; - entry->config.lenSz = DATA_ENTRY_LENSZ_BYTE; - entry->length = sizeof(rx_buf_0) - sizeof(*entry); - - entry = (rfc_dataEntry_t *)rx_buf_2; - entry->pNextEntry = rx_buf_3; - entry->config.lenSz = DATA_ENTRY_LENSZ_BYTE; - entry->length = sizeof(rx_buf_0) - sizeof(*entry); - - entry = (rfc_dataEntry_t *)rx_buf_3; - entry->pNextEntry = rx_buf_0; - entry->config.lenSz = DATA_ENTRY_LENSZ_BYTE; - entry->length = sizeof(rx_buf_0) - sizeof(*entry); -} -/*---------------------------------------------------------------------------*/ -static void -init_rf_params(void) -{ - rfc_CMD_IEEE_RX_t *cmd = (rfc_CMD_IEEE_RX_t *)cmd_ieee_rx_buf; - - memset(cmd_ieee_rx_buf, 0x00, RF_CMD_BUFFER_SIZE); - - cmd->commandNo = CMD_IEEE_RX; - cmd->status = RF_CORE_RADIO_OP_STATUS_IDLE; - cmd->pNextOp = NULL; - cmd->startTime = 0x00000000; - cmd->startTrigger.triggerType = TRIG_NOW; - cmd->condition.rule = COND_NEVER; - cmd->channel = IEEE802154_DEFAULT_CHANNEL; - - cmd->rxConfig.bAutoFlushCrc = 1; - cmd->rxConfig.bAutoFlushIgn = 0; - cmd->rxConfig.bIncludePhyHdr = 0; - cmd->rxConfig.bIncludeCrc = RF_CORE_RX_BUF_INCLUDE_CRC; - cmd->rxConfig.bAppendRssi = RF_CORE_RX_BUF_INCLUDE_RSSI; - cmd->rxConfig.bAppendCorrCrc = RF_CORE_RX_BUF_INCLUDE_CORR; - cmd->rxConfig.bAppendSrcInd = 0; - cmd->rxConfig.bAppendTimestamp = RF_CORE_RX_BUF_INCLUDE_TIMESTAMP; - - cmd->pRxQ = &rx_data_queue; - cmd->pOutput = (rfc_ieeeRxOutput_t *)rf_stats; - -#if IEEE_MODE_PROMISCOUS - cmd->frameFiltOpt.frameFiltEn = 0; -#else - cmd->frameFiltOpt.frameFiltEn = 1; -#endif - - cmd->frameFiltOpt.frameFiltStop = 1; - -#if IEEE_MODE_AUTOACK - cmd->frameFiltOpt.autoAckEn = 1; -#else - cmd->frameFiltOpt.autoAckEn = 0; -#endif - - cmd->frameFiltOpt.slottedAckEn = 0; - cmd->frameFiltOpt.autoPendEn = 0; - cmd->frameFiltOpt.defaultPend = 0; - cmd->frameFiltOpt.bPendDataReqOnly = 0; - cmd->frameFiltOpt.bPanCoord = 0; - cmd->frameFiltOpt.maxFrameVersion = 2; - cmd->frameFiltOpt.bStrictLenFilter = 0; - - /* Receive all frame types */ - cmd->frameTypes.bAcceptFt0Beacon = 1; - cmd->frameTypes.bAcceptFt1Data = 1; - cmd->frameTypes.bAcceptFt2Ack = 1; - cmd->frameTypes.bAcceptFt3MacCmd = 1; - cmd->frameTypes.bAcceptFt4Reserved = 1; - cmd->frameTypes.bAcceptFt5Reserved = 1; - cmd->frameTypes.bAcceptFt6Reserved = 1; - cmd->frameTypes.bAcceptFt7Reserved = 1; - - /* Configure CCA settings */ - cmd->ccaOpt.ccaEnEnergy = 1; - cmd->ccaOpt.ccaEnCorr = 1; - cmd->ccaOpt.ccaEnSync = 1; - cmd->ccaOpt.ccaCorrOp = 1; - cmd->ccaOpt.ccaSyncOp = 0; - cmd->ccaOpt.ccaCorrThr = 3; - - cmd->ccaRssiThr = IEEE_MODE_RSSI_THRESHOLD; - - cmd->numExtEntries = 0x00; - cmd->numShortEntries = 0x00; - cmd->pExtEntryList = 0; - cmd->pShortEntryList = 0; - - cmd->endTrigger.triggerType = TRIG_NEVER; - cmd->endTime = 0x00000000; - - /* set address filter command */ - filter_cmd.commandNo = CMD_IEEE_MOD_FILT; - memcpy(&filter_cmd.newFrameFiltOpt, &cmd->frameFiltOpt, sizeof(cmd->frameFiltOpt)); - memcpy(&filter_cmd.newFrameTypes, &cmd->frameTypes, sizeof(cmd->frameTypes)); -} -/*---------------------------------------------------------------------------*/ -static int -rx_on(void) -{ - int ret; - - /* Get status of running IEEE_RX (if any) */ - if(rf_is_on()) { - PRINTF("rx_on: We were on. PD=%u, RX=0x%04x \n", rf_core_is_accessible(), - RF_RADIO_OP_GET_STATUS(cmd_ieee_rx_buf)); - return RF_CORE_CMD_OK; - } - - /* Put CPE in RX using the currently configured parameters */ - ret = rf_cmd_ieee_rx(); - - if(ret) { - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -rx_off(void) -{ - uint32_t cmd_status; - int ret; - - /* If we are off, do nothing */ - if(!rf_is_on()) { - return RF_CORE_CMD_OK; - } - - /* Wait for ongoing ACK TX to finish */ - RTIMER_BUSYWAIT_UNTIL(!transmitting(), RF_CORE_TX_FINISH_TIMEOUT); - - /* Send a CMD_ABORT command to RF Core */ - if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_ABORT), &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("RX off: CMD_ABORT status=0x%08lx\n", cmd_status); - /* Continue nonetheless */ - } - - RTIMER_BUSYWAIT_UNTIL(!rf_is_on(), RF_CORE_TURN_OFF_TIMEOUT); - - if(RF_RADIO_OP_GET_STATUS(cmd_ieee_rx_buf) == IEEE_DONE_STOPPED || - RF_RADIO_OP_GET_STATUS(cmd_ieee_rx_buf) == IEEE_DONE_ABORT) { - /* Stopped gracefully */ - ret = RF_CORE_CMD_OK; - } else { - PRINTF("RX off: BG status=0x%04x\n", RF_RADIO_OP_GET_STATUS(cmd_ieee_rx_buf)); - ret = RF_CORE_CMD_ERROR; - } - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - - return ret; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -request(void) -{ - /* - * We rely on the RDC layer to turn us on and off. Thus, if we are on we - * will only allow sleep, standby otherwise - */ - if(rf_is_on()) { - return LPM_MODE_SLEEP; - } - - return LPM_MODE_MAX_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -LPM_MODULE(cc26xx_rf_lpm_module, request, NULL, NULL, LPM_DOMAIN_NONE); -/*---------------------------------------------------------------------------*/ -static void -soft_off(void) -{ - uint32_t cmd_status; - volatile rfc_radioOp_t *cmd = rf_core_get_last_radio_op(); - - if(!rf_core_is_accessible()) { - return; - } - - PRINTF("soft_off: Aborting 0x%04x, Status=0x%04x\n", cmd->commandNo, - cmd->status); - - /* Send a CMD_ABORT command to RF Core */ - if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_ABORT), &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("soft_off: CMD_ABORT status=0x%08lx\n", cmd_status); - return; - } - - RTIMER_BUSYWAIT_UNTIL((cmd->status & RF_CORE_RADIO_OP_MASKED_STATUS) != - RF_CORE_RADIO_OP_MASKED_STATUS_RUNNING, RF_CORE_TURN_OFF_TIMEOUT); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -soft_on(void) -{ - if(rf_radio_setup() != RF_CORE_CMD_OK) { - PRINTF("on: radio_setup() failed\n"); - return RF_CORE_CMD_ERROR; - } - - return rx_on(); -} -/*---------------------------------------------------------------------------*/ -static const rf_core_primary_mode_t mode_ieee = { - soft_off, - soft_on, - rf_is_on, - RAT_TIMESTAMP_OFFSET_2_4_GHZ -}; -/*---------------------------------------------------------------------------*/ -static int -init(void) -{ - lpm_register_module(&cc26xx_rf_lpm_module); - - rf_core_set_modesel(); - - /* Initialise RX buffers */ - memset(rx_buf_0, 0, RX_BUF_SIZE); - memset(rx_buf_1, 0, RX_BUF_SIZE); - memset(rx_buf_2, 0, RX_BUF_SIZE); - memset(rx_buf_3, 0, RX_BUF_SIZE); - - /* Set of RF Core data queue. Circular buffer, no last entry */ - rx_data_queue.pCurrEntry = rx_buf_0; - - rx_data_queue.pLastEntry = NULL; - - /* Initialize current read pointer to first element (used in ISR) */ - rx_read_entry = rx_buf_0; - - /* Populate the RF parameters data structure with default values */ - init_rf_params(); - - if(on() != RF_CORE_CMD_OK) { - PRINTF("init: on() failed\n"); - return RF_CORE_CMD_ERROR; - } - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - - rf_core_primary_mode_register(&mode_ieee); - - rf_core_rat_init(); - - process_start(&rf_core_process, NULL); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -prepare(const void *payload, unsigned short payload_len) -{ - int len = MIN(payload_len, TX_BUF_PAYLOAD_LEN); - - memcpy(&tx_buf[TX_BUF_HDR_LEN], payload, len); - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -transmit(unsigned short transmit_len) -{ - int ret; - uint8_t was_off = 0; - uint32_t cmd_status; - uint16_t stat; - uint8_t tx_active = 0; - rtimer_clock_t t0; - volatile rfc_CMD_IEEE_TX_t cmd; - - if(!rf_is_on()) { - was_off = 1; - if(on() != RF_CORE_CMD_OK) { - PRINTF("transmit: on() failed\n"); - return RADIO_TX_ERR; - } - } - - /* - * We are certainly not TXing a frame as a result of CMD_IEEE_TX, but we may - * be in the process of TXing an ACK. In that case, wait for the TX to finish - * or return after approx TX_WAIT_TIMEOUT - */ - t0 = RTIMER_NOW(); - - do { - tx_active = transmitting(); - } while(tx_active == 1 && - (RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + RF_CORE_TX_TIMEOUT))); - - if(tx_active) { - PRINTF("transmit: Already TXing and wait timed out\n"); - - if(was_off) { - off(); - } - - return RADIO_TX_COLLISION; - } - - /* Send the CMD_IEEE_TX command */ - rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_IEEE_TX); - - cmd.payloadLen = transmit_len; - cmd.pPayload = &tx_buf[TX_BUF_HDR_LEN]; - - cmd.startTime = 0; - cmd.startTrigger.triggerType = TRIG_NOW; - - /* Enable the LAST_FG_COMMAND_DONE interrupt, which will wake us up */ - rf_core_cmd_done_en(true); - - ret = rf_core_send_cmd((uint32_t)&cmd, &cmd_status); - - if(ret) { - /* If we enter here, TX actually started */ - ENERGEST_SWITCH(ENERGEST_TYPE_LISTEN, ENERGEST_TYPE_TRANSMIT); - - /* Idle away while the command is running */ - while((cmd.status & RF_CORE_RADIO_OP_MASKED_STATUS) - == RF_CORE_RADIO_OP_MASKED_STATUS_RUNNING) { - /* Note: for now sleeping while Tx'ing in polling mode is disabled. - * To enable it: - * 1) make the `lpm_sleep()` call here unconditional; - * 2) change the radio ISR priority to allow radio ISR to interrupt rtimer ISR. - */ - if(!rf_core_poll_mode) { - lpm_sleep(); - } - } - - stat = cmd.status; - - if(stat == RF_CORE_RADIO_OP_STATUS_IEEE_DONE_OK) { - /* Sent OK */ - ret = RADIO_TX_OK; - } else { - /* Operation completed, but frame was not sent */ - PRINTF("transmit: ret=%d, CMDSTA=0x%08lx, status=0x%04x\n", ret, - cmd_status, stat); - ret = RADIO_TX_ERR; - } - } else { - /* Failure sending the CMD_IEEE_TX command */ - PRINTF("transmit: ret=%d, CMDSTA=0x%08lx, status=0x%04x\n", - ret, cmd_status, cmd.status); - - ret = RADIO_TX_ERR; - } - - /* - * Update ENERGEST state here, before a potential call to off(), which - * will correctly update it if required. - */ - ENERGEST_SWITCH(ENERGEST_TYPE_TRANSMIT, ENERGEST_TYPE_LISTEN); - - /* - * Disable LAST_FG_COMMAND_DONE interrupt. We don't really care about it - * except when we are transmitting - */ - rf_core_cmd_done_dis(); - - if(was_off) { - off(); - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -send(const void *payload, unsigned short payload_len) -{ - prepare(payload, payload_len); - return transmit(payload_len); -} -/*---------------------------------------------------------------------------*/ -static void -release_data_entry(void) -{ - rfc_dataEntryGeneral_t *entry = (rfc_dataEntryGeneral_t *)rx_read_entry; - - /* Clear the length byte */ - rx_read_entry[8] = 0; - - /* Set status to 0 "Pending" in element */ - entry->status = DATA_ENTRY_STATUS_PENDING; - rx_read_entry = entry->pNextEntry; -} -/*---------------------------------------------------------------------------*/ -static int -read_frame(void *buf, unsigned short buf_len) -{ - int len = 0; - rfc_dataEntryGeneral_t *entry = (rfc_dataEntryGeneral_t *)rx_read_entry; - uint32_t rat_timestamp; - - /* wait for entry to become finished */ - rtimer_clock_t t0 = RTIMER_NOW(); - while(entry->status == DATA_ENTRY_STATUS_BUSY - && RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (RTIMER_SECOND / 250))); - - if(entry->status != DATA_ENTRY_STATUS_FINISHED) { - /* No available data */ - return 0; - } - - len = rx_read_entry[RX_BUF_LENGTH_OFFSET]; - if(len <= RX_BUF_METADATA_SIZE) { - PRINTF("RF: too short!"); - - release_data_entry(); - return 0; - } - - len -= RX_BUF_METADATA_SIZE; - if(len > buf_len) { - PRINTF("RF: too long\n"); - - release_data_entry(); - return 0; - } - - memcpy(buf, (uint8_t *)rx_read_entry + RX_BUF_DATA_OFFSET, len); - - rf_core_last_rssi = (int8_t)rx_read_entry[RX_BUF_DATA_OFFSET + len]; - rf_core_last_corr_lqi = (uint8_t)rx_read_entry[RX_BUF_DATA_OFFSET + len + 1] & STATUS_CORRELATION; - - /* get the timestamp */ - memcpy(&rat_timestamp, (uint8_t *)rx_read_entry + RX_BUF_DATA_OFFSET + len + 2, 4); - - rf_core_last_packet_timestamp = rf_core_convert_rat_to_rtimer(rat_timestamp); - - if(!rf_core_poll_mode) { - /* Not in poll mode: packetbuf should not be accessed in interrupt context. - * In poll mode, the last packet RSSI and link quality can be obtained through - * RADIO_PARAM_LAST_RSSI and RADIO_PARAM_LAST_LINK_QUALITY */ - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, rf_core_last_rssi); - packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, rf_core_last_corr_lqi); - } - - release_data_entry(); - - return len; -} -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - uint8_t was_off = 0; - uint8_t cca_info; - int ret = RF_CORE_CCA_CLEAR; - - /* - * If we are in the middle of a BLE operation, we got called by ContikiMAC - * from within an interrupt context. Indicate a clear channel - */ - if(rf_ble_is_active() == RF_BLE_ACTIVE) { - PRINTF("channel_clear: Interrupt context but BLE in progress\n"); - return RF_CORE_CCA_CLEAR; - } - - if(rf_is_on()) { - /* - * Wait for potential leftover ACK still being sent. - * Strictly speaking, if we are TXing an ACK then the channel is not clear. - * However, channel_clear is only ever called to determine whether there is - * someone else's packet in the air, not ours. - * - * We could probably even simply return that the channel is clear - */ - RTIMER_BUSYWAIT_UNTIL(!transmitting(), RF_CORE_TX_FINISH_TIMEOUT); - } else { - was_off = 1; - if(on() != RF_CORE_CMD_OK) { - PRINTF("channel_clear: on() failed\n"); - if(was_off) { - off(); - } - return RF_CORE_CCA_CLEAR; - } - } - - cca_info = get_cca_info(); - - if(cca_info == RF_CORE_GET_CCA_INFO_ERROR) { - PRINTF("channel_clear: CCA error\n"); - ret = RF_CORE_CCA_CLEAR; - } else { - /* - * cca_info bits 1:0 - ccaStatus - * Return 1 (clear) if idle or invalid. - */ - ret = (cca_info & 0x03) != RF_CORE_CMD_CCA_REQ_CCA_STATE_BUSY; - } - - if(was_off) { - off(); - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - uint8_t cca_info; - - /* - * If we are in the middle of a BLE operation, we got called by ContikiMAC - * from within an interrupt context. We are not receiving - */ - if(rf_ble_is_active() == RF_BLE_ACTIVE) { - PRINTF("receiving_packet: Interrupt context but BLE in progress\n"); - return 0; - } - - /* If we are off, we are not receiving */ - if(!rf_is_on()) { - PRINTF("receiving_packet: We were off\n"); - return 0; - } - - /* If we are transmitting (can only be an ACK here), we are not receiving */ - if(transmitting()) { - PRINTF("receiving_packet: We were TXing\n"); - return 0; - } - - cca_info = get_cca_info(); - - /* If we can't read CCA info, return "not receiving" */ - if(cca_info == RF_CORE_GET_CCA_INFO_ERROR) { - return 0; - } - - /* If sync has been seen, return 1 (receiving) */ - if(cca_info & RF_CORE_CMD_CCA_REQ_CCA_SYNC_BUSY) { - return 1; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - volatile rfc_dataEntry_t *entry = (rfc_dataEntry_t *)rx_data_queue.pCurrEntry; - int rv = 0; - - /* Go through all RX buffers and check their status */ - do { - if(entry->status == DATA_ENTRY_STATUS_FINISHED - || entry->status == DATA_ENTRY_STATUS_BUSY) { - rv = 1; - if(!rf_core_poll_mode) { - process_poll(&rf_core_process); - } - } - - entry = (rfc_dataEntry_t *)entry->pNextEntry; - } while(entry != (rfc_dataEntry_t *)rx_data_queue.pCurrEntry); - - /* If we didn't find an entry at status finished, no frames are pending */ - return rv; -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - /* - * If we are in the middle of a BLE operation, we got called by ContikiMAC - * from within an interrupt context. Abort, but pretend everything is OK. - */ - if(rf_ble_is_active() == RF_BLE_ACTIVE) { - PRINTF("on: Interrupt context but BLE in progress\n"); - return RF_CORE_CMD_OK; - } - - /* - * Request the HF XOSC as the source for the HF clock. Needed before we can - * use the FS. This will only request, it will _not_ perform the switch. - */ - oscillators_request_hf_xosc(); - - if(rf_is_on()) { - PRINTF("on: We were on. PD=%u, RX=0x%04x \n", rf_core_is_accessible(), - RF_RADIO_OP_GET_STATUS(cmd_ieee_rx_buf)); - return RF_CORE_CMD_OK; - } - - init_rx_buffers(); - - /* - * Trigger a switch to the XOSC, so that we can subsequently use the RF FS - * This will block until the XOSC is actually ready, but give how we - * requested it early on, this won't be too long a wait. - * This should be done before starting the RAT. - */ - oscillators_switch_to_hf_xosc(); - - if(rf_core_boot() != RF_CORE_CMD_OK) { - PRINTF("on: rf_core_boot() failed\n"); - return RF_CORE_CMD_ERROR; - } - - rf_core_setup_interrupts(); - - if(rf_radio_setup() != RF_CORE_CMD_OK) { - PRINTF("on: radio_setup() failed\n"); - return RF_CORE_CMD_ERROR; - } - - return rx_on(); -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - /* - * If we are in the middle of a BLE operation, we got called by ContikiMAC - * from within an interrupt context. Abort, but pretend everything is OK. - */ - if(rf_ble_is_active() == RF_BLE_ACTIVE) { - PRINTF("off: Interrupt context but BLE in progress\n"); - return RF_CORE_CMD_OK; - } - - RTIMER_BUSYWAIT_UNTIL(!transmitting(), RF_CORE_TX_FINISH_TIMEOUT); - - /* stopping the rx explicitly results in lower sleep-mode power usage */ - rx_off(); - rf_core_power_down(); - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - -#if !CC2650_FAST_RADIO_STARTUP - /* Switch HF clock source to the RCOSC to preserve power. - * This must be done after stopping RAT. - */ - oscillators_switch_to_hf_rc(); -#endif - - /* We pulled the plug, so we need to restore the status manually */ - ((rfc_CMD_IEEE_RX_t *)cmd_ieee_rx_buf)->status = RF_CORE_RADIO_OP_STATUS_IDLE; - - /* - * Just in case there was an ongoing RX (which started after we begun the - * shutdown sequence), we don't want to leave the buffer in state == ongoing - */ - if(((rfc_dataEntry_t *)rx_buf_0)->status == DATA_ENTRY_STATUS_BUSY) { - ((rfc_dataEntry_t *)rx_buf_0)->status = DATA_ENTRY_STATUS_PENDING; - } - if(((rfc_dataEntry_t *)rx_buf_1)->status == DATA_ENTRY_STATUS_BUSY) { - ((rfc_dataEntry_t *)rx_buf_1)->status = DATA_ENTRY_STATUS_PENDING; - } - if(((rfc_dataEntry_t *)rx_buf_2)->status == DATA_ENTRY_STATUS_BUSY) { - ((rfc_dataEntry_t *)rx_buf_2)->status = DATA_ENTRY_STATUS_PENDING; - } - if(((rfc_dataEntry_t *)rx_buf_3)->status == DATA_ENTRY_STATUS_BUSY) { - ((rfc_dataEntry_t *)rx_buf_3)->status = DATA_ENTRY_STATUS_PENDING; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -/* Enable or disable CCA before sending */ -static radio_result_t -set_send_on_cca(uint8_t enable) -{ - if(enable) { - /* this driver does not have support for CCA on Tx */ - return RADIO_RESULT_NOT_SUPPORTED; - } - return RADIO_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - rfc_CMD_IEEE_RX_t *cmd = (rfc_CMD_IEEE_RX_t *)cmd_ieee_rx_buf; - - if(!value) { - return RADIO_RESULT_INVALID_VALUE; - } - - switch(param) { - case RADIO_PARAM_POWER_MODE: - /* On / off */ - *value = rf_is_on() ? RADIO_POWER_MODE_ON : RADIO_POWER_MODE_OFF; - return RADIO_RESULT_OK; - case RADIO_PARAM_CHANNEL: - *value = (radio_value_t)cmd->channel; - return RADIO_RESULT_OK; - case RADIO_PARAM_PAN_ID: - *value = (radio_value_t)cmd->localPanID; - return RADIO_RESULT_OK; - case RADIO_PARAM_16BIT_ADDR: - *value = (radio_value_t)cmd->localShortAddr; - return RADIO_RESULT_OK; - case RADIO_PARAM_RX_MODE: - *value = 0; - if(cmd->frameFiltOpt.frameFiltEn) { - *value |= RADIO_RX_MODE_ADDRESS_FILTER; - } - if(cmd->frameFiltOpt.autoAckEn) { - *value |= RADIO_RX_MODE_AUTOACK; - } - if(rf_core_poll_mode) { - *value |= RADIO_RX_MODE_POLL_MODE; - } - - return RADIO_RESULT_OK; - case RADIO_PARAM_TX_MODE: - *value = 0; - return RADIO_RESULT_OK; - case RADIO_PARAM_TXPOWER: - *value = get_tx_power(); - return RADIO_RESULT_OK; - case RADIO_PARAM_CCA_THRESHOLD: - *value = cmd->ccaRssiThr; - return RADIO_RESULT_OK; - case RADIO_PARAM_RSSI: - *value = get_rssi(); - - if(*value == RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN) { - return RADIO_RESULT_ERROR; - } else { - return RADIO_RESULT_OK; - } - case RADIO_CONST_CHANNEL_MIN: - *value = IEEE_MODE_CHANNEL_MIN; - return RADIO_RESULT_OK; - case RADIO_CONST_CHANNEL_MAX: - *value = IEEE_MODE_CHANNEL_MAX; - return RADIO_RESULT_OK; - case RADIO_CONST_TXPOWER_MIN: - *value = OUTPUT_POWER_MIN; - return RADIO_RESULT_OK; - case RADIO_CONST_TXPOWER_MAX: - *value = OUTPUT_POWER_MAX; - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_RSSI: - *value = rf_core_last_rssi; - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_LINK_QUALITY: - *value = rf_core_last_corr_lqi; - return RADIO_RESULT_OK; - case RADIO_CONST_PHY_OVERHEAD: - *value = (radio_value_t)RADIO_PHY_OVERHEAD; - return RADIO_RESULT_OK; - case RADIO_CONST_BYTE_AIR_TIME: - *value = (radio_value_t)RADIO_BYTE_AIR_TIME; - return RADIO_RESULT_OK; - case RADIO_CONST_DELAY_BEFORE_TX: - *value = (radio_value_t)RADIO_DELAY_BEFORE_TX; - return RADIO_RESULT_OK; - case RADIO_CONST_DELAY_BEFORE_RX: - *value = (radio_value_t)RADIO_DELAY_BEFORE_RX; - return RADIO_RESULT_OK; - case RADIO_CONST_DELAY_BEFORE_DETECT: - *value = (radio_value_t)RADIO_DELAY_BEFORE_DETECT; - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - radio_result_t rv = RADIO_RESULT_OK; - rfc_CMD_IEEE_RX_t *cmd = (rfc_CMD_IEEE_RX_t *)cmd_ieee_rx_buf; - uint8_t old_poll_mode; - - switch(param) { - case RADIO_PARAM_POWER_MODE: - if(value == RADIO_POWER_MODE_ON) { - if(on() != RF_CORE_CMD_OK) { - PRINTF("set_value: on() failed (1)\n"); - return RADIO_RESULT_ERROR; - } - return RADIO_RESULT_OK; - } - if(value == RADIO_POWER_MODE_OFF) { - off(); - return RADIO_RESULT_OK; - } - return RADIO_RESULT_INVALID_VALUE; - case RADIO_PARAM_CHANNEL: - if(value < IEEE_MODE_CHANNEL_MIN || - value > IEEE_MODE_CHANNEL_MAX) { - return RADIO_RESULT_INVALID_VALUE; - } - - /* Note: this return may lead to long periods when RAT and RTC are not resynchronized */ - if(cmd->channel == (uint8_t)value) { - /* We already have that very same channel configured. - * Nothing to do here. */ - return RADIO_RESULT_OK; - } - - cmd->channel = (uint8_t)value; - break; - case RADIO_PARAM_PAN_ID: - cmd->localPanID = (uint16_t)value; - break; - case RADIO_PARAM_16BIT_ADDR: - cmd->localShortAddr = (uint16_t)value; - break; - case RADIO_PARAM_RX_MODE: - { - if(value & ~(RADIO_RX_MODE_ADDRESS_FILTER | - RADIO_RX_MODE_AUTOACK | RADIO_RX_MODE_POLL_MODE)) { - return RADIO_RESULT_INVALID_VALUE; - } - - cmd->frameFiltOpt.frameFiltEn = (value & RADIO_RX_MODE_ADDRESS_FILTER) != 0; - cmd->frameFiltOpt.frameFiltStop = 1; - cmd->frameFiltOpt.autoAckEn = (value & RADIO_RX_MODE_AUTOACK) != 0; - cmd->frameFiltOpt.slottedAckEn = 0; - cmd->frameFiltOpt.autoPendEn = 0; - cmd->frameFiltOpt.defaultPend = 0; - cmd->frameFiltOpt.bPendDataReqOnly = 0; - cmd->frameFiltOpt.bPanCoord = 0; - cmd->frameFiltOpt.bStrictLenFilter = 0; - - old_poll_mode = rf_core_poll_mode; - rf_core_poll_mode = (value & RADIO_RX_MODE_POLL_MODE) != 0; - if(rf_core_poll_mode == old_poll_mode) { - uint32_t cmd_status; - - /* do not turn the radio on and off, just send an update command */ - memcpy(&filter_cmd.newFrameFiltOpt, &cmd->frameFiltOpt, sizeof(cmd->frameFiltOpt)); - - if(rf_core_send_cmd((uint32_t)&filter_cmd, &cmd_status) == RF_CORE_CMD_ERROR) { - PRINTF("setting address filter failed: CMDSTA=0x%08lx\n", cmd_status); - return RADIO_RESULT_ERROR; - } - return RADIO_RESULT_OK; - } - break; - } - - case RADIO_PARAM_TX_MODE: - if(value & ~(RADIO_TX_MODE_SEND_ON_CCA)) { - return RADIO_RESULT_INVALID_VALUE; - } - return set_send_on_cca((value & RADIO_TX_MODE_SEND_ON_CCA) != 0); - - case RADIO_PARAM_TXPOWER: - if(value < OUTPUT_POWER_MIN || value > OUTPUT_POWER_MAX) { - return RADIO_RESULT_INVALID_VALUE; - } - - set_tx_power(value); - - return RADIO_RESULT_OK; - - case RADIO_PARAM_CCA_THRESHOLD: - cmd->ccaRssiThr = (int8_t)value; - break; - - default: - return RADIO_RESULT_NOT_SUPPORTED; - } - - /* If off, the new configuration will be applied the next time radio is started */ - if(!rf_is_on()) { - return RADIO_RESULT_OK; - } - - /* If we reach here we had no errors. Apply new settings */ - if(rx_off() != RF_CORE_CMD_OK) { - PRINTF("set_value: rx_off() failed\n"); - rv = RADIO_RESULT_ERROR; - } - - /* Restart the radio timer (RAT). - This causes resynchronization between RAT and RTC: useful for TSCH. */ - if(rf_core_restart_rat() == RF_CORE_CMD_OK) { - rf_core_check_rat_overflow(); - } - - if(rx_on() != RF_CORE_CMD_OK) { - PRINTF("set_value: rx_on() failed\n"); - rv = RADIO_RESULT_ERROR; - } - - return rv; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - uint8_t *target; - uint8_t *src; - int i; - rfc_CMD_IEEE_RX_t *cmd = (rfc_CMD_IEEE_RX_t *)cmd_ieee_rx_buf; - - if(param == RADIO_PARAM_64BIT_ADDR) { - if(size != 8 || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - - target = dest; - src = (uint8_t *)(&cmd->localExtAddr); - - for(i = 0; i < 8; i++) { - target[i] = src[7 - i]; - } - - return RADIO_RESULT_OK; - } - - if(param == RADIO_PARAM_LAST_PACKET_TIMESTAMP) { - if(size != sizeof(rtimer_clock_t) || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - *(rtimer_clock_t *)dest = rf_core_last_packet_timestamp; - - return RADIO_RESULT_OK; - } - - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - radio_result_t rv = RADIO_RESULT_OK; - int i; - uint8_t *dst; - rfc_CMD_IEEE_RX_t *cmd = (rfc_CMD_IEEE_RX_t *)cmd_ieee_rx_buf; - - if(param == RADIO_PARAM_64BIT_ADDR) { - if(size != 8 || !src) { - return RADIO_RESULT_INVALID_VALUE; - } - - dst = (uint8_t *)(&cmd->localExtAddr); - - for(i = 0; i < 8; i++) { - dst[i] = ((uint8_t *)src)[7 - i]; - } - - /* If off, the new configuration will be applied the next time radio is started */ - if(!rf_is_on()) { - return RADIO_RESULT_OK; - } - - if(rx_off() != RF_CORE_CMD_OK) { - PRINTF("set_object: rx_off() failed\n"); - rv = RADIO_RESULT_ERROR; - } - - if(rx_on() != RF_CORE_CMD_OK) { - PRINTF("set_object: rx_on() failed\n"); - rv = RADIO_RESULT_ERROR; - } - - return rv; - } - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -const struct radio_driver ieee_mode_driver = { - init, - prepare, - transmit, - send, - read_frame, - channel_clear, - receiving_packet, - pending_packet, - on, - off, - get_value, - set_value, - get_object, - set_object, -}; -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/prop-mode-tx-power.c b/arch/cpu/cc26x0-cc13x0/rf-core/prop-mode-tx-power.c deleted file mode 100644 index 0cfc5d3ba..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/prop-mode-tx-power.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rf-core-prop - * @{ - * - * \file - * Default TX power settings. The board can override - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/radio.h" -#include "rf-core/prop-mode.h" -/*---------------------------------------------------------------------------*/ -/* Default TX power settings for the 779-930MHz band */ -const prop_mode_tx_power_config_t prop_mode_tx_power_779_930[] = { - { 14, 0xa73f }, - { 13, 0xa63f }, /* 12.5 */ - { 12, 0xb818 }, - { 11, 0x50da }, - { 10, 0x38d3 }, - { 9, 0x2ccd }, - { 8, 0x24cb }, - { 7, 0x20c9 }, - { 6, 0x1cc7 }, - { 5, 0x18c6 }, - { 4, 0x18c5 }, - { 3, 0x14c4 }, - { 2, 0x1042 }, - { 1, 0x10c3 }, - { 0, 0x0041 }, - { -10, 0x08c0 }, - {-128, 0xFFFF }, -}; -/*---------------------------------------------------------------------------*/ -/* Default TX power settings for the 431-527MHz band */ -const prop_mode_tx_power_config_t prop_mode_tx_power_431_527[] = { - { 15, 0x003f }, - { 14, 0xbe3f }, /* 13.7 */ - { 13, 0x6a0f }, - { 10, 0x3dcb }, - { 6, 0x22c4 }, - {-128, 0xFFFF }, -}; -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/prop-mode.c b/arch/cpu/cc26x0-cc13x0/rf-core/prop-mode.c deleted file mode 100644 index 0ce6de5dd..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/prop-mode.c +++ /dev/null @@ -1,1345 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rf-core-prop - * @{ - * - * \file - * Implementation of the CC13xx prop mode NETSTACK_RADIO driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/radio.h" -#include "dev/cc26xx-uart.h" -#include "dev/oscillators.h" -#include "dev/watchdog.h" -#include "net/packetbuf.h" -#include "net/netstack.h" -#include "sys/energest.h" -#include "sys/clock.h" -#include "sys/critical.h" -#include "sys/rtimer.h" -#include "sys/cc.h" -#include "lpm.h" -#include "ti-lib.h" -#include "rf-core/rf-core.h" -#include "rf-core/rf-switch.h" -#include "rf-core/rf-ble.h" -#include "rf-core/prop-mode.h" -#include "rf-core/dot-15-4g.h" -/*---------------------------------------------------------------------------*/ -/* RF core and RF HAL API */ -#include "hw_rfc_dbell.h" -#include "hw_rfc_pwr.h" -/*---------------------------------------------------------------------------*/ -/* RF Core Mailbox API */ -#include "driverlib/rf_mailbox.h" -#include "driverlib/rf_common_cmd.h" -#include "driverlib/rf_data_entry.h" -#include "driverlib/rf_prop_mailbox.h" -#include "driverlib/rf_prop_cmd.h" -/*---------------------------------------------------------------------------*/ -/* CC13xxware patches */ -#include "rf_patches/rf_patch_cpe_genfsk.h" -#include "rf_patches/rf_patch_rfe_genfsk.h" -/*---------------------------------------------------------------------------*/ -#include "rf-core/smartrf-settings.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* Data entry status field constants */ -#define DATA_ENTRY_STATUS_PENDING 0x00 /* Not in use by the Radio CPU */ -#define DATA_ENTRY_STATUS_ACTIVE 0x01 /* Open for r/w by the radio CPU */ -#define DATA_ENTRY_STATUS_BUSY 0x02 /* Ongoing r/w */ -#define DATA_ENTRY_STATUS_FINISHED 0x03 /* Free to use and to free */ -#define DATA_ENTRY_STATUS_UNFINISHED 0x04 /* Partial RX entry */ -/*---------------------------------------------------------------------------*/ -/* Data whitener. 1: Whitener, 0: No whitener */ -#ifdef PROP_MODE_CONF_DW -#define PROP_MODE_DW PROP_MODE_CONF_DW -#else -#define PROP_MODE_DW 0 -#endif - -#ifdef PROP_MODE_CONF_USE_CRC16 -#define PROP_MODE_USE_CRC16 PROP_MODE_CONF_USE_CRC16 -#else -#define PROP_MODE_USE_CRC16 0 -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the current status of a running Radio Op command - * \param a A pointer with the buffer used to initiate the command - * \return The value of the Radio Op buffer's status field - * - * This macro can be used to e.g. return the status of a previously - * initiated background operation, or of an immediate command - */ -#define RF_RADIO_OP_GET_STATUS(a) GET_FIELD_V(a, radioOp, status) -/*---------------------------------------------------------------------------*/ -#ifdef PROP_MODE_CONF_RSSI_THRESHOLD -#define PROP_MODE_RSSI_THRESHOLD PROP_MODE_CONF_RSSI_THRESHOLD -#else -#define PROP_MODE_RSSI_THRESHOLD 0xA6 -#endif - -static int8_t rssi_threshold = PROP_MODE_RSSI_THRESHOLD; -/*---------------------------------------------------------------------------*/ -static volatile uint8_t is_receiving_packet; -/*---------------------------------------------------------------------------*/ -static int on(void); -static int off(void); - -static rfc_propRxOutput_t rx_stats; -/*---------------------------------------------------------------------------*/ -/* Defines and variables related to the .15.4g PHY HDR */ -#define DOT_4G_MAX_FRAME_LEN 2047 -#define DOT_4G_PHR_LEN 2 - -/* PHY HDR bits */ -#define DOT_4G_PHR_CRC16 0x10 -#define DOT_4G_PHR_DW 0x08 - -#if PROP_MODE_USE_CRC16 -/* CRC16 */ -#define DOT_4G_PHR_CRC_BIT DOT_4G_PHR_CRC16 -#define CRC_LEN 2 -#else -/* CRC32 */ -#define DOT_4G_PHR_CRC_BIT 0 -#define CRC_LEN 4 -#endif - -#if PROP_MODE_DW -#define DOT_4G_PHR_DW_BIT DOT_4G_PHR_DW -#else -#define DOT_4G_PHR_DW_BIT 0 -#endif -/*---------------------------------------------------------------------------*/ -/* TX power table for the 431-527MHz band */ -#ifdef PROP_MODE_CONF_TX_POWER_431_527 -#define PROP_MODE_TX_POWER_431_527 PROP_MODE_CONF_TX_POWER_431_527 -#else -#define PROP_MODE_TX_POWER_431_527 prop_mode_tx_power_431_527 -#endif -/*---------------------------------------------------------------------------*/ -/* TX power table for the 779-930MHz band */ -#ifdef PROP_MODE_CONF_TX_POWER_779_930 -#define PROP_MODE_TX_POWER_779_930 PROP_MODE_CONF_TX_POWER_779_930 -#else -#define PROP_MODE_TX_POWER_779_930 prop_mode_tx_power_779_930 -#endif -/*---------------------------------------------------------------------------*/ -/* Select power table based on the frequency band */ -#if DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_470 -#define TX_POWER_DRIVER PROP_MODE_TX_POWER_431_527 -#else -#define TX_POWER_DRIVER PROP_MODE_TX_POWER_779_930 -#endif -/*---------------------------------------------------------------------------*/ -extern const prop_mode_tx_power_config_t TX_POWER_DRIVER[]; - -/* Max and Min Output Power in dBm */ -#define OUTPUT_POWER_MAX (TX_POWER_DRIVER[0].dbm) -#define OUTPUT_POWER_UNKNOWN 0xFFFF - -/* Default TX Power - position in output_power[] */ -static const prop_mode_tx_power_config_t *tx_power_current = &TX_POWER_DRIVER[1]; -/*---------------------------------------------------------------------------*/ -#ifdef PROP_MODE_CONF_LO_DIVIDER -#define PROP_MODE_LO_DIVIDER PROP_MODE_CONF_LO_DIVIDER -#else -#define PROP_MODE_LO_DIVIDER 0x05 -#endif -/*---------------------------------------------------------------------------*/ -#ifdef PROP_MODE_CONF_RX_BUF_CNT -#define PROP_MODE_RX_BUF_CNT PROP_MODE_CONF_RX_BUF_CNT -#else -#define PROP_MODE_RX_BUF_CNT 4 -#endif -/*---------------------------------------------------------------------------*/ -#define DATA_ENTRY_LENSZ_NONE 0 -#define DATA_ENTRY_LENSZ_BYTE 1 -#define DATA_ENTRY_LENSZ_WORD 2 /* 2 bytes */ - -/* The size of the metadata (excluding the packet length field) */ -#define RX_BUF_METADATA_SIZE \ - (CRC_LEN * RF_CORE_RX_BUF_INCLUDE_CRC \ - + RF_CORE_RX_BUF_INCLUDE_RSSI \ - + RF_CORE_RX_BUF_INCLUDE_CORR \ - + 4 * RF_CORE_RX_BUF_INCLUDE_TIMESTAMP) - -/* The offset of the packet length in a rx buffer */ -#define RX_BUF_LENGTH_OFFSET sizeof(rfc_dataEntry_t) -/* The offset of the packet data in a rx buffer */ -#define RX_BUF_DATA_OFFSET (RX_BUF_LENGTH_OFFSET + DOT_4G_PHR_LEN) - -#define ALIGN_TO_4(size) (((size) + 3) & ~3) - -#define RX_BUF_SIZE ALIGN_TO_4(RX_BUF_DATA_OFFSET \ - + NETSTACK_RADIO_MAX_PAYLOAD_LEN \ - + RX_BUF_METADATA_SIZE) - -/* - * RX buffers. - * PROP_MODE_RX_BUF_CNT buffers of RX_BUF_SIZE bytes each. The start of each - * buffer must be 4-byte aligned, therefore RX_BUF_SIZE must divide by 4 - */ -static uint8_t rx_buf[PROP_MODE_RX_BUF_CNT][RX_BUF_SIZE] CC_ALIGN(4); - -/* The RX Data Queue */ -static dataQueue_t rx_data_queue = { 0 }; - -/* Receive entry pointer to keep track of read items */ -volatile static uint8_t *rx_read_entry; -/*---------------------------------------------------------------------------*/ -/* - * Increasing this number causes unicast Tx immediately after broadcast Rx to have - * negative synchronization errors ("dr" in TSCH logs); decreasing it: the opposite. - */ -#define RAT_TIMESTAMP_OFFSET_SUB_GHZ USEC_TO_RADIO(160 * 6 - 240) -/*---------------------------------------------------------------------------*/ -/* The outgoing frame buffer */ -#define TX_BUF_PAYLOAD_LEN 180 -#define TX_BUF_HDR_LEN 2 - -static uint8_t tx_buf[TX_BUF_HDR_LEN + TX_BUF_PAYLOAD_LEN] CC_ALIGN(4); -/*---------------------------------------------------------------------------*/ -static uint8_t -rf_is_on(void) -{ - if(!rf_core_is_accessible()) { - return 0; - } - - return smartrf_settings_cmd_prop_rx_adv.status == RF_CORE_RADIO_OP_STATUS_ACTIVE; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -transmitting(void) -{ - return smartrf_settings_cmd_prop_tx_adv.status == RF_CORE_RADIO_OP_STATUS_ACTIVE; -} -/*---------------------------------------------------------------------------*/ -static radio_value_t -get_rssi(void) -{ - uint32_t cmd_status; - int8_t rssi; - uint8_t attempts = 0; - uint8_t was_off = 0; - rfc_CMD_GET_RSSI_t cmd; - - /* If we are off, turn on first */ - if(!rf_is_on()) { - was_off = 1; - if(on() != RF_CORE_CMD_OK) { - PRINTF("get_rssi: on() failed\n"); - return RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN; - } - } - - rssi = RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN; - - while((rssi == RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN || rssi == 0) && ++attempts < 10) { - memset(&cmd, 0x00, sizeof(cmd)); - cmd.commandNo = CMD_GET_RSSI; - - if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) == RF_CORE_CMD_ERROR) { - PRINTF("get_rssi: CMDSTA=0x%08lx\n", cmd_status); - break; - } else { - /* Current RSSI in bits 23:16 of cmd_status */ - rssi = (cmd_status >> 16) & 0xFF; - } - } - - /* If we were off, turn back off */ - if(was_off) { - off(); - } - - return rssi; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -get_channel(void) -{ - uint32_t freq_khz; - - freq_khz = smartrf_settings_cmd_fs.frequency * 1000; - - /* - * For some channels, fractFreq * 1000 / 65536 will return 324.99xx. - * Casting the result to uint32_t will truncate decimals resulting in the - * function returning channel - 1 instead of channel. Thus, we do a quick - * positive integer round up. - */ - freq_khz += (((smartrf_settings_cmd_fs.fractFreq * 1000) + 65535) / 65536); - - return (freq_khz - DOT_15_4G_CHAN0_FREQUENCY) / DOT_15_4G_CHANNEL_SPACING; -} -/*---------------------------------------------------------------------------*/ -static void -set_channel(uint8_t channel) -{ - uint32_t new_freq; - uint16_t freq, frac; - - new_freq = DOT_15_4G_CHAN0_FREQUENCY + (channel * DOT_15_4G_CHANNEL_SPACING); - - freq = (uint16_t)(new_freq / 1000); - frac = (new_freq - (freq * 1000)) * 65536 / 1000; - - PRINTF("set_channel: %u = 0x%04x.0x%04x (%lu)\n", channel, freq, frac, - new_freq); - - smartrf_settings_cmd_prop_radio_div_setup.centerFreq = freq; - smartrf_settings_cmd_fs.frequency = freq; - smartrf_settings_cmd_fs.fractFreq = frac; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -get_tx_power_array_last_element(void) -{ - const prop_mode_tx_power_config_t *array = TX_POWER_DRIVER; - uint8_t count = 0; - - while(array->tx_power != OUTPUT_POWER_UNKNOWN) { - count++; - array++; - } - return count - 1; -} -/*---------------------------------------------------------------------------*/ -/* Returns the current TX power in dBm */ -static radio_value_t -get_tx_power(void) -{ - return tx_power_current->dbm; -} -/*---------------------------------------------------------------------------*/ -/* - * The caller must make sure to send a new CMD_PROP_RADIO_DIV_SETUP to the - * radio after calling this function. - */ -static void -set_tx_power(radio_value_t power) -{ - int i; - - for(i = get_tx_power_array_last_element(); i >= 0; --i) { - if(power <= TX_POWER_DRIVER[i].dbm) { - /* - * Merely save the value. It will be used in all subsequent usages of - * CMD_PROP_RADIO_DIV_SETP, including one immediately after this function - * has returned - */ - tx_power_current = &TX_POWER_DRIVER[i]; - - return; - } - } -} -/*---------------------------------------------------------------------------*/ -static int -prop_div_radio_setup(void) -{ - uint32_t cmd_status; - rfc_radioOp_t *cmd = (rfc_radioOp_t *)&smartrf_settings_cmd_prop_radio_div_setup; - - rf_switch_select_path(RF_SWITCH_PATH_SUBGHZ); - - /* Adjust loDivider depending on the selected band */ - smartrf_settings_cmd_prop_radio_div_setup.loDivider = PROP_MODE_LO_DIVIDER; - - /* Update to the correct TX power setting */ - smartrf_settings_cmd_prop_radio_div_setup.txPower = tx_power_current->tx_power; - - /* Adjust RF Front End and Bias based on the board */ - smartrf_settings_cmd_prop_radio_div_setup.config.frontEndMode = - RF_CORE_PROP_FRONT_END_MODE; - smartrf_settings_cmd_prop_radio_div_setup.config.biasMode = - RF_CORE_PROP_BIAS_MODE; - - /* Send Radio setup to RF Core */ - if(rf_core_send_cmd((uint32_t)cmd, &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("prop_div_radio_setup: DIV_SETUP, CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd->status); - return RF_CORE_CMD_ERROR; - } - - /* Wait until radio setup is done */ - if(rf_core_wait_cmd_done(cmd) != RF_CORE_CMD_OK) { - PRINTF("prop_div_radio_setup: DIV_SETUP wait, CMDSTA=0x%08lx," - "status=0x%04x\n", cmd_status, cmd->status); - return RF_CORE_CMD_ERROR; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -rf_cmd_prop_rx() -{ - uint32_t cmd_status; - volatile rfc_CMD_PROP_RX_ADV_t *cmd_rx_adv; - int ret; - - cmd_rx_adv = (rfc_CMD_PROP_RX_ADV_t *)&smartrf_settings_cmd_prop_rx_adv; - cmd_rx_adv->status = RF_CORE_RADIO_OP_STATUS_IDLE; - - cmd_rx_adv->rxConf.bIncludeCrc = RF_CORE_RX_BUF_INCLUDE_CRC; - cmd_rx_adv->rxConf.bAppendRssi = RF_CORE_RX_BUF_INCLUDE_RSSI; - cmd_rx_adv->rxConf.bAppendTimestamp = RF_CORE_RX_BUF_INCLUDE_TIMESTAMP; - cmd_rx_adv->rxConf.bAppendStatus = RF_CORE_RX_BUF_INCLUDE_CORR; - - /* - * Set the max Packet length. This is for the payload only, therefore - * 2047 - length offset - */ - cmd_rx_adv->maxPktLen = DOT_4G_MAX_FRAME_LEN - cmd_rx_adv->lenOffset; - - ret = rf_core_send_cmd((uint32_t)cmd_rx_adv, &cmd_status); - - if(ret != RF_CORE_CMD_OK) { - PRINTF("rf_cmd_prop_rx: send_cmd ret=%d, CMDSTA=0x%08lx, status=0x%04x\n", - ret, cmd_status, cmd_rx_adv->status); - return RF_CORE_CMD_ERROR; - } - - RTIMER_BUSYWAIT_UNTIL(cmd_rx_adv->status == RF_CORE_RADIO_OP_STATUS_ACTIVE, - RF_CORE_ENTER_RX_TIMEOUT); - - /* Wait to enter RX */ - if(cmd_rx_adv->status != RF_CORE_RADIO_OP_STATUS_ACTIVE) { - PRINTF("rf_cmd_prop_rx: CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd_rx_adv->status); - return RF_CORE_CMD_ERROR; - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static void -init_rx_buffers(void) -{ - rfc_dataEntry_t *entry; - int i; - - for(i = 0; i < PROP_MODE_RX_BUF_CNT; i++) { - entry = (rfc_dataEntry_t *)rx_buf[i]; - entry->status = DATA_ENTRY_STATUS_PENDING; - entry->config.type = DATA_ENTRY_TYPE_GEN; - entry->config.lenSz = DATA_ENTRY_LENSZ_WORD; - entry->length = RX_BUF_SIZE - 8; - entry->pNextEntry = rx_buf[i + 1]; - } - - ((rfc_dataEntry_t *)rx_buf[PROP_MODE_RX_BUF_CNT - 1])->pNextEntry = rx_buf[0]; -} -/*---------------------------------------------------------------------------*/ -static int -rx_on_prop(void) -{ - int ret; - - if(rf_is_on()) { - PRINTF("rx_on_prop: We were on. PD=%u, RX=0x%04x\n", - rf_core_is_accessible(), smartrf_settings_cmd_prop_rx_adv.status); - return RF_CORE_CMD_OK; - } - - /* Put CPE in RX using the currently configured parameters */ - ret = rf_cmd_prop_rx(); - - if(ret) { - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -rx_off_prop(void) -{ - uint32_t cmd_status; - int ret; - - /* If we are off, do nothing */ - if(!rf_is_on()) { - return RF_CORE_CMD_OK; - } - - /* Wait for ongoing ACK TX to finish */ - RTIMER_BUSYWAIT_UNTIL(!transmitting(), RF_CORE_TX_FINISH_TIMEOUT); - - /* Send a CMD_ABORT command to RF Core */ - if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_ABORT), &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("rx_off_prop: CMD_ABORT status=0x%08lx\n", cmd_status); - /* Continue nonetheless */ - } - - RTIMER_BUSYWAIT_UNTIL(!rf_is_on(), RF_CORE_TURN_OFF_TIMEOUT); - - if(smartrf_settings_cmd_prop_rx_adv.status == PROP_DONE_STOPPED || - smartrf_settings_cmd_prop_rx_adv.status == PROP_DONE_ABORT) { - /* Stopped gracefully */ - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - ret = RF_CORE_CMD_OK; - } else { - PRINTF("rx_off_prop: status=0x%04x\n", - smartrf_settings_cmd_prop_rx_adv.status); - ret = RF_CORE_CMD_ERROR; - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -request(void) -{ - /* - * We rely on the RDC layer to turn us on and off. Thus, if we are on we - * will only allow sleep, standby otherwise - */ - if(rf_is_on()) { - return LPM_MODE_SLEEP; - } - - return LPM_MODE_MAX_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -LPM_MODULE(prop_lpm_module, request, NULL, NULL, LPM_DOMAIN_NONE); -/*---------------------------------------------------------------------------*/ -static int -prop_fs(void) -{ - uint32_t cmd_status; - rfc_radioOp_t *cmd = (rfc_radioOp_t *)&smartrf_settings_cmd_fs; - - /* Send the command to the RF Core */ - if(rf_core_send_cmd((uint32_t)cmd, &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("prop_fs: CMD_FS, CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd->status); - return RF_CORE_CMD_ERROR; - } - - /* Wait until the command is done */ - if(rf_core_wait_cmd_done(cmd) != RF_CORE_CMD_OK) { - PRINTF("prop_fs: CMD_FS wait, CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd->status); - return RF_CORE_CMD_ERROR; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -static void -soft_off_prop(void) -{ - uint32_t cmd_status; - volatile rfc_radioOp_t *cmd = rf_core_get_last_radio_op(); - - if(!rf_core_is_accessible()) { - return; - } - - /* Send a CMD_ABORT command to RF Core */ - if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_ABORT), &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("soft_off_prop: CMD_ABORT status=0x%08lx\n", cmd_status); - return; - } - - RTIMER_BUSYWAIT_UNTIL((cmd->status & RF_CORE_RADIO_OP_MASKED_STATUS) != - RF_CORE_RADIO_OP_MASKED_STATUS_RUNNING, RF_CORE_TURN_OFF_TIMEOUT); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -soft_on_prop(void) -{ - if(prop_div_radio_setup() != RF_CORE_CMD_OK) { - PRINTF("soft_on_prop: prop_div_radio_setup() failed\n"); - return RF_CORE_CMD_ERROR; - } - - if(prop_fs() != RF_CORE_CMD_OK) { - PRINTF("soft_on_prop: prop_fs() failed\n"); - return RF_CORE_CMD_ERROR; - } - - return rx_on_prop(); -} -/*---------------------------------------------------------------------------*/ -static const rf_core_primary_mode_t mode_prop = { - soft_off_prop, - soft_on_prop, - rf_is_on, - RAT_TIMESTAMP_OFFSET_SUB_GHZ -}; -/*---------------------------------------------------------------------------*/ -static int -init(void) -{ - lpm_register_module(&prop_lpm_module); - - if(ti_lib_chipinfo_chip_family_is_cc13xx() == false) { - return RF_CORE_CMD_ERROR; - } - - /* Initialise RX buffers */ - memset(rx_buf, 0, sizeof(rx_buf)); - - /* Set of RF Core data queue. Circular buffer, no last entry */ - rx_data_queue.pCurrEntry = rx_buf[0]; - rx_data_queue.pLastEntry = NULL; - - /* Initialize current read pointer to first element (used in ISR) */ - rx_read_entry = rx_buf[0]; - - smartrf_settings_cmd_prop_rx_adv.pQueue = &rx_data_queue; - smartrf_settings_cmd_prop_rx_adv.pOutput = (uint8_t *)&rx_stats; - - set_channel(IEEE802154_DEFAULT_CHANNEL); - - if(on() != RF_CORE_CMD_OK) { - PRINTF("init: on() failed\n"); - return RF_CORE_CMD_ERROR; - } - - /* Enable the "sync word seen" interrupt */ - ti_lib_rfc_hw_int_enable(RFC_DBELL_RFHWIEN_MDMSOFT); - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - - rf_core_primary_mode_register(&mode_prop); - - rf_core_rat_init(); - - process_start(&rf_core_process, NULL); - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -prepare(const void *payload, unsigned short payload_len) -{ - int len = MIN(payload_len, TX_BUF_PAYLOAD_LEN); - - memcpy(&tx_buf[TX_BUF_HDR_LEN], payload, len); - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -transmit(unsigned short transmit_len) -{ - int ret; - uint8_t was_off = 0; - uint32_t cmd_status; - volatile rfc_CMD_PROP_TX_ADV_t *cmd_tx_adv; - - /* Length in .15.4g PHY HDR. Includes the CRC but not the HDR itself */ - uint16_t total_length; - - if(!rf_is_on()) { - was_off = 1; - if(on() != RF_CORE_CMD_OK) { - PRINTF("transmit: on() failed\n"); - return RADIO_TX_ERR; - } - } - - /* - * Prepare the .15.4g PHY header - * MS=0, Length MSBits=0, DW and CRC configurable - * Total length = transmit_len (payload) + CRC length - * - * The Radio will flip the bits around, so tx_buf[0] must have the length - * LSBs (PHR[15:8] and tx_buf[1] will have PHR[7:0] - */ - total_length = transmit_len + CRC_LEN; - - tx_buf[0] = total_length & 0xFF; - tx_buf[1] = (total_length >> 8) + DOT_4G_PHR_DW_BIT + DOT_4G_PHR_CRC_BIT; - - /* Prepare the CMD_PROP_TX_ADV command */ - cmd_tx_adv = (rfc_CMD_PROP_TX_ADV_t *)&smartrf_settings_cmd_prop_tx_adv; - - /* - * pktLen: Total number of bytes in the TX buffer, including the header if - * one exists, but not including the CRC (which is not present in the buffer) - */ - cmd_tx_adv->pktLen = transmit_len + DOT_4G_PHR_LEN; - cmd_tx_adv->pPkt = tx_buf; - - /* Abort RX */ - rx_off_prop(); - - /* Enable the LAST_COMMAND_DONE interrupt to wake us up */ - rf_core_cmd_done_en(false); - - ret = rf_core_send_cmd((uint32_t)cmd_tx_adv, &cmd_status); - - if(ret) { - /* If we enter here, TX actually started */ - ENERGEST_SWITCH(ENERGEST_TYPE_LISTEN, ENERGEST_TYPE_TRANSMIT); - - watchdog_periodic(); - - /* Idle away while the command is running */ - while((cmd_tx_adv->status & RF_CORE_RADIO_OP_MASKED_STATUS) - == RF_CORE_RADIO_OP_MASKED_STATUS_RUNNING) { - /* Note: for now sleeping while Tx'ing in polling mode is disabled. - * To enable it: - * 1) make the `lpm_sleep()` call here unconditional; - * 2) change the radio ISR priority to allow radio ISR to interrupt rtimer ISR. - */ - if(!rf_core_poll_mode) { - lpm_sleep(); - } - } - - if(cmd_tx_adv->status == RF_CORE_RADIO_OP_STATUS_PROP_DONE_OK) { - /* Sent OK */ - ret = RADIO_TX_OK; - } else { - /* Operation completed, but frame was not sent */ - PRINTF("transmit: Not Sent OK status=0x%04x\n", - cmd_tx_adv->status); - ret = RADIO_TX_ERR; - } - } else { - /* Failure sending the CMD_PROP_TX command */ - PRINTF("transmit: PROP_TX_ERR ret=%d, CMDSTA=0x%08lx, status=0x%04x\n", - ret, cmd_status, cmd_tx_adv->status); - ret = RADIO_TX_ERR; - } - - /* - * Update ENERGEST state here, before a potential call to off(), which - * will correctly update it if required. - */ - ENERGEST_SWITCH(ENERGEST_TYPE_TRANSMIT, ENERGEST_TYPE_LISTEN); - - /* - * Disable LAST_FG_COMMAND_DONE interrupt. We don't really care about it - * except when we are transmitting - */ - rf_core_cmd_done_dis(); - - /* Workaround. Set status to IDLE */ - cmd_tx_adv->status = RF_CORE_RADIO_OP_STATUS_IDLE; - - rx_on_prop(); - - if(was_off) { - off(); - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -send(const void *payload, unsigned short payload_len) -{ - prepare(payload, payload_len); - return transmit(payload_len); -} -/*---------------------------------------------------------------------------*/ -static void -release_data_entry(void) -{ - rfc_dataEntryGeneral_t *entry = (rfc_dataEntryGeneral_t *)rx_read_entry; - uint8_t *data_ptr = &entry->data; - int_master_status_t interrupt_status; - - /* Clear the length field (2 bytes) */ - data_ptr[0] = 0; - data_ptr[1] = 0; - - /* Set status to 0 "Pending" in element */ - entry->status = DATA_ENTRY_STATUS_PENDING; - rx_read_entry = entry->pNextEntry; - - interrupt_status = critical_enter(); - if(rf_core_rx_is_full) { - rf_core_rx_is_full = false; - PRINTF("RXQ was full, re-enabling radio!\n"); - rx_on_prop(); - } - critical_exit(interrupt_status); - -} -/*---------------------------------------------------------------------------*/ -static int -read_frame(void *buf, unsigned short buf_len) -{ - rfc_dataEntryGeneral_t *entry = (rfc_dataEntryGeneral_t *)rx_read_entry; - uint8_t *data_ptr = &entry->data; - int len = 0; - uint32_t rat_timestamp; - - /* wait for entry to become finished */ - rtimer_clock_t t0 = RTIMER_NOW(); - while(entry->status == DATA_ENTRY_STATUS_BUSY - && RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (RTIMER_SECOND / 50))); - - /* Make sure the flag is reset */ - is_receiving_packet = 0; - - if(entry->status != DATA_ENTRY_STATUS_FINISHED) { - /* No available data */ - return 0; - } - - /* - * First 2 bytes in the data entry are the length. - * Our data entry consists of: - * Payload + RSSI (1 byte) + Timestamp (4 bytes) + Status (1 byte) - * This length includes all of those. - */ - len = (*(uint16_t *)data_ptr); - - if(len <= RX_BUF_METADATA_SIZE) { - PRINTF("RF: too short!"); - - release_data_entry(); - return 0; - } - - data_ptr += 2; - len -= RX_BUF_METADATA_SIZE; - - if(len > buf_len) { - PRINTF("RF: too long\n"); - - release_data_entry(); - return 0; - } - - memcpy(buf, data_ptr, len); - - /* get the RSSI and status */ - rf_core_last_rssi = (int8_t)data_ptr[len]; - rf_core_last_corr_lqi = data_ptr[len + 5]; - - /* get the timestamp */ - memcpy(&rat_timestamp, data_ptr + len + 1, 4); - - rf_core_last_packet_timestamp = rf_core_convert_rat_to_rtimer(rat_timestamp); - - if(!rf_core_poll_mode) { - /* Not in poll mode: packetbuf should not be accessed in interrupt context. - * In poll mode, the last packet RSSI and link quality can be obtained through - * RADIO_PARAM_LAST_RSSI and RADIO_PARAM_LAST_LINK_QUALITY */ - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, rf_core_last_rssi); - packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, rf_core_last_corr_lqi); - } - - release_data_entry(); - - return len; -} -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - uint8_t was_off = 0; - uint32_t cmd_status; - int8_t rssi = RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN; - - /* - * If we are in the middle of a BLE operation, we got called by ContikiMAC - * from within an interrupt context. Indicate a clear channel - */ - if(rf_ble_is_active() == RF_BLE_ACTIVE) { - return RF_CORE_CCA_CLEAR; - } - - if(!rf_core_is_accessible()) { - was_off = 1; - if(on() != RF_CORE_CMD_OK) { - PRINTF("channel_clear: on() failed\n"); - if(was_off) { - off(); - } - return RF_CORE_CCA_CLEAR; - } - } else { - if(transmitting()) { - PRINTF("channel_clear: called while in TX\n"); - return RF_CORE_CCA_CLEAR; - } - } - - while(rssi == RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN || rssi == 0) { - if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_GET_RSSI), &cmd_status) - != RF_CORE_CMD_OK) { - break; - } - /* Current RSSI in bits 23:16 of cmd_status */ - rssi = (cmd_status >> 16) & 0xFF; - } - - if(was_off) { - off(); - } - - if(rssi >= rssi_threshold) { - return RF_CORE_CCA_BUSY; - } - - return RF_CORE_CCA_CLEAR; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - if(!rf_is_on()) { - return 0; - } - - if(!is_receiving_packet) { - /* Look for the modem synchronization word detection interrupt flag. - * This flag is raised when the synchronization word is received. - */ - if(HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIFG) & RFC_DBELL_RFHWIFG_MDMSOFT) { - is_receiving_packet = 1; - } - } else { - /* After the start of the packet: reset the Rx flag once the channel gets clear */ - is_receiving_packet = (channel_clear() == RF_CORE_CCA_BUSY); - if(!is_receiving_packet) { - /* Clear the modem sync flag */ - ti_lib_rfc_hw_int_clear(RFC_DBELL_RFHWIFG_MDMSOFT); - } - } - - return is_receiving_packet; -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - int rv = 0; - volatile rfc_dataEntry_t *entry = (rfc_dataEntry_t *)rx_data_queue.pCurrEntry; - - /* Go through all RX buffers and check their status */ - do { - if(entry->status == DATA_ENTRY_STATUS_FINISHED - || entry->status == DATA_ENTRY_STATUS_BUSY) { - rv = 1; - if(!rf_core_poll_mode) { - process_poll(&rf_core_process); - } - } - - entry = (rfc_dataEntry_t *)entry->pNextEntry; - } while(entry != (rfc_dataEntry_t *)rx_data_queue.pCurrEntry); - - /* If we didn't find an entry at status finished, no frames are pending */ - return rv; -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - /* - * If we are in the middle of a BLE operation, we got called by ContikiMAC - * from within an interrupt context. Abort, but pretend everything is OK. - */ - if(rf_ble_is_active() == RF_BLE_ACTIVE) { - return RF_CORE_CMD_OK; - } - - if(rf_is_on()) { - PRINTF("on: We were on. PD=%u, RX=0x%04x \n", rf_core_is_accessible(), - smartrf_settings_cmd_prop_rx_adv.status); - return RF_CORE_CMD_OK; - } - - /* - * Request the HF XOSC as the source for the HF clock. Needed before we can - * use the FS. This will only request, it will _not_ perform the switch. - */ - oscillators_request_hf_xosc(); - - if(!rf_core_is_accessible()) { - if(rf_core_power_up() != RF_CORE_CMD_OK) { - PRINTF("on: rf_core_power_up() failed\n"); - - rf_core_power_down(); - - return RF_CORE_CMD_ERROR; - } - - /* Keep track of RF Core mode */ - rf_core_set_modesel(); - - /* Apply patches to radio core */ - rf_patch_cpe_genfsk(); - while(!HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG)); - HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0; - rf_patch_rfe_genfsk(); - - /* Initialize bus request */ - HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0; - HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = - CMDR_DIR_CMD_1BYTE(CMD_BUS_REQUEST, 1); - - /* set VCOLDO reference */ - ti_lib_rfc_adi3vco_ldo_voltage_mode(true); - - /* Let CC13xxware automatically set a correct value for RTRIM for us */ - ti_lib_rfc_rtrim((rfc_radioOp_t *)&smartrf_settings_cmd_prop_radio_div_setup); - - /* Make sure BUS_REQUEST is done */ - while(!HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG)); - HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0; - - if(rf_core_start_rat() != RF_CORE_CMD_OK) { - PRINTF("on: rf_core_start_rat() failed\n"); - - rf_core_power_down(); - - return RF_CORE_CMD_ERROR; - } - } - - rf_core_setup_interrupts(); - - init_rx_buffers(); - - /* - * Trigger a switch to the XOSC, so that we can subsequently use the RF FS - * This will block until the XOSC is actually ready, but give how we - * requested it early on, this won't be too long a wait/ - */ - oscillators_switch_to_hf_xosc(); - - if(prop_div_radio_setup() != RF_CORE_CMD_OK) { - PRINTF("on: prop_div_radio_setup() failed\n"); - return RF_CORE_CMD_ERROR; - } - - if(prop_fs() != RF_CORE_CMD_OK) { - PRINTF("on: prop_fs() failed\n"); - return RF_CORE_CMD_ERROR; - } - - return rx_on_prop(); -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - int i; - rfc_dataEntry_t *entry; - - /* - * If we are in the middle of a BLE operation, we got called by ContikiMAC - * from within an interrupt context. Abort, but pretend everything is OK. - */ - if(rf_ble_is_active() == RF_BLE_ACTIVE) { - return RF_CORE_CMD_OK; - } - - rx_off_prop(); - rf_core_power_down(); - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - -#if !CC2650_FAST_RADIO_STARTUP - /* Switch HF clock source to the RCOSC to preserve power */ - oscillators_switch_to_hf_rc(); -#endif - - /* We pulled the plug, so we need to restore the status manually */ - smartrf_settings_cmd_prop_rx_adv.status = RF_CORE_RADIO_OP_STATUS_IDLE; - - /* - * Just in case there was an ongoing RX (which started after we begun the - * shutdown sequence), we don't want to leave the buffer in state == ongoing - */ - for(i = 0; i < PROP_MODE_RX_BUF_CNT; i++) { - entry = (rfc_dataEntry_t *)rx_buf[i]; - if(entry->status == DATA_ENTRY_STATUS_BUSY) { - entry->status = DATA_ENTRY_STATUS_PENDING; - } - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -/* Enable or disable CCA before sending */ -static radio_result_t -set_send_on_cca(uint8_t enable) -{ - if(enable) { - /* this driver does not have support for CCA on Tx */ - return RADIO_RESULT_NOT_SUPPORTED; - } - return RADIO_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - if(!value) { - return RADIO_RESULT_INVALID_VALUE; - } - - switch(param) { - case RADIO_PARAM_POWER_MODE: - /* On / off */ - *value = rf_is_on() ? RADIO_POWER_MODE_ON : RADIO_POWER_MODE_OFF; - return RADIO_RESULT_OK; - case RADIO_PARAM_CHANNEL: - *value = (radio_value_t)get_channel(); - return RADIO_RESULT_OK; - case RADIO_PARAM_RX_MODE: - *value = 0; - if(rf_core_poll_mode) { - *value |= RADIO_RX_MODE_POLL_MODE; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_TX_MODE: - *value = 0; - return RADIO_RESULT_OK; - case RADIO_PARAM_TXPOWER: - *value = get_tx_power(); - return RADIO_RESULT_OK; - case RADIO_PARAM_CCA_THRESHOLD: - *value = rssi_threshold; - return RADIO_RESULT_OK; - case RADIO_PARAM_RSSI: - *value = get_rssi(); - - if(*value == RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN) { - return RADIO_RESULT_ERROR; - } else { - return RADIO_RESULT_OK; - } - case RADIO_CONST_CHANNEL_MIN: - *value = 0; - return RADIO_RESULT_OK; - case RADIO_CONST_CHANNEL_MAX: - *value = DOT_15_4G_CHANNEL_MAX; - return RADIO_RESULT_OK; - case RADIO_CONST_TXPOWER_MIN: - *value = TX_POWER_DRIVER[get_tx_power_array_last_element()].dbm; - return RADIO_RESULT_OK; - case RADIO_CONST_TXPOWER_MAX: - *value = OUTPUT_POWER_MAX; - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_RSSI: - *value = rf_core_last_rssi; - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_LINK_QUALITY: - *value = rf_core_last_corr_lqi; - return RADIO_RESULT_OK; - case RADIO_CONST_PHY_OVERHEAD: - /* 2 header bytes, 2 or 4 bytes CRC */ - *value = (radio_value_t)(DOT_4G_PHR_LEN + CRC_LEN); - return RADIO_RESULT_OK; - case RADIO_CONST_BYTE_AIR_TIME: - *value = (radio_value_t)RADIO_BYTE_AIR_TIME; - return RADIO_RESULT_OK; - case RADIO_CONST_DELAY_BEFORE_TX: - *value = (radio_value_t)RADIO_DELAY_BEFORE_TX; - return RADIO_RESULT_OK; - case RADIO_CONST_DELAY_BEFORE_RX: - *value = (radio_value_t)RADIO_DELAY_BEFORE_RX; - return RADIO_RESULT_OK; - case RADIO_CONST_DELAY_BEFORE_DETECT: - *value = (radio_value_t)RADIO_DELAY_BEFORE_DETECT; - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - radio_result_t rv = RADIO_RESULT_OK; - uint8_t old_poll_mode; - - switch(param) { - case RADIO_PARAM_POWER_MODE: - if(value == RADIO_POWER_MODE_ON) { - if(on() != RF_CORE_CMD_OK) { - PRINTF("set_value: on() failed (1)\n"); - return RADIO_RESULT_ERROR; - } - return RADIO_RESULT_OK; - } - if(value == RADIO_POWER_MODE_OFF) { - off(); - return RADIO_RESULT_OK; - } - return RADIO_RESULT_INVALID_VALUE; - case RADIO_PARAM_CHANNEL: - if(value < 0 || - value > DOT_15_4G_CHANNEL_MAX) { - return RADIO_RESULT_INVALID_VALUE; - } - - if(get_channel() == (uint8_t)value) { - /* We already have that very same channel configured. - * Nothing to do here. */ - return RADIO_RESULT_OK; - } - - set_channel((uint8_t)value); - break; - - case RADIO_PARAM_RX_MODE: - if(value & ~(RADIO_RX_MODE_POLL_MODE)) { - return RADIO_RESULT_INVALID_VALUE; - } - - old_poll_mode = rf_core_poll_mode; - rf_core_poll_mode = (value & RADIO_RX_MODE_POLL_MODE) != 0; - if(rf_core_poll_mode == old_poll_mode) { - return RADIO_RESULT_OK; - } - break; - - case RADIO_PARAM_TX_MODE: - if(value & ~(RADIO_TX_MODE_SEND_ON_CCA)) { - return RADIO_RESULT_INVALID_VALUE; - } - return set_send_on_cca((value & RADIO_TX_MODE_SEND_ON_CCA) != 0); - - case RADIO_PARAM_TXPOWER: - if(value < TX_POWER_DRIVER[get_tx_power_array_last_element()].dbm || - value > OUTPUT_POWER_MAX) { - return RADIO_RESULT_INVALID_VALUE; - } - - soft_off_prop(); - - set_tx_power(value); - - if(soft_on_prop() != RF_CORE_CMD_OK) { - PRINTF("set_value: soft_on_prop() failed\n"); - rv = RADIO_RESULT_ERROR; - } - - return RADIO_RESULT_OK; - - case RADIO_PARAM_CCA_THRESHOLD: - rssi_threshold = (int8_t)value; - break; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } - - /* If off, the new configuration will be applied the next time radio is started */ - if(!rf_is_on()) { - return RADIO_RESULT_OK; - } - - /* If we reach here we had no errors. Apply new settings */ - if(rx_off_prop() != RF_CORE_CMD_OK) { - PRINTF("set_value: rx_off_prop() failed\n"); - rv = RADIO_RESULT_ERROR; - } - - /* Restart the radio timer (RAT). - This causes resynchronization between RAT and RTC: useful for TSCH. */ - if(rf_core_restart_rat() != RF_CORE_CMD_OK) { - PRINTF("set_value: rf_core_restart_rat() failed\n"); - /* do not set the error */ - } else { - rf_core_check_rat_overflow(); - } - - if(soft_on_prop() != RF_CORE_CMD_OK) { - PRINTF("set_value: soft_on_prop() failed\n"); - rv = RADIO_RESULT_ERROR; - } - - return rv; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - if(param == RADIO_PARAM_LAST_PACKET_TIMESTAMP) { - if(size != sizeof(rtimer_clock_t) || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - *(rtimer_clock_t *)dest = rf_core_last_packet_timestamp; - - return RADIO_RESULT_OK; - } - - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -const struct radio_driver prop_mode_driver = { - init, - prepare, - transmit, - send, - read_frame, - channel_clear, - receiving_packet, - pending_packet, - on, - off, - get_value, - set_value, - get_object, - set_object, -}; -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/prop-mode.h b/arch/cpu/cc26x0-cc13x0/rf-core/prop-mode.h deleted file mode 100644 index 5beb7d7c4..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/prop-mode.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rf-core - * @{ - * - * \defgroup rf-core-prop CC13xx Prop mode driver - * - * @{ - * - * \file - * Header file for the CC13xx prop mode NETSTACK_RADIO driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef PROP_MODE_H_ -#define PROP_MODE_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "rf-core/dot-15-4g.h" - -#include -/*---------------------------------------------------------------------------*/ -typedef struct prop_mode_tx_power_config { - radio_value_t dbm; - uint16_t tx_power; /* Value for the PROP_DIV_RADIO_SETUP.txPower field */ -} prop_mode_tx_power_config_t; -/*---------------------------------------------------------------------------*/ -#endif /* PROP_MODE_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/rf-ble.c b/arch/cpu/cc26x0-cc13x0/rf-core/rf-ble.c deleted file mode 100644 index e5a38cac7..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/rf-ble.c +++ /dev/null @@ -1,461 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2017, University of Bristol - http://www.bristol.ac.uk/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rf-core-ble - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx RF BLE driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/process.h" -#include "sys/clock.h" -#include "sys/cc.h" -#include "sys/etimer.h" -#include "net/netstack.h" -#include "net/linkaddr.h" -#include "dev/oscillators.h" -#include "rf-core/rf-core.h" -#include "rf-core/rf-switch.h" -#include "rf-core/rf-ble.h" -#include "driverlib/rf_ble_cmd.h" -#include "driverlib/rf_common_cmd.h" -#include "ti-lib.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* BLE Intervals: Send a burst of advertisements every BLE_ADV_INTERVAL secs */ -#define BLE_ADV_INTERVAL (CLOCK_SECOND * 5) -#define BLE_ADV_DUTY_CYCLE (CLOCK_SECOND / 10) -#define BLE_ADV_MESSAGES 10 - -/* BLE Advertisement-related macros */ -#define BLE_ADV_TYPE_DEVINFO 0x01 -#define BLE_ADV_TYPE_NAME 0x09 -#define BLE_ADV_TYPE_MANUFACTURER 0xFF -#define BLE_ADV_NAME_BUF_LEN BLE_ADV_MAX_SIZE -#define BLE_ADV_PAYLOAD_BUF_LEN 64 -#define BLE_UUID_SIZE 16 -/*---------------------------------------------------------------------------*/ -static unsigned char ble_params_buf[32] CC_ALIGN(4); -static uint8_t ble_mode_on = RF_BLE_IDLE; -static struct etimer ble_adv_et; -static uint8_t payload[BLE_ADV_PAYLOAD_BUF_LEN]; -static int p = 0; -static int i; -/*---------------------------------------------------------------------------*/ -/* BLE beacond config */ -static struct ble_beacond_config { - clock_time_t interval; - char adv_name[BLE_ADV_NAME_BUF_LEN]; -} beacond_config = { .interval = BLE_ADV_INTERVAL }; -/*---------------------------------------------------------------------------*/ -#ifdef RF_BLE_CONF_BOARD_OVERRIDES -#define RF_BLE_BOARD_OVERRIDES RF_BLE_CONF_BOARD_OVERRIDES -#else -#define RF_BLE_BOARD_OVERRIDES -#endif -/*---------------------------------------------------------------------------*/ -/* BLE overrides */ -static uint32_t ble_overrides[] = { - 0x00364038, /* Synth: Set RTRIM (POTAILRESTRIM) to 6 */ - 0x000784A3, /* Synth: Set FREF = 3.43 MHz (24 MHz / 7) */ - 0xA47E0583, /* Synth: Set loop bandwidth after lock to 80 kHz (K2) */ - 0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, LSB) */ - 0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, MSB) */ - 0x00456088, /* Adjust AGC reference level */ - RF_BLE_BOARD_OVERRIDES - 0xFFFFFFFF, /* End of override list */ -}; -/*---------------------------------------------------------------------------*/ -/* TX Power dBm lookup table - values from SmartRF Studio */ -typedef struct output_config { - radio_value_t dbm; - uint16_t tx_power; /* Value for the CMD_RADIO_SETUP.txPower field */ -} output_config_t; - -static const output_config_t output_power[] = { - { 5, 0x9330 }, - { 4, 0x9324 }, - { 3, 0x5a1c }, - { 2, 0x4e18 }, - { 1, 0x4214 }, - { 0, 0x3161 }, - { -3, 0x2558 }, - { -6, 0x1d52 }, - { -9, 0x194e }, - { -12, 0x144b }, - { -15, 0x0ccb }, - { -18, 0x0cc9 }, - { -21, 0x0cc7 }, -}; - -#define OUTPUT_CONFIG_COUNT (sizeof(output_power) / sizeof(output_config_t)) - -/* Max and Min Output Power in dBm */ -#define OUTPUT_POWER_MIN (output_power[OUTPUT_CONFIG_COUNT - 1].dbm) -#define OUTPUT_POWER_MAX (output_power[0].dbm) -#define OUTPUT_POWER_UNKNOWN 0xFFFF - -/* Default TX Power - position in output_power[] */ -static const output_config_t *tx_power_current = &output_power[0]; -/*---------------------------------------------------------------------------*/ -PROCESS(rf_ble_beacon_process, "CC13xx / CC26xx RF BLE Beacon Process"); -/*---------------------------------------------------------------------------*/ -static int -send_ble_adv_nc(int channel, uint8_t *adv_payload, int adv_payload_len) -{ - uint32_t cmd_status; - rfc_CMD_BLE_ADV_NC_t cmd; - rfc_bleAdvPar_t *params; - - params = (rfc_bleAdvPar_t *)ble_params_buf; - - /* Clear both buffers */ - memset(&cmd, 0x00, sizeof(cmd)); - memset(ble_params_buf, 0x00, sizeof(ble_params_buf)); - - /* Adv NC */ - cmd.commandNo = CMD_BLE_ADV_NC; - cmd.condition.rule = COND_NEVER; - cmd.whitening.bOverride = 0; - cmd.whitening.init = 0; - cmd.pParams = params; - cmd.channel = channel; - - /* Set up BLE Advertisement parameters */ - params->pDeviceAddress = (uint16_t *)BLE_ADDRESS_PTR; - params->endTrigger.triggerType = TRIG_NEVER; - params->endTime = TRIG_NEVER; - - /* Set up BLE Advertisement parameters */ - params = (rfc_bleAdvPar_t *)ble_params_buf; - params->advLen = adv_payload_len; - params->pAdvData = adv_payload; - - if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) == RF_CORE_CMD_ERROR) { - PRINTF("send_ble_adv_nc: Chan=%d CMDSTA=0x%08lx, status=0x%04x\n", - channel, cmd_status, cmd.status); - return RF_CORE_CMD_ERROR; - } - - /* Wait until the command is done */ - if(rf_core_wait_cmd_done(&cmd) != RF_CORE_CMD_OK) { - PRINTF("send_ble_adv_nc: Chan=%d CMDSTA=0x%08lx, status=0x%04x\n", - channel, cmd_status, cmd.status); - return RF_CORE_CMD_ERROR; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -/* Returns the current TX power in dBm */ -radio_value_t -rf_ble_get_tx_power(void) -{ - return tx_power_current->dbm; -} -/*---------------------------------------------------------------------------*/ -/* - * Set TX power to 'at least' power dBm - * This works with a lookup table. If the value of 'power' does not exist in - * the lookup table, TXPOWER will be set to the immediately higher available - * value - */ -void -rf_ble_set_tx_power(radio_value_t power) -{ - int i; - - /* First, find the correct setting and save it */ - for(i = OUTPUT_CONFIG_COUNT - 1; i >= 0; --i) { - if(power <= output_power[i].dbm) { - tx_power_current = &output_power[i]; - break; - } - } -} -/*---------------------------------------------------------------------------*/ -void -rf_ble_beacond_config(clock_time_t interval, const char *name) -{ - if(RF_BLE_ENABLED == 0) { - return; - } - - if(name != NULL) { - if(strlen(name) == 0 || strlen(name) >= BLE_ADV_NAME_BUF_LEN) { - return; - } - - memset(beacond_config.adv_name, 0, BLE_ADV_NAME_BUF_LEN); - memcpy(beacond_config.adv_name, name, strlen(name)); - } - - if(interval != 0) { - beacond_config.interval = interval; - } -} -/*---------------------------------------------------------------------------*/ -uint8_t -rf_ble_beacond_start() -{ - if(RF_BLE_ENABLED == 0) { - return RF_CORE_CMD_ERROR; - } - - if(ti_lib_chipinfo_supports_ble() == false) { - return RF_CORE_CMD_ERROR; - } - - if(beacond_config.adv_name[0] == 0) { - return RF_CORE_CMD_ERROR; - } - - ble_mode_on = RF_BLE_IDLE; - - process_start(&rf_ble_beacon_process, NULL); - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -uint8_t -rf_ble_is_active() -{ - return ble_mode_on; -} -/*---------------------------------------------------------------------------*/ -void -rf_ble_beacond_stop() -{ - process_exit(&rf_ble_beacon_process); -} -static uint8_t -rf_radio_setup() -{ - uint32_t cmd_status; - rfc_CMD_RADIO_SETUP_t cmd; - - rf_switch_select_path(RF_SWITCH_PATH_2_4GHZ); - - /* Create radio setup command */ - rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_RADIO_SETUP); - - cmd.txPower = tx_power_current->tx_power; - cmd.pRegOverride = ble_overrides; - cmd.config.frontEndMode = RF_CORE_RADIO_SETUP_FRONT_END_MODE; - cmd.config.biasMode = RF_CORE_RADIO_SETUP_BIAS_MODE; - cmd.mode = 0; - - /* Send Radio setup to RF Core */ - if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("rf_radio_setup: CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd.status); - return RF_CORE_CMD_ERROR; - } - - /* Wait until radio setup is done */ - if(rf_core_wait_cmd_done(&cmd) != RF_CORE_CMD_OK) { - PRINTF("rf_radio_setup: wait, CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd.status); - return RF_CORE_CMD_ERROR; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -void -rf_ble_beacon_single(uint8_t channel, uint8_t *data, uint8_t len) -{ - uint32_t cmd_status; - bool interrupts_disabled; - uint8_t j, channel_selected; - uint8_t was_on; - - /* Adhere to the maximum BLE advertisement payload size */ - if(len > BLE_ADV_NAME_BUF_LEN) { - len = BLE_ADV_NAME_BUF_LEN; - } - - /* - * Under ContikiMAC, some IEEE-related operations will be called from an - * interrupt context. We need those to see that we are in BLE mode. - */ - interrupts_disabled = ti_lib_int_master_disable(); - ble_mode_on = RF_BLE_ACTIVE; - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } - - /* - * First, determine our state: - * - * If we are running CSMA, we are likely in IEEE RX mode. We need to - * abort the IEEE BG Op before entering BLE mode. - * If we are ContikiMAC, we are likely off, in which case we need to - * boot the CPE before entering BLE mode - */ - was_on = rf_core_is_accessible(); - - if(was_on) { - /* - * We were on: If we are in the process of receiving a frame, abort the - * BLE beacon burst. Otherwise, terminate the primary radio Op so we - * can switch to BLE mode - */ - if(NETSTACK_RADIO.receiving_packet()) { - PRINTF("rf_ble_beacon_single: We were receiving\n"); - - /* Abort this pass */ - return; - } - - rf_core_primary_mode_abort(); - } else { - - oscillators_request_hf_xosc(); - - /* We were off: Boot the CPE */ - if(rf_core_boot() != RF_CORE_CMD_OK) { - /* Abort this pass */ - PRINTF("rf_ble_beacon_single: rf_core_boot() failed\n"); - return; - } - - oscillators_switch_to_hf_xosc(); - - /* Enter BLE mode */ - if(rf_radio_setup() != RF_CORE_CMD_OK) { - /* Continue so we can at least try to restore our previous state */ - PRINTF("rf_ble_beacon_single: Error entering BLE mode\n"); - } else { - - for(j = 0; j < 3; j++) { - channel_selected = (channel >> j) & 0x01; - if(channel_selected == 1) { - if(send_ble_adv_nc(37 + j, data, len) != RF_CORE_CMD_OK) { - /* Continue... */ - PRINTF("rf_ble_beacon_single: Channel=%d, " - "Error advertising\n", 37 + j); - } - } - } - } - - /* Send a CMD_STOP command to RF Core */ - if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_STOP), &cmd_status) != RF_CORE_CMD_OK) { - /* Continue... */ - PRINTF("rf_ble_beacon_single: status=0x%08lx\n", cmd_status); - } - - if(was_on) { - /* We were on, go back to previous primary mode */ - rf_core_primary_mode_restore(); - } else { - /* We were off. Shut back off */ - rf_core_power_down(); - - /* Switch HF clock source to the RCOSC to preserve power */ - oscillators_switch_to_hf_rc(); - } - - interrupts_disabled = ti_lib_int_master_disable(); - - ble_mode_on = RF_BLE_IDLE; - - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(rf_ble_beacon_process, ev, data) -{ - PROCESS_BEGIN(); - - while(1) { - etimer_set(&ble_adv_et, beacond_config.interval); - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&ble_adv_et) || ev == PROCESS_EVENT_EXIT); - - if(ev == PROCESS_EVENT_EXIT) { - PROCESS_EXIT(); - } - - /* Set the adv payload each pass: The device name may have changed */ - p = 0; - - /* device info */ - memset(payload, 0, BLE_ADV_PAYLOAD_BUF_LEN); - payload[p++] = 0x02; /* 2 bytes */ - payload[p++] = BLE_ADV_TYPE_DEVINFO; - payload[p++] = 0x1a; /* LE general discoverable + BR/EDR */ - payload[p++] = 1 + strlen(beacond_config.adv_name); - payload[p++] = BLE_ADV_TYPE_NAME; - memcpy(&payload[p], beacond_config.adv_name, - strlen(beacond_config.adv_name)); - p += strlen(beacond_config.adv_name); - - /* - * Send BLE_ADV_MESSAGES beacon bursts. Each burst on all three - * channels, with a BLE_ADV_DUTY_CYCLE interval between bursts - */ - for(i = 0; i < BLE_ADV_MESSAGES; i++) { - - rf_ble_beacon_single(BLE_ADV_CHANNEL_ALL, payload, p); - - etimer_set(&ble_adv_et, BLE_ADV_DUTY_CYCLE); - - /* Wait unless this is the last burst */ - if(i < BLE_ADV_MESSAGES - 1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&ble_adv_et)); - } - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/rf-ble.h b/arch/cpu/cc26x0-cc13x0/rf-core/rf-ble.h deleted file mode 100644 index 761ca88d6..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/rf-ble.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2017, University of Bristol - http://www.bristol.ac.uk/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rf-core - * @{ - * - * \defgroup rf-core-ble CC13xx/CC26xx BLE driver - * - * @{ - * - * \file - * Header file for the CC13xx/CC26xx BLE driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_BLE_H_ -#define RF_BLE_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "rf-core/rf-core.h" -#include "radio.h" - -#include -/*---------------------------------------------------------------------------*/ -#ifdef RF_BLE_CONF_ENABLED -#define RF_BLE_ENABLED RF_BLE_CONF_ENABLED -#else -#define RF_BLE_ENABLED 1 -#endif -/*---------------------------------------------------------------------------*/ -#define RF_BLE_IDLE 0 -#define RF_BLE_ACTIVE 1 -/*---------------------------------------------------------------------------*/ -/* Memory address of BLE MAC address. Can be overwritten by the user by defining BLE_ADDRESS_PTR. */ -#ifndef BLE_ADDRESS_PTR -#define BLE_ADDRESS_PTR (0x500012E8) -#endif -/*---------------------------------------------------------------------------*/ -/* BLE Advertisement channels. Not to be changed by the user. */ -#define BLE_ADV_CHANNEL_MASK 0x07 - -#define BLE_ADV_CHANNEL_37 0x01 -#define BLE_ADV_CHANNEL_38 0x02 -#define BLE_ADV_CHANNEL_39 0x04 - -#define BLE_ADV_CHANNEL_ALL (BLE_ADV_CHANNEL_37 | BLE_ADV_CHANNEL_38 | BLE_ADV_CHANNEL_39) -/*---------------------------------------------------------------------------*/ -/* Maximum BLE advertisement size. Not to be changed by the user. */ -#define BLE_ADV_MAX_SIZE 31 -/*---------------------------------------------------------------------------*/ -/** - * \brief Set the device name to use with the BLE advertisement/beacon daemon - * \param interval The interval (ticks) between two consecutive beacon bursts - * \param name The device name to advertise - * - * If name is NULL it will be ignored. If interval==0 it will be ignored. Thus, - * this function can be used to configure a single parameter at a time if so - * desired. - */ -void rf_ble_beacond_config(clock_time_t interval, const char *name); - -/** - * \brief Start the BLE advertisement/beacon daemon - * \return RF_CORE_CMD_OK: Success, RF_CORE_CMD_ERROR: Failure - * - * Before calling this function, the name to advertise must first be set by - * calling rf_ble_beacond_config(). Otherwise, this function will return an - * error. - */ -uint8_t rf_ble_beacond_start(void); - -/** - * \brief Stop the BLE advertisement/beacon daemon - */ -void rf_ble_beacond_stop(void); - -/** - * \brief Check whether the BLE beacond is currently active - * \retval 1 The radio is in BLE mode - * \retval 0 The BLE daemon is not active, or disabled - */ -uint8_t rf_ble_is_active(void); - -/** - * \brief Set TX power for BLE advertisements - * \param power The 'at least' TX power in dBm, values avove 5 dBm will be ignored - * - * Set TX power to 'at least' power dBm. - * This works with a lookup table. If the value of 'power' does not exist in - * the lookup table, TXPOWER will be set to the immediately higher available - * value - */ -void rf_ble_set_tx_power(radio_value_t power); - -/** - * \brief Get TX power for BLE advertisements - * \return The TX power for BLE advertisements - */ -radio_value_t rf_ble_get_tx_power(void); - -/** - * \brief Transmit a single BLE advertisement in one or more advertisement channels - * \param channel Bitmask of advertisement channels to be used: use - * BLE_ADV_CHANNEL_37 for channel 37, BLE_ADV_CHANNEL_38 for channel 38, - * BLE_ADV_CHANNEL_39 for channel 39, or any 'or' combination of those - * \param data A pointer to the advertisement data buffer - * \param len The length of the advertisement data. If more than BLE_ADV_MAX_SIZE, - * the first BLE_ADV_MAX_SIZE bytes will be used. - * - * Transmits a given advertisement payload once in one or any arbitrary combination - * of advertisement channels. - */ -void rf_ble_beacon_single(uint8_t channel, uint8_t *data, uint8_t len); -/*---------------------------------------------------------------------------*/ -#endif /* RF_BLE_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/rf-core.c b/arch/cpu/cc26x0-cc13x0/rf-core/rf-core.c deleted file mode 100644 index 7e638509d..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/rf-core.c +++ /dev/null @@ -1,782 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rf-core - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx RF core driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/watchdog.h" -#include "sys/process.h" -#include "sys/energest.h" -#include "sys/cc.h" -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "rf-core/rf-core.h" -#include "rf-core/rf-switch.h" -#include "ti-lib.h" -/*---------------------------------------------------------------------------*/ -/* RF core and RF HAL API */ -#include "hw_rfc_dbell.h" -#include "hw_rfc_pwr.h" -/*---------------------------------------------------------------------------*/ -/* RF Core Mailbox API */ -#include "driverlib/rf_mailbox.h" -#include "driverlib/rf_common_cmd.h" -#include "driverlib/rf_data_entry.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#ifdef RF_CORE_CONF_DEBUG_CRC -#define RF_CORE_DEBUG_CRC RF_CORE_CONF_DEBUG_CRC -#else -#define RF_CORE_DEBUG_CRC DEBUG -#endif -/*---------------------------------------------------------------------------*/ -/* RF interrupts */ -#define RX_FRAME_IRQ IRQ_RX_ENTRY_DONE -#define ERROR_IRQ (IRQ_INTERNAL_ERROR | IRQ_RX_BUF_FULL) -#define RX_NOK_IRQ IRQ_RX_NOK - -/* Those IRQs are enabled all the time */ -#if RF_CORE_DEBUG_CRC -#define ENABLED_IRQS (RX_FRAME_IRQ | ERROR_IRQ | RX_NOK_IRQ) -#else -#define ENABLED_IRQS (RX_FRAME_IRQ | ERROR_IRQ) -#endif - -#define ENABLED_IRQS_POLL_MODE (ENABLED_IRQS & ~(RX_FRAME_IRQ | ERROR_IRQ)) - -#define cc26xx_rf_cpe0_isr RFCCPE0IntHandler -#define cc26xx_rf_cpe1_isr RFCCPE1IntHandler -/*---------------------------------------------------------------------------*/ -typedef ChipType_t chip_type_t; -/*---------------------------------------------------------------------------*/ -/* Remember the last Radio Op issued to the radio */ -static rfc_radioOp_t *last_radio_op = NULL; -/*---------------------------------------------------------------------------*/ -/* A struct holding pointers to the primary mode's abort() and restore() */ -static const rf_core_primary_mode_t *primary_mode = NULL; -/*---------------------------------------------------------------------------*/ -/* RAT has 32-bit register, overflows once 18 minutes */ -#define RAT_RANGE 4294967296ull -/* approximate value */ -#define RAT_OVERFLOW_PERIOD_SECONDS (60 * 18) - -/* how often to check for the overflow, as a minimum */ -#define RAT_OVERFLOW_TIMER_INTERVAL (CLOCK_SECOND * RAT_OVERFLOW_PERIOD_SECONDS / 3) - -/* Radio timer (RAT) offset as compared to the rtimer counter (RTC) */ -static int32_t rat_offset; -static bool rat_offset_known; - -/* Value during the last read of the RAT register */ -static uint32_t rat_last_value; - -/* For RAT overflow handling */ -static struct ctimer rat_overflow_timer; -static volatile uint32_t rat_overflow_counter; -static rtimer_clock_t rat_last_overflow; - -static void rat_overflow_check_timer_cb(void *); -/*---------------------------------------------------------------------------*/ -volatile int8_t rf_core_last_rssi = RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN; -volatile uint8_t rf_core_last_corr_lqi = 0; -volatile uint32_t rf_core_last_packet_timestamp = 0; -/*---------------------------------------------------------------------------*/ -/* Are we currently in poll mode? */ -uint8_t rf_core_poll_mode = 0; -/*---------------------------------------------------------------------------*/ -/* Buffer full flag */ -volatile bool rf_core_rx_is_full = false; -/*---------------------------------------------------------------------------*/ -PROCESS(rf_core_process, "CC13xx / CC26xx RF driver"); -/*---------------------------------------------------------------------------*/ -#define RF_CORE_CLOCKS_MASK (RFC_PWR_PWMCLKEN_RFC_M | RFC_PWR_PWMCLKEN_CPE_M \ - | RFC_PWR_PWMCLKEN_CPERAM_M | RFC_PWR_PWMCLKEN_FSCA_M \ - | RFC_PWR_PWMCLKEN_PHA_M | RFC_PWR_PWMCLKEN_RAT_M \ - | RFC_PWR_PWMCLKEN_RFERAM_M | RFC_PWR_PWMCLKEN_RFE_M \ - | RFC_PWR_PWMCLKEN_MDMRAM_M | RFC_PWR_PWMCLKEN_MDM_M) -/*---------------------------------------------------------------------------*/ -#define RF_CMD0 0x0607 -/*---------------------------------------------------------------------------*/ -uint8_t -rf_core_is_accessible() -{ - if(ti_lib_prcm_rf_ready()) { - return RF_CORE_ACCESSIBLE; - } - return RF_CORE_NOT_ACCESSIBLE; -} -/*---------------------------------------------------------------------------*/ -uint_fast8_t -rf_core_send_cmd(uint32_t cmd, uint32_t *status) -{ - uint32_t timeout_count = 0; - bool interrupts_disabled; - bool is_radio_op = false; - - /* - * If cmd is 4-byte aligned, then it's either a radio OP or an immediate - * command. Clear the status field if it's a radio OP - */ - if((cmd & 0x03) == 0) { - uint32_t cmd_type; - cmd_type = ((rfc_command_t *)cmd)->commandNo & RF_CORE_COMMAND_TYPE_MASK; - if(cmd_type == RF_CORE_COMMAND_TYPE_IEEE_FG_RADIO_OP || - cmd_type == RF_CORE_COMMAND_TYPE_RADIO_OP) { - is_radio_op = true; - ((rfc_radioOp_t *)cmd)->status = RF_CORE_RADIO_OP_STATUS_IDLE; - } - } - - /* - * Make sure ContikiMAC doesn't turn us off from within an interrupt while - * we are accessing RF Core registers - */ - interrupts_disabled = ti_lib_int_master_disable(); - - if(!rf_core_is_accessible()) { - PRINTF("rf_core_send_cmd: RF was off\n"); - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } - return RF_CORE_CMD_ERROR; - } - - if(is_radio_op) { - uint16_t command_no = ((rfc_radioOp_t *)cmd)->commandNo; - if((command_no & RF_CORE_COMMAND_PROTOCOL_MASK) != RF_CORE_COMMAND_PROTOCOL_COMMON && - (command_no & RF_CORE_COMMAND_TYPE_MASK) == RF_CORE_COMMAND_TYPE_RADIO_OP) { - last_radio_op = (rfc_radioOp_t *)cmd; - } - } - - HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = cmd; - do { - *status = HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDSTA); - if(++timeout_count > 50000) { - PRINTF("rf_core_send_cmd: 0x%08lx Timeout\n", cmd); - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } - return RF_CORE_CMD_ERROR; - } - } while((*status & RF_CORE_CMDSTA_RESULT_MASK) == RF_CORE_CMDSTA_PENDING); - - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } - - /* - * If we reach here the command is no longer pending. It is either completed - * successfully or with error - */ - return (*status & RF_CORE_CMDSTA_RESULT_MASK) == RF_CORE_CMDSTA_DONE; -} -/*---------------------------------------------------------------------------*/ -uint_fast8_t -rf_core_wait_cmd_done(void *cmd) -{ - volatile rfc_radioOp_t *command = (rfc_radioOp_t *)cmd; - uint32_t timeout_cnt = 0; - - /* - * 0xn4nn=DONE, 0x0400=DONE_OK while all other "DONE" values means done - * but with some kind of error (ref. "Common radio operation status codes") - */ - do { - if(++timeout_cnt > 500000) { - return RF_CORE_CMD_ERROR; - } - } while((command->status & RF_CORE_RADIO_OP_MASKED_STATUS) - != RF_CORE_RADIO_OP_MASKED_STATUS_DONE); - - return (command->status & RF_CORE_RADIO_OP_MASKED_STATUS) - == RF_CORE_RADIO_OP_STATUS_DONE_OK; -} -/*---------------------------------------------------------------------------*/ -static int -fs_powerdown(void) -{ - rfc_CMD_FS_POWERDOWN_t cmd; - uint32_t cmd_status; - - rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_FS_POWERDOWN); - - if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("fs_powerdown: CMDSTA=0x%08lx\n", cmd_status); - return RF_CORE_CMD_ERROR; - } - - if(rf_core_wait_cmd_done(&cmd) != RF_CORE_CMD_OK) { - PRINTF("fs_powerdown: CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd.status); - return RF_CORE_CMD_ERROR; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -int -rf_core_power_up() -{ - uint32_t cmd_status; - bool interrupts_disabled = ti_lib_int_master_disable(); - - ti_lib_int_pend_clear(INT_RFC_CPE_0); - ti_lib_int_pend_clear(INT_RFC_CPE_1); - ti_lib_int_disable(INT_RFC_CPE_0); - ti_lib_int_disable(INT_RFC_CPE_1); - - /* Enable RF Core power domain */ - ti_lib_prcm_power_domain_on(PRCM_DOMAIN_RFCORE); - while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_RFCORE) - != PRCM_DOMAIN_POWER_ON); - - ti_lib_prcm_domain_enable(PRCM_DOMAIN_RFCORE); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0; - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = 0x0; - ti_lib_int_enable(INT_RFC_CPE_0); - ti_lib_int_enable(INT_RFC_CPE_1); - - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } - - rf_switch_power_up(); - - /* Let CPE boot */ - HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = RF_CORE_CLOCKS_MASK; - - /* Turn on additional clocks on boot */ - HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0; - HWREG(RFC_DBELL_BASE+RFC_DBELL_O_CMDR) = - CMDR_DIR_CMD_2BYTE(RF_CMD0, - RFC_PWR_PWMCLKEN_MDMRAM | RFC_PWR_PWMCLKEN_RFERAM); - - /* Send ping (to verify RFCore is ready and alive) */ - if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_PING), &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("rf_core_power_up: CMD_PING fail, CMDSTA=0x%08lx\n", cmd_status); - return RF_CORE_CMD_ERROR; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -uint8_t -rf_core_start_rat(void) -{ - uint32_t cmd_status; - rfc_CMD_SYNC_START_RAT_t cmd_start; - - /* Start radio timer (RAT) */ - rf_core_init_radio_op((rfc_radioOp_t *)&cmd_start, sizeof(cmd_start), CMD_SYNC_START_RAT); - - /* copy the value and send back */ - cmd_start.rat0 = rat_offset; - - if(rf_core_send_cmd((uint32_t)&cmd_start, &cmd_status) != RF_CORE_CMD_OK) { - PRINTF("rf_core_get_rat_rtc_offset: SYNC_START_RAT fail, CMDSTA=0x%08lx\n", - cmd_status); - return RF_CORE_CMD_ERROR; - } - - /* Wait until done (?) */ - if(rf_core_wait_cmd_done(&cmd_start) != RF_CORE_CMD_OK) { - PRINTF("rf_core_cmd_ok: SYNC_START_RAT wait, CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd_start.status); - return RF_CORE_CMD_ERROR; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -uint8_t -rf_core_stop_rat(void) -{ - rfc_CMD_SYNC_STOP_RAT_t cmd_stop; - uint32_t cmd_status; - - rf_core_init_radio_op((rfc_radioOp_t *)&cmd_stop, sizeof(cmd_stop), CMD_SYNC_STOP_RAT); - - int ret = rf_core_send_cmd((uint32_t)&cmd_stop, &cmd_status); - if(ret != RF_CORE_CMD_OK) { - PRINTF("rf_core_get_rat_rtc_offset: SYNC_STOP_RAT fail, ret %d CMDSTA=0x%08lx\n", - ret, cmd_status); - return ret; - } - - /* Wait until done */ - ret = rf_core_wait_cmd_done(&cmd_stop); - if(ret != RF_CORE_CMD_OK) { - PRINTF("rf_core_cmd_ok: SYNC_STOP_RAT wait, CMDSTA=0x%08lx, status=0x%04x\n", - cmd_status, cmd_stop.status); - return ret; - } - - if(!rat_offset_known) { - /* save the offset, but only if this is the first time */ - rat_offset_known = true; - rat_offset = cmd_stop.rat0; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -void -rf_core_power_down() -{ - bool interrupts_disabled = ti_lib_int_master_disable(); - ti_lib_int_disable(INT_RFC_CPE_0); - ti_lib_int_disable(INT_RFC_CPE_1); - - if(rf_core_is_accessible()) { - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0; - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = 0x0; - - /* need to send FS_POWERDOWN or analog components will use power */ - fs_powerdown(); - } - - rf_core_stop_rat(); - - /* Shut down the RFCORE clock domain in the MCU VD */ - ti_lib_prcm_domain_disable(PRCM_DOMAIN_RFCORE); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - /* Turn off RFCORE PD */ - ti_lib_prcm_power_domain_off(PRCM_DOMAIN_RFCORE); - while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_RFCORE) - != PRCM_DOMAIN_POWER_OFF); - - rf_switch_power_down(); - - ti_lib_int_pend_clear(INT_RFC_CPE_0); - ti_lib_int_pend_clear(INT_RFC_CPE_1); - ti_lib_int_enable(INT_RFC_CPE_0); - ti_lib_int_enable(INT_RFC_CPE_1); - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } -} -/*---------------------------------------------------------------------------*/ -uint8_t -rf_core_set_modesel() -{ - uint8_t rv = RF_CORE_CMD_ERROR; - chip_type_t chip_type = ti_lib_chipinfo_get_chip_type(); - - if(chip_type == CHIP_TYPE_CC2650) { - HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE5; - rv = RF_CORE_CMD_OK; - } else if(chip_type == CHIP_TYPE_CC2630) { - HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE2; - rv = RF_CORE_CMD_OK; - } else if(chip_type == CHIP_TYPE_CC1310) { - HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE3; - rv = RF_CORE_CMD_OK; - } else if(chip_type == CHIP_TYPE_CC1350) { - HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE5; - rv = RF_CORE_CMD_OK; -#if CPU_FAMILY_CC26X0R2 - } else if(chip_type == CHIP_TYPE_CC2640R2) { - HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE1; - rv = RF_CORE_CMD_OK; -#endif - } - - return rv; -} -/*---------------------------------------------------------------------------*/ -uint8_t -rf_core_boot() -{ - if(rf_core_power_up() != RF_CORE_CMD_OK) { - PRINTF("rf_core_boot: rf_core_power_up() failed\n"); - - rf_core_power_down(); - - return RF_CORE_CMD_ERROR; - } - - if(rf_core_start_rat() != RF_CORE_CMD_OK) { - PRINTF("rf_core_boot: rf_core_start_rat() failed\n"); - - rf_core_power_down(); - - return RF_CORE_CMD_ERROR; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -uint8_t -rf_core_restart_rat(void) -{ - if(rf_core_stop_rat() != RF_CORE_CMD_OK) { - PRINTF("rf_core_restart_rat: rf_core_stop_rat() failed\n"); - /* Don't bail out here, still try to start it */ - } - - if(rf_core_start_rat() != RF_CORE_CMD_OK) { - PRINTF("rf_core_restart_rat: rf_core_start_rat() failed\n"); - - rf_core_power_down(); - - return RF_CORE_CMD_ERROR; - } - - return RF_CORE_CMD_OK; -} -/*---------------------------------------------------------------------------*/ -void -rf_core_setup_interrupts(void) -{ - bool interrupts_disabled; - const uint32_t enabled_irqs = rf_core_poll_mode ? ENABLED_IRQS_POLL_MODE : ENABLED_IRQS; - - /* We are already turned on by the caller, so this should not happen */ - if(!rf_core_is_accessible()) { - PRINTF("setup_interrupts: No access\n"); - return; - } - - /* Disable interrupts */ - interrupts_disabled = ti_lib_int_master_disable(); - - /* Set all interrupt channels to CPE0 channel, error to CPE1 */ - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEISL) = ERROR_IRQ; - - /* Acknowledge configured interrupts */ - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = enabled_irqs; - - /* Clear interrupt flags, active low clear(?) */ - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0; - - ti_lib_int_pend_clear(INT_RFC_CPE_0); - ti_lib_int_pend_clear(INT_RFC_CPE_1); - ti_lib_int_enable(INT_RFC_CPE_0); - ti_lib_int_enable(INT_RFC_CPE_1); - - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } -} -/*---------------------------------------------------------------------------*/ -void -rf_core_cmd_done_en(bool fg) -{ - uint32_t irq = 0; - const uint32_t enabled_irqs = rf_core_poll_mode ? ENABLED_IRQS_POLL_MODE : ENABLED_IRQS; - - if(!rf_core_poll_mode) { - irq = fg ? IRQ_LAST_FG_COMMAND_DONE : IRQ_LAST_COMMAND_DONE; - } - - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = enabled_irqs; - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = enabled_irqs | irq; -} -/*---------------------------------------------------------------------------*/ -void -rf_core_cmd_done_dis(void) -{ - const uint32_t enabled_irqs = rf_core_poll_mode ? ENABLED_IRQS_POLL_MODE : ENABLED_IRQS; - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = enabled_irqs; -} -/*---------------------------------------------------------------------------*/ -rfc_radioOp_t * -rf_core_get_last_radio_op() -{ - return last_radio_op; -} -/*---------------------------------------------------------------------------*/ -void -rf_core_init_radio_op(rfc_radioOp_t *op, uint16_t len, uint16_t command) -{ - memset(op, 0, len); - - op->commandNo = command; - op->condition.rule = COND_NEVER; -} -/*---------------------------------------------------------------------------*/ -void -rf_core_primary_mode_register(const rf_core_primary_mode_t *mode) -{ - primary_mode = mode; -} -/*---------------------------------------------------------------------------*/ -void -rf_core_primary_mode_abort() -{ - if(primary_mode) { - if(primary_mode->abort) { - primary_mode->abort(); - } - } -} -/*---------------------------------------------------------------------------*/ -uint8_t -rf_core_primary_mode_restore() -{ - if(primary_mode) { - if(primary_mode->restore) { - return primary_mode->restore(); - } - } - - return RF_CORE_CMD_ERROR; -} -/*---------------------------------------------------------------------------*/ -uint8_t -rf_core_rat_init(void) -{ - rat_last_value = HWREG(RFC_RAT_BASE + RATCNT); - - ctimer_set(&rat_overflow_timer, RAT_OVERFLOW_TIMER_INTERVAL, - rat_overflow_check_timer_cb, NULL); - - return 1; -} -/*---------------------------------------------------------------------------*/ -uint8_t -rf_core_check_rat_overflow(void) -{ - uint32_t rat_current_value; - uint8_t interrupts_disabled; - - /* Bail out if the RF is not on */ - if(primary_mode == NULL || !primary_mode->is_on()) { - return 0; - } - - interrupts_disabled = ti_lib_int_master_disable(); - - rat_current_value = HWREG(RFC_RAT_BASE + RATCNT); - if(rat_current_value + RAT_RANGE / 4 < rat_last_value) { - /* Overflow detected */ - rat_last_overflow = RTIMER_NOW(); - rat_overflow_counter++; - } - rat_last_value = rat_current_value; - - if(!interrupts_disabled) { - ti_lib_int_master_enable(); - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -rat_overflow_check_timer_cb(void *unused) -{ - uint8_t success = 0; - uint8_t was_off = 0; - - if(primary_mode != NULL) { - - if(!primary_mode->is_on()) { - was_off = 1; - if(NETSTACK_RADIO.on() != RF_CORE_CMD_OK) { - PRINTF("overflow: on() failed\n"); - ctimer_set(&rat_overflow_timer, CLOCK_SECOND, - rat_overflow_check_timer_cb, NULL); - return; - } - } - - success = rf_core_check_rat_overflow(); - - if(was_off) { - NETSTACK_RADIO.off(); - } - } - - if(success) { - /* Retry after half of the interval */ - ctimer_set(&rat_overflow_timer, RAT_OVERFLOW_TIMER_INTERVAL, - rat_overflow_check_timer_cb, NULL); - } else { - /* Retry sooner */ - ctimer_set(&rat_overflow_timer, CLOCK_SECOND, - rat_overflow_check_timer_cb, NULL); - } -} -/*---------------------------------------------------------------------------*/ -uint32_t -rf_core_convert_rat_to_rtimer(uint32_t rat_timestamp) -{ - uint64_t rat_timestamp64; - uint32_t adjusted_overflow_counter; - uint8_t was_off = 0; - - if(primary_mode == NULL) { - PRINTF("rf_core_convert_rat_to_rtimer: not initialized\n"); - return 0; - } - - if(!primary_mode->is_on()) { - was_off = 1; - NETSTACK_RADIO.on(); - } - - rf_core_check_rat_overflow(); - - if(was_off) { - NETSTACK_RADIO.off(); - } - - adjusted_overflow_counter = rat_overflow_counter; - - /* if the timestamp is large and the last oveflow was recently, - assume that the timestamp refers to the time before the overflow */ - if(rat_timestamp > (uint32_t)(RAT_RANGE * 3 / 4)) { - if(RTIMER_CLOCK_LT(RTIMER_NOW(), - rat_last_overflow + RAT_OVERFLOW_PERIOD_SECONDS * RTIMER_SECOND / 4)) { - adjusted_overflow_counter--; - } - } - - /* add the overflowed time to the timestamp */ - rat_timestamp64 = rat_timestamp + RAT_RANGE * adjusted_overflow_counter; - /* correct timestamp so that it refers to the end of the SFD */ - rat_timestamp64 += primary_mode->sfd_timestamp_offset; - - return RADIO_TO_RTIMER(rat_timestamp64 - rat_offset); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(rf_core_process, ev, data) -{ - int len; - - PROCESS_BEGIN(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - do { - watchdog_periodic(); - packetbuf_clear(); - len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE); - - if(len > 0) { - packetbuf_set_datalen(len); - - NETSTACK_MAC.input(); - } - } while(len > 0); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static void -rx_nok_isr(void) -{ -} -/*---------------------------------------------------------------------------*/ -void -cc26xx_rf_cpe1_isr(void) -{ - PRINTF("RF Error\n"); - - if(!rf_core_is_accessible()) { - if(rf_core_power_up() != RF_CORE_CMD_OK) { - return; - } - } - - if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & IRQ_RX_BUF_FULL) { - PRINTF("\nRF: BUF_FULL\n\n"); - /* set a flag that the buffer is full*/ - rf_core_rx_is_full = true; - /* make sure read_frame() will be called to make space in RX buffer */ - process_poll(&rf_core_process); - /* Clear the IRQ_RX_BUF_FULL interrupt flag by writing zero to bit */ - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = ~(IRQ_RX_BUF_FULL); - } - - /* Clear INTERNAL_ERROR interrupt flag */ - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x7FFFFFFF; -} -/*---------------------------------------------------------------------------*/ -void -cc26xx_rf_cpe0_isr(void) -{ - if(!rf_core_is_accessible()) { - printf("RF ISR called but RF not ready... PANIC!!\n"); - if(rf_core_power_up() != RF_CORE_CMD_OK) { - PRINTF("rf_core_power_up() failed\n"); - return; - } - } - - ti_lib_int_master_disable(); - - if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & RX_FRAME_IRQ) { - /* Clear the RX_ENTRY_DONE interrupt flag */ - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0xFF7FFFFF; - process_poll(&rf_core_process); - } - - if(RF_CORE_DEBUG_CRC) { - if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & RX_NOK_IRQ) { - /* Clear the RX_NOK interrupt flag */ - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0xFFFDFFFF; - rx_nok_isr(); - } - } - - if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & - (IRQ_LAST_FG_COMMAND_DONE | IRQ_LAST_COMMAND_DONE)) { - /* Clear the two TX-related interrupt flags */ - HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0xFFFFFFF5; - } - - ti_lib_int_master_enable(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/rf-core.h b/arch/cpu/cc26x0-cc13x0/rf-core/rf-core.h deleted file mode 100644 index 6cb65672d..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/rf-core.h +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup rf-core CC13xx/CC26xx RF core - * - * Different flavours of chips of the CC13xx/CC26xx family have different - * radio capability. For example, the CC2650 can operate in IEEE 802.15.4 mode - * at 2.4GHz, but it can also operate in BLE mode. The CC1310 only supports - * sub-ghz mode. - * - * However, there are many radio functionalities that are identical across - * all chips. The rf-core driver provides support for this common functionality - * - * @{ - * - * \file - * Header file for the CC13xx/CC26xx RF core driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CORE_H_ -#define RF_CORE_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "driverlib/rf_common_cmd.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define RF_CORE_FRONT_END_MODE_DIFFERENTIAL 0 -#define RF_CORE_FRONT_END_MODE_SINGLE_RFP 1 -#define RF_CORE_FRONT_END_MODE_SINGLE_RFN 2 - -#define RF_CORE_BIAS_MODE_INTERNAL 0 -#define RF_CORE_BIAS_MODE_EXTERNAL 1 -/*---------------------------------------------------------------------------*/ -/* - * RF Front-End Mode and Bias for CMD_RADIO_SETUP (IEEE and BLE) - * Default: Differential mode, internal bias - */ -#ifdef RF_CORE_CONF_RADIO_SETUP_FRONT_END_MODE -#define RF_CORE_RADIO_SETUP_FRONT_END_MODE RF_CORE_CONF_RADIO_SETUP_FRONT_END_MODE -#else -#define RF_CORE_RADIO_SETUP_FRONT_END_MODE RF_CORE_FRONT_END_MODE_DIFFERENTIAL -#endif - -#ifdef RF_CORE_CONF_RADIO_SETUP_BIAS_MODE -#define RF_CORE_RADIO_SETUP_BIAS_MODE RF_CORE_CONF_RADIO_SETUP_BIAS_MODE -#else -#define RF_CORE_RADIO_SETUP_BIAS_MODE RF_CORE_BIAS_MODE_INTERNAL -#endif -/*---------------------------------------------------------------------------*/ -/* - * RF Front-End Mode and Bias for CMD_PROP_DIV_RADIO_SETUP (PROP mode) - * Default: Differential mode, external bias - */ -#ifdef RF_CORE_CONF_PROP_FRONT_END_MODE -#define RF_CORE_PROP_FRONT_END_MODE RF_CORE_CONF_PROP_FRONT_END_MODE -#else -#define RF_CORE_PROP_FRONT_END_MODE RF_CORE_FRONT_END_MODE_DIFFERENTIAL -#endif - -#ifdef RF_CORE_CONF_PROP_BIAS_MODE -#define RF_CORE_PROP_BIAS_MODE RF_CORE_CONF_PROP_BIAS_MODE -#else -#define RF_CORE_PROP_BIAS_MODE RF_CORE_BIAS_MODE_EXTERNAL -#endif -/*---------------------------------------------------------------------------*/ -#define RF_CORE_CMD_ERROR 0 -#define RF_CORE_CMD_OK 1 -/*---------------------------------------------------------------------------*/ -/** - * \brief A data strcuture representing the radio's primary mode of operation - * - * The CC13xx / CC26xx radio supports up to potentially 3 modes: IEEE, Prop and - * BLE. Within Contiki, we assume that the radio is by default in one of IEEE - * or Prop in order to support standard 6LoWPAN / .15.4 operation. The BLE - * mode interrupts this so called "primary" mode in order to send BLE adv - * messages. Once BLE is done advertising, we need to be able to restore the - * previous .15.4 mode. Unfortunately, the only way this can be done with - * NETSTACK_RADIO API is by fully power-cycling the radio, which is something - * we do not want to do. - * - * Thus, we declare a secondary data structure for primary mode drivers (IEEE - * or Prop). We use this data structure to issue "soft off" and "back on" - * commands. Soft off in this context means stopping RX (e.g. the respective - * IEEE RX operation), but without shutting down the RF core (which is what - * NETSTACK_RADIO.off() would have done). We then remember what mode we were - * using in order to be able to re-enter RX mode for this mode. - * - * A NETSTACK_RADIO driver will declare those two functions somewhere within - * its module of implementation. During its init() routine, it will notify - * the RF core module so that the latter can abort and restore operations. - */ -typedef struct rf_core_primary_mode_s { - /** - * \brief A pointer to a function used to abort the current radio op - */ - void (*abort)(void); - - /** - * \brief A pointer to a function that will restore the previous radio op - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - */ - uint8_t (*restore)(void); - - /** - * \brief A pointer to a function that checks if the radio is on - * \return 1 or 0 - */ - uint8_t (*is_on)(void); - - /** - * \brief Offset of the end of SFD when compared to the radio HW-generated timestamp - */ - int16_t sfd_timestamp_offset; -} rf_core_primary_mode_t; -/*---------------------------------------------------------------------------*/ -/* RF Command status constants - Correspond to values in the CMDSTA register */ -#define RF_CORE_CMDSTA_PENDING 0x00 -#define RF_CORE_CMDSTA_DONE 0x01 -#define RF_CORE_CMDSTA_ILLEGAL_PTR 0x81 -#define RF_CORE_CMDSTA_UNKNOWN_CMD 0x82 -#define RF_CORE_CMDSTA_UNKNOWN_DIR_CMD 0x83 -#define RF_CORE_CMDSTA_CONTEXT_ERR 0x85 -#define RF_CORE_CMDSTA_SCHEDULING_ERR 0x86 -#define RF_CORE_CMDSTA_PAR_ERR 0x87 -#define RF_CORE_CMDSTA_QUEUE_ERR 0x88 -#define RF_CORE_CMDSTA_QUEUE_BUSY 0x89 - -/* Status values starting with 0x8 correspond to errors */ -#define RF_CORE_CMDSTA_ERR_MASK 0x80 - -/* CMDSTA is 32-bits. Return value in bits 7:0 */ -#define RF_CORE_CMDSTA_RESULT_MASK 0xFF - -#define RF_CORE_RADIO_OP_STATUS_IDLE 0x0000 -/*---------------------------------------------------------------------------*/ -#define RF_CORE_NOT_ACCESSIBLE 0x00 -#define RF_CORE_ACCESSIBLE 0x01 -/*---------------------------------------------------------------------------*/ -/* RF Radio Op status constants. Field 'status' in Radio Op command struct */ -#define RF_CORE_RADIO_OP_STATUS_IDLE 0x0000 -#define RF_CORE_RADIO_OP_STATUS_PENDING 0x0001 -#define RF_CORE_RADIO_OP_STATUS_ACTIVE 0x0002 -#define RF_CORE_RADIO_OP_STATUS_SKIPPED 0x0003 -#define RF_CORE_RADIO_OP_STATUS_DONE_OK 0x0400 -#define RF_CORE_RADIO_OP_STATUS_DONE_COUNTDOWN 0x0401 -#define RF_CORE_RADIO_OP_STATUS_DONE_RXERR 0x0402 -#define RF_CORE_RADIO_OP_STATUS_DONE_TIMEOUT 0x0403 -#define RF_CORE_RADIO_OP_STATUS_DONE_STOPPED 0x0404 -#define RF_CORE_RADIO_OP_STATUS_DONE_ABORT 0x0405 -#define RF_CORE_RADIO_OP_STATUS_ERROR_PAST_START 0x0800 -#define RF_CORE_RADIO_OP_STATUS_ERROR_START_TRIG 0x0801 -#define RF_CORE_RADIO_OP_STATUS_ERROR_CONDITION 0x0802 -#define RF_CORE_RADIO_OP_STATUS_ERROR_PAR 0x0803 -#define RF_CORE_RADIO_OP_STATUS_ERROR_POINTER 0x0804 -#define RF_CORE_RADIO_OP_STATUS_ERROR_CMDID 0x0805 -#define RF_CORE_RADIO_OP_STATUS_ERROR_NO_SETUP 0x0807 -#define RF_CORE_RADIO_OP_STATUS_ERROR_NO_FS 0x0808 -#define RF_CORE_RADIO_OP_STATUS_ERROR_SYNTH_PROG 0x0809 - -/* Additional Op status values for IEEE mode */ -#define RF_CORE_RADIO_OP_STATUS_IEEE_SUSPENDED 0x2001 -#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_OK 0x2400 -#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_BUSY 0x2401 -#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_STOPPED 0x2402 -#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ACK 0x2403 -#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ACKPEND 0x2404 -#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_TIMEOUT 0x2405 -#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_BGEND 0x2406 -#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ABORT 0x2407 -#define RF_CORE_RADIO_OP_STATUS_ERROR_WRONG_BG 0x0806 -#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_PAR 0x2800 -#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_NO_SETUP 0x2801 -#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_NO_FS 0x2802 -#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_SYNTH_PROG 0x2803 -#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_RXOVF 0x2804 -#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_TXUNF 0x2805 - -/* Op status values for BLE mode */ -#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_OK 0x1400 -#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_RXTIMEOUT 0x1401 -#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_NOSYNC 0x1402 -#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_RXERR 0x1403 -#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_CONNECT 0x1404 -#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_MAXNACK 0x1405 -#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_ENDED 0x1406 -#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_ABORT 0x1407 -#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_STOPPED 0x1408 -#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_PAR 0x1800 -#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_RXBUF 0x1801 -#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_NO_SETUP 0x1802 -#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_NO_FS 0x1803 -#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_SYNTH_PROG 0x1804 -#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_RXOVF 0x1805 -#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_TXUNF 0x1806 - -/* Op status values for proprietary mode */ -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_OK 0x3400 -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_RXTIMEOUT 0x3401 -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BREAK 0x3402 -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_ENDED 0x3403 -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_STOPPED 0x3404 -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_ABORT 0x3405 -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_RXERR 0x3406 -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_IDLE 0x3407 -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BUSY 0x3408 -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_IDLETIMEOUT 0x3409 -#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BUSYTIMEOUT 0x340A -#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_PAR 0x3800 -#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXBUF 0x3801 -#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXFULL 0x3802 -#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_NO_SETUP 0x3803 -#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_NO_FS 0x3804 -#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXOVF 0x3805 -#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_TXUNF 0x3806 - -/* Bits 15:12 signify the protocol */ -#define RF_CORE_RADIO_OP_STATUS_PROTO_MASK 0xF000 -#define RF_CORE_RADIO_OP_STATUS_PROTO_GENERIC 0x0000 -#define RF_CORE_RADIO_OP_STATUS_PROTO_BLE 0x1000 -#define RF_CORE_RADIO_OP_STATUS_PROTO_IEEE 0x2000 -#define RF_CORE_RADIO_OP_STATUS_PROTO_PROP 0x3000 - -/* Bits 11:10 signify Running / Done OK / Done with error */ -#define RF_CORE_RADIO_OP_MASKED_STATUS 0x0C00 -#define RF_CORE_RADIO_OP_MASKED_STATUS_RUNNING 0x0000 -#define RF_CORE_RADIO_OP_MASKED_STATUS_DONE 0x0400 -#define RF_CORE_RADIO_OP_MASKED_STATUS_ERROR 0x0800 -/*---------------------------------------------------------------------------*/ -/* Command Types */ -#define RF_CORE_COMMAND_TYPE_MASK 0x0C00 -#define RF_CORE_COMMAND_TYPE_RADIO_OP 0x0800 -#define RF_CORE_COMMAND_TYPE_IEEE_BG_RADIO_OP 0x0800 -#define RF_CORE_COMMAND_TYPE_IEEE_FG_RADIO_OP 0x0C00 - -#define RF_CORE_COMMAND_PROTOCOL_MASK 0x3000 -#define RF_CORE_COMMAND_PROTOCOL_COMMON 0x0000 -#define RF_CORE_COMMAND_PROTOCOL_BLE 0x1000 -#define RF_CORE_COMMAND_PROTOCOL_IEEE 0x2000 -#define RF_CORE_COMMAND_PROTOCOL_PROP 0x3000 -/*---------------------------------------------------------------------------*/ -/* Radio timer register */ -#define RATCNT 0x00000004 -/*---------------------------------------------------------------------------*/ -/* Special value returned by CMD_IEEE_CCA_REQ when an RSSI is not available */ -#define RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN -128 - -/* Used for the return value of channel_clear */ -#define RF_CORE_CCA_CLEAR 1 -#define RF_CORE_CCA_BUSY 0 - -/* Used as an error return value for get_cca_info */ -#define RF_CORE_GET_CCA_INFO_ERROR 0xFF - -/* - * Values of the individual bits of the ccaInfo field in CMD_IEEE_CCA_REQ's - * status struct - */ -#define RF_CORE_CMD_CCA_REQ_CCA_STATE_IDLE 0 /* 00 */ -#define RF_CORE_CMD_CCA_REQ_CCA_STATE_BUSY 1 /* 01 */ -#define RF_CORE_CMD_CCA_REQ_CCA_STATE_INVALID 2 /* 10 */ - -#define RF_CORE_CMD_CCA_REQ_CCA_CORR_IDLE (0 << 4) -#define RF_CORE_CMD_CCA_REQ_CCA_CORR_BUSY (1 << 4) -#define RF_CORE_CMD_CCA_REQ_CCA_CORR_INVALID (3 << 4) -#define RF_CORE_CMD_CCA_REQ_CCA_CORR_MASK (3 << 4) - -#define RF_CORE_CMD_CCA_REQ_CCA_SYNC_BUSY (1 << 6) -/*---------------------------------------------------------------------------*/ -#define RF_CORE_RX_BUF_INCLUDE_CRC 0 -#define RF_CORE_RX_BUF_INCLUDE_RSSI 1 -#define RF_CORE_RX_BUF_INCLUDE_CORR 1 -#define RF_CORE_RX_BUF_INCLUDE_TIMESTAMP 1 -/*---------------------------------------------------------------------------*/ -/* How long to wait for an ongoing ACK TX to finish before starting frame TX */ -#define RF_CORE_TX_TIMEOUT (RTIMER_SECOND >> 11) - -/* How long to wait for the RF to enter RX in rf_cmd_ieee_rx */ -#define RF_CORE_ENTER_RX_TIMEOUT (RTIMER_SECOND >> 10) - -/* How long to wait for the RF to react on CMD_ABORT: around 1 msec */ -#define RF_CORE_TURN_OFF_TIMEOUT (RTIMER_SECOND >> 10) - -/* How long to wait for the RF to finish TX of a packet or an ACK */ -#define RF_CORE_TX_FINISH_TIMEOUT (RTIMER_SECOND >> 7) - -/*---------------------------------------------------------------------------*/ -/* Make the main driver process visible to mode drivers */ -PROCESS_NAME(rf_core_process); -/*---------------------------------------------------------------------------*/ -/* Buffer full flag */ -extern volatile bool rf_core_rx_is_full; -/*---------------------------------------------------------------------------*/ -/* RSSI of the last read frame */ -extern volatile int8_t rf_core_last_rssi; -/* Correlation/LQI of the last read frame */ -extern volatile uint8_t rf_core_last_corr_lqi; -/* SFD timestamp of the last read frame, in rtimer ticks */ -extern volatile uint32_t rf_core_last_packet_timestamp; -/*---------------------------------------------------------------------------*/ -/* Are we currently in poll mode? */ -extern uint8_t rf_core_poll_mode; -/*---------------------------------------------------------------------------*/ -/** - * \brief Check whether the RF core is accessible - * \retval RF_CORE_ACCESSIBLE The core is powered and ready for access - * \retval RF_CORE_NOT_ACCESSIBLE The core is not ready - * - * If this function returns RF_CORE_NOT_ACCESSIBLE, rf_core_power_up() must be - * called before any attempt to access the core. - */ -uint8_t rf_core_is_accessible(void); - -/** - * \brief Sends a command to the RF core. - * - * \param cmd The command value or a pointer to a command buffer - * \param status A pointer to a variable which will hold the status - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - * - * This function supports all three types of command (Radio OP, immediate and - * direct) - * - * For immediate and Radio OPs, cmd is a pointer to the data structure - * containing the command and its parameters. This data structure must be - * 4-byte aligned. - * - * For direct commands, cmd contains the value of the command alongside its - * parameters. This value will be written to CMDSTA verbatim, so the command - * ID must be in the 16 high bits, and the 2 LS bits must be set to 01 by the - * caller. - * - * The caller is responsible of allocating and populating cmd for Radio OP and - * immediate commands - * - * The caller is responsible for allocating status - * - * For immediate commands and radio Ops, this function will set the command's - * status field to RF_CORE_RADIO_OP_STATUS_IDLE before sending it to the RF - */ -uint_fast8_t rf_core_send_cmd(uint32_t cmd, uint32_t *status); - -/** - * \brief Block and wait for a Radio op to complete - * \param cmd A pointer to any command's structure - * \retval RF_CORE_CMD_OK the command completed with status _DONE_OK - * \retval RF_CORE_CMD_ERROR Timeout exceeded or the command completed with - * status _DONE_xxx (e.g. RF_CORE_RADIO_OP_STATUS_DONE_TIMEOUT) - */ -uint_fast8_t rf_core_wait_cmd_done(void *cmd); - -/** - * \brief Turn on power to the RFC and boot it. - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - */ -int rf_core_power_up(void); - -/** - * \brief Disable RFCORE clock domain in the MCU VD and turn off the RFCORE PD - */ -void rf_core_power_down(void); - -/** - * \brief Initialise RF APIs in the RF core - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - * - * Depending on chip family and capability, this function will set the correct - * value to PRCM.RFCMODESEL - */ -uint8_t rf_core_set_modesel(void); - -/** - * \brief Start the CM0 RAT - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - * - * This function must be called each time the CM0 boots. The boot sequence - * can be performed automatically by calling rf_core_boot() if patches are not - * required. If patches are required then the patches must be applied after - * power up and before calling this function. - */ -uint8_t rf_core_start_rat(void); - -/** - * \brief Stop the CM0 RAT synchronously - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - * - * This function is not strictly necessary, but through calling it it's possibly - * to learn the RAT / RTC offset, which useful to get accurate radio timestamps. - */ -uint8_t rf_core_stop_rat(void); - -/** - * \brief Restart the CM0 RAT - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - * - * This function restarts the CM0 RAT and therefore resynchornizes it with RTC. - * To achieve good timing accuracy, it should be called periodically. - */ -uint8_t rf_core_restart_rat(void); - -/** - * \brief Boot the RF Core - * \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR - * - * This function will perform the CM0 boot sequence. It will first power it up - * and then start the RAT. If a patch is required, then the mode driver must - * not call this function and perform the sequence manually, applying patches - * after boot and before calling rf_core_start_rat(). - * - * The function will return RF_CORE_CMD_ERROR if any of those steps fails. If - * the boot sequence fails to complete, the RF Core will be powered down. - */ -uint8_t rf_core_boot(void); - -/** - * \brief Setup RF core interrupts - */ -void rf_core_setup_interrupts(void); - -/** - * \brief Enable interrupt on command done. - * \param fg set true to enable irq on foreground command done and false for - * background commands or if not in ieee mode. - * - * This is used within TX routines in order to be able to sleep the CM3 and - * wake up after TX has finished - * - * \sa rf_core_cmd_done_dis() - */ -void rf_core_cmd_done_en(bool fg); - -/** - * \brief Disable the LAST_CMD_DONE and LAST_FG_CMD_DONE interrupts. - * - * This is used within TX routines after TX has completed - * - * \sa rf_core_cmd_done_en() - */ -void rf_core_cmd_done_dis(void); - -/** - * \brief Returns a pointer to the most recent proto-dependent Radio Op - * \return The pointer - * - * The RF Core driver will remember the most recent proto-dependent Radio OP - * issued, so that other modules can inspect its type and state at a subsequent - * stage. The assumption is that those commands will be issued by a function - * that will then return. The following commands will be "remembered" - * - * - All BLE Radio Ops (0x18nn) - * - All Prop Radio Ops (0x38nn) - * - IEEE BG Radio Ops (0x28nn) - * - * The following commands are assumed to be executed synchronously and will - * thus not be remembered by the core and not returned by this function: - * - * - Direct commands - * - Proto-independent commands (including Radio Ops and Immediate ones) - * - IEEE FG Radio Ops (0x2Cxx) - * - * This assumes that all commands will be sent to the radio using - * rf_core_send_cmd() - */ -rfc_radioOp_t *rf_core_get_last_radio_op(void); - -/** - * \brief Prepare a buffer to host a Radio Op - * \param buf A pointer to the buffer that will host the Radio Op - * \param len The buffer's length - * \param command The command ID - * - * The caller is responsible to allocate the buffer - * - * This function will not check whether the buffer is large enough to hold the - * command. This is the caller's responsibility - * - * This function will wipe out the buffer's contents. - */ -void rf_core_init_radio_op(rfc_radioOp_t *buf, uint16_t len, uint16_t command); - -/** - * \brief Register a primary mode for radio operation - * \param mode A pointer to the struct representing the mode - * - * A normal NESTACK_RADIO driver will normally register itself by calling - * this function during its own init(). - * - * \sa rf_core_primary_mode_t - */ -void rf_core_primary_mode_register(const rf_core_primary_mode_t *mode); - -/** - * \brief Abort the currently running primary radio op - */ -void rf_core_primary_mode_abort(void); - -/** - * \brief Abort the currently running primary radio op - */ -uint8_t rf_core_primary_mode_restore(void); - -/** - * \brief Initialize the RAT to RTC conversion machinery - */ -uint8_t rf_core_rat_init(void); - -/** - * \brief Check if RAT overflow has occured and increment the overflow counter if so - */ -uint8_t rf_core_check_rat_overflow(void); - -/** - * \brief Convert from RAT timestamp to rtimer ticks - */ -uint32_t rf_core_convert_rat_to_rtimer(uint32_t rat_timestamp); - -/*---------------------------------------------------------------------------*/ -#endif /* RF_CORE_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/rf-switch.h b/arch/cpu/cc26x0-cc13x0/rf-core/rf-switch.h deleted file mode 100644 index 8a701ba74..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/rf-switch.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup rf-core - * @{ - * - * \defgroup rf-switch RF Switch - * - * Header file for RF switch support - * - * @{ - * - * \file - * Header file with definitions related to RF switch support - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_SWITCH_H_ -#define RF_SWITCH_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -#ifdef RF_SWITCH_CONF_PATH_2_4GHZ -#define RF_SWITCH_PATH_2_4GHZ RF_SWITCH_CONF_PATH_2_4GHZ -#else -#define RF_SWITCH_PATH_2_4GHZ 0 -#endif - -#ifdef RF_SWITCH_CONF_PATH_SUBGHZ -#define RF_SWITCH_PATH_SUBGHZ RF_SWITCH_CONF_PATH_SUBGHZ -#else -#define RF_SWITCH_PATH_SUBGHZ 1 -#endif -/*---------------------------------------------------------------------------*/ -#ifdef RF_SWITCH_CONF_ENABLE -#define RF_SWITCH_ENABLE RF_SWITCH_CONF_ENABLE -#else -#define RF_SWITCH_ENABLE 0 -#endif -/*---------------------------------------------------------------------------*/ -#if RF_SWITCH_ENABLE -/** - * \brief Initialise RF switch pin states. - */ -void rf_switch_init(void); - -/** - * \brief Power up the RF switch. - */ -void rf_switch_power_up(void); - -/** - * \brief Power down the RF switch. - */ -void rf_switch_power_down(void); - -/** - * \brief Select RF path - * \param path The RF path to select on the switch. - * - * The path argument can take values RF_SWITCH_PATH_xyz - */ -void rf_switch_select_path(uint8_t path); -#else -#define rf_switch_init() -#define rf_switch_power_up() -#define rf_switch_power_down() -#define rf_switch_select_path(p) -#endif /* RF_SWITCH_ENABLE */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_SWITCH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/smartrf-settings.c b/arch/cpu/cc26x0-cc13x0/rf-core/smartrf-settings.c deleted file mode 100644 index fde936147..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/smartrf-settings.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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 "contiki.h" - -#include "rf-core/dot-15-4g.h" -#include "driverlib/rf_mailbox.h" -#include "driverlib/rf_common_cmd.h" -#include "driverlib/rf_prop_cmd.h" - -#include -/*---------------------------------------------------------------------------*/ -#ifdef SMARTRF_SETTINGS_CONF_BOARD_OVERRIDES -#define SMARTRF_SETTINGS_BOARD_OVERRIDES SMARTRF_SETTINGS_CONF_BOARD_OVERRIDES -#else -#define SMARTRF_SETTINGS_BOARD_OVERRIDES -#endif -/*---------------------------------------------------------------------------*/ -#ifdef SMARTRF_SETTINGS_CONF_BAND_OVERRIDES -#define SMARTRF_SETTINGS_BAND_OVERRIDES SMARTRF_SETTINGS_CONF_BAND_OVERRIDES -#else -#define SMARTRF_SETTINGS_BAND_OVERRIDES -#endif -/*---------------------------------------------------------------------------*/ -/* RSSI offset configuration for the 431-527MHz band */ -#ifdef SMARTRF_SETTINGS_CONF_RSSI_OFFSET_431_527 -#define SMARTRF_SETTINGS_RSSI_OFFSET_431_527 SMARTRF_SETTINGS_CONF_RSSI_OFFSET_431_527 -#else -#define SMARTRF_SETTINGS_RSSI_OFFSET_431_527 0x000288A3 -#endif -/*---------------------------------------------------------------------------*/ -/* RSSI offset configuration for the 779-930MHz band */ -#ifdef SMARTRF_SETTINGS_CONF_RSSI_OFFSET_779_930 -#define SMARTRF_SETTINGS_RSSI_OFFSET_779_930 SMARTRF_SETTINGS_CONF_RSSI_OFFSET_779_930 -#else -#define SMARTRF_SETTINGS_RSSI_OFFSET_779_930 0x00FB88A3 -#endif -/*---------------------------------------------------------------------------*/ -#ifdef SMARTRF_SETTINGS_CONF_OVERRIDE_TRIM_OFFSET -#define SMARTRF_SETTINGS_OVERRIDE_TRIM_OFFSET SMARTRF_SETTINGS_CONF_OVERRIDE_TRIM_OFFSET -#else -#define SMARTRF_SETTINGS_OVERRIDE_TRIM_OFFSET 0x00038883 -#endif -/*---------------------------------------------------------------------------*/ -/* Select RSSI offset value based on the frequency band */ -#if DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_470 -#define RSSI_OFFSET SMARTRF_SETTINGS_RSSI_OFFSET_431_527 -#else -#define RSSI_OFFSET SMARTRF_SETTINGS_RSSI_OFFSET_779_930 -#endif -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_PROP_RADIO_DIV_SETUP */ -static uint32_t overrides[] = -{ - /* - * override_use_patch_prop_genfsk.xml - * PHY: Use MCE ROM bank 4, RFE RAM patch - */ - MCE_RFE_OVERRIDE(0, 4, 0, 1, 0, 0), - /* - * override_synth_prop_863_930_div5.xml - * Synth: Set recommended RTRIM to 7 - */ - HW_REG_OVERRIDE(0x4038, 0x0037), - /* Synth: Set Fref to 4 MHz */ - (uint32_t)0x000684A3, - /* Synth: Configure fine calibration setting */ - HW_REG_OVERRIDE(0x4020, 0x7F00), - /* Synth: Configure fine calibration setting */ - HW_REG_OVERRIDE(0x4064, 0x0040), - /* Synth: Configure fine calibration setting */ - (uint32_t)0xB1070503, - /* Synth: Configure fine calibration setting */ - (uint32_t)0x05330523, - /* Synth: Set loop bandwidth after lock to 20 kHz */ - (uint32_t)0x0A480583, - /* Synth: Set loop bandwidth after lock to 20 kHz */ - (uint32_t)0x7AB80603, - /* - * Synth: Configure VCO LDO - * (in ADI1, set VCOLDOCFG=0x9F to use voltage input reference) - */ - ADI_REG_OVERRIDE(1, 4, 0x9F), - /* Synth: Configure synth LDO (in ADI1, set SLDOCTL0.COMP_CAP=1) */ - ADI_HALFREG_OVERRIDE(1, 7, 0x4, 0x4), - /* Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering */ - (uint32_t)0x02010403, - /* Synth: Configure extra PLL filtering */ - (uint32_t)0x00108463, - /* Synth: Increase synth programming timeout (0x04B0 RAT ticks = 300 us) */ - (uint32_t)0x04B00243, - /* - * override_phy_rx_aaf_bw_0xd.xml - * Rx: Set anti-aliasing filter bandwidth to 0xD - * (in ADI0, set IFAMPCTL3[7:4]=0xD) - */ - ADI_HALFREG_OVERRIDE(0, 61, 0xF, 0xD), - /* - * override_phy_gfsk_rx.xml - * Rx: Set LNA bias current trim offset. The board can override this - */ - (uint32_t)SMARTRF_SETTINGS_OVERRIDE_TRIM_OFFSET, - /* Rx: Freeze RSSI on sync found event */ - HW_REG_OVERRIDE(0x6084, 0x35F1), - /* - * override_phy_gfsk_pa_ramp_agc_reflevel_0x1a.xml - * Tx: Enable PA ramping (0x41). Rx: Set AGC reference level to 0x1A. - */ - HW_REG_OVERRIDE(0x6088, 0x411A), - /* Tx: Configure PA ramping setting */ - HW_REG_OVERRIDE(0x608C, 0x8213), - /* - * Rx: Set RSSI offset to adjust reported RSSI - * The board can override this - */ - (uint32_t)RSSI_OFFSET, - - /* - * TX power override - * Tx: Set PA trim to max (in ADI0, set PACTL0=0xF8) - */ - ADI_REG_OVERRIDE(0, 12, 0xF8), - - /* Overrides for CRC16 functionality */ - (uint32_t)0x943, - (uint32_t)0x963, - - /* Board-specific overrides, if any */ - SMARTRF_SETTINGS_BOARD_OVERRIDES - - /* Band-specific overrides, if any */ - SMARTRF_SETTINGS_BAND_OVERRIDES - - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_PROP_RADIO_DIV_SETUP */ -rfc_CMD_PROP_RADIO_DIV_SETUP_t smartrf_settings_cmd_prop_radio_div_setup = -{ - .commandNo = 0x3807, - .status = 0x0000, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = 0x0, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = 0x1, - .condition.nSkip = 0x0, - .modulation.modType = 0x1, - .modulation.deviation = 0x64, - .symbolRate.preScale = 0xf, - .symbolRate.rateWord = 0x8000, - .rxBw = 0x24, - .preamConf.nPreamBytes = 0x3, - .preamConf.preamMode = 0x0, - .formatConf.nSwBits = 0x18, - .formatConf.bBitReversal = 0x0, - .formatConf.bMsbFirst = 0x1, - .formatConf.fecMode = 0x0, - - /* 7: .4g mode with dynamic whitening and CRC choice */ - .formatConf.whitenMode = 0x7, - .config.frontEndMode = 0x00, /* Set by the driver */ - .config.biasMode = 0x00, /* Set by the driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = 0x00, /* Driver sets correct value */ - .pRegOverride = overrides, - .intFreq = 0x8000, - .centerFreq = 868, - .loDivider = 0x05, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_FS */ -rfc_CMD_FS_t smartrf_settings_cmd_fs = -{ - .commandNo = 0x0803, - .status = 0x0000, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = 0x0, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = 0x1, - .condition.nSkip = 0x0, - .frequency = 868, - .fractFreq = 0x0000, - .synthConf.bTxMode = 0x0, - .synthConf.refFreq = 0x0, - .__dummy0 = 0x00, - .__dummy1 = 0x00, - .__dummy2 = 0x00, - .__dummy3 = 0x0000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_PROP_TX_ADV */ -rfc_CMD_PROP_TX_ADV_t smartrf_settings_cmd_prop_tx_adv = -{ - .commandNo = 0x3803, - .status = 0x0000, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = 0x0, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = 0x1, - .condition.nSkip = 0x0, - .pktConf.bFsOff = 0x0, - .pktConf.bUseCrc = 0x1, - .pktConf.bCrcIncSw = 0x0, /* .4g mode */ - .pktConf.bCrcIncHdr = 0x0, /* .4g mode */ - .numHdrBits = 0x10 /* 16: .4g mode */, - .pktLen = 0x0000, - .startConf.bExtTxTrig = 0x0, - .startConf.inputMode = 0x0, - .startConf.source = 0x0, - .preTrigger.triggerType = TRIG_REL_START, - .preTrigger.bEnaCmd = 0x0, - .preTrigger.triggerNo = 0x0, - .preTrigger.pastTrig = 0x1, - .preTime = 0x00000000, - .syncWord = 0x0055904e, - .pPkt = 0, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_PROP_RX_ADV */ -rfc_CMD_PROP_RX_ADV_t smartrf_settings_cmd_prop_rx_adv = -{ - .commandNo = 0x3804, - .status = 0x0000, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = 0x0, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = 0x1, - .condition.nSkip = 0x0, - .pktConf.bFsOff = 0x0, - .pktConf.bRepeatOk = 0x1, - .pktConf.bRepeatNok = 0x1, - .pktConf.bUseCrc = 0x1, - .pktConf.bCrcIncSw = 0x0, /* .4g mode */ - .pktConf.bCrcIncHdr = 0x0, /* .4g mode */ - .pktConf.endType = 0x0, - .pktConf.filterOp = 0x1, - .rxConf.bAutoFlushIgnored = 0x1, - .rxConf.bAutoFlushCrcErr = 0x1, - .rxConf.bIncludeHdr = 0x0, - .rxConf.bIncludeCrc = 0x0, - .rxConf.bAppendRssi = 0x1, - .rxConf.bAppendTimestamp = 0x0, - .rxConf.bAppendStatus = 0x1, - .syncWord0 = 0x0055904e, - .syncWord1 = 0x00000000, - .maxPktLen = 0x0000, /* To be populated by the driver. */ - .hdrConf.numHdrBits = 0x10, /* 16: .4g mode */ - .hdrConf.lenPos = 0x0, /* .4g mode */ - .hdrConf.numLenBits = 0x0B, /* 11 = 0x0B .4g mode */ - .addrConf.addrType = 0x0, - .addrConf.addrSize = 0x0, - .addrConf.addrPos = 0x0, - .addrConf.numAddr = 0x0, - .lenOffset = -4, /* .4g mode */ - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, - .pAddr = 0, - .pQueue = 0, - .pOutput = 0, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc26x0-cc13x0/rf-core/smartrf-settings.h b/arch/cpu/cc26x0-cc13x0/rf-core/smartrf-settings.h deleted file mode 100644 index 483f47a7c..000000000 --- a/arch/cpu/cc26x0-cc13x0/rf-core/smartrf-settings.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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 SMARTRF_SETTINGS_H_ -#define SMARTRF_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include "driverlib/rf_mailbox.h" -#include "driverlib/rf_common_cmd.h" -#include "driverlib/rf_prop_cmd.h" -/*---------------------------------------------------------------------------*/ -extern rfc_CMD_PROP_RADIO_DIV_SETUP_t smartrf_settings_cmd_prop_radio_div_setup; -extern rfc_CMD_FS_t smartrf_settings_cmd_fs; -extern rfc_CMD_PROP_TX_ADV_t smartrf_settings_cmd_prop_tx_adv; -extern rfc_CMD_PROP_RX_ADV_t smartrf_settings_cmd_prop_rx_adv; -/*---------------------------------------------------------------------------*/ -#endif // SMARTRF_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc26x0-cc13x0/rtimer-arch.c b/arch/cpu/cc26x0-cc13x0/rtimer-arch.c deleted file mode 100644 index 6d0505f47..000000000 --- a/arch/cpu/cc26x0-cc13x0/rtimer-arch.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-rtimer - * @{ - * - * \file - * Implementation of the arch-specific rtimer functions for the CC13xx/CC26xx - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/energest.h" -#include "sys/rtimer.h" -#include "cpu.h" -#include "dev/soc-rtc.h" - -#include "ti-lib.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief We don't need to do anything special here. The RTC is initialised - * elsewhere - */ -void -rtimer_arch_init(void) -{ - return; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Schedules an rtimer task to be triggered at time t - * \param t The time when the task will need executed. - * - * \e t is an absolute time, in other words the task will be executed AT - * time \e t, not IN \e t rtimer ticks. - * - * This function schedules a one-shot event with the AON RTC. - * - * This functions converts \e to a value suitable for the AON RTC. - */ -void -rtimer_arch_schedule(rtimer_clock_t t) -{ - /* Convert the rtimer tick value to a value suitable for the AON RTC */ - soc_rtc_schedule_one_shot(AON_RTC_CH0, t); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the current real-time clock time - * \return The current rtimer time in ticks - * - * The value is read from the AON RTC counter and converted to a number of - * rtimer ticks - * - */ -rtimer_clock_t -rtimer_arch_now() -{ - return ti_lib_aon_rtc_current_compare_value_get(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/cc26x0-cc13x0/rtimer-arch.h b/arch/cpu/cc26x0-cc13x0/rtimer-arch.h deleted file mode 100644 index c6907ee59..000000000 --- a/arch/cpu/cc26x0-cc13x0/rtimer-arch.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-clocks - * @{ - * - * \defgroup cc26xx-rtimer CC13xx/CC26xx rtimer - * - * Implementation of the rtimer module for the CC13xx/CC26xx - * @{ - */ -/** - * \file - * Header file for the CC13xx/CC26xx rtimer driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef RTIMER_ARCH_H_ -#define RTIMER_ARCH_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -rtimer_clock_t rtimer_arch_now(void); - -/* HW oscillator frequency is 32 kHz, not 64 kHz and RTIMER_NOW() never returns - * an odd value; so US_TO_RTIMERTICKS always rounds to the nearest even number. - */ -#define US_TO_RTIMERTICKS(US) (2 * ((US) >= 0 ? \ - (((int32_t)(US) * (RTIMER_ARCH_SECOND / 2) + 500000) / 1000000L) : \ - ((int32_t)(US) * (RTIMER_ARCH_SECOND / 2) - 500000) / 1000000L)) - -#define RTIMERTICKS_TO_US(T) ((T) >= 0 ? \ - (((int32_t)(T) * 1000000L + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) : \ - ((int32_t)(T) * 1000000L - ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) - -/* A 64-bit version because the 32-bit one cannot handle T >= 4295 ticks. - Intended only for positive values of T. */ -#define RTIMERTICKS_TO_US_64(T) ((uint32_t)(((uint64_t)(T) * 1000000 + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND))) -/*---------------------------------------------------------------------------*/ -#endif /* RTIMER_ARCH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/cc26x0-cc13x0/slip-arch.c b/arch/cpu/cc26x0-cc13x0/slip-arch.c deleted file mode 100644 index f4141e11d..000000000 --- a/arch/cpu/cc26x0-cc13x0/slip-arch.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 "contiki.h" -#include "dev/cc26xx-uart.h" -#include "dev/slip.h" -/*---------------------------------------------------------------------------*/ -void -slip_arch_writeb(unsigned char c) -{ - cc26xx_uart_write_byte(c); -} -/*---------------------------------------------------------------------------*/ -void -slip_arch_init() -{ - /* - * Enable an input handler. In doing so, the driver will make sure that UART - * RX stays operational during deep sleep - */ - cc26xx_uart_set_input(slip_input_byte); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc26x0-cc13x0/ti-lib.h b/arch/cpu/cc26x0-cc13x0/ti-lib.h deleted file mode 100644 index 0d8400813..000000000 --- a/arch/cpu/cc26x0-cc13x0/ti-lib.h +++ /dev/null @@ -1,588 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-ti-lib TI CC26xxware/CC13xxware Glue - * - * Glue file which renames TI CC26xxware functions. Thus, for example, - * PowerCtrlIOFreezeDisable() becomes power_ctrl_io_freeze_disable() - * - * This is not strictly required and a call to the former will work perfectly - * correctly. However, in using those macros, we make the core of the Contiki - * port match the naming convention. - * - * Since all functions are prefixed with ti_lib, it also becomes clear to the - * reader that this is a call to TI driverlib's sources and not a call to a - * function inside Contiki - * - * @{ - * - * \file - * Header file with macros which rename TI CC26xxware functions. - */ -#ifndef TI_LIB_H_ -#define TI_LIB_H_ -/*---------------------------------------------------------------------------*/ -/* aon_batmon.h */ -#include "driverlib/aon_batmon.h" - -#define ti_lib_aon_batmon_enable(...) AONBatMonEnable(__VA_ARGS__) -#define ti_lib_aon_batmon_disable(...) AONBatMonDisable(__VA_ARGS__) -#define ti_lib_aon_batmon_temperature_get_deg_c(...) AONBatMonTemperatureGetDegC(__VA_ARGS__) -#define ti_lib_aon_batmon_battery_voltage_get(...) AONBatMonBatteryVoltageGet(__VA_ARGS__) -#define ti_lib_aon_batmon_new_battery_measure_ready(...) AONBatMonNewBatteryMeasureReady(__VA_ARGS__) -#define ti_lib_aon_batmon_new_temp_measure_ready(...) AONBatMonNewTempMeasureReady(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* aon_event.h */ -#include "driverlib/aon_event.h" - -#define ti_lib_aon_event_mcu_wake_up_set(...) AONEventMcuWakeUpSet(__VA_ARGS__) -#define ti_lib_aon_event_mcu_wake_up_get(...) AONEventMcuWakeUpGet(__VA_ARGS__) -#define ti_lib_aon_event_aux_wake_up_set(...) AONEventAuxWakeUpSet(__VA_ARGS__) -#define ti_lib_aon_event_aux_wake_up_get(...) AONEventAuxWakeUpGet(__VA_ARGS__) -#define ti_lib_aon_event_mcu_set(...) AONEventMcuSet(__VA_ARGS__) -#define ti_lib_aon_event_mcu_get(...) AONEventMcuGet(__VA_ARGS__) -#define ti_lib_aon_event_rtc_set(...) AONEventRtcSet(__VA_ARGS__) -#define ti_lib_aon_event_rtc_get(...) AONEventRtcGet(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* aon_ioc.h */ -#include "driverlib/aon_ioc.h" - -#define ti_lib_aon_ioc_drive_strength_set(...) AONIOCDriveStrengthSet(__VA_ARGS__) -#define ti_lib_aon_ioc_drive_strength_get(...) AONIOCDriveStrengthGet(__VA_ARGS__) -#define ti_lib_aon_ioc_freeze_enable(...) AONIOCFreezeEnable(__VA_ARGS__) -#define ti_lib_aon_ioc_freeze_disable(...) AONIOCFreezeDisable(__VA_ARGS__) -#define ti_lib_aon_ioc_32_khz_output_disable(...) AONIOC32kHzOutputDisable(__VA_ARGS__) -#define ti_lib_aon_ioc_32_khz_output_enable(...) AONIOC32kHzOutputEnable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* aon_rtc.h */ -#include "driverlib/aon_rtc.h" - -#define ti_lib_aon_rtc_enable(...) AONRTCEnable(__VA_ARGS__) -#define ti_lib_aon_rtc_disable(...) AONRTCDisable(__VA_ARGS__) -#define ti_lib_aon_rtc_active(...) AONRTCActive(__VA_ARGS__) -#define ti_lib_aon_rtc_channel_active(...) AONRTCChannelActive(__VA_ARGS__) -#define ti_lib_aon_rtc_reset(...) AONRTCReset(__VA_ARGS__) -#define ti_lib_aon_rtc_delay_config(...) AONRTCDelayConfig(__VA_ARGS__) -#define ti_lib_aon_rtc_combined_event_config(...) AONRTCCombinedEventConfig(__VA_ARGS__) -#define ti_lib_aon_rtc_event_clear(...) AONRTCEventClear(__VA_ARGS__) -#define ti_lib_aon_rtc_event_get(...) AONRTCEventGet(__VA_ARGS__) -#define ti_lib_aon_rtc_sec_get(...) AONRTCSecGet(__VA_ARGS__) -#define ti_lib_aon_rtc_fraction_get(...) AONRTCFractionGet(__VA_ARGS__) -#define ti_lib_aon_rtc_sub_sec_incr_get(...) AONRTCSubSecIncrGet(__VA_ARGS__) -#define ti_lib_aon_rtc_mode_ch1_set(...) AONRTCModeCh1Set(__VA_ARGS__) -#define ti_lib_aon_rtc_mode_ch1_get(...) AONRTCModeCh1Get(__VA_ARGS__) -#define ti_lib_aon_rtc_mode_ch2_set(...) AONRTCModeCh2Set(__VA_ARGS__) -#define ti_lib_aon_rtc_mode_ch2_get(...) AONRTCModeCh2Get(__VA_ARGS__) -#define ti_lib_aon_rtc_channel_enable(...) AONRTCChannelEnable(__VA_ARGS__) -#define ti_lib_aon_rtc_channel_disable(...) AONRTCChannelDisable(__VA_ARGS__) -#define ti_lib_aon_rtc_compare_value_set(...) AONRTCCompareValueSet(__VA_ARGS__) -#define ti_lib_aon_rtc_compare_value_get(...) AONRTCCompareValueGet(__VA_ARGS__) -#define ti_lib_aon_rtc_current_compare_value_get(...) AONRTCCurrentCompareValueGet(__VA_ARGS__) -#define ti_lib_aon_rtc_current_64_bit_value_get(...) AONRTCCurrent64BitValueGet(__VA_ARGS__) -#define ti_lib_aon_rtc_inc_value_ch2_set(...) AONRTCIncValueCh2Set(__VA_ARGS__) -#define ti_lib_aon_rtc_inc_value_ch2_get(...) AONRTCIncValueCh2Get(__VA_ARGS__) -#define ti_lib_aon_rtc_capture_value_ch1_get(...) AONRTCCaptureValueCh1Get(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* aon_wuc.h */ -#include "driverlib/aon_wuc.h" - -#define ti_lib_aon_wuc_mcu_wake_up_config(...) AONWUCMcuWakeUpConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_power_down_config(...) AONWUCMcuPowerDownConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_power_off_config(...) AONWUCMcuPowerOffConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_sram_config(...) AONWUCMcuSRamConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_clock_config_get(...) AONWUCAuxClockConfigGet(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_power_down_config(...) AONWUCAuxPowerDownConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_wake_up_config(...) AONWUCAuxWakeUpConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_sram_config(...) AONWUCAuxSRamConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_wakeup_event(...) AONWUCAuxWakeupEvent(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_image_valid(...) AONWUCAuxImageValid(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_image_invalid(...) AONWUCAuxImageInvalid(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_reset(...) AONWUCAuxReset(__VA_ARGS__) -#define ti_lib_aon_wuc_power_status_get(...) AONWUCPowerStatusGet(__VA_ARGS__) -#define ti_lib_aon_wuc_shut_down_enable(...) AONWUCShutDownEnable(__VA_ARGS__) -#define ti_lib_aon_wuc_domain_power_down_enable(...) AONWUCDomainPowerDownEnable(__VA_ARGS__) -#define ti_lib_aon_wuc_domain_power_down_disable(...) AONWUCDomainPowerDownDisable(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_reset_status_get(...) AONWUCMcuResetStatusGet(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_reset_clear(...) AONWUCMcuResetClear(__VA_ARGS__) -#define ti_lib_aon_wuc_recharge_ctrl_config_set(...) AONWUCRechargeCtrlConfigSet(__VA_ARGS__) -#define ti_lib_aon_wuc_recharge_ctrl_config_get(...) AONWUCRechargeCtrlConfigGet(__VA_ARGS__) -#define ti_lib_aon_wuc_osc_config(...) AONWUCOscConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_jtag_power_off(...) AONWUCJtagPowerOff(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* aux_adc.h */ -#include "driverlib/aux_adc.h" - -#define ti_lib_aux_adc_disable(...) AUXADCDisable(__VA_ARGS__) -#define ti_lib_aux_adc_enable_async(...) AUXADCEnableAsync(__VA_ARGS__) -#define ti_lib_aux_adc_enable_sync(...) AUXADCEnableSync(__VA_ARGS__) -#define ti_lib_aux_adc_disable_input_scaling(...) AUXADCDisableInputScaling(__VA_ARGS__) -#define ti_lib_aux_adc_flush_fifo(...) AUXADCFlushFifo(__VA_ARGS__) -#define ti_lib_aux_adc_gen_manual_trigger(...) AUXADCGenManualTrigger(__VA_ARGS__) -#define ti_lib_aux_adc_get_fifo_status(...) AUXADCGetFifoStatus(__VA_ARGS__) -#define ti_lib_aux_adc_read_fifo(...) AUXADCReadFifo(__VA_ARGS__) -#define ti_lib_aux_adc_pop_fifo(...) AUXADCPopFifo(__VA_ARGS__) -#define ti_lib_aux_adc_select_input(...) AUXADCSelectInput(__VA_ARGS__) -#define ti_lib_aux_adc_get_adjustment_gain(...) AUXADCGetAdjustmentGain(__VA_ARGS__) -#define ti_lib_aux_adc_get_adjustment_offset(...) AUXADCGetAdjustmentOffset(__VA_ARGS__) -#define ti_lib_aux_adc_value_to_microvolts(...) AUXADCValueToMicrovolts(__VA_ARGS__) -#define ti_lib_aux_adc_microvolts_to_value(...) AUXADCMicrovoltsToValue(__VA_ARGS__) -#define ti_lib_aux_adc_adjust_value_for_gain_and_offset(...) AUXADCAdjustValueForGainAndOffset(__VA_ARGS__) -#define ti_lib_aux_adc_unadjust_value_for_gain_and_offset(...) AUXADCUnadjustValueForGainAndOffset(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* aux_wuc.h */ -#include "driverlib/aux_wuc.h" - -#define ti_lib_aux_wuc_clock_enable(...) AUXWUCClockEnable(__VA_ARGS__) -#define ti_lib_aux_wuc_clock_disable(...) AUXWUCClockDisable(__VA_ARGS__) -#define ti_lib_aux_wuc_clock_status(...) AUXWUCClockStatus(__VA_ARGS__) -#define ti_lib_aux_wuc_clock_freq_req(...) AUXWUCClockFreqReq(__VA_ARGS__) -#define ti_lib_aux_wuc_power_ctrl(...) AUXWUCPowerCtrl(__VA_ARGS__) -#define ti_lib_aux_wuc_freeze_enable(...) AUXWUCFreezeEnable(__VA_ARGS__) -#define ti_lib_aux_wuc_freeze_disable(...) AUXWUCFreezeDisable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* cpu.h */ -#include "driverlib/cpu.h" - -#define ti_lib_cpu_cpsid(...) CPUcpsid(__VA_ARGS__) -#define ti_lib_cpu_cpsie(...) CPUcpsie(__VA_ARGS__) -#define ti_lib_cpu_primask(...) CPUprimask(__VA_ARGS__) -#define ti_lib_cpu_wfi(...) CPUwfi(__VA_ARGS__) -#define ti_lib_cpu_wfe(...) CPUwfe(__VA_ARGS__) -#define ti_lib_cpu_sev(...) CPUsev(__VA_ARGS__) -#define ti_lib_cpu_base_pri_get(...) CPUbasepriGet(__VA_ARGS__) -#define ti_lib_cpu_base_pri_set(...) CPUbasepriSet(__VA_ARGS__) -#define ti_lib_cpu_delay(...) CPUdelay(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* chipinfo.h */ -#include "driverlib/chipinfo.h" - -#define ti_lib_chipinfo_get_supported_protocol_bv(...) ChipInfo_GetSupportedProtocol_BV(__VA_ARGS__) -#define ti_lib_chipinfo_supports_ble(...) ChipInfo_SupportsBLE(__VA_ARGS__) -#define ti_lib_chipinfo_supports_ieee_802_15_4(...) ChipInfo_SupportsIEEE_802_15_4(__VA_ARGS__) -#define ti_lib_chipinfo_supports_proprietary(...) ChipInfo_SupportsPROPRIETARY(__VA_ARGS__) -#define ti_lib_chipinfo_get_package_type(...) ChipInfo_GetPackageType(__VA_ARGS__) -#define ti_lib_chipinfo_package_type_is_4x4(...) ChipInfo_PackageTypeIs4x4(__VA_ARGS__) -#define ti_lib_chipinfo_package_type_is_5x5(...) ChipInfo_PackageTypeIs5x5(__VA_ARGS__) -#define ti_lib_chipinfo_package_type_is_7x7(...) ChipInfo_PackageTypeIs7x7(__VA_ARGS__) -#define ti_lib_chipinfo_get_device_id_hw_rev_code(...) ChipInfo_GetDeviceIdHwRevCode(__VA_ARGS__) -#define ti_lib_chipinfo_get_chip_type(...) ChipInfo_GetChipType(__VA_ARGS__) -#define ti_lib_chipinfo_get_chip_family(...) ChipInfo_GetChipFamily(__VA_ARGS__) - -#if CPU_FAMILY_CC26X0R2 -#define ti_lib_chipinfo_chip_family_is_cc26xx(...) ChipInfo_ChipFamilyIs_CC26x0(__VA_ARGS__) -#define ti_lib_chipinfo_chip_family_is_cc13xx(...) ChipInfo_ChipFamilyIs_CC13x0(__VA_ARGS__) -#define ti_lib_chipinfo_chip_family_is_cc26x0r2(...) ChipInfo_ChipFamilyIs_CC26x0R2(__VA_ARGS__) -#else -#define ti_lib_chipinfo_chip_family_is_cc26xx(...) ChipInfo_ChipFamilyIsCC26xx(__VA_ARGS__) -#define ti_lib_chipinfo_chip_family_is_cc13xx(...) ChipInfo_ChipFamilyIsCC13xx(__VA_ARGS__) -#endif /* CPU_FAMILY_CC26X0R2 */ - -#define ti_lib_chipinfo_get_hw_revision(...) ChipInfo_GetHwRevision(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_1_0(...) ChipInfo_HwRevisionIs_1_0(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_gteq_2_0(...) ChipInfo_HwRevisionIs_GTEQ_2_0(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_2_0(...) ChipInfo_HwRevisionIs_2_0(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_2_1(...) ChipInfo_HwRevisionIs_2_1(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_2_2(...) ChipInfo_HwRevisionIs_2_2(__VA_ARGS__) -#define ti_lib_chipinfo_hw_revision_is_gteq_2_2(...) ChipInfo_HwRevisionIs_GTEQ_2_2( __VA_ARGS__ ) -/*---------------------------------------------------------------------------*/ -/* ddi.h */ -#include "driverlib/ddi.h" - -#define ti_lib_aux_adi_ddi_safe_write(...) AuxAdiDdiSafeWrite(__VA_ARGS__) -#define ti_lib_aux_adi_ddi_safe_read(...) AuxAdiDdiSafeRead(__VA_ARGS__) -#define ti_lib_ddi_32_reg_write(...) DDI32RegWrite(__VA_ARGS__) -#define ti_lib_ddi_32_reg_read(...) DDI32RegRead(__VA_ARGS__) -#define ti_lib_ddi_32_bits_set(...) DDI32BitsSet(__VA_ARGS__) -#define ti_lib_ddi_32_bits_clear(...) DDI32BitsClear(__VA_ARGS__) -#define ti_lib_ddi_8_set_val_bit(...) DDI8SetValBit(__VA_ARGS__) -#define ti_lib_ddi_16_set_val_bit(...) DDI16SetValBit(__VA_ARGS__) -#define ti_lib_ddi_16_bit_write(...) DDI16BitWrite(__VA_ARGS__) -#define ti_lib_ddi_16_bit_field_write(...) DDI16BitfieldWrite(__VA_ARGS__) -#define ti_lib_ddi_16_bit_read(...) DDI16BitRead(__VA_ARGS__) -#define ti_lib_ddi_16_bitfield_read(...) DDI16BitfieldRead(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* gpio.h */ -#include "driverlib/gpio.h" - -#define ti_lib_gpio_read_dio(...) GPIO_readDio(__VA_ARGS__) -#define ti_lib_gpio_read_multi_dio(...) GPIO_readMultiDio(__VA_ARGS__) -#define ti_lib_gpio_write_dio(...) GPIO_writeDio(__VA_ARGS__) -#define ti_lib_gpio_write_multi_dio(...) GPIO_writeMultiDio(__VA_ARGS__) -#define ti_lib_gpio_set_dio(...) GPIO_setDio(__VA_ARGS__) -#define ti_lib_gpio_set_multi_dio(...) GPIO_setMultiDio(__VA_ARGS__) -#define ti_lib_gpio_clear_dio(...) GPIO_clearDio(__VA_ARGS__) -#define ti_lib_gpio_clear_multi_dio(...) GPIO_clearMultiDio(__VA_ARGS__) -#define ti_lib_gpio_toggle_dio(...) GPIO_toggleDio(__VA_ARGS__) -#define ti_lib_gpio_toggle_multi_dio(...) GPIO_toggleMultiDio(__VA_ARGS__) -#define ti_lib_gpio_get_output_enable_dio(...) GPIO_getOutputEnableDio(__VA_ARGS__) -#define ti_lib_gpio_get_output_enable_multi_dio(...) GPIO_getOutputEnableMultiDio(__VA_ARGS__) -#define ti_lib_gpio_set_output_enable_dio(...) GPIO_setOutputEnableDio(__VA_ARGS__) -#define ti_lib_gpio_set_output_enable_multi_dio(...) GPIO_setOutputEnableMultiDio(__VA_ARGS__) -#define ti_lib_gpio_get_event_dio(...) GPIO_getEventDio(__VA_ARGS__) -#define ti_lib_gpio_get_event_multi_dio(...) GPIO_getEventMultiDio(__VA_ARGS__) -#define ti_lib_gpio_clear_event_dio(...) GPIO_clearEventDio(__VA_ARGS__) -#define ti_lib_gpio_clear_event_multi_dio(...) GPIO_clearEventMultiDio(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* i2c.h */ -#include "driverlib/i2c.h" - -#define ti_lib_i2c_int_register(...) I2CIntRegister(__VA_ARGS__) -#define ti_lib_i2c_int_unregister(...) I2CIntUnregister(__VA_ARGS__) -#define ti_lib_i2c_master_bus_busy(...) I2CMasterBusBusy(__VA_ARGS__) -#define ti_lib_i2c_master_busy(...) I2CMasterBusy(__VA_ARGS__) -#define ti_lib_i2c_master_control(...) I2CMasterControl(__VA_ARGS__) -#define ti_lib_i2c_master_data_get(...) I2CMasterDataGet(__VA_ARGS__) -#define ti_lib_i2c_master_data_put(...) I2CMasterDataPut(__VA_ARGS__) -#define ti_lib_i2c_master_disable(...) I2CMasterDisable(__VA_ARGS__) -#define ti_lib_i2c_master_enable(...) I2CMasterEnable(__VA_ARGS__) -#define ti_lib_i2c_master_err(...) I2CMasterErr(__VA_ARGS__) -#define ti_lib_i2c_master_init_exp_clk(...) I2CMasterInitExpClk(__VA_ARGS__) -#define ti_lib_i2c_master_int_clear(...) I2CMasterIntClear(__VA_ARGS__) -#define ti_lib_i2c_master_int_disable(...) I2CMasterIntDisable(__VA_ARGS__) -#define ti_lib_i2c_master_int_enable(...) I2CMasterIntEnable(__VA_ARGS__) -#define ti_lib_i2c_master_int_status(...) I2CMasterIntStatus(__VA_ARGS__) -#define ti_lib_i2c_master_slave_addr_set(...) I2CMasterSlaveAddrSet(__VA_ARGS__) -#define ti_lib_i2c_slave_data_get(...) I2CSlaveDataGet(__VA_ARGS__) -#define ti_lib_i2c_slave_data_put(...) I2CSlaveDataPut(__VA_ARGS__) -#define ti_lib_i2c_slave_disable(...) I2CSlaveDisable(__VA_ARGS__) -#define ti_lib_i2c_slave_enable(...) I2CSlaveEnable(__VA_ARGS__) -#define ti_lib_i2c_slave_init(...) I2CSlaveInit(__VA_ARGS__) -#define ti_lib_i2c_slave_address_set(...) I2CSlaveAddressSet(__VA_ARGS__) -#define ti_lib_i2c_slave_int_clear(...) I2CSlaveIntClear(__VA_ARGS__) -#define ti_lib_i2c_slave_int_disable(...) I2CSlaveIntDisable(__VA_ARGS__) -#define ti_lib_i2c_slave_int_enable(...) I2CSlaveIntEnable(__VA_ARGS__) -#define ti_lib_i2c_slave_int_status(...) I2CSlaveIntStatus(__VA_ARGS__) -#define ti_lib_i2c_slave_status(...) I2CSlaveStatus(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* interrupt.h */ -#include "driverlib/interrupt.h" - -#define ti_lib_int_master_enable(...) IntMasterEnable(__VA_ARGS__) -#define ti_lib_int_master_disable(...) IntMasterDisable(__VA_ARGS__) -#define ti_lib_int_register(...) IntRegister(__VA_ARGS__); -#define ti_lib_int_unregsiter(...) IntUnregister(__VA_ARGS__) -#define ti_lib_int_priority_grouping_set(...) IntPriorityGroupingSet(__VA_ARGS__) -#define ti_lib_int_priority_grouping_get(...) IntPriorityGroupingGet(__VA_ARGS__) -#define ti_lib_int_priority_set(...) IntPrioritySet(__VA_ARGS__) -#define ti_lib_int_priority_get(...) IntPriorityGet(__VA_ARGS__) -#define ti_lib_int_enable(...) IntEnable(__VA_ARGS__) -#define ti_lib_int_disable(...) IntDisable(__VA_ARGS__) -#define ti_lib_int_pend_set(...) IntPendSet(__VA_ARGS__) -#define ti_lib_int_pend_get(...) IntPendGet(__VA_ARGS__) -#define ti_lib_int_pend_clear(...) IntPendClear(__VA_ARGS__) -#define ti_lib_int_mask_set(...) IntPriorityMaskSet(__VA_ARGS__) -#define ti_lib_int_mask_get(...) IntPriorityMaskGet(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* ioc.h */ -#include "driverlib/ioc.h" - -#define ti_lib_ioc_port_configure_set(...) IOCPortConfigureSet(__VA_ARGS__) -#define ti_lib_ioc_port_configure_get(...) IOCPortConfigureGet(__VA_ARGS__) -#define ti_lib_ioc_io_shutdown_set(...) IOCIOShutdownSet(__VA_ARGS__) -#define ti_lib_ioc_io_mode_set(...) IOCIOModeSet(__VA_ARGS__) -#define ti_lib_ioc_io_port_pull_set(...) IOCIOPortPullSet(__VA_ARGS__) -#define ti_lib_ioc_io_hyst_set(...) IOCIOHystSet(__VA_ARGS__) -#define ti_lib_ioc_io_input_set(...) IOCIOInputSet(__VA_ARGS__) -#define ti_lib_ioc_io_slew_ctrl_set(...) IOCIOSlewCtrlSet(__VA_ARGS__) -#define ti_lib_ioc_io_drv_strength_set(...) IOCIODrvStrengthSet(__VA_ARGS__) -#define ti_lib_ioc_io_port_id_set(...) IOCIOPortIdSet(__VA_ARGS__) -#define ti_lib_ioc_io_int_set(...) IOCIOIntSet(__VA_ARGS__) -#define ti_lib_ioc_int_register(...) IOCIntRegister(__VA_ARGS__); -#define ti_lib_ioc_int_unregister(...) IOCIntUnregister(__VA_ARGS__) -#define ti_lib_ioc_int_enable(...) IOCIntEnable(__VA_ARGS__) -#define ti_lib_ioc_int_disable(...) IOCIntDisable(__VA_ARGS__) -#define ti_lib_ioc_int_clear(...) IOCIntClear(__VA_ARGS__) -#define ti_lib_ioc_int_status(...) IOCIntStatus(__VA_ARGS__) -#define ti_lib_ioc_pin_type_gpio_input(...) IOCPinTypeGpioInput(__VA_ARGS__) -#define ti_lib_ioc_pin_type_gpio_output(...) IOCPinTypeGpioOutput(__VA_ARGS__) -#define ti_lib_ioc_pin_type_uart(...) IOCPinTypeUart(__VA_ARGS__) -#define ti_lib_ioc_pin_type_ssi_master(...) IOCPinTypeSsiMaster(__VA_ARGS__) -#define ti_lib_ioc_pin_type_ssi_slave(...) IOCPinTypeSsiSlave(__VA_ARGS__) -#define ti_lib_ioc_pin_type_i2c(...) IOCPinTypeI2c(__VA_ARGS__) -#define ti_lib_ioc_pin_type_aux(...) IOCPinTypeAux(__VA_ARGS__) -#define ti_lib_ioc_pin_type_spis(...) IOCPinTypeSpis(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* osc.h */ -#include "driverlib/osc.h" - -#define ti_lib_osc_xhf_power_mode_set(...) OSCXHfPowerModeSet(__VA_ARGS__) -#define ti_lib_osc_clock_loss_event_enable(...) OSCClockLossEventEnable(__VA_ARGS__) -#define ti_lib_osc_clock_loss_event_disable(...) OSCClockLossEventDisable(__VA_ARGS__) -#define ti_lib_osc_clock_source_set(...) OSCClockSourceSet(__VA_ARGS__) -#define ti_lib_osc_clock_source_get(...) OSCClockSourceGet(__VA_ARGS__) -#define ti_lib_osc_hf_source_ready(...) OSCHfSourceReady(__VA_ARGS__) -#define ti_lib_osc_hf_source_switch(...) OSCHfSourceSwitch(__VA_ARGS__) -#define ti_lib_osc_hf_get_startup_time(...) OSCHF_GetStartupTime(__VA_ARGS__) -#define ti_lib_osc_hf_turn_on_xosc(...) OSCHF_TurnOnXosc(__VA_ARGS__) -#define ti_lib_osc_hf_attempt_to_switch_to_xosc(...) OSCHF_AttemptToSwitchToXosc(__VA_ARGS__) -#define ti_lib_osc_hf_debug_get_crystal_amplitude(...) OSCHF_DebugGetCrystalAmplitude(__VA_ARGS__) -#define ti_lib_osc_hf_debug_get_expected_average_crystal_amplitude(...) \ - OSCHF_DebugGetExpectedAverageCrystalAmplitude(__VA_ARGS__) -#define ti_lib_osc_hposc_relative_frequency_offset_get(...) \ - OSC_HPOSCRelativeFrequencyOffsetGet(__VA_ARGS__) -#define ti_lib_osc_hposc_relative_frequency_offset_to_rf_core_format_convert(...) \ - OSC_HPOSCRelativeFrequencyOffsetToRFCoreFormatConvert(__VA_ARGS__) -#define ti_lib_osc_hf_switch_to_rc_osc_turn_off_xosc(...) OSCHF_SwitchToRcOscTurnOffXosc(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* prcm.h */ -#include "driverlib/prcm.h" - -#define ti_lib_prcm_inf_clock_configure_set(...) PRCMInfClockConfigureSet(__VA_ARGS__) -#define ti_lib_prcm_inf_clock_configure_get(...) PRCMInfClockConfigureGet(__VA_ARGS__) -#define ti_lib_prcm_mcu_power_off(...) PRCMMcuPowerOff(__VA_ARGS__) -#define ti_lib_prcm_mcu_power_off_cancel(...) PRCMMcuPowerOffCancel(__VA_ARGS__) -#define ti_lib_prcm_mcu_uldo_configure(...) PRCMMcuUldoConfigure(__VA_ARGS__) -#define ti_lib_prcm_audio_clock_enable(...) PRCMAudioClockEnable(__VA_ARGS__) -#define ti_lib_prcm_audio_clock_disable(...) PRCMAudioClockDisable(__VA_ARGS__) -#define ti_lib_prcm_audio_clock_config_set(...) PRCMAudioClockConfigSet(__VA_ARGS__) -#define ti_lib_prcm_load_set(...) PRCMLoadSet(__VA_ARGS__) -#define ti_lib_prcm_load_get(...) PRCMLoadGet(__VA_ARGS__) -#define ti_lib_prcm_domain_enable(...) PRCMDomainEnable(__VA_ARGS__) -#define ti_lib_prcm_domain_disable(...) PRCMDomainDisable(__VA_ARGS__) -#define ti_lib_prcm_power_domain_on(...) PRCMPowerDomainOn(__VA_ARGS__) -#define ti_lib_prcm_power_domain_off(...) PRCMPowerDomainOff(__VA_ARGS__) -#define ti_lib_prcm_rf_power_down_when_idle(...) PRCMRfPowerDownWhenIdle(__VA_ARGS__) -#define ti_lib_prcm_peripheral_run_enable(...) PRCMPeripheralRunEnable(__VA_ARGS__) -#define ti_lib_prcm_peripheral_run_disable(...) PRCMPeripheralRunDisable(__VA_ARGS__) -#define ti_lib_prcm_peripheral_sleep_enable(...) PRCMPeripheralSleepEnable(__VA_ARGS__) -#define ti_lib_prcm_peripheral_sleep_disable(...) PRCMPeripheralSleepDisable(__VA_ARGS__) -#define ti_lib_prcm_peripheral_deep_sleep_enable(...) PRCMPeripheralDeepSleepEnable(__VA_ARGS__) -#define ti_lib_prcm_peripheral_deep_sleep_disable(...) PRCMPeripheralDeepSleepDisable(__VA_ARGS__) -#define ti_lib_prcm_power_domain_status(...) PRCMPowerDomainStatus(__VA_ARGS__) -#define ti_lib_prcm_rf_ready(...) PRCMRfReady(__VA_ARGS__) -#define ti_lib_prcm_sleep(...) PRCMSleep(__VA_ARGS__) -#define ti_lib_prcm_deep_sleep(...) PRCMDeepSleep(__VA_ARGS__) -#define ti_lib_prcm_cache_retention_enable(...) PRCMCacheRetentionEnable(__VA_ARGS__) -#define ti_lib_prcm_cache_retention_disable(...) PRCMCacheRetentionDisable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* sys_ctrl.h */ -#include "driverlib/pwr_ctrl.h" - -#define ti_lib_pwr_ctrl_state_set(...) PowerCtrlStateSet(__VA_ARGS__) -#define ti_lib_pwr_ctrl_source_set(...) PowerCtrlSourceSet(__VA_ARGS__) -#define ti_lib_pwr_ctrl_source_get(...) PowerCtrlSourceGet(__VA_ARGS__) -#define ti_lib_pwr_ctrl_reset_source_get(...) PowerCtrlResetSourceGet(__VA_ARGS__) -#define ti_lib_pwr_ctrl_reset_source_clear(...) PowerCtrlResetSourceClear(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* rfc.h */ -#include "driverlib/rfc.h" - -#define ti_lib_rfc_rtrim(...) RFCRTrim(__VA_ARGS__) -#define ti_lib_rfc_adi3vco_ldo_voltage_mode(...) RFCAdi3VcoLdoVoltageMode(__VA_ARGS__) -#define ti_lib_rfc_hw_int_enable(...) RFCHwIntEnable(__VA_ARGS__) -#define ti_lib_rfc_hw_int_disable(...) RFCHwIntDisable(__VA_ARGS__) -#define ti_lib_rfc_hw_int_clear(...) RFCHwIntClear(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* sys_ctrl.h */ -#include "driverlib/sys_ctrl.h" - -#define ti_lib_sys_ctrl_power_everything(...) SysCtrlPowerEverything(__VA_ARGS__) -#define ti_lib_sys_ctrl_powerdown(...) SysCtrlPowerdown(__VA_ARGS__) -#define ti_lib_sys_ctrl_standby(...) SysCtrlStandby(__VA_ARGS__) -#define ti_lib_sys_ctrl_shutdown(...) SysCtrlShutdown(__VA_ARGS__) -#define ti_lib_sys_ctrl_clock_get(...) SysCtrlClockGet(__VA_ARGS__) -#define ti_lib_sys_ctrl_aon_sync(...) SysCtrlAonSync(__VA_ARGS__) -#define ti_lib_sys_ctrl_aon_update(...) SysCtrlAonUpdate(__VA_ARGS__) -#define ti_lib_sys_ctrl_set_recharge_before_power_down(...) SysCtrlSetRechargeBeforePowerDown(__VA_ARGS__) - -#if CPU_FAMILY_CC26X0R2 -/* May need to change to XOSC_IN_LOW_POWER_MODE */ -#define ti_lib_sys_ctrl_adjust_recharge_after_power_down() SysCtrlAdjustRechargeAfterPowerDown(XOSC_IN_HIGH_POWER_MODE) -#else -#define ti_lib_sys_ctrl_adjust_recharge_after_power_down() SysCtrlAdjustRechargeAfterPowerDown() -#endif /* CPU_FAMILY_CC26X0R2 */ - -#define ti_lib_sys_ctrl_dcdc_voltage_conditional_control(...) SysCtrl_DCDC_VoltageConditionalControl(__VA_ARGS__) -#define ti_lib_sys_ctrl_reset_source_get(...) SysCtrlResetSourceGet(__VA_ARGS__) -#define ti_lib_sys_ctrl_system_reset(...) SysCtrlSystemReset(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* ssi.h */ -#include "driverlib/ssi.h" - -#define ti_lib_ssi_config_set_exp_clk(...) SSIConfigSetExpClk(__VA_ARGS__) -#define ti_lib_ssi_enable(...) SSIEnable(__VA_ARGS__) -#define ti_lib_ssi_disable(...) SSIDisable(__VA_ARGS__) -#define ti_lib_ssi_data_put(...) SSIDataPut(__VA_ARGS__) -#define ti_lib_ssi_data_put_non_blocking(...) SSIDataPutNonBlocking(__VA_ARGS__) -#define ti_lib_ssi_data_get(...) SSIDataGet(__VA_ARGS__) -#define ti_lib_ssi_data_get_non_blocking(...) SSIDataGetNonBlocking(__VA_ARGS__) -#define ti_lib_ssi_busy(...) SSIBusy(__VA_ARGS__) -#define ti_lib_ssi_status(...) SSIStatus(__VA_ARGS__) -#define ti_lib_ssi_int_register(...) SSIIntRegister(__VA_ARGS__) -#define ti_lib_ssi_int_unregister(...) SSIIntUnregister(__VA_ARGS__) -#define ti_lib_ssi_int_enable(...) SSIIntEnable(__VA_ARGS__) -#define ti_lib_ssi_int_disable(...) SSIIntDisable(__VA_ARGS__) -#define ti_lib_ssi_int_clear(...) SSIIntClear(__VA_ARGS__) -#define ti_lib_ssi_int_status(...) SSIIntStatus(__VA_ARGS__) -#define ti_lib_ssi_dma_enable(...) SSIDMAEnable(__VA_ARGS__) -#define ti_lib_ssi_dma_disable(...) SSIDMADisable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* systick.h */ -#include "driverlib/systick.h" - -#define ti_lib_systick_enable(...) SysTickEnable(__VA_ARGS__) -#define ti_lib_systick_disable(...) SysTickDisable(__VA_ARGS__) -#define ti_lib_systick_int_register(...) SysTickIntRegister(__VA_ARGS__) -#define ti_lib_systick_int_unregister(...) SysTickIntUnregister(__VA_ARGS__) -#define ti_lib_systick_int_enable(...) SysTickIntEnable(__VA_ARGS__) -#define ti_lib_systick_int_disable(...) SysTickIntDisable(__VA_ARGS__) -#define ti_lib_systick_period_set(...) SysTickPeriodSet(__VA_ARGS__) -#define ti_lib_systick_period_get(...) SysTickPeriodGet(__VA_ARGS__) -#define ti_lib_systick_value_get(...) SysTickValueGet(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* timer.h */ -#include "driverlib/timer.h" - -#define ti_lib_timer_enable(...) TimerEnable(__VA_ARGS__) -#define ti_lib_timer_disable(...) TimerDisable(__VA_ARGS__) -#define ti_lib_timer_configure(...) TimerConfigure(__VA_ARGS__) -#define ti_lib_timer_level_control(...) TimerLevelControl(__VA_ARGS__) -#define ti_lib_timer_event_control(...) TimerEventControl(__VA_ARGS__) -#define ti_lib_timer_stall_control(...) TimerStallControl(__VA_ARGS__) -#define ti_lib_timer_wait_on_trigger_control(...) TimerWaitOnTriggerControl(__VA_ARGS__) -#define ti_lib_timer_rtc_enable(...) TimerRtcEnable(__VA_ARGS__) -#define ti_lib_timer_rtc_disable(...) TimerRtcDisable(__VA_ARGS__) -#define ti_lib_timer_prescale_set(...) TimerPrescaleSet(__VA_ARGS__) -#define ti_lib_timer_prescale_get(...) TimerPrescaleGet(__VA_ARGS__) -#define ti_lib_timer_prescale_match_set(...) TimerPrescaleMatchSet(__VA_ARGS__) -#define ti_lib_timer_prescale_match_get(...) TimerPrescaleMatchGet(__VA_ARGS__) -#define ti_lib_timer_load_set(...) TimerLoadSet(__VA_ARGS__) -#define ti_lib_timer_load_get(...) TimerLoadGet(__VA_ARGS__) -#define ti_lib_timer_value_get(...) TimerValueGet(__VA_ARGS__) -#define ti_lib_timer_match_set(...) TimerMatchSet(__VA_ARGS__) -#define ti_lib_timer_match_get(...) TimerMatchGet(__VA_ARGS__) -#define ti_lib_timer_int_register(...) TimerIntRegister(__VA_ARGS__) -#define ti_lib_timer_int_unregister(...) TimerIntUnregister(__VA_ARGS__) -#define ti_lib_timer_int_enable(...) TimerIntEnable(__VA_ARGS__) -#define ti_lib_timer_int_disable(...) TimerIntDisable(__VA_ARGS__) -#define ti_lib_timer_int_status(...) TimerIntStatus(__VA_ARGS__) -#define ti_lib_timer_int_clear(...) TimerIntClear(__VA_ARGS__) -#define ti_lib_timer_synchronize(...) TimerSynchronize(__VA_ARGS__) -#define ti_lib_timer_ccp_combine_enable(...) TimerCcpCombineEnable(__VA_ARGS__) -#define ti_lib_timer_ccp_combine_disable(...) TimerCcpCombineDisable(__VA_ARGS__) -#define ti_lib_timer_match_update_mode(...) TimerMatchUpdateMode(__VA_ARGS__) -#define ti_lib_timer_interval_load_mode(...) TimerIntervalLoadMode(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* trng.h */ -#include "driverlib/trng.h" - -#define ti_lib_trng_configure(...) TRNGConfigure(__VA_ARGS__) -#define ti_lib_trng_enable(...) TRNGEnable(__VA_ARGS__) -#define ti_lib_trng_disable(...) TRNGDisable(__VA_ARGS__) -#define ti_lib_trng_number_get(...) TRNGNumberGet(__VA_ARGS__) -#define ti_lib_trng_status_get(...) TRNGStatusGet(__VA_ARGS__) -#define ti_lib_trng_reset(...) TRNGReset(__VA_ARGS__) -#define ti_lib_trng_int_enable(...) TRNGIntEnable(__VA_ARGS__) -#define ti_lib_trng_int_disable(...) TRNGIntDisable(__VA_ARGS__) -#define ti_lib_trng_int_status(...) TRNGIntStatus(__VA_ARGS__) -#define ti_lib_trng_int_clear(...) TRNGIntClear(__VA_ARGS__) -#define ti_lib_trng_int_register(...) TRNGIntRegister(__VA_ARGS__) -#define ti_lib_trng_int_unregister(...) TRNGIntUnregister(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* uart.h */ -#include "driverlib/uart.h" - -#define ti_lib_uart_parity_mode_set(...) UARTParityModeSet(__VA_ARGS__) -#define ti_lib_uart_parity_mode_get(...) UARTParityModeGet(__VA_ARGS__) -#define ti_lib_uart_fifo_level_set(...) UARTFIFOLevelSet(__VA_ARGS__) -#define ti_lib_uart_fifo_level_get(...) UARTFIFOLevelGet(__VA_ARGS__) -#define ti_lib_uart_config_set_exp_clk(...) UARTConfigSetExpClk(__VA_ARGS__) -#define ti_lib_uart_config_get_exp_clk(...) UARTConfigGetExpClk(__VA_ARGS__) -#define ti_lib_uart_enable(...) UARTEnable(__VA_ARGS__) -#define ti_lib_uart_disable(...) UARTDisable(__VA_ARGS__) -#define ti_lib_uart_fifo_enable(...) UARTFIFOEnable(__VA_ARGS__) -#define ti_lib_uart_fifo_disable(...) UARTFIFODisable(__VA_ARGS__) -#define ti_lib_uart_chars_avail(...) UARTCharsAvail(__VA_ARGS__) -#define ti_lib_uart_space_avail(...) UARTSpaceAvail(__VA_ARGS__) -#define ti_lib_uart_char_get_non_blocking(...) UARTCharGetNonBlocking(__VA_ARGS__) -#define ti_lib_uart_char_get(...) UARTCharGet(__VA_ARGS__) -#define ti_lib_uart_char_put_non_blocking(...) UARTCharPutNonBlocking(__VA_ARGS__) -#define ti_lib_uart_char_put(...) UARTCharPut(__VA_ARGS__) -#define ti_lib_uart_break_ctl(...) UARTBreakCtl(__VA_ARGS__) -#define ti_lib_uart_busy(...) UARTBusy(__VA_ARGS__) -#define ti_lib_uart_int_register(...) UARTIntRegister(__VA_ARGS__) -#define ti_lib_uart_int_unregister(...) UARTIntUnregister(__VA_ARGS__) -#define ti_lib_uart_int_enable(...) UARTIntEnable(__VA_ARGS__) -#define ti_lib_uart_int_disable(...) UARTIntDisable(__VA_ARGS__) -#define ti_lib_uart_int_status(...) UARTIntStatus(__VA_ARGS__) -#define ti_lib_uart_int_clear(...) UARTIntClear(__VA_ARGS__) -#define ti_lib_uart_dma_enable(...) UARTDMAEnable(__VA_ARGS__) -#define ti_lib_uart_dma_disable(...) UARTDMADisable(__VA_ARGS__) -#define ti_lib_uart_rx_error_get(...) UARTRxErrorGet(__VA_ARGS__) -#define ti_lib_uart_rx_error_clear(...) UARTRxErrorClear(__VA_ARGS__) -#define ti_lib_uart_hw_flow_control_en(...) UARTHwFlowControlEnable(__VA_ARGS__) -#define ti_lib_uart_hw_flow_control_dis(...) UARTHwFlowControlDisable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* vims.h */ -#include "driverlib/vims.h" - -#define ti_lib_vims_configure(...) VIMSConfigure(__VA_ARGS__) -#define ti_lib_vims_mode_set(...) VIMSModeSet(__VA_ARGS__) -#define ti_lib_vims_mode_get(...) VIMSModeGet(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* watchdog.h */ -#include "driverlib/watchdog.h" - -#define ti_lib_watchdog_running(...) WatchdogRunning(__VA_ARGS__) -#define ti_lib_watchdog_enable(...) WatchdogEnable(__VA_ARGS__) -#define ti_lib_watchdog_reset_enable(...) WatchdogResetEnable(__VA_ARGS__) -#define ti_lib_watchdog_reset_disable(...) WatchdogResetDisable(__VA_ARGS__) -#define ti_lib_watchdog_lock(...) WatchdogLock(__VA_ARGS__) -#define ti_lib_watchdog_unlock(...) WatchdogUnlock(__VA_ARGS__) -#define ti_lib_watchdog_lock_state(...) WatchdogLockState(__VA_ARGS__) -#define ti_lib_watchdog_reload_set(...) WatchdogReloadSet(__VA_ARGS__) -#define ti_lib_watchdog_reload_get(...) WatchdogReloadGet(__VA_ARGS__) -#define ti_lib_watchdog_value_get(...) WatchdogValueGet(__VA_ARGS__) -#define ti_lib_watchdog_int_register(...) WatchdogIntRegister(__VA_ARGS__) -#define ti_lib_watchdog_int_unregister(...) WatchdogIntUnregister(__VA_ARGS__) -#define ti_lib_watchdog_int_enable(...) WatchdogIntEnable(__VA_ARGS__) -#define ti_lib_watchdog_int_status(...) WatchdogIntStatus(__VA_ARGS__) -#define ti_lib_watchdog_int_clear(...) WatchdogIntClear(__VA_ARGS__) -#define ti_lib_watchdog_int_type_set(...) WatchdogIntTypeSet(__VA_ARGS__) -#define ti_lib_watchdog_stall_enable(...) WatchdogStallEnable(__VA_ARGS__) -#define ti_lib_watchdog_stall_disable(...) WatchdogStallDisable(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -/* crypto.h */ -#include "driverlib/crypto.h" - -#define ti_lib_crypto_aes_load_key(...) CRYPTOAesLoadKey(__VA_ARGS__) -#define ti_lib_crypto_aes_ecb(...) CRYPTOAesEcb(__VA_ARGS__) -#define ti_lib_crypto_aes_ecb_status(...) CRYPTOAesEcbStatus(__VA_ARGS__) -#define ti_lib_crypto_aes_ecb_finish(...) CRYPTOAesEcbFinish(__VA_ARGS__) -/*---------------------------------------------------------------------------*/ -#endif /* TI_LIB_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/msp430/Makefile.msp430 b/arch/cpu/msp430/Makefile.msp430 deleted file mode 100644 index 7927002b6..000000000 --- a/arch/cpu/msp430/Makefile.msp430 +++ /dev/null @@ -1,236 +0,0 @@ -# $Id: Makefile.msp430,v 1.35 2011/01/19 07:30:31 adamdunkels Exp $ - -COOJA_PATH ?= $(CONTIKI)/tools/cooja - -ifdef nodeid -CFLAGS += -DNODEID=$(nodeid) -endif - -CFLAGS += -gstabs+ - -.SUFFIXES: - -### Define the CPU directory -CONTIKI_CPU=$(ARCH_PATH)/cpu/msp430 - -### Define the source files we have in the MSP430 port - -ifndef CONTIKI_CPU_FAM_DIR - ifneq (,$(findstring msp430f1,$(MCU))) - CONTIKI_CPU_FAM_DIR = f1xxx - endif -endif -ifndef CONTIKI_CPU_FAM_DIR - ifneq (,$(findstring msp430f5,$(MCU))) - CONTIKI_CPU_FAM_DIR = f5xxx - endif -endif -ifndef CONTIKI_CPU_FAM_DIR - ifneq (,$(findstring msp430f2,$(MCU))) - CONTIKI_CPU_FAM_DIR = f2xxx f1xxx - endif -endif -ifndef CONTIKI_CPU_FAM_DIR - ${error Unhandled MSP430 family: "$(MCU)"} -endif - -CONTIKI_CPU_DIRS = $(CONTIKI_CPU_FAM_DIR) . dev - -MSP430 = msp430.c flash.c clock.c leds.c leds-arch.c \ - watchdog.c lpm.c rtimer-arch.c int-master.c -UIPDRIVERS = slip.c crc16.c - -CONTIKI_TARGET_SOURCEFILES += $(MSP430) \ - $(SYSAPPS) \ - $(UIPDRIVERS) - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -### Compiler definitions - -ifeq ($(WERROR),1) -CFLAGSWERROR= -Wall -Werror -endif - -ifdef IAR -CC = icc430 -LD = xlink -AS = iasm430 -AR = xar -OBJCOPY = ielftool -STRIP = strip - -ifndef IAR_PATH -# This works with cygwin... -IAR_BIN_PATH := $(shell dirname "`which $(CC)`") -IAR_PATH_C := $(shell dirname "$(IAR_BIN_PATH)") -IAR_PATH := $(shell cygpath -m "$(IAR_PATH_C)") -endif - -CFLAGS += --diag_suppress=Pa050 --silent - -#defaults on the MSP430X core include file here (xlfn.h) -ifndef CFLAGSNO -CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430xlfn.h" $(CFLAGSWERROR) -# CFLAGSNO = --dlib_config $(IAR_PATH)/LIB/DLIB/dl430xlfn.h -Ohz --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 --core=430X $(CFLAGSWERROR) --data_model large --double=32 -endif - -LDFLAGSNO += -B -l $(CONTIKI_NG_PROJECT_MAP) -s __program_start -# Stack and heap size in hex -ifndef IAR_STACK_SIZE - IAR_STACK_SIZE=300 -endif -# Set this to a positive number (hex) to enable malloc/free with IAR compiler -ifndef IAR_DATA16_HEAP_SIZE - IAR_DATA16_HEAP_SIZE=100 -endif -ifndef IAR_DATA20_HEAP_SIZE - IAR_DATA20_HEAP_SIZE=0 -endif -LDFLAGSNO += -D_STACK_SIZE=$(IAR_STACK_SIZE) -D_DATA16_HEAP_SIZE=$(IAR_DATA16_HEAP_SIZE) -D_DATA20_HEAP_SIZE=$(IAR_DATA20_HEAP_SIZE) - -CUSTOM_RULE_C_TO_O = 1 -%.o: %.c - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) $< -o $@ - -define FINALIZE_CYGWIN_DEPENDENCY -sed -e 's/ \([A-Z]\):\\/ \/cygdrive\/\L\1\//' -e 's/\\/\//g' \ - <$(@:.o=.P) >$(@:.o=.d); \ -rm -f $(@:.o=.P) -endef - -CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 -$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@ -ifeq ($(HOST_OS),Windows) - @$(FINALIZE_CYGWIN_DEPENDENCY) -endif - -AROPTS = -o - -else - -GCC = 1 -CC = msp430-gcc -LD = msp430-gcc -AS = msp430-as -AR = msp430-ar -NM = msp430-nm -OBJCOPY = msp430-objcopy -STRIP = msp430-strip -BSL = msp430-bsl - -# From version 4.6.x, mspgcc does not support generic MCU identifiers such as -# msp430x1611 in contrast to msp430f1611 -ifndef CC_MCU - ifndef MSPGCC_VERSION - MSPGCC_VERSION := ${shell $(CC) -dumpversion} - endif -endif -ifndef CC_MCU - ifneq (,$(findstring 4.4.,$(MSPGCC_VERSION))) - CC_MCU := ${subst msp430f,msp430x,$(MCU)} - endif -endif -ifndef CC_MCU - ifneq (,$(findstring 3.2.,$(MSPGCC_VERSION))) - CC_MCU := ${subst msp430f,msp430x,$(MCU)} - endif -endif -ifndef CC_MCU - CC_MCU := $(MCU) -endif - -### Checks for compiler version to enable 20-bit support -ifndef IAR -ifneq (,$(findstring 4.7.,$(shell msp430-gcc -dumpversion))) -ifdef CPU_HAS_MSP430X - ifeq ($(TARGET_MEMORY_MODEL),large) - CFLAGS += -mmemory-model=$(TARGET_MEMORY_MODEL) - CFLAGS += -mcode-region=far -mdata-region=far -msr20 -mc20 -md20 - LDFLAGS += -mmemory-model=$(TARGET_MEMORY_MODEL) -mcode-region=far -mdata-region=far -msr20 -mc20 -md20 - else - TARGET_MEMORY_MODEL = medium - CFLAGS += -mmemory-model=$(TARGET_MEMORY_MODEL) - CFLAGS += -ffunction-sections -fdata-sections -mcode-region=any - LDFLAGS += -mmemory-model=$(TARGET_MEMORY_MODEL) -Wl,-gc-sections - endif -endif -endif -endif - -ifndef CFLAGSNO -CFLAGSNO = -Wall -mmcu=$(CC_MCU) $(CFLAGSWERROR) -endif -CFLAGS += -Os -fno-strict-aliasing -LDFLAGS += -mmcu=$(CC_MCU) -Wl,-Map=$(CONTIKI_NG_PROJECT_MAP) - -### These flags can reduce the code size and RAM usage with up to 10% -SMALL ?= 1 -ifeq ($(SMALL),1) -CFLAGS += -ffunction-sections -# CFLAGS += -fdata-sections -LDFLAGS += -Wl,--gc-sections,--undefined=_reset_vector__,--undefined=InterruptVectors,--undefined=_copy_data_init__,--undefined=_clear_bss_init__,--undefined=_end_of_init__ -endif # SMALL - -endif # IAR - -# Define the `_stack` symbol used by the stack check library to be equal to `_end` -LDFLAGS += -Wl,--defsym=_stack=_end - -CFLAGS += $(CFLAGSNO) - -PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)} - -### CPU-dependent cleanup files -CLEAN += *.firmware *.ihex - -### Compilation rules - -%-stripped.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ - $(STRIP) --strip-unneeded -g -x $@ - -%-stripped.o: %.o - $(STRIP) --strip-unneeded -g -x -o $@ $< - -%.firmware: %.${TARGET} - mv $< $@ - -ifdef IAR -%.ihex: %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB) - $(LD) $(LDFLAGSNO) -Fintel-extended $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@ -else -%.ihex: %.$(TARGET) - $(OBJCOPY) $^ -O ihex $@ -endif - -$(COOJA_PATH)/build.xml: - @echo '----------------' - @echo 'Could not find the COOJA build file. Did you run "git submodule update --init --recursive"?' - @echo '----------------' - -$(COOJA_PATH)/mspsim/build.xml: $(COOJA_PATH)/build.xml - @echo '----------------' - @echo 'Could not find the MSPSim build file. Did you run "git submodule update --init --recursive"?' - @echo '----------------' - -$(COOJA_PATH)/mspsim/mspsim.jar: $(COOJA_PATH)/mspsim/build.xml - (cd $(COOJA_PATH)/mspsim && ant jar) - -%.mspsim: %.${TARGET} ${COOJA_PATH}/mspsim/mspsim.jar - java -jar ${COOJA_PATH}/mspsim/mspsim.jar -platform=${TARGET} $< - -%.mspsim-maptable: %.$(TARGET) - java -classpath ${COOJA_PATH}/mspsim/mspsim.jar se.sics.mspsim.util.MapTable $(CONTIKI_NG_PROJECT_MAP) - -core-labels.o: core.${TARGET} - ${CONTIKI}/tools/msp430-make-labels core.${TARGET} > core-labels.S - $(AS) -o $@ core-labels.S -# cp core-labels.o app/ - -core-globals.o: core.${TARGET} - ${CONTIKI}/tools/msp430-make-globals core.${TARGET} > core-globals.S - $(AS) -o $@ core-globals.S diff --git a/arch/cpu/msp430/button.c b/arch/cpu/msp430/button.c deleted file mode 100644 index 9e9467d58..000000000 --- a/arch/cpu/msp430/button.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "dev/button.h" -#include "isr_compat.h" - -#define BUTTON_PORT 2 -#define BUTTON_PIN 7 - -static struct button_msg button_msg; - -static struct process *selecting_proc; - -void -button_init(struct process *proc) -{ - button_msg.type = BUTTON_MSG_TYPE; - - P2DIR &= ~BV(BUTTON_PIN); - P2SEL &= ~BV(BUTTON_PIN); - - P2IES |= BV(BUTTON_PIN); - P2IFG &= ~BV(BUTTON_PIN); - - selecting_proc = proc; - if(proc != NULL) - P2IE |= BV(BUTTON_PIN); - else - P2IE &= ~BV(BUTTON_PIN); -} - -ISR(PORT2, __button_interrupt) -{ - static struct timer debouncetimer; - - P2IFG &= ~BV(BUTTON_PIN); - if(timer_expired(&debouncetimer)) { - button_msg.value = P2IN & BV(BUTTON_PIN); - timer_set(&debouncetimer, CLOCK_SECOND/4); - if(selecting_proc != NULL) { - process_post(selecting_proc, PROCESS_EVENT_MSG, &button_msg); - } - LPM4_EXIT; - } -} diff --git a/arch/cpu/msp430/cc2420-arch-sfd.c b/arch/cpu/msp430/cc2420-arch-sfd.c deleted file mode 100644 index d1db81ce0..000000000 --- a/arch/cpu/msp430/cc2420-arch-sfd.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "dev/spi-legacy.h" -#include "cc2420.h" -#include "isr_compat.h" - -extern volatile uint8_t cc2420_sfd_counter; -extern volatile uint16_t cc2420_sfd_start_time; -extern volatile uint16_t cc2420_sfd_end_time; - -/*---------------------------------------------------------------------------*/ -/* SFD interrupt for timestamping radio packets */ -ISR(TIMERB1, cc2420_timerb1_interrupt) -{ - int tbiv; - - /* always read TBIV to clear IFG */ - tbiv = TBIV; - /* read and discard tbiv to avoid "variable set but not used" warning */ - (void)tbiv; - if(CC2420_SFD_IS_1) { - cc2420_sfd_counter++; - cc2420_sfd_start_time = TBCCR1; - } else { - cc2420_sfd_counter = 0; - cc2420_sfd_end_time = TBCCR1; - } -} -/*---------------------------------------------------------------------------*/ -void -cc2420_arch_sfd_init(void) -{ - /* Need to select the special function! */ - CC2420_SFD_PORT(SEL) = BV(CC2420_SFD_PIN); - - /* start timer B - 32768 ticks per second */ - TBCTL = TBSSEL_1 | TBCLR; - - /* CM_3 = capture mode - capture on both edges */ - TBCCTL1 = CM_3 | CAP | SCS; - TBCCTL1 |= CCIE; - - /* Start Timer_B in continuous mode. */ - TBCTL |= MC1; - - TBR = RTIMER_NOW(); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/cc2420-arch-sfd.h b/arch/cpu/msp430/cc2420-arch-sfd.h deleted file mode 100644 index 15c124ca6..000000000 --- a/arch/cpu/msp430/cc2420-arch-sfd.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 CC2420_ARCH_SFD_H -#define CC2420_ARCH_SFD_H - -extern volatile uint8_t cc2420_arch_sfd_counter; -extern volatile uint16_t cc2420_arch_sfd_start_time; -extern volatile uint16_t cc2420_arch_sfd_end_time; - -void cc2420_arch_sfd_init(void); - -#endif /* CC2420_ARCH_SFD_H */ diff --git a/arch/cpu/msp430/cc2420-arch.c b/arch/cpu/msp430/cc2420-arch.c deleted file mode 100644 index c35ce949f..000000000 --- a/arch/cpu/msp430/cc2420-arch.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "contiki-net.h" - -#include "dev/spi-legacy.h" -#include "cc2420.h" -#include "isr_compat.h" - -#ifdef CC2420_CONF_SFD_TIMESTAMPS -#define CONF_SFD_TIMESTAMPS CC2420_CONF_SFD_TIMESTAMPS -#endif /* CC2420_CONF_SFD_TIMESTAMPS */ - -#ifndef CONF_SFD_TIMESTAMPS -#define CONF_SFD_TIMESTAMPS 0 -#endif /* CONF_SFD_TIMESTAMPS */ - -#ifdef CONF_SFD_TIMESTAMPS -#include "cc2420-arch-sfd.h" -#endif - -/*---------------------------------------------------------------------------*/ -ISR(CC2420_IRQ, cc2420_port1_interrupt) -{ - if(cc2420_interrupt()) { - LPM4_EXIT; - } -} -/*---------------------------------------------------------------------------*/ -void -cc2420_arch_init(void) -{ - spi_init(); - - /* all input by default, set these as output */ - CC2420_CSN_PORT(DIR) |= BV(CC2420_CSN_PIN); - CC2420_VREG_PORT(DIR) |= BV(CC2420_VREG_PIN); - CC2420_RESET_PORT(DIR) |= BV(CC2420_RESET_PIN); - -#if CONF_SFD_TIMESTAMPS - cc2420_arch_sfd_init(); -#endif - - CC2420_SPI_DISABLE(); /* Unselect radio. */ -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/cc2520-arch-sfd.c b/arch/cpu/msp430/cc2520-arch-sfd.c deleted file mode 100644 index dc0561f94..000000000 --- a/arch/cpu/msp430/cc2520-arch-sfd.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "dev/spi-legacy.h" -#include "dev/cc2520/cc2520.h" -#include "isr_compat.h" - -extern volatile uint8_t cc2520_sfd_counter; -extern volatile uint16_t cc2520_sfd_start_time; -extern volatile uint16_t cc2520_sfd_end_time; - -/*---------------------------------------------------------------------------*/ -/* SFD interrupt for timestamping radio packets */ -ISR(TIMERB1, cc2520_timerb1_interrupt) -{ - int tbiv; - - /* always read TBIV to clear IFG */ - tbiv = TBIV; - /* read and discard tbiv to avoid "variable set but not used" warning */ - (void)tbiv; - if(CC2520_SFD_IS_1) { - cc2520_sfd_counter++; - cc2520_sfd_start_time = TBCCR1; - } else { - cc2520_sfd_counter = 0; - cc2520_sfd_end_time = TBCCR1; - } -} -/*---------------------------------------------------------------------------*/ -void -cc2520_arch_sfd_init(void) -{ - /* Need to select the special function! */ - CC2520_SFD_PORT(SEL) = BV(CC2520_SFD_PIN); - - /* start timer B - 32768 ticks per second */ - TBCTL = TBSSEL_1 | TBCLR; - - /* CM_3 = capture mode - capture on both edges */ - TBCCTL1 = CM_3 | CAP | SCS; - TBCCTL1 |= CCIE; - - /* Start Timer_B in continuous mode. */ - TBCTL |= MC1; - - TBR = RTIMER_NOW(); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/cc2520-arch-sfd.h b/arch/cpu/msp430/cc2520-arch-sfd.h deleted file mode 100644 index ce6257ab2..000000000 --- a/arch/cpu/msp430/cc2520-arch-sfd.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 CC2520_ARCH_SFD_H -#define CC2520_ARCH_SFD_H - -extern volatile uint8_t cc2520_arch_sfd_counter; -extern volatile uint16_t cc2520_arch_sfd_start_time; -extern volatile uint16_t cc2520_arch_sfd_end_time; - -void cc2520_arch_sfd_init(void); - -#endif /* CC2520_ARCH_SFD_H */ diff --git a/arch/cpu/msp430/cc2520-arch.c b/arch/cpu/msp430/cc2520-arch.c deleted file mode 100644 index e63735271..000000000 --- a/arch/cpu/msp430/cc2520-arch.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "contiki-net.h" - -#include "dev/spi-legacy.h" -#include "dev/cc2520/cc2520.h" -#include "isr_compat.h" - -#ifdef CC2520_CONF_SFD_TIMESTAMPS -#define CONF_SFD_TIMESTAMPS CC2520_CONF_SFD_TIMESTAMPS -#endif /* CC2520_CONF_SFD_TIMESTAMPS */ - -#ifndef CONF_SFD_TIMESTAMPS -#define CONF_SFD_TIMESTAMPS 0 -#endif /* CONF_SFD_TIMESTAMPS */ - -#ifdef CONF_SFD_TIMESTAMPS -#include "cc2520-arch-sfd.h" -#endif - -/*---------------------------------------------------------------------------*/ -ISR(CC2520_IRQ, cc2520_port1_interrupt) -{ - if(cc2520_interrupt()) { - LPM4_EXIT; - } -} -/*---------------------------------------------------------------------------*/ -void -cc2520_arch_init(void) -{ - spi_init(); - - /* all input by default, set these as output */ - CC2520_CSN_PORT(DIR) |= BV(CC2520_CSN_PIN); - CC2520_VREG_PORT(DIR) |= BV(CC2520_VREG_PIN); - CC2520_RESET_PORT(DIR) |= BV(CC2520_RESET_PIN); - - CC2520_FIFOP_PORT(DIR) &= ~(BV(CC2520_FIFOP_PIN)); - CC2520_FIFO_PORT(DIR) &= ~(BV(CC2520_FIFO_PIN)); - CC2520_CCA_PORT(DIR) &= ~(BV(CC2520_CCA_PIN)); - CC2520_SFD_PORT(DIR) &= ~(BV(CC2520_SFD_PIN)); - -#if CONF_SFD_TIMESTAMPS - cc2520_arch_sfd_init(); -#endif - - CC2520_SPI_DISABLE(); /* Unselect radio. */ -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/dev/button.h b/arch/cpu/msp430/dev/button.h deleted file mode 100644 index 96752850a..000000000 --- a/arch/cpu/msp430/dev/button.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 BUTTON_H -#define BUTTON_H - -#define BUTTON_MSG_TYPE 1 - -struct button_msg { - uint8_t type; - uint8_t value; -}; - -void button_init(struct process *proc); - -#endif /* BUTTON_H */ diff --git a/arch/cpu/msp430/dev/flash.h b/arch/cpu/msp430/dev/flash.h deleted file mode 100644 index ed142b8a1..000000000 --- a/arch/cpu/msp430/dev/flash.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * \file - * Functions for reading and writing MSP430 flash ROM. - * \author Adam Dunkels - */ - -/* Copyright (c) 2004 Swedish Institute of Computer Science. - * 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. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - * - * - * Author: Adam Dunkels - * - */ - -#ifndef FLASH_H_ -#define FLASH_H_ - -/** - * Setup function to be called before any of the flash programming functions. - * - */ -void flash_setup(void); - -/** - * Function that is to be called after flashing is done. - */ -void flash_done(void); - -/** - * Write a 16-bit word to flash ROM. - * - * This function writes a 16-bit word to flash ROM. The function - * flash_setup() must have been called first. - * - * \param addr A pointer to the address in flash ROM which is to be - * written. - * - * \param word The 16-bit word that is to be written. - */ -void flash_write(unsigned short *addr, unsigned short word); - -/** - * Clear a 16-bit word in flash ROM. - * - * This function clears a 16-bit word in flash ROM. The function - * flash_setup() must have been called first. - * - * \param addr A pointer to the address in flash ROM which is to be - * cleared. - */ -void flash_clear(unsigned short *addr); - -#endif /* FLASH_H_ */ diff --git a/arch/cpu/msp430/dev/hwconf.h b/arch/cpu/msp430/dev/hwconf.h deleted file mode 100644 index f58c3cd6b..000000000 --- a/arch/cpu/msp430/dev/hwconf.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#ifndef HWCONF_H_ -#define HWCONF_H_ -#include "contiki.h" -#include "sys/cc.h" - -#define HWCONF_PIN(name, port, bit) \ -static CC_INLINE void name##_SELECT() {P##port##SEL &= ~(1 << bit);} \ -static CC_INLINE void name##_SELECT_IO() {P##port##SEL &= ~(1 << bit);} \ -static CC_INLINE void name##_SELECT_PM() {P##port##SEL |= 1 << bit;} \ -static CC_INLINE void name##_SET() {P##port##OUT |= 1 << bit;} \ -static CC_INLINE void name##_CLEAR() {P##port##OUT &= ~(1 << bit);} \ -static CC_INLINE int name##_READ() {return (P##port##IN & (1 << bit));} \ -static CC_INLINE void name##_MAKE_OUTPUT() {P##port##DIR |= 1 << bit;} \ -static CC_INLINE void name##_MAKE_INPUT() {P##port##DIR &= ~(1 << bit);} - -#define HWCONF_IRQ(name, port, bit) \ -static CC_INLINE void name##_ENABLE_IRQ() {P##port##IE |= 1 << bit;} \ -static CC_INLINE void name##_DISABLE_IRQ() {P##port##IE &= ~(1 << bit);} \ -static CC_INLINE int name##_IRQ_ENABLED() {return P##port##IE & (1 << bit);} \ -static CC_INLINE void name##_IRQ_EDGE_SELECTD() {P##port##IES |= 1 << bit;} \ -static CC_INLINE void name##_IRQ_EDGE_SELECTU() {P##port##IES &= ~(1 << bit);}\ -static CC_INLINE int name##_CHECK_IRQ() {return P##port##IFG & (1 << bit);} \ -static CC_INLINE int name##_IRQ_PORT() {return port;} - -#endif /* HWCONF_H_ */ diff --git a/arch/cpu/msp430/dev/lpm.h b/arch/cpu/msp430/dev/lpm.h deleted file mode 100644 index f5e5cd74f..000000000 --- a/arch/cpu/msp430/dev/lpm.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#ifndef LPM_H_ -#define LPM_H_ - -#include "contiki.h" - -#ifdef LPM_CONF_ON -#define LPM_ON LPM_CONF_ON -#else -#define LPM_ON LPM1 -#endif /* LPM_CONF_ON */ - -#ifdef LPM_CONF_OFF -#define LPM_OFF LPM_CONF_OFF -#else -#define LPM_OFF LPM1_EXIT -#endif /* LPM_CONF_OFF */ - -#define LPM_SLEEP() do { if(lpm_status == LPM_STATUS_ON) LPM_ON; } while(0) -#define LPM_AWAKE() do { if(lpm_status == LPM_STATUS_ON) LPM_OFF; } while(0) - -extern unsigned char lpm_status; - -void lpm_on(void); -void lpm_off(void); - -#define LPM_STATUS_OFF 0 -#define LPM_STATUS_ON 1 - - -#endif /* LPM_H_ */ diff --git a/arch/cpu/msp430/dev/uart0-putchar.c b/arch/cpu/msp430/dev/uart0-putchar.c deleted file mode 100644 index 4c92f9160..000000000 --- a/arch/cpu/msp430/dev/uart0-putchar.c +++ /dev/null @@ -1,39 +0,0 @@ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/uart0.h" - -#include -/*---------------------------------------------------------------------------*/ -#define SLIP_END 0300 -#undef putchar -/*---------------------------------------------------------------------------*/ -int -putchar(int c) -{ -#if SLIP_ARCH_CONF_ENABLED - static char debug_frame = 0; - - if(!debug_frame) { /* Start of debug output */ - uart0_writeb(SLIP_END); - uart0_writeb('\r'); /* Type debug line == '\r' */ - debug_frame = 1; - } -#endif /* SLIP_ARCH_CONF_ENABLED */ - - /* Need to also print '\n' because for example COOJA will not show - any output before line end */ - uart0_writeb((char)c); - -#if SLIP_ARCH_CONF_ENABLED - /* - * Line buffered output, a newline marks the end of debug output and - * implicitly flushes debug output. - */ - if(c == '\n') { - uart0_writeb(SLIP_END); - debug_frame = 0; - } -#endif /* SLIP_ARCH_CONF_ENABLED */ - return c; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/dev/uart0.h b/arch/cpu/msp430/dev/uart0.h deleted file mode 100644 index 837906596..000000000 --- a/arch/cpu/msp430/dev/uart0.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * UART0 header file - * \author - * Enric M. Calvo - */ - -#ifndef UART0_H_ -#define UART0_H_ - -#include "contiki.h" - -#define UART0_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud)) - -void uart0_set_input(int (*input)(unsigned char c)); -void uart0_writeb(unsigned char c); -void uart0_init(unsigned long ubr); -uint8_t uart0_active(void); - -#endif /* UART0_H_ */ diff --git a/arch/cpu/msp430/dev/uart1-putchar.c b/arch/cpu/msp430/dev/uart1-putchar.c deleted file mode 100644 index 14146d9dc..000000000 --- a/arch/cpu/msp430/dev/uart1-putchar.c +++ /dev/null @@ -1,39 +0,0 @@ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/uart1.h" - -#include -/*---------------------------------------------------------------------------*/ -#define SLIP_END 0300 -#undef putchar -/*---------------------------------------------------------------------------*/ -int -putchar(int c) -{ -#if SLIP_ARCH_CONF_ENABLED - static char debug_frame = 0; - - if(!debug_frame) { /* Start of debug output */ - uart1_writeb(SLIP_END); - uart1_writeb('\r'); /* Type debug line == '\r' */ - debug_frame = 1; - } -#endif /* SLIP_ARCH_CONF_ENABLED */ - - /* Need to also print '\n' because for example COOJA will not show - any output before line end */ - uart1_writeb((char)c); - -#if SLIP_ARCH_CONF_ENABLED - /* - * Line buffered output, a newline marks the end of debug output and - * implicitly flushes debug output. - */ - if(c == '\n') { - uart1_writeb(SLIP_END); - debug_frame = 0; - } -#endif /* SLIP_ARCH_CONF_ENABLED */ - return c; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/dev/uart1.h b/arch/cpu/msp430/dev/uart1.h deleted file mode 100644 index 90280d4c8..000000000 --- a/arch/cpu/msp430/dev/uart1.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#ifndef UART1_H_ -#define UART1_H_ - -#include "contiki.h" - -#define UART1_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud)) - -void uart1_set_input(int (*input)(unsigned char c)); -void uart1_writeb(unsigned char c); -void uart1_init(unsigned long ubr); -uint8_t uart1_active(void); - -#endif /* UART1_H_ */ diff --git a/arch/cpu/msp430/f1xxx/clock.c b/arch/cpu/msp430/f1xxx/clock.c deleted file mode 100644 index 8a0ab8393..000000000 --- a/arch/cpu/msp430/f1xxx/clock.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -#include "contiki.h" -#include "sys/clock.h" -#include "sys/etimer.h" -#include "sys/energest.h" -#include "rtimer-arch.h" -#include "dev/watchdog.h" -#include "isr_compat.h" - -#define INTERVAL (RTIMER_ARCH_SECOND / CLOCK_SECOND) - -#define MAX_TICKS (~((clock_time_t)0) / 2) - -#define CLOCK_LT(a, b) ((int16_t)((a)-(b)) < 0) - -static volatile unsigned long seconds; - -static volatile clock_time_t count = 0; -/* last_tar is used for calculating clock_fine */ -static volatile uint16_t last_tar = 0; -/*---------------------------------------------------------------------------*/ -static inline uint16_t -read_tar(void) -{ - /* Same as clock_counter(), but can be inlined */ - uint16_t t1, t2; - do { - t1 = TAR; - t2 = TAR; - } while(t1 != t2); - return t1; -} -/*---------------------------------------------------------------------------*/ -ISR(TIMERA1, timera1) -{ - watchdog_start(); - - if(TAIV == 2) { - - /* HW timer bug fix: Interrupt handler called before TR==CCR. - * Occurs when timer state is toggled between STOP and CONT. */ - while(TACTL & MC1 && TACCR1 - read_tar() == 1); - - last_tar = read_tar(); - /* Make sure interrupt time is future */ - while(!CLOCK_LT(last_tar, TACCR1)) { - TACCR1 += INTERVAL; - ++count; - - /* Make sure the CLOCK_CONF_SECOND is a power of two, to ensure - that the modulo operation below becomes a logical and and not - an expensive divide. Algorithm from Wikipedia: - http://en.wikipedia.org/wiki/Power_of_two */ -#if (CLOCK_CONF_SECOND & (CLOCK_CONF_SECOND - 1)) != 0 -#error CLOCK_CONF_SECOND must be a power of two (i.e., 1, 2, 4, 8, 16, 32, 64, ...). -#error Change CLOCK_CONF_SECOND in contiki-conf.h. -#endif - if(count % CLOCK_CONF_SECOND == 0) { - ++seconds; - energest_flush(); - } - last_tar = read_tar(); - } - - if(etimer_pending() && - (etimer_next_expiration_time() - count - 1) > MAX_TICKS) { - etimer_request_poll(); - LPM4_EXIT; - } - - } - /* if(process_nevents() >= 0) { - LPM4_EXIT; - }*/ - - watchdog_stop(); -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - clock_time_t t1, t2; - do { - t1 = count; - t2 = count; - } while(t1 != t2); - return t1; -} -/*---------------------------------------------------------------------------*/ -void -clock_set(clock_time_t clock, clock_time_t fclock) -{ - TAR = fclock; - TACCR1 = fclock + INTERVAL; - count = clock; -} -/*---------------------------------------------------------------------------*/ -int -clock_fine_max(void) -{ - return INTERVAL; -} -/*---------------------------------------------------------------------------*/ -unsigned short -clock_fine(void) -{ - unsigned short t; - /* Assign last_tar to local varible that can not be changed by interrupt */ - t = last_tar; - /* perform calc based on t, TAR will not be changed during interrupt */ - return (unsigned short) (TAR - t); -} -/*---------------------------------------------------------------------------*/ -void -clock_init(void) -{ - dint(); - - /* Select SMCLK (2.4576MHz), clear TAR */ - /* TACTL = TASSEL1 | TACLR | ID_3; */ - - /* Select ACLK 32768Hz clock, divide by 2 */ - /* TACTL = TASSEL0 | TACLR | ID_1;*/ - - /* Select ACLK 32768Hz clock */ - /* TACTL = TASSEL0 | TACLR; */ - -#if INTERVAL==32768/CLOCK_SECOND - TACTL = TASSEL0 | TACLR; -#elif INTERVAL==16384/CLOCK_SECOND - TACTL = TASSEL0 | TACLR | ID_1; -#else -#error NEED TO UPDATE clock.c to match interval! -#endif - - /* Initialize ccr1 to create the X ms interval. */ - /* CCR1 interrupt enabled, interrupt occurs when timer equals CCR. */ - TACCTL1 = CCIE; - - /* Interrupt after X ms. */ - TACCR1 = INTERVAL; - - /* Start Timer_A in continuous mode. */ - TACTL |= MC1; - - count = 0; - - /* Enable interrupts. */ - eint(); - -} -/*---------------------------------------------------------------------------*/ -/** - * Delay the CPU for a multiple of 2.83 us. - */ -void -clock_delay(unsigned int i) -{ - while(i--) { - _NOP(); - } -} -/*---------------------------------------------------------------------------*/ -/* - * Wait for a multiple of 10 ms. - * - */ -void -clock_wait(clock_time_t i) -{ - clock_time_t start; - - start = clock_time(); - while(clock_time() - start < (clock_time_t)i); -} -/*---------------------------------------------------------------------------*/ -void -clock_set_seconds(unsigned long sec) -{ - int s; - s = splhigh(); - seconds = sec; - splx(s); -} -/*---------------------------------------------------------------------------*/ -unsigned long -clock_seconds(void) -{ - unsigned long t1, t2; - do { - t1 = seconds; - t2 = seconds; - } while(t1 != t2); - return t1; -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -clock_counter(void) -{ - rtimer_clock_t t1, t2; - do { - t1 = TAR; - t2 = TAR; - } while(t1 != t2); - return t1; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f1xxx/msp430.c b/arch/cpu/msp430/f1xxx/msp430.c deleted file mode 100644 index eb0ca5515..000000000 --- a/arch/cpu/msp430/f1xxx/msp430.c +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -#include "contiki.h" -#include "dev/watchdog.h" - -/* dco_required set to 1 will cause the CPU not to go into - sleep modes where the DCO clock stopped */ -int msp430_dco_required; - -#if defined(__MSP430__) && defined(__GNUC__) -#define asmv(arg) __asm__ __volatile__(arg) -#endif - -/*---------------------------------------------------------------------------*/ -#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND -void * -w_memcpy(void *out, const void *in, size_t n) -{ - uint8_t *src, *dest; - src = (uint8_t *) in; - dest = (uint8_t *) out; - while(n-- > 0) { - *dest++ = *src++; - } - return out; -} -#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */ -/*---------------------------------------------------------------------------*/ -#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND -void * -w_memset(void *out, int value, size_t n) -{ - uint8_t *dest; - dest = (uint8_t *) out; - while(n-- > 0) { - *dest++ = value & 0xff; - } - return out; -} -#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */ -/*---------------------------------------------------------------------------*/ -void -msp430_init_dco(void) -{ - /* This code taken from the FU Berlin sources and reformatted. */ -#define DELTA ((MSP430_CPU_SPEED) / (32768 / 8)) - - unsigned int compare, oldcapture = 0; - unsigned int i; - - BCSCTL1 = 0xa4; /* ACLK is devided by 4. RSEL=6 no division for MCLK - and SSMCLK. XT2 is off. */ - - BCSCTL2 = 0x00; /* Init FLL to desired frequency using the 32762Hz - crystal DCO frquenzy = 2,4576 MHz */ - - BCSCTL1 |= DIVA1 + DIVA0; /* ACLK = LFXT1CLK/8 */ - for(i = 0xffff; i > 0; i--) { /* Delay for XTAL to settle */ - asm("nop"); - } - - CCTL2 = CCIS0 + CM0 + CAP; /* Define CCR2, CAP, ACLK */ - TACTL = TASSEL1 + TACLR + MC1; /* SMCLK, continous mode */ - - - while(1) { - - while((CCTL2 & CCIFG) != CCIFG); /* Wait until capture occured! */ - CCTL2 &= ~CCIFG; /* Capture occured, clear flag */ - compare = CCR2; /* Get current captured SMCLK */ - compare = compare - oldcapture; /* SMCLK difference */ - oldcapture = CCR2; /* Save current captured SMCLK */ - - if(DELTA == compare) { - break; /* if equal, leave "while(1)" */ - } else if(DELTA < compare) { /* DCO is too fast, slow it down */ - DCOCTL--; - if(DCOCTL == 0xFF) { /* Did DCO role under? */ - BCSCTL1--; - } - } else { /* -> Select next lower RSEL */ - DCOCTL++; - if(DCOCTL == 0x00) { /* Did DCO role over? */ - BCSCTL1++; - } - /* -> Select next higher RSEL */ - } - } - - CCTL2 = 0; /* Stop CCR2 function */ - TACTL = 0; /* Stop Timer_A */ - - BCSCTL1 &= ~(DIVA1 + DIVA0); /* remove /8 divisor from ACLK again */ -} -/*---------------------------------------------------------------------------*/ -static void -init_ports(void) -{ - /* Turn everything off, device drivers enable what is needed. */ - - /* All configured for digital I/O */ -#ifdef P1SEL - P1SEL = 0; -#endif -#ifdef P2SEL - P2SEL = 0; -#endif -#ifdef P3SEL - P3SEL = 0; -#endif -#ifdef P4SEL - P4SEL = 0; -#endif -#ifdef P5SEL - P5SEL = 0; -#endif -#ifdef P6SEL - P6SEL = 0; -#endif - - /* All available inputs */ -#ifdef P1DIR - P1DIR = 0; - P1OUT = 0; -#endif -#ifdef P2DIR - P2DIR = 0; - P2OUT = 0; -#endif -#ifdef P3DIR - P3DIR = 0; - P3OUT = 0; -#endif -#ifdef P4DIR - P4DIR = 0; - P4OUT = 0; -#endif - -#ifdef P5DIR - P5DIR = 0; - P5OUT = 0; -#endif - -#ifdef P6DIR - P6DIR = 0; - P6OUT = 0; -#endif - -#ifdef P7DIR - P7DIR = 0; - P7OUT = 0; -#endif - -#ifdef P8DIR - P8DIR = 0; - P8OUT = 0; -#endif - - P1IE = 0; - P2IE = 0; -} -/*---------------------------------------------------------------------------*/ -/* msp430-ld may align _end incorrectly. Workaround in cpu_init. */ -#if defined(__MSP430__) && defined(__GNUC__) -extern int _end; /* Not in sys/unistd.h */ -static char *cur_break = (char *)&_end; -#endif - -/*---------------------------------------------------------------------------*/ -/* add/remove_lpm_req - for requiring a specific LPM mode. currently Contiki */ -/* jumps to LPM3 to save power, but DMA will not work if DCO is not clocked */ -/* so some modules might need to enter their LPM requirements */ -/* NOTE: currently only works with LPM1 (e.g. DCO) requirements. */ -/*---------------------------------------------------------------------------*/ -void -msp430_add_lpm_req(int req) -{ - if(req <= MSP430_REQUIRE_LPM1) { - msp430_dco_required++; - } -} - -void -msp430_remove_lpm_req(int req) -{ - if(req <= MSP430_REQUIRE_LPM1) { - msp430_dco_required--; - } -} - -void -msp430_cpu_init(void) -{ - dint(); - watchdog_init(); - init_ports(); - msp430_init_dco(); - eint(); -#if defined(__MSP430__) && defined(__GNUC__) - if((uintptr_t)cur_break & 1) { /* Workaround for msp430-ld bug! */ - cur_break++; - } -#endif - - msp430_dco_required = 0; -} -/*---------------------------------------------------------------------------*/ - -#define STACK_EXTRA 32 - -/* - * Allocate memory from the heap. Check that we don't collide with the - * stack right now (some other routine might later). A watchdog might - * be used to check if cur_break and the stack pointer meet during - * runtime. - */ -#if defined(__MSP430__) && defined(__GNUC__) -void * -sbrk(int incr) -{ - char *stack_pointer; - - asmv("mov r1, %0" : "=r" (stack_pointer)); - stack_pointer -= STACK_EXTRA; - if(incr > (stack_pointer - cur_break)) - return (void *)-1; /* ENOMEM */ - - void *old_break = cur_break; - cur_break += incr; - /* - * If the stack was never here then [old_break .. cur_break] should - * be filled with zeros. - */ - return old_break; -} -#endif -/*---------------------------------------------------------------------------*/ -/* - * Mask all interrupts that can be masked. - */ -int -splhigh_(void) -{ - int sr; - /* Clear the GIE (General Interrupt Enable) flag. */ -#ifdef __IAR_SYSTEMS_ICC__ - sr = __get_SR_register(); - __bic_SR_register(GIE); -#else - asmv("mov r2, %0" : "=r" (sr)); - asmv("bic %0, r2" : : "i" (GIE)); -#endif - return sr & GIE; /* Ignore other sr bits. */ -} -/*---------------------------------------------------------------------------*/ -/* - * Restore previous interrupt mask. - */ -/* void */ -/* splx_(int sr) */ -/* { */ -/* #ifdef __IAR_SYSTEMS_ICC__ */ -/* __bis_SR_register(sr); */ -/* #else */ -/* /\* If GIE was set, restore it. *\/ */ -/* asmv("bis %0, r2" : : "r" (sr)); */ -/* #endif */ -/* } */ -/*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -int __low_level_init(void) -{ - /* turn off watchdog so that C-init will run */ - WDTCTL = WDTPW + WDTHOLD; - /* - * Return value: - * - * 1 - Perform data segment initialization. - * 0 - Skip data segment initialization. - */ - return 1; -} -#endif -/*---------------------------------------------------------------------------*/ -#if DCOSYNCH_CONF_ENABLED -/* this code will always start the TimerB if not already started */ -void -msp430_sync_dco(void) { - uint16_t last; - uint16_t diff; -/* uint32_t speed; */ - /* DELTA_2 assumes an ACLK of 32768 Hz */ -#define DELTA_2 ((MSP430_CPU_SPEED) / 32768) - - /* Select SMCLK clock, and capture on ACLK for TBCCR6 */ - TBCTL = TBSSEL1 | TBCLR; - TBCCTL6 = CCIS0 + CM0 + CAP; - /* start the timer */ - TBCTL |= MC1; - - /* wait for next Capture */ - TBCCTL6 &= ~CCIFG; - while(!(TBCCTL6 & CCIFG)); - last = TBCCR6; - - TBCCTL6 &= ~CCIFG; - /* wait for next Capture - and calculate difference */ - while(!(TBCCTL6 & CCIFG)); - diff = TBCCR6 - last; - - /* Stop timer - conserves energy according to user guide */ - TBCTL = 0; - -/* speed = diff; */ -/* speed = speed * 32768; */ -/* printf("Last TAR diff:%d target: %ld ", diff, DELTA_2); */ -/* printf("CPU Speed: %lu DCOCTL: %d\n", speed, DCOCTL); */ - - /* resynchronize the DCO speed if not at target */ - if(DELTA_2 < diff) { /* DCO is too fast, slow it down */ - DCOCTL--; - if(DCOCTL == 0xFF) { /* Did DCO role under? */ - BCSCTL1--; - } - } else if(DELTA_2 > diff) { - DCOCTL++; - if(DCOCTL == 0x00) { /* Did DCO role over? */ - BCSCTL1++; - } - } -} -#endif /* DCOSYNCH_CONF_ENABLED */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f1xxx/rtimer-arch.c b/arch/cpu/msp430/f1xxx/rtimer-arch.c deleted file mode 100644 index 5d94dadc4..000000000 --- a/arch/cpu/msp430/f1xxx/rtimer-arch.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * MSP430-specific rtimer code - * \author - * Adam Dunkels - */ - -#include "contiki.h" - -#include "sys/rtimer.h" -#include "sys/process.h" -#include "dev/watchdog.h" -#include "isr_compat.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/*---------------------------------------------------------------------------*/ -ISR(TIMERA0, timera0) -{ - watchdog_start(); - - rtimer_run_next(); - - if(process_nevents() > 0) { - LPM4_EXIT; - } - - watchdog_stop(); -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_init(void) -{ - dint(); - - /* CCR0 interrupt enabled, interrupt occurs when timer equals CCR0. */ - TACCTL0 = CCIE; - - /* Enable interrupts. */ - eint(); -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -rtimer_arch_now(void) -{ - rtimer_clock_t t1, t2; - do { - t1 = TAR; - t2 = TAR; - } while(t1 != t2); - return t1; -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_schedule(rtimer_clock_t t) -{ - PRINTF("rtimer_arch_schedule time %u\n", t); - - TACCR0 = t; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f1xxx/spi-legacy.c b/arch/cpu/msp430/f1xxx/spi-legacy.c deleted file mode 100644 index 38adfaa31..000000000 --- a/arch/cpu/msp430/f1xxx/spi-legacy.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" - -/* - * On the Tmote sky access to I2C/SPI/UART0 must always be - * exclusive. Set spi_busy so that interrupt handlers can check if - * they are allowed to use the bus or not. Only the CC2420 radio needs - * this in practice. - * - */ -unsigned char spi_busy = 0; - -/* - * Initialize SPI bus. - */ -void -spi_init(void) -{ -/* - static unsigned char spi_inited = 0; - - if (spi_inited) - return; -*/ - /* Initalize ports for communication with SPI units. */ - - U0CTL = CHAR + SYNC + MM + SWRST; /* SW reset,8-bit transfer, SPI master */ - U0TCTL = CKPH + SSEL1 + STC; /* Data on Rising Edge, SMCLK, 3-wire. */ - - U0BR0 = 0x02; /* SPICLK set baud. */ - U0BR1 = 0; /* Dont need baud rate control register 2 - clear it */ - U0MCTL = 0; /* Dont need modulation control. */ - - P3SEL |= BV(SCK) | BV(MOSI) | BV(MISO); /* Select Peripheral functionality */ - P3DIR |= BV(SCK) | BV(MISO); /* Configure as outputs(SIMO,CLK). */ - - ME1 |= USPIE0; /* Module enable ME1 --> U0ME? xxx/bg */ - U0CTL &= ~SWRST; /* Remove RESET */ -} diff --git a/arch/cpu/msp430/f1xxx/uart1.c b/arch/cpu/msp430/f1xxx/uart1.c deleted file mode 100644 index 0de1a9761..000000000 --- a/arch/cpu/msp430/f1xxx/uart1.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/* - * Machine dependent MSP430 UART1 code. - */ - -#include "contiki.h" -#include "dev/uart1.h" -#include "dev/watchdog.h" -#include "sys/ctimer.h" -#include "lib/ringbuf.h" -#include "isr_compat.h" - -static int (*uart1_input_handler)(unsigned char c); -static volatile uint8_t rx_in_progress; - -static volatile uint8_t transmitting; - -#ifdef UART1_CONF_TX_WITH_INTERRUPT -#define TX_WITH_INTERRUPT UART1_CONF_TX_WITH_INTERRUPT -#else /* UART1_CONF_TX_WITH_INTERRUPT */ -#define TX_WITH_INTERRUPT 0 -#endif /* UART1_CONF_TX_WITH_INTERRUPT */ - -#ifdef UART1_CONF_RX_WITH_DMA -#define RX_WITH_DMA UART1_CONF_RX_WITH_DMA -#else /* UART1_CONF_RX_WITH_DMA */ -#define RX_WITH_DMA 1 -#endif /* UART1_CONF_RX_WITH_DMA */ - -#if TX_WITH_INTERRUPT -#define TXBUFSIZE 128 - -static struct ringbuf txbuf; -static uint8_t txbuf_data[TXBUFSIZE]; -#endif /* TX_WITH_INTERRUPT */ - -#if RX_WITH_DMA -#define RXBUFSIZE 128 - -static uint8_t rxbuf[RXBUFSIZE]; -static uint16_t last_size; -static struct ctimer rxdma_timer; - -static void -handle_rxdma_timer(void *ptr) -{ - uint16_t size; - size = DMA0SZ; /* Note: loop requires that size is less or eq to RXBUFSIZE */ - while(last_size != size) { -/* printf("read: %c [%d,%d]\n", (unsigned char)rxbuf[RXBUFSIZE - last_size], */ -/* last_size, size); */ - uart1_input_handler((unsigned char)rxbuf[RXBUFSIZE - last_size]); - last_size--; - if(last_size == 0) last_size = RXBUFSIZE; - } - - ctimer_reset(&rxdma_timer); -} -#endif /* RX_WITH_DMA */ - -/*---------------------------------------------------------------------------*/ -uint8_t -uart1_active(void) -{ - return ((~ UTCTL1) & TXEPT) | rx_in_progress | transmitting; -} -/*---------------------------------------------------------------------------*/ -void -uart1_set_input(int (*input)(unsigned char c)) -{ -#if RX_WITH_DMA /* This needs to be called after ctimer process is started */ - ctimer_set(&rxdma_timer, CLOCK_SECOND/64, handle_rxdma_timer, NULL); -#endif - uart1_input_handler = input; -} -/*---------------------------------------------------------------------------*/ -void -uart1_writeb(unsigned char c) -{ - watchdog_periodic(); -#if TX_WITH_INTERRUPT - - /* Put the outgoing byte on the transmission buffer. If the buffer - is full, we just keep on trying to put the byte into the buffer - until it is possible to put it there. */ - while(ringbuf_put(&txbuf, c) == 0); - - /* If there is no transmission going, we need to start it by putting - the first byte into the UART. */ - if(transmitting == 0) { - transmitting = 1; - - /* Loop until the transmission buffer is available. */ - /*while((IFG2 & UTXIFG1) == 0);*/ - TXBUF1 = ringbuf_get(&txbuf); - } - -#else /* TX_WITH_INTERRUPT */ - - /* Loop until the transmission buffer is available. */ - while((IFG2 & UTXIFG1) == 0); - - /* Transmit the data. */ - TXBUF1 = c; -#endif /* TX_WITH_INTERRUPT */ -} -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port. - * - */ -void -uart1_init(unsigned long ubr) -{ - /* RS232 */ - P3DIR &= ~0x80; /* Select P37 for input (UART1RX) */ - P3DIR |= 0x40; /* Select P36 for output (UART1TX) */ - P3SEL |= 0xC0; /* Select P36,P37 for UART1{TX,RX} */ - - UCTL1 = SWRST | CHAR; /* 8-bit character, UART mode */ - -#if 0 - U1RCTL &= ~URXEIE; /* even erroneous characters trigger interrupts */ -#endif - - UTCTL1 = SSEL1; /* UCLK = MCLK */ - - UBR01 = ubr; - UBR11 = ubr >> 8; - /* - * UMCTL1 values calculated using - * http://mspgcc.sourceforge.net/baudrate.html - */ - switch(ubr) { - -#if F_CPU == 3900000ul - - case UART1_BAUD2UBR(115200ul): - UMCTL1 = 0xF7; - break; - case UART1_BAUD2UBR(57600ul): - UMCTL1 = 0xED; - break; - case UART1_BAUD2UBR(38400ul): - UMCTL1 = 0xD6; - break; - case UART1_BAUD2UBR(19200ul): - UMCTL1 = 0x08; - break; - case UART1_BAUD2UBR(9600ul): - UMCTL1 = 0x22; - break; - -#elif F_CPU == 2457600ul - - case UART1_BAUD2UBR(115200ul): - UMCTL1 = 0x4A; - break; - case UART1_BAUD2UBR(57600ul): - UMCTL1 = 0x5B; - break; - default: - /* 9600, 19200, 38400 don't require any correction */ - UMCTL1 = 0x00; - -#else - -#error Unsupported CPU speed in uart1.c - -#endif - } - - ME2 &= ~USPIE1; /* USART1 SPI module disable */ - ME2 |= (UTXE1 | URXE1); /* Enable USART1 TXD/RXD */ - - UCTL1 &= ~SWRST; - - /* XXX Clear pending interrupts before enable!!! */ - IFG2 &= ~URXIFG1; - U1TCTL |= URXSE; - - rx_in_progress = 0; - - transmitting = 0; - - IE2 |= URXIE1; /* Enable USART1 RX interrupt */ -#if TX_WITH_INTERRUPT - ringbuf_init(&txbuf, txbuf_data, sizeof(txbuf_data)); - IE2 |= UTXIE1; /* Enable USART1 TX interrupt */ -#endif /* TX_WITH_INTERRUPT */ - -#if RX_WITH_DMA - IE2 &= ~URXIE1; /* disable USART1 RX interrupt */ - /* UART1_RX trigger */ - DMACTL0 = DMA0TSEL_9; - - /* source address = RXBUF1 */ - DMA0SA = (unsigned int) &RXBUF1; - DMA0DA = (unsigned int) &rxbuf; - DMA0SZ = RXBUFSIZE; - last_size = RXBUFSIZE; - DMA0CTL = DMADT_4 + DMASBDB + DMADSTINCR_3 + DMAEN + DMAREQ;// DMAIE; - - msp430_add_lpm_req(MSP430_REQUIRE_LPM1); -#endif /* RX_WITH_DMA */ -} -/*---------------------------------------------------------------------------*/ -#if !RX_WITH_DMA -ISR(UART1RX, uart1_rx_interrupt) -{ - uint8_t c; - - if(!(URXIFG1 & IFG2)) { - /* Edge detect if IFG not set? */ - U1TCTL &= ~URXSE; /* Clear the URXS signal */ - U1TCTL |= URXSE; /* Re-enable URXS - needed here?*/ - rx_in_progress = 1; - LPM4_EXIT; - } else { - rx_in_progress = 0; - /* Check status register for receive errors. */ - if(URCTL1 & RXERR) { - c = RXBUF1; /* Clear error flags by forcing a dummy read. */ - } else { - c = RXBUF1; - if(uart1_input_handler != NULL) { - if(uart1_input_handler(c)) { - LPM4_EXIT; - } - } - } - } -} -#endif /* !RX_WITH_DMA */ -/*---------------------------------------------------------------------------*/ -#if TX_WITH_INTERRUPT -ISR(UART1TX, uart1_tx_interrupt) -{ - if(ringbuf_elements(&txbuf) == 0) { - transmitting = 0; - } else { - TXBUF1 = ringbuf_get(&txbuf); - } -} -#endif /* TX_WITH_INTERRUPT */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f2xxx/msp430.c b/arch/cpu/msp430/f2xxx/msp430.c deleted file mode 100644 index c6552e058..000000000 --- a/arch/cpu/msp430/f2xxx/msp430.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -#include "contiki.h" -#include "dev/watchdog.h" - -/* dco_required set to 1 will cause the CPU not to go into - * sleep modes where the DCO clock stopped */ -int msp430_dco_required; - -#if defined(__MSP430__) && defined(__GNUC__) -#define asmv(arg) __asm__ __volatile__ (arg) -#endif - -/*---------------------------------------------------------------------------*/ -#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND -void * -w_memcpy(void *out, const void *in, size_t n) -{ - uint8_t *src, *dest; - src = (uint8_t *)in; - dest = (uint8_t *)out; - while(n-- > 0) { - *dest++ = *src++; - } - return out; -} -#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */ -/*---------------------------------------------------------------------------*/ -#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND -void * -w_memset(void *out, int value, size_t n) -{ - uint8_t *dest; - dest = (uint8_t *)out; - while(n-- > 0) { - *dest++ = value & 0xff; - } - return out; -} -#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */ -/*---------------------------------------------------------------------------*/ -void -msp430_init_dco(void) -{ - if(CALBC1_8MHZ != 0xFF) { - DCOCTL = 0x00; - BCSCTL1 = CALBC1_8MHZ; /*Set DCO to 8MHz */ - DCOCTL = CALDCO_8MHZ; - } else { /*start using reasonable values at 8 Mhz */ - DCOCTL = 0x00; - BCSCTL1 = 0x8D; - DCOCTL = 0x88; - } - - /*BCSCTL1 |= XT2OFF; // Make sure XT2 is off */ - /* BCSCTL2 = 0x00; // MCLK = DCOCLK/1 */ - /* SMCLK = DCOCLK/1 */ - /* DCO Internal Resistor */ -} -/*---------------------------------------------------------------------------*/ -static void -init_ports(void) -{ - /* Turn everything off, device drivers enable what is needed. */ - - /* All configured for digital I/O */ -#ifdef P1SEL - P1SEL = 0; -#endif -#ifdef P2SEL - P2SEL = 0; -#endif -#ifdef P3SEL - P3SEL = 0; -#endif -#ifdef P4SEL - P4SEL = 0; -#endif -#ifdef P5SEL - P5SEL = 0; -#endif -#ifdef P6SEL - P6SEL = 0; -#endif - - /* All available inputs */ -#ifdef P1DIR - P1DIR = 0; - P1OUT = 0; -#endif -#ifdef P2DIR - P2DIR = 0; - P2OUT = 0; -#endif -#ifdef P3DIR - P3DIR = 0; - P3OUT = 0; -#endif -#ifdef P4DIR - P4DIR = 0; - P4OUT = 0; -#endif - -#ifdef P5DIR - P5DIR = 0; - P5OUT = 0; -#endif - -#ifdef P6DIR - P6DIR = 0; - P6OUT = 0; -#endif - -#ifdef P7DIR - P7DIR = 0; - P7OUT = 0; -#endif - -#ifdef P8DIR - P8DIR = 0; - P8OUT = 0; -#endif - - P1IE = 0; - P2IE = 0; -} -/*---------------------------------------------------------------------------*/ -/* msp430-ld may align _end incorrectly. Workaround in cpu_init. */ -#if defined(__MSP430__) && defined(__GNUC__) -extern int _end; /* Not in sys/unistd.h */ -static char *cur_break = (char *)&_end; -#endif - -/*---------------------------------------------------------------------------*/ -/* add/remove_lpm_req - for requiring a specific LPM mode. currently Contiki */ -/* jumps to LPM3 to save power, but DMA will not work if DCO is not clocked */ -/* so some modules might need to enter their LPM requirements */ -/* NOTE: currently only works with LPM1 (e.g. DCO) requirements. */ -/*---------------------------------------------------------------------------*/ -void -msp430_add_lpm_req(int req) -{ - if(req <= MSP430_REQUIRE_LPM1) { - msp430_dco_required++; - } -} -void -msp430_remove_lpm_req(int req) -{ - if(req <= MSP430_REQUIRE_LPM1) { - msp430_dco_required--; - } -} -void -msp430_cpu_init(void) -{ - dint(); - watchdog_init(); - init_ports(); - /* set DCO to a reasonable default value (8MHz) */ - msp430_init_dco(); - /* calibrate the DCO step-by-step */ - msp430_sync_dco(); - eint(); -#if defined(__MSP430__) && defined(__GNUC__) - if((uintptr_t)cur_break & 1) { /* Workaround for msp430-ld bug! */ - cur_break++; - } -#endif - msp430_dco_required = 0; -} -/*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------*/ -/* - * Mask all interrupts that can be masked. - */ -int -splhigh_(void) -{ - /* Clear the GIE (General Interrupt Enable) flag. */ - int sr; -#ifdef __IAR_SYSTEMS_ICC__ - sr = __get_SR_register(); - __bic_SR_register(GIE); -#else - asmv("mov r2, %0" : "=r" (sr)); - asmv("bic %0, r2" : : "i" (GIE)); -#endif - return sr & GIE; /* Ignore other sr bits. */ -} -/*---------------------------------------------------------------------------*/ -/* - * Restore previous interrupt mask. - */ -/* void */ -/* splx_(int sr) */ -/* { */ -/* #ifdef __IAR_SYSTEMS_ICC__ */ -/* __bis_SR_register(sr); */ -/* #else */ -/* /\* If GIE was set, restore it. *\/ */ -/* asmv("bis %0, r2" : : "r" (sr)); */ -/* #endif */ -/* } */ -/*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -int -__low_level_init(void) -{ - /* turn off watchdog so that C-init will run */ - WDTCTL = WDTPW + WDTHOLD; - /* - * Return value: - * - * 1 - Perform data segment initialization. - * 0 - Skip data segment initialization. - */ - return 1; -} -#endif -/*---------------------------------------------------------------------------*/ -void -msp430_sync_dco(void) -{ - uint16_t oldcapture; - int16_t diff; - /* DELTA_2 assumes an ACLK of 32768 Hz */ -#define DELTA_2 ((MSP430_CPU_SPEED) / 32768) - - /* Select SMCLK clock, and capture on ACLK for TBCCR6 */ - TBCTL = TBSSEL1 | TBCLR; - TBCCTL6 = CCIS0 + CM0 + CAP; - /* start the timer */ - TBCTL |= MC1; - - while(1) { - /* wait for the next capture */ - TBCCTL6 &= ~CCIFG; - while(!(TBCCTL6 & CCIFG)); - oldcapture = TBCCR6; - - /* wait for the next capture - and calculate difference */ - TBCCTL6 &= ~CCIFG; - while(!(TBCCTL6 & CCIFG)); - diff = TBCCR6 - oldcapture; - - /* resynchronize the DCO speed if not at target */ - if(DELTA_2 == diff) { - break; /* if equal, leave "while(1)" */ - } else if(DELTA_2 < diff) { /* DCO is too fast, slow it down */ - DCOCTL--; - if(DCOCTL == 0xFF) { /* Did DCO roll under? */ - BCSCTL1--; - } - } else { /* -> Select next lower RSEL */ - DCOCTL++; - if(DCOCTL == 0x00) { /* Did DCO roll over? */ - BCSCTL1++; - } - /* -> Select next higher RSEL */ - } - } - - /* Stop the timer - conserves energy according to user guide */ - TBCTL = 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f2xxx/spi-legacy.c b/arch/cpu/msp430/f2xxx/spi-legacy.c deleted file mode 100644 index 122983bd8..000000000 --- a/arch/cpu/msp430/f2xxx/spi-legacy.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" - -/* - * This is SPI initialization code for the MSP430X architecture. - * - */ -unsigned char spi_busy = 0; - -/* - * Initialize SPI bus. - */ -void -spi_init(void) -{ - // Initialize ports for communication with SPI units. - - UCB0CTL1 |= UCSWRST; //reset usci - UCB0CTL1 |= UCSSEL_2; //smclk while usci is reset - UCB0CTL0 = ( UCMSB | UCMST | UCSYNC | UCCKPL); // MSB-first 8-bit, Master, Synchronous, 3 pin SPI master, no ste, watch-out for clock-phase UCCKPH - - UCB0BR1 = 0x00; - UCB0BR0 = 0x02; - -// UCB0MCTL = 0; // Dont need modulation control. - - P3SEL |= BV(SCK) | BV(MOSI) | BV(MISO); // Select Peripheral functionality - P3DIR |= BV(SCK) | BV(MISO); // Configure as outputs(SIMO,CLK). - - //ME1 |= USPIE0; // Module enable ME1 --> U0ME? xxx/bg - - // Clear pending interrupts before enable!!! - IFG2 &= ~UCB0RXIFG; - IFG2 &= ~UCB0TXIFG; - /* UCB0IE &= ~UCRXIFG; */ - /* UCB0IE &= ~UCTXIFG; */ - UCB0CTL1 &= ~UCSWRST; // Remove RESET before enabling interrupts - - //Enable UCB0 Interrupts - //IE2 |= UCB0TXIE; // Enable USCI_B0 TX Interrupts - //IE2 |= UCB0RXIE; // Enable USCI_B0 RX Interrupts -} diff --git a/arch/cpu/msp430/f2xxx/uart0.c b/arch/cpu/msp430/f2xxx/uart0.c deleted file mode 100644 index cfe9e5904..000000000 --- a/arch/cpu/msp430/f2xxx/uart0.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/* - * Machine dependent MSP430X UART0 code. - */ - -#include - -#include "contiki.h" -#include "dev/uart0.h" -#include "dev/watchdog.h" -#include "lib/ringbuf.h" -#include "isr_compat.h" - -static int (*uart0_input_handler)(unsigned char c); - -static volatile uint8_t transmitting; - -#ifdef UART0_CONF_TX_WITH_INTERRUPT -#define TX_WITH_INTERRUPT UART0_CONF_TX_WITH_INTERRUPT -#else /* UART0_CONF_TX_WITH_INTERRUPT */ -#define TX_WITH_INTERRUPT 1 -#endif /* UART0_CONF_TX_WITH_INTERRUPT */ - -#ifdef UART0_CONF_RX_WITH_DMA -#define RX_WITH_DMA UART0_CONF_RX_WITH_DMA -#else /* UART0_CONF_RX_WITH_DMA */ -#define RX_WITH_DMA 1 -#endif /* UART0_CONF_RX_WITH_DMA */ - -#if TX_WITH_INTERRUPT -#define TXBUFSIZE 64 - -static struct ringbuf txbuf; -static uint8_t txbuf_data[TXBUFSIZE]; -#endif /* TX_WITH_INTERRUPT */ - -#if RX_WITH_DMA -#define RXBUFSIZE 128 - -static uint8_t rxbuf[RXBUFSIZE]; -static uint16_t last_size; -static struct ctimer rxdma_timer; - -static void -handle_rxdma_timer(void *ptr) -{ - uint16_t size; - size = DMA0SZ; /* Note: loop requires that size is less or eq to RXBUFSIZE */ - while(last_size != size) { - uart0_input_handler((unsigned char)rxbuf[RXBUFSIZE - last_size]); - last_size--; - if(last_size == 0) { - last_size = RXBUFSIZE; - } - } - - ctimer_reset(&rxdma_timer); -} -#endif /* RX_WITH_DMA */ - -/*---------------------------------------------------------------------------*/ -uint8_t -uart0_active(void) -{ - return (UCA0STAT & UCBUSY) | transmitting; -} -/*---------------------------------------------------------------------------*/ -void -uart0_set_input(int (*input)(unsigned char c)) -{ -#if RX_WITH_DMA /* This needs to be called after ctimer process is started */ - ctimer_set(&rxdma_timer, CLOCK_SECOND / 64, handle_rxdma_timer, NULL); -#endif - uart0_input_handler = input; -} -/*---------------------------------------------------------------------------*/ -void -uart0_writeb(unsigned char c) -{ - watchdog_periodic(); -#if TX_WITH_INTERRUPT - /* Put the outgoing byte on the transmission buffer. If the buffer - is full, we just keep on trying to put the byte into the buffer - until it is possible to put it there. */ - while(ringbuf_put(&txbuf, c) == 0); - - /* If there is no transmission going, we need to start it by putting - the first byte into the UART. */ - if(transmitting == 0) { - transmitting = 1; - UCA0TXBUF = ringbuf_get(&txbuf); - } - -#else /* TX_WITH_INTERRUPT */ - - /* Loop until the transmission buffer is available. */ - /*Enric while((IFG2 & UCA0TXIFG) == 0); */ - while((UCA0STAT & UCBUSY)); - - /* Transmit the data. */ - UCA0TXBUF = c; -#endif /* TX_WITH_INTERRUPT */ -} -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port. - * - */ -void -uart0_init(unsigned long ubr) -{ - /* RS232 */ - UCA0CTL1 |= UCSWRST; /* Hold peripheral in reset state */ - UCA0CTL1 |= UCSSEL_2; /* CLK = SMCLK */ - - UCA0BR0 = ((uint8_t *)&ubr)[0]; /* 8MHz/115200 = 69 = 0x45 */ - UCA0BR1 = ((uint8_t *)&ubr)[1]; - UCA0MCTL = UCBRS_3; /* Modulation UCBRSx = 3 */ - - P3DIR &= ~0x20; /* P3.5 = USCI_A0 RXD as input */ - P3DIR |= 0x10; /* P3.4 = USCI_A0 TXD as output */ - P3SEL |= 0x30; /* P3.4,5 = USCI_A0 TXD/RXD */ - /*UCA0CTL1 &= ~UCSWRST;*/ /* Initialize USCI state machine */ - - transmitting = 0; - - /* XXX Clear pending interrupts before enable */ - IFG2 &= ~UCA0RXIFG; - IFG2 &= ~UCA0TXIFG; - UCA0CTL1 &= ~UCSWRST; /* Initialize USCI state machine **before** enabling interrupts */ - IE2 |= UCA0RXIE; /* Enable UCA0 RX interrupt */ - /* Enable USCI_A0 TX interrupts (if TX_WITH_INTERRUPT enabled) */ -#if TX_WITH_INTERRUPT - ringbuf_init(&txbuf, txbuf_data, sizeof(txbuf_data)); - IE2 |= UCA0TXIE; /* Enable UCA0 TX interrupt */ -#endif /* TX_WITH_INTERRUPT */ - -#if RX_WITH_DMA - IE2 &= ~UCA0RXIE; /* disable USART0 RX interrupt */ - /* UART0_RX trigger */ - DMACTL0 = DMA0TSEL_3; - - /* source address = UCA0RXBUF */ - DMA0SA = (unsigned int)&UCA0RXBUF; - DMA0DA = (unsigned int)&rxbuf; - DMA0SZ = RXBUFSIZE; - last_size = RXBUFSIZE; - DMA0CTL = DMADT_4 + DMASBDB + DMADSTINCR_3 + DMAEN + DMAREQ; - - msp430_add_lpm_req(MSP430_REQUIRE_LPM1); -#endif /* RX_WITH_DMA */ -} -/*---------------------------------------------------------------------------*/ -#if !RX_WITH_DMA -ISR(USCIAB0RX, uart0_rx_interrupt) -{ - uint8_t c; - - if(UCA0STAT & UCRXERR) { - c = UCA0RXBUF; /* Clear error flags by forcing a dummy read. */ - } else { - c = UCA0RXBUF; - if(uart0_input_handler != NULL) { - if(uart0_input_handler(c)) { - LPM4_EXIT; - } - } - } -} -#endif /* !RX_WITH_DMA */ -/*---------------------------------------------------------------------------*/ -#if TX_WITH_INTERRUPT -ISR(USCIAB0TX, uart0_tx_interrupt) -{ - if((IFG2 & UCA0TXIFG)) { - - if(ringbuf_elements(&txbuf) == 0) { - transmitting = 0; - } else { - UCA0TXBUF = ringbuf_get(&txbuf); - } - } - - /* In a stand-alone app won't work without this. Is the UG misleading? */ - IFG2 &= ~UCA0TXIFG; -} -#endif /* TX_WITH_INTERRUPT */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f2xxx/uart1.c b/arch/cpu/msp430/f2xxx/uart1.c deleted file mode 100644 index 5a94726b9..000000000 --- a/arch/cpu/msp430/f2xxx/uart1.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/* - * Machine dependent MSP430X UART1 code. - */ -#include "contiki.h" -#include -#include "dev/uart1.h" -#include "dev/watchdog.h" -#include "lib/ringbuf.h" -#include "isr_compat.h" - -static int (*uart1_input_handler)(unsigned char c); - -static volatile uint8_t transmitting; - -#ifdef UART1_CONF_TX_WITH_INTERRUPT -#define TX_WITH_INTERRUPT UART1_CONF_TX_WITH_INTERRUPT -#else /* UART1_CONF_TX_WITH_INTERRUPT */ -#define TX_WITH_INTERRUPT 1 -#endif /* UART1_CONF_TX_WITH_INTERRUPT */ - -#if TX_WITH_INTERRUPT -#define TXBUFSIZE 64 - -static struct ringbuf txbuf; -static uint8_t txbuf_data[TXBUFSIZE]; -#endif /* TX_WITH_INTERRUPT */ - -/*---------------------------------------------------------------------------*/ -uint8_t -uart1_active(void) -{ - return (UCA0STAT & UCBUSY) | transmitting; -} -/*---------------------------------------------------------------------------*/ -void -uart1_set_input(int (*input)(unsigned char c)) -{ - uart1_input_handler = input; -} -/*---------------------------------------------------------------------------*/ -void -uart1_writeb(unsigned char c) -{ - /* watchdog_periodic(); */ -#if TX_WITH_INTERRUPT - - /* Put the outgoing byte on the transmission buffer. If the buffer - is full, we just keep on trying to put the byte into the buffer - until it is possible to put it there. */ - while(ringbuf_put(&txbuf, c) == 0); - - /* If there is no transmission going, we need to start it by putting - the first byte into the UART. */ - if(transmitting == 0) { - transmitting = 1; - UCA0TXBUF = ringbuf_get(&txbuf); - } - -#else /* TX_WITH_INTERRUPT */ - - /* Loop until the transmission buffer is available. */ - while(!(IFG2 & UCA0TXIFG)); - - /* Transmit the data. */ - UCA0TXBUF = c; -#endif /* TX_WITH_INTERRUPT */ -} -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port. - * - */ -void -uart1_init(unsigned long ubr) -{ - /* RS232 */ - P3SEL |= 0x30; /* P3.4,5 = USCI_A0 TXD/RXD */ - UCA0CTL1 |= UCSSEL_2; /* CLK = SMCLK */ - UCA0BR0 = 0x45; /* 8MHz/115200 = 69 = 0x45 */ - UCA0BR1 = 0x00; - UCA0MCTL = UCBRS2; /* Modulation UCBRSx = 4 */ - UCA0CTL1 &= ~UCSWRST; /* Initialize USCI state machine */ - - transmitting = 0; - -} -/*---------------------------------------------------------------------------*/ -ISR(USCIAB1RX, uart1_rx_interrupt) -{ - uint8_t c; - - /* Check status register for receive errors. */ - if(UCA0STAT & UCRXERR) { - c = UCA0RXBUF; /* Clear error flags by forcing a dummy read. */ - } else { - c = UCA0RXBUF; - if(uart1_input_handler != NULL) { - if(uart1_input_handler(c)) { - LPM4_EXIT; - } - } - } -} -/*---------------------------------------------------------------------------*/ -#if TX_WITH_INTERRUPT -ISR(USCIAB1TX, uart1_tx_interrupt) -{ - if(IFG2 & UCA0TXIFG) { - if(ringbuf_elements(&txbuf) == 0) { - transmitting = 0; - } else { - UCA0TXBUF = ringbuf_get(&txbuf); - } - } -} -#endif /* TX_WITH_INTERRUPT */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f5xxx/clock.c b/arch/cpu/msp430/f5xxx/clock.c deleted file mode 100644 index 9cb88f67f..000000000 --- a/arch/cpu/msp430/f5xxx/clock.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -#include "contiki.h" -#include "sys/clock.h" -#include "sys/etimer.h" -#include "sys/energest.h" -#include "rtimer-arch.h" -#include "dev/watchdog.h" -#include "isr_compat.h" - -#define INTERVAL (RTIMER_ARCH_SECOND / CLOCK_SECOND) - -#define MAX_TICKS (~((clock_time_t)0) / 2) - -#define CLOCK_LT(a, b) ((int16_t)((a)-(b)) < 0) - -static volatile unsigned long seconds; - -static volatile clock_time_t count = 0; -/* last_tar is used for calculating clock_fine, last_ccr might be better? */ -static volatile uint16_t last_tar = 0; -/*---------------------------------------------------------------------------*/ -static inline uint16_t -read_tar(void) -{ - /* Same as clock_counter(), but can be inlined */ - uint16_t t1, t2; - do { - t1 = TA1R; - t2 = TA1R; - } while(t1 != t2); - return t1; -} -/*---------------------------------------------------------------------------*/ -ISR(TIMER1_A1, timera1) -{ - /* watchdog_start(); */ - - if(TA1IV == 2) { - - /* HW timer bug fix: Interrupt handler called before TR==CCR. - * Occurs when timer state is toggled between STOP and CONT. */ - while(TA1CTL & MC1 && TA1CCR1 - TA1R == 1); - - last_tar = read_tar(); - /* Make sure interrupt time is future */ - while(!CLOCK_LT(last_tar, TA1CCR1)) { - TA1CCR1 += INTERVAL; - ++count; - - /* Make sure the CLOCK_CONF_SECOND is a power of two, to ensure - that the modulo operation below becomes a logical and and not - an expensive divide. Algorithm from Wikipedia: - http://en.wikipedia.org/wiki/Power_of_two */ -#if (CLOCK_CONF_SECOND & (CLOCK_CONF_SECOND - 1)) != 0 -#error CLOCK_CONF_SECOND must be a power of two (i.e., 1, 2, 4, 8, 16, 32, 64, ...). -#error Change CLOCK_CONF_SECOND in contiki-conf.h. -#endif - if(count % CLOCK_CONF_SECOND == 0) { - ++seconds; - energest_flush(); - } - last_tar = read_tar(); - } - - if(etimer_pending() && - (etimer_next_expiration_time() - count - 1) > MAX_TICKS) { - etimer_request_poll(); - LPM4_EXIT; - } - - } - /* if(process_nevents() >= 0) { - LPM4_EXIT; - }*/ - - /* watchdog_stop(); */ -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - clock_time_t t1, t2; - do { - t1 = count; - t2 = count; - } while(t1 != t2); - return t1; -} -/*---------------------------------------------------------------------------*/ -void -clock_set(clock_time_t clock, clock_time_t fclock) -{ - TA1R = fclock; - TA1CCR1 = fclock + INTERVAL; - count = clock; -} -/*---------------------------------------------------------------------------*/ -int -clock_fine_max(void) -{ - return INTERVAL; -} -/*---------------------------------------------------------------------------*/ -unsigned short -clock_fine(void) -{ - unsigned short t; - /* Assign last_tar to local varible that can not be changed by interrupt */ - t = last_tar; - /* perform calc based on t, TAR will not be changed during interrupt */ - return (unsigned short) (TA1R - t); -} -/*---------------------------------------------------------------------------*/ -void -clock_init(void) -{ - dint(); - - /* Select SMCLK (2.4576MHz), clear TAR */ - /* TACTL = TASSEL1 | TACLR | ID_3; */ - - /* Select ACLK 32768Hz clock, divide by 2 */ -/* TA1CTL = TASSEL0 | TACLR | ID_1; */ - -#if INTERVAL==32768/CLOCK_SECOND - TA1CTL = TASSEL0 | TACLR; -#elif INTERVAL==16384/CLOCK_SECOND - TA1CTL = TASSEL0 | TACLR | ID_1; -#else -#error NEED TO UPDATE clock.c to match interval! -#endif - - /* Initialize ccr1 to create the X ms interval. */ - /* CCR1 interrupt enabled, interrupt occurs when timer equals CCR1. */ - TA1CCTL1 = CCIE; - - /* Interrupt after X ms. */ - TA1CCR1 = INTERVAL; - - /* Start Timer_A in continuous mode. */ - TA1CTL |= MC1; - - count = 0; - - /* Enable interrupts. */ - eint(); - -} -/*---------------------------------------------------------------------------*/ -/** - * Delay the CPU for a multiple of 2.83 us. - */ -void -clock_delay(unsigned int i) -{ - while(i--) { - _NOP(); - } -} -/*---------------------------------------------------------------------------*/ -/* - * Wait for a multiple of 10 ms. - * - */ -void -clock_wait(clock_time_t i) -{ - clock_time_t start; - - start = clock_time(); - while(clock_time() - start < (clock_time_t)i); -} -/*---------------------------------------------------------------------------*/ -void -clock_set_seconds(unsigned long sec) -{ - int s; - s = splhigh(); - seconds = sec; - splx(s); -} -/*---------------------------------------------------------------------------*/ -unsigned long -clock_seconds(void) -{ - unsigned long t1, t2; - do { - t1 = seconds; - t2 = seconds; - } while(t1 != t2); - return t1; -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -clock_counter(void) -{ - rtimer_clock_t t1, t2; - do { - t1 = TA1R; - t2 = TA1R; - } while(t1 != t2); - return t1; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f5xxx/msp430.c b/arch/cpu/msp430/f5xxx/msp430.c deleted file mode 100644 index cc678ee36..000000000 --- a/arch/cpu/msp430/f5xxx/msp430.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ -#include "contiki.h" -#include "dev/watchdog.h" - -/* dco_required set to 1 will cause the CPU not to go into - sleep modes where the DCO clock stopped */ -int msp430_dco_required; - -#if defined(__MSP430__) && defined(__GNUC__) -#define asmv(arg) __asm__ __volatile__(arg) -#endif -/*---------------------------------------------------------------------------*/ -void -msp430_init_dco(void) -{ -#ifdef __IAR_SYSTEMS_ICC__ - __bis_SR_register(SCG0); -#else - asmv("bis %0, r2" : : "i" (SCG0)); -#endif - - UCSCTL0 = 0x0000; - UCSCTL1 = DCORSEL_4; - - UCSCTL2 = MSP430_CPU_SPEED / 32768; - UCSCTL4 = 0x33; /* instead of 0x44 that is DCO/2 */ - -#ifdef __IAR_SYSTEMS_ICC__ - __bic_SR_register(SCG0); -#else - asmv("bic %0, r2" : : "i" (SCG0)); -#endif -} -/*---------------------------------------------------------------------------*/ - -static void -init_ports(void) -{ - /* Turn everything off, device drivers enable what is needed. */ - /* All configured for digital I/O */ -#ifdef P1SEL - P1SEL = 0; -#endif -#ifdef P2SEL - P2SEL = 0; -#endif -#ifdef P3SEL - P3SEL = 0; -#endif -#ifdef P4SEL - P4SEL = 0; -#endif -#ifdef P5SEL - P5SEL = 0; -#endif -#ifdef P6SEL - P6SEL = 0; -#endif - - /* All available inputs */ -#ifdef P1DIR - P1DIR = 0; - P1OUT = 0; -#endif -#ifdef P2DIR - P2DIR = 0; - P2OUT = 0; -#endif -#ifdef P3DIR - P3DIR = 0; - P3OUT = 0; -#endif -#ifdef P4DIR - P4DIR = 0; - P4OUT = 0; -#endif - -#ifdef P5DIR - P5DIR = 0; - P5OUT = 0; -#endif - -#ifdef P6DIR - P6DIR = 0; - P6OUT = 0; -#endif - -#ifdef P7DIR - P7DIR = 0; - P7OUT = 0; -#endif - -#ifdef P8DIR - P8DIR = 0; - P8OUT = 0; -#endif - - P1IE = 0; - P2IE = 0; -} -/*---------------------------------------------------------------------------*/ -/* msp430-ld may align _end incorrectly. Workaround in cpu_init. */ -#if defined(__MSP430__) && defined(__GNUC__) -extern int _end; /* Not in sys/unistd.h */ -static char *cur_break = (char *)&_end; -#endif - -/*---------------------------------------------------------------------------*/ -/* add/remove_lpm_req - for requiring a specific LPM mode. currently Contiki */ -/* jumps to LPM3 to save power, but DMA will not work if DCO is not clocked */ -/* so some modules might need to enter their LPM requirements */ -/* NOTE: currently only works with LPM1 (e.g. DCO) requirements. */ -/*---------------------------------------------------------------------------*/ -void -msp430_add_lpm_req(int req) -{ - if(req <= MSP430_REQUIRE_LPM1) { - msp430_dco_required++; - } -} - -void -msp430_remove_lpm_req(int req) -{ - if(req <= MSP430_REQUIRE_LPM1) { - msp430_dco_required--; - } -} - -void -msp430_cpu_init(void) -{ - dint(); - watchdog_init(); - init_ports(); - msp430_init_dco(); - eint(); -#if defined(__MSP430__) && defined(__GNUC__) - if((uintptr_t)cur_break & 1) { /* Workaround for msp430-ld bug! */ - cur_break++; - } -#endif - - msp430_dco_required = 0; -} -/*---------------------------------------------------------------------------*/ - -#define STACK_EXTRA 32 - -/* - * Allocate memory from the heap. Check that we don't collide with the - * stack right now (some other routine might later). A watchdog might - * be used to check if cur_break and the stack pointer meet during - * runtime. - */ -#if defined(__MSP430__) && defined(__GNUC__) -void * -sbrk(int incr) -{ - char *stack_pointer; - - asmv("mov r1, %0" : "=r" (stack_pointer)); - stack_pointer -= STACK_EXTRA; - if(incr > (stack_pointer - cur_break)) - return (void *)-1; /* ENOMEM */ - - void *old_break = cur_break; - cur_break += incr; - /* - * If the stack was never here then [old_break .. cur_break] should - * be filled with zeros. - */ - return old_break; -} -#endif -/*---------------------------------------------------------------------------*/ -/* - * Mask all interrupts that can be masked. - */ -int -splhigh_(void) -{ - int sr; - /* Clear the GIE (General Interrupt Enable) flag. */ -#ifdef __IAR_SYSTEMS_ICC__ - sr = __get_SR_register(); - __bic_SR_register(GIE); -#else - asmv("mov r2, %0" : "=r" (sr)); - asmv("bic %0, r2" : : "i" (GIE)); -#endif - return sr & GIE; /* Ignore other sr bits. */ -} -/*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -int __low_level_init(void) -{ - /* turn off watchdog so that C-init will run */ - WDTCTL = WDTPW + WDTHOLD; - /* - * Return value: - * - * 1 - Perform data segment initialization. - * 0 - Skip data segment initialization. - */ - return 1; -} -#endif -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f5xxx/rtimer-arch.c b/arch/cpu/msp430/f5xxx/rtimer-arch.c deleted file mode 100644 index 7ed8e9cc3..000000000 --- a/arch/cpu/msp430/f5xxx/rtimer-arch.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * MSP430-specific rtimer code for MSP430X - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "sys/rtimer.h" -#include "sys/process.h" -#include "dev/watchdog.h" -#include "isr_compat.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/*---------------------------------------------------------------------------*/ -ISR(TIMER1_A0, timera0) -{ - watchdog_start(); - - rtimer_run_next(); - - if(process_nevents() > 0) { - LPM4_EXIT; - } - - watchdog_stop(); -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_init(void) -{ - dint(); - - /* CCR0 interrupt enabled, interrupt occurs when timer equals CCR0. */ - TA1CCTL0 = CCIE; - - /* Enable interrupts. */ - eint(); -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -rtimer_arch_now(void) -{ - rtimer_clock_t t1, t2; - do { - t1 = TA1R; - t2 = TA1R; - } while(t1 != t2); - return t1; -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_schedule(rtimer_clock_t t) -{ - PRINTF("rtimer_arch_schedule time %u\n", t); - - TA1CCR0 = t; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f5xxx/spi-legacy.c b/arch/cpu/msp430/f5xxx/spi-legacy.c deleted file mode 100644 index b92ca0ec7..000000000 --- a/arch/cpu/msp430/f5xxx/spi-legacy.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" - -/* - * This is SPI initialization code for the MSP430X architecture. - * - */ - -unsigned char spi_busy = 0; - -/* - * Initialize SPI bus. - */ -void -spi_init(void) -{ - // Initialize ports for communication with SPI units. - - UCB0CTL1 |= UCSWRST; //reset usci - UCB0CTL1 |= UCSSEL_2; //smclk while usci is reset - UCB0CTL0 = ( UCMSB | UCMST | UCSYNC | UCCKPL); // MSB-first 8-bit, Master, Synchronous, 3 pin SPI master, no ste, watch-out for clock-phase UCCKPH - - UCB0BR1 = 0x00; - UCB0BR0 = 0x02; - -// UCB0MCTL = 0; // Dont need modulation control. - - P3SEL |= BV(SCK) | BV(MOSI) | BV(MISO); // Select Peripheral functionality - P3DIR |= BV(SCK) | BV(MISO); // Configure as outputs(SIMO,CLK). - - //ME1 |= USPIE0; // Module enable ME1 --> U0ME? xxx/bg - - // Clear pending interrupts before enable!!! - UCB0IE &= ~UCRXIFG; - UCB0IE &= ~UCTXIFG; - UCB0CTL1 &= ~UCSWRST; // Remove RESET before enabling interrupts - - //Enable UCB0 Interrupts - //IE2 |= UCB0TXIE; // Enable USCI_B0 TX Interrupts - //IE2 |= UCB0RXIE; // Enable USCI_B0 RX Interrupts -} diff --git a/arch/cpu/msp430/f5xxx/uart0.c b/arch/cpu/msp430/f5xxx/uart0.c deleted file mode 100644 index 8bab9f40f..000000000 --- a/arch/cpu/msp430/f5xxx/uart0.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ - -/* - * Yet another machine dependent MSP430X UART0 code. - * IF2, etc. can not be used here... need to abstract to some macros - * later. - */ - -#include "contiki.h" -#include -#include "dev/uart0.h" -#include "dev/watchdog.h" -#include "isr_compat.h" - -static int (*uart0_input_handler)(unsigned char c); - -static volatile uint8_t transmitting; - -/*---------------------------------------------------------------------------*/ -uint8_t -uart0_active(void) -{ - return (UCA0STAT & UCBUSY) | transmitting; -} -/*---------------------------------------------------------------------------*/ -void -uart0_set_input(int (*input)(unsigned char c)) -{ - uart0_input_handler = input; -} -/*---------------------------------------------------------------------------*/ -void -uart0_writeb(unsigned char c) -{ - watchdog_periodic(); - /* Loop until the transmission buffer is available. */ - while((UCA0STAT & UCBUSY)); - - /* Transmit the data. */ - UCA0TXBUF = c; -} -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port. - * - */ -void -uart0_init(unsigned long ubr) -{ - /* RS232 */ - UCA0CTL1 |= UCSWRST; /* Hold peripheral in reset state */ - UCA0CTL1 |= UCSSEL_2; /* CLK = SMCLK */ - - ubr = (MSP430_CPU_SPEED / ubr); - UCA0BR0 = ubr & 0xff; - UCA0BR1 = (ubr >> 8) & 0xff; - UCA0MCTL = UCBRS_3; /* Modulation UCBRSx = 3 */ - P3DIR &= ~0x20; /* P3.5 = USCI_A0 RXD as input */ - P3DIR |= 0x10; /* P3.4 = USCI_A0 TXD as output */ - P3SEL |= 0x30; /* P3.4,5 = USCI_A0 TXD/RXD */ - - /*UCA0CTL1 &= ~UCSWRST;*/ /* Initialize USCI state machine */ - - transmitting = 0; - - /* XXX Clear pending interrupts before enable */ - UCA0IE &= ~UCRXIFG; - UCA0IE &= ~UCTXIFG; - - UCA0CTL1 &= ~UCSWRST; /* Initialize USCI state machine **before** enabling interrupts */ - UCA0IE |= UCRXIE; /* Enable UCA0 RX interrupt */ -} -/*---------------------------------------------------------------------------*/ -ISR(USCI_A0, uart0_rx_interrupt) -{ - uint8_t c; - - if(UCA0IV == 2) { - if(UCA0STAT & UCRXERR) { - c = UCA0RXBUF; /* Clear error flags by forcing a dummy read. */ - } else { - c = UCA0RXBUF; - if(uart0_input_handler != NULL) { - if(uart0_input_handler(c)) { - LPM4_EXIT; - } - } - } - } -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/f5xxx/uart1.c b/arch/cpu/msp430/f5xxx/uart1.c deleted file mode 100644 index c2312859f..000000000 --- a/arch/cpu/msp430/f5xxx/uart1.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ - -/* - * Yet another machine dependent MSP430X UART0 code. - * IF2, etc. can not be used here... need to abstract to some macros - * later. - */ - -#include "contiki.h" -#include -#include "dev/uart1.h" -#include "dev/watchdog.h" -#include "isr_compat.h" - -static int (*uart1_input_handler)(unsigned char c); - -static volatile uint8_t transmitting; - -#ifdef UART1_CONF_RX_WITH_DMA -#define RX_WITH_DMA UART1_CONF_RX_WITH_DMA -#else /* UART1_CONF_RX_WITH_DMA */ -#define RX_WITH_DMA 1 -#endif /* UART1_CONF_RX_WITH_DMA */ - -#if RX_WITH_DMA -#define RXBUFSIZE 128 - -static uint8_t rxbuf[RXBUFSIZE]; -static uint16_t last_size; -static struct ctimer rxdma_timer; - -static void -handle_rxdma_timer(void *ptr) -{ - uint16_t size; - size = DMA0SZ; /* Note: loop requires that size is less or eq to RXBUFSIZE */ - while(last_size != size) { - uart1_input_handler((unsigned char)rxbuf[RXBUFSIZE - last_size]); - last_size--; - if(last_size == 0) { - last_size = RXBUFSIZE; - } - } - - ctimer_reset(&rxdma_timer); -} -#endif /* RX_WITH_DMA */ - -/*---------------------------------------------------------------------------*/ -uint8_t -uart1_active(void) -{ - return (UCA1STAT & UCBUSY) | transmitting; -} -/*---------------------------------------------------------------------------*/ -void -uart1_set_input(int (*input)(unsigned char c)) -{ -#if RX_WITH_DMA /* This needs to be called after ctimer process is started */ - ctimer_set(&rxdma_timer, CLOCK_SECOND / 64, handle_rxdma_timer, NULL); -#endif - uart1_input_handler = input; -} -/*---------------------------------------------------------------------------*/ -void -uart1_writeb(unsigned char c) -{ - watchdog_periodic(); - /* Loop until the transmission buffer is available. */ - while((UCA1STAT & UCBUSY)); - - /* Transmit the data. */ - UCA1TXBUF = c; -} -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port. - * - */ -void -uart1_init(unsigned long ubr) -{ - /* RS232 */ - UCA1CTL1 |= UCSWRST; /* Hold peripheral in reset state */ - UCA1CTL1 |= UCSSEL_2; /* CLK = SMCLK */ - - ubr = (MSP430_CPU_SPEED / ubr); - UCA1BR0 = ubr & 0xff; - UCA1BR1 = (ubr >> 8) & 0xff; - /* UCA1MCTL |= UCBRS_2 + UCBRF_0; // Modulation UCBRFx=0 */ - UCA1MCTL = UCBRS_3; /* Modulation UCBRSx = 3 */ - - P4DIR |= BIT5; - P4OUT |= BIT5; - P5SEL |= BIT6 | BIT7; /* P5.6,7 = USCI_A1 TXD/RXD */ - - P4SEL |= BIT7; - P4DIR |= BIT7; - - /*UCA1CTL1 &= ~UCSWRST;*/ /* Initialize USCI state machine */ - - transmitting = 0; - - /* XXX Clear pending interrupts before enable */ - UCA1IE &= ~UCRXIFG; - UCA1IE &= ~UCTXIFG; - - UCA1CTL1 &= ~UCSWRST; /* Initialize USCI state machine **before** enabling interrupts */ - UCA1IE |= UCRXIE; /* Enable UCA1 RX interrupt */ - -#if RX_WITH_DMA - UCA1IE &= ~UCRXIE; /* disable USART1 RX interrupt */ - /* UART1_RX trigger */ - DMACTL0 = DMA0TSEL_20; - - /* source address = RXBUF1 */ - DMA0SA = (unsigned int)&UCA1RXBUF; - DMA0DA = (unsigned int)&rxbuf; - DMA0SZ = RXBUFSIZE; - last_size = RXBUFSIZE; - DMA0CTL = DMADT_4 + DMASBDB + DMADSTINCR_3 + DMAEN + DMAREQ; - - msp430_add_lpm_req(MSP430_REQUIRE_LPM1); -#endif /* RX_WITH_DMA */ -} -/*---------------------------------------------------------------------------*/ -#if !RX_WITH_DMA -ISR(USCI_A1, uart1_rx_interrupt) -{ - uint8_t c; - - if(UCA1IV == 2) { - if(UCA1STAT & UCRXERR) { - c = UCA1RXBUF; /* Clear error flags by forcing a dummy read. */ - } else { - c = UCA1RXBUF; - if(uart1_input_handler != NULL) { - if(uart1_input_handler(c)) { - LPM4_EXIT; - } - } - } - } -} -#endif /* !RX_WITH_DMA */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/flash.c b/arch/cpu/msp430/flash.c deleted file mode 100644 index b9b76f78e..000000000 --- a/arch/cpu/msp430/flash.c +++ /dev/null @@ -1,108 +0,0 @@ -/** - * \file - * Functions for reading and writing flash ROM. - * \author Adam Dunkels - */ - -/* Copyright (c) 2004 Swedish Institute of Computer Science. - * 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. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - * - * - * Author: Adam Dunkels - * - */ - -#include "contiki.h" -#include "dev/flash.h" -#include "dev/watchdog.h" - -#define FLASH_TIMEOUT 30 -#define FLASH_REQ_TIMEOUT 150 - -static unsigned short ie1, ie2; - -/*---------------------------------------------------------------------------*/ -void -flash_setup(void) -{ - /* disable all interrupts to protect CPU - during programming from system crash */ - _DINT(); - - /* Clear interrupt flag1. */ - /* IFG1 = 0; */ - /* The IFG1 = 0; statement locks up contikimac - not sure if this - statement needs to be here at all. I've removed it for now, since - it seems to work, but leave this little note here in case someone - stumbles over this code at some point. */ - - /* Stop watchdog. */ - watchdog_stop(); - - /* DCO(SMCLK) is 2,4576MHz, /6 = 409600 Hz - select SMCLK for flash timing, divider 5+1 */ - FCTL2 = 0xA5C5; - - /* disable all NMI-Interrupt sources */ - ie1 = IE1; - ie2 = IE2; - IE1 = 0x00; - IE2 = 0x00; -} -/*---------------------------------------------------------------------------*/ -void -flash_done(void) -{ - /* Enable interrupts. */ - IE1 = ie1; - IE2 = ie2; - _EINT(); - watchdog_start(); -} -/*---------------------------------------------------------------------------*/ -void -flash_clear(unsigned short *ptr) -{ - FCTL3 = 0xA500; /* Lock = 0 */ - while(FCTL3 & 0x0001) nop(); /* Wait for BUSY = 0, not needed - unless run from RAM */ - FCTL1 = 0xA502; /* ERASE = 1 */ - *ptr = 0; /* erase Flash segment */ - FCTL1 = 0xA500; /* ERASE = 0 automatically done?! */ - FCTL3 = 0xA510; /* Lock = 1 */ -} -/*---------------------------------------------------------------------------*/ -void -flash_write(unsigned short *ptr, unsigned short word) -{ - FCTL3 = 0xA500; /* Lock = 0 */ - while(FCTL3 & 0x0001) nop(); /* Wait for BUSY = 0, not needed unless - run from RAM */ - FCTL1 = 0xA540; /* WRT = 1 */ - *ptr = word; /* program Flash word */ - FCTL1 = 0xA500; /* WRT = 0 */ - FCTL3 = 0xA510; /* Lock = 1 */ -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/int-master.c b/arch/cpu/msp430/int-master.c deleted file mode 100644 index 5e50a563c..000000000 --- a/arch/cpu/msp430/int-master.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 - * Master interrupt manipulation implementation for the MSP430 - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/int-master.h" - -#include -/*---------------------------------------------------------------------------*/ -void -int_master_enable(void) -{ - eint(); -} -/*---------------------------------------------------------------------------*/ -int_master_status_t -int_master_read_and_disable(void) -{ - __istate_t status = __get_interrupt_state(); - dint(); - return status; -} -/*---------------------------------------------------------------------------*/ -void -int_master_status_set(int_master_status_t status) -{ - __set_interrupt_state(status); -} -/*---------------------------------------------------------------------------*/ -bool -int_master_is_enabled(void) -{ - return __get_interrupt_state() & GIE ? true : false; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/isr_compat.h b/arch/cpu/msp430/isr_compat.h deleted file mode 100644 index 5ede95a86..000000000 --- a/arch/cpu/msp430/isr_compat.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2005 Steve Underwood - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 ISR_COMPAT_H_ -#define ISR_COMPAT_H_ - -/* Cross compiler interrupt service routine compatibility definitions */ -/* This code currently allows for: - MSPGCC - the GNU tools for the MSP430 - Quadravox AQ430 - IAR Version 1 (old syntax) - IAR Versions 2, 3, 4, 5 (new syntax) - Rowley Crossworks - Code Composer Essentials - - These macros allow us to define interrupt routines for all - compilers with a common syntax: - - ISR(, ) - { - } - - e.g. - - ISR(ADC12, adc_service_routine) - { - ADC12CTL0 &= ~ENC; - ADC12CTL0 |= ENC; - } -*/ - -/* 2012-03-02: minor update to support IAR version 4 and 5 */ - -/* A tricky #define to stringify _Pragma parameters */ -#define __PRAGMA__(x) _Pragma(#x) - -#if defined(__GNUC__) && defined(__MSP430__) - /* This is the MSPGCC compiler */ -#define ISR(a,b) interrupt(a ## _VECTOR) b(void) -#elif defined(__AQCOMPILER__) - /* This is the Quadravox compiler */ -#define ISR(a,b) void _INTERRUPT[a ## _VECTOR] b(void) -#elif defined(__IAR_SYSTEMS_ICC__) && (((__TID__ >> 8) & 0x7f) == 43) && (__VER__ < 200) - /* This is V1.xx of the IAR compiler. */ -#define ISR(a,b) interrupt[a ## _VECTOR] void b(void) -#elif defined(__IAR_SYSTEMS_ICC__) && (((__TID__ >> 8) & 0x7f) == 43) && (__VER__ < 600) - /* This is V2.xx, V3.xx, V4.xx, V5.xx of the IAR compiler. */ -#define ISR(a,b) \ -__PRAGMA__(vector=a ##_VECTOR) \ -__interrupt void b(void) -#elif defined(__CROSSWORKS_MSP430) - /* This is the Rowley Crossworks compiler */ -#define ISR(a,b) void b __interrupt[a ## _VECTOR](void) -#elif defined(__TI_COMPILER_VERSION__) - /* This is the Code Composer Essentials compiler. */ -#define ISR(a,b) __interrupt void b(void); \ -a ## _ISR(b) \ -__interrupt void b(void) -#else - #error Compiler not recognised. -#endif - -#endif diff --git a/arch/cpu/msp430/leds-arch.c b/arch/cpu/msp430/leds-arch.c deleted file mode 100644 index c8131ee3e..000000000 --- a/arch/cpu/msp430/leds-arch.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Configurable Sensor Network Application - * Architecture for sensor nodes running the Contiki operating system. - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-03 - */ - -#include "contiki.h" -#include "dev/leds.h" - -/*---------------------------------------------------------------------------*/ -void -leds_arch_init(void) -{ - LEDS_PxDIR |= (LEDS_CONF_RED | LEDS_CONF_GREEN | LEDS_CONF_YELLOW); - LEDS_PxOUT |= (LEDS_CONF_RED | LEDS_CONF_GREEN | LEDS_CONF_YELLOW); -} -/*---------------------------------------------------------------------------*/ -leds_mask_t -leds_arch_get(void) -{ - leds_mask_t leds; - leds = LEDS_PxOUT; - return ((leds & LEDS_CONF_RED) ? 0 : LEDS_RED) - | ((leds & LEDS_CONF_GREEN) ? 0 : LEDS_GREEN) - | ((leds & LEDS_CONF_YELLOW) ? 0 : LEDS_YELLOW); -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set(leds_mask_t leds) -{ - LEDS_PxOUT = (LEDS_PxOUT & ~(LEDS_CONF_RED|LEDS_CONF_GREEN|LEDS_CONF_YELLOW)) - | ((leds & LEDS_RED) ? 0 : LEDS_CONF_RED) - | ((leds & LEDS_GREEN) ? 0 : LEDS_CONF_GREEN) - | ((leds & LEDS_YELLOW) ? 0 : LEDS_CONF_YELLOW); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/lpm.c b/arch/cpu/msp430/lpm.c deleted file mode 100644 index 9f9a0f965..000000000 --- a/arch/cpu/msp430/lpm.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#include "dev/lpm.h" - -unsigned char lpm_status = LPM_STATUS_OFF; - -/*---------------------------------------------------------------------------*/ -void -lpm_on(void) -{ - lpm_status = LPM_STATUS_ON; -} -/*---------------------------------------------------------------------------*/ -void -lpm_off(void) -{ - lpm_status = LPM_STATUS_OFF; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/minileds.c b/arch/cpu/msp430/minileds.c deleted file mode 100644 index ce5f97392..000000000 --- a/arch/cpu/msp430/minileds.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/* - * Minileds is intended to substitute the full leds package when only - * a small portion of the full functionality is required. It is - * intended to be syntactically compatible but with a simplified - * semantics. The semantic difference lies in not counting the number - * of leds_on and leds_off:s. It saves a substantial amount of RAM - * (820 bytes on a msp430). - */ - -#include "contiki.h" -#include "dev/leds.h" - -void -leds_init(void) -{ - LEDS_PxDIR |= (LEDS_CONF_RED | LEDS_CONF_GREEN | LEDS_CONF_YELLOW); - LEDS_PxOUT |= (LEDS_CONF_RED | LEDS_CONF_GREEN | LEDS_CONF_YELLOW); -} - -static const unsigned char l2p[LEDS_ALL + 1] = { - 0, - LEDS_CONF_GREEN, - LEDS_CONF_YELLOW, - LEDS_CONF_YELLOW | LEDS_CONF_GREEN, - LEDS_CONF_RED, - LEDS_CONF_RED | LEDS_CONF_GREEN, - LEDS_CONF_RED | LEDS_CONF_YELLOW, - LEDS_CONF_RED | LEDS_CONF_YELLOW | LEDS_CONF_GREEN -}; - - -void -leds_on(unsigned char leds) -{ - LEDS_PxOUT &= ~l2p[leds & LEDS_ALL]; -} - -void -leds_off(unsigned char leds) -{ - LEDS_PxOUT |= l2p[leds & LEDS_ALL]; -} - -void -leds_toggle(unsigned char leds) -{ - LEDS_PxOUT ^= l2p[leds & LEDS_ALL]; -} diff --git a/arch/cpu/msp430/msp430-conf.h b/arch/cpu/msp430/msp430-conf.h deleted file mode 100644 index f4f0da54c..000000000 --- a/arch/cpu/msp430/msp430-conf.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 MSP430_CONF_H_ -#define MSP430_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* default DCOSYNCH Period is 30 seconds */ -#ifdef DCOSYNCH_CONF_PERIOD -#define DCOSYNCH_PERIOD DCOSYNCH_CONF_PERIOD -#else -#define DCOSYNCH_PERIOD 30 -#endif - -#ifdef F_CPU -#define MSP430_CPU_SPEED F_CPU -#else -#define MSP430_CPU_SPEED 2457600UL -#endif - -#ifndef SLIP_ARCH_CONF_ENABLED -/* - * Determine whether we need SLIP - * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT - * keep using SLIP - */ -#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT) -#define SLIP_ARCH_CONF_ENABLED 1 -#else -#define SLIP_ARCH_CONF_ENABLED 0 -#endif -#endif - -/*---------------------------------------------------------------------------*/ -#endif /* MSP430_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/msp430-def.h b/arch/cpu/msp430/msp430-def.h deleted file mode 100644 index 28b482e9a..000000000 --- a/arch/cpu/msp430/msp430-def.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 MSP430_DEF_H_ -#define MSP430_DEF_H_ - -#ifdef __IAR_SYSTEMS_ICC__ -#include -#include -#include -#define dint() __disable_interrupt() -#define eint() __enable_interrupt() -#define __MSP430__ 1 -#define CC_CONF_INLINE - -#else /* __IAR_SYSTEMS_ICC__ */ - -#ifdef __MSPGCC__ -#include -#include -#else /* __MSPGCC__ */ -#include -#include -#if !defined(MSP430_MEMCPY_WORKAROUND) && (__GNUC__ < 4) -#define MSP430_MEMCPY_WORKAROUND 1 -#endif -#endif /* __MSPGCC__ */ - -#define CC_CONF_INLINE inline - -#endif /* __IAR_SYSTEMS_ICC__ */ - -/* Master interrupt state representation data type */ -#define INT_MASTER_CONF_STATUS_DATATYPE __istate_t - -#ifndef BV -#define BV(x) (1 << x) -#endif - -#include - -/* These names are deprecated, use C99 names. */ -typedef uint8_t u8_t; -typedef uint16_t u16_t; -typedef uint32_t u32_t; -typedef int32_t s32_t; - -/* Types for clocks and uip_stats */ -typedef unsigned short uip_stats_t; -typedef unsigned long clock_time_t; -typedef long off_t; - -/* Our clock resolution, this is the same as Unix HZ. */ -#define CLOCK_CONF_SECOND 128UL - -/* Use 16-bit rtimer (default in Contiki-NG is 32) */ -#define RTIMER_CONF_CLOCK_SIZE 2 - -typedef int spl_t; -spl_t splhigh_(void); - -#define splhigh() splhigh_() -#ifdef __IAR_SYSTEMS_ICC__ -#define splx(sr) __bis_SR_register(sr) -#else -#define splx(sr) __asm__ __volatile__("bis %0, r2" : : "r" (sr)) -#endif - -/* Workaround for bug in msp430-gcc compiler */ -#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND -#ifndef memcpy -#include - -void *w_memcpy(void *out, const void *in, size_t n); -#define memcpy(dest, src, count) w_memcpy(dest, src, count) - -void *w_memset(void *out, int value, size_t n); -#define memset(dest, value, count) w_memset(dest, value, count) - -#endif /* memcpy */ -#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */ - -#define memory_barrier() asm volatile("" : : : "memory") - -#define MSP430_REQUIRE_CPUON 0 -#define MSP430_REQUIRE_LPM1 1 -#define MSP430_REQUIRE_LPM2 2 -#define MSP430_REQUIRE_LPM3 3 - -/* Platform-specific checksum implementation */ -#define UIP_ARCH_IPCHKSUM 1 - -#define BAUD2UBR(baud) ((F_CPU/baud)) - -void msp430_add_lpm_req(int req); -void msp430_remove_lpm_req(int req); -void msp430_cpu_init(void); /* Rename to cpu_init() later! */ -void msp430_sync_dco(void); -#define cpu_init() msp430_cpu_init() -void *sbrk(int); - -#endif /* MSP430_DEF_H_ */ diff --git a/arch/cpu/msp430/rom.c b/arch/cpu/msp430/rom.c deleted file mode 100644 index e48e9fbf6..000000000 --- a/arch/cpu/msp430/rom.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" - -#include "dev/rom.h" - -struct ictx { - int s; - unsigned short ie1, ie2, wdtctl; -}; - -static void -mask_intr(struct ictx *c) -{ - /* Disable all interrupts. */ - c->s = splhigh(); - -#define WDTRPW 0x6900 /* Watchdog key returned by read */ - - /* Disable all NMI-Interrupt sources */ - c->wdtctl = WDTCTL; - c->wdtctl ^= (WDTRPW ^ WDTPW); - WDTCTL = WDTPW | WDTHOLD; - c->ie1 = IE1; - IE1 = 0x00; - c->ie2 = IE2; - IE2 = 0x00; - - /* MSP430F1611 257 < f < 476 kHz, 2.4576MHz/(5+1) = 409.6 kHz. */ - FCTL2 = FWKEY | FSSEL_SMCLK | (FN2 | FN1); - FCTL3 = FWKEY; /* Unlock flash. */ -} - -static void -rest_intr(struct ictx *c) -{ - FCTL1 = FWKEY; /* Disable erase or write. */ - FCTL3 = FWKEY | LOCK; /* Lock flash. */ - /* Restore interrupts. */ - IE2 = c->ie2; - IE1 = c->ie1; - WDTCTL = c->wdtctl; - splx(c->s); -} - -/* - * This helper routine must reside in RAM! - */ -static void -blkwrt(void *to, const void *from, const void *from_end) - // __attribute__ ((section(".data"))) - ; - -int -rom_erase(long nbytes, off_t offset) -{ - int nb = nbytes; - char *to = (char *)(uintptr_t)offset; - struct ictx c; - - if(nbytes % ROM_ERASE_UNIT_SIZE != 0) { - return -1; - } - - if(offset % ROM_ERASE_UNIT_SIZE != 0) { - return -1; - } - - while (nbytes > 0) { - mask_intr(&c); - - FCTL1 = FWKEY | ERASE; /* Segment erase. */ - *to = 0; /* Erase segment containing to. */ - nbytes -= ROM_ERASE_UNIT_SIZE; - to += ROM_ERASE_UNIT_SIZE; - - rest_intr(&c); - } - - return nb; -} - -int -rom_pwrite(const void *buf, int nbytes, off_t offset) -{ - const char *from = buf; - int nb = nbytes; - char *to = (char *)(uintptr_t)offset; - struct ictx c; - - mask_intr(&c); - - while(nbytes > 0) { - int n = (nbytes > 64) ? 64 : nbytes; - FCTL1 = FWKEY | BLKWRT | WRT; /* Enable block write. */ - blkwrt(to, from, from + n); - while(FCTL3 & BUSY); - to += 64; - from += 64; - nbytes -= n; - } - - rest_intr(&c); - - return nb; -} - -/* - * This helper routine must reside in RAM! - */ -asm(".data"); -asm(".p2align 1,0"); -asm(".type blkwrt,@function"); -asm(".section .data"); - -static void -blkwrt(void *_to, const void *_from, const void *_from_end) -{ - unsigned short *to = _to; - const unsigned short *from = _from; - const unsigned short *from_end = _from_end; - do { - *to++ = *from++; - while(!(FCTL3 & WAIT)); - } while(from < from_end); - FCTL1 = FWKEY; /* Disable block write. */ - /* Now ROM is available again! */ -} diff --git a/arch/cpu/msp430/rtimer-arch.h b/arch/cpu/msp430/rtimer-arch.h deleted file mode 100644 index 9fd5b46ba..000000000 --- a/arch/cpu/msp430/rtimer-arch.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the MSP430-specific rtimer code - * \author - * Adam Dunkels - */ - -#ifndef RTIMER_ARCH_H_ -#define RTIMER_ARCH_H_ - -#include "sys/rtimer.h" - -#define RTIMER_ARCH_SECOND (4096U*8) - -/* Do the math in 32bits to save precision. - * Round to nearest integer rather than truncate. */ -#define US_TO_RTIMERTICKS(US) ((US) >= 0 ? \ - (((int32_t)(US) * (RTIMER_ARCH_SECOND) + 500000) / 1000000L) : \ - ((int32_t)(US) * (RTIMER_ARCH_SECOND) - 500000) / 1000000L) - -#define RTIMERTICKS_TO_US(T) ((T) >= 0 ? \ - (((int32_t)(T) * 1000000L + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) : \ - ((int32_t)(T) * 1000000L - ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) - -/* A 64-bit version because the 32-bit one cannot handle T >= 4295 ticks. - Intended only for positive values of T. */ -#define RTIMERTICKS_TO_US_64(T) ((uint32_t)(((uint64_t)(T) * 1000000 + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND))) - -rtimer_clock_t rtimer_arch_now(void); - -#endif /* RTIMER_ARCH_H_ */ diff --git a/arch/cpu/msp430/slip_uart0.c b/arch/cpu/msp430/slip_uart0.c deleted file mode 100644 index 174acf703..000000000 --- a/arch/cpu/msp430/slip_uart0.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/* - * Machine dependent MSP430 SLIP routines for UART0. - */ - -#include "contiki.h" -#include "dev/slip.h" -#include "dev/uart0.h" -/*---------------------------------------------------------------------------*/ -void -slip_arch_writeb(unsigned char c) -{ - uart0_writeb(c); -} -/** - * Initalize the RS232 port and the SLIP driver. - * - */ -void -slip_arch_init() -{ - uart0_set_input(slip_input_byte); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/slip_uart1.c b/arch/cpu/msp430/slip_uart1.c deleted file mode 100644 index 16cd11967..000000000 --- a/arch/cpu/msp430/slip_uart1.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/* - * Machine dependent MSP430 SLIP routines for UART1. - */ - -#include "contiki.h" -#include "dev/slip.h" -#include "dev/uart1.h" -/*---------------------------------------------------------------------------*/ -void -slip_arch_writeb(unsigned char c) -{ - uart1_writeb(c); -} -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port and the SLIP driver. - * - */ -void -slip_arch_init() -{ - uart1_set_input(slip_input_byte); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/uip-ipchksum.c b/arch/cpu/msp430/uip-ipchksum.c deleted file mode 100644 index 442c154dc..000000000 --- a/arch/cpu/msp430/uip-ipchksum.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * uIP checksum calculation for MSP430 - */ - -#include "net/ipv6/uip.h" - -#define asmv(arg) __asm__ __volatile__(arg) -/*---------------------------------------------------------------------------*/ -#ifdef UIP_ARCH_IPCHKSUM -#ifdef __IAR_SYSTEMS_ICC__ -uint16_t -uip_ipchksum(void) -{ - return 0; -} -#else -uint16_t -uip_ipchksum(void) -{ - /* Assumes proper alignement of uip_buf. */ - uint16_t *p = (uint16_t *)UIP_IP_BUF; - register uint16_t sum; - - sum = p[0]; - asmv("add %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[1])); - asmv("addc %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[2])); - asmv("addc %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[3])); - asmv("addc %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[4])); - asmv("addc %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[5])); - asmv("addc %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[6])); - asmv("addc %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[7])); - asmv("addc %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[8])); - asmv("addc %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[9])); - - /* Finally, add the remaining carry bit. */ - asmv("addc #0, %[sum]": [sum] "+r" (sum)); - - /* Return sum in network byte order. */ - return (sum == 0) ? 0xffff : sum; -} -#endif -#endif -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/msp430/watchdog.c b/arch/cpu/msp430/watchdog.c deleted file mode 100644 index 53263ffb7..000000000 --- a/arch/cpu/msp430/watchdog.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "dev/watchdog.h" -#include "isr_compat.h" - -static int counter = 0; - -#define PRINT_STACK_ON_REBOOT 0 - -/*---------------------------------------------------------------------------*/ -#if PRINT_STACK_ON_REBOOT -#ifdef CONTIKI_TARGET_SKY -static void -printchar(char c) -{ - /* Transmit the data. */ - TXBUF1 = c; - - /* Loop until the transmission buffer is available. */ - while((IFG2 & UTXIFG1) == 0); - -} -/*---------------------------------------------------------------------------*/ -static void -hexprint(uint8_t v) -{ - const char hexconv[] = "0123456789abcdef"; - printchar(hexconv[v >> 4]); - printchar(hexconv[v & 0x0f]); -} -/*---------------------------------------------------------------------------*/ -static void -printstring(char *s) -{ - while(*s) { - printchar(*s++); - } -} -#endif /* CONTIKI_TARGET_SKY */ -#endif /* PRINT_STACK_ON_REBOOT */ -/*---------------------------------------------------------------------------*/ -ISR(WDT, watchdog_interrupt) -{ -#ifdef CONTIKI_TARGET_SKY -#if PRINT_STACK_ON_REBOOT - uint8_t dummy; - static uint8_t *ptr; - static int i; - - ptr = &dummy; - printstring("Watchdog reset"); - printstring("\nStack at $"); - hexprint(((int)ptr) >> 8); - hexprint(((int)ptr) & 0xff); - printstring(":\n"); - - for(i = 0; i < 64; ++i) { - hexprint(ptr[i]); - printchar(' '); - if((i & 0x0f) == 0x0f) { - printchar('\n'); - } - } - printchar('\n'); -#endif /* PRINT_STACK_ON_REBOOT */ -#endif /* CONTIKI_TARGET_SKY */ - - watchdog_reboot(); -} -/*---------------------------------------------------------------------------*/ -void -watchdog_init(void) -{ - /* The MSP430 watchdog is enabled at boot-up, so we stop it during - initialization. */ - counter = 0; - watchdog_stop(); -#if CONTIKI_TARGET_WISMOTE - SFRIFG1 &= ~WDTIFG; - SFRIE1 |= WDTIE; -#else - IFG1 &= ~WDTIFG; - IE1 |= WDTIE; -#endif -} -/*---------------------------------------------------------------------------*/ -void -watchdog_start(void) -{ - /* We setup the watchdog to reset the device after one second, - unless watchdog_periodic() is called. */ - counter--; - if(counter == 0) { - WDTCTL = WDTPW | WDTCNTCL | WDT_ARST_1000 | WDTTMSEL; - } -} -/*---------------------------------------------------------------------------*/ -void -watchdog_periodic(void) -{ - /* This function is called periodically to restart the watchdog - timer. */ - /* if(counter < 0) {*/ - WDTCTL = (WDTCTL & 0xff) | WDTPW | WDTCNTCL | WDTTMSEL; - /* }*/ -} -/*---------------------------------------------------------------------------*/ -void -watchdog_stop(void) -{ - counter++; - if(counter == 1) { - WDTCTL = WDTPW | WDTHOLD; - } -} -/*---------------------------------------------------------------------------*/ -void -watchdog_reboot(void) -{ - WDTCTL = 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/native/Makefile.native b/arch/cpu/native/Makefile.native deleted file mode 100644 index 30883622d..000000000 --- a/arch/cpu/native/Makefile.native +++ /dev/null @@ -1,63 +0,0 @@ -CONTIKI_CPU_DIRS = . net dev - -CONTIKI_SOURCEFILES += rtimer-arch.c watchdog.c eeprom.c int-master.c -CONTIKI_SOURCEFILES += gpio-hal-arch.c - -### Compiler definitions -CC ?= gcc -ifdef LD_OVERRIDE - LD = $(LD_OVERRIDE) -else - LD = gcc -endif -AS ?= as -NM ?= nm -OBJCOPY ?= objcopy -STRIP ?= strip -ifeq ($(WERROR),1) -CFLAGSWERROR=-Werror -endif -CFLAGSNO = -Wall -g -I/usr/local/include $(CFLAGSWERROR) -CFLAGS += $(CFLAGSNO) - -### Are we building with code size optimisations? -SMALL ?= 0 - -# The optimizations on native platform cannot be enabled in GCC (not Clang) versions less than 7.2 -GCC_IS_CLANG := $(shell gcc --version 2> /dev/null | grep clang) -ifneq ($(GCC_IS_CLANG),) - NATIVE_CAN_OPTIIMIZE = 1 -else - GCC_VERSION := $(shell gcc -dumpfullversion -dumpversion | cut -b1-3) - ifeq ($(shell expr $(GCC_VERSION) \>= 7.2), 1) - NATIVE_CAN_OPTIIMIZE = 1 - else - NATIVE_CAN_OPTIIMIZE = 0 - endif -endif - -ifeq ($(NATIVE_CAN_OPTIIMIZE),1) - ifeq ($(SMALL),1) - CFLAGS += -Os - else - CFLAGS += -O2 - endif -endif - -ifeq ($(HOST_OS),Darwin) -AROPTS = -rc -LDFLAGS_WERROR := -Wl,-fatal_warnings -LDFLAGS += -Wl,-flat_namespace,-map,$(CONTIKI_NG_PROJECT_MAP) -CFLAGS += -DHAVE_SNPRINTF=1 -U__ASSERT_USE_STDERR -else -ifeq ($(HOST_OS),Linux) -LDFLAGS += -Wl,-Map=$(CONTIKI_NG_PROJECT_MAP),-export-dynamic -endif -endif - -MAKE_MAC ?= MAKE_MAC_NULLMAC - -### Compilation rules - -%.so: $(OBJECTDIR)/%.o - $(LD) -shared -o $@ $^ diff --git a/arch/cpu/native/dev/eeprom.c b/arch/cpu/native/dev/eeprom.c deleted file mode 100644 index 17e4efa1b..000000000 --- a/arch/cpu/native/dev/eeprom.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2013, Robert Quattlebaum. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Robert Quattlebaum - * - */ - -#include "contiki.h" -#include "dev/eeprom.h" - -#include -#include - -static FILE *eeprom_file; - -/*---------------------------------------------------------------------------*/ -static void -eeprom_fill(eeprom_addr_t addr, unsigned char value, int size) -{ - if((addr > EEPROM_END_ADDR) || (addr+size > EEPROM_END_ADDR+1) || size < 0) { - fprintf(stderr, "eeprom_fill: Bad address and/or size (addr = %04x, size = %d)\n", addr, size); - - /* Abort here so that we break into the debugger. If a debugger isn't - * attached, well we might as well crash anyway. - */ - abort(); - } - - if(!eeprom_file) { - eeprom_init(); - } - - fseek(eeprom_file, addr, SEEK_SET); - - while(size--) { - if(fputc(value, eeprom_file) != value) { - perror("fputc() failed"); - exit(EXIT_FAILURE); - } - } -} - -/*---------------------------------------------------------------------------*/ -void -eeprom_init(void) -{ - long length; - char *eeprom_filename = getenv("CONTIKI_EEPROM"); - - if(eeprom_filename) { - eeprom_file = fopen(eeprom_filename, "r+"); - - if(!eeprom_file) { - /* File does exist yet, so let's create it. */ - eeprom_file = fopen(eeprom_filename, "w+"); - - if(!eeprom_file) { - perror("Unable to create EEPROM file"); - exit(EXIT_FAILURE); - } - } - - fprintf(stderr, "eeprom_init: Using \"%s\".\n", eeprom_filename); - } else { - eeprom_file = tmpfile(); - - if(!eeprom_file) { - perror("Unable to create temporary EEPROM file"); - exit(EXIT_FAILURE); - } - } - - /* Make sure that the file is the correct size by seeking - * to the end and checking the file position. If it is - * less than what we expect, we pad out the rest of the file - * with 0xFF, just like a real EEPROM. */ - - fseek(eeprom_file, 0, SEEK_END); - length = ftell(eeprom_file); - - if(length < 0) { - perror("ftell failed"); - exit(EXIT_FAILURE); - } - - if(length < EEPROM_END_ADDR) { - /* Fill with 0xFF, just like a real EEPROM. */ - eeprom_fill(length, 0xFF, EEPROM_SIZE - length); - } -} - -/*---------------------------------------------------------------------------*/ -void -eeprom_write(eeprom_addr_t addr, unsigned char *buf, int size) -{ - if((addr > EEPROM_END_ADDR) || (addr+size > EEPROM_END_ADDR+1) || size < 0) { - fprintf(stderr, "eeprom_write: Bad address and/or size (addr = %04x, size = %d)\n", addr, size); - - /* Abort here so that we break into the debugger. If a debugger isn't - * attached, well we might as well crash anyway. - */ - abort(); - } - - if(!eeprom_file) { - eeprom_init(); - } - - fseek(eeprom_file, addr, SEEK_SET); - - if(fwrite(buf, 1, size, eeprom_file) != size) { - perror("fwrite() failed"); - exit(EXIT_FAILURE); - } -} - -/*---------------------------------------------------------------------------*/ -void -eeprom_read(eeprom_addr_t addr, unsigned char *buf, int size) -{ - if((addr > EEPROM_END_ADDR) || (addr+size > EEPROM_END_ADDR+1) || size < 0) { - fprintf(stderr, "eeprom_read: Bad address and/or size (addr = %04x, size = %d)\n", addr, size); - - /* Abort here so that we break into the debugger. If a debugger isn't - * attached, well we might as well crash anyway. */ - abort(); - } - - if(!eeprom_file) { - eeprom_init(); - } - - fseek(eeprom_file, addr, SEEK_SET); - - if(fread(buf, 1, size, eeprom_file) != size) { - perror("fread() failed"); - exit(EXIT_FAILURE); - } -} diff --git a/arch/cpu/native/dev/gpio-hal-arch.c b/arch/cpu/native/dev/gpio-hal-arch.c deleted file mode 100644 index 366141d77..000000000 --- a/arch/cpu/native/dev/gpio-hal-arch.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/gpio-hal.h" -#include "sys/log.h" - -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#define LOG_MODULE "GPIO arch" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -static gpio_hal_pin_cfg_t pin_cfg[GPIO_HAL_PIN_COUNT]; -static uint8_t pin_state[GPIO_HAL_PIN_COUNT]; -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_init(void) -{ - /* Do nothing */ -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_interrupt_enable(gpio_hal_pin_t pin) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return; - } - - LOG_DBG("Pin %u: Enabled interrupt\n", pin); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_interrupt_disable(gpio_hal_pin_t pin) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return; - } - - LOG_DBG("Pin %u: Disabled interrupt\n", pin); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_pin_cfg_set(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return; - } - - pin_cfg[pin] = cfg; - LOG_DBG("Pin %u: Set config=0x%02x\n", pin, pin_cfg[pin]); -} -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_cfg_t -gpio_hal_arch_pin_cfg_get(gpio_hal_pin_t pin) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return 0; - } - - LOG_DBG("Pin %u: Config=0x%02x\n", pin, pin_cfg[pin]); - return pin_cfg[pin]; -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_pin_set_input(gpio_hal_pin_t pin) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return; - } - - LOG_DBG("Pin %u: Set input\n", pin); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_pin_set_output(gpio_hal_pin_t pin) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return; - } - - LOG_DBG("Pin %u: Set output\n", pin); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_set_pin(gpio_hal_pin_t pin) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return; - } - - pin_state[pin] = 1; - LOG_DBG("Pin %u: Set\n", pin); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_clear_pin(gpio_hal_pin_t pin) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return; - } - - pin_state[pin] = 0; - LOG_DBG("Pin %u: Clear\n", pin); -} -/*---------------------------------------------------------------------------*/ -uint8_t -gpio_hal_arch_read_pin(gpio_hal_pin_t pin) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return 0; - } - - LOG_DBG("Pin %u: Read=%u\n", pin, pin_state[pin]); - return pin_state[pin]; -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_write_pin(gpio_hal_pin_t pin, uint8_t value) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return; - } - - pin_state[pin] = value; - LOG_DBG("Pin %u: Write=%u\n", pin, pin_state[pin]); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_set_pins(gpio_hal_pin_mask_t pins) -{ - gpio_hal_pin_t pin; - - for(pin = 0; pin < GPIO_HAL_PIN_COUNT; pin++) { - if(pins & (1 << pin)) { - pin_state[pin] = 1; - } - } - - LOG_DBG("Set pins 0x%08" PRIx32 "\n", pins); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_clear_pins(gpio_hal_pin_mask_t pins) -{ - gpio_hal_pin_t pin; - - for(pin = 0; pin < GPIO_HAL_PIN_COUNT; pin++) { - if(pins & (1 << pin)) { - pin_state[pin] = 0; - } - } - - LOG_DBG("Clear pins 0x%08" PRIx32 "\n", pins); -} -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_mask_t -gpio_hal_arch_read_pins(gpio_hal_pin_mask_t pins) -{ - gpio_hal_pin_t pin; - gpio_hal_pin_mask_t state = 0; - - for(pin = 0; pin < GPIO_HAL_PIN_COUNT; pin++) { - state |= (pin_state[pin] << pin); - } - - LOG_DBG("Read pins 0x%08" PRIx32 "\n", state); - return state; -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_write_pins(gpio_hal_pin_mask_t pins, gpio_hal_pin_mask_t value) -{ - gpio_hal_pin_t pin; - - for(pin = 0; pin < GPIO_HAL_PIN_COUNT; pin++) { - if(pins & (1 << pin)) { - pin_state[pin] = (value & (1 << pin)) == 0 ? 0 : 1; - } - } - - LOG_DBG("Write pins 0x%08" PRIx32 "->0x%08" PRIx32 "\n", pins, value); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/native/int-master.c b/arch/cpu/native/int-master.c deleted file mode 100644 index 177dbd442..000000000 --- a/arch/cpu/native/int-master.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "sys/int-master.h" - -#include -/*---------------------------------------------------------------------------*/ -#define DISABLED 0 -#define ENABLED 1 -/*---------------------------------------------------------------------------*/ -static int_master_status_t stat = DISABLED; -/*---------------------------------------------------------------------------*/ -void -int_master_enable(void) -{ - stat = ENABLED; -} -/*---------------------------------------------------------------------------*/ -int_master_status_t -int_master_read_and_disable(void) -{ - int_master_status_t rv = stat; - stat = DISABLED; - return rv; -} -/*---------------------------------------------------------------------------*/ -void -int_master_status_set(int_master_status_t status) -{ - stat = status; -} -/*---------------------------------------------------------------------------*/ -bool -int_master_is_enabled(void) -{ - return stat == DISABLED ? false : true; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/native/native-def.h b/arch/cpu/native/native-def.h deleted file mode 100644 index d85ae7100..000000000 --- a/arch/cpu/native/native-def.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 NATIVE_DEF_H_ -#define NATIVE_DEF_H_ -/*---------------------------------------------------------------------------*/ -#define GPIO_HAL_CONF_ARCH_SW_TOGGLE 1 -/*---------------------------------------------------------------------------*/ -#endif /* NATIVE_DEF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/native/net/tun6-net.c b/arch/cpu/native/net/tun6-net.c deleted file mode 100644 index f1e8c2e77..000000000 --- a/arch/cpu/native/net/tun6-net.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ - -/** - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Tun6" -#define LOG_LEVEL LOG_LEVEL_WARN - -#ifdef linux -#include -#include -#endif - -#include -#include "net/netstack.h" -#include "net/packetbuf.h" - -static const char *config_ipaddr = "fd00::1/64"; -/* Allocate some bytes in RAM and copy the string */ -static char config_tundev[64] = "tun0"; - - -#ifndef __CYGWIN__ -static int tunfd = -1; - -static int set_fd(fd_set *rset, fd_set *wset); -static void handle_fd(fd_set *rset, fd_set *wset); -static const struct select_callback tun_select_callback = { - set_fd, - handle_fd -}; -#endif /* __CYGWIN__ */ - -static int ssystem(const char *fmt, ...) - __attribute__((__format__ (__printf__, 1, 2))); -static int -ssystem(const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2))); - -int -static ssystem(const char *fmt, ...) -{ - char cmd[128]; - va_list ap; - va_start(ap, fmt); - vsnprintf(cmd, sizeof(cmd), fmt, ap); - va_end(ap); - LOG_INFO("%s\n", cmd); - fflush(stdout); - return system(cmd); -} - -/*---------------------------------------------------------------------------*/ -static void -cleanup(void) -{ - ssystem("ifconfig %s down", config_tundev); -#ifndef linux - ssystem("sysctl -w net.ipv6.conf.all.forwarding=1"); -#endif - ssystem("netstat -nr" - " | awk '{ if ($2 == \"%s\") print \"route delete -net \"$1; }'" - " | sh", - config_tundev); -} - -/*---------------------------------------------------------------------------*/ -static void -sigcleanup(int signo) -{ - fprintf(stderr, "signal %d\n", signo); - exit(0); /* exit(0) will call cleanup() */ -} - -/*---------------------------------------------------------------------------*/ -static void -ifconf(const char *tundev, const char *ipaddr) -{ -#ifdef linux - ssystem("ifconfig %s inet `hostname` up", tundev); - ssystem("ifconfig %s add %s", tundev, ipaddr); -#elif defined(__APPLE__) - ssystem("ifconfig %s inet6 %s up", tundev, ipaddr); - ssystem("sysctl -w net.inet.ip.forwarding=1"); -#else - ssystem("ifconfig %s inet `hostname` %s up", tundev, ipaddr); - ssystem("sysctl -w net.inet.ip.forwarding=1"); -#endif /* !linux */ - - /* Print the configuration to the console. */ - ssystem("ifconfig %s\n", tundev); -} -/*---------------------------------------------------------------------------*/ -#ifdef linux -static int -tun_alloc(char *dev) -{ - struct ifreq ifr; - int fd, err; - LOG_INFO("Opening: %s\n", dev); - if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) { - /* Error message handled by caller */ - return -1; - } - - memset(&ifr, 0, sizeof(ifr)); - - /* Flags: IFF_TUN - TUN device (no Ethernet headers) - * IFF_NO_PI - Do not provide packet information - */ - ifr.ifr_flags = IFF_TUN | IFF_NO_PI; - if(*dev != 0) { - strncpy(ifr.ifr_name, dev, IFNAMSIZ); - } - if((err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) { - /* Error message handled by caller */ - close(fd); - return err; - } - - LOG_INFO("Using '%s' vs '%s'\n", dev, ifr.ifr_name); - strncpy(dev, ifr.ifr_name, strlen(dev)); - LOG_INFO("Using %s\n", dev); - return fd; -} -#else -static int -devopen(const char *dev, int flags) -{ - char t[32]; - strcpy(t, "/dev/"); - strncat(t, dev, sizeof(t) - 5); - return open(t, flags); -} -/*---------------------------------------------------------------------------*/ -static int -tun_alloc(char *dev) -{ - LOG_INFO("Opening: %s\n", dev); - return devopen(dev, O_RDWR); -} -#endif - -#ifdef __CYGWIN__ -/*wpcap process is used to connect to host interface */ -static void -tun_init() -{ - setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */ -} - -#else - - -/*---------------------------------------------------------------------------*/ -static void -tun_init() -{ - setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */ - - LOG_INFO("Initializing tun interface\n"); - - tunfd = tun_alloc(config_tundev); - if(tunfd == -1) { - LOG_WARN("Failed to open tun device (you may be lacking permission). Running without network.\n"); - /* err(1, "failed to allocate tun device ``%s''", config_tundev); */ - return; - } - - LOG_INFO("Tun open:%d\n", tunfd); - - select_set_callback(tunfd, &tun_select_callback); - - fprintf(stderr, "opened %s device ``/dev/%s''\n", - "tun", config_tundev); - - atexit(cleanup); - signal(SIGHUP, sigcleanup); - signal(SIGTERM, sigcleanup); - signal(SIGINT, sigcleanup); - ifconf(config_tundev, config_ipaddr); -} - -/*---------------------------------------------------------------------------*/ -static int -tun_output(uint8_t *data, int len) -{ - /* fprintf(stderr, "*** Writing to tun...%d\n", len); */ - if(tunfd != -1 && write(tunfd, data, len) != len) { - err(1, "serial_to_tun: write"); - return -1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -tun_input(unsigned char *data, int maxlen) -{ - int size; - - if(tunfd == -1) { - /* tun is not open */ - return 0; - } - - if((size = read(tunfd, data, maxlen)) == -1) { - err(1, "tun_input: read"); - } - return size; -} - -/*---------------------------------------------------------------------------*/ -static uint8_t -output(const linkaddr_t *localdest) -{ - LOG_DBG("SUT: %u\n", uip_len); - if(uip_len > 0) { - return tun_output(uip_buf, uip_len); - } - return 0; -} - -/*---------------------------------------------------------------------------*/ -/* tun and slip select callback */ -/*---------------------------------------------------------------------------*/ -static int -set_fd(fd_set *rset, fd_set *wset) -{ - if(tunfd == -1) { - return 0; - } - - FD_SET(tunfd, rset); - return 1; -} - -/*---------------------------------------------------------------------------*/ - -static void -handle_fd(fd_set *rset, fd_set *wset) -{ - int size; - - if(tunfd == -1) { - /* tun is not open */ - return; - } - - LOG_INFO("Tun6-handle FD\n"); - - if(FD_ISSET(tunfd, rset)) { - size = tun_input(uip_buf, sizeof(uip_buf)); - LOG_DBG("TUN data incoming read:%d\n", size); - uip_len = size; - tcpip_input(); - } -} -#endif /* __CYGWIN_ */ - -static void input(void) -{ - /* should not happen */ - LOG_DBG("Tun6 - input\n"); -} - - -const struct network_driver tun6_net_driver ={ - "tun6", - tun_init, - input, - output -}; - - -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/native/rtimer-arch.c b/arch/cpu/native/rtimer-arch.c deleted file mode 100644 index ad081c9f5..000000000 --- a/arch/cpu/native/rtimer-arch.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Native (non-specific) code for the Contiki real-time module rt - * \author - * Adam Dunkels - */ - -#include -#ifndef _WIN32 -#include -#endif /* !_WIN32 */ -#include - -#include "sys/rtimer.h" -#include "sys/clock.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/*---------------------------------------------------------------------------*/ -static void -interrupt(int sig) -{ - signal(sig, interrupt); - rtimer_run_next(); -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_init(void) -{ -#ifndef _WIN32 - signal(SIGALRM, interrupt); -#endif /* !_WIN32 */ -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_schedule(rtimer_clock_t t) -{ -#ifndef _WIN32 - struct itimerval val; - rtimer_clock_t c; - - c = t - (unsigned short)clock_time(); - - val.it_value.tv_sec = c / CLOCK_SECOND; - val.it_value.tv_usec = (c % CLOCK_SECOND) * CLOCK_SECOND; - - PRINTF("rtimer_arch_schedule time %u %u in %d.%d seconds\n", t, c, val.it_value.tv_sec, - val.it_value.tv_usec); - - val.it_interval.tv_sec = val.it_interval.tv_usec = 0; - setitimer(ITIMER_REAL, &val, NULL); -#endif /* !_WIN32 */ -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/native/rtimer-arch.h b/arch/cpu/native/rtimer-arch.h deleted file mode 100644 index fa0cdeb83..000000000 --- a/arch/cpu/native/rtimer-arch.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#ifndef RTIMER_ARCH_H_ -#define RTIMER_ARCH_H_ - -#include "contiki.h" - -#define RTIMER_ARCH_SECOND CLOCK_CONF_SECOND - -#define rtimer_arch_now() clock_time() - -#endif /* RTIMER_ARCH_H_ */ diff --git a/arch/cpu/native/watchdog.c b/arch/cpu/native/watchdog.c deleted file mode 100644 index 1ac6245b6..000000000 --- a/arch/cpu/native/watchdog.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "dev/watchdog.h" -#include - -/*---------------------------------------------------------------------------*/ -void -watchdog_init(void) -{ -} -/*---------------------------------------------------------------------------*/ -void -watchdog_start(void) -{ -} -/*---------------------------------------------------------------------------*/ -void -watchdog_periodic(void) -{ -} -/*---------------------------------------------------------------------------*/ -void -watchdog_stop(void) -{ -} -/*---------------------------------------------------------------------------*/ -void -watchdog_reboot(void) -{ - // Death by watchdog. - exit(-1); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/nrf52832/Makefile.nrf52832 b/arch/cpu/nrf52832/Makefile.nrf52832 deleted file mode 100644 index 102e74486..000000000 --- a/arch/cpu/nrf52832/Makefile.nrf52832 +++ /dev/null @@ -1,207 +0,0 @@ -ifndef NRF52_SDK_ROOT - $(error NRF52_SDK_ROOT not defined! You must specify where nRF52 SDK resides!) -endif - -ifneq ($(filter %.flash erase,$(MAKECMDGOALS)),) -ifeq ($(NRF52_JLINK_PATH),) -NRF52_JLINK_PATH=$(shell location=$$(which JLinkExe) && dirname $$location) -endif -ifeq ($(NRF52_JLINK_PATH),) - $(error JLink not found in PATH and NRF52_JLINK_PATH path is not defined) -endif -endif - -# custom MAC: ble_ipsp_mac_driver -MAKE_MAC ?= MAKE_MAC_OTHER - -$(info SDK: $(NRF52_SDK_ROOT)) - -ifeq ($(NRF52_DK_REVISION),) -NRF52_DK_REVISION=pca10040 -endif - -ifneq ($(NRF52_WITHOUT_SOFTDEVICE),1) - ifeq ($(NRF52_SOFTDEVICE),) - NRF52_SOFTDEVICE := $(shell find $(NRF52_SDK_ROOT) -name *iot*_softdevice.hex | head -n 1) - endif - $(info SoftDevice: $(NRF52_SOFTDEVICE)) - LDSCRIPT ?= $(CONTIKI_CPU)/ld/nrf52-$(NRF52_DK_REVISION)-sd.ld -else - LDSCRIPT ?= $(CONTIKI_CPU)/ld/nrf52.ld -endif - -OUTPUT_FILENAME := $(CONTIKI_PROJECT) -MAKEFILE_NAME := $(MAKEFILE_LIST) -MAKEFILE_DIR := $(dir $(MAKEFILE_NAME) ) - -TEMPLATE_PATH = $(NRF52_SDK_ROOT)/components/toolchain/gcc - -OBJECT_DIRECTORY = $(OBJECTDIR) -LISTING_DIRECTORY := $(OBJECTDIR) -OUTPUT_BINARY_DIRECTORY := bin_$(TARGET) - -# JLink -JLINK := $(NRF52_JLINK_PATH)/JLinkExe -JLINK_OPTS = -Device NRF52 -if swd -speed 1000 -ifneq ($(NRF52_JLINK_SN),) -JLINK_OPTS += -SelectEmuBySN $(NRF52_JLINK_SN) -endif - -#function for removing duplicates in a list -remduplicates = $(strip $(if $1,$(firstword $1) $(call remduplicates,$(filter-out $(firstword $1),$1)))) - -### CPU-dependent directories -CONTIKI_CPU_DIRS += . dev ble #compat - -### CPU-dependent source files -CONTIKI_CPU_SOURCEFILES += clock.c rtimer-arch.c uart0.c dbg.c watchdog.c -CONTIKI_CPU_SOURCEFILES += int-master.c - -ifneq ($(NRF52_WITHOUT_SOFTDEVICE),1) -CONTIKI_CPU_SOURCEFILES += ble-core.c ble-mac.c -endif - -CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) - -#source common to all targets -C_SOURCE_FILES += $(NRF52_SDK_ROOT)/components/drivers_nrf/common/nrf_drv_common.c \ - $(NRF52_SDK_ROOT)/components/drivers_nrf/gpiote/nrf_drv_gpiote.c \ - $(NRF52_SDK_ROOT)/components/drivers_nrf/rtc/nrf_drv_rtc.c \ - $(NRF52_SDK_ROOT)/components/drivers_nrf/clock/nrf_drv_clock.c \ - $(NRF52_SDK_ROOT)/components/drivers_nrf/timer/nrf_drv_timer.c \ - $(NRF52_SDK_ROOT)/components/drivers_nrf/wdt/nrf_drv_wdt.c \ - $(NRF52_SDK_ROOT)/components/drivers_nrf/rng/nrf_drv_rng.c \ - $(NRF52_SDK_ROOT)/components/drivers_nrf/delay/nrf_delay.c \ - $(NRF52_SDK_ROOT)/components/drivers_nrf/uart/nrf_drv_uart.c \ - $(NRF52_SDK_ROOT)/components/libraries/util/app_error.c \ - $(NRF52_SDK_ROOT)/components/toolchain/system_nrf52.c - -ifneq ($(NRF52_WITHOUT_SOFTDEVICE),1) -C_SOURCE_FILES += $(NRF52_SDK_ROOT)/components/softdevice/common/softdevice_handler/softdevice_handler.c \ - $(NRF52_SDK_ROOT)/components/ble/common/ble_advdata.c -else -C_SOURCE_FILES += $(NRF52_SDK_ROOT)/components/libraries/fifo/app_fifo.c \ - $(NRF52_SDK_ROOT)/components/libraries/util/app_util_platform.c -endif - -#assembly files common to all targets -ASM_SOURCE_FILES = $(NRF52_SDK_ROOT)/components/toolchain/gcc/gcc_startup_nrf52.s - -#includes common to all targets -INC_PATHS += components/drivers_nrf/gpiote -INC_PATHS += components/drivers_nrf/hal -INC_PATHS += components/drivers_nrf/config -INC_PATHS += components/drivers_nrf/delay -INC_PATHS += components/drivers_nrf/uart -INC_PATHS += components/drivers_nrf/common -INC_PATHS += components/drivers_nrf/rtc -INC_PATHS += components/drivers_nrf/wdt -INC_PATHS += components/drivers_nrf/rng -INC_PATHS += components/drivers_nrf/clock -INC_PATHS += components/drivers_nrf/timer -INC_PATHS += components/libraries/util -INC_PATHS += components/libraries/timer -INC_PATHS += components/device -INC_PATHS += components/toolchain/gcc -INC_PATHS += components/toolchain -INC_PATHS += examples/bsp - -ifneq ($(NRF52_WITHOUT_SOFTDEVICE),1) -INC_PATHS += components/softdevice/s1xx_iot/headers -INC_PATHS += components/softdevice/s1xx_iot/headers/nrf52 -INC_PATHS += components/softdevice/common/softdevice_handler -INC_PATHS += components/ble/common -INC_PATHS += components/iot/common -INC_PATHS += components/iot/ble_ipsp -else -INC_PATHS += components/drivers_nrf/nrf_soc_nosd -INC_PATHS += components/libraries/fifo -endif - -EXTERNALDIRS += $(addprefix $(NRF52_SDK_ROOT)/, $(INC_PATHS)) - -# Sorting removes duplicates -BUILD_DIRECTORIES := $(sort $(OUTPUT_BINARY_DIRECTORY) $(LISTING_DIRECTORY)) - -#flags common to all targets -ifneq ($(NRF52_WITHOUT_SOFTDEVICE),1) -CFLAGS += -DSOFTDEVICE_PRESENT -CFLAGS += -DS132 -endif - -CFLAGS += -DNRF52 -CFLAGS += -DBOARD_$(shell echo $(NRF52_DK_REVISION) | tr a-z A-Z) -CFLAGS += -D__HEAP_SIZE=512 -CFLAGS += -DSWI_DISABLE0 -CFLAGS += -DCONFIG_GPIO_AS_PINRESET -CFLAGS += -DBLE_STACK_SUPPORT_REQD -CFLAGS += -ggdb -CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 - -# keep every function in separate section. This will allow linker to dump unused functions -LDFLAGS += -Xlinker -Map=$(CONTIKI_NG_PROJECT_MAP) -LDFLAGS += -mabi=aapcs -L $(TEMPLATE_PATH) -LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -# let linker to dump unused sections -LDFLAGS += -Wl,--gc-sections -# use newlib in nano version -LDFLAGS += --specs=nano.specs -lc -lnosys - -# Assembler flags -ifneq ($(NRF52_WITHOUT_SOFTDEVICE),1) -ASMFLAGS += -DSOFTDEVICE_PRESENT -ASMFLAGS += -DS132 -endif -ASMFLAGS += -x assembler-with-cpp -ASMFLAGS += -DSWI_DISABLE0 -ASMFLAGS += -DNRF52 -ASMFLAGS += -DBOARD_$(shell echo $(NRF52_DK_REVISION) | tr a-z A-Z) -ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET -ASMFLAGS += -DBLE_STACK_SUPPORT_REQD - -C_SOURCE_FILE_NAMES = $(notdir $(C_SOURCE_FILES)) -C_PATHS = $(call remduplicates, $(dir $(C_SOURCE_FILES) ) ) -C_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILE_NAMES:.c=.o) ) - -ASM_SOURCE_FILE_NAMES = $(notdir $(ASM_SOURCE_FILES)) -ASM_PATHS = $(call remduplicates, $(dir $(ASM_SOURCE_FILES) )) -ASM_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(ASM_SOURCE_FILE_NAMES:.s=.o) ) - -vpath %.c $(C_PATHS) -vpath %.s $(ASM_PATHS) - -OBJECTS = $(C_OBJECTS) $(ASM_OBJECTS) - -NRFLIB = $(BUILD_DIR_BOARD)/nrf52832.a - -TARGET_LIBS = $(NRFLIB) $(NRF52_SDK_ROOT)/components/iot/ble_6lowpan/lib/ble_6lowpan.a - -$(NRFLIB): $(OBJECTS) - $(TRACE_AR) - $(Q)$(AR) $(AROPTS) $@ $^ - -# Assemble files -$(OBJECT_DIRECTORY)/%.o: %.s - $(TRACE_CC) - $(Q)$(CC) $(ASMFLAGS) $(addprefix -I$(NRF52_SDK_ROOT)/, $(INC_PATHS)) -c -o $@ $< - -include $(ARCH_PATH)/cpu/arm/cortex-m/cm4/Makefile.cm4 - -%.jlink: $(OUT_HEX) - sed -e 's,#OUTPUT_FILENAME#,$<,' $(CONTIKI_CPU)/flash.jlink > $@ - -%.flash: %.jlink - @echo Flashing: $^ - $(JLINK) $(JLINK_OPTS) -CommanderScript $*.jlink - -softdevice.jlink: - sed -e 's,#OUTPUT_FILENAME#,$(NRF52_SOFTDEVICE),' $(CONTIKI_CPU)/flash.jlink > $@ - -softdevice.flash: softdevice.jlink - @echo Flashing: $(notdir $(NRF52_SOFTDEVICE)) - $(JLINK) $(JLINK_OPTS) -CommanderScript $^ - -erase: - $(JLINK) $(JLINK_OPTS) -CommanderScript $(CONTIKI_CPU)/erase.jlink - -.PHONY: softdevice.jlink diff --git a/arch/cpu/nrf52832/ble/ble-core.c b/arch/cpu/nrf52832/ble/ble-core.c deleted file mode 100644 index 9f1acdfc2..000000000 --- a/arch/cpu/nrf52832/ble/ble-core.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832-ble - * @{ - * - * \file - * Basic BLE functions. - * \author - * Wojciech Bober - * - */ -#include -#include -#include "boards.h" -#include "nordic_common.h" -#include "nrf_delay.h" -#include "nrf_sdm.h" -#include "ble_advdata.h" -#include "ble_srv_common.h" -#include "ble_ipsp.h" -#include "softdevice_handler.h" -#include "app_error.h" -#include "iot_defines.h" -#include "ble-core.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define IS_SRVC_CHANGED_CHARACT_PRESENT 1 -#define APP_ADV_TIMEOUT 0 /**< Time for which the device must be advertising in non-connectable mode (in seconds). 0 disables timeout. */ -#define APP_ADV_ADV_INTERVAL MSEC_TO_UNITS(333, UNIT_0_625_MS) /**< The advertising interval. This value can vary between 100ms to 10.24s). */ - -static ble_gap_adv_params_t m_adv_params; /**< Parameters to be passed to the stack when starting advertising. */ - -static void -ble_evt_dispatch(ble_evt_t * p_ble_evt); -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize and enable the BLE stack. - */ -void -ble_stack_init(void) -{ - uint32_t err_code; - - // Enable BLE stack. - ble_enable_params_t ble_enable_params; - memset(&ble_enable_params, 0, sizeof(ble_enable_params)); - ble_enable_params.gatts_enable_params.attr_tab_size = - BLE_GATTS_ATTR_TAB_SIZE_DEFAULT; - ble_enable_params.gatts_enable_params.service_changed = - IS_SRVC_CHANGED_CHARACT_PRESENT; - err_code = sd_ble_enable(&ble_enable_params); - APP_ERROR_CHECK(err_code); - - // Register with the SoftDevice handler module for BLE events. - err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); - APP_ERROR_CHECK(err_code); - - // Setup address - ble_gap_addr_t ble_addr; - err_code = sd_ble_gap_address_get(&ble_addr); - APP_ERROR_CHECK(err_code); - - ble_addr.addr[5] = 0x00; - ble_addr.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC; - - err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &ble_addr); - APP_ERROR_CHECK(err_code); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Return device EUI64 MAC address - * \param addr pointer to a buffer to store the address - */ -void -ble_get_mac(uint8_t addr[8]) -{ - uint32_t err_code; - ble_gap_addr_t ble_addr; - - err_code = sd_ble_gap_address_get(&ble_addr); - APP_ERROR_CHECK(err_code); - - IPV6_EUI64_CREATE_FROM_EUI48(addr, ble_addr.addr, ble_addr.addr_type); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize BLE advertising data. - * \param name Human readable device name that will be advertised - */ -void -ble_advertising_init(const char *name) -{ - uint32_t err_code; - ble_advdata_t advdata; - uint8_t flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED; - ble_gap_conn_sec_mode_t sec_mode; - - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); - - err_code = sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *)name, - strlen(name)); - APP_ERROR_CHECK(err_code); - - ble_uuid_t adv_uuids[] = {{BLE_UUID_IPSP_SERVICE, BLE_UUID_TYPE_BLE}}; - - // Build and set advertising data. - memset(&advdata, 0, sizeof(advdata)); - - advdata.name_type = BLE_ADVDATA_FULL_NAME; - advdata.flags = flags; - advdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]); - advdata.uuids_complete.p_uuids = adv_uuids; - - err_code = ble_advdata_set(&advdata, NULL); - APP_ERROR_CHECK(err_code); - - // Initialize advertising parameters (used when starting advertising). - memset(&m_adv_params, 0, sizeof(m_adv_params)); - - m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_IND; - m_adv_params.p_peer_addr = NULL; // Undirected advertisement. - m_adv_params.fp = BLE_GAP_ADV_FP_ANY; - m_adv_params.interval = APP_ADV_ADV_INTERVAL; - m_adv_params.timeout = APP_ADV_TIMEOUT; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Start BLE advertising. - */ -void -ble_advertising_start(void) -{ - uint32_t err_code; - - err_code = sd_ble_gap_adv_start(&m_adv_params); - APP_ERROR_CHECK(err_code); - - PRINTF("ble-core: advertising started\n"); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Print GAP address. - * \param addr a pointer to address - */ -void -ble_gap_addr_print(const ble_gap_addr_t *addr) -{ - unsigned int i; - for(i = 0; i < sizeof(addr->addr); i++) { - if(i > 0) { - PRINTF(":"); - }PRINTF("%02x", addr->addr[i]); - }PRINTF(" (%d)", addr->addr_type); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Function for handling the Application's BLE Stack events. - * \param[in] p_ble_evt Bluetooth stack event. - */ -static void -on_ble_evt(ble_evt_t *p_ble_evt) -{ - switch(p_ble_evt->header.evt_id) { - case BLE_GAP_EVT_CONNECTED: - PRINTF("ble-core: connected [handle:%d, peer: ", p_ble_evt->evt.gap_evt.conn_handle); - ble_gap_addr_print(&(p_ble_evt->evt.gap_evt.params.connected.peer_addr)); - PRINTF("]\n"); - sd_ble_gap_rssi_start(p_ble_evt->evt.gap_evt.conn_handle, - BLE_GAP_RSSI_THRESHOLD_INVALID, - 0); - break; - - case BLE_GAP_EVT_DISCONNECTED: - PRINTF("ble-core: disconnected [handle:%d]\n", p_ble_evt->evt.gap_evt.conn_handle); - ble_advertising_start(); - break; - default: - break; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief SoftDevice BLE event callback. - * \param[in] p_ble_evt Bluetooth stack event. - */ -static void -ble_evt_dispatch(ble_evt_t *p_ble_evt) -{ - ble_ipsp_evt_handler(p_ble_evt); - on_ble_evt(p_ble_evt); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/nrf52832/ble/ble-core.h b/arch/cpu/nrf52832/ble/ble-core.h deleted file mode 100644 index 1e7b6127c..000000000 --- a/arch/cpu/nrf52832/ble/ble-core.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832 - * @{ - * - * \defgroup nrf52832-ble Bluetooth Low Energy drivers - * @{ - * - * \file - * Basic BLE functions. - * \author - * Wojciech Bober - */ -#ifndef DEV_BLE_H_ -#define DEV_BLE_H_ - -#include - -void ble_stack_init(void); -void ble_advertising_init(const char *name); -void ble_advertising_start(void); -void ble_get_mac(uint8_t addr[8]); - -#endif /* DEV_BLE_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/cpu/nrf52832/ble/ble-mac.c b/arch/cpu/nrf52832/ble/ble-mac.c deleted file mode 100644 index d604a911d..000000000 --- a/arch/cpu/nrf52832/ble/ble-mac.c +++ /dev/null @@ -1,386 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832-ble - * @{ - * - * \file - * A MAC protocol implementation that uses nRF52 IPSP implementation - * as a link layer. - * \author - * Wojciech Bober - */ -#include -#include -#include "app_error.h" -#include "ble_ipsp.h" -#include "nrf_soc.h" -#include "iot_defines.h" - -#include "net/mac/nullmac/nullmac.h" -#include "net/netstack.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/tcpip.h" -#include "net/packetbuf.h" -#include "net/netstack.h" -#include "net/linkaddr.h" - -#include "dev/watchdog.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#ifndef BLE_MAC_MAX_INTERFACE_NUM -#define BLE_MAC_MAX_INTERFACE_NUM 1 /**< Maximum number of interfaces, i.e., connection to master devices */ -#endif - -/*---------------------------------------------------------------------------*/ -process_event_t ble_event_interface_added; /**< This event is broadcast when BLE connection is established */ -process_event_t ble_event_interface_deleted; /**< This event is broadcast when BLE connection is destroyed */ - -/*---------------------------------------------------------------------------*/ -PROCESS(ble_ipsp_process, "BLE IPSP process"); - -/*---------------------------------------------------------------------------*/ -/** - * \brief A structure that binds IPSP connection with a peer address. - */ -typedef struct { - eui64_t peer_addr; - ble_ipsp_handle_t handle; -} ble_mac_interface_t; - -static ble_mac_interface_t interfaces[BLE_MAC_MAX_INTERFACE_NUM]; - -static volatile int busy_tx; /**< Flag is set to 1 when the driver is busy transmitting a packet. */ -static volatile int busy_rx; /**< Flag is set to 1 when there is a received packet pending. */ - -struct { - eui64_t src; - uint8_t payload[PACKETBUF_SIZE]; - uint16_t len; - int8_t rssi; -} input_packet; - -static mac_callback_t mac_sent_cb; -static void *mac_sent_ptr; - -/*---------------------------------------------------------------------------*/ -/** - * \brief Lookup interface by IPSP connection. - * - * \param handle a pointer to IPSP handle. - * \retval a pointer to interface structure - * \retval NULL if no interface has been found for a given handle - */ -static ble_mac_interface_t * -ble_mac_interface_lookup(ble_ipsp_handle_t *handle) -{ - int i; - for(i = 0; i < BLE_MAC_MAX_INTERFACE_NUM; i++) { - if(interfaces[i].handle.conn_handle == handle->conn_handle && - interfaces[i].handle.cid == handle->cid) { - return &interfaces[i]; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Add IPSP connection to the interface table. - * - * This function binds IPSP connection with peer address. - * - * \param peer a pointer to eui64 address - * \param handle a pointer to IPSP handle - * - * \retval a pointer to an interface structure on success - * \retval NULL if interface table is full - */ -static ble_mac_interface_t * -ble_mac_interface_add(eui64_t *peer, ble_ipsp_handle_t *handle) -{ - int i; - for(i = 0; i < BLE_MAC_MAX_INTERFACE_NUM; i++) { - if(interfaces[i].handle.conn_handle == 0 && interfaces[i].handle.cid == 0) { - memcpy(&interfaces[i].handle, handle, sizeof(ble_ipsp_handle_t)); - memcpy(&interfaces[i].peer_addr, peer, sizeof(eui64_t)); - process_post(PROCESS_BROADCAST, ble_event_interface_added, NULL); - return &interfaces[i]; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Remove interface from the interface table. - * \param interface a pointer to interface - */ -static void -ble_mac_interface_delete(ble_mac_interface_t *interface) -{ - memset(interface, 0, sizeof(ble_mac_interface_t)); - process_post(PROCESS_BROADCAST, ble_event_interface_deleted, NULL); -} - -/*---------------------------------------------------------------------------*/ -/** - * \brief Callback registered with IPSP to receive asynchronous events from the module. - * \note This function is called from SoftDevice interrupt context. - * - * \param[in] p_handle Pointer to IPSP handle. - * \param[in] p_evt Pointer to specific event, generated by IPSP module. - * - * \return NRF_SUCCESS on success, otherwise NRF_ERROR_NO_MEM error. - */ -static uint32_t -ble_mac_ipsp_evt_handler_irq(ble_ipsp_handle_t *p_handle, ble_ipsp_evt_t *p_evt) -{ - uint32_t retval = NRF_SUCCESS; - - ble_mac_interface_t *p_instance = NULL; - p_instance = ble_mac_interface_lookup(p_handle); - - if(p_handle) { - PRINTF("ble-mac: IPSP event [handle:%d CID 0x%04X]\n", p_handle->conn_handle, p_handle->cid); - } - - switch(p_evt->evt_id) { - case BLE_IPSP_EVT_CHANNEL_CONNECTED: { - eui64_t peer_addr; - - PRINTF("ble-mac: channel connected\n"); - - IPV6_EUI64_CREATE_FROM_EUI48( - peer_addr.identifier, - p_evt->evt_param->params.ch_conn_request.peer_addr.addr, - p_evt->evt_param->params.ch_conn_request.peer_addr.addr_type); - - p_instance = ble_mac_interface_add(&peer_addr, p_handle); - - if(p_instance != NULL) { - PRINTF("ble-mac: added new IPSP interface\n"); - } else { - PRINTF("ble-mac: cannot add new interface. Table is full\n"); - ble_ipsp_disconnect(p_handle); - } - break; - } - - case BLE_IPSP_EVT_CHANNEL_DISCONNECTED: { - PRINTF("ble-mac: channel disconnected\n"); - if(p_instance != NULL) { - PRINTF("ble-mac: removed IPSP interface\n"); - ble_mac_interface_delete(p_instance); - } - break; - } - - case BLE_IPSP_EVT_CHANNEL_DATA_RX: { - PRINTF("ble-mac: data received\n"); - if(p_instance != NULL) { - if(busy_rx) { - PRINTF("ble-mac: packet dropped as input buffer is busy\n"); - break; - } - - if(p_evt->evt_param->params.ch_rx.len > PACKETBUF_SIZE) { - PRINTF("ble-mac: packet buffer is too small!\n"); - break; - } - - busy_rx = 1; - - input_packet.len = p_evt->evt_param->params.ch_rx.len; - memcpy(input_packet.payload, p_evt->evt_param->params.ch_rx.p_data, input_packet.len); - memcpy(input_packet.src.identifier, p_instance->peer_addr.identifier, sizeof(eui64_t)); - sd_ble_gap_rssi_get(p_handle->conn_handle, &input_packet.rssi); - - process_poll(&ble_ipsp_process); - } else { - PRINTF("ble-mac: got data to unknown interface!\n"); - } - break; - } - - case BLE_IPSP_EVT_CHANNEL_DATA_TX_COMPLETE: { - PRINTF("ble-mac: data transmitted\n"); - busy_tx = 0; - break; - } - } - - return retval; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ble_ipsp_process, ev, data) -{ - PROCESS_BEGIN(); - - while(1) { - PROCESS_WAIT_EVENT(); - if(ev == PROCESS_EVENT_POLL) { - packetbuf_copyfrom(input_packet.payload, input_packet.len); - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, input_packet.rssi); - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const linkaddr_t *)input_packet.src.identifier); - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &linkaddr_node_addr); - busy_rx = 0; - NETSTACK_NETWORK.input(); - } - } - - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ -/** - * \brief Lookup IPSP handle by peer address. - * - * \param addr a pointer to eui64 address. - * \retval a pointer to IPSP handle on success - * \retval NULL if an IPSP handle for given address haven't been found - */ -static ble_ipsp_handle_t * -find_handle(const linkaddr_t *addr) -{ - int i; - for(i = 0; i < BLE_MAC_MAX_INTERFACE_NUM; i++) { - if(linkaddr_cmp((const linkaddr_t *)&interfaces[i].peer_addr, addr)) { - return &interfaces[i].handle; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Send packet on a given IPSP handle. - * - * \param handle a pointer to IPSP handle. - * \return 1 on success, 0 otherwise - */ -static int -send_to_peer(ble_ipsp_handle_t *handle) -{ - PRINTF("ble-mac: sending packet[GAP handle:%d CID:0x%04X]\n", handle->conn_handle, handle->cid); - return (ble_ipsp_send(handle, packetbuf_dataptr(), packetbuf_datalen()) == NRF_SUCCESS); -} -/*---------------------------------------------------------------------------*/ -static void -send_packet(mac_callback_t sent, void *ptr) -{ - int i; - const linkaddr_t *dest; - ble_ipsp_handle_t *handle; - int ret = 0; - - mac_sent_cb = sent; - mac_sent_ptr = ptr; - - dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); - - if(linkaddr_cmp(dest, &linkaddr_null)) { - for(i = 0; i < BLE_MAC_MAX_INTERFACE_NUM; i++) { - if(interfaces[i].handle.cid != 0 && interfaces[i].handle.conn_handle != 0) { - ret = send_to_peer(&interfaces[i].handle); - watchdog_periodic(); - } - } - } else if((handle = find_handle(dest)) != NULL) { - ret = send_to_peer(handle); - } else { - PRINTF("ble-mac: no connection found for peer"); - } - - if(ret) { - busy_tx = 1; - while(busy_tx) { - watchdog_periodic(); - sd_app_evt_wait(); - } - mac_call_sent_callback(sent, ptr, MAC_TX_OK, 1); - } else { - mac_call_sent_callback(sent, ptr, MAC_TX_ERR, 1); - } -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -max_payload(void) -{ - return PACKETBUF_SIZE; -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ -// Initialize IPSP service - uint32_t err_code; - ble_ipsp_init_t ipsp_init_params; - - memset(&ipsp_init_params, 0, sizeof(ipsp_init_params)); - ipsp_init_params.evt_handler = ble_mac_ipsp_evt_handler_irq; - err_code = ble_ipsp_init(&ipsp_init_params); - APP_ERROR_CHECK(err_code); - - ble_event_interface_added = process_alloc_event(); - ble_event_interface_deleted = process_alloc_event(); - - process_start(&ble_ipsp_process, NULL); -} -/*---------------------------------------------------------------------------*/ -const struct mac_driver ble_ipsp_mac_driver = { - "nRF52 IPSP driver", - init, - send_packet, - NULL, - on, - off, - max_payload -}; -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/cpu/nrf52832/ble/ble-mac.h b/arch/cpu/nrf52832/ble/ble-mac.h deleted file mode 100644 index 3dd9b82af..000000000 --- a/arch/cpu/nrf52832/ble/ble-mac.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832-ble - * @{ - * - * \file - * A MAC protocol implementation that uses nRF52 IPSP implementation - * as a link layer. - * \author - * Wojciech Bober - */ -#ifndef BLE_MAC_H_ -#define BLE_MAC_H_ - -#include "sys/process.h" -#include "net/mac/mac.h" - -extern const struct mac_driver ble_ipsp_mac_driver; /**< BLE over IPSP MAC driver structure */ -extern process_event_t ble_event_interface_added; /**< This event is broadcast when a new IPSP connection is established */ -extern process_event_t ble_event_interface_deleted; /**< This event is broadcast when a IPSP connection is deleted */ - -#endif /* BLE_MAC_H_ */ -/** - * @} - */ diff --git a/arch/cpu/nrf52832/dbg.c b/arch/cpu/nrf52832/dbg.c deleted file mode 100644 index 8f7be5cfc..000000000 --- a/arch/cpu/nrf52832/dbg.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832 - * @{ - * - * \file - * Hardware specific implementation of putchar() and puts() functions. - * \author - * Wojciech Bober - * - */ -#include "dev/uart0.h" -/*---------------------------------------------------------------------------*/ -unsigned int -dbg_send_bytes(const unsigned char *s, unsigned int len) -{ - unsigned int i = 0; - - while (s && *s != 0) { - if (i >= len) { - break; - } - uart0_writeb(*s++); - i++; - } - - return i; -} -/*---------------------------------------------------------------------------*/ -int -dbg_putchar(int c) -{ - uart0_writeb(c); - return c; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/nrf52832/dev/clock.c b/arch/cpu/nrf52832/dev/clock.c deleted file mode 100644 index 496668ecb..000000000 --- a/arch/cpu/nrf52832/dev/clock.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor. 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. - */ - -/** - * \addtogroup nrf52832 - * @{ - * - * \addtogroup nrf52832-dev Device drivers - * @{ - * - * \addtogroup nrf52832-clock Clock driver - * @{ - * - * \file - * Software clock implementation for the nRF52. - * \author - * Wojciech Bober - * - */ -/*---------------------------------------------------------------------------*/ -#include -#include -#include "nrf.h" -#include "nrf_drv_config.h" -#include "nrf_drv_rtc.h" -#include "nrf_drv_clock.h" -#include "nrf_delay.h" -#include "app_error.h" -#include "contiki.h" - -/*---------------------------------------------------------------------------*/ -const nrf_drv_rtc_t rtc = NRF_DRV_RTC_INSTANCE(PLATFORM_RTC_INSTANCE_ID); /**< RTC instance used for platform clock */ -/*---------------------------------------------------------------------------*/ -static volatile uint32_t ticks; -void clock_update(void); - -#define TICKS (RTC1_CONFIG_FREQUENCY/CLOCK_CONF_SECOND) - -/** - * \brief Function for handling the RTC0 interrupts - * \param int_type Type of interrupt to be handled - */ -static void -rtc_handler(nrf_drv_rtc_int_type_t int_type) -{ - if (int_type == NRF_DRV_RTC_INT_TICK) { - clock_update(); - } -} - -#ifndef SOFTDEVICE_PRESENT -/** \brief Function starting the internal LFCLK XTAL oscillator. - */ -static void -lfclk_config(void) -{ - ret_code_t err_code = nrf_drv_clock_init(NULL); - APP_ERROR_CHECK(err_code); - - nrf_drv_clock_lfclk_request(); -} -#endif - -/** - * \brief Function initialization and configuration of RTC driver instance. - */ -static void -rtc_config(void) -{ - uint32_t err_code; - - //Initialize RTC instance - err_code = nrf_drv_rtc_init(&rtc, NULL, rtc_handler); - APP_ERROR_CHECK(err_code); - - //Enable tick event & interrupt - nrf_drv_rtc_tick_enable(&rtc, true); - - //Power on RTC instance - nrf_drv_rtc_enable(&rtc); -} -/*---------------------------------------------------------------------------*/ -void -clock_init(void) -{ - ticks = 0; -#ifndef SOFTDEVICE_PRESENT - lfclk_config(); -#endif - rtc_config(); -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - return (clock_time_t)(ticks & 0xFFFFFFFF); -} -/*---------------------------------------------------------------------------*/ -void -clock_update(void) -{ - ticks++; - if (etimer_pending()) { - etimer_request_poll(); - } -} -/*---------------------------------------------------------------------------*/ -unsigned long -clock_seconds(void) -{ - return (unsigned long)ticks/CLOCK_CONF_SECOND; -} -/*---------------------------------------------------------------------------*/ -void -clock_wait(clock_time_t i) -{ - clock_time_t start; - start = clock_time(); - while (clock_time() - start < (clock_time_t)i) { - __WFE(); - } -} -/*---------------------------------------------------------------------------*/ -void -clock_delay_usec(uint16_t dt) -{ - nrf_delay_us(dt); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Obsolete delay function but we implement it here since some code - * still uses it - */ -void -clock_delay(unsigned int i) -{ - clock_delay_usec(i); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - * @} - */ diff --git a/arch/cpu/nrf52832/dev/lpm.h b/arch/cpu/nrf52832/dev/lpm.h deleted file mode 100644 index 192165a49..000000000 --- a/arch/cpu/nrf52832/dev/lpm.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832-dev Device drivers - * @{ - * - * \addtogroup nrf52832-lpm Low power mode functions - * @{ - * - * \file - * A header file for low power mode functions. - * \author - * Wojciech Bober - */ -#ifndef LPM_H -#define LPM_H - -#ifdef SOFTDEVICE_PRESENT -#include "nrf_soc.h" -#endif - -/** - * \brief Stop and wait for an event - * - */ -static inline void -lpm_drop(void) -{ -#ifdef SOFTDEVICE_PRESENT - sd_app_evt_wait(); -#else - __WFI(); -#endif -} - -#endif /* DEV_LPM_H_ */ -/** - * @} - * @} - */ diff --git a/arch/cpu/nrf52832/dev/random.c b/arch/cpu/nrf52832/dev/random.c deleted file mode 100644 index 60d886c10..000000000 --- a/arch/cpu/nrf52832/dev/random.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832 - * @{ - * - * \addtogroup nrf52832-dev Device drivers - * @{ - * - * \addtogroup nrf52832-rng Hardware random number generator - * @{ - * - * \file - * Random number generator routines exploiting the nRF52 hardware - * capabilities. - * - * This file overrides os/lib/random.c. - * - * \author - * Wojciech Bober - */ -#include -#include -#include "app_error.h" -/*---------------------------------------------------------------------------*/ -/** - * \brief Generates a new random number using the nRF52 RNG. - * \return a random number. - */ -unsigned short -random_rand(void) -{ - unsigned short value = 42; - uint8_t available; - ret_code_t err_code; - - do { - nrf_drv_rng_bytes_available(&available); - } while (available < sizeof(value)); - - err_code = nrf_drv_rng_rand((uint8_t *)&value, sizeof(value)); - APP_ERROR_CHECK(err_code); - - return value; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the nRF52 random number generator. - * \param seed Ignored. It's here because the function prototype is in core. - * - */ -void -random_init(unsigned short seed) -{ - (void)seed; - ret_code_t err_code = nrf_drv_rng_init(NULL); - APP_ERROR_CHECK(err_code); -} -/** - * @} - * @} - * @} - */ diff --git a/arch/cpu/nrf52832/dev/uart0.c b/arch/cpu/nrf52832/dev/uart0.c deleted file mode 100644 index 846feab18..000000000 --- a/arch/cpu/nrf52832/dev/uart0.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832-dev Device drivers - * @{ - * - * \addtogroup nrf52832-uart UART driver - * @{ - * - * \file - * Contiki compatible UART driver. - * \author - * Wojciech Bober - */ -#include -#include "nrf.h" -#include "nrf_drv_config.h" -#include "nrf_drv_uart.h" -#include "app_util_platform.h" -#include "app_error.h" - -#include "contiki.h" -#include "dev/uart0.h" -#include "dev/watchdog.h" -#include "lib/ringbuf.h" - -#define TXBUFSIZE 128 -static uint8_t rx_buffer[1]; - -static int (*uart0_input_handler)(unsigned char c); - -static struct ringbuf txbuf; -static uint8_t txbuf_data[TXBUFSIZE]; - -/*---------------------------------------------------------------------------*/ -static void -uart_event_handler(nrf_drv_uart_event_t * p_event, void * p_context) -{ - if (p_event->type == NRF_DRV_UART_EVT_RX_DONE) { - if (uart0_input_handler != NULL) { - uart0_input_handler(p_event->data.rxtx.p_data[0]); - } - (void)nrf_drv_uart_rx(rx_buffer, 1); - } else if (p_event->type == NRF_DRV_UART_EVT_TX_DONE) { - if (ringbuf_elements(&txbuf) > 0) { - uint8_t c = ringbuf_get(&txbuf); - nrf_drv_uart_tx(&c, 1); - } - } -} -/*---------------------------------------------------------------------------*/ -void -uart0_set_input(int (*input)(unsigned char c)) -{ - uart0_input_handler = input; -} -/*---------------------------------------------------------------------------*/ -void -uart0_writeb(unsigned char c) -{ - if (nrf_drv_uart_tx(&c, 1) == NRF_ERROR_BUSY) { - while (ringbuf_put(&txbuf, c) == 0) { - __WFE(); - } - } -} -/*---------------------------------------------------------------------------*/ -/** - * Initialize the RS232 port. - * - */ -void -uart0_init(unsigned long ubr) -{ - nrf_drv_uart_config_t config = NRF_DRV_UART_DEFAULT_CONFIG; - ret_code_t retcode = nrf_drv_uart_init(&config, uart_event_handler); - APP_ERROR_CHECK(retcode); - - ringbuf_init(&txbuf, txbuf_data, sizeof(txbuf_data)); - - nrf_drv_uart_rx_enable(); - nrf_drv_uart_rx(rx_buffer, 1); -} -/** - * @} - * @} - */ diff --git a/arch/cpu/nrf52832/dev/uart0.h b/arch/cpu/nrf52832/dev/uart0.h deleted file mode 100644 index 226d14a60..000000000 --- a/arch/cpu/nrf52832/dev/uart0.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832-dev Device drivers - * @{ - * - * \addtogroup nrf52832-uart UART driver - * @{ - * - * \file - * A header file for Contiki compatible UART driver. - * \author - * Wojciech Bober - */ -#ifndef UART_0_H -#define UART_0_H - -#include -#include "contiki.h" - -void uart0_init(); -void uart0_writeb(uint8_t byte); - -void uart0_set_input(int (* input)(unsigned char c)); - -#endif /* UART_0_H */ -/** - * @} - * @} - */ diff --git a/arch/cpu/nrf52832/dev/watchdog.c b/arch/cpu/nrf52832/dev/watchdog.c deleted file mode 100644 index 5d358dcb6..000000000 --- a/arch/cpu/nrf52832/dev/watchdog.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832-dev Device drivers - * @{ - * - * \addtogroup nrf52832-watchdog Watchdog driver - * @{ - * - * \file - * Contiki compatible watchdog driver implementation. - * \author - * Wojciech Bober - */ -#include -#include "app_error.h" -#include "contiki.h" - -static nrf_drv_wdt_channel_id wdt_channel_id; -static uint8_t wdt_initialized = 0; - -/** - * \brief WDT events handler. - */ -static void wdt_event_handler(void) -{ - LEDS_OFF(LEDS_MASK); -} - -/*---------------------------------------------------------------------------*/ -void -watchdog_init(void) -{ - ret_code_t err_code; - err_code = nrf_drv_wdt_init(NULL, &wdt_event_handler); - APP_ERROR_CHECK(err_code); - err_code = nrf_drv_wdt_channel_alloc(&wdt_channel_id); - APP_ERROR_CHECK(err_code); - wdt_initialized = 1; -} -/*---------------------------------------------------------------------------*/ -void -watchdog_start(void) -{ - if(wdt_initialized) { - nrf_drv_wdt_enable(); - } -} -/*---------------------------------------------------------------------------*/ -void -watchdog_periodic(void) -{ - if(wdt_initialized) { - nrf_drv_wdt_channel_feed(wdt_channel_id); - } -} -/*---------------------------------------------------------------------------*/ -void -watchdog_reboot(void) -{ - NVIC_SystemReset(); -} -/** - * @} - * @} - */ diff --git a/arch/cpu/nrf52832/doxygen-group.txt b/arch/cpu/nrf52832/doxygen-group.txt deleted file mode 100644 index fad2067d6..000000000 --- a/arch/cpu/nrf52832/doxygen-group.txt +++ /dev/null @@ -1,4 +0,0 @@ -/** - * \defgroup nrf52832 nrf52832 SoC - * \ingroup cpu - */ diff --git a/arch/cpu/nrf52832/erase.jlink b/arch/cpu/nrf52832/erase.jlink deleted file mode 100644 index 5f08d8d86..000000000 --- a/arch/cpu/nrf52832/erase.jlink +++ /dev/null @@ -1,2 +0,0 @@ -erase -q \ No newline at end of file diff --git a/arch/cpu/nrf52832/flash.jlink b/arch/cpu/nrf52832/flash.jlink deleted file mode 100644 index 787670d55..000000000 --- a/arch/cpu/nrf52832/flash.jlink +++ /dev/null @@ -1,4 +0,0 @@ -loadfile #OUTPUT_FILENAME# -r -g -q \ No newline at end of file diff --git a/arch/cpu/nrf52832/int-master.c b/arch/cpu/nrf52832/int-master.c deleted file mode 100644 index 691b2541d..000000000 --- a/arch/cpu/nrf52832/int-master.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 - * Master interrupt manipulation implementation for the nrf52832 - */ -/*---------------------------------------------------------------------------*/ -#include "nordic_common.h" -#include "contiki.h" -#include "sys/int-master.h" - -#include -/*---------------------------------------------------------------------------*/ -void -int_master_enable(void) -{ - __enable_irq(); -} -/*---------------------------------------------------------------------------*/ -int_master_status_t -int_master_read_and_disable(void) -{ - int_master_status_t primask = __get_PRIMASK(); - - __disable_irq(); - - return primask; -} -/*---------------------------------------------------------------------------*/ -void -int_master_status_set(int_master_status_t status) -{ - __set_PRIMASK(status); -} -/*---------------------------------------------------------------------------*/ -bool -int_master_is_enabled(void) -{ - return __get_PRIMASK() ? false : true; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/nrf52832/ld/nrf52-pca10036-sd.ld b/arch/cpu/nrf52832/ld/nrf52-pca10036-sd.ld deleted file mode 100644 index 2afa9e6e2..000000000 --- a/arch/cpu/nrf52832/ld/nrf52-pca10036-sd.ld +++ /dev/null @@ -1,18 +0,0 @@ -/* Linker script to configure memory regions. */ - -SEARCH_DIR(.) -GROUP(-lgcc -lc -lnosys) - -MEMORY -{ - FLASH (rx) : ORIGIN = 0x1f000, LENGTH = 0x61000 - RAM (rwx) : ORIGIN = 0x08000000, LENGTH = 0x8000 -} - -INCLUDE "nrf5x_common.ld" - -/* These symbols are used by the stack check library. */ -_stack = end; -_stack_origin = ORIGIN(RAM) + LENGTH(RAM); -_heap = _stack; -_eheap = _stack_origin; diff --git a/arch/cpu/nrf52832/ld/nrf52-pca10040-sd.ld b/arch/cpu/nrf52832/ld/nrf52-pca10040-sd.ld deleted file mode 100644 index b2c747f0a..000000000 --- a/arch/cpu/nrf52832/ld/nrf52-pca10040-sd.ld +++ /dev/null @@ -1,18 +0,0 @@ -/* Linker script to configure memory regions. */ - -SEARCH_DIR(.) -GROUP(-lgcc -lc -lnosys) - -MEMORY -{ - FLASH (rx) : ORIGIN = 0x1f000, LENGTH = 0x61000 - RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0xD800 -} - -INCLUDE "nrf5x_common.ld" - -/* These symbols are used by the stack check library. */ -_stack = end; -_stack_origin = ORIGIN(RAM) + LENGTH(RAM); -_heap = _stack; -_eheap = _stack_origin; diff --git a/arch/cpu/nrf52832/ld/nrf52.ld b/arch/cpu/nrf52832/ld/nrf52.ld deleted file mode 100644 index 3fead1250..000000000 --- a/arch/cpu/nrf52832/ld/nrf52.ld +++ /dev/null @@ -1,18 +0,0 @@ -/* Linker script to configure memory regions. */ - -SEARCH_DIR(.) -GROUP(-lgcc -lc -lnosys) - -MEMORY -{ - FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x80000 - RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 -} - -INCLUDE "nrf5x_common.ld" - -/* These symbols are used by the stack check library. */ -_stack = end; -_stack_origin = ORIGIN(RAM) + LENGTH(RAM); -_heap = _stack; -_eheap = _stack_origin; diff --git a/arch/cpu/nrf52832/nrf52832-def.h b/arch/cpu/nrf52832/nrf52832-def.h deleted file mode 100644 index b5eca1b5e..000000000 --- a/arch/cpu/nrf52832/nrf52832-def.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 NRF52832_DEF_H_ -#define NRF52832_DEF_H_ -/*---------------------------------------------------------------------------*/ -#include "cm4/cm4-def.h" -/*---------------------------------------------------------------------------*/ -#if !NETSTACK_CONF_WITH_IPV6 -/* we only support IPv6 */ -#error "Only IPv6 stack is supported!" -#endif -/*---------------------------------------------------------------------------*/ -#define RTIMER_ARCH_SECOND 62500 -/*---------------------------------------------------------------------------*/ -#endif /* NRF52832_DEF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/nrf52832/rtimer-arch.c b/arch/cpu/nrf52832/rtimer-arch.c deleted file mode 100644 index 02611ccbc..000000000 --- a/arch/cpu/nrf52832/rtimer-arch.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor. 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. - */ - -/** - * \addtogroup nrf52832 - * @{ - * - * \file - * Implementation of the architecture dependent rtimer functions for the nRF52 - * - * \author - * Wojciech Bober - */ -/*---------------------------------------------------------------------------*/ -#include -#include -#include "nrf.h" -#include "nrf_drv_timer.h" -#include "app_error.h" -#include "contiki.h" - -static const nrf_drv_timer_t timer = NRF_DRV_TIMER_INSTANCE(PLATFORM_TIMER_INSTANCE_ID); /**< Timer instance used for rtimer */ - -/** - * \brief Handler for timer events. - * - * \param event_type type of an event that should be handled - * \param p_context opaque data pointer passed from nrf_drv_timer_init() - */ -static void -timer_event_handler(nrf_timer_event_t event_type, void* p_context) -{ - switch (event_type) { - case NRF_TIMER_EVENT_COMPARE1: - rtimer_run_next(); - break; - - default: - //Do nothing. - break; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize platform rtimer - */ -void -rtimer_arch_init(void) -{ - ret_code_t err_code = nrf_drv_timer_init(&timer, NULL, timer_event_handler); - APP_ERROR_CHECK(err_code); - nrf_drv_timer_enable(&timer); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Schedules an rtimer task to be triggered at time t - * \param t The time when the task will need executed. - * - * \e t is an absolute time, in other words the task will be executed AT - * time \e t, not IN \e t rtimer ticks. - * - * This function schedules a one-shot event with the nRF RTC. - */ -void -rtimer_arch_schedule(rtimer_clock_t t) -{ - nrf_drv_timer_compare(&timer, NRF_TIMER_CC_CHANNEL1, t, true); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the current real-time clock time - * \return The current rtimer time in ticks - * - */ -rtimer_clock_t -rtimer_arch_now() -{ - return nrf_drv_timer_capture(&timer, NRF_TIMER_CC_CHANNEL0); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/cpu/nrf52832/rtimer-arch.h b/arch/cpu/nrf52832/rtimer-arch.h deleted file mode 100644 index 32c424829..000000000 --- a/arch/cpu/nrf52832/rtimer-arch.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52832 - * @{ - * - * \file - * Architecture dependent rtimer implementation header file. - * \author - * Wojciech Bober - * - */ -/*---------------------------------------------------------------------------*/ -#ifndef RTIMER_ARCH_H_ -#define RTIMER_ARCH_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -rtimer_clock_t rtimer_arch_now(void); -/*---------------------------------------------------------------------------*/ -#endif /* RTIMER_ARCH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/Makefile.cc13xx-cc26xx b/arch/cpu/simplelink-cc13xx-cc26xx/Makefile.cc13xx-cc26xx deleted file mode 100644 index bb7bf82f5..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/Makefile.cc13xx-cc26xx +++ /dev/null @@ -1,149 +0,0 @@ -################################################################################ -### CC13xx/CC26xx CPU makefile - -CC13x2_CC26x2_PRE_RTM ?= 1 - -# Core SDK is placed as a submodule under arch/cpu/simplelink-cc13xx-cc26xx/lib. -# Do a sanity check that Core SDK submodule has been initialized. -ifndef CORE_SDK - CORE_SDK := $(CONTIKI_CPU)/lib/coresdk_cc13xx_cc26xx - CORE_SDK_INIT := $(shell [ -f $(CORE_SDK)/.git ] && echo 1) - - ifneq ($(CORE_SDK_INIT),1) - $(error The Core SDK submodule is not available. Please run 'git submodule update --init --recursive') - endif -# Note that Core SDK can be overriden with a user-specified SimpleLink SDK. -# As long as the SimpleLink SDK matches the device in use and is of a reasonable -# newer version, then it should be no different than using Core SDK. -else - # Do a sanity check the path exists. - CORE_SDK_VALID := $(shell [ -d $(CORE_SDK) ] && echo 1) - - ifneq ($(CORE_SDK_VALID),1) - $(error User-specified CORE_SDK is not a valid path.) - endif -endif - -################################################################################ -### Device Family - -# CC13x2/CC26x2 has to differentiate both pre-RTM and RTM devices. As of now, -# pre-RTM is suffixed with _v1 while RTM is suffixed with _v2. This will be -# removed when CC13x2/CC26x2 RTMs. For now, provide a switch to choose -# either pre-RTM or RTM. -# Also note that the devices name is cc13x2_cc26x2 for all CC13x2/CC26x2 -# devices, while the library name is individual for each device family. -ifeq ($(SUBFAMILY),cc13x2-cc26x2) - ifeq ($(CC13x2_CC26x2_PRE_RTM),1) - SDK_DEVICES_NAME := cc13x2_cc26x2_v1 - SDK_LIB_NAME := $(DEVICE_FAMILY_LC)_v1 - else - SDK_DEVICES_NAME := cc13x2_cc26x2_v2 - SDK_LIB_NAME := $(DEVICE_FAMILY_LC)_v2 - endif -# CC13x0/CC26x0 does not have this, with both its devices name and library -# name the same as its own device family name. -else - SDK_DEVICES_NAME := $(DEVICE_FAMILY_LC) - SDK_LIB_NAME := $(DEVICE_FAMILY_LC) -endif - -################################################################################ -### CC13xx/CC26xx CPU files - -# Both ccfg-conf.c and startup_cc13xx_cc26xx_gcc.c is located locally in -# the arch/cpu/cc13xx-cc26xx folder. -CPU_START_SOURCEFILES += ccfg-conf.c startup_cc13xx_cc26xx_gcc.c - -# CPU-dependent source files -CONTIKI_CPU_SOURCEFILES += rtimer-arch.c clock-arch.c -CONTIKI_CPU_SOURCEFILES += watchdog-arch.c dbg-arch.c -CONTIKI_CPU_SOURCEFILES += uart0-arch.c slip-arch.c -CONTIKI_CPU_SOURCEFILES += gpio-hal-arch.c int-master-arch.c -CONTIKI_CPU_SOURCEFILES += random.c trng-arch.c -CONTIKI_CPU_SOURCEFILES += spi-arch.c - -# RF source files -CONTIKI_CPU_SOURCEFILES += sched.c data-queue.c -CONTIKI_CPU_SOURCEFILES += ieee-addr.c ble-addr.c -CONTIKI_CPU_SOURCEFILES += ble-beacond.c - -ifeq ($(SUPPORTS_PROP_MODE),1) - CONTIKI_CPU_SOURCEFILES += prop-mode.c prop-settings.c prop-tx-power.c -endif - -ifeq ($(SUPPORTS_IEEE_MODE),1) - CONTIKI_CPU_SOURCEFILES += ieee-mode.c ieee-settings.c ieee-tx-power.c -endif - -ifeq ($(SUPPORTS_BLE_BEACON),1) - CONTIKI_CPU_SOURCEFILES += ble-settings.c ble-tx-power.c -endif - -################################################################################ -### Modules and paths - -# Core SDK paths -SDK_NORTOS := $(CORE_SDK)/kernel/nortos -SDK_SOURCE := $(CORE_SDK)/source -SDK_DRIVERS := $(CORE_SDK)/source/ti/drivers -SDK_DEVICES := $(CORE_SDK)/source/ti/devices/$(SDK_DEVICES_NAME) - -EXTERNALDIRS += $(SDK_SOURCE) $(SDK_NORTOS) - -# CPU-dependent directories -CONTIKI_CPU_DIRS += . dev $(SUBFAMILY) -CONTIKI_CPU_DIRS += rf rf-settings rf-settings/$(DEVICE_FAMILY_LC) - -CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES) - -################################################################################ -### Compiler configuration - -# A weird behaviour of GCC garbage collector has been observed, where -# unitialized global variables with global linkage (aka non-static) put in the -# COMMON section weren't analyzed by the garbage collector at all. No idea why. -# The solution is to disable the common section, which subsequently places all -# unitialized global variables with global linkage in the .bss section, -# allowing the GC to analyze the variables. This is especially an issue with -# Board.h files, as they rely heavily on global variables placed in COMMON to -# be garbage collected if unused. -CFLAGS += -fno-common - -################################################################################ -### Linker configuration - -# Linker flags -LDFLAGS += --entry resetISR -LDFLAGS += --specs=nano.specs -LDFLAGS += -nostartfiles -LDFLAGS += -static - -# Linker script -LDSCRIPT ?= $(CONTIKI_CPU)/$(SUBFAMILY)/$(SUBFAMILY).lds - -# Globally linked libraries -TARGET_LIBFILES += -lc -lgcc -lnosys -lm - -################################################################################ -### Specialized build targets - -.PHONY: FORCE -FORCE: - -# Always re-build ieee-addr.o in case the command line passes a new NODEID -$(OBJECTDIR)/ieee-addr.o: ieee-addr.c FORCE | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -c $< -o $@ - -# Always re-build ccfg-conf.c so any changes to CCFG configuration -# always applies -$(OBJECTDIR)/ccfg-conf.o: ccfg-conf.c FORCE | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -c $< -o $@ - -################################################################################ -### Sub-family Makefile - -# Include the Sub-family Makefile specific for the specified device -include $(CONTIKI_CPU)/$(SUBFAMILY)/Makefile.$(SUBFAMILY) diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/Makefile.cc13x0-cc26x0 b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/Makefile.cc13x0-cc26x0 deleted file mode 100644 index 9be4ad6ab..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/Makefile.cc13x0-cc26x0 +++ /dev/null @@ -1,11 +0,0 @@ -################################################################################ -### CC13x0/CC26x0 CPU makefile - -# Simplelink SDK pre-compiled libraries -TARGET_LIBFILES += $(SDK_NORTOS)/lib/nortos_$(SDK_LIB_NAME).am3g -TARGET_LIBFILES += $(SDK_DRIVERS)/rf/lib/rf_multiMode_$(SDK_LIB_NAME).am3g -TARGET_LIBFILES += $(SDK_DRIVERS)/lib/drivers_$(SDK_LIB_NAME).am3g -TARGET_LIBFILES += $(SDK_DEVICES)/driverlib/bin/gcc/driverlib.lib - -# CC13x0/CC26x0 is a Cortex-M3 architecture -include $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3 diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0-cm3.h b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0-cm3.h deleted file mode 100644 index bda2e2b07..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0-cm3.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Template: - * Copyright (c) 2012 ARM LIMITED - * All rights reserved. - * - * CC13xx-CC26xx: - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-cm3 CC13xx/CC26xx CMSIS - * - * CC13xx/CC26xx Cortex-M3 CMSIS definitions - * @{ - * - * \file - * CMSIS Cortex-M3 core peripheral access layer header file for CC13xx/CC26xx - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC13XX_CC26XX_CM3_H_ -#define CC13XX_CC26XX_CM3_H_ -/*---------------------------------------------------------------------------*/ -/** - * \name Interrupt Number Definition - * @{ - */ -typedef enum cc13xx_cc26xx_cm3_irq_e { - /* Cortex-M3 Processor Exceptions */ - CC13XX_CC26XX_CM3_EXCEPTION_RESET = -15, /**< 1 Reset */ - CC13XX_CC26XX_CM3_EXCEPTION_NMI = -14, /**< 2 NMI */ - CC13XX_CC26XX_CM3_EXCEPTION_HARD_FAULT = -13, /**< 3 Hard fault */ - CC13XX_CC26XX_CM3_EXCEPTION_MPU_FAULT = -12, /**< 4 MPU fault */ - CC13XX_CC26XX_CM3_EXCEPTION_BUS_FAULT = -11, /**< 5 Bus fault */ - CC13XX_CC26XX_CM3_EXCEPTION_USAGE_FAULT = -10, /**< 6 Usage fault */ - CC13XX_CC26XX_CM3_EXCEPTION_SV_CALL = -5, /**< 11 SVCall */ - CC13XX_CC26XX_CM3_EXCEPTION_DEBUG_MON = -4, /**< 12 Debug monitor */ - CC13XX_CC26XX_CM3_EXCEPTION_PEND_SV = -2, /**< 14 PendSV */ - CC13XX_CC26XX_CM3_EXCEPTION_SYS_TICK = -1, /**< 15 SysTick */ - - /* CC13xx/CC26xx interrupts */ - CC13XX_CC26XX_CM3_IRQ_EDGE_DETECT = 0, /**< 16 AON edge detect */ - CC13XX_CC26XX_CM3_EXCEPTION_I2C = 1, /**< 17 I2C */ - CC13XX_CC26XX_CM3_EXCEPTION_RF_CPE1 = 2, /**< 18 RF Command and Packet Engine 1 */ - CC13XX_CC26XX_CM3_EXCEPTION_AON_SPI_SLAVE = 3, /**< 19 AON SpiSplave Rx, Tx and CS */ - CC13XX_CC26XX_CM3_EXCEPTION_AON_RTC = 4, /**< 20 AON RTC */ - CC13XX_CC26XX_CM3_EXCEPTION_UART0 = 5, /**< 21 UART0 Rx and Tx */ - CC13XX_CC26XX_CM3_EXCEPTION_AON_AUX_SWEV0 = 6, /**< 22 Sensor Controller software event 0, through AON domain*/ - CC13XX_CC26XX_CM3_EXCEPTION_SSI0 = 7, /**< 23 SSI0 Rx and Tx */ - CC13XX_CC26XX_CM3_EXCEPTION_SSI1 = 8, /**< 24 SSI1 Rx and Tx */ - CC13XX_CC26XX_CM3_EXCEPTION_RF_CPE0 = 9, /**< 25 RF Command and Packet Engine 0 */ - CC13XX_CC26XX_CM3_EXCEPTION_RF_HW = 10, /**< 26 RF Core Hardware */ - CC13XX_CC26XX_CM3_EXCEPTION_RF_CMD_ACK = 11, /**< 27 RF Core Command Acknowledge */ - CC13XX_CC26XX_CM3_EXCEPTION_I2S = 12, /**< 28 I2S */ - CC13XX_CC26XX_CM3_EXCEPTION_AON_AUX_SWEV1 = 13, /**< 29 Sensor Controller software event 1, through AON domain*/ - CC13XX_CC26XX_CM3_EXCEPTION_WATCHDOG = 14, /**< 30 Watchdog timer */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_0A = 15, /**< 31 Timer 0 subtimer A */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_0B = 16, /**< 32 Timer 0 subtimer B */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_1A = 17, /**< 33 Timer 1 subtimer A */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_1B = 18, /**< 34 Timer 1 subtimer B */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_2A = 19, /**< 35 Timer 2 subtimer A */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_2B = 20, /**< 36 Timer 2 subtimer B */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_3A = 21, /**< 37 Timer 3 subtimer A */ - CC13XX_CC26XX_CM3_EXCEPTION_GPTIMER_3B = 22, /**< 38 Timer 3 subtimer B */ - CC13XX_CC26XX_CM3_EXCEPTION_CRYPTO = 23, /**< 39 Crypto Core Result available */ - CC13XX_CC26XX_CM3_EXCEPTION_UDMA = 24, /**< 40 uDMA Software */ - CC13XX_CC26XX_CM3_EXCEPTION_UDMA_ERR = 25, /**< 41 uDMA Error */ - CC13XX_CC26XX_CM3_EXCEPTION_FLASH_CTRL = 26, /**< 42 Flash controller */ - CC13XX_CC26XX_CM3_EXCEPTION_SW0 = 27, /**< 43 Software Event 0 */ - CC13XX_CC26XX_CM3_EXCEPTION_AUX_COM_EVENT = 28, /**< 44 AUX combined event, directly to MCU domain*/ - CC13XX_CC26XX_CM3_EXCEPTION_AON_PRG0 = 29, /**< 45 AON programmable 0 */ - CC13XX_CC26XX_CM3_EXCEPTION_PROG = 30, /**< 46 Dynamic Programmable interrupt (default source: PRCM)*/ - CC13XX_CC26XX_CM3_EXCEPTION_AUX_COMPA = 31, /**< 47 AUX Comparator A */ - CC13XX_CC26XX_CM3_EXCEPTION_AUX_ADC = 32, /**< 48 AUX ADC IRQ */ - CC13XX_CC26XX_CM3_EXCEPTION_TRNG = 33, /**< 49 TRNG event */ -} cc13xx_cc26xx_cm3_irq_t; - -typedef cc13xx_cc26xx_cm3_irq_t IRQn_Type; - -#define SysTick_IRQn CC13XX_CC26XX_CM3_EXCEPTION_SYS_TICK -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Processor and Core Peripheral Section - * @{ - */ -/* Configuration of the Cortex-M3 Processor and Core Peripherals */ -#define __MPU_PRESENT 1 /**< MPU present or not */ -#define __NVIC_PRIO_BITS 3 /**< Number of Bits used for Priority Levels */ -#define __Vendor_SysTickConfig 0 /**< Set to 1 if different SysTick Config is used */ -/** @} */ -/*---------------------------------------------------------------------------*/ -#include "core_cm3.h" /* Cortex-M3 processor and core peripherals */ -/*---------------------------------------------------------------------------*/ -#endif /* CC13XX_CC26XX_CM3_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.icf b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.icf deleted file mode 100644 index 5dee82c93..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.icf +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2017, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -define symbol STACK_SIZE = 0x800; /* 2048 bytes */ -define symbol HEAP_SIZE = 0x100; /* 256 bytes */ - -define symbol __intvec_start__ = 0x00000000; - -/*-Memory Regions-*/ -define symbol ROM_start__ = 0x00000000; -define symbol ROM_end__ = 0x0001FFFF; -define symbol RAM_start__ = 0x20000000; -define symbol RAM_end__ = 0x20004FFF; - -/* Define a memory region that covers the entire 4 GB addressable space */ -define memory mem with size = 4G; - -/* Define a region for the on-chip flash */ -define region FLASH_region = mem:[from ROM_start__ to ROM_end__]; - -/* Define a region for the on-chip SRAM */ -define region RAM_region = mem:[from RAM_start__ to RAM_end__]; - -/* Place the interrupt vectors at the start of flash */ -place at address mem:__intvec_start__ { readonly section .intvec }; -keep { section .intvec }; - -/* Place the CCA area at the end of flash */ -place at end of FLASH_region { readonly section .ccfg }; -keep { section .ccfg }; - -/* Place remaining 'read only' in Flash */ -place in FLASH_region { readonly }; - -/* Place all read/write items into RAM */ -place in RAM_region { readwrite }; -initialize by copy { readwrite }; - -/* - * Define CSTACK block to contain .stack section. This enables the IAR IDE - * to properly show the stack content during debug. Place stack at end of - * retention RAM, do not initialize (initializing the stack will destroy the - * return address from the initialization code, causing the processor to branch - * to zero and fault) - */ -define block CSTACK with alignment = 8, size = STACK_SIZE { section .stack }; -place at end of RAM_region { block CSTACK }; -do not initialize { section .stack, section .noinit }; - -/* Export stack top symbol. Used by startup file */ -define exported symbol STACK_TOP = RAM_end__ + 1; - -/* Primary Heap configuration */ -define block HEAP with alignment = 8, size = HEAP_SIZE { }; - -/* Place heap just before CSTACK */ -place in RAM_region { block HEAP }; diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.lds b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.lds deleted file mode 100644 index 2bc8ec8cc..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.lds +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -MIN_STACKSIZE = 0x600; /* 1536 bytes */ -HEAPSIZE = 0x100; /* 256 bytes */ - -MEMORY -{ - FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x0001ffa8 - /* - * Customer Configuration Area and Bootloader Backdoor configuration in - * flash, 40 bytes - */ - FLASH_CCFG (RX) : ORIGIN = 0x0001ffa8, LENGTH = 0x00000058 - SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00005000 - GPRAM (RWX) : ORIGIN = 0x11000000, LENGTH = 0x00002000 -} - -REGION_ALIAS("REGION_TEXT", FLASH); -REGION_ALIAS("REGION_BSS", SRAM); -REGION_ALIAS("REGION_DATA", SRAM); -REGION_ALIAS("REGION_STACK", SRAM); -REGION_ALIAS("REGION_HEAP", SRAM); -REGION_ALIAS("REGION_ARM_EXIDX", FLASH); -REGION_ALIAS("REGION_ARM_EXTAB", FLASH); - -SECTIONS { - - PROVIDE (_resetVecs_base_addr = DEFINED(_resetVecs_base_addr) - ? _resetVecs_base_addr - : 0x0); - - .resetVecs (_resetVecs_base_addr) : AT (_resetVecs_base_addr) { - KEEP (*(.resetVecs)) - } > REGION_TEXT - - .ramVecs (NOLOAD) : ALIGN(1024) { - KEEP (*(.ramVecs)) - } > REGION_DATA - - /* - * UDMACC26XX_CONFIG_BASE below must match UDMACC26XX_CONFIG_BASE defined - * by ti/drivers/dma/UDMACC26XX.h - * The user is allowed to change UDMACC26XX_CONFIG_BASE to move it away from - * the default address 0x2000_0400, but remember it must be 1024 bytes aligned. - */ - UDMACC26XX_CONFIG_BASE = 0x20000400; - - /* - * Define absolute addresses for the DMA channels. - * DMA channels must always be allocated at a fixed offset from the DMA base address. - * CTEA := Control Table Entry Address - * --------- DO NOT MODIFY ----------- - */ - DMA_SPI0_RX_CTEA = (UDMACC26XX_CONFIG_BASE + 0x30); - DMA_SPI0_TX_CTEA = (UDMACC26XX_CONFIG_BASE + 0x40); - DMA_ADC_PRI_CTEA = (UDMACC26XX_CONFIG_BASE + 0x70); - DMA_GPT0A_PRI_CTEA = (UDMACC26XX_CONFIG_BASE + 0x90); - DMA_SPI1_RX_CTEA = (UDMACC26XX_CONFIG_BASE + 0x100); - DMA_SPI1_TX_CTEA = (UDMACC26XX_CONFIG_BASE + 0x110); - DMA_ADC_ALT_CTEA = (UDMACC26XX_CONFIG_BASE + 0x270); - DMA_GPT0A_ALT_CTEA = (UDMACC26XX_CONFIG_BASE + 0x290); - - /* - * Allocate SPI0, SPI1, ADC, and GPTimer0 DMA descriptors at absolute addresses. - * --------- DO NOT MODIFY ----------- - */ - UDMACC26XX_dmaSpi0RxControlTableEntry_is_placed = 0; - .dmaSpi0RxControlTableEntry DMA_SPI0_RX_CTEA (NOLOAD) : AT (DMA_SPI0_RX_CTEA) { - *(.dmaSpi0RxControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaSpi0TxControlTableEntry_is_placed = 0; - .dmaSpi0TxControlTableEntry DMA_SPI0_TX_CTEA (NOLOAD) : AT (DMA_SPI0_TX_CTEA) { - *(.dmaSpi0TxControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaADCPriControlTableEntry_is_placed = 0; - .dmaADCPriControlTableEntry DMA_ADC_PRI_CTEA (NOLOAD) : AT (DMA_ADC_PRI_CTEA) { - *(.dmaADCPriControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaGPT0APriControlTableEntry_is_placed = 0; - .dmaGPT0APriControlTableEntry DMA_GPT0A_PRI_CTEA (NOLOAD) : AT (DMA_GPT0A_PRI_CTEA) { - *(.dmaGPT0APriControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaSpi1RxControlTableEntry_is_placed = 0; - .dmaSpi1RxControlTableEntry DMA_SPI1_RX_CTEA (NOLOAD) : AT (DMA_SPI1_RX_CTEA) { - *(.dmaSpi1RxControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaSpi1TxControlTableEntry_is_placed = 0; - .dmaSpi1TxControlTableEntry DMA_SPI1_TX_CTEA (NOLOAD) : AT (DMA_SPI1_TX_CTEA) { - *(.dmaSpi1TxControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaADCAltControlTableEntry_is_placed = 0; - .dmaADCAltControlTableEntry DMA_ADC_ALT_CTEA (NOLOAD) : AT (DMA_ADC_ALT_CTEA) { - *(.dmaADCAltControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaGPT0AAltControlTableEntry_is_placed = 0; - .dmaGPT0AAltControlTableEntry DMA_GPT0A_ALT_CTEA (NOLOAD) : AT (DMA_GPT0A_ALT_CTEA) { - *(.dmaGPT0AAltControlTableEntry) - } > REGION_DATA - - .text : { - CREATE_OBJECT_SYMBOLS - *(.text) - *(.text.*) - . = ALIGN(0x4); - KEEP (*(.ctors)) - . = ALIGN(0x4); - KEEP (*(.dtors)) - . = ALIGN(0x4); - __init_array_start = .; - KEEP (*(.init_array*)) - __init_array_end = .; - *(.init) - *(.fini*) - } > REGION_TEXT AT> REGION_TEXT - - PROVIDE(__etext = .); - PROVIDE(_etext = .); - PROVIDE(etext = .); - - .rodata : { - *(.rodata) - *(.rodata.*) - } > REGION_TEXT AT> REGION_TEXT - - .data : ALIGN(0x4) { - __data_load__ = LOADADDR(.data); - __data_start__ = .; - *(.data) - *(.data.*) - . = ALIGN (0x4); - __data_end__ = .; - } > REGION_DATA AT> REGION_TEXT - - .ARM.exidx : { - __exidx_start = .; - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - __exidx_end = .; - } > REGION_ARM_EXIDX AT> REGION_ARM_EXIDX - - .ARM.extab : { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > REGION_ARM_EXTAB AT> REGION_ARM_EXTAB - - .nvs (NOLOAD) : ALIGN(0x1000) { - *(.nvs) - } > REGION_TEXT - - .ccfg : { - KEEP(*(.ccfg)) - } > FLASH_CCFG AT> FLASH_CCFG - - .bss : { - __bss_start__ = .; - *(.shbss) - *(.bss) - *(.bss.*) - *(COMMON) - . = ALIGN(0x4); - __bss_end__ = .; - } > REGION_BSS AT> REGION_BSS - - /* Start of heap must be 4 byte aligned */ - .heap (NOLOAD) : ALIGN(0x4) { - PROVIDE(__heap_start__ = .); - PROVIDE(_heap = __heap_start__); - PROVIDE(end = __heap_start__); - PROVIDE(_end = __heap_start__); - PROVIDE(__end = __heap_start__); - - . += HEAPSIZE; - KEEP(*(.heap)) - - PROVIDE(__heap_end__ = .); - PROVIDE(_eheap = __heap_end__); - PROVIDE(__HeapLimit = __heap_end__); - } > REGION_HEAP AT> REGION_HEAP - - PROVIDE(__stack_size = ORIGIN(SRAM) + LENGTH(SRAM) - ALIGN(0x8)); - - /* Start of stack must be 8 byte aligned */ - .stack (NOLOAD) : { - PROVIDE(_stack = ALIGN(0x8)); - PROVIDE(__stack = _stack); - - PROVIDE(_stack_end = ORIGIN(SRAM) + LENGTH(SRAM)); - PROVIDE(__stack_end = _stack_end); - PROVIDE(_stack_origin = _stack_end); - - /* Note that the stack check library requires the symbols */ - /* "_stack" and "_stack_origin" to be defined. */ - - /* Assert that we have enough stack */ - ASSERT(__stack_size >= MIN_STACKSIZE, "Error: No room left for the stack"); - } > REGION_STACK AT> REGION_STACK -} diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/driverlib/rf_ieee_cmd.h b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/driverlib/rf_ieee_cmd.h deleted file mode 100644 index c054da400..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/driverlib/rf_ieee_cmd.h +++ /dev/null @@ -1,629 +0,0 @@ -/****************************************************************************** -* Filename: rf_ieee_cmd.h -* Revised: 2018-01-15 06:15:14 +0100 (Mon, 15 Jan 2018) -* Revision: 18170 -* -* Description: CC13x2/CC26x2 API for IEEE 802.15.4 commands -* -* Copyright (c) 2015 - 2017, Texas Instruments Incorporated -* 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 ORGANIZATION 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 __IEEE_CMD_H -#define __IEEE_CMD_H - -#ifndef __RFC_STRUCT -#define __RFC_STRUCT -#endif - -#ifndef __RFC_STRUCT_ATTR -#if defined(__GNUC__) -#define __RFC_STRUCT_ATTR __attribute__ ((aligned (4))) -#elif defined(__TI_ARM__) -#define __RFC_STRUCT_ATTR __attribute__ ((__packed__,aligned (4))) -#else -#define __RFC_STRUCT_ATTR -#endif -#endif - -//! \addtogroup rfc -//! @{ - -//! \addtogroup ieee_cmd -//! @{ - -#include -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) - -typedef struct __RFC_STRUCT rfc_CMD_IEEE_RX_s rfc_CMD_IEEE_RX_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_ED_SCAN_s rfc_CMD_IEEE_ED_SCAN_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_TX_s rfc_CMD_IEEE_TX_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_CSMA_s rfc_CMD_IEEE_CSMA_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_RX_ACK_s rfc_CMD_IEEE_RX_ACK_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_BG_s rfc_CMD_IEEE_ABORT_BG_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_CCA_s rfc_CMD_IEEE_MOD_CCA_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_FILT_s rfc_CMD_IEEE_MOD_FILT_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_SRC_MATCH_s rfc_CMD_IEEE_MOD_SRC_MATCH_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_FG_s rfc_CMD_IEEE_ABORT_FG_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_STOP_FG_s rfc_CMD_IEEE_STOP_FG_t; -typedef struct __RFC_STRUCT rfc_CMD_IEEE_CCA_REQ_s rfc_CMD_IEEE_CCA_REQ_t; -typedef struct __RFC_STRUCT rfc_ieeeRxOutput_s rfc_ieeeRxOutput_t; -typedef struct __RFC_STRUCT rfc_shortAddrEntry_s rfc_shortAddrEntry_t; -typedef struct __RFC_STRUCT rfc_ieeeRxCorrCrc_s rfc_ieeeRxCorrCrc_t; - -//! \addtogroup CMD_IEEE_RX -//! @{ -#define CMD_IEEE_RX 0x2801 -//! IEEE 802.15.4 Receive Command -struct __RFC_STRUCT rfc_CMD_IEEE_RX_s { - uint16_t commandNo; //!< The command ID number 0x2801 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips + 1 if the rule involves skipping. 0: same, 1: next, 2: skip next, ... - } condition; - uint8_t channel; //!< \brief Channel to tune to in the start of the operation
- //!< 0: Use existing channel
- //!< 11--26: Use as IEEE 802.15.4 channel, i.e. frequency is (2405 + 5 × (channel - 11)) MHz
- //!< 60--207: Frequency is (2300 + channel) MHz
- //!< Others: Reserved - struct { - uint8_t bAutoFlushCrc:1; //!< If 1, automatically remove packets with CRC error from Rx queue - uint8_t bAutoFlushIgn:1; //!< If 1, automatically remove packets that can be ignored according to frame filtering from Rx queue - uint8_t bIncludePhyHdr:1; //!< If 1, include the received PHY header field in the stored packet; otherwise discard it - uint8_t bIncludeCrc:1; //!< If 1, include the received CRC field in the stored packet; otherwise discard it - uint8_t bAppendRssi:1; //!< If 1, append an RSSI byte to the packet in the Rx queue - uint8_t bAppendCorrCrc:1; //!< If 1, append a correlation value and CRC result byte to the packet in the Rx queue - uint8_t bAppendSrcInd:1; //!< If 1, append an index from the source matching algorithm - uint8_t bAppendTimestamp:1; //!< If 1, append a timestamp to the packet in the Rx queue - } rxConfig; - dataQueue_t* pRxQ; //!< Pointer to receive queue - rfc_ieeeRxOutput_t *pOutput; //!< Pointer to output structure (NULL: Do not store results) - struct { - uint16_t frameFiltEn:1; //!< \brief 0: Disable frame filtering
- //!< 1: Enable frame filtering - uint16_t frameFiltStop:1; //!< \brief 0: Receive all packets to the end
- //!< 1: Stop receiving frame once frame filtering has caused the frame to be rejected. - uint16_t autoAckEn:1; //!< \brief 0: Disable auto ACK
- //!< 1: Enable auto ACK. - uint16_t slottedAckEn:1; //!< \brief 0: Non-slotted ACK
- //!< 1: Slotted ACK. - uint16_t autoPendEn:1; //!< \brief 0: Auto-pend disabled
- //!< 1: Auto-pend enabled - uint16_t defaultPend:1; //!< The value of the pending data bit in auto ACK packets that are not subject to auto-pend - uint16_t bPendDataReqOnly:1; //!< \brief 0: Use auto-pend for any packet
- //!< 1: Use auto-pend for data request packets only - uint16_t bPanCoord:1; //!< \brief 0: Device is not PAN coordinator
- //!< 1: Device is PAN coordinator - uint16_t maxFrameVersion:2; //!< Reject frames where the frame version field in the FCF is greater than this value - uint16_t fcfReservedMask:3; //!< Value to be AND-ed with the reserved part of the FCF; frame rejected if result is non-zero - uint16_t modifyFtFilter:2; //!< \brief Treatment of MSB of frame type field before frame-type filtering:
- //!< 0: No modification
- //!< 1: Invert MSB
- //!< 2: Set MSB to 0
- //!< 3: Set MSB to 1 - uint16_t bStrictLenFilter:1; //!< \brief 0: Accept acknowledgement frames of any length >= 5
- //!< 1: Accept only acknowledgement frames of length 5 - } frameFiltOpt; //!< Frame filtering options - struct { - uint8_t bAcceptFt0Beacon:1; //!< \brief Treatment of frames with frame type 000 (beacon):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt1Data:1; //!< \brief Treatment of frames with frame type 001 (data):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt2Ack:1; //!< \brief Treatment of frames with frame type 010 (ACK):
- //!< 0: Reject, unless running ACK receive command
- //!< 1: Always accept - uint8_t bAcceptFt3MacCmd:1; //!< \brief Treatment of frames with frame type 011 (MAC command):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt4Reserved:1; //!< \brief Treatment of frames with frame type 100 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt5Reserved:1; //!< \brief Treatment of frames with frame type 101 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt6Reserved:1; //!< \brief Treatment of frames with frame type 110 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt7Reserved:1; //!< \brief Treatment of frames with frame type 111 (reserved):
- //!< 0: Reject
- //!< 1: Accept - } frameTypes; //!< Frame types to receive in frame filtering - struct { - uint8_t ccaEnEnergy:1; //!< Enable energy scan as CCA source - uint8_t ccaEnCorr:1; //!< Enable correlator based carrier sense as CCA source - uint8_t ccaEnSync:1; //!< Enable sync found based carrier sense as CCA source - uint8_t ccaCorrOp:1; //!< \brief Operator to use between energy based and correlator based CCA
- //!< 0: Report busy channel if either ccaEnergy or ccaCorr are busy
- //!< 1: Report busy channel if both ccaEnergy and ccaCorr are busy - uint8_t ccaSyncOp:1; //!< \brief Operator to use between sync found based CCA and the others
- //!< 0: Always report busy channel if ccaSync is busy
- //!< 1: Always report idle channel if ccaSync is idle - uint8_t ccaCorrThr:2; //!< Threshold for number of correlation peaks in correlator based carrier sense - } ccaOpt; //!< CCA options - int8_t ccaRssiThr; //!< RSSI threshold for CCA - uint8_t __dummy0; - uint8_t numExtEntries; //!< Number of extended address entries - uint8_t numShortEntries; //!< Number of short address entries - uint32_t* pExtEntryList; //!< Pointer to list of extended address entries - uint32_t* pShortEntryList; //!< Pointer to list of short address entries - uint64_t localExtAddr; //!< The extended address of the local device - uint16_t localShortAddr; //!< The short address of the local device - uint16_t localPanID; //!< The PAN ID of the local device - uint16_t __dummy1; - uint8_t __dummy2; - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } endTrigger; //!< Trigger that causes the device to end the Rx operation - ratmr_t endTime; //!< \brief Time used together with endTrigger that causes the device to end the Rx - //!< operation -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_ED_SCAN -//! @{ -#define CMD_IEEE_ED_SCAN 0x2802 -//! IEEE 802.15.4 Energy Detect Scan Command -struct __RFC_STRUCT rfc_CMD_IEEE_ED_SCAN_s { - uint16_t commandNo; //!< The command ID number 0x2802 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips + 1 if the rule involves skipping. 0: same, 1: next, 2: skip next, ... - } condition; - uint8_t channel; //!< \brief Channel to tune to in the start of the operation
- //!< 0: Use existing channel
- //!< 11--26: Use as IEEE 802.15.4 channel, i.e. frequency is (2405 + 5 × (channel - 11)) MHz
- //!< 60--207: Frequency is (2300 + channel) MHz
- //!< Others: Reserved - struct { - uint8_t ccaEnEnergy:1; //!< Enable energy scan as CCA source - uint8_t ccaEnCorr:1; //!< Enable correlator based carrier sense as CCA source - uint8_t ccaEnSync:1; //!< Enable sync found based carrier sense as CCA source - uint8_t ccaCorrOp:1; //!< \brief Operator to use between energy based and correlator based CCA
- //!< 0: Report busy channel if either ccaEnergy or ccaCorr are busy
- //!< 1: Report busy channel if both ccaEnergy and ccaCorr are busy - uint8_t ccaSyncOp:1; //!< \brief Operator to use between sync found based CCA and the others
- //!< 0: Always report busy channel if ccaSync is busy
- //!< 1: Always report idle channel if ccaSync is idle - uint8_t ccaCorrThr:2; //!< Threshold for number of correlation peaks in correlator based carrier sense - } ccaOpt; //!< CCA options - int8_t ccaRssiThr; //!< RSSI threshold for CCA - uint8_t __dummy0; - int8_t maxRssi; //!< The maximum RSSI recorded during the ED scan - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } endTrigger; //!< Trigger that causes the device to end the Rx operation - ratmr_t endTime; //!< \brief Time used together with endTrigger that causes the device to end the Rx - //!< operation -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_TX -//! @{ -#define CMD_IEEE_TX 0x2C01 -//! IEEE 802.15.4 Transmit Command -struct __RFC_STRUCT rfc_CMD_IEEE_TX_s { - uint16_t commandNo; //!< The command ID number 0x2C01 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips + 1 if the rule involves skipping. 0: same, 1: next, 2: skip next, ... - } condition; - struct { - uint8_t bIncludePhyHdr:1; //!< \brief 0: Find PHY header automatically
- //!< 1: Insert PHY header from the buffer - uint8_t bIncludeCrc:1; //!< \brief 0: Append automatically calculated CRC
- //!< 1: Insert FCS (CRC) from the buffer - uint8_t :1; - uint8_t payloadLenMsb:5; //!< \brief Most significant bits of payload length. Should only be non-zero to create long - //!< non-standard packets for test purposes - } txOpt; - uint8_t payloadLen; //!< Number of bytes in the payload - uint8_t* pPayload; //!< Pointer to payload buffer of size payloadLen - ratmr_t timeStamp; //!< Time stamp of transmitted frame -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_CSMA -//! @{ -#define CMD_IEEE_CSMA 0x2C02 -//! IEEE 802.15.4 CSMA-CA Command -struct __RFC_STRUCT rfc_CMD_IEEE_CSMA_s { - uint16_t commandNo; //!< The command ID number 0x2C02 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips + 1 if the rule involves skipping. 0: same, 1: next, 2: skip next, ... - } condition; - uint16_t randomState; //!< The state of the pseudo-random generator - uint8_t macMaxBE; //!< The IEEE 802.15.4 MAC parameter macMaxBE - uint8_t macMaxCSMABackoffs; //!< The IEEE 802.15.4 MAC parameter macMaxCSMABackoffs - struct { - uint8_t initCW:5; //!< The initialization value for the CW parameter - uint8_t bSlotted:1; //!< \brief 0: non-slotted CSMA
- //!< 1: slotted CSMA - uint8_t rxOffMode:2; //!< \brief 0: RX stays on during CSMA backoffs
- //!< 1: The CSMA-CA algorithm will suspend the receiver if no frame is being received
- //!< 2: The CSMA-CA algorithm will suspend the receiver if no frame is being received, - //!< or after finishing it (including auto ACK) otherwise
- //!< 3: The CSMA-CA algorithm will suspend the receiver immediately during back-offs - } csmaConfig; - uint8_t NB; //!< The NB parameter from the IEEE 802.15.4 CSMA-CA algorithm - uint8_t BE; //!< The BE parameter from the IEEE 802.15.4 CSMA-CA algorithm - uint8_t remainingPeriods; //!< The number of remaining periods from a paused backoff countdown - int8_t lastRssi; //!< RSSI measured at the last CCA operation - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } endTrigger; //!< Trigger that causes the device to end the CSMA-CA operation - ratmr_t lastTimeStamp; //!< Time of the last CCA operation - ratmr_t endTime; //!< \brief Time used together with endTrigger that causes the device to end the - //!< CSMA-CA operation -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_RX_ACK -//! @{ -#define CMD_IEEE_RX_ACK 0x2C03 -//! IEEE 802.15.4 Receive Acknowledgement Command -struct __RFC_STRUCT rfc_CMD_IEEE_RX_ACK_s { - uint16_t commandNo; //!< The command ID number 0x2C03 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips + 1 if the rule involves skipping. 0: same, 1: next, 2: skip next, ... - } condition; - uint8_t seqNo; //!< Sequence number to expect - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } endTrigger; //!< Trigger that causes the device to give up acknowledgement reception - ratmr_t endTime; //!< \brief Time used together with endTrigger that causes the device to give up - //!< acknowledgement reception -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_ABORT_BG -//! @{ -#define CMD_IEEE_ABORT_BG 0x2C04 -//! IEEE 802.15.4 Abort Background Level Command -struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_BG_s { - uint16_t commandNo; //!< The command ID number 0x2C04 - uint16_t status; //!< \brief An integer telling the status of the command. This value is - //!< updated by the radio CPU during operation and may be read by the - //!< system CPU at any time. - rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done - ratmr_t startTime; //!< Absolute or relative start time (depending on the value of startTrigger) - struct { - uint8_t triggerType:4; //!< The type of trigger - uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command
- //!< 1: CMD_TRIGGER can be used as an alternative trigger - uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action - uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error
- //!< 1: A trigger in the past is triggered as soon as possible - } startTrigger; //!< Identification of the trigger that starts the operation - struct { - uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed - uint8_t nSkip:4; //!< Number of skips + 1 if the rule involves skipping. 0: same, 1: next, 2: skip next, ... - } condition; -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_MOD_CCA -//! @{ -#define CMD_IEEE_MOD_CCA 0x2001 -//! IEEE 802.15.4 Modify CCA Parameter Command -struct __RFC_STRUCT rfc_CMD_IEEE_MOD_CCA_s { - uint16_t commandNo; //!< The command ID number 0x2001 - struct { - uint8_t ccaEnEnergy:1; //!< Enable energy scan as CCA source - uint8_t ccaEnCorr:1; //!< Enable correlator based carrier sense as CCA source - uint8_t ccaEnSync:1; //!< Enable sync found based carrier sense as CCA source - uint8_t ccaCorrOp:1; //!< \brief Operator to use between energy based and correlator based CCA
- //!< 0: Report busy channel if either ccaEnergy or ccaCorr are busy
- //!< 1: Report busy channel if both ccaEnergy and ccaCorr are busy - uint8_t ccaSyncOp:1; //!< \brief Operator to use between sync found based CCA and the others
- //!< 0: Always report busy channel if ccaSync is busy
- //!< 1: Always report idle channel if ccaSync is idle - uint8_t ccaCorrThr:2; //!< Threshold for number of correlation peaks in correlator based carrier sense - } newCcaOpt; //!< New value of ccaOpt for the running background level operation - int8_t newCcaRssiThr; //!< New value of ccaRssiThr for the running background level operation -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_MOD_FILT -//! @{ -#define CMD_IEEE_MOD_FILT 0x2002 -//! IEEE 802.15.4 Modify Frame Filtering Parameter Command -struct __RFC_STRUCT rfc_CMD_IEEE_MOD_FILT_s { - uint16_t commandNo; //!< The command ID number 0x2002 - struct { - uint16_t frameFiltEn:1; //!< \brief 0: Disable frame filtering
- //!< 1: Enable frame filtering - uint16_t frameFiltStop:1; //!< \brief 0: Receive all packets to the end
- //!< 1: Stop receiving frame once frame filtering has caused the frame to be rejected. - uint16_t autoAckEn:1; //!< \brief 0: Disable auto ACK
- //!< 1: Enable auto ACK. - uint16_t slottedAckEn:1; //!< \brief 0: Non-slotted ACK
- //!< 1: Slotted ACK. - uint16_t autoPendEn:1; //!< \brief 0: Auto-pend disabled
- //!< 1: Auto-pend enabled - uint16_t defaultPend:1; //!< The value of the pending data bit in auto ACK packets that are not subject to auto-pend - uint16_t bPendDataReqOnly:1; //!< \brief 0: Use auto-pend for any packet
- //!< 1: Use auto-pend for data request packets only - uint16_t bPanCoord:1; //!< \brief 0: Device is not PAN coordinator
- //!< 1: Device is PAN coordinator - uint16_t maxFrameVersion:2; //!< Reject frames where the frame version field in the FCF is greater than this value - uint16_t fcfReservedMask:3; //!< Value to be AND-ed with the reserved part of the FCF; frame rejected if result is non-zero - uint16_t modifyFtFilter:2; //!< \brief Treatment of MSB of frame type field before frame-type filtering:
- //!< 0: No modification
- //!< 1: Invert MSB
- //!< 2: Set MSB to 0
- //!< 3: Set MSB to 1 - uint16_t bStrictLenFilter:1; //!< \brief 0: Accept acknowledgement frames of any length >= 5
- //!< 1: Accept only acknowledgement frames of length 5 - } newFrameFiltOpt; //!< New value of frameFiltOpt for the running background level operation - struct { - uint8_t bAcceptFt0Beacon:1; //!< \brief Treatment of frames with frame type 000 (beacon):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt1Data:1; //!< \brief Treatment of frames with frame type 001 (data):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt2Ack:1; //!< \brief Treatment of frames with frame type 010 (ACK):
- //!< 0: Reject, unless running ACK receive command
- //!< 1: Always accept - uint8_t bAcceptFt3MacCmd:1; //!< \brief Treatment of frames with frame type 011 (MAC command):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt4Reserved:1; //!< \brief Treatment of frames with frame type 100 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt5Reserved:1; //!< \brief Treatment of frames with frame type 101 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt6Reserved:1; //!< \brief Treatment of frames with frame type 110 (reserved):
- //!< 0: Reject
- //!< 1: Accept - uint8_t bAcceptFt7Reserved:1; //!< \brief Treatment of frames with frame type 111 (reserved):
- //!< 0: Reject
- //!< 1: Accept - } newFrameTypes; //!< New value of frameTypes for the running background level operation -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_MOD_SRC_MATCH -//! @{ -#define CMD_IEEE_MOD_SRC_MATCH 0x2003 -//! IEEE 802.15.4 Enable/Disable Source Matching Entry Command -struct __RFC_STRUCT rfc_CMD_IEEE_MOD_SRC_MATCH_s { - uint16_t commandNo; //!< The command ID number 0x2003 - struct { - uint8_t bEnable:1; //!< \brief 0: Disable entry
- //!< 1: Enable entry - uint8_t srcPend:1; //!< New value of the pending bit for the entry - uint8_t entryType:1; //!< \brief 0: Short address
- //!< 1: Extended address - } options; - uint8_t entryNo; //!< Index of entry to enable or disable -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_ABORT_FG -//! @{ -#define CMD_IEEE_ABORT_FG 0x2401 -//! IEEE 802.15.4 Abort Foreground Level Command -struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_FG_s { - uint16_t commandNo; //!< The command ID number 0x2401 -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_STOP_FG -//! @{ -#define CMD_IEEE_STOP_FG 0x2402 -//! IEEE 802.15.4 Gracefully Stop Foreground Level Command -struct __RFC_STRUCT rfc_CMD_IEEE_STOP_FG_s { - uint16_t commandNo; //!< The command ID number 0x2402 -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup CMD_IEEE_CCA_REQ -//! @{ -#define CMD_IEEE_CCA_REQ 0x2403 -//! IEEE 802.15.4 CCA and RSSI Information Request Command -struct __RFC_STRUCT rfc_CMD_IEEE_CCA_REQ_s { - uint16_t commandNo; //!< The command ID number 0x2403 - int8_t currentRssi; //!< The RSSI currently observed on the channel - int8_t maxRssi; //!< The maximum RSSI observed on the channel since Rx was started - struct { - uint8_t ccaState:2; //!< \brief Value of the current CCA state
- //!< 0: Idle
- //!< 1: Busy
- //!< 2: Invalid - uint8_t ccaEnergy:2; //!< \brief Value of the current energy detect CCA state
- //!< 0: Idle
- //!< 1: Busy
- //!< 2: Invalid - uint8_t ccaCorr:2; //!< \brief Value of the current correlator based carrier sense CCA state
- //!< 0: Idle
- //!< 1: Busy
- //!< 2: Invalid - uint8_t ccaSync:1; //!< \brief Value of the current sync found based carrier sense CCA state
- //!< 0: Idle
- //!< 1: Busy - } ccaInfo; -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup ieeeRxOutput -//! @{ -//! Output structure for CMD_IEEE_RX - -struct __RFC_STRUCT rfc_ieeeRxOutput_s { - uint8_t nTxAck; //!< Total number of transmitted ACK frames - uint8_t nRxBeacon; //!< Number of received beacon frames - uint8_t nRxData; //!< Number of received data frames - uint8_t nRxAck; //!< Number of received acknowledgement frames - uint8_t nRxMacCmd; //!< Number of received MAC command frames - uint8_t nRxReserved; //!< Number of received frames with reserved frame type - uint8_t nRxNok; //!< Number of received frames with CRC error - uint8_t nRxIgnored; //!< Number of frames received that are to be ignored - uint8_t nRxBufFull; //!< Number of received frames discarded because the Rx buffer was full - int8_t lastRssi; //!< RSSI of last received frame - int8_t maxRssi; //!< Highest RSSI observed in the operation - uint8_t __dummy0; - ratmr_t beaconTimeStamp; //!< Time stamp of last received beacon frame -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup shortAddrEntry -//! @{ -//! Structure for short address entries - -struct __RFC_STRUCT rfc_shortAddrEntry_s { - uint16_t shortAddr; //!< Short address - uint16_t panId; //!< PAN ID -} __RFC_STRUCT_ATTR; - -//! @} - -//! \addtogroup ieeeRxCorrCrc -//! @{ -//! Receive status byte that may be appended to message in receive buffer - -struct __RFC_STRUCT rfc_ieeeRxCorrCrc_s { - struct { - uint8_t corr:6; //!< The correlation value - uint8_t bIgnore:1; //!< 1 if the packet should be rejected by frame filtering, 0 otherwise - uint8_t bCrcErr:1; //!< 1 if the packet was received with CRC error, 0 otherwise - } status; -} __RFC_STRUCT_ATTR; - -//! @} - -//! @} -//! @} -#endif diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/driverlib/rf_ieee_mailbox.h b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/driverlib/rf_ieee_mailbox.h deleted file mode 100644 index fce171ff7..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/driverlib/rf_ieee_mailbox.h +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************** -* Filename: rf_ieee_mailbox.h -* Revised: 2018-01-23 19:51:42 +0100 (Tue, 23 Jan 2018) -* Revision: 18189 -* -* Description: Definitions for IEEE 802.15.4 interface -* -* Copyright (c) 2015 - 2017, Texas Instruments Incorporated -* 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 ORGANIZATION 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 _IEEE_MAILBOX_H -#define _IEEE_MAILBOX_H - -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) - -/// \name Radio operation status -///@{ -/// \name Operation not finished -///@{ -#define IEEE_SUSPENDED 0x2001 ///< Operation suspended -///@} -/// \name Operation finished normally -///@{ -#define IEEE_DONE_OK 0x2400 ///< Operation ended normally -#define IEEE_DONE_BUSY 0x2401 ///< CSMA-CA operation ended with failure -#define IEEE_DONE_STOPPED 0x2402 ///< Operation stopped after stop command -#define IEEE_DONE_ACK 0x2403 ///< ACK packet received with pending data bit cleared -#define IEEE_DONE_ACKPEND 0x2404 ///< ACK packet received with pending data bit set -#define IEEE_DONE_TIMEOUT 0x2405 ///< Operation ended due to timeout -#define IEEE_DONE_BGEND 0x2406 ///< FG operation ended because necessary background level - ///< operation ended -#define IEEE_DONE_ABORT 0x2407 ///< Operation aborted by command -///@} -/// \name Operation finished with error -///@{ -#define IEEE_ERROR_PAR 0x2800 ///< Illegal parameter -#define IEEE_ERROR_NO_SETUP 0x2801 ///< Operation using Rx or Tx attempted when not in 15.4 mode -#define IEEE_ERROR_NO_FS 0x2802 ///< Operation using Rx or Tx attempted without frequency synth configured -#define IEEE_ERROR_SYNTH_PROG 0x2803 ///< Synthesizer programming failed to complete on time -#define IEEE_ERROR_RXOVF 0x2804 ///< Receiver overflowed during operation -#define IEEE_ERROR_TXUNF 0x2805 ///< Transmitter underflowed during operation -///@} -///@} - -#endif diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/rf_patches/rf_patch_cpe_ieee.h b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/rf_patches/rf_patch_cpe_ieee.h deleted file mode 100644 index f3089f061..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/rf_patches/rf_patch_cpe_ieee.h +++ /dev/null @@ -1,269 +0,0 @@ -/****************************************************************************** -* Filename: rf_patch_cpe_ieee.h -* Revised: $Date$ -* Revision: $Revision$ -* -* Description: RF Core patch file for CC26xx IEEE 802.15.4 PHY -* -* Copyright (c) 2015, Texas Instruments Incorporated -* 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 ORGANIZATION 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 _RF_PATCH_CPE_IEEE_H -#define _RF_PATCH_CPE_IEEE_H - -//***************************************************************************** -// -// If building with a C++ compiler, make all of the definitions in this header -// have a C binding. -// -//***************************************************************************** -#ifdef __cplusplus -extern "C" -{ -#endif - -#include -#include - -#ifndef CPE_PATCH_TYPE -#define CPE_PATCH_TYPE static const uint32_t -#endif - -#ifndef SYS_PATCH_TYPE -#define SYS_PATCH_TYPE static const uint32_t -#endif - -#ifndef PATCH_FUN_SPEC -#define PATCH_FUN_SPEC static inline -#endif - -#ifndef _APPLY_PATCH_TAB -#define _APPLY_PATCH_TAB -#endif - - -CPE_PATCH_TYPE patchImageIeee[] = { - 0x210004ef, - 0x21000419, - 0x21000519, - 0x21000599, - 0x210004b1, - 0x22024823, - 0x421a7dc3, - 0xd0034472, - 0x1dc04678, - 0xb5f84686, - 0x4c1f4710, - 0x200834ae, - 0x490347a0, - 0x60082008, - 0x3cec6008, - 0xbdf847a0, - 0x40045004, - 0x4c17b5f0, - 0x18612140, - 0x280278c8, - 0x4809d005, - 0x60012100, - 0x47884908, - 0x6e25bdf0, - 0x60354e07, - 0x43280760, - 0x68276620, - 0x480e6024, - 0x60274780, - 0xbdf06035, - 0x4004112c, - 0x000065a5, - 0x40044028, - 0x4c07b510, - 0x29007da1, - 0x2101d105, - 0x024875a1, - 0x393e4904, - 0x68204788, - 0xd0002800, - 0xbd104780, - 0x21000254, - 0x0000398b, - 0x6a034807, - 0x46784907, - 0x46861dc0, - 0x4788b5f8, - 0x009b089b, - 0x6a014802, - 0xd10007c9, - 0xbdf86203, - 0x40045040, - 0x0000f1ab, - 0x6a00480b, - 0xd00407c0, - 0x2201480a, - 0x43117801, - 0x48097001, - 0x72c84700, - 0xd006280d, - 0x00802285, - 0x18800252, - 0x60486840, - 0x48044770, - 0x0000e7fb, - 0x40045040, - 0x21000268, - 0x0000ff39, - 0x210004d9, - 0x4e1ab5f8, - 0x6b314605, - 0x09cc4819, - 0x2d0001e4, - 0x4918d011, - 0x29027809, - 0x7b00d00f, - 0xb6724304, - 0x4f152001, - 0x47b80240, - 0x38204811, - 0x09c18800, - 0xd00407c9, - 0x7ac0e016, - 0x7b40e7f0, - 0x490fe7ee, - 0x61cc6334, - 0x07c00a40, - 0x2001d00c, - 0x6af10380, - 0xd0012d00, - 0xe0004301, - 0x46084381, - 0x490762f1, - 0x63483940, - 0x47b82000, - 0xbdf8b662, - 0x21000280, - 0x21000088, - 0x21000296, - 0x00003cdf, - 0x40044040, - 0x28004907, - 0x2004d000, - 0xb6724a06, - 0x07c97809, - 0x5810d001, - 0x2080e000, - 0xb240b662, - 0x00004770, - 0x2100026b, - 0x40046058, -}; -#define _NWORD_PATCHIMAGE_IEEE 111 - -#define _NWORD_PATCHSYS_IEEE 0 - -#define _IRQ_PATCH_0 0x21000449 -#define _IRQ_PATCH_1 0x21000489 - - -#ifndef _IEEE_SYSRAM_START -#define _IEEE_SYSRAM_START 0x20000000 -#endif - -#ifndef _IEEE_CPERAM_START -#define _IEEE_CPERAM_START 0x21000000 -#endif - -#define _IEEE_SYS_PATCH_FIXED_ADDR 0x20000000 - -#define _IEEE_PARSER_PATCH_TAB_OFFSET 0x0334 -#define _IEEE_PATCH_TAB_OFFSET 0x033C -#define _IEEE_IRQPATCH_OFFSET 0x03AC -#define _IEEE_PATCH_VEC_OFFSET 0x0404 - -PATCH_FUN_SPEC void enterIeeeCpePatch(void) -{ - uint32_t *pPatchVec = (uint32_t *) (_IEEE_CPERAM_START + _IEEE_PATCH_VEC_OFFSET); - -#if (_NWORD_PATCHIMAGE_IEEE > 0) - memcpy(pPatchVec, patchImageIeee, sizeof(patchImageIeee)); -#endif -} - -PATCH_FUN_SPEC void enterIeeeSysPatch(void) -{ -} - -PATCH_FUN_SPEC void configureIeeePatch(void) -{ - uint8_t *pPatchTab = (uint8_t *) (_IEEE_CPERAM_START + _IEEE_PATCH_TAB_OFFSET); - uint32_t *pIrqPatch = (uint32_t *) (_IEEE_CPERAM_START + _IEEE_IRQPATCH_OFFSET); - - - pPatchTab[5] = 0; - pPatchTab[52] = 1; - pPatchTab[103] = 2; - pPatchTab[60] = 3; - pPatchTab[38] = 4; - - pIrqPatch[1] = _IRQ_PATCH_0; - pIrqPatch[9] = _IRQ_PATCH_1; -} - -PATCH_FUN_SPEC void applyIeeePatch(void) -{ - enterIeeeSysPatch(); - enterIeeeCpePatch(); - configureIeeePatch(); -} - -PATCH_FUN_SPEC void refreshIeeePatch(void) -{ - enterIeeeCpePatch(); - configureIeeePatch(); -} - -PATCH_FUN_SPEC void rf_patch_cpe_ieee(void) -{ - applyIeeePatch(); -} - -#undef _IRQ_PATCH_0 -#undef _IRQ_PATCH_1 - -//***************************************************************************** -// -// Mark the end of the C bindings section for C++ compilers. -// -//***************************************************************************** -#ifdef __cplusplus -} -#endif - -#endif // _RF_PATCH_CPE_IEEE_H - diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/Makefile.cc13x2-cc26x2 b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/Makefile.cc13x2-cc26x2 deleted file mode 100644 index afe0ae429..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/Makefile.cc13x2-cc26x2 +++ /dev/null @@ -1,11 +0,0 @@ -################################################################################ -### CC13x2/CC26x2 CPU makefile - -# Simplelink SDK pre-compiled libraries -TARGET_LIBFILES += $(SDK_NORTOS)/lib/nortos_$(SDK_LIB_NAME).am4fg -TARGET_LIBFILES += $(SDK_DRIVERS)/rf/lib/rf_multiMode_$(SDK_LIB_NAME).am4fg -TARGET_LIBFILES += $(SDK_DRIVERS)/lib/drivers_$(SDK_LIB_NAME).am4fg -TARGET_LIBFILES += $(SDK_DEVICES)/driverlib/bin/gcc/driverlib.lib - -# CC13x2/CC26x2 is a Cortex-M4 architecture -include $(ARCH_PATH)/cpu/arm/cortex-m/cm4/Makefile.cm4 diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2-cm4.h b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2-cm4.h deleted file mode 100644 index 6a9bc65f4..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2-cm4.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Template: - * Copyright (c) 2012 ARM LIMITED - * All rights reserved. - * - * CC13xx-CC26xx: - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx - * @{ - * - * \defgroup cc26xx-cm4 CC13xx/CC26xx CMSIS - * - * CC13xx/CC26xx Cortex-M4 CMSIS definitions - * @{ - * - * \file - * CMSIS Cortex-M4 core peripheral access layer header file for CC13xx/CC26xx - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC13XX_CC26XX_CM4_H_ -#define CC13XX_CC26XX_CM4_H_ -/*---------------------------------------------------------------------------*/ -/** - * \name Interrupt Number Definition - * @{ - */ -typedef enum cc13xx_cc26xx_cm4_irq_e { - /* Cortex-M4 Processor Exceptions */ - CC13XX_CC26XX_CM4_EXCEPTION_RESET = -15, /**< 1 Reset */ - CC13XX_CC26XX_CM4_EXCEPTION_NMI = -14, /**< 2 NMI */ - CC13XX_CC26XX_CM4_EXCEPTION_HARD_FAULT = -13, /**< 3 Hard fault */ - CC13XX_CC26XX_CM4_EXCEPTION_MPU_FAULT = -12, /**< 4 MPU fault */ - CC13XX_CC26XX_CM4_EXCEPTION_BUS_FAULT = -11, /**< 5 Bus fault */ - CC13XX_CC26XX_CM4_EXCEPTION_USAGE_FAULT = -10, /**< 6 Usage fault */ - CC13XX_CC26XX_CM4_EXCEPTION_SV_CALL = -5, /**< 11 SVCall */ - CC13XX_CC26XX_CM4_EXCEPTION_DEBUG_MON = -4, /**< 12 Debug monitor */ - CC13XX_CC26XX_CM4_EXCEPTION_PEND_SV = -2, /**< 14 PendSV */ - CC13XX_CC26XX_CM4_EXCEPTION_SYS_TICK = -1, /**< 15 SysTick */ - - /* CC13xx/CC26xx interrupts */ - CC13XX_CC26XX_CM4_IRQ_EDGE_DETECT = 0, /**< 16 AON edge detect */ - CC13XX_CC26XX_CM4_EXCEPTION_I2C = 1, /**< 17 I2C */ - CC13XX_CC26XX_CM4_EXCEPTION_RF_CPE1 = 2, /**< 18 RF Command and Packet Engine 1 */ - CC13XX_CC26XX_CM4_EXCEPTION_AON_SPI_SLAVE = 3, /**< 19 AON SpiSplave Rx, Tx and CS */ - CC13XX_CC26XX_CM4_EXCEPTION_AON_RTC = 4, /**< 20 AON RTC */ - CC13XX_CC26XX_CM4_EXCEPTION_UART0 = 5, /**< 21 UART0 Rx and Tx */ - CC13XX_CC26XX_CM4_EXCEPTION_AON_AUX_SWEV0 = 6, /**< 22 Sensor Controller software event 0, through AON domain*/ - CC13XX_CC26XX_CM4_EXCEPTION_SSI0 = 7, /**< 23 SSI0 Rx and Tx */ - CC13XX_CC26XX_CM4_EXCEPTION_SSI1 = 8, /**< 24 SSI1 Rx and Tx */ - CC13XX_CC26XX_CM4_EXCEPTION_RF_CPE0 = 9, /**< 25 RF Command and Packet Engine 0 */ - CC13XX_CC26XX_CM4_EXCEPTION_RF_HW = 10, /**< 26 RF Core Hardware */ - CC13XX_CC26XX_CM4_EXCEPTION_RF_CMD_ACK = 11, /**< 27 RF Core Command Acknowledge */ - CC13XX_CC26XX_CM4_EXCEPTION_I2S = 12, /**< 28 I2S */ - CC13XX_CC26XX_CM4_EXCEPTION_AON_AUX_SWEV1 = 13, /**< 29 Sensor Controller software event 1, through AON domain*/ - CC13XX_CC26XX_CM4_EXCEPTION_WATCHDOG = 14, /**< 30 Watchdog timer */ - CC13XX_CC26XX_CM4_EXCEPTION_GPTIMER_0A = 15, /**< 31 Timer 0 subtimer A */ - CC13XX_CC26XX_CM4_EXCEPTION_GPTIMER_0B = 16, /**< 32 Timer 0 subtimer B */ - CC13XX_CC26XX_CM4_EXCEPTION_GPTIMER_1A = 17, /**< 33 Timer 1 subtimer A */ - CC13XX_CC26XX_CM4_EXCEPTION_GPTIMER_1B = 18, /**< 34 Timer 1 subtimer B */ - CC13XX_CC26XX_CM4_EXCEPTION_GPTIMER_2A = 19, /**< 35 Timer 2 subtimer A */ - CC13XX_CC26XX_CM4_EXCEPTION_GPTIMER_2B = 20, /**< 36 Timer 2 subtimer B */ - CC13XX_CC26XX_CM4_EXCEPTION_GPTIMER_3A = 21, /**< 37 Timer 3 subtimer A */ - CC13XX_CC26XX_CM4_EXCEPTION_GPTIMER_3B = 22, /**< 38 Timer 3 subtimer B */ - CC13XX_CC26XX_CM4_EXCEPTION_CRYPTO = 23, /**< 39 Crypto Core Result available */ - CC13XX_CC26XX_CM4_EXCEPTION_UDMA = 24, /**< 40 uDMA Software */ - CC13XX_CC26XX_CM4_EXCEPTION_UDMA_ERR = 25, /**< 41 uDMA Error */ - CC13XX_CC26XX_CM4_EXCEPTION_FLASH_CTRL = 26, /**< 42 Flash controller */ - CC13XX_CC26XX_CM4_EXCEPTION_SW0 = 27, /**< 43 Software Event 0 */ - CC13XX_CC26XX_CM4_EXCEPTION_AUX_COM_EVENT = 28, /**< 44 AUX combined event, directly to MCU domain*/ - CC13XX_CC26XX_CM4_EXCEPTION_AON_PRG0 = 29, /**< 45 AON programmable 0 */ - CC13XX_CC26XX_CM4_EXCEPTION_PROG = 30, /**< 46 Dynamic Programmable interrupt (default source: PRCM)*/ - CC13XX_CC26XX_CM4_EXCEPTION_AUX_COMPA = 31, /**< 47 AUX Comparator A */ - CC13XX_CC26XX_CM4_EXCEPTION_AUX_ADC = 32, /**< 48 AUX ADC IRQ */ - CC13XX_CC26XX_CM4_EXCEPTION_TRNG = 33, /**< 49 TRNG event */ -} cc13xx_cc26xx_cm4_irq_t; - -typedef cc13xx_cc26xx_cm4_irq_t IRQn_Type; - -#define SysTick_IRQn CC13XX_CC26XX_CM4_EXCEPTION_SYS_TICK -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Processor and Core Peripheral Section - * @{ - */ -/* Configuration of the Cortex-M4 Processor and Core Peripherals */ -#define __MPU_PRESENT 1 /**< MPU present or not */ -#define __NVIC_PRIO_BITS 3 /**< Number of Bits used for Priority Levels */ -#define __Vendor_SysTickConfig 0 /**< Set to 1 if different SysTick Config is used */ -/** @} */ -/*---------------------------------------------------------------------------*/ -#include "core_cm4.h" /* Cortex-M4 processor and core peripherals */ -/*---------------------------------------------------------------------------*/ -#endif /* CC13XX_CC26XX_CM4_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.icf b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.icf deleted file mode 100644 index 32316f445..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.icf +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2017, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -define symbol STACK_SIZE = 0x800; /* 2048 bytes */ -define symbol HEAP_SIZE = 0x100; /* 256 bytes */ - -define symbol __intvec_start__ = 0x00000000; - -/*-Memory Regions-*/ -define symbol ROM_start__ = 0x00000000; -define symbol ROM_end__ = 0x00057FFF; -define symbol RAM_start__ = 0x20000000; -define symbol RAM_end__ = 0x20013FFF; -define symbol GPRAM_start__ = 0x11000000; -define symbol GPRAM_end__ = 0x11001FFF; - -/* Define a memory region that covers the entire 4 GB addressable space */ -define memory mem with size = 4G; - -/* Define a region for the on-chip flash */ -define region FLASH_region = mem:[from ROM_start__ to ROM_end__]; - -/* Define a region for the on-chip SRAM */ -define region RAM_region = mem:[from RAM_start__ to RAM_end__]; - -/* Define a region for the on-chip GPRAM */ -define region GPRAM_region = mem:[from GPRAM_start__ to GPRAM_end__]; - -/* Place the interrupt vectors at the start of flash */ -place at address mem:__intvec_start__ { readonly section .intvec }; -keep { section .intvec }; - -/* Place the CCA area at the end of flash */ -place at end of FLASH_region { readonly section .ccfg }; -keep { section .ccfg }; - -/* Place remaining 'read only' in Flash */ -place in FLASH_region { readonly }; - -/* Place all read/write items into RAM */ -place in RAM_region { readwrite }; -initialize by copy { readwrite }; - -/* - * Define CSTACK block to contain .stack section. This enables the IAR IDE - * to properly show the stack content during debug. Place stack at end of - * retention RAM, do not initialize (initializing the stack will destroy the - * return address from the initialization code, causing the processor to branch - * to zero and fault) - */ -define block CSTACK with alignment = 8, size = STACK_SIZE { section .stack }; -place at end of RAM_region { block CSTACK }; -do not initialize { section .stack, section .noinit }; - -/* Export stack top symbol. Used by startup file */ -define exported symbol STACK_TOP = RAM_end__ + 1; - -/* Primary Heap configuration */ -define block HEAP with alignment = 8, size = HEAP_SIZE { }; - -/* Place heap just before CSTACK */ -place in RAM_region { block HEAP }; diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.lds b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.lds deleted file mode 100644 index dc1a608be..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.lds +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -MIN_STACKSIZE = 0x600; /* 1536 bytes */ -HEAPSIZE = 0x100; /* 256 bytes */ - -MEMORY -{ - FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x00057fa8 - /* - * Customer Configuration Area and Bootloader Backdoor configuration in - * flash, 40 bytes - */ - FLASH_CCFG (RX) : ORIGIN = 0x00057fa8, LENGTH = 0x00000058 - SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00014000 - GPRAM (RWX) : ORIGIN = 0x11000000, LENGTH = 0x00002000 -} - -REGION_ALIAS("REGION_TEXT", FLASH); -REGION_ALIAS("REGION_BSS", SRAM); -REGION_ALIAS("REGION_DATA", SRAM); -REGION_ALIAS("REGION_STACK", SRAM); -REGION_ALIAS("REGION_HEAP", SRAM); -REGION_ALIAS("REGION_ARM_EXIDX", FLASH); -REGION_ALIAS("REGION_ARM_EXTAB", FLASH); - -SECTIONS { - - PROVIDE (_resetVecs_base_addr = DEFINED(_resetVecs_base_addr) - ? _resetVecs_base_addr - : 0x0); - - .resetVecs (_resetVecs_base_addr) : AT (_resetVecs_base_addr) { - KEEP (*(.resetVecs)) - } > REGION_TEXT - - .ramVecs (NOLOAD) : ALIGN(1024) { - KEEP (*(.ramVecs)) - } > REGION_DATA - - /* - * UDMACC26XX_CONFIG_BASE below must match UDMACC26XX_CONFIG_BASE defined - * by ti/drivers/dma/UDMACC26XX.h - * The user is allowed to change UDMACC26XX_CONFIG_BASE to move it away from - * the default address 0x2000_1800, but remember it must be 1024 bytes aligned. - */ - UDMACC26XX_CONFIG_BASE = 0x20001800; - - /* - * Define absolute addresses for the DMA channels. - * DMA channels must always be allocated at a fixed offset from the DMA base address. - * CTEA := Control Table Entry Address - * --------- DO NOT MODIFY ----------- - */ - DMA_SPI0_RX_CTEA = (UDMACC26XX_CONFIG_BASE + 0x30); - DMA_SPI0_TX_CTEA = (UDMACC26XX_CONFIG_BASE + 0x40); - DMA_ADC_PRI_CTEA = (UDMACC26XX_CONFIG_BASE + 0x70); - DMA_GPT0A_PRI_CTEA = (UDMACC26XX_CONFIG_BASE + 0x90); - DMA_SPI1_RX_CTEA = (UDMACC26XX_CONFIG_BASE + 0x100); - DMA_SPI1_TX_CTEA = (UDMACC26XX_CONFIG_BASE + 0x110); - DMA_ADC_ALT_CTEA = (UDMACC26XX_CONFIG_BASE + 0x270); - DMA_GPT0A_ALT_CTEA = (UDMACC26XX_CONFIG_BASE + 0x290); - - /* - * Allocate SPI0, SPI1, ADC, and GPTimer0 DMA descriptors at absolute addresses. - * --------- DO NOT MODIFY ----------- - */ - UDMACC26XX_dmaSpi0RxControlTableEntry_is_placed = 0; - .dmaSpi0RxControlTableEntry DMA_SPI0_RX_CTEA (NOLOAD) : AT (DMA_SPI0_RX_CTEA) { - *(.dmaSpi0RxControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaSpi0TxControlTableEntry_is_placed = 0; - .dmaSpi0TxControlTableEntry DMA_SPI0_TX_CTEA (NOLOAD) : AT (DMA_SPI0_TX_CTEA) { - *(.dmaSpi0TxControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaADCPriControlTableEntry_is_placed = 0; - .dmaADCPriControlTableEntry DMA_ADC_PRI_CTEA (NOLOAD) : AT (DMA_ADC_PRI_CTEA) { - *(.dmaADCPriControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaGPT0APriControlTableEntry_is_placed = 0; - .dmaGPT0APriControlTableEntry DMA_GPT0A_PRI_CTEA (NOLOAD) : AT (DMA_GPT0A_PRI_CTEA) { - *(.dmaGPT0APriControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaSpi1RxControlTableEntry_is_placed = 0; - .dmaSpi1RxControlTableEntry DMA_SPI1_RX_CTEA (NOLOAD) : AT (DMA_SPI1_RX_CTEA) { - *(.dmaSpi1RxControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaSpi1TxControlTableEntry_is_placed = 0; - .dmaSpi1TxControlTableEntry DMA_SPI1_TX_CTEA (NOLOAD) : AT (DMA_SPI1_TX_CTEA) { - *(.dmaSpi1TxControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaADCAltControlTableEntry_is_placed = 0; - .dmaADCAltControlTableEntry DMA_ADC_ALT_CTEA (NOLOAD) : AT (DMA_ADC_ALT_CTEA) { - *(.dmaADCAltControlTableEntry) - } > REGION_DATA - - UDMACC26XX_dmaGPT0AAltControlTableEntry_is_placed = 0; - .dmaGPT0AAltControlTableEntry DMA_GPT0A_ALT_CTEA (NOLOAD) : AT (DMA_GPT0A_ALT_CTEA) { - *(.dmaGPT0AAltControlTableEntry) - } > REGION_DATA - - .text : { - CREATE_OBJECT_SYMBOLS - *(.text) - *(.text.*) - . = ALIGN(0x4); - KEEP (*(.ctors)) - . = ALIGN(0x4); - KEEP (*(.dtors)) - . = ALIGN(0x4); - __init_array_start = .; - KEEP (*(.init_array*)) - __init_array_end = .; - *(.init) - *(.fini*) - } > REGION_TEXT AT> REGION_TEXT - - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - - .rodata : { - *(.rodata) - *(.rodata.*) - } > REGION_TEXT AT> REGION_TEXT - - .data : ALIGN(0x4) { - __data_load__ = LOADADDR(.data); - __data_start__ = .; - *(.data) - *(.data.*) - . = ALIGN (0x4); - __data_end__ = .; - } > REGION_DATA AT> REGION_TEXT - - .ARM.exidx : { - __exidx_start = .; - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - __exidx_end = .; - } > REGION_ARM_EXIDX AT> REGION_ARM_EXIDX - - .ARM.extab : { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > REGION_ARM_EXTAB AT> REGION_ARM_EXTAB - - .nvs (NOLOAD) : ALIGN(0x2000) { - *(.nvs) - } > REGION_TEXT - - .ccfg : { - KEEP(*(.ccfg)) - } > FLASH_CCFG AT> FLASH_CCFG - - .bss : { - __bss_start__ = .; - *(.shbss) - *(.bss) - *(.bss.*) - *(COMMON) - . = ALIGN(0x4); - __bss_end__ = .; - } > REGION_BSS AT> REGION_BSS - - /* Start of heap must be 4 byte aligned */ - .heap (NOLOAD) : ALIGN(0x4) { - PROVIDE(__heap_start__ = .); - PROVIDE(_heap = __heap_start__); - PROVIDE(end = __heap_start__); - PROVIDE(_end = __heap_start__); - PROVIDE(__end = __heap_start__); - - . += HEAPSIZE; - KEEP(*(.heap)) - - PROVIDE(__heap_end__ = .); - PROVIDE(_eheap = __heap_end__); - PROVIDE(__HeapLimit = __heap_end__); - } > REGION_HEAP AT> REGION_HEAP - - PROVIDE(__stack_size = ORIGIN(SRAM) + LENGTH(SRAM) - ALIGN(0x8)); - - /* Start of stack must be 8 byte aligned */ - .stack (NOLOAD) : { - PROVIDE(_stack = ALIGN(0x8)); - PROVIDE(__stack = _stack); - - PROVIDE(_stack_end = ORIGIN(SRAM) + LENGTH(SRAM)); - PROVIDE(__stack_end = _stack_end); - PROVIDE(_stack_origin = _stack_end); - - /* Note that the stack check library requires the symbols */ - /* "_stack" and "_stack_origin" to be defined. */ - - /* Assert that we have enough stack */ - ASSERT(__stack_size >= MIN_STACKSIZE, "Error: No room left for the stack"); - } > REGION_STACK AT> REGION_STACK -} diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13xx-cc26xx-conf.h b/arch/cpu/simplelink-cc13xx-cc26xx/cc13xx-cc26xx-conf.h deleted file mode 100644 index 49013070e..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13xx-cc26xx-conf.h +++ /dev/null @@ -1,498 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \file - * Header with configuration defines common to the CC13xx/CC26xx - * platform. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC13XX_CC26XX_CONF_H_ -#define CC13XX_CC26XX_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "cc13xx-cc26xx-def.h" - -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board Configuration. - * - * @{ - */ - -/* Configure that a board has sensors for the dev/sensors.h API. */ -#ifndef BOARD_CONF_HAS_SENSORS -#define BOARD_CONF_HAS_SENSORS 0 -#endif - -/* Enable/disable the dev/sensors.h API for the given board. */ -#ifndef BOARD_CONF_SENSORS_DISABLE -#define BOARD_CONF_SENSORS_DISABLE 0 -#endif -/*---------------------------------------------------------------------------*/ -/** - * \name GPIO HAL configuration. - * - * @{ - */ -#define GPIO_HAL_CONF_ARCH_SW_TOGGLE 0 -#define GPIO_HAL_CONF_ARCH_HDR_PATH "dev/gpio-hal-arch.h" -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Watchdog Configuration. - * - * @{ - */ -#ifndef WATCHDOG_CONF_DISABLE -#define WATCHDOG_CONF_DISABLE 0 -#endif - -#ifndef WATCHDOG_CONF_TIMER_TOP -#define WATCHDOG_CONF_TIMER_TOP 0xFFFFF -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name RF configuration. - * - * @{ - */ - -/* - * Set the inactivity timeout period for the RF driver. This determines how - * long the RF driver will wait when inactive until turning off the RF Core. - * Specified in microseconds. - */ -#ifndef RF_CONF_INACTIVITY_TIMEOUT -#define RF_CONF_INACTIVITY_TIMEOUT 2000 /**< 2 ms */ -#endif - -/* - * Configure TX power to either default PA or High PA, defaults to - * default PA. - */ -#ifndef RF_CONF_TXPOWER_HIGH_PA -#define RF_CONF_TXPOWER_HIGH_PA 0 -#endif - -#if (RF_CONF_TXPOWER_HIGH_PA) && !(SUPPORTS_HIGH_PA) -#error "Device does not support High PA" -#endif - -/* - * CC13xx only: Configure TX power to use boot mode, allowing to gain - * up to 14 dBm with the default PA. This will, however, increase power - * consumption. - */ -#ifndef RF_CONF_TXPOWER_BOOST_MODE -#define RF_CONF_TXPOWER_BOOST_MODE 0 -#endif - -/* - * Configure RF mode. That is, whether to run on Sub-1 GHz (Prop-mode) or - * 2.4 GHz (IEEE-mode). - */ -#ifdef RF_CONF_MODE -/* Sanity check a valid configuration is provided. */ -#if !(RF_CONF_MODE & RF_MODE_BM) -#error "Invalid RF_CONF_MODE provided" -#endif - -#define RF_MODE RF_CONF_MODE -#endif /* RF_CONF_MODE */ - -/* Sub-1 GHz path front-end mode configuration */ -#ifdef RF_SUB_1_GHZ_CONF_FRONT_END_MODE -#define RF_SUB_1_GHZ_FRONT_END_MODE RF_SUB_1_GHZ_CONF_FRONT_END_MODE -#else -#define RF_SUB_1_GHZ_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#endif - -#ifdef RF_SUB_1_GHZ_CONF_BIAS_MODE -#define RF_SUB_1_GHZ_BIAS_MODE RF_SUB_1_GHZ_CONF_BIAS_MODE -#else -#define RF_SUB_1_GHZ_BIAS_MODE RF_BIAS_MODE_INTERNAL -#endif - -/* 2.4 GHz path front-end mode configuration */ -#ifdef RF_2_4_GHZ_CONF_FRONT_END_MODE -#define RF_2_4_GHZ_FRONT_END_MODE RF_2_4_GHZ_CONF_FRONT_END_MODE -#else -#define RF_2_4_GHZ_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#endif - -#ifdef RF_2_4_GHZ_CONF_BIAS_MODE -#define RF_2_4_GHZ_BIAS_MODE RF_2_4_GHZ_CONF_BIAS_MODE -#else -#define RF_2_4_GHZ_BIAS_MODE RF_BIAS_MODE_INTERNAL -#endif - -/* Number of RX buffers. */ -#ifndef RF_CONF_RX_BUF_CNT -#define RF_CONF_RX_BUF_CNT 4 -#endif - -/* Size of each RX buffer in bytes. */ -#ifndef RF_CONF_RX_BUF_SIZE -#define RF_CONF_RX_BUF_SIZE 144 -#endif - -/* Enable/disable BLE beacon. */ -#ifndef RF_CONF_BLE_BEACON_ENABLE -#define RF_CONF_BLE_BEACON_ENABLE 0 -#endif - -#if (RF_CONF_BLE_BEACON_ENABLE) && !(SUPPORTS_BLE_BEACON) -#error "Device does not support BLE for BLE beacon" -#endif - -/*----- CC13xx Device Line --------------------------------------------------*/ -/* CC13xx supports both IEEE and Prop mode, depending on which device. */ -#if defined(DEVICE_LINE_CC13XX) - -/* Default to Prop-mode for CC13xx devices if not configured. */ -#ifndef RF_MODE -#define RF_MODE RF_MODE_SUB_1_GHZ -#endif - -/*----- CC13xx Prop-mode ----------------------------------------------------*/ -#if (RF_MODE == RF_MODE_SUB_1_GHZ) && (SUPPORTS_PROP_MODE) - -/* Netstack configuration. */ -#define NETSTACK_CONF_RADIO prop_mode_driver - -/* CSMA configuration. */ -#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 300) -#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000) -#define CSMA_CONF_SEND_SOFT_ACK 1 - -/*----- CC13xx IEEE-mode ----------------------------------------------------*/ -#elif (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE) - -/* Netstack configuration. */ -#define NETSTACK_CONF_RADIO ieee_mode_driver - -/* CSMA configuration. */ -#define CSMA_CONF_SEND_SOFT_ACK 0 - -#else -/*----- CC13xx Unsupported Mode ---------------------------------------------*/ -#error "Invalid RF mode configuration of CC13xx device" -#endif /* CC13xx RF Mode configuration */ - -/*----- CC26xx Device Line --------------------------------------------------*/ -/* CC26xx only supports IEEE mode */ -#elif defined(DEVICE_LINE_CC26XX) - -/* Default to IEEE-mode for CC26xx devices if not configured */ -#ifndef RF_MODE -#define RF_MODE RF_MODE_2_4_GHZ -#endif - -/*----- CC26xx IEEE-mode ----------------------------------------------------*/ -#if (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE) - -/* Netstack configuration */ -#define NETSTACK_CONF_RADIO ieee_mode_driver - -/* CSMA configuration */ -#define CSMA_CONF_SEND_SOFT_ACK 0 - -/* Frequncy band configuration */ -#undef DOT_15_4G_FREQ_BAND_ID -#define DOT_15_4G_CONF_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_2450 - -#else -/*----- CC26xx Unsupported Mode ---------------------------------------------*/ -#error "IEEE-mode only supported by CC26xx devices" -#endif /* CC26xx RF Mode configuration */ - -/*----- Unsupported device line ---------------------------------------------*/ -#else -#error "Unsupported Device Line defined" -#endif /* Unsupported device line */ - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name IEEE address configuration. Used to generate our link-local and - * global IPv6 addresses. - * @{ - */ - -/** - * \brief Location of the IEEE address. - * 0 => Read from InfoPage. - * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS. - */ -#ifndef IEEE_ADDR_CONF_HARDCODED -#define IEEE_ADDR_CONF_HARDCODED 0 -#endif - -/** - * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED - * is defined as 1. Must be a byte array of size 8. - */ -#ifndef IEEE_ADDR_CONF_ADDRESS -#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF } -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name IEEE-mode configuration. - * - * @{ - */ - -/** - * \brief Configuration to enable/disable auto ACKs in IEEE-mode. - * 0 => ACK generated by software - * 1 => ACK generated by the radio. - */ -#ifndef IEEE_MODE_CONF_AUTOACK -#define IEEE_MODE_CONF_AUTOACK 1 -#endif - -/** - * \brief Configuration to enable/disable frame filtering in IEEE-mode. - * 0 => Disable promiscous mode. - * 1 => Enable promiscous mode. - */ -#ifndef IEEE_MODE_CONF_PROMISCOUS -#define IEEE_MODE_CONF_PROMISCOUS 0 -#endif - -/** - * \brief Configuration to set the RSSI threshold in dBm in IEEE-mode. - * Defaults to -90 dBm. - */ -#ifndef IEEE_MODE_CONF_CCA_RSSI_THRESHOLD -#define IEEE_MODE_CONF_CCA_RSSI_THRESHOLD 0xA6 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Prop-mode configuration. - * - * @{ - */ - -/** - * \brief Configuration to set whitener in Prop-mode. - * 0 => No whitener - * 1 => Whitener. - */ -#ifndef PROP_MODE_CONF_DW -#define PROP_MODE_CONF_DW 0 -#endif - -/** - * \brief Use 16-bit or 32-bit CRC in Prop-mode. - * 0 => 32-bit CRC. - * 1 => 16-bit CRC. - */ -#ifndef PROP_MODE_CONF_USE_CRC16 -#define PROP_MODE_CONF_USE_CRC16 0 -#endif - -/** - * \brief Configuration to set the RSSI threshold in dBm in Prop-mode. - * Defaults to -90 dBm. - */ -#ifndef PROP_MODE_CONF_CCA_RSSI_THRESHOLD -#define PROP_MODE_CONF_CCA_RSSI_THRESHOLD 0xA6 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name TI Drivers Configuration. - * - * @{ - */ - -/** - * \brief Enable or disable UART driver. - */ -#ifndef TI_UART_CONF_ENABLE -#define TI_UART_CONF_ENABLE 1 -#endif - -/** - * \brief Enable or disable UART0 peripheral. - */ -#ifndef TI_UART_CONF_UART0_ENABLE -#define TI_UART_CONF_UART0_ENABLE TI_UART_CONF_ENABLE -#endif - -/** - * \brief Enable or disable UART1 peripheral. - */ -#ifndef TI_UART_CONF_UART1_ENABLE -#define TI_UART_CONF_UART1_ENABLE 0 -#endif - -/** - * \brief UART driver baud rate configuration. - */ -#ifndef TI_UART_CONF_BAUD_RATE -#define TI_UART_CONF_BAUD_RATE 115200 -#endif - -/** - * \brief Enable or disable SPI driver. - */ -#ifndef TI_SPI_CONF_ENABLE -#define TI_SPI_CONF_ENABLE 1 -#endif - -/** - * \brief Enable or disable SPI0 peripheral. - */ -#ifndef TI_SPI_CONF_SPI0_ENABLE -#define TI_SPI_CONF_SPI0_ENABLE TI_SPI_CONF_ENABLE -#endif - -/** - * \brief Enable or disable SPI1 peripheral. - */ -#ifndef TI_SPI_CONF_SPI1_ENABLE -#define TI_SPI_CONF_SPI1_ENABLE 0 -#endif - -/** - * \brief Enable or disable I2C driver. - */ -#ifndef TI_I2C_CONF_ENABLE -#define TI_I2C_CONF_ENABLE 1 -#endif - -/** - * \brief Enable or disable I2C0 peripheral. - */ -#ifndef TI_I2C_CONF_I2C0_ENABLE -#define TI_I2C_CONF_I2C0_ENABLE TI_I2C_CONF_ENABLE -#endif - -/** - * \brief Enable or disable Non-Volatile Storage (NVS) driver. - */ -#ifndef TI_NVS_CONF_ENABLE -#define TI_NVS_CONF_ENABLE 0 -#endif - -/** - * \brief Enable or disable internal flash storage. - */ -#ifndef TI_NVS_CONF_NVS_INTERNAL_ENABLE -#define TI_NVS_CONF_NVS_INTERNAL_ENABLE TI_NVS_CONF_ENABLE -#endif - -/** - * \brief Enable or disable external flash storage. - */ -#ifndef TI_NVS_CONF_NVS_EXTERNAL_ENABLE -#define TI_NVS_CONF_NVS_EXTERNAL_ENABLE TI_NVS_CONF_ENABLE -#endif - -/** - * \brief Enable or disable SD driver. - */ -#ifndef TI_SD_CONF_ENABLE -#define TI_SD_CONF_ENABLE 0 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI HAL configuration. - * - * CC13x0/CC26x0 has one SPI interface, while CC13x2/CC26x2 has two - * SPI interfaces. Some additional checks has to be made for the - * SPI_CONF_CONTROLLER_COUNT configuration, as this relies on whether the - * available SPI interfaces are enabled or not, as well as if the SPI driver - * is enabled at all. - * - * @{ - */ -#if TI_SPI_CONF_ENABLE -/* - * The SPI driver is enabled. Therefore, the number of SPI interfaces depends - * on which Device family parent the device falls under and if any of its - * corresponding SPI interfaces are enabled or not. - */ - -#define SPI0_IS_ENABLED ((TI_SPI_CONF_SPI0_ENABLE) ? 1 : 0) -#define SPI1_IS_ENABLED ((TI_SPI_CONF_SPI1_ENABLE) ? 1 : 0) - -#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) - -/* CC13x0/CC26x0 only has one SPI interface: SPI0. */ -#define SPI_CONF_CONTROLLER_COUNT (SPI0_IS_ENABLED) - -#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2) - -/* CC13x0/CC26x0 only has two SPI interface: SPI0 and SPI1. */ -#define SPI_CONF_CONTROLLER_COUNT (SPI0_IS_ENABLED + SPI1_IS_ENABLED) - -#endif /* DeviceFamily_PARENT */ - -#else /* TI_SPI_CONF_ENABLE */ -/* - * If the SPI driver is disabled then there are 0 available - * SPI interfaces. */ -#define SPI_CONF_CONTROLLER_COUNT 0 -#endif /* TI_SPI_CONF_ENABLE */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Slip configuration - * - * @{ - */ -#ifndef SLIP_ARCH_CONF_ENABLED -/* - * Determine whether we need SLIP - * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT - * keep using SLIP - */ -#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT) -#define SLIP_ARCH_CONF_ENABLED 1 -#endif - -#endif /* SLIP_ARCH_CONF_ENABLED */ -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* CC13XX_CC26XX_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13xx-cc26xx-def.h b/arch/cpu/simplelink-cc13xx-cc26xx/cc13xx-cc26xx-def.h deleted file mode 100644 index 5bcde9d93..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13xx-cc26xx-def.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \file - * Header with configuration defines for the Contiki system. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC13XX_CC26XX_DEF_H_ -#define CC13XX_CC26XX_DEF_H_ -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) -#include -#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2) -#include -#endif -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -#define RTIMER_ARCH_SECOND 65536 -/*---------------------------------------------------------------------------*/ -#define INT_MASTER_CONF_STATUS_DATATYPE uintptr_t -/*---------------------------------------------------------------------------*/ -/* TSCH related defines */ - -/* 1 len byte, 2 bytes CRC */ -#define RADIO_PHY_OVERHEAD 3 -/* 250kbps data rate. One byte = 32us */ -#define RADIO_BYTE_AIR_TIME 32 -/* Delay between GO signal and SFD */ -#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(81)) -/* Delay between GO signal and start listening. - * This value is so small because the radio is constantly on within each timeslot. */ -#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(15)) -/* Delay between the SFD finishes arriving and it is detected in software. */ -#define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(352)) - -/* Timer conversion; radio is running at 4 MHz */ -#define RAT_SECOND 4000000u -#define RAT_TO_RTIMER(x) ((uint32_t)(((uint64_t)(x)*(RTIMER_SECOND / 256)) / (RAT_SECOND / 256))) -#define USEC_TO_RAT(x) ((x) * 4) - -#if (RTIMER_SECOND % 256) || (RAT_SECOND % 256) -#error RAT_TO_RTIMER macro must be fixed! -#endif - -/* The PHY header (preamble + SFD, 4+1 bytes) duration is equivalent to 10 symbols */ -#define RADIO_IEEE_802154_PHY_HEADER_DURATION_USEC 160 - -/* Do not turn off TSCH within a timeslot: not enough time */ -#define TSCH_CONF_RADIO_ON_DURING_TIMESLOT 1 - -/* Disable TSCH frame filtering */ -#define TSCH_CONF_HW_FRAME_FILTERING 0 - -/* Use hardware timestamps */ -#ifndef TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS -#define TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS 1 -#define TSCH_CONF_TIMESYNC_REMOVE_JITTER 0 -#endif - -#ifndef TSCH_CONF_BASE_DRIFT_PPM -/* - * The drift compared to "true" 10ms slots. - * Enable adaptive sync to enable compensation for this. - * Slot length 10000 usec - * 328 ticks - * Tick duration 30.517578125 usec - * Real slot duration 10009.765625 usec - * Target - real duration = -9.765625 usec - * TSCH_CONF_BASE_DRIFT_PPM -977 - */ -#define TSCH_CONF_BASE_DRIFT_PPM -977 -#endif - -/* 10 times per second */ -#ifndef TSCH_CONF_CHANNEL_SCAN_DURATION -#define TSCH_CONF_CHANNEL_SCAN_DURATION (CLOCK_SECOND / 10) -#endif - -/* Slightly reduce the TSCH guard time (from 2200 usec to 1800 usec) to make sure - * the CC26xx radio has sufficient time to start up. */ -#ifndef TSCH_CONF_RX_WAIT -#define TSCH_CONF_RX_WAIT 1800 -#endif -/*---------------------------------------------------------------------------*/ -/* Path to CMSIS header */ -#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) -#define CMSIS_CONF_HEADER_PATH "cc13x0-cc26x0-cm3.h" -#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2) -#define CMSIS_CONF_HEADER_PATH "cc13x2-cc26x2-cm4.h" -#endif -/*---------------------------------------------------------------------------*/ -/* Path to headers with implementation of mutexes and memory barriers */ -#define MUTEX_CONF_ARCH_HEADER_PATH "mutex-cortex.h" -#define MEMORY_BARRIER_CONF_ARCH_HEADER_PATH "memory-barrier-cortex.h" -/*---------------------------------------------------------------------------*/ -#endif /* CC13XX_CC26XX_DEF_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/ccfg-conf.c b/arch/cpu/simplelink-cc13xx-cc26xx/ccfg-conf.c deleted file mode 100644 index ef83fc29b..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/ccfg-conf.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-ccfg Customer Configuration (CCFG) - * - * @{ - * - * \file - * Configuration of CCFG. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki-conf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name JTAG interface configuration - * - * Enable/Disable the JTAG DAP and TAP interfaces on the chip. - * Setting this to 0 will disable access to the debug interface - * to secure deployed images. - * @{ - */ -#if CCFG_CONF_JTAG_INTERFACE_DISABLE -#define SET_CCFG_CCFG_TI_OPTIONS_TI_FA_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_0_CPU_DAP_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_0_PRCM_TAP_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_0_TEST_TAP_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_1_PBIST2_TAP_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_1_PBIST1_TAP_ENABLE 0x00 -#define SET_CCFG_CCFG_TAP_DAP_1_WUC_TAP_ENABLE 0x00 -#endif /* CCFG_CONF_JTAG_INTERFACE_DISABLE */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name TX Power Boost Mode - * - * CC13xx only: Enable/Disable boost mode, which enables maximum +14 dBm - * output power with the default PA front-end configuration. - * @{ - */ -#if defined(DEVICE_LINE_CC13XX) && (RF_CONF_TXPOWER_BOOST_MODE) -#define CCFG_FORCE_VDDR_HH 1 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ROM Bootloader configuration - * - * Enable/Disable the ROM bootloader in your image, if the board supports it. - * Look in Board.h to choose the DIO and corresponding level that will cause - * the chip to enter bootloader mode. - * @{ - */ -#ifndef CCFG_CONF_ROM_BOOTLOADER_ENABLE -#define CCFG_CONF_ROM_BOOTLOADER_ENABLE 0 -#endif - -#if CCFG_CONF_ROM_BOOTLOADER_ENABLE -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 -#if defined(CCFG_CONF_BL_PIN_NUMBER) -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER CCFG_CONF_BL_PIN_NUMBER -#endif -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 -#endif /* CCFG_CONF_ROM_BOOTLOADER_ENABLE */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Include the device-specific CCFG file from the SDK. - * - * @{ - */ -#include -#include DeviceFamily_constructPath(startup_files/ccfg.c) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/clock-arch.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/clock-arch.c deleted file mode 100644 index ef2d4e1c9..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/clock-arch.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-clock CC13xx/CC26xx clock library - * - * @{ - * \file - * Implementation of the clock libary for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/etimer.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/aon_rtc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) -#include DeviceFamily_constructPath(driverlib/interrupt.h) -#include DeviceFamily_constructPath(driverlib/prcm.h) -#include DeviceFamily_constructPath(driverlib/timer.h) - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -static volatile clock_time_t count; -static ClockP_Struct etimer_clock; -/*---------------------------------------------------------------------------*/ -static void -clock_update_cb(void) -{ - const uintptr_t key = HwiP_disable(); - count += 1; - HwiP_restore(key); - - /* Notify the etimer system. */ - if(etimer_pending()) { - etimer_request_poll(); - } -} -/*---------------------------------------------------------------------------*/ -static inline clock_time_t -get_count(void) -{ - clock_time_t count_read; - - const uintptr_t key = HwiP_disable(); - count_read = count; - HwiP_restore(key); - - return count_read; -} -/*---------------------------------------------------------------------------*/ -void -clock_init(void) -{ - /* ClockP_getSystemTickPeriod() returns ticks per us. */ - const uint32_t clockp_ticks_second = - (uint32_t)(1000 * 1000) / (CLOCK_SECOND) / ClockP_getSystemTickPeriod(); - - count = 0; - - ClockP_Params params; - ClockP_Params_init(¶ms); - - params.period = clockp_ticks_second; - params.startFlag = true; - - ClockP_construct(&etimer_clock, (ClockP_Fxn)clock_update_cb, - clockp_ticks_second, ¶ms); -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - return get_count(); -} -/*---------------------------------------------------------------------------*/ -unsigned long -clock_seconds(void) -{ - return (unsigned long)get_count() / CLOCK_SECOND; -} -/*---------------------------------------------------------------------------*/ -void -clock_wait(clock_time_t i) -{ - clock_time_t start; - - start = clock_time(); - while(clock_time() - start < i); -} -/*---------------------------------------------------------------------------*/ -void -clock_delay_usec(uint16_t usec) -{ - ClockP_usleep(usec); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Obsolete delay function but we implement it here since some code - * still uses it. - */ -void -clock_delay(unsigned int i) -{ - clock_delay_usec(i); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/dbg-arch.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/dbg-arch.c deleted file mode 100644 index 823239f21..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/dbg-arch.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-platform - * @{ - * - * \file - * Implementation of the dbg module for CC13xx/CC26xx, used by stdio. - * The dbg module is implemented by writing to UART0. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include "uart0-arch.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -/*---------------------------------------------------------------------------*/ -int -dbg_putchar(int c) -{ - unsigned char ch; - int num_bytes; - - ch = (unsigned char)c; - - num_bytes = (int)uart0_write(&ch, 1); - return (num_bytes > 0) - ? num_bytes - : 0; -} -/*---------------------------------------------------------------------------*/ -unsigned int -dbg_send_bytes(const unsigned char *seq, unsigned int len) -{ - size_t seq_len; - size_t max_len; - int num_bytes; - - seq_len = strlen((const char *)seq); - max_len = MIN(seq_len, (size_t)len); - - if(max_len == 0) { - return 0; - } - - num_bytes = (int)uart0_write(seq, max_len); - return (num_bytes > 0) - ? num_bytes - : 0; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/gpio-hal-arch.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/gpio-hal-arch.c deleted file mode 100644 index f07a1f693..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/gpio-hal-arch.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-gpio-hal - * @{ - * - * \file - * Implementation of the GPIO HAL module for CC13xx/CC26xx. The GPIO - * HAL module is implemented by using the PINCC26XX module, except - * for multi-dio functions which use the GPIO driverlib module. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/gpio.h) - -#include -#include -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -static PIN_Config pin_config[] = { PIN_TERMINATE }; -static PIN_State pin_state; -static PIN_Handle pin_handle; -/*---------------------------------------------------------------------------*/ -static void -from_hal_cfg(gpio_hal_pin_cfg_t cfg, PIN_Config *pin_cfg, PIN_Config *pin_mask) -{ - /* Pulling config */ - *pin_mask |= PIN_BM_PULLING; - - switch(cfg & GPIO_HAL_PIN_CFG_PULL_MASK) { - default: /* Default to no pullup/pulldown */ - case GPIO_HAL_PIN_CFG_PULL_NONE: *pin_cfg |= PIN_NOPULL; break; - case GPIO_HAL_PIN_CFG_PULL_UP: *pin_cfg |= PIN_PULLUP; break; - case GPIO_HAL_PIN_CFG_PULL_DOWN: *pin_cfg |= PIN_PULLDOWN; break; - } - - /* Hysteresis config */ - *pin_mask |= PIN_BM_HYSTERESIS; - - if(cfg & GPIO_HAL_PIN_CFG_HYSTERESIS) { - *pin_cfg |= PIN_HYSTERESIS; - } - - /* Interrupt config */ - *pin_mask |= PIN_BM_IRQ; - - if((cfg & GPIO_HAL_PIN_CFG_INT_MASK) == GPIO_HAL_PIN_CFG_INT_ENABLE) { - /* Interrupt edge config */ - switch(cfg & GPIO_HAL_PIN_CFG_EDGE_BOTH) { - case GPIO_HAL_PIN_CFG_EDGE_NONE: *pin_cfg |= PIN_IRQ_DIS; break; - case GPIO_HAL_PIN_CFG_EDGE_FALLING: *pin_cfg |= PIN_IRQ_NEGEDGE; break; - case GPIO_HAL_PIN_CFG_EDGE_RISING: *pin_cfg |= PIN_IRQ_POSEDGE; break; - case GPIO_HAL_PIN_CFG_EDGE_BOTH: *pin_cfg |= PIN_IRQ_BOTHEDGES; break; - } - } else { - *pin_cfg |= PIN_IRQ_DIS; - } -} -/*---------------------------------------------------------------------------*/ -static void -to_hal_cfg(PIN_Config pin_cfg, gpio_hal_pin_cfg_t *cfg) -{ - /* Input config */ - if(pin_cfg & PIN_BM_INPUT_MODE) { - /* Hysteresis config */ - if((pin_cfg & PIN_BM_HYSTERESIS) == PIN_BM_HYSTERESIS) { - *cfg |= GPIO_HAL_PIN_CFG_HYSTERESIS; - } - - /* Pulling config */ - switch(pin_cfg & PIN_BM_PULLING) { - case PIN_NOPULL: *cfg |= GPIO_HAL_PIN_CFG_PULL_NONE; break; - case PIN_PULLUP: *cfg |= GPIO_HAL_PIN_CFG_PULL_UP; break; - case PIN_PULLDOWN: *cfg |= GPIO_HAL_PIN_CFG_PULL_DOWN; break; - } - } - - /* Interrupt config */ - if(pin_cfg & PIN_BM_IRQ) { - /* Interrupt edge config */ - switch(pin_cfg & PIN_BM_IRQ) { - case PIN_IRQ_DIS: *cfg |= GPIO_HAL_PIN_CFG_EDGE_NONE; - *cfg |= GPIO_HAL_PIN_CFG_INT_DISABLE; - break; - case PIN_IRQ_NEGEDGE: *cfg |= GPIO_HAL_PIN_CFG_EDGE_FALLING; - *cfg |= GPIO_HAL_PIN_CFG_INT_ENABLE; - break; - case PIN_IRQ_POSEDGE: *cfg |= GPIO_HAL_PIN_CFG_EDGE_RISING; - *cfg |= GPIO_HAL_PIN_CFG_INT_ENABLE; - break; - case PIN_IRQ_BOTHEDGES: *cfg |= GPIO_HAL_PIN_CFG_EDGE_BOTH; - *cfg |= GPIO_HAL_PIN_CFG_INT_ENABLE; - break; - } - } -} -/*---------------------------------------------------------------------------*/ -static void -gpio_int_cb(PIN_Handle handle, PIN_Id pin_id) -{ - /* Unused args */ - (void)handle; - - /* Notify the GPIO HAL driver */ - gpio_hal_event_handler(gpio_hal_pin_to_mask(pin_id)); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_init(void) -{ - /* No error checking */ - pin_handle = PIN_open(&pin_state, pin_config); - PIN_registerIntCb(pin_handle, gpio_int_cb); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_interrupt_enable(gpio_hal_pin_t pin) -{ - PIN_Config pin_cfg; - PIN_Config irq_cfg; - - pin_cfg = PIN_getConfig(pin); - PIN_add(pin_handle, pin_cfg); - - irq_cfg = pin_cfg & PIN_BM_IRQ; - PIN_setInterrupt(pin_handle, pin | irq_cfg); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_interrupt_disable(gpio_hal_pin_t pin) -{ - PIN_add(pin_handle, PIN_getConfig(pin)); - - PIN_setInterrupt(pin_handle, pin | PIN_IRQ_DIS); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_pin_cfg_set(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg) -{ - PIN_add(pin_handle, PIN_getConfig(pin)); - - /* Clear settings that we are about to change, keep everything else. */ - PIN_Config pin_cfg = 0; - PIN_Config pin_mask = 0; - - from_hal_cfg(cfg, &pin_cfg, &pin_mask); - - PIN_setConfig(pin_handle, pin_mask, pin | pin_cfg); -} -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_cfg_t -gpio_hal_arch_pin_cfg_get(gpio_hal_pin_t pin) -{ - PIN_Config pin_cfg = PIN_getConfig(pin); - gpio_hal_pin_cfg_t cfg = 0; - - to_hal_cfg(pin_cfg, &cfg); - - return cfg; -} -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_mask_t -gpio_hal_arch_read_pins(gpio_hal_pin_mask_t pins) -{ - /* For pins configured as output we need to read DOUT31_0 */ - gpio_hal_pin_mask_t oe_pins = GPIO_getOutputEnableMultiDio(pins); - - pins &= ~oe_pins; - - return (HWREG(GPIO_BASE + GPIO_O_DOUT31_0) & oe_pins) | - GPIO_readMultiDio(pins); -} -/*---------------------------------------------------------------------------*/ -uint8_t -gpio_hal_arch_read_pin(gpio_hal_pin_t pin) -{ - return (GPIO_getOutputEnableDio(pin)) - ? PINCC26XX_getOutputValue(pin) - : PINCC26XX_getInputValue(pin); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/gpio-hal-arch.h b/arch/cpu/simplelink-cc13xx-cc26xx/dev/gpio-hal-arch.h deleted file mode 100644 index 3ca169a82..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/gpio-hal-arch.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-gpio-hal CC13xx/CC26xx GPIO HAL implementation - * - * @{ - * - * \file - * Header file for the CC13xx/CC26xx GPIO HAL functions. - * \author - * Edvard Pettersen - * \note - * Do not include this header directly. - */ -/*---------------------------------------------------------------------------*/ -#ifndef GPIO_HAL_ARCH_H_ -#define GPIO_HAL_ARCH_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/gpio.h) - -#include -/*---------------------------------------------------------------------------*/ -#define gpio_hal_arch_pin_set_input(p) PINCC26XX_setOutputEnable(p, false) -#define gpio_hal_arch_pin_set_output(p) PINCC26XX_setOutputEnable(p, true) - -#define gpio_hal_arch_set_pin(p) PINCC26XX_setOutputValue(p, 1) -#define gpio_hal_arch_clear_pin(p) PINCC26XX_setOutputValue(p, 0) -#define gpio_hal_arch_toggle_pin(p) PINCC26XX_setOutputValue(p, \ - PINCC26XX_getOutputValue(p) \ - ? 0 : 1) -#define gpio_hal_arch_write_pin(p, v) PINCC26XX_setOutputValue(p, v) - -#define gpio_hal_arch_set_pins(p) GPIO_setMultiDio(p) -#define gpio_hal_arch_clear_pins(p) GPIO_clearMultiDio(p) -#define gpio_hal_arch_toggle_pins(p) GPIO_toggleMultiDio(p) -#define gpio_hal_arch_write_pins(p, v) GPIO_writeMultiDio(p, v) -/*---------------------------------------------------------------------------*/ -#endif /* GPIO_HAL_ARCH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/int-master-arch.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/int-master-arch.c deleted file mode 100644 index 2c72992e6..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/int-master-arch.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-int-master CC13xx/CC26xx master interrupt manipulation - * - * Master interrupt manipulation routines for CC13xx/CC26xx. - * - * @{ - * - * \file - * Master interrupt manipulation implementation for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/int-master.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -void -int_master_enable(void) -{ - HwiP_enable(); -} -/*---------------------------------------------------------------------------*/ -int_master_status_t -int_master_read_and_disable(void) -{ - return (int_master_status_t)HwiP_disable(); -} -/*---------------------------------------------------------------------------*/ -void -int_master_status_set(int_master_status_t status) -{ - HwiP_restore((uintptr_t)status); -} -/*---------------------------------------------------------------------------*/ -bool -int_master_is_enabled(void) -{ - return CPUprimask() ? false : true; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/random.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/random.c deleted file mode 100644 index 4286bfe89..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/random.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ - /** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-prng Pseudo Random Number Generator (PRNG) for CC13xx/CC26xx. - * @{ - * - * Implementation based on Bob Jenkins' small noncryptographic PRNG. - * - http://burtleburtle.net/bob/rand/smallprng.html - * - * This file overrides os/lib/random.c. Note that the file name must - * match the original file for the override to work. - * - * \file - * Implementation of Pseudo Random Number Generator for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -typedef struct { - uint32_t a; - uint32_t b; - uint32_t c; - uint32_t d; -} ranctx_t; - -static ranctx_t ranctx; -/*---------------------------------------------------------------------------*/ -#define rot32(x, k) (((x) << (k)) | ((x) >> (32 - (k)))) -/*---------------------------------------------------------------------------*/ -/** - * \brief Generates a new random number using the PRNG. - * \return The random number. - */ -unsigned short -random_rand(void) -{ - uint32_t e; - - e = ranctx.a - rot32(ranctx.b, 27); - ranctx.a = ranctx.b ^ rot32(ranctx.c, 17); - ranctx.b = ranctx.c + ranctx.d; - ranctx.c = ranctx.d + e; - ranctx.d = e + ranctx.a; - - return (unsigned short)ranctx.d; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the PRNG. - * \param seed Seed for the PRNG. - */ -void -random_init(unsigned short seed) -{ - uint32_t i; - - ranctx.a = 0xf1ea5eed; - ranctx.b = ranctx.c = ranctx.d = (uint32_t)seed; - for(i = 0; i < 20; ++i) { - (void)random_rand(); - } -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/rtimer-arch.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/rtimer-arch.c deleted file mode 100644 index 7fd768008..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/rtimer-arch.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rtimer - * @{ - * - * \file - * Implementation of the rtimer driver for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/aon_event.h) -#include DeviceFamily_constructPath(driverlib/aon_rtc.h) -#include DeviceFamily_constructPath(driverlib/interrupt.h) - -#include -#include -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -#define HWIP_RTC_CH AON_RTC_CH0 -#define RTIMER_RTC_CH AON_RTC_CH1 -/*---------------------------------------------------------------------------*/ -typedef void (*isr_fxn_t)(void); -typedef void (*hwi_dispatch_fxn_t)(void); - -static hwi_dispatch_fxn_t hwi_dispatch_fxn; -/*---------------------------------------------------------------------------*/ -/** - * \brief Stub function used when creating the dummy clock object. - */ -static void -rtimer_clock_stub(uintptr_t unused) -{ - (void)unused; - /* do nothing */ -} -/*---------------------------------------------------------------------------*/ -/** - * \brief The Man-in-the-Middle ISR hook for the HWI dispatch ISR. This - * will be the ISR dispatched when INT_AON_RTC_COMB is triggered, - * and will either dispatch the interrupt to the rtimer driver or - * the HWI driver, depening on which event triggered the interrupt. - */ -static void -rtimer_isr_hook(void) -{ - if(AONRTCEventGet(RTIMER_RTC_CH)) { - AONRTCEventClear(RTIMER_RTC_CH); - AONRTCChannelDisable(RTIMER_RTC_CH); - - rtimer_run_next(); - } - /* - * HWI Dispatch clears the interrupt. If HWI wasn't triggered, clear - * the interrupt manually. - */ - if(AONRTCEventGet(HWIP_RTC_CH)) { - hwi_dispatch_fxn(); - } else { - IntPendClear(INT_AON_RTC_COMB); - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief TODO - */ -void -rtimer_arch_init(void) -{ - uintptr_t key; - ClockP_Struct clk_object; - ClockP_Params clk_params; - volatile isr_fxn_t *ramvec_table; - - key = HwiP_disable(); - - /* - * Create a dummy clock to guarantee the RAM vector table is initialized. - * - * Creating a dummy clock will trigger initialization of TimerP, which - * subsequently initializes the driverlib/interrupt.h module. It is the - * interrupt module that initializes the RAM vector table. - * - * It is safe to destruct the Clock object immediately afterwards. - */ - ClockP_Params_init(&clk_params); - ClockP_construct(&clk_object, rtimer_clock_stub, 0, &clk_params); - ClockP_destruct(&clk_object); - - /* Try to access the RAM vector table. */ - ramvec_table = (isr_fxn_t *)HWREG(NVIC_VTABLE); - if(!ramvec_table) { - /* - * Unable to find the RAM vector table is a serious fault. - * Spin-lock forever. - */ - for(;;) { /* hang */ } - } - - /* - * The HWI Dispatch ISR is located at interrupt number INT_AON_RTC_COMB - * in the RAM vector table. Fetch and store it. - */ - hwi_dispatch_fxn = (hwi_dispatch_fxn_t)ramvec_table[INT_AON_RTC_COMB]; - if(!hwi_dispatch_fxn) { - /* - * Unable to find the HWI dispatch ISR in the RAM vector table is - * a serious fault. Spin-lock forever. - */ - for(;;) { /* hang */ } - } - - /* - * Override the INT_AON_RTC_COMB interrupt number with our own ISR hook, - * which will act as a man-in-the-middle ISR for the HWI dispatch. - */ - IntRegister(INT_AON_RTC_COMB, rtimer_isr_hook); - - AONEventMcuWakeUpSet(AON_EVENT_MCU_WU1, AON_EVENT_RTC_CH1); - AONRTCCombinedEventConfig(HWIP_RTC_CH | RTIMER_RTC_CH); - - HwiP_restore(key); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Schedules an rtimer task to be triggered at time \p t. - * \param t The time when the task will need executed. - * - * \p t is an absolute time, in other words the task will be - * executed AT time \p t, not IN \p t rtimer ticks. - * - * This function schedules a one-shot event with the AON RTC. - * - * This functions converts \p t to a value suitable for the AON RTC. - */ -void -rtimer_arch_schedule(rtimer_clock_t t) -{ - /* Convert the rtimer tick value to a value suitable for the AON RTC */ - AONRTCCompareValueSet(RTIMER_RTC_CH, (uint32_t)t); - AONRTCChannelEnable(RTIMER_RTC_CH); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the current real-time clock time. - * \return The current rtimer time in ticks. - * - * The value is read from the AON RTC counter and converted to a - * number of rtimer ticks. - */ -rtimer_clock_t -rtimer_arch_now() -{ - return (rtimer_clock_t)AONRTCCurrentCompareValueGet(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/rtimer-arch.h b/arch/cpu/simplelink-cc13xx-cc26xx/dev/rtimer-arch.h deleted file mode 100644 index c42fcbd41..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/rtimer-arch.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-rtimer The CC13xx/CC26xx rtimer - * - * Implementation of the rtimer module for CC13xx/CC26xx. This header - * is included by os/sys/rtimer.h. - * - * RTIMER_ARCH_SECOND is defined in cc13xx-cc26xx-def.h. - * @{ - * - * \file - * Header file of the rtimer driver for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef RTIMER_ARCH_H_ -#define RTIMER_ARCH_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -rtimer_clock_t rtimer_arch_now(void); -/*---------------------------------------------------------------------------*/ -/* - * HW oscillator frequency is 32 kHz, not 64 kHz. And, RTIMER_NOW() never - * returns an odd value; US_TO_RTIMERTICKS always rounds to the nearest - * even number. - */ -#define US_TO_RTIMERTICKS(us) ( \ - (((us) >= 0) \ - ? (((int32_t)(us) * (RTIMER_ARCH_SECOND / 2) + 500000) / 1000000L) \ - : (((int32_t)(us) * (RTIMER_ARCH_SECOND / 2) - 500000) / 1000000L) \ - ) * 2) - -#define RTIMERTICKS_TO_US(rt) ( \ - ((rt) >= 0) \ - ? (((int32_t)(rt) * 1000000L + (RTIMER_ARCH_SECOND / 2)) / RTIMER_ARCH_SECOND) \ - : (((int32_t)(rt) * 1000000L - (RTIMER_ARCH_SECOND / 2)) / RTIMER_ARCH_SECOND) \ - ) - -/* - * A 64-bit version because the 32-bit one cannot handle T >= 4295 ticks. - * Intended only for positive values of T. - */ -#define RTIMERTICKS_TO_US_64(rt) ( \ - (uint32_t)( \ - ((uint64_t)(rt) * 1000000 + (RTIMER_ARCH_SECOND / 2)) / RTIMER_ARCH_SECOND \ - )) -/*---------------------------------------------------------------------------*/ -#endif /* RTIMER_ARCH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/slip-arch.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/slip-arch.c deleted file mode 100644 index d15148428..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/slip-arch.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-slip-arch SLIP for CC13xx/CC26xx. - * @{ - * - * \file - * Implementation of SLIP driver for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/slip.h" -/*---------------------------------------------------------------------------*/ -#include "uart0-arch.h" -/*---------------------------------------------------------------------------*/ -/** - * \brief Write a single byte over SLIP. - * \param c The byte to write. - */ -void -slip_arch_writeb(unsigned char c) -{ - uart0_write(&c, 1); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the SLIP driver. - */ -void -slip_arch_init(void) -{ - /* - * Set an input handler. In doing so, the driver will make sure that UART - * RX stays operational during deep sleep. - */ - uart0_init(); - uart0_set_callback(slip_input_byte); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/spi-arch.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/spi-arch.c deleted file mode 100644 index f4c6114e8..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/spi-arch.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-spi CC13xx/CC26xx SPI HAL - * - * @{ - * \file - * Implementation of the SPI HAL driver for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/cc.h" -#include "dev/spi.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#include -#include -#include -/*---------------------------------------------------------------------------*/ -typedef struct { - SPI_Handle handle; - const spi_device_t *owner; -} spi_arch_t; -/*---------------------------------------------------------------------------*/ -#if (SPI_CONTROLLER_COUNT > 0) -static spi_arch_t spi_arches[SPI_CONTROLLER_COUNT]; -#else -static spi_arch_t *spi_arches = NULL; -#endif -/*---------------------------------------------------------------------------*/ -static inline spi_arch_t * -get_handle(uint8_t spi_controller) -{ - if(spi_controller < SPI_CONTROLLER_COUNT) { - return &spi_arches[spi_controller]; - } else { - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -static SPI_FrameFormat -convert_frame_format(uint8_t pol, uint8_t pha) -{ - pol = (pol) ? 1 : 0; - pha = (pha) ? 1 : 0; - /* - * Convert pol/pha to a single byte on the following format: - * xxxA xxxB - * where A is the polarity bit and B is the phase bit. - * Note that any other value deviating from this format will - * default to the SPI_POL1_PHA1 format. - */ - uint8_t pol_pha = (pol << 4) | (pha << 0); - switch(pol_pha) { - case 0x00: return SPI_POL0_PHA0; - case 0x01: return SPI_POL0_PHA1; - case 0x10: return SPI_POL1_PHA0; - default: /* fallthrough */ - case 0x11: return SPI_POL1_PHA1; - } -} -/*---------------------------------------------------------------------------*/ -bool -spi_arch_has_lock(const spi_device_t *dev) -{ - /* - * The SPI device is the owner if the SPI controller returns a valid - * SPI arch object and the SPI device is owner of that object. - */ - spi_arch_t *spi_arch = get_handle(dev->spi_controller); - return (spi_arch != NULL) && (spi_arch->owner == dev); -} -/*---------------------------------------------------------------------------*/ -bool -spi_arch_is_bus_locked(const spi_device_t *dev) -{ - /* - * The SPI controller is locked by any device if the SPI controller returns - * a valid SPI arch object and the SPI handle of that object is valid. - */ - spi_arch_t *spi_arch = get_handle(dev->spi_controller); - return (spi_arch != NULL) && (spi_arch->handle != NULL); -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_arch_lock_and_open(const spi_device_t *dev) -{ - uint_least8_t spi_index; - spi_arch_t *spi_arch; - SPI_Params spi_params; - - const uintptr_t hwi_key = HwiP_disable(); - - spi_index = dev->spi_controller; - spi_arch = get_handle(spi_index); - - /* Ensure the provided SPI index is valid. */ - if(spi_arch == NULL) { - HwiP_restore(hwi_key); - return SPI_DEV_STATUS_EINVAL; - } - - /* Ensure the corresponding SPI interface is not already locked. */ - if(spi_arch_is_bus_locked(dev)) { - HwiP_restore(hwi_key); - return SPI_DEV_STATUS_BUS_LOCKED; - } - - SPI_Params_init(&spi_params); - - spi_params.transferMode = SPI_MODE_BLOCKING; - spi_params.mode = SPI_MASTER; - spi_params.bitRate = dev->spi_bit_rate; - spi_params.dataSize = 8; - spi_params.frameFormat = convert_frame_format(dev->spi_pol, dev->spi_pha); - - /* - * Try to open the SPI driver. Accessing the SPI driver also ensures - * atomic access to the SPI interface. - */ - spi_arch->handle = SPI_open(spi_index, &spi_params); - - if(spi_arch->handle == NULL) { - HwiP_restore(hwi_key); - return SPI_DEV_STATUS_BUS_LOCKED; - } - - spi_arch->owner = dev; - - HwiP_restore(hwi_key); - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_arch_close_and_unlock(const spi_device_t *dev) -{ - spi_arch_t *spi_arch; - - const uintptr_t hwi_key = HwiP_disable(); - - /* Ensure the provided SPI index is valid. */ - spi_arch = get_handle(dev->spi_controller); - if(spi_arch == NULL) { - HwiP_restore(hwi_key); - return SPI_DEV_STATUS_EINVAL; - } - - /* Ensure the corresponding SPI device owns the SPI controller. */ - if(!spi_arch_has_lock(dev)) { - HwiP_restore(hwi_key); - return SPI_DEV_STATUS_BUS_NOT_OWNED; - } - - SPI_close(spi_arch->handle); - - spi_arch->handle = NULL; - spi_arch->owner = NULL; - - HwiP_restore(hwi_key); - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_arch_transfer(const spi_device_t *dev, - const uint8_t *write_buf, int wlen, - uint8_t *inbuf, int rlen, int ignore_len) -{ - spi_arch_t *spi_arch; - size_t totlen; - SPI_Transaction spi_transaction; - bool transfer_ok; - - /* Ensure the provided SPI index is valid. */ - spi_arch = get_handle(dev->spi_controller); - if(spi_arch == NULL) { - return SPI_DEV_STATUS_EINVAL; - } - - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_NOT_OWNED; - } - - totlen = MAX((size_t)(rlen + ignore_len), (size_t)wlen); - - if(totlen == 0) { - /* Nothing to do */ - return SPI_DEV_STATUS_OK; - } - - spi_transaction.count = totlen; - spi_transaction.txBuf = (void *)write_buf; - spi_transaction.rxBuf = (void *)inbuf; - - transfer_ok = SPI_transfer(spi_arch->handle, &spi_transaction); - - if(!transfer_ok) { - return SPI_DEV_STATUS_TRANSFER_ERR; - } - - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c deleted file mode 100644 index 7b34cd29b..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \file - * Startup file for GCC for CC13xx/CC26xx. - */ -/*---------------------------------------------------------------------------*/ -/* Check if compiler is GNU Compiler. */ -#if !(defined(__GNUC__)) -#error "startup_cc13xx_cc26xx_gcc.c: Unsupported compiler!" -#endif -/*---------------------------------------------------------------------------*/ -#include - -#include -#include DeviceFamily_constructPath(inc/hw_types.h) -#include DeviceFamily_constructPath(driverlib/interrupt.h) -#include DeviceFamily_constructPath(driverlib/setup.h) -/*---------------------------------------------------------------------------*/ -/* Forward declaration of the default fault handlers. */ -void resetISR(void); -static void nmiISR(void); -static void faultISR(void); -static void defaultHandler(void); -static void busFaultHandler(void); -/*---------------------------------------------------------------------------*/ -/* - * External declaration for the reset handler that is to be called when the - * processor is started. - */ -extern void _c_int00(void); - -/* The entry point for the application. */ -extern int main(void); -/*---------------------------------------------------------------------------*/ -/* Linker variable that marks the top of stack. */ -extern unsigned long _stack_end; - -/* - * The vector table. Note that the proper constructs must be placed on this to - * ensure that it ends up at physical address 0x0000.0000. - */ -__attribute__((section(".resetVecs"))) __attribute__((used)) -static void(*const resetVectors[16])(void) = -{ - (void(*)(void))((uint32_t)&_stack_end), - /* The initial stack pointer */ - resetISR, /* The reset handler */ - nmiISR, /* The NMI handler */ - faultISR, /* The hard fault handler */ - defaultHandler, /* The MPU fault handler */ - busFaultHandler, /* The bus fault handler */ - defaultHandler, /* The usage fault handler */ - 0, /* Reserved */ - 0, /* Reserved */ - 0, /* Reserved */ - 0, /* Reserved */ - defaultHandler, /* SVCall handler */ - defaultHandler, /* Debug monitor handler */ - 0, /* Reserved */ - defaultHandler, /* The PendSV handler */ - defaultHandler /* The SysTick handler */ -}; -/*---------------------------------------------------------------------------*/ -/* - * The following are arrays of pointers to constructor functions that need to - * be called during startup to initialize global objects. - */ -extern void (*__init_array_start[])(void); -extern void (*__init_array_end[])(void); - -/* The following global variable is required for C++ support. */ -void *__dso_handle = (void *)&__dso_handle; -/*---------------------------------------------------------------------------*/ -/* - * The following are constructs created by the linker, indicating where the - * the "data" and "bss" segments reside in memory. The initializers for the - * for the "data" segment resides immediately following the "text" segment. - */ -extern uint32_t __bss_start__; -extern uint32_t __bss_end__; -extern uint32_t __data_load__; -extern uint32_t __data_start__; -extern uint32_t __data_end__; -/*---------------------------------------------------------------------------*/ -/* - * \brief Entry point of the startup code. - * - * Initialize the .data and .bss sections, and call main. - */ -void -localProgramStart(void) -{ - uint32_t *bs; - uint32_t *be; - uint32_t *dl; - uint32_t *ds; - uint32_t *de; - uint32_t count; - uint32_t i; - - IntMasterDisable(); - - /* Final trim of device */ - SetupTrimDevice(); - - /* initiailize .bss to zero */ - bs = &__bss_start__; - be = &__bss_end__; - while(bs < be) { - *bs = 0; - bs++; - } - - /* relocate the .data section */ - dl = &__data_load__; - ds = &__data_start__; - de = &__data_end__; - if(dl != ds) { - while(ds < de) { - *ds = *dl; - dl++; - ds++; - } - } - - /* Run any constructors */ - count = (uint32_t)(__init_array_end - __init_array_start); - for(i = 0; i < count; i++) { - __init_array_start[i](); - } - - /* Call the application's entry point. */ - main(); - - /* If we ever return signal Error */ - faultISR(); -} -/*---------------------------------------------------------------------------*/ -/* - * \brief Reset ISR. - * - * This is the code that gets called when the processor first starts execution - * following a reset event. Only the absolutely necessary set is performed, - * after which the application supplied entry() routine is called. Any fancy - * actions (such as making decisions based on the reset cause register, and - * resetting the bits in that register) are left solely in the hands of the - * application. - */ -void __attribute__((naked)) -resetISR(void) -{ - __asm__ __volatile__ - ( - "movw r0, #:lower16:resetVectors \n" - "movt r0, #:upper16:resetVectors \n" - "ldr r0, [r0] \n" - "mov sp, r0 \n" - "bx %0 \n" - : /* output */ - : /* input */ - "r"(localProgramStart) - ); -} -/*---------------------------------------------------------------------------*/ -/* - * \brief Non-Maskable Interrupt (NMI) ISR. - * - * This is the code that gets called when the processor receives a NMI. This - * simply enters an infinite loop, preserving the system state for examination - * by a debugger. - */ -static void -nmiISR(void) -{ - /* Enter an infinite loop. */ - for(;;) { /* hang */ } -} -/*---------------------------------------------------------------------------*/ -/* - * \brief Debug stack pointer. - * \param sp Stack pointer. - * - * Provide a view into the CPU state from the provided stack pointer. - */ -static void -debugHardfault(uint32_t *sp) -{ - volatile uint32_t r0; /**< R0 register */ - volatile uint32_t r1; /**< R1 register */ - volatile uint32_t r2; /**< R2 register */ - volatile uint32_t r3; /**< R3 register */ - volatile uint32_t r12; /**< R12 register */ - volatile uint32_t lr; /**< LR register */ - volatile uint32_t pc; /**< PC register */ - volatile uint32_t psr; /**< PSR register */ - - (void)(r0 = sp[0]); - (void)(r1 = sp[1]); - (void)(r2 = sp[2]); - (void)(r3 = sp[3]); - (void)(r12 = sp[4]); - (void)(lr = sp[5]); - (void)(pc = sp[6]); - (void)(psr = sp[7]); - - /* Enter an infinite loop. */ - for(;;) { /* hang */ } -} -/*---------------------------------------------------------------------------*/ -/* - * \brief CPU Fault ISR. - * - * This is the code that gets called when the processor receives a fault - * interrupt. Setup a call to debugStackPointer with the current stack pointer. - * The stack pointer in this case would be the CPU state which caused the CPU - * fault. - */ -static void -faultISR(void) -{ - __asm__ __volatile__ - ( - "tst lr, #4 \n" - "ite eq \n" - "mrseq r0, msp \n" - "mrsne r0, psp \n" - "bx %0 \n" - : /* output */ - : /* input */ - "r"(debugHardfault) - ); -} -/*---------------------------------------------------------------------------*/ -/* Dummy variable */ -volatile int x__; - -/* - * \brief Bus Fault Handler. - * - * This is the code that gets called when the processor receives an unexpected - * interrupt. This simply enters an infinite loop, preserving the system state - * for examination by a debugger. - */ -static void -busFaultHandler(void) -{ - x__ = 0; - - /* Enter an infinite loop. */ - for(;;) { /* hang */ } -} -/*---------------------------------------------------------------------------*/ -/* - * \brief Default Handler. - * - * This is the code that gets called when the processor receives an unexpected - * interrupt. This simply enters an infinite loop, preserving the system state - * for examination by a debugger. - */ -static void -defaultHandler(void) -{ - /* Enter an infinite loop. */ - for(;;) { /* hang */ } -} -/*---------------------------------------------------------------------------*/ -/* - * \brief Finalize object function. - * - * This function is called by __libc_fini_array which gets called when exit() - * is called. In order to support exit(), an empty _fini() stub function is - * required. - */ -void -_fini(void) -{ - /* Function body left empty intentionally */ -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c deleted file mode 100644 index 3ea8500c2..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \file - * Startup file for IAR for CC13xx/CC26xx. - */ -/*---------------------------------------------------------------------------*/ -/* Check if compiler is IAR. */ -#if !(defined(__IAR_SYSTEMS_ICC__)) -#error "startup_cc13xx_cc26xx_iar.c: Unsupported compiler!" -#endif -/*---------------------------------------------------------------------------*/ -/* We need intrinsic functions for IAR (if used in source code). */ -#include - -#include -#include DeviceFamily_constructPath(inc/hw_types.h) -#include DeviceFamily_constructPath(driverlib/setup.h) -#include DeviceFamily_constructPath(driverlib/interrupt.h) -/*---------------------------------------------------------------------------*/ -/* Forward declaration of the reset ISR and the default fault handlers. */ -static void nmiISR(void); -static void faultISR(void); -static void intDefaultHandler(void); -extern int main(void); - -extern void MPUFaultIntHandler(void); -extern void BusFaultIntHandler(void); -extern void UsageFaultIntHandler(void); -extern void SVCallIntHandler(void); -extern void DebugMonIntHandler(void); -extern void PendSVIntHandler(void); -extern void SysTickIntHandler(void); -extern void GPIOIntHandler(void); -extern void I2CIntHandler(void); -extern void RFCCPE1IntHandler(void); -extern void AONRTCIntHandler(void); -extern void UART0IntHandler(void); -extern void AUXSWEvent0IntHandler(void); -extern void SSI0IntHandler(void); -extern void SSI1IntHandler(void); -extern void RFCCPE0IntHandler(void); -extern void RFCHardwareIntHandler(void); -extern void RFCCmdAckIntHandler(void); -extern void I2SIntHandler(void); -extern void AUXSWEvent1IntHandler(void); -extern void WatchdogIntHandler(void); -extern void Timer0AIntHandler(void); -extern void Timer0BIntHandler(void); -extern void Timer1AIntHandler(void); -extern void Timer1BIntHandler(void); -extern void Timer2AIntHandler(void); -extern void Timer2BIntHandler(void); -extern void Timer3AIntHandler(void); -extern void Timer3BIntHandler(void); -extern void CryptoIntHandler(void); -extern void uDMAIntHandler(void); -extern void uDMAErrIntHandler(void); -extern void FlashIntHandler(void); -extern void SWEvent0IntHandler(void); -extern void AUXCombEventIntHandler(void); -extern void AONProgIntHandler(void); -extern void DynProgIntHandler(void); -extern void AUXCompAIntHandler(void); -extern void AUXADCIntHandler(void); -extern void TRNGIntHandler(void); - -/* Default interrupt handlers */ -#pragma weak MPUFaultIntHandler = intDefaultHandler -#pragma weak BusFaultIntHandler = intDefaultHandler -#pragma weak UsageFaultIntHandler = intDefaultHandler -#pragma weak SVCallIntHandler = intDefaultHandler -#pragma weak DebugMonIntHandler = intDefaultHandler -#pragma weak PendSVIntHandler = intDefaultHandler -#pragma weak SysTickIntHandler = intDefaultHandler -#pragma weak GPIOIntHandler = intDefaultHandler -#pragma weak I2CIntHandler = intDefaultHandler -#pragma weak RFCCPE1IntHandler = intDefaultHandler -#pragma weak AONRTCIntHandler = intDefaultHandler -#pragma weak UART0IntHandler = intDefaultHandler -#pragma weak AUXSWEvent0IntHandler = intDefaultHandler -#pragma weak SSI0IntHandler = intDefaultHandler -#pragma weak SSI1IntHandler = intDefaultHandler -#pragma weak RFCCPE0IntHandler = intDefaultHandler -#pragma weak RFCHardwareIntHandler = intDefaultHandler -#pragma weak RFCCmdAckIntHandler = intDefaultHandler -#pragma weak I2SIntHandler = intDefaultHandler -#pragma weak AUXSWEvent1IntHandler = intDefaultHandler -#pragma weak WatchdogIntHandler = intDefaultHandler -#pragma weak Timer0AIntHandler = intDefaultHandler -#pragma weak Timer0BIntHandler = intDefaultHandler -#pragma weak Timer1AIntHandler = intDefaultHandler -#pragma weak Timer1BIntHandler = intDefaultHandler -#pragma weak Timer2AIntHandler = intDefaultHandler -#pragma weak Timer2BIntHandler = intDefaultHandler -#pragma weak Timer3AIntHandler = intDefaultHandler -#pragma weak Timer3BIntHandler = intDefaultHandler -#pragma weak CryptoIntHandler = intDefaultHandler -#pragma weak uDMAIntHandler = intDefaultHandler -#pragma weak uDMAErrIntHandler = intDefaultHandler -#pragma weak FlashIntHandler = intDefaultHandler -#pragma weak SWEvent0IntHandler = intDefaultHandler -#pragma weak AUXCombEventIntHandler = intDefaultHandler -#pragma weak AONProgIntHandler = intDefaultHandler -#pragma weak DynProgIntHandler = intDefaultHandler -#pragma weak AUXCompAIntHandler = intDefaultHandler -#pragma weak AUXADCIntHandler = intDefaultHandler -#pragma weak TRNGIntHandler = intDefaultHandler -/*---------------------------------------------------------------------------*/ -/* The entry point for the application startup code. */ -extern void __iar_program_start(void); - -/* Get stack start (highest address) symbol from linker file. */ -extern const void *STACK_TOP; -/*---------------------------------------------------------------------------*/ -/* - * It is required to place something in the CSTACK segment to get the stack - * check feature in IAR to work as expected - */ -__root static void *dummy_stack @ ".stack"; - -/* - * The vector table. Note that the proper constructs must be placed on this to - * ensure that it ends up at physical address 0x0000.0000 or at the start of - * the program if located at a start address other than 0. - */ -__root void(*const __vector_table[])(void) @ ".intvec" = -{ - (void (*)(void)) & STACK_TOP, /* 0 The initial stack pointer */ - __iar_program_start, /* 1 The reset handler */ - nmiISR, /* 2 The NMI handler */ - faultISR, /* 3 The hard fault handler */ - MPUFaultIntHandler, /* 4 The MPU fault handler */ - BusFaultIntHandler, /* 5 The bus fault handler */ - UsageFaultIntHandler, /* 6 The usage fault handler */ - 0, /* 7 Reserved */ - 0, /* 8 Reserved */ - 0, /* 9 Reserved */ - 0, /* 10 Reserved */ - SVCallIntHandler, /* 11 SVCall handler */ - DebugMonIntHandler, /* 12 Debug monitor handler */ - 0, /* 13 Reserved */ - PendSVIntHandler, /* 14 The PendSV handler */ - SysTickIntHandler, /* 15 The SysTick handler */ - /* --- External interrupts --- */ - GPIOIntHandler, /* 16 AON edge detect */ - I2CIntHandler, /* 17 I2C */ - RFCCPE1IntHandler, /* 18 RF Core Command & Packet Engine 1 */ - intDefaultHandler, /* 19 Reserved */ - AONRTCIntHandler, /* 20 AON RTC */ - UART0IntHandler, /* 21 UART0 Rx and Tx */ - AUXSWEvent0IntHandler, /* 22 AUX software event 0 */ - SSI0IntHandler, /* 23 SSI0 Rx and Tx */ - SSI1IntHandler, /* 24 SSI1 Rx and Tx */ - RFCCPE0IntHandler, /* 25 RF Core Command & Packet Engine 0 */ - RFCHardwareIntHandler, /* 26 RF Core Hardware */ - RFCCmdAckIntHandler, /* 27 RF Core Command Acknowledge */ - I2SIntHandler, /* 28 I2S */ - AUXSWEvent1IntHandler, /* 29 AUX software event 1 */ - WatchdogIntHandler, /* 30 Watchdog timer */ - Timer0AIntHandler, /* 31 Timer 0 subtimer A */ - Timer0BIntHandler, /* 32 Timer 0 subtimer B */ - Timer1AIntHandler, /* 33 Timer 1 subtimer A */ - Timer1BIntHandler, /* 34 Timer 1 subtimer B */ - Timer2AIntHandler, /* 35 Timer 2 subtimer A */ - Timer2BIntHandler, /* 36 Timer 2 subtimer B */ - Timer3AIntHandler, /* 37 Timer 3 subtimer A */ - Timer3BIntHandler, /* 38 Timer 3 subtimer B */ - CryptoIntHandler, /* 39 Crypto Core Result available */ - uDMAIntHandler, /* 40 uDMA Software */ - uDMAErrIntHandler, /* 41 uDMA Error */ - FlashIntHandler, /* 42 Flash controller */ - SWEvent0IntHandler, /* 43 Software Event 0 */ - AUXCombEventIntHandler, /* 44 AUX combined event */ - AONProgIntHandler, /* 45 AON programmable 0 */ - DynProgIntHandler, /* 46 Dynamic Programmable interrupt */ - /* source (Default: PRCM) */ - AUXCompAIntHandler, /* 47 AUX Comparator A */ - AUXADCIntHandler, /* 48 AUX ADC new sample or ADC DMA */ - /* done, ADC underflow, ADC overflow */ - TRNGIntHandler /* 49 TRNG event */ -} -/*---------------------------------------------------------------------------*/ -/* - * \brief Setup trim device. - * \return Return value determines whether to omit seg_init or not. - * 0 => omit seg_init - * 1 => run seg_init - * - * This function is called by __iar_program_start() early in the boot sequence. - * Copy the first 16 vectors from the read-only/reset table to the runtime - * RAM table. Fill the remaining vectors with a stub. This vector table will - * be updated at runtime. - */ -int -__low_level_init(void) -{ - IntMasterDisable(); - - /* Final trim of device */ - SetupTrimDevice(); - - /* Run seg_init */ - return 1; -} -/*---------------------------------------------------------------------------*/ -/* - * \brief Non-Maskable Interrupt (NMI) ISR. - * - * This is the code that gets called when the processor receives a NMI. This - * simply enters an infinite loop, preserving the system state for examination - * by a debugger. - */ -static void -nmiISR(void) -{ - /* Enter an infinite loop. */ - for(;;) { /* hang */ } -} -/*---------------------------------------------------------------------------*/ -/* - * \brief Debug stack pointer. - * \param sp Stack pointer. - * - * Provide a view into the CPU state from the provided stack pointer. - */ -void -debugStackPointer(uint32_t *sp) -{ - volatile uint32_t r0; /**< R0 register */ - volatile uint32_t r1; /**< R1 register */ - volatile uint32_t r2; /**< R2 register */ - volatile uint32_t r3; /**< R3 register */ - volatile uint32_t r12; /**< R12 register */ - volatile uint32_t lr; /**< LR register */ - volatile uint32_t pc; /**< PC register */ - volatile uint32_t psr; /**< PSR register */ - - /* Cast to void to disable warnings of unused variables */ - (void)(r0 = sp[0]); - (void)(r1 = sp[1]); - (void)(r2 = sp[2]); - (void)(r3 = sp[3]); - (void)(r12 = sp[4]); - (void)(lr = sp[5]); - (void)(pc = sp[6]); - (void)(psr = sp[7]); - - /* Enter an infinite loop. */ - for(;;) { /* hang */ } -} -/*---------------------------------------------------------------------------*/ -/* - * \brief CPU Fault ISR. - * - * This is the code that gets called when the processor receives a fault - * interrupt. Setup a call to debugStackPointer with the current stack pointer. - * The stack pointer in this case would be the CPU state which caused the CPU - * fault. - */ -static void -faultISR(void) -{ - __asm__ __volatile__ - ( - "tst lr, #4 \n" - "ite eq \n" - "mrseq r0, msp \n" - "mrsne r0, psp \n" - "b debugStackPointer \n" - ); -} -/*---------------------------------------------------------------------------*/ -/* - * \brief Interrupt Default Handler. - * - * This is the code that gets called when the processor receives an unexpected - * interrupt. This simply enters an infinite loop, preserving the system state - * for examination by a debugger. - */ -static void -intDefaultHandler(void) -{ - /* Enter an infinite loop. */ - for(;;) { /* hang */ } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/trng-arch.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/trng-arch.c deleted file mode 100644 index d04410bff..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/trng-arch.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-trng - * @{ - * - * \file - * Implementation of True Random Number Generator for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include "trng-arch.h" -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -/* - * Very dirty workaround because the pre-compiled TI drivers library for - * CC13x0/CC26x0 is missing the CryptoKey object file. This can be removed - * when the pre-compiled library includes the missing object file. - */ -#include -#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) -#include -#endif -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -bool -trng_rand(uint8_t *entropy_buf, size_t entropy_len, uint32_t timeout_us) -{ - TRNG_Params trng_params; - TRNG_Handle trng_handle; - CryptoKey entropy_key; - int_fast16_t result; - - TRNG_Params_init(&trng_params); - trng_params.returnBehavior = TRNG_RETURN_BEHAVIOR_BLOCKING; - if(timeout_us != TRNG_WAIT_FOREVER) { - trng_params.timeout = timeout_us; - } - - trng_handle = TRNG_open(0, &trng_params); - if(!trng_handle) { - return false; - } - - CryptoKeyPlaintext_initBlankKey(&entropy_key, entropy_buf, entropy_len); - - result = TRNG_generateEntropy(trng_handle, &entropy_key); - - TRNG_close(trng_handle); - - return result == TRNG_STATUS_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/trng-arch.h b/arch/cpu/simplelink-cc13xx-cc26xx/dev/trng-arch.h deleted file mode 100644 index fc25b9169..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/trng-arch.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-trng True Random Number Generator for CC13xx/CC26xx. - * @{ - * - * \file - * Header file of True Random Number Generator for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef TRNG_ARCH_H_ -#define TRNG_ARCH_H_ -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -#define TRNG_WAIT_FOREVER (~(uint32_t)0) -/*---------------------------------------------------------------------------*/ -/** - * \brief Generates a stream of entropy from which you can create - * a true random number from. This is a blocking function - * call with a specified timeout. - * \param entropy_buf Buffer to store a stream of entropy. - * \param entropy_len Length of the entropy buffer. - * \param timeout_us How long to wait until timing out the operation. A - * timeout of TRNG_WAIT_FOREVER blocks forever. - * \return true if successful; else, false. - */ -bool trng_rand(uint8_t *entropy_buf, size_t entropy_len, uint32_t timeout_us); -/*---------------------------------------------------------------------------*/ -#endif /* TRNG_ARCH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/uart0-arch.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/uart0-arch.c deleted file mode 100644 index d9dbfb30a..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/uart0-arch.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-uart - * @{ - * - * \file - * Implementation of UART driver for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "uart0-arch.h" -/*---------------------------------------------------------------------------*/ -#include - -#include -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -static UART_Handle uart_handle; - -static volatile uart0_input_fxn_t curr_input_cb; -static unsigned char char_buf; - -static bool initialized; -/*---------------------------------------------------------------------------*/ -static void -uart0_cb(UART_Handle handle, void *buf, size_t count) -{ - /* Simply return if the current callback is NULL. */ - if(!curr_input_cb) { - return; - } - - /* - * Save the current callback function locally, as it might be overwritten - * after calling the callback. - */ - const uart0_input_fxn_t curr_cb = curr_input_cb; - curr_cb(char_buf); - /* - * If curr_input_cb didn't change after the call, do another read. - * Else, the uart0_set_callback was called with a different callback pointer - * and triggered an another read. - */ - if(curr_cb == curr_input_cb) { - UART_read(uart_handle, &char_buf, 1); - } -} -/*---------------------------------------------------------------------------*/ -void -uart0_init(void) -{ - if(initialized) { - return; - } - - UART_Params uart_params; - UART_Params_init(&uart_params); - - uart_params.baudRate = TI_UART_CONF_BAUD_RATE; - uart_params.readMode = UART_MODE_CALLBACK; - uart_params.writeMode = UART_MODE_BLOCKING; - uart_params.readCallback = uart0_cb; - uart_params.readDataMode = UART_DATA_TEXT; - uart_params.readReturnMode = UART_RETURN_NEWLINE; - - /* No error handling. */ - uart_handle = UART_open(Board_UART0, &uart_params); - - initialized = true; -} -/*---------------------------------------------------------------------------*/ -int_fast32_t -uart0_write(const void *buf, size_t buf_size) -{ - if(!initialized) { - return UART_STATUS_ERROR; - } - return UART_write(uart_handle, buf, buf_size); -} -/*---------------------------------------------------------------------------*/ -int_fast32_t -uart0_write_byte(uint8_t byte) -{ - if(!initialized) { - return UART_STATUS_ERROR; - } - return UART_write(uart_handle, &byte, 1); -} -/*---------------------------------------------------------------------------*/ -int_fast32_t -uart0_set_callback(uart0_input_fxn_t input_cb) -{ - if(!initialized) { - return UART_STATUS_ERROR; - } - - if(curr_input_cb == input_cb) { - return UART_STATUS_SUCCESS; - } - - curr_input_cb = input_cb; - if(input_cb) { - return UART_read(uart_handle, &char_buf, 1); - } else { - UART_readCancel(uart_handle); - return UART_STATUS_SUCCESS; - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/uart0-arch.h b/arch/cpu/simplelink-cc13xx-cc26xx/dev/uart0-arch.h deleted file mode 100644 index 9d4a69fe1..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/uart0-arch.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-uart UART for CC13xx/CC26xx. - * - * This particular driver utilizes the UART0 peripheral specifically. - * - * Driver for the CC13xx/CC26xx UART controller. - * @{ - * - * \file - * Header file of UART driver for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -#ifndef UART0_ARCH_H_ -#define UART0_ARCH_H_ -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -typedef int (*uart0_input_fxn_t)(unsigned char); -/*---------------------------------------------------------------------------*/ -/** - * \brief Initializes the UART driver. - */ -void uart0_init(void); - -/** - * \brief Writes data from a memory buffer to the UART interface. - * \param buf A pointer to the data buffer. - * \param buf_size Size of the data buffer. - * \return Number of bytes that has been written to the UART. If an - * error occurs, a negative value is returned. - */ -int_fast32_t uart0_write(const void *buf, size_t buf_size); - -/** - * \brief Writes a single byte to the UART interface. - * \param byte Byte to write. - * \return Number of bytes that has been written to the UART. If an - * error occurs, a negative value is returned. - */ -int_fast32_t uart0_write_byte(uint8_t byte); - -/** - * \brief Set the callback function for when bytes are received - * on UART0. - * \param input_cb Pointer to the callback function. A valid pointer - * subscribes for UART0 callbacks when bytes are received, - * while a NULL pointer unsubscribes. - * \return 0 for success, negative value for errors. - */ -int_fast32_t uart0_set_callback(uart0_input_fxn_t input_cb); -/*---------------------------------------------------------------------------*/ -#endif /* UART0_ARCH_H_ */ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/dev/watchdog-arch.c b/arch/cpu/simplelink-cc13xx-cc26xx/dev/watchdog-arch.c deleted file mode 100644 index 6cba086b4..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/dev/watchdog-arch.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ - /** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-watchdog CC13xx/CC26xx watchdog timer driver - * - * Driver for the CC13xx/CC26xx Watchdog Timer - * - * This file is not called watchdog.c because the filename is in use by - * TI CC26xxware/CC13xxware - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx watchdog driver. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/watchdog.h" -/*---------------------------------------------------------------------------*/ -#include - -#include -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -#define WATCHDOG_DISABLE WATCHDOG_CONF_DISABLE -#define WATCHDOG_TIMER_TOP WATCHDOG_CONF_TIMER_TOP -/*---------------------------------------------------------------------------*/ -static Watchdog_Handle wdt_handle; -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialises the Watchdog module. - * - * Simply sets the reload counter to a default value. The WDT is not - * started yet. To start it, watchdog_start() must be called. - */ -void -watchdog_init(void) -{ - if(WATCHDOG_DISABLE) { - return; - } - - Watchdog_init(); - - Watchdog_Params wdt_params; - Watchdog_Params_init(&wdt_params); - - wdt_params.resetMode = Watchdog_RESET_ON; - wdt_params.debugStallMode = Watchdog_DEBUG_STALL_ON; - - wdt_handle = Watchdog_open(Board_WATCHDOG0, &wdt_params); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Start the Watchdog. - */ -void -watchdog_start(void) -{ - if(WATCHDOG_DISABLE) { - return; - } - - watchdog_periodic(); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Refresh (feed) the Watchdog. - */ -void -watchdog_periodic(void) -{ - if(WATCHDOG_DISABLE) { - return; - } - - Watchdog_setReload(wdt_handle, WATCHDOG_TIMER_TOP); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Stop the Watchdog such that it won't timeout and cause a - * system reset. - */ -void -watchdog_stop(void) -{ - if(WATCHDOG_DISABLE) { - return; - } - - Watchdog_clear(wdt_handle); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Manually trigger a Watchdog timeout. - */ -void -watchdog_reboot(void) -{ - if(WATCHDOG_DISABLE) { - return; - } - - watchdog_start(); - - /* Busy loop until watchdog times out */ - for (;;) { /* hang */ } -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/doxygen-group.txt b/arch/cpu/simplelink-cc13xx-cc26xx/doxygen-group.txt deleted file mode 100644 index ca6159c44..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/doxygen-group.txt +++ /dev/null @@ -1,16 +0,0 @@ -/** - * \defgroup cc13xx-cc26xx-cpu The TI SimpleLink CC13xx and CC26xx SoC - * - * This group documents the TI CC13xx and CC26xx CPUs. The two CPU families are - * very similar, with the main difference being related to radio capability. - * - * Documentation in this group should be considered to be applicable to both - * families, unless explicitly stated otherwise. - * - * \ingroup cpu - */ - -/** - * \defgroup cc13xx-cc26xx-platform TI SimpleLink CC13xx/CC26xx platform - * \ingroup platform - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/lib/coresdk_cc13xx_cc26xx b/arch/cpu/simplelink-cc13xx-cc26xx/lib/coresdk_cc13xx_cc26xx deleted file mode 160000 index b83faf3be..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/lib/coresdk_cc13xx_cc26xx +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b83faf3be2cb7468dc836a6fbd9d804638263252 diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ble-settings.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ble-settings.c deleted file mode 100644 index f9902f826..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ble-settings.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Parameter summary - * Adv. Address: 010203040506 - * Adv. Data: 255 - * BLE Channel: 17 - * Frequency: 2440 MHz - * PDU Payload length: 30 - * TX Power: 9 dBm (requires define CCFG_FORCE_VDDR_HH = 1 in ccfg.c, - * see CC13xx/CC26xx Technical Reference Manual) - * Whitening: true - */ -/*---------------------------------------------------------------------------*/ -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_ble.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_ble.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "ble-settings.h" -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -RF_Mode rf_ble_mode = -{ - .rfMode = RF_MODE_MULTIPLE, - .cpePatchFxn = &rf_patch_cpe_ble, - .mcePatchFxn = 0, - .rfePatchFxn = &rf_patch_rfe_ble, -}; -/*---------------------------------------------------------------------------*/ -/* - * CMD_RADIO_SETUP must be configured with default TX power value - * in the .txPower field. - */ -#define DEFAULT_TX_POWER 0x5F3C /* 5 dBm */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_RADIO_SETUP */ -uint32_t rf_ble_overrides[] CC_ALIGN(4) = -{ - /* override_use_patch_ble_1mbps.xml */ - MCE_RFE_OVERRIDE(0,0,0,1,0,0), /* PHY: Use MCE ROM, RFE RAM patch */ - /* override_synth_ble_1mbps.xml */ - HW_REG_OVERRIDE(0x4038,0x0034), /* Synth: Set recommended RTRIM to 4 */ - (uint32_t)0x000784A3, /* Synth: Set Fref to 3.43 MHz */ - HW_REG_OVERRIDE(0x4020,0x7F00), /* Synth: Configure fine calibration setting */ - HW_REG_OVERRIDE(0x4064,0x0040), /* Synth: Configure fine calibration setting */ - (uint32_t)0xB1070503, /* Synth: Configure fine calibration setting */ - (uint32_t)0x05330523, /* Synth: Configure fine calibration setting */ - (uint32_t)0xA47E0583, /* Synth: Set loop bandwidth after lock to 80 kHz */ - (uint32_t)0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz */ - (uint32_t)0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz */ - HW32_ARRAY_OVERRIDE(0x405C,1), /* Synth: Configure PLL bias */ - (uint32_t)0x18000000, /* Synth: Configure PLL bias */ - /* Synth: Configure VCO LDO */ - ADI_REG_OVERRIDE(1,4,0x9F), /* (in ADI1, set VCOLDOCFG=0x9F to use voltage input reference) */ - ADI_HALFREG_OVERRIDE(1,7,0x4,0x4), /* Synth: Configure synth LDO (in ADI1, set SLDOCTL0.COMP_CAP=1) */ - /* override_phy_ble_1mbps.xml */ - (uint32_t)0x013800C3, /* Tx: Configure symbol shape for BLE frequency deviation requirements */ - HW_REG_OVERRIDE(0x6088, 0x0045), /* Rx: Configure AGC reference level */ - HW_REG_OVERRIDE(0x6084, 0x05FD), /* Rx: Configure AGC gain level */ - (uint32_t)0x00038883, /* Rx: Configure LNA bias current trim offset */ - /* override_frontend_xd.xml */ - (uint32_t)0x00F388A3, /* Rx: Set RSSI offset to adjust reported RSSI by +13 dB */ - /* TX power override */ - ADI_REG_OVERRIDE(0,12,0xF8), /* Tx: Set PA trim to max (in ADI0, set PACTL0=0xF8) */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_RADIO_SETUP: Radio Setup Command for Pre-Defined Schemes */ -rfc_CMD_RADIO_SETUP_t rf_ble_cmd_radio_setup = -{ - .commandNo = CMD_RADIO_SETUP, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .mode = 0x00, - .loDivider = 0x00, - .config.frontEndMode = 0x0, /* set by driver */ - .config.biasMode = 0x0, /* set by driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = DEFAULT_TX_POWER, - .pRegOverride = rf_ble_overrides, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_BLE_ADV_NC: BLE Non-Connectable Advertiser Command */ -rfc_CMD_BLE_ADV_NC_t rf_ble_cmd_ble_adv_nc = -{ - .commandNo = CMD_BLE_ADV_NC, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x1, - .condition.rule = 0x0, /* set by driver */ - .condition.nSkip = 0x0, - .channel = 0x00, /* set by driver */ - .whitening.init = 0x00, /* set by driver */ - .whitening.bOverride = 0x1, - .pParams = 0x00000000, /* set by driver */ - .pOutput = 0x00000000, /* set by driver */ -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ble-settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ble-settings.h deleted file mode 100644 index 4d94edca8..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ble-settings.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 BLE_SETTINGS_H_ -#define BLE_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h) - -#include -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -extern RF_Mode rf_ble_mode; -/*---------------------------------------------------------------------------*/ -/* RF Core API commands */ -extern rfc_CMD_RADIO_SETUP_t rf_ble_cmd_radio_setup; -extern rfc_CMD_BLE_ADV_NC_t rf_ble_cmd_ble_adv_nc; -/*---------------------------------------------------------------------------*/ -/* RF Core API Overrides */ -extern uint32_t rf_ble_overrides[]; -/*---------------------------------------------------------------------------*/ -#endif /* BLE_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ble-tx-power.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ble-tx-power.c deleted file mode 100644 index a0ae346c5..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ble-tx-power.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-tx-power - * @{ - * - * \file - * Source file for BLE Beacon TX power tables for CC13x0. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1350 - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ble_tx_power_table_cc1350[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 3, 1, 6) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 1, 6) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 3, 1, 10) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 3, 1, 12) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(26, 3, 1, 14) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(35, 3, 1, 18) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(47, 3, 1, 22) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(29, 0, 1, 45) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(33, 0, 1, 49) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(38, 0, 1, 55) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(44, 0, 1, 63) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(52, 0, 1, 59) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(60, 0, 1, 47) }, -#if RF_TXPOWER_BOOST_MODE - /* This setting requires CCFG_FORCE_VDDR_HH = 1. */ - { 6, RF_TxPowerTable_DEFAULT_PA_ENTRY(38, 0, 1, 49) }, - /* This setting requires CCFG_FORCE_VDDR_HH = 1. */ - { 7, RF_TxPowerTable_DEFAULT_PA_ENTRY(46, 0, 1, 59) }, - /* This setting requires CCFG_FORCE_VDDR_HH = 1. */ - { 8, RF_TxPowerTable_DEFAULT_PA_ENTRY(55, 0, 1, 51) }, - /* This setting requires CCFG_FORCE_VDDR_HH = 1. */ - { 9, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 1, 30) }, -#endif - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -tx_power_table_t rf_ble_tx_power_table_empty[] = -{ - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* TX power table, based on which board is used. */ -#if defined(DEVICE_CC1350) || defined(DEVICE_CC1350_4) -#define TX_POWER_TABLE rf_ble_tx_power_table_cc1350 - -#else -#define TX_POWER_TABLE rf_ble_tx_power_table_empty -#endif - -/* - * Define symbols for both the TX power table and its size. The TX power - * table size is with one less entry by excluding the termination entry. - */ -tx_power_table_t *const ble_tx_power_table = TX_POWER_TABLE; -const size_t ble_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ieee-settings.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ieee-settings.c deleted file mode 100644 index 1537f693c..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ieee-settings.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Parameter summary - * IEEE Channel: 11 - * Frequency: 2405 MHz - * SFD: 0 - * Packet Data: 255 - * Preamble (32 bit): 01010101... - * TX Power: 5 dBm (requires define CCFG_FORCE_VDDR_HH = 0 in ccfg.c, - * see CC13xx/CC26xx Technical Reference Manual) - */ -/*---------------------------------------------------------------------------*/ -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -/* - * rf_ieee_cmd.h must be included "locally" from the arch/cpu directory, - * as it isn't defined in CC13x0 driverlib. - */ -#include "driverlib/rf_ieee_cmd.h" - -#include -/*---------------------------------------------------------------------------*/ -#include "ieee-settings.h" -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -RF_Mode rf_ieee_mode = -{ - .rfMode = RF_MODE_MULTIPLE, - .cpePatchFxn = 0, - .mcePatchFxn = 0, - .rfePatchFxn = 0, -}; -/*---------------------------------------------------------------------------*/ -/* - * CMD_RADIO_SETUP must be configured with default TX power value - * in the .txPower field. - */ -#define DEFAULT_TX_POWER 0x9330 /* 5 dBm */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_RADIO_SETUP */ -uint32_t rf_ieee_overrides[] CC_ALIGN(4) = -{ - /* override_synth_ieee_15_4.xml */ - HW_REG_OVERRIDE(0x4038,0x0035), /* Synth: Set recommended RTRIM to 5 */ - (uint32_t)0x000784A3, /* Synth: Set Fref to 3.43 MHz */ - (uint32_t)0xA47E0583, /* Synth: Set loop bandwidth after lock to 80 kHz */ - (uint32_t)0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz */ - (uint32_t)0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz */ - HW32_ARRAY_OVERRIDE(0x405C,1), /* Synth: Configure PLL bias */ - (uint32_t)0x1801F800, /* Synth: Configure PLL bias */ - HW32_ARRAY_OVERRIDE(0x402C,1), /* Synth: Configure PLL latency */ - (uint32_t)0x00608402, /* Synth: Configure PLL latency */ - (uint32_t)0x02010403, /* Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering */ - HW32_ARRAY_OVERRIDE(0x4034,1), /* Synth: Configure extra PLL filtering */ - (uint32_t)0x177F0408, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x38000463, /* Synth: Configure extra PLL filtering */ - /* override_phy_ieee_15_4.xml */ - (uint32_t)0x05000243, /* Synth: Increase synth programming timeout */ - (uint32_t)0x002082C3, /* Rx: Adjust Rx FIFO threshold to avoid overflow */ - /* override_frontend_id.xml */ - (uint32_t)0x000288A3, /* Rx: Set RSSI offset to adjust reported RSSI by -2 dB */ - (uint32_t)0x000F8883, /* Rx: Configure LNA bias current trim offset */ - HW_REG_OVERRIDE(0x50DC,0x002B), /* Rx: Adjust AGC DC filter */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_RADIO_SETUP: Radio Setup Command for Pre-Defined Schemes */ -rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup = -{ - .commandNo = CMD_RADIO_SETUP, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .mode = 0x01, - .config.frontEndMode = 0x0, /* set by driver */ - .config.biasMode = 0x0, /* set by driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = DEFAULT_TX_POWER, /* 5 dBm default */ - .pRegOverride = rf_ieee_overrides, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_FS: Frequency Synthesizer Programming Command */ -rfc_CMD_FS_t rf_cmd_ieee_fs = -{ - .commandNo = CMD_FS, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .frequency = 0x0965, /* set by driver */ - .fractFreq = 0x0000, /* set by driver */ - .synthConf.bTxMode = 0x1, - .synthConf.refFreq = 0x0, - .__dummy0 = 0x00, - .__dummy1 = 0x00, - .__dummy2 = 0x00, - .__dummy3 = 0x0000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_TX: IEEE 802.15.4 Transmit Command */ -rfc_CMD_IEEE_TX_t rf_cmd_ieee_tx = -{ - .commandNo = CMD_IEEE_TX, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .txOpt.bIncludePhyHdr = 0x0, - .txOpt.bIncludeCrc = 0x0, - .txOpt.payloadLenMsb = 0x0, - .payloadLen = 0x0, /* set by driver */ - .pPayload = 0, /* set by driver */ - .timeStamp = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_RX: IEEE 802.15.4 Receive Command */ -rfc_CMD_IEEE_RX_t rf_cmd_ieee_rx = -{ - .commandNo = CMD_IEEE_RX, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .channel = 0x00, /* set by driver */ - .rxConfig.bAutoFlushCrc = 0x1, - .rxConfig.bAutoFlushIgn = 0x1, - .rxConfig.bIncludePhyHdr = 0x0, - .rxConfig.bIncludeCrc = 0x1, - .rxConfig.bAppendRssi = 0x1, - .rxConfig.bAppendCorrCrc = 0x1, - .rxConfig.bAppendSrcInd = 0x0, - .rxConfig.bAppendTimestamp = 0x1, - .pRxQ = 0, /* set by driver */ - .pOutput = 0, /* set by driver */ - .frameFiltOpt.frameFiltEn = 0x0, /* set by driver */ - .frameFiltOpt.frameFiltStop = 0x1, - .frameFiltOpt.autoAckEn = 0x0, /* set by driver */ - .frameFiltOpt.slottedAckEn = 0x0, - .frameFiltOpt.autoPendEn = 0x0, - .frameFiltOpt.defaultPend = 0x0, - .frameFiltOpt.bPendDataReqOnly = 0x0, - .frameFiltOpt.bPanCoord = 0x0, - .frameFiltOpt.maxFrameVersion = 0x2, - .frameFiltOpt.fcfReservedMask = 0x0, - .frameFiltOpt.modifyFtFilter = 0x0, - .frameFiltOpt.bStrictLenFilter = 0x0, - .frameTypes.bAcceptFt0Beacon = 0x1, - .frameTypes.bAcceptFt1Data = 0x1, - .frameTypes.bAcceptFt2Ack = 0x1, - .frameTypes.bAcceptFt3MacCmd = 0x1, - .frameTypes.bAcceptFt4Reserved = 0x1, - .frameTypes.bAcceptFt5Reserved = 0x1, - .frameTypes.bAcceptFt6Reserved = 0x1, - .frameTypes.bAcceptFt7Reserved = 0x1, - .ccaOpt.ccaEnEnergy = 0x1, - .ccaOpt.ccaEnCorr = 0x1, - .ccaOpt.ccaEnSync = 0x1, - .ccaOpt.ccaCorrOp = 0x1, - .ccaOpt.ccaSyncOp = 0x0, - .ccaOpt.ccaCorrThr = 0x3, - .ccaRssiThr = 0x0, /* set by driver */ - .__dummy0 = 0x00, - .numExtEntries = 0x00, - .numShortEntries = 0x00, - .pExtEntryList = 0, - .pShortEntryList = 0, - .localExtAddr = 0x0, /* set by driver */ - .localShortAddr = 0x0, /* set by driver */ - .localPanID = 0x0000, - .__dummy1 = 0x000000, - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_RX_ACK: IEEE 802.15.4 Receive ACK Command */ -rfc_CMD_IEEE_RX_ACK_t rf_cmd_ieee_rx_ack = -{ - .commandNo = CMD_IEEE_RX_ACK, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .seqNo = 0x0, - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ieee-settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ieee-settings.h deleted file mode 100644 index bc60d70c3..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ieee-settings.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 IEEE_SETTINGS_H_ -#define IEEE_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki-conf.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -/* - * These two headers must be included "locally" from the arch/cpu directory, - * as they aren't defined in CC13x0 driverlib. - */ -#include "driverlib/rf_ieee_cmd.h" -#include "driverlib/rf_ieee_mailbox.h" - -#include -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -extern RF_Mode rf_ieee_mode; -/*---------------------------------------------------------------------------*/ -/* RF Core API commands */ -extern rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup; -extern rfc_CMD_FS_t rf_cmd_ieee_fs; -extern rfc_CMD_IEEE_TX_t rf_cmd_ieee_tx; -extern rfc_CMD_IEEE_RX_t rf_cmd_ieee_rx; -extern rfc_CMD_IEEE_RX_ACK_t rf_cmd_ieee_rx_ack; -/*---------------------------------------------------------------------------*/ -/* RF Core API Overrides */ -extern uint32_t rf_ieee_overrides[]; -/*---------------------------------------------------------------------------*/ -#endif /* IEEE_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ieee-tx-power.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ieee-tx-power.c deleted file mode 100644 index 2d37ef641..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/ieee-tx-power.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-tx-power - * @{ - * - * \file - * Source file for IEEE-mode TX power tables for CC13x0. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1350 - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ieee_tx_power_table_cc1350[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 6) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 6) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 6) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 1, 0, 10) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 1, 12) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(18, 1, 1, 14) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(24, 1, 1, 18) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(33, 1, 1, 24) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 0, 0, 33) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(24, 0, 0, 39) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 0, 0, 45) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(36, 0, 1, 73) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(48, 0, 1, 73) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -tx_power_table_t rf_ieee_tx_power_table_empty[] = -{ - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* Only define the symbols if Prop-mode is selected */ -#if (RF_MODE == RF_MODE_2_4_GHZ) -/*---------------------------------------------------------------------------*/ -/* TX power table, based on which board is used. */ -#if defined(DEVICE_CC1350) || defined(DEVICE_CC1350_4) -#define TX_POWER_TABLE rf_ieee_tx_power_table_cc1350 - -#else -#define TX_POWER_TABLE rf_ieee_tx_power_table_empty -#endif - -/* - * Define symbols for both the TX power table and its size. The TX power - * table size is with one less entry by excluding the termination entry. - */ -tx_power_table_t *const rf_tx_power_table = TX_POWER_TABLE; -const size_t rf_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1; -/*---------------------------------------------------------------------------*/ -#endif /* RF_MODE */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/prop-settings.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/prop-settings.c deleted file mode 100644 index 3d57fc3a3..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/prop-settings.c +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Parameter summary - * Address: 0 - * Address0: 0xAA - * Address1: 0xBB - * Frequency: 868.00000 MHz - * Data Format: Serial mode disable - * Deviation: 25.000 kHz - * pktLen: 30 - * 802.15.4g Mode: 0 - * Select bit order to transmit PSDU octets:: 1 - * Packet Length Config: Variable - * Max Packet Length: 255 - * Packet Length: 0 - * Packet Data: 255 - * RX Filter BW: 98 kHz - * Symbol Rate: 50.00000 kBaud - * Sync Word Length: 24 Bits - * TX Power: 14 dBm (requires define CCFG_FORCE_VDDR_HH = 1 in ccfg.c, - * see CC13xx/CC26xx Technical Reference Manual) - * Whitening: Dynamically IEEE 802.15.4g compatible whitener and 16/32-bit CRC - */ -/*---------------------------------------------------------------------------*/ -#include "contiki-conf.h" -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_genfsk.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_genfsk.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "prop-settings.h" -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -RF_Mode rf_prop_mode = -{ - .rfMode = RF_MODE_MULTIPLE, - .cpePatchFxn = &rf_patch_cpe_genfsk, - .mcePatchFxn = 0, - .rfePatchFxn = &rf_patch_rfe_genfsk, -}; -/*---------------------------------------------------------------------------*/ -#if defined(DEVICE_CC1310) -/* - * CMD_PROP_RADIO_DIV_SETUP must be configured with default TX power value - * in the .txPower field. This depends on whether RF_CONF_TXPOWER_BOOST_MODE - * is configured or not. - */ -#if RF_CONF_TXPOWER_BOOST_MODE -#define DEFAULT_TX_POWER 0xA73F /* 14 dBm */ -#else -#define DEFAULT_TX_POWER 0xA63F /* 12.5 dBm (rounded up to 13 dBm) */ -#endif - -#endif /* defined(DEVICE_CC1310) */ -/*---------------------------------------------------------------------------*/ -#if defined(DEVICE_CC1350) -/* - * CMD_PROP_RADIO_DIV_SETUP must be configured with default TX power value - * in the .txPower field. This depends on whether RF_CONF_TXPOWER_BOOST_MODE - * is configured or not. - */ -#if RF_CONF_TXPOWER_BOOST_MODE -#define DEFAULT_TX_POWER 0xAB3F /* 14 dBm */ -#else -#define DEFAULT_TX_POWER 0xBC2B /* 12 dBm */ -#endif - -#endif /* defined(DEVICE_CC1350) */ - /*---------------------------------------------------------------------------*/ -#if defined(DEVICE_CC1350_4) -/* - * CMD_PROP_RADIO_DIV_SETUP must be configured with default TX power value - * in the .txPower field. This depends on whether RF_CONF_TXPOWER_BOOST_MODE - * is configured or not. - */ -#if RF_CONF_TXPOWER_BOOST_MODE -#define DEFAULT_TX_POWER 0x913F /* 15 dBm */ -#else -#define DEFAULT_TX_POWER 0xB83F /* 13.7 dBm (rounded up to 14 dBm) */ -#endif - -#endif /* defined(DEVICE_CC1350_4) */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_PROP_RADIO_DIV_SETUP */ -uint32_t rf_prop_overrides[] CC_ALIGN(4) = -{ - /* override_use_patch_prop_genfsk.xml */ - MCE_RFE_OVERRIDE(0,4,0,1,0,0), /* PHY: Use MCE ROM bank 4, RFE RAM patch */ - /* override_synth_prop_863_930_div5.xml */ - HW_REG_OVERRIDE(0x4038,0x0037), /* Synth: Set recommended RTRIM to 7 */ - (uint32_t)0x000684A3, /* Synth: Set Fref to 4 MHz */ - HW_REG_OVERRIDE(0x4020,0x7F00), /* Synth: Configure fine calibration setting */ - HW_REG_OVERRIDE(0x4064,0x0040), /* Synth: Configure fine calibration setting */ - (uint32_t)0xB1070503, /* Synth: Configure fine calibration setting */ - (uint32_t)0x05330523, /* Synth: Configure fine calibration setting */ - (uint32_t)0x0A480583, /* Synth: Set loop bandwidth after lock to 20 kHz */ - (uint32_t)0x7AB80603, /* Synth: Set loop bandwidth after lock to 20 kHz */ - /* Synth: Configure VCO LDO */ - ADI_REG_OVERRIDE(1,4,0x9F), /* (in ADI1, set VCOLDOCFG=0x9F to use voltage input reference) */ - ADI_HALFREG_OVERRIDE(1,7,0x4,0x4), /* Synth: Configure synth LDO (in ADI1, set SLDOCTL0.COMP_CAP=1) */ - (uint32_t)0x02010403, /* Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering */ - (uint32_t)0x00108463, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x04B00243, /* Synth: Increase synth programming timeout (0x04B0 RAT ticks = 300 us) */ - /* override_phy_rx_aaf_bw_0xd.xml */ - /* Rx: Set anti-aliasing filter bandwidth to 0xD */ - ADI_HALFREG_OVERRIDE(0,61,0xF,0xD), /* (in ADI0, set IFAMPCTL3[7:4]=0xD) */ - /* override_phy_gfsk_rx.xml */ - (uint32_t)0x00038883, /* Rx: Set LNA bias current trim offset to 3 */ - HW_REG_OVERRIDE(0x6084,0x35F1), /* Rx: Freeze RSSI on sync found event */ - /* override_phy_gfsk_pa_ramp_agc_reflevel_0x1a.xml */ - /* Tx: Configure PA ramping setting (0x41). */ - HW_REG_OVERRIDE(0x6088,0x411A), /* Rx: Set AGC reference level to 0x1A. */ - HW_REG_OVERRIDE(0x608C,0x8213), /* Tx: Configure PA ramping setting */ - /* override_crc_ieee_802_15_4.xml */ - /* IEEE 802.15.4g: Fix incorrect initialization value for */ - (uint32_t)0x00000943, /* CRC-16 calculation (see TRM section 23.7.5.2.1) */ - /* IEEE 802.15.4g: Fix incorrect initialization value for */ - (uint32_t)0x00000963, /* CRC-16 calculation (see TRM section 23.7.5.2.1) */ -#if defined(DEVICE_CC1350_4) - /* override_phy_rx_rssi_offset_neg2db.xml */ - (uint32_t)0x000288A3, /* Rx: Set RSSI offset to adjust reported RSSI by -2 dB */ -#else - /* override_phy_rx_rssi_offset_5db.xml */ - (uint32_t)0x00FB88A3, /* Rx: Set RSSI offset to adjust reported RSSI by +5 dB */ -#endif - /* TX power override */ -#if RF_CONF_TXPOWER_BOOST_MODE - ADI_REG_OVERRIDE(0,12,0xF8), /* Tx: Set PA trim to max (in ADI0, set PACTL0=0xF8) */ -#endif - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_PROP_RADIO_DIV_SETUP */ -/* Proprietary Mode Radio Setup Command for All Frequency Bands */ -rfc_CMD_PROP_RADIO_DIV_SETUP_t rf_cmd_prop_radio_div_setup = -{ - .commandNo = CMD_PROP_RADIO_DIV_SETUP, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .modulation.modType = 0x1, - .modulation.deviation = 0x64, - .symbolRate.preScale = 0xF, - .symbolRate.rateWord = 0x8000, - .rxBw = 0x24, - .preamConf.nPreamBytes = 0x7, - .preamConf.preamMode = 0x0, - .formatConf.nSwBits = 0x18, - .formatConf.bBitReversal = 0x0, - .formatConf.bMsbFirst = 0x1, - .formatConf.fecMode = 0x0, - .formatConf.whitenMode = 0x7, - .config.frontEndMode = 0x0, /* set by driver */ - .config.biasMode = 0x0, /* set by driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = DEFAULT_TX_POWER, - .pRegOverride = rf_prop_overrides, - .centerFreq = 0x0364, /* set by driver */ - .intFreq = 0x8000, /* set by driver */ - .loDivider = 0x05, /* set by driver */ -}; -/*---------------------------------------------------------------------------*/ -/* CMD_FS */ -/* Frequency Synthesizer Programming Command */ -rfc_CMD_FS_t rf_cmd_prop_fs = -{ - .commandNo = CMD_FS, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .frequency = 0x0364, /* set by driver */ - .fractFreq = 0x0000, /* set by driver */ - .synthConf.bTxMode = 0x0, - .synthConf.refFreq = 0x0, - .__dummy0 = 0x00, - .__dummy1 = 0x00, - .__dummy2 = 0x00, - .__dummy3 = 0x0000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_PROP_TX_ADV */ -/* Proprietary Mode Advanced Transmit Command */ -rfc_CMD_PROP_TX_ADV_t rf_cmd_prop_tx_adv = -{ - .commandNo = CMD_PROP_TX_ADV, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .pktConf.bFsOff = 0x0, - .pktConf.bUseCrc = 0x1, - .pktConf.bCrcIncSw = 0x0, - .pktConf.bCrcIncHdr = 0x0, - .numHdrBits = 0x10, - .pktLen = 0x0, /* set by driver */ - .startConf.bExtTxTrig = 0x0, - .startConf.inputMode = 0x0, - .startConf.source = 0x0, - .preTrigger.triggerType = TRIG_REL_START, - .preTrigger.bEnaCmd = 0x0, - .preTrigger.triggerNo = 0x0, - .preTrigger.pastTrig = 0x1, - .preTime = 0x00000000, - .syncWord = 0x0055904E, - .pPkt = 0, /* set by driver */ -}; -/*---------------------------------------------------------------------------*/ -/* CMD_PROP_RX_ADV */ -/* Proprietary Mode Advanced Receive Command */ -rfc_CMD_PROP_RX_ADV_t rf_cmd_prop_rx_adv = -{ - .commandNo = CMD_PROP_RX_ADV, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .pktConf.bFsOff = 0x0, - .pktConf.bRepeatOk = 0x1, - .pktConf.bRepeatNok = 0x1, - .pktConf.bUseCrc = 0x1, - .pktConf.bCrcIncSw = 0x0, - .pktConf.bCrcIncHdr = 0x0, - .pktConf.endType = 0x0, - .pktConf.filterOp = 0x1, - .rxConf.bAutoFlushIgnored = 0x1, - .rxConf.bAutoFlushCrcErr = 0x1, - .rxConf.bIncludeHdr = 0x0, - .rxConf.bIncludeCrc = 0x0, - .rxConf.bAppendRssi = 0x1, - .rxConf.bAppendTimestamp = 0x0, - .rxConf.bAppendStatus = 0x1, - .syncWord0 = 0x0055904E, - .syncWord1 = 0x00000000, - .maxPktLen = 0x0, /* set by driver */ - .hdrConf.numHdrBits = 0x10, - .hdrConf.lenPos = 0x0, - .hdrConf.numLenBits = 0x0B, - .addrConf.addrType = 0x0, - .addrConf.addrSize = 0x0, - .addrConf.addrPos = 0x0, - .addrConf.numAddr = 0x0, - .lenOffset = 0xFC, - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, - .pAddr = 0, /* set by driver */ - .pQueue = 0, /* set by driver */ - .pOutput = 0, /* set by driver */ -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/prop-settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/prop-settings.h deleted file mode 100644 index f4f32ad57..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/prop-settings.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROP_SETTINGS_H_ -#define PROP_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki-conf.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h) - -#include -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -extern RF_Mode rf_prop_mode; -/*---------------------------------------------------------------------------*/ -/* TX Power Table */ -extern RF_TxPowerTable_Entry rf_prop_tx_power_table[]; -extern const size_t rf_prop_tx_power_table_size; -/*---------------------------------------------------------------------------*/ -/* RF Core API commands */ -extern rfc_CMD_PROP_RADIO_DIV_SETUP_t rf_cmd_prop_radio_div_setup; -extern rfc_CMD_FS_t rf_cmd_prop_fs; -extern rfc_CMD_PROP_TX_ADV_t rf_cmd_prop_tx_adv; -extern rfc_CMD_PROP_RX_ADV_t rf_cmd_prop_rx_adv; -/*---------------------------------------------------------------------------*/ -/* RF Core API Overrides */ -extern uint32_t rf_prop_overrides[]; -/*---------------------------------------------------------------------------*/ -#endif /* PROP_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/prop-tx-power.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/prop-tx-power.c deleted file mode 100644 index f2293767f..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/prop-tx-power.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-tx-power - * @{ - * - * \file - * Source file for Prop-mode TX power tables for CC13x0. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1310 - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_prop_tx_power_table_cc1310[] = -{ - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY( 0, 3, 0, 4) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY( 1, 1, 0, 0) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY( 3, 3, 0, 8) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY( 2, 1, 0, 8) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY( 4, 3, 0, 10) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY( 5, 3, 0, 12) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY( 6, 3, 0, 12) }, - { 6, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 14) }, - { 7, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 16) }, - { 8, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 18) }, - { 9, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 3, 0, 22) }, - { 10, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 3, 0, 28) }, - { 11, RF_TxPowerTable_DEFAULT_PA_ENTRY(26, 3, 0, 40) }, - { 12, RF_TxPowerTable_DEFAULT_PA_ENTRY(24, 0, 0, 92) }, - /* The original PA value (12.5 dBm) have been rounded to an integer value. */ - { 13, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 0, 83) }, -#if RF_CONF_TXPOWER_BOOST_MODE - /* This setting requires RF_CONF_TXPOWER_BOOST_MODE = 1. */ - { 14, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 1, 83) }, -#endif - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1350 - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_prop_tx_power_table_cc1350[] = -{ - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY( 0, 3, 0, 2) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY( 3, 3, 0, 9) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY( 4, 3, 0, 11) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY( 5, 3, 0, 12) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY( 6, 3, 0, 14) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY( 4, 1, 0, 12) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 3, 0, 16) }, - { 6, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 18) }, - { 7, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 21) }, - { 8, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 3, 0, 25) }, - { 9, RF_TxPowerTable_DEFAULT_PA_ENTRY(18, 3, 0, 32) }, - { 10, RF_TxPowerTable_DEFAULT_PA_ENTRY(24, 3, 0, 44) }, - { 11, RF_TxPowerTable_DEFAULT_PA_ENTRY(37, 3, 0, 72) }, - { 12, RF_TxPowerTable_DEFAULT_PA_ENTRY(43, 0, 0, 94) }, -#if RF_CONF_TXPOWER_BOOST_MODE - /* This setting requires RF_CONF_TXPOWER_BOOST_MODE = 1. */ - { 14, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 1, 85) }, -#endif - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1350_433 - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_prop_tx_power_table_cc1350_4[] = -{ - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY( 0, 3, 0, 2) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY( 1, 3, 0, 7) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY( 1, 3, 0, 9) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY( 2, 3, 0, 11) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY( 2, 3, 0, 12) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY( 3, 3, 0, 16) }, - { 6, RF_TxPowerTable_DEFAULT_PA_ENTRY( 4, 3, 0, 18) }, - { 7, RF_TxPowerTable_DEFAULT_PA_ENTRY( 5, 3, 0, 21) }, - { 8, RF_TxPowerTable_DEFAULT_PA_ENTRY( 6, 3, 0, 23) }, - { 9, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 3, 0, 28) }, - { 10, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 35) }, - { 11, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 1, 0, 39) }, - { 12, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 0, 60) }, - { 13, RF_TxPowerTable_DEFAULT_PA_ENTRY(15, 0, 0, 108) }, - /* The original PA value (13.7 dBm) have been rounded to an integer value. */ - { 14, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 0, 92) }, -#if RF_CONF_TXPOWER_BOOST_MODE - /* This setting requires RF_CONF_TXPOWER_BOOST_MODE = 1. */ - { 15, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 1, 72) }, -#endif - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -tx_power_table_t rf_prop_tx_power_table_empty[] = -{ - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* Only define the symbols if Prop-mode is selected */ -#if (RF_MODE == RF_MODE_SUB_1_GHZ) -/*---------------------------------------------------------------------------*/ -/* TX power table, based on which board is used. */ -#if defined(DEVICE_CC1310) -#define TX_POWER_TABLE rf_prop_tx_power_table_cc1310 - -#elif defined(DEVICE_CC1350) -#define TX_POWER_TABLE rf_prop_tx_power_table_cc1350 - -#elif defined(DEVICE_CC1350_4) -#define TX_POWER_TABLE rf_prop_tx_power_table_cc1350_4 - -#else -#define TX_POWER_TABLE rf_prop_tx_power_table_empty -#endif - -/* - * Define symbols for both the TX power table and its size. The TX power - * table size is with one less entry by excluding the termination entry. - */ -tx_power_table_t *const rf_tx_power_table = TX_POWER_TABLE; -const size_t rf_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1; -/*---------------------------------------------------------------------------*/ -#endif /* RF_MODE */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ble-settings.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ble-settings.c deleted file mode 100644 index b43ce21a6..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ble-settings.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Parameter summary - * Adv. Address: 010203040506 - * Adv. Data: dummy - * BLE Channel: 17 - * Extended Header: 09 09 010203040506 babe - * Frequency: 2440 MHz - * PDU Payload length:: 30 - * TX Power: 5 dBm (requires define CCFG_FORCE_VDDR_HH = 0 in ccfg - * see CC13xx/CC26xx Technical Reference Manual) - * Whitening: true - */ -/*---------------------------------------------------------------------------*/ -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_bt5.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_mce_bt5.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "ble-settings.h" -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -RF_Mode rf_ble_mode = -{ - .rfMode = RF_MODE_AUTO, - .cpePatchFxn = &rf_patch_cpe_multi_protocol, - .mcePatchFxn = &rf_patch_mce_bt5, - .rfePatchFxn = &rf_patch_rfe_bt5, -}; -/*---------------------------------------------------------------------------*/ -/* - * CMD_RADIO_SETUP must be configured with default TX power value - * in the .txPower field. - */ -#define DEFAULT_TX_POWER 0x941E /* 5 dBm */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_BLE5_RADIO_SETUP */ -uint32_t rf_ble_overrides_common[] CC_ALIGN(4) = -{ - /* override_ble5_setup_override_common.xml */ - (uint32_t)0x02400403, /* Synth: Use 48 MHz crystal, enable extra PLL filtering */ - (uint32_t)0x001C8473, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x00088433, /* Synth: Configure synth hardware */ - (uint32_t)0x00038793, /* Synth: Set minimum RTRIM to 3 */ - HW32_ARRAY_OVERRIDE(0x4004,1), /* Synth: Configure faster calibration */ - (uint32_t)0x1C0C0618, /* Synth: Configure faster calibration */ - (uint32_t)0xC00401A1, /* Synth: Configure faster calibration */ - (uint32_t)0x00010101, /* Synth: Configure faster calibration */ - (uint32_t)0xC0040141, /* Synth: Configure faster calibration */ - (uint32_t)0x00214AD3, /* Synth: Configure faster calibration */ - (uint32_t)0x02980243, /* Synth: Decrease synth programming time-out (0x0298 RAT ticks = 166 us) */ - /* DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0xFCFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0x00038883, /* Rx: Set LNA bias current offset to adjust +3 (default: 0) */ - (uint32_t)0x000288A3, /* Rx: Set RSSI offset to adjust reported RSSI by -2 dB (default: 0) */ - (uint32_t)0x01080263, /* Bluetooth 5: Compensate for reduced pilot tone length */ - (uint32_t)0x08E90AA3, /* Bluetooth 5: Compensate for reduced pilot tone length */ - (uint32_t)0x00068BA3, /* Bluetooth 5: Compensate for reduced pilot tone length */ - /* Bluetooth 5: Set correct total clock accuracy for received AuxPtr */ - (uint32_t)0x0E490C83, /* assuming local sleep clock of 50 ppm */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_BLE5_RADIO_SETUP */ -uint32_t rf_ble_overrides_1mbps[] CC_ALIGN(4) = -{ - /* override_ble5_setup_override_1mbps.xml */ - MCE_RFE_OVERRIDE(1,0,0,1,0,0), /* PHY: Use MCE RAM patch (mode 0), RFE RAM patch (mode 0) */ - HW_REG_OVERRIDE(0x5320,0x0240), /* Bluetooth 5: Reduce pilot tone length */ - (uint32_t)0x013302A3, /* Bluetooth 5: Compensate for reduced pilot tone length */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_BLE5_RADIO_SETUP */ -uint32_t rf_ble_overrides_2mbps[] CC_ALIGN(4) = -{ - /* override_ble5_setup_override_2mbps.xml */ - MCE_RFE_OVERRIDE(1,0,2,1,0,2), /* PHY: Use MCE RAM patch (mode 2), RFE RAM patch (mode 2) */ - HW_REG_OVERRIDE(0x5320,0x0240), /* Bluetooth 5: Reduce pilot tone length */ - (uint32_t)0x00D102A3, /* Bluetooth 5: Compensate for reduced pilot tone length */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_BLE5_RADIO_SETUP */ -uint32_t rf_ble_overrides_coded[] CC_ALIGN(4) = -{ - /* override_ble5_setup_override_coded.xml */ - MCE_RFE_OVERRIDE(1,0,1,1,0,1), /* PHY: Use MCE RAM patch (mode 1), RFE RAM patch (mode 1) */ - HW_REG_OVERRIDE(0x5320,0x0240), /* Bluetooth 5: Reduce pilot tone length */ - (uint32_t)0x078902A3, /* Bluetooth 5: Compensate for reduced pilot tone length */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_BLE5_RADIO_SETUP: Bluetooth 5 Radio Setup Command for all PHYs */ -rfc_CMD_BLE5_RADIO_SETUP_t rf_ble_cmd_radio_setup = -{ - .commandNo = CMD_BLE5_RADIO_SETUP, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .defaultPhy.mainMode = 0x0, - .defaultPhy.coding = 0x0, - .loDivider = 0x00, - .config.frontEndMode = 0x0, /* set by driver */ - .config.biasMode = 0x0, /* set by driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = DEFAULT_TX_POWER, - .pRegOverrideCommon = rf_ble_overrides_common, - .pRegOverride1Mbps = rf_ble_overrides_1mbps, - .pRegOverride2Mbps = rf_ble_overrides_2mbps, - .pRegOverrideCoded = rf_ble_overrides_coded, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_BLE5_ADV_NC: Bluetooth 5 Non-Connectable Advertiser Command */ -rfc_CMD_BLE5_ADV_NC_t rf_ble_cmd_ble_adv_nc = -{ - .commandNo = CMD_BLE5_ADV_NC, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x1, - .condition.rule = 0x0, /* set by driver */ - .condition.nSkip = 0x0, - .channel = 0x00, /* set by driver */ - .whitening.init = 0x00, /* set by driver */ - .whitening.bOverride = 0x1, - .phyMode.mainMode = 0x0, - .phyMode.coding = 0x0, - .rangeDelay = 0x00, - .txPower = 0x0000, - .pParams = 0x00000000, /* set by driver */ - .pOutput = 0x00000000, /* set by driver */ - .tx20Power = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ble-settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ble-settings.h deleted file mode 100644 index c5295c868..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ble-settings.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 BLE_SETTINGS_H_ -#define BLE_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h) - -#include -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -extern RF_Mode rf_ble_mode; -/*---------------------------------------------------------------------------*/ -/* RF Core API commands */ -extern rfc_CMD_BLE5_RADIO_SETUP_t rf_ble_cmd_radio_setup; -extern rfc_CMD_BLE5_ADV_NC_t rf_ble_cmd_ble_adv_nc; -/*---------------------------------------------------------------------------*/ -/* RF Core API Overrides */ -extern uint32_t rf_ble_overrides_common[]; -extern uint32_t rf_ble_overrides_1mbps[]; -extern uint32_t rf_ble_overrides_2mbps[]; -extern uint32_t rf_ble_overrides_coded[]; -/*---------------------------------------------------------------------------*/ -#endif /* BLE_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ble-tx-power.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ble-tx-power.c deleted file mode 100644 index 7a87ca567..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ble-tx-power.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-tx-power - * @{ - * - * \file - * Source file for ble-mode TX power tables for CC13x2. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1352R - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ble_tx_power_table_cc1352r[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 3) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 3) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 2, 0, 6) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 2, 0, 8) }, - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 2, 0, 11) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 2, 0, 5) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 1, 0, 16) }, - { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 0, 17) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 1, 0, 20) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 26) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 1, 0, 28) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 0, 0, 34) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 0, 0, 42) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 0, 0, 54) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(30, 0, 0, 74) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1352P with default PA - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ble_tx_power_table_cc1352p_dpa[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 3) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 3) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 2, 0, 6) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 2, 0, 8) }, - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 2, 0, 11) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 2, 0, 5) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 1, 0, 16) }, - { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 0, 17) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 1, 0, 20) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 26) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 1, 0, 28) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 0, 0, 34) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 0, 0, 42) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 0, 0, 54) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(30, 0, 0, 74) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1352P with high PA - * The RF_TxPowerTable_HIGH_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_HIGH_PA_ENTRY(bias, ibboost, boost, coefficient, ldoTrim) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ble_tx_power_table_cc1352p_hpa[] = -{ - { 0, RF_TxPowerTable_HIGH_PA_ENTRY(29, 0, 1, 17, 1) }, - { 3, RF_TxPowerTable_HIGH_PA_ENTRY(39, 0, 1, 20, 1) }, - { 6, RF_TxPowerTable_HIGH_PA_ENTRY(46, 0, 1, 26, 7) }, - { 9, RF_TxPowerTable_HIGH_PA_ENTRY(40, 0, 1, 39, 41) }, - { 10, RF_TxPowerTable_HIGH_PA_ENTRY(23, 2, 1, 65, 5) }, - { 11, RF_TxPowerTable_HIGH_PA_ENTRY(24, 2, 1, 29, 7) }, - { 12, RF_TxPowerTable_HIGH_PA_ENTRY(19, 2, 1, 16, 25) }, - { 13, RF_TxPowerTable_HIGH_PA_ENTRY(27, 2, 1, 19, 13) }, - { 14, RF_TxPowerTable_HIGH_PA_ENTRY(24, 2, 1, 19, 27) }, - { 15, RF_TxPowerTable_HIGH_PA_ENTRY(23, 2, 1, 20, 39) }, - { 16, RF_TxPowerTable_HIGH_PA_ENTRY(34, 2, 1, 26, 23) }, - { 17, RF_TxPowerTable_HIGH_PA_ENTRY(38, 2, 1, 33, 25) }, - { 18, RF_TxPowerTable_HIGH_PA_ENTRY(30, 2, 1, 37, 53) }, - { 19, RF_TxPowerTable_HIGH_PA_ENTRY(36, 2, 1, 57, 59) }, - { 20, RF_TxPowerTable_HIGH_PA_ENTRY(56, 2, 1, 45, 63) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -tx_power_table_t rf_ble_tx_power_table_empty[] = -{ - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* TX power table, based on which board is used. */ -#if defined(DEVICE_CC1352R) -#define TX_POWER_TABLE rf_ble_tx_power_table_cc1352r - -#elif defined(DEVICE_CC1352P) -#if RF_TXPOWER_HIGH_PA -#define TX_POWER_TABLE rf_ble_tx_power_table_cc1352p_hpa -#else -#define TX_POWER_TABLE rf_ble_tx_power_table_cc1352p_dpa -#endif - -#else -#define TX_POWER_TABLE rf_ble_tx_power_table_empty -#endif - -/* - * Define symbols for both the TX power table and its size. The TX power - * table size is with one less entry by excluding the termination entry. - */ -tx_power_table_t *const ble_tx_power_table = TX_POWER_TABLE; -const size_t ble_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ieee-settings.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ieee-settings.c deleted file mode 100644 index a81a83385..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ieee-settings.c +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Parameter summary - * IEEE Channel: 11 - * Frequency: 2405 MHz - * SFD: 0 - * Packet Data: 255 - * Preamble (32 bit): 01010101... - * For Default PA: - * Enable high output power PA: false - * TX Power: 5 dBm (requires define CCFG_FORCE_VDDR_HH = 0 in ccfg.c, - * see CC13xx/CC26xx Technical Reference Manual) - * For High PA: - * Enable high output power PA: true - * TX Power: 20 dBm (requires define CCFG_FORCE_VDDR_HH = 0 in ccfg.c, - * see CC13xx/CC26xx Technical Reference Manual) - */ -/*---------------------------------------------------------------------------*/ -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ieee_cmd.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_mce_ieee_802_15_4.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "ieee-settings.h" -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -RF_Mode rf_ieee_mode = -{ - .rfMode = RF_MODE_AUTO, - .cpePatchFxn = &rf_patch_cpe_multi_protocol, - .mcePatchFxn = &rf_patch_mce_ieee_802_15_4, - .rfePatchFxn = 0, -}; -/*---------------------------------------------------------------------------*/ -#if defined(DEVICE_CC1352R) -/* - * CMD_RADIO_SETUP must be configured with default TX power value - * in the .txPower field. - */ -#define DEFAULT_TX_POWER 0x941E /* 5 dBm */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_RADIO_SETUP */ -uint32_t rf_ieee_overrides[] CC_ALIGN(4) = -{ - /* override_ieee_802_15_4.xml */ - MCE_RFE_OVERRIDE(1,0,0,0,1,0), /* PHY: Use MCE RAM patch, RFE ROM bank 1 */ - (uint32_t)0x02400403, /* Synth: Use 48 MHz crystal, enable extra PLL filtering */ - (uint32_t)0x001C8473, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x00088433, /* Synth: Configure synth hardware */ - (uint32_t)0x00038793, /* Synth: Set minimum RTRIM to 3 */ - HW32_ARRAY_OVERRIDE(0x4004,1), /* Synth: Configure faster calibration */ - (uint32_t)0x1C0C0618, /* Synth: Configure faster calibration */ - (uint32_t)0xC00401A1, /* Synth: Configure faster calibration */ - (uint32_t)0x00010101, /* Synth: Configure faster calibration */ - (uint32_t)0xC0040141, /* Synth: Configure faster calibration */ - (uint32_t)0x00214AD3, /* Synth: Configure faster calibration */ - (uint32_t)0x02980243, /* Synth: Decrease synth programming time-out (0x0298 RAT ticks = 166 us) */ - /* DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0xFCFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0x000F8883, /* Rx: Set LNA bias current offset to +15 to saturate trim to max (default: 0) */ - (uint32_t)0xFFFFFFFF, -}; - -#endif /* defined(DEVICE_CC1352R) */ -/*---------------------------------------------------------------------------*/ -#if defined(DEVICE_CC1352P) - -#if RF_CONF_TXPOWER_HIGH_PA -/* - * CMD_PROP_RADIO_DIV_SETUP must be configured with default TX power value - * in the .txPower field. For High PA, this must be 0xFFFF. - */ -#define DEFAULT_TX_POWER 0xFFFF /* High PA */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_RADIO_SETUP with high PA */ -uint32_t rf_ieee_overrides[] CC_ALIGN(4) = -{ - /* override_ieee_802_15_4.xml */ - MCE_RFE_OVERRIDE(1,0,0,0,1,0), /* PHY: Use MCE RAM patch, RFE ROM bank 1 */ - (uint32_t)0x02400403, /* Synth: Use 48 MHz crystal, enable extra PLL filtering */ - (uint32_t)0x001C8473, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x00088433, /* Synth: Configure synth hardware */ - (uint32_t)0x00038793, /* Synth: Set minimum RTRIM to 3 */ - HW32_ARRAY_OVERRIDE(0x4004,1), /* Synth: Configure faster calibration */ - (uint32_t)0x1C0C0618, /* Synth: Configure faster calibration */ - (uint32_t)0xC00401A1, /* Synth: Configure faster calibration */ - (uint32_t)0x00010101, /* Synth: Configure faster calibration */ - (uint32_t)0xC0040141, /* Synth: Configure faster calibration */ - (uint32_t)0x00214AD3, /* Synth: Configure faster calibration */ - (uint32_t)0x02980243, /* Synth: Decrease synth programming time-out (0x0298 RAT ticks = 166 us) */ - /* DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0xFCFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0x000F8883, /* Rx: Set LNA bias current offset to +15 to saturate trim to max (default: 0) */ - /* override_frontend_xd.xml */ - /* TX power override */ - (uint32_t)0xFD6EE02B, /* txHighPA=0x3F5BB8 */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -#else -/* - * CMD_RADIO_SETUP must be configured with default TX power value - * in the .txPower field. - */ -#define DEFAULT_TX_POWER 0x941E /* 5 dBm */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_RADIO_SETUP with default PA */ -uint32_t rf_ieee_overrides[] CC_ALIGN(4) = -{ - /* override_ieee_802_15_4.xml */ - MCE_RFE_OVERRIDE(1,0,0,0,1,0), /* PHY: Use MCE RAM patch, RFE ROM bank 1 */ - (uint32_t)0x02400403, /* Synth: Use 48 MHz crystal, enable extra PLL filtering */ - (uint32_t)0x001C8473, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x00088433, /* Synth: Configure synth hardware */ - (uint32_t)0x00038793, /* Synth: Set minimum RTRIM to 3 */ - HW32_ARRAY_OVERRIDE(0x4004,1), /* Synth: Configure faster calibration */ - (uint32_t)0x1C0C0618, /* Synth: Configure faster calibration */ - (uint32_t)0xC00401A1, /* Synth: Configure faster calibration */ - (uint32_t)0x00010101, /* Synth: Configure faster calibration */ - (uint32_t)0xC0040141, /* Synth: Configure faster calibration */ - (uint32_t)0x00214AD3, /* Synth: Configure faster calibration */ - (uint32_t)0x02980243, /* Synth: Decrease synth programming time-out (0x0298 RAT ticks = 166 us) */ - /* DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0xFCFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0x000F8883, /* Rx: Set LNA bias current offset to +15 to saturate trim to max (default: 0) */ - (uint32_t)0xFFFFFFFF, -}; - -#endif /* RF_CONF_TXPOWER_HIGH_PA */ - -#endif /* defined(DEVICE_CC1352P) */ -/*---------------------------------------------------------------------------*/ -/* CMD_RADIO_SETUP: Radio Setup Command for Pre-Defined Schemes */ -rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup = -{ - .commandNo = CMD_RADIO_SETUP, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .mode = 0x01, - .loDivider = 0x00, - .config.frontEndMode = 0x0, /* set by driver */ - .config.biasMode = 0x0, /* set by driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = DEFAULT_TX_POWER, /* 5 dBm default */ - .pRegOverride = rf_ieee_overrides, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_FS: Frequency Synthesizer Programming Command */ -rfc_CMD_FS_t rf_cmd_ieee_fs = -{ - .commandNo = CMD_FS, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .frequency = 0x0965, /* set by driver */ - .fractFreq = 0x0000, /* set by driver */ - .synthConf.bTxMode = 0x1, - .synthConf.refFreq = 0x0, - .__dummy0 = 0x00, - .__dummy1 = 0x00, - .__dummy2 = 0x00, - .__dummy3 = 0x0000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_TX: IEEE 802.15.4 Transmit Command */ -rfc_CMD_IEEE_TX_t rf_cmd_ieee_tx = -{ - .commandNo = CMD_IEEE_TX, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .txOpt.bIncludePhyHdr = 0x0, - .txOpt.bIncludeCrc = 0x0, - .txOpt.payloadLenMsb = 0x0, - .payloadLen = 0x0, /* set by driver */ - .pPayload = 0, /* set by driver */ - .timeStamp = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_RX: IEEE 802.15.4 Receive Command */ -rfc_CMD_IEEE_RX_t rf_cmd_ieee_rx = -{ - .commandNo = CMD_IEEE_RX, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .channel = 0x00, /* set by driver */ - .rxConfig.bAutoFlushCrc = 0x1, - .rxConfig.bAutoFlushIgn = 0x1, - .rxConfig.bIncludePhyHdr = 0x0, - .rxConfig.bIncludeCrc = 0x1, - .rxConfig.bAppendRssi = 0x1, - .rxConfig.bAppendCorrCrc = 0x1, - .rxConfig.bAppendSrcInd = 0x0, - .rxConfig.bAppendTimestamp = 0x1, - .pRxQ = 0, /* set by driver */ - .pOutput = 0, /* set by driver */ - .frameFiltOpt.frameFiltEn = 0x0, /* set by driver */ - .frameFiltOpt.frameFiltStop = 0x1, - .frameFiltOpt.autoAckEn = 0x0, /* set by driver */ - .frameFiltOpt.slottedAckEn = 0x0, - .frameFiltOpt.autoPendEn = 0x0, - .frameFiltOpt.defaultPend = 0x0, - .frameFiltOpt.bPendDataReqOnly = 0x0, - .frameFiltOpt.bPanCoord = 0x0, - .frameFiltOpt.maxFrameVersion = 0x2, - .frameFiltOpt.fcfReservedMask = 0x0, - .frameFiltOpt.modifyFtFilter = 0x0, - .frameFiltOpt.bStrictLenFilter = 0x0, - .frameTypes.bAcceptFt0Beacon = 0x1, - .frameTypes.bAcceptFt1Data = 0x1, - .frameTypes.bAcceptFt2Ack = 0x1, - .frameTypes.bAcceptFt3MacCmd = 0x1, - .frameTypes.bAcceptFt4Reserved = 0x1, - .frameTypes.bAcceptFt5Reserved = 0x1, - .frameTypes.bAcceptFt6Reserved = 0x1, - .frameTypes.bAcceptFt7Reserved = 0x1, - .ccaOpt.ccaEnEnergy = 0x1, - .ccaOpt.ccaEnCorr = 0x1, - .ccaOpt.ccaEnSync = 0x1, - .ccaOpt.ccaCorrOp = 0x1, - .ccaOpt.ccaSyncOp = 0x0, - .ccaOpt.ccaCorrThr = 0x3, - .ccaRssiThr = 0x0, /* set by driver */ - .__dummy0 = 0x00, - .numExtEntries = 0x00, - .numShortEntries = 0x00, - .pExtEntryList = 0, - .pShortEntryList = 0, - .localExtAddr = 0x0, /* set by driver */ - .localShortAddr = 0x0, /* set by driver */ - .localPanID = 0x0000, - .__dummy1 = 0x000000, - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_RX_ACK: IEEE 802.15.4 Receive ACK Command */ -rfc_CMD_IEEE_RX_ACK_t rf_cmd_ieee_rx_ack = -{ - .commandNo = CMD_IEEE_RX_ACK, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .seqNo = 0x0, - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ieee-settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ieee-settings.h deleted file mode 100644 index 7019598c8..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ieee-settings.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 IEEE_SETTINGS_H_ -#define IEEE_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki-conf.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ieee_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ieee_mailbox.h) - -#include -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -extern RF_Mode rf_ieee_mode; -/*---------------------------------------------------------------------------*/ -/* RF Core API commands */ -extern rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup; -extern rfc_CMD_FS_t rf_cmd_ieee_fs; -extern rfc_CMD_IEEE_TX_t rf_cmd_ieee_tx; -extern rfc_CMD_IEEE_RX_t rf_cmd_ieee_rx; -extern rfc_CMD_IEEE_RX_ACK_t rf_cmd_ieee_rx_ack; -/*---------------------------------------------------------------------------*/ -/* RF Core API Overrides */ -extern uint32_t rf_ieee_overrides[]; -/*---------------------------------------------------------------------------*/ -#endif /* IEEE_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ieee-tx-power.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ieee-tx-power.c deleted file mode 100644 index efd143e9d..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ieee-tx-power.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-tx-power - * @{ - * - * \file - * Source file for IEEE-mode TX power tables for CC13x2. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1312R - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ieee_tx_power_table_cc1312r[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 3) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 3) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 2, 0, 6) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 2, 0, 8) }, - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 2, 0, 11) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 2, 0, 5) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 1, 0, 16) }, - { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 0, 17) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 1, 0, 20) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 26) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 1, 0, 28) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 0, 0, 34) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 0, 0, 42) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 0, 0, 54) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(30, 0, 0, 74) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1352R - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ieee_tx_power_table_cc1352r[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 3) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 3) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 2, 0, 6) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 2, 0, 8) }, - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 2, 0, 11) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 2, 0, 5) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 1, 0, 16) }, - { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 0, 17) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 1, 0, 20) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 26) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 1, 0, 28) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 0, 0, 34) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 0, 0, 42) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 0, 0, 54) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(30, 0, 0, 74) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1352P with default PA - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ieee_tx_power_table_cc1352p_dpa[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 3) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 3) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 2, 0, 6) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 2, 0, 8) }, - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 2, 0, 11) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 2, 0, 5) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 1, 0, 16) }, - { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 0, 17) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 1, 0, 20) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 26) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 1, 0, 28) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 0, 0, 34) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 0, 0, 42) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 0, 0, 54) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(30, 0, 0, 74) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1352P with high PA - * The RF_TxPowerTable_HIGH_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_HIGH_PA_ENTRY(bias, ibboost, boost, coefficient, ldoTrim) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ieee_tx_power_table_cc1352p_hpa[] = -{ - { 0, RF_TxPowerTable_HIGH_PA_ENTRY(29, 0, 1, 17, 1) }, - { 3, RF_TxPowerTable_HIGH_PA_ENTRY(39, 0, 1, 20, 1) }, - { 6, RF_TxPowerTable_HIGH_PA_ENTRY(46, 0, 1, 26, 7) }, - { 9, RF_TxPowerTable_HIGH_PA_ENTRY(40, 0, 1, 39, 41) }, - { 10, RF_TxPowerTable_HIGH_PA_ENTRY(23, 2, 1, 65, 5) }, - { 11, RF_TxPowerTable_HIGH_PA_ENTRY(24, 2, 1, 29, 7) }, - { 12, RF_TxPowerTable_HIGH_PA_ENTRY(19, 2, 1, 16, 25) }, - { 13, RF_TxPowerTable_HIGH_PA_ENTRY(27, 2, 1, 19, 13) }, - { 14, RF_TxPowerTable_HIGH_PA_ENTRY(24, 2, 1, 19, 27) }, - { 15, RF_TxPowerTable_HIGH_PA_ENTRY(23, 2, 1, 20, 39) }, - { 16, RF_TxPowerTable_HIGH_PA_ENTRY(34, 2, 1, 26, 23) }, - { 17, RF_TxPowerTable_HIGH_PA_ENTRY(38, 2, 1, 33, 25) }, - { 18, RF_TxPowerTable_HIGH_PA_ENTRY(30, 2, 1, 37, 53) }, - { 19, RF_TxPowerTable_HIGH_PA_ENTRY(36, 2, 1, 57, 59) }, - { 20, RF_TxPowerTable_HIGH_PA_ENTRY(56, 2, 1, 45, 63) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -tx_power_table_t rf_ieee_ztx_power_table_empty[] = -{ - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* Only define the symbols if Prop-mode is selected */ -#if (RF_MODE == RF_MODE_2_4_GHZ) -/*---------------------------------------------------------------------------*/ -/* TX power table, based on which board is used. */ -#if defined(DEVICE_CC1312R) -#define TX_POWER_TABLE rf_ieee_tx_power_table_cc1312r - -#elif defined(DEVICE_CC1352R) -#define TX_POWER_TABLE rf_ieee_tx_power_table_cc1352r - -#elif defined(DEVICE_CC1352P) -#if RF_TXPOWER_HIGH_PA -#define TX_POWER_TABLE rf_ieee_tx_power_table_cc1352p_hpa -#else -#define TX_POWER_TABLE rf_ieee_tx_power_table_cc1352p_dpa -#endif - -#else -#define TX_POWER_TABLE rf_ieee_tx_power_table_empty -#endif - -/* - * Define symbols for both the TX power table and its size. The TX power - * table size is with one less entry by excluding the termination entry. - */ -tx_power_table_t *const rf_tx_power_table = TX_POWER_TABLE; -const size_t rf_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1; -/*---------------------------------------------------------------------------*/ -#endif /* RF_MODE */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/prop-settings.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/prop-settings.c deleted file mode 100644 index 0f098c5e1..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/prop-settings.c +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Parameter summary - * Address: 0 - * Address0: 0xAA - * Address1: 0xBB - * Frequency: 915.00000 MHz - * Data Format: Serial mode disable - * Deviation: 25.000 kHz - * pktLen: 30 - * 802.15.4g Mode: 0 - * Select bit order to transmit PSDU octets:: 1 - * Packet Length Config: Variable - * Max Packet Length: 255 - * Packet Length: 20 - * Packet Data: 255 - * RX Filter BW: 98.0 kHz - * Symbol Rate: 50.00000 kBaud - * Sync Word Length: 24 Bits - * For Default PA: - * Enable high output power PA: false - * TX Power: 13.5 dBm (requires define CCFG_FORCE_VDDR_HH = 1 in ccfg.c, - * see CC13xx/CC26xx Technical Reference Manual) - * For High PA: - * Enable high output power PA: true - * TX Power: 20 dBm (requires define CCFG_FORCE_VDDR_HH = 0 in ccfg.c, - * see CC13xx/CC26xx Technical Reference Manual) - * Whitening: Dynamically IEEE 802.15.4g compatible whitener and 16/32-bit CRC - */ -/*---------------------------------------------------------------------------*/ -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_genfsk.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_mce_genfsk.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "prop-settings.h" -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -RF_Mode rf_prop_mode = -{ - .rfMode = RF_MODE_AUTO, - .cpePatchFxn = &rf_patch_cpe_multi_protocol, - .mcePatchFxn = &rf_patch_mce_genfsk, - .rfePatchFxn = &rf_patch_rfe_genfsk, -}; -/*---------------------------------------------------------------------------*/ -#if defined(DEVICE_CC1312R) || defined(DEVICE_CC1352R) -/* - * CMD_PROP_RADIO_DIV_SETUP must be configured with default TX power value - * in the .txPower field. This depends on whether RF_CONF_TXPOWER_BOOST_MODE - * is configured or not. - */ -#if RF_CONF_TXPOWER_BOOST_MODE -#define DEFAULT_TX_POWER 0x9F3F /* 14 dBm */ -#else -#define DEFAULT_TX_POWER 0xCC14 /* 12.5 dBm (rounded up to 13 dBm) */ -#endif - -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_PROP_RADIO_DIV_SETUP */ -uint32_t rf_prop_overrides[] CC_ALIGN(4) = -{ - /* override_use_patch_prop_genfsk.xml */ - MCE_RFE_OVERRIDE(1,0,0,1,0,0), /* PHY: Use MCE RAM patch, RFE RAM patch */ - /* override_synth_prop_863_930_div5.xml */ - (uint32_t)0x02400403, /* Synth: Use 48 MHz crystal as synth clock, enable extra PLL filtering */ - (uint32_t)0x00068793, /* Synth: Set minimum RTRIM to 6 */ - (uint32_t)0x001C8473, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x00088433, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x000684A3, /* Synth: Set Fref to 4 MHz */ - HW32_ARRAY_OVERRIDE(0x4004,1), /* Synth: Configure faster calibration */ - (uint32_t)0x180C0618, /* Synth: Configure faster calibration */ - (uint32_t)0xC00401A1, /* Synth: Configure faster calibration */ - (uint32_t)0x00010101, /* Synth: Configure faster calibration */ - (uint32_t)0xC0040141, /* Synth: Configure faster calibration */ - (uint32_t)0x00214AD3, /* Synth: Configure faster calibration */ - /* Synth: Decrease synth programming time-out by 90 us from default */ - (uint32_t)0x02980243, /* (0x0298 RAT ticks = 166 us) */ - (uint32_t)0x0A480583, /* Synth: Set loop bandwidth after lock to 20 kHz */ - (uint32_t)0x7AB80603, /* Synth: Set loop bandwidth after lock to 20 kHz */ - (uint32_t)0x00000623, /* Synth: Set loop bandwidth after lock to 20 kHz */ - /* override_phy_tx_pa_ramp_genfsk_hpa.xml */ - ADI_HALFREG_OVERRIDE(0,16,0x8,0x8), /* Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[3]=1) */ - ADI_HALFREG_OVERRIDE(0,17,0x1,0x1), /* Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[4]=1) */ - /* override_phy_rx_frontend_genfsk.xml */ - HW_REG_OVERRIDE(0x609C,0x001A), /* Rx: Set AGC reference level to 0x1A (default: 0x2E) */ - (uint32_t)0x00018883, /* Rx: Set LNA bias current offset to adjust +1 (default: 0) */ - (uint32_t)0x000288A3, /* Rx: Set RSSI offset to adjust reported RSSI by -2 dB (default: 0) */ - /* override_phy_rx_aaf_bw_0xd.xml */ - /* Rx: Set anti-aliasing filter bandwidth to 0xD */ - ADI_HALFREG_OVERRIDE(0,61,0xF,0xD), /* (in ADI0, set IFAMPCTL3[7:4]=0xD) */ -#if RF_CONF_TXPOWER_BOOST_MODE - /* TX power override */ - /* DC/DC regulator: In Tx with 14 dBm PA setting, */ - /* use DCDCCTL5[3:0]=0xF (DITHER_EN=1 and IPEAK=7). */ - (uint32_t)0xFFFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - /* Tx: Set PA trim to max to maximize its output power */ - ADI_REG_OVERRIDE(0,12,0xF8), /* (in ADI0, set PACTL0=0xF8) */ -#else - /* TX power override */ - /* DC/DC regulator: */ - /* In Tx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0xFCFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ -#endif - (uint32_t)0xFFFFFFFF, -}; - -#endif /* defined(DEVICE_CC1312R) || defined(DEVICE_CC1352R) */ -/*---------------------------------------------------------------------------*/ -#if defined(DEVICE_CC1352P) - -#if RF_CONF_TXPOWER_HIGH_PA -/* - * CMD_PROP_RADIO_DIV_SETUP must be configured with default TX power value - * in the .txPower field. For High PA, this must be 0xFFFF. - */ -#define DEFAULT_TX_POWER 0xFFFF /* High PA */ - -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_PROP_RADIO_DIV_SETUP with high PA */ -uint32_t rf_prop_overrides[] CC_ALIGN(4) = -{ - /* override_use_patch_prop_genfsk.xml */ - MCE_RFE_OVERRIDE(1,0,0,1,0,0), /* PHY: Use MCE RAM patch, RFE RAM patch */ - /* override_synth_prop_863_930_div5.xml */ - (uint32_t)0x02400403, /* Synth: Use 48 MHz crystal as synth clock, enable extra PLL filtering */ - (uint32_t)0x00068793, /* Synth: Set minimum RTRIM to 6 */ - (uint32_t)0x001C8473, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x00088433, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x000684A3, /* Synth: Set Fref to 4 MHz */ - HW32_ARRAY_OVERRIDE(0x4004,1), /* Synth: Configure faster calibration */ - (uint32_t)0x180C0618, /* Synth: Configure faster calibration */ - (uint32_t)0xC00401A1, /* Synth: Configure faster calibration */ - (uint32_t)0x00010101, /* Synth: Configure faster calibration */ - (uint32_t)0xC0040141, /* Synth: Configure faster calibration */ - (uint32_t)0x00214AD3, /* Synth: Configure faster calibration */ - /* Synth: Decrease synth programming time-out by 90 us */ - (uint32_t)0x02980243, /* from default (0x0298 RAT ticks = 166 us) */ - (uint32_t)0x0A480583, /* Synth: Set loop bandwidth after lock to 20 kHz */ - (uint32_t)0x7AB80603, /* Synth: Set loop bandwidth after lock to 20 kHz */ - (uint32_t)0x00000623, /* Synth: Set loop bandwidth after lock to 20 kHz */ - /* override_phy_tx_pa_ramp_genfsk_hpa.xml */ - /* Tx: Configure PA ramping, set wait time before turning off */ - HW_REG_OVERRIDE(0x6028,0x002F), /* (0x2F ticks of 16/24 us = 31.3 us). */ - ADI_HALFREG_OVERRIDE(0,16,0x8,0x8), /* Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[3]=1) */ - ADI_HALFREG_OVERRIDE(0,17,0x1,0x1), /* Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[4]=1) */ - /* override_phy_rx_frontend_genfsk.xml */ - HW_REG_OVERRIDE(0x609C,0x001A), /* Rx: Set AGC reference level to 0x1A (default: 0x2E) */ - (uint32_t)0x00018883, /* Rx: Set LNA bias current offset to adjust +1 (default: 0) */ - (uint32_t)0x000288A3, /* Rx: Set RSSI offset to adjust reported RSSI by -2 dB (default: 0) */ - /* override_phy_rx_aaf_bw_0xd.xml */ - /* Rx: Set anti-aliasing filter bandwidth to 0xD */ - ADI_HALFREG_OVERRIDE(0,61,0xF,0xD), /* (in ADI0, set IFAMPCTL3[7:4]=0xD) */ - /* TX power override */ - /* DC/DC regulator: */ - /* In Tx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0xFCFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0x82A86C2B, /* txHighPA=0x20AA1B */ - (uint32_t)0xFFFFFFFF, -}; - -#else -/*---------------------------------------------------------------------------*/ -/* - * CMD_PROP_RADIO_DIV_SETUP must be configured with default TX power value - * in the .txPower field. This depends on whether RF_CONF_TXPOWER_BOOST_MODE - * is configured or not. - */ -#if RF_CONF_TXPOWER_BOOST_MODE -#define DEFAULT_TX_POWER 0x013F /* 13.5 dBm (rounded up to 14 dBm) */ -#else -#define DEFAULT_TX_POWER 0x803F /* 12 dBm */ -#endif - -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_PROP_RADIO_DIV_SETUP with defualt PA */ -uint32_t rf_prop_overrides[] CC_ALIGN(4) = -{ - /* override_use_patch_prop_genfsk.xml */ - MCE_RFE_OVERRIDE(1,0,0,1,0,0), /* PHY: Use MCE RAM patch, RFE RAM patch */ - /* override_synth_prop_863_930_div5.xml */ - (uint32_t)0x02400403, /* Synth: Use 48 MHz crystal as synth clock, enable extra PLL filtering */ - (uint32_t)0x00068793, /* Synth: Set minimum RTRIM to 6 */ - (uint32_t)0x001C8473, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x00088433, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x000684A3, /* Synth: Set Fref to 4 MHz */ - HW32_ARRAY_OVERRIDE(0x4004,1), /* Synth: Configure faster calibration */ - (uint32_t)0x180C0618, /* Synth: Configure faster calibration */ - (uint32_t)0xC00401A1, /* Synth: Configure faster calibration */ - (uint32_t)0x00010101, /* Synth: Configure faster calibration */ - (uint32_t)0xC0040141, /* Synth: Configure faster calibration */ - (uint32_t)0x00214AD3, /* Synth: Configure faster calibration */ - /* Synth: Decrease synth programming time-out by 90 us from default */ - (uint32_t)0x02980243, /* (0x0298 RAT ticks = 166 us) */ - (uint32_t)0x0A480583, /* Synth: Set loop bandwidth after lock to 20 kHz */ - (uint32_t)0x7AB80603, /* Synth: Set loop bandwidth after lock to 20 kHz */ - (uint32_t)0x00000623, /* Synth: Set loop bandwidth after lock to 20 kHz */ - /* override_phy_tx_pa_ramp_genfsk_hpa.xml */ - /* Tx: Configure PA ramping, set wait time before turning off */ - HW_REG_OVERRIDE(0x6028,0x002F), /* (0x2F ticks of 16/24 us = 31.3 us). */ - ADI_HALFREG_OVERRIDE(0,16,0x8,0x8), /* Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[3]=1) */ - ADI_HALFREG_OVERRIDE(0,17,0x1,0x1), /* Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[4]=1) */ - /* override_phy_rx_frontend_genfsk.xml */ - HW_REG_OVERRIDE(0x609C,0x001A), /* Rx: Set AGC reference level to 0x1A (default: 0x2E) */ - (uint32_t)0x00018883, /* Rx: Set LNA bias current offset to adjust +1 (default: 0) */ - (uint32_t)0x000288A3, /* Rx: Set RSSI offset to adjust reported RSSI by -2 dB (default: 0) */ - /* override_phy_rx_aaf_bw_0xd.xml */ - /* Rx: Set anti-aliasing filter bandwidth to 0xD */ - ADI_HALFREG_OVERRIDE(0,61,0xF,0xD), /* (in ADI0, set IFAMPCTL3[7:4]=0xD) */ -#if RF_CONF_TXPOWER_BOOST_MODE - /* TX power override */ - /* DC/DC regulator: In Tx with 14 dBm PA setting, */ - /* use DCDCCTL5[3:0]=0xF (DITHER_EN=1 and IPEAK=7). */ - (uint32_t)0xFFFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - /* Tx: Set PA trim to max to maximize its output power */ - ADI_REG_OVERRIDE(0,12,0xF8), /* (in ADI0, set PACTL0=0xF8) */ -#else - /* TX power override */ - /* DC/DC regulator: */ - /* In Tx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0xFCFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ -#endif - (uint32_t)0xFFFFFFFF, -}; - -#endif /* RF_CONF_TXPOWER_HIGH_PA */ - -#endif /* defined(DEVICE_CC1352P) */ -/*---------------------------------------------------------------------------*/ -/* CMD_PROP_RADIO_DIV_SETUP: Proprietary Mode Radio Setup Command for All Frequency Bands */ -rfc_CMD_PROP_RADIO_DIV_SETUP_t rf_cmd_prop_radio_div_setup = -{ - .commandNo = CMD_PROP_RADIO_DIV_SETUP, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .modulation.modType = 0x1, - .modulation.deviation = 0x64, - .modulation.deviationStepSz = 0x0, - .symbolRate.preScale = 0xF, - .symbolRate.rateWord = 0x8000, - .symbolRate.decimMode = 0x0, - .rxBw = 0x52, - .preamConf.nPreamBytes = 0x7, - .preamConf.preamMode = 0x0, - .formatConf.nSwBits = 0x18, - .formatConf.bBitReversal = 0x0, - .formatConf.bMsbFirst = 0x1, - .formatConf.fecMode = 0x0, - .formatConf.whitenMode = 0x7, - .config.frontEndMode = 0x0, /* set by driver */ - .config.biasMode = 0x0, /* set by driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = DEFAULT_TX_POWER, - .pRegOverride = rf_prop_overrides, - .centerFreq = 0x0393, /* set by driver */ - .intFreq = 0x8000, /* set by driver */ - .loDivider = 0x05, /* set by driver */ -}; -/*---------------------------------------------------------------------------*/ -/* CMD_FS: Frequency Synthesizer Programming Command */ -rfc_CMD_FS_t rf_cmd_prop_fs = -{ - .commandNo = CMD_FS, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .frequency = 0x0393, /* set by driver */ - .fractFreq = 0x0000, /* set by driver */ - .synthConf.bTxMode = 0x0, - .synthConf.refFreq = 0x0, - .__dummy0 = 0x00, - .__dummy1 = 0x00, - .__dummy2 = 0x00, - .__dummy3 = 0x0000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_PROP_TX_ADV: Proprietary Mode Advanced Transmit Command */ -rfc_CMD_PROP_TX_ADV_t rf_cmd_prop_tx_adv = -{ - .commandNo = CMD_PROP_TX_ADV, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .pktConf.bFsOff = 0x0, - .pktConf.bUseCrc = 0x1, - .pktConf.bCrcIncSw = 0x0, - .pktConf.bCrcIncHdr = 0x0, - .numHdrBits = 0x10, - .pktLen = 0x0, /* set by driver */ - .startConf.bExtTxTrig = 0x0, - .startConf.inputMode = 0x0, - .startConf.source = 0x0, - .preTrigger.triggerType = TRIG_REL_START, - .preTrigger.bEnaCmd = 0x0, - .preTrigger.triggerNo = 0x0, - .preTrigger.pastTrig = 0x1, - .preTime = 0x00000000, - .syncWord = 0x0055904E, - .pPkt = 0, /* set by driver */ -}; -/*---------------------------------------------------------------------------*/ -/* CMD_PROP_RX_ADV: Proprietary Mode Advanced Receive Command */ -rfc_CMD_PROP_RX_ADV_t rf_cmd_prop_rx_adv = -{ - .commandNo = CMD_PROP_RX_ADV, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .pktConf.bFsOff = 0x0, - .pktConf.bRepeatOk = 0x1, - .pktConf.bRepeatNok = 0x1, - .pktConf.bUseCrc = 0x1, - .pktConf.bCrcIncSw = 0x0, - .pktConf.bCrcIncHdr = 0x0, - .pktConf.endType = 0x0, - .pktConf.filterOp = 0x1, - .rxConf.bAutoFlushIgnored = 0x1, - .rxConf.bAutoFlushCrcErr = 0x1, - .rxConf.bIncludeHdr = 0x0, - .rxConf.bIncludeCrc = 0x0, - .rxConf.bAppendRssi = 0x1, - .rxConf.bAppendTimestamp = 0x0, - .rxConf.bAppendStatus = 0x1, - .syncWord0 = 0x0055904E, - .syncWord1 = 0x00000000, - .maxPktLen = 0x0, /* set by driver */ - .hdrConf.numHdrBits = 0x10, - .hdrConf.lenPos = 0x0, - .hdrConf.numLenBits = 0x0B, - .addrConf.addrType = 0x0, - .addrConf.addrSize = 0x0, - .addrConf.addrPos = 0x0, - .addrConf.numAddr = 0x0, - .lenOffset = 0xFC, - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, - .pAddr = 0, /* set by driver */ - .pQueue = 0, /* set by driver */ - .pOutput = 0, /* set by driver */ -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/prop-settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/prop-settings.h deleted file mode 100644 index ab13a754a..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/prop-settings.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROP_SETTINGS_H_ -#define PROP_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki-conf.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h) - -#include -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -extern RF_Mode rf_prop_mode; -/*---------------------------------------------------------------------------*/ -/* RF Core API commands */ -extern rfc_CMD_PROP_RADIO_DIV_SETUP_t rf_cmd_prop_radio_div_setup; -extern rfc_CMD_FS_t rf_cmd_prop_fs; -extern rfc_CMD_PROP_TX_ADV_t rf_cmd_prop_tx_adv; -extern rfc_CMD_PROP_RX_ADV_t rf_cmd_prop_rx_adv; -/*---------------------------------------------------------------------------*/ -/* RF Core API Overrides */ -extern uint32_t rf_prop_overrides[]; -/*---------------------------------------------------------------------------*/ -#endif /* PROP_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/prop-tx-power.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/prop-tx-power.c deleted file mode 100644 index 8052ac4fb..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/prop-tx-power.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-tx-power - * @{ - * - * \file - * Source file for TX power tables for CC13x2. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1312R - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_prop_tx_power_table_cc1312r[] = -{ - { -20, RF_TxPowerTable_DEFAULT_PA_ENTRY(0, 3, 0, 2) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY(1, 3, 0, 2) }, - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(2, 3, 0, 4) }, - { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(4, 3, 0, 5) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 7) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(9, 3, 0, 7) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 9) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 9) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 3, 0, 11) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 3, 0, 12) }, - { 6, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 3, 0, 14) }, - { 7, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 2, 0, 16) }, - { 8, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 3, 0, 32) }, - { 9, RF_TxPowerTable_DEFAULT_PA_ENTRY(26, 3, 0, 28) }, - { 10, RF_TxPowerTable_DEFAULT_PA_ENTRY(33, 3, 0, 55) }, - { 11, RF_TxPowerTable_DEFAULT_PA_ENTRY(23, 2, 0, 42) }, - { 12, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 0, 0, 58) }, - /* The original PA value (12.5 dBm) have been rounded to an integer value. */ - { 13, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 0, 0, 102) }, -#if RF_TXPOWER_BOOST_MODE - /* This setting requires RF_TXPOWER_BOOST_MODE = 1. */ - { 14, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 1, 79) }, -#endif - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1352R - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_prop_tx_power_table_cc1352r[] = -{ - { -20, RF_TxPowerTable_DEFAULT_PA_ENTRY(0, 3, 0, 2) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY(1, 3, 0, 2) }, - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(2, 3, 0, 4) }, - { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(4, 3, 0, 5) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 7) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(9, 3, 0, 7) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 9) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 9) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 3, 0, 11) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 3, 0, 12) }, - { 6, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 3, 0, 14) }, - { 7, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 2, 0, 16) }, - { 8, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 3, 0, 32) }, - { 9, RF_TxPowerTable_DEFAULT_PA_ENTRY(26, 3, 0, 28) }, - { 10, RF_TxPowerTable_DEFAULT_PA_ENTRY(33, 3, 0, 55) }, - { 11, RF_TxPowerTable_DEFAULT_PA_ENTRY(23, 2, 0, 42) }, - { 12, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 0, 0, 58) }, - /* The original PA value (12.5 dBm) have been rounded to an integer value. */ - { 13, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 0, 0, 102) }, -#if RF_TXPOWER_BOOST_MODE - /* This setting requires RF_TXPOWER_BOOST_MODE = 1. */ - { 14, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 1, 79) }, -#endif - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1352P with default PA - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_prop_tx_power_table_cc1352p_dpa[] = -{ - { -20, RF_TxPowerTable_DEFAULT_PA_ENTRY( 0, 3, 0, 2) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY( 1, 3, 0, 3) }, - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY( 2, 3, 0, 3) }, - { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY( 4, 3, 0, 6) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 8) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 3, 0, 9) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 9) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 11) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 3, 0, 12) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 3, 0, 14) }, - { 6, RF_TxPowerTable_DEFAULT_PA_ENTRY( 6, 2, 0, 14) }, - { 7, RF_TxPowerTable_DEFAULT_PA_ENTRY( 4, 1, 0, 16) }, - { 8, RF_TxPowerTable_DEFAULT_PA_ENTRY( 6, 1, 0, 19) }, - { 9, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 1, 0, 25) }, - { 10, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 1, 0, 40) }, - { 11, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 0, 0, 71) }, - { 12, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 0, 64) }, -#if RF_TXPOWER_BOOST_MODE - /* - * This setting requires RF_TXPOWER_BOOST_MODE = 1. - * The original PA value (13.5 dBm) have been rounded to an integer value. - */ - { 14, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 1, 0) }, -#endif - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC1352P with high PA - * The RF_TxPowerTable_HIGH_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_HIGH_PA_ENTRY(bias, ibboost, boost, coefficient, ldoTrim) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_prop_tx_power_table_cc1352p_hpa[] = -{ - { 14, RF_TxPowerTable_HIGH_PA_ENTRY( 7, 0, 0, 23, 4) }, - { 15, RF_TxPowerTable_HIGH_PA_ENTRY(10, 0, 0, 26, 4) }, - { 16, RF_TxPowerTable_HIGH_PA_ENTRY(14, 0, 0, 33, 4) }, - { 17, RF_TxPowerTable_HIGH_PA_ENTRY(18, 0, 0, 40, 6) }, - { 18, RF_TxPowerTable_HIGH_PA_ENTRY(24, 0, 0, 51, 8) }, - { 19, RF_TxPowerTable_HIGH_PA_ENTRY(32, 0, 0, 73, 12) }, - { 20, RF_TxPowerTable_HIGH_PA_ENTRY(27, 0, 0, 85, 32) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -tx_power_table_t rf_prop_tx_power_table_empty[] = -{ - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* Only define the symbols if Prop-mode is selected */ -#if (RF_MODE == RF_MODE_SUB_1_GHZ) -/*---------------------------------------------------------------------------*/ -/* TX power table, based on which board is used. */ -#if defined(DEVICE_CC1312R) -#define TX_POWER_TABLE rf_prop_tx_power_table_cc1312r - -#elif defined(DEVICE_CC1352R) -#define TX_POWER_TABLE rf_prop_tx_power_table_cc1352r - -#elif defined(DEVICE_CC1352P) -#if RF_TXPOWER_HIGH_PA -#define TX_POWER_TABLE rf_prop_tx_power_table_cc1352p_hpa -#else -#define TX_POWER_TABLE rf_prop_tx_power_table_cc1352p_dpa -#endif - -#else -#define TX_POWER_TABLE rf_prop_tx_power_table_empty -#endif - -/* - * Define symbols for both the TX power table and its size. The TX power - * table size is with one less entry by excluding the termination entry. - */ -tx_power_table_t *const rf_tx_power_table = TX_POWER_TABLE; -const size_t rf_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1; -/*---------------------------------------------------------------------------*/ -#endif /* RF_MODE */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ble-settings.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ble-settings.c deleted file mode 100644 index 9c19021fd..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ble-settings.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Parameter summary - * Adv. Address: 010203040506 - * Adv. Data: 255 - * BLE Channel: 17 - * Frequency: 2440 MHz - * PDU Payload length:: 30 - * TX Power: 5 dBm - * Whitening: true - */ -/*---------------------------------------------------------------------------*/ -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_ble.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_ble.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "ble-settings.h" -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -RF_Mode rf_ble_mode = -{ - .rfMode = RF_MODE_MULTIPLE, - .cpePatchFxn = &rf_patch_cpe_ble, - .mcePatchFxn = 0, - .rfePatchFxn = &rf_patch_rfe_ble, -}; -/*---------------------------------------------------------------------------*/ -/* - * CMD_RADIO_SETUP must be configured with default TX power value - * in the .txPower field. - */ -#define DEFAULT_TX_POWER 0x9330 /* 5 dBm */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_RADIO_SETUP */ -uint32_t rf_ble_overrides[] CC_ALIGN(4) = -{ - /* override_use_patch_ble_1mbps.xml */ - MCE_RFE_OVERRIDE(0,0,0,1,0,0), /* PHY: Use MCE ROM, RFE RAM patch */ - /* override_synth_ble_1mbps.xml */ - HW_REG_OVERRIDE(0x4038,0x0035), /* Synth: Set recommended RTRIM to 5 */ - (uint32_t)0x000784A3, /* Synth: Set Fref to 3.43 MHz */ - (uint32_t)0xA47E0583, /* Synth: Set loop bandwidth after lock to 80 kHz */ - (uint32_t)0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz */ - (uint32_t)0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz */ - HW32_ARRAY_OVERRIDE(0x405C,1), /* Synth: Configure PLL bias */ - (uint32_t)0x1801F800, /* Synth: Configure PLL bias */ - HW32_ARRAY_OVERRIDE(0x402C,1), /* Synth: Configure PLL latency */ - (uint32_t)0x00608402, /* Synth: Configure PLL latency */ - (uint32_t)0x02010403, /* Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering */ - HW32_ARRAY_OVERRIDE(0x4034,1), /* Synth: Configure extra PLL filtering */ - (uint32_t)0x177F0408, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x38000463, /* Synth: Configure extra PLL filtering */ - /* override_phy_ble_1mbps.xml */ - (uint32_t)0x013800C3, /* Tx: Configure symbol shape for BLE frequency deviation requirements */ - HW_REG_OVERRIDE(0x6088, 0x0045), /* Rx: Configure AGC reference level */ - /* Tx: Configure pilot tone length to ensure stable frequency */ - HW_REG_OVERRIDE(0x52AC, 0x0360), /* before start of packet */ - (uint32_t)0x01AD02A3, /* Tx: Compensate timing offset to match new pilot tone setting */ - (uint32_t)0x01680263, /* Tx: Compensate timing offset to match new pilot tone setting */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_RADIO_SETUP: Radio Setup Command for Pre-Defined Schemes */ -rfc_CMD_RADIO_SETUP_t rf_ble_cmd_radio_setup = -{ - .commandNo = CMD_RADIO_SETUP, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .mode = 0x00, - .__dummy0 = 0x00, - .config.frontEndMode = 0x0, /* set by driver */ - .config.biasMode = 0x0, /* set by driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = DEFAULT_TX_POWER, - .pRegOverride = rf_ble_overrides, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_BLE_ADV_NC: BLE Non-Connectable Advertiser Command */ -rfc_CMD_BLE_ADV_NC_t rf_ble_cmd_ble_adv_nc = -{ - .commandNo = CMD_BLE_ADV_NC, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x1, - .condition.rule = 0x0, /* set by driver */ - .condition.nSkip = 0x0, - .channel = 0x00, /* set by driver */ - .whitening.init = 0x00, /* set by driver */ - .whitening.bOverride = 0x1, - .pParams = 0x00000000, /* set by driver */ - .pOutput = 0x00000000, /* set by driver */ -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ble-settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ble-settings.h deleted file mode 100644 index 0679265d6..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ble-settings.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 BLE_SETTINGS_H_ -#define BLE_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h) - -#include -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -extern RF_Mode rf_ble_mode; -/*---------------------------------------------------------------------------*/ -/* RF Core API commands */ -extern rfc_CMD_RADIO_SETUP_t rf_ble_cmd_radio_setup; -extern rfc_CMD_BLE_ADV_NC_t rf_ble_cmd_ble_adv_nc; -/*---------------------------------------------------------------------------*/ -/* RF Core API Overrides */ -extern uint32_t rf_ble_overrides[]; -/*---------------------------------------------------------------------------*/ -#endif /* BLE_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ble-tx-power.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ble-tx-power.c deleted file mode 100644 index 7510df27a..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ble-tx-power.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-tx-power - * @{ - * - * \file - * Source file for BLE Beacon TX power tables for CC26x0. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC2650 - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ble_tx_power_table_cc2650[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 6) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 6) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 6) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 1, 0, 10) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 1, 12) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(18, 1, 1, 14) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(24, 1, 1, 18) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(33, 1, 1, 24) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 0, 0, 33) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(24, 0, 0, 39) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 0, 0, 45) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(36, 0, 1, 73) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(48, 0, 1, 73) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -tx_power_table_t rf_ble_tx_power_table_empty[] = -{ - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* TX power table, based on which board is used. */ -#if defined(DEVICE_CC2650) -#define TX_POWER_TABLE rf_ble_tx_power_table_cc2650 - -#else -#define TX_POWER_TABLE rf_ble_tx_power_table_empty -#endif - -/* - * Define symbols for both the TX power table and its size. The TX power - * table size is with one less entry by excluding the termination entry. - */ -tx_power_table_t *const ble_tx_power_table = TX_POWER_TABLE; -const size_t ble_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ieee-settings.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ieee-settings.c deleted file mode 100644 index 4d860109d..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ieee-settings.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Parameter summary - * IEEE Channel: 11 - * Frequency: 2405 MHz - * SFD: 0 - * Packet Data: 255 - * Preamble (32 bit): 01010101... - * TX Power: 5 dBm - */ -/*---------------------------------------------------------------------------*/ -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ieee_cmd.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_ieee.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "ieee-settings.h" -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -RF_Mode rf_ieee_mode = -{ - .rfMode = RF_MODE_MULTIPLE, - .cpePatchFxn = &rf_patch_cpe_ieee, - .mcePatchFxn = 0, - .rfePatchFxn = 0, -}; -/*---------------------------------------------------------------------------*/ -/* - * CMD_RADIO_SETUP must be configured with default TX power value - * in the .txPower field. - */ -#define DEFAULT_TX_POWER 0x9330 /* 5 dBm */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_RADIO_SETUP */ -uint32_t rf_ieee_overrides[] CC_ALIGN(4) = -{ - /* override_synth_ieee_15_4.xml */ - HW_REG_OVERRIDE(0x4038,0x0035), /* Synth: Set recommended RTRIM to 5 */ - (uint32_t)0x000784A3, /* Synth: Set Fref to 3.43 MHz */ - (uint32_t)0xA47E0583, /* Synth: Set loop bandwidth after lock to 80 kHz */ - (uint32_t)0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz */ - (uint32_t)0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz */ - HW32_ARRAY_OVERRIDE(0x405C,1), /* Synth: Configure PLL bias */ - (uint32_t)0x1801F800, /* Synth: Configure PLL bias */ - HW32_ARRAY_OVERRIDE(0x402C,1), /* Synth: Configure PLL latency */ - (uint32_t)0x00608402, /* Synth: Configure PLL latency */ - (uint32_t)0x02010403, /* Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering */ - HW32_ARRAY_OVERRIDE(0x4034,1), /* Synth: Configure extra PLL filtering */ - (uint32_t)0x177F0408, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x38000463, /* Synth: Configure extra PLL filtering */ - /* override_phy_ieee_15_4.xml */ - (uint32_t)0x05000243, /* Synth: Increase synth programming timeout */ - (uint32_t)0x002082C3, /* Rx: Adjust Rx FIFO threshold to avoid overflow */ - /* override_frontend_id.xml */ - (uint32_t)0x000288A3, /* Rx: Set RSSI offset to adjust reported RSSI by -2 dB */ - (uint32_t)0x000F8883, /* Rx: Configure LNA bias current trim offset */ - HW_REG_OVERRIDE(0x50DC,0x002B), /* Rx: Adjust AGC DC filter */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_RADIO_SETUP: Radio Setup Command for Pre-Defined Schemes */ -rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup = -{ - .commandNo = CMD_RADIO_SETUP, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .mode = 0x01, - .__dummy0 = 0x00, - .config.frontEndMode = 0x0, /* set by driver */ - .config.biasMode = 0x0, /* set by driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = DEFAULT_TX_POWER, /* 5 dBm default */ - .pRegOverride = rf_ieee_overrides, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_FS: Frequency Synthesizer Programming Command */ -rfc_CMD_FS_t rf_cmd_ieee_fs = -{ - .commandNo = CMD_FS, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .frequency = 0x0965, /* set by driver */ - .fractFreq = 0x0000, /* set by driver */ - .synthConf.bTxMode = 0x1, - .synthConf.refFreq = 0x0, - .__dummy0 = 0x00, - .__dummy1 = 0x00, - .__dummy2 = 0x00, - .__dummy3 = 0x0000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_TX: IEEE 802.15.4 Transmit Command */ -rfc_CMD_IEEE_TX_t rf_cmd_ieee_tx = -{ - .commandNo = CMD_IEEE_TX, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .txOpt.bIncludePhyHdr = 0x0, - .txOpt.bIncludeCrc = 0x0, - .txOpt.payloadLenMsb = 0x0, - .payloadLen = 0x0, /* set by driver */ - .pPayload = 0, /* set by driver */ - .timeStamp = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_RX: IEEE 802.15.4 Receive Command */ -rfc_CMD_IEEE_RX_t rf_cmd_ieee_rx = -{ - .commandNo = CMD_IEEE_RX, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .channel = 0x00, /* set by driver */ - .rxConfig.bAutoFlushCrc = 0x1, - .rxConfig.bAutoFlushIgn = 0x1, - .rxConfig.bIncludePhyHdr = 0x0, - .rxConfig.bIncludeCrc = 0x1, - .rxConfig.bAppendRssi = 0x1, - .rxConfig.bAppendCorrCrc = 0x1, - .rxConfig.bAppendSrcInd = 0x0, - .rxConfig.bAppendTimestamp = 0x1, - .pRxQ = 0, /* set by driver */ - .pOutput = 0, /* set by driver */ - .frameFiltOpt.frameFiltEn = 0x0, /* set by driver */ - .frameFiltOpt.frameFiltStop = 0x1, - .frameFiltOpt.autoAckEn = 0x0, /* set by driver */ - .frameFiltOpt.slottedAckEn = 0x0, - .frameFiltOpt.autoPendEn = 0x0, - .frameFiltOpt.defaultPend = 0x0, - .frameFiltOpt.bPendDataReqOnly = 0x0, - .frameFiltOpt.bPanCoord = 0x0, - .frameFiltOpt.maxFrameVersion = 0x2, - .frameFiltOpt.fcfReservedMask = 0x0, - .frameFiltOpt.modifyFtFilter = 0x0, - .frameFiltOpt.bStrictLenFilter = 0x0, - .frameTypes.bAcceptFt0Beacon = 0x1, - .frameTypes.bAcceptFt1Data = 0x1, - .frameTypes.bAcceptFt2Ack = 0x1, - .frameTypes.bAcceptFt3MacCmd = 0x1, - .frameTypes.bAcceptFt4Reserved = 0x1, - .frameTypes.bAcceptFt5Reserved = 0x1, - .frameTypes.bAcceptFt6Reserved = 0x1, - .frameTypes.bAcceptFt7Reserved = 0x1, - .ccaOpt.ccaEnEnergy = 0x1, - .ccaOpt.ccaEnCorr = 0x1, - .ccaOpt.ccaEnSync = 0x1, - .ccaOpt.ccaCorrOp = 0x1, - .ccaOpt.ccaSyncOp = 0x0, - .ccaOpt.ccaCorrThr = 0x3, - .ccaRssiThr = 0x0, /* set by driver */ - .__dummy0 = 0x00, - .numExtEntries = 0x00, - .numShortEntries = 0x00, - .pExtEntryList = 0, - .pShortEntryList = 0, - .localExtAddr = 0x0, /* set by driver */ - .localShortAddr = 0x0, /* set by driver */ - .localPanID = 0x0000, - .__dummy1 = 0x000000, - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_RX_ACK: IEEE 802.15.4 Receive ACK Command */ -rfc_CMD_IEEE_RX_ACK_t rf_cmd_ieee_rx_ack = -{ - .commandNo = CMD_IEEE_RX_ACK, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .seqNo = 0x0, - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ieee-settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ieee-settings.h deleted file mode 100644 index 7019598c8..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ieee-settings.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 IEEE_SETTINGS_H_ -#define IEEE_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki-conf.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ieee_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ieee_mailbox.h) - -#include -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -extern RF_Mode rf_ieee_mode; -/*---------------------------------------------------------------------------*/ -/* RF Core API commands */ -extern rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup; -extern rfc_CMD_FS_t rf_cmd_ieee_fs; -extern rfc_CMD_IEEE_TX_t rf_cmd_ieee_tx; -extern rfc_CMD_IEEE_RX_t rf_cmd_ieee_rx; -extern rfc_CMD_IEEE_RX_ACK_t rf_cmd_ieee_rx_ack; -/*---------------------------------------------------------------------------*/ -/* RF Core API Overrides */ -extern uint32_t rf_ieee_overrides[]; -/*---------------------------------------------------------------------------*/ -#endif /* IEEE_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ieee-tx-power.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ieee-tx-power.c deleted file mode 100644 index a3a34a860..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x0/ieee-tx-power.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-tx-power - * @{ - * - * \file - * Source file for IEEE-mode TX power tables for CC26x0. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC2650 - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ieee_tx_power_table_cc2650[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 6) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 6) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 6) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 1, 0, 10) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 1, 12) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(18, 1, 1, 14) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(24, 1, 1, 18) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(33, 1, 1, 24) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 0, 0, 33) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(24, 0, 0, 39) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 0, 0, 45) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(36, 0, 1, 73) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(48, 0, 1, 73) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -tx_power_table_t rf_ieee_tx_power_table_empty[] = -{ - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* Only define the symbols if Prop-mode is selected */ -#if (RF_MODE == RF_MODE_2_4_GHZ) -/*---------------------------------------------------------------------------*/ -/* TX power table, based on which board is used. */ -#if defined(DEVICE_CC2650) -#define TX_POWER_TABLE rf_ieee_tx_power_table_cc2650 - -#else -#define TX_POWER_TABLE rf_ieee_tx_power_table_empty -#endif - -/* - * Define symbols for both the TX power table and its size. The TX power - * table size is with one less entry by excluding the termination entry. - */ -tx_power_table_t *const rf_tx_power_table = TX_POWER_TABLE; -const size_t rf_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1; -/*---------------------------------------------------------------------------*/ -#endif /* RF_MODE */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ble-settings.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ble-settings.c deleted file mode 100644 index 21ed73201..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ble-settings.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Parameter summary - * Adv. Address: 010203040506 - * Adv. Data: dummy - * BLE Channel: 17 - * Extended Header: 09 09 010203040506 babe - * Frequency: 2440 MHz - * PDU Payload length:: 30 - * TX Power: 5 dBm - * Whitening: true - */ -/*---------------------------------------------------------------------------*/ -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_bt5.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_mce_bt5.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "ble-settings.h" -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -RF_Mode rf_ble_mode = -{ - .rfMode = RF_MODE_AUTO, - .cpePatchFxn = &rf_patch_cpe_multi_protocol, - .mcePatchFxn = &rf_patch_mce_bt5, - .rfePatchFxn = &rf_patch_rfe_bt5, -}; -/*---------------------------------------------------------------------------*/ -/* - * CMD_RADIO_SETUP must be configured with default TX power value - * in the .txPower field. - */ -#define DEFAULT_TX_POWER 0x941E /* 5 dBm */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_BLE5_RADIO_SETUP */ -uint32_t rf_ble_overrides_common[] CC_ALIGN(4) = -{ - /* override_ble5_setup_override_common.xml */ - (uint32_t)0x02400403, /* Synth: Use 48 MHz crystal, enable extra PLL filtering */ - (uint32_t)0x001C8473, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x00088433, /* Synth: Configure synth hardware */ - (uint32_t)0x00038793, /* Synth: Set minimum RTRIM to 3 */ - HW32_ARRAY_OVERRIDE(0x4004,1), /* Synth: Configure faster calibration */ - (uint32_t)0x1C0C0618, /* Synth: Configure faster calibration */ - (uint32_t)0xC00401A1, /* Synth: Configure faster calibration */ - (uint32_t)0x00010101, /* Synth: Configure faster calibration */ - (uint32_t)0xC0040141, /* Synth: Configure faster calibration */ - (uint32_t)0x00214AD3, /* Synth: Configure faster calibration */ - (uint32_t)0x02980243, /* Synth: Decrease synth programming time-out (0x0298 RAT ticks = 166 us) */ - /* DC/DC regulator: */ - /* In Tx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0xFCFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0x00038883, /* Rx: Set LNA bias current offset to adjust +3 (default: 0) */ - (uint32_t)0x000288A3, /* Rx: Set RSSI offset to adjust reported RSSI by -2 dB (default: 0) */ - (uint32_t)0x01080263, /* Bluetooth 5: Compensate for reduced pilot tone length */ - (uint32_t)0x08E90AA3, /* Bluetooth 5: Compensate for reduced pilot tone length */ - (uint32_t)0x00068BA3, /* Bluetooth 5: Compensate for reduced pilot tone length */ - /* Bluetooth 5: Set correct total clock accuracy for received AuxPtr */ - (uint32_t)0x0E490C83, /* assuming local sleep clock of 50 ppm */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_BLE5_RADIO_SETUP */ -uint32_t rf_ble_overrides_1mbps[] CC_ALIGN(4) = -{ - /* override_ble5_setup_override_1mbps.xml */ - MCE_RFE_OVERRIDE(1,0,0,1,0,0), /* PHY: Use MCE RAM patch (mode 0), RFE RAM patch (mode 0) */ - HW_REG_OVERRIDE(0x5320,0x0240), /* Bluetooth 5: Reduce pilot tone length */ - (uint32_t)0x013302A3, /* Bluetooth 5: Compensate for reduced pilot tone length */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_BLE5_RADIO_SETUP */ -uint32_t rf_ble_overrides_2mbps[] CC_ALIGN(4) = -{ - /* override_ble5_setup_override_2mbps.xml */ - MCE_RFE_OVERRIDE(1,0,2,1,0,2), /* PHY: Use MCE RAM patch (mode 2), RFE RAM patch (mode 2) */ - HW_REG_OVERRIDE(0x5320,0x0240), /* Bluetooth 5: Reduce pilot tone length */ - (uint32_t)0x00D102A3, /* Bluetooth 5: Compensate for reduced pilot tone length */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_BLE5_RADIO_SETUP */ -uint32_t rf_ble_overrides_coded[] CC_ALIGN(4) = -{ - /* override_ble5_setup_override_coded.xml */ - MCE_RFE_OVERRIDE(1,0,1,1,0,1), /* PHY: Use MCE RAM patch (mode 1), RFE RAM patch (mode 1) */ - HW_REG_OVERRIDE(0x5320,0x0240), /* Bluetooth 5: Reduce pilot tone length */ - (uint32_t)0x078902A3, /* Bluetooth 5: Compensate for reduced pilot tone length */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_BLE5_RADIO_SETUP: Bluetooth 5 Radio Setup Command for all PHYs */ -rfc_CMD_BLE5_RADIO_SETUP_t rf_ble_cmd_radio_setup = -{ - .commandNo = CMD_BLE5_RADIO_SETUP, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .defaultPhy.mainMode = 0x0, - .defaultPhy.coding = 0x0, - .loDivider = 0x00, - .config.frontEndMode = 0x0, /* set by driver */ - .config.biasMode = 0x0, /* set by driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = DEFAULT_TX_POWER, - .pRegOverrideCommon = rf_ble_overrides_common, - .pRegOverride1Mbps = rf_ble_overrides_1mbps, - .pRegOverride2Mbps = rf_ble_overrides_2mbps, - .pRegOverrideCoded = rf_ble_overrides_coded, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_BLE5_ADV_NC: Bluetooth 5 Non-Connectable Advertiser Command */ -rfc_CMD_BLE5_ADV_NC_t rf_ble_cmd_ble_adv_nc = -{ - .commandNo = CMD_BLE5_ADV_NC, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x1, - .condition.rule = 0x0, /* set by driver */ - .condition.nSkip = 0x0, - .channel = 0x00, /* set by driver */ - .whitening.init = 0x00, /* set by driver */ - .whitening.bOverride = 0x1, - .phyMode.mainMode = 0x0, - .phyMode.coding = 0x0, - .rangeDelay = 0x00, - .txPower = 0x0000, - .pParams = 0x00000000, /* set by driver */ - .pOutput = 0x00000000, /* set by driver */ - .tx20Power = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ble-settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ble-settings.h deleted file mode 100644 index c5295c868..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ble-settings.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 BLE_SETTINGS_H_ -#define BLE_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h) - -#include -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -extern RF_Mode rf_ble_mode; -/*---------------------------------------------------------------------------*/ -/* RF Core API commands */ -extern rfc_CMD_BLE5_RADIO_SETUP_t rf_ble_cmd_radio_setup; -extern rfc_CMD_BLE5_ADV_NC_t rf_ble_cmd_ble_adv_nc; -/*---------------------------------------------------------------------------*/ -/* RF Core API Overrides */ -extern uint32_t rf_ble_overrides_common[]; -extern uint32_t rf_ble_overrides_1mbps[]; -extern uint32_t rf_ble_overrides_2mbps[]; -extern uint32_t rf_ble_overrides_coded[]; -/*---------------------------------------------------------------------------*/ -#endif /* BLE_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ble-tx-power.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ble-tx-power.c deleted file mode 100644 index 368c19637..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ble-tx-power.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-tx-power - * @{ - * - * \file - * Source file for BLE Beacon TX power tables for CC26x2. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC2652R - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ble_tx_power_table_cc2652r[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 3) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 3) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 2, 0, 6) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 2, 0, 8) }, - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 2, 0, 11) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 2, 0, 5) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 1, 0, 16) }, - { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 0, 17) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 1, 0, 20) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 26) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 1, 0, 28) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 0, 0, 34) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 0, 0, 42) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 0, 0, 54) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(30, 0, 0, 74) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -tx_power_table_t rf_ble_tx_power_table_empty[] = -{ - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* TX power table, based on which board is used. */ -#if defined(DEVICE_CC2652R) -#define TX_POWER_TABLE rf_ble_tx_power_table_cc2652r - -#else -#define TX_POWER_TABLE rf_ble_tx_power_table_empty -#endif - -/* - * Define symbols for both the TX power table and its size. The TX power - * table size is with one less entry by excluding the termination entry. - */ -tx_power_table_t *const ble_tx_power_table = TX_POWER_TABLE; -const size_t ble_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ieee-settings.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ieee-settings.c deleted file mode 100644 index d95ff87ba..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ieee-settings.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Parameter summary - * IEEE Channel: 11 - * Frequency: 2405 MHz - * SFD: 0 - * Packet Data: 255 - * Preamble (32 bit): 01010101... - * TX Power: 5 dBm - */ -/*---------------------------------------------------------------------------*/ -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ieee_cmd.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h) -#include DeviceFamily_constructPath(rf_patches/rf_patch_mce_ieee_802_15_4.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "ieee-settings.h" -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -RF_Mode rf_ieee_mode = -{ - .rfMode = RF_MODE_AUTO, - .cpePatchFxn = &rf_patch_cpe_multi_protocol, - .mcePatchFxn = &rf_patch_mce_ieee_802_15_4, - .rfePatchFxn = 0, -}; -/*---------------------------------------------------------------------------*/ -/* - * CMD_RADIO_SETUP must be configured with default TX power value - * in the .txPower field. - */ -#define DEFAULT_TX_POWER 0x941E /* 5 dBm */ -/*---------------------------------------------------------------------------*/ -/* Overrides for CMD_RADIO_SETUP */ -uint32_t rf_ieee_overrides[] CC_ALIGN(4) = -{ - /* override_ieee_802_15_4.xml */ - MCE_RFE_OVERRIDE(1,0,0,0,1,0), /* PHY: Use MCE RAM patch, RFE ROM bank 1 */ - (uint32_t)0x02400403, /* Synth: Use 48 MHz crystal, enable extra PLL filtering */ - (uint32_t)0x001C8473, /* Synth: Configure extra PLL filtering */ - (uint32_t)0x00088433, /* Synth: Configure synth hardware */ - (uint32_t)0x00038793, /* Synth: Set minimum RTRIM to 3 */ - HW32_ARRAY_OVERRIDE(0x4004,1), /* Synth: Configure faster calibration */ - (uint32_t)0x1C0C0618, /* Synth: Configure faster calibration */ - (uint32_t)0xC00401A1, /* Synth: Configure faster calibration */ - (uint32_t)0x00010101, /* Synth: Configure faster calibration */ - (uint32_t)0xC0040141, /* Synth: Configure faster calibration */ - (uint32_t)0x00214AD3, /* Synth: Configure faster calibration */ - (uint32_t)0x02980243, /* Synth: Decrease synth programming time-out (0x0298 RAT ticks = 166 us) */ - /* DC/DC regulator: */ - /* In Tx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0xFCFC08C3, /* In Rx, use DCDCCTL5[3:0]=0xC (DITHER_EN=1 and IPEAK=4). */ - (uint32_t)0x000F8883, /* Rx: Set LNA bias current offset to +15 to saturate trim to max (default: 0) */ - (uint32_t)0xFFFFFFFF, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_RADIO_SETUP: Radio Setup Command for Pre-Defined Schemes */ -rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup = -{ - .commandNo = CMD_RADIO_SETUP, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .mode = 0x01, - .loDivider = 0x00, - .config.frontEndMode = 0x0, /* set by driver */ - .config.biasMode = 0x0, /* set by driver */ - .config.analogCfgMode = 0x0, - .config.bNoFsPowerUp = 0x0, - .txPower = DEFAULT_TX_POWER, - .pRegOverride = rf_ieee_overrides, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_FS: Frequency Synthesizer Programming Command */ -rfc_CMD_FS_t rf_cmd_ieee_fs = -{ - .commandNo = CMD_FS, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .frequency = 0x0965, /* set by driver */ - .fractFreq = 0x0000, /* set by driver */ - .synthConf.bTxMode = 0x1, - .synthConf.refFreq = 0x0, - .__dummy0 = 0x00, - .__dummy1 = 0x00, - .__dummy2 = 0x00, - .__dummy3 = 0x0000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_TX: IEEE 802.15.4 Transmit Command */ -rfc_CMD_IEEE_TX_t rf_cmd_ieee_tx = -{ - .commandNo = CMD_IEEE_TX, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .txOpt.bIncludePhyHdr = 0x0, - .txOpt.bIncludeCrc = 0x0, - .txOpt.payloadLenMsb = 0x0, - .payloadLen = 0x0, /* set by driver */ - .pPayload = 0, /* set by driver */ - .timeStamp = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_RX: IEEE 802.15.4 Receive Command */ -rfc_CMD_IEEE_RX_t rf_cmd_ieee_rx = -{ - .commandNo = CMD_IEEE_RX, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .channel = 0x00, /* set by driver */ - .rxConfig.bAutoFlushCrc = 0x1, - .rxConfig.bAutoFlushIgn = 0x1, - .rxConfig.bIncludePhyHdr = 0x0, - .rxConfig.bIncludeCrc = 0x1, - .rxConfig.bAppendRssi = 0x1, - .rxConfig.bAppendCorrCrc = 0x1, - .rxConfig.bAppendSrcInd = 0x0, - .rxConfig.bAppendTimestamp = 0x1, - .pRxQ = 0, /* set by driver */ - .pOutput = 0, /* set by driver */ - .frameFiltOpt.frameFiltEn = 0x0, /* set by driver */ - .frameFiltOpt.frameFiltStop = 0x1, - .frameFiltOpt.autoAckEn = 0x0, /* set by driver */ - .frameFiltOpt.slottedAckEn = 0x0, - .frameFiltOpt.autoPendEn = 0x0, - .frameFiltOpt.defaultPend = 0x0, - .frameFiltOpt.bPendDataReqOnly = 0x0, - .frameFiltOpt.bPanCoord = 0x0, - .frameFiltOpt.maxFrameVersion = 0x2, - .frameFiltOpt.fcfReservedMask = 0x0, - .frameFiltOpt.modifyFtFilter = 0x0, - .frameFiltOpt.bStrictLenFilter = 0x0, - .frameTypes.bAcceptFt0Beacon = 0x1, - .frameTypes.bAcceptFt1Data = 0x1, - .frameTypes.bAcceptFt2Ack = 0x1, - .frameTypes.bAcceptFt3MacCmd = 0x1, - .frameTypes.bAcceptFt4Reserved = 0x1, - .frameTypes.bAcceptFt5Reserved = 0x1, - .frameTypes.bAcceptFt6Reserved = 0x1, - .frameTypes.bAcceptFt7Reserved = 0x1, - .ccaOpt.ccaEnEnergy = 0x1, - .ccaOpt.ccaEnCorr = 0x1, - .ccaOpt.ccaEnSync = 0x1, - .ccaOpt.ccaCorrOp = 0x1, - .ccaOpt.ccaSyncOp = 0x0, - .ccaOpt.ccaCorrThr = 0x3, - .ccaRssiThr = 0x0, /* set by driver */ - .__dummy0 = 0x00, - .numExtEntries = 0x00, - .numShortEntries = 0x00, - .pExtEntryList = 0, - .pShortEntryList = 0, - .localExtAddr = 0x0, /* set by driver */ - .localShortAddr = 0x0, /* set by driver */ - .localPanID = 0x0000, - .__dummy1 = 0x000000, - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ -/* CMD_IEEE_RX_ACK: IEEE 802.15.4 Receive ACK Command */ -rfc_CMD_IEEE_RX_ACK_t rf_cmd_ieee_rx_ack = -{ - .commandNo = CMD_IEEE_RX_ACK, - .status = IDLE, - .pNextOp = 0, - .startTime = 0x00000000, - .startTrigger.triggerType = TRIG_NOW, - .startTrigger.bEnaCmd = 0x0, - .startTrigger.triggerNo = 0x0, - .startTrigger.pastTrig = 0x0, - .condition.rule = COND_NEVER, - .condition.nSkip = 0x0, - .seqNo = 0x0, - .endTrigger.triggerType = TRIG_NEVER, - .endTrigger.bEnaCmd = 0x0, - .endTrigger.triggerNo = 0x0, - .endTrigger.pastTrig = 0x0, - .endTime = 0x00000000, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ieee-settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ieee-settings.h deleted file mode 100644 index 141a0e4b3..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ieee-settings.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 IEEE_SETTINGS_H_ -#define IEEE_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki-conf.h" - -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ieee_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_ieee_mailbox.h) - -#include -/*---------------------------------------------------------------------------*/ -/* TI-RTOS RF Mode Object */ -extern RF_Mode rf_ieee_mode; -/*---------------------------------------------------------------------------*/ -/* RF Core API commands */ -extern rfc_CMD_RADIO_SETUP_t rf_cmd_ieee_radio_setup; -extern rfc_CMD_FS_t rf_cmd_ieee_fs; -extern rfc_CMD_IEEE_TX_t rf_cmd_ieee_tx; -extern rfc_CMD_IEEE_RX_t rf_cmd_ieee_rx; -extern rfc_CMD_IEEE_RX_ACK_t rf_cmd_ieee_rx_ack; -/*---------------------------------------------------------------------------*/ -/* RF Core API Overrides */ -extern uint32_t rf_ieee_overrides[]; -/*---------------------------------------------------------------------------*/ -#endif /* IEEE_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ - diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ieee-tx-power.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ieee-tx-power.c deleted file mode 100644 index fcf353209..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc26x2/ieee-tx-power.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-tx-power - * @{ - * - * \file - * Source file for IEEE-mode TX power tables for CC26x2. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -/* - * TX Power table for CC2652R - * The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments: - * RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient) - * See the Technical Reference Manual for further details about the "txPower" Command field. - * The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. - */ -tx_power_table_t rf_ieee_tx_power_table_cc2652r[] = -{ - { -21, RF_TxPowerTable_DEFAULT_PA_ENTRY(7, 3, 0, 3) }, - { -18, RF_TxPowerTable_DEFAULT_PA_ENTRY(9, 3, 0, 3) }, - { -15, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 2, 0, 100) }, - { -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(40, 2, 0, 8) }, - { -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 2, 0, 11) }, - { -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 2, 0, 5) }, - { -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 1, 0, 16) }, - { -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 0, 17) }, - { -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 1, 0, 20) }, - { 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 26) }, - { 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 1, 0, 28) }, - { 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 0, 0, 34) }, - { 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 0, 0, 42) }, - { 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 0, 0, 54) }, - { 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(30, 0, 0, 74) }, - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -tx_power_table_t rf_ieee_tx_power_table_empty[] = -{ - RF_TxPowerTable_TERMINATION_ENTRY -}; -/*---------------------------------------------------------------------------*/ -/* Only define the symbols if Prop-mode is selected */ -#if (RF_MODE == RF_MODE_2_4_GHZ) -/*---------------------------------------------------------------------------*/ -/* TX power table, based on which board is used. */ -#if defined(DEVICE_CC2652R) -#define TX_POWER_TABLE rf_ieee_tx_power_table_cc2652r - -#else -#define TX_POWER_TABLE rf_ieee_tx_power_table_empty -#endif - -/* - * Define symbols for both the TX power table and its size. The TX power - * table size is with one less entry by excluding the termination entry. - */ -tx_power_table_t *const rf_tx_power_table = TX_POWER_TABLE; -const size_t rf_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1; -/*---------------------------------------------------------------------------*/ -#endif /* RF_MODE */ -/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-addr.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-addr.c deleted file mode 100644 index 7a445a229..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-addr.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2016, Michael Spoerk - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-ble-addr - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx IEEE addresses driver. - * \author - * Michael Spoerk - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/ble-hal.h" -#include "net/linkaddr.h" - -#include "rf/ble-addr.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(inc/hw_memmap.h) -#include DeviceFamily_constructPath(inc/hw_fcfg1.h) -#include DeviceFamily_constructPath(inc/hw_ccfg.h) -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#define BLE_MAC_PRIMARY_ADDRESS (FCFG1_BASE + FCFG1_O_MAC_BLE_0) -#define BLE_MAC_SECONDARY_ADDRESS (CCFG_BASE + CCFG_O_IEEE_BLE_0) -/*---------------------------------------------------------------------------*/ -uint8_t * -ble_addr_ptr(void) -{ - volatile const uint8_t *const primary = (uint8_t *)BLE_MAC_PRIMARY_ADDRESS; - volatile const uint8_t *const secondary = (uint8_t *)BLE_MAC_SECONDARY_ADDRESS; - - /* - * Reading from primary location... - * ...unless we can find a byte != 0xFF in secondary - * - * Intentionally checking all bytes here instead of len, because we - * are checking validity of the entire address irrespective of the - * actual number of bytes the caller wants to copy over. - */ - size_t i; - for(i = 0; i < BLE_ADDR_SIZE; i++) { - if(secondary[i] != 0xFF) { - /* A byte in secondary is not 0xFF. Use secondary address. */ - return (uint8_t *)secondary; - } - } - - /* All bytes in secondary is 0xFF. Use primary address. */ - return (uint8_t *)primary; -} -/*---------------------------------------------------------------------------*/ -int -ble_addr_be_cpy(uint8_t *dst) -{ - if(!dst) { - return -1; - } - - volatile const uint8_t *const ble_addr = ble_addr_ptr(); - - /* - * We have chosen what address to read the BLE address from. Do so, - * inverting byte order - */ - size_t i; - for(i = 0; i < BLE_ADDR_SIZE; i++) { - dst[i] = ble_addr[BLE_ADDR_SIZE - 1 - i]; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -ble_addr_le_cpy(uint8_t *dst) -{ - if(!dst) { - return -1; - } - - volatile const uint8_t *const ble_addr = ble_addr_ptr(); - - size_t i; - for(i = 0; i < BLE_ADDR_SIZE; i++) { - dst[i] = ble_addr[i]; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -ble_addr_to_eui64(uint8_t *dst, uint8_t *src) -{ - if(!dst || !src) { - return -1; - } - - memcpy(dst, src, 3); - dst[3] = 0xFF; - dst[4] = 0xFE; - memcpy(&dst[5], &src[3], 3); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -ble_addr_to_eui64_cpy(uint8_t *dst) -{ - if(!dst) { - return -1; - } - - int res; - uint8_t ble_addr[BLE_ADDR_SIZE]; - - res = ble_addr_le_cpy(ble_addr); - if(res) { - return -1; - } - - return ble_addr_to_eui64(dst, ble_addr); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-addr.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-addr.h deleted file mode 100644 index effc95d22..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-addr.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2016, Michael Spoerk - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf - * @{ - * - * \defgroup cc13xx-cc26xx-rf-ble-addr Driver for CC13xx/CC26xx BLE addresses - * - * @{ - * - * \file - * Header file for the CC13xx/CC26xx BLE address driver. - * \author - * Michael Spoerk - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef BLE_ADDR_H_ -#define BLE_ADDR_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Retrieve the pointer to where the BLE address is stored. - * - * This function will return the primary address from info page, unless a - * valid address is found in the secondary address from CCFG. - */ -uint8_t *ble_addr_ptr(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Copy the node's factory BLE address to a destination memory area - * in big-endian (be) order. - * \param dst A pointer to the destination area where the BLE address is to be - * written - * \return 0 : Returned successfully - * -1 : Returned with error - * - * This function will copy 6 bytes and it will invert byte order in - * the process. The factory address on devices is normally little-endian, - * therefore you should expect dst to store the address in a big-endian order. - */ -int ble_addr_be_cpy(uint8_t *dst); -/*---------------------------------------------------------------------------*/ -/** - * \brief Copy the node's factory BLE address to a destination memory area - * in little-endian (le) order. - * \param dst A pointer to the destination area where the BLE address is to be - * written - * \return 0 : Returned successfully - * -1 : Returned with error - * - * This function will copy 6 bytes, but will **not** invert the byte order. - * This is usefull for the RF core which assumes the BLE MAC address in - * little-endian order. - */ -int ble_addr_le_cpy(uint8_t *dst); -/*---------------------------------------------------------------------------*/ -/** - * \brief Copy the node's BLE address to a destination memory area and converts - * it into a EUI64 address in the process - * \param dst A pointer to the destination area where the EUI64 address is to be - * written - * \param src A pointer to the BLE address that is to be copied - * \return 0 : Returned successfully - * -1 : Returned with error - */ -int ble_addr_to_eui64(uint8_t *dst, uint8_t *src); -/*---------------------------------------------------------------------------*/ -/** - * \brief Copy the node's EUI64 address that is based on its factory BLE address - * to a destination memory area - * \param dst A pointer to the destination area where the EUI64 address is to be - * written - * \return 0 : Returned successfully - * -1 : Returned with error - */ -int ble_addr_to_eui64_cpy(uint8_t *dst); -/*---------------------------------------------------------------------------*/ -#endif /* BLE_ADDR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ \ No newline at end of file diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-beacond.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-beacond.c deleted file mode 100644 index 2e8d9d4bc..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-beacond.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-ble - * @{ - * - * \file - * Implementation for the CC13xx/CC26xx BLE Beacon Daemon. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/cc.h" -#include "sys/clock.h" -#include "sys/etimer.h" -#include "sys/process.h" -#include "net/linkaddr.h" -#include "net/netstack.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/chipinfo.h) -#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -#include "rf/sched.h" -#include "rf/ble-addr.h" -#include "rf/ble-beacond.h" -#include "rf/tx-power.h" -#include "rf/settings.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Radio" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -#if RF_CONF_BLE_BEACON_ENABLE -/*---------------------------------------------------------------------------*/ -/* Maximum BLE advertisement size. Not to be changed by the user. */ -#define BLE_ADV_MAX_SIZE 31 -/*---------------------------------------------------------------------------*/ -/* - * BLE Intervals: Send a burst of advertisements every BLE_ADV_INTERVAL - * specified in milliseconds. - */ -#define BLE_ADV_INTERVAL ((100 * CLOCK_SECOND) / 1000) - -/* GAP Advertisement data types */ -#define BLE_ADV_TYPE_FLAGS 0x01 -#define BLE_ADV_TYPE_16BIT_MORE 0x02 -#define BLE_ADV_TYPE_16BIT_COMPLETE 0x03 -#define BLE_ADV_TYPE_32BIT_MORE 0x04 -#define BLE_ADV_TYPE_32BIT_COMPLETE 0x05 -#define BLE_ADV_TYPE_128BIT_MORE 0x06 -#define BLE_ADV_TYPE_128BIT_COMPLETE 0x07 -#define BLE_ADV_TYPE_LOCAL_NAME_SHORT 0x08 -#define BLE_ADV_TYPE_LOCAL_NAME_COMPLETE 0x09 -#define BLE_ADV_TYPE_POWER_LEVEL 0x0A -#define BLE_ADV_TYPE_OOB_CLASS_OF_DEVICE 0x0D -#define BLE_ADV_TYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E -#define BLE_ADV_TYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F -#define BLE_ADV_TYPE_SM_TK 0x10 -#define BLE_ADV_TYPE_SM_OOB_FLAG 0x11 -#define BLE_ADV_TYPE_SLAVE_CONN_INTERVAL_RANGE 0x12 -#define BLE_ADV_TYPE_SIGNED_DATA 0x13 -#define BLE_ADV_TYPE_SERVICE_LIST_16BIT 0x14 -#define BLE_ADV_TYPE_SERVICE_LIST_128BIT 0x15 -#define BLE_ADV_TYPE_SERVICE_DATA 0x16 -#define BLE_ADV_TYPE_PUBLIC_TARGET_ADDR 0x17 -#define BLE_ADV_TYPE_RANDOM_TARGET_ADDR 0x18 -#define BLE_ADV_TYPE_APPEARANCE 0x19 -#define BLE_ADV_TYPE_ADV_INTERVAL 0x1A -#define BLE_ADV_TYPE_LE_BD_ADDR 0x1B -#define BLE_ADV_TYPE_LE_ROLE 0x1C -#define BLE_ADV_TYPE_SIMPLE_PAIRING_HASHC_256 0x1D -#define BLE_ADV_TYPE_SIMPLE_PAIRING_RANDR_256 0x1E -#define BLE_ADV_TYPE_SERVICE_DATA_32BIT 0x20 -#define BLE_ADV_TYPE_SERVICE_DATA_128BIT 0x21 -#define BLE_ADV_TYPE_3D_INFO_DATA 0x3D -#define BLE_ADV_TYPE_MANUFACTURER_SPECIFIC 0xFF - -/* GAP Advertisement data type flags */ - -/* Discovery Mode: LE Limited Discoverable Mode */ -#define BLE_ADV_TYPE_FLAGS_LIMITED 0x01 -/* Discovery Mode: LE General Discoverable Mode */ -#define BLE_ADV_TYPE_FLAGS_GENERAL 0x02 -/* Discovery Mode: BR/EDR Not Supported */ -#define BLE_ADV_TYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04 - -#define BLE_ADV_NAME_BUF_LEN BLE_ADV_MAX_SIZE -#define BLE_ADV_PAYLOAD_BUF_LEN 64 -#define BLE_UUID_SIZE 16 -/*---------------------------------------------------------------------------*/ -typedef struct { - /* Outgoing frame buffer */ - uint8_t tx_buf[BLE_ADV_PAYLOAD_BUF_LEN] CC_ALIGN(4); - - /* Config data */ - size_t adv_name_len; - char adv_name[BLE_ADV_NAME_BUF_LEN]; - - /* Indicates whether deamon is active or not */ - bool is_active; - - /* Periodic timer for sending out BLE advertisements */ - clock_time_t ble_adv_interval; - struct etimer ble_adv_et; - - /* RF driver */ - RF_Handle rf_handle; - - /* BLE command specific structures. Common accross BLE and BLE5. */ - uint8_t ble_mac_addr[6]; - rfc_bleAdvPar_t ble_adv_par; - rfc_bleAdvOutput_t ble_adv_output; -} ble_beacond_t; - -static ble_beacond_t ble_beacond; -/*---------------------------------------------------------------------------*/ -PROCESS(ble_beacond_process, "RF BLE Beacon Daemon Process"); -/*---------------------------------------------------------------------------*/ -rf_ble_beacond_result_t -rf_ble_beacond_init(void) -{ - ble_cmd_radio_setup.config.frontEndMode = RF_2_4_GHZ_FRONT_END_MODE; - ble_cmd_radio_setup.config.biasMode = RF_2_4_GHZ_BIAS_MODE; - - RF_Params rf_params; - RF_Params_init(&rf_params); - - rf_params.nInactivityTimeout = RF_CONF_INACTIVITY_TIMEOUT; - - ble_beacond.rf_handle = ble_open(&rf_params); - - if(ble_beacond.rf_handle == NULL) { - return RF_BLE_BEACOND_ERROR; - } - - /* - * It is important that the contents of the BLE MAC address is copied into - * RAM, as the System CPU, and subsequently flash, goes idle when pending - * on an RF command. This causes pend to hang forever. - */ - ble_addr_le_cpy(ble_beacond.ble_mac_addr); - ble_beacond.ble_adv_par.pDeviceAddress = (uint16_t *)ble_beacond.ble_mac_addr; - ble_beacond.ble_adv_par.endTrigger.triggerType = TRIG_NEVER; - - rf_ble_cmd_ble_adv_nc.pParams = &ble_beacond.ble_adv_par; - rf_ble_cmd_ble_adv_nc.pOutput = &ble_beacond.ble_adv_output; - - return RF_BLE_BEACOND_OK; -} -/*---------------------------------------------------------------------------*/ -rf_ble_beacond_result_t -rf_ble_beacond_config(clock_time_t interval, const char *name) -{ - rf_ble_beacond_result_t res; - - res = RF_BLE_BEACOND_ERROR; - - if(interval > 0) { - ble_beacond.ble_adv_interval = interval; - - res = RF_BLE_BEACOND_OK; - } else { - ble_beacond.ble_adv_interval = BLE_ADV_INTERVAL; - } - - if(name != NULL) { - const size_t name_len = strlen(name); - - if((0 < name_len) && (name_len < BLE_ADV_NAME_BUF_LEN)) { - ble_beacond.adv_name_len = name_len; - memcpy(ble_beacond.adv_name, name, name_len); - - res = RF_BLE_BEACOND_OK; - } - } - - return res; -} -/*---------------------------------------------------------------------------*/ -rf_ble_beacond_result_t -rf_ble_beacond_start(void) -{ - if(ble_beacond.is_active) { - return RF_BLE_BEACOND_OK; - } - - ble_beacond.is_active = true; - - process_start(&ble_beacond_process, NULL); - - return RF_BLE_BEACOND_OK; -} -/*---------------------------------------------------------------------------*/ -rf_ble_beacond_result_t -rf_ble_beacond_stop(void) -{ - if(!ble_beacond.is_active) { - return RF_BLE_BEACOND_OK; - } - - ble_beacond.is_active = false; - - process_exit(&ble_beacond_process); - - return RF_BLE_BEACOND_OK; -} -/*---------------------------------------------------------------------------*/ -int8_t -rf_ble_is_active(void) -{ - return (int8_t)ble_beacond.is_active; -} -/*---------------------------------------------------------------------------*/ -rf_ble_beacond_result_t -rf_ble_set_tx_power(int8_t dbm) -{ - rf_result_t res; - - if(!tx_power_in_range(dbm, ble_tx_power_table, ble_tx_power_table_size)) { - return RADIO_RESULT_INVALID_VALUE; - } - - res = rf_set_tx_power(ble_beacond.rf_handle, ble_tx_power_table, dbm); - - return (res == RF_RESULT_OK) - ? RF_BLE_BEACOND_OK - : RF_BLE_BEACOND_ERROR; -} -/*---------------------------------------------------------------------------*/ -int8_t -rf_ble_get_tx_power(void) -{ - rf_result_t res; - - int8_t dbm; - res = rf_get_tx_power(ble_beacond.rf_handle, ble_tx_power_table, &dbm); - - if(res != RF_RESULT_OK) { - return RF_TxPowerTable_INVALID_DBM; - } - - return dbm; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ble_beacond_process, ev, data) -{ - size_t len; - - PROCESS_BEGIN(); - - while(1) { - etimer_set(&ble_beacond.ble_adv_et, ble_beacond.ble_adv_interval); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&ble_beacond.ble_adv_et) || - (ev == PROCESS_EVENT_EXIT)); - - if(ev == PROCESS_EVENT_EXIT) { - PROCESS_EXIT(); - } - - /* Device info */ - /* Set the adv payload each pass: The device name may have changed */ - len = 0; - - #define append_byte(x) ble_beacond.tx_buf[len++] = (uint8_t)((x)) - - /* 2 bytes */ - append_byte(2); - append_byte(BLE_ADV_TYPE_FLAGS); - /* LE general discoverable + BR/EDR not supported */ - append_byte(BLE_ADV_TYPE_FLAGS_GENERAL | - BLE_ADV_TYPE_FLAGS_BREDR_NOT_SUPPORTED); - - /* 1 + len(name) bytes (excluding zero termination) */ - append_byte(1 + ble_beacond.adv_name_len); - append_byte(BLE_ADV_TYPE_LOCAL_NAME_COMPLETE); - - memcpy(ble_beacond.tx_buf + len, ble_beacond.adv_name, ble_beacond.adv_name_len); - len += ble_beacond.adv_name_len; - - #undef append_byte - - /* Send advertisements on all three channels */ - ble_beacond.ble_adv_par.advLen = len; - ble_beacond.ble_adv_par.pAdvData = ble_beacond.tx_buf; - - ble_sched_beacons(BLE_ADV_CHANNEL_ALL); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -#else /* RF_CONF_BLE_BEACON_ENABLE */ -/*---------------------------------------------------------------------------*/ -rf_ble_beacond_result_t -rf_ble_beacond_init(void) -{ - return RF_BLE_BEACOND_DISABLED; -} -/*---------------------------------------------------------------------------*/ -rf_ble_beacond_result_t -rf_ble_beacond_config(clock_time_t interval, const char *name) -{ - (void)interval; - (void)name; - return RF_BLE_BEACOND_DISABLED; -} -/*---------------------------------------------------------------------------*/ -rf_ble_beacond_result_t -rf_ble_beacond_start(void) -{ - return RF_BLE_BEACOND_DISABLED; -} - -/*---------------------------------------------------------------------------*/ -rf_ble_beacond_result_t -rf_ble_beacond_stop(void) -{ - return RF_BLE_BEACOND_DISABLED; -} -/*---------------------------------------------------------------------------*/ -int8_t -rf_ble_is_active(void) -{ - return -1; -} -/*---------------------------------------------------------------------------*/ -rf_ble_beacond_result_t -rf_ble_set_tx_power(int8_t power) -{ - (void)power; - return RF_BLE_BEACOND_DISABLED; -} -/*---------------------------------------------------------------------------*/ -int8_t -rf_ble_get_tx_power(void) -{ - return ~(int8_t)(0); -} -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_BLE_BEACON_ENABLE */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-beacond.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-beacond.h deleted file mode 100644 index 7741a2d71..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ble-beacond.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf - * @{ - * - * \defgroup cc13xx-cc26xx-rf-ble CC13xx/CC26xx BLE Beacon Daemon - * - * @{ - * - * \file - * Header file for the CC13xx/CC26xx BLE Beacon Daemon. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_BLE_BEACOND_H_ -#define RF_BLE_BEACOND_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -typedef enum { - RF_BLE_BEACOND_OK, - RF_BLE_BEACOND_ERROR, - RF_BLE_BEACOND_DISABLED, -} rf_ble_beacond_result_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the BLE advertisement/beacon daemon - */ -rf_ble_beacond_result_t rf_ble_beacond_init(void); - -/** - * \brief Set the device name to use with the BLE advertisement/beacon daemon - * \param interval The interval (ticks) between two consecutive beacon bursts - * \param name The device name to advertise - * - * If name is NULL it will be ignored. If interval==0 it will be ignored. Thus, - * this function can be used to configure a single parameter at a time if so - * desired. - */ -rf_ble_beacond_result_t rf_ble_beacond_config(clock_time_t interval, const char *name); - -/** - * \brief Start the BLE advertisement/beacon daemon - * \return RF_CORE_CMD_OK: Success, RF_CORE_CMD_ERROR: Failure - * - * Before calling this function, the name to advertise must first be set by - * calling rf_ble_beacond_config(). Otherwise, this function will return an - * error. - */ -rf_ble_beacond_result_t rf_ble_beacond_start(void); - -/** - * \brief Stop the BLE advertisement/beacon daemon - */ -rf_ble_beacond_result_t rf_ble_beacond_stop(void); - -/** - * \brief Check whether the BLE beacond is currently active - * \retval 1 BLE daemon is active - * \retval 0 BLE daemon is inactive - * \retval -1 BLE daemon is disabled - */ -int8_t rf_ble_is_active(void); - -/** - * \brief Set TX power for BLE advertisements - * \param dbm The 'at least' TX power in dBm, values avove 5 dBm will be ignored - * - * Set TX power to 'at least' power dBm. - * This works with a lookup table. If the value of 'power' does not exist in - * the lookup table, TXPOWER will be set to the immediately higher available - * value - */ -rf_ble_beacond_result_t rf_ble_set_tx_power(int8_t dbm); - -/** - * \brief Get TX power for BLE advertisements - * \return The TX power for BLE advertisements - */ -int8_t rf_ble_get_tx_power(void); -/*---------------------------------------------------------------------------*/ -#endif /* RF_BLE_BEACOND_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/data-queue.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf/data-queue.c deleted file mode 100644 index a5f03a8d7..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/data-queue.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-data-queue - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx RF data queue. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_data_entry.h) -/*---------------------------------------------------------------------------*/ -#include "rf/data-queue.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* RX buf configuration */ -#define RX_BUF_CNT RF_CONF_RX_BUF_CNT -#define RX_BUF_SIZE RF_CONF_RX_BUF_SIZE -/*---------------------------------------------------------------------------*/ -/* Receive buffer entries with room for 1 IEEE 802.15.4 frame in each */ -typedef union { - data_entry_t data_entry; - uint8_t buf[RX_BUF_SIZE]; -} rx_buf_t CC_ALIGN (4); -/*---------------------------------------------------------------------------*/ -typedef struct { - /* RX bufs */ - rx_buf_t bufs[RX_BUF_CNT]; - /* RFC data queue object */ - data_queue_t data_queue; - /* Current data entry in use by RF */ - data_entry_t *curr_entry; - /* Size in bytes of length field in data entry */ - size_t lensz; -} rx_data_queue_t; - -static rx_data_queue_t rx_data_queue; -/*---------------------------------------------------------------------------*/ -static void -rx_bufs_init(void) -{ - data_entry_t *data_entry; - size_t i; - - for(i = 0; i < RX_BUF_CNT; ++i) { - data_entry = &(rx_data_queue.bufs[i].data_entry); - - data_entry->status = DATA_ENTRY_PENDING; - data_entry->config.type = DATA_ENTRY_TYPE_GEN; - data_entry->config.lenSz = rx_data_queue.lensz; - data_entry->length = RX_BUF_SIZE - sizeof(data_entry_t); - /* Point to fist entry if this is last entry, else point to next entry */ - data_entry->pNextEntry = ((i + 1) == RX_BUF_CNT) - ? rx_data_queue.bufs[0].buf - : rx_data_queue.bufs[i + 1].buf; - } -} -/*---------------------------------------------------------------------------*/ -static void -rx_bufs_reset(void) -{ - size_t i; - for(i = 0; i < RX_BUF_CNT; ++i) { - data_entry_t *const data_entry = &(rx_data_queue.bufs[i].data_entry); - - /* Clear length bytes */ - memset(&(data_entry->data), 0x0, rx_data_queue.lensz); - /* Set status to Pending */ - data_entry->status = DATA_ENTRY_PENDING; - } -} -/*---------------------------------------------------------------------------*/ -data_queue_t * -data_queue_init(size_t lensz) -{ - rx_data_queue.lensz = lensz; - - /* Initialize RX buffers */ - rx_bufs_init(); - - /* Configure data queue as circular buffer */ - rx_data_queue.data_queue.pCurrEntry = rx_data_queue.bufs[0].buf; - rx_data_queue.data_queue.pLastEntry = NULL; - - /* Set current read pointer to first element */ - rx_data_queue.curr_entry = &(rx_data_queue.bufs[0].data_entry); - - return &rx_data_queue.data_queue; -} -/*---------------------------------------------------------------------------*/ -void -data_queue_reset(void) -{ - rx_bufs_reset(); - - /* Only need to reconfigure pCurrEntry */ - rx_data_queue.data_queue.pCurrEntry = rx_data_queue.bufs[0].buf; - - /* Set current read pointer to first element */ - rx_data_queue.curr_entry = &(rx_data_queue.bufs[0].data_entry); -} -/*---------------------------------------------------------------------------*/ -data_entry_t * -data_queue_current_entry(void) -{ - return rx_data_queue.curr_entry; -} -/*---------------------------------------------------------------------------*/ -void -data_queue_release_entry(void) -{ - data_entry_t *const curr_entry = rx_data_queue.curr_entry; - uint8_t *const frame_ptr = (uint8_t *)&(curr_entry->data); - - /* Clear length bytes */ - memset(frame_ptr, 0x0, rx_data_queue.lensz); - /* Set status to Pending */ - curr_entry->status = DATA_ENTRY_PENDING; - - /* Move current entry to the next entry */ - rx_data_queue.curr_entry = (data_entry_t *)(curr_entry->pNextEntry); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/data-queue.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf/data-queue.h deleted file mode 100644 index 049cf78d1..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/data-queue.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf - * @{ - * - * \defgroup cc13xx-cc26xx-rf-data-queue RF data queue for CC13xx/CC26xx - * - * @{ - * - * \file - * Header file of the CC13xx/CC26xx RF data queue. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_DATA_QUEUE_H_ -#define RF_DATA_QUEUE_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_data_entry.h) -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -typedef dataQueue_t data_queue_t; -typedef rfc_dataEntryGeneral_t data_entry_t; -/*---------------------------------------------------------------------------*/ -data_queue_t *data_queue_init(size_t lensz); -void data_queue_reset(void); -data_entry_t *data_queue_current_entry(void); -void data_queue_release_entry(void); -/*---------------------------------------------------------------------------*/ -#endif /* RF_DATA_QUEUE_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/dot-15-4g.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf/dot-15-4g.h deleted file mode 100644 index 5366651e7..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/dot-15-4g.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf - * @{ - * - * \defgroup cc13xx-cc26xx-rf-15-4g-modes IEEE 802.15.4g Frequency Bands and Modes - * - * @{ - * - * \file - * Header file with descriptors for the various modes of operation - * defined in IEEE 802.15.4g. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef DOT_15_4G_H_ -#define DOT_15_4G_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -/* IEEE 802.15.4g frequency band identifiers (Table 68f) */ -#define DOT_15_4G_FREQ_BAND_169 0 /* 169.400–169.475 (Europe) - 169 MHz band */ -#define DOT_15_4G_FREQ_BAND_450 1 /* 450–470 (US FCC Part 22/90) - 450 MHz band */ -#define DOT_15_4G_FREQ_BAND_470 2 /* 470–510 (China) - 470 MHz band */ -#define DOT_15_4G_FREQ_BAND_780 3 /* 779–787 (China) - 780 MHz band */ -#define DOT_15_4G_FREQ_BAND_863 4 /* 863–870 (Europe) - 863 MHz band */ -#define DOT_15_4G_FREQ_BAND_896 5 /* 896–901 (US FCC Part 90) - 896 MHz band */ -#define DOT_15_4G_FREQ_BAND_901 6 /* 901–902 (US FCC Part 24) - 901 MHz band */ -#define DOT_15_4G_FREQ_BAND_915 7 /* 902–928 (US) - 915 MHz band */ -#define DOT_15_4G_FREQ_BAND_917 8 /* 917–923.5 (Korea) - 917 MHz band */ -#define DOT_15_4G_FREQ_BAND_920 9 /* 920–928 (Japan) - 920 MHz band */ -#define DOT_15_4G_FREQ_BAND_928 10 /* 928–960 (US, non-contiguous) - 928 MHz band */ -#define DOT_15_4G_FREQ_BAND_950 11 /* 950–958 (Japan) - 950 MHz band */ -#define DOT_15_4G_FREQ_BAND_1427 12 /* 1427–1518 (US and Canada, non-contiguous) - 1427 MHz band */ -#define DOT_15_4G_FREQ_BAND_2450 13 /* 2400–2483.5 2450 MHz band */ -/*---------------------------------------------------------------------------*/ -/* Default band selection to band 4 - 863MHz */ -#ifdef DOT_15_4G_CONF_FREQ_BAND_ID -#define DOT_15_4G_FREQ_BAND_ID DOT_15_4G_CONF_FREQ_BAND_ID -#else -#define DOT_15_4G_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_863 -#endif -/*---------------------------------------------------------------------------*/ -/* - * Channel count, spacing and other params relating to the selected band. We - * currently only support some of the bands defined in .15.4g and for those - * bands we only support operating mode #1 (Table 134). - * - * DOT_15_4G_CHAN0_FREQ is specified here in KHz - */ -#if (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_470) -#define DOT_15_4G_CHAN_MIN 0 -#define DOT_15_4G_CHAN_MAX 198 -#define DOT_15_4G_FREQ_SPACING 200 -#define DOT_15_4G_CHAN0_FREQ 470200 - -#define PROP_MODE_CONF_CENTER_FREQ 0x01EA -#define PROP_MODE_CONF_LO_DIVIDER 0x0A - -#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_780) -#define DOT_15_4G_CHAN_MIN 0 -#define DOT_15_4G_CHAN_MAX 38 -#define DOT_15_4G_FREQ_SPACING 200 -#define DOT_15_4G_CHAN0_FREQ 779200 - -#define PROP_MODE_CONF_CENTER_FREQ 0x030F -#define PROP_MODE_CONF_LO_DIVIDER 0x06 - -#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_863) -#define DOT_15_4G_CHAN_MIN 0 -#define DOT_15_4G_CHAN_MAX 33 -#define DOT_15_4G_FREQ_SPACING 200 -#define DOT_15_4G_CHAN0_FREQ 863125 - -#define PROP_MODE_CONF_CENTER_FREQ 0x0362 -#define PROP_MODE_CONF_LO_DIVIDER 0x05 - -#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_915) -#define DOT_15_4G_CHAN_MIN 0 -#define DOT_15_4G_CHAN_MAX 128 -#define DOT_15_4G_FREQ_SPACING 200 -#define DOT_15_4G_CHAN0_FREQ 902200 - -#define PROP_MODE_CONF_CENTER_FREQ 0x0393 -#define PROP_MODE_CONF_LO_DIVIDER 0x05 - -#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_920) -#define DOT_15_4G_CHAN_MIN 0 -#define DOT_15_4G_CHAN_MAX 37 -#define DOT_15_4G_FREQ_SPACING 200 -#define DOT_15_4G_CHAN0_FREQ 920600 - -#define PROP_MODE_CONF_CENTER_FREQ 0x039C -#define PROP_MODE_CONF_LO_DIVIDER 0x05 - -#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_950) -#define DOT_15_4G_CHAN_MIN 0 -#define DOT_15_4G_CHAN_MAX 32 -#define DOT_15_4G_FREQ_SPACING 200 -#define DOT_15_4G_CHAN0_FREQ 951000 - -#define PROP_MODE_CONF_CENTER_FREQ 0x03BA -#define PROP_MODE_CONF_LO_DIVIDER 0x05 - -#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_2450) -#define DOT_15_4G_CHAN_MIN 11 -#define DOT_15_4G_CHAN_MAX 26 -#define DOT_15_4G_FREQ_SPACING 5000 -#define DOT_15_4G_CHAN0_FREQ 2405000 - -#else -#error "The selected IEEE 802.15.4g frequency band is not supported" -#endif -/*---------------------------------------------------------------------------*/ -static inline uint32_t -dot_15_4g_freq(const uint16_t chan) -{ - const uint32_t chan0 = DOT_15_4G_CHAN0_FREQ; - const uint32_t spacing = DOT_15_4G_FREQ_SPACING; - const uint32_t chan_min = DOT_15_4G_CHAN_MIN; - return chan0 + spacing * ((uint32_t)chan - chan_min); -} -/*---------------------------------------------------------------------------*/ -static inline bool -dot_15_4g_chan_in_range(const uint16_t chan) -{ - const uint16_t chan_min = DOT_15_4G_CHAN_MIN; - const uint16_t chan_max = DOT_15_4G_CHAN_MAX; - return (chan >= chan_min) && - (chan <= chan_max); -} -/*---------------------------------------------------------------------------*/ -#define DOT_15_4G_DEFAULT_CHAN IEEE802154_DEFAULT_CHANNEL -/*---------------------------------------------------------------------------*/ -#endif /* DOT_15_4G_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ieee-addr.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf/ieee-addr.c deleted file mode 100644 index 4ce39a241..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ieee-addr.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-ieee-addr - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx IEEE addresses driver. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "net/linkaddr.h" - -#include "rf/ieee-addr.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(inc/hw_memmap.h) -#include DeviceFamily_constructPath(inc/hw_fcfg1.h) -#include DeviceFamily_constructPath(inc/hw_ccfg.h) -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -#define IEEE_ADDR_HARDCODED IEEE_ADDR_CONF_HARDCODED -#define IEEE_ADDR_ADDRESS IEEE_ADDR_CONF_ADDRESS -/*---------------------------------------------------------------------------*/ -#define IEEE_MAC_PRIMARY_ADDRESS (FCFG1_BASE + FCFG1_O_MAC_15_4_0) -#define IEEE_MAC_SECONDARY_ADDRESS (CCFG_BASE + CCFG_O_IEEE_MAC_0) -/*---------------------------------------------------------------------------*/ -int -ieee_addr_cpy_to(uint8_t *dst, uint8_t len) -{ - if(len > LINKADDR_SIZE) { - return -1; - } - - if(IEEE_ADDR_HARDCODED) { - const uint8_t ieee_addr_hc[LINKADDR_SIZE] = IEEE_ADDR_ADDRESS; - - memcpy(dst, &ieee_addr_hc[LINKADDR_SIZE - len], len); - } else { - int i; - - volatile const uint8_t *const primary = (uint8_t *)IEEE_MAC_PRIMARY_ADDRESS; - volatile const uint8_t *const secondary = (uint8_t *)IEEE_MAC_SECONDARY_ADDRESS; - - /* Reading from primary location... */ - volatile const uint8_t *ieee_addr = primary; - - /* - * ...unless we can find a byte != 0xFF in secondary. - * - * Intentionally checking all 8 bytes here instead of len, because we - * are checking validity of the entire address respective of the - * actual number of bytes the caller wants to copy over. - */ - for(i = 0; i < len; i++) { - if(secondary[i] != 0xFF) { - /* A byte in the secondary location is not 0xFF. Use the secondary */ - ieee_addr = secondary; - break; - } - } - - /* - * We have chosen what address to read the address from. Do so, - * in inverted byte order. - */ - for(i = 0; i < len; i++) { - dst[i] = ieee_addr[len - 1 - i]; - } - } - -#ifdef IEEE_ADDR_NODE_ID - dst[len - 1] = (IEEE_ADDR_NODE_ID >> 0) & 0xFF; - dst[len - 2] = (IEEE_ADDR_NODE_ID >> 8) & 0xFF; -#endif - - return 0; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ieee-addr.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf/ieee-addr.h deleted file mode 100644 index dc649cdd1..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ieee-addr.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-rf-ieee-addr CC13xx/CC26xx IEEE Address Control - * - * Driver for the retrieval of an IEEE address from flash. - * - * The user can specify a hardcoded IEEE address through the - * IEEE_ADDR_CONF_HARDCODED configuration macro. - * - * If the user does not hard-code an address, then one will be read from either - * the primary location (InfoPage) or from the secondary location (on flash). - * - * In order to allow the user to easily program nodes with addresses, the - * secondary location is given priority: If it contains a valid address then - * it will be chosen in favour of the one on InfoPage. - * - * In this context, an address is valid if at least one of the 8 bytes does not - * equal 0xFF. If all 8 bytes are 0xFF, then the primary location will be used. - * - * In all cases, the address is assumed to be written little-endian. - * - * Lastly, it is possible to override the 2 LSB's of the address by using the - * NODE_ID make variable. - * @{ - * - * \file - * Header file for the CC13xx/CC26xx IEEE address driver. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef IEEE_ADDR_H_ -#define IEEE_ADDR_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -/** - * \brief Copy the device's IEEE address to a destination buffer. - * \param dst A pointer to the destination area where the IEEE address is to - * be written. - * \param len The number of bytes to write to destination area - * \return 0 : Returned successfully - * -1 : Returned with error - * - * This function will copy \p len bytes in LSB and it will invert byte order - * in the process. The factory address on devices is normally little-endian, - * therefore you should expect dst to store the address in a big-endian order. - */ -int ieee_addr_cpy_to(uint8_t *dst, uint8_t len); -/*---------------------------------------------------------------------------*/ -#endif /* IEEE_ADDR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ieee-mode.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf/ieee-mode.c deleted file mode 100644 index 6f21c72ba..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/ieee-mode.c +++ /dev/null @@ -1,1034 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf - * @{ - * - * \defgroup cc13xx-cc26xx-rf-ieee IEEE-mode driver for CC13xx/CC26xx - * - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx IEEE-mode NETSTACK_RADIO driver. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "net/packetbuf.h" -#include "net/linkaddr.h" -#include "net/netstack.h" -#include "sys/energest.h" -#include "sys/clock.h" -#include "sys/rtimer.h" -#include "sys/ctimer.h" -#include "sys/cc.h" -/*---------------------------------------------------------------------------*/ -/* RF driver and RF Core API */ -#include -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_data_entry.h) -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -/* - * rf_ieee_cmd.h and rf_ieee_mailbox.h are included by RF settings because a - * discrepancy between CC13x0 and CC13x2 IEEE support. CC13x0 doesn't provide - * RFCore definitions of IEEE commands, and are therefore included locally - * from the Contiki build system. CC13x2 includes these normally from driverlib. - * This is taken care of RF settings. - */ - -#include -/*---------------------------------------------------------------------------*/ -/* SimpleLink Platform RF dev */ -#include "rf/rf.h" -#include "rf/data-queue.h" -#include "rf/dot-15-4g.h" -#include "rf/sched.h" -#include "rf/settings.h" -#include "rf/tx-power.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Radio" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -/* Configuration parameters */ -#define IEEE_MODE_AUTOACK IEEE_MODE_CONF_AUTOACK -#define IEEE_MODE_PROMISCOUS IEEE_MODE_CONF_PROMISCOUS -#define IEEE_MODE_CCA_RSSI_THRESHOLD IEEE_MODE_CONF_CCA_RSSI_THRESHOLD -/*---------------------------------------------------------------------------*/ -/* Timeout constants */ - -/* How long to wait for the rx read entry to become ready */ -#define TIMEOUT_DATA_ENTRY_BUSY (RTIMER_SECOND / 250) - -/* How long to wait for RX to become active after scheduled */ -#define TIMEOUT_ENTER_RX_WAIT (RTIMER_SECOND >> 10) -/*---------------------------------------------------------------------------*/ -#define RAT_RANGE (~(uint32_t)0) -#define RAT_ONE_QUARTER (RAT_RANGE / (uint32_t)4) -#define RAT_THREE_QUARTERS ((RAT_RANGE * (uint32_t)3) / (uint32_t)4) - -/* XXX: don't know what exactly is this, looks like the time to TX 3 octets */ -#define RAT_TIMESTAMP_OFFSET -(USEC_TO_RAT(32 * 3) - 1) /* -95.75 usec */ -/*---------------------------------------------------------------------------*/ -#define STATUS_CORRELATION 0x3f /* bits 0-5 */ -#define STATUS_REJECT_FRAME 0x40 /* bit 6 */ -#define STATUS_CRC_FAIL 0x80 /* bit 7 */ -/*---------------------------------------------------------------------------*/ -#define FRAME_FCF_OFFSET 0 -#define FRAME_SEQNUM_OFFSET 2 - -#define FRAME_ACK_REQUEST 0x20 /* bit 5 */ - -/* TX buf configuration */ -#define TX_BUF_SIZE 180 -/*---------------------------------------------------------------------------*/ -/* Size of the Length representation in Data Entry, one byte in this case */ -typedef uint8_t lensz_t; - -#define FRAME_OFFSET sizeof(lensz_t) -#define FRAME_SHAVE 8 /* FCS (2) + RSSI (1) + Status (1) + Timestamp (4) */ -/*---------------------------------------------------------------------------*/ -/* Used for checking result of CCA_REQ command */ -typedef enum { - CCA_STATE_IDLE = 0, - CCA_STATE_BUSY = 1, - CCA_STATE_INVALID = 2 -} cca_state_t; -/*---------------------------------------------------------------------------*/ -/* RF Core typedefs */ -typedef rfc_ieeeRxOutput_t rx_output_t; -typedef rfc_CMD_IEEE_MOD_FILT_t cmd_mod_filt_t; -typedef rfc_CMD_IEEE_CCA_REQ_t cmd_cca_req_t; - -typedef struct { - /* Outgoing frame buffer */ - uint8_t tx_buf[TX_BUF_SIZE] CC_ALIGN(4); - - /* RF Statistics struct */ - rx_output_t rx_stats; - - /* Indicates RF is supposed to be on or off */ - bool rf_is_on; - /* Enable/disable CCA before sending */ - bool send_on_cca; - /* Are we currently in poll mode? */ - bool poll_mode; - - /* Last RX operation stats */ - struct { - int8_t rssi; - uint8_t corr_lqi; - uint32_t timestamp; - } last; - - /* RAT Overflow Upkeep */ - struct { - struct ctimer overflow_timer; - rtimer_clock_t last_overflow; - volatile uint32_t overflow_count; - } rat; - - /* RF driver */ - RF_Handle rf_handle; -} ieee_radio_t; - -static ieee_radio_t ieee_radio; - -/* Global RF Core commands */ -static cmd_mod_filt_t cmd_mod_filt; -/*---------------------------------------------------------------------------*/ -/* RF Command volatile objects */ -#define cmd_radio_setup (*(volatile rfc_CMD_RADIO_SETUP_t *)&rf_cmd_ieee_radio_setup) -#define cmd_fs (*(volatile rfc_CMD_FS_t *) &rf_cmd_ieee_fs) -#define cmd_tx (*(volatile rfc_CMD_IEEE_TX_t *) &rf_cmd_ieee_tx) -#define cmd_rx (*(volatile rfc_CMD_IEEE_RX_t *) &rf_cmd_ieee_rx) -#define cmd_rx_ack (*(volatile rfc_CMD_IEEE_RX_ACK_t *)&rf_cmd_ieee_rx_ack) -/*---------------------------------------------------------------------------*/ -static inline bool -rx_is_active(void) -{ - return cmd_rx.status == ACTIVE; -} -/*---------------------------------------------------------------------------*/ -/* Forward declarations of local functions */ -static void check_rat_overflow(void); -static uint32_t rat_to_timestamp(const uint32_t); -/*---------------------------------------------------------------------------*/ -/* Forward declarations of Radio driver functions */ -static int init(void); -static int prepare(const void *, unsigned short); -static int transmit(unsigned short); -static int send(const void *, unsigned short); -static int read(void *, unsigned short); -static int channel_clear(void); -static int receiving_packet(void); -static int pending_packet(void); -static int on(void); -static int off(void); -static radio_result_t get_value(radio_param_t, radio_value_t *); -static radio_result_t set_value(radio_param_t, radio_value_t); -static radio_result_t get_object(radio_param_t, void *, size_t); -static radio_result_t set_object(radio_param_t, const void *, size_t); -/*---------------------------------------------------------------------------*/ -static void -rat_overflow_cb(void *arg) -{ - check_rat_overflow(); - /* Check next time after half of the RAT interval */ - const clock_time_t two_quarters = (2 * RAT_ONE_QUARTER * CLOCK_SECOND) / RAT_SECOND; - ctimer_set(&ieee_radio.rat.overflow_timer, two_quarters, rat_overflow_cb, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -init_rf_params(void) -{ - cmd_radio_setup.config.frontEndMode = RF_2_4_GHZ_FRONT_END_MODE; - cmd_radio_setup.config.biasMode = RF_2_4_GHZ_BIAS_MODE; - - data_queue_t *rx_q = data_queue_init(sizeof(lensz_t)); - - cmd_rx.pRxQ = rx_q; - cmd_rx.pOutput = &ieee_radio.rx_stats; - -#if IEEE_MODE_PROMISCOUS - cmd_rx.frameFiltOpt.frameFiltEn = 0; -#else - cmd_rx.frameFiltOpt.frameFiltEn = 1; -#endif - -#if IEEE_MODE_AUTOACK - cmd_rx.frameFiltOpt.autoAckEn = 1; -#else - cmd_rx.frameFiltOpt.autoAckEn = 0; -#endif - - cmd_rx.ccaRssiThr = IEEE_MODE_CCA_RSSI_THRESHOLD; - - cmd_tx.pNextOp = (RF_Op *)&cmd_rx_ack; - cmd_tx.condition.rule = COND_NEVER; /* Initially ACK turned off */ - - /* - * ACK packet is transmitted 192 us after the end of the received packet, - * takes 352 us for ACK transmission, total of 546 us of expected time to - * recieve ACK in ideal conditions. 700 us endTime for CMD_IEEE_RX_ACK - * should give some margins. - * The ACK frame consists of 6 bytes of SHR/PDR and 5 bytes of PSDU, total - * of 11 bytes. 11 bytes x 32 us/byte equals 352 us of ACK transmission time. - */ - cmd_rx_ack.startTrigger.triggerType = TRIG_NOW; - cmd_rx_ack.endTrigger.triggerType = TRIG_REL_START; - cmd_rx_ack.endTime = RF_convertUsToRatTicks(700); - - /* Initialize address filter command */ - cmd_mod_filt.commandNo = CMD_IEEE_MOD_FILT; - memcpy(&(cmd_mod_filt.newFrameFiltOpt), &(rf_cmd_ieee_rx.frameFiltOpt), sizeof(rf_cmd_ieee_rx.frameFiltOpt)); - memcpy(&(cmd_mod_filt.newFrameTypes), &(rf_cmd_ieee_rx.frameTypes), sizeof(rf_cmd_ieee_rx.frameTypes)); -} -/*---------------------------------------------------------------------------*/ -static rf_result_t -set_channel(uint8_t channel) -{ - if(!dot_15_4g_chan_in_range(channel)) { - LOG_WARN("Supplied hannel %d is illegal, defaults to %d\n", - (int)channel, DOT_15_4G_DEFAULT_CHAN); - channel = DOT_15_4G_DEFAULT_CHAN; - } - - /* - * cmd_rx.channel is initialized to 0, causing any initial call to - * set_channel() to cause a synth calibration, since channel must be in - * range 11-26. - */ - if(channel == cmd_rx.channel) { - /* We are already calibrated to this channel */ - return true; - } - - cmd_rx.channel = channel; - - const uint32_t new_freq = dot_15_4g_freq(channel); - const uint16_t freq = (uint16_t)(new_freq / 1000); - const uint16_t frac = (uint16_t)(((new_freq - (freq * 1000)) * 0x10000) / 1000); - - LOG_DBG("Set channel to %d, frequency 0x%04X.0x%04X (%lu)\n", - (int)channel, freq, frac, new_freq); - - cmd_fs.frequency = freq; - cmd_fs.fractFreq = frac; - - return netstack_sched_fs(); -} -/*---------------------------------------------------------------------------*/ -static void -set_send_on_cca(bool enable) -{ - ieee_radio.send_on_cca = enable; -} -/*---------------------------------------------------------------------------*/ -static void -check_rat_overflow(void) -{ - const bool was_off = !rx_is_active(); - - if(was_off) { - RF_runDirectCmd(ieee_radio.rf_handle, CMD_NOP); - } - - const uint32_t current_value = RF_getCurrentTime(); - - static bool initial_iteration = true; - static uint32_t last_value; - - if(initial_iteration) { - /* First time checking overflow will only store the current value */ - initial_iteration = false; - } else { - /* Overflow happens in the last quarter of the RAT range */ - if((current_value + RAT_ONE_QUARTER) < last_value) { - /* Overflow detected */ - ieee_radio.rat.last_overflow = RTIMER_NOW(); - ieee_radio.rat.overflow_count += 1; - } - } - - last_value = current_value; - - if(was_off) { - RF_yield(ieee_radio.rf_handle); - } -} -/*---------------------------------------------------------------------------*/ -static uint32_t -rat_to_timestamp(const uint32_t rat_ticks) -{ - check_rat_overflow(); - - uint64_t adjusted_overflow_count = ieee_radio.rat.overflow_count; - - /* If the timestamp is in the 4th quarter and the last overflow was recently, - * assume that the timestamp refers to the time before the overflow */ - if(rat_ticks > RAT_THREE_QUARTERS) { - const rtimer_clock_t one_quarter = (RAT_ONE_QUARTER * RTIMER_SECOND) / RAT_SECOND; - if(RTIMER_CLOCK_LT(RTIMER_NOW(), ieee_radio.rat.last_overflow + one_quarter)) { - adjusted_overflow_count -= 1; - } - } - - /* Add the overflowed time to the timestamp */ - const uint64_t rat_ticks_adjusted = (uint64_t)rat_ticks + (uint64_t)RAT_RANGE * adjusted_overflow_count; - - /* Correct timestamp so that it refers to the end of the SFD and convert to RTIMER */ - return RAT_TO_RTIMER(rat_ticks_adjusted + RAT_TIMESTAMP_OFFSET); -} -/*---------------------------------------------------------------------------*/ -static int -init(void) -{ - if(ieee_radio.rf_handle) { - LOG_WARN("Radio already initialized\n"); - return RF_RESULT_OK; - } - - /* RX is off */ - ieee_radio.rf_is_on = false; - - init_rf_params(); - - /* Init RF params and specify non-default params */ - RF_Params rf_params; - RF_Params_init(&rf_params); - rf_params.nInactivityTimeout = RF_CONF_INACTIVITY_TIMEOUT; - - ieee_radio.rf_handle = netstack_open(&rf_params); - - if(ieee_radio.rf_handle == NULL) { - LOG_ERR("Unable to open RF driver\n"); - return RF_RESULT_ERROR; - } - - set_channel(DOT_15_4G_DEFAULT_CHAN); - - int8_t max_tx_power = tx_power_max(rf_tx_power_table, rf_tx_power_table_size); - rf_set_tx_power(ieee_radio.rf_handle, rf_tx_power_table, max_tx_power); - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - - /* Start RAT overflow upkeep */ - check_rat_overflow(); - clock_time_t two_quarters = (2 * RAT_ONE_QUARTER * CLOCK_SECOND) / RAT_SECOND; - ctimer_set(&ieee_radio.rat.overflow_timer, two_quarters, rat_overflow_cb, NULL); - - /* Start RF process */ - process_start(&rf_sched_process, NULL); - - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static int -prepare(const void *payload, unsigned short payload_len) -{ - const size_t len = MIN((size_t)payload_len, - (size_t)TX_BUF_SIZE); - - memcpy(ieee_radio.tx_buf, payload, len); - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -transmit(unsigned short transmit_len) -{ - rf_result_t res; - - if(ieee_radio.send_on_cca && channel_clear() != 1) { - LOG_WARN("Channel is not clear for transmission\n"); - return RADIO_TX_COLLISION; - } - - /* - * Are we expecting ACK? The ACK Request flag is in the first Frame - * Control Field byte, that is the first byte in the frame. - */ - const bool ack_request = (bool)(ieee_radio.tx_buf[FRAME_FCF_OFFSET] & FRAME_ACK_REQUEST); - if(ack_request) { - /* Yes, turn on chaining */ - cmd_tx.condition.rule = COND_STOP_ON_FALSE; - - /* Reset CMD_IEEE_RX_ACK command */ - cmd_rx_ack.status = IDLE; - /* Sequence number is the third byte in the frame */ - cmd_rx_ack.seqNo = ieee_radio.tx_buf[FRAME_SEQNUM_OFFSET]; - } else { - /* No, turn off chaining */ - cmd_tx.condition.rule = COND_NEVER; - } - - /* Configure TX command */ - cmd_tx.payloadLen = (uint8_t)transmit_len; - cmd_tx.pPayload = ieee_radio.tx_buf; - - res = netstack_sched_ieee_tx(ack_request); - - if(res != RF_RESULT_OK) { - return RADIO_TX_ERR; - } - - if(ack_request) { - switch(cmd_rx_ack.status) { - /* CMD_IEEE_RX_ACK timed out, i.e. never received ACK */ - case IEEE_DONE_TIMEOUT: return RADIO_TX_NOACK; - /* An ACK was received with either pending data bit set or cleared */ - case IEEE_DONE_ACK: /* fallthrough */ - case IEEE_DONE_ACKPEND: return RADIO_TX_OK; - /* Any other statuses are errors */ - default: return RADIO_TX_ERR; - } - } - - /* No ACK expected, TX OK */ - return RADIO_TX_OK; -} -/*---------------------------------------------------------------------------*/ -static int -send(const void *payload, unsigned short payload_len) -{ - prepare(payload, payload_len); - return transmit(payload_len); -} -/*---------------------------------------------------------------------------*/ -static int -read(void *buf, unsigned short buf_len) -{ - volatile data_entry_t *data_entry = data_queue_current_entry(); - - const rtimer_clock_t t0 = RTIMER_NOW(); - /* Only wait if the Radio timer is accessing the entry */ - while((data_entry->status == DATA_ENTRY_BUSY) && - RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_DATA_ENTRY_BUSY)) ; - - if(data_entry->status != DATA_ENTRY_FINISHED) { - /* No available data */ - return -1; - } - - /* - * lensz bytes (1) in the data entry are the length of the received frame. - * Data frame is on the following format: - * Length (1) + Payload (N) + FCS (2) + RSSI (1) + Status (1) + Timestamp (4) - * Data frame DOES NOT contain the following: - * no PHY Header bytes - * no Source Index bytes - * Visual representation of frame format: - * - * +--------+---------+---------+--------+--------+-----------+ - * | 1 byte | N bytes | 2 bytes | 1 byte | 1 byte | 4 bytes | - * +--------+---------+---------+--------+--------+-----------+ - * | Length | Payload | FCS | RSSI | Status | Timestamp | - * +--------+---------+---------+--------+--------+-----------+ - * - * Length bytes equal total length of entire frame excluding itself, - * Length = N + FCS (2) + RSSI (1) + Status (1) + Timestamp (4) - * Length = N + 8 - * N = Length - 8 - */ - uint8_t *const frame_ptr = (uint8_t *)&data_entry->data; - const lensz_t frame_len = *(lensz_t *)frame_ptr; - - /* Sanity check that Frame is at least Frame Shave bytes long */ - if(frame_len < FRAME_SHAVE) { - LOG_ERR("Received frame too short, len=%d\n", frame_len); - - data_queue_release_entry(); - return 0; - } - - const uint8_t *payload_ptr = frame_ptr + sizeof(lensz_t); - const unsigned short payload_len = (unsigned short)(frame_len - FRAME_SHAVE); - - /* Sanity check that Payload fits in buffer. */ - if(payload_len > buf_len) { - LOG_ERR("MAC payload too large for buffer, len=%d buf_len=%d\n", - payload_len, buf_len); - - data_queue_release_entry(); - return 0; - } - - memcpy(buf, payload_ptr, payload_len); - - /* RSSI stored FCS (2) bytes after payload. */ - ieee_radio.last.rssi = (int8_t)payload_ptr[payload_len + 2]; - /* LQI retrieved from Status byte, FCS (2) + RSSI (1) bytes after payload. */ - ieee_radio.last.corr_lqi = (uint8_t)(payload_ptr[payload_len + 3] & STATUS_CORRELATION); - /* Timestamp stored FCS (2) + RSSI (1) + Status (1) bytes after payload. */ - const uint32_t rat_ticks = *(uint32_t *)(payload_ptr + payload_len + 4); - ieee_radio.last.timestamp = rat_to_timestamp(rat_ticks); - - if(!ieee_radio.poll_mode) { - /* Not in poll mode: packetbuf should not be accessed in interrupt context. */ - /* In poll mode, the last packet RSSI and link quality can be obtained through */ - /* RADIO_PARAM_LAST_RSSI and RADIO_PARAM_LAST_LINK_QUALITY */ - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, (packetbuf_attr_t)ieee_radio.last.rssi); - packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, (packetbuf_attr_t)ieee_radio.last.corr_lqi); - } - - data_queue_release_entry(); - return (int)payload_len; -} -/*---------------------------------------------------------------------------*/ -static rf_result_t -cca_request(cmd_cca_req_t *cmd_cca_req) -{ - RF_Stat stat = RF_StatRadioInactiveError; - rf_result_t res; - bool stop_rx = false; - - /* RX is required to be running in order to do a CCA request */ - if(!rx_is_active()) { - /* If RX is not pending, i.e. soon to be running, schedule the RX command */ - if(cmd_rx.status != PENDING) { - res = netstack_sched_rx(false); - if(res != RF_RESULT_OK) { - LOG_ERR("CCA request failed to schedule RX\n"); - return res; - } - - /* We only stop RX if we had to schedule it */ - stop_rx = true; - } - - /* Make sure RX is running before we continue, unless we timeout and fail */ - RTIMER_BUSYWAIT_UNTIL(!rx_is_active(), TIMEOUT_ENTER_RX_WAIT); - - if(!rx_is_active()) { - LOG_ERR("CCA request failed to turn on RX, RX status=0x%04X\n", cmd_rx.status); - return RF_RESULT_ERROR; - } - } - - /* Perform the CCA request */ - stat = RF_runImmediateCmd(ieee_radio.rf_handle, (uint32_t *)&cmd_cca_req); - - if(stop_rx) { - netstack_stop_rx(); - } - - if(stat != RF_StatCmdDoneSuccess) { - LOG_ERR("CCA request command failed, stat=0x%02X\n", stat); - return RF_RESULT_ERROR; - } - - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - cmd_cca_req_t cmd_cca_req; - memset(&cmd_cca_req, 0x0, sizeof(cmd_cca_req_t)); - cmd_cca_req.commandNo = CMD_IEEE_CCA_REQ; - - if(cca_request(&cmd_cca_req) != RF_RESULT_OK) { - return 0; - } - - /* Channel is clear if CCA state is IDLE */ - return cmd_cca_req.ccaInfo.ccaState == CCA_STATE_IDLE; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - cmd_cca_req_t cmd_cca_req; - memset(&cmd_cca_req, 0x0, sizeof(cmd_cca_req_t)); - cmd_cca_req.commandNo = CMD_IEEE_CCA_REQ; - - if(cca_request(&cmd_cca_req) != RF_RESULT_OK) { - return 0; - } - - /* If we are transmitting (can only be an ACK here), we are not receiving */ - if((cmd_cca_req.ccaInfo.ccaEnergy == CCA_STATE_BUSY) && - (cmd_cca_req.ccaInfo.ccaCorr == CCA_STATE_BUSY) && - (cmd_cca_req.ccaInfo.ccaSync == CCA_STATE_BUSY)) { - LOG_WARN("We are TXing ACK, therefore not receiving packets\n"); - return 0; - } - - /* We are receiving a packet if a CCA sync has been seen, i.e. ccaSync is busy (1) */ - return cmd_cca_req.ccaInfo.ccaSync == CCA_STATE_BUSY; -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - const data_entry_t *const read_entry = data_queue_current_entry(); - volatile const data_entry_t *curr_entry = read_entry; - - int num_pending = 0; - - /* Go through RX Circular buffer and check each data entry status */ - do { - const uint8_t status = curr_entry->status; - if((status == DATA_ENTRY_FINISHED) || - (status == DATA_ENTRY_BUSY)) { - num_pending += 1; - } - - /* Stop when we have looped the circular buffer */ - curr_entry = (data_entry_t *)curr_entry->pNextEntry; - } while(curr_entry != read_entry); - - if((num_pending > 0) && !ieee_radio.poll_mode) { - process_poll(&rf_sched_process); - } - - /* If we didn't find an entry at status finished or busy, no frames are pending */ - return num_pending; -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - rf_result_t res; - - if(ieee_radio.rf_is_on) { - LOG_WARN("Radio is already on\n"); - return RF_RESULT_OK; - } - - data_queue_reset(); - - res = netstack_sched_rx(true); - - if(res != RF_RESULT_OK) { - return RF_RESULT_ERROR; - } - - ieee_radio.rf_is_on = true; - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - if(!ieee_radio.rf_is_on) { - LOG_WARN("Radio is already off\n"); - return RF_RESULT_OK; - } - - rf_yield(); - - ieee_radio.rf_is_on = false; - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - rf_result_t res; - - if(!value) { - return RADIO_RESULT_INVALID_VALUE; - } - - switch(param) { - - /* Power Mode */ - case RADIO_PARAM_POWER_MODE: - *value = (ieee_radio.rf_is_on) - ? RADIO_POWER_MODE_ON - : RADIO_POWER_MODE_OFF; - return RADIO_RESULT_OK; - - /* Channel */ - case RADIO_PARAM_CHANNEL: - *value = (radio_value_t)cmd_rx.channel; - return RADIO_RESULT_OK; - - /* PAN ID */ - case RADIO_PARAM_PAN_ID: - *value = (radio_value_t)cmd_rx.localPanID; - return RADIO_RESULT_OK; - - /* 16-bit address */ - case RADIO_PARAM_16BIT_ADDR: - *value = (radio_value_t)cmd_rx.localShortAddr; - return RADIO_RESULT_OK; - - /* RX mode */ - case RADIO_PARAM_RX_MODE: - *value = 0; - if(cmd_rx.frameFiltOpt.frameFiltEn) { - *value |= (radio_value_t)RADIO_RX_MODE_ADDRESS_FILTER; - } - if(cmd_rx.frameFiltOpt.autoAckEn) { - *value |= (radio_value_t)RADIO_RX_MODE_AUTOACK; - } - if(ieee_radio.poll_mode) { - *value |= (radio_value_t)RADIO_RX_MODE_POLL_MODE; - } - return RADIO_RESULT_OK; - - /* TX mode */ - case RADIO_PARAM_TX_MODE: - *value = 0; - return RADIO_RESULT_OK; - - /* TX power */ - case RADIO_PARAM_TXPOWER: - res = rf_get_tx_power(ieee_radio.rf_handle, rf_tx_power_table, (int8_t *)&value); - return ((res == RF_RESULT_OK) && - (*value != RF_TxPowerTable_INVALID_DBM)) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - - /* CCA threshold */ - case RADIO_PARAM_CCA_THRESHOLD: - *value = cmd_rx.ccaRssiThr; - return RADIO_RESULT_OK; - - /* RSSI */ - case RADIO_PARAM_RSSI: - *value = RF_getRssi(ieee_radio.rf_handle); - return (*value == RF_GET_RSSI_ERROR_VAL) - ? RADIO_RESULT_ERROR - : RADIO_RESULT_OK; - - /* Channel min */ - case RADIO_CONST_CHANNEL_MIN: - *value = (radio_value_t)DOT_15_4G_CHAN_MIN; - return RADIO_RESULT_OK; - - /* Channel max */ - case RADIO_CONST_CHANNEL_MAX: - *value = (radio_value_t)DOT_15_4G_CHAN_MAX; - return RADIO_RESULT_OK; - - case RADIO_CONST_TXPOWER_MIN: - *value = (radio_value_t)tx_power_min(rf_tx_power_table); - return RADIO_RESULT_OK; - - /* TX power max */ - case RADIO_CONST_TXPOWER_MAX: - *value = (radio_value_t)tx_power_max(rf_tx_power_table, rf_tx_power_table_size); - return RADIO_RESULT_OK; - - /* Last RSSI */ - case RADIO_PARAM_LAST_RSSI: - *value = (radio_value_t)ieee_radio.last.rssi; - return RADIO_RESULT_OK; - - /* Last link quality */ - case RADIO_PARAM_LAST_LINK_QUALITY: - *value = (radio_value_t)ieee_radio.last.corr_lqi; - return RADIO_RESULT_OK; - - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - rf_result_t res; - - switch(param) { - - /* Power Mode */ - case RADIO_PARAM_POWER_MODE: - - if(value == RADIO_POWER_MODE_ON) { - return (on() == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - } else if(value == RADIO_POWER_MODE_OFF) { - off(); - return RADIO_RESULT_OK; - } - - return RADIO_RESULT_INVALID_VALUE; - - /* Channel */ - case RADIO_PARAM_CHANNEL: - if(!dot_15_4g_chan_in_range(value)) { - return RADIO_RESULT_INVALID_VALUE; - } - set_channel((uint8_t)value); - return RADIO_RESULT_OK; - - /* PAN ID */ - case RADIO_PARAM_PAN_ID: - cmd_rx.localPanID = (uint16_t)value; - if(!ieee_radio.rf_is_on) { - return RADIO_RESULT_OK; - } - - netstack_stop_rx(); - res = netstack_sched_rx(false); - return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - - /* 16bit address */ - case RADIO_PARAM_16BIT_ADDR: - cmd_rx.localShortAddr = (uint16_t)value; - if(!ieee_radio.rf_is_on) { - return RADIO_RESULT_OK; - } - - netstack_stop_rx(); - res = netstack_sched_rx(false); - return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - - /* RX Mode */ - case RADIO_PARAM_RX_MODE: { - if(value & ~(RADIO_RX_MODE_ADDRESS_FILTER | - RADIO_RX_MODE_AUTOACK | - RADIO_RX_MODE_POLL_MODE)) { - return RADIO_RESULT_INVALID_VALUE; - } - - cmd_rx.frameFiltOpt.frameFiltEn = (value & RADIO_RX_MODE_ADDRESS_FILTER) != 0; - cmd_rx.frameFiltOpt.frameFiltStop = 1; - cmd_rx.frameFiltOpt.autoAckEn = (value & RADIO_RX_MODE_AUTOACK) != 0; - cmd_rx.frameFiltOpt.slottedAckEn = 0; - cmd_rx.frameFiltOpt.autoPendEn = 0; - cmd_rx.frameFiltOpt.defaultPend = 0; - cmd_rx.frameFiltOpt.bPendDataReqOnly = 0; - cmd_rx.frameFiltOpt.bPanCoord = 0; - cmd_rx.frameFiltOpt.bStrictLenFilter = 0; - - const bool old_poll_mode = ieee_radio.poll_mode; - ieee_radio.poll_mode = (value & RADIO_RX_MODE_POLL_MODE) != 0; - if(old_poll_mode == ieee_radio.poll_mode) { - /* Do not turn the radio off and on, just send an update command */ - memcpy(&cmd_mod_filt.newFrameFiltOpt, &(rf_cmd_ieee_rx.frameFiltOpt), sizeof(rf_cmd_ieee_rx.frameFiltOpt)); - const RF_Stat stat = RF_runImmediateCmd(ieee_radio.rf_handle, (uint32_t *)&cmd_mod_filt); - if(stat != RF_StatCmdDoneSuccess) { - LOG_ERR("Setting address filter failed, stat=0x%02X\n", stat); - return RADIO_RESULT_ERROR; - } - return RADIO_RESULT_OK; - } - if(!ieee_radio.rf_is_on) { - return RADIO_RESULT_OK; - } - - netstack_stop_rx(); - res = netstack_sched_rx(false); - return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - } - - /* TX Mode */ - case RADIO_PARAM_TX_MODE: - if(value & ~(RADIO_TX_MODE_SEND_ON_CCA)) { - return RADIO_RESULT_INVALID_VALUE; - } - set_send_on_cca((value & RADIO_TX_MODE_SEND_ON_CCA) != 0); - return RADIO_RESULT_OK; - - /* TX Power */ - case RADIO_PARAM_TXPOWER: - if(!tx_power_in_range((int8_t)value, rf_tx_power_table, rf_tx_power_table_size)) { - return RADIO_RESULT_INVALID_VALUE; - } - res = rf_set_tx_power(ieee_radio.rf_handle, rf_tx_power_table, (int8_t)value); - return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - - /* CCA Threshold */ - case RADIO_PARAM_CCA_THRESHOLD: - cmd_rx.ccaRssiThr = (int8_t)value; - if(!ieee_radio.rf_is_on) { - return RADIO_RESULT_OK; - } - - netstack_stop_rx(); - res = netstack_sched_rx(false); - return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - if(!dest) { - return RADIO_RESULT_INVALID_VALUE; - } - - switch(param) { - /* 64bit address */ - case RADIO_PARAM_64BIT_ADDR: { - const size_t srcSize = sizeof(cmd_rx.localExtAddr); - if(size != srcSize) { - return RADIO_RESULT_INVALID_VALUE; - } - - const uint8_t *pSrc = (uint8_t *)&(cmd_rx.localExtAddr); - uint8_t *pDest = dest; - for(size_t i = 0; i < srcSize; ++i) { - pDest[i] = pSrc[srcSize - 1 - i]; - } - - return RADIO_RESULT_OK; - } - /* Last packet timestamp */ - case RADIO_PARAM_LAST_PACKET_TIMESTAMP: - if(size != sizeof(rtimer_clock_t)) { - return RADIO_RESULT_INVALID_VALUE; - } - - *(rtimer_clock_t *)dest = ieee_radio.last.timestamp; - - return RADIO_RESULT_OK; - - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - rf_result_t res; - - if(!src) { - return RADIO_RESULT_INVALID_VALUE; - } - - switch(param) { - /* 64-bit address */ - case RADIO_PARAM_64BIT_ADDR: { - const size_t destSize = sizeof(cmd_rx.localExtAddr); - if(size != destSize) { - return RADIO_RESULT_INVALID_VALUE; - } - - const uint8_t *pSrc = (const uint8_t *)src; - volatile uint8_t *pDest = (uint8_t *)&(cmd_rx.localExtAddr); - for(size_t i = 0; i < destSize; ++i) { - pDest[i] = pSrc[destSize - 1 - i]; - } - - if(!rx_is_active()) { - return RADIO_RESULT_OK; - } - - netstack_stop_rx(); - res = netstack_sched_rx(false); - return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - } - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -const struct radio_driver ieee_mode_driver = { - init, - prepare, - transmit, - send, - read, - channel_clear, - receiving_packet, - pending_packet, - on, - off, - get_value, - set_value, - get_object, - set_object, -}; -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/prop-mode.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf/prop-mode.c deleted file mode 100644 index 241ae986d..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/prop-mode.c +++ /dev/null @@ -1,726 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf - * @{ - * - * \defgroup cc13xx-cc26xx-rf-prop Prop-mode driver for CC13xx/CC26xx - * - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx prop-mode NETSTACK_RADIO driver. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "net/packetbuf.h" -#include "net/netstack.h" -#include "sys/energest.h" -#include "sys/clock.h" -#include "sys/rtimer.h" -#include "sys/cc.h" -#include "dev/watchdog.h" -/*---------------------------------------------------------------------------*/ -/* RF Core Mailbox API */ -#include -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_data_entry.h) -#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h) - -#include -/*---------------------------------------------------------------------------*/ -/* Platform RF dev */ -#include "rf/rf.h" -#include "rf/dot-15-4g.h" -#include "rf/sched.h" -#include "rf/data-queue.h" -#include "rf/tx-power.h" -#include "rf/settings.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Radio" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -#undef CLAMP -#define CLAMP(v, vmin, vmax) (MAX(MIN(v, vmax), vmin)) -/*---------------------------------------------------------------------------*/ -/* Configuration parameters */ -#define PROP_MODE_DYN_WHITENER PROP_MODE_CONF_DW -#define PROP_MODE_USE_CRC16 PROP_MODE_CONF_USE_CRC16 -#define PROP_MODE_CENTER_FREQ PROP_MODE_CONF_CENTER_FREQ -#define PROP_MODE_LO_DIVIDER PROP_MODE_CONF_LO_DIVIDER -#define PROP_MODE_CCA_RSSI_THRESHOLD PROP_MODE_CONF_CCA_RSSI_THRESHOLD -/*---------------------------------------------------------------------------*/ -/* Used for checking result of CCA_REQ command */ -typedef enum { - CCA_STATE_IDLE = 0, - CCA_STATE_BUSY = 1, - CCA_STATE_INVALID = 2 -} cca_state_t; -/*---------------------------------------------------------------------------*/ -/* Defines and variables related to the .15.4g PHY HDR */ -#define DOT_4G_MAX_FRAME_LEN 2047 -#define DOT_4G_PHR_LEN 2 - -/* PHY HDR bits */ -#define DOT_4G_PHR_CRC16 0x10 -#define DOT_4G_PHR_DW 0x08 - -#if PROP_MODE_USE_CRC16 -/* CRC16 */ -#define DOT_4G_PHR_CRC_BIT DOT_4G_PHR_CRC16 -#define CRC_LEN 2 -#else -/* CRC32 */ -#define DOT_4G_PHR_CRC_BIT 0 -#define CRC_LEN 4 -#endif /* PROP_MODE_USE_CRC16 */ - -#if PROP_MODE_DYN_WHITENER -#define DOT_4G_PHR_DW_BIT DOT_4G_PHR_DW -#else -#define DOT_4G_PHR_DW_BIT 0 -#endif -/*---------------------------------------------------------------------------*/ -/* How long to wait for the RF to enter RX in rf_cmd_ieee_rx */ -#define TIMEOUT_ENTER_RX_WAIT (RTIMER_SECOND >> 10) - -/* How long to wait for the rx read entry to become ready */ -#define TIMEOUT_DATA_ENTRY_BUSY (RTIMER_SECOND / 250) -/*---------------------------------------------------------------------------*/ -/* TX buf configuration */ -#define TX_BUF_HDR_LEN 2 -#define TX_BUF_PAYLOAD_LEN 180 - -#define TX_BUF_SIZE (TX_BUF_HDR_LEN + TX_BUF_PAYLOAD_LEN) -/*---------------------------------------------------------------------------*/ -/* Size of the Length field in Data Entry, two bytes in this case */ -typedef uint16_t lensz_t; - -#define FRAME_OFFSET sizeof(lensz_t) -#define FRAME_SHAVE 2 /**< RSSI (1) + Status (1) */ -/*---------------------------------------------------------------------------*/ -/* Constants used when calculating the LQI from the RSSI */ -#define RX_SENSITIVITY_DBM -110 -#define RX_SATURATION_DBM 10 -#define ED_MIN_DBM_ABOVE_RX_SENSITIVITY 10 -#define ED_MAX 0xFF - -#define ED_RF_POWER_MIN_DBM (RX_SENSITIVITY_DBM + ED_MIN_DBM_ABOVE_RX_SENSITIVITY) -#define ED_RF_POWER_MAX_DBM RX_SATURATION_DBM -/*---------------------------------------------------------------------------*/ -/* RF Core typedefs */ -typedef rfc_propRxOutput_t rx_output_t; - -typedef struct { - /* Outgoing frame buffer */ - uint8_t tx_buf[TX_BUF_SIZE] CC_ALIGN(4); - - /* RX Statistics struct */ - rx_output_t rx_stats; - - /* RSSI Threshold */ - int8_t rssi_threshold; - uint16_t channel; - - /* Indicates RF is supposed to be on or off */ - uint8_t rf_is_on; - - /* RF driver */ - RF_Handle rf_handle; -} prop_radio_t; - -static prop_radio_t prop_radio; -/*---------------------------------------------------------------------------*/ -/* Convenience macros for volatile access with the RF commands */ -#define cmd_radio_setup (*(volatile rfc_CMD_PROP_RADIO_DIV_SETUP_t *)&rf_cmd_prop_radio_div_setup) -#define cmd_fs (*(volatile rfc_CMD_FS_t *) &rf_cmd_prop_fs) -#define cmd_tx (*(volatile rfc_CMD_PROP_TX_ADV_t *) &rf_cmd_prop_tx_adv) -#define cmd_rx (*(volatile rfc_CMD_PROP_RX_ADV_t *) &rf_cmd_prop_rx_adv) -/*---------------------------------------------------------------------------*/ -static inline bool -tx_is_active(void) -{ - return cmd_tx.status == ACTIVE; -} -/*---------------------------------------------------------------------------*/ -static inline bool -rx_is_active(void) -{ - return cmd_rx.status == ACTIVE; -} -/*---------------------------------------------------------------------------*/ -static int on(void); -static int off(void); -/*---------------------------------------------------------------------------*/ -static void -init_rf_params(void) -{ - cmd_radio_setup.config.frontEndMode = RF_SUB_1_GHZ_FRONT_END_MODE; - cmd_radio_setup.config.biasMode = RF_SUB_1_GHZ_BIAS_MODE; - cmd_radio_setup.centerFreq = PROP_MODE_CENTER_FREQ; - cmd_radio_setup.loDivider = PROP_MODE_LO_DIVIDER; - - data_queue_t *data_queue = data_queue_init(sizeof(lensz_t)); - - cmd_rx.maxPktLen = DOT_4G_MAX_FRAME_LEN - cmd_rx.lenOffset; - cmd_rx.pQueue = data_queue; - cmd_rx.pOutput = (uint8_t *)&prop_radio.rx_stats; -} -/*---------------------------------------------------------------------------*/ -static int8_t -get_rssi(void) -{ - rf_result_t res; - bool stop_rx = false; - int8_t rssi = RF_GET_RSSI_ERROR_VAL; - - /* RX is required to be running in order to do a RSSI measurement */ - if(!rx_is_active()) { - /* If RX is not pending, i.e. soon to be running, schedule the RX command */ - if(cmd_rx.status != PENDING) { - res = netstack_sched_rx(false); - if(res != RF_RESULT_OK) { - LOG_ERR("RSSI measurement failed to schedule RX\n"); - return res; - } - - /* We only stop RX if we had to schedule it */ - stop_rx = true; - } - - /* Make sure RX is running before we continue, unless we timeout and fail */ - RTIMER_BUSYWAIT_UNTIL(!rx_is_active(), TIMEOUT_ENTER_RX_WAIT); - - if(!rx_is_active()) { - LOG_ERR("RSSI measurement failed to turn on RX, RX status=0x%04X\n", cmd_rx.status); - return RF_RESULT_ERROR; - } - } - - /* Perform the RSSI measurement */ - rssi = RF_getRssi(prop_radio.rf_handle); - - if(stop_rx) { - netstack_stop_rx(); - } - - return rssi; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -get_channel(void) -{ - uint32_t freq_khz = cmd_fs.frequency * 1000; - - /* - * For some channels, fractFreq * 1000 / 65536 will return 324.99xx. - * Casting the result to uint32_t will truncate decimals resulting in the - * function returning channel - 1 instead of channel. Thus, we do a quick - * positive integer round up. - */ - freq_khz += (((cmd_fs.fractFreq * 1000) + 65535) / 65536); - - return (uint8_t)((freq_khz - DOT_15_4G_CHAN0_FREQ) / DOT_15_4G_FREQ_SPACING); -} -/*---------------------------------------------------------------------------*/ -static rf_result_t -set_channel(uint16_t channel) -{ - rf_result_t res; - - if(!dot_15_4g_chan_in_range(channel)) { - LOG_WARN("Supplied hannel %d is illegal, defaults to %d\n", - (int)channel, DOT_15_4G_DEFAULT_CHAN); - channel = DOT_15_4G_DEFAULT_CHAN; - } - - if(channel == prop_radio.channel) { - /* We are already calibrated to this channel */ - return RF_RESULT_OK; - } - - const uint32_t new_freq = dot_15_4g_freq(channel); - const uint16_t freq = (uint16_t)(new_freq / 1000); - const uint16_t frac = (uint16_t)(((new_freq - (freq * 1000)) * 0x10000) / 1000); - - LOG_DBG("Set channel to %d, frequency 0x%04X.0x%04X (%lu)\n", - (int)channel, freq, frac, new_freq); - - cmd_fs.frequency = freq; - cmd_fs.fractFreq = frac; - - res = netstack_sched_fs(); - - if(res != RF_RESULT_OK) { - return res; - } - - prop_radio.channel = channel; - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -calculate_lqi(int8_t rssi) -{ - /* - * Note : Currently the LQI value is simply the energy detect measurement. - * A more accurate value could be derived by using the correlation - * value along with the RSSI value. - */ - rssi = CLAMP(rssi, ED_RF_POWER_MIN_DBM, ED_RF_POWER_MAX_DBM); - - /* - * Create energy detect measurement by normalizing and scaling RF power level. - * Note : The division operation below is designed for maximum accuracy and - * best granularity. This is done by grouping the math operations to - * compute the entire numerator before doing any division. - */ - return (ED_MAX * (rssi - ED_RF_POWER_MIN_DBM)) / (ED_RF_POWER_MAX_DBM - ED_RF_POWER_MIN_DBM); -} -/*---------------------------------------------------------------------------*/ -static int -prepare(const void *payload, unsigned short payload_len) -{ - const size_t len = MIN((size_t)payload_len, - (size_t)TX_BUF_PAYLOAD_LEN); - - memcpy(prop_radio.tx_buf + TX_BUF_HDR_LEN, payload, len); - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -transmit(unsigned short transmit_len) -{ - rf_result_t res; - - if(tx_is_active()) { - LOG_ERR("A transmission is already active\n"); - return RADIO_TX_ERR; - } - - /* Length in .15.4g PHY HDR. Includes the CRC but not the HDR itself */ - const uint16_t total_length = transmit_len + CRC_LEN; - /* - * Prepare the .15.4g PHY header - * MS=0, Length MSBits=0, DW and CRC configurable - * Total length = transmit_len (payload) + CRC length - * - * The Radio will flip the bits around, so tx_buf[0] must have the length - * LSBs (PHR[15:8] and tx_buf[1] will have PHR[7:0] - */ - prop_radio.tx_buf[0] = ((total_length >> 0) & 0xFF); - prop_radio.tx_buf[1] = ((total_length >> 8) & 0xFF) + DOT_4G_PHR_DW_BIT + DOT_4G_PHR_CRC_BIT; - - /* pktLen: Total number of bytes in the TX buffer, including the header if - * one exists, but not including the CRC (which is not present in the buffer) */ - cmd_tx.pktLen = transmit_len + DOT_4G_PHR_LEN; - cmd_tx.pPkt = prop_radio.tx_buf; - - res = netstack_sched_prop_tx(); - - return (res == RF_RESULT_OK) - ? RADIO_TX_OK - : RADIO_TX_ERR; -} -/*---------------------------------------------------------------------------*/ -static int -send(const void *payload, unsigned short payload_len) -{ - prepare(payload, payload_len); - return transmit(payload_len); -} -/*---------------------------------------------------------------------------*/ -static int -read(void *buf, unsigned short buf_len) -{ - volatile data_entry_t *data_entry = data_queue_current_entry(); - - const rtimer_clock_t t0 = RTIMER_NOW(); - /* Only wait if the Radio is accessing the entry */ - while((data_entry->status == DATA_ENTRY_BUSY) && - RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_DATA_ENTRY_BUSY)) ; - - if(data_entry->status != DATA_ENTRY_FINISHED) { - /* No available data */ - return -1; - } - - /* - * lensz bytes (2) in the data entry are the length of the received frame. - * Data frame is on the following format: - * Length (2) + Payload (N) + RSSI (1) + Status (1) - * Data frame DOES NOT contain the following: - * no Header/PHY bytes - * no appended Received CRC bytes - * no Timestamp bytes - * Visual representation of frame format: - * - * +---------+---------+--------+--------+ - * | 2 bytes | N bytes | 1 byte | 1 byte | - * +---------+---------+--------+--------+ - * | Length | Payload | RSSI | Status | - * +---------+---------+--------+--------+ - * - * Length bytes equal total length of entire frame excluding itself, - * Length = N + RSSI (1) + Status (1) - * = N + 2 - * N = Length - 2 - */ - uint8_t *const frame_ptr = (uint8_t *)&data_entry->data; - const lensz_t frame_len = *(lensz_t *)frame_ptr; - - /* Sanity check that Frame is at least Frame Shave bytes long */ - if(frame_len < FRAME_SHAVE) { - LOG_ERR("Received rame is too short, len=%d\n", frame_len); - - data_queue_release_entry(); - return 0; - } - - const uint8_t *payload_ptr = frame_ptr + sizeof(lensz_t); - const unsigned short payload_len = (unsigned short)(frame_len - FRAME_SHAVE); - - /* Sanity check that Payload fits in Buffer */ - if(payload_len > buf_len) { - LOG_ERR("Payload of received frame is too large for local buffer, len=%d buf_len=%d\n", - payload_len, buf_len); - - data_queue_release_entry(); - return 0; - } - - memcpy(buf, payload_ptr, payload_len); - - /* RSSI stored after payload */ - const int8_t rssi = (int8_t)payload_ptr[payload_len]; - /* LQI calculated from RSSI */ - const uint8_t lqi = calculate_lqi(rssi); - - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, (packetbuf_attr_t)rssi); - packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, (packetbuf_attr_t)lqi); - - data_queue_release_entry(); - return (int)payload_len; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -cca_request(void) -{ - const int8_t rssi = get_rssi(); - - if(rssi == RF_GET_RSSI_ERROR_VAL) { - return CCA_STATE_INVALID; - } - - return (rssi < prop_radio.rssi_threshold) - ? CCA_STATE_IDLE - : CCA_STATE_BUSY; -} -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - if(tx_is_active()) { - LOG_ERR("Channel clear called while in TX\n"); - return 0; - } - - const uint8_t cca_state = cca_request(); - - /* Channel is clear if CCA state is IDLE */ - return cca_state == CCA_STATE_IDLE; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - if(!rx_is_active()) { - return 0; - } - - const uint8_t cca_state = cca_request(); - - return cca_state == CCA_STATE_BUSY; -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - const data_entry_t *const read_entry = data_queue_current_entry(); - volatile const data_entry_t *curr_entry = read_entry; - - int num_pending = 0; - - /* Go through RX Circular buffer and check their status */ - do { - const uint8_t status = curr_entry->status; - if((status == DATA_ENTRY_FINISHED) || - (status == DATA_ENTRY_BUSY)) { - num_pending += 1; - } - - /* Stop when we have looped the circular buffer */ - curr_entry = (data_entry_t *)curr_entry->pNextEntry; - } while(curr_entry != read_entry); - - if(num_pending > 0) { - process_poll(&rf_sched_process); - } - - /* If we didn't find an entry at status finished, no frames are pending */ - return num_pending; -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - rf_result_t res; - - if(prop_radio.rf_is_on) { - LOG_WARN("Radio is already on\n"); - return RF_RESULT_OK; - } - - data_queue_reset(); - - res = netstack_sched_rx(true); - - if(res != RF_RESULT_OK) { - return RF_RESULT_ERROR; - } - - prop_radio.rf_is_on = true; - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - if(!prop_radio.rf_is_on) { - LOG_WARN("Radio is already off\n"); - return RF_RESULT_OK; - } - - rf_yield(); - - prop_radio.rf_is_on = false; - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - rf_result_t res; - - if(!value) { - return RADIO_RESULT_INVALID_VALUE; - } - - switch(param) { - case RADIO_PARAM_POWER_MODE: - /* On / off */ - *value = (prop_radio.rf_is_on) - ? RADIO_POWER_MODE_ON - : RADIO_POWER_MODE_OFF; - - return RADIO_RESULT_OK; - - case RADIO_PARAM_CHANNEL: - *value = (radio_value_t)get_channel(); - return RADIO_RESULT_OK; - - case RADIO_PARAM_TXPOWER: - res = rf_get_tx_power(prop_radio.rf_handle, rf_tx_power_table, (int8_t *)&value); - return ((res == RF_RESULT_OK) && - (*value != RF_TxPowerTable_INVALID_DBM)) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - - case RADIO_PARAM_CCA_THRESHOLD: - *value = prop_radio.rssi_threshold; - return RADIO_RESULT_OK; - - case RADIO_PARAM_RSSI: - *value = get_rssi(); - return (*value == RF_GET_RSSI_ERROR_VAL) - ? RADIO_RESULT_ERROR - : RADIO_RESULT_OK; - - case RADIO_CONST_CHANNEL_MIN: - *value = DOT_15_4G_CHAN_MIN; - return RADIO_RESULT_OK; - - case RADIO_CONST_CHANNEL_MAX: - *value = DOT_15_4G_CHAN_MAX; - return RADIO_RESULT_OK; - - case RADIO_CONST_TXPOWER_MIN: - *value = (radio_value_t)tx_power_min(rf_tx_power_table); - return RADIO_RESULT_OK; - - case RADIO_CONST_TXPOWER_MAX: - *value = (radio_value_t)tx_power_max(rf_tx_power_table, rf_tx_power_table_size); - return RADIO_RESULT_OK; - - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - rf_result_t res; - - switch(param) { - case RADIO_PARAM_POWER_MODE: - - if(value == RADIO_POWER_MODE_ON) { - return (on() == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - } else if(value == RADIO_POWER_MODE_OFF) { - off(); - return RADIO_RESULT_OK; - } - - return RADIO_RESULT_INVALID_VALUE; - - case RADIO_PARAM_CHANNEL: - res = set_channel((uint16_t)value); - return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - - case RADIO_PARAM_TXPOWER: - if(!tx_power_in_range((int8_t)value, rf_tx_power_table, rf_tx_power_table_size)) { - return RADIO_RESULT_INVALID_VALUE; - } - res = rf_set_tx_power(prop_radio.rf_handle, rf_tx_power_table, (int8_t)value); - return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - - case RADIO_PARAM_RX_MODE: - return RADIO_RESULT_OK; - - case RADIO_PARAM_CCA_THRESHOLD: - prop_radio.rssi_threshold = (int8_t)value; - return RADIO_RESULT_OK; - - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static int -init(void) -{ - if(prop_radio.rf_handle) { - LOG_WARN("Radio is already initialized\n"); - return RF_RESULT_OK; - } - - /* RX is off */ - prop_radio.rf_is_on = false; - - /* Set configured RSSI threshold */ - prop_radio.rssi_threshold = PROP_MODE_CCA_RSSI_THRESHOLD; - - init_rf_params(); - - /* Init RF params and specify non-default params */ - RF_Params rf_params; - RF_Params_init(&rf_params); - rf_params.nInactivityTimeout = RF_CONF_INACTIVITY_TIMEOUT; - - /* Open RF Driver */ - prop_radio.rf_handle = netstack_open(&rf_params); - - if(prop_radio.rf_handle == NULL) { - LOG_ERR("Unable to open RF driver during initialization\n"); - return RF_RESULT_ERROR; - } - - set_channel(IEEE802154_DEFAULT_CHANNEL); - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - - /* Start RF process */ - process_start(&rf_sched_process, NULL); - - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -const struct radio_driver prop_mode_driver = { - init, - prepare, - transmit, - send, - read, - channel_clear, - receiving_packet, - pending_packet, - on, - off, - get_value, - set_value, - get_object, - set_object, -}; -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/rf.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf/rf.h deleted file mode 100644 index 65b2b1543..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/rf.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-rf RF specific files for CC13xx/CC26xx - * - * @{ - * - * \file - * Header file of common CC13xx/CC26xx RF functionality. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CORE_H_ -#define RF_CORE_H_ -/*---------------------------------------------------------------------------*/ -/** - * \name Different modes the RF can operate on, denoted by which frequency - * band said mode operates on. Currently supports the following modes: - * - Sub-1 GHz, called prop-mode - * - 2.4 GHz, called ieee-mode - * - * @{ - */ -#define RF_MODE_SUB_1_GHZ (1 << 0) -#define RF_MODE_2_4_GHZ (1 << 1) - -/* Bitmask of supported RF modes */ -#define RF_MODE_BM (RF_MODE_SUB_1_GHZ | \ - RF_MODE_2_4_GHZ) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name The different front-end modes the CC13xx/CC26xx devices support. The - * front-end mode can be configured independently of the bias mode. The - * two types of modes are as follows: - * - Differential: Both RF_P and RF_N are used as a differential RF - * interface. - * - Single ended: Either the RF_P pin or the RF_N pin is used as the - * RF path. - * - * @{ - */ -/* Available front-end mode configurations */ -#define RF_FRONT_END_MODE_DIFFERENTIAL 0 -#define RF_FRONT_END_MODE_SINGLE_ENDED_RFP 1 -#define RF_FRONT_END_MODE_SINGLE_ENDED_RFN 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name The different bias modes the CC13xx/CC26xx devices support. The - * bias mode can be configured independently of the front-end mode. The - * two different modes are as follows: - * - Internal bias: the LNA is biased by an internal bias. - * - External bias: the LNA is biased by an external bias. - * - * @{ - */ -/* Available bias mode configurations */ -#define RF_BIAS_MODE_INTERNAL 0 -#define RF_BIAS_MODE_EXTERNAL 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CORE_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/sched.c b/arch/cpu/simplelink-cc13xx-cc26xx/rf/sched.c deleted file mode 100644 index f15d33d2f..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/sched.c +++ /dev/null @@ -1,728 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf-sched - * @{ - * - * \file - * Implementation of the CC13xx/CC26xx RF scheduler. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/watchdog.h" -#include "sys/cc.h" -#include "sys/etimer.h" -#include "sys/process.h" -#include "sys/energest.h" -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "net/mac/mac.h" -#include "lib/random.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) -#include DeviceFamily_constructPath(driverlib/rf_mailbox.h) -#include DeviceFamily_constructPath(driverlib/rf_ble_mailbox.h) - -#include -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -#include "rf/sched.h" -#include "rf/data-queue.h" -#include "rf/settings.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Radio" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -#define CMD_FS_RETRIES 3 - -#define RF_EVENTS_CMD_DONE (RF_EventCmdDone | RF_EventLastCmdDone | \ - RF_EventFGCmdDone | RF_EventLastFGCmdDone) - -#define CMD_STATUS(cmd) (CC_ACCESS_NOW(RF_Op, cmd).status) - -#define CMD_HANDLE_OK(handle) (((handle) != RF_ALLOC_ERROR) && \ - ((handle) != RF_SCHEDULE_CMD_ERROR)) - -#define EVENTS_CMD_DONE(events) (((events) & RF_EVENTS_CMD_DONE) != 0) -/*---------------------------------------------------------------------------*/ -/* BLE advertisement channel range (inclusive) */ -#define BLE_ADV_CHANNEL_MIN 37 -#define BLE_ADV_CHANNEL_MAX 39 - -/* Number of BLE advertisement channels */ -#define NUM_BLE_ADV_CHANNELS (BLE_ADV_CHANNEL_MAX - BLE_ADV_CHANNEL_MIN + 1) -/*---------------------------------------------------------------------------*/ -/* Synth re-calibration every 3 minutes */ -#define SYNTH_RECAL_INTERVAL (CLOCK_SECOND * 60 * 3) -/* Set re-calibration interval with a jitter of 10 seconds */ -#define SYNTH_RECAL_JITTER (CLOCK_SECOND * 10) - -static struct etimer synth_recal_timer; -/*---------------------------------------------------------------------------*/ -#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) -typedef rfc_CMD_BLE_ADV_NC_t ble_cmd_adv_nc_t; -#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2) -typedef rfc_CMD_BLE5_ADV_NC_t ble_cmd_adv_nc_t; -#endif -/*---------------------------------------------------------------------------*/ -static RF_Object rf_netstack; - -#if RF_CONF_BLE_BEACON_ENABLE -static RF_Object rf_ble; -#endif - -static RF_CmdHandle cmd_rx_handle; - -static bool rf_is_on; -static volatile bool rx_buf_full; -/*---------------------------------------------------------------------------*/ -static void -cmd_rx_cb(RF_Handle client, RF_CmdHandle command, RF_EventMask events) -{ - /* Unused arguments */ - (void)client; - (void)command; - - if(events & RF_EventRxEntryDone) { - process_poll(&rf_sched_process); - } - - if(events & RF_EventRxBufFull) { - rx_buf_full = true; - process_poll(&rf_sched_process); - } -} -/*---------------------------------------------------------------------------*/ -static inline clock_time_t -synth_recal_interval(void) -{ - /* - * Add jitter centered around SYNTH_RECAL_INTERVAL, giving a plus/minus - * jitter seconds halved. - */ - return SYNTH_RECAL_INTERVAL + (random_rand() % SYNTH_RECAL_JITTER) - (SYNTH_RECAL_JITTER / 2); -} -/*---------------------------------------------------------------------------*/ -static inline bool -cmd_rx_is_active(void) -{ - /* - * Active in this case means RX command is either running to be running, - * that is ACTIVE for running or PENDING for to be running. - */ - const uint16_t status = CMD_STATUS(netstack_cmd_rx); - return (status == ACTIVE) || - (status == PENDING); -} -/*---------------------------------------------------------------------------*/ -static uint_fast8_t -cmd_rx_disable(void) -{ - const bool is_active = cmd_rx_is_active(); - - if(is_active) { - CMD_STATUS(netstack_cmd_rx) = DONE_STOPPED; - RF_cancelCmd(&rf_netstack, cmd_rx_handle, RF_ABORT_GRACEFULLY); - cmd_rx_handle = 0; - } - - return (uint_fast8_t)is_active; -} -/*---------------------------------------------------------------------------*/ -static rf_result_t -cmd_rx_restore(uint_fast8_t rx_key) -{ - const bool was_active = (rx_key != 0) ? true : false; - - if(!was_active) { - return RF_RESULT_OK; - } - - RF_ScheduleCmdParams sched_params; - RF_ScheduleCmdParams_init(&sched_params); - - sched_params.priority = RF_PriorityNormal; - sched_params.endTime = 0; - sched_params.allowDelay = RF_AllowDelayAny; - - CMD_STATUS(netstack_cmd_rx) = PENDING; - - cmd_rx_handle = RF_scheduleCmd( - &rf_netstack, - (RF_Op *)&netstack_cmd_rx, - &sched_params, - cmd_rx_cb, - RF_EventRxEntryDone | RF_EventRxBufFull); - - if(!CMD_HANDLE_OK(cmd_rx_handle)) { - LOG_ERR("Unable to restore RX command, handle=%d status=0x%04x", - cmd_rx_handle, CMD_STATUS(netstack_cmd_rx)); - return RF_RESULT_ERROR; - } - - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -rf_result_t -rf_yield(void) -{ - /* Force abort of any ongoing RF operation */ - RF_flushCmd(&rf_netstack, RF_CMDHANDLE_FLUSH_ALL, RF_ABORT_GRACEFULLY); -#if RF_CONF_BLE_BEACON_ENABLE - RF_flushCmd(&rf_ble, RF_CMDHANDLE_FLUSH_ALL, RF_ABORT_GRACEFULLY); -#endif - - /* Trigger a manual power-down */ - RF_yield(&rf_netstack); -#if RF_CONF_BLE_BEACON_ENABLE - RF_yield(&rf_ble); -#endif - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - - etimer_stop(&synth_recal_timer); - rf_is_on = false; - - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -rf_result_t -rf_set_tx_power(RF_Handle handle, RF_TxPowerTable_Entry *table, int8_t dbm) -{ - const RF_Stat stat = RF_setTxPower(handle, RF_TxPowerTable_findValue(table, dbm)); - - return (stat == RF_StatSuccess) - ? RF_RESULT_OK - : RF_RESULT_ERROR; -} -/*---------------------------------------------------------------------------*/ -rf_result_t -rf_get_tx_power(RF_Handle handle, RF_TxPowerTable_Entry *table, int8_t *dbm) -{ - *dbm = RF_TxPowerTable_findPowerLevel(table, RF_getTxPower(handle)); - - return (*dbm != RF_TxPowerTable_INVALID_DBM) - ? RF_RESULT_OK - : RF_RESULT_ERROR; -} -/*---------------------------------------------------------------------------*/ -RF_Handle -netstack_open(RF_Params *params) -{ - return RF_open(&rf_netstack, &netstack_mode, (RF_RadioSetup *)&netstack_cmd_radio_setup, params); -} -/*---------------------------------------------------------------------------*/ -rf_result_t -netstack_sched_fs(void) -{ - const uint_fast8_t rx_key = cmd_rx_disable(); - - /* - * For IEEE-mode, restarting CMD_IEEE_RX re-calibrates the synth by using the - * channel field in the CMD_IEEE_RX command. It is assumed this field is - * already configured before this function is called. However, if - * CMD_IEEE_RX wasn't active, manually calibrate the synth with CMD_FS. - * - * For Prop-mode, the synth is always manually calibrated with CMD_FS. - */ -#if (RF_MODE == RF_CORE_MODE_2_4_GHZ) - if(rx_key) { - cmd_rx_restore(rx_key); - return RF_RESULT_OK; - } -#endif /* RF_MODE == RF_CORE_MODE_2_4_GHZ */ - - RF_EventMask events; - bool synth_error = false; - uint8_t num_tries = 0; - - do { - CMD_STATUS(netstack_cmd_fs) = PENDING; - - events = RF_runCmd( - &rf_netstack, - (RF_Op *)&netstack_cmd_fs, - RF_PriorityNormal, - NULL, - 0); - - synth_error = (EVENTS_CMD_DONE(events)) && (CMD_STATUS(netstack_cmd_fs) == ERROR_SYNTH_PROG); - - } while(synth_error && (num_tries++ < CMD_FS_RETRIES)); - - cmd_rx_restore(rx_key); - - return (CMD_STATUS(netstack_cmd_fs) == DONE_OK) - ? RF_RESULT_OK - : RF_RESULT_ERROR; -} -/*---------------------------------------------------------------------------*/ -rf_result_t -netstack_sched_ieee_tx(bool ack_request) -{ - rf_result_t res; - - RF_ScheduleCmdParams sched_params; - RF_ScheduleCmdParams_init(&sched_params); - - sched_params.priority = RF_PriorityNormal; - sched_params.endTime = 0; - sched_params.allowDelay = RF_AllowDelayAny; - - const bool rx_is_active = cmd_rx_is_active(); - const bool rx_needed = (ack_request && !rx_is_active); - - /* - * If we expect ACK after transmission, RX must be running to be able to - * run the RX_ACK command. Therefore, turn on RX before starting the - * chained TX command. - */ - if(rx_needed) { - res = netstack_sched_rx(false); - if(res != RF_RESULT_OK) { - return res; - } - } - - CMD_STATUS(netstack_cmd_tx) = PENDING; - - RF_CmdHandle tx_handle = RF_scheduleCmd( - &rf_netstack, - (RF_Op *)&netstack_cmd_tx, - &sched_params, - NULL, - 0); - - if(!CMD_HANDLE_OK(tx_handle)) { - LOG_ERR("Unable to schedule TX command, handle=%d status=0x%04x\n", - tx_handle, CMD_STATUS(netstack_cmd_tx)); - return RF_RESULT_ERROR; - } - - if(rx_is_active) { - ENERGEST_SWITCH(ENERGEST_TYPE_LISTEN, ENERGEST_TYPE_TRANSMIT); - } else { - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - } - - /* Wait until TX operation finishes */ - RF_EventMask tx_events = RF_pendCmd(&rf_netstack, tx_handle, 0); - - /* Stop RX if it was turned on only for ACK */ - if(rx_needed) { - netstack_stop_rx(); - } - - if(rx_is_active) { - ENERGEST_SWITCH(ENERGEST_TYPE_TRANSMIT, ENERGEST_TYPE_LISTEN); - } else { - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - } - - if(!EVENTS_CMD_DONE(tx_events)) { - LOG_ERR("Pending on TX comand generated error, events=0x%08llx status=0x%04x\n", - tx_events, CMD_STATUS(netstack_cmd_tx)); - return RF_RESULT_ERROR; - } - - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -rf_result_t -netstack_sched_prop_tx(void) -{ - RF_ScheduleCmdParams sched_params; - RF_ScheduleCmdParams_init(&sched_params); - - sched_params.priority = RF_PriorityNormal; - sched_params.endTime = 0; - sched_params.allowDelay = RF_AllowDelayAny; - - CMD_STATUS(netstack_cmd_tx) = PENDING; - - RF_CmdHandle tx_handle = RF_scheduleCmd( - &rf_netstack, - (RF_Op *)&netstack_cmd_tx, - &sched_params, - NULL, - 0); - - if(!CMD_HANDLE_OK(tx_handle)) { - LOG_ERR("Unable to schedule TX command, handle=%d status=0x%04x\n", - tx_handle, CMD_STATUS(netstack_cmd_tx)); - return RF_RESULT_ERROR; - } - - /* - * Prop TX requires any on-going RX operation to be stopped to be - * able to transmit. Therefore, disable RX if running. - */ - const bool rx_key = cmd_rx_disable(); - - if(rx_key) { - ENERGEST_SWITCH(ENERGEST_TYPE_LISTEN, ENERGEST_TYPE_TRANSMIT); - } else { - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - } - - /* Wait until TX operation finishes */ - RF_EventMask tx_events = RF_pendCmd(&rf_netstack, tx_handle, 0); - - cmd_rx_restore(rx_key); - - if(rx_key) { - ENERGEST_SWITCH(ENERGEST_TYPE_TRANSMIT, ENERGEST_TYPE_LISTEN); - } else { - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - } - - if(!EVENTS_CMD_DONE(tx_events)) { - LOG_ERR("Pending on scheduled TX command generated error, events=0x%08llx status=0x%04x\n", - tx_events, CMD_STATUS(netstack_cmd_tx)); - return RF_RESULT_ERROR; - } - - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -rf_result_t -netstack_sched_rx(bool start) -{ - if(cmd_rx_is_active()) { - LOG_WARN("Already in RX when scheduling RX\n"); - return RF_RESULT_OK; - } - - RF_ScheduleCmdParams sched_params; - RF_ScheduleCmdParams_init(&sched_params); - - sched_params.priority = RF_PriorityNormal; - sched_params.endTime = 0; - sched_params.allowDelay = RF_AllowDelayAny; - - CMD_STATUS(netstack_cmd_rx) = PENDING; - - cmd_rx_handle = RF_scheduleCmd( - &rf_netstack, - (RF_Op *)&netstack_cmd_rx, - &sched_params, - cmd_rx_cb, - RF_EventRxEntryDone | RF_EventRxBufFull); - - if(!CMD_HANDLE_OK(cmd_rx_handle)) { - LOG_ERR("Unable to schedule RX command, handle=%d status=0x%04x\n", - cmd_rx_handle, CMD_STATUS(netstack_cmd_rx)); - return RF_RESULT_ERROR; - } - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - - if(start) { - rf_is_on = true; - process_poll(&rf_sched_process); - } - - return RF_RESULT_OK; -} -/*---------------------------------------------------------------------------*/ -rf_result_t -netstack_stop_rx(void) -{ - if(!cmd_rx_is_active()) { - LOG_WARN("RX not active when stopping RX\n"); - return RF_RESULT_OK; - } - - CMD_STATUS(netstack_cmd_rx) = DONE_STOPPED; - const RF_Stat stat = RF_cancelCmd(&rf_netstack, cmd_rx_handle, RF_ABORT_GRACEFULLY); - cmd_rx_handle = 0; - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - - return (stat == RF_StatSuccess) - ? RF_RESULT_OK - : RF_RESULT_ERROR; -} -/*---------------------------------------------------------------------------*/ -RF_Handle -ble_open(RF_Params *params) -{ -#if RF_CONF_BLE_BEACON_ENABLE - return RF_open(&rf_ble, &ble_mode, (RF_RadioSetup *)&ble_cmd_radio_setup, params); - -#else - return (RF_Handle)NULL; -#endif -} -/*---------------------------------------------------------------------------*/ -#if RF_CONF_BLE_BEACON_ENABLE -static RF_Op * -init_ble_adv_array(ble_cmd_adv_nc_t *ble_adv_array, uint8_t bm_channel) -{ - RF_Op *first_ble_adv = NULL; - ble_cmd_adv_nc_t *cmd_adv_37 = &ble_adv_array[0]; - ble_cmd_adv_nc_t *cmd_adv_38 = &ble_adv_array[1]; - ble_cmd_adv_nc_t *cmd_adv_39 = &ble_adv_array[2]; - - /* Setup channel 37 advertisement if enabled */ - if(bm_channel & BLE_ADV_CHANNEL_37) { - /* Default configurations from ble_cmd_adv_nc */ - memcpy(cmd_adv_37, &ble_cmd_adv_nc, sizeof(ble_cmd_adv_nc)); - - cmd_adv_37->channel = 37; - /* Magic number: initialization for whitener, specific for channel 37 */ - cmd_adv_37->whitening.init = 0x65; - - /* - * The next advertisement is chained depending on whether they are - * enbled or not. If both 38 and 39 are disabled, then there is no - * chaining. - */ - if(bm_channel & BLE_ADV_CHANNEL_38) { - cmd_adv_37->pNextOp = (RF_Op *)cmd_adv_38; - cmd_adv_37->condition.rule = COND_ALWAYS; - } else if(bm_channel & BLE_ADV_CHANNEL_39) { - cmd_adv_37->pNextOp = (RF_Op *)cmd_adv_39; - cmd_adv_37->condition.rule = COND_ALWAYS; - } else { - cmd_adv_37->pNextOp = NULL; - cmd_adv_37->condition.rule = COND_NEVER; - } - - /* Channel 37 will always be first if enabled */ - first_ble_adv = (RF_Op *)cmd_adv_37; - } - - /* Setup channel 38 advertisement if enabled */ - if(bm_channel & BLE_ADV_CHANNEL_38) { - memcpy(cmd_adv_38, &ble_cmd_adv_nc, sizeof(ble_cmd_adv_nc)); - - cmd_adv_38->channel = 38; - /* Magic number: initialization for whitener, specific for channel 38 */ - cmd_adv_38->whitening.init = 0x66; - - /* - * The next advertisement is chained depending on whether they are - * enbled or not. If 39 is disabled, then there is no chaining. - */ - if(bm_channel & BLE_ADV_CHANNEL_39) { - cmd_adv_38->pNextOp = (RF_Op *)cmd_adv_39; - cmd_adv_38->condition.rule = COND_ALWAYS; - } else { - cmd_adv_38->pNextOp = NULL; - cmd_adv_38->condition.rule = COND_NEVER; - } - - /* - * Channel 38 is only first if the first_ble_adv pointer is not - * set by channel 37. - */ - if(first_ble_adv == NULL) { - first_ble_adv = (RF_Op *)cmd_adv_38; - } - } - - /* Setup channel 39 advertisement if enabled */ - if(bm_channel & BLE_ADV_CHANNEL_39) { - memcpy(cmd_adv_39, &ble_cmd_adv_nc, sizeof(ble_cmd_adv_nc)); - - cmd_adv_39->channel = 39; - /* Magic number: initialization for whitener, specific for channel 39 */ - cmd_adv_39->whitening.init = 0x67; - - /* Channel 39 is always the last advertisement in the chain */ - cmd_adv_39->pNextOp = NULL; - cmd_adv_39->condition.rule = COND_NEVER; - - /* - * Channel 39 is only first if the first_ble_adv pointer is not - * set by channel 37 or channel 38. - */ - if(first_ble_adv == NULL) { - first_ble_adv = (RF_Op *)cmd_adv_39; - } - } - - return first_ble_adv; -} -#endif /* RF_CONF_BLE_BEACON_ENABLE */ -/*---------------------------------------------------------------------------*/ -rf_result_t -ble_sched_beacons(uint8_t bm_channel) -{ -#if RF_CONF_BLE_BEACON_ENABLE - /* - * Allocate the advertisement commands on the stack rather than statically - * to RAM in order to save space. We don't need them after the - * advertisements have been transmitted. - */ - ble_cmd_adv_nc_t ble_cmd_adv_nc_array[NUM_BLE_ADV_CHANNELS]; - - RF_Op *initial_adv = NULL; - RF_ScheduleCmdParams sched_params; - RF_CmdHandle beacon_handle; - RF_EventMask beacon_events; - rf_result_t rf_result; - - /* If no channels are mapped, then early return OK */ - if((bm_channel & BLE_ADV_CHANNEL_ALL) == 0) { - return RF_RESULT_OK; - } - - initial_adv = init_ble_adv_array(ble_cmd_adv_nc_array, bm_channel); - - if(initial_adv == NULL) { - LOG_ERR("Initializing BLE Advertisement chain failed\n"); - return RF_RESULT_ERROR; - } - - RF_ScheduleCmdParams_init(&sched_params); - sched_params.priority = RF_PriorityNormal; - sched_params.endTime = 0; - sched_params.allowDelay = RF_AllowDelayAny; - - /* - * The most efficient way to schedule the command is as follows: - * 1. Schedule the BLE advertisement chain - * 2. Reschedule the RX command IF it was running. - * 3. Pend on the BLE avertisement chain - */ - beacon_handle = RF_scheduleCmd( - &rf_ble, - initial_adv, - &sched_params, - NULL, - 0); - - if(!CMD_HANDLE_OK(beacon_handle)) { - LOG_ERR("Unable to schedule BLE Beacon command, handle=%d status=0x%04x\n", - beacon_handle, CMD_STATUS(ble_cmd_adv_nc)); - - return RF_RESULT_ERROR; - } - - /* Note that this only reschedules RX if it is running */ - rf_result = cmd_rx_restore(cmd_rx_disable()); - - /* Wait until Beacon operation finishes */ - beacon_events = RF_pendCmd(&rf_ble, beacon_handle, 0); - - if(rf_result != RF_RESULT_OK) { - LOG_ERR("Rescheduling CMD_RX failed when BLE advertising\n"); - - return RF_RESULT_ERROR; - } - - if(!EVENTS_CMD_DONE(beacon_events)) { - LOG_ERR("Pending on scheduled BLE Beacon command generated error, events=0x%08llx status=0x%04x\n", - beacon_events, CMD_STATUS(ble_cmd_adv_nc)); - - return RF_RESULT_ERROR; - } - - return RF_RESULT_OK; - -#else - return RF_RESULT_ERROR; -#endif -} -/*---------------------------------------------------------------------------*/ -PROCESS(rf_sched_process, "RF Scheduler Process"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(rf_sched_process, ev, data) -{ - int len; - - PROCESS_BEGIN(); - - while(1) { - PROCESS_YIELD_UNTIL((ev == PROCESS_EVENT_POLL) || - (ev == PROCESS_EVENT_TIMER)); - - /* start the synth re-calibration timer once. */ - if(rf_is_on) { - rf_is_on = false; - clock_time_t interval = synth_recal_interval(); - LOG_INFO("Starting synth re-calibration timer, next timeout %lu\n", interval); - etimer_set(&synth_recal_timer, interval); - } - - if(ev == PROCESS_EVENT_POLL) { - do { - watchdog_periodic(); - - packetbuf_clear(); - len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE); - - /* - * RX will stop if the RX buffers are full. In this case, restart - * RX after we've freed at least on packet. - */ - if(rx_buf_full) { - LOG_ERR("RX buffer full, restart RX status=0x%04x\n", CMD_STATUS(netstack_cmd_rx)); - rx_buf_full = false; - - /* Restart RX. */ - netstack_stop_rx(); - netstack_sched_rx(false); - } - - if(len > 0) { - packetbuf_set_datalen(len); - - NETSTACK_MAC.input(); - } - /* Only break when we receive -1 => No available data */ - } while(len >= 0); - } - - /* Scheduling CMD_FS will re-calibrate the synth. */ - if((ev == PROCESS_EVENT_TIMER) && - etimer_expired(&synth_recal_timer)) { - clock_time_t interval = synth_recal_interval(); - LOG_DBG("Re-calibrate synth, next interval %lu\n", interval); - - netstack_sched_fs(); - etimer_set(&synth_recal_timer, interval); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/sched.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf/sched.h deleted file mode 100644 index fe4963036..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/sched.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-rf - * @{ - * - * \defgroup cc13xx-cc26xx-rf-sched RF Scheduler for CC13xx/CC26xx - * - * @{ - * - * \file - * Header file of the CC13xx/CC26xx RF scheduler. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_SCHED_H_ -#define RF_SCHED_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/process.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -PROCESS_NAME(rf_sched_process); -/*---------------------------------------------------------------------------*/ -typedef enum { - RF_RESULT_OK = 0, - RF_RESULT_ERROR, -} rf_result_t; -/*---------------------------------------------------------------------------*/ -typedef enum { - BLE_ADV_CHANNEL_37 = (1 << 0), - BLE_ADV_CHANNEL_38 = (1 << 1), - BLE_ADV_CHANNEL_39 = (1 << 2), - - BLE_ADV_CHANNEL_ALL = (BLE_ADV_CHANNEL_37 | - BLE_ADV_CHANNEL_38 | - BLE_ADV_CHANNEL_39), -} ble_adv_channel_t; -/*---------------------------------------------------------------------------*/ -/** - * \name Common RF scheduler functionality. - * - * @{ - */ -rf_result_t rf_yield(void); -rf_result_t rf_set_tx_power(RF_Handle handle, RF_TxPowerTable_Entry *table, int8_t dbm); -rf_result_t rf_get_tx_power(RF_Handle handle, RF_TxPowerTable_Entry *table, int8_t *dbm); -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Nestack Radio scheduler functionality. - * - * Either for Prop-mode or IEEE-mode Radio driver. - * - * @{ - */ -RF_Handle netstack_open(RF_Params *params); -rf_result_t netstack_sched_fs(void); -rf_result_t netstack_sched_ieee_tx(bool ack_request); -rf_result_t netstack_sched_prop_tx(void); -rf_result_t netstack_sched_rx(bool start); -rf_result_t netstack_stop_rx(void); -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name BLE Radio scheduler functionality. - * - * Only for the BLE Beacon Daemon. - * - * @{ - */ -RF_Handle ble_open(RF_Params *params); -rf_result_t ble_sched_beacons(uint8_t bm_adv_channel); -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_SCHED_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/settings.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf/settings.h deleted file mode 100644 index 1d20fce91..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/settings.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-rf-settings RF settings for CC13xx/CC26xx - * - * @{ - * - * \file - * Header file of RF settings for CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef NETSTACK_SETTINGS_H_ -#define NETSTACK_SETTINGS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -/* Netstack RF command configuration */ - -#if SUPPORTS_PROP_MODE -#include "prop-settings.h" -#endif - -#if SUPPORTS_IEEE_MODE -#include "ieee-settings.h" -#endif - -/* Prop-mode RF settings */ -#if (RF_MODE == RF_MODE_SUB_1_GHZ) - -#define netstack_mode rf_prop_mode -#define netstack_cmd_radio_setup rf_cmd_prop_radio_div_setup -#define netstack_cmd_fs rf_cmd_prop_fs -#define netstack_cmd_tx rf_cmd_prop_tx_adv -#define netstack_cmd_rx rf_cmd_prop_rx_adv - -/* IEEE-mode RF settings */ -#elif (RF_MODE == RF_MODE_2_4_GHZ) - -#define netstack_mode rf_ieee_mode -#define netstack_cmd_radio_setup rf_cmd_ieee_radio_setup -#define netstack_cmd_fs rf_cmd_ieee_fs -#define netstack_cmd_tx rf_cmd_ieee_tx -#define netstack_cmd_rx rf_cmd_ieee_rx - -#endif /* RF_MODE */ -/*---------------------------------------------------------------------------*/ -/* BLE Beacon RF command configuration */ -#if SUPPORTS_BLE_BEACON - -#include "ble-settings.h" - -/* CC13x0/CC26x0 devices */ -#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) - -#define ble_mode rf_ble_mode -#define ble_cmd_radio_setup rf_ble_cmd_radio_setup -#define ble_adv_par rf_ble_adv_par -#define ble_cmd_adv_nc rf_ble_cmd_ble_adv_nc - -/* CC13x2/CC26x2 devices */ -#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2) - -#define ble_mode rf_ble_mode -#define ble_cmd_radio_setup rf_ble_cmd_radio_setup -#define ble_adv_par rf_ble_adv_par -#define ble_cmd_adv_nc rf_ble_cmd_ble_adv_nc - -#endif /* DeviceFamily_PARENT */ - -#endif /* SUPPORTS_BLE_BEACON */ -/*---------------------------------------------------------------------------*/ -#endif /* NETSTACK_SETTINGS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ \ No newline at end of file diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/rf/tx-power.h b/arch/cpu/simplelink-cc13xx-cc26xx/rf/tx-power.h deleted file mode 100644 index 91bab7d6b..000000000 --- a/arch/cpu/simplelink-cc13xx-cc26xx/rf/tx-power.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-cpu - * @{ - * - * \defgroup cc13xx-cc26xx-rf-tx-power TX power functioanlity for CC13xx/CC26xx - * - * @{ - * - * \file - * Header file of TX power functionality of CC13xx/CC26xx. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef TX_POWER_H_ -#define TX_POWER_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define RF_TXPOWER_HIGH_PA RF_CONF_TXPOWER_HIGH_PA -#define RF_TXPOWER_BOOST_MODE RF_CONF_TXPOWER_BOOST_MODE -/*---------------------------------------------------------------------------*/ -typedef RF_TxPowerTable_Entry tx_power_table_t; -/*---------------------------------------------------------------------------*/ -/** - * \name Extern declarations of TX Power Table variables. - * - * @{ - */ - -/* Nestack RF TX power table */ -extern tx_power_table_t *const rf_tx_power_table; -extern const size_t rf_tx_power_table_size; - -/* BLE Beacon RF TX power table */ -extern tx_power_table_t *const ble_tx_power_table; -extern const size_t ble_tx_power_table_size; -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name TX power table convenience functions. - * - * @{ - */ - -static inline int8_t -tx_power_min(tx_power_table_t *table) -{ - return table[0].power; -} -static inline int8_t -tx_power_max(tx_power_table_t *table, size_t size) -{ - return table[size - 1].power; -} -static inline bool -tx_power_in_range(int8_t dbm, tx_power_table_t *table, size_t size) -{ - return (dbm >= tx_power_min(table)) && - (dbm <= tx_power_max(table, size)); -} -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* TX_POWER_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/dev/bme280/README.bme280 b/arch/dev/bme280/README.bme280 deleted file mode 100644 index 718013cdc..000000000 --- a/arch/dev/bme280/README.bme280 +++ /dev/null @@ -1,26 +0,0 @@ - -Contiki implementation for Bosch Sensortec BME280 sensor. -BME280 is compact and fast and includes temp, RH, and pressure. -Chip uses I2C or SPI. This implementation and follow Contiki -device API and I2C. - -For better performance and less chip warm up and less I2C transactions -burst read is recommended. Here all T/RH/P is read in one single -I2C read and kept the measurements have the same time. - -The burst read is stored in struct bme280_mea which accessible from -the Contiki. Also note that the full chip resolution is available. -The variables are overscaled to give the app full controlover resolution. - -See bme280.h - -The pressure can be calculated with 32 or 64. The define BME280_64BIT -controls this. Typically in your project-conf.h - -Implemented according to datasheet Rev 1.1. - -Limitations: -Implementation implements Weather Mode which uses forced one-shot -mode no oversampling nor filters and reads all T/RH/P in one read. - - diff --git a/arch/dev/bme280/bme280-arch.h b/arch/dev/bme280/bme280-arch.h deleted file mode 100644 index b6a48edb5..000000000 --- a/arch/dev/bme280/bme280-arch.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 BME280_ARCH_H -#define BME280_ARCH_H - -/* Initialize the I2C module */ -void bme280_arch_i2c_init(); - -/* I2C read registers */ -void bme280_arch_i2c_read_mem(uint8_t addr, uint8_t reg, uint8_t *buf, - uint8_t bytes); - -/* I2C write to a single register */ -void bme280_arch_i2c_write_mem(uint8_t addr, uint8_t reg, uint8_t value); - -#endif -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/dev/bme280/bme280-sensor.c b/arch/dev/bme280/bme280-sensor.c deleted file mode 100644 index cb2980e8a..000000000 --- a/arch/dev/bme280/bme280-sensor.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2015, Copyright Robert Olsson - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * - * Author : Robert Olsson rolss@kth.se/robert@radio-sensors.com - * Created : 2016-09-14 - */ - -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/bme280/bme280.h" -#include "dev/bme280/bme280-sensor.h" -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* Read all measurements with one burst read */ - bme280_read(BME280_MODE_WEATHER); - - /* Return a la Contiki API */ - switch(type) { - - case BME280_SENSOR_TEMP: - return bme280_mea.t_overscale100 / 100; - - case BME280_SENSOR_HUMIDITY: - return bme280_mea.h_overscale1024 >> 10; - - case BME280_SENSOR_PRESSURE: - /* Scale down w. 10 not to overslow the signed int */ -#ifdef BME280_64BIT - return bme280_mea.p_overscale256 / (256 * 10); -#else - return bme280_mea.p / 10; -#endif - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return bme280_init(BME280_MODE_WEATHER); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(bme280_sensor, "bme280", value, configure, status); diff --git a/arch/dev/bme280/bme280-sensor.h b/arch/dev/bme280/bme280-sensor.h deleted file mode 100644 index 4b34b6997..000000000 --- a/arch/dev/bme280/bme280-sensor.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2015, Copyright Robert Olsson - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * - * Author : Robert Olsson rolss@kth.se/robert@radio-sensors.com - * Created : 2016-09-14 - */ - -#ifndef BME280_SENSOR_H_ -#define BME280_SENSOR_H_ - -#include "lib/sensors.h" -#include "bme280.h" - -extern const struct sensors_sensor bme280_sensor; - -#define BME280_SENSOR_TEMP 0 -#define BME280_SENSOR_HUMIDITY 1 -#define BME280_SENSOR_PRESSURE 2 - -#endif /* BME280_SENSOR_H_ */ diff --git a/arch/dev/bme280/bme280.c b/arch/dev/bme280/bme280.c deleted file mode 100644 index 43bf76185..000000000 --- a/arch/dev/bme280/bme280.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2015, Copyright Robert Olsson - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * - * Author : Robert Olsson rolss@kth.se/robert@radio-sensors.com - * Created : 2016-09-14 - */ - -/** - * \file - * Basic functions for Bosch BME280 based on datasheet Rev 1.1 - */ - -#include "contiki.h" -#include -#include "bme280.h" -#include "bme280-arch.h" -#include "lib/sensors.h" - -static struct { - unsigned short dig_t1; - signed short dig_t2; - signed short dig_t3; - unsigned short dig_p1; - signed short dig_p2; - signed short dig_p3; - signed short dig_p4; - signed short dig_p5; - signed short dig_p6; - signed short dig_p7; - signed short dig_p8; - signed short dig_p9; - unsigned char dig_h1; - signed short dig_h2; - unsigned char dig_h3; - signed short dig_h4; - signed short dig_h5; - signed char dig_h6; - int32_t t_fine; - uint8_t mode; -} bm; - -int32_t -bme280_t_overscale100(int32_t ut) -{ - int32_t v1, v2, t; - - v1 = ((((ut >> 3) - ((int32_t)bm.dig_t1 << 1))) * - ((int32_t)bm.dig_t2)) >> 11; - - v2 = (((((ut >> 4) - ((int32_t)bm.dig_t1)) * ((ut >> 4) - - ((int32_t)bm.dig_t1))) >> 12) * ((int32_t)bm.dig_t3)) >> 14; - - bm.t_fine = v1 + v2; - t = (bm.t_fine * 5 + 128) >> 8; - return t; -} -#ifdef BME280_32BIT -static uint32_t -bme280_p(int32_t up) -{ - int32_t v1, v2; - uint32_t p; - - v1 = (((int32_t)bm.t_fine) >> 1) - (int32_t)64000; - v2 = (((v1 >> 2) * (v1 >> 2)) >> 11) * ((int32_t)bm.dig_p6); - v2 = v2 + ((v1 * ((int32_t)bm.dig_p5)) << 1); - v2 = (v2 >> 2) + (((int32_t)bm.dig_p4) << 16); - - v1 = (((bm.dig_p3 * (((v1 >> 2) * (v1 >> 2)) >> 13)) >> 3) + - ((((int32_t)bm.dig_p2) * v1) >> 1)) >> 18; - - v1 = ((((32768 + v1)) * ((int32_t)bm.dig_p1)) >> 15); - - if(v1 == 0) { - return 0; - } - - p = (((uint32_t)(((int32_t)1048576) - up) - (v2 >> 12))) * 3125; - - if(p < 0x80000000) { - p = (p << 1) / ((uint32_t)v1); - } else { - p = (p / (uint32_t)v1) * 2; - } - - v1 = (((int32_t)bm.dig_p9) * ((int32_t)(((p >> 3) * (p >> 3)) >> 13))) >> 12; - v2 = (((int32_t)(p >> 2)) * ((int32_t)bm.dig_p8)) >> 13; - p = (uint32_t)((int32_t)p + ((v1 + v2 + bm.dig_p7) >> 4)); - return p; -} -#else - -static uint32_t -bme280_p_overscale256(int32_t up) -{ - int64_t v1, v2, p; - - v1 = ((int64_t)bm.t_fine) - 128000; - v2 = v1 * v1 * (int64_t)bm.dig_p6; - v2 = v2 + ((v1 * (int64_t)bm.dig_p5) << 17); - v2 = v2 + (((int64_t)bm.dig_p4) << 35); - v1 = ((v1 * v1 * (int64_t)bm.dig_p3) >> 8) + ((v1 * (int64_t)bm.dig_p2) << 12); - v1 = (((((int64_t)1) << 47) + v1)) * ((int64_t)bm.dig_p1) >> 33; - - if(v1 == 0) { - return 0; - } - - p = 1048576 - up; - p = (((p << 31) - v2) * 3125) / v1; - v1 = (((int64_t)bm.dig_p9) * (p >> 13) * (p >> 13)) >> 25; - v2 = (((int64_t)bm.dig_p8) * p) >> 19; - p = (((p + v1 + v2) >> 8) + (((int64_t)bm.dig_p7) << 4)); - return (uint32_t)p; -} -#endif - -static uint32_t -bme280_h_overscale1024(int32_t uh) -{ - int32_t v1; - v1 = (bm.t_fine - ((int32_t)76800)); - v1 = (((((uh << 14) - (((int32_t)bm.dig_h4) << 20) - (((int32_t)bm.dig_h5) * v1)) + ((int32_t)16384)) >> 15) - * (((((((v1 * ((int32_t)bm.dig_h6)) >> 10) * (((v1 * ((int32_t)bm.dig_h3)) >> 11) + ((int32_t)32768))) - >> 10) + ((int32_t)2097152)) * ((int32_t)bm.dig_h2) + 8192) >> 14)); - v1 = (v1 - (((((v1 >> 15) * (v1 >> 15)) >> 7) * ((int32_t)bm.dig_h1)) >> 4)); - v1 = (v1 < 0 ? 0 : v1); - v1 = (v1 > 419430400 ? 419430400 : v1); - return (uint32_t)(v1 >> 12); -} -uint8_t -bme280_init(uint8_t mode) -{ - uint16_t i; - uint8_t buf[26]; - - bme280_arch_i2c_init(); - - /* Do not mess with other chips */ - bme280_arch_i2c_read_mem(BME280_ADDR, 0xD0, buf, 1); - if(buf[0] != BME280_CHIP_ID) { - return 0; - } - - bme280_arch_i2c_write_mem(BME280_ADDR, BME280_CNTL_RESET, 0xB6); - - for(i = 0; i < BME280_MAX_WAIT; i++) { - clock_delay_usec(1000); - } - - memset(buf, 0, sizeof(buf)); - - /* Burst read of all calibration part 1 */ - bme280_arch_i2c_read_mem(BME280_ADDR, BME280_DIG_T1_ADDR, buf, sizeof(buf)); - bm.dig_t1 = ((uint16_t)buf[1] << 8) | (uint16_t)buf[0]; - bm.dig_t2 = ((int16_t)buf[3] << 8) | (uint16_t)buf[2]; - bm.dig_t3 = ((int16_t)buf[5] << 8) | (uint16_t)buf[4]; - bm.dig_p1 = ((uint16_t)buf[7] << 8) | (uint16_t)buf[6]; - bm.dig_p2 = ((int16_t)buf[9] << 8) | (uint16_t)buf[8]; - bm.dig_p3 = ((int16_t)buf[11] << 8) | (uint16_t)buf[10]; - bm.dig_p4 = ((int16_t)buf[13] << 8) | (uint16_t)buf[12]; - bm.dig_p5 = ((int16_t)buf[15] << 8) | (uint16_t)buf[14]; - bm.dig_p6 = ((int16_t)buf[17] << 8) | (uint16_t)buf[16]; - bm.dig_p7 = ((int16_t)buf[19] << 8) | (uint16_t)buf[18]; - bm.dig_p8 = ((int16_t)buf[21] << 8) | (uint16_t)buf[20]; - bm.dig_p9 = ((int16_t)buf[23] << 8) | (uint16_t)buf[22]; - /* A0 not used */ - bm.dig_h1 = (unsigned char)buf[25]; - - /* Burst read of all calibration part 2 */ - bme280_arch_i2c_read_mem(BME280_ADDR, BME280_DIG_H2_ADDR, buf, 8); - bm.dig_h2 = ((int16_t)buf[1] << 8) | (uint16_t)buf[0]; - bm.dig_h3 = (unsigned char)buf[2]; - bm.dig_h4 = ((int16_t)buf[3] << 4) | (((uint16_t)buf[4]) & 0xF); - bm.dig_h5 = ((int16_t)buf[6] << 4) | (((uint16_t)buf[5]) & 0xF); - bm.dig_h6 = (unsigned char)buf[7]; - - bm.mode = mode; - return 1; -} -void -bme280_read(uint8_t mode) -{ - int32_t ut, uh, up; - uint8_t buf[8], sleep; - uint16_t i; - memset(buf, 0, sizeof(buf)); - - /* Are we initilized and in the right mode? */ - if(mode == BME280_MODE_NONE || mode != bm.mode) { - return; - } - - ut = uh = up = 0; - - /* Weather mode. See sectiom 3.5 Datasheet */ - if(mode == BME280_MODE_WEATHER) { - /* Humidity oversampling *1 */ - bme280_arch_i2c_write_mem(BME280_ADDR, BME280_CNTL_HUM, 0x01); - - /* 00100111 0x27 oversampling *1 for t and p plus normal mode */ - /* 0.5 ms -- no filter -- no SPI */ - bme280_arch_i2c_write_mem(BME280_ADDR, BME280_CONTROL, 0x00); - - /* 00100110 0x26 oversampling *1 for t and p plus forced mode */ - /* Trigger measurement needed for every time in forced mode */ - bme280_arch_i2c_write_mem(BME280_ADDR, BME280_CNTL_MEAS, 0x26); - /* Wait to get into sleep mode == measurement done */ - for(i = 0; i < BME280_MAX_WAIT; i++) { - bme280_arch_i2c_read_mem(BME280_ADDR, BME280_CNTL_MEAS, &sleep, 1); - sleep = sleep& 0x03; - if(sleep== 0) { - break; - } else { - clock_delay_usec(1000); - } - } - if(i == BME280_MAX_WAIT) { - return; /* error wait*/ - } - } else { /* if(mode == BME280_MODE_WEATHER) */ - return; /* error mode*/ - } - - /* Burst read of all measurements */ - bme280_arch_i2c_read_mem(BME280_ADDR, BME280_PRESS, buf, 8); - ut = (uint32_t)(buf[3]) << 12 | (uint32_t)(buf[4]) << 4 | (uint32_t)buf[5] >> 4; - up = (uint32_t)(buf[0]) << 12 | (uint32_t)(buf[1]) << 4 | (uint32_t)buf[2] >> 4; - uh = (uint32_t)(buf[6]) << 8 | (uint32_t)buf[7]; - - bme280_mea.t_overscale100 = bme280_t_overscale100(ut); - bme280_mea.h_overscale1024 = bme280_h_overscale1024(uh); -#ifdef BME280_64BIT - bme280_mea.p_overscale256 = bme280_p_overscale256(up); -#else - bme280_mea.p = bme280_p(up); -#endif - -#if TEST - printf("T_BME280=%5.2f", (double)bme280_mea.t_overscale100 / 100.); - printf(" RH_BME280=%5.2f ", (double)bme280_mea.h_overscale1024 / 1024.); -#ifdef BME280_64BIT - printf(" P_BME280=%5.2f\n", (double)bme280_mea.p_overscale256 / 256.); -#else - printf(" P_BME280=%5.2f\n", (double)bme280_mea.p); -#endif -#endif -} diff --git a/arch/dev/bme280/bme280.h b/arch/dev/bme280/bme280.h deleted file mode 100644 index 10b3ad6ac..000000000 --- a/arch/dev/bme280/bme280.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2015, Copyright Robert Olsson - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * - * Author : Robert Olsson rolss@kth.se/robert@radio-sensors.com - * - * Created : 2016-09-14 - */ - -/** - * \file - * Definitions for the Bosch BME280 based on datasheet Rev 1.1 - */ - -#ifndef BME280_H -#define BME280_H - -#ifndef BME280_32BIT -#define BME280_64BIT -#endif - -uint8_t bme280_init(uint8_t mode); -void bme280_read(uint8_t mode); - -#ifdef BME280_CONF_ADDR -#define BME280_ADDR BME280_CONF_ADDR -#else -#define BME280_ADDR (0x77 << 1) /* Alternative 0x76 */ -#endif - -/* Diffrent BOSCH chip id's */ -#define BMP085_CHIP_ID 0x55 /* And also BMP180 */ -#define BMP280_CHIP_ID 0x58 -#define BME280_CHIP_ID 0x60 - -/* Address map */ -#define BME280_DIG_T1_ADDR 0x88 -#define BME280_DIG_T2_ADDR 0x8A -#define BME280_DIG_T3_ADDR 0x8C -#define BME280_DIG_P1_ADDR 0x8E -#define BME280_DIG_P2_ADDR 0x90 -#define BME280_DIG_P3_ADDR 0x92 -#define BME280_DIG_P4_ADDR 0x94 -#define BME280_DIG_P5_ADDR 0x96 -#define BME280_DIG_P6_ADDR 0x98 -#define BME280_DIG_P7_ADDR 0x9A -#define BME280_DIG_P8_ADDR 0x9C -#define BME280_DIG_P9_ADDR 0x9E -#define BME280_DIG_H1_ADDR 0xA1 -#define BMP_CHIP_ID_ADDR 0xD0 -#define BME280_CNTL_RESET 0xE0 -#define BME280_DIG_H2_ADDR 0xE1 -#define BME280_DIG_H3_ADDR 0xE3 -#define BME280_DIG_H4_ADDR 0xE4 -#define BME280_DIG_H5_ADDR 0xE5 -#define BME280_DIG_H6_ADDR 0xE7 -#define BME280_CNTL_HUM 0xF2 -#define BME280_STATUS 0xF3 -#define BME280_CNTL_MEAS 0xF4 -#define BME280_CONTROL 0xF5 -#define BME280_PRESS 0xF7 - -/* Function modes outlined in datasheet */ -#define BME280_MODE_NONE 0 -#define BME280_MODE_WEATHER 1 -#define BME280_MODE_HUMIDITY 2 -#define BME280_MODE_INDOOR_NAVIGATION 3 -#define BME280_MODE_GAMING 4 - -#define BME280_MAX_WAIT 300 /* ms. Forced mode max wait */ - - -struct { - int32_t t_overscale100; - uint32_t h_overscale1024; -#ifdef BME280_64BIT - uint32_t p_overscale256; -#else - uint32_t p; -#endif -} bme280_mea; - -#endif /* BME280_H */ diff --git a/arch/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c b/arch/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c deleted file mode 100644 index f6b1e9a5a..000000000 --- a/arch/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2015, Weptech elektronik GmbH Germany - * http://www.weptech.de - * - * 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. - * - * This file is part of the Contiki operating system. - */ - -#include "cc1200-rf-cfg.h" -#include "cc1200-const.h" -#include "net/mac/tsch/tsch.h" - -/* - * This is a setup for the following configuration: - * - * 802.15.4g - * ========= - * Table 68f: Frequency band identifier 4 (863-870 MHz) - * Table 68g: Modulation scheme identifier 0 (Filtered FSK) - * Table 68h: Mode #1 (50kbps) - */ - -/* Base frequency in kHz */ -#define RF_CFG_CHAN_CENTER_F0 863125 -/* Channel spacing in Hz */ -#define RF_CFG_CHAN_SPACING 200000 -/* The minimum channel */ -#define RF_CFG_MIN_CHANNEL 0 -/* The maximum channel */ -#define RF_CFG_MAX_CHANNEL 33 -/* The maximum output power in dBm */ -#define RF_CFG_MAX_TXPOWER CC1200_CONST_TX_POWER_MAX -/* The carrier sense level used for CCA in dBm */ -#define RF_CFG_CCA_THRESHOLD (-91) -/* The RSSI offset in dBm */ -#define RF_CFG_RSSI_OFFSET (-81) -/*---------------------------------------------------------------------------*/ -static const char rf_cfg_descriptor[] = "802.15.4g 863-870MHz MR-FSK mode #1"; -/*---------------------------------------------------------------------------*/ - -/* 1 byte time: 160 usec */ -#define CC1200_TSCH_PREAMBLE_LENGTH 800 /* 5 bytes */ -#define CC1200_TSCH_CONF_RX_WAIT 2200 -#define CC1200_TSCH_CONF_RX_ACK_WAIT 400 - -#define CC1200_TSCH_DEFAULT_TS_CCA_OFFSET 1800 -#define CC1200_TSCH_DEFAULT_TS_CCA 128 - -#define CC1200_TSCH_DEFAULT_TS_TX_OFFSET 3800 -#define CC1200_TSCH_DEFAULT_TS_RX_OFFSET (CC1200_TSCH_DEFAULT_TS_TX_OFFSET - CC1200_TSCH_PREAMBLE_LENGTH - (CC1200_TSCH_CONF_RX_WAIT / 2)) -#define CC1200_TSCH_DEFAULT_TS_RX_ACK_DELAY (CC1200_TSCH_DEFAULT_TS_TX_ACK_DELAY - CC1200_TSCH_PREAMBLE_LENGTH - (CC1200_TSCH_CONF_RX_ACK_WAIT / 2)) -#define CC1200_TSCH_DEFAULT_TS_TX_ACK_DELAY 3000 - -#define CC1200_TSCH_DEFAULT_TS_RX_WAIT (CC1200_TSCH_PREAMBLE_LENGTH + CC1200_TSCH_CONF_RX_WAIT) -#define CC1200_TSCH_DEFAULT_TS_ACK_WAIT (CC1200_TSCH_PREAMBLE_LENGTH + CC1200_TSCH_CONF_RX_ACK_WAIT) -#define CC1200_TSCH_DEFAULT_TS_RX_TX 192 -#define CC1200_TSCH_DEFAULT_TS_MAX_ACK 3360 /* 17+1+3 bytes at 50 kbps */ -#define CC1200_TSCH_DEFAULT_TS_MAX_TX 20800 /* 126+1+3 bytes at 50 kbps */ - -#define CC1200_TSCH_DEFAULT_SLACK_TIME 500 -/* Timeslot length: 31460 usec */ -#define CC1200_TSCH_DEFAULT_TS_TIMESLOT_LENGTH \ - ( CC1200_TSCH_DEFAULT_TS_TX_OFFSET \ - + CC1200_TSCH_DEFAULT_TS_MAX_TX \ - + CC1200_TSCH_DEFAULT_TS_TX_ACK_DELAY \ - + CC1200_TSCH_DEFAULT_TS_MAX_ACK \ - + CC1200_TSCH_DEFAULT_SLACK_TIME \ - ) - -/* TSCH timeslot timing (mircoseconds) */ -static const tsch_timeslot_timing_usec cc1200_50kbps_tsch_timing = { - CC1200_TSCH_DEFAULT_TS_CCA_OFFSET, - CC1200_TSCH_DEFAULT_TS_CCA, - CC1200_TSCH_DEFAULT_TS_TX_OFFSET, - CC1200_TSCH_DEFAULT_TS_RX_OFFSET, - CC1200_TSCH_DEFAULT_TS_RX_ACK_DELAY, - CC1200_TSCH_DEFAULT_TS_TX_ACK_DELAY, - CC1200_TSCH_DEFAULT_TS_RX_WAIT, - CC1200_TSCH_DEFAULT_TS_ACK_WAIT, - CC1200_TSCH_DEFAULT_TS_RX_TX, - CC1200_TSCH_DEFAULT_TS_MAX_ACK, - CC1200_TSCH_DEFAULT_TS_MAX_TX, - CC1200_TSCH_DEFAULT_TS_TIMESLOT_LENGTH, -}; - -/* - * Register settings exported from SmartRF Studio using the standard template - * "trxEB RF Settings Performance Line". - */ - -// Modulation format = 2-GFSK -// Whitening = false -// Packet length = 255 -// Packet length mode = Variable -// Packet bit length = 0 -// Symbol rate = 50 -// Deviation = 24.948120 -// Carrier frequency = 867.999878 -// Device address = 0 -// Manchester enable = false -// Address config = No address check -// Bit rate = 50 -// RX filter BW = 104.166667 - -static const registerSetting_t preferredSettings[]= -{ - {CC1200_IOCFG2, 0x06}, - {CC1200_SYNC3, 0x6E}, - {CC1200_SYNC2, 0x4E}, - {CC1200_SYNC1, 0x90}, - {CC1200_SYNC0, 0x4E}, - {CC1200_SYNC_CFG1, 0xE5}, - {CC1200_SYNC_CFG0, 0x23}, - {CC1200_DEVIATION_M, 0x47}, - {CC1200_MODCFG_DEV_E, 0x0B}, - {CC1200_DCFILT_CFG, 0x56}, - - /* - * 18.1.1.1 Preamble field - * The Preamble field shall contain phyFSKPreambleLength (as defined in 9.3) - * multiples of the 8-bit sequence “01010101†for filtered 2FSK. - * The Preamble field shall contain phyFSKPreambleLength multiples of the - * 16-bit sequence “0111 0111 0111 0111†for filtered 4FSK. - * - * We need to define this in order to be able to compute e.g. timeouts for the - * MAC layer. According to 9.3, phyFSKPreambleLength can be configured between - * 4 and 1000. We set it to 4. Attention: Once we use a long wake-up preamble, - * the timing parameters have to change accordingly. Will we use a shorter - * preamble for an ACK in this case??? - */ - {CC1200_PREAMBLE_CFG1, 0x19}, - - {CC1200_PREAMBLE_CFG0, 0xBA}, - {CC1200_IQIC, 0xC8}, - {CC1200_CHAN_BW, 0x84}, - {CC1200_MDMCFG1, 0x42}, - {CC1200_MDMCFG0, 0x05}, - {CC1200_SYMBOL_RATE2, 0x94}, - {CC1200_SYMBOL_RATE1, 0x7A}, - {CC1200_SYMBOL_RATE0, 0xE1}, - {CC1200_AGC_REF, 0x27}, - {CC1200_AGC_CS_THR, 0xF1}, - {CC1200_AGC_CFG1, 0x11}, - {CC1200_AGC_CFG0, 0x90}, - {CC1200_FIFO_CFG, 0x00}, - {CC1200_FS_CFG, 0x12}, - {CC1200_PKT_CFG2, 0x24}, - {CC1200_PKT_CFG0, 0x20}, - {CC1200_PKT_LEN, 0xFF}, - {CC1200_IF_MIX_CFG, 0x18}, - {CC1200_TOC_CFG, 0x03}, - {CC1200_MDMCFG2, 0x02}, - {CC1200_FREQ2, 0x56}, - {CC1200_FREQ1, 0xCC}, - {CC1200_FREQ0, 0xCC}, - {CC1200_IF_ADC1, 0xEE}, - {CC1200_IF_ADC0, 0x10}, - {CC1200_FS_DIG1, 0x04}, - {CC1200_FS_DIG0, 0x50}, - {CC1200_FS_CAL1, 0x40}, - {CC1200_FS_CAL0, 0x0E}, - {CC1200_FS_DIVTWO, 0x03}, - {CC1200_FS_DSM0, 0x33}, - {CC1200_FS_DVC1, 0xF7}, - {CC1200_FS_DVC0, 0x0F}, - {CC1200_FS_PFD, 0x00}, - {CC1200_FS_PRE, 0x6E}, - {CC1200_FS_REG_DIV_CML, 0x1C}, - {CC1200_FS_SPARE, 0xAC}, - {CC1200_FS_VCO0, 0xB5}, - {CC1200_IFAMP, 0x05}, - {CC1200_XOSC5, 0x0E}, - {CC1200_XOSC1, 0x03}, -}; -/*---------------------------------------------------------------------------*/ -/* Global linkage: symbol name must be different in each exported file! */ -const cc1200_rf_cfg_t cc1200_802154g_863_870_fsk_50kbps = { - .cfg_descriptor = rf_cfg_descriptor, - .register_settings = preferredSettings, - .size_of_register_settings = sizeof(preferredSettings), - .tx_pkt_lifetime = (RTIMER_SECOND / 20), - .tx_rx_turnaround = (RTIMER_SECOND / 100), - /* Includes 3 Bytes preamble + 2 Bytes SFD, at 160usec per byte = 800 usec */ - /* Includes time to completion of "Wait for TX to start" if cc1200.c: 397 usec */ - .delay_before_tx = ((unsigned)US_TO_RTIMERTICKS(800 + 397 + 423)), - .delay_before_rx = (unsigned)US_TO_RTIMERTICKS(400), - .delay_before_detect = 0, - .chan_center_freq0 = RF_CFG_CHAN_CENTER_F0, - .chan_spacing = RF_CFG_CHAN_SPACING, - .min_channel = RF_CFG_MIN_CHANNEL, - .max_channel = RF_CFG_MAX_CHANNEL, - .max_txpower = RF_CFG_MAX_TXPOWER, - .cca_threshold = RF_CFG_CCA_THRESHOLD, - .rssi_offset = RF_CFG_RSSI_OFFSET, - .bitrate = 50000, - .tsch_timing = cc1200_50kbps_tsch_timing, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/dev/cc1200/cc1200-868-4gfsk-1000kbps.c b/arch/dev/cc1200/cc1200-868-4gfsk-1000kbps.c deleted file mode 100644 index 5314bb517..000000000 --- a/arch/dev/cc1200/cc1200-868-4gfsk-1000kbps.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2015, Weptech elektronik GmbH Germany - * http://www.weptech.de - * - * 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. - * - * This file is part of the Contiki operating system. - */ - -#include "cc1200-rf-cfg.h" -#include "cc1200-const.h" -#include "net/mac/tsch/tsch.h" - -/* -* Register settings exported from SmartRF Studio using the standard 1000kpbs 868MHz template - */ - - /* Base frequency in kHz */ - #define RF_CFG_CHAN_CENTER_F0 863125 - /* Channel spacing in Hz */ - #define RF_CFG_CHAN_SPACING 1666667 -/* The minimum channel */ -#define RF_CFG_MIN_CHANNEL 0 -/* The maximum channel */ -#define RF_CFG_MAX_CHANNEL 3 -/* The maximum output power in dBm */ -#define RF_CFG_MAX_TXPOWER CC1200_CONST_TX_POWER_MAX -/* The carrier sense level used for CCA in dBm */ -#define RF_CFG_CCA_THRESHOLD (-91) -/* The RSSI offset in dBm */ -#define RF_CFG_RSSI_OFFSET (-81) -/*---------------------------------------------------------------------------*/ -static const char rf_cfg_descriptor[] = "868MHz 2-GFSK 1000 kbps"; -/*---------------------------------------------------------------------------*/ - -/* 1 byte time: 8 usec */ -#define CC1200_TSCH_PREAMBLE_LENGTH 800 /* 5 bytes */ -#define CC1200_TSCH_CONF_RX_WAIT 2200 -#define CC1200_TSCH_CONF_RX_ACK_WAIT 400 - -#define CC1200_TSCH_DEFAULT_TS_CCA_OFFSET 1800 -#define CC1200_TSCH_DEFAULT_TS_CCA 128 -#define CC1200_TSCH_DEFAULT_TS_TX_OFFSET 2200 -#define CC1200_TSCH_DEFAULT_TS_RX_OFFSET (CC1200_TSCH_DEFAULT_TS_TX_OFFSET - CC1200_TSCH_PREAMBLE_LENGTH - (CC1200_TSCH_CONF_RX_WAIT / 2)) -#define CC1200_TSCH_DEFAULT_TS_RX_ACK_DELAY (CC1200_TSCH_DEFAULT_TS_TX_ACK_DELAY - CC1200_TSCH_PREAMBLE_LENGTH - (CC1200_TSCH_CONF_RX_ACK_WAIT / 2)) -#define CC1200_TSCH_DEFAULT_TS_TX_ACK_DELAY 1900 -#define CC1200_TSCH_DEFAULT_TS_RX_WAIT (CC1200_TSCH_PREAMBLE_LENGTH + CC1200_TSCH_CONF_RX_WAIT) -#define CC1200_TSCH_DEFAULT_TS_ACK_WAIT (CC1200_TSCH_PREAMBLE_LENGTH + CC1200_TSCH_CONF_RX_ACK_WAIT) -#define CC1200_TSCH_DEFAULT_TS_RX_TX 192 -#define CC1200_TSCH_DEFAULT_TS_MAX_ACK 168 /* 17+1+3 bytes at 1000 kbps */ -#define CC1200_TSCH_DEFAULT_TS_MAX_TX 1040 /* 126+1+3 bytes at 1000 kbps */ - -#define CC1200_TSCH_DEFAULT_SLACK_TIME 500 -/* Timeslot length: 5808 usec */ -#define CC1200_TSCH_DEFAULT_TS_TIMESLOT_LENGTH \ - ( CC1200_TSCH_DEFAULT_TS_TX_OFFSET \ - + CC1200_TSCH_DEFAULT_TS_MAX_TX \ - + CC1200_TSCH_DEFAULT_TS_TX_ACK_DELAY \ - + CC1200_TSCH_DEFAULT_TS_MAX_ACK \ - + CC1200_TSCH_DEFAULT_SLACK_TIME \ - ) - -/* TSCH timeslot timing (in rtimer ticks) */ -static const tsch_timeslot_timing_usec cc1200_1000kbps_tsch_timing = { - CC1200_TSCH_DEFAULT_TS_CCA_OFFSET, - CC1200_TSCH_DEFAULT_TS_CCA, - CC1200_TSCH_DEFAULT_TS_TX_OFFSET, - CC1200_TSCH_DEFAULT_TS_RX_OFFSET, - CC1200_TSCH_DEFAULT_TS_RX_ACK_DELAY, - CC1200_TSCH_DEFAULT_TS_TX_ACK_DELAY, - CC1200_TSCH_DEFAULT_TS_RX_WAIT, - CC1200_TSCH_DEFAULT_TS_ACK_WAIT, - CC1200_TSCH_DEFAULT_TS_RX_TX, - CC1200_TSCH_DEFAULT_TS_MAX_ACK, - CC1200_TSCH_DEFAULT_TS_MAX_TX, - CC1200_TSCH_DEFAULT_TS_TIMESLOT_LENGTH, -}; - -static const registerSetting_t preferredSettings[]= -{ - {CC1200_IOCFG2, 0x06}, - {CC1200_SYNC_CFG1, 0xA8}, - {CC1200_DEVIATION_M, 0x47}, - {CC1200_MODCFG_DEV_E, 0x2F}, - {CC1200_DCFILT_CFG, 0x1E}, - {CC1200_PREAMBLE_CFG0, 0x8A}, - {CC1200_IQIC, 0x00}, - {CC1200_CHAN_BW, 0x01}, - {CC1200_MDMCFG1, 0x42}, - {CC1200_MDMCFG0, 0x05}, - {CC1200_SYMBOL_RATE2, 0xC9}, - {CC1200_SYMBOL_RATE1, 0x99}, - {CC1200_SYMBOL_RATE0, 0x99}, - {CC1200_AGC_REF, 0x2F}, - {CC1200_AGC_CS_THR, 0xF8}, - {CC1200_AGC_CFG2, 0x60}, - {CC1200_AGC_CFG1, 0x12}, - {CC1200_AGC_CFG0, 0x84}, - {CC1200_FIFO_CFG, 0x00}, - {CC1200_FS_CFG, 0x12}, - {CC1200_PKT_CFG2, 0x00}, - {CC1200_PKT_CFG0, 0x20}, - {CC1200_PKT_LEN, 0xFF}, - {CC1200_FREQOFF_CFG, 0x23}, - {CC1200_MDMCFG2, 0x00}, - {CC1200_FREQ2, 0x56}, - {CC1200_FREQ1, 0xCC}, - {CC1200_FREQ0, 0xCC}, - {CC1200_IF_ADC1, 0xEE}, - {CC1200_IF_ADC0, 0x10}, - {CC1200_FS_DIG1, 0x04}, - {CC1200_FS_DIG0, 0xA3}, - {CC1200_FS_CAL1, 0x40}, - {CC1200_FS_CAL0, 0x0E}, - {CC1200_FS_DIVTWO, 0x03}, - {CC1200_FS_DSM0, 0x33}, - {CC1200_FS_DVC1, 0xF7}, - {CC1200_FS_DVC0, 0x0F}, - {CC1200_FS_PFD, 0x00}, - {CC1200_FS_PRE, 0x6E}, - {CC1200_FS_REG_DIV_CML, 0x1C}, - {CC1200_FS_SPARE, 0xAC}, - {CC1200_FS_VCO0, 0xB5}, - {CC1200_IFAMP, 0x0D}, - {CC1200_XOSC5, 0x0E}, - {CC1200_XOSC1, 0x03}, -}; -/*---------------------------------------------------------------------------*/ -/* Global linkage: symbol name must be different in each exported file! */ -const cc1200_rf_cfg_t cc1200_868_4gfsk_1000kbps = { - .cfg_descriptor = rf_cfg_descriptor, - .register_settings = preferredSettings, - .size_of_register_settings = sizeof(preferredSettings), - .tx_pkt_lifetime = (RTIMER_SECOND), - .tx_rx_turnaround = (RTIMER_SECOND / 100), - /* Includes 3 Bytes preamble + 2 Bytes SFD, at 8usec per byte = 40 usec */ - /* Includes time to completion of "Wait for TX to start" if cc1200.c: 397 usec */ - .delay_before_tx = ((unsigned)US_TO_RTIMERTICKS(40 + 397 + 207)), - .delay_before_rx = (unsigned)US_TO_RTIMERTICKS(400), - .delay_before_detect = 0, - .chan_center_freq0 = RF_CFG_CHAN_CENTER_F0, - .chan_spacing = RF_CFG_CHAN_SPACING, - .min_channel = RF_CFG_MIN_CHANNEL, - .max_channel = RF_CFG_MAX_CHANNEL, - .max_txpower = RF_CFG_MAX_TXPOWER, - .cca_threshold = RF_CFG_CCA_THRESHOLD, - .rssi_offset = RF_CFG_RSSI_OFFSET, - .bitrate = 1000000, - .tsch_timing = cc1200_1000kbps_tsch_timing, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/dev/cc1200/cc1200-868-fsk-1-2kbps.c b/arch/dev/cc1200/cc1200-868-fsk-1-2kbps.c deleted file mode 100644 index 7cb8f3021..000000000 --- a/arch/dev/cc1200/cc1200-868-fsk-1-2kbps.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2015, Weptech elektronik GmbH Germany - * http://www.weptech.de - * - * 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. - * - * This file is part of the Contiki operating system. - */ - -#include "cc1200-rf-cfg.h" -#include "cc1200-const.h" - -/* - * This is a setup for the following configuration: - * - * cc1200 at 1.2 kbps, 2-FSK, 12.5 kHz Channel Spacing (868 MHz). - */ - -/* Base frequency in kHz */ -#define RF_CFG_CHAN_CENTER_F0 867787 -/* Channel spacing in Hz */ -#define RF_CFG_CHAN_SPACING 12500 -/* The minimum channel */ -#define RF_CFG_MIN_CHANNEL 0 -/* The maximum channel */ -#define RF_CFG_MAX_CHANNEL 33 -/* The maximum output power in dBm */ -#define RF_CFG_MAX_TXPOWER CC1200_CONST_TX_POWER_MAX -/* The carrier sense level used for CCA in dBm */ -#define RF_CFG_CCA_THRESHOLD (-91) -/* The RSSI offset in dBm */ -#define RF_CFG_RSSI_OFFSET (-99) -/*---------------------------------------------------------------------------*/ -static const char rf_cfg_descriptor[] = "868MHz 2-FSK 1.2 kbps"; -/*---------------------------------------------------------------------------*/ -/* - * Register settings exported from SmartRF Studio using the standard template - * "trxEB RF Settings Performance Line". - */ - -// Modulation format = 2-FSK -// Whitening = false -// Symbol rate = 1.2 -// Deviation = 3.986359 -// Carrier frequency = 867.999878 -// Manchester enable = false -// Bit rate = 1.2 -// RX filter BW = 10.964912 - -static const registerSetting_t preferredSettings[]= -{ - {CC1200_IOCFG2, 0x06}, - {CC1200_DEVIATION_M, 0xD1}, - {CC1200_MODCFG_DEV_E, 0x00}, - {CC1200_DCFILT_CFG, 0x5D}, - {CC1200_PREAMBLE_CFG0, 0x8A}, - {CC1200_IQIC, 0xCB}, - {CC1200_CHAN_BW, 0xA6}, - {CC1200_MDMCFG1, 0x40}, - {CC1200_MDMCFG0, 0x05}, - {CC1200_SYMBOL_RATE2, 0x3F}, - {CC1200_SYMBOL_RATE1, 0x75}, - {CC1200_SYMBOL_RATE0, 0x10}, - {CC1200_AGC_REF, 0x20}, - {CC1200_AGC_CS_THR, 0xEC}, - {CC1200_AGC_CFG1, 0x51}, - {CC1200_AGC_CFG0, 0x87}, - {CC1200_FIFO_CFG, 0x00}, - {CC1200_FS_CFG, 0x12}, - {CC1200_PKT_CFG2, 0x00}, - {CC1200_PKT_CFG0, 0x20}, - {CC1200_PKT_LEN, 0xFF}, - {CC1200_IF_MIX_CFG, 0x1C}, - {CC1200_FREQOFF_CFG, 0x22}, - {CC1200_MDMCFG2, 0x0C}, - {CC1200_FREQ2, 0x56}, - {CC1200_FREQ1, 0xCC}, - {CC1200_FREQ0, 0xCC}, - {CC1200_IF_ADC1, 0xEE}, - {CC1200_IF_ADC0, 0x10}, - {CC1200_FS_DIG1, 0x07}, - {CC1200_FS_DIG0, 0xAF}, - {CC1200_FS_CAL1, 0x40}, - {CC1200_FS_CAL0, 0x0E}, - {CC1200_FS_DIVTWO, 0x03}, - {CC1200_FS_DSM0, 0x33}, - {CC1200_FS_DVC0, 0x17}, - {CC1200_FS_PFD, 0x00}, - {CC1200_FS_PRE, 0x6E}, - {CC1200_FS_REG_DIV_CML, 0x1C}, - {CC1200_FS_SPARE, 0xAC}, - {CC1200_FS_VCO0, 0xB5}, - {CC1200_XOSC5, 0x0E}, - {CC1200_XOSC1, 0x03}, -}; -/*---------------------------------------------------------------------------*/ -/* Global linkage: symbol name must be different in each exported file! */ -const cc1200_rf_cfg_t cc1200_868_fsk_1_2kbps = { - .cfg_descriptor = rf_cfg_descriptor, - .register_settings = preferredSettings, - .size_of_register_settings = sizeof(preferredSettings), - .tx_pkt_lifetime = (2 * RTIMER_SECOND), - .tx_rx_turnaround = (RTIMER_SECOND / 2), - .delay_before_tx = 0, - .delay_before_rx = 0, - .delay_before_detect = 0, - .chan_center_freq0 = RF_CFG_CHAN_CENTER_F0, - .chan_spacing = RF_CFG_CHAN_SPACING, - .min_channel = RF_CFG_MIN_CHANNEL, - .max_channel = RF_CFG_MAX_CHANNEL, - .max_txpower = RF_CFG_MAX_TXPOWER, - .cca_threshold = RF_CFG_CCA_THRESHOLD, - .rssi_offset = RF_CFG_RSSI_OFFSET, - .bitrate = 1200, - .tsch_timing = NULL, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/dev/cc1200/cc1200-arch.h b/arch/dev/cc1200/cc1200-arch.h deleted file mode 100644 index c48a8798d..000000000 --- a/arch/dev/cc1200/cc1200-arch.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2015, Weptech elektronik GmbH Germany - * http://www.weptech.de - * - * 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. - * - * This file is part of the Contiki operating system. - */ - -#ifndef CC1200_ARCH_H -#define CC1200_ARCH_H - -#include -/*---------------------------------------------------------------------------*/ -/* - * Initialize SPI module & Pins. - * - * The function has to accomplish the following tasks: - * - Enable SPI and configure SPI (CPOL = 0, CPHA = 0) - * - Configure MISO, MOSI, SCLK accordingly - * - Configure GPIOx (input) - * - Configure RESET_N (output high) - * - Configure CSn (output high) - */ -void -cc1200_arch_init(void); -/*---------------------------------------------------------------------------*/ -/* Select CC1200 (pull down CSn pin). */ -void -cc1200_arch_spi_select(void); -/*---------------------------------------------------------------------------*/ -/* De-select CC1200 (release CSn pin). */ -void -cc1200_arch_spi_deselect(void); -/*---------------------------------------------------------------------------*/ -/* - * Configure port IRQ for GPIO0. - * If rising == 1: configure IRQ for rising edge, else falling edge - * Interrupt has to call cc1200_rx_interrupt()! - */ -void -cc1200_arch_gpio0_setup_irq(int rising); -/*---------------------------------------------------------------------------*/ -/* - * Configure port IRQ for GPIO2. - * - * GPIO2 might not be needed at all depending on the driver's - * configuration (see cc1200-conf.h) - * - * If rising == 1: configure IRQ for rising edge, else falling edge - * Interrupt has to call cc1200_rx_interrupt()! - */ -void -cc1200_arch_gpio2_setup_irq(int rising); -/*---------------------------------------------------------------------------*/ -/* Reset interrupt flag and enable GPIO0 port IRQ. */ -void -cc1200_arch_gpio0_enable_irq(void); -/*---------------------------------------------------------------------------*/ -/* Disable GPIO0 port IRQ. */ -void -cc1200_arch_gpio0_disable_irq(void); -/*---------------------------------------------------------------------------*/ -/* - * Reset interrupt flag and enable GPIO2 port IRQ - * - * GPIO2 might not be needed at all depending on the driver's - * configuration (see cc1200-conf.h) - */ -void -cc1200_arch_gpio2_enable_irq(void); -/*---------------------------------------------------------------------------*/ -/* - * Disable GPIO2 port IRQ. - * - * GPIO2 might not be needed at all depending on the driver's - * configuration (see cc1200-conf.h) - */ -void -cc1200_arch_gpio2_disable_irq(void); -/*---------------------------------------------------------------------------*/ -/* - * Read back the status of the GPIO0 pin. - * Returns 0 if the pin is low, otherwise 1 - */ -int -cc1200_arch_gpio0_read_pin(void); -/*---------------------------------------------------------------------------*/ -/* - * Read back the status of the GPIO2 pin. - * - * GPIO2 might not be needed at all depending on the driver's - * configuration (see cc1200-conf.h) - * - * Returns 0 if the pin is low, otherwise 1 - */ -int -cc1200_arch_gpio2_read_pin(void); -/*---------------------------------------------------------------------------*/ -/* - * Read back the status of the GPIO3 pin. - * - * Currently only used for rf test modes. - * - * Returns 0 if the pin is low, otherwise 1 - */ -int -cc1200_arch_gpio3_read_pin(void); -/*---------------------------------------------------------------------------*/ -/* Write a single byte via SPI, return response. */ -int -cc1200_arch_spi_rw_byte(uint8_t c); -/*---------------------------------------------------------------------------*/ -/* - * Write a sequence of bytes while reading back the response. - * Either read_buf or write_buf can be NULL. - */ -int -cc1200_arch_spi_rw(uint8_t *read_buf, - const uint8_t *write_buf, - uint16_t len); -/*---------------------------------------------------------------------------*/ -/* - * The CC1200 interrupt handler exported from the cc1200 driver. - * - * To be called by the hardware interrupt handler(s), - * which are defined as part of the cc1200-arch interface. - */ -int -cc1200_rx_interrupt(void); - -#endif /* CC1200_ARCH_H */ diff --git a/arch/dev/cc1200/cc1200-conf.h b/arch/dev/cc1200/cc1200-conf.h deleted file mode 100644 index 45517080f..000000000 --- a/arch/dev/cc1200/cc1200-conf.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2015, Weptech elektronik GmbH Germany - * http://www.weptech.de - * - * 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. - * - * This file is part of the Contiki operating system. - */ - -#ifndef CC1200_H_ -#define CC1200_H_ - -#include "contiki.h" - -/*---------------------------------------------------------------------------*/ -/* - * Can we use GPIO2 (in addition to GPIO0)? - * - * If this is the case, we can easily handle payloads > 125 bytes - * (and even > 127 bytes). If GPIO2 is available, we use it as an indicator - * pin for RX / TX FIFO threshold. - */ -#ifdef CC1200_CONF_USE_GPIO2 -#define CC1200_USE_GPIO2 CC1200_CONF_USE_GPIO2 -#else -#define CC1200_USE_GPIO2 1 -#endif -/*---------------------------------------------------------------------------*/ -/* - * The maximum payload length the driver can handle. - * - * - If CC1200_MAX_PAYLOAD_LEN <= 125 and CC1200_USE_GPIO2 == 0, we read - * out the RX FIFO at the end of the packet. RXOFF_MODE is set to RX in this - * case. - * - If 125 < CC1200_MAX_PAYLOAD_LEN <= 127 and CC1200_USE_GPIO2 == 0, we - * also read out the RX FIFO at the end of the packet, but read out - * RSSI + LQI "by hand". In this case, we also have to restart RX - * manually because RSSI + LQI are overwritten as soon as RX re-starts. - * This will lead to an increased RX/RX turnaround time. - * - If CC1200_USE_GPIO2 is set, we can use an arbitrary payload length - * (only limited by the payload length defined in the phy header). - * - * See below for 802.15.4g support. - */ -#ifdef CC1200_CONF_MAX_PAYLOAD_LEN -#define CC1200_MAX_PAYLOAD_LEN CC1200_CONF_MAX_PAYLOAD_LEN -#else -#define CC1200_MAX_PAYLOAD_LEN 127 -#endif -/*---------------------------------------------------------------------------*/ -/* - * The RX watchdog is used to check whether the radio is in RX mode at regular - * intervals (once per second). Can be used to improve reliability especially - * if CSMA is used. Turned of by default. - */ -#ifdef CC1200_CONF_USE_RX_WATCHDOG -#define CC1200_USE_RX_WATCHDOG CC1200_CONF_USE_RX_WATCHDOG -#else -#define CC1200_USE_RX_WATCHDOG 0 -#endif -/*---------------------------------------------------------------------------*/ -/* - * Use 802.15.4g frame format? Supports frame lenghts up to 2047 bytes! - */ -#ifdef CC1200_CONF_802154G -#define CC1200_802154G CC1200_CONF_802154G -#else -#define CC1200_802154G 0 -#endif -/*---------------------------------------------------------------------------*/ -/* - * Do we use withening in 802.15.4g mode? Set to 1 if enabled, 0 otherwise. - */ -#ifdef CC1200_CONF_802154G_WHITENING -#define CC1200_802154G_WHITENING CC1200_CONF_802154G_WHITENING -#else -#define CC1200_802154G_WHITENING 0 -#endif -/*---------------------------------------------------------------------------*/ -/* - * Do we use CRC16 in 802.15.4g mode? Set to 1 if enabled, 0 otherwise. - * - * It set to 0, we use FCS type 0: CRC32. - */ -#ifdef CC1200_CONF_802154G_CRC16 -#define CC1200_802154G_CRC16 CC1200_CONF_802154G_CRC16 -#else -/* Use FCS type 0: CRC32 */ -#define CC1200_802154G_CRC16 0 -#endif -/*---------------------------------------------------------------------------*/ -/* The RF configuration to be used. */ -#ifdef CC1200_CONF_RF_CFG -#define CC1200_RF_CFG CC1200_CONF_RF_CFG -#else -#define CC1200_RF_CFG cc1200_802154g_863_870_fsk_50kbps -#endif -/*---------------------------------------------------------------------------*/ -/* - * The frequency offset - * - * Might be hardware dependent (e.g. depending on crystal load capacitances), - * so we make it a configuration parameter. Written to FREQOFF1 / FREQOFF2. - * Signed 16 bit number, see cc1200 user's guide. - * - * TODO: Make it a parameter for set_value() / get_value() - */ -#ifdef CC1200_CONF_FREQ_OFFSET -#define CC1200_FREQ_OFFSET CC1200_CONF_FREQ_OFFSET -#else -#define CC1200_FREQ_OFFSET (0) -#endif -/*---------------------------------------------------------------------------*/ -/* - * The default channel to use. - * - * Permitted values depending on the data rate + band used are defined - * in the appropriate rf configuration file. Make sure the default value - * is within these limits! - */ -#ifdef CC1200_CONF_DEFAULT_CHANNEL -#define CC1200_DEFAULT_CHANNEL CC1200_CONF_DEFAULT_CHANNEL -#else -/* 868.325 MHz */ -#define CC1200_DEFAULT_CHANNEL 26 -#endif -/*---------------------------------------------------------------------------*/ -/* - * Wether to use auto calibration or not. - * - * If set to 0, calibration is performed manually when turning the radio - * on (on()), when transmitting (transmit()) or when changing the channel. - * Enabling auto calibration will increase turn around times + - * energy consumption. If enabled, we calibrate every time we go from - * IDLE to RX or TX. - * When RDC or channel hopping is used, there is no need to turn calibration - * on because either on() is called frequently or the channel is updated. - */ -#ifdef CC1200_CONF_AUTOCAL -#define CC1200_AUTOCAL CC1200_CONF_AUTOCAL -#else -#define CC1200_AUTOCAL 0 -#endif -/*---------------------------------------------------------------------------*/ -/* - * If CC1200_AUTOCAL is not set, we use this parameter to defer - * calibration until a certain amount of time has expired. - * - * This is what happens in detail: - * - * - We (manually) calibrate once after initialization - * - We (manually) calibrate every time we change the channel - * - We (manually) calibrate when the radio is turned on() only if - * the timeout has expired - * - We (manually) calibrate when transmitting only of the timeout has expired - * - * Set this parameter to 0 when this feature is not used. In this case we - * (manually) calibrate in all situations mentioned above. - */ -#ifdef CC1200_CONF_CAL_TIMEOUT_SECONDS -#define CC1200_CAL_TIMEOUT_SECONDS CC1200_CONF_CAL_TIMEOUT_SECONDS -#else -/* Calibrate at the latest every 15 minutes */ -#define CC1200_CAL_TIMEOUT_SECONDS 900 -#endif -/*---------------------------------------------------------------------------*/ -/* - * If defined, use these LEDS to indicate TX activity - * - * The LEDs are turned on once the radio enters TX mode - * (together with ENERGEST_ON(ENERGEST_TYPE_TRANSMIT), - * and turned of as soon as TX has completed. - */ -#ifdef CC1200_CONF_TX_LEDS -#define CC1200_TX_LEDS CC1200_CONF_TX_LEDS -#endif -/*---------------------------------------------------------------------------*/ -/* - * If defined, use these LEDS to indicate RX activity - * - * The LEDs are turned on as soon as the first byte is read out from - * the RX FIFO - */ -#ifdef CC1200_CONF_RX_LED -#define CC1200_RX_LEDS CC1200_CONF_RX_LEDS -#endif -/*---------------------------------------------------------------------------*/ - -#endif /* CC1200_H_ */ diff --git a/arch/dev/cc1200/cc1200-const.h b/arch/dev/cc1200/cc1200-const.h deleted file mode 100644 index 077ade559..000000000 --- a/arch/dev/cc1200/cc1200-const.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (c) 2015, Weptech elektronik GmbH Germany - * http://www.weptech.de - * - * 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. - * - * This file is part of the Contiki operating system. - */ - -#ifndef CC1200_CONST_H_ -#define CC1200_CONST_H_ - -/*---------------------------------------------------------------------------*/ -/* Register addresses exported from SmartRF Studio */ -#define CC1200_IOCFG3 0x0000 /* GPIO3 IO Pin Configuration */ -#define CC1200_IOCFG2 0x0001 /* GPIO2 IO Pin Configuration */ -#define CC1200_IOCFG1 0x0002 /* GPIO1 IO Pin Configuration */ -#define CC1200_IOCFG0 0x0003 /* GPIO0 IO Pin Configuration */ -#define CC1200_SYNC3 0x0004 /* Sync Word Configuration [31:24] */ -#define CC1200_SYNC2 0x0005 /* Sync Word Configuration [23:16] */ -#define CC1200_SYNC1 0x0006 /* Sync Word Configuration [15:8] */ -#define CC1200_SYNC0 0x0007 /* Sync Word Configuration [7:0] */ -#define CC1200_SYNC_CFG1 0x0008 /* Sync Word Detection Configuration Reg. 1 */ -#define CC1200_SYNC_CFG0 0x0009 /* Sync Word Detection Configuration Reg. 0 */ -#define CC1200_DEVIATION_M 0x000A /* Frequency Deviation Configuration */ -#define CC1200_MODCFG_DEV_E 0x000B /* Modulation Format and Frequency Deviation Configur.. */ -#define CC1200_DCFILT_CFG 0x000C /* Digital DC Removal Configuration */ -#define CC1200_PREAMBLE_CFG1 0x000D /* Preamble Length Configuration Reg. 1 */ -#define CC1200_PREAMBLE_CFG0 0x000E /* Preamble Detection Configuration Reg. 0 */ -#define CC1200_IQIC 0x000F /* Digital Image Channel Compensation Configuration */ -#define CC1200_CHAN_BW 0x0010 /* Channel Filter Configuration */ -#define CC1200_MDMCFG1 0x0011 /* General Modem Parameter Configuration Reg. 1 */ -#define CC1200_MDMCFG0 0x0012 /* General Modem Parameter Configuration Reg. 0 */ -#define CC1200_SYMBOL_RATE2 0x0013 /* Symbol Rate Configuration Exponent and Mantissa [1.. */ -#define CC1200_SYMBOL_RATE1 0x0014 /* Symbol Rate Configuration Mantissa [15:8] */ -#define CC1200_SYMBOL_RATE0 0x0015 /* Symbol Rate Configuration Mantissa [7:0] */ -#define CC1200_AGC_REF 0x0016 /* AGC Reference Level Configuration */ -#define CC1200_AGC_CS_THR 0x0017 /* Carrier Sense Threshold Configuration */ -#define CC1200_AGC_GAIN_ADJUST 0x0018 /* RSSI Offset Configuration */ -#define CC1200_AGC_CFG3 0x0019 /* Automatic Gain Control Configuration Reg. 3 */ -#define CC1200_AGC_CFG2 0x001A /* Automatic Gain Control Configuration Reg. 2 */ -#define CC1200_AGC_CFG1 0x001B /* Automatic Gain Control Configuration Reg. 1 */ -#define CC1200_AGC_CFG0 0x001C /* Automatic Gain Control Configuration Reg. 0 */ -#define CC1200_FIFO_CFG 0x001D /* FIFO Configuration */ -#define CC1200_DEV_ADDR 0x001E /* Device Address Configuration */ -#define CC1200_SETTLING_CFG 0x001F /* Frequency Synthesizer Calibration and Settling Con.. */ -#define CC1200_FS_CFG 0x0020 /* Frequency Synthesizer Configuration */ -#define CC1200_WOR_CFG1 0x0021 /* eWOR Configuration Reg. 1 */ -#define CC1200_WOR_CFG0 0x0022 /* eWOR Configuration Reg. 0 */ -#define CC1200_WOR_EVENT0_MSB 0x0023 /* Event 0 Configuration MSB */ -#define CC1200_WOR_EVENT0_LSB 0x0024 /* Event 0 Configuration LSB */ -#define CC1200_RXDCM_TIME 0x0025 /* RX Duty Cycle Mode Configuration */ -#define CC1200_PKT_CFG2 0x0026 /* Packet Configuration Reg. 2 */ -#define CC1200_PKT_CFG1 0x0027 /* Packet Configuration Reg. 1 */ -#define CC1200_PKT_CFG0 0x0028 /* Packet Configuration Reg. 0 */ -#define CC1200_RFEND_CFG1 0x0029 /* RFEND Configuration Reg. 1 */ -#define CC1200_RFEND_CFG0 0x002A /* RFEND Configuration Reg. 0 */ -#define CC1200_PA_CFG1 0x002B /* Power Amplifier Configuration Reg. 1 */ -#define CC1200_PA_CFG0 0x002C /* Power Amplifier Configuration Reg. 0 */ -#define CC1200_ASK_CFG 0x002D /* ASK Configuration */ -#define CC1200_PKT_LEN 0x002E /* Packet Length Configuration */ -#define CC1200_IF_MIX_CFG 0x2F00 /* IF Mix Configuration */ -#define CC1200_FREQOFF_CFG 0x2F01 /* Frequency Offset Correction Configuration */ -#define CC1200_TOC_CFG 0x2F02 /* Timing Offset Correction Configuration */ -#define CC1200_MARC_SPARE 0x2F03 /* MARC Spare */ -#define CC1200_ECG_CFG 0x2F04 /* External Clock Frequency Configuration */ -#define CC1200_MDMCFG2 0x2F05 /* General Modem Parameter Configuration Reg. 2 */ -#define CC1200_EXT_CTRL 0x2F06 /* External Control Configuration */ -#define CC1200_RCCAL_FINE 0x2F07 /* RC Oscillator Calibration Fine */ -#define CC1200_RCCAL_COARSE 0x2F08 /* RC Oscillator Calibration Coarse */ -#define CC1200_RCCAL_OFFSET 0x2F09 /* RC Oscillator Calibration Clock Offset */ -#define CC1200_FREQOFF1 0x2F0A /* Frequency Offset MSB */ -#define CC1200_FREQOFF0 0x2F0B /* Frequency Offset LSB */ -#define CC1200_FREQ2 0x2F0C /* Frequency Configuration [23:16] */ -#define CC1200_FREQ1 0x2F0D /* Frequency Configuration [15:8] */ -#define CC1200_FREQ0 0x2F0E /* Frequency Configuration [7:0] */ -#define CC1200_IF_ADC2 0x2F0F /* Analog to Digital Converter Configuration Reg. 2 */ -#define CC1200_IF_ADC1 0x2F10 /* Analog to Digital Converter Configuration Reg. 1 */ -#define CC1200_IF_ADC0 0x2F11 /* Analog to Digital Converter Configuration Reg. 0 */ -#define CC1200_FS_DIG1 0x2F12 /* Frequency Synthesizer Digital Reg. 1 */ -#define CC1200_FS_DIG0 0x2F13 /* Frequency Synthesizer Digital Reg. 0 */ -#define CC1200_FS_CAL3 0x2F14 /* Frequency Synthesizer Calibration Reg. 3 */ -#define CC1200_FS_CAL2 0x2F15 /* Frequency Synthesizer Calibration Reg. 2 */ -#define CC1200_FS_CAL1 0x2F16 /* Frequency Synthesizer Calibration Reg. 1 */ -#define CC1200_FS_CAL0 0x2F17 /* Frequency Synthesizer Calibration Reg. 0 */ -#define CC1200_FS_CHP 0x2F18 /* Frequency Synthesizer Charge Pump Configuration */ -#define CC1200_FS_DIVTWO 0x2F19 /* Frequency Synthesizer Divide by 2 */ -#define CC1200_FS_DSM1 0x2F1A /* FS Digital Synthesizer Module Configuration Reg. 1 */ -#define CC1200_FS_DSM0 0x2F1B /* FS Digital Synthesizer Module Configuration Reg. 0 */ -#define CC1200_FS_DVC1 0x2F1C /* Frequency Synthesizer Divider Chain Configuration .. */ -#define CC1200_FS_DVC0 0x2F1D /* Frequency Synthesizer Divider Chain Configuration .. */ -#define CC1200_FS_LBI 0x2F1E /* Frequency Synthesizer Local Bias Configuration */ -#define CC1200_FS_PFD 0x2F1F /* Frequency Synthesizer Phase Frequency Detector Con.. */ -#define CC1200_FS_PRE 0x2F20 /* Frequency Synthesizer Prescaler Configuration */ -#define CC1200_FS_REG_DIV_CML 0x2F21 /* Frequency Synthesizer Divider Regulator Configurat.. */ -#define CC1200_FS_SPARE 0x2F22 /* Frequency Synthesizer Spare */ -#define CC1200_FS_VCO4 0x2F23 /* FS Voltage Controlled Oscillator Configuration Reg.. */ -#define CC1200_FS_VCO3 0x2F24 /* FS Voltage Controlled Oscillator Configuration Reg.. */ -#define CC1200_FS_VCO2 0x2F25 /* FS Voltage Controlled Oscillator Configuration Reg.. */ -#define CC1200_FS_VCO1 0x2F26 /* FS Voltage Controlled Oscillator Configuration Reg.. */ -#define CC1200_FS_VCO0 0x2F27 /* FS Voltage Controlled Oscillator Configuration Reg.. */ -#define CC1200_GBIAS6 0x2F28 /* Global Bias Configuration Reg. 6 */ -#define CC1200_GBIAS5 0x2F29 /* Global Bias Configuration Reg. 5 */ -#define CC1200_GBIAS4 0x2F2A /* Global Bias Configuration Reg. 4 */ -#define CC1200_GBIAS3 0x2F2B /* Global Bias Configuration Reg. 3 */ -#define CC1200_GBIAS2 0x2F2C /* Global Bias Configuration Reg. 2 */ -#define CC1200_GBIAS1 0x2F2D /* Global Bias Configuration Reg. 1 */ -#define CC1200_GBIAS0 0x2F2E /* Global Bias Configuration Reg. 0 */ -#define CC1200_IFAMP 0x2F2F /* Intermediate Frequency Amplifier Configuration */ -#define CC1200_LNA 0x2F30 /* Low Noise Amplifier Configuration */ -#define CC1200_RXMIX 0x2F31 /* RX Mixer Configuration */ -#define CC1200_XOSC5 0x2F32 /* Crystal Oscillator Configuration Reg. 5 */ -#define CC1200_XOSC4 0x2F33 /* Crystal Oscillator Configuration Reg. 4 */ -#define CC1200_XOSC3 0x2F34 /* Crystal Oscillator Configuration Reg. 3 */ -#define CC1200_XOSC2 0x2F35 /* Crystal Oscillator Configuration Reg. 2 */ -#define CC1200_XOSC1 0x2F36 /* Crystal Oscillator Configuration Reg. 1 */ -#define CC1200_XOSC0 0x2F37 /* Crystal Oscillator Configuration Reg. 0 */ -#define CC1200_ANALOG_SPARE 0x2F38 /* Analog Spare */ -#define CC1200_PA_CFG3 0x2F39 /* Power Amplifier Configuration Reg. 3 */ -#define CC1200_WOR_TIME1 0x2F64 /* eWOR Timer Counter Value MSB */ -#define CC1200_WOR_TIME0 0x2F65 /* eWOR Timer Counter Value LSB */ -#define CC1200_WOR_CAPTURE1 0x2F66 /* eWOR Timer Capture Value MSB */ -#define CC1200_WOR_CAPTURE0 0x2F67 /* eWOR Timer Capture Value LSB */ -#define CC1200_BIST 0x2F68 /* MARC Built-In Self-Test */ -#define CC1200_DCFILTOFFSET_I1 0x2F69 /* DC Filter Offset I MSB */ -#define CC1200_DCFILTOFFSET_I0 0x2F6A /* DC Filter Offset I LSB */ -#define CC1200_DCFILTOFFSET_Q1 0x2F6B /* DC Filter Offset Q MSB */ -#define CC1200_DCFILTOFFSET_Q0 0x2F6C /* DC Filter Offset Q LSB */ -#define CC1200_IQIE_I1 0x2F6D /* IQ Imbalance Value I MSB */ -#define CC1200_IQIE_I0 0x2F6E /* IQ Imbalance Value I LSB */ -#define CC1200_IQIE_Q1 0x2F6F /* IQ Imbalance Value Q MSB */ -#define CC1200_IQIE_Q0 0x2F70 /* IQ Imbalance Value Q LSB */ -#define CC1200_RSSI1 0x2F71 /* Received Signal Strength Indicator Reg. 1 */ -#define CC1200_RSSI0 0x2F72 /* Received Signal Strength Indicator Reg.0 */ -#define CC1200_MARCSTATE 0x2F73 /* MARC State */ -#define CC1200_LQI_VAL 0x2F74 /* Link Quality Indicator Value */ -#define CC1200_PQT_SYNC_ERR 0x2F75 /* Preamble and Sync Word Error */ -#define CC1200_DEM_STATUS 0x2F76 /* Demodulator Status */ -#define CC1200_FREQOFF_EST1 0x2F77 /* Frequency Offset Estimate MSB */ -#define CC1200_FREQOFF_EST0 0x2F78 /* Frequency Offset Estimate LSB */ -#define CC1200_AGC_GAIN3 0x2F79 /* Automatic Gain Control Reg. 3 */ -#define CC1200_AGC_GAIN2 0x2F7A /* Automatic Gain Control Reg. 2 */ -#define CC1200_AGC_GAIN1 0x2F7B /* Automatic Gain Control Reg. 1 */ -#define CC1200_AGC_GAIN0 0x2F7C /* Automatic Gain Control Reg. 0 */ -#define CC1200_CFM_RX_DATA_OUT 0x2F7D /* Custom Frequency Modulation RX Data */ -#define CC1200_CFM_TX_DATA_IN 0x2F7E /* Custom Frequency Modulation TX Data */ -#define CC1200_ASK_SOFT_RX_DATA 0x2F7F /* ASK Soft Decision Output */ -#define CC1200_RNDGEN 0x2F80 /* Random Number Generator Value */ -#define CC1200_MAGN2 0x2F81 /* Signal Magnitude after CORDIC [16] */ -#define CC1200_MAGN1 0x2F82 /* Signal Magnitude after CORDIC [15:8] */ -#define CC1200_MAGN0 0x2F83 /* Signal Magnitude after CORDIC [7:0] */ -#define CC1200_ANG1 0x2F84 /* Signal Angular after CORDIC [9:8] */ -#define CC1200_ANG0 0x2F85 /* Signal Angular after CORDIC [7:0] */ -#define CC1200_CHFILT_I2 0x2F86 /* Channel Filter Data Real Part [16] */ -#define CC1200_CHFILT_I1 0x2F87 /* Channel Filter Data Real Part [15:8] */ -#define CC1200_CHFILT_I0 0x2F88 /* Channel Filter Data Real Part [7:0] */ -#define CC1200_CHFILT_Q2 0x2F89 /* Channel Filter Data Imaginary Part [16] */ -#define CC1200_CHFILT_Q1 0x2F8A /* Channel Filter Data Imaginary Part [15:8] */ -#define CC1200_CHFILT_Q0 0x2F8B /* Channel Filter Data Imaginary Part [7:0] */ -#define CC1200_GPIO_STATUS 0x2F8C /* General Purpose Input/Output Status */ -#define CC1200_FSCAL_CTRL 0x2F8D /* Frequency Synthesizer Calibration Control */ -#define CC1200_PHASE_ADJUST 0x2F8E /* Frequency Synthesizer Phase Adjust */ -#define CC1200_PARTNUMBER 0x2F8F /* Part Number */ -#define CC1200_PARTVERSION 0x2F90 /* Part Revision */ -#define CC1200_SERIAL_STATUS 0x2F91 /* Serial Status */ -#define CC1200_MODEM_STATUS1 0x2F92 /* Modem Status Reg. 1 */ -#define CC1200_MODEM_STATUS0 0x2F93 /* Modem Status Reg. 0 */ -#define CC1200_MARC_STATUS1 0x2F94 /* MARC Status Reg. 1 */ -#define CC1200_MARC_STATUS0 0x2F95 /* MARC Status Reg. 0 */ -#define CC1200_PA_IFAMP_TEST 0x2F96 /* Power Amplifier Intermediate Frequency Amplifier T.. */ -#define CC1200_FSRF_TEST 0x2F97 /* Frequency Synthesizer Test */ -#define CC1200_PRE_TEST 0x2F98 /* Frequency Synthesizer Prescaler Test */ -#define CC1200_PRE_OVR 0x2F99 /* Frequency Synthesizer Prescaler Override */ -#define CC1200_ADC_TEST 0x2F9A /* Analog to Digital Converter Test */ -#define CC1200_DVC_TEST 0x2F9B /* Digital Divider Chain Test */ -#define CC1200_ATEST 0x2F9C /* Analog Test */ -#define CC1200_ATEST_LVDS 0x2F9D /* Analog Test LVDS */ -#define CC1200_ATEST_MODE 0x2F9E /* Analog Test Mode */ -#define CC1200_XOSC_TEST1 0x2F9F /* Crystal Oscillator Test Reg. 1 */ -#define CC1200_XOSC_TEST0 0x2FA0 /* Crystal Oscillator Test Reg. 0 */ -#define CC1200_AES 0x2FA1 /* AES */ -#define CC1200_MDM_TEST 0x2FA2 /* MODEM Test */ -#define CC1200_RXFIRST 0x2FD2 /* RX FIFO Pointer First Entry */ -#define CC1200_TXFIRST 0x2FD3 /* TX FIFO Pointer First Entry */ -#define CC1200_RXLAST 0x2FD4 /* RX FIFO Pointer Last Entry */ -#define CC1200_TXLAST 0x2FD5 /* TX FIFO Pointer Last Entry */ -#define CC1200_NUM_TXBYTES 0x2FD6 /* TX FIFO Status */ -#define CC1200_NUM_RXBYTES 0x2FD7 /* RX FIFO Status */ -#define CC1200_FIFO_NUM_TXBYTES 0x2FD8 /* TX FIFO Status */ -#define CC1200_FIFO_NUM_RXBYTES 0x2FD9 /* RX FIFO Status */ -#define CC1200_RXFIFO_PRE_BUF 0x2FDA /* RX FIFO Status */ -#define CC1200_AES_KEY15 0x2FE0 /* Advanced Encryption Standard Key [127:120] */ -#define CC1200_AES_KEY14 0x2FE1 /* Advanced Encryption Standard Key [119:112] */ -#define CC1200_AES_KEY13 0x2FE2 /* Advanced Encryption Standard Key [111:104] */ -#define CC1200_AES_KEY12 0x2FE3 /* Advanced Encryption Standard Key [103:96] */ -#define CC1200_AES_KEY11 0x2FE4 /* Advanced Encryption Standard Key [95:88] */ -#define CC1200_AES_KEY10 0x2FE5 /* Advanced Encryption Standard Key [87:80] */ -#define CC1200_AES_KEY9 0x2FE6 /* Advanced Encryption Standard Key [79:72] */ -#define CC1200_AES_KEY8 0x2FE7 /* Advanced Encryption Standard Key [71:64] */ -#define CC1200_AES_KEY7 0x2FE8 /* Advanced Encryption Standard Key [63:56] */ -#define CC1200_AES_KEY6 0x2FE9 /* Advanced Encryption Standard Key [55:48] */ -#define CC1200_AES_KEY5 0x2FEA /* Advanced Encryption Standard Key [47:40] */ -#define CC1200_AES_KEY4 0x2FEB /* Advanced Encryption Standard Key [39:32] */ -#define CC1200_AES_KEY3 0x2FEC /* Advanced Encryption Standard Key [31:24] */ -#define CC1200_AES_KEY2 0x2FED /* Advanced Encryption Standard Key [23:16] */ -#define CC1200_AES_KEY1 0x2FEE /* Advanced Encryption Standard Key [15:8] */ -#define CC1200_AES_KEY0 0x2FEF /* Advanced Encryption Standard Key [7:0] */ -#define CC1200_AES_BUFFER15 0x2FF0 /* Advanced Encryption Standard Buffer [127:120] */ -#define CC1200_AES_BUFFER14 0x2FF1 /* Advanced Encryption Standard Buffer [119:112] */ -#define CC1200_AES_BUFFER13 0x2FF2 /* Advanced Encryption Standard Buffer [111:104] */ -#define CC1200_AES_BUFFER12 0x2FF3 /* Advanced Encryption Standard Buffer [103:93] */ -#define CC1200_AES_BUFFER11 0x2FF4 /* Advanced Encryption Standard Buffer [95:88] */ -#define CC1200_AES_BUFFER10 0x2FF5 /* Advanced Encryption Standard Buffer [87:80] */ -#define CC1200_AES_BUFFER9 0x2FF6 /* Advanced Encryption Standard Buffer [79:72] */ -#define CC1200_AES_BUFFER8 0x2FF7 /* Advanced Encryption Standard Buffer [71:64] */ -#define CC1200_AES_BUFFER7 0x2FF8 /* Advanced Encryption Standard Buffer [63:56] */ -#define CC1200_AES_BUFFER6 0x2FF9 /* Advanced Encryption Standard Buffer [55:48] */ -#define CC1200_AES_BUFFER5 0x2FFA /* Advanced Encryption Standard Buffer [47:40] */ -#define CC1200_AES_BUFFER4 0x2FFB /* Advanced Encryption Standard Buffer [39:32] */ -#define CC1200_AES_BUFFER3 0x2FFC /* Advanced Encryption Standard Buffer [31:24] */ -#define CC1200_AES_BUFFER2 0x2FFD /* Advanced Encryption Standard Buffer [23:16] */ -#define CC1200_AES_BUFFER1 0x2FFE /* Advanced Encryption Standard Buffer [15:8] */ -#define CC1200_AES_BUFFER0 0x2FFF /* Advanced Encryption Standard Buffer [7:0] */ -/*---------------------------------------------------------------------------*/ -/* Access to RX / TX FIFO */ -#define CC1200_TXFIFO 0x3F -#define CC1200_RXFIFO 0x3F -/*---------------------------------------------------------------------------*/ -/* MARC_STATE */ -#define CC1200_MARC_STATE_SLEEP 0x00 -#define CC1200_MARC_STATE_IDLE 0x01 -#define CC1200_MARC_STATE_RX 0x0D -#define CC1200_MARC_STATE_RX_FIFO_ERR 0x11 -#define CC1200_MARC_STATE_TX 0x13 -#define CC1200_MARC_STATE_TX_FIFO_ERR 0x16 -/*---------------------------------------------------------------------------*/ -/* Status byte */ -#define CC1200_STATUS_BYTE_IDLE (0 << 4) -#define CC1200_STATUS_BYTE_RX (1 << 4) -#define CC1200_STATUS_BYTE_TX (2 << 4) -#define CC1200_STATUS_BYTE_FSTXON (3 << 4) -#define CC1200_STATUS_BYTE_CALIBRATE (4 << 4) -#define CC1200_STATUS_BYTE_SETTLING (5 << 4) -#define CC1200_STATUS_BYTE_RX_FIFO_ERR (6 << 4) -#define CC1200_STATUS_BYTE_TX_FIFO_ERR (7 << 4) -/*---------------------------------------------------------------------------*/ -/* GPIO configuration */ -#define CC1200_IOCFG_RXFIFO_THR 0 -#define CC1200_IOCFG_RXFFIFO_THR_PKT 1 -#define CC1200_IOCFG_TXFIFO_THR 2 -#define CC1200_IOCFG_PKT_SYNC_RXTX 6 -#define CC1200_IOCFG_SERIAL_CLK 8 -#define CC1200_IOCFG_SERIAL_RX 9 -#define CC1200_IOCFG_CARRIER_SENSE 17 -#define CC1200_IOCFG_MARC_2PIN_STATUS_1 37 -#define CC1200_IOCFG_MARC_2PIN_STATUS_0 38 -#define CC1200_IOCFG_RXFIFO_CHIP_RDY_N 50 -/*---------------------------------------------------------------------------*/ -/* Command strobes */ -#define CC1200_SRES 0x30 -#define CC1200_SFSTXON 0x31 -#define CC1200_SXOFF 0x32 -#define CC1200_SCAL 0x33 -#define CC1200_SRX 0x34 -#define CC1200_STX 0x35 -#define CC1200_SIDLE 0x36 -#define CC1200_SPWD 0x39 -#define CC1200_SFRX 0x3A -#define CC1200_SFTX 0x3B -#define CC1200_SNOP 0x3D -/*---------------------------------------------------------------------------*/ -/* SPI access modifier */ -#define CC1200_WRITE_BIT 0x00 -#define CC1200_READ_BIT 0x80 -#define CC1200_BURST_BIT 0x40 -#define CC1200_EXTENDED_WRITE_CMD (0x2F | CC1200_WRITE_BIT) -#define CC1200_EXTENDED_BURST_WRITE_CMD \ - (0x2F | CC1200_BURST_BIT | CC1200_WRITE_BIT) -#define CC1200_EXTENDED_READ_CMD (0x2F | CC1200_READ_BIT) -#define CC1200_EXTENDED_BURST_READ_CMD \ - (0x2F | CC1200_BURST_BIT | CC1200_READ_BIT) -/*---------------------------------------------------------------------------*/ -#define CC1200_IS_EXTENDED_ADDR(x) (x & 0x2F00) -/*---------------------------------------------------------------------------*/ -/* RSSI0 register */ -#define CC1200_CARRIER_SENSE_VALID (1 << 1) -#define CC1200_CARRIER_SENSE (1 << 2) -/*---------------------------------------------------------------------------*/ -/* MODEM_STATUS1 register */ -#define CC1200_SYNC_FOUND (1 << 7) -#define CC1200_PQT_REACHED (1 << 1) -/*---------------------------------------------------------------------------*/ -#define CC1200_FIFO_SIZE 128 -/*---------------------------------------------------------------------------*/ -/* Output power in dBm */ -/* Up to now we don't handle the special power levels PA_POWER_RAMP < 3, hence - * the minimum tx power is -16. See update_txpower(). - */ -#define CC1200_CONST_TX_POWER_MIN (-16) -/* - * Maximum output power will propably depend on the band we use due to - * regulation issues - */ -#define CC1200_CONST_TX_POWER_MAX 14 -/*---------------------------------------------------------------------------*/ -/* CCA threshold in dBm */ -#define CC1200_CONST_CCA_THRESHOLD_MIN (-127) -#define CC1200_CONST_CCA_THRESHOLD_MAX 127 - -#endif /* CC1200_CONST_H_ */ diff --git a/arch/dev/cc1200/cc1200-rf-cfg.h b/arch/dev/cc1200/cc1200-rf-cfg.h deleted file mode 100644 index 3042ffdd5..000000000 --- a/arch/dev/cc1200/cc1200-rf-cfg.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2015, Weptech elektronik GmbH Germany - * http://www.weptech.de - * - * 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. - * - * This file is part of the Contiki operating system. - */ - -#ifndef CC1200_RF_CFG_H -#define CC1200_RF_CFG_H - -#include "contiki.h" - -#include -#include - -/*---------------------------------------------------------------------------*/ -/* - * We export the register setup from SmartRF using the standard template - * "trxEB RF Settings Performance Line" and have therefore to typedef - * the following struct. - */ -typedef struct cc1200_registerSetting { - uint16_t addr; - uint8_t val; -} registerSetting_t; -/*---------------------------------------------------------------------------*/ -/* Map SmartRF typedef to reflect Contiki's naming conventions */ -typedef registerSetting_t cc1200_register_settings_t; -/*---------------------------------------------------------------------------*/ -/* This struct holds the complete configuration for a given mode */ -typedef struct cc1200_rf_cfg { - /* A string describing the mode */ - const char *cfg_descriptor; - /* A pointer to a register setup exported from SmartRF */ - const cc1200_register_settings_t *register_settings; - /* The size of the register setup */ - size_t size_of_register_settings; - /* - * TX packet lifetime. Maximum duration of a TX packet including preamble, - * synch word + phy header, payload + CRC. - */ - rtimer_clock_t tx_pkt_lifetime; - /* The maximum time it takes to switch from Tx to Rx */ - rtimer_clock_t tx_rx_turnaround; - /* The delay between a call to transmit() and end of SFD */ - rtimer_clock_t delay_before_tx; - /* Delay between GO signal and start listening - * Measured 104us: between GO signal and start listening */ - rtimer_clock_t delay_before_rx; - /* Delay between the SFD finishes arriving and it is detected in software */ - rtimer_clock_t delay_before_detect; - /* Base frequency in kHz */ - uint32_t chan_center_freq0; - /* Channel spacing in Hz */ - uint32_t chan_spacing; - /* The minimum channel */ - uint8_t min_channel; - /* The maximum channel */ - uint8_t max_channel; - /* The maximum output power in dBm */ - int8_t max_txpower; - /* - * The carrier sense level used for CCA in dBm (int8_t). Limited by - * CC1200_CONST_CCA_THRESHOLD_MIN and CC1200_CONST_CCA_THRESHOLD_MAX. - */ - int8_t cca_threshold; - /* The RSSI offset in dBm. - * -99 when MDMCFG1.DVGA_GAIN=00, -81 when MDMCFG1.DVGA_GAIN=01 */ - int8_t rssi_offset; - /* The bitrate in bps */ - uint32_t bitrate; - /* TSCH timeslot timing */ - const uint16_t *tsch_timing; -} cc1200_rf_cfg_t; -/*---------------------------------------------------------------------------*/ -#endif /* CC1200_RF_CFG_H */ diff --git a/arch/dev/cc1200/cc1200.c b/arch/dev/cc1200/cc1200.c deleted file mode 100644 index 50babb93d..000000000 --- a/arch/dev/cc1200/cc1200.c +++ /dev/null @@ -1,2555 +0,0 @@ -/* - * Copyright (c) 2015, Weptech elektronik GmbH Germany - * http://www.weptech.de - * - * 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. - * - * This file is part of the Contiki operating system. - */ - -#include "cc1200-const.h" -#include "cc1200-conf.h" -#include "cc1200-arch.h" -#include "cc1200-rf-cfg.h" - -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "dev/watchdog.h" -#include "sys/energest.h" - -#include "dev/leds.h" - -#include -#include - -static int16_t rssi; -static rtimer_clock_t sfd_timestamp = 0; - -/*---------------------------------------------------------------------------*/ -/* Various implementation specific defines */ -/*---------------------------------------------------------------------------*/ -/* - * The debug level to use - * - 0: No output at all - * - 1: Print errors (unrecoverable) - * - 2: Print errors + warnings (recoverable errors) - * - 3: Print errors + warnings + information (what's going on...) - */ -#define DEBUG_LEVEL 0 -/* - * RF test mode. Blocks inside "configure()". - * - Set this parameter to 1 in order to produce an modulated carrier (PN9) - * - Set this parameter to 2 in order to produce an unmodulated carrier - * - Set this parameter to 3 in order to switch to rx synchronous mode - * The channel is set according to CC1200_DEFAULT_CHANNEL - */ -#ifndef CC1200_RF_TESTMODE -#define CC1200_RF_TESTMODE 0 -#endif - -#if CC1200_RF_TESTMODE -#undef CC1200_RF_CFG -#if CC1200_RF_TESTMODE == 1 -#define CC1200_RF_CFG cc1200_802154g_863_870_fsk_50kbps -#elif CC1200_RF_TESTMODE == 2 -#define CC1200_RF_CFG cc1200_802154g_863_870_fsk_50kbps -#elif CC1200_RF_TESTMODE == 3 -#define CC1200_RF_CFG cc1200_802154g_863_870_fsk_50kbps -#endif -#endif -/* - * When set, a software buffer is used to store outgoing packets before copying - * to Tx FIFO. This enabled sending packets larger than the FIFO. When unset, - * no buffer is used; instead, the payload is copied directly to the Tx FIFO. - * This is requried by TSCH, for shorter and more predictable delay in the Tx - * chain. This, however, restircts the payload length to the Tx FIFO size. - */ -#define CC1200_WITH_TX_BUF (!MAC_CONF_WITH_TSCH) -/* - * Set this parameter to 1 in order to use the MARC_STATE register when - * polling the chips's status. Else use the status byte returned when sending - * a NOP strobe. - * - * TODO: Option to be removed upon approval of the driver - */ -#define STATE_USES_MARC_STATE 0 -/* - * Set this parameter to 1 in order to speed up transmission by - * sending a FSTXON strobe before filling the FIFO. - * - * TODO: Option to be removed upon approval of the driver - */ -#if MAC_CONF_WITH_TSCH -#define USE_SFSTXON 0 -#else /* MAC_CONF_WITH_TSCH */ -#define USE_SFSTXON 1 -#endif /* MAC_CONF_WITH_TSCH */ -/*---------------------------------------------------------------------------*/ -/* Phy header length */ -#if CC1200_802154G -/* Phy header = 2 byte */ -#define PHR_LEN 2 -#else -/* Phy header = length byte = 1 byte */ -#define PHR_LEN 1 -#endif /* #if CC1200_802154G */ -/*---------------------------------------------------------------------------*/ -/* Size of appendix (rssi + lqi) appended to the rx pkt */ -#define APPENDIX_LEN 2 -/*---------------------------------------------------------------------------*/ -/* Verify payload length */ -/*---------------------------------------------------------------------------*/ -#if CC1200_802154G -#if CC1200_USE_GPIO2 -#if CC1200_MAX_PAYLOAD_LEN > (2048 - PHR_LEN) -#error Payload length not supported by this driver -#endif -#else -#if CC1200_MAX_PAYLOAD_LEN > (CC1200_FIFO_SIZE - PHR_LEN) -/* PHR_LEN = 2 -> we can only place 126 payload bytes bytes in the FIFO */ -#error Payload length not supported without GPIO2 -#endif -#endif /* #if CC1200_USE_GPIO2 */ -#else /* #if CC1200_802154G */ -#if CC1200_MAX_PAYLOAD_LEN > (CC1200_FIFO_SIZE - PHR_LEN) -/* PHR_LEN = 1 -> we can only place 127 payload bytes bytes in the FIFO */ -#error Payload length not supported without enabling 802.15.4g mode -#endif -#endif /* #if CC1200_802154G */ -/*---------------------------------------------------------------------------*/ -/* Main driver configurations settings. Don't touch! */ -/*---------------------------------------------------------------------------*/ -#if CC1200_USE_GPIO2 -/* Use GPIO2 as RX / TX FIFO threshold indicator pin */ -#define GPIO2_IOCFG CC1200_IOCFG_RXFIFO_THR -/* This is the FIFO threshold we use */ -#if MAC_CONF_WITH_TSCH -#if CC1200_802154G -#define FIFO_THRESHOLD 1 -#else -#define FIFO_THRESHOLD 0 -#endif -#else /* MAC_CONF_WITH_TSCH */ -#define FIFO_THRESHOLD 32 -#endif /* MAC_CONF_WITH_TSCH */ -/* Turn on RX after packet reception */ -#define RXOFF_MODE_RX 1 -/* Let the CC1200 append RSSI + LQI */ -#define APPEND_STATUS 1 -#else -/* Arbitrary configuration for GPIO2 */ -#define GPIO2_IOCFG CC1200_IOCFG_MARC_2PIN_STATUS_0 -#if (CC1200_MAX_PAYLOAD_LEN <= (CC1200_FIFO_SIZE - PHR_LEN - APPENDIX_LEN)) -/* - * Read out RX FIFO at the end of the packet (GPIO0 falling edge). RX restarts - * automatically - */ -#define RXOFF_MODE_RX 1 -/* Let the CC1200 append RSSI + LQI */ -#define APPEND_STATUS 1 -#else -/* - * Read out RX FIFO at the end of the packet (GPIO0 falling edge). RX has - * to be started manually in this case - */ -#define RXOFF_MODE_RX 0 -/* No space for appendix in the RX FIFO. Read it out by hand */ -#define APPEND_STATUS 0 -#endif /* #if CC1200_MAX_PAYLOAD_LEN <= 125 */ -#endif /* #if CC1200_USE_GPIO2 */ - -/* Read out packet on falling edge of GPIO0 */ -#define GPIO0_IOCFG CC1200_IOCFG_PKT_SYNC_RXTX -/* Arbitrary configuration for GPIO3 */ -#define GPIO3_IOCFG CC1200_IOCFG_MARC_2PIN_STATUS_0 -/* Turn on RX automatically after TX */ -#define TXOFF_MODE_RX 1 -#if APPEND_STATUS -/* CC1200 places two bytes in the RX FIFO */ -#define CC_APPENDIX_LEN 2 -#else -/* CC1200 doesn't add appendix to RX FIFO */ -#define CC_APPENDIX_LEN 0 -#endif /* #if APPEND_STATUS */ -/*---------------------------------------------------------------------------*/ -/* RF configuration */ -/*---------------------------------------------------------------------------*/ -/* Import the rf configuration set by CC1200_RF_CFG */ -extern const cc1200_rf_cfg_t CC1200_RF_CFG; -/*---------------------------------------------------------------------------*/ -/* This defines the way we calculate the frequency registers */ -/*---------------------------------------------------------------------------*/ -/* XTAL frequency in kHz */ -#define XTAL_FREQ_KHZ 40000 -/* - * Divider + multiplier for calculation of FREQ registers - * f * 2^16 * 4 / 40000 = f * 2^12 / 625 (no overflow up to frequencies of - * 1048.576 MHz using uint32_t) - */ -#define LO_DIVIDER 4 -#if (XTAL_FREQ_KHZ == 40000) && (LO_DIVIDER == 4) -#define FREQ_DIVIDER 625 -#define FREQ_MULTIPLIER 4096 -#else -#error Invalid settings for frequency calculation -#endif -/*---------------------------------------------------------------------------*/ -#if STATE_USES_MARC_STATE -/* We use the MARC_STATE register to poll the chip's status */ -#define STATE_IDLE CC1200_MARC_STATE_IDLE -#define STATE_RX CC1200_MARC_STATE_RX -#define STATE_TX CC1200_MARC_STATE_TX -#define STATE_RX_FIFO_ERROR CC1200_MARC_STATE_RX_FIFO_ERR -#define STATE_TX_FIFO_ERROR CC1200_MARC_STATE_TX_FIFO_ERR -#else -/* We use the status byte read out using a NOP strobe */ -#define STATE_IDLE CC1200_STATUS_BYTE_IDLE -#define STATE_RX CC1200_STATUS_BYTE_RX -#define STATE_TX CC1200_STATUS_BYTE_TX -#define STATE_FSTXON CC1200_STATUS_BYTE_FSTXON -#define STATE_CALIBRATE CC1200_STATUS_BYTE_CALIBRATE -#define STATE_SETTLING CC1200_STATUS_BYTE_SETTLING -#define STATE_RX_FIFO_ERR CC1200_STATUS_BYTE_RX_FIFO_ERR -#define STATE_TX_FIFO_ERR CC1200_STATUS_BYTE_TX_FIFO_ERR -#endif /* #if STATE_USES_MARC_STATE */ -/*---------------------------------------------------------------------------*/ -/* Return values for addr_check_auto_ack() */ -/*---------------------------------------------------------------------------*/ -/* Frame cannot be parsed / is to short */ -#define INVALID_FRAME 0 -/* Address check failed */ -#define ADDR_CHECK_FAILED 1 -/* Address check succeeded */ -#define ADDR_CHECK_OK 2 -/* Address check succeeded and ACK was send */ -#define ADDR_CHECK_OK_ACK_SEND 3 -/*---------------------------------------------------------------------------*/ -/* Return values for set_channel() */ -/*---------------------------------------------------------------------------*/ -/* Channel update was performed */ -#define CHANNEL_UPDATE_SUCCEEDED 0 -/* Busy, channel update postponed */ -#define CHANNEL_UPDATE_POSTPONED 1 -/* Invalid channel */ -#define CHANNEL_OUT_OF_LIMITS 2 -/*---------------------------------------------------------------------------*/ -/* Various flags indicating the operating state of the radio. See rf_flags */ -/*---------------------------------------------------------------------------*/ -/* Radio was initialized (= init() was called) */ -#define RF_INITIALIZED 0x01 -/* The radio is on (= not in standby) */ -#define RF_ON 0x02 -/* An incoming packet was detected (at least payload length was received */ -#define RF_RX_PROCESSING_PKT 0x04 -/* TX is ongoing */ -#define RF_TX_ACTIVE 0x08 -/* Channel update required */ -#define RF_UPDATE_CHANNEL 0x10 -/* SPI was locked when calling RX interrupt, let the pollhandler do the job */ -#define RF_POLL_RX_INTERRUPT 0x20 -/* Ongoing reception */ -#define RF_RX_ONGOING 0x40 -/* Force calibration in case we don't use CC1200 AUTOCAL + timeout */ -#if !CC1200_AUTOCAL -#if CC1200_CAL_TIMEOUT_SECONDS -#define RF_FORCE_CALIBRATION 0x40 -#endif -#endif -/*---------------------------------------------------------------------------*/ -/* Length of 802.15.4 ACK. We discard packets with a smaller size */ -#define ACK_LEN 3 -/*---------------------------------------------------------------------------*/ -/* This is the way we handle the LEDs */ -/*---------------------------------------------------------------------------*/ -#ifdef CC1200_TX_LEDS -#define TX_LEDS_ON() leds_on(CC1200_TX_LEDS) -#define TX_LEDS_OFF() leds_off(CC1200_TX_LEDS) -#else -#define TX_LEDS_ON() -#define TX_LEDS_OFF() -#endif /* #ifdef CC1200_TX_LEDS */ - -#ifdef CC1200_RX_LEDS -#define RX_LEDS_ON() leds_on(CC1200_RX_LEDS) -#define RX_LEDS_OFF() leds_off(CC1200_RX_LEDS) -#else -#define RX_LEDS_ON() -#define RX_LEDS_OFF() -#endif /* #ifdef CC1200_RX_LEDS */ -/*---------------------------------------------------------------------------*/ -/* - * We have to prevent duplicate SPI access. - * We therefore LOCK SPI in order to prevent the rx interrupt to - * interfere. - */ -#define LOCK_SPI() do { spi_locked++; } while(0) -#define SPI_IS_LOCKED() (spi_locked != 0) -#define RELEASE_SPI() do { spi_locked--; } while(0) - -/*---------------------------------------------------------------------------*/ -#if CC1200_USE_GPIO2 -/* Configure GPIO interrupts. GPIO0: falling, GPIO2: rising edge */ -#define SETUP_GPIO_INTERRUPTS() \ - do { \ - cc1200_arch_gpio0_setup_irq(0); \ - cc1200_arch_gpio2_setup_irq(1); \ - } while(0) -#define ENABLE_GPIO_INTERRUPTS() \ - do { \ - cc1200_arch_gpio0_enable_irq(); \ - cc1200_arch_gpio2_enable_irq(); \ - } while(0) -#define DISABLE_GPIO_INTERRUPTS() \ - do { \ - cc1200_arch_gpio0_disable_irq(); \ - cc1200_arch_gpio2_disable_irq(); \ - } while(0) -#else -#define SETUP_GPIO_INTERRUPTS() cc1200_arch_gpio0_setup_irq(0) -#define ENABLE_GPIO_INTERRUPTS() cc1200_arch_gpio0_enable_irq() -#define DISABLE_GPIO_INTERRUPTS() cc1200_arch_gpio0_disable_irq() -#endif /* #if CC1200_USE_GPIO2 */ -/*---------------------------------------------------------------------------*/ -/* Debug macros */ -/*---------------------------------------------------------------------------*/ -#if DEBUG_LEVEL > 0 -/* Show all kind of errors e.g. when passing invalid payload length */ -#define ERROR(...) printf(__VA_ARGS__) -#else -#define ERROR(...) -#endif - -#if DEBUG_LEVEL > 0 -/* This macro is used to check if the radio is in a valid state */ -#define RF_ASSERT(condition) \ - do { \ - if(!(condition)) { \ - printf("RF: Assertion failed in line %d\n", __LINE__); \ - } \ - } while(0) -#else -#define RF_ASSERT(condition) -#endif - -#if DEBUG_LEVEL > 1 -/* Show warnings e.g. for FIFO errors */ -#define WARNING(...) printf(__VA_ARGS__) -#else -#define WARNING(...) -#endif - -#if DEBUG_LEVEL > 2 -/* We just print out what's going on */ -#define INFO(...) printf(__VA_ARGS__) -#else -#define INFO(...) -#endif - -/* Busy-wait (time-bounded) until the radio reaches a given state */ -#define RTIMER_BUSYWAIT_UNTIL_STATE(s, t) RTIMER_BUSYWAIT_UNTIL(state() == (s), t) - -/*---------------------------------------------------------------------------*/ -/* Variables */ -/*---------------------------------------------------------------------------*/ -/* Flag indicating whether non-interrupt routines are using SPI */ -static volatile uint8_t spi_locked = 0; -#if CC1200_WITH_TX_BUF -/* Packet buffer for transmission, filled within prepare() */ -static uint8_t tx_pkt[CC1200_MAX_PAYLOAD_LEN]; -#endif /* CC1200_WITH_TX_BUF */ -/* The number of bytes waiting in tx_pkt */ -static uint16_t tx_pkt_len; -/* Number of bytes from tx_pkt left to write to FIFO */ -uint16_t bytes_left_to_write; -/* Packet buffer for reception */ -static uint8_t rx_pkt[CC1200_MAX_PAYLOAD_LEN + APPENDIX_LEN]; -/* The number of bytes placed in rx_pkt */ -static volatile uint16_t rx_pkt_len = 0; -/* - * The current channel in the range CC1200_RF_CHANNEL_MIN - * to CC1200_RF_CHANNEL_MAX - */ -static uint8_t rf_channel; -/* The next channel requested */ -static uint8_t new_rf_channel; -/* RADIO_PARAM_RX_MODE. Initialized in init() */ -static radio_value_t rx_mode_value; -/* RADIO_PARAM_RX_MODE. Initialized in init() */ -static radio_value_t tx_mode_value; -/* RADIO_PARAM_TXPOWER in dBm. Initialized in init() */ -static int8_t txpower; -static int8_t new_txpower; -/* RADIO_PARAM_CCA_THRESHOLD. Initialized in init() */ -static int8_t cca_threshold; -static int8_t new_cca_threshold; -/* The radio drivers state */ -static uint8_t rf_flags = 0; -#if !CC1200_AUTOCAL && CC1200_CAL_TIMEOUT_SECONDS -/* Use a timeout to decide when to calibrate */ -static unsigned long cal_timer; -#endif -#if CC1200_USE_RX_WATCHDOG -/* Timer used for RX watchdog */ -static struct etimer et; -#endif /* #if CC1200_USE_RX_WATCHDOG */ -/*---------------------------------------------------------------------------*/ -/* Prototypes for Netstack API radio driver functions */ -/*---------------------------------------------------------------------------*/ -/* Init the radio. */ -static int -init(void); -/* Prepare and copy PHY header to Tx FIFO */ -static int -copy_header_to_tx_fifo(unsigned short payload_len); -/* Prepare the radio with a packet to be sent. */ -static int -prepare(const void *payload, unsigned short payload_len); -/* Send the packet that has previously been prepared. */ -static int -transmit(unsigned short payload_len); -/* Prepare & transmit a packet. */ -static int -send(const void *payload, unsigned short payload_len); -/* Read a received packet into a buffer. */ -static int -read(void *buf, unsigned short bufsize); -/* - * Perform a Clear-Channel Assessment (CCA) to find out if there is - * a packet in the air or not. - */ -static int -channel_clear(void); -/* Check if the radio driver is currently receiving a packet. */ -static int -receiving_packet(void); -/* Check if the radio driver has just received a packet. */ -static int -pending_packet(void); -/* Turn the radio on. */ -static int -on(void); -/* Turn the radio off. */ -static int -off(void); -/* Get a radio parameter value. */ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value); -/* Set a radio parameter value. */ -static radio_result_t -set_value(radio_param_t param, radio_value_t value); -/* Get a radio parameter object. */ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size); -/* Set a radio parameter object. */ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size); -/*---------------------------------------------------------------------------*/ -/* The radio driver exported to contiki */ -/*---------------------------------------------------------------------------*/ -const struct radio_driver cc1200_driver = { - init, - prepare, - transmit, - send, - read, - channel_clear, - receiving_packet, - pending_packet, - on, - off, - get_value, - set_value, - get_object, - set_object -}; -/*---------------------------------------------------------------------------*/ -/* Prototypes for CC1200 low level function. All of these functions are - called by the radio driver functions or the rx interrupt, - so there is no need to lock SPI within these functions */ -/*---------------------------------------------------------------------------*/ -/* Send a command strobe. */ -static uint8_t -strobe(uint8_t strobe); -/* Reset CC1200. */ -static void -reset(void); -/* Write a single byte to the specified address. */ -static uint8_t -single_write(uint16_t addr, uint8_t value); -/* Read a single byte from the specified address. */ -static uint8_t -single_read(uint16_t addr); -/* Write a burst of bytes starting at the specified address. */ -static void -burst_write(uint16_t addr, const uint8_t *data, uint8_t data_len); -/* Read a burst of bytes starting at the specified address. */ -static void -burst_read(uint16_t addr, uint8_t *data, uint8_t data_len); -/* Write a list of register settings. */ -static void -write_reg_settings(const registerSetting_t *reg_settings, - uint16_t sizeof_reg_settings); -/* Configure the radio (write basic configuration). */ -static void -configure(void); -/* Return the radio's state. */ -static uint8_t -state(void); -#if !CC1200_AUTOCAL -/* Perform manual calibration. */ -static void -calibrate(void); -#endif -/* Enter IDLE state. */ -static void -idle(void); -/* Enter RX state. */ -static void -idle_calibrate_rx(void); -/* Restart RX from within RX interrupt. */ -static void -rx_rx(void); -/* Fill TX FIFO (if not already done), start TX and wait for TX to complete (blocking!). */ -static int -idle_tx_rx(const uint8_t *payload, uint16_t payload_len); -/* Update TX power */ -static void -update_txpower(int8_t txpower_dbm); -/* Update CCA threshold */ -static void -update_cca_threshold(int8_t threshold_dbm); -/* Calculate FREQ register from channel */ -static uint32_t -calculate_freq(uint8_t channel); -/* Update rf channel if possible, else postpone it (-> pollhandler). */ -static int -set_channel(uint8_t channel); -/* Validate address and send ACK if requested. */ -static int -addr_check_auto_ack(uint8_t *frame, uint16_t frame_len); -/*---------------------------------------------------------------------------*/ -/* Handle tasks left over from rx interrupt or because SPI was locked */ -static void pollhandler(void); -/*---------------------------------------------------------------------------*/ -PROCESS(cc1200_process, "CC1200 driver"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cc1200_process, ev, data) -{ - - PROCESS_POLLHANDLER(pollhandler()); - - PROCESS_BEGIN(); - -#if CC1200_USE_RX_WATCHDOG - while(1) { - - if((rf_flags & (RF_ON | RF_TX_ACTIVE)) == RF_ON) { - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - - /* - * We are on and not in TX. As every function of this driver - * assures that we are in RX mode - * (using RTIMER_BUSYWAIT_UNTIL_STATE(STATE_RX, ...) construct) in - * either rx_rx(), idle_calibrate_rx() or transmit(), - * something probably went wrong in the rx interrupt handler - * if we are not in RX at this point. - */ - - if(cc1200_arch_gpio0_read_pin() == 0) { - - /* - * GPIO de-asserts as soon as we leave RX for what reason ever. No - * reason to check RX as long as it is asserted (we are receiving a - * packet). We should never interfere with the rx interrupt if we - * check GPIO0 in advance... - */ - - LOCK_SPI(); - if(state() != STATE_RX) { - WARNING("RF: RX watchdog triggered!\n"); - rx_rx(); - } - RELEASE_SPI(); - - } - - } else { - PROCESS_YIELD(); - } - - } -#endif /* #if CC1200_USE_RX_WATCHDOG */ - - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_EXIT); - - PROCESS_END(); - -} -/*---------------------------------------------------------------------------*/ -/* Handle tasks left over from rx interrupt or because SPI was locked */ -static void -pollhandler(void) -{ - - if((rf_flags & (RF_ON + RF_POLL_RX_INTERRUPT)) == - (RF_ON + RF_POLL_RX_INTERRUPT)) { - cc1200_rx_interrupt(); - } - - if(rf_flags & RF_UPDATE_CHANNEL) { - /* We couldn't set the channel because we were busy. Try again now. */ - set_channel(new_rf_channel); - } - - if((rx_mode_value & RADIO_RX_MODE_POLL_MODE) == 0 && rx_pkt_len > 0) { - - int len; - - /* - * We received a valid packet. CRC was checked before, - * address filtering was performed (if configured) - * and ACK was send (if configured) - */ - - packetbuf_clear(); - len = read(packetbuf_dataptr(), PACKETBUF_SIZE); - - if(len > 0) { - packetbuf_set_datalen(len); - NETSTACK_MAC.input(); - } - - } - -} -/*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -/* - * Netstack API radio driver functions - */ -/*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ - -/* Initialize radio. */ -static int -init(void) -{ - - INFO("RF: Init (%s)\n", CC1200_RF_CFG.cfg_descriptor); - - if(!(rf_flags & RF_INITIALIZED)) { - - LOCK_SPI(); - - /* Perform low level initialization */ - cc1200_arch_init(); - - /* Configure GPIO interrupts */ - SETUP_GPIO_INTERRUPTS(); - - /* Write initial configuration */ - configure(); - - /* Enable address filtering + auto ack */ - rx_mode_value = (RADIO_RX_MODE_AUTOACK | RADIO_RX_MODE_ADDRESS_FILTER); - - /* Enable CCA */ - tx_mode_value = (RADIO_TX_MODE_SEND_ON_CCA); - - /* Set output power */ - new_txpower = CC1200_RF_CFG.max_txpower; - update_txpower(new_txpower); - - /* Adjust CAA threshold */ - new_cca_threshold = CC1200_RF_CFG.cca_threshold; - update_cca_threshold(new_cca_threshold); - - process_start(&cc1200_process, NULL); - - /* We are on + initialized at this point */ - rf_flags |= (RF_INITIALIZED + RF_ON); - - RELEASE_SPI(); - - /* Set default channel. This will also force initial calibration! */ - set_channel(CC1200_DEFAULT_CHANNEL); - - /* - * We have to call off() before on() because on() relies on the - * configuration of the GPIO0 pin - */ - off(); - } - - return 1; - -} -/*---------------------------------------------------------------------------*/ -/* Prepare the radio with a packet to be sent. */ -static int -prepare(const void *payload, unsigned short payload_len) -{ - - INFO("RF: Prepare (%d)\n", payload_len); - - if((payload_len < ACK_LEN) || - (payload_len > CC1200_MAX_PAYLOAD_LEN)) { - ERROR("RF: Invalid payload length!\n"); - return RADIO_TX_ERR; - } - - tx_pkt_len = payload_len; - -#if CC1200_WITH_TX_BUF - /* Copy payload to buffer, will be sent later */ - memcpy(tx_pkt, payload, tx_pkt_len); -#else /* CC1200_WITH_TX_BUF */ -#if (CC1200_MAX_PAYLOAD_LEN > (CC1200_FIFO_SIZE - PHR_LEN)) -#error CC1200 max payload too large -#else - /* Copy header and payload directly to Radio Tx FIFO (127 bytes max) */ - copy_header_to_tx_fifo(payload_len); - burst_write(CC1200_TXFIFO, payload, payload_len); -#endif -#endif /* CC1200_WITH_TX_BUF */ - - return RADIO_TX_OK; -} -/*---------------------------------------------------------------------------*/ -/* Prepare the radio with a packet to be sent. */ -static int -copy_header_to_tx_fifo(unsigned short payload_len) -{ -#if CC1200_802154G - /* Prepare PHR for 802.15.4g frames */ - struct { - uint8_t phra; - uint8_t phrb; - } phr; -#if CC1200_802154G_CRC16 - payload_len += 2; -#else - payload_len += 4; -#endif - /* Frame length */ - phr.phrb = (uint8_t)(payload_len & 0x00FF); - phr.phra = (uint8_t)((payload_len >> 8) & 0x0007); -#if CC1200_802154G_WHITENING - /* Enable Whitening */ - phr.phra |= (1 << 3); -#endif /* #if CC1200_802154G_WHITENING */ -#if CC1200_802154G_CRC16 - /* FCS type 1, 2 Byte CRC */ - phr.phra |= (1 << 4); -#endif /* #if CC1200_802154G_CRC16 */ -#endif /* #if CC1200_802154G */ - - idle(); - - rf_flags &= ~RF_RX_PROCESSING_PKT; - strobe(CC1200_SFRX); - /* Flush TX FIFO */ - strobe(CC1200_SFTX); - -#if CC1200_802154G - /* Write PHR */ - burst_write(CC1200_TXFIFO, (uint8_t *)&phr, PHR_LEN); -#else - /* Write length byte */ - burst_write(CC1200_TXFIFO, (uint8_t *)&payload_len, PHR_LEN); -#endif /* #if CC1200_802154G */ - - return 0; -} -/*---------------------------------------------------------------------------*/ -/* Send the packet that has previously been prepared. */ -static int -transmit(unsigned short transmit_len) -{ - - uint8_t was_off = 0; - int ret = RADIO_TX_OK; - int txret; - - INFO("RF: Transmit (%d)\n", transmit_len); - - if(transmit_len != tx_pkt_len) { - ERROR("RF: TX length mismatch!\n"); - return RADIO_TX_ERR; - } - - /* TX ongoing. Inhibit channel update & ACK as soon as possible */ - rf_flags |= RF_TX_ACTIVE; - - if(!(rf_flags & RF_ON)) { - /* Radio is off - turn it on */ - was_off = 1; - on(); - /* Radio is in RX now (and calibrated...) */ - } - - if(tx_mode_value & RADIO_TX_MODE_SEND_ON_CCA) { - /* Perform clear channel assessment */ - if(!channel_clear()) { - /* Channel occupied */ - if(was_off) { - off(); - } - rf_flags &= ~RF_TX_ACTIVE; - return RADIO_TX_COLLISION; - } - } - - /* - * Lock SPI here because "on()" and "channel_clear()" - * won't work if SPI is locked! - */ - LOCK_SPI(); - - /* - * Make sure we start from a sane state. idle() also disables - * the GPIO interrupt(s). - */ - idle(); - - /* Update output power */ - if(new_txpower != txpower) { - update_txpower(new_txpower); - } - -#if !CC1200_AUTOCAL - /* Perform manual calibration unless just turned on */ - if(!was_off) { - calibrate(); - } -#endif - - /* Send data using TX FIFO */ -#if CC1200_WITH_TX_BUF - txret = idle_tx_rx(tx_pkt, tx_pkt_len); -#else /* CC1200_WITH_TX_BUF */ - txret = idle_tx_rx(NULL, tx_pkt_len); -#endif /* CC1200_WITH_TX_BUF */ - if(txret == RADIO_TX_OK) { - - /* - * TXOFF_MODE is set to RX, - * let's wait until we are in RX and turn on the GPIO IRQs - * again as they were turned off in idle() - */ - - RTIMER_BUSYWAIT_UNTIL_STATE(STATE_RX, - CC1200_RF_CFG.tx_rx_turnaround); - - ENABLE_GPIO_INTERRUPTS(); - - } else { - - /* - * Something went wrong during TX, idle_tx_rx() returns in IDLE - * state in this case. - * Turn on RX again unless we turn off anyway - */ - - ret = RADIO_TX_ERR; - if(!was_off) { -#ifdef RF_FORCE_CALIBRATION - rf_flags |= RF_FORCE_CALIBRATION; -#endif - idle_calibrate_rx(); - } - } - - /* Release SPI here because "off()" won't work if SPI is locked! */ - RELEASE_SPI(); - - if(was_off) { - off(); - } - - /* TX completed */ - rf_flags &= ~RF_TX_ACTIVE; - - return ret; - -} -/*---------------------------------------------------------------------------*/ -/* Prepare & transmit a packet. */ -static int -send(const void *payload, unsigned short payload_len) -{ - - int ret; - - INFO("RF: Send (%d)\n", payload_len); - - /* payload_len checked within prepare() */ - if((ret = prepare(payload, payload_len)) == RADIO_TX_OK) { - ret = transmit(payload_len); - } - - return ret; - -} -/*---------------------------------------------------------------------------*/ -/* Read a received packet into a buffer. */ -static int -read(void *buf, unsigned short buf_len) -{ - - int len = 0; - - if(rx_pkt_len > 0) { - - rssi = (int8_t)rx_pkt[rx_pkt_len - 2] + (int)CC1200_RF_CFG.rssi_offset; - /* CRC is already checked */ - uint8_t crc_lqi = rx_pkt[rx_pkt_len - 1]; - - len = rx_pkt_len - APPENDIX_LEN; - - if(len > buf_len) { - - ERROR("RF: Failed to read packet (too big)!\n"); - - } else { - - INFO("RF: Read (%d bytes, %d dBm)\n", len, rssi); - - memcpy((void *)buf, (const void *)rx_pkt, len); - - /* Release rx_pkt */ - rx_pkt_len = 0; - - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, rssi); - /* Mask out CRC bit */ - packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, - crc_lqi & ~(1 << 7)); - } - - } - - return len; - -} -/*---------------------------------------------------------------------------*/ -/* - * Perform a Clear-Channel Assessment (CCA) to find out if there is a - * packet in the air or not. - */ -static int -channel_clear(void) -{ - - uint8_t cca, was_off = 0; - - if(SPI_IS_LOCKED()) { - /* Probably locked in rx interrupt. Return "channel occupied" */ - return 0; - } - - if(!(rf_flags & RF_ON)) { - /* We are off */ - was_off = 1; - on(); - } - - LOCK_SPI(); - - RF_ASSERT(state() == STATE_RX); - - /* - * At this point we should be in RX. If GPIO0 is set, we are currently - * receiving a packet, no need to check the RSSI. Or is there any situation - * when we want access the channel even if we are currently receiving a - * packet??? - */ - - if(cc1200_arch_gpio0_read_pin() == 1) { - /* Channel occupied */ - INFO("RF: CCA (0)\n"); - cca = 0; - } else { - - uint8_t rssi0; - - /* Update CCA threshold */ - if(new_cca_threshold != cca_threshold) { - update_cca_threshold(new_cca_threshold); - } - - /* Wait for CARRIER_SENSE_VALID signal */ - RTIMER_BUSYWAIT_UNTIL(((rssi0 = single_read(CC1200_RSSI0)) - & CC1200_CARRIER_SENSE_VALID), - RTIMER_SECOND / 100); - RF_ASSERT(rssi0 & CC1200_CARRIER_SENSE_VALID); - - if(rssi0 & CC1200_CARRIER_SENSE) { - /* Channel occupied */ - INFO("RF: CCA (0)\n"); - cca = 0; - } else { - /* Channel clear */ - INFO("RF: CCA (1)\n"); - cca = 1; - } - - } - - RELEASE_SPI(); - - if(was_off) { - off(); - } - - return cca; - -} -/*---------------------------------------------------------------------------*/ -/* - * Check if the radio driver is currently receiving a packet. - * - * CSMA uses this function - * - to detect a collision before transmit() - * - to detect an incoming ACK - */ -static int -receiving_packet(void) -{ - - int ret = 0; - - if((rf_flags & (RF_ON | RF_TX_ACTIVE)) == RF_ON) { - /* We are on and not in TX */ - if((cc1200_arch_gpio0_read_pin() == 1) || (rx_pkt_len != 0)) { - - /* - * SYNC word found or packet just received. Changing the criteria - * for this event might make it necessary to review the MAC timing - * parameters! Instead of (or in addition to) using GPIO0 we could also - * read out MODEM_STATUS1 (e.g. PQT reached), but this would not change - * the situation at least for CSMA as it uses two "blocking" timers - * (does not perform polling...). Therefore the overall timing - * of the ACK handling wouldn't change. It would just allow to detect an - * incoming packet a little bit earlier and help us with respect to - * collision avoidance (why not use channel_clear() - * at this point?). - */ - - ret = 1; - - } - } - - INFO("RF: Receiving (%d)\n", ret); - return ret; - -} -/*---------------------------------------------------------------------------*/ -/* Check if the radio driver has just received a packet. */ -static int -pending_packet(void) -{ - int ret; - ret = ((rx_pkt_len != 0) ? 1 : 0); - if(ret == 0 && !SPI_IS_LOCKED()) { - LOCK_SPI(); - ret = (single_read(CC1200_NUM_RXBYTES) > 0); - RELEASE_SPI(); - } - - INFO("RF: Pending (%d)\n", ret); - return ret; - -} -/*---------------------------------------------------------------------------*/ -/* Turn the radio on. */ -static int -on(void) -{ - - INFO("RF: On\n"); - - /* Don't turn on if we are on already */ - if(!(rf_flags & RF_ON)) { - - if(SPI_IS_LOCKED()) { - return 0; - } - - LOCK_SPI(); - - /* Wake-up procedure. Wait for GPIO0 to de-assert (CHIP_RDYn) */ - cc1200_arch_spi_select(); - RTIMER_BUSYWAIT_UNTIL((cc1200_arch_gpio0_read_pin() == 0), - RTIMER_SECOND / 100); - RF_ASSERT((cc1200_arch_gpio0_read_pin() == 0)); - cc1200_arch_spi_deselect(); - - rf_flags = RF_INITIALIZED; - rf_flags |= RF_ON; - - /* Radio is IDLE now, re-configure GPIO0 (modified inside off()) */ - single_write(CC1200_IOCFG0, GPIO0_IOCFG); - - /* Turn on RX */ - idle_calibrate_rx(); - - RELEASE_SPI(); - -#if CC1200_USE_RX_WATCHDOG - PROCESS_CONTEXT_BEGIN(&cc1200_process); - etimer_set(&et, CLOCK_SECOND); - PROCESS_CONTEXT_END(&cc1200_process); -#endif /* #if CC1200_USE_RX_WATCHDOG */ - - } else { - INFO("RF: Already on\n"); - } - - return 1; - -} -/*---------------------------------------------------------------------------*/ -/* Turn the radio off. */ -static int -off(void) -{ - - INFO("RF: Off\n"); - - /* Don't turn off if we are off already */ - if(rf_flags & RF_ON) { - - if(SPI_IS_LOCKED()) { - return 0; - } - - LOCK_SPI(); - - idle(); - - if(single_read(CC1200_NUM_RXBYTES) > 0) { - RELEASE_SPI(); - /* In case there is something in the Rx FIFO, read it */ - cc1200_rx_interrupt(); - if(SPI_IS_LOCKED()) { - return 0; - } - LOCK_SPI(); - } - - /* - * As we use GPIO as CHIP_RDYn signal on wake-up / on(), - * we re-configure it for CHIP_RDYn. - */ - single_write(CC1200_IOCFG0, CC1200_IOCFG_RXFIFO_CHIP_RDY_N); - - /* Say goodbye ... */ - strobe(CC1200_SPWD); - - /* Clear all but the initialized flag */ - rf_flags = RF_INITIALIZED; - - RELEASE_SPI(); - -#if CC1200_USE_RX_WATCHDOG - etimer_stop(&et); -#endif /* #if CC1200_USE_RX_WATCHDOG */ - - } else { - INFO("RF: Already off\n"); - } - - return 1; - -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Reads the current signal strength (RSSI) - * \return The current RSSI in dBm - * - * This function reads the current RSSI on the currently configured - * channel. - */ -static int16_t -get_rssi(void) -{ - int16_t rssi0, rssi1; - uint8_t was_off = 0; - - /* If we are off, turn on first */ - if(!(rf_flags & RF_ON)) { - was_off = 1; - on(); - } - - /* Wait for CARRIER_SENSE_VALID signal */ - RTIMER_BUSYWAIT_UNTIL(((rssi0 = single_read(CC1200_RSSI0)) - & CC1200_CARRIER_SENSE_VALID), - RTIMER_SECOND / 100); - RF_ASSERT(rssi0 & CC1200_CARRIER_SENSE_VALID); - rssi1 = (int8_t)single_read(CC1200_RSSI1) + (int)CC1200_RF_CFG.rssi_offset; - - /* If we were off, turn back off */ - if(was_off) { - off(); - } - - return rssi1; -} -/*---------------------------------------------------------------------------*/ -/* Get a radio parameter value. */ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - - if(!value) { - return RADIO_RESULT_INVALID_VALUE; - } - - switch(param) { - case RADIO_PARAM_POWER_MODE: - - if(rf_flags & RF_ON) { - *value = (radio_value_t)RADIO_POWER_MODE_ON; - } else { - *value = (radio_value_t)RADIO_POWER_MODE_OFF; - } - return RADIO_RESULT_OK; - - case RADIO_PARAM_CHANNEL: - - *value = (radio_value_t)rf_channel; - return RADIO_RESULT_OK; - - case RADIO_PARAM_PAN_ID: - case RADIO_PARAM_16BIT_ADDR: - - return RADIO_RESULT_NOT_SUPPORTED; - - case RADIO_PARAM_RX_MODE: - - *value = (radio_value_t)rx_mode_value; - return RADIO_RESULT_OK; - - case RADIO_PARAM_TX_MODE: - - *value = (radio_value_t)tx_mode_value; - return RADIO_RESULT_OK; - - case RADIO_PARAM_TXPOWER: - - *value = (radio_value_t)txpower; - return RADIO_RESULT_OK; - - case RADIO_PARAM_CCA_THRESHOLD: - - *value = (radio_value_t)cca_threshold; - return RADIO_RESULT_OK; - - case RADIO_PARAM_RSSI: - *value = get_rssi(); - return RADIO_RESULT_OK; - - case RADIO_PARAM_LAST_RSSI: - *value = (radio_value_t)rssi; - return RADIO_RESULT_OK; - - case RADIO_PARAM_64BIT_ADDR: - - return RADIO_RESULT_NOT_SUPPORTED; - - case RADIO_CONST_CHANNEL_MIN: - - *value = (radio_value_t)CC1200_RF_CFG.min_channel; - return RADIO_RESULT_OK; - - case RADIO_CONST_CHANNEL_MAX: - - *value = (radio_value_t)CC1200_RF_CFG.max_channel; - return RADIO_RESULT_OK; - - case RADIO_CONST_TXPOWER_MIN: - - *value = (radio_value_t)CC1200_CONST_TX_POWER_MIN; - return RADIO_RESULT_OK; - - case RADIO_CONST_TXPOWER_MAX: - - *value = (radio_value_t)CC1200_RF_CFG.max_txpower; - return RADIO_RESULT_OK; - - case RADIO_CONST_PHY_OVERHEAD: -#if CC1200_802154G -#if CC1200_802154G_CRC16 - *value = (radio_value_t)4; /* 2 bytes PHR, 2 bytes CRC */ -#else - *value = (radio_value_t)6; /* 2 bytes PHR, 4 bytes CRC */ -#endif -#else - *value = (radio_value_t)3; /* 1 len byte, 2 bytes CRC */ -#endif - return RADIO_RESULT_OK; - - case RADIO_CONST_BYTE_AIR_TIME: - *value = (radio_value_t)8*1000*1000 / CC1200_RF_CFG.bitrate; - return RADIO_RESULT_OK; - - case RADIO_CONST_DELAY_BEFORE_TX: - *value = (radio_value_t)CC1200_RF_CFG.delay_before_tx; - return RADIO_RESULT_OK; - - case RADIO_CONST_DELAY_BEFORE_RX: - *value = (radio_value_t)CC1200_RF_CFG.delay_before_rx; - return RADIO_RESULT_OK; - - case RADIO_CONST_DELAY_BEFORE_DETECT: - *value = (radio_value_t)CC1200_RF_CFG.delay_before_detect; - return RADIO_RESULT_OK; - - default: - - return RADIO_RESULT_NOT_SUPPORTED; - - } - -} -/*---------------------------------------------------------------------------*/ -/* Set a radio parameter value. */ -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - - switch(param) { - case RADIO_PARAM_POWER_MODE: - - if(value == RADIO_POWER_MODE_ON) { - on(); - return RADIO_RESULT_OK; - } - - if(value == RADIO_POWER_MODE_OFF) { - off(); - return RADIO_RESULT_OK; - } - - return RADIO_RESULT_INVALID_VALUE; - - case RADIO_PARAM_CHANNEL: - - if(set_channel(value) == CHANNEL_OUT_OF_LIMITS) { - return RADIO_RESULT_INVALID_VALUE; - } - - /* - * We always return OK here even if the channel update was - * postponed. rf_channel is NOT updated in this case until - * the channel update was performed. So reading back - * the channel using get_value() might return the "old" channel - * until the channel was actually changed - */ - - return RADIO_RESULT_OK; - - case RADIO_PARAM_PAN_ID: - case RADIO_PARAM_16BIT_ADDR: - - return RADIO_RESULT_NOT_SUPPORTED; - - case RADIO_PARAM_RX_MODE: - - rx_mode_value = value; - return RADIO_RESULT_OK; - - case RADIO_PARAM_TX_MODE: - - tx_mode_value = value; - return RADIO_RESULT_OK; - - case RADIO_PARAM_TXPOWER: - - if(value > (radio_value_t)CC1200_RF_CFG.max_txpower) { - value = (radio_value_t)CC1200_RF_CFG.max_txpower; - } - - if(value < (radio_value_t)CC1200_CONST_TX_POWER_MIN) { - value = (radio_value_t)CC1200_CONST_TX_POWER_MIN; - } - - /* We update the output power as soon as we transmit the next packet */ - new_txpower = (int8_t)value; - return RADIO_RESULT_OK; - - case RADIO_PARAM_CCA_THRESHOLD: - - if(value > (radio_value_t)CC1200_CONST_CCA_THRESHOLD_MAX) { - value = (radio_value_t)CC1200_CONST_CCA_THRESHOLD_MAX; - } - - if(value < (radio_value_t)CC1200_CONST_CCA_THRESHOLD_MIN) { - value = (radio_value_t)CC1200_CONST_CCA_THRESHOLD_MIN; - } - - /* When to update the threshold? Let's do it in channel_clear() ... */ - new_cca_threshold = (int8_t)value; - return RADIO_RESULT_OK; - - case RADIO_PARAM_RSSI: - case RADIO_PARAM_64BIT_ADDR: - - default: - - return RADIO_RESULT_NOT_SUPPORTED; - - } - -} -/*---------------------------------------------------------------------------*/ -/* Get a radio parameter object. */ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - if(param == RADIO_PARAM_LAST_PACKET_TIMESTAMP) { - if(size != sizeof(rtimer_clock_t) || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - *(rtimer_clock_t *)dest = sfd_timestamp; - return RADIO_RESULT_OK; - } - -#if MAC_CONF_WITH_TSCH - if(param == RADIO_CONST_TSCH_TIMING) { - if(size != sizeof(uint16_t *) || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - /* Assigned value: a pointer to the TSCH timing in usec */ - *(const uint16_t **)dest = CC1200_RF_CFG.tsch_timing; - return RADIO_RESULT_OK; - } -#endif /* MAC_CONF_WITH_TSCH */ - - return RADIO_RESULT_NOT_SUPPORTED; - -} -/*---------------------------------------------------------------------------*/ -/* Set a radio parameter object. */ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - - return RADIO_RESULT_NOT_SUPPORTED; - -} -/*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -/* - * CC1200 low level functions - */ -/*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ - -/* Send a command strobe. */ -static uint8_t -strobe(uint8_t strobe) -{ - - uint8_t ret; - - cc1200_arch_spi_select(); - ret = cc1200_arch_spi_rw_byte(strobe); - cc1200_arch_spi_deselect(); - - return ret; - -} -/*---------------------------------------------------------------------------*/ -/* Reset CC1200. */ -static void -reset(void) -{ - - cc1200_arch_spi_select(); - cc1200_arch_spi_rw_byte(CC1200_SRES); - /* - * Here we should wait for SO to go low again. - * As we don't have access to this pin we just wait for 100µs. - */ - clock_delay(100); - cc1200_arch_spi_deselect(); - -} -/*---------------------------------------------------------------------------*/ -/* Write a single byte to the specified address. */ -static uint8_t -single_write(uint16_t addr, uint8_t val) -{ - - uint8_t ret; - - cc1200_arch_spi_select(); - if(CC1200_IS_EXTENDED_ADDR(addr)) { - cc1200_arch_spi_rw_byte(CC1200_EXTENDED_WRITE_CMD); - cc1200_arch_spi_rw_byte((uint8_t)addr); - } else { - cc1200_arch_spi_rw_byte(addr | CC1200_WRITE_BIT); - } - ret = cc1200_arch_spi_rw_byte(val); - cc1200_arch_spi_deselect(); - - return ret; - -} -/*---------------------------------------------------------------------------*/ -/* Read a single byte from the specified address. */ -static uint8_t -single_read(uint16_t addr) -{ - - uint8_t ret; - - cc1200_arch_spi_select(); - if(CC1200_IS_EXTENDED_ADDR(addr)) { - cc1200_arch_spi_rw_byte(CC1200_EXTENDED_READ_CMD); - cc1200_arch_spi_rw_byte((uint8_t)addr); - } else { - cc1200_arch_spi_rw_byte(addr | CC1200_READ_BIT); - } - ret = cc1200_arch_spi_rw_byte(0); - cc1200_arch_spi_deselect(); - - return ret; - -} -/*---------------------------------------------------------------------------*/ -/* Write a burst of bytes starting at the specified address. */ -static void -burst_write(uint16_t addr, const uint8_t *data, uint8_t data_len) -{ - - cc1200_arch_spi_select(); - if(CC1200_IS_EXTENDED_ADDR(addr)) { - cc1200_arch_spi_rw_byte(CC1200_EXTENDED_BURST_WRITE_CMD); - cc1200_arch_spi_rw_byte((uint8_t)addr); - } else { - cc1200_arch_spi_rw_byte(addr | CC1200_WRITE_BIT | CC1200_BURST_BIT); - } - cc1200_arch_spi_rw(NULL, data, data_len); - cc1200_arch_spi_deselect(); - -} -/*---------------------------------------------------------------------------*/ -/* Read a burst of bytes starting at the specified address. */ -static void -burst_read(uint16_t addr, uint8_t *data, uint8_t data_len) -{ - - cc1200_arch_spi_select(); - if(CC1200_IS_EXTENDED_ADDR(addr)) { - cc1200_arch_spi_rw_byte(CC1200_EXTENDED_BURST_READ_CMD); - cc1200_arch_spi_rw_byte((uint8_t)addr); - } else { - cc1200_arch_spi_rw_byte(addr | CC1200_READ_BIT | CC1200_BURST_BIT); - } - cc1200_arch_spi_rw(data, NULL, data_len); - cc1200_arch_spi_deselect(); - -} -/*---------------------------------------------------------------------------*/ -/* Write a list of register settings. */ -static void -write_reg_settings(const registerSetting_t *reg_settings, - uint16_t sizeof_reg_settings) -{ - - int i = sizeof_reg_settings / sizeof(registerSetting_t); - - if(reg_settings != NULL) { - while(i--) { - single_write(reg_settings->addr, - reg_settings->val); - reg_settings++; - } - } - -} -/*---------------------------------------------------------------------------*/ -/* Configure the radio (write basic configuration). */ -static void -configure(void) -{ - - uint8_t reg; -#if CC1200_RF_TESTMODE - uint32_t freq; -#endif - - /* - * As we only write registers which are different from the chip's reset - * state, let's assure that the chip is in a clean state - */ - reset(); - - /* Write the configuration as exported from SmartRF Studio */ - write_reg_settings(CC1200_RF_CFG.register_settings, - CC1200_RF_CFG.size_of_register_settings); - - /* Write frequency offset */ -#if CC1200_FREQ_OFFSET - /* MSB */ - single_write(CC1200_FREQOFF1, (uint8_t)(CC1200_FREQ_OFFSET >> 8)); - /* LSB */ - single_write(CC1200_FREQOFF0, (uint8_t)(CC1200_FREQ_OFFSET)); -#endif - - /* RSSI offset */ - single_write(CC1200_AGC_GAIN_ADJUST, (int8_t)CC1200_RF_CFG.rssi_offset); - - /*************************************************************************** - * RF test modes needed during hardware development - **************************************************************************/ - -#if (CC1200_RF_TESTMODE == 1) || (CC1200_RF_TESTMODE == 2) - - strobe(CC1200_SFTX); - single_write(CC1200_TXFIRST, 0); - single_write(CC1200_TXLAST, 0xFF); - update_txpower(CC1200_CONST_TX_POWER_MAX); - single_write(CC1200_PKT_CFG2, 0x02); - freq = calculate_freq(CC1200_DEFAULT_CHANNEL - CC1200_RF_CFG.min_channel); - single_write(CC1200_FREQ0, ((uint8_t *)&freq)[0]); - single_write(CC1200_FREQ1, ((uint8_t *)&freq)[1]); - single_write(CC1200_FREQ2, ((uint8_t *)&freq)[2]); - - printf("RF: Freq0 0x%02x\n", ((uint8_t *)&freq)[0]); - printf("RF: Freq1 0x%02x\n", ((uint8_t *)&freq)[1]); - printf("RF: Freq2 0x%02x\n", ((uint8_t *)&freq)[2]); - -#if (CC1200_RF_TESTMODE == 1) - single_write(CC1200_SYNC_CFG1, 0xE8); - single_write(CC1200_PREAMBLE_CFG1, 0x00); - single_write(CC1200_MDMCFG1, 0x46); - single_write(CC1200_PKT_CFG0, 0x40); - single_write(CC1200_FS_DIG1, 0x07); - single_write(CC1200_FS_DIG0, 0xAA); - single_write(CC1200_FS_DVC1, 0xFF); - single_write(CC1200_FS_DVC0, 0x17); -#endif - -#if (CC1200_RF_TESTMODE == 2) - single_write(CC1200_SYNC_CFG1, 0xE8); - single_write(CC1200_PREAMBLE_CFG1, 0x00); - single_write(CC1200_MDMCFG1, 0x06); - single_write(CC1200_PA_CFG1, 0x3F); - single_write(CC1200_MDMCFG2, 0x03); - single_write(CC1200_FS_DIG1, 0x07); - single_write(CC1200_FS_DIG0, 0xAA); - single_write(CC1200_FS_DVC0, 0x17); - single_write(CC1200_SERIAL_STATUS, 0x08); -#endif - - strobe(CC1200_STX); - - while(1) { -#if (CC1200_RF_TESTMODE == 1) - watchdog_periodic(); - RTIMER_BUSYWAIT(RTIMER_SECOND / 10); - leds_off(LEDS_YELLOW); - leds_on(LEDS_RED); - watchdog_periodic(); - RTIMER_BUSYWAIT(RTIMER_SECOND / 10); - leds_off(LEDS_RED); - leds_on(LEDS_YELLOW); -#else - watchdog_periodic(); - RTIMER_BUSYWAIT(RTIMER_SECOND / 10); - leds_off(LEDS_GREEN); - leds_on(LEDS_RED); - watchdog_periodic(); - RTIMER_BUSYWAIT(RTIMER_SECOND / 10); - leds_off(LEDS_RED); - leds_on(LEDS_GREEN); -#endif - } - -#elif (CC1200_RF_TESTMODE == 3) - - /* CS on GPIO3 */ - single_write(CC1200_IOCFG3, CC1200_IOCFG_CARRIER_SENSE); - single_write(CC1200_IOCFG2, CC1200_IOCFG_SERIAL_CLK); - single_write(CC1200_IOCFG0, CC1200_IOCFG_SERIAL_RX); - update_cca_threshold(CC1200_RF_CFG.cca_threshold); - freq = calculate_freq(CC1200_DEFAULT_CHANNEL - CC1200_RF_CFG.min_channel); - single_write(CC1200_FREQ0, ((uint8_t *)&freq)[0]); - single_write(CC1200_FREQ1, ((uint8_t *)&freq)[1]); - single_write(CC1200_FREQ2, ((uint8_t *)&freq)[2]); - strobe(CC1200_SRX); - - while(1) { - - watchdog_periodic(); - RTIMER_BUSYWAIT(RTIMER_SECOND / 10); - leds_off(LEDS_GREEN); - leds_on(LEDS_YELLOW); - watchdog_periodic(); - RTIMER_BUSYWAIT(RTIMER_SECOND / 10); - leds_off(LEDS_YELLOW); - leds_on(LEDS_GREEN); - clock_delay_usec(1000); - - /* CS on GPIO3 */ - if(cc1200_arch_gpio3_read_pin() == 1) { - leds_on(LEDS_RED); - } else { - leds_off(LEDS_RED); - } - - } - -#endif /* #if CC1200_RF_TESTMODE == ... */ - - /*************************************************************************** - * Set the stuff we need for this driver to work. Don't touch! - **************************************************************************/ - - /* GPIOx configuration */ - single_write(CC1200_IOCFG3, GPIO3_IOCFG); - single_write(CC1200_IOCFG2, GPIO2_IOCFG); - single_write(CC1200_IOCFG0, GPIO0_IOCFG); - - reg = single_read(CC1200_SETTLING_CFG); - /* - * Turn of auto calibration. This gives us better control - * over the timing (RX/TX & TX /RX turnaround!). We calibrate manually: - * - Upon wake-up (on()) - * - Before going to TX (transmit()) - * - When setting an new channel (set_channel()) - */ - reg &= ~(3 << 3); -#if CC1200_AUTOCAL - /* We calibrate when going from idle to RX or TX */ - reg |= (1 << 3); -#endif - single_write(CC1200_SETTLING_CFG, reg); - - /* Configure RXOFF_MODE */ - reg = single_read(CC1200_RFEND_CFG1); - reg &= ~(3 << 4); /* RXOFF_MODE = IDLE */ -#if RXOFF_MODE_RX - reg |= (3 << 4); /* RXOFF_MODE = RX */ -#endif - reg |= 0x0F; /* Disable RX timeout */ - single_write(CC1200_RFEND_CFG1, reg); - - /* Configure TXOFF_MODE */ - reg = single_read(CC1200_RFEND_CFG0); - reg &= ~(3 << 4); /* TXOFF_MODE = IDLE */ -#if TXOFF_MODE_RX - reg |= (3 << 4); /* TXOFF_MODE = RX */ -#endif - single_write(CC1200_RFEND_CFG0, reg); - - /* - * CCA Mode 0: Always give clear channel indication. - * CCA is done "by hand". Keep in mind: automatic CCA would also - * affect the transmission of the ACK and is not implemented yet! - */ -#if CC1200_802154G - single_write(CC1200_PKT_CFG2, (1 << 5)); -#else - single_write(CC1200_PKT_CFG2, 0x00); -#endif - - /* Configure appendix */ - reg = single_read(CC1200_PKT_CFG1); -#if APPEND_STATUS - reg |= (1 << 0); -#else - reg &= ~(1 << 0); -#endif - single_write(CC1200_PKT_CFG1, reg); - - /* Variable packet length mode */ - reg = single_read(CC1200_PKT_CFG0); - reg &= ~(3 << 5); - reg |= (1 << 5); - single_write(CC1200_PKT_CFG0, reg); - -#ifdef FIFO_THRESHOLD - /* FIFO threshold */ - single_write(CC1200_FIFO_CFG, FIFO_THRESHOLD); -#endif - -} -/*---------------------------------------------------------------------------*/ -/* Return the radio's state. */ -static uint8_t -state(void) -{ - -#if STATE_USES_MARC_STATE - return single_read(CC1200_MARCSTATE) & 0x1f; -#else - return strobe(CC1200_SNOP) & 0x70; -#endif - -} -/*---------------------------------------------------------------------------*/ -#if !CC1200_AUTOCAL -/* Perform manual calibration. */ -static void -calibrate(void) -{ - -#ifdef RF_FORCE_CALIBRATION - if (!(rf_flags & RF_FORCE_CALIBRATION) - && ((clock_seconds() - cal_timer) < CC1200_CAL_TIMEOUT_SECONDS)) { - /* Timeout not reached, defer calibration... */ - return; - } - rf_flags &= ~RF_FORCE_CALIBRATION; -#endif - - INFO("RF: Calibrate\n"); - - strobe(CC1200_SCAL); - RTIMER_BUSYWAIT_UNTIL_STATE(STATE_CALIBRATE, RTIMER_SECOND / 100); - RTIMER_BUSYWAIT_UNTIL_STATE(STATE_IDLE, RTIMER_SECOND / 100); - -#if CC1200_CAL_TIMEOUT_SECONDS - cal_timer = clock_seconds(); -#endif - -} -#endif -/*---------------------------------------------------------------------------*/ -/* Enter IDLE state. */ -static void -idle(void) -{ - - uint8_t s; - - DISABLE_GPIO_INTERRUPTS(); - - TX_LEDS_OFF(); - RX_LEDS_OFF(); - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - - s = state(); - - if(s == STATE_IDLE) { - return; - } else if(s == STATE_RX_FIFO_ERR) { - WARNING("RF: RX FIFO error!\n"); - strobe(CC1200_SFRX); - } else if(s == STATE_TX_FIFO_ERR) { - WARNING("RF: TX FIFO error!\n"); - strobe(CC1200_SFTX); - } - - strobe(CC1200_SIDLE); - RTIMER_BUSYWAIT_UNTIL_STATE(STATE_IDLE, RTIMER_SECOND / 100); - -} /* idle(), 21.05.2015 */ -/*---------------------------------------------------------------------------*/ -/* Enter RX state. */ -static void -idle_calibrate_rx(void) -{ - - RF_ASSERT(state() == STATE_IDLE); - -#if !CC1200_AUTOCAL - calibrate(); -#endif - - rf_flags &= ~RF_RX_PROCESSING_PKT; - strobe(CC1200_SFRX); - strobe(CC1200_SRX); - RTIMER_BUSYWAIT_UNTIL_STATE(STATE_RX, RTIMER_SECOND / 100); - - ENABLE_GPIO_INTERRUPTS(); - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - -} -/*---------------------------------------------------------------------------*/ -/* Restart RX from within RX interrupt. */ -static void -rx_rx(void) -{ - - uint8_t s = state(); - - if(s == STATE_IDLE) { - /* Proceed to rx */ - } else if(s == STATE_RX_FIFO_ERR) { - WARNING("RF: RX FIFO error!\n"); - strobe(CC1200_SFRX); - } else if(s == STATE_TX_FIFO_ERR) { - WARNING("RF: TX FIFO error!\n"); - strobe(CC1200_SFTX); - } else { - strobe(CC1200_SIDLE); - RTIMER_BUSYWAIT_UNTIL_STATE(STATE_IDLE, - RTIMER_SECOND / 100); - } - - RX_LEDS_OFF(); - rf_flags &= ~RF_RX_PROCESSING_PKT; - - /* Clear pending GPIO interrupts */ - ENABLE_GPIO_INTERRUPTS(); - - strobe(CC1200_SFRX); - strobe(CC1200_SRX); - RTIMER_BUSYWAIT_UNTIL_STATE(STATE_RX, RTIMER_SECOND / 100); - -} -/*---------------------------------------------------------------------------*/ -/* Fill TX FIFO (if not already done), start TX and wait for TX to complete (blocking!). */ -static int -idle_tx_rx(const uint8_t *payload, uint16_t payload_len) -{ -#if (CC1200_MAX_PAYLOAD_LEN > (CC1200_FIFO_SIZE - PHR_LEN)) - uint8_t to_write; - const uint8_t *p; -#endif - - /* Prepare for RX */ - rf_flags &= ~RF_RX_PROCESSING_PKT; - strobe(CC1200_SFRX); - - /* Configure GPIO0 to detect TX state */ - single_write(CC1200_IOCFG0, CC1200_IOCFG_MARC_2PIN_STATUS_0); - -#if CC1200_WITH_TX_BUF - /* Prepare and write header */ - copy_header_to_tx_fifo(payload_len); - - /* - * Fill FIFO with data. If SPI is slow it might make sense - * to divide this process into several chunks. - * The best solution would be to perform TX FIFO refill - * using an interrupt, but we are blocking here (= in TX) anyway... - */ - -#if (CC1200_MAX_PAYLOAD_LEN > (CC1200_FIFO_SIZE - PHR_LEN)) - to_write = MIN(payload_len, (CC1200_FIFO_SIZE - PHR_LEN)); - burst_write(CC1200_TXFIFO, payload, to_write); - bytes_left_to_write = payload_len - to_write; - p = payload + to_write; -#else - burst_write(CC1200_TXFIFO, payload, payload_len); -#endif -#endif /* CC1200_WITH_TX_BUF */ - -#if USE_SFSTXON - /* Wait for synthesizer to be ready */ - RTIMER_BUSYWAIT_UNTIL_STATE(STATE_FSTXON, RTIMER_SECOND / 100); -#endif - - /* Start TX */ - strobe(CC1200_STX); - - /* Wait for TX to start. */ - RTIMER_BUSYWAIT_UNTIL((cc1200_arch_gpio0_read_pin() == 1), RTIMER_SECOND / 100); - - /* Turned off at the latest in idle() */ - TX_LEDS_ON(); - - /* Turned off at the latest in idle() */ - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - - if((cc1200_arch_gpio0_read_pin() == 0) && - (single_read(CC1200_NUM_TXBYTES) != 0)) { - - /* - * TX didn't start in time. We also check NUM_TXBYES - * in case we missed the rising edge of the GPIO signal - */ - - ERROR("RF: TX doesn't start!\n"); -#if (CC1200_MAX_PAYLOAD_LEN > (CC1200_FIFO_SIZE - PHR_LEN)) - single_write(CC1200_IOCFG2, GPIO2_IOCFG); -#endif - idle(); - - /* Re-configure GPIO0 */ - single_write(CC1200_IOCFG0, GPIO0_IOCFG); - - return RADIO_TX_ERR; - - } - -#if (CC1200_MAX_PAYLOAD_LEN > (CC1200_FIFO_SIZE - PHR_LEN)) && CC1200_WITH_TX_BUF - if(bytes_left_to_write != 0) { - rtimer_clock_t t0; - uint8_t s; - t0 = RTIMER_NOW(); - do { - if((bytes_left_to_write != 0) && - (cc1200_arch_gpio2_read_pin() == 0)) { - /* TX TIFO is drained below FIFO_THRESHOLD. Re-fill... */ - to_write = MIN(bytes_left_to_write, FIFO_THRESHOLD); - burst_write(CC1200_TXFIFO, p, to_write); - bytes_left_to_write -= to_write; - p += to_write; - t0 += CC1200_RF_CFG.tx_pkt_lifetime; - } - } while((cc1200_arch_gpio0_read_pin() == 1) && - RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + CC1200_RF_CFG.tx_pkt_lifetime)); - - /* - * At this point we either left TX or a timeout occurred. If all went - * well, we are in RX (or at least settling) now. - * If we didn't manage to refill the TX FIFO, an underflow might - * have occur-ed - the radio might be still in TX here! - */ - - s = state(); - if((s != STATE_RX) && (s != STATE_SETTLING)) { - - /* - * Something bad happened. Wait for radio to enter a - * stable state (in case of an error we are in TX here) - */ - - INFO("RF: TX failure!\n"); - RTIMER_BUSYWAIT_UNTIL((state() != STATE_TX), RTIMER_SECOND / 100); - /* Re-configure GPIO2 */ - single_write(CC1200_IOCFG2, GPIO2_IOCFG); - idle(); - - /* Re-configure GPIO0 */ - single_write(CC1200_IOCFG0, GPIO0_IOCFG); - - return RADIO_TX_ERR; - - } - - } else { - /* Wait for TX to complete */ - RTIMER_BUSYWAIT_UNTIL((cc1200_arch_gpio0_read_pin() == 0), - CC1200_RF_CFG.tx_pkt_lifetime); - } -#else - /* Wait for TX to complete */ - RTIMER_BUSYWAIT_UNTIL((cc1200_arch_gpio0_read_pin() == 0), - CC1200_RF_CFG.tx_pkt_lifetime); -#endif - - if(cc1200_arch_gpio0_read_pin() == 1) { - /* TX takes to long - abort */ - ERROR("RF: TX takes to long!\n"); -#if (CC1200_MAX_PAYLOAD_LEN > (CC1200_FIFO_SIZE - PHR_LEN)) - /* Re-configure GPIO2 */ - single_write(CC1200_IOCFG2, GPIO2_IOCFG); -#endif - idle(); - - /* Re-configure GPIO0 */ - single_write(CC1200_IOCFG0, GPIO0_IOCFG); - - return RADIO_TX_ERR; - - } - -#if (CC1200_MAX_PAYLOAD_LEN > (CC1200_FIFO_SIZE - PHR_LEN)) - /* Re-configure GPIO2 */ - single_write(CC1200_IOCFG2, GPIO2_IOCFG); -#endif - - /* Re-configure GPIO0 */ - single_write(CC1200_IOCFG0, GPIO0_IOCFG); - - TX_LEDS_OFF(); - - ENERGEST_SWITCH(ENERGEST_TYPE_TRANSMIT, ENERGEST_TYPE_LISTEN); - - return RADIO_TX_OK; - -} -/*---------------------------------------------------------------------------*/ -/* Update TX power */ -static void -update_txpower(int8_t txpower_dbm) -{ - - uint8_t reg = single_read(CC1200_PA_CFG1); - - reg &= ~0x3F; - /* Up to now we don't handle the special power levels PA_POWER_RAMP < 3 */ - reg |= ((((txpower_dbm + 18) * 2) - 1) & 0x3F); - single_write(CC1200_PA_CFG1, reg); - - txpower = txpower_dbm; - -} -/*---------------------------------------------------------------------------*/ -/* Update CCA threshold */ -static void -update_cca_threshold(int8_t threshold_dbm) -{ - - single_write(CC1200_AGC_CS_THR, (uint8_t)threshold_dbm); - cca_threshold = threshold_dbm; - -} -/*---------------------------------------------------------------------------*/ -/* Calculate FREQ register from channel */ -static uint32_t -calculate_freq(uint8_t channel) -{ - - uint32_t freq; - - freq = CC1200_RF_CFG.chan_center_freq0 + (channel * CC1200_RF_CFG.chan_spacing) / 1000 /* /1000 because chan_spacing is in Hz */; - freq *= FREQ_MULTIPLIER; - freq /= FREQ_DIVIDER; - - return freq; - -} -/*---------------------------------------------------------------------------*/ -/* Update rf channel if possible, else postpone it (->pollhandler) */ -static int -set_channel(uint8_t channel) -{ - - uint8_t was_off = 0; - uint32_t freq; - - channel %= (CC1200_RF_CFG.max_channel - CC1200_RF_CFG.min_channel + 1); - channel += CC1200_RF_CFG.min_channel; - -#if 0 - /* - * We explicitly allow a channel update even if the channel does not change. - * This feature can be used to manually force a calibration. - */ - if(channel == rf_channel) { - return rf_channel; - } -#endif - - if(channel < CC1200_RF_CFG.min_channel || - channel > CC1200_RF_CFG.max_channel) { - /* Invalid channel */ - return CHANNEL_OUT_OF_LIMITS; - } - - if(SPI_IS_LOCKED() || (rf_flags & RF_TX_ACTIVE) || receiving_packet()) { - - /* We are busy, postpone channel update */ - - new_rf_channel = channel; - rf_flags |= RF_UPDATE_CHANNEL; - process_poll(&cc1200_process); - INFO("RF: Channel update postponed\n"); - - return CHANNEL_UPDATE_POSTPONED; - - } - rf_flags &= ~RF_UPDATE_CHANNEL; - - INFO("RF: Channel update (%d)\n", channel); - - if(!(rf_flags & RF_ON)) { - was_off = 1; - on(); - } - - LOCK_SPI(); - - idle(); - - freq = calculate_freq(channel - CC1200_RF_CFG.min_channel); - single_write(CC1200_FREQ0, ((uint8_t *)&freq)[0]); - single_write(CC1200_FREQ1, ((uint8_t *)&freq)[1]); - single_write(CC1200_FREQ2, ((uint8_t *)&freq)[2]); - - rf_channel = channel; - - /* Turn on RX again unless we turn off anyway */ - if(!was_off) { -#ifdef RF_FORCE_CALIBRATION - rf_flags |= RF_FORCE_CALIBRATION; -#endif - idle_calibrate_rx(); - } - - RELEASE_SPI(); - - if(was_off) { - off(); - } - - return CHANNEL_UPDATE_SUCCEEDED; - -} -/*---------------------------------------------------------------------------*/ -/* Check broadcast address. */ -static int -is_broadcast_addr(uint8_t mode, uint8_t *addr) -{ - - int i = mode == FRAME802154_SHORTADDRMODE ? 2 : 8; - - while(i-- > 0) { - if(addr[i] != 0xff) { - return 0; - } - } - - return 1; - -} -/*---------------------------------------------------------------------------*/ -static int -addr_check_auto_ack(uint8_t *frame, uint16_t frame_len) -{ - - frame802154_t info154; - - if(frame802154_parse(frame, frame_len, &info154) != 0) { - - /* We received a valid 802.15.4 frame */ - - if(!(rx_mode_value & RADIO_RX_MODE_ADDRESS_FILTER) || - info154.fcf.frame_type == FRAME802154_ACKFRAME || - is_broadcast_addr(info154.fcf.dest_addr_mode, - (uint8_t *)&info154.dest_addr) || - linkaddr_cmp((linkaddr_t *)&info154.dest_addr, - &linkaddr_node_addr)) { - - /* - * Address check succeeded or address filter disabled. - * We send an ACK in case a corresponding data frame - * is received even in promiscuous mode (if auto-ack is - * enabled)! - */ - - if((rx_mode_value & RADIO_RX_MODE_AUTOACK) && - info154.fcf.frame_type == FRAME802154_DATAFRAME && - info154.fcf.ack_required != 0 && - (!(rx_mode_value & RADIO_RX_MODE_ADDRESS_FILTER) || - linkaddr_cmp((linkaddr_t *)&info154.dest_addr, - &linkaddr_node_addr))) { - - /* - * Data frame destined for us & ACK request bit set -> send ACK. - * Make sure the preamble length is configured accordingly as - * MAC timing parameters rely on this! - */ - - uint8_t ack[ACK_LEN] = { FRAME802154_ACKFRAME, 0, info154.seq }; - -#if (RXOFF_MODE_RX == 1) - /* - * This turns off GPIOx interrupts. Make sure they are turned on - * in rx_rx() later on! - */ - idle(); -#endif - - prepare((const uint8_t *)ack, ACK_LEN); - idle_tx_rx((const uint8_t *)ack, ACK_LEN); - - /* rx_rx() will follow */ - - return ADDR_CHECK_OK_ACK_SEND; - - } - - return ADDR_CHECK_OK; - - } else { - - return ADDR_CHECK_FAILED; - - } - - } - - return INVALID_FRAME; - -} -/*---------------------------------------------------------------------------*/ -/* - * The CC1200 interrupt handler: called by the hardware interrupt - * handler, which is defined as part of the cc1200-arch interface. - */ -int -cc1200_rx_interrupt(void) -{ - - /* The radio's state */ - uint8_t s; - /* The number of bytes in the RX FIFO waiting for read-out */ - uint8_t num_rxbytes; - /* The payload length read as the first byte from the RX FIFO */ - static uint16_t payload_len; - /* - * The number of bytes already read out and placed in the - * intermediate buffer - */ - static uint16_t bytes_read; - /* - * We use an intermediate buffer for the packet before - * we pass it to the next upper layer. We also place RSSI + - * LQI in this buffer - */ - static uint8_t buf[CC1200_MAX_PAYLOAD_LEN + APPENDIX_LEN]; - - /* - * If CC1200_USE_GPIO2 is enabled, we come here either once RX FIFO - * threshold is reached (GPIO2 rising edge) - * or at the end of the packet (GPIO0 falling edge). - */ -#if CC1200_USE_GPIO2 - int gpio2 = cc1200_arch_gpio2_read_pin(); - int gpio0 = cc1200_arch_gpio0_read_pin(); - if((rf_flags & RF_RX_ONGOING) == 0 && gpio2 > 0) { - rf_flags |= RF_RX_ONGOING; - sfd_timestamp = RTIMER_NOW(); - } - if(gpio0 == 0) { - rf_flags &= ~RF_RX_ONGOING; - } -#endif - - if(SPI_IS_LOCKED()) { - - /* - * SPI is in use. Exit and make sure this - * function is called from the poll handler as soon - * as SPI is available again - */ - - rf_flags |= RF_POLL_RX_INTERRUPT; - process_poll(&cc1200_process); - return 1; - - } - rf_flags &= ~RF_POLL_RX_INTERRUPT; - - LOCK_SPI(); - - /* - * If CC1200_USE_GPIO2 is enabled, we come here either once RX FIFO - * threshold is reached (GPIO2 rising edge) - * or at the end of the packet (GPIO0 falling edge). - */ - - /* Make sure we are in a sane state. Sane means: either RX or IDLE */ - s = state(); - if((s == STATE_RX_FIFO_ERR) || (s == STATE_TX_FIFO_ERR)) { - - rx_rx(); - RELEASE_SPI(); - return 0; - - } - - num_rxbytes = single_read(CC1200_NUM_RXBYTES); - - if(num_rxbytes == 0) { - - /* - * This might happen from time to time because - * this function is also called by the pollhandler and / or - * from TWO interrupts which can occur at the same time. - */ - - INFO("RF: RX FIFO empty!\n"); - RELEASE_SPI(); - return 0; - - } - - if(!(rf_flags & RF_RX_PROCESSING_PKT)) { - -#if CC1200_802154G - struct { - uint8_t phra; - uint8_t phrb; - } - phr; - - if(num_rxbytes < PHR_LEN) { - - WARNING("RF: PHR incomplete!\n"); - rx_rx(); - RELEASE_SPI(); - return 0; - - } - - burst_read(CC1200_RXFIFO, - &phr, - PHR_LEN); - payload_len = (phr.phra & 0x07); - payload_len <<= 8; - payload_len += phr.phrb; - - if(phr.phra & (1 << 4)) { - /* CRC16, payload_len += 2 */ - payload_len -= 2; - } else { - /* CRC16, payload_len += 4 */ - payload_len -= 4; - } -#else - /* Read first byte in RX FIFO (payload length) */ - burst_read(CC1200_RXFIFO, - (uint8_t *)&payload_len, - PHR_LEN); -#endif - - if(payload_len < ACK_LEN) { - /* Packet to short. Discard it */ - WARNING("RF: Packet too short!\n"); - rx_rx(); - RELEASE_SPI(); - return 0; - } - - if(payload_len > CC1200_MAX_PAYLOAD_LEN) { - /* Packet to long. Discard it */ - WARNING("RF: Packet to long!\n"); - rx_rx(); - RELEASE_SPI(); - return 0; - } - - RX_LEDS_ON(); - bytes_read = 0; - num_rxbytes -= PHR_LEN; - - rf_flags |= RF_RX_PROCESSING_PKT; - - /* Fall through... */ - - } - - if(rf_flags & RF_RX_PROCESSING_PKT) { - - /* - * Read out remaining bytes unless FIFO is empty. - * We have at least num_rxbytes in the FIFO to be read out. - */ - - if((num_rxbytes + bytes_read) > (payload_len + CC_APPENDIX_LEN)) { - - /* - * We have a mismatch between the number of bytes in the RX FIFO - * and the payload_len. This would lead to an buffer overflow, - * so we catch this error here. - */ - - WARNING("RF: RX length mismatch %d %d %d!\n", num_rxbytes, - bytes_read, - payload_len); - rx_rx(); - RELEASE_SPI(); - return 0; - - } - - burst_read(CC1200_RXFIFO, - &buf[bytes_read], - num_rxbytes); - - bytes_read += num_rxbytes; - num_rxbytes = 0; - - if(bytes_read == (payload_len + CC_APPENDIX_LEN)) { - - /* - * End of packet. Read appendix (if available), check CRC - * and copy the data from temporary buffer to rx_pkt - * RSSI offset already set using AGC_GAIN_ADJUST.GAIN_ADJUSTMENT - */ - -#if APPEND_STATUS - uint8_t crc_lqi = buf[bytes_read - 1]; -#else - int8_t rssi = single_read(CC1200_RSSI1); - uint8_t crc_lqi = single_read(CC1200_LQI_VAL); -#endif - - if(!(crc_lqi & (1 << 7))) { - /* CRC error. Drop the packet */ - INFO("RF: CRC error!\n"); - } else if(rx_pkt_len != 0) { - /* An old packet is pending. Drop the packet */ - WARNING("RF: Packet pending!\n"); - } else { - - int ret = addr_check_auto_ack(buf, bytes_read); - - if((ret == ADDR_CHECK_OK) || - (ret == ADDR_CHECK_OK_ACK_SEND)) { -#if APPEND_STATUS - /* RSSI + LQI already read out and placed into buf */ -#else - buf[bytes_read++] = (uint8_t)rssi; - buf[bytes_read++] = crc_lqi; -#endif - rx_pkt_len = bytes_read; - memcpy((void *)rx_pkt, buf, rx_pkt_len); - rx_rx(); - process_poll(&cc1200_process); - RELEASE_SPI(); - return 1; - - } else { - /* Invalid address. Drop the packet */ - } - - } - - /* Buffer full, address or CRC check failed */ - rx_rx(); - RELEASE_SPI(); - return 0; - - } /* if (bytes_read == payload_len) */ - - } - - RELEASE_SPI(); - return 0; - -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/dev/cc2420/cc2420-tsch-15ms.c b/arch/dev/cc2420/cc2420-tsch-15ms.c deleted file mode 100644 index cccc63b34..000000000 --- a/arch/dev/cc2420/cc2420-tsch-15ms.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * IEEE 802.15.4 TSCH timeslot timings for 15ms slots - * \author - * Simon Duquennoy - * - */ - -#include "contiki.h" -#include "net/mac/tsch/tsch.h" - -/** - * \brief 15ms TSCH timeslot timings, required for cc2420 platforms as - * they are unable to keep up with the defulat 10ms timeslots. - */ -const tsch_timeslot_timing_usec tsch_timeslot_timing_us_15000= { - 1800, /* CCAOffset */ - 128, /* CCA */ - 4000, /* TxOffset */ - (4000 - (TSCH_CONF_RX_WAIT / 2)), /* RxOffset */ - 3600, /* RxAckDelay */ - 4000, /* TxAckDelay */ - TSCH_CONF_RX_WAIT, /* RxWait */ - 800, /* AckWait */ - 2072, /* RxTx */ - 2400, /* MaxAck */ - 4256, /* MaxTx */ - 15000, /* TimeslotLength */ -}; diff --git a/arch/dev/cc2420/cc2420-tsch-15ms.h b/arch/dev/cc2420/cc2420-tsch-15ms.h deleted file mode 100644 index 7c0b47073..000000000 --- a/arch/dev/cc2420/cc2420-tsch-15ms.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" - -extern const uint16_t tsch_timeslot_timing_us_15000[]; diff --git a/arch/dev/cc2420/cc2420.c b/arch/dev/cc2420/cc2420.c deleted file mode 100644 index 545f917ac..000000000 --- a/arch/dev/cc2420/cc2420.c +++ /dev/null @@ -1,1176 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/* - * This code is almost device independent and should be easy to port. - */ - -#include - -#include "contiki.h" -#include "sys/energest.h" - -#include "dev/leds.h" -#include "dev/spi-legacy.h" -#include "cc2420.h" -#include "cc2420_const.h" - -#include "net/packetbuf.h" -#include "net/netstack.h" - -enum write_ram_order { - /* Begin with writing the first given byte */ - WRITE_RAM_IN_ORDER, - /* Begin with writing the last given byte */ - WRITE_RAM_REVERSE -}; - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) do {} while (0) -#endif - -#define DEBUG_LEDS DEBUG -#undef LEDS_ON -#undef LEDS_OFF -#if DEBUG_LEDS -#define LEDS_ON(x) leds_on(x) -#define LEDS_OFF(x) leds_off(x) -#else -#define LEDS_ON(x) -#define LEDS_OFF(x) -#endif - -/* Conversion map between PA_LEVEL and output power in dBm - (from table 9 in CC2420 specification). -*/ -struct output_config { - int8_t power; - uint8_t config; -}; - -static const struct output_config output_power[] = { - { 0, 31 }, /* 0xff */ - { -1, 27 }, /* 0xfb */ - { -3, 23 }, /* 0xf7 */ - { -5, 19 }, /* 0xf3 */ - { -7, 15 }, /* 0xef */ - {-10, 11 }, /* 0xeb */ - {-15, 7 }, /* 0xe7 */ - {-25, 3 }, /* 0xe3 */ -}; -#define OUTPUT_NUM (sizeof(output_power) / sizeof(struct output_config)) -#define OUTPUT_POWER_MAX 0 -#define OUTPUT_POWER_MIN -25 - -void cc2420_arch_init(void); - -int cc2420_authority_level_of_sender; - -volatile uint8_t cc2420_sfd_counter; -volatile uint16_t cc2420_sfd_start_time; -volatile uint16_t cc2420_sfd_end_time; - -static volatile uint16_t last_packet_timestamp; -/*---------------------------------------------------------------------------*/ -PROCESS(cc2420_process, "CC2420 driver"); -/*---------------------------------------------------------------------------*/ - -#define AUTOACK (1 << 4) -#define AUTOCRC (1 << 5) -#define ADR_DECODE (1 << 11) -#define RXFIFO_PROTECTION (1 << 9) -#define CORR_THR(n) (((n) & 0x1f) << 6) -#define FIFOP_THR(n) ((n) & 0x7f) -#define RXBPF_LOCUR (1 << 13); -#define TX_MODE (3 << 2) - -int cc2420_on(void); -int cc2420_off(void); - -static int cc2420_read(void *buf, unsigned short bufsize); - -static int cc2420_prepare(const void *data, unsigned short len); -static int cc2420_transmit(unsigned short len); -static int cc2420_send(const void *data, unsigned short len); - -static int cc2420_receiving_packet(void); -static int pending_packet(void); -static int get_cca_threshold(void); -static int cc2420_cca(void); -static uint16_t getreg(enum cc2420_register regname); - -static void set_frame_filtering(uint8_t enable); -static void set_poll_mode(uint8_t enable); -static void set_send_on_cca(uint8_t enable); -static void set_auto_ack(uint8_t enable); - -static void set_test_mode(uint8_t enable, uint8_t modulated); - -signed char cc2420_last_rssi; -uint8_t cc2420_last_correlation; - -static uint8_t receive_on; -static int channel; - -/* Are we currently in poll mode? */ -static uint8_t volatile poll_mode = 0; -/* Do we perform a CCA before sending? */ -static uint8_t send_on_cca = WITH_SEND_CCA; - -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - int i, v; - - if(!value) { - return RADIO_RESULT_INVALID_VALUE; - } - switch(param) { - case RADIO_PARAM_POWER_MODE: - if((getreg(CC2420_MDMCTRL1) & TX_MODE) & 0x08) { - *value = RADIO_POWER_MODE_CARRIER_ON; - } else { - *value = receive_on ? RADIO_POWER_MODE_ON : RADIO_POWER_MODE_OFF; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_CHANNEL: - *value = cc2420_get_channel(); - return RADIO_RESULT_OK; - case RADIO_PARAM_RX_MODE: - *value = 0; - if(getreg(CC2420_MDMCTRL0) & ADR_DECODE) { - *value |= RADIO_RX_MODE_ADDRESS_FILTER; - } - if(getreg(CC2420_MDMCTRL0) & AUTOACK) { - *value |= RADIO_RX_MODE_AUTOACK; - } - if(poll_mode) { - *value |= RADIO_RX_MODE_POLL_MODE; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_TX_MODE: - *value = 0; - if(send_on_cca) { - *value |= RADIO_TX_MODE_SEND_ON_CCA; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_TXPOWER: - v = cc2420_get_txpower(); - *value = OUTPUT_POWER_MIN; - /* Find the actual estimated output power in conversion table */ - for(i = 0; i < OUTPUT_NUM; i++) { - if(v >= output_power[i].config) { - *value = output_power[i].power; - break; - } - } - return RADIO_RESULT_OK; - case RADIO_PARAM_CCA_THRESHOLD: - *value = get_cca_threshold() + RSSI_OFFSET; - return RADIO_RESULT_OK; - case RADIO_PARAM_RSSI: - /* Return the RSSI value in dBm */ - *value = cc2420_rssi(); - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_RSSI: - /* RSSI of the last packet received */ - *value = cc2420_last_rssi; - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_LINK_QUALITY: - /* LQI of the last packet received */ - *value = cc2420_last_correlation; - return RADIO_RESULT_OK; - case RADIO_CONST_CHANNEL_MIN: - *value = 11; - return RADIO_RESULT_OK; - case RADIO_CONST_CHANNEL_MAX: - *value = 26; - return RADIO_RESULT_OK; - case RADIO_CONST_TXPOWER_MIN: - *value = OUTPUT_POWER_MIN; - return RADIO_RESULT_OK; - case RADIO_CONST_TXPOWER_MAX: - *value = OUTPUT_POWER_MAX; - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} - -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - int i; - - switch(param) { - case RADIO_PARAM_POWER_MODE: - if(value == RADIO_POWER_MODE_ON) { - cc2420_on(); - return RADIO_RESULT_OK; - } - if(value == RADIO_POWER_MODE_OFF) { - cc2420_off(); - return RADIO_RESULT_OK; - } - if(value == RADIO_POWER_MODE_CARRIER_ON || - value == RADIO_POWER_MODE_CARRIER_OFF) { - set_test_mode((value == RADIO_POWER_MODE_CARRIER_ON), 0); - return RADIO_RESULT_OK; - } - return RADIO_RESULT_INVALID_VALUE; - case RADIO_PARAM_CHANNEL: - if(value < 11 || value > 26) { - return RADIO_RESULT_INVALID_VALUE; - } - cc2420_set_channel(value); - return RADIO_RESULT_OK; - case RADIO_PARAM_RX_MODE: - if(value & ~(RADIO_RX_MODE_ADDRESS_FILTER | - RADIO_RX_MODE_AUTOACK | RADIO_RX_MODE_POLL_MODE)) { - return RADIO_RESULT_INVALID_VALUE; - } - set_frame_filtering((value & RADIO_RX_MODE_ADDRESS_FILTER) != 0); - set_auto_ack((value & RADIO_RX_MODE_AUTOACK) != 0); - set_poll_mode((value & RADIO_RX_MODE_POLL_MODE) != 0); - return RADIO_RESULT_OK; - case RADIO_PARAM_TX_MODE: - if(value & ~(RADIO_TX_MODE_SEND_ON_CCA)) { - return RADIO_RESULT_INVALID_VALUE; - } - set_send_on_cca((value & RADIO_TX_MODE_SEND_ON_CCA) != 0); - return RADIO_RESULT_OK; - case RADIO_PARAM_TXPOWER: - if(value < OUTPUT_POWER_MIN || value > OUTPUT_POWER_MAX) { - return RADIO_RESULT_INVALID_VALUE; - } - /* Find the closest higher PA_LEVEL for the desired output power */ - for(i = 1; i < OUTPUT_NUM; i++) { - if(value > output_power[i].power) { - break; - } - } - cc2420_set_txpower(output_power[i - 1].config); - return RADIO_RESULT_OK; - case RADIO_PARAM_CCA_THRESHOLD: - cc2420_set_cca_threshold(value - RSSI_OFFSET); - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} - -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - if(param == RADIO_PARAM_LAST_PACKET_TIMESTAMP) { -#if CC2420_CONF_SFD_TIMESTAMPS - if(size != sizeof(rtimer_clock_t) || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - *(rtimer_clock_t*)dest = cc2420_sfd_start_time; - return RADIO_RESULT_OK; -#else - return RADIO_RESULT_NOT_SUPPORTED; -#endif - } - return RADIO_RESULT_NOT_SUPPORTED; -} - -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - return RADIO_RESULT_NOT_SUPPORTED; -} - -const struct radio_driver cc2420_driver = - { - cc2420_init, - cc2420_prepare, - cc2420_transmit, - cc2420_send, - cc2420_read, - cc2420_cca, - cc2420_receiving_packet, - pending_packet, - cc2420_on, - cc2420_off, - get_value, - set_value, - get_object, - set_object - }; - -/*---------------------------------------------------------------------------*/ -/* Sends a strobe */ -static void -strobe(enum cc2420_register regname) -{ - CC2420_SPI_ENABLE(); - SPI_WRITE(regname); - CC2420_SPI_DISABLE(); -} -/*---------------------------------------------------------------------------*/ -/* Reads a register */ -static uint16_t -getreg(enum cc2420_register regname) -{ - uint16_t value; - - CC2420_SPI_ENABLE(); - SPI_WRITE(regname | 0x40); - value = (uint8_t)SPI_RXBUF; - SPI_TXBUF = 0; - SPI_WAITFOREORx(); - value = SPI_RXBUF << 8; - SPI_TXBUF = 0; - SPI_WAITFOREORx(); - value |= SPI_RXBUF; - CC2420_SPI_DISABLE(); - - return value; -} -/*---------------------------------------------------------------------------*/ -/** - * Writes to a register. - * Note: the SPI_WRITE(0) seems to be needed for getting the - * write reg working on the Z1 / MSP430X platform - */ -static void -setreg(enum cc2420_register regname, uint16_t value) -{ - CC2420_SPI_ENABLE(); - SPI_WRITE_FAST(regname); - SPI_WRITE_FAST((uint8_t) (value >> 8)); - SPI_WRITE_FAST((uint8_t) (value & 0xff)); - SPI_WAITFORTx_ENDED(); - SPI_WRITE(0); - CC2420_SPI_DISABLE(); -} -/*---------------------------------------------------------------------------*/ -static void -read_ram(uint8_t *buffer, uint16_t adr, uint16_t count) -{ - uint8_t i; - - CC2420_SPI_ENABLE(); - SPI_WRITE(0x80 | ((adr) & 0x7f)); - SPI_WRITE((((adr) >> 1) & 0xc0) | 0x20); - SPI_RXBUF; - for(i = 0; i < count; i++) { - SPI_READ(((uint8_t*) buffer)[i]); - } - CC2420_SPI_DISABLE(); -} -/*---------------------------------------------------------------------------*/ -/* Write to RAM in the CC2420 */ -static void -write_ram(const uint8_t *buffer, - uint16_t adr, - uint16_t count, - enum write_ram_order order) -{ - uint8_t i; - - CC2420_SPI_ENABLE(); - SPI_WRITE_FAST(0x80 | (adr & 0x7f)); - SPI_WRITE_FAST((adr >> 1) & 0xc0); - if(order == WRITE_RAM_IN_ORDER) { - for(i = 0; i < count; i++) { - SPI_WRITE_FAST((buffer)[i]); - } - } else { - for(i = count; i > 0; i--) { - SPI_WRITE_FAST((buffer)[i - 1]); - } - } - SPI_WAITFORTx_ENDED(); - CC2420_SPI_DISABLE(); -} -/*---------------------------------------------------------------------------*/ -static void -write_fifo_buf(const uint8_t *buffer, uint16_t count) -{ - uint8_t i; - - CC2420_SPI_ENABLE(); - SPI_WRITE_FAST(CC2420_TXFIFO); - for(i = 0; i < count; i++) { - SPI_WRITE_FAST((buffer)[i]); - } - SPI_WAITFORTx_ENDED(); - CC2420_SPI_DISABLE(); -} -/*---------------------------------------------------------------------------*/ -/* Returns the current status */ -static uint8_t -get_status(void) -{ - uint8_t status; - - CC2420_SPI_ENABLE(); - SPI_WRITE(CC2420_SNOP); - status = SPI_RXBUF; - CC2420_SPI_DISABLE(); - - return status; -} -/*---------------------------------------------------------------------------*/ -static void -getrxdata(uint8_t *buffer, int count) -{ - uint8_t i; - - CC2420_SPI_ENABLE(); - SPI_WRITE(CC2420_RXFIFO | 0x40); - (void) SPI_RXBUF; - for(i = 0; i < count; i++) { - SPI_READ(buffer[i]); - } - clock_delay(1); - CC2420_SPI_DISABLE(); -} -/*---------------------------------------------------------------------------*/ -static void -flushrx(void) -{ - uint8_t dummy; - - getrxdata(&dummy, 1); - strobe(CC2420_SFLUSHRX); - strobe(CC2420_SFLUSHRX); - if(dummy) { - /* avoid unused variable compiler warning */ - } -} -/*---------------------------------------------------------------------------*/ -static void -wait_for_status(uint8_t status_bit) -{ - rtimer_clock_t t0; - t0 = RTIMER_NOW(); - while(!(get_status() & status_bit) - && RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (RTIMER_SECOND / 10))); -} -/*---------------------------------------------------------------------------*/ -static void -wait_for_transmission(void) -{ - rtimer_clock_t t0; - t0 = RTIMER_NOW(); - while((get_status() & BV(CC2420_TX_ACTIVE)) - && RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (RTIMER_SECOND / 10))); -} -/*---------------------------------------------------------------------------*/ -static void -on(void) -{ - if(!poll_mode) { - CC2420_ENABLE_FIFOP_INT(); - } - - strobe(CC2420_SRXON); - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - receive_on = 1; -} -/*---------------------------------------------------------------------------*/ -static void -off(void) -{ - /* PRINTF("off\n");*/ - receive_on = 0; - - /* Wait for transmission to end before turning radio off. */ - wait_for_transmission(); - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - strobe(CC2420_SRFOFF); - if(!poll_mode) { - CC2420_DISABLE_FIFOP_INT(); - } - - if(!CC2420_FIFOP_IS_1) { - flushrx(); - } -} -/*---------------------------------------------------------------------------*/ -static uint8_t locked, lock_on, lock_off; -#define GET_LOCK() locked++ -static void RELEASE_LOCK(void) { - if(locked == 1) { - if(lock_on) { - on(); - lock_on = 0; - } - if(lock_off) { - off(); - lock_off = 0; - } - } - locked--; -} -/*---------------------------------------------------------------------------*/ -static void -init_security(void) -{ - /* only use key 0 */ - setreg(CC2420_SECCTRL0, 0); - setreg(CC2420_SECCTRL1, 0); -} -/*---------------------------------------------------------------------------*/ -static void -set_key(const uint8_t *key) -{ - GET_LOCK(); - - write_ram(key, CC2420RAM_KEY0, 16, WRITE_RAM_REVERSE); - - RELEASE_LOCK(); -} -/*---------------------------------------------------------------------------*/ -static void -encrypt(uint8_t *plaintext_and_result) -{ - GET_LOCK(); - - write_ram(plaintext_and_result, - CC2420RAM_SABUF, - 16, - WRITE_RAM_IN_ORDER); - - strobe(CC2420_SAES); - while(get_status() & BV(CC2420_ENC_BUSY)); - - read_ram(plaintext_and_result, CC2420RAM_SABUF, 16); - - RELEASE_LOCK(); -} -/*---------------------------------------------------------------------------*/ -const struct aes_128_driver cc2420_aes_128_driver = { - set_key, - encrypt -}; -/*---------------------------------------------------------------------------*/ -static void -set_txpower(uint8_t power) -{ - uint16_t reg; - - reg = getreg(CC2420_TXCTRL); - reg = (reg & 0xffe0) | (power & 0x1f); - setreg(CC2420_TXCTRL, reg); -} -/*---------------------------------------------------------------------------*/ -int -cc2420_init(void) -{ - uint16_t reg; - { - int s = splhigh(); - cc2420_arch_init(); /* Initalize ports and SPI. */ - CC2420_DISABLE_FIFOP_INT(); - CC2420_FIFOP_INT_INIT(); - splx(s); - } - - /* Turn on voltage regulator and reset. */ - SET_VREG_ACTIVE(); - clock_delay(250); - SET_RESET_ACTIVE(); - clock_delay(127); - SET_RESET_INACTIVE(); - clock_delay(125); - - - /* Turn on the crystal oscillator. */ - strobe(CC2420_SXOSCON); - /* And wait until it stabilizes */ - wait_for_status(BV(CC2420_XOSC16M_STABLE)); - - /* Set auto-ack and frame filtering */ - set_auto_ack(CC2420_CONF_AUTOACK); - set_frame_filtering(CC2420_CONF_AUTOACK); - - /* Enabling CRC in hardware; this is required by AUTOACK anyway - and provides us with RSSI and link quality indication (LQI) - information. */ - reg = getreg(CC2420_MDMCTRL0); - reg |= AUTOCRC; - setreg(CC2420_MDMCTRL0, reg); - - /* Set transmission turnaround time to the lower setting (8 symbols - = 0.128 ms) instead of the default (12 symbols = 0.192 ms). */ - /* reg = getreg(CC2420_TXCTRL); - reg &= ~(1 << 13); - setreg(CC2420_TXCTRL, reg);*/ - - - /* Change default values as recomended in the data sheet, */ - /* correlation threshold = 20, RX bandpass filter = 1.3uA. */ - setreg(CC2420_MDMCTRL1, CORR_THR(20)); - reg = getreg(CC2420_RXCTRL1); - reg |= RXBPF_LOCUR; - setreg(CC2420_RXCTRL1, reg); - - /* Set the FIFOP threshold to maximum. */ - setreg(CC2420_IOCFG0, FIFOP_THR(127)); - - init_security(); - - cc2420_set_pan_addr(0xffff, 0x0000, NULL); - cc2420_set_channel(IEEE802154_DEFAULT_CHANNEL); - cc2420_set_cca_threshold(CC2420_CONF_CCA_THRESH); - - flushrx(); - - set_poll_mode(0); - - process_start(&cc2420_process, NULL); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -cc2420_transmit(unsigned short payload_len) -{ - int i; - - GET_LOCK(); - - /* The TX FIFO can only hold one packet. Make sure to not overrun - * FIFO by waiting for transmission to start here and synchronizing - * with the CC2420_TX_ACTIVE check in cc2420_send. - * - * Note that we may have to wait up to 320 us (20 symbols) before - * transmission starts. - */ -#ifndef CC2420_CONF_SYMBOL_LOOP_COUNT -#error CC2420_CONF_SYMBOL_LOOP_COUNT needs to be set!!! -#else -#define LOOP_20_SYMBOLS CC2420_CONF_SYMBOL_LOOP_COUNT -#endif - - if(send_on_cca) { - strobe(CC2420_SRXON); - wait_for_status(BV(CC2420_RSSI_VALID)); - strobe(CC2420_STXONCCA); - } else { - strobe(CC2420_STXON); - } - for(i = LOOP_20_SYMBOLS; i > 0; i--) { - if(CC2420_SFD_IS_1) { - if(!(get_status() & BV(CC2420_TX_ACTIVE))) { - /* SFD went high but we are not transmitting. This means that - we just started receiving a packet, so we drop the - transmission. */ - RELEASE_LOCK(); - return RADIO_TX_COLLISION; - } - if(receive_on) { - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - } - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - /* We wait until transmission has ended so that we get an - accurate measurement of the transmission time.*/ - wait_for_transmission(); - - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - if(receive_on) { - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - } else { - /* We need to explicitly turn off the radio, - * since STXON[CCA] -> TX_ACTIVE -> RX_ACTIVE */ - off(); - } - - RELEASE_LOCK(); - return RADIO_TX_OK; - } - } - - /* If we send with cca (cca_on_send), we get here if the packet wasn't - transmitted because of other channel activity. */ - PRINTF("cc2420: do_send() transmission never started\n"); - - RELEASE_LOCK(); - return RADIO_TX_COLLISION; -} -/*---------------------------------------------------------------------------*/ -static int -cc2420_prepare(const void *payload, unsigned short payload_len) -{ - uint8_t total_len; - - GET_LOCK(); - - PRINTF("cc2420: sending %d bytes\n", payload_len); - - /* Wait for any previous transmission to finish. */ - /* while(status() & BV(CC2420_TX_ACTIVE));*/ - - /* Write packet to TX FIFO. */ - strobe(CC2420_SFLUSHTX); - - total_len = payload_len + CHECKSUM_LEN; - write_fifo_buf(&total_len, 1); - write_fifo_buf(payload, payload_len); - - RELEASE_LOCK(); - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -cc2420_send(const void *payload, unsigned short payload_len) -{ - cc2420_prepare(payload, payload_len); - return cc2420_transmit(payload_len); -} -/*---------------------------------------------------------------------------*/ -int -cc2420_off(void) -{ - /* Don't do anything if we are already turned off. */ - if(receive_on == 0) { - return 1; - } - - /* If we are called when the driver is locked, we indicate that the - radio should be turned off when the lock is unlocked. */ - if(locked) { - /* printf("Off when locked (%d)\n", locked);*/ - lock_off = 1; - return 1; - } - - GET_LOCK(); - /* If we are currently receiving a packet (indicated by SFD == 1), - we don't actually switch the radio off now, but signal that the - driver should switch off the radio once the packet has been - received and processed, by setting the 'lock_off' variable. */ - if(get_status() & BV(CC2420_TX_ACTIVE)) { - lock_off = 1; - } else { - off(); - } - RELEASE_LOCK(); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -cc2420_on(void) -{ - if(receive_on) { - return 1; - } - if(locked) { - lock_on = 1; - return 1; - } - - GET_LOCK(); - on(); - RELEASE_LOCK(); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -cc2420_get_channel(void) -{ - return channel; -} -/*---------------------------------------------------------------------------*/ -int -cc2420_set_channel(int c) -{ - uint16_t f; - - GET_LOCK(); - /* - * Subtract the base channel (11), multiply by 5, which is the - * channel spacing. 357 is 2405-2048 and 0x4000 is LOCK_THR = 1. - */ - channel = c; - - f = 5 * (c - 11) + 357 + 0x4000; - - /* Wait for any transmission to end. */ - wait_for_transmission(); - - setreg(CC2420_FSCTRL, f); - - /* If we are in receive mode, we issue an SRXON command to ensure - that the VCO is calibrated. */ - if(receive_on) { - strobe(CC2420_SRXON); - } - - RELEASE_LOCK(); - return 1; -} -/*---------------------------------------------------------------------------*/ -void -cc2420_set_pan_addr(unsigned pan, - unsigned addr, - const uint8_t *ieee_addr) -{ - GET_LOCK(); - - write_ram((uint8_t *) &pan, CC2420RAM_PANID, 2, WRITE_RAM_IN_ORDER); - write_ram((uint8_t *) &addr, CC2420RAM_SHORTADDR, 2, WRITE_RAM_IN_ORDER); - - if(ieee_addr != NULL) { - write_ram(ieee_addr, CC2420RAM_IEEEADDR, 8, WRITE_RAM_REVERSE); - } - RELEASE_LOCK(); -} -/*---------------------------------------------------------------------------*/ -/* - * Interrupt leaves frame intact in FIFO. - */ -int -cc2420_interrupt(void) -{ - CC2420_CLEAR_FIFOP_INT(); - process_poll(&cc2420_process); - - last_packet_timestamp = cc2420_sfd_start_time; - return 1; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cc2420_process, ev, data) -{ - int len; - PROCESS_BEGIN(); - - PRINTF("cc2420_process: started\n"); - - while(1) { - PROCESS_YIELD_UNTIL(!poll_mode && ev == PROCESS_EVENT_POLL); - - PRINTF("cc2420_process: calling receiver callback\n"); - - packetbuf_clear(); - packetbuf_set_attr(PACKETBUF_ATTR_TIMESTAMP, last_packet_timestamp); - len = cc2420_read(packetbuf_dataptr(), PACKETBUF_SIZE); - - packetbuf_set_datalen(len); - - NETSTACK_MAC.input(); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static int -cc2420_read(void *buf, unsigned short bufsize) -{ - uint8_t footer[FOOTER_LEN]; - uint8_t len; - - if(!CC2420_FIFOP_IS_1) { - return 0; - } - - GET_LOCK(); - - getrxdata(&len, 1); - - if(len > CC2420_MAX_PACKET_LEN) { - /* Oops, we must be out of sync. */ - } else if(len <= FOOTER_LEN) { - /* Packet too short */ - } else if(len - FOOTER_LEN > bufsize) { - /* Packet too long */ - } else { - getrxdata((uint8_t *) buf, len - FOOTER_LEN); - getrxdata(footer, FOOTER_LEN); - - if(footer[1] & FOOTER1_CRC_OK) { - cc2420_last_rssi = footer[0] + RSSI_OFFSET; - cc2420_last_correlation = footer[1] & FOOTER1_CORRELATION; - if(!poll_mode) { - /* Not in poll mode: packetbuf should not be accessed in interrupt context. - * In poll mode, the last packet RSSI and link quality can be obtained through - * RADIO_PARAM_LAST_RSSI and RADIO_PARAM_LAST_LINK_QUALITY */ - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, cc2420_last_rssi); - packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, cc2420_last_correlation); - } - } else { - len = FOOTER_LEN; - } - - if(!poll_mode) { - if(CC2420_FIFOP_IS_1) { - if(!CC2420_FIFO_IS_1) { - /* Clean up in case of FIFO overflow! This happens for every - * full length frame and is signaled by FIFOP = 1 and FIFO = - * 0. */ - flushrx(); - } else { - /* Another packet has been received and needs attention. */ - process_poll(&cc2420_process); - } - } - } - - RELEASE_LOCK(); - return len - FOOTER_LEN; - } - - flushrx(); - RELEASE_LOCK(); - return 0; -} -/*---------------------------------------------------------------------------*/ -void -cc2420_set_txpower(uint8_t power) -{ - GET_LOCK(); - set_txpower(power); - RELEASE_LOCK(); -} -/*---------------------------------------------------------------------------*/ -int -cc2420_get_txpower(void) -{ - int power; - GET_LOCK(); - power = (int)(getreg(CC2420_TXCTRL) & 0x001f); - RELEASE_LOCK(); - return power; -} -/*---------------------------------------------------------------------------*/ -int -cc2420_rssi(void) -{ - int rssi; - int radio_was_off = 0; - - if(locked) { - return 0; - } - - GET_LOCK(); - - if(!receive_on) { - radio_was_off = 1; - cc2420_on(); - } - wait_for_status(BV(CC2420_RSSI_VALID)); - - rssi = (int)((signed char) getreg(CC2420_RSSI)); - rssi += RSSI_OFFSET; - - if(radio_was_off) { - cc2420_off(); - } - RELEASE_LOCK(); - return rssi; -} -/*---------------------------------------------------------------------------*/ -static int -cc2420_cca(void) -{ - int cca; - int radio_was_off = 0; - - /* If the radio is locked by an underlying thread (because we are - being invoked through an interrupt), we preted that the coast is - clear (i.e., no packet is currently being transmitted by a - neighbor). */ - if(locked) { - return 1; - } - - GET_LOCK(); - if(!receive_on) { - radio_was_off = 1; - cc2420_on(); - } - - /* Make sure that the radio really got turned on. */ - if(!receive_on) { - RELEASE_LOCK(); - if(radio_was_off) { - cc2420_off(); - } - return 1; - } - - wait_for_status(BV(CC2420_RSSI_VALID)); - - cca = CC2420_CCA_IS_1; - - if(radio_was_off) { - cc2420_off(); - } - RELEASE_LOCK(); - return cca; -} -/*---------------------------------------------------------------------------*/ -int -cc2420_receiving_packet(void) -{ - return CC2420_SFD_IS_1; -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - return CC2420_FIFOP_IS_1; -} -/*---------------------------------------------------------------------------*/ -static int -get_cca_threshold(void) -{ - int value; - - GET_LOCK(); - value = (int8_t)(getreg(CC2420_RSSI) >> 8); - RELEASE_LOCK(); - return value; -} -/*---------------------------------------------------------------------------*/ -void -cc2420_set_cca_threshold(int value) -{ - uint16_t shifted = value << 8; - GET_LOCK(); - setreg(CC2420_RSSI, shifted); - RELEASE_LOCK(); -} -/*---------------------------------------------------------------------------*/ -/* Set or unset frame autoack */ -static void -set_auto_ack(uint8_t enable) -{ - GET_LOCK(); - - uint16_t reg = getreg(CC2420_MDMCTRL0); - if(enable) { - reg |= AUTOACK; - } else { - reg &= ~(AUTOACK); - } - - setreg(CC2420_MDMCTRL0, reg); - RELEASE_LOCK(); -} -/*---------------------------------------------------------------------------*/ -/* Set or unset frame filtering */ -static void -set_frame_filtering(uint8_t enable) -{ - GET_LOCK(); - - /* Turn on/off address decoding. */ - uint16_t reg = getreg(CC2420_MDMCTRL0); - if(enable) { - reg |= ADR_DECODE; - } else { - reg &= ~(ADR_DECODE); - } - - setreg(CC2420_MDMCTRL0, reg); - RELEASE_LOCK(); -} -/*---------------------------------------------------------------------------*/ -/* Enable or disable radio interrupts (both FIFOP and SFD timer capture) */ -static void -set_poll_mode(uint8_t enable) -{ - GET_LOCK(); - poll_mode = enable; - if(enable) { - /* Disable FIFOP interrupt */ - CC2420_CLEAR_FIFOP_INT(); - CC2420_DISABLE_FIFOP_INT(); - } else { - /* Initialize and enable FIFOP interrupt */ - CC2420_FIFOP_INT_INIT(); - CC2420_ENABLE_FIFOP_INT(); - CC2420_CLEAR_FIFOP_INT(); - } - RELEASE_LOCK(); -} -/*---------------------------------------------------------------------------*/ -/* Enable or disable CCA before sending */ -static void -set_send_on_cca(uint8_t enable) -{ - send_on_cca = enable; -} -/*---------------------------------------------------------------------------*/ -/* Enable or disable radio test mode emmiting modulated or unmodulated - * (carrier) signal. See datasheet page 55. - */ -static uint16_t prev_MDMCTRL1, prev_DACTST; -static uint8_t was_on; - -static void -set_test_mode(uint8_t enable, uint8_t modulated) -{ - radio_value_t mode; - get_value(RADIO_PARAM_POWER_MODE, &mode); - - if(enable) { - if(mode == RADIO_POWER_MODE_CARRIER_ON) { - return; - } - was_on = (mode == RADIO_POWER_MODE_ON); - off(); - prev_MDMCTRL1 = getreg(CC2420_MDMCTRL1); - setreg(CC2420_MDMCTRL1, 0x050C); - if(!modulated) { - prev_DACTST = getreg(CC2420_DACTST); - setreg(CC2420_DACTST, 0x1800); - } - /* actually starts the test mode */ - strobe(CC2420_STXON); - } else { - if(mode != RADIO_POWER_MODE_CARRIER_ON) { - return; - } - strobe(CC2420_SRFOFF); - if(!modulated) { - setreg(CC2420_DACTST, prev_DACTST); - } - setreg(CC2420_MDMCTRL1, prev_MDMCTRL1); - /* actually stops the carrier */ - if(was_on) { - on(); - } - } -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/dev/cc2420/cc2420.h b/arch/dev/cc2420/cc2420.h deleted file mode 100644 index 33135e21c..000000000 --- a/arch/dev/cc2420/cc2420.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * CC2420 driver header file - * \author - * Adam Dunkels - * Joakim Eriksson - * Konrad Krentz - */ - -#ifndef CC2420_H_ -#define CC2420_H_ - -#include "contiki.h" -#include "dev/spi-legacy.h" -#include "dev/radio.h" -#include "cc2420_const.h" -#include "lib/aes-128.h" - -#define WITH_SEND_CCA 1 - -#ifndef CC2420_CONF_CCA_THRESH -#define CC2420_CONF_CCA_THRESH -45 -#endif /* CC2420_CONF_CCA_THRESH */ - -#ifndef CC2420_CONF_AUTOACK -#define CC2420_CONF_AUTOACK 1 -#endif /* CC2420_CONF_AUTOACK */ - -#define CHECKSUM_LEN 2 -#define FOOTER_LEN 2 -#define FOOTER1_CRC_OK 0x80 -#define FOOTER1_CORRELATION 0x7f - -#ifdef CC2420_CONF_RSSI_OFFSET -#define RSSI_OFFSET CC2420_CONF_RSSI_OFFSET -#else /* CC2420_CONF_RSSI_OFFSET */ -/* The RSSI_OFFSET is approximate -45 (see CC2420 specification) */ -#define RSSI_OFFSET -45 -#endif /* CC2420_CONF_RSSI_OFFSET */ - -int cc2420_init(void); - -#define CC2420_MAX_PACKET_LEN 127 - -int cc2420_set_channel(int channel); -int cc2420_get_channel(void); - -void cc2420_set_pan_addr(unsigned pan, - unsigned addr, - const uint8_t *ieee_addr); - -extern signed char cc2420_last_rssi; -extern uint8_t cc2420_last_correlation; - -int cc2420_rssi(void); - -extern const struct radio_driver cc2420_driver; - -/** - * \param power Between 1 and 31. - */ -void cc2420_set_txpower(uint8_t power); -int cc2420_get_txpower(void); -#define CC2420_TXPOWER_MAX 31 -#define CC2420_TXPOWER_MIN 0 - -/** - * Interrupt function, called from the simple-cc2420-arch driver. - * - */ -int cc2420_interrupt(void); - -extern int cc2420_authority_level_of_sender; - -int cc2420_on(void); -int cc2420_off(void); - -void cc2420_set_cca_threshold(int value); - -extern const struct aes_128_driver cc2420_aes_128_driver; - -#endif /* CC2420_H_ */ diff --git a/arch/dev/cc2420/cc2420_const.h b/arch/dev/cc2420/cc2420_const.h deleted file mode 100644 index cc52e7bb8..000000000 --- a/arch/dev/cc2420/cc2420_const.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 CC2420_CONST_H -#define CC2420_CONST_H - -/* - * All constants are from the Chipcon CC2420 Data Sheet that at one - * point in time could be found at - * http://www.chipcon.com/files/CC2420_Data_Sheet_1_4.pdf - * - * The page numbers below refer to pages in this document. - */ - -/* Page 27. */ -enum cc2420_status_byte { - CC2420_XOSC16M_STABLE = 6, - CC2420_TX_UNDERFLOW = 5, - CC2420_ENC_BUSY = 4, - CC2420_TX_ACTIVE = 3, - CC2420_LOCK = 2, - CC2420_RSSI_VALID = 1, -}; - -/* Page 27. */ -enum cc2420_memory_size { - CC2420_RAM_SIZE = 368, - CC2420_FIFO_SIZE = 128, -}; - -/* Page 29. */ -enum cc2420_address { - CC2420RAM_TXFIFO = 0x000, - CC2420RAM_RXFIFO = 0x080, - CC2420RAM_KEY0 = 0x100, - CC2420RAM_RXNONCE = 0x110, - CC2420RAM_SABUF = 0x120, - CC2420RAM_KEY1 = 0x130, - CC2420RAM_TXNONCE = 0x140, - CC2420RAM_CBCSTATE = 0x150, - CC2420RAM_IEEEADDR = 0x160, - CC2420RAM_PANID = 0x168, - CC2420RAM_SHORTADDR = 0x16A, -}; - -/* Page 60. */ -enum cc2420_register { - CC2420_SNOP = 0x00, - CC2420_SXOSCON = 0x01, - CC2420_STXCAL = 0x02, - CC2420_SRXON = 0x03, - CC2420_STXON = 0x04, - CC2420_STXONCCA = 0x05, - CC2420_SRFOFF = 0x06, - CC2420_SXOSCOFF = 0x07, - CC2420_SFLUSHRX = 0x08, - CC2420_SFLUSHTX = 0x09, - CC2420_SACK = 0x0A, - CC2420_SACKPEND = 0x0B, - CC2420_SRXDEC = 0x0C, - CC2420_STXENC = 0x0D, - CC2420_SAES = 0x0E, - CC2420_foo = 0x0F, - CC2420_MAIN = 0x10, - CC2420_MDMCTRL0 = 0x11, - CC2420_MDMCTRL1 = 0x12, - CC2420_RSSI = 0x13, - CC2420_SYNCWORD = 0x14, - CC2420_TXCTRL = 0x15, - CC2420_RXCTRL0 = 0x16, - CC2420_RXCTRL1 = 0x17, - CC2420_FSCTRL = 0x18, - CC2420_SECCTRL0 = 0x19, - CC2420_SECCTRL1 = 0x1A, - CC2420_BATTMON = 0x1B, - CC2420_IOCFG0 = 0x1C, - CC2420_IOCFG1 = 0x1D, - CC2420_MANFIDL = 0x1E, - CC2420_MANFIDH = 0x1F, - CC2420_FSMTC = 0x20, - CC2420_MANAND = 0x21, - CC2420_MANOR = 0x22, - CC2420_AGCCTRL = 0x23, - CC2420_AGCTST0 = 0x24, - CC2420_AGCTST1 = 0x25, - CC2420_AGCTST2 = 0x26, - CC2420_FSTST0 = 0x27, - CC2420_FSTST1 = 0x28, - CC2420_FSTST2 = 0x29, - CC2420_FSTST3 = 0x2A, - CC2420_RXBPFTST = 0x2B, - CC2420_FSMSTATE = 0x2C, - CC2420_ADCTST = 0x2D, - CC2420_DACTST = 0x2E, - CC2420_TOPTST = 0x2F, - CC2420_RESERVED = 0x30, - /* 0x31 - 0x3D not used */ - CC2420_TXFIFO = 0x3E, - CC2420_RXFIFO = 0x3F, -}; - -/* Page 69. */ -enum cc2420_secctrl0 { - CC2420_SECCTRL0_NO_SECURITY = 0x0000, - CC2420_SECCTRL0_CBC_MAC = 0x0001, - CC2420_SECCTRL0_CTR = 0x0002, - CC2420_SECCTRL0_CCM = 0x0003, - - CC2420_SECCTRL0_SEC_M_IDX = 2, - - CC2420_SECCTRL0_RXKEYSEL0 = 0x0000, - CC2420_SECCTRL0_RXKEYSEL1 = 0x0020, - - CC2420_SECCTRL0_TXKEYSEL0 = 0x0000, - CC2420_SECCTRL0_TXKEYSEL1 = 0x0040, - - CC2420_SECCTRL0_SAKEYSEL0 = 0x0000, - CC2420_SECCTRL0_SAKEYSEL1 = 0x0080, - - CC2420_SECCTRL0_SEC_CBC_HEAD = 0x0100, - CC2420_SECCTRL0_RXFIFO_PROTECTION = 0x0200, -}; - -#endif /* CC2420_CONST_H */ diff --git a/arch/dev/disk/disk.h b/arch/dev/disk/disk.h deleted file mode 100644 index cef12361a..000000000 --- a/arch/dev/disk/disk.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup dev - * @{ - * - * \defgroup disk Disk device drivers - * - * Documentation for all the disk device drivers. - * @{ - * - * \file - * Header file defining the disk device driver API. - */ -#ifndef DISK_H_ -#define DISK_H_ - -#include - -/** Disk status flags. */ -typedef enum { - DISK_STATUS_INIT = 0x01, /**< Device initialized and ready to work */ - DISK_STATUS_DISK = 0x02, /**< Medium present in the drive */ - DISK_STATUS_WRITABLE = 0x04 /**< Writable medium */ -} disk_status_t; - -/** Generic disk I/O control commands. */ -typedef enum { - DISK_IOCTL_CTRL_SYNC, /**< Synchronize the cached writes to persistent storage */ - DISK_IOCTL_GET_SECTOR_COUNT, /**< Get the sector count through the \c uint32_t pointed to by \c buff */ - DISK_IOCTL_GET_SECTOR_SIZE, /**< Get the sector size through the \c uint16_t pointed to by \c buff */ - DISK_IOCTL_GET_BLOCK_SIZE, /**< Get the erase block size (in sectors) through the \c uint32_t pointed to by \c buff */ - DISK_IOCTL_CTRL_TRIM /**< Trim the sector range within the \c uint32_t boundaries pointed to by \c buff */ -} disk_ioctl_t; - -/** Disk access result codes. */ -typedef enum { - DISK_RESULT_OK, /**< Success */ - DISK_RESULT_IO_ERROR, /**< Unrecoverable I/O error */ - DISK_RESULT_WR_PROTECTED, /**< Write-protected medium */ - DISK_RESULT_NO_INIT, /**< Device not initialized */ - DISK_RESULT_INVALID_ARG /**< Invalid argument */ -} disk_result_t; - -/** Disk driver API structure. */ -struct disk_driver { - /** Get device status. */ - disk_status_t (*status)(uint8_t dev); - - /** Initialize device. */ - disk_status_t (*initialize)(uint8_t dev); - - /** Read sector(s). */ - disk_result_t (*read)(uint8_t dev, void *buff, uint32_t sector, - uint32_t count); - - /** Write sector(s). */ - disk_result_t (*write)(uint8_t dev, const void *buff, uint32_t sector, - uint32_t count); - - /** Control device-specific features. */ - disk_result_t (*ioctl)(uint8_t dev, uint8_t cmd, void *buff); -}; - -#endif /* DISK_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/dev/disk/mmc/mmc-arch.h b/arch/dev/disk/mmc/mmc-arch.h deleted file mode 100644 index 69009d99e..000000000 --- a/arch/dev/disk/mmc/mmc-arch.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup mmc - * @{ - * - * \defgroup mmc-arch SD/MMC architecture-specific definitions - * - * SD/MMC device driver architecture-specific definitions. - * @{ - * - * \file - * Header file for the SD/MMC device driver architecture-specific definitions. - */ -#ifndef MMC_ARCH_H_ -#define MMC_ARCH_H_ - -#include -#include -#include - -/** \brief Callback of the SD/MMC driver to call when the card-detection signal - * changes. - * \param dev Device - * \param cd Whether a card is detected - * \note Using this function is not mandatory. This only allows to detect a card - * replacement between two successive calls to the SD/MMC driver API. - */ -void mmc_arch_cd_changed_callback(uint8_t dev, bool cd); - -/** \brief Gets the state of the card-detection signal. - * \param dev Device - * \return Whether a card is detected - */ -bool mmc_arch_get_cd(uint8_t dev); - -/** \brief Gets the state of the write-protection signal. - * \param dev Device - * \return Whether the card is write-protected - */ -bool mmc_arch_get_wp(uint8_t dev); - -/** \brief Sets the SPI /CS signal as indicated. - * \param dev Device - * \param sel Whether to assert /CS - */ -void mmc_arch_spi_select(uint8_t dev, bool sel); - -/** \brief Sets the SPI clock frequency. - * \param dev Device - * \param freq Frequency (Hz) - */ -void mmc_arch_spi_set_clock_freq(uint8_t dev, uint32_t freq); - -/** \brief Performs an SPI transfer. - * \param dev Device - * \param tx_buf Pointer to the transmission buffer, or \c NULL - * \param tx_cnt Number of bytes to transmit, or \c 0 - * \param rx_buf Pointer to the reception buffer, or \c NULL - * \param rx_cnt Number of bytes to receive, or \c 0 - */ -void mmc_arch_spi_xfer(uint8_t dev, const void *tx_buf, size_t tx_cnt, - void *rx_buf, size_t rx_cnt); - -#endif /* MMC_ARCH_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/dev/disk/mmc/mmc.c b/arch/dev/disk/mmc/mmc.c deleted file mode 100644 index 11582de17..000000000 --- a/arch/dev/disk/mmc/mmc.c +++ /dev/null @@ -1,608 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * All rights reserved. - * - * Based on the FatFs Module STM32 Sample Project, - * Copyright (c) 2014, ChaN - * 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. - */ -/** - * \addtogroup mmc - * @{ - * - * \file - * Implementation of the SD/MMC device driver. - */ -#include -#include -#include "contiki.h" -#include "sys/clock.h" -#include "sys/rtimer.h" -#include "dev/watchdog.h" -#include "mmc-arch.h" -#include "mmc.h" - -/* Data read/write block length */ -#define BLOCK_LEN 512 -/* - * Logical sector size exposed to the disk API, not to be confused with the SDSC - * sector size, which is the size of an erasable sector - */ -#define SECTOR_SIZE BLOCK_LEN - -/* Clock frequency in card identification mode: fOD <= 400 kHz */ -#define CLOCK_FREQ_CARD_ID_MODE 400000 -/* - * Clock frequency in data transfer mode: fPP <= 20 MHz, limited by the - * backward-compatible MMC interface timings - */ -#define CLOCK_FREQ_DATA_XFER_MODE 20000000 - -/* SPI-mode command list */ -#define CMD0 0 /* GO_IDLE_STATE */ -#define CMD1 1 /* SEND_OP_COND */ -#define CMD8 8 /* SEND_IF_COND */ -#define CMD8_VHS_2_7_3_6 0x1 -#define CMD8_ARG(vhs, check_pattern) ((vhs) << 8 | (check_pattern)) -#define CMD8_ECHO_MASK 0x00000fff -#define CMD9 9 /* SEND_CSD */ -#define CMD10 10 /* SEND_CID */ -#define CMD12 12 /* STOP_TRANSMISSION */ -#define CMD13 13 /* SEND_STATUS */ -#define CMD16 16 /* SET_BLOCKLEN */ -#define CMD17 17 /* READ_SINGLE_BLOCK */ -#define CMD18 18 /* READ_MULTIPLE_BLOCK */ -#define CMD23 23 /* SET_BLOCK_COUNT */ -#define CMD24 24 /* WRITE_BLOCK */ -#define CMD25 25 /* WRITE_MULTIPLE_BLOCK */ -#define CMD32 32 /* ERASE_WR_BLK_START */ -#define CMD33 33 /* ERASE_WR_BLK_END */ -#define CMD38 38 /* ERASE */ -#define CMD55 55 /* APP_CMD */ -#define CMD58 58 /* READ_OCR */ -#define ACMD 0x80 /* Application-specific command */ -#define ACMD13 (ACMD | 13) /* SD_STATUS */ -#define ACMD23 (ACMD | 23) /* SET_WR_BLK_ERASE_COUNT */ -#define ACMD41 (ACMD | 41) /* SD_APP_OP_COND */ -#define ACMD41_HCS (1 << 30) - -#define CMD_TX 0x40 /* Command transmission bit */ - -#define R1_MSB 0x00 -#define R1_SUCCESS 0x00 -#define R1_IDLE_STATE (1 << 0) -#define R1_ERASE_RESET (1 << 1) -#define R1_ILLEGAL_COMMAND (1 << 2) -#define R1_COM_CRC_ERROR (1 << 3) -#define R1_ERASE_SEQUENCE_ERROR (1 << 4) -#define R1_ADDRESS_ERROR (1 << 5) -#define R1_PARAMETER_ERROR (1 << 6) - -#define TOK_DATA_RESP_MASK 0x1f -#define TOK_DATA_RESP_ACCEPTED 0x05 -#define TOK_DATA_RESP_CRC_ERROR 0x0b -#define TOK_DATA_RESP_WR_ERROR 0x0d -#define TOK_RD_SINGLE_WR_START_BLOCK 0xfe -#define TOK_MULTI_WR_START_BLOCK 0xfc -#define TOK_MULTI_WR_STOP_TRAN 0xfd - -/* The SD Status is one data block of 512 bits. */ -#define SD_STATUS_SIZE (512 / 8) -#define SD_STATUS_AU_SIZE(sd_status) ((sd_status)[10] >> 4) - -#define OCR_CCS (1 << 30) - -#define CSD_SIZE 16 -#define CSD_STRUCTURE(csd) ((csd)[0] >> 6) -#define CSD_STRUCTURE_SD_V1_0 0 -#define CSD_STRUCTURE_SD_V2_0 1 -#define CSD_SD_V1_0_READ_BL_LEN(csd) ((csd)[5] & 0x0f) -#define CSD_SD_V1_0_BLOCK_LEN(csd) (1ull << CSD_SD_V1_0_READ_BL_LEN(csd)) -#define CSD_SD_V1_0_C_SIZE(csd) \ - (((csd)[6] & 0x03) << 10 | (csd)[7] << 2 | (csd)[8] >> 6) -#define CSD_SD_V1_0_C_SIZE_MULT(csd) \ - (((csd)[9] & 0x03) << 1 | (csd)[10] >> 7) -#define CSD_SD_V1_0_MULT(csd) \ - (1 << (CSD_SD_V1_0_C_SIZE_MULT(csd) + 2)) -#define CSD_SD_V1_0_BLOCKNR(csd) \ - (((uint32_t)CSD_SD_V1_0_C_SIZE(csd) + 1) * CSD_SD_V1_0_MULT(csd)) -#define CSD_SD_V1_0_CAPACITY(csd) \ - (CSD_SD_V1_0_BLOCKNR(csd) * CSD_SD_V1_0_BLOCK_LEN(csd)) -#define CSD_SD_V1_0_SECTOR_SIZE(csd) \ - (((csd)[10] & 0x3f) << 1 | (csd)[11] >> 7) -#define CSD_SD_V1_0_WRITE_BL_LEN(csd) \ - (((csd)[12] & 0x03) << 2 | (csd)[13] >> 6) -#define CSD_SD_V2_0_C_SIZE(csd) \ - (((csd)[7] & 0x3f) << 16 | (csd)[8] << 8 | (csd)[9]) -#define CSD_SD_V2_0_CAPACITY(csd) \ - (((uint64_t)CSD_SD_V2_0_C_SIZE(csd) + 1) << 19) -#define CSD_MMC_ERASE_GRP_SIZE(csd) (((csd)[10] & 0x7c) >> 2) -#define CSD_MMC_ERASE_GRP_MULT(csd) \ - (((csd)[10] & 0x03) << 3 | (csd)[11] >> 5) -#define CSD_MMC_WRITE_BL_LEN(csd) \ - (((csd)[12] & 0x03) << 2 | (csd)[13] >> 6) - -typedef enum { - CARD_TYPE_MMC = 0x01, /* MMC v3 */ - CARD_TYPE_SD1 = 0x02, /* SD v1 */ - CARD_TYPE_SD2 = 0x04, /* SD v2 */ - CARD_TYPE_SD = CARD_TYPE_SD1 | CARD_TYPE_SD2, /* SD */ - CARD_TYPE_BLOCK = 0x08 /* Block addressing */ -} card_type_t; - -static struct mmc_priv { - uint8_t status; - uint8_t card_type; -} mmc_priv[MMC_CONF_DEV_COUNT]; - -/*----------------------------------------------------------------------------*/ -static uint8_t -mmc_spi_xchg(uint8_t dev, uint8_t tx_byte) -{ - uint8_t rx_byte; - - mmc_arch_spi_xfer(dev, &tx_byte, 1, &rx_byte, 1); - return rx_byte; -} -/*----------------------------------------------------------------------------*/ -static void -mmc_spi_tx(uint8_t dev, const void *buf, size_t cnt) -{ - mmc_arch_spi_xfer(dev, buf, cnt, NULL, 0); -} -/*----------------------------------------------------------------------------*/ -static void -mmc_spi_rx(uint8_t dev, void *buf, size_t cnt) -{ - mmc_arch_spi_xfer(dev, NULL, 0, buf, cnt); -} -/*----------------------------------------------------------------------------*/ -static bool -mmc_wait_ready(uint8_t dev, uint16_t timeout_ms) -{ - rtimer_clock_t timeout_end = - RTIMER_NOW() + ((uint32_t)timeout_ms * RTIMER_SECOND + 999) / 1000; - uint8_t rx_byte; - - do { - rx_byte = mmc_spi_xchg(dev, 0xff); - watchdog_periodic(); - } while(rx_byte != 0xff && RTIMER_CLOCK_LT(RTIMER_NOW(), timeout_end)); - return rx_byte == 0xff; -} -/*----------------------------------------------------------------------------*/ -static bool -mmc_select(uint8_t dev, bool sel) -{ - mmc_arch_spi_select(dev, sel); - mmc_spi_xchg(dev, 0xff); /* Dummy clock (force D0) */ - if(sel && !mmc_wait_ready(dev, 500)) { - mmc_select(dev, false); - return false; - } - return true; -} -/*----------------------------------------------------------------------------*/ -static uint8_t -mmc_send_cmd(uint8_t dev, uint8_t cmd, uint32_t arg) -{ - uint8_t resp, n; - - /* Send a CMD55 prior to a ACMD. */ - if(cmd & ACMD) { - cmd &= ~ACMD; - resp = mmc_send_cmd(dev, CMD55, 0); - if(resp != R1_SUCCESS && resp != R1_IDLE_STATE) { - return resp; - } - } - - /* - * Select the card and wait for ready, except to stop a multiple-block read. - */ - if(cmd != CMD12) { - mmc_select(dev, false); - if(!mmc_select(dev, true)) { - return 0xff; - } - } - - /* Send the command packet. */ - mmc_spi_xchg(dev, CMD_TX | cmd); /* Start & tx bits, cmd index */ - mmc_spi_xchg(dev, arg >> 24); /* Argument[31..24] */ - mmc_spi_xchg(dev, arg >> 16); /* Argument[23..16] */ - mmc_spi_xchg(dev, arg >> 8); /* Argument[15..8] */ - mmc_spi_xchg(dev, arg); /* Argument[7..0] */ - switch(cmd) { - case CMD0: - n = 0x95; /* CMD0(0) CRC7, end bit */ - break; - case CMD8: - n = 0x87; /* CMD8(0x1aa) CRC7, end bit */ - break; - default: - n = 0x01; /* Dummy CRC7, end bit */ - break; - } - mmc_spi_xchg(dev, n); - - /* Receive the command response. */ - if(cmd == CMD12) { - mmc_spi_xchg(dev, 0xff); /* Discard following byte if CMD12. */ - } - /* Wait for the response (max. 10 bytes). */ - n = 10; - do { - resp = mmc_spi_xchg(dev, 0xff); - } while((resp & 0x80) != R1_MSB && --n); - return resp; -} -/*----------------------------------------------------------------------------*/ -static bool -mmc_tx_block(uint8_t dev, const void *buf, uint8_t token) -{ - uint8_t resp; - - if(!mmc_wait_ready(dev, 500)) { - return false; - } - - mmc_spi_xchg(dev, token); - if(token != TOK_MULTI_WR_STOP_TRAN) { - mmc_spi_tx(dev, buf, BLOCK_LEN); - mmc_spi_xchg(dev, 0xff); /* Dummy CRC */ - mmc_spi_xchg(dev, 0xff); - - resp = mmc_spi_xchg(dev, 0xff); - if((resp & TOK_DATA_RESP_MASK) != TOK_DATA_RESP_ACCEPTED) { - return false; - } - } - return true; -} -/*----------------------------------------------------------------------------*/ -static bool -mmc_rx(uint8_t dev, void *buf, size_t cnt) -{ - rtimer_clock_t timeout_end = - RTIMER_NOW() + (200ul * RTIMER_SECOND + 999) / 1000; - uint8_t token; - - do { - token = mmc_spi_xchg(dev, 0xff); - watchdog_periodic(); - } while(token == 0xff && RTIMER_CLOCK_LT(RTIMER_NOW(), timeout_end)); - if(token != TOK_RD_SINGLE_WR_START_BLOCK) { - return false; - } - - mmc_spi_rx(dev, buf, cnt); - mmc_spi_xchg(dev, 0xff); /* Discard CRC. */ - mmc_spi_xchg(dev, 0xff); - return true; -} -/*----------------------------------------------------------------------------*/ -void -mmc_arch_cd_changed_callback(uint8_t dev, bool cd) -{ - uint8_t status; - - if(dev >= MMC_CONF_DEV_COUNT) { - return; - } - - if(cd) { - status = DISK_STATUS_DISK; - if(!mmc_arch_get_wp(dev)) { - status |= DISK_STATUS_WRITABLE; - } - } else { - status = 0; - } - mmc_priv[dev].status = status; -} -/*----------------------------------------------------------------------------*/ -static disk_status_t -mmc_status(uint8_t dev) -{ - bool cd; - struct mmc_priv *priv; - - if(dev >= MMC_CONF_DEV_COUNT) { - return DISK_RESULT_INVALID_ARG; - } - - cd = mmc_arch_get_cd(dev); - priv = &mmc_priv[dev]; - if(cd == !(priv->status & DISK_STATUS_DISK)) { - mmc_arch_cd_changed_callback(dev, cd); - } - return priv->status; -} -/*----------------------------------------------------------------------------*/ -static disk_status_t -mmc_initialize(uint8_t dev) -{ - disk_status_t status; - uint8_t n, cmd; - card_type_t card_type; - rtimer_clock_t timeout_end; - uint32_t arg, resp, ocr; - struct mmc_priv *priv; - - if(dev >= MMC_CONF_DEV_COUNT) { - return DISK_RESULT_INVALID_ARG; - } - status = mmc_status(dev); - if(!(status & DISK_STATUS_DISK)) { - return status; - } - - mmc_arch_spi_select(dev, false); - clock_delay_usec(10000); - - mmc_arch_spi_set_clock_freq(dev, CLOCK_FREQ_CARD_ID_MODE); - for(n = 10; n; n--) { - mmc_spi_xchg(dev, 0xff); /* Generate 80 dummy clock cycles. */ - } - - card_type = 0; - if(mmc_send_cmd(dev, CMD0, 0) == R1_IDLE_STATE) { - timeout_end = RTIMER_NOW() + RTIMER_SECOND; - arg = CMD8_ARG(CMD8_VHS_2_7_3_6, 0xaa); /* Arbitrary check pattern */ - if(mmc_send_cmd(dev, CMD8, arg) == R1_IDLE_STATE) { /* SD v2? */ - resp = 0; - for(n = 4; n; n--) { - resp = resp << 8 | mmc_spi_xchg(dev, 0xff); - } - /* Does the card support 2.7 V - 3.6 V? */ - if((arg & CMD8_ECHO_MASK) == (resp & CMD8_ECHO_MASK)) { - /* Wait for end of initialization. */ - while(RTIMER_CLOCK_LT(RTIMER_NOW(), timeout_end) && - mmc_send_cmd(dev, ACMD41, ACMD41_HCS) != R1_SUCCESS) { - watchdog_periodic(); - } - if(RTIMER_CLOCK_LT(RTIMER_NOW(), timeout_end) && - mmc_send_cmd(dev, CMD58, 0) == R1_SUCCESS) { /* Read OCR. */ - ocr = 0; - for(n = 4; n; n--) { - ocr = ocr << 8 | mmc_spi_xchg(dev, 0xff); - } - card_type = CARD_TYPE_SD2; - if(ocr & OCR_CCS) { - card_type |= CARD_TYPE_BLOCK; - } - } - } - } else { /* Not SD v2 */ - resp = mmc_send_cmd(dev, ACMD41, 0); - if(resp == R1_SUCCESS || resp == R1_IDLE_STATE) { /* SD v1 or MMC? */ - card_type = CARD_TYPE_SD1; - cmd = ACMD41; - } else { - card_type = CARD_TYPE_MMC; - cmd = CMD1; - } - /* Wait for end of initialization. */ - while(RTIMER_CLOCK_LT(RTIMER_NOW(), timeout_end) && - mmc_send_cmd(dev, cmd, 0) != R1_SUCCESS) { - watchdog_periodic(); - } - /* Set block length. */ - if(!RTIMER_CLOCK_LT(RTIMER_NOW(), timeout_end) || - mmc_send_cmd(dev, CMD16, BLOCK_LEN) != R1_SUCCESS) { - card_type = 0; - } - } - } - priv = &mmc_priv[dev]; - priv->card_type = card_type; - mmc_select(dev, false); - - status = priv->status; - if(status & DISK_STATUS_DISK && card_type) { /* OK */ - mmc_arch_spi_set_clock_freq(dev, CLOCK_FREQ_DATA_XFER_MODE); - status |= DISK_STATUS_INIT; - } else { /* Failed */ - status &= ~DISK_STATUS_INIT; - } - priv->status = status; - return status; -} -/*----------------------------------------------------------------------------*/ -static disk_result_t -mmc_read(uint8_t dev, void *buff, uint32_t sector, uint32_t count) -{ - if(dev >= MMC_CONF_DEV_COUNT || !count) { - return DISK_RESULT_INVALID_ARG; - } - if(!(mmc_status(dev) & DISK_STATUS_INIT)) { - return DISK_RESULT_NO_INIT; - } - - if(!(mmc_priv[dev].card_type & CARD_TYPE_BLOCK)) { - sector *= SECTOR_SIZE; - } - - if(count == 1) { - if(mmc_send_cmd(dev, CMD17, sector) == R1_SUCCESS && - mmc_rx(dev, buff, SECTOR_SIZE)) { - count = 0; - } - } else if(mmc_send_cmd(dev, CMD18, sector) == R1_SUCCESS) { - do { - if(!mmc_rx(dev, buff, SECTOR_SIZE)) { - break; - } - buff = (uint8_t *)buff + SECTOR_SIZE; - watchdog_periodic(); - } while(--count); - mmc_send_cmd(dev, CMD12, 0); /* Stop transmission. */ - } - mmc_select(dev, false); - return count ? DISK_RESULT_IO_ERROR : DISK_RESULT_OK; -} -/*----------------------------------------------------------------------------*/ -static disk_result_t -mmc_write(uint8_t dev, const void *buff, uint32_t sector, uint32_t count) -{ - disk_status_t status; - card_type_t card_type; - - if(dev >= MMC_CONF_DEV_COUNT || !count) { - return DISK_RESULT_INVALID_ARG; - } - status = mmc_status(dev); - if(!(status & DISK_STATUS_INIT)) { - return DISK_RESULT_NO_INIT; - } - if(!(status & DISK_STATUS_WRITABLE)) { - return DISK_RESULT_WR_PROTECTED; - } - - card_type = mmc_priv[dev].card_type; - if(!(card_type & CARD_TYPE_BLOCK)) { - sector *= SECTOR_SIZE; - } - - if(count == 1) { - if(mmc_send_cmd(dev, CMD24, sector) == R1_SUCCESS && - mmc_tx_block(dev, buff, TOK_RD_SINGLE_WR_START_BLOCK)) { - count = 0; - } - } else { - if(card_type & CARD_TYPE_SD) { - mmc_send_cmd(dev, ACMD23, count); - } - if(mmc_send_cmd(dev, CMD25, sector) == R1_SUCCESS) { - do { - if(!mmc_tx_block(dev, buff, TOK_MULTI_WR_START_BLOCK)) { - break; - } - buff = (uint8_t *)buff + BLOCK_LEN; - watchdog_periodic(); - } while(--count); - if(!mmc_tx_block(dev, NULL, TOK_MULTI_WR_STOP_TRAN)) { - count = 1; - } - } - } - mmc_select(dev, false); - return count ? DISK_RESULT_IO_ERROR : DISK_RESULT_OK; -} -/*----------------------------------------------------------------------------*/ -static disk_result_t -mmc_ioctl(uint8_t dev, uint8_t cmd, void *buff) -{ - card_type_t card_type; - disk_result_t res; - uint8_t csd[CSD_SIZE], sd_status[SD_STATUS_SIZE], au_size; - uint64_t capacity; - uint32_t block_size; - - static const uint8_t AU_TO_BLOCK_SIZE[] = {12, 16, 24, 32, 64}; - - if(dev >= MMC_CONF_DEV_COUNT) { - return DISK_RESULT_INVALID_ARG; - } - if(!(mmc_status(dev) & DISK_STATUS_INIT)) { - return DISK_RESULT_NO_INIT; - } - - card_type = mmc_priv[dev].card_type; - res = DISK_RESULT_IO_ERROR; - - switch(cmd) { - case DISK_IOCTL_CTRL_SYNC: - if(mmc_select(dev, true)) { - res = DISK_RESULT_OK; - } - break; - - case DISK_IOCTL_GET_SECTOR_COUNT: - if(mmc_send_cmd(dev, CMD9, 0) == R1_SUCCESS && mmc_rx(dev, csd, CSD_SIZE)) { - capacity = CSD_STRUCTURE(csd) == CSD_STRUCTURE_SD_V2_0 ? - CSD_SD_V2_0_CAPACITY(csd) : CSD_SD_V1_0_CAPACITY(csd); - *(uint32_t *)buff = capacity / SECTOR_SIZE; - res = DISK_RESULT_OK; - } - break; - - case DISK_IOCTL_GET_SECTOR_SIZE: - *(uint16_t *)buff = SECTOR_SIZE; - res = DISK_RESULT_OK; - break; - - case DISK_IOCTL_GET_BLOCK_SIZE: - if(card_type & CARD_TYPE_SD2) { - if(mmc_send_cmd(dev, ACMD13, 0) == R1_SUCCESS) { /* Read SD status. */ - mmc_spi_xchg(dev, 0xff); - if(mmc_rx(dev, sd_status, SD_STATUS_SIZE)) { - au_size = SD_STATUS_AU_SIZE(sd_status); - if(au_size) { - block_size = au_size <= 0xa ? 8192ull << au_size : - (uint32_t)AU_TO_BLOCK_SIZE[au_size - 0xb] << 20; - *(uint32_t *)buff = block_size / SECTOR_SIZE; - res = DISK_RESULT_OK; - } - } - } - } else if(mmc_send_cmd(dev, CMD9, 0) == R1_SUCCESS && - mmc_rx(dev, csd, CSD_SIZE)) { - if(card_type & CARD_TYPE_SD1) { - block_size = (uint32_t)(CSD_SD_V1_0_SECTOR_SIZE(csd) + 1) << - CSD_SD_V1_0_WRITE_BL_LEN(csd); - } else { /* MMC */ - block_size = (uint32_t)(CSD_MMC_ERASE_GRP_SIZE(csd) + 1) * - (CSD_MMC_ERASE_GRP_MULT(csd) + 1) << - CSD_MMC_WRITE_BL_LEN(csd); - } - *(uint32_t *)buff = block_size / SECTOR_SIZE; - res = DISK_RESULT_OK; - } - break; - - default: - res = DISK_RESULT_INVALID_ARG; - break; - } - mmc_select(dev, false); - return res; -} -/*----------------------------------------------------------------------------*/ -const struct disk_driver mmc_driver = { - .status = mmc_status, - .initialize = mmc_initialize, - .read = mmc_read, - .write = mmc_write, - .ioctl = mmc_ioctl -}; -/*----------------------------------------------------------------------------*/ - -/** @} */ diff --git a/arch/dev/disk/mmc/mmc.h b/arch/dev/disk/mmc/mmc.h deleted file mode 100644 index aef6bd165..000000000 --- a/arch/dev/disk/mmc/mmc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup disk - * @{ - * - * \defgroup mmc SD/MMC - * - * SD/MMC device driver. - * @{ - * - * \file - * Header file for the SD/MMC device driver. - */ -#ifndef MMC_H_ -#define MMC_H_ - -#include "contiki.h" -#include "../disk.h" - -#ifndef MMC_CONF_DEV_COUNT -/** Number of SD/MMC devices. */ -#define MMC_CONF_DEV_COUNT 1 -#endif - -extern const struct disk_driver mmc_driver; - -#endif /* MMC_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/dev/ds2411/ds2411.c b/arch/dev/ds2411/ds2411.c deleted file mode 100644 index 09c3f287f..000000000 --- a/arch/dev/ds2411/ds2411.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/* - * Device driver for the Dallas Semiconductor DS2411 chip. Heavily - * based on the application note 126 "1-Wire Communications Through - * Software". - * - * http://www.maxim-ic.com/appnotes.cfm/appnote_number/126 - */ - -/* - * For now we stuff in Moteiv Corporation's unique OUI. - * From http://www.ethereal.com/distribution/manuf.txt: - * 00:12:75 Moteiv # Moteiv Corporation - * - * The EUI-64 is a concatenation of the 24-bit OUI value assigned by - * the IEEE Registration Authority and a 40-bit extension identifier - * assigned by the organization with that OUI assignment. - */ - -#include - -#include "contiki.h" -#include "dev/ds2411/ds2411.h" - -unsigned char ds2411_id[8]; - -#ifdef CONTIKI_TARGET_SKY -/* 1-wire is at p2.4 */ -#define PIN BV(4) - -#define PIN_INIT() {\ - P2DIR &= ~PIN; /* p2.4 in, resistor pull high */\ - P2OUT &= ~PIN; /* p2.4 == 0 but still input */\ -} - -/* Set 1-Wire low or high. */ -#define OUTP_0() (P2DIR |= PIN) /* output and p2.4 == 0 from above */ -#define OUTP_1() (P2DIR &= ~PIN) /* p2.4 in, external resistor pull high */ - -/* Read one bit. */ -#define INP() (P2IN & PIN) - -/* - * Delay for u microseconds on a MSP430 at 2.4756MHz. - * - * The loop in clock_delay consists of one add and one jnz, i.e 3 - * cycles. - * - * 3 cycles at 2.4756MHz ==> 1.2us = 6/5us. - * - * Call overhead is roughly 7 cycles and the loop 3 cycles, to - * compensate for call overheads we make 7/3=14/6 fewer laps in the - * loop. - * - * This macro will loose badly if not passed a constant argument, it - * relies on the compiler doing the arithmetic during compile time!! - * TODO: Fix above comment to be correct - below code is modified for 4Mhz - */ -#define udelay(u) clock_delay((u*8 - 14)/6) - -/* - * Where call overhead dominates, use a macro! - * Note: modified for 4 Mhz - */ -#define udelay_6() { _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); } - -#endif /* CONTIKI_TARGET_SKY */ - -/* - * Recommended delay times in us. - */ -#define udelay_tA() udelay_6() -/* tA 6 max 15 */ -#define tB 64 -#define tC 60 /* max 120 */ -#define tD 10 -#define tE 9 /* max 12 */ -#define tF 55 -#define tG 0 -#define tH 480 -#define tI 70 -#define tJ 410 -/*---------------------------------------------------------------------------*/ -static int -owreset(void) -{ - int result; - OUTP_0(); - udelay(tH); - OUTP_1(); /* Releases the bus */ - udelay(tI); - result = INP(); - udelay(tJ); - return result; -} -/*---------------------------------------------------------------------------*/ -static void -owwriteb(unsigned byte) -{ - int i = 7; - do { - if(byte & 0x01) { - OUTP_0(); - udelay_tA(); - OUTP_1(); /* Releases the bus */ - udelay(tB); - } else { - OUTP_0(); - udelay(tC); - OUTP_1(); /* Releases the bus */ - udelay(tD); - } - if(i == 0) { - return; - } - i--; - byte >>= 1; - } while(1); -} -/*---------------------------------------------------------------------------*/ -static unsigned -owreadb(void) -{ - unsigned result = 0; - int i = 7; - do { - OUTP_0(); - udelay_tA(); - OUTP_1(); /* Releases the bus */ - udelay(tE); - if(INP()) { - result |= 0x80; /* LSbit first */ - } - udelay(tF); - if(i == 0) { - return result; - } - i--; - result >>= 1; - } while(1); -} -/*---------------------------------------------------------------------------*/ -/* Polynomial ^8 + ^5 + ^4 + 1 */ -static unsigned -crc8_add(unsigned acc, unsigned byte) -{ - int i; - acc ^= byte; - for(i = 0; i < 8; i++) { - if(acc & 1) { - acc = (acc >> 1) ^ 0x8c; - } else { - acc >>= 1; - } - } - return acc; -} -/*---------------------------------------------------------------------------*/ -int -ds2411_init() -{ - int i; - unsigned family, crc, acc; - - PIN_INIT(); - - if(owreset() == 0) { /* Something pulled down 1-wire. */ - /* - * Read MAC id with interrupts disabled. - */ - int s = splhigh(); - owwriteb(0x33); /* Read ROM command. */ - family = owreadb(); - /* We receive 6 bytes in the reverse order, LSbyte first. */ - for(i = 7; i >= 2; i--) { - ds2411_id[i] = owreadb(); - } - crc = owreadb(); - splx(s); - - /* Verify family and that CRC match. */ - if(family != 0x01) { - goto fail; - } - acc = crc8_add(0x0, family); - for(i = 7; i >= 2; i--) { - acc = crc8_add(acc, ds2411_id[i]); - } - if(acc == crc) { -#ifdef CONTIKI_TARGET_SKY - /* 00:12:75 Moteiv # Moteiv Corporation */ - ds2411_id[0] = 0x00; - ds2411_id[1] = 0x12; - ds2411_id[2] = 0x75; -#endif /* CONTIKI_TARGET_SKY */ - return 1; /* Success! */ - } - } - - fail: - memset(ds2411_id, 0x0, sizeof(ds2411_id)); - return 0; /* Fail! */ -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/dev/ds2411/ds2411.h b/arch/dev/ds2411/ds2411.h deleted file mode 100644 index 8cece23f6..000000000 --- a/arch/dev/ds2411/ds2411.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/* -*- C -*- */ - -#ifndef DS2411_H -#define DS2411_H - -extern unsigned char ds2411_id[8]; -extern int ds2411_init(); - -#endif /* DS2411_H */ diff --git a/arch/dev/enc28j60/enc28j60-ip64-driver.c b/arch/dev/enc28j60/enc28j60-ip64-driver.c deleted file mode 100644 index a3ed19e35..000000000 --- a/arch/dev/enc28j60/enc28j60-ip64-driver.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2012-2013, Thingsquare, http://www.thingsquare.com/. - * 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 "contiki.h" -#include "enc28j60.h" -#include "enc28j60-ip64-driver.h" -#include "linkaddr.h" - -#include "ip64/ip64.h" -#include "ip64/ip64-eth.h" - -#include -#include - -PROCESS(enc28j60_ip64_driver_process, "ENC28J60 IP64 driver"); - -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - uint8_t eui64[8]; - uint8_t macaddr[6]; - - /* Assume that linkaddr_node_addr holds the EUI64 of this device. */ - memcpy(eui64, &linkaddr_node_addr, sizeof(eui64)); - - /* Mangle the EUI64 into a 48-bit Ethernet address. */ - memcpy(&macaddr[0], &eui64[0], 3); - memcpy(&macaddr[3], &eui64[5], 3); - - /* In case the OUI happens to contain a broadcast bit, we mask that - out here. */ - macaddr[0] = (macaddr[0] & 0xfe); - - /* Set the U/L bit, in order to create a locally administered MAC address */ - macaddr[0] = (macaddr[0] | 0x02); - - memcpy(ip64_eth_addr.addr, macaddr, sizeof(macaddr)); - - printf("MAC addr %02x:%02x:%02x:%02x:%02x:%02x\n", - macaddr[0], macaddr[1], macaddr[2], - macaddr[3], macaddr[4], macaddr[5]); - enc28j60_init(macaddr); - process_start(&enc28j60_ip64_driver_process, NULL); -} -/*---------------------------------------------------------------------------*/ -static int -output(uint8_t *packet, uint16_t len) -{ - enc28j60_send(packet, len); - return len; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(enc28j60_ip64_driver_process, ev, data) -{ - static int len; - static struct etimer e; - PROCESS_BEGIN(); - - while(1) { - etimer_set(&e, 1); - PROCESS_WAIT_EVENT(); - len = enc28j60_read(ip64_packet_buffer, ip64_packet_buffer_maxlen); - if(len > 0) { - IP64_INPUT(ip64_packet_buffer, len); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -const struct ip64_driver enc28j60_ip64_driver = { - init, - output -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/dev/enc28j60/enc28j60-ip64-driver.h b/arch/dev/enc28j60/enc28j60-ip64-driver.h deleted file mode 100644 index aba56b635..000000000 --- a/arch/dev/enc28j60/enc28j60-ip64-driver.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2012-2013, Thingsquare, http://www.thingsquare.com/. - * 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 ENC28J60_IP64_DRIVER_H -#define ENC28J60_IP64_DRIVER_H - -#include "ip64/ip64-driver.h" -extern const struct ip64_driver enc28j60_ip64_driver; - -#endif /* ENC28J60_IP64_DRIVER_H */ diff --git a/arch/dev/enc28j60/enc28j60.c b/arch/dev/enc28j60/enc28j60.c deleted file mode 100644 index 6d7704e7f..000000000 --- a/arch/dev/enc28j60/enc28j60.c +++ /dev/null @@ -1,692 +0,0 @@ -/* - * Copyright (c) 2012-2013, Thingsquare, http://www.thingsquare.com/. - * 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 "contiki.h" -#include "enc28j60.h" -#include -#include - -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define EIE 0x1b -#define EIR 0x1c -#define ESTAT 0x1d -#define ECON2 0x1e -#define ECON1 0x1f - -#define ESTAT_CLKRDY 0x01 -#define ESTAT_TXABRT 0x02 - -#define ECON1_RXEN 0x04 -#define ECON1_TXRTS 0x08 - -#define ECON2_AUTOINC 0x80 -#define ECON2_PKTDEC 0x40 - -#define EIR_TXIF 0x08 - -#define ERXTX_BANK 0x00 - -#define ERDPTL 0x00 -#define ERDPTH 0x01 -#define EWRPTL 0x02 -#define EWRPTH 0x03 -#define ETXSTL 0x04 -#define ETXSTH 0x05 -#define ETXNDL 0x06 -#define ETXNDH 0x07 -#define ERXSTL 0x08 -#define ERXSTH 0x09 -#define ERXNDL 0x0a -#define ERXNDH 0x0b -#define ERXRDPTL 0x0c -#define ERXRDPTH 0x0d - -#define RX_BUF_START 0x0000 -#define RX_BUF_END 0x0fff - -#define TX_BUF_START 0x1200 - -/* MACONx registers are in bank 2 */ -#define MACONX_BANK 0x02 - -#define MACON1 0x00 -#define MACON3 0x02 -#define MACON4 0x03 -#define MABBIPG 0x04 -#define MAIPGL 0x06 -#define MAIPGH 0x07 -#define MAMXFLL 0x0a -#define MAMXFLH 0x0b - -#define MACON1_TXPAUS 0x08 -#define MACON1_RXPAUS 0x04 -#define MACON1_MARXEN 0x01 - -#define MACON3_PADCFG_FULL 0xe0 -#define MACON3_TXCRCEN 0x10 -#define MACON3_FRMLNEN 0x02 -#define MACON3_FULDPX 0x01 - -#define MAX_MAC_LENGTH 1518 - -#define MAADRX_BANK 0x03 -#define MAADR1 0x04 /* MAADR<47:40> */ -#define MAADR2 0x05 /* MAADR<39:32> */ -#define MAADR3 0x02 /* MAADR<31:24> */ -#define MAADR4 0x03 /* MAADR<23:16> */ -#define MAADR5 0x00 /* MAADR<15:8> */ -#define MAADR6 0x01 /* MAADR<7:0> */ -#define MISTAT 0x0a -#define EREVID 0x12 - -#define EPKTCNT_BANK 0x01 -#define ERXFCON 0x18 -#define EPKTCNT 0x19 - -#define ERXFCON_UCEN 0x80 -#define ERXFCON_ANDOR 0x40 -#define ERXFCON_CRCEN 0x20 -#define ERXFCON_MCEN 0x02 -#define ERXFCON_BCEN 0x01 - - -PROCESS(enc_watchdog_process, "Enc28j60 watchdog"); - -static uint8_t initialized = 0; -static uint8_t bank = ERXTX_BANK; -static uint8_t enc_mac_addr[6]; -static int received_packets = 0; -static int sent_packets = 0; - -/*---------------------------------------------------------------------------*/ -static uint8_t -is_mac_mii_reg(uint8_t reg) -{ - /* MAC or MII register (otherwise, ETH register)? */ - switch(bank) { - case MACONX_BANK: - return reg < EIE; - case MAADRX_BANK: - return reg <= MAADR2 || reg == MISTAT; - case ERXTX_BANK: - case EPKTCNT_BANK: - default: - return 0; - } -} -/*---------------------------------------------------------------------------*/ -static uint8_t -readreg(uint8_t reg) -{ - uint8_t r; - enc28j60_arch_spi_select(); - enc28j60_arch_spi_write(0x00 | (reg & 0x1f)); - if(is_mac_mii_reg(reg)) { - /* MAC and MII registers require that a dummy byte be read first. */ - enc28j60_arch_spi_read(); - } - r = enc28j60_arch_spi_read(); - enc28j60_arch_spi_deselect(); - return r; -} -/*---------------------------------------------------------------------------*/ -static void -writereg(uint8_t reg, uint8_t data) -{ - enc28j60_arch_spi_select(); - enc28j60_arch_spi_write(0x40 | (reg & 0x1f)); - enc28j60_arch_spi_write(data); - enc28j60_arch_spi_deselect(); -} -/*---------------------------------------------------------------------------*/ -static void -setregbitfield(uint8_t reg, uint8_t mask) -{ - if(is_mac_mii_reg(reg)) { - writereg(reg, readreg(reg) | mask); - } else { - enc28j60_arch_spi_select(); - enc28j60_arch_spi_write(0x80 | (reg & 0x1f)); - enc28j60_arch_spi_write(mask); - enc28j60_arch_spi_deselect(); - } -} -/*---------------------------------------------------------------------------*/ -static void -clearregbitfield(uint8_t reg, uint8_t mask) -{ - if(is_mac_mii_reg(reg)) { - writereg(reg, readreg(reg) & ~mask); - } else { - enc28j60_arch_spi_select(); - enc28j60_arch_spi_write(0xa0 | (reg & 0x1f)); - enc28j60_arch_spi_write(mask); - enc28j60_arch_spi_deselect(); - } -} -/*---------------------------------------------------------------------------*/ -static void -setregbank(uint8_t new_bank) -{ - writereg(ECON1, (readreg(ECON1) & 0xfc) | (new_bank & 0x03)); - bank = new_bank; -} -/*---------------------------------------------------------------------------*/ -static void -writedata(const uint8_t *data, int datalen) -{ - int i; - enc28j60_arch_spi_select(); - /* The Write Buffer Memory (WBM) command is 0 1 1 1 1 0 1 0 */ - enc28j60_arch_spi_write(0x7a); - for(i = 0; i < datalen; i++) { - enc28j60_arch_spi_write(data[i]); - } - enc28j60_arch_spi_deselect(); -} -/*---------------------------------------------------------------------------*/ -static void -writedatabyte(uint8_t byte) -{ - writedata(&byte, 1); -} -/*---------------------------------------------------------------------------*/ -static int -readdata(uint8_t *buf, int len) -{ - int i; - enc28j60_arch_spi_select(); - /* THe Read Buffer Memory (RBM) command is 0 0 1 1 1 0 1 0 */ - enc28j60_arch_spi_write(0x3a); - for(i = 0; i < len; i++) { - buf[i] = enc28j60_arch_spi_read(); - } - enc28j60_arch_spi_deselect(); - return i; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -readdatabyte(void) -{ - uint8_t r; - readdata(&r, 1); - return r; -} -/*---------------------------------------------------------------------------*/ -static void -softreset(void) -{ - enc28j60_arch_spi_select(); - /* The System Command (soft reset) is 1 1 1 1 1 1 1 1 */ - enc28j60_arch_spi_write(0xff); - enc28j60_arch_spi_deselect(); - bank = ERXTX_BANK; -} -/*---------------------------------------------------------------------------*/ -#if DEBUG -static uint8_t -readrev(void) -{ - uint8_t rev; - setregbank(MAADRX_BANK); - rev = readreg(EREVID); - switch(rev) { - case 2: - return 1; - case 6: - return 7; - default: - return rev; - } -} -#endif -/*---------------------------------------------------------------------------*/ -static void -reset(void) -{ - PRINTF("enc28j60: resetting chip\n"); - - enc28j60_arch_spi_init(); - - /* - 6.0 INITIALIZATION - - Before the ENC28J60 can be used to transmit and receive packets, - certain device settings must be initialized. Depending on the - application, some configuration options may need to be - changed. Normally, these tasks may be accomplished once after - Reset and do not need to be changed thereafter. - - 6.1 Receive Buffer - - Before receiving any packets, the receive buffer must be - initialized by programming the ERXST and ERXND pointers. All - memory between and including the ERXST and ERXND addresses will be - dedicated to the receive hardware. It is recommended that the - ERXST pointer be programmed with an even address. - - Applications expecting large amounts of data and frequent packet - delivery may wish to allocate most of the memory as the receive - buffer. Applications that may need to save older packets or have - several packets ready for transmission should allocate less - memory. - - When programming the ERXST pointer, the ERXWRPT registers will - automatically be updated with the same values. The address in - ERXWRPT will be used as the starting location when the receive - hardware begins writing received data. For tracking purposes, the - ERXRDPT registers should additionally be programmed with the same - value. To program ERXRDPT, the host controller must write to - ERXRDPTL first, followed by ERXRDPTH. See Section 7.2.4 “Freeing - Receive Buffer Space for more information - - 6.2 Transmission Buffer - - All memory which is not used by the receive buffer is considered - the transmission buffer. Data which is to be transmitted should be - written into any unused space. After a packet is transmitted, - however, the hardware will write a seven-byte status vector into - memory after the last byte in the packet. Therefore, the host - controller should leave at least seven bytes between each packet - and the beginning of the receive buffer. No explicit action is - required to initialize the transmission buffer. - - 6.3 Receive Filters - - The appropriate receive filters should be enabled or disabled by - writing to the ERXFCON register. See Section 8.0 “Receive Filters - for information on how to configure it. - - 6.4 Waiting For OST - - If the initialization procedure is being executed immediately - following a Power-on Reset, the ESTAT.CLKRDY bit should be polled - to make certain that enough time has elapsed before proceeding to - modify the MAC and PHY registers. For more information on the OST, - see Section 2.2 “Oscillator Start-up Timer. - */ - - softreset(); - - /* Workaround for erratum #2. */ - clock_delay_usec(1000); - - /* Wait for OST */ - while((readreg(ESTAT) & ESTAT_CLKRDY) == 0); - - setregbank(ERXTX_BANK); - /* Set up receive buffer */ - writereg(ERXSTL, RX_BUF_START & 0xff); - writereg(ERXSTH, RX_BUF_START >> 8); - writereg(ERXNDL, RX_BUF_END & 0xff); - writereg(ERXNDH, RX_BUF_END >> 8); - writereg(ERDPTL, RX_BUF_START & 0xff); - writereg(ERDPTH, RX_BUF_START >> 8); - writereg(ERXRDPTL, RX_BUF_END & 0xff); - writereg(ERXRDPTH, RX_BUF_END >> 8); - - /* Receive filters */ - setregbank(EPKTCNT_BANK); - writereg(ERXFCON, ERXFCON_UCEN | ERXFCON_CRCEN | ERXFCON_BCEN); - - /* - 6.5 MAC Initialization Settings - - Several of the MAC registers require configuration during - initialization. This only needs to be done once; the order of - programming is unimportant. - - 1. Set the MARXEN bit in MACON1 to enable the MAC to receive - frames. If using full duplex, most applications should also set - TXPAUS and RXPAUS to allow IEEE defined flow control to function. - - 2. Configure the PADCFG, TXCRCEN and FULDPX bits of MACON3. Most - applications should enable automatic padding to at least 60 bytes - and always append a valid CRC. For convenience, many applications - may wish to set the FRMLNEN bit as well to enable frame length - status reporting. The FULDPX bit should be set if the application - will be connected to a full-duplex configured remote node; - otherwise, it should be left clear. - - 3. Configure the bits in MACON4. For conformance to the IEEE 802.3 - standard, set the DEFER bit. - - 4. Program the MAMXFL registers with the maximum frame length to - be permitted to be received or transmitted. Normal network nodes - are designed to handle packets that are 1518 bytes or less. - - 5. Configure the Back-to-Back Inter-Packet Gap register, - MABBIPG. Most applications will program this register with 15h - when Full-Duplex mode is used and 12h when Half-Duplex mode is - used. - - 6. Configure the Non-Back-to-Back Inter-Packet Gap register low - byte, MAIPGL. Most applications will program this register with - 12h. - - 7. If half duplex is used, the Non-Back-to-Back Inter-Packet Gap - register high byte, MAIPGH, should be programmed. Most - applications will program this register to 0Ch. - - 8. If Half-Duplex mode is used, program the Retransmission and - Collision Window registers, MACLCON1 and MACLCON2. Most - applications will not need to change the default Reset values. If - the network is spread over exceptionally long cables, the default - value of MACLCON2 may need to be increased. - - 9. Program the local MAC address into the MAADR1:MAADR6 registers. - */ - - setregbank(MACONX_BANK); - - /* Turn on reception and IEEE-defined flow control */ - setregbitfield(MACON1, MACON1_MARXEN | MACON1_TXPAUS | MACON1_RXPAUS); - - /* Set padding, crc, full duplex */ - setregbitfield(MACON3, MACON3_PADCFG_FULL | MACON3_TXCRCEN | MACON3_FULDPX | - MACON3_FRMLNEN); - - /* Don't modify MACON4 */ - - /* Set maximum frame length in MAMXFL */ - writereg(MAMXFLL, MAX_MAC_LENGTH & 0xff); - writereg(MAMXFLH, MAX_MAC_LENGTH >> 8); - - /* Set back-to-back inter packet gap */ - writereg(MABBIPG, 0x15); - - /* Set non-back-to-back packet gap */ - writereg(MAIPGL, 0x12); - - /* Set MAC address */ - setregbank(MAADRX_BANK); - writereg(MAADR6, enc_mac_addr[5]); - writereg(MAADR5, enc_mac_addr[4]); - writereg(MAADR4, enc_mac_addr[3]); - writereg(MAADR3, enc_mac_addr[2]); - writereg(MAADR2, enc_mac_addr[1]); - writereg(MAADR1, enc_mac_addr[0]); - - /* - 6.6 PHY Initialization Settings - - Depending on the application, bits in three of the PHY module’s - registers may also require configuration. The PHCON1.PDPXMD bit - partially controls the device’s half/full-duplex - configuration. Normally, this bit is initialized correctly by the - external circuitry (see Section 2.6 “LED Configuration). If the - external circuitry is not present or incorrect, however, the host - controller must program the bit properly. Alternatively, for an - externally configurable system, the PDPXMD bit may be read and the - FULDPX bit be programmed to match. - - For proper duplex operation, the PHCON1.PDPXMD bit must also match - the value of the MACON3.FULDPX bit. - - If using half duplex, the host controller may wish to set the - PHCON2.HDLDIS bit to prevent automatic loopback of the data which - is transmitted. The PHY register, PHLCON, controls the outputs of - LEDA and LEDB. If an application requires a LED configuration - other than the default, PHLCON must be altered to match the new - requirements. The settings for LED operation are discussed in - Section 2.6 “LED Configuration. The PHLCON register is shown in - Register 2-2 (page 9). - */ - - /* Don't worry about PHY configuration for now */ - - /* Turn on autoincrement for buffer access */ - setregbitfield(ECON2, ECON2_AUTOINC); - - /* Turn on reception */ - writereg(ECON1, ECON1_RXEN); -} -/*---------------------------------------------------------------------------*/ -void -enc28j60_init(const uint8_t *mac_addr) -{ - if(initialized) { - return; - } - - memcpy(enc_mac_addr, mac_addr, 6); - - /* Start watchdog process */ - process_start(&enc_watchdog_process, NULL); - - reset(); - - PRINTF("ENC28J60 rev. B%d\n", readrev()); - - initialized = 1; -} -/*---------------------------------------------------------------------------*/ -int -enc28j60_send(const uint8_t *data, uint16_t datalen) -{ - uint16_t dataend; - - if(!initialized) { - return -1; - } - - /* - 1. Appropriately program the ETXST pointer to point to an unused - location in memory. It will point to the per packet control - byte. In the example, it would be programmed to 0120h. It is - recommended that an even address be used for ETXST. - - 2. Use the WBM SPI command to write the per packet control byte, - the destination address, the source MAC address, the - type/length and the data payload. - - 3. Appropriately program the ETXND pointer. It should point to the - last byte in the data payload. In the example, it would be - programmed to 0156h. - - 4. Clear EIR.TXIF, set EIE.TXIE and set EIE.INTIE to enable an - interrupt when done (if desired). - - 5. Start the transmission process by setting - ECON1.TXRTS. - */ - - setregbank(ERXTX_BANK); - /* Set up the transmit buffer pointer */ - writereg(ETXSTL, TX_BUF_START & 0xff); - writereg(ETXSTH, TX_BUF_START >> 8); - writereg(EWRPTL, TX_BUF_START & 0xff); - writereg(EWRPTH, TX_BUF_START >> 8); - - /* Write the transmission control register as the first byte of the - output packet. We write 0x00 to indicate that the default - configuration (the values in MACON3) will be used. */ - writedatabyte(0x00); /* MACON3 */ - - writedata(data, datalen); - - /* Write a pointer to the last data byte. */ - dataend = TX_BUF_START + datalen; - writereg(ETXNDL, dataend & 0xff); - writereg(ETXNDH, dataend >> 8); - - /* Clear EIR.TXIF */ - clearregbitfield(EIR, EIR_TXIF); - - /* Don't care about interrupts for now */ - - /* Send the packet */ - setregbitfield(ECON1, ECON1_TXRTS); - while((readreg(ECON1) & ECON1_TXRTS) > 0); - -#if DEBUG - if((readreg(ESTAT) & ESTAT_TXABRT) != 0) { - uint16_t erdpt; - uint8_t tsv[7]; - erdpt = (readreg(ERDPTH) << 8) | readreg(ERDPTL); - writereg(ERDPTL, (dataend + 1) & 0xff); - writereg(ERDPTH, (dataend + 1) >> 8); - readdata(tsv, sizeof(tsv)); - writereg(ERDPTL, erdpt & 0xff); - writereg(ERDPTH, erdpt >> 8); - PRINTF("enc28j60: tx err: %d: %02x:%02x:%02x:%02x:%02x:%02x\n" - " tsv: %02x%02x%02x%02x%02x%02x%02x\n", datalen, - 0xff & data[0], 0xff & data[1], 0xff & data[2], - 0xff & data[3], 0xff & data[4], 0xff & data[5], - tsv[6], tsv[5], tsv[4], tsv[3], tsv[2], tsv[1], tsv[0]); - } else { - PRINTF("enc28j60: tx: %d: %02x:%02x:%02x:%02x:%02x:%02x\n", datalen, - 0xff & data[0], 0xff & data[1], 0xff & data[2], - 0xff & data[3], 0xff & data[4], 0xff & data[5]); - } -#endif - - sent_packets++; - PRINTF("enc28j60: sent_packets %d\n", sent_packets); - return datalen; -} -/*---------------------------------------------------------------------------*/ -int -enc28j60_read(uint8_t *buffer, uint16_t bufsize) -{ - int n, len, next, err; - - uint8_t nxtpkt[2]; - uint8_t status[2]; - uint8_t length[2]; - - if(!initialized) { - return -1; - } - - err = 0; - - setregbank(EPKTCNT_BANK); - n = readreg(EPKTCNT); - - if(n == 0) { - return 0; - } - - PRINTF("enc28j60: EPKTCNT 0x%02x\n", n); - - setregbank(ERXTX_BANK); - /* Read the next packet pointer */ - nxtpkt[0] = readdatabyte(); - nxtpkt[1] = readdatabyte(); - - PRINTF("enc28j60: nxtpkt 0x%02x%02x\n", nxtpkt[1], nxtpkt[0]); - - length[0] = readdatabyte(); - length[1] = readdatabyte(); - - PRINTF("enc28j60: length 0x%02x%02x\n", length[1], length[0]); - - status[0] = readdatabyte(); - status[1] = readdatabyte(); - - /* This statement is just to avoid a compiler warning: */ - status[0] = status[0]; - PRINTF("enc28j60: status 0x%02x%02x\n", status[1], status[0]); - - len = (length[1] << 8) + length[0]; - if(bufsize >= len) { - readdata(buffer, len); - } else { - uint16_t i; - - err = 1; - - /* flush rx fifo */ - for(i = 0; i < len; i++) { - readdatabyte(); - } - } - - /* Read an additional byte at odd lengths, to avoid FIFO corruption */ - if((len % 2) != 0) { - readdatabyte(); - } - - /* Errata #14 */ - next = (nxtpkt[1] << 8) + nxtpkt[0]; - if(next == RX_BUF_START) { - next = RX_BUF_END; - } else { - next = next - 1; - } - writereg(ERXRDPTL, next & 0xff); - writereg(ERXRDPTH, next >> 8); - - setregbitfield(ECON2, ECON2_PKTDEC); - - if(err) { - PRINTF("enc28j60: rx err: flushed %d\n", len); - return 0; - } - PRINTF("enc28j60: rx: %d: %02x:%02x:%02x:%02x:%02x:%02x\n", len, - 0xff & buffer[0], 0xff & buffer[1], 0xff & buffer[2], - 0xff & buffer[3], 0xff & buffer[4], 0xff & buffer[5]); - - received_packets++; - PRINTF("enc28j60: received_packets %d\n", received_packets); - return len; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(enc_watchdog_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - - while(1) { -#define RESET_PERIOD (30 * CLOCK_SECOND) - etimer_set(&et, RESET_PERIOD); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - PRINTF("enc28j60: test received_packet %d > sent_packets %d\n", received_packets, sent_packets); - if(received_packets <= sent_packets) { - PRINTF("enc28j60: resetting chip\n"); - reset(); - } - received_packets = 0; - sent_packets = 0; - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/dev/enc28j60/enc28j60.h b/arch/dev/enc28j60/enc28j60.h deleted file mode 100644 index 473cceca4..000000000 --- a/arch/dev/enc28j60/enc28j60.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2012-2013, Thingsquare, http://www.thingsquare.com/. - * 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 ENC28J60_H -#define ENC28J60_H - -void enc28j60_init(const uint8_t *mac_addr); - -int enc28j60_send(const uint8_t *data, uint16_t datalen); - -int enc28j60_read(uint8_t *buffer, uint16_t bufsize); - -/* ENC28J60 architecture-specific SPI functions that are called by the - enc28j60 driver and must be implemented by the platform code */ - -void enc28j60_arch_spi_init(void); -uint8_t enc28j60_arch_spi_write(uint8_t data); -uint8_t enc28j60_arch_spi_read(void); -void enc28j60_arch_spi_select(void); -void enc28j60_arch_spi_deselect(void); - - -#endif /* ENC28J60_H */ diff --git a/arch/dev/ext-flash/README.md b/arch/dev/ext-flash/README.md deleted file mode 100644 index a16fb9c49..000000000 --- a/arch/dev/ext-flash/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Ext-flash Driver - -This is a generic driver for external SPI flash memories. It has been tested with the following parts: -- Winbond W25X20CL -- Winbond W25X40CL -- Macronix MX25R8035F -- Macronix MX25R1635F -- Macronix MX25R6435F -- Macronix MX25U6435F - -These parts have identical instruction sets; only the manufacturer and device ID differ, which must be specified in `board.h`. \ No newline at end of file diff --git a/arch/dev/ext-flash/ext-flash.c b/arch/dev/ext-flash/ext-flash.c deleted file mode 100644 index c4b108271..000000000 --- a/arch/dev/ext-flash/ext-flash.c +++ /dev/null @@ -1,536 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup ext-flash - * @{ - * - * \file - * Implementation of a generic external SPI flash driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "ext-flash.h" -#include "dev/spi.h" -#include "gpio-hal.h" -#include "sys/log.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#ifndef EXT_FLASH_SPI_CONTROLLER - -#define EXT_FLASH_SPI_CONTROLLER 0xFF /* No controller */ - -#define EXT_FLASH_SPI_PIN_SCK GPIO_HAL_PIN_UNKNOWN -#define EXT_FLASH_SPI_PIN_MOSI GPIO_HAL_PIN_UNKNOWN -#define EXT_FLASH_SPI_PIN_MISO GPIO_HAL_PIN_UNKNOWN -#define EXT_FLASH_SPI_PIN_CS GPIO_HAL_PIN_UNKNOWN - -#define EXT_FLASH_DEVICE_ID 0xFF -#define EXT_FLASH_MID 0xFF - -#define EXT_FLASH_PROGRAM_PAGE_SIZE 256 -#define EXT_FLASH_ERASE_SECTOR_SIZE 4096 - -#endif /* EXT_FLASH_SPI_CONTROLLER */ -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#define LOG_MODULE "ext-flash" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -/* Instruction codes */ - -#define BLS_CODE_PROGRAM 0x02 /**< Page Program */ -#define BLS_CODE_READ 0x03 /**< Read Data */ -#define BLS_CODE_READ_STATUS 0x05 /**< Read Status Register */ -#define BLS_CODE_WRITE_ENABLE 0x06 /**< Write Enable */ -#define BLS_CODE_SECTOR_ERASE 0x20 /**< Sector Erase */ -#define BLS_CODE_MDID 0x90 /**< Manufacturer Device ID */ - -#define BLS_CODE_PD 0xB9 /**< Power down */ -#define BLS_CODE_RPD 0xAB /**< Release Power-Down */ -/*---------------------------------------------------------------------------*/ -/* Erase instructions */ - -#define BLS_CODE_ERASE_4K 0x20 /**< Sector Erase */ -#define BLS_CODE_ERASE_32K 0x52 -#define BLS_CODE_ERASE_64K 0xD8 -#define BLS_CODE_ERASE_ALL 0xC7 /**< Mass Erase */ -/*---------------------------------------------------------------------------*/ -/* Bitmasks of the status register */ - -#define BLS_STATUS_SRWD_BM 0x80 -#define BLS_STATUS_BP_BM 0x0C -#define BLS_STATUS_WEL_BM 0x02 -#define BLS_STATUS_WIP_BM 0x01 - -#define BLS_STATUS_BIT_BUSY 0x01 /**< Busy bit of the status register */ -/*---------------------------------------------------------------------------*/ -#define VERIFY_PART_LOCKED -2 -#define VERIFY_PART_ERROR -1 -#define VERIFY_PART_POWERED_DOWN 0 -#define VERIFY_PART_OK 1 -/*---------------------------------------------------------------------------*/ -static const spi_device_t flash_spi_configuration_default = { - .spi_controller = EXT_FLASH_SPI_CONTROLLER, - .pin_spi_sck = EXT_FLASH_SPI_PIN_SCK, - .pin_spi_miso = EXT_FLASH_SPI_PIN_MISO, - .pin_spi_mosi = EXT_FLASH_SPI_PIN_MOSI, - .pin_spi_cs = EXT_FLASH_SPI_PIN_CS, - .spi_bit_rate = 4000000, - .spi_pha = 0, - .spi_pol = 0 -}; -/*---------------------------------------------------------------------------*/ -/** - * Get spi configuration, return default configuration if NULL - */ -static const spi_device_t * -get_spi_conf(const spi_device_t *conf) -{ - if(conf == NULL) { - return &flash_spi_configuration_default; - } - return conf; -} -/*---------------------------------------------------------------------------*/ -/** - * Clear external flash CSN line - */ -static bool -select_on_bus(const spi_device_t *flash_spi_configuration) -{ - if(spi_select(flash_spi_configuration) == SPI_DEV_STATUS_OK) { - return true; - } - return false; -} -/*---------------------------------------------------------------------------*/ -/** - * Set external flash CSN line - */ -static void -deselect(const spi_device_t *flash_spi_configuration) -{ - spi_deselect(flash_spi_configuration); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Wait till previous erase/program operation completes. - * \return True when successful. - */ -static bool -wait_ready(const spi_device_t *flash_spi_configuration) -{ - bool ret; - const uint8_t wbuf[1] = { BLS_CODE_READ_STATUS }; - - if(select_on_bus(flash_spi_configuration) == false) { - return false; - } - - ret = spi_write(flash_spi_configuration, wbuf, sizeof(wbuf)); - - if(ret != SPI_DEV_STATUS_OK) { - deselect(flash_spi_configuration); - return false; - } - - for(;;) { - uint8_t buf; - /* Note that this temporary implementation is not - * energy efficient. - * Thread could have yielded while waiting for flash - * erase/program to complete. - */ - ret = spi_read(flash_spi_configuration, &buf, sizeof(buf)); - - if(ret != SPI_DEV_STATUS_OK) { - /* Error */ - deselect(flash_spi_configuration); - return false; - } - - if(!(buf & BLS_STATUS_BIT_BUSY)) { - /* Now ready */ - break; - } - } - deselect(flash_spi_configuration); - return true; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Verify the flash part. - * \retval VERIFY_PART_OK The part was identified successfully - * \retval VERIFY_PART_ERROR There was an error communicating with the part - * \retval VERIFY_PART_POWERED_DOWN Communication was successful, but the part - * was powered down - */ -static uint8_t -verify_part(const spi_device_t *flash_spi_configuration) -{ - const uint8_t wbuf[] = { BLS_CODE_MDID, 0xFF, 0xFF, 0x00 }; - uint8_t rbuf[2] = { 0, 0 }; - bool ret; - - if(select_on_bus(flash_spi_configuration) == false) { - return VERIFY_PART_LOCKED; - } - - if(spi_write(flash_spi_configuration, wbuf, sizeof(wbuf)) != SPI_DEV_STATUS_OK) { - deselect(flash_spi_configuration); - return VERIFY_PART_ERROR; - } - - ret = spi_read(flash_spi_configuration, rbuf, sizeof(rbuf)); - deselect(flash_spi_configuration); - if(ret != SPI_DEV_STATUS_OK) { - return VERIFY_PART_ERROR; - } - - LOG_DBG("Verify: %02x %02x\n", rbuf[0], rbuf[1]); - - if(rbuf[0] != EXT_FLASH_MID || rbuf[1] != EXT_FLASH_DEVICE_ID) { - return VERIFY_PART_POWERED_DOWN; - } - return VERIFY_PART_OK; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Put the device in power save mode. No access to data; only - * the status register is accessible. - */ -static bool -power_down(const spi_device_t *flash_spi_configuration) -{ - uint8_t cmd; - uint8_t i; - - /* First, wait for the device to be ready */ - if(wait_ready(flash_spi_configuration) == false) { - /* Entering here will leave the device in standby instead of powerdown */ - return false; - } - - cmd = BLS_CODE_PD; - if(select_on_bus(flash_spi_configuration) == false) { - return false; - } - - if(spi_write_byte(flash_spi_configuration, cmd) != SPI_DEV_STATUS_OK) { - deselect(flash_spi_configuration); - return false; - } - deselect(flash_spi_configuration); - - i = 0; - while(i < 10) { - if(verify_part(flash_spi_configuration) == VERIFY_PART_POWERED_DOWN) { - /* Device is powered down */ - return true; - } - i++; - } - - /* Should not be required */ - deselect(flash_spi_configuration); - return false; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Take device out of power save mode and prepare it for normal operation - * \return True if the command was written successfully - */ -static bool -power_standby(const spi_device_t *flash_spi_configuration) -{ - uint8_t cmd; - bool success; - - cmd = BLS_CODE_RPD; - if(select_on_bus(flash_spi_configuration) == false) { - return false; - } - - success = (spi_write(flash_spi_configuration, &cmd, sizeof(cmd)) == SPI_DEV_STATUS_OK); - - if(success) { - success = wait_ready(flash_spi_configuration) == true ? true : false; - } - - deselect(flash_spi_configuration); - - return success; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Enable write. - * \return True when successful. - */ -static bool -write_enable(const spi_device_t *flash_spi_configuration) -{ - bool ret; - const uint8_t wbuf[] = { BLS_CODE_WRITE_ENABLE }; - - if(select_on_bus(flash_spi_configuration) == false) { - return false; - } - - ret = (spi_write(flash_spi_configuration, wbuf, sizeof(wbuf)) == SPI_DEV_STATUS_OK); - deselect(flash_spi_configuration); - - if(ret == false) { - return false; - } - return true; -} -/*---------------------------------------------------------------------------*/ -bool -ext_flash_open(const spi_device_t *conf) -{ - const spi_device_t *flash_spi_configuration; - - flash_spi_configuration = get_spi_conf(conf); - - /* Check if platform has ext-flash */ - if(flash_spi_configuration->pin_spi_sck == GPIO_HAL_PIN_UNKNOWN) { - return false; - } - - if(spi_acquire(flash_spi_configuration) != SPI_DEV_STATUS_OK) { - return false; - } - /* Default output to clear chip select */ - deselect(flash_spi_configuration); - - /* Put the part is standby mode */ - power_standby(flash_spi_configuration); - - if(verify_part(flash_spi_configuration) == VERIFY_PART_OK) { - return true; - } - - /* Failed to verify */ - spi_release(flash_spi_configuration); - return false; -} -/*---------------------------------------------------------------------------*/ -bool -ext_flash_close(const spi_device_t *conf) -{ - bool ret; - const spi_device_t *flash_spi_configuration; - - flash_spi_configuration = get_spi_conf(conf); - - /* Put the part in low power mode */ - ret = power_down(flash_spi_configuration); - - /* SPI is released no matter if power_down() succeeds or fails */ - if(spi_release(flash_spi_configuration) != SPI_DEV_STATUS_OK) { - return false; - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -bool -ext_flash_read(const spi_device_t *conf, uint32_t offset, uint32_t length, uint8_t *buf) -{ - uint8_t wbuf[4]; - bool ret; - - const spi_device_t *flash_spi_configuration; - - flash_spi_configuration = get_spi_conf(conf); - - /* Wait till previous erase/program operation completes */ - if(wait_ready(flash_spi_configuration) == false) { - return false; - } - - /* - * SPI is driven with very low frequency (1MHz < 33MHz fR spec) - * in this implementation, hence it is not necessary to use fast read. - */ - wbuf[0] = BLS_CODE_READ; - wbuf[1] = (offset >> 16) & 0xff; - wbuf[2] = (offset >> 8) & 0xff; - wbuf[3] = offset & 0xff; - - if(select_on_bus(flash_spi_configuration) == false) { - return false; - } - - if(spi_write(flash_spi_configuration, wbuf, sizeof(wbuf)) != SPI_DEV_STATUS_OK) { - /* failure */ - deselect(flash_spi_configuration); - return false; - } - - ret = (spi_read(flash_spi_configuration, buf, length) == SPI_DEV_STATUS_OK); - - deselect(flash_spi_configuration); - - return ret; -} -/*---------------------------------------------------------------------------*/ -bool -ext_flash_write(const spi_device_t *conf, uint32_t offset, uint32_t length, const uint8_t *buf) -{ - uint8_t wbuf[4]; - uint32_t ilen; /* interim length per instruction */ - - const spi_device_t *flash_spi_configuration; - - flash_spi_configuration = get_spi_conf(conf); - - while(length > 0) { - /* Wait till previous erase/program operation completes */ - if(wait_ready(flash_spi_configuration) == false) { - return false; - } - - if(write_enable(flash_spi_configuration) == false) { - return false; - } - - ilen = EXT_FLASH_PROGRAM_PAGE_SIZE - (offset % EXT_FLASH_PROGRAM_PAGE_SIZE); - if(length < ilen) { - ilen = length; - } - - wbuf[0] = BLS_CODE_PROGRAM; - wbuf[1] = (offset >> 16) & 0xff; - wbuf[2] = (offset >> 8) & 0xff; - wbuf[3] = offset & 0xff; - - offset += ilen; - length -= ilen; - - /* Upto 100ns CS hold time (which is not clear - * whether it's application only inbetween reads) - * is not imposed here since above instructions - * should be enough to delay - * as much. */ - if(select_on_bus(flash_spi_configuration) == false) { - return false; - } - - if(spi_write(flash_spi_configuration, wbuf, sizeof(wbuf)) != SPI_DEV_STATUS_OK) { - /* failure */ - deselect(flash_spi_configuration); - return false; - } - - if(spi_write(flash_spi_configuration, buf, ilen) != SPI_DEV_STATUS_OK) { - /* failure */ - deselect(flash_spi_configuration); - return false; - } - buf += ilen; - deselect(flash_spi_configuration); - } - - return true; -} -/*---------------------------------------------------------------------------*/ -bool -ext_flash_erase(const spi_device_t *conf, uint32_t offset, uint32_t length) -{ - /* - * Note that Block erase might be more efficient when the floor map - * is well planned for OTA, but to simplify this implementation, - * sector erase is used blindly. - */ - uint8_t wbuf[4]; - uint32_t i, numsectors; - uint32_t endoffset = offset + length - 1; - - const spi_device_t *flash_spi_configuration; - - flash_spi_configuration = get_spi_conf(conf); - - offset = (offset / EXT_FLASH_ERASE_SECTOR_SIZE) * EXT_FLASH_ERASE_SECTOR_SIZE; - numsectors = (endoffset - offset + EXT_FLASH_ERASE_SECTOR_SIZE - 1) / EXT_FLASH_ERASE_SECTOR_SIZE; - - wbuf[0] = BLS_CODE_SECTOR_ERASE; - - for(i = 0; i < numsectors; i++) { - /* Wait till previous erase/program operation completes */ - if(wait_ready(flash_spi_configuration) == false) { - return false; - } - - if(write_enable(flash_spi_configuration) == false) { - return false; - } - - wbuf[1] = (offset >> 16) & 0xff; - wbuf[2] = (offset >> 8) & 0xff; - wbuf[3] = offset & 0xff; - - if(select_on_bus(flash_spi_configuration) == false) { - return false; - } - - if(spi_write(flash_spi_configuration, wbuf, sizeof(wbuf)) != SPI_DEV_STATUS_OK) { - /* failure */ - deselect(flash_spi_configuration); - return false; - } - deselect(flash_spi_configuration); - - offset += EXT_FLASH_ERASE_SECTOR_SIZE; - } - - return true; -} -/*---------------------------------------------------------------------------*/ -bool -ext_flash_init(const spi_device_t *conf) -{ - if(ext_flash_open(conf) == false) { - return false; - } - - if(ext_flash_close(conf) == false) { - return false; - } - - LOG_INFO("Flash init successful\n"); - - return true; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/dev/ext-flash/ext-flash.h b/arch/dev/ext-flash/ext-flash.h deleted file mode 100644 index 2d081f5be..000000000 --- a/arch/dev/ext-flash/ext-flash.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup dev - * @{ - * - * \defgroup ext-flash Generic external SPI flash driver - * - * This is a generic driver for external SPI flash memories. The driver has - * been tested and works with multiple external SPI flash parts. The list of - * parts the driver has been tested against is shown in the README in this - * directory. - * - * If you successfully use this driver with a part that is not listed in the - * README, please let us know so we can update it. - * - * @{ - * - * \file - * Header file for the external SPI flash API - */ -/*---------------------------------------------------------------------------*/ -#ifndef EXT_FLASH_H_ -#define EXT_FLASH_H_ -/*---------------------------------------------------------------------------*/ -#include "dev/spi.h" -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize storage driver. - * \param conf SPI bus configuration struct. NULL for default. - * \return True when successful. - */ -bool ext_flash_open(const spi_device_t *conf); - -/** - * \brief Close the storage driver - * \param conf SPI bus configuration struct. NULL for default. - * \return True when successful. - * - * This call will put the device in its lower power mode (power down). - */ -bool ext_flash_close(const spi_device_t *conf); - -/** - * \brief Read storage content - * \param conf SPI bus configuration struct. NULL for default. - * \param offset Address to read from - * \param length Number of bytes to read - * \param buf Buffer where to store the read bytes - * \return True when successful. - * - * buf must be allocated by the caller - */ -bool ext_flash_read(const spi_device_t *conf, uint32_t offset, uint32_t length, uint8_t *buf); - -/** - * \brief Erase storage sectors corresponding to the range. - * \param conf SPI bus configuration struct. NULL for default. - * \param offset Address to start erasing - * \param length Number of bytes to erase - * \return True when successful. - * - * The erase operation will be sector-wise, therefore a call to this function - * will generally start the erase procedure at an address lower than offset - */ -bool ext_flash_erase(const spi_device_t *conf, uint32_t offset, uint32_t length); - -/** - * \brief Write to storage sectors. - * \param conf SPI bus configuration struct. NULL for default. - * \param offset Address to write to - * \param length Number of bytes to write - * \param buf Buffer holding the bytes to be written - * - * \return True when successful. - */ -bool ext_flash_write(const spi_device_t *conf, uint32_t offset, uint32_t length, const uint8_t *buf); - -/** - * \brief Initialise the external flash - * \param conf SPI bus configuration struct. NULL for default. - * - * This function will explicitly put the part in its lowest power mode - * (power-down). - * - * In order to perform any operation, the caller must first wake the device - * up by calling ext_flash_open() - */ -bool ext_flash_init(const spi_device_t *conf); -/*---------------------------------------------------------------------------*/ -#endif /* EXT_FLASH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/dev/rgb-led/rgb-led.c b/arch/dev/rgb-led/rgb-led.c deleted file mode 100644 index 521583022..000000000 --- a/arch/dev/rgb-led/rgb-led.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rgb-led - * @{ - * - * \file - * Implementation of the RGB LED driver. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/leds.h" -#include "dev/rgb-led/rgb-led.h" -/*---------------------------------------------------------------------------*/ -void -rgb_led_off(void) -{ - leds_off(LEDS_ALL); -} -/*----------------------------------------------------------------------------*/ -void -rgb_led_set(uint8_t colour) -{ - leds_mask_t leds = - ((colour & RGB_LED_RED) ? LEDS_RED : LEDS_COLOUR_NONE) | - ((colour & RGB_LED_GREEN) ? LEDS_GREEN : LEDS_COLOUR_NONE) | - ((colour & RGB_LED_BLUE) ? LEDS_BLUE : LEDS_COLOUR_NONE); - - leds_off(LEDS_ALL); - leds_on(leds); -} -/*----------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/dev/rgb-led/rgb-led.h b/arch/dev/rgb-led/rgb-led.h deleted file mode 100644 index d0cd81d38..000000000 --- a/arch/dev/rgb-led/rgb-led.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 RGB_LED_H_ -#define RGB_LED_H_ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup dev - * @{ - */ -/*---------------------------------------------------------------------------*/ -/** - * \defgroup rgb-led Generic RGB LED driver - * - * This is a driver for a tri-color RGB LED part, such as for example the - * Broadcom (ex Avago Technologies) PLCC-4 Tricolor Black Surface LED present - * on all Zolertia Zoul-based boards. - * - * - * This driver sits on top of the LED HAL. Therefore, any port that wishes to - * use this driver should first implement the GPIO HAL and the new LED API. - * This driver will set the colour of the RGB LED by using combinations of - * LED_RED, LED_GREEN and LED_BLUE. Therefore, those must be correctly defined - * by the platform configuration. - * @{ - * - * \file - * Header file for the RGB LED driver. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -#define RGB_LED_RED 1 -#define RGB_LED_GREEN 2 -#define RGB_LED_BLUE 4 -#define RGB_LED_MAGENTA (RGB_LED_RED | RGB_LED_BLUE) -#define RGB_LED_YELLOW (RGB_LED_RED | RGB_LED_GREEN) -#define RGB_LED_CYAN (RGB_LED_GREEN | RGB_LED_BLUE ) -#define RGB_LED_WHITE (RGB_LED_RED | RGB_LED_GREEN | RGB_LED_BLUE) -/*---------------------------------------------------------------------------*/ -/** - * \brief Turn off the RGB LED - */ -void rgb_led_off(void); - -/** - * \brief Set the colour of the RGB LED - * \param colour The colour to set - * - * \e colour can take the value of one of the RGB_LED_xyz defines. - */ -void rgb_led_set(uint8_t colour); -/*---------------------------------------------------------------------------*/ -#endif /* RGB_LED_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/dev/sht11/sht11-sensor.c b/arch/dev/sht11/sht11-sensor.c deleted file mode 100644 index cbe472218..000000000 --- a/arch/dev/sht11/sht11-sensor.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include - -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/sht11/sht11.h" -#include "dev/sht11/sht11-sensor.h" - -const struct sensors_sensor sht11_sensor; - -enum { - ON, OFF -}; -static uint8_t state = OFF; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - switch(type) { - /* Photosynthetically Active Radiation. */ - case SHT11_SENSOR_TEMP: - return sht11_temp();; - - /* Total Solar Radiation. */ - case SHT11_SENSOR_HUMIDITY: - return sht11_humidity(); - - case SHT11_SENSOR_BATTERY_INDICATOR: - return sht11_sreg() & 0x40? 1: 0; -} - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return (state == ON); - } - return 0; -} - -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - switch(type) { - case SENSORS_ACTIVE: - if(c) { - if(!status(SENSORS_ACTIVE)) { - rtimer_clock_t t0; - sht11_init(); - state = ON; - - /* For for about 11 ms before the SHT11 can be used. */ - t0 = RTIMER_NOW(); - while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + RTIMER_SECOND / 100)); - } - } else { - sht11_off(); - state = OFF; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(sht11_sensor, "sht11", - value, configure, status); diff --git a/arch/dev/sht11/sht11-sensor.h b/arch/dev/sht11/sht11-sensor.h deleted file mode 100644 index 7395a49fd..000000000 --- a/arch/dev/sht11/sht11-sensor.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2010-01-08 - * Updated : $Date: 2010/01/15 08:51:21 $ - * $Revision: 1.2 $ - */ - -#ifndef SHT11_SENSOR_H_ -#define SHT11_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor sht11_sensor; - -#define SHT11_SENSOR_TEMP 0 -#define SHT11_SENSOR_HUMIDITY 1 -#define SHT11_SENSOR_BATTERY_INDICATOR 2 - - -#endif /* SHT11-SENSOR_H_ */ diff --git a/arch/dev/sht11/sht11.c b/arch/dev/sht11/sht11.c deleted file mode 100644 index 670d10d91..000000000 --- a/arch/dev/sht11/sht11.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/* - * Device driver for the Sensirion SHT1x/SHT7x family of humidity and - * temperature sensors. - */ - -#include "contiki.h" -#include -#include "dev/sht11/sht11.h" -#include "sht11-arch.h" - -#define DEBUG 0 - -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#ifndef SDA_0 -#define SDA_0() (SHT11_PxDIR |= BV(SHT11_ARCH_SDA)) /* SDA Output=0 */ -#define SDA_1() (SHT11_PxDIR &= ~BV(SHT11_ARCH_SDA)) /* SDA Input */ -#define SDA_IS_1 (SHT11_PxIN & BV(SHT11_ARCH_SDA)) - -#define SCL_0() (SHT11_PxOUT &= ~BV(SHT11_ARCH_SCL)) /* SCL Output=0 */ -#define SCL_1() (SHT11_PxOUT |= BV(SHT11_ARCH_SCL)) /* SCL Output=1 */ -#endif - /* adr command r/w */ -#define STATUS_REG_W 0x06 /* 000 0011 0 */ -#define STATUS_REG_R 0x07 /* 000 0011 1 */ -#define MEASURE_TEMP 0x03 /* 000 0001 1 */ -#define MEASURE_HUMI 0x05 /* 000 0010 1 */ -#define RESET 0x1e /* 000 1111 0 */ - -/* This can probably be reduced to 250ns according to data sheet. */ -#ifndef delay_400ns -#define delay_400ns() _NOP() -#endif -/*---------------------------------------------------------------------------*/ -static void -sstart(void) -{ - SDA_1(); SCL_0(); - delay_400ns(); - SCL_1(); - delay_400ns(); - SDA_0(); - delay_400ns(); - SCL_0(); - delay_400ns(); - SCL_1(); - delay_400ns(); - SDA_1(); - delay_400ns(); - SCL_0(); -} -/*---------------------------------------------------------------------------*/ -static void -sreset(void) -{ - int i; - SDA_1(); - SCL_0(); - for(i = 0; i < 9 ; i++) { - SCL_1(); - delay_400ns(); - SCL_0(); - delay_400ns(); - } - sstart(); /* Start transmission, why??? */ -} -/*---------------------------------------------------------------------------*/ -/* - * Return true if we received an ACK. - */ -static int -swrite(unsigned _c) -{ - unsigned char c = _c; - int i; - int ret; - - for(i = 0; i < 8; i++, c <<= 1) { - if(c & 0x80) { - SDA_1(); - } else { - SDA_0(); - } - SCL_1(); - delay_400ns(); - SCL_0(); - delay_400ns(); - } - - SDA_1(); - SCL_1(); - delay_400ns(); - ret = !SDA_IS_1; - - SCL_0(); - - return ret; -} -/*---------------------------------------------------------------------------*/ -static unsigned -sread(int send_ack) -{ - int i; - unsigned char c = 0x00; - - SDA_1(); - for(i = 0; i < 8; i++) { - c <<= 1; - SCL_1(); - delay_400ns(); - if(SDA_IS_1) { - c |= 0x1; - } - SCL_0(); - delay_400ns(); - } - - if(send_ack) { - SDA_0(); - } - SCL_1(); - delay_400ns(); - SCL_0(); - - SDA_1(); /* Release SDA */ - - return c; -} -/*---------------------------------------------------------------------------*/ -#define CRC_CHECK -#ifdef CRC_CHECK -static unsigned char -rev8bits(unsigned char v) -{ - unsigned char r = v; - int s = 7; - - for (v >>= 1; v; v >>= 1) { - r <<= 1; - r |= v & 1; - s--; - } - r <<= s; /* Shift when v's highest bits are zero */ - return r; -} -/*---------------------------------------------------------------------------*/ -/* BEWARE: Bit reversed CRC8 using polynomial ^8 + ^5 + ^4 + 1 */ -static unsigned -crc8_add(unsigned acc, unsigned byte) -{ - int i; - acc ^= byte; - for(i = 0; i < 8; i++) { - if(acc & 0x80) { - acc = (acc << 1) ^ 0x31; - } else { - acc <<= 1; - } - } - return acc & 0xff; -} -#endif /* CRC_CHECK */ -/*---------------------------------------------------------------------------*/ -/* - * Power up the device. The device can be used after an additional - * 11ms waiting time. - */ -void -sht11_init(void) -{ - /* - * SCL Output={0,1} - * SDA 0: Output=0 - * 1: Input and pull-up (Output=0) - */ -#ifdef SHT11_INIT - SHT11_INIT(); -#else - /* As this driver is bit-bang based, disable the I2C first - This assumes the SDA/SCL pins passed in the -arch.h file are - actually the same used for I2C operation, else comment out the following - */ - SHT11_PxSEL &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL)); - #if defined(__MSP430_HAS_MSP430X_CPU__) || defined(__MSP430_HAS_MSP430XV2_CPU__) - SHT11_PxREN &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL)); - #endif - - /* Configure SDA/SCL as GPIOs */ - SHT11_PxOUT |= BV(SHT11_ARCH_PWR); - SHT11_PxOUT &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL)); - SHT11_PxDIR |= BV(SHT11_ARCH_PWR) | BV(SHT11_ARCH_SCL); -#endif -} -/*---------------------------------------------------------------------------*/ -/* - * Power of device. - */ -void -sht11_off(void) -{ -#ifdef SHT11_OFF - SHT11_OFF(); -#else - SHT11_PxOUT &= ~BV(SHT11_ARCH_PWR); - SHT11_PxOUT &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL)); - SHT11_PxDIR |= BV(SHT11_ARCH_PWR) | BV(SHT11_ARCH_SCL); -#endif -} -/*---------------------------------------------------------------------------*/ -/* - * Only commands MEASURE_HUMI or MEASURE_TEMP! - */ -static unsigned int -scmd(unsigned cmd) -{ - unsigned int n; - - if(cmd != MEASURE_HUMI && cmd != MEASURE_TEMP) { - PRINTF("Illegal command: %d\n", cmd); - return -1; - } - - sstart(); /* Start transmission */ - if(!swrite(cmd)) { - PRINTF("SHT11: scmd - swrite failed\n"); - goto fail; - } - - for(n = 0; n < 20000; n++) { - if(!SDA_IS_1) { - unsigned t0, t1, rcrc; - t0 = sread(1); - t1 = sread(1); - rcrc = sread(0); - PRINTF("SHT11: scmd - read %d, %d\n", t0, t1); -#ifdef CRC_CHECK - { - unsigned crc; - crc = crc8_add(0x0, cmd); - crc = crc8_add(crc, t0); - crc = crc8_add(crc, t1); - if(crc != rev8bits(rcrc)) { - PRINTF("SHT11: scmd - crc check failed %d vs %d\n", - crc, rev8bits(rcrc)); - goto fail; - } - } -#endif - return (t0 << 8) | t1; - } - /* short wait before next loop */ - clock_wait(1); - } - fail: - sreset(); - return -1; -} -/*---------------------------------------------------------------------------*/ -/* - * Call may take up to 210ms. - */ -unsigned int -sht11_temp(void) -{ - return scmd(MEASURE_TEMP); -} -/*---------------------------------------------------------------------------*/ -/* - * Call may take up to 210ms. - */ -unsigned int -sht11_humidity(void) -{ - return scmd(MEASURE_HUMI); -} -/*---------------------------------------------------------------------------*/ -#if 1 /* But ok! */ -unsigned -sht11_sreg(void) -{ - unsigned sreg, rcrc; - - sstart(); /* Start transmission */ - if(!swrite(STATUS_REG_R)) { - goto fail; - } - - sreg = sread(1); - rcrc = sread(0); - -#ifdef CRC_CHECK - { - unsigned crc; - crc = crc8_add(0x0, STATUS_REG_R); - crc = crc8_add(crc, sreg); - if (crc != rev8bits(rcrc)) - goto fail; - } -#endif - - return sreg; - - fail: - sreset(); - return -1; -} -#endif -/*---------------------------------------------------------------------------*/ -#if 0 -int -sht11_set_sreg(unsigned sreg) -{ - sstart(); /* Start transmission */ - if(!swrite(STATUS_REG_W)) { - goto fail; - } - if(!swrite(sreg)) { - goto fail; - } - - return 0; - - fail: - sreset(); - return -1; -} -#endif -/*---------------------------------------------------------------------------*/ -#if 0 -int -sht11_reset(void) -{ - sstart(); /* Start transmission */ - if(!swrite(RESET)) { - goto fail; - } - - return 0; - - fail: - sreset(); - return -1; -} -#endif -/*---------------------------------------------------------------------------*/ diff --git a/arch/dev/sht11/sht11.h b/arch/dev/sht11/sht11.h deleted file mode 100644 index 1aa3197c5..000000000 --- a/arch/dev/sht11/sht11.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 SHT11_H -#define SHT11_H - -void sht11_init(void); -void sht11_off(void); - -unsigned int sht11_temp(void); -unsigned int sht11_humidity(void); -unsigned int sht11_sreg(void); -int sht11_set_sreg(unsigned); - -/* - * Relative Humidity in percent (h in 12 bits resolution) - * RH = -4 + 0.0405*h - 2.8e-6*(h*h) - * - * Temperature in Celsius (t in 14 bits resolution at 3 Volts) - * T = -39.60 + 0.01*t - */ - -#endif /* SHT11_H */ diff --git a/arch/platform/cc2538dk/Makefile.cc2538dk b/arch/platform/cc2538dk/Makefile.cc2538dk deleted file mode 100644 index bdbc7598f..000000000 --- a/arch/platform/cc2538dk/Makefile.cc2538dk +++ /dev/null @@ -1,54 +0,0 @@ -# cc2538dk platform makefile - -ifndef CONTIKI - $(error CONTIKI not defined! You must specify where CONTIKI resides!) -endif - -CONTIKI_TARGET_DIRS = . dev - -CONTIKI_TARGET_SOURCEFILES += leds-arch.c -CONTIKI_TARGET_SOURCEFILES += platform.c -CONTIKI_TARGET_SOURCEFILES += sensors.c smartrf-sensors.c -CONTIKI_TARGET_SOURCEFILES += board-buttons.c als-sensor.c - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -### Define the CPU directory -CONTIKI_CPU=$(ARCH_PATH)/cpu/cc2538 -include $(CONTIKI_CPU)/Makefile.cc2538 - -MODULES += os/storage/cfs - -PYTHON = python -BSL_FLAGS += -e -w -v - -ifdef PORT - BSL_FLAGS += -p $(PORT) -endif - -BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py - -%.upload: $(OUT_BIN) $(OUT_ELF) -ifeq ($(wildcard $(BSL)), ) - @echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?" -else - $(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h \ - $(BUILD_DIR_BOARD)/$*.elf | grep -B1 LOAD | \ - grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \ - sort -g | head -1)) - $(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $< -endif - -ifeq ($(HOST_OS),Darwin) - RENODE = mono /Applications/Renode.app/Contents/MacOS/bin/Renode.exe -else - RENODE = renode -endif - -SCRIPT ?= $(notdir $(CURDIR)).resc - -.PHONY: renode - -renode: all - $(RENODE) $(SCRIPT) - diff --git a/arch/platform/cc2538dk/contiki-conf.h b/arch/platform/cc2538dk/contiki-conf.h deleted file mode 100644 index 649fde347..000000000 --- a/arch/platform/cc2538dk/contiki-conf.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538dk - * @{ - * - * \file - * Configuration for the cc2538dk platform - */ -#ifndef CONTIKI_CONF_H_ -#define CONTIKI_CONF_H_ - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Include Project Specific conf */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif /* PROJECT_CONF_PATH */ -/*---------------------------------------------------------------------------*/ -#include "cc2538-def.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Serial Boot Loader Backdoor configuration - * - * @{ - */ -#ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR -#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR 1 /** - * 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. - */ -/** - * \addtogroup cc2538dk-als-sensor - * @{ - * - * \file - * Driver for the SmartRF06EB ALS - */ -#include "contiki.h" -#include "sys/clock.h" -#include "dev/ioc.h" -#include "dev/gpio.h" -#include "dev/adc.h" -#include "dev/als-sensor.h" - -#include - -#define ADC_ALS_PWR_PORT_BASE GPIO_PORT_TO_BASE(ADC_ALS_PWR_PORT) -#define ADC_ALS_PWR_PIN_MASK GPIO_PIN_MASK(ADC_ALS_PWR_PIN) -#define ADC_ALS_OUT_PIN_MASK GPIO_PIN_MASK(ADC_ALS_OUT_PIN) -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - uint8_t channel = SOC_ADC_ADCCON_CH_AIN0 + ADC_ALS_OUT_PIN; - int16_t res; - - GPIO_SET_PIN(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK); - clock_delay_usec(2000); - - res = adc_get(channel, SOC_ADC_ADCCON_REF_INT, SOC_ADC_ADCCON_DIV_512); - - GPIO_CLR_PIN(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK); - - return res; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - GPIO_SOFTWARE_CONTROL(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK); - GPIO_SET_OUTPUT(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK); - GPIO_CLR_PIN(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK); - ioc_set_over(ADC_ALS_PWR_PORT, ADC_ALS_PWR_PIN, IOC_OVERRIDE_DIS); - - GPIO_SOFTWARE_CONTROL(GPIO_A_BASE, ADC_ALS_OUT_PIN_MASK); - GPIO_SET_INPUT(GPIO_A_BASE, ADC_ALS_OUT_PIN_MASK); - ioc_set_over(GPIO_A_NUM, ADC_ALS_OUT_PIN, IOC_OVERRIDE_ANA); - - break; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(als_sensor, ALS_SENSOR, value, configure, status); - -/** @} */ diff --git a/arch/platform/cc2538dk/dev/als-sensor.h b/arch/platform/cc2538dk/dev/als-sensor.h deleted file mode 100644 index abed92e13..000000000 --- a/arch/platform/cc2538dk/dev/als-sensor.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-smartrf-sensors - * @{ - * - * \defgroup cc2538dk-als-sensor cc2538dk ALS Driver - * - * Driver for the SmartRF06EB ALS sensor - * @{ - * - * \file - * Header file for the cc2538dk ALS Driver - */ -#ifndef ALS_SENSOR_H_ -#define ALS_SENSOR_H_ - -#include "lib/sensors.h" - -/*---------------------------------------------------------------------------*/ -/** \name ALS sensor - * @{ - */ -#define ALS_SENSOR "ALS" -/** @} */ - -extern const struct sensors_sensor als_sensor; - -#endif /* ALS_SENSOR_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/platform/cc2538dk/dev/board-buttons.c b/arch/platform/cc2538dk/dev/board-buttons.c deleted file mode 100644 index 6afc915df..000000000 --- a/arch/platform/cc2538dk/dev/board-buttons.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538-smartrf - * @{ - * - * \defgroup cc2538-smartrf-buttons SmartRF06EB Buttons - * - * Generic module controlling buttons on the SmartRF06EB - * @{ - * - * \file - * Defines SmartRF06EB buttons for use with the button HAL - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/button-hal.h" -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTON(key_left, "Key Left", \ - GPIO_PORT_PIN_TO_GPIO_HAL_PIN(BUTTON_LEFT_PORT, BUTTON_LEFT_PIN), \ - GPIO_HAL_PIN_CFG_PULL_UP, BUTTON_HAL_ID_BUTTON_ZERO, true); -BUTTON_HAL_BUTTON(key_right, "Key Right", \ - GPIO_PORT_PIN_TO_GPIO_HAL_PIN(BUTTON_RIGHT_PORT, BUTTON_RIGHT_PIN), \ - GPIO_HAL_PIN_CFG_PULL_UP, BUTTON_HAL_ID_BUTTON_ONE, true); -BUTTON_HAL_BUTTON(key_up, "Key Up", \ - GPIO_PORT_PIN_TO_GPIO_HAL_PIN(BUTTON_UP_PORT, BUTTON_UP_PIN), \ - GPIO_HAL_PIN_CFG_PULL_UP, BUTTON_HAL_ID_BUTTON_TWO, true); -BUTTON_HAL_BUTTON(key_down, "Key Down", \ - GPIO_PORT_PIN_TO_GPIO_HAL_PIN(BUTTON_DOWN_PORT, BUTTON_DOWN_PIN), \ - GPIO_HAL_PIN_CFG_PULL_UP, BUTTON_HAL_ID_BUTTON_THREE, true); -BUTTON_HAL_BUTTON(key_select, "Key Select", \ - GPIO_PORT_PIN_TO_GPIO_HAL_PIN(BUTTON_SELECT_PORT, BUTTON_SELECT_PIN), \ - GPIO_HAL_PIN_CFG_PULL_UP, BUTTON_HAL_ID_BUTTON_FOUR, true); -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTONS(&key_left, &key_right, &key_up, &key_down, &key_select); -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc2538dk/dev/board.h b/arch/platform/cc2538dk/dev/board.h deleted file mode 100644 index 2540b7ce7..000000000 --- a/arch/platform/cc2538dk/dev/board.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538dk - * @{ - * - * \defgroup cc2538-smartrf SmartRF06EB Peripherals - * - * Defines related to the SmartRF06EB - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other SmartRF peripherals - * - * Notably, PC0 is used to drive LED1 as well as the USB D+ pullup. Therefore - * when USB is enabled, LED1 can not be driven by firmware. - * - * This file can be used as the basis to configure other platforms using the - * cc2538 SoC. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the TI - * SmartRF06EB - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -#ifndef BOARD_H_ -#define BOARD_H_ - -#include "dev/gpio.h" -#include "dev/nvic.h" -/*---------------------------------------------------------------------------*/ -/** \name SmartRF LED configuration - * - * LEDs on the SmartRF06 (EB and BB) are connected as follows: - * - LED1 (Red) -> PC0 - * - LED2 (Yellow) -> PC1 - * - LED3 (Green) -> PC2 - * - LED4 (Orange) -> PC3 - * - * LED1 shares the same pin with the USB pullup - * @{ - */ -/*---------------------------------------------------------------------------*/ -#define LEDS_CONF_YELLOW 1 -#define LEDS_CONF_GREEN 2 -#define LEDS_CONF_ORANGE 4 - -#define LEDS_ARCH_L1_PORT GPIO_C_NUM -#define LEDS_ARCH_L1_PIN 1 -#define LEDS_ARCH_L2_PORT GPIO_C_NUM -#define LEDS_ARCH_L2_PIN 2 -#define LEDS_ARCH_L3_PORT GPIO_C_NUM -#define LEDS_ARCH_L3_PIN 3 - -#if USB_SERIAL_CONF_ENABLE -#define LEDS_CONF_COUNT 3 -#else -#define LEDS_ARCH_L4_PORT GPIO_C_NUM -#define LEDS_ARCH_L4_PIN 0 -#define LEDS_CONF_RED 8 -#define LEDS_CONF_COUNT 4 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name USB configuration - * - * The USB pullup is driven by PC0 and is shared with LED1 - */ -#define USB_PULLUP_PORT GPIO_C_NUM -#define USB_PULLUP_PIN 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART configuration - * - * On the SmartRF06EB, the UART (XDS back channel) is connected to the - * following ports/pins - * - RX: PA0 - * - TX: PA1 - * - CTS: PB0 (Can only be used with UART1) - * - RTS: PD3 (Can only be used with UART1) - * - * We configure the port to use UART0. To use UART1, replace UART0_* with - * UART1_* below. - * @{ - */ -#define UART0_RX_PORT GPIO_A_NUM -#define UART0_RX_PIN 0 - -#define UART0_TX_PORT GPIO_A_NUM -#define UART0_TX_PIN 1 - -#define UART1_CTS_PORT GPIO_B_NUM -#define UART1_CTS_PIN 0 - -#define UART1_RTS_PORT GPIO_D_NUM -#define UART1_RTS_PIN 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name SmartRF Button configuration - * - * Buttons on the SmartRF06 are connected as follows: - * - BUTTON_SELECT -> PA3 - * - BUTTON_LEFT -> PC4 - * - BUTTON_RIGHT -> PC5 - * - BUTTON_UP -> PC6 - * - BUTTON_DOWN -> PC7 - * @{ - */ -/** BUTTON_SELECT -> PA3 */ -#define BUTTON_SELECT_PORT GPIO_A_NUM -#define BUTTON_SELECT_PIN 3 -#define BUTTON_SELECT_VECTOR GPIO_A_IRQn - -/** BUTTON_LEFT -> PC4 */ -#define BUTTON_LEFT_PORT GPIO_C_NUM -#define BUTTON_LEFT_PIN 4 -#define BUTTON_LEFT_VECTOR GPIO_C_IRQn - -/** BUTTON_RIGHT -> PC5 */ -#define BUTTON_RIGHT_PORT GPIO_C_NUM -#define BUTTON_RIGHT_PIN 5 -#define BUTTON_RIGHT_VECTOR GPIO_C_IRQn - -/** BUTTON_UP -> PC6 */ -#define BUTTON_UP_PORT GPIO_C_NUM -#define BUTTON_UP_PIN 6 -#define BUTTON_UP_VECTOR GPIO_C_IRQn - -/** BUTTON_DOWN -> PC7 */ -#define BUTTON_DOWN_PORT GPIO_C_NUM -#define BUTTON_DOWN_PIN 7 -#define BUTTON_DOWN_VECTOR GPIO_C_IRQn - -/* Notify various examples that we have Buttons */ -#define PLATFORM_HAS_BUTTON 1 -#define PLATFORM_SUPPORTS_BUTTON_HAL 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ADC configuration - * - * These values configure which CC2538 pins and ADC channels to use for the ADC - * inputs. - * - * ADC inputs can only be on port A. - * @{ - */ -#define ADC_ALS_PWR_PORT GPIO_A_NUM /**< ALS power GPIO control port */ -#define ADC_ALS_PWR_PIN 7 /**< ALS power GPIO control pin */ -#define ADC_ALS_OUT_PIN 6 /**< ALS output ADC input pin on port A */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI configuration - * - * These values configure which CC2538 pins to use for the SPI lines. Both - * SPI instances can be used independently by providing the corresponding - * port / pin macros. - * @{ - */ -#define SPI0_IN_USE 0 -#define SPI1_IN_USE 0 -#if SPI0_IN_USE -/** Clock port SPI0 */ -#define SPI0_CLK_PORT GPIO_A_NUM -/** Clock pin SPI0 */ -#define SPI0_CLK_PIN 2 -/** TX port SPI0 (master mode: MOSI) */ -#define SPI0_TX_PORT GPIO_A_NUM -/** TX pin SPI0 */ -#define SPI0_TX_PIN 4 -/** RX port SPI0 (master mode: MISO */ -#define SPI0_RX_PORT GPIO_A_NUM -/** RX pin SPI0 */ -#define SPI0_RX_PIN 5 -#endif /* #if SPI0_IN_USE */ -#if SPI1_IN_USE -/** Clock port SPI1 */ -#define SPI1_CLK_PORT GPIO_A_NUM -/** Clock pin SPI1 */ -#define SPI1_CLK_PIN 2 -/** TX port SPI1 (master mode: MOSI) */ -#define SPI1_TX_PORT GPIO_A_NUM -/** TX pin SPI1 */ -#define SPI1_TX_PIN 4 -/** RX port SPI1 (master mode: MISO) */ -#define SPI1_RX_PORT GPIO_A_NUM -/** RX pin SPI1 */ -#define SPI1_RX_PIN 5 -#endif /* #if SPI1_IN_USE */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name CC2538 TSCH configuration - * - * @{ - */ -#define RADIO_PHY_OVERHEAD CC2538_PHY_OVERHEAD -#define RADIO_BYTE_AIR_TIME CC2538_BYTE_AIR_TIME -#define RADIO_DELAY_BEFORE_TX CC2538_DELAY_BEFORE_TX -#define RADIO_DELAY_BEFORE_RX CC2538_DELAY_BEFORE_RX -#define RADIO_DELAY_BEFORE_DETECT CC2538_DELAY_BEFORE_DETECT -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "TI SmartRF06 + cc2538EM" -/** @} */ - -#endif /* BOARD_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/platform/cc2538dk/dev/leds-arch.c b/arch/platform/cc2538dk/dev/leds-arch.c deleted file mode 100644 index 78441defc..000000000 --- a/arch/platform/cc2538dk/dev/leds-arch.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/leds.h" -#include "dev/gpio-hal.h" -#include "dev/gpio-hal-arch.h" - -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L1_PORT, LEDS_ARCH_L1_PIN), - .negative_logic = false - }, - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L2_PORT, LEDS_ARCH_L2_PIN), - .negative_logic = false - }, - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L3_PORT, LEDS_ARCH_L3_PIN), - .negative_logic = false - }, -#if !USB_SERIAL_CONF_ENABLE - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L4_PORT, LEDS_ARCH_L4_PIN), - .negative_logic = false - }, -#endif -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/cc2538dk/dev/smartrf-sensors.c b/arch/platform/cc2538dk/dev/smartrf-sensors.c deleted file mode 100644 index 1b833e764..000000000 --- a/arch/platform/cc2538dk/dev/smartrf-sensors.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-smartrf - * @{ - * - * \defgroup cc2538-smartrf-sensors SmartRF06EB Sensors - * - * Generic module controlling sensors on the SmartRF06EB - * @{ - * - * \file - * Implementation of a generic module controlling SmartRF06EB sensors - */ -#include "contiki.h" -#include "dev/als-sensor.h" -#include "dev/cc2538-sensors.h" - -#include - -/** \brief Exports a global symbol to be used by the sensor API */ -SENSORS(&als_sensor, &cc2538_temp_sensor, &vdd3_sensor); - -/** - * @} - * @} - */ diff --git a/arch/platform/cc2538dk/platform.c b/arch/platform/cc2538dk/platform.c deleted file mode 100644 index 2a3ca21ed..000000000 --- a/arch/platform/cc2538dk/platform.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-platforms - * @{ - * - * \defgroup cc2538dk The cc2538 Development Kit platform - * - * The cc2538DK is a platform by Texas Instruments, based on the - * cc2538 SoC with an ARM Cortex-M3 core. - * @{ - * - * \file - * Main module for the cc2538dk platform - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/adc.h" -#include "dev/leds.h" -#include "dev/uart.h" -#include "dev/serial-line.h" -#include "dev/slip.h" -#include "dev/cc2538-rf.h" -#include "dev/udma.h" -#include "dev/crypto.h" -#include "dev/button-hal.h" -#include "usb/usb-serial.h" -#include "lib/random.h" -#include "lib/sensors.h" -#include "net/netstack.h" -#include "net/mac/framer/frame802154.h" -#include "net/linkaddr.h" -#include "sys/platform.h" -#include "soc.h" -#include "cpu.h" -#include "reg.h" -#include "ieee-addr.h" -#include "lpm.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "CC2538DK" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -static void -fade(leds_mask_t l) -{ - volatile int i; - int k, j; - for(k = 0; k < 800; ++k) { - j = k > 400 ? 800 - k : k; - - leds_on(l); - for(i = 0; i < j; ++i) { - __asm("nop"); - } - leds_off(l); - for(i = 0; i < 400 - j; ++i) { - __asm("nop"); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -set_rf_params(void) -{ - uint16_t short_addr; - uint8_t ext_addr[8]; - - ieee_addr_cpy_to(ext_addr, 8); - - short_addr = ext_addr[7]; - short_addr |= ext_addr[6] << 8; - - NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID); - NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr); - NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, IEEE802154_DEFAULT_CHANNEL); - NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one(void) -{ - soc_init(); - - leds_init(); - fade(LEDS_YELLOW); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two() -{ - /* - * Character I/O Initialisation. - * When the UART receives a character it will call serial_line_input_byte to - * notify the core. The same applies for the USB driver. - * - * If slip-arch is also linked in afterwards (e.g. if we are a border router) - * it will overwrite one of the two peripheral input callbacks. Characters - * received over the relevant peripheral will be handled by - * slip_input_byte instead - */ -#if UART_CONF_ENABLE - uart_init(0); - uart_init(1); - uart_set_input(SERIAL_LINE_CONF_UART, serial_line_input_byte); -#endif - -#if USB_SERIAL_CONF_ENABLE - usb_serial_init(); - usb_serial_set_input(serial_line_input_byte); -#endif - - serial_line_init(); - - /* Initialise the H/W RNG engine. */ - random_init(0); - - udma_init(); - -#if CRYPTO_CONF_INIT - crypto_init(); - crypto_disable(); -#endif - - /* Populate linkaddr_node_addr */ - ieee_addr_cpy_to(linkaddr_node_addr.u8, LINKADDR_SIZE); - - button_hal_init(); - - INTERRUPTS_ENABLE(); - - fade(LEDS_GREEN); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three() -{ - LOG_INFO("%s\n", BOARD_STRING); - - set_rf_params(); - - soc_print_info(); - - adc_init(); - - process_start(&sensors_process, NULL); - - fade(LEDS_ORANGE); -} -/*---------------------------------------------------------------------------*/ -void -platform_idle() -{ - /* We have serviced all pending events. Enter a Low-Power mode. */ - lpm_enter(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 b/arch/platform/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 deleted file mode 100644 index 622445dd4..000000000 --- a/arch/platform/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 +++ /dev/null @@ -1,29 +0,0 @@ -# cc26x0-cc13x0 platform makefile - -ifndef CONTIKI - $(error CONTIKI not defined! You must specify where CONTIKI resides!) -endif - -### Board and BSP selection -BOARD ?= srf06/cc26x0 -BOARDS = srf06/cc26x0 srf06/cc13x0 launchpad/cc2640r2 launchpad/cc2650 launchpad/cc1310 launchpad/cc1350 sensortag/cc2650 sensortag/cc1350 - -CONTIKI_TARGET_DIRS += . - -### Include the board-specific makefile -PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET) --include $(PLATFORM_ROOT_DIR)/$(BOARD)/Makefile.$(notdir $(BOARD)) - -CONTIKI_TARGET_SOURCEFILES += platform.c leds-arch.c -CONTIKI_TARGET_SOURCEFILES += $(BOARD_SOURCEFILES) - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -### Unless the example dictates otherwise, build without code size optimisations -SMALL ?= 0 - -### Define the CPU directory and pull in the correct CPU makefile. This will -### be defined by one of the makefiles included above and it can be either -### Makefile.cc26xx or Makefile.cc13xx -CONTIKI_CPU=$(ARCH_PATH)/cpu/cc26x0-cc13x0 -include $(CONTIKI_CPU)/Makefile.$(CPU_FAMILY) diff --git a/arch/platform/cc26x0-cc13x0/cfs-coffee-arch.h b/arch/platform/cc26x0-cc13x0/cfs-coffee-arch.h deleted file mode 100644 index 6816ca043..000000000 --- a/arch/platform/cc26x0-cc13x0/cfs-coffee-arch.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Coffee architecture-dependent header for the srf06-cc2650 sensortag platform. - * \author - * Dongda Lee - */ - -#ifndef CFS_COFFEE_ARCH_H -#define CFS_COFFEE_ARCH_H - -#include "contiki-conf.h" -#include "dev/xmem.h" - -/* - * MX25R8035F Memory Organization - * The memory is organized as: - * 8Mbit = 1048576 bytes (8 bits each) - * 256 sectors (32 Kbits, 4096 bytes each) - * 4096 pages (256 bytes each). - * Each page can be individually programmed (bits are programmed from 1 to 0). - * The device is sector or bulk erasable (bits are erased from 0 to 1) but not - * page erasable - */ -#define COFFEE_XMEM_TOTAL_SIZE_KB 1024UL /* Total size of the External Flash Memory in the Z1 */ - -/* Coffee configuration parameters. */ -#define COFFEE_SECTOR_SIZE 4096UL -#define COFFEE_PAGE_SIZE 256UL -#define COFFEE_START 0UL /* COFFEE_SECTOR_SIZE */ -#define COFFEE_SIZE (COFFEE_XMEM_TOTAL_SIZE_KB * 1024UL - COFFEE_START) -#define COFFEE_NAME_LENGTH 16 -#define COFFEE_MAX_OPEN_FILES 6 -#define COFFEE_FD_SET_SIZE 8 -#define COFFEE_LOG_TABLE_LIMIT 256 -#define COFFEE_DYN_SIZE 2 * 1024 -#define COFFEE_LOG_SIZE 1024 - -#define COFFEE_MICRO_LOGS 1 - -/* Flash operations. */ -#define COFFEE_WRITE(buf, size, offset) \ - xmem_pwrite((char *)(buf), (size), COFFEE_START + (offset)) - -#define COFFEE_READ(buf, size, offset) \ - xmem_pread((char *)(buf), (size), COFFEE_START + (offset)) - -#define COFFEE_ERASE(sector) \ - xmem_erase(COFFEE_SECTOR_SIZE, COFFEE_START + (sector) * COFFEE_SECTOR_SIZE) - -/* Coffee types. */ -typedef int16_t coffee_page_t; - -#endif /* !COFFEE_ARCH_H */ diff --git a/arch/platform/cc26x0-cc13x0/common/xmem.c b/arch/platform/cc26x0-cc13x0/common/xmem.c deleted file mode 100644 index 9228e0fbb..000000000 --- a/arch/platform/cc26x0-cc13x0/common/xmem.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Device driver for the MX25R8035F 1Mbyte external memory. - * \author - * Dongda Lee - * - * Data is written bit inverted (~-operator) to flash so that - * unwritten data will read as zeros (UNIX style). - */ - -#include "contiki.h" -#include "ext-flash.h" -#include "dev/xmem.h" -#include "dev/watchdog.h" -#include "cfs-coffee-arch.h" -#include /* For PRINTF() */ - -#define EXT_ERASE_UNIT_SIZE 4096UL - -#define XMEM_BUFF_LENGHT 128 - -#if 0 -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) do {} while(0) -#endif - -void -xmem_init(void) -{ - ext_flash_open(NULL); -} -int -xmem_pread(void *_p, int size, unsigned long addr) -{ - int rv; - uint8_t x; - int i; - - rv = ext_flash_open(NULL); - - if(!rv) { - PRINTF("Could not open flash to save config\n"); - ext_flash_close(NULL); - return -1; - } - - rv = ext_flash_read(NULL, addr, size, _p); - for(i = 0; i < size; i++) { - x = ~*((uint8_t *)_p + i); - *((uint8_t *)_p + i) = x; - } - - ext_flash_close(NULL); - - if(rv) { - return size; - } - - PRINTF("Could not read flash memory!\n"); - return -1; -} -int -xmem_pwrite(const void *_buf, int size, unsigned long addr) -{ - int rv; - int i, j; - int remain; - - uint8_t tmp_buf[XMEM_BUFF_LENGHT]; - - rv = ext_flash_open(NULL); - - if(!rv) { - PRINTF("Could not open flash to save config!\n"); - ext_flash_close(NULL); - return -1; - } - - for(remain = size, j = 0; remain > 0; remain -= XMEM_BUFF_LENGHT, j += XMEM_BUFF_LENGHT) { - int to_write = MIN(XMEM_BUFF_LENGHT, remain); - for(i = 0; i < to_write; i++) { - tmp_buf[i] = ~*((uint8_t *)_buf + j + i); - } - rv = ext_flash_write(NULL, addr + j, to_write, tmp_buf); - if(!rv) { - PRINTF("Could not write flash memory!\n"); - return size - remain; - } - } - - ext_flash_close(NULL); - - return size; -} -int -xmem_erase(long size, unsigned long addr) -{ - int rv; - - rv = ext_flash_open(NULL); - - if(!rv) { - PRINTF("Could not open flash to save config\n"); - ext_flash_close(NULL); - return -1; - } - - if(size % EXT_ERASE_UNIT_SIZE != 0) { - PRINTF("xmem_erase: bad size\n"); - return -1; - } - - if(addr % EXT_ERASE_UNIT_SIZE != 0) { - PRINTF("xmem_erase: bad offset\n"); - return -1; - } - - rv = ext_flash_erase(NULL, addr, size); - - ext_flash_close(NULL); - - watchdog_periodic(); - - if(rv) { - return size; - } - - PRINTF("Could not erase flash memory\n"); - return -1; -} diff --git a/arch/platform/cc26x0-cc13x0/contiki-conf.h b/arch/platform/cc26x0-cc13x0/contiki-conf.h deleted file mode 100644 index de61c102c..000000000 --- a/arch/platform/cc26x0-cc13x0/contiki-conf.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26xx-srf-tag - * @{ - * - * \file - * Configuration for the cc26x0-cc13x0 platform - */ -#ifndef CONTIKI_CONF_H -#define CONTIKI_CONF_H - -#include -#include -/*---------------------------------------------------------------------------*/ -/* Include Project Specific conf */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif /* PROJECT_CONF_PATH */ -/*---------------------------------------------------------------------------*/ -#include "cc13xx-cc26xx-def.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Button configurations - * - * @{ - */ - -/* Notify various examples that we have Buttons */ -#define PLATFORM_HAS_BUTTON 1 -#define PLATFORM_SUPPORTS_BUTTON_HAL 1 - -/** @} */ -/*---------------------------------------------------------------------------*/ -/* Platform-specific define to signify sensor reading failure */ -#define CC26XX_SENSOR_READING_ERROR 0x80000000 -/*---------------------------------------------------------------------------*/ -/* Include CPU-related configuration */ -#include "cc13xx-cc26xx-conf.h" -/*---------------------------------------------------------------------------*/ -/* board.h assumes that basic configuration is done */ -#include "board.h" -/*---------------------------------------------------------------------------*/ -#endif /* CONTIKI_CONF_H */ - -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/launchpad/Makefile.launchpad b/arch/platform/cc26x0-cc13x0/launchpad/Makefile.launchpad deleted file mode 100644 index 09af79c0b..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/Makefile.launchpad +++ /dev/null @@ -1,10 +0,0 @@ -CFLAGS += -DBOARD_LAUNCHPAD=1 - -CONTIKI_TARGET_DIRS += launchpad common - -BOARD_SOURCEFILES += board.c board-buttons.c xmem.c - -MODULES += arch/dev/ext-flash - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL=1 diff --git a/arch/platform/cc26x0-cc13x0/launchpad/board-buttons.c b/arch/platform/cc26x0-cc13x0/launchpad/board-buttons.c deleted file mode 100644 index f07fff09e..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/board-buttons.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup launchpad-cc26xx-peripherals - * @{ - * - * \file - * Defines CC13xx/CC26xx Launchpad buttons for use with the button HAL - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/button-hal.h" - -#include "ti-lib.h" -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTON(key_left, "Key Left", BOARD_IOID_KEY_LEFT, \ - GPIO_HAL_PIN_CFG_PULL_UP, BOARD_BUTTON_HAL_INDEX_KEY_LEFT, \ - true); - -BUTTON_HAL_BUTTON(key_right, "Key Right", BOARD_IOID_KEY_RIGHT, \ - GPIO_HAL_PIN_CFG_PULL_UP, BOARD_BUTTON_HAL_INDEX_KEY_RIGHT, \ - true); -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTONS(&key_left, &key_right); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/launchpad/board-peripherals.h b/arch/platform/cc26x0-cc13x0/launchpad/board-peripherals.h deleted file mode 100644 index 0ad9c6b68..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/board-peripherals.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup cc26xx-srf-tag - * @{ - * - * \defgroup launchpad-peripherals LaunchPad peripherals - * - * Defines related to LaunchPad peripherals. - * - * @{ - * - * \file - * Header file with definitions related to LaunchPad peripherals - * - * \note Do not include this file directly. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_PERIPHERALS_H_ -#define BOARD_PERIPHERALS_H_ -/*---------------------------------------------------------------------------*/ -#include "ext-flash.h" -/*---------------------------------------------------------------------------*/ -#define BOARD_CONF_HAS_SENSORS 0 -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_PERIPHERALS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/launchpad/board.c b/arch/platform/cc26x0-cc13x0/launchpad/board.c deleted file mode 100644 index cda0a7c6c..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/board.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * LaunchPad-specific board initialisation driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lpm.h" -#include "ti-lib.h" -#include "board-peripherals.h" -#include "rf-core/rf-switch.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -static void -wakeup_handler(void) -{ - /* Turn on the PERIPH PD */ - ti_lib_prcm_power_domain_on(PRCM_DOMAIN_PERIPH); - while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) - != PRCM_DOMAIN_POWER_ON); -} -/*---------------------------------------------------------------------------*/ -/* - * Declare a data structure to register with LPM. - * We don't care about what power mode we'll drop to, we don't care about - * getting notified before deep sleep. All we need is to be notified when we - * wake up so we can turn power domains back on - */ -LPM_MODULE(launchpad_module, NULL, NULL, wakeup_handler, LPM_DOMAIN_NONE); -/*---------------------------------------------------------------------------*/ -static void -configure_unused_pins(void) -{ - uint32_t pins[] = BOARD_UNUSED_PINS; - - uint32_t *pin; - - for(pin = pins; *pin != IOID_UNUSED; pin++) { - ti_lib_ioc_pin_type_gpio_input(*pin); - ti_lib_ioc_io_port_pull_set(*pin, IOC_IOPULL_DOWN); - } -} -/*---------------------------------------------------------------------------*/ -void -board_init() -{ - /* Disable global interrupts */ - bool int_disabled = ti_lib_int_master_disable(); - - /* Turn on relevant PDs */ - wakeup_handler(); - - /* Enable GPIO peripheral */ - ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_GPIO); - - /* Apply settings and wait for them to take effect */ - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - /* Make sure the external flash is in the lower power mode */ - ext_flash_init(NULL); - - lpm_register_module(&launchpad_module); - - /* For unsupported peripherals, select a default pin configuration */ - configure_unused_pins(); - - /* Initialise the RF switch if present */ - rf_switch_init(); - - /* Re-enable interrupt if initially enabled. */ - if(!int_disabled) { - ti_lib_int_master_enable(); - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/launchpad/cc1310/Makefile.cc1310 b/arch/platform/cc26x0-cc13x0/launchpad/cc1310/Makefile.cc1310 deleted file mode 100644 index e9f7bab91..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/cc1310/Makefile.cc1310 +++ /dev/null @@ -1,8 +0,0 @@ -### Will allow the inclusion of the correct CPU makefile -CPU_FAMILY = cc13x0 - -### Add to the source dirs -CONTIKI_TARGET_DIRS += launchpad/cc1310 - -### Include the common launchpad makefile -include $(PLATFORM_ROOT_DIR)/launchpad/Makefile.launchpad diff --git a/arch/platform/cc26x0-cc13x0/launchpad/cc1310/board.h b/arch/platform/cc26x0-cc13x0/launchpad/cc1310/board.h deleted file mode 100644 index 43a330e28..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/cc1310/board.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup launchpad-peripherals - * @{ - * - * \defgroup launchpad-cc1310-specific CC1310 LaunchPad Peripherals - * - * Defines related to the CC1310 LaunchPad - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * This file is not meant to be modified by the user. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the TI - * CC1310 LaunchPad - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_H_ -#define BOARD_H_ -/*---------------------------------------------------------------------------*/ -#include "ioc.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED HAL configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#define LEDS_CONF_COUNT 2 -#define LEDS_CONF_RED 1 -#define LEDS_CONF_GREEN 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LED IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_LED_1 IOID_6 -#define BOARD_IOID_LED_2 IOID_7 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UART IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_UART_RX IOID_2 -#define BOARD_IOID_UART_TX IOID_3 -#define BOARD_IOID_UART_RTS IOID_18 -#define BOARD_IOID_UART_CTS IOID_19 -#define BOARD_UART_RX (1 << BOARD_IOID_UART_RX) -#define BOARD_UART_TX (1 << BOARD_IOID_UART_TX) -#define BOARD_UART_RTS (1 << BOARD_IOID_UART_RTS) -#define BOARD_UART_CTS (1 << BOARD_IOID_UART_CTS) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_KEY_LEFT IOID_13 -#define BOARD_IOID_KEY_RIGHT IOID_14 -#define BOARD_KEY_LEFT (1 << BOARD_IOID_KEY_LEFT) -#define BOARD_KEY_RIGHT (1 << BOARD_IOID_KEY_RIGHT) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name External flash IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 - -#define EXT_FLASH_SPI_PIN_SCK IOID_10 -#define EXT_FLASH_SPI_PIN_MOSI IOID_9 -#define EXT_FLASH_SPI_PIN_MISO IOID_8 -#define EXT_FLASH_SPI_PIN_CS IOID_20 - -#define EXT_FLASH_DEVICE_ID 0x14 -#define EXT_FLASH_MID 0xC2 - -#define EXT_FLASH_PROGRAM_PAGE_SIZE 256 -#define EXT_FLASH_ERASE_SECTOR_SIZE 4096 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief I2C IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_SCL IOID_4 -#define BOARD_IOID_SDA IOID_5 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief ROM bootloader configuration - * - * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which - * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to - * control the pin level that enables the bootloader (0: low, 1: high). It is - * also possible to use any other externally-controlled DIO. - * @{ - */ -#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT -#define CCXXWARE_CONF_BL_LEVEL 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Remaining pins - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_DIO1 IOID_1 -#define BOARD_IOID_CS IOID_11 -#define BOARD_IOID_TDO IOID_16 -#define BOARD_IOID_TDI IOID_17 -#define BOARD_IOID_DIO12 IOID_12 -#define BOARD_IOID_DIO15 IOID_15 -#define BOARD_IOID_DIO21 IOID_21 -#define BOARD_IOID_DIO22 IOID_22 -#define BOARD_IOID_DIO23 IOID_23 -#define BOARD_IOID_DIO24 IOID_24 -#define BOARD_IOID_DIO25 IOID_25 -#define BOARD_IOID_DIO26 IOID_26 -#define BOARD_IOID_DIO27 IOID_27 -#define BOARD_IOID_DIO28 IOID_28 -#define BOARD_IOID_DIO29 IOID_29 -#define BOARD_IOID_DIO30 IOID_30 - -#define BOARD_UNUSED_PINS { \ - BOARD_IOID_DIO1, BOARD_IOID_CS, BOARD_IOID_TDO, BOARD_IOID_TDI, \ - BOARD_IOID_DIO12, BOARD_IOID_DIO15, BOARD_IOID_DIO21, BOARD_IOID_DIO22, \ - BOARD_IOID_DIO23, BOARD_IOID_DIO24, BOARD_IOID_DIO25, BOARD_IOID_DIO26, \ - BOARD_IOID_DIO27, BOARD_IOID_DIO28, BOARD_IOID_DIO29, BOARD_IOID_DIO30, \ - IOID_UNUSED \ - } -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board indices for the button HAL - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_BUTTON_HAL_INDEX_KEY_LEFT 0x00 -#define BOARD_BUTTON_HAL_INDEX_KEY_RIGHT 0x01 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "TI CC1310 LaunchPad" - -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/launchpad/cc1350/Makefile.cc1350 b/arch/platform/cc26x0-cc13x0/launchpad/cc1350/Makefile.cc1350 deleted file mode 100644 index 811a3f61b..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/cc1350/Makefile.cc1350 +++ /dev/null @@ -1,10 +0,0 @@ -### Will allow the inclusion of the correct CPU makefile -CPU_FAMILY = cc13x0 - -### Add to the source dirs -CONTIKI_TARGET_DIRS += launchpad/cc1350 - -BOARD_SOURCEFILES += rf-switch.c tx-power-driver.c - -### Include the common launchpad makefile -include $(PLATFORM_ROOT_DIR)/launchpad/Makefile.launchpad diff --git a/arch/platform/cc26x0-cc13x0/launchpad/cc1350/board.h b/arch/platform/cc26x0-cc13x0/launchpad/cc1350/board.h deleted file mode 100644 index 5f6239531..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/cc1350/board.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup launchpad-peripherals - * @{ - * - * \defgroup launchpad-cc1350-specific CC1350 LaunchPad Peripherals - * - * Defines related to the CC1350 LaunchPad - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * This file is not meant to be modified by the user. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the TI - * CC1350 LaunchPad - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_H_ -#define BOARD_H_ -/*---------------------------------------------------------------------------*/ -#include "ioc.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED HAL configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#define LEDS_CONF_COUNT 2 -#define LEDS_CONF_RED 1 -#define LEDS_CONF_GREEN 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LED IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_LED_1 IOID_6 -#define BOARD_IOID_LED_2 IOID_7 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UART IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_UART_RX IOID_2 -#define BOARD_IOID_UART_TX IOID_3 -#define BOARD_IOID_UART_RTS IOID_18 -#define BOARD_IOID_UART_CTS IOID_19 -#define BOARD_UART_RX (1 << BOARD_IOID_UART_RX) -#define BOARD_UART_TX (1 << BOARD_IOID_UART_TX) -#define BOARD_UART_RTS (1 << BOARD_IOID_UART_RTS) -#define BOARD_UART_CTS (1 << BOARD_IOID_UART_CTS) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_KEY_LEFT IOID_13 -#define BOARD_IOID_KEY_RIGHT IOID_14 -#define BOARD_KEY_LEFT (1 << BOARD_IOID_KEY_LEFT) -#define BOARD_KEY_RIGHT (1 << BOARD_IOID_KEY_RIGHT) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name External flash IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 - -#define EXT_FLASH_SPI_PIN_SCK IOID_10 -#define EXT_FLASH_SPI_PIN_MOSI IOID_9 -#define EXT_FLASH_SPI_PIN_MISO IOID_8 -#define EXT_FLASH_SPI_PIN_CS IOID_20 - -#define EXT_FLASH_DEVICE_ID 0x14 -#define EXT_FLASH_MID 0xC2 - -#define EXT_FLASH_PROGRAM_PAGE_SIZE 256 -#define EXT_FLASH_ERASE_SECTOR_SIZE 4096 -/*---------------------------------------------------------------------------*/ -/** - * \brief I2C IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_SCL IOID_4 -#define BOARD_IOID_SDA IOID_5 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief CC1350LP RF Switch - * - * Those values are not meant to be modified by the user - * @{ - */ -#define RF_SWITCH_CONF_ENABLE 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief TX power settings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define PROP_MODE_CONF_TX_POWER_779_930 tx_power_driver_779_930 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief ROM bootloader configuration - * - * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which - * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to - * control the pin level that enables the bootloader (0: low, 1: high). It is - * also possible to use any other externally-controlled DIO. - * @{ - */ -#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT -#define CCXXWARE_CONF_BL_LEVEL 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Remaining pins - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_CS IOID_11 -#define BOARD_IOID_TDO IOID_16 -#define BOARD_IOID_TDI IOID_17 -#define BOARD_IOID_DIO12 IOID_12 -#define BOARD_IOID_DIO15 IOID_15 -#define BOARD_IOID_DIO21 IOID_21 -#define BOARD_IOID_DIO22 IOID_22 -#define BOARD_IOID_DIO23 IOID_23 -#define BOARD_IOID_DIO24 IOID_24 -#define BOARD_IOID_DIO25 IOID_25 -#define BOARD_IOID_DIO26 IOID_26 -#define BOARD_IOID_DIO27 IOID_27 -#define BOARD_IOID_DIO28 IOID_28 -#define BOARD_IOID_DIO29 IOID_29 -#define BOARD_IOID_DIO30 IOID_30 - -#define BOARD_UNUSED_PINS { \ - BOARD_IOID_CS, BOARD_IOID_TDO, BOARD_IOID_TDI, BOARD_IOID_DIO12, \ - BOARD_IOID_DIO15, BOARD_IOID_DIO21, BOARD_IOID_DIO22, BOARD_IOID_DIO23, \ - BOARD_IOID_DIO24, BOARD_IOID_DIO25, BOARD_IOID_DIO26, BOARD_IOID_DIO27, \ - BOARD_IOID_DIO28, BOARD_IOID_DIO29, \ - IOID_UNUSED \ - } -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board indices for the button HAL - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_BUTTON_HAL_INDEX_KEY_LEFT 0x00 -#define BOARD_BUTTON_HAL_INDEX_KEY_RIGHT 0x01 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "TI CC1350 LaunchPad" -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/launchpad/cc1350/rf-switch.c b/arch/platform/cc26x0-cc13x0/launchpad/cc1350/rf-switch.c deleted file mode 100644 index 639b246cc..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/cc1350/rf-switch.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rf-switch - * @{ - * - * \file - * CC1350 LP RF switch driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lpm.h" -#include "rf-core/rf-switch.h" -#include "ti-lib.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define POWER_PIN IOID_30 -#define SELECT_PIN IOID_1 -/*---------------------------------------------------------------------------*/ -static void -shutdown_handler(uint8_t mode) -{ - ti_lib_gpio_clear_dio(POWER_PIN); -} -/*---------------------------------------------------------------------------*/ -/* - * Declare a data structure to register with LPM. Always turn off the switch - * when we are dropping to deep sleep. We let the RF driver turn it on though. - */ -LPM_MODULE(rf_switch_module, NULL, shutdown_handler, NULL, LPM_DOMAIN_NONE); -/*---------------------------------------------------------------------------*/ -void -rf_switch_init() -{ - ti_lib_ioc_pin_type_gpio_output(POWER_PIN); - ti_lib_gpio_clear_dio(POWER_PIN); - ti_lib_ioc_pin_type_gpio_output(SELECT_PIN); - ti_lib_gpio_clear_dio(SELECT_PIN); - - lpm_register_module(&rf_switch_module); -} -/*---------------------------------------------------------------------------*/ -void -rf_switch_power_up() -{ - ti_lib_gpio_set_dio(POWER_PIN); -} -/*---------------------------------------------------------------------------*/ -void -rf_switch_power_down() -{ - ti_lib_gpio_clear_dio(POWER_PIN); -} -/*---------------------------------------------------------------------------*/ -void -rf_switch_select_path(uint8_t path) -{ - ti_lib_gpio_write_dio(SELECT_PIN, path); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/launchpad/cc1350/tx-power-driver.c b/arch/platform/cc26x0-cc13x0/launchpad/cc1350/tx-power-driver.c deleted file mode 100644 index 6ff9d6be3..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/cc1350/tx-power-driver.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup rf-core-prop - * @{ - * - * \file - * TX power settings for the CC1350 LP - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/radio.h" -#include "rf-core/prop-mode.h" -/*---------------------------------------------------------------------------*/ -/* TX power settings for the 779-930MHz band */ -const prop_mode_tx_power_config_t tx_power_driver_779_930[] = { - { 14, 0xab3f }, - { 12, 0xbc2b }, - { 11, 0x90e5 }, - { 10, 0x58d8 }, - { 9, 0x40d2 }, - { 8, 0x32ce }, - { 7, 0x2acb }, - { 6, 0x24c9 }, - { 5, 0x20c8 }, - { 4, 0x1844 }, - { 3, 0x1cc6 }, - { 2, 0x18c5 }, - { 1, 0x16c4 }, - { 0, 0x12c3 }, - { -10, 0x04c0 }, - {-128, 0xFFFF }, -}; -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/launchpad/cc2640r2/Makefile.cc2640r2 b/arch/platform/cc26x0-cc13x0/launchpad/cc2640r2/Makefile.cc2640r2 deleted file mode 100644 index 5abb37a97..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/cc2640r2/Makefile.cc2640r2 +++ /dev/null @@ -1,8 +0,0 @@ -### Will allow the inclusion of the correct CPU makefile -CPU_FAMILY = cc26x0r2f - -### Add to the source dirs -CONTIKI_TARGET_DIRS += launchpad/cc2640r2 - -### Include the common launchpad makefile -include $(PLATFORM_ROOT_DIR)/launchpad/Makefile.launchpad diff --git a/arch/platform/cc26x0-cc13x0/launchpad/cc2640r2/board.h b/arch/platform/cc26x0-cc13x0/launchpad/cc2640r2/board.h deleted file mode 100644 index 1bf42ec18..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/cc2640r2/board.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup launchpad-peripherals - * @{ - * - * \defgroup launchpad-cc2640r2-specific CC2640R2 LaunchPad Peripherals - * - * Defines related to the CC2640R2 LaunchPad - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * This file is not meant to be modified by the user. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the TI - * CC2640R2 LaunchPad - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_H_ -#define BOARD_H_ -/*---------------------------------------------------------------------------*/ -#include "ioc.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED HAL configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#define LEDS_CONF_COUNT 2 -#define LEDS_CONF_RED 1 -#define LEDS_CONF_GREEN 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LED IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_LED_1 IOID_6 -#define BOARD_IOID_LED_2 IOID_7 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UART IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_UART_RX IOID_2 -#define BOARD_IOID_UART_TX IOID_3 -#define BOARD_IOID_UART_RTS IOID_18 -#define BOARD_IOID_UART_CTS IOID_19 -#define BOARD_UART_RX (1 << BOARD_IOID_UART_RX) -#define BOARD_UART_TX (1 << BOARD_IOID_UART_TX) -#define BOARD_UART_RTS (1 << BOARD_IOID_UART_RTS) -#define BOARD_UART_CTS (1 << BOARD_IOID_UART_CTS) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_KEY_LEFT IOID_13 -#define BOARD_IOID_KEY_RIGHT IOID_14 -#define BOARD_KEY_LEFT (1 << BOARD_IOID_KEY_LEFT) -#define BOARD_KEY_RIGHT (1 << BOARD_IOID_KEY_RIGHT) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name External flash IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 - -#define EXT_FLASH_SPI_PIN_SCK IOID_10 -#define EXT_FLASH_SPI_PIN_MOSI IOID_9 -#define EXT_FLASH_SPI_PIN_MISO IOID_8 -#define EXT_FLASH_SPI_PIN_CS IOID_20 - -#define EXT_FLASH_DEVICE_ID 0x14 -#define EXT_FLASH_MID 0xC2 - -#define EXT_FLASH_PROGRAM_PAGE_SIZE 256 -#define EXT_FLASH_ERASE_SECTOR_SIZE 4096 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief I2C IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_SCL IOID_4 -#define BOARD_IOID_SDA IOID_5 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief ROM bootloader configuration - * - * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which - * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to - * control the pin level that enables the bootloader (0: low, 1: high). It is - * also possible to use any other externally-controlled DIO. - * @{ - */ -#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT -#define CCXXWARE_CONF_BL_LEVEL 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Remaining pins - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_DIO0 IOID_0 -#define BOARD_IOID_DIO1 IOID_1 -#define BOARD_IOID_CS IOID_11 -#define BOARD_IOID_TDO IOID_16 -#define BOARD_IOID_TDI IOID_17 -#define BOARD_IOID_DIO12 IOID_12 -#define BOARD_IOID_DIO15 IOID_15 -#define BOARD_IOID_DIO21 IOID_21 -#define BOARD_IOID_DIO22 IOID_22 -#define BOARD_IOID_DIO23 IOID_23 -#define BOARD_IOID_DIO24 IOID_24 -#define BOARD_IOID_DIO25 IOID_25 -#define BOARD_IOID_DIO26 IOID_26 -#define BOARD_IOID_DIO27 IOID_27 -#define BOARD_IOID_DIO28 IOID_28 -#define BOARD_IOID_DIO29 IOID_29 -#define BOARD_IOID_DIO30 IOID_30 - -#define BOARD_UNUSED_PINS { \ - BOARD_IOID_DIO0, BOARD_IOID_DIO1, BOARD_IOID_CS, BOARD_IOID_TDO, \ - BOARD_IOID_TDI, BOARD_IOID_DIO12, BOARD_IOID_DIO15, BOARD_IOID_DIO21, \ - BOARD_IOID_DIO22, BOARD_IOID_DIO23, BOARD_IOID_DIO24, BOARD_IOID_DIO25, \ - BOARD_IOID_DIO26, BOARD_IOID_DIO27, BOARD_IOID_DIO28, BOARD_IOID_DIO29, \ - BOARD_IOID_DIO30, IOID_UNUSED \ - } -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board indices for the button HAL - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_BUTTON_HAL_INDEX_KEY_LEFT 0x00 -#define BOARD_BUTTON_HAL_INDEX_KEY_RIGHT 0x01 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "LAUNCHXL-CC2640R2" - -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/launchpad/cc2650/Makefile.cc2650 b/arch/platform/cc26x0-cc13x0/launchpad/cc2650/Makefile.cc2650 deleted file mode 100644 index 399cd79e5..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/cc2650/Makefile.cc2650 +++ /dev/null @@ -1,8 +0,0 @@ -### Will allow the inclusion of the correct CPU makefile -CPU_FAMILY = cc26x0 - -### Add to the source dirs -CONTIKI_TARGET_DIRS += launchpad/cc2650 - -### Include the common launchpad makefile -include $(PLATFORM_ROOT_DIR)/launchpad/Makefile.launchpad diff --git a/arch/platform/cc26x0-cc13x0/launchpad/cc2650/board.h b/arch/platform/cc26x0-cc13x0/launchpad/cc2650/board.h deleted file mode 100644 index 95946cd14..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/cc2650/board.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup launchpad-peripherals - * @{ - * - * \defgroup launchpad-cc26xx-specific CC2650 LaunchPad Peripherals - * - * Defines related to the CC2650 LaunchPad - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * This file is not meant to be modified by the user. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the TI - * CC2650 LaunchPad - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_H_ -#define BOARD_H_ -/*---------------------------------------------------------------------------*/ -#include "ioc.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED HAL configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#define LEDS_CONF_COUNT 2 -#define LEDS_CONF_RED 1 -#define LEDS_CONF_GREEN 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LED IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_LED_1 IOID_6 -#define BOARD_IOID_LED_2 IOID_7 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UART IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_UART_RX IOID_2 -#define BOARD_IOID_UART_TX IOID_3 -#define BOARD_IOID_UART_RTS IOID_18 -#define BOARD_IOID_UART_CTS IOID_19 -#define BOARD_UART_RX (1 << BOARD_IOID_UART_RX) -#define BOARD_UART_TX (1 << BOARD_IOID_UART_TX) -#define BOARD_UART_RTS (1 << BOARD_IOID_UART_RTS) -#define BOARD_UART_CTS (1 << BOARD_IOID_UART_CTS) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_KEY_LEFT IOID_13 -#define BOARD_IOID_KEY_RIGHT IOID_14 -#define BOARD_KEY_LEFT (1 << BOARD_IOID_KEY_LEFT) -#define BOARD_KEY_RIGHT (1 << BOARD_IOID_KEY_RIGHT) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name External flash IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 - -#define EXT_FLASH_SPI_PIN_SCK IOID_10 -#define EXT_FLASH_SPI_PIN_MOSI IOID_9 -#define EXT_FLASH_SPI_PIN_MISO IOID_8 -#define EXT_FLASH_SPI_PIN_CS IOID_20 - -#define EXT_FLASH_DEVICE_ID 0x14 -#define EXT_FLASH_MID 0xC2 - -#define EXT_FLASH_PROGRAM_PAGE_SIZE 256 -#define EXT_FLASH_ERASE_SECTOR_SIZE 4096 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief I2C IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_SCL IOID_4 -#define BOARD_IOID_SDA IOID_5 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief ROM bootloader configuration - * - * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which - * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to - * control the pin level that enables the bootloader (0: low, 1: high). It is - * also possible to use any other externally-controlled DIO. - * @{ - */ -#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT -#define CCXXWARE_CONF_BL_LEVEL 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Remaining pins - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_DIO0 IOID_0 -#define BOARD_IOID_DIO1 IOID_1 -#define BOARD_IOID_CS IOID_11 -#define BOARD_IOID_TDO IOID_16 -#define BOARD_IOID_TDI IOID_17 -#define BOARD_IOID_DIO12 IOID_12 -#define BOARD_IOID_DIO15 IOID_15 -#define BOARD_IOID_DIO21 IOID_21 -#define BOARD_IOID_DIO22 IOID_22 -#define BOARD_IOID_DIO23 IOID_23 -#define BOARD_IOID_DIO24 IOID_24 -#define BOARD_IOID_DIO25 IOID_25 -#define BOARD_IOID_DIO26 IOID_26 -#define BOARD_IOID_DIO27 IOID_27 -#define BOARD_IOID_DIO28 IOID_28 -#define BOARD_IOID_DIO29 IOID_29 -#define BOARD_IOID_DIO30 IOID_30 - -#define BOARD_UNUSED_PINS { \ - BOARD_IOID_DIO0, BOARD_IOID_DIO1, BOARD_IOID_CS, BOARD_IOID_TDO, \ - BOARD_IOID_TDI, BOARD_IOID_DIO12, BOARD_IOID_DIO15, BOARD_IOID_DIO21, \ - BOARD_IOID_DIO22, BOARD_IOID_DIO23, BOARD_IOID_DIO24, BOARD_IOID_DIO25, \ - BOARD_IOID_DIO26, BOARD_IOID_DIO27, BOARD_IOID_DIO28, BOARD_IOID_DIO29, \ - BOARD_IOID_DIO30, IOID_UNUSED \ - } -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board indices for the button HAL - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_BUTTON_HAL_INDEX_KEY_LEFT 0x00 -#define BOARD_BUTTON_HAL_INDEX_KEY_RIGHT 0x01 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "TI CC2650 LaunchPad" - -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/launchpad/leds-arch.c b/arch/platform/cc26x0-cc13x0/launchpad/leds-arch.c deleted file mode 100644 index 3c483d3bd..000000000 --- a/arch/platform/cc26x0-cc13x0/launchpad/leds-arch.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/leds.h" -#include "dev/gpio-hal.h" -#include "ti-lib.h" - -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - { .pin = BOARD_IOID_LED_1, .negative_logic = false }, - { .pin = BOARD_IOID_LED_2, .negative_logic = false }, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/cc26x0-cc13x0/platform.c b/arch/platform/cc26x0-cc13x0/platform.c deleted file mode 100644 index d160c13e1..000000000 --- a/arch/platform/cc26x0-cc13x0/platform.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-platforms - * @{ - * - * \defgroup cc26xx-srf-tag SmartRF+CC13xx/CC26xx EM, SensorTags and LaunchPads - * - * This platform supports a number of different boards: - * - A standard TI SmartRF06EB with a CC26xx EM mounted on it - * - A standard TI SmartRF06EB with a CC1310 EM mounted on it - * - The TI CC2650 SensorTag - * - The TI CC1350 SensorTag - * - The TI CC2650 LaunchPad - * - The TI CC1310 LaunchPad - * - The TI CC1350 LaunchPad - * @{ - */ -#include "ti-lib.h" -#include "contiki.h" -#include "contiki-net.h" -#include "lpm.h" -#include "dev/leds.h" -#include "dev/gpio-hal.h" -#include "dev/oscillators.h" -#include "ieee-addr.h" -#include "ble-addr.h" -#include "vims.h" -#include "dev/cc26xx-uart.h" -#include "dev/soc-rtc.h" -#include "dev/serial-line.h" -#include "rf-core/rf-core.h" -#include "sys_ctrl.h" -#include "uart.h" -#include "sys/clock.h" -#include "sys/rtimer.h" -#include "sys/node-id.h" -#include "sys/platform.h" -#include "lib/random.h" -#include "lib/sensors.h" -#include "button-sensor.h" -#include "dev/serial-line.h" -#include "dev/button-hal.h" -#include "net/mac/framer/frame802154.h" -#include "board-peripherals.h" - -#include "driverlib/driverlib_release.h" - -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "CC26xx/CC13xx" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -/** \brief Board specific iniatialisation */ -void board_init(void); -/*---------------------------------------------------------------------------*/ -#ifdef BOARD_CONF_HAS_SENSORS -#define BOARD_HAS_SENSORS BOARD_CONF_HAS_SENSORS -#else -#define BOARD_HAS_SENSORS 1 -#endif -/*---------------------------------------------------------------------------*/ -static void -fade(leds_mask_t l) -{ - volatile int i; - int k, j; - for(k = 0; k < 800; ++k) { - j = k > 400 ? 800 - k : k; - - leds_on(l); - for(i = 0; i < j; ++i) { - __asm("nop"); - } - leds_off(l); - for(i = 0; i < 400 - j; ++i) { - __asm("nop"); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -set_rf_params(void) -{ - uint8_t ext_addr[8]; - -#if MAC_CONF_WITH_BLE - ble_eui64_addr_cpy_to((uint8_t *)&ext_addr); - NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8); -#else - uint16_t short_addr; - ieee_addr_cpy_to(ext_addr, 8); - - short_addr = ext_addr[7]; - short_addr |= ext_addr[6] << 8; - - NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID); - NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr); - NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, IEEE802154_DEFAULT_CHANNEL); - NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8); -#endif -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one() -{ - /* Enable flash cache and prefetch. */ - ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_ENABLED); - ti_lib_vims_configure(VIMS_BASE, true, true); - - ti_lib_int_master_disable(); - - /* Set the LF XOSC as the LF system clock source */ - oscillators_select_lf_xosc(); - - lpm_init(); - - board_init(); - - gpio_hal_init(); - - leds_init(); - fade(LEDS_RED); - - /* - * Disable I/O pad sleep mode and open I/O latches in the AON IOC interface - * This is only relevant when returning from shutdown (which is what froze - * latches in the first place. Before doing these things though, we should - * allow software to first regain control of pins - */ - ti_lib_aon_ioc_freeze_disable(); - HWREG(AON_SYSCTL_BASE + AON_SYSCTL_O_SLEEPCTL) = 1; - ti_lib_sys_ctrl_aon_sync(); - - ti_lib_int_enable(INT_AON_GPIO_EDGE); - ti_lib_int_master_enable(); - - soc_rtc_init(); - fade(LEDS_YELLOW); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two() -{ - random_init(0x1234); - - /* Character I/O Initialisation */ -#if CC26XX_UART_CONF_ENABLE - cc26xx_uart_init(); -#endif - - serial_line_init(); - -#if BUILD_WITH_SHELL - cc26xx_uart_set_input(serial_line_input_byte); -#endif - - /* Populate linkaddr_node_addr */ -#if MAC_CONF_WITH_BLE - uint8_t ext_addr[8]; - ble_eui64_addr_cpy_to((uint8_t *)&ext_addr); - memcpy(&linkaddr_node_addr, &ext_addr[8 - LINKADDR_SIZE], LINKADDR_SIZE); -#else - ieee_addr_cpy_to(linkaddr_node_addr.u8, LINKADDR_SIZE); -#endif - - button_hal_init(); - - fade(LEDS_GREEN); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three() -{ - radio_value_t chan = 0; - radio_value_t pan = 0; - - set_rf_params(); - - NETSTACK_RADIO.get_value(RADIO_PARAM_CHANNEL, &chan); - - LOG_DBG("With DriverLib v%u.%u\n", DRIVERLIB_RELEASE_GROUP, - DRIVERLIB_RELEASE_BUILD); - LOG_INFO(BOARD_STRING "\n"); - LOG_DBG("IEEE 802.15.4: %s, Sub-GHz: %s, BLE: %s, Prop: %s\n", - ti_lib_chipinfo_supports_ieee_802_15_4() == true ? "Yes" : "No", - ti_lib_chipinfo_chip_family_is_cc13xx() == true ? "Yes" : "No", - ti_lib_chipinfo_supports_ble() == true ? "Yes" : "No", - ti_lib_chipinfo_supports_proprietary() == true ? "Yes" : "No"); - LOG_INFO(" RF: Channel %d", chan); - - if(NETSTACK_RADIO.get_value(RADIO_PARAM_PAN_ID, &pan) == RADIO_RESULT_OK) { - LOG_INFO_(", PANID 0x%04X", pan); - } - LOG_INFO_("\n"); - -#if BOARD_HAS_SENSORS - process_start(&sensors_process, NULL); -#endif - - fade(LEDS_ORANGE); -} -/*---------------------------------------------------------------------------*/ -void -platform_idle() -{ - /* Drop to some low power mode */ - lpm_drop(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/Makefile.sensortag b/arch/platform/cc26x0-cc13x0/sensortag/Makefile.sensortag deleted file mode 100644 index 5f7712fef..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/Makefile.sensortag +++ /dev/null @@ -1,12 +0,0 @@ -CFLAGS += -DBOARD_SENSORTAG=1 -CFLAGS += -DBACKDOOR_IOID=0x00000000 - -CONTIKI_TARGET_DIRS += sensortag common - -BOARD_SOURCEFILES += sensortag-sensors.c board-buttons.c sensor-common.c -BOARD_SOURCEFILES += bmp-280-sensor.c tmp-007-sensor.c opt-3001-sensor.c -BOARD_SOURCEFILES += hdc-1000-sensor.c mpu-9250-sensor.c xmem.c -BOARD_SOURCEFILES += buzzer.c -BOARD_SOURCEFILES += board.c board-i2c.c - -MODULES += arch/dev/ext-flash diff --git a/arch/platform/cc26x0-cc13x0/sensortag/bmp-280-sensor.c b/arch/platform/cc26x0-cc13x0/sensortag/bmp-280-sensor.c deleted file mode 100644 index e27a54610..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/bmp-280-sensor.c +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-bmp-sensor - * @{ - * - * \file - * Driver for the Sensortag BMP280 Altimeter / Pressure Sensor - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "bmp-280-sensor.h" -#include "sys/ctimer.h" -#include "sensor-common.h" -#include "board-i2c.h" -#include "ti-lib.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define BMP280_I2C_ADDRESS 0x77 -/*---------------------------------------------------------------------------*/ -/* Registers */ -#define ADDR_CALIB 0x88 -#define ADDR_PROD_ID 0xD0 -#define ADDR_RESET 0xE0 -#define ADDR_STATUS 0xF3 -#define ADDR_CTRL_MEAS 0xF4 -#define ADDR_CONFIG 0xF5 -#define ADDR_PRESS_MSB 0xF7 -#define ADDR_PRESS_LSB 0xF8 -#define ADDR_PRESS_XLSB 0xF9 -#define ADDR_TEMP_MSB 0xFA -#define ADDR_TEMP_LSB 0xFB -#define ADDR_TEMP_XLSB 0xFC -/*---------------------------------------------------------------------------*/ -/* Reset values */ -#define VAL_PROD_ID 0x58 -#define VAL_RESET 0x00 -#define VAL_STATUS 0x00 -#define VAL_CTRL_MEAS 0x00 -#define VAL_CONFIG 0x00 -#define VAL_PRESS_MSB 0x80 -#define VAL_PRESS_LSB 0x00 -#define VAL_TEMP_MSB 0x80 -#define VAL_TEMP_LSB 0x00 -/*---------------------------------------------------------------------------*/ -/* Test values */ -#define VAL_RESET_EXECUTE 0xB6 -#define VAL_CTRL_MEAS_TEST 0x55 -/*---------------------------------------------------------------------------*/ -/* Misc. */ -#define MEAS_DATA_SIZE 6 -#define CALIB_DATA_SIZE 24 -/*---------------------------------------------------------------------------*/ -#define RES_OFF 0 -#define RES_ULTRA_LOW_POWER 1 -#define RES_LOW_POWER 2 -#define RES_STANDARD 3 -#define RES_HIGH 5 -#define RES_ULTRA_HIGH 6 -/*---------------------------------------------------------------------------*/ -/* Bit fields in CTRL_MEAS register */ -#define PM_OFF 0 -#define PM_FORCED 1 -#define PM_NORMAL 3 -/*---------------------------------------------------------------------------*/ -#define OSRST(v) ((v) << 5) -#define OSRSP(v) ((v) << 2) -/*---------------------------------------------------------------------------*/ -typedef struct bmp_280_calibration { - uint16_t dig_t1; - int16_t dig_t2; - int16_t dig_t3; - uint16_t dig_p1; - int16_t dig_p2; - int16_t dig_p3; - int16_t dig_p4; - int16_t dig_p5; - int16_t dig_p6; - int16_t dig_p7; - int16_t dig_p8; - int16_t dig_p9; - int32_t t_fine; -} bmp_280_calibration_t; -/*---------------------------------------------------------------------------*/ -static uint8_t calibration_data[CALIB_DATA_SIZE]; -/*---------------------------------------------------------------------------*/ -#define SENSOR_STATUS_DISABLED 0 -#define SENSOR_STATUS_INITIALISED 1 -#define SENSOR_STATUS_NOT_READY 2 -#define SENSOR_STATUS_READY 3 - -static int enabled = SENSOR_STATUS_DISABLED; -/*---------------------------------------------------------------------------*/ -/* A buffer for the raw reading from the sensor */ -#define SENSOR_DATA_BUF_SIZE 6 - -static uint8_t sensor_value[SENSOR_DATA_BUF_SIZE]; -/*---------------------------------------------------------------------------*/ -/* Wait SENSOR_STARTUP_DELAY clock ticks for the sensor to be ready - ~80ms */ -#define SENSOR_STARTUP_DELAY 3 - -static struct ctimer startup_timer; -/*---------------------------------------------------------------------------*/ -static void -notify_ready(void *not_used) -{ - enabled = SENSOR_STATUS_READY; - sensors_changed(&bmp_280_sensor); -} -/*---------------------------------------------------------------------------*/ -static void -select_on_bus(void) -{ - /* Set up I2C */ - board_i2c_select(BOARD_I2C_INTERFACE_0, BMP280_I2C_ADDRESS); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initalise the sensor - */ -static void -init(void) -{ - uint8_t val; - - select_on_bus(); - - /* Read and store calibration data */ - sensor_common_read_reg(ADDR_CALIB, calibration_data, CALIB_DATA_SIZE); - - /* Reset the sensor */ - val = VAL_RESET_EXECUTE; - sensor_common_write_reg(ADDR_RESET, &val, sizeof(val)); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Enable/disable measurements - * \param enable 0: disable, enable otherwise - * - * @return none - */ -static void -enable_sensor(bool enable) -{ - uint8_t val; - - select_on_bus(); - - if(enable) { - /* Enable forced mode */ - val = PM_FORCED | OSRSP(1) | OSRST(1); - } else { - val = PM_OFF; - } - sensor_common_write_reg(ADDR_CTRL_MEAS, &val, sizeof(val)); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Read temperature and pressure data - * \param data Pointer to a buffer where temperature and pressure will be - * written (6 bytes) - * \return True if valid data could be retrieved - */ -static bool -read_data(uint8_t *data) -{ - bool success; - - select_on_bus(); - - success = sensor_common_read_reg(ADDR_PRESS_MSB, data, MEAS_DATA_SIZE); - if(!success) { - sensor_common_set_error_data(data, MEAS_DATA_SIZE); - } - - return success; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert raw data to values in degrees C (temp) and Pascal (pressure) - * \param data Pointer to a buffer that holds raw sensor data - * \param temp Pointer to a variable where the converted temperature will be - * written - * \param press Pointer to a variable where the converted pressure will be - * written - */ -static void -convert(uint8_t *data, int32_t *temp, uint32_t *press) -{ - int32_t utemp, upress; - bmp_280_calibration_t *p = (bmp_280_calibration_t *)calibration_data; - int32_t v_x1_u32r; - int32_t v_x2_u32r; - int32_t temperature; - uint32_t pressure; - - /* Pressure */ - upress = (int32_t)((((uint32_t)(data[0])) << 12) - | (((uint32_t)(data[1])) << 4) | ((uint32_t)data[2] >> 4)); - - /* Temperature */ - utemp = (int32_t)((((uint32_t)(data[3])) << 12) | (((uint32_t)(data[4])) << 4) - | ((uint32_t)data[5] >> 4)); - - /* Compensate temperature */ - v_x1_u32r = ((((utemp >> 3) - ((int32_t)p->dig_t1 << 1))) - * ((int32_t)p->dig_t2)) >> 11; - v_x2_u32r = (((((utemp >> 4) - ((int32_t)p->dig_t1)) - * ((utemp >> 4) - ((int32_t)p->dig_t1))) >> 12) - * ((int32_t)p->dig_t3)) - >> 14; - p->t_fine = v_x1_u32r + v_x2_u32r; - temperature = (p->t_fine * 5 + 128) >> 8; - *temp = temperature; - - /* Compensate pressure */ - v_x1_u32r = (((int32_t)p->t_fine) >> 1) - (int32_t)64000; - v_x2_u32r = (((v_x1_u32r >> 2) * (v_x1_u32r >> 2)) >> 11) - * ((int32_t)p->dig_p6); - v_x2_u32r = v_x2_u32r + ((v_x1_u32r * ((int32_t)p->dig_p5)) << 1); - v_x2_u32r = (v_x2_u32r >> 2) + (((int32_t)p->dig_p4) << 16); - v_x1_u32r = - (((p->dig_p3 * (((v_x1_u32r >> 2) * (v_x1_u32r >> 2)) >> 13)) >> 3) - + ((((int32_t)p->dig_p2) * v_x1_u32r) >> 1)) >> 18; - v_x1_u32r = ((((32768 + v_x1_u32r)) * ((int32_t)p->dig_p1)) >> 15); - - if(v_x1_u32r == 0) { - return; /* Avoid exception caused by division by zero */ - } - - pressure = (((uint32_t)(((int32_t)1048576) - upress) - (v_x2_u32r >> 12))) - * 3125; - if(pressure < 0x80000000) { - pressure = (pressure << 1) / ((uint32_t)v_x1_u32r); - } else { - pressure = (pressure / (uint32_t)v_x1_u32r) * 2; - } - - v_x1_u32r = (((int32_t)p->dig_p9) - * ((int32_t)(((pressure >> 3) * (pressure >> 3)) >> 13))) >> 12; - v_x2_u32r = (((int32_t)(pressure >> 2)) * ((int32_t)p->dig_p8)) >> 13; - pressure = (uint32_t)((int32_t)pressure - + ((v_x1_u32r + v_x2_u32r + p->dig_p7) >> 4)); - - *press = pressure; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor - * \param type BMP_280_SENSOR_TYPE_TEMP or BMP_280_SENSOR_TYPE_PRESS - * \return Temperature (centi degrees C) or Pressure (Pascal). - */ -static int -value(int type) -{ - int rv; - int32_t temp = 0; - uint32_t pres = 0; - - if(enabled != SENSOR_STATUS_READY) { - PRINTF("Sensor disabled or starting up (%d)\n", enabled); - return CC26XX_SENSOR_READING_ERROR; - } - - if((type != BMP_280_SENSOR_TYPE_TEMP) && type != BMP_280_SENSOR_TYPE_PRESS) { - PRINTF("Invalid type\n"); - return CC26XX_SENSOR_READING_ERROR; - } else { - memset(sensor_value, 0, SENSOR_DATA_BUF_SIZE); - - rv = read_data(sensor_value); - - if(rv == 0) { - return CC26XX_SENSOR_READING_ERROR; - } - - PRINTF("val: %02x%02x%02x %02x%02x%02x\n", - sensor_value[0], sensor_value[1], sensor_value[2], - sensor_value[3], sensor_value[4], sensor_value[5]); - - convert(sensor_value, &temp, &pres); - - if(type == BMP_280_SENSOR_TYPE_TEMP) { - rv = (int)temp; - } else if(type == BMP_280_SENSOR_TYPE_PRESS) { - rv = (int)pres; - } - } - return rv; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the BMP280 sensor. - * - * \param type Activate, enable or disable the sensor. See below - * \param enable - * - * When type == SENSORS_HW_INIT we turn on the hardware - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor - */ -static int -configure(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - enabled = SENSOR_STATUS_INITIALISED; - init(); - enable_sensor(0); - break; - case SENSORS_ACTIVE: - /* Must be initialised first */ - if(enabled == SENSOR_STATUS_DISABLED) { - return SENSOR_STATUS_DISABLED; - } - if(enable) { - enable_sensor(1); - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready, NULL); - enabled = SENSOR_STATUS_NOT_READY; - } else { - ctimer_stop(&startup_timer); - enable_sensor(0); - enabled = SENSOR_STATUS_INITIALISED; - } - break; - default: - break; - } - return enabled; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor - * \param type SENSORS_ACTIVE or SENSORS_READY - * \return 1 if the sensor is enabled - */ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - break; - default: - break; - } - return SENSOR_STATUS_DISABLED; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(bmp_280_sensor, "BMP280", value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/bmp-280-sensor.h b/arch/platform/cc26x0-cc13x0/sensortag/bmp-280-sensor.h deleted file mode 100644 index 0047aaa9a..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/bmp-280-sensor.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \defgroup sensortag-cc26xx-bmp-sensor SensorTag 2.0 Pressure Sensor - * - * Due to the time required for the sensor to startup, this driver is meant to - * be used in an asynchronous fashion. The caller must first activate the - * sensor by calling SENSORS_ACTIVATE(). This will trigger the sensor's startup - * sequence, but the call will not wait for it to complete so that the CPU can - * perform other tasks or drop to a low power mode. - * - * Once the sensor is stable, the driver will generate a sensors_changed event. - * - * We take readings in "Forced" mode. In this mode, the BMP will take a single - * measurement and it will then automatically go to sleep. - * - * SENSORS_ACTIVATE must be called again to trigger a new reading cycle - * @{ - * - * \file - * Header file for the Sensortag BMP280 Altimeter / Pressure Sensor - */ -/*---------------------------------------------------------------------------*/ -#ifndef BMP_280_SENSOR_H_ -#define BMP_280_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#define BMP_280_SENSOR_TYPE_TEMP 1 -#define BMP_280_SENSOR_TYPE_PRESS 2 -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor bmp_280_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* BMP_280_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/board-buttons.c b/arch/platform/cc26x0-cc13x0/sensortag/board-buttons.c deleted file mode 100644 index 4a1b02ed5..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/board-buttons.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \file - * Defines Sensortag buttons for use with the button HAL - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" -#include "dev/button-hal.h" - -#include "ti-lib.h" - -#include -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTON(reed_relay, "Reed Relay", BOARD_IOID_REED_RELAY, \ - GPIO_HAL_PIN_CFG_PULL_DOWN, \ - BOARD_BUTTON_HAL_INDEX_REED_RELAY, true); - -BUTTON_HAL_BUTTON(key_left, "Key Left", BOARD_IOID_KEY_LEFT, \ - GPIO_HAL_PIN_CFG_PULL_UP, BOARD_BUTTON_HAL_INDEX_KEY_LEFT, \ - true); - -BUTTON_HAL_BUTTON(key_right, "Key Right", BOARD_IOID_KEY_RIGHT, \ - GPIO_HAL_PIN_CFG_PULL_UP, BOARD_BUTTON_HAL_INDEX_KEY_RIGHT, \ - true); -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTONS(&reed_relay, &key_left, &key_right); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/board-i2c.c b/arch/platform/cc26x0-cc13x0/sensortag/board-i2c.c deleted file mode 100644 index cc30e0fb0..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/board-i2c.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2017, University of Bristol - http://www.bris.ac.uk/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-i2c - * @{ - * - * \file - * Board-specific I2C driver for the Sensortags - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "ti-lib.h" -#include "board-i2c.h" -#include "lpm.h" -#include "rtimer.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define I2C_MAX_WAIT_TIME (RTIMER_SECOND / 10) - -#define LIMITED_BUSYWAIT(cond) do { \ - rtimer_clock_t end_time = RTIMER_NOW() + I2C_MAX_WAIT_TIME; \ - while(cond) { \ - if(!RTIMER_CLOCK_LT(RTIMER_NOW(), end_time)) { \ - return false; \ - } \ - } \ - } while(0) -/*---------------------------------------------------------------------------*/ -#define NO_INTERFACE 0xFF -/*---------------------------------------------------------------------------*/ -static uint8_t slave_addr = 0x00; -static uint8_t interface = NO_INTERFACE; -/*---------------------------------------------------------------------------*/ -static bool -accessible(void) -{ - /* First, check the PD */ - if(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_SERIAL) - != PRCM_DOMAIN_POWER_ON) { - return false; - } - - /* Then check the 'run mode' clock gate */ - if(!(HWREG(PRCM_BASE + PRCM_O_I2CCLKGR) & PRCM_I2CCLKGR_CLK_EN)) { - return false; - } - - return true; -} -/*---------------------------------------------------------------------------*/ -void -board_i2c_wakeup() -{ - /* First, make sure the SERIAL PD is on */ - ti_lib_prcm_power_domain_on(PRCM_DOMAIN_SERIAL); - while((ti_lib_prcm_power_domain_status(PRCM_DOMAIN_SERIAL) - != PRCM_DOMAIN_POWER_ON)); - - /* Enable the clock to I2C */ - ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_I2C0); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - /* Enable and initialize the I2C master module */ - ti_lib_i2c_master_init_exp_clk(I2C0_BASE, ti_lib_sys_ctrl_clock_get(), - true); -} -/*---------------------------------------------------------------------------*/ -static bool -i2c_status() -{ - uint32_t status; - - status = ti_lib_i2c_master_err(I2C0_BASE); - if(status & (I2C_MSTAT_DATACK_N_M | I2C_MSTAT_ADRACK_N_M)) { - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_ERROR_STOP); - } - - return status == I2C_MASTER_ERR_NONE; -} -/*---------------------------------------------------------------------------*/ -void -board_i2c_shutdown() -{ - interface = NO_INTERFACE; - - if(accessible()) { - ti_lib_i2c_master_disable(I2C0_BASE); - } - - ti_lib_prcm_peripheral_run_disable(PRCM_PERIPH_I2C0); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - /* - * Set all pins to GPIO Input and disable the output driver. Set internal - * pull to match external pull - * - * SDA and SCL: external PU resistor - * SDA HP and SCL HP: MPU PWR low - */ - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_SDA_HP); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_SDA_HP, IOC_IOPULL_DOWN); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_SCL_HP); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_SCL_HP, IOC_IOPULL_DOWN); - - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_SDA); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_SDA, IOC_IOPULL_UP); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_SCL); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_SCL, IOC_IOPULL_UP); -} -/*---------------------------------------------------------------------------*/ -bool -board_i2c_write(uint8_t *data, uint8_t len) -{ - uint32_t i; - bool success; - - /* Write slave address */ - ti_lib_i2c_master_slave_addr_set(I2C0_BASE, slave_addr, false); - - /* Write first byte */ - ti_lib_i2c_master_data_put(I2C0_BASE, data[0]); - - /* Check if another master has access */ - LIMITED_BUSYWAIT(ti_lib_i2c_master_bus_busy(I2C0_BASE)); - - /* Assert RUN + START */ - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_START); - LIMITED_BUSYWAIT(ti_lib_i2c_master_busy(I2C0_BASE)); - success = i2c_status(); - - for(i = 1; i < len && success; i++) { - /* Write next byte */ - ti_lib_i2c_master_data_put(I2C0_BASE, data[i]); - if(i < len - 1) { - /* Clear START */ - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_CONT); - LIMITED_BUSYWAIT(ti_lib_i2c_master_busy(I2C0_BASE)); - success = i2c_status(); - } - } - - /* Assert stop */ - if(success) { - /* Assert STOP */ - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH); - LIMITED_BUSYWAIT(ti_lib_i2c_master_busy(I2C0_BASE)); - success = i2c_status(); - LIMITED_BUSYWAIT(ti_lib_i2c_master_bus_busy(I2C0_BASE)); - } - - return success; -} -/*---------------------------------------------------------------------------*/ -bool -board_i2c_write_single(uint8_t data) -{ - /* Write slave address */ - ti_lib_i2c_master_slave_addr_set(I2C0_BASE, slave_addr, false); - - /* Write first byte */ - ti_lib_i2c_master_data_put(I2C0_BASE, data); - - /* Check if another master has access */ - LIMITED_BUSYWAIT(ti_lib_i2c_master_bus_busy(I2C0_BASE)); - - /* Assert RUN + START + STOP */ - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_SINGLE_SEND); - LIMITED_BUSYWAIT(ti_lib_i2c_master_busy(I2C0_BASE)); - - return i2c_status(); -} -/*---------------------------------------------------------------------------*/ -bool -board_i2c_read(uint8_t *data, uint8_t len) -{ - uint8_t i; - bool success; - - /* Set slave address */ - ti_lib_i2c_master_slave_addr_set(I2C0_BASE, slave_addr, true); - - /* Check if another master has access */ - LIMITED_BUSYWAIT(ti_lib_i2c_master_bus_busy(I2C0_BASE)); - - /* Assert RUN + START + ACK */ - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_RECEIVE_START); - - i = 0; - success = true; - while(i < (len - 1) && success) { - LIMITED_BUSYWAIT(ti_lib_i2c_master_busy(I2C0_BASE)); - success = i2c_status(); - if(success) { - data[i] = ti_lib_i2c_master_data_get(I2C0_BASE); - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); - i++; - } - } - - if(success) { - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH); - LIMITED_BUSYWAIT(ti_lib_i2c_master_busy(I2C0_BASE)); - success = i2c_status(); - if(success) { - data[len - 1] = ti_lib_i2c_master_data_get(I2C0_BASE); - LIMITED_BUSYWAIT(ti_lib_i2c_master_bus_busy(I2C0_BASE)); - } - } - - return success; -} -/*---------------------------------------------------------------------------*/ -bool -board_i2c_write_read(uint8_t *wdata, uint8_t wlen, uint8_t *rdata, uint8_t rlen) -{ - uint32_t i; - bool success; - - /* Set slave address for write */ - ti_lib_i2c_master_slave_addr_set(I2C0_BASE, slave_addr, false); - - /* Write first byte */ - ti_lib_i2c_master_data_put(I2C0_BASE, wdata[0]); - - /* Check if another master has access */ - LIMITED_BUSYWAIT(ti_lib_i2c_master_bus_busy(I2C0_BASE)); - - /* Assert RUN + START */ - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_START); - LIMITED_BUSYWAIT(ti_lib_i2c_master_busy(I2C0_BASE)); - success = i2c_status(); - - for(i = 1; i < wlen && success; i++) { - /* Write next byte */ - ti_lib_i2c_master_data_put(I2C0_BASE, wdata[i]); - - /* Clear START */ - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_CONT); - LIMITED_BUSYWAIT(ti_lib_i2c_master_busy(I2C0_BASE)); - success = i2c_status(); - } - if(!success) { - return false; - } - - /* Set slave address for read */ - ti_lib_i2c_master_slave_addr_set(I2C0_BASE, slave_addr, true); - - /* Assert ACK */ - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_RECEIVE_START); - - i = 0; - while(i < (rlen - 1) && success) { - LIMITED_BUSYWAIT(ti_lib_i2c_master_busy(I2C0_BASE)); - success = i2c_status(); - if(success) { - rdata[i] = ti_lib_i2c_master_data_get(I2C0_BASE); - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); - i++; - } - } - - if(success) { - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH); - LIMITED_BUSYWAIT(ti_lib_i2c_master_busy(I2C0_BASE)); - success = i2c_status(); - if(success) { - rdata[rlen - 1] = ti_lib_i2c_master_data_get(I2C0_BASE); - LIMITED_BUSYWAIT(ti_lib_i2c_master_bus_busy(I2C0_BASE)); - } - } - - return success; -} -/*---------------------------------------------------------------------------*/ -void -board_i2c_select(uint8_t new_interface, uint8_t address) -{ - slave_addr = address; - - if(accessible() == false) { - board_i2c_wakeup(); - } - - if(new_interface != interface) { - interface = new_interface; - - ti_lib_i2c_master_disable(I2C0_BASE); - - if(interface == BOARD_I2C_INTERFACE_0) { - ti_lib_ioc_io_port_pull_set(BOARD_IOID_SDA, IOC_NO_IOPULL); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_SCL, IOC_NO_IOPULL); - ti_lib_ioc_pin_type_i2c(I2C0_BASE, BOARD_IOID_SDA, BOARD_IOID_SCL); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_SDA_HP); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_SCL_HP); - } else if(interface == BOARD_I2C_INTERFACE_1) { - ti_lib_ioc_io_port_pull_set(BOARD_IOID_SDA_HP, IOC_NO_IOPULL); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_SCL_HP, IOC_NO_IOPULL); - ti_lib_ioc_pin_type_i2c(I2C0_BASE, BOARD_IOID_SDA_HP, BOARD_IOID_SCL_HP); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_SDA); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_SCL); - } - - /* Enable and initialize the I2C master module */ - ti_lib_i2c_master_init_exp_clk(I2C0_BASE, ti_lib_sys_ctrl_clock_get(), - true); - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/board-i2c.h b/arch/platform/cc26x0-cc13x0/sensortag/board-i2c.h deleted file mode 100644 index 46233c332..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/board-i2c.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \defgroup sensortag-cc26xx-i2c SensorTag 2.0 I2C functions - * @{ - * - * \file - * Header file for the Sensortag I2C Driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_I2C_H_ -#define BOARD_I2C_H_ -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -#define BOARD_I2C_INTERFACE_0 0 -#define BOARD_I2C_INTERFACE_1 1 -/*---------------------------------------------------------------------------*/ -/** - * \brief Put the I2C controller in a known state - * - * In this state, pins SDA and SCL will be under i2c control and pins SDA HP - * and SCL HP will be configured as gpio inputs. This is equal to selecting - * BOARD_I2C_INTERFACE_0, but without selecting a slave device address - */ -#define board_i2c_deselect() board_i2c_select(BOARD_I2C_INTERFACE_0, 0) -/*---------------------------------------------------------------------------*/ -/** - * \brief Select an I2C slave - * \param interface The I2C interface to be used (BOARD_I2C_INTERFACE_0 or _1) - * \param slave_addr The slave's address - * - * The various sensors on the sensortag are connected either on interface 0 or - * 1. All sensors are connected to interface 0, with the exception of the MPU - * that is connected to 1. - */ -void board_i2c_select(uint8_t interface, uint8_t slave_addr); - -/** - * \brief Burst read from an I2C device - * \param buf Pointer to a buffer where the read data will be stored - * \param len Number of bytes to read - * \return True on success - */ -bool board_i2c_read(uint8_t *buf, uint8_t len); - -/** - * \brief Burst write to an I2C device - * \param buf Pointer to the buffer to be written - * \param len Number of bytes to write - * \return True on success - */ -bool board_i2c_write(uint8_t *buf, uint8_t len); - -/** - * \brief Single write to an I2C device - * \param data The byte to write - * \return True on success - */ -bool board_i2c_write_single(uint8_t data); - -/** - * \brief Write and read in one operation - * \param wdata Pointer to the buffer to be written - * \param wlen Number of bytes to write - * \param rdata Pointer to a buffer where the read data will be stored - * \param rlen Number of bytes to read - * \return True on success - */ -bool board_i2c_write_read(uint8_t *wdata, uint8_t wlen, uint8_t *rdata, - uint8_t rlen); - -/** - * \brief Enables the I2C peripheral with defaults - * - * This function is called to wakeup and initialise the I2C. - * - * This function can be called explicitly, but it will also be called - * automatically by board_i2c_select() when required. One of those two - * functions MUST be called before any other I2C operation after a chip - * sleep / wakeup cycle or after a call to board_i2c_shutdown(). Failing to do - * so will lead to a bus fault. - */ -void board_i2c_wakeup(void); - -/** - * \brief Stops the I2C peripheral and restores pins to s/w control - * - * This function is called automatically by the board's LPM logic, but it - * can also be called explicitly. - */ -void board_i2c_shutdown(void); -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_I2C_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/board-peripherals.h b/arch/platform/cc26x0-cc13x0/sensortag/board-peripherals.h deleted file mode 100644 index 65c03198b..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/board-peripherals.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup cc26xx-srf-tag - * @{ - * - * \defgroup sensortag-cc26xx-peripherals Sensortag CC1350/CC2650 common - * - * Defines related to Sensortag sensors. The two sensortags are identical to a - * very large extent. Everything documented within this group applies to both - * sensortags. - * - * @{ - * - * \file - * Header file with definitions related to the sensors on the Sensortags - * - * \note Do not include this file directly. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_PERIPHERALS_H_ -#define BOARD_PERIPHERALS_H_ -/*---------------------------------------------------------------------------*/ -#include "bmp-280-sensor.h" -#include "tmp-007-sensor.h" -#include "opt-3001-sensor.h" -#include "hdc-1000-sensor.h" -#include "mpu-9250-sensor.h" -#include "buzzer.h" -#include "ext-flash.h" -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_PERIPHERALS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/board.c b/arch/platform/cc26x0-cc13x0/sensortag/board.c deleted file mode 100644 index 4b6a69bde..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/board.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \file - * Sensortag-specific board initialisation driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "buzzer.h" -#include "lpm.h" -#include "ti-lib.h" -#include "board-peripherals.h" -#include "board-i2c.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -static void -power_domains_on(void) -{ - /* Turn on the PERIPH PD */ - ti_lib_prcm_power_domain_on(PRCM_DOMAIN_PERIPH); - - /* Wait for domains to power on */ - while((ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) - != PRCM_DOMAIN_POWER_ON)); -} -/*---------------------------------------------------------------------------*/ -static void -lpm_wakeup_handler(void) -{ - power_domains_on(); -} -/*---------------------------------------------------------------------------*/ -static void -shutdown_handler(uint8_t mode) -{ - if(mode == LPM_MODE_SHUTDOWN) { - buzzer_stop(); - SENSORS_DEACTIVATE(bmp_280_sensor); - SENSORS_DEACTIVATE(opt_3001_sensor); - SENSORS_DEACTIVATE(tmp_007_sensor); - SENSORS_DEACTIVATE(hdc_1000_sensor); - SENSORS_DEACTIVATE(mpu_9250_sensor); - ti_lib_gpio_clear_dio(BOARD_IOID_MPU_POWER); - } - - /* In all cases, stop the I2C */ - board_i2c_shutdown(); -} -/*---------------------------------------------------------------------------*/ -/* - * Declare a data structure to register with LPM. - * We don't care about what power mode we'll drop to, we don't care about - * getting notified before deep sleep. All we need is to be notified when we - * wake up so we can turn power domains back on for I2C and SSI, and to make - * sure everything on the board is off before CM3 shutdown. - */ -LPM_MODULE(sensortag_module, NULL, shutdown_handler, lpm_wakeup_handler, - LPM_DOMAIN_NONE); -/*---------------------------------------------------------------------------*/ -static void -configure_unused_pins(void) -{ - /* DP[0..3] */ - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_DP0); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_DP0, IOC_IOPULL_DOWN); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_DP1); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_DP1, IOC_IOPULL_DOWN); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_DP2); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_DP2, IOC_IOPULL_DOWN); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_DP3); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_DP3, IOC_IOPULL_DOWN); - - /* Devpack ID */ - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_DEVPK_ID); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_DEVPK_ID, IOC_IOPULL_UP); - - /* Digital Microphone */ - ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_MIC_POWER); - ti_lib_gpio_clear_dio(BOARD_IOID_MIC_POWER); - ti_lib_ioc_io_drv_strength_set(BOARD_IOID_MIC_POWER, IOC_CURRENT_2MA, - IOC_STRENGTH_MIN); - - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_AUDIO_DI); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_AUDIO_DI, IOC_IOPULL_DOWN); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_AUDIO_CLK); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_AUDIO_CLK, IOC_IOPULL_DOWN); - - /* UART over Devpack - TX only (ToDo: Map all UART pins to Debugger) */ - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_DP5_UARTTX); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_DP5_UARTTX, IOC_IOPULL_DOWN); -} -/*---------------------------------------------------------------------------*/ -void -board_init() -{ - /* Disable global interrupts */ - bool int_disabled = ti_lib_int_master_disable(); - - power_domains_on(); - - /* Enable GPIO peripheral */ - ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_GPIO); - - /* Apply settings and wait for them to take effect */ - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - /* I2C controller */ - board_i2c_wakeup(); - - buzzer_init(); - - /* Make sure the external flash is in the lower power mode */ - ext_flash_init(NULL); - - lpm_register_module(&sensortag_module); - - /* For unsupported peripherals, select a default pin configuration */ - configure_unused_pins(); - - /* Re-enable interrupt if initially enabled. */ - if(!int_disabled) { - ti_lib_int_master_enable(); - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/buzzer.c b/arch/platform/cc26x0-cc13x0/sensortag/buzzer.c deleted file mode 100644 index 45ab751d5..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/buzzer.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-buzzer - * @{ - * - * \file - * Driver for the Sensortag Buzzer - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "buzzer.h" -#include "ti-lib.h" -#include "lpm.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -static uint8_t buzzer_on; -LPM_MODULE(buzzer_module, NULL, NULL, NULL, LPM_DOMAIN_PERIPH); -/*---------------------------------------------------------------------------*/ -void -buzzer_init() -{ - buzzer_on = 0; -} -/*---------------------------------------------------------------------------*/ -uint8_t -buzzer_state() -{ - return buzzer_on; -} -/*---------------------------------------------------------------------------*/ -void -buzzer_start(int freq) -{ - uint32_t load; - - /* Enable GPT0 clocks under active, sleep, deep sleep */ - ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_TIMER0); - ti_lib_prcm_peripheral_sleep_enable(PRCM_PERIPH_TIMER0); - ti_lib_prcm_peripheral_deep_sleep_enable(PRCM_PERIPH_TIMER0); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - /* Drive the I/O ID with GPT0 / Timer A */ - ti_lib_ioc_port_configure_set(BOARD_IOID_BUZZER, IOC_PORT_MCU_PORT_EVENT0, - IOC_STD_OUTPUT); - - /* GPT0 / Timer A: PWM, Interrupt Enable */ - HWREG(GPT0_BASE + GPT_O_TAMR) = (TIMER_CFG_A_PWM & 0xFF) | GPT_TAMR_TAPWMIE; - - buzzer_on = 1; - - /* - * Register ourself with LPM. This will keep the PERIPH PD powered on - * during deep sleep, allowing the buzzer to keep working while the chip is - * being power-cycled - */ - lpm_register_module(&buzzer_module); - - /* Stop the timer */ - ti_lib_timer_disable(GPT0_BASE, TIMER_A); - - if(freq > 0) { - load = (GET_MCU_CLOCK / freq); - - ti_lib_timer_load_set(GPT0_BASE, TIMER_A, load); - ti_lib_timer_match_set(GPT0_BASE, TIMER_A, load / 2); - - /* Start */ - ti_lib_timer_enable(GPT0_BASE, TIMER_A); - } -} -/*---------------------------------------------------------------------------*/ -void -buzzer_stop() -{ - buzzer_on = 0; - - /* - * Unregister the buzzer module from LPM. This will effectively release our - * lock for the PERIPH PD allowing it to be powered down (unless some other - * module keeps it on) - */ - lpm_unregister_module(&buzzer_module); - - /* Stop the timer */ - ti_lib_timer_disable(GPT0_BASE, TIMER_A); - - /* - * Stop the module clock: - * - * Currently GPT0 is in use by clock_delay_usec (GPT0/TB) and by this - * module here (GPT0/TA). - * - * clock_delay_usec - * - is definitely not running when we enter here and - * - handles the module clock internally - * - * Thus, we can safely change the state of module clocks here. - */ - ti_lib_prcm_peripheral_run_disable(PRCM_PERIPH_TIMER0); - ti_lib_prcm_peripheral_sleep_disable(PRCM_PERIPH_TIMER0); - ti_lib_prcm_peripheral_deep_sleep_disable(PRCM_PERIPH_TIMER0); - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - /* Un-configure the pin */ - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_BUZZER); - ti_lib_ioc_io_input_set(BOARD_IOID_BUZZER, IOC_INPUT_DISABLE); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/buzzer.h b/arch/platform/cc26x0-cc13x0/sensortag/buzzer.h deleted file mode 100644 index 679729245..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/buzzer.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \defgroup sensortag-cc26xx-buzzer SensorTag 2.0 Buzzer - * @{ - * - * \file - * Header file for the Sensortag Buzzer - */ -/*---------------------------------------------------------------------------*/ -#ifndef BUZZER_H_ -#define BUZZER_H_ -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise the buzzer - */ -void buzzer_init(void); - -/** - * \brief Start the buzzer - * \param freq The buzzer frequency - */ -void buzzer_start(int freq); - -/** - * \brief Stop the buzzer - */ -void buzzer_stop(void); - -/** - * \brief Retrieve the buzzer state - * \return 1: on, 0: off - */ -uint8_t buzzer_state(void); -/*---------------------------------------------------------------------------*/ -#endif /* BUZZER_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/cc1350/Makefile.cc1350 b/arch/platform/cc26x0-cc13x0/sensortag/cc1350/Makefile.cc1350 deleted file mode 100644 index f0f924e97..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/cc1350/Makefile.cc1350 +++ /dev/null @@ -1,8 +0,0 @@ -### Will allow the inclusion of the correct CPU makefile -CPU_FAMILY = cc13x0 - -### Add to the source dirs -CONTIKI_TARGET_DIRS += sensortag/cc1350 - -### Include the common sensortag makefile -include $(PLATFORM_ROOT_DIR)/sensortag/Makefile.sensortag diff --git a/arch/platform/cc26x0-cc13x0/sensortag/cc1350/board.h b/arch/platform/cc26x0-cc13x0/sensortag/cc1350/board.h deleted file mode 100644 index 84fd0717c..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/cc1350/board.h +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup cc26xx-srf-tag - * @{ - * - * \defgroup sensortag-cc13xx-peripherals CC1350 Sensortag Peripherals - * - * Defines related to the CC1350 Sensortag - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * This file can be used as the basis to configure other boards using the - * CC13xx code as their basis. - * - * This file is not meant to be modified by the user. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the TI - * Sensortag - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_H_ -#define BOARD_H_ -/*---------------------------------------------------------------------------*/ -#include "ioc.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED HAL configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#define LEDS_CONF_COUNT 1 -#define LEDS_CONF_RED 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LED IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_LED_1 IOID_10 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UART IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_DP4_UARTRX IOID_28 -#define BOARD_IOID_DP5_UARTTX IOID_29 - -#if BOARD_CONF_DEBUGGER_DEVPACK -#define BOARD_IOID_UART_RX BOARD_IOID_DP4_UARTRX -#define BOARD_IOID_UART_TX BOARD_IOID_DP5_UARTTX -#else -#define BOARD_IOID_UART_RX IOID_17 -#define BOARD_IOID_UART_TX IOID_16 -#endif - -#define BOARD_IOID_UART_CTS IOID_UNUSED -#define BOARD_IOID_UART_RTS IOID_UNUSED -#define BOARD_UART_RX (1 << BOARD_IOID_UART_RX) -#define BOARD_UART_TX (1 << BOARD_IOID_UART_TX) -#define BOARD_UART_CTS (1 << BOARD_IOID_UART_CTS) -#define BOARD_UART_RTS (1 << BOARD_IOID_UART_RTS) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_KEY_LEFT IOID_15 -#define BOARD_IOID_KEY_RIGHT IOID_4 -#define BOARD_KEY_LEFT (1 << BOARD_IOID_KEY_LEFT) -#define BOARD_KEY_RIGHT (1 << BOARD_IOID_KEY_RIGHT) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Buzzer configuration - * @{ - */ -#define BOARD_IOID_BUZZER IOID_21 /**< Buzzer Pin */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Reed Relay IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_REED_RELAY IOID_1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name External flash IOID mapping and part-related constants - * - * Those values are not meant to be modified by the user - * @{ - */ -#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 - -#define EXT_FLASH_SPI_PIN_SCK IOID_17 -#define EXT_FLASH_SPI_PIN_MOSI IOID_19 -#define EXT_FLASH_SPI_PIN_MISO IOID_18 -#define EXT_FLASH_SPI_PIN_CS IOID_14 - -#define EXT_FLASH_DEVICE_ID 0x14 -#define EXT_FLASH_MID 0xC2 - -#define EXT_FLASH_PROGRAM_PAGE_SIZE 256 -#define EXT_FLASH_ERASE_SECTOR_SIZE 4096 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief I2C IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_SDA IOID_5 /**< Interface 0 SDA: All sensors bar MPU */ -#define BOARD_IOID_SCL IOID_6 /**< Interface 0 SCL: All sensors bar MPU */ -#define BOARD_IOID_SDA_HP IOID_8 /**< Interface 1 SDA: MPU */ -#define BOARD_IOID_SCL_HP IOID_9 /**< Interface 1 SCL: MPU */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief MPU IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_MPU_INT IOID_7 -#define BOARD_IOID_MPU_POWER IOID_12 -#define BOARD_MPU_INT (1 << BOARD_IOID_MPU_INT) -#define BOARD_MPU_POWER (1 << BOARD_IOID_MPU_POWER) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board devpack IOID mappings (LCD etc.) - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_AUDIOFS_TDO IOID_16 -#define BOARD_IOID_DEVPACK_CS IOID_20 -#define BOARD_IOID_DEVPK_LCD_EXTCOMIN IOID_22 -#define BOARD_IOID_AUDIODO IOID_22 -#define BOARD_IOID_DP2 IOID_23 -#define BOARD_IOID_DP1 IOID_24 -#define BOARD_IOID_DP0 IOID_25 -#define BOARD_IOID_DP3 IOID_27 -#define BOARD_IOID_DEVPK_ID IOID_30 -#define BOARD_DEVPACK_CS (1 << BOARD_IOID_DEVPACK_CS) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief TMP Sensor - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_TMP_RDY IOID_11 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Digital Microphone - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_MIC_POWER IOID_13 -#define BOARD_IOID_AUDIO_DI IOID_2 -#define BOARD_IOID_AUDIO_CLK IOID_3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name RF Front End configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#define RF_CORE_CONF_RADIO_SETUP_FRONT_END_MODE 0x01 /* Single-Ended, RFP */ -#define RF_CORE_CONF_RADIO_SETUP_BIAS_MODE 0x01 /* External */ -#define RF_CORE_CONF_PROP_FRONT_END_MODE 0x02 /* Single-Ended, RFN */ -#define RF_CORE_CONF_PROP_BIAS_MODE 0x01 /* External */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific overrides - * - * Those values are not meant to be modified by the user - * @{ - */ -#define IEEE_MODE_CONF_BOARD_OVERRIDES ADI_HALFREG_OVERRIDE(0, 16, 0x7, 1), -#define RF_BLE_CONF_BOARD_OVERRIDES ADI_HALFREG_OVERRIDE(0, 16, 0x7, 1), -#define SMARTRF_SETTINGS_CONF_BOARD_OVERRIDES ADI_HALFREG_OVERRIDE(0, 16, 0x7, 2), - -#define SMARTRF_SETTINGS_CONF_RSSI_OFFSET_779_930 0x00F688A3 -#define SMARTRF_SETTINGS_CONF_OVERRIDE_TRIM_OFFSET 0x00018883 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board indices for the button HAL - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_BUTTON_HAL_INDEX_KEY_LEFT 0x00 -#define BOARD_BUTTON_HAL_INDEX_KEY_RIGHT 0x01 -#define BOARD_BUTTON_HAL_INDEX_REED_RELAY 0xFF -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief ROM bootloader configuration - * - * Sensortags do not support the bootloader - * @{ - */ -#define CCXXWARE_CONF_BL_PIN_NUMBER IOID_UNUSED -#define CCXXWARE_CONF_BL_LEVEL 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "TI CC1350 SensorTag" - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board specific iniatialisation - * @{ - */ -void board_init(void); -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/cc1350/leds-arch.c b/arch/platform/cc26x0-cc13x0/sensortag/cc1350/leds-arch.c deleted file mode 100644 index 8da95520f..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/cc1350/leds-arch.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/leds.h" -#include "dev/gpio-hal.h" - -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - { .pin = BOARD_IOID_LED_1, .negative_logic = false }, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/cc2650/Makefile.cc2650 b/arch/platform/cc26x0-cc13x0/sensortag/cc2650/Makefile.cc2650 deleted file mode 100644 index 4aa83e352..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/cc2650/Makefile.cc2650 +++ /dev/null @@ -1,8 +0,0 @@ -### Will allow the inclusion of the correct CPU makefile -CPU_FAMILY = cc26x0 - -### Add to the source dirs -CONTIKI_TARGET_DIRS += sensortag/cc2650 - -### Include the common sensortag makefile -include $(PLATFORM_ROOT_DIR)/sensortag/Makefile.sensortag diff --git a/arch/platform/cc26x0-cc13x0/sensortag/cc2650/board.h b/arch/platform/cc26x0-cc13x0/sensortag/cc2650/board.h deleted file mode 100644 index 915b7161f..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/cc2650/board.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup cc26xx-srf-tag - * @{ - * - * \defgroup sensortag-cc26xx-specific CC2650 Sensortag Peripherals - * - * Defines related to the CC2650 Sensortag - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * This file can be used as the basis to configure other boards using the - * CC13xx/CC26xx code as their basis. - * - * This file is not meant to be modified by the user. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the TI - * Sensortag - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_H_ -#define BOARD_H_ -/*---------------------------------------------------------------------------*/ -#include "ioc.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED HAL configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#define LEDS_CONF_COUNT 2 -#define LEDS_CONF_RED 1 -#define LEDS_CONF_GREEN 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LED IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_LED_1 IOID_10 -#define BOARD_IOID_LED_2 IOID_15 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UART IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_DP4_UARTRX IOID_28 -#define BOARD_IOID_DP5_UARTTX IOID_29 - -#if BOARD_CONF_DEBUGGER_DEVPACK -#define BOARD_IOID_UART_RX BOARD_IOID_DP4_UARTRX -#define BOARD_IOID_UART_TX BOARD_IOID_DP5_UARTTX -#else -#define BOARD_IOID_UART_RX IOID_17 -#define BOARD_IOID_UART_TX IOID_16 -#endif - -#define BOARD_IOID_UART_CTS IOID_UNUSED -#define BOARD_IOID_UART_RTS IOID_UNUSED -#define BOARD_UART_RX (1 << BOARD_IOID_UART_RX) -#define BOARD_UART_TX (1 << BOARD_IOID_UART_TX) -#define BOARD_UART_CTS (1 << BOARD_IOID_UART_CTS) -#define BOARD_UART_RTS (1 << BOARD_IOID_UART_RTS) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_KEY_LEFT IOID_0 -#define BOARD_IOID_KEY_RIGHT IOID_4 -#define BOARD_KEY_LEFT (1 << BOARD_IOID_KEY_LEFT) -#define BOARD_KEY_RIGHT (1 << BOARD_IOID_KEY_RIGHT) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Buzzer configuration - * @{ - */ -#define BOARD_IOID_BUZZER IOID_21 /**< Buzzer Pin */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Reed Relay IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_REED_RELAY IOID_3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name External flash IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 - -#define EXT_FLASH_SPI_PIN_SCK IOID_17 -#define EXT_FLASH_SPI_PIN_MOSI IOID_19 -#define EXT_FLASH_SPI_PIN_MISO IOID_18 -#define EXT_FLASH_SPI_PIN_CS IOID_14 - -#if SENSORTAG_CC2650_REV_1_2_0 -#define EXT_FLASH_DEVICE_ID 0x12 -#define EXT_FLASH_MID 0xEF -#else -#define EXT_FLASH_DEVICE_ID 0x14 -#define EXT_FLASH_MID 0xC2 -#endif - -#define EXT_FLASH_PROGRAM_PAGE_SIZE 256 -#define EXT_FLASH_ERASE_SECTOR_SIZE 4096 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief I2C IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_SDA IOID_5 /**< Interface 0 SDA: All sensors bar MPU */ -#define BOARD_IOID_SCL IOID_6 /**< Interface 0 SCL: All sensors bar MPU */ -#define BOARD_IOID_SDA_HP IOID_8 /**< Interface 1 SDA: MPU */ -#define BOARD_IOID_SCL_HP IOID_9 /**< Interface 1 SCL: MPU */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief MPU IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_MPU_INT IOID_7 -#define BOARD_IOID_MPU_POWER IOID_12 -#define BOARD_MPU_INT (1 << BOARD_IOID_MPU_INT) -#define BOARD_MPU_POWER (1 << BOARD_IOID_MPU_POWER) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board devpack IOID mappings (LCD etc.) - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_AUDIOFS_TDO IOID_16 -#define BOARD_IOID_DEVPACK_CS IOID_20 -#define BOARD_IOID_DEVPK_LCD_EXTCOMIN IOID_22 -#define BOARD_IOID_AUDIODO IOID_22 -#define BOARD_IOID_DP2 IOID_23 -#define BOARD_IOID_DP1 IOID_24 -#define BOARD_IOID_DP0 IOID_25 -#define BOARD_IOID_DP3 IOID_27 -#define BOARD_IOID_DEVPK_ID IOID_30 -#define BOARD_DEVPACK_CS (1 << BOARD_IOID_DEVPACK_CS) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief TMP Sensor - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_TMP_RDY IOID_1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Digital Microphone - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_MIC_POWER IOID_13 -#define BOARD_IOID_AUDIO_DI IOID_2 -#define BOARD_IOID_AUDIO_CLK IOID_11 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board indices for the button HAL - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_BUTTON_HAL_INDEX_KEY_LEFT 0x00 -#define BOARD_BUTTON_HAL_INDEX_KEY_RIGHT 0x01 -#define BOARD_BUTTON_HAL_INDEX_REED_RELAY 0xFF -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief ROM bootloader configuration - * - * Sensortags do not support the bootloader - * @{ - */ -#define CCXXWARE_CONF_BL_PIN_NUMBER IOID_UNUSED -#define CCXXWARE_CONF_BL_LEVEL 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "TI CC2650 SensorTag" - -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/cc2650/leds-arch.c b/arch/platform/cc26x0-cc13x0/sensortag/cc2650/leds-arch.c deleted file mode 100644 index ac4abb7d5..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/cc2650/leds-arch.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/leds.h" -#include "dev/gpio-hal.h" - -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - { .pin = BOARD_IOID_LED_1, .negative_logic = false }, - { .pin = BOARD_IOID_LED_2, .negative_logic = false }, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/hdc-1000-sensor.c b/arch/platform/cc26x0-cc13x0/sensortag/hdc-1000-sensor.c deleted file mode 100644 index 15ee8d434..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/hdc-1000-sensor.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-hdc-sensor - * @{ - * - * \file - * Driver for the Sensortag HDC sensor - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/ctimer.h" -#include "lib/sensors.h" -#include "hdc-1000-sensor.h" -#include "sensor-common.h" -#include "board-i2c.h" - -#include "ti-lib.h" - -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* Sensor I2C address */ -#define SENSOR_I2C_ADDRESS 0x43 - -/* Registers */ -#define HDC1000_REG_TEMP 0x00 /* Temperature */ -#define HDC1000_REG_HUM 0x01 /* Humidity */ -#define HDC1000_REG_CONFIG 0x02 /* Configuration */ -#define HDC1000_REG_SERID_H 0xFB /* Serial ID high */ -#define HDC1000_REG_SERID_M 0xFC /* Serial ID middle */ -#define HDC1000_REG_SERID_L 0xFD /* Serial ID low */ -#define HDC1000_REG_MANF_ID 0xFE /* Manufacturer ID */ -#define HDC1000_REG_DEV_ID 0xFF /* Device ID */ - -/* Fixed values */ -#define HDC1000_VAL_MANF_ID 0x5449 -#define HDC1000_VAL_DEV_ID 0x1000 -#define HDC1000_VAL_CONFIG 0x1000 /* 14 bit, acquired in sequence */ - -/* Sensor selection/deselection */ -#define SENSOR_SELECT() board_i2c_select(BOARD_I2C_INTERFACE_0, SENSOR_I2C_ADDRESS) -#define SENSOR_DESELECT() board_i2c_deselect() -/*---------------------------------------------------------------------------*/ -/* Byte swap of 16-bit register value */ -#define HI_UINT16(a) (((a) >> 8) & 0xFF) -#define LO_UINT16(a) ((a) & 0xFF) - -#define SWAP(v) ((LO_UINT16(v) << 8) | HI_UINT16(v)) -/*---------------------------------------------------------------------------*/ -/* Raw data as returned from the sensor (Big Endian) */ -typedef struct sensor_data { - uint16_t temp; - uint16_t hum; -} sensor_data_t; - -/* Raw data, little endian */ -static uint16_t raw_temp; -static uint16_t raw_hum; -/*---------------------------------------------------------------------------*/ -static bool success; -static sensor_data_t data; -/*---------------------------------------------------------------------------*/ -static int enabled = HDC_1000_SENSOR_STATUS_DISABLED; -/*---------------------------------------------------------------------------*/ -/* - * Maximum measurement durations in clock ticks. We use 14bit resolution, thus: - * - Tmp: 6.35ms - * - RH: 6.5ms - */ -#define MEASUREMENT_DURATION 2 - -/* - * Wait SENSOR_STARTUP_DELAY clock ticks between activation and triggering a - * reading (max 15ms) - */ -#define SENSOR_STARTUP_DELAY 3 - -static struct ctimer startup_timer; -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise the humidity sensor driver - * \return True if I2C operation successful - */ -static bool -sensor_init(void) -{ - uint16_t val; - - SENSOR_SELECT(); - - /* Enable reading data in one operation */ - val = SWAP(HDC1000_VAL_CONFIG); - success = sensor_common_write_reg(HDC1000_REG_CONFIG, (uint8_t *)&val, 2); - - SENSOR_DESELECT(); - - return success; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Start measurement - */ -static void -start(void) -{ - if(success) { - SENSOR_SELECT(); - - success = board_i2c_write_single(HDC1000_REG_TEMP); - SENSOR_DESELECT(); - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Take readings from the sensor - * \return true of I2C operations successful - */ -static bool -read_data() -{ - bool valid; - - if(success) { - SENSOR_SELECT(); - - success = board_i2c_read((uint8_t *)&data, sizeof(data)); - SENSOR_DESELECT(); - - /* Store temperature */ - raw_temp = SWAP(data.temp); - - /* Store humidity */ - raw_hum = SWAP(data.hum); - } - - valid = success; - success = true; - - return valid; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert raw data to temperature and humidity - * \param temp - converted temperature - * \param hum - converted humidity - */ -static void -convert(float *temp, float *hum) -{ - /* Convert temperature to degrees C */ - *temp = ((double)raw_temp / 65536) * 165 - 40; - - /* Convert relative humidity to a %RH value */ - *hum = ((double)raw_hum / 65536) * 100; -} -/*---------------------------------------------------------------------------*/ -static void -notify_ready(void *not_used) -{ - enabled = HDC_1000_SENSOR_STATUS_READINGS_READY; - - /* Latch readings */ - read_data(); - - sensors_changed(&hdc_1000_sensor); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor - * \param type HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMID - * \return Temperature (centi degrees C) or Humidity (centi %RH) - */ -static int -value(int type) -{ - int rv; - float temp; - float hum; - - if(enabled != HDC_1000_SENSOR_STATUS_READINGS_READY) { - PRINTF("Sensor disabled or starting up (%d)\n", enabled); - return CC26XX_SENSOR_READING_ERROR; - } - - if((type != HDC_1000_SENSOR_TYPE_TEMP) && - type != HDC_1000_SENSOR_TYPE_HUMID) { - PRINTF("Invalid type\n"); - return CC26XX_SENSOR_READING_ERROR; - } else { - convert(&temp, &hum); - PRINTF("HDC: %04X %04X t=%d h=%d\n", raw_temp, raw_hum, - (int)(temp * 100), (int)(hum * 100)); - - if(type == HDC_1000_SENSOR_TYPE_TEMP) { - rv = (int)(temp * 100); - } else if(type == HDC_1000_SENSOR_TYPE_HUMID) { - rv = (int)(hum * 100); - } - } - return rv; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the HDC1000 sensor. - * - * \param type Activate, enable or disable the sensor. See below - * \param enable - * - * When type == SENSORS_HW_INIT we turn on the hardware - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor - */ -static int -configure(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - raw_temp = 0; - raw_hum = 0; - memset(&data, 0, sizeof(data)); - - sensor_init(); - enabled = HDC_1000_SENSOR_STATUS_INITIALISED; - break; - case SENSORS_ACTIVE: - /* Must be initialised first */ - if(enabled == HDC_1000_SENSOR_STATUS_DISABLED) { - return HDC_1000_SENSOR_STATUS_DISABLED; - } - if(enable) { - start(); - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready, NULL); - enabled = HDC_1000_SENSOR_STATUS_TAKING_READINGS; - } else { - ctimer_stop(&startup_timer); - enabled = HDC_1000_SENSOR_STATUS_INITIALISED; - } - break; - default: - break; - } - return enabled; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor - * \param type SENSORS_ACTIVE or SENSORS_READY - * \return One of the SENSOR_STATUS_xyz defines - */ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - break; - default: - break; - } - return HDC_1000_SENSOR_STATUS_DISABLED; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(hdc_1000_sensor, "HDC1000", value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/hdc-1000-sensor.h b/arch/platform/cc26x0-cc13x0/sensortag/hdc-1000-sensor.h deleted file mode 100644 index 5c3a8aaff..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/hdc-1000-sensor.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \defgroup sensortag-cc26xx-hdc-sensor SensorTag 2.0 TI HDC1000 Sensor - * - * Due to the time required for the sensor to startup, this driver is meant to - * be used in an asynchronous fashion. The caller must first activate the - * sensor by calling SENSORS_ACTIVATE(). This will trigger the sensor's startup - * sequence, but the call will not wait for it to complete so that the CPU can - * perform other tasks or drop to a low power mode. Once the sensor has taken - * readings, it will automatically go back to low power mode. - * - * Once the sensor is stable, the driver will retrieve readings from the sensor - * and latch them. It will then generate a sensors_changed event. - * - * The user can then retrieve readings by calling .value() and by passing - * either HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMID as the - * argument. Multiple calls to value() will not trigger new readings, they will - * simply return the most recent latched values. - * - * The user can query the sensor's status by calling .status() - * - * To get a fresh reading, the user must trigger a new reading cycle by calling - * SENSORS_ACTIVATE(). - * @{ - * - * \file - * Header file for the Sensortag TI HDC1000 sensor - */ -/*---------------------------------------------------------------------------*/ -#ifndef HDC_1000_SENSOR_H -#define HDC_1000_SENSOR_H -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define HDC_1000_SENSOR_TYPE_TEMP 1 -#define HDC_1000_SENSOR_TYPE_HUMID 2 -/*---------------------------------------------------------------------------*/ -/** - * \name HDC1000 driver states - * @{ - */ -#define HDC_1000_SENSOR_STATUS_DISABLED 0 /**< Not initialised */ -#define HDC_1000_SENSOR_STATUS_INITIALISED 1 /**< Initialised but idle */ -#define HDC_1000_SENSOR_STATUS_TAKING_READINGS 2 /**< Readings in progress */ -#define HDC_1000_SENSOR_STATUS_READINGS_READY 3 /**< Both readings ready */ -/** @} */ -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor hdc_1000_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* HDC_1000_SENSOR_H */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/mpu-9250-sensor.c b/arch/platform/cc26x0-cc13x0/sensortag/mpu-9250-sensor.c deleted file mode 100644 index 9e9685cd3..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/mpu-9250-sensor.c +++ /dev/null @@ -1,663 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-mpu - * @{ - * - * \file - * Driver for the Sensortag Invensense MPU9250 motion processing unit - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "mpu-9250-sensor.h" -#include "sys/rtimer.h" -#include "sensor-common.h" -#include "board-i2c.h" - -#include "ti-lib.h" - -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* Sensor I2C address */ -#define SENSOR_I2C_ADDRESS 0x68 -#define SENSOR_MAG_I2_ADDRESS 0x0C -/*---------------------------------------------------------------------------*/ -/* Registers */ -#define SELF_TEST_X_GYRO 0x00 /* R/W */ -#define SELF_TEST_Y_GYRO 0x01 /* R/W */ -#define SELF_TEST_Z_GYRO 0x02 /* R/W */ -#define SELF_TEST_X_ACCEL 0x0D /* R/W */ -#define SELF_TEST_Z_ACCEL 0x0E /* R/W */ -#define SELF_TEST_Y_ACCEL 0x0F /* R/W */ -/*---------------------------------------------------------------------------*/ -#define XG_OFFSET_H 0x13 /* R/W */ -#define XG_OFFSET_L 0x14 /* R/W */ -#define YG_OFFSET_H 0x15 /* R/W */ -#define YG_OFFSET_L 0x16 /* R/W */ -#define ZG_OFFSET_H 0x17 /* R/W */ -#define ZG_OFFSET_L 0x18 /* R/W */ -/*---------------------------------------------------------------------------*/ -#define SMPLRT_DIV 0x19 /* R/W */ -#define CONFIG 0x1A /* R/W */ -#define GYRO_CONFIG 0x1B /* R/W */ -#define ACCEL_CONFIG 0x1C /* R/W */ -#define ACCEL_CONFIG_2 0x1D /* R/W */ -#define LP_ACCEL_ODR 0x1E /* R/W */ -#define WOM_THR 0x1F /* R/W */ -#define FIFO_EN 0x23 /* R/W */ -/*---------------------------------------------------------------------------*/ -/* - * Registers 0x24 - 0x36 are not applicable to the SensorTag HW configuration - * (IC2 Master) - */ -#define INT_PIN_CFG 0x37 /* R/W */ -#define INT_ENABLE 0x38 /* R/W */ -#define INT_STATUS 0x3A /* R */ -#define ACCEL_XOUT_H 0x3B /* R */ -#define ACCEL_XOUT_L 0x3C /* R */ -#define ACCEL_YOUT_H 0x3D /* R */ -#define ACCEL_YOUT_L 0x3E /* R */ -#define ACCEL_ZOUT_H 0x3F /* R */ -#define ACCEL_ZOUT_L 0x40 /* R */ -#define TEMP_OUT_H 0x41 /* R */ -#define TEMP_OUT_L 0x42 /* R */ -#define GYRO_XOUT_H 0x43 /* R */ -#define GYRO_XOUT_L 0x44 /* R */ -#define GYRO_YOUT_H 0x45 /* R */ -#define GYRO_YOUT_L 0x46 /* R */ -#define GYRO_ZOUT_H 0x47 /* R */ -#define GYRO_ZOUT_L 0x48 /* R */ -/*---------------------------------------------------------------------------*/ -/* - * Registers 0x49 - 0x60 are not applicable to the SensorTag HW configuration - * (external sensor data) - * - * Registers 0x63 - 0x67 are not applicable to the SensorTag HW configuration - * (I2C master) - */ -#define SIGNAL_PATH_RESET 0x68 /* R/W */ -#define ACCEL_INTEL_CTRL 0x69 /* R/W */ -#define USER_CTRL 0x6A /* R/W */ -#define PWR_MGMT_1 0x6B /* R/W */ -#define PWR_MGMT_2 0x6C /* R/W */ -#define FIFO_COUNT_H 0x72 /* R/W */ -#define FIFO_COUNT_L 0x73 /* R/W */ -#define FIFO_R_W 0x74 /* R/W */ -#define WHO_AM_I 0x75 /* R/W */ -/*---------------------------------------------------------------------------*/ -/* Masks is mpuConfig valiable */ -#define ACC_CONFIG_MASK 0x38 -#define GYRO_CONFIG_MASK 0x07 -/*---------------------------------------------------------------------------*/ -/* Values PWR_MGMT_1 */ -#define MPU_SLEEP 0x4F /* Sleep + stop all clocks */ -#define MPU_WAKE_UP 0x09 /* Disable temp. + intern osc */ -/*---------------------------------------------------------------------------*/ -/* Values PWR_MGMT_2 */ -#define ALL_AXES 0x3F -#define GYRO_AXES 0x07 -#define ACC_AXES 0x38 -/*---------------------------------------------------------------------------*/ -/* Data sizes */ -#define DATA_SIZE 6 -/*---------------------------------------------------------------------------*/ -/* Output data rates */ -#define INV_LPA_0_3125HZ 0 -#define INV_LPA_0_625HZ 1 -#define INV_LPA_1_25HZ 2 -#define INV_LPA_2_5HZ 3 -#define INV_LPA_5HZ 4 -#define INV_LPA_10HZ 5 -#define INV_LPA_20HZ 6 -#define INV_LPA_40HZ 7 -#define INV_LPA_80HZ 8 -#define INV_LPA_160HZ 9 -#define INV_LPA_320HZ 10 -#define INV_LPA_640HZ 11 -#define INV_LPA_STOPPED 255 -/*---------------------------------------------------------------------------*/ -/* Bit values */ -#define BIT_ANY_RD_CLR 0x10 -#define BIT_RAW_RDY_EN 0x01 -#define BIT_WOM_EN 0x40 -#define BIT_LPA_CYCLE 0x20 -#define BIT_STBY_XA 0x20 -#define BIT_STBY_YA 0x10 -#define BIT_STBY_ZA 0x08 -#define BIT_STBY_XG 0x04 -#define BIT_STBY_YG 0x02 -#define BIT_STBY_ZG 0x01 -#define BIT_STBY_XYZA (BIT_STBY_XA | BIT_STBY_YA | BIT_STBY_ZA) -#define BIT_STBY_XYZG (BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG) -/*---------------------------------------------------------------------------*/ -/* User control register */ -#define BIT_ACTL 0x80 -#define BIT_LATCH_EN 0x20 -/*---------------------------------------------------------------------------*/ -/* INT Pin / Bypass Enable Configuration */ -#define BIT_AUX_IF_EN 0x20 /* I2C_MST_EN */ -#define BIT_BYPASS_EN 0x02 -/*---------------------------------------------------------------------------*/ -#define ACC_RANGE_INVALID -1 - -#define ACC_RANGE_2G 0 -#define ACC_RANGE_4G 1 -#define ACC_RANGE_8G 2 -#define ACC_RANGE_16G 3 - -#define MPU_AX_GYR_X 2 -#define MPU_AX_GYR_Y 1 -#define MPU_AX_GYR_Z 0 -#define MPU_AX_GYR 0x07 - -#define MPU_AX_ACC_X 5 -#define MPU_AX_ACC_Y 4 -#define MPU_AX_ACC_Z 3 -#define MPU_AX_ACC 0x38 - -#define MPU_AX_MAG 6 -/*---------------------------------------------------------------------------*/ -#define MPU_DATA_READY 0x01 -#define MPU_MOVEMENT 0x40 -/*---------------------------------------------------------------------------*/ -/* Sensor selection/deselection */ -#define SENSOR_SELECT() board_i2c_select(BOARD_I2C_INTERFACE_1, SENSOR_I2C_ADDRESS) -#define SENSOR_DESELECT() board_i2c_deselect() -/*---------------------------------------------------------------------------*/ -/* Delay */ -#define delay_ms(i) (ti_lib_cpu_delay(8000 * (i))) -/*---------------------------------------------------------------------------*/ -static uint8_t mpu_config; -static uint8_t acc_range; -static uint8_t acc_range_reg; -static uint8_t val; -static uint8_t interrupt_status; -/*---------------------------------------------------------------------------*/ -#define SENSOR_STATE_DISABLED 0 -#define SENSOR_STATE_BOOTING 1 -#define SENSOR_STATE_ENABLED 2 - -static int state = SENSOR_STATE_DISABLED; -static int elements = MPU_9250_SENSOR_TYPE_NONE; -/*---------------------------------------------------------------------------*/ -/* 3 16-byte words for all sensor readings */ -#define SENSOR_DATA_BUF_SIZE 3 - -static uint16_t sensor_value[SENSOR_DATA_BUF_SIZE]; -/*---------------------------------------------------------------------------*/ -/* - * Wait SENSOR_BOOT_DELAY ticks for the sensor to boot and - * SENSOR_STARTUP_DELAY for readings to be ready - * Gyro is a little slower than Acc - */ -#define SENSOR_BOOT_DELAY 8 -#define SENSOR_STARTUP_DELAY 5 - -static struct ctimer startup_timer; -/*---------------------------------------------------------------------------*/ -/* Wait for the MPU to have data ready */ -rtimer_clock_t t0; - -/* - * Wait timeout in rtimer ticks. This is just a random low number, since the - * first time we read the sensor status, it should be ready to return data - */ -#define READING_WAIT_TIMEOUT 10 -/*---------------------------------------------------------------------------*/ -/** - * \brief Place the MPU in low power mode - */ -static void -sensor_sleep(void) -{ - SENSOR_SELECT(); - - val = ALL_AXES; - sensor_common_write_reg(PWR_MGMT_2, &val, 1); - - val = MPU_SLEEP; - sensor_common_write_reg(PWR_MGMT_1, &val, 1); - SENSOR_DESELECT(); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Exit low power mode - */ -static void -sensor_wakeup(void) -{ - SENSOR_SELECT(); - val = MPU_WAKE_UP; - sensor_common_write_reg(PWR_MGMT_1, &val, 1); - - /* All axis initially disabled */ - val = ALL_AXES; - sensor_common_write_reg(PWR_MGMT_2, &val, 1); - mpu_config = 0; - - /* Restore the range */ - sensor_common_write_reg(ACCEL_CONFIG, &acc_range_reg, 1); - - /* Clear interrupts */ - sensor_common_read_reg(INT_STATUS, &val, 1); - SENSOR_DESELECT(); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Select gyro and accelerometer axes - */ -static void -select_axes(void) -{ - val = ~mpu_config; - SENSOR_SELECT(); - sensor_common_write_reg(PWR_MGMT_2, &val, 1); - SENSOR_DESELECT(); -} -/*---------------------------------------------------------------------------*/ -static void -convert_to_le(uint8_t *data, uint8_t len) -{ - int i; - for(i = 0; i < len; i += 2) { - uint8_t tmp; - tmp = data[i]; - data[i] = data[i + 1]; - data[i + 1] = tmp; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Set the range of the accelerometer - * \param new_range: ACC_RANGE_2G, ACC_RANGE_4G, ACC_RANGE_8G, ACC_RANGE_16G - * \return true if the write to the sensor succeeded - */ -static bool -acc_set_range(uint8_t new_range) -{ - bool success; - - if(new_range == acc_range) { - return true; - } - - success = false; - - acc_range_reg = (new_range << 3); - - /* Apply the range */ - SENSOR_SELECT(); - success = sensor_common_write_reg(ACCEL_CONFIG, &acc_range_reg, 1); - SENSOR_DESELECT(); - - if(success) { - acc_range = new_range; - } - - return success; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Check whether a data or wake on motion interrupt has occurred - * \return Return the interrupt status - * - * This driver does not use interrupts, however this function allows us to - * determine whether a new sensor reading is available - */ -static uint8_t -int_status(void) -{ - SENSOR_SELECT(); - sensor_common_read_reg(INT_STATUS, &interrupt_status, 1); - SENSOR_DESELECT(); - - return interrupt_status; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Enable the MPU - * \param axes: Gyro bitmap [0..2], X = 1, Y = 2, Z = 4. 0 = gyro off - * Acc bitmap [3..5], X = 8, Y = 16, Z = 32. 0 = accelerometer off - */ -static void -enable_sensor(uint16_t axes) -{ - if(mpu_config == 0 && axes != 0) { - /* Wake up the sensor if it was off */ - sensor_wakeup(); - } - - mpu_config = axes; - - if(mpu_config != 0) { - /* Enable gyro + accelerometer readout */ - select_axes(); - delay_ms(10); - } else if(mpu_config == 0) { - sensor_sleep(); - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Read data from the accelerometer - X, Y, Z - 3 words - * \return True if a valid reading could be taken, false otherwise - */ -static bool -acc_read(uint16_t *data) -{ - bool success; - - if(interrupt_status & BIT_RAW_RDY_EN) { - /* Burst read of all accelerometer values */ - SENSOR_SELECT(); - success = sensor_common_read_reg(ACCEL_XOUT_H, (uint8_t *)data, DATA_SIZE); - SENSOR_DESELECT(); - - if(success) { - convert_to_le((uint8_t *)data, DATA_SIZE); - } else { - sensor_common_set_error_data((uint8_t *)data, DATA_SIZE); - } - } else { - /* Data not ready */ - success = false; - } - - return success; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Read data from the gyroscope - X, Y, Z - 3 words - * \return True if a valid reading could be taken, false otherwise - */ -static bool -gyro_read(uint16_t *data) -{ - bool success; - - if(interrupt_status & BIT_RAW_RDY_EN) { - /* Select this sensor */ - SENSOR_SELECT(); - - /* Burst read of all gyroscope values */ - success = sensor_common_read_reg(GYRO_XOUT_H, (uint8_t *)data, DATA_SIZE); - - if(success) { - convert_to_le((uint8_t *)data, DATA_SIZE); - } else { - sensor_common_set_error_data((uint8_t *)data, DATA_SIZE); - } - - SENSOR_DESELECT(); - } else { - success = false; - } - - return success; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert accelerometer raw reading to a value in G - * \param raw_data The raw accelerometer reading - * \return The converted value - */ -static float -acc_convert(int16_t raw_data) -{ - float v = 0; - - switch(acc_range) { - case ACC_RANGE_2G: - /* Calculate acceleration, unit G, range -2, +2 */ - v = (raw_data * 1.0) / (32768 / 2); - break; - case ACC_RANGE_4G: - /* Calculate acceleration, unit G, range -4, +4 */ - v = (raw_data * 1.0) / (32768 / 4); - break; - case ACC_RANGE_8G: - /* Calculate acceleration, unit G, range -8, +8 */ - v = (raw_data * 1.0) / (32768 / 8); - break; - case ACC_RANGE_16G: - /* Calculate acceleration, unit G, range -16, +16 */ - v = (raw_data * 1.0) / (32768 / 16); - break; - default: - v = 0; - break; - } - - return v; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert gyro raw reading to a value in deg/sec - * \param raw_data The raw accelerometer reading - * \return The converted value - */ -static float -gyro_convert(int16_t raw_data) -{ - /* calculate rotation, unit deg/s, range -250, +250 */ - return (raw_data * 1.0) / (65536 / 500); -} -/*---------------------------------------------------------------------------*/ -static void -notify_ready(void *not_used) -{ - state = SENSOR_STATE_ENABLED; - sensors_changed(&mpu_9250_sensor); -} -/*---------------------------------------------------------------------------*/ -static void -initialise(void *not_used) -{ - /* Configure the accelerometer range */ - if((elements & MPU_9250_SENSOR_TYPE_ACC) != 0) { - acc_set_range(MPU_9250_SENSOR_ACC_RANGE); - } - - enable_sensor(elements & MPU_9250_SENSOR_TYPE_ALL); - - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -power_up(void) -{ - ti_lib_gpio_set_dio(BOARD_IOID_MPU_POWER); - state = SENSOR_STATE_BOOTING; - - ctimer_set(&startup_timer, SENSOR_BOOT_DELAY, initialise, NULL); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor - * \param type MPU_9250_SENSOR_TYPE_ACC_[XYZ] or MPU_9250_SENSOR_TYPE_GYRO_[XYZ] - * \return centi-G (ACC) or centi-Deg/Sec (Gyro) - */ -static int -value(int type) -{ - int rv; - float converted_val = 0; - - if(state == SENSOR_STATE_DISABLED) { - PRINTF("MPU: Sensor Disabled\n"); - return CC26XX_SENSOR_READING_ERROR; - } - - memset(sensor_value, 0, sizeof(sensor_value)); - - if((type & MPU_9250_SENSOR_TYPE_ACC) != 0) { - t0 = RTIMER_NOW(); - - while(!int_status() && - (RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + READING_WAIT_TIMEOUT))); - - rv = acc_read(sensor_value); - - if(rv == 0) { - return CC26XX_SENSOR_READING_ERROR; - } - - PRINTF("MPU: ACC = 0x%04x 0x%04x 0x%04x = ", - sensor_value[0], sensor_value[1], sensor_value[2]); - - /* Convert */ - if(type == MPU_9250_SENSOR_TYPE_ACC_X) { - converted_val = acc_convert(sensor_value[0]); - } else if(type == MPU_9250_SENSOR_TYPE_ACC_Y) { - converted_val = acc_convert(sensor_value[1]); - } else if(type == MPU_9250_SENSOR_TYPE_ACC_Z) { - converted_val = acc_convert(sensor_value[2]); - } - rv = (int)(converted_val * 100); - } else if((type & MPU_9250_SENSOR_TYPE_GYRO) != 0) { - t0 = RTIMER_NOW(); - - while(!int_status() && - (RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + READING_WAIT_TIMEOUT))); - - rv = gyro_read(sensor_value); - - if(rv == 0) { - return CC26XX_SENSOR_READING_ERROR; - } - - PRINTF("MPU: Gyro = 0x%04x 0x%04x 0x%04x = ", - sensor_value[0], sensor_value[1], sensor_value[2]); - - if(type == MPU_9250_SENSOR_TYPE_GYRO_X) { - converted_val = gyro_convert(sensor_value[0]); - } else if(type == MPU_9250_SENSOR_TYPE_GYRO_Y) { - converted_val = gyro_convert(sensor_value[1]); - } else if(type == MPU_9250_SENSOR_TYPE_GYRO_Z) { - converted_val = gyro_convert(sensor_value[2]); - } - rv = (int)(converted_val * 100); - } else { - PRINTF("MPU: Invalid type\n"); - rv = CC26XX_SENSOR_READING_ERROR; - } - - PRINTF("%ld\n", (long int)(converted_val * 100)); - - return rv; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the MPU9250 sensor. - * - * \param type Activate, enable or disable the sensor. See below - * \param enable - * - * When type == SENSORS_HW_INIT we turn on the hardware - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor - */ -static int -configure(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_MPU_INT); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_MPU_INT, IOC_IOPULL_DOWN); - ti_lib_ioc_io_hyst_set(BOARD_IOID_MPU_INT, IOC_HYST_ENABLE); - - ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_MPU_POWER); - ti_lib_ioc_io_drv_strength_set(BOARD_IOID_MPU_POWER, IOC_CURRENT_4MA, - IOC_STRENGTH_MAX); - ti_lib_gpio_clear_dio(BOARD_IOID_MPU_POWER); - elements = MPU_9250_SENSOR_TYPE_NONE; - break; - case SENSORS_ACTIVE: - if(((enable & MPU_9250_SENSOR_TYPE_ACC) != 0) || - ((enable & MPU_9250_SENSOR_TYPE_GYRO) != 0)) { - PRINTF("MPU: Enabling\n"); - elements = enable & MPU_9250_SENSOR_TYPE_ALL; - - power_up(); - - state = SENSOR_STATE_BOOTING; - } else { - PRINTF("MPU: Disabling\n"); - if(HWREG(GPIO_BASE + GPIO_O_DOUT31_0) & BOARD_MPU_POWER) { - /* Then check our state */ - elements = MPU_9250_SENSOR_TYPE_NONE; - ctimer_stop(&startup_timer); - sensor_sleep(); - while(ti_lib_i2c_master_busy(I2C0_BASE)); - state = SENSOR_STATE_DISABLED; - ti_lib_gpio_clear_dio(BOARD_IOID_MPU_POWER); - } - } - break; - default: - break; - } - return state; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor - * \param type SENSORS_ACTIVE or SENSORS_READY - * \return 1 if the sensor is enabled - */ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return state; - break; - default: - break; - } - return SENSOR_STATE_DISABLED; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(mpu_9250_sensor, "MPU9250", value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/mpu-9250-sensor.h b/arch/platform/cc26x0-cc13x0/sensortag/mpu-9250-sensor.h deleted file mode 100644 index da4386412..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/mpu-9250-sensor.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \defgroup sensortag-cc26xx-mpu SensorTag 2.0 Motion Processing Unit - * - * Driver for the Invensense MPU9250 Motion Processing Unit. - * - * Due to the time required between triggering a reading and the reading - * becoming available, this driver is meant to be used in an asynchronous - * fashion. The caller must first activate the sensor by calling - * mpu_9250_sensor.configure(SENSORS_ACTIVE, xyz); - * The value for the xyz arguments depends on the required readings. If the - * caller intends to read both the accelerometer as well as the gyro then - * xyz should be MPU_9250_SENSOR_TYPE_ALL. If the caller only needs to take a - * reading from one of the two elements, xyz should be one of - * MPU_9250_SENSOR_TYPE_ACC or MPU_9250_SENSOR_TYPE_GYRO - * - * Calling .configure() will power up the sensor and initialise it. When the - * sensor is ready to provide readings, the driver will generate a - * sensors_changed event. - * - * Calls to .status() will return the driver's state which could indicate that - * the sensor is off, booting or on. - * - * Once a reading has been taken, the caller has two options: - * - Turn the sensor off by calling SENSORS_DEACTIVATE, but in order to take - * subsequent readings the sensor must be started up all over - * - Leave the sensor on. In this scenario, the caller can simply keep calling - * value() for subsequent readings, but having the sensor on will consume - * more energy, especially if both accelerometer and the gyro are on. - * @{ - * - * \file - * Header file for the Sensortag Invensense MPU9250 motion processing unit - */ -/*---------------------------------------------------------------------------*/ -#ifndef MPU_9250_SENSOR_H_ -#define MPU_9250_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -/* ACC / Gyro Axes */ -#define MPU_9250_SENSOR_TYPE_GYRO_Z 0x01 -#define MPU_9250_SENSOR_TYPE_GYRO_Y 0x02 -#define MPU_9250_SENSOR_TYPE_GYRO_X 0x04 -#define MPU_9250_SENSOR_TYPE_GYRO_ALL 0x07 - -#define MPU_9250_SENSOR_TYPE_ACC_Z 0x08 -#define MPU_9250_SENSOR_TYPE_ACC_Y 0x10 -#define MPU_9250_SENSOR_TYPE_ACC_X 0x20 -#define MPU_9250_SENSOR_TYPE_ACC_ALL 0x38 - -#define MPU_9250_SENSOR_TYPE_MASK 0x3F -#define MPU_9250_SENSOR_TYPE_ACC 0x38 -#define MPU_9250_SENSOR_TYPE_GYRO 0x07 - -#define MPU_9250_SENSOR_TYPE_NONE 0 -#define MPU_9250_SENSOR_TYPE_ALL (MPU_9250_SENSOR_TYPE_ACC | \ - MPU_9250_SENSOR_TYPE_GYRO) -/*---------------------------------------------------------------------------*/ -/* Accelerometer range */ -#define MPU_9250_SENSOR_ACC_RANGE_2G 0 -#define MPU_9250_SENSOR_ACC_RANGE_4G 1 -#define MPU_9250_SENSOR_ACC_RANGE_8G 2 -#define MPU_9250_SENSOR_ACC_RANGE_16G 3 -/*---------------------------------------------------------------------------*/ -/* Accelerometer range configuration */ -#ifdef MPU_9250_SENSOR_CONF_ACC_RANGE -#define MPU_9250_SENSOR_ACC_RANGE MPU_9250_SENSOR_CONF_ACC_RANGE -#else -#define MPU_9250_SENSOR_ACC_RANGE MPU_9250_SENSOR_ACC_RANGE_2G -#endif -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor mpu_9250_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* MPU_9250_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/opt-3001-sensor.c b/arch/platform/cc26x0-cc13x0/sensortag/opt-3001-sensor.c deleted file mode 100644 index 39568b227..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/opt-3001-sensor.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-opt-sensor - * @{ - * - * \file - * Driver for the Sensortag Opt3001 light sensor - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "opt-3001-sensor.h" -#include "sys/ctimer.h" -#include "ti-lib.h" -#include "board-i2c.h" -#include "sensor-common.h" - -#include -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* Slave address */ -#define OPT3001_I2C_ADDRESS 0x45 -/*---------------------------------------------------------------------------*/ -/* Register addresses */ -#define REG_RESULT 0x00 -#define REG_CONFIGURATION 0x01 -#define REG_LOW_LIMIT 0x02 -#define REG_HIGH_LIMIT 0x03 - -#define REG_MANUFACTURER_ID 0x7E -#define REG_DEVICE_ID 0x7F -/*---------------------------------------------------------------------------*/ -/* - * Configuration Register Bits and Masks. - * We use uint16_t to read from / write to registers, meaning that the - * register's MSB is the variable's LSB. - */ -#define CONFIG_RN 0x00F0 /* [15..12] Range Number */ -#define CONFIG_CT 0x0008 /* [11] Conversion Time */ -#define CONFIG_M 0x0006 /* [10..9] Mode of Conversion */ -#define CONFIG_OVF 0x0001 /* [8] Overflow */ -#define CONFIG_CRF 0x8000 /* [7] Conversion Ready Field */ -#define CONFIG_FH 0x4000 /* [6] Flag High */ -#define CONFIG_FL 0x2000 /* [5] Flag Low */ -#define CONFIG_L 0x1000 /* [4] Latch */ -#define CONFIG_POL 0x0800 /* [3] Polarity */ -#define CONFIG_ME 0x0400 /* [2] Mask Exponent */ -#define CONFIG_FC 0x0300 /* [1..0] Fault Count */ - -/* Possible Values for CT */ -#define CONFIG_CT_100 0x0000 -#define CONFIG_CT_800 CONFIG_CT - -/* Possible Values for M */ -#define CONFIG_M_CONTI 0x0004 -#define CONFIG_M_SINGLE 0x0002 -#define CONFIG_M_SHUTDOWN 0x0000 - -/* Reset Value for the register 0xC810. All zeros except: */ -#define CONFIG_RN_RESET 0x00C0 -#define CONFIG_CT_RESET CONFIG_CT_800 -#define CONFIG_L_RESET 0x1000 -#define CONFIG_DEFAULTS (CONFIG_RN_RESET | CONFIG_CT_100 | CONFIG_L_RESET) - -/* Enable / Disable */ -#define CONFIG_ENABLE_CONTINUOUS (CONFIG_M_CONTI | CONFIG_DEFAULTS) -#define CONFIG_ENABLE_SINGLE_SHOT (CONFIG_M_SINGLE | CONFIG_DEFAULTS) -#define CONFIG_DISABLE CONFIG_DEFAULTS -/*---------------------------------------------------------------------------*/ -/* Register length */ -#define REGISTER_LENGTH 2 -/*---------------------------------------------------------------------------*/ -/* Sensor data size */ -#define DATA_LENGTH 2 -/*---------------------------------------------------------------------------*/ -/* - * SENSOR_STATE_SLEEPING and SENSOR_STATE_ACTIVE are mutually exclusive. - * SENSOR_STATE_DATA_READY can be ORd with both of the above. For example the - * sensor may be sleeping but with a conversion ready to read out. - */ -#define SENSOR_STATE_SLEEPING 0 -#define SENSOR_STATE_ACTIVE 1 -#define SENSOR_STATE_DATA_READY 2 - -static int state = SENSOR_STATE_SLEEPING; -/*---------------------------------------------------------------------------*/ -/* Wait SENSOR_STARTUP_DELAY for the sensor to be ready - 125ms */ -#define SENSOR_STARTUP_DELAY (CLOCK_SECOND >> 3) - -static struct ctimer startup_timer; -/*---------------------------------------------------------------------------*/ -/** - * \brief Select the sensor on the I2C bus - */ -static void -select_on_bus(void) -{ - /* Select slave and set clock rate */ - board_i2c_select(BOARD_I2C_INTERFACE_0, OPT3001_I2C_ADDRESS); -} -/*---------------------------------------------------------------------------*/ -static void -notify_ready(void *not_used) -{ - /* - * Depending on the CONFIGURATION.CONVERSION_TIME bits, a conversion will - * take either 100 or 800 ms. Here we inspect the CONVERSION_READY bit and - * if the reading is ready we notify, otherwise we just reschedule ourselves - */ - uint16_t val; - - select_on_bus(); - - sensor_common_read_reg(REG_CONFIGURATION, (uint8_t *)&val, REGISTER_LENGTH); - - if(val & CONFIG_CRF) { - sensors_changed(&opt_3001_sensor); - state = SENSOR_STATE_DATA_READY; - } else { - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready, NULL); - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Turn the sensor on/off - * \param enable TRUE: on, FALSE: off - */ -static void -enable_sensor(bool enable) -{ - uint16_t val; - uint16_t had_data_ready = state & SENSOR_STATE_DATA_READY; - - select_on_bus(); - - if(enable) { - val = CONFIG_ENABLE_SINGLE_SHOT; - - /* Writing CONFIG_ENABLE_SINGLE_SHOT to M bits will clear CRF bits */ - state = SENSOR_STATE_ACTIVE; - } else { - val = CONFIG_DISABLE; - - /* Writing CONFIG_DISABLE to M bits will not clear CRF bits */ - state = SENSOR_STATE_SLEEPING | had_data_ready; - } - - sensor_common_write_reg(REG_CONFIGURATION, (uint8_t *)&val, REGISTER_LENGTH); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Read the result register - * \param raw_data Pointer to a buffer to store the reading - * \return TRUE if valid data - */ -static bool -read_data(uint16_t *raw_data) -{ - bool success; - uint16_t val; - - if((state & SENSOR_STATE_DATA_READY) != SENSOR_STATE_DATA_READY) { - return false; - } - - select_on_bus(); - - success = sensor_common_read_reg(REG_CONFIGURATION, (uint8_t *)&val, - REGISTER_LENGTH); - - if(success) { - success = sensor_common_read_reg(REG_RESULT, (uint8_t *)&val, DATA_LENGTH); - } - - if(success) { - /* Swap bytes */ - *raw_data = (val << 8) | (val >> 8 & 0xFF); - } else { - sensor_common_set_error_data((uint8_t *)raw_data, DATA_LENGTH); - } - - return success; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert raw data to a value in lux - * \param raw_data data Pointer to a buffer with a raw sensor reading - * \return Converted value (lux) - */ -static float -convert(uint16_t raw_data) -{ - uint16_t e, m; - - m = raw_data & 0x0FFF; - e = (raw_data & 0xF000) >> 12; - - return m * (0.01 * exp2(e)); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor - * \param type Ignored - * \return Illuminance in centilux - */ -static int -value(int type) -{ - int rv; - uint16_t raw_val; - float converted_val; - - rv = read_data(&raw_val); - - if(rv == false) { - return CC26XX_SENSOR_READING_ERROR; - } - - converted_val = convert(raw_val); - PRINTF("OPT: %04X r=%d (centilux)\n", raw_val, - (int)(converted_val * 100)); - - rv = (int)(converted_val * 100); - - return rv; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the OPT3001 sensor. - * - * \param type Activate, enable or disable the sensor. See below - * \param enable - * - * When type == SENSORS_HW_INIT we turn on the hardware - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor - */ -static int -configure(int type, int enable) -{ - int rv = 0; - - switch(type) { - case SENSORS_HW_INIT: - /* - * Device reset won't reset the sensor, so we put it to sleep here - * explicitly - */ - enable_sensor(0); - rv = 0; - break; - case SENSORS_ACTIVE: - if(enable) { - enable_sensor(1); - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready, NULL); - rv = 1; - } else { - ctimer_stop(&startup_timer); - enable_sensor(0); - rv = 0; - } - break; - default: - break; - } - return rv; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor - * \param type ignored - * \return The state of the sensor SENSOR_STATE_xyz - */ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - default: - break; - } - return state; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(opt_3001_sensor, "OPT3001", value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/opt-3001-sensor.h b/arch/platform/cc26x0-cc13x0/sensortag/opt-3001-sensor.h deleted file mode 100644 index e9fa379a4..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/opt-3001-sensor.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \defgroup sensortag-cc26xx-opt-sensor SensorTag 2.0 Light Sensor - * - * Due to the time required for the sensor to startup, this driver is meant to - * be used in an asynchronous fashion. The caller must first activate the - * sensor by calling SENSORS_ACTIVATE(). This will trigger the sensor's startup - * sequence, but the call will not wait for it to complete so that the CPU can - * perform other tasks or drop to a low power mode. - * - * Once the reading and conversion are complete, the driver will generate a - * sensors_changed event. - * - * We use single-shot readings. In this mode, the hardware automatically goes - * back to its shutdown mode after the conversion is finished. However, it will - * still respond to I2C operations, so the last conversion can still be read - * out. - * - * In order to take a new reading, the caller has to use SENSORS_ACTIVATE - * again. - * @{ - * - * \file - * Header file for the Sensortag Opt3001 light sensor - */ -/*---------------------------------------------------------------------------*/ -#ifndef OPT_3001_SENSOR_H_ -#define OPT_3001_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor opt_3001_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* OPT_3001_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/sensor-common.c b/arch/platform/cc26x0-cc13x0/sensortag/sensor-common.c deleted file mode 100644 index 0c09bf630..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/sensor-common.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-sensor-common - * @{ - * - * \file - * Utilities common among SensorTag sensors - */ -/*---------------------------------------------------------------------------*/ -#include "sensor-common.h" -#include "board-i2c.h" -/*---------------------------------------------------------------------------*/ -/* Data to use when an error occurs */ -#define ERROR_DATA 0xCC -/*---------------------------------------------------------------------------*/ -static uint8_t buffer[32]; -/*---------------------------------------------------------------------------*/ -bool -sensor_common_read_reg(uint8_t addr, uint8_t *buf, uint8_t len) -{ - return board_i2c_write_read(&addr, 1, buf, len); -} -/*---------------------------------------------------------------------------*/ -bool -sensor_common_write_reg(uint8_t addr, uint8_t *buf, uint8_t len) -{ - uint8_t i; - uint8_t *p = buffer; - - /* Copy address and data to local buffer for burst write */ - *p++ = addr; - for(i = 0; i < len; i++) { - *p++ = *buf++; - } - len++; - - /* Send data */ - return board_i2c_write(buffer, len); -} -/*---------------------------------------------------------------------------*/ -void -sensor_common_set_error_data(uint8_t *buf, uint8_t len) -{ - while(len > 0) { - len--; - buf[len] = ERROR_DATA; - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/sensor-common.h b/arch/platform/cc26x0-cc13x0/sensortag/sensor-common.h deleted file mode 100644 index 7f2bab4f1..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/sensor-common.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \defgroup sensortag-cc26xx-sensor-common SensorTag 2.0 Sensors - * @{ - * - * \file - * Header file for the Sensortag Common sensor utilities - */ -/*---------------------------------------------------------------------------*/ -#ifndef SENSOR_H -#define SENSOR_H -/*---------------------------------------------------------------------------*/ -#include "board-i2c.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Reads a sensor's register over I2C - * \param addr The address of the register to read - * \param buf Pointer to buffer to place data - * \param len Number of bytes to read - * \return TRUE if the required number of bytes are received - * - * The sensor must be selected before this routine is called. - */ -bool sensor_common_read_reg(uint8_t addr, uint8_t *buf, uint8_t len); - -/** - * \brief Write to a sensor's register over I2C - * \param addr The address of the register to read - * \param buf Pointer to buffer containing data to be written - * \param len Number of bytes to write - * \return TRUE if successful write - * - * The sensor must be selected before this routine is called. - */ -bool sensor_common_write_reg(uint8_t addr, uint8_t *buf, uint8_t len); - -/** - * \brief Fill a result buffer with dummy error data - * \param buf Pointer to the buffer where to write the data - * \param len Number of bytes to fill - * \return bitmask of error flags - */ -void sensor_common_set_error_data(uint8_t *buf, uint8_t len); -/*---------------------------------------------------------------------------*/ -#endif /* SENSOR_H */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/sensortag-sensors.c b/arch/platform/cc26x0-cc13x0/sensortag/sensortag-sensors.c deleted file mode 100644 index 065ef6112..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/sensortag-sensors.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \file - * Generic module controlling sensors on Sensortags - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sensortag/bmp-280-sensor.h" -#include "sensortag/tmp-007-sensor.h" -#include "sensortag/opt-3001-sensor.h" -#include "sensortag/hdc-1000-sensor.h" -#include "sensortag/mpu-9250-sensor.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \brief Exports a global symbol to be used by the sensor API */ -SENSORS(&bmp_280_sensor, &tmp_007_sensor, &opt_3001_sensor, &hdc_1000_sensor, - &mpu_9250_sensor); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/tmp-007-sensor.c b/arch/platform/cc26x0-cc13x0/sensortag/tmp-007-sensor.c deleted file mode 100644 index c40dd2eff..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/tmp-007-sensor.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-tmp-sensor - * @{ - * - * \file - * Driver for the Sensortag TI TMP007 infrared thermophile sensor - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "tmp-007-sensor.h" -#include "sys/ctimer.h" -#include "board-i2c.h" -#include "sensor-common.h" -#include "ti-lib.h" - -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* Slave address */ -#define SENSOR_I2C_ADDRESS 0x44 -/*---------------------------------------------------------------------------*/ -/* TMP007 register addresses */ -#define TMP007_REG_ADDR_VOLTAGE 0x00 -#define TMP007_REG_ADDR_LOCAL_TEMP 0x01 -#define TMP007_REG_ADDR_CONFIG 0x02 -#define TMP007_REG_ADDR_OBJ_TEMP 0x03 -#define TMP007_REG_ADDR_STATUS 0x04 -#define TMP007_REG_PROD_ID 0x1F -/*---------------------------------------------------------------------------*/ -/* TMP007 register values */ -#define TMP007_VAL_CONFIG_ON 0x1000 /* Sensor on state */ -#define TMP007_VAL_CONFIG_OFF 0x0000 /* Sensor off state */ -#define TMP007_VAL_CONFIG_RESET 0x8000 -#define TMP007_VAL_PROD_ID 0x0078 /* Product ID */ -/*---------------------------------------------------------------------------*/ -/* Conversion ready (status register) bit values */ -#define CONV_RDY_BIT 0x4000 -/*---------------------------------------------------------------------------*/ -/* Register length */ -#define REGISTER_LENGTH 2 -/*---------------------------------------------------------------------------*/ -/* Sensor data size */ -#define DATA_SIZE 4 -/*---------------------------------------------------------------------------*/ -/* Byte swap of 16-bit register value */ -#define HI_UINT16(a) (((a) >> 8) & 0xFF) -#define LO_UINT16(a) ((a) & 0xFF) - -#define SWAP(v) ((LO_UINT16(v) << 8) | HI_UINT16(v)) -/*---------------------------------------------------------------------------*/ -#define SELECT() board_i2c_select(BOARD_I2C_INTERFACE_0, SENSOR_I2C_ADDRESS) -/*---------------------------------------------------------------------------*/ -static uint8_t buf[DATA_SIZE]; -static uint16_t val; -/*---------------------------------------------------------------------------*/ -#define SENSOR_STATUS_DISABLED 0 -#define SENSOR_STATUS_INITIALISED 1 -#define SENSOR_STATUS_NOT_READY 2 -#define SENSOR_STATUS_READY 3 - -static int enabled = SENSOR_STATUS_DISABLED; -/*---------------------------------------------------------------------------*/ -/* Wait SENSOR_STARTUP_DELAY clock ticks for the sensor to be ready - 275ms */ -#define SENSOR_STARTUP_DELAY 36 - -static struct ctimer startup_timer; -/*---------------------------------------------------------------------------*/ -/* Latched values */ -static int obj_temp_latched; -static int amb_temp_latched; -/*---------------------------------------------------------------------------*/ -static void -notify_ready(void *not_used) -{ - enabled = SENSOR_STATUS_READY; - sensors_changed(&tmp_007_sensor); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Turn the sensor on/off - */ -static bool -enable_sensor(bool enable) -{ - bool success; - - SELECT(); - - if(enable) { - val = TMP007_VAL_CONFIG_ON; - } else { - val = TMP007_VAL_CONFIG_OFF; - } - val = SWAP(val); - - success = sensor_common_write_reg(TMP007_REG_ADDR_CONFIG, (uint8_t *)&val, - REGISTER_LENGTH); - - return success; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Read the sensor value registers - * \param raw_temp Temperature in 16 bit format - * \param raw_obj_temp object temperature in 16 bit format - * \return TRUE if valid data could be retrieved - */ -static bool -read_data(uint16_t *raw_temp, uint16_t *raw_obj_temp) -{ - bool success; - - SELECT(); - - success = sensor_common_read_reg(TMP007_REG_ADDR_STATUS, (uint8_t *)&val, - REGISTER_LENGTH); - - if(success) { - val = SWAP(val); - success = val & CONV_RDY_BIT; - } - - if(success) { - success = sensor_common_read_reg(TMP007_REG_ADDR_LOCAL_TEMP, &buf[0], - REGISTER_LENGTH); - if(success) { - success = sensor_common_read_reg(TMP007_REG_ADDR_OBJ_TEMP, &buf[2], - REGISTER_LENGTH); - } - } - - if(!success) { - sensor_common_set_error_data(buf, 4); - } - - /* Swap byte order */ - *raw_temp = buf[0] << 8 | buf[1]; - *raw_obj_temp = buf[2] << 8 | buf[3]; - - return success; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert raw data to values in degrees C - * \param raw_temp raw ambient temperature from sensor - * \param raw_obj_temp raw object temperature from sensor - * \param obj converted object temperature - * \param amb converted ambient temperature - */ -static void -convert(uint16_t raw_temp, uint16_t raw_obj_temp, float *obj, float *amb) -{ - const float SCALE_LSB = 0.03125; - float t; - int it; - - it = (int)((raw_obj_temp) >> 2); - t = ((float)(it)) * SCALE_LSB; - *obj = t; - - it = (int)((raw_temp) >> 2); - t = (float)it; - *amb = t * SCALE_LSB; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor - * \param type TMP_007_SENSOR_TYPE_OBJECT or TMP_007_SENSOR_TYPE_AMBIENT - * \return Object or Ambient temperature in milli degrees C - */ -static int -value(int type) -{ - int rv; - uint16_t raw_temp; - uint16_t raw_obj_temp; - float obj_temp; - float amb_temp; - - if(enabled != SENSOR_STATUS_READY) { - PRINTF("Sensor disabled or starting up (%d)\n", enabled); - return CC26XX_SENSOR_READING_ERROR; - } - - if((type & TMP_007_SENSOR_TYPE_ALL) == 0) { - PRINTF("Invalid type\n"); - return CC26XX_SENSOR_READING_ERROR; - } - - rv = CC26XX_SENSOR_READING_ERROR; - - if(type == TMP_007_SENSOR_TYPE_ALL) { - rv = read_data(&raw_temp, &raw_obj_temp); - - if(rv == 0) { - return CC26XX_SENSOR_READING_ERROR; - } - - convert(raw_temp, raw_obj_temp, &obj_temp, &amb_temp); - PRINTF("TMP: %04X %04X o=%d a=%d\n", raw_temp, raw_obj_temp, - (int)(obj_temp * 1000), (int)(amb_temp * 1000)); - - obj_temp_latched = (int)(obj_temp * 1000); - amb_temp_latched = (int)(amb_temp * 1000); - rv = 1; - } else if(type == TMP_007_SENSOR_TYPE_OBJECT) { - rv = obj_temp_latched; - } else if(type == TMP_007_SENSOR_TYPE_AMBIENT) { - rv = amb_temp_latched; - } - - return rv; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the TMP007 sensor. - * - * \param type Activate, enable or disable the sensor. See below - * \param enable - * - * When type == SENSORS_HW_INIT we turn on the hardware - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor - */ -static int -configure(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_TMP_RDY); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_TMP_RDY, IOC_IOPULL_UP); - ti_lib_ioc_io_hyst_set(BOARD_IOID_TMP_RDY, IOC_HYST_ENABLE); - - enable_sensor(false); - enabled = SENSOR_STATUS_INITIALISED; - break; - case SENSORS_ACTIVE: - /* Must be initialised first */ - if(enabled == SENSOR_STATUS_DISABLED) { - return SENSOR_STATUS_DISABLED; - } - if(enable) { - enable_sensor(true); - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready, NULL); - enabled = SENSOR_STATUS_NOT_READY; - } else { - ctimer_stop(&startup_timer); - enable_sensor(false); - enabled = SENSOR_STATUS_INITIALISED; - } - break; - default: - break; - } - return enabled; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor - * \param type SENSORS_ACTIVE or SENSORS_READY - * \return 1 if the sensor is enabled - */ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - break; - default: - break; - } - return SENSOR_STATUS_DISABLED; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(tmp_007_sensor, "TMP007", value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/sensortag/tmp-007-sensor.h b/arch/platform/cc26x0-cc13x0/sensortag/tmp-007-sensor.h deleted file mode 100644 index 5260c9152..000000000 --- a/arch/platform/cc26x0-cc13x0/sensortag/tmp-007-sensor.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-cc26xx-peripherals - * @{ - * - * \defgroup sensortag-cc26xx-tmp-sensor SensorTag 2.0 IR thermophile sensor - * - * Due to the time required for the sensor to startup, this driver is meant to - * be used in an asynchronous fashion. The caller must first activate the - * sensor by calling SENSORS_ACTIVATE(). This will trigger the sensor's startup - * sequence, but the call will not wait for it to complete so that the CPU can - * perform other tasks or drop to a low power mode. - * - * Once the sensor is stable, the driver will generate a sensors_changed event. - * - * The caller should then use value(TMP_007_SENSOR_TYPE_ALL) to read sensor - * values and latch them. Once completed successfully, individual readings can - * be retrieved with calls to value(TMP_007_SENSOR_TYPE_OBJECT) or - * value(TMP_007_SENSOR_TYPE_AMBIENT). - * - * Once required readings have been taken, the caller has two options: - * - Turn the sensor off by calling SENSORS_DEACTIVATE, but in order to take - * subsequent readings SENSORS_ACTIVATE must be called again - * - Leave the sensor on. In this scenario, the caller can simply keep calling - * value(TMP_007_SENSOR_TYPE_ALL) to read and latch new values. However - * keeping the sensor on will consume more energy - * @{ - * - * \file - * Header file for the Sensortag TI TMP007 infrared thermophile sensor - */ -/*---------------------------------------------------------------------------*/ -#ifndef TMP_007_SENSOR_H_ -#define TMP_007_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#define TMP_007_SENSOR_TYPE_OBJECT 1 -#define TMP_007_SENSOR_TYPE_AMBIENT 2 -#define TMP_007_SENSOR_TYPE_ALL 3 -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor tmp_007_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* TMP_007_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/srf06/Makefile.srf06 b/arch/platform/cc26x0-cc13x0/srf06/Makefile.srf06 deleted file mode 100644 index dde7e9672..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/Makefile.srf06 +++ /dev/null @@ -1,9 +0,0 @@ -CFLAGS += -DBOARD_SMARTRF06EB=1 - -CONTIKI_TARGET_DIRS += srf06 - -BOARD_SOURCEFILES += srf06-sensors.c board-buttons.c board.c -BOARD_SOURCEFILES += als-sensor.c - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL=1 diff --git a/arch/platform/cc26x0-cc13x0/srf06/als-sensor.c b/arch/platform/cc26x0-cc13x0/srf06/als-sensor.c deleted file mode 100644 index 42e714065..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/als-sensor.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bris.ac.uk/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup srf06-common-peripherals - * @{ - * - * \file - * Driver for the SmartRF06EB ALS when a CC13xx/CC26xxEM is mounted on it - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "srf06/als-sensor.h" -#include "sys/timer.h" -#include "dev/adc-sensor.h" -#include "dev/aux-ctrl.h" - -#include "ti-lib.h" - -#include -/*---------------------------------------------------------------------------*/ -static aux_consumer_module_t als_aux = { - .clocks = AUX_WUC_ADI_CLOCK | AUX_WUC_ANAIF_CLOCK | AUX_WUC_SMPH_CLOCK -}; -/*---------------------------------------------------------------------------*/ -static int -config(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR); - break; - case SENSORS_ACTIVE: - ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR); - ti_lib_ioc_port_configure_set(BOARD_IOID_ALS_OUT, IOC_PORT_GPIO, - IOC_STD_OUTPUT); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_ALS_OUT); - - if(enable) { - ti_lib_gpio_set_dio(BOARD_IOID_ALS_PWR); - aux_ctrl_register_consumer(&als_aux); - ti_lib_aux_adc_select_input(ADC_COMPB_IN_AUXIO7); - clock_delay_usec(2000); - } else { - ti_lib_gpio_clear_dio(BOARD_IOID_ALS_PWR); - aux_ctrl_unregister_consumer(&als_aux); - } - break; - default: - break; - } - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - int val; - - ti_lib_aux_adc_enable_sync(AUXADC_REF_VDDS_REL, AUXADC_SAMPLE_TIME_2P7_US, - AUXADC_TRIGGER_MANUAL); - ti_lib_aux_adc_gen_manual_trigger(); - val = ti_lib_aux_adc_read_fifo(); - ti_lib_aux_adc_disable(); - - return val; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(als_sensor, ALS_SENSOR, value, config, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/srf06/als-sensor.h b/arch/platform/cc26x0-cc13x0/srf06/als-sensor.h deleted file mode 100644 index 5d70478f8..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/als-sensor.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016, University of Bristol - http://www.bris.ac.uk/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup srf06-common-peripherals - * @{ - * - * \file - * Header file for the SmartRF06EB + CC13xx/CC26xxEM ALS Driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef ALS_SENSOR_H_ -#define ALS_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define ALS_SENSOR "ALS" -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor als_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* ALS_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/srf06/board-buttons.c b/arch/platform/cc26x0-cc13x0/srf06/board-buttons.c deleted file mode 100644 index c0db8daaa..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/board-buttons.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup srf06-common-peripherals - * @{ - * - * \file - * Defines SmarfRF06 + CC13xxEM/CC26xxEM buttons for use with the button HAL - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/button-hal.h" - -#include "ti-lib.h" -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTON(key_left, "Key Left", BOARD_IOID_KEY_LEFT, \ - GPIO_HAL_PIN_CFG_PULL_UP, BOARD_BUTTON_HAL_INDEX_KEY_LEFT, \ - true); -BUTTON_HAL_BUTTON(key_right, "Key Right", BOARD_IOID_KEY_RIGHT, \ - GPIO_HAL_PIN_CFG_PULL_UP, BOARD_BUTTON_HAL_INDEX_KEY_RIGHT, \ - true); -BUTTON_HAL_BUTTON(key_up, "Key Up", BOARD_IOID_KEY_UP, \ - GPIO_HAL_PIN_CFG_PULL_UP, BOARD_BUTTON_HAL_INDEX_KEY_UP, \ - true); -BUTTON_HAL_BUTTON(key_down, "Key Down", BOARD_IOID_KEY_DOWN, \ - GPIO_HAL_PIN_CFG_PULL_UP, BOARD_BUTTON_HAL_INDEX_KEY_DOWN, \ - true); -BUTTON_HAL_BUTTON(key_select, "Key Select", BOARD_IOID_KEY_SELECT, \ - GPIO_HAL_PIN_CFG_PULL_UP, \ - BOARD_BUTTON_HAL_INDEX_KEY_SELECT, true); -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTONS(&key_left, &key_right, &key_up, &key_down, &key_select); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/srf06/board-peripherals.h b/arch/platform/cc26x0-cc13x0/srf06/board-peripherals.h deleted file mode 100644 index c709ec963..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/board-peripherals.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup cc26xx-srf-tag - * @{ - * - * \defgroup srf06-common-peripherals SmartRF06EB + CC13xx/CC26xx common - * - * Defines related to the SmartRF06 Evaluation Board irrespective of the EM - * mounted on it - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * @{ - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_PERIPHERALS_H_ -#define BOARD_PERIPHERALS_H_ -/*---------------------------------------------------------------------------*/ -#include "als-sensor.h" -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_PERIPHERALS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/srf06/board.c b/arch/platform/cc26x0-cc13x0/srf06/board.c deleted file mode 100644 index 119f77994..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/board.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup srf06-common-peripherals - * @{ - * - * \file - * Board-initialisation for the Srf06EB with a CC13xx/CC26xx EM. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "ti-lib.h" -#include "lpm.h" -#include "prcm.h" -#include "hw_sysctl.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -static void -lpm_handler(uint8_t mode) -{ - /* Ambient light sensor (off, output low) */ - ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ALS_PWR); - ti_lib_gpio_clear_dio(BOARD_IOID_ALS_PWR); - ti_lib_ioc_pin_type_gpio_input(BOARD_IOID_ALS_OUT); - ti_lib_ioc_io_port_pull_set(BOARD_IOID_ALS_OUT, IOC_NO_IOPULL); -} -/*---------------------------------------------------------------------------*/ -static void -wakeup_handler(void) -{ - /* Turn on the PERIPH PD */ - ti_lib_prcm_power_domain_on(PRCM_DOMAIN_PERIPH); - while((ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) - != PRCM_DOMAIN_POWER_ON)); -} -/*---------------------------------------------------------------------------*/ -/* - * Declare a data structure to register with LPM. - * We don't care about what power mode we'll drop to, we don't care about - * getting notified before deep sleep. All we need is to be notified when we - * wake up so we can turn power domains back on - */ -LPM_MODULE(srf_module, NULL, lpm_handler, wakeup_handler, LPM_DOMAIN_NONE); -/*---------------------------------------------------------------------------*/ -static void -configure_unused_pins(void) -{ - /* Turn off 3.3-V domain (lcd/sdcard power, output low) */ - ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_3V3_EN); - ti_lib_gpio_clear_dio(BOARD_IOID_3V3_EN); - - /* Accelerometer (PWR output low, CSn output, high) */ - ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_ACC_PWR); - ti_lib_gpio_clear_dio(BOARD_IOID_ACC_PWR); -} -/*---------------------------------------------------------------------------*/ -void -board_init() -{ - uint8_t int_disabled = ti_lib_int_master_disable(); - - /* Turn on relevant PDs */ - wakeup_handler(); - - /* Enable GPIO peripheral */ - ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_GPIO); - - /* Apply settings and wait for them to take effect */ - ti_lib_prcm_load_set(); - while(!ti_lib_prcm_load_get()); - - lpm_register_module(&srf_module); - - configure_unused_pins(); - - /* Re-enable interrupt if initially enabled. */ - if(!int_disabled) { - ti_lib_int_master_enable(); - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cc26x0-cc13x0/srf06/cc13x0/Makefile.cc13x0 b/arch/platform/cc26x0-cc13x0/srf06/cc13x0/Makefile.cc13x0 deleted file mode 100644 index ec20fcb63..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/cc13x0/Makefile.cc13x0 +++ /dev/null @@ -1,7 +0,0 @@ -### Will allow the inclusion of the correct CPU makefile -CPU_FAMILY = cc13x0 - -### Include the common sensortag makefile -include $(PLATFORM_ROOT_DIR)/srf06/Makefile.srf06 - -CONTIKI_TARGET_DIRS += srf06/cc13x0 diff --git a/arch/platform/cc26x0-cc13x0/srf06/cc13x0/board.h b/arch/platform/cc26x0-cc13x0/srf06/cc13x0/board.h deleted file mode 100644 index 4c0fcf686..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/cc13x0/board.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup cc26xx-srf-tag - * @{ - * - * \defgroup srf06-cc13xx-peripherals Peripherals for the SmartRF06EB + CC1310EM - * - * Defines related to the SmartRF06 Evaluation Board with a CC1310EM - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * This file can be used as the basis to configure other boards using the - * CC13xx/CC26xx code as their basis. - * - * This file is not meant to be modified by the user. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the TI - * SmartRF06 Evaluation Board with a CC1310EM - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_H_ -#define BOARD_H_ -/*---------------------------------------------------------------------------*/ -#include "ioc.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED HAL configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#define LEDS_CONF_COUNT 4 -#define LEDS_CONF_RED 1 -#define LEDS_CONF_YELLOW 2 -#define LEDS_CONF_GREEN 4 -#define LEDS_CONF_ORANGE 8 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LED IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_LED_1 IOID_25 -#define BOARD_IOID_LED_2 IOID_27 -#define BOARD_IOID_LED_3 IOID_7 -#define BOARD_IOID_LED_4 IOID_6 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UART IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_UART_RX IOID_2 -#define BOARD_IOID_UART_TX IOID_3 -#define BOARD_IOID_UART_CTS IOID_UNUSED -#define BOARD_IOID_UART_RTS IOID_UNUSED -#define BOARD_UART_RX (1 << BOARD_IOID_UART_RX) -#define BOARD_UART_TX (1 << BOARD_IOID_UART_TX) -#define BOARD_UART_CTS (1 << BOARD_IOID_UART_CTS) -#define BOARD_UART_RTS (1 << BOARD_IOID_UART_RTS) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_KEY_LEFT IOID_15 -#define BOARD_IOID_KEY_RIGHT IOID_18 -#define BOARD_IOID_KEY_UP IOID_19 -#define BOARD_IOID_KEY_DOWN IOID_12 -#define BOARD_IOID_KEY_SELECT IOID_11 -#define BOARD_KEY_LEFT (1 << BOARD_IOID_KEY_LEFT) -#define BOARD_KEY_RIGHT (1 << BOARD_IOID_KEY_RIGHT) -#define BOARD_KEY_UP (1 << BOARD_IOID_KEY_UP) -#define BOARD_KEY_DOWN (1 << BOARD_IOID_KEY_DOWN) -#define BOARD_KEY_SELECT (1 << BOARD_IOID_KEY_SELECT) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name 3.3V domain IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_3V3_EN IOID_13 -#define BOARD_3V3_EN (1 << BOARD_IOID_3V3_EN) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_SPI_SCK IOID_10 -#define BOARD_IOID_SPI_MOSI IOID_9 -#define BOARD_IOID_SPI_MISO IOID_8 -#define BOARD_SPI_SCK (1 << BOARD_IOID_SPI_SCK) -#define BOARD_SPI_MOSI (1 << BOARD_IOID_SPI_MOSI) -#define BOARD_SPI_MISO (1 << BOARD_IOID_SPI_MISO) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LCD IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_LCD_MODE IOID_4 -#define BOARD_IOID_LCD_RST IOID_5 -#define BOARD_IOID_LCD_CS IOID_14 -#define BOARD_IOID_LCD_SCK BOARD_IOID_SPI_SCK -#define BOARD_IOID_LCD_MOSI BOARD_IOID_SPI_MOSI -#define BOARD_LCD_MODE (1 << BOARD_IOID_LCD_MODE) -#define BOARD_LCD_RST (1 << BOARD_IOID_LCD_RST) -#define BOARD_LCD_CS (1 << BOARD_IOID_LCD_CS) -#define BOARD_LCD_SCK BOARD_SPI_SCK -#define BOARD_LCD_MOSI BOARD_SPI_MOSI -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SD Card IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_SDCARD_CS IOID_30 -#define BOARD_SDCARD_CS (1 << BOARD_IOID_SDCARD_CS) -#define BOARD_IOID_SDCARD_SCK BOARD_IOID_SPI_SCK -#define BOARD_SDCARD_SCK BOARD_SPI_SCK -#define BOARD_IOID_SDCARD_MOSI BOARD_IOID_SPI_MOSI -#define BOARD_SDCARD_MOSI BOARD_SPI_MOSI -#define BOARD_IOID_SDCARD_MISO BOARD_IOID_SPI_MISO -#define BOARD_SDCARD_MISO BOARD_SPI_MISO -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ALS IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_ALS_PWR IOID_26 -#define BOARD_IOID_ALS_OUT IOID_23 -#define BOARD_ALS_PWR (1 << BOARD_IOID_ALS_PWR) -#define BOARD_ALS_OUT (1 << BOARD_IOID_ALS_OUT) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ACC IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_ACC_PWR IOID_20 -#define BOARD_IOID_ACC_INT IOID_28 -#define BOARD_IOID_ACC_INT1 IOID_28 -#define BOARD_IOID_ACC_INT2 IOID_29 -#define BOARD_IOID_ACC_CS IOID_24 -#define BOARD_ACC_PWR (1 << BOARD_IOID_ACC_PWR) -#define BOARD_ACC_INT (1 << BOARD_IOID_ACC_INT) -#define BOARD_ACC_INT1 (1 << BOARD_IOID_ACC_INT1) -#define BOARD_ACC_INT2 (1 << BOARD_IOID_ACC_INT2) -#define BOARD_ACC_CS (1 << BOARD_IOID_ACC_CS) -#define BOARD_IOID_ACC_SCK BOARD_IOID_SPI_SCK -#define BOARD_ACC_SCK BOARD_SPI_SCK -#define BOARD_IOID_ACC_MOSI BOARD_IOID_SPI_MOSI -#define BOARD_ACC_MOSI BOARD_SPI_MOSI -#define BOARD_IOID_ACC_MISO BOARD_IOID_SPI_MISO -#define BOARD_ACC_MISO BOARD_SPI_MISO -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief ROM bootloader configuration - * - * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which - * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to - * control the pin level that enables the bootloader (0: low, 1: high). It is - * also possible to use any other externally-controlled DIO. - * @{ - */ -#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_SELECT -#define CCXXWARE_CONF_BL_LEVEL 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board indices for the button HAL - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_BUTTON_HAL_INDEX_KEY_LEFT 0x00 -#define BOARD_BUTTON_HAL_INDEX_KEY_RIGHT 0x01 -#define BOARD_BUTTON_HAL_INDEX_KEY_UP 0x02 -#define BOARD_BUTTON_HAL_INDEX_KEY_DOWN 0x03 -#define BOARD_BUTTON_HAL_INDEX_KEY_SELECT 0x04 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "TI SmartRF06EB + CC13xx EM" -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/srf06/cc26x0/Makefile.cc26x0 b/arch/platform/cc26x0-cc13x0/srf06/cc26x0/Makefile.cc26x0 deleted file mode 100644 index 84ef217a8..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/cc26x0/Makefile.cc26x0 +++ /dev/null @@ -1,7 +0,0 @@ -### Will allow the inclusion of the correct CPU makefile -CPU_FAMILY = cc26x0 - -### Include the common makefile -include $(PLATFORM_ROOT_DIR)/srf06/Makefile.srf06 - -CONTIKI_TARGET_DIRS += srf06/cc26x0 diff --git a/arch/platform/cc26x0-cc13x0/srf06/cc26x0/board.h b/arch/platform/cc26x0-cc13x0/srf06/cc26x0/board.h deleted file mode 100644 index cd6d2b1e4..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/cc26x0/board.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup cc26xx-srf-tag - * @{ - * - * \defgroup cc26x0-cc13x0-peripherals Peripherals for the SmartRF06EB + CC26xxEM - * - * Defines related to the SmartRF06 Evaluation Board with a CC26xxEM - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * This file can be used as the basis to configure other boards using the - * CC13xx/CC26xx code as their basis. - * - * This file is not meant to be modified by the user. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the TI - * SmartRF06 Evaluation Board with a CC26xxEM - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_H_ -#define BOARD_H_ -/*---------------------------------------------------------------------------*/ -#include "ioc.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED HAL configuration - * - * Those values are not meant to be modified by the user - * @{ - */ -#define LEDS_CONF_COUNT 4 -#define LEDS_CONF_RED 1 -#define LEDS_CONF_YELLOW 2 -#define LEDS_CONF_GREEN 4 -#define LEDS_CONF_ORANGE 8 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LED IOID mappings - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_LED_1 IOID_25 -#define BOARD_IOID_LED_2 IOID_27 -#define BOARD_IOID_LED_3 IOID_7 -#define BOARD_IOID_LED_4 IOID_6 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name UART IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_UART_RX IOID_2 -#define BOARD_IOID_UART_TX IOID_3 -#define BOARD_IOID_UART_CTS IOID_UNUSED -#define BOARD_IOID_UART_RTS IOID_UNUSED -#define BOARD_UART_RX (1 << BOARD_IOID_UART_RX) -#define BOARD_UART_TX (1 << BOARD_IOID_UART_TX) -#define BOARD_UART_CTS (1 << BOARD_IOID_UART_CTS) -#define BOARD_UART_RTS (1 << BOARD_IOID_UART_RTS) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_KEY_LEFT IOID_15 -#define BOARD_IOID_KEY_RIGHT IOID_18 -#define BOARD_IOID_KEY_UP IOID_19 -#define BOARD_IOID_KEY_DOWN IOID_12 -#define BOARD_IOID_KEY_SELECT IOID_11 -#define BOARD_KEY_LEFT (1 << BOARD_IOID_KEY_LEFT) -#define BOARD_KEY_RIGHT (1 << BOARD_IOID_KEY_RIGHT) -#define BOARD_KEY_UP (1 << BOARD_IOID_KEY_UP) -#define BOARD_KEY_DOWN (1 << BOARD_IOID_KEY_DOWN) -#define BOARD_KEY_SELECT (1 << BOARD_IOID_KEY_SELECT) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name 3.3V domain IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_3V3_EN IOID_13 -#define BOARD_3V3_EN (1 << BOARD_IOID_3V3_EN) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_SPI_SCK IOID_10 -#define BOARD_IOID_SPI_MOSI IOID_9 -#define BOARD_IOID_SPI_MISO IOID_8 -#define BOARD_SPI_SCK (1 << BOARD_IOID_SPI_SCK) -#define BOARD_SPI_MOSI (1 << BOARD_IOID_SPI_MOSI) -#define BOARD_SPI_MISO (1 << BOARD_IOID_SPI_MISO) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LCD IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_LCD_MODE IOID_4 -#define BOARD_IOID_LCD_RST IOID_5 -#define BOARD_IOID_LCD_CS IOID_14 -#define BOARD_IOID_LCD_SCK BOARD_IOID_SPI_SCK -#define BOARD_IOID_LCD_MOSI BOARD_IOID_SPI_MOSI -#define BOARD_LCD_MODE (1 << BOARD_IOID_LCD_MODE) -#define BOARD_LCD_RST (1 << BOARD_IOID_LCD_RST) -#define BOARD_LCD_CS (1 << BOARD_IOID_LCD_CS) -#define BOARD_LCD_SCK BOARD_SPI_SCK -#define BOARD_LCD_MOSI BOARD_SPI_MOSI -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SD Card IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_SDCARD_CS IOID_30 -#define BOARD_SDCARD_CS (1 << BOARD_IOID_SDCARD_CS) -#define BOARD_IOID_SDCARD_SCK BOARD_IOID_SPI_SCK -#define BOARD_SDCARD_SCK BOARD_SPI_SCK -#define BOARD_IOID_SDCARD_MOSI BOARD_IOID_SPI_MOSI -#define BOARD_SDCARD_MOSI BOARD_SPI_MOSI -#define BOARD_IOID_SDCARD_MISO BOARD_IOID_SPI_MISO -#define BOARD_SDCARD_MISO BOARD_SPI_MISO -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ALS IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_ALS_PWR IOID_26 -#define BOARD_IOID_ALS_OUT IOID_23 -#define BOARD_ALS_PWR (1 << BOARD_IOID_ALS_PWR) -#define BOARD_ALS_OUT (1 << BOARD_IOID_ALS_OUT) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ACC IOID mapping - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_IOID_ACC_PWR IOID_20 -#define BOARD_IOID_ACC_INT IOID_28 -#define BOARD_IOID_ACC_INT1 IOID_28 -#define BOARD_IOID_ACC_INT2 IOID_29 -#define BOARD_IOID_ACC_CS IOID_24 -#define BOARD_ACC_PWR (1 << BOARD_IOID_ACC_PWR) -#define BOARD_ACC_INT (1 << BOARD_IOID_ACC_INT) -#define BOARD_ACC_INT1 (1 << BOARD_IOID_ACC_INT1) -#define BOARD_ACC_INT2 (1 << BOARD_IOID_ACC_INT2) -#define BOARD_ACC_CS (1 << BOARD_IOID_ACC_CS) -#define BOARD_IOID_ACC_SCK BOARD_IOID_SPI_SCK -#define BOARD_ACC_SCK BOARD_SPI_SCK -#define BOARD_IOID_ACC_MOSI BOARD_IOID_SPI_MOSI -#define BOARD_ACC_MOSI BOARD_SPI_MOSI -#define BOARD_IOID_ACC_MISO BOARD_IOID_SPI_MISO -#define BOARD_ACC_MISO BOARD_SPI_MISO -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief ROM bootloader configuration - * - * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which - * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to - * control the pin level that enables the bootloader (0: low, 1: high). It is - * also possible to use any other externally-controlled DIO. - * @{ - */ -#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_SELECT -#define CCXXWARE_CONF_BL_LEVEL 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Board indices for the button HAL - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_BUTTON_HAL_INDEX_KEY_LEFT 0x00 -#define BOARD_BUTTON_HAL_INDEX_KEY_RIGHT 0x01 -#define BOARD_BUTTON_HAL_INDEX_KEY_UP 0x02 -#define BOARD_BUTTON_HAL_INDEX_KEY_DOWN 0x03 -#define BOARD_BUTTON_HAL_INDEX_KEY_SELECT 0x04 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "TI SmartRF06EB + CC26xx EM" -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/cc26x0-cc13x0/srf06/leds-arch.c b/arch/platform/cc26x0-cc13x0/srf06/leds-arch.c deleted file mode 100644 index f504f9cc2..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/leds-arch.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/leds.h" -#include "dev/gpio-hal.h" - -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - { .pin = BOARD_IOID_LED_1, .negative_logic = false }, - { .pin = BOARD_IOID_LED_2, .negative_logic = false }, - { .pin = BOARD_IOID_LED_3, .negative_logic = false }, - { .pin = BOARD_IOID_LED_4, .negative_logic = false }, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/cc26x0-cc13x0/srf06/srf06-sensors.c b/arch/platform/cc26x0-cc13x0/srf06/srf06-sensors.c deleted file mode 100644 index 642d2b103..000000000 --- a/arch/platform/cc26x0-cc13x0/srf06/srf06-sensors.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup srf06-common-peripherals - * @{ - * - * \file - * Generic module controlling sensors on the SmartRF06EB when a CC26xx is - * mounted on the board - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "srf06/als-sensor.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \brief Exports a global symbol to be used by the sensor API */ -SENSORS(&als_sensor); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/cooja/Makefile.cooja b/arch/platform/cooja/Makefile.cooja deleted file mode 100644 index 023fe3d9a..000000000 --- a/arch/platform/cooja/Makefile.cooja +++ /dev/null @@ -1,78 +0,0 @@ -# $Id: Makefile.cooja,v 1.42 2010/11/10 13:11:43 fros4943 Exp $ - -## The COOJA Simulator Contiki platform Makefile -## -## This makefile should normally never be called directly, but -## rather from inside the COOJA simulator. -## The purpose of this file is to compile a shared library that -## can be loaded into the Java part of COOJA. - -ifndef CONTIKI - $(error CONTIKI not defined!) -endif - -### Assuming simulator quickstart if no JNI library name set from Cooja -ifndef LIBNAME -QUICKSTART=1 -endif - -### Quickstart simulator -ifdef QUICKSTART - -# Create COOJA JAR rule -$(CONTIKI)/tools/cooja/dist/cooja.jar: - @echo "Creating COOJA Java archive..." - (cd $(CONTIKI)/tools/cooja && ant jar) - -# Quickstart rule -ifneq ($(MAKECMDGOALS),clean) -.PHONY: $(MAKECMDGOALS) -.PRECIOUS: $(MAKECMDGOALS) -$(MAKECMDGOALS): $(CONTIKI)/tools/cooja/dist/cooja.jar - java -mx512m -jar $< -quickstart='$(firstword $(MAKECMDGOALS))' -contiki='$(CONTIKI)' -endif - -endif ## QUICKSTART - -#MAIN_SRC = $(BUILD_DIR_BOARD)/$(LIBNAME).c -MAIN_OBJ = $(BUILD_DIR_BOARD)/$(LIBNAME).o -ARCHIVE = $(BUILD_DIR_BOARD)/$(LIBNAME).a -JNILIB = $(BUILD_DIR_BOARD)/$(LIBNAME).$(TARGET) -CONTIKI_APP_OBJ = $(CONTIKI_APP).o - -### COOJA platform sources -COOJA = $(ARCH_PATH)/platform/$(TARGET) -CONTIKI_TARGET_DIRS = . dev lib sys cfs net - -# (COOJA_SOURCEDIRS contains additional sources dirs set from simulator) -vpath %.c $(COOJA_SOURCEDIRS) - -COOJA_BASE = simEnvChange.c cooja_mt.c cooja_mtarch.c rtimer-arch.c slip.c watchdog.c int-master.c - -COOJA_INTFS = beep.c button-sensor.c ip.c leds-arch.c moteid.c \ - pir-sensor.c rs232.c vib-sensor.c \ - clock.c cooja-log.c cfs-cooja.c cooja-radio.c \ - eeprom.c slip-arch.c - -COOJA_CORE = random.c sensors.c leds.c - -# (COOJA_SOURCEFILES contains additional sources set from simulator) -CONTIKI_TARGET_SOURCEFILES = \ -$(COOJA_BASE) $(COOJA_INTFS) $(COOJA_CORE) $(COOJA_NET) $(COOJA_SOURCEFILES) - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -.SUFFIXES: - -CLEAN += COOJA.log - -### Define the CPU directory -CONTIKI_CPU=$(ARCH_PATH)/cpu/x86 - -### Compiler arguments -#CC = gcc -CFLAGSNO = $(EXTRA_CC_ARGS) -Wall -g -I/usr/local/include -DCLASSNAME=$(CLASSNAME) -ifeq ($(WERROR),1) -CFLAGSNO += -Werror -endif -CFLAGS += $(CFLAGSNO) diff --git a/arch/platform/cooja/Makefile.customrules-cooja b/arch/platform/cooja/Makefile.customrules-cooja deleted file mode 100644 index 60d6240f1..000000000 --- a/arch/platform/cooja/Makefile.customrules-cooja +++ /dev/null @@ -1,36 +0,0 @@ -### Define custom targets - -CUSTOM_RULE_C_TO_CE=1 -#CUSTOM_RULE_C_TO_OBJECTDIR_O=1 -CUSTOM_RULE_S_TO_OBJECTDIR_O=1 -#CUSTOM_RULE_C_TO_O=1 -#CUSTOM_RULE_C_TO_CO=1 -CUSTOM_RULE_ALLOBJS_TO_TARGETLIB=1 -CUSTOM_RULE_LINK=1 - -REDEF_PRINTF=1 # Redefine functions to enable printf()s inside Cooja - -# NB: Assumes ARCHIVE was not overridden and is in $(BUILD_DIR_BOARD) -$(ARCHIVE): $(CONTIKI_OBJECTFILES) | $(OBJECTDIR) - $(AR_COMMAND_1) $^ $(AR_COMMAND_2) - -# NB: Assumes JNILIB was not overridden and is in $(BUILD_DIR_BOARD) -$(JNILIB): $(CONTIKI_APP_OBJ) $(MAIN_OBJ) $(PROJECT_OBJECTFILES) $(ARCHIVE) | $(OBJECTDIR) - -ifdef REDEF_PRINTF - @echo Redefining printf - -$(foreach OBJ,$^, $(OBJCOPY) --redefine-sym printf=log_printf $(OBJ); ) - -$(foreach OBJ,$^, $(OBJCOPY) --redefine-sym puts=log_puts $(OBJ); ) - -$(foreach OBJ,$^, $(OBJCOPY) --redefine-sym putchar=log_putchar $(OBJ); ) -endif ## REDEF_PRINTF - $(LINK_COMMAND_1) $^ $(LINK_COMMAND_2) - -.PHONY: $(CONTIKI_APP).cooja -$(CONTIKI_APP).cooja: $(JNILIB) - cp $(JNILIB) $@ - rm $(CONTIKI_APP_OBJ) - -# Trickiness: GNU make matches this against the file base name. -# Assume that the directory part is the standard location. -mtype%.o: platform.o | $(OBJECTDIR) - mv platform.o $@ diff --git a/arch/platform/cooja/cfs/cfs-cooja.c b/arch/platform/cooja/cfs/cfs-cooja.c deleted file mode 100644 index 3150517b2..000000000 --- a/arch/platform/cooja/cfs/cfs-cooja.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#include -#include -#include "lib/simEnvChange.h" -#include "cfs/cfs.h" - -#define FLAG_FILE_CLOSED 0 -#define FLAG_FILE_OPEN 1 - -struct filestate { - char flag; - int access; - int fileptr; - int endptr; -}; - -static struct filestate file; - -const struct simInterface cfs_interface; - -// COOJA variables -#define CFS_BUF_SIZE 4000 /* Configure CFS size here and in ContikiCFS.java */ -char simCFSData[CFS_BUF_SIZE] = { 0 }; -int simCFSSize = 0; -char simCFSChanged = 0; -int simCFSRead = 0; -int simCFSWritten = 0; - -/*---------------------------------------------------------------------------*/ -int -cfs_open(const char *n, int f) -{ - if(file.flag == FLAG_FILE_CLOSED) { - file.flag = FLAG_FILE_OPEN; - file.access = f; - file.fileptr = 0; - file.endptr = simCFSSize; - if(f & CFS_WRITE) { - if(f & CFS_APPEND) { - file.fileptr = file.endptr; - } else { - file.endptr = 0; - } - } - return 0; - } else { - return -1; - } -} -/*---------------------------------------------------------------------------*/ -void -cfs_close(int f) -{ - file.flag = FLAG_FILE_CLOSED; -} -/*---------------------------------------------------------------------------*/ -int -cfs_read(int f, void *buf, unsigned int len) -{ - if(file.flag == FLAG_FILE_OPEN && file.access & CFS_READ) { - if(file.fileptr + len >= file.endptr) { - len = file.endptr - file.fileptr; - } - memcpy(buf, &simCFSData[file.fileptr], len); - file.fileptr += len; - simCFSChanged = 1; - simCFSRead += len; - return len; - } else { - return -1; - } -} -/*---------------------------------------------------------------------------*/ -int -cfs_write(int f, const void *buf, unsigned int len) -{ - if(file.flag == FLAG_FILE_OPEN && file.access & CFS_WRITE) { - if(file.fileptr + len > CFS_BUF_SIZE) { - len = CFS_BUF_SIZE - file.fileptr; - printf("cfs-cooja.c: warning: write truncated\n"); - } - memcpy(&simCFSData[file.fileptr], buf, len); - file.fileptr += len; - simCFSChanged = 1; - simCFSWritten += len; - if(file.fileptr > file.endptr) { - file.endptr = file.fileptr; - } - if(file.fileptr > simCFSSize) { - simCFSSize = file.fileptr; - } - return len; - } else { - return -1; - } -} -/*---------------------------------------------------------------------------*/ -cfs_offset_t -cfs_seek(int f, cfs_offset_t o, int w) -{ - if(file.flag == FLAG_FILE_OPEN) { - if(w == CFS_SEEK_SET) { - file.fileptr = o; - } else if(w == CFS_SEEK_CUR) { - file.fileptr += o; - } else if(w == CFS_SEEK_END) { - file.fileptr = file.endptr + o; - } - if(file.fileptr >= 0 && file.fileptr <= CFS_BUF_SIZE) { - if(file.fileptr > file.endptr) { - file.endptr = file.fileptr; - } - return file.fileptr; - } - } - return -1; -} -/*---------------------------------------------------------------------------*/ -int -cfs_remove(const char *name) -{ - memset(simCFSData, 0, sizeof(simCFSData)); - return 0; -} -/*---------------------------------------------------------------------------*/ -int -cfs_opendir(struct cfs_dir *p, const char *n) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -int -cfs_readdir(struct cfs_dir *p, struct cfs_dirent *e) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -void -cfs_closedir(struct cfs_dir *p) -{ -} -/*---------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ -} -/*---------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*---------------------------------------------------------------------------*/ -SIM_INTERFACE(cfs_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/cooja/contiki-conf.h b/arch/platform/cooja/contiki-conf.h deleted file mode 100644 index 44c984dbf..000000000 --- a/arch/platform/cooja/contiki-conf.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 CONTIKI_CONF_H_ -#define CONTIKI_CONF_H_ - -/* include the project config */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif /* PROJECT_CONF_PATH */ - -#ifdef INCLUDE_SUBPLATFORM_CONF -#include "subplatform-conf.h" -#endif /* INCLUDE_SUBPLATFORM_CONF */ - -#define PLATFORM_CONF_PROVIDES_MAIN_LOOP 1 - -#define LOG_CONF_ENABLED 1 - -#define COOJA 1 - -#define LEDS_CONF_LEGACY_API 1 - -#ifndef EEPROM_CONF_SIZE -#define EEPROM_CONF_SIZE 1024 -#endif - -#define w_memcpy memcpy - -#ifdef NETSTACK_CONF_H - -/* These header overrides the below default configuration */ -#define NETSTACK__QUOTEME(s) NETSTACK_QUOTEME(s) -#define NETSTACK_QUOTEME(s) #s -#include NETSTACK__QUOTEME(NETSTACK_CONF_H) - -#else /* NETSTACK_CONF_H */ - -/* Default network config */ -#define CSMA_CONF_SEND_SOFT_ACK 1 -#define CSMA_CONF_ACK_WAIT_TIME RTIMER_SECOND / 500 -#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME 0 - -/* Radio setup */ -#define NETSTACK_CONF_RADIO cooja_radio_driver - -#endif /* NETSTACK_CONF_H */ - -/* Default network config */ -#if NETSTACK_CONF_WITH_IPV6 - - - -/* Radio setup */ -#define NETSTACK_CONF_RADIO cooja_radio_driver - -/* configure network size and density */ -#ifndef NETSTACK_MAX_ROUTE_ENTRIES -#define NETSTACK_MAX_ROUTE_ENTRIES 300 -#endif /* NETSTACK_MAX_ROUTE_ENTRIES */ -#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS -#define NBR_TABLE_CONF_MAX_NEIGHBORS 300 -#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ - -/* configure queues */ -#ifndef QUEUEBUF_CONF_NUM -#define QUEUEBUF_CONF_NUM 64 -#endif /* QUEUEBUF_CONF_NUM */ - -#ifndef UIP_CONF_IPV6_QUEUE_PKT -#define UIP_CONF_IPV6_QUEUE_PKT 1 -#endif /* UIP_CONF_IPV6_QUEUE_PKT */ - -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -#define CC_CONF_REGISTER_ARGS 1 -#define CC_CONF_FUNCTION_POINTER_ARGS 1 -#define CC_CONF_VA_ARGS 1 -#define CC_CONF_INLINE inline - -/* These names are deprecated, use C99 names. */ -#include -typedef uint8_t u8_t; -typedef uint16_t u16_t; -typedef uint32_t u32_t; -typedef int32_t s32_t; - -typedef unsigned short uip_stats_t; - -#define CLOCK_CONF_SECOND 1000L -typedef unsigned long clock_time_t; - -/* Use 64-bit rtimer (default in Contiki-NG is 32) */ -#define RTIMER_CONF_CLOCK_SIZE 8 - -/* 1 len byte, 2 bytes CRC */ -#define RADIO_PHY_OVERHEAD 3 -/* 250kbps data rate. One byte = 32us */ -#define RADIO_BYTE_AIR_TIME 32 -#define RADIO_DELAY_BEFORE_TX 0 -#define RADIO_DELAY_BEFORE_RX 0 -#define RADIO_DELAY_BEFORE_DETECT 0 - -#define UIP_ARCH_IPCHKSUM 1 - -#if MAC_CONF_WITH_TSCH -/* A bug in cooja causes many EBs to be missed at scan. Increase EB - frequency to shorten the join process */ -#undef TSCH_CONF_EB_PERIOD -#define TSCH_CONF_EB_PERIOD (4 * CLOCK_SECOND) -#undef TSCH_CONF_MAX_EB_PERIOD -#define TSCH_CONF_MAX_EB_PERIOD (4 * CLOCK_SECOND) -#endif /* MAC_CONF_WITH_TSCH */ - -#define CFS_CONF_OFFSET_TYPE long - -#define NETSTACK_RADIO_MAX_PAYLOAD_LEN 125 - -#define PLATFORM_CONF_SUPPORTS_STACK_CHECK 0 - -#endif /* CONTIKI_CONF_H_ */ diff --git a/arch/platform/cooja/dev/beep.c b/arch/platform/cooja/dev/beep.c deleted file mode 100644 index e479998ef..000000000 --- a/arch/platform/cooja/dev/beep.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "dev/beep.h" -#include "lib/simEnvChange.h" - -const struct simInterface beep_interface; - -// COOJA variables -char simBeeped; - -/*-----------------------------------------------------------------------------------*/ -void -beep_alarm(int alarmmode, int len) -{ - simBeeped = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_beep(int i) -{ - simBeeped = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -beep(void) -{ - simBeeped = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_down(int d) -{ - simBeeped = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_on(void) -{ - simBeeped = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_off(void) -{ - simBeeped = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_spinup(void) -{ - simBeeped = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_quick(int n) -{ - simBeeped = 1; -} -/*-----------------------------------------------------------------------------------*/ -void beep_long(clock_time_t len) -{ - simBeeped = 1; -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ - -SIM_INTERFACE(beep_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); diff --git a/arch/platform/cooja/dev/beep.h b/arch/platform/cooja/dev/beep.h deleted file mode 100644 index d228fc613..000000000 --- a/arch/platform/cooja/dev/beep.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 BEEP_H_ -#define BEEP_H_ - -#include "sys/clock.h" - -#define BEEP_ON 1 -#define BEEP_OFF 0 - -#define BEEP_ALARM1 1 -#define BEEP_ALARM2 2 - -void beep_beep(int len); - -void beep_alarm(int alarmmode, int len); - -void beep(void); - -void beep_down(int len); - -void beep_on(void); - -void beep_off(void); - -void beep_spinup(void); - -void beep_long(clock_time_t len); - -void beep_quick(int num); - -#endif /* BEEP_H_ */ diff --git a/arch/platform/cooja/dev/button-sensor.c b/arch/platform/cooja/dev/button-sensor.c deleted file mode 100644 index 90f2dd26c..000000000 --- a/arch/platform/cooja/dev/button-sensor.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "lib/sensors.h" -#include "dev/button-sensor.h" -#include "lib/simEnvChange.h" - -const struct simInterface button_interface; -const struct sensors_sensor button_sensor; -static struct timer debouncetimer; - -// COOJA variables -char simButtonChanged; -char simButtonIsDown; -char simButtonIsActive; -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return simButtonIsDown || !timer_expired(&debouncetimer); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - if(type == SENSORS_ACTIVE) { - simButtonIsActive = c; - return 1; - } else if(type == SENSORS_HW_INIT) { - simButtonIsActive = 1; - timer_set(&debouncetimer, 0); - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return (type == SENSORS_ACTIVE) ? simButtonIsActive : 0; -} -/*---------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ - // Check if button value has changed - if(simButtonChanged && simButtonIsActive && simButtonIsDown) { - if(timer_expired(&debouncetimer)) { - timer_set(&debouncetimer, CLOCK_SECOND / 10); - sensors_changed(&button_sensor); - } - } - simButtonChanged = 0; -} -/*---------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*---------------------------------------------------------------------------*/ - -SIM_INTERFACE(button_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); - -SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, - value, configure, status); diff --git a/arch/platform/cooja/dev/button-sensor.h b/arch/platform/cooja/dev/button-sensor.h deleted file mode 100644 index 1f1fb0fbc..000000000 --- a/arch/platform/cooja/dev/button-sensor.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 BUTTON_SENSOR_H_ -#define BUTTON_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor button_sensor; - -#define BUTTON_SENSOR "Button" - -#endif /* BUTTON_SENSOR_H_ */ diff --git a/arch/platform/cooja/dev/cooja-radio.c b/arch/platform/cooja/dev/cooja-radio.c deleted file mode 100644 index f0dee567b..000000000 --- a/arch/platform/cooja/dev/cooja-radio.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 -#include - -#include "contiki.h" - -#include "sys/cooja_mt.h" -#include "lib/simEnvChange.h" - -#include "net/packetbuf.h" -#include "net/netstack.h" - -#include "dev/radio.h" -#include "dev/cooja-radio.h" - -#define COOJA_RADIO_BUFSIZE PACKETBUF_SIZE -#define CCA_SS_THRESHOLD -95 - -const struct simInterface radio_interface; - -/* COOJA */ -char simReceiving = 0; -char simInDataBuffer[COOJA_RADIO_BUFSIZE]; -int simInSize = 0; -rtimer_clock_t simLastPacketTimestamp = 0; -char simOutDataBuffer[COOJA_RADIO_BUFSIZE]; -int simOutSize = 0; -char simRadioHWOn = 1; -int simSignalStrength = -100; -int simLastSignalStrength = -100; -char simPower = 100; -int simRadioChannel = 26; -int simLQI = 105; - -static const void *pending_data; - -/* If we are in the polling mode, poll_mode is 1; otherwise 0 */ -static int poll_mode = 0; /* default 0, disabled */ -static int auto_ack = 0; /* AUTO_ACK is not supported; always 0 */ -static int addr_filter = 0; /* ADDRESS_FILTER is not supported; always 0 */ -static int send_on_cca = (COOJA_TRANSMIT_ON_CCA != 0); - -PROCESS(cooja_radio_process, "cooja radio process"); -/*---------------------------------------------------------------------------*/ -static void -set_send_on_cca(uint8_t enable) -{ - send_on_cca = enable; -} -/*---------------------------------------------------------------------------*/ -static void -set_frame_filtering(int enable) -{ - addr_filter = enable; -} -/*---------------------------------------------------------------------------*/ -static void -set_auto_ack(int enable) -{ - auto_ack = enable; -} -/*---------------------------------------------------------------------------*/ -static void -set_poll_mode(int enable) -{ - poll_mode = enable; -} -/*---------------------------------------------------------------------------*/ -void -radio_set_channel(int channel) -{ - simRadioChannel = channel; -} -/*---------------------------------------------------------------------------*/ -void -radio_set_txpower(unsigned char power) -{ - /* 1 - 100: Number indicating output power */ - simPower = power; -} -/*---------------------------------------------------------------------------*/ -int -radio_signal_strength_last(void) -{ - return simLastSignalStrength; -} -/*---------------------------------------------------------------------------*/ -int -radio_signal_strength_current(void) -{ - return simSignalStrength; -} -/*---------------------------------------------------------------------------*/ -int -radio_LQI(void) -{ - return simLQI; -} -/*---------------------------------------------------------------------------*/ -static int -radio_on(void) -{ - simRadioHWOn = 1; - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -radio_off(void) -{ - simRadioHWOn = 0; - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ - if(!simRadioHWOn) { - simInSize = 0; - return; - } - if(simReceiving) { - simLastSignalStrength = simSignalStrength; - return; - } - - if(simInSize > 0) { - process_poll(&cooja_radio_process); - } -} -/*---------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*---------------------------------------------------------------------------*/ -static int -radio_read(void *buf, unsigned short bufsize) -{ - int tmp = simInSize; - - if(simInSize == 0) { - return 0; - } - if(bufsize < simInSize) { - simInSize = 0; /* rx flush */ - return 0; - } - - memcpy(buf, simInDataBuffer, simInSize); - simInSize = 0; - if(!poll_mode) { - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, simSignalStrength); - packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, simLQI); - } - - return tmp; -} -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - if(simSignalStrength > CCA_SS_THRESHOLD) { - return 0; - } - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -radio_send(const void *payload, unsigned short payload_len) -{ - int radiostate = simRadioHWOn; - - /* Simulate turnaround time of 2ms for packets, 1ms for acks*/ -#if COOJA_SIMULATE_TURNAROUND - simProcessRunValue = 1; - cooja_mt_yield(); - if(payload_len > 3) { - simProcessRunValue = 1; - cooja_mt_yield(); - } -#endif /* COOJA_SIMULATE_TURNAROUND */ - - if(!simRadioHWOn) { - /* Turn on radio temporarily */ - simRadioHWOn = 1; - } - if(payload_len > COOJA_RADIO_BUFSIZE) { - return RADIO_TX_ERR; - } - if(payload_len == 0) { - return RADIO_TX_ERR; - } - if(simOutSize > 0) { - return RADIO_TX_ERR; - } - - /* Transmit on CCA */ -#if COOJA_TRANSMIT_ON_CCA - if(send_on_cca && !channel_clear()) { - return RADIO_TX_COLLISION; - } -#endif /* COOJA_TRANSMIT_ON_CCA */ - - /* Copy packet data to temporary storage */ - memcpy(simOutDataBuffer, payload, payload_len); - simOutSize = payload_len; - - /* Transmit */ - while(simOutSize > 0) { - cooja_mt_yield(); - } - - simRadioHWOn = radiostate; - return RADIO_TX_OK; -} -/*---------------------------------------------------------------------------*/ -static int -prepare_packet(const void *data, unsigned short len) -{ - pending_data = data; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -transmit_packet(unsigned short len) -{ - int ret = RADIO_TX_ERR; - if(pending_data != NULL) { - ret = radio_send(pending_data, len); - } - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - return simReceiving; -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - return !simReceiving && simInSize > 0; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cooja_radio_process, ev, data) -{ - int len; - - PROCESS_BEGIN(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - if(poll_mode) { - continue; - } - - packetbuf_clear(); - len = radio_read(packetbuf_dataptr(), PACKETBUF_SIZE); - if(len > 0) { - packetbuf_set_datalen(len); - NETSTACK_MAC.input(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static int -init(void) -{ - process_start(&cooja_radio_process, NULL); - return 1; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - switch(param) { - case RADIO_PARAM_RX_MODE: - *value = 0; - if(addr_filter) { - *value |= RADIO_RX_MODE_ADDRESS_FILTER; - } - if(auto_ack) { - *value |= RADIO_RX_MODE_AUTOACK; - } - if(poll_mode) { - *value |= RADIO_RX_MODE_POLL_MODE; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_TX_MODE: - *value = 0; - if(send_on_cca) { - *value |= RADIO_TX_MODE_SEND_ON_CCA; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_RSSI: - *value = simSignalStrength; - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_LINK_QUALITY: - *value = simLQI; - return RADIO_RESULT_OK; - case RADIO_PARAM_RSSI: - /* return a fixed value depending on the channel */ - *value = -90 + simRadioChannel - 11; - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - switch(param) { - case RADIO_PARAM_RX_MODE: - if(value & ~(RADIO_RX_MODE_ADDRESS_FILTER | - RADIO_RX_MODE_AUTOACK | RADIO_RX_MODE_POLL_MODE)) { - return RADIO_RESULT_INVALID_VALUE; - } - - /* Only disabling is acceptable for RADIO_RX_MODE_ADDRESS_FILTER */ - if ((value & RADIO_RX_MODE_ADDRESS_FILTER) != 0) { - return RADIO_RESULT_NOT_SUPPORTED; - } - set_frame_filtering((value & RADIO_RX_MODE_ADDRESS_FILTER) != 0); - - /* Only disabling is acceptable for RADIO_RX_MODE_AUTOACK */ - if ((value & RADIO_RX_MODE_ADDRESS_FILTER) != 0) { - return RADIO_RESULT_NOT_SUPPORTED; - } - set_auto_ack((value & RADIO_RX_MODE_AUTOACK) != 0); - - set_poll_mode((value & RADIO_RX_MODE_POLL_MODE) != 0); - return RADIO_RESULT_OK; - case RADIO_PARAM_TX_MODE: - if(value & ~(RADIO_TX_MODE_SEND_ON_CCA)) { - return RADIO_RESULT_INVALID_VALUE; - } - set_send_on_cca((value & RADIO_TX_MODE_SEND_ON_CCA) != 0); - return RADIO_RESULT_OK; - case RADIO_PARAM_CHANNEL: - if(value < 11 || value > 26) { - return RADIO_RESULT_INVALID_VALUE; - } - radio_set_channel(value); - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - if(param == RADIO_PARAM_LAST_PACKET_TIMESTAMP) { - if(size != sizeof(rtimer_clock_t) || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - *(rtimer_clock_t *)dest = (rtimer_clock_t)simLastPacketTimestamp; - return RADIO_RESULT_OK; - } - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -const struct radio_driver cooja_radio_driver = -{ - init, - prepare_packet, - transmit_packet, - radio_send, - radio_read, - channel_clear, - receiving_packet, - pending_packet, - radio_on, - radio_off, - get_value, - set_value, - get_object, - set_object -}; -/*---------------------------------------------------------------------------*/ -SIM_INTERFACE(radio_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); diff --git a/arch/platform/cooja/dev/cooja-radio.h b/arch/platform/cooja/dev/cooja-radio.h deleted file mode 100644 index ee5e9097d..000000000 --- a/arch/platform/cooja/dev/cooja-radio.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef COOJA_RADIO_H_ -#define COOJA_RADIO_H_ - -#include "contiki.h" -#include "dev/radio.h" - -#ifdef COOJA_CONF_SIMULATE_TURNAROUND -#define COOJA_SIMULATE_TURNAROUND COOJA_CONF_SIMULATE_TURNAROUND -#else -#define COOJA_SIMULATE_TURNAROUND (!(MAC_CONF_WITH_TSCH)) -#endif - -#ifdef COOJA_CONF_TRANSMIT_ON_CCA -#define COOJA_TRANSMIT_ON_CCA COOJA_CONF_TRANSMIT_ON_CCA -#else -#define COOJA_TRANSMIT_ON_CCA 1 -#endif - -extern const struct radio_driver cooja_radio_driver; - -/** - * Set radio channel. - */ -void -radio_set_channel(int channel); - -/** - * Set transmission power of transceiver. - * - * \param p The power of the transceiver, between 1 and 100. - */ -void -radio_set_txpower(unsigned char p); - -/** - * The signal strength of the last received packet - */ -int -radio_signal_strength_last(void); - -/** - * This current signal strength. - */ -int -radio_signal_strength_current(void); - -/** - * Link quality indicator of last received packet. - */ -int -radio_LQI(void); - - -#endif /* COOJA_RADIO_H_ */ diff --git a/arch/platform/cooja/dev/eeprom.c b/arch/platform/cooja/dev/eeprom.c deleted file mode 100644 index 026c10f26..000000000 --- a/arch/platform/cooja/dev/eeprom.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2014, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 -#include "dev/eeprom.h" - -#include "lib/simEnvChange.h" - -const struct simInterface eeprom_interface; - -#define EEPROM_BUF_SIZE 1024 /* Configure EEPROM size here and in ContikiEeprom.java */ - -unsigned char simEEPROMData[EEPROM_BUF_SIZE]; -char simEEPROMChanged = 0; -int simEEPROMRead = 0; -int simEEPROMWritten = 0; - -void -eeprom_init(void) -{ -} - -void -eeprom_read(eeprom_addr_t addr, unsigned char *buf, int len) -{ - if (addr >= EEPROM_BUF_SIZE) { - return; - } - - if(addr + len >= EEPROM_BUF_SIZE) { - len = EEPROM_BUF_SIZE - addr; - } - - memcpy(buf, &simEEPROMData[addr], len); - - simEEPROMChanged = 1; - simEEPROMRead += len; -} - -void -eeprom_write(eeprom_addr_t addr, unsigned char *buf, int len) -{ - if (addr >= EEPROM_BUF_SIZE) { - return; - } - - if(addr + len >= EEPROM_BUF_SIZE) { - len = EEPROM_BUF_SIZE - addr; - } - - - memcpy(&simEEPROMData[addr], buf, len); - - simEEPROMChanged = 1; - simEEPROMWritten += len; - -} - -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ - -SIM_INTERFACE(eeprom_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); diff --git a/arch/platform/cooja/dev/ip.c b/arch/platform/cooja/dev/ip.c deleted file mode 100644 index 7e942215c..000000000 --- a/arch/platform/cooja/dev/ip.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "dev/ip.h" -#include "lib/simEnvChange.h" - -#include "net/ipv6/uip.h" - -const struct simInterface ip_interface; - -// COOJA variables - -#if NETSTACK_CONF_WITH_IPV6 - -char simIPChanged; -char simIP[16]; - -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ -#if NETSTACK_CONF_WITH_IPV6 - - /* check if IPv6 address should change */ - -#endif /* NETSTACK_CONF_WITH_IPV6 */ -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ - -SIM_INTERFACE(ip_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); diff --git a/arch/platform/cooja/dev/ip.h b/arch/platform/cooja/dev/ip.h deleted file mode 100644 index 57ff9c046..000000000 --- a/arch/platform/cooja/dev/ip.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 IP_H_ -#define IP_H_ - -#endif /* IP_H_ */ diff --git a/arch/platform/cooja/dev/leds-arch.c b/arch/platform/cooja/dev/leds-arch.c deleted file mode 100644 index b65df2945..000000000 --- a/arch/platform/cooja/dev/leds-arch.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "dev/leds.h" -#include "lib/simEnvChange.h" - -const struct simInterface leds_interface; - -// COOJA variables -leds_mask_t simLedsValue; - -/*-----------------------------------------------------------------------------------*/ -void leds_arch_init() { - simLedsValue = 0; -} -/*-----------------------------------------------------------------------------------*/ -leds_mask_t leds_arch_get() { - return simLedsValue; -} -/*-----------------------------------------------------------------------------------*/ -void leds_arch_set(leds_mask_t leds) { - if(leds != simLedsValue) { - simLedsValue = leds; - } -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ - -SIM_INTERFACE(leds_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); diff --git a/arch/platform/cooja/dev/moteid.c b/arch/platform/cooja/dev/moteid.c deleted file mode 100644 index 02321563f..000000000 --- a/arch/platform/cooja/dev/moteid.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "dev/moteid.h" -#include "lib/simEnvChange.h" -#include "lib/random.h" - -const struct simInterface moteid_interface; - -// COOJA variables -int simMoteID; -char simMoteIDChanged; -int simRandomSeed; - -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ - if (simMoteIDChanged) { - simMoteIDChanged = 0; - random_init(simRandomSeed); - } -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ - -SIM_INTERFACE(moteid_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); diff --git a/arch/platform/cooja/dev/moteid.h b/arch/platform/cooja/dev/moteid.h deleted file mode 100644 index 18aada16d..000000000 --- a/arch/platform/cooja/dev/moteid.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 MOTEID_H_ -#define MOTEID_H_ - -extern int simMoteID; - -#endif /* MOTEID_H_ */ diff --git a/arch/platform/cooja/dev/pir-sensor.c b/arch/platform/cooja/dev/pir-sensor.c deleted file mode 100644 index 8e3b4e045..000000000 --- a/arch/platform/cooja/dev/pir-sensor.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "dev/pir-sensor.h" -#include "lib/simEnvChange.h" - -const struct simInterface pir_interface; -const struct sensors_sensor pir_sensor; - -// COOJA variables -char simPirChanged; -char simPirIsActive; -char simPirValue = 0; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return simPirValue; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - switch(type) { - case SENSORS_HW_INIT: - simPirIsActive = 0; - return 1; - case SENSORS_ACTIVE: - simPirIsActive = c; - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return simPirIsActive; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ - // Check if PIR value has changed - if (simPirIsActive && simPirChanged) { - simPirValue++; - - sensors_changed(&pir_sensor); - simPirChanged = 0; - } -} -/*---------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*---------------------------------------------------------------------------*/ - -SIM_INTERFACE(pir_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); - -SENSORS_SENSOR(pir_sensor, PIR_SENSOR, - value, configure, status); diff --git a/arch/platform/cooja/dev/pir-sensor.h b/arch/platform/cooja/dev/pir-sensor.h deleted file mode 100644 index aa2c1eef4..000000000 --- a/arch/platform/cooja/dev/pir-sensor.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 PIR_H_ -#define PIR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor pir_sensor; - -#define PIR_SENSOR "PIR" - -#endif /* PIR_H_ */ diff --git a/arch/platform/cooja/dev/rs232.c b/arch/platform/cooja/dev/rs232.c deleted file mode 100644 index 08257b555..000000000 --- a/arch/platform/cooja/dev/rs232.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "lib/sensors.h" -#include "dev/rs232.h" -#include "dev/serial-line.h" -#include "lib/simEnvChange.h" -#include -#include - -const struct simInterface rs232_interface; - -#define SERIAL_BUF_SIZE 2048 - -// COOJA variables -char simSerialReceivingData[SERIAL_BUF_SIZE]; -int simSerialReceivingLength; -char simSerialReceivingFlag; - -static int (* input_handler)(unsigned char) = NULL; - -void simlog_char(char c); -/*-----------------------------------------------------------------------------------*/ -void rs232_init(void) { } -/*-----------------------------------------------------------------------------------*/ -void rs232_set_speed(unsigned char speed) { } -/*-----------------------------------------------------------------------------------*/ -void -rs232_set_input(int (*f)(unsigned char)) -{ - input_handler = f; -} -/*-----------------------------------------------------------------------------------*/ -void rs232_send(char c) { - printf("%c", c); -} -/*-----------------------------------------------------------------------------------*/ -void -rs232_print(char *message) -{ - printf("%s", message); -} -/*-----------------------------------------------------------------------------------*/ -void -slip_arch_writeb(unsigned char c) -{ - simlog_char(c); -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ - int i; - - if (!simSerialReceivingFlag) { - return; - } - - if (simSerialReceivingLength == 0) { - /* Error, should not be zero */ - simSerialReceivingFlag = 0; - return; - } - - /* Notify specified rs232 handler */ - if(input_handler != NULL) { - for (i=0; i < simSerialReceivingLength; i++) { - input_handler(simSerialReceivingData[i]); - } - } else { - /* Notify serial process */ - for (i=0; i < simSerialReceivingLength; i++) { - serial_line_input_byte(simSerialReceivingData[i]); - } - serial_line_input_byte(0x0a); - } - - simSerialReceivingLength = 0; - simSerialReceivingFlag = 0; -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ - -SIM_INTERFACE(rs232_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); diff --git a/arch/platform/cooja/dev/rs232.h b/arch/platform/cooja/dev/rs232.h deleted file mode 100644 index d21c549b0..000000000 --- a/arch/platform/cooja/dev/rs232.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - - -/** - * \file - * Header file for COOJA RS232 driver. - * \author Adam Dunkels - * - */ -#ifndef RS232_H_ -#define RS232_H_ - - -#define RS232_19200 1 -#define RS232_38400 2 -#define RS232_57600 3 -#define RS232_115200 4 - -/** - * \brief Initialize the RS232 module - * - * This function is called from the boot up code to - * initalize the RS232 module. - */ -void rs232_init(void); - -/** - * \brief Set an input handler for incoming RS232 data - * \param f A pointer to a byte input handler - * - * This function sets the input handler for incoming RS232 - * data. The input handler function is called for every - * incoming data byte. The function is called from the - * RS232 interrupt handler, so care must be taken when - * implementing the input handler to avoid race - * conditions. - * - * The return value of the input handler affects the sleep - * mode of the CPU: if the input handler returns non-zero - * (true), the CPU is awakened to let other processing - * take place. If the input handler returns zero, the CPU - * is kept sleeping. - */ -void rs232_set_input(int (* f)(unsigned char)); - -/** - * \brief Configure the speed of the RS232 hardware - * \param speed The speed - * - * This function configures the speed of the RS232 - * hardware. The allowed parameters are RS232_19200, - * RS232_38400, RS232_57600, and RS232_115200. - */ -void rs232_set_speed(unsigned char speed); - -/** - * \brief Print a text string on RS232 - * \param text A pointer to the string that is to be printed - * - * This function prints a string to RS232. The string must - * be terminated by a null byte. The RS232 module must be - * correctly initalized and configured for this function - * to work. - */ -void rs232_print(char *text); - -/** - * \brief Print a character on RS232 - * \param c The character to be printed - * - * This function prints a character to RS232. The RS232 - * module must be correctly initalized and configured for - * this function to work. - */ -void rs232_send(char c); - -#endif /* RS232_H_ */ - diff --git a/arch/platform/cooja/dev/vib-sensor.c b/arch/platform/cooja/dev/vib-sensor.c deleted file mode 100644 index 56d915d61..000000000 --- a/arch/platform/cooja/dev/vib-sensor.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "dev/vib-sensor.h" -#include "lib/simEnvChange.h" - -const struct simInterface vib_interface; -const struct sensors_sensor vib_sensor; - -// COOJA variables -char simVibChanged; -char simVibIsActive; -char simVibValue = 0; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return simVibValue; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - switch(type) { - case SENSORS_HW_INIT: - simVibIsActive = 0; - return 1; - case SENSORS_ACTIVE: - simVibIsActive = c; - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return simVibIsActive; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ - // Check if Vib value has changed - if (simVibIsActive && simVibChanged) { - simVibValue++; - - sensors_changed(&vib_sensor); - simVibChanged = 0; - } -} -/*---------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*---------------------------------------------------------------------------*/ - -SIM_INTERFACE(vib_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); - -SENSORS_SENSOR(vib_sensor, VIB_SENSOR, - value, configure, status); diff --git a/arch/platform/cooja/dev/vib-sensor.h b/arch/platform/cooja/dev/vib-sensor.h deleted file mode 100644 index bd12097c9..000000000 --- a/arch/platform/cooja/dev/vib-sensor.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 VIB_H_ -#define VIB_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor vib_sensor; - -#define VIB_SENSOR "Vibration" - -#endif /* VIB_H_ */ diff --git a/arch/platform/cooja/dev/watchdog.c b/arch/platform/cooja/dev/watchdog.c deleted file mode 100644 index 347d9a996..000000000 --- a/arch/platform/cooja/dev/watchdog.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - - /* Dummy watchdog routines for Cooja motes */ -#include "dev/watchdog.h" -#include "lib/simEnvChange.h" -#include "sys/cooja_mt.h" - -/*---------------------------------------------------------------------------*/ -void -watchdog_init(void) -{ -} -/*---------------------------------------------------------------------------*/ -void -watchdog_start(void) -{ -} -/*---------------------------------------------------------------------------*/ -void -watchdog_periodic(void) -{ - /* Yield and give control back to the simulator scheduler */ - simProcessRunValue = 1; - cooja_mt_yield(); -} -/*---------------------------------------------------------------------------*/ -void -watchdog_stop(void) -{ -} -/*---------------------------------------------------------------------------*/ -void -watchdog_reboot(void) -{ -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/cooja/doxygen-group.txt b/arch/platform/cooja/doxygen-group.txt deleted file mode 100644 index ce6c60b0d..000000000 --- a/arch/platform/cooja/doxygen-group.txt +++ /dev/null @@ -1,4 +0,0 @@ -/** - * \defgroup cooja COOJA network simulator node - * \ingroup platform - */ diff --git a/arch/platform/cooja/int-master.c b/arch/platform/cooja/int-master.c deleted file mode 100644 index 177dbd442..000000000 --- a/arch/platform/cooja/int-master.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "sys/int-master.h" - -#include -/*---------------------------------------------------------------------------*/ -#define DISABLED 0 -#define ENABLED 1 -/*---------------------------------------------------------------------------*/ -static int_master_status_t stat = DISABLED; -/*---------------------------------------------------------------------------*/ -void -int_master_enable(void) -{ - stat = ENABLED; -} -/*---------------------------------------------------------------------------*/ -int_master_status_t -int_master_read_and_disable(void) -{ - int_master_status_t rv = stat; - stat = DISABLED; - return rv; -} -/*---------------------------------------------------------------------------*/ -void -int_master_status_set(int_master_status_t status) -{ - stat = status; -} -/*---------------------------------------------------------------------------*/ -bool -int_master_is_enabled(void) -{ - return stat == DISABLED ? false : true; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/cooja/lib/simEnvChange.c b/arch/platform/cooja/lib/simEnvChange.c deleted file mode 100644 index f6060b449..000000000 --- a/arch/platform/cooja/lib/simEnvChange.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "lib/simEnvChange.h" - -#include -#include - -// All registered interfaces -extern const struct simInterface *simInterfaces[]; - -char simDontFallAsleep = 0; - -int simProcessRunValue; -int simEtimerPending; -clock_time_t simEtimerNextExpirationTime; - -void doActionsBeforeTick() { - // Poll all interfaces to do their thing before the tick - int i; - for(i = 0; simInterfaces[i] != NULL; ++i) { - simInterfaces[i]->doActionsBeforeTick(); - } -} - -void doActionsAfterTick() { - // Poll all interfaces to do their thing after the tick - int i; - for(i = 0; simInterfaces[i] != NULL; ++i) { - simInterfaces[i]->doActionsAfterTick(); - } -} diff --git a/arch/platform/cooja/lib/simEnvChange.h b/arch/platform/cooja/lib/simEnvChange.h deleted file mode 100644 index 7723eb16f..000000000 --- a/arch/platform/cooja/lib/simEnvChange.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 SIMENVCHANGE_H_ -#define SIMENVCHANGE_H_ - -#include "contiki.h" - -/* Simulation interface structure */ -struct simInterface { - void (* doActionsBeforeTick) (void); - void (* doActionsAfterTick) (void); -}; - -// Variable for keeping the last process_run() return value -extern int simProcessRunValue; -extern int simEtimerPending; -extern clock_time_t simEtimerNextExpirationTime; -extern clock_time_t simCurrentTime; - -// Variable that when set to != 0, stops the mote from falling asleep next tick -extern char simDontFallAsleep; - -// Definition for registering an interface -#define SIM_INTERFACE(name, doActionsBeforeTick, doActionsAfterTick) \ -const struct simInterface name = { doActionsBeforeTick, doActionsAfterTick } - -// Definition for getting access to simulation interface -#define SIM_INTERFACE_NAME(name) \ -extern const struct simInterface name - -// Definition for creating all interface (from main file) -#define SIM_INTERFACES(...) \ -const struct simInterface *simInterfaces[] = {__VA_ARGS__, NULL}; - -// Functions which polls all interfaces -void doActionsBeforeTick(); -void doActionsAfterTick(); - -#endif /* SIMENVCHANGE_H_ */ diff --git a/arch/platform/cooja/mtarch.c b/arch/platform/cooja/mtarch.c deleted file mode 100644 index 832043ac7..000000000 --- a/arch/platform/cooja/mtarch.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Oliver Schmidt - * - */ - -#include "mtarch.h" - -/*--------------------------------------------------------------------------*/ -void -mtarch_init(void) -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_remove(void) -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_start(struct mtarch_thread *thread, - void (* function)(void *data), - void *data) -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_yield(void) -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_exec(struct mtarch_thread *thread) -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_stop(struct mtarch_thread *thread) -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_pstart(void) -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_pstop(void) -{ -} -/*--------------------------------------------------------------------------*/ diff --git a/arch/platform/cooja/mtarch.h b/arch/platform/cooja/mtarch.h deleted file mode 100644 index 1244f9a4a..000000000 --- a/arch/platform/cooja/mtarch.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef MTARCH_H_ -#define MTARCH_H_ - -struct mtarch_thread { - void *mt_thread; -}; - -#endif /* MTARCH_H_ */ diff --git a/arch/platform/cooja/net/init-net.h b/arch/platform/cooja/net/init-net.h deleted file mode 100644 index 1f45b30eb..000000000 --- a/arch/platform/cooja/net/init-net.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Configurable Sensor Network Application - * Architecture for sensor nodes running the Contiki operating system. - * - * - */ - -#ifndef INIT_NET_H_ -#define INIT_NET_H_ - -void -init_net(void); - -#endif /* INIT_NET_H_ */ diff --git a/arch/platform/cooja/net/uip-driver.c b/arch/platform/cooja/net/uip-driver.c deleted file mode 100644 index fd86cc9c6..000000000 --- a/arch/platform/cooja/net/uip-driver.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A brief description of what this file is - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "net/netstack.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/tcpip.h" -#include "net/packetbuf.h" -#include "net/uip-driver.h" -#include "net/linkaddr.h" -#include - -/*--------------------------------------------------------------------*/ -static uint8_t -uip_driver_send(const linkaddr_t *addr) -{ - packetbuf_copyfrom(uip_buf, uip_len); - - /* XXX we should provide a callback function that is called when the - packet is sent. For now, we just supply a NULL pointer. */ - NETSTACK_MAC.send(NULL, NULL); - return 1; -} -/*--------------------------------------------------------------------*/ -static void -init(void) -{ -} -/*--------------------------------------------------------------------*/ -static void -input(void) -{ - if(packetbuf_datalen() > 0 && packetbuf_datalen() <= UIP_BUFSIZE) { - memcpy(uip_buf, packetbuf_dataptr(), packetbuf_datalen()); - uip_len = packetbuf_datalen(); - tcpip_input(); - } -} -/*--------------------------------------------------------------------*/ -const struct network_driver uip_driver = { - "uip", - init, - input, - uip_driver_send -}; -/*--------------------------------------------------------------------*/ diff --git a/arch/platform/cooja/net/uip-driver.h b/arch/platform/cooja/net/uip-driver.h deleted file mode 100644 index ea0a43e42..000000000 --- a/arch/platform/cooja/net/uip-driver.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A brief description of what this file is - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef UIP_DRIVER_H_ -#define UIP_DRIVER_H_ - -#include "net/netstack.h" -extern const struct network_driver uip_driver; - -#endif /* UIP_DRIVER_H_ */ diff --git a/arch/platform/cooja/platform.c b/arch/platform/cooja/platform.c deleted file mode 100644 index 591abe67e..000000000 --- a/arch/platform/cooja/platform.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * COOJA Contiki mote main file. - * \author - * Fredrik Osterlind - */ - -#include -#include -#include - -#include "contiki.h" -#include "sys/cc.h" - -#include "sys/clock.h" -#include "sys/etimer.h" -#include "sys/cooja_mt.h" - -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Cooja" -#define LOG_LEVEL LOG_LEVEL_MAIN - -#include "lib/random.h" -#include "lib/simEnvChange.h" - -#include "net/netstack.h" -#include "net/queuebuf.h" - -#include "dev/eeprom.h" -#include "dev/serial-line.h" -#include "dev/cooja-radio.h" -#include "dev/button-sensor.h" -#include "dev/pir-sensor.h" -#include "dev/vib-sensor.h" -#include "dev/moteid.h" - -#include "sys/node-id.h" -#include "services/rpl-border-router/rpl-border-router.h" -#if BUILD_WITH_ORCHESTRA -#include "orchestra.h" -#endif /* BUILD_WITH_ORCHESTRA */ -#if BUILD_WITH_SHELL -#include "serial-shell.h" -#endif /* BUILD_WITH_SHELL */ - -/* JNI-defined functions, depends on the environment variable CLASSNAME */ -#ifndef CLASSNAME -#error CLASSNAME is undefined, required by platform.c -#endif /* CLASSNAME */ -#define COOJA__QUOTEME(a,b,c) COOJA_QUOTEME(a,b,c) -#define COOJA_QUOTEME(a,b,c) a##b##c -#define COOJA_JNI_PATH Java_org_contikios_cooja_corecomm_ -#define Java_org_contikios_cooja_corecomm_CLASSNAME_init COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_init) -#define Java_org_contikios_cooja_corecomm_CLASSNAME_getMemory COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_getMemory) -#define Java_org_contikios_cooja_corecomm_CLASSNAME_setMemory COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_setMemory) -#define Java_org_contikios_cooja_corecomm_CLASSNAME_tick COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_tick) -#define Java_org_contikios_cooja_corecomm_CLASSNAME_setReferenceAddress COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_setReferenceAddress) - -#if NETSTACK_CONF_WITH_IPV6 -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -/* The main function, implemented in contiki-main.c */ -int main(void); - -/* Simulation mote interfaces */ -SIM_INTERFACE_NAME(moteid_interface); -SIM_INTERFACE_NAME(vib_interface); -SIM_INTERFACE_NAME(rs232_interface); -SIM_INTERFACE_NAME(simlog_interface); -SIM_INTERFACE_NAME(beep_interface); -SIM_INTERFACE_NAME(radio_interface); -SIM_INTERFACE_NAME(button_interface); -SIM_INTERFACE_NAME(pir_interface); -SIM_INTERFACE_NAME(clock_interface); -SIM_INTERFACE_NAME(leds_interface); -SIM_INTERFACE_NAME(cfs_interface); -SIM_INTERFACE_NAME(eeprom_interface); -SIM_INTERFACES(&vib_interface, &moteid_interface, &rs232_interface, &simlog_interface, &beep_interface, &radio_interface, &button_interface, &pir_interface, &clock_interface, &leds_interface, &cfs_interface, &eeprom_interface); -/* Example: manually add mote interfaces */ -//SIM_INTERFACE_NAME(dummy_interface); -//SIM_INTERFACES(..., &dummy_interface); - -/* Sensors */ -SENSORS(&button_sensor, &pir_sensor, &vib_sensor); - -/* - * referenceVar is used for comparing absolute and process relative memory. - * (this must not be static due to memory locations) - */ -long referenceVar; - -/* - * Contiki and rtimer threads. - */ -static struct cooja_mt_thread rtimer_thread; -static struct cooja_mt_thread process_run_thread; - -/*---------------------------------------------------------------------------*/ -static void -rtimer_thread_loop(void *data) -{ - while(1) - { - rtimer_arch_check(); - - /* Return to COOJA */ - cooja_mt_yield(); - } -} -/*---------------------------------------------------------------------------*/ -static void -set_lladdr(void) -{ - linkaddr_t addr; - - memset(&addr, 0, sizeof(linkaddr_t)); -#if NETSTACK_CONF_WITH_IPV6 - { - int i; - for(i = 0; i < sizeof(uip_lladdr.addr); i += 2) { - addr.u8[i + 1] = simMoteID & 0xff; - addr.u8[i + 0] = simMoteID >> 8; - } - } -#else /* NETSTACK_CONF_WITH_IPV6 */ - addr.u8[0] = simMoteID & 0xff; - addr.u8[1] = simMoteID >> 8; -#endif /* NETSTACK_CONF_WITH_IPV6 */ - linkaddr_set_node_addr(&addr); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one() -{ - return; -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two() -{ - set_lladdr(); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three() -{ - /* Initialize eeprom */ - eeprom_init(); - /* Start serial process */ - serial_line_init(); -} -/*---------------------------------------------------------------------------*/ -void -platform_main_loop() -{ - while(1) - { - simProcessRunValue = process_run(); - while(simProcessRunValue-- > 0) { - process_run(); - } - simProcessRunValue = process_nevents(); - - /* Check if we must stay awake */ - if(simDontFallAsleep) { - simDontFallAsleep = 0; - simProcessRunValue = 1; - } - - /* Return to COOJA */ - cooja_mt_yield(); - } -} -/*---------------------------------------------------------------------------*/ -static void -process_run_thread_loop(void *data) -{ - /* Yield once during bootup */ - simProcessRunValue = 1; - cooja_mt_yield(); - - /* Then call common Contiki-NG main function */ - main(); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize a mote by starting processes etc. - * \param env JNI Environment interface pointer - * \param obj unused - * - * This function initializes a mote by starting certain - * processes and setting up the environment. - * - * This is a JNI function and should only be called via the - * responsible Java part (MoteType.java). - */ -JNIEXPORT void JNICALL -Java_org_contikios_cooja_corecomm_CLASSNAME_init(JNIEnv *env, jobject obj) -{ - /* Create rtimers and Contiki threads */ - cooja_mt_start(&rtimer_thread, &rtimer_thread_loop, NULL); - cooja_mt_start(&process_run_thread, &process_run_thread_loop, NULL); - } -/*---------------------------------------------------------------------------*/ -/** - * \brief Get a segment from the process memory. - * \param env JNI Environment interface pointer - * \param obj unused - * \param rel_addr Start address of segment - * \param length Size of memory segment - * \param mem_arr Byte array destination for the fetched memory segment - * \return Java byte array containing a copy of memory segment. - * - * Fetches a memory segment from the process memory starting at - * (rel_addr), with size (length). This function does not perform - * ANY error checking, and the process may crash if addresses are - * not available/readable. - * - * This is a JNI function and should only be called via the - * responsible Java part (MoteType.java). - */ -JNIEXPORT void JNICALL -Java_org_contikios_cooja_corecomm_CLASSNAME_getMemory(JNIEnv *env, jobject obj, jint rel_addr, jint length, jbyteArray mem_arr) -{ - (*env)->SetByteArrayRegion( - env, - mem_arr, - 0, - (size_t) length, - (jbyte *) (((long)rel_addr) + referenceVar) - ); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Replace a segment of the process memory with given byte array. - * \param env JNI Environment interface pointer - * \param obj unused - * \param rel_addr Start address of segment - * \param length Size of memory segment - * \param mem_arr Byte array contaning new memory - * - * Replaces a process memory segment with given byte array. - * This function does not perform ANY error checking, and the - * process may crash if addresses are not available/writable. - * - * This is a JNI function and should only be called via the - * responsible Java part (MoteType.java). - */ -JNIEXPORT void JNICALL -Java_org_contikios_cooja_corecomm_CLASSNAME_setMemory(JNIEnv *env, jobject obj, jint rel_addr, jint length, jbyteArray mem_arr) -{ - jbyte *mem = (*env)->GetByteArrayElements(env, mem_arr, 0); - memcpy((char*) (((long)rel_addr) + referenceVar), - mem, - length); - (*env)->ReleaseByteArrayElements(env, mem_arr, mem, 0); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Let mote execute one "block" of code (tick mote). - * \param env JNI Environment interface pointer - * \param obj unused - * - * Let mote defined by the active contiki processes and current - * process memory execute some program code. This code must not block - * or else this function will never return. A typical contiki - * process will return when it executes PROCESS_WAIT..() statements. - * - * Before the control is left to contiki processes, any messages - * from the Java part are handled. These may for example be - * incoming network data. After the contiki processes return control, - * messages to the Java part are also handled (those which may need - * special attention). - * - * This is a JNI function and should only be called via the - * responsible Java part (MoteType.java). - */ -JNIEXPORT void JNICALL -Java_org_contikios_cooja_corecomm_CLASSNAME_tick(JNIEnv *env, jobject obj) -{ - simProcessRunValue = 0; - - /* Let all simulation interfaces act first */ - doActionsBeforeTick(); - - /* Poll etimer process */ - if(etimer_pending()) { - etimer_request_poll(); - } - - /* Let rtimers run. - * Sets simProcessRunValue */ - cooja_mt_exec(&rtimer_thread); - - if(simProcessRunValue == 0) { - /* Rtimers done: Let Contiki handle a few events. - * Sets simProcessRunValue */ - cooja_mt_exec(&process_run_thread); - } - - /* Let all simulation interfaces act before returning to java */ - doActionsAfterTick(); - - /* Do we have any pending timers */ - simEtimerPending = etimer_pending(); - - /* Save nearest expiration time */ - simEtimerNextExpirationTime = etimer_next_expiration_time(); - -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Set the relative memory address of the reference variable. - * \param env JNI Environment interface pointer - * \param obj unused - * \param addr Relative memory address - * - * This is a JNI function and should only be called via the - * responsible Java part (MoteType.java). - */ -JNIEXPORT void JNICALL -Java_org_contikios_cooja_corecomm_CLASSNAME_setReferenceAddress(JNIEnv *env, jobject obj, jint addr) -{ - referenceVar = (((long)&referenceVar) - ((long)addr)); -} diff --git a/arch/platform/cooja/rtimer-arch.c b/arch/platform/cooja/rtimer-arch.c deleted file mode 100644 index 9d4f77646..000000000 --- a/arch/platform/cooja/rtimer-arch.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include -#include -#include - -#include "sys/rtimer.h" -#include "sys/clock.h" -#include "sys/cooja_mt.h" - -#include "lib/simEnvChange.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/* COOJA */ -int simRtimerPending; -rtimer_clock_t simRtimerNextExpirationTime; -rtimer_clock_t simRtimerCurrentTicks; - -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_init(void) -{ - simRtimerNextExpirationTime = 0; - simRtimerPending = 0; -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_schedule(rtimer_clock_t t) -{ - simRtimerNextExpirationTime = t; - simRtimerPending = 1; -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -rtimer_arch_next(void) -{ - return simRtimerNextExpirationTime; -} -/*---------------------------------------------------------------------------*/ -int -rtimer_arch_pending(void) -{ - return simRtimerPending; -} -/*---------------------------------------------------------------------------*/ -int -rtimer_arch_check(void) -{ - if (simRtimerCurrentTicks == simRtimerNextExpirationTime) { - /* Execute rtimer */ - simRtimerPending = 0; - rtimer_run_next(); - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -rtimer_arch_now(void) -{ - return simRtimerCurrentTicks; -} -/*---------------------------------------------------------------------------*/ - diff --git a/arch/platform/cooja/rtimer-arch.h b/arch/platform/cooja/rtimer-arch.h deleted file mode 100644 index 35bd892b4..000000000 --- a/arch/platform/cooja/rtimer-arch.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef RTIMER_ARCH_H_ -#define RTIMER_ARCH_H_ - -#include "contiki.h" -#include "sys/clock.h" -#include "lib/simEnvChange.h" -#include "sys/cooja_mt.h" - -#define RTIMER_ARCH_SECOND UINT64_C(1000000) - -#define US_TO_RTIMERTICKS(US) (US) -#define RTIMERTICKS_TO_US(T) (T) -#define RTIMERTICKS_TO_US_64(T) (T) - -rtimer_clock_t rtimer_arch_now(void); -int rtimer_arch_check(void); -int rtimer_arch_pending(void); -rtimer_clock_t rtimer_arch_next(void); - -/** \brief A platform-specific implementation that calls cooja_mt_yield() - * periodically. Without this, Cooja will get stuck in the busy-loop - * without ever updating the current rtimer time. */ -#define RTIMER_BUSYWAIT_UNTIL_ABS(cond, t0, max_time) \ - ({ \ - bool c; \ - while(!(c = cond) && RTIMER_CLOCK_LT(RTIMER_NOW(), (t0) + (max_time))) { \ - simProcessRunValue = 1; \ - cooja_mt_yield(); \ - } \ - c; \ - }) - -#endif /* RTIMER_ARCH_H_ */ diff --git a/arch/platform/cooja/slip-arch.c b/arch/platform/cooja/slip-arch.c deleted file mode 100644 index 74077db31..000000000 --- a/arch/platform/cooja/slip-arch.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2014, TU Braunschweig - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "dev/slip.h" -#include "dev/rs232.h" - -void -slip_arch_init() -{ - rs232_set_input(slip_input_byte); -} - diff --git a/arch/platform/cooja/sys/clock.c b/arch/platform/cooja/sys/clock.c deleted file mode 100644 index 069515c1a..000000000 --- a/arch/platform/cooja/sys/clock.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "sys/clock.h" -#include "lib/simEnvChange.h" - -const struct simInterface clock_interface; - -// COOJA variables -clock_time_t simCurrentTime; - -/*-----------------------------------------------------------------------------------*/ -void -clock_init(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - return simCurrentTime; -} -/*-----------------------------------------------------------------------------------*/ -unsigned long -clock_seconds(void) -{ - return simCurrentTime / CLOCK_CONF_SECOND; -} -/*-----------------------------------------------------------------------------------*/ -void -clock_delay(unsigned int delay_time) -{ -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ - -SIM_INTERFACE(clock_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); diff --git a/arch/platform/cooja/sys/cooja-log.c b/arch/platform/cooja/sys/cooja-log.c deleted file mode 100644 index c7ffdb9ac..000000000 --- a/arch/platform/cooja/sys/cooja-log.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 -#include -#include -#include "lib/simEnvChange.h" - -#define IMPLEMENT_PRINTF 1 - -#ifndef MAX_LOG_LENGTH -#define MAX_LOG_LENGTH 8192 -#endif /* MAX_LOG_LENGTH */ - - -const struct simInterface simlog_interface; - -/* Variables shared between COOJA and Contiki */ -char simLoggedData[MAX_LOG_LENGTH]; -int simLoggedLength; -char simLoggedFlag; - -/*-----------------------------------------------------------------------------------*/ -void -simlog_char(char c) -{ - if (simLoggedLength + 1 > MAX_LOG_LENGTH) { - /* Dropping message due to buffer overflow */ - return; - } - - simLoggedData[simLoggedLength] = c; - simLoggedLength += 1; - simLoggedFlag = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -simlog(const char *message) -{ - if (simLoggedLength + strlen(message) > MAX_LOG_LENGTH) { - /* Dropping message due to buffer overflow */ - return; - } - - memcpy(simLoggedData + simLoggedLength, message, strlen(message)); - simLoggedLength += strlen(message); - simLoggedFlag = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -log_message(const char *part1, const char *part2) -{ - simlog(part1); - simlog(part2); -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsBeforeTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -static void -doInterfaceActionsAfterTick(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -static int log_putchar_with_slip; -void -log_set_putchar_with_slip(int with) -{ - log_putchar_with_slip = with; -} -/*-----------------------------------------------------------------------------------*/ -#if IMPLEMENT_PRINTF -int -putchar(int c) -{ -#define SLIP_END 0300 - static char debug_frame = 0; - - if(log_putchar_with_slip) { - simlog_char(SLIP_END); - - if(!debug_frame) { /* Start of debug output */ - simlog_char(SLIP_END); - simlog_char('\r'); /* Type debug line == '\r' */ - debug_frame = 1; - } - - simlog_char((char)c); - - /* - * Line buffered output, a newline marks the end of debug output and - * implicitly flushes debug output. - */ - if(c == '\n') { - simlog_char(SLIP_END); - debug_frame = 0; - } - - return c; - } else { - simlog_char(c); - return c; - } -} -/*-----------------------------------------------------------------------------------*/ -int -puts(const char* s) -{ - simlog(s); - simlog_char('\n'); - return 0; -} -/*-----------------------------------------------------------------------------------*/ -int -printf(const char *fmt, ...) -{ - int res; - static char buf[MAX_LOG_LENGTH]; - va_list ap; - int i; - - va_start(ap, fmt); - res = vsnprintf(buf, MAX_LOG_LENGTH, fmt, ap); - va_end(ap); - - // simlog(buf); - for(i = 0; i < res; i++) { - putchar(buf[i]); - } - return res; -} -#endif /* IMPLEMENT_PRINTF */ -/*-----------------------------------------------------------------------------------*/ - -SIM_INTERFACE(simlog_interface, - doInterfaceActionsBeforeTick, - doInterfaceActionsAfterTick); diff --git a/arch/platform/cooja/sys/cooja_mt.c b/arch/platform/cooja/sys/cooja_mt.c deleted file mode 100644 index ca0d79303..000000000 --- a/arch/platform/cooja/sys/cooja_mt.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ -/* - * This file is ripped from mt.c of the Contiki Multi-threading library. - * Fredrik Osterlind - */ - -#include "contiki.h" -#include "sys/cooja_mt.h" -#include "sys/cc.h" - -#define MT_STATE_READY 1 -#define MT_STATE_RUNNING 2 -#define MT_STATE_EXITED 5 - -static struct cooja_mt_thread *current; - -/*--------------------------------------------------------------------------*/ -void -cooja_mt_start(struct cooja_mt_thread *thread, void (* function)(void *), void *data) -{ - /* Call the architecture dependant function to set up the processor - stack with the correct parameters. */ - cooja_mtarch_start(&thread->thread, function, data); - - thread->state = MT_STATE_READY; -} -/*--------------------------------------------------------------------------*/ -void -cooja_mt_exec(struct cooja_mt_thread *thread) -{ - if(thread->state == MT_STATE_READY) { - thread->state = MT_STATE_RUNNING; - current = thread; - /* Switch context to the thread. The function call will not return - until the the thread has yielded, or is preempted. */ - cooja_mtarch_exec(&thread->thread); - } -} -/*--------------------------------------------------------------------------*/ -void -cooja_mt_yield(void) -{ - current->state = MT_STATE_READY; - current = NULL; - /* This function is called from the running thread, and we call the - switch function in order to switch the thread to the main Contiki - program instead. For us, the switch function will not return - until the next time we are scheduled to run. */ - cooja_mtarch_yield(); -} diff --git a/arch/platform/cooja/sys/cooja_mt.h b/arch/platform/cooja/sys/cooja_mt.h deleted file mode 100644 index f9138c6dd..000000000 --- a/arch/platform/cooja/sys/cooja_mt.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ -/* - * This file is ripped from mt.h of the Contiki Multi-threading library. - * Fredrik Osterlind - */ -#ifndef COOJA_MT_H_ -#define COOJA_MT_H_ - -#include "contiki.h" - - -/** - * An opaque structure that is used for holding the state of a thread. - * - * The structure should be defined in the "mtarch.h" file. This - * structure typically holds the entire stack for the thread. - */ -struct cooja_mtarch_thread; - -/** - * Setup the stack frame for a thread that is being started. - * - * This function is called by the mt_start() function in order to set - * up the architecture specific stack of the thread to be started. - * - * \param thread A pointer to a struct mtarch_thread for the thread to - * be started. - * - * \param function A pointer to the function that the thread will - * start executing the first time it is scheduled to run. - * - * \param data A pointer to the argument that the function should be - * passed. - */ -void cooja_mtarch_start(struct cooja_mtarch_thread *thread, - void (* function)(void *data), - void *data); - -/** - * Yield the processor. - * - * This function is called by the mt_yield() function, which is called - * from the running thread in order to give up the processor. - * - */ -void cooja_mtarch_yield(void); - -/** - * Start executing a thread. - * - * This function is called from mt_exec() and the purpose of the - * function is to start execution of the thread. The function should - * switch in the stack of the thread, and does not return until the - * thread has explicitly yielded (using mt_yield()) or until it is - * preempted. - * - */ -void cooja_mtarch_exec(struct cooja_mtarch_thread *thread); - - -/** @} */ - - -#include "cooja_mtarch.h" - -struct cooja_mt_thread { - int state; - process_event_t *evptr; - process_data_t *dataptr; - struct cooja_mtarch_thread thread; -}; - -/** - * No error. - * - * \hideinitializer - */ -#define MT_OK 1 - -/** - * Starts a multithreading thread. - * - * \param thread Pointer to an mt_thread struct that must have been - * previously allocated by the caller. - * - * \param function A pointer to the entry function of the thread that is - * to be set up. - * - * \param data A pointer that will be passed to the entry function. - * - */ -void cooja_mt_start(struct cooja_mt_thread *thread, void (* function)(void *), void *data); - -/** - * Execute parts of a thread. - * - * This function is called by a Contiki process and runs a - * thread. The function does not return until the thread has yielded, - * or is preempted. - * - * \note The thread must first be initialized with the mt_init() function. - * - * \param thread A pointer to a struct mt_thread block that must be - * allocated by the caller. - * - */ -void cooja_mt_exec(struct cooja_mt_thread *thread); - -/** - * Post an event to a thread. - * - * This function posts an event to a thread. The thread will be - * scheduled if the thread currently is waiting for the posted event - * number. If the thread is not waiting for the event, this function - * does nothing. - * - * \note The thread must first be initialized with the mt_init() function. - * - * \param thread A pointer to a struct mt_thread block that must be - * allocated by the caller. - * - * \param s The event that is posted to the thread. - * - * \param data An opaque pointer to a user specified structure - * containing additonal information, or NULL if no additional - * information is needed. - */ -/*void mt_exec_event(struct mt_thread *thread, process_event_t s, - process_data_t data);*/ - -/** - * Voluntarily give up the processor. - * - * This function is called by a running thread in order to give up - * control of the CPU. - * - */ -void cooja_mt_yield(void); - -/** @} */ -/** @} */ -#endif /* MT_H_ */ diff --git a/arch/platform/cooja/sys/cooja_mtarch.c b/arch/platform/cooja/sys/cooja_mtarch.c deleted file mode 100644 index 4a1f78360..000000000 --- a/arch/platform/cooja/sys/cooja_mtarch.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include - -#include -#include -#include -#include "sys/cooja_mt.h" - -#ifndef __WORDSIZE -#define __WORDSIZE 32 -#endif /* __WORDSIZE */ - -#ifndef ON_64BIT_ARCH -#if __WORDSIZE == 64 -#define ON_64BIT_ARCH 1 -#else /* ON_64BIT_ARCH */ -#define ON_64BIT_ARCH 0 -#endif /* __WORDSIZE == 64 */ -#endif /* ON_64BIT_ARCH */ - -struct frame { - unsigned long flags; -#if ON_64BIT_ARCH - unsigned long rbp; - unsigned long rdi; - unsigned long rsi; - unsigned long rdx; - unsigned long rcx; - unsigned long rbx; - unsigned long rax; -#else /* ON_64BIT_ARCH */ - unsigned long ebp; - unsigned long edi; - unsigned long esi; - unsigned long edx; - unsigned long ecx; - unsigned long ebx; - unsigned long eax; -#endif /* ON_64BIT_ARCH */ - unsigned long retaddr; - unsigned long retaddr2; - unsigned long data; -}; - -/*--------------------------------------------------------------------------*/ -void -cooja_mtarch_start(struct cooja_mtarch_thread *t, - void (*function)(void *), void *data) -{ - struct frame *f = (struct frame *)&t->stack[COOJA_MTARCH_STACKSIZE - sizeof(struct frame)/sizeof(unsigned long)]; - int i; - - for(i = 0; i < COOJA_MTARCH_STACKSIZE; ++i) { - t->stack[i] = i; - } - - memset(f, 0, sizeof(struct frame)); - f->retaddr = (unsigned long)function; - f->data = (unsigned long)data; - t->sp = (unsigned long)&f->flags; -#if ON_64BIT_ARCH - f->rbp = (unsigned long)&f->rax; -#else /* ON_64BIT_ARCH */ - f->ebp = (unsigned long)&f->eax; -#endif /* ON_64BIT_ARCH */ -} -/*--------------------------------------------------------------------------*/ -static struct cooja_mtarch_thread *cooja_running_thread; -/*--------------------------------------------------------------------------*/ -void cooja_sw(void) -{ - /* Store registers */ -#if ON_64BIT_ARCH - __asm__ ( - "pushq %rax\n\t" - "pushq %rbx\n\t" - "pushq %rcx\n\t" - "pushq %rdx\n\t" - "pushq %rsi\n\t" - "pushq %rdi\n\t" - "pushq %rbp\n\t" - "pushq %rbp\n\t"); -#else /* ON_64BIT_ARCH */ - __asm__ ( - "pushl %eax\n\t" - "pushl %ebx\n\t" - "pushl %ecx\n\t" - "pushl %edx\n\t" - "pushl %esi\n\t" - "pushl %edi\n\t" - "pushl %ebp\n\t" - "pushl %ebp\n\t"); -#endif /* ON_64BIT_ARCH */ - - /* Switch stack pointer */ -#if ON_64BIT_ARCH - __asm__ ("movq %0, %%rax\n\t" : : "m" (cooja_running_thread)); - __asm__ ( - "movq (%rax), %rbx\n\t" - "movq %rsp, (%rax)\n\t" - "movq %rbx, %rsp\n\t" - ); -#else /* ON_64BIT_ARCH */ - __asm__ ("movl %0, %%eax\n\t" : : "m" (cooja_running_thread)); - __asm__ ( - "movl (%eax), %ebx\n\t" - "movl %esp, (%eax)\n\t" - "movl %ebx, %esp\n\t" - ); -#endif /* ON_64BIT_ARCH */ - - /* Restore previous registers */ -#if ON_64BIT_ARCH - __asm__ ( - "popq %rbp\n\t" - "popq %rbp\n\t" - "popq %rdi\n\t" - "popq %rsi\n\t" - "popq %rdx\n\t" - "popq %rcx\n\t" - "popq %rbx\n\t" - "popq %rax\n\t" - - "leave\n\t" - "ret\n\t" - ); -#else /* ON_64BIT_ARCH */ - __asm__ ( - "popl %ebp\n\t" - "popl %ebp\n\t" - "popl %edi\n\t" - "popl %esi\n\t" - "popl %edx\n\t" - "popl %ecx\n\t" - "popl %ebx\n\t" - "popl %eax\n\t" - - "leave\n\t" - "ret\n\t" - ); -#endif /* ON_64BIT_ARCH */ - -} - -/*--------------------------------------------------------------------------*/ -void -cooja_mtarch_exec(struct cooja_mtarch_thread *t) -{ - cooja_running_thread = t; - cooja_sw(); - cooja_running_thread = NULL; -} -/*--------------------------------------------------------------------------*/ -void -cooja_mtarch_yield(void) -{ - cooja_sw(); -} -/*--------------------------------------------------------------------------*/ diff --git a/arch/platform/cooja/sys/cooja_mtarch.h b/arch/platform/cooja/sys/cooja_mtarch.h deleted file mode 100644 index 2a16c0ae4..000000000 --- a/arch/platform/cooja/sys/cooja_mtarch.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -/* - * This file is ripped from x86/mtarch.h of the Contiki Multi-threading library. - * Fredrik Osterlind - */ -#ifndef COOJA_MTARCH_H_ -#define COOJA_MTARCH_H_ - -#ifndef COOJA_MTARCH_STACKSIZE -#define COOJA_MTARCH_STACKSIZE 1024 -#endif /* COOJA_MTARCH_STACKSIZE */ - -struct cooja_mtarch_thread { - unsigned long sp; /* Note: stack pointer must be first var in struct! */ - unsigned long stack[COOJA_MTARCH_STACKSIZE]; -}; - -struct cooja_mt_thread; - -#endif /* COOJA_MTARCH_H_ */ diff --git a/arch/platform/cooja/testapps/hello-world.c b/arch/platform/cooja/testapps/hello-world.c deleted file mode 100644 index 6cfe9f7f1..000000000 --- a/arch/platform/cooja/testapps/hello-world.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" - -#include - -/*---------------------------------------------------------------------------*/ -PROCESS(hello_world_process, "Hello world process"); -AUTOSTART_PROCESSES(&hello_world_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(hello_world_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("Hello, world\n"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/cooja/testapps/testbutton.c b/arch/platform/cooja/testapps/testbutton.c deleted file mode 100644 index 099ce5757..000000000 --- a/arch/platform/cooja/testapps/testbutton.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "dev/button-sensor.h" - -#include - -PROCESS(test_button_process, "Test button process"); -AUTOSTART_PROCESSES(&test_button_process); - -PROCESS_THREAD(test_button_process, ev, data) -{ - static int counter = 0; - - PROCESS_BEGIN(); - - printf("Starting Button test process (counter=%i)\n", counter); - button_sensor.configure(SENSORS_ACTIVE, 1); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == sensors_event && data == &button_sensor) { - counter++; - printf("Button pressed (counter=%i)\n", counter); - } - } - - PROCESS_END(); -} diff --git a/arch/platform/cooja/testapps/testcfs.c b/arch/platform/cooja/testapps/testcfs.c deleted file mode 100644 index 9c6ffa9f4..000000000 --- a/arch/platform/cooja/testapps/testcfs.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "sys/etimer.h" -#include "sys/clock.h" -#include "cfs/cfs.h" - -#include - -PROCESS(test_cfs_process, "Test CFS process"); -AUTOSTART_PROCESSES(&test_cfs_process); - -PROCESS_THREAD(test_cfs_process, ev, data) -{ - static struct etimer et; - static int fd; - static uint16_t counter; - static char buf[30]; - - PROCESS_BEGIN(); - - printf("Starting CFS test process\n"); - - while(1) { - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Write to filesystem */ - sprintf(buf, "filedata%04ifiledata%04i", counter, counter); - fd = cfs_open("filename", CFS_READ | CFS_WRITE); - cfs_seek(fd, 0, CFS_SEEK_SET); - cfs_write(fd, buf, 24); - cfs_close(fd); - printf("Wrote to filesystem: '%s'\n", buf); - counter++; - - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Read from filesystem */ - fd = cfs_open("file1", CFS_READ | CFS_WRITE); - cfs_seek(fd, 4, CFS_SEEK_SET); - cfs_read(fd, buf, 12); - cfs_close(fd); - buf[12] = '\0'; - printf("Read from filesystem: '%s'\n", buf); - - } - - PROCESS_END(); -} diff --git a/arch/platform/cooja/testapps/testctimer.c b/arch/platform/cooja/testapps/testctimer.c deleted file mode 100644 index 2f2ed8d4c..000000000 --- a/arch/platform/cooja/testapps/testctimer.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "sys/ctimer.h" - -#include - -PROCESS(test_ctimer_process, "Callback timer test process"); -AUTOSTART_PROCESSES(&test_ctimer_process); -/*---------------------------------------------------------------------------*/ -static struct ctimer ct; -static uint16_t counter = 0; -/*---------------------------------------------------------------------------*/ -static void -callback(void *ptr) -{ - counter++; - printf("Callback function called at time %lu (counter=%i)\n", clock_time(), counter); - ctimer_set(&ct, CLOCK_SECOND/2, callback, NULL); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_ctimer_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("Starting callback timer test process (counter=%i)\n", counter); - - ctimer_set(&ct, CLOCK_SECOND/2, callback, NULL); - - PROCESS_END(); -} diff --git a/arch/platform/cooja/testapps/testetimer.c b/arch/platform/cooja/testapps/testetimer.c deleted file mode 100644 index d486995d4..000000000 --- a/arch/platform/cooja/testapps/testetimer.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "sys/etimer.h" - -#include - -PROCESS(test_etimer_process, "Event timer test process"); -AUTOSTART_PROCESSES(&test_etimer_process); - -PROCESS_THREAD(test_etimer_process, ev, data) -{ - static struct etimer et; - static uint16_t counter = 0; - - PROCESS_BEGIN(); - - printf("Starting event timer test process (counter=%i)\n", counter); - - while(1) { - etimer_set(&et, CLOCK_SECOND/2); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - counter++; - printf("Event timer triggered event at time %lu (counter=%i)\n", clock_time(), counter); - } - - PROCESS_END(); -} diff --git a/arch/platform/cooja/testapps/testsensors.c b/arch/platform/cooja/testapps/testsensors.c deleted file mode 100644 index 6860084c7..000000000 --- a/arch/platform/cooja/testapps/testsensors.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "dev/button-sensor.h" -#include "dev/pir-sensor.h" -#include "dev/vib-sensor.h" - -#include - -PROCESS(test_sensors_process, "Test sensors process"); -AUTOSTART_PROCESSES(&test_sensors_process); - -PROCESS_THREAD(test_sensors_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("Starting sensors test process\n"); - button_sensor.configure(SENSORS_ACTIVE, 1); - pir_sensor.configure(SENSORS_ACTIVE, 1); - vib_sensor.configure(SENSORS_ACTIVE, 1); - - while(1) { - PROCESS_WAIT_EVENT(); - - if (ev == sensors_event) { - if (data == &button_sensor) { - printf("Button\n"); - } else if (data == &vib_sensor) { - printf("Vibration sensor\n"); - } else if (data == &pir_sensor) { - printf("Passive IR sensor\n"); - } else { - printf("Unknown sensor\n"); - } - } else { - printf("Non-sensor event triggered\n"); - } - - } - - PROCESS_END(); -} diff --git a/arch/platform/cooja/testapps/testserial.c b/arch/platform/cooja/testapps/testserial.c deleted file mode 100644 index d5604b6fc..000000000 --- a/arch/platform/cooja/testapps/testserial.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "dev/serial-line.h" - -#include - -PROCESS(test_serial_process, "Serial test process"); -AUTOSTART_PROCESSES(&test_serial_process); - -PROCESS_THREAD(test_serial_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - - etimer_set(&et, CLOCK_SECOND); - - while(1) { - PROCESS_WAIT_EVENT(); - - if (etimer_expired(&et)) { - printf("Waiting for serial data\n"); - etimer_restart(&et); - } - - if(ev == serial_line_event_message) { - printf("Message received: '%s'\n", data); - } - } - - PROCESS_END(); -} diff --git a/arch/platform/cooja/testapps/testuip.c b/arch/platform/cooja/testapps/testuip.c deleted file mode 100644 index 5f0017d9a..000000000 --- a/arch/platform/cooja/testapps/testuip.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 -#include "net/ipv6/uip.h" -#include "dev/button-sensor.h" -#include "dev/leds.h" - -#include - -#define COOJA_PORT 1234 - -PROCESS(test_uip_process, "uIP test process"); -AUTOSTART_PROCESSES(&test_uip_process); - -static struct uip_udp_conn *broadcast_conn; -/*---------------------------------------------------------------------*/ -PROCESS_THREAD(test_uip_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("uIP test process started\n"); - - broadcast_conn = udp_broadcast_new(COOJA_PORT, NULL); - button_sensor.configure(SENSORS_ACTIVE, 1); - - while(1) { - PROCESS_WAIT_EVENT(); - printf("An event occured: "); - - if(ev == PROCESS_EVENT_EXIT) { - printf("shutting down\n"); - break; - } - - if(ev == sensors_event && data == &button_sensor) { - printf("button clicked, sending packet\n"); - - tcpip_poll_udp(broadcast_conn); - PROCESS_WAIT_UNTIL(ev == tcpip_event && uip_poll()); - uip_send("cooyah COOJA", 12); - } else if(ev == sensors_event) { - printf("unknown sensor event: %s\n", ((struct sensors_sensor *)data)->type); - } else if(ev == tcpip_event && uip_newdata()) { - printf("a packet was received, toggling leds\n"); - printf("packet data: '%s'\n", (char*) uip_appdata); - leds_toggle(LEDS_ALL); - } else { - printf("unknown event: %d\n", ev); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/arch/platform/jn516x/App_Stack_Size.ld b/arch/platform/jn516x/App_Stack_Size.ld deleted file mode 100644 index 3eaaf34c0..000000000 --- a/arch/platform/jn516x/App_Stack_Size.ld +++ /dev/null @@ -1,46 +0,0 @@ -/***************************************************************************** - * - * MODULE: App_Stack_Size.ld - * - * DESCRIPTION: Linker command file defining the default app stack size - * - **************************************************************************** - /* -* Copyright (c) 2015 NXP B.V. -* 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* -* This file is part of the Contiki operating system. -* -* -*/ - -/* Default stack size for MAC applications. - * To override the default setting, copy this - * file to your apoplication build folder and - * alter the stack size as required. */ - -_stack_size = 2048; diff --git a/arch/platform/jn516x/Makefile.jn516x b/arch/platform/jn516x/Makefile.jn516x deleted file mode 100644 index 051c336fb..000000000 --- a/arch/platform/jn516x/Makefile.jn516x +++ /dev/null @@ -1,301 +0,0 @@ -ifndef CONTIKI - $(error CONTIKI not defined! You must specify where CONTIKI resides!) -endif - -############################################################################## -# User definable make parameters that may be overwritten from the command line -ifdef CHIP - JENNIC_CHIP = $(CHIP) -else -JENNIC_CHIP ?= JN5168 -endif -ifdef MODULE - JN5168_MODULE = $(MODULE) -else - JN5168_MODULE ?= M00 -endif -JENNIC_PCB ?= DEVKIT4 -JENNIC_STACK ?= MAC -JENNIC_MAC ?= MiniMac -DISABLE_LTO ?= 1 -# can be set to SW or HW -DEBUG ?= None - -ifeq ($(HOST_OS),Windows) - SDK_BASE_DIR ?= C:/NXP/bstudio_nxp/sdk/JN-SW-4163 - FLASH_PROGRAMMER ?= ${SDK_BASE_DIR}/Tools/flashprogrammer/FlashCLI.exe -else - # Assume Linux - SDK_BASE_DIR ?= /usr/jn516x-sdk/JN-SW-4163 - FLASH_PROGRAMMER ?= $(CONTIKI)/tools/jn516x/JennicModuleProgrammer -endif - -############################################################################### -# Include NXP makefiles -include $(SDK_BASE_DIR)/Chip/Common/Build/config.mk -include $(SDK_BASE_DIR)/Platform/Common/Build/config.mk -include $(SDK_BASE_DIR)/Stack/Common/Build/config.mk - -# Add missing includes -INCFLAGS += -I$(COMPONENTS_BASE_DIR)/MicroSpecific/Include -INCFLAGS += -I$(COMPONENTS_BASE_DIR)/Recal/Include -INCFLAGS += -I$(COMPONENTS_BASE_DIR)/ProductionTestApi/Include -INCFLAGS += -I$(COMPONENTS_BASE_DIR)/Xcv/Include - -# Add missing libs and -# do not link with MiniMac nor MiniMacShim (we use MMAC) -LDLIBS += Recal_$(JENNIC_CHIP_FAMILY) -LDLIBS := $(subst MiniMacShim_JN516x, ,$(LDLIBS)) -ifeq ($(JENNIC_CHIP),JN5169) - LDLIBS := $(subst MiniMac_JN5169, ,$(LDLIBS)) -else -LDLIBS := $(subst MiniMac_JN516x, ,$(LDLIBS)) - LDLIBS += JPT_$(JENNIC_CHIP) -endif - -# Enable all warnings -CFLAGS += -Wall -# Disable warnings that result many false positives with the Contiki core -CFLAGS += -Wno-strict-aliasing -CFLAGS += -Wno-cast-align - -# Warings as error -ifeq ($(WERROR),1) -CFLAGS += -Werror -endif - -# Pass DEBUG as CFLAG -ifeq ($(DEBUG),SW) -CFLAGS += -DDEBUG=1 -endif - -# Path-independent cross-compiler -CC:=$(CROSS_COMPILE)-gcc -AS:=$(CROSS_COMPILE)-as -LD:=$(CROSS_COMPILE)-ls -AR:=$(CROSS_COMPILE)-ar -NM:=$(CROSS_COMPILE)-nm -STRIP:=$(CROSS_COMPILE)-strip -SIZE:=$(CROSS_COMPILE)-size -OBJCOPY:=$(CROSS_COMPILE)-objcopy -OBJDUMP:=$(CROSS_COMPILE)-objdump - -ARCH = jn516x-ccm-star.c exceptions.c rtimer-arch.c rtimer-arch-slow.c \ - slip_uart0.c clock.c micromac-radio.c int-master.c \ - watchdog.c slip.c dbg.c -# Default uart0 for printf and slip -TARGET_WITH_UART0 ?= 1 -TARGET_WITH_UART1 ?= 0 - -# Get required uart files -ifeq ($(TARGET_WITH_UART0),1) -WITH_UART = 1 -ARCH += uart0.c -endif -ifeq ($(TARGET_WITH_UART1),1) -WITH_UART = 1 -ARCH += uart1.c -endif -ifeq ($(WITH_UART),1) -ARCH += uart-driver.c -endif - -CONTIKI_TARGET_DIRS = . dev -CONTIKI_TARGET_MAIN = platform.c - -ifeq ($(JN516x_WITH_DR1175),1) -JN516x_WITH_DR1174 = 1 -CFLAGS += -DSENSOR_BOARD_DR1175 -CONTIKI_TARGET_DIRS += dev/dr1175 -ARCH += ht-sensor.c light-sensor.c leds-extension.c leds-arch-1175.c -endif - -ifeq ($(JN516x_WITH_DR1199),1) -JN516x_WITH_DR1174 = 1 -CFLAGS += -DSENSOR_BOARD_DR1199 -CONTIKI_TARGET_DIRS += dev/dr1199 -ARCH += pot-sensor.c leds-arch-1199.c -endif - -ifeq ($(JN516x_WITH_DR1174),1) -CFLAGS += -DSENSOR_BOARD_DR1174 -CONTIKI_TARGET_DIRS += dev/dr1174 -ARCH += button-sensor.c leds-arch.c -else -# Dongle is the default platform -JN516x_WITH_DONGLE = 1 -endif - -ifeq ($(JN516x_WITH_DONGLE),1) -CFLAGS += -DDONGLE_NODE -CONTIKI_TARGET_DIRS += dev/dongle -ARCH += leds-arch.c -endif - -ifeq ($(JENNIC_CHIP),JN5168) -CFLAGS += -DJN5168_$(JN5168_MODULE) -endif - -ifdef nodemac -CFLAGS += -DMACID=$(nodemac) -endif - -CLEAN += *.jn516x.bin - -CONTIKI_TARGET_SOURCEFILES += $(ARCH) -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)} - -CFLAGS += $(INCFLAGS) - -# Library search paths -LDFLAGS += -L$(CHIP_BASE_DIR)/Build -LDFLAGS += -L$(CHIP_BASE_DIR)/Library - -LDLIBS := $(addsuffix _$(JENNIC_CHIP_FAMILY),$(APPLIBS)) $(LDLIBS) - -ifeq ($(HOST_OS),Windows) -# Windows assumes Cygwin. Substitute all paths in CFLAGS and LDFLAGS with Windows paths. -CFLAGS := $(patsubst -I/cygdrive/c/%,-Ic:/%,$(CFLAGS)) -LDFLAGS := $(patsubst -L/cygdrive/c/%,-Lc:/%,$(LDFLAGS)) -endif - -# These symbols are used by the stack check library -LDFLAGS += -Wl,--defsym=_stack=_stack_low_water_mark -LDFLAGS += -Wl,--defsym=_stack_origin=_ram_top - -######################################################################## - -MOTELIST = python $(CONTIKI)/tools/jn516x/mote-list.py - -# Check if we are running under Windows -ifeq ($(HOST_OS),Windows) - USBDEVPREFIX=/dev/com - USBDEVBASENAME=COM -else -ifeq ($(HOST_OS),Darwin) - USBDEVPREFIX= - USBDEVBASENAME=/dev/tty.usbserial- -else - # Else we assume Linux - USBDEVPREFIX= - USBDEVBASENAME=/dev/ttyUSB -endif -endif - -# Note: this logic is different from Sky -ifneq ("", "$(filter-out %all,$(filter %.upload serial% login, $(MAKECMDGOALS)))") -ifndef MOTE - $(error MOTE not defined! You must specify which MOTE (serial port) to use) -endif -endif -DEV_PORT = $(USBDEVBASENAME)$(MOTE) - -#### make targets - -######################################################################## -# Dependency, compilation and flash-programming rules - -.PHONY: all clean - -.PRECIOUS: %.elf - -%.d: clean - -%.nm: %.$(TARGET) - $(Q)$(NM) -nS $< > $@ - -%.dmp: %.$(TARGET) - $(Q)$(OBJDUMP) -d $< > $@ - -define FINALIZE_DEPENDENCY_ -# hack: subsitute windows path back to cygwin path -sed -e 's/c:\//\/cygdrive\/c\//' $(@:.o=.d) > $(@:.o=.$$$$); \ -cp $(@:.o=.$$$$) $(@:.o=.d); \ -sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(@:.o=.$$$$) >> $(@:.o=.d); \ -rm -f $(@:.o=.$$$$) -endef - -CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 -$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) - $(TRACE_CC) - $(Q)$(CC) $(CFLAGS) -MMD -c $< -o $@ - @$(FINALIZE_DEPENDENCY_) - -CUSTOM_RULE_LINK = 1 -ALLLIBS = $(addprefix -l,$(LDLIBS)) $(addprefix -l,$(LDSTACKLIBS)) $(addprefix -l,$(LDMYLIBS)) -ABS_APPLIBS = $(addsuffix _$(JENNIC_CHIP_FAMILY).a,$(addprefix $(COMPONENTS_BASE_DIR)/Library/lib,$(APPLIBS))) - -ifneq ($(wildcard $(SDK_BASE_DIR)/Components/Library/*),) -# The SDK is fully installed, proceed to linking -$(BUILD_DIR_BOARD)/%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB) $(ABS_APPLIBS) - @echo ${filter %.a,$^} - $(Q)$(CC) -Wl,--gc-sections $(LDFLAGS) -T$(LINKCMD) -o $@ -Wl,--start-group \ - $(patsubst /cygdrive/c/%,c:/%,${filter-out %.a,$^}) \ - $(patsubst /cygdrive/c/%,c:/%,${filter %.a,$^}) \ - $(ALLLIBS) -Wl,--end-group -Wl,-Map,$(CONTIKI_NG_PROJECT_MAP) -else -# The SDK does not include libraries, only build objects and libraries, skip linking -$(BUILD_DIR_BOARD)/%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB) - @echo Creating empty $@ - touch $@ -endif - -$(BUILD_DIR_BOARD)/%.$(TARGET).bin: $(BUILD_DIR_BOARD)/%.$(TARGET) - $(TRACE_OBJCOPY) - $(Q)$(OBJCOPY) -S -O binary $< $@ - -%.$(TARGET).bin: $(BUILD_DIR_BOARD)/%.$(TARGET).bin - $(TRACE_CP) - $(Q)$(CP) $< $@ - -### Upload target to one jn516x mote specified by MOTE=portNumber -ifeq ($(HOST_OS),Windows) -%.upload: $(BUILD_DIR_BOARD)/%.$(TARGET).bin - ${FLASH_PROGRAMMER} -a -c $(DEV_PORT) -B 1000000 -s -w -f $< -else -%.upload: $(BUILD_DIR_BOARD)/%.$(TARGET).bin - ${FLASH_PROGRAMMER} -V 10 -v -s $(DEV_PORT) -I 38400 -P 1000000 -f $< -endif - -### Flash the given file -ifeq ($(HOST_OS),Windows) -%.flash: ${FLASH_PROGRAMMER} - ${FLASH_PROGRAMMER} -a -c $(DEV_PORT) -B 1000000 -s -w -f $*.$(TARGET).bin -else -%.flash: ${FLASH_PROGRAMMER} - ${FLASH_PROGRAMMER} -V 10 -v -s $(DEV_PORT) -I 38400 -P 1000000 -s -f $*.$(TARGET).bin -endif - -### List the ports with connected jn516x motes -motelist: - $(Q)$(MOTELIST) ${FLASH_PROGRAMMER} \# - -motelistmac: - $(Q)$(MOTELIST) ${FLASH_PROGRAMMER} \! - -motelistinfo: - $(Q)$(MOTELIST) ${FLASH_PROGRAMMER} \? - -### Upload target to all connected jn516x motes -%.uploadall: $(BUILD_DIR_BOARD)/%.$(TARGET).bin - $(Q)$(MOTELIST) ${FLASH_PROGRAMMER} $< - -### Flash the given file to all connected jn516x motes -%.flashall: - $(Q)$(MOTELIST) ${FLASH_PROGRAMMER} $* - -### Dump output from all connected jn516x motes -serialdumpall: - $(Q)$(MOTELIST) ${FLASH_PROGRAMMER} \% $(SERIALDUMP) - -########### login: read serial line ############## -### USAGE: make TARGET=jn516x login UART_BAUDRATE={baudrate} {serial device} -### UART_BAUDRATE: i.e., 115200. default is 1000000 -### example: make TARGET=jn516x UART_BAUDRATE=115200 login MOTE=1 - -### For the login etc targets -BAUDRATE = 1000000 -PORT = $(USBDEVPREFIX)$(DEV_PORT) diff --git a/arch/platform/jn516x/contiki-conf.h b/arch/platform/jn516x/contiki-conf.h deleted file mode 100644 index e4d741400..000000000 --- a/arch/platform/jn516x/contiki-conf.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef CONTIKI_CONF_H_ -#define CONTIKI_CONF_H_ - -/* include the project config */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif /* PROJECT_CONF_PATH */ - -#include "jn516x-def.h" - -/* Configure radio driver */ -#ifndef NETSTACK_CONF_RADIO -#define NETSTACK_CONF_RADIO micromac_radio_driver -#endif /* NETSTACK_CONF_RADIO */ - -/* Platform-specific (H/W) CCM* implementation */ -#ifndef CCM_STAR_CONF -#define CCM_STAR_CONF ccm_star_driver_jn516x -#endif /* CCM_STAR_CONF */ - -#endif /* CONTIKI_CONF_H_ */ diff --git a/arch/platform/jn516x/dbg.c b/arch/platform/jn516x/dbg.c deleted file mode 100644 index ac6cc3888..000000000 --- a/arch/platform/jn516x/dbg.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" - -#include -#include "dev/uart0.h" -/*---------------------------------------------------------------------------*/ -int -dbg_putchar(int c) -{ - uart0_writeb(c); - return 1; -} -/*---------------------------------------------------------------------------*/ -unsigned int -dbg_send_bytes(const unsigned char *s, unsigned int len) -{ - unsigned int i = 0; - - while(s && *s != 0) { - if(i >= len) { - break; - } - uart0_writeb(*s++); - i++; - } - return i; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/jn516x/dev/clock.c b/arch/platform/jn516x/dev/clock.c deleted file mode 100644 index eec23166a..000000000 --- a/arch/platform/jn516x/dev/clock.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Tickless clock implementation for NXP jn516x. - * \author - * Beshr Al Nahas - * Atis Elsts - * - */ - -#include -#include -#include "contiki.h" -#include "sys/clock.h" -#include "sys/etimer.h" -#include "rtimer-arch.h" -#include "dev/watchdog.h" - - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define CLOCK_TIMER E_AHI_TIMER_1 -#define CLOCK_TIMER_ISR_DEV E_AHI_DEVICE_TIMER1 - -#define OVERFLOW_TIMER E_AHI_TIMER_0 -#define OVERFLOW_TIMER_ISR_DEV E_AHI_DEVICE_TIMER0 - -/* 16Mhz / 2^10 = 15.625 kHz */ -#define CLOCK_PRESCALE 10 -#define PRESCALED_TICKS_PER_SECOND 15625 -/* 8ms tick --> overflow after ~397.7 days */ -#define CLOCK_INTERVAL 125 -/* Max schedulable number of ticks. - * Must not be more than: - * 0xffff / (16'000'000 / (1 << CLOCK_PRESCALE) / CLOCK_SECOND) - */ -#define CLOCK_MAX_SCHEDULABLE_TICKS 520 -/* Min guard time an etimer can be scheduled before an rtimer */ -#define CLOCK_RTIMER_GUARD_TIME US_TO_RTIMERTICKS(16) -/* Clock tick expressed as rtimer ticks */ -#define CLOCK_TICK ((1 << CLOCK_PRESCALE) * CLOCK_INTERVAL) - -#define RTIMER_OVERFLOW_PRESCALED 4194304 /* = 0x100000000 / (2^CLOCK_PRESCALE) */ -#define RTIMER_OVERFLOW_REMAINDER 54 /* in prescaled ticks, per one overflow */ - - -#define CLOCK_LT(a, b) ((int32_t)((a)-(b)) < 0) - -/*---------------------------------------------------------------------------*/ -static uint32_t -clock(void) -{ - /* same as rtimer_arch_now() */ - return u32AHI_TickTimerRead(); -} -/*---------------------------------------------------------------------------*/ -static uint32_t -check_rtimer_overflow(rtimer_clock_t now) -{ - static rtimer_clock_t last_rtimer_ticks; - static uint32_t clock_ticks_remainder; - static uint32_t clock_ticks_base; - - if(last_rtimer_ticks > now) { - clock_ticks_base += RTIMER_OVERFLOW_PRESCALED / CLOCK_INTERVAL; - clock_ticks_remainder += RTIMER_OVERFLOW_REMAINDER; - if(clock_ticks_remainder > CLOCK_INTERVAL) { - clock_ticks_remainder -= CLOCK_INTERVAL; - clock_ticks_base += 1; - } - } - last_rtimer_ticks = now; - return clock_ticks_base; -} -/*---------------------------------------------------------------------------*/ -static void -check_etimers(void) -{ - if(etimer_pending()) { - clock_time_t now = clock_time(); - if(!CLOCK_LT(now, etimer_next_expiration_time())) { - etimer_request_poll(); - } - } - process_nevents(); -} -/*---------------------------------------------------------------------------*/ -void -clockTimerISR(uint32 u32Device, uint32 u32ItemBitmap) -{ - if(u32Device != CLOCK_TIMER_ISR_DEV && u32Device != OVERFLOW_TIMER_ISR_DEV) { - return; - } - - if(u32Device == CLOCK_TIMER_ISR_DEV) { - check_etimers(); - } - - if(u32Device == OVERFLOW_TIMER_ISR_DEV) { - check_rtimer_overflow(clock()); - } -} -/*---------------------------------------------------------------------------*/ -void -clock_arch_calibrate(void) -{ - bAHI_SetClockRate(E_AHI_XTAL_32MHZ); - - /* Wait for oscillator to stabilise */ - while(bAHI_GetClkSource() == 1) ; - while(bAHI_Clock32MHzStable() == 0) ; - - vAHI_OptimiseWaitStates(); - - /* Turn on SPI master */ - vREG_SysWrite(REG_SYS_PWR_CTRL, u32REG_SysRead(REG_SYS_PWR_CTRL) - | REG_SYSCTRL_PWRCTRL_SPIMEN_MASK); -} -/*---------------------------------------------------------------------------*/ -void -clock_arch_init(int is_reinitialization) -{ - /* initialize etimer interrupt timer */ - vAHI_TimerEnable(CLOCK_TIMER, CLOCK_PRESCALE, 0, 1, 0); - vAHI_TimerClockSelect(CLOCK_TIMER, 0, 0); - - vAHI_TimerConfigureOutputs(CLOCK_TIMER, 0, 1); - vAHI_TimerDIOControl(CLOCK_TIMER, 0); - - vAHI_Timer1RegisterCallback(clockTimerISR); - - /* initialize and start rtimer overflow timer */ - vAHI_TimerEnable(OVERFLOW_TIMER, CLOCK_PRESCALE, 0, 1, 0); - vAHI_TimerClockSelect(OVERFLOW_TIMER, 0, 0); - - vAHI_TimerConfigureOutputs(OVERFLOW_TIMER, 0, 1); - vAHI_TimerDIOControl(OVERFLOW_TIMER, 0); - - vAHI_Timer0RegisterCallback(clockTimerISR); - vAHI_TimerStartRepeat(OVERFLOW_TIMER, 0, PRESCALED_TICKS_PER_SECOND * 4); - - if(is_reinitialization) { - /* check if the etimer has overflowed (useful when this is executed after sleep */ - check_rtimer_overflow(clock()); - } -} -/*---------------------------------------------------------------------------*/ -void -clock_init(void) -{ - /* gMAC_u8MaxBuffers = 2; */ -#ifdef JENNIC_CHIP_FAMILY_JN516x - /* Turn off debugger */ - *(volatile uint32 *)0x020000a0 = 0; -#endif - - clock_arch_calibrate(); - - /* setup clock mode and interrupt handler */ - clock_arch_init(0); -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - uint32_t now = clock(); - clock_time_t base = check_rtimer_overflow(now); - return base + now / CLOCK_TICK; -} -/*---------------------------------------------------------------------------*/ -/** - * Delay the CPU for a multiple of 0.0625 us. - */ -void -clock_delay_usec(uint16_t dt) -{ - uint32_t end = clock() + dt; - /* Note: this does not call watchdog periodic() */ - while(CLOCK_LT(clock(), end)); -} -/*---------------------------------------------------------------------------*/ -/** - * Delay the CPU for a multiple of 8 us. - */ -void -clock_delay(unsigned int dt) -{ - uint32_t end = clock() + dt * 128; - while(CLOCK_LT(clock(), end)) { - watchdog_periodic(); - } -} -/*---------------------------------------------------------------------------*/ -/** - * Wait for a multiple of 10 ms. - * - */ -void -clock_wait(clock_time_t t) -{ - clock_time_t end = clock_time() + t; - while(CLOCK_LT(clock_time(), end)) { - watchdog_periodic(); - } -} -/*---------------------------------------------------------------------------*/ -unsigned long -clock_seconds(void) -{ - return clock_time() / CLOCK_SECOND; -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_arch_time_to_etimer(void) -{ - clock_time_t time_to_etimer; - if(etimer_pending()) { - time_to_etimer = etimer_next_expiration_time() - clock_time(); - if((int32_t)time_to_etimer < 0) { - time_to_etimer = 0; - } - } else { - /* no active etimers */ - time_to_etimer = (clock_time_t)-1; - } - return time_to_etimer; -} -/*---------------------------------------------------------------------------*/ -void -clock_arch_schedule_interrupt(clock_time_t time_to_etimer, rtimer_clock_t ticks_to_rtimer) -{ - if(time_to_etimer > CLOCK_MAX_SCHEDULABLE_TICKS) { - time_to_etimer = CLOCK_MAX_SCHEDULABLE_TICKS; - } - - time_to_etimer *= CLOCK_INTERVAL; - - if(ticks_to_rtimer != (rtimer_clock_t)-1) { - /* if the next rtimer is close enough to the etimer... */ - rtimer_clock_t ticks_to_etimer = time_to_etimer * (1 << CLOCK_PRESCALE); - -#if RTIMER_USE_32KHZ - ticks_to_rtimer = (uint64_t)ticks_to_rtimer * (F_CPU / 2) / RTIMER_SECOND; -#endif - - if(!CLOCK_LT(ticks_to_rtimer, ticks_to_etimer) - && CLOCK_LT(ticks_to_rtimer, ticks_to_etimer + CLOCK_RTIMER_GUARD_TIME)) { - /* ..then schedule the etimer after the rtimer */ - time_to_etimer += 2; - } - } - - /* interrupt will not be generated if 0 is passed as the parameter */ - if(time_to_etimer == 0) { - time_to_etimer = 1; - } - - vAHI_TimerStartSingleShot(CLOCK_TIMER, 0, time_to_etimer); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/jn516x/dev/dongle/README.md b/arch/platform/jn516x/dev/dongle/README.md deleted file mode 100644 index a9b6e9cb2..000000000 --- a/arch/platform/jn516x/dev/dongle/README.md +++ /dev/null @@ -1,9 +0,0 @@ -This directory contains the contiki driver for the LED driver for the dongle. - -Mapping of LEDs on JN516x Dongle: - leds.h led on dongle: - LEDS_RED Red LED - LEDS_GREEN Green LED -Note: Only one LED can be switch on at the same time - - diff --git a/arch/platform/jn516x/dev/dongle/leds-arch.c b/arch/platform/jn516x/dev/dongle/leds-arch.c deleted file mode 100644 index 513d52b76..000000000 --- a/arch/platform/jn516x/dev/dongle/leds-arch.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "contiki.h" -#include "leds.h" -#include - -#define LED_G (1 << 16) -#define LED_R (1 << 17) - -static volatile leds_mask_t leds; - -/*---------------------------------------------------------------------------*/ -void -leds_arch_init(void) -{ - vAHI_DioSetDirection(0, LED_R | LED_G); - vAHI_DioSetOutput(0, LED_R | LED_G); /* Default off */ - leds = 0; -} -/*---------------------------------------------------------------------------*/ -leds_mask_t -leds_arch_get(void) -{ - return leds; -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set(leds_mask_t c) -{ - uint32 on_mask = 0; - uint32 off_mask = 0; - - if(c & LEDS_GREEN) { - on_mask |= LED_G; - } else { - off_mask |= LED_G; - } if(c & LEDS_RED) { - on_mask |= LED_R; - } else { - off_mask |= LED_R; - } vAHI_DioSetOutput(on_mask, off_mask); - /* Both LEDs can not be switched on at the same time. - Will result in both leds being OFF */ - if(on_mask == (LED_R | LED_G)) { - leds = 0; - } else { - leds = c; - } -} diff --git a/arch/platform/jn516x/dev/dr1174/README.md b/arch/platform/jn516x/dev/dr1174/README.md deleted file mode 100644 index 60bffde14..000000000 --- a/arch/platform/jn516x/dev/dr1174/README.md +++ /dev/null @@ -1,8 +0,0 @@ -This directory contains the contiki driver for the button sensor on the DR1174 baseboard. -When used with an extention board, sensors from the dr1175 anf dr1179 directories are used in addition to this. -leds-arch.c implements the led driver for leds D3 and D6 on the board. -Mapping of LEDs on JN516x DR1174: - leds.h: led on DR1174: - LEDS_GP0 LED D3 - LEDS_GP1 LED D6 -Note: LEDS_GPx definitions included in leds.h via jn516x-def.h diff --git a/arch/platform/jn516x/dev/dr1174/button-sensor.c b/arch/platform/jn516x/dev/dr1174/button-sensor.c deleted file mode 100644 index 9262a6ef8..000000000 --- a/arch/platform/jn516x/dev/dr1174/button-sensor.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "contiki.h" -#include "sys/etimer.h" -#include "lib/sensors.h" -#include "button-sensor.h" -#include - -/*---------------------------------------------------------------------------*/ -/* LOCAL DEFINITIONS */ -/*---------------------------------------------------------------------------*/ -/* #define DEBUG */ -#ifdef DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -typedef enum { - APP_E_BUTTON_SW0 = 0, -#if SENSOR_BOARD_DR1199 - APP_E_BUTTON_SW1, - APP_E_BUTTON_SW2, - APP_E_BUTTON_SW3, - APP_E_BUTTON_SW4, -#endif /* SENSOR_BOARD_DR1199 */ - APP_E_BUTTON_NUM /* Number of buttons */ -} app_e_button_t; - -/* Mapping of DIO port connections to buttons. Use as mask to get button value */ -#define APP_PORT_BUTTON_SW0 (8) -#if SENSOR_BOARD_DR1199 -#define APP_PORT_BUTTON_SW1 (11) -#define APP_PORT_BUTTON_SW2 (12) -#define APP_PORT_BUTTON_SW3 (17) -#define APP_PORT_BUTTON_SW4 (1) -#endif /* SENSOR_BOARD_DR1199 */ - -/* Definition of port masks based on button mapping */ -#if SENSOR_BOARD_DR1199 -#define APP_BUTTONS_DIO_MASK ((1 << APP_PORT_BUTTON_SW0) | \ - (1 << APP_PORT_BUTTON_SW1) | \ - (1 << APP_PORT_BUTTON_SW2) | \ - (1 << APP_PORT_BUTTON_SW3) | \ - (1 << APP_PORT_BUTTON_SW4)) -#else /* SENSOR_BOARD_DR1199 */ -#define APP_BUTTONS_DIO_MASK (1 << APP_PORT_BUTTON_SW0) -#endif /* SENSOR_BOARD_DR1199 */ - -#define KEY_SAMPLE_TIME (CLOCK_SECOND / 20) - -typedef enum { - BUTTONS_STATUS_NOT_INIT = 0, - BUTTONS_STATUS_INIT, - BUTTONS_STATUS_NOT_ACTIVE = BUTTONS_STATUS_INIT, - BUTTONS_STATUS_ACTIVE -} buttons_status_t; - -/*---------------------------------------------------------------------------*/ -/* LOCAL DATA DEFINITIONS */ -/*---------------------------------------------------------------------------*/ -const struct sensors_sensor button_sensor; -volatile static buttons_status_t buttons_status = BUTTONS_STATUS_NOT_INIT; -static int key_value = 0; -static uint8 key_map[] = { APP_PORT_BUTTON_SW0, /* APP_E_BUTTON_SW0 */ -#if SENSOR_BOARD_DR1199 - APP_PORT_BUTTON_SW1, /* APP_E_BUTTON_SW1 */ - APP_PORT_BUTTON_SW2, /* APP_E_BUTTON_SW2 */ - APP_PORT_BUTTON_SW3, /* APP_E_BUTTON_SW3 */ - APP_PORT_BUTTON_SW4 /* APP_E_BUTTON_SW4 */ -#endif /* SENSOR_BOARD_DR1199 */ -}; - -/*---------------------------------------------------------------------------*/ -/* LOCAL FUNCTION PROTOTYPES */ -/*---------------------------------------------------------------------------*/ -PROCESS(key_sampling, "Key sample"); -static int get_key_value(void); - -/*---------------------------------------------------------------------------*/ -/* PUBLIC FUNCTIONS */ -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type == SENSORS_HW_INIT) { - /* Called from sensor thread when started. - Configure DIO lines with buttons connected as input */ - vAHI_DioSetDirection(APP_BUTTONS_DIO_MASK, 0); - /* Turn on pull-ups for DIO lines with buttons connected */ - vAHI_DioSetPullup(APP_BUTTONS_DIO_MASK, 0); - PRINTF("HW_INIT BUTTONS (0x%x)\n", APP_BUTTONS_DIO_MASK); - /* Configure debounce timer. Do not run it yet. */ - buttons_status = BUTTONS_STATUS_INIT; - process_start(&key_sampling, NULL); - return 1; - } else if(type == SENSORS_ACTIVE) { - if(buttons_status != BUTTONS_STATUS_NOT_INIT) { - if(value) { - /* Button sensor activated */ - PRINTF("BUTTONS ACTIVATED\n"); - buttons_status = BUTTONS_STATUS_ACTIVE; - } else { - /* Button sensor de-activated */ - PRINTF("BUTTONS DE-ACTIVATED\n"); - buttons_status = BUTTONS_STATUS_NOT_ACTIVE; - } - process_post(&key_sampling, PROCESS_EVENT_MSG, (void *)&buttons_status); - return 1; - } else { - /* Buttons must be intialised before being (de)-activated */ - PRINTF("ERROR: NO HW_INIT BUTTONS\n"); - return 0; - } - } else { - /* Non valid type */ - return 0; - } -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - if(type == SENSORS_ACTIVE) { - return buttons_status == BUTTONS_STATUS_ACTIVE; - } else if(type == SENSORS_READY) { - return buttons_status != BUTTONS_STATUS_NOT_INIT; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* type: Not defined for the buttons interface - */ - return key_value; -} -/*---------------------------------------------------------------------------*/ -/* LOCAL FUNCTIONS */ -/*---------------------------------------------------------------------------*/ -static int -get_key_value(void) -{ - /* Function returns the actual key value. Pressed key will return '1' */ - int io_value = ~u32AHI_DioReadInput() & APP_BUTTONS_DIO_MASK; - int k = 0; - int key = 0; - - while(k < APP_E_BUTTON_NUM) { - if(io_value & (1 << key_map[k])) { - key |= (1 << k); - } - k++; - } - return key; -} -/* Process takes care of detecting key changes */ -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(key_sampling, ev, data) -{ - PROCESS_BEGIN(); - static struct etimer et; - static int previous_key_value = 0; - static char debounce_check = 0; - int current_key_value; - - etimer_set(&et, CLOCK_SECOND / 50); - while(1) { - PROCESS_WAIT_EVENT_UNTIL((ev == PROCESS_EVENT_TIMER) || (ev == PROCESS_EVENT_MSG)); - if(ev == PROCESS_EVENT_TIMER) { - /* Handle sensor reading. */ - PRINTF("Key sample\n"); - current_key_value = get_key_value(); - if(debounce_check != 0) { - /* Check if key remained constant */ - if(previous_key_value == current_key_value) { - sensors_changed(&button_sensor); - key_value = current_key_value; - debounce_check = 0; - } else { - /* Bouncing */ - previous_key_value = current_key_value; - } - } else - /* Check for new key change */ - if(current_key_value != previous_key_value) { - previous_key_value = current_key_value; - debounce_check = 1; - } - etimer_reset(&et); - } else { - /* ev == PROCESS_EVENT_MSG */ - if(*(buttons_status_t *)data == BUTTONS_STATUS_NOT_ACTIVE) { - /* Stop sampling */ - etimer_stop(&et); - } else if((*(buttons_status_t *)data == BUTTONS_STATUS_ACTIVE)) { - /* restart sampling */ - etimer_restart(&et); - } - } - } - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ -/* Sensor defintion for sensor module */ -SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/jn516x/dev/dr1174/button-sensor.h b/arch/platform/jn516x/dev/dr1174/button-sensor.h deleted file mode 100644 index eaa87a751..000000000 --- a/arch/platform/jn516x/dev/dr1174/button-sensor.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#ifndef __BUTTON_SENSOR_H__ -#define __BUTTON_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor button_sensor; - -#define BUTTON_SENSOR "Button" - -#endif /* __BUTTON_SENSOR_H__ */ diff --git a/arch/platform/jn516x/dev/dr1174/leds-arch.c b/arch/platform/jn516x/dev/dr1174/leds-arch.c deleted file mode 100644 index 4e49e9c53..000000000 --- a/arch/platform/jn516x/dev/dr1174/leds-arch.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "contiki.h" -#include "dev/leds.h" -#include -#ifdef SENSOR_BOARD_DR1199 -#include "dr1199/leds-arch-1199.h" -#endif -#ifdef SENSOR_BOARD_DR1175 -#include "leds-extension.h" -#include "dr1175/leds-arch-1175.h" -#endif - -#define LED_D3 (1 << 3) -#define LED_D6 (1 << 2) - -static volatile unsigned char leds; - -/*---------------------------------------------------------------------------*/ -void -leds_arch_init(void) -{ - vAHI_DioSetDirection(0, LED_D3 | LED_D6); - vAHI_DioSetOutput(LED_D3 | LED_D6, 0); /* Default off */ -#ifdef SENSOR_BOARD_DR1199 - leds_arch_init_1199(); -#endif -#ifdef SENSOR_BOARD_DR1175 - leds_arch_init_1175(); -#endif - leds = 0; -} -/*---------------------------------------------------------------------------*/ -unsigned char -leds_arch_get(void) -{ - return leds; -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set(unsigned char c) -{ - uint32 on_mask = 0; - uint32 off_mask = 0; - - /* LOW level on pins switches ON LED for DR1174 */ - if(c & LEDS_GP0) { - on_mask |= LED_D3; - } else { - off_mask |= LED_D3; - } if(c & LEDS_GP1) { - on_mask |= LED_D6; - } else { - off_mask |= LED_D6; - } vAHI_DioSetOutput(off_mask, on_mask); -#ifdef SENSOR_BOARD_DR1199 - /* DR1174 with DR1199 */ - leds_arch_set_1199(c); - if(c == LEDS_ALL) { - leds = LEDS_GP0 | LEDS_GP1 | LEDS_RED | LEDS_BLUE | LEDS_GREEN; - } else { - leds = (c & (LEDS_GP0 | LEDS_GP1 | LEDS_RED | LEDS_BLUE | LEDS_GREEN)); - } -#elif SENSOR_BOARD_DR1175 - /* DR1174 with DR1175 */ - leds_arch_set_1175(c); - if(c == LEDS_ALL) { - leds = LEDS_GP0 | LEDS_GP1 | LEDS_RED | LEDS_BLUE | LEDS_GREEN | LEDS_WHITE; - } else { - leds = (c & (LEDS_GP0 | LEDS_GP1 | LEDS_RED | LEDS_BLUE | LEDS_GREEN | LEDS_WHITE)); -/* printf("++++++++++++++++++++ leds_arch_set: leds: 0x%x\n", leds); */ - } -#else - /* DR1174-only */ - if(c == LEDS_ALL) { - leds = LEDS_GP0 | LEDS_GP1; - } else { - leds = c; - } -#endif -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set_level(unsigned char level, unsigned char c) -{ -#ifdef SENSOR_BOARD_DR1175 - leds_arch_set_level_1175(level, c, leds); -/* printf("++++++++++++++++++++ leds_arch_set_level: leds: 0x%x\n", leds); */ -#endif -} diff --git a/arch/platform/jn516x/dev/dr1175/README.md b/arch/platform/jn516x/dev/dr1175/README.md deleted file mode 100644 index e4fe60adf..000000000 --- a/arch/platform/jn516x/dev/dr1175/README.md +++ /dev/null @@ -1,17 +0,0 @@ -This directory contains the contiki driver for the sensors (light, humidity and temperature sensor) available on the -NXP DR1175 board. This board is part of the NXP JN516X Evaluation Kit (see http://www.nxp.com/documents/leaflet/75017368.pdf). - -The dr1175 sensor code interfaces to the contiki `os/lib/sensors.c` framework. -The code is specificaly for the JN516X platform, because it makes use of the platform\DK4 libraries of this JN516X SDK. -`examples/jn516x/rpl/coap-dr1175-node.c` shows an example on using this contiki driver. - -Mapping of LEDs on JN516x DR1175/DR1174: - leds.h: led on DR1175/DR1174: -DR1174+DR1175: - LEDS_RED Red led in RGB-led with level control on DR1175 - LEDS_GREEN Green led in RGB-led with level control on DR1175 - LEDS_BLUE Blue led in RGB-led with level control on DR1175 - LEDS_WHITE White power led with level control on DR1175 - LEDS_GP0 LEDS D3 on DR1174 - LEDS_GP1 LEDS D6 on DR1174 -Note: LEDS_GPx and LEDS_WHITE definitions included in leds.h via jn516x-def.h diff --git a/arch/platform/jn516x/dev/dr1175/ht-sensor.c b/arch/platform/jn516x/dev/dr1175/ht-sensor.c deleted file mode 100644 index 76f889d84..000000000 --- a/arch/platform/jn516x/dev/dr1175/ht-sensor.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "contiki.h" -#include "sys/etimer.h" -#include "lib/sensors.h" -#include "ht-sensor.h" -#include -#include - -/*---------------------------------------------------------------------------*/ -/* LOCAL DEFINITIONS */ -/*---------------------------------------------------------------------------*/ -/* #define DEBUG */ -#ifdef DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -typedef enum { - HT_SENSOR_STATUS_NOT_INIT = 0, - HT_SENSOR_STATUS_INIT, - HT_SENSOR_STATUS_NOT_ACTIVE = HT_SENSOR_STATUS_INIT, - HT_SENSOR_STATUS_ACTIVE -} ht_sensor_status_t; - -/* Absolute delta in light or humidity level needed to generate event */ -#define DELTA_TEMP_SENSOR_VALUE 1 -#define DELTA_HUM_SENSOR_VALUE 1 - -/*---------------------------------------------------------------------------*/ -/* LOCAL DATA DEFINITIONS */ -/*---------------------------------------------------------------------------*/ -const struct sensors_sensor ht_sensor; -volatile static ht_sensor_status_t ht_sensor_status = HT_SENSOR_STATUS_NOT_INIT; -static int prev_temp_event_val = 0; -static int prev_hum_event_val = 0; -static int temp_sensor_value = 0; -static int hum_sensor_value = 0; - -/*---------------------------------------------------------------------------*/ -/* LOCAL FUNCTION PROTOTYPES */ -/*---------------------------------------------------------------------------*/ -PROCESS(HTSensorSampling, "Humidity/Temperature sensor"); - -/*---------------------------------------------------------------------------*/ -/* PUBLIC FUNCTIONS */ -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type == SENSORS_HW_INIT) { - PRINTF("SENSORS_HW_INIT\n"); - ht_sensor_status = HT_SENSOR_STATUS_INIT; - process_start(&HTSensorSampling, NULL); - return 1; - } else if(type == SENSORS_ACTIVE) { - if(ht_sensor_status != HT_SENSOR_STATUS_NOT_INIT) { - if(value) { - /* ACTIVATE SENSOR */ - vHTSreset(); - prev_temp_event_val = 0; - prev_hum_event_val = 0; - /* Activate ht sensor. Start sampling */ - PRINTF("HT SENSOR ACTIVATED\n"); - ht_sensor_status = HT_SENSOR_STATUS_ACTIVE; - process_post(&HTSensorSampling, PROCESS_EVENT_MSG, (void *)&ht_sensor_status); - } else { - /* DE-ACTIVATE SENSOR */ - PRINTF("HT SENSOR DE-ACTIVATED\n"); - ht_sensor_status = HT_SENSOR_STATUS_NOT_ACTIVE; - process_post(&HTSensorSampling, PROCESS_EVENT_MSG, (void *)&ht_sensor_status); - } - return 1; - } else { - /* HT sensor must be intialised before being (de)-activated */ - PRINTF("ERROR: NO HW_INIT HT SENSOR\n"); - return 0; - } - } else { - /* Non valid type */ - return 0; - } -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - if(type == SENSORS_ACTIVE) { - return ht_sensor_status == HT_SENSOR_STATUS_ACTIVE; - } else if(type == SENSORS_READY) { - return ht_sensor_status != HT_SENSOR_STATUS_NOT_INIT; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* type: HT_SENSOR_TEMP is to return temperature - !=HT_SENSOR_TEMP is to return humidity */ - if(type == HT_SENSOR_TEMP) { - return temp_sensor_value; - } else { - return hum_sensor_value; - } -} -/*---------------------------------------------------------------------------*/ -/* LOCAL FUNCTIONS */ -/*---------------------------------------------------------------------------*/ -/* Process to get ht sensor value. - ht sensor is sampled. Sampling stopped when sensor is de-activated. - Event is generated if temp and/or hum value changed at least the value DELTA_TEMP_SENSOR_VALUE - or DELTA_HUM_SENSOR_VALUE since last event. */ -PROCESS_THREAD(HTSensorSampling, ev, data) -{ - PROCESS_BEGIN(); - static struct etimer et; - - etimer_set(&et, CLOCK_SECOND); - while(1) { - PROCESS_WAIT_EVENT_UNTIL((ev == PROCESS_EVENT_TIMER) || (ev == PROCESS_EVENT_MSG)); - if(ev == PROCESS_EVENT_TIMER) { - /* Handle sensor reading. */ - vHTSstartReadTemp(); - temp_sensor_value = u16HTSreadTempResult(); - PRINTF("Temperature sample: %d\n", temp_sensor_value); - vHTSstartReadHumidity(); - hum_sensor_value = u16HTSreadHumidityResult(); - PRINTF("Humidity sample: %d\n", hum_sensor_value); - if((abs(temp_sensor_value - prev_temp_event_val) > DELTA_TEMP_SENSOR_VALUE) || - (abs(hum_sensor_value - prev_hum_event_val) > DELTA_HUM_SENSOR_VALUE)) { - prev_temp_event_val = temp_sensor_value; - prev_hum_event_val = hum_sensor_value; - sensors_changed(&ht_sensor); - } - etimer_reset(&et); - } else { - /* ev == PROCESS_EVENT_MSG */ - if(*(int *)data == HT_SENSOR_STATUS_NOT_ACTIVE) { - /* Stop sampling */ - etimer_stop(&et); - } else if((*(int *)data == HT_SENSOR_STATUS_ACTIVE)) { - /* restart sampling */ - etimer_restart(&et); - } - } - } - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ -/* Sensor defintion for sensor module */ -SENSORS_SENSOR(ht_sensor, HT_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/jn516x/dev/dr1175/ht-sensor.h b/arch/platform/jn516x/dev/dr1175/ht-sensor.h deleted file mode 100644 index 43fb8b63a..000000000 --- a/arch/platform/jn516x/dev/dr1175/ht-sensor.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#ifndef __HT_SENSOR_H__ -#define __HT_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor ht_sensor; - -#define HT_SENSOR "TH" - -#define HT_SENSOR_TEMP 0 -#define HT_SENSOR_HUM 1 - -#endif /* __HT_SENSOR_H__ */ diff --git a/arch/platform/jn516x/dev/dr1175/leds-arch-1175.c b/arch/platform/jn516x/dev/dr1175/leds-arch-1175.c deleted file mode 100644 index c1adeb2fb..000000000 --- a/arch/platform/jn516x/dev/dr1175/leds-arch-1175.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "contiki.h" -#include "dev/leds.h" -#include - -static uint8_t white_level; -static uint8_t red_level; -static uint8_t green_level; -static uint8_t blue_level; - -/*---------------------------------------------------------------------------*/ -void -leds_arch_init_1175(void) -{ - /* White LED initialisation */ - white_level = 0; - bWhite_LED_Enable(); - bWhite_LED_SetLevel(0); - bWhite_LED_On(); - /* Coloured LED initialisation */ - red_level = 0; - green_level = 0; - blue_level = 0; - bRGB_LED_Enable(); - bRGB_LED_SetGroupLevel(255); - bRGB_LED_SetLevel(0, 0, 0); - bRGB_LED_On(); -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set_1175(unsigned char c) -{ - bWhite_LED_SetLevel(c & LEDS_WHITE ? white_level : 0); - bRGB_LED_SetLevel(c & LEDS_RED ? red_level : 0, - c & LEDS_GREEN ? green_level : 0, - c & LEDS_BLUE ? blue_level : 0); -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set_level_1175(unsigned char level, unsigned char c, unsigned char leds) -{ - if(c & LEDS_WHITE) { - white_level = level; - } - if(c & LEDS_RED) { - red_level = level; - } - if(c & LEDS_GREEN) { - green_level = level; - } - if(c & LEDS_BLUE) { - blue_level = level; - /* Activate level if LED is on */ - } - bRGB_LED_SetLevel(leds & LEDS_RED ? red_level : 0, - leds & LEDS_GREEN ? green_level : 0, - leds & LEDS_BLUE ? blue_level : 0); - bWhite_LED_SetLevel(leds & LEDS_WHITE ? white_level : 0); -} \ No newline at end of file diff --git a/arch/platform/jn516x/dev/dr1175/leds-arch-1175.h b/arch/platform/jn516x/dev/dr1175/leds-arch-1175.h deleted file mode 100644 index 7611bc51d..000000000 --- a/arch/platform/jn516x/dev/dr1175/leds-arch-1175.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -void leds_arch_init_1175(void); -void leds_arch_set_1175(unsigned char c); -void leds_arch_set_level_1175(unsigned char level, unsigned char c, unsigned char leds); diff --git a/arch/platform/jn516x/dev/dr1175/light-sensor.c b/arch/platform/jn516x/dev/dr1175/light-sensor.c deleted file mode 100644 index 6a25b2af4..000000000 --- a/arch/platform/jn516x/dev/dr1175/light-sensor.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "contiki.h" -#include "sys/etimer.h" -#include "lib/sensors.h" -#include "light-sensor.h" -#include -#include -#include - -/*---------------------------------------------------------------------------*/ -/* LOCAL DEFINITIONS */ -/*---------------------------------------------------------------------------*/ -/* #define DEBUG */ -#ifdef DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -typedef enum { - LIGHT_SENSOR_STATUS_NOT_INIT = 0, - LIGHT_SENSOR_STATUS_INIT, - LIGHT_SENSOR_STATUS_NOT_ACTIVE = LIGHT_SENSOR_STATUS_INIT, - LIGHT_SENSOR_STATUS_ACTIVE -} light_sensor_status_t; - -/* Absolute delta in light level needed to generate event */ -#define DELTA_LIGHT_SENSOR_VALUE 1 - -/*---------------------------------------------------------------------------*/ -/* LOCAL DATA DEFINITIONS */ -/*---------------------------------------------------------------------------*/ -const struct sensors_sensor light_sensor; -volatile static light_sensor_status_t light_sensor_status = LIGHT_SENSOR_STATUS_NOT_INIT; -static int prev_light_event_val = 0; -static int light_sensor_value = 0; - -/*---------------------------------------------------------------------------*/ -/* LOCAL FUNCTION PROTOTYPES */ -/*---------------------------------------------------------------------------*/ -static int adjust(int input1, int input2); -PROCESS(LightSensorSampling, "Light sensor"); - -/*---------------------------------------------------------------------------*/ -/* PUBLIC FUNCTIONS */ -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type == SENSORS_HW_INIT) { - PRINTF("SENSORS_HW_INIT\n"); - light_sensor_status = LIGHT_SENSOR_STATUS_INIT; - process_start(&LightSensorSampling, NULL); - return 1; - } else if(type == SENSORS_ACTIVE) { - if(light_sensor_status != LIGHT_SENSOR_STATUS_NOT_INIT) { - if(value) { - /* ACTIVATE SENSOR */ - vALSreset(); - prev_light_event_val = 0; - /* Activate light sensor. Use channel 0. (Channel 1 = IR). Start sampling */ - PRINTF("LIGHT SENSOR ACTIVATED\n"); - light_sensor_status = LIGHT_SENSOR_STATUS_ACTIVE; - process_post(&LightSensorSampling, PROCESS_EVENT_MSG, (void *)&light_sensor_status); - } else { - /* DE-ACTIVATE SENSOR */ - vALSpowerDown(); - PRINTF("LIGHT SENSOR DE-ACTIVATED\n"); - light_sensor_status = LIGHT_SENSOR_STATUS_NOT_ACTIVE; - process_post(&LightSensorSampling, PROCESS_EVENT_MSG, (void *)&light_sensor_status); - } - return 1; - } else { - /* Light sensor must be intialised before being (de)-activated */ - PRINTF("ERROR: NO HW_INIT LIGHT SENSOR\n"); - return 0; - } - } else { - /* Non valid type */ - return 0; - } -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - if(type == SENSORS_ACTIVE) { - return light_sensor_status == LIGHT_SENSOR_STATUS_ACTIVE; - } else if(type == SENSORS_READY) { - return light_sensor_status != LIGHT_SENSOR_STATUS_NOT_INIT; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* type: Not defined for the light sensor interface */ - return light_sensor_value; -} -/*---------------------------------------------------------------------------*/ -/* LOCAL FUNCTIONS */ -/*---------------------------------------------------------------------------*/ -/* Process to get light sensor value. - Light sensor is sampled. Sampling stopped when sensor is de-activated. - Event is generated if light value changed at least the value DELTA_LIGHT_SENSOR_VALUE - since last event. */ -PROCESS_THREAD(LightSensorSampling, ev, data) -{ - PROCESS_BEGIN(); - static struct etimer et; - int channel0_value, channel1_value; - - etimer_set(&et, CLOCK_SECOND / 10); - while(1) { - PROCESS_WAIT_EVENT_UNTIL((ev == PROCESS_EVENT_TIMER) || (ev == PROCESS_EVENT_MSG)); - if(ev == PROCESS_EVENT_TIMER) { - /* Handle sensor reading. */ - PRINTF("Light sensor sample\n"); - vALSstartReadChannel(0); - channel0_value = u16ALSreadChannelResult(); - PRINTF("Channel 0 = %d\n", channel0_value); - vALSstartReadChannel(1); - channel1_value = u16ALSreadChannelResult(); - PRINTF("Channel 1 = %d\n", channel1_value); - light_sensor_value = adjust(channel0_value, channel1_value); - PRINTF("Light output = %d\n", light_sensor_value); - if(abs(light_sensor_value - prev_light_event_val) > DELTA_LIGHT_SENSOR_VALUE) { - prev_light_event_val = light_sensor_value; - sensors_changed(&light_sensor); - } - etimer_reset(&et); - } else { - /* ev == PROCESS_EVENT_MSG */ - if(*(int *)data == LIGHT_SENSOR_STATUS_NOT_ACTIVE) { - /* Stop sampling */ - etimer_stop(&et); - } else if((*(int *)data == LIGHT_SENSOR_STATUS_ACTIVE)) { - /* restart sampling */ - etimer_restart(&et); - } - } - } - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ -/* Sensor defintion for sensor module */ -SENSORS_SENSOR(light_sensor, LIGHT_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------*/ -/* adjust() converts the 2 measured light level into 1 ambient light level. */ -/* See manual JN-RM-2003.pdf */ -/* Approximation is used: output[Lux] = 0.39*(ch0-ch1) */ -/*---------------------------------------------------------------------------*/ -static int -adjust(int ch0, int ch1) -{ - if(ch0 > ch1) { - return (39 * (ch0 - ch1)) / 100; - } else { - return 0; - } -} diff --git a/arch/platform/jn516x/dev/dr1175/light-sensor.h b/arch/platform/jn516x/dev/dr1175/light-sensor.h deleted file mode 100644 index 49f9d9bbd..000000000 --- a/arch/platform/jn516x/dev/dr1175/light-sensor.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#ifndef __LIGHT_SENSOR_H__ -#define __LIGHT_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor light_sensor; - -#define LIGHT_SENSOR "Light" - -#endif /* __LIGHT_SENSOR_H__ */ diff --git a/arch/platform/jn516x/dev/dr1199/README.md b/arch/platform/jn516x/dev/dr1199/README.md deleted file mode 100644 index c6e622652..000000000 --- a/arch/platform/jn516x/dev/dr1199/README.md +++ /dev/null @@ -1,19 +0,0 @@ -This directory contains the contiki driver for the sensor (potentiometer) available on the -NXP DR1199 board. This board is part of the NXP JN516x Evaluation Kit (see http://www.nxp.com/documents/leaflet/75017368.pdf). -The driver for the switches on the DR1199 are supported by `dev/dr1174` when compiled with the flag `SENSOR_BOARD_DR1199` set. - -The dr1199 sensor code interfaces to contiki `os/lib/sensors.c` framework. -The code is specificaly for the JN516X platform, because it makes use of the platform\DK4 libraries -of this JN516X SDK. -`examples/jn516x/rpl/coap-dr1199-node.c` shows an example on using this contiki driver. -leds-arch.c implements the led driver for leds D3 and D6 on the DR1174 base-board and the DR1199 board. -Mapping of LEDs on JN516x DR1199/DR1174: - leds.h: led on DR1174: -DR1174+DR1199: - leds.h physical leds - LEDS_GREEN LED D1 on DR1199 - LEDS_BLUE LED D2 on DR1199 - LEDS_RED LED D3 on DR1199 - LEDS_GP0 LED D3 on DR1174 - LEDS_GP1 LED D6 on DR1174 -Note: LEDS_GPx definitions included in leds.h via jn516x-def.h diff --git a/arch/platform/jn516x/dev/dr1199/leds-arch-1199.c b/arch/platform/jn516x/dev/dr1199/leds-arch-1199.c deleted file mode 100644 index c6dc1c3ba..000000000 --- a/arch/platform/jn516x/dev/dr1199/leds-arch-1199.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "contiki.h" -#include "dev/leds.h" -#include - -/*---------------------------------------------------------------------------*/ -void -leds_arch_init_1199(void) -{ - vGenericLEDInit(); -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set_1199(unsigned char c) -{ - vGenericLEDSetOutput(GEN_BOARD_LED_D1_VAL, c & LEDS_GREEN); - vGenericLEDSetOutput(GEN_BOARD_LED_D2_VAL, c & LEDS_BLUE); - vGenericLEDSetOutput(GEN_BOARD_LED_D3_VAL, c & LEDS_RED); -} diff --git a/arch/platform/jn516x/dev/dr1199/leds-arch-1199.h b/arch/platform/jn516x/dev/dr1199/leds-arch-1199.h deleted file mode 100644 index 477d2402b..000000000 --- a/arch/platform/jn516x/dev/dr1199/leds-arch-1199.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -void leds_arch_init_1199(void); -void leds_arch_set_1199(unsigned char c); diff --git a/arch/platform/jn516x/dev/dr1199/pot-sensor.c b/arch/platform/jn516x/dev/dr1199/pot-sensor.c deleted file mode 100644 index e6254337a..000000000 --- a/arch/platform/jn516x/dev/dr1199/pot-sensor.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "contiki.h" -#include "sys/etimer.h" -#include "lib/sensors.h" -#include "pot-sensor.h" -#include -#include - -/*---------------------------------------------------------------------------*/ -/* LOCAL DEFINITIONS */ -/*---------------------------------------------------------------------------*/ -/* #define DEBUG */ -#ifdef DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -typedef enum { - POT_STATUS_NOT_INIT = 0, - POT_STATUS_INIT, - POT_STATUS_NOT_ACTIVE = POT_STATUS_INIT, - POT_STATUS_ACTIVE -} pot_status_t; - -/* Absolute delta in pot level needed to generate event */ -#define DELTA_POT_VALUE 1 - -/*---------------------------------------------------------------------------*/ -/* LOCAL DATA DEFINITIONS */ -/*---------------------------------------------------------------------------*/ -const struct sensors_sensor pot_sensor; -volatile static pot_status_t pot_status = POT_STATUS_NOT_INIT; -static int prev_pot_event_val = 0; -static int pot_value = 0; - -/*---------------------------------------------------------------------------*/ -/* LOCAL FUNCTION PROTOTYPES */ -/*---------------------------------------------------------------------------*/ -PROCESS(POTSampling, "POT"); - -/*---------------------------------------------------------------------------*/ -/* PUBLIC FUNCTIONS */ -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type == SENSORS_HW_INIT) { - pot_status = POT_STATUS_INIT; - bPotEnable(); - process_start(&POTSampling, NULL); - return 1; - } else if(type == SENSORS_ACTIVE) { - if(pot_status != POT_STATUS_NOT_INIT) { - if(value) { - /* ACTIVATE SENSOR */ - bPotEnable(); - prev_pot_event_val = 0; - /* Activate POT. */ - PRINTF("POT ACTIVATED\n"); - pot_status = POT_STATUS_ACTIVE; - process_post(&POTSampling, PROCESS_EVENT_MSG, (void *)&pot_status); - } else { - /* DE-ACTIVATE SENSOR */ - bPotDisable(); - PRINTF("POT DE-ACTIVATED\n"); - pot_status = POT_STATUS_NOT_ACTIVE; - process_post(&POTSampling, PROCESS_EVENT_MSG, (void *)&pot_status); - } - return 1; - } else { - /* - POT must be intialised before being (de)-activated */ - PRINTF("ERROR: NO HW_INIT POT\n"); - return 0; - } - } else { - /* Non valid type */ - return 0; - } -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - if(type == SENSORS_ACTIVE) { - return pot_status == POT_STATUS_ACTIVE; - } else if(type == SENSORS_READY) { - return pot_status != POT_STATUS_NOT_INIT; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* type: Not defined for the pot interface */ - return pot_value; -} -/*---------------------------------------------------------------------------*/ -/* LOCAL FUNCTIONS */ -/*---------------------------------------------------------------------------*/ -/* Process to get POT_SENSOR value. - POT is sampled. Sampling stopped when POT is de-activated. - Event is generated if pot value changed at least the value DELTA_POT_VALUE - since last event. */ -PROCESS_THREAD(POTSampling, ev, data) -{ - PROCESS_BEGIN(); - static struct etimer et; - - etimer_set(&et, CLOCK_SECOND / 10); - while(1) { - PROCESS_WAIT_EVENT_UNTIL((ev == PROCESS_EVENT_TIMER) || (ev == PROCESS_EVENT_MSG)); - if(ev == PROCESS_EVENT_TIMER) { - /* Handle sensor reading. */ - PRINTF("POT sample\n"); - pot_value = u16ReadPotValue(); - PRINTF("POT = %d\n", pot_value); - if(abs(pot_value - prev_pot_event_val) > DELTA_POT_VALUE) { - prev_pot_event_val = pot_value; - sensors_changed(&pot_sensor); - } - etimer_reset(&et); - } else { - /* ev == PROCESS_EVENT_MSG */ - if(*(int *)data == POT_STATUS_NOT_ACTIVE) { - /* Stop sampling */ - etimer_stop(&et); - } else if((*(int *)data == POT_STATUS_ACTIVE)) { - /* restart sampling */ - etimer_restart(&et); - } - } - } - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ -/* Sensor defintion for sensor module */ -SENSORS_SENSOR(pot_sensor, POT_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ - diff --git a/arch/platform/jn516x/dev/dr1199/pot-sensor.h b/arch/platform/jn516x/dev/dr1199/pot-sensor.h deleted file mode 100644 index d2297f822..000000000 --- a/arch/platform/jn516x/dev/dr1199/pot-sensor.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#ifndef __POT_SENSOR_H__ -#define __POT_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor pot_sensor; - -#define POT_SENSOR "pot" - -#endif /* __POT_SENSOR_H__ */ - diff --git a/arch/platform/jn516x/dev/exceptions.c b/arch/platform/jn516x/dev/exceptions.c deleted file mode 100644 index 172118a97..000000000 --- a/arch/platform/jn516x/dev/exceptions.c +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Thomas Haydon - * Integrated into Contiki by Beshr Al Nahas - * - */ - -#include -#include -#include -#include "contiki.h" -#include "exceptions.h" - -#ifndef EXCEPTION_STALLS_SYSTEM -#define EXCEPTION_STALLS_SYSTEM 0 -#endif /* EXCEPTION_STALLS_SYSTEM */ - -#ifndef PRINT_STACK_ON_REBOOT -#define PRINT_STACK_ON_REBOOT 1 -#endif /* PRINT_STACK_ON_REBOOT */ - -/** Define to dump the stack on exception */ -#ifndef EXC_DUMP_STACK -#define EXC_DUMP_STACK -#endif /* EXC_DUMP_STACK */ - -/** Define to dump registers on exception */ -#ifndef EXC_DUMP_REGS -/* #define EXC_DUMP_REGS */ -#endif /* EXC_DUMP_REGS */ - -/* Select whether exception vectors should be in RAM or Flash based on chip family */ -#if (defined JENNIC_CHIP_FAMILY_JN514x) -#define EXCEPTION_VECTORS_LOCATION_RAM -#elif (defined JENNIC_CHIP_FAMILY_JN516x) -#define EXCEPTION_VECTORS_LOCATION_FLASH -#else -#error Unsupported chip family selected -#endif /* JENNIC_CHIP_FAMILY */ - -#if (defined EXCEPTION_VECTORS_LOCATION_RAM) -/* RAM exception vectors are set up at run time */ -/* Addresses of exception vectors in RAM */ -#define BUS_ERROR *((volatile uint32 *)(0x4000000)) -#define TICK_TIMER *((volatile uint32 *)(0x4000004)) -#define UNALIGNED_ACCESS *((volatile uint32 *)(0x4000008)) -#define ILLEGAL_INSTRUCTION *((volatile uint32 *)(0x400000c)) -#define EXTERNAL_INTERRUPT *((volatile uint32 *)(0x4000010)) -#define SYSCALL *((volatile uint32 *)(0x4000014)) -#define TRAP *((volatile uint32 *)(0x4000018)) -#define GENERIC *((volatile uint32 *)(0x400001c)) -#define STACK_OVERFLOW *((volatile uint32 *)(0x4000020)) -#elif (defined EXCEPTION_VECTORS_LOCATION_FLASH) -/* Flash exception vectors are set up at compile time */ -#else -#error Unknown exception vector location -#endif /* EXCEPTION_VECTORS_LOCATION */ - -/* Locations in stack trace of important information */ -#define STACK_REG 1 -#define PROGRAM_COUNTER 18 -#define EFFECTIVE_ADDR 19 - -/* Number of registers */ -#define REG_COUNT 16 - -/* Chip dependant RAM size */ -#if defined(JENNIC_CHIP_JN5148) || defined(JENNIC_CHIP_JN5148J01) -#define EXCEPTION_RAM_TOP 0x04020000 -#else -#define EXCEPTION_RAM_TOP 0x04008000 -#endif - -static void exception_handler(uint32 *pu32Stack, eExceptionType eType); -static void *heap_alloc_overflow_protect(void *pvPointer, uint32 u32Size, bool_t bClear); -/*---------------------------------------------------------------------------*/ -#if PRINT_STACK_ON_REBOOT -static void hexprint(uint8 v); -static void hexprint32(uint32 v); -static void printstring(const char *s); -#endif /* PRINT_STACK_ON_REBOOT */ - -/* For debugging */ -static const char *debug_filename = "nothing"; -static int debug_line = -1; - -void -debug_file_line(const char *file, int line) -{ - debug_filename = file; - debug_line = line; -} -extern uint32 heap_location; -extern void *(*prHeap_AllocFunc)(void *, uint32, bool_t); -PRIVATE void *(*prHeap_AllocOrig)(void *, uint32, bool_t); - -/* Symbol defined by the linker script */ -/* marks the end of the stack */ -extern void *stack_low_water_mark; - -/****************************************************************************/ -/*** Local Functions ***/ -/****************************************************************************/ -/*---------------------------------------------------------------------------*/ -#if PRINT_STACK_ON_REBOOT -#include "dev/uart0.h" -#define printchar(X) uart0_write_direct(X) -/*---------------------------------------------------------------------------*/ -static void -hexprint(uint8 v) -{ - const char hexconv[] = "0123456789abcdef"; - printchar(hexconv[v >> 4]); - printchar(hexconv[v & 0x0f]); -} -/*---------------------------------------------------------------------------*/ -static void -hexprint32(uint32 v) -{ - hexprint(((uint32)v) >> (uint32)24); - hexprint(((uint32)v) >> (uint32)16); - hexprint(((uint32)v) >> (uint32)8); - hexprint((v) & 0xff); -} -/*---------------------------------------------------------------------------*/ -static void -printstring(const char *s) -{ - while(*s) { - printchar(*s++); - } -} -#endif /* PRINT_STACK_ON_REBOOT */ - -/**************************************************************************** - * - * NAME: vEXC_Register - * - * DESCRIPTION: - * Set up exceptions. When in RAM, overwrite the default vectors with ours. - * We also patch the heap allocation function so that we can keep tabs on - * the amount of free heap. - * - * PARAMETERS: None - * - * RETURNS: - * None - * - ****************************************************************************/ -PUBLIC void -vEXC_Register(void) -{ -#ifdef EXCEPTION_VECTORS_LOCATION_RAM - /* Overwrite exception vectors, pointing them all at the generic handler */ - BUS_ERROR = (uint32)exception_handler; - UNALIGNED_ACCESS = (uint32)exception_handler; - ILLEGAL_INSTRUCTION = (uint32)exception_handler; - SYSCALL = (uint32)exception_handler; - TRAP = (uint32)exception_handler; - GENERIC = (uint32)exception_handler; - STACK_OVERFLOW = (uint32)exception_handler; -#endif /* EXCEPTION_VECTORS_LOCATION */ - - prHeap_AllocOrig = prHeap_AllocFunc; - prHeap_AllocFunc = heap_alloc_overflow_protect; -} -#ifdef EXCEPTION_VECTORS_LOCATION_FLASH -/* If exception vectors are in flash, define the handler functions here to be linked in */ -/* These function names are defined in the 6x linker script for the various exceptions */ -/* Point them all at the generic handler */ -PUBLIC void -vException_BusError(uint32 *pu32Stack, eExceptionType eType) -{ - exception_handler(pu32Stack, eType); -} -PUBLIC void -vException_UnalignedAccess(uint32 *pu32Stack, eExceptionType eType) -{ - exception_handler(pu32Stack, eType); -} -PUBLIC void -vException_IllegalInstruction(uint32 *pu32Stack, eExceptionType eType) -{ - exception_handler(pu32Stack, eType); -} -PUBLIC void -vException_SysCall(uint32 *pu32Stack, eExceptionType eType) -{ - exception_handler(pu32Stack, eType); -} -PUBLIC void -vException_Trap(uint32 *pu32Stack, eExceptionType eType) -{ - exception_handler(pu32Stack, eType); -} -PUBLIC void -vException_StackOverflow(uint32 *pu32Stack, eExceptionType eType) -{ - exception_handler(pu32Stack, eType); -} -#endif /* EXCEPTION_VECTORS_LOCATION_FLASH */ - -/**************************************************************************** - * - * NAME: exception_handler - * - * DESCRIPTION: - * Generic exception handler which is called whether the vectors are in RAM or flash - * - * PARAMETERS: None - * - * RETURNS: - * None - * - ****************************************************************************/ -static void -exception_handler(uint32 *pu32Stack, eExceptionType eType) -{ -#if (defined EXC_DUMP_STACK) || (defined EXC_DUMP_REGS) - int i; -#endif - uint32 u32EPCR, u32EEAR, u32Stack; - char *pcString; - - MICRO_DISABLE_INTERRUPTS(); - - switch(eType) { - case E_EXC_BUS_ERROR: - pcString = "BUS"; - break; - - case E_EXC_UNALIGNED_ACCESS: - pcString = "ALIGN"; - break; - - case E_EXC_ILLEGAL_INSTRUCTION: - pcString = "ILLEGAL"; - break; - - case E_EXC_SYSCALL: - pcString = "SYSCALL"; - break; - - case E_EXC_TRAP: - pcString = "TRAP"; - break; - - case E_EXC_GENERIC: - pcString = "GENERIC"; - break; - - case E_EXC_STACK_OVERFLOW: - pcString = "STACK"; - break; - - default: - pcString = "UNKNOWN"; - break; - } - - if(bAHI_WatchdogResetEvent()) { - pcString = "WATCHDOG"; - } - vAHI_WatchdogStop(); - - /* Pull the EPCR and EEAR values from where they've been saved by the ROM exception handler */ - u32EPCR = pu32Stack[PROGRAM_COUNTER]; - u32EEAR = pu32Stack[EFFECTIVE_ADDR]; - u32Stack = pu32Stack[STACK_REG]; - - /* Log the exception */ - printstring("\n\n\n"); - printstring(pcString); - printstring(" EXCEPTION @ $"); - hexprint32(u32EPCR); - printstring(" EA: "); - hexprint32(u32EEAR); - printstring(" SK: "); - hexprint32(u32Stack); - printstring(" HP: "); - hexprint32(((uint32 *)&heap_location)[0]); - printstring("\n"); - printstring(" File: "); - printstring(debug_filename); - printstring(" Line: "); - hexprint32(debug_line); - printstring("\n"); - -#ifdef EXC_DUMP_REGS - printstring("\nREGS: "); - /* Pull and print the registers from saved locations */ - for(i = 0; i < REG_COUNT; i += 4) { - printstring("R"); - hexprint(i); - printstring("-"); - hexprint(i + 3); - printstring(": "); - hexprint(pu32Stack[i]); - printstring(" "); - hexprint32(pu32Stack[i + 1]); - printstring(" "); - hexprint32(pu32Stack[i + 2]); - printstring(" "); - hexprint32(pu32Stack[i + 3]); - printstring("\n"); - } -#endif - -#ifdef EXC_DUMP_STACK - /* Print the stack */ - printstring("\nRAM top: "); - hexprint32(EXCEPTION_RAM_TOP); - printstring("\nSTACK: \n"); - pu32Stack = (uint32 *)(u32Stack & 0xFFFFFFF0); - for(i = 0; (pu32Stack + i) < (uint32 *)(EXCEPTION_RAM_TOP); i += 4) { - printstring("@"); - hexprint32((uint32)(pu32Stack + i)); - printstring(": "); - hexprint32(pu32Stack[i]); - printstring(" "); - hexprint32(pu32Stack[i + 1]); - printstring(" "); - hexprint32(pu32Stack[i + 2]); - printstring(" "); - hexprint32(pu32Stack[i + 3]); - printstring("\n"); - } -#endif - - if(eType == E_EXC_SYSCALL) { - return; - } - -#if EXCEPTION_STALLS_SYSTEM - while(1) { - } -#else /* EXCEPTION_STALLS_SYSTEM */ - /* Software reset */ - vAHI_WatchdogException(0); - vAHI_SwReset(); -#endif /* EXCEPTION_STALLS_SYSTEM */ -} -/**************************************************************************** - * - * NAME: heap_alloc_overflow_protect - * - * DESCRIPTION: - * New heap allocation function that sets the stack overflow location to the new - * top address of the heap. - * - * PARAMETERS: Name RW Usage - * pvPointer W Location of allocated heap memory - * u32Size R Number of bytes to allocate - * bClear R Flag to set new memory to 0 - * - * RETURNS: - * Pointer to new memory - * - ****************************************************************************/ -static void * -heap_alloc_overflow_protect(void *pvPointer, uint32 u32Size, bool_t bClear) -{ - void *pvAlloc; - /* Call original heap allocation function */ - pvAlloc = prHeap_AllocOrig(pvPointer, u32Size, bClear); - /* - * Initialise the stack overflow exception to trigger if the end of the - * stack is reached. See the linker command file to adjust the allocated - * stack size. - */ - /* Set stack overflow address */ - vAHI_SetStackOverflow(TRUE, ((uint32 *)&heap_location)[0]); - return pvAlloc; -} diff --git a/arch/platform/jn516x/dev/exceptions.h b/arch/platform/jn516x/dev/exceptions.h deleted file mode 100644 index 6acfd8d16..000000000 --- a/arch/platform/jn516x/dev/exceptions.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Thomas Haydon - * Integrated into Contiki by Beshr Al Nahas - * - */ - -#ifndef EXCEPTIONS_H -#define EXCEPTIONS_H - -#include - -/** Enumerated type of CPU exception numbers */ -typedef enum { - E_EXC_BUS_ERROR = 0x02, - E_EXC_TICK_TIMER = 0x05, - E_EXC_UNALIGNED_ACCESS = 0x06, - E_EXC_ILLEGAL_INSTRUCTION = 0x07, - E_EXC_EXTERNAL_INTERRUPT = 0x08, - E_EXC_SYSCALL = 0x0C, - E_EXC_TRAP = 0x0E, - E_EXC_GENERIC = 0x0F, - E_EXC_STACK_OVERFLOW = 0x10 -} eExceptionType; - -/* Exceptions set up function */ -PUBLIC void vEXC_Register(void); -/* For debugging */ -void debug_file_line(const char *file, int line); - -#endif /* EXCEPTIONS_H */ diff --git a/arch/platform/jn516x/dev/jn516x-ccm-star.c b/arch/platform/jn516x/dev/jn516x-ccm-star.c deleted file mode 100644 index b846985be..000000000 --- a/arch/platform/jn516x/dev/jn516x-ccm-star.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * CCM* header implementation exploiting the JN516x - * cryptographic co-processor - * \author - * Simon Duquennoy - */ - -#include "ccm-star.h" -#include -#include - -static tsReg128 current_key; -static int current_key_is_new = 1; - -/*---------------------------------------------------------------------------*/ -static void -aead(const uint8_t *nonce, - uint8_t *m, uint8_t m_len, - const uint8_t *a, uint8_t a_len, - uint8_t *result, uint8_t mic_len, - int forward) -{ - tsReg128 nonce_aligned; - memcpy(&nonce_aligned, nonce, sizeof(nonce_aligned)); - if(forward) { - bACI_CCMstar( - ¤t_key, - current_key_is_new, - XCV_REG_AES_SET_MODE_CCM, - mic_len, - a_len, - m_len, - &nonce_aligned, - (uint8_t *)a, - (uint8_t *)m, - (uint8_t *)m, - result, - NULL - ); - } else { - bool_t auth; - bACI_CCMstar( - ¤t_key, - current_key_is_new, - XCV_REG_AES_SET_MODE_CCM_D, - mic_len, - a_len, - m_len, - &nonce_aligned, - (uint8_t *)a, - (uint8_t *)m, - (uint8_t *)m, - (uint8_t *)a + a_len + m_len, - &auth - ); - /* To comply with the CCM_STAR interface, copy MIC to result in case of success */ - if(result != NULL) { - if(auth) { - memcpy(result, a + a_len + m_len, mic_len); - } else { - /* Otherwise, corrupt the result */ - memcpy(result, a + a_len + m_len, mic_len); - result[0]++; - } - } - } - - current_key_is_new = 0; -} -/*---------------------------------------------------------------------------*/ -static void -set_key(const uint8_t *key) -{ - if(memcmp(¤t_key, key, sizeof(current_key)) == 0) { - current_key_is_new = 0; - } else { - memcpy(¤t_key, key, sizeof(current_key)); - current_key_is_new = 1; - } -} -/*---------------------------------------------------------------------------*/ -const struct ccm_star_driver ccm_star_driver_jn516x = { - set_key, - aead -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/jn516x/dev/leds-extension.c b/arch/platform/jn516x/dev/leds-extension.c deleted file mode 100644 index 05e9a8223..000000000 --- a/arch/platform/jn516x/dev/leds-extension.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "leds-extension.h" -#include "dev/leds.h" - -void -leds_set_level(unsigned char level, unsigned char c) -{ - leds_arch_set_level(level, c); -} diff --git a/arch/platform/jn516x/dev/leds-extension.h b/arch/platform/jn516x/dev/leds-extension.h deleted file mode 100644 index 2e33b59ff..000000000 --- a/arch/platform/jn516x/dev/leds-extension.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#ifndef LEDS_EXTENSION_H_ -#define LEDS_EXTENSION_H_ - -void leds_set_level(unsigned char level, unsigned char c); - -/** - * Leds implementation - */ -void leds_arch_set_level(unsigned char level, unsigned char c); - -#endif /* LEDS_EXTENSION_H_ */ \ No newline at end of file diff --git a/arch/platform/jn516x/dev/micromac-radio.c b/arch/platform/jn516x/dev/micromac-radio.c deleted file mode 100644 index bad81f4f0..000000000 --- a/arch/platform/jn516x/dev/micromac-radio.c +++ /dev/null @@ -1,1067 +0,0 @@ -/* - * Copyright (c) 2014, NXP and SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Contiki driver for NXP JN516X using MMAC interface - * \authors - * Beshr Al Nahas - * Simon Duquennot - * Atis Elsts - * - */ - -#include -#include "contiki.h" -#include "dev/leds.h" -#include "sys/rtimer.h" -#include "sys/energest.h" -#include "net/packetbuf.h" -#include "net/netstack.h" -#include "net/mac/framer/frame802154.h" -#include "lib/crc16.h" -#include "lib/ringbufindex.h" - -#include "AppHardwareApi.h" -#include "MMAC.h" -#include "micromac-radio.h" -#include "JPT.h" -#include "PeripheralRegs.h" - -/* This driver configures the radio in PHY mode and does address decoding - * and acknowledging in software. */ - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -#ifdef MICROMAC_CONF_RADIO_MAC -#define MICROMAC_RADIO_MAC MICROMAC_CONF_RADIO_MAC -#else -#define MICROMAC_RADIO_MAC 0 -#endif - -#if MICROMAC_RADIO_MAC -#define MICROMAC_FRAME tsMacFrame -#else -#define MICROMAC_FRAME tsPhyFrame -#endif - -/* Perform CRC check for received packets in SW, - * since we use PHY mode which does not calculate CRC in HW */ -#define CRC_SW 1 - -#define CHECKSUM_LEN 2 - -/* Max packet duration: 5 + 127 + 2 bytes, 32us per byte */ -#define MAX_PACKET_DURATION US_TO_RTIMERTICKS((127 + 2) * 32 + RADIO_DELAY_BEFORE_TX) -/* Max ACK duration: 5 + 3 + 2 bytes */ -#define MAX_ACK_DURATION US_TO_RTIMERTICKS((3 + 2) * 32 + RADIO_DELAY_BEFORE_TX) - -/* Test-mode pins output on dev-kit */ -#define RADIO_TEST_MODE_HIGH_PWR 1 -#define RADIO_TEST_MODE_ADVANCED 2 -#define RADIO_TEST_MODE_DISABLED 0 - -#ifndef RADIO_TEST_MODE -#define RADIO_TEST_MODE RADIO_TEST_MODE_DISABLED -#endif /* RADIO_TEST_MODE */ - -/* The number of input buffers */ -#ifndef MIRCOMAC_CONF_BUF_NUM -#define MIRCOMAC_CONF_BUF_NUM 2 -#endif /* MIRCOMAC_CONF_BUF_NUM */ - -/* Default energy level threshold for clear channel detection */ -#ifndef MICROMAC_CONF_CCA_THR -#define MICROMAC_CONF_CCA_THR 39 /* approximately -85 dBm */ -#endif /* MICROMAC_CONF_CCA_THR */ - -#if (JENNIC_CHIP == JN5169) -#define OUTPUT_POWER_MAX 10 -#define OUTPUT_POWER_MIN (-32) -#define ABS_OUTPUT_POWER_MIN (32) -#else -#define OUTPUT_POWER_MAX 0 -#define OUTPUT_POWER_MIN (-32) -#endif - -/* Default Tx power [dBm] (between OUTPUT_POWER_MIN and OUTPUT_POWER_MAX) */ -#ifndef MICROMAC_CONF_TX_POWER -#define MICROMAC_CONF_TX_POWER 0 -#endif - -/* Autoack */ -#ifndef MICROMAC_CONF_AUTOACK -#define MICROMAC_CONF_AUTOACK 1 -#endif /* MICROMAC_CONF_AUTOACK */ - -/* Set radio always on for now because this is what Contiki MAC layers - * expect. */ -#ifndef MICROMAC_CONF_ALWAYS_ON -#define MICROMAC_CONF_ALWAYS_ON 1 -#endif /* MICROMAC_CONF_ALWAYS_ON */ - -/* Local variables */ -static volatile signed char radio_last_rssi; -static volatile uint8_t radio_last_correlation; /* LQI */ - -/* Did we miss a request to turn the radio on due to overflow? */ -static volatile uint8_t missed_radio_on_request = 0; - -/* Poll mode disabled by default */ -static uint8_t poll_mode = 0; -/* (Software) frame filtering enabled by default */ -static uint8_t frame_filtering = 1; -/* (Software) autoack */ -static uint8_t autoack_enabled = MICROMAC_CONF_AUTOACK; -/* CCA before sending? Disabled by default. */ -static uint8_t send_on_cca = 0; - -/* Current radio channel */ -static int current_channel = IEEE802154_DEFAULT_CHANNEL; - -/* Current set point tx power - Actual tx power may be different. Use get_txpower() for actual power */ -static int current_tx_power = MICROMAC_CONF_TX_POWER; - -/* an integer between 0 and 255, used only with cca() */ -static uint8_t cca_thershold = MICROMAC_CONF_CCA_THR; - -/* Tx in progress? */ -static volatile uint8_t tx_in_progress = 0; -/* Are we currently listening? */ -static volatile uint8_t listen_on = 0; - -/* Is the driver currently transmitting a software ACK? */ -static uint8_t in_ack_transmission = 0; - -/* TX frame buffer */ -static MICROMAC_FRAME tx_frame_buffer; - -/* RX frame buffer */ -static MICROMAC_FRAME *rx_frame_buffer; - -/* Frame buffer pointer to read from */ -static MICROMAC_FRAME *input_frame_buffer = NULL; - -/* Ringbuffer for received packets in interrupt enabled mode */ -static struct ringbufindex input_ringbuf; -static MICROMAC_FRAME input_array[MIRCOMAC_CONF_BUF_NUM]; - -/* SFD timestamp in RTIMER ticks */ -static volatile uint32_t last_packet_timestamp = 0; - -/* Local functions prototypes */ -static int on(void); -static int off(void); -#if !MICROMAC_RADIO_MAC -static int is_packet_for_us(uint8_t *buf, int len, int do_send_ack); -#endif -static void set_frame_filtering(uint8_t enable); -static rtimer_clock_t get_packet_timestamp(void); -static void set_txpower(int8_t power); -void set_channel(int c); -static void radio_interrupt_handler(uint32 mac_event); -static int get_detected_energy(void); -static int get_rssi(void); -static void read_last_rssi(void); - -/*---------------------------------------------------------------------------*/ -PROCESS(micromac_radio_process, "micromac_radio_driver"); -/*---------------------------------------------------------------------------*/ - -/* Custom Radio parameters */ -#ifndef RADIO_RX_MODE_POLL_MODE -#define RADIO_PARAM_LAST_RSSI 0x80 -#define RADIO_PARAM_LAST_PACKET_TIMESTAMP 0x81 -#define RADIO_RX_MODE_POLL_MODE (1 << 2) -#endif /* RADIO_RX_MODE_POLL_MODE */ - -/*---------------------------------------------------------------------------*/ -static rtimer_clock_t -get_packet_timestamp(void) -{ - /* Wait for an edge */ - uint32_t t = u32MMAC_GetTime(); - while(u32MMAC_GetTime() == t); - /* Save SFD timestamp, converted from radio timer to RTIMER */ - last_packet_timestamp = RTIMER_NOW() - - RADIO_TO_RTIMER((uint32_t)(u32MMAC_GetTime() - (u32MMAC_GetRxTime() - 1))); - /* The remaining measured error is typically in range 0..16 usec. - * Center it around zero, in the -8..+8 usec range. */ - last_packet_timestamp -= US_TO_RTIMERTICKS(8); - return last_packet_timestamp; -} -/*---------------------------------------------------------------------------*/ -static int -init_software(void) -{ - int put_index; - /* Initialize ring buffer and first input packet pointer */ - ringbufindex_init(&input_ringbuf, MIRCOMAC_CONF_BUF_NUM); - /* get pointer to next input slot */ - put_index = ringbufindex_peek_put(&input_ringbuf); - if(put_index == -1) { - rx_frame_buffer = NULL; - printf("micromac_radio init:! no buffer available. Abort init.\n"); - off(); - return 0; - } else { - rx_frame_buffer = &input_array[put_index]; - } - input_frame_buffer = rx_frame_buffer; - - process_start(µmac_radio_process, NULL); - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -init(void) -{ - int ret = 1; - tsExtAddr node_long_address; - uint16_t node_short_address; - static uint8_t is_initialized; - - tx_in_progress = 0; - - u32JPT_Init(); - vMMAC_Enable(); - - /* Enable/disable interrupts */ - if(poll_mode) { - vMMAC_EnableInterrupts(NULL); - vMMAC_ConfigureInterruptSources(0); - } else { - vMMAC_EnableInterrupts(&radio_interrupt_handler); - } - vMMAC_ConfigureRadio(); - set_txpower(current_tx_power); /* it sets also the current_channel */ - - vMMAC_GetMacAddress(&node_long_address); - /* Short addresses are disabled by default */ - node_short_address = (uint16_t)node_long_address.u32L; - vMMAC_SetRxAddress(frame802154_get_pan_id(), node_short_address, &node_long_address); - - /* Disable hardware backoff */ - vMMAC_SetTxParameters(1, 0, 0, 0); - vMMAC_SetCutOffTimer(0, FALSE); - -#if RADIO_TEST_MODE == RADIO_TEST_MODE_HIGH_PWR - /* Enable high power mode. - * In this mode DIO2 goes high during RX - * and DIO3 goes high during TX - **/ - vREG_SysWrite(REG_SYS_PWR_CTRL, - u32REG_SysRead(REG_SYS_PWR_CTRL) - | REG_SYSCTRL_PWRCTRL_RFRXEN_MASK - | REG_SYSCTRL_PWRCTRL_RFTXEN_MASK); -#elif RADIO_TEST_MODE == RADIO_TEST_MODE_ADVANCED - /* output internal radio status on IO pins. - * See Chris@NXP email */ - vREG_SysWrite(REG_SYS_PWR_CTRL, - u32REG_SysRead(REG_SYS_PWR_CTRL) | (1UL << 26UL)); -#endif /* TEST_MODE */ - - if(!is_initialized) { - is_initialized = 1; - ret = init_software(); - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - /* No address matching or frame decoding */ - if(rx_frame_buffer != NULL) { -#if MICROMAC_RADIO_MAC - vMMAC_StartMacReceive(rx_frame_buffer, - (uint16_t)(E_MMAC_RX_START_NOW - | E_MMAC_RX_USE_AUTO_ACK - | E_MMAC_RX_NO_MALFORMED - | E_MMAC_RX_NO_FCS_ERROR - | E_MMAC_RX_ADDRESS_MATCH - | E_MMAC_RX_ALIGN_NORMAL) - ); -#else - vMMAC_StartPhyReceive(rx_frame_buffer, - (uint16_t)(E_MMAC_RX_START_NOW - | E_MMAC_RX_NO_FCS_ERROR) /* means: reject FCS errors */ - ); -#endif - } else { - missed_radio_on_request = 1; - } - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - listen_on = 1; - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - listen_on = 0; - tx_in_progress = 0; - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - - /* The following would be needed with delayed Tx/Rx functions - * vMMAC_SetCutOffTimer(0, FALSE);*/ - vMMAC_RadioOff(); - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -transmit(unsigned short payload_len) -{ - if(tx_in_progress) { - return RADIO_TX_COLLISION; - } - tx_in_progress = 1; - - /* Energest */ - if(listen_on) { - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - } - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - - /* Transmit and wait */ -#if MICROMAC_RADIO_MAC - vMMAC_StartMacTransmit(&tx_frame_buffer, - E_MMAC_TX_START_NOW | - E_MMAC_TX_USE_AUTO_ACK | - (send_on_cca ? E_MMAC_TX_USE_CCA : E_MMAC_TX_NO_CCA)); -#else - vMMAC_StartPhyTransmit(&tx_frame_buffer, - E_MMAC_TX_START_NOW | - (send_on_cca ? E_MMAC_TX_USE_CCA : E_MMAC_TX_NO_CCA)); -#endif - if(poll_mode) { - RTIMER_BUSYWAIT_UNTIL(u32MMAC_PollInterruptSource(E_MMAC_INT_TX_COMPLETE), MAX_PACKET_DURATION); - } else { - if(in_ack_transmission) { - /* as nested interupts are not possible, the tx flag will never be cleared */ - RTIMER_BUSYWAIT_UNTIL(FALSE, MAX_ACK_DURATION); - } else { - /* wait until the tx flag is cleared */ - RTIMER_BUSYWAIT_UNTIL(!tx_in_progress, MAX_PACKET_DURATION); - } - } - - /* Energest */ - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - if(listen_on) { - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - } - tx_in_progress = 0; - - /* Check error code */ - int ret; - uint32_t tx_error = u32MMAC_GetTxErrors(); - if(tx_error == 0) { - ret = RADIO_TX_OK; - } else if(tx_error & E_MMAC_TXSTAT_ABORTED) { - ret = RADIO_TX_ERR; - } else if(tx_error & E_MMAC_TXSTAT_CCA_BUSY) { - ret = RADIO_TX_COLLISION; - } else if(tx_error & E_MMAC_TXSTAT_NO_ACK) { - ret = RADIO_TX_NOACK; - } else { - ret = RADIO_TX_ERR; - } - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -prepare(const void *payload, unsigned short payload_len) -{ -#if !MICROMAC_RADIO_MAC - uint8_t i; - uint16_t checksum; -#endif - - if(tx_in_progress) { - return 1; - } - if(payload_len > 127 || payload == NULL) { - return 1; - } -#if MICROMAC_RADIO_MAC - frame802154_t info154; - int hdr_len = frame802154_parse((unsigned char *)payload, payload_len, &info154); - //TODO: hdr_len contains security header, which are not managed by micromac - tx_frame_buffer.u8PayloadLength = payload_len - hdr_len; - tx_frame_buffer.u8SequenceNum = info154.seq; - tx_frame_buffer.u16FCF = ((uint8_t*)payload)[0] | (((uint8_t*)payload)[1] << 8); - tx_frame_buffer.u16DestPAN = info154.dest_pid; - tx_frame_buffer.u16SrcPAN = info154.src_pid; - if(info154.fcf.dest_addr_mode == FRAME802154_SHORTADDRMODE) { - tx_frame_buffer.uDestAddr.u16Short = info154.dest_addr[0] | (info154.dest_addr[0] << 8); - } else if(info154.fcf.dest_addr_mode == FRAME802154_LONGADDRMODE) { - tx_frame_buffer.uDestAddr.sExt.u32L = *(uint32_t*)(&info154.dest_addr[4]); - tx_frame_buffer.uDestAddr.sExt.u32H = *(uint32_t*)(&info154.dest_addr[0]); - } - if(info154.fcf.src_addr_mode == FRAME802154_SHORTADDRMODE) { - tx_frame_buffer.uSrcAddr.u16Short = info154.src_addr[0] | (info154.src_addr[0] << 8); - } else if(info154.fcf.src_addr_mode == FRAME802154_LONGADDRMODE) { - tx_frame_buffer.uSrcAddr.sExt.u32L = *(uint32_t*)(&info154.src_addr[4]); - tx_frame_buffer.uSrcAddr.sExt.u32H = *(uint32_t*)(&info154.src_addr[0]); - } - tx_frame_buffer.u16FCS = crc16_data(payload, payload_len, 0); - memcpy(tx_frame_buffer.uPayload.au8Byte, info154.payload, info154.payload_len); -#else - /* Copy payload to (soft) Ttx buffer */ - memcpy(tx_frame_buffer.uPayload.au8Byte, payload, payload_len); - i = payload_len; -#if CRC_SW - /* Compute CRC */ - checksum = crc16_data(payload, payload_len, 0); - tx_frame_buffer.uPayload.au8Byte[i++] = checksum; - tx_frame_buffer.uPayload.au8Byte[i++] = (checksum >> 8) & 0xff; - tx_frame_buffer.u8PayloadLength = payload_len + CHECKSUM_LEN; -#else - tx_frame_buffer.u8PayloadLength = payload_len; -#endif -#endif - - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -send(const void *payload, unsigned short payload_len) -{ - if(prepare(payload, payload_len) == 0) { - return transmit(payload_len); - } else { - return RADIO_TX_ERR; - } -} -/*---------------------------------------------------------------------------*/ -int -get_channel(void) -{ - return current_channel; -} -/*---------------------------------------------------------------------------*/ -void -set_channel(int c) -{ - current_channel = c; - vMMAC_SetChannelAndPower(current_channel, current_tx_power); -} -/*---------------------------------------------------------------------------*/ -#if !MICROMAC_RADIO_MAC -static int -is_broadcast_addr(uint8_t mode, uint8_t *addr) -{ - int i = ((mode == FRAME802154_SHORTADDRMODE) ? 2 : 8); - while(i-- > 0) { - if(addr[i] != 0xff) { - return 0; - } - } - return 1; -} -/*---------------------------------------------------------------------------*/ -/* Send an ACK */ -static void -send_ack(const frame802154_t *frame) -{ - uint8_t buffer[3]; - /* FCF: 2 octets */ - buffer[0] = FRAME802154_ACKFRAME; - buffer[1] = 0; - /* Seqnum: 1 octets */ - buffer[2] = frame->seq; - in_ack_transmission = 1; - send(&buffer, sizeof(buffer)); - in_ack_transmission = 0; -} -/*---------------------------------------------------------------------------*/ -/* Check if a packet is for us */ -static int -is_packet_for_us(uint8_t *buf, int len, int do_send_ack) -{ - frame802154_t frame; - int result; - uint8_t parsed = frame802154_parse(buf, len, &frame); - if(parsed) { - if(frame.fcf.dest_addr_mode) { - int has_dest_panid; - frame802154_has_panid(&frame.fcf, NULL, &has_dest_panid); - if(has_dest_panid - && frame802154_get_pan_id() != FRAME802154_BROADCASTPANDID - && frame.dest_pid != frame802154_get_pan_id() - && frame.dest_pid != FRAME802154_BROADCASTPANDID) { - /* Packet to another PAN */ - return 0; - } - if(!is_broadcast_addr(frame.fcf.dest_addr_mode, frame.dest_addr)) { - result = linkaddr_cmp((linkaddr_t *)frame.dest_addr, &linkaddr_node_addr); - if(autoack_enabled && result && do_send_ack) { - /* this is a unicast frame and sending ACKs is enabled */ - send_ack(&frame); - } - return result; - } - } - return 1; - } else { - return 0; - } -} -#endif -/*---------------------------------------------------------------------------*/ -static int -read(void *buf, unsigned short bufsize) -{ - int len = 0; -#if MICROMAC_RADIO_MAC - frame802154_fcf_t fcf; - uint8_t *p = (uint8_t*)buf; - int has_src_panid; - int has_dest_panid; - int c; - - p[len++] = input_frame_buffer->u16FCF & 0xff; - p[len++] = (input_frame_buffer->u16FCF >> 8) & 0xff; - frame802154_parse_fcf(p, &fcf); - p[len++] = input_frame_buffer->u8SequenceNum; - frame802154_has_panid(&fcf, &has_src_panid, &has_dest_panid); - if(has_dest_panid) { - p[len++] = input_frame_buffer->u16DestPAN & 0xff; - p[len++] = (input_frame_buffer->u16DestPAN >> 8) & 0xff; - } - if(fcf.dest_addr_mode == FRAME802154_SHORTADDRMODE) { - p[len++] = input_frame_buffer->uDestAddr.u16Short & 0xff; - p[len++] = (input_frame_buffer->uDestAddr.u16Short >> 8) & 0xff; - } else if(fcf.dest_addr_mode == FRAME802154_LONGADDRMODE) { - for(c = 0; c < 4; c++) { - p[len + c] = ((uint8_t*)(&input_frame_buffer->uDestAddr.sExt.u32L))[3 - c]; - } - for(c = 0; c < 4; c++) { - p[len + c + 4] = ((uint8_t*)(&input_frame_buffer->uDestAddr.sExt.u32H))[3 - c]; - } - len += 8; - } - if(has_src_panid) { - p[len++] = input_frame_buffer->u16SrcPAN & 0xff; - p[len++] = (input_frame_buffer->u16SrcPAN >> 8) & 0xff; - } - if(fcf.src_addr_mode == FRAME802154_SHORTADDRMODE) { - p[len++] = input_frame_buffer->uSrcAddr.u16Short & 0xff; - p[len++] = (input_frame_buffer->uSrcAddr.u16Short >> 8) & 0xff; - } else if(fcf.src_addr_mode == FRAME802154_LONGADDRMODE) { - for(c = 0; c < 4; c++) { - p[len + c] = ((uint8_t*)(&input_frame_buffer->uSrcAddr.sExt.u32L))[3 - c]; - } - for(c = 0; c < 4; c++) { - p[len + c + 4] = ((uint8_t*)(&input_frame_buffer->uSrcAddr.sExt.u32H))[3 - c]; - } - len += 8; - } - memcpy(&p[len], input_frame_buffer->uPayload.au8Byte, input_frame_buffer->u8PayloadLength); - len += input_frame_buffer->u8PayloadLength; -#else - uint16_t radio_last_rx_crc; - uint8_t radio_last_rx_crc_ok = 1; - - len = input_frame_buffer->u8PayloadLength; - - if(len <= CHECKSUM_LEN) { - input_frame_buffer->u8PayloadLength = 0; - return 0; - } else { - len -= CHECKSUM_LEN; - /* Check CRC */ -#if CRC_SW - uint16_t checksum = crc16_data(input_frame_buffer->uPayload.au8Byte, len, 0); - radio_last_rx_crc = - (uint16_t)(input_frame_buffer->uPayload.au8Byte[len + 1] << (uint16_t)8) - | input_frame_buffer->uPayload.au8Byte[len]; - radio_last_rx_crc_ok = (checksum == radio_last_rx_crc); - if(!radio_last_rx_crc_ok) { - } -#endif /* CRC_SW */ - if(radio_last_rx_crc_ok) { - /* If we are in poll mode we need to check the frame here */ - if(poll_mode) { - if(frame_filtering && - !is_packet_for_us(input_frame_buffer->uPayload.au8Byte, len, 0)) { - len = 0; - } else { - read_last_rssi(); - } - } - if(len != 0) { - bufsize = MIN(len, bufsize); - memcpy(buf, input_frame_buffer->uPayload.au8Byte, bufsize); - if(!poll_mode) { - /* Not in poll mode: packetbuf should not be accessed in interrupt context */ - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, radio_last_rssi); - packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, radio_last_correlation); - } - } - } else { - len = 0; - } - /* Disable further read attempts */ - input_frame_buffer->u8PayloadLength = 0; - } -#endif - return len; -} -/*---------------------------------------------------------------------------*/ -static void -set_txpower(int8_t power) -{ - if(power > OUTPUT_POWER_MAX) { - current_tx_power = OUTPUT_POWER_MAX; - } else { - if(power < OUTPUT_POWER_MIN) { - current_tx_power = OUTPUT_POWER_MIN; - } else { - current_tx_power = power; - } - } - vMMAC_SetChannelAndPower(current_channel, current_tx_power); -} -/*--------------------------------------------------------------------------*/ -static int -get_txpower(void) -{ - int actual_tx_power; -#if (JENNIC_CHIP == JN5169) - /* Actual tx power value rounded to nearest integer number */ - const static int8 power_table [] = { - -32, -30, -29, -29, /* -32 .. -29 */ - -28, -28, -28, -28, /* -28 .. -25 */ - -21, -21, -21, -2, /* -24 .. -21 */ - -20, -19, -18, -17, /* -20 .. -17 */ - -17, -17, -17, -10, /* -16 .. -13 */ - -10, -10, -10, -9, /* -12 .. -09 */ - -8, -7, -6, -6, /* -08 .. -05 */ - -6, -6, 1, 1, /* -04 .. -01 */ - 1, 1, 2, 3, /* 00 .. 03 */ - 4, 5, 6, 7, /* 04 .. 07 */ - 9, 9, 10 }; /* 08 .. 10 */ - if(current_tx_power > OUTPUT_POWER_MAX) { - actual_tx_power = OUTPUT_POWER_MAX; - } else if(current_tx_power < OUTPUT_POWER_MIN) { - actual_tx_power = OUTPUT_POWER_MIN; - } else { - actual_tx_power = power_table[current_tx_power + ABS_OUTPUT_POWER_MIN]; - } -#else - /* Other JN516x chips */ - if(current_tx_power < (-24)) { - actual_tx_power = OUTPUT_POWER_MIN; - } else if(current_tx_power < (-12)) { - actual_tx_power = (-20); - } else if(current_tx_power < 0) { - actual_tx_power = (-9); - } else { - actual_tx_power = OUTPUT_POWER_MAX; - } -#endif - return (int)actual_tx_power; -} -/*---------------------------------------------------------------------------*/ -static int -get_detected_energy(void) -{ - const uint32 u32Samples = 8; - return u8JPT_EnergyDetect(current_channel, u32Samples); -} -/*---------------------------------------------------------------------------*/ -static int -get_rssi(void) -{ - /* this approximate formula for RSSI is taken from NXP internal docs */ - return (7 * get_detected_energy() - 1970) / 20; -} -/*---------------------------------------------------------------------------*/ -static void -read_last_rssi(void) -{ - uint8_t radio_last_rx_energy; - radio_last_rx_energy = u8MMAC_GetRxLqi((uint8_t *)&radio_last_correlation); - radio_last_rssi = i16JPT_ConvertEnergyTodBm(radio_last_rx_energy); -} -/*---------------------------------------------------------------------------*/ -int -receiving_packet(void) -{ - return bMMAC_RxDetected(); -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - if(!poll_mode) { - return ringbufindex_peek_get(&input_ringbuf) != -1; - } else { - return u32MMAC_PollInterruptSource( - E_MMAC_INT_RX_COMPLETE | E_MMAC_INT_RX_HEADER); - } -} -/*---------------------------------------------------------------------------*/ -static int -cca(void) -{ - bool_t is_channel_busy = bJPT_CCA(current_channel, - E_JPT_CCA_MODE_CARRIER_OR_ENERGY, - cca_thershold); - return is_channel_busy == FALSE; -} -/*---------------------------------------------------------------------------*/ -static void -radio_interrupt_handler(uint32 mac_event) -{ - uint32_t rx_status; - uint8_t overflow = 0; - int get_index; - int put_index; -#if !MICROMAC_RADIO_MAC - int packet_for_me = 0; -#endif - - if(mac_event & E_MMAC_INT_TX_COMPLETE) { - /* Transmission attempt has finished */ - tx_in_progress = 0; - } else if(mac_event & E_MMAC_INT_RX_COMPLETE) { - rx_status = u32MMAC_GetRxErrors(); - /* If rx is successful */ - if(rx_status == 0) { - /* Save SFD timestamp */ - last_packet_timestamp = get_packet_timestamp(); - - if(!poll_mode && (mac_event & E_MMAC_INT_RX_COMPLETE)) { -#if MICROMAC_RADIO_MAC - /* read and cache RSSI and LQI values */ - read_last_rssi(); - /* Put received frame in queue */ - ringbufindex_put(&input_ringbuf); - - if((get_index = ringbufindex_peek_get(&input_ringbuf)) != -1) { - input_frame_buffer = &input_array[get_index]; - } - process_poll(µmac_radio_process); - - /* get pointer to next input slot */ - put_index = ringbufindex_peek_put(&input_ringbuf); - /* is there space? */ - if(put_index != -1) { - /* move rx_frame_buffer to next empty slot */ - rx_frame_buffer = &input_array[put_index]; - } else { - overflow = 1; - rx_frame_buffer = NULL; - } -#else - if(rx_frame_buffer->u8PayloadLength > CHECKSUM_LEN) { - if(frame_filtering) { - /* Check RX address */ - packet_for_me = is_packet_for_us(rx_frame_buffer->uPayload.au8Byte, rx_frame_buffer->u8PayloadLength - CHECKSUM_LEN, 1); - } else if(!frame_filtering) { - packet_for_me = 1; - } - } - if(!packet_for_me) { - /* Prevent reading */ - rx_frame_buffer->u8PayloadLength = 0; - } else { - /* read and cache RSSI and LQI values */ - read_last_rssi(); - /* Put received frame in queue */ - ringbufindex_put(&input_ringbuf); - - if((get_index = ringbufindex_peek_get(&input_ringbuf)) != -1) { - input_frame_buffer = &input_array[get_index]; - } - process_poll(µmac_radio_process); - - /* get pointer to next input slot */ - put_index = ringbufindex_peek_put(&input_ringbuf); - /* is there space? */ - if(put_index != -1) { - /* move rx_frame_buffer to next empty slot */ - rx_frame_buffer = &input_array[put_index]; - } else { - overflow = 1; - rx_frame_buffer = NULL; - } - } -#endif - } - } - } - if(overflow) { - off(); - } else if(MICROMAC_CONF_ALWAYS_ON - && (mac_event & (E_MMAC_INT_TX_COMPLETE | E_MMAC_INT_RX_COMPLETE))) { - on(); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(micromac_radio_process, ev, data) -{ - PROCESS_BEGIN(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - - /* Pass received packets to upper layer */ - int16_t read_index; - /* Loop on accessing (without removing) a pending input packet */ - while((read_index = ringbufindex_peek_get(&input_ringbuf)) != -1) { - input_frame_buffer = &input_array[read_index]; - /* Put packet into packetbuf for input callback */ - packetbuf_clear(); - int len = read(packetbuf_dataptr(), PACKETBUF_SIZE); - /* is packet valid? */ - if(len > 0) { - packetbuf_set_datalen(len); - NETSTACK_MAC.input(); - } - /* Remove packet from ringbuf */ - ringbufindex_get(&input_ringbuf); - /* Disable further read attempts */ - input_frame_buffer->u8PayloadLength = 0; - } - - /* Are we recovering from overflow? */ - if(rx_frame_buffer == NULL) { - /* get pointer to next input slot */ - int put_index = ringbufindex_peek_put(&input_ringbuf); - /* is there space? */ - if(put_index != -1) { - /* move rx_frame_buffer to next empty slot */ - rx_frame_buffer = &input_array[put_index]; - /* do we need to turn radio on? */ - if(MICROMAC_CONF_ALWAYS_ON || missed_radio_on_request) { - missed_radio_on_request = 0; - on(); - } - } else { - rx_frame_buffer = NULL; - } - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static void -set_frame_filtering(uint8_t enable) -{ - frame_filtering = enable; -} -/*---------------------------------------------------------------------------*/ -static void -set_autoack(uint8_t enable) -{ - autoack_enabled = enable; -} -/*---------------------------------------------------------------------------*/ -static void -set_poll_mode(uint8_t enable) -{ - poll_mode = enable; - if(poll_mode) { - /* Disable interrupts */ - vMMAC_EnableInterrupts(NULL); - vMMAC_ConfigureInterruptSources(0); - } else { - /* Initialize and enable interrupts */ - /* TODO: enable E_MMAC_INT_RX_HEADER & filter out frames after header rx */ - vMMAC_ConfigureInterruptSources( - E_MMAC_INT_RX_COMPLETE | E_MMAC_INT_TX_COMPLETE); - vMMAC_EnableInterrupts(&radio_interrupt_handler); - } -} -/* Enable or disable CCA before sending */ -static void -set_send_on_cca(uint8_t enable) -{ - send_on_cca = enable; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - if(!value) { - return RADIO_RESULT_INVALID_VALUE; - } - switch(param) { - case RADIO_PARAM_POWER_MODE: - *value = listen_on || tx_in_progress ? RADIO_POWER_MODE_ON : RADIO_POWER_MODE_OFF; - return RADIO_RESULT_OK; - case RADIO_PARAM_CHANNEL: - *value = get_channel(); - return RADIO_RESULT_OK; - case RADIO_PARAM_RX_MODE: - *value = 0; - if(frame_filtering) { - *value |= RADIO_RX_MODE_ADDRESS_FILTER; - } - if(autoack_enabled) { - *value |= RADIO_RX_MODE_AUTOACK; - } - if(poll_mode) { - *value |= RADIO_RX_MODE_POLL_MODE; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_TX_MODE: - *value = 0; - if(send_on_cca) { - *value |= RADIO_TX_MODE_SEND_ON_CCA; - } - return RADIO_RESULT_OK; - case RADIO_PARAM_TXPOWER: - *value = get_txpower(); - return RADIO_RESULT_OK; - case RADIO_PARAM_RSSI: - *value = get_rssi(); - return RADIO_RESULT_OK; - case RADIO_PARAM_LAST_RSSI: - *value = radio_last_rssi; - return RADIO_RESULT_OK; - case RADIO_PARAM_CCA_THRESHOLD: - *value = cca_thershold; - return RADIO_RESULT_OK; - case RADIO_CONST_CHANNEL_MIN: - *value = 11; - return RADIO_RESULT_OK; - case RADIO_CONST_CHANNEL_MAX: - *value = 26; - return RADIO_RESULT_OK; - case RADIO_CONST_TXPOWER_MIN: - *value = OUTPUT_POWER_MIN; - return RADIO_RESULT_OK; - case RADIO_CONST_TXPOWER_MAX: - *value = OUTPUT_POWER_MAX; - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - switch(param) { - case RADIO_PARAM_POWER_MODE: - if(value == RADIO_POWER_MODE_ON) { - on(); - return RADIO_RESULT_OK; - } - if(value == RADIO_POWER_MODE_OFF) { - off(); - return RADIO_RESULT_OK; - } - return RADIO_RESULT_INVALID_VALUE; - case RADIO_PARAM_CHANNEL: - if(value < 11 || value > 26) { - return RADIO_RESULT_INVALID_VALUE; - } - set_channel(value); - return RADIO_RESULT_OK; - case RADIO_PARAM_RX_MODE: - if(value & ~(RADIO_RX_MODE_ADDRESS_FILTER | - RADIO_RX_MODE_AUTOACK | RADIO_RX_MODE_POLL_MODE)) { - return RADIO_RESULT_INVALID_VALUE; - } - set_frame_filtering((value & RADIO_RX_MODE_ADDRESS_FILTER) != 0); - set_autoack((value & RADIO_RX_MODE_AUTOACK) != 0); - set_poll_mode((value & RADIO_RX_MODE_POLL_MODE) != 0); - return RADIO_RESULT_OK; - case RADIO_PARAM_TX_MODE: - if(value & ~(RADIO_TX_MODE_SEND_ON_CCA)) { - return RADIO_RESULT_INVALID_VALUE; - } - set_send_on_cca((value & RADIO_TX_MODE_SEND_ON_CCA) != 0); - return RADIO_RESULT_OK; - case RADIO_PARAM_TXPOWER: - if(value < OUTPUT_POWER_MIN || value > OUTPUT_POWER_MAX) { - return RADIO_RESULT_INVALID_VALUE; - /* Find the closest higher PA_LEVEL for the desired output power */ - } - set_txpower(value); - return RADIO_RESULT_OK; - case RADIO_PARAM_CCA_THRESHOLD: - cca_thershold = value; - return RADIO_RESULT_OK; - default: - return RADIO_RESULT_NOT_SUPPORTED; - } -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - if(param == RADIO_PARAM_LAST_PACKET_TIMESTAMP) { - if(size != sizeof(rtimer_clock_t) || !dest) { - return RADIO_RESULT_INVALID_VALUE; - } - *(rtimer_clock_t *)dest = get_packet_timestamp(); - - return RADIO_RESULT_OK; - } - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -const struct radio_driver micromac_radio_driver = { - init, - prepare, - transmit, - send, - read, - cca, - receiving_packet, - pending_packet, - on, - off, - get_value, - set_value, - get_object, - set_object -}; diff --git a/arch/platform/jn516x/dev/micromac-radio.h b/arch/platform/jn516x/dev/micromac-radio.h deleted file mode 100644 index a283af23d..000000000 --- a/arch/platform/jn516x/dev/micromac-radio.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014, NXP and SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * MICROMAC_RADIO driver header file - * \authors - * Beshr Al Nahas - * Simon Duquennot - */ - -#ifndef MICROMAC_RADIO_H_ -#define MICROMAC_RADIO_H_ - -#include "dev/radio.h" - -extern const struct radio_driver micromac_radio_driver; - -#endif /* MICROMAC_RADIO_H_ */ diff --git a/arch/platform/jn516x/dev/rtimer-arch-slow.c b/arch/platform/jn516x/dev/rtimer-arch-slow.c deleted file mode 100644 index facbfb94f..000000000 --- a/arch/platform/jn516x/dev/rtimer-arch-slow.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * RTIMER for NXP jn516x: 32 kHz mode - * \author - * Atis Elsts - */ - -#include "sys/rtimer.h" -#include "sys/clock.h" -#include -#include -#include -#include "dev/watchdog.h" -#include "sys/process.h" - -#if RTIMER_USE_32KHZ - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define RTIMER_TIMER_ISR_DEV E_AHI_DEVICE_SYSCTRL -/* 1.5 days wraparound time */ -#define MAX_VALUE 0xFFFFFFFF -/* make this small to more easily detect wraparound bugs */ -#define START_VALUE (60 * RTIMER_ARCH_SECOND) -#define WRAPAROUND_VALUE ((uint64_t)0x1FFFFFFFFFF) - -static volatile rtimer_clock_t scheduled_time; -static volatile uint8_t has_next; - -/*---------------------------------------------------------------------------*/ -static void -timerISR(uint32 u32Device, uint32 u32ItemBitmap) -{ - PRINTF("\ntimer isr %u %u\n", u32Device, u32ItemBitmap); - if(u32Device != RTIMER_TIMER_ISR_DEV) { - return; - } - - if(u32ItemBitmap & TICK_TIMER_MASK) { - /* 32-bit overflow happened; restart the timer */ - uint32_t ticks_late = WRAPAROUND_VALUE - u64AHI_WakeTimerReadLarge(TICK_TIMER); - - PRINTF("\nrtimer oflw, missed ticks %u\n", ticks_late); - - vAHI_WakeTimerStartLarge(TICK_TIMER, MAX_VALUE - ticks_late); - } - - if(u32ItemBitmap & WAKEUP_TIMER_MASK) { - PRINTF("\nrtimer fire @ %u\n", rtimer_arch_now()); - - /* Compare with the current time, as after sleep there is - * a fake interrupt generated 10ms earlier to wake up & reinitialize - * the system before the actual rtimer fires. - */ - rtimer_clock_t now = rtimer_arch_now(); - if(RTIMER_CLOCK_LT(now + 1, scheduled_time)) { - vAHI_WakeTimerEnable(WAKEUP_TIMER, TRUE); - vAHI_WakeTimerStartLarge(WAKEUP_TIMER, scheduled_time - now); - } else { - has_next = 0; - watchdog_start(); - rtimer_run_next(); - process_nevents(); - } - } -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_init(void) -{ - /* Initialise tick timer to run continuously */ - vAHI_TickTimerIntEnable(0); - vAHI_TickTimerConfigure(E_AHI_TICK_TIMER_DISABLE); - vAHI_TickTimerWrite(0); - vAHI_TickTimerConfigure(E_AHI_TICK_TIMER_CONT); - - vAHI_SysCtrlRegisterCallback(timerISR); - /* set the highest priority for the rtimer interrupt */ - vAHI_InterruptSetPriority(MICRO_ISR_MASK_SYSCTRL, 15); - /* enable interrupt on a rtimer */ - vAHI_WakeTimerEnable(WAKEUP_TIMER, TRUE); - /* enable interrupt on 32-bit overflow */ - vAHI_WakeTimerEnable(TICK_TIMER, TRUE); - /* count down from START_VALUE */ - vAHI_WakeTimerStartLarge(TICK_TIMER, START_VALUE); - - (void)u32AHI_Init(); -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_reinit(rtimer_clock_t sleep_start, rtimer_clock_t sleep_ticks) -{ - uint64_t t; - - uint32_t wakeup_time = sleep_start + (uint64_t)sleep_ticks * (F_CPU / 2) / RTIMER_SECOND; - - /* Initialise tick timer to run continuously */ - vAHI_TickTimerConfigure(E_AHI_TICK_TIMER_DISABLE); - vAHI_TickTimerIntEnable(0); - WAIT_FOR_EDGE(t); - vAHI_TickTimerWrite(wakeup_time); - vAHI_TickTimerConfigure(E_AHI_TICK_TIMER_CONT); - - /* call pending interrupts */ - (void)u32AHI_Init(); - - if(has_next) { - /* reschedule the timer */ - rtimer_arch_schedule(scheduled_time); - } -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -rtimer_arch_now(void) -{ - return START_VALUE - (rtimer_clock_t)u64AHI_WakeTimerReadLarge(TICK_TIMER); -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_schedule(rtimer_clock_t t) -{ - PRINTF("rtimer_arch_schedule time %lu\n", t); - vAHI_WakeTimerEnable(WAKEUP_TIMER, TRUE); - vAHI_WakeTimerStartLarge(WAKEUP_TIMER, t - rtimer_arch_now()); - scheduled_time = t; - has_next = 1; -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -rtimer_arch_time_to_rtimer(void) -{ - rtimer_clock_t now = RTIMER_NOW(); - if(has_next) { - return scheduled_time >= now ? scheduled_time - now : 0; - } - /* if no wakeup is scheduled yet return maximum time */ - return (rtimer_clock_t)-1; -} -/*---------------------------------------------------------------------------*/ -#endif /* RTIMER_USE_32KHZ */ diff --git a/arch/platform/jn516x/dev/rtimer-arch.c b/arch/platform/jn516x/dev/rtimer-arch.c deleted file mode 100644 index e72c63d99..000000000 --- a/arch/platform/jn516x/dev/rtimer-arch.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * RTIMER for NXP jn516x - * \author - * Beshr Al Nahas - * Atis Elsts - */ - -#include "sys/rtimer.h" -#include "sys/clock.h" -#include -#include -#include -#include "dev/watchdog.h" -#include "sys/process.h" - -#if !RTIMER_USE_32KHZ - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define RTIMER_TIMER_ISR_DEV E_AHI_DEVICE_TICK_TIMER - -static volatile rtimer_clock_t scheduled_time; -static volatile uint8_t has_next; - -void -rtimer_arch_run_next(uint32 u32DeviceId, uint32 u32ItemBitmap) -{ - uint32_t delta; - - if(u32DeviceId != RTIMER_TIMER_ISR_DEV) { - return; - } - - vAHI_TickTimerIntPendClr(); - vAHI_TickTimerIntEnable(0); - /* - * compare register is only 28bits wide so make sure the upper 4bits match - * the set compare point - */ - delta = u32AHI_TickTimerRead() - scheduled_time; - if(delta >> 28 == 0) { - /* run scheduled */ - has_next = 0; - watchdog_start(); - rtimer_run_next(); - process_nevents(); - } else { - /* No match. Schedule again. */ - vAHI_TickTimerIntEnable(1); - vAHI_TickTimerInterval(scheduled_time); - } -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_init(void) -{ - /* Initialise tick timer to run continuously */ - vAHI_TickTimerConfigure(E_AHI_TICK_TIMER_DISABLE); - vAHI_TickTimerIntEnable(0); - vAHI_TickTimerRegisterCallback(rtimer_arch_run_next); - vAHI_TickTimerWrite(0); - vAHI_TickTimerConfigure(E_AHI_TICK_TIMER_CONT); - - /* enable wakeup timers, but keep interrupts disabled */ - vAHI_WakeTimerEnable(WAKEUP_TIMER, FALSE); - vAHI_WakeTimerEnable(TICK_TIMER, FALSE); - /* count down from zero (2, as values 0 and 1 must not be used) */ - vAHI_WakeTimerStartLarge(TICK_TIMER, 2); - - (void)u32AHI_Init(); -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_reinit(rtimer_clock_t sleep_start, rtimer_clock_t sleep_ticks) -{ - uint64_t t; - /* Initialise tick timer to run continuously */ - vAHI_TickTimerConfigure(E_AHI_TICK_TIMER_DISABLE); - vAHI_TickTimerIntEnable(0); - /* set the highest priority for the rtimer interrupt */ - vAHI_InterruptSetPriority(MICRO_ISR_MASK_TICK_TMR, 15); - vAHI_TickTimerRegisterCallback(rtimer_arch_run_next); - WAIT_FOR_EDGE(t); - vAHI_TickTimerWrite(sleep_start + sleep_ticks); - vAHI_TickTimerConfigure(E_AHI_TICK_TIMER_CONT); - - /* call pending interrupts */ - u32AHI_Init(); - - if(has_next) { - vAHI_TickTimerIntPendClr(); - vAHI_TickTimerIntEnable(1); - vAHI_TickTimerInterval(scheduled_time); - } -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -rtimer_arch_now(void) -{ - return u32AHI_TickTimerRead(); -} -/*---------------------------------------------------------------------------*/ -void -rtimer_arch_schedule(rtimer_clock_t t) -{ - PRINTF("rtimer_arch_schedule time %lu\n", t); - vAHI_TickTimerIntPendClr(); - vAHI_TickTimerIntEnable(1); - vAHI_TickTimerInterval(t); - has_next = 1; - scheduled_time = t; -} -/*---------------------------------------------------------------------------*/ -rtimer_clock_t -rtimer_arch_time_to_rtimer(void) -{ - rtimer_clock_t now = RTIMER_NOW(); - if(has_next) { - return scheduled_time >= now ? scheduled_time - now : 0; - } - /* if no wakeup is scheduled yet return maximum time */ - return (rtimer_clock_t)-1; -} -/*---------------------------------------------------------------------------*/ -#endif /* !RTIMER_USE_32KHZ */ diff --git a/arch/platform/jn516x/dev/rtimer-arch.h b/arch/platform/jn516x/dev/rtimer-arch.h deleted file mode 100644 index 63212566b..000000000 --- a/arch/platform/jn516x/dev/rtimer-arch.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for NXP jn516x-specific rtimer code - * \author - * Beshr Al Nahas - * Atis Elsts - */ - -#ifndef RTIMER_ARCH_H_ -#define RTIMER_ARCH_H_ - -#include "sys/rtimer.h" - -#if RTIMER_USE_32KHZ -#if JN516X_EXTERNAL_CRYSTAL_OSCILLATOR -#define RTIMER_ARCH_SECOND 32768 -#else -#define RTIMER_ARCH_SECOND 32000 -#endif -#else -/* 32MHz CPU clock => 16MHz timer */ -#define RTIMER_ARCH_SECOND (F_CPU / 2) -#endif - -#if RTIMER_USE_32KHZ -#define US_TO_RTIMERTICKS(US) ((US) >= 0 ? \ - (((int32_t)(US) * (RTIMER_ARCH_SECOND) + 500000) / 1000000L) : \ - ((int32_t)(US) * (RTIMER_ARCH_SECOND) - 500000) / 1000000L) - -#define RTIMERTICKS_TO_US(T) ((T) >= 0 ? \ - (((int32_t)(T) * 1000000L + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) : \ - ((int32_t)(T) * 1000000L - ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) - -/* A 64-bit version because the 32-bit one cannot handle T >= 4295 ticks. - Intended only for positive values of T. */ -#define RTIMERTICKS_TO_US_64(T) ((uint32_t)(((uint64_t)(T) * 1000000 + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND))) - -#else - -#define US_TO_RTIMERTICKS(D) ((int64_t)(D) << 4) -#define RTIMERTICKS_TO_US(T) ((int64_t)(T) >> 4) -#define RTIMERTICKS_TO_US_64(T) RTIMERTICKS_TO_US(T) - -#endif - -rtimer_clock_t rtimer_arch_now(void); - -rtimer_clock_t rtimer_arch_time_to_rtimer(void); - -void rtimer_arch_reinit(rtimer_clock_t sleep_start, rtimer_clock_t wakeup_time); - -void clock_arch_init(int is_reinitialization); - -void clock_arch_calibrate(void); - -void clock_arch_reinit(void); - -void clock_arch_schedule_interrupt(clock_time_t time_to_etimer, rtimer_clock_t ticks_to_rtimer); - -clock_t clock_arch_time_to_etimer(void); - -/* Use 20 ms: enough for TSCH with the default schedule to sleep */ -#define JN516X_MIN_SLEEP_TIME (RTIMER_SECOND / 50) -/* 1 second by default: arbitrary picked value which could be increased */ -#define JN516X_MAX_SLEEP_TIME RTIMER_SECOND -/* Assume conservative 10 ms maximal system wakeup time */ -#define JN516X_SLEEP_GUARD_TIME (RTIMER_ARCH_SECOND / 100) - -#define WAKEUP_TIMER E_AHI_WAKE_TIMER_0 -#define WAKEUP_TIMER_MASK E_AHI_SYSCTRL_WK0_MASK - -#define TICK_TIMER E_AHI_WAKE_TIMER_1 -#define TICK_TIMER_MASK E_AHI_SYSCTRL_WK1_MASK - -#define WAIT_FOR_EDGE(edge_t) do { \ - uint64_t start_t = u64AHI_WakeTimerReadLarge(TICK_TIMER); \ - do { \ - edge_t = u64AHI_WakeTimerReadLarge(TICK_TIMER); \ - } while(edge_t == start_t); \ - } while(0) - -#endif /* RTIMER_ARCH_H_ */ diff --git a/arch/platform/jn516x/dev/slip_uart0.c b/arch/platform/jn516x/dev/slip_uart0.c deleted file mode 100644 index d29bc9b5f..000000000 --- a/arch/platform/jn516x/dev/slip_uart0.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/* - * Machine dependent jn516x SLIP routines for UART0. - */ - -#include "contiki.h" -#include "dev/slip.h" -#include "dev/uart0.h" -/*---------------------------------------------------------------------------*/ -void -slip_arch_writeb(unsigned char c) -{ - uart0_writeb(c); -} -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port and the SLIP driver. - * - */ -void -slip_arch_init() -{ - uart0_set_input(slip_input_byte); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/jn516x/dev/uart-driver.c b/arch/platform/jn516x/dev/uart-driver.c deleted file mode 100644 index aeeffeeb4..000000000 --- a/arch/platform/jn516x/dev/uart-driver.c +++ /dev/null @@ -1,604 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Lee Mitchell - * Integrated into Contiki by Beshr Al Nahas - * - */ - -#include - -#ifdef DEBUG -#include -#else -#define DBG_vPrintf(...) -#endif - -#include "contiki.h" -#include "uart-driver.h" -#include "sys/rtimer.h" -#include "watchdog.h" -#include -#include - -#if UART_XONXOFF_FLOW_CTRL - -#include "sys/process.h" - -#define TX_FIFO_SW_FLOW_LIMIT 8 /* Maximum allowed fill level for tx fifo */ -#if TX_FIFO_SW_FLOW_LIMIT > 16 -#undef TX_FIFO_SW_FLOW_LIMIT -#define TX_FIFO_SW_FLOW_LIMIT 16 -#warning "TX_FIFO_SW_FLOW_LIMIT too big. Forced to 16." -#endif /* TX_FIFO_SW_FLOW_LIMIT > 16 */ - -#define XON 17 -#define XOFF 19 - -extern volatile unsigned char xonxoff_state; - -#endif /* UART_XONXOFF_FLOW_CTRL */ - -#define DEBUG_UART_BUFFERED FALSE - -#define CHAR_DEADLINE (uart_char_delay * 100) - -/*** Local Function Prototypes ***/ -static void uart_driver_isr(uint32_t device_id, uint32_t item_bitmap); -#if !UART_XONXOFF_FLOW_CTRL -static int16_t uart_driver_get_tx_fifo_available_space(uint8_t uart_dev); -#endif /* !UART_XONXOFF_FLOW_CTRL */ -static void uart_driver_set_baudrate(uint8_t uart_dev, uint8_t br); -static void uart_driver_set_high_baudrate(uint8_t uart_dev, uint32_t baud_rate); - -/*** Local Variables ***/ -#define UART_NUM_UARTS 2 -static uint16_t tx_fifo_size[UART_NUM_UARTS] = { 0 }; -static uint8_t active_uarts[UART_NUM_UARTS] = { 0 }; -/** slip input function pointer */ -static int(*uart_input[UART_NUM_UARTS]) (unsigned char) = { 0 }; -/* time in uSec for transmitting 1 char */ -static uint16_t uart_char_delay = 0; -static volatile int8_t interrupt_enabled[UART_NUM_UARTS] = { 0 }; -static volatile int8_t interrupt_enabled_saved[UART_NUM_UARTS] = { 0 }; - -/**************************************************************************** - * - * NAME: uart_driver_init - * - * DESCRIPTION: - * Initializes the specified UART device. - * - * PARAMETERS: Name RW Usage - * uart_dev R UART to initialise, eg, E_AHI_UART_0 - * br R Baudrate to use (e.g. UART_RATE_115200) - * if br > UART_RATE_115200 - * then uart_driver_set_baud_rate is called - * else vAHI_UartSetClockDivisor - * txbuf_data R Pointer to a memory block to use - * and rxbuf_data as uart tx/rx fifo - * txbuf_size R size of tx fifo (valid range: 16-2047) - * txbuf_size R size of rx fifo (valid range: 16-2047) - * uart_input_function a function pointer to input uart rx bytes - * RETURNS: - * void - * - ****************************************************************************/ -void -uart_driver_init(uint8_t uart_dev, uint8_t br, uint8_t *txbuf_data, - uint16_t txbuf_size, uint8_t *rxbuf_data, uint16_t rxbuf_size, - int (*uart_input_function)(unsigned char c)) -{ -#if !UART_HW_FLOW_CTRL - /* Disable RTS/CTS */ - vAHI_UartSetRTSCTS(uart_dev, FALSE); -#endif - - tx_fifo_size[uart_dev] = txbuf_size; - - /* Configure the selected Uart */ - uint8_t uart_enabled = bAHI_UartEnable(uart_dev, txbuf_data, txbuf_size, - rxbuf_data, rxbuf_size); - /* fallback to internal buffers */ - if(!uart_enabled) { - vAHI_UartEnable(uart_dev); - tx_fifo_size[uart_dev] = 16; /* Fixed size */ - } - /* Reset tx/rx fifos */ - vAHI_UartReset(uart_dev, TRUE, TRUE); - vAHI_UartReset(uart_dev, FALSE, FALSE); - - uart_driver_set_baudrate(uart_dev, br); - - /* install interrupt service callback */ - if(uart_dev == E_AHI_UART_0) { - vAHI_Uart0RegisterCallback((void *)uart_driver_isr); - } else { - vAHI_Uart1RegisterCallback((void *)uart_driver_isr); - /* Enable RX interrupt */ - } - uart_driver_enable_interrupts(uart_dev); - uart_input[uart_dev] = uart_input_function; - active_uarts[uart_dev] = 1; - -#if UART_HW_FLOW_CTRL - /* Configure HW flow control */ - vAHI_UartSetAutoFlowCtrl(uart_dev, E_AHI_UART_FIFO_ARTS_LEVEL_13, /* uint8 const u8RxFifoLevel,*/ - FALSE, /* bool_t const bFlowCtrlPolarity,*/ - TRUE, /* bool_t const bAutoRts, */ - TRUE /* bool_t const bAutoCts */); -#endif - - DBG_vPrintf("UART %d init: using %s buffers %d\n", uart_dev, - uart_enabled ? "external" : "internal", tx_fifo_size[uart_dev]); -} -void -uart_driver_enable_interrupts(uint8_t uart_dev) -{ - /* wait while char being tx is done */ - while((u8AHI_UartReadLineStatus(uart_dev) & E_AHI_UART_LS_THRE) == 0) ; - - vAHI_UartSetInterrupt(uart_dev, FALSE /*bEnableModemStatus*/, - FALSE /*bEnableRxLineStatus == Break condition */, - FALSE /*bEnableTxFifoEmpty*/, - TRUE /* bEnableRxData */, E_AHI_UART_FIFO_LEVEL_14); - interrupt_enabled[uart_dev] = 1; -} -void -uart_driver_disable_interrupts(uint8_t uart_dev) -{ - /* wait while char being tx is done */ - while((u8AHI_UartReadLineStatus(uart_dev) & E_AHI_UART_LS_THRE) == 0) ; - - vAHI_UartSetInterrupt(uart_dev, FALSE /*bEnableModemStatus*/, - FALSE /*bEnableRxLineStatus == Break condition */, - FALSE /*bEnableTxFifoEmpty*/, - FALSE /* bEnableRxData */, E_AHI_UART_FIFO_LEVEL_14); - interrupt_enabled[uart_dev] = 0; -} -void -uart_driver_store_interrupts(uint8_t uart_dev) -{ - interrupt_enabled_saved[uart_dev] = interrupt_enabled[uart_dev]; -} -void -uart_driver_restore_interrupts(uint8_t uart_dev) -{ - if(interrupt_enabled_saved[uart_dev]) { - uart_driver_enable_interrupts(uart_dev); - } else { - uart_driver_disable_interrupts(uart_dev); - } -} -int8_t -uart_driver_interrupt_is_enabled(uint8_t uart_dev) -{ - return interrupt_enabled[uart_dev]; -} -void -uart_driver_set_input(uint8_t uart_dev, int - (*uart_input_function)(unsigned char c)) -{ - uart_input[uart_dev] = uart_input_function; -} -/**************************************************************************** - * - * NAME: uart_driver_read - * - * DESCRIPTION: - * Reads 1 byte from the RX buffer. If there is no data in the - * buffer, then return FALSE - * - * PARAMETERS: Name RW Usage - * uart_dev R UART to use, eg, E_AHI_UART_0 - * - * RETURNS: - * TRUE if a byte has been read from the queue - * - ****************************************************************************/ -uint8_t -uart_driver_read(uint8_t uart_dev, uint8_t *data) -{ - if(data && u16AHI_UartReadRxFifoLevel(uart_dev) > 0) { - *data = u8AHI_UartReadData(uart_dev); - return TRUE; - } - return FALSE; -} -void -uart_driver_write_buffered(uint8_t uart_dev, uint8_t ch) -{ - uart_driver_write_with_deadline(uart_dev, ch); -} -/**************************************************************************** - * - * NAME: uart_driver_write_with_deadline - * - * DESCRIPTION: - * Writes one byte to the specified uart for transmission - * - * PARAMETERS: Name RW Usage - * uart_dev R UART to use, eg, E_AHI_UART_0 - * ch R data to transmit - * - * RETURNS: - * void - * - ****************************************************************************/ -void -uart_driver_write_with_deadline(uint8_t uart_dev, uint8_t ch) -{ -#if UART_XONXOFF_FLOW_CTRL - /* Block until host can receive data */ - /* Wait until there are less than N characters in TX FIFO */ - while(xonxoff_state != XON - || u16AHI_UartReadTxFifoLevel(uart_dev) > TX_FIFO_SW_FLOW_LIMIT) { - watchdog_periodic(); - } - /* write to TX FIFO and return immediately */ - vAHI_UartWriteData(uart_dev, ch); -#else /* UART_XONXOFF_FLOW_CTRL */ - volatile int16_t write = 0; - watchdog_periodic(); - /* wait until there is space in tx fifo */ - RTIMER_BUSYWAIT_UNTIL(write = (uart_driver_get_tx_fifo_available_space(uart_dev) > 0), - CHAR_DEADLINE); - /* write only if there is space so we do not get stuck */ - if(write) { - /* write to TX FIFO and return immediately */ - vAHI_UartWriteData(uart_dev, ch); - } -#endif /* UART_XONXOFF_FLOW_CTRL */ -} -void -uart_driver_write_direct(uint8_t uart_dev, uint8_t ch) -{ - /* Write character */ - vAHI_UartWriteData(uart_dev, ch); - /* Wait for buffers to empty */ - while((u8AHI_UartReadLineStatus(uart_dev) & E_AHI_UART_LS_THRE) == 0) ; - while((u8AHI_UartReadLineStatus(uart_dev) & E_AHI_UART_LS_TEMT) == 0) ; -} -/**************************************************************************** - * - * NAME: uart_driver_rx_handler - * - * DESCRIPTION: - * Interrupt service callback for UART data reception. Reads a received - * byte from the UART and writes it to the reception buffer if it is not - * full. - * - * PARAMETERS: Name RW Usage - * uart_dev R Uart to read from - * - * RETURNS: - * void - * - ****************************************************************************/ -void -uart_driver_rx_handler(uint8_t uart_dev) -{ - /* optimization for high throughput: Read upto 32 bytes from RX fifo. - * Disabled because it does not work with current slip_input_byte */ - - /* Status from uart_input: - * 0 means do not exit power saving mode - * -1 means RX buffer overflow ==> stop reading - * 1 means end of slip packet - */ -#if UART_XONXOFF_FLOW_CTRL - /* save old status */ - int xonxoff_state_old = xonxoff_state; -#endif /* UART_XONXOFF_FLOW_CTRL */ - int status = 0; - int c = 0; - while(u16AHI_UartReadRxFifoLevel(uart_dev) > 0 && c++ < 32 && status == 0) { - if(uart_input[uart_dev] != NULL) { /* read one char at a time */ - - /* process received character */ - status = (uart_input[uart_dev])(u8AHI_UartReadData(uart_dev)); - -#if UART_XONXOFF_FLOW_CTRL - /* Process XON-XOFF*/ - if(xonxoff_state == XOFF) { - /* XXX do not set break condition as it corrupts one character, instead we block on TX */ - /* Instruct uart to stop TX */ - /* vAHI_UartSetBreak(uart_dev, TRUE); */ - break; - } else if(xonxoff_state_old == XOFF && xonxoff_state == XON) { - /* Instruct uart to resume TX if it was stopped */ - /* vAHI_UartSetBreak(uart_dev, FALSE); */ - } -#endif /* UART_XONXOFF_FLOW_CTRL */ - } else { - /* no input handler, or no bytes to read: Discard byte. */ - u8AHI_UartReadData(uart_dev); - } - } -} -/****************************************************************************/ -/*** Local Functions ***/ -/****************************************************************************/ - -#if !UART_XONXOFF_FLOW_CTRL -/* Returns the free space in tx fifo, i.e., how many characters we can put */ -static int16_t -uart_driver_get_tx_fifo_available_space(uint8_t uart_dev) -{ - return tx_fifo_size[uart_dev] - u16AHI_UartReadTxFifoLevel(uart_dev); -} -#endif /* !UART_XONXOFF_FLOW_CTRL */ -/* Initializes the specified UART with auto-selection of - baudrate tuning method */ -static void -uart_driver_set_baudrate(uint8_t uart_dev, uint8_t br) -{ - uint32_t high_br = 0; - uint8_t low_br = 0; - - switch(br) { - case UART_RATE_4800: - low_br = E_AHI_UART_RATE_4800; - uart_char_delay = 1667; - break; - case UART_RATE_9600: - low_br = E_AHI_UART_RATE_9600; - uart_char_delay = 834; - break; - case UART_RATE_19200: - low_br = E_AHI_UART_RATE_19200; - uart_char_delay = 417; - break; - case UART_RATE_38400: - low_br = E_AHI_UART_RATE_38400; - uart_char_delay = 209; - break; - case UART_RATE_76800: - low_br = E_AHI_UART_RATE_76800; - uart_char_delay = 105; - break; - case UART_RATE_115200: - low_br = E_AHI_UART_RATE_115200; - uart_char_delay = 69; - break; - case UART_RATE_230400: - high_br = 230400UL; - uart_char_delay = 35; - break; - case UART_RATE_460800: - high_br = 460800UL; - uart_char_delay = 18; - break; - case UART_RATE_500000: - high_br = 500000UL; - uart_char_delay = 16; - break; - case UART_RATE_576000: - high_br = 576000UL; - uart_char_delay = 14; - break; - case UART_RATE_921600: - high_br = 921600UL; - uart_char_delay = 9; - break; - case UART_RATE_1000000: - high_br = 1000000UL; - uart_char_delay = 8; - break; - default: - high_br = 1000000UL; - uart_char_delay = 8; - break; - } - if(high_br == 0) { - vAHI_UartSetClockDivisor(uart_dev, low_br); - } else { - uart_driver_set_high_baudrate(uart_dev, high_br); - } -} -/**************************************************************************** - * - * NAME: uart_driver_set_high_baudrate - * - * DESCRIPTION: - * Sets the baud rate for the specified uart - * - * PARAMETERS: Name RW Usage - * uart_dev R UART to initialise, eg, E_AHI_UART_0 - * baud_rate R Baudrate to use (bps eg 921600) - * - * RETURNS: - * void - * - ****************************************************************************/ -static void -uart_driver_set_high_baudrate(uint8_t uart_dev, uint32_t baud_rate) -{ - uint16 u16Divisor = 1; - uint32_t u32Remainder; - uint8_t u8ClocksPerBit = 16; - -#if (ENABLE_ADVANCED_BAUD_SELECTION) - /* Defining ENABLE_ADVANCED_BAUD_SELECTION in the Makefile - * enables this code which searches for a clocks per bit setting - * that gets closest to the configured rate. - */ - uint32_t u32CalcBaudRate = 0; - int32 i32BaudError = 0x7FFFFFFF; - - DBG_vPrintf(DEBUG_UART_BUFFERED, "Config uart=%d, baud=%d\n", uart_dev, - baud_rate); - - while(ABS(i32BaudError) > (int32)(baud_rate >> 4)) { /* 6.25% (100/16) error */ - if(--u8ClocksPerBit < 3) { - DBG_vPrintf(DEBUG_UART_BUFFERED, - "Could not calculate UART settings for target baud!"); - return; - } -#endif /* ENABLE_ADVANCED_BAUD_SELECTION */ - - /* Calculate Divisor register = 16MHz / (16 x baud rate) */ - u16Divisor = (uint16)(16000000UL / ((u8ClocksPerBit + 1) * baud_rate)); - - /* Correct for rounding errors */ - u32Remainder = - (uint32_t)(16000000UL % ((u8ClocksPerBit + 1) * baud_rate)); - - if(u32Remainder >= (((u8ClocksPerBit + 1) * baud_rate) / 2)) { - u16Divisor += 1; - } -#if (ENABLE_ADVANCED_BAUD_SELECTION) - DBG_vPrintf(DEBUG_UART_BUFFERED, "Divisor=%d, cpb=%d\n", u16Divisor, - u8ClocksPerBit); - - u32CalcBaudRate = (16000000UL / ((u8ClocksPerBit + 1) * u16Divisor)); - - DBG_vPrintf(DEBUG_UART_BUFFERED, "Calculated baud=%d\n", u32CalcBaudRate); - - i32BaudError = (int32)u32CalcBaudRate - (int32)baud_rate; - - DBG_vPrintf(DEBUG_UART_BUFFERED, "Error baud=%d\n", i32BaudError); -} -DBG_vPrintf(DEBUG_UART_BUFFERED, "Config uart=%d: Divisor=%d, cpb=%d\n", - uart_dev, u16Divisor, u8ClocksPerBit); - -/* Set the calculated clocks per bit */ -vAHI_UartSetClocksPerBit(uart_dev, u8ClocksPerBit); -#endif /* ENABLE_ADVANCED_BAUD_SELECTION */ - - /* Set the calculated divisor */ - vAHI_UartSetBaudDivisor(uart_dev, u16Divisor); -} - -/**************************************************************************** - * - * NAME: uart_driver_isr - * - * DESCRIPTION: - * Interrupt service callback for UART's - * - * PARAMETERS: Name RW Usage - * device_id R Device ID of whatever generated the - * interrupt - * item_bitmap R Which part of the device generated - * the interrupt - * - * RETURNS: - * void - * - ****************************************************************************/ -static void -uart_driver_isr(uint32_t device_id, uint32_t item_bitmap) -{ - uint8_t uart_dev; - switch(device_id) { - case E_AHI_DEVICE_UART0: - uart_dev = E_AHI_UART_0; - break; - case E_AHI_DEVICE_UART1: - uart_dev = E_AHI_UART_1; - break; - default: - return; - } - switch(item_bitmap) { - /* byte available since a long time but RX-fifo not full: */ - case E_AHI_UART_INT_TIMEOUT: - /* RX-fifo full: */ - case E_AHI_UART_INT_RXDATA: - uart_driver_rx_handler(uart_dev); - break; - case E_AHI_UART_INT_TX: - break; - case E_AHI_UART_INT_RXLINE: - /* rx-line interrupt is disabled. Should not get here */ - /* An error condition has occurred on the RxD line, such as - a break indication, framing error, parity error or over-run. */ - break; - } -} -/**************************************************************************** - * - * NAME: uart_driver_tx_in_progress - * - * DESCRIPTION: - * Returns the state of data transmission - * - * PARAMETERS: Name RW Usage - * uart_dev R UART to use, eg, E_AHI_UART_0 - * - * RETURNS: - * uint8_t: TRUE if data in buffer is being transmitted - * FALSE if all data in buffer has been transmitted by the UART - * - ****************************************************************************/ -uint8_t -uart_driver_tx_in_progress(uint8_t uart_dev) -{ - - if(u16AHI_UartReadTxFifoLevel(uart_dev) == 0) { - if((u8AHI_UartReadLineStatus(uart_dev) & E_AHI_UART_LS_TEMT) != 0) { - return FALSE; - } - } - return TRUE; -} -#ifdef UART_EXTRAS - -/**************************************************************************** - * - * NAME: uart_driver_flush - * - * DESCRIPTION: - * Flushes the buffers of the specified UART - * - * PARAMETERS: Name RW Usage - * uart_dev R UART to disable, eg, E_AHI_UART_0 - * reset_tx R to reset the transmit FIFO - * reset_rx R to reset the receive FIFO - * - * RETURNS: - * void - * - ****************************************************************************/ -void -uart_driver_flush(uint8_t uart_dev, bool_t reset_tx, bool_t reset_rx) -{ - /* Disable TX Fifo empty and Rx data interrupts */ - uart_driver_disable_interrupts(uart_dev); - - /* flush hardware buffer */ - vAHI_UartReset(uart_dev, reset_tx, reset_rx); - vAHI_UartReset(uart_dev, FALSE, FALSE); - - /* Re-enable TX Fifo empty and Rx data interrupts */ - uart_driver_enable_interrupts(uart_dev); -} -#endif /* UART_EXTRAS */ diff --git a/arch/platform/jn516x/dev/uart-driver.h b/arch/platform/jn516x/dev/uart-driver.h deleted file mode 100644 index af4ff7840..000000000 --- a/arch/platform/jn516x/dev/uart-driver.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Lee Mitchell - * Integrated into Contiki by Beshr Al Nahas - * - */ - -#ifndef UARTDRIVER_H -#define UARTDRIVER_H - -#include -#include "contiki.h" - -#define UART_EXTRAS 1 - -void uart_driver_init(uint8_t uart_dev, uint8_t br, uint8_t * txbuf_data, uint16_t txbuf_size, uint8_t * rxbuf_data, uint16_t rxbuf_size, int (*uart_input_function)(unsigned char c)); -void uart_driver_write_buffered(uint8_t uart_dev, uint8_t ch); -void uart_driver_write_with_deadline(uint8_t uart_dev, uint8_t c); -uint8_t uart_driver_read(uint8_t uart_dev, uint8_t *data); -void uart_driver_write_direct(uint8_t uart_dev, uint8_t ch); -void uart_driver_set_input(uint8_t u8Uart, int (*uart_input_function)(unsigned char c)); - -void uart_driver_rx_handler(uint8_t uart_dev); -void uart_driver_enable_interrupts(uint8_t uart_dev); -void uart_driver_disable_interrupts(uint8_t uart_dev); -int8_t uart_driver_interrupt_is_enabled(uint8_t uart_dev); -void uart_driver_store_interrupts(uint8_t uart_dev); -void uart_driver_restore_interrupts(uint8_t uart_dev); - -uint8_t uart_driver_tx_in_progress(uint8_t uart_dev); - -#ifdef UART_EXTRAS -void uart_driver_flush(uint8_t uart_dev, bool_t reset_tx, bool_t reset_rx); -#endif - -#endif /* UARTDRIVER_H */ diff --git a/arch/platform/jn516x/dev/uart0.c b/arch/platform/jn516x/dev/uart0.c deleted file mode 100644 index fcc686a47..000000000 --- a/arch/platform/jn516x/dev/uart0.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * UART0 drivers - * \author - * Beshr Al Nahas - * - */ - -#include -#include -#include -#include "contiki.h" -#include "dev/uart0.h" -#include "uart-driver.h" - -/* Valid range for TXBUFSIZE and RXBUFSIZE: 16-2047 */ - -static unsigned char txbuf_data[UART_TX_BUFFER_SIZE]; -static unsigned char rxbuf_data[UART_RX_BUFFER_SIZE]; -static int (*uart0_input)(unsigned char c); - -uint8_t -uart0_active(void) -{ - return uart_driver_tx_in_progress(E_AHI_UART_0); -} -void -uart0_set_input(int - (*input)(unsigned char c)) -{ - uart0_input = input; - uart_driver_set_input(E_AHI_UART_0, uart0_input); -} -void -uart0_writeb(unsigned char c) -{ - uart_driver_write_buffered(E_AHI_UART_0, c); -} -void -uart0_init(uint8_t br) -{ - uart_driver_init(E_AHI_UART_0, br, txbuf_data, UART_TX_BUFFER_SIZE, rxbuf_data, UART_RX_BUFFER_SIZE, uart0_input); -} diff --git a/arch/platform/jn516x/dev/uart0.h b/arch/platform/jn516x/dev/uart0.h deleted file mode 100644 index 9b39c9d40..000000000 --- a/arch/platform/jn516x/dev/uart0.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * UART0 drivers - * \author - * Beshr Al Nahas - * - */ - -#ifndef __UART0_H__ -#define __UART0_H__ - -#include -#include "contiki.h" -#include "uart-driver.h" - -#define UART_DEFAULT_RX_BUFFER_SIZE 2047 -#if UART_XONXOFF_FLOW_CTRL -#define UART_DEFAULT_TX_BUFFER_SIZE 64 -#else -#define UART_DEFAULT_TX_BUFFER_SIZE 1281 -#endif -#ifdef UART_CONF_TX_BUFFER_SIZE -#define UART_TX_BUFFER_SIZE UART_CONF_TX_BUFFER_SIZE -#else -#define UART_TX_BUFFER_SIZE UART_DEFAULT_TX_BUFFER_SIZE -#endif -#ifdef UART_CONF_RX_BUFFER_SIZE -#define UART_RX_BUFFER_SIZE UART_CONF_RX_BUFFER_SIZE -#else -#define UART_RX_BUFFER_SIZE UART_DEFAULT_RX_BUFFER_SIZE -#endif -void uart0_set_input(int (*input)(unsigned char c)); -void uart0_writeb(unsigned char c); -void uart0_init(unsigned char br); - -#define uart0_write_direct(c) uart_driver_write_direct(E_AHI_UART_0, (c)) -#define uart0_disable_interrupts() uart_driver_disable_interrupts(E_AHI_UART_0) -#define uart0_enable_interrupts() uart_driver_enable_interrupts(E_AHI_UART_0) -#define uart0_restore_interrupts() uart_driver_restore_interrupts(E_AHI_UART_0) -#define uart0_store_interrupts() uart_driver_store_interrupts(E_AHI_UART_0) - -uint8_t uart0_active(void); - -#endif diff --git a/arch/platform/jn516x/dev/uart1.c b/arch/platform/jn516x/dev/uart1.c deleted file mode 100644 index 4cd828f77..000000000 --- a/arch/platform/jn516x/dev/uart1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * UART1 drivers - * \author - * Beshr Al Nahas - * - */ - -#include -#include -#include -#include "contiki.h" -#include "dev/uart1.h" -#include "uart-driver.h" - -static unsigned char txbuf_data[UART1_TX_BUFFER_SIZE]; -static unsigned char rxbuf_data[UART1_RX_BUFFER_SIZE]; -static int (*uart1_input)(unsigned char c); - -uint8_t -uart1_active(void) -{ - return uart_driver_tx_in_progress(E_AHI_UART_1); -} -void -uart1_set_input(int - (*input)(unsigned char c)) -{ - uart1_input = input; - uart_driver_set_input(E_AHI_UART_1, uart1_input); -} -void -uart1_writeb(unsigned char c) -{ - uart_driver_write_buffered(E_AHI_UART_1, c); -} -void -uart1_init(uint8_t br) -{ - uart_driver_init(E_AHI_UART_1, br, txbuf_data, UART1_TX_BUFFER_SIZE, rxbuf_data, UART1_RX_BUFFER_SIZE, uart1_input); -} diff --git a/arch/platform/jn516x/dev/uart1.h b/arch/platform/jn516x/dev/uart1.h deleted file mode 100644 index 523537999..000000000 --- a/arch/platform/jn516x/dev/uart1.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * UART1 drivers - * \author - * Beshr Al Nahas - * - */ - -#ifndef __UART1_H__ -#define __UART1_H__ - -#include -#include "contiki.h" - -/* Default buffer size - Valid range for TX_BUFFER_SIZE and RX_BUFFER_SIZE: 16-2047 */ -#define UART1_DEFAULT_RX_BUFFER_SIZE 16 -#define UART1_DEFAULT_TX_BUFFER_SIZE 16 - -/* Buffer size selection */ -#ifdef UART1_CONF_TX_BUFFER_SIZE -#define UART1_TX_BUFFER_SIZE UART1_CONF_TX_BUFFER_SIZE -#else -#define UART1_TX_BUFFER_SIZE UART1_DEFAULT_TX_BUFFER_SIZE -#endif - -#ifdef UART1_CONF_RX_BUFFER_SIZE -#define UART1_RX_BUFFER_SIZE UART1_CONF_RX_BUFFER_SIZE -#else -#define UART1_RX_BUFFER_SIZE UART1_DEFAULT_RX_BUFFER_SIZE -#endif - -void uart1_set_input(int (*input)(unsigned char c)); -void uart1_writeb(unsigned char c); -void uart1_init(unsigned char br); - -#define uart1_write_direct(c) uart_driver_write_direct(E_AHI_UART_1, (c)) -#define uart1_disable_interrupts() uart_driver_disable_interrupts(E_AHI_UART_1) -#define uart1_enable_interrupts() uart_driver_enable_interrupts(E_AHI_UART_1) -#define uart1_restore_interrupts() uart_driver_restore_interrupts(E_AHI_UART_1) -#define uart1_store_interrupts() uart_driver_store_interrupts(E_AHI_UART_1) - -uint8_t uart1_active(void); - -#endif diff --git a/arch/platform/jn516x/dev/watchdog.c b/arch/platform/jn516x/dev/watchdog.c deleted file mode 100644 index 395106fd3..000000000 --- a/arch/platform/jn516x/dev/watchdog.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * JN516X watchdog support. - * \author - * Beshr Al Nahas - * - */ - -#include "dev/watchdog.h" -#include "AppHardwareApi.h" - -/*---------------------------------------------------------------------------*/ -static int counter = 0; - -/*---------------------------------------------------------------------------*/ -void -watchdog_init(void) -{ - counter = 0; - watchdog_stop(); - /* enable WDT interrupt */ - vAHI_WatchdogException(1); -} -/*---------------------------------------------------------------------------*/ -void -watchdog_start(void) -{ - /* We setup the watchdog to reset the device after two seconds, - unless watchdog_periodic() is called. */ - counter--; - if(counter == 0) { - vAHI_WatchdogStart(9); /* about 8*2^(9-1)ms=2.048s timeout */ - } -} -/*---------------------------------------------------------------------------*/ -void -watchdog_periodic(void) -{ - /* This function is called periodically to restart the watchdog - timer. */ - vAHI_WatchdogRestart(); -} -/*---------------------------------------------------------------------------*/ -void -watchdog_stop(void) -{ - counter++; - if(counter == 1) { - vAHI_WatchdogStop(); - } -} -/*---------------------------------------------------------------------------*/ -void -watchdog_reboot(void) -{ - vAHI_SwReset(); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/jn516x/doxygen-group.txt b/arch/platform/jn516x/doxygen-group.txt deleted file mode 100644 index 11e5a702c..000000000 --- a/arch/platform/jn516x/doxygen-group.txt +++ /dev/null @@ -1,4 +0,0 @@ -/** - * \defgroup jn516x The JN516x Board - * \ingroup platform - */ diff --git a/arch/platform/jn516x/int-master.c b/arch/platform/jn516x/int-master.c deleted file mode 100644 index d86bd801b..000000000 --- a/arch/platform/jn516x/int-master.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 - * Master interrupt manipulation implementation for the JN516x - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "MicroSpecific.h" -#include "sys/int-master.h" - -#include -/*---------------------------------------------------------------------------*/ -void -int_master_enable(void) -{ - MICRO_ENABLE_INTERRUPTS(); -} -/*---------------------------------------------------------------------------*/ -int_master_status_t -int_master_read_and_disable(void) -{ - int_master_status_t status; - - MICRO_DISABLE_AND_SAVE_INTERRUPTS(status); - - return status; -} -/*---------------------------------------------------------------------------*/ -void -int_master_status_set(int_master_status_t status) -{ - MICRO_RESTORE_INTERRUPTS(status); -} -/*---------------------------------------------------------------------------*/ -bool -int_master_is_enabled(void) -{ - int_master_status_t status; - - asm volatile ("bw.mfspr %0, r0, 17;" :"=r"(status) : ); - - return status; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/jn516x/jn516x-def.h b/arch/platform/jn516x/jn516x-def.h deleted file mode 100644 index a7d8906f9..000000000 --- a/arch/platform/jn516x/jn516x-def.h +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef JN516X_DEF_H_ -#define JN516X_DEF_H_ - -#include -#include - -#undef putchar - -/* 1 len byte, 2 bytes CRC */ -#define RADIO_PHY_OVERHEAD 3 -/* 250kbps data rate. One byte = 32us */ -#define RADIO_BYTE_AIR_TIME 32 -/* Delay between GO signal and SFD - * Measured 153us between GO and preamble. Add 5 bytes (preamble + SFD) air time: 153+5*32 = 313 */ -#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(313)) -/* Delay between GO signal and start listening - * Measured 104us: between GO signal and start listening */ -#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(104)) -/* Delay between the SFD finishes arriving and it is detected in software */ -#define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(14)) - -/* uIP endinanness */ -#define UIP_CONF_BYTE_ORDER UIP_BIG_ENDIAN - -/* Micromac configuration */ - -#ifndef MIRCOMAC_CONF_BUF_NUM -#define MIRCOMAC_CONF_BUF_NUM 2 -#endif - -/* 32kHz or 16MHz rtimers? */ -#ifdef RTIMER_CONF_USE_32KHZ -#define RTIMER_USE_32KHZ RTIMER_CONF_USE_32KHZ -#else -#define RTIMER_USE_32KHZ 0 -#endif - -/* Put the device in a sleep mode in idle periods? - * If RTIMER_USE_32KHZ is set, the device runs all the time on the 32 kHz oscillator. - * If RTIMER_USE_32KHZ is not set, the device runs on the 32 kHz oscillator during sleep, - * and switches back to the 32 MHz oscillator (16 MHz rtimer) at wakeup. - * */ -#ifdef JN516X_SLEEP_CONF_ENABLED -#define JN516X_SLEEP_ENABLED JN516X_SLEEP_CONF_ENABLED -#else -#define JN516X_SLEEP_ENABLED 0 -#endif - -/* Enable this to get the 32.768kHz oscillator */ -#ifndef JN516X_EXTERNAL_CRYSTAL_OSCILLATOR -#define JN516X_EXTERNAL_CRYSTAL_OSCILLATOR (RTIMER_USE_32KHZ || JN516X_SLEEP_ENABLED) -#endif /* JN516X_EXTERNAL_CRYSTAL_OSCILLATOR */ - -/* 8ms timer tick */ -#define CLOCK_CONF_SECOND 125 - -#if JN516X_EXTERNAL_CRYSTAL_OSCILLATOR -#define JN516X_XOSC_SECOND 32768 -#else -#define JN516X_XOSC_SECOND 32000 -#endif - -/* Timer conversion*/ -#if RTIMER_USE_32KHZ -#define RADIO_TO_RTIMER(X) ((X) * (JN516X_XOSC_SECOND) / 62500) -#else - /* RTIMER 16M = 256 * 62500(RADIO) == 2^8 * 62500 */ -#define RADIO_TO_RTIMER(X) ((rtimer_clock_t)((X) << (int32_t)8L)) -#endif - -/* If the timer base a binary 32kHz clock, compensate for this base drift */ -#if RTIMER_USE_32KHZ && JN516X_EXTERNAL_CRYSTAL_OSCILLATOR -/* The drift compared to "true" 10ms slots. - * Enable adaptive sync to enable compensation for this. - * Slot length 10000 usec - * 328 ticks - * Tick duration 30.517578125 usec - * Real slot duration 10009.765625 usec - * Target - real duration = -9.765625 usec - * TSCH_CONF_BASE_DRIFT_PPM -977 - */ -#define TSCH_CONF_BASE_DRIFT_PPM -977 -#endif - -#define DR_11744_DIO2 12 -#define DR_11744_DIO3 13 -#define DR_11744_DIO4 14 -#define DR_11744_DIO5 15 -#define DR_11744_DIO6 16 -#define DR_11744_DIO7 17 - -/* Enable power amplifier of JN5168 M05 and M06 modules */ -#if defined(JN5168_M05) || defined(JN5168_M06) -#define RADIO_TEST_MODE RADIO_TEST_MODE_HIGH_PWR -#else -#define RADIO_TEST_MODE RADIO_TEST_MODE_DISABLED -#endif - -#define TSCH_DEBUG 0 - -#if TSCH_DEBUG -#define TSCH_DEBUG_INIT() do { \ - vAHI_DioSetDirection(0, (1 << DR_11744_DIO2) | (1 << DR_11744_DIO3) | (1 << DR_11744_DIO4) | (1 << DR_11744_DIO5) | (1 << DR_11744_DIO6) | (1 << DR_11744_DIO7)); \ - vAHI_DioSetOutput(0, (1 << DR_11744_DIO2) | (1 << DR_11744_DIO3) | (1 << DR_11744_DIO4) | (1 << DR_11744_DIO5) | (1 << DR_11744_DIO6) | (1 << DR_11744_DIO7)); } while(0); -#define TSCH_DEBUG_INTERRUPT() do { \ - static dio_state = 0; \ - dio_state = !dio_state; \ - if(dio_state) { \ - vAHI_DioSetOutput((1 << DR_11744_DIO2), 0); \ - } else { \ - vAHI_DioSetOutput(0, (1 << DR_11744_DIO2)); \ - } \ -} while(0); -#define TSCH_DEBUG_RX_EVENT() do { \ - static dio_state = 0; \ - dio_state = !dio_state; \ - if(dio_state) { \ - vAHI_DioSetOutput((1 << DR_11744_DIO4), 0); \ - } else { \ - vAHI_DioSetOutput(0, (1 << DR_11744_DIO4)); \ - } \ -} while(0); -#define TSCH_DEBUG_TX_EVENT() do { \ - static dio_state = 0; \ - dio_state = !dio_state; \ - if(dio_state) { \ - vAHI_DioSetOutput((1 << DR_11744_DIO5), 0); \ - } else { \ - vAHI_DioSetOutput(0, (1 << DR_11744_DIO5)); \ - } \ -} while(0); -#define TSCH_DEBUG_SLOT_START() do { \ - static dio_state = 0; \ - dio_state = !dio_state; \ - if(dio_state) { \ - vAHI_DioSetOutput((1 << DR_11744_DIO3), 0); \ - } else { \ - vAHI_DioSetOutput(0, (1 << DR_11744_DIO3)); \ - } \ -} while(0); -#define TSCH_DEBUG_SLOT_END() -#endif /* TSCH_DEBUG */ - -/* UART baud rates */ -#define UART_RATE_4800 0 -#define UART_RATE_9600 1 -#define UART_RATE_19200 2 -#define UART_RATE_38400 3 -#define UART_RATE_76800 4 -#define UART_RATE_115200 5 -#define UART_RATE_230400 6 -#define UART_RATE_460800 7 -#define UART_RATE_500000 8 -#define UART_RATE_576000 9 -#define UART_RATE_921600 10 -#define UART_RATE_1000000 11 - -#define PLATFORM_HAS_LEDS 1 -#define PLATFORM_HAS_BUTTON (SENSOR_BOARD_DR1174 == 1) -#define PLATFORM_HAS_LIGHT (SENSOR_BOARD_DR1175 == 1) -#define PLATFORM_HAS_HT (SENSOR_BOARD_DR1175 == 1) -#define PLATFORM_HAS_POT (SENSOR_BOARD_DR1199 == 1) -#define PLATFORM_HAS_BATTERY 0 /* sensor driver not implemented */ -#define PLATFORM_HAS_SHT11 0 -#define PLATFORM_HAS_RADIO 1 - -#define LEDS_CONF_LEGACY_API 1 - -#define PLATFORM_CONF_PROVIDES_MAIN_LOOP 1 - -/* CPU target speed in Hz - * RTIMER and peripherals clock is F_CPU/2 */ -#define F_CPU 32000000UL - -/* LED ports */ -/* - #define LEDS_PxDIR P5DIR - #define LEDS_PxOUT P5OUT - #define LEDS_CONF_RED 0x10 - #define LEDS_CONF_GREEN 0x20 - #define LEDS_CONF_YELLOW 0x40 - #define JENNIC_CONF_BUTTON_PIN (IRQ_DIO9|IRQ_DIO10) - */ - -#define CC_CONF_REGISTER_ARGS 1 -#define CC_CONF_FUNCTION_POINTER_ARGS 1 -#define CC_CONF_VA_ARGS 1 -#define CC_CONF_INLINE inline - -#ifdef HAVE_STDINT_H -#include -#else -#ifndef uint8_t -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned long uint32_t; -typedef signed char int8_t; -typedef short int16_t; -typedef long int32_t; -typedef unsigned long long uint64_t; -typedef long long int64_t; -#endif -#endif /* !HAVE_STDINT_H */ - -/* Types for clocks and uip_stats */ -typedef uint16_t uip_stats_t; -typedef uint32_t clock_time_t; - -/* Shall we calibrate the DCO periodically? */ -#ifndef DCOSYNCH_CONF_ENABLED -#define DCOSYNCH_CONF_ENABLED (!(MAC_CONF_WITH_TSCH)) -#endif /* DCOSYNCH_CONF_ENABLED */ - -/* How often shall we attempt to calibrate DCO? - * PS: It should be calibrated upon temperature changes, - * but the naive approach of periodic calibration is fine too */ -#ifndef DCOSYNCH_PERIOD -#define DCOSYNCH_PERIOD (5 * 60) -#endif /* VCO_CALIBRATION_INTERVAL */ - -/* Disable UART HW flow control */ -#ifndef UART_HW_FLOW_CTRL -#define UART_HW_FLOW_CTRL 0 -#endif /* UART_HW_FLOW_CTRL */ - -/* Disable UART SW flow control */ -#ifndef UART_XONXOFF_FLOW_CTRL -#define UART_XONXOFF_FLOW_CTRL 1 -#endif /* UART_XONXOFF_FLOW_CTRL */ - -#ifndef UART_BAUD_RATE -#define UART_BAUD_RATE UART_RATE_1000000 -#endif /* UART_BAUD_RATE */ - -#ifndef UART1_BAUD_RATE -#define UART1_BAUD_RATE UART_RATE_1000000 -#endif -#define ENABLE_ADVANCED_BAUD_SELECTION (UART_BAUD_RATE > UART_RATE_115200) - -/* Extension of LED definitions from leds.h for various JN516x dev boards -JN516x Dongle: - LEDS_RED Red LED on dongle - LEDS_GREEN Green LED on dongle - Note: Only one LED can be switch on at the same time - -DR1174-only: - LEDS_GP0 LED D3 on DR1174 - LEDS_GP1 LED D6 on DR1174 - -DR1174+DR1199: - LEDS_RED LED D1 on DR1199 - LEDS_GREEN LED D2 on DR1199 - LEDS_BLUE LED D3 on DR1199 - LEDS_GP0 LED D3 on DR1174 - LEDS_GP1 LED D6 on DR1174 - -DR1174+DR1175: - LEDS_RED Red led in RGB-led with level control on DR1175 - LEDS_GREEN Green led in RGB-led with level control on DR1175 - LEDS_BLUE Blue led in RGB-led with level control on DR1175 - LEDS_WHITE White power led with level control on DR1175 - LEDS_GP0 LEDS D3 on DR1174 - LEDS_GP1 LEDS D6 on DR1174 -*/ -#define LEDS_WHITE 8 -#define LEDS_GP0 16 -#define LEDS_GP1 32 -#define LEDS_GP2 64 -#define LEDS_GP3 128 -#define LEDS_CONF_ALL 255 - -#endif /* JN516X_DEF_H_ */ diff --git a/arch/platform/jn516x/platform.c b/arch/platform/jn516x/platform.c deleted file mode 100644 index bc9d7b955..000000000 --- a/arch/platform/jn516x/platform.c +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki OS - * - */ - -/** - * \file - * Contiki main for NXP JN516X platform - * - * \author - * Beshr Al Nahas - * Atis Elsts - */ - -#include -#include -#include - -#include "dev/watchdog.h" -#include -#include -#include -#include "dev/uart0.h" -#include "dev/uart-driver.h" - -#include "contiki.h" -#include "sys/energest.h" -#include "net/netstack.h" - -#include "dev/serial-line.h" - -#include "dev/leds.h" - -#include "lib/random.h" -#include "sys/node-id.h" -#include "sys/platform.h" -#include "rtimer-arch.h" - -#if NETSTACK_CONF_WITH_IPV6 -#include "net/ipv6/uip-ds6.h" -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -#include "dev/micromac-radio.h" -#include "MMAC.h" -/* Includes depending on connected sensor boards */ -#if SENSOR_BOARD_DR1175 -#include "light-sensor.h" -#include "ht-sensor.h" -SENSORS(&light_sensor, &ht_sensor); -#elif SENSOR_BOARD_DR1199 -#include "button-sensor.h" -#include "pot-sensor.h" -SENSORS(&pot_sensor, &button_sensor); -#else -#include "dev/button-sensor.h" -/* #include "dev/pir-sensor.h" */ -/* #include "dev/vib-sensor.h" */ -/* &pir_sensor, &vib_sensor */ -SENSORS(&button_sensor); -#endif -unsigned char node_mac[8]; - -/* Symbol defined by the linker script - * marks the end of the stack taking into account the used heap */ -extern uint32_t heap_location; - -#ifdef EXPERIMENT_SETUP -#include "experiment-setup.h" -#endif - -/* _EXTRA_LPM is the sleep mode, _LPM is the doze mode */ -#define ENERGEST_TYPE_EXTRA_LPM ENERGEST_TYPE_LPM - -extern int main(void); - -#if DCOSYNCH_CONF_ENABLED -static unsigned long last_dco_calibration_time; -#endif -static uint64_t sleep_start; -static uint32_t sleep_start_ticks; -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "JN516x" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -/* Reads MAC from SoC - * Must be called before network addresses initialization */ -static void -init_node_mac(void) -{ - tuAddr psExtAddress; - vMMAC_GetMacAddress(&psExtAddress.sExt); - node_mac[7] = psExtAddress.sExt.u32L; - node_mac[6] = psExtAddress.sExt.u32L >> (uint32_t)8; - node_mac[5] = psExtAddress.sExt.u32L >> (uint32_t)16; - node_mac[4] = psExtAddress.sExt.u32L >> (uint32_t)24; - node_mac[3] = psExtAddress.sExt.u32H; - node_mac[2] = psExtAddress.sExt.u32H >> (uint32_t)8; - node_mac[1] = psExtAddress.sExt.u32H >> (uint32_t)16; - node_mac[0] = psExtAddress.sExt.u32H >> (uint32_t)24; -} -/*---------------------------------------------------------------------------*/ -static void -set_linkaddr(void) -{ - linkaddr_t addr; - memset(&addr, 0, LINKADDR_SIZE); - -#if NETSTACK_CONF_WITH_IPV6 - memcpy(addr.u8, node_mac, sizeof(addr.u8)); -#else - int i; - for(i = 0; i < LINKADDR_SIZE; ++i) { - addr.u8[i] = node_mac[LINKADDR_SIZE - 1 - i]; - } -#endif - linkaddr_set_node_addr(&addr); -} -/*---------------------------------------------------------------------------*/ -bool_t -xosc_init(void) -{ - /* The internal 32kHz RC oscillator is used by default; - * Initialize and enable the external 32.768kHz crystal. - */ - vAHI_Init32KhzXtal(); - /* Switch to the 32.768kHz crystal. - * This will block and wait up to 1 sec for it to stabilize. */ - return bAHI_Set32KhzClockMode(E_AHI_XTAL); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one(void) -{ - /* Set stack overflow address for detecting overflow in runtime */ - vAHI_SetStackOverflow(TRUE, ((uint32_t *)&heap_location)[0]); - - /* Initialize random with a seed from the SoC random generator. - * This must be done before selecting the high-precision external oscillator. - */ - vAHI_StartRandomNumberGenerator(E_AHI_RND_SINGLE_SHOT, E_AHI_INTS_DISABLED); - random_init(u16AHI_ReadRandomNumber()); - - clock_init(); - rtimer_init(); - -#if JN516X_EXTERNAL_CRYSTAL_OSCILLATOR - /* initialize the 32kHz crystal and wait for ready */ - xosc_init(); - /* need to reinitialize because the wait-for-ready process uses system timers */ - clock_init(); - rtimer_init(); -#endif - - leds_init(); - leds_on(LEDS_ALL); - init_node_mac(); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two(void) -{ - uart0_init(UART_BAUD_RATE); /* Must come before first PRINTF */ - - /* check for reset source */ - if(bAHI_WatchdogResetEvent()) { - LOG_INFO("Init: Watchdog timer has reset device!\r\n"); - } - set_linkaddr(); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three(void) -{ -#ifndef UIP_FALLBACK_INTERFACE - uart0_set_input(serial_line_input_byte); - serial_line_init(); -#endif /* UIP_FALLBACK_INTERFACE */ - -#if TIMESYNCH_CONF_ENABLED - timesynch_init(); - timesynch_set_authority_level((linkaddr_node_addr.u8[0] << 4) + 16); -#endif /* TIMESYNCH_CONF_ENABLED */ - - /* need this to reliably generate the first rtimer callback and callbacks in other - auto-start processes */ - (void)u32AHI_Init(); - - leds_off(LEDS_ALL); -} -/*---------------------------------------------------------------------------*/ -void -platform_idle() -{ - clock_time_t time_to_etimer; - rtimer_clock_t ticks_to_rtimer; - -#if DCOSYNCH_CONF_ENABLED - /* Calibrate the DCO every DCOSYNCH_PERIOD - * if we have more than 500uSec until next rtimer - * PS: Calibration disables interrupts and blocks for 200uSec. - * */ - if(clock_seconds() - last_dco_calibration_time > DCOSYNCH_PERIOD) { - if(rtimer_arch_time_to_rtimer() > RTIMER_SECOND / 2000) { - /* PRINTF("ContikiMain: Calibrating the DCO\n"); */ - eAHI_AttemptCalibration(); - /* Patch to allow CpuDoze after calibration */ - vREG_PhyWrite(REG_PHY_IS, REG_PHY_INT_VCO_CAL_MASK); - last_dco_calibration_time = clock_seconds(); - } - } -#endif /* DCOSYNCH_CONF_ENABLED */ - - /* flush standard output before sleeping */ - uart_driver_flush(E_AHI_UART_0, TRUE, FALSE); - - /* calculate the time to the next etimer and rtimer */ - time_to_etimer = clock_arch_time_to_etimer(); - ticks_to_rtimer = rtimer_arch_time_to_rtimer(); - -#if JN516X_SLEEP_ENABLED - /* we can sleep only up to the next rtimer/etimer */ - rtimer_clock_t max_sleep_time = ticks_to_rtimer; - if(max_sleep_time >= JN516X_MIN_SLEEP_TIME) { - /* also take into account etimers */ - uint64_t ticks_to_etimer = ((uint64_t)time_to_etimer * RTIMER_SECOND) / CLOCK_SECOND; - max_sleep_time = MIN(ticks_to_etimer, ticks_to_rtimer); - } - - if(max_sleep_time >= JN516X_MIN_SLEEP_TIME) { - max_sleep_time -= JN516X_SLEEP_GUARD_TIME; - /* bound the sleep time to 1 second */ - max_sleep_time = MIN(max_sleep_time, JN516X_MAX_SLEEP_TIME); - -#if !RTIMER_USE_32KHZ - /* convert to 32.768 kHz oscillator ticks */ - max_sleep_time = (uint64_t)max_sleep_time * JN516X_XOSC_SECOND / RTIMER_SECOND; -#endif - vAHI_WakeTimerEnable(WAKEUP_TIMER, TRUE); - /* sync with the tick timer */ - WAIT_FOR_EDGE(sleep_start); - sleep_start_ticks = u32AHI_TickTimerRead(); - - vAHI_WakeTimerStartLarge(WAKEUP_TIMER, max_sleep_time); - ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_EXTRA_LPM); - vAHI_Sleep(E_AHI_SLEEP_OSCON_RAMON); - } else { -#else - { -#endif /* JN516X_SLEEP_ENABLED */ - clock_arch_schedule_interrupt(time_to_etimer, ticks_to_rtimer); - ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM); - vAHI_CpuDoze(); - watchdog_start(); - ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU); - } -} -/*---------------------------------------------------------------------------*/ -void -platform_main_loop(void) -{ - int r; - - while(1) { - do { - /* Reset watchdog. */ - watchdog_periodic(); - r = process_run(); - } while(r > 0); - /* - * Idle processing. - */ - platform_idle(); - } -} -/*---------------------------------------------------------------------------*/ -void -AppColdStart(void) -{ - /* After reset or sleep with memory off */ - main(); -} -/*---------------------------------------------------------------------------*/ -void -AppWarmStart(void) -{ - /* Wakeup after sleep with memory on. - * Need to initialize devices but not the application state. - * Note: the actual time this function is called is - * ~8 ticks (32kHz timer) later than the scheduled sleep end time. - */ - uint32_t sleep_ticks; - uint64_t sleep_end; - rtimer_clock_t sleep_ticks_rtimer; - - clock_arch_calibrate(); - leds_init(); - uart0_init(UART_BAUD_RATE); /* Must come before first PRINTF */ - NETSTACK_RADIO.init(); - watchdog_init(); - watchdog_stop(); - - WAIT_FOR_EDGE(sleep_end); - sleep_ticks = (uint32_t)(sleep_start - sleep_end) + 1; - -#if RTIMER_USE_32KHZ - sleep_ticks_rtimer = sleep_ticks; -#else - { - static uint32_t remainder; - uint64_t t = (uint64_t)sleep_ticks * RTIMER_SECOND + remainder; - sleep_ticks_rtimer = (uint32_t)(t / JN516X_XOSC_SECOND); - remainder = t - sleep_ticks_rtimer * JN516X_XOSC_SECOND; - } -#endif - - /* reinitialize rtimers */ - rtimer_arch_reinit(sleep_start_ticks, sleep_ticks_rtimer); - - ENERGEST_SWITCH(ENERGEST_TYPE_EXTRA_LPM, ENERGEST_TYPE_CPU); - - watchdog_start(); - - /* reinitialize clock */ - clock_arch_init(1); - /* schedule etimer interrupt */ - clock_arch_schedule_interrupt(clock_arch_time_to_etimer(), rtimer_arch_time_to_rtimer()); - -#if DCOSYNCH_CONF_ENABLED - /* The radio is recalibrated on wakeup */ - last_dco_calibration_time = clock_seconds(); -#endif - - platform_main_loop(); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/jn516x/slip.c b/arch/platform/jn516x/slip.c deleted file mode 100644 index 41652e181..000000000 --- a/arch/platform/jn516x/slip.c +++ /dev/null @@ -1,429 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Alternative implementation for SLIP: - * 1. Accepts more than two packet - * 2. Disables UART rx interrupt when buffer is full - * (thus invoking flow control if configured) - * \author - * Niklas Finne - * Beshr Al Nahas - * - */ - -#include "contiki.h" - -#include -#include "net/ipv6/uip.h" - -#include "dev/slip.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#define PUTCHAR(X) do { putchar(X); putchar('\n'); } while(0) -#else -#define PRINTF(...) do {} while(0) -#define PUTCHAR(X) do {} while(0) -#endif - -#define SLIP_END 0300 -#define SLIP_ESC 0333 -#define SLIP_ESC_END 0334 -#define SLIP_ESC_ESC 0335 -#define SLIP_NEUTRAL 0 /* means: none of the above */ -#define SLIP_ESC_XON 0336 -#define SLIP_ESC_XOFF 0337 -#define XON ((unsigned char)17) -#define XOFF ((unsigned char)19) -#if UART_XONXOFF_FLOW_CTRL -volatile unsigned char xonxoff_state = XON; -#endif /* UART_XONXOFF_FLOW_CTRL */ - -PROCESS(slip_process, "SLIP driver"); - -#include "dev/uart0.h" -#define STORE_UART_INTERRUPTS uart0_store_interrupts -#define RESTORE_UART_INTERRUPTS uart0_restore_interrupts -#define DISABLE_UART_INTERRUPTS uart0_disable_interrupts -#define ENABLE_UART_INTERRUPTS uart0_enable_interrupts - -/** - * @brief A block of code may be made atomic by wrapping it with this - * macro. Something which is atomic cannot be interrupted by interrupts. - */ -/* A specific ATMOIC that disables UART interrupts only */ -#define ATOMIC(blah) \ - { \ - /* STORE_UART_INTERRUPTS(); */ \ - DISABLE_UART_INTERRUPTS(); \ - { blah } \ - /* RESTORE_UART_INTERRUPTS(); */ \ - ENABLE_UART_INTERRUPTS(); \ - } - -/* A generic ATMOIC that disables all interrupts */ -#define GLOBAL_ATOMIC(blah) \ - { \ - MICRO_DISABLE_INTERRUPTS(); \ - { blah } \ - MICRO_ENABLE_INTERRUPTS(); \ - } - -#if 1 -#define SLIP_STATISTICS(statement) -#else -uint16_t slip_drop_bytes, slip_overflow, slip_error_drop; -/* No used in this file */ -uint16_t slip_rubbish, slip_twopackets, slip_ip_drop; -unsigned long slip_received, slip_frames; -#define SLIP_STATISTICS(statement) statement -#endif - -/* Must be at least one byte larger than UIP_BUFSIZE (for SLIP_END)! */ -#ifdef SLIP_CONF_RX_BUFSIZE -#define RX_BUFSIZE SLIP_CONF_RX_BUFSIZE - -#if RX_BUFSIZE < (UIP_BUFSIZE + 16) -#error "SLIP_CONF_RX_BUFSIZE too small for UIP_BUFSIZE" -#endif - -#else -#define RX_BUFSIZE (UIP_CONF_BUFFER_SIZE * 2) -#endif - -/* - * Variables begin and end manage the buffer space in a cyclic - * fashion. The first used byte is at begin and end is one byte past - * the last. I.e. [begin, end) is the actively used space. - */ - -static volatile uint16_t begin, end, end_counter; -static uint8_t rxbuf[RX_BUFSIZE]; -static volatile uint8_t is_dropping = 0; -static volatile uint8_t is_full = 0; - -static void (*input_callback)(void) = NULL; -/*---------------------------------------------------------------------------*/ -void -slip_set_input_callback(void (*c)(void)) -{ - input_callback = c; -} -static void -slip_write_char(uint8_t c) -{ - /* Escape SLIP control characters */ - if(c == SLIP_END) { - slip_arch_writeb(SLIP_ESC); - c = SLIP_ESC_END; - } else if(c == SLIP_ESC) { - slip_arch_writeb(SLIP_ESC); - c = SLIP_ESC_ESC; - } -#if UART_XONXOFF_FLOW_CTRL - /* Escape XON/XOFF characters */ - else if(c == XON) { - slip_arch_writeb(SLIP_ESC); - c = SLIP_ESC_XON; - } else if(c == XOFF) { - slip_arch_writeb(SLIP_ESC); - c = SLIP_ESC_XOFF; - } -#endif /* UART_XONXOFF_FLOW_CTRL */ - slip_arch_writeb(c); -} -/*---------------------------------------------------------------------------*/ -void -slip_write(const void *_ptr, int len) -{ - const uint8_t *ptr = _ptr; - uint16_t i; - uint8_t c; - - slip_arch_writeb(SLIP_END); - - for(i = 0; i < len; ++i) { - c = *ptr++; - slip_write_char(c); - } - slip_arch_writeb(SLIP_END); -} -/*---------------------------------------------------------------------------*/ -/* slip_send: forward (IPv4) packets with {UIP_FW_NETIF(..., slip_send)} - * was used in slip-bridge.c - */ -void -slip_send(void) -{ - uint16_t i; - uint8_t *ptr; - uint8_t c; - - slip_arch_writeb(SLIP_END); - - ptr = uip_buf; - for(i = 0; i < uip_len; ++i) { - c = *ptr++; - slip_write_char(c); - } - slip_arch_writeb(SLIP_END); -} -/*---------------------------------------------------------------------------*/ -static void -rxbuf_init(void) -{ - begin = end = end_counter = 0; - is_dropping = 0; -} -/*---------------------------------------------------------------------------*/ -/* Upper half does the polling. */ -static uint16_t -slip_poll_handler(uint8_t *outbuf, uint16_t blen) -{ - uint16_t len; - uint16_t pos; - uint8_t c; - uint8_t state; - - if(end_counter == 0 && is_full == 0) { - return 0; - } - for(len = 0, pos = begin, state = c = SLIP_NEUTRAL; - len < blen + 1; /* +1 for SLIP_END! */ - ) { - - c = rxbuf[pos++]; - - if(pos == RX_BUFSIZE) { - /* Circular buffer: warp around */ - pos = 0; - } - if(c == SLIP_END) { - /* End of packet */ - break; - } - if(len >= blen) { - /* End of buffer with no SLIP_END - * ==> something wrong happened */ - break; - } - switch(c) { - case SLIP_ESC: - state = SLIP_ESC; - break; - case SLIP_ESC_END: - if(state == SLIP_ESC) { - outbuf[len++] = SLIP_END; - state = SLIP_NEUTRAL; - } else { - outbuf[len++] = c; - } break; - case SLIP_ESC_ESC: - if(state == SLIP_ESC) { - outbuf[len++] = SLIP_ESC; - state = SLIP_NEUTRAL; - } else { - outbuf[len++] = c; - } break; -#if UART_XONXOFF_FLOW_CTRL - case SLIP_ESC_XON: - if(state == SLIP_ESC) { - outbuf[len++] = XON; - state = SLIP_NEUTRAL; - } else { - outbuf[len++] = c; - } break; - case SLIP_ESC_XOFF: - if(state == SLIP_ESC) { - outbuf[len++] = XOFF; - state = SLIP_NEUTRAL; - } else { - outbuf[len++] = c; - } break; -#endif /* UART_XONXOFF_FLOW_CTRL */ - default: - outbuf[len++] = c; - state = SLIP_NEUTRAL; - break; - } - } - - /* Update counters */ - if(c == SLIP_END) { - ATOMIC(begin = pos; - if(end_counter) { - end_counter--; - } - ) - PUTCHAR('P'); - } else { - /* Something went wrong, no SLIP_END found, drop everything */ - ATOMIC(rxbuf_init(); - is_dropping = 1; - ) - SLIP_STATISTICS(slip_error_drop++); - len = 0; - PRINTF("SLIP: *** out of sync!\n"); - } - - if(end_counter > 0) { - /* One more packet is buffered, need to be polled again! */ - process_poll(&slip_process); - } - return len; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(slip_process, ev, data) -{ - PROCESS_BEGIN(); - - rxbuf_init(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - - /* Move packet from rxbuf to buffer provided by uIP. */ - uip_len = slip_poll_handler(uip_buf, UIP_BUFSIZE); - - PRINTF("SLIP: recv bytes %u frames RECV: %u. is_full %u, is_dropping %u.\n", - end_counter, uip_len, is_full, is_dropping); - - /* We have free space now, resume slip RX */ - if(is_full) { - is_full = 0; - ENABLE_UART_INTERRUPTS(); - } - - if(uip_len > 0) { - if(input_callback) { - input_callback(); - } -#ifdef SLIP_CONF_TCPIP_INPUT - SLIP_CONF_TCPIP_INPUT(); -#else - tcpip_input(); -#endif - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/* Return status from slip_input_byte: - * -1 means RX buffer overflow ==> stop reading - * 0 means do not exit power saving mode - * 1 means exit power saving mode - **/ -int -slip_input_byte(unsigned char c) -{ - static int in_frame = 0; - uint16_t next, next_next; - int error_return_code = is_full ? -1 : 0; - int success_return_code = is_full ? -1 : 1; - - SLIP_STATISTICS(slip_received++); - -#if UART_XONXOFF_FLOW_CTRL - if(c == XOFF || c == XON) { - xonxoff_state = c; - return 1; - } else { - /* ANY char would be XON */ - xonxoff_state = XON; - } -#endif /* UART_XONXOFF_FLOW_CTRL */ - - if(is_dropping) { - /* Make sure to drop full frames when overflow or - * out of sync happens */ - if(c != SLIP_END) { - SLIP_STATISTICS(slip_drop_bytes++); - } else { - is_dropping = 0; - in_frame = 0; - } - return error_return_code; - } - - if(!in_frame && c == SLIP_END) { - /* Ignore slip end when not receiving frame */ - return error_return_code; - /* increment and wrap */ - } - next = end + 1; - if(next >= RX_BUFSIZE) { - next = 0; - } - next_next = next + 1; - if(next_next >= RX_BUFSIZE) { - next_next = 0; - /* Next byte will overflow. Stop accepting. */ - } - if(next_next == begin) { - is_full = 1; - /* disable UART interrupts */ - DISABLE_UART_INTERRUPTS(); - process_poll(&slip_process); - } - - /* Buffer is full. We can't store anymore. - * Shall not happen normally, - * because of overflow protection above. */ - if(next == begin) { - is_dropping = 1; - SLIP_STATISTICS(slip_overflow++); - is_full = 1; - /* disable UART interrupts */ - DISABLE_UART_INTERRUPTS(); - process_poll(&slip_process); - return -1; - } - - rxbuf[end] = c; - end = next; - in_frame = 1; - - if(c == SLIP_END) { - in_frame = 0; - end_counter++; - SLIP_STATISTICS(slip_frames++); - process_poll(&slip_process); - return success_return_code; - } - return error_return_code; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/native/Makefile.native b/arch/platform/native/Makefile.native deleted file mode 100644 index 51681284e..000000000 --- a/arch/platform/native/Makefile.native +++ /dev/null @@ -1,32 +0,0 @@ -ifndef CONTIKI - $(error CONTIKI not defined! You must specify where CONTIKI resides!) -endif - - -CONTIKI_TARGET_DIRS = . dev -CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o} - -CONTIKI_TARGET_SOURCEFILES += platform.c clock.c xmem.c -CONTIKI_TARGET_SOURCEFILES += cfs-posix.c cfs-posix-dir.c buttons.c - -ifeq ($(HOST_OS),Windows) -CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c -TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a -else -CONTIKI_TARGET_SOURCEFILES += tun6-net.c -endif - -ifeq ($(HOST_OS),Linux) -TARGET_LIBFILES += -lrt -endif - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -.SUFFIXES: - -# Enable nullmac by default -MAKE_MAC ?= MAKE_MAC_NULLMAC - -### Define the CPU directory -CONTIKI_CPU=$(ARCH_PATH)/cpu/native -include $(ARCH_PATH)/cpu/native/Makefile.native diff --git a/arch/platform/native/cfs-coffee-arch.h b/arch/platform/native/cfs-coffee-arch.h deleted file mode 100644 index db468ea7c..000000000 --- a/arch/platform/native/cfs-coffee-arch.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Coffee architecture-dependent header for the native platform. - * \author - * Nicolas Tsiftes - */ - -#ifndef CFS_COFFEE_ARCH_H -#define CFS_COFFEE_ARCH_H - -#include "contiki.h" -#include "dev/xmem.h" - -#define COFFEE_SECTOR_SIZE 65536UL -#define COFFEE_PAGE_SIZE 256UL -#define COFFEE_START 0 -#define COFFEE_SIZE ((1024UL * 1024UL) - COFFEE_START) -#define COFFEE_NAME_LENGTH 16 -#define COFFEE_DYN_SIZE 16384 -#define COFFEE_MAX_OPEN_FILES 6 -#define COFFEE_FD_SET_SIZE 8 -#define COFFEE_LOG_DIVISOR 4 -#define COFFEE_LOG_SIZE 8192 -#define COFFEE_LOG_TABLE_LIMIT 256 -#define COFFEE_MICRO_LOGS 0 - -#define COFFEE_WRITE(buf, size, offset) \ - xmem_pwrite((char *)(buf), (size), COFFEE_START + (offset)) - -#define COFFEE_READ(buf, size, offset) \ - xmem_pread((char *)(buf), (size), COFFEE_START + (offset)) - -#define COFFEE_ERASE(sector) \ - xmem_erase(COFFEE_SECTOR_SIZE, COFFEE_START + (sector) * COFFEE_SECTOR_SIZE) - -#define READ_HEADER(hdr, page) \ - COFFEE_READ((hdr), sizeof (*hdr), (page) * COFFEE_PAGE_SIZE) - -#define WRITE_HEADER(hdr, page) \ - COFFEE_WRITE((hdr), sizeof (*hdr), (page) * COFFEE_PAGE_SIZE) - -/* Coffee types. */ -typedef int16_t coffee_page_t; - -#endif /* !COFFEE_ARCH_H */ diff --git a/arch/platform/native/cfs-posix-dir.c b/arch/platform/native/cfs-posix-dir.c deleted file mode 100644 index 623471b29..000000000 --- a/arch/platform/native/cfs-posix-dir.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -#include -#include -#include - -#define CFS_IMPL 1 -#include "cfs/cfs.h" - -struct cfs_posix_dir { - DIR *dirp; -}; - -/*---------------------------------------------------------------------------*/ -int -cfs_opendir(struct cfs_dir *p, const char *n) -{ - struct cfs_posix_dir *dir = (struct cfs_posix_dir *)p; - - dir->dirp = opendir(n); - return dir->dirp == NULL; -} -/*---------------------------------------------------------------------------*/ -int -cfs_readdir(struct cfs_dir *p, struct cfs_dirent *e) -{ - struct cfs_posix_dir *dir = (struct cfs_posix_dir *)p; - struct dirent *res; - - if(dir->dirp == NULL) { - return -1; - } - res = readdir(dir->dirp); - if(res == NULL) { - return -1; - } - strncpy(e->name, res->d_name, sizeof(e->name)); -#if defined(__APPLE2__) || defined(__CBM__) - e->size = res->d_blocks; -#else /* __APPLE2__ || __CBM__ */ - e->size = 0; -#endif /* __APPLE2__ || __CBM__ */ - return 0; -} -/*---------------------------------------------------------------------------*/ -void -cfs_closedir(struct cfs_dir *p) -{ - struct cfs_posix_dir *dir = (struct cfs_posix_dir *)p; - - if(dir->dirp != NULL) { - closedir(dir->dirp); - } -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/native/cfs-posix.c b/arch/platform/native/cfs-posix.c deleted file mode 100644 index 452ddbbbb..000000000 --- a/arch/platform/native/cfs-posix.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -#include -#include -#ifdef _MSC_VER -#include -#else -#include -#endif - -#define CFS_IMPL 1 -#include "cfs/cfs.h" - -/*---------------------------------------------------------------------------*/ -int -cfs_open(const char *n, int f) -{ - int s = 0; - if(f == CFS_READ) { - return open(n, O_RDONLY); - } else if(f & CFS_WRITE) { - s = O_CREAT; - if(f & CFS_READ) { - s |= O_RDWR; - } else { - s |= O_WRONLY; - } - if(f & CFS_APPEND) { - s |= O_APPEND; - } else { - s |= O_TRUNC; - } - return open(n, s, 0600); - } - return -1; -} -/*---------------------------------------------------------------------------*/ -void -cfs_close(int f) -{ - close(f); -} -/*---------------------------------------------------------------------------*/ -int -cfs_read(int f, void *b, unsigned int l) -{ - return read(f, b, l); -} -/*---------------------------------------------------------------------------*/ -int -cfs_write(int f, const void *b, unsigned int l) -{ - return write(f, b, l); -} -/*---------------------------------------------------------------------------*/ -cfs_offset_t -cfs_seek(int f, cfs_offset_t o, int w) -{ - if(w == CFS_SEEK_SET) { - w = SEEK_SET; - } else if(w == CFS_SEEK_CUR) { - w = SEEK_CUR; - } else if(w == CFS_SEEK_END) { - w = SEEK_END; - } else { - return (cfs_offset_t)-1; - } - return lseek(f, o, w); -} -/*---------------------------------------------------------------------------*/ -int -cfs_remove(const char *name) -{ - return remove(name); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/native/clock.c b/arch/platform/native/clock.c deleted file mode 100644 index 3b94f3d4f..000000000 --- a/arch/platform/native/clock.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Clock implementation for Unix. - * \author - * Adam Dunkels - */ - -#include "sys/clock.h" -#include -#include - -/*---------------------------------------------------------------------------*/ -typedef struct clock_timespec_s { - time_t tv_sec; - long tv_nsec; -} clock_timespec_t; -/*---------------------------------------------------------------------------*/ -static void -get_time(clock_timespec_t *spec) -{ -#if defined(__linux__) || (defined(__MACH__) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) - struct timespec ts; - - clock_gettime(CLOCK_MONOTONIC, &ts); - - spec->tv_sec = ts.tv_sec; - spec->tv_nsec = ts.tv_nsec; -#else - struct timeval tv; - - gettimeofday(&tv, NULL); - - spec->tv_sec = tv.tv_sec; - spec->tv_nsec = tv.tv_usec * 1000; -#endif -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - clock_timespec_t ts; - - get_time(&ts); - - return ts.tv_sec * CLOCK_SECOND + ts.tv_nsec / (1000000000 / CLOCK_SECOND); -} -/*---------------------------------------------------------------------------*/ -unsigned long -clock_seconds(void) -{ - clock_timespec_t ts; - - get_time(&ts); - - return ts.tv_sec; -} -/*---------------------------------------------------------------------------*/ -void -clock_delay(unsigned int d) -{ - /* Does not do anything. */ -} -/*---------------------------------------------------------------------------*/ -void -clock_init(void) -{ - /* Provide this function, required by main() */ - return; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/native/contiki-conf.h b/arch/platform/native/contiki-conf.h deleted file mode 100644 index e8177d7b2..000000000 --- a/arch/platform/native/contiki-conf.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef CONTIKI_CONF_H_ -#define CONTIKI_CONF_H_ - -/* include the project config */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif /* PROJECT_CONF_PATH */ -/*---------------------------------------------------------------------------*/ -#include "native-def.h" -/*---------------------------------------------------------------------------*/ -#include -#ifndef WIN32_LEAN_AND_MEAN -#include -#endif - -struct select_callback { - int (* set_fd)(fd_set *fdr, fd_set *fdw); - void (* handle_fd)(fd_set *fdr, fd_set *fdw); -}; -int select_set_callback(int fd, const struct select_callback *callback); - -#define CC_CONF_REGISTER_ARGS 1 -#define CC_CONF_FUNCTION_POINTER_ARGS 1 -#define CC_CONF_VA_ARGS 1 -/*#define CC_CONF_INLINE inline*/ - -#ifndef EEPROM_CONF_SIZE -#define EEPROM_CONF_SIZE 1024 -#endif - -typedef unsigned int uip_stats_t; - -#ifndef UIP_CONF_BYTE_ORDER -#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN -#endif - -#if NETSTACK_CONF_WITH_IPV6 - -#ifndef NETSTACK_CONF_NETWORK -#define NETSTACK_CONF_NETWORK tun6_net_driver -#endif - -#ifndef NETSTACK_CONF_RADIO -#define NETSTACK_CONF_RADIO nullradio_driver -#endif /* NETSTACK_CONF_RADIO */ - -#define NETSTACK_CONF_LINUXRADIO_DEV "wpan0" - -/* configure network size and density */ -#ifndef NETSTACK_MAX_ROUTE_ENTRIES -#define NETSTACK_MAX_ROUTE_ENTRIES 300 -#endif /* NETSTACK_MAX_ROUTE_ENTRIES */ -#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS -#define NBR_TABLE_CONF_MAX_NEIGHBORS 300 -#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ - -/* configure queues */ -#ifndef QUEUEBUF_CONF_NUM -#define QUEUEBUF_CONF_NUM 64 -#endif /* QUEUEBUF_CONF_NUM */ - -#define UIP_CONF_IPV6_QUEUE_PKT 1 -#define UIP_ARCH_IPCHKSUM 1 - -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -#include - -typedef unsigned long clock_time_t; - -#define CLOCK_CONF_SECOND 1000 - -#define LOG_CONF_ENABLED 1 - -#define PLATFORM_SUPPORTS_BUTTON_HAL 1 - -/* Not part of C99 but actually present */ -int strcasecmp(const char*, const char*); - -#define PLATFORM_CONF_PROVIDES_MAIN_LOOP 1 -#define PLATFORM_CONF_MAIN_ACCEPTS_ARGS 1 -#define PLATFORM_CONF_SUPPORTS_STACK_CHECK 0 - -#endif /* CONTIKI_CONF_H_ */ diff --git a/arch/platform/native/dev/buttons.c b/arch/platform/native/dev/buttons.c deleted file mode 100644 index 359f7a409..000000000 --- a/arch/platform/native/dev/buttons.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/button-hal.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -button_hal_button_t *button_hal_buttons[] = { NULL }; -const uint8_t button_hal_button_count = 0; -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/native/dev/xmem.c b/arch/platform/native/dev/xmem.c deleted file mode 100644 index bc0deceb7..000000000 --- a/arch/platform/native/dev/xmem.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -#include "contiki.h" -#include "dev/xmem.h" - -#include -#include -#include -#include -#include - -#define XMEM_SIZE 1024 * 1024 - -static unsigned char xmem[XMEM_SIZE]; -/*---------------------------------------------------------------------------*/ -int -xmem_pwrite(const void *buf, int size, unsigned long offset) -{ - /* int f; - char name[400]; - - snprintf(name, sizeof(name), "xmem.%d.%d", node_x(), node_y()); - f = open(name, O_WRONLY | O_APPEND | O_CREAT, 0644); - lseek(f, addr, SEEK_SET); - write(f, buf, size); - close(f);*/ - - /* printf("xmem_write(offset 0x%02x, buf %p, size %l);\n", offset, buf, size);*/ - - memcpy(&xmem[offset], buf, size); - return size; -} -/*---------------------------------------------------------------------------*/ -int -xmem_pread(void *buf, int size, unsigned long offset) -{ - /* printf("xmem_read(addr 0x%02x, buf %p, size %d);\n", addr, buf, size);*/ - memcpy(buf, &xmem[offset], size); - return size; -} -/*---------------------------------------------------------------------------*/ -int -xmem_erase(long nbytes, unsigned long offset) -{ - /* printf("xmem_read(addr 0x%02x, buf %p, size %d);\n", addr, buf, size);*/ - memset(&xmem[offset], 0, nbytes); - return nbytes; -} -/*---------------------------------------------------------------------------*/ -void -xmem_init(void) -{ - -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/native/doxygen-group.txt b/arch/platform/native/doxygen-group.txt deleted file mode 100644 index 705d2b8fa..000000000 --- a/arch/platform/native/doxygen-group.txt +++ /dev/null @@ -1,4 +0,0 @@ -/** - * \defgroup native_platform Native platform - * \ingroup platform - */ diff --git a/arch/platform/native/platform.c b/arch/platform/native/platform.c deleted file mode 100644 index b2c25e223..000000000 --- a/arch/platform/native/platform.c +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki OS - * - */ - -/** - * \ingroup platform - * - * \defgroup native_platform Native platform - * - * Platform running in the host (Windows or Linux) environment. - * - * Used mainly for development and debugging. - * @{ - */ - -#include -#include -#include -#include -#include - -#ifdef __CYGWIN__ -#include "net/wpcap-drv.h" -#endif /* __CYGWIN__ */ - -#include "contiki.h" -#include "net/netstack.h" - -#include "dev/serial-line.h" -#include "dev/button-hal.h" -#include "dev/gpio-hal.h" -#include "dev/leds.h" - -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-debug.h" -#include "net/queuebuf.h" - -#if NETSTACK_CONF_WITH_IPV6 -#include "net/ipv6/uip-ds6.h" -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Native" -#define LOG_LEVEL LOG_LEVEL_MAIN - -/*---------------------------------------------------------------------------*/ -/** - * \name Native Platform Configuration - * - * @{ - */ - -/* - * Defines the maximum number of file descriptors monitored by the platform - * main loop. - */ -#ifdef SELECT_CONF_MAX -#define SELECT_MAX SELECT_CONF_MAX -#else -#define SELECT_MAX 8 -#endif - -/* - * Defines the timeout (in msec) of the select operation if no monitored file - * descriptors becomes ready. - */ -#ifdef SELECT_CONF_TIMEOUT -#define SELECT_TIMEOUT SELECT_CONF_TIMEOUT -#else -#define SELECT_TIMEOUT 1000 -#endif - -/* - * Adds the STDIN file descriptor to the list of monitored file descriptors. - */ -#ifdef SELECT_CONF_STDIN -#define SELECT_STDIN SELECT_CONF_STDIN -#else -#define SELECT_STDIN 1 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ - -static const struct select_callback *select_callback[SELECT_MAX]; -static int select_max = 0; - -#ifdef PLATFORM_CONF_MAC_ADDR -static uint8_t mac_addr[] = PLATFORM_CONF_MAC_ADDR; -#else /* PLATFORM_CONF_MAC_ADDR */ -static uint8_t mac_addr[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; -#endif /* PLATFORM_CONF_MAC_ADDR */ - -/*---------------------------------------------------------------------------*/ -int -select_set_callback(int fd, const struct select_callback *callback) -{ - int i; - if(fd >= 0 && fd < SELECT_MAX) { - /* Check that the callback functions are set */ - if(callback != NULL && - (callback->set_fd == NULL || callback->handle_fd == NULL)) { - callback = NULL; - } - - select_callback[fd] = callback; - - /* Update fd max */ - if(callback != NULL) { - if(fd > select_max) { - select_max = fd; - } - } else { - select_max = 0; - for(i = SELECT_MAX - 1; i > 0; i--) { - if(select_callback[i] != NULL) { - select_max = i; - break; - } - } - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -#if SELECT_STDIN -static int -stdin_set_fd(fd_set *rset, fd_set *wset) -{ - FD_SET(STDIN_FILENO, rset); - return 1; -} -static void -stdin_handle_fd(fd_set *rset, fd_set *wset) -{ - char c; - if(FD_ISSET(STDIN_FILENO, rset)) { - if(read(STDIN_FILENO, &c, 1) > 0) { - serial_line_input_byte(c); - } - } -} -const static struct select_callback stdin_fd = { - stdin_set_fd, stdin_handle_fd -}; -#endif /* SELECT_STDIN */ -/*---------------------------------------------------------------------------*/ -static void -set_lladdr(void) -{ - linkaddr_t addr; - - memset(&addr, 0, sizeof(linkaddr_t)); -#if NETSTACK_CONF_WITH_IPV6 - memcpy(addr.u8, mac_addr, sizeof(addr.u8)); -#else - int i; - for(i = 0; i < sizeof(linkaddr_t); ++i) { - addr.u8[i] = mac_addr[7 - i]; - } -#endif - linkaddr_set_node_addr(&addr); -} -/*---------------------------------------------------------------------------*/ -#if NETSTACK_CONF_WITH_IPV6 -static void -set_global_address(void) -{ - uip_ipaddr_t ipaddr; - const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix(); - - /* Assign a unique local address (RFC4193, - http://tools.ietf.org/html/rfc4193). */ - uip_ip6addr_copy(&ipaddr, default_prefix); - - /* Assumes that the uip_lladdr is set */ - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - - LOG_INFO("Added global IPv6 address "); - LOG_INFO_6ADDR(&ipaddr); - LOG_INFO_("\n"); - - /* set the PREFIX::1 address to the IF */ - uip_ip6addr_copy(&ipaddr, default_prefix); - ipaddr.u8[15] = 1; - uip_ds6_defrt_add(&ipaddr, 0); -} -#endif -/*---------------------------------------------------------------------------*/ -int contiki_argc = 0; -char **contiki_argv; -/*---------------------------------------------------------------------------*/ -void -platform_process_args(int argc, char**argv) -{ - /* crappy way of remembering and accessing argc/v */ - contiki_argc = argc; - contiki_argv = argv; - - /* native under windows is hardcoded to use the first one or two args */ - /* for wpcap configuration so this needs to be "removed" from */ - /* contiki_args (used by the native-border-router) */ -#ifdef __CYGWIN__ - contiki_argc--; - contiki_argv++; -#ifdef UIP_FALLBACK_INTERFACE - contiki_argc--; - contiki_argv++; -#endif -#endif -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one() -{ - gpio_hal_init(); - button_hal_init(); - leds_init(); - return; -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two() -{ - set_lladdr(); - serial_line_init(); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three() -{ -#if NETSTACK_CONF_WITH_IPV6 -#ifdef __CYGWIN__ - process_start(&wpcap_process, NULL); -#endif - - set_global_address(); - -#endif /* NETSTACK_CONF_WITH_IPV6 */ - - /* Make standard output unbuffered. */ - setvbuf(stdout, (char *)NULL, _IONBF, 0); -} -/*---------------------------------------------------------------------------*/ -void -platform_main_loop() -{ -#if SELECT_STDIN - select_set_callback(STDIN_FILENO, &stdin_fd); -#endif /* SELECT_STDIN */ - while(1) { - fd_set fdr; - fd_set fdw; - int maxfd; - int i; - int retval; - struct timeval tv; - - retval = process_run(); - - tv.tv_sec = 0; - tv.tv_usec = retval ? 1 : SELECT_TIMEOUT; - - FD_ZERO(&fdr); - FD_ZERO(&fdw); - maxfd = 0; - for(i = 0; i <= select_max; i++) { - if(select_callback[i] != NULL && select_callback[i]->set_fd(&fdr, &fdw)) { - maxfd = i; - } - } - - retval = select(maxfd + 1, &fdr, &fdw, NULL, &tv); - if(retval < 0) { - if(errno != EINTR) { - perror("select"); - } - } else if(retval > 0) { - /* timeout => retval == 0 */ - for(i = 0; i <= maxfd; i++) { - if(select_callback[i] != NULL) { - select_callback[i]->handle_fd(&fdr, &fdw); - } - } - } - - etimer_request_poll(); - } - - return; -} -/*---------------------------------------------------------------------------*/ -void -log_message(char *m1, char *m2) -{ - fprintf(stderr, "%s%s\n", m1, m2); -} -/*---------------------------------------------------------------------------*/ -void -uip_log(char *m) -{ - fprintf(stderr, "%s\n", m); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/nrf52dk/Makefile.nrf52dk b/arch/platform/nrf52dk/Makefile.nrf52dk deleted file mode 100644 index ff554b35c..000000000 --- a/arch/platform/nrf52dk/Makefile.nrf52dk +++ /dev/null @@ -1,25 +0,0 @@ -ifndef CONTIKI - $(error CONTIKI not defined! You must specify where CONTIKI resides!) -endif - -### Include the board-specific makefile -PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET) - -CONTIKI_TARGET_DIRS += . dev config -CONTIKI_SOURCEFILES += platform.c leds-arch.c nrf52dk-sensors.c button-sensor.c temperature-sensor.c - -ifeq ($(NRF52_USE_RTT),1) -### Suppress the existing debug I/O in os/lib -MAKE_WITH_LIB_DBG_IO = 0 -CONTIKI_TARGET_DIRS += rtt -CONTIKI_SOURCEFILES += rtt-printf.c segger-rtt.c segger-rtt-printf.c -else -CONTIKI_SOURCEFILES += dbg.c -endif - -### Unless the example dictates otherwise, build with code size optimisations switched off -SMALL ?= 0 - -### Define the CPU directory and pull in the correct CPU makefile. -CONTIKI_CPU=$(ARCH_PATH)/cpu/nrf52832 -include $(CONTIKI_CPU)/Makefile.nrf52832 diff --git a/arch/platform/nrf52dk/README-BLE-6LoWPAN.md b/arch/platform/nrf52dk/README-BLE-6LoWPAN.md deleted file mode 100644 index e4c9ef5f6..000000000 --- a/arch/platform/nrf52dk/README-BLE-6LoWPAN.md +++ /dev/null @@ -1,100 +0,0 @@ -This README contains information how to establish an IPv6 connecton between -Linux BLE router and an IPSP enabled BLE device. - -Prerequisites -============= -In general, any device capable of running Linux operating system, can be used -as a BLE router provided the following conditions are met: - -* Linux Kernel >3.18 is used -* bluez, libcap-ng0, radvd tools are present. - -If a built-in Bluetooth device is not available then Bluetooth 4.0 compatible -USB dongle can be used. - -The following procedures have been tested on Ubuntu 15.10. - -Establishing an IPv6 connection -=============================== -Use the following procedure to establish a connection between an nRF52 device -and Linux router: - -First enable 6LoWPAN module. This is neccessary only once per session: - - # Log in as a root user. - sudo su - - # Mount debugfs file system. - mount -t debugfs none /sys/kernel/debug - - # Load 6LoWPAN module. - modprobe bluetooth_6lowpan - - # Enable the bluetooth 6lowpan module. - echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable - - # Look for available HCI devices. - hciconfig - - # Reset HCI device - for example hci0 device. - hciconfig hci0 reset - - # Read 00:AA:BB:XX:YY:ZZ address of the nRF5x device. - hcitool lescan - -If you see device name and address in lescan output then you can connect to the -device: - - echo "connect 00:AA:BB:XX:YY:ZZ 1" > /sys/kernel/debug/bluetooth/6lowpan_control - -If above is successful then LED1 will stop blinking and LED2 will switch on. -You can then check the connection using the following commands: - - # Check if bt0 interface is present and up - ifconfig - - # Try to ping the device using its link-local address, for example, on bt0 interface. - ping6 -I bt0 fe80::2aa:bbff:fexx:yyzz - -If you'd like to learn more about the procedure please refer to -[Connecting devices to the router]. - -Distributing routable IPv6 prefix -================================= -In Linux, Router Advertisement Daemon (RADVD) can be used to distribute prefixes -in the network, hance configure routable IPv6 address. - -To configure RADVD create `/etc/radvd.conf` file and paste the following contents: - - interface bt0 - { - AdvSendAdvert on; - prefix 2001:db8::/64 - { - AdvOnLink off; - AdvAutonomous on; - AdvRouterAddr on; - }; - }; - -Next, start RADVD daemon: - - # Set IPv6 forwarding (must be present). - sudo echo 1 > /proc/sys/net/ipv6/conf/all/forwarding - # Run radvd daemon. - sudo service radvd restart - -If successfull then all devices connected to the host will receive -a routable `2001:db8` prefix. - -This can be verified by sending echo request to the full address: - - ping6 -I bt0 2001:db8::2aa:bbff:fexx:yyzz - -where `aa:bbff:fexx:yyzz` is device Bluetooth address. - -If you'd like to learn more about the procedure please refer to -[Distributing a global IPv6 prefix]. - -* [Connecting devices to the router]: http://developer.nordicsemi.com/nRF5_IoT_SDK/doc/0.9.0/html/a00089.html -* [Distributing a global IPv6 prefix]: http://developer.nordicsemi.com/nRF5_IoT_SDK/doc/0.9.0/html/a00090.html \ No newline at end of file diff --git a/arch/platform/nrf52dk/config/nrf_drv_config.h b/arch/platform/nrf52dk/config/nrf_drv_config.h deleted file mode 100644 index dd9e9b5de..000000000 --- a/arch/platform/nrf52dk/config/nrf_drv_config.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \addtogroup nrf52dk - * @{ - * - * \defgroup nrf52dk-config nRF52 SDK configuration - * @{ - */ - -#ifndef NRF_DRV_CONFIG_H -#define NRF_DRV_CONFIG_H - -/* CLOCK */ -#define CLOCK_CONFIG_XTAL_FREQ NRF_CLOCK_XTALFREQ_Default -#define CLOCK_CONFIG_LF_SRC NRF_CLOCK_LF_SRC_Xtal -#define CLOCK_CONFIG_LF_RC_CAL_INTERVAL RC_2000MS_CALIBRATION_INTERVAL -#define CLOCK_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW - -/* GPIOTE */ -#define GPIOTE_ENABLED 1 - -#if (GPIOTE_ENABLED == 1) -#define GPIOTE_CONFIG_USE_SWI_EGU false -#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH -#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 4 -#endif - -/* TIMER */ -#define TIMER0_ENABLED 0 - -#if (TIMER0_ENABLED == 1) -#define TIMER0_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER0_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER0_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_32Bit -#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW - -#define TIMER0_INSTANCE_INDEX 0 -#endif - -#define TIMER1_ENABLED 1 - -#if (TIMER1_ENABLED == 1) -#define TIMER1_CONFIG_FREQUENCY NRF_TIMER_FREQ_62500Hz -#define TIMER1_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER1_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_32Bit -#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW - -#define TIMER1_INSTANCE_INDEX (TIMER0_ENABLED) -#endif - -#define TIMER2_ENABLED 0 - -#if (TIMER2_ENABLED == 1) -#define TIMER2_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER2_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER2_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW - -#define TIMER2_INSTANCE_INDEX (TIMER1_ENABLED+TIMER0_ENABLED) -#endif - -#define TIMER3_ENABLED 0 - -#if (TIMER3_ENABLED == 1) -#define TIMER3_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER3_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER3_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW - -#define TIMER3_INSTANCE_INDEX (TIMER2_ENABLED+TIMER2_INSTANCE_INDEX) -#endif - -#define TIMER4_ENABLED 0 - -#if (TIMER4_ENABLED == 1) -#define TIMER4_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER4_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER4_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW - -#define TIMER4_INSTANCE_INDEX (TIMER3_ENABLED+TIMER3_INSTANCE_INDEX) -#endif - - -#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED) - -/* RTC */ -#define RTC0_ENABLED 0 - -#if (RTC0_ENABLED == 1) -#define RTC0_CONFIG_FREQUENCY 32678 -#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW -#define RTC0_CONFIG_RELIABLE false - -#define RTC0_INSTANCE_INDEX 0 -#endif - -#define RTC1_ENABLED 1 - -#if (RTC1_ENABLED == 1) -#define RTC1_CONFIG_FREQUENCY 128 -#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW -#define RTC1_CONFIG_RELIABLE false - -#define RTC1_INSTANCE_INDEX (RTC0_ENABLED) -#endif - -#define RTC_COUNT (RTC0_ENABLED+RTC1_ENABLED) - -#define NRF_MAXIMUM_LATENCY_US 2000 - -/* RNG */ -#define RNG_ENABLED 1 - -#if (RNG_ENABLED == 1) -#define RNG_CONFIG_ERROR_CORRECTION true -#define RNG_CONFIG_POOL_SIZE 8 -#define RNG_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW -#endif - -/* SPI */ -#define SPI0_ENABLED 0 - -#if (SPI0_ENABLED == 1) -#define SPI0_USE_EASY_DMA 0 - -#define SPI0_CONFIG_SCK_PIN 2 -#define SPI0_CONFIG_MOSI_PIN 3 -#define SPI0_CONFIG_MISO_PIN 4 -#define SPI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW - -#define SPI0_INSTANCE_INDEX 0 -#endif - -#define SPI1_ENABLED 0 - -#if (SPI1_ENABLED == 1) -#define SPI1_USE_EASY_DMA 0 - -#define SPI1_CONFIG_SCK_PIN 2 -#define SPI1_CONFIG_MOSI_PIN 3 -#define SPI1_CONFIG_MISO_PIN 4 -#define SPI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW - -#define SPI1_INSTANCE_INDEX (SPI0_ENABLED) -#endif - -#define SPI2_ENABLED 0 - -#if (SPI2_ENABLED == 1) -#define SPI2_USE_EASY_DMA 0 - -#define SPI2_CONFIG_SCK_PIN 2 -#define SPI2_CONFIG_MOSI_PIN 3 -#define SPI2_CONFIG_MISO_PIN 4 -#define SPI2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW - -#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED) -#endif - -#define SPI_COUNT (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED) - -/* UART */ -#define UART0_ENABLED 1 - -#if (UART0_ENABLED == 1) -#define UART0_CONFIG_HWFC NRF_UART_HWFC_DISABLED -#define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED -#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_115200 -#define UART0_CONFIG_PSEL_TXD 6 -#define UART0_CONFIG_PSEL_RXD 8 -#define UART0_CONFIG_PSEL_CTS 7 -#define UART0_CONFIG_PSEL_RTS 5 -#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW -#ifdef NRF52 -#define UART0_CONFIG_USE_EASY_DMA false -//Compile time flag -#define UART_EASY_DMA_SUPPORT 1 -#define UART_LEGACY_SUPPORT 1 -#endif //NRF52 -#endif - -#define TWI0_ENABLED 0 - -#if (TWI0_ENABLED == 1) -#define TWI0_CONFIG_FREQUENCY NRF_TWI_FREQ_100K -#define TWI0_CONFIG_SCL 0 -#define TWI0_CONFIG_SDA 1 -#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH - -#define TWI0_INSTANCE_INDEX 0 -#endif - -#define TWI1_ENABLED 0 - -#if (TWI1_ENABLED == 1) -#define TWI1_CONFIG_FREQUENCY NRF_TWI_FREQ_100K -#define TWI1_CONFIG_SCL 0 -#define TWI1_CONFIG_SDA 1 -#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH - -#define TWI1_INSTANCE_INDEX (TWI0_ENABLED) -#endif - -#define TWI_COUNT (TWI0_ENABLED+TWI1_ENABLED) - -/* TWIS */ -#define TWIS0_ENABLED 0 - -#if (TWIS0_ENABLED == 1) - #define TWIS0_CONFIG_ADDR0 0 - #define TWIS0_CONFIG_ADDR1 0 /* 0: Disabled */ - #define TWIS0_CONFIG_SCL 0 - #define TWIS0_CONFIG_SDA 1 - #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH - - #define TWIS0_INSTANCE_INDEX 0 -#endif - -#define TWIS1_ENABLED 0 - -#if (TWIS1_ENABLED == 1) - #define TWIS1_CONFIG_ADDR0 0 - #define TWIS1_CONFIG_ADDR1 0 /* 0: Disabled */ - #define TWIS1_CONFIG_SCL 0 - #define TWIS1_CONFIG_SDA 1 - #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH - - #define TWIS1_INSTANCE_INDEX (TWIS0_ENABLED) -#endif - -#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED) -/* For more documentation see nrf_drv_twis.h file */ -#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 -/* For more documentation see nrf_drv_twis.h file */ -#define TWIS_NO_SYNC_MODE 0 -/** - * \brief Definition for patching PAN problems - * - * Set this definition to nonzero value to patch anomalies - * from MPW3 - first lunch microcontroller. - * - * Concerns: - * - PAN-29: TWIS: incorrect bits in ERRORSRC - * - PAN-30: TWIS: STOP task does not work as expected - */ -#define NRF_TWIS_PATCH_FOR_MPW3 1 - - -/* QDEC */ -#define QDEC_ENABLED 0 - -#if (QDEC_ENABLED == 1) -#define QDEC_CONFIG_REPORTPER NRF_QDEC_REPORTPER_10 -#define QDEC_CONFIG_SAMPLEPER NRF_QDEC_SAMPLEPER_16384us -#define QDEC_CONFIG_PIO_A 1 -#define QDEC_CONFIG_PIO_B 2 -#define QDEC_CONFIG_PIO_LED 3 -#define QDEC_CONFIG_LEDPRE 511 -#define QDEC_CONFIG_LEDPOL NRF_QDEC_LEPOL_ACTIVE_HIGH -#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW -#define QDEC_CONFIG_DBFEN false -#define QDEC_CONFIG_SAMPLE_INTEN false -#endif - -/* SAADC */ -#define SAADC_ENABLED 0 - -#if (SAADC_ENABLED == 1) -#define SAADC_CONFIG_RESOLUTION NRF_SAADC_RESOLUTION_10BIT -#define SAADC_CONFIG_OVERSAMPLE NRF_SAADC_OVERSAMPLE_DISABLED -#define SAADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW -#endif - -/* LPCOMP */ -#define LPCOMP_ENABLED 0 - -#if (LPCOMP_ENABLED == 1) -#define LPCOMP_CONFIG_REFERENCE NRF_LPCOMP_REF_SUPPLY_4_8 -#define LPCOMP_CONFIG_DETECTION NRF_LPCOMP_DETECT_DOWN -#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW -#define LPCOMP_CONFIG_INPUT NRF_LPCOMP_INPUT_0 -#endif - -/* WDT */ -#define WDT_ENABLED 1 - -#if (WDT_ENABLED == 1) -#define WDT_CONFIG_BEHAVIOUR NRF_WDT_BEHAVIOUR_RUN_SLEEP -#define WDT_CONFIG_RELOAD_VALUE 2000 -#define WDT_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH -#endif - -#include "nrf_drv_config_validation.h" -#endif // NRF_DRV_CONFIG_H - -/** - * @} - * @} - */ diff --git a/arch/platform/nrf52dk/config/pstorage_platform.h b/arch/platform/nrf52dk/config/pstorage_platform.h deleted file mode 100644 index 3102b2097..000000000 --- a/arch/platform/nrf52dk/config/pstorage_platform.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - - /** @cond To make doxygen skip this file */ - -/** @file - * This header contains defines with respect persistent storage that are specific to - * persistent storage implementation and application use case. - */ -#ifndef PSTORAGE_PL_H__ -#define PSTORAGE_PL_H__ - -#include -#include "nrf.h" - -static __INLINE uint16_t pstorage_flash_page_size() -{ - return (uint16_t)NRF_FICR->CODEPAGESIZE; -} - -#define PSTORAGE_FLASH_PAGE_SIZE pstorage_flash_page_size() /**< Size of one flash page. */ -#define PSTORAGE_FLASH_EMPTY_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */ - -#ifdef NRF51 -#define BOOTLOADER_ADDRESS (NRF_UICR->BOOTLOADERADDR) -#elif defined NRF52 -#define BOOTLOADER_ADDRESS (PSTORAGE_FLASH_EMPTY_MASK) -#endif - -#define PSTORAGE_FLASH_PAGE_END \ - ((BOOTLOADER_ADDRESS != PSTORAGE_FLASH_EMPTY_MASK) \ - ? (BOOTLOADER_ADDRESS / PSTORAGE_FLASH_PAGE_SIZE) \ - : NRF_FICR->CODESIZE) - - -#define PSTORAGE_NUM_OF_PAGES 2 /**< Number of flash pages allocated for the pstorage module excluding the swap page, configurable based on system requirements. */ -#define PSTORAGE_MIN_BLOCK_SIZE 0x0010 /**< Minimum size of block that can be registered with the module. Should be configured based on system requirements, recommendation is not have this value to be at least size of word. */ - -#define PSTORAGE_DATA_START_ADDR ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_NUM_OF_PAGES - 1) \ - * PSTORAGE_FLASH_PAGE_SIZE) /**< Start address for persistent data, configurable according to system requirements. */ -#define PSTORAGE_DATA_END_ADDR ((PSTORAGE_FLASH_PAGE_END - 1) * PSTORAGE_FLASH_PAGE_SIZE) /**< End address for persistent data, configurable according to system requirements. */ -#define PSTORAGE_SWAP_ADDR PSTORAGE_DATA_END_ADDR /**< Top-most page is used as swap area for clear and update. */ - -#define PSTORAGE_MAX_BLOCK_SIZE PSTORAGE_FLASH_PAGE_SIZE /**< Maximum size of block that can be registered with the module. Should be configured based on system requirements. And should be greater than or equal to the minimum size. */ -#define PSTORAGE_CMD_QUEUE_SIZE 30 /**< Maximum number of flash access commands that can be maintained by the module for all applications. Configurable. */ - - -/** Abstracts persistently memory block identifier. */ -typedef uint32_t pstorage_block_t; - -typedef struct -{ - uint32_t module_id; /**< Module ID.*/ - pstorage_block_t block_id; /**< Block ID.*/ -} pstorage_handle_t; - -typedef uint16_t pstorage_size_t; /** Size of length and offset fields. */ - -/**\brief Handles Flash Access Result Events. To be called in the system event dispatcher of the application. */ -void pstorage_sys_event_handler (uint32_t sys_evt); - -#endif // PSTORAGE_PL_H__ - -/** @} */ -/** @endcond */ diff --git a/arch/platform/nrf52dk/contiki-conf.h b/arch/platform/nrf52dk/contiki-conf.h deleted file mode 100644 index 12d1b2fc9..000000000 --- a/arch/platform/nrf52dk/contiki-conf.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup nrf52dk - * @{ - * - * \addtogroup nrf52dk-contikic-conf Contiki configuration - * @{ - * - * \file - * Contiki configuration for the nRF52 DK - */ -#ifndef CONTIKI_CONF_H -#define CONTIKI_CONF_H - -#include -#include -/*---------------------------------------------------------------------------*/ -/* Include Project Specific conf */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif /* PROJECT_CONF_PATH */ -/*---------------------------------------------------------------------------*/ -/* Include platform peripherals configuration */ -#include "nrf52dk-def.h" -#include "nrf52832-def.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Network Stack Configuration - * - * @{ - */ - -/* Select the BLE mac driver */ -#if MAC_CONF_WITH_OTHER -#define NETSTACK_CONF_MAC ble_ipsp_mac_driver -#endif - -/* 6LoWPAN */ -#define SICSLOWPAN_CONF_MAC_MAX_PAYLOAD 1280 - -#ifndef SICSLOWPAN_CONF_FRAG -#define SICSLOWPAN_CONF_FRAG 0 /**< We don't use 6LoWPAN fragmentation as IPSP takes care of that for us.*/ -#endif - -#define SICSLOWPAN_FRAMER_HDRLEN 0 /**< Use fixed header len rather than framer.length() function */ - -/* Packet buffer */ -#define PACKETBUF_CONF_SIZE 1280 /**< Required IPv6 MTU size */ - -/* Queuebuf */ -#define QUEUEBUF_CONF_ENABLED 0 - -/** @} */ - -/** - * \name BLE configuration - * @{ - */ -#ifndef DEVICE_NAME -#define DEVICE_NAME "Contiki nRF52dk" /**< Device name used in BLE undirected advertisement. */ -#endif -/** - * @} - */ - -/** - * \name IPv6 network buffer configuration - * - * @{ - */ - -#if NETSTACK_CONF_WITH_IPV6 -/*---------------------------------------------------------------------------*/ - -/* ND and Routing */ -#define UIP_CONF_ROUTER 0 /**< BLE master role, which allows for routing, isn't supported. */ -#define UIP_CONF_ND6_SEND_NS 1 - -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -/** @} */ -#endif /* CONTIKI_CONF_H */ -/** - * @} - * @} - */ diff --git a/arch/platform/nrf52dk/dev/button-sensor.c b/arch/platform/nrf52dk/dev/button-sensor.c deleted file mode 100644 index 3c218a439..000000000 --- a/arch/platform/nrf52dk/dev/button-sensor.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup nrf52dk-devices Device drivers - * @{ - * - * \addtogroup nrf52dk-devices-button Buttons driver - * @{ - * - * \file - * Driver for nRF52 DK buttons. - * \author - * Wojciech Bober - */ -/*---------------------------------------------------------------------------*/ -#include -#include "nordic_common.h" -#include "nrf_drv_gpiote.h" -#include "nrf_assert.h" -#include "boards.h" -#include "contiki.h" -#include "lib/sensors.h" -#include "button-sensor.h" - -/*---------------------------------------------------------------------------*/ -#define DEBOUNCE_DURATION (CLOCK_SECOND >> 5) /**< Delay before button state is assumed to be stable */ - -/*---------------------------------------------------------------------------*/ -struct btn_timer -{ - struct timer debounce; - clock_time_t start; - clock_time_t duration; -}; - -static struct btn_timer btn_timer[BUTTONS_NUMBER]; -static int btn_state = 0; - -/*---------------------------------------------------------------------------*/ -/** - * \brief Button toggle handler - * \param pin GPIO pin which has been triggered - * \param action toggle direction - * - */ -static void -gpiote_event_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) -{ - int id = pin - BUTTON_START; - - if(!timer_expired(&(btn_timer[id].debounce))) { - return; - } - - /* Set timer to ignore consecutive changes for - * DEBOUNCE_DURATION. - */ - timer_set(&(btn_timer[id].debounce), DEBOUNCE_DURATION); - - /* - * Start measuring duration on falling edge, stop on rising edge. - */ - if(nrf_drv_gpiote_in_is_set(pin) == 0) { - btn_timer[id].start = clock_time(); - btn_timer[id].duration = 0; - } else { - btn_timer[id].duration = clock_time() - btn_timer[id].start; - } - sensors_changed(&buttons[id]); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the button sensor for all buttons. - * - * \param type if \a SENSORS_HW_INIT is passed the function will initialize - * given button - * if \a SENSORS_ACTIVE is passed then \p c parameter defines - * whether button should be set active or inactive - * \param c 0 to disable the button, non-zero: enable - * \param pin GPIOE pin number - */ -static int -config(int type, int c, nrf_drv_gpiote_pin_t pin) -{ - int id = pin - BUTTON_START; - - switch(type) { - case SENSORS_HW_INIT: { - nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false); - config.pull = NRF_GPIO_PIN_PULLUP; - nrf_drv_gpiote_in_init(pin, &config, gpiote_event_handler); - timer_set(&(btn_timer[id].debounce), DEBOUNCE_DURATION); - return 1; - } - case SENSORS_ACTIVE: { - if(c) { - nrf_drv_gpiote_in_event_enable(pin, true); - btn_state |= (1 << id); - } else { - nrf_drv_gpiote_in_event_disable(pin); - btn_state &= ~(1 << id); - } - return 1; - } - default: - return 0; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for button 1 - * - * \param type passed to config() as-is - * \param value passed to config() as-is - * \return same as config() return value - */ -static int -config_button_1(int type, int value) -{ - return config(type, value, BSP_BUTTON_0); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for button 2 - * - * \param type passed to config() as-is - * \param value passed to config() as-is - * \return same as config() return value - */ -static int -config_button_2(int type, int value) -{ - return config(type, value, BSP_BUTTON_1); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for button 3 - * - * \param type passed to config() as-is - * \param value passed to config() as-is - * \return same as config() return value - */ -static int -config_button_3(int type, int value) -{ - return config(type, value, BSP_BUTTON_2); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for button 4 - * - * \param type passed to config() as-is - * \param value passed to config() as-is - * \return same as config() return value - */ -static int -config_button_4(int type, int value) -{ - return config(type, value, BSP_BUTTON_3); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Return current state of a button - * \param type pass \ref BUTTON_SENSOR_VALUE_STATE to get current button state - * or \ref BUTTON_SENSOR_VALUE_DURATION to get active state duration - * \param pin GPIOE pin number - * - * \retval BUTTON_SENSOR_VALUE_PRESSED - * \retval BUTTON_SENSOR_VALUE_RELEASED when \a type is \ref BUTTON_SENSOR_VALUE_STATE - * \retval duration Active state duration in clock ticks - */ -static int -value(int type, nrf_drv_gpiote_pin_t pin) -{ - - if(type == BUTTON_SENSOR_VALUE_STATE) { - return nrf_drv_gpiote_in_is_set(pin) == 0 ? - BUTTON_SENSOR_VALUE_PRESSED : BUTTON_SENSOR_VALUE_RELEASED; - } else if(type == BUTTON_SENSOR_VALUE_DURATION) { - return btn_timer[pin - BUTTON_START].duration; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Return current state of a button 1 - * \param type passed to value() as-is - * \return same as value returned by value() - */ -static int -value_button_1(int type) -{ - return value(type, BSP_BUTTON_0); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Return current state of a button 2 - * \param type passed to value() as-is - * \return same as value returned by value() - */ -static int -value_button_2(int type) -{ - return value(type, BSP_BUTTON_1); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Return current state of a button 3 - * \param type passed to value() as-is - * \return same as value returned by value() - */ -static int -value_button_3(int type) -{ - return value(type, BSP_BUTTON_2); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Return current state of a button 4 - * \param type passed to value() as-is - * \return same as value returned by value() - */ -static int -value_button_4(int type) -{ - return value(type, BSP_BUTTON_3); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Get status of a given button - * \param type \a SENSORS_ACTIVE or \a SENSORS_READY - * \param pin GPIOE pin number - * \return 1 if the button's port interrupt is enabled - */ -static int -status(int type, nrf_drv_gpiote_pin_t pin) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return (btn_state & (1 << (pin - BUTTON_START))); - default: - break; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Status function for button 1 - * \param type passed to state() as-is - * \return value returned by state() - */ -static int -status_button_1(int type) -{ - return status(type, BSP_BUTTON_0); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Status function for button 2 - * \param type passed to state() as-is - * \return value returned by state() - */ -static int -status_button_2(int type) -{ - return status(type, BSP_BUTTON_1); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Status function for button 3 - * \param type passed to state() as-is - * \return value returned by state() - */ -static int -status_button_3(int type) -{ - return status(type, BSP_BUTTON_2); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Status function for button 3 - * \param type passed to state() as-is - * \return value returned by state() - */ -static int -status_button_4(int type) -{ - return status(type, BSP_BUTTON_3); -} -/*---------------------------------------------------------------------------*/ -const struct sensors_sensor buttons[BUTTONS_NUMBER] = { - {BUTTON_SENSOR, value_button_1, config_button_1, status_button_1}, - {BUTTON_SENSOR, value_button_2, config_button_2, status_button_2}, - {BUTTON_SENSOR, value_button_3, config_button_3, status_button_3}, - {BUTTON_SENSOR, value_button_4, config_button_4, status_button_4}, }; -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/nrf52dk/dev/button-sensor.h b/arch/platform/nrf52dk/dev/button-sensor.h deleted file mode 100644 index ababb1c1c..000000000 --- a/arch/platform/nrf52dk/dev/button-sensor.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup nrf52dk-devices Device drivers - * @{ - * - * \addtogroup nrf52dk-devices-button Buttons driver - * @{ - * - * \file - * Header file for the nRF52dk button driver. - * \author - * Wojciech Bober - * - */ -/*---------------------------------------------------------------------------*/ -#ifndef BUTTON_SENSOR_H_ -#define BUTTON_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define BUTTON_SENSOR "Button" -/*---------------------------------------------------------------------------*/ -#define BUTTON_SENSOR_VALUE_STATE 0 /**< Can be passed to value() function - to get current button state */ -#define BUTTON_SENSOR_VALUE_DURATION 1 /**< Can be passed to value() function - to get low state duration */ - -#define BUTTON_SENSOR_VALUE_RELEASED 0 -#define BUTTON_SENSOR_VALUE_PRESSED 1 -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor buttons[]; -/*---------------------------------------------------------------------------*/ -#define button_1 buttons[0] -#define button_2 buttons[1] -#define button_3 buttons[2] -#define button_4 buttons[3] -/*---------------------------------------------------------------------------*/ -#endif /* BUTTON_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/nrf52dk/dev/leds-arch.c b/arch/platform/nrf52dk/dev/leds-arch.c deleted file mode 100644 index cda1317ef..000000000 --- a/arch/platform/nrf52dk/dev/leds-arch.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \addtogroup nrf52dk - * @{ - * - * \addtogroup nrf52dk-devices Device drivers - * @{ - * - * \addtogroup nrf52dk-devices-led LED driver - * @{ - * - * \file - * Architecture specific LED driver implementation for nRF52 DK. - * \author - * Wojciech Bober - */ -#include "boards.h" -#include "contiki.h" -#include "dev/leds.h" - -/*---------------------------------------------------------------------------*/ -void -leds_arch_init(void) -{ - LEDS_CONFIGURE(LEDS_MASK); - LEDS_OFF(LEDS_MASK); -} -/*---------------------------------------------------------------------------*/ -leds_mask_t -leds_arch_get(void) -{ - return (leds_mask_t)(LED_IS_ON(LEDS_MASK) >> LED_START); -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set(leds_mask_t leds) -{ - unsigned int mask = (unsigned int)leds << LED_START; - LEDS_OFF(LEDS_MASK); - LEDS_ON(mask); -} -/*---------------------------------------------------------------------------*/ - -/** - * @} - * @} - * @} - */ diff --git a/arch/platform/nrf52dk/dev/nrf52dk-sensors.c b/arch/platform/nrf52dk/dev/nrf52dk-sensors.c deleted file mode 100644 index 3d56e91d1..000000000 --- a/arch/platform/nrf52dk/dev/nrf52dk-sensors.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \addtogroup nrf52dk - * @{ - * - * \addtogroup nrf52dk-devices Device drivers - * @{ - * - * \addtogroup nrf52dk-sensors Sensors - * The nRF52 DK exports 4 button sensors and an internal temperature sensor. - * @{ - * - * \file - * This file exports a global sensors table. - * \author - * Wojciech Bober - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/button-sensor.h" -#include "dev/temperature-sensor.h" -/*---------------------------------------------------------------------------*/ -SENSORS( - &button_1, - &button_2, - &button_3, - &button_4, - &temperature_sensor -); -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - * @} - */ diff --git a/arch/platform/nrf52dk/dev/temperature-sensor.c b/arch/platform/nrf52dk/dev/temperature-sensor.c deleted file mode 100644 index f42fd3fe3..000000000 --- a/arch/platform/nrf52dk/dev/temperature-sensor.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \addtogroup nrf52dk-devices Device drivers - * @{ - * - * \addtogroup nrf52dk-devices-temp Temperature sensor driver - * This is a driver for nRF52832 hardware sensor. - * - * @{ - * - * \file - * Temperature sensor implementation. - * \author - * Wojciech Bober - * - */ -#ifndef SOFTDEVICE_PRESENT -#include "nrf_temp.h" -#else -#include "nrf_soc.h" -#endif -#include "contiki.h" -#include "dev/temperature-sensor.h" - - -const struct sensors_sensor temperature_sensor; - -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns device temperature - * \param type ignored - * \return Device temperature in degrees Celsius - */ -static int -value(int type) -{ -#ifndef SOFTDEVICE_PRESENT - int32_t volatile temp; - - NRF_TEMP->TASKS_START = 1; - /* nRF52832 datasheet: one temperature measurement takes typically 36 us */ - RTIMER_BUSYWAIT_UNTIL(NRF_TEMP->EVENTS_DATARDY, RTIMER_SECOND * 72 / 1000000); - NRF_TEMP->EVENTS_DATARDY = 0; - temp = nrf_temp_read(); - NRF_TEMP->TASKS_STOP = 1; - - return temp; -#else - int32_t temp; - sd_temp_get(&temp); - return temp >> 2; -#endif -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configures temperature sensor - * \param type initializes the hardware sensor when \a type is set to - * \a SENSORS_HW_INIT - * \param c ignored - * \return 1 - * \note This function does nothing when SoftDevice is present - */ -static int -configure(int type, int c) -{ -#ifndef SOFTDEVICE_PRESENT - if (type == SENSORS_HW_INIT) { - nrf_temp_init(); - } -#endif - return 1; -} -/** - * \brief Return temperature sensor status - * \param type ignored - * \return 1 - */ -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR, value, configure, status); -/** - * @} - * @} - */ diff --git a/arch/platform/nrf52dk/dev/temperature-sensor.h b/arch/platform/nrf52dk/dev/temperature-sensor.h deleted file mode 100644 index 27b246b2d..000000000 --- a/arch/platform/nrf52dk/dev/temperature-sensor.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \addtogroup nrf52dk-devices Device drivers - * @{ - * - * \addtogroup nrf52dk-devices-temp Temperature sensor driver - * @{ - * - * \file - * Temperature sensor header file. - * \author - * Wojciech Bober - * - */ - -#ifndef TEMPERATURE_SENSOR_H_ -#define TEMPERATURE_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor temperature_sensor; - -#define TEMPERATURE_SENSOR "Temperature" - -#endif /* TEMPERATURE_SENSOR_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/platform/nrf52dk/doxygen-group.txt b/arch/platform/nrf52dk/doxygen-group.txt deleted file mode 100644 index e1f2c25e8..000000000 --- a/arch/platform/nrf52dk/doxygen-group.txt +++ /dev/null @@ -1,4 +0,0 @@ -/** - * \defgroup nrf52dk nRF52 Development Kit - * \ingroup platform - */ diff --git a/arch/platform/nrf52dk/nrf52dk-def.h b/arch/platform/nrf52dk/nrf52dk-def.h deleted file mode 100644 index 0e387f0f0..000000000 --- a/arch/platform/nrf52dk/nrf52dk-def.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \addtogroup platform - * @{ - * - * \addtogroup nrf52dk nRF52 Development Kit - * @{ - * - * \addtogroup nrf52dk-platform-conf Platform configuration - * @{ - * \file - * Platform features configuration. - * \author - * Wojciech Bober - * - */ -#ifndef NRF52DK_DEF_H_ -#define NRF52DK_DEF_H_ - -#include "boards.h" - -#define PLATFORM_HAS_BATTERY 0 -#define PLATFORM_HAS_RADIO 0 -#define PLATFORM_HAS_TEMPERATURE 1 - -/** - * \name Leds configurations - * - * On nRF52dk all leds are green. - * - * @{ - */ -#define PLATFORM_HAS_LEDS 1 -#define LEDS_CONF_LEGACY_API 1 - -#define LEDS_1 (1 << (LED_1 - LED_START)) // 1 -#define LEDS_2 (1 << (LED_2 - LED_START)) // 2 -#define LEDS_3 (1 << (LED_3 - LED_START)) // 4 -#define LEDS_4 (1 << (LED_4 - LED_START)) // 8 - -#define LEDS_CONF_GREEN LEDS_1 -#define LEDS_CONF_YELLOW LEDS_2 -#define LEDS_CONF_RED LEDS_3 -#define LEDS_CONF_BLUE LEDS_4 - -#define LEDS_CONF_ALL (LEDS_1 | LEDS_2 | LEDS_3 | LEDS_4) - -/** - * \brief If set to 1 then LED1 and LED2 are used by the - * platform to indicate BLE connection state. - */ -#define PLATFORM_INDICATE_BLE_STATE 1 -/** @} */ - -/** - * \name Button configurations - * - * @{ - */ -/* Notify various examples that we have Buttons */ -#define PLATFORM_HAS_BUTTON 1 - -/* - * Override button symbols from dev/button-sensor.h, for the examples that - * include it - */ -#define button_sensor button_1 -#define button_sensor2 button_2 - -/** - * \brief nRF52 RTC instance to be used for Contiki clock driver. - * \note RTC 0 is used by the SoftDevice. - */ -#define PLATFORM_RTC_INSTANCE_ID 1 - -/** - * \brief nRF52 timer instance to be used for Contiki rtimer driver. - * \note Timer 0 is used by the SoftDevice. - */ -#define PLATFORM_TIMER_INSTANCE_ID 1 - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** @} - * @} - * @} - */ -#endif /* NRF52DK_DEF_H_ */ diff --git a/arch/platform/nrf52dk/platform.c b/arch/platform/nrf52dk/platform.c deleted file mode 100644 index e48a3c05d..000000000 --- a/arch/platform/nrf52dk/platform.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup nrf52dk nRF52 Development Kit - * @{ - */ -#include -#include - -#include "nordic_common.h" -#include "contiki.h" - -#include "nrf_drv_config.h" -#include "nrf_drv_gpiote.h" -#ifdef SOFTDEVICE_PRESENT -#include "softdevice_handler.h" -#include "ble/ble-core.h" -#include "ble/ble-mac.h" -#endif - -#include "contiki-net.h" -#include "leds.h" -#include "lib/sensors.h" - -#include "dev/serial-line.h" -#include "dev/uart0.h" -#include "dev/lpm.h" -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "NRF52DK" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -#if defined(SOFTDEVICE_PRESENT) && PLATFORM_INDICATE_BLE_STATE -PROCESS(ble_iface_observer, "BLE interface observer"); - -/** - * \brief A process that handles adding/removing - * BLE IPSP interfaces. - */ -PROCESS_THREAD(ble_iface_observer, ev, data) -{ - static struct etimer led_timer; - - PROCESS_BEGIN(); - - etimer_set(&led_timer, CLOCK_SECOND/2); - - while(1) { - PROCESS_WAIT_EVENT(); - if(ev == ble_event_interface_added) { - etimer_stop(&led_timer); - leds_off(LEDS_1); - leds_on(LEDS_2); - } else if(ev == ble_event_interface_deleted) { - etimer_set(&led_timer, CLOCK_SECOND/2); - leds_off(LEDS_2); - } else if(ev == PROCESS_EVENT_TIMER && etimer_expired(&led_timer)) { - etimer_reset(&led_timer); - leds_toggle(LEDS_1); - } - } - PROCESS_END(); -} -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief Board specific initialization - * - * This function will enable SoftDevice is present. - */ -static void -board_init(void) -{ -#ifdef SOFTDEVICE_PRESENT - /* Initialize the SoftDevice handler module */ - SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL); -#endif -#ifdef PLATFORM_HAS_BUTTON - if (!nrf_drv_gpiote_is_init()) { - nrf_drv_gpiote_init(); - } -#endif -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one(void) -{ - board_init(); - leds_init(); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two(void) -{ - // Seed value is ignored since hardware RNG is used. - random_init(0); - -#ifdef UART0_ENABLED - uart0_init(); -#if SLIP_ARCH_CONF_ENABLE - #error Platform does not support SLIP -#else - uart0_set_input(serial_line_input_byte); - serial_line_init(); -#endif -#endif - -#ifdef SOFTDEVICE_PRESENT - ble_stack_init(); - ble_advertising_init(DEVICE_NAME); -#endif -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three(void) -{ -#if defined(SOFTDEVICE_PRESENT) && NETSTACK_CONF_WITH_IPV6 - linkaddr_t linkaddr; - ble_get_mac(linkaddr.u8); - /* Set link layer address */ - linkaddr_set_node_addr(&linkaddr); - process_start(&ble_iface_observer, NULL); -#endif - - process_start(&sensors_process, NULL); - -#ifdef SOFTDEVICE_PRESENT - ble_advertising_start(); - LOG_INFO("Advertising name [%s]\n", DEVICE_NAME); -#endif -} -/*---------------------------------------------------------------------------*/ -void -platform_idle() -{ - lpm_drop(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/nrf52dk/rtt/rtt-printf.c b/arch/platform/nrf52dk/rtt/rtt-printf.c deleted file mode 100644 index 416fff0ab..000000000 --- a/arch/platform/nrf52dk/rtt/rtt-printf.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include "segger-rtt.h" - -int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList); - -int -putchar(int c) -{ - SEGGER_RTT_Write(0, &c, 1); - return c; -} - -int -printf(const char *fmt, ...) -{ - int res; - va_list ap; - va_start(ap, fmt); - res = SEGGER_RTT_vprintf(0, fmt, &ap); - va_end(ap); - return res; -} - - diff --git a/arch/platform/nrf52dk/rtt/segger-rtt-conf.h b/arch/platform/nrf52dk/rtt/segger-rtt-conf.h deleted file mode 100644 index ac996644f..000000000 --- a/arch/platform/nrf52dk/rtt/segger-rtt-conf.h +++ /dev/null @@ -1,135 +0,0 @@ -/********************************************************************* -* SEGGER MICROCONTROLLER GmbH & Co. KG * -* Solutions for real time microcontroller applications * -********************************************************************** -* * -* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * -* * -* www.segger.com Support: support@segger.com * -* * -********************************************************************** ----------------------------------------------------------------------- -File : SEGGER_RTT_Conf.h -Purpose : Implementation of SEGGER real-time transfer (RTT) which - allows real-time communication on targets which support - debugger memory accesses while the CPU is running. ----------------------------END-OF-HEADER------------------------------ -*/ - -#ifndef SEGGER_RTT_CONF_H -#define SEGGER_RTT_CONF_H - -#ifdef __ICCARM__ - #include -#endif - -/********************************************************************* -* -* Defines, configurable -* -********************************************************************** -*/ - -#define SEGGER_RTT_MAX_NUM_UP_BUFFERS (2) // Max. number of up-buffers (T->H) available on this target (Default: 2) -#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (2) // Max. number of down-buffers (H->T) available on this target (Default: 2) - -#define BUFFER_SIZE_UP (1024) // Size of the buffer for terminal output of target, up to host (Default: 1k) -#define BUFFER_SIZE_DOWN (16) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16) - -#define SEGGER_RTT_PRINTF_BUFFER_SIZE (64u) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64) - -#define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0) - -// -// Target is not allowed to perform other RTT operations while string still has not been stored completely. -// Otherwise we would probably end up with a mixed string in the buffer. -// If using RTT from within interrupts, multiple tasks or multi processors, define the SEGGER_RTT_LOCK() and SEGGER_RTT_UNLOCK() function here. -// -/********************************************************************* -* -* RTT lock configuration for SEGGER Embedded Studio, -* Rowley CrossStudio and GCC -*/ -#if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__) - #ifdef __ARM_ARCH_6M__ - #define SEGGER_RTT_LOCK(SavedState) { \ - asm volatile ("mrs %0, primask \n\t" \ - "mov r1, $1 \n\t" \ - "msr primask, r1 \n\t" \ - : "=r" (SavedState) \ - : \ - : "r1" \ - ); \ - } - - #define SEGGER_RTT_UNLOCK(SavedState) { \ - asm volatile ("msr primask, %0 \n\t" \ - : \ - : "r" (SavedState) \ - : \ - ); \ - } - - #elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)) - #define SEGGER_RTT_LOCK(SavedState) { \ - asm volatile ("mrs %0, basepri \n\t" \ - "mov r1, $128 \n\t" \ - "msr basepri, r1 \n\t" \ - : "=r" (SavedState) \ - : \ - : "r1" \ - ); \ - } - #define SEGGER_RTT_UNLOCK(SavedState) { \ - asm volatile ("msr basepri, %0 \n\t" \ - : \ - : "r" (SavedState) \ - : \ - ); \ - } - #else - #define SEGGER_RTT_LOCK(SavedState) (void)(SavedState) - #define SEGGER_RTT_UNLOCK(SavedState) (void)(SavedState) - #endif -#endif - -/********************************************************************* -* -* RTT lock configuration for IAR EWARM -*/ -#ifdef __ICCARM__ - #if (defined (__ARM7M__) && (__CORE__ == __ARM7M__)) - #define SEGGER_RTT_LOCK(SavedState) { \ - SavedState = __get_PRIMASK(); \ - __set_PRIMASK(1); \ - } - - #define SEGGER_RTT_UNLOCK(SavedState) { \ - __set_PRIMASK(SavedState); \ - } - #elif (defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) - #define SEGGER_RTT_LOCK(SavedState) { \ - SavedState = __get_BASEPRI(); \ - __set_BASEPRI(128); \ - } - - #define SEGGER_RTT_UNLOCK(SavedState) { \ - __set_BASEPRI(SavedState); \ - } - #endif -#endif - -/********************************************************************* -* -* RTT lock configuration fallback -*/ -#ifndef SEGGER_RTT_LOCK - #define SEGGER_RTT_LOCK(SavedState) (void)(SavedState) -#endif - -#ifndef SEGGER_RTT_UNLOCK - #define SEGGER_RTT_UNLOCK(SavedState) (void)(SavedState) -#endif - -#endif -/*************************** End of file ****************************/ diff --git a/arch/platform/nrf52dk/rtt/segger-rtt-printf.c b/arch/platform/nrf52dk/rtt/segger-rtt-printf.c deleted file mode 100644 index e992e7a36..000000000 --- a/arch/platform/nrf52dk/rtt/segger-rtt-printf.c +++ /dev/null @@ -1,510 +0,0 @@ -/********************************************************************* -* SEGGER MICROCONTROLLER GmbH & Co. KG * -* Solutions for real time microcontroller applications * -********************************************************************** -* * -* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * -* * -* www.segger.com Support: support@segger.com * -* * -********************************************************************** -* * -* All rights reserved. * -* * -* * This software may in its unmodified form be freely redistributed * -* in source form. * -* * The source code may be modified, provided the source code * -* retains the above copyright notice, this list of conditions and * -* the following disclaimer. * -* * Modified versions of this software in source or linkable form * -* may not be distributed without prior consent of SEGGER. * -* * This software may only be used for communication with SEGGER * -* J-Link debug probes. * -* * -* 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 SEGGER Microcontroller 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. * -* * -********************************************************************** ----------------------------END-OF-HEADER------------------------------ -File : SEGGER_RTT_printf.c -Purpose : Replacement for printf to write formatted data via RTT ----------------------------------------------------------------------- -*/ -#include "segger-rtt.h" -#include "segger-rtt-conf.h" - -/********************************************************************* -* -* Defines, configurable -* -********************************************************************** -*/ - -#ifndef SEGGER_RTT_PRINTF_BUFFER_SIZE - #define SEGGER_RTT_PRINTF_BUFFER_SIZE (64) -#endif - -#include -#include - - -#define FORMAT_FLAG_LEFT_JUSTIFY (1u << 0) -#define FORMAT_FLAG_PAD_ZERO (1u << 1) -#define FORMAT_FLAG_PRINT_SIGN (1u << 2) -#define FORMAT_FLAG_ALTERNATE (1u << 3) - -/********************************************************************* -* -* Types -* -********************************************************************** -*/ - -typedef struct { - char* pBuffer; - unsigned BufferSize; - unsigned Cnt; - - int ReturnValue; - - unsigned RTTBufferIndex; -} SEGGER_RTT_PRINTF_DESC; - -/********************************************************************* -* -* Function prototypes -* -********************************************************************** -*/ -int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList); - -/********************************************************************* -* -* Static code -* -********************************************************************** -*/ -/********************************************************************* -* -* _StoreChar -*/ -static void _StoreChar(SEGGER_RTT_PRINTF_DESC * p, char c) { - unsigned Cnt; - - Cnt = p->Cnt; - if ((Cnt + 1u) <= p->BufferSize) { - *(p->pBuffer + Cnt) = c; - p->Cnt = Cnt + 1u; - p->ReturnValue++; - } - // - // Write part of string, when the buffer is full - // - if (p->Cnt == p->BufferSize) { - if (SEGGER_RTT_Write(p->RTTBufferIndex, p->pBuffer, p->Cnt) != p->Cnt) { - p->ReturnValue = -1; - } else { - p->Cnt = 0u; - } - } -} - -/********************************************************************* -* -* _PrintUnsigned -*/ -static void _PrintUnsigned(SEGGER_RTT_PRINTF_DESC * pBufferDesc, unsigned v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) { - static const char _aV2C[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - unsigned Div; - unsigned Digit; - unsigned Number; - unsigned Width; - char c; - - Number = v; - Digit = 1u; - // - // Get actual field width - // - Width = 1u; - while (Number >= Base) { - Number = (Number / Base); - Width++; - } - if (NumDigits > Width) { - Width = NumDigits; - } - // - // Print leading chars if necessary - // - if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) { - if (FieldWidth != 0u) { - if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && (NumDigits == 0u)) { - c = '0'; - } else { - c = ' '; - } - while ((FieldWidth != 0u) && (Width < FieldWidth)) { - FieldWidth--; - _StoreChar(pBufferDesc, c); - if (pBufferDesc->ReturnValue < 0) { - break; - } - } - } - } - if (pBufferDesc->ReturnValue >= 0) { - // - // Compute Digit. - // Loop until Digit has the value of the highest digit required. - // Example: If the output is 345 (Base 10), loop 2 times until Digit is 100. - // - while (1) { - if (NumDigits > 1u) { // User specified a min number of digits to print? => Make sure we loop at least that often, before checking anything else (> 1 check avoids problems with NumDigits being signed / unsigned) - NumDigits--; - } else { - Div = v / Digit; - if (Div < Base) { // Is our divider big enough to extract the highest digit from value? => Done - break; - } - } - Digit *= Base; - } - // - // Output digits - // - do { - Div = v / Digit; - v -= Div * Digit; - _StoreChar(pBufferDesc, _aV2C[Div]); - if (pBufferDesc->ReturnValue < 0) { - break; - } - Digit /= Base; - } while (Digit); - // - // Print trailing spaces if necessary - // - if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == FORMAT_FLAG_LEFT_JUSTIFY) { - if (FieldWidth != 0u) { - while ((FieldWidth != 0u) && (Width < FieldWidth)) { - FieldWidth--; - _StoreChar(pBufferDesc, ' '); - if (pBufferDesc->ReturnValue < 0) { - break; - } - } - } - } - } -} - -/********************************************************************* -* -* _PrintInt -*/ -static void _PrintInt(SEGGER_RTT_PRINTF_DESC * pBufferDesc, int v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) { - unsigned Width; - int Number; - - Number = (v < 0) ? -v : v; - - // - // Get actual field width - // - Width = 1u; - while (Number >= (int)Base) { - Number = (Number / (int)Base); - Width++; - } - if (NumDigits > Width) { - Width = NumDigits; - } - if ((FieldWidth > 0u) && ((v < 0) || ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN))) { - FieldWidth--; - } - - // - // Print leading spaces if necessary - // - if ((((FormatFlags & FORMAT_FLAG_PAD_ZERO) == 0u) || (NumDigits != 0u)) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u)) { - if (FieldWidth != 0u) { - while ((FieldWidth != 0u) && (Width < FieldWidth)) { - FieldWidth--; - _StoreChar(pBufferDesc, ' '); - if (pBufferDesc->ReturnValue < 0) { - break; - } - } - } - } - // - // Print sign if necessary - // - if (pBufferDesc->ReturnValue >= 0) { - if (v < 0) { - v = -v; - _StoreChar(pBufferDesc, '-'); - } else if ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN) { - _StoreChar(pBufferDesc, '+'); - } else { - - } - if (pBufferDesc->ReturnValue >= 0) { - // - // Print leading zeros if necessary - // - if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) && (NumDigits == 0u)) { - if (FieldWidth != 0u) { - while ((FieldWidth != 0u) && (Width < FieldWidth)) { - FieldWidth--; - _StoreChar(pBufferDesc, '0'); - if (pBufferDesc->ReturnValue < 0) { - break; - } - } - } - } - if (pBufferDesc->ReturnValue >= 0) { - // - // Print number without sign - // - _PrintUnsigned(pBufferDesc, (unsigned)v, Base, NumDigits, FieldWidth, FormatFlags); - } - } - } -} - -/********************************************************************* -* -* Public code -* -********************************************************************** -*/ -/********************************************************************* -* -* SEGGER_RTT_vprintf -* -* Function description -* Stores a formatted string in SEGGER RTT control block. -* This data is read by the host. -* -* Parameters -* BufferIndex Index of "Up"-buffer to be used. (e.g. 0 for "Terminal") -* sFormat Pointer to format string -* pParamList Pointer to the list of arguments for the format string -* -* Return values -* >= 0: Number of bytes which have been stored in the "Up"-buffer. -* < 0: Error -*/ -int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList) { - char c; - SEGGER_RTT_PRINTF_DESC BufferDesc; - int v; - unsigned NumDigits; - unsigned FormatFlags; - unsigned FieldWidth; - char acBuffer[SEGGER_RTT_PRINTF_BUFFER_SIZE]; - - BufferDesc.pBuffer = acBuffer; - BufferDesc.BufferSize = SEGGER_RTT_PRINTF_BUFFER_SIZE; - BufferDesc.Cnt = 0u; - BufferDesc.RTTBufferIndex = BufferIndex; - BufferDesc.ReturnValue = 0; - - do { - c = *sFormat; - sFormat++; - if (c == 0u) { - break; - } - if (c == '%') { - // - // Filter out flags - // - FormatFlags = 0u; - v = 1; - do { - c = *sFormat; - switch (c) { - case '-': FormatFlags |= FORMAT_FLAG_LEFT_JUSTIFY; sFormat++; break; - case '0': FormatFlags |= FORMAT_FLAG_PAD_ZERO; sFormat++; break; - case '+': FormatFlags |= FORMAT_FLAG_PRINT_SIGN; sFormat++; break; - case '#': FormatFlags |= FORMAT_FLAG_ALTERNATE; sFormat++; break; - default: v = 0; break; - } - } while (v); - // - // filter out field with - // - FieldWidth = 0u; - do { - c = *sFormat; - if ((c < '0') || (c > '9')) { - break; - } - sFormat++; - FieldWidth = (FieldWidth * 10u) + ((unsigned)c - '0'); - } while (1); - - // - // Filter out precision (number of digits to display) - // - NumDigits = 0u; - c = *sFormat; - if (c == '.') { - sFormat++; - do { - c = *sFormat; - if (c == '*') { - sFormat++; - v = va_arg(*pParamList, int); - NumDigits = (unsigned)v; - break; - } - if ((c < '0') || (c > '9')) { - break; - } - sFormat++; - NumDigits = NumDigits * 10u + ((unsigned)c - '0'); - } while (1); - } - // - // Filter out length modifier - // - c = *sFormat; - do { - if ((c == 'l') || (c == 'h')) { - c = *sFormat; - sFormat++; - } else { - break; - } - } while (1); - // - // Handle specifiers - // - switch (c) { - case 'c': { - char c0; - v = va_arg(*pParamList, int); - c0 = (char)v; - _StoreChar(&BufferDesc, c0); - break; - } - case 'd': - v = va_arg(*pParamList, int); - _PrintInt(&BufferDesc, v, 10u, NumDigits, FieldWidth, FormatFlags); - break; - case 'u': - v = va_arg(*pParamList, int); - _PrintUnsigned(&BufferDesc, (unsigned)v, 10u, NumDigits, FieldWidth, FormatFlags); - break; - case 'x': - case 'X': - v = va_arg(*pParamList, int); - _PrintUnsigned(&BufferDesc, (unsigned)v, 16u, NumDigits, FieldWidth, FormatFlags); - break; - case 's': - { - const char * s = va_arg(*pParamList, const char *); - if (NumDigits > 0) { - do { - c = *s; - s++; - if (NumDigits == 0) { - break; - } - NumDigits--; - _StoreChar(&BufferDesc, c); - } while (BufferDesc.ReturnValue >= 0); - } else { - do { - c = *s; - s++; - if (c == '\0' || NumDigits == 0) { - break; - } - _StoreChar(&BufferDesc, c); - } while (BufferDesc.ReturnValue >= 0); - } - } - break; - case 'p': - v = va_arg(*pParamList, int); - _PrintUnsigned(&BufferDesc, (unsigned)v, 16u, 8u, 8u, 0u); - break; - case '%': - _StoreChar(&BufferDesc, '%'); - break; - default: - break; - } - sFormat++; - } else { - _StoreChar(&BufferDesc, c); - } - } while (BufferDesc.ReturnValue >= 0); - - if (BufferDesc.ReturnValue > 0) { - // - // Write remaining data, if any - // - if (BufferDesc.Cnt != 0u) { - SEGGER_RTT_Write(BufferIndex, acBuffer, BufferDesc.Cnt); - } - BufferDesc.ReturnValue += (int)BufferDesc.Cnt; - } - return BufferDesc.ReturnValue; -} - -/********************************************************************* -* -* SEGGER_RTT_printf -* -* Function description -* Stores a formatted string in SEGGER RTT control block. -* This data is read by the host. -* -* Parameters -* BufferIndex Index of "Up"-buffer to be used. (e.g. 0 for "Terminal") -* sFormat Pointer to format string, followed by the arguments for conversion -* -* Return values -* >= 0: Number of bytes which have been stored in the "Up"-buffer. -* < 0: Error -* -* Notes -* (1) Conversion specifications have following syntax: -* %[flags][FieldWidth][.Precision]ConversionSpecifier -* (2) Supported flags: -* -: Left justify within the field width -* +: Always print sign extension for signed conversions -* 0: Pad with 0 instead of spaces. Ignored when using '-'-flag or precision -* Supported conversion specifiers: -* c: Print the argument as one char -* d: Print the argument as a signed integer -* u: Print the argument as an unsigned integer -* x: Print the argument as an hexadecimal integer -* s: Print the string pointed to by the argument -* p: Print the argument as an 8-digit hexadecimal integer. (Argument shall be a pointer to void.) -*/ -int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...) { - va_list ParamList; - - va_start(ParamList, sFormat); - return SEGGER_RTT_vprintf(BufferIndex, sFormat, &ParamList); -} -/*************************** End of file ****************************/ diff --git a/arch/platform/nrf52dk/rtt/segger-rtt.c b/arch/platform/nrf52dk/rtt/segger-rtt.c deleted file mode 100644 index 453a6a0e4..000000000 --- a/arch/platform/nrf52dk/rtt/segger-rtt.c +++ /dev/null @@ -1,1102 +0,0 @@ -/********************************************************************* -* SEGGER MICROCONTROLLER GmbH & Co. KG * -* Solutions for real time microcontroller applications * -********************************************************************** -* * -* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * -* * -* www.segger.com Support: support@segger.com * -* * -********************************************************************** -* * -* All rights reserved. * -* * -* * This software may in its unmodified form be freely redistributed * -* in source form. * -* * The source code may be modified, provided the source code * -* retains the above copyright notice, this list of conditions and * -* the following disclaimer. * -* * Modified versions of this software in source or linkable form * -* may not be distributed without prior consent of SEGGER. * -* * This software may only be used for communication with SEGGER * -* J-Link debug probes. * -* * -* 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 SEGGER Microcontroller 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. * -* * -********************************************************************** ----------------------------END-OF-HEADER------------------------------ -File : SEGGER_RTT.c -Purpose : Implementation of SEGGER real-time transfer (RTT) which - allows real-time communication on targets which support - debugger memory accesses while the CPU is running. - -Additional information: - Type "int" is assumed to be 32-bits in size - H->T Host to target communication - T->H Target to host communication - - RTT channel 0 is always present and reserved for Terminal usage. - Name is fixed to "Terminal" - ----------------------------------------------------------------------- -*/ - -#include "segger-rtt.h" - -#include // for memcpy - -/********************************************************************* -* -* Configuration, default values -* -********************************************************************** -*/ - -#ifndef BUFFER_SIZE_UP - #define BUFFER_SIZE_UP 1024 // Size of the buffer for terminal output of target, up to host -#endif - -#ifndef BUFFER_SIZE_DOWN - #define BUFFER_SIZE_DOWN 16 // Size of the buffer for terminal input to target from host (Usually keyboard input) -#endif - -#ifndef SEGGER_RTT_MAX_NUM_UP_BUFFERS - #define SEGGER_RTT_MAX_NUM_UP_BUFFERS 2 // Number of up-buffers (T->H) available on this target -#endif - -#ifndef SEGGER_RTT_MAX_NUM_DOWN_BUFFERS - #define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS 2 // Number of down-buffers (H->T) available on this target -#endif - -#ifndef SEGGER_RTT_MODE_DEFAULT - #define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP -#endif - -#ifndef SEGGER_RTT_LOCK - #define SEGGER_RTT_LOCK(SavedState) -#endif - -#ifndef SEGGER_RTT_UNLOCK - #define SEGGER_RTT_UNLOCK(SavedState) -#endif - -#ifndef STRLEN - #define STRLEN(a) strlen((a)) -#endif - -#ifndef MEMCPY - #define MEMCPY(pDest, pSrc, NumBytes) memcpy((pDest), (pSrc), (NumBytes)) -#endif - -#ifndef MIN - #define MIN(a, b) (((a) < (b)) ? (a) : (b)) -#endif - -#ifndef MAX - #define MAX(a, b) (((a) > (b)) ? (a) : (b)) -#endif -// -// For some environments, NULL may not be defined until certain headers are included -// -#ifndef NULL - #define NULL 0 -#endif - -/********************************************************************* -* -* Static const data -* -********************************************************************** -*/ - -static unsigned char _aTerminalId[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - -/********************************************************************* -* -* Static data -* -********************************************************************** -*/ -// -// Allocate buffers for channel 0 -// -static char _acUpBuffer [BUFFER_SIZE_UP]; -static char _acDownBuffer[BUFFER_SIZE_DOWN]; -// -// Initialize SEGGER Real-time-Terminal control block (CB) -// -SEGGER_RTT_CB _SEGGER_RTT; - -static char _ActiveTerminal; - -/********************************************************************* -* -* Static functions -* -********************************************************************** -*/ - -/********************************************************************* -* -* _DoInit() -* -* Function description -* Initializes the control block an buffers. -* May only be called via INIT() to avoid overriding settings. -* -*/ -#define INIT() do { \ - if (_SEGGER_RTT.acID[0] == '\0') { _DoInit(); } \ - } while (0) -static void _DoInit(void) { - SEGGER_RTT_CB* p; - // - // Initialize control block - // - p = &_SEGGER_RTT; - p->MaxNumUpBuffers = SEGGER_RTT_MAX_NUM_UP_BUFFERS; - p->MaxNumDownBuffers = SEGGER_RTT_MAX_NUM_DOWN_BUFFERS; - // - // Initialize up buffer 0 - // - p->aUp[0].sName = "Terminal"; - p->aUp[0].pBuffer = _acUpBuffer; - p->aUp[0].SizeOfBuffer = sizeof(_acUpBuffer); - p->aUp[0].RdOff = 0u; - p->aUp[0].WrOff = 0u; - p->aUp[0].Flags = SEGGER_RTT_MODE_DEFAULT; - // - // Initialize down buffer 0 - // - p->aDown[0].sName = "Terminal"; - p->aDown[0].pBuffer = _acDownBuffer; - p->aDown[0].SizeOfBuffer = sizeof(_acDownBuffer); - p->aDown[0].RdOff = 0u; - p->aDown[0].WrOff = 0u; - p->aDown[0].Flags = SEGGER_RTT_MODE_DEFAULT; - // - // Finish initialization of the control block. - // Copy Id string in three steps to make sure "SEGGER RTT" is not found - // in initializer memory (usually flash) by J-Link - // - strcpy(&p->acID[7], "RTT"); - strcpy(&p->acID[0], "SEGGER"); - p->acID[6] = ' '; -} - -/********************************************************************* -* -* _WriteBlocking() -* -* Function description -* Stores a specified number of characters in SEGGER RTT ring buffer -* and updates the associated write pointer which is periodically -* read by the host. -* The caller is responsible for managing the write chunk sizes as -* _WriteBlocking() will block until all data has been posted successfully. -* -* Parameters -* pRing Ring buffer to post to. -* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. -* NumBytes Number of bytes to be stored in the SEGGER RTT control block. -* -* Return value -* >= 0 - Number of bytes written into buffer. -*/ -static unsigned _WriteBlocking(SEGGER_RTT_RING_BUFFER *pRing, const char* pBuffer, unsigned NumBytes) { - unsigned NumBytesToWrite; - unsigned NumBytesWritten; - unsigned RdOff; - unsigned WrOff; - // - // Write data to buffer and handle wrap-around if necessary - // - NumBytesWritten = 0u; - WrOff = pRing->WrOff; - do { - RdOff = pRing->RdOff; // May be changed by host (debug probe) in the meantime - if (RdOff > WrOff) { - NumBytesToWrite = RdOff - WrOff - 1u; - } else { - NumBytesToWrite = pRing->SizeOfBuffer - (WrOff - RdOff + 1u); - } - NumBytesToWrite = MIN(NumBytesToWrite, (pRing->SizeOfBuffer - WrOff)); // Number of bytes that can be written until buffer wrap-around - NumBytesToWrite = MIN(NumBytesToWrite, NumBytes); - memcpy(pRing->pBuffer + WrOff, pBuffer, NumBytesToWrite); - NumBytesWritten += NumBytesToWrite; - pBuffer += NumBytesToWrite; - NumBytes -= NumBytesToWrite; - WrOff += NumBytesToWrite; - if (WrOff == pRing->SizeOfBuffer) { - WrOff = 0u; - } - pRing->WrOff = WrOff; - } while (NumBytes); - // - return NumBytesWritten; -} - -/********************************************************************* -* -* _WriteNoCheck() -* -* Function description -* Stores a specified number of characters in SEGGER RTT ring buffer -* and updates the associated write pointer which is periodically -* read by the host. -* It is callers responsibility to make sure data actually fits in buffer. -* -* Parameters -* pRing Ring buffer to post to. -* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. -* NumBytes Number of bytes to be stored in the SEGGER RTT control block. -* -* Notes -* (1) If there might not be enough space in the "Up"-buffer, call _WriteBlocking -*/ -static void _WriteNoCheck(SEGGER_RTT_RING_BUFFER *pRing, const char* pData, unsigned NumBytes) { - unsigned NumBytesAtOnce; - unsigned WrOff; - unsigned Rem; - - WrOff = pRing->WrOff; - Rem = pRing->SizeOfBuffer - WrOff; - if (Rem > NumBytes) { - // - // All data fits before wrap around - // - memcpy(pRing->pBuffer + WrOff, pData, NumBytes); - pRing->WrOff = WrOff + NumBytes; - } else { - // - // We reach the end of the buffer, so need to wrap around - // - NumBytesAtOnce = Rem; - memcpy(pRing->pBuffer + WrOff, pData, NumBytesAtOnce); - NumBytesAtOnce = NumBytes - Rem; - memcpy(pRing->pBuffer, pData + Rem, NumBytesAtOnce); - pRing->WrOff = NumBytesAtOnce; - } -} - -/********************************************************************* -* -* _PostTerminalSwitch() -* -* Function description -* Switch terminal to the given terminal ID. It is the caller's -* responsibility to ensure the terminal ID is correct and there is -* enough space in the buffer for this to complete successfully. -* -* Parameters -* pRing Ring buffer to post to. -* TerminalId Terminal ID to switch to. -*/ -static void _PostTerminalSwitch(SEGGER_RTT_RING_BUFFER *pRing, char TerminalId) { - char ac[2]; - - ac[0] = 0xFFu; - ac[1] = _aTerminalId[(int)TerminalId]; // Caller made already sure that TerminalId does not exceed our terminal limit - _WriteBlocking(pRing, ac, 2u); -} - -/********************************************************************* -* -* _GetAvailWriteSpace() -* -* Function description -* Returns the number of bytes that can be written to the ring -* buffer without blocking. -* -* Parameters -* pRing Ring buffer to check. -* -* Return value -* Number of bytes that are free in the buffer. -*/ -static unsigned _GetAvailWriteSpace(SEGGER_RTT_RING_BUFFER *pRing) { - unsigned RdOff; - unsigned WrOff; - unsigned r; - // - // Avoid warnings regarding volatile access order. It's not a problem - // in this case, but dampen compiler enthusiasm. - // - RdOff = pRing->RdOff; - WrOff = pRing->WrOff; - if (RdOff <= WrOff) { - r = pRing->SizeOfBuffer - 1u - WrOff + RdOff; - } else { - r = RdOff - WrOff - 1u; - } - return r; -} - -/********************************************************************* -* -* Public code -* -********************************************************************** -*/ -/********************************************************************* -* -* SEGGER_RTT_ReadNoLock() -* -* Function description -* Reads characters from SEGGER real-time-terminal control block -* which have been previously stored by the host. -* Do not lock against interrupts and multiple access. -* -* Parameters -* BufferIndex Index of Down-buffer to be used (e.g. 0 for "Terminal"). -* pBuffer Pointer to buffer provided by target application, to copy characters from RTT-down-buffer to. -* BufferSize Size of the target application buffer. -* -* Return value -* Number of bytes that have been read. -*/ -unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned BufferSize) { - unsigned NumBytesRem; - unsigned NumBytesRead; - unsigned RdOff; - unsigned WrOff; - unsigned char* pBuffer; - SEGGER_RTT_RING_BUFFER* pRing; - // - INIT(); - pRing = &_SEGGER_RTT.aDown[BufferIndex]; - pBuffer = (unsigned char*)pData; - RdOff = pRing->RdOff; - WrOff = pRing->WrOff; - NumBytesRead = 0u; - // - // Read from current read position to wrap-around of buffer, first - // - if (RdOff > WrOff) { - NumBytesRem = pRing->SizeOfBuffer - RdOff; - NumBytesRem = MIN(NumBytesRem, BufferSize); - memcpy(pBuffer, pRing->pBuffer + RdOff, NumBytesRem); - NumBytesRead += NumBytesRem; - pBuffer += NumBytesRem; - BufferSize -= NumBytesRem; - RdOff += NumBytesRem; - // - // Handle wrap-around of buffer - // - if (RdOff == pRing->SizeOfBuffer) { - RdOff = 0u; - } - } - // - // Read remaining items of buffer - // - NumBytesRem = WrOff - RdOff; - NumBytesRem = MIN(NumBytesRem, BufferSize); - if (NumBytesRem > 0u) { - memcpy(pBuffer, pRing->pBuffer + RdOff, NumBytesRem); - NumBytesRead += NumBytesRem; - pBuffer += NumBytesRem; - BufferSize -= NumBytesRem; - RdOff += NumBytesRem; - } - if (NumBytesRead) { - pRing->RdOff = RdOff; - } - // - return NumBytesRead; -} - -/********************************************************************* -* -* SEGGER_RTT_Read -* -* Function description -* Reads characters from SEGGER real-time-terminal control block -* which have been previously stored by the host. -* -* Parameters -* BufferIndex Index of Down-buffer to be used (e.g. 0 for "Terminal"). -* pBuffer Pointer to buffer provided by target application, to copy characters from RTT-down-buffer to. -* BufferSize Size of the target application buffer. -* -* Return value -* Number of bytes that have been read. -*/ -unsigned SEGGER_RTT_Read(unsigned BufferIndex, void* pBuffer, unsigned BufferSize) { - unsigned NumBytesRead; - volatile unsigned SavedState; - // - SEGGER_RTT_LOCK(SavedState); - // - // Call the non-locking read function - // - NumBytesRead = SEGGER_RTT_ReadNoLock(BufferIndex, pBuffer, BufferSize); - // - // Finish up. - // - SEGGER_RTT_UNLOCK(SavedState); - // - return NumBytesRead; -} - -/********************************************************************* -* -* SEGGER_RTT_WriteSkipNoLock -* -* Function description -* Stores a specified number of characters in SEGGER RTT -* control block which is then read by the host. -* SEGGER_RTT_WriteSkipNoLock does not lock the application and -* skips all data, if the data does not fit into the buffer. -* -* Parameters -* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). -* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. -* NumBytes Number of bytes to be stored in the SEGGER RTT control block. -* -* Return value -* Number of bytes which have been stored in the "Up"-buffer. -* -* Notes -* (1) If there is not enough space in the "Up"-buffer, all data is dropped. -* (2) For performance reasons this function does not call Init() -* and may only be called after RTT has been initialized. -* Either by calling SEGGER_RTT_Init() or calling another RTT API function first. -*/ -unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { - const char* pData; - SEGGER_RTT_RING_BUFFER* pRing; - unsigned Avail; - unsigned RdOff; - unsigned WrOff; - unsigned Rem; - - pData = (const char *)pBuffer; - // - // Get "to-host" ring buffer and copy some elements into local variables. - // - pRing = &_SEGGER_RTT.aUp[BufferIndex]; - RdOff = pRing->RdOff; - WrOff = pRing->WrOff; - // - // Handle the most common cases fastest. - // Which is: - // RdOff <= WrOff -> Space until wrap around is free. - // AND - // WrOff + NumBytes < SizeOfBuffer -> No Wrap around necessary. - // - // OR - // - // RdOff > WrOff -> Space until RdOff - 1 is free. - // AND - // WrOff + NumBytes < RdOff -> Data fits into buffer - // - if (RdOff <= WrOff) { - // - // Get space until WrOff will be at wrap around. - // - Avail = pRing->SizeOfBuffer - 1u - WrOff ; - if (Avail >= NumBytes) { - memcpy(pRing->pBuffer + WrOff, pData, NumBytes); - pRing->WrOff = WrOff + NumBytes; - return 1; - } - // - // If data did not fit into space until wrap around calculate complete space in buffer. - // - Avail += RdOff; - // - // If there is still no space for the whole of this output, don't bother. - // - if (Avail >= NumBytes) { - // - // OK, we have enough space in buffer. Copy in one or 2 chunks - // - Rem = pRing->SizeOfBuffer - WrOff; // Space until end of buffer - if (Rem > NumBytes) { - memcpy(pRing->pBuffer + WrOff, pData, NumBytes); - pRing->WrOff = WrOff + NumBytes; - } else { - // - // We reach the end of the buffer, so need to wrap around - // - memcpy(pRing->pBuffer + WrOff, pData, Rem); - memcpy(pRing->pBuffer, pData + Rem, NumBytes - Rem); - pRing->WrOff = NumBytes - Rem; - } - return 1; - } - } else { - Avail = RdOff - WrOff - 1u; - if (Avail >= NumBytes) { - memcpy(pRing->pBuffer + WrOff, pData, NumBytes); - pRing->WrOff = WrOff + NumBytes; - return 1; - } - } - // - // If we reach this point no data has been written - // - return 0; -} - -/********************************************************************* -* -* SEGGER_RTT_WriteNoLock -* -* Function description -* Stores a specified number of characters in SEGGER RTT -* control block which is then read by the host. -* SEGGER_RTT_WriteNoLock does not lock the application. -* -* Parameters -* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). -* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. -* NumBytes Number of bytes to be stored in the SEGGER RTT control block. -* -* Return value -* Number of bytes which have been stored in the "Up"-buffer. -* -* Notes -* (1) If there is not enough space in the "Up"-buffer, remaining characters of pBuffer are dropped. -* (2) For performance reasons this function does not call Init() -* and may only be called after RTT has been initialized. -* Either by calling SEGGER_RTT_Init() or calling another RTT API function first. -*/ -unsigned SEGGER_RTT_WriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { - unsigned Status; - unsigned Avail; - const char* pData; - SEGGER_RTT_RING_BUFFER *pRing; - - pData = (const char *)pBuffer; - // - // Get "to-host" ring buffer. - // - pRing = &_SEGGER_RTT.aUp[BufferIndex]; - // - // How we output depends upon the mode... - // - switch (pRing->Flags) { - case SEGGER_RTT_MODE_NO_BLOCK_SKIP: - // - // If we are in skip mode and there is no space for the whole - // of this output, don't bother. - // - Avail = _GetAvailWriteSpace(pRing); - if (Avail < NumBytes) { - Status = 0u; - } else { - Status = NumBytes; - _WriteNoCheck(pRing, pData, NumBytes); - } - break; - case SEGGER_RTT_MODE_NO_BLOCK_TRIM: - // - // If we are in trim mode, trim to what we can output without blocking. - // - Avail = _GetAvailWriteSpace(pRing); - Status = Avail < NumBytes ? Avail : NumBytes; - _WriteNoCheck(pRing, pData, Status); - break; - case SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL: - // - // If we are in blocking mode, output everything. - // - Status = _WriteBlocking(pRing, pData, NumBytes); - break; - default: - Status = 0u; - break; - } - // - // Finish up. - // - return Status; -} - -/********************************************************************* -* -* SEGGER_RTT_Write -* -* Function description -* Stores a specified number of characters in SEGGER RTT -* control block which is then read by the host. -* -* Parameters -* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). -* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. -* NumBytes Number of bytes to be stored in the SEGGER RTT control block. -* -* Return value -* Number of bytes which have been stored in the "Up"-buffer. -* -* Notes -* (1) If there is not enough space in the "Up"-buffer, remaining characters of pBuffer are dropped. -*/ -unsigned SEGGER_RTT_Write(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { - unsigned Status; - volatile unsigned SavedState; - // - INIT(); - SEGGER_RTT_LOCK(SavedState); - // - // Call the non-locking write function - // - Status = SEGGER_RTT_WriteNoLock(BufferIndex, pBuffer, NumBytes); - // - // Finish up. - // - SEGGER_RTT_UNLOCK(SavedState); - // - return Status; -} - -/********************************************************************* -* -* SEGGER_RTT_WriteString -* -* Function description -* Stores string in SEGGER RTT control block. -* This data is read by the host. -* -* Parameters -* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). -* s Pointer to string. -* -* Return value -* Number of bytes which have been stored in the "Up"-buffer. -* -* Notes -* (1) If there is not enough space in the "Up"-buffer, depending on configuration, -* remaining characters may be dropped or RTT module waits until there is more space in the buffer. -* (2) String passed to this function has to be \0 terminated -* (3) \0 termination character is *not* stored in RTT buffer -*/ -unsigned SEGGER_RTT_WriteString(unsigned BufferIndex, const char* s) { - unsigned Len; - - Len = STRLEN(s); - return SEGGER_RTT_Write(BufferIndex, s, Len); -} - -/********************************************************************* -* -* SEGGER_RTT_GetKey -* -* Function description -* Reads one character from the SEGGER RTT buffer. -* Host has previously stored data there. -* -* Return value -* < 0 - No character available (buffer empty). -* >= 0 - Character which has been read. (Possible values: 0 - 255) -* -* Notes -* (1) This function is only specified for accesses to RTT buffer 0. -*/ -int SEGGER_RTT_GetKey(void) { - char c; - int r; - - r = (int)SEGGER_RTT_Read(0u, &c, 1u); - if (r == 1) { - r = (int)(unsigned char)c; - } else { - r = -1; - } - return r; -} - -/********************************************************************* -* -* SEGGER_RTT_WaitKey -* -* Function description -* Waits until at least one character is avaible in the SEGGER RTT buffer. -* Once a character is available, it is read and this function returns. -* -* Return value -* >=0 - Character which has been read. -* -* Notes -* (1) This function is only specified for accesses to RTT buffer 0 -* (2) This function is blocking if no character is present in RTT buffer -*/ -int SEGGER_RTT_WaitKey(void) { - int r; - - do { - r = SEGGER_RTT_GetKey(); - } while (r < 0); - return r; -} - -/********************************************************************* -* -* SEGGER_RTT_HasKey -* -* Function description -* Checks if at least one character for reading is available in the SEGGER RTT buffer. -* -* Return value -* == 0 - No characters are available to read. -* == 1 - At least one character is available. -* -* Notes -* (1) This function is only specified for accesses to RTT buffer 0 -*/ -int SEGGER_RTT_HasKey(void) { - unsigned RdOff; - int r; - - INIT(); - RdOff = _SEGGER_RTT.aDown[0].RdOff; - if (RdOff != _SEGGER_RTT.aDown[0].WrOff) { - r = 1; - } else { - r = 0; - } - return r; -} - -/********************************************************************* -* -* SEGGER_RTT_HasData -* -* Function description -* Check if there is data from the host in the given buffer. -* -* Return value: -* ==0: No data -* !=0: Data in buffer -* -*/ -unsigned SEGGER_RTT_HasData(unsigned BufferIndex) { - SEGGER_RTT_RING_BUFFER *pRing; - unsigned v; - - pRing = &_SEGGER_RTT.aDown[BufferIndex]; - v = pRing->WrOff; - return v - pRing->RdOff; -} - - -/********************************************************************* -* -* SEGGER_RTT_ConfigUpBuffer -* -* Function description -* Run-time configuration of a specific up-buffer (T->H). -* Buffer to be configured is specified by index. -* This includes: Buffer address, size, name, flags, ... -* -* Parameters -* BufferIndex Index of the buffer to configure. -* sName Pointer to a constant name string. -* pBuffer Pointer to a buffer to be used. -* BufferSize Size of the buffer. -* Flags Operating modes. Define behavior if buffer is full (not enough space for entire message). -* -* Return value -* >= 0 - O.K. -* < 0 - Error -*/ -int SEGGER_RTT_ConfigUpBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) { - int r; - volatile unsigned SavedState; - - INIT(); - if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumUpBuffers) { - SEGGER_RTT_LOCK(SavedState); - if (BufferIndex > 0u) { - _SEGGER_RTT.aUp[BufferIndex].sName = sName; - _SEGGER_RTT.aUp[BufferIndex].pBuffer = pBuffer; - _SEGGER_RTT.aUp[BufferIndex].SizeOfBuffer = BufferSize; - _SEGGER_RTT.aUp[BufferIndex].RdOff = 0u; - _SEGGER_RTT.aUp[BufferIndex].WrOff = 0u; - } - _SEGGER_RTT.aUp[BufferIndex].Flags = Flags; - SEGGER_RTT_UNLOCK(SavedState); - r = 0; - } else { - r = -1; - } - return r; -} - -/********************************************************************* -* -* SEGGER_RTT_ConfigDownBuffer -* -* Function description -* Run-time configuration of a specific down-buffer (H->T). -* Buffer to be configured is specified by index. -* This includes: Buffer address, size, name, flags, ... -* -* Parameters -* BufferIndex Index of the buffer to configure. -* sName Pointer to a constant name string. -* pBuffer Pointer to a buffer to be used. -* BufferSize Size of the buffer. -* Flags Operating modes. Define behavior if buffer is full (not enough space for entire message). -* -* Return value -* >= 0 O.K. -* < 0 Error -*/ -int SEGGER_RTT_ConfigDownBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) { - int r; - volatile unsigned SavedState; - - INIT(); - if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumDownBuffers) { - SEGGER_RTT_LOCK(SavedState); - if (BufferIndex > 0u) { - _SEGGER_RTT.aDown[BufferIndex].sName = sName; - _SEGGER_RTT.aDown[BufferIndex].pBuffer = pBuffer; - _SEGGER_RTT.aDown[BufferIndex].SizeOfBuffer = BufferSize; - _SEGGER_RTT.aDown[BufferIndex].RdOff = 0u; - _SEGGER_RTT.aDown[BufferIndex].WrOff = 0u; - } - _SEGGER_RTT.aDown[BufferIndex].Flags = Flags; - SEGGER_RTT_UNLOCK(SavedState); - r = 0; - } else { - r = -1; - } - return r; -} - -/********************************************************************* -* -* SEGGER_RTT_SetNameUpBuffer -* -* Function description -* Run-time configuration of a specific up-buffer name (T->H). -* Buffer to be configured is specified by index. -* -* Parameters -* BufferIndex Index of the buffer to renamed. -* sName Pointer to a constant name string. -* -* Return value -* >= 0 O.K. -* < 0 Error -*/ -int SEGGER_RTT_SetNameUpBuffer(unsigned BufferIndex, const char* sName) { - int r; - volatile unsigned SavedState; - - INIT(); - if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumUpBuffers) { - SEGGER_RTT_LOCK(SavedState); - _SEGGER_RTT.aUp[BufferIndex].sName = sName; - SEGGER_RTT_UNLOCK(SavedState); - r = 0; - } else { - r = -1; - } - return r; -} - -/********************************************************************* -* -* SEGGER_RTT_SetNameDownBuffer -* -* Function description -* Run-time configuration of a specific Down-buffer name (T->H). -* Buffer to be configured is specified by index. -* -* Parameters -* BufferIndex Index of the buffer to renamed. -* sName Pointer to a constant name string. -* -* Return value -* >= 0 O.K. -* < 0 Error -*/ -int SEGGER_RTT_SetNameDownBuffer(unsigned BufferIndex, const char* sName) { - int r; - volatile unsigned SavedState; - - INIT(); - if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumDownBuffers) { - SEGGER_RTT_LOCK(SavedState); - _SEGGER_RTT.aDown[BufferIndex].sName = sName; - SEGGER_RTT_UNLOCK(SavedState); - r = 0; - } else { - r = -1; - } - return r; -} - -/********************************************************************* -* -* SEGGER_RTT_Init -* -* Function description -* Initializes the RTT Control Block. -* Should be used in RAM targets, at start of the application. -* -*/ -void SEGGER_RTT_Init (void) { - INIT(); -} - -/********************************************************************* -* -* SEGGER_RTT_SetTerminal -* -* Function description -* Sets the terminal to be used for output on channel 0. -* -* Parameters -* TerminalId Index of the terminal. -* -* Return value -* >= 0 O.K. -* < 0 Error (e.g. if RTT is configured for non-blocking mode and there was no space in the buffer to set the new terminal Id) -*/ -int SEGGER_RTT_SetTerminal (char TerminalId) { - char ac[2]; - SEGGER_RTT_RING_BUFFER *pRing; - volatile unsigned SavedState; - unsigned Avail; - int r; - // - INIT(); - // - r = 0; - ac[0] = 0xFFU; - if (TerminalId < (char)sizeof(_aTerminalId)) { // We only support a certain number of channels - ac[1] = _aTerminalId[(int)TerminalId]; - pRing = &_SEGGER_RTT.aUp[0]; // Buffer 0 is always reserved for terminal I/O, so we can use index 0 here, fixed - SEGGER_RTT_LOCK(SavedState); // Lock to make sure that no other task is writing into buffer, while we are and number of free bytes in buffer does not change downwards after checking and before writing - if ((pRing->Flags & SEGGER_RTT_MODE_MASK) == SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) { - _ActiveTerminal = TerminalId; - _WriteBlocking(pRing, ac, 2u); - } else { // Skipping mode or trim mode? => We cannot trim this command so handling is the same for both modes - Avail = _GetAvailWriteSpace(pRing); - if (Avail >= 2) { - _ActiveTerminal = TerminalId; // Only change active terminal in case of success - _WriteNoCheck(pRing, ac, 2u); - } else { - r = -1; - } - } - SEGGER_RTT_UNLOCK(SavedState); - } else { - r = -1; - } - return r; -} - -/********************************************************************* -* -* SEGGER_RTT_TerminalOut -* -* Function description -* Writes a string to the given terminal -* without changing the terminal for channel 0. -* -* Parameters -* TerminalId Index of the terminal. -* s String to be printed on the terminal. -* -* Return value -* >= 0 - Number of bytes written. -* < 0 - Error. -* -*/ -int SEGGER_RTT_TerminalOut (char TerminalId, const char* s) { - int Status; - unsigned FragLen; - unsigned Avail; - SEGGER_RTT_RING_BUFFER *pRing; - volatile unsigned SavedState; - // - INIT(); - // - // Validate terminal ID. - // - if (TerminalId < (char)sizeof(_aTerminalId)) { // We only support a certain number of channels - // - // Get "to-host" ring buffer. - // - pRing = &_SEGGER_RTT.aUp[0]; - // - // Need to be able to change terminal, write data, change back. - // Compute the fixed and variable sizes. - // - FragLen = strlen(s); - // - // How we output depends upon the mode... - // - SEGGER_RTT_LOCK(SavedState); - Avail = _GetAvailWriteSpace(pRing); - switch (pRing->Flags & SEGGER_RTT_MODE_MASK) { - case SEGGER_RTT_MODE_NO_BLOCK_SKIP: - // - // If we are in skip mode and there is no space for the whole - // of this output, don't bother switching terminals at all. - // - if (Avail < (FragLen + 4u)) { - Status = 0; - } else { - _PostTerminalSwitch(pRing, TerminalId); - Status = (int)_WriteBlocking(pRing, s, FragLen); - _PostTerminalSwitch(pRing, _ActiveTerminal); - } - break; - case SEGGER_RTT_MODE_NO_BLOCK_TRIM: - // - // If we are in trim mode and there is not enough space for everything, - // trim the output but always include the terminal switch. If no room - // for terminal switch, skip that totally. - // - if (Avail < 4u) { - Status = -1; - } else { - _PostTerminalSwitch(pRing, TerminalId); - Status = (int)_WriteBlocking(pRing, s, (FragLen < (Avail - 4u)) ? FragLen : (Avail - 4u)); - _PostTerminalSwitch(pRing, _ActiveTerminal); - } - break; - case SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL: - // - // If we are in blocking mode, output everything. - // - _PostTerminalSwitch(pRing, TerminalId); - Status = (int)_WriteBlocking(pRing, s, FragLen); - _PostTerminalSwitch(pRing, _ActiveTerminal); - break; - default: - Status = -1; - break; - } - // - // Finish up. - // - SEGGER_RTT_UNLOCK(SavedState); - } else { - Status = -1; - } - return Status; -} - - -/*************************** End of file ****************************/ diff --git a/arch/platform/nrf52dk/rtt/segger-rtt.h b/arch/platform/nrf52dk/rtt/segger-rtt.h deleted file mode 100644 index e3436c462..000000000 --- a/arch/platform/nrf52dk/rtt/segger-rtt.h +++ /dev/null @@ -1,204 +0,0 @@ -/********************************************************************* -* SEGGER MICROCONTROLLER GmbH & Co. KG * -* Solutions for real time microcontroller applications * -********************************************************************** -* * -* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * -* * -* www.segger.com Support: support@segger.com * -* * -********************************************************************** -* * -* All rights reserved. * -* * -* * This software may in its unmodified form be freely redistributed * -* in source form. * -* * The source code may be modified, provided the source code * -* retains the above copyright notice, this list of conditions and * -* the following disclaimer. * -* * Modified versions of this software in source or linkable form * -* may not be distributed without prior consent of SEGGER. * -* * This software may only be used for communication with SEGGER * -* J-Link debug probes. * -* * -* 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 SEGGER Microcontroller 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. * -* * -********************************************************************** ----------------------------END-OF-HEADER------------------------------ -File : SEGGER_RTT.h -Purpose : Implementation of SEGGER real-time transfer which allows - real-time communication on targets which support debugger - memory accesses while the CPU is running. ----------------------------------------------------------------------- -*/ - -#ifndef SEGGER_RTT_H -#define SEGGER_RTT_H - -#include "segger-rtt-conf.h" - -/********************************************************************* -* -* Defines, fixed -* -********************************************************************** -*/ - -/********************************************************************* -* -* Types -* -********************************************************************** -*/ - -// -// Description for a circular buffer (also called "ring buffer") -// which is used as up- (T->H) or down-buffer (H->T) -// -typedef struct { - const char* sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4" - char* pBuffer; // Pointer to start of buffer - unsigned SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty. - volatile unsigned WrOff; // Position of next item to be written by either host (down-buffer) or target (up-buffer). Must be volatile since it may be modified by host (down-buffer) - volatile unsigned RdOff; // Position of next item to be read by target (down-buffer) or host (up-buffer). Must be volatile since it may be modified by host (up-buffer) - unsigned Flags; // Contains configuration flags -} SEGGER_RTT_RING_BUFFER; - -// -// RTT control block which describes the number of buffers available -// as well as the configuration for each buffer -// -// -typedef struct { - char acID[16]; // Initialized to "SEGGER RTT" - int MaxNumUpBuffers; // Initialized to SEGGER_RTT_MAX_NUM_UP_BUFFERS (type. 2) - int MaxNumDownBuffers; // Initialized to SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (type. 2) - SEGGER_RTT_RING_BUFFER aUp[SEGGER_RTT_MAX_NUM_UP_BUFFERS]; // Up buffers, transferring information up from target via debug probe to host - SEGGER_RTT_RING_BUFFER aDown[SEGGER_RTT_MAX_NUM_DOWN_BUFFERS]; // Down buffers, transferring information down from host via debug probe to target -} SEGGER_RTT_CB; - -/********************************************************************* -* -* Global data -* -********************************************************************** -*/ -extern SEGGER_RTT_CB _SEGGER_RTT; - -/********************************************************************* -* -* RTT API functions -* -********************************************************************** -*/ -int SEGGER_RTT_ConfigUpBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags); -int SEGGER_RTT_ConfigDownBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags); -int SEGGER_RTT_GetKey (void); -unsigned SEGGER_RTT_HasData (unsigned BufferIndex); -int SEGGER_RTT_HasKey (void); -void SEGGER_RTT_Init (void); -unsigned SEGGER_RTT_Read (unsigned BufferIndex, void* pBuffer, unsigned BufferSize); -unsigned SEGGER_RTT_ReadNoLock (unsigned BufferIndex, void* pData, unsigned BufferSize); -int SEGGER_RTT_SetNameDownBuffer(unsigned BufferIndex, const char* sName); -int SEGGER_RTT_SetNameUpBuffer (unsigned BufferIndex, const char* sName); -int SEGGER_RTT_WaitKey (void); -unsigned SEGGER_RTT_Write (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes); -unsigned SEGGER_RTT_WriteNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes); -unsigned SEGGER_RTT_WriteSkipNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes); -unsigned SEGGER_RTT_WriteString (unsigned BufferIndex, const char* s); -// -// Function macro for performance optimization -// -#define SEGGER_RTT_HASDATA(n) (_SEGGER_RTT.aDown[n].WrOff - _SEGGER_RTT.aDown[n].RdOff) - -/********************************************************************* -* -* RTT "Terminal" API functions -* -********************************************************************** -*/ -int SEGGER_RTT_SetTerminal (char TerminalId); -int SEGGER_RTT_TerminalOut (char TerminalId, const char* s); - -/********************************************************************* -* -* RTT printf functions (require SEGGER_RTT_printf.c) -* -********************************************************************** -*/ -int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...); - -/********************************************************************* -* -* Defines -* -********************************************************************** -*/ - -// -// Operating modes. Define behavior if buffer is full (not enough space for entire message) -// -#define SEGGER_RTT_MODE_NO_BLOCK_SKIP (0U) // Skip. Do not block, output nothing. (Default) -#define SEGGER_RTT_MODE_NO_BLOCK_TRIM (1U) // Trim: Do not block, output as much as fits. -#define SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL (2U) // Block: Wait until there is space in the buffer. -#define SEGGER_RTT_MODE_MASK (3U) - -// -// Control sequences, based on ANSI. -// Can be used to control color, and clear the screen -// -#define RTT_CTRL_RESET "\e[0m" // Reset to default colors -#define RTT_CTRL_CLEAR "\e[2J" // Clear screen, reposition cursor to top left - -#define RTT_CTRL_TEXT_BLACK "\e[2;30m" -#define RTT_CTRL_TEXT_RED "\e[2;31m" -#define RTT_CTRL_TEXT_GREEN "\e[2;32m" -#define RTT_CTRL_TEXT_YELLOW "\e[2;33m" -#define RTT_CTRL_TEXT_BLUE "\e[2;34m" -#define RTT_CTRL_TEXT_MAGENTA "\e[2;35m" -#define RTT_CTRL_TEXT_CYAN "\e[2;36m" -#define RTT_CTRL_TEXT_WHITE "\e[2;37m" - -#define RTT_CTRL_TEXT_BRIGHT_BLACK "\e[1;30m" -#define RTT_CTRL_TEXT_BRIGHT_RED "\e[1;31m" -#define RTT_CTRL_TEXT_BRIGHT_GREEN "\e[1;32m" -#define RTT_CTRL_TEXT_BRIGHT_YELLOW "\e[1;33m" -#define RTT_CTRL_TEXT_BRIGHT_BLUE "\e[1;34m" -#define RTT_CTRL_TEXT_BRIGHT_MAGENTA "\e[1;35m" -#define RTT_CTRL_TEXT_BRIGHT_CYAN "\e[1;36m" -#define RTT_CTRL_TEXT_BRIGHT_WHITE "\e[1;37m" - -#define RTT_CTRL_BG_BLACK "\e[24;40m" -#define RTT_CTRL_BG_RED "\e[24;41m" -#define RTT_CTRL_BG_GREEN "\e[24;42m" -#define RTT_CTRL_BG_YELLOW "\e[24;43m" -#define RTT_CTRL_BG_BLUE "\e[24;44m" -#define RTT_CTRL_BG_MAGENTA "\e[24;45m" -#define RTT_CTRL_BG_CYAN "\e[24;46m" -#define RTT_CTRL_BG_WHITE "\e[24;47m" - -#define RTT_CTRL_BG_BRIGHT_BLACK "\e[4;40m" -#define RTT_CTRL_BG_BRIGHT_RED "\e[4;41m" -#define RTT_CTRL_BG_BRIGHT_GREEN "\e[4;42m" -#define RTT_CTRL_BG_BRIGHT_YELLOW "\e[4;43m" -#define RTT_CTRL_BG_BRIGHT_BLUE "\e[4;44m" -#define RTT_CTRL_BG_BRIGHT_MAGENTA "\e[4;45m" -#define RTT_CTRL_BG_BRIGHT_CYAN "\e[4;46m" -#define RTT_CTRL_BG_BRIGHT_WHITE "\e[4;47m" - - -#endif - -/*************************** End of file ****************************/ diff --git a/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 b/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 deleted file mode 100644 index f720a9ae8..000000000 --- a/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 +++ /dev/null @@ -1,47 +0,0 @@ -# openmote-cc2538 platform makefile - -### Allow the OpenMote-CC2538 platform to support different CC2538 chip revisions -ifeq ($(findstring REV_A1,$(BOARD_REVISION)),REV_A1) - CFLAGS+=-DCC2538_DEV_CONF=CC2538_DEV_CC2538SF23 -endif - -ifndef CONTIKI - $(error CONTIKI not defined! You must specify where CONTIKI resides!) -endif - -### Configure the build for the board and pull in board-specific sources -CONTIKI_TARGET_DIRS += . dev -PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET) - -### Include -CONTIKI_TARGET_SOURCEFILES += platform.c board.c -CONTIKI_TARGET_SOURCEFILES += leds-arch.c board-buttons.c openmote-sensors.c -CONTIKI_TARGET_SOURCEFILES += antenna.c adxl346.c max44009.c sht21.c tps62730.c - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -### Define the CPU directory -CONTIKI_CPU=$(ARCH_PATH)/cpu/cc2538 -include $(CONTIKI_CPU)/Makefile.cc2538 - -MODULES += os/storage/cfs - -PYTHON = python -BSL_FLAGS += -e --bootloader-invert-lines -w -v -b 450000 - -ifdef PORT - BSL_FLAGS += -p $(PORT) -endif - -BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py - -%.upload: $(OUT_BIN) $(OUT_ELF) -ifeq ($(wildcard $(BSL)), ) - @echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?" -else - $(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h \ - $(BUILD_DIR_BOARD)/$*.elf | grep -B1 LOAD | \ - grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \ - sort -g | head -1)) - $(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $< -endif diff --git a/arch/platform/openmote-cc2538/board.c b/arch/platform/openmote-cc2538/board.c deleted file mode 100644 index 664c0b8ee..000000000 --- a/arch/platform/openmote-cc2538/board.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-cc2538 - * @{ - * - * \file - * Board-initialisation for the OpenMote-CC2538 platform - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/antenna.h" -#include -#include -/*---------------------------------------------------------------------------*/ -static void -configure_unused_pins(void) -{ - /* FIXME */ -} -/*---------------------------------------------------------------------------*/ -void -board_init() -{ - antenna_init(); - configure_unused_pins(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/openmote-cc2538/board.h b/arch/platform/openmote-cc2538/board.h deleted file mode 100644 index 6e2a15e46..000000000 --- a/arch/platform/openmote-cc2538/board.h +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - * - * This file is part of the Contiki operating system. - * - */ -/* -------------------------------------------------------------------------- */ -/** - * \addtogroup openmote-cc2538 - * @{ - * - * \file - * This file provides connectivity information on LEDs, Buttons, UART and - * other OpenMote-CC2538 peripherals. - * - * This file can be used as the basis to configure other platforms using the - * cc2538 SoC. - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ - -#ifndef BOARD_H_ -#define BOARD_H_ -/*---------------------------------------------------------------------------*/ -#include "dev/gpio.h" -#include "dev/nvic.h" -/*---------------------------------------------------------------------------*/ -/** \name OpenMote-CC2538 LED configuration - * - * LEDs on the OpenMote-CC2538 are connected as follows: - * - LED1 (Red) -> PC4 - * - LED2 (Yellow) -> PC6 - * - LED3 (Green) -> PC7 - * - LED4 (Orange) -> PC5 - * - * @{ - */ -/*---------------------------------------------------------------------------*/ -#define LEDS_ARCH_L1_PORT GPIO_C_NUM -#define LEDS_ARCH_L1_PIN 4 -#define LEDS_ARCH_L2_PORT GPIO_C_NUM -#define LEDS_ARCH_L2_PIN 6 -#define LEDS_ARCH_L3_PORT GPIO_C_NUM -#define LEDS_ARCH_L3_PIN 7 -#define LEDS_ARCH_L4_PORT GPIO_C_NUM -#define LEDS_ARCH_L4_PIN 5 - -#define LEDS_CONF_RED 1 -#define LEDS_CONF_YELLOW 2 -#define LEDS_CONF_GREEN 4 -#define LEDS_CONF_ORANGE 8 - -#define LEDS_CONF_COUNT 4 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name USB configuration - * - * The USB pullup is driven by PC0 - */ -#define USB_PULLUP_PORT GPIO_C_NUM -#define USB_PULLUP_PIN 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART configuration - * - * On the OpenMote, the UART is connected to the - * following ports/pins - * - RX: PA0 - * - TX: PA1 - * - CTS: PB0 (Can only be used with UART1) - * - RTS: PD3 (Can only be used with UART1) - * - * We configure the port to use UART0. To use UART1, replace UART0_* with - * UART1_* below. - * @{ - */ -#define UART0_RX_PORT GPIO_A_NUM -#define UART0_RX_PIN 0 -#define UART0_TX_PORT GPIO_A_NUM -#define UART0_TX_PIN 1 - -#define UART1_RX_PORT GPIO_B_NUM -#define UART1_RX_PIN 0 -#define UART1_TX_PORT GPIO_D_NUM -#define UART1_TX_PIN 3 -#define UART1_CTS_PORT (-1) -#define UART1_CTS_PIN (-1) -#define UART1_RTS_PORT (-1) -#define UART1_RTS_PIN (-1) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name OpenMote-CC2538 Button configuration - * - * Buttons on the OpenMote-CC2538 are connected as follows: - * - BUTTON_USER -> PC3 - * @{ - */ -/** BUTTON_USER -> PC3 */ -#define BUTTON_USER_PORT GPIO_C_NUM -#define BUTTON_USER_PIN 3 -#define BUTTON_USER_VECTOR GPIO_C_IRQn -/* Notify various examples that we have Buttons */ -#define PLATFORM_HAS_BUTTON 1 -#define PLATFORM_SUPPORTS_BUTTON_HAL 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI0) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI0) lines. - * The SSI0 is currently used to interface with the Ethernet driver (ENC28J60) - * on the OpenBase board. - * @{ - */ -#define SPI_CLK_PORT GPIO_A_NUM -#define SPI_CLK_PIN 2 -#define SPI_MOSI_PORT GPIO_A_NUM -#define SPI_MOSI_PIN 5 -#define SPI_MISO_PORT GPIO_A_NUM -#define SPI_MISO_PIN 4 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI1) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI1) lines. - * The SSI1 is currently not used. - * @{ - */ -#define SPI1_CLK_PORT GPIO_C_NUM -#define SPI1_CLK_PIN 4 -#define SPI1_TX_PORT GPIO_C_NUM -#define SPI1_TX_PIN 5 -#define SPI1_RX_PORT GPIO_C_NUM -#define SPI1_RX_PIN 6 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name I2C configuration - * - * These values configure which CC2538 pins to use for the I2C lines. - * @{ - */ -#define I2C_SCL_PORT GPIO_B_NUM -#define I2C_SCL_PIN 3 -#define I2C_SDA_PORT GPIO_B_NUM -#define I2C_SDA_PIN 4 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name CC2538 TSCH configuration - * - * @{ - */ -#define RADIO_PHY_OVERHEAD CC2538_PHY_OVERHEAD -#define RADIO_BYTE_AIR_TIME CC2538_BYTE_AIR_TIME -#define RADIO_DELAY_BEFORE_TX CC2538_DELAY_BEFORE_TX -#define RADIO_DELAY_BEFORE_RX CC2538_DELAY_BEFORE_RX -#define RADIO_DELAY_BEFORE_DETECT CC2538_DELAY_BEFORE_DETECT -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "OpenMote-CC2538" -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/openmote-cc2538/contiki-conf.h b/arch/platform/openmote-cc2538/contiki-conf.h deleted file mode 100644 index daa203065..000000000 --- a/arch/platform/openmote-cc2538/contiki-conf.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2014, OpenMote Technologies, S.L. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-cc2538 - * @{ - * - * \defgroup openmote-cc2538-platforms OpenMote-CC2538 platform - * - * The OpenMote-CC2538 platform was designed at UC Berkeley in 2013 and - * is comercialized by OpenMote Technologies since 2014. It is the first - * commercial platform based on the powerful TI CC2538 SoC. It uses a - * XBee form-factor to ease prototyping. - * @{ - * - * \file - * Configuration for the OpenMote-CC2538 platform - */ -#ifndef CONTIKI_CONF_H_ -#define CONTIKI_CONF_H_ - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Include Project Specific conf */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif /* PROJECT_CONF_PATH */ -/*---------------------------------------------------------------------------*/ -#include "cc2538-def.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Serial Boot Loader Backdoor configuration - * - * @{ - */ -#ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR -#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR 1 /** - */ -/*---------------------------------------------------------------------------*/ -#include "dev/i2c.h" -#include "dev/adxl346.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/** - * \name ADXL346 address and device identifier - * @{ - */ -#define ADXL346_ADDRESS (0x53) -#define ADXL346_DEVID_VALUE (0xE6) -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name ADXL346 register addresses - * @{ - */ -#define ADXL346_DEVID_ADDR (0x00) -#define ADXL346_THRES_TAP_ADDR (0x1D) -#define ADXL346_OFSX_ADDR (0x1E) -#define ADXL346_OFSY_ADDR (0x1F) -#define ADXL346_OFSZ_ADDR (0x20) -#define ADXL346_DUR_ADDR (0x21) -#define ADXL346_LATENT_ADDR (0x22) -#define ADXL346_WINDOW_ADDR (0x23) -#define ADXL346_THRESH_ACT_ADDR (0x24) -#define ADXL346_THRESH_INACT_ADDR (0x25) -#define ADXL346_TIME_INACT_ADDR (0x26) -#define ADXL346_ACT_INACT_CTL_ADDR (0x27) -#define ADXL346_THRESH_FF_ADDR (0x28) -#define ADXL346_TIME_FF_ADDR (0x29) -#define ADXL346_TAP_AXES_ADDR (0x2A) -#define ADXL346_ACT_TAP_STATUS_ADDR (0x2B) -#define ADXL346_BW_RATE_ADDR (0x2C) -#define ADXL346_POWER_CTL_ADDR (0x2D) -#define ADXL346_INT_ENABLE_ADDR (0x2E) -#define ADXL346_INT_MAP_ADDR (0x2F) -#define ADXL346_INT_SOURCE_ADDR (0x30) -#define ADXL346_DATA_FORMAT_ADDR (0x31) -#define ADXL346_DATAX0_ADDR (0x32) -#define ADXL346_DATAX1_ADDR (0x33) -#define ADXL346_DATAY0_ADDR (0x34) -#define ADXL346_DATAY1_ADDR (0x35) -#define ADXL346_DATAZ0_ADDR (0x36) -#define ADXL346_DATAZ1_ADDR (0x37) -#define ADXL346_FIFO_CTL_ADDR (0x38) -#define ADXL346_FIFO_STATUS_ADDR (0x39) -#define ADXL346_TAP_SIGN_ADDR (0x3A) -#define ADXL346_ORIENT_CONF_ADDR (0x3B) -#define ADXL346_ORIENT_ADDR (0x3C) -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name ADXL346 register values - * @{ - */ -#define ADXL346_INT_ENABLE_DATA_READY (1 << 7) -#define ADXL346_INT_ENABLE_SINGLE_TAP (1 << 6) -#define ADXL346_INT_ENABLE_DOUBLE_TAP (1 << 5) -#define ADXL346_INT_ENABLE_ACTIVITY (1 << 4) -#define ADXL346_INT_ENABLE_INACTIVITY (1 << 3) -#define ADXL346_INT_ENABLE_FREE_FALL (1 << 2) -#define ADXL346_INT_ENABLE_WATERMARK (1 << 1) -#define ADXL346_INT_ENABLE_OVERRUN (1 << 0) - -#define ADXL346_ACT_INACT_CTL_ACT_ACDC (1 << 7) -#define ADXL346_ACT_INACT_CTL_ACT_X_EN (1 << 6) -#define ADXL346_ACT_INACT_CTL_ACT_Y_EN (1 << 5) -#define ADXL346_ACT_INACT_CTL_ACT_Z_EN (1 << 4) -#define ADXL346_ACT_INACT_CTL_INACT_ACDC (1 << 3) -#define ADXL346_ACT_INACT_CTL_INACT_X_EN (1 << 2) -#define ADXL346_ACT_INACT_CTL_INACT_Y_EN (1 << 1) -#define ADXL346_ACT_INACT_CTL_INACT_Z_EN (1 << 0) - -#define ADXL346_TAP_AXES_SUPPRESS (1 << 3) -#define ADXL346_TAP_AXES_TAP_X_EN (1 << 2) -#define ADXL346_TAP_AXES_TAP_Y_EN (1 << 1) -#define ADXL346_TAP_AXES_TAP_Z_EN (1 << 0) - -#define ADXL346_ACT_TAP_STATUS_ACT_X_SRC (1 << 6) -#define ADXL346_ACT_TAP_STATUS_ACT_Y_SRC (1 << 5) -#define ADXL346_ACT_TAP_STATUS_ACT_Z_SRC (1 << 4) -#define ADXL346_ACT_TAP_STATUS_ASLEEP (1 << 3) -#define ADXL346_ACT_TAP_STATUS_TAP_X_SRC (1 << 2) -#define ADXL346_ACT_TAP_STATUS_TAP_Y_SRC (1 << 1) -#define ADXL346_ACT_TAP_STATUS_TAP_Z_SRC (1 << 0) - -#define ADXL346_BW_RATE_POWER (1 << 4) -#define ADXL346_BW_RATE_RATE(x) ((x) & 0x0F) - -#define ADXL346_POWER_CTL_LINK (1 << 5) -#define ADXL346_POWER_CTL_AUTO_SLEEP (1 << 4) -#define ADXL346_POWER_CTL_MEASURE (1 << 3) -#define ADXL346_POWER_CTL_SLEEP (1 << 2) -#define ADXL346_POWER_CTL_WAKEUP(x) ((x) & 0x03) - -#define ADXL346_DATA_FORMAT_SELF_TEST (1 << 7) -#define ADXL346_DATA_FORMAT_SPI (1 << 6) -#define ADXL346_DATA_FORMAT_INT_INVERT (1 << 5) -#define ADXL346_DATA_FORMAT_FULL_RES (1 << 3) -#define ADXL346_DATA_FORMAT_JUSTIFY (1 << 2) -#define ADXL346_DATA_FORMAT_RANGE(x) ((x) & 0x03) -#define ADXL346_DATA_FORMAT_RANGE_PM_2g (0) -#define ADXL346_DATA_FORMAT_RANGE_PM_4g (1) -#define ADXL346_DATA_FORMAT_RANGE_PM_8g (2) -#define ADXL346_DATA_FORMAT_RANGE_PM_16g (3) - -#define ADXL346_USER_CONFIGURATION (ADXL346_DATA_FORMAT_RANGE_PM_2g) - -/** @} */ -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -/*---------------------------------------------------------------------------*/ -static void -adxl346_init(void) -{ - uint8_t config[2]; - - config[0] = ADXL346_BW_RATE_ADDR; - config[1] = (ADXL346_BW_RATE_RATE(6)); - i2c_burst_send(ADXL346_ADDRESS, config, sizeof(config)); - - config[0] = ADXL346_DATA_FORMAT_ADDR; - config[1] = (ADXL346_USER_CONFIGURATION); - i2c_burst_send(ADXL346_ADDRESS, config, sizeof(config)); - - config[0] = ADXL346_POWER_CTL_ADDR; - config[1] = (ADXL346_POWER_CTL_MEASURE); - i2c_burst_send(ADXL346_ADDRESS, config, sizeof(config)); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -adxl346_is_present(void) -{ - uint8_t is_present; - - i2c_single_send(ADXL346_ADDRESS, ADXL346_DEVID_ADDR); - i2c_single_receive(ADXL346_ADDRESS, &is_present); - - return is_present == ADXL346_DEVID_VALUE; -} -/*---------------------------------------------------------------------------*/ -static int16_t -adxl346_read_accel(uint8_t addr1, uint8_t addr2) -{ - uint8_t acceleration[2]; - int16_t result; - - i2c_single_send(ADXL346_ADDRESS, addr1); - i2c_single_receive(ADXL346_ADDRESS, &acceleration[0]); - i2c_single_send(ADXL346_ADDRESS, addr2); - i2c_single_receive(ADXL346_ADDRESS, &acceleration[1]); - - result = (acceleration[1] << 8) | acceleration[0]; - - return result; -} -/*---------------------------------------------------------------------------*/ -static int16_t -adxl346_convert_accel(int16_t accel) -{ - int32_t result; - - result = (1000 * accel) / 256; - - return (int16_t)result; -} -/*---------------------------------------------------------------------------*/ -static void -adxl346_calibrate_offset(void) -{ - int32_t accum_x = 0; - int32_t accum_y = 0; - int32_t accum_z = 0; - uint8_t config[2]; - int8_t offset; - - config[0] = ADXL346_OFSX_ADDR; - config[1] = 0; - i2c_burst_send(ADXL346_ADDRESS, config, sizeof(config)); - config[0] = ADXL346_OFSY_ADDR; - config[1] = 0; - i2c_burst_send(ADXL346_ADDRESS, config, sizeof(config)); - config[0] = ADXL346_OFSZ_ADDR; - config[1] = 0; - i2c_burst_send(ADXL346_ADDRESS, config, sizeof(config)); - - uint16_t i; - for(i = 0; i < 100; i++) { - uint16_t x, y, z; - - x = adxl346_read_accel(ADXL346_DATAX0_ADDR, ADXL346_DATAX1_ADDR); - accum_x += x; - - y = adxl346_read_accel(ADXL346_DATAY0_ADDR, ADXL346_DATAY1_ADDR); - accum_y += y; - - z = adxl346_read_accel(ADXL346_DATAZ0_ADDR, ADXL346_DATAZ1_ADDR); - accum_z += z; - } - - offset = (64 * accum_x) / 25600; - config[0] = ADXL346_OFSX_ADDR; - config[1] = -offset; - i2c_burst_send(ADXL346_ADDRESS, config, sizeof(config)); - PRINTF("ADXL346: X calibration offset is %d\n", offset); - - offset = (64 * accum_y) / 25600; - config[0] = ADXL346_OFSY_ADDR; - config[1] = -offset; - i2c_burst_send(ADXL346_ADDRESS, config, sizeof(config)); - PRINTF("ADXL346: Y calibration offset is %d\n", offset); - - offset = (64 * accum_z) / 25600; - config[0] = ADXL346_OFSZ_ADDR; - config[1] = -offset; - i2c_burst_send(ADXL346_ADDRESS, config, sizeof(config)); - PRINTF("ADXL346: Z calibration offset is %d\n", offset); -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - int16_t accel; - if(!enabled) { - PRINTF("ADXL346: sensor not started\n"); - return ADXL346_ERROR; - } - - if(type == ADXL346_READ_X) { - return adxl346_read_accel(ADXL346_DATAX0_ADDR, ADXL346_DATAX1_ADDR); - } else if(type == ADXL346_READ_Y) { - return adxl346_read_accel(ADXL346_DATAY0_ADDR, ADXL346_DATAY1_ADDR); - } else if(type == ADXL346_READ_Z) { - return adxl346_read_accel(ADXL346_DATAZ0_ADDR, ADXL346_DATAZ1_ADDR); - } else if(type == ADXL346_READ_X_mG) { - accel = adxl346_read_accel(ADXL346_DATAX0_ADDR, ADXL346_DATAX1_ADDR); - return adxl346_convert_accel(accel); - } else if(type == ADXL346_READ_Y_mG) { - accel = adxl346_read_accel(ADXL346_DATAY0_ADDR, ADXL346_DATAY1_ADDR); - return adxl346_convert_accel(accel); - } else if(type == ADXL346_READ_Z_mG) { - accel = adxl346_read_accel(ADXL346_DATAZ0_ADDR, ADXL346_DATAZ1_ADDR); - return adxl346_convert_accel(accel); - } else { - PRINTF("ADXL346: invalid value requested\n"); - return ADXL346_ERROR; - } - - return ADXL346_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type == ADXL346_ACTIVATE) { - if(!adxl346_is_present()) { - PRINTF("ADXL346: is not present\n"); - enabled = 0; - return ADXL346_ERROR; - } else { - adxl346_init(); - enabled = 1; - return ADXL346_SUCCESS; - } - } - - if(type == ADXL346_CALIB_OFFSET && enabled) { - adxl346_calibrate_offset(); - return ADXL346_SUCCESS; - } - - return ADXL346_ERROR; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(adxl346, ADXL346_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/openmote-cc2538/dev/adxl346.h b/arch/platform/openmote-cc2538/dev/adxl346.h deleted file mode 100644 index 401e601d1..000000000 --- a/arch/platform/openmote-cc2538/dev/adxl346.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2014, OpenMote Technologies, S.L. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-sensors - * @{ - * - * \defgroup openmote-adxl346-sensor ADXL346 acceleration sensor - * @{ - * - * \file - * ADXL346 acceleration sensor driver header file - * - * \author - * Pere Tuset - */ -/*---------------------------------------------------------------------------*/ -#ifndef ADXL346_H_ -#define ADXL346_H_ -/*---------------------------------------------------------------------------*/ -#define ADXL346_ERROR (-1) -#define ADXL346_SUCCESS (0) -#define ADXL346_ACTIVATE (SENSORS_ACTIVE) -#define ADXL346_READ_X (2) -#define ADXL346_READ_X_mG (3) -#define ADXL346_READ_Y (4) -#define ADXL346_READ_Y_mG (5) -#define ADXL346_READ_Z (6) -#define ADXL346_READ_Z_mG (7) -#define ADXL346_CALIB_OFFSET (8) -#define ADXL346_NONE (9) -/*---------------------------------------------------------------------------*/ -#define ADXL346_SENSOR "ADXL346 Sensor" -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor adxl346; -/*---------------------------------------------------------------------------*/ -#endif /* ADXL346_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/openmote-cc2538/dev/antenna.c b/arch/platform/openmote-cc2538/dev/antenna.c deleted file mode 100644 index 4018ddeb3..000000000 --- a/arch/platform/openmote-cc2538/dev/antenna.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2014, Thingsquare, http://www.thingsquare.com/. - * 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. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-antenna - * @{ - * - * Driver for the OpenMote-CC2538 RF switch. - * INT is the internal antenna (chip) configured through ANT1_SEL (V1) - * EXT is the external antenna (connector) configured through ANT2_SEL (V2) - * @{ - * - * \file - * Driver implementation for the OpenMote-CC2538 antenna switch - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio.h" -#include "dev/antenna.h" -/*---------------------------------------------------------------------------*/ -#define BSP_RADIO_BASE GPIO_PORT_TO_BASE(GPIO_D_NUM) -#define BSP_RADIO_INT GPIO_PIN_MASK(5) -#define BSP_RADIO_EXT GPIO_PIN_MASK(4) -/*---------------------------------------------------------------------------*/ -void -antenna_init(void) -{ - /* Configure the ANT1 and ANT2 GPIO as output */ - GPIO_SET_OUTPUT(BSP_RADIO_BASE, BSP_RADIO_INT); - GPIO_SET_OUTPUT(BSP_RADIO_BASE, BSP_RADIO_EXT); - - /* Select external antenna by default. */ - antenna_external(); -} -/*---------------------------------------------------------------------------*/ -void -antenna_external(void) -{ - GPIO_WRITE_PIN(BSP_RADIO_BASE, BSP_RADIO_INT, 0); - GPIO_WRITE_PIN(BSP_RADIO_BASE, BSP_RADIO_EXT, 1); -} -/*---------------------------------------------------------------------------*/ -void -antenna_internal(void) -{ - GPIO_WRITE_PIN(BSP_RADIO_BASE, BSP_RADIO_EXT, 0); - GPIO_WRITE_PIN(BSP_RADIO_BASE, BSP_RADIO_INT, 1); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/openmote-cc2538/dev/antenna.h b/arch/platform/openmote-cc2538/dev/antenna.h deleted file mode 100644 index 9c42bf885..000000000 --- a/arch/platform/openmote-cc2538/dev/antenna.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014, Thingsquare, http://www.thingsquare.com/. - * 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. - * - * This file is part of the Contiki operating system. - * - */ -/*--------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-cc2538 - * @{ - * - * \defgroup openmote-antenna OpenMote-CC2538 antenna switch - * - * Driver for the OpenMote-CC2538 antenna switch - * @{ - * - * \file - * Header for the OpenMote-CC2538 antenna switch - */ -/*---------------------------------------------------------------------------*/ -#ifndef ANTENNA_H_ -#define ANTENNA_H_ -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the antenna switch, by default it uses the external - */ -void antenna_init(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Select the external (connector) antenna - */ -void antenna_internal(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Select the internal (chip) antenna - */ -void antenna_external(void); -/*---------------------------------------------------------------------------*/ -#endif /* ANTENNA_H_ */ -/** - * @} - * @} - */ diff --git a/arch/platform/openmote-cc2538/dev/board-buttons.c b/arch/platform/openmote-cc2538/dev/board-buttons.c deleted file mode 100644 index 654302f24..000000000 --- a/arch/platform/openmote-cc2538/dev/board-buttons.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-cc2538 - * @{ - * - * \defgroup openmote-cc2538-buttons OpenMote-CC2538 user button - * - * Generic module controlling the user button on the OpenMote-CC2538 - * @{ - * - * \file - * Defines the OpenMote-CC2538 user button for use with the button HAL - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/button-hal.h" -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTON(button_user, "User button", \ - GPIO_PORT_PIN_TO_GPIO_HAL_PIN(BUTTON_USER_PORT, BUTTON_USER_PIN), \ - GPIO_HAL_PIN_CFG_PULL_UP, BUTTON_HAL_ID_USER_BUTTON, true); -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTONS(&button_user); -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/openmote-cc2538/dev/leds-arch.c b/arch/platform/openmote-cc2538/dev/leds-arch.c deleted file mode 100644 index 3c1fe333f..000000000 --- a/arch/platform/openmote-cc2538/dev/leds-arch.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/leds.h" -#include "dev/gpio-hal.h" - -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L1_PORT, LEDS_ARCH_L1_PIN), - .negative_logic = false - }, - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L2_PORT, LEDS_ARCH_L2_PIN), - .negative_logic = false - }, - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L3_PORT, LEDS_ARCH_L3_PIN), - .negative_logic = false - }, - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L4_PORT, LEDS_ARCH_L4_PIN), - .negative_logic = false - }, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/openmote-cc2538/dev/max44009.c b/arch/platform/openmote-cc2538/dev/max44009.c deleted file mode 100644 index d7f4e90d9..000000000 --- a/arch/platform/openmote-cc2538/dev/max44009.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2014, OpenMote Technologies, S.L. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-max44009-sensor - * @{ - * - * \file - * Driver for the MAX44009 light sensor - * - * \author - * Pere Tuset - */ -/*---------------------------------------------------------------------------*/ -#include "dev/i2c.h" -#include "dev/max44009.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 1 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/** - * \name MAX44009 address and device identifier - * @{ - */ -#define MAX44009_ADDRESS (0x4A) -#define MAX44009_NOT_FOUND (0x00) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name MAX44009 register addresses - * @{ - */ -#define MAX44009_INT_STATUS_ADDR (0x00) /* R */ -#define MAX44009_INT_ENABLE_ADDR (0x01) /* R/W */ -#define MAX44009_CONFIG_ADDR (0x02) /* R/W */ -#define MAX44009_LUX_HIGH_ADDR (0x03) /* R */ -#define MAX44009_LUX_LOW_ADDR (0x04) /* R */ -#define MAX44009_THR_HIGH_ADDR (0x05) /* R/W */ -#define MAX44009_THR_LOW_ADDR (0x06) /* R/W */ -#define MAX44009_THR_TIMER_ADDR (0x07) /* R/W */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name MAX44009 register values - * @{ - */ -#define MAX44009_INT_STATUS_OFF (0x00) -#define MAX44009_INT_STATUS_ON (0x01) -#define MAX44009_INT_DISABLED (0x00) -#define MAX44009_INT_ENABLED (0x01) - -#define MAX44009_CONFIG_DEFAULT (0 << 7) -#define MAX44009_CONFIG_CONTINUOUS (1 << 7) -#define MAX44009_CONFIG_AUTO (0 << 6) -#define MAX44009_CONFIG_MANUAL (1 << 6) -#define MAX44009_CONFIG_CDR_NORMAL (0 << 5) -#define MAX44009_CONFIG_CDR_DIVIDED (1 << 5) -#define MAX44009_CONFIG_INTEGRATION_800ms (0 << 0) -#define MAX44009_CONFIG_INTEGRATION_400ms (1 << 0) -#define MAX44009_CONFIG_INTEGRATION_200ms (2 << 0) -#define MAX44009_CONFIG_INTEGRATION_100ms (3 << 0) -#define MAX44009_CONFIG_INTEGRATION_50ms (4 << 0) -#define MAX44009_CONFIG_INTEGRATION_25ms (5 << 0) -#define MAX44009_CONFIG_INTEGRATION_12ms (6 << 0) -#define MAX44009_CONFIG_INTEGRATION_6ms (7 << 0) - -#define MAX44009_DEFAULT_CONFIGURATION (MAX44009_CONFIG_DEFAULT | \ - MAX44009_CONFIG_AUTO | \ - MAX44009_CONFIG_CDR_NORMAL | \ - MAX44009_CONFIG_INTEGRATION_100ms) - -#define MAX44009_USER_CONFIGURATION (MAX44009_CONFIG_DEFAULT | \ - MAX44009_CONFIG_AUTO | \ - MAX44009_CONFIG_CDR_NORMAL | \ - MAX44009_CONFIG_INTEGRATION_800ms) - -/** @} */ -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -/*---------------------------------------------------------------------------*/ -static void -max44009_init(void) -{ - uint8_t max44009_address[5] = { MAX44009_INT_ENABLE_ADDR, MAX44009_CONFIG_ADDR, \ - MAX44009_THR_HIGH_ADDR, MAX44009_THR_LOW_ADDR, \ - MAX44009_THR_TIMER_ADDR }; - uint8_t max44009_value[5]; - uint8_t max44009_data[2]; - uint8_t i; - - max44009_value[0] = (MAX44009_INT_STATUS_OFF); - max44009_value[1] = (MAX44009_USER_CONFIGURATION); - max44009_value[2] = (0xFF); - max44009_value[3] = (0x00); - max44009_value[4] = (0xFF); - - for(i = 0; i < sizeof(max44009_address) / sizeof(max44009_address[0]); i++) { - max44009_data[0] = max44009_address[i]; - max44009_data[1] = max44009_value[i]; - i2c_burst_send(MAX44009_ADDRESS, max44009_data, 2); - } -} -/*---------------------------------------------------------------------------*/ -static void -max44009_reset(void) -{ - uint8_t max44009_address[5] = { MAX44009_INT_ENABLE_ADDR, MAX44009_CONFIG_ADDR, \ - MAX44009_THR_HIGH_ADDR, MAX44009_THR_LOW_ADDR, \ - MAX44009_THR_TIMER_ADDR }; - uint8_t max44009_value[5] = { 0x00, 0x03, 0xFF, 0x00, 0xFF }; - uint8_t max44009_data[2]; - uint8_t i; - - for(i = 0; i < sizeof(max44009_address) / sizeof(max44009_address[0]); i++) { - max44009_data[0] = max44009_address[i]; - max44009_data[1] = max44009_value[i]; - i2c_burst_send(MAX44009_ADDRESS, max44009_data, 2); - } -} -/*---------------------------------------------------------------------------*/ -static uint8_t -max44009_is_present(void) -{ - uint8_t status; - uint8_t is_present; - - i2c_single_send(MAX44009_ADDRESS, MAX44009_CONFIG_ADDR); - status = i2c_single_receive(MAX44009_ADDRESS, &is_present); - if(status != I2C_MASTER_ERR_NONE) { - return 0; - } - - return is_present != MAX44009_NOT_FOUND; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -max44009_read_light(void) -{ - uint8_t exponent, mantissa; - uint8_t max44009_data[2]; - uint32_t result; - - i2c_single_send(MAX44009_ADDRESS, MAX44009_LUX_HIGH_ADDR); - i2c_single_receive(MAX44009_ADDRESS, &max44009_data[0]); - i2c_single_send(MAX44009_ADDRESS, MAX44009_LUX_LOW_ADDR); - i2c_single_receive(MAX44009_ADDRESS, &max44009_data[1]); - - exponent = ((max44009_data[0] >> 4) & 0x0E); - mantissa = ((max44009_data[0] & 0x0F) << 4) | (max44009_data[1] & 0x0F); - - result = ((uint16_t)exponent << 8) | ((uint16_t)mantissa << 0); - - return result; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -max44009_convert_light(uint16_t lux) -{ - uint8_t exponent, mantissa; - uint32_t result; - - exponent = (lux >> 8) & 0xFF; - exponent = (exponent == 0x0F ? exponent & 0x0E : exponent); - mantissa = (lux >> 0) & 0xFF; - - result = 45 * (2 ^ exponent * mantissa) / 10; - - return (uint16_t)result; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - uint16_t value; - - if(!enabled) { - PRINTF("MAX44009: sensor not started\n"); - return MAX44009_ERROR; - } - - if(type == MAX44009_READ_RAW_LIGHT) { - return max44009_read_light(); - } else if(type == MAX44009_READ_LIGHT) { - value = max44009_read_light(); - return max44009_convert_light(value); - } else { - PRINTF("MAX44009: invalid value requested\n"); - return MAX44009_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type == MAX44009_ACTIVATE) { - if(!max44009_is_present()) { - return MAX44009_ERROR; - } else { - max44009_init(); - enabled = 1; - return MAX44009_SUCCESS; - } - } - - if((type == MAX44009_RESET) && enabled) { - max44009_reset(); - return MAX44009_SUCCESS; - } else { - PRINTF("MAX44009: is not enabled\n"); - return MAX44009_ERROR; - } - - return MAX44009_ERROR; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(max44009, MAX44009_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/openmote-cc2538/dev/max44009.h b/arch/platform/openmote-cc2538/dev/max44009.h deleted file mode 100644 index 32ba101e8..000000000 --- a/arch/platform/openmote-cc2538/dev/max44009.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2014, OpenMote Technologies, S.L. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-sensors - * @{ - * - * \defgroup openmote-max44009-sensor MAX4009 light sensor - * @{ - * - * \file - * Header file for the MAX44009 light sensor driver - * - * \author - * Pere Tuset - */ -/*---------------------------------------------------------------------------*/ -#ifndef MAX44009_H_ -#define MAX44009_H_ -/*---------------------------------------------------------------------------*/ -#define MAX44009_ERROR (-1) -#define MAX44009_SUCCESS (0) -#define MAX44009_ACTIVATE (SENSORS_ACTIVE) -#define MAX44009_READ_RAW_LIGHT (2) -#define MAX44009_READ_LIGHT (3) -#define MAX44009_RESET (4) -#define MAX44009_NONE (5) -/*---------------------------------------------------------------------------*/ -#define MAX44009_SENSOR "MAX44009 Sensor" -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor max44009; -/*---------------------------------------------------------------------------*/ -#endif /* MAX44009_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/openmote-cc2538/dev/openmote-sensors.c b/arch/platform/openmote-cc2538/dev/openmote-sensors.c deleted file mode 100644 index 772087fa9..000000000 --- a/arch/platform/openmote-cc2538/dev/openmote-sensors.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-sensors - * @{ - * - * Generic module controlling sensors on the OpenMote-CC2538 platform - * @{ - * - * \file - * Implementation of a generic module controlling OpenMote-CC2538 sensors - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/cc2538-sensors.h" -#include "dev/button-sensor.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Exports a global symbol to be used by the sensor API - */ -SENSORS(&cc2538_temp_sensor); -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/openmote-cc2538/dev/openmote-sensors.h b/arch/platform/openmote-cc2538/dev/openmote-sensors.h deleted file mode 100644 index 811518625..000000000 --- a/arch/platform/openmote-cc2538/dev/openmote-sensors.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-cc2538 - * @{ - * - * \defgroup openmote-sensors OpenMote-CC2538 sensors - * - * Generic module controlling sensors on the OpenMote-CC2538 platform - * @{ - * - * \file - * Implementation of a generic module controlling OpenMote-CC2538 sensors - */ -/*---------------------------------------------------------------------------*/ -#ifndef OPENMOTE_SENSORS_H_ -#define OPENMOTE_SENSORS_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -#include "dev/cc2538-sensors.h" -/*---------------------------------------------------------------------------*/ -#endif /* OPENMOTE_SENSORS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/openmote-cc2538/dev/sht21.c b/arch/platform/openmote-cc2538/dev/sht21.c deleted file mode 100644 index 4fd577e01..000000000 --- a/arch/platform/openmote-cc2538/dev/sht21.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (c) 2014, OpenMote Technologies, S.L. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-sht21-sensor - * @{ - * - * \file - * Driver for the SHT21 temperature and relative humidity sensor - * - * \author - * Pere Tuset - */ -/*---------------------------------------------------------------------------*/ -#include "dev/i2c.h" -#include "dev/sht21.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/** - * \name SHT21 address - */ -#define SHT21_ADDRESS (0x40) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SHT21 register addresses and values - * @{ - */ -#define SHT21_USER_REG_READ (0xE7) -#define SHT21_USER_REG_WRITE (0xE6) -#define SHT21_USER_REG_RESERVED_BITS (0x38) - -#define SHT21_TEMPERATURE_HM_CMD (0xE3) -#define SHT21_HUMIDITY_HM_CMD (0xE5) -#define SHT21_TEMPERATURE_NHM_CMD (0xF3) -#define SHT21_HUMIDITY_NHM_CMD (0xF5) -#define SHT21_RESET_CMD (0xFE) - -#define SHT21_STATUS_MASK (0xFC) - -#define SHT21_RESOLUTION_12b_14b ((0 << 7) | (0 << 0)) -#define SHT21_RESOLUTION_8b_12b ((0 << 7) | (1 << 0)) -#define SHT21_RESOLUTION_10b_13b ((1 << 7) | (0 << 0)) -#define SHT21_RESOLUTION_11b_11b ((1 << 7) | (1 << 0)) -#define SHT21_BATTERY_ABOVE_2V25 (0 << 6) -#define SHT21_BATTERY_BELOW_2V25 (1 << 6) -#define SHT21_ONCHIP_HEATER_ENABLE (1 << 2) -#define SHT21_ONCHIP_HEATER_DISABLE (0 << 2) -#define SHT21_OTP_RELOAD_ENABLE (0 << 1) -#define SHT21_OTP_RELOAD_DISABLE (1 << 1) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SHT21 configuration values - * @{ - */ -#define SHT21_DEFAULT_CONFIG (SHT21_RESOLUTION_12b_14b | \ - SHT21_ONCHIP_HEATER_DISABLE | \ - SHT21_BATTERY_ABOVE_2V25 | \ - SHT21_OTP_RELOAD_DISABLE) - -#define SHT21_USER_CONFIG (SHT21_RESOLUTION_12b_14b | \ - SHT21_ONCHIP_HEATER_DISABLE | \ - SHT21_BATTERY_ABOVE_2V25 | \ - SHT21_OTP_RELOAD_DISABLE) -/** @} */ -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -/*---------------------------------------------------------------------------*/ -static void -sht21_init(void) -{ - uint8_t config[2]; - - /* Setup the configuration vector, the first position holds address */ - /* and the second position holds the actual configuration */ - config[0] = SHT21_USER_REG_WRITE; - config[1] = 0; - - /* Read the current configuration according to the datasheet (pag. 9, fig. 18) */ - i2c_single_send(SHT21_ADDRESS, SHT21_USER_REG_READ); - i2c_single_receive(SHT21_ADDRESS, &config[1]); - - /* Clean all the configuration bits except those reserved */ - config[1] &= SHT21_USER_REG_RESERVED_BITS; - - /* Set the configuration bits without changing those reserved */ - config[1] |= SHT21_USER_CONFIG; - - i2c_burst_send(SHT21_ADDRESS, config, sizeof(config)); -} -/*---------------------------------------------------------------------------*/ -static void -sht21_reset(void) -{ - /* Send a soft-reset command according to the datasheet (pag. 9, fig. 17) */ - i2c_single_send(SHT21_ADDRESS, SHT21_RESET_CMD); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -sht21_is_present(void) -{ - uint8_t status; - uint8_t is_present; - - /* Read the current configuration according to the datasheet (pag. 9, fig. 18) */ - i2c_single_send(SHT21_ADDRESS, SHT21_USER_REG_READ); - status = i2c_single_receive(SHT21_ADDRESS, &is_present); - if(status != I2C_MASTER_ERR_NONE) { - return 0; - } - - /* Clear the reserved bits according to the datasheet (pag. 9, tab. 8) */ - is_present &= ~SHT21_USER_REG_RESERVED_BITS; - - return (is_present == SHT21_USER_CONFIG) || (is_present == SHT21_DEFAULT_CONFIG); -} -/*---------------------------------------------------------------------------*/ -static uint32_t -sht21_read_temperature(void) -{ - uint8_t sht21_temperature[2]; - uint16_t temperature; - - /* Read the current temperature according to the datasheet (pag. 8, fig. 15) */ - i2c_single_send(SHT21_ADDRESS, SHT21_TEMPERATURE_HM_CMD); - i2c_burst_receive(SHT21_ADDRESS, sht21_temperature, sizeof(sht21_temperature)); - - temperature = (sht21_temperature[0] << 8) | ((sht21_temperature[1] & SHT21_STATUS_MASK)); - - return temperature; -} -/*---------------------------------------------------------------------------*/ -static int16_t -sht21_convert_temperature(uint32_t temperature) -{ - int16_t result; - - temperature *= 17572; - temperature = temperature >> 16; - result = (int16_t)temperature - 4685; - - return result; -} -/*---------------------------------------------------------------------------*/ -static uint32_t -sht21_read_humidity(void) -{ - uint8_t sht21_humidity[2]; - uint16_t humidity; - - /* Read the current humidity according to the datasheet (pag. 8, fig. 15) */ - i2c_single_send(SHT21_ADDRESS, SHT21_HUMIDITY_HM_CMD); - i2c_burst_receive(SHT21_ADDRESS, sht21_humidity, sizeof(sht21_humidity)); - - humidity = (sht21_humidity[0] << 8) | ((sht21_humidity[1] & SHT21_STATUS_MASK)); - - return humidity; -} -/*---------------------------------------------------------------------------*/ -static int16_t -sht21_convert_humidity(uint32_t humidity) -{ - int16_t result; - - humidity *= 12500; - humidity = humidity >> 16; - result = (int16_t)humidity - 600; - result = (result > 10000) ? 10000 : result; - - return result; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - uint32_t value; - - if(!enabled) { - PRINTF("SHT21: sensor not started\n"); - return SHT21_ERROR; - } - - if(type == SHT21_READ_RAW_TEMP) { - return sht21_read_temperature(); - } else if(type == SHT21_READ_RAW_RHUM) { - return sht21_read_humidity(); - } else if(type == SHT21_READ_TEMP) { - value = sht21_read_temperature(); - return sht21_convert_temperature(value); - } else if(type == SHT21_READ_RHUM) { - value = sht21_read_humidity(); - return sht21_convert_humidity(value); - } else { - PRINTF("SHT21: invalid value requested\n"); - return SHT21_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type == SHT21_ACTIVATE) { - if(!sht21_is_present()) { - PRINTF("SHT21: is not present\n"); - return SHT21_ERROR; - } else { - sht21_init(); - enabled = 1; - return SHT21_SUCCESS; - } - } - - if(type == SHT21_RESET && enabled) { - sht21_reset(); - return SHT21_SUCCESS; - } else { - PRINTF("SHT21: is not enabled\n"); - return SHT21_ERROR; - } - - return SHT21_ERROR; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(sht21, SHT21_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/openmote-cc2538/dev/sht21.h b/arch/platform/openmote-cc2538/dev/sht21.h deleted file mode 100644 index 3304d915e..000000000 --- a/arch/platform/openmote-cc2538/dev/sht21.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014, OpenMote Technologies, S.L. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-sensors - * @{ - * - * \defgroup openmote-sht21-sensor SHT21 sensor - * @{ - * - * \file - * Header file for the SHT21 temperature and humidity sensor driver - * - * \author - * Pere Tuset - */ -/*---------------------------------------------------------------------------*/ -#ifndef SHT21_H_ -#define SHT21_H_ -/*---------------------------------------------------------------------------*/ -#define SHT21_ERROR (-1) -#define SHT21_SUCCESS (0) -#define SHT21_ACTIVATE (SENSORS_ACTIVE) -#define SHT21_READ_RAW_TEMP (2) -#define SHT21_READ_RAW_RHUM (3) -#define SHT21_READ_TEMP (4) -#define SHT21_READ_RHUM (5) -#define SHT21_RESET (6) -#define SHT21_NONE (7) -/*---------------------------------------------------------------------------*/ -#define SHT21_SENSOR "SHT21 Sensor" -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor sht21; -/*---------------------------------------------------------------------------*/ -#endif /* SHT21_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/openmote-cc2538/dev/tps62730.c b/arch/platform/openmote-cc2538/dev/tps62730.c deleted file mode 100644 index 5311e3960..000000000 --- a/arch/platform/openmote-cc2538/dev/tps62730.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2014, OpenMote Technologies, S.L. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-tps62730 - * @{ - * - * Driver for the TPS62730 voltage regulator, to enable power from - * the battery voltage (bypass, Vout=Vin, Iq < 1uA) or through the - * buck regulator (on, Vout=2.1V, Iq = 30uA) - * @{ - * - * \file - * Driver for the TPS62730 voltage regulator - * - * \author - * Pere Tuset - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio.h" -#include "dev/tps62730.h" -/*---------------------------------------------------------------------------*/ -#define BSP_TPS62730_BASE (GPIO_B_BASE) -#define BSP_TPS62730_ON (1 << 1) -#define BSP_TPS62730_STATUS (1 << 0) -/*---------------------------------------------------------------------------*/ -static void -gpio_set(int port, int bit) -{ - REG((port | GPIO_DATA) + (bit << 2)) = bit; -} -/*---------------------------------------------------------------------------*/ -static void -gpio_reset(int port, int bit) -{ - REG((port | GPIO_DATA) + (bit << 2)) = 0; -} -/*---------------------------------------------------------------------------*/ -void -tps62730_init(void) -{ - GPIO_SET_OUTPUT(BSP_TPS62730_BASE, BSP_TPS62730_ON); - GPIO_SET_INPUT(BSP_TPS62730_BASE, BSP_TPS62730_STATUS); - - tps62730_bypass(); -} -/*---------------------------------------------------------------------------*/ -void -tps62730_on(void) -{ - gpio_set(BSP_TPS62730_BASE, BSP_TPS62730_ON); -} -/*---------------------------------------------------------------------------*/ -void -tps62730_bypass(void) -{ - gpio_reset(BSP_TPS62730_BASE, BSP_TPS62730_ON); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/openmote-cc2538/dev/tps62730.h b/arch/platform/openmote-cc2538/dev/tps62730.h deleted file mode 100644 index 00518c9c7..000000000 --- a/arch/platform/openmote-cc2538/dev/tps62730.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2014, OpenMote Technologies, S.L. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-cc2538 - * @{ - * - * \defgroup openmote-tps62730 TPS62730 voltage regulator - * - * Driver for the TPS62730 voltage regulator, to enable power from - * the battery voltage (bypass, Vout=Vin, Iq < 1uA) or through the - * buck regulator (on, Vout=2.1V, Iq = 30uA) - * @{ - * - * \file - * Driver for the TPS62730 voltage regulator - * - * \author - * Pere Tuset - */ -/*---------------------------------------------------------------------------*/ -#ifndef TPS62730_H_ -#define TPS62730_H_ -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the TPS62730 voltage regulator in bypass mode - */ -void tps62730_init(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Set TPS62730 to on, Vout = 2.2V, Iq = 30 uA - */ -void tps62730_on(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Set TPS62730 to bypass, Vout = Vin, Iq < 1 uA - */ -void tps62730_bypass(void); -/*---------------------------------------------------------------------------*/ -#endif /* TPS62730_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/openmote-cc2538/platform.c b/arch/platform/openmote-cc2538/platform.c deleted file mode 100644 index 4656d2332..000000000 --- a/arch/platform/openmote-cc2538/platform.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538-platforms - * @{ - * - * \defgroup openmote-cc2538 OpenMote-CC2538 platform - * - * The OpenMote-CC2538 is based on the CC2538, the new platform by Texas Instruments - * based on an ARM Cortex-M3 core and a IEEE 802.15.4 radio. - * @{ - * - * \file - * Main module for the OpenMote-CC2538 platform - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/leds.h" -#include "dev/uart.h" -#include "dev/i2c.h" -#include "dev/button-sensor.h" -#include "dev/serial-line.h" -#include "dev/slip.h" -#include "dev/cc2538-rf.h" -#include "dev/udma.h" -#include "dev/crypto.h" -#include "dev/button-hal.h" -#include "usb/usb-serial.h" -#include "lib/random.h" -#include "lib/sensors.h" -#include "net/netstack.h" -#include "net/mac/framer/frame802154.h" -#include "net/linkaddr.h" -#include "sys/platform.h" -#include "soc.h" -#include "cpu.h" -#include "reg.h" -#include "ieee-addr.h" -#include "lpm.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "OpenMote CC2538" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -/** - * \brief Board specific iniatialisation - */ -void board_init(void); -/*---------------------------------------------------------------------------*/ -static void -fade(leds_mask_t l) -{ - volatile int i; - int k, j; - for(k = 0; k < 800; ++k) { - j = k > 400 ? 800 - k : k; - - leds_on(l); - for(i = 0; i < j; ++i) { - __asm("nop"); - } - leds_off(l); - for(i = 0; i < 400 - j; ++i) { - __asm("nop"); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -set_rf_params(void) -{ - uint16_t short_addr; - uint8_t ext_addr[8]; - - ieee_addr_cpy_to(ext_addr, 8); - - short_addr = ext_addr[7]; - short_addr |= ext_addr[6] << 8; - - NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID); - NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr); - NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, IEEE802154_DEFAULT_CHANNEL); - NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one(void) -{ - soc_init(); - - leds_init(); - fade(LEDS_RED); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two() -{ -#if UART_CONF_ENABLE - uart_init(0); - uart_init(1); - uart_set_input(SERIAL_LINE_CONF_UART, serial_line_input_byte); -#endif - -#if USB_SERIAL_CONF_ENABLE - usb_serial_init(); - usb_serial_set_input(serial_line_input_byte); -#endif - - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, I2C_SCL_NORMAL_BUS_SPEED); - - serial_line_init(); - - /* Initialise the H/W RNG engine. */ - random_init(0); - - udma_init(); - -#if CRYPTO_CONF_INIT - crypto_init(); - crypto_disable(); -#endif - - /* Populate linkaddr_node_addr */ - ieee_addr_cpy_to(linkaddr_node_addr.u8, LINKADDR_SIZE); - - button_hal_init(); - - INTERRUPTS_ENABLE(); - - fade(LEDS_BLUE); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three() -{ - LOG_INFO("%s\n", BOARD_STRING); - - set_rf_params(); - - board_init(); - - soc_print_info(); - - process_start(&sensors_process, NULL); - - fade(LEDS_GREEN); -} -/*---------------------------------------------------------------------------*/ -void -platform_idle() -{ - /* We have serviced all pending events. Enter a Low-Power mode. */ - lpm_enter(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/Makefile.simplelink b/arch/platform/simplelink/Makefile.simplelink deleted file mode 100644 index acb613d6e..000000000 --- a/arch/platform/simplelink/Makefile.simplelink +++ /dev/null @@ -1,48 +0,0 @@ -################################################################################ -### SimpleLink MCU platform makefile - -################################################################################ -### Sanity check of expected symbols - -ifndef CONTIKI - $(error 'CONTIKI' not defined! You must specify where CONTIKI resides!) -endif - -BOARD ?= srf06/cc26x0 - -################################################################################ -### Resolve the SimpleLink Family - -SIMPLELINK_FAMILIES := cc13xx-cc26xx - -# Given a SimpleLink family as argument, check if it has the Board file. -# If so, return itself; else, return empty string. -verify_family = $(shell [ -d $(CONTIKI)/arch/platform/simplelink/$(1)/$(BOARD) ] && echo $(1)) - -# Test each supported SimpleLink family and see if it contains the specified Board. -# Throw an error if it isn't found. -FAMILY := $(foreach FAMILY, $(SIMPLELINK_FAMILIES), $(call verify_family,$(FAMILY))) -ifeq ($(strip $(FAMILY)),) - $(error Board '$(BOARD)' does not corresponding to any SimpleLink family. Make sure your BOARD variable is correct.) -endif -# If multiple families are found, only the first one is chosen. If this ever -# happens something is not correct. -ifneq ($(words $(FAMILY)),1) - FAMILY := $(firstword $(FAMILY)) - $(warning Multiple SimpleLink families found to support '$(BOARD)'. Resolve to '$(FAMILY)'.) -endif - -# Remove any excess whitespace. -FAMILY := $(strip $(FAMILY)) - -FAMILY_PATH := $(realpath $(CONTIKI)/arch/platform/simplelink/$(FAMILY)) -CLEAN += *.simplelink - -# Include the Simplelink Family specific Makefile -include $(FAMILY_PATH)/Makefile.$(FAMILY) - -################################################################################ -### SimpleLink targets - -simplelink_families: - @echo "$(SIMPLELINK_FAMILIES) (current: $(FAMILY))" diff --git a/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx b/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx deleted file mode 100644 index 39a3fc504..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx +++ /dev/null @@ -1,62 +0,0 @@ -################################################################################ -### SimpleLink MCU platform makefile - -################################################################################ -# Board and BSP selection -BOARD_PLATFORMS = launchpad sensortag srf06 - -# All supported boards for this SimpleLink family -BOARDS = $(foreach BOARD, $(BOARD_PLATFORMS), \ - $(shell cd $(FAMILY_PATH); find $(BOARD)/* -type d -print)) - -################################################################################ -# Directory and source configurations - -# Include the board-specific Makefile -BOARD_PATH := $(FAMILY_PATH)/$(BOARD) -include $(BOARD_PATH)/Makefile.$(notdir $(BOARD)) - -DEVICE_FAMILY_LC := $(shell echo "$(DEVICE_FAMILY)" | tr A-Z a-z) - -# Add to the source dirs -TARGET_FAMILY_DIRS += common -TARGET_FAMILY_DIRS += $(BOARD) - -CONTIKI_TARGET_DIRS += $(FAMILY) -CONTIKI_TARGET_DIRS += $(addprefix $(FAMILY)/, $(TARGET_FAMILY_DIRS)) - -BOARD_DEFINES += DeviceFamily_$(DEVICE_FAMILY) -BOARD_DEFINES += DEVICE_LINE_$(DEVICE_LINE) -BOARD_DEFINES += DEVICE_$(DEVICE) -BOARD_DEFINES += $(BOARD_TYPE) -BOARD_DEFINES += SUPPORTS_PROP_MODE=$(SUPPORTS_PROP_MODE) -BOARD_DEFINES += SUPPORTS_IEEE_MODE=$(SUPPORTS_IEEE_MODE) -BOARD_DEFINES += SUPPORTS_BLE_BEACON=$(SUPPORTS_BLE_BEACON) -BOARD_DEFINES += SUPPORTS_HIGH_PA=$(SUPPORTS_HIGH_PA) - -# If the user-specified a Node ID, pass a define -ifdef NODEID - BOARD_DEFINES += IEEE_ADDR_NODE_ID=$(NODEID) -endif - -CFLAGS += $(addprefix -D, $(BOARD_DEFINES)) - -CONTIKI_TARGET_SOURCEFILES += platform.c -CONTIKI_TARGET_SOURCEFILES += batmon-sensor.c -CONTIKI_TARGET_SOURCEFILES += $(BOARD_SOURCEFILES) - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -# Pull in the correct CPU makefile -CPU_FAMILY = cc13xx-cc26xx - -# Define the CPU directory and pull in the correct CPU Makefile -CONTIKI_CPU := $(realpath $(ARCH_PATH)/cpu/simplelink-$(CPU_FAMILY)) -include $(CONTIKI_CPU)/Makefile.$(CPU_FAMILY) - -MODULES += os/net os/net/mac os/net/mac/framer - -################################################################################ -# Display all supported Boards for the given SimpleLink Family -simplelink_boards: - @echo "$(BOARDS) (current: $(BOARD))" diff --git a/arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.c b/arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.c deleted file mode 100644 index b0433405d..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-batmon - * @{ - * - * \file - * Driver for the CC13xx/CC26xx AON battery monitor. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" - -#include "batmon-sensor.h" -/*---------------------------------------------------------------------------*/ -#include -#include DeviceFamily_constructPath(driverlib/aon_batmon.h) -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define SENSOR_STATUS_DISABLED 0 -#define SENSOR_STATUS_ENABLED 1 - -static int enabled = SENSOR_STATUS_DISABLED; -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor - * \param type BATMON_SENSOR_TYPE_TEMP or BATMON_SENSOR_TYPE_VOLT - * - * \return The value as returned by the respective CC26xxware function - */ -static int -value(int type) -{ - if(enabled == SENSOR_STATUS_DISABLED) { - PRINTF("Sensor Disabled\n"); - return BATMON_SENSOR_READING_ERROR; - } - - switch(type) { - case BATMON_SENSOR_TYPE_TEMP: return (int)AONBatMonTemperatureGetDegC(); - case BATMON_SENSOR_TYPE_VOLT: return (int)AONBatMonBatteryVoltageGet(); - default: - PRINTF("Invalid type\n"); - return BATMON_SENSOR_READING_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the battery monitor sensor. - * - * \param type Activate, enable or disable the sensor. See below - * \param enable If - * - * When type == SENSORS_HW_INIT we turn on the hardware - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor - */ -static int -configure(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - AONBatMonEnable(); - enabled = SENSOR_STATUS_ENABLED; - break; - case SENSORS_ACTIVE: - if(enable) { - AONBatMonEnable(); - enabled = SENSOR_STATUS_ENABLED; - } else { - AONBatMonDisable(); - enabled = SENSOR_STATUS_DISABLED; - } - break; - default: - break; - } - return enabled; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor - * \param type SENSORS_ACTIVE or SENSORS_READY - * \return 1 if the sensor is enabled - */ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - break; - default: - break; - } - return SENSOR_STATUS_DISABLED; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(batmon_sensor, "Battery Monitor", value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.h b/arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.h deleted file mode 100644 index 569671d8c..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/batmon-sensor.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-platform - * @{ - * - * \defgroup cc13xx-cc26xx-batmon CC13xx/CC26xx Battery Monitor sensor driver. - * - * Driver for the on-chip battery voltage and chip temperature sensor. - * @{ - * - * \file - * Header file for the CC13xx/CC26xx battery monitor. - */ -/*---------------------------------------------------------------------------*/ -#ifndef BATMON_SENSOR_H_ -#define BATMON_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#define BATMON_SENSOR_TYPE_TEMP 1 -#define BATMON_SENSOR_TYPE_VOLT 2 -/*---------------------------------------------------------------------------*/ -#define BATMON_SENSOR_READING_ERROR -1 -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor batmon_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* BATMON_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/contiki-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/contiki-conf.h deleted file mode 100644 index 542f69869..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/contiki-conf.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-platform - * @{ - * - * The order of which these header files are included is important in order - * for the configurations to be correctly set. This has to do with some - * slight unfortunate configuration dependencies of the board file. - * - * \file - * Configuration for the SimpleLink CC13xx/CC26xx platform. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef CONTIKI_CONF_H_ -#define CONTIKI_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Include project-specific configurations */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif -/*---------------------------------------------------------------------------*/ -/* Include board-specific configurations */ -#include "board-conf.h" -/*---------------------------------------------------------------------------*/ -/* Include CPU-related configurations */ -#include "cc13xx-cc26xx-conf.h" -/*---------------------------------------------------------------------------*/ -#endif /* CONTIKI_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/Makefile.launchpad b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/Makefile.launchpad deleted file mode 100644 index 66ac2df24..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/Makefile.launchpad +++ /dev/null @@ -1,9 +0,0 @@ -################################################################################ -# SimpleLink LaunchPad makefile - -BOARD_TYPE = BOARD_LAUNCHPAD - -# leds-arch.c etc. -BOARD_SOURCEFILES += button-sensor-arch.c leds-arch.c - -TARGET_FAMILY_DIRS += launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/board-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/board-conf.h deleted file mode 100644 index 5e5c75528..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/board-conf.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-platform - * @{ - * - * \defgroup launchpad-peripherals LaunchPad peripherals - * - * Defines related to configuring LaunchPad peripherals. All LaunchPads - * are identical to a very large extent. Everything documented within this - * group applies to both sensortags - * - * @{ - * - * \file - * Header file with definitions related to LaunchPad boards. - * \author - * Edvard Pettersen - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_CONF_H_ -#define BOARD_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf-conf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED configurations for the dev/leds.h API. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define PLATFORM_HAS_LEDS 1 - -#define LEDS_CONF_COUNT 2 - -#define LEDS_CONF_RED 0 -#define LEDS_CONF_GREEN 1 - -#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button configurations for the dev/button-hal.h API. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define PLATFORM_HAS_BUTTON 1 -#define PLATFORM_SUPPORTS_BUTTON_HAL 1 - -#define BUTTON_HAL_ID_KEY_LEFT 0 -#define BUTTON_HAL_ID_KEY_RIGHT 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LaunchPad does not have any sensors. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_CONF_HAS_SENSORS 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name The external flash SPI CS pin, defined in Board.h. - * - * Note that SPI SCK, MOSI and MISO does not need to be defined, as they are - * implicitly defined via the Board_SPI0 controller. - * - * Those values are not meant to be modified by the user - * @{ - */ -#if TI_SPI_CONF_SPI0_ENABLE -#define EXT_FLASH_SPI_CONTROLLER Board_SPI0 - -#define EXT_FLASH_SPI_PIN_SCK Board_SPI0_SCK -#define EXT_FLASH_SPI_PIN_MOSI Board_SPI0_MOSI -#define EXT_FLASH_SPI_PIN_MISO Board_SPI0_MISO -#define EXT_FLASH_SPI_PIN_CS Board_SPI_FLASH_CS - -#define EXT_FLASH_DEVICE_ID 0x14 -#define EXT_FLASH_MID 0xC2 - -#define EXT_FLASH_PROGRAM_PAGE_SIZE 256 -#define EXT_FLASH_ERASE_SECTOR_SIZE 4096 -#endif /* TI_SPI_CONF_SPI0_ENABLE */ -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/board-peripherals.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/board-peripherals.h deleted file mode 100644 index 528ddb26f..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/board-peripherals.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-platform - * @{ - * - * \defgroup launchpad-peripherals LaunchPad peripherals - * - * Defines related to configuring LaunchPad peripherals. All - * LaunchPads are identical to a very large extent. Everything - * documented within this group applies to all LaunchPads. - * - * @{ - * - * \file - * Header file with definitions related to LaunchPad boards. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_PERIPHERALS_H_ -#define BOARD_PERIPHERALS_H_ -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_PERIPHERALS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/button-sensor-arch.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/button-sensor-arch.c deleted file mode 100644 index 41bfef92e..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/button-sensor-arch.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Button HAL definitions for the LaunchPad buttons. Common across - * all CC13xx/CC26xx LaunchPad boards. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/button-hal.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -/* Key left button, AKA BTN-1. */ -BUTTON_HAL_BUTTON( - key_left, /**< Name */ - "Key Left", /**< Description */ - Board_PIN_BTN1, /**< Board PIN */ - GPIO_HAL_PIN_CFG_PULL_UP | - GPIO_HAL_PIN_CFG_HYSTERESIS, /**< Pull configuration */ - BUTTON_HAL_ID_KEY_LEFT, /**< Unique ID */ - true); /**< Negative logic */ - -/* Key right button, AKA BTN-2. */ -BUTTON_HAL_BUTTON( - key_right, /**< Name */ - "Key Right", /**< Description */ - Board_PIN_BTN2, /**< Board PIN */ - GPIO_HAL_PIN_CFG_PULL_UP | - GPIO_HAL_PIN_CFG_HYSTERESIS, /**< Pull configuration */ - BUTTON_HAL_ID_KEY_RIGHT, /**< Unique ID */ - true); /**< Negative logic */ -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTONS(&key_left, &key_right); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/Board.h deleted file mode 100644 index 88999fe6f..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/Board.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#define Board_CC1310_LAUNCHXL -#define BOARD_STRING "TI CC1310 LaunchPad" - -#define RF_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC1310_LAUNCHXL.h" - -#define Board_initGeneral() CC1310_LAUNCHXL_initGeneral() -#define Board_shutDownExtFlash() CC1310_LAUNCHXL_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC1310_LAUNCHXL_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADC0 CC1310_LAUNCHXL_ADC0 -#define Board_ADC1 CC1310_LAUNCHXL_ADC1 - -#define Board_ADCBUF0 CC1310_LAUNCHXL_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC1310_LAUNCHXL_ADCBUF0CHANNEL0 -#define Board_ADCBUF0CHANNEL1 CC1310_LAUNCHXL_ADCBUF0CHANNEL1 - -#define Board_CRYPTO0 CC1310_LAUNCHXL_CRYPTO0 - -#define Board_DIO0 CC1310_LAUNCHXL_DIO0 -#define Board_DIO1 CC1310_LAUNCHXL_DIO1 -#define Board_DIO12 CC1310_LAUNCHXL_DIO12 -#define Board_DIO15 CC1310_LAUNCHXL_DIO15 -#define Board_DIO16_TDO CC1310_LAUNCHXL_DIO16_TDO -#define Board_DIO17_TDI CC1310_LAUNCHXL_DIO17_TDI -#define Board_DIO21 CC1310_LAUNCHXL_DIO21 -#define Board_DIO22 CC1310_LAUNCHXL_DIO22 - -#define Board_GPIO_BUTTON0 CC1310_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BUTTON1 CC1310_LAUNCHXL_GPIO_S2 -#define Board_GPIO_BTN1 CC1310_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BTN2 CC1310_LAUNCHXL_GPIO_S2 -#define Board_GPIO_LED0 CC1310_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_LED1 CC1310_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_RLED CC1310_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_GLED CC1310_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED_ON CC1310_LAUNCHXL_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC1310_LAUNCHXL_GPIO_LED_OFF - -#define Board_GPTIMER0A CC1310_LAUNCHXL_GPTIMER0A -#define Board_GPTIMER0B CC1310_LAUNCHXL_GPTIMER0B -#define Board_GPTIMER1A CC1310_LAUNCHXL_GPTIMER1A -#define Board_GPTIMER1B CC1310_LAUNCHXL_GPTIMER1B -#define Board_GPTIMER2A CC1310_LAUNCHXL_GPTIMER2A -#define Board_GPTIMER2B CC1310_LAUNCHXL_GPTIMER2B -#define Board_GPTIMER3A CC1310_LAUNCHXL_GPTIMER3A -#define Board_GPTIMER3B CC1310_LAUNCHXL_GPTIMER3B - -#define Board_I2C0 CC1310_LAUNCHXL_I2C0 -#define Board_I2C_TMP CC1310_LAUNCHXL_I2C0 - -#define Board_NVSINTERNAL CC1310_LAUNCHXL_NVSCC26XX0 -#define Board_NVSEXTERNAL CC1310_LAUNCHXL_NVSSPI25X0 - -#define Board_PIN_BUTTON0 CC1310_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BUTTON1 CC1310_LAUNCHXL_PIN_BTN2 -#define Board_PIN_BTN1 CC1310_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BTN2 CC1310_LAUNCHXL_PIN_BTN2 -#define Board_PIN_LED0 CC1310_LAUNCHXL_PIN_RLED -#define Board_PIN_LED1 CC1310_LAUNCHXL_PIN_GLED -#define Board_PIN_LED2 CC1310_LAUNCHXL_PIN_RLED -#define Board_PIN_RLED CC1310_LAUNCHXL_PIN_RLED -#define Board_PIN_GLED CC1310_LAUNCHXL_PIN_GLED - -#define Board_PWM0 CC1310_LAUNCHXL_PWM0 -#define Board_PWM1 CC1310_LAUNCHXL_PWM1 -#define Board_PWM2 CC1310_LAUNCHXL_PWM2 -#define Board_PWM3 CC1310_LAUNCHXL_PWM3 -#define Board_PWM4 CC1310_LAUNCHXL_PWM4 -#define Board_PWM5 CC1310_LAUNCHXL_PWM5 -#define Board_PWM6 CC1310_LAUNCHXL_PWM6 -#define Board_PWM7 CC1310_LAUNCHXL_PWM7 - -#define Board_SD0 CC1310_LAUNCHXL_SDSPI0 - -#define Board_SPI0 CC1310_LAUNCHXL_SPI0 -#define Board_SPI0_MISO CC1310_LAUNCHXL_SPI0_MISO -#define Board_SPI0_MOSI CC1310_LAUNCHXL_SPI0_MOSI -#define Board_SPI0_CLK CC1310_LAUNCHXL_SPI0_CLK -#define Board_SPI0_CSN CC1310_LAUNCHXL_SPI0_CSN -#define Board_SPI1 CC1310_LAUNCHXL_SPI1 -#define Board_SPI1_MISO CC1310_LAUNCHXL_SPI1_MISO -#define Board_SPI1_MOSI CC1310_LAUNCHXL_SPI1_MOSI -#define Board_SPI1_CLK CC1310_LAUNCHXL_SPI1_CLK -#define Board_SPI1_CSN CC1310_LAUNCHXL_SPI1_CSN -#define Board_SPI_FLASH_CS CC1310_LAUNCHXL_SPI_FLASH_CS -#define Board_FLASH_CS_ON 0 -#define Board_FLASH_CS_OFF 1 - -#define Board_SPI_MASTER CC1310_LAUNCHXL_SPI0 -#define Board_SPI_SLAVE CC1310_LAUNCHXL_SPI0 -#define Board_SPI_MASTER_READY CC1310_LAUNCHXL_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC1310_LAUNCHXL_SPI_SLAVE_READY - -#define Board_UART0 CC1310_LAUNCHXL_UART0 - -#define Board_WATCHDOG0 CC1310_LAUNCHXL_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_TMP_ADDR (0x40) -#define Board_SENSORS_BP_TMP_ADDR Board_TMP_ADDR - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.c deleted file mode 100644 index b5db4e61d..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.c +++ /dev/null @@ -1,820 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC1310_LAUNCHXL.c =================================== - * This file is responsible for setting up the board specific items for the - * CC1310_LAUNCHXL board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC1310_LAUNCHXL.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26XX_Object adcBufCC26xxObjects[CC1310_LAUNCHXL_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[CC1310_LAUNCHXL_ADCBUF0CHANNELCOUNT] = { - {CC1310_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7}, - {CC1310_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6}, - {CC1310_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5}, - {CC1310_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4}, - {CC1310_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3}, - {CC1310_LAUNCHXL_DIO28_ANALOG, ADC_COMPB_IN_AUXIO2}, - {CC1310_LAUNCHXL_DIO29_ANALOG, ADC_COMPB_IN_AUXIO1}, - {CC1310_LAUNCHXL_DIO30_ANALOG, ADC_COMPB_IN_AUXIO0}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, -}; - -const ADCBufCC26XX_HWAttrs adcBufCC26xxHWAttrs[CC1310_LAUNCHXL_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26XX_adcChannelLut, - .gpTimerUnit = CC1310_LAUNCHXL_GPTIMER0A, - .gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC1310_LAUNCHXL_ADCBUFCOUNT] = { - { - &ADCBufCC26XX_fxnTable, - &adcBufCC26xxObjects[CC1310_LAUNCHXL_ADCBUF0], - &adcBufCC26xxHWAttrs[CC1310_LAUNCHXL_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC1310_LAUNCHXL_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC1310_LAUNCHXL_ADCCOUNT]; - - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADCCOUNT] = { - { - .adcDIO = CC1310_LAUNCHXL_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1310_LAUNCHXL_DIO24_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO6, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1310_LAUNCHXL_DIO25_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO5, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1310_LAUNCHXL_DIO26_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO4, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1310_LAUNCHXL_DIO27_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO3, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1310_LAUNCHXL_DIO28_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO2, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1310_LAUNCHXL_DIO29_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO1, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1310_LAUNCHXL_DIO30_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO0, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_10P9_MS, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC1310_LAUNCHXL_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADC0]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADC1]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADC2]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADC3]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADC4]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADC5], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADC5]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADC6], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADC6]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADC7], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADC7]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1310_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC1310_LAUNCHXL_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC1310_LAUNCHXL_ADCCOUNT; - -/* - * =============================== Crypto =============================== - */ -#include - -CryptoCC26XX_Object cryptoCC26XXObjects[CC1310_LAUNCHXL_CRYPTOCOUNT]; - -const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC1310_LAUNCHXL_CRYPTOCOUNT] = { - { - .baseAddr = CRYPTO_BASE, - .powerMngrId = PowerCC26XX_PERIPH_CRYPTO, - .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ, - .intPriority = ~0, - } -}; - -const CryptoCC26XX_Config CryptoCC26XX_config[CC1310_LAUNCHXL_CRYPTOCOUNT] = { - { - .object = &cryptoCC26XXObjects[CC1310_LAUNCHXL_CRYPTO0], - .hwAttrs = &cryptoCC26XXHWAttrs[CC1310_LAUNCHXL_CRYPTO0] - } -}; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1310_LAUNCHXL.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_13 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1310_LAUNCHXL_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1310_LAUNCHXL_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG, - - /* SD CS */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1310_LAUNCH.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC1310_LAUNCHXL_SPI_MASTER_READY */ - NULL, /* CC1310_LAUNCHXL_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC1310_LAUNCHXL_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC1310_LAUNCHXL_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1310_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1310_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC1310_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1310_LAUNCHXL_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC1310_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1310_LAUNCHXL_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC1310_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1310_LAUNCHXL_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC1310_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1310_LAUNCHXL_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC1310_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1310_LAUNCHXL_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC1310_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1310_LAUNCHXL_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC1310_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1310_LAUNCHXL_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC1310_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1310_LAUNCHXL_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC1310_LAUNCHXL_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1310_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC1310_LAUNCHXL_I2C0_SDA0, - .sclPin = CC1310_LAUNCHXL_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC1310_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC1310_LAUNCHXL_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC1310_LAUNCHXL_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC1310_LAUNCHXL_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x1A000 -#define SECTORSIZE 0x1000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS External Regions */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS External Regions */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC1310_LAUNCHXL_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC1310_LAUNCHXL_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC1310_LAUNCHXL_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC1310_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1310_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1310_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1310_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1310_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1310_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */ - CC1310_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC1310_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC1310_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC1310_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26XX_Config PowerCC26XX_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1310_LAUNCHXL_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1310_LAUNCHXL_PWMCOUNT] = { - { .pwmPin = CC1310_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC1310_LAUNCHXL_GPTIMER0A }, - { .pwmPin = CC1310_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC1310_LAUNCHXL_GPTIMER0B }, - { .pwmPin = CC1310_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1310_LAUNCHXL_GPTIMER1A }, - { .pwmPin = CC1310_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC1310_LAUNCHXL_GPTIMER1B }, - { .pwmPin = CC1310_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC1310_LAUNCHXL_GPTIMER2A }, - { .pwmPin = CC1310_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC1310_LAUNCHXL_GPTIMER2B }, - { .pwmPin = CC1310_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC1310_LAUNCHXL_GPTIMER3A }, - { .pwmPin = CC1310_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC1310_LAUNCHXL_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC1310_LAUNCHXL_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1310_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC1310_LAUNCHXL_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1310_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC1310_LAUNCHXL_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1310_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC1310_LAUNCHXL_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1310_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC1310_LAUNCHXL_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1310_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC1310_LAUNCHXL_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1310_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC1310_LAUNCHXL_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1310_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC1310_LAUNCHXL_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1310_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC1310_LAUNCHXL_PWM7] }, -}; - -const uint_least8_t PWM_count = CC1310_LAUNCHXL_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - .globalCallback = NULL, /* No board specific callback */ - .globalEventMask = 0 /* No events subscribed to */ -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC1310_LAUNCHXL_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC1310_LAUNCHXL_SDCOUNT] = { - { - .spiIndex = CC1310_LAUNCHXL_SPI0, - .spiCsGpioIndex = CC1310_LAUNCHXL_SDSPI_CS - } -}; - -const SD_Config SD_config[CC1310_LAUNCHXL_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC1310_LAUNCHXL_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC1310_LAUNCHXL_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC1310_LAUNCHXL_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1310_LAUNCHXL_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1310_LAUNCHXL_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X0_Object trngCC26X0Object[CC1310_LAUNCHXL_TRNGCOUNT]; - -const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1310_LAUNCHXL_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC1310_LAUNCHXL_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC1310_LAUNCHXL_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC1310_LAUNCHXL_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1310_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1310_LAUNCHXL_UART_TX, - .rxPin = CC1310_LAUNCHXL_UART_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1310_LAUNCHXL_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1310_LAUNCHXL_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC1310_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1310_LAUNCHXL_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC1310_LAUNCHXL_UART0] - }, -#endif -}; - -const uint_least8_t UART_count = CC1310_LAUNCHXL_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC1310_LAUNCHXL_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC1310_LAUNCHXL_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC1310_LAUNCHXL_UDMACOUNT] = { - { - .object = &udmaObjects[CC1310_LAUNCHXL_UDMA0], - .hwAttrs = &udmaHWAttrs[CC1310_LAUNCHXL_UDMA0] - }, -}; - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC1310_LAUNCHXL_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1310_LAUNCHXL_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC1310_LAUNCHXL_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC1310_LAUNCHXL_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC1310_LAUNCHXL_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC1310_LAUNCHXL_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC1310_LAUNCHXL_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC1310_LAUNCHXL_initGeneral ======== - */ -void CC1310_LAUNCHXL_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.h deleted file mode 100644 index f2c1638d7..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL.h +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** ============================================================================ - * @file CC1310_LAUNCHXL.h - * - * @brief CC1310 LaunchPad Board Specific header file. - * - * The CC1310_LAUNCHXL header file should be included in an application as - * follows: - * @code - * #include "CC1310_LAUNCHXL.h" - * @endcode - * - * ============================================================================ - */ -#ifndef __CC1310_LAUNCHXL_BOARD_H__ -#define __CC1310_LAUNCHXL_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC1310_LAUNCHXL - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Analog capable DIOs */ -#define CC1310_LAUNCHXL_DIO23_ANALOG IOID_23 -#define CC1310_LAUNCHXL_DIO24_ANALOG IOID_24 -#define CC1310_LAUNCHXL_DIO25_ANALOG IOID_25 -#define CC1310_LAUNCHXL_DIO26_ANALOG IOID_26 -#define CC1310_LAUNCHXL_DIO27_ANALOG IOID_27 -#define CC1310_LAUNCHXL_DIO28_ANALOG IOID_28 -#define CC1310_LAUNCHXL_DIO29_ANALOG IOID_29 -#define CC1310_LAUNCHXL_DIO30_ANALOG IOID_30 - -/* Digital IOs */ -#define CC1310_LAUNCHXL_DIO0 IOID_0 -#define CC1310_LAUNCHXL_DIO1 IOID_1 -#define CC1310_LAUNCHXL_DIO12 IOID_12 -#define CC1310_LAUNCHXL_DIO15 IOID_15 -#define CC1310_LAUNCHXL_DIO16_TDO IOID_16 -#define CC1310_LAUNCHXL_DIO17_TDI IOID_17 -#define CC1310_LAUNCHXL_DIO21 IOID_21 -#define CC1310_LAUNCHXL_DIO22 IOID_22 - -/* Discrete Inputs */ -#define CC1310_LAUNCHXL_PIN_BTN1 IOID_13 -#define CC1310_LAUNCHXL_PIN_BTN2 IOID_14 - -/* GPIO */ -#define CC1310_LAUNCHXL_GPIO_LED_ON 1 -#define CC1310_LAUNCHXL_GPIO_LED_OFF 0 - -/* I2C */ -#define CC1310_LAUNCHXL_I2C0_SCL0 IOID_4 -#define CC1310_LAUNCHXL_I2C0_SDA0 IOID_5 - -/* LEDs */ -#define CC1310_LAUNCHXL_PIN_LED_ON 1 -#define CC1310_LAUNCHXL_PIN_LED_OFF 0 -#define CC1310_LAUNCHXL_PIN_RLED IOID_6 -#define CC1310_LAUNCHXL_PIN_GLED IOID_7 - -/* PWM Outputs */ -#define CC1310_LAUNCHXL_PWMPIN0 CC1310_LAUNCHXL_PIN_RLED -#define CC1310_LAUNCHXL_PWMPIN1 CC1310_LAUNCHXL_PIN_GLED -#define CC1310_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED -#define CC1310_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED -#define CC1310_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED -#define CC1310_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED -#define CC1310_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED -#define CC1310_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED - -/* SPI */ -#define CC1310_LAUNCHXL_SPI_FLASH_CS IOID_20 -#define CC1310_LAUNCHXL_FLASH_CS_ON 0 -#define CC1310_LAUNCHXL_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC1310_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */ -#define CC1310_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */ -#define CC1310_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */ -#define CC1310_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED -#define CC1310_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED -#define CC1310_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED -#define CC1310_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED -#define CC1310_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC1310_LAUNCHXL_UART_RX IOID_2 /* RXD */ -#define CC1310_LAUNCHXL_UART_TX IOID_3 /* TXD */ -#define CC1310_LAUNCHXL_UART_CTS IOID_19 /* CTS */ -#define CC1310_LAUNCHXL_UART_RTS IOID_18 /* RTS */ - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC1310_LAUNCHXL_initGeneral(void); - -/*! - * @brief Turn off the external flash on LaunchPads - * - */ -void CC1310_LAUNCHXL_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC1310_LAUNCHXL_wakeUpExtFlash(void); - -/*! - * @def CC1310_LAUNCHXL_ADCBufName - * @brief Enum of ADCBufs - */ -typedef enum CC1310_LAUNCHXL_ADCBufName { - CC1310_LAUNCHXL_ADCBUF0 = 0, - - CC1310_LAUNCHXL_ADCBUFCOUNT -} CC1310_LAUNCHXL_ADCBufName; - -/*! - * @def CC1310_LAUNCHXL_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC1310_LAUNCHXL_ADCBuf0ChannelName { - CC1310_LAUNCHXL_ADCBUF0CHANNEL0 = 0, - CC1310_LAUNCHXL_ADCBUF0CHANNEL1, - CC1310_LAUNCHXL_ADCBUF0CHANNEL2, - CC1310_LAUNCHXL_ADCBUF0CHANNEL3, - CC1310_LAUNCHXL_ADCBUF0CHANNEL4, - CC1310_LAUNCHXL_ADCBUF0CHANNEL5, - CC1310_LAUNCHXL_ADCBUF0CHANNEL6, - CC1310_LAUNCHXL_ADCBUF0CHANNEL7, - CC1310_LAUNCHXL_ADCBUF0CHANNELVDDS, - CC1310_LAUNCHXL_ADCBUF0CHANNELDCOUPL, - CC1310_LAUNCHXL_ADCBUF0CHANNELVSS, - - CC1310_LAUNCHXL_ADCBUF0CHANNELCOUNT -} CC1310_LAUNCHXL_ADCBuf0ChannelName; - -/*! - * @def CC1310_LAUNCHXL_ADCName - * @brief Enum of ADCs - */ -typedef enum CC1310_LAUNCHXL_ADCName { - CC1310_LAUNCHXL_ADC0 = 0, - CC1310_LAUNCHXL_ADC1, - CC1310_LAUNCHXL_ADC2, - CC1310_LAUNCHXL_ADC3, - CC1310_LAUNCHXL_ADC4, - CC1310_LAUNCHXL_ADC5, - CC1310_LAUNCHXL_ADC6, - CC1310_LAUNCHXL_ADC7, - CC1310_LAUNCHXL_ADCDCOUPL, - CC1310_LAUNCHXL_ADCVSS, - CC1310_LAUNCHXL_ADCVDDS, - - CC1310_LAUNCHXL_ADCCOUNT -} CC1310_LAUNCHXL_ADCName; - -/*! - * @def CC1310_LAUNCHXL_CryptoName - * @brief Enum of Crypto names - */ -typedef enum CC1310_LAUNCHXL_CryptoName { - CC1310_LAUNCHXL_CRYPTO0 = 0, - - CC1310_LAUNCHXL_CRYPTOCOUNT -} CC1310_LAUNCHXL_CryptoName; - -/*! - * @def CC1310_LAUNCHXL_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC1310_LAUNCHXL_GPIOName { - CC1310_LAUNCHXL_GPIO_S1 = 0, - CC1310_LAUNCHXL_GPIO_S2, - CC1310_LAUNCHXL_SPI_MASTER_READY, - CC1310_LAUNCHXL_SPI_SLAVE_READY, - CC1310_LAUNCHXL_GPIO_LED_GREEN, - CC1310_LAUNCHXL_GPIO_LED_RED, - CC1310_LAUNCHXL_GPIO_SPI_FLASH_CS, - CC1310_LAUNCHXL_SDSPI_CS, - CC1310_LAUNCHXL_GPIOCOUNT -} CC1310_LAUNCHXL_GPIOName; - -/*! - * @def CC1310_LAUNCHXL_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC1310_LAUNCHXL_GPTimerName { - CC1310_LAUNCHXL_GPTIMER0A = 0, - CC1310_LAUNCHXL_GPTIMER0B, - CC1310_LAUNCHXL_GPTIMER1A, - CC1310_LAUNCHXL_GPTIMER1B, - CC1310_LAUNCHXL_GPTIMER2A, - CC1310_LAUNCHXL_GPTIMER2B, - CC1310_LAUNCHXL_GPTIMER3A, - CC1310_LAUNCHXL_GPTIMER3B, - - CC1310_LAUNCHXL_GPTIMERPARTSCOUNT -} CC1310_LAUNCHXL_GPTimerName; - -/*! - * @def CC1310_LAUNCHXL_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC1310_LAUNCHXL_GPTimers { - CC1310_LAUNCHXL_GPTIMER0 = 0, - CC1310_LAUNCHXL_GPTIMER1, - CC1310_LAUNCHXL_GPTIMER2, - CC1310_LAUNCHXL_GPTIMER3, - - CC1310_LAUNCHXL_GPTIMERCOUNT -} CC1310_LAUNCHXL_GPTimers; - -/*! - * @def CC1310_LAUNCHXL_I2CName - * @brief Enum of I2C names - */ -typedef enum CC1310_LAUNCHXL_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC1310_LAUNCHXL_I2C0 = 0, -#endif - - CC1310_LAUNCHXL_I2CCOUNT -} CC1310_LAUNCHXL_I2CName; - -/*! - * @def CC1310_LAUNCHXL_NVSName - * @brief Enum of NVS names - */ -typedef enum CC1310_LAUNCHXL_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC1310_LAUNCHXL_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC1310_LAUNCHXL_NVSSPI25X0, -#endif - - CC1310_LAUNCHXL_NVSCOUNT -} CC1310_LAUNCHXL_NVSName; - -/*! - * @def CC1310_LAUNCHXL_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC1310_LAUNCHXL_PWMName { - CC1310_LAUNCHXL_PWM0 = 0, - CC1310_LAUNCHXL_PWM1, - CC1310_LAUNCHXL_PWM2, - CC1310_LAUNCHXL_PWM3, - CC1310_LAUNCHXL_PWM4, - CC1310_LAUNCHXL_PWM5, - CC1310_LAUNCHXL_PWM6, - CC1310_LAUNCHXL_PWM7, - - CC1310_LAUNCHXL_PWMCOUNT -} CC1310_LAUNCHXL_PWMName; - -/*! - * @def CC1310_LAUNCHXL_SDName - * @brief Enum of SD names - */ -typedef enum CC1310_LAUNCHXL_SDName { - CC1310_LAUNCHXL_SDSPI0 = 0, - - CC1310_LAUNCHXL_SDCOUNT -} CC1310_LAUNCHXL_SDName; - -/*! - * @def CC1310_LAUNCHXL_SPIName - * @brief Enum of SPI names - */ -typedef enum CC1310_LAUNCHXL_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC1310_LAUNCHXL_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC1310_LAUNCHXL_SPI1, -#endif - - CC1310_LAUNCHXL_SPICOUNT -} CC1310_LAUNCHXL_SPIName; - -/*! - * @def CC1310_LAUNCHXL_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC1310_LAUNCHXL_TRNGName { - CC1310_LAUNCHXL_TRNG0 = 0, - - CC1310_LAUNCHXL_TRNGCOUNT -} CC1310_LAUNCHXL_TRNGName; - -/*! - * @def CC1310_LAUNCHXL_UARTName - * @brief Enum of UARTs - */ -typedef enum CC1310_LAUNCHXL_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC1310_LAUNCHXL_UART0 = 0, -#endif - - CC1310_LAUNCHXL_UARTCOUNT -} CC1310_LAUNCHXL_UARTName; - -/*! - * @def CC1310_LAUNCHXL_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC1310_LAUNCHXL_UDMAName { - CC1310_LAUNCHXL_UDMA0 = 0, - - CC1310_LAUNCHXL_UDMACOUNT -} CC1310_LAUNCHXL_UDMAName; - -/*! - * @def CC1310_LAUNCHXL_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC1310_LAUNCHXL_WatchdogName { - CC1310_LAUNCHXL_WATCHDOG0 = 0, - - CC1310_LAUNCHXL_WATCHDOGCOUNT -} CC1310_LAUNCHXL_WatchdogName; - - -#ifdef __cplusplus -} -#endif - -#endif /* __CC1310_LAUNCHXL_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL_fxns.c deleted file mode 100644 index 6918918bb..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/CC1310_LAUNCHXL_fxns.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ======== CC1310_LAUNCHXL_fxns.c ======== - * This file contains the board-specific initialization functions. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include - -#include "Board.h" - - -/* - * ======== CC1310_LAUNCHXL_sendExtFlashByte ======== - */ -void CC1310_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC1310_LAUNCHXL_wakeUpExtFlash ======== - */ -void CC1310_LAUNCHXL_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC1310_LAUNCHXL_shutDownExtFlash ======== - */ -void CC1310_LAUNCHXL_shutDownExtFlash(void) -{ - /* - * To be sure we are putting the flash into sleep and not waking it, - * we first have to make a wake up call - */ - CC1310_LAUNCHXL_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC1310_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC1310_LAUNCHXL_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/Makefile.cc1310 b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/Makefile.cc1310 deleted file mode 100644 index d43113151..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/Makefile.cc1310 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x0-cc26x0 -DEVICE_FAMILY = CC13X0 -DEVICE_LINE = CC13XX -DEVICE = CC1310 - -BOARD_SOURCEFILES += CC1310_LAUNCHXL.c CC1310_LAUNCHXL_fxns.c - -SUPPORTS_PROP_MODE = 1 -SUPPORTS_IEEE_MODE = 0 -SUPPORTS_BLE_BEACON = 0 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 1 - -# Include the common board makefile -include $(FAMILY_PATH)/launchpad/Makefile.launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/rf-conf.h deleted file mode 100644 index d26d3a864..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1310/rf-conf.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for the Sub-1 GHz path - * on the radio. - * - * These are the following front-end mode configurations for the - * CC1310-LAUNCHXL board: - * - Sub-1 GHz: differential and external bias - * - * @{ - */ -#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/Board.h deleted file mode 100644 index a230c764e..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/Board.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC1312R1_LAUNCHXL.h" - -#define Board_CC1312R1_LAUNCHXL -#define BOARD_STRING "TI CC1312R1 LaunchPad" - -#define Board_initGeneral() CC1312R1_LAUNCHXL_initGeneral() -#define Board_shutDownExtFlash() CC1312R1_LAUNCHXL_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC1312R1_LAUNCHXL_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADC0 CC1312R1_LAUNCHXL_ADC0 -#define Board_ADC1 CC1312R1_LAUNCHXL_ADC1 - -#define Board_ADCBUF0 CC1312R1_LAUNCHXL_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC1312R1_LAUNCHXL_ADCBUF0CHANNEL0 -#define Board_ADCBUF0CHANNEL1 CC1312R1_LAUNCHXL_ADCBUF0CHANNEL1 - -#define Board_ECDH0 CC1312R1_LAUNCHXL_ECDH0 -#define Board_ECDSA0 CC1312R1_LAUNCHXL_ECDSA0 -#define Board_ECJPAKE0 CC1312R1_LAUNCHXL_ECJPAKE0 -#define Board_AESCCM0 CC1312R1_LAUNCHXL_AESCCM0 -#define Board_AESECB0 CC1312R1_LAUNCHXL_AESECB0 -#define Board_SHA20 CC1312R1_LAUNCHXL_SHA20 - -#define Board_DIO0 CC1312R1_LAUNCHXL_DIO0 -#define Board_DIO1 CC1312R1_LAUNCHXL_DIO1 -#define Board_DIO12 CC1312R1_LAUNCHXL_DIO12 -#define Board_DIO15 CC1312R1_LAUNCHXL_DIO15 -#define Board_DIO16_TDO CC1312R1_LAUNCHXL_DIO16_TDO -#define Board_DIO17_TDI CC1312R1_LAUNCHXL_DIO17_TDI -#define Board_DIO21 CC1312R1_LAUNCHXL_DIO21 -#define Board_DIO22 CC1312R1_LAUNCHXL_DIO22 - -#define Board_GPIO_BUTTON0 CC1312R1_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BUTTON1 CC1312R1_LAUNCHXL_GPIO_S2 -#define Board_GPIO_BTN1 CC1312R1_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BTN2 CC1312R1_LAUNCHXL_GPIO_S2 -#define Board_GPIO_LED0 CC1312R1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_LED1 CC1312R1_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_RLED CC1312R1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_GLED CC1312R1_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED_ON CC1312R1_LAUNCHXL_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC1312R1_LAUNCHXL_GPIO_LED_OFF - -#define Board_GPTIMER0A CC1312R1_LAUNCHXL_GPTIMER0A -#define Board_GPTIMER0B CC1312R1_LAUNCHXL_GPTIMER0B -#define Board_GPTIMER1A CC1312R1_LAUNCHXL_GPTIMER1A -#define Board_GPTIMER1B CC1312R1_LAUNCHXL_GPTIMER1B -#define Board_GPTIMER2A CC1312R1_LAUNCHXL_GPTIMER2A -#define Board_GPTIMER2B CC1312R1_LAUNCHXL_GPTIMER2B -#define Board_GPTIMER3A CC1312R1_LAUNCHXL_GPTIMER3A -#define Board_GPTIMER3B CC1312R1_LAUNCHXL_GPTIMER3B - -#define Board_I2C0 CC1312R1_LAUNCHXL_I2C0 -#define Board_I2C_TMP CC1312R1_LAUNCHXL_I2C0 - -#define Board_NVSINTERNAL CC1312R1_LAUNCHXL_NVSCC26XX0 -#define Board_NVSEXTERNAL CC1312R1_LAUNCHXL_NVSSPI25X0 - -#define Board_PIN_BUTTON0 CC1312R1_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BUTTON1 CC1312R1_LAUNCHXL_PIN_BTN2 -#define Board_PIN_BTN1 CC1312R1_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BTN2 CC1312R1_LAUNCHXL_PIN_BTN2 -#define Board_PIN_LED0 CC1312R1_LAUNCHXL_PIN_RLED -#define Board_PIN_LED1 CC1312R1_LAUNCHXL_PIN_GLED -#define Board_PIN_LED2 CC1312R1_LAUNCHXL_PIN_RLED -#define Board_PIN_RLED CC1312R1_LAUNCHXL_PIN_RLED -#define Board_PIN_GLED CC1312R1_LAUNCHXL_PIN_GLED - -#define Board_PWM0 CC1312R1_LAUNCHXL_PWM0 -#define Board_PWM1 CC1312R1_LAUNCHXL_PWM1 -#define Board_PWM2 CC1312R1_LAUNCHXL_PWM2 -#define Board_PWM3 CC1312R1_LAUNCHXL_PWM3 -#define Board_PWM4 CC1312R1_LAUNCHXL_PWM4 -#define Board_PWM5 CC1312R1_LAUNCHXL_PWM5 -#define Board_PWM6 CC1312R1_LAUNCHXL_PWM6 -#define Board_PWM7 CC1312R1_LAUNCHXL_PWM7 - -#define Board_SD0 CC1312R1_LAUNCHXL_SDSPI0 - -#define Board_SPI0 CC1312R1_LAUNCHXL_SPI0 -#define Board_SPI0_MISO CC1312R1_LAUNCHXL_SPI0_MISO -#define Board_SPI0_MOSI CC1312R1_LAUNCHXL_SPI0_MOSI -#define Board_SPI0_CLK CC1312R1_LAUNCHXL_SPI0_CLK -#define Board_SPI0_CSN CC1312R1_LAUNCHXL_SPI0_CSN -#define Board_SPI1 CC1312R1_LAUNCHXL_SPI1 -#define Board_SPI1_MISO CC1312R1_LAUNCHXL_SPI1_MISO -#define Board_SPI1_MOSI CC1312R1_LAUNCHXL_SPI1_MOSI -#define Board_SPI1_CLK CC1312R1_LAUNCHXL_SPI1_CLK -#define Board_SPI1_CSN CC1312R1_LAUNCHXL_SPI1_CSN -#define Board_SPI_FLASH_CS CC1312R1_LAUNCHXL_SPI_FLASH_CS -#define Board_FLASH_CS_ON 0 -#define Board_FLASH_CS_OFF 1 - -#define Board_SPI_MASTER CC1312R1_LAUNCHXL_SPI0 -#define Board_SPI_SLAVE CC1312R1_LAUNCHXL_SPI0 -#define Board_SPI_MASTER_READY CC1312R1_LAUNCHXL_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC1312R1_LAUNCHXL_SPI_SLAVE_READY - -#define Board_UART0 CC1312R1_LAUNCHXL_UART0 -#define Board_UART1 CC1312R1_LAUNCHXL_UART1 - -#define Board_WATCHDOG0 CC1312R1_LAUNCHXL_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_TMP_ADDR (0x40) -#define Board_SENSORS_BP_TMP_ADDR Board_TMP_ADDR - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.c deleted file mode 100644 index a51bba632..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.c +++ /dev/null @@ -1,941 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC1312R1_LAUNCHXL.c =================================== - * This file is responsible for setting up the board specific items for the - * CC1312R1_LAUNCHXL board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC1312R1_LAUNCHXL.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26X2_Object adcBufCC26xxObjects[CC1312R1_LAUNCHXL_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26X2_AdcChannelLutEntry ADCBufCC26X2_adcChannelLut[CC1312R1_LAUNCHXL_ADCBUF0CHANNELCOUNT] = { - {CC1312R1_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7}, - {CC1312R1_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6}, - {CC1312R1_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5}, - {CC1312R1_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4}, - {CC1312R1_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3}, - {CC1312R1_LAUNCHXL_DIO28_ANALOG, ADC_COMPB_IN_AUXIO2}, - {CC1312R1_LAUNCHXL_DIO29_ANALOG, ADC_COMPB_IN_AUXIO1}, - {CC1312R1_LAUNCHXL_DIO30_ANALOG, ADC_COMPB_IN_AUXIO0}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, -}; - -const ADCBufCC26X2_HWAttrs adcBufCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26X2_adcChannelLut, - .gpTimerUnit = CC1312R1_LAUNCHXL_GPTIMER0A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC1312R1_LAUNCHXL_ADCBUFCOUNT] = { - { - &ADCBufCC26X2_fxnTable, - &adcBufCC26xxObjects[CC1312R1_LAUNCHXL_ADCBUF0], - &adcBufCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC1312R1_LAUNCHXL_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC1312R1_LAUNCHXL_ADCCOUNT]; - - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADCCOUNT] = { - { - .adcDIO = CC1312R1_LAUNCHXL_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1312R1_LAUNCHXL_DIO24_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO6, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1312R1_LAUNCHXL_DIO25_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO5, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1312R1_LAUNCHXL_DIO26_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO4, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1312R1_LAUNCHXL_DIO27_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO3, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1312R1_LAUNCHXL_DIO28_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO2, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1312R1_LAUNCHXL_DIO29_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO1, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1312R1_LAUNCHXL_DIO30_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO0, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_10P9_MS, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC1312R1_LAUNCHXL_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADC0]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADC1]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADC2]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADC3]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADC4]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADC5], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADC5]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADC6], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADC6]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADC7], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADC7]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1312R1_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC1312R1_LAUNCHXL_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC1312R1_LAUNCHXL_ADCCOUNT; - -/* - * =============================== ECDH =============================== - */ -#include -#include - -ECDHCC26X2_Object ecdhCC26X2Objects[CC1312R1_LAUNCHXL_ECDHCOUNT]; - -const ECDHCC26X2_HWAttrs ecdhCC26X2HWAttrs[CC1312R1_LAUNCHXL_ECDHCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDH_Config ECDH_config[CC1312R1_LAUNCHXL_ECDHCOUNT] = { - { - .object = &ecdhCC26X2Objects[CC1312R1_LAUNCHXL_ECDH0], - .hwAttrs = &ecdhCC26X2HWAttrs[CC1312R1_LAUNCHXL_ECDH0] - }, -}; - -const uint_least8_t ECDH_count = CC1312R1_LAUNCHXL_ECDHCOUNT; - -/* - * =============================== ECDSA =============================== - */ -#include -#include - -ECDSACC26X2_Object ecdsaCC26X2Objects[CC1312R1_LAUNCHXL_ECDSACOUNT]; - -const ECDSACC26X2_HWAttrs ecdsaCC26X2HWAttrs[CC1312R1_LAUNCHXL_ECDSACOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDSA_Config ECDSA_config[CC1312R1_LAUNCHXL_ECDSACOUNT] = { - { - .object = &ecdsaCC26X2Objects[CC1312R1_LAUNCHXL_ECDSA0], - .hwAttrs = &ecdsaCC26X2HWAttrs[CC1312R1_LAUNCHXL_ECDSA0] - }, -}; - -const uint_least8_t ECDSA_count = CC1312R1_LAUNCHXL_ECDSACOUNT; - -/* - * =============================== ECJPAKE =============================== - */ -#include -#include - -ECJPAKECC26X2_Object ecjpakeCC26X2Objects[CC1312R1_LAUNCHXL_ECJPAKECOUNT]; - -const ECJPAKECC26X2_HWAttrs ecjpakeCC26X2HWAttrs[CC1312R1_LAUNCHXL_ECJPAKECOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECJPAKE_Config ECJPAKE_config[CC1312R1_LAUNCHXL_ECJPAKECOUNT] = { - { - .object = &ecjpakeCC26X2Objects[CC1312R1_LAUNCHXL_ECJPAKE0], - .hwAttrs = &ecjpakeCC26X2HWAttrs[CC1312R1_LAUNCHXL_ECJPAKE0] - }, -}; - -const uint_least8_t ECJPAKE_count = CC1312R1_LAUNCHXL_ECJPAKECOUNT; - - -/* - * =============================== SHA2 =============================== - */ -#include -#include - -SHA2CC26X2_Object sha2CC26X2Objects[CC1312R1_LAUNCHXL_SHA2COUNT]; - -const SHA2CC26X2_HWAttrs sha2CC26X2HWAttrs[CC1312R1_LAUNCHXL_SHA2COUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const SHA2_Config SHA2_config[CC1312R1_LAUNCHXL_SHA2COUNT] = { - { - .object = &sha2CC26X2Objects[CC1312R1_LAUNCHXL_SHA20], - .hwAttrs = &sha2CC26X2HWAttrs[CC1312R1_LAUNCHXL_SHA20] - }, -}; - -const uint_least8_t SHA2_count = CC1312R1_LAUNCHXL_SHA2COUNT; - -/* - * =============================== AESCCM =============================== - */ -#include -#include - -AESCCMCC26XX_Object aesccmCC26XXObjects[CC1312R1_LAUNCHXL_AESCCMCOUNT]; - -const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC1312R1_LAUNCHXL_AESCCMCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESCCM_Config AESCCM_config[CC1312R1_LAUNCHXL_AESCCMCOUNT] = { - { - .object = &aesccmCC26XXObjects[CC1312R1_LAUNCHXL_AESCCM0], - .hwAttrs = &aesccmCC26XXHWAttrs[CC1312R1_LAUNCHXL_AESCCM0] - }, -}; - -const uint_least8_t AESCCM_count = CC1312R1_LAUNCHXL_AESCCMCOUNT; - -/* - * =============================== AESECB =============================== - */ -#include -#include - -AESECBCC26XX_Object aesecbCC26XXObjects[CC1312R1_LAUNCHXL_AESECBCOUNT]; - -const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC1312R1_LAUNCHXL_AESECBCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESECB_Config AESECB_config[CC1312R1_LAUNCHXL_AESECBCOUNT] = { - { - .object = &aesecbCC26XXObjects[CC1312R1_LAUNCHXL_AESECB0], - .hwAttrs = &aesecbCC26XXHWAttrs[CC1312R1_LAUNCHXL_AESECB0] - }, -}; - -const uint_least8_t AESECB_count = CC1312R1_LAUNCHXL_AESECBCOUNT; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1312R1_LAUNCHXL.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_13 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1312R1_LAUNCHXL_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1312R1_LAUNCHXL_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG, - - /* SD CS */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1312R1_LAUNCH.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC1312R1_LAUNCHXL_SPI_MASTER_READY */ - NULL, /* CC1312R1_LAUNCHXL_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC1312R1_LAUNCHXL_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC1312R1_LAUNCHXL_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1312R1_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC1312R1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC1312R1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC1312R1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC1312R1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC1312R1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC1312R1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC1312R1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC1312R1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC1312R1_LAUNCHXL_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1312R1_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC1312R1_LAUNCHXL_I2C0_SDA0, - .sclPin = CC1312R1_LAUNCHXL_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC1312R1_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC1312R1_LAUNCHXL_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC1312R1_LAUNCHXL_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC1312R1_LAUNCHXL_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x48000 -#define SECTORSIZE 0x2000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS External Regions */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS External Regions */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC1312R1_LAUNCHXL_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC1312R1_LAUNCHXL_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC1312R1_LAUNCHXL_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC1312R1_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1312R1_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1312R1_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1312R1_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1312R1_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1312R1_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */ - CC1312R1_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC1312R1_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC1312R1_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC1312R1_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26X2_Config PowerCC26X2_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1312R1_LAUNCHXL_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_PWMCOUNT] = { - { .pwmPin = CC1312R1_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC1312R1_LAUNCHXL_GPTIMER0A }, - { .pwmPin = CC1312R1_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC1312R1_LAUNCHXL_GPTIMER0B }, - { .pwmPin = CC1312R1_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1312R1_LAUNCHXL_GPTIMER1A }, - { .pwmPin = CC1312R1_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC1312R1_LAUNCHXL_GPTIMER1B }, - { .pwmPin = CC1312R1_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC1312R1_LAUNCHXL_GPTIMER2A }, - { .pwmPin = CC1312R1_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC1312R1_LAUNCHXL_GPTIMER2B }, - { .pwmPin = CC1312R1_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC1312R1_LAUNCHXL_GPTIMER3A }, - { .pwmPin = CC1312R1_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC1312R1_LAUNCHXL_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC1312R1_LAUNCHXL_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1312R1_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1312R1_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1312R1_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1312R1_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1312R1_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1312R1_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1312R1_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1312R1_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC1312R1_LAUNCHXL_PWM7] }, -}; - -const uint_least8_t PWM_count = CC1312R1_LAUNCHXL_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - .globalCallback = NULL, /* No board specific callback */ - .globalEventMask = 0 /* No events subscribed to */ -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC1312R1_LAUNCHXL_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC1312R1_LAUNCHXL_SDCOUNT] = { - { - .spiIndex = CC1312R1_LAUNCHXL_SPI0, - .spiCsGpioIndex = CC1312R1_LAUNCHXL_SDSPI_CS - } -}; - -const SD_Config SD_config[CC1312R1_LAUNCHXL_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC1312R1_LAUNCHXL_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC1312R1_LAUNCHXL_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC1312R1_LAUNCHXL_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1312R1_LAUNCHXL_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1312R1_LAUNCHXL_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X2_Object trngCC26X2Object[CC1312R1_LAUNCHXL_TRNGCOUNT]; - -const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC1312R1_LAUNCHXL_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC1312R1_LAUNCHXL_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC1312R1_LAUNCHXL_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC1312R1_LAUNCHXL_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1312R1_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1312R1_LAUNCHXL_UART_TX, - .rxPin = CC1312R1_LAUNCHXL_UART_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1312R1_LAUNCHXL_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1312R1_LAUNCHXL_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC1312R1_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1312R1_LAUNCHXL_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC1312R1_LAUNCHXL_UART0] - }, -#endif -}; - -const uint_least8_t UART_count = CC1312R1_LAUNCHXL_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC1312R1_LAUNCHXL_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC1312R1_LAUNCHXL_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC1312R1_LAUNCHXL_UDMACOUNT] = { - { - .object = &udmaObjects[CC1312R1_LAUNCHXL_UDMA0], - .hwAttrs = &udmaHWAttrs[CC1312R1_LAUNCHXL_UDMA0] - }, -}; - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC1312R1_LAUNCHXL_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1312R1_LAUNCHXL_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC1312R1_LAUNCHXL_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC1312R1_LAUNCHXL_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC1312R1_LAUNCHXL_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC1312R1_LAUNCHXL_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC1312R1_LAUNCHXL_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC1312R1_LAUNCHXL_initGeneral ======== - */ -void CC1312R1_LAUNCHXL_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.h deleted file mode 100644 index 0295dc0b4..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL.h +++ /dev/null @@ -1,440 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** ============================================================================ - * @file CC1312R1_LAUNCHXL.h - * - * @brief CC1312R1 LaunchPad Board Specific header file. - * - * The CC1312R1_LAUNCHXL header file should be included in an application as - * follows: - * @code - * #include "CC1312R1_LAUNCHXL.h" - * @endcode - * - * ============================================================================ - */ -#ifndef __CC1312R1_LAUNCHXL_BOARD_H__ -#define __CC1312R1_LAUNCHXL_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC1312R1_LAUNCHXL - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Analog capable DIOs */ -#define CC1312R1_LAUNCHXL_DIO23_ANALOG IOID_23 -#define CC1312R1_LAUNCHXL_DIO24_ANALOG IOID_24 -#define CC1312R1_LAUNCHXL_DIO25_ANALOG IOID_25 -#define CC1312R1_LAUNCHXL_DIO26_ANALOG IOID_26 -#define CC1312R1_LAUNCHXL_DIO27_ANALOG IOID_27 -#define CC1312R1_LAUNCHXL_DIO28_ANALOG IOID_28 -#define CC1312R1_LAUNCHXL_DIO29_ANALOG IOID_29 -#define CC1312R1_LAUNCHXL_DIO30_ANALOG IOID_30 - -/* Digital IOs */ -#define CC1312R1_LAUNCHXL_DIO0 IOID_0 -#define CC1312R1_LAUNCHXL_DIO1 IOID_1 -#define CC1312R1_LAUNCHXL_DIO12 IOID_12 -#define CC1312R1_LAUNCHXL_DIO15 IOID_15 -#define CC1312R1_LAUNCHXL_DIO16_TDO IOID_16 -#define CC1312R1_LAUNCHXL_DIO17_TDI IOID_17 -#define CC1312R1_LAUNCHXL_DIO21 IOID_21 -#define CC1312R1_LAUNCHXL_DIO22 IOID_22 - -/* Discrete Inputs */ -#define CC1312R1_LAUNCHXL_PIN_BTN1 IOID_13 -#define CC1312R1_LAUNCHXL_PIN_BTN2 IOID_14 - -/* GPIO */ -#define CC1312R1_LAUNCHXL_GPIO_LED_ON 1 -#define CC1312R1_LAUNCHXL_GPIO_LED_OFF 0 - -/* I2C */ -#define CC1312R1_LAUNCHXL_I2C0_SCL0 IOID_4 -#define CC1312R1_LAUNCHXL_I2C0_SDA0 IOID_5 - -/* LEDs */ -#define CC1312R1_LAUNCHXL_PIN_LED_ON 1 -#define CC1312R1_LAUNCHXL_PIN_LED_OFF 0 -#define CC1312R1_LAUNCHXL_PIN_RLED IOID_6 -#define CC1312R1_LAUNCHXL_PIN_GLED IOID_7 - -/* PWM Outputs */ -#define CC1312R1_LAUNCHXL_PWMPIN0 CC1312R1_LAUNCHXL_PIN_RLED -#define CC1312R1_LAUNCHXL_PWMPIN1 CC1312R1_LAUNCHXL_PIN_GLED -#define CC1312R1_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED - -/* SPI */ -#define CC1312R1_LAUNCHXL_SPI_FLASH_CS IOID_20 -#define CC1312R1_LAUNCHXL_FLASH_CS_ON 0 -#define CC1312R1_LAUNCHXL_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC1312R1_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */ -#define CC1312R1_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */ -#define CC1312R1_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */ -#define CC1312R1_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC1312R1_LAUNCHXL_UART0_RX IOID_2 /* RXD */ -#define CC1312R1_LAUNCHXL_UART0_TX IOID_3 /* TXD */ -#define CC1312R1_LAUNCHXL_UART0_CTS IOID_19 /* CTS */ -#define CC1312R1_LAUNCHXL_UART0_RTS IOID_18 /* RTS */ -#define CC1312R1_LAUNCHXL_UART1_RX PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_UART1_TX PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_UART1_CTS PIN_UNASSIGNED -#define CC1312R1_LAUNCHXL_UART1_RTS PIN_UNASSIGNED -/* For backward compatibility */ -#define CC1312R1_LAUNCHXL_UART_RX CC1312R1_LAUNCHXL_UART0_RX -#define CC1312R1_LAUNCHXL_UART_TX CC1312R1_LAUNCHXL_UART0_TX -#define CC1312R1_LAUNCHXL_UART_CTS CC1312R1_LAUNCHXL_UART0_CTS -#define CC1312R1_LAUNCHXL_UART_RTS CC1312R1_LAUNCHXL_UART0_RTS - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC1312R1_LAUNCHXL_initGeneral(void); - -/*! - * @brief Turn off the external flash on LaunchPads - * - */ -void CC1312R1_LAUNCHXL_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC1312R1_LAUNCHXL_wakeUpExtFlash(void); - -/*! - * @def CC1312R1_LAUNCHXL_ADCBufName - * @brief Enum of ADCBufs - */ -typedef enum CC1312R1_LAUNCHXL_ADCBufName { - CC1312R1_LAUNCHXL_ADCBUF0 = 0, - - CC1312R1_LAUNCHXL_ADCBUFCOUNT -} CC1312R1_LAUNCHXL_ADCBufName; - -/*! - * @def CC1312R1_LAUNCHXL_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC1312R1_LAUNCHXL_ADCBuf0ChannelName { - CC1312R1_LAUNCHXL_ADCBUF0CHANNEL0 = 0, - CC1312R1_LAUNCHXL_ADCBUF0CHANNEL1, - CC1312R1_LAUNCHXL_ADCBUF0CHANNEL2, - CC1312R1_LAUNCHXL_ADCBUF0CHANNEL3, - CC1312R1_LAUNCHXL_ADCBUF0CHANNEL4, - CC1312R1_LAUNCHXL_ADCBUF0CHANNEL5, - CC1312R1_LAUNCHXL_ADCBUF0CHANNEL6, - CC1312R1_LAUNCHXL_ADCBUF0CHANNEL7, - CC1312R1_LAUNCHXL_ADCBUF0CHANNELVDDS, - CC1312R1_LAUNCHXL_ADCBUF0CHANNELDCOUPL, - CC1312R1_LAUNCHXL_ADCBUF0CHANNELVSS, - - CC1312R1_LAUNCHXL_ADCBUF0CHANNELCOUNT -} CC1312R1_LAUNCHXL_ADCBuf0ChannelName; - -/*! - * @def CC1312R1_LAUNCHXL_ADCName - * @brief Enum of ADCs - */ -typedef enum CC1312R1_LAUNCHXL_ADCName { - CC1312R1_LAUNCHXL_ADC0 = 0, - CC1312R1_LAUNCHXL_ADC1, - CC1312R1_LAUNCHXL_ADC2, - CC1312R1_LAUNCHXL_ADC3, - CC1312R1_LAUNCHXL_ADC4, - CC1312R1_LAUNCHXL_ADC5, - CC1312R1_LAUNCHXL_ADC6, - CC1312R1_LAUNCHXL_ADC7, - CC1312R1_LAUNCHXL_ADCDCOUPL, - CC1312R1_LAUNCHXL_ADCVSS, - CC1312R1_LAUNCHXL_ADCVDDS, - - CC1312R1_LAUNCHXL_ADCCOUNT -} CC1312R1_LAUNCHXL_ADCName; - -/*! - * @def CC1312R1_LAUNCHXL_ECDHName - * @brief Enum of ECDH names - */ -typedef enum CC1312R1_LAUNCHXL_ECDHName { - CC1312R1_LAUNCHXL_ECDH0 = 0, - - CC1312R1_LAUNCHXL_ECDHCOUNT -} CC1312R1_LAUNCHXL_ECDHName; - -/*! - * @def CC1312R1_LAUNCHXL_ECDSAName - * @brief Enum of ECDSA names - */ -typedef enum CC1312R1_LAUNCHXL_ECDSAName { - CC1312R1_LAUNCHXL_ECDSA0 = 0, - - CC1312R1_LAUNCHXL_ECDSACOUNT -} CC1312R1_LAUNCHXL_ECDSAName; - -/*! - * @def CC1312R1_LAUNCHXL_ECJPAKEName - * @brief Enum of ECJPAKE names - */ -typedef enum CC1312R1_LAUNCHXL_ECJPAKEName { - CC1312R1_LAUNCHXL_ECJPAKE0 = 0, - - CC1312R1_LAUNCHXL_ECJPAKECOUNT -} CC1312R1_LAUNCHXL_ECJPAKEName; - -/*! - * @def CC1312R1_LAUNCHXL_AESCCMName - * @brief Enum of AESCCM names - */ -typedef enum CC1312R1_LAUNCHXL_AESCCMName { - CC1312R1_LAUNCHXL_AESCCM0 = 0, - - CC1312R1_LAUNCHXL_AESCCMCOUNT -} CC1312R1_LAUNCHXL_AESCCMName; - -/*! - * @def CC1312R1_LAUNCHXL_AESECBName - * @brief Enum of AESECB names - */ -typedef enum CC1312R1_LAUNCHXL_AESECBName { - CC1312R1_LAUNCHXL_AESECB0 = 0, - - CC1312R1_LAUNCHXL_AESECBCOUNT -} CC1312R1_LAUNCHXL_AESECBName; - -/*! - * @def CC1312R1_LAUNCHXL_SHA2Name - * @brief Enum of SHA2 names - */ -typedef enum CC1312R1_LAUNCHXL_SHA2Name { - CC1312R1_LAUNCHXL_SHA20 = 0, - - CC1312R1_LAUNCHXL_SHA2COUNT -} CC1312R1_LAUNCHXL_SHA2Name; - -/*! - * @def CC1312R1_LAUNCHXL_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC1312R1_LAUNCHXL_GPIOName { - CC1312R1_LAUNCHXL_GPIO_S1 = 0, - CC1312R1_LAUNCHXL_GPIO_S2, - CC1312R1_LAUNCHXL_SPI_MASTER_READY, - CC1312R1_LAUNCHXL_SPI_SLAVE_READY, - CC1312R1_LAUNCHXL_GPIO_LED_GREEN, - CC1312R1_LAUNCHXL_GPIO_LED_RED, - CC1312R1_LAUNCHXL_GPIO_SPI_FLASH_CS, - CC1312R1_LAUNCHXL_SDSPI_CS, - CC1312R1_LAUNCHXL_GPIOCOUNT -} CC1312R1_LAUNCHXL_GPIOName; - -/*! - * @def CC1312R1_LAUNCHXL_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC1312R1_LAUNCHXL_GPTimerName { - CC1312R1_LAUNCHXL_GPTIMER0A = 0, - CC1312R1_LAUNCHXL_GPTIMER0B, - CC1312R1_LAUNCHXL_GPTIMER1A, - CC1312R1_LAUNCHXL_GPTIMER1B, - CC1312R1_LAUNCHXL_GPTIMER2A, - CC1312R1_LAUNCHXL_GPTIMER2B, - CC1312R1_LAUNCHXL_GPTIMER3A, - CC1312R1_LAUNCHXL_GPTIMER3B, - - CC1312R1_LAUNCHXL_GPTIMERPARTSCOUNT -} CC1312R1_LAUNCHXL_GPTimerName; - -/*! - * @def CC1312R1_LAUNCHXL_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC1312R1_LAUNCHXL_GPTimers { - CC1312R1_LAUNCHXL_GPTIMER0 = 0, - CC1312R1_LAUNCHXL_GPTIMER1, - CC1312R1_LAUNCHXL_GPTIMER2, - CC1312R1_LAUNCHXL_GPTIMER3, - - CC1312R1_LAUNCHXL_GPTIMERCOUNT -} CC1312R1_LAUNCHXL_GPTimers; - -/*! - * @def CC1312R1_LAUNCHXL_I2CName - * @brief Enum of I2C names - */ -typedef enum CC1312R1_LAUNCHXL_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC1312R1_LAUNCHXL_I2C0 = 0, -#endif - - CC1312R1_LAUNCHXL_I2CCOUNT -} CC1312R1_LAUNCHXL_I2CName; - -/*! - * @def CC1312R1_LAUNCHXL_NVSName - * @brief Enum of NVS names - */ -typedef enum CC1312R1_LAUNCHXL_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC1312R1_LAUNCHXL_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC1312R1_LAUNCHXL_NVSSPI25X0, -#endif - - CC1312R1_LAUNCHXL_NVSCOUNT -} CC1312R1_LAUNCHXL_NVSName; - -/*! - * @def CC1312R1_LAUNCHXL_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC1312R1_LAUNCHXL_PWMName { - CC1312R1_LAUNCHXL_PWM0 = 0, - CC1312R1_LAUNCHXL_PWM1, - CC1312R1_LAUNCHXL_PWM2, - CC1312R1_LAUNCHXL_PWM3, - CC1312R1_LAUNCHXL_PWM4, - CC1312R1_LAUNCHXL_PWM5, - CC1312R1_LAUNCHXL_PWM6, - CC1312R1_LAUNCHXL_PWM7, - - CC1312R1_LAUNCHXL_PWMCOUNT -} CC1312R1_LAUNCHXL_PWMName; - -/*! - * @def CC1312R1_LAUNCHXL_SDName - * @brief Enum of SD names - */ -typedef enum CC1312R1_LAUNCHXL_SDName { - CC1312R1_LAUNCHXL_SDSPI0 = 0, - - CC1312R1_LAUNCHXL_SDCOUNT -} CC1312R1_LAUNCHXL_SDName; - -/*! - * @def CC1312R1_LAUNCHXL_SPIName - * @brief Enum of SPI names - */ -typedef enum CC1312R1_LAUNCHXL_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC1312R1_LAUNCHXL_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC1312R1_LAUNCHXL_SPI1, -#endif - - CC1312R1_LAUNCHXL_SPICOUNT -} CC1312R1_LAUNCHXL_SPIName; - -/*! - * @def CC1312R1_LAUNCHXL_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC1312R1_LAUNCHXL_TRNGName { - CC1312R1_LAUNCHXL_TRNG0 = 0, - - CC1312R1_LAUNCHXL_TRNGCOUNT -} CC1312R1_LAUNCHXL_TRNGName; - -/*! - * @def CC1312R1_LAUNCHXL_UARTName - * @brief Enum of UARTs - */ -typedef enum CC1312R1_LAUNCHXL_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC1312R1_LAUNCHXL_UART0 = 0, -#endif - - CC1312R1_LAUNCHXL_UARTCOUNT -} CC1312R1_LAUNCHXL_UARTName; - -/*! - * @def CC1312R1_LAUNCHXL_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC1312R1_LAUNCHXL_UDMAName { - CC1312R1_LAUNCHXL_UDMA0 = 0, - - CC1312R1_LAUNCHXL_UDMACOUNT -} CC1312R1_LAUNCHXL_UDMAName; - -/*! - * @def CC1312R1_LAUNCHXL_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC1312R1_LAUNCHXL_WatchdogName { - CC1312R1_LAUNCHXL_WATCHDOG0 = 0, - - CC1312R1_LAUNCHXL_WATCHDOGCOUNT -} CC1312R1_LAUNCHXL_WatchdogName; - - -#ifdef __cplusplus -} -#endif - -#endif /* __CC1312R1_LAUNCHXL_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL_fxns.c deleted file mode 100644 index 0a28583d4..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/CC1312R1_LAUNCHXL_fxns.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ======== CC1312R1_LAUNCHXL_fxns.c ======== - * This file contains the board-specific initialization functions. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) -#include - -#include "Board.h" - -/* - * ======== CC1312R1_LAUNCHXL_sendExtFlashByte ======== - */ -void CC1312R1_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC1312R1_LAUNCHXL_wakeUpExtFlash ======== - */ -void CC1312R1_LAUNCHXL_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC1312R1_LAUNCHXL_shutDownExtFlash ======== - */ -void CC1312R1_LAUNCHXL_shutDownExtFlash(void) -{ - /* - * To be sure we are putting the flash into sleep and not waking it, - * we first have to make a wake up call - */ - CC1312R1_LAUNCHXL_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC1312R1_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC1312R1_LAUNCHXL_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/Makefile.cc1312r1 b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/Makefile.cc1312r1 deleted file mode 100644 index b88997c9a..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/Makefile.cc1312r1 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x2-cc26x2 -DEVICE_FAMILY = CC13X2 -DEVICE_LINE = CC13XX -DEVICE = CC1312R - -BOARD_SOURCEFILES += CC1312R1_LAUNCHXL.c CC1312R1_LAUNCHXL_fxns.c - -SUPPORTS_PROP_MODE = 1 -SUPPORTS_IEEE_MODE = 0 -SUPPORTS_BLE_BEACON = 0 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 0 - -# Include the common board makefile -include $(FAMILY_PATH)/launchpad/Makefile.launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/rf-conf.h deleted file mode 100644 index f649dd170..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1312r1/rf-conf.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for the Sub-1 GHz path - * on the radio. - * - * These are the following front-end mode configurations for the - * CC1312R1-LAUNCHXL board: - * - Sub-1 GHz: differential and external bias - * - * @{ - */ -#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/Board.h deleted file mode 100644 index 4b8fbe5c0..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/Board.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC1350_LAUNCHXL_433.h" - -#define Board_CC1350_LAUNCHXL_433 -#define BOARD_STRING "TI CC1350-433 LaunchPad" - -#define Board_initGeneral() CC1350_LAUNCHXL_433_initGeneral() -#define Board_shutDownExtFlash() CC1350_LAUNCHXL_433_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC1350_LAUNCHXL_433_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADC0 CC1350_LAUNCHXL_433_ADC0 -#define Board_ADC1 CC1350_LAUNCHXL_433_ADC1 - -#define Board_ADCBUF0 CC1350_LAUNCHXL_433_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC1350_LAUNCHXL_433_ADCBUF0CHANNEL0 -#define Board_ADCBUF0CHANNEL1 CC1350_LAUNCHXL_433_ADCBUF0CHANNEL1 - -#define Board_CRYPTO0 CC1350_LAUNCHXL_433_CRYPTO0 - -#define Board_DIO0 CC1350_LAUNCHXL_433_DIO0 -#define Board_DIO1_RFSW CC1350_LAUNCHXL_433_DIO1_RF_SUB1GHZ -#define Board_DIO12 CC1350_LAUNCHXL_433_DIO12 -#define Board_DIO15 CC1350_LAUNCHXL_433_DIO15 -#define Board_DIO16_TDO CC1350_LAUNCHXL_433_DIO16_TDO -#define Board_DIO17_TDI CC1350_LAUNCHXL_433_DIO17_TDI -#define Board_DIO21 CC1350_LAUNCHXL_433_DIO21 -#define Board_DIO22 CC1350_LAUNCHXL_433_DIO22 -#define Board_DIO30_SWPWR CC1350_LAUNCHXL_433_DIO30_RF_POWER - -#define Board_DIO23_ANALOG CC1350_LAUNCHXL_433_DIO23_ANALOG -#define Board_DIO24_ANALOG CC1350_LAUNCHXL_433_DIO24_ANALOG -#define Board_DIO25_ANALOG CC1350_LAUNCHXL_433_DIO25_ANALOG -#define Board_DIO26_ANALOG CC1350_LAUNCHXL_433_DIO26_ANALOG -#define Board_DIO27_ANALOG CC1350_LAUNCHXL_433_DIO27_ANALOG -#define Board_DIO28_ANALOG CC1350_LAUNCHXL_433_DIO28_ANALOG -#define Board_DIO29_ANALOG CC1350_LAUNCHXL_433_DIO29_ANALOG -#define Board_DIO30_ANALOG CC1350_LAUNCHXL_433_DIO30_ANALOG - -/* - * Board_RF_SUB1GHZ and Board_RF_POWER are the names generated by SysConfig. - * Define them here so that RF callback function can reference them. - */ -#define Board_RF_SUB1GHZ CC1350_LAUNCHXL_433_DIO1_RF_SUB1GHZ -#define Board_RF_POWER CC1350_LAUNCHXL_433_DIO30_RF_POWER - -#define Board_GPIO_BUTTON0 CC1350_LAUNCHXL_433_GPIO_S1 -#define Board_GPIO_BUTTON1 CC1350_LAUNCHXL_433_GPIO_S2 -#define Board_GPIO_BTN1 CC1350_LAUNCHXL_433_GPIO_S1 -#define Board_GPIO_BTN2 CC1350_LAUNCHXL_433_GPIO_S2 -#define Board_GPIO_LED0 CC1350_LAUNCHXL_433_GPIO_LED_RED -#define Board_GPIO_LED1 CC1350_LAUNCHXL_433_GPIO_LED_GREEN -#define Board_GPIO_RLED CC1350_LAUNCHXL_433_GPIO_LED_RED -#define Board_GPIO_GLED CC1350_LAUNCHXL_433_GPIO_LED_GREEN -#define Board_GPIO_LED_ON CC1350_LAUNCHXL_433_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC1350_LAUNCHXL_433_GPIO_LED_OFF - -#define Board_GPTIMER0A CC1350_LAUNCHXL_433_GPTIMER0A -#define Board_GPTIMER0B CC1350_LAUNCHXL_433_GPTIMER0B -#define Board_GPTIMER1A CC1350_LAUNCHXL_433_GPTIMER1A -#define Board_GPTIMER1B CC1350_LAUNCHXL_433_GPTIMER1B -#define Board_GPTIMER2A CC1350_LAUNCHXL_433_GPTIMER2A -#define Board_GPTIMER2B CC1350_LAUNCHXL_433_GPTIMER2B -#define Board_GPTIMER3A CC1350_LAUNCHXL_433_GPTIMER3A -#define Board_GPTIMER3B CC1350_LAUNCHXL_433_GPTIMER3B - -#define Board_NVSINTERNAL CC1350_LAUNCHXL_433_NVSCC26XX0 -#define Board_NVSEXTERNAL CC1350_LAUNCHXL_433_NVSSPI25X0 - -#define Board_I2C0 CC1350_LAUNCHXL_433_I2C0 -#define Board_I2C_TMP CC1350_LAUNCHXL_433_I2C0 - -#define Board_PIN_BUTTON0 CC1350_LAUNCHXL_433_PIN_BTN1 -#define Board_PIN_BUTTON1 CC1350_LAUNCHXL_433_PIN_BTN2 -#define Board_PIN_BTN1 CC1350_LAUNCHXL_433_PIN_BTN1 -#define Board_PIN_BTN2 CC1350_LAUNCHXL_433_PIN_BTN2 -#define Board_PIN_LED0 CC1350_LAUNCHXL_433_PIN_RLED -#define Board_PIN_LED1 CC1350_LAUNCHXL_433_PIN_GLED -#define Board_PIN_LED2 CC1350_LAUNCHXL_433_PIN_RLED -#define Board_PIN_RLED CC1350_LAUNCHXL_433_PIN_RLED -#define Board_PIN_GLED CC1350_LAUNCHXL_433_PIN_GLED - -#define Board_PWM0 CC1350_LAUNCHXL_433_PWM0 -#define Board_PWM1 CC1350_LAUNCHXL_433_PWM1 -#define Board_PWM2 CC1350_LAUNCHXL_433_PWM2 -#define Board_PWM3 CC1350_LAUNCHXL_433_PWM3 -#define Board_PWM4 CC1350_LAUNCHXL_433_PWM4 -#define Board_PWM5 CC1350_LAUNCHXL_433_PWM5 -#define Board_PWM6 CC1350_LAUNCHXL_433_PWM6 -#define Board_PWM7 CC1350_LAUNCHXL_433_PWM7 - -#define Board_SD0 CC1350_LAUNCHXL_433_SDSPI0 - -#define Board_SPI0 CC1350_LAUNCHXL_433_SPI0 -#define Board_SPI0_MISO CC1350_LAUNCHXL_433_SPI0_MISO -#define Board_SPI0_MOSI CC1350_LAUNCHXL_433_SPI0_MOSI -#define Board_SPI0_CLK CC1350_LAUNCHXL_433_SPI0_CLK -#define Board_SPI0_CSN CC1350_LAUNCHXL_433_SPI0_CSN -#define Board_SPI1 CC1350_LAUNCHXL_433_SPI1 -#define Board_SPI1_MISO CC1350_LAUNCHXL_433_SPI1_MISO -#define Board_SPI1_MOSI CC1350_LAUNCHXL_433_SPI1_MOSI -#define Board_SPI1_CLK CC1350_LAUNCHXL_433_SPI1_CLK -#define Board_SPI1_CSN CC1350_LAUNCHXL_433_SPI1_CSN -#define Board_SPI_FLASH_CS CC1350_LAUNCHXL_433_SPI_FLASH_CS -#define Board_FLASH_CS_ON (0) -#define Board_FLASH_CS_OFF (1) - -#define Board_SPI_MASTER CC1350_LAUNCHXL_433_SPI0 -#define Board_SPI_SLAVE CC1350_LAUNCHXL_433_SPI0 -#define Board_SPI_MASTER_READY CC1350_LAUNCHXL_433_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC1350_LAUNCHXL_433_SPI_SLAVE_READY - -#define Board_UART0 CC1350_LAUNCHXL_433_UART0 - -#define Board_WATCHDOG0 CC1350_LAUNCHXL_433_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_TMP_ADDR (0x40) -#define Board_SENSORS_BP_TMP_ADDR Board_TMP_ADDR - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.c deleted file mode 100644 index aa690dff4..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.c +++ /dev/null @@ -1,828 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ============================ CC1350_LAUNCHXL_433.c ============================ - * This file is responsible for setting up the board specific items for the - * CC1350_LAUNCHXL_433 board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC1350_LAUNCHXL_433.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26XX_Object adcBufCC26XXobjects[CC1350_LAUNCHXL_433_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[CC1350_LAUNCHXL_433_ADCBUF0CHANNELCOUNT] = { - {CC1350_LAUNCHXL_433_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7}, - {CC1350_LAUNCHXL_433_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6}, - {CC1350_LAUNCHXL_433_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5}, - {CC1350_LAUNCHXL_433_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4}, - {CC1350_LAUNCHXL_433_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3}, - {CC1350_LAUNCHXL_433_DIO28_ANALOG, ADC_COMPB_IN_AUXIO2}, - {CC1350_LAUNCHXL_433_DIO29_ANALOG, ADC_COMPB_IN_AUXIO1}, - {CC1350_LAUNCHXL_433_DIO30_ANALOG, ADC_COMPB_IN_AUXIO0}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, -}; - -const ADCBufCC26XX_HWAttrs adcBufCC26XXHWAttrs[CC1350_LAUNCHXL_433_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26XX_adcChannelLut, - .gpTimerUnit = CC1350_LAUNCHXL_433_GPTIMER0A, - .gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC1350_LAUNCHXL_433_ADCBUFCOUNT] = { - { - &ADCBufCC26XX_fxnTable, - &adcBufCC26XXobjects[CC1350_LAUNCHXL_433_ADCBUF0], - &adcBufCC26XXHWAttrs[CC1350_LAUNCHXL_433_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC1350_LAUNCHXL_433_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC1350_LAUNCHXL_433_ADCCOUNT]; - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADCCOUNT] = { - { - .adcDIO = CC1350_LAUNCHXL_433_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_433_DIO24_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO6, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_433_DIO25_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO5, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_433_DIO26_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO4, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_433_DIO27_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO3, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_433_DIO28_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO2, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_433_DIO29_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO1, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_433_DIO30_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO0, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_10P9_MS, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC1350_LAUNCHXL_433_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADC0], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADC0]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADC1], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADC1]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADC2], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADC2]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADC3], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADC3]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADC4], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADC4]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADC5], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADC5]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADC6], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADC6]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADC7], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADC7]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADCDCOUPL], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADCVSS], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_433_ADCVDDS], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_433_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC1350_LAUNCHXL_433_ADCCOUNT; - -/* - * =============================== Crypto =============================== - */ -#include - -CryptoCC26XX_Object cryptoCC26XXObjects[CC1350_LAUNCHXL_433_CRYPTOCOUNT]; - -const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC1350_LAUNCHXL_433_CRYPTOCOUNT] = { - { - .baseAddr = CRYPTO_BASE, - .powerMngrId = PowerCC26XX_PERIPH_CRYPTO, - .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ, - .intPriority = ~0, - } -}; - -const CryptoCC26XX_Config CryptoCC26XX_config[CC1350_LAUNCHXL_433_CRYPTOCOUNT] = { - { - .object = &cryptoCC26XXObjects[CC1350_LAUNCHXL_433_CRYPTO0], - .hwAttrs = &cryptoCC26XXHWAttrs[CC1350_LAUNCHXL_433_CRYPTO0] - }, -}; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1350_LAUNCHXL_433.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_13 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1350_LAUNCHXL_433_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1350_LAUNCHXL_433_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG, - - /* SD CS */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1350_LAUNCHXL_433.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC1350_LAUNCHXL_433_SPI_MASTER_READY */ - NULL, /* CC1350_LAUNCHXL_433_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = sizeof(gpioPinConfigs)/sizeof(GPIO_PinConfig), - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC1350_LAUNCHXL_433_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1350_LAUNCHXL_433_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_433_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_433_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_433_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_433_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_433_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_433_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_433_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_433_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC1350_LAUNCHXL_433_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350_LAUNCHXL_433_I2CCOUNT] = { - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC1350_LAUNCHXL_433_I2C0_SDA0, - .sclPin = CC1350_LAUNCHXL_433_I2C0_SCL0, - } -}; - -const I2C_Config I2C_config[CC1350_LAUNCHXL_433_I2CCOUNT] = { - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC1350_LAUNCHXL_433_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC1350_LAUNCHXL_433_I2C0] - }, -}; - -const uint_least8_t I2C_count = CC1350_LAUNCHXL_433_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x1A000 -#define SECTORSIZE 0x1000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS External Regions */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS External Regions */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC1350_LAUNCHXL_433_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC1350_LAUNCHXL_433_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC1350_LAUNCHXL_433_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC1350_LAUNCHXL_433_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1350_LAUNCHXL_433_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1350_LAUNCHXL_433_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350_LAUNCHXL_433_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350_LAUNCHXL_433_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1350_LAUNCHXL_433_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */ - CC1350_LAUNCHXL_433_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC1350_LAUNCHXL_433_DIO1_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* RF SW Switch defaults to 2.4 GHz path*/ - CC1350_LAUNCHXL_433_DIO30_RF_POWER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* External RF Switch is powered off by default */ - CC1350_LAUNCHXL_433_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC1350_LAUNCHXL_433_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC1350_LAUNCHXL_433_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26XX_Config PowerCC26XX_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1350_LAUNCHXL_433_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_PWMCOUNT] = { - { .pwmPin = CC1350_LAUNCHXL_433_PWMPIN0, .gpTimerUnit = CC1350_LAUNCHXL_433_GPTIMER0A }, - { .pwmPin = CC1350_LAUNCHXL_433_PWMPIN1, .gpTimerUnit = CC1350_LAUNCHXL_433_GPTIMER0B }, - { .pwmPin = CC1350_LAUNCHXL_433_PWMPIN2, .gpTimerUnit = CC1350_LAUNCHXL_433_GPTIMER1A }, - { .pwmPin = CC1350_LAUNCHXL_433_PWMPIN3, .gpTimerUnit = CC1350_LAUNCHXL_433_GPTIMER1B }, - { .pwmPin = CC1350_LAUNCHXL_433_PWMPIN4, .gpTimerUnit = CC1350_LAUNCHXL_433_GPTIMER2A }, - { .pwmPin = CC1350_LAUNCHXL_433_PWMPIN5, .gpTimerUnit = CC1350_LAUNCHXL_433_GPTIMER2B }, - { .pwmPin = CC1350_LAUNCHXL_433_PWMPIN6, .gpTimerUnit = CC1350_LAUNCHXL_433_GPTIMER3A }, - { .pwmPin = CC1350_LAUNCHXL_433_PWMPIN7, .gpTimerUnit = CC1350_LAUNCHXL_433_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC1350_LAUNCHXL_433_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_433_PWM0], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_433_PWM1], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_433_PWM2], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_433_PWM3], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_433_PWM4], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_433_PWM5], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_433_PWM6], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_433_PWM7], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_433_PWM7] }, -}; - -const uint_least8_t PWM_count = CC1350_LAUNCHXL_433_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -/* - * Board-specific callback function to set the correct antenna path. - * - * This function is called by the RF driver on global driver events. - * It contains a default implementation to set the correct antenna path. - * This function is defined in the file CC1350_LAUNCHXL_433_fxns.c - */ -extern void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg); - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - - /* Register the board specific callback */ - .globalCallback = &rfDriverCallback, - /* Subscribe the callback to both events */ - .globalEventMask = RF_GlobalEventRadioSetup | RF_GlobalEventRadioPowerDown -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC1350_LAUNCHXL_433_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC1350_LAUNCHXL_433_SDCOUNT] = { - { - .spiIndex = CC1350_LAUNCHXL_433_SPI0, - .spiCsGpioIndex = CC1350_LAUNCHXL_433_SDSPI_CS - } -}; - -const SD_Config SD_config[CC1350_LAUNCHXL_433_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC1350_LAUNCHXL_433_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC1350_LAUNCHXL_433_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC1350_LAUNCHXL_433_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350_LAUNCHXL_433_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_433_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X0_Object trngCC26X0Object[CC1350_LAUNCHXL_433_TRNGCOUNT]; - -const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1350_LAUNCHXL_433_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC1350_LAUNCHXL_433_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC1350_LAUNCHXL_433_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC1350_LAUNCHXL_433_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350_LAUNCHXL_433_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1350_LAUNCHXL_433_UART_TX, - .rxPin = CC1350_LAUNCHXL_433_UART_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1350_LAUNCHXL_433_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1350_LAUNCHXL_433_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC1350_LAUNCHXL_433_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1350_LAUNCHXL_433_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC1350_LAUNCHXL_433_UART0] - }, -#endif -}; - -const uint_least8_t UART_count = CC1350_LAUNCHXL_433_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC1350_LAUNCHXL_433_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC1350_LAUNCHXL_433_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC1350_LAUNCHXL_433_UDMACOUNT] = { - { - .object = &udmaObjects[CC1350_LAUNCHXL_433_UDMA0], - .hwAttrs = &udmaHWAttrs[CC1350_LAUNCHXL_433_UDMA0] - }, -}; - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC1350_LAUNCHXL_433_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1350_LAUNCHXL_433_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC1350_LAUNCHXL_433_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC1350_LAUNCHXL_433_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC1350_LAUNCHXL_433_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC1350_LAUNCHXL_433_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC1350_LAUNCHXL_433_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC1350_LAUNCHXL_433_initGeneral ======== - */ -void CC1350_LAUNCHXL_433_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.h deleted file mode 100644 index 5377700d5..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.h +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** ============================================================================ - * @file CC1350_LAUNCHXL_433.h - * - * @brief CC1350 LaunchPad Board Specific header file. - * - * The CC1350_LAUNCHXL_433 header file should be included in an application as - * follows: - * @code - * #include "CC1350_LAUNCHXL_433.h" - * @endcode - * - * ============================================================================ - */ -#ifndef __CC1350_LAUNCHXL_433_BOARD_H__ -#define __CC1350_LAUNCHXL_433_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC1350_LAUNCHXL_433 - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Analog Capable DIOs */ -#define CC1350_LAUNCHXL_433_DIO23_ANALOG IOID_23 -#define CC1350_LAUNCHXL_433_DIO24_ANALOG IOID_24 -#define CC1350_LAUNCHXL_433_DIO25_ANALOG IOID_25 -#define CC1350_LAUNCHXL_433_DIO26_ANALOG IOID_26 -#define CC1350_LAUNCHXL_433_DIO27_ANALOG IOID_27 -#define CC1350_LAUNCHXL_433_DIO28_ANALOG IOID_28 -#define CC1350_LAUNCHXL_433_DIO29_ANALOG IOID_29 -#define CC1350_LAUNCHXL_433_DIO30_ANALOG IOID_30 - -/* Digital IOs */ -#define CC1350_LAUNCHXL_433_DIO0 IOID_0 -#define CC1350_LAUNCHXL_433_DIO1_RF_SUB1GHZ IOID_1 -#define CC1350_LAUNCHXL_433_DIO12 IOID_12 -#define CC1350_LAUNCHXL_433_DIO15 IOID_15 -#define CC1350_LAUNCHXL_433_DIO16_TDO IOID_16 -#define CC1350_LAUNCHXL_433_DIO17_TDI IOID_17 -#define CC1350_LAUNCHXL_433_DIO21 IOID_21 -#define CC1350_LAUNCHXL_433_DIO22 IOID_22 -#define CC1350_LAUNCHXL_433_DIO30_RF_POWER IOID_30 - -/* Discrete Inputs */ -#define CC1350_LAUNCHXL_433_PIN_BTN1 IOID_13 -#define CC1350_LAUNCHXL_433_PIN_BTN2 IOID_14 - - -/* GPIO */ -#define CC1350_LAUNCHXL_433_GPIO_LED_ON 1 -#define CC1350_LAUNCHXL_433_GPIO_LED_OFF 0 - -/* I2C */ -#define CC1350_LAUNCHXL_433_I2C0_SCL0 IOID_4 -#define CC1350_LAUNCHXL_433_I2C0_SDA0 IOID_5 - - -/* LEDs */ -#define CC1350_LAUNCHXL_433_PIN_LED_ON 1 -#define CC1350_LAUNCHXL_433_PIN_LED_OFF 0 -#define CC1350_LAUNCHXL_433_PIN_RLED IOID_6 -#define CC1350_LAUNCHXL_433_PIN_GLED IOID_7 - -/* PWM Outputs */ -#define CC1350_LAUNCHXL_433_PWMPIN0 CC1350_LAUNCHXL_433_PIN_RLED -#define CC1350_LAUNCHXL_433_PWMPIN1 CC1350_LAUNCHXL_433_PIN_GLED -#define CC1350_LAUNCHXL_433_PWMPIN2 PIN_UNASSIGNED -#define CC1350_LAUNCHXL_433_PWMPIN3 PIN_UNASSIGNED -#define CC1350_LAUNCHXL_433_PWMPIN4 PIN_UNASSIGNED -#define CC1350_LAUNCHXL_433_PWMPIN5 PIN_UNASSIGNED -#define CC1350_LAUNCHXL_433_PWMPIN6 PIN_UNASSIGNED -#define CC1350_LAUNCHXL_433_PWMPIN7 PIN_UNASSIGNED - -/* SPI */ -#define CC1350_LAUNCHXL_433_SPI_FLASH_CS IOID_20 -#define CC1350_LAUNCHXL_433_FLASH_CS_ON 0 -#define CC1350_LAUNCHXL_433_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC1350_LAUNCHXL_433_SPI0_MISO IOID_8 /* RF1.20 */ -#define CC1350_LAUNCHXL_433_SPI0_MOSI IOID_9 /* RF1.18 */ -#define CC1350_LAUNCHXL_433_SPI0_CLK IOID_10 /* RF1.16 */ -#define CC1350_LAUNCHXL_433_SPI0_CSN PIN_UNASSIGNED -#define CC1350_LAUNCHXL_433_SPI1_MISO PIN_UNASSIGNED -#define CC1350_LAUNCHXL_433_SPI1_MOSI PIN_UNASSIGNED -#define CC1350_LAUNCHXL_433_SPI1_CLK PIN_UNASSIGNED -#define CC1350_LAUNCHXL_433_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC1350_LAUNCHXL_433_UART_RX IOID_2 /* RXD */ -#define CC1350_LAUNCHXL_433_UART_TX IOID_3 /* TXD */ -#define CC1350_LAUNCHXL_433_UART_CTS IOID_19 /* CTS */ -#define CC1350_LAUNCHXL_433_UART_RTS IOID_18 /* RTS */ - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC1350_LAUNCHXL_433_initGeneral(void); - -/*! - * @brief Turn off the external flash on LaunchPads - * - */ -void CC1350_LAUNCHXL_433_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC1350_LAUNCHXL_433_wakeUpExtFlash(void); - -/*! - * @def CC1350_LAUNCHXL_433_ADCBufName - * @brief Enum of ADCBufs - */ -typedef enum CC1350_LAUNCHXL_433_ADCBufName { - CC1350_LAUNCHXL_433_ADCBUF0 = 0, - - CC1350_LAUNCHXL_433_ADCBUFCOUNT -} CC1350_LAUNCHXL_433_ADCBufName; - -/*! - * @def CC1350_LAUNCHXL_433_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC1350_LAUNCHXL_433_ADCBuf0ChannelName { - CC1350_LAUNCHXL_433_ADCBUF0CHANNEL0 = 0, - CC1350_LAUNCHXL_433_ADCBUF0CHANNEL1, - CC1350_LAUNCHXL_433_ADCBUF0CHANNEL2, - CC1350_LAUNCHXL_433_ADCBUF0CHANNEL3, - CC1350_LAUNCHXL_433_ADCBUF0CHANNEL4, - CC1350_LAUNCHXL_433_ADCBUF0CHANNEL5, - CC1350_LAUNCHXL_433_ADCBUF0CHANNEL6, - CC1350_LAUNCHXL_433_ADCBUF0CHANNEL7, - CC1350_LAUNCHXL_433_ADCBUF0CHANNELVDDS, - CC1350_LAUNCHXL_433_ADCBUF0CHANNELDCOUPL, - CC1350_LAUNCHXL_433_ADCBUF0CHANNELVSS, - - CC1350_LAUNCHXL_433_ADCBUF0CHANNELCOUNT -} CC1350_LAUNCHXL_433_ADCBuf0ChannelName; - -/*! - * @def CC1350_LAUNCHXL_433_ADCName - * @brief Enum of ADCs - */ -typedef enum CC1350_LAUNCHXL_433_ADCName { - CC1350_LAUNCHXL_433_ADC0 = 0, - CC1350_LAUNCHXL_433_ADC1, - CC1350_LAUNCHXL_433_ADC2, - CC1350_LAUNCHXL_433_ADC3, - CC1350_LAUNCHXL_433_ADC4, - CC1350_LAUNCHXL_433_ADC5, - CC1350_LAUNCHXL_433_ADC6, - CC1350_LAUNCHXL_433_ADC7, - CC1350_LAUNCHXL_433_ADCDCOUPL, - CC1350_LAUNCHXL_433_ADCVSS, - CC1350_LAUNCHXL_433_ADCVDDS, - - CC1350_LAUNCHXL_433_ADCCOUNT -} CC1350_LAUNCHXL_433_ADCName; - -/*! - * @def CC1350_LAUNCHXL_433_CryptoName - * @brief Enum of Crypto names - */ -typedef enum CC1350_LAUNCHXL_433_CryptoName { - CC1350_LAUNCHXL_433_CRYPTO0 = 0, - - CC1350_LAUNCHXL_433_CRYPTOCOUNT -} CC1350_LAUNCHXL_433_CryptoName; - -/*! - * @def CC1350_LAUNCHXL_433_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC1350_LAUNCHXL_433_GPIOName { - CC1350_LAUNCHXL_433_GPIO_S1 = 0, - CC1350_LAUNCHXL_433_GPIO_S2, - CC1350_LAUNCHXL_433_SPI_MASTER_READY, - CC1350_LAUNCHXL_433_SPI_SLAVE_READY, - CC1350_LAUNCHXL_433_GPIO_LED_GREEN, - CC1350_LAUNCHXL_433_GPIO_LED_RED, - CC1350_LAUNCHXL_433_GPIO_SPI_FLASH_CS, - CC1350_LAUNCHXL_433_SDSPI_CS, - CC1350_LAUNCHXL_433_GPIOCOUNT -} CC1350_LAUNCHXL_433_GPIOName; - -/*! - * @def CC1350_LAUNCHXL_433_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC1350_LAUNCHXL_433_GPTimerName { - CC1350_LAUNCHXL_433_GPTIMER0A = 0, - CC1350_LAUNCHXL_433_GPTIMER0B, - CC1350_LAUNCHXL_433_GPTIMER1A, - CC1350_LAUNCHXL_433_GPTIMER1B, - CC1350_LAUNCHXL_433_GPTIMER2A, - CC1350_LAUNCHXL_433_GPTIMER2B, - CC1350_LAUNCHXL_433_GPTIMER3A, - CC1350_LAUNCHXL_433_GPTIMER3B, - - CC1350_LAUNCHXL_433_GPTIMERPARTSCOUNT -} CC1350_LAUNCHXL_433_GPTimerName; - -/*! - * @def CC1350_LAUNCHXL_433_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC1350_LAUNCHXL_433_GPTimers { - CC1350_LAUNCHXL_433_GPTIMER0 = 0, - CC1350_LAUNCHXL_433_GPTIMER1, - CC1350_LAUNCHXL_433_GPTIMER2, - CC1350_LAUNCHXL_433_GPTIMER3, - - CC1350_LAUNCHXL_433_GPTIMERCOUNT -} CC1350_LAUNCHXL_433_GPTimers; - -/*! - * @def CC1350_LAUNCHXL_433_I2CName - * @brief Enum of I2C names - */ -typedef enum CC1350_LAUNCHXL_433_I2CName { - CC1350_LAUNCHXL_433_I2C0 = 0, - - CC1350_LAUNCHXL_433_I2CCOUNT -} CC1350_LAUNCHXL_433_I2CName; - -/*! - * @def CC1350_LAUNCHXL_433_NVSName - * @brief Enum of NVS names - */ -typedef enum CC1350_LAUNCHXL_433_NVSName { -#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH - CC1350_LAUNCHXL_433_NVSCC26XX0 = 0, -#endif -#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH - CC1350_LAUNCHXL_433_NVSSPI25X0, -#endif - - CC1350_LAUNCHXL_433_NVSCOUNT -} CC1350_LAUNCHXL_433_NVSName; - -/*! - * @def CC1350_LAUNCHXL_433_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC1350_LAUNCHXL_433_PWMName { - CC1350_LAUNCHXL_433_PWM0 = 0, - CC1350_LAUNCHXL_433_PWM1, - CC1350_LAUNCHXL_433_PWM2, - CC1350_LAUNCHXL_433_PWM3, - CC1350_LAUNCHXL_433_PWM4, - CC1350_LAUNCHXL_433_PWM5, - CC1350_LAUNCHXL_433_PWM6, - CC1350_LAUNCHXL_433_PWM7, - - CC1350_LAUNCHXL_433_PWMCOUNT -} CC1350_LAUNCHXL_433_PWMName; - -/*! - * @def CC1350_LAUNCHXL_433_SDName - * @brief Enum of SD names - */ -typedef enum CC1350_LAUNCHXL_433_SDName { - CC1350_LAUNCHXL_433_SDSPI0 = 0, - - CC1350_LAUNCHXL_433_SDCOUNT -} CC1350_LAUNCHXL_433_SDName; - -/*! - * @def CC1350_LAUNCHXL_433_SPIName - * @brief Enum of SPI names - */ -typedef enum CC1350_LAUNCHXL_433_SPIName { - CC1350_LAUNCHXL_433_SPI0 = 0, - CC1350_LAUNCHXL_433_SPI1, - - CC1350_LAUNCHXL_433_SPICOUNT -} CC1350_LAUNCHXL_433_SPIName; - -/*! - * @def CC1350_LAUNCHXL_433_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC1350_LAUNCHXL_433_TRNGName { - CC1350_LAUNCHXL_433_TRNG0 = 0, - - CC1350_LAUNCHXL_433_TRNGCOUNT -} CC1350_LAUNCHXL_433_TRNGName; - -/*! - * @def CC1350_LAUNCHXL_433_UARTName - * @brief Enum of UARTs - */ -typedef enum CC1350_LAUNCHXL_433_UARTName { - CC1350_LAUNCHXL_433_UART0 = 0, - - CC1350_LAUNCHXL_433_UARTCOUNT -} CC1350_LAUNCHXL_433_UARTName; - -/*! - * @def CC1350_LAUNCHXL_433_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC1350_LAUNCHXL_433_UDMAName { - CC1350_LAUNCHXL_433_UDMA0 = 0, - - CC1350_LAUNCHXL_433_UDMACOUNT -} CC1350_LAUNCHXL_433_UDMAName; - -/*! - * @def CC1350_LAUNCHXL_433_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC1350_LAUNCHXL_433_WatchdogName { - CC1350_LAUNCHXL_433_WATCHDOG0 = 0, - - CC1350_LAUNCHXL_433_WATCHDOGCOUNT -} CC1350_LAUNCHXL_433_WatchdogName; - -#ifdef __cplusplus -} -#endif - -#endif /* __CC1350_LAUNCHXL_433_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433_fxns.c deleted file mode 100644 index 92e349480..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433_fxns.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * ======== CC1350_LAUNCHXL_433_fxns.c ======== - * This file contains the board-specific initialization functions, and - * RF callback function for antenna switching. - */ -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include -#include - -#include "Board.h" - - -/* - * ======== CC1350_LAUNCHXL_433_sendExtFlashByte ======== - */ -void CC1350_LAUNCHXL_433_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC1350_LAUNCHXL_433_wakeUpExtFlash ======== - */ -void CC1350_LAUNCHXL_433_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC1350_LAUNCHXL_433_shutDownExtFlash ======== - */ -void CC1350_LAUNCHXL_433_shutDownExtFlash(void) -{ - /* - * To be sure we are putting the flash into sleep and not waking it, - * we first have to make a wake up call - */ - CC1350_LAUNCHXL_433_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC1350_LAUNCHXL_433_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC1350_LAUNCHXL_433_shutDownExtFlash(); -} - -/* - * For the SysConfig generated Board.h file, Board_RF_SUB1GHZ will not be - * defined unless the RF module is added to the configuration. Therefore, - * we don't include this code if Board_RF_SUB1GHZ is not defined. - */ -#if defined(Board_RF_SUB1GHZ) - -/* - * Mask to be used to determine the effective value of the setup command's - * loDivider field. - */ -#define LODIVIDER_MASK 0x7F - -/* - * ======== rfDriverCallback ======== - * This is an implementation for the CC1350 LaunchPad which uses a - * single signal for antenna switching. - */ -void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg) -{ - /* Decode input arguments. */ - (void)client; - RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg; - - /* Local variable. */ - bool sub1GHz = false; - uint8_t loDivider = 0; - - if (events & RF_GlobalEventRadioSetup) { - /* Power up the antenna switch */ - PINCC26XX_setOutputValue(Board_RF_POWER, 1); - - /* Decision about the frequency band shall be made based on the - loDivider field. */ - switch (setupCommand->common.commandNo) { - case (CMD_RADIO_SETUP): - case (CMD_BLE5_RADIO_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->common.loDivider; - - /* Sub-1 GHz, requires antenna switch high. */ - if ((loDivider != 0) && (loDivider != 2)) { - sub1GHz = true; - } - break; - case (CMD_PROP_RADIO_DIV_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider; - - /* Sub-1 GHz, requires antenna switch high. */ - if ((loDivider != 0) && (loDivider != 2)) { - sub1GHz = true; - } - break; - default:break; - } - - /* Select the correct antenna. */ - if (sub1GHz) { - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 1); - } - else { - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0); - } - } - else if (events & RF_GlobalEventRadioPowerDown) { - /* Disable antenna switch to save current */ - PINCC26XX_setOutputValue(Board_RF_POWER, 0); - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0); - } -} -#endif diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/Makefile.cc1350-4 b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/Makefile.cc1350-4 deleted file mode 100644 index 8ea92347b..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/Makefile.cc1350-4 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x0-cc26x0 -DEVICE_FAMILY = CC13X0 -DEVICE_LINE = CC13XX -DEVICE = CC1350_4 - -BOARD_SOURCEFILES += CC1350_LAUNCHXL_433.c CC1350_LAUNCHXL_433_fxns.c - -SUPPORTS_PROP_MODE = 1 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 1 - -# Include the common board makefile -include $(FAMILY_PATH)/launchpad/Makefile.launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/rf-conf.h deleted file mode 100644 index 371af4d89..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/rf-conf.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for both the Sub-1 GHz - * path and the 2.4 GHz path on the radio. - * - * These are the following front-end mode configurations for the - * CC1350-4-LAUNCHXL board: - * - Sub-1 GHz: differential and external bias - * - 2.4 GHz: differential and external bias - * - * @{ - */ -#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL - -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/Board.h deleted file mode 100644 index 97ff04a59..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/Board.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC1350_LAUNCHXL.h" - -#define Board_CC1350_LAUNCHXL -#define BOARD_STRING "TI CC1350 LaunchPad" - -#define Board_initGeneral() CC1350_LAUNCHXL_initGeneral() -#define Board_shutDownExtFlash() CC1350_LAUNCHXL_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC1350_LAUNCHXL_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADC0 CC1350_LAUNCHXL_ADC0 -#define Board_ADC1 CC1350_LAUNCHXL_ADC1 - -#define Board_ADCBUF0 CC1350_LAUNCHXL_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC1350_LAUNCHXL_ADCBUF0CHANNEL0 -#define Board_ADCBUF0CHANNEL1 CC1350_LAUNCHXL_ADCBUF0CHANNEL1 - -#define Board_CRYPTO0 CC1350_LAUNCHXL_CRYPTO0 - -#define Board_DIO0 CC1350_LAUNCHXL_DIO0 -#define Board_DIO1_RFSW CC1350_LAUNCHXL_DIO1_RF_SUB1GHZ -#define Board_DIO12 CC1350_LAUNCHXL_DIO12 -#define Board_DIO15 CC1350_LAUNCHXL_DIO15 -#define Board_DIO16_TDO CC1350_LAUNCHXL_DIO16_TDO -#define Board_DIO17_TDI CC1350_LAUNCHXL_DIO17_TDI -#define Board_DIO21 CC1350_LAUNCHXL_DIO21 -#define Board_DIO22 CC1350_LAUNCHXL_DIO22 -#define Board_DIO30_SWPWR CC1350_LAUNCHXL_DIO30_RF_POWER - -#define Board_DIO23_ANALOG CC1350_LAUNCHXL_DIO23_ANALOG -#define Board_DIO24_ANALOG CC1350_LAUNCHXL_DIO24_ANALOG -#define Board_DIO25_ANALOG CC1350_LAUNCHXL_DIO25_ANALOG -#define Board_DIO26_ANALOG CC1350_LAUNCHXL_DIO26_ANALOG -#define Board_DIO27_ANALOG CC1350_LAUNCHXL_DIO27_ANALOG -#define Board_DIO28_ANALOG CC1350_LAUNCHXL_DIO28_ANALOG -#define Board_DIO29_ANALOG CC1350_LAUNCHXL_DIO29_ANALOG -#define Board_DIO30_ANALOG CC1350_LAUNCHXL_DIO30_ANALOG - -/* - * Board_RF_SUB1GHZ and Board_RF_POWER are the names generated by SysConfig. - * Define them here so that RF callback function can reference them. - */ -#define Board_RF_SUB1GHZ CC1350_LAUNCHXL_DIO1_RF_SUB1GHZ -#define Board_RF_POWER CC1350_LAUNCHXL_DIO30_RF_POWER - -#define Board_GPIO_BUTTON0 CC1350_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BUTTON1 CC1350_LAUNCHXL_GPIO_S2 -#define Board_GPIO_BTN1 CC1350_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BTN2 CC1350_LAUNCHXL_GPIO_S2 -#define Board_GPIO_LED0 CC1350_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_LED1 CC1350_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_RLED CC1350_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_GLED CC1350_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED_ON CC1350_LAUNCHXL_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC1350_LAUNCHXL_GPIO_LED_OFF - -#define Board_GPTIMER0A CC1350_LAUNCHXL_GPTIMER0A -#define Board_GPTIMER0B CC1350_LAUNCHXL_GPTIMER0B -#define Board_GPTIMER1A CC1350_LAUNCHXL_GPTIMER1A -#define Board_GPTIMER1B CC1350_LAUNCHXL_GPTIMER1B -#define Board_GPTIMER2A CC1350_LAUNCHXL_GPTIMER2A -#define Board_GPTIMER2B CC1350_LAUNCHXL_GPTIMER2B -#define Board_GPTIMER3A CC1350_LAUNCHXL_GPTIMER3A -#define Board_GPTIMER3B CC1350_LAUNCHXL_GPTIMER3B - -#define Board_NVSINTERNAL CC1350_LAUNCHXL_NVSCC26XX0 -#define Board_NVSEXTERNAL CC1350_LAUNCHXL_NVSSPI25X0 - -#define Board_I2C0 CC1350_LAUNCHXL_I2C0 -#define Board_I2C_TMP CC1350_LAUNCHXL_I2C0 - -#define Board_PIN_BUTTON0 CC1350_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BUTTON1 CC1350_LAUNCHXL_PIN_BTN2 -#define Board_PIN_BTN1 CC1350_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BTN2 CC1350_LAUNCHXL_PIN_BTN2 -#define Board_PIN_LED0 CC1350_LAUNCHXL_PIN_RLED -#define Board_PIN_LED1 CC1350_LAUNCHXL_PIN_GLED -#define Board_PIN_LED2 CC1350_LAUNCHXL_PIN_RLED -#define Board_PIN_RLED CC1350_LAUNCHXL_PIN_RLED -#define Board_PIN_GLED CC1350_LAUNCHXL_PIN_GLED - -#define Board_PWM0 CC1350_LAUNCHXL_PWM0 -#define Board_PWM1 CC1350_LAUNCHXL_PWM1 -#define Board_PWM2 CC1350_LAUNCHXL_PWM2 -#define Board_PWM3 CC1350_LAUNCHXL_PWM3 -#define Board_PWM4 CC1350_LAUNCHXL_PWM4 -#define Board_PWM5 CC1350_LAUNCHXL_PWM5 -#define Board_PWM6 CC1350_LAUNCHXL_PWM6 -#define Board_PWM7 CC1350_LAUNCHXL_PWM7 - -#define Board_SD0 CC1350_LAUNCHXL_SDSPI0 - -#define Board_SPI0 CC1350_LAUNCHXL_SPI0 -#define Board_SPI0_MISO CC1350_LAUNCHXL_SPI0_MISO -#define Board_SPI0_MOSI CC1350_LAUNCHXL_SPI0_MOSI -#define Board_SPI0_CLK CC1350_LAUNCHXL_SPI0_CLK -#define Board_SPI0_CSN CC1350_LAUNCHXL_SPI0_CSN -#define Board_SPI1 CC1350_LAUNCHXL_SPI1 -#define Board_SPI1_MISO CC1350_LAUNCHXL_SPI1_MISO -#define Board_SPI1_MOSI CC1350_LAUNCHXL_SPI1_MOSI -#define Board_SPI1_CLK CC1350_LAUNCHXL_SPI1_CLK -#define Board_SPI1_CSN CC1350_LAUNCHXL_SPI1_CSN -#define Board_SPI_FLASH_CS CC1350_LAUNCHXL_SPI_FLASH_CS -#define Board_FLASH_CS_ON (0) -#define Board_FLASH_CS_OFF (1) - -#define Board_SPI_MASTER CC1350_LAUNCHXL_SPI0 -#define Board_SPI_SLAVE CC1350_LAUNCHXL_SPI0 -#define Board_SPI_MASTER_READY CC1350_LAUNCHXL_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC1350_LAUNCHXL_SPI_SLAVE_READY - -#define Board_UART0 CC1350_LAUNCHXL_UART0 - -#define Board_WATCHDOG0 CC1350_LAUNCHXL_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_TMP_ADDR (0x40) -#define Board_SENSORS_BP_TMP_ADDR Board_TMP_ADDR - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.c deleted file mode 100644 index ff7f47351..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.c +++ /dev/null @@ -1,833 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ============================ CC1350_LAUNCHXL.c ============================ - * This file is responsible for setting up the board specific items for the - * CC1350_LAUNCHXL board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC1350_LAUNCHXL.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -static ADCBufCC26XX_Object adcBufCC26XXobjects[CC1350_LAUNCHXL_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[CC1350_LAUNCHXL_ADCBUF0CHANNELCOUNT] = { - {CC1350_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7}, - {CC1350_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6}, - {CC1350_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5}, - {CC1350_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4}, - {CC1350_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3}, - {CC1350_LAUNCHXL_DIO28_ANALOG, ADC_COMPB_IN_AUXIO2}, - {CC1350_LAUNCHXL_DIO29_ANALOG, ADC_COMPB_IN_AUXIO1}, - {CC1350_LAUNCHXL_DIO30_ANALOG, ADC_COMPB_IN_AUXIO0}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, -}; - -const ADCBufCC26XX_HWAttrs adcBufCC26XXHWAttrs[CC1350_LAUNCHXL_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26XX_adcChannelLut, - .gpTimerUnit = CC1350_LAUNCHXL_GPTIMER0A, - .gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC1350_LAUNCHXL_ADCBUFCOUNT] = { - { - &ADCBufCC26XX_fxnTable, - &adcBufCC26XXobjects[CC1350_LAUNCHXL_ADCBUF0], - //NULL, - &adcBufCC26XXHWAttrs[CC1350_LAUNCHXL_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC1350_LAUNCHXL_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -static ADCCC26XX_Object adcCC26xxObjects[CC1350_LAUNCHXL_ADCCOUNT]; - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADCCOUNT] = { - { - .adcDIO = CC1350_LAUNCHXL_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_DIO24_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO6, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_DIO25_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO5, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_DIO26_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO4, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_DIO27_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO3, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_DIO28_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO2, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_DIO29_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO1, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1350_LAUNCHXL_DIO30_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO0, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_10P9_MS, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC1350_LAUNCHXL_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADC0]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADC1]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADC2]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADC3]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADC4]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADC5], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADC5]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADC6], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADC6]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADC7], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADC7]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC1350_LAUNCHXL_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC1350_LAUNCHXL_ADCCOUNT; - -/* - * =============================== Crypto =============================== - */ -#include - -CryptoCC26XX_Object cryptoCC26XXObjects[CC1350_LAUNCHXL_CRYPTOCOUNT]; - -const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC1350_LAUNCHXL_CRYPTOCOUNT] = { - { - .baseAddr = CRYPTO_BASE, - .powerMngrId = PowerCC26XX_PERIPH_CRYPTO, - .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ, - .intPriority = ~0, - } -}; - -const CryptoCC26XX_Config CryptoCC26XX_config[CC1350_LAUNCHXL_CRYPTOCOUNT] = { - { - .object = &cryptoCC26XXObjects[CC1350_LAUNCHXL_CRYPTO0], - .hwAttrs = &cryptoCC26XXHWAttrs[CC1350_LAUNCHXL_CRYPTO0] - }, -}; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1350_LAUNCHXL.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_13 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1350_LAUNCHXL_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1350_LAUNCHXL_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG, - - /* SD CS */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1350_LAUNCHXL.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC1350_LAUNCHXL_SPI_MASTER_READY */ - NULL, /* CC1350_LAUNCHXL_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = sizeof(gpioPinConfigs)/sizeof(GPIO_PinConfig), - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC1350_LAUNCHXL_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1350_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC1350_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350_LAUNCHXL_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC1350_LAUNCHXL_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC1350_LAUNCHXL_I2C0_SDA0, - .sclPin = CC1350_LAUNCHXL_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC1350_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC1350_LAUNCHXL_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC1350_LAUNCHXL_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC1350_LAUNCHXL_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x1A000 -#define SECTORSIZE 0x1000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS External Regions */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS External Regions */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC1350_LAUNCHXL_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC1350_LAUNCHXL_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC1350_LAUNCHXL_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC1350_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1350_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1350_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1350_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */ - CC1350_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC1350_LAUNCHXL_DIO1_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* RF SW Switch defaults to 2.4 GHz path*/ - CC1350_LAUNCHXL_DIO30_RF_POWER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* External RF Switch is powered off by default */ - CC1350_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC1350_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC1350_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26XX_Config PowerCC26XX_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1350_LAUNCHXL_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_PWMCOUNT] = { - { .pwmPin = CC1350_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC1350_LAUNCHXL_GPTIMER0A }, - { .pwmPin = CC1350_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC1350_LAUNCHXL_GPTIMER0B }, - { .pwmPin = CC1350_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1350_LAUNCHXL_GPTIMER1A }, - { .pwmPin = CC1350_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC1350_LAUNCHXL_GPTIMER1B }, - { .pwmPin = CC1350_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC1350_LAUNCHXL_GPTIMER2A }, - { .pwmPin = CC1350_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC1350_LAUNCHXL_GPTIMER2B }, - { .pwmPin = CC1350_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC1350_LAUNCHXL_GPTIMER3A }, - { .pwmPin = CC1350_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC1350_LAUNCHXL_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC1350_LAUNCHXL_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC1350_LAUNCHXL_PWM7] }, -}; - -const uint_least8_t PWM_count = CC1350_LAUNCHXL_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -/* - * Board-specific callback function to set the correct antenna path. - * - * This function is called by the RF driver on global driver events. - * It contains a default implementation to set the correct antenna path. - * This function is defined in the file CC1350_LAUNCHXL_fxns.c - */ -extern void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg); - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - - /* Register the board specific callback */ - .globalCallback = &rfDriverCallback, - /* Subscribe the callback to both events */ - .globalEventMask = RF_GlobalEventRadioSetup | RF_GlobalEventRadioPowerDown -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC1350_LAUNCHXL_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC1350_LAUNCHXL_SDCOUNT] = { - { - .spiIndex = CC1350_LAUNCHXL_SPI0, - .spiCsGpioIndex = CC1350_LAUNCHXL_SDSPI_CS - } -}; - -const SD_Config SD_config[CC1350_LAUNCHXL_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC1350_LAUNCHXL_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC1350_LAUNCHXL_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC1350_LAUNCHXL_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350_LAUNCHXL_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350_LAUNCHXL_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X0_Object trngCC26X0Object[CC1350_LAUNCHXL_TRNGCOUNT]; - -const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1350_LAUNCHXL_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC1350_LAUNCHXL_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC1350_LAUNCHXL_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC1350_LAUNCHXL_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1350_LAUNCHXL_UART_TX, - .rxPin = CC1350_LAUNCHXL_UART_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1350_LAUNCHXL_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1350_LAUNCHXL_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC1350_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1350_LAUNCHXL_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC1350_LAUNCHXL_UART0] - }, -#endif -}; - -const uint_least8_t UART_count = CC1350_LAUNCHXL_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC1350_LAUNCHXL_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC1350_LAUNCHXL_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC1350_LAUNCHXL_UDMACOUNT] = { - { - .object = &udmaObjects[CC1350_LAUNCHXL_UDMA0], - .hwAttrs = &udmaHWAttrs[CC1350_LAUNCHXL_UDMA0] - }, -}; - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC1350_LAUNCHXL_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1350_LAUNCHXL_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC1350_LAUNCHXL_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC1350_LAUNCHXL_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC1350_LAUNCHXL_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC1350_LAUNCHXL_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC1350_LAUNCHXL_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC1350_LAUNCHXL_initGeneral ======== - */ -void CC1350_LAUNCHXL_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.h deleted file mode 100644 index 9167a15c3..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL.h +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** ============================================================================ - * @file CC1350_LAUNCHXL.h - * - * @brief CC1350 LaunchPad Board Specific header file. - * - * The CC1350_LAUNCHXL header file should be included in an application as - * follows: - * @code - * #include "CC1350_LAUNCHXL.h" - * @endcode - * - * ============================================================================ - */ -#ifndef __CC1350_LAUNCHXL_BOARD_H__ -#define __CC1350_LAUNCHXL_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC1350_LAUNCHXL - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Analog Capable DIOs */ -#define CC1350_LAUNCHXL_DIO23_ANALOG IOID_23 -#define CC1350_LAUNCHXL_DIO24_ANALOG IOID_24 -#define CC1350_LAUNCHXL_DIO25_ANALOG IOID_25 -#define CC1350_LAUNCHXL_DIO26_ANALOG IOID_26 -#define CC1350_LAUNCHXL_DIO27_ANALOG IOID_27 -#define CC1350_LAUNCHXL_DIO28_ANALOG IOID_28 -#define CC1350_LAUNCHXL_DIO29_ANALOG IOID_29 -#define CC1350_LAUNCHXL_DIO30_ANALOG IOID_30 - -/* Digital IOs */ -#define CC1350_LAUNCHXL_DIO0 IOID_0 -#define CC1350_LAUNCHXL_DIO1_RF_SUB1GHZ IOID_1 -#define CC1350_LAUNCHXL_DIO12 IOID_12 -#define CC1350_LAUNCHXL_DIO15 IOID_15 -#define CC1350_LAUNCHXL_DIO16_TDO IOID_16 -#define CC1350_LAUNCHXL_DIO17_TDI IOID_17 -#define CC1350_LAUNCHXL_DIO21 IOID_21 -#define CC1350_LAUNCHXL_DIO22 IOID_22 -#define CC1350_LAUNCHXL_DIO30_RF_POWER IOID_30 - -/* Discrete Inputs */ -#define CC1350_LAUNCHXL_PIN_BTN1 IOID_13 -#define CC1350_LAUNCHXL_PIN_BTN2 IOID_14 - - -/* GPIO */ -#define CC1350_LAUNCHXL_GPIO_LED_ON 1 -#define CC1350_LAUNCHXL_GPIO_LED_OFF 0 - -/* I2C */ -#define CC1350_LAUNCHXL_I2C0_SCL0 IOID_4 -#define CC1350_LAUNCHXL_I2C0_SDA0 IOID_5 - - -/* LEDs */ -#define CC1350_LAUNCHXL_PIN_LED_ON 1 -#define CC1350_LAUNCHXL_PIN_LED_OFF 0 -#define CC1350_LAUNCHXL_PIN_RLED IOID_6 -#define CC1350_LAUNCHXL_PIN_GLED IOID_7 - -/* PWM Outputs */ -#define CC1350_LAUNCHXL_PWMPIN0 CC1350_LAUNCHXL_PIN_RLED -#define CC1350_LAUNCHXL_PWMPIN1 CC1350_LAUNCHXL_PIN_GLED -#define CC1350_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED -#define CC1350_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED -#define CC1350_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED -#define CC1350_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED -#define CC1350_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED -#define CC1350_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED - -/* SPI */ -#define CC1350_LAUNCHXL_SPI_FLASH_CS IOID_20 -#define CC1350_LAUNCHXL_FLASH_CS_ON 0 -#define CC1350_LAUNCHXL_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC1350_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */ -#define CC1350_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */ -#define CC1350_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */ -#define CC1350_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED -#define CC1350_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED -#define CC1350_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED -#define CC1350_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED -#define CC1350_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC1350_LAUNCHXL_UART_RX IOID_2 /* RXD */ -#define CC1350_LAUNCHXL_UART_TX IOID_3 /* TXD */ -#define CC1350_LAUNCHXL_UART_CTS IOID_19 /* CTS */ -#define CC1350_LAUNCHXL_UART_RTS IOID_18 /* RTS */ - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC1350_LAUNCHXL_initGeneral(void); - -/*! - * @brief Turn off the external flash on LaunchPads - * - */ -void CC1350_LAUNCHXL_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC1350_LAUNCHXL_wakeUpExtFlash(void); - -/*! - * @def CC1350_LAUNCHXL_ADCBufName - * @brief Enum of ADCBufs - */ -typedef enum CC1350_LAUNCHXL_ADCBufName { - CC1350_LAUNCHXL_ADCBUF0 = 0, - - CC1350_LAUNCHXL_ADCBUFCOUNT -} CC1350_LAUNCHXL_ADCBufName; - -/*! - * @def CC1350_LAUNCHXL_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC1350_LAUNCHXL_ADCBuf0ChannelName { - CC1350_LAUNCHXL_ADCBUF0CHANNEL0 = 0, - CC1350_LAUNCHXL_ADCBUF0CHANNEL1, - CC1350_LAUNCHXL_ADCBUF0CHANNEL2, - CC1350_LAUNCHXL_ADCBUF0CHANNEL3, - CC1350_LAUNCHXL_ADCBUF0CHANNEL4, - CC1350_LAUNCHXL_ADCBUF0CHANNEL5, - CC1350_LAUNCHXL_ADCBUF0CHANNEL6, - CC1350_LAUNCHXL_ADCBUF0CHANNEL7, - CC1350_LAUNCHXL_ADCBUF0CHANNELVDDS, - CC1350_LAUNCHXL_ADCBUF0CHANNELDCOUPL, - CC1350_LAUNCHXL_ADCBUF0CHANNELVSS, - - CC1350_LAUNCHXL_ADCBUF0CHANNELCOUNT -} CC1350_LAUNCHXL_ADCBuf0ChannelName; - -/*! - * @def CC1350_LAUNCHXL_ADCName - * @brief Enum of ADCs - */ -typedef enum CC1350_LAUNCHXL_ADCName { - CC1350_LAUNCHXL_ADC0 = 0, - CC1350_LAUNCHXL_ADC1, - CC1350_LAUNCHXL_ADC2, - CC1350_LAUNCHXL_ADC3, - CC1350_LAUNCHXL_ADC4, - CC1350_LAUNCHXL_ADC5, - CC1350_LAUNCHXL_ADC6, - CC1350_LAUNCHXL_ADC7, - CC1350_LAUNCHXL_ADCDCOUPL, - CC1350_LAUNCHXL_ADCVSS, - CC1350_LAUNCHXL_ADCVDDS, - - CC1350_LAUNCHXL_ADCCOUNT -} CC1350_LAUNCHXL_ADCName; - -/*! - * @def CC1350_LAUNCHXL_CryptoName - * @brief Enum of Crypto names - */ -typedef enum CC1350_LAUNCHXL_CryptoName { - CC1350_LAUNCHXL_CRYPTO0 = 0, - - CC1350_LAUNCHXL_CRYPTOCOUNT -} CC1350_LAUNCHXL_CryptoName; - -/*! - * @def CC1350_LAUNCHXL_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC1350_LAUNCHXL_GPIOName { - CC1350_LAUNCHXL_GPIO_S1 = 0, - CC1350_LAUNCHXL_GPIO_S2, - CC1350_LAUNCHXL_SPI_MASTER_READY, - CC1350_LAUNCHXL_SPI_SLAVE_READY, - CC1350_LAUNCHXL_GPIO_LED_GREEN, - CC1350_LAUNCHXL_GPIO_LED_RED, - CC1350_LAUNCHXL_GPIO_SPI_FLASH_CS, - CC1350_LAUNCHXL_SDSPI_CS, - CC1350_LAUNCHXL_GPIOCOUNT -} CC1350_LAUNCHXL_GPIOName; - -/*! - * @def CC1350_LAUNCHXL_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC1350_LAUNCHXL_GPTimerName { - CC1350_LAUNCHXL_GPTIMER0A = 0, - CC1350_LAUNCHXL_GPTIMER0B, - CC1350_LAUNCHXL_GPTIMER1A, - CC1350_LAUNCHXL_GPTIMER1B, - CC1350_LAUNCHXL_GPTIMER2A, - CC1350_LAUNCHXL_GPTIMER2B, - CC1350_LAUNCHXL_GPTIMER3A, - CC1350_LAUNCHXL_GPTIMER3B, - - CC1350_LAUNCHXL_GPTIMERPARTSCOUNT -} CC1350_LAUNCHXL_GPTimerName; - -/*! - * @def CC1350_LAUNCHXL_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC1350_LAUNCHXL_GPTimers { - CC1350_LAUNCHXL_GPTIMER0 = 0, - CC1350_LAUNCHXL_GPTIMER1, - CC1350_LAUNCHXL_GPTIMER2, - CC1350_LAUNCHXL_GPTIMER3, - - CC1350_LAUNCHXL_GPTIMERCOUNT -} CC1350_LAUNCHXL_GPTimers; - -/*! - * @def CC1350_LAUNCHXL_I2CName - * @brief Enum of I2C names - */ -typedef enum CC1350_LAUNCHXL_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC1350_LAUNCHXL_I2C0 = 0, -#endif - - CC1350_LAUNCHXL_I2CCOUNT -} CC1350_LAUNCHXL_I2CName; - -/*! - * @def CC1350_LAUNCHXL_NVSName - * @brief Enum of NVS names - */ -typedef enum CC1350_LAUNCHXL_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC1350_LAUNCHXL_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC1350_LAUNCHXL_NVSSPI25X0, -#endif - - CC1350_LAUNCHXL_NVSCOUNT -} CC1350_LAUNCHXL_NVSName; - -/*! - * @def CC1350_LAUNCHXL_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC1350_LAUNCHXL_PWMName { - CC1350_LAUNCHXL_PWM0 = 0, - CC1350_LAUNCHXL_PWM1, - CC1350_LAUNCHXL_PWM2, - CC1350_LAUNCHXL_PWM3, - CC1350_LAUNCHXL_PWM4, - CC1350_LAUNCHXL_PWM5, - CC1350_LAUNCHXL_PWM6, - CC1350_LAUNCHXL_PWM7, - - CC1350_LAUNCHXL_PWMCOUNT -} CC1350_LAUNCHXL_PWMName; - -/*! - * @def CC1350_LAUNCHXL_SDName - * @brief Enum of SD names - */ -typedef enum CC1350_LAUNCHXL_SDName { - CC1350_LAUNCHXL_SDSPI0 = 0, - - CC1350_LAUNCHXL_SDCOUNT -} CC1350_LAUNCHXL_SDName; - -/*! - * @def CC1350_LAUNCHXL_SPIName - * @brief Enum of SPI names - */ -typedef enum CC1350_LAUNCHXL_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC1350_LAUNCHXL_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC1350_LAUNCHXL_SPI1, -#endif - - CC1350_LAUNCHXL_SPICOUNT -} CC1350_LAUNCHXL_SPIName; - -/*! - * @def CC1350_LAUNCHXL_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC1350_LAUNCHXL_TRNGName { - CC1350_LAUNCHXL_TRNG0 = 0, - - CC1350_LAUNCHXL_TRNGCOUNT -} CC1350_LAUNCHXL_TRNGName; - -/*! - * @def CC1350_LAUNCHXL_UARTName - * @brief Enum of UARTs - */ -typedef enum CC1350_LAUNCHXL_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC1350_LAUNCHXL_UART0 = 0, -#endif - - CC1350_LAUNCHXL_UARTCOUNT -} CC1350_LAUNCHXL_UARTName; - -/*! - * @def CC1350_LAUNCHXL_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC1350_LAUNCHXL_UDMAName { - CC1350_LAUNCHXL_UDMA0 = 0, - - CC1350_LAUNCHXL_UDMACOUNT -} CC1350_LAUNCHXL_UDMAName; - -/*! - * @def CC1350_LAUNCHXL_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC1350_LAUNCHXL_WatchdogName { - CC1350_LAUNCHXL_WATCHDOG0 = 0, - - CC1350_LAUNCHXL_WATCHDOGCOUNT -} CC1350_LAUNCHXL_WatchdogName; - -#ifdef __cplusplus -} -#endif - -#endif /* __CC1350_LAUNCHXL_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL_fxns.c deleted file mode 100644 index 56de7c562..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/CC1350_LAUNCHXL_fxns.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ======== CC1350_LAUNCHXL_fxns.c ======== - * This file contains the board-specific initialization functions, and - * RF callback function for antenna switching. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include -#include - -#include "Board.h" - - -/* - * ======== CC1350_LAUNCHXL_sendExtFlashByte ======== - */ -void CC1350_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC1350_LAUNCHXL_wakeUpExtFlash ======== - */ -void CC1350_LAUNCHXL_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC1350_LAUNCHXL_shutDownExtFlash ======== - */ -void CC1350_LAUNCHXL_shutDownExtFlash(void) -{ - /* - * To be sure we are putting the flash into sleep and not waking it, - * we first have to make a wake up call - */ - CC1350_LAUNCHXL_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC1350_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC1350_LAUNCHXL_shutDownExtFlash(); -} - -/* - * For the SysConfig generated Board.h file, Board_RF_SUB1GHZ will not be - * defined unless the RF module is added to the configuration. Therefore, - * we don't include this code if Board_RF_SUB1GHZ is not defined. - */ -#if defined(Board_RF_SUB1GHZ) - -/* - * Mask to be used to determine the effective value of the setup command's - * loDivider field. - */ -#define LODIVIDER_MASK 0x7F - -/* - * ======== rfDriverCallback ======== - * This is an implementation for the CC1350 launchpad which uses a - * single signal for antenna switching. - */ -void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg) -{ - /* Decode input arguments. */ - (void)client; - RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg; - - /* Local variable. */ - bool sub1GHz = false; - uint8_t loDivider = 0; - - if (events & RF_GlobalEventRadioSetup) { - /* Power up the antenna switch */ - PINCC26XX_setOutputValue(Board_RF_POWER, 1); - - /* Decision about the frequency band shall be made based on the - loDivider field. */ - switch (setupCommand->common.commandNo) { - case (CMD_RADIO_SETUP): - case (CMD_BLE5_RADIO_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->common.loDivider; - - /* Sub-1 GHz, requires antenna switch high. */ - if ((loDivider != 0) && (loDivider != 2)) { - sub1GHz = true; - } - break; - case (CMD_PROP_RADIO_DIV_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider; - - /* Sub-1 GHz, requires antenna switch high. */ - if ((loDivider != 0) && (loDivider != 2)) { - sub1GHz = true; - } - break; - default:break; - } - - /* Select the correct antenna. */ - if (sub1GHz) { - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 1); - } - else { - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0); - } - } - else if (events & RF_GlobalEventRadioPowerDown) { - /* Disable antenna switch to save current */ - PINCC26XX_setOutputValue(Board_RF_POWER, 0); - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0); - } -} -#endif diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/Makefile.cc1350 b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/Makefile.cc1350 deleted file mode 100644 index 350a5a045..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/Makefile.cc1350 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x0-cc26x0 -DEVICE_FAMILY = CC13X0 -DEVICE_LINE = CC13XX -DEVICE = CC1350 - -BOARD_SOURCEFILES += CC1350_LAUNCHXL.c CC1350_LAUNCHXL_fxns.c - -SUPPORTS_PROP_MODE = 1 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 1 - -# Include the common board makefile -include $(FAMILY_PATH)/launchpad/Makefile.launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/rf-conf.h deleted file mode 100644 index e6cd0b744..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350/rf-conf.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for both the Sub-1 GHz - * path and the 2.4 GHz path on the radio. - * - * These are the following front-end mode configurations for the - * CC1350-LAUNCHXL board: - * - Sub-1 GHz: differential and external bias - * - 2.4 GHz: differential and external bias - * - * @{ - */ -#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL - -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/Board.h deleted file mode 100644 index 40f76e18b..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/Board.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC1352P_2_LAUNCHXL.h" - -#define Board_CC1352P_2_LAUNCHXL -#define BOARD_STRING "TI CC1352P-2 LaunchPad" - -#define Board_initGeneral() CC1352P_2_LAUNCHXL_initGeneral() -#define Board_shutDownExtFlash() CC1352P_2_LAUNCHXL_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC1352P_2_LAUNCHXL_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADC0 CC1352P_2_LAUNCHXL_ADC0 -#define Board_ADC1 CC1352P_2_LAUNCHXL_ADC1 - -#define Board_ADCBUF0 CC1352P_2_LAUNCHXL_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL0 -#define Board_ADCBUF0CHANNEL1 CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL1 - -#define Board_CRYPTO0 CC1352P_2_LAUNCHXL_CRYPTO0 -#define Board_ECDH0 CC1352P_2_LAUNCHXL_ECDH0 -#define Board_ECDSA0 CC1352P_2_LAUNCHXL_ECDSA0 -#define Board_ECJPAKE0 CC1352P_2_LAUNCHXL_ECJPAKE0 -#define Board_AESCCM0 CC1352P_2_LAUNCHXL_AESCCM0 -#define Board_AESECB0 CC1352P_2_LAUNCHXL_AESECB0 -#define Board_SHA20 CC1352P_2_LAUNCHXL_SHA20 - -#define Board_DIO12 CC1352P_2_LAUNCHXL_DIO12 -#define Board_DIO15 CC1352P_2_LAUNCHXL_DIO15 -#define Board_DIO16_TDO CC1352P_2_LAUNCHXL_DIO16_TDO -#define Board_DIO17_TDI CC1352P_2_LAUNCHXL_DIO17_TDI -#define Board_DIO21 CC1352P_2_LAUNCHXL_DIO21 -#define Board_DIO22 CC1352P_2_LAUNCHXL_DIO22 - -#define Board_DIO23_ANALOG CC1352P_2_LAUNCHXL_DIO23_ANALOG -#define Board_DIO24_ANALOG CC1352P_2_LAUNCHXL_DIO24_ANALOG -#define Board_DIO25_ANALOG CC1352P_2_LAUNCHXL_DIO25_ANALOG -#define Board_DIO26_ANALOG CC1352P_2_LAUNCHXL_DIO26_ANALOG -#define Board_DIO27_ANALOG CC1352P_2_LAUNCHXL_DIO27_ANALOG -#define Board_DIO28_ANALOG CC1352P_2_LAUNCHXL_DIO28_ANALOG -#define Board_DIO29_ANALOG CC1352P_2_LAUNCHXL_DIO29_ANALOG -#define Board_DIO30_RFSW CC1352P_2_LAUNCHXL_DIO30_RF_SUB1GHZ - -/* - * Board_RF_SUB1GHZ, Board_RF_HIGH_PA, and Board_RF_24GHZ are the names - * generated by SysConfig. Define them here so that the RF callback function - * can reference them. - */ -#define Board_RF_24GHZ CC1352P_2_LAUNCHXL_DIO28_RF_24GHZ -#define Board_RF_HIGH_PA CC1352P_2_LAUNCHXL_DIO29_RF_HIGH_PA -#define Board_RF_SUB1GHZ CC1352P_2_LAUNCHXL_DIO30_RF_SUB1GHZ - -#define Board_GPIO_BUTTON0 CC1352P_2_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BUTTON1 CC1352P_2_LAUNCHXL_GPIO_S2 -#define Board_GPIO_BTN1 CC1352P_2_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BTN2 CC1352P_2_LAUNCHXL_GPIO_S2 -#define Board_GPIO_LED0 CC1352P_2_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_LED1 CC1352P_2_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED2 CC1352P_2_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_RLED CC1352P_2_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_GLED CC1352P_2_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED_ON CC1352P_2_LAUNCHXL_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC1352P_2_LAUNCHXL_GPIO_LED_OFF - -#define Board_GPTIMER0A CC1352P_2_LAUNCHXL_GPTIMER0A -#define Board_GPTIMER0B CC1352P_2_LAUNCHXL_GPTIMER0B -#define Board_GPTIMER1A CC1352P_2_LAUNCHXL_GPTIMER1A -#define Board_GPTIMER1B CC1352P_2_LAUNCHXL_GPTIMER1B -#define Board_GPTIMER2A CC1352P_2_LAUNCHXL_GPTIMER2A -#define Board_GPTIMER2B CC1352P_2_LAUNCHXL_GPTIMER2B -#define Board_GPTIMER3A CC1352P_2_LAUNCHXL_GPTIMER3A -#define Board_GPTIMER3B CC1352P_2_LAUNCHXL_GPTIMER3B - -#define Board_I2C0 CC1352P_2_LAUNCHXL_I2C0 -#define Board_I2C_TMP Board_I2C0 - -#define Board_NVSINTERNAL CC1352P_2_LAUNCHXL_NVSCC26XX0 -#define Board_NVSEXTERNAL CC1352P_2_LAUNCHXL_NVSSPI25X0 - -#define Board_PIN_BUTTON0 CC1352P_2_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BUTTON1 CC1352P_2_LAUNCHXL_PIN_BTN2 -#define Board_PIN_BTN1 CC1352P_2_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BTN2 CC1352P_2_LAUNCHXL_PIN_BTN2 -#define Board_PIN_LED0 CC1352P_2_LAUNCHXL_PIN_RLED -#define Board_PIN_LED1 CC1352P_2_LAUNCHXL_PIN_GLED -#define Board_PIN_LED2 CC1352P_2_LAUNCHXL_PIN_RLED -#define Board_PIN_RLED CC1352P_2_LAUNCHXL_PIN_RLED -#define Board_PIN_GLED CC1352P_2_LAUNCHXL_PIN_GLED - -#define Board_PWM0 CC1352P_2_LAUNCHXL_PWM0 -#define Board_PWM1 CC1352P_2_LAUNCHXL_PWM1 -#define Board_PWM2 CC1352P_2_LAUNCHXL_PWM2 -#define Board_PWM3 CC1352P_2_LAUNCHXL_PWM3 -#define Board_PWM4 CC1352P_2_LAUNCHXL_PWM4 -#define Board_PWM5 CC1352P_2_LAUNCHXL_PWM5 -#define Board_PWM6 CC1352P_2_LAUNCHXL_PWM6 -#define Board_PWM7 CC1352P_2_LAUNCHXL_PWM7 - -#define Board_SD0 CC1352P_2_LAUNCHXL_SDSPI0 - -#define Board_SPI0 CC1352P_2_LAUNCHXL_SPI0 -#define Board_SPI0_MISO CC1352P_2_LAUNCHXL_SPI0_MISO -#define Board_SPI0_MOSI CC1352P_2_LAUNCHXL_SPI0_MOSI -#define Board_SPI0_CLK CC1352P_2_LAUNCHXL_SPI0_CLK -#define Board_SPI0_CSN CC1352P_2_LAUNCHXL_SPI0_CSN -#define Board_SPI1 CC1352P_2_LAUNCHXL_SPI1 -#define Board_SPI1_MISO CC1352P_2_LAUNCHXL_SPI1_MISO -#define Board_SPI1_MOSI CC1352P_2_LAUNCHXL_SPI1_MOSI -#define Board_SPI1_CLK CC1352P_2_LAUNCHXL_SPI1_CLK -#define Board_SPI1_CSN CC1352P_2_LAUNCHXL_SPI1_CSN -#define Board_SPI_FLASH_CS CC1352P_2_LAUNCHXL_SPI_FLASH_CS -#define Board_FLASH_CS_ON 0 -#define Board_FLASH_CS_OFF 1 - -#define Board_SPI_MASTER CC1352P_2_LAUNCHXL_SPI0 -#define Board_SPI_SLAVE CC1352P_2_LAUNCHXL_SPI0 -#define Board_SPI_MASTER_READY CC1352P_2_LAUNCHXL_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC1352P_2_LAUNCHXL_SPI_SLAVE_READY - -#define Board_UART0 CC1352P_2_LAUNCHXL_UART0 -#define Board_UART1 CC1352P_2_LAUNCHXL_UART1 - -#define Board_WATCHDOG0 CC1352P_2_LAUNCHXL_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_TMP_ADDR (0x40) -#define Board_SENSORS_BP_TMP_ADDR Board_TMP_ADDR - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.c deleted file mode 100644 index c2717cc70..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.c +++ /dev/null @@ -1,949 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC1352P_2_LAUNCHXL.c =================================== - * This file is responsible for setting up the board specific items for the - * CC1352P_2_LAUNCHXL board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC1352P_2_LAUNCHXL.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26X2_Object adcBufCC26xxObjects[CC1352P_2_LAUNCHXL_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26X2_AdcChannelLutEntry ADCBufCC26X2_adcChannelLut[CC1352P_2_LAUNCHXL_ADCBUF0CHANNELCOUNT] = { - {CC1352P_2_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7}, - {CC1352P_2_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6}, - {CC1352P_2_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5}, - {CC1352P_2_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4}, - {CC1352P_2_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, -}; - -const ADCBufCC26X2_HWAttrs adcBufCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26X2_adcChannelLut, - .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER0A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC1352P_2_LAUNCHXL_ADCBUFCOUNT] = { - { - &ADCBufCC26X2_fxnTable, - &adcBufCC26xxObjects[CC1352P_2_LAUNCHXL_ADCBUF0], - &adcBufCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC1352P_2_LAUNCHXL_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADCCOUNT]; - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCCOUNT] = { - { - .adcDIO = CC1352P_2_LAUNCHXL_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P_2_LAUNCHXL_DIO24_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO6, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P_2_LAUNCHXL_DIO25_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO5, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P_2_LAUNCHXL_DIO26_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO4, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P_2_LAUNCHXL_DIO27_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO3, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC1352P_2_LAUNCHXL_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADC0]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADC1]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADC2]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADC3]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADC4]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC1352P_2_LAUNCHXL_ADCCOUNT; - -/* - * =============================== ECDH =============================== - */ -#include -#include - -ECDHCC26X2_Object ecdhCC26X2Objects[CC1352P_2_LAUNCHXL_ECDHCOUNT]; - -const ECDHCC26X2_HWAttrs ecdhCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECDHCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDH_Config ECDH_config[CC1352P_2_LAUNCHXL_ECDHCOUNT] = { - { - .object = &ecdhCC26X2Objects[CC1352P_2_LAUNCHXL_ECDH0], - .hwAttrs = &ecdhCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECDH0] - }, -}; - -const uint_least8_t ECDH_count = CC1352P_2_LAUNCHXL_ECDHCOUNT; - -/* - * =============================== ECDSA =============================== - */ -#include -#include - -ECDSACC26X2_Object ecdsaCC26X2Objects[CC1352P_2_LAUNCHXL_ECDSACOUNT]; - -const ECDSACC26X2_HWAttrs ecdsaCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECDSACOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDSA_Config ECDSA_config[CC1352P_2_LAUNCHXL_ECDSACOUNT] = { - { - .object = &ecdsaCC26X2Objects[CC1352P_2_LAUNCHXL_ECDSA0], - .hwAttrs = &ecdsaCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECDSA0] - }, -}; - -const uint_least8_t ECDSA_count = CC1352P_2_LAUNCHXL_ECDSACOUNT; - -/* - * =============================== ECJPAKE =============================== - */ -#include -#include - -ECJPAKECC26X2_Object ecjpakeCC26X2Objects[CC1352P_2_LAUNCHXL_ECJPAKECOUNT]; - -const ECJPAKECC26X2_HWAttrs ecjpakeCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECJPAKECOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECJPAKE_Config ECJPAKE_config[CC1352P_2_LAUNCHXL_ECJPAKECOUNT] = { - { - .object = &ecjpakeCC26X2Objects[CC1352P_2_LAUNCHXL_ECJPAKE0], - .hwAttrs = &ecjpakeCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECJPAKE0] - }, -}; - -const uint_least8_t ECJPAKE_count = CC1352P_2_LAUNCHXL_ECJPAKECOUNT; - - -/* - * =============================== SHA2 =============================== - */ -#include -#include - -SHA2CC26X2_Object sha2CC26X2Objects[CC1352P_2_LAUNCHXL_SHA2COUNT]; - -const SHA2CC26X2_HWAttrs sha2CC26X2HWAttrs[CC1352P_2_LAUNCHXL_SHA2COUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const SHA2_Config SHA2_config[CC1352P_2_LAUNCHXL_SHA2COUNT] = { - { - .object = &sha2CC26X2Objects[CC1352P_2_LAUNCHXL_SHA20], - .hwAttrs = &sha2CC26X2HWAttrs[CC1352P_2_LAUNCHXL_SHA20] - }, -}; - -const uint_least8_t SHA2_count = CC1352P_2_LAUNCHXL_SHA2COUNT; - -/* - * =============================== AESCCM =============================== - */ -#include -#include - -AESCCMCC26XX_Object aesccmCC26XXObjects[CC1352P_2_LAUNCHXL_AESCCMCOUNT]; - -const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESCCMCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESCCM_Config AESCCM_config[CC1352P_2_LAUNCHXL_AESCCMCOUNT] = { - { - .object = &aesccmCC26XXObjects[CC1352P_2_LAUNCHXL_AESCCM0], - .hwAttrs = &aesccmCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESCCM0] - }, -}; - -const uint_least8_t AESCCM_count = CC1352P_2_LAUNCHXL_AESCCMCOUNT; - -/* - * =============================== AESECB =============================== - */ -#include -#include - -AESECBCC26XX_Object aesecbCC26XXObjects[CC1352P_2_LAUNCHXL_AESECBCOUNT]; - -const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESECBCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESECB_Config AESECB_config[CC1352P_2_LAUNCHXL_AESECBCOUNT] = { - { - .object = &aesecbCC26XXObjects[CC1352P_2_LAUNCHXL_AESECB0], - .hwAttrs = &aesecbCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESECB0] - }, -}; - -const uint_least8_t AESECB_count = CC1352P_2_LAUNCHXL_AESECBCOUNT; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1352P_2_LAUNCHXL.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1352P_2_LAUNCHXL_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1352P_2_LAUNCHXL_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG, - - /* SD CS */ - GPIOCC26XX_DIO_19 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1352P_LAUNCH.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC1352P_2_LAUNCHXL_SPI_MASTER_READY */ - NULL, /* CC1352P_2_LAUNCHXL_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC1352P_2_LAUNCHXL_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352P_2_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC1352P_2_LAUNCHXL_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P_2_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC1352P_2_LAUNCHXL_I2C0_SDA0, - .sclPin = CC1352P_2_LAUNCHXL_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC1352P_2_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC1352P_2_LAUNCHXL_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC1352P_2_LAUNCHXL_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC1352P_2_LAUNCHXL_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x48000 -#define SECTORSIZE 0x2000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS External Regions */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS External Regions */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC1352P_2_LAUNCHXL_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC1352P_2_LAUNCHXL_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC1352P_2_LAUNCHXL_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC1352P_2_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1352P_2_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1352P_2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1352P_2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1352P_2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1352P_2_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */ - CC1352P_2_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC1352P_2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC1352P_2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC1352P_2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - CC1352P_2_LAUNCHXL_DIO28_RF_24GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - CC1352P_2_LAUNCHXL_DIO29_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - CC1352P_2_LAUNCHXL_DIO30_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26X2_Config PowerCC26X2_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWMCOUNT] = { - { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER0A }, - { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER0B }, - { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER1A }, - { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER1B }, - { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER2A }, - { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER2B }, - { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER3A }, - { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC1352P_2_LAUNCHXL_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM7] }, -}; - -const uint_least8_t PWM_count = CC1352P_2_LAUNCHXL_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -/* - * Board-specific callback function to set the correct antenna path. - * - * This function is called by the RF driver on global driver events. - * It contains a default implementation to set the correct antenna path. - * This function is defined in the file CC1352P_2_LAUNCHXL_fxns.c - */ -extern void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void* arg); - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - - /* Register the board specific callback */ - .globalCallback = &rfDriverCallback, - - /* Subscribe the callback to both events */ - .globalEventMask = RF_GlobalEventRadioSetup | RF_GlobalEventRadioPowerDown -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC1352P_2_LAUNCHXL_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC1352P_2_LAUNCHXL_SDCOUNT] = { - { - .spiIndex = CC1352P_2_LAUNCHXL_SPI0, - .spiCsGpioIndex = CC1352P_2_LAUNCHXL_GPIO_DIO_19 - } -}; - -const SD_Config SD_config[CC1352P_2_LAUNCHXL_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC1352P_2_LAUNCHXL_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC1352P_2_LAUNCHXL_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC1352P_2_LAUNCHXL_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1352P_2_LAUNCHXL_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P_2_LAUNCHXL_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X2_Object trngCC26X2Object[CC1352P_2_LAUNCHXL_TRNGCOUNT]; - -const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC1352P_2_LAUNCHXL_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC1352P_2_LAUNCHXL_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC1352P_2_LAUNCHXL_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1352P_2_LAUNCHXL_UART0_TX, - .rxPin = CC1352P_2_LAUNCHXL_UART0_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -#if TI_UART_CONF_UART1_ENABLE - { - .baseAddr = UART1_BASE, - .powerMngrId = PowerCC26X2_PERIPH_UART1, - .intNum = INT_UART1_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1352P_2_LAUNCHXL_UART1_TX, - .rxPin = CC1352P_2_LAUNCHXL_UART1_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UART1], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UART1]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC1352P_2_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1352P_2_LAUNCHXL_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UART0] - }, -#endif -#if TI_UART_CONF_UART1_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1352P_2_LAUNCHXL_UART1], - .hwAttrs = &uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UART1] - }, -#endif -}; - -const uint_least8_t UART_count = CC1352P_2_LAUNCHXL_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC1352P_2_LAUNCHXL_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC1352P_2_LAUNCHXL_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC1352P_2_LAUNCHXL_UDMACOUNT] = { - { - .object = &udmaObjects[CC1352P_2_LAUNCHXL_UDMA0], - .hwAttrs = &udmaHWAttrs[CC1352P_2_LAUNCHXL_UDMA0] - }, -}; - - - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC1352P_2_LAUNCHXL_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1352P_2_LAUNCHXL_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC1352P_2_LAUNCHXL_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC1352P_2_LAUNCHXL_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC1352P_2_LAUNCHXL_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC1352P_2_LAUNCHXL_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC1352P_2_LAUNCHXL_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC1352P_2_LAUNCHXL_initGeneral ======== - */ -void CC1352P_2_LAUNCHXL_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h deleted file mode 100644 index a3defe845..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** =========================================================================== - * @file CC1352P_2_LAUNCHXL.h - * - * @brief CC1352P_2_LAUNCHXL Board Specific header file. - * - * The CC1352P_2_LAUNCHXL header file should be included in an application as - * follows: - * @code - * #include "CC1352P_2_LAUNCHXL.h" - * @endcode - * - * =========================================================================== - */ -#ifndef __CC1352P_2_LAUNCHXL_BOARD_H__ -#define __CC1352P_2_LAUNCHXL_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC1352P_2_LAUNCHXL - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Mapping of pins to board signals using general board aliases - * - */ -/* Analog Capable DIOs */ -#define CC1352P_2_LAUNCHXL_DIO23_ANALOG IOID_23 -#define CC1352P_2_LAUNCHXL_DIO24_ANALOG IOID_24 -#define CC1352P_2_LAUNCHXL_DIO25_ANALOG IOID_25 -#define CC1352P_2_LAUNCHXL_DIO26_ANALOG IOID_26 -#define CC1352P_2_LAUNCHXL_DIO27_ANALOG IOID_27 - -/* RF Antenna Switch */ -#define CC1352P_2_LAUNCHXL_DIO28_RF_24GHZ IOID_28 -#define CC1352P_2_LAUNCHXL_DIO29_RF_HIGH_PA IOID_29 -#define CC1352P_2_LAUNCHXL_DIO30_RF_SUB1GHZ IOID_30 - -/* Digital IOs */ -#define CC1352P_2_LAUNCHXL_DIO12 IOID_12 -#define CC1352P_2_LAUNCHXL_DIO15 IOID_15 -#define CC1352P_2_LAUNCHXL_DIO16_TDO IOID_16 -#define CC1352P_2_LAUNCHXL_DIO17_TDI IOID_17 -#define CC1352P_2_LAUNCHXL_DIO21 IOID_21 -#define CC1352P_2_LAUNCHXL_DIO22 IOID_22 - -/* Discrete Inputs */ -#define CC1352P_2_LAUNCHXL_PIN_BTN1 IOID_15 -#define CC1352P_2_LAUNCHXL_PIN_BTN2 IOID_14 - -/* GPIO */ -#define CC1352P_2_LAUNCHXL_GPIO_LED_ON 1 -#define CC1352P_2_LAUNCHXL_GPIO_LED_OFF 0 - -/* I2C */ -#define CC1352P_2_LAUNCHXL_I2C0_SCL0 IOID_22 -#define CC1352P_2_LAUNCHXL_I2C0_SDA0 IOID_5 - -/* LEDs */ -#define CC1352P_2_LAUNCHXL_PIN_LED_ON 1 -#define CC1352P_2_LAUNCHXL_PIN_LED_OFF 0 -#define CC1352P_2_LAUNCHXL_PIN_RLED IOID_6 -#define CC1352P_2_LAUNCHXL_PIN_GLED IOID_7 - -/* PWM Outputs */ -#define CC1352P_2_LAUNCHXL_PWMPIN0 CC1352P_2_LAUNCHXL_PIN_RLED -#define CC1352P_2_LAUNCHXL_PWMPIN1 CC1352P_2_LAUNCHXL_PIN_GLED -#define CC1352P_2_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED - -/* SPI */ -#define CC1352P_2_LAUNCHXL_SPI_FLASH_CS IOID_20 -#define CC1352P_2_LAUNCHXL_FLASH_CS_ON 0 -#define CC1352P_2_LAUNCHXL_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC1352P_2_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */ -#define CC1352P_2_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */ -#define CC1352P_2_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */ -#define CC1352P_2_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC1352P_2_LAUNCHXL_UART0_RX IOID_12 /* RXD */ -#define CC1352P_2_LAUNCHXL_UART0_TX IOID_13 /* TXD */ -#define CC1352P_2_LAUNCHXL_UART0_CTS IOID_19 /* CTS */ -#define CC1352P_2_LAUNCHXL_UART0_RTS IOID_18 /* RTS */ -#define CC1352P_2_LAUNCHXL_UART1_RX PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_UART1_TX PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_UART1_CTS PIN_UNASSIGNED -#define CC1352P_2_LAUNCHXL_UART1_RTS PIN_UNASSIGNED -/* For backward compatibility */ -#define CC1352P_2_LAUNCHXL_UART_RX CC1352P_2_LAUNCHXL_UART0_RX -#define CC1352P_2_LAUNCHXL_UART_TX CC1352P_2_LAUNCHXL_UART0_TX -#define CC1352P_2_LAUNCHXL_UART_CTS CC1352P_2_LAUNCHXL_UART0_CTS -#define CC1352P_2_LAUNCHXL_UART_RTS CC1352P_2_LAUNCHXL_UART0_RTS - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC1352P_2_LAUNCHXL_initGeneral(void); - -/*! - * @brief Shut down the external flash present on the board files - * - * This function bitbangs the SPI sequence necessary to turn off - * the external flash on LaunchPads. - */ -void CC1352P_2_LAUNCHXL_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC1352P_2_LAUNCHXL_wakeUpExtFlash(void); - - -/*! - * \brief Initializes the antenna switch IOs. - * - * This function sets up the antenna switch and occupies - * the necessary IO pins. After calling this function, they - * cannot be used in the application anymore. - */ -void CC1352P_2_LAUNCHXL_initAntennaSwitch(void); - -/*! - * @def CC1352P_2_LAUNCHXL_ADCBufName - * @brief Enum of ADCs - */ -typedef enum CC1352P_2_LAUNCHXL_ADCBufName { - CC1352P_2_LAUNCHXL_ADCBUF0 = 0, - - CC1352P_2_LAUNCHXL_ADCBUFCOUNT -} CC1352P_2_LAUNCHXL_ADCBufName; - -/*! - * @def CC1352P_2_LAUNCHXL_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC1352P_2_LAUNCHXL_ADCBuf0ChannelName { - CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL0 = 0, - CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL1, - CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL2, - CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL3, - CC1352P_2_LAUNCHXL_ADCBUF0CHANNEL4, - CC1352P_2_LAUNCHXL_ADCBUF0CHANNELVDDS, - CC1352P_2_LAUNCHXL_ADCBUF0CHANNELDCOUPL, - CC1352P_2_LAUNCHXL_ADCBUF0CHANNELVSS, - - CC1352P_2_LAUNCHXL_ADCBUF0CHANNELCOUNT -} CC1352P_2_LAUNCHXL_ADCBuf0ChannelName; - -/*! - * @def CC1352P_2_LAUNCHXL_ADCName - * @brief Enum of ADCs - */ -typedef enum CC1352P_2_LAUNCHXL_ADCName { - CC1352P_2_LAUNCHXL_ADC0 = 0, - CC1352P_2_LAUNCHXL_ADC1, - CC1352P_2_LAUNCHXL_ADC2, - CC1352P_2_LAUNCHXL_ADC3, - CC1352P_2_LAUNCHXL_ADC4, - CC1352P_2_LAUNCHXL_ADCDCOUPL, - CC1352P_2_LAUNCHXL_ADCVSS, - CC1352P_2_LAUNCHXL_ADCVDDS, - - CC1352P_2_LAUNCHXL_ADCCOUNT -} CC1352P_2_LAUNCHXL_ADCName; - -/*! - * @def CC1352P_2_LAUNCHXL_ECDHName - * @brief Enum of ECDH names - */ -typedef enum CC1352P_2_LAUNCHXL_ECDHName { - CC1352P_2_LAUNCHXL_ECDH0 = 0, - - CC1352P_2_LAUNCHXL_ECDHCOUNT -} CC1352P_2_LAUNCHXL_ECDHName; - -/*! - * @def CC1352P_2_LAUNCHXL_ECDSAName - * @brief Enum of ECDSA names - */ -typedef enum CC1352P_2_LAUNCHXL_ECDSAName { - CC1352P_2_LAUNCHXL_ECDSA0 = 0, - - CC1352P_2_LAUNCHXL_ECDSACOUNT -} CC1352P_2_LAUNCHXL_ECDSAName; - -/*! - * @def CC1352P_2_LAUNCHXL_ECJPAKEName - * @brief Enum of ECJPAKE names - */ -typedef enum CC1352P_2_LAUNCHXL_ECJPAKEName { - CC1352P_2_LAUNCHXL_ECJPAKE0 = 0, - - CC1352P_2_LAUNCHXL_ECJPAKECOUNT -} CC1352P_2_LAUNCHXL_ECJPAKEName; - -/*! - * @def CC1352P_2_LAUNCHXL_AESCCMName - * @brief Enum of AESCCM names - */ -typedef enum CC1352P_2_LAUNCHXL_AESCCMName { - CC1352P_2_LAUNCHXL_AESCCM0 = 0, - - CC1352P_2_LAUNCHXL_AESCCMCOUNT -} CC1352P_2_LAUNCHXL_AESCCMName; - -/*! - * @def CC1352P_2_LAUNCHXL_AESECBName - * @brief Enum of AESECB names - */ -typedef enum CC1352P_2_LAUNCHXL_AESECBName { - CC1352P_2_LAUNCHXL_AESECB0 = 0, - - CC1352P_2_LAUNCHXL_AESECBCOUNT -} CC1352P_2_LAUNCHXL_AESECBName; - -/*! - * @def CC1352P_2_LAUNCHXL_SHA2Name - * @brief Enum of SHA2 names - */ -typedef enum CC1352P_2_LAUNCHXL_SHA2Name { - CC1352P_2_LAUNCHXL_SHA20 = 0, - - CC1352P_2_LAUNCHXL_SHA2COUNT -} CC1352P_2_LAUNCHXL_SHA2Name; - -/*! - * @def CC1352P_2_LAUNCHXL_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC1352P_2_LAUNCHXL_GPIOName { - CC1352P_2_LAUNCHXL_GPIO_S1 = 0, - CC1352P_2_LAUNCHXL_GPIO_S2, - CC1352P_2_LAUNCHXL_SPI_MASTER_READY, - CC1352P_2_LAUNCHXL_SPI_SLAVE_READY, - CC1352P_2_LAUNCHXL_GPIO_LED_GREEN, - CC1352P_2_LAUNCHXL_GPIO_LED_RED, - CC1352P_2_LAUNCHXL_GPIO_SPI_FLASH_CS, - CC1352P_2_LAUNCHXL_GPIO_SDSPI_CS, - CC1352P_2_LAUNCHXL_GPIOCOUNT -} CC1352P_2_LAUNCHXL_GPIOName; - -/*! - * @def CC1352P_2_LAUNCHXL_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC1352P_2_LAUNCHXL_GPTimerName { - CC1352P_2_LAUNCHXL_GPTIMER0A = 0, - CC1352P_2_LAUNCHXL_GPTIMER0B, - CC1352P_2_LAUNCHXL_GPTIMER1A, - CC1352P_2_LAUNCHXL_GPTIMER1B, - CC1352P_2_LAUNCHXL_GPTIMER2A, - CC1352P_2_LAUNCHXL_GPTIMER2B, - CC1352P_2_LAUNCHXL_GPTIMER3A, - CC1352P_2_LAUNCHXL_GPTIMER3B, - - CC1352P_2_LAUNCHXL_GPTIMERPARTSCOUNT -} CC1352P_2_LAUNCHXL_GPTimerName; - -/*! - * @def CC1352P_2_LAUNCHXL_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC1352P_2_LAUNCHXL_GPTimers { - CC1352P_2_LAUNCHXL_GPTIMER0 = 0, - CC1352P_2_LAUNCHXL_GPTIMER1, - CC1352P_2_LAUNCHXL_GPTIMER2, - CC1352P_2_LAUNCHXL_GPTIMER3, - - CC1352P_2_LAUNCHXL_GPTIMERCOUNT -} CC1352P_2_LAUNCHXL_GPTimers; - -/*! - * @def CC1352P_2_LAUNCHXL_I2CName - * @brief Enum of I2C names - */ -typedef enum CC1352P_2_LAUNCHXL_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC1352P_2_LAUNCHXL_I2C0 = 0, -#endif - - CC1352P_2_LAUNCHXL_I2CCOUNT -} CC1352P_2_LAUNCHXL_I2CName; - -/*! - * @def CC1352P_2_LAUNCHXL_NVSName - * @brief Enum of NVS names - */ -typedef enum CC1352P_2_LAUNCHXL_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC1352P_2_LAUNCHXL_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC1352P_2_LAUNCHXL_NVSSPI25X0, -#endif - - CC1352P_2_LAUNCHXL_NVSCOUNT -} CC1352P_2_LAUNCHXL_NVSName; - -/*! - * @def CC1352P_2_LAUNCHXL_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC1352P_2_LAUNCHXL_PWMName { - CC1352P_2_LAUNCHXL_PWM0 = 0, - CC1352P_2_LAUNCHXL_PWM1, - CC1352P_2_LAUNCHXL_PWM2, - CC1352P_2_LAUNCHXL_PWM3, - CC1352P_2_LAUNCHXL_PWM4, - CC1352P_2_LAUNCHXL_PWM5, - CC1352P_2_LAUNCHXL_PWM6, - CC1352P_2_LAUNCHXL_PWM7, - - CC1352P_2_LAUNCHXL_PWMCOUNT -} CC1352P_2_LAUNCHXL_PWMName; - -/*! - * @def CC1352P_2_LAUNCHXL_SDName - * @brief Enum of SD names - */ -typedef enum CC1352P_2_LAUNCHXL_SDName { - CC1352P_2_LAUNCHXL_SDSPI0 = 0, - - CC1352P_2_LAUNCHXL_SDCOUNT -} CC1352P_2_LAUNCHXL_SDName; - -/*! - * @def CC1352P_2_LAUNCHXL_SPIName - * @brief Enum of SPI names - */ -typedef enum CC1352P_2_LAUNCHXL_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC1352P_2_LAUNCHXL_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC1352P_2_LAUNCHXL_SPI1, -#endif - - CC1352P_2_LAUNCHXL_SPICOUNT -} CC1352P_2_LAUNCHXL_SPIName; - -/*! - * @def CC1352P_2_LAUNCHXL_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC1352P_2_LAUNCHXL_TRNGName { - CC1352P_2_LAUNCHXL_TRNG0 = 0, - - CC1352P_2_LAUNCHXL_TRNGCOUNT -} CC1352P_2_LAUNCHXL_TRNGName; - -/*! - * @def CC1352P_2_LAUNCHXL_UARTName - * @brief Enum of UARTs - */ -typedef enum CC1352P_2_LAUNCHXL_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC1352P_2_LAUNCHXL_UART0 = 0, -#endif -#if TI_UART_CONF_UART1_ENABLE - CC1352P_2_LAUNCHXL_UART1, -#endif - - CC1352P_2_LAUNCHXL_UARTCOUNT -} CC1352P_2_LAUNCHXL_UARTName; - -/*! - * @def CC1352P_2_LAUNCHXL_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC1352P_2_LAUNCHXL_UDMAName { - CC1352P_2_LAUNCHXL_UDMA0 = 0, - - CC1352P_2_LAUNCHXL_UDMACOUNT -} CC1352P_2_LAUNCHXL_UDMAName; - -/*! - * @def CC1352P_2_LAUNCHXL_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC1352P_2_LAUNCHXL_WatchdogName { - CC1352P_2_LAUNCHXL_WATCHDOG0 = 0, - - CC1352P_2_LAUNCHXL_WATCHDOGCOUNT -} CC1352P_2_LAUNCHXL_WatchdogName; - - -#ifdef __cplusplus -} -#endif - -#endif /* __CC1352P_2_LAUNCHXL_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL_fxns.c deleted file mode 100644 index 57f545360..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL_fxns.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ======== CC1352P_2_LAUNCHXL_fxns.c ======== - * This file contains the board-specific initialization functions, and - * RF callback function for antenna switching. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) -#include -#include - -#include "Board.h" - -/* - * ======== CC1352P_2_LAUNCHXL_sendExtFlashByte ======== - */ -void CC1352P_2_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC1352P_2_LAUNCHXL_wakeUpExtFlash ======== - */ -void CC1352P_2_LAUNCHXL_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC1352P_2_LAUNCHXL_shutDownExtFlash ======== - */ -void CC1352P_2_LAUNCHXL_shutDownExtFlash(void) -{ - /* To be sure we are putting the flash into sleep and not waking it, we first have to make a wake up call */ - CC1352P_2_LAUNCHXL_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC1352P_2_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * For the SysConfig generated Board.h file, Board_RF_SUB1GHZ will not be - * defined unless the RF module is added to the configuration. Therefore, - * we don't include this code if Board_RF_SUB1GHZ is not defined. - */ -#if defined(Board_RF_SUB1GHZ) - -/* - * Mask to be used to determine the effective value of the setup command's - * loDivider field. - */ -#define LODIVIDER_MASK 0x7F - -/* - * ======== Antenna switching ======== - */ -static PIN_Handle antennaPins; -static PIN_State antennaState; - -void initAntennaSwitch() -{ - PIN_Config antennaConfig[] = { - Board_RF_24GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - Board_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - Board_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - PIN_TERMINATE - }; - antennaPins = PIN_open(&antennaState, antennaConfig); -} - -/* - * ======== CC1352P1_LAUNCHXL_rfDriverCallback ======== - * Sets up the antenna switch depending on the current PHY configuration. - * Truth table: - * - * Path DIO28 DIO29 DIO30 - * =========== ===== ===== ===== - * Off 0 0 0 - * Sub-1 GHz 0 0 1 - * 2.4 GHz 1 0 0 - * 20 dBm TX 0 1 0 - */ -void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg) -{ - /* Local variable. */ - bool sub1GHz = false; - uint8_t loDivider = 0; - - /* Switch off all paths first. Needs to be done anyway in every sub-case below. */ - PINCC26XX_setOutputValue(Board_RF_24GHZ, 0); - PINCC26XX_setOutputValue(Board_RF_HIGH_PA, 0); - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0); - - if (events & RF_GlobalEventRadioSetup) { - /* Decode the current PA configuration. */ - RF_TxPowerTable_PAType paType = (RF_TxPowerTable_PAType)RF_getTxPower(client).paType; - - /* Decode the generic argument as a setup command. */ - RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg; - - switch (setupCommand->common.commandNo) { - case (CMD_RADIO_SETUP): - case (CMD_BLE5_RADIO_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->common.loDivider; - - /* Sub-1GHz front-end. */ - if (loDivider != 0) { - sub1GHz = true; - } - break; - case (CMD_PROP_RADIO_DIV_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider; - - /* Sub-1GHz front-end. */ - if (loDivider != 0) { - sub1GHz = true; - } - break; - default:break; - } - - if (sub1GHz) { - /* Sub-1 GHz */ - if (paType == RF_TxPowerTable_HighPA) { - /* PA enable --> HIGH PA - * LNA enable --> Sub-1 GHz - */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not - de-asserted on CC1352 Rev A. */ - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_RFC_GPO0); - } else { - /* RF core active --> Sub-1 GHz */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 1); - } - } else { - /* 2.4 GHz */ - if (paType == RF_TxPowerTable_HighPA) - { - /* PA enable --> HIGH PA - * LNA enable --> 2.4 GHz - */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_RFC_GPO0); - /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not - de-asserted on CC1352 Rev A. */ - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - } else { - /* RF core active --> 2.4 GHz */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setOutputValue(Board_RF_24GHZ, 1); - } - } - } else { - /* Reset the IO multiplexer to GPIO functionality */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - } -} -#endif - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ -#if defined(Board_RF_SUB1GHZ) - initAntennaSwitch(); -#endif - - CC1352P_2_LAUNCHXL_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/Makefile.cc1352p-2 b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/Makefile.cc1352p-2 deleted file mode 100644 index 2a31100d4..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/Makefile.cc1352p-2 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x2-cc26x2 -DEVICE_FAMILY = CC13X2 -DEVICE_LINE = CC13XX -DEVICE = CC1352P - -BOARD_SOURCEFILES += CC1352P_2_LAUNCHXL.c CC1352P_2_LAUNCHXL_fxns.c - -SUPPORTS_PROP_MODE = 1 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 1 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 0 - -# Include the common board makefile -include $(FAMILY_PATH)/launchpad/Makefile.launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/rf-conf.h deleted file mode 100644 index 1eb0926b7..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/rf-conf.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for both the Sub-1 GHz - * path and the 2.4 GHz path on the radio. - * - * These are the following front-end mode configurations for the - * CC1352P-2-LAUNCHXL board: - * - Sub-1 GHz: differential and external bias - * - 2.4 GHz: differential and external bias - * - * @{ - */ -#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL - -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/Board.h deleted file mode 100644 index de9bc8e9d..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/Board.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC1352P_4_LAUNCHXL.h" - -#define Board_CC1352P_4_LAUNCHXL -#define BOARD_STRING "TI CC1352P-4 LaunchPad" - -#define Board_initGeneral() CC1352P_4_LAUNCHXL_initGeneral() -#define Board_shutDownExtFlash() CC1352P_4_LAUNCHXL_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC1352P_4_LAUNCHXL_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADC0 CC1352P_4_LAUNCHXL_ADC0 -#define Board_ADC1 CC1352P_4_LAUNCHXL_ADC1 - -#define Board_ADCBUF0 CC1352P_4_LAUNCHXL_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL0 -#define Board_ADCBUF0CHANNEL1 CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL1 - -#define Board_CRYPTO0 CC1352P_4_LAUNCHXL_CRYPTO0 -#define Board_ECDH0 CC1352P_4_LAUNCHXL_ECDH0 -#define Board_ECDSA0 CC1352P_4_LAUNCHXL_ECDSA0 -#define Board_ECJPAKE0 CC1352P_4_LAUNCHXL_ECJPAKE0 -#define Board_AESCCM0 CC1352P_4_LAUNCHXL_AESCCM0 -#define Board_AESECB0 CC1352P_4_LAUNCHXL_AESECB0 -#define Board_SHA20 CC1352P_4_LAUNCHXL_SHA20 - -#define Board_DIO12 CC1352P_4_LAUNCHXL_DIO12 -#define Board_DIO15 CC1352P_4_LAUNCHXL_DIO15 -#define Board_DIO16_TDO CC1352P_4_LAUNCHXL_DIO16_TDO -#define Board_DIO17_TDI CC1352P_4_LAUNCHXL_DIO17_TDI -#define Board_DIO21 CC1352P_4_LAUNCHXL_DIO21 -#define Board_DIO22 CC1352P_4_LAUNCHXL_DIO22 - -#define Board_DIO23_ANALOG CC1352P_4_LAUNCHXL_DIO23_ANALOG -#define Board_DIO24_ANALOG CC1352P_4_LAUNCHXL_DIO24_ANALOG -#define Board_DIO25_ANALOG CC1352P_4_LAUNCHXL_DIO25_ANALOG -#define Board_DIO26_ANALOG CC1352P_4_LAUNCHXL_DIO26_ANALOG -#define Board_DIO27_ANALOG CC1352P_4_LAUNCHXL_DIO27_ANALOG -#define Board_DIO28_ANALOG CC1352P_4_LAUNCHXL_DIO28_ANALOG -#define Board_DIO29_ANALOG CC1352P_4_LAUNCHXL_DIO29_ANALOG -#define Board_DIO30_RFSW CC1352P_4_LAUNCHXL_DIO30_RF_SUB1GHZ - -/* - * Board_RF_SUB1GHZ, Board_RF_HIGH_PA, and Board_RF_24GHZ are the names - * generated by SysConfig. Define them here so that the RF callback function - * can reference them. - */ -#define Board_RF_24GHZ CC1352P_4_LAUNCHXL_DIO28_RF_24GHZ -#define Board_RF_HIGH_PA CC1352P_4_LAUNCHXL_DIO29_RF_HIGH_PA -#define Board_RF_SUB1GHZ CC1352P_4_LAUNCHXL_DIO30_RF_SUB1GHZ - -#define Board_GPIO_BUTTON0 CC1352P_4_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BUTTON1 CC1352P_4_LAUNCHXL_GPIO_S2 -#define Board_GPIO_BTN1 CC1352P_4_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BTN2 CC1352P_4_LAUNCHXL_GPIO_S2 -#define Board_GPIO_LED0 CC1352P_4_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_LED1 CC1352P_4_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED2 CC1352P_4_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_RLED CC1352P_4_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_GLED CC1352P_4_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED_ON CC1352P_4_LAUNCHXL_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC1352P_4_LAUNCHXL_GPIO_LED_OFF - -#define Board_GPTIMER0A CC1352P_4_LAUNCHXL_GPTIMER0A -#define Board_GPTIMER0B CC1352P_4_LAUNCHXL_GPTIMER0B -#define Board_GPTIMER1A CC1352P_4_LAUNCHXL_GPTIMER1A -#define Board_GPTIMER1B CC1352P_4_LAUNCHXL_GPTIMER1B -#define Board_GPTIMER2A CC1352P_4_LAUNCHXL_GPTIMER2A -#define Board_GPTIMER2B CC1352P_4_LAUNCHXL_GPTIMER2B -#define Board_GPTIMER3A CC1352P_4_LAUNCHXL_GPTIMER3A -#define Board_GPTIMER3B CC1352P_4_LAUNCHXL_GPTIMER3B - -#define Board_I2C0 CC1352P_4_LAUNCHXL_I2C0 -#define Board_I2C_TMP Board_I2C0 - -#define Board_NVSINTERNAL CC1352P_4_LAUNCHXL_NVSCC26XX0 -#define Board_NVSEXTERNAL CC1352P_4_LAUNCHXL_NVSSPI25X0 - -#define Board_PIN_BUTTON0 CC1352P_4_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BUTTON1 CC1352P_4_LAUNCHXL_PIN_BTN2 -#define Board_PIN_BTN1 CC1352P_4_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BTN2 CC1352P_4_LAUNCHXL_PIN_BTN2 -#define Board_PIN_LED0 CC1352P_4_LAUNCHXL_PIN_RLED -#define Board_PIN_LED1 CC1352P_4_LAUNCHXL_PIN_GLED -#define Board_PIN_LED2 CC1352P_4_LAUNCHXL_PIN_RLED -#define Board_PIN_RLED CC1352P_4_LAUNCHXL_PIN_RLED -#define Board_PIN_GLED CC1352P_4_LAUNCHXL_PIN_GLED - -#define Board_PWM0 CC1352P_4_LAUNCHXL_PWM0 -#define Board_PWM1 CC1352P_4_LAUNCHXL_PWM1 -#define Board_PWM2 CC1352P_4_LAUNCHXL_PWM2 -#define Board_PWM3 CC1352P_4_LAUNCHXL_PWM3 -#define Board_PWM4 CC1352P_4_LAUNCHXL_PWM4 -#define Board_PWM5 CC1352P_4_LAUNCHXL_PWM5 -#define Board_PWM6 CC1352P_4_LAUNCHXL_PWM6 -#define Board_PWM7 CC1352P_4_LAUNCHXL_PWM7 - -#define Board_SD0 CC1352P_4_LAUNCHXL_SDSPI0 - -#define Board_SPI0 CC1352P_4_LAUNCHXL_SPI0 -#define Board_SPI0_MISO CC1352P_4_LAUNCHXL_SPI0_MISO -#define Board_SPI0_MOSI CC1352P_4_LAUNCHXL_SPI0_MOSI -#define Board_SPI0_CLK CC1352P_4_LAUNCHXL_SPI0_CLK -#define Board_SPI0_CSN CC1352P_4_LAUNCHXL_SPI0_CSN -#define Board_SPI1 CC1352P_4_LAUNCHXL_SPI1 -#define Board_SPI1_MISO CC1352P_4_LAUNCHXL_SPI1_MISO -#define Board_SPI1_MOSI CC1352P_4_LAUNCHXL_SPI1_MOSI -#define Board_SPI1_CLK CC1352P_4_LAUNCHXL_SPI1_CLK -#define Board_SPI1_CSN CC1352P_4_LAUNCHXL_SPI1_CSN -#define Board_SPI_FLASH_CS CC1352P_4_LAUNCHXL_SPI_FLASH_CS -#define Board_FLASH_CS_ON 0 -#define Board_FLASH_CS_OFF 1 - -#define Board_SPI_MASTER CC1352P_4_LAUNCHXL_SPI0 -#define Board_SPI_SLAVE CC1352P_4_LAUNCHXL_SPI0 -#define Board_SPI_MASTER_READY CC1352P_4_LAUNCHXL_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC1352P_4_LAUNCHXL_SPI_SLAVE_READY - -#define Board_UART0 CC1352P_4_LAUNCHXL_UART0 -#define Board_UART1 CC1352P_4_LAUNCHXL_UART1 - -#define Board_WATCHDOG0 CC1352P_4_LAUNCHXL_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_TMP_ADDR (0x40) -#define Board_SENSORS_BP_TMP_ADDR Board_TMP_ADDR - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.c deleted file mode 100644 index bd4f43032..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.c +++ /dev/null @@ -1,949 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC1352P_4_LAUNCHXL.c =================================== - * This file is responsible for setting up the board specific items for the - * CC1352P_4_LAUNCHXL board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC1352P_4_LAUNCHXL.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26X2_Object adcBufCC26xxObjects[CC1352P_4_LAUNCHXL_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26X2_AdcChannelLutEntry ADCBufCC26X2_adcChannelLut[CC1352P_4_LAUNCHXL_ADCBUF0CHANNELCOUNT] = { - {CC1352P_4_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7}, - {CC1352P_4_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6}, - {CC1352P_4_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5}, - {CC1352P_4_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4}, - {CC1352P_4_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, -}; - -const ADCBufCC26X2_HWAttrs adcBufCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26X2_adcChannelLut, - .gpTimerUnit = CC1352P_4_LAUNCHXL_GPTIMER0A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC1352P_4_LAUNCHXL_ADCBUFCOUNT] = { - { - &ADCBufCC26X2_fxnTable, - &adcBufCC26xxObjects[CC1352P_4_LAUNCHXL_ADCBUF0], - &adcBufCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC1352P_4_LAUNCHXL_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC1352P_4_LAUNCHXL_ADCCOUNT]; - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADCCOUNT] = { - { - .adcDIO = CC1352P_4_LAUNCHXL_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P_4_LAUNCHXL_DIO24_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO6, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P_4_LAUNCHXL_DIO25_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO5, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P_4_LAUNCHXL_DIO26_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO4, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P_4_LAUNCHXL_DIO27_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO3, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC1352P_4_LAUNCHXL_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_4_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADC0]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_4_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADC1]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_4_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADC2]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_4_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADC3]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_4_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADC4]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_4_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_4_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_4_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC1352P_4_LAUNCHXL_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC1352P_4_LAUNCHXL_ADCCOUNT; - -/* - * =============================== ECDH =============================== - */ -#include -#include - -ECDHCC26X2_Object ecdhCC26X2Objects[CC1352P_4_LAUNCHXL_ECDHCOUNT]; - -const ECDHCC26X2_HWAttrs ecdhCC26X2HWAttrs[CC1352P_4_LAUNCHXL_ECDHCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDH_Config ECDH_config[CC1352P_4_LAUNCHXL_ECDHCOUNT] = { - { - .object = &ecdhCC26X2Objects[CC1352P_4_LAUNCHXL_ECDH0], - .hwAttrs = &ecdhCC26X2HWAttrs[CC1352P_4_LAUNCHXL_ECDH0] - }, -}; - -const uint_least8_t ECDH_count = CC1352P_4_LAUNCHXL_ECDHCOUNT; - -/* - * =============================== ECDSA =============================== - */ -#include -#include - -ECDSACC26X2_Object ecdsaCC26X2Objects[CC1352P_4_LAUNCHXL_ECDSACOUNT]; - -const ECDSACC26X2_HWAttrs ecdsaCC26X2HWAttrs[CC1352P_4_LAUNCHXL_ECDSACOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDSA_Config ECDSA_config[CC1352P_4_LAUNCHXL_ECDSACOUNT] = { - { - .object = &ecdsaCC26X2Objects[CC1352P_4_LAUNCHXL_ECDSA0], - .hwAttrs = &ecdsaCC26X2HWAttrs[CC1352P_4_LAUNCHXL_ECDSA0] - }, -}; - -const uint_least8_t ECDSA_count = CC1352P_4_LAUNCHXL_ECDSACOUNT; - -/* - * =============================== ECJPAKE =============================== - */ -#include -#include - -ECJPAKECC26X2_Object ecjpakeCC26X2Objects[CC1352P_4_LAUNCHXL_ECJPAKECOUNT]; - -const ECJPAKECC26X2_HWAttrs ecjpakeCC26X2HWAttrs[CC1352P_4_LAUNCHXL_ECJPAKECOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECJPAKE_Config ECJPAKE_config[CC1352P_4_LAUNCHXL_ECJPAKECOUNT] = { - { - .object = &ecjpakeCC26X2Objects[CC1352P_4_LAUNCHXL_ECJPAKE0], - .hwAttrs = &ecjpakeCC26X2HWAttrs[CC1352P_4_LAUNCHXL_ECJPAKE0] - }, -}; - -const uint_least8_t ECJPAKE_count = CC1352P_4_LAUNCHXL_ECJPAKECOUNT; - - -/* - * =============================== SHA2 =============================== - */ -#include -#include - -SHA2CC26X2_Object sha2CC26X2Objects[CC1352P_4_LAUNCHXL_SHA2COUNT]; - -const SHA2CC26X2_HWAttrs sha2CC26X2HWAttrs[CC1352P_4_LAUNCHXL_SHA2COUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const SHA2_Config SHA2_config[CC1352P_4_LAUNCHXL_SHA2COUNT] = { - { - .object = &sha2CC26X2Objects[CC1352P_4_LAUNCHXL_SHA20], - .hwAttrs = &sha2CC26X2HWAttrs[CC1352P_4_LAUNCHXL_SHA20] - }, -}; - -const uint_least8_t SHA2_count = CC1352P_4_LAUNCHXL_SHA2COUNT; - -/* - * =============================== AESCCM =============================== - */ -#include -#include - -AESCCMCC26XX_Object aesccmCC26XXObjects[CC1352P_4_LAUNCHXL_AESCCMCOUNT]; - -const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC1352P_4_LAUNCHXL_AESCCMCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESCCM_Config AESCCM_config[CC1352P_4_LAUNCHXL_AESCCMCOUNT] = { - { - .object = &aesccmCC26XXObjects[CC1352P_4_LAUNCHXL_AESCCM0], - .hwAttrs = &aesccmCC26XXHWAttrs[CC1352P_4_LAUNCHXL_AESCCM0] - }, -}; - -const uint_least8_t AESCCM_count = CC1352P_4_LAUNCHXL_AESCCMCOUNT; - -/* - * =============================== AESECB =============================== - */ -#include -#include - -AESECBCC26XX_Object aesecbCC26XXObjects[CC1352P_4_LAUNCHXL_AESECBCOUNT]; - -const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC1352P_4_LAUNCHXL_AESECBCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESECB_Config AESECB_config[CC1352P_4_LAUNCHXL_AESECBCOUNT] = { - { - .object = &aesecbCC26XXObjects[CC1352P_4_LAUNCHXL_AESECB0], - .hwAttrs = &aesecbCC26XXHWAttrs[CC1352P_4_LAUNCHXL_AESECB0] - }, -}; - -const uint_least8_t AESECB_count = CC1352P_4_LAUNCHXL_AESECBCOUNT; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1352P_4_LAUNCHXL.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1352P_4_LAUNCHXL_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1352P_4_LAUNCHXL_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG, - - /* SD CS */ - GPIOCC26XX_DIO_19 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1352P_LAUNCH.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC1352P_4_LAUNCHXL_SPI_MASTER_READY */ - NULL, /* CC1352P_4_LAUNCHXL_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC1352P_4_LAUNCHXL_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC1352P_4_LAUNCHXL_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352P_4_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC1352P_4_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P_4_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC1352P_4_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P_4_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC1352P_4_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P_4_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC1352P_4_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P_4_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC1352P_4_LAUNCHXL_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P_4_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC1352P_4_LAUNCHXL_I2C0_SDA0, - .sclPin = CC1352P_4_LAUNCHXL_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC1352P_4_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC1352P_4_LAUNCHXL_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC1352P_4_LAUNCHXL_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC1352P_4_LAUNCHXL_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x48000 -#define SECTORSIZE 0x2000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS External Regions */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS External Regions */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC1352P_4_LAUNCHXL_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC1352P_4_LAUNCHXL_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC1352P_4_LAUNCHXL_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC1352P_4_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1352P_4_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1352P_4_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1352P_4_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1352P_4_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1352P_4_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */ - CC1352P_4_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC1352P_4_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC1352P_4_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC1352P_4_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - CC1352P_4_LAUNCHXL_DIO28_RF_24GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - CC1352P_4_LAUNCHXL_DIO29_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - CC1352P_4_LAUNCHXL_DIO30_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26X2_Config PowerCC26X2_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1352P_4_LAUNCHXL_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_PWMCOUNT] = { - { .pwmPin = CC1352P_4_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC1352P_4_LAUNCHXL_GPTIMER0A }, - { .pwmPin = CC1352P_4_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC1352P_4_LAUNCHXL_GPTIMER0B }, - { .pwmPin = CC1352P_4_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1352P_4_LAUNCHXL_GPTIMER1A }, - { .pwmPin = CC1352P_4_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC1352P_4_LAUNCHXL_GPTIMER1B }, - { .pwmPin = CC1352P_4_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC1352P_4_LAUNCHXL_GPTIMER2A }, - { .pwmPin = CC1352P_4_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC1352P_4_LAUNCHXL_GPTIMER2B }, - { .pwmPin = CC1352P_4_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC1352P_4_LAUNCHXL_GPTIMER3A }, - { .pwmPin = CC1352P_4_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC1352P_4_LAUNCHXL_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC1352P_4_LAUNCHXL_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_4_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_4_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_4_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_4_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_4_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_4_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_4_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_4_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC1352P_4_LAUNCHXL_PWM7] }, -}; - -const uint_least8_t PWM_count = CC1352P_4_LAUNCHXL_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -/* - * Board-specific callback function to set the correct antenna path. - * - * This function is called by the RF driver on global driver events. - * It contains a default implementation to set the correct antenna path. - * This function is defined in the file CC1352P_4_LAUNCHXL_fxns.c - */ -extern void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void* arg); - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - - /* Register the board specific callback */ - .globalCallback = &rfDriverCallback, - - /* Subscribe the callback to both events */ - .globalEventMask = RF_GlobalEventRadioSetup | RF_GlobalEventRadioPowerDown -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC1352P_4_LAUNCHXL_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC1352P_4_LAUNCHXL_SDCOUNT] = { - { - .spiIndex = CC1352P_4_LAUNCHXL_SPI0, - .spiCsGpioIndex = CC1352P_4_LAUNCHXL_GPIO_DIO_19 - } -}; - -const SD_Config SD_config[CC1352P_4_LAUNCHXL_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC1352P_4_LAUNCHXL_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC1352P_4_LAUNCHXL_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC1352P_4_LAUNCHXL_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1352P_4_LAUNCHXL_SPICOUNT]; - -#if TI_SPI_CONF_ENABLE - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P_4_LAUNCHXL_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X2_Object trngCC26X2Object[CC1352P_4_LAUNCHXL_TRNGCOUNT]; - -const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC1352P_4_LAUNCHXL_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC1352P_4_LAUNCHXL_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC1352P_4_LAUNCHXL_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC1352P_4_LAUNCHXL_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P_4_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1352P_4_LAUNCHXL_UART0_TX, - .rxPin = CC1352P_4_LAUNCHXL_UART0_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1352P_4_LAUNCHXL_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352P_4_LAUNCHXL_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -#if TI_UART_CONF_UART1_ENABLE - { - .baseAddr = UART1_BASE, - .powerMngrId = PowerCC26X2_PERIPH_UART1, - .intNum = INT_UART1_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1352P_4_LAUNCHXL_UART1_TX, - .rxPin = CC1352P_4_LAUNCHXL_UART1_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1352P_4_LAUNCHXL_UART1], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352P_4_LAUNCHXL_UART1]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC1352P_4_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1352P_4_LAUNCHXL_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC1352P_4_LAUNCHXL_UART0] - }, -#endif -#if TI_UART_CONF_UART1_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1352P_4_LAUNCHXL_UART1], - .hwAttrs = &uartCC26XXHWAttrs[CC1352P_4_LAUNCHXL_UART1] - }, -#endif -}; - -const uint_least8_t UART_count = CC1352P_4_LAUNCHXL_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC1352P_4_LAUNCHXL_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC1352P_4_LAUNCHXL_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC1352P_4_LAUNCHXL_UDMACOUNT] = { - { - .object = &udmaObjects[CC1352P_4_LAUNCHXL_UDMA0], - .hwAttrs = &udmaHWAttrs[CC1352P_4_LAUNCHXL_UDMA0] - }, -}; - - - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC1352P_4_LAUNCHXL_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1352P_4_LAUNCHXL_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC1352P_4_LAUNCHXL_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC1352P_4_LAUNCHXL_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC1352P_4_LAUNCHXL_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC1352P_4_LAUNCHXL_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC1352P_4_LAUNCHXL_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC1352P_4_LAUNCHXL_initGeneral ======== - */ -void CC1352P_4_LAUNCHXL_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.h deleted file mode 100644 index d33d50847..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL.h +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** =========================================================================== - * @file CC1352P_4_LAUNCHXL.h - * - * @brief CC1352P_4_LAUNCHXL Board Specific header file. - * - * The CC1352P_4_LAUNCHXL header file should be included in an application as - * follows: - * @code - * #include "CC1352P_4_LAUNCHXL.h" - * @endcode - * - * =========================================================================== - */ -#ifndef __CC1352P_4_LAUNCHXL_BOARD_H__ -#define __CC1352P_4_LAUNCHXL_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC1352P_4_LAUNCHXL - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Mapping of pins to board signals using general board aliases - * - */ -/* Analog Capable DIOs */ -#define CC1352P_4_LAUNCHXL_DIO23_ANALOG IOID_23 -#define CC1352P_4_LAUNCHXL_DIO24_ANALOG IOID_24 -#define CC1352P_4_LAUNCHXL_DIO25_ANALOG IOID_25 -#define CC1352P_4_LAUNCHXL_DIO26_ANALOG IOID_26 -#define CC1352P_4_LAUNCHXL_DIO27_ANALOG IOID_27 - -/* RF Antenna Switch */ -#define CC1352P_4_LAUNCHXL_DIO28_RF_24GHZ IOID_28 -#define CC1352P_4_LAUNCHXL_DIO29_RF_HIGH_PA IOID_29 -#define CC1352P_4_LAUNCHXL_DIO30_RF_SUB1GHZ IOID_30 - -/* Digital IOs */ -#define CC1352P_4_LAUNCHXL_DIO12 IOID_12 -#define CC1352P_4_LAUNCHXL_DIO15 IOID_15 -#define CC1352P_4_LAUNCHXL_DIO16_TDO IOID_16 -#define CC1352P_4_LAUNCHXL_DIO17_TDI IOID_17 -#define CC1352P_4_LAUNCHXL_DIO21 IOID_21 -#define CC1352P_4_LAUNCHXL_DIO22 IOID_22 - -/* Discrete Inputs */ -#define CC1352P_4_LAUNCHXL_PIN_BTN1 IOID_15 -#define CC1352P_4_LAUNCHXL_PIN_BTN2 IOID_14 - -/* GPIO */ -#define CC1352P_4_LAUNCHXL_GPIO_LED_ON 1 -#define CC1352P_4_LAUNCHXL_GPIO_LED_OFF 0 - -/* I2C */ -#define CC1352P_4_LAUNCHXL_I2C0_SCL0 IOID_21 -#define CC1352P_4_LAUNCHXL_I2C0_SDA0 IOID_5 - -/* LEDs */ -#define CC1352P_4_LAUNCHXL_PIN_LED_ON 1 -#define CC1352P_4_LAUNCHXL_PIN_LED_OFF 0 -#define CC1352P_4_LAUNCHXL_PIN_RLED IOID_6 -#define CC1352P_4_LAUNCHXL_PIN_GLED IOID_7 - -/* PWM Outputs */ -#define CC1352P_4_LAUNCHXL_PWMPIN0 CC1352P_4_LAUNCHXL_PIN_RLED -#define CC1352P_4_LAUNCHXL_PWMPIN1 CC1352P_4_LAUNCHXL_PIN_GLED -#define CC1352P_4_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED - -/* SPI */ -#define CC1352P_4_LAUNCHXL_SPI_FLASH_CS IOID_20 -#define CC1352P_4_LAUNCHXL_FLASH_CS_ON 0 -#define CC1352P_4_LAUNCHXL_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC1352P_4_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */ -#define CC1352P_4_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */ -#define CC1352P_4_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */ -#define CC1352P_4_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC1352P_4_LAUNCHXL_UART0_RX IOID_12 /* RXD */ -#define CC1352P_4_LAUNCHXL_UART0_TX IOID_13 /* TXD */ -#define CC1352P_4_LAUNCHXL_UART0_CTS PIN_UNASSIGNED /* CTS */ -#define CC1352P_4_LAUNCHXL_UART0_RTS IOID_18 /* RTS */ -#define CC1352P_4_LAUNCHXL_UART1_RX PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_UART1_TX PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_UART1_CTS PIN_UNASSIGNED -#define CC1352P_4_LAUNCHXL_UART1_RTS PIN_UNASSIGNED -/* For backward compatibility */ -#define CC1352P_4_LAUNCHXL_UART_RX CC1352P_4_LAUNCHXL_UART0_RX -#define CC1352P_4_LAUNCHXL_UART_TX CC1352P_4_LAUNCHXL_UART0_TX -#define CC1352P_4_LAUNCHXL_UART_CTS CC1352P_4_LAUNCHXL_UART0_CTS -#define CC1352P_4_LAUNCHXL_UART_RTS CC1352P_4_LAUNCHXL_UART0_RTS - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC1352P_4_LAUNCHXL_initGeneral(void); - -/*! - * @brief Shut down the external flash present on the board files - * - * This function bitbangs the SPI sequence necessary to turn off - * the external flash on LaunchPads. - */ -void CC1352P_4_LAUNCHXL_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC1352P_4_LAUNCHXL_wakeUpExtFlash(void); - - -/*! - * \brief Initializes the antenna switch IOs. - * - * This function sets up the antenna switch and occupies - * the necessary IO pins. After calling this function, they - * cannot be used in the application anymore. - */ -void CC1352P_4_LAUNCHXL_initAntennaSwitch(void); - -/*! - * @def CC1352P_4_LAUNCHXL_ADCBufName - * @brief Enum of ADCs - */ -typedef enum CC1352P_4_LAUNCHXL_ADCBufName { - CC1352P_4_LAUNCHXL_ADCBUF0 = 0, - - CC1352P_4_LAUNCHXL_ADCBUFCOUNT -} CC1352P_4_LAUNCHXL_ADCBufName; - -/*! - * @def CC1352P_4_LAUNCHXL_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC1352P_4_LAUNCHXL_ADCBuf0ChannelName { - CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL0 = 0, - CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL1, - CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL2, - CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL3, - CC1352P_4_LAUNCHXL_ADCBUF0CHANNEL4, - CC1352P_4_LAUNCHXL_ADCBUF0CHANNELVDDS, - CC1352P_4_LAUNCHXL_ADCBUF0CHANNELDCOUPL, - CC1352P_4_LAUNCHXL_ADCBUF0CHANNELVSS, - - CC1352P_4_LAUNCHXL_ADCBUF0CHANNELCOUNT -} CC1352P_4_LAUNCHXL_ADCBuf0ChannelName; - -/*! - * @def CC1352P_4_LAUNCHXL_ADCName - * @brief Enum of ADCs - */ -typedef enum CC1352P_4_LAUNCHXL_ADCName { - CC1352P_4_LAUNCHXL_ADC0 = 0, - CC1352P_4_LAUNCHXL_ADC1, - CC1352P_4_LAUNCHXL_ADC2, - CC1352P_4_LAUNCHXL_ADC3, - CC1352P_4_LAUNCHXL_ADC4, - CC1352P_4_LAUNCHXL_ADCDCOUPL, - CC1352P_4_LAUNCHXL_ADCVSS, - CC1352P_4_LAUNCHXL_ADCVDDS, - - CC1352P_4_LAUNCHXL_ADCCOUNT -} CC1352P_4_LAUNCHXL_ADCName; - -/*! - * @def CC1352P_4_LAUNCHXL_ECDHName - * @brief Enum of ECDH names - */ -typedef enum CC1352P_4_LAUNCHXL_ECDHName { - CC1352P_4_LAUNCHXL_ECDH0 = 0, - - CC1352P_4_LAUNCHXL_ECDHCOUNT -} CC1352P_4_LAUNCHXL_ECDHName; - -/*! - * @def CC1352P_4_LAUNCHXL_ECDSAName - * @brief Enum of ECDSA names - */ -typedef enum CC1352P_4_LAUNCHXL_ECDSAName { - CC1352P_4_LAUNCHXL_ECDSA0 = 0, - - CC1352P_4_LAUNCHXL_ECDSACOUNT -} CC1352P_4_LAUNCHXL_ECDSAName; - -/*! - * @def CC1352P_4_LAUNCHXL_ECJPAKEName - * @brief Enum of ECJPAKE names - */ -typedef enum CC1352P_4_LAUNCHXL_ECJPAKEName { - CC1352P_4_LAUNCHXL_ECJPAKE0 = 0, - - CC1352P_4_LAUNCHXL_ECJPAKECOUNT -} CC1352P_4_LAUNCHXL_ECJPAKEName; - -/*! - * @def CC1352P_4_LAUNCHXL_AESCCMName - * @brief Enum of AESCCM names - */ -typedef enum CC1352P_4_LAUNCHXL_AESCCMName { - CC1352P_4_LAUNCHXL_AESCCM0 = 0, - - CC1352P_4_LAUNCHXL_AESCCMCOUNT -} CC1352P_4_LAUNCHXL_AESCCMName; - -/*! - * @def CC1352P_4_LAUNCHXL_AESECBName - * @brief Enum of AESECB names - */ -typedef enum CC1352P_4_LAUNCHXL_AESECBName { - CC1352P_4_LAUNCHXL_AESECB0 = 0, - - CC1352P_4_LAUNCHXL_AESECBCOUNT -} CC1352P_4_LAUNCHXL_AESECBName; - -/*! - * @def CC1352P_4_LAUNCHXL_SHA2Name - * @brief Enum of SHA2 names - */ -typedef enum CC1352P_4_LAUNCHXL_SHA2Name { - CC1352P_4_LAUNCHXL_SHA20 = 0, - - CC1352P_4_LAUNCHXL_SHA2COUNT -} CC1352P_4_LAUNCHXL_SHA2Name; - -/*! - * @def CC1352P_4_LAUNCHXL_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC1352P_4_LAUNCHXL_GPIOName { - CC1352P_4_LAUNCHXL_GPIO_S1 = 0, - CC1352P_4_LAUNCHXL_GPIO_S2, - CC1352P_4_LAUNCHXL_SPI_MASTER_READY, - CC1352P_4_LAUNCHXL_SPI_SLAVE_READY, - CC1352P_4_LAUNCHXL_GPIO_LED_GREEN, - CC1352P_4_LAUNCHXL_GPIO_LED_RED, - CC1352P_4_LAUNCHXL_GPIO_SPI_FLASH_CS, - CC1352P_4_LAUNCHXL_GPIO_SDSPI_CS, - CC1352P_4_LAUNCHXL_GPIOCOUNT -} CC1352P_4_LAUNCHXL_GPIOName; - -/*! - * @def CC1352P_4_LAUNCHXL_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC1352P_4_LAUNCHXL_GPTimerName { - CC1352P_4_LAUNCHXL_GPTIMER0A = 0, - CC1352P_4_LAUNCHXL_GPTIMER0B, - CC1352P_4_LAUNCHXL_GPTIMER1A, - CC1352P_4_LAUNCHXL_GPTIMER1B, - CC1352P_4_LAUNCHXL_GPTIMER2A, - CC1352P_4_LAUNCHXL_GPTIMER2B, - CC1352P_4_LAUNCHXL_GPTIMER3A, - CC1352P_4_LAUNCHXL_GPTIMER3B, - - CC1352P_4_LAUNCHXL_GPTIMERPARTSCOUNT -} CC1352P_4_LAUNCHXL_GPTimerName; - -/*! - * @def CC1352P_4_LAUNCHXL_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC1352P_4_LAUNCHXL_GPTimers { - CC1352P_4_LAUNCHXL_GPTIMER0 = 0, - CC1352P_4_LAUNCHXL_GPTIMER1, - CC1352P_4_LAUNCHXL_GPTIMER2, - CC1352P_4_LAUNCHXL_GPTIMER3, - - CC1352P_4_LAUNCHXL_GPTIMERCOUNT -} CC1352P_4_LAUNCHXL_GPTimers; - -/*! - * @def CC1352P_4_LAUNCHXL_I2CName - * @brief Enum of I2C names - */ -typedef enum CC1352P_4_LAUNCHXL_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC1352P_4_LAUNCHXL_I2C0 = 0, -#endif - - CC1352P_4_LAUNCHXL_I2CCOUNT -} CC1352P_4_LAUNCHXL_I2CName; - -/*! - * @def CC1352P_4_LAUNCHXL_NVSName - * @brief Enum of NVS names - */ -typedef enum CC1352P_4_LAUNCHXL_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC1352P_4_LAUNCHXL_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC1352P_4_LAUNCHXL_NVSSPI25X0, -#endif - - CC1352P_4_LAUNCHXL_NVSCOUNT -} CC1352P_4_LAUNCHXL_NVSName; - -/*! - * @def CC1352P_4_LAUNCHXL_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC1352P_4_LAUNCHXL_PWMName { - CC1352P_4_LAUNCHXL_PWM0 = 0, - CC1352P_4_LAUNCHXL_PWM1, - CC1352P_4_LAUNCHXL_PWM2, - CC1352P_4_LAUNCHXL_PWM3, - CC1352P_4_LAUNCHXL_PWM4, - CC1352P_4_LAUNCHXL_PWM5, - CC1352P_4_LAUNCHXL_PWM6, - CC1352P_4_LAUNCHXL_PWM7, - - CC1352P_4_LAUNCHXL_PWMCOUNT -} CC1352P_4_LAUNCHXL_PWMName; - -/*! - * @def CC1352P_4_LAUNCHXL_SDName - * @brief Enum of SD names - */ -typedef enum CC1352P_4_LAUNCHXL_SDName { - CC1352P_4_LAUNCHXL_SDSPI0 = 0, - - CC1352P_4_LAUNCHXL_SDCOUNT -} CC1352P_4_LAUNCHXL_SDName; - -/*! - * @def CC1352P_4_LAUNCHXL_SPIName - * @brief Enum of SPI names - */ -typedef enum CC1352P_4_LAUNCHXL_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC1352P_4_LAUNCHXL_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC1352P_4_LAUNCHXL_SPI1, -#endif - - CC1352P_4_LAUNCHXL_SPICOUNT -} CC1352P_4_LAUNCHXL_SPIName; - -/*! - * @def CC1352P_4_LAUNCHXL_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC1352P_4_LAUNCHXL_TRNGName { - CC1352P_4_LAUNCHXL_TRNG0 = 0, - - CC1352P_4_LAUNCHXL_TRNGCOUNT -} CC1352P_4_LAUNCHXL_TRNGName; - -/*! - * @def CC1352P_4_LAUNCHXL_UARTName - * @brief Enum of UARTs - */ -typedef enum CC1352P_4_LAUNCHXL_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC1352P_4_LAUNCHXL_UART0 = 0, -#endif -#if TI_UART_CONF_UART1_ENABLE - CC1352P_4_LAUNCHXL_UART1, -#endif - - CC1352P_4_LAUNCHXL_UARTCOUNT -} CC1352P_4_LAUNCHXL_UARTName; - -/*! - * @def CC1352P_4_LAUNCHXL_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC1352P_4_LAUNCHXL_UDMAName { - CC1352P_4_LAUNCHXL_UDMA0 = 0, - - CC1352P_4_LAUNCHXL_UDMACOUNT -} CC1352P_4_LAUNCHXL_UDMAName; - -/*! - * @def CC1352P_4_LAUNCHXL_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC1352P_4_LAUNCHXL_WatchdogName { - CC1352P_4_LAUNCHXL_WATCHDOG0 = 0, - - CC1352P_4_LAUNCHXL_WATCHDOGCOUNT -} CC1352P_4_LAUNCHXL_WatchdogName; - - -#ifdef __cplusplus -} -#endif - -#endif /* __CC1352P_4_LAUNCHXL_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL_fxns.c deleted file mode 100644 index eea9c3b33..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/CC1352P_4_LAUNCHXL_fxns.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ======== CC1352P_4_LAUNCHXL_fxns.c ======== - * This file contains the board-specific initialization functions, and - * RF callback function for antenna switching. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) -#include -#include - -#include "Board.h" - -/* - * ======== CC1352P_4_LAUNCHXL_sendExtFlashByte ======== - */ -void CC1352P_4_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC1352P_4_LAUNCHXL_wakeUpExtFlash ======== - */ -void CC1352P_4_LAUNCHXL_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC1352P_4_LAUNCHXL_shutDownExtFlash ======== - */ -void CC1352P_4_LAUNCHXL_shutDownExtFlash(void) -{ - /* To be sure we are putting the flash into sleep and not waking it, we first have to make a wake up call */ - CC1352P_4_LAUNCHXL_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC1352P_4_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * For the SysConfig generated Board.h file, Board_RF_SUB1GHZ will not be - * defined unless the RF module is added to the configuration. Therefore, - * we don't include this code if Board_RF_SUB1GHZ is not defined. - */ -#if defined(Board_RF_SUB1GHZ) - -/* - * Mask to be used to determine the effective value of the setup command's - * loDivider field. - */ -#define LODIVIDER_MASK 0x7F - -/* - * ======== Antenna switching ======== - */ -static PIN_Handle antennaPins; -static PIN_State antennaState; - -void initAntennaSwitch() -{ - PIN_Config antennaConfig[] = { - Board_RF_24GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - Board_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - Board_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - PIN_TERMINATE - }; - antennaPins = PIN_open(&antennaState, antennaConfig); -} - -/* - * ======== CC1352P1_LAUNCHXL_rfDriverCallback ======== - * Sets up the antenna switch depending on the current PHY configuration. - * Truth table: - * - * Path DIO28 DIO29 DIO30 - * =========== ===== ===== ===== - * Off 0 0 0 - * Sub-1 GHz 0 0 1 - * 2.4 GHz 1 0 0 - * 20 dBm TX 0 1 0 - */ -void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg) -{ - /* Local variable. */ - bool sub1GHz = false; - uint8_t loDivider = 0; - - /* Switch off all paths first. Needs to be done anyway in every sub-case below. */ - PINCC26XX_setOutputValue(Board_RF_24GHZ, 0); - PINCC26XX_setOutputValue(Board_RF_HIGH_PA, 0); - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0); - - if (events & RF_GlobalEventRadioSetup) { - /* Decode the current PA configuration. */ - RF_TxPowerTable_PAType paType = (RF_TxPowerTable_PAType)RF_getTxPower(client).paType; - - /* Decode the generic argument as a setup command. */ - RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg; - - switch (setupCommand->common.commandNo) { - case (CMD_RADIO_SETUP): - case (CMD_BLE5_RADIO_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->common.loDivider; - - /* Sub-1GHz front-end. */ - if (loDivider != 0) { - sub1GHz = true; - } - break; - case (CMD_PROP_RADIO_DIV_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider; - - /* Sub-1GHz front-end. */ - if (loDivider != 0) { - sub1GHz = true; - } - break; - default:break; - } - - if (sub1GHz) { - /* Sub-1 GHz */ - if (paType == RF_TxPowerTable_HighPA) { - /* PA enable --> HIGH PA - * LNA enable --> Sub-1 GHz - */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not - de-asserted on CC1352 Rev A. */ - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_RFC_GPO0); - } else { - /* RF core active --> Sub-1 GHz */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 1); - } - } else { - /* 2.4 GHz */ - if (paType == RF_TxPowerTable_HighPA) - { - /* PA enable --> HIGH PA - * LNA enable --> 2.4 GHz - */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_RFC_GPO0); - /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not - de-asserted on CC1352 Rev A. */ - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - } else { - /* RF core active --> 2.4 GHz */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setOutputValue(Board_RF_24GHZ, 1); - } - } - } else { - /* Reset the IO multiplexer to GPIO functionality */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - } -} -#endif - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ -#if defined(Board_RF_SUB1GHZ) - initAntennaSwitch(); -#endif - - CC1352P_4_LAUNCHXL_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/Makefile.cc1352p-4 b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/Makefile.cc1352p-4 deleted file mode 100644 index 076e186b4..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/Makefile.cc1352p-4 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x2-cc26x2 -DEVICE_FAMILY = CC13X2 -DEVICE_LINE = CC13XX -DEVICE = CC1352P - -BOARD_SOURCEFILES += CC1352P_4_LAUNCHXL.c CC1352P_4_LAUNCHXL_fxns.c - -SUPPORTS_PROP_MODE = 1 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 1 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 0 - -# Include the common board makefile -include $(FAMILY_PATH)/launchpad/Makefile.launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/rf-conf.h deleted file mode 100644 index af183614b..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-4/rf-conf.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for both the Sub-1 GHz - * path and the 2.4 GHz path on the radio. - * - * These are the following front-end mode configurations for the - * CC1352P-4-LAUNCHXL board: - * - Sub-1 GHz: differential and external bias - * - 2.4 GHz: differential and external bias - * - * @{ - */ -#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL - -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/Board.h deleted file mode 100644 index db07b3a0d..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/Board.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC1352P1_LAUNCHXL.h" - -#define Board_CC1352P1_LAUNCHXL -#define BOARD_STRING "TI CC1352P1 LaunchPad" - -#define Board_initGeneral() CC1352P1_LAUNCHXL_initGeneral() -#define Board_shutDownExtFlash() CC1352P1_LAUNCHXL_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC1352P1_LAUNCHXL_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADC0 CC1352P1_LAUNCHXL_ADC0 -#define Board_ADC1 CC1352P1_LAUNCHXL_ADC1 - -#define Board_ADCBUF0 CC1352P1_LAUNCHXL_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC1352P1_LAUNCHXL_ADCBUF0CHANNEL0 -#define Board_ADCBUF0CHANNEL1 CC1352P1_LAUNCHXL_ADCBUF0CHANNEL1 - -#define Board_CRYPTO0 CC1352P1_LAUNCHXL_CRYPTO0 -#define Board_ECDH0 CC1352P1_LAUNCHXL_ECDH0 -#define Board_ECDSA0 CC1352P1_LAUNCHXL_ECDSA0 -#define Board_ECJPAKE0 CC1352P1_LAUNCHXL_ECJPAKE0 -#define Board_AESCCM0 CC1352P1_LAUNCHXL_AESCCM0 -#define Board_AESECB0 CC1352P1_LAUNCHXL_AESECB0 -#define Board_SHA20 CC1352P1_LAUNCHXL_SHA20 - -#define Board_DIO12 CC1352P1_LAUNCHXL_DIO12 -#define Board_DIO15 CC1352P1_LAUNCHXL_DIO15 -#define Board_DIO16_TDO CC1352P1_LAUNCHXL_DIO16_TDO -#define Board_DIO17_TDI CC1352P1_LAUNCHXL_DIO17_TDI -#define Board_DIO21 CC1352P1_LAUNCHXL_DIO21 -#define Board_DIO22 CC1352P1_LAUNCHXL_DIO22 - -#define Board_DIO23_ANALOG CC1352P1_LAUNCHXL_DIO23_ANALOG -#define Board_DIO24_ANALOG CC1352P1_LAUNCHXL_DIO24_ANALOG -#define Board_DIO25_ANALOG CC1352P1_LAUNCHXL_DIO25_ANALOG -#define Board_DIO26_ANALOG CC1352P1_LAUNCHXL_DIO26_ANALOG -#define Board_DIO27_ANALOG CC1352P1_LAUNCHXL_DIO27_ANALOG -#define Board_DIO28_ANALOG CC1352P1_LAUNCHXL_DIO28_ANALOG -#define Board_DIO29_ANALOG CC1352P1_LAUNCHXL_DIO29_ANALOG -#define Board_DIO30_RFSW CC1352P1_LAUNCHXL_DIO30_RF_SUB1GHZ - -/* - * Board_RF_SUB1GHZ, Board_RF_HIGH_PA, and Board_RF_24GHZ are the names - * generated by SysConfig. Define them here so that the RF callback function - * can reference them. - */ -#define Board_RF_24GHZ CC1352P1_LAUNCHXL_DIO28_RF_24GHZ -#define Board_RF_HIGH_PA CC1352P1_LAUNCHXL_DIO29_RF_HIGH_PA -#define Board_RF_SUB1GHZ CC1352P1_LAUNCHXL_DIO30_RF_SUB1GHZ - -#define Board_GPIO_BUTTON0 CC1352P1_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BUTTON1 CC1352P1_LAUNCHXL_GPIO_S2 -#define Board_GPIO_BTN1 CC1352P1_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BTN2 CC1352P1_LAUNCHXL_GPIO_S2 -#define Board_GPIO_LED0 CC1352P1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_LED1 CC1352P1_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED2 CC1352P1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_RLED CC1352P1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_GLED CC1352P1_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED_ON CC1352P1_LAUNCHXL_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC1352P1_LAUNCHXL_GPIO_LED_OFF - -#define Board_GPTIMER0A CC1352P1_LAUNCHXL_GPTIMER0A -#define Board_GPTIMER0B CC1352P1_LAUNCHXL_GPTIMER0B -#define Board_GPTIMER1A CC1352P1_LAUNCHXL_GPTIMER1A -#define Board_GPTIMER1B CC1352P1_LAUNCHXL_GPTIMER1B -#define Board_GPTIMER2A CC1352P1_LAUNCHXL_GPTIMER2A -#define Board_GPTIMER2B CC1352P1_LAUNCHXL_GPTIMER2B -#define Board_GPTIMER3A CC1352P1_LAUNCHXL_GPTIMER3A -#define Board_GPTIMER3B CC1352P1_LAUNCHXL_GPTIMER3B - -#define Board_I2C0 CC1352P1_LAUNCHXL_I2C0 -#define Board_I2C_TMP Board_I2C0 - -#define Board_NVSINTERNAL CC1352P1_LAUNCHXL_NVSCC26XX0 -#define Board_NVSEXTERNAL CC1352P1_LAUNCHXL_NVSSPI25X0 - -#define Board_PIN_BUTTON0 CC1352P1_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BUTTON1 CC1352P1_LAUNCHXL_PIN_BTN2 -#define Board_PIN_BTN1 CC1352P1_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BTN2 CC1352P1_LAUNCHXL_PIN_BTN2 -#define Board_PIN_LED0 CC1352P1_LAUNCHXL_PIN_RLED -#define Board_PIN_LED1 CC1352P1_LAUNCHXL_PIN_GLED -#define Board_PIN_LED2 CC1352P1_LAUNCHXL_PIN_RLED -#define Board_PIN_RLED CC1352P1_LAUNCHXL_PIN_RLED -#define Board_PIN_GLED CC1352P1_LAUNCHXL_PIN_GLED - -#define Board_PWM0 CC1352P1_LAUNCHXL_PWM0 -#define Board_PWM1 CC1352P1_LAUNCHXL_PWM1 -#define Board_PWM2 CC1352P1_LAUNCHXL_PWM2 -#define Board_PWM3 CC1352P1_LAUNCHXL_PWM3 -#define Board_PWM4 CC1352P1_LAUNCHXL_PWM4 -#define Board_PWM5 CC1352P1_LAUNCHXL_PWM5 -#define Board_PWM6 CC1352P1_LAUNCHXL_PWM6 -#define Board_PWM7 CC1352P1_LAUNCHXL_PWM7 - -#define Board_SD0 CC1352P1_LAUNCHXL_SDSPI0 - -#define Board_SPI0 CC1352P1_LAUNCHXL_SPI0 -#define Board_SPI0_MISO CC1352P1_LAUNCHXL_SPI0_MISO -#define Board_SPI0_MOSI CC1352P1_LAUNCHXL_SPI0_MOSI -#define Board_SPI0_CLK CC1352P1_LAUNCHXL_SPI0_CLK -#define Board_SPI0_CSN CC1352P1_LAUNCHXL_SPI0_CSN -#define Board_SPI1 CC1352P1_LAUNCHXL_SPI1 -#define Board_SPI1_MISO CC1352P1_LAUNCHXL_SPI1_MISO -#define Board_SPI1_MOSI CC1352P1_LAUNCHXL_SPI1_MOSI -#define Board_SPI1_CLK CC1352P1_LAUNCHXL_SPI1_CLK -#define Board_SPI1_CSN CC1352P1_LAUNCHXL_SPI1_CSN -#define Board_SPI_FLASH_CS CC1352P1_LAUNCHXL_SPI_FLASH_CS -#define Board_FLASH_CS_ON 0 -#define Board_FLASH_CS_OFF 1 - -#define Board_SPI_MASTER CC1352P1_LAUNCHXL_SPI0 -#define Board_SPI_SLAVE CC1352P1_LAUNCHXL_SPI0 -#define Board_SPI_MASTER_READY CC1352P1_LAUNCHXL_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC1352P1_LAUNCHXL_SPI_SLAVE_READY - -#define Board_UART0 CC1352P1_LAUNCHXL_UART0 -#define Board_UART1 CC1352P1_LAUNCHXL_UART1 - -#define Board_WATCHDOG0 CC1352P1_LAUNCHXL_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_TMP_ADDR (0x40) -#define Board_SENSORS_BP_TMP_ADDR Board_TMP_ADDR - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.c deleted file mode 100644 index cff74bc03..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.c +++ /dev/null @@ -1,949 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC1352P1_LAUNCHXL.c =================================== - * This file is responsible for setting up the board specific items for the - * CC1352P1_LAUNCHXL board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC1352P1_LAUNCHXL.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26X2_Object adcBufCC26xxObjects[CC1352P1_LAUNCHXL_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26X2_AdcChannelLutEntry ADCBufCC26X2_adcChannelLut[CC1352P1_LAUNCHXL_ADCBUF0CHANNELCOUNT] = { - {CC1352P1_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7}, - {CC1352P1_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6}, - {CC1352P1_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5}, - {CC1352P1_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4}, - {CC1352P1_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, -}; - -const ADCBufCC26X2_HWAttrs adcBufCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26X2_adcChannelLut, - .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER0A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC1352P1_LAUNCHXL_ADCBUFCOUNT] = { - { - &ADCBufCC26X2_fxnTable, - &adcBufCC26xxObjects[CC1352P1_LAUNCHXL_ADCBUF0], - &adcBufCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC1352P1_LAUNCHXL_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC1352P1_LAUNCHXL_ADCCOUNT]; - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCCOUNT] = { - { - .adcDIO = CC1352P1_LAUNCHXL_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P1_LAUNCHXL_DIO24_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO6, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P1_LAUNCHXL_DIO25_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO5, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P1_LAUNCHXL_DIO26_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO4, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352P1_LAUNCHXL_DIO27_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO3, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC1352P1_LAUNCHXL_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADC0]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADC1]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADC2]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADC3]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADC4]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC1352P1_LAUNCHXL_ADCCOUNT; - -/* - * =============================== ECDH =============================== - */ -#include -#include - -ECDHCC26X2_Object ecdhCC26X2Objects[CC1352P1_LAUNCHXL_ECDHCOUNT]; - -const ECDHCC26X2_HWAttrs ecdhCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECDHCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDH_Config ECDH_config[CC1352P1_LAUNCHXL_ECDHCOUNT] = { - { - .object = &ecdhCC26X2Objects[CC1352P1_LAUNCHXL_ECDH0], - .hwAttrs = &ecdhCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECDH0] - }, -}; - -const uint_least8_t ECDH_count = CC1352P1_LAUNCHXL_ECDHCOUNT; - -/* - * =============================== ECDSA =============================== - */ -#include -#include - -ECDSACC26X2_Object ecdsaCC26X2Objects[CC1352P1_LAUNCHXL_ECDSACOUNT]; - -const ECDSACC26X2_HWAttrs ecdsaCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECDSACOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDSA_Config ECDSA_config[CC1352P1_LAUNCHXL_ECDSACOUNT] = { - { - .object = &ecdsaCC26X2Objects[CC1352P1_LAUNCHXL_ECDSA0], - .hwAttrs = &ecdsaCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECDSA0] - }, -}; - -const uint_least8_t ECDSA_count = CC1352P1_LAUNCHXL_ECDSACOUNT; - -/* - * =============================== ECJPAKE =============================== - */ -#include -#include - -ECJPAKECC26X2_Object ecjpakeCC26X2Objects[CC1352P1_LAUNCHXL_ECJPAKECOUNT]; - -const ECJPAKECC26X2_HWAttrs ecjpakeCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECJPAKECOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECJPAKE_Config ECJPAKE_config[CC1352P1_LAUNCHXL_ECJPAKECOUNT] = { - { - .object = &ecjpakeCC26X2Objects[CC1352P1_LAUNCHXL_ECJPAKE0], - .hwAttrs = &ecjpakeCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECJPAKE0] - }, -}; - -const uint_least8_t ECJPAKE_count = CC1352P1_LAUNCHXL_ECJPAKECOUNT; - - -/* - * =============================== SHA2 =============================== - */ -#include -#include - -SHA2CC26X2_Object sha2CC26X2Objects[CC1352P1_LAUNCHXL_SHA2COUNT]; - -const SHA2CC26X2_HWAttrs sha2CC26X2HWAttrs[CC1352P1_LAUNCHXL_SHA2COUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const SHA2_Config SHA2_config[CC1352P1_LAUNCHXL_SHA2COUNT] = { - { - .object = &sha2CC26X2Objects[CC1352P1_LAUNCHXL_SHA20], - .hwAttrs = &sha2CC26X2HWAttrs[CC1352P1_LAUNCHXL_SHA20] - }, -}; - -const uint_least8_t SHA2_count = CC1352P1_LAUNCHXL_SHA2COUNT; - -/* - * =============================== AESCCM =============================== - */ -#include -#include - -AESCCMCC26XX_Object aesccmCC26XXObjects[CC1352P1_LAUNCHXL_AESCCMCOUNT]; - -const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESCCMCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESCCM_Config AESCCM_config[CC1352P1_LAUNCHXL_AESCCMCOUNT] = { - { - .object = &aesccmCC26XXObjects[CC1352P1_LAUNCHXL_AESCCM0], - .hwAttrs = &aesccmCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESCCM0] - }, -}; - -const uint_least8_t AESCCM_count = CC1352P1_LAUNCHXL_AESCCMCOUNT; - -/* - * =============================== AESECB =============================== - */ -#include -#include - -AESECBCC26XX_Object aesecbCC26XXObjects[CC1352P1_LAUNCHXL_AESECBCOUNT]; - -const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESECBCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESECB_Config AESECB_config[CC1352P1_LAUNCHXL_AESECBCOUNT] = { - { - .object = &aesecbCC26XXObjects[CC1352P1_LAUNCHXL_AESECB0], - .hwAttrs = &aesecbCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESECB0] - }, -}; - -const uint_least8_t AESECB_count = CC1352P1_LAUNCHXL_AESECBCOUNT; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1352P1_LAUNCHXL.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1352P1_LAUNCHXL_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1352P1_LAUNCHXL_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG, - - /* SD CS */ - GPIOCC26XX_DIO_19 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1352P_LAUNCH.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC1352P1_LAUNCHXL_SPI_MASTER_READY */ - NULL, /* CC1352P1_LAUNCHXL_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC1352P1_LAUNCHXL_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352P1_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC1352P1_LAUNCHXL_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P1_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC1352P1_LAUNCHXL_I2C0_SDA0, - .sclPin = CC1352P1_LAUNCHXL_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC1352P1_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC1352P1_LAUNCHXL_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC1352P1_LAUNCHXL_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC1352P1_LAUNCHXL_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x48000 -#define SECTORSIZE 0x2000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS External Regions */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS External Regions */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC1352P1_LAUNCHXL_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC1352P1_LAUNCHXL_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC1352P1_LAUNCHXL_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC1352P1_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1352P1_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1352P1_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1352P1_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1352P1_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1352P1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */ - CC1352P1_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC1352P1_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC1352P1_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC1352P1_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - CC1352P1_LAUNCHXL_DIO28_RF_24GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - CC1352P1_LAUNCHXL_DIO29_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - CC1352P1_LAUNCHXL_DIO30_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26X2_Config PowerCC26X2_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWMCOUNT] = { - { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER0A }, - { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER0B }, - { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER1A }, - { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER1B }, - { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER2A }, - { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER2B }, - { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER3A }, - { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC1352P1_LAUNCHXL_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM7] }, -}; - -const uint_least8_t PWM_count = CC1352P1_LAUNCHXL_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -/* - * Board-specific callback function to set the correct antenna path. - * - * This function is called by the RF driver on global driver events. - * It contains a default implementation to set the correct antenna path. - * This function is defined in the file CC1352P1_LAUNCHXL_fxns.c - */ -extern void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void* arg); - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - - /* Register the board specific callback */ - .globalCallback = &rfDriverCallback, - - /* Subscribe the callback to both events */ - .globalEventMask = RF_GlobalEventRadioSetup | RF_GlobalEventRadioPowerDown -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC1352P1_LAUNCHXL_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC1352P1_LAUNCHXL_SDCOUNT] = { - { - .spiIndex = CC1352P1_LAUNCHXL_SPI0, - .spiCsGpioIndex = CC1352P1_LAUNCHXL_GPIO_DIO_19 - } -}; - -const SD_Config SD_config[CC1352P1_LAUNCHXL_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC1352P1_LAUNCHXL_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC1352P1_LAUNCHXL_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC1352P1_LAUNCHXL_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1352P1_LAUNCHXL_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352P1_LAUNCHXL_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X2_Object trngCC26X2Object[CC1352P1_LAUNCHXL_TRNGCOUNT]; - -const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC1352P1_LAUNCHXL_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC1352P1_LAUNCHXL_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC1352P1_LAUNCHXL_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1352P1_LAUNCHXL_UART0_TX, - .rxPin = CC1352P1_LAUNCHXL_UART0_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -#if TI_UART_CONF_UART1_ENABLE - { - .baseAddr = UART1_BASE, - .powerMngrId = PowerCC26X2_PERIPH_UART1, - .intNum = INT_UART1_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1352P1_LAUNCHXL_UART1_TX, - .rxPin = CC1352P1_LAUNCHXL_UART1_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UART1], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UART1]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC1352P1_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1352P1_LAUNCHXL_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UART0] - }, -#endif -#if TI_UART_CONF_UART1_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1352P1_LAUNCHXL_UART1], - .hwAttrs = &uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UART1] - }, -#endif -}; - -const uint_least8_t UART_count = CC1352P1_LAUNCHXL_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC1352P1_LAUNCHXL_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC1352P1_LAUNCHXL_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC1352P1_LAUNCHXL_UDMACOUNT] = { - { - .object = &udmaObjects[CC1352P1_LAUNCHXL_UDMA0], - .hwAttrs = &udmaHWAttrs[CC1352P1_LAUNCHXL_UDMA0] - }, -}; - - - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC1352P1_LAUNCHXL_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1352P1_LAUNCHXL_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC1352P1_LAUNCHXL_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC1352P1_LAUNCHXL_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC1352P1_LAUNCHXL_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC1352P1_LAUNCHXL_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC1352P1_LAUNCHXL_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC1352P1_LAUNCHXL_initGeneral ======== - */ -void CC1352P1_LAUNCHXL_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.h deleted file mode 100644 index 067a3ea87..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL.h +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** =========================================================================== - * @file CC1352P1_LAUNCHXL.h - * - * @brief CC1352P1_LAUNCHXL Board Specific header file. - * - * The CC1352P1_LAUNCHXL header file should be included in an application as - * follows: - * @code - * #include "CC1352P1_LAUNCHXL.h" - * @endcode - * - * =========================================================================== - */ -#ifndef __CC1352P1_LAUNCHXL_BOARD_H__ -#define __CC1352P1_LAUNCHXL_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC1352P1_LAUNCHXL - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Mapping of pins to board signals using general board aliases - * - */ -/* Analog Capable DIOs */ -#define CC1352P1_LAUNCHXL_DIO23_ANALOG IOID_23 -#define CC1352P1_LAUNCHXL_DIO24_ANALOG IOID_24 -#define CC1352P1_LAUNCHXL_DIO25_ANALOG IOID_25 -#define CC1352P1_LAUNCHXL_DIO26_ANALOG IOID_26 -#define CC1352P1_LAUNCHXL_DIO27_ANALOG IOID_27 - -/* RF Antenna Switch */ -#define CC1352P1_LAUNCHXL_DIO28_RF_24GHZ IOID_28 -#define CC1352P1_LAUNCHXL_DIO29_RF_HIGH_PA IOID_29 -#define CC1352P1_LAUNCHXL_DIO30_RF_SUB1GHZ IOID_30 - -/* Digital IOs */ -#define CC1352P1_LAUNCHXL_DIO12 IOID_12 -#define CC1352P1_LAUNCHXL_DIO15 IOID_15 -#define CC1352P1_LAUNCHXL_DIO16_TDO IOID_16 -#define CC1352P1_LAUNCHXL_DIO17_TDI IOID_17 -#define CC1352P1_LAUNCHXL_DIO21 IOID_21 -#define CC1352P1_LAUNCHXL_DIO22 IOID_22 - -/* Discrete Inputs */ -#define CC1352P1_LAUNCHXL_PIN_BTN1 IOID_15 -#define CC1352P1_LAUNCHXL_PIN_BTN2 IOID_14 - -/* GPIO */ -#define CC1352P1_LAUNCHXL_GPIO_LED_ON 1 -#define CC1352P1_LAUNCHXL_GPIO_LED_OFF 0 - -/* I2C */ -#define CC1352P1_LAUNCHXL_I2C0_SCL0 IOID_22 -#define CC1352P1_LAUNCHXL_I2C0_SDA0 IOID_5 - -/* LEDs */ -#define CC1352P1_LAUNCHXL_PIN_LED_ON 1 -#define CC1352P1_LAUNCHXL_PIN_LED_OFF 0 -#define CC1352P1_LAUNCHXL_PIN_RLED IOID_6 -#define CC1352P1_LAUNCHXL_PIN_GLED IOID_7 - -/* PWM Outputs */ -#define CC1352P1_LAUNCHXL_PWMPIN0 CC1352P1_LAUNCHXL_PIN_RLED -#define CC1352P1_LAUNCHXL_PWMPIN1 CC1352P1_LAUNCHXL_PIN_GLED -#define CC1352P1_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED - -/* SPI */ -#define CC1352P1_LAUNCHXL_SPI_FLASH_CS IOID_20 -#define CC1352P1_LAUNCHXL_FLASH_CS_ON 0 -#define CC1352P1_LAUNCHXL_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC1352P1_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */ -#define CC1352P1_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */ -#define CC1352P1_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */ -#define CC1352P1_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC1352P1_LAUNCHXL_UART0_RX IOID_12 /* RXD */ -#define CC1352P1_LAUNCHXL_UART0_TX IOID_13 /* TXD */ -#define CC1352P1_LAUNCHXL_UART0_CTS IOID_19 /* CTS */ -#define CC1352P1_LAUNCHXL_UART0_RTS IOID_18 /* RTS */ -#define CC1352P1_LAUNCHXL_UART1_RX PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_UART1_TX PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_UART1_CTS PIN_UNASSIGNED -#define CC1352P1_LAUNCHXL_UART1_RTS PIN_UNASSIGNED -/* For backward compatibility */ -#define CC1352P1_LAUNCHXL_UART_RX CC1352P1_LAUNCHXL_UART0_RX -#define CC1352P1_LAUNCHXL_UART_TX CC1352P1_LAUNCHXL_UART0_TX -#define CC1352P1_LAUNCHXL_UART_CTS CC1352P1_LAUNCHXL_UART0_CTS -#define CC1352P1_LAUNCHXL_UART_RTS CC1352P1_LAUNCHXL_UART0_RTS - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC1352P1_LAUNCHXL_initGeneral(void); - -/*! - * @brief Shut down the external flash present on the board files - * - * This function bitbangs the SPI sequence necessary to turn off - * the external flash on LaunchPads. - */ -void CC1352P1_LAUNCHXL_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC1352P1_LAUNCHXL_wakeUpExtFlash(void); - - -/*! - * \brief Initializes the antenna switch IOs. - * - * This function sets up the antenna switch and occupies - * the necessary IO pins. After calling this function, they - * cannot be used in the application anymore. - */ -void CC1352P1_LAUNCHXL_initAntennaSwitch(void); - -/*! - * @def CC1352P1_LAUNCHXL_ADCBufName - * @brief Enum of ADCs - */ -typedef enum CC1352P1_LAUNCHXL_ADCBufName { - CC1352P1_LAUNCHXL_ADCBUF0 = 0, - - CC1352P1_LAUNCHXL_ADCBUFCOUNT -} CC1352P1_LAUNCHXL_ADCBufName; - -/*! - * @def CC1352P1_LAUNCHXL_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC1352P1_LAUNCHXL_ADCBuf0ChannelName { - CC1352P1_LAUNCHXL_ADCBUF0CHANNEL0 = 0, - CC1352P1_LAUNCHXL_ADCBUF0CHANNEL1, - CC1352P1_LAUNCHXL_ADCBUF0CHANNEL2, - CC1352P1_LAUNCHXL_ADCBUF0CHANNEL3, - CC1352P1_LAUNCHXL_ADCBUF0CHANNEL4, - CC1352P1_LAUNCHXL_ADCBUF0CHANNEL5, - CC1352P1_LAUNCHXL_ADCBUF0CHANNEL6, - CC1352P1_LAUNCHXL_ADCBUF0CHANNELVDDS, - CC1352P1_LAUNCHXL_ADCBUF0CHANNELDCOUPL, - CC1352P1_LAUNCHXL_ADCBUF0CHANNELVSS, - - CC1352P1_LAUNCHXL_ADCBUF0CHANNELCOUNT -} CC1352P1_LAUNCHXL_ADCBuf0ChannelName; - -/*! - * @def CC1352P1_LAUNCHXL_ADCName - * @brief Enum of ADCs - */ -typedef enum CC1352P1_LAUNCHXL_ADCName { - CC1352P1_LAUNCHXL_ADC0 = 0, - CC1352P1_LAUNCHXL_ADC1, - CC1352P1_LAUNCHXL_ADC2, - CC1352P1_LAUNCHXL_ADC3, - CC1352P1_LAUNCHXL_ADC4, - CC1352P1_LAUNCHXL_ADC5, - CC1352P1_LAUNCHXL_ADC6, - CC1352P1_LAUNCHXL_ADCDCOUPL, - CC1352P1_LAUNCHXL_ADCVSS, - CC1352P1_LAUNCHXL_ADCVDDS, - - CC1352P1_LAUNCHXL_ADCCOUNT -} CC1352P1_LAUNCHXL_ADCName; - -/*! - * @def CC1352P1_LAUNCHXL_ECDHName - * @brief Enum of ECDH names - */ -typedef enum CC1352P1_LAUNCHXL_ECDHName { - CC1352P1_LAUNCHXL_ECDH0 = 0, - - CC1352P1_LAUNCHXL_ECDHCOUNT -} CC1352P1_LAUNCHXL_ECDHName; - -/*! - * @def CC1352P1_LAUNCHXL_ECDSAName - * @brief Enum of ECDSA names - */ -typedef enum CC1352P1_LAUNCHXL_ECDSAName { - CC1352P1_LAUNCHXL_ECDSA0 = 0, - - CC1352P1_LAUNCHXL_ECDSACOUNT -} CC1352P1_LAUNCHXL_ECDSAName; - -/*! - * @def CC1352P1_LAUNCHXL_ECJPAKEName - * @brief Enum of ECJPAKE names - */ -typedef enum CC1352P1_LAUNCHXL_ECJPAKEName { - CC1352P1_LAUNCHXL_ECJPAKE0 = 0, - - CC1352P1_LAUNCHXL_ECJPAKECOUNT -} CC1352P1_LAUNCHXL_ECJPAKEName; - -/*! - * @def CC1352P1_LAUNCHXL_AESCCMName - * @brief Enum of AESCCM names - */ -typedef enum CC1352P1_LAUNCHXL_AESCCMName { - CC1352P1_LAUNCHXL_AESCCM0 = 0, - - CC1352P1_LAUNCHXL_AESCCMCOUNT -} CC1352P1_LAUNCHXL_AESCCMName; - -/*! - * @def CC1352P1_LAUNCHXL_AESECBName - * @brief Enum of AESECB names - */ -typedef enum CC1352P1_LAUNCHXL_AESECBName { - CC1352P1_LAUNCHXL_AESECB0 = 0, - - CC1352P1_LAUNCHXL_AESECBCOUNT -} CC1352P1_LAUNCHXL_AESECBName; - -/*! - * @def CC1352P1_LAUNCHXL_SHA2Name - * @brief Enum of SHA2 names - */ -typedef enum CC1352P1_LAUNCHXL_SHA2Name { - CC1352P1_LAUNCHXL_SHA20 = 0, - - CC1352P1_LAUNCHXL_SHA2COUNT -} CC1352P1_LAUNCHXL_SHA2Name; - -/*! - * @def CC1352P1_LAUNCHXL_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC1352P1_LAUNCHXL_GPIOName { - CC1352P1_LAUNCHXL_GPIO_S1 = 0, - CC1352P1_LAUNCHXL_GPIO_S2, - CC1352P1_LAUNCHXL_SPI_MASTER_READY, - CC1352P1_LAUNCHXL_SPI_SLAVE_READY, - CC1352P1_LAUNCHXL_GPIO_LED_GREEN, - CC1352P1_LAUNCHXL_GPIO_LED_RED, - CC1352P1_LAUNCHXL_GPIO_SPI_FLASH_CS, - CC1352P1_LAUNCHXL_GPIO_SDSPI_CS, - CC1352P1_LAUNCHXL_GPIOCOUNT -} CC1352P1_LAUNCHXL_GPIOName; - -/*! - * @def CC1352P1_LAUNCHXL_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC1352P1_LAUNCHXL_GPTimerName { - CC1352P1_LAUNCHXL_GPTIMER0A = 0, - CC1352P1_LAUNCHXL_GPTIMER0B, - CC1352P1_LAUNCHXL_GPTIMER1A, - CC1352P1_LAUNCHXL_GPTIMER1B, - CC1352P1_LAUNCHXL_GPTIMER2A, - CC1352P1_LAUNCHXL_GPTIMER2B, - CC1352P1_LAUNCHXL_GPTIMER3A, - CC1352P1_LAUNCHXL_GPTIMER3B, - - CC1352P1_LAUNCHXL_GPTIMERPARTSCOUNT -} CC1352P1_LAUNCHXL_GPTimerName; - -/*! - * @def CC1352P1_LAUNCHXL_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC1352P1_LAUNCHXL_GPTimers { - CC1352P1_LAUNCHXL_GPTIMER0 = 0, - CC1352P1_LAUNCHXL_GPTIMER1, - CC1352P1_LAUNCHXL_GPTIMER2, - CC1352P1_LAUNCHXL_GPTIMER3, - - CC1352P1_LAUNCHXL_GPTIMERCOUNT -} CC1352P1_LAUNCHXL_GPTimers; - -/*! - * @def CC1352P1_LAUNCHXL_I2CName - * @brief Enum of I2C names - */ -typedef enum CC1352P1_LAUNCHXL_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC1352P1_LAUNCHXL_I2C0 = 0, -#endif - - CC1352P1_LAUNCHXL_I2CCOUNT -} CC1352P1_LAUNCHXL_I2CName; - -/*! - * @def CC1352P1_LAUNCHXL_NVSName - * @brief Enum of NVS names - */ -typedef enum CC1352P1_LAUNCHXL_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC1352P1_LAUNCHXL_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC1352P1_LAUNCHXL_NVSSPI25X0, -#endif - - CC1352P1_LAUNCHXL_NVSCOUNT -} CC1352P1_LAUNCHXL_NVSName; - -/*! - * @def CC1352P1_LAUNCHXL_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC1352P1_LAUNCHXL_PWMName { - CC1352P1_LAUNCHXL_PWM0 = 0, - CC1352P1_LAUNCHXL_PWM1, - CC1352P1_LAUNCHXL_PWM2, - CC1352P1_LAUNCHXL_PWM3, - CC1352P1_LAUNCHXL_PWM4, - CC1352P1_LAUNCHXL_PWM5, - CC1352P1_LAUNCHXL_PWM6, - CC1352P1_LAUNCHXL_PWM7, - - CC1352P1_LAUNCHXL_PWMCOUNT -} CC1352P1_LAUNCHXL_PWMName; - -/*! - * @def CC1352P1_LAUNCHXL_SDName - * @brief Enum of SD names - */ -typedef enum CC1352P1_LAUNCHXL_SDName { - CC1352P1_LAUNCHXL_SDSPI0 = 0, - - CC1352P1_LAUNCHXL_SDCOUNT -} CC1352P1_LAUNCHXL_SDName; - -/*! - * @def CC1352P1_LAUNCHXL_SPIName - * @brief Enum of SPI names - */ -typedef enum CC1352P1_LAUNCHXL_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC1352P1_LAUNCHXL_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC1352P1_LAUNCHXL_SPI1, -#endif - - CC1352P1_LAUNCHXL_SPICOUNT -} CC1352P1_LAUNCHXL_SPIName; - -/*! - * @def CC1352P1_LAUNCHXL_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC1352P1_LAUNCHXL_TRNGName { - CC1352P1_LAUNCHXL_TRNG0 = 0, - - CC1352P1_LAUNCHXL_TRNGCOUNT -} CC1352P1_LAUNCHXL_TRNGName; - -/*! - * @def CC1352P1_LAUNCHXL_UARTName - * @brief Enum of UARTs - */ -typedef enum CC1352P1_LAUNCHXL_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC1352P1_LAUNCHXL_UART0 = 0, -#endif -#if TI_UART_CONF_UART1_ENABLE - CC1352P1_LAUNCHXL_UART1, -#endif - - CC1352P1_LAUNCHXL_UARTCOUNT -} CC1352P1_LAUNCHXL_UARTName; - -/*! - * @def CC1352P1_LAUNCHXL_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC1352P1_LAUNCHXL_UDMAName { - CC1352P1_LAUNCHXL_UDMA0 = 0, - - CC1352P1_LAUNCHXL_UDMACOUNT -} CC1352P1_LAUNCHXL_UDMAName; - -/*! - * @def CC1352P1_LAUNCHXL_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC1352P1_LAUNCHXL_WatchdogName { - CC1352P1_LAUNCHXL_WATCHDOG0 = 0, - - CC1352P1_LAUNCHXL_WATCHDOGCOUNT -} CC1352P1_LAUNCHXL_WatchdogName; - - -#ifdef __cplusplus -} -#endif - -#endif /* __CC1352P1_LAUNCHXL_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL_fxns.c deleted file mode 100644 index 795f60106..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/CC1352P1_LAUNCHXL_fxns.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ======== CC1352P1_LAUNCHXL_fxns.c ======== - * This file contains the board-specific initialization functions, and - * RF callback function for antenna switching. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) -#include -#include - -#include "Board.h" - -/* - * ======== CC1352P1_LAUNCHXL_sendExtFlashByte ======== - */ -void CC1352P1_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC1352P1_LAUNCHXL_wakeUpExtFlash ======== - */ -void CC1352P1_LAUNCHXL_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC1352P1_LAUNCHXL_shutDownExtFlash ======== - */ -void CC1352P1_LAUNCHXL_shutDownExtFlash(void) -{ - /* To be sure we are putting the flash into sleep and not waking it, we first have to make a wake up call */ - CC1352P1_LAUNCHXL_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC1352P1_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * For the SysConfig generated Board.h file, Board_RF_SUB1GHZ will not be - * defined unless the RF module is added to the configuration. Therefore, - * we don't include this code if Board_RF_SUB1GHZ is not defined. - */ -#if defined(Board_RF_SUB1GHZ) - -/* - * Mask to be used to determine the effective value of the setup command's - * loDivider field. - */ -#define LODIVIDER_MASK 0x7F - -/* - * ======== Antenna switching ======== - */ -static PIN_Handle antennaPins; -static PIN_State antennaState; - -void initAntennaSwitch() -{ - PIN_Config antennaConfig[] = { - Board_RF_24GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - Board_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - Board_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */ - PIN_TERMINATE - }; - antennaPins = PIN_open(&antennaState, antennaConfig); -} - -/* - * ======== CC1352P1_LAUNCHXL_rfDriverCallback ======== - * Sets up the antenna switch depending on the current PHY configuration. - * Truth table: - * - * Path DIO28 DIO29 DIO30 - * =========== ===== ===== ===== - * Off 0 0 0 - * Sub-1 GHz 0 0 1 - * 2.4 GHz 1 0 0 - * 20 dBm TX 0 1 0 - */ -void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg) -{ - /* Local variable. */ - bool sub1GHz = false; - uint8_t loDivider = 0; - - /* Switch off all paths first. Needs to be done anyway in every sub-case below. */ - PINCC26XX_setOutputValue(Board_RF_24GHZ, 0); - PINCC26XX_setOutputValue(Board_RF_HIGH_PA, 0); - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0); - - if (events & RF_GlobalEventRadioSetup) { - /* Decode the current PA configuration. */ - RF_TxPowerTable_PAType paType = (RF_TxPowerTable_PAType)RF_getTxPower(client).paType; - - /* Decode the generic argument as a setup command. */ - RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg; - - switch (setupCommand->common.commandNo) { - case (CMD_RADIO_SETUP): - case (CMD_BLE5_RADIO_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->common.loDivider; - - /* Sub-1GHz front-end. */ - if (loDivider != 0) { - sub1GHz = true; - } - break; - case (CMD_PROP_RADIO_DIV_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider; - - /* Sub-1GHz front-end. */ - if (loDivider != 0) { - sub1GHz = true; - } - break; - default:break; - } - - if (sub1GHz) { - /* Sub-1 GHz */ - if (paType == RF_TxPowerTable_HighPA) { - /* PA enable --> HIGH PA - * LNA enable --> Sub-1 GHz - */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not - de-asserted on CC1352 Rev A. */ - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_RFC_GPO0); - } else { - /* RF core active --> Sub-1 GHz */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 1); - } - } else { - /* 2.4 GHz */ - if (paType == RF_TxPowerTable_HighPA) - { - /* PA enable --> HIGH PA - * LNA enable --> 2.4 GHz - */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_RFC_GPO0); - /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not - de-asserted on CC1352 Rev A. */ - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - } else { - /* RF core active --> 2.4 GHz */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setOutputValue(Board_RF_24GHZ, 1); - } - } - } else { - /* Reset the IO multiplexer to GPIO functionality */ - PINCC26XX_setMux(antennaPins, Board_RF_24GHZ, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_HIGH_PA, PINCC26XX_MUX_GPIO); - PINCC26XX_setMux(antennaPins, Board_RF_SUB1GHZ, PINCC26XX_MUX_GPIO); - } -} -#endif - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ -#if defined(Board_RF_SUB1GHZ) - initAntennaSwitch(); -#endif - - CC1352P1_LAUNCHXL_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/Makefile.cc1352p1 b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/Makefile.cc1352p1 deleted file mode 100644 index 37afeef96..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/Makefile.cc1352p1 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x2-cc26x2 -DEVICE_FAMILY = CC13X2 -DEVICE_LINE = CC13XX -DEVICE = CC1352P - -BOARD_SOURCEFILES += CC1352P1_LAUNCHXL.c CC1352P1_LAUNCHXL_fxns.c - -SUPPORTS_PROP_MODE = 1 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 1 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 0 - -# Include the common board makefile -include $(FAMILY_PATH)/launchpad/Makefile.launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/rf-conf.h deleted file mode 100644 index c18573f7a..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p1/rf-conf.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for both the Sub-1 GHz - * path and the 2.4 GHz path on the radio. - * - * These are the following front-end mode configurations for the - * CC1352P1-LAUNCHXL board: - * - Sub-1 GHz: differential and external bias - * - 2.4 GHz: differential and external bias - * - * @{ - */ -#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL - -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/Board.h deleted file mode 100644 index 83b27069a..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/Board.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC1352R1_LAUNCHXL.h" - -#define Board_CC1352R1_LAUNCHXL -#define BOARD_STRING "TI CC1352R1 LaunchPad" - -#define Board_initGeneral() CC1352R1_LAUNCHXL_initGeneral() -#define Board_shutDownExtFlash() CC1352R1_LAUNCHXL_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC1352R1_LAUNCHXL_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADC0 CC1352R1_LAUNCHXL_ADC0 -#define Board_ADC1 CC1352R1_LAUNCHXL_ADC1 - -#define Board_ADCBUF0 CC1352R1_LAUNCHXL_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC1352R1_LAUNCHXL_ADCBUF0CHANNEL0 -#define Board_ADCBUF0CHANNEL1 CC1352R1_LAUNCHXL_ADCBUF0CHANNEL1 - -#define Board_ECDH0 CC1352R1_LAUNCHXL_ECDH0 -#define Board_ECDSA0 CC1352R1_LAUNCHXL_ECDSA0 -#define Board_ECJPAKE0 CC1352R1_LAUNCHXL_ECJPAKE0 -#define Board_AESCCM0 CC1352R1_LAUNCHXL_AESCCM0 -#define Board_AESECB0 CC1352R1_LAUNCHXL_AESECB0 -#define Board_SHA20 CC1352R1_LAUNCHXL_SHA20 - -#define Board_DIO12 CC1352R1_LAUNCHXL_DIO12 -#define Board_DIO15 CC1352R1_LAUNCHXL_DIO15 -#define Board_DIO16_TDO CC1352R1_LAUNCHXL_DIO16_TDO -#define Board_DIO17_TDI CC1352R1_LAUNCHXL_DIO17_TDI -#define Board_DIO21 CC1352R1_LAUNCHXL_DIO21 -#define Board_DIO22 CC1352R1_LAUNCHXL_DIO22 - -#define Board_DIO23_ANALOG CC1352R1_LAUNCHXL_DIO23_ANALOG -#define Board_DIO24_ANALOG CC1352R1_LAUNCHXL_DIO24_ANALOG -#define Board_DIO25_ANALOG CC1352R1_LAUNCHXL_DIO25_ANALOG -#define Board_DIO26_ANALOG CC1352R1_LAUNCHXL_DIO26_ANALOG -#define Board_DIO27_ANALOG CC1352R1_LAUNCHXL_DIO27_ANALOG -#define Board_DIO28_ANALOG CC1352R1_LAUNCHXL_DIO28_ANALOG -#define Board_DIO29_ANALOG CC1352R1_LAUNCHXL_DIO29_ANALOG -#define Board_DIO30_RFSW CC1352R1_LAUNCHXL_DIO30_RF_SUB1GHZ - -/* - * Board_RF_SUB1GHZ is the name generated by SysConfig. Define it - * here so that RF callback function can reference it. - */ -#define Board_RF_SUB1GHZ CC1352R1_LAUNCHXL_DIO30_RF_SUB1GHZ - -#define Board_GPIO_BUTTON0 CC1352R1_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BUTTON1 CC1352R1_LAUNCHXL_GPIO_S2 -#define Board_GPIO_BTN1 CC1352R1_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BTN2 CC1352R1_LAUNCHXL_GPIO_S2 -#define Board_GPIO_LED0 CC1352R1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_LED1 CC1352R1_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED2 CC1352R1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_RLED CC1352R1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_GLED CC1352R1_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED_ON CC1352R1_LAUNCHXL_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC1352R1_LAUNCHXL_GPIO_LED_OFF - -#define Board_GPTIMER0A CC1352R1_LAUNCHXL_GPTIMER0A -#define Board_GPTIMER0B CC1352R1_LAUNCHXL_GPTIMER0B -#define Board_GPTIMER1A CC1352R1_LAUNCHXL_GPTIMER1A -#define Board_GPTIMER1B CC1352R1_LAUNCHXL_GPTIMER1B -#define Board_GPTIMER2A CC1352R1_LAUNCHXL_GPTIMER2A -#define Board_GPTIMER2B CC1352R1_LAUNCHXL_GPTIMER2B -#define Board_GPTIMER3A CC1352R1_LAUNCHXL_GPTIMER3A -#define Board_GPTIMER3B CC1352R1_LAUNCHXL_GPTIMER3B - -#define Board_I2C0 CC1352R1_LAUNCHXL_I2C0 -#define Board_I2C_TMP Board_I2C0 - -#define Board_NVSINTERNAL CC1352R1_LAUNCHXL_NVSCC26XX0 -#define Board_NVSEXTERNAL CC1352R1_LAUNCHXL_NVSSPI25X0 - -#define Board_PIN_BUTTON0 CC1352R1_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BUTTON1 CC1352R1_LAUNCHXL_PIN_BTN2 -#define Board_PIN_BTN1 CC1352R1_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BTN2 CC1352R1_LAUNCHXL_PIN_BTN2 -#define Board_PIN_LED0 CC1352R1_LAUNCHXL_PIN_RLED -#define Board_PIN_LED1 CC1352R1_LAUNCHXL_PIN_GLED -#define Board_PIN_LED2 CC1352R1_LAUNCHXL_PIN_RLED -#define Board_PIN_RLED CC1352R1_LAUNCHXL_PIN_RLED -#define Board_PIN_GLED CC1352R1_LAUNCHXL_PIN_GLED - -#define Board_PWM0 CC1352R1_LAUNCHXL_PWM0 -#define Board_PWM1 CC1352R1_LAUNCHXL_PWM1 -#define Board_PWM2 CC1352R1_LAUNCHXL_PWM2 -#define Board_PWM3 CC1352R1_LAUNCHXL_PWM3 -#define Board_PWM4 CC1352R1_LAUNCHXL_PWM4 -#define Board_PWM5 CC1352R1_LAUNCHXL_PWM5 -#define Board_PWM6 CC1352R1_LAUNCHXL_PWM6 -#define Board_PWM7 CC1352R1_LAUNCHXL_PWM7 - -#define Board_SD0 CC1352R1_LAUNCHXL_SDSPI0 - -#define Board_SPI0 CC1352R1_LAUNCHXL_SPI0 -#define Board_SPI0_MISO CC1352R1_LAUNCHXL_SPI0_MISO -#define Board_SPI0_MOSI CC1352R1_LAUNCHXL_SPI0_MOSI -#define Board_SPI0_CLK CC1352R1_LAUNCHXL_SPI0_CLK -#define Board_SPI0_CSN CC1352R1_LAUNCHXL_SPI0_CSN -#define Board_SPI1 CC1352R1_LAUNCHXL_SPI1 -#define Board_SPI1_MISO CC1352R1_LAUNCHXL_SPI1_MISO -#define Board_SPI1_MOSI CC1352R1_LAUNCHXL_SPI1_MOSI -#define Board_SPI1_CLK CC1352R1_LAUNCHXL_SPI1_CLK -#define Board_SPI1_CSN CC1352R1_LAUNCHXL_SPI1_CSN -#define Board_SPI_FLASH_CS CC1352R1_LAUNCHXL_SPI_FLASH_CS -#define Board_FLASH_CS_ON 0 -#define Board_FLASH_CS_OFF 1 - -#define Board_SPI_MASTER CC1352R1_LAUNCHXL_SPI0 -#define Board_SPI_SLAVE CC1352R1_LAUNCHXL_SPI0 -#define Board_SPI_MASTER_READY CC1352R1_LAUNCHXL_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC1352R1_LAUNCHXL_SPI_SLAVE_READY - -#define Board_UART0 CC1352R1_LAUNCHXL_UART0 -#define Board_UART1 CC1352R1_LAUNCHXL_UART1 - -#define Board_WATCHDOG0 CC1352R1_LAUNCHXL_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_TMP_ADDR (0x40) -#define Board_SENSORS_BP_TMP_ADDR Board_TMP_ADDR - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.c deleted file mode 100644 index f3d002206..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.c +++ /dev/null @@ -1,969 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC1352R1_LAUNCHXL.c =================================== - * This file is responsible for setting up the board specific items for the - * CC1352R1_LAUNCHXL board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC1352R1_LAUNCHXL.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26X2_Object adcBufCC26xxObjects[CC1352R1_LAUNCHXL_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26X2_AdcChannelLutEntry ADCBufCC26X2_adcChannelLut[CC1352R1_LAUNCHXL_ADCBUF0CHANNELCOUNT] = { - {CC1352R1_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7}, - {CC1352R1_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6}, - {CC1352R1_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5}, - {CC1352R1_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4}, - {CC1352R1_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3}, - {CC1352R1_LAUNCHXL_DIO28_ANALOG, ADC_COMPB_IN_AUXIO2}, - {CC1352R1_LAUNCHXL_DIO29_ANALOG, ADC_COMPB_IN_AUXIO1}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, -}; - -const ADCBufCC26X2_HWAttrs adcBufCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26X2_adcChannelLut, - .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER0A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC1352R1_LAUNCHXL_ADCBUFCOUNT] = { - { - &ADCBufCC26X2_fxnTable, - &adcBufCC26xxObjects[CC1352R1_LAUNCHXL_ADCBUF0], - &adcBufCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC1352R1_LAUNCHXL_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC1352R1_LAUNCHXL_ADCCOUNT]; - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCCOUNT] = { - { - .adcDIO = CC1352R1_LAUNCHXL_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352R1_LAUNCHXL_DIO24_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO6, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352R1_LAUNCHXL_DIO25_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO5, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352R1_LAUNCHXL_DIO26_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO4, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352R1_LAUNCHXL_DIO27_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO3, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352R1_LAUNCHXL_DIO28_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO2, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC1352R1_LAUNCHXL_DIO29_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO1, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC1352R1_LAUNCHXL_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC0]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC1]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC2]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC3]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC4]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC5], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC5]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC6], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC6]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC1352R1_LAUNCHXL_ADCCOUNT; - -/* - * =============================== ECDH =============================== - */ -#include -#include - -ECDHCC26X2_Object ecdhCC26X2Objects[CC1352R1_LAUNCHXL_ECDHCOUNT]; - -const ECDHCC26X2_HWAttrs ecdhCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECDHCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDH_Config ECDH_config[CC1352R1_LAUNCHXL_ECDHCOUNT] = { - { - .object = &ecdhCC26X2Objects[CC1352R1_LAUNCHXL_ECDH0], - .hwAttrs = &ecdhCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECDH0] - }, -}; - -const uint_least8_t ECDH_count = CC1352R1_LAUNCHXL_ECDHCOUNT; - -/* - * =============================== ECDSA =============================== - */ -#include -#include - -ECDSACC26X2_Object ecdsaCC26X2Objects[CC1352R1_LAUNCHXL_ECDSACOUNT]; - -const ECDSACC26X2_HWAttrs ecdsaCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECDSACOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDSA_Config ECDSA_config[CC1352R1_LAUNCHXL_ECDSACOUNT] = { - { - .object = &ecdsaCC26X2Objects[CC1352R1_LAUNCHXL_ECDSA0], - .hwAttrs = &ecdsaCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECDSA0] - }, -}; - -const uint_least8_t ECDSA_count = CC1352R1_LAUNCHXL_ECDSACOUNT; - -/* - * =============================== ECJPAKE =============================== - */ -#include -#include - -ECJPAKECC26X2_Object ecjpakeCC26X2Objects[CC1352R1_LAUNCHXL_ECJPAKECOUNT]; - -const ECJPAKECC26X2_HWAttrs ecjpakeCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECJPAKECOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECJPAKE_Config ECJPAKE_config[CC1352R1_LAUNCHXL_ECJPAKECOUNT] = { - { - .object = &ecjpakeCC26X2Objects[CC1352R1_LAUNCHXL_ECJPAKE0], - .hwAttrs = &ecjpakeCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECJPAKE0] - }, -}; - -const uint_least8_t ECJPAKE_count = CC1352R1_LAUNCHXL_ECJPAKECOUNT; - - -/* - * =============================== SHA2 =============================== - */ -#include -#include - -SHA2CC26X2_Object sha2CC26X2Objects[CC1352R1_LAUNCHXL_SHA2COUNT]; - -const SHA2CC26X2_HWAttrs sha2CC26X2HWAttrs[CC1352R1_LAUNCHXL_SHA2COUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const SHA2_Config SHA2_config[CC1352R1_LAUNCHXL_SHA2COUNT] = { - { - .object = &sha2CC26X2Objects[CC1352R1_LAUNCHXL_SHA20], - .hwAttrs = &sha2CC26X2HWAttrs[CC1352R1_LAUNCHXL_SHA20] - }, -}; - -const uint_least8_t SHA2_count = CC1352R1_LAUNCHXL_SHA2COUNT; - -/* - * =============================== AESCCM =============================== - */ -#include -#include - -AESCCMCC26XX_Object aesccmCC26XXObjects[CC1352R1_LAUNCHXL_AESCCMCOUNT]; - -const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESCCMCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESCCM_Config AESCCM_config[CC1352R1_LAUNCHXL_AESCCMCOUNT] = { - { - .object = &aesccmCC26XXObjects[CC1352R1_LAUNCHXL_AESCCM0], - .hwAttrs = &aesccmCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESCCM0] - }, -}; - -const uint_least8_t AESCCM_count = CC1352R1_LAUNCHXL_AESCCMCOUNT; - -/* - * =============================== AESECB =============================== - */ -#include -#include - -AESECBCC26XX_Object aesecbCC26XXObjects[CC1352R1_LAUNCHXL_AESECBCOUNT]; - -const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESECBCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESECB_Config AESECB_config[CC1352R1_LAUNCHXL_AESECBCOUNT] = { - { - .object = &aesecbCC26XXObjects[CC1352R1_LAUNCHXL_AESECB0], - .hwAttrs = &aesecbCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESECB0] - }, -}; - -const uint_least8_t AESECB_count = CC1352R1_LAUNCHXL_AESECBCOUNT; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1352R1_LAUNCHXL.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1352R1_LAUNCHXL_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1352R1_LAUNCHXL_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG, - - /* SD CS */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1352R1_LAUNCH.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC1352R1_LAUNCHXL_SPI_MASTER_READY */ - NULL, /* CC1352R1_LAUNCHXL_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC1352R1_LAUNCHXL_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352R1_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC1352R1_LAUNCHXL_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352R1_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC1352R1_LAUNCHXL_I2C0_SDA0, - .sclPin = CC1352R1_LAUNCHXL_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC1352R1_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC1352R1_LAUNCHXL_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC1352R1_LAUNCHXL_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC1352R1_LAUNCHXL_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x48000 -#define SECTORSIZE 0x2000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS External Regions */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS External Regions */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC1352R1_LAUNCHXL_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC1352R1_LAUNCHXL_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC1352R1_LAUNCHXL_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC1352R1_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1352R1_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1352R1_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1352R1_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1352R1_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1352R1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */ - CC1352R1_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC1352R1_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC1352R1_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC1352R1_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - CC1352R1_LAUNCHXL_DIO30_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* RF SW Switch defaults to 2.4GHz path */ - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26X2_Config PowerCC26X2_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWMCOUNT] = { - { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER0A }, - { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER0B }, - { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER1A }, - { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER1B }, - { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER2A }, - { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER2B }, - { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER3A }, - { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC1352R1_LAUNCHXL_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM7] }, -}; - -const uint_least8_t PWM_count = CC1352R1_LAUNCHXL_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -/* - * Board-specific callback function to set the correct antenna path. - * - * This function is called by the RF driver on global driver events. - * It contains a default implementation to set the correct antenna path. - * This function is defined in the file CC1352R1_LAUNCHXL_fxns.c - */ -extern void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg); - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - - /* Register the board specific callback */ - .globalCallback = &rfDriverCallback, - - /* Subscribe the callback to both events */ - .globalEventMask = RF_GlobalEventRadioSetup | RF_GlobalEventRadioPowerDown -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC1352R1_LAUNCHXL_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC1352R1_LAUNCHXL_SDCOUNT] = { - { - .spiIndex = CC1352R1_LAUNCHXL_SPI0, - .spiCsGpioIndex = CC1352R1_LAUNCHXL_SDSPI_CS - } -}; - -const SD_Config SD_config[CC1352R1_LAUNCHXL_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC1352R1_LAUNCHXL_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC1352R1_LAUNCHXL_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC1352R1_LAUNCHXL_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1352R1_LAUNCHXL_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1352R1_LAUNCHXL_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X2_Object trngCC26X2Object[CC1352R1_LAUNCHXL_TRNGCOUNT]; - -const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC1352R1_LAUNCHXL_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC1352R1_LAUNCHXL_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC1352R1_LAUNCHXL_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC1352R1_LAUNCHXL_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352R1_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1352R1_LAUNCHXL_UART0_TX, - .rxPin = CC1352R1_LAUNCHXL_UART0_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1352R1_LAUNCHXL_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352R1_LAUNCHXL_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -#if TI_UART_CONF_UART1_ENABLE - { - .baseAddr = UART1_BASE, - .powerMngrId = PowerCC26X2_PERIPH_UART1, - .intNum = INT_UART1_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1352R1_LAUNCHXL_UART1_TX, - .rxPin = CC1352R1_LAUNCHXL_UART1_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1352R1_LAUNCHXL_UART1], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352R1_LAUNCHXL_UART1]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC1352R1_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1352R1_LAUNCHXL_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC1352R1_LAUNCHXL_UART0] - }, -#endif -#if TI_UART_CONF_UART1_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1352R1_LAUNCHXL_UART1], - .hwAttrs = &uartCC26XXHWAttrs[CC1352R1_LAUNCHXL_UART1] - }, -#endif -}; - -const uint_least8_t UART_count = CC1352R1_LAUNCHXL_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC1352R1_LAUNCHXL_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC1352R1_LAUNCHXL_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC1352R1_LAUNCHXL_UDMACOUNT] = { - { - .object = &udmaObjects[CC1352R1_LAUNCHXL_UDMA0], - .hwAttrs = &udmaHWAttrs[CC1352R1_LAUNCHXL_UDMA0] - }, -}; - - - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC1352R1_LAUNCHXL_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1352R1_LAUNCHXL_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC1352R1_LAUNCHXL_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC1352R1_LAUNCHXL_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC1352R1_LAUNCHXL_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC1352R1_LAUNCHXL_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC1352R1_LAUNCHXL_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC1352R1_LAUNCHXL_initGeneral ======== - */ -void CC1352R1_LAUNCHXL_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.h deleted file mode 100644 index b6362cf9f..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL.h +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (c) 2017-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** =========================================================================== - * @file CC1352R1_LAUNCHXL.h - * - * @brief CC1352R1_LAUNCHXL Board Specific header file. - * - * The CC1352R1_LAUNCHXL header file should be included in an application as - * follows: - * @code - * #include "CC1352R1_LAUNCHXL.h" - * @endcode - * - * =========================================================================== - */ -#ifndef __CC1352R1_LAUNCHXL_BOARD_H__ -#define __CC1352R1_LAUNCHXL_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC1352R1_LAUNCHXL - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Mapping of pins to board signals using general board aliases - * - */ -/* Analog Capable DIOs */ -#define CC1352R1_LAUNCHXL_DIO23_ANALOG IOID_23 -#define CC1352R1_LAUNCHXL_DIO24_ANALOG IOID_24 -#define CC1352R1_LAUNCHXL_DIO25_ANALOG IOID_25 -#define CC1352R1_LAUNCHXL_DIO26_ANALOG IOID_26 -#define CC1352R1_LAUNCHXL_DIO27_ANALOG IOID_27 -#define CC1352R1_LAUNCHXL_DIO28_ANALOG IOID_28 -#define CC1352R1_LAUNCHXL_DIO29_ANALOG IOID_29 - -/* Antenna switch */ -#define CC1352R1_LAUNCHXL_DIO30_RF_SUB1GHZ IOID_30 - -/* Digital IOs */ -#define CC1352R1_LAUNCHXL_DIO12 IOID_12 -#define CC1352R1_LAUNCHXL_DIO15 IOID_15 -#define CC1352R1_LAUNCHXL_DIO16_TDO IOID_16 -#define CC1352R1_LAUNCHXL_DIO17_TDI IOID_17 -#define CC1352R1_LAUNCHXL_DIO21 IOID_21 -#define CC1352R1_LAUNCHXL_DIO22 IOID_22 - -/* Discrete Inputs */ -#define CC1352R1_LAUNCHXL_PIN_BTN1 IOID_15 -#define CC1352R1_LAUNCHXL_PIN_BTN2 IOID_14 - -/* GPIO */ -#define CC1352R1_LAUNCHXL_GPIO_LED_ON 1 -#define CC1352R1_LAUNCHXL_GPIO_LED_OFF 0 - -/* I2C */ -#define CC1352R1_LAUNCHXL_I2C0_SCL0 IOID_4 -#define CC1352R1_LAUNCHXL_I2C0_SDA0 IOID_5 - - -/* LEDs */ -#define CC1352R1_LAUNCHXL_PIN_LED_ON 1 -#define CC1352R1_LAUNCHXL_PIN_LED_OFF 0 -#define CC1352R1_LAUNCHXL_PIN_RLED IOID_6 -#define CC1352R1_LAUNCHXL_PIN_GLED IOID_7 - -/* PWM Outputs */ -#define CC1352R1_LAUNCHXL_PWMPIN0 CC1352R1_LAUNCHXL_PIN_RLED -#define CC1352R1_LAUNCHXL_PWMPIN1 CC1352R1_LAUNCHXL_PIN_GLED -#define CC1352R1_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED - -/* SPI */ -#define CC1352R1_LAUNCHXL_SPI_FLASH_CS IOID_20 -#define CC1352R1_LAUNCHXL_FLASH_CS_ON 0 -#define CC1352R1_LAUNCHXL_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC1352R1_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */ -#define CC1352R1_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */ -#define CC1352R1_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */ -#define CC1352R1_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC1352R1_LAUNCHXL_UART0_RX IOID_12 /* RXD */ -#define CC1352R1_LAUNCHXL_UART0_TX IOID_13 /* TXD */ -#define CC1352R1_LAUNCHXL_UART0_CTS IOID_19 /* CTS */ -#define CC1352R1_LAUNCHXL_UART0_RTS IOID_18 /* RTS */ -#define CC1352R1_LAUNCHXL_UART1_RX PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_UART1_TX PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_UART1_CTS PIN_UNASSIGNED -#define CC1352R1_LAUNCHXL_UART1_RTS PIN_UNASSIGNED -/* For backward compatibility */ -#define CC1352R1_LAUNCHXL_UART_RX CC1352R1_LAUNCHXL_UART0_RX -#define CC1352R1_LAUNCHXL_UART_TX CC1352R1_LAUNCHXL_UART0_TX -#define CC1352R1_LAUNCHXL_UART_CTS CC1352R1_LAUNCHXL_UART0_CTS -#define CC1352R1_LAUNCHXL_UART_RTS CC1352R1_LAUNCHXL_UART0_RTS - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC1352R1_LAUNCHXL_initGeneral(void); - -/*! - * @brief Shut down the external flash present on the board files - * - * This function bitbangs the SPI sequence necessary to turn off - * the external flash on LaunchPads. - */ -void CC1352R1_LAUNCHXL_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC1352R1_LAUNCHXL_wakeUpExtFlash(void); - -/*! - * @def CC1352R1_LAUNCHXL_ADCBufName - * @brief Enum of ADCs - */ -typedef enum CC1352R1_LAUNCHXL_ADCBufName { - CC1352R1_LAUNCHXL_ADCBUF0 = 0, - - CC1352R1_LAUNCHXL_ADCBUFCOUNT -} CC1352R1_LAUNCHXL_ADCBufName; - -/*! - * @def CC1352R1_LAUNCHXL_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC1352R1_LAUNCHXL_ADCBuf0ChannelName { - CC1352R1_LAUNCHXL_ADCBUF0CHANNEL0 = 0, - CC1352R1_LAUNCHXL_ADCBUF0CHANNEL1, - CC1352R1_LAUNCHXL_ADCBUF0CHANNEL2, - CC1352R1_LAUNCHXL_ADCBUF0CHANNEL3, - CC1352R1_LAUNCHXL_ADCBUF0CHANNEL4, - CC1352R1_LAUNCHXL_ADCBUF0CHANNEL5, - CC1352R1_LAUNCHXL_ADCBUF0CHANNEL6, - CC1352R1_LAUNCHXL_ADCBUF0CHANNELVDDS, - CC1352R1_LAUNCHXL_ADCBUF0CHANNELDCOUPL, - CC1352R1_LAUNCHXL_ADCBUF0CHANNELVSS, - - CC1352R1_LAUNCHXL_ADCBUF0CHANNELCOUNT -} CC1352R1_LAUNCHXL_ADCBuf0ChannelName; - -/*! - * @def CC1352R1_LAUNCHXL_ADCName - * @brief Enum of ADCs - */ -typedef enum CC1352R1_LAUNCHXL_ADCName { - CC1352R1_LAUNCHXL_ADC0 = 0, - CC1352R1_LAUNCHXL_ADC1, - CC1352R1_LAUNCHXL_ADC2, - CC1352R1_LAUNCHXL_ADC3, - CC1352R1_LAUNCHXL_ADC4, - CC1352R1_LAUNCHXL_ADC5, - CC1352R1_LAUNCHXL_ADC6, - CC1352R1_LAUNCHXL_ADCDCOUPL, - CC1352R1_LAUNCHXL_ADCVSS, - CC1352R1_LAUNCHXL_ADCVDDS, - - CC1352R1_LAUNCHXL_ADCCOUNT -} CC1352R1_LAUNCHXL_ADCName; - -/*! - * @def CC1352R1_LAUNCHXL_ECDHName - * @brief Enum of ECDH names - */ -typedef enum CC1352R1_LAUNCHXL_ECDHName { - CC1352R1_LAUNCHXL_ECDH0 = 0, - - CC1352R1_LAUNCHXL_ECDHCOUNT -} CC1352R1_LAUNCHXL_ECDHName; - -/*! - * @def CC1352R1_LAUNCHXL_ECDSAName - * @brief Enum of ECDSA names - */ -typedef enum CC1352R1_LAUNCHXL_ECDSAName { - CC1352R1_LAUNCHXL_ECDSA0 = 0, - - CC1352R1_LAUNCHXL_ECDSACOUNT -} CC1352R1_LAUNCHXL_ECDSAName; - -/*! - * @def CC1352R1_LAUNCHXL_ECJPAKEName - * @brief Enum of ECJPAKE names - */ -typedef enum CC1352R1_LAUNCHXL_ECJPAKEName { - CC1352R1_LAUNCHXL_ECJPAKE0 = 0, - - CC1352R1_LAUNCHXL_ECJPAKECOUNT -} CC1352R1_LAUNCHXL_ECJPAKEName; - -/*! - * @def CC1352R1_LAUNCHXL_AESCCMName - * @brief Enum of AESCCM names - */ -typedef enum CC1352R1_LAUNCHXL_AESCCMName { - CC1352R1_LAUNCHXL_AESCCM0 = 0, - - CC1352R1_LAUNCHXL_AESCCMCOUNT -} CC1352R1_LAUNCHXL_AESCCMName; - -/*! - * @def CC1352R1_LAUNCHXL_AESECBName - * @brief Enum of AESECB names - */ -typedef enum CC1352R1_LAUNCHXL_AESECBName { - CC1352R1_LAUNCHXL_AESECB0 = 0, - - CC1352R1_LAUNCHXL_AESECBCOUNT -} CC1352R1_LAUNCHXL_AESECBName; - -/*! - * @def CC1352R1_LAUNCHXL_SHA2Name - * @brief Enum of SHA2 names - */ -typedef enum CC1352R1_LAUNCHXL_SHA2Name { - CC1352R1_LAUNCHXL_SHA20 = 0, - - CC1352R1_LAUNCHXL_SHA2COUNT -} CC1352R1_LAUNCHXL_SHA2Name; - -/*! - * @def CC1352R1_LAUNCHXL_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC1352R1_LAUNCHXL_GPIOName { - CC1352R1_LAUNCHXL_GPIO_S1 = 0, - CC1352R1_LAUNCHXL_GPIO_S2, - CC1352R1_LAUNCHXL_SPI_MASTER_READY, - CC1352R1_LAUNCHXL_SPI_SLAVE_READY, - CC1352R1_LAUNCHXL_GPIO_LED_GREEN, - CC1352R1_LAUNCHXL_GPIO_LED_RED, - CC1352R1_LAUNCHXL_GPIO_SPI_FLASH_CS, - CC1352R1_LAUNCHXL_SDSPI_CS, - CC1352R1_LAUNCHXL_GPIOCOUNT -} CC1352R1_LAUNCHXL_GPIOName; - -/*! - * @def CC1352R1_LAUNCHXL_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC1352R1_LAUNCHXL_GPTimerName { - CC1352R1_LAUNCHXL_GPTIMER0A = 0, - CC1352R1_LAUNCHXL_GPTIMER0B, - CC1352R1_LAUNCHXL_GPTIMER1A, - CC1352R1_LAUNCHXL_GPTIMER1B, - CC1352R1_LAUNCHXL_GPTIMER2A, - CC1352R1_LAUNCHXL_GPTIMER2B, - CC1352R1_LAUNCHXL_GPTIMER3A, - CC1352R1_LAUNCHXL_GPTIMER3B, - - CC1352R1_LAUNCHXL_GPTIMERPARTSCOUNT -} CC1352R1_LAUNCHXL_GPTimerName; - -/*! - * @def CC1352R1_LAUNCHXL_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC1352R1_LAUNCHXL_GPTimers { - CC1352R1_LAUNCHXL_GPTIMER0 = 0, - CC1352R1_LAUNCHXL_GPTIMER1, - CC1352R1_LAUNCHXL_GPTIMER2, - CC1352R1_LAUNCHXL_GPTIMER3, - - CC1352R1_LAUNCHXL_GPTIMERCOUNT -} CC1352R1_LAUNCHXL_GPTimers; - -/*! - * @def CC1352R1_LAUNCHXL_I2CName - * @brief Enum of I2C names - */ -typedef enum CC1352R1_LAUNCHXL_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC1352R1_LAUNCHXL_I2C0 = 0, -#endif - - CC1352R1_LAUNCHXL_I2CCOUNT -} CC1352R1_LAUNCHXL_I2CName; - -/*! - * @def CC1352R1_LAUNCHXL_NVSName - * @brief Enum of NVS names - */ -typedef enum CC1352R1_LAUNCHXL_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC1352R1_LAUNCHXL_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC1352R1_LAUNCHXL_NVSSPI25X0, -#endif - - CC1352R1_LAUNCHXL_NVSCOUNT -} CC1352R1_LAUNCHXL_NVSName; - -/*! - * @def CC1352R1_LAUNCHXL_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC1352R1_LAUNCHXL_PWMName { - CC1352R1_LAUNCHXL_PWM0 = 0, - CC1352R1_LAUNCHXL_PWM1, - CC1352R1_LAUNCHXL_PWM2, - CC1352R1_LAUNCHXL_PWM3, - CC1352R1_LAUNCHXL_PWM4, - CC1352R1_LAUNCHXL_PWM5, - CC1352R1_LAUNCHXL_PWM6, - CC1352R1_LAUNCHXL_PWM7, - - CC1352R1_LAUNCHXL_PWMCOUNT -} CC1352R1_LAUNCHXL_PWMName; - -/*! - * @def CC1352R1_LAUNCHXL_SDName - * @brief Enum of SD names - */ -typedef enum CC1352R1_LAUNCHXL_SDName { - CC1352R1_LAUNCHXL_SDSPI0 = 0, - - CC1352R1_LAUNCHXL_SDCOUNT -} CC1352R1_LAUNCHXL_SDName; - -/*! - * @def CC1352R1_LAUNCHXL_SPIName - * @brief Enum of SPI names - */ -typedef enum CC1352R1_LAUNCHXL_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC1352R1_LAUNCHXL_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC1352R1_LAUNCHXL_SPI1, -#endif - - CC1352R1_LAUNCHXL_SPICOUNT -} CC1352R1_LAUNCHXL_SPIName; - -/*! - * @def CC1352R1_LAUNCHXL_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC1352R1_LAUNCHXL_TRNGName { - CC1352R1_LAUNCHXL_TRNG0 = 0, - - CC1352R1_LAUNCHXL_TRNGCOUNT -} CC1352R1_LAUNCHXL_TRNGName; - -/*! - * @def CC1352R1_LAUNCHXL_UARTName - * @brief Enum of UARTs - */ -typedef enum CC1352R1_LAUNCHXL_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC1352R1_LAUNCHXL_UART0 = 0, -#endif -#if TI_UART_CONF_UART1_ENABLE - CC1352R1_LAUNCHXL_UART1, -#endif - - CC1352R1_LAUNCHXL_UARTCOUNT -} CC1352R1_LAUNCHXL_UARTName; - -/*! - * @def CC1352R1_LAUNCHXL_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC1352R1_LAUNCHXL_UDMAName { - CC1352R1_LAUNCHXL_UDMA0 = 0, - - CC1352R1_LAUNCHXL_UDMACOUNT -} CC1352R1_LAUNCHXL_UDMAName; - -/*! - * @def CC1352R1_LAUNCHXL_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC1352R1_LAUNCHXL_WatchdogName { - CC1352R1_LAUNCHXL_WATCHDOG0 = 0, - - CC1352R1_LAUNCHXL_WATCHDOGCOUNT -} CC1352R1_LAUNCHXL_WatchdogName; - - -#ifdef __cplusplus -} -#endif - -#endif /* __CC1352R1_LAUNCHXL_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL_fxns.c deleted file mode 100644 index 79d97d7b6..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/CC1352R1_LAUNCHXL_fxns.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ======== CC1352R1_LAUNCHXL_fxns.c ======== - * This file contains the board-specific initialization functions, and - * RF callback function for antenna switching. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) -#include -#include - -#include "Board.h" - -/* - * ======== CC1352R1_LAUNCHXL_sendExtFlashByte ======== - */ -void CC1352R1_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC1352R1_LAUNCHXL_wakeUpExtFlash ======== - */ -void CC1352R1_LAUNCHXL_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC1352R1_LAUNCHXL_shutDownExtFlash ======== - */ -void CC1352R1_LAUNCHXL_shutDownExtFlash(void) -{ - /* - * To be sure we are putting the flash into sleep and not waking it, - * we first have to make a wake up call - */ - CC1352R1_LAUNCHXL_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC1352R1_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC1352R1_LAUNCHXL_shutDownExtFlash(); -} - -/* - * For the SysConfig generated Board.h file, Board_RF_SUB1GHZ will not be - * defined unless the RF module is added to the configuration. Therefore, - * we don't include this code if Board_RF_SUB1GHZ is not defined. - */ -#if defined(Board_RF_SUB1GHZ) - -/* - * Mask to be used to determine the effective value of the setup command's - * loDivider field. - */ -#define LODIVIDER_MASK 0x7F - -/* - * ======== rfDriverCallback ======== - * This is an implementation for the CC1352R launchpad which uses a - * single signal for antenna switching. - */ -void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg) -{ - /* Decode input arguments. */ - (void)client; - RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg; - - /* Local variable. */ - bool sub1GHz = false; - uint8_t loDivider = 0; - - if (events & RF_GlobalEventRadioSetup) { - /* Decision about the frequency band shall be made based on the - loDivider field. */ - switch (setupCommand->common.commandNo) { - case (CMD_RADIO_SETUP): - case (CMD_BLE5_RADIO_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->common.loDivider; - - /* Sub-1GHz front-end. */ - if (loDivider != 0) { - sub1GHz = true; - } - break; - case (CMD_PROP_RADIO_DIV_SETUP): - loDivider = LODIVIDER_MASK & setupCommand->prop_div.loDivider; - - /* Sub-1GHz front-end. */ - if (loDivider != 0) { - sub1GHz = true; - } - break; - default:break; - } - - /* Select the correct antenna. */ - if (sub1GHz) { - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 1); - } - else { - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0); - } - } - else if (events & RF_GlobalEventRadioPowerDown) { - /* Set the antenna to 2.4 GHz as default. */ - PINCC26XX_setOutputValue(Board_RF_SUB1GHZ, 0); - } -} -#endif diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/Makefile.cc1352r1 b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/Makefile.cc1352r1 deleted file mode 100644 index acc892e33..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/Makefile.cc1352r1 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x2-cc26x2 -DEVICE_FAMILY = CC13X2 -DEVICE_LINE = CC13XX -DEVICE = CC1352R - -BOARD_SOURCEFILES += CC1352R1_LAUNCHXL.c CC1352R1_LAUNCHXL_fxns.c - -SUPPORTS_PROP_MODE = 1 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 0 - -# Include the common board makefile -include $(FAMILY_PATH)/launchpad/Makefile.launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/rf-conf.h deleted file mode 100644 index ba652cd53..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352r1/rf-conf.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for both the Sub-1 GHz - * path and the 2.4 GHz path on the radio. - * - * These are the following front-end mode configurations for the - * CC1352R1-LAUNCHXL board: - * - Sub-1 GHz: differential and external bias - * - 2.4 GHz: differential and external bias - * - * @{ - */ -#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL - -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/Board.h deleted file mode 100644 index 577ce0422..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/Board.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC2650_LAUNCHXL.h" - -#define Board_CC2650_LAUNCHXL -#define BOARD_STRING "TI CC2650 LaunchPad" - -#define Board_initGeneral() CC2650_LAUNCHXL_initGeneral() -#define Board_shutDownExtFlash() CC2650_LAUNCHXL_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC2650_LAUNCHXL_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADC0 CC2650_LAUNCHXL_ADC0 -#define Board_ADC1 CC2650_LAUNCHXL_ADC1 - -#define Board_ADCBUF0 CC2650_LAUNCHXL_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC2650_LAUNCHXL_ADCBUF0CHANNEL0 -#define Board_ADCBUF0CHANNEL1 CC2650_LAUNCHXL_ADCBUF0CHANNEL1 - -#define Board_CRYPTO0 CC2650_LAUNCHXL_CRYPTO0 - -#define Board_DIO0 CC2650_LAUNCHXL_DIO0 -#define Board_DIO1_RFSW CC2650_LAUNCHXL_DIO1_RFSW -#define Board_DIO12 CC2650_LAUNCHXL_DIO12 -#define Board_DIO15 CC2650_LAUNCHXL_DIO15 -#define Board_DIO16_TDO CC2650_LAUNCHXL_DIO16_TDO -#define Board_DIO17_TDI CC2650_LAUNCHXL_DIO17_TDI -#define Board_DIO21 CC2650_LAUNCHXL_DIO21 -#define Board_DIO22 CC2650_LAUNCHXL_DIO22 - -#define Board_DIO23_ANALOG CC2650_LAUNCHXL_DIO23_ANALOG -#define Board_DIO24_ANALOG CC2650_LAUNCHXL_DIO24_ANALOG -#define Board_DIO25_ANALOG CC2650_LAUNCHXL_DIO25_ANALOG -#define Board_DIO26_ANALOG CC2650_LAUNCHXL_DIO26_ANALOG -#define Board_DIO27_ANALOG CC2650_LAUNCHXL_DIO27_ANALOG -#define Board_DIO28_ANALOG CC2650_LAUNCHXL_DIO28_ANALOG -#define Board_DIO29_ANALOG CC2650_LAUNCHXL_DIO29_ANALOG -#define Board_DIO30_ANALOG CC2650_LAUNCHXL_DIO30_ANALOG - -#define Board_GPIO_BUTTON0 CC2650_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BUTTON1 CC2650_LAUNCHXL_GPIO_S2 -#define Board_GPIO_BTN1 CC2650_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BTN2 CC2650_LAUNCHXL_GPIO_S2 -#define Board_GPIO_LED0 CC2650_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_LED1 CC2650_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_RLED CC2650_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_GLED CC2650_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED_ON CC2650_LAUNCHXL_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC2650_LAUNCHXL_GPIO_LED_OFF - -#define Board_GPTIMER0A CC2650_LAUNCHXL_GPTIMER0A -#define Board_GPTIMER0B CC2650_LAUNCHXL_GPTIMER0B -#define Board_GPTIMER1A CC2650_LAUNCHXL_GPTIMER1A -#define Board_GPTIMER1B CC2650_LAUNCHXL_GPTIMER1B -#define Board_GPTIMER2A CC2650_LAUNCHXL_GPTIMER2A -#define Board_GPTIMER2B CC2650_LAUNCHXL_GPTIMER2B -#define Board_GPTIMER3A CC2650_LAUNCHXL_GPTIMER3A -#define Board_GPTIMER3B CC2650_LAUNCHXL_GPTIMER3B - -#define Board_I2C0 CC2650_LAUNCHXL_I2C0 -#define Board_I2C_TMP CC2650_LAUNCHXL_I2C0 - -#define Board_NVSINTERNAL CC2650_LAUNCHXL_NVSCC26XX0 -#define Board_NVSEXTERNAL CC2650_LAUNCHXL_NVSSPI25X0 - -#define Board_PIN_BUTTON0 CC2650_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BUTTON1 CC2650_LAUNCHXL_PIN_BTN2 -#define Board_PIN_BTN1 CC2650_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BTN2 CC2650_LAUNCHXL_PIN_BTN2 -#define Board_PIN_LED0 CC2650_LAUNCHXL_PIN_RLED -#define Board_PIN_LED1 CC2650_LAUNCHXL_PIN_GLED -#define Board_PIN_LED2 CC2650_LAUNCHXL_PIN_RLED -#define Board_PIN_RLED CC2650_LAUNCHXL_PIN_RLED -#define Board_PIN_GLED CC2650_LAUNCHXL_PIN_GLED - -#define Board_PWM0 CC2650_LAUNCHXL_PWM0 -#define Board_PWM1 CC2650_LAUNCHXL_PWM1 -#define Board_PWM2 CC2650_LAUNCHXL_PWM2 -#define Board_PWM3 CC2650_LAUNCHXL_PWM3 -#define Board_PWM4 CC2650_LAUNCHXL_PWM4 -#define Board_PWM5 CC2650_LAUNCHXL_PWM5 -#define Board_PWM6 CC2650_LAUNCHXL_PWM6 -#define Board_PWM7 CC2650_LAUNCHXL_PWM7 - -#define Board_SD0 CC2650_LAUNCHXL_SDSPI0 - -#define Board_SPI0 CC2650_LAUNCHXL_SPI0 -#define Board_SPI0_MISO CC2650_LAUNCHXL_SPI0_MISO -#define Board_SPI0_MOSI CC2650_LAUNCHXL_SPI0_MOSI -#define Board_SPI0_CLK CC2650_LAUNCHXL_SPI0_CLK -#define Board_SPI0_CSN CC2650_LAUNCHXL_SPI0_CSN -#define Board_SPI1 CC2650_LAUNCHXL_SPI1 -#define Board_SPI1_MISO CC2650_LAUNCHXL_SPI1_MISO -#define Board_SPI1_MOSI CC2650_LAUNCHXL_SPI1_MOSI -#define Board_SPI1_CLK CC2650_LAUNCHXL_SPI1_CLK -#define Board_SPI1_CSN CC2650_LAUNCHXL_SPI1_CSN -#define Board_SPI_FLASH_CS CC2650_LAUNCHXL_SPI_FLASH_CS -#define Board_FLASH_CS_ON 0 -#define Board_FLASH_CS_OFF 1 - -#define Board_SPI_MASTER CC2650_LAUNCHXL_SPI0 -#define Board_SPI_SLAVE CC2650_LAUNCHXL_SPI0 -#define Board_SPI_MASTER_READY CC2650_LAUNCHXL_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC2650_LAUNCHXL_SPI_SLAVE_READY - -#define Board_UART0 CC2650_LAUNCHXL_UART0 - -#define Board_WATCHDOG0 CC2650_LAUNCHXL_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_TMP_ADDR (0x40) -#define Board_SENSORS_BP_TMP_ADDR Board_TMP_ADDR - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.c deleted file mode 100644 index 02fd96471..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.c +++ /dev/null @@ -1,821 +0,0 @@ -/* - * Copyright (c) 2016-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC2650_LAUNCHXL.c =================================== - * This file is responsible for setting up the board specific items for the - * CC2650_LAUNCHXL board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC2650_LAUNCHXL.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26XX_Object adcBufCC26xxObjects[CC2650_LAUNCHXL_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[CC2650_LAUNCHXL_ADCBUF0CHANNELCOUNT] = { - {CC2650_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7}, - {CC2650_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6}, - {CC2650_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5}, - {CC2650_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4}, - {CC2650_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3}, - {CC2650_LAUNCHXL_DIO28_ANALOG, ADC_COMPB_IN_AUXIO2}, - {CC2650_LAUNCHXL_DIO29_ANALOG, ADC_COMPB_IN_AUXIO1}, - {CC2650_LAUNCHXL_DIO30_ANALOG, ADC_COMPB_IN_AUXIO0}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, -}; - -const ADCBufCC26XX_HWAttrs adcBufCC26xxHWAttrs[CC2650_LAUNCHXL_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26XX_adcChannelLut, - .gpTimerUnit = CC2650_LAUNCHXL_GPTIMER0A, - .gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC2650_LAUNCHXL_ADCBUFCOUNT] = { - { - &ADCBufCC26XX_fxnTable, - &adcBufCC26xxObjects[CC2650_LAUNCHXL_ADCBUF0], - &adcBufCC26xxHWAttrs[CC2650_LAUNCHXL_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC2650_LAUNCHXL_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC2650_LAUNCHXL_ADCCOUNT]; - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADCCOUNT] = { - { - .adcDIO = CC2650_LAUNCHXL_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC2650_LAUNCHXL_DIO24_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO6, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC2650_LAUNCHXL_DIO25_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO5, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC2650_LAUNCHXL_DIO26_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO4, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC2650_LAUNCHXL_DIO27_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO3, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC2650_LAUNCHXL_DIO28_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO2, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC2650_LAUNCHXL_DIO29_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO1, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC2650_LAUNCHXL_DIO30_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO0, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_10P9_MS, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC2650_LAUNCHXL_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADC0]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADC1]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADC2]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADC3]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADC4]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADC5], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADC5]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADC6], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADC6]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADC7], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADC7]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC2650_LAUNCHXL_ADCCOUNT; - -/* - * =============================== Crypto =============================== - */ -#include - -CryptoCC26XX_Object cryptoCC26XXObjects[CC2650_LAUNCHXL_CRYPTOCOUNT]; - -const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC2650_LAUNCHXL_CRYPTOCOUNT] = { - { - .baseAddr = CRYPTO_BASE, - .powerMngrId = PowerCC26XX_PERIPH_CRYPTO, - .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ, - .intPriority = ~0, - } -}; - -const CryptoCC26XX_Config CryptoCC26XX_config[CC2650_LAUNCHXL_CRYPTOCOUNT] = { - { - .object = &cryptoCC26XXObjects[CC2650_LAUNCHXL_CRYPTO0], - .hwAttrs = &cryptoCC26XXHWAttrs[CC2650_LAUNCHXL_CRYPTO0] - }, -}; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC2650_LAUNCHXL.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_13 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC2650_LAUNCHXL_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC2650_LAUNCHXL_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG, - - /* SD CS */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC2650_LAUNCH.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC2650_LAUNCHXL_SPI_MASTER_READY */ - NULL, /* CC2650_LAUNCHXL_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC2650_LAUNCHXL_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC2650_LAUNCHXL_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC2650_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2650_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC2650_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650_LAUNCHXL_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC2650_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650_LAUNCHXL_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC2650_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650_LAUNCHXL_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC2650_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650_LAUNCHXL_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC2650_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650_LAUNCHXL_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC2650_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650_LAUNCHXL_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC2650_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650_LAUNCHXL_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC2650_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650_LAUNCHXL_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC2650_LAUNCHXL_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC2650_LAUNCHXL_I2C0_SDA0, - .sclPin = CC2650_LAUNCHXL_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC2650_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC2650_LAUNCHXL_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC2650_LAUNCHXL_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC2650_LAUNCHXL_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x1A000 -#define SECTORSIZE 0x1000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS External Regions */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS External Regions */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC2650_LAUNCHXL_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC2650_LAUNCHXL_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC2650_LAUNCHXL_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC2650_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC2650_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC2650_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC2650_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC2650_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC2650_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */ - CC2650_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC2650_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC2650_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC2650_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26XX_Config PowerCC26XX_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC2650_LAUNCHXL_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC2650_LAUNCHXL_PWMCOUNT] = { - { .pwmPin = CC2650_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC2650_LAUNCHXL_GPTIMER0A }, - { .pwmPin = CC2650_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC2650_LAUNCHXL_GPTIMER0B }, - { .pwmPin = CC2650_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC2650_LAUNCHXL_GPTIMER1A }, - { .pwmPin = CC2650_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC2650_LAUNCHXL_GPTIMER1B }, - { .pwmPin = CC2650_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC2650_LAUNCHXL_GPTIMER2A }, - { .pwmPin = CC2650_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC2650_LAUNCHXL_GPTIMER2B }, - { .pwmPin = CC2650_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC2650_LAUNCHXL_GPTIMER3A }, - { .pwmPin = CC2650_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC2650_LAUNCHXL_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC2650_LAUNCHXL_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC2650_LAUNCHXL_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC2650_LAUNCHXL_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC2650_LAUNCHXL_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC2650_LAUNCHXL_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC2650_LAUNCHXL_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC2650_LAUNCHXL_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC2650_LAUNCHXL_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC2650_LAUNCHXL_PWM7] }, -}; - -const uint_least8_t PWM_count = CC2650_LAUNCHXL_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - .globalCallback = NULL, /* No board specific callback */ - .globalEventMask = 0 /* No events subscribed to */ -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC2650_LAUNCHXL_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC2650_LAUNCHXL_SDCOUNT] = { - { - .spiIndex = CC2650_LAUNCHXL_SPI0, - .spiCsGpioIndex = CC2650_LAUNCHXL_SDSPI_CS - } -}; - -const SD_Config SD_config[CC2650_LAUNCHXL_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC2650_LAUNCHXL_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC2650_LAUNCHXL_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC2650_LAUNCHXL_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650_LAUNCHXL_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650_LAUNCHXL_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X0_Object trngCC26X0Object[CC2650_LAUNCHXL_TRNGCOUNT]; - -const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC2650_LAUNCHXL_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC2650_LAUNCHXL_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC2650_LAUNCHXL_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC2650_LAUNCHXL_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC2650_LAUNCHXL_UART_TX, - .rxPin = CC2650_LAUNCHXL_UART_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC2650_LAUNCHXL_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC2650_LAUNCHXL_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC2650_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC2650_LAUNCHXL_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC2650_LAUNCHXL_UART0] - }, -#endif -}; - -const uint_least8_t UART_count = CC2650_LAUNCHXL_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC2650_LAUNCHXL_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC2650_LAUNCHXL_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC2650_LAUNCHXL_UDMACOUNT] = { - { - .object = &udmaObjects[CC2650_LAUNCHXL_UDMA0], - .hwAttrs = &udmaHWAttrs[CC2650_LAUNCHXL_UDMA0] - }, -}; - - - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC2650_LAUNCHXL_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC2650_LAUNCHXL_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC2650_LAUNCHXL_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC2650_LAUNCHXL_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC2650_LAUNCHXL_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC2650_LAUNCHXL_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC2650_LAUNCHXL_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC2650_LAUNCHXL_initGeneral ======== - */ -void CC2650_LAUNCHXL_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.h deleted file mode 100644 index 8c440aa9d..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL.h +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** ============================================================================ - * @file CC2650_LAUNCHXL.h - * - * @brief CC2650 LaunchPad Board Specific header file. - * - * The CC2650_LAUNCHXL header file should be included in an application as - * follows: - * @code - * #include "CC2650_LAUNCHXL.h" - * @endcode - * - * ============================================================================ - */ -#ifndef __CC2650_LAUNCHXL_BOARD_H__ -#define __CC2650_LAUNCHXL_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC2650_LAUNCHXL - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Analog Capable DIOs */ -#define CC2650_LAUNCHXL_DIO23_ANALOG IOID_23 -#define CC2650_LAUNCHXL_DIO24_ANALOG IOID_24 -#define CC2650_LAUNCHXL_DIO25_ANALOG IOID_25 -#define CC2650_LAUNCHXL_DIO26_ANALOG IOID_26 -#define CC2650_LAUNCHXL_DIO27_ANALOG IOID_27 -#define CC2650_LAUNCHXL_DIO28_ANALOG IOID_28 -#define CC2650_LAUNCHXL_DIO29_ANALOG IOID_29 -#define CC2650_LAUNCHXL_DIO30_ANALOG IOID_30 - -/* Digital IOs */ -#define CC2650_LAUNCHXL_DIO0 IOID_0 -#define CC2650_LAUNCHXL_DIO1_RFSW IOID_1 -#define CC2650_LAUNCHXL_DIO12 IOID_12 -#define CC2650_LAUNCHXL_DIO15 IOID_15 -#define CC2650_LAUNCHXL_DIO16_TDO IOID_16 -#define CC2650_LAUNCHXL_DIO17_TDI IOID_17 -#define CC2650_LAUNCHXL_DIO21 IOID_21 -#define CC2650_LAUNCHXL_DIO22 IOID_22 - -/* Discrete Inputs */ -#define CC2650_LAUNCHXL_PIN_BTN1 IOID_13 -#define CC2650_LAUNCHXL_PIN_BTN2 IOID_14 - -/* GPIO */ -#define CC2650_LAUNCHXL_GPIO_LED_ON 1 -#define CC2650_LAUNCHXL_GPIO_LED_OFF 0 - -/* I2C */ -#define CC2650_LAUNCHXL_I2C0_SCL0 IOID_4 -#define CC2650_LAUNCHXL_I2C0_SDA0 IOID_5 - -/* LEDs */ -#define CC2650_LAUNCHXL_PIN_LED_ON 1 -#define CC2650_LAUNCHXL_PIN_LED_OFF 0 -#define CC2650_LAUNCHXL_PIN_RLED IOID_6 -#define CC2650_LAUNCHXL_PIN_GLED IOID_7 - -/* PWM Outputs */ -#define CC2650_LAUNCHXL_PWMPIN0 CC2650_LAUNCHXL_PIN_RLED -#define CC2650_LAUNCHXL_PWMPIN1 CC2650_LAUNCHXL_PIN_GLED -#define CC2650_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED -#define CC2650_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED -#define CC2650_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED -#define CC2650_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED -#define CC2650_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED -#define CC2650_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED - -/* SPI */ -#define CC2650_LAUNCHXL_SPI_FLASH_CS IOID_20 -#define CC2650_LAUNCHXL_FLASH_CS_ON 0 -#define CC2650_LAUNCHXL_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC2650_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */ -#define CC2650_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */ -#define CC2650_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */ -#define CC2650_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED -#define CC2650_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED -#define CC2650_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED -#define CC2650_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED -#define CC2650_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC2650_LAUNCHXL_UART_RX IOID_2 /* RXD */ -#define CC2650_LAUNCHXL_UART_TX IOID_3 /* TXD */ -#define CC2650_LAUNCHXL_UART_CTS IOID_19 /* CTS */ -#define CC2650_LAUNCHXL_UART_RTS IOID_18 /* RTS */ - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC2650_LAUNCHXL_initGeneral(void); - -/*! - * @brief Turn off the external flash on LaunchPads - * - */ -void CC2650_LAUNCHXL_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC2650_LAUNCHXL_wakeUpExtFlash(void); - -/*! - * @def CC2650_LAUNCHXL_ADCBufName - * @brief Enum of ADCs - */ -typedef enum CC2650_LAUNCHXL_ADCBufName { - CC2650_LAUNCHXL_ADCBUF0 = 0, - - CC2650_LAUNCHXL_ADCBUFCOUNT -} CC2650_LAUNCHXL_ADCBufName; - -/*! - * @def CC2650_LAUNCHXL_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC2650_LAUNCHXL_ADCBuf0ChannelName { - CC2650_LAUNCHXL_ADCBUF0CHANNEL0 = 0, - CC2650_LAUNCHXL_ADCBUF0CHANNEL1, - CC2650_LAUNCHXL_ADCBUF0CHANNEL2, - CC2650_LAUNCHXL_ADCBUF0CHANNEL3, - CC2650_LAUNCHXL_ADCBUF0CHANNEL4, - CC2650_LAUNCHXL_ADCBUF0CHANNEL5, - CC2650_LAUNCHXL_ADCBUF0CHANNEL6, - CC2650_LAUNCHXL_ADCBUF0CHANNEL7, - CC2650_LAUNCHXL_ADCBUF0CHANNELVDDS, - CC2650_LAUNCHXL_ADCBUF0CHANNELDCOUPL, - CC2650_LAUNCHXL_ADCBUF0CHANNELVSS, - - CC2650_LAUNCHXL_ADCBUF0CHANNELCOUNT -} CC2650_LAUNCHXL_ADCBuf0ChannelName; - -/*! - * @def CC2650_LAUNCHXL_ADCName - * @brief Enum of ADCs - */ -typedef enum CC2650_LAUNCHXL_ADCName { - CC2650_LAUNCHXL_ADC0 = 0, - CC2650_LAUNCHXL_ADC1, - CC2650_LAUNCHXL_ADC2, - CC2650_LAUNCHXL_ADC3, - CC2650_LAUNCHXL_ADC4, - CC2650_LAUNCHXL_ADC5, - CC2650_LAUNCHXL_ADC6, - CC2650_LAUNCHXL_ADC7, - CC2650_LAUNCHXL_ADCDCOUPL, - CC2650_LAUNCHXL_ADCVSS, - CC2650_LAUNCHXL_ADCVDDS, - - CC2650_LAUNCHXL_ADCCOUNT -} CC2650_LAUNCHXL_ADCName; - -/*! - * @def CC2650_LAUNCHXL_CryptoName - * @brief Enum of Crypto names - */ -typedef enum CC2650_LAUNCHXL_CryptoName { - CC2650_LAUNCHXL_CRYPTO0 = 0, - - CC2650_LAUNCHXL_CRYPTOCOUNT -} CC2650_LAUNCHXL_CryptoName; - -/*! - * @def CC2650_LAUNCHXL_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC2650_LAUNCHXL_GPIOName { - CC2650_LAUNCHXL_GPIO_S1 = 0, - CC2650_LAUNCHXL_GPIO_S2, - CC2650_LAUNCHXL_SPI_MASTER_READY, - CC2650_LAUNCHXL_SPI_SLAVE_READY, - CC2650_LAUNCHXL_GPIO_LED_GREEN, - CC2650_LAUNCHXL_GPIO_LED_RED, - CC2650_LAUNCHXL_GPIO_SPI_FLASH_CS, - CC2650_LAUNCHXL_SDSPI_CS, - CC2650_LAUNCHXL_GPIOCOUNT -} CC2650_LAUNCHXL_GPIOName; - -/*! - * @def CC2650_LAUNCHXL_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC2650_LAUNCHXL_GPTimerName { - CC2650_LAUNCHXL_GPTIMER0A = 0, - CC2650_LAUNCHXL_GPTIMER0B, - CC2650_LAUNCHXL_GPTIMER1A, - CC2650_LAUNCHXL_GPTIMER1B, - CC2650_LAUNCHXL_GPTIMER2A, - CC2650_LAUNCHXL_GPTIMER2B, - CC2650_LAUNCHXL_GPTIMER3A, - CC2650_LAUNCHXL_GPTIMER3B, - - CC2650_LAUNCHXL_GPTIMERPARTSCOUNT -} CC2650_LAUNCHXL_GPTimerName; - -/*! - * @def CC2650_LAUNCHXL_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC2650_LAUNCHXL_GPTimers { - CC2650_LAUNCHXL_GPTIMER0 = 0, - CC2650_LAUNCHXL_GPTIMER1, - CC2650_LAUNCHXL_GPTIMER2, - CC2650_LAUNCHXL_GPTIMER3, - - CC2650_LAUNCHXL_GPTIMERCOUNT -} CC2650_LAUNCHXL_GPTimers; - -/*! - * @def CC2650_LAUNCHXL_I2CName - * @brief Enum of I2C names - */ -typedef enum CC2650_LAUNCHXL_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC2650_LAUNCHXL_I2C0 = 0, -#endif - - CC2650_LAUNCHXL_I2CCOUNT -} CC2650_LAUNCHXL_I2CName; - -/*! - * @def CC2650_LAUNCHXL_NVSName - * @brief Enum of NVS names - */ -typedef enum CC2650_LAUNCHXL_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC2650_LAUNCHXL_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC2650_LAUNCHXL_NVSSPI25X0, -#endif - - CC2650_LAUNCHXL_NVSCOUNT -} CC2650_LAUNCHXL_NVSName; - -/*! - * @def CC2650_LAUNCHXL_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC2650_LAUNCHXL_PWMName { - CC2650_LAUNCHXL_PWM0 = 0, - CC2650_LAUNCHXL_PWM1, - CC2650_LAUNCHXL_PWM2, - CC2650_LAUNCHXL_PWM3, - CC2650_LAUNCHXL_PWM4, - CC2650_LAUNCHXL_PWM5, - CC2650_LAUNCHXL_PWM6, - CC2650_LAUNCHXL_PWM7, - - CC2650_LAUNCHXL_PWMCOUNT -} CC2650_LAUNCHXL_PWMName; - -/*! - * @def CC2650_LAUNCHXL_SDName - * @brief Enum of SD names - */ -typedef enum CC2650_LAUNCHXL_SDName { - CC2650_LAUNCHXL_SDSPI0 = 0, - - CC2650_LAUNCHXL_SDCOUNT -} CC2650_LAUNCHXL_SDName; - -/*! - * @def CC2650_LAUNCHXL_SPIName - * @brief Enum of SPI names - */ -typedef enum CC2650_LAUNCHXL_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC2650_LAUNCHXL_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC2650_LAUNCHXL_SPI1, -#endif - - CC2650_LAUNCHXL_SPICOUNT -} CC2650_LAUNCHXL_SPIName; - -/*! - * @def CC2650_LAUNCHXL_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC2650_LAUNCHXL_TRNGName { - CC2650_LAUNCHXL_TRNG0 = 0, - - CC2650_LAUNCHXL_TRNGCOUNT -} CC2650_LAUNCHXL_TRNGName; - -/*! - * @def CC2650_LAUNCHXL_UARTName - * @brief Enum of UARTs - */ -typedef enum CC2650_LAUNCHXL_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC2650_LAUNCHXL_UART0 = 0, -#endif - - CC2650_LAUNCHXL_UARTCOUNT -} CC2650_LAUNCHXL_UARTName; - -/*! - * @def CC2650_LAUNCHXL_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC2650_LAUNCHXL_UDMAName { - CC2650_LAUNCHXL_UDMA0 = 0, - - CC2650_LAUNCHXL_UDMACOUNT -} CC2650_LAUNCHXL_UDMAName; - -/*! - * @def CC2650_LAUNCHXL_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC2650_LAUNCHXL_WatchdogName { - CC2650_LAUNCHXL_WATCHDOG0 = 0, - - CC2650_LAUNCHXL_WATCHDOGCOUNT -} CC2650_LAUNCHXL_WatchdogName; - -#ifdef __cplusplus -} -#endif - -#endif /* __CC2650_LAUNCHXL_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL_fxns.c deleted file mode 100644 index f471e33d6..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/CC2650_LAUNCHXL_fxns.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ======== CC2650_LAUNCHXL_fxns.c ======== - * This file contains the board-specific initialization functions. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include - -#include "Board.h" - -/* - * ======== CC2650_LAUNCHXL_sendExtFlashByte ======== - */ -void CC2650_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC2650_LAUNCHXL_wakeUpExtFlash ======== - */ -void CC2650_LAUNCHXL_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC2650_LAUNCHXL_shutDownExtFlash ======== - */ -void CC2650_LAUNCHXL_shutDownExtFlash(void) -{ - /* - * To be sure we are putting the flash into sleep and not waking it, - * we first have to make a wake up call - */ - CC2650_LAUNCHXL_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC2650_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC2650_LAUNCHXL_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/Makefile.cc2650 b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/Makefile.cc2650 deleted file mode 100644 index d03a02397..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/Makefile.cc2650 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x0-cc26x0 -DEVICE_FAMILY = CC26X0 -DEVICE_LINE = CC26XX -DEVICE = CC2650 - -BOARD_SOURCEFILES += CC2650_LAUNCHXL.c CC2650_LAUNCHXL_fxns.c - -SUPPORTS_PROP_MODE = 0 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 1 - -# Include the common board makefile -include $(FAMILY_PATH)/launchpad/Makefile.launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/rf-conf.h deleted file mode 100644 index 9d6abaeac..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc2650/rf-conf.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for the 2.4 GHz path - * on the radio. - * - * These are the following front-end mode configurations for the - * CC2650-LAUNCHXL board: - * - 2.4 GHz: differential and internal bias - * - * @{ - */ -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_INTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/Board.h deleted file mode 100644 index ddf5e4946..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/Board.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC26X2R1_LAUNCHXL.h" - -#define Board_CC26X2R1_LAUNCHXL -#define BOARD_STRING "TI CC26x2R1 LaunchPad" - -#define Board_initGeneral() CC26X2R1_LAUNCHXL_initGeneral() -#define Board_shutDownExtFlash() CC26X2R1_LAUNCHXL_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC26X2R1_LAUNCHXL_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADC0 CC26X2R1_LAUNCHXL_ADC0 -#define Board_ADC1 CC26X2R1_LAUNCHXL_ADC1 - -#define Board_ADCBUF0 CC26X2R1_LAUNCHXL_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL0 -#define Board_ADCBUF0CHANNEL1 CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL1 - -#define Board_ECDH0 CC26X2R1_LAUNCHXL_ECDH0 -#define Board_ECDSA0 CC26X2R1_LAUNCHXL_ECDSA0 -#define Board_ECJPAKE0 CC26X2R1_LAUNCHXL_ECJPAKE0 -#define Board_AESCCM0 CC26X2R1_LAUNCHXL_AESCCM0 -#define Board_AESECB0 CC26X2R1_LAUNCHXL_AESECB0 -#define Board_SHA20 CC26X2R1_LAUNCHXL_SHA20 - -#define Board_DIO0 CC26X2R1_LAUNCHXL_DIO0 -#define Board_DIO1_RFSW CC26X2R1_LAUNCHXL_DIO1_RFSW -#define Board_DIO12 CC26X2R1_LAUNCHXL_DIO12 -#define Board_DIO15 CC26X2R1_LAUNCHXL_DIO15 -#define Board_DIO16_TDO CC26X2R1_LAUNCHXL_DIO16_TDO -#define Board_DIO17_TDI CC26X2R1_LAUNCHXL_DIO17_TDI -#define Board_DIO21 CC26X2R1_LAUNCHXL_DIO21 -#define Board_DIO22 CC26X2R1_LAUNCHXL_DIO22 - -#define Board_DIO23_ANALOG CC26X2R1_LAUNCHXL_DIO23_ANALOG -#define Board_DIO24_ANALOG CC26X2R1_LAUNCHXL_DIO24_ANALOG -#define Board_DIO25_ANALOG CC26X2R1_LAUNCHXL_DIO25_ANALOG -#define Board_DIO26_ANALOG CC26X2R1_LAUNCHXL_DIO26_ANALOG -#define Board_DIO27_ANALOG CC26X2R1_LAUNCHXL_DIO27_ANALOG -#define Board_DIO28_ANALOG CC26X2R1_LAUNCHXL_DIO28_ANALOG -#define Board_DIO29_ANALOG CC26X2R1_LAUNCHXL_DIO29_ANALOG -#define Board_DIO30_ANALOG CC26X2R1_LAUNCHXL_DIO30_ANALOG - -#define Board_GPIO_BUTTON0 CC26X2R1_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BUTTON1 CC26X2R1_LAUNCHXL_GPIO_S2 -#define Board_GPIO_BTN1 CC26X2R1_LAUNCHXL_GPIO_S1 -#define Board_GPIO_BTN2 CC26X2R1_LAUNCHXL_GPIO_S2 -#define Board_GPIO_LED0 CC26X2R1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_LED1 CC26X2R1_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED2 CC26X2R1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_RLED CC26X2R1_LAUNCHXL_GPIO_LED_RED -#define Board_GPIO_GLED CC26X2R1_LAUNCHXL_GPIO_LED_GREEN -#define Board_GPIO_LED_ON CC26X2R1_LAUNCHXL_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC26X2R1_LAUNCHXL_GPIO_LED_OFF - -#define Board_GPTIMER0A CC26X2R1_LAUNCHXL_GPTIMER0A -#define Board_GPTIMER0B CC26X2R1_LAUNCHXL_GPTIMER0B -#define Board_GPTIMER1A CC26X2R1_LAUNCHXL_GPTIMER1A -#define Board_GPTIMER1B CC26X2R1_LAUNCHXL_GPTIMER1B -#define Board_GPTIMER2A CC26X2R1_LAUNCHXL_GPTIMER2A -#define Board_GPTIMER2B CC26X2R1_LAUNCHXL_GPTIMER2B -#define Board_GPTIMER3A CC26X2R1_LAUNCHXL_GPTIMER3A -#define Board_GPTIMER3B CC26X2R1_LAUNCHXL_GPTIMER3B - -#define Board_I2C0 CC26X2R1_LAUNCHXL_I2C0 -#define Board_I2C_TMP Board_I2C0 - -#define Board_NVSINTERNAL CC26X2R1_LAUNCHXL_NVSCC26XX0 -#define Board_NVSEXTERNAL CC26X2R1_LAUNCHXL_NVSSPI25X0 - -#define Board_PIN_BUTTON0 CC26X2R1_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BUTTON1 CC26X2R1_LAUNCHXL_PIN_BTN2 -#define Board_PIN_BTN1 CC26X2R1_LAUNCHXL_PIN_BTN1 -#define Board_PIN_BTN2 CC26X2R1_LAUNCHXL_PIN_BTN2 -#define Board_PIN_LED0 CC26X2R1_LAUNCHXL_PIN_RLED -#define Board_PIN_LED1 CC26X2R1_LAUNCHXL_PIN_GLED -#define Board_PIN_LED2 CC26X2R1_LAUNCHXL_PIN_RLED -#define Board_PIN_RLED CC26X2R1_LAUNCHXL_PIN_RLED -#define Board_PIN_GLED CC26X2R1_LAUNCHXL_PIN_GLED - -#define Board_PWM0 CC26X2R1_LAUNCHXL_PWM0 -#define Board_PWM1 CC26X2R1_LAUNCHXL_PWM1 -#define Board_PWM2 CC26X2R1_LAUNCHXL_PWM2 -#define Board_PWM3 CC26X2R1_LAUNCHXL_PWM3 -#define Board_PWM4 CC26X2R1_LAUNCHXL_PWM4 -#define Board_PWM5 CC26X2R1_LAUNCHXL_PWM5 -#define Board_PWM6 CC26X2R1_LAUNCHXL_PWM6 -#define Board_PWM7 CC26X2R1_LAUNCHXL_PWM7 - -#define Board_SD0 CC26X2R1_LAUNCHXL_SDSPI0 - -#define Board_SPI0 CC26X2R1_LAUNCHXL_SPI0 -#define Board_SPI0_MISO CC26X2R1_LAUNCHXL_SPI0_MISO -#define Board_SPI0_MOSI CC26X2R1_LAUNCHXL_SPI0_MOSI -#define Board_SPI0_CLK CC26X2R1_LAUNCHXL_SPI0_CLK -#define Board_SPI0_CSN CC26X2R1_LAUNCHXL_SPI0_CSN -#define Board_SPI1 CC26X2R1_LAUNCHXL_SPI1 -#define Board_SPI1_MISO CC26X2R1_LAUNCHXL_SPI1_MISO -#define Board_SPI1_MOSI CC26X2R1_LAUNCHXL_SPI1_MOSI -#define Board_SPI1_CLK CC26X2R1_LAUNCHXL_SPI1_CLK -#define Board_SPI1_CSN CC26X2R1_LAUNCHXL_SPI1_CSN -#define Board_SPI_FLASH_CS CC26X2R1_LAUNCHXL_SPI_FLASH_CS -#define Board_FLASH_CS_ON 0 -#define Board_FLASH_CS_OFF 1 - -#define Board_SPI_MASTER CC26X2R1_LAUNCHXL_SPI0 -#define Board_SPI_SLAVE CC26X2R1_LAUNCHXL_SPI0 -#define Board_SPI_MASTER_READY CC26X2R1_LAUNCHXL_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC26X2R1_LAUNCHXL_SPI_SLAVE_READY - -#define Board_UART0 CC26X2R1_LAUNCHXL_UART0 -#define Board_UART1 CC26X2R1_LAUNCHXL_UART1 - -#define Board_WATCHDOG0 CC26X2R1_LAUNCHXL_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_TMP_ADDR (0x40) -#define Board_SENSORS_BP_TMP_ADDR Board_TMP_ADDR - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.c deleted file mode 100644 index 854d1d2ba..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.c +++ /dev/null @@ -1,967 +0,0 @@ -/* - * Copyright (c) 2016-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC26X2R1_LAUNCHXL.c =================================== - * This file is responsible for setting up the board specific items for the - * CC26X2R1_LAUNCHXL board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC26X2R1_LAUNCHXL.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26X2_Object adcBufCC26xxObjects[CC26X2R1_LAUNCHXL_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26X2_AdcChannelLutEntry ADCBufCC26X2_adcChannelLut[CC26X2R1_LAUNCHXL_ADCBUF0CHANNELCOUNT] = { - {CC26X2R1_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7}, - {CC26X2R1_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6}, - {CC26X2R1_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5}, - {CC26X2R1_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4}, - {CC26X2R1_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3}, - {CC26X2R1_LAUNCHXL_DIO28_ANALOG, ADC_COMPB_IN_AUXIO2}, - {CC26X2R1_LAUNCHXL_DIO29_ANALOG, ADC_COMPB_IN_AUXIO1}, - {CC26X2R1_LAUNCHXL_DIO30_ANALOG, ADC_COMPB_IN_AUXIO0}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, -}; - -const ADCBufCC26X2_HWAttrs adcBufCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26X2_adcChannelLut, - .gpTimerUnit = CC26X2R1_LAUNCHXL_GPTIMER0A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC26X2R1_LAUNCHXL_ADCBUFCOUNT] = { - { - &ADCBufCC26X2_fxnTable, - &adcBufCC26xxObjects[CC26X2R1_LAUNCHXL_ADCBUF0], - &adcBufCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC26X2R1_LAUNCHXL_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADCCOUNT]; - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADCCOUNT] = { - { - .adcDIO = CC26X2R1_LAUNCHXL_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC26X2R1_LAUNCHXL_DIO24_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO6, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC26X2R1_LAUNCHXL_DIO25_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO5, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC26X2R1_LAUNCHXL_DIO26_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO4, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC26X2R1_LAUNCHXL_DIO27_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO3, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC26X2R1_LAUNCHXL_DIO28_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO2, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC26X2R1_LAUNCHXL_DIO29_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO1, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = CC26X2R1_LAUNCHXL_DIO30_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO0, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_10P9_MS, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC26X2R1_LAUNCHXL_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADC0]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADC1]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADC2]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADC3]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADC4]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADC5], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADC5]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADC6], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADC6]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADC7], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADC7]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC26X2R1_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC26X2R1_LAUNCHXL_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC26X2R1_LAUNCHXL_ADCCOUNT; - - -/* - * =============================== ECDH =============================== - */ -#include -#include - -ECDHCC26X2_Object ecdhCC26X2Objects[CC26X2R1_LAUNCHXL_ECDHCOUNT]; - -const ECDHCC26X2_HWAttrs ecdhCC26X2HWAttrs[CC26X2R1_LAUNCHXL_ECDHCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDH_Config ECDH_config[CC26X2R1_LAUNCHXL_ECDHCOUNT] = { - { - .object = &ecdhCC26X2Objects[CC26X2R1_LAUNCHXL_ECDH0], - .hwAttrs = &ecdhCC26X2HWAttrs[CC26X2R1_LAUNCHXL_ECDH0] - }, -}; - -const uint_least8_t ECDH_count = CC26X2R1_LAUNCHXL_ECDHCOUNT; - -/* - * =============================== ECDSA =============================== - */ -#include -#include - -ECDSACC26X2_Object ecdsaCC26X2Objects[CC26X2R1_LAUNCHXL_ECDSACOUNT]; - -const ECDSACC26X2_HWAttrs ecdsaCC26X2HWAttrs[CC26X2R1_LAUNCHXL_ECDSACOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECDSA_Config ECDSA_config[CC26X2R1_LAUNCHXL_ECDSACOUNT] = { - { - .object = &ecdsaCC26X2Objects[CC26X2R1_LAUNCHXL_ECDSA0], - .hwAttrs = &ecdsaCC26X2HWAttrs[CC26X2R1_LAUNCHXL_ECDSA0] - }, -}; - -const uint_least8_t ECDSA_count = CC26X2R1_LAUNCHXL_ECDSACOUNT; - -/* - * =============================== ECJPAKE =============================== - */ -#include -#include - -ECJPAKECC26X2_Object ecjpakeCC26X2Objects[CC26X2R1_LAUNCHXL_ECJPAKECOUNT]; - -const ECJPAKECC26X2_HWAttrs ecjpakeCC26X2HWAttrs[CC26X2R1_LAUNCHXL_ECJPAKECOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const ECJPAKE_Config ECJPAKE_config[CC26X2R1_LAUNCHXL_ECJPAKECOUNT] = { - { - .object = &ecjpakeCC26X2Objects[CC26X2R1_LAUNCHXL_ECJPAKE0], - .hwAttrs = &ecjpakeCC26X2HWAttrs[CC26X2R1_LAUNCHXL_ECJPAKE0] - }, -}; - -const uint_least8_t ECJPAKE_count = CC26X2R1_LAUNCHXL_ECJPAKECOUNT; - -/* - * =============================== SHA2 =============================== - */ -#include -#include - -SHA2CC26X2_Object sha2CC26X2Objects[CC26X2R1_LAUNCHXL_SHA2COUNT]; - -const SHA2CC26X2_HWAttrs sha2CC26X2HWAttrs[CC26X2R1_LAUNCHXL_SHA2COUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const SHA2_Config SHA2_config[CC26X2R1_LAUNCHXL_SHA2COUNT] = { - { - .object = &sha2CC26X2Objects[CC26X2R1_LAUNCHXL_SHA20], - .hwAttrs = &sha2CC26X2HWAttrs[CC26X2R1_LAUNCHXL_SHA20] - }, -}; - -const uint_least8_t SHA2_count = CC26X2R1_LAUNCHXL_SHA2COUNT; - -/* - * =============================== AESCCM =============================== - */ -#include -#include - -AESCCMCC26XX_Object aesccmCC26XXObjects[CC26X2R1_LAUNCHXL_AESCCMCOUNT]; - -const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC26X2R1_LAUNCHXL_AESCCMCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESCCM_Config AESCCM_config[CC26X2R1_LAUNCHXL_AESCCMCOUNT] = { - { - .object = &aesccmCC26XXObjects[CC26X2R1_LAUNCHXL_AESCCM0], - .hwAttrs = &aesccmCC26XXHWAttrs[CC26X2R1_LAUNCHXL_AESCCM0] - }, -}; - -const uint_least8_t AESCCM_count = CC26X2R1_LAUNCHXL_AESCCMCOUNT; - -/* - * =============================== AESECB =============================== - */ -#include -#include - -AESECBCC26XX_Object aesecbCC26XXObjects[CC26X2R1_LAUNCHXL_AESECBCOUNT]; - -const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC26X2R1_LAUNCHXL_AESECBCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - } -}; - -const AESECB_Config AESECB_config[CC26X2R1_LAUNCHXL_AESECBCOUNT] = { - { - .object = &aesecbCC26XXObjects[CC26X2R1_LAUNCHXL_AESECB0], - .hwAttrs = &aesecbCC26XXHWAttrs[CC26X2R1_LAUNCHXL_AESECB0] - }, -}; - -const uint_least8_t AESECB_count = CC26X2R1_LAUNCHXL_AESECBCOUNT; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC26X2R1_LAUNCHXL.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_13 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC26X2R1_LAUNCHXL_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC26X2R1_LAUNCHXL_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG, - - /* SD CS */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC26X2R1_LAUNCH.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC26X2R1_LAUNCHXL_SPI_MASTER_READY */ - NULL, /* CC26X2R1_LAUNCHXL_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC26X2R1_LAUNCHXL_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC26X2R1_LAUNCHXL_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC26X2R1_LAUNCHXL_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC26X2R1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC26X2R1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC26X2R1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC26X2R1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC26X2R1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC26X2R1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC26X2R1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC26X2R1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC26X2R1_LAUNCHXL_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC26X2R1_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC26X2R1_LAUNCHXL_I2C0_SDA0, - .sclPin = CC26X2R1_LAUNCHXL_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC26X2R1_LAUNCHXL_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC26X2R1_LAUNCHXL_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC26X2R1_LAUNCHXL_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC26X2R1_LAUNCHXL_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x48000 -#define SECTORSIZE 0x2000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS External Regions */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS External Regions */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC26X2R1_LAUNCHXL_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC26X2R1_LAUNCHXL_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC26X2R1_LAUNCHXL_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC26X2R1_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC26X2R1_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC26X2R1_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC26X2R1_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC26X2R1_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC26X2R1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */ - CC26X2R1_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC26X2R1_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC26X2R1_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC26X2R1_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26X2_Config PowerCC26X2_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC26X2R1_LAUNCHXL_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_PWMCOUNT] = { - { .pwmPin = CC26X2R1_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC26X2R1_LAUNCHXL_GPTIMER0A }, - { .pwmPin = CC26X2R1_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC26X2R1_LAUNCHXL_GPTIMER0B }, - { .pwmPin = CC26X2R1_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC26X2R1_LAUNCHXL_GPTIMER1A }, - { .pwmPin = CC26X2R1_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC26X2R1_LAUNCHXL_GPTIMER1B }, - { .pwmPin = CC26X2R1_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC26X2R1_LAUNCHXL_GPTIMER2A }, - { .pwmPin = CC26X2R1_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC26X2R1_LAUNCHXL_GPTIMER2B }, - { .pwmPin = CC26X2R1_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC26X2R1_LAUNCHXL_GPTIMER3A }, - { .pwmPin = CC26X2R1_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC26X2R1_LAUNCHXL_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC26X2R1_LAUNCHXL_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC26X2R1_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC26X2R1_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC26X2R1_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC26X2R1_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC26X2R1_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC26X2R1_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC26X2R1_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC26X2R1_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC26X2R1_LAUNCHXL_PWM7] }, -}; - -const uint_least8_t PWM_count = CC26X2R1_LAUNCHXL_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - .globalCallback = NULL, /* No board specific callback */ - .globalEventMask = 0 /* No events subscribed to */ -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC26X2R1_LAUNCHXL_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC26X2R1_LAUNCHXL_SDCOUNT] = { - { - .spiIndex = CC26X2R1_LAUNCHXL_SPI0, - .spiCsGpioIndex = CC26X2R1_LAUNCHXL_SDSPI_CS - } -}; - -const SD_Config SD_config[CC26X2R1_LAUNCHXL_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC26X2R1_LAUNCHXL_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC26X2R1_LAUNCHXL_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC26X2R1_LAUNCHXL_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC26X2R1_LAUNCHXL_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC26X2R1_LAUNCHXL_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X2_Object trngCC26X2Object[CC26X2R1_LAUNCHXL_TRNGCOUNT]; - -const TRNGCC26X2_HWAttrs trngCC26X2HWAttrs[CC26X2R1_LAUNCHXL_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X2Object[0], &trngCC26X2HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC26X2R1_LAUNCHXL_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC26X2R1_LAUNCHXL_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC26X2R1_LAUNCHXL_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC26X2R1_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC26X2R1_LAUNCHXL_UART0_TX, - .rxPin = CC26X2R1_LAUNCHXL_UART0_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC26X2R1_LAUNCHXL_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC26X2R1_LAUNCHXL_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -#if TI_UART_CONF_UART1_ENABLE - { - .baseAddr = UART1_BASE, - .powerMngrId = PowerCC26X2_PERIPH_UART1, - .intNum = INT_UART1_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC26X2R1_LAUNCHXL_UART1_TX, - .rxPin = CC26X2R1_LAUNCHXL_UART1_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC26X2R1_LAUNCHXL_UART1], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC26X2R1_LAUNCHXL_UART1]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC26X2R1_LAUNCHXL_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC26X2R1_LAUNCHXL_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC26X2R1_LAUNCHXL_UART0] - }, -#endif -#if TI_UART_CONF_UART1_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC26X2R1_LAUNCHXL_UART1], - .hwAttrs = &uartCC26XXHWAttrs[CC26X2R1_LAUNCHXL_UART1] - }, -#endif -}; - -const uint_least8_t UART_count = CC26X2R1_LAUNCHXL_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC26X2R1_LAUNCHXL_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC26X2R1_LAUNCHXL_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC26X2R1_LAUNCHXL_UDMACOUNT] = { - { - .object = &udmaObjects[CC26X2R1_LAUNCHXL_UDMA0], - .hwAttrs = &udmaHWAttrs[CC26X2R1_LAUNCHXL_UDMA0] - }, -}; - - - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC26X2R1_LAUNCHXL_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC26X2R1_LAUNCHXL_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC26X2R1_LAUNCHXL_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC26X2R1_LAUNCHXL_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC26X2R1_LAUNCHXL_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC26X2R1_LAUNCHXL_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC26X2R1_LAUNCHXL_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC26X2R1_LAUNCHXL_initGeneral ======== - */ -void CC26X2R1_LAUNCHXL_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.h deleted file mode 100644 index 840d937e7..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL.h +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** ============================================================================ - * @file CC26X2R1_LAUNCHXL.h - * - * @brief CC26X2R1_LAUNCHXL Board Specific header file. - * - * The CC26X2R1_LAUNCHXL header file should be included in an application as - * follows: - * @code - * #include "CC26X2R1_LAUNCHXL.h" - * @endcode - * - * ============================================================================ - */ -#ifndef __CC26X2R1_LAUNCHXL_BOARD_H__ -#define __CC26X2R1_LAUNCHXL_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC26X2R1_LAUNCHXL -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Analog Capable DIOs */ -#define CC26X2R1_LAUNCHXL_DIO23_ANALOG IOID_23 -#define CC26X2R1_LAUNCHXL_DIO24_ANALOG IOID_24 -#define CC26X2R1_LAUNCHXL_DIO25_ANALOG IOID_25 -#define CC26X2R1_LAUNCHXL_DIO26_ANALOG IOID_26 -#define CC26X2R1_LAUNCHXL_DIO27_ANALOG IOID_27 -#define CC26X2R1_LAUNCHXL_DIO28_ANALOG IOID_28 -#define CC26X2R1_LAUNCHXL_DIO29_ANALOG IOID_29 -#define CC26X2R1_LAUNCHXL_DIO30_ANALOG IOID_30 - -/* Digital IOs */ -#define CC26X2R1_LAUNCHXL_DIO0 IOID_0 -#define CC26X2R1_LAUNCHXL_DIO1_RFSW IOID_1 -#define CC26X2R1_LAUNCHXL_DIO12 IOID_12 -#define CC26X2R1_LAUNCHXL_DIO15 IOID_15 -#define CC26X2R1_LAUNCHXL_DIO16_TDO IOID_16 -#define CC26X2R1_LAUNCHXL_DIO17_TDI IOID_17 -#define CC26X2R1_LAUNCHXL_DIO21 IOID_21 -#define CC26X2R1_LAUNCHXL_DIO22 IOID_22 - -/* Discrete Inputs */ -#define CC26X2R1_LAUNCHXL_PIN_BTN1 IOID_13 -#define CC26X2R1_LAUNCHXL_PIN_BTN2 IOID_14 - -/* GPIO */ -#define CC26X2R1_LAUNCHXL_GPIO_LED_ON 1 -#define CC26X2R1_LAUNCHXL_GPIO_LED_OFF 0 - -/* I2C */ -#define CC26X2R1_LAUNCHXL_I2C0_SCL0 IOID_4 -#define CC26X2R1_LAUNCHXL_I2C0_SDA0 IOID_5 - -/* LEDs */ -#define CC26X2R1_LAUNCHXL_PIN_LED_ON 1 -#define CC26X2R1_LAUNCHXL_PIN_LED_OFF 0 -#define CC26X2R1_LAUNCHXL_PIN_RLED IOID_6 -#define CC26X2R1_LAUNCHXL_PIN_GLED IOID_7 - -/* PWM Outputs */ -#define CC26X2R1_LAUNCHXL_PWMPIN0 CC26X2R1_LAUNCHXL_PIN_RLED -#define CC26X2R1_LAUNCHXL_PWMPIN1 CC26X2R1_LAUNCHXL_PIN_GLED -#define CC26X2R1_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED - -/* SPI */ -#define CC26X2R1_LAUNCHXL_SPI_FLASH_CS IOID_20 -#define CC26X2R1_LAUNCHXL_FLASH_CS_ON 0 -#define CC26X2R1_LAUNCHXL_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC26X2R1_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */ -#define CC26X2R1_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */ -#define CC26X2R1_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */ -#define CC26X2R1_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC26X2R1_LAUNCHXL_UART0_RX IOID_2 /* RXD */ -#define CC26X2R1_LAUNCHXL_UART0_TX IOID_3 /* TXD */ -#define CC26X2R1_LAUNCHXL_UART0_CTS IOID_19 /* CTS */ -#define CC26X2R1_LAUNCHXL_UART0_RTS IOID_18 /* RTS */ -#define CC26X2R1_LAUNCHXL_UART1_RX PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_UART1_TX PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_UART1_CTS PIN_UNASSIGNED -#define CC26X2R1_LAUNCHXL_UART1_RTS PIN_UNASSIGNED -/* For backward compatibility */ -#define CC26X2R1_LAUNCHXL_UART_RX CC26X2R1_LAUNCHXL_UART0_RX -#define CC26X2R1_LAUNCHXL_UART_TX CC26X2R1_LAUNCHXL_UART0_TX -#define CC26X2R1_LAUNCHXL_UART_CTS CC26X2R1_LAUNCHXL_UART0_CTS -#define CC26X2R1_LAUNCHXL_UART_RTS CC26X2R1_LAUNCHXL_UART0_RTS - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC26X2R1_LAUNCHXL_initGeneral(void); - -/*! - * @brief Shut down the external flash present on the board files - * - * This function bitbangs the SPI sequence necessary to turn off - * the external flash on LaunchPads. - */ -void CC26X2R1_LAUNCHXL_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC26X2R1_LAUNCHXL_wakeUpExtFlash(void); - - -/*! - * @def CC26X2R1_LAUNCHXL_ADCBufName - * @brief Enum of ADCs - */ -typedef enum CC26X2R1_LAUNCHXL_ADCBufName { - CC26X2R1_LAUNCHXL_ADCBUF0 = 0, - - CC26X2R1_LAUNCHXL_ADCBUFCOUNT -} CC26X2R1_LAUNCHXL_ADCBufName; - -/*! - * @def CC26X2R1_LAUNCHXL_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC26X2R1_LAUNCHXL_ADCBuf0ChannelName { - CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL0 = 0, - CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL1, - CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL2, - CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL3, - CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL4, - CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL5, - CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL6, - CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL7, - CC26X2R1_LAUNCHXL_ADCBUF0CHANNELVDDS, - CC26X2R1_LAUNCHXL_ADCBUF0CHANNELDCOUPL, - CC26X2R1_LAUNCHXL_ADCBUF0CHANNELVSS, - - CC26X2R1_LAUNCHXL_ADCBUF0CHANNELCOUNT -} CC26X2R1_LAUNCHXL_ADCBuf0ChannelName; - -/*! - * @def CC26X2R1_LAUNCHXL_ADCName - * @brief Enum of ADCs - */ -typedef enum CC26X2R1_LAUNCHXL_ADCName { - CC26X2R1_LAUNCHXL_ADC0 = 0, - CC26X2R1_LAUNCHXL_ADC1, - CC26X2R1_LAUNCHXL_ADC2, - CC26X2R1_LAUNCHXL_ADC3, - CC26X2R1_LAUNCHXL_ADC4, - CC26X2R1_LAUNCHXL_ADC5, - CC26X2R1_LAUNCHXL_ADC6, - CC26X2R1_LAUNCHXL_ADC7, - CC26X2R1_LAUNCHXL_ADCDCOUPL, - CC26X2R1_LAUNCHXL_ADCVSS, - CC26X2R1_LAUNCHXL_ADCVDDS, - - CC26X2R1_LAUNCHXL_ADCCOUNT -} CC26X2R1_LAUNCHXL_ADCName; - -/*! - * @def CC26X2R1_LAUNCHXL_ECDHName - * @brief Enum of ECDH names - */ -typedef enum CC26X2R1_LAUNCHXL_ECDHName { - CC26X2R1_LAUNCHXL_ECDH0 = 0, - - CC26X2R1_LAUNCHXL_ECDHCOUNT -} CC26X2R1_LAUNCHXL_ECDHName; - -/*! - * @def CC26X2R1_LAUNCHXL_ECDSAName - * @brief Enum of ECDSA names - */ -typedef enum CC26X2R1_LAUNCHXL_ECDSAName { - CC26X2R1_LAUNCHXL_ECDSA0 = 0, - - CC26X2R1_LAUNCHXL_ECDSACOUNT -} CC26X2R1_LAUNCHXL_ECDSAName; - -/*! - * @def CC26X2R1_LAUNCHXL_ECJPAKEName - * @brief Enum of ECJPAKE names - */ -typedef enum CC26X2R1_LAUNCHXL_ECJPAKEName { - CC26X2R1_LAUNCHXL_ECJPAKE0 = 0, - - CC26X2R1_LAUNCHXL_ECJPAKECOUNT -} CC26X2R1_LAUNCHXL_ECJPAKEName; - -/*! - * @def CC26X2R1_LAUNCHXL_AESCCMName - * @brief Enum of AESCCM names - */ -typedef enum CC26X2R1_LAUNCHXL_AESCCMName { - CC26X2R1_LAUNCHXL_AESCCM0 = 0, - - CC26X2R1_LAUNCHXL_AESCCMCOUNT -} CC26X2R1_LAUNCHXL_AESCCMName; - -/*! - * @def CC26X2R1_LAUNCHXL_AESECBName - * @brief Enum of AESECB names - */ -typedef enum CC26X2R1_LAUNCHXL_AESECBName { - CC26X2R1_LAUNCHXL_AESECB0 = 0, - - CC26X2R1_LAUNCHXL_AESECBCOUNT -} CC26X2R1_LAUNCHXL_AESECBName; - -/*! - * @def CC26X2R1_LAUNCHXL_SHA2Name - * @brief Enum of SHA2 names - */ -typedef enum CC26X2R1_LAUNCHXL_SHA2Name { - CC26X2R1_LAUNCHXL_SHA20 = 0, - - CC26X2R1_LAUNCHXL_SHA2COUNT -} CC26X2R1_LAUNCHXL_SHA2Name; - -/*! - * @def CC26X2R1_LAUNCHXL_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC26X2R1_LAUNCHXL_GPIOName { - CC26X2R1_LAUNCHXL_GPIO_S1 = 0, - CC26X2R1_LAUNCHXL_GPIO_S2, - CC26X2R1_LAUNCHXL_SPI_MASTER_READY, - CC26X2R1_LAUNCHXL_SPI_SLAVE_READY, - CC26X2R1_LAUNCHXL_GPIO_LED_GREEN, - CC26X2R1_LAUNCHXL_GPIO_LED_RED, - CC26X2R1_LAUNCHXL_GPIO_SPI_FLASH_CS, - CC26X2R1_LAUNCHXL_SDSPI_CS, - CC26X2R1_LAUNCHXL_GPIOCOUNT -} CC26X2R1_LAUNCHXL_GPIOName; - -/*! - * @def CC26X2R1_LAUNCHXL_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC26X2R1_LAUNCHXL_GPTimerName { - CC26X2R1_LAUNCHXL_GPTIMER0A = 0, - CC26X2R1_LAUNCHXL_GPTIMER0B, - CC26X2R1_LAUNCHXL_GPTIMER1A, - CC26X2R1_LAUNCHXL_GPTIMER1B, - CC26X2R1_LAUNCHXL_GPTIMER2A, - CC26X2R1_LAUNCHXL_GPTIMER2B, - CC26X2R1_LAUNCHXL_GPTIMER3A, - CC26X2R1_LAUNCHXL_GPTIMER3B, - - CC26X2R1_LAUNCHXL_GPTIMERPARTSCOUNT -} CC26X2R1_LAUNCHXL_GPTimerName; - -/*! - * @def CC26X2R1_LAUNCHXL_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC26X2R1_LAUNCHXL_GPTimers { - CC26X2R1_LAUNCHXL_GPTIMER0 = 0, - CC26X2R1_LAUNCHXL_GPTIMER1, - CC26X2R1_LAUNCHXL_GPTIMER2, - CC26X2R1_LAUNCHXL_GPTIMER3, - - CC26X2R1_LAUNCHXL_GPTIMERCOUNT -} CC26X2R1_LAUNCHXL_GPTimers; - -/*! - * @def CC26X2R1_LAUNCHXL_I2CName - * @brief Enum of I2C names - */ -typedef enum CC26X2R1_LAUNCHXL_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC26X2R1_LAUNCHXL_I2C0 = 0, -#endif - - CC26X2R1_LAUNCHXL_I2CCOUNT -} CC26X2R1_LAUNCHXL_I2CName; - -/*! - * @def CC26X2R1_LAUNCHXL_NVSName - * @brief Enum of NVS names - */ -typedef enum CC26X2R1_LAUNCHXL_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC26X2R1_LAUNCHXL_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC26X2R1_LAUNCHXL_NVSSPI25X0, -#endif - - CC26X2R1_LAUNCHXL_NVSCOUNT -} CC26X2R1_LAUNCHXL_NVSName; - -/*! - * @def CC26X2R1_LAUNCHXL_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC26X2R1_LAUNCHXL_PWMName { - CC26X2R1_LAUNCHXL_PWM0 = 0, - CC26X2R1_LAUNCHXL_PWM1, - CC26X2R1_LAUNCHXL_PWM2, - CC26X2R1_LAUNCHXL_PWM3, - CC26X2R1_LAUNCHXL_PWM4, - CC26X2R1_LAUNCHXL_PWM5, - CC26X2R1_LAUNCHXL_PWM6, - CC26X2R1_LAUNCHXL_PWM7, - - CC26X2R1_LAUNCHXL_PWMCOUNT -} CC26X2R1_LAUNCHXL_PWMName; - -/*! - * @def CC26X2R1_LAUNCHXL_SDName - * @brief Enum of SD names - */ -typedef enum CC26X2R1_LAUNCHXL_SDName { - CC26X2R1_LAUNCHXL_SDSPI0 = 0, - - CC26X2R1_LAUNCHXL_SDCOUNT -} CC26X2R1_LAUNCHXL_SDName; - -/*! - * @def CC26X2R1_LAUNCHXL_SPIName - * @brief Enum of SPI names - */ -typedef enum CC26X2R1_LAUNCHXL_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC26X2R1_LAUNCHXL_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC26X2R1_LAUNCHXL_SPI1, -#endif - - CC26X2R1_LAUNCHXL_SPICOUNT -} CC26X2R1_LAUNCHXL_SPIName; - -/*! - * @def CC26X2R1_LAUNCHXL_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC26X2R1_LAUNCHXL_TRNGName { - CC26X2R1_LAUNCHXL_TRNG0 = 0, - - CC26X2R1_LAUNCHXL_TRNGCOUNT -} CC26X2R1_LAUNCHXL_TRNGName; - -/*! - * @def CC26X2R1_LAUNCHXL_UARTName - * @brief Enum of UARTs - */ -typedef enum CC26X2R1_LAUNCHXL_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC26X2R1_LAUNCHXL_UART0 = 0, -#endif -#if TI_UART_CONF_UART1_ENABLE - CC26X2R1_LAUNCHXL_UART1, -#endif - - CC26X2R1_LAUNCHXL_UARTCOUNT -} CC26X2R1_LAUNCHXL_UARTName; - -/*! - * @def CC26X2R1_LAUNCHXL_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC26X2R1_LAUNCHXL_UDMAName { - CC26X2R1_LAUNCHXL_UDMA0 = 0, - - CC26X2R1_LAUNCHXL_UDMACOUNT -} CC26X2R1_LAUNCHXL_UDMAName; - -/*! - * @def CC26X2R1_LAUNCHXL_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC26X2R1_LAUNCHXL_WatchdogName { - CC26X2R1_LAUNCHXL_WATCHDOG0 = 0, - - CC26X2R1_LAUNCHXL_WATCHDOGCOUNT -} CC26X2R1_LAUNCHXL_WatchdogName; - -#ifdef __cplusplus -} -#endif - -#endif /* __CC26X2R1_LAUNCHXL_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL_fxns.c deleted file mode 100644 index 606339f2d..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/CC26X2R1_LAUNCHXL_fxns.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * =================== CC26X2R1_LAUNCHXL_fxns.c ============================ - * This file contains the board-specific initialization functions. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include - -#include "Board.h" - -/* - * ======== CC26X2R1_LAUNCHXL_sendExtFlashByte ======== - */ -void CC26X2R1_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC26X2R1_LAUNCHXL_wakeUpExtFlash ======== - */ -void CC26X2R1_LAUNCHXL_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC26X2R1_LAUNCHXL_shutDownExtFlash ======== - */ -void CC26X2R1_LAUNCHXL_shutDownExtFlash(void) -{ - /* - * To be sure we are putting the flash into sleep and not waking it, - * we first have to make a wake up call - */ - CC26X2R1_LAUNCHXL_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC26X2R1_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC26X2R1_LAUNCHXL_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/Makefile.cc26x2r1 b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/Makefile.cc26x2r1 deleted file mode 100644 index 803b592c0..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/Makefile.cc26x2r1 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x2-cc26x2 -DEVICE_FAMILY = CC26X2 -DEVICE_LINE = CC26XX -DEVICE = CC2652R - -BOARD_SOURCEFILES += CC26X2R1_LAUNCHXL.c CC26X2R1_LAUNCHXL_fxns.c - -SUPPORTS_PROP_MODE = 0 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 0 - -# Include the common board makefile -include $(FAMILY_PATH)/launchpad/Makefile.launchpad diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/rf-conf.h deleted file mode 100644 index ed58c8732..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc26x2r1/rf-conf.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for the 2.4 GHz path - * on the radio. - * - * These are the following front-end mode configurations for the - * CC26X2R1-LAUNCHXL board: - * - 2.4 GHz: differential and internal bias - * - * @{ - */ -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_INTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/leds-arch.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/leds-arch.c deleted file mode 100644 index 85065e104..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/leds-arch.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * LED HAL definitions for the LaunchPad LEDs. Common across all - * CC13xx/CC26xx LaunchPad LEDs. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/leds.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - /* Red LED, AKA LED0 */ - { .pin = Board_PIN_LED0, .negative_logic = false }, - /* Green LED, AKA LED1 */ - { .pin = Board_PIN_LED1, .negative_logic = false }, -}; -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/platform.c b/arch/platform/simplelink/cc13xx-cc26xx/platform.c deleted file mode 100644 index 56030445a..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/platform.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-platform - * @{ - * - * \file - * Setup the SimpleLink CC13xx/CC26xx ecosystem with the - * Contiki environment. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "contiki-net.h" -#include "sys/clock.h" -#include "sys/rtimer.h" -#include "sys/node-id.h" -#include "sys/platform.h" -#include "dev/button-hal.h" -#include "dev/gpio-hal.h" -#include "dev/serial-line.h" -#include "dev/leds.h" -#include "net/mac/framer/frame802154.h" -#include "lib/random.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/driverlib_release.h) -#include DeviceFamily_constructPath(driverlib/chipinfo.h) -#include DeviceFamily_constructPath(driverlib/vims.h) - -#include -#include -#include -#include -#include -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#include "board-peripherals.h" -#include "uart0-arch.h" -#include "trng-arch.h" -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -#include "rf/ble-beacond.h" -#include "rf/ieee-addr.h" -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "CC13xx/CC26xx" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -/* - * Board-specific initialization function. This function is defined in - * the _fxns.c file. - */ -extern void Board_initHook(void); -/*---------------------------------------------------------------------------*/ -/* - * \brief Fade a specified LED. - */ -static void -fade(PIN_Id pin) -{ - volatile uint32_t i; - uint32_t k; - uint32_t j; - uint32_t pivot = 800; - uint32_t pivot_half = pivot / 2; - - for(k = 0; k < pivot; ++k) { - j = (k > pivot_half) ? pivot - k : k; - - PINCC26XX_setOutputValue(pin, 1); - for(i = 0; i < j; ++i) { - __asm__ __volatile__ ("nop"); - } - PINCC26XX_setOutputValue(pin, 0); - for(i = 0; i < pivot_half - j; ++i) { - __asm__ __volatile__ ("nop"); - } - } -} -/*---------------------------------------------------------------------------*/ -/* - * \brief Configure RF params for the radio driver. - */ -static void -set_rf_params(void) -{ - uint8_t ext_addr[8]; - uint16_t short_addr; - - memset(ext_addr, 0x0, sizeof(ext_addr)); - - ieee_addr_cpy_to(ext_addr, sizeof(ext_addr)); - - /* Short address is the last two bytes of the MAC address */ - short_addr = (((uint16_t)ext_addr[7] << 0) | - ((uint16_t)ext_addr[6] << 8)); - - NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID); - NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr); - NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, sizeof(ext_addr)); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one(void) -{ - DRIVERLIB_ASSERT_CURR_RELEASE(); - - /* Enable flash cache */ - VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED); - /* Configure round robin arbitration and prefetching */ - VIMSConfigure(VIMS_BASE, true, true); - - Power_init(); - - /* BoardGpioInitTable declared in Board.h */ - if(PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* - * Something is seriously wrong if PIN initialization of the Board GPIO - * table fails. - */ - for(;;) { /* hang */ } - } - - /* Perform board-specific initialization */ - Board_initHook(); - - /* Contiki drivers init */ - gpio_hal_init(); - leds_init(); - - fade(Board_PIN_LED0); - - /* TI Drivers init */ -#if TI_UART_CONF_ENABLE - UART_init(); -#endif -#if TI_I2C_CONF_ENABLE - I2C_init(); -#endif -#if TI_SPI_CONF_ENABLE - SPI_init(); -#endif -#if TI_NVS_CONF_ENABLE - NVS_init(); -#endif - - TRNG_init(); - - fade(Board_PIN_LED1); - - /* NoRTOS must be called last */ - NoRTOS_start(); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two(void) -{ - serial_line_init(); - -#if TI_UART_CONF_UART0_ENABLE - uart0_init(); -#endif - -#if BUILD_WITH_SHELL - uart0_set_callback(serial_line_input_byte); -#endif - - /* Use TRNG to seed PRNG. If TRNG fails, use a hard-coded seed. */ - unsigned short seed = 0; - if(!trng_rand((uint8_t *)&seed, sizeof(seed), TRNG_WAIT_FOREVER)) { - /* Default to some hard-coded seed. */ - seed = 0x1234; - } - random_init(seed); - - /* Populate linkaddr_node_addr */ - ieee_addr_cpy_to(linkaddr_node_addr.u8, LINKADDR_SIZE); - - button_hal_init(); - - fade(Board_PIN_LED0); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three(void) -{ -#if RF_CONF_BLE_BEACON_ENABLE - rf_ble_beacond_init(); -#endif - - radio_value_t chan = 0; - radio_value_t pan = 0; - - set_rf_params(); - - LOG_DBG("With DriverLib v%u.%u\n", DRIVERLIB_RELEASE_GROUP, - DRIVERLIB_RELEASE_BUILD); - LOG_DBG("IEEE 802.15.4: %s, Sub-1 GHz: %s, BLE: %s\n", - ChipInfo_SupportsIEEE_802_15_4() ? "Yes" : "No", - ChipInfo_SupportsPROPRIETARY() ? "Yes" : "No", - ChipInfo_SupportsBLE() ? "Yes" : "No"); - -#if (RF_MODE == RF_MODE_SUB_1_GHZ) - LOG_INFO("Operating frequency on Sub-1 GHz\n"); -#elif (RF_MODE == RF_MODE_2_4_GHZ) - LOG_INFO("Operating frequency on 2.4 GHz\n"); -#endif - - NETSTACK_RADIO.get_value(RADIO_PARAM_CHANNEL, &chan); - LOG_INFO("RF: Channel %d", chan); - - if(NETSTACK_RADIO.get_value(RADIO_PARAM_PAN_ID, &pan) == RADIO_RESULT_OK) { - LOG_INFO_(", PANID 0x%04X", pan); - } - LOG_INFO_("\n"); - - LOG_INFO("Node ID: %d\n", node_id); - -#if BOARD_CONF_SENSORS_ENABLE - process_start(&sensors_process, NULL); -#endif - - fade(Board_PIN_LED1); -} -/*---------------------------------------------------------------------------*/ -void -platform_idle(void) -{ - /* Drop to some low power mode */ - Power_idleFunc(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/Makefile.sensortag b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/Makefile.sensortag deleted file mode 100644 index cdb55c48f..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/Makefile.sensortag +++ /dev/null @@ -1,13 +0,0 @@ -################################################################################ -# SimpleLink LaunchPad makefile - -BOARD_TYPE = BOARD_SENSORTAG - -# leds-arch.c etc. -BOARD_SOURCEFILES += sensortag-sensors.c -BOARD_SOURCEFILES += button-sensor-arch.c -BOARD_SOURCEFILES += bmp-280-sensor.c hdc-1000-sensor.c -BOARD_SOURCEFILES += mpu-9250-sensor.c opt-3001-sensor.c -BOARD_SOURCEFILES += tmp-007-sensor.c buzzer.c - -TARGET_FAMILY_DIRS += sensortag \ No newline at end of file diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/bmp-280-sensor.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/bmp-280-sensor.c deleted file mode 100644 index bf47c1571..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/bmp-280-sensor.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-bmp-sensor - * @{ - * - * \file - * Driver for the Sensortag BMP280 Altimeter / Pressure Sensor - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "sys/ctimer.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -#include "bmp-280-sensor.h" -/*---------------------------------------------------------------------------*/ -#include - -#include -/*---------------------------------------------------------------------------*/ -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* - * Disable the entire file if sensors are disabled, as it could potentially - * create compile errors with missing defines from either the Board file or - * configuration defines. - */ -#if BOARD_SENSORS_ENABLE -/*---------------------------------------------------------------------------*/ -#ifndef Board_BMP280_ADDR -#error "Board file doesn't define I2C address Board_BMP280_ADDR" -#endif -/* Sensor I2C address */ -#define BMP280_I2C_ADDRESS Board_BMP280_ADDR -/*---------------------------------------------------------------------------*/ -/* Registers */ -#define ADDR_CALIB 0x88 -#define ADDR_PROD_ID 0xD0 -#define ADDR_RESET 0xE0 -#define ADDR_STATUS 0xF3 -#define ADDR_CTRL_MEAS 0xF4 -#define ADDR_CONFIG 0xF5 -#define ADDR_PRESS_MSB 0xF7 -#define ADDR_PRESS_LSB 0xF8 -#define ADDR_PRESS_XLSB 0xF9 -#define ADDR_TEMP_MSB 0xFA -#define ADDR_TEMP_LSB 0xFB -#define ADDR_TEMP_XLSB 0xFC -/*---------------------------------------------------------------------------*/ -/* Reset values */ -#define VAL_PROD_ID 0x58 -#define VAL_RESET 0x00 -#define VAL_STATUS 0x00 -#define VAL_CTRL_MEAS 0x00 -#define VAL_CONFIG 0x00 -#define VAL_PRESS_MSB 0x80 -#define VAL_PRESS_LSB 0x00 -#define VAL_TEMP_MSB 0x80 -#define VAL_TEMP_LSB 0x00 -/*---------------------------------------------------------------------------*/ -/* Test values */ -#define VAL_RESET_EXECUTE 0xB6 -#define VAL_CTRL_MEAS_TEST 0x55 -/*---------------------------------------------------------------------------*/ -/* Misc. */ -#define MEAS_DATA_SIZE 6 -#define CALIB_DATA_SIZE 24 -/*---------------------------------------------------------------------------*/ -#define RES_OFF 0 -#define RES_ULTRA_LOW_POWER 1 -#define RES_LOW_POWER 2 -#define RES_STANDARD 3 -#define RES_HIGH 5 -#define RES_ULTRA_HIGH 6 -/*---------------------------------------------------------------------------*/ -/* Bit fields in CTRL_MEAS register */ -#define PM_OFF 0 -#define PM_FORCED 1 -#define PM_NORMAL 3 -/*---------------------------------------------------------------------------*/ -#define OSRST(v) ((v) << 5) -#define OSRSP(v) ((v) << 2) -/*---------------------------------------------------------------------------*/ -typedef struct { - uint16_t dig_t1; - int16_t dig_t2; - int16_t dig_t3; - uint16_t dig_p1; - int16_t dig_p2; - int16_t dig_p3; - int16_t dig_p4; - int16_t dig_p5; - int16_t dig_p6; - int16_t dig_p7; - int16_t dig_p8; - int16_t dig_p9; -} BMP_280_Calibration; -/*---------------------------------------------------------------------------*/ -static BMP_280_Calibration calib_data; -/*---------------------------------------------------------------------------*/ -static I2C_Handle i2c_handle; -/*---------------------------------------------------------------------------*/ -typedef enum { - SENSOR_STATUS_DISABLED, - SENSOR_STATUS_INITIALISED, - SENSOR_STATUS_NOT_READY, - SENSOR_STATUS_READY -} SENSOR_STATUS; - -static volatile SENSOR_STATUS sensor_status = SENSOR_STATUS_DISABLED; -/*---------------------------------------------------------------------------*/ -/* Wait SENSOR_STARTUP_DELAY clock ticks for the sensor to be ready - ~80ms */ -#define SENSOR_STARTUP_DELAY 3 - -static struct ctimer startup_timer; -/*---------------------------------------------------------------------------*/ -static void -notify_ready(void *unused) -{ - (void)unused; - - sensor_status = SENSOR_STATUS_READY; - sensors_changed(&bmp_280_sensor); -} -/*---------------------------------------------------------------------------*/ -static bool -i2c_write_read(void *writeBuf, size_t writeCount, void *readBuf, size_t readCount) -{ - I2C_Transaction i2cTransaction = { - .writeBuf = writeBuf, - .writeCount = writeCount, - .readBuf = readBuf, - .readCount = readCount, - .slaveAddress = BMP280_I2C_ADDRESS, - }; - - return I2C_transfer(i2c_handle, &i2cTransaction); -} -#define i2c_write(writeBuf, writeCount) i2c_write_read(writeBuf, writeCount, NULL, 0) -#define i2c_read(readBuf, readCount) i2c_write_read(NULL, 0, readBuf, readCount) -/*---------------------------------------------------------------------------*/ -/** - * \brief Initalise the sensor. - * \return Boolean Value descibing whether initialization were - * successful or not. - * \retval true Successful initialization - * \retval false Error during initialization - */ -static bool -init(void) -{ - if(i2c_handle) { - return true; - } - - I2C_Params i2cParams; - I2C_Params_init(&i2cParams); - - i2cParams.transferMode = I2C_MODE_BLOCKING; - i2cParams.bitRate = I2C_400kHz; - - i2c_handle = I2C_open(Board_I2C0, &i2cParams); - if(i2c_handle == NULL) { - return false; - } - - uint8_t reset_data[] = { ADDR_RESET, VAL_RESET_EXECUTE }; - - uint8_t calib_reg = ADDR_CALIB; - /* Read and store calibration data */ - return i2c_write_read(&calib_reg, sizeof(calib_reg), &calib_data, sizeof(calib_data)) - /* then reset the sensor */ - && i2c_write(reset_data, sizeof(reset_data)); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Enable/disable measurements. - * \param enable Enable if true; else, disable. - * \return Boolean Value descibing whether initialization were - * successful or not. - * \retval true Successful initialization - * \retval false Error during initialization - */ -static bool -enable_sensor(bool enable) -{ - uint8_t val = (enable) - ? PM_FORCED | OSRSP(1) | OSRST(1) - : PM_OFF; - - uint8_t ctrl_meas_data[] = { ADDR_CTRL_MEAS, val }; - return i2c_write(&ctrl_meas_data, sizeof(ctrl_meas_data)); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Read temperature and pressure data. - * \param data Pointer to a buffer where temperature and pressure will be - * written. - * \param count Number of byes to read. - * \return Boolean Value descibing whether initialization were - * successful or not. - * \retval true Successful initialization - * \retval false Error during initialization - */ -static bool -read_data(uint8_t *data, size_t count) -{ - uint8_t press_msb_reg = ADDR_PRESS_MSB; - return i2c_write_read(&press_msb_reg, sizeof(press_msb_reg), data, count); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert raw data to values in degrees C (temp) and Pascal - * (pressure). - * \param data Pointer to a buffer that holds raw sensor data. - * \param temp Pointer to a variable where the converted temperature will - * be written. - * \param press Pointer to a variable where the converted pressure will be - * written. - */ -static void -convert(uint8_t *data, int32_t *temp, uint32_t *press) -{ - BMP_280_Calibration *p = &calib_data; - - /* Pressure */ - const int32_t upress = (int32_t)( - (((uint32_t)data[0]) << 12) | - (((uint32_t)data[1]) << 4) | - (((uint32_t)data[2]) >> 4) - ); - /* Temperature */ - const int32_t utemp = (int32_t)( - (((uint32_t)data[3]) << 12) | - (((uint32_t)data[4]) << 4) | - (((uint32_t)data[5]) >> 4) - ); - - /* Compensate temperature */ - int32_t v_x1_u32r = (((utemp >> 3) - ((int32_t)p->dig_t1 << 1)) * (int32_t)p->dig_t2) >> 11; - int32_t v_x2_u32r = (((((utemp >> 4) - (int32_t)p->dig_t1) * ((utemp >> 4) - (int32_t)p->dig_t1)) >> 12) * (int32_t)p->dig_t3) >> 14; - - const uint32_t t_fine = v_x1_u32r + v_x2_u32r; - const int32_t temperature = (t_fine * 5 + 128) >> 8; - *temp = temperature; - - /* Compensate pressure */ - v_x1_u32r = ((int32_t)t_fine >> 1) - (int32_t)64000; - v_x2_u32r = (((v_x1_u32r >> 2) * (v_x1_u32r >> 2)) >> 11) * (int32_t)p->dig_p6; - v_x2_u32r = ((v_x1_u32r * (int32_t)p->dig_p5) << 1) + v_x2_u32r; - v_x2_u32r = (v_x2_u32r >> 2) + ((int32_t)p->dig_p4 << 16); - v_x1_u32r = ((((((v_x1_u32r >> 2) * (v_x1_u32r >> 2)) >> 13) * p->dig_p3) >> 3) + (((int32_t)p->dig_p2 * v_x1_u32r) >> 1)) >> 18; - v_x1_u32r = ((32768 + v_x1_u32r) * (int32_t)p->dig_p1) >> 15; - - if(v_x1_u32r == 0) { - /* Avoid exception caused by division by zero */ - *press = 0; - return; - } - - uint32_t pressure = (((uint32_t)((int32_t)1048576 - upress)) - (v_x2_u32r >> 12)) * 3125; - if((int32_t)pressure < 0) { - pressure = (pressure << 1) / (uint32_t)v_x1_u32r; - } else { - pressure = (pressure / (uint32_t)v_x1_u32r) * 2; - } - - v_x1_u32r = (((int32_t)(((pressure >> 3) * (pressure >> 3)) >> 13)) * (int32_t)p->dig_p9) >> 12; - v_x2_u32r = ((int32_t)(pressure >> 2) * (int32_t)p->dig_p8) >> 13; - pressure = (uint32_t)(((v_x1_u32r + v_x2_u32r + p->dig_p7) >> 4) + (int32_t)pressure); - - *press = pressure; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor. - * \param type Parameter of type BMP_280_SENSOR_TYPE, choosing between either - * measuring temperature or pressure. - * \return Sensor data of either Temperature (centi degrees C) or - * Pressure (Pascal). - */ -static int -value(int type) -{ - int32_t temp = 0; - uint32_t pres = 0; - - if(sensor_status != SENSOR_STATUS_READY) { - PRINTF("Sensor disabled or starting up (%d)\n", sensor_status); - return BMP_280_READING_ERROR; - } - - /* A buffer for the raw reading from the sensor */ - uint8_t sensor_value[MEAS_DATA_SIZE]; - - switch(type) { - case BMP_280_SENSOR_TYPE_TEMP: - case BMP_280_SENSOR_TYPE_PRESS: - memset(sensor_value, 0, MEAS_DATA_SIZE); - if(!read_data(sensor_value, MEAS_DATA_SIZE)) { - return BMP_280_READING_ERROR; - } - - PRINTF("val: %02x%02x%02x %02x%02x%02x\n", - sensor_value[0], sensor_value[1], sensor_value[2], - sensor_value[3], sensor_value[4], sensor_value[5]); - - convert(sensor_value, &temp, &pres); - - if(type == BMP_280_SENSOR_TYPE_TEMP) { - return (int)temp; - } else if(type == BMP_280_SENSOR_TYPE_PRESS) { - return (int)pres; - } else { - return 0; - } - - default: - PRINTF("Invalid BMP 208 Sensor Type\n"); - return BMP_280_READING_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the BMP280 sensor. - * \param type Activate, enable or disable the sensor. See below - * \param enable Disable sensor if 0; else, enable sensor otherwise. - * When type == SENSORS_HW_INIT we turn on the hardware. - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor. - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor. - */ -static int -configure(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - if(init()) { - enable_sensor(false); - sensor_status = SENSOR_STATUS_INITIALISED; - } else { - sensor_status = SENSOR_STATUS_DISABLED; - } - break; - - case SENSORS_ACTIVE: - /* Must be initialised first */ - if(sensor_status == SENSOR_STATUS_DISABLED) { - break; - } - if(enable) { - enable_sensor(true); - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready, NULL); - sensor_status = SENSOR_STATUS_NOT_READY; - } else { - ctimer_stop(&startup_timer); - enable_sensor(false); - sensor_status = SENSOR_STATUS_INITIALISED; - } - break; - - default: - break; - } - return sensor_status; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor. - * \param type SENSORS_ACTIVE or SENSORS_READY. - * \return Current status of the sensor. - */ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return sensor_status; - default: - return SENSOR_STATUS_DISABLED; - } -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(bmp_280_sensor, "BMP280", value, configure, status); -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_SENSORS_ENABLE */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/bmp-280-sensor.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/bmp-280-sensor.h deleted file mode 100644 index 02b2034b1..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/bmp-280-sensor.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-peripherals - * @{ - * - * \defgroup sensortag-bmp-sensor SensorTag Pressure Sensor - * - * Due to the time required for the sensor to startup, this driver is meant to - * be used in an asynchronous fashion. The caller must first activate the - * sensor by calling SENSORS_ACTIVATE(). This will trigger the sensor's startup - * sequence, but the call will not wait for it to complete so that the CPU can - * perform other tasks or drop to a low power mode. - * - * Once the sensor is stable, the driver will generate a sensors_changed event. - * - * We take readings in "Forced" mode. In this mode, the BMP will take a single - * measurement and it will then automatically go to sleep. - * - * SENSORS_ACTIVATE must be called again to trigger a new reading cycle - * @{ - * - * \file - * Header file for the Sensortag BMP280 Altimeter / Pressure Sensor - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef BMP_280_SENSOR_H_ -#define BMP_280_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -/*---------------------------------------------------------------------------*/ -/* The BMP-280 driver uses the I2C0 peripheral to access the senssor */ -#if BOARD_SENSORS_ENABLE -#if (TI_I2C_CONF_ENABLE == 0) || (TI_I2C_CONF_I2C0_ENABLE == 0) -#error "The BMP280 requires the I2C driver (TI_I2C_CONF_ENABLE = 1)" -#endif -#endif -/*---------------------------------------------------------------------------*/ -typedef enum { - BMP_280_SENSOR_TYPE_TEMP, - BMP_280_SENSOR_TYPE_PRESS -} BMP_280_SENSOR_TYPE; -/*---------------------------------------------------------------------------*/ -#define BMP_280_READING_ERROR -1 -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor bmp_280_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* BMP_280_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/board-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/board-conf.h deleted file mode 100644 index 5ff2f78d8..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/board-conf.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-platform - * @{ - * - * \defgroup sensortag-peripherals Sensortag peripherals - * - * Defines related to configuring SensorTag peripherals. The two sensortags, - * CC1350STK and CC2650STK, are identical to a very large extent. - * Everything documented within this group applies to both sensortags. - * - * @{ - * - * \file - * Header file with definitions related to the sensors on the Sensortags - * \author - * Edvard Pettersen - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_CONF_H_ -#define BOARD_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf-conf.h" -#include "leds-arch.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED configurations for the dev/leds.h API. The actual LED - * configuration of available LEDs are done in leds-arch.h. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define PLATFORM_HAS_LEDS 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button configurations for the dev/button-hal.h API. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define PLATFORM_HAS_BUTTON 1 -#define PLATFORM_SUPPORTS_BUTTON_HAL 1 - -#define BUTTON_HAL_ID_KEY_LEFT 0 -#define BUTTON_HAL_ID_KEY_RIGHT 1 -#define BUTTON_HAL_ID_REED_RELAY 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SensorTag does have sensors. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_CONF_HAS_SENSORS 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Enable or disable the SensorTag sensors. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_SENSORS_ENABLE (!(BOARD_CONF_SENSORS_DISABLE)) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name The external flash SPI CS pin, defined in Board.h. - * - * Those values are not meant to be modified by the user - * @{ - */ -#if TI_SPI_CONF_SPI0_ENABLE -#define EXT_FLASH_SPI_CONTROLLER Board_SPI0 - -#define EXT_FLASH_SPI_PIN_SCK Board_SPI0_SCK -#define EXT_FLASH_SPI_PIN_MOSI Board_SPI0_MOSI -#define EXT_FLASH_SPI_PIN_MISO Board_SPI0_MISO -#define EXT_FLASH_SPI_PIN_CS Board_SPI_FLASH_CS - -#define EXT_FLASH_DEVICE_ID 0x14 -#define EXT_FLASH_MID 0xC2 - -#define EXT_FLASH_PROGRAM_PAGE_SIZE 256 -#define EXT_FLASH_ERASE_SECTOR_SIZE 4096 -#endif /* TI_SPI_CONF_SPI0_ENABLE */ -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/board-peripherals.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/board-peripherals.h deleted file mode 100644 index 7a4f8c19b..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/board-peripherals.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-platform - * @{ - * - * \defgroup sensortag-peripherals Sensortag peripherals - * - * Defines related to configuring SensorTag peripherals. The two sensortags, - * CC1350STK and CC2650STK, are identical to a very large extent. - * Everything documented within this group applies to both sensortags. - * - * @{ - * - * \file - * Header file with definitions related to the sensors on the Sensortags - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_PERIPHERALS_H_ -#define BOARD_PERIPHERALS_H_ -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -/*---------------------------------------------------------------------------*/ -#include "bmp-280-sensor.h" -#include "tmp-007-sensor.h" -#include "opt-3001-sensor.h" -#include "hdc-1000-sensor.h" -#include "mpu-9250-sensor.h" -#include "buzzer.h" -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_PERIPHERALS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/button-sensor-arch.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/button-sensor-arch.c deleted file mode 100644 index 4b2ccba9b..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/button-sensor-arch.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-peripherals - * @{ - * - * \file - * Button HAL definitions for the SensorTag buttons. Common across - * all CC13xx/CC26xx SensorTag boards. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/button-hal.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -/* Key left button, AKA BTN-1 */ -BUTTON_HAL_BUTTON( - key_left, /**< Name */ - "Key Left", /**< Description */ - Board_KEY_LEFT, /**< PIN */ - GPIO_HAL_PIN_CFG_PULL_UP | - GPIO_HAL_PIN_CFG_HYSTERESIS, /**< Pull configuration */ - BUTTON_HAL_ID_KEY_LEFT, /**< Unique ID */ - true); /**< Negative logic */ - -/* Key right button, AKA BTN-2 */ -BUTTON_HAL_BUTTON( - key_right, /**< Name */ - "Key Right", /**< Description */ - Board_KEY_RIGHT, /**< PIN */ - GPIO_HAL_PIN_CFG_PULL_UP | - GPIO_HAL_PIN_CFG_HYSTERESIS, /**< Pull configuration */ - BUTTON_HAL_ID_KEY_RIGHT, /**< Unique ID */ - true); /**< Negative logic */ - -/* Reed Relay button */ -BUTTON_HAL_BUTTON( - reed_relay, /**< Name */ - "Reed Relay", /**< Description */ - Board_RELAY, /**< PIN */ - GPIO_HAL_PIN_CFG_PULL_DOWN | - GPIO_HAL_PIN_CFG_HYSTERESIS, /**< Pull configuration */ - BUTTON_HAL_ID_REED_RELAY, /**< Unique ID */ - true); /**< Negative logic */ -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTONS(&key_left, &key_right, &reed_relay); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/buzzer.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/buzzer.c deleted file mode 100644 index 1815a370d..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/buzzer.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sensortag-buzzer - * @{ - * - * \file - * Driver for the Sensortag Buzzer. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "buzzer.h" -/*---------------------------------------------------------------------------*/ -#include -#include -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Configure BUZZER pin */ -#ifndef Board_BUZZER -#error "Board file doesn't define pin Board_BUZZER" -#endif -#define BUZZER_PIN Board_BUZZER -/*---------------------------------------------------------------------------*/ -static const PIN_Config pin_table[] = { - BUZZER_PIN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW, - PIN_TERMINATE -}; - -static PIN_State pin_state; -static PIN_Handle pin_handle; - -static GPTimerCC26XX_Handle gpt_handle; - -static bool has_init; -static volatile bool is_running; -/*---------------------------------------------------------------------------*/ -bool -buzzer_init() -{ - if(has_init) { - return true; - } - - GPTimerCC26XX_Params gpt_params; - GPTimerCC26XX_Params_init(&gpt_params); - - gpt_params.mode = GPT_CONFIG_16BIT; - gpt_params.mode = GPT_MODE_PERIODIC_UP; - gpt_params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF; - - gpt_handle = GPTimerCC26XX_open(Board_GPTIMER0A, &gpt_params); - if(!gpt_handle) { - return false; - } - - is_running = false; - - has_init = true; - return true; -} -/*---------------------------------------------------------------------------*/ -bool -buzzer_running() -{ - return is_running; -} -/*---------------------------------------------------------------------------*/ -bool -buzzer_start(uint32_t freq) -{ - if(!has_init) { - return false; - } - - if(freq == 0) { - return false; - } - - if(is_running) { - return true; - } - - pin_handle = PIN_open(&pin_state, pin_table); - if(!pin_handle) { - return false; - } - - Power_setDependency(PowerCC26XX_XOSC_HF); - - PINCC26XX_setMux(pin_handle, BUZZER_PIN, GPT_PIN_0A); - - /* MCU runs at 48 MHz */ - GPTimerCC26XX_Value load_value = (48 * 1000 * 1000) / freq; - - GPTimerCC26XX_setLoadValue(gpt_handle, load_value); - GPTimerCC26XX_start(gpt_handle); - - is_running = true; - return true; -} -/*---------------------------------------------------------------------------*/ -void -buzzer_stop() -{ - if(!gpt_handle) { - return; - } - - if(!is_running) { - return; - } - - Power_releaseDependency(PowerCC26XX_XOSC_HF); - - GPTimerCC26XX_stop(gpt_handle); - - PIN_close(pin_handle); - pin_handle = NULL; - - is_running = false; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/buzzer.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/buzzer.h deleted file mode 100644 index 3895be4b7..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/buzzer.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-peripherals - * @{ - * - * \defgroup sensortag-buzzer SensorTag Buzzer - * @{ - * - * \file - * Header file for the Sensortag Buzzer. - * \author - * Edvard Pettersen . - */ -/*---------------------------------------------------------------------------*/ -#ifndef BUZZER_H_ -#define BUZZER_H_ -/*---------------------------------------------------------------------------*/ -#include -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise the buzzer - */ -bool buzzer_init(void); - -/** - * \brief Start the buzzer. - * \param freq The buzzer frequency in Hz. - */ -bool buzzer_start(uint32_t freq); - -/** - * \brief Stop the buzzer. - */ -void buzzer_stop(void); - -/** - * \brief Retrieve the buzzer state. - * \return Running status of the buzzer. - * \retval 0 Buzzer is off - * \retval 1 Buzzer is on - */ -bool buzzer_running(void); -/*---------------------------------------------------------------------------*/ -#endif /* BUZZER_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/Board.h deleted file mode 100644 index e32e74fc1..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/Board.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC1350STK.h" - -#define Board_CC1350STK -#define BOARD_STRING "TI CC1350 SensorTag" - -#define Board_initGeneral() CC1350STK_initGeneral() -#define Board_shutDownExtFlash() CC1350STK_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC1350STK_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_BUZZER CC1350STK_BUZZER -#define Board_BUZZER_ON CC1350STK_LED_ON -#define Board_BUZZER_OFF CC1350STK_LED_OFF - -#define Board_CRYPTO0 CC1350STK_CRYPTO0 - -#define Board_GPIO_BUTTON0 CC1350STK_GPIO_S1 -#define Board_GPIO_BUTTON1 CC1350STK_GPIO_S2 -#define Board_GPIO_LED0 CC1350STK_GPIO_LED0 -#define Board_GPIO_LED1 CC1350STK_GPIO_LED0 -#define Board_GPIO_LED_ON CC1350STK_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC1350STK_GPIO_LED_OFF - -#define Board_GPTIMER0A CC1350STK_GPTIMER0A -#define Board_GPTIMER0B CC1350STK_GPTIMER0B -#define Board_GPTIMER1A CC1350STK_GPTIMER1A -#define Board_GPTIMER1B CC1350STK_GPTIMER1B -#define Board_GPTIMER2A CC1350STK_GPTIMER2A -#define Board_GPTIMER2B CC1350STK_GPTIMER2B -#define Board_GPTIMER3A CC1350STK_GPTIMER3A -#define Board_GPTIMER3B CC1350STK_GPTIMER3B - -#define Board_I2C0 CC1350STK_I2C0 -#define Board_I2C0_SDA1 CC1350STK_I2C0_SDA1 -#define Board_I2C0_SCL1 CC1350STK_I2C0_SCL1 -#define Board_I2C_TMP CC1350STK_I2C0 - -#define Board_KEY_LEFT CC1350STK_KEY_LEFT -#define Board_KEY_RIGHT CC1350STK_KEY_RIGHT -#define Board_RELAY CC1350STK_RELAY - -#define Board_MIC_POWER CC1350STK_MIC_POWER -#define Board_MIC_POWER_OM CC1350STK_MIC_POWER_ON -#define Board_MIC_POWER_OFF CC1350STK_MIC_POWER_OFF - -#define Board_MPU_INT CC1350STK_MPU_INT -#define Board_MPU_POWER CC1350STK_MPU_POWER -#define Board_MPU_POWER_OFF CC1350STK_MPU_POWER_OFF -#define Board_MPU_POWER_ON CC1350STK_MPU_POWER_ON - -#define Board_TMP_RDY CC1350STK_TMP_RDY - -#define Board_NVSINTERNAL CC1350STK_NVSCC26XX0 -#define Board_NVSEXTERNAL CC1350STK_NVSSPI25X0 - -#define Board_PDM0 CC2650STK_PDM0 - -#define Board_PIN_BUTTON0 CC1350STK_KEY_LEFT -#define Board_PIN_BUTTON1 CC1350STK_KEY_RIGHT -#define Board_PIN_BTN1 CC1350STK_KEY_LEFT -#define Board_PIN_BTN2 CC1350STK_KEY_RIGHT -#define Board_PIN_LED0 CC1350STK_PIN_LED1 -#define Board_PIN_LED1 CC1350STK_PIN_LED1 -#define Board_PIN_LED2 CC1350STK_PIN_LED1 - -#define Board_PWM0 CC1350STK_PWM0 -#define Board_PWM1 CC1350STK_PWM0 -#define Board_PWM2 CC1350STK_PWM2 -#define Board_PWM3 CC1350STK_PWM3 -#define Board_PWM4 CC1350STK_PWM4 -#define Board_PWM5 CC1350STK_PWM5 -#define Board_PWM6 CC1350STK_PWM6 -#define Board_PWM7 CC1350STK_PWM7 - -#define Board_SPI0 CC1350STK_SPI0 -#define Board_SPI0_MISO CC1350STK_SPI0_MISO -#define Board_SPI0_MOSI CC1350STK_SPI0_MOSI -#define Board_SPI0_CLK CC1350STK_SPI0_CLK -#define Board_SPI0_CSN CC1350STK_SPI0_CSN -#define Board_SPI1 CC1350STK_SPI1 -#define Board_SPI1_MISO CC1350STK_SPI1_MISO -#define Board_SPI1_MOSI CC1350STK_SPI1_MOSI -#define Board_SPI1_CLK CC1350STK_SPI1_CLK -#define Board_SPI1_CSN CC1350STK_SPI1_CSN -#define Board_SPI_FLASH_CS CC1350STK_SPI_FLASH_CS -#define Board_FLASH_CS_ON CC1350STK_FLASH_CS_ON -#define Board_FLASH_CS_OFF CC1350STK_FLASH_CS_OFF - -#define Board_UART0 CC1350STK_UART0 - -#define Board_WATCHDOG0 CC1350STK_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_BMP280_ADDR (0x77) -#define Board_HDC1000_ADDR (0x43) -#define Board_MPU9250_ADDR (0x68) -#define Board_MPU9250_MAG_ADDR (0x0C) -#define Board_OPT3001_ADDR (0x45) -#define Board_TMP_ADDR (0x44) - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.c deleted file mode 100644 index de15954f0..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.c +++ /dev/null @@ -1,653 +0,0 @@ -/* - * Copyright (c) 2016-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC1350STK.c ========================================= - * This file is responsible for setting up the board specific items for the - * CC1350STK board. - */ - -#include -#include -#include - -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC1350STK.h" - -/* - * =============================== Crypto =============================== - */ -#include - -CryptoCC26XX_Object cryptoCC26XXObjects[CC1350STK_CRYPTOCOUNT]; - -const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC1350STK_CRYPTOCOUNT] = { - { - .baseAddr = CRYPTO_BASE, - .powerMngrId = PowerCC26XX_PERIPH_CRYPTO, - .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ, - .intPriority = ~0, - } -}; - -const CryptoCC26XX_Config CryptoCC26XX_config[CC1350STK_CRYPTOCOUNT] = { - { - .object = &cryptoCC26XXObjects[CC1350STK_CRYPTO0], - .hwAttrs = &cryptoCC26XXHWAttrs[CC1350STK_CRYPTO0] - } -}; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1350STK.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_04 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - /* Output pins */ - GPIOCC26XX_DIO_10 | GPIO_DO_NOT_CONFIG, /* LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1350STK.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC1350STK_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC1350STK_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1350STK_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1350STK_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC1350STK_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350STK_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC1350STK_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350STK_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC1350STK_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350STK_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC1350STK_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350STK_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC1350STK_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350STK_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC1350STK_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350STK_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC1350STK_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350STK_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC1350STK_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350STK_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC1350STK_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350STK_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC1350STK_I2C0_SDA0, - .sclPin = CC1350STK_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC1350STK_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC1350STK_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC1350STK_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC1350STK_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x1A000 -#define SECTORSIZE 0x1000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS and NVS SPI */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS SPI */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC1350STK_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC1350STK_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC1350STK_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PDM =============================== -*/ -#include -#include - -PDMCC26XX_Object pdmCC26XXObjects[CC1350STK_PDMCOUNT]; -PDMCC26XX_I2S_Object pdmCC26XXI2SObjects[CC1350STK_PDMCOUNT]; - -const PDMCC26XX_HWAttrs pdmCC26XXHWAttrs[CC1350STK_PDMCOUNT] = { - { - .micPower = CC1350STK_MIC_POWER, - .taskPriority = 2 - } -}; - -const PDMCC26XX_Config PDMCC26XX_config[CC1350STK_PDMCOUNT] = { - { - .object = &pdmCC26XXObjects[CC1350STK_PDM0], - .hwAttrs = &pdmCC26XXHWAttrs[CC1350STK_PDM0] - } -}; - -const PDMCC26XX_I2S_HWAttrs pdmC26XXI2SHWAttrs[CC1350STK_PDMCOUNT] = { - { - .baseAddr = I2S0_BASE, - .intNum = INT_I2S_IRQ, - .powerMngrId = PowerCC26XX_PERIPH_I2S, - .intPriority = ~0, - .mclkPin = PIN_UNASSIGNED, - .bclkPin = CC1350STK_AUDIO_CLK, - .wclkPin = PIN_UNASSIGNED, - .ad0Pin = CC1350STK_AUDIO_DI, - } -}; - -const PDMCC26XX_I2S_Config PDMCC26XX_I2S_config[CC1350STK_PDMCOUNT] = { - { - .object = &pdmCC26XXI2SObjects[CC1350STK_PDM0], - .hwAttrs = &pdmC26XXI2SHWAttrs[CC1350STK_PDM0] - } -}; - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC1350STK_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1350STK_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350STK_KEY_RIGHT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350STK_RELAY | PIN_INPUT_EN | PIN_PULLDOWN | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Relay is active high */ - CC1350STK_MPU_INT | PIN_INPUT_EN | PIN_PULLDOWN | PIN_IRQ_NEGEDGE | PIN_HYSTERESIS, /* MPU_INT is active low */ - CC1350STK_TMP_RDY | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS, /* TMP_RDY is active high */ - CC1350STK_BUZZER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Buzzer initially off */ - CC1350STK_MPU_POWER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* MPU initially on */ - CC1350STK_MIC_POWER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* MIC initially off */ - CC1350STK_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1350STK_SPI_DEVPK_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* DevPack chip select */ - CC1350STK_AUDIO_DI | PIN_INPUT_EN | PIN_PULLDOWN, /* Audio DI */ - CC1350STK_AUDIODO | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* Audio data out */ - CC1350STK_AUDIO_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC1350STK_DP2 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC1350STK_DP1 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC1350STK_DP0 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC1350STK_DP3 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC1350STK_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* DevPack */ - CC1350STK_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC1350STK_DEVPK_ID | PIN_INPUT_EN | PIN_NOPULL, /* Device pack ID - external PU */ - CC1350STK_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC1350STK_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC1350STK_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -const PowerCC26XX_Config PowerCC26XX_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1350STK_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1350STK_PWMCOUNT] = { - { .pwmPin = CC1350STK_PWMPIN0, .gpTimerUnit = CC1350STK_GPTIMER0A }, - { .pwmPin = CC1350STK_PWMPIN1, .gpTimerUnit = CC1350STK_GPTIMER0B }, - { .pwmPin = CC1350STK_PWMPIN2, .gpTimerUnit = CC1350STK_GPTIMER1A }, - { .pwmPin = CC1350STK_PWMPIN3, .gpTimerUnit = CC1350STK_GPTIMER1B }, - { .pwmPin = CC1350STK_PWMPIN4, .gpTimerUnit = CC1350STK_GPTIMER2A }, - { .pwmPin = CC1350STK_PWMPIN5, .gpTimerUnit = CC1350STK_GPTIMER2B }, - { .pwmPin = CC1350STK_PWMPIN6, .gpTimerUnit = CC1350STK_GPTIMER3A }, - { .pwmPin = CC1350STK_PWMPIN7, .gpTimerUnit = CC1350STK_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC1350STK_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350STK_PWM0], &pwmtimerCC26xxHWAttrs[CC1350STK_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350STK_PWM1], &pwmtimerCC26xxHWAttrs[CC1350STK_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350STK_PWM2], &pwmtimerCC26xxHWAttrs[CC1350STK_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350STK_PWM3], &pwmtimerCC26xxHWAttrs[CC1350STK_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350STK_PWM4], &pwmtimerCC26xxHWAttrs[CC1350STK_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350STK_PWM5], &pwmtimerCC26xxHWAttrs[CC1350STK_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350STK_PWM6], &pwmtimerCC26xxHWAttrs[CC1350STK_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350STK_PWM7], &pwmtimerCC26xxHWAttrs[CC1350STK_PWM7] }, -}; - -const uint_least8_t PWM_count = CC1350STK_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - .globalCallback = NULL, /* No board specific callback */ - .globalEventMask = 0 /* No events subscribed to */ -}; - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350STK_SPICOUNT]; - -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350STK_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0, - .rxChannelBitMask = 1< -#include - -TRNGCC26X0_Object trngCC26X0Object[CC1350STK_TRNGCOUNT]; - -const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1350STK_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC1350STK_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC1350STK_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC1350STK_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350STK_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1350STK_UART_TX, - .rxPin = CC1350STK_UART_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1350STK_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1350STK_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC1350STK_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1350STK_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC1350STK_UART0] - }, -#endif -}; - -const uint_least8_t UART_count = CC1350STK_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC1350STK_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC1350STK_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC1350STK_UDMACOUNT] = { - { - .object = &udmaObjects[CC1350STK_UDMA0], - .hwAttrs = &udmaHWAttrs[CC1350STK_UDMA0] - }, -}; - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC1350STK_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1350STK_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC1350STK_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC1350STK_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC1350STK_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC1350STK_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC1350STK_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC1350STK_initGeneral ======== - */ -void CC1350STK_initGeneral(void) -{ - Power_init(); - - if ( PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.h deleted file mode 100644 index 2347876b1..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK.h +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** ============================================================================ - * @file CC1350STK.h - * - * @brief CC1350STK Board Specific header file. - * - * The CC1350STK header file should be included in an application as - * follows: - * @code - * #include "CC1350STK.h" - * @endcode - * ============================================================================ - */ -#ifndef __CC1350STK_BOARD_H__ -#define __CC1350STK_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC1350STK - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Audio */ -#define CC1350STK_MIC_POWER IOID_13 -#define CC1350STK_MIC_POWER_ON 1 -#define CC1350STK_MIC_POWER_OFF 0 -#define CC1350STK_AUDIO_DI IOID_2 -#define CC1350STK_AUDIO_CLK IOID_3 - -/* Buzzer */ -#define CC1350STK_BUZZER IOID_21 -#define CC1350STK_BUZZER_ON 1 -#define CC1350STK_BUZZER_OFF 0 - -/* DevPack */ -#define CC1350STK_AUDIOFS_TDO IOID_16 -#define CC1350STK_AUDIODO IOID_22 -#define CC1350STK_DP2 IOID_23 -#define CC1350STK_DP1 IOID_24 -#define CC1350STK_DP0 IOID_25 -#define CC1350STK_DP3 IOID_27 -#define CC1350STK_DP4_UARTRX IOID_28 -#define CC1350STK_DP5_UARTTX IOID_29 -#define CC1350STK_DEVPK_ID IOID_30 -#define CC1350STK_SPI_DEVPK_CS IOID_20 - -/* Discrete Outputs */ -#define CC1350STK_PIN_LED1 IOID_10 -#define CC1350STK_LED_ON 1 -#define CC1350STK_LED_OFF 0 - - -/* Discrete Inputs */ -#define CC1350STK_KEY_LEFT IOID_15 -#define CC1350STK_KEY_RIGHT IOID_4 -#define CC1350STK_RELAY IOID_1 - -/* GPIO */ -#define CC1350STK_GPIO_LED_ON 1 -#define CC1350STK_GPIO_LED_OFF 0 - -/* I2C */ -#define CC1350STK_I2C0_SDA0 IOID_5 -#define CC1350STK_I2C0_SCL0 IOID_6 -#define CC1350STK_I2C0_SDA1 IOID_8 -#define CC1350STK_I2C0_SCL1 IOID_9 - -/* LED-Audio DevPack */ -#define CC1350STK_DEVPK_LIGHT_BLUE IOID_23 -#define CC1350STK_DEVPK_LIGHT_GREEN IOID_24 -#define CC1350STK_DEVPK_LIGHT_WHITE IOID_25 -#define CC1350STK_DEVPK_LIGHT_RED IOID_27 - -/* Power */ -#define CC1350STK_MPU_POWER IOID_12 -#define CC1350STK_MPU_POWER_ON 1 -#define CC1350STK_MPU_POWER_OFF 0 - -/* PWM */ -#define CC1350STK_PWMPIN0 CC1350STK_PIN_LED1 -#define CC1350STK_PWMPIN1 CC1350STK_PIN_LED1 -#define CC1350STK_PWMPIN2 PIN_UNASSIGNED -#define CC1350STK_PWMPIN3 PIN_UNASSIGNED -#define CC1350STK_PWMPIN4 PIN_UNASSIGNED -#define CC1350STK_PWMPIN5 PIN_UNASSIGNED -#define CC1350STK_PWMPIN6 PIN_UNASSIGNED -#define CC1350STK_PWMPIN7 PIN_UNASSIGNED - -/* Sensors */ -#define CC1350STK_MPU_INT IOID_7 -#define CC1350STK_TMP_RDY IOID_11 - -/* SPI */ -#define CC1350STK_SPI_FLASH_CS IOID_14 -#define CC1350STK_FLASH_CS_ON 0 -#define CC1350STK_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC1350STK_SPI0_MISO IOID_18 -#define CC1350STK_SPI0_MOSI IOID_19 -#define CC1350STK_SPI0_CLK IOID_17 -#define CC1350STK_SPI0_CSN PIN_UNASSIGNED -#define CC1350STK_SPI1_MISO PIN_UNASSIGNED -#define CC1350STK_SPI1_MOSI PIN_UNASSIGNED -#define CC1350STK_SPI1_CLK PIN_UNASSIGNED -#define CC1350STK_SPI1_CSN PIN_UNASSIGNED - -/* UART */ -#define CC1350STK_UART_TX CC1350STK_DP5_UARTTX -#define CC1350STK_UART_RX CC1350STK_DP4_UARTRX - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC1350STK_initGeneral(void); - -/*! - * @brief Turn off the external flash on LaunchPads - * - */ -void CC1350STK_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC1350STK_wakeUpExtFlash(void); - -/*! - * @def CC1350STK_CryptoName - * @brief Enum of Crypto names - */ -typedef enum CC1350STK_CryptoName { - CC1350STK_CRYPTO0 = 0, - - CC1350STK_CRYPTOCOUNT -} CC1350STK_CryptoName; - -/*! - * @def CC1350STK_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC1350STK_GPIOName { - CC1350STK_GPIO_S1 = 0, - CC1350STK_GPIO_S2, - CC1350STK_GPIO_LED0, - CC1350STK_GPIO_SPI_FLASH_CS, - - CC1350STK_GPIOCOUNT -} CC1350STK_GPIOName; - -/*! - * @def CC1350STK_GPTimerName - * @brief Enum of GPTimers parts - */ -typedef enum CC1350STK_GPTimerName { - CC1350STK_GPTIMER0A = 0, - CC1350STK_GPTIMER0B, - CC1350STK_GPTIMER1A, - CC1350STK_GPTIMER1B, - CC1350STK_GPTIMER2A, - CC1350STK_GPTIMER2B, - CC1350STK_GPTIMER3A, - CC1350STK_GPTIMER3B, - - CC1350STK_GPTIMERPARTSCOUNT -} CC1350STK_GPTimerName; - -/*! - * @def CC1350STK_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC1350STK_GPTimers { - CC1350STK_GPTIMER0 = 0, - CC1350STK_GPTIMER1, - CC1350STK_GPTIMER2, - CC1350STK_GPTIMER3, - - CC1350STK_GPTIMERCOUNT -} CC1350STK_GPTimers; - -/*! - * @def CC1350STK_I2CName - * @brief Enum of I2C names - */ -typedef enum CC1350STK_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC1350STK_I2C0 = 0, -#endif - - CC1350STK_I2CCOUNT -} CC1350STK_I2CName; - -/*! - * @def CC1350STK_NVSName - * @brief Enum of NVS names - */ -typedef enum CC1350STK_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC1350STK_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC1350STK_NVSSPI25X0, -#endif - - CC1350STK_NVSCOUNT -} CC1350STK_NVSName; - -/*! - * @def CC1350STK_PDMName - * @brief Enum of PDM names - */ -typedef enum CC1350STK_PDMName { - CC1350STK_PDM0 = 0, - - CC1350STK_PDMCOUNT -} CC1350STK_PDMName; - -/*! - * @def CC1350STK_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC1350STK_PWMName { - CC1350STK_PWM0 = 0, - CC1350STK_PWM1, - CC1350STK_PWM2, - CC1350STK_PWM3, - CC1350STK_PWM4, - CC1350STK_PWM5, - CC1350STK_PWM6, - CC1350STK_PWM7, - - CC1350STK_PWMCOUNT -} CC1350STK_PWMName; - -/*! - * @def CC1350STK_SPIName - * @brief Enum of SPI names - */ -typedef enum CC1350STK_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC1350STK_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC1350STK_SPI1, -#endif - - CC1350STK_SPICOUNT -} CC1350STK_SPIName; - -/*! - * @def CC1350STK_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC1350STK_TRNGName { - CC1350STK_TRNG0 = 0, - - CC1350STK_TRNGCOUNT -} CC1350STK_TRNGName; - -/*! - * @def CC1350STK_UARTName - * @brief Enum of UARTs - */ -typedef enum CC1350STK_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC1350STK_UART0 = 0, -#endif - - CC1350STK_UARTCOUNT -} CC1350STK_UARTName; - -/*! - * @def CC1350STK_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC1350STK_UDMAName { - CC1350STK_UDMA0 = 0, - - CC1350STK_UDMACOUNT -} CC1350STK_UDMAName; - -/*! - * @def CC1350STK_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC1350STK_WatchdogName { - CC1350STK_WATCHDOG0 = 0, - - CC1350STK_WATCHDOGCOUNT -} CC1350STK_WatchdogName; - -#ifdef __cplusplus -} -#endif - -#endif /* __CC1350STK_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK_fxns.c deleted file mode 100644 index dd20cb301..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/CC1350STK_fxns.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * ====================== CC1350STK_fxns.c ========================================= - * This file contains the board-specific initialization functions. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include "Board.h" - -/* - * ======== CC1350STK_sendExtFlashByte ======== - */ -void CC1350STK_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_14, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_17, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_19, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_17, 1); - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_17, 0); - PIN_setOutputValue(pinHandle, IOID_14, 1); - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC1350STK_wakeUpExtFlash ======== - */ -void CC1350STK_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - IOID_14 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_14, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_14, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC1350STK_shutDownExtFlash ======== - */ -void CC1350STK_shutDownExtFlash(void) -{ - /* - * To be sure we are putting the flash into sleep and not waking it, - * we first have to make a wake up call - */ - CC1350STK_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_14 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_17 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_19 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_18 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC1350STK_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC1350STK_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/Makefile.cc1350 b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/Makefile.cc1350 deleted file mode 100644 index f9b395f95..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/Makefile.cc1350 +++ /dev/null @@ -1,22 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x0-cc26x0 -DEVICE_FAMILY = CC13X0 -DEVICE_LINE = CC13XX -DEVICE = CC1350 - -BOARD_SOURCEFILES += CC1350STK.c CC1350STK_fxns.c -BOARD_SOURCEFILES += leds-arch.c - -SUPPORTS_PROP_MODE = 1 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 1 - -# Include the common board makefile -include $(FAMILY_PATH)/sensortag/Makefile.sensortag diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/leds-arch.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/leds-arch.c deleted file mode 100644 index 020d538bf..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/leds-arch.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-peripherals - * @{ - * - * \file - * LED HAL definitions for the CC1350STK LEDs. Is not compatible with - * the CC2650STK. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/leds.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - /* Red LED, AKA LED0 */ - { .pin = Board_PIN_LED0, .negative_logic = false }, -}; -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/leds-arch.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/leds-arch.h deleted file mode 100644 index 535396f43..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/leds-arch.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** \addtogroup sensortag-peripherals - * @{ - * - * \file - * LED HAL definitions for the CC1350STK LEDs. Is not compatible with - * the CC2650STK. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef LEDS_ARCH_H_ -#define LEDS_ARCH_H_ -/*---------------------------------------------------------------------------*/ -/** - * \name LED configurations for the dev/leds.h API. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define LEDS_CONF_COUNT 1 - -#define LEDS_CONF_RED 0 - -#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1) -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* LEDS_ARCH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/rf-conf.h deleted file mode 100644 index 1f3dfbe52..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc1350/rf-conf.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for both the Sub-1 GHz - * path and the 2.4 GHz path on the radio. - * - * These are the following front-end mode configurations for the - * CC1350STK board: - * - Sub-1 GHz: single-ended RFN and external bias - * - 2.4 GHz: single-ended RFP and external bias - * - * @{ - */ -#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_SINGLE_ENDED_RFN -#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL - -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_SINGLE_ENDED_RFP -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/Board.h deleted file mode 100644 index 8425de454..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/Board.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC2650STK.h" - -#define Board_CC2650STK -#define BOARD_STRING "TI CC2650 SensorTag" - -#define Board_initGeneral() CC2650STK_initGeneral() -#define Board_shutDownExtFlash() CC2650STK_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC2650STK_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_BUZZER CC2650STK_BUZZER -#define Board_BUZZER_ON CC2650STK_LED_ON -#define Board_BUZZER_OFF CC2650STK_LED_OFF - -#define Board_CRYPTO0 CC2650STK_CRYPTO0 - -#define Board_GPIO_BUTTON0 CC2650STK_GPIO_S1 -#define Board_GPIO_BUTTON1 CC2650STK_GPIO_S2 -#define Board_GPIO_LED0 CC2650STK_GPIO_LED0 -#define Board_GPIO_LED1 CC2650STK_GPIO_LED0 -#define Board_GPIO_LED_ON CC2650STK_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC2650STK_GPIO_LED_OFF - -#define Board_GPTIMER0A CC2650STK_GPTIMER0A -#define Board_GPTIMER0B CC2650STK_GPTIMER0B -#define Board_GPTIMER1A CC2650STK_GPTIMER1A -#define Board_GPTIMER1B CC2650STK_GPTIMER1B -#define Board_GPTIMER2A CC2650STK_GPTIMER2A -#define Board_GPTIMER2B CC2650STK_GPTIMER2B -#define Board_GPTIMER3A CC2650STK_GPTIMER3A -#define Board_GPTIMER3B CC2650STK_GPTIMER3B - -#define Board_I2C0 CC2650STK_I2C0 -#define Board_I2C0_SDA1 CC2650STK_I2C0_SDA1 -#define Board_I2C0_SCL1 CC2650STK_I2C0_SCL1 -#define Board_I2C_TMP CC2650STK_I2C0 - -#define Board_KEY_LEFT CC2650STK_KEY_LEFT -#define Board_KEY_RIGHT CC2650STK_KEY_RIGHT -#define Board_RELAY CC2650STK_RELAY - -#define Board_MIC_POWER CC2650STK_MIC_POWER -#define Board_MIC_POWER_OM CC2650STK_MIC_POWER_ON -#define Board_MIC_POWER_OFF CC2650STK_MIC_POWER_OFF - -#define Board_MPU_INT CC2650STK_MPU_INT -#define Board_MPU_POWER CC2650STK_MPU_POWER -#define Board_MPU_POWER_OFF CC2650STK_MPU_POWER_OFF -#define Board_MPU_POWER_ON CC2650STK_MPU_POWER_ON - -#define Board_TMP_RDY CC2650STK_TMP_RDY - -#define Board_NVSINTERNAL CC2650STK_NVSCC26XX0 -#define Board_NVSEXTERNAL CC2650STK_NVSSPI25X0 - -#define Board_PDM0 CC2650STK_PDM0 - -#define Board_PIN_BUTTON0 CC2650STK_KEY_LEFT -#define Board_PIN_BUTTON1 CC2650STK_KEY_RIGHT -#define Board_PIN_BTN1 CC2650STK_KEY_LEFT -#define Board_PIN_BTN2 CC2650STK_KEY_RIGHT -#define Board_PIN_LED0 CC2650STK_PIN_LED0 -#define Board_PIN_LED1 CC2650STK_PIN_LED1 -#define Board_PIN_LED2 CC2650STK_PIN_LED1 - -#define Board_PWM0 CC2650STK_PWM0 -#define Board_PWM1 CC2650STK_PWM0 -#define Board_PWM2 CC2650STK_PWM2 -#define Board_PWM3 CC2650STK_PWM3 -#define Board_PWM4 CC2650STK_PWM4 -#define Board_PWM5 CC2650STK_PWM5 -#define Board_PWM6 CC2650STK_PWM6 -#define Board_PWM7 CC2650STK_PWM7 - -#define Board_SPI0 CC2650STK_SPI0 -#define Board_SPI0_MISO CC2650STK_SPI0_MISO -#define Board_SPI0_MOSI CC2650STK_SPI0_MOSI -#define Board_SPI0_CLK CC2650STK_SPI0_CLK -#define Board_SPI0_CSN CC2650STK_SPI0_CSN -#define Board_SPI1 CC2650STK_SPI1 -#define Board_SPI1_MISO CC2650STK_SPI1_MISO -#define Board_SPI1_MOSI CC2650STK_SPI1_MOSI -#define Board_SPI1_CLK CC2650STK_SPI1_CLK -#define Board_SPI1_CSN CC2650STK_SPI1_CSN -#define Board_SPI_FLASH_CS CC2650STK_SPI_FLASH_CS -#define Board_FLASH_CS_ON CC2650STK_FLASH_CS_ON -#define Board_FLASH_CS_OFF CC2650STK_FLASH_CS_OFF - -#define Board_UART0 CC2650STK_UART0 - -#define Board_WATCHDOG0 CC2650STK_WATCHDOG0 - -/* Board specific I2C addresses */ -#define Board_BMP280_ADDR (0x77) -#define Board_HDC1000_ADDR (0x43) -#define Board_MPU9250_ADDR (0x68) -#define Board_MPU9250_MAG_ADDR (0x0C) -#define Board_OPT3001_ADDR (0x45) -#define Board_TMP_ADDR (0x44) - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.c deleted file mode 100644 index 7b16c58ee..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.c +++ /dev/null @@ -1,653 +0,0 @@ -/* - * Copyright (c) 2016-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC2650STK.c ========================================= - * This file is responsible for setting up the board specific items for the - * CC2650STK board. - */ - -#include -#include -#include - -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC2650STK.h" - -/* - * =============================== Crypto =============================== - */ -#include - -CryptoCC26XX_Object cryptoCC26XXObjects[CC2650STK_CRYPTOCOUNT]; - -const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC2650STK_CRYPTOCOUNT] = { - { - .baseAddr = CRYPTO_BASE, - .powerMngrId = PowerCC26XX_PERIPH_CRYPTO, - .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ, - .intPriority = ~0, - } -}; - -const CryptoCC26XX_Config CryptoCC26XX_config[CC2650STK_CRYPTOCOUNT] = { - { - .object = &cryptoCC26XXObjects[CC2650STK_CRYPTO0], - .hwAttrs = &cryptoCC26XXHWAttrs[CC2650STK_CRYPTO0] - } -}; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC2650STK.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Button 0 */ - GPIOCC26XX_DIO_04 | GPIO_DO_NOT_CONFIG, /* Button 1 */ - - /* Output pins */ - GPIOCC26XX_DIO_10 | GPIO_DO_NOT_CONFIG, /* LED */ - - /* SPI Flash CSN */ - GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC2650STK.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC2650STK_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC2650STK_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC2650STK_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2650STK_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC2650STK_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC2650STK_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC2650STK_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC2650STK_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC2650STK_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC2650STK_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC2650STK_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC2650STK_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC2650STK_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650STK_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC2650STK_I2C0_SDA0, - .sclPin = CC2650STK_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC2650STK_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC2650STK_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC2650STK_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC2650STK_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x1A000 -#define SECTORSIZE 0x1000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - -#define SPISECTORSIZE 0x1000 -#define SPIREGIONSIZE (SPISECTORSIZE * 32) -#define VERIFYBUFSIZE 64 - -static uint8_t verifyBuf[VERIFYBUFSIZE]; - -/* Allocate objects for NVS and NVS SPI */ -NVSSPI25X_Object nvsSPI25XObjects[1]; - -/* Hardware attributes for NVS SPI */ -const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = { - { - .regionBaseOffset = 0, - .regionSize = SPIREGIONSIZE, - .sectorSize = SPISECTORSIZE, - .verifyBuf = verifyBuf, - .verifyBufSize = VERIFYBUFSIZE, - .spiHandle = NULL, - .spiIndex = 0, - .spiBitRate = 4000000, - .spiCsnGpioIndex = CC2650STK_GPIO_SPI_FLASH_CS, - }, -}; - -#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC2650STK_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - { - .fxnTablePtr = &NVSSPI25X_fxnTable, - .object = &nvsSPI25XObjects[0], - .hwAttrs = &nvsSPI25XHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC2650STK_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PDM =============================== -*/ -#include -#include - -PDMCC26XX_Object pdmCC26XXObjects[CC2650STK_PDMCOUNT]; -PDMCC26XX_I2S_Object pdmCC26XXI2SObjects[CC2650STK_PDMCOUNT]; - -const PDMCC26XX_HWAttrs pdmCC26XXHWAttrs[CC2650STK_PDMCOUNT] = { - { - .micPower = CC2650STK_MIC_POWER, - .taskPriority = 2 - } -}; - -const PDMCC26XX_Config PDMCC26XX_config[CC2650STK_PDMCOUNT] = { - { - .object = &pdmCC26XXObjects[CC2650STK_PDM0], - .hwAttrs = &pdmCC26XXHWAttrs[CC2650STK_PDM0] - } -}; - -const PDMCC26XX_I2S_HWAttrs pdmC26XXI2SHWAttrs[CC2650STK_PDMCOUNT] = { - { - .baseAddr = I2S0_BASE, - .intNum = INT_I2S_IRQ, - .powerMngrId = PowerCC26XX_PERIPH_I2S, - .intPriority = ~0, - .mclkPin = PIN_UNASSIGNED, - .bclkPin = CC2650STK_AUDIO_CLK, - .wclkPin = PIN_UNASSIGNED, - .ad0Pin = CC2650STK_AUDIO_DI, - } -}; - -const PDMCC26XX_I2S_Config PDMCC26XX_I2S_config[CC2650STK_PDMCOUNT] = { - { - .object = &pdmCC26XXI2SObjects[CC2650STK_PDM0], - .hwAttrs = &pdmC26XXI2SHWAttrs[CC2650STK_PDM0] - } -}; - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC2650STK_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC2650STK_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC2650STK_KEY_RIGHT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC2650STK_RELAY | PIN_INPUT_EN | PIN_PULLDOWN | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Relay is active high */ - CC2650STK_MPU_INT | PIN_INPUT_EN | PIN_PULLDOWN | PIN_IRQ_NEGEDGE | PIN_HYSTERESIS, /* MPU_INT is active low */ - CC2650STK_TMP_RDY | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS, /* TMP_RDY is active high */ - CC2650STK_BUZZER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Buzzer initially off */ - CC2650STK_MPU_POWER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* MPU initially on */ - CC2650STK_MIC_POWER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* MIC initially off */ - CC2650STK_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC2650STK_SPI_DEVPK_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* DevPack chip select */ - CC2650STK_AUDIO_DI | PIN_INPUT_EN | PIN_PULLDOWN, /* Audio DI */ - CC2650STK_AUDIODO | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* Audio data out */ - CC2650STK_AUDIO_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC2650STK_DP2 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC2650STK_DP1 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC2650STK_DP0 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC2650STK_DP3 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC2650STK_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* DevPack */ - CC2650STK_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */ - CC2650STK_DEVPK_ID | PIN_INPUT_EN | PIN_NOPULL, /* Device pack ID - external PU */ - CC2650STK_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC2650STK_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC2650STK_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -const PowerCC26XX_Config PowerCC26XX_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC2650STK_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC2650STK_PWMCOUNT] = { - { .pwmPin = CC2650STK_PWMPIN0, .gpTimerUnit = CC2650STK_GPTIMER0A }, - { .pwmPin = CC2650STK_PWMPIN1, .gpTimerUnit = CC2650STK_GPTIMER0B }, - { .pwmPin = CC2650STK_PWMPIN2, .gpTimerUnit = CC2650STK_GPTIMER1A }, - { .pwmPin = CC2650STK_PWMPIN3, .gpTimerUnit = CC2650STK_GPTIMER1B }, - { .pwmPin = CC2650STK_PWMPIN4, .gpTimerUnit = CC2650STK_GPTIMER2A }, - { .pwmPin = CC2650STK_PWMPIN5, .gpTimerUnit = CC2650STK_GPTIMER2B }, - { .pwmPin = CC2650STK_PWMPIN6, .gpTimerUnit = CC2650STK_GPTIMER3A }, - { .pwmPin = CC2650STK_PWMPIN7, .gpTimerUnit = CC2650STK_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC2650STK_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM0], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM1], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM2], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM3], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM4], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM5], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM6], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM7], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM7] }, -}; - -const uint_least8_t PWM_count = CC2650STK_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - .globalCallback = NULL, /* No board specific callback */ - .globalEventMask = 0 /* No events subscribed to */ -}; - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650STK_SPICOUNT]; - -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650STK_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0, - .rxChannelBitMask = 1< -#include - -TRNGCC26X0_Object trngCC26X0Object[CC2650STK_TRNGCOUNT]; - -const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC2650STK_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC2650STK_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC2650STK_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC2650STK_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650STK_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC2650STK_UART_TX, - .rxPin = CC2650STK_UART_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC2650STK_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC2650STK_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC2650STK_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC2650STK_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC2650STK_UART0] - }, -#endif -}; - -const uint_least8_t UART_count = CC2650STK_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC2650STK_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC2650STK_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC2650STK_UDMACOUNT] = { - { - .object = &udmaObjects[CC2650STK_UDMA0], - .hwAttrs = &udmaHWAttrs[CC2650STK_UDMA0] - }, -}; - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC2650STK_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC2650STK_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC2650STK_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC2650STK_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC2650STK_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC2650STK_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC2650STK_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC2650STK_initGeneral ======== - */ -void CC2650STK_initGeneral(void) -{ - Power_init(); - - if ( PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.h deleted file mode 100644 index 17533f6cd..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK.h +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** ============================================================================ - * @file CC2650STK.h - * - * @brief CC2650STK Board Specific header file. - * - * The CC2650STK header file should be included in an application as - * follows: - * @code - * #include "CC2650STK.h" - * @endcode - * ============================================================================ - */ -#ifndef __CC2650STK_BOARD_H__ -#define __CC2650STK_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC2650STK - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Audio */ -#define CC2650STK_MIC_POWER IOID_13 -#define CC2650STK_MIC_POWER_ON 1 -#define CC2650STK_MIC_POWER_OFF 0 -#define CC2650STK_AUDIO_DI IOID_2 -#define CC2650STK_AUDIO_CLK IOID_11 - -/* Buzzer */ -#define CC2650STK_BUZZER IOID_21 -#define CC2650STK_BUZZER_ON 1 -#define CC2650STK_BUZZER_OFF 0 - -/* DevPack */ -#define CC2650STK_AUDIOFS_TDO IOID_16 -#define CC2650STK_AUDIODO IOID_22 -#define CC2650STK_DP2 IOID_23 -#define CC2650STK_DP1 IOID_24 -#define CC2650STK_DP0 IOID_25 -#define CC2650STK_DP3 IOID_27 -#define CC2650STK_DP4_UARTRX IOID_28 -#define CC2650STK_DP5_UARTTX IOID_29 -#define CC2650STK_DEVPK_ID IOID_30 -#define CC2650STK_SPI_DEVPK_CS IOID_20 - -/* Discrete Outputs */ -#define CC2650STK_PIN_LED0 IOID_10 -#define CC2650STK_PIN_LED1 IOID_15 -#define CC2650STK_LED_ON 1 -#define CC2650STK_LED_OFF 0 - - -/* Discrete Inputs */ -#define CC2650STK_KEY_LEFT IOID_0 -#define CC2650STK_KEY_RIGHT IOID_4 -#define CC2650STK_RELAY IOID_3 - -/* GPIO */ -#define CC2650STK_GPIO_LED_ON 1 -#define CC2650STK_GPIO_LED_OFF 0 - -/* I2C */ -#define CC2650STK_I2C0_SDA0 IOID_5 -#define CC2650STK_I2C0_SCL0 IOID_6 -#define CC2650STK_I2C0_SDA1 IOID_8 -#define CC2650STK_I2C0_SCL1 IOID_9 - -/* LED-Audio DevPack */ -#define CC2650STK_DEVPK_LIGHT_BLUE IOID_23 -#define CC2650STK_DEVPK_LIGHT_GREEN IOID_24 -#define CC2650STK_DEVPK_LIGHT_WHITE IOID_25 -#define CC2650STK_DEVPK_LIGHT_RED IOID_27 - -/* Power */ -#define CC2650STK_MPU_POWER IOID_12 -#define CC2650STK_MPU_POWER_ON 1 -#define CC2650STK_MPU_POWER_OFF 0 - -/* PWM */ -#define CC2650STK_PWMPIN0 CC2650STK_PIN_LED1 -#define CC2650STK_PWMPIN1 CC2650STK_PIN_LED1 -#define CC2650STK_PWMPIN2 PIN_UNASSIGNED -#define CC2650STK_PWMPIN3 PIN_UNASSIGNED -#define CC2650STK_PWMPIN4 PIN_UNASSIGNED -#define CC2650STK_PWMPIN5 PIN_UNASSIGNED -#define CC2650STK_PWMPIN6 PIN_UNASSIGNED -#define CC2650STK_PWMPIN7 PIN_UNASSIGNED - -/* Sensors */ -#define CC2650STK_MPU_INT IOID_7 -#define CC2650STK_TMP_RDY IOID_1 - -/* SPI */ -#define CC2650STK_SPI_FLASH_CS IOID_14 -#define CC2650STK_FLASH_CS_ON 0 -#define CC2650STK_FLASH_CS_OFF 1 - -/* SPI Board */ -#define CC2650STK_SPI0_MISO IOID_18 -#define CC2650STK_SPI0_MOSI IOID_19 -#define CC2650STK_SPI0_CLK IOID_17 -#define CC2650STK_SPI0_CSN PIN_UNASSIGNED -#define CC2650STK_SPI1_MISO PIN_UNASSIGNED -#define CC2650STK_SPI1_MOSI PIN_UNASSIGNED -#define CC2650STK_SPI1_CLK PIN_UNASSIGNED -#define CC2650STK_SPI1_CSN PIN_UNASSIGNED - -/* UART */ -#define CC2650STK_UART_TX CC2650STK_DP5_UARTTX -#define CC2650STK_UART_RX CC2650STK_DP4_UARTRX - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC2650STK_initGeneral(void); - -/*! - * @brief Turn off the external flash on LaunchPads - * - */ -void CC2650STK_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC2650STK_wakeUpExtFlash(void); - -/*! - * @def CC2650STK_CryptoName - * @brief Enum of Crypto names - */ -typedef enum CC2650STK_CryptoName { - CC2650STK_CRYPTO0 = 0, - - CC2650STK_CRYPTOCOUNT -} CC2650STK_CryptoName; - -/*! - * @def CC2650STK_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC2650STK_GPIOName { - CC2650STK_GPIO_S1 = 0, - CC2650STK_GPIO_S2, - CC2650STK_GPIO_LED0, - CC2650STK_GPIO_SPI_FLASH_CS, - - CC2650STK_GPIOCOUNT -} CC2650STK_GPIOName; - -/*! - * @def CC2650STK_GPTimerName - * @brief Enum of GPTimers parts - */ -typedef enum CC2650STK_GPTimerName { - CC2650STK_GPTIMER0A = 0, - CC2650STK_GPTIMER0B, - CC2650STK_GPTIMER1A, - CC2650STK_GPTIMER1B, - CC2650STK_GPTIMER2A, - CC2650STK_GPTIMER2B, - CC2650STK_GPTIMER3A, - CC2650STK_GPTIMER3B, - - CC2650STK_GPTIMERPARTSCOUNT -} CC2650STK_GPTimerName; - -/*! - * @def CC2650STK_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC2650STK_GPTimers { - CC2650STK_GPTIMER0 = 0, - CC2650STK_GPTIMER1, - CC2650STK_GPTIMER2, - CC2650STK_GPTIMER3, - - CC2650STK_GPTIMERCOUNT -} CC2650STK_GPTimers; - -/*! - * @def CC2650STK_I2CName - * @brief Enum of I2C names - */ -typedef enum CC2650STK_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC2650STK_I2C0 = 0, -#endif - - CC2650STK_I2CCOUNT -} CC2650STK_I2CName; - -/*! - * @def CC2650STK_NVSName - * @brief Enum of NVS names - */ -typedef enum CC2650STK_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC2650STK_NVSCC26XX0 = 0, -#endif -#if TI_NVS_CONF_NVS_EXTERNAL_ENABLE - CC2650STK_NVSSPI25X0, -#endif - - CC2650STK_NVSCOUNT -} CC2650STK_NVSName; - -/*! - * @def CC2650STK_PDMName - * @brief Enum of PDM names - */ -typedef enum CC2650STK_PDMName { - CC2650STK_PDM0 = 0, - - CC2650STK_PDMCOUNT -} CC2650STK_PDMName; - -/*! - * @def CC2650STK_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC2650STK_PWMName { - CC2650STK_PWM0 = 0, - CC2650STK_PWM1, - CC2650STK_PWM2, - CC2650STK_PWM3, - CC2650STK_PWM4, - CC2650STK_PWM5, - CC2650STK_PWM6, - CC2650STK_PWM7, - - CC2650STK_PWMCOUNT -} CC2650STK_PWMName; - -/*! - * @def CC2650STK_SPIName - * @brief Enum of SPI names - */ -typedef enum CC2650STK_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC2650STK_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC2650STK_SPI1, -#endif - - CC2650STK_SPICOUNT -} CC2650STK_SPIName; - -/*! - * @def CC2650STK_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC2650STK_TRNGName { - CC2650STK_TRNG0 = 0, - - CC2650STK_TRNGCOUNT -} CC2650STK_TRNGName; - -/*! - * @def CC2650STK_UARTName - * @brief Enum of UARTs - */ -typedef enum CC2650STK_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC2650STK_UART0 = 0, -#endif - - - CC2650STK_UARTCOUNT -} CC2650STK_UARTName; - -/*! - * @def CC2650STK_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC2650STK_UDMAName { - CC2650STK_UDMA0 = 0, - - CC2650STK_UDMACOUNT -} CC2650STK_UDMAName; - -/*! - * @def CC2650STK_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC2650STK_WatchdogName { - CC2650STK_WATCHDOG0 = 0, - - CC2650STK_WATCHDOGCOUNT -} CC2650STK_WatchdogName; - -#ifdef __cplusplus -} -#endif - -#endif /* __CC2650STK_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK_fxns.c deleted file mode 100644 index 3312a1702..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/CC2650STK_fxns.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * ====================== CC2650STK_fxns.c ========================================= - * This file contains the board-specific initialization functions. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include "Board.h" - -/* - * ======== CC2650STK_sendExtFlashByte ======== - */ -void CC2650STK_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_14, 0); - - for (i = 0; i < 8; i++) { - PIN_setOutputValue(pinHandle, IOID_17, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_19, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_17, 1); - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_17, 0); - PIN_setOutputValue(pinHandle, IOID_14, 1); - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC2650STK_wakeUpExtFlash ======== - */ -void CC2650STK_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - IOID_14 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_14, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_14, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC2650STK_shutDownExtFlash ======== - */ -void CC2650STK_shutDownExtFlash(void) -{ - /* - * To be sure we are putting the flash into sleep and not waking it, - * we first have to make a wake up call - */ - CC2650STK_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_14 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_17 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_19 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | - PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_18 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE - }; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC2650STK_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC2650STK_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/Makefile.cc2650 b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/Makefile.cc2650 deleted file mode 100644 index d5b3303ba..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/Makefile.cc2650 +++ /dev/null @@ -1,22 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x0-cc26x0 -DEVICE_FAMILY = CC26X0 -DEVICE_LINE = CC26XX -DEVICE = CC2650 - -BOARD_SOURCEFILES += CC2650STK.c CC2650STK_fxns.c -BOARD_SOURCEFILES += leds-arch.c - -SUPPORTS_PROP_MODE = 0 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 1 - -# Include the common board makefile -include $(FAMILY_PATH)/sensortag/Makefile.sensortag diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/leds-arch.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/leds-arch.c deleted file mode 100644 index 97b2ca597..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/leds-arch.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-peripherals - * @{ - * - * \file - * LED HAL definitions for the CC2650STK LEDs. Is not compatible with - * the CC1350STK. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/leds.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - /* Red LED, AKA LED0 */ - { .pin = Board_PIN_LED0, .negative_logic = false }, - /* Green LED, AKA LED1 */ - { .pin = Board_PIN_LED1, .negative_logic = false }, -}; -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/leds-arch.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/leds-arch.h deleted file mode 100644 index fcb89bd69..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/leds-arch.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** \addtogroup sensortag-peripherals - * @{ - * - * \file - * LED HAL definitions for the CC1350STK LEDs. Is not compatible with - * the CC2650STK. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef LEDS_ARCH_H_ -#define LEDS_ARCH_H_ -/*---------------------------------------------------------------------------*/ -/** - * \name LED configurations for the dev/leds.h API. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define LEDS_CONF_COUNT 2 - -#define LEDS_CONF_RED 0 -#define LEDS_CONF_GREEN 1 - -#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1) -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* LEDS_ARCH_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/rf-conf.h deleted file mode 100644 index 48db37a96..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/cc2650/rf-conf.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for the 2.4 GHz path - * on the radio. - * - * These are the following front-end mode configurations for the - * CC2650STK board: - * - 2.4 GHz: differential and internal bias - * - * @{ - */ -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_INTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/hdc-1000-sensor.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/hdc-1000-sensor.c deleted file mode 100644 index 85840605d..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/hdc-1000-sensor.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-hdc-sensor - * @{ - * - * \file - * Driver for the Sensortag HDC1000 sensor. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/ctimer.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -#include "hdc-1000-sensor.h" -/*---------------------------------------------------------------------------*/ -#include - -#include -/*---------------------------------------------------------------------------*/ -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* - * Disable the entire file if sensors are disabled, as it could potentially - * create compile errors with missing defines from either the Board file or - * configuration defines. - */ -#if BOARD_SENSORS_ENABLE -/*---------------------------------------------------------------------------*/ -#ifndef Board_HDC1000_ADDR -#error "Board file doesn't define the I2C address Board_HDC1000_ADDR" -#endif -/* Sensor I2C address */ -#define HDC1000_I2C_ADDRESS Board_HDC1000_ADDR -/*---------------------------------------------------------------------------*/ -/* Registers */ -#define HDC1000_REG_TEMP 0x00 /* Temperature */ -#define HDC1000_REG_HUM 0x01 /* Humidity */ -#define HDC1000_REG_CONFIG 0x02 /* Configuration */ -#define HDC1000_REG_SERID_H 0xFB /* Serial ID high */ -#define HDC1000_REG_SERID_M 0xFC /* Serial ID middle */ -#define HDC1000_REG_SERID_L 0xFD /* Serial ID low */ -#define HDC1000_REG_MANF_ID 0xFE /* Manufacturer ID */ -#define HDC1000_REG_DEV_ID 0xFF /* Device ID */ -/*---------------------------------------------------------------------------*/ -/* Fixed values */ -#define HDC1000_VAL_MANF_ID 0x5449 -#define HDC1000_VAL_DEV_ID 0x1000 -#define HDC1000_VAL_CONFIG 0x1000 /* 14 bit, acquired in sequence */ -/*---------------------------------------------------------------------------*/ -/* Byte swap of 16-bit register value */ -#define HI_UINT16(a) (((a) >> 8) & 0xFF) -#define LO_UINT16(a) ((a) & 0xFF) - -#define SWAP16(v) ((LO_UINT16(v) << 8) | HI_UINT16(v)) - -#define LSB16(v) (LO_UINT16(v)), (HI_UINT16(v)) -/*---------------------------------------------------------------------------*/ -static I2C_Handle i2c_handle; -/*---------------------------------------------------------------------------*/ -/* Raw data as returned from the sensor (Big Endian) */ -typedef struct { - uint16_t temp; - uint16_t hum; -} HDC_1000_SensorData; - -static HDC_1000_SensorData sensor_data; -/*---------------------------------------------------------------------------*/ -static volatile HDC_1000_SENSOR_STATUS sensor_status = HDC_1000_SENSOR_STATUS_DISABLED; -/*---------------------------------------------------------------------------*/ -/* - * Maximum measurement durations in clock ticks. We use 14bit resolution, thus: - * - Tmp: 6.35ms - * - RH: 6.5ms - */ -#define MEASUREMENT_DURATION 2 - -/* - * Wait SENSOR_STARTUP_DELAY clock ticks between activation and triggering a - * reading (max 15ms) - */ -#define SENSOR_STARTUP_DELAY 3 - -static struct ctimer startup_timer; -/*---------------------------------------------------------------------------*/ -/** - * \brief Setup and peform an I2C transaction. - * \param wbuf Output buffer during the I2C transation. - * \param wcount How many bytes in the wbuf. - * \param rbuf Input buffer during the I2C transation. - * \param rcount How many bytes to read into rbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static bool -i2c_write_read(void *wbuf, size_t wcount, void *rbuf, size_t rcount) -{ - I2C_Transaction i2c_transaction = { - .writeBuf = wbuf, - .writeCount = wcount, - .readBuf = rbuf, - .readCount = rcount, - .slaveAddress = HDC1000_I2C_ADDRESS, - }; - - return I2C_transfer(i2c_handle, &i2c_transaction); -} -/** - * \brief Peform a write only I2C transaction. - * \param wbuf Output buffer during the I2C transation. - * \param wcount How many bytes in the wbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static inline bool -i2c_write(void *wbuf, size_t wcount) -{ - return i2c_write_read(wbuf, wcount, NULL, 0); -} -/** - * \brief Peform a read only I2C transaction. - * \param rbuf Input buffer during the I2C transation. - * \param rcount How many bytes to read into rbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static inline bool -i2c_read(void *rbuf, size_t rcount) -{ - return i2c_write_read(NULL, 0, rbuf, rcount); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the HDC-1000 sensor driver. - * \return true if I2C operation successful; else, return false. - */ -static bool -sensor_init(void) -{ - if(i2c_handle) { - return true; - } - - I2C_Params i2c_params; - I2C_Params_init(&i2c_params); - - i2c_params.transferMode = I2C_MODE_BLOCKING; - i2c_params.bitRate = I2C_400kHz; - - i2c_handle = I2C_open(Board_I2C0, &i2c_params); - if(i2c_handle == NULL) { - return false; - } - - /* Enable reading data in one operation */ - uint8_t config_data[] = { HDC1000_REG_CONFIG, LSB16(HDC1000_VAL_CONFIG) }; - - return i2c_write(config_data, sizeof(config_data)); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Start measurement. - * \return true if I2C operation successful; else, return false. - */ -static bool -start(void) -{ - uint8_t temp_reg[] = { HDC1000_REG_TEMP }; - - return i2c_write(temp_reg, sizeof(temp_reg)); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert raw data to temperature and humidity. - * \param temp Output variable to store converted temperature. - * \param hum Output variable to store converted humidity. - */ -static void -convert(int32_t *temp, int32_t *hum) -{ - int32_t raw_temp = SWAP16(sensor_data.temp); - int32_t raw_hum = SWAP16(sensor_data.hum); - - /* Convert temperature to degrees C */ - *temp = raw_temp * 100 * 165 / 65536 - 40000; - /* Convert relative humidity to a %RH value */ - *hum = raw_hum * 100 * 100 / 65536; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Callback when sensor is ready to read data from. - */ -static void -notify_ready(void *unused) -{ - /* Unused args */ - (void)unused; - - /* Latch readings */ - if(i2c_read(&sensor_data, sizeof(sensor_data))) { - sensor_status = HDC_1000_SENSOR_STATUS_READINGS_READY; - } else { - sensor_status = HDC_1000_SENSOR_STATUS_I2C_ERROR; - } - - sensors_changed(&hdc_1000_sensor); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor. - * \param type HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMID. - * \return Temperature (centi degrees C) or Humidity (centi %RH). - */ -static int -value(int type) -{ - int32_t temp = 0; - int32_t hum = 0; - - if(sensor_status != HDC_1000_SENSOR_STATUS_READINGS_READY) { - PRINTF("Sensor disabled or starting up (%d)\n", sensor_status); - return HDC_1000_READING_ERROR; - } - - switch(type) { - case HDC_1000_SENSOR_TYPE_TEMP: - case HDC_1000_SENSOR_TYPE_HUMID: - convert(&temp, &hum); - PRINTF("HDC: t=%d h=%d\n", (int)temp, (int)hum); - - if(type == HDC_1000_SENSOR_TYPE_TEMP) { - return (int)temp; - } else if(type == HDC_1000_SENSOR_TYPE_HUMID) { - return (int)hum; - } else { - return HDC_1000_READING_ERROR; - } - - default: - PRINTF("Invalid type\n"); - return HDC_1000_READING_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the HDC1000 sensor. - * \param type Activate, enable or disable the sensor. See below. - * \param enable Either enable or disable the sensor. - * When type == SENSORS_HW_INIT we turn on the hardware. - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor. - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor. - */ -static int -configure(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - memset(&sensor_data, 0, sizeof(sensor_data)); - - if(sensor_init()) { - sensor_status = HDC_1000_SENSOR_STATUS_INITIALISED; - } else { - sensor_status = HDC_1000_SENSOR_STATUS_I2C_ERROR; - } - break; - - case SENSORS_ACTIVE: - /* Must be initialised first */ - if(sensor_status == HDC_1000_SENSOR_STATUS_DISABLED) { - break; - } - - if(enable) { - if(!start()) { - sensor_status = HDC_1000_SENSOR_STATUS_I2C_ERROR; - break; - } - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready, NULL); - sensor_status = HDC_1000_SENSOR_STATUS_TAKING_READINGS; - } else { - ctimer_stop(&startup_timer); - sensor_status = HDC_1000_SENSOR_STATUS_INITIALISED; - } - break; - - default: - break; - } - return sensor_status; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor. - * \param type SENSORS_ACTIVE or SENSORS_READY. - * \return One of the SENSOR_STATUS_xyz defines. - */ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return sensor_status; - - default: - return HDC_1000_SENSOR_STATUS_DISABLED; - } -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(hdc_1000_sensor, "HDC1000", value, configure, status); -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_SENSORS_ENABLE */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/hdc-1000-sensor.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/hdc-1000-sensor.h deleted file mode 100644 index 4dcab02c2..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/hdc-1000-sensor.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-peripherals - * @{ - * - * \defgroup sensortag-hdc-sensor SensorTag HDC1000 - Temperature and - * Humidity Sensor - * - * Due to the time required for the sensor to startup, this driver is meant to - * be used in an asynchronous fashion. The caller must first activate the - * sensor by calling SENSORS_ACTIVATE(). This will trigger the sensor's startup - * sequence, but the call will not wait for it to complete so that the CPU can - * perform other tasks or drop to a low power mode. Once the sensor has taken - * readings, it will automatically go back to low power mode. - * - * Once the sensor is stable, the driver will retrieve readings from the sensor - * and latch them. It will then generate a sensors_changed event. - * - * The user can then retrieve readings by calling .value() and by passing - * either HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMID as the - * argument. Multiple calls to value() will not trigger new readings, they will - * simply return the most recent latched values. - * - * The user can query the sensor's status by calling status(). - * - * To get a fresh reading, the user must trigger a new reading cycle by calling - * SENSORS_ACTIVATE(). - * @{ - * - * \file - * Header file for the Sensortag HDC1000 sensor. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef HDC_1000_SENSOR_H -#define HDC_1000_SENSOR_H -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -/*---------------------------------------------------------------------------*/ -#if BOARD_SENSORS_ENABLE -#if (TI_I2C_CONF_ENABLE == 0) || (TI_I2C_CONF_I2C0_ENABLE == 0) -#error "The HDC-1000 requires the I2C driver (TI_I2C_CONF_ENABLE = 1)" -#endif -#endif -/*---------------------------------------------------------------------------*/ -typedef enum { - HDC_1000_SENSOR_TYPE_TEMP, - HDC_1000_SENSOR_TYPE_HUMID -} HDC_1000_SENSOR_TYPE; -/*---------------------------------------------------------------------------*/ -/** - * \name HDC1000 driver states - * @{ - */ -typedef enum { - HDC_1000_SENSOR_STATUS_DISABLED, /**< Not initialised */ - HDC_1000_SENSOR_STATUS_INITIALISED, /**< Initialised but idle */ - HDC_1000_SENSOR_STATUS_TAKING_READINGS, /**< Readings in progress */ - HDC_1000_SENSOR_STATUS_I2C_ERROR, /**< I2C transaction failed */ - HDC_1000_SENSOR_STATUS_READINGS_READY /**< Both readings ready */ -} HDC_1000_SENSOR_STATUS; -/** @} */ -/*---------------------------------------------------------------------------*/ -#define HDC_1000_READING_ERROR -1 -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor hdc_1000_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* HDC_1000_SENSOR_H */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/mpu-9250-sensor.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/mpu-9250-sensor.c deleted file mode 100644 index 8842d4177..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/mpu-9250-sensor.c +++ /dev/null @@ -1,659 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-mpu - * @{ - * - * \file - * Driver for the Sensortag Invensense MPU9250 motion processing unit - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "sys/rtimer.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -#include "mpu-9250-sensor.h" -/*---------------------------------------------------------------------------*/ -#include - -#include -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include -#include -/*---------------------------------------------------------------------------*/ -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* - * Disable the entire file if sensors are disabled, as it could potentially - * create compile errors with missing defines from either the Board file or - * configuration defines. - */ -#if BOARD_SENSORS_ENABLE -/*---------------------------------------------------------------------------*/ -#ifndef Board_MPU9250_ADDR -#error "Board file doesn't define I2C address Board_MPU9250_ADDR" -#endif -#ifndef Board_MPU9250_MAG_ADDR -#error "Board file doesn't define I2C address Board_MPU9250_MAG_ADDR" -#endif - -/* Sensor I2C address */ -#define MPU_9250_I2C_ADDRESS Board_MPU9250_ADDR -#define MPU_9250_MAG_I2C_ADDRESS Board_MPU9250_MAG_ADDR -/*-------------a--------------------------------------------------------------*/ -/* Self Test Registers */ -#define REG_SELF_TEST_X_GYRO 0x00 /* R/W */ -#define REG_SELF_TEST_Y_GYRO 0x01 /* R/W */ -#define REG_SELF_TEST_Z_GYRO 0x02 /* R/W */ -#define REG_SELF_TEST_X_ACCEL 0x0D /* R/W */ -#define REG_SELF_TEST_Z_ACCEL 0x0E /* R/W */ -#define REG_SELF_TEST_Y_ACCEL 0x0F /* R/W */ -/*---------------------------------------------------------------------------*/ -/* Axis Registers */ -#define REG_XG_OFFSET_H 0x13 /* R/W */ -#define REG_XG_OFFSET_L 0x14 /* R/W */ -#define REG_YG_OFFSET_H 0x15 /* R/W */ -#define REG_YG_OFFSET_L 0x16 /* R/W */ -#define REG_ZG_OFFSET_H 0x17 /* R/W */ -#define REG_ZG_OFFSET_L 0x18 /* R/W */ -/*---------------------------------------------------------------------------*/ -/* Control Registers */ -#define REG_SMPLRT_DIV 0x19 /* R/W */ -#define REG_CONFIG 0x1A /* R/W */ -#define REG_GYRO_CONFIG 0x1B /* R/W */ -#define REG_ACCEL_CONFIG 0x1C /* R/W */ -#define REG_ACCEL_CONFIG_2 0x1D /* R/W */ -#define REG_LP_ACCEL_ODR 0x1E /* R/W */ -#define REG_WOM_THR 0x1F /* R/W */ -#define REG_FIFO_EN 0x23 /* R/W */ -/*---------------------------------------------------------------------------*/ -/* - * Registers 0x24 - 0x36 are not applicable to the SensorTag HW configuration - * (IC2 Master) - */ -#define REG_INT_PIN_CFG 0x37 /* R/W */ -#define REG_INT_ENABLE 0x38 /* R/W */ -#define REG_INT_STATUS 0x3A /* R */ -#define REG_ACCEL_XOUT_H 0x3B /* R */ -#define REG_ACCEL_XOUT_L 0x3C /* R */ -#define REG_ACCEL_YOUT_H 0x3D /* R */ -#define REG_ACCEL_YOUT_L 0x3E /* R */ -#define REG_ACCEL_ZOUT_H 0x3F /* R */ -#define REG_ACCEL_ZOUT_L 0x40 /* R */ -#define REG_TEMP_OUT_H 0x41 /* R */ -#define REG_TEMP_OUT_L 0x42 /* R */ -#define REG_GYRO_XOUT_H 0x43 /* R */ -#define REG_GYRO_XOUT_L 0x44 /* R */ -#define REG_GYRO_YOUT_H 0x45 /* R */ -#define REG_GYRO_YOUT_L 0x46 /* R */ -#define REG_GYRO_ZOUT_H 0x47 /* R */ -#define REG_GYRO_ZOUT_L 0x48 /* R */ -/*---------------------------------------------------------------------------*/ -/* - * Registers 0x49 - 0x60 are not applicable to the SensorTag HW configuration - * (external sensor data) - * - * Registers 0x63 - 0x67 are not applicable to the SensorTag HW configuration - * (I2C master) - */ -#define REG_SIG_PATH_RST 0x68 /* R/W */ -#define REG_ACC_INTEL_CTRL 0x69 /* R/W */ -#define REG_USER_CTRL 0x6A /* R/W */ -#define REG_PWR_MGMT_1 0x6B /* R/W */ -#define REG_PWR_MGMT_2 0x6C /* R/W */ -#define REG_FIFO_COUNT_H 0x72 /* R/W */ -#define REG_FIFO_COUNT_L 0x73 /* R/W */ -#define REG_FIFO_R_W 0x74 /* R/W */ -#define REG_WHO_AM_I 0x75 /* R/W */ -/*---------------------------------------------------------------------------*/ -/* Masks is mpuConfig valiable */ -#define ACC_CONFIG_MASK 0x38 -#define GYRO_CONFIG_MASK 0x07 -/*---------------------------------------------------------------------------*/ -/* Values PWR_MGMT_1 */ -#define PWR_MGMT_1_VAL_MPU_SLEEP 0x4F /* Sleep + stop all clocks */ -#define PWR_MGMT_1_VAL_MPU_WAKE_UP 0x09 /* Disable temp. + intern osc */ -/*---------------------------------------------------------------------------*/ -/* Values PWR_MGMT_2 */ -#define PWR_MGMT_2_VAL_ALL_AXES 0x3F -#define PWR_MGMT_2_VAL_GYRO_AXES 0x07 -#define PWR_MGMT_2_VAL_ACC_AXES 0x38 -/*---------------------------------------------------------------------------*/ -/* Output data rates */ -#define INV_LPA_0_3125HZ 0 -#define INV_LPA_0_625HZ 1 -#define INV_LPA_1_25HZ 2 -#define INV_LPA_2_5HZ 3 -#define INV_LPA_5HZ 4 -#define INV_LPA_10HZ 5 -#define INV_LPA_20HZ 6 -#define INV_LPA_40HZ 7 -#define INV_LPA_80HZ 8 -#define INV_LPA_160HZ 9 -#define INV_LPA_320HZ 10 -#define INV_LPA_640HZ 11 -#define INV_LPA_STOPPED 255 -/*---------------------------------------------------------------------------*/ -/* Bit values */ -#define BIT_ANY_RD_CLR 0x10 -#define BIT_RAW_RDY_EN 0x01 -#define BIT_WOM_EN 0x40 -#define BIT_LPA_CYCLE 0x20 -#define BIT_STBY_XA 0x20 -#define BIT_STBY_YA 0x10 -#define BIT_STBY_ZA 0x08 -#define BIT_STBY_XG 0x04 -#define BIT_STBY_YG 0x02 -#define BIT_STBY_ZG 0x01 -#define BIT_STBY_XYZA (BIT_STBY_XA | BIT_STBY_YA | BIT_STBY_ZA) -#define BIT_STBY_XYZG (BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG) -/*---------------------------------------------------------------------------*/ -static PIN_Config mpu_9250_pin_table[] = { - Board_MPU_INT | PIN_INPUT_EN | PIN_PULLDOWN | PIN_HYSTERESIS, - Board_MPU_POWER | PIN_GPIO_OUTPUT_EN | PIN_DRVSTR_MAX | PIN_GPIO_LOW, - PIN_TERMINATE -}; - -static PIN_State pin_state; -static PIN_Handle pin_handle; -static I2C_Handle i2c_handle; - -/*---------------------------------------------------------------------------*/ -typedef struct { - volatile MPU_9250_SENSOR_STATUS status; - volatile MPU_9250_SENSOR_TYPE type; - MPU_9250_SENSOR_ACC_RANGE acc_range; -} MPU_9250_Object; - -static MPU_9250_Object mpu_9250; -/*---------------------------------------------------------------------------*/ -/* 3 16-byte words for all sensor readings */ -#define SENSOR_DATA_BUF_SIZE 3 -/* Data sizes */ -#define DATA_SIZE 6 -/*---------------------------------------------------------------------------*/ -/* - * Wait SENSOR_BOOT_DELAY ticks for the sensor to boot and - * SENSOR_STARTUP_DELAY for readings to be ready - * Gyro is a little slower than Acc - */ -#define SENSOR_BOOT_DELAY 8 -#define SENSOR_STARTUP_DELAY 5 - -static struct ctimer startup_timer; -/*---------------------------------------------------------------------------*/ - -/* - * Wait timeout in rtimer ticks. This is just a random low number, since the - * first time we read the sensor status, it should be ready to return data - */ -#define READING_WAIT_TIMEOUT 10 -/*---------------------------------------------------------------------------*/ -/* Code in flash, cache disabled: 7 cycles per loop */ -/* ui32Count = [delay in us] * [CPU clock in MHz] / [cycles per loop] */ -#define delay_ms(ms) CPUdelay((ms) * 1000 * 48 / 7) -/*---------------------------------------------------------------------------*/ -/** - * \brief Setup and peform an I2C transaction. - * \param wbuf Output buffer during the I2C transation. - * \param wcount How many bytes in the wbuf. - * \param rbuf Input buffer during the I2C transation. - * \param rcount How many bytes to read into rbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static bool -i2c_write_read(void *wbuf, size_t wcount, void *rbuf, size_t rcount) -{ - I2C_Transaction i2c_transaction = { - .writeBuf = wbuf, - .writeCount = wcount, - .readBuf = rbuf, - .readCount = rcount, - .slaveAddress = MPU_9250_I2C_ADDRESS, - }; - - return I2C_transfer(i2c_handle, &i2c_transaction); -} -/** - * \brief Peform a write only I2C transaction. - * \param wbuf Output buffer during the I2C transation. - * \param wcount How many bytes in the wbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static inline bool -i2c_write(void *wbuf, size_t wcount) -{ - return i2c_write_read(wbuf, wcount, NULL, 0); -} -/** - * \brief Peform a read only I2C transaction. - * \param rbuf Input buffer during the I2C transation. - * \param rcount How many bytes to read into rbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static inline bool -i2c_read(void *rbuf, size_t rcount) -{ - return i2c_write_read(NULL, 0, rbuf, rcount); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the MPU-9250 sensor driver. - * \return true if I2C operation successful; else, return false. - */ -static bool -sensor_init(void) -{ - pin_handle = PIN_open(&pin_state, mpu_9250_pin_table); - if(pin_handle == NULL) { - return false; - } - - I2C_Params i2cParams; - I2C_Params_init(&i2cParams); - i2cParams.transferMode = I2C_MODE_BLOCKING; - i2cParams.bitRate = I2C_400kHz; - - i2c_handle = I2C_open(Board_I2C0, &i2cParams); - if(i2c_handle == NULL) { - PIN_close(&pin_state); - return false; - } - - mpu_9250.type = MPU_9250_SENSOR_TYPE_NONE; - mpu_9250.status = MPU_9250_SENSOR_STATUS_DISABLED; - mpu_9250.acc_range = MPU_9250_SENSOR_ACC_RANGE_ARG; - - return true; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Place the sensor in low-power mode. - */ -static void -sensor_sleep(void) -{ - { - uint8_t all_axes_data[] = { REG_PWR_MGMT_2, PWR_MGMT_2_VAL_ALL_AXES }; - i2c_write(all_axes_data, sizeof(all_axes_data)); - } - { - uint8_t mpu_sleep_data[] = { REG_PWR_MGMT_1, PWR_MGMT_1_VAL_MPU_SLEEP }; - i2c_write(mpu_sleep_data, sizeof(mpu_sleep_data)); - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Wakeup the sensor from low-power mode. - */ -static void -sensor_wakeup(void) -{ - { - uint8_t mpu_wakeup_data[] = { REG_PWR_MGMT_1, PWR_MGMT_1_VAL_MPU_WAKE_UP }; - i2c_write(mpu_wakeup_data, sizeof(mpu_wakeup_data)); - } - { - /* All axis initially disabled */ - uint8_t all_axes_data[] = { REG_PWR_MGMT_2, PWR_MGMT_2_VAL_ALL_AXES }; - i2c_write(all_axes_data, sizeof(all_axes_data)); - } - { - /* Restore the range */ - uint8_t accel_cfg_data[] = { REG_ACCEL_CONFIG, mpu_9250.acc_range }; - i2c_write(accel_cfg_data, sizeof(accel_cfg_data)); - } - { - /* Clear interrupts */ - uint8_t int_status_data[] = { REG_INT_STATUS }; - uint8_t dummy; - i2c_write_read(int_status_data, sizeof(int_status_data), &dummy, 1); - } -} -/*---------------------------------------------------------------------------*/ -static void -sensor_set_acc_range(MPU_9250_SENSOR_ACC_RANGE acc_range) -{ - /* Apply the range */ - uint8_t accel_cfg_data[] = { REG_ACCEL_CONFIG, acc_range }; - i2c_write(accel_cfg_data, sizeof(accel_cfg_data)); -} -/*---------------------------------------------------------------------------*/ -static void -sensor_set_axes(MPU_9250_SENSOR_TYPE sensor_type) -{ - uint8_t _data[] = { REG_PWR_MGMT_2, ~(uint8_t)sensor_type }; - i2c_write(_data, sizeof(_data)); -} -/*---------------------------------------------------------------------------*/ -static void -convert_to_le(uint8_t *data, uint8_t len) -{ - int i; - for(i = 0; i < len; i += 2) { - uint8_t tmp; - tmp = data[i]; - data[i] = data[i + 1]; - data[i + 1] = tmp; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Check whether a data or wake on motion interrupt has occurred. - * \return Return the interrupt status. - * - * This driver does not use interrupts, however this function allows - * us to determine whether a new sensor reading is available. - */ -static bool -sensor_data_ready(uint8_t *int_status) -{ - uint8_t int_status_data[] = { REG_INT_STATUS }; - const bool spi_ok = i2c_write_read(int_status_data, sizeof(int_status_data), int_status, 1); - - return spi_ok && (*int_status != 0); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Read data from the accelerometer, total of 3 words (X, Y, Z). - * \return true if a valid reading could be taken; otherwise, false. - */ -static bool -acc_read(uint8_t int_status, uint16_t *data) -{ - if(!(int_status & BIT_RAW_RDY_EN)) { - return false; - } - - /* Burst read of all accelerometer values */ - uint8_t accel_xout_h[] = { REG_ACCEL_XOUT_H }; - bool spi_ok = i2c_write_read(accel_xout_h, sizeof(accel_xout_h), data, DATA_SIZE); - if(!spi_ok) { - return false; - } - - convert_to_le((uint8_t *)data, DATA_SIZE); - - return true; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Read data from the accelerometer, total of 3 words (X, Y, Z). - * \return true if a valid reading could be taken; otherwise, false. - */ -static bool -gyro_read(uint8_t int_status, uint16_t *data) -{ - if(!(int_status & BIT_RAW_RDY_EN)) { - return false; - } - - /* Burst read of all accelerometer values */ - uint8_t gyro_xout_h[] = { REG_GYRO_XOUT_H }; - bool spi_ok = i2c_write_read(gyro_xout_h, sizeof(gyro_xout_h), data, DATA_SIZE); - if(!spi_ok) { - return false; - } - - convert_to_le((uint8_t *)data, DATA_SIZE); - - return true; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert accelerometer raw reading to a value in G. - * \param raw_data The raw accelerometer reading. - * \return The converted value. - */ -static int32_t -acc_convert(int32_t raw_data) -{ - switch(mpu_9250.acc_range) { - case MPU_9250_SENSOR_ACC_RANGE_2G: return raw_data * 100 * 2 / 32768; - case MPU_9250_SENSOR_ACC_RANGE_4G: return raw_data * 100 * 4 / 32768; - case MPU_9250_SENSOR_ACC_RANGE_8G: return raw_data * 100 * 8 / 32768; - case MPU_9250_SENSOR_ACC_RANGE_16G: return raw_data * 100 * 16 / 32768; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert gyro raw reading to a value in deg/sec. - * \param raw_data The raw accelerometer reading. - * \return The converted value. - */ -static int32_t -gyro_convert(int32_t raw_data) -{ - /* calculate rotation, unit deg/s, range -250, +250 */ - return raw_data * 100 * 500 / 65536; -} -/*---------------------------------------------------------------------------*/ -static void -notify_ready_cb(void *unused) -{ - (void)unused; - - mpu_9250.status = MPU_9250_SENSOR_STATUS_READY; - sensors_changed(&mpu_9250_sensor); -} -/*---------------------------------------------------------------------------*/ -static void -initialise_cb(void *unused) -{ - (void)unused; - - if(mpu_9250.type == MPU_9250_SENSOR_TYPE_NONE) { - return; - } - - /* Wake up the sensor */ - sensor_wakeup(); - - /* Configure the accelerometer range */ - if((mpu_9250.type & MPU_9250_SENSOR_TYPE_ACC) != 0) { - sensor_set_acc_range(mpu_9250.acc_range); - } - - /* Enable gyro + accelerometer readout */ - sensor_set_axes(mpu_9250.type); - delay_ms(10); - - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready_cb, NULL); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor. - * \param type MPU_9250_SENSOR_TYPE_ACC_[XYZ] or - * MPU_9250_SENSOR_TYPE_GYRO_[XYZ]. - * \return Centi-G (ACC) or centi-Deg/Sec (Gyro). - */ -static int -value(int type) -{ - if(mpu_9250.status == MPU_9250_SENSOR_STATUS_DISABLED) { - PRINTF("MPU: Sensor Disabled\n"); - return MPU_9250_READING_ERROR; - } - - if(mpu_9250.type == MPU_9250_SENSOR_TYPE_NONE) { - return MPU_9250_READING_ERROR; - } - - uint8_t int_status = 0; - const rtimer_clock_t t0 = RTIMER_NOW(); - while(!sensor_data_ready(&int_status)) { - if(!(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + READING_WAIT_TIMEOUT))) { - return MPU_9250_READING_ERROR; - } - } - - uint16_t sensor_value[SENSOR_DATA_BUF_SIZE]; - memset(sensor_value, 0, sizeof(sensor_value)); - - /* Read accel data */ - if((type & MPU_9250_SENSOR_TYPE_ACC) != 0) { - - if(!acc_read(int_status, sensor_value)) { - return MPU_9250_READING_ERROR; - } - - PRINTF("MPU: ACC = 0x%04x 0x%04x 0x%04x = ", - sensor_value[0], sensor_value[1], sensor_value[2]); - - /* Convert */ - switch(type) { - case MPU_9250_SENSOR_TYPE_ACC_X: return acc_convert(sensor_value[0]); - case MPU_9250_SENSOR_TYPE_ACC_Y: return acc_convert(sensor_value[1]); - case MPU_9250_SENSOR_TYPE_ACC_Z: return acc_convert(sensor_value[2]); - default: return MPU_9250_READING_ERROR; - } - - /* Read gyro data */ - } else if((type & MPU_9250_SENSOR_TYPE_GYRO) != 0) { - - if(!gyro_read(int_status, sensor_value)) { - return MPU_9250_READING_ERROR; - } - - PRINTF("MPU: Gyro = 0x%04x 0x%04x 0x%04x = ", - sensor_value[0], sensor_value[1], sensor_value[2]); - - /* Convert */ - switch(type) { - case MPU_9250_SENSOR_TYPE_GYRO_X: return gyro_convert(sensor_value[0]); - case MPU_9250_SENSOR_TYPE_GYRO_Y: return gyro_convert(sensor_value[1]); - case MPU_9250_SENSOR_TYPE_GYRO_Z: return gyro_convert(sensor_value[2]); - default: return MPU_9250_READING_ERROR; - } - - /* Invalid sensor type */ - } else { - PRINTF("MPU: Invalid type\n"); - return MPU_9250_READING_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the MPU9250 sensor. - * \param type Activate, enable or disable the sensor. See below. - * \param enable Enable or disable sensor. - * When type == SENSORS_HW_INIT we turn on the hardware. - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor. - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor. - */ -static int -configure(int type, int enable) -{ - /* Mask enable */ - const MPU_9250_SENSOR_TYPE enable_type = enable & MPU_9250_SENSOR_TYPE_ALL; - - switch(type) { - case SENSORS_HW_INIT: - if(sensor_init()) { - mpu_9250.status = MPU_9250_SENSOR_STATUS_ENABLED; - } else { - mpu_9250.status = MPU_9250_SENSOR_STATUS_DISABLED; - } - break; - - case SENSORS_ACTIVE: - if(enable_type != MPU_9250_SENSOR_TYPE_NONE) { - PRINTF("MPU: Enabling\n"); - - mpu_9250.type = enable_type; - mpu_9250.status = MPU_9250_SENSOR_STATUS_BOOTING; - - PIN_setOutputValue(pin_handle, Board_MPU_POWER, 1); - - ctimer_set(&startup_timer, SENSOR_BOOT_DELAY, initialise_cb, NULL); - } else { - PRINTF("MPU: Disabling\n"); - - ctimer_stop(&startup_timer); - - if(PIN_getOutputValue(Board_MPU_POWER)) { - sensor_sleep(); - - I2C_cancel(i2c_handle); - PIN_setOutputValue(pin_handle, Board_MPU_POWER, 0); - } - - mpu_9250.type = MPU_9250_SENSOR_TYPE_NONE; - mpu_9250.status = MPU_9250_SENSOR_STATUS_DISABLED; - } - break; - - default: - break; - } - return mpu_9250.status; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor - * \param type SENSORS_ACTIVE or SENSORS_READY - * \return 1 if the sensor is enabled, else 0. - */ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return mpu_9250.status; - - default: - return MPU_9250_SENSOR_STATUS_DISABLED; - } -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(mpu_9250_sensor, "MPU9250", value, configure, status); -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_SENSORS_ENABLE */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/mpu-9250-sensor.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/mpu-9250-sensor.h deleted file mode 100644 index d66e91977..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/mpu-9250-sensor.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-peripherals - * @{ - * - * \defgroup sensortag-mpu SensorTag Motion Processing Unit - * - * Driver for the Invensense MPU-9250 Motion Processing Unit. - * - * Due to the time required between triggering a reading and the - * reading becoming available, this driver is meant to be used in an - * asynchronous fashion. The caller must first activate the sensor by - * calling - * - * mpu_9250_sensor.configure(SENSORS_ACTIVE, xyz); - * - * The value for the xyz arguments depends on the required readings. If - * the caller intends to read both the accelerometer as well as the gyro - * then xyz should be MPU_9250_SENSOR_TYPE_ALL. If the caller only needs - * to take a reading from one of the two elements, xyz should be one of - * MPU_9250_SENSOR_TYPE_ACC or MPU_9250_SENSOR_TYPE_GYRO - * - * Calling configure() will power up the sensor and initialise it. When - * the sensor is ready to provide readings, the driver will generate a - * sensors_changed event. - * - * Calls to status() will return the driver's state which could indicate - * that the sensor is off, booting or on. - * - * Once a reading has been taken, the caller has two options: - * - Turn the sensor off by calling SENSORS_DEACTIVATE, but in order to - * take subsequent readings the sensor must be started up all over - * - Leave the sensor on. In this scenario, the caller can simply keep - * calling value() for subsequent readings, but having the sensor on - * will consume more energy, especially if both accelerometer and the - * gyro are on. - * @{ - * - * \file - * Header file for the Sensortag Invensense MPU-9250 motion processing unit - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef MPU_9250_SENSOR_H_ -#define MPU_9250_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -/*---------------------------------------------------------------------------*/ -#if BOARD_SENSORS_ENABLE -#if (TI_I2C_CONF_ENABLE == 0) || (TI_I2C_CONF_I2C0_ENABLE == 0) -#error "The MPU-9250 requires the I2C driver (TI_I2C_CONF_ENABLE = 1)" -#endif -#endif -/*---------------------------------------------------------------------------*/ -#define MPU_9250_READING_ERROR -1 -/*---------------------------------------------------------------------------*/ -/* Accelerometer / Gyro Axes */ -typedef enum { - MPU_9250_SENSOR_TYPE_NONE = (0), /**< 0b000000 = 0x00 */ - MPU_9250_SENSOR_TYPE_GYRO_X = (1 << 0), /**< 0b000001 = 0x01 */ - MPU_9250_SENSOR_TYPE_GYRO_Y = (1 << 1), /**< 0b000010 = 0x02 */ - MPU_9250_SENSOR_TYPE_GYRO_Z = (1 << 2), /**< 0b000100 = 0x04 */ - MPU_9250_SENSOR_TYPE_ACC_X = (1 << 3), /**< 0b001000 = 0x08 */ - MPU_9250_SENSOR_TYPE_ACC_Y = (1 << 4), /**< 0b010000 = 0x10 */ - MPU_9250_SENSOR_TYPE_ACC_Z = (1 << 5), /**< 0b100000 = 0x20 */ - MPU_9250_SENSOR_TYPE_GYRO = MPU_9250_SENSOR_TYPE_GYRO_X - | MPU_9250_SENSOR_TYPE_GYRO_Y - | MPU_9250_SENSOR_TYPE_GYRO_Z, - /**< 0b000111 = 0x07 */ - MPU_9250_SENSOR_TYPE_ACC = MPU_9250_SENSOR_TYPE_ACC_X - | MPU_9250_SENSOR_TYPE_ACC_Y - | MPU_9250_SENSOR_TYPE_ACC_Z, - /**< 0b111000 = 0x38 */ - MPU_9250_SENSOR_TYPE_ALL = MPU_9250_SENSOR_TYPE_GYRO - | MPU_9250_SENSOR_TYPE_ACC - /**< 0b111111 = 0x3F */ -} MPU_9250_SENSOR_TYPE; -/*---------------------------------------------------------------------------*/ -/* Accelerometer range */ -typedef enum { - MPU_9250_SENSOR_ACC_RANGE_2G = 0, - MPU_9250_SENSOR_ACC_RANGE_4G = 1, - MPU_9250_SENSOR_ACC_RANGE_8G = 2, - MPU_9250_SENSOR_ACC_RANGE_16G = 3 -} MPU_9250_SENSOR_ACC_RANGE; -/*---------------------------------------------------------------------------*/ -/* Sensor status */ -typedef enum { - MPU_9250_SENSOR_STATUS_DISABLED, - MPU_9250_SENSOR_STATUS_ENABLED, - MPU_9250_SENSOR_STATUS_BOOTING, - MPU_9250_SENSOR_STATUS_READY -} MPU_9250_SENSOR_STATUS; -/*---------------------------------------------------------------------------*/ -/* Accelerometer range configuration, type MPU_9250_SENSOR_ACC_RANGE */ -#ifdef MPU_9250_SENSOR_CONF_ACC_RANGE_ARG -#define MPU_9250_SENSOR_ACC_RANGE_ARG MPU_9250_SENSOR_CONF_ACC_RANGE -#else -#define MPU_9250_SENSOR_ACC_RANGE_ARG MPU_9250_SENSOR_ACC_RANGE_2G -#endif -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor mpu_9250_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* MPU_9250_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/opt-3001-sensor.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/opt-3001-sensor.c deleted file mode 100644 index 42e3976d8..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/opt-3001-sensor.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-opt-sensor - * @{ - * - * \file - * Driver for the Sensortag OPT-3001 light sensor. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "sys/ctimer.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -#include "opt-3001-sensor.h" -/*---------------------------------------------------------------------------*/ -#include - -#include -/*---------------------------------------------------------------------------*/ -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* - * Disable the entire file if sensors are disabled, as it could potentially - * create compile errors with missing defines from either the Board file or - * configuration defines. - */ -#if BOARD_SENSORS_ENABLE -/*---------------------------------------------------------------------------*/ -#ifndef Board_OPT3001_ADDR -#error "Board file doesn't define I2C address Board_OPT3001_ADDR" -#endif -/* Slave address */ -#define OPT_3001_I2C_ADDRESS Board_OPT3001_ADDR -/*---------------------------------------------------------------------------*/ -/* Register addresses */ -#define REG_RESULT 0x00 -#define REG_CONFIGURATION 0x01 -#define REG_LOW_LIMIT 0x02 -#define REG_HIGH_LIMIT 0x03 - -#define REG_MANUFACTURER_ID 0x7E -#define REG_DEVICE_ID 0x7F -/*---------------------------------------------------------------------------*/ -/* - * Configuration Register Bits and Masks. - * We use uint16_t to read from / write to registers, meaning that the - * register's MSB is the variable's LSB. - */ -#define CFG_RN 0x00F0 /**< [15..12] Range Number */ -#define CFG_CT 0x0008 /**< [11] Conversion Time */ -#define CFG_M 0x0006 /**< [10..9] Mode of Conversion */ -#define CFG_OVF 0x0001 /**< [8] Overflow */ -#define CFG_CRF 0x8000 /**< [7] Conversion Ready Field */ -#define CFG_FH 0x4000 /**< [6] Flag High */ -#define CFG_FL 0x2000 /**< [5] Flag Low */ -#define CFG_L 0x1000 /**< [4] Latch */ -#define CFG_POL 0x0800 /**< [3] Polarity */ -#define CFG_ME 0x0400 /**< [2] Mask Exponent */ -#define CFG_FC 0x0300 /**< [1..0] Fault Count */ -/*---------------------------------------------------------------------------*/ -/* Possible Values for CT */ -#define CFG_CT_100 0x0000 -#define CFG_CT_800 CFG_CT -/*---------------------------------------------------------------------------*/ -/* Possible Values for M */ -#define CFG_M_CONTI 0x0004 -#define CFG_M_SINGLE 0x0002 -#define CFG_M_SHUTDOWN 0x0000 -/*---------------------------------------------------------------------------*/ -/* Reset Value for the register 0xC810. All zeros except: */ -#define CFG_RN_RESET 0x00C0 -#define CFG_CT_RESET CFG_CT_800 -#define CFG_L_RESET 0x1000 -#define CFG_DEFAULTS (CFG_RN_RESET | CFG_CT_100 | CFG_L_RESET) -/*---------------------------------------------------------------------------*/ -/* Enable / Disable */ -#define CFG_ENABLE_CONTINUOUS (CFG_M_CONTI | CFG_DEFAULTS) -#define CFG_ENABLE_SINGLE_SHOT (CFG_M_SINGLE | CFG_DEFAULTS) -#define CFG_DISABLE CFG_DEFAULTS -/*---------------------------------------------------------------------------*/ -/* Register length */ -#define REGISTER_LENGTH 2 -/*---------------------------------------------------------------------------*/ -/* Sensor data size */ -#define DATA_LENGTH 2 -/*---------------------------------------------------------------------------*/ -/* Byte swap of 16-bit register value */ -#define HI_UINT16(a) (((a) >> 8) & 0xFF) -#define LO_UINT16(a) (((a) >> 0) & 0xFF) - -#define SWAP16(v) ((LO_UINT16(v) << 8) | (HI_UINT16(v) << 0)) - -#define LSB16(v) (LO_UINT16(v)), (HI_UINT16(v)) -#define MSB16(v) (HI_UINT16(v)), (LO_UINT16(v)) -/*---------------------------------------------------------------------------*/ -typedef struct { - volatile OPT_3001_STATUS status; -} OPT_3001_Object; - -static OPT_3001_Object opt_3001; -/*---------------------------------------------------------------------------*/ -/* Wait SENSOR_STARTUP_DELAY for the sensor to be ready - 125ms */ -#define SENSOR_STARTUP_DELAY (CLOCK_SECOND >> 3) - -static struct ctimer startup_timer; -/*---------------------------------------------------------------------------*/ -static I2C_Handle i2c_handle; -/*---------------------------------------------------------------------------*/ -/** - * \brief Setup and peform an I2C transaction. - * \param wbuf Output buffer during the I2C transation. - * \param wcount How many bytes in the wbuf. - * \param rbuf Input buffer during the I2C transation. - * \param rcount How many bytes to read into rbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static bool -i2c_write_read(void *wbuf, size_t wcount, void *rbuf, size_t rcount) -{ - I2C_Transaction i2c_transaction = { - .writeBuf = wbuf, - .writeCount = wcount, - .readBuf = rbuf, - .readCount = rcount, - .slaveAddress = OPT_3001_I2C_ADDRESS, - }; - - return I2C_transfer(i2c_handle, &i2c_transaction); -} -/** - * \brief Peform a write only I2C transaction. - * \param wbuf Output buffer during the I2C transation. - * \param wcount How many bytes in the wbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static inline bool -i2c_write(void *wbuf, size_t wcount) -{ - return i2c_write_read(wbuf, wcount, NULL, 0); -} -/** - * \brief Peform a read only I2C transaction. - * \param rbuf Input buffer during the I2C transation. - * \param rcount How many bytes to read into rbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static inline bool -i2c_read(void *rbuf, size_t rcount) -{ - return i2c_write_read(NULL, 0, rbuf, rcount); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the OPT-3001 sensor driver. - * \return true if I2C operation successful; else, return false. - */ -static bool -sensor_init(void) -{ - if(i2c_handle) { - return true; - } - - I2C_Params i2c_params; - I2C_Params_init(&i2c_params); - - i2c_params.transferMode = I2C_MODE_BLOCKING; - i2c_params.bitRate = I2C_400kHz; - - i2c_handle = I2C_open(Board_I2C0, &i2c_params); - if(i2c_handle == NULL) { - return false; - } - - opt_3001.status = OPT_3001_STATUS_DISABLED; - - return true; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Turn the sensor on/off - * \param enable Enable sensor if true; else, disable sensor. - */ -static bool -sensor_enable(bool enable) -{ - uint16_t data = (enable) - ? CFG_ENABLE_SINGLE_SHOT - : CFG_DISABLE; - - uint8_t cfg_data[] = { REG_CONFIGURATION, LSB16(data) }; - return i2c_write(cfg_data, sizeof(cfg_data)); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Callback when sensor is ready to read data from. - */ -static void -notify_ready_cb(void *unused) -{ - /* Unused args */ - (void)unused; - - /* - * Depending on the CONFIGURATION.CONVERSION_TIME bits, a conversion will - * take either 100 or 800 ms. Here we inspect the CONVERSION_READY bit and - * if the reading is ready we notify, otherwise we just reschedule ourselves - */ - - uint8_t cfg_data[] = { REG_CONFIGURATION }; - uint16_t cfg_value = 0; - - bool spi_ok = i2c_write_read(cfg_data, sizeof(cfg_data), &cfg_value, sizeof(cfg_value)); - if(!spi_ok) { - opt_3001.status = OPT_3001_STATUS_I2C_ERROR; - return; - } - - if(cfg_value & CFG_CRF) { - opt_3001.status = OPT_3001_STATUS_DATA_READY; - sensors_changed(&opt_3001_sensor); - } else { - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready_cb, NULL); - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor. - * \param type Ignored. - * \return Illuminance in centilux. - */ -static int -value(int type) -{ - /* Unused args */ - (void)type; - - if(opt_3001.status != OPT_3001_STATUS_DATA_READY) { - return OPT_3001_READING_ERROR; - } - - uint8_t cfg_data[] = { REG_CONFIGURATION }; - uint16_t cfg_value = 0; - - bool spi_ok = i2c_write_read(cfg_data, sizeof(cfg_data), &cfg_value, sizeof(cfg_value)); - if(!spi_ok) { - opt_3001.status = OPT_3001_STATUS_I2C_ERROR; - return OPT_3001_READING_ERROR; - } - - uint8_t result_data[] = { REG_RESULT }; - uint16_t result_value = 0; - - spi_ok = i2c_write_read(result_data, sizeof(result_data), &result_value, sizeof(result_value)); - if(!spi_ok) { - opt_3001.status = OPT_3001_STATUS_I2C_ERROR; - return OPT_3001_READING_ERROR; - } - - result_value = SWAP16(result_value); - - /* formula for computing lux: lux = 0.01 * 2^e * m - * scale up by 100 to avoid floating point, then require - * users to scale down by same. - */ - uint32_t m = (result_value & 0x0FFF) >> 0; - uint32_t e = (result_value & 0xF000) >> 12; - uint32_t converted = m * (1 << e); - - PRINTF("OPT: %04X r=%d (centilux)\n", result_value, - (int)(converted)); - - return (int)converted; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the OPT3001 sensor. - * \param type Activate, enable or disable the sensor. See below. - * \param enable Enable or disable sensor. - * - * When type == SENSORS_HW_INIT we turn on the hardware. - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor. - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor. - */ -static int -configure(int type, int enable) -{ - int rv = 0; - switch(type) { - case SENSORS_HW_INIT: - if(sensor_init()) { - opt_3001.status = OPT_3001_STATUS_STANDBY; - } else { - opt_3001.status = OPT_3001_STATUS_DISABLED; - rv = OPT_3001_READING_ERROR; - } - break; - - case SENSORS_ACTIVE: - if(enable) { - sensor_enable(true); - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready_cb, NULL); - - opt_3001.status = OPT_3001_STATUS_BOOTING; - } else { - ctimer_stop(&startup_timer); - sensor_enable(false); - } - break; - - default: - break; - } - - return rv; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor. - * \param type Ignored. - * \return The state of the sensor SENSOR_STATE_xyz. - */ -static int -status(int type) -{ - /* Unused args */ - (void)type; - - return opt_3001.status; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(opt_3001_sensor, "OPT3001", value, configure, status); -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_SENSORS_ENABLE */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/opt-3001-sensor.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/opt-3001-sensor.h deleted file mode 100644 index 221ea041f..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/opt-3001-sensor.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-peripherals - * @{ - * - * \defgroup sensortag-opt-sensor SensorTag Optical Sensor - * - * Due to the time required for the sensor to startup, this driver is - * meant to be used in an asynchronous fashion. The caller must first - * activate the sensor by calling SENSORS_ACTIVATE(). This will trigger - * the sensor's startup sequence, but the call will not wait for it to - * complete so that the CPU can perform other tasks or drop to a low - * power mode. - * - * Once the reading and conversion are complete, the driver will - * generate a sensors_changed event. - * - * We use single-shot readings. In this mode, the hardware - * automatically goes back to its shutdown mode after the conversion - * is finished. However, it will still respond to I2C operations, so - * the last conversion can still be read out. - * - * In order to take a new reading, the caller has to use - * SENSORS_ACTIVATE again. - * @{ - * - * \file - * Header file for the Sensortag OPT-3001 light sensor. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef OPT_3001_SENSOR_H_ -#define OPT_3001_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -/*---------------------------------------------------------------------------*/ -#if BOARD_SENSORS_ENABLE -#if (TI_I2C_CONF_ENABLE == 0) || (TI_I2C_CONF_I2C0_ENABLE == 0) -#error "The OPT-3001 requires the I2C driver (TI_I2C_CONF_ENABLE = 1)" -#endif -#endif -/*---------------------------------------------------------------------------*/ -#define OPT_3001_READING_ERROR -1 -/*---------------------------------------------------------------------------*/ -typedef enum { - OPT_3001_STATUS_DISABLED, - OPT_3001_STATUS_STANDBY, - OPT_3001_STATUS_BOOTING, - OPT_3001_STATUS_ACTIVE, - OPT_3001_STATUS_DATA_READY, - OPT_3001_STATUS_I2C_ERROR, -} OPT_3001_STATUS; -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor opt_3001_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* OPT_3001_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/sensortag-sensors.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/sensortag-sensors.c deleted file mode 100644 index d2da9fa8f..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/sensortag-sensors.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-peripherals - * @{ - * - * \file - * Generic module controlling sensors on SensorTag. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -#include "board-peripherals.h" -/*---------------------------------------------------------------------------*/ -/* Exports a global symbol to be used by the sensor API */ -#if BOARD_SENSORS_ENABLE -SENSORS(&bmp_280_sensor, &tmp_007_sensor, &opt_3001_sensor, &hdc_1000_sensor, &mpu_9250_sensor); -#endif -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/tmp-007-sensor.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/tmp-007-sensor.c deleted file mode 100644 index 7e08006ea..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/tmp-007-sensor.c +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-tmp-sensor - * @{ - * - * \file - * Driver for the Sensortag TI TMP-007 IR Thermophile sensor. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "sys/ctimer.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -#include "tmp-007-sensor.h" -/*---------------------------------------------------------------------------*/ -#include - -#include -#include -/*---------------------------------------------------------------------------*/ -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* - * Disable the entire file if sensors are disabled, as it could potentially - * create compile errors with missing defines from either the Board file or - * configuration defines. - */ -#if BOARD_SENSORS_ENABLE -/*---------------------------------------------------------------------------*/ -/* Slave address */ -#ifndef Board_TMP_ADDR -#error "Board file doesn't define I2C address Board_TMP_ADDR" -#endif -#define TMP_007_I2C_ADDRESS Board_TMP_ADDR - -/* Sensor Interrupt pin */ -#ifndef Board_TMP_RDY -#error "Board file doesn't define interrupt pin Board_TMP_RDY" -#endif -#define TMP_007_TMP_RDY Board_TMP_RDY -/*---------------------------------------------------------------------------*/ -/* TMP-007 register addresses */ -#define REG_VOLTAGE 0x00 -#define REG_LOCAL_TEMP 0x01 -#define REG_CONFIG 0x02 -#define REG_OBJ_TEMP 0x03 -#define REG_STATUS 0x04 -#define REG_PROD_ID 0x1F -/*---------------------------------------------------------------------------*/ -/* TMP-007 register values */ -#define VAL_CONFIG_ON 0x1000 /**< Sensor on state */ -#define VAL_CONFIG_OFF 0x0000 /**< Sensor off state */ -#define VAL_CONFIG_RESET 0x8000 -#define VAL_PROD_ID 0x0078 /**< Product ID */ -/*---------------------------------------------------------------------------*/ -/* Conversion ready (status register) bit values */ -#define CONV_RDY_BIT 0x4000 -/*---------------------------------------------------------------------------*/ -/* Register length */ -#define REGISTER_LENGTH 2 -/*---------------------------------------------------------------------------*/ -/* Sensor data size */ -#define DATA_SIZE 4 -/*---------------------------------------------------------------------------*/ -/* Byte swap of 16-bit register value */ -#define HI_UINT16(a) (((a) >> 8) & 0xFF) -#define LO_UINT16(a) (((a) >> 0) & 0xFF) - -#define SWAP16(v) ((LO_UINT16(v) << 8) | (HI_UINT16(v) << 0)) - -#define LSB16(v) (LO_UINT16(v)), (HI_UINT16(v)) -#define MSB16(v) (HI_UINT16(v)), (LO_UINT16(v)) -/*---------------------------------------------------------------------------*/ -static const PIN_Config pin_table[] = { - TMP_007_TMP_RDY | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS | PIN_IRQ_NEGEDGE, - PIN_TERMINATE -}; - -static PIN_State pin_state; -static PIN_Handle pin_handle; - -static I2C_Handle i2c_handle; -/*---------------------------------------------------------------------------*/ -typedef struct { - TMP_007_TYPE type; - volatile TMP_007_STATUS status; - uint16_t local_tmp_latched; - uint16_t obj_tmp_latched; -} TMP_007_Object; - -static TMP_007_Object tmp_007; -/*---------------------------------------------------------------------------*/ -/* Wait SENSOR_STARTUP_DELAY clock ticks for the sensor to be ready - 275ms */ -#define SENSOR_STARTUP_DELAY 36 - -static struct ctimer startup_timer; -/*---------------------------------------------------------------------------*/ -/** - * \brief Setup and peform an I2C transaction. - * \param wbuf Output buffer during the I2C transation. - * \param wcount How many bytes in the wbuf. - * \param rbuf Input buffer during the I2C transation. - * \param rcount How many bytes to read into rbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static bool -i2c_write_read(void *wbuf, size_t wcount, void *rbuf, size_t rcount) -{ - I2C_Transaction i2c_transaction = { - .writeBuf = wbuf, - .writeCount = wcount, - .readBuf = rbuf, - .readCount = rcount, - .slaveAddress = TMP_007_I2C_ADDRESS, - }; - - return I2C_transfer(i2c_handle, &i2c_transaction); -} -/** - * \brief Peform a write only I2C transaction. - * \param wbuf Output buffer during the I2C transation. - * \param wcount How many bytes in the wbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static inline bool -i2c_write(void *wbuf, size_t wcount) -{ - return i2c_write_read(wbuf, wcount, NULL, 0); -} -/** - * \brief Peform a read only I2C transaction. - * \param rbuf Input buffer during the I2C transation. - * \param rcount How many bytes to read into rbuf. - * \return true if the I2C operation was successful; - * else, return false. - */ -static inline bool -i2c_read(void *rbuf, size_t rcount) -{ - return i2c_write_read(NULL, 0, rbuf, rcount); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the TMP-007 sensor driver. - * \return true if I2C operation successful; else, return false. - */ -static bool -sensor_init(void) -{ - if(pin_handle && i2c_handle) { - return true; - } - - pin_handle = PIN_open(&pin_state, pin_table); - if(!pin_handle) { - return false; - } - - I2C_Params i2c_params; - I2C_Params_init(&i2c_params); - - i2c_params.transferMode = I2C_MODE_BLOCKING; - i2c_params.bitRate = I2C_400kHz; - - i2c_handle = I2C_open(Board_I2C0, &i2c_params); - if(i2c_handle == NULL) { - PIN_close(pin_handle); - return false; - } - - tmp_007.status = TMP_007_STATUS_DISABLED; - - return true; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Callback when sensor is ready to read data from. - */ -static void -notify_ready_cb(void *not_used) -{ - tmp_007.status = TMP_007_STATUS_READY; - sensors_changed(&tmp_007_sensor); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Turn the sensor on or off. - */ -static bool -enable_sensor(bool enable) -{ - uint16_t cfg_value = (enable) - ? VAL_CONFIG_ON - : VAL_CONFIG_OFF; - - uint8_t cfg_data[] = { REG_CONFIG, LSB16(cfg_value) }; - - return i2c_write(cfg_data, sizeof(cfg_data)); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Read the sensor value registers. - * \param local_tmp Output variable holding the Temperature in - * 16-bit format. - * \param obj_tmp Output variable holding the Object temperature in - * 16-bit format. - * \return true if valid data could be retrieved; else, false. - */ -static bool -read_data(uint16_t *local_tmp, uint16_t *obj_tmp) -{ - bool spi_ok = false; - - uint8_t status_data[] = { REG_STATUS }; - uint16_t status_value = 0; - - spi_ok = i2c_write_read(status_data, sizeof(status_data), - &status_value, sizeof(status_value)); - if(!spi_ok) { - return false; - } - status_value = SWAP16(status_value); - - if((status_value & CONV_RDY_BIT) == 0) { - return false; - } - - uint8_t local_temp_data[] = { REG_LOCAL_TEMP }; - uint16_t local_temp_value = 0; - - spi_ok = i2c_write_read(local_temp_data, sizeof(local_temp_data), - &local_temp_value, sizeof(local_temp_value)); - if(!spi_ok) { - return false; - } - - uint8_t obj_temp_data[] = { REG_OBJ_TEMP }; - uint16_t obj_temp_value = 0; - - spi_ok = i2c_write_read(obj_temp_data, sizeof(obj_temp_data), - &obj_temp_value, sizeof(obj_temp_value)); - if(!spi_ok) { - return false; - } - - *local_tmp = SWAP16(local_temp_value); - *obj_tmp = SWAP16(obj_temp_value); - - return true; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert raw data to values in degrees Celsius. - * \param local_tmp Output variable holding the raw ambient temperature - * from sensor. - * \param obj_tmp Output variable holding the raw object temperature - * from sensor. - */ -static void -convert(uint16_t *local_tmp, uint16_t *obj_tmp) -{ - uint32_t local = (uint32_t)*local_tmp; - uint32_t obj = (uint32_t)*obj_tmp; - - local = (local >> 2) * 3125 / 100; - obj = (obj >> 2) * 3125 / 100; - - *local_tmp = (uint16_t)local; - *obj_tmp = (uint16_t)obj; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns a reading from the sensor. - * \param type TMP_007_SENSOR_TYPE_OBJECT or TMP_007_SENSOR_TYPE_AMBIENT. - * \return Object or Ambient temperature in milli degrees Celsius. - */ -static int -value(int type) -{ - uint16_t raw_local_tmp = 0, local_tmp = 0; - uint16_t raw_obj_tmp = 0, obj_tmp = 0; - - if(tmp_007.status != TMP_007_STATUS_READY) { - PRINTF("Sensor disabled or starting up (%d)\n", tmp_007.status); - return TMP_007_READING_ERROR; - } - - switch(type) { - case TMP_007_TYPE_OBJECT: return tmp_007.obj_tmp_latched; - case TMP_007_TYPE_AMBIENT: return tmp_007.local_tmp_latched; - - case TMP_007_TYPE_ALL: - if(!read_data(&raw_local_tmp, &raw_obj_tmp)) { - return TMP_007_READING_ERROR; - } - - local_tmp = raw_local_tmp; - obj_tmp = raw_obj_tmp; - convert(&local_tmp, &obj_tmp); - - PRINTF("TMP: %04X %04X o=%d a=%d\n", raw_local_tmp, raw_obj_tmp, - (int)(local_tmp), (int)(obj_tmp)); - - tmp_007.local_tmp_latched = (int)(local_tmp); - tmp_007.obj_tmp_latched = (int)(obj_tmp); - - return 0; - - default: - PRINTF("Invalid type (%d)\n", type); - return TMP_007_READING_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Configuration function for the TMP-007 sensor. - * \param type Activate, enable or disable the sensor. See below. - * \param enable Enable or disable sensor. - * - * When type == SENSORS_HW_INIT we turn on the hardware. - * When type == SENSORS_ACTIVE and enable==1 we enable the sensor. - * When type == SENSORS_ACTIVE and enable==0 we disable the sensor. - */ -static int -configure(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - if(!sensor_init()) { - return TMP_007_STATUS_DISABLED; - } - - enable_sensor(false); - - tmp_007.status = TMP_007_STATUS_INITIALIZED; - break; - - case SENSORS_ACTIVE: - /* Must be initialised first */ - if(tmp_007.status == TMP_007_STATUS_DISABLED) { - return TMP_007_STATUS_DISABLED; - } - if(enable) { - enable_sensor(true); - ctimer_set(&startup_timer, SENSOR_STARTUP_DELAY, notify_ready_cb, NULL); - tmp_007.status = TMP_007_STATUS_NOT_READY; - } else { - ctimer_stop(&startup_timer); - enable_sensor(false); - tmp_007.status = TMP_007_STATUS_INITIALIZED; - } - break; - - default: - break; - } - - return tmp_007.status; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the status of the sensor. - * \param type Ignored. - * \return Status of the sensor. - */ -static int -status(int type) -{ - (void)type; - - return tmp_007.status; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(tmp_007_sensor, "TMP-007", value, configure, status); -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_SENSORS_ENABLE */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/tmp-007-sensor.h b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/tmp-007-sensor.h deleted file mode 100644 index 1c806abe8..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/tmp-007-sensor.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup sensortag-peripherals - * @{ - * - * \defgroup sensortag-tmp-sensor SensorTag IR Thermophile sensor - * - * Due to the time required for the sensor to startup, this driver is - * meant to be used in an asynchronous fashion. The caller must first - * activate the sensor by calling SENSORS_ACTIVATE(). This will trigger - * the sensor's startup sequence, but the call will not wait for it to - * complete so that the CPU can perform other tasks or drop to a low - * power mode. - * - * Once the sensor is stable, the driver will generate a - * sensors_changed event. - * - * The caller should then use value(TMP_007_SENSOR_TYPE_ALL) to - * read sensor values and latch them. Once completed successfully, - * individual readings can be retrieved with calls to - * value(TMP_007_SENSOR_TYPE_OBJECT) or - * value(TMP_007_SENSOR_TYPE_AMBIENT). - * - * Once required readings have been taken, the caller has two options: - * - Turn the sensor off by calling SENSORS_DEACTIVATE, but in order - * to take subsequent readings SENSORS_ACTIVATE must be called again. - * - Leave the sensor on. In this scenario, the caller can simply keep - * calling value(TMP_007_SENSOR_TYPE_ALL) to read and latch new - * values. However keeping the sensor on will consume more energy. - * @{ - * - * \file - * Header file for the Sensortag TMP-007 IR Thermophile sensor. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef TMP_007_SENSOR_H_ -#define TMP_007_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -/*---------------------------------------------------------------------------*/ -#if BOARD_SENSORS_ENABLE -#if (TI_I2C_CONF_ENABLE == 0) || (TI_I2C_CONF_I2C0_ENABLE == 0) -#error "The BMP280 requires the I2C driver to be enabled (TI_I2C_CONF_ENABLE = 1)" -#endif -#endif -/*---------------------------------------------------------------------------*/ -typedef enum { - TMP_007_TYPE_OBJECT = (1 << 0), - TMP_007_TYPE_AMBIENT = (1 << 1), - - TMP_007_TYPE_ALL = (TMP_007_TYPE_OBJECT | - TMP_007_TYPE_AMBIENT), -} TMP_007_TYPE; -/*---------------------------------------------------------------------------*/ -typedef enum { - TMP_007_STATUS_DISABLED, - TMP_007_STATUS_INITIALIZED, - TMP_007_STATUS_NOT_READY, - TMP_007_STATUS_READY, - TMP_007_STATUS_I2C_ERROR, -} TMP_007_STATUS; -/*---------------------------------------------------------------------------*/ -#define TMP_007_READING_ERROR -1 -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor tmp_007_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* TMP_007_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/Makefile.srf06 b/arch/platform/simplelink/cc13xx-cc26xx/srf06/Makefile.srf06 deleted file mode 100644 index d6686e10a..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/Makefile.srf06 +++ /dev/null @@ -1,11 +0,0 @@ -################################################################################ -# SimpleLink LaunchPad makefile - -BOARD_TYPE = BOARD_SMARTRF06EB - -# leds-arch.c etc. -BOARD_SOURCEFILES += srf06-sensors.c -BOARD_SOURCEFILES += button-sensor-arch.c leds-arch.c -BOARD_SOURCEFILES += als-sensor.c - -TARGET_FAMILY_DIRS += srf06 diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/als-sensor.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/als-sensor.c deleted file mode 100644 index 4f625943b..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/als-sensor.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup srf06-peripherals - * @{ - * - * \file - * Driver for the SmartRF06 EB ALS sensor. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" -#include "lib/sensors.h" -#include "sys/timer.h" - -#include "als-sensor.h" -/*---------------------------------------------------------------------------*/ -#include - -#include -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -static ADC_Handle adc_handle; -/*---------------------------------------------------------------------------*/ -static int -init(void) -{ - ADC_Params adc_params; - ADC_Params_init(&adc_params); - - adc_handle = ADC_open(Board_ADCALS, &adc_params); - if(adc_handle == NULL) { - return 0; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -config(int type, int enable) -{ - switch(type) { - case SENSORS_HW_INIT: - return init(); - - case SENSORS_ACTIVE: - gpio_hal_arch_pin_set_output(Board_ALS_PWR); - gpio_hal_arch_pin_set_input(Board_ALS_OUT); - - if(enable) { - gpio_hal_arch_set_pin(Board_ALS_PWR); - clock_delay_usec(2000); - } else { - gpio_hal_arch_clear_pin(Board_ALS_PWR); - } - break; - - default: - break; - } - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - - uint16_t adc_value = 0; - int_fast16_t res = ADC_convert(adc_handle, &adc_value); - if(res != ADC_STATUS_SUCCESS) { - return -1; - } - - return (int)adc_value; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(als_sensor, ALS_SENSOR, value, config, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/als-sensor.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/als-sensor.h deleted file mode 100644 index dd9141fad..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/als-sensor.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup srf06-peripherals - * @{ - * - * \file - * Header file for the SmartRF06 EB ALS sensor. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef ALS_SENSOR_H_ -#define ALS_SENSOR_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define ALS_SENSOR "ALS" -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor als_sensor; -/*---------------------------------------------------------------------------*/ -#endif /* ALS_SENSOR_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/board-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/board-conf.h deleted file mode 100644 index 7d6f8328f..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/board-conf.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup srf06-peripherals - * @{ - * - * \file - * Header file with definitions related to SmartRF06 EB boards. - * \author - * Edvard Pettersen - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_CONF_H_ -#define BOARD_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf-conf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name LED configurations for the dev/leds.h API. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define PLATFORM_HAS_LEDS 1 - -#define LEDS_CONF_COUNT 4 - -#define LEDS_CONF_RED 0 -#define LEDS_CONF_YELLOW 1 -#define LEDS_CONF_GREEN 2 -#define LEDS_CONF_ORANGE 3 - -#define LEDS_CONF_ALL ((1 << LEDS_CONF_COUNT) - 1) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Button configurations for the dev/button-hal.h API. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define PLATFORM_HAS_BUTTON 1 -#define PLATFORM_SUPPORTS_BUTTON_HAL 1 - -#define BUTTON_HAL_ID_KEY_LEFT 0 -#define BUTTON_HAL_ID_KEY_RIGHT 1 -#define BUTTON_HAL_ID_KEY_UP 2 -#define BUTTON_HAL_ID_KEY_DOWN 3 -#define BUTTON_HAL_ID_KEY_SELECT 4 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SmartRF06 EB does have sensors. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_CONF_HAS_SENSORS 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Enable or disable the SmartRF06EB sensors. - * - * Those values are not meant to be modified by the user - * @{ - */ -#define BOARD_SENSORS_ENABLE (!(BOARD_CONF_SENSORS_DISABLE)) -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/board-peripherals.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/board-peripherals.h deleted file mode 100644 index 5a30b5fe1..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/board-peripherals.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc13xx-cc26xx-platform - * @{ - * - * \defgroup srf06-peripherals SmartRF06 Evaluation Board peripherals - * - * Defines related to configuring SmartRF06 EB's peripherals. All - * SmartRF06 EBs are identical to a very large extent. Everything - * documented within this group applies to all SmartRF06 EBs. - * - * @{ - * - * \file - * Header file with definitions related to SmartRF06 EB boards. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#ifndef BOARD_PERIPHERALS_H_ -#define BOARD_PERIPHERALS_H_ -/*---------------------------------------------------------------------------*/ -#include "als-sensor.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_PERIPHERALS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/button-sensor-arch.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/button-sensor-arch.c deleted file mode 100644 index 9c3df6abb..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/button-sensor-arch.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup srf06-peripherals - * @{ - * - * \file - * Button HAL definitions for the SmartRF06 Evaluation Board's buttons. - * Common across all CC13xx/CC26xx devices on SmartRF06 EB. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/button-hal.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -/* Key select button */ -BUTTON_HAL_BUTTON( - key_select, /**< Name */ - "Key Select", /**< Description */ - Board_KEY_SELECT, /**< PIN */ - GPIO_HAL_PIN_CFG_PULL_UP | - GPIO_HAL_PIN_CFG_HYSTERESIS, /**< Pull configuration */ - BUTTON_HAL_ID_KEY_SELECT, /**< Unique ID */ - true); /**< Negative logic */ - -/* Key up button */ -BUTTON_HAL_BUTTON( - key_up, /**< Name */ - "Key Up", /**< Description */ - Board_KEY_UP, /**< PIN */ - GPIO_HAL_PIN_CFG_PULL_UP | - GPIO_HAL_PIN_CFG_HYSTERESIS, /**< Pull configuration */ - BUTTON_HAL_ID_KEY_UP, /**< Unique ID */ - true); /**< Negative logic */ - -/* Key down button */ -BUTTON_HAL_BUTTON( - key_down, /**< Name */ - "Key Down", /**< Description */ - Board_KEY_DOWN, /**< PIN */ - GPIO_HAL_PIN_CFG_PULL_UP | - GPIO_HAL_PIN_CFG_HYSTERESIS, /**< Pull configuration */ - BUTTON_HAL_ID_KEY_DOWN, /**< Unique ID */ - true); /**< Negative logic */ - -/* Key left button */ -BUTTON_HAL_BUTTON( - key_left, /**< Name */ - "Key Left", /**< Description */ - Board_KEY_LEFT, /**< PIN */ - GPIO_HAL_PIN_CFG_PULL_UP | - GPIO_HAL_PIN_CFG_HYSTERESIS, /**< Pull configuration */ - BUTTON_HAL_ID_KEY_LEFT, /**< Unique ID */ - true); /**< Negative logic */ - -/* Key right button */ -BUTTON_HAL_BUTTON( - key_right, /**< Name */ - "Key Right", /**< Description */ - Board_KEY_RIGHT, /**< PIN */ - GPIO_HAL_PIN_CFG_PULL_UP | - GPIO_HAL_PIN_CFG_HYSTERESIS, /**< Pull configuration */ - BUTTON_HAL_ID_KEY_RIGHT, /**< Unique ID */ - true); /**< Negative logic */ -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTONS(&key_select, &key_up, &key_down, &key_left, &key_right); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/Board.h deleted file mode 100644 index 48d232e54..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/Board.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC1350DK_7XD.h" - -#define Board_CC1350DK_7XD -#define BOARD_STRING "TI SmartRF06EB + CC13x0 EM" - -#define Board_initGeneral() CC1350DK_7XD_initGeneral() -#define Board_shutDownExtFlash() CC1350DK_7XD_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC1350DK_7XD_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADCALS CC1350DK_7XD_ADCALS - -#define Board_ADC0 CC1350DK_7XD_ADCVDDS -#define Board_ADC1 CC1350DK_7XD_ADCALS - -#define Board_ADCBUF0 CC1350DK_7XD_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC1350DK_7XD_ADCBUF0CHANNELVDDS -#define Board_ADCBUF0CHANNEL1 CC1350DK_7XD_ADCBUF0CHANNELADCALS - -#define Board_CRYPTO0 CC1350DK_7XD_CRYPTO0 - -#define Board_DIO0 CC1350DK_7XD_DIO0 -#define Board_DIO1_RFSW CC1350DK_7XD_DIO1_RFSW -#define Board_DIO12 CC1350DK_7XD_DIO12 -#define Board_DIO15 CC1350DK_7XD_DIO15 -#define Board_DIO16_TDO CC1350DK_7XD_DIO16_TDO -#define Board_DIO17_TDI CC1350DK_7XD_DIO17_TDI -#define Board_DIO21 CC1350DK_7XD_DIO21 -#define Board_DIO22 CC1350DK_7XD_DIO22 - -#define Board_DIO23_ANALOG CC1350DK_7XD_DIO23_ANALOG -#define Board_DIO24_ANALOG CC1350DK_7XD_DIO24_ANALOG -#define Board_DIO25_ANALOG CC1350DK_7XD_DIO25_ANALOG -#define Board_DIO26_ANALOG CC1350DK_7XD_DIO26_ANALOG -#define Board_DIO27_ANALOG CC1350DK_7XD_DIO27_ANALOG -#define Board_DIO28_ANALOG CC1350DK_7XD_DIO28_ANALOG -#define Board_DIO29_ANALOG CC1350DK_7XD_DIO29_ANALOG -#define Board_DIO30_ANALOG CC1350DK_7XD_DIO30_ANALOG - -#define Board_GPIO_BTN0 CC1350DK_7XD_PIN_KEY_SELECT -#define Board_GPIO_BTN1 CC1350DK_7XD_PIN_KEY_UP -#define Board_GPIO_BTN2 CC1350DK_7XD_PIN_KEY_DOWN -#define Board_GPIO_BTN3 CC1350DK_7XD_PIN_KEY_LEFT -#define Board_GPIO_BTN4 CC1350DK_7XD_PIN_KEY_RIGHT -#define Board_GPIO_LED0 CC1350DK_7XD_PIN_LED1 -#define Board_GPIO_LED1 CC1350DK_7XD_PIN_LED2 -#define Board_GPIO_LED2 CC1350DK_7XD_PIN_LED3 -#define Board_GPIO_LED3 CC1350DK_7XD_PIN_LED4 -#define Board_GPIO_LED_ON CC1350DK_7XD_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC1350DK_7XD_GPIO_LED_OFF - -#define Board_GPTIMER0A CC1350DK_7XD_GPTIMER0A -#define Board_GPTIMER0B CC1350DK_7XD_GPTIMER0B -#define Board_GPTIMER1A CC1350DK_7XD_GPTIMER1A -#define Board_GPTIMER1B CC1350DK_7XD_GPTIMER1B -#define Board_GPTIMER2A CC1350DK_7XD_GPTIMER2A -#define Board_GPTIMER2B CC1350DK_7XD_GPTIMER2B -#define Board_GPTIMER3A CC1350DK_7XD_GPTIMER3A -#define Board_GPTIMER3B CC1350DK_7XD_GPTIMER3B - -#define Board_I2C0 CC1350DK_7XD_I2C0 - -#define Board_NVSINTERNAL CC1350DK_7XD_NVSCC26XX0 - -#define Board_KEY_SELECT CC1350DK_7XD_PIN_KEY_SELECT -#define Board_KEY_UP CC1350DK_7XD_PIN_KEY_UP -#define Board_KEY_DOWN CC1350DK_7XD_PIN_KEY_DOWN -#define Board_KEY_LEFT CC1350DK_7XD_PIN_KEY_LEFT -#define Board_KEY_RIGHT CC1350DK_7XD_PIN_KEY_RIGHT - -#define Board_PIN_BUTTON0 CC1350DK_7XD_PIN_KEY_SELECT -#define Board_PIN_BUTTON1 CC1350DK_7XD_PIN_KEY_UP -#define Board_PIN_BUTTON2 CC1350DK_7XD_PIN_KEY_DOWN -#define Board_PIN_BUTTON3 CC1350DK_7XD_PIN_KEY_LEFT -#define Board_PIN_BUTTON4 CC1350DK_7XD_PIN_KEY_RIGHT -#define Board_PIN_BTN1 CC1350DK_7XD_PIN_KEY_SELECT -#define Board_PIN_BTN2 CC1350DK_7XD_PIN_KEY_UP -#define Board_PIN_BTN3 CC1350DK_7XD_PIN_KEY_DOWN -#define Board_PIN_BTN4 CC1350DK_7XD_PIN_KEY_LEFT -#define Board_PIN_BTN5 CC1350DK_7XD_PIN_KEY_RIGHT -#define Board_PIN_LED0 CC1350DK_7XD_PIN_LED1 -#define Board_PIN_LED1 CC1350DK_7XD_PIN_LED2 -#define Board_PIN_LED2 CC1350DK_7XD_PIN_LED3 -#define Board_PIN_LED3 CC1350DK_7XD_PIN_LED4 - -#define Board_PWM0 CC1350DK_7XD_PWM0 -#define Board_PWM1 CC1350DK_7XD_PWM1 -#define Board_PWM2 CC1350DK_7XD_PWM2 -#define Board_PWM3 CC1350DK_7XD_PWM3 -#define Board_PWM4 CC1350DK_7XD_PWM4 -#define Board_PWM5 CC1350DK_7XD_PWM5 -#define Board_PWM6 CC1350DK_7XD_PWM6 -#define Board_PWM7 CC1350DK_7XD_PWM7 - -#define Board_SD0 CC1350DK_7XD_SDSPI0 - -#define Board_SPI0 CC1350DK_7XD_SPI0 -#define Board_SPI0_MISO CC1350DK_7XD_SPI0_MISO -#define Board_SPI0_MOSI CC1350DK_7XD_SPI0_MOSI -#define Board_SPI0_CLK CC1350DK_7XD_SPI0_CLK -#define Board_SPI0_CSN CC1350DK_7XD_SPI0_CSN -#define Board_SPI1 CC1350DK_7XD_SPI1 -#define Board_SPI1_MISO CC1350DK_7XD_SPI1_MISO -#define Board_SPI1_MOSI CC1350DK_7XD_SPI1_MOSI -#define Board_SPI1_CLK CC1350DK_7XD_SPI1_CLK -#define Board_SPI1_CSN CC1350DK_7XD_SPI1_CSN -#define Board_FLASH_CS_ON 0 -#define Board_FLASH_CS_OFF 1 - -#define Board_SPI_MASTER CC1350DK_7XD_SPI0 -#define Board_SPI_SLAVE CC1350DK_7XD_SPI0 -#define Board_SPI_MASTER_READY CC1350DK_7XD_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC1350DK_7XD_SPI_SLAVE_READY - -#define Board_UART0 CC1350DK_7XD_UART0 - -#define Board_WATCHDOG0 CC1350DK_7XD_WATCHDOG0 - -#define Board_SDCARD_CS CC1350DK_7XD_SDCARD_CS - -#define Board_LCD_MODE CC1350DK_7XD_LCD_MODE -#define Board_LCD_RST CC1350DK_7XD_LCD_RST -#define Board_LCD_CS CC1350DK_7XD_LCD_CS - -#define Board_ALS_OUT CC1350DK_7XD_ALS_OUT -#define Board_ALS_PWR CC1350DK_7XD_ALS_PWR - -#define Board_ACC_PWR CC1350DK_7XD_ACC_PWR -#define Board_ACC_CS CC1350DK_7XD_ACC_CS - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c deleted file mode 100644 index 2040a7582..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c +++ /dev/null @@ -1,719 +0,0 @@ -/* - * Copyright (c) 2016-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC1350DK_7XD.c =================================== - * This file is responsible for setting up the board specific items for the - * CC1350DK_7XD board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC1350DK_7XD.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26XX_Object adcBufCC26xxObjects[CC1350DK_7XD_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[CC1350DK_7XD_ADCBUF0CHANNELCOUNT] = { - {CC1350DK_7XD_ALS_OUT, ADC_COMPB_IN_AUXIO7}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, -}; - -const ADCBufCC26XX_HWAttrs adcBufCC26xxHWAttrs[CC1350DK_7XD_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26XX_adcChannelLut, - .gpTimerUnit = CC1350DK_7XD_GPTIMER0A, - .gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC1350DK_7XD_ADCBUFCOUNT] = { - { - &ADCBufCC26XX_fxnTable, - &adcBufCC26xxObjects[CC1350DK_7XD_ADCBUF0], - &adcBufCC26xxHWAttrs[CC1350DK_7XD_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC1350DK_7XD_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC1350DK_7XD_ADCCOUNT]; - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1350DK_7XD_ADCCOUNT] = { - { - .adcDIO = CC1350DK_7XD_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC1350DK_7XD_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCALS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCALS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCDCOUPL], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCVSS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCVDDS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC1350DK_7XD_ADCCOUNT; - -/* - * =============================== Crypto =============================== - */ -#include - -CryptoCC26XX_Object cryptoCC26XXObjects[CC1350DK_7XD_CRYPTOCOUNT]; - -const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC1350DK_7XD_CRYPTOCOUNT] = { - { - .baseAddr = CRYPTO_BASE, - .powerMngrId = PowerCC26XX_PERIPH_CRYPTO, - .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ, - .intPriority = ~0, - } -}; - -const CryptoCC26XX_Config CryptoCC26XX_config[CC1350DK_7XD_CRYPTOCOUNT] = { - { - .object = &cryptoCC26XXObjects[CC1350DK_7XD_CRYPTO0], - .hwAttrs = &cryptoCC26XXHWAttrs[CC1350DK_7XD_CRYPTO0] - }, -}; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC1350DK_7XD.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_11 | GPIO_DO_NOT_CONFIG, /* Key Select */ - GPIOCC26XX_DIO_19 | GPIO_DO_NOT_CONFIG, /* Key Up */ - GPIOCC26XX_DIO_12 | GPIO_DO_NOT_CONFIG, /* Key Down */ - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Key Left */ - GPIOCC26XX_DIO_18 | GPIO_DO_NOT_CONFIG, /* Key Right */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1350DK_7XD_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1350DK_7XD_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_25 | GPIO_DO_NOT_CONFIG, /* LED 1 */ - GPIOCC26XX_DIO_27 | GPIO_DO_NOT_CONFIG, /* LED 2 */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* LED 3 */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* LED 4 */ - - /* SDCARD */ - GPIOCC26XX_DIO_30 | GPIO_DO_NOT_CONFIG, /* SPI chip select */ - - /* Accelerometer */ - GPIOCC26XX_DIO_24 | GPIO_DO_NOT_CONFIG, /* SPI chip select */ -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC2650_LAUNCH.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC1350DK_7XD_SPI_MASTER_READY */ - NULL, /* CC1350DK_7XD_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC1350DK_7XD_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC1350DK_7XD_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1350DK_7XD_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC1350DK_7XD_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350DK_7XD_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC1350DK_7XD_I2C0_SDA0, - .sclPin = CC1350DK_7XD_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC1350DK_7XD_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC1350DK_7XD_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC1350DK_7XD_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC1350DK_7XD_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x1A000 -#define SECTORSIZE 0x1000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC1350DK_7XD_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC1350DK_7XD_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC1350DK_7XD_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1350DK_7XD_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1350DK_7XD_PIN_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1350DK_7XD_PIN_LED4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC1350DK_7XD_PIN_KEY_SELECT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350DK_7XD_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350DK_7XD_PIN_KEY_DOWN | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350DK_7XD_PIN_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350DK_7XD_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC1350DK_7XD_SDCARD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1350DK_7XD_ACC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1350DK_7XD_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */ - CC1350DK_7XD_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC1350DK_7XD_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC1350DK_7XD_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC1350DK_7XD_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26XX_Config PowerCC26XX_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1350DK_7XD_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWMCOUNT] = { - { .pwmPin = CC1350DK_7XD_PWMPIN0, .gpTimerUnit = CC1350DK_7XD_GPTIMER0A }, - { .pwmPin = CC1350DK_7XD_PWMPIN1, .gpTimerUnit = CC1350DK_7XD_GPTIMER0B }, - { .pwmPin = CC1350DK_7XD_PWMPIN2, .gpTimerUnit = CC1350DK_7XD_GPTIMER1A }, - { .pwmPin = CC1350DK_7XD_PWMPIN3, .gpTimerUnit = CC1350DK_7XD_GPTIMER1B }, - { .pwmPin = CC1350DK_7XD_PWMPIN4, .gpTimerUnit = CC1350DK_7XD_GPTIMER2A }, - { .pwmPin = CC1350DK_7XD_PWMPIN5, .gpTimerUnit = CC1350DK_7XD_GPTIMER2B }, - { .pwmPin = CC1350DK_7XD_PWMPIN6, .gpTimerUnit = CC1350DK_7XD_GPTIMER3A }, - { .pwmPin = CC1350DK_7XD_PWMPIN7, .gpTimerUnit = CC1350DK_7XD_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC1350DK_7XD_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM0], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM1], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM2], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM3], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM4], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM5], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM6], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM7], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM7] }, -}; - -const uint_least8_t PWM_count = CC1350DK_7XD_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - .globalCallback = NULL, /* No board specific callback */ - .globalEventMask = 0 /* No events subscribed to */ -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC1350DK_7XD_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC1350DK_7XD_SDCOUNT] = { - { - .spiIndex = CC1350DK_7XD_SPI0, - .spiCsGpioIndex = CC1350DK_7XD_SDCARD_CS - } -}; - -const SD_Config SD_config[CC1350DK_7XD_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC1350DK_7XD_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC1350DK_7XD_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC1350DK_7XD_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350DK_7XD_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X0_Object trngCC26X0Object[CC1350DK_7XD_TRNGCOUNT]; - -const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1350DK_7XD_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC1350DK_7XD_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC1350DK_7XD_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC1350DK_7XD_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350DK_7XD_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC1350DK_7XD_UART_TX, - .rxPin = CC1350DK_7XD_UART_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC1350DK_7XD_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1350DK_7XD_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC1350DK_7XD_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC1350DK_7XD_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC1350DK_7XD_UART0] - }, -#endif -}; - -const uint_least8_t UART_count = CC1350DK_7XD_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC1350DK_7XD_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC1350DK_7XD_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC1350DK_7XD_UDMACOUNT] = { - { - .object = &udmaObjects[CC1350DK_7XD_UDMA0], - .hwAttrs = &udmaHWAttrs[CC1350DK_7XD_UDMA0] - }, -}; - - - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC1350DK_7XD_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1350DK_7XD_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC1350DK_7XD_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC1350DK_7XD_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC1350DK_7XD_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC1350DK_7XD_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC1350DK_7XD_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC1350DK_7XD_initGeneral ======== - */ -void CC1350DK_7XD_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.h deleted file mode 100644 index 4c705abe5..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.h +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** ============================================================================ - * @file CC1350DK_7XD.h - * - * @brief CC2650 LaunchPad Board Specific header file. - * - * The CC1350DK_7XD header file should be included in an application as - * follows: - * @code - * #include "CC1350DK_7XD.h" - * @endcode - * - * ============================================================================ - */ -#ifndef __CC1350DK_7XD_BOARD_H__ -#define __CC1350DK_7XD_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC1350DK_7XD - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Analog Capable DIOs */ -#define CC1350DK_7XD_DIO23_ANALOG IOID_23 -#define CC1350DK_7XD_DIO24_ANALOG IOID_24 -#define CC1350DK_7XD_DIO25_ANALOG IOID_25 -#define CC1350DK_7XD_DIO26_ANALOG IOID_26 -#define CC1350DK_7XD_DIO27_ANALOG IOID_27 -#define CC1350DK_7XD_DIO28_ANALOG IOID_28 -#define CC1350DK_7XD_DIO29_ANALOG IOID_29 -#define CC1350DK_7XD_DIO30_ANALOG IOID_30 - -/* Digital IOs */ -#define CC1350DK_7XD_DIO0 IOID_0 -#define CC1350DK_7XD_DIO1_RFSW IOID_1 -#define CC1350DK_7XD_DIO12 IOID_12 -#define CC1350DK_7XD_DIO15 IOID_15 -#define CC1350DK_7XD_DIO16_TDO IOID_16 -#define CC1350DK_7XD_DIO17_TDI IOID_17 -#define CC1350DK_7XD_DIO21 IOID_21 -#define CC1350DK_7XD_DIO22 IOID_22 - -/* Discrete Inputs */ -#define CC1350DK_7XD_PIN_KEY_SELECT IOID_11 -#define CC1350DK_7XD_PIN_KEY_UP IOID_19 -#define CC1350DK_7XD_PIN_KEY_DOWN IOID_12 -#define CC1350DK_7XD_PIN_KEY_LEFT IOID_15 -#define CC1350DK_7XD_PIN_KEY_RIGHT IOID_18 - -/* GPIO */ -#define CC1350DK_7XD_GPIO_LED_ON 1 -#define CC1350DK_7XD_GPIO_LED_OFF 0 - -/* I2C */ -#define CC1350DK_7XD_I2C0_SCL0 PIN_UNASSIGNED -#define CC1350DK_7XD_I2C0_SDA0 PIN_UNASSIGNED - -/* LEDs */ -#define CC1350DK_7XD_PIN_LED_ON 1 -#define CC1350DK_7XD_PIN_LED_OFF 0 -#define CC1350DK_7XD_PIN_LED1 IOID_25 -#define CC1350DK_7XD_PIN_LED2 IOID_27 -#define CC1350DK_7XD_PIN_LED3 IOID_7 -#define CC1350DK_7XD_PIN_LED4 IOID_6 - -/* PWM Outputs */ -#define CC1350DK_7XD_PWMPIN0 CC1350DK_7XD_PIN_LED1 -#define CC1350DK_7XD_PWMPIN1 CC1350DK_7XD_PIN_LED2 -#define CC1350DK_7XD_PWMPIN2 PIN_UNASSIGNED -#define CC1350DK_7XD_PWMPIN3 PIN_UNASSIGNED -#define CC1350DK_7XD_PWMPIN4 PIN_UNASSIGNED -#define CC1350DK_7XD_PWMPIN5 PIN_UNASSIGNED -#define CC1350DK_7XD_PWMPIN6 PIN_UNASSIGNED -#define CC1350DK_7XD_PWMPIN7 PIN_UNASSIGNED - -/* SPI Board */ -#define CC1350DK_7XD_SPI0_MISO IOID_8 -#define CC1350DK_7XD_SPI0_MOSI IOID_9 -#define CC1350DK_7XD_SPI0_CLK IOID_10 -#define CC1350DK_7XD_SPI0_CSN PIN_UNASSIGNED -#define CC1350DK_7XD_SPI1_MISO PIN_UNASSIGNED -#define CC1350DK_7XD_SPI1_MOSI PIN_UNASSIGNED -#define CC1350DK_7XD_SPI1_CLK PIN_UNASSIGNED -#define CC1350DK_7XD_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC1350DK_7XD_UART_RX IOID_2 -#define CC1350DK_7XD_UART_TX IOID_3 -#define CC1350DK_7XD_UART_CTS IOID_22 -#define CC1350DK_7XD_UART_RTS IOID_21 - -/* SD Card */ -#define CC1350DK_7XD_SDCARD_CS IOID_30 - -/* Ambient Light Sensor */ -#define CC1350DK_7XD_ALS_OUT IOID_23 -#define CC1350DK_7XD_ALS_PWR IOID_26 - -/* Accelerometer */ -#define CC1350DK_7XD_ACC_PWR IOID_20 -#define CC1350DK_7XD_ACC_CS IOID_24 - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC1350DK_7XD_initGeneral(void); - -/*! - * @brief Turn off the external flash on LaunchPads - * - */ -void CC1350DK_7XD_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC1350DK_7XD_wakeUpExtFlash(void); - -/*! - * @def CC1350DK_7XD_ADCBufName - * @brief Enum of ADCs - */ -typedef enum CC1350DK_7XD_ADCBufName { - CC1350DK_7XD_ADCBUF0 = 0, - - CC1350DK_7XD_ADCBUFCOUNT -} CC1350DK_7XD_ADCBufName; - -/*! - * @def CC1350DK_7XD_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC1350DK_7XD_ADCBuf0ChannelName { - CC1350DK_7XD_ADCBUF0CHANNELADCALS = 0, - CC1350DK_7XD_ADCBUF0CHANNELVDDS, - CC1350DK_7XD_ADCBUF0CHANNELDCOUPL, - CC1350DK_7XD_ADCBUF0CHANNELVSS, - - CC1350DK_7XD_ADCBUF0CHANNELCOUNT -} CC1350DK_7XD_ADCBuf0ChannelName; - -/*! - * @def CC1350DK_7XD_ADCName - * @brief Enum of ADCs - */ -typedef enum CC1350DK_7XD_ADCName { - CC1350DK_7XD_ADCALS = 0, - CC1350DK_7XD_ADCDCOUPL, - CC1350DK_7XD_ADCVSS, - CC1350DK_7XD_ADCVDDS, - - CC1350DK_7XD_ADCCOUNT -} CC1350DK_7XD_ADCName; - -/*! - * @def CC1350DK_7XD_CryptoName - * @brief Enum of Crypto names - */ -typedef enum CC1350DK_7XD_CryptoName { - CC1350DK_7XD_CRYPTO0 = 0, - - CC1350DK_7XD_CRYPTOCOUNT -} CC1350DK_7XD_CryptoName; - -/*! - * @def CC1350DK_7XD_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC1350DK_7XD_GPIOName { - CC1350DK_7XD_GPIO_KEY_SELECT = 0, - CC1350DK_7XD_GPIO_KEY_UP, - CC1350DK_7XD_GPIO_KEY_DOWN, - CC1350DK_7XD_GPIO_KEY_LEFT, - CC1350DK_7XD_GPIO_KEY_RIGHT, - CC1350DK_7XD_SPI_MASTER_READY, - CC1350DK_7XD_SPI_SLAVE_READY, - CC1350DK_7XD_GPIO_LED1, - CC1350DK_7XD_GPIO_LED2, - CC1350DK_7XD_GPIO_LED3, - CC1350DK_7XD_GPIO_LED4, - CC1350DK_7XD_GPIO_SDCARD_CS, - CC1350DK_7XD_GPIO_ACC_CS, - - CC1350DK_7XD_GPIOCOUNT -} CC1350DK_7XD_GPIOName; - -/*! - * @def CC1350DK_7XD_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC1350DK_7XD_GPTimerName { - CC1350DK_7XD_GPTIMER0A = 0, - CC1350DK_7XD_GPTIMER0B, - CC1350DK_7XD_GPTIMER1A, - CC1350DK_7XD_GPTIMER1B, - CC1350DK_7XD_GPTIMER2A, - CC1350DK_7XD_GPTIMER2B, - CC1350DK_7XD_GPTIMER3A, - CC1350DK_7XD_GPTIMER3B, - - CC1350DK_7XD_GPTIMERPARTSCOUNT -} CC1350DK_7XD_GPTimerName; - -/*! - * @def CC1350DK_7XD_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC1350DK_7XD_GPTimers { - CC1350DK_7XD_GPTIMER0 = 0, - CC1350DK_7XD_GPTIMER1, - CC1350DK_7XD_GPTIMER2, - CC1350DK_7XD_GPTIMER3, - - CC1350DK_7XD_GPTIMERCOUNT -} CC1350DK_7XD_GPTimers; - -/*! - * @def CC1350DK_7XD_I2CName - * @brief Enum of I2C names - */ -typedef enum CC1350DK_7XD_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC1350DK_7XD_I2C0 = 0, -#endif - - CC1350DK_7XD_I2CCOUNT -} CC1350DK_7XD_I2CName; - -/*! - * @def CC1350DK_7XD_NVSName - * @brief Enum of NVS names - */ -typedef enum CC1350DK_7XD_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC1350DK_7XD_NVSCC26XX0 = 0, -#endif - - CC1350DK_7XD_NVSCOUNT -} CC1350DK_7XD_NVSName; - -/*! - * @def CC1350DK_7XD_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC1350DK_7XD_PWMName { - CC1350DK_7XD_PWM0 = 0, - CC1350DK_7XD_PWM1, - CC1350DK_7XD_PWM2, - CC1350DK_7XD_PWM3, - CC1350DK_7XD_PWM4, - CC1350DK_7XD_PWM5, - CC1350DK_7XD_PWM6, - CC1350DK_7XD_PWM7, - - CC1350DK_7XD_PWMCOUNT -} CC1350DK_7XD_PWMName; - -/*! - * @def CC1350DK_7XD_SDName - * @brief Enum of SD names - */ -typedef enum CC1350DK_7XD_SDName { - CC1350DK_7XD_SDSPI0 = 0, - - CC1350DK_7XD_SDCOUNT -} CC1350DK_7XD_SDName; - -/*! - * @def CC1350DK_7XD_SPIName - * @brief Enum of SPI names - */ -typedef enum CC1350DK_7XD_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC1350DK_7XD_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC1350DK_7XD_SPI1, -#endif - - CC1350DK_7XD_SPICOUNT -} CC1350DK_7XD_SPIName; - -/*! - * @def CC1350DK_7XD_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC1350DK_7XD_TRNGName { - CC1350DK_7XD_TRNG0 = 0, - - CC1350DK_7XD_TRNGCOUNT -} CC1350DK_7XD_TRNGName; - -/*! - * @def CC1350DK_7XD_UARTName - * @brief Enum of UARTs - */ -typedef enum CC1350DK_7XD_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC1350DK_7XD_UART0 = 0, -#endif - - CC1350DK_7XD_UARTCOUNT -} CC1350DK_7XD_UARTName; - -/*! - * @def CC1350DK_7XD_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC1350DK_7XD_UDMAName { - CC1350DK_7XD_UDMA0 = 0, - - CC1350DK_7XD_UDMACOUNT -} CC1350DK_7XD_UDMAName; - -/*! - * @def CC1350DK_7XD_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC1350DK_7XD_WatchdogName { - CC1350DK_7XD_WATCHDOG0 = 0, - - CC1350DK_7XD_WATCHDOGCOUNT -} CC1350DK_7XD_WatchdogName; - -#ifdef __cplusplus -} -#endif - -#endif /* __CC1350DK_7XD_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD_fxns.c deleted file mode 100644 index b7983730a..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD_fxns.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ======== CC1350DK_7XD_fxns.c ======== - * This file contains the board-specific initialization functions. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include - -#include "Board.h" - -/* - * ======== CC1350DK_7XD_wakeUpExtFlash ======== - */ -void CC1350DK_7XD_wakeUpExtFlash(void) -{ - /* No external flash on CC1350DK_7XD */ -} - -/* - * ======== CC1350DK_7XD_shutDownExtFlash ======== - */ -void CC1350DK_7XD_shutDownExtFlash(void) -{ - /* No external flash on CC1350DK_7XD */ -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC1350DK_7XD_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/Makefile.cc13x0 b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/Makefile.cc13x0 deleted file mode 100644 index 8b034de05..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/Makefile.cc13x0 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x0-cc26x0 -DEVICE_FAMILY = CC13X0 -DEVICE_LINE = CC13XX -DEVICE = CC1350 - -BOARD_SOURCEFILES += CC1350DK_7XD.c CC1350DK_7XD_fxns.c - -SUPPORTS_PROP_MODE = 1 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 1 - -# Include the common board makefile -include $(FAMILY_PATH)/srf06/Makefile.srf06 diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/rf-conf.h deleted file mode 100644 index 327e8fb5d..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/rf-conf.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for both the Sub-1 GHz - * path and the 2.4 GHz path on the radio. - * - * These are the following front-end mode configurations for the - * CC1350DK-7XD board: - * - Sub-1 GHz: differential and external bias - * - 2.4 GHz: differential and external bias - * - * @{ - */ -#define RF_SUB_1_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_SUB_1_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL - -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_EXTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/Board.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/Board.h deleted file mode 100644 index d90291418..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/Board.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "CC2650DK_7ID.h" - -#define Board_CC2650DK_7ID -#define BOARD_STRING "TI SmartRF06EB + CC26x0 EM" - -#define Board_initGeneral() CC2650DK_7ID_initGeneral() -#define Board_shutDownExtFlash() CC2650DK_7ID_shutDownExtFlash() -#define Board_wakeUpExtFlash() CC2650DK_7ID_wakeUpExtFlash() - -/* These #defines allow us to reuse TI-RTOS across other device families */ - -#define Board_ADCALS CC2650DK_7ID_ADCALS - -#define Board_ADC0 CC2650DK_7ID_ADCVDDS -#define Board_ADC1 CC2650DK_7ID_ADCALS - -#define Board_ADCBUF0 CC2650DK_7ID_ADCBUF0 -#define Board_ADCBUF0CHANNEL0 CC2650DK_7ID_ADCBUF0CHANNELVDDS -#define Board_ADCBUF0CHANNEL1 CC2650DK_7ID_ADCBUF0CHANNELADCALS - -#define Board_CRYPTO0 CC2650DK_7ID_CRYPTO0 - -#define Board_DIO0 CC2650DK_7ID_DIO0 -#define Board_DIO1_RFSW CC2650DK_7ID_DIO1_RFSW -#define Board_DIO12 CC2650DK_7ID_DIO12 -#define Board_DIO15 CC2650DK_7ID_DIO15 -#define Board_DIO16_TDO CC2650DK_7ID_DIO16_TDO -#define Board_DIO17_TDI CC2650DK_7ID_DIO17_TDI -#define Board_DIO21 CC2650DK_7ID_DIO21 -#define Board_DIO22 CC2650DK_7ID_DIO22 - -#define Board_DIO23_ANALOG CC2650DK_7ID_DIO23_ANALOG -#define Board_DIO24_ANALOG CC2650DK_7ID_DIO24_ANALOG -#define Board_DIO25_ANALOG CC2650DK_7ID_DIO25_ANALOG -#define Board_DIO26_ANALOG CC2650DK_7ID_DIO26_ANALOG -#define Board_DIO27_ANALOG CC2650DK_7ID_DIO27_ANALOG -#define Board_DIO28_ANALOG CC2650DK_7ID_DIO28_ANALOG -#define Board_DIO29_ANALOG CC2650DK_7ID_DIO29_ANALOG -#define Board_DIO30_ANALOG CC2650DK_7ID_DIO30_ANALOG - -#define Board_GPIO_BTN0 CC2650DK_7ID_PIN_KEY_SELECT -#define Board_GPIO_BTN1 CC2650DK_7ID_PIN_KEY_UP -#define Board_GPIO_BTN2 CC2650DK_7ID_PIN_KEY_DOWN -#define Board_GPIO_BTN3 CC2650DK_7ID_PIN_KEY_LEFT -#define Board_GPIO_BTN4 CC2650DK_7ID_PIN_KEY_RIGHT -#define Board_GPIO_LED0 CC2650DK_7ID_PIN_LED1 -#define Board_GPIO_LED1 CC2650DK_7ID_PIN_LED2 -#define Board_GPIO_LED2 CC2650DK_7ID_PIN_LED3 -#define Board_GPIO_LED3 CC2650DK_7ID_PIN_LED4 -#define Board_GPIO_LED_ON CC2650DK_7ID_GPIO_LED_ON -#define Board_GPIO_LED_OFF CC2650DK_7ID_GPIO_LED_OFF - -#define Board_GPTIMER0A CC2650DK_7ID_GPTIMER0A -#define Board_GPTIMER0B CC2650DK_7ID_GPTIMER0B -#define Board_GPTIMER1A CC2650DK_7ID_GPTIMER1A -#define Board_GPTIMER1B CC2650DK_7ID_GPTIMER1B -#define Board_GPTIMER2A CC2650DK_7ID_GPTIMER2A -#define Board_GPTIMER2B CC2650DK_7ID_GPTIMER2B -#define Board_GPTIMER3A CC2650DK_7ID_GPTIMER3A -#define Board_GPTIMER3B CC2650DK_7ID_GPTIMER3B - -#define Board_I2C0 CC2650DK_7ID_I2C0 - -#define Board_NVSINTERNAL CC2650DK_7ID_NVSCC26XX0 - -#define Board_KEY_SELECT CC2650DK_7ID_PIN_KEY_SELECT -#define Board_KEY_UP CC2650DK_7ID_PIN_KEY_UP -#define Board_KEY_DOWN CC2650DK_7ID_PIN_KEY_DOWN -#define Board_KEY_LEFT CC2650DK_7ID_PIN_KEY_LEFT -#define Board_KEY_RIGHT CC2650DK_7ID_PIN_KEY_RIGHT - -#define Board_PIN_BUTTON0 CC2650DK_7ID_PIN_KEY_SELECT -#define Board_PIN_BUTTON1 CC2650DK_7ID_PIN_KEY_UP -#define Board_PIN_BUTTON2 CC2650DK_7ID_PIN_KEY_DOWN -#define Board_PIN_BUTTON3 CC2650DK_7ID_PIN_KEY_LEFT -#define Board_PIN_BUTTON4 CC2650DK_7ID_PIN_KEY_RIGHT -#define Board_PIN_BTN1 CC2650DK_7ID_PIN_KEY_SELECT -#define Board_PIN_BTN2 CC2650DK_7ID_PIN_KEY_UP -#define Board_PIN_BTN3 CC2650DK_7ID_PIN_KEY_DOWN -#define Board_PIN_BTN4 CC2650DK_7ID_PIN_KEY_LEFT -#define Board_PIN_BTN5 CC2650DK_7ID_PIN_KEY_RIGHT -#define Board_PIN_LED0 CC2650DK_7ID_PIN_LED1 -#define Board_PIN_LED1 CC2650DK_7ID_PIN_LED2 -#define Board_PIN_LED2 CC2650DK_7ID_PIN_LED3 -#define Board_PIN_LED3 CC2650DK_7ID_PIN_LED4 - -#define Board_PWM0 CC2650DK_7ID_PWM0 -#define Board_PWM1 CC2650DK_7ID_PWM1 -#define Board_PWM2 CC2650DK_7ID_PWM2 -#define Board_PWM3 CC2650DK_7ID_PWM3 -#define Board_PWM4 CC2650DK_7ID_PWM4 -#define Board_PWM5 CC2650DK_7ID_PWM5 -#define Board_PWM6 CC2650DK_7ID_PWM6 -#define Board_PWM7 CC2650DK_7ID_PWM7 - -#define Board_SD0 CC2650DK_7ID_SDSPI0 - -#define Board_SPI0 CC2650DK_7ID_SPI0 -#define Board_SPI0_MISO CC2650DK_7ID_SPI0_MISO -#define Board_SPI0_MOSI CC2650DK_7ID_SPI0_MOSI -#define Board_SPI0_CLK CC2650DK_7ID_SPI0_CLK -#define Board_SPI0_CSN CC2650DK_7ID_SPI0_CSN -#define Board_SPI1 CC2650DK_7ID_SPI1 -#define Board_SPI1_MISO CC2650DK_7ID_SPI1_MISO -#define Board_SPI1_MOSI CC2650DK_7ID_SPI1_MOSI -#define Board_SPI1_CLK CC2650DK_7ID_SPI1_CLK -#define Board_SPI1_CSN CC2650DK_7ID_SPI1_CSN -#define Board_FLASH_CS_ON 0 -#define Board_FLASH_CS_OFF 1 - -#define Board_SPI_MASTER CC2650DK_7ID_SPI0 -#define Board_SPI_SLAVE CC2650DK_7ID_SPI0 -#define Board_SPI_MASTER_READY CC2650DK_7ID_SPI_MASTER_READY -#define Board_SPI_SLAVE_READY CC2650DK_7ID_SPI_SLAVE_READY - -#define Board_UART0 CC2650DK_7ID_UART0 - -#define Board_WATCHDOG0 CC2650DK_7ID_WATCHDOG0 - -#define Board_SDCARD_CS CC2650DK_7ID_SDCARD_CS - -#define Board_LCD_MODE CC2650DK_7ID_LCD_MODE -#define Board_LCD_RST CC2650DK_7ID_LCD_RST -#define Board_LCD_CS CC2650DK_7ID_LCD_CS - -#define Board_ALS_OUT CC2650DK_7ID_ALS_OUT -#define Board_ALS_PWR CC2650DK_7ID_ALS_PWR - -#define Board_ACC_PWR CC2650DK_7ID_ACC_PWR -#define Board_ACC_CS CC2650DK_7ID_ACC_CS - -#ifdef __cplusplus -} -#endif - -#endif /* __BOARD_H */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c deleted file mode 100644 index 4d0115d38..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c +++ /dev/null @@ -1,720 +0,0 @@ -/* - * Copyright (c) 2016-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ====================== CC2650DK_7ID.c =================================== - * This file is responsible for setting up the board specific items for the - * CC2650DK_7ID board. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/udma.h) -#include DeviceFamily_constructPath(inc/hw_ints.h) -#include DeviceFamily_constructPath(inc/hw_memmap.h) - -#include "CC2650DK_7ID.h" - -/* - * =============================== ADCBuf =============================== - */ -#include -#include - -ADCBufCC26XX_Object adcBufCC26xxObjects[CC2650DK_7ID_ADCBUFCOUNT]; - -/* - * This table converts a virtual adc channel into a dio and internal analogue - * input signal. This table is necessary for the functioning of the adcBuf - * driver. Comment out unused entries to save flash. Dio and internal signal - * pairs are hardwired. Do not remap them in the table. You may reorder entire - * entries. The mapping of dio and internal signals is package dependent. - */ -const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[CC2650DK_7ID_ADCBUF0CHANNELCOUNT] = { - {CC2650DK_7ID_ALS_OUT, ADC_COMPB_IN_AUXIO7}, - {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VSS}, - {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS}, -}; - -const ADCBufCC26XX_HWAttrs adcBufCC26xxHWAttrs[CC2650DK_7ID_ADCBUFCOUNT] = { - { - .intPriority = ~0, - .swiPriority = 0, - .adcChannelLut = ADCBufCC26XX_adcChannelLut, - .gpTimerUnit = CC2650DK_7ID_GPTIMER0A, - .gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A, - } -}; - -const ADCBuf_Config ADCBuf_config[CC2650DK_7ID_ADCBUFCOUNT] = { - { - &ADCBufCC26XX_fxnTable, - &adcBufCC26xxObjects[CC2650DK_7ID_ADCBUF0], - &adcBufCC26xxHWAttrs[CC2650DK_7ID_ADCBUF0] - }, -}; - -const uint_least8_t ADCBuf_count = CC2650DK_7ID_ADCBUFCOUNT; - -/* - * =============================== ADC =============================== - */ -#include -#include - -ADCCC26XX_Object adcCC26xxObjects[CC2650DK_7ID_ADCCOUNT]; - -const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2650DK_7ID_ADCCOUNT] = { - { - .adcDIO = CC2650DK_7ID_DIO23_ANALOG, - .adcCompBInput = ADC_COMPB_IN_AUXIO7, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_DCOUPL, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VSS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - }, - { - .adcDIO = PIN_UNASSIGNED, - .adcCompBInput = ADC_COMPB_IN_VDDS, - .refSource = ADCCC26XX_FIXED_REFERENCE, - .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, - .inputScalingEnabled = true, - .triggerSource = ADCCC26XX_TRIGGER_MANUAL, - .returnAdjustedVal = false - } -}; - -const ADC_Config ADC_config[CC2650DK_7ID_ADCCOUNT] = { - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCALS], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCALS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCDCOUPL], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCDCOUPL]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCVSS], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCVSS]}, - {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCVDDS], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCVDDS]}, -}; - -const uint_least8_t ADC_count = CC2650DK_7ID_ADCCOUNT; - -/* - * =============================== Crypto =============================== - */ -#include - -CryptoCC26XX_Object cryptoCC26XXObjects[CC2650DK_7ID_CRYPTOCOUNT]; - -const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC2650DK_7ID_CRYPTOCOUNT] = { - { - .baseAddr = CRYPTO_BASE, - .powerMngrId = PowerCC26XX_PERIPH_CRYPTO, - .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ, - .intPriority = ~0, - } -}; - -const CryptoCC26XX_Config CryptoCC26XX_config[CC2650DK_7ID_CRYPTOCOUNT] = { - { - .object = &cryptoCC26XXObjects[CC2650DK_7ID_CRYPTO0], - .hwAttrs = &cryptoCC26XXHWAttrs[CC2650DK_7ID_CRYPTO0] - }, -}; - -/* - * =============================== GPIO =============================== - */ -#include -#include - -/* - * Array of Pin configurations - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC2650DK_7ID.h - * NOTE: Pins not used for interrupts should be placed at the end of the - * array. Callback entries can be omitted from callbacks array to - * reduce memory usage. - */ -GPIO_PinConfig gpioPinConfigs[] = { - /* Input pins */ - GPIOCC26XX_DIO_11 | GPIO_DO_NOT_CONFIG, /* Key Select */ - GPIOCC26XX_DIO_19 | GPIO_DO_NOT_CONFIG, /* Key Up */ - GPIOCC26XX_DIO_12 | GPIO_DO_NOT_CONFIG, /* Key Down */ - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Key Left */ - GPIOCC26XX_DIO_18 | GPIO_DO_NOT_CONFIG, /* Key Right */ - - GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC2650DK_7ID_SPI_MASTER_READY */ - GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC2650DK_7ID_SPI_SLAVE_READY */ - - /* Output pins */ - GPIOCC26XX_DIO_25 | GPIO_DO_NOT_CONFIG, /* LED 1 */ - GPIOCC26XX_DIO_27 | GPIO_DO_NOT_CONFIG, /* LED 2 */ - GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* LED 3 */ - GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* LED 4 */ - - /* SDCARD */ - GPIOCC26XX_DIO_30 | GPIO_DO_NOT_CONFIG, /* SPI chip select */ - - /* Accelerometer */ - GPIOCC26XX_DIO_24 | GPIO_DO_NOT_CONFIG, /* SPI chip select */ -}; - -/* - * Array of callback function pointers - * NOTE: The order of the pin configurations must coincide with what was - * defined in CC2650_LAUNCH.h - * NOTE: Pins not used for interrupts can be omitted from callbacks array to - * reduce memory usage (if placed at end of gpioPinConfigs array). - */ -GPIO_CallbackFxn gpioCallbackFunctions[] = { - NULL, /* Button 0 */ - NULL, /* Button 1 */ - NULL, /* CC2650DK_7ID_SPI_MASTER_READY */ - NULL, /* CC2650DK_7ID_SPI_SLAVE_READY */ -}; - -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = CC2650DK_7ID_GPIOCOUNT, - .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), - .intPriority = (~0) -}; - -/* - * =============================== GPTimer =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include - -GPTimerCC26XX_Object gptimerCC26XXObjects[CC2650DK_7ID_GPTIMERCOUNT]; - -const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMERPARTSCOUNT] = { - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, - { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, }, - { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, }, - { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, }, - { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, }, -}; - -const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2650DK_7ID_GPTIMERPARTSCOUNT] = { - { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER0A], GPT_A }, - { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER0B], GPT_B }, - { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER1A], GPT_A }, - { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER1B], GPT_B }, - { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER2A], GPT_A }, - { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER2B], GPT_B }, - { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER3A], GPT_A }, - { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER3B], GPT_B }, -}; - -/* - * =============================== I2C =============================== -*/ -#include -#include - -#if TI_I2C_CONF_ENABLE - -I2CCC26XX_Object i2cCC26xxObjects[CC2650DK_7ID_I2CCOUNT]; - -const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650DK_7ID_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .baseAddr = I2C0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_I2C0, - .intNum = INT_I2C_IRQ, - .intPriority = ~0, - .swiPriority = 0, - .sdaPin = CC2650DK_7ID_I2C0_SDA0, - .sclPin = CC2650DK_7ID_I2C0_SCL0, - }, -#endif -}; - -const I2C_Config I2C_config[CC2650DK_7ID_I2CCOUNT] = { -#if TI_I2C_CONF_I2C0_ENABLE - { - .fxnTablePtr = &I2CCC26XX_fxnTable, - .object = &i2cCC26xxObjects[CC2650DK_7ID_I2C0], - .hwAttrs = &i2cCC26xxHWAttrs[CC2650DK_7ID_I2C0] - }, -#endif -}; - -const uint_least8_t I2C_count = CC2650DK_7ID_I2CCOUNT; - -#endif /* TI_I2C_CONF_ENABLE */ - -/* - * =============================== NVS =============================== - */ -#include -#include -#include - -#define NVS_REGIONS_BASE 0x1A000 -#define SECTORSIZE 0x1000 -#define REGIONSIZE (SECTORSIZE * 4) - -#if TI_NVS_CONF_ENABLE - -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - -/* - * Reserve flash sectors for NVS driver use by placing an uninitialized byte - * array at the desired flash address. - */ -#if defined(__TI_COMPILER_VERSION__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -#pragma LOCATION(flashBuf, NVS_REGIONS_BASE); -#pragma NOINIT(flashBuf); -static char flashBuf[REGIONSIZE]; - -#elif defined(__IAR_SYSTEMS_ICC__) - -/* - * Place uninitialized array at NVS_REGIONS_BASE - */ -static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE; - -#elif defined(__GNUC__) - -/* - * Place the flash buffers in the .nvs section created in the gcc linker file. - * The .nvs section enforces alignment on a sector boundary but may - * be placed anywhere in flash memory. If desired the .nvs section can be set - * to a fixed address by changing the following in the gcc linker file: - * - * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) { - * *(.nvs) - * } > REGION_TEXT - */ -__attribute__ ((section (".nvs"))) -static char flashBuf[REGIONSIZE]; - -#endif - -/* Allocate objects for NVS Internal Regions */ -NVSCC26XX_Object nvsCC26xxObjects[1]; - -/* Hardware attributes for NVS Internal Regions */ -const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = { - { - .regionBase = (void *)flashBuf, - .regionSize = REGIONSIZE, - }, -}; - -#endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */ - -/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */ -const NVS_Config NVS_config[CC2650DK_7ID_NVSCOUNT] = { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - { - .fxnTablePtr = &NVSCC26XX_fxnTable, - .object = &nvsCC26xxObjects[0], - .hwAttrs = &nvsCC26xxHWAttrs[0], - }, -#endif -}; - -const uint_least8_t NVS_count = CC2650DK_7ID_NVSCOUNT; - -#endif /* TI_NVS_CONF_ENABLE */ - -/* - * =============================== PIN =============================== - */ -#include -#include - -const PIN_Config BoardGpioInitTable[] = { - - CC2650DK_7ID_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC2650DK_7ID_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC2650DK_7ID_PIN_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC2650DK_7ID_PIN_LED4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - CC2650DK_7ID_PIN_KEY_SELECT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC2650DK_7ID_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC2650DK_7ID_PIN_KEY_DOWN | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC2650DK_7ID_PIN_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC2650DK_7ID_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ - CC2650DK_7ID_SDCARD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC2650DK_7ID_ACC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC2650DK_7ID_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */ - CC2650DK_7ID_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ - CC2650DK_7ID_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ - CC2650DK_7ID_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ - CC2650DK_7ID_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ - - PIN_TERMINATE -}; - -const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = { - .intPriority = ~0, - .swiPriority = 0 -}; - -/* - * =============================== Power =============================== - */ -#include -#include - -const PowerCC26XX_Config PowerCC26XX_config = { - .policyInitFxn = NULL, - .policyFxn = &PowerCC26XX_standbyPolicy, - .calibrateFxn = &PowerCC26XX_calibrate, - .enablePolicy = true, - .calibrateRCOSC_LF = true, - .calibrateRCOSC_HF = true, -}; - -/* - * =============================== PWM =============================== - * Remove unused entries to reduce flash usage both in Board.c and Board.h - */ -#include -#include - -PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC2650DK_7ID_PWMCOUNT]; - -const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWMCOUNT] = { - { .pwmPin = CC2650DK_7ID_PWMPIN0, .gpTimerUnit = CC2650DK_7ID_GPTIMER0A }, - { .pwmPin = CC2650DK_7ID_PWMPIN1, .gpTimerUnit = CC2650DK_7ID_GPTIMER0B }, - { .pwmPin = CC2650DK_7ID_PWMPIN2, .gpTimerUnit = CC2650DK_7ID_GPTIMER1A }, - { .pwmPin = CC2650DK_7ID_PWMPIN3, .gpTimerUnit = CC2650DK_7ID_GPTIMER1B }, - { .pwmPin = CC2650DK_7ID_PWMPIN4, .gpTimerUnit = CC2650DK_7ID_GPTIMER2A }, - { .pwmPin = CC2650DK_7ID_PWMPIN5, .gpTimerUnit = CC2650DK_7ID_GPTIMER2B }, - { .pwmPin = CC2650DK_7ID_PWMPIN6, .gpTimerUnit = CC2650DK_7ID_GPTIMER3A }, - { .pwmPin = CC2650DK_7ID_PWMPIN7, .gpTimerUnit = CC2650DK_7ID_GPTIMER3B }, -}; - -const PWM_Config PWM_config[CC2650DK_7ID_PWMCOUNT] = { - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM0], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM0] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM1], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM1] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM2], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM2] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM3], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM3] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM4], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM4] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM5], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM5] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM6], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM6] }, - { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM7], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM7] }, -}; - -const uint_least8_t PWM_count = CC2650DK_7ID_PWMCOUNT; - -/* - * =============================== RF Driver =============================== - */ -#include - -const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { - .hwiPriority = ~0, /* Lowest HWI priority */ - .swiPriority = 0, /* Lowest SWI priority */ - .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ - .globalCallback = NULL, /* No board specific callback */ - .globalEventMask = 0 /* No events subscribed to */ -}; - -/* - * =============================== SD =============================== - */ -#include -#include - -#if TI_SD_CONF_ENABLE - -#if !(TI_SPI_CONF_SPI0_ENABLE) -#error "SD driver requires SPI0 enabled" -#endif - -SDSPI_Object sdspiObjects[CC2650DK_7ID_SDCOUNT]; - -const SDSPI_HWAttrs sdspiHWAttrs[CC2650DK_7ID_SDCOUNT] = { - { - .spiIndex = CC2650DK_7ID_SPI0, - .spiCsGpioIndex = CC2650DK_7ID_SDCARD_CS - } -}; - -const SD_Config SD_config[CC2650DK_7ID_SDCOUNT] = { - { - .fxnTablePtr = &SDSPI_fxnTable, - .object = &sdspiObjects[CC2650DK_7ID_SDSPI0], - .hwAttrs = &sdspiHWAttrs[CC2650DK_7ID_SDSPI0] - }, -}; - -const uint_least8_t SD_count = CC2650DK_7ID_SDCOUNT; - -#endif /* TI_SD_CONF_ENABLE */ - -/* - * =============================== SPI DMA =============================== - */ -#include -#include - -#if TI_SPI_CONF_ENABLE - -SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650DK_7ID_SPICOUNT]; - -/* - * NOTE: The SPI instances below can be used by the SD driver to communicate - * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF - * to satisfy the SDSPI driver requirement. - */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPICOUNT] = { -#if TI_SPI_CONF_SPI0_ENABLE - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0xFF, - .rxChannelBitMask = 1< -#include - -TRNGCC26X0_Object trngCC26X0Object[CC2650DK_7ID_TRNGCOUNT]; - -const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC2650DK_7ID_TRNGCOUNT] = { - { - .swiPriority = 0, - .intPriority = ~0, - } -}; - -const TRNG_Config TRNG_config[] = { - { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, -}; - -const uint8_t TRNG_count = CC2650DK_7ID_TRNGCOUNT; - - -/* - * =============================== UART =============================== - */ -#include -#include - -#if TI_UART_CONF_ENABLE - -UARTCC26XX_Object uartCC26XXObjects[CC2650DK_7ID_UARTCOUNT]; - -uint8_t uartCC26XXRingBuffer[CC2650DK_7ID_UARTCOUNT][32]; - -const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650DK_7ID_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .baseAddr = UART0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UART0, - .intNum = INT_UART0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .txPin = CC2650DK_7ID_UART_TX, - .rxPin = CC2650DK_7ID_UART_RX, - .ctsPin = PIN_UNASSIGNED, - .rtsPin = PIN_UNASSIGNED, - .ringBufPtr = uartCC26XXRingBuffer[CC2650DK_7ID_UART0], - .ringBufSize = sizeof(uartCC26XXRingBuffer[CC2650DK_7ID_UART0]), - .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8, - .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8, - .errorFxn = NULL - }, -#endif -}; - -const UART_Config UART_config[CC2650DK_7ID_UARTCOUNT] = { -#if TI_UART_CONF_UART0_ENABLE - { - .fxnTablePtr = &UARTCC26XX_fxnTable, - .object = &uartCC26XXObjects[CC2650DK_7ID_UART0], - .hwAttrs = &uartCC26XXHWAttrs[CC2650DK_7ID_UART0] - }, -#endif -}; - -const uint_least8_t UART_count = CC2650DK_7ID_UARTCOUNT; - -#endif /* TI_UART_CONF_ENABLE */ - -/* - * =============================== UDMA =============================== - */ -#include - -UDMACC26XX_Object udmaObjects[CC2650DK_7ID_UDMACOUNT]; - -const UDMACC26XX_HWAttrs udmaHWAttrs[CC2650DK_7ID_UDMACOUNT] = { - { - .baseAddr = UDMA0_BASE, - .powerMngrId = PowerCC26XX_PERIPH_UDMA, - .intNum = INT_DMA_ERR, - .intPriority = ~0 - } -}; - -const UDMACC26XX_Config UDMACC26XX_config[CC2650DK_7ID_UDMACOUNT] = { - { - .object = &udmaObjects[CC2650DK_7ID_UDMA0], - .hwAttrs = &udmaHWAttrs[CC2650DK_7ID_UDMA0] - }, -}; - - - -/* - * =============================== Watchdog =============================== - */ -#include -#include - -WatchdogCC26XX_Object watchdogCC26XXObjects[CC2650DK_7ID_WATCHDOGCOUNT]; - -const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC2650DK_7ID_WATCHDOGCOUNT] = { - { - .baseAddr = WDT_BASE, - .reloadValue = 1000 /* Reload value in milliseconds */ - }, -}; - -const Watchdog_Config Watchdog_config[CC2650DK_7ID_WATCHDOGCOUNT] = { - { - .fxnTablePtr = &WatchdogCC26XX_fxnTable, - .object = &watchdogCC26XXObjects[CC2650DK_7ID_WATCHDOG0], - .hwAttrs = &watchdogCC26XXHWAttrs[CC2650DK_7ID_WATCHDOG0] - }, -}; - -const uint_least8_t Watchdog_count = CC2650DK_7ID_WATCHDOGCOUNT; - -/* - * Board-specific initialization function to disable external flash. - * This function is defined in the file CC2650DK_7ID_fxns.c - */ -extern void Board_initHook(void); - -/* - * ======== CC2650DK_7ID_initGeneral ======== - */ -void CC2650DK_7ID_initGeneral(void) -{ - Power_init(); - - if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) { - /* Error with PIN_init */ - while (1); - } - - /* Perform board-specific initialization */ - Board_initHook(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.h deleted file mode 100644 index 21bae0eed..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.h +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** ============================================================================ - * @file CC2650DK_7ID.h - * - * @brief CC2650 LaunchPad Board Specific header file. - * - * The CC2650DK_7ID header file should be included in an application as - * follows: - * @code - * #include "CC2650DK_7ID.h" - * @endcode - * - * ============================================================================ - */ -#ifndef __CC2650DK_7ID_BOARD_H__ -#define __CC2650DK_7ID_BOARD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "contiki-conf.h" - -/* Includes */ -#include -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) - -/* Externs */ -extern const PIN_Config BoardGpioInitTable[]; - -/* Defines */ -#define CC2650DK_7ID - -/* Mapping of pins to board signals using general board aliases - * - */ - -/* Analog Capable DIOs */ -#define CC2650DK_7ID_DIO23_ANALOG IOID_23 -#define CC2650DK_7ID_DIO24_ANALOG IOID_24 -#define CC2650DK_7ID_DIO25_ANALOG IOID_25 -#define CC2650DK_7ID_DIO26_ANALOG IOID_26 -#define CC2650DK_7ID_DIO27_ANALOG IOID_27 -#define CC2650DK_7ID_DIO28_ANALOG IOID_28 -#define CC2650DK_7ID_DIO29_ANALOG IOID_29 -#define CC2650DK_7ID_DIO30_ANALOG IOID_30 - -/* Digital IOs */ -#define CC2650DK_7ID_DIO0 IOID_0 -#define CC2650DK_7ID_DIO1_RFSW IOID_1 -#define CC2650DK_7ID_DIO12 IOID_12 -#define CC2650DK_7ID_DIO15 IOID_15 -#define CC2650DK_7ID_DIO16_TDO IOID_16 -#define CC2650DK_7ID_DIO17_TDI IOID_17 -#define CC2650DK_7ID_DIO21 IOID_21 -#define CC2650DK_7ID_DIO22 IOID_22 - -/* Discrete Inputs */ -#define CC2650DK_7ID_PIN_KEY_SELECT IOID_11 -#define CC2650DK_7ID_PIN_KEY_UP IOID_19 -#define CC2650DK_7ID_PIN_KEY_DOWN IOID_12 -#define CC2650DK_7ID_PIN_KEY_LEFT IOID_15 -#define CC2650DK_7ID_PIN_KEY_RIGHT IOID_18 - -/* GPIO */ -#define CC2650DK_7ID_GPIO_LED_ON 1 -#define CC2650DK_7ID_GPIO_LED_OFF 0 - -/* I2C */ -#define CC2650DK_7ID_I2C0_SCL0 PIN_UNASSIGNED -#define CC2650DK_7ID_I2C0_SDA0 PIN_UNASSIGNED - -/* LEDs */ -#define CC2650DK_7ID_PIN_LED_ON 1 -#define CC2650DK_7ID_PIN_LED_OFF 0 -#define CC2650DK_7ID_PIN_LED1 IOID_25 -#define CC2650DK_7ID_PIN_LED2 IOID_27 -#define CC2650DK_7ID_PIN_LED3 IOID_7 -#define CC2650DK_7ID_PIN_LED4 IOID_6 - -/* PWM Outputs */ -#define CC2650DK_7ID_PWMPIN0 CC2650DK_7ID_PIN_LED1 -#define CC2650DK_7ID_PWMPIN1 CC2650DK_7ID_PIN_LED2 -#define CC2650DK_7ID_PWMPIN2 PIN_UNASSIGNED -#define CC2650DK_7ID_PWMPIN3 PIN_UNASSIGNED -#define CC2650DK_7ID_PWMPIN4 PIN_UNASSIGNED -#define CC2650DK_7ID_PWMPIN5 PIN_UNASSIGNED -#define CC2650DK_7ID_PWMPIN6 PIN_UNASSIGNED -#define CC2650DK_7ID_PWMPIN7 PIN_UNASSIGNED - -/* SPI Board */ -#define CC2650DK_7ID_SPI0_MISO IOID_8 -#define CC2650DK_7ID_SPI0_MOSI IOID_9 -#define CC2650DK_7ID_SPI0_CLK IOID_10 -#define CC2650DK_7ID_SPI0_CSN PIN_UNASSIGNED -#define CC2650DK_7ID_SPI1_MISO PIN_UNASSIGNED -#define CC2650DK_7ID_SPI1_MOSI PIN_UNASSIGNED -#define CC2650DK_7ID_SPI1_CLK PIN_UNASSIGNED -#define CC2650DK_7ID_SPI1_CSN PIN_UNASSIGNED - -/* UART Board */ -#define CC2650DK_7ID_UART_RX IOID_2 -#define CC2650DK_7ID_UART_TX IOID_3 -#define CC2650DK_7ID_UART_CTS IOID_0 -#define CC2650DK_7ID_UART_RTS IOID_21 - -/* SD Card */ -#define CC2650DK_7ID_SDCARD_CS IOID_30 - -/* Ambient Light Sensor */ -#define CC2650DK_7ID_ALS_OUT IOID_23 -#define CC2650DK_7ID_ALS_PWR IOID_26 - -/* Accelerometer */ -#define CC2650DK_7ID_ACC_PWR IOID_20 -#define CC2650DK_7ID_ACC_CS IOID_24 - -/*! - * @brief Initialize the general board specific settings - * - * This function initializes the general board specific settings. - */ -void CC2650DK_7ID_initGeneral(void); - -/*! - * @brief Turn off the external flash on LaunchPads - * - */ -void CC2650DK_7ID_shutDownExtFlash(void); - -/*! - * @brief Wake up the external flash present on the board files - * - * This function toggles the chip select for the amount of time needed - * to wake the chip up. - */ -void CC2650DK_7ID_wakeUpExtFlash(void); - -/*! - * @def CC2650DK_7ID_ADCBufName - * @brief Enum of ADCs - */ -typedef enum CC2650DK_7ID_ADCBufName { - CC2650DK_7ID_ADCBUF0 = 0, - - CC2650DK_7ID_ADCBUFCOUNT -} CC2650DK_7ID_ADCBufName; - -/*! - * @def CC2650DK_7ID_ADCBuf0ChannelName - * @brief Enum of ADCBuf channels - */ -typedef enum CC2650DK_7ID_ADCBuf0ChannelName { - CC2650DK_7ID_ADCBUF0CHANNELADCALS = 0, - CC2650DK_7ID_ADCBUF0CHANNELVDDS, - CC2650DK_7ID_ADCBUF0CHANNELDCOUPL, - CC2650DK_7ID_ADCBUF0CHANNELVSS, - - CC2650DK_7ID_ADCBUF0CHANNELCOUNT -} CC2650DK_7ID_ADCBuf0ChannelName; - -/*! - * @def CC2650DK_7ID_ADCName - * @brief Enum of ADCs - */ -typedef enum CC2650DK_7ID_ADCName { - CC2650DK_7ID_ADCALS = 0, - CC2650DK_7ID_ADCDCOUPL, - CC2650DK_7ID_ADCVSS, - CC2650DK_7ID_ADCVDDS, - - CC2650DK_7ID_ADCCOUNT -} CC2650DK_7ID_ADCName; - -/*! - * @def CC2650DK_7ID_CryptoName - * @brief Enum of Crypto names - */ -typedef enum CC2650DK_7ID_CryptoName { - CC2650DK_7ID_CRYPTO0 = 0, - - CC2650DK_7ID_CRYPTOCOUNT -} CC2650DK_7ID_CryptoName; - -/*! - * @def CC2650DK_7ID_GPIOName - * @brief Enum of GPIO names - */ -typedef enum CC2650DK_7ID_GPIOName { - CC2650DK_7ID_GPIO_KEY_SELECT = 0, - CC2650DK_7ID_GPIO_KEY_UP, - CC2650DK_7ID_GPIO_KEY_DOWN, - CC2650DK_7ID_GPIO_KEY_LEFT, - CC2650DK_7ID_GPIO_KEY_RIGHT, - CC2650DK_7ID_SPI_MASTER_READY, - CC2650DK_7ID_SPI_SLAVE_READY, - CC2650DK_7ID_GPIO_LED1, - CC2650DK_7ID_GPIO_LED2, - CC2650DK_7ID_GPIO_LED3, - CC2650DK_7ID_GPIO_LED4, - CC2650DK_7ID_GPIO_SDCARD_CS, - CC2650DK_7ID_GPIO_ACC_CS, - - CC2650DK_7ID_GPIOCOUNT -} CC2650DK_7ID_GPIOName; - -/*! - * @def CC2650DK_7ID_GPTimerName - * @brief Enum of GPTimer parts - */ -typedef enum CC2650DK_7ID_GPTimerName { - CC2650DK_7ID_GPTIMER0A = 0, - CC2650DK_7ID_GPTIMER0B, - CC2650DK_7ID_GPTIMER1A, - CC2650DK_7ID_GPTIMER1B, - CC2650DK_7ID_GPTIMER2A, - CC2650DK_7ID_GPTIMER2B, - CC2650DK_7ID_GPTIMER3A, - CC2650DK_7ID_GPTIMER3B, - - CC2650DK_7ID_GPTIMERPARTSCOUNT -} CC2650DK_7ID_GPTimerName; - -/*! - * @def CC2650DK_7ID_GPTimers - * @brief Enum of GPTimers - */ -typedef enum CC2650DK_7ID_GPTimers { - CC2650DK_7ID_GPTIMER0 = 0, - CC2650DK_7ID_GPTIMER1, - CC2650DK_7ID_GPTIMER2, - CC2650DK_7ID_GPTIMER3, - - CC2650DK_7ID_GPTIMERCOUNT -} CC2650DK_7ID_GPTimers; - -/*! - * @def CC2650DK_7ID_I2CName - * @brief Enum of I2C names - */ -typedef enum CC2650DK_7ID_I2CName { -#if TI_I2C_CONF_I2C0_ENABLE - CC2650DK_7ID_I2C0 = 0, -#endif - - CC2650DK_7ID_I2CCOUNT -} CC2650DK_7ID_I2CName; - -/*! - * @def CC2650DK_7ID_NVSName - * @brief Enum of NVS names - */ -typedef enum CC2650DK_7ID_NVSName { -#if TI_NVS_CONF_NVS_INTERNAL_ENABLE - CC2650DK_7ID_NVSCC26XX0 = 0, -#endif - - CC2650DK_7ID_NVSCOUNT -} CC2650DK_7ID_NVSName; - -/*! - * @def CC2650DK_7ID_PWMName - * @brief Enum of PWM outputs - */ -typedef enum CC2650DK_7ID_PWMName { - CC2650DK_7ID_PWM0 = 0, - CC2650DK_7ID_PWM1, - CC2650DK_7ID_PWM2, - CC2650DK_7ID_PWM3, - CC2650DK_7ID_PWM4, - CC2650DK_7ID_PWM5, - CC2650DK_7ID_PWM6, - CC2650DK_7ID_PWM7, - - CC2650DK_7ID_PWMCOUNT -} CC2650DK_7ID_PWMName; - -/*! - * @def CC2650DK_7ID_SDName - * @brief Enum of SD names - */ -typedef enum CC2650DK_7ID_SDName { - CC2650DK_7ID_SDSPI0 = 0, - - CC2650DK_7ID_SDCOUNT -} CC2650DK_7ID_SDName; - -/*! - * @def CC2650DK_7ID_TRNGName - * @brief Enum of TRNGs - */ -typedef enum CC2650DK_7ID_TRNGName { - CC2650DK_7ID_TRNG0 = 0, - - CC2650DK_7ID_TRNGCOUNT -} CC2650DK_7ID_TRNGName; - -/*! - * @def CC2650DK_7ID_SPIName - * @brief Enum of SPI names - */ -typedef enum CC2650DK_7ID_SPIName { -#if TI_SPI_CONF_SPI0_ENABLE - CC2650DK_7ID_SPI0 = 0, -#endif -#if TI_SPI_CONF_SPI1_ENABLE - CC2650DK_7ID_SPI1, -#endif - - CC2650DK_7ID_SPICOUNT -} CC2650DK_7ID_SPIName; - -/*! - * @def CC2650DK_7ID_UARTName - * @brief Enum of UARTs - */ -typedef enum CC2650DK_7ID_UARTName { -#if TI_UART_CONF_UART0_ENABLE - CC2650DK_7ID_UART0 = 0, -#endif - - CC2650DK_7ID_UARTCOUNT -} CC2650DK_7ID_UARTName; - -/*! - * @def CC2650DK_7ID_UDMAName - * @brief Enum of DMA buffers - */ -typedef enum CC2650DK_7ID_UDMAName { - CC2650DK_7ID_UDMA0 = 0, - - CC2650DK_7ID_UDMACOUNT -} CC2650DK_7ID_UDMAName; - -/*! - * @def CC2650DK_7ID_WatchdogName - * @brief Enum of Watchdogs - */ -typedef enum CC2650DK_7ID_WatchdogName { - CC2650DK_7ID_WATCHDOG0 = 0, - - CC2650DK_7ID_WATCHDOGCOUNT -} CC2650DK_7ID_WatchdogName; - -#ifdef __cplusplus -} -#endif - -#endif /* __CC2650DK_7ID_BOARD_H__ */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID_fxns.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID_fxns.c deleted file mode 100644 index aa6a6c60e..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID_fxns.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * ======== CC2650DK_7ID_fxns.c ======== - * This file contains the board-specific initialization functions. - */ - -#include -#include -#include - -#include -#include DeviceFamily_constructPath(driverlib/ioc.h) -#include DeviceFamily_constructPath(driverlib/cpu.h) - -#include - -#include "Board.h" - -/* - * ======== CC2650DK_7ID_wakeUpExtFlash ======== - */ -void CC2650DK_7ID_wakeUpExtFlash(void) -{ - /* No external flash on CC2650DK_7ID */ -} - -/* - * ======== CC2650DK_7ID_shutDownExtFlash ======== - */ -void CC2650DK_7ID_shutDownExtFlash(void) -{ - /* No external flash on CC2650DK_7ID */ -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC2650DK_7ID_shutDownExtFlash(); -} diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/Makefile.cc26x0 b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/Makefile.cc26x0 deleted file mode 100644 index 5f554cda4..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/Makefile.cc26x0 +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# SimpleLink Device makefile - -SUBFAMILY = cc13x0-cc26x0 -DEVICE_FAMILY = CC26X0 -DEVICE_LINE = CC26XX -DEVICE = CC2650 - -BOARD_SOURCEFILES += CC2650DK_7ID.c CC2650DK_7ID_fxns.c - -SUPPORTS_PROP_MODE = 0 -SUPPORTS_IEEE_MODE = 1 -SUPPORTS_BLE_BEACON = 1 - -SUPPORTS_HIGH_PA = 0 - -### Signal that we can be programmed with cc2538-bsl -BOARD_SUPPORTS_BSL = 1 - -# Include the common board makefile -include $(FAMILY_PATH)/srf06/Makefile.srf06 diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/rf-conf.h b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/rf-conf.h deleted file mode 100644 index bdbade005..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/rf-conf.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup launchpad-peripherals - * @{ - * - * \file - * Header file with board-specific RF configurations. - * \author - * Texas Instruments - * \note - * This file should not be included directly - */ -/*---------------------------------------------------------------------------*/ -#ifndef RF_CONF_H_ -#define RF_CONF_H_ -/*---------------------------------------------------------------------------*/ -#include "rf/rf.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Board-specific front-end mode configurations for the 2.4 GHz path - * on the radio. - * - * These are the following front-end mode configurations for the - * CC2650DK-7ID board: - * - 2.4 GHz: differential and internal bias - * - * @{ - */ -#define RF_2_4_GHZ_CONF_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL -#define RF_2_4_GHZ_CONF_BIAS_MODE RF_BIAS_MODE_INTERNAL -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* RF_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/leds-arch.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/leds-arch.c deleted file mode 100644 index 23f1e1b53..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/leds-arch.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup srf06-peripherals - * @{ - * - * \file - * LED HAL definitions for the SmartRF06 Evaluation Board's LEDs. - * Common across all CC13xx/CC26xx devices for the SmartRF06 EB. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/leds.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - /* Red LED, AKA LED0 */ - { .pin = Board_PIN_LED0, .negative_logic = false }, - /* Yellow LED, AKA LED1 */ - { .pin = Board_PIN_LED1, .negative_logic = false }, - /* Green LED, AKA LED2 */ - { .pin = Board_PIN_LED2, .negative_logic = false }, - /* Red-orange LED, AKA LED3 */ - { .pin = Board_PIN_LED3, .negative_logic = false }, -}; -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/srf06-sensors.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/srf06-sensors.c deleted file mode 100644 index 1660cc0c8..000000000 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/srf06-sensors.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup srf06-peripherals - * @{ - * - * \file - * Generic module controlling sensors on SmartRF06 Evaluation Board. - * \author - * Edvard Pettersen - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#include "board-conf.h" -#include "board-peripherals.h" -/*---------------------------------------------------------------------------*/ -/* Exports a global symbol to be used by the sensor API */ -#if BOARD_SENSORS_ENABLE -SENSORS(&als_sensor); -#endif -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/sky/Makefile.common b/arch/platform/sky/Makefile.common deleted file mode 100644 index b72f92ed8..000000000 --- a/arch/platform/sky/Makefile.common +++ /dev/null @@ -1,175 +0,0 @@ -# $Id: Makefile.common,v 1.3 2010/08/24 16:24:11 joxe Exp $ - -ARCH=spi-legacy.c ds2411.c xmem.c i2c.c sensors.c cfs-coffee.c \ - cc2420.c cc2420-arch.c cc2420-arch-sfd.c \ - sky-sensors.c uip-ipchksum.c \ - uart1.c slip_uart1.c uart1-putchar.c platform.c - -CONTIKI_TARGET_DIRS = . dev apps net -ifndef CONTIKI_TARGET_MAIN -CONTIKI_TARGET_MAIN = contiki-main.c -endif - -ifdef IAR -CFLAGS += -D__MSP430F1611__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32 -CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR) -endif - -CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) - -MCU=msp430f1611 -include $(ARCH_PATH)/cpu/msp430/Makefile.msp430 - - -ifdef IAR -LDFLAGSNO += -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f1611.xcl" -LDFLAGS += $(LDFLAGSNO) -Felf -yn -endif # IAR - -NUMPAR=20 - -# Check if we are running under Windows -ifeq ($(HOST_OS),Windows) - USBDEVPREFIX=/dev/com - SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-windows - MOTELIST = $(CONTIKI)/tools/sky/motelist-windows - TMOTE_BSL_FILE = tmote-bsl - TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE).exe),1,0) - ifeq ($(TMOTE_BSL), 1) - NUMPAR = 1 - BSL = $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE) - MOTES = $(shell $(MOTELIST) | grep COM | \ - cut -f 4 -d \ ) - else - BSL = $(CONTIKI)/tools/sky/msp430-bsl-windows --telosb - BSL_FILETYPE = -I - MOTES = $(shell $(MOTELIST) | grep COM | \ - cut -f 4 -d \ | \ - perl -ne 'print $$1 - 1 . " " if(/COM(\d+)/);') - endif - CMOTES = $(shell $(MOTELIST) | grep COM | \ - cut -f 4 -d \ | \ - perl -ne 'print $$1 . " " if(/COM(\d+)/);') -else -ifeq ($(HOST_OS),Darwin) - ifndef MOTELIST - USBDEVPREFIX= - MOTELIST = $(CONTIKI)/tools/sky/motelist-macos - TMOTE_BSL_FILE = tmote-bsl-linux - TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)),1,0) - ifeq ($(TMOTE_BSL), 1) - PATH := $(PATH):$(CONTIKI)/tools/sky - BSL = $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE) - NUMPAR = 1 - else - BSL = $(CONTIKI)/tools/sky/msp430-bsl-linux --telosb - BSL_FILETYPE = -I - endif - MOTES = $(shell $(MOTELIST) 2>&- | grep usbserial | \ - cut -f 4 -d \ | \ - perl -ne 'print $$1 . " " if(m-(/dev/[\w+\.\-]+)-);') - CMOTES=$(MOTES) - endif -else - # Else we assume Linux - ifndef MOTELIST - USBDEVPREFIX= - MOTELIST = $(CONTIKI)/tools/sky/motelist-linux - TMOTE_BSL_FILE = tmote-bsl-linux - TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)),1,0) - ifeq ($(TMOTE_BSL), 1) - PATH := $(PATH):$(CONTIKI)/tools/sky - BSL = $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE) - NUMPAR = 1 - else - BSL = $(CONTIKI)/tools/sky/msp430-bsl-linux --telosb - BSL_FILETYPE = -I - endif - ifdef MOTEIDS - MOTES = $(foreach MOTEID, $(MOTEIDS), $(shell $(MOTELIST) 2>&- | grep $(MOTEID) | \ - cut -f 4 -d \ | \ - perl -ne 'print $$1 . " " if(m-(/dev/[\w+\.\-]+)-);')) - else - MOTES = $(shell $(MOTELIST) 2>&- | grep USB | \ - cut -f 4 -d \ | \ - perl -ne 'print $$1 . " " if(m-(/dev/[\w+\.\-]+)-);') - endif - CMOTES=$(MOTES) - endif -endif -endif - -motelist: sky-motelist - -sky-motelist: - $(MOTELIST) -sky-motes: - @echo $(MOTES) - -ifdef MOTE -%.upload: %.ihex - $(MAKE) IHEXFILE=$< sky-u.$(subst /,_,$(word $(MOTE), $(MOTES))) -else # MOTE -%.upload: %.ihex - $(MAKE) IHEXFILE=$< sky-reset sky-upload -endif # MOTE - -upload-ihex: -ifdef FILE - @echo Uploading $(FILE) -ifdef MOTE - $(MAKE) IHEXFILE=$(FILE) sky-u.$(subst /,_,$(word $(MOTE), $(MOTES))) -else # MOTE - $(MAKE) sky-reset sky-upload -endif # MOTE -else - @echo Example: $(MAKE) upload-ihex FILE=myfile.ihex -endif - -sky-upload: sky-reset - $(MAKE) -j $(NUMPAR) sky-upload-sequence - -sky-upload-sequence: $(foreach PORT, $(MOTES), sky-u.$(subst /,_,$(PORT))) - @echo Done - -sky-reset: - $(MAKE) -k -j $(NUMPAR) sky-reset-sequence - -sky-reset-sequence: $(foreach PORT, $(MOTES), sky-r.$(subst /,_,$(PORT))) - @echo Done - -sky-u.%: - @echo +++++ Erasing $(subst _,/,$*); \ - $(BSL) -c $(subst _,/,$*) -e && sleep 2 ; \ - echo +++++ Programming $(subst _,/,$*) ; \ - $(BSL) -c $(subst _,/,$*) $(BSL_FILETYPE) -p $(IHEXFILE) && sleep 2 ; \ - echo +++++ Resetting $(subst _,/,$*) ; \ - $(BSL) -c $(subst _,/,$*) -r - -sky-r.%: - $(BSL) -c $(subst _,/,$*) -r - -sizeplot: - msp430-size $(OBJECTDIR)/*.o | $(CONTIKI)/tools/sky/check-size > size-data - gnuplot $(CONTIKI)/tools/sky/plot-size - gv size.pdf - -winslip: -ifdef INTERFACE - $(CONTIKI)/tools/wpcapslip/wpcapslip -s $(USBDEVPREFIX)$(firstword $(CMOTES)) $(INTERFACE) 172.16.0.0 255.255.0.0 -else - @echo "Usage: \"$(MAKE) $@ INTERFACE=\"" - @echo "Use the \"ipconfig\" command to find out the IP addresses of the local interfaces" -endif - -linslip: $(CONTIKI)/tools/tunslip - $(CONTIKI)/tools/tunslip -s $(USBDEVPREFIX)$(firstword $(CMOTES)) 172.16.0.0 255.255.0.0 - -$(CONTIKI)/tools/tunslip: - (cd $(CONTIKI)/tools; $(MAKE) tunslip) - -ifdef MOTE - PORT = $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) -else - PORT = $(USBDEVPREFIX)$(firstword $(CMOTES)) -endif diff --git a/arch/platform/sky/Makefile.sky b/arch/platform/sky/Makefile.sky deleted file mode 100644 index ec2324085..000000000 --- a/arch/platform/sky/Makefile.sky +++ /dev/null @@ -1,9 +0,0 @@ -# $Id: Makefile.sky,v 1.38 2010/05/03 13:51:11 nifi Exp $ - -CONTIKI_TARGET_SOURCEFILES += contiki-sky-platform.c \ - sht11.c sht11-sensor.c light-sensor.c battery-sensor.c \ - button-sensor.c - -include $(ARCH_PATH)/platform/sky/Makefile.common - -MODULES += arch/dev/cc2420 arch/dev/sht11 arch/dev/ds2411 os/storage/cfs diff --git a/arch/platform/sky/apps/blink.c b/arch/platform/sky/apps/blink.c deleted file mode 100644 index 22dd274df..000000000 --- a/arch/platform/sky/apps/blink.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A quick program that blinks the LEDs - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "dev/leds.h" -/*---------------------------------------------------------------------------*/ -PROCESS(blink_process, "Blink"); -AUTOSTART_PROCESSES(&blink_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(blink_process, ev, data) -{ - PROCESS_EXITHANDLER(goto exit;) - PROCESS_BEGIN(); - - while(1) { - static struct etimer et; - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - leds_on(LEDS_ALL); - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - leds_off(LEDS_ALL); - } - - exit: - leds_off(LEDS_ALL); - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/sky/apps/fader.c b/arch/platform/sky/apps/fader.c deleted file mode 100644 index c36fb01b5..000000000 --- a/arch/platform/sky/apps/fader.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -#include "contiki.h" -#include "dev/leds.h" - -PROCESS(fader_process, "LED fader"); -AUTOSTART_PROCESSES(&fader_process); - -#define ON 1 -#define OFF 0 - -struct fader { - struct pt fade_pt, fade_in_pt, fade_out_pt; - struct etimer etimer; - int led; - int delay; -}; - -static unsigned char onoroff; - -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(fade_in(struct fader *f)) -{ - PT_BEGIN(&f->fade_in_pt); - - for(f->delay = 3980; f->delay > 20; f->delay -= 20) { - leds_on(f->led); - clock_delay(4000 - f->delay); - leds_off(f->led); - clock_delay(f->delay); - PT_YIELD(&f->fade_in_pt); - } - - PT_END(&f->fade_in_pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(fade_out(struct fader *f)) -{ - PT_BEGIN(&f->fade_out_pt); - - for(f->delay = 20; f->delay < 3980; f->delay += 20) { - leds_on(f->led); - clock_delay(4000 - f->delay); - leds_off(f->led); - clock_delay(f->delay); - PT_YIELD(&f->fade_out_pt); - } - - PT_END(&f->fade_out_pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(fade(struct fader *f)) -{ - PT_BEGIN(&f->fade_pt); - - while(1) { - - PT_SPAWN(&f->fade_pt, &f->fade_in_pt, fade_in(f)); - PT_SPAWN(&f->fade_pt, &f->fade_out_pt, fade_out(f)); - - etimer_set(&f->etimer, CLOCK_SECOND * 4); - PT_WAIT_UNTIL(&f->fade_pt, etimer_expired(&f->etimer)); - } - - PT_END(&f->fade_pt); -} -/*---------------------------------------------------------------------------*/ -static void -init_fader(struct fader *f, int led) -{ - PT_INIT(&f->fade_pt); - PT_INIT(&f->fade_in_pt); - PT_INIT(&f->fade_out_pt); - f->led = led; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(fader_process, ev, data) -{ - static struct fader red, green, yellow; - static struct timer timer; - static struct etimer etimer; - - PROCESS_BEGIN(); - - init_fader(&red, LEDS_RED); - init_fader(&green, LEDS_GREEN); - init_fader(&yellow, LEDS_YELLOW); - - timer_set(&timer, CLOCK_SECOND/4); - while(!timer_expired(&timer)) { - PT_SCHEDULE(fade(&red)); - } - timer_set(&timer, CLOCK_SECOND/4); - while(!timer_expired(&timer)) { - PT_SCHEDULE(fade(&red)); - PT_SCHEDULE(fade(&green)); - } - - timer_set(&timer, CLOCK_SECOND/4); - while(!timer_expired(&timer)) { - PT_SCHEDULE(fade(&green)); - PT_SCHEDULE(fade(&yellow)); - } - - etimer_set(&etimer, CLOCK_SECOND * 4); - fader_on(); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == PROCESS_EVENT_TIMER) { - etimer_set(&etimer, CLOCK_SECOND * 4); - process_poll(&fader_process); - } - - if(onoroff == ON && - PT_SCHEDULE(fade(&red)) && - PT_SCHEDULE(fade(&yellow)) && - PT_SCHEDULE(fade(&green))) { - process_poll(&fader_process); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -fader_on(void) -{ - onoroff = ON; - process_poll(&fader_process); -} -/*---------------------------------------------------------------------------*/ -void -fader_off(void) -{ - onoroff = OFF; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/sky/cfs-coffee-arch.h b/arch/platform/sky/cfs-coffee-arch.h deleted file mode 100644 index 842068707..000000000 --- a/arch/platform/sky/cfs-coffee-arch.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Coffee architecture-dependent header for the Tmote Sky platform. - * \author - * Nicolas Tsiftes - */ - -#ifndef CFS_COFFEE_ARCH_H -#define CFS_COFFEE_ARCH_H - -#include "contiki.h" -#include "dev/xmem.h" - -/* Coffee configuration parameters. */ -#define COFFEE_SECTOR_SIZE 65536UL -#define COFFEE_PAGE_SIZE 256UL -#define COFFEE_START COFFEE_SECTOR_SIZE -#define COFFEE_SIZE (1024UL * 1024UL - COFFEE_START) -#define COFFEE_NAME_LENGTH 16 -#define COFFEE_MAX_OPEN_FILES 6 -#define COFFEE_FD_SET_SIZE 8 -#define COFFEE_LOG_TABLE_LIMIT 256 -#ifdef COFFEE_CONF_DYN_SIZE -#define COFFEE_DYN_SIZE COFFEE_CONF_DYN_SIZE -#else -#define COFFEE_DYN_SIZE 4*1024 -#endif -#define COFFEE_LOG_SIZE 1024 - -#define COFFEE_APPEND_ONLY 0 -#define COFFEE_MICRO_LOGS 1 - -/* Flash operations. */ -#define COFFEE_WRITE(buf, size, offset) \ - xmem_pwrite((char *)(buf), (size), COFFEE_START + (offset)) - -#define COFFEE_READ(buf, size, offset) \ - xmem_pread((char *)(buf), (size), COFFEE_START + (offset)) - -#define COFFEE_ERASE(sector) \ - xmem_erase(COFFEE_SECTOR_SIZE, COFFEE_START + (sector) * COFFEE_SECTOR_SIZE) - -/* Coffee types. */ -typedef int16_t coffee_page_t; - -#endif /* !COFFEE_ARCH_H */ diff --git a/arch/platform/sky/contiki-conf.h b/arch/platform/sky/contiki-conf.h deleted file mode 100644 index d690af86a..000000000 --- a/arch/platform/sky/contiki-conf.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- C -*- */ - -#ifndef CONTIKI_CONF_H -#define CONTIKI_CONF_H - -/* include the project config */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif /* PROJECT_CONF_PATH */ -/*---------------------------------------------------------------------------*/ -#include "sky-def.h" -#include "msp430-def.h" -/*---------------------------------------------------------------------------*/ - -/* Configure radio driver */ -#ifndef NETSTACK_CONF_RADIO -#define NETSTACK_CONF_RADIO cc2420_driver -#endif /* NETSTACK_CONF_RADIO */ - -/* Symbol for the TSCH 15ms timeslot timing template */ -#define TSCH_CONF_ARCH_HDR_PATH "dev/cc2420/cc2420-tsch-15ms.h" - -/* The TSCH default slot length of 10ms is a bit too short for this platform, - * use 15ms instead. */ -#ifndef TSCH_CONF_DEFAULT_TIMESLOT_TIMING -#define TSCH_CONF_DEFAULT_TIMESLOT_TIMING tsch_timeslot_timing_us_15000 -#endif /* TSCH_CONF_DEFAULT_TIMESLOT_TIMING */ - -/* Save RAM through a smaller uIP buffer */ -#ifndef UIP_CONF_BUFFER_SIZE -#define UIP_CONF_BUFFER_SIZE 240 -#endif - -/* Platform-specific (H/W) AES implementation */ -#ifndef AES_128_CONF -#define AES_128_CONF cc2420_aes_128_driver -#endif /* AES_128_CONF */ - -/* Disable the stack check library by default: .rom overflow otherwise */ -#ifndef STACK_CHECK_CONF_ENABLED -#define STACK_CHECK_CONF_ENABLED 0 -#endif -/*---------------------------------------------------------------------------*/ -#include "msp430-conf.h" -/*---------------------------------------------------------------------------*/ -#endif /* CONTIKI_CONF_H */ diff --git a/arch/platform/sky/contiki-sky-platform.c b/arch/platform/sky/contiki-sky-platform.c deleted file mode 100644 index ccb6be835..000000000 --- a/arch/platform/sky/contiki-sky-platform.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Niclas Finne , Joakim Eriksson - * - */ - -#include "dev/button-sensor.h" - -SENSORS(&button_sensor); - -void -init_platform(void) -{ - process_start(&sensors_process, NULL); -} diff --git a/arch/platform/sky/dev/battery-sensor.c b/arch/platform/sky/dev/battery-sensor.c deleted file mode 100644 index f11b9da92..000000000 --- a/arch/platform/sky/dev/battery-sensor.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2010/08/25 19:30:52 $ - * $Revision: 1.11 $ - */ - -#include "contiki.h" -#include "dev/battery-sensor.h" -#include "dev/sky-sensors.h" - -/* Configure ADC12_2 to sample channel 11 (voltage) and use */ -/* the Vref+ as reference (SREF_1) since it is a stable reference */ -#define INPUT_CHANNEL (1 << INCH_11) -#define INPUT_REFERENCE SREF_1 -#define BATTERY_MEM ADC12MEM11 - -const struct sensors_sensor battery_sensor; -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return BATTERY_MEM; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(battery_sensor, BATTERY_SENSOR, value, configure, status); diff --git a/arch/platform/sky/dev/button-sensor.c b/arch/platform/sky/dev/button-sensor.c deleted file mode 100644 index 9aa03f48d..000000000 --- a/arch/platform/sky/dev/button-sensor.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/hwconf.h" -#include "dev/button-sensor.h" -#include "isr_compat.h" - -const struct sensors_sensor button_sensor; - -static struct timer debouncetimer; -static int status(int type); - -HWCONF_PIN(BUTTON, 2, 7); -HWCONF_IRQ(BUTTON, 2, 7); - -/*---------------------------------------------------------------------------*/ -ISR(PORT2, irq_p2) -{ - if(BUTTON_CHECK_IRQ()) { - if(timer_expired(&debouncetimer)) { - timer_set(&debouncetimer, CLOCK_SECOND / 4); - sensors_changed(&button_sensor); - LPM4_EXIT; - } - } - P2IFG = 0x00; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return BUTTON_READ() || !timer_expired(&debouncetimer); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - switch (type) { - case SENSORS_ACTIVE: - if (c) { - if(!status(SENSORS_ACTIVE)) { - timer_set(&debouncetimer, 0); - BUTTON_IRQ_EDGE_SELECTD(); - - BUTTON_SELECT(); - BUTTON_MAKE_INPUT(); - - BUTTON_ENABLE_IRQ(); - } - } else { - BUTTON_DISABLE_IRQ(); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch (type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return BUTTON_IRQ_ENABLED(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, - value, configure, status); diff --git a/arch/platform/sky/dev/i2c.c b/arch/platform/sky/dev/i2c.c deleted file mode 100644 index 1acbe897a..000000000 --- a/arch/platform/sky/dev/i2c.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/* - * Small and portable implementation of a bit-banging I2C bus master. - * - * The code should port really easily to platforms other than the - * msp430 but has some hardcoded constants in it. - * - * More info at: - * http://i2c-bus.org/ - * http://www.esacademy.com/faq/i2c/ - */ - -#include -#include -#include "dev/spi-legacy.h" -#include - -#include "dev/i2c.h" - -/* - * On the Tmote sky access to I2C/SPI/UART0 must always be exclusive. - */ - -void i2c_enable(void); -void i2c_disable(void); -int i2c_start(void); -unsigned i2c_read(int send_ack); -int i2c_write(unsigned); -void i2c_stop(void); - -#define I2C_PxDIR P3DIR -#define I2C_PxIN P3IN -#define I2C_PxOUT P3OUT -#define I2C_PxSEL P3SEL -/* - * SDA == P3.1 - * SCL == P3.3 - */ -#define SDA 1 -#define SCL 3 - -#define SDA_0() (I2C_PxDIR |= BV(SDA)) /* SDA Output */ -#define SDA_1() (I2C_PxDIR &= ~BV(SDA)) /* SDA Input */ -#define SDA_IS_1 (I2C_PxIN & BV(SDA)) - -#define SCL_0() (I2C_PxDIR |= BV(SCL)) /* SCL Output */ -#define SCL_1() (I2C_PxDIR &= ~BV(SCL)) /* SCL Input */ -#define SCL_IS_1 (I2C_PxIN & BV(SCL)) - -/* - * Should avoid infinite looping while waiting for SCL_IS_1. xxx/bg - */ -#define SCL_WAIT_FOR_1() do{}while (!SCL_IS_1) - -#define delay_4_7us() do{ _NOP(); _NOP(); _NOP(); _NOP(); \ - _NOP(); _NOP(); _NOP(); _NOP(); \ - _NOP(); _NOP(); _NOP(); _NOP(); }while(0) - -#define delay_4us() do{ _NOP(); _NOP(); _NOP(); _NOP(); \ - _NOP(); _NOP(); _NOP(); _NOP(); \ - _NOP(); _NOP(); }while(0) - -static unsigned char old_pxsel, old_pxout, old_pxdir; - -/* - * Grab SDA and SCL pins for exclusive use but remember old - * configuration so that it may be restored when we are done. - */ -void -i2c_enable(void) -{ - unsigned char sda_scl = BV(SDA)|BV(SCL); - - old_pxsel = I2C_PxSEL & sda_scl; - old_pxout = I2C_PxOUT & sda_scl; - old_pxdir = I2C_PxDIR & sda_scl; - - spi_busy = 1; - - I2C_PxSEL &= ~sda_scl; - - I2C_PxOUT &= ~sda_scl; - - I2C_PxDIR |= BV(SCL); /* SCL Output */ - I2C_PxDIR &= ~BV(SDA); /* SDA Input */ -} - -/* - * Restore bus to what it was before i2c_enable. - * - */ -void -i2c_disable(void) -{ - unsigned char not_sda_scl = ~(BV(SDA)|BV(SCL)); - - I2C_PxDIR = (I2C_PxDIR & not_sda_scl) | old_pxdir; - I2C_PxOUT = (I2C_PxOUT & not_sda_scl) | old_pxout; - I2C_PxSEL = (I2C_PxSEL & not_sda_scl) | old_pxsel; - - spi_busy = 0; -} - -int -i2c_start(void) -{ - SDA_1(); - SCL_1(); -#if 1 - SCL_WAIT_FOR_1(); -#else - { - unsigned long n; - for (n = 0; n < 100000 && !SCL_IS_1; n++) - ; - if (!SCL_IS_1) - return -1; - } -#endif - delay_4_7us(); - SDA_0(); - delay_4us(); - SCL_0(); - return 0; -} - -void -i2c_stop(void) -{ - SDA_0(); - delay_4us(); - SCL_1(); - SCL_WAIT_FOR_1(); - SDA_1(); -} - -/* - * Return true if we received an ACK. - */ -int -i2c_write(unsigned _c) -{ - unsigned char c = _c; - unsigned long n; - int i; - int ret; - - for (i = 0; i < 8; i++, c <<= 1) { - if (c & 0x80) - SDA_1(); - else - SDA_0(); - SCL_1(); - SCL_WAIT_FOR_1(); - SCL_0(); - } - - SDA_1(); - SCL_1(); - ret = 0; /* Loop waiting for an ACK to arrive. */ - for (n = 0; n < 250000; n++) { - if (!SDA_IS_1) { - ret = 1; - break; - } - } - SCL_WAIT_FOR_1(); /* clock stretching? */ - SCL_0(); - - return ret; -} - -unsigned -i2c_read(int send_ack) -{ - int i; - unsigned char c = 0x00; - - SDA_1(); - for (i = 0; i < 8; i++) { - c <<= 1; - SCL_1(); - SCL_WAIT_FOR_1(); - if (SDA_IS_1) - c |= 0x1; - SCL_0(); - } - - if (send_ack) - SDA_0(); - SCL_1(); - SCL_WAIT_FOR_1(); - SCL_0(); - - return c; -} diff --git a/arch/platform/sky/dev/i2c.h b/arch/platform/sky/dev/i2c.h deleted file mode 100644 index 71df70997..000000000 --- a/arch/platform/sky/dev/i2c.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 I2C_H -#define I2C_H - -/* - * On the Tmote sky access to I2C/SPI/UART0 must always be exclusive. - */ -#define I2C_ENABLE() (i2c_enable()) -#define I2C_DISABLE() (i2c_disable()) - -void i2c_enable(void); -void i2c_disable(void); -int i2c_start(void); -void i2c_stop(void); - -int i2c_write(unsigned); -unsigned i2c_read(int send_ack); - -#endif /* I2C_H */ diff --git a/arch/platform/sky/dev/light-sensor.c b/arch/platform/sky/dev/light-sensor.c deleted file mode 100644 index a75b542ee..000000000 --- a/arch/platform/sky/dev/light-sensor.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2005-2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/sky-sensors.h" -#include "dev/light-sensor.h" - -/* Photodiode 1 (P64) on INCH_4 */ -/* Photodiode 2 (P65) on INCH_5 */ -#define INPUT_CHANNEL ((1 << INCH_4) | (1 << INCH_5)) -#define INPUT_REFERENCE SREF_0 -#define PHOTOSYNTHETIC_MEM ADC12MEM4 -#define TOTAL_SOLAR_MEM ADC12MEM5 - -const struct sensors_sensor light_sensor; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - switch(type) { - /* Photosynthetically Active Radiation. */ - case LIGHT_SENSOR_PHOTOSYNTHETIC: - return PHOTOSYNTHETIC_MEM; - - /* Total Solar Radiation. */ - case LIGHT_SENSOR_TOTAL_SOLAR: - return TOTAL_SOLAR_MEM; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(light_sensor, "Light", value, configure, status); diff --git a/arch/platform/sky/dev/light-sensor.h b/arch/platform/sky/dev/light-sensor.h deleted file mode 100644 index 411c6fa33..000000000 --- a/arch/platform/sky/dev/light-sensor.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2010-01-08 - * Updated : $Date: 2010/01/14 20:23:02 $ - * $Revision: 1.2 $ - */ - -#ifndef LIGHT_SENSOR_H_ -#define LIGHT_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor light_sensor; - -#define LIGHT_SENSOR_PHOTOSYNTHETIC 0 -#define LIGHT_SENSOR_TOTAL_SOLAR 1 - - -#endif /* LIGHT-SENSOR_H_ */ diff --git a/arch/platform/sky/dev/sht11-arch.h b/arch/platform/sky/dev/sht11-arch.h deleted file mode 100644 index 8df629f65..000000000 --- a/arch/platform/sky/dev/sht11-arch.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Architecture-specific definitions for the SHT11 sensor on Tmote Sky. - * \author - * Niclas Finne - */ - -#ifndef SHT11_ARCH_H -#define SHT11_ARCH_H - -#define SHT11_ARCH_SDA 5 /* P1.5 */ -#define SHT11_ARCH_SCL 6 /* P1.6 */ -#define SHT11_ARCH_PWR 7 /* P1.7 */ - -#define SHT11_PxDIR P1DIR -#define SHT11_PxIN P1IN -#define SHT11_PxOUT P1OUT -#define SHT11_PxSEL P1SEL - -#endif diff --git a/arch/platform/sky/dev/sky-sensors.c b/arch/platform/sky/dev/sky-sensors.c deleted file mode 100644 index 48ac22428..000000000 --- a/arch/platform/sky/dev/sky-sensors.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * - * ----------------------------------------------------------------- - * - * Author : Joakim Eriksson - * Created : 2010-02-02 - * Updated : $Date: 2010/08/25 19:30:53 $ - * $Revision: 1.3 $ - */ -#include "contiki.h" -#include "lib/sensors.h" - -#define ADC12MCTL_NO(adcno) ((unsigned char *) ADC12MCTL0_)[adcno] - -static uint16_t adc_on; -static uint16_t ready; -/*---------------------------------------------------------------------------*/ -static CC_INLINE void -start(void) -{ - uint16_t c, last; - - /* Set up the ADC. */ - P6DIR = 0xff; - P6OUT = 0x00; - - /* Setup ADC12, ref., sampling time */ - /* XXX Note according to the specification a minimum of 17 ms should - be allowed after turn on of the internal reference generator. */ - ADC12CTL0 = REF2_5V + SHT0_6 + SHT1_6 + MSC + REFON; - /* Use sampling timer, repeat-sequence-of-channels */ - ADC12CTL1 = SHP + CONSEQ_3; - - last = 15; - for(c = 0; c < 16; c++) { - /* Clear all end-of-sequences */ - ADC12MCTL_NO(c) &= ~EOS; - if(adc_on & (1 << c)) { - if(last == 15) { - /* Set new start of sequence to lowest active memory holder */ - ADC12CTL1 |= (c * CSTARTADD_1); - } - last = c; - } - } - - /* Set highest end-of-sequence. */ - ADC12MCTL_NO(last) |= EOS; - - ADC12CTL0 |= ADC12ON; - ADC12CTL0 |= ENC; /* enable conversion */ - ADC12CTL0 |= ADC12SC; /* sample & convert */ -} -/*---------------------------------------------------------------------------*/ -static CC_INLINE void -stop(void) -{ - /* stop converting immediately, turn off reference voltage, etc. */ - - ADC12CTL0 &= ~ENC; - /* need to remove CONSEQ_3 if not EOS is configured */ - ADC12CTL1 &= ~CONSEQ_3; - - /* wait for conversion to stop */ - while(ADC12CTL1 & ADC12BUSY); - - /* clear any pending interrupts */ - ADC12IFG = 0; -} -/*---------------------------------------------------------------------------*/ -int -sky_sensors_status(uint16_t input, int type) -{ - if(type == SENSORS_ACTIVE) { - return (adc_on & input) == input; - } - if(type == SENSORS_READY) { - ready |= ADC12IFG & adc_on & input; - return (ready & adc_on & input) == input; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sky_sensors_configure(uint16_t input, uint8_t ref, int type, int value) -{ - uint16_t c; - - if(type == SENSORS_ACTIVE) { - stop(); - - if(value) { - adc_on |= input; - P6SEL |= input & 0xff; - - /* Set ADC config */ - for(c = 0; c < 16; c++) { - if(input & (1 << c)) { - ADC12MCTL_NO(c) = (c * INCH_1) | ref; - } - } - - } else { - adc_on &= ~input; - ready &= ~input; - P6SEL &= ~(input & 0xff); - } - - if(adc_on == 0) { - P6DIR = 0x00; - P6SEL = 0x00; - - /* Turn off ADC and internal reference generator */ - ADC12CTL0 = 0; - ADC12CTL1 = 0; - } else { - start(); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/sky/dev/sky-sensors.h b/arch/platform/sky/dev/sky-sensors.h deleted file mode 100644 index df2aeea48..000000000 --- a/arch/platform/sky/dev/sky-sensors.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * ----------------------------------------------------------------- - * - * Author : Joakim Eriksson - * Created : 2010-02-02 - * Updated : $Date: 2010/08/25 19:30:53 $ - * $Revision: 1.2 $ - */ - -#ifndef SKY_SENSORS_H_ -#define SKY_SENSORS_H_ - -int sky_sensors_status(uint16_t input, int type); -int sky_sensors_configure(uint16_t input, uint8_t reference, - int type, int value); - -#endif /* SKY_SENSORS_H_ */ diff --git a/arch/platform/sky/dev/temperature-sensor.c b/arch/platform/sky/dev/temperature-sensor.c deleted file mode 100644 index 6471df485..000000000 --- a/arch/platform/sky/dev/temperature-sensor.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Sensor driver for reading the built-in temperature sensor in the CPU. - * \author - * Adam Dunkels - * Joakim Eriksson - * Niclas Finne - */ - -#include "contiki.h" -#include "dev/temperature-sensor.h" -#include "dev/sky-sensors.h" - -#define INPUT_CHANNEL (1 << INCH_10) -#define INPUT_REFERENCE SREF_1 -#define TEMPERATURE_MEM ADC12MEM10 - -const struct sensors_sensor temperature_sensor; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return TEMPERATURE_MEM; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR, - value, configure, status); diff --git a/arch/platform/sky/dev/temperature-sensor.h b/arch/platform/sky/dev/temperature-sensor.h deleted file mode 100644 index 05eafe852..000000000 --- a/arch/platform/sky/dev/temperature-sensor.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Temperature sensor header file. - * \author - * Adam Dunkels - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef TEMPERATURE_SENSOR_H_ -#define TEMPERATURE_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor temperature_sensor; - -#define TEMPERATURE_SENSOR "Temperature" - -#endif /* TEMPERATURE_SENSOR_H_ */ diff --git a/arch/platform/sky/dev/xmem.c b/arch/platform/sky/dev/xmem.c deleted file mode 100644 index 4ff525bb8..000000000 --- a/arch/platform/sky/dev/xmem.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Device driver for the ST M25P80 40MHz 1Mbyte external memory. - * \author - * Björn Grönvall - * - * Data is written bit inverted (~-operator) to flash so that - * unwritten data will read as zeros (UNIX style). - */ - - -#include "contiki.h" -#include -#include - -#include "dev/spi-legacy.h" -#include "dev/xmem.h" -#include "dev/watchdog.h" - -#if 0 -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) do {} while (0) -#endif - -#define SPI_FLASH_INS_WREN 0x06 -#define SPI_FLASH_INS_WRDI 0x04 -#define SPI_FLASH_INS_RDSR 0x05 -#define SPI_FLASH_INS_WRSR 0x01 -#define SPI_FLASH_INS_READ 0x03 -#define SPI_FLASH_INS_FAST_READ 0x0b -#define SPI_FLASH_INS_PP 0x02 -#define SPI_FLASH_INS_SE 0xd8 -#define SPI_FLASH_INS_BE 0xc7 -#define SPI_FLASH_INS_DP 0xb9 -#define SPI_FLASH_INS_RES 0xab -/*---------------------------------------------------------------------------*/ -static void -write_enable(void) -{ - int s; - - s = splhigh(); - SPI_FLASH_ENABLE(); - - SPI_WRITE(SPI_FLASH_INS_WREN); - - SPI_FLASH_DISABLE(); - splx(s); -} -/*---------------------------------------------------------------------------*/ -static unsigned -read_status_register(void) -{ - unsigned char u; - - int s; - - s = splhigh(); - SPI_FLASH_ENABLE(); - - SPI_WRITE(SPI_FLASH_INS_RDSR); - - SPI_FLUSH(); - SPI_READ(u); - - SPI_FLASH_DISABLE(); - splx(s); - - return u; -} -/*---------------------------------------------------------------------------*/ -/* - * Wait for a write/erase operation to finish. - */ -static unsigned -wait_ready(void) -{ - unsigned u; - do { - u = read_status_register(); - watchdog_periodic(); - } while(u & 0x01); /* WIP=1, write in progress */ - return u; -} -/*---------------------------------------------------------------------------*/ -/* - * Erase 64k bytes of data. It takes about 1s before WIP goes low! - */ -static void -erase_sector(unsigned long offset) -{ - int s; - - wait_ready(); - write_enable(); - - s = splhigh(); - SPI_FLASH_ENABLE(); - - SPI_WRITE_FAST(SPI_FLASH_INS_SE); - SPI_WRITE_FAST(offset >> 16); /* MSB */ - SPI_WRITE_FAST(offset >> 8); - SPI_WRITE_FAST(offset >> 0); /* LSB */ - SPI_WAITFORTx_ENDED(); - - SPI_FLASH_DISABLE(); - splx(s); -} -/*---------------------------------------------------------------------------*/ -/* - * Initialize external flash *and* SPI bus! - */ -void -xmem_init(void) -{ - int s; - spi_init(); - - P4DIR |= BV(FLASH_CS) | BV(FLASH_HOLD) | BV(FLASH_PWR); - P4OUT |= BV(FLASH_PWR); /* P4.3 Output, turn on power! */ - - /* Release from Deep Power-down */ - s = splhigh(); - SPI_FLASH_ENABLE(); - SPI_WRITE_FAST(SPI_FLASH_INS_RES); - SPI_WAITFORTx_ENDED(); - SPI_FLASH_DISABLE(); /* Unselect flash. */ - splx(s); - - SPI_FLASH_UNHOLD(); -} -/*---------------------------------------------------------------------------*/ -int -xmem_pread(void *_p, int size, unsigned long offset) -{ - unsigned char *p = _p; - const unsigned char *end = p + size; - int s; - - wait_ready(); - - s = splhigh(); - SPI_FLASH_ENABLE(); - - SPI_WRITE_FAST(SPI_FLASH_INS_READ); - SPI_WRITE_FAST(offset >> 16); /* MSB */ - SPI_WRITE_FAST(offset >> 8); - SPI_WRITE_FAST(offset >> 0); /* LSB */ - SPI_WAITFORTx_ENDED(); - - SPI_FLUSH(); - for(; p < end; p++) { - unsigned char u; - SPI_READ(u); - *p = ~u; - } - - SPI_FLASH_DISABLE(); - splx(s); - - return size; -} -/*---------------------------------------------------------------------------*/ -static const unsigned char * -program_page(unsigned long offset, const unsigned char *p, int nbytes) -{ - const unsigned char *end = p + nbytes; - int s; - - wait_ready(); - write_enable(); - - s = splhigh(); - SPI_FLASH_ENABLE(); - - SPI_WRITE_FAST(SPI_FLASH_INS_PP); - SPI_WRITE_FAST(offset >> 16); /* MSB */ - SPI_WRITE_FAST(offset >> 8); - SPI_WRITE_FAST(offset >> 0); /* LSB */ - - for(; p < end; p++) { - SPI_WRITE_FAST(~*p); - } - SPI_WAITFORTx_ENDED(); - - SPI_FLASH_DISABLE(); - splx(s); - - return p; -} -/*---------------------------------------------------------------------------*/ -int -xmem_pwrite(const void *_buf, int size, unsigned long addr) -{ - const unsigned char *p = _buf; - const unsigned long end = addr + size; - unsigned long i, next_page; - - for(i = addr; i < end;) { - next_page = (i | 0xff) + 1; - if(next_page > end) { - next_page = end; - } - p = program_page(i, p, next_page - i); - i = next_page; - } - - return size; -} -/*---------------------------------------------------------------------------*/ -int -xmem_erase(long size, unsigned long addr) -{ - unsigned long end = addr + size; - - if(size % XMEM_ERASE_UNIT_SIZE != 0) { - PRINTF("xmem_erase: bad size\n"); - return -1; - } - - if(addr % XMEM_ERASE_UNIT_SIZE != 0) { - PRINTF("xmem_erase: bad offset\n"); - return -1; - } - - for (; addr < end; addr += XMEM_ERASE_UNIT_SIZE) { - erase_sector(addr); - } - - return size; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/sky/doc/sky.txt b/arch/platform/sky/doc/sky.txt deleted file mode 100644 index 7357ee921..000000000 --- a/arch/platform/sky/doc/sky.txt +++ /dev/null @@ -1,39 +0,0 @@ -/** \addtogroup platform - * @{ - **/ - -/** -\defgroup sky The Tmote Sky board - -The Tmote Sky platform is a wireless sensor board from Moteiv. It is -an MSP430-based board with an 802.15.4-compatible CC2420 radio chip, a -1 megabyte external serial flash memory, and two light -sensors. Contiki was ported to the Tmote Sky by Björn Grönvall as part -of the RUNES project. The Tmote Sky port was integrated into the -Contiki build system in March 2007. - -The platform-specif source code for the Tmote Sky port can be found in -the directories platform/sky and cpu/msp430 in the Contiki source -tree. Code for writing to the on-chip flash ROM is in the -cpu/msp430/flash.c and code for reading and writing to the external -flash is the file platform/sky/dev/xmem.c. Code for reading the light -sensors is in platform/sky/dev/light.c. - -The serial/USB port is read from and written to with either the code -in cpu/msp430/dev/uart1.c or platform/sky/slip_uart1.c, depending on -weather or not the Tmote Sky is running TCP/IP or not. - -There are currently two CC2420 drivers in the Contiki source code, -os/dev/simple-cc2420.c (a really simple CC2420 driver) and -os/dev/cc2420.c (a more feature-rich CC2420 driver). - -More information about the Tmote Sky, including data sheets, can be -found at Moteiv's web site: http://www.moteiv.com - -@{ - -*/ - - -/** @} */ -/** @} */ diff --git a/arch/platform/sky/platform.c b/arch/platform/sky/platform.c deleted file mode 100644 index 8044a7196..000000000 --- a/arch/platform/sky/platform.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 -#include -#include "contiki.h" -#include "sys/energest.h" -#include "cc2420.h" -#include "dev/ds2411/ds2411.h" -#include "dev/leds.h" -#include "dev/serial-line.h" -#include "dev/slip.h" -#include "dev/uart1.h" -#include "dev/watchdog.h" -#include "dev/xmem.h" -#include "lib/random.h" -#include "net/netstack.h" -#include "net/mac/framer/frame802154.h" -#include "net/mac/tsch/tsch.h" - -#if NETSTACK_CONF_WITH_IPV6 -#include "net/ipv6/uip-ds6.h" -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -#include "sys/node-id.h" -#include "cfs-coffee-arch.h" -#include "cfs/cfs-coffee.h" - -#if DCOSYNCH_CONF_ENABLED -static struct timer mgt_timer; -#endif -extern int msp430_dco_required; - -#define UIP_OVER_MESH_CHANNEL 8 - -#ifdef EXPERIMENT_SETUP -#include "experiment-setup.h" -#endif - -void init_platform(void); -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Sky" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -#if 0 -int -force_float_inclusion() -{ - extern int __fixsfsi; - extern int __floatsisf; - extern int __mulsf3; - extern int __subsf3; - - return __fixsfsi + __floatsisf + __mulsf3 + __subsf3; -} -#endif -/*---------------------------------------------------------------------------*/ -void uip_log(char *msg) { puts(msg); } - -/*---------------------------------------------------------------------------*/ -#if 0 -void -force_inclusion(int d1, int d2) -{ - snprintf(NULL, 0, "%d", d1 % d2); -} -#endif -/*---------------------------------------------------------------------------*/ -static void -set_lladdr(void) -{ - linkaddr_t addr; - - memset(&addr, 0, sizeof(linkaddr_t)); -#if NETSTACK_CONF_WITH_IPV6 - memcpy(addr.u8, ds2411_id, sizeof(addr.u8)); -#else - int i; - for(i = 0; i < sizeof(linkaddr_t); ++i) { - addr.u8[i] = ds2411_id[7 - i]; - } -#endif - linkaddr_set_node_addr(&addr); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one(void) -{ - /* - * Initalize hardware. - */ - msp430_cpu_init(); - - leds_init(); - leds_on(LEDS_RED); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two(void) -{ - uart1_init(BAUD2UBR(115200)); /* Must come before first printf */ - - leds_on(LEDS_GREEN); - ds2411_init(); - - /* XXX hack: Fix it so that the 802.15.4 MAC address is compatible - with an Ethernet MAC address - byte 0 (byte 2 in the DS ID) - cannot be odd. */ - ds2411_id[2] &= 0xfe; - - leds_on(LEDS_BLUE); - xmem_init(); - - leds_off(LEDS_RED); - /* - * Hardware initialization done! - */ - - random_init(ds2411_id[0]); - - leds_off(LEDS_BLUE); - - set_lladdr(); - - /* - * main() will turn the radio on inside netstack_init(). The CC2420 - * must already be initialised by that time, so we do this here early. - * Later on in stage three we set correct values for PANID and radio - * short/long address. - */ - cc2420_init(); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three(void) -{ - uint8_t longaddr[8]; - uint16_t shortaddr; - - init_platform(); - - shortaddr = (linkaddr_node_addr.u8[0] << 8) + linkaddr_node_addr.u8[1]; - memset(longaddr, 0, sizeof(longaddr)); - linkaddr_copy((linkaddr_t *)&longaddr, &linkaddr_node_addr); - - cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr); - - LOG_INFO("CC2420 CCA threshold %i\n", CC2420_CONF_CCA_THRESH); - -#if !NETSTACK_CONF_WITH_IPV6 - uart1_set_input(serial_line_input_byte); - serial_line_init(); -#endif - - leds_off(LEDS_GREEN); - -#if TIMESYNCH_CONF_ENABLED - timesynch_init(); - timesynch_set_authority_level((linkaddr_node_addr.u8[0] << 4) + 16); -#endif /* TIMESYNCH_CONF_ENABLED */ - - /* - * This is the scheduler loop. - */ -#if DCOSYNCH_CONF_ENABLED - timer_set(&mgt_timer, DCOSYNCH_PERIOD * CLOCK_SECOND); -#endif -} -/*---------------------------------------------------------------------------*/ -void -platform_idle(void) -{ - /* - * Idle processing. - */ - int s = splhigh(); /* Disable interrupts. */ - /* uart1_active is for avoiding LPM3 when still sending or receiving */ - if(process_nevents() != 0 || uart1_active()) { - splx(s); /* Re-enable interrupts. */ - } else { -#if DCOSYNCH_CONF_ENABLED - /* before going down to sleep possibly do some management */ - if(timer_expired(&mgt_timer)) { - watchdog_periodic(); - timer_reset(&mgt_timer); - msp430_sync_dco(); -#if CC2420_CONF_SFD_TIMESTAMPS - cc2420_arch_sfd_init(); -#endif /* CC2420_CONF_SFD_TIMESTAMPS */ - } -#endif - - /* Re-enable interrupts and go to sleep atomically. */ - ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM); - watchdog_stop(); - /* check if the DCO needs to be on - if so - only LPM 1 */ - if (msp430_dco_required) { - _BIS_SR(GIE | CPUOFF); /* LPM1 sleep for DMA to work!. */ - } else { - _BIS_SR(GIE | SCG0 | SCG1 | CPUOFF); /* LPM3 sleep. This - statement will block - until the CPU is - woken up by an - interrupt that sets - the wake up flag. */ - } - watchdog_start(); - ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU); - } -} diff --git a/arch/platform/sky/sky-def.h b/arch/platform/sky/sky-def.h deleted file mode 100644 index 1077563a3..000000000 --- a/arch/platform/sky/sky-def.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A brief description of what this file is - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef SKY_DEF_H_ -#define SKY_DEF_H_ - -/* - * Definitions below are dictated by the hardware and not really - * changeable! - */ - - /* 1 len byte, 2 bytes CRC */ - #define RADIO_PHY_OVERHEAD 3 - /* 250kbps data rate. One byte = 32us */ - #define RADIO_BYTE_AIR_TIME 32 -/* Delay between GO signal and SFD: radio fixed delay + 4Bytes preample + 1B SFD -- 1Byte time is 32us - * ~327us + 129preample = 456 us */ -#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(456)) -/* Delay between GO signal and start listening - * ~50us delay + 129preample + ?? = 183 us */ -#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(183)) -/* Delay between the SFD finishes arriving and it is detected in software */ -#define RADIO_DELAY_BEFORE_DETECT 0 - -/* Disable TSCH frame filtering */ -#define TSCH_CONF_HW_FRAME_FILTERING 0 - -#define PLATFORM_HAS_LEDS 1 -#define PLATFORM_HAS_BUTTON 1 -#define PLATFORM_HAS_LIGHT 1 -#define PLATFORM_HAS_BATTERY 1 -#define PLATFORM_HAS_SHT11 1 -#define PLATFORM_HAS_RADIO 1 - -/* CPU target speed in Hz */ -#define F_CPU 3900000uL /*2457600uL*/ - -/* the low-level radio driver */ -#define NETSTACK_CONF_RADIO cc2420_driver - -/* LED ports */ -#define LEDS_PxDIR P5DIR -#define LEDS_PxOUT P5OUT -#define LEDS_CONF_RED 0x10 -#define LEDS_CONF_GREEN 0x20 -#define LEDS_CONF_YELLOW 0x40 - -#define LEDS_CONF_LEGACY_API 1 - -/* DCO speed resynchronization for more robust UART, etc. */ -#ifndef DCOSYNCH_CONF_ENABLED -#define DCOSYNCH_CONF_ENABLED (!(MAC_CONF_WITH_TSCH)) /* TSCH needs timerB -for SFD timestamping */ -#endif /* DCOSYNCH_CONF_ENABLED */ - -#ifndef CC2420_CONF_SFD_TIMESTAMPS -#define CC2420_CONF_SFD_TIMESTAMPS (MAC_CONF_WITH_TSCH) /* TSCH needs SFD timestamping */ -#endif /* CC2420_CONF_SFD_TIMESTAMPS */ - -#ifndef DCOSYNCH_CONF_PERIOD -#define DCOSYNCH_CONF_PERIOD 30 -#endif /* DCOSYNCH_CONF_PERIOD */ - -#define ROM_ERASE_UNIT_SIZE 512 -#define XMEM_ERASE_UNIT_SIZE (64*1024L) - - -#define CFS_CONF_OFFSET_TYPE long - - -/* Use the first 64k of external flash for node configuration */ -#define NODE_ID_XMEM_OFFSET (0 * XMEM_ERASE_UNIT_SIZE) - -/* Use the second 64k of external flash for codeprop. */ -#define EEPROMFS_ADDR_CODEPROP (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_XMEM_CONF_OFFSET (2 * XMEM_ERASE_UNIT_SIZE) -#define CFS_XMEM_CONF_SIZE (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_RAM_CONF_SIZE 4096 - -/* - * SPI bus configuration for the TMote Sky. - */ - -/* SPI input/output registers. */ -#define SPI_TXBUF U0TXBUF -#define SPI_RXBUF U0RXBUF - - /* USART0 Tx ready? */ -#define SPI_WAITFOREOTx() while ((U0TCTL & TXEPT) == 0) - /* USART0 Rx ready? */ -#define SPI_WAITFOREORx() while ((IFG1 & URXIFG0) == 0) - /* USART0 Tx buffer ready? */ -#define SPI_WAITFORTxREADY() while ((IFG1 & UTXIFG0) == 0) - -#define SCK 1 /* P3.1 - Output: SPI Serial Clock (SCLK) */ -#define MOSI 2 /* P3.2 - Output: SPI Master out - slave in (MOSI) */ -#define MISO 3 /* P3.3 - Input: SPI Master in - slave out (MISO) */ - -/* - * SPI bus - M25P80 external flash configuration. - */ - -#define FLASH_PWR 3 /* P4.3 Output */ -#define FLASH_CS 4 /* P4.4 Output */ -#define FLASH_HOLD 7 /* P4.7 Output */ - -/* Enable/disable flash access to the SPI bus (active low). */ - -#define SPI_FLASH_ENABLE() ( P4OUT &= ~BV(FLASH_CS) ) -#define SPI_FLASH_DISABLE() ( P4OUT |= BV(FLASH_CS) ) - -#define SPI_FLASH_HOLD() ( P4OUT &= ~BV(FLASH_HOLD) ) -#define SPI_FLASH_UNHOLD() ( P4OUT |= BV(FLASH_HOLD) ) - -/* - * SPI bus - CC2420 pin configuration. - */ - -#define CC2420_CONF_SYMBOL_LOOP_COUNT 800 - -/* P1.0 - Input: FIFOP from CC2420 */ -#define CC2420_FIFOP_PORT(type) P1##type -#define CC2420_FIFOP_PIN 0 -/* P1.3 - Input: FIFO from CC2420 */ -#define CC2420_FIFO_PORT(type) P1##type -#define CC2420_FIFO_PIN 3 -/* P1.4 - Input: CCA from CC2420 */ -#define CC2420_CCA_PORT(type) P1##type -#define CC2420_CCA_PIN 4 -/* P4.1 - Input: SFD from CC2420 */ -#define CC2420_SFD_PORT(type) P4##type -#define CC2420_SFD_PIN 1 -/* P4.2 - Output: SPI Chip Select (CS_N) */ -#define CC2420_CSN_PORT(type) P4##type -#define CC2420_CSN_PIN 2 -/* P4.5 - Output: VREG_EN to CC2420 */ -#define CC2420_VREG_PORT(type) P4##type -#define CC2420_VREG_PIN 5 -/* P4.6 - Output: RESET_N to CC2420 */ -#define CC2420_RESET_PORT(type) P4##type -#define CC2420_RESET_PIN 6 - -#define CC2420_IRQ_VECTOR PORT1_VECTOR - -/* Pin status. */ -#define CC2420_FIFOP_IS_1 (!!(CC2420_FIFOP_PORT(IN) & BV(CC2420_FIFOP_PIN))) -#define CC2420_FIFO_IS_1 (!!(CC2420_FIFO_PORT(IN) & BV(CC2420_FIFO_PIN))) -#define CC2420_CCA_IS_1 (!!(CC2420_CCA_PORT(IN) & BV(CC2420_CCA_PIN))) -#define CC2420_SFD_IS_1 (!!(CC2420_SFD_PORT(IN) & BV(CC2420_SFD_PIN))) - -/* The CC2420 reset pin. */ -#define SET_RESET_INACTIVE() (CC2420_RESET_PORT(OUT) |= BV(CC2420_RESET_PIN)) -#define SET_RESET_ACTIVE() (CC2420_RESET_PORT(OUT) &= ~BV(CC2420_RESET_PIN)) - -/* CC2420 voltage regulator enable pin. */ -#define SET_VREG_ACTIVE() (CC2420_VREG_PORT(OUT) |= BV(CC2420_VREG_PIN)) -#define SET_VREG_INACTIVE() (CC2420_VREG_PORT(OUT) &= ~BV(CC2420_VREG_PIN)) - -/* CC2420 rising edge trigger for external interrupt 0 (FIFOP). */ -#define CC2420_FIFOP_INT_INIT() do { \ - CC2420_FIFOP_PORT(IES) &= ~BV(CC2420_FIFOP_PIN); \ - CC2420_CLEAR_FIFOP_INT(); \ - } while(0) - -/* FIFOP on external interrupt 0. */ -#define CC2420_ENABLE_FIFOP_INT() do {CC2420_FIFOP_PORT(IE) |= BV(CC2420_FIFOP_PIN);} while(0) -#define CC2420_DISABLE_FIFOP_INT() do {CC2420_FIFOP_PORT(IE) &= ~BV(CC2420_FIFOP_PIN);} while(0) -#define CC2420_CLEAR_FIFOP_INT() do {CC2420_FIFOP_PORT(IFG) &= ~BV(CC2420_FIFOP_PIN);} while(0) - -/* - * Enables/disables CC2420 access to the SPI bus (not the bus). - * (Chip Select) - */ - - /* ENABLE CSn (active low) */ -#define CC2420_SPI_ENABLE() (CC2420_CSN_PORT(OUT) &= ~BV(CC2420_CSN_PIN)) - /* DISABLE CSn (active low) */ -#define CC2420_SPI_DISABLE() (CC2420_CSN_PORT(OUT) |= BV(CC2420_CSN_PIN)) -#define CC2420_SPI_IS_ENABLED() ((CC2420_CSN_PORT(OUT) & BV(CC2420_CSN_PIN)) != BV(CC2420_CSN_PIN)) - -/* Platform-specific define for the end of the stack region */ -#define STACK_CONF_ORIGIN ((void *)0x3900) - -#endif /* SKY_DEF_H_ */ diff --git a/arch/platform/z1/Makefile.common b/arch/platform/z1/Makefile.common deleted file mode 100644 index 42172022b..000000000 --- a/arch/platform/z1/Makefile.common +++ /dev/null @@ -1,145 +0,0 @@ - -# -# Currently enabling SMALL breaks the build on this platform. -# No large effect is expected anyway: unused sections are discarded even if SMALL is not set. -# -SMALL=0 - -ARCH = leds.c xmem.c i2cmaster.c \ - spi-legacy.c cc2420.c cc2420-arch.c cc2420-arch-sfd.c\ - node-id-z1.c sensors.c button-sensor.c cfs-coffee.c \ - uart0.c uart0-putchar.c uip-ipchksum.c \ - slip.c slip_uart0.c z1-sensors.c adxl345.c temperature-sensor.c \ - z1-phidgets.c light-sensor.c battery-sensor.c sky-sensors.c tmp102.c \ - platform.c - -CONTIKI_TARGET_DIRS = . dev apps -ifndef CONTIKI_TARGET_MAIN -CONTIKI_TARGET_MAIN = contiki-main.c -endif - -CONTIKI_TARGET_SOURCEFILES += $(ARCH) - -MCU=msp430f2617 -CPU_HAS_MSP430X=1 - -LDFLAGS += -Wl,--defsym -Wl,__P1SEL2=0x0041 -Wl,--defsym -Wl,__P5SEL2=0x0045 - -ifdef nodemac -CFLAGS += -DMACID=$(nodemac) -endif - -CFLAGS += -g - -include $(ARCH_PATH)/cpu/msp430/Makefile.msp430 - - -NUMPAR=20 -IHEXFILE=tmpimage.ihex - -ifeq ($(HOST_OS),Darwin) - ifndef MOTELIST - USBDEVPREFIX= - SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux - MOTELIST = $(CONTIKI)/tools/zolertia/motelist-zolertia-macos - BSL = $(CONTIKI)/tools/zolertia/z1-bsl-nopic --z1 - BSL_FILETYPE = -I - MOTES = $(shell $(MOTELIST) -b z1 -c 2>&- | \ - cut -f 2 -d ,) - REFNUM = $(shell $(MOTELIST) -c 2>&- | \ - cut -f 1 -d , | tail -c5 | sed 's/^0*//') - ifneq (,$(REFNUM)) - # No device fo-und - ifeq (,$(findstring und, $(REFNUM))) - CFLAGS += -DSERIALNUM=$(REFNUM:0%=%) - endif - endif - endif -else - # If we are not running under Mac, we assume Linux - ifndef MOTELIST - USBDEVPREFIX= - SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux - MOTELIST = $(CONTIKI)/tools/zolertia/motelist-zolertia - BSL = $(CONTIKI)/tools/zolertia/z1-bsl-nopic --z1 - BSL_FILETYPE = -I - MOTES = $(shell $(MOTELIST) -b z1 -c 2>&- | \ - cut -f 2 -d , | \ - perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);') - CMOTES=$(MOTES) - REFNUM = $(shell $(MOTELIST) -c 2>&- | \ - cut -f 1 -d , | tail -c5 | sed 's/^0*//') - ifneq (,$(REFNUM)) - # No device fo-und - ifeq (,$(findstring und, $(REFNUM))) - CFLAGS += -DSERIALNUM=$(REFNUM) - endif - endif - endif -endif - -motelist: - $(MOTELIST) -z1-motelist: - $(MOTELIST) -b z1 -z1-motes: - @echo $(MOTES) - -ifdef MOTE -%.upload: %.ihex - cp $< $(IHEXFILE) - $(MAKE) z1-u.$(subst /,-,$(word $(MOTE), $(MOTES))) -else # MOTE -%.upload: %.ihex - cp $< $(IHEXFILE) - @echo $(MOTES) - $(MAKE) z1-reset z1-upload -endif # MOTE - -z1-upload: z1-reset - $(MAKE) -j $(NUMPAR) z1-upload-sequence - -z1-upload-sequence: $(foreach PORT, $(MOTES), z1-u.$(subst /,-,$(PORT))) - @echo Done - -z1-reset: - $(MAKE) -k -j $(NUMPAR) z1-reset-sequence - -z1-reset-sequence: $(foreach PORT, $(MOTES), z1-r.$(subst /,-,$(PORT))) - @echo Done - -z1-u.%: - @echo +++++ Erasing $(subst -,/,$*); \ - $(BSL) -c $(subst -,/,$*) -e && sleep 2 ; \ - echo +++++ Programming $(subst -,/,$*) ; \ - $(BSL) -c $(subst -,/,$*) $(BSL_FILETYPE) -p $(IHEXFILE) && sleep 2 ; \ - echo +++++ Resetting $(subst -,/,$*) ; \ - $(BSL) -c $(subst -,/,$*) -r - -z1-r.%: - $(BSL) -c $(subst -,/,$*) -r - -sizeplot: - msp430-size $(OBJECTDIR)/*.o | $(CONTIKI)/tools/sky/check-size > size-data - gnuplot $(CONTIKI)/tools/sky/plot-size - gv size.pdf - -winslip: -ifdef INTERFACE - $(CONTIKI)/tools/wpcapslip/wpcapslip -s $(USBDEVPREFIX)$(firstword $(CMOTES)) $(INTERFACE) 172.16.0.0 255.255.0.0 -else - @echo "Usage: \"$(MAKE) $@ INTERFACE=\"" - @echo "Use the \"ipconfig\" command to find out the IP addresses of the local interfaces" -endif - -linslip: $(CONTIKI)/tools/tunslip - $(CONTIKI)/tools/tunslip -s $(USBDEVPREFIX)$(firstword $(CMOTES)) 172.16.0.0 255.255.0.0 - -$(CONTIKI)/tools/tunslip: - (cd $(CONTIKI)/tools; $(MAKE) tunslip) - -ifdef MOTE - PORT = $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) -else - PORT = $(USBDEVPREFIX)$(firstword $(CMOTES)) -endif diff --git a/arch/platform/z1/Makefile.z1 b/arch/platform/z1/Makefile.z1 deleted file mode 100644 index aeff61bf2..000000000 --- a/arch/platform/z1/Makefile.z1 +++ /dev/null @@ -1,11 +0,0 @@ -# Common Makefile between Z1 and Z1SP - -CONTIKI_TARGET_SOURCEFILES += contiki-z1-platform.c - -include $(ARCH_PATH)/platform/z1/Makefile.common - -ifeq ($(ZOLERTIA_Z1SP),1) -include $(ARCH_PATH)/platform/z1/Makefile.z1sp -endif - -MODULES += arch/dev/cc2420 os/storage/cfs diff --git a/arch/platform/z1/Makefile.z1sp b/arch/platform/z1/Makefile.z1sp deleted file mode 100644 index 29b8fcbd1..000000000 --- a/arch/platform/z1/Makefile.z1sp +++ /dev/null @@ -1,6 +0,0 @@ -# Makefile for Z1 Starter Platform - -# This is the actual flag we need to include specific Z1SP components -CFLAGS += -DZ1_IS_Z1SP - -CONTIKI_TARGET_SOURCEFILES += potentiometer-sensor.c diff --git a/arch/platform/z1/README.z1sp b/arch/platform/z1/README.z1sp deleted file mode 100644 index 8db1e48da..000000000 --- a/arch/platform/z1/README.z1sp +++ /dev/null @@ -1,9 +0,0 @@ -Using the Z1 starter platform (Z1SP) -============================================ - -To enable the Z1SP components, you should include in your application Makefile -the ZOLERTIA_Z1SP flag set to 1, see "examples/z1/Makefile". - -For Z1SP specific information please go to: - -http://zolertia.sourceforge.net/wiki/index.php/Mainpage:z1sp diff --git a/arch/platform/z1/apps/burn-nodeid.c b/arch/platform/z1/apps/burn-nodeid.c deleted file mode 100644 index 0f469cac4..000000000 --- a/arch/platform/z1/apps/burn-nodeid.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A program for burning a node ID into the flash ROM of a Tmote Sky node. - * \author - * Adam Dunkels - */ - -#include "dev/leds.h" -#include "dev/watchdog.h" -#include "sys/node-id.h" -#include "contiki.h" -#include "sys/etimer.h" - -#include "node-id-z1.h" - -#include - -static struct etimer etimer; - -PROCESS(burn_process, "Burn node id"); -AUTOSTART_PROCESSES(&burn_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(burn_process, ev, data) -{ - PROCESS_BEGIN(); - - etimer_set(&etimer, 5*CLOCK_SECOND); - PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); - - watchdog_stop(); - leds_on(LEDS_RED); -#if NODEID - #warning "***** BURNING NODE ID" - printf("Burning node id %d\n", NODEID); - node_id_burn(NODEID); - leds_on(LEDS_BLUE); - node_id_restore(); - printf("Restored node id %d\n", node_id); -#else -#error "burn-nodeid must be compiled with nodeid=" - node_id_restore(); - printf("Restored node id %d\n", node_id); -#endif - leds_off(LEDS_RED + LEDS_BLUE); - watchdog_start(); - while(1) { - PROCESS_WAIT_EVENT(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/z1/cfs-coffee-arch.h b/arch/platform/z1/cfs-coffee-arch.h deleted file mode 100644 index 3225e2f32..000000000 --- a/arch/platform/z1/cfs-coffee-arch.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Coffee architecture-dependent header for the Zolertia Z1 platform. - * \author - * Nicolas Tsiftes - * Enric M. Calvo - */ - -#ifndef CFS_COFFEE_ARCH_H -#define CFS_COFFEE_ARCH_H - -#include "contiki-conf.h" -#include "dev/xmem.h" - -/*** M25P16 Memory Organization -The memory is organized as: -16Mbit = 2 097 152 bytes (8 bits each) -32 sectors (512 Kbits, 65536 bytes each) -8192 pages (256 bytes each). -Each page can be individually programmed (bits are programmed from 1 to 0). The device is -sector or bulk erasable (bits are erased from 0 to 1) but not page erasable -*/ - -/* Total size of the External Flash Memory in the Z1 */ -#define COFFEE_XMEM_TOTAL_SIZE_KB 2048UL - -/* Coffee configuration parameters. */ -#define COFFEE_SECTOR_SIZE 65536UL -#define COFFEE_PAGE_SIZE 256UL -#define COFFEE_START COFFEE_SECTOR_SIZE -#define COFFEE_SIZE (COFFEE_XMEM_TOTAL_SIZE_KB * 1024UL - COFFEE_START) -#define COFFEE_NAME_LENGTH 16 -#define COFFEE_MAX_OPEN_FILES 6 -#define COFFEE_FD_SET_SIZE 8 -#define COFFEE_LOG_TABLE_LIMIT 256 -#define COFFEE_DYN_SIZE 4*1024 -#define COFFEE_LOG_SIZE 1024 - -#define COFFEE_MICRO_LOGS 1 - -/* Flash operations. */ -#define COFFEE_WRITE(buf, size, offset) \ - xmem_pwrite((char *)(buf), (size), COFFEE_START + (offset)) - -#define COFFEE_READ(buf, size, offset) \ - xmem_pread((char *)(buf), (size), COFFEE_START + (offset)) - -#define COFFEE_ERASE(sector) \ - xmem_erase(COFFEE_SECTOR_SIZE, COFFEE_START + (sector) * COFFEE_SECTOR_SIZE) - -/* Coffee types. */ -typedef int16_t coffee_page_t; - -#endif /* !CFS_COFFEE_ARCH_H */ diff --git a/arch/platform/z1/contiki-conf.h b/arch/platform/z1/contiki-conf.h deleted file mode 100644 index e31a9fbcd..000000000 --- a/arch/platform/z1/contiki-conf.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef CONTIKI_CONF_H -#define CONTIKI_CONF_H - -/* include the project config */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif /* PROJECT_CONF_PATH */ -/*---------------------------------------------------------------------------*/ -#include "z1-def.h" -#include "msp430-def.h" -/*---------------------------------------------------------------------------*/ - -/* Configure radio driver */ -#ifndef NETSTACK_CONF_RADIO -#define NETSTACK_CONF_RADIO cc2420_driver -#endif /* NETSTACK_CONF_RADIO */ - -/* Symbol for the TSCH 15ms timeslot timing template */ -#define TSCH_CONF_ARCH_HDR_PATH "dev/cc2420/cc2420-tsch-15ms.h" - -/* The TSCH default slot length of 10ms is a bit too short for this platform, - * use 15ms instead. */ -#ifndef TSCH_CONF_DEFAULT_TIMESLOT_TIMING -#define TSCH_CONF_DEFAULT_TIMESLOT_TIMING tsch_timeslot_timing_us_15000 -#endif /* TSCH_CONF_DEFAULT_TIMESLOT_TIMING */ - -/* Save RAM through a smaller uIP buffer */ -#ifndef UIP_CONF_BUFFER_SIZE -#define UIP_CONF_BUFFER_SIZE 140 -#endif - -#define PROCESS_CONF_NUMEVENTS 8 -#define PROCESS_CONF_STATS 1 -/*#define PROCESS_CONF_FASTPOLL 4*/ - -/* So far, printfs without interrupt. */ -#define UART0_CONF_TX_WITH_INTERRUPT 0 -/* This does not work in Cooja. */ -#define UART0_CONF_RX_WITH_DMA 0 - -/* Handle 10 neighbors */ -#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS -#define NBR_TABLE_CONF_MAX_NEIGHBORS 10 -#endif - -/* Handle 10 routes */ -#ifndef NETSTACK_MAX_ROUTE_ENTRIES -#define NETSTACK_MAX_ROUTE_ENTRIES 10 -#endif - -/* Handle 10 links */ -#ifndef TSCH_SCHEDULE_CONF_MAX_LINKS -#define TSCH_SCHEDULE_CONF_MAX_LINKS 10 -#endif - -#ifndef TSCH_CONF_MAX_INCOMING_PACKETS -#define TSCH_CONF_MAX_INCOMING_PACKETS 2 -#endif - -#ifndef TSCH_QUEUE_CONF_NUM_PER_NEIGHBOR -#define TSCH_QUEUE_CONF_NUM_PER_NEIGHBOR 4 -#endif - -/* Platform-specific (H/W) AES implementation */ -#ifndef AES_128_CONF -#define AES_128_CONF cc2420_aes_128_driver -#endif /* AES_128_CONF */ - -/*---------------------------------------------------------------------------*/ -#include "msp430-conf.h" -/*---------------------------------------------------------------------------*/ -#endif /* CONTIKI_CONF_H */ diff --git a/arch/platform/z1/contiki-z1-platform.c b/arch/platform/z1/contiki-z1-platform.c deleted file mode 100644 index 60272bb00..000000000 --- a/arch/platform/z1/contiki-z1-platform.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2011, Zolertia(TM) is a trademark of Advancare,SL - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * Author: Enric M. Calvo based on previous work by - * Niclas Finne , Joakim Eriksson - * - */ - -#include "dev/button-sensor.h" - -void -init_platform(void) -{ - process_start(&sensors_process, NULL); -} diff --git a/arch/platform/z1/dev/adxl345.c b/arch/platform/z1/dev/adxl345.c deleted file mode 100644 index 08e170432..000000000 --- a/arch/platform/z1/dev/adxl345.c +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \file - * Device drivers for adxl345 accelerometer in Zolertia Z1. - * \author - * Marcus Lundén, SICS - * Enric M. Calvo, Zolertia - * Antonio Lignan, Zolertia - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "adxl345.h" -#include "cc2420.h" -#include "i2cmaster.h" -#include "isr_compat.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -/*---------------------------------------------------------------------------*/ -/* Callback pointers when interrupt occurs */ -void (*accm_int1_cb)(uint8_t reg); -void (*accm_int2_cb)(uint8_t reg); -/*---------------------------------------------------------------------------*/ -/* Bitmasks for the interrupts */ -static uint16_t int1_mask = 0, int2_mask = 0; - -/* Default values for adxl345 at startup. - * This will be sent to the adxl345 in a - * stream at init to set it up in a default state - */ - -static uint8_t adxl345_default_settings[] = { - /* Note, as the two first two bulks are to be written in a stream, they contain - * the register address as first byte in that section. - * 0--14 are in one stream, start at ADXL345_THRESH_TAP - */ - /* XXX NB Register address, not register value!! */ - ADXL345_THRESH_TAP, - ADXL345_THRESH_TAP_DEFAULT, - ADXL345_OFSX_DEFAULT, - ADXL345_OFSY_DEFAULT, - ADXL345_OFSZ_DEFAULT, - ADXL345_DUR_DEFAULT, - ADXL345_LATENT_DEFAULT, - ADXL345_WINDOW_DEFAULT, - ADXL345_THRESH_ACT_DEFAULT, - ADXL345_THRESH_INACT_DEFAULT, - ADXL345_TIME_INACT_DEFAULT, - ADXL345_ACT_INACT_CTL_DEFAULT, - ADXL345_THRESH_FF_DEFAULT, - ADXL345_TIME_FF_DEFAULT, - ADXL345_TAP_AXES_DEFAULT, - - /* 15--19 start at ADXL345_BW_RATE */ - /* XXX NB Register address, not register value!! */ - ADXL345_BW_RATE, - ADXL345_BW_RATE_DEFAULT, - ADXL345_POWER_CTL_DEFAULT, - ADXL345_INT_ENABLE_DEFAULT, - ADXL345_INT_MAP_DEFAULT, - - /* These two: 20, 21 write separately */ - ADXL345_DATA_FORMAT_DEFAULT, - ADXL345_FIFO_CTL_DEFAULT -}; -/*---------------------------------------------------------------------------*/ -PROCESS(accmeter_process, "Accelerometer process"); -/*---------------------------------------------------------------------------*/ -static void -accm_write_reg(uint8_t reg, uint8_t val) -{ - uint8_t tx_buf[] = {reg, val}; - - i2c_transmitinit(ADXL345_ADDR); - while (i2c_busy()); - PRINTF("ADXL345: I2C Ready to TX\n"); - - i2c_transmit_n(2, tx_buf); - while (i2c_busy()); - PRINTF("ADXL345: WRITE_REG 0x%02X @ reg 0x%02X\n", val, reg); -} -/*---------------------------------------------------------------------------*/ -/* First byte in stream must be the register address to begin writing to. - * The data is then written from second byte and increasing. - */ -static void -accm_write_stream(uint8_t len, uint8_t *data) -{ - i2c_transmitinit(ADXL345_ADDR); - while (i2c_busy()); - PRINTF("ADXL345: I2C Ready to TX(stream)\n"); - - i2c_transmit_n(len, data); // start tx and send conf reg - while (i2c_busy()); - PRINTF("ADXL345: WRITE_STR %u B to 0x%02X\n", len, data[0]); -} - -/*---------------------------------------------------------------------------*/ -static uint8_t -accm_read_reg(uint8_t reg) -{ - uint8_t retVal = 0; - uint8_t rtx = reg; - PRINTF("ADXL345: READ_REG 0x%02X\n", reg); - - /* transmit the register to read */ - i2c_transmitinit(ADXL345_ADDR); - while (i2c_busy()); - i2c_transmit_n(1, &rtx); - while (i2c_busy()); - - /* receive the data */ - i2c_receiveinit(ADXL345_ADDR); - while (i2c_busy()); - i2c_receive_n(1, &retVal); - while (i2c_busy()); - - return retVal; -} -/*---------------------------------------------------------------------------*/ -static void -accm_read_stream(uint8_t reg, uint8_t len, uint8_t *whereto) -{ - uint8_t rtx = reg; - PRINTF("ADXL345: READ_STR %u B from 0x%02X\n", len, reg); - - /* transmit the register to start reading from */ - i2c_transmitinit(ADXL345_ADDR); - while (i2c_busy()); - i2c_transmit_n(1, &rtx); - while (i2c_busy()); - - /* receive the data */ - i2c_receiveinit(ADXL345_ADDR); - while (i2c_busy()); - i2c_receive_n(len, whereto); - while (i2c_busy()); -} - -/*---------------------------------------------------------------------------*/ -/* Read an axis of the accelerometer (x, y or z). Return value is a signed - * 10 bit int. - * The resolution of the acceleration measurement can be increased up to 13 bit, - * but will change the data format of this read out. Refer to the data sheet if - * so is wanted/needed. - */ -int16_t -accm_read_axis(enum ADXL345_AXIS axis) -{ - int16_t rd = 0; - uint8_t tmp[2]; - if(axis > Z_AXIS){ - return 0; - } - accm_read_stream(ADXL345_DATAX0 + axis, 2, &tmp[0]); - rd = (int16_t)(tmp[0] | (tmp[1]<<8)); - return rd; -} -/*---------------------------------------------------------------------------*/ -int -accm_set_grange(uint8_t grange) -{ - uint8_t tempreg = 0; - - if(grange > ADXL345_RANGE_16G) { - PRINTF("ADXL345: grange invalid: %u\n", grange); - return ADXL345_ERROR; - } - - if(!enabled) { - return ADXL345_ERROR; - } - - /* Keep the previous contents of the register, zero out the last two bits */ - tempreg = (accm_read_reg(ADXL345_DATA_FORMAT) & 0xFC); - tempreg |= grange; - accm_write_reg(ADXL345_DATA_FORMAT, tempreg); - return ADXL345_SUCCESS; -} - -/*---------------------------------------------------------------------------*/ -void -accm_init(void) -{ - PRINTF("ADXL345: init\n"); - accm_int1_cb = NULL; - accm_int2_cb = NULL; - - /* Set up ports and pins for interrups. */ - ADXL345_DIR &=~ (ADXL345_INT1_PIN | ADXL345_INT2_PIN); - ADXL345_SEL &=~ (ADXL345_INT1_PIN | ADXL345_INT2_PIN); - ADXL345_SEL2 &=~ (ADXL345_INT1_PIN | ADXL345_INT2_PIN); - - /* Set up ports and pins for I2C communication */ - i2c_enable(); - - /* set default register values. */ - accm_write_stream(15, &adxl345_default_settings[0]); - accm_write_stream(5, &adxl345_default_settings[15]); - accm_write_reg(ADXL345_DATA_FORMAT, adxl345_default_settings[20]); - accm_write_reg(ADXL345_FIFO_CTL, adxl345_default_settings[21]); - - process_start(&accmeter_process, NULL); - - /* Enable msp430 interrupts on the two interrupt pins. */ - dint(); - /* low to high transition interrupts */ - ADXL345_IES &=~ (ADXL345_INT1_PIN | ADXL345_INT2_PIN); - /* enable interrupts */ - ADXL345_IE |= (ADXL345_INT1_PIN | ADXL345_INT2_PIN); - eint(); - - enabled = 1; -} -/*---------------------------------------------------------------------------*/ -void -accm_stop(void) -{ - dint(); - ADXL345_IE &= ~(ADXL345_INT1_PIN | ADXL345_INT2_PIN); - accm_write_reg(ADXL345_INT_ENABLE, ~(int1_mask | int2_mask)); - accm_write_reg(ADXL345_INT_MAP, ~int2_mask); - eint(); - enabled = 0; -} -/*---------------------------------------------------------------------------*/ -int -accm_set_irq(uint8_t int1, uint8_t int2) -{ - if(!enabled) { - return ADXL345_ERROR; - } - - /* Set the corresponding interrupt mapping to INT1 or INT2 */ - PRINTF("ADXL345: IRQs set to INT1: 0x%02X IRQ2: 0x%02X\n", int1, int2); - - int1_mask = int1; - int2_mask = int2; - - accm_write_reg(ADXL345_INT_ENABLE, (int1 | int2)); - /* int1 bits are zeroes in the map register so this is for both ints */ - accm_write_reg(ADXL345_INT_MAP, int2); - return ADXL345_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -/* Invoked after an interrupt happened. Reads the interrupt source reg at the - * accelerometer, which resets the interrupts, and invokes the corresponding - * callback. It passes the source register value so the callback can determine - * what interrupt happened, if several interrupts are mapped to the same pin. - */ -static void -poll_handler(void) -{ - uint8_t ireg = 0; - ireg = accm_read_reg(ADXL345_INT_SOURCE); - - /* Invoke callbacks for the corresponding interrupts */ - if(ireg & int1_mask){ - if(accm_int1_cb != NULL){ - PRINTF("ADXL345: INT1 cb invoked\n"); - accm_int1_cb(ireg); - } - } else if(ireg & int2_mask){ - if(accm_int2_cb != NULL){ - PRINTF("ADXL345: INT2 cb invoked\n"); - accm_int2_cb(ireg); - } - } -} -/*---------------------------------------------------------------------------*/ -/* This process is sleeping until an interrupt from the accelerometer occurs, - * which polls this process from the interrupt service routine. */ -PROCESS_THREAD(accmeter_process, ev, data) -{ - PROCESS_POLLHANDLER(poll_handler()); - PROCESS_EXITHANDLER(); - PROCESS_BEGIN(); - while(1){ - PROCESS_WAIT_EVENT_UNTIL(0); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/* This interrupt vector is shared with the interrupts from CC2420, so that - * was moved here - */ -static struct timer suppressTimer1, suppressTimer2; - -ISR(PORT1, port1_isr) -{ - /* ADXL345_IFG.x goes high when interrupt occurs, use to check what - * interrupted - */ - if((ADXL345_IFG & ADXL345_INT1_PIN) && !(ADXL345_IFG & BV(CC2420_FIFOP_PIN))){ - /* Check if this should be suppressed or not */ - if(timer_expired(&suppressTimer1)) { - timer_set(&suppressTimer1, SUPPRESS_TIME_INT1); - ADXL345_IFG &= ~ADXL345_INT1_PIN; // clear interrupt flag - process_poll(&accmeter_process); - LPM4_EXIT; - } - } else if((ADXL345_IFG & ADXL345_INT2_PIN) && - !(ADXL345_IFG & BV(CC2420_FIFOP_PIN))){ - /* Check if this should be suppressed or not */ - if(timer_expired(&suppressTimer2)) { - timer_set(&suppressTimer2, SUPPRESS_TIME_INT2); - /* clear interrupt flag */ - ADXL345_IFG &= ~ADXL345_INT2_PIN; - process_poll(&accmeter_process); - LPM4_EXIT; - } - } else { - /* CC2420 interrupt */ - if(cc2420_interrupt()) { - LPM4_EXIT; - } - } -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type != SENSORS_ACTIVE) { - return ADXL345_ERROR; - } - - if(value) { - accm_init(); - } else { - accm_stop(); - } - enabled = value; - return ADXL345_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - } - return ADXL345_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - if(!enabled) { - return ADXL345_ERROR; - } - - if((type != X_AXIS) && (type != Y_AXIS) && (type != Z_AXIS)) { - return ADXL345_ERROR; - } - - switch(type) { - case X_AXIS: - return accm_read_axis(X_AXIS); - case Y_AXIS: - return accm_read_axis(Y_AXIS); - case Z_AXIS: - return accm_read_axis(Z_AXIS); - default: - return ADXL345_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(adxl345, ADXL345_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/z1/dev/adxl345.h b/arch/platform/z1/dev/adxl345.h deleted file mode 100644 index a8d4789d8..000000000 --- a/arch/platform/z1/dev/adxl345.h +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \file - * Device drivers header file for adxl345 accelerometer in Zolertia Z1. - * \author - * Marcus Lundén, SICS - * Enric Calvo, Zolertia - * Antonio Lignan, Zolertia - */ -/*---------------------------------------------------------------------------*/ -#ifndef ADXL345_H_ -#define ADXL345_H_ -#include -#include "dev/i2cmaster.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -/* Used in accm_read_axis(), eg accm_read_axis(X_AXIS) */ -enum ADXL345_AXIS { - X_AXIS = 0, - Y_AXIS = 2, - Z_AXIS = 4, -}; -/* -------------------------------------------------------------------------- */ -/* Init the accelerometer: ports, pins, registers, interrupts (none enabled), - * I2C, default threshold values etc. - */ -void accm_init(void); - -/* Read an axis of the accelerometer (x, y or z). Return value is a signed 10 - * bit int. - * The resolution of the acceleration measurement can be increased up to 13 bit, - * but will change the data format of this read out. Refer to the data sheet if - * so is wanted/needed. - */ -int16_t accm_read_axis(enum ADXL345_AXIS axis); - -/* Sets the g-range, ie the range the accelerometer measures (ie 2g means -2 to - * +2 g on every axis). Possible values: - * - ADXL345_RANGE_2G - * - ADXL345_RANGE_4G - * - ADXL345_RANGE_8G - * - ADXL345_RANGE_16G - */ -int accm_set_grange(uint8_t grange); - -/* Map interrupt (FF, tap, dbltap etc) to interrupt pin (IRQ_INT1, IRQ_INT2). - * This must come after accm_init() as the registers will otherwise be - * overwritten. - */ -int accm_set_irq(uint8_t int1, uint8_t int2); - -/* Macros for setting the pointers to callback functions from the interrupts. - * The function will be called with an uint8_t as parameter, containing the - * interrupt flag register from the ADXL345. That way, several interrupts can be - * mapped to the same pin and be read - */ -#define ACCM_REGISTER_INT1_CB(ptr) accm_int1_cb = ptr; -#define ACCM_REGISTER_INT2_CB(ptr) accm_int2_cb = ptr; -/* -------------------------------------------------------------------------- */ -/* Application definitions, change if required by application. */ - -/* Time after an interrupt that subsequent interrupts are suppressed. Should - * later be turned into one specific time per type of interrupt (tap, freefall. - * etc) - */ -#define SUPPRESS_TIME_INT1 CLOCK_SECOND/4 -#define SUPPRESS_TIME_INT2 CLOCK_SECOND/4 - -/* Suggested defaults according to the data sheet etc */ -#define ADXL345_THRESH_TAP_DEFAULT 0x48 /* 4.5g (0x30 == 3.0g) */ -#define ADXL345_OFSX_DEFAULT 0x00 /* for calibration only */ -#define ADXL345_OFSY_DEFAULT 0x00 -#define ADXL345_OFSZ_DEFAULT 0x00 -#define ADXL345_DUR_DEFAULT 0x20 /* 20 ms (datasheet: 10ms++) */ -#define ADXL345_LATENT_DEFAULT 0x50 /* 100 ms (datasheet: 20ms++) */ -#define ADXL345_WINDOW_DEFAULT 0xFF /* 320 ms (datasheet: 80ms++) */ -#define ADXL345_THRESH_ACT_DEFAULT 0x15 /* 1.3g (62.5 mg/LSB) */ -#define ADXL345_THRESH_INACT_DEFAULT 0x08 /* 0.5g (62.5 mg/LSB) */ -#define ADXL345_TIME_INACT_DEFAULT 0x02 /* 2 s (1 s/LSB) */ -#define ADXL345_ACT_INACT_CTL_DEFAULT 0xFF /* all axis, ac-coupled */ -#define ADXL345_THRESH_FF_DEFAULT 0x09 /* 563 mg */ -#define ADXL345_TIME_FF_DEFAULT 0x20 /* 60 ms */ -#define ADXL345_TAP_AXES_DEFAULT 0x07 /* all axis, no suppression */ - -#define ADXL345_BW_RATE_DEFAULT (0x00 | ADXL345_SRATE_100) /* 100 Hz */ -/* link bit set, no autosleep, start normal measuring */ -#define ADXL345_POWER_CTL_DEFAULT 0x28 -#define ADXL345_INT_ENABLE_DEFAULT 0x00 /* no interrupts enabled */ -#define ADXL345_INT_MAP_DEFAULT 0x00 /* all mapped to int_1 */ - -/* XXX NB: In the data format register, data format of axis readings is chosen - * between left or right justify. This affects the position of the MSB/LSB and is - * different depending on g-range and resolution. If changed, make sure this is - * reflected in the _read_axis() function. Also, the resolution can be increased - * from 10 bit to at most 13 bit, but this also changes position of MSB etc on data - * format so check this in read_axis() too. - */ -/* right-justify, 2g, 10-bit mode, int is active high */ -#define ADXL345_DATA_FORMAT_DEFAULT (0x00 | ADXL345_RANGE_2G) -#define ADXL345_FIFO_CTL_DEFAULT 0x00 /* FIFO bypass mode */ - -/* -------------------------------------------------------------------------- */ -/* Reference definitions, should not be changed */ -/* adxl345 slave address */ -#define ADXL345_ADDR 0x53 - -/* ADXL345 registers */ -#define ADXL345_DEVID 0x00 -/* registers 0x01 to 0x1C are reserved, do not access */ -#define ADXL345_THRESH_TAP 0x1D -#define ADXL345_OFSX 0x1E -#define ADXL345_OFSY 0x1F -#define ADXL345_OFSZ 0x20 -#define ADXL345_DUR 0x21 -#define ADXL345_LATENT 0x22 -#define ADXL345_WINDOW 0x23 -#define ADXL345_THRESH_ACT 0x24 -#define ADXL345_THRESH_INACT 0x25 -#define ADXL345_TIME_INACT 0x26 -#define ADXL345_ACT_INACT_CTL 0x27 -#define ADXL345_THRESH_FF 0x28 -#define ADXL345_TIME_FF 0x29 -#define ADXL345_TAP_AXES 0x2A -#define ADXL345_ACT_TAP_STATUS 0x2B -#define ADXL345_BW_RATE 0x2C -#define ADXL345_POWER_CTL 0x2D -#define ADXL345_INT_ENABLE 0x2E -#define ADXL345_INT_MAP 0x2F -#define ADXL345_INT_SOURCE 0x30 -#define ADXL345_DATA_FORMAT 0x31 -#define ADXL345_DATAX0 0x32 /* read only, LSByte X, two's complement */ -#define ADXL345_DATAX1 0x33 /* read only, MSByte X */ -#define ADXL345_DATAY0 0x34 /* read only, LSByte Y */ -#define ADXL345_DATAY1 0x35 /* read only, MSByte X */ -#define ADXL345_DATAZ0 0x36 /* read only, LSByte Z */ -#define ADXL345_DATAZ1 0x37 /* read only, MSByte X */ -#define ADXL345_FIFO_CTL 0x38 -#define ADXL345_FIFO_STATUS 0x39 /* read only */ - -/* ADXL345 interrupts */ -#define ADXL345_INT_DISABLE 0X00 /* used for disabling interrupts */ -#define ADXL345_INT_OVERRUN 0X01 -#define ADXL345_INT_WATERMARK 0X02 -#define ADXL345_INT_FREEFALL 0X04 -#define ADXL345_INT_INACTIVITY 0X08 -#define ADXL345_INT_ACTIVITY 0X10 -#define ADXL345_INT_DOUBLETAP 0X20 -#define ADXL345_INT_TAP 0X40 -#define ADXL345_INT_DATAREADY 0X80 - -/* Accelerometer hardware ports, pins and registers on the msp430 µC */ -#define ADXL345_DIR P1DIR -#define ADXL345_PIN P1PIN -#define ADXL345_REN P1REN -#define ADXL345_SEL P1SEL -#define ADXL345_SEL2 P1SEL2 -#define ADXL345_INT1_PIN (1<<6) /* P1.6 */ -#define ADXL345_INT2_PIN (1<<7) /* P1.7 */ -#define ADXL345_IES P1IES -#define ADXL345_IE P1IE -#define ADXL345_IFG P1IFG -#define ADXL345_VECTOR PORT1_VECTOR - -/* g-range for DATA_FORMAT register */ -#define ADXL345_RANGE_2G 0x00 -#define ADXL345_RANGE_4G 0x01 -#define ADXL345_RANGE_8G 0x02 -#define ADXL345_RANGE_16G 0x03 - - -/* The adxl345 has programmable sample rates, but unexpected results may occur - * if the wrong rate and I2C bus speed is used (see datasheet p 17). Sample - * rates in Hz. This setting does not change the internal sampling rate, just - * how often it is piped to the output registers (ie the interrupt features use - * the full sample rate internally). - * Example use: - * adxl345_set_reg(ADXL345_BW_RATE, ((_ADXL345_STATUS & LOW_POWER) - * | ADXL345_SRATE_50)); - */ - -/* XXX NB don't use at all as I2C data rate<= 400kHz */ -#define ADXL345_SRATE_3200 0x0F -/* XXX NB don't use at all as I2C data rate<= 400kHz */ -#define ADXL345_SRATE_1600 0x0E -#define ADXL345_SRATE_800 0x0D /* when I2C data rate == 400 kHz */ -#define ADXL345_SRATE_400 0x0C /* when I2C data rate == 400 kHz */ -#define ADXL345_SRATE_200 0x0B /* when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_100 0x0A /* when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_50 0x09 /* when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_25 0x08 /* when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_12_5 0x07 /* 12.5 Hz, when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_6_25 0x06 /* when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_3_13 0x05 /* when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_1_56 0x04 /* when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_0_78 0x03 /* when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_0_39 0x02 /* when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_0_20 0x01 /* when I2C data rate >= 100 kHz */ -#define ADXL345_SRATE_0_10 0x00 /* 0.10 Hz, when I2C data rate >= 100 kHz */ -/* -------------------------------------------------------------------------- */ -/* Callback pointers for the interrupts */ -extern void (*accm_int1_cb)(uint8_t reg); -extern void (*accm_int2_cb)(uint8_t reg); -/* -------------------------------------------------------------------------- */ -#define ACCM_INT1 0x01 -#define ACCM_INT2 0x02 -#define ADXL345_SUCCESS 0x00 -#define ADXL345_ERROR (-1) -/* -------------------------------------------------------------------------- */ -#define ADXL345_SENSOR "ADXL345 sensor" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor adxl345; -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ -#endif /* ifndef ADXL345_H_ */ diff --git a/arch/platform/z1/dev/battery-sensor.c b/arch/platform/z1/dev/battery-sensor.c deleted file mode 100644 index dd787ccae..000000000 --- a/arch/platform/z1/dev/battery-sensor.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2010/08/25 19:30:52 $ - * $Revision: 1.11 $ - */ -#include "contiki.h" -#include "dev/battery-sensor.h" -#include "dev/sky-sensors.h" - -/* Configure ADC12_2 to sample channel 11 (voltage) and use */ -/* the Vref+ as reference (SREF_1) since it is a stable reference */ -#define INPUT_CHANNEL (1 << INCH_11) -#define INPUT_REFERENCE SREF_1 -#define BATTERY_MEM ADC12MEM11 - -const struct sensors_sensor battery_sensor; -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return BATTERY_MEM; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(battery_sensor, BATTERY_SENSOR, value, configure, status); diff --git a/arch/platform/z1/dev/button-sensor.c b/arch/platform/z1/dev/button-sensor.c deleted file mode 100644 index 58479bf3b..000000000 --- a/arch/platform/z1/dev/button-sensor.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/hwconf.h" -#include "dev/button-sensor.h" -#include "isr_compat.h" - -const struct sensors_sensor button_sensor; - -static struct timer debouncetimer; -static int status(int type); - -HWCONF_PIN(BUTTON, 2, 5); -HWCONF_IRQ(BUTTON, 2, 5); - -/*---------------------------------------------------------------------------*/ -ISR(PORT2, irq_p2) -{ - if(BUTTON_CHECK_IRQ()) { - if(timer_expired(&debouncetimer)) { - timer_set(&debouncetimer, CLOCK_SECOND / 4); - sensors_changed(&button_sensor); - LPM4_EXIT; - } - } - P2IFG = 0x00; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return BUTTON_READ() || !timer_expired(&debouncetimer); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - switch (type) { - case SENSORS_ACTIVE: - if (c) { - if(!status(SENSORS_ACTIVE)) { - timer_set(&debouncetimer, 0); - BUTTON_IRQ_EDGE_SELECTD(); - - BUTTON_SELECT(); - BUTTON_MAKE_INPUT(); - - BUTTON_ENABLE_IRQ(); - } - } else { - BUTTON_DISABLE_IRQ(); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch (type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return BUTTON_IRQ_ENABLED(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, - value, configure, status); diff --git a/arch/platform/z1/dev/cc2420-arch.c b/arch/platform/z1/dev/cc2420-arch.c deleted file mode 100644 index 394c5c569..000000000 --- a/arch/platform/z1/dev/cc2420-arch.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "contiki-net.h" -#include "dev/spi-legacy.h" -#include "cc2420.h" -#include "isr_compat.h" - -#ifdef CC2420_CONF_SFD_TIMESTAMPS -#define CONF_SFD_TIMESTAMPS CC2420_CONF_SFD_TIMESTAMPS -#endif /* CC2420_CONF_SFD_TIMESTAMPS */ - -#ifndef CONF_SFD_TIMESTAMPS -#define CONF_SFD_TIMESTAMPS 0 -#endif /* CONF_SFD_TIMESTAMPS */ - -#ifdef CONF_SFD_TIMESTAMPS -#include "cc2420-arch-sfd.h" -#endif /* CONF_SFD_TIMESTAMPS */ - -/*---------------------------------------------------------------------------*/ -#if 0 -/* this is now handled in the ADXL345 accelerometer code as it uses irq on port1 too. */ -ISR(CC2420_IRQ, cc24240_port1_interrupt) -{ - if(cc2420_interrupt()) { - LPM4_EXIT; - } -} -#endif -/*---------------------------------------------------------------------------*/ -void -cc2420_arch_init(void) -{ - spi_init(); - - /* all input by default, set these as output */ - CC2420_CSN_PORT(DIR) |= BV(CC2420_CSN_PIN); - CC2420_VREG_PORT(DIR) |= BV(CC2420_VREG_PIN); - CC2420_RESET_PORT(DIR) |= BV(CC2420_RESET_PIN); - -#if CONF_SFD_TIMESTAMPS - cc2420_arch_sfd_init(); -#endif /* CONF_SFD_TIMESTAMPS */ - - CC2420_SPI_DISABLE(); /* Unselect radio. */ -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/z1/dev/i2cmaster.c b/arch/platform/z1/dev/i2cmaster.c deleted file mode 100644 index 59437b904..000000000 --- a/arch/platform/z1/dev/i2cmaster.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * I2C communication device drivers for Zolertia Z1 sensor node. - * \author - * Enric M. Calvo, Zolertia - * Marcus Lundén, SICS - */ - -#include "i2cmaster.h" -#include "isr_compat.h" - -signed char tx_byte_ctr, rx_byte_ctr; -unsigned char rx_buf[2]; -unsigned char *tx_buf_ptr; -unsigned char *rx_buf_ptr; -unsigned char receive_data; -unsigned char transmit_data1; -unsigned char transmit_data2; -unsigned char prescale_lsb = I2C_PRESC_Z1_LSB; -unsigned char prescale_msb = I2C_PRESC_Z1_MSB; -volatile unsigned int i; /* volatile to prevent optimization */ - -/* ------------------------------------------------------------------------------ - * Change the data rate prior initializing transmission or reception - * ----------------------------------------------------------------------------- */ -void -i2c_setrate(uint8_t p_lsb, uint8_t p_msb) -{ - prescale_lsb = p_lsb; - prescale_lsb = p_msb; -} -/* ------------------------------------------------------------------------------ - * This function initializes the USCI module for master-receive operation. - * ----------------------------------------------------------------------------- */ -void -i2c_receiveinit(uint8_t slave_address) -{ - UCB1CTL1 = UCSWRST; /* Enable SW reset */ - UCB1CTL0 = UCMST + UCMODE_3 + UCSYNC; /* I2C Master, synchronous mode */ - UCB1CTL1 = UCSSEL_2 | UCSWRST; /* Use SMCLK, keep SW reset */ - UCB1BR0 = prescale_lsb; /* prescaler (default 400 kHz) */ - UCB1BR1 = prescale_msb; - UCB1I2CSA = slave_address; /* set slave address */ - UCB1CTL1 &= ~UCTR; /* I2C Receiver */ - UCB1CTL1 &= ~UCSWRST; /* Clear SW reset, resume operation */ - UCB1I2CIE = UCNACKIE; -#if I2C_RX_WITH_INTERRUPT - UC1IE = UCB1RXIE; /* Enable RX interrupt if desired */ -#endif -} -/* ------------------------------------------------------------------------------ - * Initializes USCI for master-transmit operation. - * ------------------------------------------------------------------------------ */ -void -i2c_transmitinit(uint8_t slave_address) -{ - UCB1CTL1 |= UCSWRST; /* Enable SW reset */ - UCB1CTL0 |= (UCMST | UCMODE_3 | UCSYNC); /* I2C Master, synchronous mode */ - UCB1CTL1 = UCSSEL_2 + UCSWRST; /* Use SMCLK, keep SW reset */ - UCB1BR0 = prescale_lsb; /* prescaler (default 400 kHz) */ - UCB1BR1 = prescale_msb; - UCB1I2CSA = slave_address; /* Set slave address */ - UCB1CTL1 &= ~UCSWRST; /* Clear SW reset, resume operation */ - UCB1I2CIE = UCNACKIE; - UC1IE = UCB1TXIE; /* Enable TX ready interrupt */ -} -/* ------------------------------------------------------------------------------ - * This function is used to start an I2C communication in master-receiver mode WITHOUT INTERRUPTS - * for more than 1 byte - * ------------------------------------------------------------------------------ */ -static volatile uint8_t rx_byte_tot = 0; -uint8_t -i2c_receive_n(uint8_t byte_ctr, uint8_t *rx_buf) -{ - - rx_byte_tot = byte_ctr; - rx_byte_ctr = byte_ctr; - rx_buf_ptr = rx_buf; - - while((UCB1CTL1 & UCTXSTT) || (UCB1STAT & UCNACKIFG)) /* Slave acks address or not? */ - PRINTFDEBUG("____ UCTXSTT not clear OR NACK received\n"); - -#if I2C_RX_WITH_INTERRUPT - PRINTFDEBUG(" RX Interrupts: YES \n"); - - /* SPECIAL-CASE: Stop condition must be sent while receiving the 1st byte for 1-byte only read operations */ - if(rx_byte_tot == 1) { /* See page 537 of slau144e.pdf */ - dint(); - UCB1CTL1 |= UCTXSTT; /* I2C start condition */ - while(UCB1CTL1 & UCTXSTT) /* Waiting for Start bit to clear */ - PRINTFDEBUG("____ STT clear wait\n"); - UCB1CTL1 |= UCTXSTP; /* I2C stop condition */ - eint(); - } else { /* all other cases */ - UCB1CTL1 |= UCTXSTT; /* I2C start condition */ - } - return 0; - -#else - uint8_t n_received = 0; - - PRINTFDEBUG(" RX Interrupts: NO \n"); - - UCB1CTL1 |= UCTXSTT; /* I2C start condition */ - - while(rx_byte_ctr > 0) { - if(UC1IFG & UCB1RXIFG) { /* Waiting for Data */ - rx_buf[rx_byte_tot - rx_byte_ctr] = UCB1RXBUF; - rx_byte_ctr--; - UC1IFG &= ~UCB1RXIFG; /* Clear USCI_B1 RX int flag */ - n_received++; - } - } - UCB1CTL1 |= UCTXSTP; /* I2C stop condition */ - return n_received; -#endif -} -/* ------------------------------------------------------------------------------ - * This function is used to check if there is communication in progress. - * ------------------------------------------------------------------------------ */ -uint8_t -i2c_busy(void) -{ - return UCB1STAT & UCBBUSY; -} -/*---------------------------------------------------------------------------- - * Setup ports and pins for I2C use. - * ------------------------------------------------------------------------------ */ - -void -i2c_enable(void) -{ - I2C_PxSEL |= (I2C_SDA | I2C_SCL); /* Secondary function (USCI) selected */ - I2C_PxSEL2 |= (I2C_SDA | I2C_SCL); /* Secondary function (USCI) selected */ - I2C_PxDIR |= I2C_SCL; /* SCL is output (not needed?) */ - I2C_PxDIR &= ~I2C_SDA; /* SDA is input (not needed?) */ - I2C_PxREN |= (I2C_SDA | I2C_SCL); /* Activate internal pull-up/-down resistors */ - I2C_PxOUT |= (I2C_SDA | I2C_SCL); /* Select pull-up resistors */ -} -void -i2c_disable(void) -{ - I2C_PxSEL &= ~(I2C_SDA | I2C_SCL); /* GPIO function selected */ - I2C_PxSEL2 &= ~(I2C_SDA | I2C_SCL); /* GPIO function selected */ - I2C_PxREN &= ~(I2C_SDA | I2C_SCL); /* Deactivate internal pull-up/-down resistors */ - I2C_PxOUT &= ~(I2C_SDA | I2C_SCL); /* Select pull-up resistors */ -} -/* ------------------------------------------------------------------------------ - * This function is used to start an I2C communication in master-transmit mode. - * ------------------------------------------------------------------------------ */ -static volatile uint8_t tx_byte_tot = 0; -void -i2c_transmit_n(uint8_t byte_ctr, uint8_t *tx_buf) -{ - tx_byte_tot = byte_ctr; - tx_byte_ctr = byte_ctr; - tx_buf_ptr = tx_buf; - UCB1CTL1 |= UCTR + UCTXSTT; /* I2C TX, start condition */ -} -/*----------------------------------------------------------------------------*/ -ISR(USCIAB1TX, i2c_tx_interrupt) -{ - /* TX Part */ - if(UC1IFG & UCB1TXIFG) { /* TX int. condition */ - if(tx_byte_ctr == 0) { - UCB1CTL1 |= UCTXSTP; /* I2C stop condition */ - UC1IFG &= ~UCB1TXIFG; /* Clear USCI_B1 TX int flag */ - } else { - UCB1TXBUF = tx_buf_ptr[tx_byte_tot - tx_byte_ctr]; - tx_byte_ctr--; - } - } - /* RX Part */ -#if I2C_RX_WITH_INTERRUPT - else if(UC1IFG & UCB1RXIFG) { /* RX int. condition */ - rx_buf_ptr[rx_byte_tot - rx_byte_ctr] = UCB1RXBUF; - rx_byte_ctr--; - if(rx_byte_ctr == 1) { /* stop condition should be set before receiving last byte */ - /* Only for 1-byte transmissions, STOP is handled in receive_n_int */ - if(rx_byte_tot != 1) { - UCB1CTL1 |= UCTXSTP; /* I2C stop condition */ - } - UC1IFG &= ~UCB1RXIFG; /* Clear USCI_B1 RX int flag. XXX Just in case, check if necessary */ - } - } -#endif -} - -ISR(USCIAB1RX, i2c_rx_interrupt) -{ - if(UCB1STAT & UCNACKIFG) { - PRINTFDEBUG("!!! NACK received in RX\n"); - UCB1CTL1 |= UCTXSTP; - UCB1STAT &= ~UCNACKIFG; - } -} diff --git a/arch/platform/z1/dev/i2cmaster.h b/arch/platform/z1/dev/i2cmaster.h deleted file mode 100644 index cf9d96e6d..000000000 --- a/arch/platform/z1/dev/i2cmaster.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * I2C communication device driver header file for Zolertia Z1 sensor node. - * \author - * Enric Calvo, Zolertia - * Marcus Lundén, SICS - */ - -#ifndef I2CMASTER_H_ -#define I2CMASTER_H_ - -#include "contiki.h" - -void i2c_enable(void); -void i2c_disable(void); - -void i2c_receiveinit(uint8_t slave_address); -uint8_t i2c_receive_n(uint8_t byte_ctr, uint8_t *rx_buf); - -void i2c_transmitinit(uint8_t slave_address); -void i2c_transmit_n(uint8_t byte_ctr, uint8_t *tx_buf); - -uint8_t i2c_busy(void); -void i2c_setrate(uint8_t p_lsb, uint8_t p_msb); - -#if 0 -#include -#define PRINTFDEBUG(...) printf(__VA_ARGS__) -#else -#define PRINTFDEBUG(...) -#endif - -#endif /* #ifdef I2CMASTER_H_ */ diff --git a/arch/platform/z1/dev/light-sensor.c b/arch/platform/z1/dev/light-sensor.c deleted file mode 100644 index ebc52d4db..000000000 --- a/arch/platform/z1/dev/light-sensor.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2005-2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/sky-sensors.h" -#include "dev/light-sensor.h" -#include "dev/potentiometer-sensor.h" - -/* Photodiode 1 (P64) on INCH_4 */ -/* Photodiode 2 (P65) on INCH_5 */ -/* Enric#define INPUT_CHANNEL ((1 << INCH_4) | (1 << INCH_5)) */ -#ifndef INPUT_CHANNEL -#define INPUT_CHANNEL (1 << INCH_4) -#endif - -#ifndef INPUT_REFERENCE -#define INPUT_REFERENCE SREF_0 -#endif - -#ifdef POTENTIOMETER_MEM -#define PHOTOSYNTHETIC_MEM POTENTIOMETER_MEM -#define TOTAL_SOLAR_MEM POTENTIOMETER_MEM -#else -#define PHOTOSYNTHETIC_MEM ADC12MEM4 -#define TOTAL_SOLAR_MEM ADC12MEM4 -#endif - - -const struct sensors_sensor light_sensor; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - switch(type) { - /* Photosynthetically Active Radiation. */ - case LIGHT_SENSOR_PHOTOSYNTHETIC: - return PHOTOSYNTHETIC_MEM; - - /* Total Solar Radiation. */ - case LIGHT_SENSOR_TOTAL_SOLAR: - return TOTAL_SOLAR_MEM; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(light_sensor, "Light", value, configure, status); diff --git a/arch/platform/z1/dev/light-sensor.h b/arch/platform/z1/dev/light-sensor.h deleted file mode 100644 index 411c6fa33..000000000 --- a/arch/platform/z1/dev/light-sensor.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2010-01-08 - * Updated : $Date: 2010/01/14 20:23:02 $ - * $Revision: 1.2 $ - */ - -#ifndef LIGHT_SENSOR_H_ -#define LIGHT_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor light_sensor; - -#define LIGHT_SENSOR_PHOTOSYNTHETIC 0 -#define LIGHT_SENSOR_TOTAL_SOLAR 1 - - -#endif /* LIGHT-SENSOR_H_ */ diff --git a/arch/platform/z1/dev/light-ziglet.c b/arch/platform/z1/dev/light-ziglet.c deleted file mode 100644 index 3f322e30a..000000000 --- a/arch/platform/z1/dev/light-ziglet.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Device drivers for light ziglet sensor in Zolertia Z1. - * It is recommended to use with a 100KHz data rate - * \author - * Antonio Lignan, Zolertia - * Marcus Lundén, SICS - */ - -#include -#include "contiki.h" -#include "i2cmaster.h" -#include "light-ziglet.h" - -#if 0 -#define PRINTFDEBUG(...) printf(__VA_ARGS__) -#else -#define PRINTFDEBUG(...) -#endif - -/* Bitmasks and bit flag variable for keeping track of tmp102 status. */ -enum TSL2563_STATUSTYPES { - /* must be a bit and not more, not using 0x00. */ - INITED = 0x01, - RUNNING = 0x02, - STOPPED = 0x04, -}; - -static enum TSL2563_STATUSTYPES _TSL2563_STATUS = 0x00; - -uint16_t -calculateLux(uint16_t *buffer) -{ - uint32_t ch0, ch1 = 0; - uint32_t aux = (1 << 14); - uint32_t ratio, lratio, tmp = 0; - - ch0 = (buffer[0] * aux) >> 10; - ch1 = (buffer[1] * aux) >> 10; - - PRINTFDEBUG("B0 %u, B1 %u\n", buffer[0], buffer[1]); - PRINTFDEBUG("ch0 %lu, ch1 %lu\n", ch0, ch1); - - ratio = (ch1 << 10); - ratio = ratio / ch0; - lratio = (ratio + 1) >> 1; - - PRINTFDEBUG("ratio %lu, lratio %lu\n", ratio, lratio); - - if((lratio >= 0) && (lratio <= K1T)) { - tmp = (ch0 * B1T) - (ch1 * M1T); - } else if(lratio <= K2T) { - tmp = (ch0 * B2T) - (ch1 * M2T); - } else if(lratio <= K3T) { - tmp = (ch0 * B3T) - (ch1 * M3T); - } else if(lratio <= K4T) { - tmp = (ch0 * B4T) - (ch1 * M4T); - } else if(lratio <= K5T) { - tmp = (ch0 * B5T) - (ch1 * M5T); - } else if(lratio <= K6T) { - tmp = (ch0 * B6T) - (ch1 * M6T); - } else if(lratio <= K7T) { - tmp = (ch0 * B7T) - (ch1 * M7T); - } else if(lratio > K8T) { - tmp = (ch0 * B8T) - (ch1 * M8T); - } - - if(tmp < 0) { - tmp = 0; - } - - tmp += (1 << 13); - - PRINTFDEBUG("tmp %lu\n", tmp); - - return tmp >> 14; -} -/*---------------------------------------------------------------------------*/ -/* Init the light ziglet sensor: ports, pins, registers, interrupts (none enabled), I2C, - default threshold values etc. */ - -void -light_ziglet_init(void) -{ - if(!(_TSL2563_STATUS & INITED)) { - PRINTFDEBUG("light ziglet init\n"); - _TSL2563_STATUS |= INITED; - - /* Set up ports and pins for I2C communication */ - i2c_enable(); - return; - } -} -/*---------------------------------------------------------------------------*/ -/* Write to a 16-bit register. - args: - reg register to write to - val value to write - */ - -void -tsl2563_write_reg(uint8_t reg, uint16_t val) -{ - uint8_t tx_buf[] = { reg, 0x00, 0x00 }; - - tx_buf[1] = (uint8_t)(val >> 8); - tx_buf[2] = (uint8_t)(val & 0x00FF); - - i2c_transmitinit(TSL2563_ADDR); - while(i2c_busy()); - PRINTFDEBUG("I2C Ready to TX\n"); - - i2c_transmit_n(3, tx_buf); - while(i2c_busy()); - PRINTFDEBUG("WRITE_REG 0x%04X @ reg 0x%02X\n", val, reg); -} -/*---------------------------------------------------------------------------*/ -/* Read register. - args: - reg what register to read - returns the value of the read register type uint16_t - */ - -uint16_t -tsl2563_read_reg(uint8_t reg) -{ - uint16_t readBuf[] = { 0x00, 0x00 }; - uint8_t buf[] = { 0x00, 0x00, 0x00, 0x00 }; - uint16_t retVal = 0; - uint8_t rtx = reg; - - /* Transmit the register to read */ - i2c_transmitinit(TSL2563_ADDR); - while(i2c_busy()); - i2c_transmit_n(1, &rtx); - while(i2c_busy()); - - /* Receive the data */ - i2c_receiveinit(TSL2563_ADDR); - while(i2c_busy()); - i2c_receive_n(4, buf); - while(i2c_busy()); - - PRINTFDEBUG("\nb0 %u, b1 %u, b2 %u, b3 %u\n", buf[0], buf[1], buf[2], buf[3]); - - readBuf[0] = (buf[1] << 8 | (buf[0])); - readBuf[1] = (buf[3] << 8 | (buf[2])); - - retVal = calculateLux(readBuf); - return retVal; -} -uint16_t -light_ziglet_on(void) -{ - uint16_t data; - uint8_t regon = TSL2563_PWRN; - /* Turn on the sensor */ - i2c_transmitinit(TSL2563_ADDR); - while(i2c_busy()); - i2c_transmit_n(1, ®on); - while(i2c_busy()); - data = (uint16_t)tsl2563_read_reg(TSL2563_READ); - return data; -} -void -light_ziglet_off(void) -{ - uint8_t regoff = 0x00; - /* Turn off the sensor */ - i2c_transmitinit(TSL2563_ADDR); - while(i2c_busy()); - i2c_transmit_n(1, ®off); - while(i2c_busy()); - return; -} -/*---------------------------------------------------------------------------*/ -/* Read light ziglet sensor - */ - -uint16_t -light_ziglet_read(void) -{ - uint16_t lux = 0; - lux = light_ziglet_on(); - light_ziglet_off(); - return lux; -} diff --git a/arch/platform/z1/dev/light-ziglet.h b/arch/platform/z1/dev/light-ziglet.h deleted file mode 100644 index 4db18e24e..000000000 --- a/arch/platform/z1/dev/light-ziglet.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Device drivers header file for light ziglet sensor in Zolertia Z1 WSN Platform. - * \author - * Antonio Lignan, Zolertia - * Marcus Lundén, SICS - */ - -#ifndef LIGHT_ZIGLET_H_ -#define LIGHT_ZIGLET_H_ -#include -#include "i2cmaster.h" - -/* Init the light ziglet sensor: ports, pins, I2C, interrupts */ -void light_ziglet_init(void); - -/* Write to a register. - args: - reg register to write to - val value to write - */ -void tsl2563_write_reg(uint8_t reg, uint16_t val); - -/* Read one register. - args: - reg what register to read - returns the value of the read register - */ -uint16_t tsl2563_read_reg(uint8_t reg); - -/* Takes a single light reading - args: none - returns a lux value - */ -uint16_t light_ziglet_read(); - -/* Calculates the lux values from the calibration table - args: raw values from sensor - returns a lux value - */ -uint16_t calculateLux(uint16_t *readRaw); - -/* Turns the light ziglet ON and polls the sensor for a light reading */ -uint16_t light_ziglet_on(void); - -/* -------------------------------------------------------------------------- */ -/* Reference definitions */ - -/* TSL2563 slave address */ -#define TSL2563_ADDR 0x39 - -/* Registers */ -#define TSL2563_READ 0xAC -#define TSL2563_PWRN 0x03 - -/* Calibration settings */ -#define K1T 0X0040 -#define B1T 0x01f2 -#define M1T 0x01b2 - -#define K2T 0x0080 -#define B2T 0x0214 -#define M2T 0x02d1 - -#define K3T 0x00c0 -#define B3T 0x023f -#define M3T 0x037b - -#define K4T 0x0100 -#define B4T 0x0270 -#define M4T 0x03fe - -#define K5T 0x0138 -#define B5T 0x016f -#define M5T 0x01fc - -#define K6T 0x019a -#define B6T 0x00d2 -#define M6T 0x00fb - -#define K7T 0x029a -#define B7T 0x0018 -#define M7T 0x0012 - -#define K8T 0x029a -#define B8T 0x0000 -#define M8T 0x0000 - -/* -------------------------------------------------------------------------- */ -#endif /* ifndef LIGHT_ZIGLET_H_ */ - diff --git a/arch/platform/z1/dev/potentiometer-sensor.c b/arch/platform/z1/dev/potentiometer-sensor.c deleted file mode 100644 index 12597bd0e..000000000 --- a/arch/platform/z1/dev/potentiometer-sensor.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2011 Zolertia(TM) is a trademark by Advancare,SL - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Enric M. Calvo (based on work by A. Dunkels, J. Eriksson, N. Finne) - * Created : 2011-02-22 - * $Revision: 1.0 $ - */ - -#include "dev/potentiometer-sensor.h" -#include "dev/sky-sensors.h" -#include "contiki.h" - -/* Configure ADC12_2 to sample channel 11 (voltage) and use */ -/* the Vref+ as reference (SREF_1) since it is a stable reference */ -#define INPUT_CHANNEL (1 << INCH_4) -#define INPUT_REFERENCE SREF_0 -#define POTENTIOMETER_MEM ADC12MEM4 - -const struct sensors_sensor potentiometer_sensor; -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return POTENTIOMETER_MEM; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(potentiometer_sensor, POTENTIOMETER_SENSOR, value, configure, status); diff --git a/arch/platform/z1/dev/potentiometer-sensor.h b/arch/platform/z1/dev/potentiometer-sensor.h deleted file mode 100644 index d9d8b983d..000000000 --- a/arch/platform/z1/dev/potentiometer-sensor.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2011 Zolertia(TM) is a trademark by Advancare,SL - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Enric M. Calvo (based on work by A. Dunkels, J. Eriksson, N. Finne) - * Created : 2011-02-22 - * $Revision: 1.0 $ - */ - -#ifndef POTENTIOMETER_SENSOR_H_ -#define POTENTIOMETER_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor potentiometer_sensor; - -#define POTENTIOMETER_SENSOR "Potentiometer" - -#endif /* POTENTIOMETER_SENSOR_H_ */ diff --git a/arch/platform/z1/dev/reed-sensor.c b/arch/platform/z1/dev/reed-sensor.c deleted file mode 100644 index 7e7a0df6d..000000000 --- a/arch/platform/z1/dev/reed-sensor.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * Reed sensor driver file - * \author - * Antonio Lignan - */ - -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/reed-sensor.h" -#include "sys/process.h" -#include "sys/ctimer.h" -/*---------------------------------------------------------------------------*/ -#ifndef REED_CHECK_PERIOD -#define REED_CHECK_PERIOD CLOCK_SECOND -#endif -/*---------------------------------------------------------------------------*/ -static int current_status = -1; -static struct ctimer change_timer; -process_event_t reed_sensor_event_changed; -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return ~(REED_PORT_DIR & REED_READ_PIN); - } - return REED_SENSOR_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - if((!status(SENSORS_ACTIVE)) || (type != REED_SENSOR_VAL)) { - return REED_SENSOR_ERROR; - } - return (REED_PORT_READ & REED_READ_PIN) ? REED_CLOSED : REED_OPEN; -} -/*---------------------------------------------------------------------------*/ -static void -check_callback(void *data) -{ - static int new_status; - if(current_status == -1) { - ctimer_stop(&change_timer); - return; - } - - new_status = value(REED_SENSOR_VAL); - if(new_status != current_status) { - current_status = new_status; - process_post(PROCESS_BROADCAST, reed_sensor_event_changed, ¤t_status); - } - ctimer_reset(&change_timer); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - switch(type) { - case SENSORS_ACTIVE: - if(c) { - if(!status(SENSORS_ACTIVE)) { - REED_PORT_SEL |= REED_READ_PIN; - REED_PORT_DIR &= ~REED_READ_PIN; - REED_PORT_REN |= REED_READ_PIN; - REED_PORT_PRES |= REED_READ_PIN; - } - } else { - REED_PORT_DIR |= REED_READ_PIN; - REED_PORT_REN &= ~REED_READ_PIN; - } - return REED_SENSOR_SUCCESS; - case REED_SENSOR_MODE: - if(c == REED_SENSOR_EVENT_MODE) { - current_status = value(REED_SENSOR_VAL); - ctimer_set(&change_timer, REED_CHECK_PERIOD, check_callback, NULL); - } else if(c == REED_SENSOR_EVENT_POLL) { - current_status = -1; - ctimer_stop(&change_timer); - } else { - return REED_SENSOR_ERROR; - } - return REED_SENSOR_SUCCESS; - } - return REED_SENSOR_ERROR; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(reed_sensor, REED_SENSOR, value, configure, status); diff --git a/arch/platform/z1/dev/reed-sensor.h b/arch/platform/z1/dev/reed-sensor.h deleted file mode 100644 index 7e86716f5..000000000 --- a/arch/platform/z1/dev/reed-sensor.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * Header file for the reed sensor - * - * The Reed sensor allows to be used either by polling the sensor status or by - * setting up a timer on the background ticking every REED_CHECK_PERIOD, posting - * a reed_sensor_event_changed event, informing the application about a change - * in the sensor status (basically open or closed). To enable each mode - * (default is polling) call the configure() function with REED_SENSOR_MODE - * using REED_SENSOR_EVENT_MODE or REED_SENSOR_POLL_MODE, after having - * initialized the device using SENSORS_ACTIVATE(reed_sensor). - * - * \file - * Reed sensor header file - * \author - * Antonio Lignan - */ -#include "lib/sensors.h" - -#ifndef REED_SENSOR_H_ -#define REED_SENSOR_H_ -/* -------------------------------------------------------------------------- */ -#define REED_SENSOR_ERROR -1 -#define REED_SENSOR_SUCCESS 0x00 -#define REED_SENSOR_VAL 0x01 -/* -------------------------------------------------------------------------- */ -#define REED_OPEN 0x00 -#define REED_CLOSED 0x01 -/* -------------------------------------------------------------------------- */ -#define REED_SENSOR_MODE 0x01 -#define REED_SENSOR_EVENT_MODE 0x0A -#define REED_SENSOR_EVENT_POLL 0x0B -/* -------------------------------------------------------------------------- */ -#define REED_PORT_DIR P4DIR -#define REED_PORT_SEL P4SEL -#define REED_PORT_REN P4REN -#define REED_PORT_READ P4IN -#define REED_PORT_PRES P4OUT -#define REED_READ_PIN (1 << 2) -/* -------------------------------------------------------------------------- */ -#define REED_SENSOR "Reed Sensor" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor reed_sensor; -extern process_event_t reed_sensor_event_changed; -/* -------------------------------------------------------------------------- */ -#endif /* ifndef REED_SENSOR_H_ */ diff --git a/arch/platform/z1/dev/relay-phidget.c b/arch/platform/z1/dev/relay-phidget.c deleted file mode 100644 index d78734b21..000000000 --- a/arch/platform/z1/dev/relay-phidget.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * - * ----------------------------------------------------------------- - * - * \file - * Device simple driver for generic relay in phidget port of Zolertia Z1 - * \author - * Antonio Lignan, Zolertia - * - */ - -#include "contiki.h" -#include "relay-phidget.h" - -static uint8_t controlPin; - -enum PHIDGET_RELAY_STATUSTYPES { - /* must be a bit and not more, not using 0x00. */ - INITED = 0x01, - RUNNING = 0x02, - STOPPED = 0x04, -}; - -static enum PHIDGET_RELAY_STATUSTYPES _RELAY_STATUS = 0x00; - -/*---------------------------------------------------------------------------*/ - -void -relay_enable(uint8_t pin) -{ - - if(!(_RELAY_STATUS & INITED)) { - - _RELAY_STATUS |= INITED; - - /* Selects the pin to be configure as the control pin of the relay module */ - controlPin = (1 << pin); - - /* Configures the control pin */ - P6SEL &= ~controlPin; - P6DIR |= controlPin; - } -} -/*---------------------------------------------------------------------------*/ - -void -relay_on() -{ - if((_RELAY_STATUS & INITED)) { - P6OUT |= controlPin; - } -} -/*---------------------------------------------------------------------------*/ -void -relay_off() -{ - if((_RELAY_STATUS & INITED)) { - P6OUT &= ~controlPin; - } -} -/*---------------------------------------------------------------------------*/ - -int8_t -relay_toggle() -{ - if((_RELAY_STATUS & INITED)) { - P6OUT ^= controlPin; - if((P6OUT & controlPin)) { - return 1; - } - return 0; - } - return -1; -} -/*---------------------------------------------------------------------------*/ - diff --git a/arch/platform/z1/dev/relay-phidget.h b/arch/platform/z1/dev/relay-phidget.h deleted file mode 100644 index 580151f58..000000000 --- a/arch/platform/z1/dev/relay-phidget.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * ----------------------------------------------------------------- - * - * \file - * Device simple driver for generic relay in phidget port of Zolertia Z1 - * \author - * Antonio Lignan, Zolertia - * - */ - -#ifndef RELAY_PHIDGET_H_ -#define RELAY_PHIDGETS_H_ - -void relay_enable(uint8_t pin); - -void relay_on(); -void relay_off(); -int8_t relay_toggle(); - -#endif /* RELAY_PHIDGET_H_ */ diff --git a/arch/platform/z1/dev/sht11-arch.h b/arch/platform/z1/dev/sht11-arch.h deleted file mode 100644 index 1cd1bc8e6..000000000 --- a/arch/platform/z1/dev/sht11-arch.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2011, Zolertia(TM) is a trademark of Advancare,SL - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Architecture-specific definitions for the SHT11 sensor on Zolertia Z1 - * when connected to the Ziglet port. - * \author - * Enric M. Calvo , adapted from work by - * Nicolas Tsiftes - */ - -#ifndef SHT11_ARCH_H -#define SHT11_ARCH_H - -/* Architecture-specific definitions for the SHT11 sensor on Zolertia Z1 - * when connected to the Ziglet port. - * CAUTION: I2C needs to be disabled to use the bitbang protocol of SHT11 - */ - -#define SHT11_ARCH_SDA 1 /* P5.1 */ -#define SHT11_ARCH_SCL 2 /* P5.2 */ -/* SHT11_ARCH_PWR is not needed, but until and *-arch abstraction exists, this - * should fix it - */ -#define SHT11_ARCH_PWR 3 /* P5.3 -- unused pin */ - -#define SHT11_PxDIR P5DIR -#define SHT11_PxIN P5IN -#define SHT11_PxOUT P5OUT -#define SHT11_PxSEL P5SEL -#define SHT11_PxREN P5REN - -#endif diff --git a/arch/platform/z1/dev/sht25.c b/arch/platform/z1/dev/sht25.c deleted file mode 100644 index b8356087b..000000000 --- a/arch/platform/z1/dev/sht25.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * SHT25 temperature and humidity sensor driver - * \author - * Antonio Lignan - */ -#include -#include "contiki.h" -#include "i2cmaster.h" -#include "dev/sht25.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type != SENSORS_ACTIVE) { - return SHT25_ERROR; - } - if(value) { - i2c_enable(); - } else { - i2c_disable(); - } - enabled = value; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -sht25_read_reg(uint8_t reg) -{ - uint8_t buf[] = { 0x00, 0x00 }; - uint16_t retval; - uint8_t rtx = reg; - - /* transmit the register to read */ - i2c_transmitinit(SHT25_ADDR); - while(i2c_busy()); - i2c_transmit_n(1, &rtx); - while(i2c_busy()); - /* receive the data */ - i2c_receiveinit(SHT25_ADDR); - while(i2c_busy()); - i2c_receive_n(2, &buf[0]); - while(i2c_busy()); - - retval = (uint16_t)(buf[0] << 8 | (buf[1])); - return retval; -} -/*---------------------------------------------------------------------------*/ -static int16_t -sht25_convert(uint8_t variable, uint16_t value) -{ - int16_t rd; - uint32_t buff; - buff = (uint32_t)value; - if(variable == SHT25_VAL_TEMP) { - buff *= 17572; - buff = buff >> 16; - rd = (int16_t)buff - 4685; - } else { - buff *= 12500; - buff = buff >> 16; - rd = (int16_t)buff - 600; - rd = (rd > 10000) ? 10000 : rd; - } - return rd; -} -/*---------------------------------------------------------------------------*/ -static int16_t -sht25_read(uint8_t variable) -{ - int16_t rd; - uint16_t raw; - - if((variable != SHT25_VAL_TEMP) && (variable != SHT25_VAL_HUM)) { - return SHT25_ERROR; - } - raw = sht25_read_reg(variable); - rd = sht25_convert(variable, raw); - return rd; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return sht25_read(type); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(sht25, SHT25_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/z1/dev/sht25.h b/arch/platform/z1/dev/sht25.h deleted file mode 100644 index 65d9399d3..000000000 --- a/arch/platform/z1/dev/sht25.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * SHT25 temperature and humidity sensor driver - * \author - * Antonio Lignan - */ -#include "lib/sensors.h" - -#ifndef SHT25_H_ -#define SHT25_H_ - -/* -------------------------------------------------------------------------- */ -#define SHT25_ADDR 0x40 -#define SHT25_TEMP_HOLD 0xE3 -#define SHT25_HUM_HOLD 0xE5 -#define SHT25_TEMP_NO_HOLD 0xF3 -#define SHT25_HUM_NO_HOLD 0xF5 -#define SHT2X_UREG_WRITE 0xE6 -#define SHT2X_UREG_READ 0xE7 -#define SHT2X_SOFT_RESET 0XFE -#define SHT2X_NULL 0x00 -/* -------------------------------------------------------------------------- */ -#define SHT2X_RES_14T_12RH 0x00 -#define SHT2X_RES_12T_08RH 0x01 -#define SHT2X_RES_13T_10RH 0x80 -#define SHT2X_RES_11T_11RH 0x81 -#define SHT2X_HEATER_ON 0x04 -#define SHT2X_HEATER_OFF 0x00 -#define SHT2X_OTP_RELOAD_EN 0x00 -#define SHT2X_OTP_RELOAD_DIS 0x02 -/* -------------------------------------------------------------------------- */ -#define SHT25_VAL_TEMP SHT25_TEMP_HOLD -#define SHT25_VAL_HUM SHT25_HUM_HOLD -#define SHT25_ERROR -1 -/* -------------------------------------------------------------------------- */ -#define SHT25_SENSOR "SHT25 Sensor" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor sht25; -/* -------------------------------------------------------------------------- */ -#endif /* ifndef SHT25_H_ */ diff --git a/arch/platform/z1/dev/sky-sensors.c b/arch/platform/z1/dev/sky-sensors.c deleted file mode 100644 index 48ac22428..000000000 --- a/arch/platform/z1/dev/sky-sensors.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * - * ----------------------------------------------------------------- - * - * Author : Joakim Eriksson - * Created : 2010-02-02 - * Updated : $Date: 2010/08/25 19:30:53 $ - * $Revision: 1.3 $ - */ -#include "contiki.h" -#include "lib/sensors.h" - -#define ADC12MCTL_NO(adcno) ((unsigned char *) ADC12MCTL0_)[adcno] - -static uint16_t adc_on; -static uint16_t ready; -/*---------------------------------------------------------------------------*/ -static CC_INLINE void -start(void) -{ - uint16_t c, last; - - /* Set up the ADC. */ - P6DIR = 0xff; - P6OUT = 0x00; - - /* Setup ADC12, ref., sampling time */ - /* XXX Note according to the specification a minimum of 17 ms should - be allowed after turn on of the internal reference generator. */ - ADC12CTL0 = REF2_5V + SHT0_6 + SHT1_6 + MSC + REFON; - /* Use sampling timer, repeat-sequence-of-channels */ - ADC12CTL1 = SHP + CONSEQ_3; - - last = 15; - for(c = 0; c < 16; c++) { - /* Clear all end-of-sequences */ - ADC12MCTL_NO(c) &= ~EOS; - if(adc_on & (1 << c)) { - if(last == 15) { - /* Set new start of sequence to lowest active memory holder */ - ADC12CTL1 |= (c * CSTARTADD_1); - } - last = c; - } - } - - /* Set highest end-of-sequence. */ - ADC12MCTL_NO(last) |= EOS; - - ADC12CTL0 |= ADC12ON; - ADC12CTL0 |= ENC; /* enable conversion */ - ADC12CTL0 |= ADC12SC; /* sample & convert */ -} -/*---------------------------------------------------------------------------*/ -static CC_INLINE void -stop(void) -{ - /* stop converting immediately, turn off reference voltage, etc. */ - - ADC12CTL0 &= ~ENC; - /* need to remove CONSEQ_3 if not EOS is configured */ - ADC12CTL1 &= ~CONSEQ_3; - - /* wait for conversion to stop */ - while(ADC12CTL1 & ADC12BUSY); - - /* clear any pending interrupts */ - ADC12IFG = 0; -} -/*---------------------------------------------------------------------------*/ -int -sky_sensors_status(uint16_t input, int type) -{ - if(type == SENSORS_ACTIVE) { - return (adc_on & input) == input; - } - if(type == SENSORS_READY) { - ready |= ADC12IFG & adc_on & input; - return (ready & adc_on & input) == input; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sky_sensors_configure(uint16_t input, uint8_t ref, int type, int value) -{ - uint16_t c; - - if(type == SENSORS_ACTIVE) { - stop(); - - if(value) { - adc_on |= input; - P6SEL |= input & 0xff; - - /* Set ADC config */ - for(c = 0; c < 16; c++) { - if(input & (1 << c)) { - ADC12MCTL_NO(c) = (c * INCH_1) | ref; - } - } - - } else { - adc_on &= ~input; - ready &= ~input; - P6SEL &= ~(input & 0xff); - } - - if(adc_on == 0) { - P6DIR = 0x00; - P6SEL = 0x00; - - /* Turn off ADC and internal reference generator */ - ADC12CTL0 = 0; - ADC12CTL1 = 0; - } else { - start(); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/z1/dev/sky-sensors.h b/arch/platform/z1/dev/sky-sensors.h deleted file mode 100644 index df2aeea48..000000000 --- a/arch/platform/z1/dev/sky-sensors.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * ----------------------------------------------------------------- - * - * Author : Joakim Eriksson - * Created : 2010-02-02 - * Updated : $Date: 2010/08/25 19:30:53 $ - * $Revision: 1.2 $ - */ - -#ifndef SKY_SENSORS_H_ -#define SKY_SENSORS_H_ - -int sky_sensors_status(uint16_t input, int type); -int sky_sensors_configure(uint16_t input, uint8_t reference, - int type, int value); - -#endif /* SKY_SENSORS_H_ */ diff --git a/arch/platform/z1/dev/temperature-sensor.c b/arch/platform/z1/dev/temperature-sensor.c deleted file mode 100644 index 1d4328d24..000000000 --- a/arch/platform/z1/dev/temperature-sensor.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Sensor driver for reading the built-in temperature sensor in the CPU. - * \author - * Adam Dunkels - * Joakim Eriksson - * Niclas Finne - */ - -#include "dev/temperature-sensor.h" -#include "dev/sky-sensors.h" -#include "contiki.h" - -#define INPUT_CHANNEL (1 << INCH_10) -#define INPUT_REFERENCE SREF_1 -#define TEMPERATURE_MEM ADC12MEM10 - -const struct sensors_sensor temperature_sensor; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return TEMPERATURE_MEM; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR, - value, configure, status); diff --git a/arch/platform/z1/dev/temperature-sensor.h b/arch/platform/z1/dev/temperature-sensor.h deleted file mode 100644 index 05eafe852..000000000 --- a/arch/platform/z1/dev/temperature-sensor.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Temperature sensor header file. - * \author - * Adam Dunkels - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef TEMPERATURE_SENSOR_H_ -#define TEMPERATURE_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor temperature_sensor; - -#define TEMPERATURE_SENSOR "Temperature" - -#endif /* TEMPERATURE_SENSOR_H_ */ diff --git a/arch/platform/z1/dev/tlc59116.c b/arch/platform/z1/dev/tlc59116.c deleted file mode 100644 index 2db0bf093..000000000 --- a/arch/platform/z1/dev/tlc59116.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2013, Jelmer Tiete. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Device drivers for tlc59116 i2c led driver on Zolertia Z1. - * See http://www.ti.com/product/tlc59116 for datasheet. - * \author - * Jelmer Tiete, VUB - */ - -#include -#include "contiki.h" -#include "tlc59116.h" -#include "i2cmaster.h" - -/*---------------------------------------------------------------------------*/ -/* Write to a register. - * args: - * reg register to write to - * val value to write - */ - -void -tlc59116_write_reg(uint8_t reg, uint8_t val) -{ - uint8_t tx_buf[] = { reg, val }; - - i2c_transmitinit(TLC59116_ADDR); - while(i2c_busy()); - PRINTFDEBUG("I2C Ready to TX\n"); - - i2c_transmit_n(2, tx_buf); - while(i2c_busy()); - PRINTFDEBUG("WRITE_REG 0x%02X @ reg 0x%02X\n", val, reg); -} -/*---------------------------------------------------------------------------*/ -/* Write several registers from a stream. - * args: - * len number of bytes to write - * data pointer to where the data is written from - * - * First byte in stream must be the register address to begin writing to. - * The data is then written from second byte and increasing. - */ - -void -tlc59116_write_stream(uint8_t len, uint8_t *data) -{ - i2c_transmitinit(TLC59116_ADDR); - while(i2c_busy()); - PRINTFDEBUG("I2C Ready to TX(stream)\n"); - - i2c_transmit_n(len, data); /* start tx and send conf reg */ - while(i2c_busy()); - PRINTFDEBUG("WRITE_STR %u B to 0x%02X\n", len, data[0]); -} -/*---------------------------------------------------------------------------*/ -/* Read one register. - * args: - * reg what register to read - * returns the value of the read register - */ - -uint8_t -tlc59116_read_reg(uint8_t reg) -{ - uint8_t retVal = 0; - uint8_t rtx = reg; - - PRINTFDEBUG("READ_REG 0x%02X\n", reg); - - /* transmit the register to read */ - i2c_transmitinit(TLC59116_ADDR); - while(i2c_busy()); - i2c_transmit_n(1, &rtx); - while(i2c_busy()); - - /* receive the data */ - i2c_receiveinit(TLC59116_ADDR); - while(i2c_busy()); - i2c_receive_n(1, &retVal); - while(i2c_busy()); - - return retVal; -} -/*---------------------------------------------------------------------------*/ -/* Read several registers in a stream. - * args: - * reg what register to start reading from - * len number of bytes to read - * whereto pointer to where the data is saved - */ - -void -tlc59116_read_stream(uint8_t reg, uint8_t len, uint8_t *whereto) -{ - uint8_t rtx = reg; - - PRINTFDEBUG("READ_STR %u B from 0x%02X\n", len, reg); - - /* transmit the register to start reading from */ - i2c_transmitinit(TLC59116_ADDR); - while(i2c_busy()); - i2c_transmit_n(1, &rtx); - while(i2c_busy()); - - /* receive the data */ - i2c_receiveinit(TLC59116_ADDR); - while(i2c_busy()); - i2c_receive_n(len, whereto); - while(i2c_busy()); -} -/*---------------------------------------------------------------------------*/ -/* Set pwm value for individual led. Make sure PWM mode is enabled. - * args: - * led led output -> 0 till 15 - * pwm led pwm value - */ - -void -tlc59116_led(uint8_t led, uint8_t pwm) -{ - if((led < 0) || (led > 15)) { - PRINTFDEBUG("TLC59116: wrong led value."); - } else { - tlc59116_write_reg(led + TLC59116_PWM0, pwm); - } -} -/*---------------------------------------------------------------------------*/ -/* Init the led driver: ports, pins, registers, interrupts (none enabled), I2C, - * default threshold values etc. - */ - -void -tlc59116_init(void) -{ - /* Set up ports and pins for I2C communication */ - i2c_enable(); - - /* set default register values. */ - tlc59116_write_reg(TLC59116_MODE1, TLC59116_MODE1_DEFAULT); - tlc59116_write_reg(TLC59116_MODE2, TLC59116_MODE2_DEFAULT); - - /*Set all PWM values to 0x00 (off) */ - /*This would maybe be better with a SWRST */ - uint8_t tx_buf[] = - { TLC59116_PWM0_AUTOINCR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - tlc59116_write_stream(17, tx_buf); - - /* set all leds to PWM control */ - tlc59116_write_reg(TLC59116_LEDOUT0, TLC59116_LEDOUT_PWM); - tlc59116_write_reg(TLC59116_LEDOUT1, TLC59116_LEDOUT_PWM); - tlc59116_write_reg(TLC59116_LEDOUT2, TLC59116_LEDOUT_PWM); - tlc59116_write_reg(TLC59116_LEDOUT3, TLC59116_LEDOUT_PWM); -} diff --git a/arch/platform/z1/dev/tlc59116.h b/arch/platform/z1/dev/tlc59116.h deleted file mode 100644 index c5b74f76a..000000000 --- a/arch/platform/z1/dev/tlc59116.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2013, Jelmer Tiete. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Device drivers header file for TLC59116 i2c led driver on Zolertia Z1. - * See http://www.ti.com/product/tlc59116 for datasheet. - * \author - * Jelmer Tiete, VUB - */ - -#ifndef TLC59116_H_ -#define TLC59116_H_ -#include -#include "dev/i2cmaster.h" - -#if 0 -#include -#define PRINTFDEBUG(...) printf(__VA_ARGS__) -#else -#define PRINTFDEBUG(...) -#endif - - -/* -------------------------------------------------------------------------- */ -/* Init the led driver: ports, pins, registers, I2C*/ -void tlc59116_init(void); - -/* Write to a register. - * args: - * reg register to write to - * val value to write - */ -void tlc59116_write_reg(uint8_t reg, uint8_t val); - -/* Write several registers from a stream. - * args: - * len number of bytes to read - * data pointer to where the data is read from - * First byte in stream must be the register address to begin writing to. - * The data is then written from the second byte and increasing. The address byte - * is not included in length len. - */ -void tlc59116_write_stream(uint8_t len, uint8_t * data); - -/* Read one register. - * args: - * reg what register to read - * returns the value of the read register - */ -uint8_t tlc59116_read_reg(uint8_t reg); - -/* Read several registers in a stream. - * args: - * reg what register to start reading from - * len number of bytes to read - * whereto pointer to where the data is saved - */ -void tlc59116_read_stream(uint8_t reg, uint8_t len, uint8_t * whereto); - -/* Set pwm value for individual led - * args: - * led led output -> 0 till 15 - * pwm led pwm value - */ -void tlc59116_led(uint8_t led, uint8_t pwm); - - -/* -------------------------------------------------------------------------- */ -/* Application definitions, change if required by application. */ - -/* Suggested defaults according to the data sheet etc */ -#define TLC59116_MODE1_DEFAULT 0x00 /* Default (no sub or all call) + OSC on */ -#define TLC59116_MODE2_DEFAULT 0x00 /* Default (output change on stop) */ - -#define TLC59116_LEDOUT_PWM 0xAA /* LDRx = 01 -> PWM; 4 leds per reg: 01010101b -> 0xAA */ - -/* -------------------------------------------------------------------------- */ -/* Reference definitions, should not be changed */ -/* TLC59116 slave address */ -#define TLC59116_ADDR 0x60 /* 7bit adress, 8bit write adress: 0xC0 */ - /* address with all address pins pulled to ground */ -/* TLC59116 registers */ -#define TLC59116_MODE1 0x00 -#define TLC59116_MODE2 0x01 -#define TLC59116_PWM0_AUTOINCR 0xA2 /* auto increment address for first pwm register */ -#define TLC59116_PWM0 0x02 -#define TLC59116_PWM1 0x03 -#define TLC59116_PWM2 0x04 -#define TLC59116_PWM3 0x05 -#define TLC59116_PWM4 0x06 -#define TLC59116_PWM5 0x07 -#define TLC59116_PWM6 0x08 -#define TLC59116_PWM7 0x09 -#define TLC59116_PWM8 0x0A -#define TLC59116_PWM9 0x0B -#define TLC59116_PWM10 0x0C -#define TLC59116_PWM11 0x0D -#define TLC59116_PWM12 0x0E -#define TLC59116_PWM13 0x0F -#define TLC59116_PWM14 0x10 -#define TLC59116_PWM15 0x11 -#define TLC59116_GRPPWM 0x12 -#define TLC59116_GRPFREQ 0x13 -#define TLC59116_LEDOUT0 0x14 -#define TLC59116_LEDOUT1 0x15 -#define TLC59116_LEDOUT2 0x16 -#define TLC59116_LEDOUT3 0x17 - -/* More registers follow, but not used in this implementation */ - -/* -------------------------------------------------------------------------- */ -#endif /* ifndef TLC59116_H_ */ diff --git a/arch/platform/z1/dev/tmp102.c b/arch/platform/z1/dev/tmp102.c deleted file mode 100644 index 4bf267246..000000000 --- a/arch/platform/z1/dev/tmp102.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \file - * Device drivers for tmp102 temperature sensor in Zolertia Z1. - * \author - * Enric M. Calvo, Zolertia - * Marcus Lundén, SICS - * Antonio Lignan, Zolertia - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "i2cmaster.h" -#include "tmp102.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -/*---------------------------------------------------------------------------*/ -void -tmp102_init(void) -{ - /* Power Up TMP102 via pin */ - TMP102_PWR_DIR |= TMP102_PWR_PIN; - TMP102_PWR_SEL &= ~TMP102_PWR_SEL; - TMP102_PWR_SEL2 &= ~TMP102_PWR_SEL; - TMP102_PWR_REN &= ~TMP102_PWR_SEL; - TMP102_PWR_OUT |= TMP102_PWR_PIN; - - /* Set up ports and pins for I2C communication */ - i2c_enable(); - - enabled = 1; -} -/*---------------------------------------------------------------------------*/ -void -tmp102_stop(void) -{ - /* Power off */ - TMP102_PWR_OUT &= ~TMP102_PWR_PIN; - enabled = 0; -} -/*---------------------------------------------------------------------------*/ -void -tmp102_write_reg(uint8_t reg, uint16_t val) -{ - uint8_t tx_buf[] = { reg, 0x00, 0x00 }; - - tx_buf[1] = (uint8_t)(val >> 8); - tx_buf[2] = (uint8_t)(val & 0x00FF); - - i2c_transmitinit(TMP102_ADDR); - while(i2c_busy()); - PRINTF("I2C Ready to TX\n"); - - i2c_transmit_n(3, tx_buf); - while(i2c_busy()); - PRINTF("WRITE_REG 0x%04X @ reg 0x%02X\n", val, reg); -} -/*---------------------------------------------------------------------------*/ -uint16_t -tmp102_read_reg(uint8_t reg) -{ - uint8_t buf[] = { 0x00, 0x00 }; - uint16_t retVal = 0; - uint8_t rtx = reg; - PRINTF("READ_REG 0x%02X\n", reg); - - /* transmit the register to read */ - i2c_transmitinit(TMP102_ADDR); - while(i2c_busy()); - i2c_transmit_n(1, &rtx); - while(i2c_busy()); - - /* receive the data */ - i2c_receiveinit(TMP102_ADDR); - while(i2c_busy()); - i2c_receive_n(2, &buf[0]); - while(i2c_busy()); - - retVal = (uint16_t)(buf[0] << 8 | (buf[1])); - - return retVal; -} -/*---------------------------------------------------------------------------*/ -uint16_t -tmp102_read_temp_raw(void) -{ - uint16_t rd = 0; - rd = tmp102_read_reg(TMP102_TEMP); - return rd; -} -/*---------------------------------------------------------------------------*/ -int16_t -tmp102_read_temp_x100(void) -{ - int16_t raw = 0; - int16_t sign = 1; - int16_t abstemp, temp_int; - - raw = (int16_t)tmp102_read_reg(TMP102_TEMP); - if(raw < 0) { - abstemp = (raw ^ 0xFFFF) + 1; - sign = -1; - } else { - abstemp = raw; - } - - /* Integer part of the temperature value and percents*/ - temp_int = (abstemp >> 8) * sign * 100; - temp_int += ((abstemp & 0xff) * 100) / 0x100; - return temp_int; -} -/*---------------------------------------------------------------------------*/ -int8_t -tmp102_read_temp_simple(void) -{ - /* Casted to int8_t: We don't expect temperatures outside -128 to 127 C */ - return tmp102_read_temp_x100() / 100; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type != SENSORS_ACTIVE) { - return TMP102_ERROR; - } - if(value) { - tmp102_init(); - } else { - tmp102_stop(); - } - enabled = value; - return TMP102_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - } - return TMP102_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return (int)tmp102_read_temp_x100(); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(tmp102, TMP102_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/z1/dev/tmp102.h b/arch/platform/z1/dev/tmp102.h deleted file mode 100644 index cf7a71eb8..000000000 --- a/arch/platform/z1/dev/tmp102.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Device drivers header file for tmp102 temperature sensor in Zolertia - * Z1 WSN Platform. - * \author - * Enric M. Calvo, Zolertia - * Marcus Lundén, SICS - * Antonio Lignan, Zolertia - */ -/* -------------------------------------------------------------------------- */ -#ifndef TMP102_H_ -#define TMP102_H_ -#include -#include "lib/sensors.h" -#include "i2cmaster.h" -/* -------------------------------------------------------------------------- */ -void tmp102_init(void); -void tmp102_write_reg(uint8_t reg, uint16_t val); -uint16_t tmp102_read_reg(uint8_t reg); -uint16_t tmp102_read_temp_raw(); -int8_t tmp102_read_temp_simple(); -int16_t tmp102_read_temp_x100(); -/* -------------------------------------------------------------------------- */ -#define TMP102_ADDR 0x48 -#define TMP102_TEMP 0x00 -#define TMP102_CONF 0x01 -#define TMP102_TLOW 0x02 -#define TMP102_THIGH 0x03 - -/* TMP102 pin-out */ -#define TMP102_PWR_DIR P5DIR -#define TMP102_PWR_SEL P5SEL -#define TMP102_PWR_SEL2 P5SEL2 -#define TMP102_PWR_REN P5REN -#define TMP102_PWR_OUT P5OUT -#define TMP102_PWR_PIN (1<<0) /* P5.0 */ -/* -------------------------------------------------------------------------- */ -#define TMP102_SUCCESS 0 -#define TMP102_ERROR (-1) -#define TMP102_READ 0x01 -/* -------------------------------------------------------------------------- */ -#define TMP102_SENSOR "TMP102 sensor" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor tmp102; -/* -------------------------------------------------------------------------- */ -#endif /* ifndef TMP102_H_ */ diff --git a/arch/platform/z1/dev/xmem.c b/arch/platform/z1/dev/xmem.c deleted file mode 100644 index 89ca9c17b..000000000 --- a/arch/platform/z1/dev/xmem.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Device driver for the ST M25P16 40MHz 1Mbyte external memory. - * \author - * Björn Grönvall - * Enric M. Calvo - * - * Data is written bit inverted (~-operator) to flash so that - * unwritten data will read as zeros (UNIX style). - */ - -#include -#include - -#include "contiki.h" -#include "dev/spi-legacy.h" -#include "dev/xmem.h" -#include "dev/watchdog.h" - -#if 1 -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) do {} while (0) -#endif - -#define SPI_FLASH_INS_WREN 0x06 -#define SPI_FLASH_INS_WRDI 0x04 -#define SPI_FLASH_INS_RDSR 0x05 -#define SPI_FLASH_INS_WRSR 0x01 -#define SPI_FLASH_INS_READ 0x03 -#define SPI_FLASH_INS_FAST_READ 0x0b -#define SPI_FLASH_INS_PP 0x02 -#define SPI_FLASH_INS_SE 0xd8 -#define SPI_FLASH_INS_BE 0xc7 -#define SPI_FLASH_INS_DP 0xb9 -#define SPI_FLASH_INS_RES 0xab -/*---------------------------------------------------------------------------*/ -static void -write_enable(void) -{ - int s; - - s = splhigh(); - SPI_FLASH_ENABLE(); - - SPI_WRITE(SPI_FLASH_INS_WREN); - - SPI_FLASH_DISABLE(); - splx(s); -} -/*---------------------------------------------------------------------------*/ -static unsigned -read_status_register(void) -{ - unsigned char u; - - int s; - - s = splhigh(); - SPI_FLASH_ENABLE(); - - - SPI_WRITE(SPI_FLASH_INS_RDSR); - - SPI_FLUSH(); - SPI_READ(u); - - SPI_FLASH_DISABLE(); - splx(s); - - return u; -} -/*---------------------------------------------------------------------------*/ -/* - * Wait for a write/erase operation to finish. - */ -static unsigned -wait_ready(void) -{ - unsigned u; - do { - u = read_status_register(); - watchdog_periodic(); - } while(u & 0x01); /* WIP=1, write in progress */ - return u; -} -/*---------------------------------------------------------------------------*/ -/* - * Erase 64k bytes of data. It takes about 1s before WIP goes low! - */ -static void -erase_sector(unsigned long offset) -{ - int s; - wait_ready(); - - write_enable(); - - s = splhigh(); - SPI_FLASH_ENABLE(); - - SPI_WRITE_FAST(SPI_FLASH_INS_SE); - SPI_WRITE_FAST(offset >> 16); /* MSB */ - SPI_WRITE_FAST(offset >> 8); - SPI_WRITE_FAST(offset >> 0); /* LSB */ - SPI_WAITFORTx_ENDED(); - - SPI_FLASH_DISABLE(); - splx(s); -} -/*---------------------------------------------------------------------------*/ -/* - * Initialize external flash *and* SPI bus! - */ -void -xmem_init(void) -{ - spi_init(); - - P4DIR |= BV(FLASH_CS); /* Unnecessary for Zolertia Z1 | BV(FLASH_PWR); */ - P5DIR |= BV(FLASH_HOLD); /* In P5 for Z1 */ - - SPI_FLASH_DISABLE(); /* Unselect flash. */ - SPI_FLASH_UNHOLD(); -} -/*---------------------------------------------------------------------------*/ -int -xmem_pread(void *_p, int size, unsigned long offset) -{ - unsigned char *p = _p; - const unsigned char *end = p + size; - int s; - wait_ready(); - - s = splhigh(); - SPI_FLASH_ENABLE(); - - SPI_WRITE_FAST(SPI_FLASH_INS_READ); - SPI_WRITE_FAST(offset >> 16); /* MSB */ - SPI_WRITE_FAST(offset >> 8); - SPI_WRITE_FAST(offset >> 0); /* LSB */ - SPI_WAITFORTx_ENDED(); - - SPI_FLUSH(); - for(; p < end; p++) { - unsigned char u; - SPI_READ(u); - *p = ~u; - } - - SPI_FLASH_DISABLE(); - splx(s); - - return size; -} -/*---------------------------------------------------------------------------*/ -static const unsigned char * -program_page(unsigned long offset, const unsigned char *p, int nbytes) -{ - const unsigned char *end = p + nbytes; - int s; - - wait_ready(); - - write_enable(); - - s = splhigh(); - SPI_FLASH_ENABLE(); - - SPI_WRITE_FAST(SPI_FLASH_INS_PP); - SPI_WRITE_FAST(offset >> 16); /* MSB */ - SPI_WRITE_FAST(offset >> 8); - SPI_WRITE_FAST(offset >> 0); /* LSB */ - - for(; p < end; p++) { - SPI_WRITE_FAST(~*p); - } - SPI_WAITFORTx_ENDED(); - - SPI_FLASH_DISABLE(); - splx(s); - - return p; -} -/*---------------------------------------------------------------------------*/ -int -xmem_pwrite(const void *_buf, int size, unsigned long addr) -{ - const unsigned char *p = _buf; - const unsigned long end = addr + size; - unsigned long i, next_page; - - for(i = addr; i < end;) { - next_page = (i | 0xff) + 1; - if(next_page > end) { - next_page = end; - } - p = program_page(i, p, next_page - i); - i = next_page; - } - - return size; -} -/*---------------------------------------------------------------------------*/ -int -xmem_erase(long size, unsigned long addr) -{ - unsigned long end = addr + size; - - if(size % XMEM_ERASE_UNIT_SIZE != 0) { - PRINTF("xmem_erase: bad size\n"); - return -1; - } - - if(addr % XMEM_ERASE_UNIT_SIZE != 0) { - PRINTF("xmem_erase: bad offset\n"); - return -1; - } - - for (; addr < end; addr += XMEM_ERASE_UNIT_SIZE) { - erase_sector(addr); - } - - return size; -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/z1/dev/z1-phidgets.c b/arch/platform/z1/dev/z1-phidgets.c deleted file mode 100644 index e86c3e2f0..000000000 --- a/arch/platform/z1/dev/z1-phidgets.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * - * ----------------------------------------------------------------- - * - * Author : Joakim Eriksson - * Created : 2010-02-02 - * Updated : $Date: 2010/11/05 10:31:57 $ - * $Revision: 1.3 $ - */ - -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/z1-phidgets.h" - -static uint8_t adc_on; -static uint8_t active; -/*---------------------------------------------------------------------------*/ -static void -sensors_activate(uint8_t type) -{ - uint8_t pre = adc_on; - - adc_on |= type; - - if(pre == 0 && adc_on > 0) { - P6DIR = 0xff; - P6OUT = 0x00; - P6SEL |= 0x8b; /* bit 7 + 3 + 1 + 0 */ - - /* if nothing was started before, start up the ADC system */ - /* Set up the ADC. */ - ADC12CTL0 = REF2_5V + SHT0_6 + SHT1_6 + MSC; /* Setup ADC12, ref., sampling time */ - ADC12CTL1 = SHP + CONSEQ_3 + CSTARTADD_0; /* Use sampling timer, repeat-sequenc-of-channels */ - /* convert up to MEM4 */ - ADC12MCTL4 |= EOS; - - ADC12CTL0 |= ADC12ON + REFON; - ADC12CTL0 |= ENC; /* enable conversion */ - ADC12CTL0 |= ADC12SC; /* sample & convert */ - } -} -/*---------------------------------------------------------------------------*/ -static void -sensors_deactivate(uint8_t type) -{ - adc_on &= ~type; - - if(adc_on == 0) { - /* stop converting immediately, turn off reference voltage, etc. */ - /* wait for conversion to stop */ - - ADC12CTL0 &= ~ENC; - /* need to remove CONSEQ_3 if not EOS is configured */ - ADC12CTL1 &= ~CONSEQ_3; - - while(ADC12CTL1 & ADC12BUSY); - - ADC12CTL0 = 0; - ADC12CTL1 = 0; - - P6DIR = 0x00; - P6OUT = 0x00; - P6SEL = 0x00; - } -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* ADC0 corresponds to the port under the logo, ADC1 to the port over the logo, - ADC2 and ADC3 corresponds to port on the JCreate bottom expansion port) */ - switch(type) { - case PHIDGET5V_1: - return ADC12MEM0; - case PHIDGET5V_2: - return ADC12MEM1; - case PHIDGET3V_1: - return ADC12MEM2; - case PHIDGET3V_2: - return ADC12MEM3; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return active; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - switch(type) { - case SENSORS_ACTIVE: - if(c) { - if(!status(SENSORS_ACTIVE)) { - /* SREF_1 is Vref+ */ - /* MemReg6 == P6.0/A0 == 5V 1 */ - ADC12MCTL0 = (INCH_0 + SREF_0); - /* MemReg7 == P6.3/A3 == 5V 2 */ - ADC12MCTL1 = (INCH_3 + SREF_0); - /* MemReg8 == P6.1/A1 == 3V 1 */ - ADC12MCTL2 = (INCH_1 + SREF_0); - /* MemReg9 == P6.7/A7 == 3V_2 */ - ADC12MCTL3 = (INCH_7 + SREF_0); - - sensors_activate(0x0F); - active = 1; - } - } else { - sensors_deactivate(0x0F); - active = 0; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(phidgets, "Phidgets", value, configure, status); diff --git a/arch/platform/z1/dev/z1-phidgets.h b/arch/platform/z1/dev/z1-phidgets.h deleted file mode 100644 index f56356508..000000000 --- a/arch/platform/z1/dev/z1-phidgets.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * - * ----------------------------------------------------------------- - * - * Author : Joakim Eriksson - * Created : 2010-08-26 - * Updated : $Date: 2010/08/27 12:58:57 $ - * $Revision: 1.2 $ - */ -#ifndef Z1_PHIDGETS_H_ -#define Z1_PHIDGETS_H_ - -#define PHIDGET5V_1 0 -#define PHIDGET5V_2 1 -#define PHIDGET3V_1 2 -#define PHIDGET3V_2 3 - -extern const struct sensors_sensor phidgets; - -#endif /* Z1_PHIDGETS_H_ */ diff --git a/arch/platform/z1/dev/z1-sensors.c b/arch/platform/z1/dev/z1-sensors.c deleted file mode 100644 index db5b418b9..000000000 --- a/arch/platform/z1/dev/z1-sensors.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 - * Zolertia Z1 on-board sensors - * \author - * Antonio Lignan, Zolertia - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/button-sensor.h" -#include "dev/tmp102.h" -#include "dev/adxl345.h" -/*---------------------------------------------------------------------------*/ -/** \brief Exports global symbols for the sensor API */ -SENSORS(&button_sensor, &adxl345, &tmp102); -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/z1/node-id-z1.c b/arch/platform/z1/node-id-z1.c deleted file mode 100644 index 7f65e2c58..000000000 --- a/arch/platform/z1/node-id-z1.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Utility to store a node id in the external flash - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "sys/node-id.h" -#include "dev/xmem.h" -#include - -unsigned char node_mac[8]; - -/*---------------------------------------------------------------------------*/ -void -node_id_z1_restore(void) -{ - unsigned char buf[12]; - xmem_pread(buf, 12, NODE_ID_XMEM_OFFSET); - if(buf[0] == 0xad && - buf[1] == 0xde) { - node_id = (buf[2] << 8) | buf[3]; - memcpy(node_mac, &buf[4], 8); - } else { - node_id = 0; - } -} -/*---------------------------------------------------------------------------*/ -void -node_id_z1_burn(unsigned short id) -{ - unsigned char buf[12]; - memset(buf, 0, sizeof(buf)); - buf[0] = 0xad; - buf[1] = 0xde; - buf[2] = id >> 8; - buf[3] = id & 0xff; - xmem_erase(XMEM_ERASE_UNIT_SIZE, NODE_ID_XMEM_OFFSET); - xmem_pwrite(buf, 12, NODE_ID_XMEM_OFFSET); -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/z1/node-id-z1.h b/arch/platform/z1/node-id-z1.h deleted file mode 100644 index d70c018d6..000000000 --- a/arch/platform/z1/node-id-z1.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -#ifndef NODE_ID_Z1_H_ -#define NODE_ID_Z1_H_ - -#include - -void node_id_z1_restore(void); -void node_id_z1_burn(uint16_t node_id); - -#endif /* NODE_ID_Z1_H_ */ diff --git a/arch/platform/z1/platform.c b/arch/platform/z1/platform.c deleted file mode 100644 index 0d8d248c5..000000000 --- a/arch/platform/z1/platform.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 -#include -#include - -#include "contiki.h" -#include "cc2420.h" -#include "dev/leds.h" -#include "dev/serial-line.h" -#include "dev/slip.h" -#include "dev/uart0.h" -#include "dev/watchdog.h" -#include "dev/xmem.h" -#include "lib/random.h" -#include "net/netstack.h" -#include "net/mac/framer/frame802154.h" -#include "dev/adxl345.h" -#include "sys/clock.h" -#include "sys/energest.h" - -#if NETSTACK_CONF_WITH_IPV6 -#include "net/ipv6/uip-ds6.h" -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -#include "node-id-z1.h" -#include "cfs-coffee-arch.h" -#include "cfs/cfs-coffee.h" - -extern unsigned char node_mac[8]; - -#if DCOSYNCH_CONF_ENABLED -static struct timer mgt_timer; -#endif -extern int msp430_dco_required; - -#define UIP_OVER_MESH_CHANNEL 8 -#if NETSTACK_CONF_WITH_IPV4 -static uint8_t is_gateway; -#endif /* NETSTACK_CONF_WITH_IPV4 */ - -#ifdef EXPERIMENT_SETUP -#include "experiment-setup.h" -#endif - -void init_platform(void); -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Z1" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -#ifdef UART0_CONF_BAUD_RATE -#define UART0_BAUD_RATE UART0_CONF_BAUD_RATE -#else -#define UART0_BAUD_RATE 115200 -#endif -/*---------------------------------------------------------------------------*/ -#if 0 -int -force_float_inclusion() -{ - extern int __fixsfsi; - extern int __floatsisf; - extern int __mulsf3; - extern int __subsf3; - - return __fixsfsi + __floatsisf + __mulsf3 + __subsf3; -} -#endif -/*---------------------------------------------------------------------------*/ -void -uip_log(char *msg) -{ - puts(msg); -} -/*---------------------------------------------------------------------------*/ -#if 0 -void -force_inclusion(int d1, int d2) -{ - snprintf(NULL, 0, "%d", d1 % d2); -} -#endif -/*---------------------------------------------------------------------------*/ -static void -set_lladdr(void) -{ - linkaddr_t addr; - - memset(&addr, 0, sizeof(linkaddr_t)); -#if NETSTACK_CONF_WITH_IPV6 - memcpy(addr.u8, node_mac, sizeof(addr.u8)); -#else - if(node_id == 0) { - int i; - for(i = 0; i < sizeof(linkaddr_t); ++i) { - addr.u8[i] = node_mac[7 - i]; - } - } else { - addr.u8[0] = node_id & 0xff; - addr.u8[1] = node_id >> 8; - } -#endif - linkaddr_set_node_addr(&addr); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one(void) -{ - /* - * Initalize hardware. - */ - msp430_cpu_init(); - - leds_init(); - leds_on(LEDS_RED); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two(void) -{ - clock_wait(100); - - uart0_init(BAUD2UBR(UART0_BAUD_RATE)); /* Must come before first printf */ - - xmem_init(); - - leds_off(LEDS_RED); - /* - * Hardware initialization done! - */ - - /* Restore node id if such has been stored in external mem */ - node_id_z1_restore(); - - /* If no MAC address was burned, we use the node id or the Z1 product ID */ - if(!(node_mac[0] | node_mac[1] | node_mac[2] | node_mac[3] | - node_mac[4] | node_mac[5] | node_mac[6] | node_mac[7])) { - -#ifdef SERIALNUM - if(!node_id) { - LOG_INFO("Node id is not set, using Z1 product ID\n"); - node_id = SERIALNUM; - } -#endif - node_mac[0] = 0xc1; /* Hardcoded for Z1 */ - node_mac[1] = 0x0c; /* Hardcoded for Revision C */ - node_mac[2] = 0x00; /* Hardcoded to arbitrary even number so that - the 802.15.4 MAC address is compatible with - an Ethernet MAC address - byte 0 (byte 2 in - the DS ID) */ - node_mac[3] = 0x00; /* Hardcoded */ - node_mac[4] = 0x00; /* Hardcoded */ - node_mac[5] = 0x00; /* Hardcoded */ - node_mac[6] = node_id >> 8; - node_mac[7] = node_id & 0xff; - } - - /* Overwrite node MAC if desired at compile time */ -#ifdef MACID -#warning "***** CHANGING DEFAULT MAC *****" - node_mac[0] = 0xc1; /* Hardcoded for Z1 */ - node_mac[1] = 0x0c; /* Hardcoded for Revision C */ - node_mac[2] = 0x00; /* Hardcoded to arbitrary even number so that - the 802.15.4 MAC address is compatible with - an Ethernet MAC address - byte 0 (byte 2 in - the DS ID) */ - node_mac[3] = 0x00; /* Hardcoded */ - node_mac[4] = 0x00; /* Hardcoded */ - node_mac[5] = 0x00; /* Hardcoded */ - node_mac[6] = MACID >> 8; - node_mac[7] = MACID & 0xff; -#endif - -#ifdef IEEE_802154_MAC_ADDRESS - /* for setting "hardcoded" IEEE 802.15.4 MAC addresses */ - { - uint8_t ieee[] = IEEE_802154_MAC_ADDRESS; - memcpy(node_mac, ieee, sizeof(uip_lladdr.addr)); - node_mac[7] = node_id & 0xff; - } -#endif /* IEEE_802154_MAC_ADDRESS */ - - random_init(node_mac[6] + node_mac[7]); - - set_lladdr(); - - /* - * main() will turn the radio on inside netstack_init(). The CC2420 - * must already be initialised by that time, so we do this here early. - * Later on in stage three we set correct values for PANID and radio - * short/long address. - */ - cc2420_init(); - - SENSORS_ACTIVATE(adxl345); - - leds_off(LEDS_ALL); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three(void) -{ - uint8_t longaddr[8]; - uint16_t shortaddr; - - init_platform(); - - shortaddr = (linkaddr_node_addr.u8[0] << 8) + linkaddr_node_addr.u8[1]; - memset(longaddr, 0, sizeof(longaddr)); - linkaddr_copy((linkaddr_t *)&longaddr, &linkaddr_node_addr); - - cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr); - - LOG_INFO("CC2420 CCA threshold %i\n", CC2420_CONF_CCA_THRESH); - -#if DCOSYNCH_CONF_ENABLED - timer_set(&mgt_timer, DCOSYNCH_PERIOD * CLOCK_SECOND); -#endif -} -/*---------------------------------------------------------------------------*/ -void -platform_idle(void) -{ - /* - * Idle processing. - */ - int s = splhigh(); /* Disable interrupts. */ - /* uart0_active is for avoiding LPM3 when still sending or receiving */ - if(process_nevents() != 0 || uart0_active()) { - splx(s); /* Re-enable interrupts. */ - } else { -#if DCOSYNCH_CONF_ENABLED - /* before going down to sleep possibly do some management */ - if(timer_expired(&mgt_timer)) { - watchdog_periodic(); - timer_reset(&mgt_timer); - msp430_sync_dco(); -#if CC2420_CONF_SFD_TIMESTAMPS - cc2420_arch_sfd_init(); -#endif /* CC2420_CONF_SFD_TIMESTAMPS */ - } -#endif - - /* Re-enable interrupts and go to sleep atomically. */ - ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM); - watchdog_stop(); - /* check if the DCO needs to be on - if so - only LPM 1 */ - if (msp430_dco_required) { - _BIS_SR(GIE | CPUOFF); /* LPM1 sleep for DMA to work!. */ - } else { - _BIS_SR(GIE | SCG0 | SCG1 | CPUOFF); /* LPM3 sleep. This - statement will block - until the CPU is - woken up by an - interrupt that sets - the wake up flag. */ - } - watchdog_start(); - ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU); - } -} -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/z1/z1-def.h b/arch/platform/z1/z1-def.h deleted file mode 100644 index e59165ee3..000000000 --- a/arch/platform/z1/z1-def.h +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Platform configuration for the Z1 platform - * \author - * Joakim Eriksson - */ - -#ifndef Z1_DEF_H_ -#define Z1_DEF_H_ - -#include - -/* - * Definitions below are dictated by the hardware and not really - * changeable! - */ - -#define ZOLERTIA_Z1 1 /* Enric */ - -/* 1 len byte, 2 bytes CRC */ - #define RADIO_PHY_OVERHEAD 3 - /* 250kbps data rate. One byte = 32us */ - #define RADIO_BYTE_AIR_TIME 32 -/* Delay between GO signal and SFD: radio fixed delay + 4Bytes preample + 1B SFD -- 1Byte time is 32us - * ~327us + 129preample = 456 us */ -#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(456)) -/* Delay between GO signal and start listening - * ~50us delay + 129preample + ?? = 183 us */ -#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(183)) -/* Delay between the SFD finishes arriving and it is detected in software */ -#define RADIO_DELAY_BEFORE_DETECT 0 - -#define PLATFORM_HAS_LEDS 1 -#define PLATFORM_HAS_BUTTON 1 -#define PLATFORM_HAS_RADIO 1 -#define PLATFORM_HAS_BATTERY 1 - -/* CPU target speed in Hz */ -#define F_CPU 8000000uL /* 8MHz by default */ - -/* the low-level radio driver */ -#define NETSTACK_CONF_RADIO cc2420_driver - -/* XXX Temporary place for defines that are lacking in mspgcc4's gpio.h */ -#ifdef __IAR_SYSTEMS_ICC__ -#ifndef P1SEL2_ -#define P1SEL2_ (0x0041u) /* Port 1 Selection 2*/ -DEFC(P1SEL2, P1SEL2_) -#endif -#ifndef P5SEL2_ -#define P5SEL2_ (0x0045u) /* Port 5 Selection 2*/ -DEFC(P5SEL2, P5SEL2_) -#endif -#else /* __IAR_SYSTEMS_ICC__ */ -#ifdef __GNUC__ -#ifndef P1SEL2_ -#define P1SEL2_ 0x0041 /* Port 1 Selection 2*/ -sfrb(P1SEL2, P1SEL2_); -#endif -#ifndef P5SEL2_ -#define P5SEL2_ 0x0045 /* Port 5 Selection 2*/ -sfrb(P5SEL2, P5SEL2_); -#endif -#endif /* __GNUC__ */ -#endif /* __IAR_SYSTEMS_ICC__ */ - -/* - * Definitions below are dictated by the hardware and not really - * changeable! - */ - -/* LED ports */ -#ifdef Z1_IS_Z1SP -#define LEDS_PxDIR P4DIR -#define LEDS_PxOUT P4OUT -#define LEDS_CONF_RED 0x04 -#define LEDS_CONF_GREEN 0x01 -#define LEDS_CONF_YELLOW 0x80 -#else -#define LEDS_PxDIR P5DIR -#define LEDS_PxOUT P5OUT -#define LEDS_CONF_RED 0x10 -#define LEDS_CONF_GREEN 0x40 -#define LEDS_CONF_YELLOW 0x20 -#endif /* Z1_IS_Z1SP */ - -#define LEDS_CONF_LEGACY_API 1 - -/* DCO speed resynchronization for more robust UART, etc. */ -#ifndef DCOSYNCH_CONF_ENABLED -#define DCOSYNCH_CONF_ENABLED (!(MAC_CONF_WITH_TSCH)) /* TSCH needs timerB -for SFD timestamping */ -#endif /* DCOSYNCH_CONF_ENABLED */ - -#ifndef CC2420_CONF_SFD_TIMESTAMPS -#define CC2420_CONF_SFD_TIMESTAMPS (MAC_CONF_WITH_TSCH) /* TSCH needs SFD timestamping */ -#endif /* CC2420_CONF_SFD_TIMESTAMPS */ - -#ifndef DCOSYNCH_CONF_PERIOD -#define DCOSYNCH_CONF_PERIOD 30 -#endif /* DCOSYNCH_CONF_PERIOD */ - -#define ROM_ERASE_UNIT_SIZE 512 -#define XMEM_ERASE_UNIT_SIZE (64 * 1024L) - -#define CFS_CONF_OFFSET_TYPE long - -/* Use the first 64k of external flash for node configuration */ -#define NODE_ID_XMEM_OFFSET (0 * XMEM_ERASE_UNIT_SIZE) - -/* Use the second 64k of external flash for codeprop. */ -#define EEPROMFS_ADDR_CODEPROP (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_XMEM_CONF_OFFSET (2 * XMEM_ERASE_UNIT_SIZE) -#define CFS_XMEM_CONF_SIZE (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_RAM_CONF_SIZE 4096 - -/* - * SPI bus configuration for the Z1 mote. - */ - -/* SPI input/output registers. */ -#define SPI_TXBUF UCB0TXBUF -#define SPI_RXBUF UCB0RXBUF - -/* USART0 Tx ready? */ -#define SPI_WAITFOREOTx() while((UCB0STAT & UCBUSY) != 0) -/* USART0 Rx ready? */ -#define SPI_WAITFOREORx() while((IFG2 & UCB0RXIFG) == 0) -/* USART0 Tx buffer ready? */ -#define SPI_WAITFORTxREADY() while((IFG2 & UCB0TXIFG) == 0) - -#define MOSI 1 /* P3.1 - Output: SPI Master out - slave in (MOSI) */ -#define MISO 2 /* P3.2 - Input: SPI Master in - slave out (MISO) */ -#define SCK 3 /* P3.3 - Output: SPI Serial Clock (SCLK) */ - -/* - * SPI bus - M25P80 external flash configuration. - */ -/* FLASH_PWR P4.3 Output ALWAYS POWERED ON Z1 */ -#define FLASH_CS 4 /* P4.4 Output */ -#define FLASH_HOLD 7 /* P5.7 Output */ - -/* Enable/disable flash access to the SPI bus (active low). */ - -#define SPI_FLASH_ENABLE() (P4OUT &= ~BV(FLASH_CS)) -#define SPI_FLASH_DISABLE() (P4OUT |= BV(FLASH_CS)) - -#define SPI_FLASH_HOLD() (P5OUT &= ~BV(FLASH_HOLD)) -#define SPI_FLASH_UNHOLD() (P5OUT |= BV(FLASH_HOLD)) - -/* - * SPI bus - CC2420 pin configuration. - */ - -#define CC2420_CONF_SYMBOL_LOOP_COUNT 1302 /* 326us msp430X @ 8MHz */ - -/* P1.2 - Input: FIFOP from CC2420 */ -#define CC2420_FIFOP_PORT(type) P1##type -#define CC2420_FIFOP_PIN 2 -/* P1.3 - Input: FIFO from CC2420 */ -#define CC2420_FIFO_PORT(type) P1##type -#define CC2420_FIFO_PIN 3 -/* P1.4 - Input: CCA from CC2420 */ -#define CC2420_CCA_PORT(type) P1##type -#define CC2420_CCA_PIN 4 -/* P4.1 - Input: SFD from CC2420 */ -#define CC2420_SFD_PORT(type) P4##type -#define CC2420_SFD_PIN 1 -/* P3.0 - Output: SPI Chip Select (CS_N) */ -#define CC2420_CSN_PORT(type) P3##type -#define CC2420_CSN_PIN 0 -/* P4.5 - Output: VREG_EN to CC2420 */ -#define CC2420_VREG_PORT(type) P4##type -#define CC2420_VREG_PIN 5 -/* P4.6 - Output: RESET_N to CC2420 */ -#define CC2420_RESET_PORT(type) P4##type -#define CC2420_RESET_PIN 6 - -#define CC2420_IRQ_VECTOR PORT1_VECTOR - -/* Pin status. */ -#define CC2420_FIFOP_IS_1 (!!(CC2420_FIFOP_PORT(IN) & BV(CC2420_FIFOP_PIN))) -#define CC2420_FIFO_IS_1 (!!(CC2420_FIFO_PORT(IN) & BV(CC2420_FIFO_PIN))) -#define CC2420_CCA_IS_1 (!!(CC2420_CCA_PORT(IN) & BV(CC2420_CCA_PIN))) -#define CC2420_SFD_IS_1 (!!(CC2420_SFD_PORT(IN) & BV(CC2420_SFD_PIN))) - -/* The CC2420 reset pin. */ -#define SET_RESET_INACTIVE() (CC2420_RESET_PORT(OUT) |= BV(CC2420_RESET_PIN)) -#define SET_RESET_ACTIVE() (CC2420_RESET_PORT(OUT) &= ~BV(CC2420_RESET_PIN)) - -/* CC2420 voltage regulator enable pin. */ -#define SET_VREG_ACTIVE() (CC2420_VREG_PORT(OUT) |= BV(CC2420_VREG_PIN)) -#define SET_VREG_INACTIVE() (CC2420_VREG_PORT(OUT) &= ~BV(CC2420_VREG_PIN)) - -/* CC2420 rising edge trigger for external interrupt 0 (FIFOP). */ -#define CC2420_FIFOP_INT_INIT() do { \ - CC2420_FIFOP_PORT(IES) &= ~BV(CC2420_FIFOP_PIN); \ - CC2420_CLEAR_FIFOP_INT(); \ -} while(0) - -/* FIFOP on external interrupt 0. */ -#define CC2420_ENABLE_FIFOP_INT() do { CC2420_FIFOP_PORT(IE) |= BV(CC2420_FIFOP_PIN); } while(0) -#define CC2420_DISABLE_FIFOP_INT() do { CC2420_FIFOP_PORT(IE) &= ~BV(CC2420_FIFOP_PIN); } while(0) -#define CC2420_CLEAR_FIFOP_INT() do { CC2420_FIFOP_PORT(IFG) &= ~BV(CC2420_FIFOP_PIN); } while(0) - -/* - * Enables/disables CC2420 access to the SPI bus (not the bus). - * (Chip Select) - */ - -/* ENABLE CSn (active low) */ -#define CC2420_SPI_ENABLE() (CC2420_CSN_PORT(OUT) &= ~BV(CC2420_CSN_PIN)) -/* DISABLE CSn (active low) */ -#define CC2420_SPI_DISABLE() (CC2420_CSN_PORT(OUT) |= BV(CC2420_CSN_PIN)) -#define CC2420_SPI_IS_ENABLED() ((CC2420_CSN_PORT(OUT) & BV(CC2420_CSN_PIN)) != BV(CC2420_CSN_PIN)) - -/* - * I2C configuration - */ - -#define I2C_PxDIR P5DIR -#define I2C_PxIN P5IN -#define I2C_PxOUT P5OUT -#define I2C_PxSEL P5SEL -#define I2C_PxSEL2 P5SEL2 -#define I2C_PxREN P5REN - -#define I2C_SDA (1 << 1) /* SDA == P5.1 */ -#define I2C_SCL (1 << 2) /* SCL == P5.2 */ -#define I2C_PRESC_1KHZ_LSB 0x00 -#define I2C_PRESC_1KHZ_MSB 0x20 -#define I2C_PRESC_100KHZ_LSB 0x50 -#define I2C_PRESC_100KHZ_MSB 0x00 -#define I2C_PRESC_400KHZ_LSB 0x14 -#define I2C_PRESC_400KHZ_MSB 0x00 - -/* Set rate as high as possible by default */ -#ifndef I2C_PRESC_Z1_LSB -#define I2C_PRESC_Z1_LSB I2C_PRESC_400KHZ_LSB -#endif - -#ifndef I2C_PRESC_Z1_MSB -#define I2C_PRESC_Z1_MSB I2C_PRESC_400KHZ_MSB -#endif - -/* I2C configuration with RX interrupts */ -#ifdef I2C_CONF_RX_WITH_INTERRUPT -#define I2C_RX_WITH_INTERRUPT I2C_CONF_RX_WITH_INTERRUPT -#else /* I2C_CONF_RX_WITH_INTERRUPT */ -#define I2C_RX_WITH_INTERRUPT 1 -#endif /* I2C_CONF_RX_WITH_INTERRUPT */ - -/* Platform-specific define for the end of the stack region */ -#define STACK_CONF_ORIGIN ((void *)0x3100) - -#endif /* PLATFORM_CONF_H_ */ diff --git a/arch/platform/zoul/Makefile.zoul b/arch/platform/zoul/Makefile.zoul deleted file mode 100644 index e65290b42..000000000 --- a/arch/platform/zoul/Makefile.zoul +++ /dev/null @@ -1,90 +0,0 @@ -### Zoul Makefile - -ifndef CONTIKI - $(error CONTIKI not defined! You must specify where CONTIKI resides!) -endif - -### If no board is specified the default option is the RE-Mote revision B -BOARD ?= remote-revb -BOARDS = remote-reva remote-revb firefly-reva firefly orion - -### As previously the RE-Mote revision A was plainly defined as remote, keep for -### backward compatibility -ifeq ($(BOARD), remote) - override BOARD = remote-reva -endif - -PYTHON = python -BSL_FLAGS += -e -w -v - -BSL_SPEED ?= 460800 - -# Works in Linux and probably on OSX too (RTCC example) -CFLAGS += -DDATE="\"`date +"%02u %02d %02m %02y %02H %02M %02S"`\"" - -### Configure the build for the board and pull in board-specific sources -CONTIKI_TARGET_DIRS += . dev -CONTIKI_TARGET_DIRS += . $(BOARD) -PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET) - -### Include the board dir if one exists --include $(PLATFORM_ROOT_DIR)/$(BOARD)/Makefile.$(BOARD) - -### Include -CONTIKI_TARGET_SOURCEFILES += platform.c leds-arch.c -CONTIKI_TARGET_SOURCEFILES += leds.c cc1200-zoul-arch.c -CONTIKI_TARGET_SOURCEFILES += adc-zoul.c board-buttons.c zoul-sensors.c -CONTIKI_TARGET_SOURCEFILES += $(BOARD_SOURCEFILES) - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -### Define the CPU directory -CONTIKI_CPU=$(ARCH_PATH)/cpu/cc2538 -include $(CONTIKI_CPU)/Makefile.cc2538 - -MODULES += arch/dev/cc1200 arch/dev/rgb-led os/storage/cfs - -BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py - -MOTES := $(shell python $(TOOLS_DIR)/motelist/motelist.py --omit-header \ - | grep $(MOTELIST_ZOLERTIA) | cut -f1 -d " ") - -### If PORT is defined, override to keep backward compatibility -ifdef PORT - MOTES := $(PORT) -endif - -### Check the BSL script exists -ifeq ($(wildcard $(BSL)), ) -%.upload: - @echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?" -else -### Upload to every MOTE -%.upload: $(foreach MOTE,$(MOTES),%.$(MOTE)) - @# Dummy recipe to prevent "No rule to make *.upload errors" -endif - -### Variable that expands into a pattern rule to upload to a given MOTE. -### Requires $(MOTE) to be defined -### $$$$ Double escapes $s that need to be passed to the shell - once for when -### make parses UPLOAD_RULE, and once for when the expanded rule is parsed by make. -define UPLOAD_RULE -%.$(MOTE): $(OUT_BIN) $(OUT_ELF) - @echo "Flashing $(MOTE)" - @BSL_ADDRESS=`$(OBJDUMP) -h $(BUILD_DIR_BOARD)/$$*.elf | grep -B1 LOAD | \ - grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$$$5}' | \ - sort -g | head -1`; \ - $(PYTHON) $(BSL) $(BSL_FLAGS) -b $(BSL_SPEED) -a $$$${BSL_ADDRESS} -p $(MOTE) $$< -endef - -### Create an upload rule for every MOTE connected -$(foreach MOTE,$(MOTES),$(eval $(UPLOAD_RULE))) - -.PHONY: zoul-motes - -zoul-motes: - @echo $(MOTES) - -### For the login etc targets -BAUDRATE = 115200 -PORT = $(USBDEVPREFIX)$(firstword $(MOTES)) diff --git a/arch/platform/zoul/contiki-conf.h b/arch/platform/zoul/contiki-conf.h deleted file mode 100644 index a4c455d86..000000000 --- a/arch/platform/zoul/contiki-conf.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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. - */ -/** - * \addtogroup zoul-core - * @{ - * - * \defgroup zoul-platforms Zolertia Zoul platforms - * - * The Zoul allows a fast reuse and easy integration to most applications and - * products. Its small size and module format eases to place in different PCB - * designs and to integrate in existing products. The Zoul-based platforms - * share most of the Zoul core implementation. - * - * \file - * Configuration for the Zoul-based platforms - */ -#ifndef CONTIKI_CONF_H_ -#define CONTIKI_CONF_H_ - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Include Project Specific conf */ -#ifdef PROJECT_CONF_PATH -#include PROJECT_CONF_PATH -#endif /* PROJECT_CONF_PATH */ -/*---------------------------------------------------------------------------*/ -#include "cc2538-def.h" - -unsigned radio_phy_overhead(void); -unsigned radio_byte_air_time(void); -unsigned radio_delay_before_tx(void); -unsigned radio_delay_before_rx(void); -unsigned radio_delay_before_detect(void); -uint16_t *radio_tsch_timeslot_timing(void); - -/** @} */ -/*---------------------------------------------------------------------------*/ - -#define RADIO_PHY_OVERHEAD radio_phy_overhead() -#define RADIO_BYTE_AIR_TIME radio_byte_air_time() -#define RADIO_DELAY_BEFORE_TX radio_delay_before_tx() -#define RADIO_DELAY_BEFORE_RX radio_delay_before_rx() -#define RADIO_DELAY_BEFORE_DETECT radio_delay_before_detect() - -#define TSCH_CONF_DEFAULT_TIMESLOT_TIMING radio_tsch_timeslot_timing() - -/*---------------------------------------------------------------------------*/ -/** - * \name Serial Boot Loader Backdoor configuration - * - * @{ - */ -#ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR -#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR 1 /** -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -typedef struct { - int type; - uint8_t pin_mask; - uint8_t vdd3; -} adc_info_t; - -typedef struct { - uint8_t sensors_num; - uint8_t sensors_ports; - adc_info_t sensor[ADC_SENSORS_MAX]; -} adc_wrapper_t; - -static adc_wrapper_t sensors; -/*---------------------------------------------------------------------------*/ -static uint16_t -convert_to_value(uint8_t index) -{ - uint32_t value; - value = adc_zoul.value(sensors.sensor[index].pin_mask); - - if(value == ZOUL_SENSORS_ERROR) { - PRINTF("ADC sensors: failed retrieving data\n"); - return ADC_WRAPPER_ERROR; - } - - /* Default voltage divisor relation is 5/3 aprox, change at adc_wrapper.h, - * calculations below assume a decimation rate of 512 (12 bits ENOB) and - * AVVD5 voltage reference of 3.3V - */ - - if(!sensors.sensor[index].vdd3) { - value *= ADC_WRAPPER_EXTERNAL_VREF; - value /= ADC_WRAPPER_EXTERNAL_VREF_CROSSVAL; - } - - switch(sensors.sensor[index].type) { - case ANALOG_GROVE_LIGHT: - /* Light dependant resistor (LDR) resistance value*/ - value = (10230 - (value * 10)) / value; - /* TODO: With the resistance we could calculate the lux as 63*R^(-0.7) */ - return (uint16_t)value; - - case ANALOG_GROVE_LOUDNESS: - /* Based on the LM2904 amplifier (blue version with potentiometer) */ - return (uint16_t)value; - - case ANALOG_PHIDGET_ROTATION_1109: - /* Linear sensor with 0-300º, 300/33000 = 0.00909 */ - value *= 909; - value /= 100000; - return (uint16_t)value; - - /* VDD+5 sensors */ - case ANALOG_VAC_SENSOR: - /* Linear sensor from 0 to 5 V; 0.0088 resolution*/ - value *= 88; - value /= 10000; - return (uint16_t)value; - - case ANALOG_AAC_SENSOR: - /* Linear sensor from 0 to 5 V;*/ - return (uint16_t)value; - - default: - return ADC_WRAPPER_ERROR; - } - - return ADC_WRAPPER_ERROR; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -is_sensor_in_list(int type) -{ - uint8_t i; - - for(i = 0; i <= sensors.sensors_num; i++) { - if(sensors.sensor[i].type == type) { - return i + 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - uint8_t index; - uint16_t sensor_value; - - index = is_sensor_in_list(type); - - if(!index) { - PRINTF("ADC sensors: sensor not registered\n"); - return ADC_WRAPPER_SUCCESS; - } - - /* Restore index value after the check */ - index -= 1; - sensor_value = convert_to_value(index); - - return sensor_value; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - uint8_t pin_mask = GPIO_PIN_MASK(value); - - if((type != ANALOG_GROVE_LIGHT) && (type != ANALOG_PHIDGET_ROTATION_1109) && - (type != ANALOG_GROVE_LOUDNESS) && (type != ANALOG_VAC_SENSOR) && - (type != ANALOG_AAC_SENSOR) ) { - PRINTF("ADC sensors: sensor not supported, check adc_wrapper.h header\n"); - return ADC_WRAPPER_ERROR; - } - - if(sensors.sensors_num >= ADC_SENSORS_MAX) { - PRINTF("ADC sensors: all adc channels available have been assigned\n"); - return ADC_WRAPPER_ERROR; - } - - if((value < 0x01) || (value > 0x07) || ((value == BUTTON_USER_PIN) && (ADC_SENSORS_ADC6_PIN < 0))) { - PRINTF("ADC sensors: invalid pin value, (PA0-PA1, PA3) are reserved\n"); - return ADC_WRAPPER_ERROR; - } - - if(sensors.sensors_ports & pin_mask) { - PRINTF("ADC sensors: a sensor has been already assigned to this pin\n"); - return ADC_WRAPPER_ERROR; - } - - switch(type) { - /* V+3.3 sensors */ - case ANALOG_GROVE_LIGHT: - case ANALOG_GROVE_LOUDNESS: - case ANALOG_PHIDGET_ROTATION_1109: - if(adc_zoul.configure(SENSORS_HW_INIT, pin_mask) == ZOUL_SENSORS_ERROR) { - return ADC_WRAPPER_ERROR; - } - sensors.sensor[sensors.sensors_num].type = type; - sensors.sensor[sensors.sensors_num].pin_mask = pin_mask; - sensors.sensor[sensors.sensors_num].vdd3 = 1; - break; - - /*V+5 sensors*/ - case ANALOG_VAC_SENSOR: - case ANALOG_AAC_SENSOR: - if(adc_zoul.configure(SENSORS_HW_INIT, pin_mask) == ZOUL_SENSORS_ERROR) { - return ADC_WRAPPER_ERROR; - } - sensors.sensor[sensors.sensors_num].type = type; - sensors.sensor[sensors.sensors_num].pin_mask = pin_mask; - sensors.sensor[sensors.sensors_num].vdd3 = 0; - break; - - - default: - return ADC_WRAPPER_ERROR; - } - - PRINTF("ADC sensors: type %u mask 0x%02X vdd3 %u\n", - sensors.sensor[sensors.sensors_num].type, - sensors.sensor[sensors.sensors_num].pin_mask, - sensors.sensor[sensors.sensors_num].vdd3); - - sensors.sensors_num++; - sensors.sensors_ports |= pin_mask; - - return ADC_WRAPPER_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(adc_sensors, ADC_SENSORS, value, configure, NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ - diff --git a/arch/platform/zoul/dev/adc-sensors.h b/arch/platform/zoul/dev/adc-sensors.h deleted file mode 100644 index 769e9d97c..000000000 --- a/arch/platform/zoul/dev/adc-sensors.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-adc-sensors Zoul adc wrapper to use analogue sensors - * - * The ADC wrapper implement analogue sensors on top of the ADC interface, - * obscuring the ADC configuration and required calculations to obtain actual - * sensor values. The driver allows to reuse the adc-wrapper implementation and - * add sensors easily, without duplicating code, providing also a simplified - * interface and exposing the available ADC assigned channels by a given - * platform. - * - * To use a given sensor simply use: adc_sensors.configure(SENSOR_NAME, pin_no), - * where pin_no is a given pin in the PA port, check out the board.h for more - * information on available pins. To read a value just use - * adc_sensors.value(SENSOR_NAME), the expected result would be the sensor value - * already converted to the sensor variable type, check the adc-wrapper file - * for more information. - * - * @{ - * - * \file - * Header file for the Zoul ADC sensors API - */ -/*---------------------------------------------------------------------------*/ -#ifndef ADC_SENSORS_H_ -#define ADC_SENSORS_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -#include "dev/soc-adc.h" -#include "dev/adc-zoul.h" -/*---------------------------------------------------------------------------*/ -#define ADC_WRAPPER_SUCCESS 0x00 -#define ADC_WRAPPER_ERROR (-1) -#define ADC_WRAPPER_EXTERNAL_VREF 5000 -#define ADC_WRAPPER_EXTERNAL_VREF_CROSSVAL 3000 -/*---------------------------------------------------------------------------*/ -#define ANALOG_GROVE_LIGHT 0x01 -#define ANALOG_PHIDGET_ROTATION_1109 0x02 -#define ANALOG_GROVE_LOUDNESS 0x03 -#define ANALOG_VAC_SENSOR 0x04 -#define ANALOG_AAC_SENSOR 0x05 -/* -------------------------------------------------------------------------- */ -#define ADC_SENSORS "ADC sensors API" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor adc_sensors; -/*---------------------------------------------------------------------------*/ -#endif /* ADC_SENSORS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/dev/adc-zoul.c b/arch/platform/zoul/dev/adc-zoul.c deleted file mode 100644 index 1b9dbc974..000000000 --- a/arch/platform/zoul/dev/adc-zoul.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-adc-interface - * @{ - * - * \file - * Generic driver for the Zoul ADC interface - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/clock.h" -#include "dev/ioc.h" -#include "dev/gpio.h" -#include "dev/adc.h" -#include "adc-zoul.h" -#include "zoul-sensors.h" -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -static uint8_t decimation_rate; -static uint8_t enabled_channels; -/*---------------------------------------------------------------------------*/ -static int -set_decimation_rate(uint8_t rate) -{ - switch(rate) { - case SOC_ADC_ADCCON_DIV_64: - case SOC_ADC_ADCCON_DIV_128: - case SOC_ADC_ADCCON_DIV_256: - case SOC_ADC_ADCCON_DIV_512: - decimation_rate = rate; - break; - default: - return ZOUL_SENSORS_ERROR; - } - - return decimation_rate; -} -/*---------------------------------------------------------------------------*/ -static int -get_channel_pin(int type) -{ - if((ZOUL_SENSORS_ADC1) && (type == ZOUL_SENSORS_ADC1)) { - return SOC_ADC_ADCCON_CH_AIN0 + ADC_SENSORS_ADC1_PIN; - } - if((ZOUL_SENSORS_ADC2) && (type == ZOUL_SENSORS_ADC2)) { - return SOC_ADC_ADCCON_CH_AIN0 + ADC_SENSORS_ADC2_PIN; - } - if((ZOUL_SENSORS_ADC3) && (type == ZOUL_SENSORS_ADC3)) { - return SOC_ADC_ADCCON_CH_AIN0 + ADC_SENSORS_ADC3_PIN; - } - if((ZOUL_SENSORS_ADC4) && (type == ZOUL_SENSORS_ADC4)) { - return SOC_ADC_ADCCON_CH_AIN0 + ADC_SENSORS_ADC4_PIN; - } - if((ZOUL_SENSORS_ADC5) && (type == ZOUL_SENSORS_ADC5)) { - return SOC_ADC_ADCCON_CH_AIN0 + ADC_SENSORS_ADC5_PIN; - } - if((ZOUL_SENSORS_ADC6) && (type == ZOUL_SENSORS_ADC6)) { - return SOC_ADC_ADCCON_CH_AIN0 + ADC_SENSORS_ADC6_PIN; - } - return ZOUL_SENSORS_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - int channel; - int16_t res; - - if(!(type & enabled_channels)) { - PRINTF("ADC: channel not enabled\n"); - return ZOUL_SENSORS_ERROR; - } - - channel = get_channel_pin(type); - - if(channel == ZOUL_SENSORS_ERROR) { - PRINTF("ADC: pin not active\n"); - return ZOUL_SENSORS_ERROR; - } - - res = adc_get(channel, ADC_SENSORS_REFERENCE, decimation_rate); - - /* Only allow negative values if using differential input */ - if((ADC_SENSORS_REFERENCE != SOC_ADC_ADCCON_REF_EXT_DIFF) && (res < 0)) { - res = 0; - } - - return res; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - - /* This should filter out disabled sensors as its value should be zero */ - if((value < ZOUL_SENSORS_ADC_MIN) || (value > ZOUL_SENSORS_ADC_ALL)) { - PRINTF("ADC: invalid adc pin mask (0x%02X)\n", value); - return ZOUL_SENSORS_ERROR; - } - - GPIO_SOFTWARE_CONTROL(GPIO_A_BASE, value); - GPIO_SET_INPUT(GPIO_A_BASE, value); - - if(value & ZOUL_SENSORS_ADC1) { - ioc_set_over(GPIO_A_NUM, ADC_SENSORS_ADC1_PIN, IOC_OVERRIDE_ANA); - } - if(value & ZOUL_SENSORS_ADC2) { - ioc_set_over(GPIO_A_NUM, ADC_SENSORS_ADC2_PIN, IOC_OVERRIDE_ANA); - } - if(value & ZOUL_SENSORS_ADC3) { - ioc_set_over(GPIO_A_NUM, ADC_SENSORS_ADC3_PIN, IOC_OVERRIDE_ANA); - } - if(value & ZOUL_SENSORS_ADC4) { - ioc_set_over(GPIO_A_NUM, ADC_SENSORS_ADC4_PIN, IOC_OVERRIDE_ANA); - } - if(value & ZOUL_SENSORS_ADC5) { - ioc_set_over(GPIO_A_NUM, ADC_SENSORS_ADC5_PIN, IOC_OVERRIDE_ANA); - } - if(value & ZOUL_SENSORS_ADC6) { - ioc_set_over(GPIO_A_NUM, ADC_SENSORS_ADC6_PIN, IOC_OVERRIDE_ANA); - } - adc_init(); - set_decimation_rate(SOC_ADC_ADCCON_DIV_512); - enabled_channels |= value; - PRINTF("ADC: enabled channels 0x%02X\n", enabled_channels); - break; - - case ZOUL_SENSORS_CONFIGURE_TYPE_DECIMATION_RATE: - return set_decimation_rate((uint8_t)value); - - default: - return ZOUL_SENSORS_ERROR; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(adc_zoul, ADC_ZOUL, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ - diff --git a/arch/platform/zoul/dev/adc-zoul.h b/arch/platform/zoul/dev/adc-zoul.h deleted file mode 100644 index fca2643eb..000000000 --- a/arch/platform/zoul/dev/adc-zoul.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-adc-interface Zoul Generic ADC interface - * - * Driver for the Zoul ADC interface - * - * This driver supports analogue sensors connected to ADC1, ADC2, ADC3, - * ADC4, ADC5 and ADC6 inputs. ADC6 is shared with the user button, so disable - * user button if ADC6 is needed. - * This is controlled by the type argument of the value() function. Possible - * choices are: - * - * - ZOUL_SENSORS_ADC1 - * - ZOUL_SENSORS_ADC2 - * - ZOUL_SENSORS_ADC3 - * - ZOUL_SENSORS_ADC4 - * - ZOUL_SENSORS_ADC5 - * - ZOUL_SENSORS_ADC6 - * - * To initialize the ADC sensors use the configure() function, using as first - * argument SENSORS_HW_INIT, and choose which ADC channels to enable passing as - * second argument any single or combined (sum) values as below: - * - * - Either use multiple values (i.e ZOUL_SENSORS_ADC1 + ZOUL_SENSORS_ADC2) - * - ZOUL_SENSORS_ADC_ALL (all channels above) - * - * Using an invalid combination will return ZOUL_SENSORS_ERROR. - * - * The decimation rate can be set by passing - * ZOUL_SENSORS_CONFIGURE_TYPE_DECIMATION_RATE as the type argument to the - * configure() function and then specifying the rate through the value - * argument. Valid values are: - * - * - SOC_ADC_ADCCON_DIV_64 (64 bit rate) - * - SOC_ADC_ADCCON_DIV_128 (128 bit rate) - * - SOC_ADC_ADCCON_DIV_256 (256 bit rate) - * - SOC_ADC_ADCCON_DIV_512 (512 bit rate) - * @{ - * - * \file - * Header file for the Zoul ADC interface - */ -/*---------------------------------------------------------------------------*/ -#ifndef ADC_ZOUL_H_ -#define ADC_ZOUL_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -#include "dev/soc-adc.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Generic ADC sensors - * @{ - */ -#define ADC_ZOUL "ADC sensor interface" -#define ADC_SENSORS_PORT_BASE GPIO_PORT_TO_BASE(ADC_SENSORS_PORT) - -#ifdef ADC_SENSORS_CONF_REFERENCE -#define ADC_SENSORS_REFERENCE ADC_SENSORS_CONF_REFERENCE -#else -#define ADC_SENSORS_REFERENCE SOC_ADC_ADCCON_REF_AVDD5 -#endif - -/* - * PA0-PA3 are hardcoded to UART0 and the user button for most Zolertia - * platforms, the following assumes PA0-1 shall not be used as ADC input, else - * re-write the below definitions - */ -#define ZOUL_SENSORS_ADC_MIN 2 /**< PA1 pin mask */ - -/* ADC phidget-like connector ADC1 */ -#if ADC_SENSORS_ADC1_PIN >= ZOUL_SENSORS_ADC_MIN -#define ZOUL_SENSORS_ADC1 GPIO_PIN_MASK(ADC_SENSORS_ADC1_PIN) -#else -#define ZOUL_SENSORS_ADC1 0 -#endif -/* ADC phidget-like connector ADC2 */ -#if ADC_SENSORS_ADC2_PIN >= ZOUL_SENSORS_ADC_MIN -#define ZOUL_SENSORS_ADC2 GPIO_PIN_MASK(ADC_SENSORS_ADC2_PIN) -#else -#define ZOUL_SENSORS_ADC2 0 -#endif -/* ADC phidget-like connector ADC3 */ -#if ADC_SENSORS_ADC3_PIN >= ZOUL_SENSORS_ADC_MIN -#define ZOUL_SENSORS_ADC3 GPIO_PIN_MASK(ADC_SENSORS_ADC3_PIN) -#else -#define ZOUL_SENSORS_ADC3 0 -#endif -/* ADC phidget-like connector ADC4 */ -#if ADC_SENSORS_ADC4_PIN >= ZOUL_SENSORS_ADC_MIN -#define ZOUL_SENSORS_ADC4 GPIO_PIN_MASK(ADC_SENSORS_ADC4_PIN) -#else -#define ZOUL_SENSORS_ADC4 0 -#endif -/* ADC phidget-like connector ADC5 */ -#if ADC_SENSORS_ADC5_PIN >= ZOUL_SENSORS_ADC_MIN -#define ZOUL_SENSORS_ADC5 GPIO_PIN_MASK(ADC_SENSORS_ADC5_PIN) -#else -#define ZOUL_SENSORS_ADC5 0 -#endif - -/* ADC phidget-like connector ADC6 */ -#if ADC_SENSORS_ADC6_PIN >= ZOUL_SENSORS_ADC_MIN -#define ZOUL_SENSORS_ADC6 GPIO_PIN_MASK(ADC_SENSORS_ADC6_PIN) -#else -#define ZOUL_SENSORS_ADC6 0 -#endif -/* - * This is safe as the disabled sensors should have a zero value thus not - * affecting the mask operations - */ -#define ZOUL_SENSORS_ADC_ALL (ZOUL_SENSORS_ADC1 + ZOUL_SENSORS_ADC2 + \ - ZOUL_SENSORS_ADC3 + ZOUL_SENSORS_ADC4 + \ - ZOUL_SENSORS_ADC5 + ZOUL_SENSORS_ADC6) -/** @} */ -/*---------------------------------------------------------------------------*/ -extern const struct sensors_sensor adc_zoul; -/*---------------------------------------------------------------------------*/ -#endif /* ADC_ZOUL_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/dev/antenna-sw.c b/arch/platform/zoul/dev/antenna-sw.c deleted file mode 100644 index 3266b66cc..000000000 --- a/arch/platform/zoul/dev/antenna-sw.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-antenna - * @{ - * - * Driver for the RE-Mote RF switch, to enable either the built-in 2.4GHz RF - * interface of the CC2538, or the CC1200 Sub-1GHz RF interface, both routed to - * the RP-SMA connector for an external antenna. - * When the 2.4GHz RF interface is enabled, the CC1200 is powered down. - * When the CC1200 is enabled, alternatively the 2.4GHz can be also used if - * placing an 0Ohm resistor (R19), to connect either via a non-mounted chip - * antenna, or with an external antenna connected to a non-mounted U.Fl - * connector with a pigtail. - * - * RF switch state: - * - LOW: 2.4GHz RF interface on RP-SMA connector, CC1200 powered-off. - * - HIGH: Sub-1GHz RF interface on RP-SMA connector. - * @{ - * - * \file - * Driver for the RE-Mote RF antenna switch - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio.h" -#include "antenna-sw.h" - -#include -/*---------------------------------------------------------------------------*/ -#define ANTENNA_RF_SW_PORT_BASE GPIO_PORT_TO_BASE(ANTENNA_RF_SW_PORT) -#define ANTENNA_RF_SW_PIN_MASK GPIO_PIN_MASK(ANTENNA_RF_SW_PIN) -/*---------------------------------------------------------------------------*/ -static uint8_t initialized = 0; -/*---------------------------------------------------------------------------*/ -void -antenna_sw_config(void) -{ - /* Software controlled */ - GPIO_SOFTWARE_CONTROL(ANTENNA_RF_SW_PORT_BASE, - ANTENNA_RF_SW_PIN_MASK); - - /* Set pin to output */ - GPIO_SET_OUTPUT(ANTENNA_RF_SW_PORT_BASE, ANTENNA_RF_SW_PIN_MASK); - - /* Set the antenna selector to a default position */ - GPIO_WRITE_PIN(ANTENNA_RF_SW_PORT_BASE, ANTENNA_RF_SW_PIN_MASK, - ANTENNA_SW_SELECT_DEFAULT); - - initialized = 1; -} -/*---------------------------------------------------------------------------*/ -int -antenna_sw_get(void) -{ - if(!initialized) { - return ANTENNA_SW_SELECT_ERROR; - } - - /* Set the antenna selector */ - return GPIO_READ_PIN(ANTENNA_RF_SW_PORT_BASE, ANTENNA_RF_SW_PIN_MASK); -} -/*---------------------------------------------------------------------------*/ -int -antenna_sw_select(uint8_t val) -{ - if(!initialized) { - return ANTENNA_SW_SELECT_ERROR; - } - - if(val != ANTENNA_SW_SELECT_SUBGHZ && val != ANTENNA_SW_SELECT_2_4GHZ) { - return ANTENNA_SW_SELECT_ERROR; - } - - if(val & antenna_sw_get()) { - return val; - } - - /* Set the antenna selector */ - GPIO_WRITE_PIN(ANTENNA_RF_SW_PORT_BASE, ANTENNA_RF_SW_PIN_MASK, val); - - return val; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/antenna-sw.h b/arch/platform/zoul/dev/antenna-sw.h deleted file mode 100644 index 0e35f9578..000000000 --- a/arch/platform/zoul/dev/antenna-sw.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/* -------------------------------------------------------------------------- */ -/** - * \addtogroup zoul - * @{ - * - * \defgroup remote-antenna RE-Mote Antenna switch - * - * Driver for the RE-Mote RF antenna switch, to enable either the internal - * ceramic antenna or an external one connected to the uFL connector - * @{ - * - * \file - * Header file for the RE-Mote RF antenna switch - */ -/* -------------------------------------------------------------------------- */ -#ifndef ANTENNA_SW_H_ -#define ANTENNA_SW_H_ -/* -------------------------------------------------------------------------- */ -#include -/* -------------------------------------------------------------------------- */ -#define ANTENNA_SW_SELECT_2_4GHZ 0 -#define ANTENNA_SW_SELECT_SUBGHZ (1 << ANTENNA_RF_SW_PIN) -#define ANTENNA_SW_SELECT_ERROR (-1) -/* -------------------------------------------------------------------------- */ -/** - * \brief Init function for the antenna switch - * - * The RE-Mote platform allows to programatically select between the 2.4GHz - * RF interface of the CC2538, or the Sub-1GHz RF interface of the CC1200. - * The function is set to enable the Sub-1GHz as default, - * it should be called from the contiki-main initialization process. - * - * \return ignored - */ -void antenna_sw_config(void); - -/** - * \brief Function to select between the 2.4GHz or Sub-1GHz RF interface - * - * \param val Select antenna. - * 2.4GHz : ANTENNA_SW_SELECT_2_4GHZ or - * Sub-1GHz: ANTENNA_SW_SELECT_SUBGHZ - * \return the selected antenna position, or ANTENNA_SW_SELECT_ERROR if not - * previously configured - */ -int antenna_sw_select(uint8_t val); - -/** - * \brief Function to read the current status of the RF switch - * - * - * \return the selected antenna position, or ANTENNA_SW_SELECT_ERROR if not - * previously configured - */ -int antenna_sw_get(void); -/* -------------------------------------------------------------------------- */ -#endif /* ifndef ANTENNA_SW_H_ */ -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/bme280-arch.c b/arch/platform/zoul/dev/bme280-arch.c deleted file mode 100644 index 0e21f9344..000000000 --- a/arch/platform/zoul/dev/bme280-arch.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-bme280-sensor - * \ingroup zoul - * - * @{ - * - * \file - * Architecture-specific I2C for the external BME280 weather sensor - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/i2c.h" -/*---------------------------------------------------------------------------*/ -void -bme280_arch_i2c_init(void) -{ - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, - I2C_SCL_NORMAL_BUS_SPEED); -} -/*---------------------------------------------------------------------------*/ -void -bme280_arch_i2c_write_mem(uint8_t addr, uint8_t reg, uint8_t value) -{ - uint8_t buf[2]; - - buf[0] = reg; - buf[1] = value; - - i2c_master_enable(); - i2c_burst_send(addr, buf, 2); -} -/*---------------------------------------------------------------------------*/ -void -bme280_arch_i2c_read_mem(uint8_t addr, uint8_t reg, uint8_t *buf, uint8_t bytes) -{ - i2c_master_enable(); - if(i2c_single_send(addr, reg) == I2C_MASTER_ERR_NONE) { - while(i2c_master_busy()); - i2c_burst_receive(addr, buf, bytes); - } -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/arch/platform/zoul/dev/bmpx8x.c b/arch/platform/zoul/dev/bmpx8x.c deleted file mode 100644 index 41e1b2d13..000000000 --- a/arch/platform/zoul/dev/bmpx8x.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-bmpx8x-sensor - * @{ - * - * BMP085/BMP180 driver implementation - * - * \file - * Driver for the external BMP085/BMP180 atmospheric pressure sensor - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/i2c.h" -#include "dev/gpio.h" -#include "dev/zoul-sensors.h" -#include "lib/sensors.h" -#include "bmpx8x.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -static uint8_t enabled = 0; -/*---------------------------------------------------------------------------*/ -typedef struct { - int16_t ac1; - int16_t ac2; - int16_t ac3; - uint16_t ac4; - uint16_t ac5; - uint16_t ac6; - int16_t b1; - int16_t b2; - int16_t mb; - int16_t mc; - int16_t md; -} bmpx8x_calibration_values; - -typedef struct { - uint8_t oversampling_mode; - int32_t b5; - bmpx8x_calibration_values calib; -} bmpx8x_config; - -static bmpx8x_config bmpx8x_values; -/*---------------------------------------------------------------------------*/ -static int -bmpx8x_read_reg(uint8_t reg, uint8_t *buf, uint8_t num) -{ - if((buf == NULL) || (num <= 0)) { - PRINTF("BMPx8x: invalid read values\n"); - return BMPx8x_ERROR; - } - - i2c_master_enable(); - if(i2c_single_send(BMPx8x_ADDR, reg) == I2C_MASTER_ERR_NONE) { - while(i2c_master_busy()); - if(i2c_burst_receive(BMPx8x_ADDR, buf, num) == I2C_MASTER_ERR_NONE) { - return BMPx8x_SUCCESS; - } - } - return BMPx8x_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -bmpx8x_write_reg(uint8_t *buf, uint8_t num) -{ - if((buf == NULL) || (num <= 0)) { - PRINTF("BMPx8x: invalid write values\n"); - return BMPx8x_ERROR; - } - - i2c_master_enable(); - if(i2c_burst_send(BMPx8x_ADDR, buf, num) == I2C_MASTER_ERR_NONE) { - return BMPx8x_SUCCESS; - } - return BMPx8x_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -bmpx8x_read_calib(void) -{ - uint8_t buf[BMPx8x_CALIB_TABLE_SIZE]; - - if(bmpx8x_read_reg(BMPx8x_AC1_CALIB, buf, - BMPx8x_CALIB_TABLE_SIZE) == BMPx8x_SUCCESS) { - - /* MSB first */ - bmpx8x_values.calib.ac1 = ((buf[0] << 8) + buf[1]); - bmpx8x_values.calib.ac2 = ((buf[2] << 8) + buf[3]); - bmpx8x_values.calib.ac3 = ((buf[4] << 8) + buf[5]); - bmpx8x_values.calib.ac4 = ((buf[6] << 8) + buf[7]); - bmpx8x_values.calib.ac5 = ((buf[8] << 8) + buf[9]); - bmpx8x_values.calib.ac6 = ((buf[10] << 8) + buf[11]); - bmpx8x_values.calib.b1 = ((buf[12] << 8) + buf[13]); - bmpx8x_values.calib.b2 = ((buf[14] << 8) + buf[15]); - bmpx8x_values.calib.mb = ((buf[16] << 8) + buf[17]); - bmpx8x_values.calib.mc = ((buf[18] << 8) + buf[19]); - bmpx8x_values.calib.md = ((buf[20] << 8) + buf[21]); - - return BMPx8x_SUCCESS; - } - - PRINTF("BMPx8x: failed to read calibration\n"); - return BMPx8x_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -bmpx8x_read_uncompensated_pressure(int32_t *pressure) -{ - uint8_t buf[3]; - uint16_t delay; - int32_t upres; - - buf[0] = BMPx8x_CTRL_REG; - - switch(bmpx8x_values.oversampling_mode) { - case BMPx8x_MODE_ULTRA_LOW_POWER: - buf[1] = BMPx8x_CTRL_REG_PRESS_4_5MS; - delay = BMPx8x_DELAY_4_5MS; - break; - case BMPx8x_MODE_STANDARD: - buf[1] = BMPx8x_CTRL_REG_PRESS_7_5MS; - delay = BMPx8x_DELAY_7_5MS; - break; - case BMPx8x_MODE_HIGH_RES: - buf[1] = BMPx8x_CTRL_REG_PRESS_13_5MS; - delay = BMPx8x_DELAY_13_5MS; - break; - case BMPx8x_MODE_ULTRA_HIGH_RES: - buf[1] = BMPx8x_CTRL_REG_PRESS_25_5MS; - delay = BMPx8x_DELAY_25_5MS; - break; - default: - return BMPx8x_ERROR; - } - - if(bmpx8x_write_reg(buf, 2) == BMPx8x_SUCCESS) { - clock_delay_usec(delay); - if(bmpx8x_read_reg(BMPx8x_DATA_MSB, buf, 3) == BMPx8x_SUCCESS) { - upres = (buf[0] << 16) + (buf[1] << 8) + buf[2]; - *pressure = (upres >> (8 - bmpx8x_values.oversampling_mode)); - return BMPx8x_SUCCESS; - } - } - return BMPx8x_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -bmpx8x_read_uncompensated_temperature(int32_t *temp) -{ - uint8_t buf[2]; - buf[0] = BMPx8x_CTRL_REG; - buf[1] = BMPx8x_CTRL_REG_TEMP; - - if(bmpx8x_write_reg(buf, 2) == BMPx8x_SUCCESS) { - clock_delay_usec(BMPx8x_DELAY_4_5MS); - if(bmpx8x_read_reg(BMPx8x_DATA_MSB, buf, 2) == BMPx8x_SUCCESS) { - *temp = (int32_t)((buf[0] << 8) + buf[1]); - return BMPx8x_SUCCESS; - } - } - return BMPx8x_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -bmpx8x_read_temperature(int16_t *temp) -{ - int32_t ut = 0; - int32_t x1, x2; - - if(bmpx8x_read_uncompensated_temperature(&ut) == BMPx8x_ERROR) { - return BMPx8x_ERROR; - } - - x1 = ((int32_t)ut - (int32_t)bmpx8x_values.calib.ac6) - * (int32_t)bmpx8x_values.calib.ac5 >> 15; - x2 = ((int32_t)bmpx8x_values.calib.mc << 11) / (x1 + bmpx8x_values.calib.md); - bmpx8x_values.b5 = x1 + x2; - *temp = (int16_t)((bmpx8x_values.b5 + 8) >> 4); - return BMPx8x_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -bmpx8x_read_pressure(int32_t *pressure) -{ - int32_t ut = 0; - int32_t up = 0; - int32_t x1, x2, b6, x3, b3, p; - uint32_t b4, b7; - - if(bmpx8x_read_uncompensated_pressure(&up) == BMPx8x_ERROR) { - return BMPx8x_ERROR; - } - - if(bmpx8x_read_uncompensated_temperature(&ut) == BMPx8x_ERROR) { - return BMPx8x_ERROR; - } - - b6 = bmpx8x_values.b5 - 4000; - x1 = (bmpx8x_values.calib.b2 * (b6 * b6 >> 12)) >> 11; - x2 = bmpx8x_values.calib.ac2 * b6 >> 11; - x3 = x1 + x2; - b3 = ((((int32_t)bmpx8x_values.calib.ac1) * 4 + x3) + 2) >> 2; - - x1 = (bmpx8x_values.calib.ac3 * b6) >> 13; - x2 = (bmpx8x_values.calib.b1 * ((b6 * b6) >> 12)) >> 16; - x3 = ((x1 + x2) + 2) >> 2; - b4 = (bmpx8x_values.calib.ac4 * ((uint32_t)(x3 + 32768))) >> 15; - b7 = ((uint32_t)up - b3) * 50000; - - if(b7 < 0x80000000) { - p = (b7 << 1) / b4; - } else { - p = (b7 / b4) << 1; - } - - x1 = (p >> 8) * (p >> 8); - x1 = (x1 * 3038) >> 16; - x2 = (-7357 * p) >> 16; - *pressure = (p + ((x1 + x2 + 3791) >> 4)); - *pressure /= 10; - - return BMPx8x_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if((type != BMPx8x_ACTIVE) && (type != BMPx8x_OVERSAMPLING)) { - PRINTF("BMPx8x: invalid start value\n"); - return BMPx8x_ERROR; - } - - if(type == BMPx8x_ACTIVE) { - if(value) { - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, - I2C_SCL_NORMAL_BUS_SPEED); - - /* Read the calibration values */ - if(bmpx8x_read_calib() != BMPx8x_ERROR) { - PRINTF("BMPx8x: sensor started\n"); - enabled = 1; - bmpx8x_values.oversampling_mode = BMPx8x_MODE_ULTRA_LOW_POWER; - return BMPx8x_SUCCESS; - } - - PRINTF("BMPx8x: failed to enable\n"); - return BMPx8x_ERROR; - } else { - enabled = 0; - return BMPx8x_SUCCESS; - } - } else if(type == BMPx8x_OVERSAMPLING) { - if((value < BMPx8x_MODE_ULTRA_LOW_POWER) || - (value > BMPx8x_MODE_ULTRA_HIGH_RES)) { - PRINTF("BMPx8x: invalid oversampling value\n"); - return BMPx8x_ERROR; - } - bmpx8x_values.oversampling_mode = value; - return BMPx8x_SUCCESS; - } - - return BMPx8x_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -bmpx8x_read_sensor(int32_t *value, uint8_t type) -{ - int16_t temp = 0; - - /* The temperature is required to compensate the pressure value */ - if(bmpx8x_read_temperature(&temp) != BMPx8x_SUCCESS) { - return BMPx8x_ERROR; - } - - switch(type) { - case BMPx8x_READ_PRESSURE: - return bmpx8x_read_pressure(value); - - case BMPx8x_READ_TEMP: - *value = (int16_t) temp; - return BMPx8x_SUCCESS; - } - - return BMPx8x_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - int32_t value; - - if(!enabled) { - PRINTF("BMPx8x: sensor not started\n"); - return BMPx8x_ERROR; - } - - if((type != BMPx8x_READ_PRESSURE) && (type != BMPx8x_READ_TEMP)) { - PRINTF("BMPx8x: invalid read value\n"); - return BMPx8x_ERROR; - } - - if(bmpx8x_read_sensor(&value, type) == BMPx8x_SUCCESS) { - return (int)value; - } - - PRINTF("BMPx8x: fail to read\n"); - return BMPx8x_ERROR; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(bmpx8x, BMPx8x_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/bmpx8x.h b/arch/platform/zoul/dev/bmpx8x.h deleted file mode 100644 index 75f768bef..000000000 --- a/arch/platform/zoul/dev/bmpx8x.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-bmpx8x-sensor BMP085/BMP180 Sensor - * - * Driver for the BMP085/BMP180 sensor - * - * BMP085/BMP180 digital atmospheric pressure and temperature driver - * @{ - * - * \file - * Header file for the external BMP085/BMP180 Sensor Driver - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#ifndef BMPX8X_H_ -#define BMPX8X_H_ -#include -#include "lib/sensors.h" -#include "dev/zoul-sensors.h" -#include "i2c.h" -/* -------------------------------------------------------------------------- */ -/** - * \name BMPx8x address and registers - * @{ - */ -/* -------------------------------------------------------------------------- */ -#define BMPx8x_ADDR 0x77 -/* -------------------------------------------------------------------------- */ -/* Control register */ -#define BMPx8x_CTRL_REG 0xF4 -/* Read uncompensated temperature */ -#define BMPx8x_CTRL_REG_TEMP 0x2E -/* Read uncompensated pressure, no oversampling */ -#define BMPx8x_CTRL_REG_PRESS_4_5MS 0x34 -/* Read uncompensated pressure, oversampling 1*/ -#define BMPx8x_CTRL_REG_PRESS_7_5MS 0x74 -/* Read uncompensated pressure, oversampling 2 */ -#define BMPx8x_CTRL_REG_PRESS_13_5MS 0xB4 -/* Read uncompensated pressure, oversampling 3 */ -#define BMPx8x_CTRL_REG_PRESS_25_5MS 0xF4 -/* -------------------------------------------------------------------------- */ -#define BMPx8x_DATA_MSB 0xF6 -#define BMPx8x_DATA_LSB 0xF7 -/* 19-bit resolution */ -#define BMPx8x_DATA_XLSB 0xF8 -/* -------------------------------------------------------------------------- */ -/* Calibration registers, 16-bit wide */ -#define BMPx8x_AC1_CALIB 0xAA -#define BMPx8x_AC2_CALIB 0xAC -#define BMPx8x_AC3_CALIB 0xAE -#define BMPx8x_AC4_CALIB 0xB0 -#define BMPx8x_AC5_CALIB 0xB2 -#define BMPx8x_AC6_CALIB 0xB4 -#define BMPx8x_B1_CALIB 0xB6 -#define BMPx8x_B2_CALIB 0xB8 -#define BMPx8x_MB_CALIB 0xBA -#define BMPx8x_MC_CALIB 0xBC -#define BMPx8x_MD_CALIB 0xBE -#define BMPx8x_CALIB_TABLE_SIZE 22 /**< size in bytes */ -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name BMPx8x operation modes - * @{ - */ -#define BMPx8x_MODE_ULTRA_LOW_POWER 0x00 -#define BMPx8x_MODE_STANDARD 0x01 -#define BMPx8x_MODE_HIGH_RES 0x02 -#define BMPx8x_MODE_ULTRA_HIGH_RES 0x03 -/* -------------------------------------------------------------------------- */ -#define BMPx8x_DELAY_4_5MS 4700 -#define BMPx8x_DELAY_7_5MS 7700 -#define BMPx8x_DELAY_13_5MS 13700 -#define BMPx8x_DELAY_25_5MS 25700 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name BMPx8x return and command values - * @{ - */ -#define BMPx8x_SUCCESS 0x00 -#define BMPx8x_ERROR -1 - -#define BMPx8x_ACTIVE SENSORS_ACTIVE -#define BMPx8x_OVERSAMPLING 0x00 -#define BMPx8x_READ_PRESSURE 0x01 -#define BMPx8x_READ_TEMP 0x02 -/** @} */ -/* -------------------------------------------------------------------------- */ -#define BMPx8x_SENSOR "BMP085/BMP180 pressure and temperature sensor" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor bmpx8x; -/* -------------------------------------------------------------------------- */ -#endif -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/dev/board-buttons.c b/arch/platform/zoul/dev/board-buttons.c deleted file mode 100644 index 93532caa4..000000000 --- a/arch/platform/zoul/dev/board-buttons.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul - * @{ - * - * \defgroup zoul-buttons Zoul user button - * - * Generic module controlling the user button on the Zoul - * @{ - * - * \file - * Defines the Zoul user button for use with the button HAL - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/button-hal.h" -/*---------------------------------------------------------------------------*/ -#if PLATFORM_HAS_BUTTON -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTON(button_user, "User button", \ - GPIO_PORT_PIN_TO_GPIO_HAL_PIN(BUTTON_USER_PORT, BUTTON_USER_PIN), \ - GPIO_HAL_PIN_CFG_PULL_UP, BUTTON_HAL_ID_USER_BUTTON, true); -/*---------------------------------------------------------------------------*/ -BUTTON_HAL_BUTTONS(&button_user); -/*---------------------------------------------------------------------------*/ -#endif -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/cc1200-zoul-arch.c b/arch/platform/zoul/dev/cc1200-zoul-arch.c deleted file mode 100644 index b0fd8dd96..000000000 --- a/arch/platform/zoul/dev/cc1200-zoul-arch.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul - * @{ - * - * \defgroup zoul-cc1200 Zoul CC1200 arch - * - * CC1200 Zoul arch specifics - * @{ - * - * \file - * CC1200 Zoul arch specifics - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "contiki-net.h" -#include "dev/leds.h" -#include "reg.h" -#include "dev/spi-arch-legacy.h" -#include "dev/ioc.h" -#include "dev/sys-ctrl.h" -#include "dev/spi-legacy.h" -#include "dev/ssi.h" -#include "dev/gpio.h" -#include "dev/gpio-hal.h" -#include -/*---------------------------------------------------------------------------*/ -#define CC1200_SPI_CLK_PORT_BASE GPIO_PORT_TO_BASE(SPI0_CLK_PORT) -#define CC1200_SPI_CLK_PIN_MASK GPIO_PIN_MASK(SPI0_CLK_PIN) -#define CC1200_SPI_MOSI_PORT_BASE GPIO_PORT_TO_BASE(SPI0_TX_PORT) -#define CC1200_SPI_MOSI_PIN_MASK GPIO_PIN_MASK(SPI0_TX_PIN) -#define CC1200_SPI_MISO_PORT_BASE GPIO_PORT_TO_BASE(SPI0_RX_PORT) -#define CC1200_SPI_MISO_PIN_MASK GPIO_PIN_MASK(SPI0_RX_PIN) -#define CC1200_SPI_CSN_PORT_BASE GPIO_PORT_TO_BASE(CC1200_SPI_CSN_PORT) -#define CC1200_SPI_CSN_PIN_MASK GPIO_PIN_MASK(CC1200_SPI_CSN_PIN) -#define CC1200_GDO0_PORT_BASE GPIO_PORT_TO_BASE(CC1200_GDO0_PORT) -#define CC1200_GDO0_PIN_MASK GPIO_PIN_MASK(CC1200_GDO0_PIN) -#define CC1200_GDO2_PORT_BASE GPIO_PORT_TO_BASE(CC1200_GDO2_PORT) -#define CC1200_GDO2_PIN_MASK GPIO_PIN_MASK(CC1200_GDO2_PIN) -#define CC1200_RESET_PORT_BASE GPIO_PORT_TO_BASE(CC1200_RESET_PORT) -#define CC1200_RESET_PIN_MASK GPIO_PIN_MASK(CC1200_RESET_PIN) -/*---------------------------------------------------------------------------*/ -#ifndef DEBUG_CC1200_ARCH -#define DEBUG_CC1200_ARCH 0 -#endif -/*---------------------------------------------------------------------------*/ -#if DEBUG_CC1200_ARCH > 0 -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -extern int cc1200_rx_interrupt(void); -/*---------------------------------------------------------------------------*/ -void -cc1200_int_handler(gpio_hal_pin_mask_t pin_mask) -{ - /* To keep the gpio_register_callback happy */ - cc1200_rx_interrupt(); -} -/*---------------------------------------------------------------------------*/ -void -cc1200_arch_spi_select(void) -{ - /* Set CSn to low (0) */ - GPIO_CLR_PIN(CC1200_SPI_CSN_PORT_BASE, CC1200_SPI_CSN_PIN_MASK); - /* The MISO pin should go low before chip is fully enabled. */ - RTIMER_BUSYWAIT_UNTIL( - GPIO_READ_PIN(CC1200_SPI_MISO_PORT_BASE, CC1200_SPI_MISO_PIN_MASK) == 0, - RTIMER_SECOND / 100); -} -/*---------------------------------------------------------------------------*/ -void -cc1200_arch_spi_deselect(void) -{ - /* Set CSn to high (1) */ - GPIO_SET_PIN(CC1200_SPI_CSN_PORT_BASE, CC1200_SPI_CSN_PIN_MASK); -} -/*---------------------------------------------------------------------------*/ -int -cc1200_arch_spi_rw_byte(uint8_t c) -{ - SPI_WAITFORTx_BEFORE(); - SPIX_BUF(CC1200_SPI_INSTANCE) = c; - SPIX_WAITFOREOTx(CC1200_SPI_INSTANCE); - SPIX_WAITFOREORx(CC1200_SPI_INSTANCE); - c = SPIX_BUF(CC1200_SPI_INSTANCE); - - return c; -} -/*---------------------------------------------------------------------------*/ -int -cc1200_arch_spi_rw(uint8_t *inbuf, const uint8_t *write_buf, uint16_t len) -{ - int i; - uint8_t c; - - if((inbuf == NULL && write_buf == NULL) || len <= 0) { - return 1; - } else if(inbuf == NULL) { - for(i = 0; i < len; i++) { - SPI_WAITFORTx_BEFORE(); - SPIX_BUF(CC1200_SPI_INSTANCE) = write_buf[i]; - SPIX_WAITFOREOTx(CC1200_SPI_INSTANCE); - SPIX_WAITFOREORx(CC1200_SPI_INSTANCE); - c = SPIX_BUF(CC1200_SPI_INSTANCE); - /* read and discard to avoid "variable set but not used" warning */ - (void)c; - } - } else if(write_buf == NULL) { - for(i = 0; i < len; i++) { - SPI_WAITFORTx_BEFORE(); - SPIX_BUF(CC1200_SPI_INSTANCE) = 0; - SPIX_WAITFOREOTx(CC1200_SPI_INSTANCE); - SPIX_WAITFOREORx(CC1200_SPI_INSTANCE); - inbuf[i] = SPIX_BUF(CC1200_SPI_INSTANCE); - } - } else { - for(i = 0; i < len; i++) { - SPI_WAITFORTx_BEFORE(); - SPIX_BUF(CC1200_SPI_INSTANCE) = write_buf[i]; - SPIX_WAITFOREOTx(CC1200_SPI_INSTANCE); - SPIX_WAITFOREORx(CC1200_SPI_INSTANCE); - inbuf[i] = SPIX_BUF(CC1200_SPI_INSTANCE); - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static gpio_hal_event_handler_t interrupt_handler = { - .next = NULL, - .handler = cc1200_int_handler, - .pin_mask = - (gpio_hal_pin_to_mask(CC1200_GDO0_PIN) << (CC1200_GDO0_PORT << 3)) | - (gpio_hal_pin_to_mask(CC1200_GDO2_PIN) << (CC1200_GDO2_PORT << 3)) -}; -/*---------------------------------------------------------------------------*/ -void -cc1200_arch_gpio0_setup_irq(int rising) -{ - - GPIO_SOFTWARE_CONTROL(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); - GPIO_SET_INPUT(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); - GPIO_DETECT_EDGE(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); - GPIO_TRIGGER_SINGLE_EDGE(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); - - if(rising) { - GPIO_DETECT_RISING(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); - } else { - GPIO_DETECT_FALLING(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); - } - - GPIO_ENABLE_INTERRUPT(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); - ioc_set_over(CC1200_GDO0_PORT, CC1200_GDO0_PIN, IOC_OVERRIDE_PUE); - NVIC_EnableIRQ(CC1200_GPIOx_VECTOR); - gpio_hal_register_handler(&interrupt_handler); -} -/*---------------------------------------------------------------------------*/ -void -cc1200_arch_gpio2_setup_irq(int rising) -{ - - GPIO_SOFTWARE_CONTROL(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); - GPIO_SET_INPUT(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); - GPIO_DETECT_EDGE(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); - GPIO_TRIGGER_SINGLE_EDGE(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); - - if(rising) { - GPIO_DETECT_RISING(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); - } else { - GPIO_DETECT_FALLING(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); - } - - GPIO_ENABLE_INTERRUPT(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); - ioc_set_over(CC1200_GDO2_PORT, CC1200_GDO2_PIN, IOC_OVERRIDE_PUE); - NVIC_EnableIRQ(CC1200_GPIOx_VECTOR); - gpio_hal_register_handler(&interrupt_handler); -} -/*---------------------------------------------------------------------------*/ -void -cc1200_arch_gpio0_enable_irq(void) -{ - GPIO_ENABLE_INTERRUPT(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); - ioc_set_over(CC1200_GDO0_PORT, CC1200_GDO0_PIN, IOC_OVERRIDE_PUE); - NVIC_EnableIRQ(CC1200_GPIOx_VECTOR); -} -/*---------------------------------------------------------------------------*/ -void -cc1200_arch_gpio0_disable_irq(void) -{ - GPIO_DISABLE_INTERRUPT(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); -} -/*---------------------------------------------------------------------------*/ -void -cc1200_arch_gpio2_enable_irq(void) -{ - GPIO_ENABLE_INTERRUPT(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); - ioc_set_over(CC1200_GDO2_PORT, CC1200_GDO2_PIN, IOC_OVERRIDE_PUE); - NVIC_EnableIRQ(CC1200_GPIOx_VECTOR); -} -/*---------------------------------------------------------------------------*/ -void -cc1200_arch_gpio2_disable_irq(void) -{ - GPIO_DISABLE_INTERRUPT(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); -} -/*---------------------------------------------------------------------------*/ -int -cc1200_arch_gpio0_read_pin(void) -{ - return (GPIO_READ_PIN(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK) ? 1 : 0); -} -/*---------------------------------------------------------------------------*/ -int -cc1200_arch_gpio2_read_pin(void) -{ - return GPIO_READ_PIN(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); -} -/*---------------------------------------------------------------------------*/ -int -cc1200_arch_gpio3_read_pin(void) -{ - return 0x00; -} -/*---------------------------------------------------------------------------*/ -void -cc1200_arch_init(void) -{ - /* First leave RESET high */ - GPIO_SOFTWARE_CONTROL(CC1200_RESET_PORT_BASE, CC1200_RESET_PIN_MASK); - GPIO_SET_OUTPUT(CC1200_RESET_PORT_BASE, CC1200_RESET_PIN_MASK); - ioc_set_over(CC1200_RESET_PORT, CC1200_RESET_PIN, IOC_OVERRIDE_OE); - GPIO_SET_PIN(CC1200_RESET_PORT_BASE, CC1200_RESET_PIN_MASK); - - /* Initialize CSn, enable CSn and then wait for MISO to go low*/ - spix_cs_init(CC1200_SPI_CSN_PORT, CC1200_SPI_CSN_PIN); - - /* Initialize SPI */ - spix_init(CC1200_SPI_INSTANCE); - - /* Configure GPIOx */ - GPIO_SOFTWARE_CONTROL(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); - GPIO_SET_INPUT(CC1200_GDO0_PORT_BASE, CC1200_GDO0_PIN_MASK); - GPIO_SOFTWARE_CONTROL(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); - GPIO_SET_INPUT(CC1200_GDO2_PORT_BASE, CC1200_GDO2_PIN_MASK); - - /* Leave CSn as default */ - cc1200_arch_spi_deselect(); - - /* Ensure MISO is high */ - RTIMER_BUSYWAIT_UNTIL( - GPIO_READ_PIN(CC1200_SPI_MISO_PORT_BASE, CC1200_SPI_MISO_PIN_MASK), - RTIMER_SECOND / 10); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/dht22.c b/arch/platform/zoul/dev/dht22.c deleted file mode 100644 index 23174b2e6..000000000 --- a/arch/platform/zoul/dev/dht22.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-dht22 - * @{ - * - * \file - * Driver for the DHT22 temperature and humidity sensor - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dht22.h" -#include "dev/gpio.h" -#include "lib/sensors.h" -#include "dev/ioc.h" -#include "dev/watchdog.h" -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define DHT22_PORT_BASE GPIO_PORT_TO_BASE(DHT22_PORT) -#define DHT22_PIN_MASK GPIO_PIN_MASK(DHT22_PIN) -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -static uint8_t busy; -static uint8_t dht22_data[DHT22_BUFFER]; -/*---------------------------------------------------------------------------*/ -static int -dht22_read(void) -{ - uint8_t i; - uint8_t j = 0; - uint8_t last_state = 0xFF; - uint8_t counter = 0; - uint8_t checksum = 0; - - if(enabled) { - /* Exit low power mode and initialize variables */ - GPIO_SET_OUTPUT(DHT22_PORT_BASE, DHT22_PIN_MASK); - GPIO_SET_PIN(DHT22_PORT_BASE, DHT22_PIN_MASK); - RTIMER_BUSYWAIT(DHT22_AWAKE_TIME); - memset(dht22_data, 0, DHT22_BUFFER); - - /* Initialization sequence */ - GPIO_CLR_PIN(DHT22_PORT_BASE, DHT22_PIN_MASK); - RTIMER_BUSYWAIT(DHT22_START_TIME); - GPIO_SET_PIN(DHT22_PORT_BASE, DHT22_PIN_MASK); - clock_delay_usec(DHT22_READY_TIME); - - /* Prepare to read, DHT22 should keep line low 80us, then 80us high. - * The ready-to-send-bit condition is the line kept low for 50us, then if - * the line is high between 24-25us the bit sent will be "0" (zero), else - * if the line is high between 70-74us the bit sent will be "1" (one). - */ - GPIO_SET_INPUT(DHT22_PORT_BASE, DHT22_PIN_MASK); - - for(i = 0; i < DHT22_MAX_TIMMING; i++) { - counter = 0; - while(GPIO_READ_PIN(DHT22_PORT_BASE, DHT22_PIN_MASK) == last_state) { - counter++; - clock_delay_usec(DHT22_READING_DELAY); - - /* Exit if not responsive */ - if(counter == 0xFF) { - break; - } - } - - last_state = GPIO_READ_PIN(DHT22_PORT_BASE, DHT22_PIN_MASK); - - /* Double check for stray sensor */ - if(counter == 0xFF) { - break; - } - - /* Ignore the first 3 transitions (the 80us x 2 start condition plus the - * first ready-to-send-bit state), and discard ready-to-send-bit counts - */ - if((i >= 4) && ((i % 2) == 0)) { - dht22_data[j / 8] <<= 1; - if(counter > DHT22_COUNT) { - dht22_data[j / 8] |= 1; - } - j++; - } - } - - for(i = 0; i < DHT22_BUFFER; i++) { - PRINTF("DHT22: (%u) %u\n", i, dht22_data[i]); - } - - /* If we have 5 bytes (40 bits), wrap-up and end */ - if(j >= 40) { - /* The first 2 bytes are humidity values, the next 2 are temperature, the - * final byte is the checksum - */ - checksum = dht22_data[0] + dht22_data[1] + dht22_data[2] + dht22_data[3]; - checksum &= 0xFF; - if(dht22_data[4] == checksum) { - GPIO_SET_INPUT(DHT22_PORT_BASE, DHT22_PIN_MASK); - GPIO_SET_PIN(DHT22_PORT_BASE, DHT22_PIN_MASK); - return DHT22_SUCCESS; - } - PRINTF("DHT22: bad checksum\n"); - } - } - return DHT22_ERROR; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -dht22_humidity(void) -{ - uint16_t res; - res = dht22_data[0]; - res *= 256; - res += dht22_data[1]; - busy = 0; - return res; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -dht22_temperature(void) -{ - uint16_t res; - res = dht22_data[2] & 0x7F; - res *= 256; - res += dht22_data[3]; - busy = 0; - return res; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - if((type != DHT22_READ_HUM) && (type != DHT22_READ_TEMP) && - (type != DHT22_READ_ALL)) { - PRINTF("DHT22: Invalid type %u\n", type); - return DHT22_ERROR; - } - - if(busy) { - PRINTF("DHT22: ongoing operation, wait\n"); - return DHT22_BUSY; - } - - busy = 1; - - if(dht22_read() != DHT22_SUCCESS) { - PRINTF("DHT22: Fail to read sensor\n"); - GPIO_SET_INPUT(DHT22_PORT_BASE, DHT22_PIN_MASK); - GPIO_SET_PIN(DHT22_PORT_BASE, DHT22_PIN_MASK); - busy = 0; - return DHT22_ERROR; - } - - switch(type) { - case DHT22_READ_HUM: - return dht22_humidity(); - case DHT22_READ_TEMP: - return dht22_temperature(); - case DHT22_READ_ALL: - return DHT22_SUCCESS; - default: - return DHT22_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -int16_t -dht22_read_all(int16_t *temperature, int16_t *humidity) -{ - if((temperature == NULL) || (humidity == NULL)) { - PRINTF("DHT22: Invalid arguments\n"); - return DHT22_ERROR; - } - - if(value(DHT22_READ_ALL) != DHT22_ERROR) { - *temperature = dht22_temperature(); - *humidity = dht22_humidity(); - return DHT22_SUCCESS; - } - - /* Already cleaned-up in the value() function */ - return DHT22_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type != SENSORS_ACTIVE) { - return DHT22_ERROR; - } - - GPIO_SOFTWARE_CONTROL(DHT22_PORT_BASE, DHT22_PIN_MASK); - GPIO_SET_INPUT(DHT22_PORT_BASE, DHT22_PIN_MASK); - ioc_set_over(DHT22_PORT, DHT22_PIN, IOC_OVERRIDE_OE); - GPIO_SET_PIN(DHT22_PORT_BASE, DHT22_PIN_MASK); - - /* Restart flag */ - busy = 0; - - if(value) { - enabled = 1; - return DHT22_SUCCESS; - } - - enabled = 0; - return DHT22_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(dht22, DHT22_SENSOR, value, configure, NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/dht22.h b/arch/platform/zoul/dev/dht22.h deleted file mode 100644 index ecd02a26e..000000000 --- a/arch/platform/zoul/dev/dht22.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-dht22 DHT22 temperature and humidity sensor - * - * Driver for the DHT22 temperature and humidity sensor - * @{ - * - * \file - * Header file for the DHT22 temperature and humidity sensor - */ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#ifndef DHT22_H_ -#define DHT22_H_ -/* -------------------------------------------------------------------------- */ -/** - * \name DHT22 default pin and port - * @{ - */ -#ifdef DHT22_CONF_PIN -#define DHT22_PIN DHT22_CONF_PIN -#else -#define DHT22_PIN 5 -#endif -#ifdef DHT22_CONF_PORT -#define DHT22_PORT DHT22_CONF_PORT -#else -#define DHT22_PORT GPIO_A_NUM -#endif -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name DHT22 available commands - * @{ - */ -#define DHT22_READ_TEMP 0x01 -#define DHT22_READ_HUM 0x02 -#define DHT22_READ_ALL 0x03 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name DHT22 return types - * @{ - */ -#define DHT22_ERROR (-1) -#define DHT22_SUCCESS 0x00 -#define DHT22_BUSY 0xFF -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name DHT22 constants - * @{ - */ -#define DHT22_BUFFER 5 /**< Buffer to store the samples */ -#define DHT22_COUNT 8 /**< Minimum ticks to detect a "1" bit */ -#define DHT22_MAX_TIMMING 85 /**< Maximum ticks in a single operation */ -#define DHT22_READING_DELAY 1 /**< 1 us */ -#define DHT22_READY_TIME 40 /**< 40 us */ -#define DHT22_START_TIME (RTIMER_SECOND / 50) /**< 20 ms */ -#define DHT22_AWAKE_TIME (RTIMER_SECOND / 4) /**< 250 ms */ -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name DHT22 auxiliary functions - * @{ - */ -int16_t dht22_read_all(int16_t *temperature, int16_t *humidity); -/** @} */ -/* -------------------------------------------------------------------------- */ -#define DHT22_SENSOR "DHT22 sensor" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor dht22; -/* -------------------------------------------------------------------------- */ -#endif /* DHT22_H_ */ -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/grove-gyro.c b/arch/platform/zoul/dev/grove-gyro.c deleted file mode 100644 index 1ef9d6036..000000000 --- a/arch/platform/zoul/dev/grove-gyro.c +++ /dev/null @@ -1,653 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-grove-gyro-sensor - * @{ - * - * \file - * Grove's 3-axis gyroscope driver - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/i2c.h" -#include "dev/grove-gyro.h" -#include "dev/gpio-hal.h" -#include "lib/sensors.h" -#include "dev/watchdog.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define GROVE_GYRO_INT_PORT_BASE GPIO_PORT_TO_BASE(I2C_INT_PORT) -#define GROVE_GYRO_INT_PIN_MASK GPIO_PIN_MASK(I2C_INT_PIN) -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -static uint8_t power_mgmt; -static uint8_t int_en; -/*---------------------------------------------------------------------------*/ -grove_gyro_values_t gyro_values; -/*---------------------------------------------------------------------------*/ -void (*grove_gyro_int_callback)(uint8_t value); -/*---------------------------------------------------------------------------*/ -static uint16_t -grove_gyro_read_reg(uint8_t reg, uint8_t *buf, uint8_t num) -{ - if((buf == NULL) || (num <= 0)) { - return GROVE_GYRO_ERROR; - } - - i2c_master_enable(); - if(i2c_single_send(GROVE_GYRO_ADDR, reg) == I2C_MASTER_ERR_NONE) { - if(i2c_burst_receive(GROVE_GYRO_ADDR, buf, num) == I2C_MASTER_ERR_NONE) { - return GROVE_GYRO_SUCCESS; - } - } - - PRINTF("Gyro: failed to read from sensor\n"); - return GROVE_GYRO_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -grove_gyro_write_reg(uint8_t *buf, uint8_t num) -{ - if((buf == NULL) || (num <= 0)) { - PRINTF("Gyro: invalid write values\n"); - return GROVE_GYRO_ERROR; - } - - i2c_master_enable(); - if(i2c_burst_send(GROVE_GYRO_ADDR, buf, num) == I2C_MASTER_ERR_NONE) { - return GROVE_GYRO_SUCCESS; - } - return GROVE_GYRO_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -grove_gyro_sampdiv(uint8_t value) -{ - uint8_t buf[2]; - buf[0] = GROVE_GYRO_SMPLRT_DIV; - buf[1] = value; - if(grove_gyro_write_reg(buf, 2) == GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: new sampdiv 0x%02X\n", value); - return GROVE_GYRO_SUCCESS; - } - PRINTF("Gyro: failed to set sampdiv\n"); - return GROVE_GYRO_ERROR; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -grove_gyro_clear_interrupt(void) -{ - uint8_t aux = 0; - - /* Clear interrupt */ - grove_gyro_read_reg(GROVE_GYRO_INT_STATUS, &aux, 1); - - if(aux & GROVE_GYRO_INT_STATUS_DATA_RDY_MASK) { - return GROVE_GYRO_INT_STATUS_DATA_RDY_MASK; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -grove_gyro_interrupt(uint8_t value) -{ - uint8_t buf[2]; - buf[0] = GROVE_GYRO_INT_CFG; - buf[1] = value; - if(grove_gyro_write_reg(buf, 2) == GROVE_GYRO_SUCCESS){ - PRINTF("Gyro: interrupt cfg 0x%02X\n", value); - return GROVE_GYRO_SUCCESS; - } - PRINTF("Gyro: failed to change interrupt config\n"); - return GROVE_GYRO_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -grove_gyro_reset(void) -{ - uint8_t buf[2]; - buf[0] = GROVE_GYRO_PWR_MGMT; - - /* Read the power management status as well to force sync */ - if(grove_gyro_read_reg(GROVE_GYRO_PWR_MGMT, &power_mgmt, 1) == - GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: current power mgmt 0x%02X\n", power_mgmt); - buf[1] = power_mgmt + GROVE_GYRO_PWR_MGMT_RESET; - if(grove_gyro_write_reg(buf, 2) == GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: restarted with 0x%02X, now with default values\n", buf[1]); - return GROVE_GYRO_SUCCESS; - } - } - PRINTF("Gyro: failed to restart\n"); - return GROVE_GYRO_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -grove_gyro_osc(uint8_t value) -{ - uint8_t buf[2]; - buf[0] = GROVE_GYRO_PWR_MGMT; - - /* Read the power management status as well to force sync */ - if(grove_gyro_read_reg(GROVE_GYRO_PWR_MGMT, &power_mgmt, 1) == - GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: current power mgmt 0x%02X\n", power_mgmt); - power_mgmt &= ~GROVE_GYRO_PWR_MGMT_CLK_SEL_MASK; - buf[1] = power_mgmt + value; - if(grove_gyro_write_reg(buf, 2) == GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: new clock source 0x%02X\n", buf[1]); - return GROVE_GYRO_SUCCESS; - } - } - PRINTF("Gyro: failed to change the clock source\n"); - return GROVE_GYRO_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -grove_gyro_power_mgmt(uint8_t value, uint8_t type) -{ - uint8_t buf[2]; - buf[0] = GROVE_GYRO_PWR_MGMT; - - if((type != GROVE_GYRO_POWER_ON) && (type != GROVE_GYRO_POWER_OFF)) { - PRINTF("Gyro: invalid power command type\n"); - return GROVE_GYRO_ERROR; - } - - /* Read the power management status as well to force sync */ - if(grove_gyro_read_reg(GROVE_GYRO_PWR_MGMT, &power_mgmt, 1) == - GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: current power mgmt 0x%02X\n", power_mgmt); - - if(type == GROVE_GYRO_POWER_ON) { - power_mgmt &= ~value; - } else { - power_mgmt |= value; - } - - buf[1] = power_mgmt; - if(grove_gyro_write_reg(buf, 2) == GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: new power management register value 0x%02X\n", power_mgmt); - - /* Power-up delay */ - if(type == GROVE_GYRO_POWER_ON) { - clock_delay_usec(25000); - } - - return GROVE_GYRO_SUCCESS; - } - } - PRINTF("Gyro: power management fail\n"); - - return GROVE_GYRO_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -grove_gyro_dlpf(uint8_t value) -{ - uint8_t buf[2]; - buf[0] = GROVE_GYRO_DLPF_FS; - buf[1] = GROVE_GYRO_DLPF_FS_SEL + value; - - if(grove_gyro_write_reg(buf, 2) == GROVE_GYRO_SUCCESS) { - /* Double-check */ - if(grove_gyro_read_reg(GROVE_GYRO_DLPF_FS, &buf[0], 1) == - GROVE_GYRO_SUCCESS) { - if(buf[0] == buf[1]) { - PRINTF("Gyro: updated lp/sr 0x%02X\n", buf[0]); - return GROVE_GYRO_SUCCESS; - } else { - PRINTF("Gyro: DLPF register value mismatch\n"); - return GROVE_GYRO_ERROR; - } - } - } - - PRINTF("Gyro: failed to change the lp/sr\n"); - return GROVE_GYRO_ERROR; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -grove_gyro_convert_to_value(uint16_t val) -{ - uint32_t aux; - - /* Convert from 2C's to 10's, as we care about º/s negative quantifier doesn't - * matter, so we ommit flaging the sign - */ - if(val & 0x8000) { - val = (~val + 1); - } - - /* ITG-3200 datasheet: sensitivity 14.375 LSB/(º/s) to get º/s */ - aux = val * 6956; - aux /= 1000; - - return (uint16_t)aux; -} -/*---------------------------------------------------------------------------*/ -static void -grove_gyro_convert(uint8_t *buf, uint8_t type) -{ - uint16_t aux; - - if(type & GROVE_GYRO_X) { - aux = (buf[0] << 8) + buf[1]; - PRINTF("Gyro: X_axis (raw) 0x%02X\n", aux); - gyro_values.x = grove_gyro_convert_to_value(aux); - } - - if(type & GROVE_GYRO_Y) { - aux = (buf[2] << 8) + buf[3]; - PRINTF("Gyro: Y_axis (raw) 0x%02X\n", aux); - gyro_values.y = grove_gyro_convert_to_value(aux); - } - - if(type & GROVE_GYRO_Z) { - aux = (buf[4] << 8) + buf[5]; - PRINTF("Gyro: Z_axis (raw) 0x%02X\n", aux); - gyro_values.z = grove_gyro_convert_to_value(aux); - } - - if(type == GROVE_GYRO_TEMP) { - aux = (buf[0] << 8) + buf[1]; - PRINTF("Gyro: Temp (raw) 0x%02X\n", aux); - /* ITG-3200 datasheet: offset -13200, sensitivity 280 LSB/ºC */ - aux = (aux + 13200) / 28; - aux += 350; - gyro_values.temp = (int16_t)aux; - } -} -/*---------------------------------------------------------------------------*/ -static int -grove_gyro_read(int type) -{ - uint8_t reg; - uint8_t len; - uint8_t buf_ptr; - uint8_t buf[GROVE_GYRO_MAX_DATA]; - - len = (type == GROVE_GYRO_XYZ) ? GROVE_GYRO_MAX_DATA : 2; - - switch(type) { - case GROVE_GYRO_X: - case GROVE_GYRO_XYZ: - buf_ptr = 0; - reg = GROVE_GYRO_XOUT_H; - break; - case GROVE_GYRO_Y: - buf_ptr = 2; - reg = GROVE_GYRO_YOUT_H; - break; - case GROVE_GYRO_Z: - buf_ptr = 4; - reg = GROVE_GYRO_ZOUT_H; - break; - case GROVE_GYRO_TEMP: - buf_ptr = 0; - reg = GROVE_GYRO_TEMP_OUT_H; - break; - case GROVE_GYRO_ADDR: - buf_ptr = 0; - len = 1; - reg = GROVE_GYRO_WHO_AM_I; - break; - default: - PRINTF("Gyro: invalid value requested\n"); - return GROVE_GYRO_ERROR; - } - - if(grove_gyro_read_reg(reg, &buf[buf_ptr], len) == GROVE_GYRO_SUCCESS) { - if(type == GROVE_GYRO_ADDR) { - PRINTF("Gyro: I2C_addr 0x%02X\n", buf[0]); - return buf[0]; - } - grove_gyro_convert(buf, type); - return GROVE_GYRO_SUCCESS; - } - - PRINTF("Gyro: failed to change the lp/sr\n"); - return GROVE_GYRO_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -grove_gyro_calibrate(void) -{ - uint8_t i; - uint8_t buf[GROVE_GYRO_MAX_DATA]; - uint8_t power_mgmt_backup; - uint32_t x, y, z; - - /* Disable interrupts */ - if(int_en) { - if(grove_gyro_interrupt(GROVE_GYRO_INT_CFG_DISABLE) == GROVE_GYRO_ERROR) { - PRINTF("Gyro: failed to disable the interrupts\n"); - return GROVE_GYRO_ERROR; - } - GPIO_DISABLE_INTERRUPT(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK); - } - - /* Turn on the 3-axis, save the current config */ - if(grove_gyro_read_reg(GROVE_GYRO_PWR_MGMT, &power_mgmt_backup, 1) == - GROVE_GYRO_ERROR) { - PRINTF("Gyro: failed to read power mgmt config\n"); - return GROVE_GYRO_ERROR; - } - - if(grove_gyro_power_mgmt(GROVE_GYRO_ALL, GROVE_GYRO_POWER_ON) == - GROVE_GYRO_ERROR) { - PRINTF("Gyro: failed to bring sensor up\n"); - return GROVE_GYRO_ERROR; - } - - x = 0; - y = 0; - z = 0; - - for (i = 0; i < GROVE_GYRO_CALIB_SAMPLES; i++){ - clock_delay_usec(GROVE_GYRO_CALIB_TIME_US); - watchdog_periodic(); - if(grove_gyro_read_reg(GROVE_GYRO_XOUT_H, buf, GROVE_GYRO_MAX_DATA) == - GROVE_GYRO_SUCCESS) { - x += (buf[0] << 8) + buf[1]; - y += (buf[2] << 8) + buf[3]; - z += (buf[4] << 8) + buf[5]; - } - } - - gyro_values.x_offset = ABS(x)/GROVE_GYRO_CALIB_SAMPLES; - gyro_values.y_offset = ABS(y)/GROVE_GYRO_CALIB_SAMPLES; - gyro_values.z_offset = ABS(z)/GROVE_GYRO_CALIB_SAMPLES; - - PRINTF("Gyro: x_offset (RAW) 0x%02X\n", gyro_values.x_offset); - PRINTF("Gyro: y_offset (RAW) 0x%02X\n", gyro_values.y_offset); - PRINTF("Gyro: z_offset (RAW) 0x%02X\n", gyro_values.z_offset); - - gyro_values.x_offset = grove_gyro_convert_to_value(gyro_values.x_offset); - gyro_values.y_offset = grove_gyro_convert_to_value(gyro_values.y_offset); - gyro_values.z_offset = grove_gyro_convert_to_value(gyro_values.z_offset); - - PRINTF("Gyro: x_offset (converted) %d\n", gyro_values.x_offset); - PRINTF("Gyro: y_offset (converted) %d\n", gyro_values.y_offset); - PRINTF("Gyro: z_offset (converted) %d\n", gyro_values.z_offset); - - /* Cleaning up */ - buf[0] = GROVE_GYRO_PWR_MGMT; - buf[1] = power_mgmt_backup; - - if(grove_gyro_write_reg(&buf[0], 2) != GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: failed restoring power mgmt (0x%02X)\n", power_mgmt_backup); - return GROVE_GYRO_ERROR; - } - - if(int_en) { - if(grove_gyro_interrupt(GROVE_GYRO_INT_CFG_RAW_READY_EN + - GROVE_GYRO_INT_CFG_LATCH_EN) == GROVE_GYRO_ERROR) { - PRINTF("Gyro: failed to enable the interrupt\n"); - return GROVE_GYRO_ERROR; - } - - GPIO_ENABLE_INTERRUPT(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK); - } - - return GROVE_GYRO_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -PROCESS(grove_gyro_int_process, "Grove gyroscope interrupt process handler"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(grove_gyro_int_process, ev, data) -{ - PROCESS_EXITHANDLER(); - PROCESS_BEGIN(); - - static uint8_t axis_to_read = 0; - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - if(grove_gyro_clear_interrupt() == GROVE_GYRO_INT_STATUS_DATA_RDY_MASK) { - - axis_to_read += (power_mgmt & GROVE_GYRO_X) ? 0: GROVE_GYRO_X; - axis_to_read += (power_mgmt & GROVE_GYRO_Y) ? 0: GROVE_GYRO_Y; - axis_to_read += (power_mgmt & GROVE_GYRO_Z) ? 0: GROVE_GYRO_Z; - - if(grove_gyro_read(axis_to_read) == GROVE_GYRO_SUCCESS) { - grove_gyro_int_callback(GROVE_GYRO_SUCCESS); - } - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static void -grove_gyro_interrupt_handler(gpio_hal_pin_mask_t pin_mask) -{ - process_poll(&grove_gyro_int_process); -} -/*---------------------------------------------------------------------------*/ -static gpio_hal_event_handler_t gyro_handler = { - .next = NULL, - .handler = grove_gyro_interrupt_handler, - .pin_mask = gpio_hal_pin_to_mask(I2C_INT_PIN) << (I2C_INT_PORT << 3), -}; -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - if(!enabled) { - PRINTF("Gyro: sensor not started\n"); - return GROVE_GYRO_ERROR; - } - - if((type != GROVE_GYRO_X) && (type != GROVE_GYRO_Y) && - (type != GROVE_GYRO_Z) && (type != GROVE_GYRO_XYZ) && - (type != GROVE_GYRO_TEMP) && (type != GROVE_GYRO_ADDR)) { - PRINTF("Gyro: invalid value requested 0x%02X\n", type); - return GROVE_GYRO_ERROR; - } - - if((type != GROVE_GYRO_TEMP) && (type != GROVE_GYRO_ADDR) && - (type & power_mgmt)) { - PRINTF("Gyro: axis not enabled (0x%02X vs 0x%02X)\n", power_mgmt, type); - return GROVE_GYRO_ERROR; - } - - return grove_gyro_read(type); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if((type != GROVE_GYRO_ACTIVE) && (type != GROVE_GYRO_SAMPLE_RATE) && - (type != GROVE_GYRO_SAMPLE_RATE_DIVIDER) && (type != GROVE_GYRO_POWER_ON) && - (type != GROVE_GYRO_POWER_OFF) && (type != GROVE_GYRO_DATA_INTERRUPT) && - (type != GROVE_GYRO_CALIBRATE_ZERO)) { - PRINTF("Gyro: option not supported\n"); - return GROVE_GYRO_ERROR; - } - - switch(type) { - case GROVE_GYRO_ACTIVE: - if(value) { - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, - I2C_SCL_FAST_BUS_SPEED); - - /* Initialize the data structure values */ - gyro_values.x = 0; - gyro_values.y = 0; - gyro_values.z = 0; - gyro_values.temp = 0; - gyro_values.x_offset = 0; - gyro_values.y_offset = 0; - gyro_values.z_offset = 0; - - /* Make sure the sensor is on */ - if(grove_gyro_power_mgmt(GROVE_GYRO_ALL, GROVE_GYRO_POWER_ON) != - GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: failed to power on the sensor\n"); - return GROVE_GYRO_ERROR; - } - - /* Reset and configure as default with internal oscillator, 8KHz @ 2000 - * degrees/s, no divider (full scale) - */ - if(grove_gyro_reset() == GROVE_GYRO_SUCCESS) { - if(grove_gyro_osc(GROVE_GYRO_DEFAULT_OSC) == GROVE_GYRO_SUCCESS) { - if(grove_gyro_dlpf(GROVE_GYRO_DLPF_FS_CGF_8KHZ_LP256HZ) == - GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: started and configured\n"); - /* Disable interrupts as default */ - if(grove_gyro_interrupt(GROVE_GYRO_INT_CFG_DISABLE) == - GROVE_GYRO_SUCCESS) { - PRINTF("Gyro: interrupts disabled\n"); - /* And finally put the device in SLEEP mode, set also X, Y and Z - * in stand-by mode, whenever an axis is not used it should stay - * in this state to save power - */ - if(grove_gyro_power_mgmt(GROVE_GYRO_ALL, GROVE_GYRO_POWER_OFF) == - GROVE_GYRO_SUCCESS) { - enabled = 1; - PRINTF("Gyro: axis and gyroscope in low-power mode now\n"); - - return GROVE_GYRO_SUCCESS; - } - } - } - } - } - return GROVE_GYRO_ERROR; - - } else { - enabled = 0; - int_en = 0; - GPIO_DISABLE_INTERRUPT(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK); - grove_gyro_int_callback = NULL; - if(grove_gyro_interrupt(GROVE_GYRO_INT_CFG_DISABLE) == - GROVE_GYRO_SUCCESS) { - return grove_gyro_power_mgmt(GROVE_GYRO_ALL, GROVE_GYRO_POWER_OFF); - } - PRINTF("Gyro: hw interrupt disabled but failed to disable sensor\n"); - return GROVE_GYRO_ERROR; - } - - if(!enabled) { - PRINTF("Gyro: sensor not started\n"); - return GROVE_GYRO_ERROR; - } - - case GROVE_GYRO_DATA_INTERRUPT: - - if(!value) { - - /* Ensure the GPIO doesn't generate more interrupts, this may affect others - * I2C digital sensors using the bus and sharing this pin, so an user may - * comment the line below - */ - int_en = 0; - GPIO_DISABLE_INTERRUPT(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK); - return grove_gyro_interrupt(GROVE_GYRO_INT_CFG_DISABLE); - } - - /* Enable interrupt and latch the pin until cleared */ - if(grove_gyro_interrupt(GROVE_GYRO_INT_CFG_RAW_READY_EN + - GROVE_GYRO_INT_CFG_LATCH_EN) == GROVE_GYRO_ERROR) { - PRINTF("Gyro: failed to enable the interrupt\n"); - return GROVE_GYRO_ERROR; - } - - /* Default register configuration is active high, push-pull */ - GPIO_SOFTWARE_CONTROL(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK); - GPIO_SET_INPUT(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK); - GPIO_DETECT_EDGE(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK); - GPIO_TRIGGER_SINGLE_EDGE(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK); - GPIO_DETECT_FALLING(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK); - gpio_hal_register_handler(&gyro_handler); - - /* Spin process until an interrupt is received */ - process_start(&grove_gyro_int_process, NULL); - - /* Enable interrupts */ - int_en = 1; - GPIO_ENABLE_INTERRUPT(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK); - ioc_set_over(I2C_INT_PORT, I2C_INT_PIN, IOC_OVERRIDE_PUE); - NVIC_EnableIRQ(I2C_INT_VECTOR); - - PRINTF("Gyro: Data interrupt configured\n"); - return GROVE_GYRO_SUCCESS; - - case GROVE_GYRO_SAMPLE_RATE: - if((value < GROVE_GYRO_DLPF_FS_CGF_8KHZ_LP256HZ) || - (value > GROVE_GYRO_DLPF_FS_CGF_1KHZ_LP5HZ)) { - PRINTF("Gyro: invalid sample rate/filter configuration\n"); - return GROVE_GYRO_ERROR; - } - return grove_gyro_dlpf(value); - - case GROVE_GYRO_SAMPLE_RATE_DIVIDER: - if((value < 0) && (value > 0xFF)) { - PRINTF("Gyro: invalid sampling rate div, it must be an 8-bit value\n"); - return GROVE_GYRO_ERROR; - } - return grove_gyro_sampdiv((uint8_t)value); - - case GROVE_GYRO_POWER_ON: - case GROVE_GYRO_POWER_OFF: - /* We accept mask values to enable more than one axis at the same time */ - if((value < GROVE_GYRO_Z) || (value > GROVE_GYRO_ALL)) { - PRINTF("Gyro: invalid power management setting\n"); - return GROVE_GYRO_ERROR; - } - return grove_gyro_power_mgmt(value, type); - - case GROVE_GYRO_CALIBRATE_ZERO: - return grove_gyro_calibrate(); - - default: - return GROVE_GYRO_ERROR; - } - - return GROVE_GYRO_ERROR; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(grove_gyro, GROVE_GYRO_STRING, value, configure, NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/grove-gyro.h b/arch/platform/zoul/dev/grove-gyro.h deleted file mode 100644 index 8ab84ba7e..000000000 --- a/arch/platform/zoul/dev/grove-gyro.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-grove-gyro-sensor Grove 3-axis gyroscope based on ITG-3200 - * @{ - * - * \file - * Grove 3-axis gyroscope header file - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/* -------------------------------------------------------------------------- */ -#ifndef GROVE_GYRO_H_ -#define GROVE_GYRO_H_ -/* -------------------------------------------------------------------------- */ -/** - * \name Callback function to handle the interrupt - * @{ - */ -#define GROVE_GYRO_REGISTER_INT(ptr) grove_gyro_int_callback = ptr; -extern void (*grove_gyro_int_callback)(uint8_t value); -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Gyroscope data values structure - * @{ - */ -typedef struct { - uint16_t x; - uint16_t y; - uint16_t z; - uint16_t x_offset; - uint16_t y_offset; - uint16_t z_offset; - int16_t temp; -} grove_gyro_values_t; - -extern grove_gyro_values_t gyro_values; -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Grove 3-axis gyroscope address and registers - * @{ - */ -#define GROVE_GYRO_ADDR 0x68 - -#define GROVE_GYRO_WHO_AM_I 0x00 -#define GROVE_GYRO_SMPLRT_DIV 0x15 -#define GROVE_GYRO_DLPF_FS 0x16 -#define GROVE_GYRO_INT_CFG 0x17 -#define GROVE_GYRO_INT_STATUS 0x1A -#define GROVE_GYRO_TEMP_OUT_H 0x1B -#define GROVE_GYRO_TEMP_OUT_L 0x1C -#define GROVE_GYRO_XOUT_H 0x1D -#define GROVE_GYRO_XOUT_L 0x1E -#define GROVE_GYRO_YOUT_H 0x1F -#define GROVE_GYRO_YOUT_L 0x20 -#define GROVE_GYRO_ZOUT_H 0x21 -#define GROVE_GYRO_ZOUT_L 0x22 -#define GROVE_GYRO_PWR_MGMT 0x3E -/** @} */ -/*--------------------------------------------------------------------------*/ -/** - * \name Grove 3-axis gyroscope bitmasks and config - * @{ - */ -#define GROVE_GYRO_DLPF_FS_SEL 0x18 -#define GROVE_GYRO_DLPF_FS_CGF_8KHZ_LP256HZ 0x00 -#define GROVE_GYRO_DLPF_FS_CGF_1KHZ_LP188HZ 0x01 -#define GROVE_GYRO_DLPF_FS_CGF_1KHZ_LP98HZ 0x02 -#define GROVE_GYRO_DLPF_FS_CGF_1KHZ_LP42HZ 0x03 -#define GROVE_GYRO_DLPF_FS_CGF_1KHZ_LP20HZ 0x04 -#define GROVE_GYRO_DLPF_FS_CGF_1KHZ_LP10HZ 0x05 -#define GROVE_GYRO_DLPF_FS_CGF_1KHZ_LP5HZ 0x06 - -#define GROVE_GYRO_INT_CFG_RAW_READY_EN 0x01 -#define GROVE_GYRO_INT_CFG_READY_EN 0x04 -#define GROVE_GYRO_INT_CFG_LATCH_CLR_ANY 0x10 -#define GROVE_GYRO_INT_CFG_LATCH_EN 0x20 -#define GROVE_GYRO_INT_CFG_PIN_OPEN 0x40 -#define GROVE_GYRO_INT_CFG_PIN_ACTL 0x80 -#define GROVE_GYRO_INT_CFG_DISABLE 0x00 - -#define GROVE_GYRO_INT_STATUS_DATA_RDY_MASK 0x01 -#define GROVE_GYRO_INT_STATUS_PLL_RDY_MASK 0x04 - -#define GROVE_GYRO_PWR_MGMT_CLK_SEL_INTOSC 0x00 -#define GROVE_GYRO_PWR_MGMT_CLK_SEL_PLL_X 0x01 -#define GROVE_GYRO_PWR_MGMT_CLK_SEL_PLL_Y 0x02 -#define GROVE_GYRO_PWR_MGMT_CLK_SEL_PLL_Z 0x03 -#define GROVE_GYRO_PWR_MGMT_CLK_SEL_EXT_32K 0x04 -#define GROVE_GYRO_PWR_MGMT_CLK_SEL_EXT_19K 0x05 -#define GROVE_GYRO_PWR_MGMT_STBY_ZG 0x08 -#define GROVE_GYRO_PWR_MGMT_STBY_YG 0x10 -#define GROVE_GYRO_PWR_MGMT_STBY_XG 0x20 -#define GROVE_GYRO_PWR_MGMT_SLEEP 0x40 -#define GROVE_GYRO_PWR_MGMT_RESET 0x80 - -#ifdef GROVE_GYRO_CONF_OSC -#define GROVE_GYRO_DEFAULT_OSC GROVE_GYRO_CONF_OSC -#else -#define GROVE_GYRO_DEFAULT_OSC GROVE_GYRO_PWR_MGMT_CLK_SEL_INTOSC -#endif - -#define GROVE_GYRO_PWR_MGMT_CLK_SEL_MASK 0x07 -#define GROVE_GYRO_MAX_DATA 0x06 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Grove 3-axis gyroscope operation values - * @{ - */ -/* Configure request type */ -#define GROVE_GYRO_ACTIVE SENSORS_ACTIVE -#define GROVE_GYRO_DATA_INTERRUPT 0x01 -#define GROVE_GYRO_SAMPLE_RATE 0x02 -#define GROVE_GYRO_SAMPLE_RATE_DIVIDER 0x03 -#define GROVE_GYRO_POWER_ON 0x04 -#define GROVE_GYRO_POWER_OFF 0x05 -#define GROVE_GYRO_CALIBRATE_ZERO 0x06 - -/* Sensor value request type, match to the stand-by mask to check if enabled */ -#define GROVE_GYRO_X GROVE_GYRO_PWR_MGMT_STBY_XG -#define GROVE_GYRO_Y GROVE_GYRO_PWR_MGMT_STBY_YG -#define GROVE_GYRO_Z GROVE_GYRO_PWR_MGMT_STBY_ZG -#define GROVE_GYRO_SENSOR GROVE_GYRO_PWR_MGMT_SLEEP -#define GROVE_GYRO_XYZ (GROVE_GYRO_X + GROVE_GYRO_Y + \ - GROVE_GYRO_Z) -#define GROVE_GYRO_ALL (GROVE_GYRO_XYZ + GROVE_GYRO_SENSOR) -#define GROVE_GYRO_TEMP 0x06 - -/* Return types */ -#define GROVE_GYRO_ERROR (-1) -#define GROVE_GYRO_SUCCESS 0x00 - -/* Calibration constants */ -#define GROVE_GYRO_CALIB_SAMPLES 200 -#define GROVE_GYRO_CALIB_TIME_US 5000 -/** @} */ -/* -------------------------------------------------------------------------- */ -#define GROVE_GYRO_STRING "Grove 3-axis gyroscope Sensor" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor grove_gyro; -/* -------------------------------------------------------------------------- */ -#endif /* ifndef GROVE_GYRO_H_ */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/iaq.c b/arch/platform/zoul/dev/iaq.c deleted file mode 100644 index 7bc929a26..000000000 --- a/arch/platform/zoul/dev/iaq.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-iaq-sensor - * @{ - * Driver for the RE-Mote IAQ iAQ-Core (Indoor Air Quality Sensor) - * \file - * Driver for the RE-Mote RF IAQ iAQ-Core sensor (IAQ) - * \author - * Aitor Mejias - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/gpio.h" -#include "dev/i2c.h" -#include "iaq.h" -#include "sys/timer.h" -#include "sys/etimer.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/* Callback pointers when interrupt occurs */ -void (*iaq_enable_callback)(uint16_t value); -/*---------------------------------------------------------------------------*/ -static int16_t enabled; -/*---------------------------------------------------------------------------*/ -static struct etimer et; -static simple_iaq_data iaq_data; -static uint8_t iaq_buffer[IAQ_FRAME_SIZE+1]; -/*---------------------------------------------------------------------------*/ -PROCESS(iaq_process, "IAQ process handler"); -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ -/* Return the status of the iAQ-Core or the status of the driver */ - if (type == IAQ_STATUS) { - return (uint16_t)iaq_data.status; - } else if (type == IAQ_DRIVER_STATUS) { - return enabled; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(iaq_process, ev, data) -{ - #if DEBUG - uint8_t i = 0; - #endif - - PROCESS_EXITHANDLER(); - PROCESS_BEGIN(); - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, - I2C_SCL_NORMAL_BUS_SPEED); - - while(1) { - etimer_set(&et, (IAQ_POLLING_TIME)); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - i2c_master_enable(); - if(i2c_burst_receive(IAQ_ADDR, &iaq_buffer[0], IAQ_FRAME_SIZE) != - I2C_MASTER_ERR_NONE) { - PRINTF("IAQ: Failed to retrieve data from IAQ\n"); - enabled = IAQ_ERROR; - iaq_data.status = IAQ_INTERNAL_ERROR; - } else { - #if DEBUG - PRINTF("IAQ: Buffer "); - for (i=1;i<10;i++) { - PRINTF("[%d] %x, ", i-1, iaq_buffer[i-1]); - } - PRINTF("\n"); - #endif - /* Update the status of the sensor. This value readed represents the - internal status of the external driver. */ - switch (iaq_buffer[2]) { - case IAQ_INTERNAL_SUCCESS: - enabled = IAQ_ACTIVE; - break; - case IAQ_INTERNAL_RUNIN: - enabled = IAQ_INIT_STATE; - break; - case IAQ_INTERNAL_BUSY: - case IAQ_INTERNAL_ERROR: - enabled = IAQ_ERROR; - break; - default: - enabled = IAQ_ERROR; - break; - } - - iaq_data.tvoc = ((uint16_t)iaq_buffer[0] << 8) + iaq_buffer[1]; - iaq_data.co2 = ((uint16_t)iaq_buffer[7] << 8) + iaq_buffer[8]; - iaq_data.status = iaq_buffer[2]; - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - if (!enabled) { - PRINTF("IAQ: Sensor not enabled\n"); - return IAQ_ERROR; - } - if (enabled == IAQ_INIT_STATE) { - PRINTF("IAQ: Sensor initializing\n"); - return IAQ_INIT_STATE; - } - if (type == IAQ_CO2_VALUE) { - return iaq_data.co2; - } - if (type == IAQ_VOC_VALUE) { - return iaq_data.tvoc; - } - if (type == IAQ_STATUS) { - #if DEBUG - switch (iaq_data.status) { - case IAQ_INTERNAL_SUCCESS: - PRINTF("IAQ Status: SUCCESS\n"); - break; - case IAQ_INTERNAL_RUNIN: - PRINTF("IAQ Status: WARM UP\n"); - break; - case IAQ_INTERNAL_BUSY: - case IAQ_INTERNAL_ERROR: - PRINTF("IAQ Status: ERROR\n"); - break; - default: - PRINTF("IAQ Status: UNKNOWN STATUS %d\n", iaq_data.status); - break; - } - #endif - return iaq_data.status; - } - - return IAQ_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - /* Check the current status. If is initialized or is active, return the same - state */ - if ((enabled == IAQ_INIT_STATE) || (enabled == IAQ_ACTIVE)) { - return IAQ_ERROR; - } - - /* Fix the status in initial wait status */ - enabled = IAQ_INIT_STATE; - - /* Start Internal process to measure the iAQ Sensor */ - process_start(&iaq_process, NULL); - - return enabled; -} -/*---------------------------------------------------------------------------*/ -/* name, type, value, configure, status */ -SENSORS_SENSOR(iaq, IAQ_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** - * @} - */ - diff --git a/arch/platform/zoul/dev/iaq.h b/arch/platform/zoul/dev/iaq.h deleted file mode 100644 index 92562dfd7..000000000 --- a/arch/platform/zoul/dev/iaq.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/* -------------------------------------------------------------------------- */ -/** - * \addtogroup zoul-sensors - * @{ - * \defgroup zoul-iaq-sensor IAQ driver (Indoor Air Quality) Sensor Module - * IAQ driver RE-Mote Indoor Air Quality Sensor Module - * Driver for the RE-Mote Sensor pack: Air Quality Sensor Module (IAQ) - * @{ - * \file - * Header file for the RE-Mote Sensor IAQ - */ -/* -------------------------------------------------------------------------- */ -#ifndef IAQ_H_ -#define IAQ_H_ -/* -------------------------------------------------------------------------- */ -#include -#include "lib/sensors.h" -#include "dev/zoul-sensors.h" -#include "iaq.h" -#include "i2c.h" -#include "sys/timer.h" -#include "sys/rtimer.h" -/* -------------------------------------------------------------------------- */ -/** \name IAQ address and definition - * @{ - */ -/* Address of the sensor: 1011010(1) Addr (R/W bit) */ -#define IAQ_ADDR 0x5A -#define IAQ_SENSOR "iAQ" -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name IAQ sensor types in iAQ-Core module - * @{ - */ -extern const struct sensors_sensor iaq; -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name IAQ error values and definitions - * @{ - */ -#define IAQ_ACTIVE SENSORS_ACTIVE -#define IAQ_INIT_STATE SENSORS_HW_INIT -#define IAQ_ERROR (-1) -#define IAQ_SUCCESS 0x00 -#define IAQ_FRAME_SIZE 0x09 - -/* Variables used by external driver to get the state */ -#define IAQ_INTERNAL_SUCCESS 0x00 -#define IAQ_INTERNAL_RUNIN 0x10 -#define IAQ_INTERNAL_BUSY 0x01 -#define IAQ_INTERNAL_ERROR 0x80 - -/* Value types for the sensor readings */ -#define IAQ_CO2_VALUE 0x00 -#define IAQ_VOC_VALUE 0x01 -#define IAQ_STATUS 0x02 -#define IAQ_DRIVER_STATUS 0x03 - -/* Definition that corresponds with the two models of iAQ Sensor */ -#ifdef IAQ_PULSE_MODE -#define IAQ_POLLING_TIME (CLOCK_SECOND * 11) -#else -#define IAQ_POLLING_TIME (CLOCK_SECOND) -#endif -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name IAQ enumeration and options - * @{ - */ -enum { - IAQ_INIT = 0, - IAQ_STARTED, -}; -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name Readable IAQ-Core interface result conversion implementation as - * datasheet specification. - * - * @{ - */ -typedef struct iaq_struct_simple_td_reg { - uint16_t co2; - uint8_t status; - int32_t resistance; - uint16_t tvoc; -} __attribute__ ((packed)) simple_iaq_data; -/** @} */ -/* -------------------------------------------------------------------------- */ -#endif -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/led-strip.c b/arch/platform/zoul/dev/led-strip.c deleted file mode 100644 index fa64aa91c..000000000 --- a/arch/platform/zoul/dev/led-strip.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-led-strip - * @{ - * - * Driver to control a bright LED strip powered at 3VDC, drawing power directly - * from the battery power supply. An example on how to adapt 12VDC LED strips - * to 3VDC is provided at http://www.hackster.io/zolertia - * @{ - * - * \file - * Driver for a bright LED strip - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio.h" -#include "led-strip.h" - -#include -/*---------------------------------------------------------------------------*/ -#ifndef LED_STRIP_PORT -#define LED_STRIP_PORT GPIO_A_NUM -#endif -#ifndef LED_STRIP_PIN -#define LED_STRIP_PIN 6 -#endif -#define LED_STRIP_PORT_BASE GPIO_PORT_TO_BASE(LED_STRIP_PORT) -#define LED_STRIP_PIN_MASK GPIO_PIN_MASK(LED_STRIP_PIN) -/*---------------------------------------------------------------------------*/ -static uint8_t initialized = 0; -/*---------------------------------------------------------------------------*/ -void -led_strip_config(void) -{ - /* Software controlled */ - GPIO_SOFTWARE_CONTROL(LED_STRIP_PORT_BASE, LED_STRIP_PIN_MASK); - /* Set pin to output */ - GPIO_SET_OUTPUT(LED_STRIP_PORT_BASE, LED_STRIP_PIN_MASK); - /* Set the pin to a default position */ - GPIO_SET_PIN(LED_STRIP_PORT_BASE, LED_STRIP_PIN_MASK); - - initialized = 1; -} -/*---------------------------------------------------------------------------*/ -int -led_strip_switch(uint8_t val) -{ - if(!initialized) { - return LED_STRIP_ERROR; - } - - if(val != LED_STRIP_ON && val != LED_STRIP_OFF) { - return LED_STRIP_ERROR; - } - - /* Set the LED to ON or OFF */ - GPIO_WRITE_PIN(LED_STRIP_PORT_BASE, LED_STRIP_PIN_MASK, val); - - return val; -} -/*---------------------------------------------------------------------------*/ -int -led_strip_get(void) -{ - if(!initialized) { - return LED_STRIP_ERROR; - } - - /* Inverse logic, return ON if the pin is low */ - if(GPIO_READ_PIN(LED_STRIP_PORT_BASE, LED_STRIP_PIN_MASK)) { - return LED_STRIP_OFF; - } - return LED_STRIP_ON; -} -/*---------------------------------------------------------------------------*/ - -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/dev/led-strip.h b/arch/platform/zoul/dev/led-strip.h deleted file mode 100644 index 623180789..000000000 --- a/arch/platform/zoul/dev/led-strip.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/* -------------------------------------------------------------------------- */ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-led-strip LED strip compatible with Zoul-based platforms - * - * Driver to control a bright LED strip powered at 3VDC, drawing power directly - * from the battery power supply. An example on how to adapt 12VDC LED strips - * to 3VDC is provided at http://www.hackster.io/zolertia - * @{ - * - * \file - * Header file for a bright LED strip driver - */ -/* -------------------------------------------------------------------------- */ -#ifndef LED_STRIP_H_ -#define LED_STRIP_H_ -/* -------------------------------------------------------------------------- */ -#include -/* -------------------------------------------------------------------------- */ -#define LED_STRIP_OFF 0xFF -#define LED_STRIP_ON 0x00 - -#define LED_STRIP_ERROR -1 -/* -------------------------------------------------------------------------- */ -/** - * \brief Init function for the bright LED strip driver - * - * The LED strip driver allows to lighten up any application using up to 4 - * LEDs 3VDC-powered per strip - * The function is set to power OFF the LEDs as default, - * it should be called from the contiki-main initialization process. - * - * \return ignored - */ -void led_strip_config(void); - -/** - * \brief Function to turn ON/OFF the LED strip - * - * \param val Set ON/OFF (LED_STRIP_ON or LED_STRIP_OFF) - * \return the selected antenna position, or LED_STRIP_ERROR if not - * previously configured - */ -int led_strip_switch(uint8_t val); - -/** - * \brief Function to get the LED strip current state - * - * \return Current LED strip state or LED_STRIP_ERROR if not - * previously configured - */ -int led_strip_get(void); -/* -------------------------------------------------------------------------- */ -#endif /* ifndef LED_STRIP_H_ */ -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/dev/leds-arch.c b/arch/platform/zoul/dev/leds-arch.c deleted file mode 100644 index ecb02b2f6..000000000 --- a/arch/platform/zoul/dev/leds-arch.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/leds.h" -#include "dev/gpio-hal.h" - -#include -/*---------------------------------------------------------------------------*/ -const leds_t leds_arch_leds[] = { - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L1_PORT, LEDS_ARCH_L1_PIN), - .negative_logic = false - }, - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L2_PORT, LEDS_ARCH_L2_PIN), - .negative_logic = false - }, - { - .pin = GPIO_PORT_PIN_TO_GPIO_HAL_PIN(LEDS_ARCH_L3_PORT, LEDS_ARCH_L3_PIN), - .negative_logic = false - }, -}; -/*---------------------------------------------------------------------------*/ diff --git a/arch/platform/zoul/dev/mmc-arch.c b/arch/platform/zoul/dev/mmc-arch.c deleted file mode 100644 index f1eca8d32..000000000 --- a/arch/platform/zoul/dev/mmc-arch.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup mmc-arch - * \ingroup zoul - * @{ - * - * \file - * Implementation of the SD/MMC device driver RE-Mote-specific definitions. - */ -#include -#include -#include -#include "dev/spi-arch-legacy.h" -#include "dev/ioc.h" -#include "dev/gpio.h" -#include "dev/spi-legacy.h" -#include "mmc-arch.h" - -#define USD_SEL_PORT_BASE GPIO_PORT_TO_BASE(USD_SEL_PORT) -#define USD_SEL_PIN_MASK GPIO_PIN_MASK(USD_SEL_PIN) - -/*----------------------------------------------------------------------------*/ -static void -mmc_arch_init(void) -{ - static uint8_t init_done; - - if(init_done) { - return; - } - - GPIO_SET_INPUT(USD_SEL_PORT_BASE, USD_SEL_PIN_MASK); - GPIO_SOFTWARE_CONTROL(USD_SEL_PORT_BASE, USD_SEL_PIN_MASK); - ioc_set_over(USD_SEL_PORT, USD_SEL_PIN, IOC_OVERRIDE_DIS); - - spix_cs_init(USD_CSN_PORT, USD_CSN_PIN); - spix_init(USD_SPI_INSTANCE); - spix_set_mode(USD_SPI_INSTANCE, SSI_CR0_FRF_MOTOROLA, 0, 0, 8); - - init_done = 1; -} -/*----------------------------------------------------------------------------*/ -bool -mmc_arch_get_cd(uint8_t dev) -{ - mmc_arch_init(); - - if(GPIO_IS_OUTPUT(USD_SEL_PORT_BASE, USD_SEL_PIN_MASK)) { - /* Card previously detected and powered */ - return true; - } else if(GPIO_READ_PIN(USD_SEL_PORT_BASE, USD_SEL_PIN_MASK)) { - /* Card inserted -> power it */ - GPIO_SET_OUTPUT(USD_SEL_PORT_BASE, USD_SEL_PIN_MASK); - GPIO_CLR_PIN(USD_SEL_PORT_BASE, USD_SEL_PIN_MASK); - return true; - } else { - /* No card detected */ - return false; - } -} -/*----------------------------------------------------------------------------*/ -bool -mmc_arch_get_wp(uint8_t dev) -{ - return false; -} -/*----------------------------------------------------------------------------*/ -void -mmc_arch_spi_select(uint8_t dev, bool sel) -{ - if(sel) { - SPIX_CS_CLR(USD_CSN_PORT, USD_CSN_PIN); - } else { - SPIX_CS_SET(USD_CSN_PORT, USD_CSN_PIN); - } -} -/*----------------------------------------------------------------------------*/ -void -mmc_arch_spi_set_clock_freq(uint8_t dev, uint32_t freq) -{ - spix_set_clock_freq(USD_SPI_INSTANCE, freq); -} -/*----------------------------------------------------------------------------*/ -void -mmc_arch_spi_xfer(uint8_t dev, const void *tx_buf, size_t tx_cnt, - void *rx_buf, size_t rx_cnt) -{ - const uint8_t *tx_buf_u8 = tx_buf; - uint8_t *rx_buf_u8 = rx_buf; - - while(tx_cnt || rx_cnt) { - SPIX_WAITFORTxREADY(USD_SPI_INSTANCE); - if(tx_cnt) { - SPIX_BUF(USD_SPI_INSTANCE) = *tx_buf_u8++; - tx_cnt--; - } else { - SPIX_BUF(USD_SPI_INSTANCE) = 0; - } - SPIX_WAITFOREOTx(USD_SPI_INSTANCE); - SPIX_WAITFOREORx(USD_SPI_INSTANCE); - if(rx_cnt) { - *rx_buf_u8++ = SPIX_BUF(USD_SPI_INSTANCE); - rx_cnt--; - } else { - SPIX_BUF(USD_SPI_INSTANCE); - } - } -} -/*----------------------------------------------------------------------------*/ - -/** @} */ diff --git a/arch/platform/zoul/dev/motion-sensor.c b/arch/platform/zoul/dev/motion-sensor.c deleted file mode 100644 index a44462d69..000000000 --- a/arch/platform/zoul/dev/motion-sensor.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-motion-sensor - * @{ - * - * \file - * Digital motion sensor driver - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/i2c.h" -#include "dev/motion-sensor.h" -#include "lib/sensors.h" -#include "dev/sys-ctrl.h" -#include "dev/gpio.h" -#include "dev/gpio-hal.h" -#include "dev/ioc.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define MOTION_SENSOR_PORT_BASE GPIO_PORT_TO_BASE(MOTION_SENSOR_PORT) -#define MOTION_SENSOR_PIN_MASK GPIO_PIN_MASK(MOTION_SENSOR_PIN) -/*---------------------------------------------------------------------------*/ -void (*presence_int_callback)(uint8_t value); -/*---------------------------------------------------------------------------*/ -PROCESS(motion_int_process, "Motion interrupt process handler"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(motion_int_process, ev, data) -{ - PROCESS_EXITHANDLER(); - PROCESS_BEGIN(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - presence_int_callback(0); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static void -motion_interrupt_handler(gpio_hal_pin_mask_t pin_mask) -{ - process_poll(&motion_int_process); -} -/*---------------------------------------------------------------------------*/ -static gpio_hal_event_handler_t motion_handler = { - .next = NULL, - .handler = motion_interrupt_handler, - .pin_mask = gpio_hal_pin_to_mask(MOTION_SENSOR_PIN) << (MOTION_SENSOR_PORT << 3), -}; -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return MOTION_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return GPIO_READ_PIN(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type != MOTION_ACTIVE) { - PRINTF("Motion: invalid configuration option\n"); - return MOTION_ERROR; - } - - if(!value) { - presence_int_callback = NULL; - GPIO_DISABLE_INTERRUPT(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK); - return MOTION_SUCCESS; - } - - /* Configure interruption */ - GPIO_SOFTWARE_CONTROL(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK); - GPIO_SET_INPUT(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK); - GPIO_DETECT_RISING(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK); - GPIO_TRIGGER_SINGLE_EDGE(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK); - ioc_set_over(MOTION_SENSOR_PORT, MOTION_SENSOR_PIN, IOC_OVERRIDE_DIS); - gpio_hal_register_handler(&motion_handler); - - process_start(&motion_int_process, NULL); - - GPIO_ENABLE_INTERRUPT(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK); - NVIC_EnableIRQ(MOTION_SENSOR_VECTOR); - return MOTION_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(motion_sensor, MOTION_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/motion-sensor.h b/arch/platform/zoul/dev/motion-sensor.h deleted file mode 100644 index c52597a24..000000000 --- a/arch/platform/zoul/dev/motion-sensor.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-motion-sensor Digital motion sensor - * @{ - * - * \file - * Digital motion sensor header file - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/* -------------------------------------------------------------------------- */ -#ifndef MOTION_SENSOR_H_ -#define MOTION_SENSOR_H_ -/* -------------------------------------------------------------------------- */ -/** - * \name Motion sensor return and operation values - * @{ - */ -#define MOTION_ACTIVE SENSORS_ACTIVE -#define MOTION_SUCCESS 0 -#define MOTION_ERROR (-1) -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Motion sensor interrupt callback macro - * @{ - */ -#define MOTION_REGISTER_INT(ptr) presence_int_callback = ptr; -extern void (*presence_int_callback)(uint8_t value); -/** @} */ -/* -------------------------------------------------------------------------- */ -#define MOTION_SENSOR "Digital motion sensor" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor motion_sensor; -/* -------------------------------------------------------------------------- */ -#endif /* ifndef MOTION_SENSOR_H_ */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/mp3-wtv020sd.c b/arch/platform/zoul/dev/mp3-wtv020sd.c deleted file mode 100644 index 7633d05e3..000000000 --- a/arch/platform/zoul/dev/mp3-wtv020sd.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-mp3-wtv020sd - * @{ - * - * Driver to control the MP3 WTV020SD board in MP3 mode (GPIO based) and the - * 2-line serial mode (CLK/DI). Loop Mode and Key Modes not implemented. - * More product information available at: - * http://avrproject.ru/chasy-budilnik/WTV020SD.pdf - * An example on how to wire with a sound power amplifier and speakers at - * http://www.hackster.io/zolertia - * @{ - * - * \file - * Header file for the MP3 WTV020SD driver - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio.h" -#include "mp3-wtv020sd.h" - -#include -/*---------------------------------------------------------------------------*/ - -/* - * The WTV020SD can be used in MP3 mode (GPIO-controlled) or 2-line mode (CLK - * and DATA line). The following pin-out can be implemented without reusing - * the pins as below (in 2-line mode the CLK/DATA functions replace the VOL+/- - * keys, others remain the same), but this would require more GPIOs to - * interface all functions, so we chose the configuration that uses the less - * number of GPIOs, and emulate all functions available in each mode - */ -#ifndef MP3_WTV020SD_P07_PORT -#define MP3_WTV020SD_P07_PORT GPIO_B_NUM -#endif -#ifndef MP3_WTV020SD_P07_PIN -#define MP3_WTV020SD_P07_PIN 0 -#endif -#ifndef MP3_WTV020SD_P02_PORT -#define MP3_WTV020SD_P02_PORT GPIO_B_NUM -#endif -#ifndef MP3_WTV020SD_P02_PIN -#define MP3_WTV020SD_P02_PIN 1 -#endif -#ifndef MP3_WTV020SD_P06_PORT -#define MP3_WTV020SD_P06_PORT GPIO_C_NUM -#endif -#ifndef MP3_WTV020SD_P06_PIN -#define MP3_WTV020SD_P06_PIN 1 -#endif -#ifndef MP3_WTV020SD_P04_PORT -#define MP3_WTV020SD_P04_PORT GPIO_B_NUM -#endif -#ifndef MP3_WTV020SD_P04_PIN -#define MP3_WTV020SD_P04_PIN 0 -#endif -#ifndef MP3_WTV020SD_P05_PORT -#define MP3_WTV020SD_P05_PORT GPIO_B_NUM -#endif -#ifndef MP3_WTV020SD_P05_PIN -#define MP3_WTV020SD_P05_PIN 1 -#endif -#ifndef MP3_WTV020SD_RESET_PORT -#define MP3_WTV020SD_RESET_PORT GPIO_B_NUM -#endif -#ifndef MP3_WTV020SD_RESET_PIN -#define MP3_WTV020SD_RESET_PIN 1 -#endif - -/* The BUSY pin is shared between operation modes */ -#define MP3_BUSY_PORT_BASE GPIO_PORT_TO_BASE(MP3_WTV020SD_P06_PORT) -#define MP3_BUSY_PIN_MASK GPIO_PIN_MASK(MP3_WTV020SD_P06_PIN) - -#define MP3_PLAY_PORT_BASE GPIO_PORT_TO_BASE(MP3_WTV020SD_P07_PORT) -#define MP3_PLAY_PIN_MASK GPIO_PIN_MASK(MP3_WTV020SD_P07_PIN) -#define MP3_NEXT_PORT_BASE GPIO_PORT_TO_BASE(MP3_WTV020SD_P02_PORT) -#define MP3_NEXT_PIN_MASK GPIO_PIN_MASK(MP3_WTV020SD_P02_PIN) - -#define MP3_RESET_PORT_BASE GPIO_PORT_TO_BASE(MP3_WTV020SD_RESET_PORT) -#define MP3_RESET_PIN_MASK GPIO_PIN_MASK(MP3_WTV020SD_RESET_PIN) -#define MP3_CLK_PORT_BASE GPIO_PORT_TO_BASE(MP3_WTV020SD_P04_PORT) -#define MP3_CLK_PIN_MASK GPIO_PIN_MASK(MP3_WTV020SD_P04_PIN) -#define MP3_DATA_PORT_BASE GPIO_PORT_TO_BASE(MP3_WTV020SD_P05_PORT) -#define MP3_DATA_PIN_MASK GPIO_PIN_MASK(MP3_WTV020SD_P05_PIN) - -/*---------------------------------------------------------------------------*/ -static uint8_t initialized = 0; -static int mp3_line_command(uint16_t cmd); -/*---------------------------------------------------------------------------*/ -int -mp3_wtv020sd_config(uint8_t mode) -{ - if(mode != MP3_WTV020SD_GPIO_MODE && mode != MP3_WTV020SD_LINE_MODE) { - return MP3_WTV020SD_ERROR; - } - - if(mode == MP3_WTV020SD_GPIO_MODE) { - GPIO_SOFTWARE_CONTROL(MP3_PLAY_PORT_BASE, MP3_PLAY_PIN_MASK); - GPIO_SET_OUTPUT(MP3_PLAY_PORT_BASE, MP3_PLAY_PIN_MASK); - GPIO_SET_PIN(MP3_PLAY_PORT_BASE, MP3_PLAY_PIN_MASK); - GPIO_SOFTWARE_CONTROL(MP3_NEXT_PORT_BASE, MP3_NEXT_PIN_MASK); - GPIO_SET_OUTPUT(MP3_NEXT_PORT_BASE, MP3_NEXT_PIN_MASK); - GPIO_SET_PIN(MP3_NEXT_PORT_BASE, MP3_NEXT_PIN_MASK); - } else { - GPIO_SOFTWARE_CONTROL(MP3_RESET_PORT_BASE, MP3_RESET_PIN_MASK); - GPIO_SET_OUTPUT(MP3_RESET_PORT_BASE, MP3_RESET_PIN_MASK); - GPIO_SET_PIN(MP3_RESET_PORT_BASE, MP3_RESET_PIN_MASK); - GPIO_SOFTWARE_CONTROL(MP3_CLK_PORT_BASE, MP3_CLK_PIN_MASK); - GPIO_SET_OUTPUT(MP3_CLK_PORT_BASE, MP3_CLK_PIN_MASK); - GPIO_SET_PIN(MP3_CLK_PORT_BASE, MP3_CLK_PIN_MASK); - GPIO_SOFTWARE_CONTROL(MP3_DATA_PORT_BASE, MP3_DATA_PIN_MASK); - GPIO_SET_OUTPUT(MP3_DATA_PORT_BASE, MP3_DATA_PIN_MASK); - GPIO_SET_PIN(MP3_DATA_PORT_BASE, MP3_DATA_PIN_MASK); - } - - GPIO_SOFTWARE_CONTROL(MP3_BUSY_PORT_BASE, MP3_BUSY_PIN_MASK); - GPIO_SET_INPUT(MP3_BUSY_PORT_BASE, MP3_BUSY_PIN_MASK); - - initialized = mode; - return MP3_WTV020SD_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -mp3_wtv020sd_gpio_play(void) -{ - if(initialized != MP3_WTV020SD_GPIO_MODE) { - return MP3_WTV020SD_ERROR; - } - GPIO_CLR_PIN(MP3_PLAY_PORT_BASE, MP3_PLAY_PIN_MASK); - return MP3_WTV020SD_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -mp3_wtv020sd_gpio_stop(void) -{ - if(initialized != MP3_WTV020SD_GPIO_MODE) { - return MP3_WTV020SD_ERROR; - } - GPIO_SET_PIN(MP3_PLAY_PORT_BASE, MP3_PLAY_PIN_MASK); - return MP3_WTV020SD_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -mp3_wtv020sd_gpio_next(void) -{ - if(initialized != MP3_WTV020SD_GPIO_MODE) { - return MP3_WTV020SD_ERROR; - } - GPIO_CLR_PIN(MP3_PLAY_PORT_BASE, MP3_PLAY_PIN_MASK); - clock_delay_usec(MP3_USEC_DELAY); - GPIO_SET_PIN(MP3_PLAY_PORT_BASE, MP3_PLAY_PIN_MASK); - return MP3_WTV020SD_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -mp3_wtv020sd_busy(void) -{ - if((initialized != MP3_WTV020SD_GPIO_MODE) && - (initialized != MP3_WTV020SD_LINE_MODE)) { - return MP3_WTV020SD_ERROR; - } - if(GPIO_READ_PIN(MP3_BUSY_PORT_BASE, MP3_BUSY_PIN_MASK)) { - return MP3_WTV020SD_BUSY; - } - return MP3_WTV020SD_IDLE; -} -/*---------------------------------------------------------------------------*/ -int -mp3_wtv020sd_reset(void) -{ - if(initialized != MP3_WTV020SD_LINE_MODE) { - return MP3_WTV020SD_ERROR; - } - GPIO_CLR_PIN(MP3_CLK_PORT_BASE, MP3_CLK_PIN_MASK); - GPIO_SET_PIN(MP3_RESET_PORT_BASE, MP3_RESET_PIN_MASK); - GPIO_CLR_PIN(MP3_RESET_PORT_BASE, MP3_RESET_PIN_MASK); - clock_delay_usec(MP3_USEC_DELAY); - GPIO_SET_PIN(MP3_RESET_PORT_BASE, MP3_RESET_PIN_MASK); - GPIO_SET_PIN(MP3_CLK_PORT_BASE, MP3_CLK_PIN_MASK); - clock_delay_usec(MP3_USEC_RESET_DELAY); - return MP3_WTV020SD_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -mp3_wtv020sd_sync_play(uint16_t track) -{ - if(initialized != MP3_WTV020SD_LINE_MODE) { - return MP3_WTV020SD_ERROR; - } - mp3_line_command(track); - while(mp3_wtv020sd_busy()); - return MP3_WTV020SD_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -mp3_wtv020sd_async_play(uint16_t track) -{ - if(initialized != MP3_WTV020SD_LINE_MODE) { - return MP3_WTV020SD_ERROR; - } - mp3_line_command(track); - return MP3_WTV020SD_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -mp3_wtv020sd_stop(void) -{ - if(initialized != MP3_WTV020SD_LINE_MODE) { - return MP3_WTV020SD_ERROR; - } - mp3_line_command(MP3_WTV020SD_STOP_VAL); - return MP3_WTV020SD_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -mp3_wtv020sd_pause(void) -{ - if(initialized != MP3_WTV020SD_LINE_MODE) { - return MP3_WTV020SD_ERROR; - } - mp3_line_command(MP3_WTV020SD_PLAY_PAUSE_VAL); - return MP3_WTV020SD_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -mp3_line_command(uint16_t cmd) -{ - uint16_t mask; - if(initialized != MP3_WTV020SD_LINE_MODE) { - return MP3_WTV020SD_ERROR; - } - GPIO_CLR_PIN(MP3_CLK_PORT_BASE, MP3_CLK_PIN_MASK); - clock_delay_usec(MP3_USEC_CMD_DELAY / 10); - for(mask = 0x8000; mask > 0; mask >> 1) { - GPIO_CLR_PIN(MP3_CLK_PORT_BASE, MP3_CLK_PIN_MASK); - clock_delay_usec(MP3_USEC_CMD_DELAY / 2); - if(cmd & mask) { - GPIO_SET_PIN(MP3_DATA_PORT_BASE, MP3_DATA_PIN_MASK); - } else { - GPIO_CLR_PIN(MP3_DATA_PORT_BASE, MP3_DATA_PIN_MASK); - } - clock_delay_usec(MP3_USEC_CMD_DELAY / 2); - GPIO_SET_PIN(MP3_CLK_PORT_BASE, MP3_CLK_PIN_MASK); - clock_delay_usec(MP3_USEC_CMD_DELAY); - if(mask > 0x0001) { - clock_delay_usec(MP3_USEC_CMD_DELAY / 10); - } - } - clock_delay_usec(MP3_USEC_CMD_DELAY / 8); - return MP3_WTV020SD_SUCCESS; -} -/*---------------------------------------------------------------------------*/ - -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/mp3-wtv020sd.h b/arch/platform/zoul/dev/mp3-wtv020sd.h deleted file mode 100644 index 294157ca8..000000000 --- a/arch/platform/zoul/dev/mp3-wtv020sd.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/* -------------------------------------------------------------------------- */ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-mp3-wtv020sd MP3 WTV020SD driver compatible with Zoul-based - * platforms - * - * Driver to control the MP3 WTV020SD board in MP3 mode (GPIO based) and the - * 2-line serial mode (CLK/DI). Loop Mode and Key Modes not implemented. - * More product information available at: - * http://avrproject.ru/chasy-budilnik/WTV020SD.pdf - * An example on how to wire with a sound power amplifier and speakers at - * http://www.hackster.io/zolertia - * Based on the Arduino Wtv020sd16p library - * @{ - * - * \file - * Header file for the MP3 WTV020SD driver - */ -/* -------------------------------------------------------------------------- */ -#ifndef MP3_WTV020SD_H_ -#define MP3_WTV020SD_H_ -/* -------------------------------------------------------------------------- */ -#include -/* -------------------------------------------------------------------------- */ -#define MP3_WTV020SD_ERROR -1 -#define MP3_WTV020SD_SUCCESS 0x00 -#define MP3_WTV020SD_GPIO_MODE 0x01 -#define MP3_WTV020SD_LINE_MODE 0x02 -#define MP3_WTV020SD_IDLE 0x00 -#define MP3_WTV020SD_BUSY 0x0F -/* -------------------------------------------------------------------------- */ -#define MP3_WTV020SD_PLAY_PAUSE_VAL 0xFFFE -#define MP3_WTV020SD_STOP_VAL 0xFFFF -#define MP3_WTV020SD_VOLUME_MIN 0xFFF0 -#define MP3_WTV020SD_VOLUME_MAX 0xFFF7 -/* -------------------------------------------------------------------------- */ -#define MP3_USEC_DELAY 1000 -#define MP3_USEC_CMD_DELAY 100 -#define MP3_USEC_RESET_DELAY ((MP3_USEC_DELAY) * 30) -/* -------------------------------------------------------------------------- */ -#define MP3_TRACK_BASE 0 /* 0000.ad4 */ -/* -------------------------------------------------------------------------- */ -/** - * \brief Init function for the MP3 driver - * - * Configures the pins required to operate in either driver mode - * - * \param mode drive the board using GPIOs or the two-line mode, using - * either MP3_WTV020SD_GPIO_MODE or MP3_WTV020SD_LINE_MODE - * \return MP3_WTV020SD_ERROR if invalid mode selected, otherwise it - * will return MP3_WTV020SD_SUCCESS - */ -int mp3_wtv020sd_config(uint8_t mode); -/** - * \brief Function to play a current track - * - * \return MP3_WTV020SD_ERROR if invalid mode used, otherwise it will - * return MP3_WTV020SD_SUCCESS - */ -int mp3_wtv020sd_gpio_play(void); -/** - * \brief Function to stop a current track - * - * \return MP3_WTV020SD_ERROR if invalid mode used, otherwise it will - * return MP3_WTV020SD_SUCCESS - */ -int mp3_wtv020sd_gpio_stop(void); -/** - * \brief Advances and play the next track, wraps over the playlist - * - * \return MP3_WTV020SD_ERROR if invalid mode used, otherwise it will - * return MP3_WTV020SD_SUCCESS - */ -int mp3_wtv020sd_gpio_next(void); -/** - * \brief Get the current status of the device (playing/stopped) - * - * \return MP3_WTV020SD_BUSY if a track is playing, otherwise it will - * return MP3_WTV020SD_IDLE - */ -int mp3_wtv020sd_busy(void); -/** - * \brief Trigger a module reset - * - * \return MP3_WTV020SD_ERROR if invalid mode used, otherwise it will - * return MP3_WTV020SD_SUCCESS - */ -int mp3_wtv020sd_reset(void); -/** - * \brief Plays the selected track and waits until it stops - * - * \param track forwards and play the selected track, starting from - * MP3_TRACK_BASE (0000.ad4) up to MP3_TRACK_BASE + 511 - * (0511.ad4) - * \return MP3_WTV020SD_ERROR if invalid mode used, otherwise it will - * return MP3_WTV020SD_SUCCESS - */ -int mp3_wtv020sd_sync_play(uint16_t track); -/** - * \brief Plays the selected track and returns immediately - * - * \param track forwards and play the selected track, starting from - * MP3_TRACK_BASE (0000.ad4) up to MP3_TRACK_BASE + 511 - * (0511.ad4) - * \return MP3_WTV020SD_ERROR if invalid mode used, otherwise it will - * return MP3_WTV020SD_SUCCESS - */ -int mp3_wtv020sd_async_play(uint16_t track); -/** - * \brief Stops the current track - * - * \return MP3_WTV020SD_ERROR if invalid mode used, otherwise it will - * return MP3_WTV020SD_SUCCESS - */ -int mp3_wtv020sd_stop(void); -/** - * \brief Pauses the current track - * - * \return MP3_WTV020SD_ERROR if invalid mode used, otherwise it will - * return MP3_WTV020SD_SUCCESS - */ -int mp3_wtv020sd_pause(void); - -/* -------------------------------------------------------------------------- */ -#endif /* ifndef MP3_WTV020SD_H_ */ -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/pm10-sensor.c b/arch/platform/zoul/dev/pm10-sensor.c deleted file mode 100644 index 3ec10de62..000000000 --- a/arch/platform/zoul/dev/pm10-sensor.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-pm10-sensor - * @{ - * - * \file - * GP2Y1010AU0F PM10 sensor example using the ADC sensors wrapper - * \author - * Toni Lozano - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "adc-sensors.h" -#include "adc-zoul.h" -#include "zoul-sensors.h" -#include "dev/pm10-sensor.h" -#include "dev/sys-ctrl.h" -#include "lib/sensors.h" -#include "dev/gpio.h" -#include "dev/ioc.h" -/*---------------------------------------------------------------------------*/ -#define PM10_SENSOR_PORT_BASE GPIO_PORT_TO_BASE(PM10_SENSOR_CTRL_PORT) -#define PM10_SENSOR_PIN_MASK GPIO_PIN_MASK(PM10_SENSOR_CTRL_PIN) -/*---------------------------------------------------------------------------*/ -static int pm10_channel; -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type != SENSORS_ACTIVE) { - return PM10_ERROR; - } - - if(value) { - /* Set as output, used as pulse-driven wave */ - GPIO_SOFTWARE_CONTROL(PM10_SENSOR_PORT_BASE, PM10_SENSOR_PIN_MASK); - ioc_set_over(PM10_SENSOR_CTRL_PORT, PM10_SENSOR_CTRL_PIN, IOC_OVERRIDE_DIS); - GPIO_SET_OUTPUT(PM10_SENSOR_PORT_BASE, PM10_SENSOR_PIN_MASK); - GPIO_CLR_PIN(PM10_SENSOR_PORT_BASE, PM10_SENSOR_PIN_MASK); - - pm10_channel = (1 << value); - return adc_zoul.configure(SENSORS_HW_INIT, pm10_channel); - } - - pm10_channel = 0; - return PM10_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - uint32_t val; - - if(!pm10_channel) { - return PM10_ERROR; - } - - /* Set Pulse Wave pin before measure */ - GPIO_SET_PIN(PM10_SENSOR_PORT_BASE, PM10_SENSOR_PIN_MASK); - /* Pulse wave delay */ - clock_delay_usec(PM10_SENSOR_PULSE_DELAY); - /* Data acquisition */ - val = (uint32_t)adc_zoul.value(pm10_channel); - - if(val == ZOUL_SENSORS_ERROR) { - printf("PM10 sensor: failed retrieving data\n"); - return PM10_ERROR; - } - - /* Default voltage divisor relation is 5/3 aprox, change at adc_wrapper.h, - * calculations below assume a decimation rate of 512 (12 bits ENOB) and - * AVVD5 voltage reference of 3.3V - */ - val *= PM10_EXTERNAL_VREF; - val /= PM10_EXTERNAL_VREF_CROSSVAL; - - /* Applied constant conversion from UAir project - * to obtain value in ppm (value in mV * 0.28) - */ - val *= 28; - val /= 1000; - - /* Clear pulse wave pin */ - GPIO_CLR_PIN(PM10_SENSOR_PORT_BASE, PM10_SENSOR_PIN_MASK); - - return (uint16_t)val; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(pm10, PM10_SENSOR, value, configure, NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/pm10-sensor.h b/arch/platform/zoul/dev/pm10-sensor.h deleted file mode 100644 index 07f7811c1..000000000 --- a/arch/platform/zoul/dev/pm10-sensor.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-pm10-sensor Analog PM10 sensor - * @{ - * \file - * GP2Y1010AU0F PM10 sensor driver - * \author - * Toni Lozano - */ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#ifndef PM10_SENSOR_H_ -#define PM10_SENSOR_H_ -/* -------------------------------------------------------------------------- */ -#define PM10_ERROR (-1) -#define PM10_SUCCESS 0 -#define PM10_SENSOR "PM10 Sensor" -#define PM10_SENSOR_PULSE_DELAY 280 -#define PM10_EXTERNAL_VREF 5000 -#define PM10_EXTERNAL_VREF_CROSSVAL 3000 -/* -------------------------------------------------------------------------- */ -#ifdef PM10_SENSOR_CONF_CTRL_PIN -#define PM10_SENSOR_CTRL_PIN PM10_SENSOR_CONF_CTRL_PIN -#else -#define PM10_SENSOR_CTRL_PIN 7 -#endif -#ifdef PM10_SENSOR_CONF_CTRL_PORT -#define PM10_SENSOR_CTRL_PORT PM10_SENSOR_CONF_CTRL_PORT -#else -#define PM10_SENSOR_CTRL_PORT GPIO_A_NUM -#endif -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor pm10; -/* -------------------------------------------------------------------------- */ -#endif /* ifndef PM10_SENSOR_H_ */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/relay.c b/arch/platform/zoul/dev/relay.c deleted file mode 100644 index aa4f88dd5..000000000 --- a/arch/platform/zoul/dev/relay.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-relay - * @{ - * - * \file - * Driver for a relay actuator - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "relay.h" -#include "dev/gpio.h" -#include "lib/sensors.h" -#include "dev/ioc.h" -/*---------------------------------------------------------------------------*/ -#define RELAY_PORT_BASE GPIO_PORT_TO_BASE(RELAY_PORT) -#define RELAY_PIN_MASK GPIO_PIN_MASK(RELAY_PIN) -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -/*---------------------------------------------------------------------------*/ -static int -relay_on(void) -{ - if(enabled) { - GPIO_SET_PIN(RELAY_PORT_BASE, RELAY_PIN_MASK); - return RELAY_SUCCESS; - } - return RELAY_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -relay_off(void) -{ - if(enabled) { - GPIO_CLR_PIN(RELAY_PORT_BASE, RELAY_PIN_MASK); - return RELAY_SUCCESS; - } - return RELAY_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - return GPIO_READ_PIN(RELAY_PORT_BASE, RELAY_PIN_MASK); - case SENSORS_READY: - return enabled; - } - return RELAY_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - switch(type) { - case RELAY_OFF: - return relay_on(); - case RELAY_ON: - return relay_off(); - case RELAY_TOGGLE: - if(status(SENSORS_ACTIVE)) { - return relay_off(); - } else { - return relay_on(); - } - default: - return RELAY_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if(type != SENSORS_ACTIVE) { - return RELAY_ERROR; - } - - if(value) { - GPIO_SOFTWARE_CONTROL(RELAY_PORT_BASE, RELAY_PIN_MASK); - GPIO_SET_OUTPUT(RELAY_PORT_BASE, RELAY_PIN_MASK); - ioc_set_over(RELAY_PORT, RELAY_PIN, IOC_OVERRIDE_OE); - GPIO_CLR_PIN(RELAY_PORT_BASE, RELAY_PIN_MASK); - enabled = 1; - return RELAY_SUCCESS; - } - - GPIO_SET_INPUT(RELAY_PORT_BASE, RELAY_PIN_MASK); - enabled = 0; - return RELAY_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(relay, RELAY_ACTUATOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/relay.h b/arch/platform/zoul/dev/relay.h deleted file mode 100644 index 4123f9e99..000000000 --- a/arch/platform/zoul/dev/relay.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-relay Generic relay driver - * - * Driver for a generic relay driver - * @{ - * - * \file - * Header file for the generic relay driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef RELAY_H_ -#define RELAY_H_ -/* -------------------------------------------------------------------------- */ -/** - * \name Relay default pin and port - * @{ - */ -#ifdef RELAY_CONF_PIN -#define RELAY_PIN RELAY_CONF_PIN -#else -#define RELAY_PIN 5 -#endif -#ifdef RELAY_CONF_PORT -#define RELAY_PORT RELAY_CONF_PORT -#else -#define RELAY_PORT GPIO_A_NUM -#endif -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Relay available commands - * @{ - */ -#define RELAY_OFF 0x00 -#define RELAY_ON 0x01 -#define RELAY_TOGGLE 0x02 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Relay return types - * @{ - */ -#define RELAY_ERROR (-1) -#define RELAY_SUCCESS 0x00 -/** @} */ -/* -------------------------------------------------------------------------- */ -#define RELAY_ACTUATOR "Generic Relay" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor relay; -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ -#endif /* RELAY_H_ */ -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/rgb-bl-lcd.c b/arch/platform/zoul/dev/rgb-bl-lcd.c deleted file mode 100644 index c0c79ebe8..000000000 --- a/arch/platform/zoul/dev/rgb-bl-lcd.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-lcd-backlight-lcd - * @{ - * - * \file - * Grove LCD with RGB backlight driver - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/i2c.h" -#include "dev/rgb-bl-lcd.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -/*---------------------------------------------------------------------------*/ -typedef struct { - uint8_t display_func; - uint8_t display_ctrl; - uint8_t display_mode; - uint8_t num_lines; - uint8_t cur_line; -} rgb_lcd_config_t; - -static rgb_lcd_config_t lcd; -/*---------------------------------------------------------------------------*/ -static const unsigned char rgb_color[7][3] = -{ - { 0xFF, 0xFF, 0xFF }, /**< White */ - { 0xFF, 0x00, 0x00 }, /**< Red */ - { 0x00, 0xFF, 0x00 }, /**< Green */ - { 0x00, 0x00, 0xFF }, /**< Blue */ - { 0xFF, 0xFF, 0x00 }, /**< Yellow */ - { 0x00, 0xFF, 0xFF }, /**< Purple */ - { 0x00, 0x00, 0x00 }, /**< Black (off) */ -}; -/*---------------------------------------------------------------------------*/ -static int -lcd_backlight_write_reg(uint8_t addr, uint8_t val) -{ - uint8_t buf[2]; - buf[0] = addr; - buf[1] = val; - - i2c_master_enable(); - if(i2c_burst_send(LCD_RGB_ADDR, buf, 2) == I2C_MASTER_ERR_NONE) { - return LCD_RGB_SUCCESS; - } - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -int -lcd_backlight_color(uint8_t color) -{ - lcd_backlight_write_reg(LCD_RGB_LED_RED, rgb_color[color][0]); - lcd_backlight_write_reg(LCD_RGB_LED_GREEN, rgb_color[color][1]); - lcd_backlight_write_reg(LCD_RGB_LED_BLUE, rgb_color[color][2]); - - return LCD_RGB_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -lcd_write_reg(uint8_t *buf, uint8_t num) -{ - if((buf == NULL) || (num <= 0)) { - PRINTF("LCD: invalid write values\n"); - return LCD_RGB_ERROR; - } - - i2c_master_enable(); - if(i2c_burst_send(LCD_ADDR, buf, num) == I2C_MASTER_ERR_NONE) { - return LCD_RGB_SUCCESS; - } - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -lcd_cmd(uint8_t value) -{ - uint8_t buf[2]; - buf[0] = LCD_RGB_COMMAND_BYTE; - buf[1] = value; - - if(lcd_write_reg(buf, 2) == LCD_RGB_SUCCESS) { - return LCD_RGB_SUCCESS; - } - - PRINTF("LCD: failed to send command 0x%02X\n", value); - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -int -lcd_clear_display(void) -{ - if(lcd_cmd(LCD_RGB_CLEAR_DISPLAY) == LCD_RGB_SUCCESS) { - clock_delay_usec(LCD_RGB_DELAY_2MS); - return LCD_RGB_SUCCESS; - } - PRINTF("LCD: failed to clear LCD\n"); - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -int -lcd_return_home(void) -{ - if(lcd_cmd(LCD_RGB_RETURN_HOME) == LCD_RGB_SUCCESS) { - clock_delay_usec(LCD_RGB_DELAY_2MS); - return LCD_RGB_SUCCESS; - } - PRINTF("LCD: failed to return home\n"); - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -int -lcd_set_cursor(uint8_t col, uint8_t row) -{ - uint8_t buf[2]; - buf[0] = LCD_RGB_SETDDRAM_ADDR; - buf[1] = col; - buf[1] += (!row) ? LCD_RGB_START_1ST_ROW : LCD_RGB_START_2ND_ROW; - - if(lcd_write_reg(buf, 2) == LCD_RGB_SUCCESS) { - return LCD_RGB_SUCCESS; - } - - PRINTF("LCD: failed to set cursor\n"); - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -int -lcd_display(uint8_t state) -{ - lcd.display_ctrl &= ~LCD_RGB_DISPLAY_ON; - if(state) { - lcd.display_ctrl |= LCD_RGB_DISPLAY_ON; - } - - if(lcd_cmd(LCD_RGB_DISPLAY_CONTROL + lcd.display_ctrl) == LCD_RGB_SUCCESS) { - return LCD_RGB_SUCCESS; - } - PRINTF("LCD: failed to set display\n"); - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -int -lcd_cursor(uint8_t state) -{ - lcd.display_ctrl &= ~LCD_RGB_DISPLAY_CURSOR_ON; - if(state) { - lcd.display_ctrl |= LCD_RGB_DISPLAY_CURSOR_ON; - } - - if(lcd_cmd(LCD_RGB_DISPLAY_CONTROL + lcd.display_ctrl) == LCD_RGB_SUCCESS) { - return LCD_RGB_SUCCESS; - } - PRINTF("LCD: failed to set cursor\n"); - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -int -lcd_blink(uint8_t state) -{ - lcd.display_ctrl &= ~LCD_RGB_DISPLAY_BLINK_ON; - if(state) { - lcd.display_ctrl |= LCD_RGB_DISPLAY_BLINK_ON; - } - - if(lcd_cmd(LCD_RGB_DISPLAY_CONTROL + lcd.display_ctrl) == LCD_RGB_SUCCESS) { - return LCD_RGB_SUCCESS; - } - PRINTF("LCD: failed to set blink\n"); - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -int -lcd_scroll_display(uint8_t direction, uint8_t num) -{ - uint8_t i; - - /* FIXME: add check for num */ - - for(i = 0; i < num; i++) { - if(lcd_cmd(LCD_RGB_CURSOR_SHIFT + LCD_RGB_CURSOR_DISPLAY_MOVE + - direction) != LCD_RGB_SUCCESS) { - PRINTF("LCD: failed to set scroll\n"); - return LCD_RGB_ERROR; - } - } - return LCD_RGB_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -lcd_text_direction(uint8_t direction) -{ - lcd.display_mode &= ~LCD_RGB_ENTRY_MODE_LEFT; - if(direction) { - lcd.display_mode |= LCD_RGB_ENTRY_MODE_LEFT; - } - - if(lcd_cmd(LCD_RGB_ENTRY_MODE_SET + lcd.display_mode) == LCD_RGB_SUCCESS) { - return LCD_RGB_SUCCESS; - } - PRINTF("LCD: failed to set text direction\n"); - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -int -lcd_autoscroll(uint8_t state) -{ - lcd.display_mode &= ~LCD_RGB_ENTRY_SHIFT_INCREMENT; - if(state) { - lcd.display_mode |= LCD_RGB_ENTRY_SHIFT_INCREMENT; - } - - if(lcd_cmd(LCD_RGB_ENTRY_MODE_SET + lcd.display_mode) == LCD_RGB_SUCCESS) { - return LCD_RGB_SUCCESS; - } - PRINTF("LCD: failed to set autoscroll\n"); - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -lcd_write_byte(int c) -{ - uint8_t buf[2]; - buf[0] = LCD_RGB_SETCGRAM_ADDR; - buf[1] = c; - - if(lcd_write_reg(buf, 2) == LCD_RGB_SUCCESS) { - return LCD_RGB_SUCCESS; - } - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -uint8_t -lcd_write(const char *s) -{ - uint8_t i = 0; - while(s && *s != 0) { - lcd_write_byte(*s++); - i++; - } - - PRINTF("LCD: wrote %u bytes\n", i); - return i; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - - if(type != LCD_RGB_ACTIVE) { - PRINTF("LCD: option not supported\n"); - return LCD_RGB_ERROR; - } - - switch(type) { - - /* Default initialization value is 16 columns and 2 rows */ - case LCD_RGB_ACTIVE: - if(value) { - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, - I2C_SCL_NORMAL_BUS_SPEED); - - lcd.display_func = LCD_RGB_FUNCTION_SET_2_LINE + - LCD_RGB_FUNCTION_SET_5x8_DOTS; - - /* wait at least 50ms for the LCD to initialize */ - clock_delay_usec(LCD_RGB_DELAY_50MS); - - /* Send function set command sequence */ - if(lcd_cmd(LCD_RGB_FUNCTION_SET + lcd.display_func) == LCD_RGB_ERROR) { - return LCD_RGB_ERROR; - } - clock_delay_usec(LCD_RGB_DELAY_4_5MS); - - /* Datasheet instructs to repeat a second time... */ - if(lcd_cmd(LCD_RGB_FUNCTION_SET + lcd.display_func) == LCD_RGB_ERROR) { - return LCD_RGB_ERROR; - } - clock_delay_usec(LCD_RGB_DELAY_150US); - - /* and a third... */ - if(lcd_cmd(LCD_RGB_FUNCTION_SET + lcd.display_func) == LCD_RGB_ERROR) { - return LCD_RGB_ERROR; - } - - /* Now we can configure everything */ - if(lcd_cmd(LCD_RGB_FUNCTION_SET + lcd.display_func) == LCD_RGB_ERROR) { - return LCD_RGB_ERROR; - } - - /* Turn on the display */ - lcd.display_ctrl = LCD_RGB_DISPLAY_ON + LCD_RGB_DISPLAY_CURSOR_OFF + - LCD_RGB_DISPLAY_BLINK_OFF; - if(lcd_cmd(LCD_RGB_DISPLAY_CONTROL + lcd.display_ctrl) == LCD_RGB_ERROR) { - return LCD_RGB_ERROR; - } - - /* Clear the display */ - if(lcd_clear_display() == LCD_RGB_ERROR) { - return LCD_RGB_ERROR; - } - - /* Initialize text direction (the LCD supports japanese, cool! */ - lcd.display_mode = LCD_RGB_ENTRY_MODE_LEFT + LCD_RGB_ENTRY_SHIFT_DECREMENT; - - /* configure the entry mode */ - if(lcd_cmd(LCD_RGB_ENTRY_MODE_SET + lcd.display_mode) == LCD_RGB_ERROR) { - return LCD_RGB_ERROR; - } - - /* Backlight initialization */ - lcd_backlight_write_reg(LCD_RGB_LED_MODE_1, LCD_RGB_LED_MODE_DEFAULT); - lcd_backlight_write_reg(LCD_RGB_LED_MODE_2, LCD_RGB_LED_MODE_DEFAULT); - lcd_backlight_write_reg(LCD_RGB_LED_OUT, LCD_RGB_LED_OUT_PWM_CTRL); - - /* Set the backlight color */ - lcd_backlight_color(LCD_RGB_RED); - - PRINTF("LCD: initialized\n"); - enabled = 1; - return LCD_RGB_SUCCESS; - } else { - lcd_display(LCD_RGB_DISPLAY_OFF); - lcd_backlight_color(LCD_RGB_BLACK); - enabled = 0; - } - } - - return LCD_RGB_ERROR; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(rgb_bl_lcd, RGB_BACKLIGHT_LCD, NULL, configure, NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/rgb-bl-lcd.h b/arch/platform/zoul/dev/rgb-bl-lcd.h deleted file mode 100644 index eaf5c2761..000000000 --- a/arch/platform/zoul/dev/rgb-bl-lcd.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 SOcFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-lcd-backlight-lcd Grove LCD with RGB backlight - * @{ - * - * \file - * Grove LCD with RGB backlight header - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/* -------------------------------------------------------------------------- */ -#ifndef RGB_BL_LCD_H_ -#define RGB_BL_LCD_H_ -/* -------------------------------------------------------------------------- */ -/** - * \name LCD w/ backlight enums - * @{ - */ -enum { - LCD_RGB_WHITE = 0x00, - LCD_RGB_RED = 0x01, - LCD_RGB_GREEN = 0x02, - LCD_RGB_BLUE = 0x03, - LCD_RGB_BLACK = 0x04, - LCD_RGB_YELLOW = 0x05, - LCD_RGB_PURPLE = 0x06, -}; -/* -------------------------------------------------------------------------- */ -enum { - LCD_RGB_1ST_ROW = 0x00, - LCD_RGB_2ND_ROW = 0x01, -}; -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name LCD w/ backlight address, registers and bitmasks - * @{ - */ -#define LCD_ADDR 0x3E -#define LCD_RGB_ADDR 0x62 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_REG_MODE1 0x00 -#define LCD_RGB_REG_MODE2 0x01 -#define LCD_RGB_REG_OUTPUT 0x08 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_COMMAND_BYTE 0x80 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_CLEAR_DISPLAY 0x01 -#define LCD_RGB_RETURN_HOME 0x02 -#define LCD_RGB_ENTRY_MODE_SET 0x04 -#define LCD_RGB_DISPLAY_CONTROL 0x08 -#define LCD_RGB_CURSOR_SHIFT 0x10 -#define LCD_RGB_FUNCTION_SET 0x20 -#define LCD_RGB_SETCGRAM_ADDR 0x40 -#define LCD_RGB_SETDDRAM_ADDR 0x80 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_ENTRY_MODE_RIGHT 0x00 -#define LCD_RGB_ENTRY_MODE_LEFT 0x02 -#define LCD_RGB_ENTRY_SHIFT_INCREMENT 0x01 -#define LCD_RGB_ENTRY_SHIFT_DECREMENT 0x00 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_DISPLAY_ON 0x04 -#define LCD_RGB_DISPLAY_OFF 0x00 -#define LCD_RGB_DISPLAY_CURSOR_ON 0x02 -#define LCD_RGB_DISPLAY_CURSOR_OFF 0x00 -#define LCD_RGB_DISPLAY_BLINK_ON 0x01 -#define LCD_RGB_DISPLAY_BLINK_OFF 0x00 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_CURSOR_DISPLAY_MOVE 0x08 -#define LCD_RGB_CURSOR_MOVE 0x00 -#define LCD_RGB_CURSOR_MOVE_RIGHT 0x04 -#define LCD_RGB_CURSOR_MOVE_LEFT 0x00 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_FUNCTION_SET_8BIT 0x10 -#define LCD_RGB_FUNCTION_SET_4BIT 0x00 -#define LCD_RGB_FUNCTION_SET_2_LINE 0x08 -#define LCD_RGB_FUNCTION_SET_1_LINE 0x00 -#define LCD_RGB_FUNCTION_SET_5x10_DOTS 0x04 -#define LCD_RGB_FUNCTION_SET_5x8_DOTS 0x00 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_LED_MODE_1 0x00 -#define LCD_RGB_LED_MODE_2 0x01 -#define LCD_RGB_LED_OUT 0x08 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_LED_RED 0x04 -#define LCD_RGB_LED_GREEN 0x03 -#define LCD_RGB_LED_BLUE 0x02 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_LED_MODE_DEFAULT 0x00 -#define LCD_RGB_LED_OUT_PWM_CTRL 0xAA -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_DELAY_50MS 50000 -#define LCD_RGB_DELAY_4_5MS 4500 -#define LCD_RGB_DELAY_150US 150 -#define LCD_RGB_DELAY_2MS 2000 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_START_1ST_ROW 0x80 -#define LCD_RGB_START_2ND_ROW 0xC0 -/* -------------------------------------------------------------------------- */ -#define LCD_RGB_ACTIVE SENSORS_ACTIVE -#define LCD_RGB_ERROR (-1) -#define LCD_RGB_SUCCESS 0x00 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name TSL2563 return and command values - * @{ - */ -/* LCD functions */ -uint8_t lcd_write(const char *s); -int lcd_set_cursor(uint8_t col, uint8_t row); -int lcd_autoscroll(uint8_t state); -int lcd_scroll_display(uint8_t direction, uint8_t num); -int lcd_blink(uint8_t state); -int lcd_clear_display(void); -int lcd_return_home(void); -int lcd_display(uint8_t state); -int lcd_cursor(uint8_t state); -int lcd_text_direction(uint8_t direction); - -/* Backlight functions */ -int lcd_backlight_color(uint8_t color); -/** @} */ -/* -------------------------------------------------------------------------- */ -#define RGB_BACKLIGHT_LCD "LCD with RGB backlight" -extern const struct sensors_sensor rgb_bl_lcd; -/* -------------------------------------------------------------------------- */ -#endif /* ifndef RGB_BL_LCD_ */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/rtcc-config.h b/arch/platform/zoul/dev/rtcc-config.h deleted file mode 100644 index cf5f92135..000000000 --- a/arch/platform/zoul/dev/rtcc-config.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/* -------------------------------------------------------------------------- */ -/** - * \addtogroup remote-rtcc - * @{ - * - * Driver for the RE-Mote RTCC (Real Time Clock Calendar) - * @{ - * - * \file - * RTCC configuration file - * - * \author - * - * Antonio Lignan - * Aitor Mejias - * Toni Lozano - */ -/* -------------------------------------------------------------------------- */ -#ifndef RTCC_CONFIG_H_ -#define RTCC_CONFIG_H_ -/* -------------------------------------------------------------------------- */ -#include "rtcc.h" -/* -------------------------------------------------------------------------- */ -/** - * \name RTCC configuration macros - * @{ - */ -#define RTCC_SET_DEFAULT_CONFIG 1 -#define RTCC_CLEAR_INT_MANUALLY 1 -#define RTCC_SET_AUTOCAL 1 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name RTCC default configuration (if enabled by RTCC_SET_DEFAULT_CONFIG) - * @{ - */ -/* Reset values from the Application Manual */ -#define RTCC_DEFAULT_STATUS 0x00 -#define RTCC_DEFAULT_CTRL1 0x11 -#define RTCC_DEFAULT_CTRL2 0x00 -#define RTCC_DEFAULT_INTMASK 0xE0 -#define RTCC_DEFAULT_SQW 0x26 -#define RTCC_DEFAULT_TIMER_CTRL 0x23 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name RTCC default configuration structure - * @{ - */ -typedef struct ab080x_register_config { - uint8_t reg; - uint8_t val; -} ab080x_register_config_t; -/* -------------------------------------------------------------------------- */ -static const ab080x_register_config_t ab080x_default_setting[] = -{ - { (CONFIG_MAP_OFFSET + STATUS_ADDR), RTCC_DEFAULT_STATUS }, - { (CONFIG_MAP_OFFSET + CTRL_1_ADDR), RTCC_DEFAULT_CTRL1 }, - { (CONFIG_MAP_OFFSET + CTRL_2_ADDR), RTCC_DEFAULT_CTRL2 }, - { (CONFIG_MAP_OFFSET + INT_MASK_ADDR), RTCC_DEFAULT_INTMASK }, - { (CONFIG_MAP_OFFSET + SQW_ADDR), RTCC_DEFAULT_SQW }, - { (CONFIG_MAP_OFFSET + TIMER_CONTROL_ADDR), RTCC_DEFAULT_TIMER_CTRL }, -}; -/** @} */ -/* -------------------------------------------------------------------------- */ -#endif /* ifndef RTCC_CONFIG_H_ */ -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ \ No newline at end of file diff --git a/arch/platform/zoul/dev/rtcc.c b/arch/platform/zoul/dev/rtcc.c deleted file mode 100644 index d03413d5b..000000000 --- a/arch/platform/zoul/dev/rtcc.c +++ /dev/null @@ -1,958 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-rtcc - * @{ - * - * Driver for the RE-Mote RTCC (Real Time Clock Calendar) - * @{ - * - * \file - * Driver for the RE-Mote RF Real Time Clock Calendar (RTCC) - * - * \author - * - * Antonio Lignan - * Aitor Mejias - * Toni Lozano - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio.h" -#include "dev/i2c.h" -#include "rtcc.h" -#include "rtcc-config.h" -#include "dev/leds.h" -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define RTC_INT1_PORT_BASE GPIO_PORT_TO_BASE(RTC_INT1_PORT) -#define RTC_INT1_PIN_MASK GPIO_PIN_MASK(RTC_INT1_PIN) -/*---------------------------------------------------------------------------*/ -/* Callback pointers when interrupt occurs */ -void (*rtcc_int1_callback)(uint8_t value); -/* -------------------------------------------------------------------------- */ -static const char *ab080x_td_register_name[] = -{ - "Mseconds", - "Seconds", - "Minutes", - "Hours", - "Days", - "Months", - "Years", - "Weekdays", -}; -/* -------------------------------------------------------------------------- */ -static const char *ab080x_config_register_name[] = -{ - "STATUS", - "CTRL1", - "CTRL2", - "INTMASK", - "SQW", - "CAL_XT", - "CAL_RCU", - "CAL_RCL", - "INTPOL", - "TIMER_CTRL", - "TIMER_CDOWN", - "TIMER_INIT", - "WDT", - "OSC_CTRL", - "OSC_STAT", - "CONF_KEY", - "TRICKLE", - "BREF", -}; -/*---------------------------------------------------------------------------*/ -static uint8_t -bcd_to_dec(uint8_t val) -{ - return (uint8_t)(((val >> 4) * 10) + (val % 16)); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -dec_to_bcd(uint8_t val) -{ - return (uint8_t)(((val / 10) << 4) + (val % 10)); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -check_leap_year(uint8_t val) -{ - return ((val % 4) && (val % 100)) || (val % 400); -} -/*---------------------------------------------------------------------------*/ -static uint16_t -ab08_read_reg(uint8_t reg, uint8_t *buf, uint8_t regnum) -{ - i2c_master_enable(); - if(i2c_single_send(AB08XX_ADDR, reg) == I2C_MASTER_ERR_NONE) { - if(i2c_burst_receive(AB08XX_ADDR, buf, regnum) == I2C_MASTER_ERR_NONE) { - return AB08_SUCCESS; - } - } - return AB08_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int8_t -ab08_write_reg(uint8_t reg, uint8_t *buf, uint8_t regnum) -{ - uint8_t i, buff[INT_BUFF_SIZE]; - - if(regnum > (INT_BUFF_SIZE - 1)) { - return AB08_ERROR; - } - - /* FIXME: Replace by single_send/burst_send */ - - buff[0] = reg; - for(i = 0; i < regnum; i++) { - buff[(i + 1)] = buf[i]; - } - - i2c_master_enable(); - if(i2c_burst_send(AB08XX_ADDR, buff, (regnum + 1)) == I2C_MASTER_ERR_NONE) { - return AB08_SUCCESS; - } - - return AB08_ERROR; -} -/*---------------------------------------------------------------------------*/ -static void -write_default_config(void) -{ - const ab080x_register_config_t *settings; - settings = ab080x_default_setting; - uint8_t i, len = (sizeof(ab080x_default_setting) / sizeof(ab080x_register_config_t)); - - for(i = 0; i < len; i++) { - ab08_write_reg(settings[i].reg, (uint8_t *)&settings[i].val, 1); - } -} -/*---------------------------------------------------------------------------*/ -static int8_t -ab08_key_reg(uint8_t unlock) -{ - if((unlock != RTCC_CONFKEY_OSCONTROL) && (unlock != RTCC_CONFKEY_SWRESET) && - (unlock != RTCC_CONFKEY_DEFREGS)) { - PRINTF("RTC: invalid confkey values\n"); - return AB08_ERROR; - } - - if(ab08_write_reg((CONFIG_MAP_OFFSET + CONF_KEY_ADDR), &unlock, 1)) { - PRINTF("RTC: failed to write to confkey register\n"); - return AB08_ERROR; - } - - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int8_t -ab08_read_status(uint8_t *buf) -{ - return ab08_read_reg((STATUS_ADDR + CONFIG_MAP_OFFSET), buf, 1); -} -/*---------------------------------------------------------------------------*/ -static int8_t -ab08_ctrl1_config(uint8_t cmd) -{ - uint8_t ctrl1 = 0; - - if(cmd >= RTCC_CMD_MAX) { - return AB08_ERROR; - } - - if(ab08_read_reg((CONFIG_MAP_OFFSET + CTRL_1_ADDR), &ctrl1, 1)) { - PRINTF("RTC: failed to retrieve CTRL1 register\n"); - return AB08_ERROR; - } - - switch(cmd) { - case RTCC_CMD_LOCK: - ctrl1 &= ~CTRL1_WRTC; - break; - case RTCC_CMD_UNLOCK: - ctrl1 |= CTRL1_WRTC; - break; - case RTCC_CMD_ENABLE: - ctrl1 &= ~CTRL1_STOP; - break; - case RTCC_CMD_STOP: - ctrl1 |= CTRL1_STOP; - break; - default: - return AB08_ERROR; - } - - if(ab08_write_reg((CONFIG_MAP_OFFSET + CTRL_1_ADDR), - &ctrl1, 1) == AB08_ERROR) { - PRINTF("RTC: failed to write to the CTRL1 register\n"); - return AB08_ERROR; - } - - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int8_t -ab08_check_td_format(simple_td_map *data, uint8_t alarm_state) -{ - /* Using fixed values as these are self-indicative of the variable */ - if((data->seconds > 59) || (data->minutes > 59) || (data->hours > 23)) { - return AB08_ERROR; - } - - if((data->months > 12) || (data->weekdays > 7) || (data->day > 31)) { - return AB08_ERROR; - } - - /* Fixed condition for February (month 2) */ - if(data->months == 2) { - if(check_leap_year(data->years)) { - if(data->day > 29) { - return AB08_ERROR; - } - } else { - if(data->day > 28) { - return AB08_ERROR; - } - } - } - - /* Alarm doesn't care about year */ - if(!alarm_state) { - /* AB08X5 Real-Time Clock Family, page 55 (year up to 2199) */ - if(data->years > 199) { - return AB08_ERROR; - } - } - - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int8_t -rtcc_set_time_date(simple_td_map *data) -{ - uint8_t aux = 0; - uint8_t rtc_buffer[RTCC_TD_MAP_SIZE]; - - if(ab08_check_td_format(data, 0) == AB08_ERROR) { - PRINTF("RTC: Invalid time/date values\n"); - return AB08_ERROR; - } - - if(ab08_read_reg((CTRL_1_ADDR + CONFIG_MAP_OFFSET), - &aux, 1) == AB08_ERROR) { - PRINTF("RTC: failed to retrieve CONTROL1 register\n"); - return AB08_ERROR; - } - - rtc_buffer[WEEKDAYLS_ADDR] = dec_to_bcd(data->weekdays); - rtc_buffer[YEAR_ADDR] = dec_to_bcd(data->years); - rtc_buffer[MONTHS_ADDR] = dec_to_bcd(data->months); - rtc_buffer[DAY_ADDR] = dec_to_bcd(data->day); - rtc_buffer[HOUR_ADDR] = dec_to_bcd(data->hours); - rtc_buffer[MIN_ADDR] = dec_to_bcd(data->minutes); - rtc_buffer[SEC_ADDR] = dec_to_bcd(data->seconds); - rtc_buffer[CENTHS_ADDR] = dec_to_bcd(data->miliseconds); - - /* Check if we are to set the time in 12h/24h format */ - if(data->mode == RTCC_24H_MODE) { - aux &= ~CTRL1_1224; - } else { - if((data->hours == 0) || (data->hours > 12)) { - PRINTF("RTC: Invalid hour configuration (12h mode selected)\n"); - return AB08_ERROR; - } - aux |= CTRL1_1224; - if(data->mode == RTCC_12H_MODE_PM) { - /* Toggle bit for PM */ - rtc_buffer[HOUR_ADDR] |= RTCC_TOGGLE_PM_BIT; - } else { - PRINTF("RTC: Invalid time mode selected\n"); - return AB08_ERROR; - } - } - - /* Write the 12h/24h config */ - if(ab08_write_reg((CTRL_1_ADDR + CONFIG_MAP_OFFSET), - &aux, 1) == AB08_ERROR) { - PRINTF("RTC: failed to write 12h/24h configuration\n"); - return AB08_ERROR; - } - - /* Reading the STATUS register with the CONTROL1.ARST set will clear the - * interrupt flags, we write directly to the register without caring its - * actual status and let the interrupt handler take care of any pending flag - */ - - if(ab08_read_reg((STATUS_ADDR + CONFIG_MAP_OFFSET), &aux, 1) == AB08_ERROR) { - PRINTF("RTC: failed to retrieve STATUS register\n"); - return AB08_ERROR; - } - - if(data->century == RTCC_CENTURY_20XX) { - aux |= STATUS_CB; - } else if(data->century == RTCC_CENTURY_19XX_21XX) { - aux |= ~STATUS_CB; - } else { - PRINTF("RTC: invalid century value\n"); - return AB08_ERROR; - } - - PRINTF("RTC: current STATUS value 0x%02X\n", aux); - - if(ab08_write_reg((STATUS_ADDR + CONFIG_MAP_OFFSET), &aux, 1) == AB08_ERROR) { - PRINTF("RTC: failed to write century to STATUS register\n"); - return AB08_ERROR; - } - - /* Set the WRTC bit to enable writting to the counters */ - if(ab08_ctrl1_config(RTCC_CMD_UNLOCK) == AB08_ERROR) { - return AB08_ERROR; - } - - /* Write the buffers but the mode and century fields (used only for config) */ - if(ab08_write_reg(CENTHS_ADDR, rtc_buffer, - RTCC_TD_MAP_SIZE) == AB08_ERROR) { - PRINTF("RTC: failed to write date configuration\n"); - return AB08_ERROR; - } - - /* Lock the RTCC and return */ - if(ab08_ctrl1_config(RTCC_CMD_LOCK) == AB08_ERROR) { - return AB08_ERROR; - } - - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int8_t -rtcc_get_time_date(simple_td_map *data) -{ - uint8_t rtc_buffer[RTCC_TD_MAP_SIZE]; - - if(ab08_read_reg(CENTHS_ADDR, rtc_buffer, - RTCC_TD_MAP_SIZE) == AB08_ERROR) { - PRINTF("RTC: failed to retrieve date and time values\n"); - return AB08_ERROR; - } - - data->weekdays = bcd_to_dec(rtc_buffer[WEEKDAYLS_ADDR]); - data->years = bcd_to_dec(rtc_buffer[YEAR_ADDR]); - data->months = bcd_to_dec(rtc_buffer[MONTHS_ADDR]); - data->day = bcd_to_dec(rtc_buffer[DAY_ADDR]); - data->hours = bcd_to_dec(rtc_buffer[HOUR_ADDR]); - data->minutes = bcd_to_dec(rtc_buffer[MIN_ADDR]); - data->seconds = bcd_to_dec(rtc_buffer[SEC_ADDR]); - data->miliseconds = bcd_to_dec(rtc_buffer[CENTHS_ADDR]); - - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int8_t -rtcc_set_alarm_time_date(simple_td_map *data, uint8_t state, uint8_t repeat, - uint8_t trigger) -{ - uint8_t aux[4], buf[RTCC_ALARM_MAP_SIZE]; - - if((trigger != RTCC_TRIGGER_INT2) && (trigger != RTCC_TRIGGER_INT1) && - (trigger != RTCC_TRIGGER_BOTH)) { - PRINTF("RTC: invalid trigger pin\n"); - return AB08_ERROR; - } - - if(state == RTCC_ALARM_OFF) { - if(ab08_read_reg((INT_MASK_ADDR + CONFIG_MAP_OFFSET), - &aux[0], 1) == AB08_ERROR) { - PRINTF("RTC: failed to retrieve INTMASK register\n"); - return AB08_ERROR; - } - - aux[0] &= ~INTMASK_AIE; - - if(ab08_write_reg((INT_MASK_ADDR + CONFIG_MAP_OFFSET), - &aux[0], 1) == AB08_ERROR) { - PRINTF("RTC: failed to clear the alarm config\n"); - return AB08_ERROR; - } - return AB08_SUCCESS; - } - - if((data == NULL) || (ab08_check_td_format(data, 1) == AB08_ERROR)) { - PRINTF("RTC: invalid alarm values\n"); - return AB08_ERROR; - } - - if((state >= RTCC_ALARM_MAX) || (repeat >= RTCC_REPEAT_100THS)) { - PRINTF("RTC: invalid alarm config type or state\n"); - return AB08_ERROR; - } - - /* Stop the RTCC */ - ab08_ctrl1_config(RTCC_CMD_STOP); - - buf[WEEKDAYS_ALARM_ADDR] = dec_to_bcd(data->weekdays); - buf[MONTHS_ALARM_ADDR] = dec_to_bcd(data->months); - buf[DAY_ALARMS_ADDR] = dec_to_bcd(data->day); - buf[HOURS_ALARM_ADDR] = dec_to_bcd(data->hours); - buf[MINUTES_ALARM_ADDR] = dec_to_bcd(data->minutes); - buf[SECONDS_ALARM_ADDR] = dec_to_bcd(data->seconds); - buf[HUNDREDTHS_ALARM_ADDR] = dec_to_bcd(data->miliseconds); - - /* Check if the 12h/24h match the current configuration */ - if(ab08_read_reg((CTRL_1_ADDR + CONFIG_MAP_OFFSET), - &aux[0], 1) == AB08_ERROR) { - PRINTF("RTC: failed to retrieve CONTROL1 register\n"); - return AB08_ERROR; - } - - if(((aux[0] & CTRL1_1224) && (data->mode == RTCC_24H_MODE)) || - (!(aux[0] & CTRL1_1224) && ((data->mode == RTCC_12H_MODE_AM) || - (data->mode == RTCC_12H_MODE_PM)))) { - PRINTF("RTC: 12/24h mode and present date config mismatch\n"); - return AB08_ERROR; - } - - if(data->mode != RTCC_24H_MODE) { - if((data->hours == 0) || (data->hours > 12)) { - PRINTF("RTC: Invalid hour configuration (12h mode selected)\n"); - return AB08_ERROR; - } - - /* Toggle the PM bit */ - if(data->mode == RTCC_12H_MODE_PM) { - buf[HOURS_ALARM_ADDR] |= RTCC_TOGGLE_PM_BIT; - } - } - - /* Clear the RPT field */ - if(ab08_read_reg((TIMER_CONTROL_ADDR + CONFIG_MAP_OFFSET), - &aux[0], 1) == AB08_ERROR) { - PRINTF("RTC: failed to retrieve TIMER CTRL register\n"); - return AB08_ERROR; - } - - aux[0] &= ~COUNTDOWN_TIMER_RPT_SECOND; - - /* AB08XX application manual, table 76 */ - if(repeat == RTCC_REPEAT_10THS) { - buf[HUNDREDTHS_ALARM_ADDR] |= RTCC_FIX_10THS_HUNDRETHS; - repeat = RTCC_REPEAT_SECOND; - } else if(repeat == RTCC_REPEAT_100THS) { - buf[HUNDREDTHS_ALARM_ADDR] |= RTCC_FIX_100THS_HUNDRETHS; - repeat = RTCC_REPEAT_SECOND; - } - - if(repeat != RTCC_REPEAT_NONE) { - aux[0] |= (repeat << COUNTDOWN_TIMER_RPT_SHIFT); - } - - /* We are using as default the level interrupt instead of pulses */ - /* FIXME: make this selectable */ - aux[0] |= COUNTDOWN_TIMER_TM; - aux[0] &= ~COUNTDOWN_TIMER_TRPT; - - if(ab08_write_reg((TIMER_CONTROL_ADDR + CONFIG_MAP_OFFSET), - &aux[0], 1) == AB08_ERROR) { - PRINTF("RTC: failed to clear the alarm config\n"); - return AB08_ERROR; - } - - if(ab08_read_reg((STATUS_ADDR + CONFIG_MAP_OFFSET), - aux, 4) == AB08_ERROR) { - PRINTF("RTC: failed to read configuration registers\n"); - return AB08_ERROR; - } - - /* Clear ALM field if any */ - aux[STATUS_ADDR] &= ~STATUS_ALM; - -#if RTCC_CLEAR_INT_MANUALLY - aux[CTRL_1_ADDR] &= ~CTRL1_ARST; -#endif - - /* Clear the AIE alarm bit */ - aux[INT_MASK_ADDR] &= ~INTMASK_AIE; - - /* Configure Interrupt parameters for Alarm Interrupt Mode in nIRQ - * or nAIRQ pins and fixed level until interrupt flag is cleared - * RTC_INT1 is connected to the CC2538 - * RTC_INT2 is connected to the power management PIC in revision B - */ - if (trigger == RTCC_TRIGGER_INT2) { - aux[CTRL_2_ADDR] |= CTRL2_OUT2S_NAIRQ_OUTB; - /* Only options left enable the INT1 interrupt pin */ - } else { - GPIO_ENABLE_INTERRUPT(RTC_INT1_PORT_BASE, RTC_INT1_PIN_MASK); - ioc_set_over(RTC_INT1_PORT, RTC_INT1_PIN, IOC_OVERRIDE_PUE); - NVIC_EnableIRQ(RTC_INT1_VECTOR); - } - - if (trigger == RTCC_TRIGGER_INT1) { - aux[CTRL_2_ADDR] |= CTRL2_OUT1S_NIRQ_NAIRQ_OUT; - } else if (trigger == RTCC_TRIGGER_BOTH) { - aux[CTRL_2_ADDR] |= (CTRL2_OUT1S_NIRQ_NAIRQ_OUT + CTRL2_OUT2S_NAIRQ_OUTB); - } - - if(repeat != RTCC_REPEAT_NONE) { - aux[INT_MASK_ADDR] &= ~INTMASK_IM_LOW; - } else { - aux[INT_MASK_ADDR] |= INTMASK_IM_LOW; - } - - if(ab08_write_reg((STATUS_ADDR + CONFIG_MAP_OFFSET), aux, 4) == AB08_ERROR) { - PRINTF("RTC: failed to clear alarm config\n"); - return AB08_ERROR; - } - - /* Write to the alarm counters */ - if(ab08_write_reg((HUNDREDTHS_ALARM_ADDR + ALARM_MAP_OFFSET), buf, - RTCC_ALARM_MAP_SIZE) == AB08_ERROR) { - PRINTF("RTC: failed to set the alarm\n"); - return AB08_ERROR; - } - - /* And finally enable the AIE bit */ - aux[INT_MASK_ADDR] |= INTMASK_AIE; - if(ab08_write_reg((INT_MASK_ADDR + CONFIG_MAP_OFFSET), - &aux[INT_MASK_ADDR], 1) == AB08_ERROR) { - PRINTF("RTC: failed to enable the alarm\n"); - return AB08_ERROR; - } - - /* Enable back the RTCC */ - ab08_ctrl1_config(RTCC_CMD_ENABLE); - - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int8_t -rtcc_date_increment_seconds(simple_td_map *data, uint16_t seconds) -{ - uint16_t aux; - - if(data == NULL) { - PRINTF("RTC: invalid argument\n"); - return AB08_ERROR; - } - - if(rtcc_get_time_date(data) == AB08_ERROR) { - return AB08_ERROR; - } - - /* Nothing to do here but congratulate the user */ - if(!seconds) { - return AB08_SUCCESS; - } - - aux = data->seconds + seconds; - data->seconds = (uint8_t)(aux % 60); - - /* Add the remainder seconds to the minutes counter */ - if(aux > 59) { - aux /= 60; - aux += data->minutes; - data->minutes = (uint8_t)(aux % 60); - } - - /* Add the remainder minutes to the hours counter */ - if(aux > 59) { - aux /= 60; - aux += data->hours; - data->hours = (uint8_t)(aux % 24); - } - - if(aux > 23) { - aux /= 24; - aux += data->day; - - if(data->months == 2) { - if(check_leap_year(data->years)) { - if(aux > 29) { - data->day = (uint8_t)(aux % 29); - data->months++; - } - } else if(aux > 28) { - data->day = (uint8_t)(aux % 28); - data->months++; - } - } else if((data->months == 4) || (data->months == 6) || - (data->months == 9) || (data->months == 11)) { - if(aux > 30) { - data->day = (uint8_t)(aux % 30); - data->months++; - } - } else if(aux > 31) { - data->day = (uint8_t)(aux % 31); - data->months++; - } - } - - if(data->months > 12) { - data->months = data->months % 12; - data->years++; - } - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -PROCESS(rtcc_int_process, "RTCC interruption process handler"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(rtcc_int_process, ev, data) -{ - static uint8_t buf; - PROCESS_EXITHANDLER(); - PROCESS_BEGIN(); - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - - if(ab08_read_status(&buf) == AB08_ERROR) { - PRINTF("RTC: failed to retrieve ARST value\n"); - PROCESS_EXIT(); - } - - /* We only handle the AIE (alarm interrupt) only */ - if((buf & STATUS_ALM) && (rtcc_int1_callback != NULL)) { -#if RTCC_CLEAR_INT_MANUALLY - buf &= ~STATUS_ALM; - if(ab08_write_reg((STATUS_ADDR + CONFIG_MAP_OFFSET), - &buf, 1) == AB08_ERROR) { - PRINTF("RTC: failed to clear the alarm\n"); - return AB08_ERROR; - } -#endif - rtcc_int1_callback(0); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -int8_t -rtcc_print(uint8_t value) -{ - uint8_t i, len, reg; - char **name; - uint8_t rtc_buffer[RTCC_CONFIG_MAP_SIZE]; - - if(value >= RTCC_PRINT_MAX) { - return AB08_ERROR; - } - - switch(value) { - case RTCC_PRINT_CONFIG: - len = (RTCC_CONFIG_MAP_SIZE - 1); - reg = STATUS_ADDR + CONFIG_MAP_OFFSET; - name = (char **)ab080x_config_register_name; - break; - case RTCC_PRINT_ALARM: - case RTCC_PRINT_ALARM_DEC: - len = RTCC_ALARM_MAP_SIZE; - reg = HUNDREDTHS_ALARM_ADDR + ALARM_MAP_OFFSET; - name = (char **)ab080x_td_register_name; - break; - case RTCC_PRINT_DATE: - case RTCC_PRINT_DATE_DEC: - len = RTCC_TD_MAP_SIZE; - reg = CENTHS_ADDR; - name = (char **)ab080x_td_register_name; - break; - default: - return AB08_ERROR; - } - - if(ab08_read_reg(reg, rtc_buffer, len) == AB08_ERROR) { - PRINTF("RTC: failed to retrieve values to print\n"); - return AB08_ERROR; - } - - if(value == RTCC_PRINT_ALARM_DEC) { - printf("%02u/%02u (%02u) %02u:%02u:%02u/%02u\n", - bcd_to_dec(rtc_buffer[MONTHS_ALARM_ADDR]), - bcd_to_dec(rtc_buffer[DAY_ALARMS_ADDR]), - bcd_to_dec(rtc_buffer[WEEKDAYS_ALARM_ADDR]), - bcd_to_dec(rtc_buffer[HOURS_ALARM_ADDR]), - bcd_to_dec(rtc_buffer[MINUTES_ALARM_ADDR]), - bcd_to_dec(rtc_buffer[SECONDS_ALARM_ADDR]), - bcd_to_dec(rtc_buffer[HUNDREDTHS_ALARM_ADDR])); - return AB08_SUCCESS; - } - - if(value == RTCC_PRINT_DATE_DEC) { - printf("%02u/%02u/%02u (%02u) %02u:%02u:%02u/%02u\n", - bcd_to_dec(rtc_buffer[YEAR_ADDR]), - bcd_to_dec(rtc_buffer[MONTHS_ADDR]), - bcd_to_dec(rtc_buffer[DAY_ADDR]), - bcd_to_dec(rtc_buffer[WEEKDAYLS_ADDR]), - bcd_to_dec(rtc_buffer[HOUR_ADDR]), - bcd_to_dec(rtc_buffer[MIN_ADDR]), - bcd_to_dec(rtc_buffer[SEC_ADDR]), - bcd_to_dec(rtc_buffer[CENTHS_ADDR])); - return AB08_SUCCESS; - } - - for(i = 0; i < len; i++) { - printf("0x%02X <- %s\n", rtc_buffer[i], name[i]); - } - - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static void -rtcc_interrupt_handler(gpio_hal_pin_mask_t pin_mask) -{ - process_poll(&rtcc_int_process); -} -/*---------------------------------------------------------------------------*/ -int8_t -rtcc_set_autocalibration(uint8_t period) -{ - uint8_t aux; - - if(period > RTCC_AUTOCAL_9_MIN) { - PRINTF("RTC: invalid autocal value\n"); - return AB08_ERROR; - } - - if(ab08_read_reg((OSC_CONTROL_ADDR + CONFIG_MAP_OFFSET), - &aux, 1) == AB08_ERROR) { - PRINTF("RTC: failed to read oscillator registers\n"); - return AB08_ERROR; - } - - /* Clear ACAL */ - aux &= ~OSCONTROL_ACAL_9_MIN; - - /* Unlock the key register */ - ab08_key_reg(RTCC_CONFKEY_OSCONTROL); - - switch(period) { - case RTCC_AUTOCAL_DISABLE: - break; - case RTCC_AUTOCAL_ONCE: - case RTCC_AUTOCAL_17_MIN: - aux |= OSCONTROL_ACAL_17_MIN; - break; - case RTCC_AUTOCAL_9_MIN: - aux |= OSCONTROL_ACAL_9_MIN; - break; - default: - return AB08_ERROR; - } - - if(ab08_write_reg((OSC_CONTROL_ADDR + CONFIG_MAP_OFFSET), - &aux, 1) == AB08_ERROR) { - PRINTF("RTC: failed to clear the autocalibration\n"); - return AB08_ERROR; - } - - if(period == RTCC_AUTOCAL_ONCE) { - clock_delay_usec(10000); - ab08_key_reg(RTCC_CONFKEY_OSCONTROL); - aux &= ~OSCONTROL_ACAL_9_MIN; - if(ab08_write_reg((OSC_CONTROL_ADDR + CONFIG_MAP_OFFSET), - &aux, 1) == AB08_ERROR) { - PRINTF("RTC: failed to clear the autocalibration\n"); - return AB08_ERROR; - } - } - - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int8_t -rtcc_set_calibration(uint8_t mode, int32_t adjust) -{ - int32_t adjint; - uint8_t adjreg[2]; - uint8_t xtcal; - - if(mode > RTCC_CAL_RC_OSC) { - PRINTF("RTC: invalid calibration mode\n"); - return AB08_ERROR; - } - - /* Fixed values dependant on the oscillator source (Application Manual) */ - if((mode == RTCC_CAL_XT_OSC) && ((adjust <= -610) || (adjust >= 242))) { - PRINTF("RTC: invalid adjust value for XT oscillator\n"); - return AB08_ERROR; - } - - if((mode == RTCC_CAL_RC_OSC) && ((adjust <= -65536) || (adjust >= 65520))) { - PRINTF("RTC: invalid adjust value for XT oscillator\n"); - return AB08_ERROR; - } - - /* Calibration routine taken from the Application manual */ - if(adjust < 0) { - adjint = ((adjust) * 1000 - 953); - } else { - adjint = ((adjust) * 1000 + 953); - } - - adjint = adjint / 1907; - - if(mode == RTCC_CAL_XT_OSC) { - if(adjint > 63) { - xtcal = 0; - /* CMDX = 1 */ - adjreg[0] = ((adjint >> 1) & 0x3F) | 0x80; - } else if(adjint > -65) { - xtcal = 0; - adjreg[0] = (adjint & 0x7F); - } else if(adjint > -129) { - xtcal = 1; - adjreg[0] = ((adjint + 64) & 0x7F); - } else if(adjint > -193) { - xtcal = 2; - adjreg[0] = ((adjint + 128) & 0x7F); - } else if(adjint > -257) { - xtcal = 3; - adjreg[0] = ((adjint + 192) & 0x7F); - } else { - xtcal = 3; - adjreg[0] = ((adjint + 192) >> 1) & 0xFF; - } - - if(ab08_write_reg((CAL_XT_ADDR + CONFIG_MAP_OFFSET), - &adjreg[0], 1) == AB08_ERROR) { - PRINTF("RTC: failed to clear the autocalibration\n"); - return AB08_ERROR; - } - - if(ab08_read_reg((OSC_STATUS_ADDR + CONFIG_MAP_OFFSET), - &adjreg[0], 1) == AB08_ERROR) { - PRINTF("RTC: failed to read oscillator registers\n"); - return AB08_ERROR; - } - - /* Clear XTCAL and write new value */ - adjreg[0] &= 0x3F; - adjreg[0] |= (xtcal << 6); - - if(ab08_write_reg((OSC_STATUS_ADDR + CONFIG_MAP_OFFSET), - &adjreg[0], 1) == AB08_ERROR) { - PRINTF("RTC: failed to clear the autocalibration\n"); - return AB08_ERROR; - } - } else if(mode == RTCC_CAL_RC_OSC) { - if(adjint > 32767) { - adjreg[1] = ((adjint >> 3) & 0xFF); - adjreg[0] = ((adjint >> 11) | 0xC0); - } else if(adjint > 16383) { - adjreg[1] = ((adjint >> 2) & 0xFF); - adjreg[0] = ((adjint >> 10) | 0x80); - } else if(adjint > 8191) { - adjreg[1] = ((adjint >> 1) & 0xFF); - adjreg[0] = ((adjint >> 9) | 0x40); - } else if(adjint >= 0) { - adjreg[1] = ((adjint) & 0xFF); - adjreg[0] = (adjint >> 8); - } else if(adjint > -8193) { - adjreg[1] = ((adjint) & 0xFF); - adjreg[0] = (adjint >> 8) & 0x3F; - } else if(adjint > -16385) { - adjreg[1] = ((adjint >> 1) & 0xFF); - adjreg[0] = (adjint >> 9) & 0x7F; - } else if(adjint > -32769) { - adjreg[1] = ((adjint >> 2) & 0xFF); - adjreg[0] = (adjint >> 10) & 0xBF; - } else { - adjreg[1] = ((adjint >> 3) & 0xFF); - adjreg[0] = (adjint >> 11) & 0xFF; - } - - if(ab08_write_reg((CAL_RC_HI_ADDR + CONFIG_MAP_OFFSET), - adjreg, 2) == AB08_ERROR) { - PRINTF("RTC: failed to set the RC calibration\n"); - return AB08_ERROR; - } - - /* This should not happen */ - } else { - return AB08_ERROR; - } - - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static gpio_hal_event_handler_t rtcc_handler = { - .next = NULL, - .handler = rtcc_interrupt_handler, - .pin_mask = gpio_hal_pin_to_mask(RTC_INT1_PIN) << (RTC_INT1_PORT << 3), -}; -/*---------------------------------------------------------------------------*/ -int8_t -rtcc_init(void) -{ - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, - I2C_SCL_NORMAL_BUS_SPEED); - -#if RTCC_SET_DEFAULT_CONFIG - write_default_config(); -#endif - -#if RTCC_SET_AUTOCAL - rtcc_set_autocalibration(RTCC_AUTOCAL_17_MIN); -#endif - - /* Initialize interrupts handlers */ - rtcc_int1_callback = NULL; - - /* Configure the interrupts pins */ - GPIO_SOFTWARE_CONTROL(RTC_INT1_PORT_BASE, RTC_INT1_PIN_MASK); - GPIO_SET_INPUT(RTC_INT1_PORT_BASE, RTC_INT1_PIN_MASK); - - /* Pull-up resistor, detect falling edge */ - GPIO_DETECT_EDGE(RTC_INT1_PORT_BASE, RTC_INT1_PIN_MASK); - GPIO_TRIGGER_SINGLE_EDGE(RTC_INT1_PORT_BASE, RTC_INT1_PIN_MASK); - GPIO_DETECT_FALLING(RTC_INT1_PORT_BASE, RTC_INT1_PIN_MASK); - gpio_hal_register_handler(&rtcc_handler); - - /* Spin process until an interrupt is received */ - process_start(&rtcc_int_process, NULL); - - return AB08_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/dev/rtcc.h b/arch/platform/zoul/dev/rtcc.h deleted file mode 100644 index 92592e5ba..000000000 --- a/arch/platform/zoul/dev/rtcc.h +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/* -------------------------------------------------------------------------- */ -/** - * \addtogroup zoul - * @{ - * - * \defgroup remote-rtcc RE-Mote Real Time Clock Calendar - * - * Driver for the RE-Mote on-board ultra-low power RTCC (Real Time Clock - * Calendar) - * @{ - * - * \file - * Header file for the RE-Mote RF antenna switch - */ -/* -------------------------------------------------------------------------- */ -#ifndef RTCC_H_ -#define RTCC_H_ -/* -------------------------------------------------------------------------- */ -#include -#include "i2c.h" -/* -------------------------------------------------------------------------- */ -/** - * \name Callback function to handle the RTCC alarm interrupt and macro - * @{ - */ -#define RTCC_REGISTER_INT1(ptr) rtcc_int1_callback = ptr; -extern void (*rtcc_int1_callback)(uint8_t value); -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name AB08XX Address registers - * @{ - */ -/* -------------------------------------------------------------------------- */ -/* Time/date registers (no offset) */ -#define CENTHS_ADDR 0x00 -#define SEC_ADDR 0x01 -#define MIN_ADDR 0x02 -#define HOUR_ADDR 0x03 -#define DAY_ADDR 0x04 -#define MONTHS_ADDR 0x05 -#define YEAR_ADDR 0x06 -#define WEEKDAYLS_ADDR 0x07 - -/* Alarm registers */ -#define ALARM_MAP_OFFSET 0x08 -#define HUNDREDTHS_ALARM_ADDR 0x00 -#define SECONDS_ALARM_ADDR 0x01 -#define MINUTES_ALARM_ADDR 0x02 -#define HOURS_ALARM_ADDR 0x03 -#define DAY_ALARMS_ADDR 0x04 -#define MONTHS_ALARM_ADDR 0x05 -#define WEEKDAYS_ALARM_ADDR 0x06 - -/* Configuration registers */ -#define CONFIG_MAP_OFFSET 0x0F -#define STATUS_ADDR 0x00 -#define CTRL_1_ADDR 0x01 -#define CTRL_2_ADDR 0x02 -#define INT_MASK_ADDR 0x03 -#define SQW_ADDR 0x04 -#define CAL_XT_ADDR 0x05 -#define CAL_RC_HI_ADDR 0x06 -#define CAL_RC_LO_ADDR 0x07 -#define INT_POL_ADDR 0x08 -#define TIMER_CONTROL_ADDR 0x09 -#define TIMER_COUNTDOWN_ADDR 0x0A -#define TIMER_INITIAL_ADDR 0x0B -#define WDT_ADDR 0x0C -#define OSC_CONTROL_ADDR 0x0D -#define OSC_STATUS_ADDR 0x0E -#define CONF_KEY_ADDR 0x10 -#define TRICKLE_ADDR 0x11 -#define BREF_CTRL_ADDR 0x12 -#define AF_CTRL_ADDR 0x17 -#define BAT_MODE_IO_ADDR 0x18 -#define ASTAT_ADDR 0x20 -#define OCTRL_ADDR 0x21 -#define EXT_ADDR 0x30 -/* 256b. The upper 2 bits are taken from XADS field */ -#define RAM_1_ADDR (CONFIG_MAP_OFFSET + 0x31) -/* 256b. The upper 2 bits are taken from XADA field */ -#define RAM_2_ADDR (CONFIG_MAP_OFFSET + 0x71) -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name RTCC Bitmasks and shifts - * @{ - */ -#define STATUS_CB 0x80 -#define STATUS_BAT 0x40 -#define STATUS_WDT 0x20 -#define STATUS_BL 0x10 -#define STATUS_TIM 0x08 -#define STATUS_ALM 0x04 -#define STATUS_EX2 0x02 -#define STATUS_EX1 0x01 - -#define CTRL1_WRTC 0x01 -#define CTRL1_ARST 0x04 -#define CTRL1_OUT 0x10 -#define CTRL1_OUTB 0x20 -#define CTRL1_1224 0x40 -#define CTRL1_STOP 0x80 - -/* Defines the nIRQ pin control */ -#define CTRL2_OUT1S_NIRQ_OUT 0x00 -#define CTRL2_OUT1S_NIRQ_SQW_OUT 0x01 -#define CTRL2_OUT1S_NIRQ_SQW_NIRQ 0x02 -#define CTRL2_OUT1S_NIRQ_NAIRQ_OUT 0x03 - -/* Defines the nIRQ2 pin control */ -#define CTRL2_OUT2S_SQW_OUT 0x04 -#define CTRL2_OUT2S_NAIRQ_OUTB 0x0C -#define CTRL2_OUT2S_TIRQ_OUTB 0x10 -#define CTRL2_OUT2S_NTIRQ_OUTB 0x14 -#define CTRL2_OUT2S_OUTB 0x1C - -/* Interrupt Mask */ -#define INTMASK_EX1E 0x01 -#define INTMASK_EX2E 0x02 -#define INTMASK_AIE 0x04 -#define INTMASK_TIE 0x08 -#define INTMASK_BLIE 0x10 -#define INTMASK_IM_HIGH 0x20 -#define INTMASK_IM_MED 0x40 -#define INTMASK_IM_LOW 0x60 -#define INTMASK_CEB 0x80 - -/* Timer countdown control */ -#define COUNTDOWN_TIMER_TE 0x80 -#define COUNTDOWN_TIMER_TM 0x40 -#define COUNTDOWN_TIMER_TRPT 0x20 -#define COUNTDOWN_TIMER_RPT_SECOND 0x1C -#define COUNTDOWN_TIMER_RPT_MINUTE 0x18 -#define COUNTDOWN_TIMER_RPT_HOUR 0x24 -#define COUNTDOWN_TIMER_RPT_DAY 0x10 -#define COUNTDOWN_TIMER_RPT_WEEK 0x0C -#define COUNTDOWN_TIMER_RPT_MONTH 0x08 -#define COUNTDOWN_TIMER_RPT_YEAR 0x04 -#define COUNTDOWN_TIMER_RPT_SHIFT 0x02 -#define COUNTDOWN_TIMER_TFS_ONE 0x01 -#define COUNTDOWN_TIMER_TFS_TWO 0x02 -#define COUNTDOWN_TIMER_TFS_THREE 0x03 - -/* Oscillator control */ -#define OSCONTROL_ACIE 0x01 -#define OSCONTROL_OFIE 0x02 -#define OSCONTROL_FOS 0x08 -#define OSCONTROL_AOS 0x10 -#define OSCONTROL_ACAL_NO_CAL 0x00 -#define OSCONTROL_ACAL_17_MIN 0x40 -#define OSCONTROL_ACAL_9_MIN 0x60 -#define OSCONTROL_OSEL 0x80 - -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name RTCC operational values - * @{ - */ -/* I2C address (7-bits) */ -#define AB08XX_ADDR 0x69 -#define INT_BUFF_SIZE 20L -#define TCS_DIODE_3K (TCS_ENABLE + 0x05) -#define TCS_DIODE_6K (TCS_ENABLE + 0x06) -#define TCS_DIODE_11K (TCS_ENABLE + 0x07) -#define RTCC_TOGGLE_PM_BIT 0x20 -#define RTCC_FIX_10THS_HUNDRETHS 0xF0 -#define RTCC_FIX_100THS_HUNDRETHS 0xFF -#define RTCC_TD_MAP_SIZE (WEEKDAYLS_ADDR + 1) -#define RTCC_ALARM_MAP_SIZE (WEEKDAYS_ALARM_ADDR + 1) -#define RTCC_CONFIG_MAP_SIZE (BREF_CTRL_ADDR + 1) -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name RTCC error values - * @{ - */ -#define AB08_ERROR (-1) -#define AB08_SUCCESS 0x00 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name RTCC enumeration and options - * @{ - */ -enum { - RTCC_PRINT_DATE = 0, - RTCC_PRINT_CONFIG, - RTCC_PRINT_ALARM, - RTCC_PRINT_ALARM_DEC, - RTCC_PRINT_DATE_DEC, - RTCC_PRINT_MAX, -}; -/* -------------------------------------------------------------------------- */ -enum { - RTCC_ALARM_OFF = 0, - RTCC_ALARM_ON, - RTCC_ALARM_MAX, -}; -/* -------------------------------------------------------------------------- */ -enum { - RTCC_CMD_UNLOCK = 0, - RTCC_CMD_LOCK, - RTCC_CMD_ENABLE, - RTCC_CMD_STOP, - RTCC_CMD_MAX, -}; -/* -------------------------------------------------------------------------- */ -enum { - RTCC_24H_MODE = 0, - RTCC_12H_MODE_AM, - RTCC_12H_MODE_PM, -}; -/* -------------------------------------------------------------------------- */ -enum { - RTCC_CENTURY_19XX_21XX = 1, - RTCC_CENTURY_20XX, -}; -/* -------------------------------------------------------------------------- */ -enum { - RTCC_REPEAT_NONE = 0, - RTCC_REPEAT_YEAR, - RTCC_REPEAT_MONTH, - RTCC_REPEAT_WEEK, - RTCC_REPEAT_DAY, - RTCC_REPEAT_HOUR, - RTCC_REPEAT_MINUTE, - RTCC_REPEAT_SECOND, - RTCC_REPEAT_10THS, - RTCC_REPEAT_100THS, -}; -/* -------------------------------------------------------------------------- */ -enum { - RTCC_CONFKEY_OSCONTROL = 0xA1, - RTCC_CONFKEY_SWRESET = 0x3C, - RTCC_CONFKEY_DEFREGS = 0x9D, -}; -/* -------------------------------------------------------------------------- */ -enum { - RTCC_CAL_XT_OSC = 0, - RTCC_CAL_RC_OSC, -}; -/* -------------------------------------------------------------------------- */ -enum { - RTCC_AUTOCAL_DISABLE = 0, - RTCC_AUTOCAL_ONCE, - RTCC_AUTOCAL_17_MIN, - RTCC_AUTOCAL_9_MIN, -}; -/* -------------------------------------------------------------------------- */ -enum { - RTCC_TRIGGER_INT1 = 0, - RTCC_TRIGGER_INT2, - RTCC_TRIGGER_BOTH, -}; - -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name Readable Date and time memory map implementation - * - * This simplified structure allows the user to set date/alarms with a - * reduced structure, without the bit-defined restrictions of the memory map, - * using decimal values - * - * @{ - */ -typedef struct ab0805_struct_simple_td_reg { - uint8_t miliseconds; - uint8_t seconds; - uint8_t minutes; - uint8_t hours; - uint8_t day; - uint8_t months; - uint8_t years; - uint8_t weekdays; - uint8_t mode; - uint8_t century; -} __attribute__ ((packed)) simple_td_map; -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name RTCC User functions - * @{ - */ - -/** - * \brief Set the time and date - * \param *data Time and date value (decimal format) - * \return - * \ AB08_SUCCESS date/time set - * \ AB08_ERROR failed to set time/date (enable DEBUG for more info) - */ -int8_t rtcc_set_time_date(simple_td_map *data); - -/** - * \brief Get the current time and date - * \param *data buffer to store the results - * \return - * \ AB08_SUCCESS date/time set - * \ AB08_ERROR failed to set time/date (enable DEBUG for more info) - */ -int8_t rtcc_get_time_date(simple_td_map *data); - -/** - * \brief Print data from the RTCC module, either from the memory - * map (values in BCD) or actual readable data (decimal). - * \param value value to print, see RTCC_PRINT_* options available - * \return - * \ AB08_SUCCESS date/time set - * \ AB08_ERROR failed to set time/date (enable DEBUG for more info) - */ -int8_t rtcc_print(uint8_t value); - -/** - * \brief Configure the RTCC to match an alarm counter - * \param data date and time values (in decimal) to match against - * \param state set on/off the alarm interruption - * \param repeat set the frequency of the alarm (minute, hourly, daily, etc.) - * \param trigger interrupt trigger (INT1, INT2 or both) - * \return - * \ AB08_SUCCESS date/time set - * \ AB08_ERROR failed to set time/date (enable DEBUG for more info) - */ -int8_t rtcc_set_alarm_time_date(simple_td_map *data, uint8_t state, - uint8_t repeat, uint8_t trigger); - -/** - * \brief Increments the current date by a number of seconds - * \param data structure to store the date - * \param seconds the numberof seconds to increment the date - * \return - * \ AB08_SUCCESS updated date values - * \ AB08_ERROR failed to return the values - */ -int8_t rtcc_date_increment_seconds(simple_td_map *data, uint16_t seconds); - -/** - * \brief Manually calibrate the RTCC - * \param mode oscillator to calibrate - * \param adjust value (in ppm) to adjust the oscillator - * \return - * \ AB08_SUCCESS date/time set - * \ AB08_ERROR failed to set time/date (enable DEBUG for more info) - */ -int8_t rtcc_set_calibration(uint8_t mode, int32_t adjust); - -/** - * \brief Set the autocallibration period - * \param period autocalibration configuration - * \return - * \ AB08_SUCCESS date/time set - * \ AB08_ERROR failed to set time/date (enable DEBUG for more info) - */ -int8_t rtcc_set_autocalibration(uint8_t period); - -/** - * \brief Initialize the RTCC, configures the I2C bus, interrupts and registers - * \return - * \ AB08_SUCCESS date/time set - * \ AB08_ERROR failed to set time/date (enable DEBUG for more info) - */ -int8_t rtcc_init(void); -/** @} */ -/* -------------------------------------------------------------------------- */ -#endif /* ifndef RTCC_H_ */ -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/servo.c b/arch/platform/zoul/dev/servo.c deleted file mode 100644 index 2b08599a1..000000000 --- a/arch/platform/zoul/dev/servo.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-servo - * @{ - * - * \file - * Driver for a generic Servo driver - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/pwm.h" -#include "dev/gpio.h" -#include "servo.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -int -servo_position(uint16_t gptab, uint8_t port, uint8_t pin, uint16_t pos) -{ - uint8_t gpt_num; - uint8_t gpt_ab; - uint32_t count = 0; - - if((gptab < SERVO_CHANNEL_1) && (gptab > SERVO_CHANNEL_7)) { - PRINTF("Servo: invalid servo channel\n"); - return SERVO_ERROR; - } - - /* CC2538 has 4 ports (A-D) and up to 8 pins (0-7) */ - if((port > GPIO_D_NUM) || (pin > 7)) { - PRINTF("Servo: Invalid pin/port settings\n"); - return SERVO_ERROR; - } - - if(pos > SERVO_MAX_DEGREES) { - PRINTF("Servo: invalid position (max %u)\n", SERVO_MAX_DEGREES); - return SERVO_ERROR; - } - - count = (SERVO_MAX_VAL - SERVO_MIN_VAL) * pos; - count /= SERVO_MAX_DEGREES; - count += SERVO_MIN_VAL; - - gpt_num = (uint8_t)(gptab >> 8); - gpt_ab = (uint8_t)(gptab & 0x00FF); - - PRINTF("Servo: F%uHz GPTNUM %u GPTAB %u --> %uº (%lu)\n", SERVO_DEFAULT_FREQ, - gpt_num, gpt_ab, - pos, count); - /* Use count as argument instead of percentage */ - if(pwm_enable(SERVO_DEFAULT_FREQ, 0, count, gpt_num,gpt_ab) != PWM_SUCCESS) { - PRINTF("Servo: failed to configure the pwm channel\n"); - return SERVO_ERROR; - } - - /* Start the PWM as soon as possible, keep the pulses to lock the servo in the - * given position - */ - if(pwm_start(gpt_num, gpt_ab, port, pin) != PWM_SUCCESS) { - PRINTF("Servo: failed to initialize the pwm channel\n"); - return SERVO_ERROR; - } - - return SERVO_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -int -servo_stop(uint16_t gptab, uint8_t port, uint8_t pin) -{ - uint8_t gpt_num; - uint8_t gpt_ab; - - if((gptab < SERVO_CHANNEL_1) && (gptab > SERVO_CHANNEL_7)) { - PRINTF("Servo: invalid servo channel\n"); - return SERVO_ERROR; - } - - /* CC2538 has 4 ports (A-D) and up to 8 pins (0-7) */ - if((port > GPIO_D_NUM) || (pin > 7)) { - PRINTF("Servo: Invalid pin/port settings\n"); - return SERVO_ERROR; - } - - gpt_num = (uint8_t)((gptab & 0xFF00) >> 8); - gpt_ab = (uint8_t)(gptab & 0x00FF); - - if(pwm_disable(gpt_num, gpt_ab, port, pin) != PWM_SUCCESS) { - PRINTF("Servo: unable to disable the pwm channel\n"); - return SERVO_ERROR; - } - - return SERVO_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/servo.h b/arch/platform/zoul/dev/servo.h deleted file mode 100644 index 6ec2fae5f..000000000 --- a/arch/platform/zoul/dev/servo.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-servo Generic servo driver - * - * Driver for a Generic Servo actuator - * - * @{ - * - * \file - * Header file for a Generic Servo driver - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#ifndef SERVO_H_ -#define SERVO_H_ -#include -#include "dev/pwm.h" -/* -------------------------------------------------------------------------- */ -/** - * \name Servo default settings - * @{ - */ -/* -------------------------------------------------------------------------- */ -#ifndef SERVO_CONF_FREQ -#define SERVO_DEFAULT_FREQ 50 /**< 50 Hz */ -#else -#define SERVO_DEFAULT_FREQ SERVO_CONF_FREQ -#endif - -#ifndef SERVO_CONF_MAX_DEGREES -#define SERVO_MAX_DEGREES 180 -#else -#define SERVO_MAX_DEGREES SERVO_CONF_MAX_DEGREES -#endif - -#ifndef SERVO_CONF_MIN_VAL -#define SERVO_MIN_VAL 9600 /**> roughly equals to 3% duty cycle */ -#else -#define SERVO_MIN_VAL SERVO_CONF_MIN_VAL -#endif - -#ifndef SERVO_CONF_MAX_VAL -#define SERVO_MAX_VAL 38400 /**> roughly equals to 12% duty cycle */ -#else -#define SERVO_MAX_VAL SERVO_CONF_MAX_VAL -#endif -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Servo general purpose timers mapping - * @{ - */ -#define SERVO_CHANNEL_1 0x001 /**< GPT0-B */ -#define SERVO_CHANNEL_2 0x100 /**< GPT1-A */ -#define SERVO_CHANNEL_3 0x101 /**< GPT1-B */ -#define SERVO_CHANNEL_4 0x200 /**< GPT2-A */ -#define SERVO_CHANNEL_5 0x201 /**< GPT2-B */ -#define SERVO_CHANNEL_6 0x300 /**< GPT3-A */ -#define SERVO_CHANNEL_7 0x301 /**< GPT3-B */ -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Servo general constants - * @{ - */ -#define SERVO_SUCCESS 0 -#define SERVO_ERROR (-1) -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Servo public funtions - * @{ - */ - -/** \brief Configures and positions a servo in a given position (by degrees) - * The servo will lock its position as long as it is not stopped - * \param gptab Servo channel (PWM GPT from 1-7) - * \param port Port number to use as PWM - * \param pin Pin number to use as PWM - * \param pos Position to map the servo to (0-360º, integer) - * \return \c SERVO_SUCCESS if successful, else \c SERVO_ERROR - */ -int servo_position(uint16_t gptab, uint8_t port, uint8_t pin, uint16_t pos); - -/** \brief Fully stop a servo and reconfigures back the pin/port as GPIO - * \param gptab Servo channel (PWM GPT from 1-7) - * \param port Port number to use as PWM - * \param pin Pin number to use as PWM - * \return \c SERVO_SUCCESS if successful, else \c SERVO_ERROR - */ -int servo_stop(uint16_t gptab, uint8_t port, uint8_t pin); -/** @} */ -/* -------------------------------------------------------------------------- */ -#endif -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/dev/sht25.c b/arch/platform/zoul/dev/sht25.c deleted file mode 100644 index 6273ae0c0..000000000 --- a/arch/platform/zoul/dev/sht25.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sht25-sensor - * @{ - * - * \file - * SHT25 temperature and humidity sensor driver - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/i2c.h" -#include "dev/sht25.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -static uint8_t user_reg; -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -sht25_read_reg(uint8_t reg, uint8_t *buf, uint8_t num) -{ - if((buf == NULL) || (num <= 0)) { - return SHT25_ERROR; - } - - i2c_master_enable(); - if(i2c_single_send(SHT25_ADDR, reg) == I2C_MASTER_ERR_NONE) { - if(i2c_burst_receive(SHT25_ADDR, buf, num) == I2C_MASTER_ERR_NONE) { - return SHT25_SUCCESS; - } - } - return SHT25_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int16_t -sht25_convert(uint8_t variable, uint16_t value) -{ - int16_t rd; - uint32_t buff; - - /* Clear the status bits */ - buff = (uint32_t)(value & ~SHT25_STATUS_BITS_MASK); - - if(variable == SHT25_VAL_TEMP) { - buff *= 17572; - buff = buff >> 16; - rd = (int16_t)buff - 4685; - } else { - buff *= 12500; - buff = buff >> 16; - rd = (int16_t)buff - 600; - rd = (rd > 10000) ? 10000 : rd; - } - return rd; -} -/*---------------------------------------------------------------------------*/ -static int -sht25_read(uint8_t variable, uint16_t *rd) -{ - uint8_t buf[2]; - uint16_t raw; - - if((variable != SHT25_VAL_TEMP) && (variable != SHT25_VAL_HUM)) { - PRINTF("SHT25: invalid sensor requested\n"); - return SHT25_ERROR; - } - - if(sht25_read_reg(variable, buf, 2) == SHT25_SUCCESS) { - raw = (buf[0] << 8) + buf[1]; - *rd = sht25_convert(variable, raw); - return SHT25_SUCCESS; - } - - PRINTF("SHT25: failed to read sensor\n"); - return SHT25_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -sht25_write_reg(uint8_t *buf, uint8_t num) -{ - if((buf == NULL) || (num <= 0)) { - PRINTF("SHT25: invalid write values\n"); - return SHT25_ERROR; - } - - i2c_master_enable(); - if(i2c_burst_send(SHT25_ADDR, buf, num) == I2C_MASTER_ERR_NONE) { - return SHT25_SUCCESS; - } - return SHT25_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -sht25_read_user_register(void) -{ - if(sht25_read_reg(SHT2X_UREG_READ, &user_reg, 1) == SHT25_SUCCESS) { - PRINTF("SHT25: user register 0x%02X\n", user_reg); - return SHT25_SUCCESS; - } - PRINTF("SHT25: failed to read user register\n"); - return SHT25_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - uint16_t val; - - if(!enabled) { - PRINTF("SHT25: sensor not started\n"); - return SHT25_ERROR; - } - - if((type != SHT25_VAL_TEMP) && (type != SHT25_VAL_HUM) && - (type != SHT25_VOLTAGE_ALARM)) { - PRINTF("SHT25: invalid value requested\n"); - return SHT25_ERROR; - } - - if(type == SHT25_VOLTAGE_ALARM) { - if(sht25_read_user_register() == SHT25_SUCCESS) { - return (user_reg & SHT2x_LOW_VOLTAGE_MASK) >> SHT2x_LOW_VOLTAGE_SHIFT; - } - } else { - if(sht25_read(type, &val) == SHT25_SUCCESS) { - return val; - } - } - return SHT25_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - uint8_t buf[2]; - - if((type != SHT25_ACTIVE) && (type != SHT25_SOFT_RESET) && - (type != SHT25_RESOLUTION)) { - PRINTF("SHT25: option not supported\n"); - return SHT25_ERROR; - } - - switch(type) { - case SHT25_ACTIVE: - if(value) { - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, - I2C_SCL_NORMAL_BUS_SPEED); - - /* Read the user config register */ - if(sht25_read_user_register() == SHT25_SUCCESS) { - enabled = value; - return SHT25_SUCCESS; - } - } - - case SHT25_SOFT_RESET: - buf[0] = SHT2X_SOFT_RESET; - if(sht25_write_reg(&buf[0], 1) != SHT25_SUCCESS) { - PRINTF("SHT25: failed to reset the sensor\n"); - return SHT25_ERROR; - } - clock_delay_usec(SHT25_RESET_DELAY); - return SHT25_SUCCESS; - - case SHT25_RESOLUTION: - if((value != SHT2X_RES_14T_12RH) && (value != SHT2X_RES_12T_08RH) && - (value != SHT2X_RES_13T_10RH) && (value != SHT2X_RES_11T_11RH)) { - PRINTF("SHT25: invalid resolution value\n"); - return SHT25_ERROR; - } - - user_reg &= ~SHT2X_RES_11T_11RH; - user_reg |= value; - buf[0] = SHT2X_UREG_WRITE; - buf[1] = user_reg; - - if(sht25_write_reg(buf, 2) == SHT25_SUCCESS) { - PRINTF("SHT25: new user register value 0x%02X\n", user_reg); - return SHT25_SUCCESS; - } - - default: - return SHT25_ERROR; - } - - return SHT25_ERROR; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(sht25, SHT25_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/sht25.h b/arch/platform/zoul/dev/sht25.h deleted file mode 100644 index 11d5c61a8..000000000 --- a/arch/platform/zoul/dev/sht25.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-sht25-sensor SHT25 digital temperature sensor - * @{ - * - * \file - * SHT25 temperature and humidity sensor driver header file - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -/* -------------------------------------------------------------------------- */ -#ifndef SHT25_H_ -#define SHT25_H_ -/* -------------------------------------------------------------------------- */ -#define SHT25_ADDR 0x40 -#define SHT25_TEMP_HOLD 0xE3 -#define SHT25_HUM_HOLD 0xE5 -#define SHT25_TEMP_NO_HOLD 0xF3 -#define SHT25_HUM_NO_HOLD 0xF5 -#define SHT2X_UREG_WRITE 0xE6 -#define SHT2X_UREG_READ 0xE7 -#define SHT2X_SOFT_RESET 0XFE -#define SHT2X_NULL 0x00 -/* -------------------------------------------------------------------------- */ -#define SHT2X_RES_14T_12RH 0x00 -#define SHT2X_RES_12T_08RH 0x01 -#define SHT2X_RES_13T_10RH 0x80 -#define SHT2X_RES_11T_11RH 0x81 -#define SHT2X_HEATER_ON 0x04 -#define SHT2X_HEATER_OFF 0x00 -#define SHT2X_OTP_RELOAD_EN 0x00 -#define SHT2X_OTP_RELOAD_DIS 0x02 -#define SHT2x_LOW_VOLTAGE_MASK 0x40 -#define SHT2x_LOW_VOLTAGE_SHIFT 0x06 -/* -------------------------------------------------------------------------- */ -#define SHT25_ACTIVE SENSORS_ACTIVE -#define SHT25_SOFT_RESET 0x01 -#define SHT25_RESOLUTION 0x02 - -#define SHT25_VAL_TEMP SHT25_TEMP_HOLD -#define SHT25_VAL_HUM SHT25_HUM_HOLD -#define SHT25_VOLTAGE_ALARM 0x01 - -#define SHT25_ERROR (-1) -#define SHT25_SUCCESS 0x00 -#define SHT25_RESET_DELAY 15000 -#define SHT25_STATUS_BITS_MASK 0x0003 -/* -------------------------------------------------------------------------- */ -#define SHT25_SENSOR "SHT25 Sensor" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor sht25; -/* -------------------------------------------------------------------------- */ -#endif /* ifndef SHT25_H_ */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/tmp102.c b/arch/platform/zoul/dev/tmp102.c deleted file mode 100644 index 4b2de59b0..000000000 --- a/arch/platform/zoul/dev/tmp102.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-tmp102-sensor - * @{ - * - * \file - * Driver for the TMP102 temperature sensor - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/i2c.h" -#include "tmp102.h" - -void -tmp102_init(void) -{ - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, I2C_SCL_NORMAL_BUS_SPEED); -} -/*---------------------------------------------------------------------------*/ - -uint8_t -tmp102_read(uint16_t *data) -{ - uint8_t buf[2]; - uint16_t temp; - - /* Write to the temperature register to trigger a reading */ - if(i2c_single_send(TMP102_ADDR, TMP102_TEMP) == I2C_MASTER_ERR_NONE) { - /* Read two bytes only */ - if(i2c_burst_receive(TMP102_ADDR, buf, 2) == I2C_MASTER_ERR_NONE) { - /* 12-bit value, TMP102 SBOS397F Table 8-9 */ - temp = (buf[0] << 4) + (buf[1] >> 4); - if(temp > 2047) { - temp -= (1 << 12); - } - temp *= 0.625; - *data = temp; - return I2C_MASTER_ERR_NONE; - } - } - return i2c_master_error(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/tmp102.h b/arch/platform/zoul/dev/tmp102.h deleted file mode 100644 index 030e59fe5..000000000 --- a/arch/platform/zoul/dev/tmp102.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-tmp102-sensor TMP102 Sensor - * - * Driver for the TMP102 sensor - * - * The TMP102 driver returns the converted temperature value in centiCelsius - * with 2 digits precision, to get Celsius just divide by 100. - * @{ - * - * \file - * Header file for the TMP102 Sensor Driver - */ -/*---------------------------------------------------------------------------*/ -#ifndef TMP102_H_ -#define TMP102_H_ -#include -#include "i2c.h" -/* -------------------------------------------------------------------------- */ -/** - * \name Generic TMP102 sensor - * @{ - */ -/* -------------------------------------------------------------------------- */ -#define TMP102_ADDR 0x48 /**< TMP102 slave address */ -#define TMP102_TEMP 0x00 /**< TMP102 temperature data register */ -/** @} */ -/* -------------------------------------------------------------------------- */ -#endif /* ifndef TMP102_H_ */ -/*---------------------------------------------------------------------------*/ - -/** \brief Initialiser for the TMP102 sensor driver */ -void tmp102_init(void); - -/** \brief Get a temperature reading from the TMP102 sensor */ -uint8_t tmp102_read(uint16_t *data); - -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/tsl256x.c b/arch/platform/zoul/dev/tsl256x.c deleted file mode 100644 index ffcf2e218..000000000 --- a/arch/platform/zoul/dev/tsl256x.c +++ /dev/null @@ -1,501 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-tsl256x-sensor - * @{ - * - * \file - * Driver for the external TSL256X light sensor - * - * \author - * Antonio Lignan - * Toni Lozano - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/i2c.h" -#include "dev/gpio.h" -#include "dev/gpio-hal.h" -#include "dev/zoul-sensors.h" -#include "lib/sensors.h" -#include "tsl256x.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define TSL256X_INT_PORT_BASE GPIO_PORT_TO_BASE(I2C_INT_PORT) -#define TSL256X_INT_PIN_MASK GPIO_PIN_MASK(I2C_INT_PIN) -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -static uint8_t gain; -static uint8_t timming; -/*---------------------------------------------------------------------------*/ -void (*tsl256x_int_callback)(uint8_t value); -/*---------------------------------------------------------------------------*/ -static uint16_t -calculate_lux(uint8_t *buf) -{ - uint32_t ch0, ch1, chscale = 0; - uint32_t ratio = 0; - uint32_t lratio, tmp = 0; - uint16_t buffer[2]; - - /* The calculations below assume the integration time is 402ms and the gain - * is 16x (nominal), if not then it is required to normalize the reading - * before converting to lux - */ - - buffer[0] = (buf[1] << 8 | (buf[0])); - buffer[1] = (buf[3] << 8 | (buf[2])); - - switch(timming) { - case TSL256X_TIMMING_INTEG_402MS: - chscale = (1 << CH_SCALE); - break; - case TSL256X_TIMMING_INTEG_101MS: - chscale = CHSCALE_TINT1; - break; - case TSL256X_TIMMING_INTEG_13_7MS: - chscale = CHSCALE_TINT0; - break; - } - - if(!gain) { - chscale = chscale << 4; - } - - ch0 = (buffer[0] * chscale) >> CH_SCALE; - ch1 = (buffer[1] * chscale) >> CH_SCALE; - - if(ch0 > 0) { - ratio = (ch1 << CH_SCALE); - ratio = ratio / ch0; - } - - lratio = (ratio + 1) >> 1; - - if((lratio >= 0) && (lratio <= K1T)) { - tmp = (ch0 * B1T) - (ch1 * M1T); - } else if(lratio <= K2T) { - tmp = (ch0 * B2T) - (ch1 * M2T); - } else if(lratio <= K3T) { - tmp = (ch0 * B3T) - (ch1 * M3T); - } else if(lratio <= K4T) { - tmp = (ch0 * B4T) - (ch1 * M4T); - } else if(lratio <= K5T) { - tmp = (ch0 * B5T) - (ch1 * M5T); - } else if(lratio <= K6T) { - tmp = (ch0 * B6T) - (ch1 * M6T); - } else if(lratio <= K7T) { - tmp = (ch0 * B7T) - (ch1 * M7T); - } else if(lratio > K8T) { - tmp = (ch0 * B8T) - (ch1 * M8T); - } - - if(tmp < 0) { - tmp = 0; - } - - tmp += (1 << (LUX_SCALE - 1)); - return tmp >> LUX_SCALE; -} -/*---------------------------------------------------------------------------*/ -static int -tsl256x_read_reg(uint8_t reg, uint8_t *buf, uint8_t regNum) -{ - i2c_master_enable(); - if(i2c_single_send(TSL256X_ADDR, reg) == I2C_MASTER_ERR_NONE) { - while(i2c_master_busy()); - if(i2c_burst_receive(TSL256X_ADDR, buf, regNum) == I2C_MASTER_ERR_NONE) { - return TSL256X_SUCCESS; - } - } - return TSL256X_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -tsl256x_write_reg(uint8_t *buf, uint8_t num) -{ - if((buf == NULL) || (num <= 0)) { - PRINTF("TSL256X: invalid write values\n"); - return TSL256X_ERROR; - } - - i2c_master_enable(); - if(i2c_burst_send(TSL256X_ADDR, buf, num) == I2C_MASTER_ERR_NONE) { - return TSL256X_SUCCESS; - } - return TSL256X_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -tsl256x_on(void) -{ - uint8_t buf[2]; - buf[0] = (TSL256X_COMMAND + TSL256X_CONTROL); - buf[1] = TSL256X_CONTROL_POWER_ON; - - if(tsl256x_write_reg(buf, 2) == I2C_MASTER_ERR_NONE) { - if(i2c_single_receive(TSL256X_ADDR, &buf[0]) == I2C_MASTER_ERR_NONE) { - if((buf[0] & 0x0F) == TSL256X_CONTROL_POWER_ON) { - PRINTF("TSL256X: powered on\n"); - return TSL256X_SUCCESS; - } - } - } - - PRINTF("TSL256X: failed to power on\n"); - return TSL256X_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -tsl256x_id_register(uint8_t *buf) -{ - if(tsl256x_read_reg((TSL256X_COMMAND + TSL256X_ID_REG), - buf, 1) == TSL256X_SUCCESS) { - PRINTF("TSL256X: partnum/revnum 0x%02X\n", *buf); - return TSL256X_SUCCESS; - } - - return TSL256X_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -tsl256x_off(void) -{ - uint8_t buf[2]; - buf[0] = (TSL256X_COMMAND + TSL256X_CONTROL); - buf[1] = TSL256X_CONTROL_POWER_OFF; - - if(tsl256x_write_reg(buf, 2) == I2C_MASTER_ERR_NONE) { - PRINTF("TSL256X: powered off\n"); - return TSL256X_SUCCESS; - } - - PRINTF("TSL256X: failed to power off\n"); - return TSL256X_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -tsl256x_clear_interrupt(void) -{ - uint8_t buf = (TSL256X_COMMAND + TSL256X_CLEAR_INTERRUPT); - if(tsl256x_write_reg(&buf, 1) != I2C_MASTER_ERR_NONE) { - PRINTF("TSL256X: failed to clear the interrupt\n"); - return TSL256X_ERROR; - } - return TSL256X_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -tsl256x_read_sensor(uint16_t *lux) -{ - uint8_t buf[4]; - - /* This is hardcoded to use word write/read operations */ - if(tsl256x_read_reg((TSL256X_COMMAND + TSL256X_D0LOW), - &buf[0], 2) == TSL256X_SUCCESS) { - if(tsl256x_read_reg((TSL256X_COMMAND + TSL256X_D1LOW), - &buf[2], 2) == TSL256X_SUCCESS) { - - PRINTF("TSL256X: CH0 0x%02X%02X CH1 0x%02X%02X\n", buf[1], buf[0], - buf[3], buf[2]); - *lux = calculate_lux(buf); - return TSL256X_SUCCESS; - } - } - PRINTF("TSL256X: failed to read\n"); - return TSL256X_ERROR; -} -/*---------------------------------------------------------------------------*/ -PROCESS(tsl256x_int_process, "TSL256X interrupt process handler"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tsl256x_int_process, ev, data) -{ - PROCESS_EXITHANDLER(); - PROCESS_BEGIN(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - tsl256x_clear_interrupt(); - tsl256x_int_callback(0); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static void -tsl256x_interrupt_handler(gpio_hal_pin_mask_t pin_mask) -{ - /* There's no alert/interruption flag to check, clear the interruption by - * writting to the CLEAR bit in the COMMAND register - */ - process_poll(&tsl256x_int_process); -} -/*---------------------------------------------------------------------------*/ -static gpio_hal_event_handler_t tsl256x_handler = { - .next = NULL, - .handler = tsl256x_interrupt_handler, - .pin_mask = gpio_hal_pin_to_mask(I2C_INT_PIN) << (I2C_INT_PORT << 3), -}; -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - uint8_t buf[3]; - - if((type != TSL256X_ACTIVE) && (type != TSL256X_INT_OVER) && - (type != TSL256X_INT_BELOW) && (type != TSL256X_INT_DISABLE) && - (type != TSL256X_TIMMING_CFG)) { - PRINTF("TSL256X: invalid start value\n"); - return TSL256X_ERROR; - } - - /* As default the power-on values of the sensor are gain 1X, 402ms integration - * time (not nominal), with manual control disabled - */ - - if(type == TSL256X_ACTIVE) { - if(value) { - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, - I2C_SCL_NORMAL_BUS_SPEED); - - /* Initialize interrupts handlers */ - tsl256x_int_callback = NULL; - - /* Power on the sensor and check for the part number */ - if(tsl256x_on() == TSL256X_SUCCESS) { - if(tsl256x_id_register(&buf[0]) == TSL256X_SUCCESS) { - if((buf[0] & TSL256X_ID_PARTNO_MASK) == TSL256X_EXPECTED_PARTNO) { - - /* Read the timming/gain configuration */ - if(tsl256x_read_reg((TSL256X_COMMAND + TSL256X_TIMMING), - &buf[0], 1) == TSL256X_SUCCESS) { - gain = buf[0] & TSL256X_TIMMING_GAIN; - timming = buf[0] & TSL256X_TIMMING_INTEG_MASK; - PRINTF("TSL256X: enabled, timming %u gain %u\n", timming, gain); - - /* Restart the over interrupt threshold */ - buf[0] = (TSL256X_COMMAND + TSL256X_THRHIGHLOW); - buf[1] = 0xFF; - buf[2] = 0xFF; - - if(tsl256x_write_reg(buf, 3) != TSL256X_SUCCESS) { - PRINTF("TSL256X: failed to clear over interrupt\n"); - return TSL256X_ERROR; - } - - /* Restart the below interrupt threshold */ - buf[0] = (TSL256X_COMMAND + TSL256X_THRLOWLOW); - buf[1] = 0x00; - buf[2] = 0x00; - - if(tsl256x_write_reg(buf, 3) != TSL256X_SUCCESS) { - PRINTF("TSL256X: failed to clear below interrupt\n"); - return TSL256X_ERROR; - } - - /* Clear any pending interrupt */ - if(tsl256x_clear_interrupt() == TSL256X_SUCCESS) { - enabled = 1; - return TSL256X_SUCCESS; - } - } - } - } - } - return TSL256X_ERROR; - } else { - if(tsl256x_off() == TSL256X_SUCCESS) { - PRINTF("TSL256X: stopped\n"); - enabled = 0; - return TSL256X_SUCCESS; - } - return TSL256X_ERROR; - } - } - - if(!enabled) { - PRINTF("TSL256X: sensor not started\n"); - return TSL256X_ERROR; - } - - if(type == TSL256X_INT_DISABLE) { - - /* Ensure the GPIO doesn't generate more interrupts, this may affect others - * I2C digital sensors using the bus and sharing this pin, so an user may - * comment the line below - */ - GPIO_DISABLE_INTERRUPT(TSL256X_INT_PORT_BASE, TSL256X_INT_PIN_MASK); - - /* This also wipes out the persistance value, to be reconfigured when - * enabling back the interruption - */ - buf[0] = (TSL256X_COMMAND + TSL256X_INTERRUPT); - buf[1] = TSL256X_INTR_DISABLED; - - if(tsl256x_write_reg(buf, 2) != TSL256X_SUCCESS) { - PRINTF("TSL256X: failed to disable the interrupt\n"); - return TSL256X_ERROR; - } - return TSL256X_SUCCESS; - } - - /* Configure the timming and gain */ - if(type == TSL256X_TIMMING_CFG) { - if((value != TSL256X_G16X_402MS) && (value != TSL256X_G1X_402MS) && - (value != TSL256X_G1X_101MS) && (value != TSL256X_G1X_13_7MS)) { - PRINTF("TSL256X: invalid timming configuration values\n"); - return TSL256X_ERROR; - } - - buf[0] = (TSL256X_COMMAND + TSL256X_TIMMING); - buf[1] = value; - - if(tsl256x_write_reg(buf, 2) == TSL256X_SUCCESS) { - if(value == TSL256X_G16X_402MS) { - gain = 1; - } - - switch(value) { - case TSL256X_G16X_402MS: - case TSL256X_G1X_402MS: - timming = TSL256X_TIMMING_INTEG_402MS; - break; - case TSL256X_G1X_101MS: - timming = TSL256X_TIMMING_INTEG_101MS; - break; - case TSL256X_G1X_13_7MS: - timming = TSL256X_TIMMING_INTEG_13_7MS; - break; - } - - PRINTF("TSL256X: new timming %u gain %u\n", timming, gain); - return TSL256X_SUCCESS; - } - PRINTF("TSL256X: failed to configure timming\n"); - return TSL256X_ERROR; - } - - /* From here we handle the interrupt configuration, it requires the interrupt - * callback handler to have been previously set using the TSL256X_REGISTER_INT - * macro - */ - - buf[1] = ((uint8_t *)&value)[0]; - buf[2] = ((uint8_t *)&value)[1]; - - if(type == TSL256X_INT_OVER) { - buf[0] = (TSL256X_COMMAND + TSL256X_THRHIGHLOW); - } else if(type == TSL256X_INT_BELOW) { - buf[0] = (TSL256X_COMMAND + TSL256X_THRLOWLOW); - } - - if(tsl256x_write_reg(buf, 3) != TSL256X_SUCCESS) { - PRINTF("TSL256X: failed to set interrupt level\n"); - return TSL256X_ERROR; - } - - /* Now configure the interruption register (level interrupt, 2 integration - * cycles after threshold has been reached (roughly 804ms if timming is 402ms) - */ - buf[0] = (TSL256X_COMMAND + TSL256X_INTERRUPT); - buf[1] = (TSL256X_INTR_LEVEL << TSL256X_INTR_SHIFT); - buf[1] += TSL256X_INT_PERSIST_2_CYCLES; - - if(tsl256x_write_reg(buf, 2) != TSL256X_SUCCESS) { - PRINTF("TSL256X: failed to enable interrupt\n"); - return TSL256X_ERROR; - } - - /* Configure the interrupts pins */ - GPIO_SOFTWARE_CONTROL(TSL256X_INT_PORT_BASE, TSL256X_INT_PIN_MASK); - GPIO_SET_INPUT(TSL256X_INT_PORT_BASE, TSL256X_INT_PIN_MASK); - - /* Pull-up resistor, detect falling edge */ - GPIO_DETECT_EDGE(TSL256X_INT_PORT_BASE, TSL256X_INT_PIN_MASK); - GPIO_TRIGGER_SINGLE_EDGE(TSL256X_INT_PORT_BASE, TSL256X_INT_PIN_MASK); - GPIO_DETECT_FALLING(TSL256X_INT_PORT_BASE, TSL256X_INT_PIN_MASK); - gpio_hal_register_handler(&tsl256x_handler); - - /* Spin process until an interrupt is received */ - process_start(&tsl256x_int_process, NULL); - - /* Enable interrupts */ - GPIO_ENABLE_INTERRUPT(TSL256X_INT_PORT_BASE, TSL256X_INT_PIN_MASK); - - /* The RE-Mote revision A has this pin shared and with a pull-down resistor, - * for other platforms (like the firefly), change to enable pull-up internal - * resistor instead if no external pull-up is present. - */ - ioc_set_over(I2C_INT_PORT, I2C_INT_PIN, IOC_OVERRIDE_PUE); - NVIC_EnableIRQ(I2C_INT_VECTOR); - - PRINTF("TSL256X: Interrupt configured\n"); - return TSL256X_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return enabled; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - uint16_t lux; - - if(!enabled) { - PRINTF("TSL256X: sensor not started\n"); - return TSL256X_ERROR; - } - - if(type == TSL256X_VAL_READ) { - if(tsl256x_read_sensor(&lux) != TSL256X_ERROR) { - return lux; - } - PRINTF("TSL256X: fail to read\n"); - } - return TSL256X_ERROR; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(tsl256x, TSL256X_SENSOR, value, configure, status); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/arch/platform/zoul/dev/tsl256x.h b/arch/platform/zoul/dev/tsl256x.h deleted file mode 100644 index b21337f11..000000000 --- a/arch/platform/zoul/dev/tsl256x.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-tsl256x-sensor TSL256X Sensor - * - * Driver for the TSL256X sensor - * - * The TSL256X driver returns the converted light value value in lux - * @{ - * - * \file - * Header file for the external TSL256X Sensor Driver - * - * \author - * Antonio Lignan - * Toni Lozano - */ -/*---------------------------------------------------------------------------*/ -#ifndef TSL256X_H_ -#define TSL256X_H_ -#include -#include "lib/sensors.h" -#include "dev/zoul-sensors.h" -#include "i2c.h" -/* -------------------------------------------------------------------------- */ -/** - * \name TSL256x digital Light sensor specific model information - * @{ - */ -/* This driver supports the TSL2563 (Zolertia) and the TSL2561 (Grove) */ -#define TSL2561_SENSOR_REF 0 -#define TSL2563_SENSOR_REF 1 - -/* The TSL2563 (from Zolertia) has a different part number than the TSL2561 from - * Grove (digital light sensor) - */ -#define TSL2563_EXPECTED_PARTNO 0x30 -#define TSL2561_EXPECTED_PARTNO 0x50 - -#ifndef TSL256X_CONF_REF -#define TSL256X_REF TSL2561_SENSOR_REF -#else -#define TSL256X_REF TSL256X_CONF_REF -#endif - -#if TSL256X_CONF_REF == TSL2561_SENSOR -#define TSL256X_ADDR 0x29 -#define TSL256X_EXPECTED_PARTNO TSL2561_EXPECTED_PARTNO -#else -#define TSL256X_ADDR 0x39 -#define TSL256X_EXPECTED_PARTNO TSL2563_EXPECTED_PARTNO -#endif - -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name TSL256X digital Light registers - * @{ - */ -/* -------------------------------------------------------------------------- */ -#define TSL256X_CONTROL 0x00 -#define TSL256X_TIMMING 0x01 -#define TSL256X_THRLOWLOW 0x02 -#define TSL256X_THRLOWHIGH 0x03 -#define TSL256X_THRHIGHLOW 0x04 -#define TSL256X_THRHIGHHIGH 0x05 -#define TSL256X_INTERRUPT 0x06 -#define TSL256X_CRC 0x08 -#define TSL256X_ID_REG 0x0A -#define TSL256X_D0LOW 0x0C -#define TSL256X_D0HIGH 0x0D -#define TSL256X_D1LOW 0x0E -#define TSL256X_D1HIGH 0x0F -/* -------------------------------------------------------------------------- */ -/* Uses the word read/write operation protocol */ -#define TSL256X_COMMAND 0xA0 -#define TSL256X_CLEAR_INTERRUPT 0x40 -/* -------------------------------------------------------------------------- */ -#define TSL256X_CONTROL_POWER_ON 0x03 -#define TSL256X_CONTROL_POWER_OFF 0x00 -#define TSL256X_TIMMING_GAIN 0x10 -#define TSL256X_TIMMING_MANUAL 0x08 -#define TSL256X_TIMMING_INTEG_MANUAL 0x03 -#define TSL256X_TIMMING_INTEG_402MS 0x02 -#define TSL256X_TIMMING_INTEG_101MS 0x01 -#define TSL256X_TIMMING_INTEG_13_7MS 0x00 -#define TSL256X_TIMMING_INTEG_MASK 0x03 - -#define TSL256X_G16X_402MS (TSL256X_TIMMING_INTEG_402MS + TSL256X_TIMMING_GAIN) -#define TSL256X_G1X_402MS TSL256X_TIMMING_INTEG_402MS -#define TSL256X_G1X_101MS TSL256X_TIMMING_INTEG_101MS -#define TSL256X_G1X_13_7MS TSL256X_TIMMING_INTEG_13_7MS - -#define TSL256X_INTR_SHIFT 0x04 -#define TSL256X_INTR_DISABLED 0x00 -#define TSL256X_INTR_LEVEL 0x01 -#define TSL256X_INTR_SMB_ALERT 0x02 -#define TSL256X_INTR_TEST 0x03 - -#define TSL256X_INT_PERSIST_EVERY 0x00 -#define TSL256X_INT_PERSIST_ANY 0x01 -#define TSL256X_INT_PERSIST_2_CYCLES 0x02 -#define TSL256X_INT_PERSIST_3_CYCLES 0x03 -#define TSL256X_INT_PERSIST_4_CYCLES 0x04 -#define TSL256X_INT_PERSIST_5_CYCLES 0x05 -#define TSL256X_INT_PERSIST_6_CYCLES 0x06 -#define TSL256X_INT_PERSIST_7_CYCLES 0x07 -#define TSL256X_INT_PERSIST_8_CYCLES 0x08 -#define TSL256X_INT_PERSIST_9_CYCLES 0x09 -#define TSL256X_INT_PERSIST_10_CYCLES 0x0A -#define TSL256X_INT_PERSIST_11_CYCLES 0x0B -#define TSL256X_INT_PERSIST_12_CYCLES 0x0C -#define TSL256X_INT_PERSIST_13_CYCLES 0x0D -#define TSL256X_INT_PERSIST_14_CYCLES 0x0E -#define TSL256X_INT_PERSIST_15_CYCLES 0x0F - -#define TSL256X_ID_PARTNO_MASK 0xF0 -#define TSL256X_ID_REV_MASK 0x0F -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name TSL256X convertion and calibration values - * @{ - */ - -#define LUX_SCALE 14 /**< scale by 2^14 */ -#define RATIO_SCALE 9 /**< scale ratio */ -#define CH_SCALE 10 /**< scale channel values by 2^10 */ -#define CHSCALE_TINT0 0x7517 /**< 322/11 * 2^CH_SCALE */ -#define CHSCALE_TINT1 0x0fe7 /**< 322/81 * 2^CH_SCALE */ - -/* T/FN/CL package coefficients (hardcoded) */ -#define K1T 0X0040 -#define B1T 0x01f2 -#define M1T 0x01b2 -#define K2T 0x0080 -#define B2T 0x0214 -#define M2T 0x02d1 -#define K3T 0x00c0 -#define B3T 0x023f -#define M3T 0x037b -#define K4T 0x0100 -#define B4T 0x0270 -#define M4T 0x03fe -#define K5T 0x0138 -#define B5T 0x016f -#define M5T 0x01fc -#define K6T 0x019a -#define B6T 0x00d2 -#define M6T 0x00fb -#define K7T 0x029a -#define B7T 0x0018 -#define M7T 0x0012 -#define K8T 0x029a -#define B8T 0x0000 -#define M8T 0x0000 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Callback function to handle the TSL256X alarm interrupt and macro - * @{ - */ -#define TSL256X_REGISTER_INT(ptr) tsl256x_int_callback = ptr; -extern void (*tsl256x_int_callback)(uint8_t value); -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name TSL256X return and command values - * @{ - */ -#define TSL256X_SUCCESS 0x00 -#define TSL256X_LIGHT 0x01 -#define TSL256X_ERROR -1 - -#define TSL256X_ACTIVE SENSORS_ACTIVE -#define TSL256X_INT_OVER HW_INT_OVER_THRS -#define TSL256X_INT_BELOW HW_INT_BELOW_THRS -#define TSL256X_INT_DISABLE HW_INT_DISABLE -#define TSL256X_TIMMING_CFG (HW_INT_DISABLE + 1) - -#define TSL256X_VAL_READ 0x01 -/** @} */ -/* -------------------------------------------------------------------------- */ -#define TSL256X_SENSOR "TSL256X Light Sensor" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor tsl256x; -/* -------------------------------------------------------------------------- */ -#endif -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/dev/weather-meter.c b/arch/platform/zoul/dev/weather-meter.c deleted file mode 100644 index cc78f9654..000000000 --- a/arch/platform/zoul/dev/weather-meter.c +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-weather-meter-sensor - * @{ - * - * The Sparkfun's weather meter comprises an anemometer, wind vane and rain - * gauge, see https://www.sparkfun.com/products/8942 - * - * \file - * Weather meter sensor driver - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/adc-zoul.h" -#include "dev/weather-meter.h" -#include "dev/zoul-sensors.h" -#include "lib/sensors.h" -#include "dev/sys-ctrl.h" -#include "dev/gpio.h" -#include "dev/gpio-hal.h" -#include "dev/ioc.h" -#include "sys/timer.h" -#include "sys/ctimer.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define DEBOUNCE_DURATION (CLOCK_SECOND >> 6) -/*---------------------------------------------------------------------------*/ -#define ANEMOMETER_SENSOR_PORT_BASE GPIO_PORT_TO_BASE(ANEMOMETER_SENSOR_PORT) -#define ANEMOMETER_SENSOR_PIN_MASK GPIO_PIN_MASK(ANEMOMETER_SENSOR_PIN) -#define RAIN_GAUGE_SENSOR_PORT_BASE GPIO_PORT_TO_BASE(RAIN_GAUGE_SENSOR_PORT) -#define RAIN_GAUGE_SENSOR_PIN_MASK GPIO_PIN_MASK(RAIN_GAUGE_SENSOR_PIN) -/*---------------------------------------------------------------------------*/ -void (*rain_gauge_int_callback)(uint16_t value); -void (*anemometer_int_callback)(uint16_t value); -/*---------------------------------------------------------------------------*/ -static uint8_t enabled; -/*---------------------------------------------------------------------------*/ -process_event_t anemometer_int_event; -process_event_t rain_gauge_int_event; -/*---------------------------------------------------------------------------*/ -static struct ctimer ct; -static struct timer debouncetimer; -/*---------------------------------------------------------------------------*/ -typedef struct { - uint16_t ticks; - uint16_t value; - uint8_t int_en; - uint16_t int_thres; -} weather_meter_sensors_t; - -typedef struct { - uint16_t value_max; - uint64_t ticks_avg; - uint64_t value_avg; - uint32_t value_buf_xm; - uint16_t value_avg_xm; -} weather_meter_ext_t; - -typedef struct { - uint16_t wind_vane; - weather_meter_sensors_t rain_gauge; - weather_meter_sensors_t anemometer; -} weather_meter_sensors; - -typedef struct { - int32_t value_buf_xm; - int16_t value_prev; - int16_t value_avg_xm; -} weather_meter_wind_vane_ext_t; - -static weather_meter_sensors weather_sensors; -static weather_meter_ext_t anemometer; -static weather_meter_wind_vane_ext_t wind_vane; -/*---------------------------------------------------------------------------*/ -typedef struct { - uint16_t mid_point; - uint16_t degree; -} wind_vane_mid_point_t; - -/* From the datasheet we adjusted the values for a 3V divider, using a 10K - * resistor, the check values are the following: - * --------------------+------------------+------------------------------- - * Direction (Degrees) Resistance (Ohms) Voltage (mV) - * 0 33k 2532.55 * - * 22.5 6.57k 1308.44 * - * 45 8.2k 1486.81 * - * 67.5 891 269.97 * - * 90 1k 300.00 * - * 112.5 688 212.42 * - * 135 2.2k 595.08 * - * 157.5 1.41k 407.80 * - * 180 3.9k 925.89 * - * 202.5 3.14k 788.58 * - * 225 16k 2030.76 * - * 247.5 14.12k 1930.84 * - * 270 120k 3046.15 * - * 292.5 42.12k 2666.84 * - * 315 64.9k 2859.41 * - * 337.5 21.88k 2264.86 * - * --------------------+------------------+------------------------------- - */ -static const wind_vane_mid_point_t wind_vane_table[16] = { - { 2124, 1125 }, - { 2699, 675 }, - { 3000, 900 }, - { 4078, 1575 }, - { 5950, 1350 }, - { 7885, 2025 }, - { 9258, 1800 }, - { 13084, 225 }, - { 14868, 450 }, - { 19308, 2475 }, - { 20307, 2250 }, - { 22648, 3375 }, - { 25325, 0 }, - { 26668, 2925 }, - { 28594, 3150 }, - { 30461, 2700 }, -}; -/*---------------------------------------------------------------------------*/ -static int -weather_meter_wind_vane_degrees(uint16_t value) -{ - uint8_t i; - for(i = 0; i < 16; i++) { - if(value <= wind_vane_table[i].mid_point) { - return (int)wind_vane_table[i].degree; - } else { - if(i == 15) { - return (int)wind_vane_table[i].degree; - } - } - } - - PRINTF("Weather: invalid wind vane value\n"); - return WEATHER_METER_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -weather_meter_get_wind_dir(void) -{ - weather_sensors.wind_vane = adc_zoul.value(WIND_VANE_ADC); - if((int16_t)weather_sensors.wind_vane < 0) { - weather_sensors.wind_vane = 0; - } - return weather_meter_wind_vane_degrees(weather_sensors.wind_vane); -} -/*---------------------------------------------------------------------------*/ -static void -ct_callback(void *ptr) -{ - uint32_t wind_speed; - int16_t wind_dir; - int16_t wind_dir_delta; - - /* Disable to make the calculations in an interrupt-safe context */ - GPIO_DISABLE_INTERRUPT(ANEMOMETER_SENSOR_PORT_BASE, - ANEMOMETER_SENSOR_PIN_MASK); - wind_speed = weather_sensors.anemometer.ticks; - wind_speed *= WEATHER_METER_ANEMOMETER_SPEED_1S; - weather_sensors.anemometer.value = (uint16_t)wind_speed; - anemometer.ticks_avg++; - anemometer.value_avg += weather_sensors.anemometer.value; - anemometer.value_buf_xm += weather_sensors.anemometer.value; - - /* Take maximum value */ - if(weather_sensors.anemometer.value > anemometer.value_max) { - anemometer.value_max = weather_sensors.anemometer.value; - } - - /* Mitsuta method to get the wind direction average */ - wind_dir = weather_meter_get_wind_dir(); - wind_dir_delta = wind_dir - wind_vane.value_prev; - - if(wind_dir_delta < -1800) { - wind_vane.value_prev += wind_dir_delta + 3600; - } else if(wind_dir_delta > 1800) { - wind_vane.value_prev += wind_dir_delta - 3600; - } else { - wind_vane.value_prev += wind_dir_delta; - } - - wind_vane.value_buf_xm += wind_vane.value_prev; - - /* Calculate the 2 minute average */ - if(!(anemometer.ticks_avg % WEATHER_METER_AVG_PERIOD)) { - PRINTF("\nWeather: calculate the %u averages ***\n", WEATHER_METER_AVG_PERIOD); - - if(anemometer.value_buf_xm) { - anemometer.value_avg_xm = anemometer.value_buf_xm / WEATHER_METER_AVG_PERIOD; - anemometer.value_buf_xm = 0; - } else { - anemometer.value_avg_xm = 0; - } - - if(wind_vane.value_buf_xm >= 0) { - wind_vane.value_buf_xm = wind_vane.value_buf_xm / WEATHER_METER_AVG_PERIOD; - wind_vane.value_avg_xm = wind_vane.value_buf_xm; - } else { - wind_vane.value_buf_xm = ABS(wind_vane.value_buf_xm) / WEATHER_METER_AVG_PERIOD; - wind_vane.value_avg_xm = wind_vane.value_buf_xm; - wind_vane.value_avg_xm = ~wind_vane.value_avg_xm + 1; - } - - if(wind_vane.value_avg_xm >= 3600) { - wind_vane.value_avg_xm -= 3600; - } else if(wind_vane.value_avg_xm < 0) { - wind_vane.value_avg_xm += 3600; - } - - wind_vane.value_buf_xm = 0; - wind_vane.value_prev = wind_dir; - } - - /* Check for roll-over */ - if(!anemometer.ticks_avg) { - anemometer.value_avg = 0; - } - - weather_sensors.anemometer.ticks = 0; - - /* Enable the interrupt again */ - GPIO_ENABLE_INTERRUPT(ANEMOMETER_SENSOR_PORT_BASE, - ANEMOMETER_SENSOR_PIN_MASK); - - ctimer_set(&ct, CLOCK_SECOND, ct_callback, NULL); -} -/*---------------------------------------------------------------------------*/ -PROCESS(weather_meter_int_process, "Weather meter interrupt process handler"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(weather_meter_int_process, ev, data) -{ - PROCESS_EXITHANDLER(); - PROCESS_BEGIN(); - - while(1) { - PROCESS_YIELD(); - - if((ev == anemometer_int_event) && (weather_sensors.anemometer.int_en)) { - if(weather_sensors.anemometer.ticks >= - weather_sensors.anemometer.int_thres) { - anemometer_int_callback(weather_sensors.anemometer.ticks); - } - } - - if((ev == rain_gauge_int_event) && (weather_sensors.rain_gauge.int_en)) { - if(weather_sensors.rain_gauge.ticks >= - weather_sensors.rain_gauge.int_thres) { - rain_gauge_int_callback(weather_sensors.rain_gauge.ticks); - } - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static void weather_meter_interrupt_handler(gpio_hal_pin_mask_t pin_mask); -/*---------------------------------------------------------------------------*/ -static gpio_hal_event_handler_t rain_handler = { - .next = NULL, - .handler = weather_meter_interrupt_handler, - .pin_mask = gpio_hal_pin_to_mask(RAIN_GAUGE_SENSOR_PIN) << (RAIN_GAUGE_SENSOR_PORT << 3), -}; -/*---------------------------------------------------------------------------*/ -static gpio_hal_event_handler_t anemometer_handler = { - .next = NULL, - .handler = weather_meter_interrupt_handler, - .pin_mask = gpio_hal_pin_to_mask(ANEMOMETER_SENSOR_PIN) << (ANEMOMETER_SENSOR_PORT << 3), -}; -/*---------------------------------------------------------------------------*/ -static void -weather_meter_interrupt_handler(gpio_hal_pin_mask_t pin_mask) -{ - uint32_t aux; - - /* Prevent bounce events */ - if(!timer_expired(&debouncetimer)) { - return; - } - - timer_set(&debouncetimer, DEBOUNCE_DURATION); - - /* We make a process_post() to check in the pollhandler any specific threshold - * value - */ - - if(pin_mask == rain_handler.pin_mask) { - weather_sensors.anemometer.ticks++; - process_post(&weather_meter_int_process, anemometer_int_event, NULL); - } else if(pin_mask == anemometer_handler.pin_mask) { - weather_sensors.rain_gauge.ticks++; - aux = weather_sensors.rain_gauge.ticks * WEATHER_METER_AUX_RAIN_MM; - aux /= 1000; - weather_sensors.rain_gauge.value = (uint16_t)aux; - process_post(&weather_meter_int_process, rain_gauge_int_event, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - uint64_t aux; - - if((type != WEATHER_METER_ANEMOMETER) && - (type != WEATHER_METER_RAIN_GAUGE) && - (type != WEATHER_METER_WIND_VANE) && - (type != WEATHER_METER_WIND_VANE_AVG_X) && - (type != WEATHER_METER_ANEMOMETER_AVG) && - (type != WEATHER_METER_ANEMOMETER_AVG_X) && - (type != WEATHER_METER_ANEMOMETER_MAX)) { - PRINTF("Weather: requested an invalid sensor value\n"); - return WEATHER_METER_ERROR; - } - - if(!enabled) { - PRINTF("Weather: module is not configured\n"); - return WEATHER_METER_ERROR; - } - - switch(type) { - case WEATHER_METER_WIND_VANE: - return weather_meter_get_wind_dir(); - - case WEATHER_METER_WIND_VANE_AVG_X: - return wind_vane.value_avg_xm; - - case WEATHER_METER_ANEMOMETER: - return weather_sensors.anemometer.value; - - case WEATHER_METER_ANEMOMETER_AVG: - if(anemometer.value_avg <= 0) { - return (uint16_t)anemometer.value_avg; - } - aux = anemometer.value_avg / anemometer.ticks_avg; - return (uint16_t)aux; - - case WEATHER_METER_ANEMOMETER_AVG_X: - return anemometer.value_avg_xm; - - case WEATHER_METER_ANEMOMETER_MAX: - return anemometer.value_max; - - /* as the default return type is int, we have a lower resolution if returning - * the calculated value as it is truncated, an alternative is returning the - * ticks and calculating on your own with WEATHER_METER_AUX_RAIN_MM - */ - case WEATHER_METER_RAIN_GAUGE: -#if WEATHER_METER_RAIN_RETURN_TICKS - return weather_sensors.rain_gauge.ticks; -#else - return weather_sensors.rain_gauge.value; -#endif - - default: - return WEATHER_METER_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - if((type != WEATHER_METER_ACTIVE) && - (type != WEATHER_METER_ANEMOMETER_INT_OVER) && - (type != WEATHER_METER_RAIN_GAUGE_INT_OVER) && - (type != WEATHER_METER_ANEMOMETER_INT_DIS) && - (type != WEATHER_METER_RAIN_GAUGE_INT_DIS)) { - PRINTF("Weather: invalid configuration option\n"); - return WEATHER_METER_ERROR; - } - - if(type == WEATHER_METER_ACTIVE) { - - anemometer.value_avg = 0; - anemometer.ticks_avg = 0; - - weather_sensors.anemometer.int_en = 0; - weather_sensors.rain_gauge.int_en = 0; - weather_sensors.anemometer.ticks = 0; - weather_sensors.rain_gauge.ticks = 0; - weather_sensors.anemometer.value = 0; - weather_sensors.rain_gauge.value = 0; - - if(!value) { - anemometer_int_callback = NULL; - rain_gauge_int_callback = NULL; - GPIO_DISABLE_INTERRUPT(ANEMOMETER_SENSOR_PORT_BASE, - ANEMOMETER_SENSOR_PIN_MASK); - GPIO_DISABLE_INTERRUPT(RAIN_GAUGE_SENSOR_PORT_BASE, - RAIN_GAUGE_SENSOR_PIN_MASK); - process_exit(&weather_meter_int_process); - enabled = 0; - PRINTF("Weather: disabled\n"); - return WEATHER_METER_SUCCESS; - } - - /* Configure the wind vane */ - adc_zoul.configure(SENSORS_HW_INIT, WIND_VANE_ADC); - - /* Configure anemometer interruption */ - GPIO_SOFTWARE_CONTROL(ANEMOMETER_SENSOR_PORT_BASE, ANEMOMETER_SENSOR_PIN_MASK); - GPIO_SET_INPUT(ANEMOMETER_SENSOR_PORT_BASE, ANEMOMETER_SENSOR_PIN_MASK); - GPIO_DETECT_RISING(ANEMOMETER_SENSOR_PORT_BASE, ANEMOMETER_SENSOR_PIN_MASK); - GPIO_TRIGGER_SINGLE_EDGE(ANEMOMETER_SENSOR_PORT_BASE, - ANEMOMETER_SENSOR_PIN_MASK); - ioc_set_over(ANEMOMETER_SENSOR_PORT, ANEMOMETER_SENSOR_PIN, IOC_OVERRIDE_DIS); - gpio_hal_register_handler(&anemometer_handler); - - /* Configure rain gauge interruption */ - GPIO_SOFTWARE_CONTROL(RAIN_GAUGE_SENSOR_PORT_BASE, RAIN_GAUGE_SENSOR_PIN_MASK); - GPIO_SET_INPUT(RAIN_GAUGE_SENSOR_PORT_BASE, RAIN_GAUGE_SENSOR_PIN_MASK); - GPIO_DETECT_RISING(RAIN_GAUGE_SENSOR_PORT_BASE, RAIN_GAUGE_SENSOR_PIN_MASK); - GPIO_TRIGGER_SINGLE_EDGE(RAIN_GAUGE_SENSOR_PORT_BASE, - RAIN_GAUGE_SENSOR_PIN_MASK); - ioc_set_over(RAIN_GAUGE_SENSOR_PORT, RAIN_GAUGE_SENSOR_PIN, IOC_OVERRIDE_DIS); - gpio_hal_register_handler(&rain_handler); - - process_start(&weather_meter_int_process, NULL); - - /* Initialize here prior the first second tick */ - wind_vane.value_prev = weather_meter_get_wind_dir(); - - ctimer_set(&ct, CLOCK_SECOND, ct_callback, NULL); - - GPIO_ENABLE_INTERRUPT(ANEMOMETER_SENSOR_PORT_BASE, ANEMOMETER_SENSOR_PIN_MASK); - GPIO_ENABLE_INTERRUPT(RAIN_GAUGE_SENSOR_PORT_BASE, RAIN_GAUGE_SENSOR_PIN_MASK); - NVIC_EnableIRQ(ANEMOMETER_SENSOR_VECTOR); - NVIC_EnableIRQ(RAIN_GAUGE_SENSOR_VECTOR); - - enabled = 1; - PRINTF("Weather: started\n"); - return WEATHER_METER_SUCCESS; - } - - switch(type) { - case WEATHER_METER_ANEMOMETER_INT_OVER: - weather_sensors.anemometer.int_en = 1; - weather_sensors.anemometer.int_thres = value; - PRINTF("Weather: anemometer threshold %u\n", value); - break; - case WEATHER_METER_RAIN_GAUGE_INT_OVER: - weather_sensors.rain_gauge.int_en = 1; - weather_sensors.rain_gauge.int_thres = value; - PRINTF("Weather: rain gauge threshold %u\n", value); - break; - case WEATHER_METER_ANEMOMETER_INT_DIS: - PRINTF("Weather: anemometer int disabled\n"); - weather_sensors.anemometer.int_en = 0; - break; - case WEATHER_METER_RAIN_GAUGE_INT_DIS: - PRINTF("Weather: rain gauge int disabled\n"); - weather_sensors.rain_gauge.int_en = 0; - break; - default: - return WEATHER_METER_ERROR; - } - - return WEATHER_METER_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(weather_meter, WEATHER_METER_SENSOR, value, configure, NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ - diff --git a/arch/platform/zoul/dev/weather-meter.h b/arch/platform/zoul/dev/weather-meter.h deleted file mode 100644 index 0d414fb4a..000000000 --- a/arch/platform/zoul/dev/weather-meter.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup zoul-weather-meter-sensor Sparkfun's weather meter - * @{ - * - * \file - * Weather meter header file - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -#include "dev/zoul-sensors.h" -/* -------------------------------------------------------------------------- */ -#ifndef WEATHER_METER_H_ -#define WEATHER_METER_H_ -/* -------------------------------------------------------------------------- */ -/** - * \name Weather meter sensor return and operation values - * @{ - */ -#define WEATHER_METER_RAIN_GAUGE 0x01 -#define WEATHER_METER_WIND_VANE 0x02 -#define WEATHER_METER_WIND_VANE_AVG_X 0x03 -#define WEATHER_METER_ANEMOMETER 0x04 -#define WEATHER_METER_ANEMOMETER_AVG 0x05 -#define WEATHER_METER_ANEMOMETER_AVG_X 0x06 -#define WEATHER_METER_ANEMOMETER_MAX 0x07 - -/* Period (seconds) to calculate an average */ -#ifdef WEATHER_METER_CONF_AVG_PERIOD -#define WEATHER_METER_AVG_PERIOD WEATHER_METER_CONF_AVG_PERIOD -#else -#define WEATHER_METER_AVG_PERIOD 120 -#endif - -#define WEATHER_METER_ACTIVE SENSORS_ACTIVE -#define WEATHER_METER_ANEMOMETER_INT_OVER HW_INT_OVER_THRS -#define WEATHER_METER_ANEMOMETER_INT_DIS HW_INT_DISABLE -#define WEATHER_METER_RAIN_GAUGE_INT_OVER (HW_INT_OVER_THRS << 1) -#define WEATHER_METER_RAIN_GAUGE_INT_DIS (HW_INT_DISABLE << 1) - -#define WEATHER_METER_SUCCESS 0 -#define WEATHER_METER_ERROR (-1) - -/* 2.4Km/h per tick, 2 per rotation */ -#define WEATHER_METER_ANEMOMETER_SPEED_1S (1200) - -/* 0.2794mm per tick */ -#define WEATHER_METER_AUX_RAIN_MM 2794 - -/* Allows to select the return type: ticks or converted value (truncated) */ -#ifdef WEATHER_METER_RAIN_CONF_RETURN -#define WEATHER_METER_RAIN_RETURN_TICKS WEATHER_METER_RAIN_CONF_RETURN -#else -#define WEATHER_METER_RAIN_RETURN_TICKS 1 -#endif -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Anemometer and rain gauge sensor interrupt callback macro - * @{ - */ -#define WEATHER_METER_REGISTER_ANEMOMETER_INT(ptr) anemometer_int_callback = ptr; -#define WEATHER_METER_REGISTER_RAIN_GAUGE_INT(ptr) rain_gauge_int_callback = ptr; -extern void (*anemometer_int_callback)(uint16_t value); -extern void (*rain_gauge_int_callback)(uint16_t value); -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Weather meter's anemometer default pin, port and interrupt vector - * @{ - */ -#ifdef WEATHER_METER_CONF_ANEMOMETER_PIN -#define ANEMOMETER_SENSOR_PIN WEATHER_METER_CONF_ANEMOMETER_PIN -#else -#define ANEMOMETER_SENSOR_PIN 1 -#endif -#ifdef WEATHER_METER_CONF_ANEMOMETER_PORT -#define ANEMOMETER_SENSOR_PORT WEATHER_METER_CONF_ANEMOMETER_PORT -#else -#define ANEMOMETER_SENSOR_PORT GPIO_D_NUM -#endif -#ifdef WEATHER_METER_CONF_ANEMOMETER_VECTOR -#define ANEMOMETER_SENSOR_VECTOR WEATHER_METER_CONF_ANEMOMETER_VECTOR -#else -#define ANEMOMETER_SENSOR_VECTOR GPIO_D_IRQn -#endif -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Weather meter's rain gauge default pin, port and interrupt vector - * @{ - */ -#ifdef WEATHER_METER_CONF_RAIN_GAUGE_PIN -#define RAIN_GAUGE_SENSOR_PIN WEATHER_METER_CONF_RAIN_GAUGE_PIN -#else -#define RAIN_GAUGE_SENSOR_PIN 2 -#endif -#ifdef WEATHER_METER_CONF_RAIN_GAUGE_PORT -#define RAIN_GAUGE_SENSOR_PORT WEATHER_METER_CONF_RAIN_GAUGE_PORT -#else -#define RAIN_GAUGE_SENSOR_PORT GPIO_D_NUM -#endif -#ifdef WEATHER_METER_CONF_RAIN_GAUGE_VECTOR -#define RAIN_GAUGE_SENSOR_VECTOR WEATHER_METER_CONF_RAIN_GAUGE_VECTOR -#else -#define RAIN_GAUGE_SENSOR_VECTOR GPIO_D_IRQn -#endif -/** @} */ -/* -------------------------------------------------------------------------- */ -/** - * \name Weather meter's wind vane default ADCx pin (see board.h) - * @{ - */ -#ifdef WEATHER_METER_CONF_RAIN_WIND_VANE_ADC -#define WIND_VANE_ADC WEATHER_METER_CONF_RAIN_WIND_VANE_ADC -#else -#define WIND_VANE_ADC ZOUL_SENSORS_ADC3 -#endif -/** @} */ -/* -------------------------------------------------------------------------- */ -#define WEATHER_METER_SENSOR "Sparkfun weather meter" -/* -------------------------------------------------------------------------- */ -extern const struct sensors_sensor weather_meter; -/* -------------------------------------------------------------------------- */ -#endif /* ifndef WEATHER_METER_H_ */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/zonik.c b/arch/platform/zoul/dev/zonik.c deleted file mode 100644 index a087b620a..000000000 --- a/arch/platform/zoul/dev/zonik.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-zonik - * @{ - * Driver for the RE-Mote Zonik sonometer board - * @{ - * \file - * Driver for the RE-Mote Zonik sound sensor (ZONIK) - * \author - * Aitor Mejias - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/gpio.h" -#include "dev/i2c.h" -#include "zonik.h" -#include "sys/timer.h" -#include "sys/etimer.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -#define ZONIK_INT1_PORT_BASE GPIO_PORT_TO_BASE(ZONIK_INT_PORT) -#define ZONIK_INT1_PIN_MASK GPIO_PIN_MASK(ZONIK_INT_PIN) -/*---------------------------------------------------------------------------*/ -static uint8_t zonik_buffer[ZONIK_FRAME_SIZE+1]; -static uint16_t zonik_status = ZONIK_DISABLED; -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS(zonik_stm_process, "Zonik process process handler"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(zonik_stm_process, ev, data) -{ - #if DEBUG - static int i; - #endif - PROCESS_EXITHANDLER(); - PROCESS_BEGIN(); - - while(1) { - /* Wait a process */ - etimer_set(&et, ZONIK_SECOND_INTERVAL); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Control the interrupt for activate the sensor */ - GPIO_SET_OUTPUT(ZONIK_INT1_PORT_BASE, ZONIK_INT1_PIN_MASK); - GPIO_CLR_PIN(ZONIK_INT1_PORT_BASE, ZONIK_INT1_PIN_MASK); - clock_delay_usec(ZONIK_INITIAL_WAIT_DELAY); - i2c_master_enable(); - if(i2c_single_send(ZONIK_ADDR, ZONIK_CMD_READ) != I2C_MASTER_ERR_NONE) { - zonik_status = ZONIK_ERROR; - PRINTF("Zonik: Error in I2C Communication\n"); - } - GPIO_SET_PIN(ZONIK_INT1_PORT_BASE, ZONIK_INT1_PIN_MASK); - GPIO_SET_INPUT(ZONIK_INT1_PORT_BASE, ZONIK_INT1_PIN_MASK); - if(zonik_status != ZONIK_ERROR) { - etimer_set(&et, ZONIK_WAIT_ACQ); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - clock_delay_usec(ZONIK_FINAL_WAIT_DELAY); - i2c_master_enable(); - if(i2c_burst_receive(ZONIK_ADDR, &zonik_buffer[0], ZONIK_FRAME_SIZE) != - I2C_MASTER_ERR_NONE) { - zonik_status = ZONIK_ERROR; - PRINTF("Zonik: Error in I2C Burst Mode Receive"); - } - #if DEBUG - PRINTF("\nZonik: "); - for(i=0; i - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/* -------------------------------------------------------------------------- */ -/** - * \addtogroup zoul-sensors - * @{ - * - * \defgroup remote-zonik Zonik sound sensor - * @{ - * - * \file - * Header file for the Zolertia Zonik sound sensor - */ -/* -------------------------------------------------------------------------- */ -#ifndef ZONIK_H_ -#define ZONIK_H_ -/* -------------------------------------------------------------------------- */ -#include -#include "lib/sensors.h" -#include "dev/zoul-sensors.h" -#include "i2c.h" -#include "sys/rtimer.h" -/* -------------------------------------------------------------------------- */ -/** \name ZONIK address and definitions - * @{ - */ -#define ZONIK_ADDR 0x68 -#define ZONIK_SENSOR "Zonik Sound Sensor" - -#define ZONIK_INITIAL_WAIT_DELAY 11000L -#define ZONIK_FINAL_WAIT_DELAY 22000L - -#ifndef ZONIK_INT_CONF_PORT -#define ZONIK_INT_PORT I2C_INT_PORT -#else -#define ZONIK_INT_PORT ZONIK_INT_CONF_PORT -#endif - -#ifndef ZONIK_INT_CONF_PIN -#define ZONIK_INT_PIN I2C_INT_PIN -#else -#define ZONIK_INT_PIN ZONIK_INT_CONF_PIN -#endif - -#define ZONIK_FRAME_SIZE 4 - -#define ZONIK_WAIT_ACQ (CLOCK_SECOND / 5) - -/* Zonik wait sensor delay: ~800ms */ -#define ZONIK_SECOND_INTERVAL 106 - -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name ZONIK error values and definitions - * @{ - */ -#define ZONIK_ACTIVE SENSORS_ACTIVE -#define ZONIK_HW_INIT SENSORS_HW_INIT -#define ZONIK_ENABLED 1 -#define ZONIK_VALUE_DEACTIVATE 0 -#define ZONIK_DISABLED 0xD1ED -#define ZONIK_ERROR (-1) -#define ZONIK_DBA_LEQ_VALUE 0x00 -#define ZONIK_COUNT_VALUE 0x01 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name ZONIK command definitions - * @{ - */ -#define ZONIK_CMD_READ 0x01 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name ZONIK sensor type - * @{ - */ -extern const struct sensors_sensor zonik; -/** @} */ -/* -------------------------------------------------------------------------- */ -#endif -/* -------------------------------------------------------------------------- */ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/zoul-sensors.c b/arch/platform/zoul/dev/zoul-sensors.c deleted file mode 100644 index 8015a183e..000000000 --- a/arch/platform/zoul/dev/zoul-sensors.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-sensors - * @{ - * - * Generic module controlling sensors on the Zoul platform - * @{ - * - * \file - * Implementation of a generic module controlling Zoul sensors - */ -#include "contiki.h" -#include "dev/cc2538-sensors.h" -#include "dev/button-sensor.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \brief Exports global symbols for the sensor API */ -SENSORS(&vdd3_sensor, &cc2538_temp_sensor); -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/dev/zoul-sensors.h b/arch/platform/zoul/dev/zoul-sensors.h deleted file mode 100644 index 92635810a..000000000 --- a/arch/platform/zoul/dev/zoul-sensors.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul - * @{ - * - * \defgroup zoul-sensors Zoul Sensors - * - * Generic module controlling sensors on the Zoul platform - * @{ - * - * \file - * Implementation of a generic module controlling Zoul sensors - */ -/*---------------------------------------------------------------------------*/ -#ifndef ZOUL_SENSORS_H_ -#define ZOUL_SENSORS_H_ -/*---------------------------------------------------------------------------*/ -#include "lib/sensors.h" -#include "dev/cc2538-sensors.h" -/*---------------------------------------------------------------------------*/ -/** - * \name Zoul sensor constants - * - * These constants are used by various sensors on the Zoul. They can be used - * to configure ADC decimation rate (where applicable), enable interrupts, etc. - * @{ - */ -#define HW_INT_OVER_THRS 0x01 -#define HW_INT_BELOW_THRS 0x02 -#define HW_INT_DISABLE 0x03 -#define ZOUL_SENSORS_CONFIGURE_TYPE_DECIMATION_RATE 0x0100 -#define ZOUL_SENSORS_ERROR CC2538_SENSORS_ERROR -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* ZOUL_SENSORS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/doxygen-group.txt b/arch/platform/zoul/doxygen-group.txt deleted file mode 100644 index 9090c2390..000000000 --- a/arch/platform/zoul/doxygen-group.txt +++ /dev/null @@ -1,4 +0,0 @@ -/** - * \defgroup zoul-core Zolertia Zoul-based platforms - * \ingroup cc2538-platforms - */ diff --git a/arch/platform/zoul/firefly-reva/Makefile.firefly-reva b/arch/platform/zoul/firefly-reva/Makefile.firefly-reva deleted file mode 100644 index bfbcb03fb..000000000 --- a/arch/platform/zoul/firefly-reva/Makefile.firefly-reva +++ /dev/null @@ -1,2 +0,0 @@ -MOTELIST_ZOLERTIA := Firefly -BOARD_SOURCEFILES += board.c diff --git a/arch/platform/zoul/firefly-reva/board.c b/arch/platform/zoul/firefly-reva/board.c deleted file mode 100644 index 1824e43ba..000000000 --- a/arch/platform/zoul/firefly-reva/board.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup firefly - * @{ - * - * \file - * Board-initialisation for the Zolertia's Firefly platform - * - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include -#include -/*---------------------------------------------------------------------------*/ -static void -configure_unused_pins(void) -{ - /* FIXME */ -} -/*---------------------------------------------------------------------------*/ -void -board_init() -{ - configure_unused_pins(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ - diff --git a/arch/platform/zoul/firefly-reva/board.h b/arch/platform/zoul/firefly-reva/board.h deleted file mode 100644 index 784f9e902..000000000 --- a/arch/platform/zoul/firefly-reva/board.h +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2015, Zolertia - * 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. - */ -/** - * \addtogroup zoul-platforms - * @{ - * - * \addtogroup firefly - * - * The Zolertia Firefly is the most down-to-core development platform, exposing - * the Zoul core functionalities and features, with a slick design to allow a - * flexible and easier user experience. - * - * Defines related to the Firefly platform: a Zoul-based breakout board - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * This file can be used as the basis to configure other platforms using the - * cc2538 SoC. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the Zolertia's - * Firefly platform, Zoul-based - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -#ifndef BOARD_H_ -#define BOARD_H_ - -#include "dev/gpio.h" -#include "dev/nvic.h" -/*---------------------------------------------------------------------------*/ -/** \name Connector headers - * - * The Firefly features two 2.54 mm header rows over which exposes the following - * pins (facing up, Zolertia logo above and USB connector below): - * -----------------------------+---+---+-------------------------------------- - * PIN_NAME |JP3|JP2| PIN_NAME - * -----------------------------+---+---+-------------------------------------- - * PB5/CC1200.CS |-01|15-| PD2/SPI1.MISO - * PB2/SPI0.SCLK/CC1200.SCLK |-02|16-| PD0/SPI1.SCLK - * PB1/SPIO0.MOSI/CC1200.MOSI |-03|17-| ADC5/AIN7/PA7 - * PB3/SPIO0.MISO/CC1200.MISO |-04|18-| ADC4/AIN6/PA6 - * PB4/CC1200.GPIO0 |-05|19-| DGND - * PB0/CC1200.GPIO2 |-06|20-| +VDD - * PD1/I2C.INT |-07|21-| ADC1/AIN5/PA5 - * PC2/I2C.SDA |-08|22-| ADC2/AIN4/PA4 - * PC3/I2C.SCL |-09|23-| BUTTON.USER/ADC6/AIN3/PA3 - * DGND |-10|24-| ADC3/AIN2/PA2 - * +VDD |-11|25-| PC0/UART1.TX - * PC6/SPI1.MOSI |-12|26-| PC1/UART1.RX - * USB.D+ |-13|27-| PC4 - * USB.D- |-14|28-| PC5 - * ---------------------------+-+---+---+-+------------------------------------ - */ -/*---------------------------------------------------------------------------*/ -/** \name Firefly LED configuration - * - * LEDs on the Firefly are connected as follows: - * - LED1 (Red) -> PD5 - * - LED2 (Green) -> PD4 - * - LED3 (Blue) -> PD3 - * - * LED1 pin exposed in JP2 connector - * LED2 pin exposed in JP2 connector - * LED3 pin exposed in JP2 connector - * @{ - */ -/*---------------------------------------------------------------------------*/ -#define LEDS_ARCH_L1_PORT GPIO_D_NUM -#define LEDS_ARCH_L1_PIN 5 -#define LEDS_ARCH_L2_PORT GPIO_D_NUM -#define LEDS_ARCH_L2_PIN 4 -#define LEDS_ARCH_L3_PORT GPIO_D_NUM -#define LEDS_ARCH_L3_PIN 3 - -#define LEDS_CONF_RED 1 -#define LEDS_CONF_GREEN 2 -#define LEDS_CONF_BLUE 4 - -#define LEDS_CONF_COUNT 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name USB configuration - * - * The USB pullup is to be enabled by an external resistor, as it is not mapped - * to a GPIO. - */ -#ifdef USB_PULLUP_PORT -#undef USB_PULLUP_PORT -#endif -#ifdef USB_PULLUP_PIN -#undef USB_PULLUP_PIN -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART configuration - * - * On the Firefly, the UARTs are connected to the following ports/pins: - * - * - UART0: - * - RX: PA0, connected to CP2104 serial-to-usb converter TX pin - * - TX: PA1, connected to CP2104 serial-to-usb converter RX pin - * - UART1: - * - RX: PC1 - * - TX: PC0 - * - CTS: not used, one suggestion however is to use PC4 - * - RTS: not used, one suggestion however is to use PC5 - * - * We configure the port to use UART0 and UART1, CTS/RTS only for UART1, - * both without a HW pull-up resistor. - * UART0 is not exposed anywhere, UART1 pins are exposed over the JP3 connector. - * @{ - */ -#define UART0_RX_PORT GPIO_A_NUM -#define UART0_RX_PIN 0 -#define UART0_TX_PORT GPIO_A_NUM -#define UART0_TX_PIN 1 - -#define UART1_RX_PORT GPIO_C_NUM -#define UART1_RX_PIN 1 -#define UART1_TX_PORT GPIO_C_NUM -#define UART1_TX_PIN 0 -#define UART1_CTS_PORT (-1) /**< GPIO_D_NUM */ -#define UART1_CTS_PIN (-1) /**< 1 */ -#define UART1_RTS_PORT (-1) /**< GPIO_D_NUM */ -#define UART1_RTS_PIN (-1) /**< 0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ADC configuration - * - * These values configure which CC2538 pins and ADC channels to use for the ADC - * inputs. There pins are suggested as they can be changed, but note that only - * pins from PA can be configured as ADC. - * - * - ADC1: up to 3.3V. - * - ADC2: up to 3.3V. - * - ADC3: up to 3.3V. - * - ADC4: up to 3.3V. - * - ADC5: up to 3.3V. - * - ADC6: up to 3.3V, shared with user button. - * - * The internal ADC reference is 1190mV, use either a voltage divider as input, - * or a different voltage reference, like AVDD5 or other externally (AIN7 or - * AIN6). - * - * Warning: if using ADC6 (PA3), you will need to disable the bootloader by - * making FLASH_CCA_CONF_BOOTLDR_BACKDOOR equal to zero - * @{ - */ -#define ADC_SENSORS_PORT GPIO_A_NUM /**< ADC GPIO control port */ - -#ifndef ADC_SENSORS_CONF_ADC1_PIN -#define ADC_SENSORS_ADC1_PIN 5 /**< ADC1 to PA5 */ -#else -#if ((ADC_SENSORS_CONF_ADC1_PIN != -1) && (ADC_SENSORS_CONF_ADC1_PIN != 5)) -#error "ADC1 channel should be mapped to PA5 or disabled with -1" -#else -#define ADC_SENSORS_ADC1_PIN ADC_SENSORS_CONF_ADC1_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC2_PIN -#define ADC_SENSORS_ADC2_PIN 4 /**< ADC2 to PA4 */ -#else -#if ((ADC_SENSORS_CONF_ADC2_PIN != -1) && (ADC_SENSORS_CONF_ADC2_PIN != 4)) -#error "ADC2 channel should be mapped to PA4 or disabled with -1" -#else -#define ADC_SENSORS_ADC2_PIN ADC_SENSORS_CONF_ADC2_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC3_PIN -#define ADC_SENSORS_ADC3_PIN 2 /**< ADC3 to PA2 */ -#else -#if ((ADC_SENSORS_CONF_ADC3_PIN != -1) && (ADC_SENSORS_CONF_ADC3_PIN != 2)) -#error "ADC3 channel should be mapped to PA2 or disabled with -1" -#else -#define ADC_SENSORS_ADC3_PIN ADC_SENSORS_CONF_ADC3_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC4_PIN -#define ADC_SENSORS_ADC4_PIN 6 /**< ADC4 to PA6 */ -#else -#if ((ADC_SENSORS_CONF_ADC4_PIN != -1) && (ADC_SENSORS_CONF_ADC4_PIN != 6)) -#error "ADC4 channel should be mapped to PA6 or disabled with -1" -#else -#define ADC_SENSORS_ADC4_PIN ADC_SENSORS_CONF_ADC4_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC5_PIN -#define ADC_SENSORS_ADC5_PIN 7 /**< ADC5 to PA7 */ -#else -#if ((ADC_SENSORS_CONF_ADC5_PIN != -1) && (ADC_SENSORS_CONF_ADC5_PIN != 7)) -#error "ADC5 channel should be mapped to PA7 or disabled with -1" -#else -#define ADC_SENSORS_ADC5_PIN ADC_SENSORS_CONF_ADC5_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC6_PIN -#define ADC_SENSORS_ADC6_PIN (-1) /**< ADC6 not declared */ -#else -#define ADC_SENSORS_ADC6_PIN 3 /**< Hard-coded to PA3 */ -#endif - -#ifndef ADC_SENSORS_CONF_MAX -#define ADC_SENSORS_MAX 5 /**< Maximum sensors */ -#else -#define ADC_SENSORS_MAX ADC_SENSORS_CONF_MAX -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Firefly Button configuration - * - * Buttons on the Firefly are connected as follows: - * - BUTTON_USER -> PA3, S1 user button, shared with bootloader - * - BUTTON_RESET -> RESET_N line - * @{ - */ -/** BUTTON_USER -> PA3 */ -#define BUTTON_USER_PORT GPIO_A_NUM -#define BUTTON_USER_PIN 3 -#define BUTTON_USER_VECTOR GPIO_A_IRQn - -/* Notify various examples that we have an user button. - * If ADC6 channel is used, then disable the user button - */ -#ifdef PLATFORM_CONF_WITH_BUTTON -#if (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) -#error "The ADC6 (PA3) and user button cannot be enabled at the same time" -#else -#define PLATFORM_HAS_BUTTON (PLATFORM_CONF_WITH_BUTTON && \ - !(ADC_SENSORS_ADC6_PIN == 3)) -#endif /* (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) */ -#else -#define PLATFORM_HAS_BUTTON !(ADC_SENSORS_ADC6_PIN == 3) -#endif /* PLATFORM_CONF_WITH_BUTTON */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI0) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI0) lines, - * reserved exclusively for the CC1200 RF transceiver. These pins are exposed - * to the JP3 connector. To disable the CC1200 and use these pins, just - * remove the R10 resistor (0 ohm), which powers both the CC2538 and CC1200 to - * only power the SoC. - * TX -> MOSI, RX -> MISO - * @{ - */ -#define SPI0_CLK_PORT GPIO_B_NUM -#define SPI0_CLK_PIN 2 -#define SPI0_TX_PORT GPIO_B_NUM -#define SPI0_TX_PIN 1 -#define SPI0_RX_PORT GPIO_B_NUM -#define SPI0_RX_PIN 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI1) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI1) lines, - * exposed over JP3 connector. - * TX -> MOSI, RX -> MISO - * @{ - */ -#define SPI1_CLK_PORT GPIO_D_NUM -#define SPI1_CLK_PIN 0 -#define SPI1_TX_PORT GPIO_C_NUM -#define SPI1_TX_PIN 6 -#define SPI1_RX_PORT GPIO_D_NUM -#define SPI1_RX_PIN 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name I2C configuration - * - * These values configure which CC2538 pins to use for the I2C lines, exposed - * over JP3 connector. - * @{ - */ -#define I2C_SCL_PORT GPIO_C_NUM -#define I2C_SCL_PIN 3 -#define I2C_SDA_PORT GPIO_C_NUM -#define I2C_SDA_PIN 2 -#define I2C_INT_PORT GPIO_D_NUM -#define I2C_INT_PIN 1 -#define I2C_INT_VECTOR GPIO_D_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Dual RF interface support - * - * Enables support for dual band operation (both CC1200 and 2.4GHz enabled). - * Unlike the RE-Mote, the Firefly doesn't have a RF switch, so both interfaces - * should be always enabled if the R10 resistor is mounted. If only using the - * 2.4GHz RF interface, the resistor can be removed to power-off the CC1200. - * @{ - */ -#define REMOTE_DUAL_RF_ENABLED 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name CC1200 configuration - * - * These values configure the required pins to drive the CC1200 - * None of the following pins are exposed to any connector, kept for internal - * use only - * @{ - */ -#define CC1200_SPI_INSTANCE 0 -#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT -#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN -#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT -#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN -#define CC1200_SPI_MISO_PORT SPI0_RX_PORT -#define CC1200_SPI_MISO_PIN SPI0_RX_PIN -#define CC1200_SPI_CSN_PORT GPIO_B_NUM -#define CC1200_SPI_CSN_PIN 5 -#define CC1200_GDO0_PORT GPIO_B_NUM -#define CC1200_GDO0_PIN 4 -#define CC1200_GDO2_PORT GPIO_B_NUM -#define CC1200_GDO2_PIN 0 -#define CC1200_RESET_PORT GPIO_C_NUM -#define CC1200_RESET_PIN 7 -#define CC1200_GPIOx_VECTOR GPIO_B_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "Zolertia Firefly revision A platform" -/** @} */ - -#endif /* BOARD_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/firefly/Makefile.firefly b/arch/platform/zoul/firefly/Makefile.firefly deleted file mode 100644 index bfbcb03fb..000000000 --- a/arch/platform/zoul/firefly/Makefile.firefly +++ /dev/null @@ -1,2 +0,0 @@ -MOTELIST_ZOLERTIA := Firefly -BOARD_SOURCEFILES += board.c diff --git a/arch/platform/zoul/firefly/board.c b/arch/platform/zoul/firefly/board.c deleted file mode 100644 index 1824e43ba..000000000 --- a/arch/platform/zoul/firefly/board.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup firefly - * @{ - * - * \file - * Board-initialisation for the Zolertia's Firefly platform - * - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include -#include -/*---------------------------------------------------------------------------*/ -static void -configure_unused_pins(void) -{ - /* FIXME */ -} -/*---------------------------------------------------------------------------*/ -void -board_init() -{ - configure_unused_pins(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ - diff --git a/arch/platform/zoul/firefly/board.h b/arch/platform/zoul/firefly/board.h deleted file mode 100644 index 0367ea8df..000000000 --- a/arch/platform/zoul/firefly/board.h +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2015, Zolertia - * 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. - */ -/** - * \addtogroup zoul-platforms - * @{ - * - * \defgroup firefly Firefly platform - * - * The Zolertia Firefly is the most down-to-core development platform, exposing - * the Zoul core functionalities and features, with a slick design to allow a - * flexible and easier user experience. - * - * Defines related to the Firefly platform: a Zoul-based breakout board - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * This file can be used as the basis to configure other platforms using the - * cc2538 SoC. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the Zolertia's - * Firefly platform, Zoul-based - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -#ifndef BOARD_H_ -#define BOARD_H_ - -#include "dev/gpio.h" -#include "dev/nvic.h" -/*---------------------------------------------------------------------------*/ -/** \name Connector headers - * - * The Firefly features two 2.54 mm header rows over which exposes the following - * pins (facing up, Zolertia logo above and Micro-USB connector below): - * -----------------------------+---+---+-------------------------------------- - * PIN_NAME |JP3|JP2| PIN_NAME - * -----------------------------+---+---+-------------------------------------- - * PB5/CC1200.CS |-01|01-| LED1/PD5 - * PB2/SPI0.SCLK/CC1200.SCLK |-02|02-| LED2/PD4 - * PB1/SPIO0.MOSI/CC1200.MOSI |-03|03-| LED3/PD3 - * PB3/SPIO0.MISO/CC1200.MISO |-04|04-| PD2 - * PB3/CC1200.GPIO0 |-05|05-| PD1 - * PC0/UART1.TX |-06|06-| PD0 - * PC1/UART1.RX |-07|07-| AIN7/PA7 - * PC2/I2C.SDA |-08|08-| AIN6/PA6 - * PC3/I2C.SCL |-09|09-| ADC1/AIN5/PA5 - * PC4/SPI1.SCLK |-10|10-| ADC2/AIN4/PA4 - * PC5/SPI1.MOSI |-11|11-| BUTTON.USER/PA3 - * PC6/SPI1.MISO |-12|12-| ADC3/AIN2/PA2 - * USB.D+ |-13|13-| DGND - * USB.D- |-14|14-| D+3.3 - * ---------------------------+-+---+---+-+------------------------------------ - */ -/*---------------------------------------------------------------------------*/ -/** \name Firefly LED configuration - * - * LEDs on the Firefly are connected as follows: - * - LED1 (Red) -> PD5 - * - LED2 (Green) -> PD4 - * - LED3 (Blue) -> PD3 - * - * LED1 pin exposed in JP2 connector - * LED2 pin exposed in JP2 connector - * LED3 pin exposed in JP2 connector - * @{ - */ -/*---------------------------------------------------------------------------*/ -#define LEDS_ARCH_L1_PORT GPIO_D_NUM -#define LEDS_ARCH_L1_PIN 5 -#define LEDS_ARCH_L2_PORT GPIO_D_NUM -#define LEDS_ARCH_L2_PIN 4 -#define LEDS_ARCH_L3_PORT GPIO_D_NUM -#define LEDS_ARCH_L3_PIN 3 - -#define LEDS_CONF_RED 1 -#define LEDS_CONF_GREEN 2 -#define LEDS_CONF_BLUE 4 - -#define LEDS_CONF_COUNT 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name USB configuration - * - * The USB pullup is to be enabled by an external resistor, as it is not mapped - * to a GPIO. - */ -#ifdef USB_PULLUP_PORT -#undef USB_PULLUP_PORT -#endif -#ifdef USB_PULLUP_PIN -#undef USB_PULLUP_PIN -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART configuration - * - * On the Firefly, the UARTs are connected to the following ports/pins: - * - * - UART0: - * - RX: PA0, connected to CP2104 serial-to-usb converter TX pin - * - TX: PA1, connected to CP2104 serial-to-usb converter RX pin - * - UART1: - * - RX: PC1 - * - TX: PC0 - * - CTS: not used, one suggestion however is to use PD1 - * - RTS: not used, one suggestion however is to use PD0 - * - * We configure the port to use UART0 and UART1, CTS/RTS only for UART1, - * both without a HW pull-up resistor. - * UART0 is not exposed anywhere, UART1 pins are exposed over the JP3 connector. - * @{ - */ -#define UART0_RX_PORT GPIO_A_NUM -#define UART0_RX_PIN 0 -#define UART0_TX_PORT GPIO_A_NUM -#define UART0_TX_PIN 1 - -#define UART1_RX_PORT GPIO_C_NUM -#define UART1_RX_PIN 1 -#define UART1_TX_PORT GPIO_C_NUM -#define UART1_TX_PIN 0 -#define UART1_CTS_PORT (-1) /**< GPIO_D_NUM */ -#define UART1_CTS_PIN (-1) /**< 1 */ -#define UART1_RTS_PORT (-1) /**< GPIO_D_NUM */ -#define UART1_RTS_PIN (-1) /**< 0 */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ADC configuration - * - * These values configure which CC2538 pins and ADC channels to use for the ADC - * inputs. There pins are suggested as they can be changed, but note that only - * pins from PA can be configured as ADC. - * - * - ADC1: up to 3.3V. - * - ADC2: up to 3.3V. - * - ADC3: up to 3.3V. - * - ADC4: up to 3.3V. - * - ADC5: up to 3.3V. - * - ADC6: up to 3.3V, shared with user button. - * - * Only ADC1 and ADC3 are enabled as default. - * - * The internal ADC reference is 1190mV, use either a voltage divider as input, - * or a different voltage reference, like AVDD5 or other externally (AIN7 or - * AIN6). - * @{ - */ -#define ADC_SENSORS_PORT GPIO_A_NUM /**< ADC GPIO control port */ - -#ifndef ADC_SENSORS_CONF_ADC1_PIN -#define ADC_SENSORS_ADC1_PIN 5 /**< ADC1 to PA5 */ -#else -#if ((ADC_SENSORS_CONF_ADC1_PIN != -1) && (ADC_SENSORS_CONF_ADC1_PIN != 5)) -#error "ADC1 channel should be mapped to PA5 or disabled with -1" -#else -#define ADC_SENSORS_ADC1_PIN ADC_SENSORS_CONF_ADC1_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC2_PIN -#define ADC_SENSORS_ADC2_PIN 4 /**< ADC2 to PA4 */ -#else -#if ((ADC_SENSORS_CONF_ADC2_PIN != -1) && (ADC_SENSORS_CONF_ADC2_PIN != 4)) -#error "ADC2 channel should be mapped to PA4 or disabled with -1" -#else -#define ADC_SENSORS_ADC2_PIN ADC_SENSORS_CONF_ADC2_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC3_PIN -#define ADC_SENSORS_ADC3_PIN 2 /**< ADC3 to PA2 */ -#else -#if ((ADC_SENSORS_CONF_ADC3_PIN != -1) && (ADC_SENSORS_CONF_ADC3_PIN != 2)) -#error "ADC3 channel should be mapped to PA2 or disabled with -1" -#else -#define ADC_SENSORS_ADC3_PIN ADC_SENSORS_CONF_ADC3_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC4_PIN -#define ADC_SENSORS_ADC4_PIN 6 /**< ADC4 to PA6 */ -#else -#if ((ADC_SENSORS_CONF_ADC4_PIN != -1) && (ADC_SENSORS_CONF_ADC4_PIN != 6)) -#error "ADC4 channel should be mapped to PA6 or disabled with -1" -#else -#define ADC_SENSORS_ADC4_PIN ADC_SENSORS_CONF_ADC4_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC5_PIN -#define ADC_SENSORS_ADC5_PIN 7 /**< ADC5 to PA7 */ -#else -#if ((ADC_SENSORS_CONF_ADC5_PIN != -1) && (ADC_SENSORS_CONF_ADC5_PIN != 7)) -#error "ADC5 channel should be mapped to PA7 or disabled with -1" -#else -#define ADC_SENSORS_ADC5_PIN ADC_SENSORS_CONF_ADC5_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC6_PIN -#define ADC_SENSORS_ADC6_PIN (-1) /**< ADC6 not declared */ -#else -#define ADC_SENSORS_ADC6_PIN 3 /**< Hard-coded to PA3 */ -#endif - -#ifndef ADC_SENSORS_CONF_MAX -#define ADC_SENSORS_MAX 5 /**< Maximum sensors */ -#else -#define ADC_SENSORS_MAX ADC_SENSORS_CONF_MAX -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Firefly Button configuration - * - * Buttons on the Firefly are connected as follows: - * - BUTTON_USER -> PA3, S1 user button, shared with bootloader - * - BUTTON_RESET -> RESET_N line - * @{ - */ -/** BUTTON_USER -> PA3 */ -#define BUTTON_USER_PORT GPIO_A_NUM -#define BUTTON_USER_PIN 3 -#define BUTTON_USER_VECTOR GPIO_A_IRQn - -/* Notify various examples that we have an user button. - * If ADC6 channel is used, then disable the user button - */ -#ifdef PLATFORM_CONF_WITH_BUTTON -#if (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) -#error "The ADC6 (PA3) and user button cannot be enabled at the same time" -#else -#define PLATFORM_HAS_BUTTON (PLATFORM_CONF_WITH_BUTTON && \ - !(ADC_SENSORS_ADC6_PIN == 3)) -#endif /* (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) */ -#else -#define PLATFORM_HAS_BUTTON !(ADC_SENSORS_ADC6_PIN == 3) -#endif /* PLATFORM_CONF_WITH_BUTTON */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI0) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI0) lines, - * reserved exclusively for the CC1200 RF transceiver. These pins are exposed - * to the JP3 connector. To disable the CC1200 and use these pins, just - * remove the R10 resistor (0 ohm), which powers both the CC2538 and CC1200 to - * only power the SoC. - * TX -> MOSI, RX -> MISO - * @{ - */ -#define SPI0_CLK_PORT GPIO_B_NUM -#define SPI0_CLK_PIN 2 -#define SPI0_TX_PORT GPIO_B_NUM -#define SPI0_TX_PIN 1 -#define SPI0_RX_PORT GPIO_B_NUM -#define SPI0_RX_PIN 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI1) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI1) lines, - * exposed over JP3 connector. - * TX -> MOSI, RX -> MISO - * @{ - */ -#define SPI1_CLK_PORT GPIO_C_NUM -#define SPI1_CLK_PIN 4 -#define SPI1_TX_PORT GPIO_C_NUM -#define SPI1_TX_PIN 5 -#define SPI1_RX_PORT GPIO_C_NUM -#define SPI1_RX_PIN 6 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name I2C configuration - * - * These values configure which CC2538 pins to use for the I2C lines, exposed - * over JP3 connector. - * @{ - */ -#define I2C_SCL_PORT GPIO_C_NUM -#define I2C_SCL_PIN 3 -#define I2C_SDA_PORT GPIO_C_NUM -#define I2C_SDA_PIN 2 -#define I2C_INT_PORT GPIO_D_NUM -#define I2C_INT_PIN 1 -#define I2C_INT_VECTOR GPIO_D_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Dual RF interface support - * - * Enables support for dual band operation (both CC1200 and 2.4GHz enabled). - * Unlike the RE-Mote, the Firefly doesn't have a RF switch, so both interfaces - * should be always enabled if the R10 resistor is mounted. If only using the - * 2.4GHz RF interface, the resistor can be removed to power-off the CC1200. - * @{ - */ -#define REMOTE_DUAL_RF_ENABLED 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name CC1200 configuration - * - * These values configure the required pins to drive the CC1200 - * None of the following pins are exposed to any connector, kept for internal - * use only - * @{ - */ -#define CC1200_SPI_INSTANCE 0 -#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT -#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN -#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT -#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN -#define CC1200_SPI_MISO_PORT SPI0_RX_PORT -#define CC1200_SPI_MISO_PIN SPI0_RX_PIN -#define CC1200_SPI_CSN_PORT GPIO_B_NUM -#define CC1200_SPI_CSN_PIN 5 -#define CC1200_GDO0_PORT GPIO_B_NUM -#define CC1200_GDO0_PIN 4 -#define CC1200_GDO2_PORT GPIO_B_NUM -#define CC1200_GDO2_PIN 0 -#define CC1200_RESET_PORT GPIO_C_NUM -#define CC1200_RESET_PIN 7 -#define CC1200_GPIOx_VECTOR GPIO_B_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "Zolertia Firefly platform" -/** @} */ - -#endif /* BOARD_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/fs/fat/diskio.c b/arch/platform/zoul/fs/fat/diskio.c deleted file mode 100644 index f0b457ca8..000000000 --- a/arch/platform/zoul/fs/fat/diskio.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup remote-fat - * @{ - * - * \file - * Implementation of the default port of FatFs on RE-Mote. - */ -#include "diskio.h" -#include "mmc.h" -#include "rtcc.h" - -/*----------------------------------------------------------------------------*/ -DSTATUS __attribute__((__weak__)) -disk_status(BYTE pdrv) -{ - return ~mmc_driver.status(pdrv); -} -/*----------------------------------------------------------------------------*/ -DSTATUS __attribute__((__weak__)) -disk_initialize(BYTE pdrv) -{ - return ~mmc_driver.initialize(pdrv); -} -/*----------------------------------------------------------------------------*/ -DRESULT __attribute__((__weak__)) -disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count) -{ - return mmc_driver.read(pdrv, buff, sector, count); -} -/*----------------------------------------------------------------------------*/ -DRESULT __attribute__((__weak__)) -disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count) -{ - return mmc_driver.write(pdrv, buff, sector, count); -} -/*----------------------------------------------------------------------------*/ -DRESULT __attribute__((__weak__)) -disk_ioctl(BYTE pdrv, BYTE cmd, void *buff) -{ - return mmc_driver.ioctl(pdrv, cmd, buff); -} -/*----------------------------------------------------------------------------*/ -DWORD __attribute__((__weak__)) -get_fattime(void) -{ - simple_td_map td; - - return rtcc_get_time_date(&td) == AB08_SUCCESS ? - (2000 + td.years - 1980) << 25 | td.months << 21 | td.day << 16 | - td.hours << 11 | td.minutes << 5 | td.seconds : 0; -} -/*----------------------------------------------------------------------------*/ - -/** @} */ diff --git a/arch/platform/zoul/fs/fat/ffconf.h b/arch/platform/zoul/fs/fat/ffconf.h deleted file mode 100644 index cb4dca086..000000000 --- a/arch/platform/zoul/fs/fat/ffconf.h +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * All rights reserved. - * - * Based on the FatFs Module, - * Copyright (c) 2016, ChaN - * 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. - */ -/** - * \addtogroup zoul - * @{ - * - * \defgroup remote-fat RE-Mote FatFs - * - * Default port of FatFs on RE-Mote. - * @{ - * - * \file - * Header file configuring FatFs for RE-Mote. - */ -#ifndef FFCONF_H_ -#define FFCONF_H_ - -#include "contiki.h" - -#define _FFCONF 68020 /**< Revision ID */ - -/*----------------------------------------------------------------------------*/ -/** \name Function Configuration - * @{ - */ - -#ifndef _FS_READONLY -/** This option switches the read-only configuration - * (\c 0: read/write or \c 1: read-only). - * - * The read-only configuration removes the writing functions from the API: - * \c f_write(), \c f_sync(), \c f_unlink(), \c f_mkdir(), \c f_chmod(), - * \c f_rename(), \c f_truncate(), \c f_getfree(), and optional writing - * functions as well. - */ -#define _FS_READONLY 0 -#endif - -#ifndef _FS_MINIMIZE -/** This option defines the minimization level to remove some basic API - * functions. - * - * \c 0: All the basic functions are enabled. - * \c 1: \c f_stat(), \c f_getfree(), \c f_unlink(), \c f_mkdir(), - * \c f_truncate(), and \c f_rename() are removed. - * \c 2: \c f_opendir(), \c f_readdir(), and \c f_closedir() are removed in - * addition to \c 1. - * \c 3: \c f_lseek() is removed in addition to \c 2. - */ -#define _FS_MINIMIZE 0 -#endif - -#ifndef _USE_STRFUNC -/** This option switches the string functions: \c f_gets(), \c f_putc(), - * \c f_puts(), and \c f_printf(). - * - * \c 0: Disable string functions. - * \c 1: Enable without LF-CRLF conversion. - * \c 2: Enable with LF-CRLF conversion. - */ -#define _USE_STRFUNC 1 -#endif - -#ifndef _USE_FIND -/** This option switches the filtered directory read functions: \c f_findfirst() - * and \c f_findnext() (\c 0: disable, \c 1: enable, \c 2: enable with matching - * \c altname[] too). - */ -#define _USE_FIND 1 -#endif - -#ifndef _USE_MKFS -/** This option switches the \c f_mkfs() function - * (\c 0: disable or \c 1: enable). - */ -#define _USE_MKFS 1 -#endif - -#ifndef _USE_FASTSEEK -/** This option switches the fast seek function - * (\c 0: disable or \c 1: enable). - */ -#define _USE_FASTSEEK 0 -#endif - -#ifndef _USE_EXPAND -/** This option switches the \c f_expand() function - * (\c 0: disable or \c 1: enable). - */ -#define _USE_EXPAND 0 -#endif - -#ifndef _USE_CHMOD -/** This option switches the attribute manipulation functions: \c f_chmod() and - * \c f_utime() (\c 0: disable or \c 1: enable). Also, \c _FS_READONLY needs to - * be \c 0 to enable this option. - */ -#define _USE_CHMOD 1 -#endif - -#ifndef _USE_LABEL -/** This option switches the volume label functions: \c f_getlabel() and - * \c f_setlabel() (\c 0: disable or \c 1: enable). - */ -#define _USE_LABEL 1 -#endif - -#ifndef _USE_FORWARD -/** This option switches the \c f_forward() function - * (\c 0: disable or \c 1: enable). - */ -#define _USE_FORWARD 0 -#endif - -/** @} */ -/*----------------------------------------------------------------------------*/ -/** \name Locale and Namespace Configuration - * @{ - */ - -#ifndef _CODE_PAGE -/** This option specifies the OEM code page to be used on the target system. - * Incorrect setting of the code page can cause a file open failure. - * - * \c 1 - ASCII (no extended character, non-LFN cfg. only) - * \c 437 - U.S. - * \c 720 - Arabic - * \c 737 - Greek - * \c 771 - KBL - * \c 775 - Baltic - * \c 850 - Latin 1 - * \c 852 - Latin 2 - * \c 855 - Cyrillic - * \c 857 - Turkish - * \c 860 - Portuguese - * \c 861 - Icelandic - * \c 862 - Hebrew - * \c 863 - Canadian French - * \c 864 - Arabic - * \c 865 - Nordic - * \c 866 - Russian - * \c 869 - Greek 2 - * \c 932 - Japanese (DBCS) - * \c 936 - Simplified Chinese (DBCS) - * \c 949 - Korean (DBCS) - * \c 950 - Traditional Chinese (DBCS) - */ -#define _CODE_PAGE 437 -#endif - -#ifndef _USE_LFN -/** \c _USE_LFN switches the support of long file name (LFN). - * - * \c 0: Disable LFN support. \c _MAX_LFN has no effect. - * \c 1: Enable LFN with static working buffer on the BSS. Always thread-unsafe. - * \c 2: Enable LFN with dynamic working buffer on the STACK. - * \c 3: Enable LFN with dynamic working buffer on the HEAP. - * - * To enable LFN, the Unicode handling functions (option/unicode.c) - * must be added to the project. The working buffer occupies - * (_MAX_LFN + 1) * 2 bytes, and 608 more bytes with exFAT enabled. - * \c _MAX_LFN can be in the range from 12 to 255. It should be set to 255 to - * support the full-featured LFN operations. When using the stack for the - * working buffer, take care of stack overflow. When using the heap memory for - * the working buffer, the memory management functions, \c ff_memalloc() and - * \c ff_memfree(), must be added to the project. - */ -#define _USE_LFN 3 -#endif -#ifndef _MAX_LFN -#define _MAX_LFN 255 -#endif - -#ifndef _LFN_UNICODE -/** This option switches the character encoding in the API - * (\c 0: ANSI/OEM or \c 1: UTF-16). - * - * To use a Unicode string for the path name, enable LFN and set \c _LFN_UNICODE - * to \c 1. - * This option also affects the behavior of the string I/O functions. - */ -#define _LFN_UNICODE 0 -#endif - -#ifndef _STRF_ENCODE -/** If \c _LFN_UNICODE is set to \c 1, this option selects the character - * encoding OF THE FILE to be read/written via the string I/O functions: - * \c f_gets(), \c f_putc(), \c f_puts(), and \c f_printf(). - * - * \c 0: ANSI/OEM - * \c 1: UTF-16LE - * \c 2: UTF-16BE - * \c 3: UTF-8 - * - * This option has no effect if \c _LFN_UNICODE is set to \c 0. - */ -#define _STRF_ENCODE 0 -#endif - -#ifndef _FS_RPATH -/** This option configures the support of relative path. - * - * \c 0: Disable relative path and remove related functions. - * \c 1: Enable relative path. \c f_chdir() and \c f_chdrive() are available. - * \c 2: \c f_getcwd() is available in addition to \c 1. - */ -#define _FS_RPATH 2 -#endif - -/** @} */ -/*----------------------------------------------------------------------------*/ -/** \name Drive/Volume Configuration - * @{ - */ - -#ifndef _VOLUMES -/** Number of volumes (logical drives) to be used. */ -#define _VOLUMES 1 -#endif - -#ifndef _STR_VOLUME_ID -/** \c _STR_VOLUME_ID switches the string support of volume ID. - * If \c _STR_VOLUME_ID is set to \c 1, pre-defined strings can also be used as - * drive number in the path name. \c _VOLUME_STRS defines the drive ID strings - * for each logical drive. The number of items must be equal to \c _VOLUMES. - * The valid characters for the drive ID strings are: A-Z and 0-9. - */ -#define _STR_VOLUME_ID 0 -#endif -#ifndef _VOLUME_STRS -#define _VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3" -#endif - -#ifndef _MULTI_PARTITION -/** This option switches support of multi-partition on a physical drive. - * By default (0), each logical drive number is bound to the same physical drive - * number and only an FAT volume found on the physical drive will be mounted. - * When multi-partition is enabled (1), each logical drive number can be bound to - * arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() - * funciton will be available. - */ -#define _MULTI_PARTITION 0 -#endif - -#ifndef _MIN_SS -/** These options configure the range of sector size to be supported (512, 1024, - * 2048, or 4096). Always set both to 512 for most systems, all types of memory - * cards and harddisk. But a larger value may be required for on-board flash - * memory and some types of optical media. When \c _MAX_SS is larger than - * \c _MIN_SS, FatFs is configured to variable sector size and the - * \c GET_SECTOR_SIZE command must be implemented in \c disk_ioctl(). - */ -#define _MIN_SS 512 -#endif -#ifndef _MAX_SS -#define _MAX_SS 512 -#endif - -#ifndef _USE_TRIM -/** This option switches the support of ATA-TRIM - * (\c 0: disable or \c 1: enable). - * - * To enable the Trim function, the \c CTRL_TRIM command should also be - * implemented in \c disk_ioctl(). - */ -#define _USE_TRIM 0 -#endif - -#ifndef _FS_NOFSINFO -/** If you need to know the correct free space on the FAT32 volume, set the bit - * 0 of this option, and the \c f_getfree() function will force a full FAT scan - * on the first time after a volume mount. The bit 1 controls the use of the - * last allocated cluster number. - * - * bit 0=0: Use the free cluster count in FSINFO if available. - * bit 0=1: Do not trust the free cluster count in FSINFO. - * bit 1=0: Use the last allocated cluster number in FSINFO if available. - * bit 1=1: Do not trust the last allocated cluster number in FSINFO. - */ -#define _FS_NOFSINFO 3 -#endif - -/** @} */ -/*----------------------------------------------------------------------------*/ -/** \name System Configuration - * @{ - */ - -#ifndef _FS_TINY -/** This option switches the tiny buffer configuration - * (\c 0: normal or \c 1: tiny). - * - * With the tiny configuration, the size of a file object (FIL) is reduced to - * \c _MAX_SS bytes. Instead of the private sector buffer eliminated from the - * file object, a common sector buffer in the file system object (FATFS) is used - * for the file data transfer. - */ -#define _FS_TINY 0 -#endif - -#ifndef _FS_EXFAT -/** This option switches the support of the exFAT file system - * (\c 0: disable or \c 1: enable). - * - * With exFAT enabled, LFN also needs to be enabled (\c _USE_LFN >= 1). - * Note that enabling exFAT discards C89 compatibility. - */ -#define _FS_EXFAT 1 -#endif - -#ifndef _FS_NORTC -/** The option \c _FS_NORTC switches the timestamp function. If the system does - * not have any RTC function or if a valid timestamp is not needed, set - * \c _FS_NORTC to \c 1 to disable the timestamp function. All the objects - * modified by FatFs will have a fixed timestamp defined by \c _NORTC_MON, - * \c _NORTC_MDAY, and \c _NORTC_YEAR in local time. - * To enable the timestamp function (\c _FS_NORTC set to \c 0), \c get_fattime() - * needs to be added to the project to get the current time from a real-time - * clock. \c _NORTC_MON, \c _NORTC_MDAY, and \c _NORTC_YEAR have no effect. - * These options have no effect with a read-only configuration (\c _FS_READONLY - * set to \c 1). - */ -#define _FS_NORTC (!RTC_CONF_INIT) -#endif -#ifndef _NORTC_MON -#define _NORTC_MON 1 -#endif -#ifndef _NORTC_MDAY -#define _NORTC_MDAY 1 -#endif -#ifndef _NORTC_YEAR -#define _NORTC_YEAR 2016 -#endif - -#ifndef _FS_LOCK -/** The option \c _FS_LOCK switches the file lock function controlling duplicate - * file open and illegal operations on the open objects. This option must be set - * to \c 0 if \c _FS_READONLY is \c 1. - * - * \c 0: Disable the file lock function. To avoid volume corruption, the - * application program should avoid illegal open, remove, and rename on - * the open objects. - * \c >0: Enable the file lock function. The value defines how many - * files/sub-directories can be opened simultaneously under file lock - * control. Note that the file lock control is independent of - * re-entrancy. - */ -#define _FS_LOCK 0 -#endif - -#ifndef _FS_REENTRANT -/** The option \c _FS_REENTRANT switches the re-entrancy (thread-safe) of the - * FatFs module itself. Note that, regardless of this option, file access to - * different volumes is always re-entrant, and the volume control functions, - * \c f_mount(), \c f_mkfs(), and \c f_fdisk(), are always non-re-entrant. Only - * file/directory access to the same volume is under control of this function. - * - * \c 0: Disable re-entrancy. \c _FS_TIMEOUT and \c _SYNC_t have no effect. - * \c 1: Enable re-entrancy. The user-provided synchronization handlers, - * \c ff_req_grant(), \c ff_rel_grant(), \c ff_del_syncobj(), and - * \c ff_cre_syncobj(), must also be added to the project. Samples are - * available in option/syscall.c. - * - * \c _FS_TIMEOUT defines the timeout period in unit of time tick. - * \c _SYNC_t defines the OS-dependent sync object type, e.g. \c HANDLE, \c ID, - * \c OS_EVENT*, \c SemaphoreHandle_t, etc. A header file for the OS definitions - * needs to be included somewhere in the scope of ff.h. - */ -#define _FS_REENTRANT 0 -#endif -#ifndef _FS_TIMEOUT -#define _FS_TIMEOUT 1000 -#endif -#ifndef _SYNC_t -#define _SYNC_t HANDLE -#endif - -/** @} */ -/*----------------------------------------------------------------------------*/ - -#endif /* FFCONF_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/orion/Makefile.orion b/arch/platform/zoul/orion/Makefile.orion deleted file mode 100644 index b7313afc0..000000000 --- a/arch/platform/zoul/orion/Makefile.orion +++ /dev/null @@ -1,7 +0,0 @@ -MOTELIST_ZOLERTIA := Orion -MODULES += arch/dev/enc28j60 -CC2538_ENC28J60_ARCH ?= gpio -ifeq ($(WITH_IP64),1) -CFLAGS += -DUIP_FALLBACK_INTERFACE=ip64_uip_fallback_interface -endif -BOARD_SOURCEFILES += board.c enc28j60-arch-$(CC2538_ENC28J60_ARCH).c leds-arch.c diff --git a/arch/platform/zoul/orion/board.c b/arch/platform/zoul/orion/board.c deleted file mode 100644 index 2c137c562..000000000 --- a/arch/platform/zoul/orion/board.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2016, Zolertia - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zolertia-orion-ethernet-router - * @{ - * - * \file - * Board-initialisation for the Zolertia Orion Ethernet Router - * - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include -#include -/*---------------------------------------------------------------------------*/ -static void -configure_unused_pins(void) -{ - // FIXME -} -/*---------------------------------------------------------------------------*/ -void -board_init() -{ - configure_unused_pins(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ - diff --git a/arch/platform/zoul/orion/board.h b/arch/platform/zoul/orion/board.h deleted file mode 100644 index ee80cc709..000000000 --- a/arch/platform/zoul/orion/board.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2016, Zolertia - * 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. - */ -/** - * \addtogroup zoul-platforms - * @{ - * - * \defgroup zolertia-orion-ethernet-router Zolertia IoT Orion Ethernet Router - * - * The Zolertia Orion Router includes an Ethernet ENC28J60 controller with - * active POE (power over ethernet), operating over IPv4/IP64. It features a - * dual RF interface (2.4GHz and 863-950MHz) with external antenna connectors, - * a power on/off switch and programable user button. - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other peripherals - * - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the Zolertia's - * Orion Ethernet Router, Zoul-based - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -#ifndef BOARD_H_ -#define BOARD_H_ - -#include "dev/gpio.h" -#include "dev/nvic.h" -/*---------------------------------------------------------------------------*/ -/** \name Orion Ethernet Router LED configuration - * - * LEDs on the eth-gw are connected as follows: - * - LED1 (Red) -> PD5 - * - LED2 (Green) -> PD4 - * - LED3 (Blue) -> PD3 - * @{ - */ -/*---------------------------------------------------------------------------*/ -#define LEDS_ARCH_L1_PORT GPIO_D_NUM -#define LEDS_ARCH_L1_PIN 5 -#define LEDS_ARCH_L2_PORT GPIO_D_NUM -#define LEDS_ARCH_L2_PIN 4 -#define LEDS_ARCH_L3_PORT GPIO_D_NUM -#define LEDS_ARCH_L3_PIN 3 - -#define LEDS_CONF_RED 1 -#define LEDS_CONF_GREEN 2 -#define LEDS_CONF_BLUE 4 - -#define LEDS_CONF_COUNT 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name USB configuration - * - * The USB pullup for D+ is not included in this platform - */ -#ifdef USB_PULLUP_PORT -#undef USB_PULLUP_PORT -#endif -#ifdef USB_PULLUP_PIN -#undef USB_PULLUP_PIN -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART configuration - * - * On the eth-gw, the UARTs are connected to the following ports/pins: - * - * - UART0: - * - RX: PA0, connected to CP2104 serial-to-usb converter TX pin - * - TX: PA1, connected to CP2104 serial-to-usb converter RX pin - * - UART1: - * - RX: PC1 - * - TX: PC0 - * - CTS: not used - * - RTS: not used - * - * We configure the port to use UART0 and UART1, CTS/RTS only for UART1, - * both without a HW pull-up resistor. - * UART0 is not exposed anywhere, UART1 pins are exposed over the JP9 connector. - * @{ - */ -#define UART0_RX_PORT GPIO_A_NUM -#define UART0_RX_PIN 0 -#define UART0_TX_PORT GPIO_A_NUM -#define UART0_TX_PIN 1 - -#define UART1_RX_PORT GPIO_C_NUM -#define UART1_RX_PIN 1 -#define UART1_TX_PORT GPIO_C_NUM -#define UART1_TX_PIN 0 -#define UART1_CTS_PORT (-1) -#define UART1_CTS_PIN (-1) -#define UART1_RTS_PORT (-1) -#define UART1_RTS_PIN (-1) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name Zolertia Orion Router button configuration - * - * Buttons on the eth-gw are connected as follows: - * - BUTTON_USER -> PA3, S1 user button, shared with bootloader - * - BUTTON_RESET -> RESET_N line - * @{ - */ -/** BUTTON_USER -> PA3 */ -#define BUTTON_USER_PORT GPIO_A_NUM -#define BUTTON_USER_PIN 3 -#define BUTTON_USER_VECTOR GPIO_A_IRQn - -/* Notify various examples that we have Buttons */ -#define PLATFORM_HAS_BUTTON 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ADC configuration - * - * These values configure which CC2538 pins and ADC channels to use for the ADC - * inputs. There pins are suggested as they can be changed, but note that only - * pins from PA can be configured as ADC. - * - * The Zolertia eth-gw, as it is, only allows 3.3VDC sensors. - * - * The internal ADC reference is 1190mV, use either a voltage divider as input, - * or a different voltage reference, like AVDD5 or other externally (AIN7 or - * AIN6). - * - * The ADC1 is exposed over the JP9 connector - * @{ - */ -#define ADC_SENSORS_PORT GPIO_A_NUM /**< ADC GPIO control port */ -#define ADC_SENSORS_ADC1_PIN 2 /**< ADC1 to PA2, 3V3 */ -#define ADC_SENSORS_ADC2_PIN 4 /**< ADC2 to PA4, 3V3 */ -#define ADC_SENSORS_ADC3_PIN 5 /**< ADC3 to PA5, 3V3 */ -#define ADC_SENSORS_ADC4_PIN 6 /**< ADC4 to PA6, 3V3 */ -#define ADC_SENSORS_ADC5_PIN (-1) /**< Not used */ -#define ADC_SENSORS_ADC6_PIN (-1) /**< Not used */ -#define ADC_SENSORS_MAX 4 /**< PA2, PA4, PA5, PA6 */ - - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI0) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI0) lines, - * reserved exclusively for the CC1200 RF transceiver. - * TX -> MOSI, RX -> MISO - * @{ - */ -#define SPI0_CLK_PORT GPIO_B_NUM -#define SPI0_CLK_PIN 2 -#define SPI0_TX_PORT GPIO_B_NUM -#define SPI0_TX_PIN 1 -#define SPI0_RX_PORT GPIO_B_NUM -#define SPI0_RX_PIN 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI1) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI1) lines, - * reserved exclusively for the ENC28J60 ethernet module. These pins should not - * be used for other use, unless you really know what you are doing - * TX -> MOSI, RX -> MISO - * @{ - */ -#define SPI1_CLK_PORT GPIO_C_NUM -#define SPI1_CLK_PIN 4 -#define SPI1_TX_PORT GPIO_C_NUM -#define SPI1_TX_PIN 5 -#define SPI1_RX_PORT GPIO_C_NUM -#define SPI1_RX_PIN 6 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name I2C configuration - * - * As default there is not a default pin assignment for I2C, change this values - * accordingly if mapping either pin to the I2C controller. - * @{ - */ -#define I2C_SCL_PORT GPIO_C_NUM -#define I2C_SCL_PIN 3 -#define I2C_SDA_PORT GPIO_C_NUM -#define I2C_SDA_PIN 2 -#define I2C_INT_PORT GPIO_D_NUM -#define I2C_INT_PIN 2 -#define I2C_INT_VECTOR GPIO_D_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Dual RF interface support - * - * Enables support for dual band operation (both CC1200 and 2.4GHz enabled). - * @{ - */ -#define REMOTE_DUAL_RF_ENABLED 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name CC1200 configuration - * - * These values configure the required pins to drive the CC1200 - * None of the following pins are exposed to any connector, kept for internal - * use only - * @{ - */ -#define CC1200_SPI_INSTANCE 0 -#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT -#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN -#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT -#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN -#define CC1200_SPI_MISO_PORT SPI0_RX_PORT -#define CC1200_SPI_MISO_PIN SPI0_RX_PIN -#define CC1200_SPI_CSN_PORT GPIO_B_NUM -#define CC1200_SPI_CSN_PIN 5 -#define CC1200_GDO0_PORT GPIO_B_NUM -#define CC1200_GDO0_PIN 4 -#define CC1200_GDO2_PORT GPIO_B_NUM -#define CC1200_GDO2_PIN 0 -#define CC1200_RESET_PORT GPIO_C_NUM -#define CC1200_RESET_PIN 7 -#define CC1200_GPIOx_VECTOR GPIO_B_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Ethernet ENC28J60 configuration - * - * These values configure the required pins to drive an external Ethernet - * module. The implementation can be SPI or GPIO-based, for the first the SPI1 - * controller should be used - * @{ - */ -#define ETH_SPI_INSTANCE 1 -#define ETH_SPI_CLK_PORT SPI1_CLK_PORT -#define ETH_SPI_CLK_PIN SPI1_CLK_PIN -#define ETH_SPI_MOSI_PORT SPI1_TX_PORT -#define ETH_SPI_MOSI_PIN SPI1_TX_PIN -#define ETH_SPI_MISO_PORT SPI1_RX_PORT -#define ETH_SPI_MISO_PIN SPI1_RX_PIN -#define ETH_SPI_CSN_PORT GPIO_A_NUM -#define ETH_SPI_CSN_PIN 7 -#define ETH_INT_PORT GPIO_D_NUM -#define ETH_INT_PIN 0 -#define ETH_RESET_PORT GPIO_D_NUM -#define ETH_RESET_PIN 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name On-board external WDT - * The Orion Ethernet Router has an external WDT and battery monitor, which - * adds more robustness and prevents the mote to run wild if any unexpected - * problem shows-up. - * The external WDT requires a short pulse (<1ms) to be sent before a 2-second - * period. The battery monitor keeps the device in Reset if the voltage input - * is lower than 2.5V. - * @{ - */ -#define EXT_WDT_PORT GPIO_D_NUM -#define EXT_WDT_PIN 5 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "Zolertia Orion Ethernet Router" -/** @} */ - -#endif /* BOARD_H_ */ - -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/orion/enc28j60-arch-gpio.c b/arch/platform/zoul/orion/enc28j60-arch-gpio.c deleted file mode 100644 index 4a35e2723..000000000 --- a/arch/platform/zoul/orion/enc28j60-arch-gpio.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2012-2013, Thingsquare, http://www.thingsquare.com/. - * Copyright (c) 2016, Zolertia - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zolertia-orion-ethernet-router - * @{ - * - * \defgroup zolertia-eth-arch-gpio Zolertia ENC28J60 GPIO arch - * - * ENC28J60 eth-gw GPIO arch specifics - * @{ - * - * \file - * eth-gw GPIO arch specifics - */ -/*---------------------------------------------------------------------------*/ -#include "clock.h" -#include "dev/gpio.h" -/*---------------------------------------------------------------------------*/ -#define CLK_PORT GPIO_PORT_TO_BASE(ETH_SPI_CLK_PORT) -#define CLK_BIT GPIO_PIN_MASK(ETH_SPI_CLK_PIN) -#define MOSI_PORT GPIO_PORT_TO_BASE(ETH_SPI_MOSI_PORT) -#define MOSI_BIT GPIO_PIN_MASK(ETH_SPI_MOSI_PIN) -#define MISO_PORT GPIO_PORT_TO_BASE(ETH_SPI_MISO_PORT) -#define MISO_BIT GPIO_PIN_MASK(ETH_SPI_MISO_PIN) -#define CSN_PORT GPIO_PORT_TO_BASE(ETH_SPI_CSN_PORT) -#define CSN_BIT GPIO_PIN_MASK(ETH_SPI_CSN_PIN) -#define RESET_PORT GPIO_PORT_TO_BASE(ETH_RESET_PORT) -#define RESET_BIT GPIO_PIN_MASK(ETH_RESET_PIN) -/*---------------------------------------------------------------------------*/ -/* Delay in us */ -#define DELAY 10 -/*---------------------------------------------------------------------------*/ -static void -delay(void) -{ - clock_delay_usec(DELAY); -} -/*---------------------------------------------------------------------------*/ -void -enc28j60_arch_spi_select(void) -{ - GPIO_CLR_PIN(CSN_PORT, CSN_BIT); - delay(); -} -/*---------------------------------------------------------------------------*/ -void -enc28j60_arch_spi_deselect(void) -{ - GPIO_SET_PIN(CSN_PORT, CSN_BIT); -} -/*---------------------------------------------------------------------------*/ -void -enc28j60_arch_spi_init(void) -{ - /* Set all pins to GPIO mode */ - GPIO_SOFTWARE_CONTROL(CLK_PORT, CLK_BIT); - GPIO_SOFTWARE_CONTROL(MOSI_PORT, MOSI_BIT); - GPIO_SOFTWARE_CONTROL(MISO_PORT, MISO_BIT); - GPIO_SOFTWARE_CONTROL(CSN_PORT, CSN_BIT); - GPIO_SOFTWARE_CONTROL(RESET_PORT, RESET_BIT); - - /* CSN, MOSI, CLK and RESET are output pins */ - GPIO_SET_OUTPUT(CSN_PORT, CSN_BIT); - GPIO_SET_OUTPUT(MOSI_PORT, MOSI_BIT); - GPIO_SET_OUTPUT(CLK_PORT, CLK_BIT); - GPIO_SET_OUTPUT(RESET_PORT, RESET_BIT); - - /* MISO is an input pin */ - GPIO_SET_INPUT(MISO_PORT, MISO_BIT); - - /* Enable the device */ - GPIO_SET_INPUT(RESET_PORT, RESET_BIT); - - /* The CS pin is active low, so we set it high when we haven't - selected the chip. */ - enc28j60_arch_spi_deselect(); - - /* The CLK is active low, we set it high when we aren't using it. */ - GPIO_CLR_PIN(CLK_PORT, CLK_BIT); -} -/*---------------------------------------------------------------------------*/ -uint8_t -enc28j60_arch_spi_write(uint8_t output) -{ - int i; - uint8_t input; - input = 0; - - for(i=0; i < 8; i++) { - /* Write data on MOSI pin */ - if(output & 0x80) { - GPIO_SET_PIN(MOSI_PORT, MOSI_BIT); - } else { - GPIO_CLR_PIN(MOSI_PORT, MOSI_BIT); - } - output <<= 1; - - /* Set clock high */ - GPIO_SET_PIN(CLK_PORT, CLK_BIT); - delay(); - - /* Read data from MISO pin */ - input <<= 1; - if(GPIO_READ_PIN(MISO_PORT, MISO_BIT) != 0) { - input |= 0x1; - } - - /* Set clock low */ - GPIO_CLR_PIN(CLK_PORT, CLK_BIT); - delay(); - } - return input; -} -/*---------------------------------------------------------------------------*/ -uint8_t -enc28j60_arch_spi_read(void) -{ - return enc28j60_arch_spi_write(0); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/orion/enc28j60-arch-spi.c b/arch/platform/zoul/orion/enc28j60-arch-spi.c deleted file mode 100644 index bc9c9dadd..000000000 --- a/arch/platform/zoul/orion/enc28j60-arch-spi.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2014, CETIC. - * Copyright (c) 2016, Zolertia - * 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zolertia-orion-ethernet-router - * @{ - * - * \defgroup zolertia-eth-arch-spi Zolertia ENC28J60 SPI arch - * - * ENC28J60 eth-gw SPI arch specifics - * @{ - * - * \file - * eth-gw SPI arch specifics - */ -/*---------------------------------------------------------------------------*/ -#include "dev/spi-arch-legacy.h" -#include "dev/spi-legacy.h" -#include "dev/gpio.h" -/*---------------------------------------------------------------------------*/ -#define RESET_PORT GPIO_PORT_TO_BASE(ETH_RESET_PORT) -#define RESET_BIT GPIO_PIN_MASK(ETH_RESET_PIN) -/*---------------------------------------------------------------------------*/ -void -enc28j60_arch_spi_init(void) -{ - spix_init(ETH_SPI_INSTANCE); - spix_cs_init(ETH_SPI_CSN_PORT, ETH_SPI_CSN_PIN); - spix_set_mode(ETH_SPI_INSTANCE, SSI_CR0_FRF_MOTOROLA, 0, 0, 8); - GPIO_SOFTWARE_CONTROL(RESET_PORT, RESET_BIT); - GPIO_SET_OUTPUT(RESET_PORT, RESET_BIT); - GPIO_SET_INPUT(RESET_PORT, RESET_BIT); -} -/*---------------------------------------------------------------------------*/ -void -enc28j60_arch_spi_select(void) -{ - SPIX_CS_CLR(ETH_SPI_CSN_PORT, ETH_SPI_CSN_PIN); -} -/*---------------------------------------------------------------------------*/ -void -enc28j60_arch_spi_deselect(void) -{ - SPIX_CS_SET(ETH_SPI_CSN_PORT, ETH_SPI_CSN_PIN); -} -/*---------------------------------------------------------------------------*/ -void -enc28j60_arch_spi_write(uint8_t output) -{ - SPIX_WAITFORTxREADY(ETH_SPI_INSTANCE); - SPIX_BUF(ETH_SPI_INSTANCE) = output; - SPIX_WAITFOREOTx(ETH_SPI_INSTANCE); - SPIX_WAITFOREORx(ETH_SPI_INSTANCE); - uint32_t dummy = SPIX_BUF(ETH_SPI_INSTANCE); - (void) dummy; -} -/*---------------------------------------------------------------------------*/ -uint8_t -enc28j60_arch_spi_read(void) -{ - SPIX_WAITFORTxREADY(ETH_SPI_INSTANCE); - SPIX_BUF(ETH_SPI_INSTANCE) = 0; - SPIX_WAITFOREOTx(ETH_SPI_INSTANCE); - SPIX_WAITFOREORx(ETH_SPI_INSTANCE); - return SPIX_BUF(ETH_SPI_INSTANCE); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/arch/platform/zoul/orion/ip64-conf.h b/arch/platform/zoul/orion/ip64-conf.h deleted file mode 100644 index 5201ded4c..000000000 --- a/arch/platform/zoul/orion/ip64-conf.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * Copyright (c) 2016, Zolertia - * 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 IP64_CONF_H -#define IP64_CONF_H -/*---------------------------------------------------------------------------*/ -#include "ip64/ip64-eth-interface.h" -/*---------------------------------------------------------------------------*/ -#define IP64_CONF_UIP_FALLBACK_INTERFACE ip64_eth_interface -#define IP64_CONF_INPUT ip64_eth_interface_input -#include "enc28j60-ip64-driver.h" -#define IP64_CONF_ETH_DRIVER enc28j60_ip64_driver -/*---------------------------------------------------------------------------*/ -#endif /* IP64_CONF_H */ diff --git a/arch/platform/zoul/platform.c b/arch/platform/zoul/platform.c deleted file mode 100644 index 49158b5b4..000000000 --- a/arch/platform/zoul/platform.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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. - */ -/** - * \addtogroup zoul-core - * @{ - * - * \defgroup zoul Zolertia Zoul core module - * - * The Zoul comprises the CC2538SF53 and CC1200 in a single module - * format, which allows a fast reuse of its core components in different - * formats and form-factors. - * @{ - * - * \file - * Main module for the Zolertia Zoul core and based platforms - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/leds.h" -#include "dev/uart.h" -#include "dev/button-sensor.h" -#include "dev/serial-line.h" -#include "dev/slip.h" -#include "dev/cc2538-rf.h" -#include "dev/udma.h" -#include "dev/crypto.h" -#include "dev/rtcc.h" -#include "dev/button-hal.h" -#include "usb/usb-serial.h" -#include "lib/random.h" -#include "lib/sensors.h" -#include "net/netstack.h" -#include "net/mac/framer/frame802154.h" -#include "net/linkaddr.h" -#include "sys/platform.h" -#include "soc.h" -#include "cpu.h" -#include "reg.h" -#include "ieee-addr.h" -#include "lpm.h" - -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Zoul" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -/** - * \brief Board specific iniatialisation - */ -void board_init(void); -/*---------------------------------------------------------------------------*/ -static void -fade(leds_mask_t l) -{ - volatile int i; - int k, j; - for(k = 0; k < 800; ++k) { - j = k > 400 ? 800 - k : k; - - leds_on(l); - for(i = 0; i < j; ++i) { - __asm("nop"); - } - leds_off(l); - for(i = 0; i < 400 - j; ++i) { - __asm("nop"); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -rtc_init(void) -{ -#if RTC_CONF_INIT -#if RTC_CONF_SET_FROM_SYS - char *next; - simple_td_map td; -#endif - - /* Configure RTC and return structure with all parameters */ - rtcc_init(); - -#if RTC_CONF_SET_FROM_SYS -#ifndef DATE -#error Could not retrieve date from system -#endif - - /* Alternatively, for test only, undefine DATE and define it on your own as: - * #define DATE "07 06 12 15 16 00 00" - * Also note that if you restart the node at a given time, it will use the - * already defined DATE, so if you want to update the device date/time you - * need to reflash the node. - */ - - /* Get the system date in the following format: wd dd mm yy hh mm ss */ - LOG_INFO("Setting RTC from system date: %s\n", DATE); - - /* Configure the RTC with the current values */ - td.weekdays = (uint8_t)strtol(DATE, &next, 10); - td.day = (uint8_t)strtol(next, &next, 10); - td.months = (uint8_t)strtol(next, &next, 10); - td.years = (uint8_t)strtol(next, &next, 10); - td.hours = (uint8_t)strtol(next, &next, 10); - td.minutes = (uint8_t)strtol(next, &next, 10); - td.seconds = (uint8_t)strtol(next, NULL, 10); - - /* Don't care about the milliseconds... */ - td.miliseconds = 0; - - /* This example relies on 24h mode */ - td.mode = RTCC_24H_MODE; - - /* - * And to simplify the configuration, it relies on the fact that it will be - * executed in the present century - */ - td.century = RTCC_CENTURY_20XX; - - /* Set the time and date */ - if(rtcc_set_time_date(&td) == AB08_ERROR) { - LOG_ERR("Failed to set time and date\n"); - } -#endif -#endif -} -/*---------------------------------------------------------------------------*/ -static void -set_rf_params(void) -{ - uint16_t short_addr; - uint8_t ext_addr[8]; - - ieee_addr_cpy_to(ext_addr, 8); - - short_addr = ext_addr[7]; - short_addr |= ext_addr[6] << 8; - - NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID); - NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr); - NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, IEEE802154_DEFAULT_CHANNEL); - NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_one(void) -{ - soc_init(); - - leds_init(); - fade(LEDS_RED); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_two() -{ - /* - * Character I/O Initialisation. - * When the UART receives a character it will call serial_line_input_byte to - * notify the core. The same applies for the USB driver. - * - * If slip-arch is also linked in afterwards (e.g. if we are a border router) - * it will overwrite one of the two peripheral input callbacks. Characters - * received over the relevant peripheral will be handled by - * slip_input_byte instead - */ -#if UART_CONF_ENABLE - uart_init(0); - uart_init(1); - uart_set_input(SERIAL_LINE_CONF_UART, serial_line_input_byte); -#endif - -#if USB_SERIAL_CONF_ENABLE - usb_serial_init(); - usb_serial_set_input(serial_line_input_byte); -#endif - - serial_line_init(); - - /* Initialise the H/W RNG engine. */ - random_init(0); - - udma_init(); - -#if CRYPTO_CONF_INIT - crypto_init(); - crypto_disable(); -#endif - - /* Populate linkaddr_node_addr */ - ieee_addr_cpy_to(linkaddr_node_addr.u8, LINKADDR_SIZE); - -#if PLATFORM_HAS_BUTTON - button_hal_init(); -#endif - - INTERRUPTS_ENABLE(); - - fade(LEDS_BLUE); -} -/*---------------------------------------------------------------------------*/ -void -platform_init_stage_three() -{ - LOG_INFO("%s\n", BOARD_STRING); - - set_rf_params(); - - board_init(); - - rtc_init(); - - soc_print_info(); - - process_start(&sensors_process, NULL); - - fade(LEDS_GREEN); -} -/*---------------------------------------------------------------------------*/ -void -platform_idle() -{ - /* We have serviced all pending events. Enter a Low-Power mode. */ - lpm_enter(); -} -/*---------------------------------------------------------------------------*/ -unsigned -radio_phy_overhead(void) { - radio_value_t ret; - NETSTACK_RADIO.get_value(RADIO_CONST_PHY_OVERHEAD, &ret); - return (unsigned)ret; -} -/*---------------------------------------------------------------------------*/ -unsigned -radio_byte_air_time(void) { - radio_value_t ret; - NETSTACK_RADIO.get_value(RADIO_CONST_BYTE_AIR_TIME, &ret); - return (unsigned)ret; -} -/*---------------------------------------------------------------------------*/ -unsigned -radio_delay_before_tx(void) { - radio_value_t ret; - NETSTACK_RADIO.get_value(RADIO_CONST_DELAY_BEFORE_TX, &ret); - return (unsigned)ret; -} -/*---------------------------------------------------------------------------*/ -unsigned -radio_delay_before_rx(void) { - radio_value_t ret; - NETSTACK_RADIO.get_value(RADIO_CONST_DELAY_BEFORE_RX, &ret); - return (unsigned)ret; -} -/*---------------------------------------------------------------------------*/ -unsigned -radio_delay_before_detect(void) { - radio_value_t ret; - NETSTACK_RADIO.get_value(RADIO_CONST_DELAY_BEFORE_DETECT, &ret); - return (unsigned)ret; -} -/*---------------------------------------------------------------------------*/ -uint16_t * -radio_tsch_timeslot_timing(void) { - uint16_t *ret; - /* Get and return pointer to TSCH timings in usec */ - NETSTACK_RADIO.get_object(RADIO_CONST_TSCH_TIMING, &ret, sizeof(ret)); - return ret; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/remote-reva/Makefile.remote-reva b/arch/platform/zoul/remote-reva/Makefile.remote-reva deleted file mode 100644 index ec4095265..000000000 --- a/arch/platform/zoul/remote-reva/Makefile.remote-reva +++ /dev/null @@ -1,4 +0,0 @@ -MOTELIST_ZOLERTIA := RE-Mote -BOARD_SOURCEFILES += board.c antenna-sw.c mmc-arch.c rtcc.c power-mgmt.c - -MODULES += os/lib/fs/fat os/lib/fs/fat/option arch/platform/zoul/fs/fat arch/dev/disk/mmc diff --git a/arch/platform/zoul/remote-reva/board.c b/arch/platform/zoul/remote-reva/board.c deleted file mode 100644 index c412eaea0..000000000 --- a/arch/platform/zoul/remote-reva/board.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-reva - * @{ - * - * \file - * Board-initialisation for the Zolertia's RE-Mote revision A platform - * - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "antenna-sw.h" -#include -#include -/*---------------------------------------------------------------------------*/ -static void -configure_unused_pins(void) -{ - /* FIXME */ -} -/*---------------------------------------------------------------------------*/ -void -board_init() -{ - antenna_sw_config(); - configure_unused_pins(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ - diff --git a/arch/platform/zoul/remote-reva/board.h b/arch/platform/zoul/remote-reva/board.h deleted file mode 100644 index 23722badd..000000000 --- a/arch/platform/zoul/remote-reva/board.h +++ /dev/null @@ -1,488 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2015, Zolertia - * 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. - */ -/** - * \addtogroup zoul-platforms - * @{ - * - * \defgroup remote-reva RE-Mote platform revision A - * - * The RE-Mote was designed jointly with universities and industry partners in - * RERUM European project, to ease the development of private and secure - * applications for IoT and Smart City applications. The RE-Mote packs several - * on-board resources, like a RTC, external WDT, Micro-SD, RF switch and a - * Shutdown mode to reduce its power consumption down to 300nA. - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other RE-Mote revision A peripherals - * - * This file can be used as the basis to configure other platforms using the - * cc2538 SoC. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the Zolertia's - * RE-Mote platform (revision A), cc2538-based - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -#ifndef BOARD_H_ -#define BOARD_H_ - -#include "dev/gpio.h" -#include "dev/nvic.h" -/*---------------------------------------------------------------------------*/ -/** \name Connector headers - * - * The RE-Mote features two 2.54 mm header rows over which exposes the following - * pins (facing up, Zolertia/RERUM logo above, buttons and micro USB at bottom): - * ----------------------+---+---+--------------------------------------------- - * PIN_NAME |JP6|JP5| PIN_NAME - * ----------------------+---+---+--------------------------------------------- - * LED1/EXT_WDT/PD5 |-01|18-| PC6/SPI1.MISO/USD.MISO - * LED2/UART1.CTS/PD4 |-02|17-| PC5/SPI1.MOSI/USD.MOSI - * LED3/UART1.RTS/PD3 |-03|16-| PC4/SPI1.SCLK/USD.SCLK - * UART0.RX/PA0 |-04|15-| PA3/BUTTON.USER - * UART0.TX/PA1 |-05|14-| RESET/JTAG.RESET/BUTTON.RESET - * SHUTDOWN_ENABLE/PD1 |-06|13-| DGND - * RTC.SDA/I2C.SDA/PC2 |-07|12-| D+3.3 - * RTC.SCL/I2C.SCL/PC3 |-08|11-| PA5/AIN5/ADC1 - * DGND |-09|10-| PA4/RTC_INT1/AIN4/ADC2 - * D+3.3 |-10|09-| DGND - * USD.CS/AIN7/PA7 |-11|08-| D+5.1 - * SHUTDOWN_DONE/PD0 |-12|07-| PA2/AIN2/ADC3 - * UART1.RX/PC1 |-13|06-| JTAG.TMS - * UART1.TX/PC0 |-14|05-| JTAG.TCK - * DGND |-15|04-| PB7/JTAG.TDO - * D+3.3 |-16|03-| PB6/JTAG.TDI - * DGND |-17|02-| PS+EXT - * +VBAT |-18|01-| DGND - * ----------------------+---+---+--------------------------------------------- - */ -/*---------------------------------------------------------------------------*/ -/** \name RE-Mote LED configuration - * - * LEDs on the RE-Mote are connected as follows: - * - LED1 (Red) -> PD5 - * - LED2 (Green) -> PD4 - * - LED3 (Blue) -> PD3 - * - * LED1 pin shared with EXT_WDT and exposed in JP6 connector - * LED2 pin shared with UART1 CTS, pin exposed in JP6 connector - * LED3 pin shared with UART1 RTS, exposed in JP6 connector - * @{ - */ -/*---------------------------------------------------------------------------*/ -#define LEDS_ARCH_L1_PORT GPIO_D_NUM -#define LEDS_ARCH_L1_PIN 5 -#define LEDS_ARCH_L2_PORT GPIO_D_NUM -#define LEDS_ARCH_L2_PIN 4 -#define LEDS_ARCH_L3_PORT GPIO_D_NUM -#define LEDS_ARCH_L3_PIN 3 - -#define LEDS_CONF_RED 1 -#define LEDS_CONF_GREEN 2 -#define LEDS_CONF_BLUE 4 - -#define LEDS_CONF_COUNT 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name USB configuration - * - * The USB pullup is enabled by an external resistor, not mapped to a GPIO - */ -#ifdef USB_PULLUP_PORT -#undef USB_PULLUP_PORT -#endif -#ifdef USB_PULLUP_PIN -#undef USB_PULLUP_PIN -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART configuration - * - * On the RE-Mote, the UARTs are connected to the following ports/pins: - * - * - UART0: - * - RX: PA0, connected to CP2104 serial-to-usb converter TX pin - * - TX: PA1, connected to CP2104 serial-to-usb converter RX pin - * - UART1: - * - RX: PC1 - * - TX: PC0 - * - CTS: PD4, shared with LED2 (Green), disabled as default - * - RTS: PD3, shared with LED3 (Blue), disabled as default - * - * We configure the port to use UART0 and UART1, CTS/RTS only for UART1, - * both without a HW pull-up resistor - * UART0 and UART1 pins are exposed over the JP6 connector - * @{ - */ -#define UART0_RX_PORT GPIO_A_NUM -#define UART0_RX_PIN 0 -#define UART0_TX_PORT GPIO_A_NUM -#define UART0_TX_PIN 1 - -#define UART1_RX_PORT GPIO_C_NUM -#define UART1_RX_PIN 1 -#define UART1_TX_PORT GPIO_C_NUM -#define UART1_TX_PIN 0 -#define UART1_CTS_PORT (-1) -#define UART1_CTS_PIN (-1) -#define UART1_RTS_PORT (-1) -#define UART1_RTS_PIN (-1) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ADC configuration - * - * These values configure which CC2538 pins and ADC channels to use for the ADC - * inputs. By default the RE-Mote allows two out-of-the-box ADC ports with a - * phidget-like 3-pin connector (GND/VDD/ADC) - * - * The RE-Mote allows both 3.3V and 5V analogue sensors as follow: - * - * - ADC1: up to 3.3V. - * - ADC2: up to 3.3V, shared with RTC_INT - * - ADC3: up to 5V, by means of a 2/3 voltage divider. - * - * Also there are other ADC channels shared by default with Micro SD card and - * user button implementations: - * - ADC4: up to 3.3V. - * - ADC5: up to 3.3V. - * - ADC6: up to 3.3V. - * - * ADC inputs can only be on port A. - * All ADCx are exposed in JP5 connector, but only ADC1 and ADC3 have GND and - * VDD (3/5V) pins next to it, so these can be exposed into a 3-pin phidget-like - * connector, for ADC2 either solder a wire to connect, or use a 4-pin connector - * to expose both ADC1 and ADC2 in a single connector, but this will leave no - * space for a ADC3 connector. - * The internal ADC reference is 1190mV, use either a voltage divider as input, - * or a different voltage reference, like AVDD5 or other externally (AIN7), but - * note the PA7 is shared with the Micro-SD CSn pin, likewise for PA6 (AIN6) - * shared witht the Micro-SD select pin - * To use the ADC2 pin, remove the resistor on the Zoul's PA4 pin (JP1, pin 10) - * and enable below (replace -1 with 4). - * @{ - */ -#define ADC_SENSORS_PORT GPIO_A_NUM /**< ADC GPIO control port */ - -#ifndef ADC_SENSORS_CONF_ADC1_PIN -#define ADC_SENSORS_ADC1_PIN 5 /**< ADC1 to PA5, 3V3 */ -#else -#if ((ADC_SENSORS_CONF_ADC1_PIN != -1) && (ADC_SENSORS_CONF_ADC1_PIN != 5)) -#error "ADC1 channel should be mapped to PA5 or disabled with -1" -#else -#define ADC_SENSORS_ADC1_PIN ADC_SENSORS_CONF_ADC1_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC3_PIN -#define ADC_SENSORS_ADC3_PIN 2 /**< ADC3 to PA2, 5V */ -#else -#if ((ADC_SENSORS_CONF_ADC3_PIN != -1) && (ADC_SENSORS_CONF_ADC3_PIN != 2)) -#error "ADC3 channel should be mapped to PA2 or disabled with -1" -#else -#define ADC_SENSORS_ADC3_PIN ADC_SENSORS_CONF_ADC3_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC2_PIN -#define ADC_SENSORS_ADC2_PIN (-1) /**< ADC2 no declared */ -#else -#define ADC_SENSORS_ADC2_PIN 4 /**< Hard-coded to PA4 */ -#endif - -#ifndef ADC_SENSORS_CONF_ADC4_PIN -#define ADC_SENSORS_ADC4_PIN (-1) /**< ADC4 not declared */ -#else -#define ADC_SENSORS_ADC4_PIN 6 /**< Hard-coded to PA6 */ -#endif - -#ifndef ADC_SENSORS_CONF_ADC5_PIN -#define ADC_SENSORS_ADC5_PIN (-1) /**< ADC5 not declared */ -#else -#define ADC_SENSORS_ADC5_PIN 7 /**< Hard-coded to PA7 */ -#endif - -#ifndef ADC_SENSORS_CONF_ADC6_PIN -#define ADC_SENSORS_ADC6_PIN (-1) /**< ADC6 not declared */ -#else -#define ADC_SENSORS_ADC6_PIN 3 /**< Hard-coded to PA3 */ -#endif - -#ifndef ADC_SENSORS_CONF_MAX -#define ADC_SENSORS_MAX 2 /**< Maximum sensors */ -#else -#define ADC_SENSORS_MAX ADC_SENSORS_CONF_MAX -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RE-Mote Button configuration - * - * Buttons on the RE-Mote are connected as follows: - * - BUTTON_USER -> PA3, S1 user button, shared with bootloader and RTC_INT1 - * - BUTTON_RESET -> RESET_N line, S2 reset both CC2538 and CoP - * - BUTTON_PIC1W -> shared with SHUTDOWN_ENABLE, not mounted. - * @{ - */ -/** BUTTON_USER -> PA3 */ -#define BUTTON_USER_PORT GPIO_A_NUM -#define BUTTON_USER_PIN 3 -#define BUTTON_USER_VECTOR GPIO_A_IRQn - -/* Notify various examples that we have an user button. - * If ADC6 channel is used, then disable the user button - */ -#ifdef PLATFORM_CONF_WITH_BUTTON -#if (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) -#error "The ADC6 (PA3) and user button cannot be enabled at the same time" -#else -#define PLATFORM_HAS_BUTTON (PLATFORM_CONF_WITH_BUTTON && \ - !(ADC_SENSORS_ADC6_PIN == 3)) -#endif /* (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) */ -#else -#define PLATFORM_HAS_BUTTON !(ADC_SENSORS_ADC6_PIN == 3) -#endif /* PLATFORM_CONF_WITH_BUTTON */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI0) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI0) lines, - * reserved exclusively for the CC1200 RF transceiver. These pins are not - * exposed to any connector, and should be avoid to use it. - * TX -> MOSI, RX -> MISO - * @{ - */ -#define SPI0_CLK_PORT GPIO_B_NUM -#define SPI0_CLK_PIN 2 -#define SPI0_TX_PORT GPIO_B_NUM -#define SPI0_TX_PIN 1 -#define SPI0_RX_PORT GPIO_B_NUM -#define SPI0_RX_PIN 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI1) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI1) lines, - * shared with the microSD and exposed over JP5 connector. - * It is advisable to use a CSn pin other than the Micro-SD's. - * TX -> MOSI, RX -> MISO - * @{ - */ -#define SPI1_CLK_PORT GPIO_C_NUM -#define SPI1_CLK_PIN 4 -#define SPI1_TX_PORT GPIO_C_NUM -#define SPI1_TX_PIN 5 -#define SPI1_RX_PORT GPIO_C_NUM -#define SPI1_RX_PIN 6 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name I2C configuration - * - * These values configure which CC2538 pins to use for the I2C lines, exposed - * over JP6 connector, also available as testpoints T2 (PC2) and T3 (PC3). - * The I2C bus is shared with the on-board RTC. - * The I2C is exposed over the JP6 header, using a 5-pin connector with 2.54 mm - * spacing, providing also D+3.3V, GND and a generic pin that can be used as an - * interrupt pin - * @{ - */ -#define I2C_SCL_PORT GPIO_C_NUM -#define I2C_SCL_PIN 3 -#define I2C_SDA_PORT GPIO_C_NUM -#define I2C_SDA_PIN 2 -#define I2C_INT_PORT GPIO_D_NUM -#define I2C_INT_PIN 1 -#define I2C_INT_VECTOR GPIO_D_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Antenna switch configuration - * - * These values configure the required pin to drive the RF antenna switch, to - * either enable the sub-1Ghz RF interface (power-up the CC1200) or the 2.4GHz - * RF interface of the CC2538, both alternatively routed to a RP-SMA connector - * to allow using an external antenna for both cases. - * - * Note it is also possible to enable both RF interfaces at the same time, by - * switching On the sub-1GHz RF interface, and placing an 0Ohm resistor (R19), - * to select between using a ceramic chip antenna (not mounted), or to connect - * and external antenna over a pigtail to the U.Fl connector (not mounted). - * - * RF switch state: - * - LOW: 2.4GHz RF interface on RP-SMA connector, CC1200 powered-off. - * - HIGH: Sub-1GHz RF interface on RP-SMA connector. - * @{ - */ -#define ANTENNA_RF_SW_PORT GPIO_D_NUM -#define ANTENNA_RF_SW_PIN 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Dual RF interface support - * - * Enables support for dual band operation (both CC1200 and 2.4GHz enabled). - * The driver checks the selected Radio stack, and forces the antenna switch to - * either position. Enabling the definition below forces to skip this check. - * @{ - */ -#define REMOTE_DUAL_RF_ENABLED 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name CC1200 configuration - * - * These values configure the required pins to drive the CC1200 - * None of the following pins are exposed to any connector, kept for internal - * use only - * @{ - */ -#define CC1200_SPI_INSTANCE 0 -#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT -#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN -#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT -#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN -#define CC1200_SPI_MISO_PORT SPI0_RX_PORT -#define CC1200_SPI_MISO_PIN SPI0_RX_PIN -#define CC1200_SPI_CSN_PORT GPIO_B_NUM -#define CC1200_SPI_CSN_PIN 5 -#define CC1200_GDO0_PORT GPIO_B_NUM -#define CC1200_GDO0_PIN 4 -#define CC1200_GDO2_PORT GPIO_B_NUM -#define CC1200_GDO2_PIN 0 -#define CC1200_RESET_PORT GPIO_C_NUM -#define CC1200_RESET_PIN 7 -#define CC1200_GPIOx_VECTOR GPIO_B_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name microSD configuration - * - * These values configure the required pins to drive the built-in microSD - * external module, to be used with SSI1 - * @{ - */ -#define USD_SPI_INSTANCE 1 -#define USD_CLK_PORT SPI1_CLK_PORT -#define USD_CLK_PIN SPI1_CLK_PIN -#define USD_MOSI_PORT SPI1_TX_PORT -#define USD_MOSI_PIN SPI1_TX_PIN -#define USD_MISO_PORT SPI1_RX_PORT -#define USD_MISO_PIN SPI1_RX_PIN -#define USD_CSN_PORT GPIO_A_NUM -#define USD_CSN_PIN 7 -#define USD_SEL_PORT GPIO_A_NUM -#define USD_SEL_PIN 6 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Power management and shutdown mode - * - * The shutdown mode is an ultra-low power operation mode that effectively - * powers-down the entire RE-Mote (CC2538, CC1200, attached sensors, etc) and - * only keeps running a power gating timer (NanoTimer), the on-board RTC and - * an ultra-low power consumption MCU (PIC12F635). The Shutdown mode allows: - * - * - Put the RE-Mote in an ultra-low power sleep (shutdown) drawing <200nA avg. - * - Periodically awake and execute tasks, being the shutdown period selectable - * via R47 resistor value (22KOhm as default for 1 minute shutdown period). - * - Enter shutdown mode before the shutdown period expiration, by invoking the - * PM_SHUTDOWN_NOW macrp - * - * The shutdown mode can be disabled by hardware by short-circuiting or placing - * an 0Ohm resistor across W1 pad. - * @{ - */ -#define PM_DONE_PORT GPIO_D_NUM -#define PM_DONE_PIN 0 -#define PM_CMD_PORT GPIO_D_NUM -#define PM_CMD_PIN 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name On-board RTC - * - * The shutdown mode can be disabled by hardware by short-circuiting or placing - * an 0Ohm resistor across W1 pad. As the RTC_INT1 pin is also shared with the - * BUTTON_USER, so either disable or not use the user button, or upon receiving - * an interrupt, poll the RTC. - * - * The RTC_INT1 can be used to exit the CC2538's LPM3 mode. - * A second interruption pin is connected to the PIC12F635, for applications - * requiring to put the PIC into deep-sleep and waking up at a certain time. - * @{ - */ -#define PLATFORM_HAS_RTC 1 -#define RTC_SDA_PORT I2C_SDA_PORT -#define RTC_SDA_PIN I2C_SDA_PIN -#define RTC_SCL_PORT I2C_SCL_PORT -#define RTC_SCL_PIN I2C_SCL_PIN -#define RTC_INT1_PORT GPIO_A_NUM -#define RTC_INT1_PIN 4 -#define RTC_INT1_VECTOR GPIO_A_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name On-board external WDT - * The RE-Mote features an on-board external WDT and battery monitor, which - * adds more robustness and prevents the mote to run wild if any unexpected - * problem shows-up. - * The external WDT requires a short pulse (<1ms) to be sent before a 2-second - * period. The battery monitor keeps the device in Reset if the voltage input - * is lower than 2.5V. - * The external WDT can be disabled by removing the R40 0Ohm resistor. - * The EXT_WDT pin is shared with LED1 (Red). For long-time operation, it is - * advised to remove R14 resistor to disable LED1. - * As default the Texas Instrument's TPS3823 WDT is not mounted. - * @{ - */ -#define EXT_WDT_PORT GPIO_D_NUM -#define EXT_WDT_PIN 5 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "Zolertia RE-Mote revision A platform" -/** @} */ - -#endif /* BOARD_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/remote-reva/power-mgmt.c b/arch/platform/zoul/remote-reva/power-mgmt.c deleted file mode 100644 index 43a4f84c7..000000000 --- a/arch/platform/zoul/remote-reva/power-mgmt.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-power-mgmt-reva - * @{ - * - * RE-Mote power management and shutdown mode - * @{ - * - * \author - * Aitor Mejias - * Antonio Lignan - */ -/* -------------------------------------------------------------------------- */ -#include -#include -#include "contiki.h" -#include "dev/gpio.h" -#include "sys/rtimer.h" -#include "power-mgmt.h" -/* -------------------------------------------------------------------------- */ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/* -------------------------------------------------------------------------- */ -#define PM_CMD_LINE_SET GPIO_SET_PIN(PM_CMD_PORT_BASE, PM_CMD_PIN_MASK) -#define PM_CMD_LINE_CLR GPIO_CLR_PIN(PM_CMD_PORT_BASE, PM_CMD_PIN_MASK) -#define PM_CMD_LINE_READ GPIO_READ_PIN(PM_CMD_PORT_BASE, PM_CMD_PIN_MASK) -#define PM_CMD_AS_OUTPUT GPIO_SET_OUTPUT(PM_CMD_PORT_BASE, PM_CMD_PIN_MASK) -#define PM_CMD_AS_INPUT GPIO_SET_INPUT(PM_CMD_PORT_BASE, PM_CMD_PIN_MASK) -/* -------------------------------------------------------------------------- */ -#define PM_NUMBITS(X) (1 << ((X) - 1)) -/* -------------------------------------------------------------------------- */ -static uint8_t initialized = 0; -static uint8_t getData = 0; -/* -------------------------------------------------------------------------- */ -static int8_t -pm_get_ack(void) -{ - uint16_t error = PM_ERROR; - PM_CMD_AS_INPUT; - clock_delay_usec(PM_3_MILISECOND); - if(PM_CMD_LINE_READ) { - error = PM_SUCCESS; - } - - clock_delay_usec(PM_10_MILISECOND); - PM_CMD_AS_OUTPUT; - return error; -} -/* -------------------------------------------------------------------------- */ -static int8_t -pm_send_cmd(uint8_t cmd) -{ - uint8_t i; - - PRINTF("PM: cmd %u\n", cmd); - - /* Enter command mode */ - PM_CMD_LINE_SET; - clock_delay_usec(PM_1_MILISECOND); - PM_CMD_LINE_CLR; - - /* Send command */ - for (i = PM_MAX_BITS; i > 0; i--) { - clock_delay_usec(PM_1_MILISECOND); - - if (cmd & PM_NUMBITS(i)) { - PM_CMD_LINE_SET; - } - else PM_CMD_LINE_CLR; - } - - clock_delay_usec(PM_1_MILISECOND); - PM_CMD_LINE_CLR; - - /* Receive command reply if any */ - if((cmd == PM_CMD_GET_STATE) || (cmd == PM_CMD_GET_FW_VERSION)) { - PM_CMD_AS_INPUT; - clock_delay_usec(PM_2_2_MILISECOND); - for (i = PM_MAX_BITS; i > 0; i--) { - clock_delay_usec(PM_1_MILISECOND); - PM_CMD_LINE_READ ? (getData |= PM_NUMBITS(i)) : (getData &= ~PM_NUMBITS(i)); - } - - PRINTF("PM: getData = 0x%02X\n", getData); - clock_delay_usec(PM_2_2_MILISECOND); - PM_CMD_AS_OUTPUT; - PM_CMD_LINE_CLR; - - clock_delay_usec(PM_2_2_MILISECOND); - - return PM_SUCCESS; - } - - /* Default case */ - clock_delay_usec(PM_1_MILISECOND); - - return pm_get_ack(); -} -/* -------------------------------------------------------------------------- */ -int8_t -pm_init(void) -{ - /* Configure and clear immediately */ - GPIO_SOFTWARE_CONTROL(PM_DONE_PORT_BASE, PM_DONE_PIN_MASK); - GPIO_SET_OUTPUT(PM_DONE_PORT_BASE, PM_DONE_PIN_MASK); - GPIO_CLR_PIN(PM_DONE_PORT_BASE, PM_DONE_PIN_MASK); - - /* Set as output/low to set IDLE state */ - GPIO_SOFTWARE_CONTROL(PM_CMD_PORT_BASE, PM_CMD_PIN_MASK); - PM_CMD_AS_OUTPUT; - PM_CMD_LINE_CLR; - - /* Ensure the battery charger is on, so we don't lock ourselves out and left - * stranded in a state the CC2538 and components are kept off - */ - - if(pm_send_cmd(PM_CMD_PWR_ON) == PM_SUCCESS) { - initialized = 1; - PRINTF("PM: Initialized\n"); - return PM_SUCCESS; - } - - PRINTF("PM: Failed to initialize\n"); - return PM_ERROR; -} -/* -------------------------------------------------------------------------- */ -int8_t -pm_enable_timer(void) -{ - if(!initialized) { - return PM_ERROR; - } - - if(pm_send_cmd(PM_CMD_DTIMER_ON) == PM_SUCCESS) { - return PM_SUCCESS; - } - return PM_ERROR; -} -/* -------------------------------------------------------------------------- */ -int8_t -pm_disable_timer(void) -{ - if(!initialized) { - return PM_ERROR; - } - - if(pm_send_cmd(PM_CMD_DTIMER_OFF) == PM_SUCCESS) { - return PM_SUCCESS; - } - return PM_ERROR; -} -/* -------------------------------------------------------------------------- */ -int8_t -pm_get_state(uint8_t *state) -{ - if(!initialized) { - return PM_ERROR; - } - - if(pm_send_cmd(PM_CMD_GET_STATE) == PM_SUCCESS) { - *state = getData; - PRINTF("PM: state %u\n", getData); - - return PM_SUCCESS; - } - return PM_ERROR; -} -/* -------------------------------------------------------------------------- */ -int8_t -pm_get_firmware_version(uint8_t *state) -{ - if(!initialized) { - return PM_ERROR; - } - - if (pm_send_cmd(PM_CMD_GET_FW_VERSION) == PM_SUCCESS) { - *state = getData; - printf("PM: FW Version %u\n", getData); - return PM_SUCCESS; - } - return PM_ERROR; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/remote-reva/power-mgmt.h b/arch/platform/zoul/remote-reva/power-mgmt.h deleted file mode 100644 index 33fbb7854..000000000 --- a/arch/platform/zoul/remote-reva/power-mgmt.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-reva - * @{ - * - * \defgroup remote-power-mgmt-reva RE-Mote power management driver - * - * The power management module is composed by a nano-watt (gating) timer and an - * ultra-low power MCU, driving the RE-Mote power supply when connected to an - * external battery, and allowing an application to enter a so-called "shutdown - * mode". - * While in shutdown mode, only the RTCC and the power management block is on, - * effectively reducing the RE-Mote power consumption down to <~200nA. The - * nano Timer allows the RE-Mote to be awaken off shutdown mode after a given - * period (from 100ms to 2 hours, default is 1 minute). To change the shutdown - * period, the R47 resistor (at the DELAY input pin, see the RE-Mote datasheet) - * has to be changed. - * See the TPL5110 datasheet ((Table 2 and 3) for more information about the R47 - * resistor value, below is a table resuming most common periods: - * - * +------------+------------+ - * | R47 (Ohm) | Time | - * +------------+------------+ - * | 500 | 100ms | - * +------------+------------+ - * | 2.5K | 500ms | - * +------------+------------+ - * | 5.202K | 1s | - * +------------+------------+ - * | 22.021K | 1min | - * +------------+------------+ - * | 42.887K | 5min | - * +------------+------------+ - * | 57.434K | 10min | - * +------------+------------+ - * | 92.233K | 30min | - * +------------+------------+ - * | 170K | 2h | - * +------------+------------+ - * - * An application can enter the shutdown mode before the shutdown period expires - * by invoking the PM_SHUTDOWN_NOW macro. - * The on-board RTCC can also be used to drive the CC2538 off PM3 power mode, if - * the application requires to retain RAM. Note that while in shutdown mode the - * RE-Mote will be powered off. - * - * @{ - * - * \file - * Header file for the RE-Mote Power Management driver - */ -/* -------------------------------------------------------------------------- */ -#ifndef POWER_MGMT_H_ -#define POWER_MGMT_H_ -#include "dev/gpio.h" -/* -------------------------------------------------------------------------- */ -#define PM_CMD_PORT_BASE GPIO_PORT_TO_BASE(PM_CMD_PORT) -#define PM_CMD_PIN_MASK GPIO_PIN_MASK(PM_CMD_PIN) -#define PM_DONE_PORT_BASE GPIO_PORT_TO_BASE(PM_DONE_PORT) -#define PM_DONE_PIN_MASK GPIO_PIN_MASK(PM_DONE_PIN) -/* -------------------------------------------------------------------------- */ -/** \name Power Management return values - * @{ - */ -#define PM_SUCCESS 0 -#define PM_ERROR (-1) -#define PM_MAX_BITS 8 -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name Power Management "done" signal - * @{ - */ -#define PM_SHUTDOWN_NOW GPIO_SET_PIN(PM_DONE_PORT_BASE, PM_DONE_PIN_MASK) -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name Power Management timing values - * @{ - */ -#define PM_1_MILISECOND 1000L -#define PM_2_2_MILISECOND 2200L -#define PM_3_MILISECOND 3000L -#define PM_10_MILISECOND 10000L -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name Power Management commands - * @{ - */ -typedef enum { - PM_CMD_PWR_ON = 0x34, - PM_CMD_PWR_OFF = 0x35, - PM_CMD_RST_HARD = 0x36, - PM_CMD_RST_TIMED = 0x37, /* Not implemented */ - PM_CMD_DTIMER_ON = 0x38, - PM_CMD_DTIMER_OFF = 0x39, - PM_CMD_DTIMER_TIMED = 0x3A, /* Not implemented */ - PM_CMD_PARAM_SET_MAX_TIME = 0x3B, /* Not implemented */ - PM_CMD_GET_STATE = 0x3C, - PM_CMD_GET_FW_VERSION = 0x3D, - PM_MAX_NUM_CMDS -} pm_cmd_t; -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name Power Management status and masks - * @{ - */ -typedef enum { - PM_IDLE, - PM_SYSOFF_OFF, - PM_SYSOFF_ON, - PM_TIMER_DISABLED, - PM_TIMER_ENABLED, - PM_AWAITING_RTC_DIS, /* Not implemented */ - PM_AWAITING_RTC_EVENT, /* Not implemented */ -} pm_state_t; - -#define PM_SYSOFF_ON_MASK 0x01 -#define PM_TIMER_ENABLED_MASK 0x02 -#define PM_AWAITING_RTC_EVENT_MASK 0x04 - -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name Power Management functions - * @{ - */ -/** \brief Initializes the Power Management driver - * \return PM_SUCCESS if initialized, else PM_ERROR - */ -int8_t pm_init(void); -/* -------------------------------------------------------------------------- */ -/** \brief Enable the shutdown mode, periodically driven by the Nano Timer - * \return PM_SUCCESS if successful, else PM_ERROR - */ -int8_t pm_enable_timer(void); -/* -------------------------------------------------------------------------- */ -/** \brief Disable the Nano Timer - * \return PM_SUCCESS if successful, else PM_ERROR - */ -int8_t pm_disable_timer(void); -/* -------------------------------------------------------------------------- */ -/** \brief Get the current state of the power management module - * \param state Pointer to a variable to save the state - * \return PM_SUCCESS if successful, else PM_ERROR - */ -int8_t pm_get_state(uint8_t *state); -/* -------------------------------------------------------------------------- */ -/** \brief Get the firmware version of the power management module - * \param state Pointer to a variable to save the state - * \return PM_SUCCESS if successful, else PM_ERROR - */ -int8_t pm_get_firmware_version(uint8_t *state); -/* -------------------------------------------------------------------------- */ -/** @} */ -#endif /* POWER_MGMT_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/remote-revb/Makefile.remote-revb b/arch/platform/zoul/remote-revb/Makefile.remote-revb deleted file mode 100644 index ec4095265..000000000 --- a/arch/platform/zoul/remote-revb/Makefile.remote-revb +++ /dev/null @@ -1,4 +0,0 @@ -MOTELIST_ZOLERTIA := RE-Mote -BOARD_SOURCEFILES += board.c antenna-sw.c mmc-arch.c rtcc.c power-mgmt.c - -MODULES += os/lib/fs/fat os/lib/fs/fat/option arch/platform/zoul/fs/fat arch/dev/disk/mmc diff --git a/arch/platform/zoul/remote-revb/board.c b/arch/platform/zoul/remote-revb/board.c deleted file mode 100644 index b733bdb9b..000000000 --- a/arch/platform/zoul/remote-revb/board.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-revb - * @{ - * - * \file - * Board-initialisation for the Zolertia's RE-Mote revision B platform - * - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "antenna-sw.h" -#include -#include -/*---------------------------------------------------------------------------*/ -static void -configure_unused_pins(void) -{ - /* FIXME */ -} -/*---------------------------------------------------------------------------*/ -void -board_init() -{ - antenna_sw_config(); - configure_unused_pins(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ - diff --git a/arch/platform/zoul/remote-revb/board.h b/arch/platform/zoul/remote-revb/board.h deleted file mode 100644 index 244489562..000000000 --- a/arch/platform/zoul/remote-revb/board.h +++ /dev/null @@ -1,510 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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. - */ -/** - * \addtogroup zoul-platforms - * @{ - * - * \defgroup remote-revb RE-Mote platform revision B - * - * The RE-Mote was designed jointly with universities and industry partners in - * RERUM European project, to ease the development of private and secure - * applications for IoT and Smart City applications. The RE-Mote packs several - * on-board resources, like a RTC, external WDT, Micro-SD, RF switch and a - * Shutdown mode to reduce its power consumption down to 150nA. - * - * This file provides connectivity information on LEDs, Buttons, UART and - * other RE-Mote revision A peripherals - * - * This file can be used as the basis to configure other platforms using the - * cc2538 SoC. - * @{ - * - * \file - * Header file with definitions related to the I/O connections on the Zolertia's - * RE-Mote platform (revision B), cc2538-based - * - * \note Do not include this file directly. It gets included by contiki-conf - * after all relevant directives have been set. - */ -#ifndef BOARD_H_ -#define BOARD_H_ - -#include "dev/gpio.h" -#include "dev/nvic.h" -/*---------------------------------------------------------------------------*/ -/** \name Connector headers - * - * The RE-Mote features two 2.54 mm header rows over which exposes the following - * pins (facing up, Zolertia/RERUM logo above, buttons and micro USB at bottom): - * ----------------------+---+---+--------------------------------------------- - * PIN_NAME |JP6|JP5| PIN_NAME - * ----------------------+---+---+--------------------------------------------- - * LED1.R/PD4 |-01|17-| PB2/SPIO0.SCLK/CC1200.SCLK - * LED2.G/JTAG.TDO/PB7 |-02|16-| PB1/SPIO0.MOSI/CC1200.MOSI - * LED3.B/JTAG.TDI/PB6 |-03|15-| PB3/SPIO0.MISO/CC1200.MISO - * UART0.RX/PA0 |-04|14-| PA7/AIN7/USD.CS|ADC5 - * UART0.TX/PA1 |-05|13-| DGND - * PD0 |-06|12-| D+3.3 - * I2C.SDA/PC2 |-07|11-| PA5/AIN5/ADC1 - * I2C.SCL/PC3 |-08|10-| PA4/AIN4/ADC2 - * DGND |-09|09-| DGND - * D+3.3 |-10|08-| D+5.0 - * CC1200.GPIO0/PB4 |-11|07-| PA2/AIN2/ADC3 - * CC1200.GPIO2/PB0 |-12|06-| PA6/AIN6/USD.SEL|ADC4 - * UART1.RX/PC1 |-13|05-| PC6/SPI1.MISO - * UART1.TX/PC0 |-14|04-| PC5/SPI1.MOSI - * DGND |-15|03-| PC4/SPI1.SCLK - * D+3.3 |-16|02-| PS+EXT/VIN - * CC1200.CS/PB5 |-17|01-| DGND - * ----------------------+---+---+--------------------------------------------- - * - * Two auxiliary connectors allow to connect an external LiPo battery and - * access to the RESET/user buttons: - * - * - JP4 (placed below JP6 connector): |1-| DGND, |2-| VBAT - * - JP9 (placed above JP5 connector): |1-| BUTTON.RESET, |2-| BUTTON.USER|ADC6 - */ -/*---------------------------------------------------------------------------*/ -/** \name RE-Mote LED configuration - * - * LEDs on the RE-Mote are exposed in the JP6 port as follows: - * - LED1 (Red) -> PD4 - * - LED2 (Green) -> PB7 (shared with JTAG.TDO) - * - LED3 (Blue) -> PB6 (shared with JTAG.TDI) - * - * The LEDs are connected to a MOSFET to minimize current draw. The LEDs can - * be disabled by removing resistors R12, R13 and R14. - * @{ - */ -/*---------------------------------------------------------------------------*/ -#define LEDS_ARCH_L1_PORT GPIO_D_NUM -#define LEDS_ARCH_L1_PIN 4 -#define LEDS_ARCH_L2_PORT GPIO_B_NUM -#define LEDS_ARCH_L2_PIN 7 -#define LEDS_ARCH_L3_PORT GPIO_B_NUM -#define LEDS_ARCH_L3_PIN 6 - -#define LEDS_CONF_RED 1 -#define LEDS_CONF_GREEN 2 -#define LEDS_CONF_BLUE 4 - -#define LEDS_CONF_COUNT 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name USB configuration - * - * The USB pullup is enabled by an external resistor, not mapped to a GPIO - */ -#ifdef USB_PULLUP_PORT -#undef USB_PULLUP_PORT -#endif -#ifdef USB_PULLUP_PIN -#undef USB_PULLUP_PIN -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name UART configuration - * - * On the RE-Mote, the UARTs are connected to the following ports/pins: - * - * - UART0: - * - RX: PA0, connected to CP2104 serial-to-usb converter TX pin - * - TX: PA1, connected to CP2104 serial-to-usb converter RX pin - * - UART1: - * - RX: PC1 - * - TX: PC0 - * - CTS: disabled as default, PD0 may be assigned if not using I2C interrupts - * - RTS: disabled as default - * - * We configure the port to use UART0 and UART1, CTS/RTS only for UART1, - * both without a HW pull-up resistor - * UART0 and UART1 pins are exposed over the JP6 connector - * @{ - */ -#define UART0_RX_PORT GPIO_A_NUM -#define UART0_RX_PIN 0 -#define UART0_TX_PORT GPIO_A_NUM -#define UART0_TX_PIN 1 - -#define UART1_RX_PORT GPIO_C_NUM -#define UART1_RX_PIN 1 -#define UART1_TX_PORT GPIO_C_NUM -#define UART1_TX_PIN 0 -#define UART1_CTS_PORT (-1) -#define UART1_CTS_PIN (-1) -#define UART1_RTS_PORT (-1) -#define UART1_RTS_PIN (-1) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ADC configuration - * - * These values configure which CC2538 pins and ADC channels to use for the ADC - * inputs. By default the RE-Mote allows two out-of-the-box ADC ports with a - * phidget-like 3-pin connector (GND/VDD/ADC) - * - * The RE-Mote allows both 3.3V and 5V analogue sensors as follow: - * - * - ADC1 (PA5): up to 3.3V. - * - ADC2 (PA4): up to 3.3V - * - ADC3 (PA2): up to 5V, by means of a 2/3 voltage divider. - * - * Also there are other ADC channels shared by default with Micro SD card and - * user button implementations: - * - * - ADC4 (PA6): up to 3.3V. - * - ADC5 (PA7): up to 3.3V. - * - ADC6 (PA3): up to 3.3V. - * - * ADC inputs can only be on port A. - * All ADCx are exposed in JP5 connector, but only ADC1 and ADC3 have GND and - * VDD (3/5V) pins next to it, so these can be exposed into a 3-pin phidget-like - * connector, for ADC2 either solder a wire to connect, or use a 4-pin connector - * to expose both ADC1 and ADC2 in a single connector, but this will leave no - * space for a ADC3 connector. - * - * The internal ADC reference is 1190mV, use either a voltage divider as input, - * or a different voltage reference, like AVDD5, or externally using PA7/AIN7 - * and PA6/AIN6 configurable as differential reference, by removing the R26 and - * R33 0Ohm resistors to disconnect off the Micro-SD, and those will be - * accessible from JP5 connector. - * - * To enable the ADC[2,4-6], remove any 0Ohm resistors if required (see above), - * and define in your application `ADC_SENSORS_CONF_ADCx_PIN` and set its - * value with the corresponding pin number (i.e ADC2 to 4 as mapped to PA4). - * To disable any ADC[1-6] just define as above, but set to (-1) instead. - - * Warning: if using ADC6 (PA3), you will need to disable the bootloader by - * making FLASH_CCA_CONF_BOOTLDR_BACKDOOR equal to zero - * - * @{ - */ -#define ADC_SENSORS_PORT GPIO_A_NUM /**< ADC GPIO control port */ - -#ifndef ADC_SENSORS_CONF_ADC1_PIN -#define ADC_SENSORS_ADC1_PIN 5 /**< ADC1 to PA5, 3V3 */ -#else -#if ((ADC_SENSORS_CONF_ADC1_PIN != -1) && (ADC_SENSORS_CONF_ADC1_PIN != 5)) -#error "ADC1 channel should be mapped to PA5 or disabled with -1" -#else -#define ADC_SENSORS_ADC1_PIN ADC_SENSORS_CONF_ADC1_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC3_PIN -#define ADC_SENSORS_ADC3_PIN 2 /**< ADC3 to PA2, 5V */ -#else -#if ((ADC_SENSORS_CONF_ADC3_PIN != -1) && (ADC_SENSORS_CONF_ADC3_PIN != 2)) -#error "ADC3 channel should be mapped to PA2 or disabled with -1" -#else -#define ADC_SENSORS_ADC3_PIN ADC_SENSORS_CONF_ADC3_PIN -#endif -#endif - -#ifndef ADC_SENSORS_CONF_ADC2_PIN -#define ADC_SENSORS_ADC2_PIN (-1) /**< ADC2 no declared */ -#else -#define ADC_SENSORS_ADC2_PIN 4 /**< Hard-coded to PA4 */ -#endif - -#ifndef ADC_SENSORS_CONF_ADC4_PIN -#define ADC_SENSORS_ADC4_PIN (-1) /**< ADC4 not declared */ -#else -#define ADC_SENSORS_ADC4_PIN 6 /**< Hard-coded to PA6 */ -#endif - -#ifndef ADC_SENSORS_CONF_ADC5_PIN -#define ADC_SENSORS_ADC5_PIN (-1) /**< ADC5 not declared */ -#else -#define ADC_SENSORS_ADC5_PIN 7 /**< Hard-coded to PA7 */ -#endif - -#ifndef ADC_SENSORS_CONF_ADC6_PIN -#define ADC_SENSORS_ADC6_PIN (-1) /**< ADC6 not declared */ -#else -#define ADC_SENSORS_ADC6_PIN 3 /**< Hard-coded to PA3 */ -#endif - -#ifndef ADC_SENSORS_CONF_MAX -#define ADC_SENSORS_MAX 2 /**< Maximum sensors */ -#else -#define ADC_SENSORS_MAX ADC_SENSORS_CONF_MAX -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** \name RE-Mote Button configuration - * - * Buttons on the RE-Mote are connected as follows: - * - BUTTON_USER -> PA3, S1 user button, shared with bootloader - * - BUTTON_RESET -> RESET_N line, S2 reset the CC2538 - * - BUTTON_PWR -> Depending on the enabled resistor, it can be used to reset - * the onboard Low-power PIC, provoking a master reset on all - * the RE-Mote's onboards components. Note the BUTTON_RESET - * only resets the CC2538. This is disabled by default, as - * the R45 0Ohm resistor is not soldered on that position - * The other R45 position enables a test-button to drive the - * SYSOFF pin of the power management block, disconnecting the - * battery when used, leaving only powered the RTCC and - * Low-Power PIC. Useful if developing applications using the - * shutdown mode if required to snap out of it. - * @{ - */ -#define BUTTON_USER_PORT GPIO_A_NUM -#define BUTTON_USER_PIN 3 -#define BUTTON_USER_VECTOR GPIO_A_IRQn - -/* Notify various examples that we have an user button. - * If ADC6 channel is used, then disable the user button - */ -#ifdef PLATFORM_CONF_WITH_BUTTON -#if (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) -#error "The ADC6 (PA3) and user button cannot be enabled at the same time" -#else -#define PLATFORM_HAS_BUTTON (PLATFORM_CONF_WITH_BUTTON && \ - !(ADC_SENSORS_ADC6_PIN == 3)) -#endif /* (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) */ -#else -#define PLATFORM_HAS_BUTTON !(ADC_SENSORS_ADC6_PIN == 3) -#endif /* PLATFORM_CONF_WITH_BUTTON */ -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI0) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI0) lines, - * reserved exclusively for the CC1200 RF transceiver. These pins are not - * exposed to any connector, and should be avoid to use it. - * TX -> MOSI, RX -> MISO - * @{ - */ -#define SPI0_CLK_PORT GPIO_B_NUM -#define SPI0_CLK_PIN 2 -#define SPI0_TX_PORT GPIO_B_NUM -#define SPI0_TX_PIN 1 -#define SPI0_RX_PORT GPIO_B_NUM -#define SPI0_RX_PIN 3 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name SPI (SSI1) configuration - * - * These values configure which CC2538 pins to use for the SPI (SSI1) lines, - * shared with the microSD and exposed over JP5 connector. - * TX -> MOSI, RX -> MISO - * @{ - */ -#define SPI1_CLK_PORT GPIO_C_NUM -#define SPI1_CLK_PIN 4 -#define SPI1_TX_PORT GPIO_C_NUM -#define SPI1_TX_PIN 5 -#define SPI1_RX_PORT GPIO_C_NUM -#define SPI1_RX_PIN 6 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name I2C configuration - * - * These values configure which CC2538 pins to use for the I2C lines, exposed - * over JP6 connector. - * The I2C bus is shared with the on-board RTC and the Low-Power PIC - * The I2C is exposed over the JP6 header, using a 5-pin connector with 2.54 mm - * spacing, providing also D+3.3V, GND and PD0 pin that can be used as an - * interrupt pin if required - * @{ - */ -#define I2C_SCL_PORT GPIO_C_NUM -#define I2C_SCL_PIN 3 -#define I2C_SDA_PORT GPIO_C_NUM -#define I2C_SDA_PIN 2 -#define I2C_INT_PORT GPIO_D_NUM -#define I2C_INT_PIN 0 -#define I2C_INT_VECTOR GPIO_D_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Antenna switch configuration - * - * These values configure the required pin to drive the RF antenna switch, to - * either enable the sub-1Ghz RF interface (power-up the CC1200) or the 2.4GHz - * RF interface of the CC2538, both alternatively routed to a RP-SMA connector - * to allow using an external antenna for both cases. - * - * Note it is also possible to enable both RF interfaces at the same time, by - * switching On the sub-1GHz RF interface, and placing an 0Ohm resistor (R19), - * to select between using a ceramic chip antenna (not mounted), or to connect - * and external antenna over a pigtail to the U.Fl connector (not mounted). - * - * RF switch state: - * - LOW: 2.4GHz RF interface on RP-SMA connector, CC1200 powered-off. - * - HIGH: Sub-1GHz RF interface on RP-SMA connector. - * @{ - */ -#define ANTENNA_RF_SW_PORT GPIO_D_NUM -#define ANTENNA_RF_SW_PIN 2 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Dual RF interface support - * - * Enables support for dual band operation (both CC1200 and 2.4GHz enabled). - * The driver checks the selected Radio stack, and forces the antenna switch to - * either position. Enabling the definition below forces to skip this check. - * @{ - */ -#define REMOTE_DUAL_RF_ENABLED 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name CC1200 configuration - * - * These values configure the required pins to drive the CC1200 - * None of the following pins are exposed to any connector, kept for internal - * use only - * @{ - */ -#define CC1200_SPI_INSTANCE 0 -#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT -#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN -#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT -#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN -#define CC1200_SPI_MISO_PORT SPI0_RX_PORT -#define CC1200_SPI_MISO_PIN SPI0_RX_PIN -#define CC1200_SPI_CSN_PORT GPIO_B_NUM -#define CC1200_SPI_CSN_PIN 5 -#define CC1200_GDO0_PORT GPIO_B_NUM -#define CC1200_GDO0_PIN 4 -#define CC1200_GDO2_PORT GPIO_B_NUM -#define CC1200_GDO2_PIN 0 -#define CC1200_RESET_PORT GPIO_C_NUM -#define CC1200_RESET_PIN 7 -#define CC1200_GPIOx_VECTOR GPIO_B_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name microSD configuration - * - * These values configure the required pins to drive the built-in microSD - * external module, to be used with SSI1. USD_CSN and USD_SEL are shared with - * ADC4/ADC5, but it is disabled by default as there are 0Ohm resistors - * connecting the PA6/PA7 pins to the microSD (see ADC block above for comments) - * The USD_SEL pin can be used both as output and input, to detect if there is - * a microSD in the slot, or when connected to disable the microSD to save power - * @{ - */ -#define USD_SPI_INSTANCE 1 -#define USD_CLK_PORT SPI1_CLK_PORT -#define USD_CLK_PIN SPI1_CLK_PIN -#define USD_MOSI_PORT SPI1_TX_PORT -#define USD_MOSI_PIN SPI1_TX_PIN -#define USD_MISO_PORT SPI1_RX_PORT -#define USD_MISO_PIN SPI1_RX_PIN -#define USD_CSN_PORT GPIO_A_NUM -#define USD_CSN_PIN 7 -#define USD_SEL_PORT GPIO_A_NUM -#define USD_SEL_PIN 6 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Power management and shutdown mode - * - * The shutdown mode is an ultra-low power operation mode that effectively - * powers-down the entire RE-Mote (CC2538, CC1200, attached sensors, etc) and - * only keeps running a the on-board RTC and an ultra-low power consumption MCU - * The Shutdown mode allows: - * - * - Put the board in an ultra-low power sleep (shutdown) drawing <150nA avg. - * - Awake the system by scheduling the RTCC to awake the Low-Power PIC after - * it disconnects the battery and goes to sleep mode. - * - Awake the system by using the Low-Power PIC's timer - * - * As commented above, S3 can be used to restart the entire board (power - * management block included), or to kick the board out of shutdown mode by - * reconnecting the battery. - * @{ - */ -#define PM_ENABLE_PORT GPIO_D_NUM -#define PM_ENABLE_PIN 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name On-board RTCC - * - * The on-board RTCC (real time clock-calendar) is powered over USB/battery, - * and it will remain powered in shutdown mode with the Low-Power PIC. The - * RTC_INT1 is connected to the CC2538, so it is possible to receive interrupts - * from a pre-configured alarm, even waking up the CC2538 from PM3. - * A second interruption pin (RTC_INT2) is connected to the Low-Power PIC, after - * configuring the RTCC the Low-Power PIC can drive the board to shutdown mode, - * and enter into low-power mode (sleep), being the RTCC interrupt the waking up - * source to resume operation. - * - * @{ - */ -#define PLATFORM_HAS_RTC 1 -#define RTC_SDA_PORT I2C_SDA_PORT -#define RTC_SDA_PIN I2C_SDA_PIN -#define RTC_SCL_PORT I2C_SCL_PORT -#define RTC_SCL_PIN I2C_SCL_PIN -#define RTC_INT1_PORT GPIO_D_NUM -#define RTC_INT1_PIN 3 -#define RTC_INT1_VECTOR GPIO_D_IRQn -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name On-board external WDT - * The RE-Mote features an on-board external WDT and battery monitor, which - * adds more robustness and prevents the mote to run wild if any unexpected - * problem shows-up. - * The external WDT requires a short pulse (<1ms) to be sent before a 2-second - * period. The battery monitor keeps the device in Reset if the voltage input - * is lower than 2.5V. - * The external WDT can be disabled by removing the R34 0Ohm resistor. - * As default the Texas Instrument's TPS3823 WDT is not mounted. - * Alternatively the testpoint or unused WDT's pad can be used to re-use as GPIO - * @{ - */ -#define EXT_WDT_PORT GPIO_D_NUM -#define EXT_WDT_PIN 5 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Device string used on startup - * @{ - */ -#define BOARD_STRING "Zolertia RE-Mote revision B platform" -/** @} */ - -#endif /* BOARD_H_ */ - -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/remote-revb/power-mgmt.c b/arch/platform/zoul/remote-revb/power-mgmt.c deleted file mode 100644 index 0de8a8903..000000000 --- a/arch/platform/zoul/remote-revb/power-mgmt.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-power-mgmt-revb - * @{ - * RE-Mote power management functions. - * - * @{ - * - * \author - * Aitor Mejias - * Antonio Lignan - */ -/* -------------------------------------------------------------------------- */ -#include -#include -#include "contiki.h" -#include "dev/gpio.h" -#include "sys/rtimer.h" -#include "power-mgmt.h" -#include "dev/i2c.h" -/* -------------------------------------------------------------------------- */ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/* -------------------------------------------------------------------------- */ -#define PM_ENABLE_LINE_SET GPIO_SET_PIN(PM_ENABLE_PORT_BASE, \ - PM_ENABLE_PIN_MASK) -#define PM_ENABLE_LINE_CLR GPIO_CLR_PIN(PM_ENABLE_PORT_BASE, \ - PM_ENABLE_PIN_MASK) -#define PM_ENABLE_AS_OUTPUT GPIO_SET_OUTPUT(PM_ENABLE_PORT_BASE, \ - PM_ENABLE_PIN_MASK) -#define PM_ENABLE_LINE_CMD PM_ENABLE_LINE_SET; \ - clock_delay_usec(100); - -/* -------------------------------------------------------------------------- */ -#define PM_NUMBITS(X) (1 << ((X)-1)) -/* -------------------------------------------------------------------------- */ -static uint8_t initialized = 0; -static uint8_t lbuf[5]; -/* -------------------------------------------------------------------------- */ -int8_t -pm_enable(void) -{ - /* Set as output/low to set IDLE state */ - GPIO_SOFTWARE_CONTROL(PM_ENABLE_PORT_BASE, PM_ENABLE_PIN_MASK); - PM_ENABLE_AS_OUTPUT; - - i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN, - I2C_SCL_NORMAL_BUS_SPEED); - initialized = 1; - return PM_SUCCESS; -} -/* -------------------------------------------------------------------------- */ -static int -pm_write_byte(uint8_t reg, uint8_t val) -{ - if(!initialized) { - return PM_ERROR; - } - lbuf[0] = reg; - lbuf[1] = val; - PM_ENABLE_LINE_CMD; - - if(i2c_burst_send(PWR_MNGMT_ADDR, lbuf, 2) == I2C_MASTER_ERR_NONE) { - PM_ENABLE_LINE_CLR; - return PM_SUCCESS; - } - PM_ENABLE_LINE_CLR; - return PM_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int -pm_read_byte(uint8_t reg, uint8_t *val, uint8_t len) -{ - /* Detect valid register parameter */ - if((reg < PM_VBAT) || (reg >= PM_MAX_COMMANDS) || (!len)) { - PRINTF("PM: invalid settings/not initialized\n"); - return PM_ERROR; - } - - PM_ENABLE_LINE_CMD; - - if(i2c_single_send(PWR_MNGMT_ADDR, reg) == I2C_MASTER_ERR_NONE) { - if(i2c_burst_receive(PWR_MNGMT_ADDR, val, len) == I2C_MASTER_ERR_NONE) { - printf("PM: Data 0x%02X\n", *val); - PM_ENABLE_LINE_CLR; - return PM_SUCCESS; - } - } - PRINTF("PM: Error reading the registers\n"); - PM_ENABLE_LINE_CLR; - return PM_ERROR; -} -/* -------------------------------------------------------------------------- */ -int8_t -pm_reset_system(void) -{ - if(!initialized) { - return PM_ERROR; - } - - /* Reset the low-power PIC and the whole board as a bonus */ - lbuf[0] = PM_CMD_RST_HARD; - lbuf[1] = 1; - PM_ENABLE_LINE_CMD; - - if(i2c_burst_send(PWR_MNGMT_ADDR, lbuf, 2) == I2C_MASTER_ERR_NONE) { - clock_delay_usec(1000); - PM_ENABLE_LINE_CLR; - return PM_SUCCESS; - } - PM_ENABLE_LINE_CLR; - return PM_ERROR; -} -/* -------------------------------------------------------------------------- */ -int8_t -pm_set_timeout(uint32_t time) -{ - if(!initialized) { - return PM_ERROR; - } - - if(time > PM_SOFT_SHTDN_28_DAYS) { - PRINTF("PM: maximum timeout is %u\n", (uint32_t)PM_SOFT_SHTDN_28_DAYS); - return PM_ERROR; - } - - lbuf[0] = PM_SOFT_TIME; - lbuf[1] = (uint8_t)(time >> 24); - lbuf[2] = (uint8_t)(time >> 16) & 0xFF; - lbuf[3] = (uint8_t)(time >> 8) & 0xFF; - lbuf[4] = (uint8_t)(time & 0xFF); - PRINTF("PM: Timeout 0x%02x%02x%02x%02x\n", lbuf[1], lbuf[2], lbuf[3], lbuf[4]); - - PM_ENABLE_LINE_CMD; - - if(i2c_burst_send(PWR_MNGMT_ADDR, lbuf, 5) == I2C_MASTER_ERR_NONE) { - PM_ENABLE_LINE_CLR; - return PM_SUCCESS; - } - - PRINTF("PM: error setting the timeout\n"); - PM_ENABLE_LINE_CLR; - return PM_ERROR; -} -/* -------------------------------------------------------------------------- */ -uint32_t -pm_get_timeout(void) -{ - uint32_t retval = 0; - PM_ENABLE_LINE_CMD; - - if(i2c_single_send(PWR_MNGMT_ADDR, PM_SOFT_TIME) == I2C_MASTER_ERR_NONE) { - if(i2c_burst_receive(PWR_MNGMT_ADDR, lbuf, 4) == I2C_MASTER_ERR_NONE) { - retval |= ((uint32_t)lbuf[0] << 24); - retval |= ((uint32_t)lbuf[1] << 16); - retval |= ((uint32_t)lbuf[2] << 8); - retval |= lbuf[3]; - } - } - - PM_ENABLE_LINE_CLR; - PRINTF("PM: Timeout 0x%02x%02x%02x%02x\n", lbuf[0], lbuf[1], lbuf[2], lbuf[3]); - - retval *= PM_SOFT_SHTDN_INTERVAL; - retval /= 100; - return retval; -} -/* -------------------------------------------------------------------------- */ -uint32_t -pm_get_num_cycles(void) -{ - uint32_t retval = 0; - PM_ENABLE_LINE_CMD; - - if(i2c_single_send(PWR_MNGMT_ADDR, PM_GET_NUM_CYCLES) == I2C_MASTER_ERR_NONE) { - if(i2c_burst_receive(PWR_MNGMT_ADDR, lbuf, 4) == I2C_MASTER_ERR_NONE) { - retval |= ((uint32_t)lbuf[0] << 24); - retval |= ((uint32_t)lbuf[1] << 16); - retval |= ((uint32_t)lbuf[2] << 8); - retval |= lbuf[3]; - } - } - PM_ENABLE_LINE_CLR; - PRINTF("PM: Sleep cycles: 0x%02x%02x%02x%02x\n", lbuf[0], lbuf[1], lbuf[2], - lbuf[3]); - return retval; -} -/* -------------------------------------------------------------------------- */ -int8_t -pm_shutdown_now(uint8_t type) -{ - if(!initialized) { - PRINTF("PM: Not initialized\n"); - return PM_ERROR; - } - - if((type != PM_HARD_SLEEP_CONFIG) && (type != PM_SOFT_SLEEP_CONFIG)) { - PRINTF("PM: Invalid shutdown mode type\n"); - return PM_ERROR; - } - - PM_ENABLE_LINE_CMD; - - if(type == PM_HARD_SLEEP_CONFIG) { - pm_write_byte(PM_HARD_SLEEP_CONFIG, PM_ENABLE); - PM_ENABLE_LINE_CLR; - return PM_SUCCESS; - } - - /* Soft sleep */ - pm_write_byte(PM_SOFT_SLEEP_CONFIG, PM_ENABLE); - PM_ENABLE_LINE_CLR; - return PM_SUCCESS; -} -/* -------------------------------------------------------------------------- */ -int8_t -pm_get_voltage(uint16_t *state) -{ - if(!initialized) { - return PM_ERROR; - } - - PM_ENABLE_LINE_CMD; - if(i2c_single_send(PWR_MNGMT_ADDR, PM_GET_VDD) == I2C_MASTER_ERR_NONE) { - /* Read two bytes only */ - if(i2c_burst_receive(PWR_MNGMT_ADDR, lbuf, 2) == I2C_MASTER_ERR_NONE) { - *state = (uint16_t)lbuf[0] << 8; - *state += lbuf[1]; - - /* Delay required for the command to finish */ - clock_delay_usec(3000); - - PRINTF("PM: Voltage %u [%u][%u]\n", *state, lbuf[0], lbuf[1]); - PM_ENABLE_LINE_CLR; - return PM_SUCCESS; - } - } - PM_ENABLE_LINE_CLR; - return PM_ERROR; -} -/* -------------------------------------------------------------------------- */ -int8_t -pm_get_fw_ver(uint8_t *fwver) -{ - if((!initialized) || (fwver == NULL)) { - return PM_ERROR; - } - - if(pm_read_byte(PM_FW_VERSION, fwver, 1) == PM_SUCCESS) { - return PM_SUCCESS; - } - return PM_ERROR; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/arch/platform/zoul/remote-revb/power-mgmt.h b/arch/platform/zoul/remote-revb/power-mgmt.h deleted file mode 100644 index d7ea54d79..000000000 --- a/arch/platform/zoul/remote-revb/power-mgmt.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-revb - * @{ - * - * \defgroup remote-power-mgmt-revb RE-Mote power management driver - * - * Driver control the power management of the RE-Mote rev B platform. This - * driver is an I2C communication with external power manager chip - * that controls few functions of the board. Note the driver will work if - * powered both over USB and external battery, but the shutdown mode will only - * be actually working with external battery - * - * @{ - * - * \file - * Header file for the RE-Mote Power Management driver - * - * \ingroup remote-power-mgmt-revb - * @{ - */ -/* -------------------------------------------------------------------------- */ -#ifndef POWER_MGMT_H_ -#define POWER_MGMT_H_ -#include "dev/gpio.h" -/* -------------------------------------------------------------------------- */ -/** - * \name Power management controller - * @{ - */ -/* -------------------------------------------------------------------------- */ -#define PWR_MNGMT_ADDR 0x7F /**< Power Management slave address */ -/** @} */ -/* -------------------------------------------------------------------------- */ -#define PM_ENABLE_PORT_BASE GPIO_PORT_TO_BASE(PM_ENABLE_PORT) -#define PM_ENABLE_PIN_MASK GPIO_PIN_MASK(PM_ENABLE_PIN) -/* -------------------------------------------------------------------------- */ -/** \name Power Management return values - * @{ - */ -#define PM_SUCCESS 0 -#define PM_ERROR (-1) -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name Power Management Registers - * @{ - */ -typedef enum { - PM_VBAT = 34, /* Connect/Disconnect battery, it can be "1" (ON) or "0" (OFF) */ - PM_CURRENT_CHARGE, /* register with pm_charge_current_states options */ - PM_CHARGE_ENABLE, /* Enable the current charge mode on the battery */ - PM_SYSOFF, /* Control SYSOFF pin on the battery charger */ - PM_EXTERNAL_REFERENCE, /* Use reference fot vdd. 0: internal 1:External */ - PM_HARD_SLEEP_CONFIG, /* Disconnect Battery until event ext2 on RTCC. */ - PM_SOFT_SLEEP_CONFIG, /* Disconnect Batt without RTCC until PM_SOFT_TIME val */ - PM_SOFT_TIME, /* Time Out used by system time on hard/soft config */ - PM_GET_VDD, /* Command to get the current VDD on the system */ - PM_FW_VERSION, /* Get the Firmware version */ - PM_GET_NUM_CYCLES, /* Obtain the current sleep cycles at moment */ - PM_CMD_RST_HARD, /* Disconnect and reconnect the battery */ - PM_MAX_COMMANDS /* Maximum register commands. Register not valid */ -} pm_registers_t; -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name Power Management status and masks - * @{ - */ -#define PM_ENABLE 1 /* Pin status on */ -#define PM_DISABLE 0 /* Pin status off */ - -#define BATT_CHARGED_VAL 0 -#define BATT_UNCHARGED_VAL 1 - -#define PM_REFERENCE_INTERNAL 0 -#define PM_REFERENCE_EXTERNAL 1 - -/* The PIC interval time is 57.20ms given in PM_SOFT_SHTDN_INTERVAL, to set a - * timeout period (using the soft shutdown mode) then calculate the time using - * this value as base, i.e 10 minutes would be roughly 600000/57.20 ~10490. - * The maximum value is 28 days! - */ -#define PM_SOFT_SHTDN_INTERVAL 5720 - -#define PM_SOFT_SHTDN_0_5_SEC 8 -#define PM_SOFT_SHTDN_1_SEC 17 -#define PM_SOFT_SHTDN_1_4_SEC 25 -#define PM_SOFT_SHTDN_5_7_SEC 100 -#define PM_SOFT_SHTDN_30_SEC 524 -#define PM_SOFT_SHTDN_1_MIN 1049 -#define PM_SOFT_SHTDN_5_MIN 5245 -#define PM_SOFT_SHTDN_10_MIN 10490 -#define PM_SOFT_SHTDN_1_H 62937 -#define PM_SOFT_SHTDN_24_H 1510490 -#define PM_SOFT_SHTDN_7_DAYS 10573427 -#define PM_SOFT_SHTDN_14_DAYS 21146853 -#define PM_SOFT_SHTDN_28_DAYS 42383709 -#define PM_SOFT_SHTDN_TEST 0xCC00FFEE - -typedef enum { - PM_USB100 = 0, /* 100mA chage */ - PM_USB500, /* 500mA chage */ - PM_USBEXT, /* USB set by external resistor to ILIM (1K) */ - PM_USBSUSPEND /* USB in suspend mode */ -} pm_charge_current_states; - -/** @} */ -/* -------------------------------------------------------------------------- */ -/** \name Power Management functions - * @{ - */ -/** \brief Initializes the Power Management driver - * \return PM_SUCCESS if initialized, else PM_ERROR - */ -int8_t pm_enable(void); - -/** \brief Gets the current firmware version of power management module - * \param fwver pointer to get the value of firmware - * \return PM_SUCCESS if success, else PM_ERROR - */ -int8_t pm_get_fw_ver(uint8_t *fwver); - -/** \brief Disconnects the board battery and enter shutdown mode - * PM_SOFT/HARD_SLEEP_CONFIG - * \param type Hard shutdown (RTCC based) or soft (PIC-governed) - * \return Value byte of the register requested. - */ -int8_t pm_shutdown_now(uint8_t type); - -/** \brief Configure Internal Timeout for Hard and Soft shutdown modes. - * In Hard mode, any positive value counts as internal security timeout. - * In Soft mode, this value is needed. - * \param time value as timeout maximum - * \return PM_SUCCESS if success, else PM_ERROR - */ -int8_t pm_set_timeout(uint32_t time); - -/** \brief Gets the current timeout value configured in power management module - * \return value with timeout. - */ -uint32_t pm_get_timeout(void); - -/** \brief Gets current cycles. incremented each shutdown cycle - * \return Number of shutdown cycles - */ -uint32_t pm_get_num_cycles(void); - -/** \brief Reads the voltage of the external battery if connected to VIN pin - * \param state pointer to get the voltage value - * \return PM_SUCCESS if success, else PM_ERROR - */ -int8_t pm_get_voltage(uint16_t *state); - -/** \brief Restarts the on-board low-power PIC, provoking a board reset - * \return PM_SUCCESS if success, else PM_ERROR - */ -int8_t pm_reset_system(void); -/* -------------------------------------------------------------------------- */ -/** @} */ -#endif /* POWER_MGMT_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - * @} - */ diff --git a/arch/platform/zoul/zolertia-zoul-cdc-acm.inf b/arch/platform/zoul/zolertia-zoul-cdc-acm.inf deleted file mode 100644 index 00ac60439..000000000 --- a/arch/platform/zoul/zolertia-zoul-cdc-acm.inf +++ /dev/null @@ -1,64 +0,0 @@ -; Windows LUFA CDC ACM Setup File -; Copyright (c) 2000 Microsoft Corporation - -[DefaultInstall] -CopyINF="zolertia-zoul-cdc-acm.inf" - -[Version] -Signature="$Windows NT$" -Class=Ports -ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} -Provider=%MFGNAME% -DriverVer=7/1/2012,10.0.0.0 - -[Manufacturer] -%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 - -[SourceDisksNames] - -[SourceDisksFiles] - -[DestinationDirs] -DefaultDestDir=12 - -[DriverInstall] -Include=mdmcpq.inf -CopyFiles=FakeModemCopyFileSection -AddReg=DriverInstall.AddReg - -[DriverInstall.Services] -Include=mdmcpq.inf -AddService=usbser, 0x00000002, LowerFilter_Service_Inst - -[DriverInstall.AddReg] -HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" - -;------------------------------------------------------------------------------ -; Vendor and Product ID Definitions -;------------------------------------------------------------------------------ -; When developing your USB device, the VID and PID used in the PC side -; application program and the firmware on the microcontroller must match. -; Modify the below line to use your VID and PID. Use the format as shown below. -; Note: One INF file can be used for multiple devices with different VID and PIDs. -; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. -;------------------------------------------------------------------------------ -[DeviceList] -%DESCRIPTION%=DriverInstall, USB\VID_0451&PID_16C8 - -[DeviceList.NTx86] -%DESCRIPTION%=DriverInstall, USB\VID_0451&PID_16C8 - -[DeviceList.NTamd64] -%DESCRIPTION%=DriverInstall, USB\VID_0451&PID_16C8 - -[DeviceList.NTia64] -%DESCRIPTION%=DriverInstall, USB\VID_0451&PID_16C8 - -;------------------------------------------------------------------------------ -; String Definitions -;------------------------------------------------------------------------------ -;Modify these strings to customize your device -;------------------------------------------------------------------------------ -[Strings] -MFGNAME="http://zolertia.io" -DESCRIPTION="Zolertia Zoul Virtual COM Port" diff --git a/project/assigner/Makefile b/assigner/Makefile similarity index 100% rename from project/assigner/Makefile rename to assigner/Makefile diff --git a/project/assigner/assigner.c b/assigner/assigner.c similarity index 100% rename from project/assigner/assigner.c rename to assigner/assigner.c diff --git a/project/assigner/assigner_fun.c b/assigner/assigner_fun.c similarity index 100% rename from project/assigner/assigner_fun.c rename to assigner/assigner_fun.c diff --git a/project/assigner/assigner_fun.h b/assigner/assigner_fun.h similarity index 100% rename from project/assigner/assigner_fun.h rename to assigner/assigner_fun.h diff --git a/examples/1/project-conf.h b/assigner/project-conf.h similarity index 100% rename from examples/1/project-conf.h rename to assigner/project-conf.h diff --git a/project/cart/Makefile b/cart/Makefile similarity index 100% rename from project/cart/Makefile rename to cart/Makefile diff --git a/project/cart/batmon.c b/cart/batmon.c similarity index 100% rename from project/cart/batmon.c rename to cart/batmon.c diff --git a/project/cart/batmon.h b/cart/batmon.h similarity index 100% rename from project/cart/batmon.h rename to cart/batmon.h diff --git a/project/cart/cart.c b/cart/cart.c similarity index 100% rename from project/cart/cart.c rename to cart/cart.c diff --git a/project/cart/event.h b/cart/event.h similarity index 100% rename from project/cart/event.h rename to cart/event.h diff --git a/project/cart/leds.cart.c b/cart/leds.cart.c similarity index 100% rename from project/cart/leds.cart.c rename to cart/leds.cart.c diff --git a/project/cart/leds.cart.h b/cart/leds.cart.h similarity index 100% rename from project/cart/leds.cart.h rename to cart/leds.cart.h diff --git a/project/cart/log.h b/cart/log.h similarity index 100% rename from project/cart/log.h rename to cart/log.h diff --git a/project/cart/project-conf.h b/cart/project-conf.h similarity index 100% rename from project/cart/project-conf.h rename to cart/project-conf.h diff --git a/project/cart/sendrecv.c b/cart/sendrecv.c similarity index 100% rename from project/cart/sendrecv.c rename to cart/sendrecv.c diff --git a/project/cart/sendrecv.h b/cart/sendrecv.h similarity index 100% rename from project/cart/sendrecv.h rename to cart/sendrecv.h diff --git a/project/cart/status.c b/cart/status.c similarity index 100% rename from project/cart/status.c rename to cart/status.c diff --git a/project/cart/status.h b/cart/status.h similarity index 100% rename from project/cart/status.h rename to cart/status.h diff --git a/project/cashreg/Makefile b/cashreg/Makefile similarity index 100% rename from project/cashreg/Makefile rename to cashreg/Makefile diff --git a/project/cashreg/cassa.c b/cashreg/cassa.c similarity index 100% rename from project/cashreg/cassa.c rename to cashreg/cassa.c diff --git a/examples/2/project-conf.h b/cashreg/project-conf.h similarity index 100% rename from examples/2/project-conf.h rename to cashreg/project-conf.h diff --git a/project/common/product.h b/common/product.h similarity index 100% rename from project/common/product.h rename to common/product.h diff --git a/project/common/supermarket_net.h b/common/supermarket_net.h similarity index 100% rename from project/common/supermarket_net.h rename to common/supermarket_net.h diff --git a/contiki-ng b/contiki-ng deleted file mode 100644 index 03423c2ba..000000000 --- a/contiki-ng +++ /dev/null @@ -1,42 +0,0 @@ -[editor] -line_wrapping=false -line_break_column=72 -auto_continue_multiline=true - -[file_prefs] -final_new_line=true -ensure_convert_new_lines=false -strip_trailing_spaces=false -replace_tabs=false - -[indentation] -indent_width=4 -indent_type=1 -indent_hard_tab_width=8 -detect_indent=false -detect_indent_width=false -indent_mode=2 - -[project] -name=contiki-ng -base_path=/home/osboxes/contiki-ng/ -description= - -[long line marker] -long_line_behaviour=1 -long_line_column=72 - -[files] -current_page=0 -FILE_NAME_0=500;C;0;EUTF-8;1;1;0;%2Fhome%2Fosboxes%2Fcontiki-ng%2Fexamples%2F5%2Fhello-blink.c;0;4 - -[VTE] -last_dir=/home/osboxes - -[prjorg] -source_patterns=*.c;*.C;*.cpp;*.cxx;*.c++;*.cc;*.m; -header_patterns=*.h;*.H;*.hpp;*.hxx;*.h++;*.hh; -ignored_dirs_patterns=.*;CVS; -ignored_file_patterns=*.o;*.obj;*.a;*.lib;*.so;*.dll;*.lo;*.la;*.class;*.jar;*.pyc;*.mo;*.gmo; -generate_tag_prefs=0 -external_dirs= diff --git a/project/doc/presentation.pdf b/doc/presentation.pdf similarity index 100% rename from project/doc/presentation.pdf rename to doc/presentation.pdf diff --git a/examples/1/Makefile b/examples/1/Makefile deleted file mode 100644 index 8a2a90895..000000000 --- a/examples/1/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = hello-world -PLATFORMS_ONLY = cc26x0-cc13x0 -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. - -PLATFORMS_EXCLUDE = nrf52dk - -#use this to enable TSCH: MAKE_MAC = MAKE_MAC_TSCH -MAKE_MAC ?= MAKE_MAC_CSMA -MAKE_NET = MAKE_NET_NULLNET -include $(CONTIKI)/Makefile.include diff --git a/examples/1/hello-world.c b/examples/1/hello-world.c deleted file mode 100644 index 22a4bceaa..000000000 --- a/examples/1/hello-world.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" -#include -#include -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -PROCESS(contiki1, "Hello world process"); -AUTOSTART_PROCESSES(&contiki1); - -PROCESS_THREAD(contiki1, ev, data) { // data, NULL) { - PROCESS_BEGIN(); - printf("HWllo world"); - PROCESS_END(); -} - - diff --git a/examples/2/Makefile b/examples/2/Makefile deleted file mode 100644 index 1e6c60a5d..000000000 --- a/examples/2/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = test-timers -PLATFORMS_ONLY = cc26x0-cc13x0 -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. - -PLATFORMS_EXCLUDE = nrf52dk - -#use this to enable TSCH: MAKE_MAC = MAKE_MAC_TSCH -MAKE_MAC ?= MAKE_MAC_CSMA -MAKE_NET = MAKE_NET_NULLNET -include $(CONTIKI)/Makefile.include diff --git a/examples/2/make b/examples/2/make deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/2/test-timers.c b/examples/2/test-timers.c deleted file mode 100644 index c86919417..000000000 --- a/examples/2/test-timers.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" -#include -#include -#include "sys/log.h" -#include "sys/timer.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -PROCESS(contiki2, "Timer process"); -AUTOSTART_PROCESSES(&contiki2); - -PROCESS_THREAD(contiki2, ev, data) { - PROCESS_BEGIN(); - - static struct etimer sec3_timer; - - printf("Starting...\n"); - - etimer_set(&sec3_timer, 3 * CLOCK_SECOND); - - while (true) { - PROCESS_WAIT_EVENT(); - - printf("E\n"); - etimer_reset(&sec3_timer); - } - - PROCESS_END(); -} - - diff --git a/examples/3/Makefile b/examples/3/Makefile deleted file mode 100644 index bc6f57c8b..000000000 --- a/examples/3/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = serial-test -PLATFORMS_ONLY = cc26x0-cc13x0 -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. - -PLATFORMS_EXCLUDE = nrf52dk - -#use this to enable TSCH: MAKE_MAC = MAKE_MAC_TSCH -MAKE_MAC ?= MAKE_MAC_CSMA -MAKE_NET = MAKE_NET_NULLNET -include $(CONTIKI)/Makefile.include diff --git a/examples/3/project-conf.h b/examples/3/project-conf.h deleted file mode 100644 index 3cbc0da86..000000000 --- a/examples/3/project-conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 25 -#define RF_BLE_CONF_ENABLED 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/3/serial-test.c b/examples/3/serial-test.c deleted file mode 100644 index 822637a94..000000000 --- a/examples/3/serial-test.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" -#include -#include -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#include "os/dev/serial-line.h" -#include "arch/cpu/cc26x0-cc13x0/dev/cc26xx-uart.h" - -PROCESS(contiki_main_process, "Serial Line Test"); -AUTOSTART_PROCESSES(&contiki_main_process); - -PROCESS_THREAD(contiki_main_process, ev, data) { - PROCESS_BEGIN(); - - cc26xx_uart_set_input(serial_line_input_byte); - serial_line_init(); - - printf("Hello world\n"); - - while (true) { - PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message); - - printf("received: %s\n", (char*)data); - } - - PROCESS_END(); -} - - diff --git a/examples/4/Makefile b/examples/4/Makefile deleted file mode 100644 index bc6f57c8b..000000000 --- a/examples/4/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = serial-test -PLATFORMS_ONLY = cc26x0-cc13x0 -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. - -PLATFORMS_EXCLUDE = nrf52dk - -#use this to enable TSCH: MAKE_MAC = MAKE_MAC_TSCH -MAKE_MAC ?= MAKE_MAC_CSMA -MAKE_NET = MAKE_NET_NULLNET -include $(CONTIKI)/Makefile.include diff --git a/examples/4/project-conf.h b/examples/4/project-conf.h deleted file mode 100644 index 3cbc0da86..000000000 --- a/examples/4/project-conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 25 -#define RF_BLE_CONF_ENABLED 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/4/serial-test.c b/examples/4/serial-test.c deleted file mode 100644 index 5ccdcfa9e..000000000 --- a/examples/4/serial-test.c +++ /dev/null @@ -1,28 +0,0 @@ -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" -#include -#include -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#include "os/dev/serial-line.h" - -PROCESS(contiki_main_process, "Serial Line Test"); -AUTOSTART_PROCESSES(&contiki_main_process); - -PROCESS_THREAD(contiki_main_process, ev, data) { - PROCESS_BEGIN(); - - printf("Hello world\n"); - - while (true) { - PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message); - - printf("received: %s\n", (char*)data); - } - - PROCESS_END(); -} - - diff --git a/examples/5/Makefile b/examples/5/Makefile deleted file mode 100644 index bd858274a..000000000 --- a/examples/5/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = hello-blink -PLATFORMS_ONLY = cc26x0-cc13x0 -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. - -PLATFORMS_EXCLUDE = nrf52dk - -#use this to enable TSCH: MAKE_MAC = MAKE_MAC_TSCH -MAKE_MAC ?= MAKE_MAC_CSMA -MAKE_NET = MAKE_NET_NULLNET -include $(CONTIKI)/Makefile.include diff --git a/examples/5/hello-blink.c b/examples/5/hello-blink.c deleted file mode 100644 index 07d049c67..000000000 --- a/examples/5/hello-blink.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" -#include -#include -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#include "os/dev/serial-line.h" -#include "arch/cpu/cc26x0-cc13x0/dev/cc26xx-uart.h" -#include "os/dev/leds.h" -#include "os/dev/button-hal.h" - - -PROCESS(contiki_main_process, "Serial Line Test"); -AUTOSTART_PROCESSES(&contiki_main_process); - -PROCESS_THREAD(contiki_main_process, ev, data) { - PROCESS_BEGIN(); - - static struct etimer my_timer; - static short status = 1; - - etimer_set(&my_timer, 0.2 * CLOCK_SECOND); - - cc26xx_uart_set_input(serial_line_input_byte); - serial_line_init(); - - printf("Hello world\n"); - - while (true) { - PROCESS_WAIT_EVENT(); - - if (ev == serial_line_event_message) { - printf("received: %s\n", (char*)data); - } else - if (ev == PROCESS_EVENT_TIMER) { - if (status == 1) { - leds_toggle(LEDS_ALL); - } - etimer_reset(&my_timer); - } else - if (ev == button_hal_press_event) { - /* PAY ATTENTION: Never allocate things on the stack */ - button_hal_button_t* button = data; - printf("Received button event from %d\n", button->unique_id); - if (button->unique_id == 0) { - status = (status == 0) ? 1 : 0; /* redundant */ - } - else { - status = 0; - leds_off(LEDS_ALL); - } - } - } - - PROCESS_END(); -} - - diff --git a/examples/5/project-conf.h b/examples/5/project-conf.h deleted file mode 100644 index 3cbc0da86..000000000 --- a/examples/5/project-conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 25 -#define RF_BLE_CONF_ENABLED 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/6/Makefile b/examples/6/Makefile deleted file mode 100644 index 40920157c..000000000 --- a/examples/6/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = sensebattery -PLATFORMS_ONLY = cc26x0-cc13x0 -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. - -PLATFORMS_EXCLUDE = nrf52dk - -#use this to enable TSCH: MAKE_MAC = MAKE_MAC_TSCH -MAKE_MAC ?= MAKE_MAC_CSMA -MAKE_NET = MAKE_NET_NULLNET -include $(CONTIKI)/Makefile.include diff --git a/examples/6/project-conf.h b/examples/6/project-conf.h deleted file mode 100644 index 3cbc0da86..000000000 --- a/examples/6/project-conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 25 -#define RF_BLE_CONF_ENABLED 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/6/sensebattery.c b/examples/6/sensebattery.c deleted file mode 100644 index 9c427d3b9..000000000 --- a/examples/6/sensebattery.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" -#include -#include -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#include "os/dev/serial-line.h" -#include "arch/cpu/cc26x0-cc13x0/dev/cc26xx-uart.h" -//#include "os/dev/leds.h" -//#include "os/dev/button-hal.h" -#include "batmon-sensor.h" - -PROCESS(contiki_main_process, "Battery monitor sensor test"); -AUTOSTART_PROCESSES(&contiki_main_process); - - -void print_battery_status(void) { - static int temp, volt; - temp = batmon_sensor.value(BATMON_SENSOR_TYPE_TEMP); - volt = batmon_sensor.value(BATMON_SENSOR_TYPE_VOLT); - printf("Battery: temperature: %d, volt %d\n", temp, (volt * 125) >> 5); - - -} - -PROCESS_THREAD(contiki_main_process, ev, data) { - PROCESS_BEGIN(); - SENSORS_ACTIVATE(batmon_sensor); - - static struct etimer my_timer; - - etimer_set(&my_timer, 2 * CLOCK_SECOND); - - cc26xx_uart_set_input(serial_line_input_byte); - serial_line_init(); - - printf("Hello world\n"); - - while (true) { - PROCESS_WAIT_EVENT(); - - if (ev == PROCESS_EVENT_TIMER) { - print_battery_status(); - etimer_reset(&my_timer); - } - } - - PROCESS_END(); -} - - diff --git a/examples/6tisch/6p-packet/6p-packet.csc b/examples/6tisch/6p-packet/6p-packet.csc deleted file mode 100644 index e25b08ef8..000000000 --- a/examples/6tisch/6p-packet/6p-packet.csc +++ /dev/null @@ -1,188 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype639 - 6P node - [CONTIKI_DIR]/examples/6tisch/6p-packet/sixp-node.c - make sixp-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -65.17052901237824 - 35.68868314082581 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype639 - - - - org.contikios.cooja.interfaces.Position - -31.58320760838481 - 36.12872091616695 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype639 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 2.463050617589194 0.0 0.0 2.463050617589194 316.15467536891634 50.055049291885666 - - 400 - 5 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1320 - 3 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - - - - 500.0 - - 1720 - 7 - 166 - 0 - 837 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1040 - 6 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 2 - 700 - 710 - 30 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - - 500 - 4 - 300 - 472 - 426 - - - diff --git a/examples/6tisch/6p-packet/Makefile b/examples/6tisch/6p-packet/Makefile deleted file mode 100644 index 707a02485..000000000 --- a/examples/6tisch/6p-packet/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -CONTIKI_PROJECT = sixp-node -PROJECT_SOURCEFILES += test-sf.c - -PLATFORMS_EXCLUDE = sky z1 nrf52dk native simplelink - -CONTIKI = ../../../ - -MAKE_MAC = MAKE_MAC_TSCH -MAKE_ROUTING = MAKE_ROUTING_NULLROUTING -MODULES += os/net/mac/tsch/sixtop - -all: $(CONTIKI_PROJECT) -include $(CONTIKI)/Makefile.include diff --git a/examples/6tisch/6p-packet/README.md b/examples/6tisch/6p-packet/README.md deleted file mode 100644 index 86a7c09f7..000000000 --- a/examples/6tisch/6p-packet/README.md +++ /dev/null @@ -1,4 +0,0 @@ -6P Packet Examples -================== - -You can generate a pcap file having 6P packets with `6p-packet.csc`. \ No newline at end of file diff --git a/examples/6tisch/6p-packet/project-conf.h b/examples/6tisch/6p-packet/project-conf.h deleted file mode 100644 index 9771fe4b1..000000000 --- a/examples/6tisch/6p-packet/project-conf.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UIP_CONF_ND6_SEND_RA 0 - -#define TSCH_CONF_WITH_SIXTOP 1 -#define TSCH_CONF_AUTOSTART 1 -#define TSCH_CONF_DEFAULT_HOPPING_SEQUENCE TSCH_HOPPING_SEQUENCE_1_1 - -#define LOG_CONF_LEVEL_6TOP LOG_LEVEL_DBG - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/6tisch/6p-packet/sixp-node.c b/examples/6tisch/6p-packet/sixp-node.c deleted file mode 100644 index 7bcc8a1a9..000000000 --- a/examples/6tisch/6p-packet/sixp-node.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 -#include -#include -#include -#include - -/* Hard-coded MAC address of the TSCH coordinator */ -static linkaddr_t coordinator_addr = {{ 0x00, 0x01, 0x00, 0x01, - 0x00, 0x01, 0x00, 0x01 }}; - -extern const sixtop_sf_t test_sf; -extern int test_sf_start(const linkaddr_t *addr); - -PROCESS(sixp_node_process, "6P node"); -AUTOSTART_PROCESSES(&sixp_node_process); - -PROCESS_THREAD(sixp_node_process, ev, data) -{ - PROCESS_BEGIN(); - - sixtop_add_sf(&test_sf); - - if(linkaddr_cmp(&coordinator_addr, &linkaddr_node_addr)) { - tsch_set_coordinator(1); - assert(test_sf_start(NULL) == 0); - } else { - static struct etimer et; - struct tsch_neighbor *peer; - etimer_set(&et, CLOCK_SECOND); - while(tsch_is_associated == 0) { - PROCESS_YIELD_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - } - peer = tsch_queue_get_time_source(); - assert(test_sf_start((const linkaddr_t *)&peer->addr) == 0); - } - - PROCESS_END(); -} diff --git a/examples/6tisch/6p-packet/test-sf.c b/examples/6tisch/6p-packet/test-sf.c deleted file mode 100644 index e8745edae..000000000 --- a/examples/6tisch/6p-packet/test-sf.c +++ /dev/null @@ -1,831 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 -#include -#include -#include -#include -#include -#include - -#define DEBUG DEBUG_PRINT -#include - -#define SIXP_PKT_BUFLEN 128 -static uint8_t sixp_pkt_buf[SIXP_PKT_BUFLEN]; - -#define TEST_SF_SFID 0x80 -#define TEST_SF_TIMEOUT CLOCK_SECOND - -PROCESS(test_sf_process, "test-sf initiator process"); -static linkaddr_t peer_addr; -static process_event_t test_sf_trans_done; -static enum { TEST_SF_MODE_INITIATOR, TEST_SF_MODE_RESPONDER } test_sf_mode; -static int test_index = 0; - -static const sixp_pkt_metadata_t sample_metadata = 0xcafe; -static const uint32_t sample_cell_list1[] = { 0xdeadbeef, - 0xcafebabe, - 0xbaadf00d }; -static const uint32_t sample_cell_list2[] = { 0xbaadcafe, - 0xfacefeed, - 0xbadcab1e }; - -static void test_add_2_step(const linkaddr_t *peer_addr); -static void test_add_3_step(const linkaddr_t *peer_addr); -static void test_delete_2_step(const linkaddr_t *peer_addr); -static void test_delete_3_step(const linkaddr_t *peer_addr); -static void test_relocate_2_step(const linkaddr_t *peer_addr); -static void test_count_2_step(const linkaddr_t *peer_addr); -static void test_list_2_step(const linkaddr_t *peer_addr); -static void test_list_2_step_eol(const linkaddr_t *peer_addr); -static void test_signal_2_step(const linkaddr_t *peer_addr); -static void test_clear_2_step_success(const linkaddr_t *peer_addr); -static void test_clear_2_step_eol(const linkaddr_t *peer_addr); -static void test_clear_2_step_err(const linkaddr_t *peer_addr); -static void test_clear_2_step_reset(const linkaddr_t *peer_addr); -static void test_clear_2_step_version(const linkaddr_t *peer_addr); -static void test_clear_2_step_sfid(const linkaddr_t *peer_addr); -static void test_clear_2_step_seqnum(const linkaddr_t *peer_addr); -static void test_clear_2_step_celllist(const linkaddr_t *peer_addr); -static void test_clear_2_step_busy(const linkaddr_t *peer_addr); -static void test_clear_2_step_locked(const linkaddr_t *peer_addr); - -typedef void (*test_func)(const linkaddr_t *peer_addr); -static const test_func test_case[] = { - test_add_2_step, - test_add_3_step, - test_delete_2_step, - test_delete_3_step, - test_relocate_2_step, - test_count_2_step, - test_list_2_step, - test_list_2_step_eol, - test_signal_2_step, - test_clear_2_step_success, - test_clear_2_step_eol, - test_clear_2_step_err, - test_clear_2_step_reset, - test_clear_2_step_version, - test_clear_2_step_sfid, - test_clear_2_step_seqnum, - test_clear_2_step_celllist, - test_clear_2_step_busy, - test_clear_2_step_locked, -}; - -static void -set_peer_addr(const linkaddr_t *addr) -{ - peer_addr = *addr; - PRINTF("test-sf: set peer addr: "); - PRINTLLADDR((const uip_lladdr_t *)&peer_addr); - PRINTF("\n"); -} - -int -test_sf_start(const linkaddr_t *addr) -{ - if(addr == NULL) { - test_sf_mode = TEST_SF_MODE_RESPONDER; - } else { - test_sf_mode = TEST_SF_MODE_INITIATOR; - set_peer_addr(addr); - test_sf_trans_done = process_alloc_event(); - process_start(&test_sf_process, NULL); - } - return 0; -} - -static void -init(void) -{ -} - -static void -input(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *body, uint16_t body_len, - const linkaddr_t *src_addr) -{ - if(test_index < (sizeof(test_case) / sizeof(test_func))) { - test_case[test_index](src_addr); - } -} - -static void -timeout(sixp_pkt_cmd_t cmd, const linkaddr_t *peer_addr) -{ -} - -static void -test_add_2_step(const linkaddr_t *peer_addr) -{ - sixp_trans_t *trans = sixp_trans_find(peer_addr); - - if(trans == NULL) { - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert(sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - sample_metadata, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - SIXP_PKT_CELL_OPTION_TX | - SIXP_PKT_CELL_OPTION_SHARED, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - 1, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - (const uint8_t *)sample_cell_list1, - sizeof(sample_cell_list1), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t) + - sizeof(sixp_pkt_metadata_t) + - sizeof(sample_cell_list1), - peer_addr, - NULL, NULL, 0) == 0); - } else { - sixp_trans_state_t state; - state = sixp_trans_get_state(trans); - if(state == SIXP_TRANS_STATE_REQUEST_RECEIVED) { - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t *)sample_cell_list1, - sizeof(uint32_t), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, sixp_pkt_buf, sizeof(uint32_t), - peer_addr, - NULL, NULL, 0); - test_index++; - } else if(state == SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - process_post(&test_sf_process, test_sf_trans_done, NULL); - } - } -} - -static void -test_add_3_step(const linkaddr_t *peer_addr) -{ - sixp_trans_t *trans = sixp_trans_find(peer_addr); - - if(trans == NULL) { - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert(sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - sample_metadata, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - SIXP_PKT_CELL_OPTION_TX | - SIXP_PKT_CELL_OPTION_SHARED, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - 1, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t) + - sizeof(sixp_pkt_metadata_t), - peer_addr, - NULL, NULL, 0) == 0); - } else { - sixp_trans_state_t state; - state = sixp_trans_get_state(trans); - if(state == SIXP_TRANS_STATE_REQUEST_RECEIVED) { - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t *)sample_cell_list1, - sizeof(sample_cell_list1), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, sixp_pkt_buf, sizeof(sample_cell_list1), - peer_addr, - NULL, NULL, 0); - } else if (state == SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t *)sample_cell_list1, - sizeof(uint32_t), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - sixp_output(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, sixp_pkt_buf, sizeof(uint32_t), - peer_addr, - NULL, NULL, 0); - process_post(&test_sf_process, test_sf_trans_done, NULL); - } else if (state == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED){ - test_index++; - } - } -} - -static void -test_delete_2_step(const linkaddr_t *peer_addr) -{ - sixp_trans_t *trans = sixp_trans_find(peer_addr); - - if(trans == NULL) { - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert(sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - sample_metadata, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - SIXP_PKT_CELL_OPTION_TX | - SIXP_PKT_CELL_OPTION_SHARED, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - 1, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - (const uint8_t *)sample_cell_list1, - sizeof(sample_cell_list1), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t) + - sizeof(sixp_pkt_metadata_t) + - sizeof(sample_cell_list1), - peer_addr, - NULL, NULL, 0) == 0); - } else { - sixp_trans_state_t state; - state = sixp_trans_get_state(trans); - if(state == SIXP_TRANS_STATE_REQUEST_RECEIVED) { - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t *)sample_cell_list1, - sizeof(uint32_t), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, sixp_pkt_buf, sizeof(uint32_t), - peer_addr, - NULL, NULL, 0); - test_index++; - } else if(state == SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - process_post(&test_sf_process, test_sf_trans_done, NULL); - } - } -} - -static void -test_delete_3_step(const linkaddr_t *peer_addr) -{ - sixp_trans_t *trans = sixp_trans_find(peer_addr); - - if(trans == NULL) { - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert(sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - sample_metadata, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - SIXP_PKT_CELL_OPTION_TX | - SIXP_PKT_CELL_OPTION_SHARED, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - 1, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t) + - sizeof(sixp_pkt_metadata_t), - peer_addr, - NULL, NULL, 0) == 0); - } else { - sixp_trans_state_t state; - state = sixp_trans_get_state(trans); - if(state == SIXP_TRANS_STATE_REQUEST_RECEIVED) { - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t *)sample_cell_list1, - sizeof(sample_cell_list1), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, sixp_pkt_buf, sizeof(sample_cell_list1), - peer_addr, - NULL, NULL, 0); - } else if (state == SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t *)sample_cell_list1, - sizeof(uint32_t), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - sixp_output(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, sixp_pkt_buf, sizeof(uint32_t), - peer_addr, - NULL, NULL, 0); - process_post(&test_sf_process, test_sf_trans_done, NULL); - } else if (state == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) { - test_index++; - } - } -} - -static void -test_relocate_2_step(const linkaddr_t *peer_addr) -{ - sixp_trans_t *trans = sixp_trans_find(peer_addr); - - if(trans == NULL) { - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - sample_metadata, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - SIXP_PKT_CELL_OPTION_TX | - SIXP_PKT_CELL_OPTION_SHARED, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - 3, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - (const uint8_t *)sample_cell_list1, - sizeof(sample_cell_list1), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - (const uint8_t *)sample_cell_list2, - sizeof(sample_cell_list2), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t) + - sizeof(sample_cell_list1) + - sizeof(sample_cell_list2), - peer_addr, - NULL, NULL, 0) == 0); - } else { - sixp_trans_state_t state; - state = sixp_trans_get_state(trans); - if(state == SIXP_TRANS_STATE_REQUEST_RECEIVED) { - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t *)sample_cell_list2, - sizeof(uint32_t), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, sixp_pkt_buf, sizeof(uint32_t), - peer_addr, - NULL, NULL, 0); - test_index++; - } else if(state == SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - process_post(&test_sf_process, test_sf_trans_done, NULL); - } - } -} - -static void -test_count_2_step(const linkaddr_t *peer_addr) -{ - sixp_trans_t *trans = sixp_trans_find(peer_addr); - - if(trans == NULL) { - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - sample_metadata, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - SIXP_PKT_CELL_OPTION_TX | - SIXP_PKT_CELL_OPTION_RX | - SIXP_PKT_CELL_OPTION_SHARED, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t), - peer_addr, - NULL, NULL, 0) == 0); - } else { - sixp_trans_state_t state; - state = sixp_trans_get_state(trans); - if(state == SIXP_TRANS_STATE_REQUEST_RECEIVED) { - assert( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - 0xf0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_total_num_cells_t), - peer_addr, - NULL, NULL, 0); - test_index++; - } else if(state == SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - process_post(&test_sf_process, test_sf_trans_done, NULL); - } - } -} - -static void -test_list_2_step(const linkaddr_t *peer_addr) -{ - sixp_trans_t *trans = sixp_trans_find(peer_addr); - - if(trans == NULL) { - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - sample_metadata, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - SIXP_PKT_CELL_OPTION_TX | - SIXP_PKT_CELL_OPTION_RX | - SIXP_PKT_CELL_OPTION_SHARED, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert( - sixp_pkt_set_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - 0x0f, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - 0xf0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_reserved_t) + - sizeof(sixp_pkt_offset_t) + - sizeof(sixp_pkt_max_num_cells_t), - peer_addr, - NULL, NULL, 0) == 0); - } else { - sixp_trans_state_t state; - state = sixp_trans_get_state(trans); - if(state == SIXP_TRANS_STATE_REQUEST_RECEIVED) { - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t *)sample_cell_list1, - sizeof(sample_cell_list1), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t *)sample_cell_list2, - sizeof(sample_cell_list2), - sizeof(sample_cell_list1), - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sample_cell_list1) + sizeof(sample_cell_list2), - peer_addr, - NULL, NULL, 0); - test_index++; - } else if(state == SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - process_post(&test_sf_process, test_sf_trans_done, NULL); - } - } -} - -static void -test_list_2_step_eol(const linkaddr_t *peer_addr) -{ - sixp_trans_t *trans = sixp_trans_find(peer_addr); - - if(trans == NULL) { - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - sample_metadata, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - SIXP_PKT_CELL_OPTION_TX | - SIXP_PKT_CELL_OPTION_RX | - SIXP_PKT_CELL_OPTION_SHARED, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert( - sixp_pkt_set_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - 0x0f, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - 0xf0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_reserved_t) + - sizeof(sixp_pkt_offset_t) + - sizeof(sixp_pkt_max_num_cells_t), - peer_addr, - NULL, NULL, 0) == 0); - } else { - sixp_trans_state_t state; - state = sixp_trans_get_state(trans); - if(state == SIXP_TRANS_STATE_REQUEST_RECEIVED) { - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_EOL, - (const uint8_t *)sample_cell_list1, - sizeof(sample_cell_list1), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_EOL, - (const uint8_t *)sample_cell_list2, - sizeof(sample_cell_list2), - sizeof(sample_cell_list1), - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_EOL, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sample_cell_list1) + sizeof(sample_cell_list2), - peer_addr, - NULL, NULL, 0); - test_index++; - } else if(state == SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - process_post(&test_sf_process, test_sf_trans_done, NULL); - } - } -} - -static void -test_signal_2_step(const linkaddr_t *peer_addr) -{ - sixp_trans_t *trans = sixp_trans_find(peer_addr); - uint8_t payload[10]; - size_t payload_len; - - if(trans == NULL) { - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - sample_metadata, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - payload[0] = 0xbe; - payload[1] = 0xef; - payload[2] = 0xca; - payload[3] = 0xfe; - payload_len = 4; - - assert( - sixp_pkt_set_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - (const uint8_t *)payload, payload_len, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_metadata_t) + payload_len, - peer_addr, - NULL, NULL, 0) == 0); - } else { - sixp_trans_state_t state; - printf("hoge\n"); - state = sixp_trans_get_state(trans); - if(state == SIXP_TRANS_STATE_REQUEST_RECEIVED) { - payload[0] = 0x01; - payload[1] = 0x02; - payload[2] = 0x03; - payload[3] = 0x04; - payload[4] = 0x05; - payload_len = 5; - - assert( - sixp_pkt_set_payload(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t *)payload, payload_len, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, sixp_pkt_buf, - payload_len, - peer_addr, - NULL, NULL, 0); - test_index++; - } else if(state == SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - process_post(&test_sf_process, test_sf_trans_done, NULL); - } - } -} - -static void -test_clear_2_step(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc) -{ - sixp_trans_t *trans = sixp_trans_find(peer_addr); - - if(trans == NULL) { - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - sample_metadata, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - TEST_SF_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_metadata_t), - peer_addr, - NULL, NULL, 0) == 0); - } else { - sixp_trans_state_t state; - state = sixp_trans_get_state(trans); - if(state == SIXP_TRANS_STATE_REQUEST_RECEIVED) { - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)rc, - TEST_SF_SFID, NULL, 0, peer_addr, - NULL, NULL, 0); - test_index++; - } else if(state == SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - process_post(&test_sf_process, test_sf_trans_done, NULL); - } - } -} - -static void -test_clear_2_step_success(const linkaddr_t *peer_addr) -{ - test_clear_2_step(peer_addr, SIXP_PKT_RC_SUCCESS); -} - -static void -test_clear_2_step_err(const linkaddr_t *peer_addr) -{ - test_clear_2_step(peer_addr, SIXP_PKT_RC_ERR); -} - -static void -test_clear_2_step_eol(const linkaddr_t *peer_addr) -{ - test_clear_2_step(peer_addr, SIXP_PKT_RC_EOL); -} - -static void -test_clear_2_step_reset(const linkaddr_t *peer_addr) -{ - test_clear_2_step(peer_addr, SIXP_PKT_RC_RESET); -} - -static void -test_clear_2_step_version(const linkaddr_t *peer_addr) -{ - test_clear_2_step(peer_addr, SIXP_PKT_RC_ERR_VERSION); -} - -static void -test_clear_2_step_sfid(const linkaddr_t *peer_addr) -{ - test_clear_2_step(peer_addr, SIXP_PKT_RC_ERR_SFID); -} - -static void -test_clear_2_step_seqnum(const linkaddr_t *peer_addr) -{ - test_clear_2_step(peer_addr, SIXP_PKT_RC_ERR_SEQNUM); -} - -static void -test_clear_2_step_busy(const linkaddr_t *peer_addr) -{ - test_clear_2_step(peer_addr, SIXP_PKT_RC_ERR_BUSY); -} - -static void -test_clear_2_step_locked(const linkaddr_t *peer_addr) -{ - test_clear_2_step(peer_addr, SIXP_PKT_RC_ERR_LOCKED); -} - -static void -test_clear_2_step_celllist(const linkaddr_t *peer_addr) -{ - test_clear_2_step(peer_addr, SIXP_PKT_RC_ERR_CELLLIST); -} - -PROCESS_THREAD(test_sf_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - etimer_set(&et, CLOCK_SECOND); - - while(1) { - if(test_index == (sizeof(test_case) / sizeof(test_func))) { - break; - } else { - test_case[test_index]((const linkaddr_t *)&peer_addr); - } - PROCESS_WAIT_EVENT_UNTIL(ev == test_sf_trans_done); - PROCESS_YIELD_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - test_index++; - } - PRINTF("done\n"); - - PROCESS_END(); -} - -const sixtop_sf_t test_sf = { - TEST_SF_SFID, - TEST_SF_TIMEOUT, - init, - input, - timeout -}; diff --git a/examples/6tisch/channel-selection-demo/Makefile b/examples/6tisch/channel-selection-demo/Makefile deleted file mode 100644 index e3c4288f6..000000000 --- a/examples/6tisch/channel-selection-demo/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -CONTIKI_PROJECT = node -all: $(CONTIKI_PROJECT) - -CONTIKI=../../.. - -PLATFORMS_EXCLUDE = sky z1 nrf52dk native -BOARDS_EXCLUDE = srf06/cc13x0 launchpad/cc1310 launchpad/cc1350 sensortag/cc2650 sensortag/cc1350 - -# The channel selection library -MODULES += os/services/tsch-cs - -# force Orchestra from command line -MAKE_WITH_ORCHESTRA ?= 0 -# force Security from command line -MAKE_WITH_SECURITY ?= 0 -# print #routes periodically, used for regression tests -MAKE_WITH_PERIODIC_ROUTES_PRINT ?= 0 - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/services/shell - -ifeq ($(MAKE_WITH_ORCHESTRA),1) -MODULES += os/services/orchestra -endif - -ifeq ($(MAKE_WITH_SECURITY),1) -CFLAGS += -DWITH_SECURITY=1 -endif - -ifeq ($(MAKE_WITH_PERIODIC_ROUTES_PRINT),1) -CFLAGS += -DWITH_PERIODIC_ROUTES_PRINT=1 -endif - -include $(CONTIKI)/Makefile.include diff --git a/examples/6tisch/channel-selection-demo/README.md b/examples/6tisch/channel-selection-demo/README.md deleted file mode 100644 index b6415ab9b..000000000 --- a/examples/6tisch/channel-selection-demo/README.md +++ /dev/null @@ -1,8 +0,0 @@ -Demonstration of TSCH adaptive channel selection based on background noise RSSI metric. -TSCH stats must be enabled for the adaptive selection functionality to compile and work. - -This code relies on the `os/services/channel-selection` library that implements -the "RSSI upstream" adaptative channel selection strategy, described in the following paper: - -A. Elsts, X. Fafoutis, G. Oikonomou and R. Piechocki. Adaptive Channel Selection in IEEE 802.15.4 TSCH Networks, 1st Global Internet of Things Summit, 2017. -http://ieeexplore.ieee.org/document/8016246/ \ No newline at end of file diff --git a/examples/6tisch/channel-selection-demo/node.c b/examples/6tisch/channel-selection-demo/node.c deleted file mode 100644 index 86dca79d8..000000000 --- a/examples/6tisch/channel-selection-demo/node.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * Copyright (c) 2018, University of Bristol - http://www.bristol.ac.uk - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A RPL+TSCH node. - * - * \author Simon Duquennoy - * Atis Elsts - */ - -#include "contiki.h" -#include "sys/node-id.h" -#include "sys/log.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/ipv6/uip-sr.h" -#include "net/mac/tsch/tsch.h" -#include "net/routing/routing.h" -#include "tsch-cs.h" - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -/*---------------------------------------------------------------------------*/ -PROCESS(node_process, "RPL Node"); -AUTOSTART_PROCESSES(&node_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(node_process, ev, data) -{ - int is_coordinator; - - PROCESS_BEGIN(); - - is_coordinator = 0; - -#if CONTIKI_TARGET_COOJA - is_coordinator = (node_id == 1); -#endif - - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - -#if WITH_PERIODIC_ROUTES_PRINT - { - static struct etimer et; - /* Print out routing tables every minute */ - etimer_set(&et, CLOCK_SECOND * 60); - while(1) { - /* Used for non-regression testing */ - #if (UIP_MAX_ROUTES != 0) - PRINTF("Routing entries: %u\n", uip_ds6_route_num_routes()); - #endif - #if (UIP_SR_LINK_NUM != 0) - PRINTF("Routing links: %u\n", uip_sr_num_nodes()); - #endif - PROCESS_YIELD_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - } - } -#endif /* WITH_PERIODIC_ROUTES_PRINT */ - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/6tisch/channel-selection-demo/project-conf.h b/examples/6tisch/channel-selection-demo/project-conf.h deleted file mode 100644 index dcf326036..000000000 --- a/examples/6tisch/channel-selection-demo/project-conf.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * Copyright (c) 2017, University of Bristol - http://www.bristol.ac.uk - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \author Simon Duquennoy - * Atis Elsts - */ - -#ifndef __PROJECT_CONF_H__ -#define __PROJECT_CONF_H__ - -#include -#include - -/* Set to enable TSCH security */ -#ifndef WITH_SECURITY -#define WITH_SECURITY 0 -#endif /* WITH_SECURITY */ - -/* USB serial takes space, free more space elsewhere */ -#define SICSLOWPAN_CONF_FRAG 0 -#define UIP_CONF_BUFFER_SIZE 160 - -/*******************************************************/ -/******************* Configure TSCH ********************/ -/*******************************************************/ - -/* IEEE802.15.4 PANID */ -#define IEEE802154_CONF_PANID 0x81a5 - -/* Do not start TSCH at init, wait for NETSTACK_MAC.on() */ -#define TSCH_CONF_AUTOSTART 0 - -/* 6TiSCH minimal schedule length. - * Larger values result in less frequent active slots: reduces capacity and saves energy. */ -#define TSCH_SCHEDULE_CONF_DEFAULT_LENGTH 3 - -#if WITH_SECURITY - -/* Enable security */ -#define LLSEC802154_CONF_ENABLED 1 - -#endif /* WITH_SECURITY */ - -/* Enable TSCH statistics: must be on for channel selection to work */ -#define TSCH_STATS_CONF_ON 1 - -/* Enable periodic RSSI sampling for TSCH statistics */ -#define TSCH_STATS_CONF_SAMPLE_NOISE_RSSI 1 - -/* Reduce the TSCH stat "decay to normal" period to get printouts more often */ -#define TSCH_STATS_CONF_DECAY_INTERVAL (60 * CLOCK_SECOND) - -/* For adaptive channel selection */ -extern void tsch_cs_channel_stats_updated(uint8_t updated_channel, uint16_t old_busyness_metric); -extern bool tsch_cs_process(void); -/* These will be called from the core TSCH code */ -#define TSCH_CALLBACK_CHANNEL_STATS_UPDATED tsch_cs_channel_stats_updated -#define TSCH_CALLBACK_SELECT_CHANNELS tsch_cs_process - -/* The coordinator will update the network nodes with new hopping sequences */ -#define TSCH_PACKET_CONF_EB_WITH_HOPPING_SEQUENCE 1 - -/* Reduce the EB period in order to update the network nodes with more agility */ -#define TSCH_CONF_EB_PERIOD (4 * CLOCK_SECOND) -#define TSCH_CONF_MAX_EB_PERIOD (4 * CLOCK_SECOND) - -/*******************************************************/ -/************* Other system configuration **************/ -/*******************************************************/ - -/* Logging */ -#define LOG_CONF_LEVEL_RPL LOG_LEVEL_INFO -#define LOG_CONF_LEVEL_TCPIP LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_IPV6 LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_6LOWPAN LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_MAC LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_FRAMER LOG_LEVEL_INFO -#define TSCH_LOG_CONF_PER_SLOT 1 - -#endif /* __PROJECT_CONF_H__ */ diff --git a/examples/6tisch/etsi-plugtest-2017/Makefile b/examples/6tisch/etsi-plugtest-2017/Makefile deleted file mode 100644 index 6b1a23a4c..000000000 --- a/examples/6tisch/etsi-plugtest-2017/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -CONTIKI_PROJECT = node -all: $(CONTIKI_PROJECT) - -PLATFORMS_EXCLUDE = sky z1 nrf52dk native simplelink -BOARDS_EXCLUDE = sensortag/cc2650 sensortag/cc1350 - -MAKE_WITH_SECURITY ?= 0 # force Security from command line -ifeq ($(MAKE_WITH_SECURITY),1) -CFLAGS += -DWITH_SECURITY=1 -endif - -MODULES += os/services/shell -MODULES += os/net/mac/tsch/sixtop -PROJECT_SOURCEFILES += sf-plugtest.c -CFLAGS += -Wno-nonnull-compare - -ifeq ($(BOARD),launchpad/cc2650) -# Enable DAP and TAP by default for ETSI Plugtest -CFLAGS += -DSET_CCFG_CCFG_TAP_DAP_0_CPU_DAP_ENABLE=0xC5 -CFLAGS += -DSET_CCFG_CCFG_TAP_DAP_0_TEST_TAP_ENABLE=0xC5 -endif - -MAKE_MAC = MAKE_MAC_TSCH - -CONTIKI =../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/6tisch/etsi-plugtest-2017/README.md b/examples/6tisch/etsi-plugtest-2017/README.md deleted file mode 100644 index 7369918fa..000000000 --- a/examples/6tisch/etsi-plugtest-2017/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# The 1st F-Interop 6TiSCH Interoperability Event - -## Overview - -This project was used to build firmwares for [the 1st F-Interop 6TiSCH -Interoperability -Event](http://www.etsi.org/news-events/events/1197-6tisch-interop-prague-2017), -which worked well in all the tests except for "secjoin". - -## Authors - -* Simon Duquennoy -* Yasuyuki Tanaka - -## Supported Hardwares - -The following hardwares were used in the event: - -* Zolertia Remote (TARGET=`zoul`, BOARD=`remote`) -* JN156x (TARGET=`jn516`) -* CC2650 LaunchPad (TARGET=`cc26x0-cc13x0`, BOARD=`launchpad/cc2650`) - -## Usage - -Access to your target board through serial connection. You'll get available -commands by hit `help` on the shell prompt. - -```shell -> help -Available commands: -'> help': Shows this help -'> ip-addr': Shows all IPv6 addresses -'> ip-nbr': Shows all IPv6 neighbors -'> log module level': Sets log level (0--4) for a given module (or "all"). For module "mac", level 4 also enables per-slot logg'> ping addr': Pings the IPv6 address 'addr' -'> rpl-set-root 0/1 [prefix]': Sets node as root (on) or not (off). A /64 prefix can be optionally specified. -'> rpl-status': Shows a summary of the current RPL state -'> rpl-global-repair': Triggers a RPL global repair -'> rpl-local-repair': Triggers a RPL local repair -'> routes': Shows the route entries -'> tsch-schedule': Shows the current TSCH schedule -'> tsch-status': Shows a summary of the current TSCH state -'> reboot': Reboot the board by watchdog_reboot() -'> 6top help': Shows 6top command usage -``` - -Your board runs as a 6TiSCH node by default. Its role can be changed to DAG root -by `rpl-set-root 1`. - -You can see how it works with -[test-with-cooja-mote.csc](test-with-cooja-mote.csc). - -## Configuration - -Edit [project-confi.h](./project-conf.h) if necessary. - -* `UIP_CONF_IPV6_CHECKS`: set 0 if you want to disable checksum validation -* `SIXP_CONF_WITH_PAYLOAD_TERMINATION_IE`: set 1 if you want to append Paload Termination IE in 6P frames diff --git a/examples/6tisch/etsi-plugtest-2017/node.c b/examples/6tisch/etsi-plugtest-2017/node.c deleted file mode 100644 index 32d0429c0..000000000 --- a/examples/6tisch/etsi-plugtest-2017/node.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A RPL+TSCH node able to act as either a simple node (6ln), - * DAG Root (6dr) or DAG Root with security (6dr-sec) - * Press use button at startup to configure. - * - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "sys/node-id.h" -#include "sys/log.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/mac/tsch/tsch.h" -#include "net/routing/routing.h" -#include "serial-shell.h" -#include "sf-plugtest.h" -#if CONTIKI_TARGET_SRF06_CC26XX -#include -#include -#endif - -/*---------------------------------------------------------------------------*/ -PROCESS(node_process, "RPL Node"); -AUTOSTART_PROCESSES(&node_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(node_process, ev, data) -{ - int is_coordinator; - - PROCESS_BEGIN(); - - is_coordinator = 0; - -#if CONTIKI_TARGET_SRF06_CC26XX - cc26xx_uart_set_input(serial_line_input_byte); -#endif - - serial_shell_init(); - log_set_level("all", LOG_LEVEL_WARN); - log_set_level("6top", LOG_LEVEL_INFO); - tsch_log_stop(); - -#if CONTIKI_TARGET_COOJA - is_coordinator = (node_id == 1); -#endif - - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - - sixtop_add_sf(&sf_plugtest); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/6tisch/etsi-plugtest-2017/project-conf.h b/examples/6tisch/etsi-plugtest-2017/project-conf.h deleted file mode 100644 index 93c5925b6..000000000 --- a/examples/6tisch/etsi-plugtest-2017/project-conf.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \author Simon Duquennoy - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -/* Set to enable TSCH security */ -#ifndef WITH_SECURITY -#define WITH_SECURITY 0 -#endif /* WITH_SECURITY */ - -/* IEEE802.15.4 PANID */ -#define IEEE802154_CONF_PANID 0x81a5 - -/* Do not start TSCH at init, wait for NETSTACK_MAC.on() */ -#define TSCH_CONF_AUTOSTART 0 - -/* 6TiSCH minimal schedule length. - * Larger values result in less frequent active slots: reduces capacity and saves energy. */ -#define TSCH_SCHEDULE_CONF_DEFAULT_LENGTH 11 - -#if WITH_SECURITY -/* Enable security */ -#define LLSEC802154_CONF_ENABLED 1 - -#define TSCH_SECURITY_CONF_K1 { 0x11, 0x11, 0x11, 0x11, \ - 0x11, 0x11, 0x11, 0x11, \ - 0x11, 0x11, 0x11, 0x11, \ - 0x11, 0x11, 0x11, 0x11 } -#define TSCH_SECURITY_CONF_K2 { 0x22, 0x22, 0x22, 0x22, \ - 0x22, 0x22, 0x22, 0x22, \ - 0x22, 0x22, 0x22, 0x22, \ - 0x22, 0x22, 0x22, 0x22 } -#endif /* WITH_SECURITY */ - -#define TSCH_CONF_MAC_MAX_FRAME_RETRIES 3 - -#define TSCH_CONF_DEFAULT_HOPPING_SEQUENCE (uint8_t[]){ 20 } -//#define TSCH_CONF_DEFAULT_HOPPING_SEQUENCE TSCH_HOPPING_SEQUENCE_16_16 - -#define TSCH_PACKET_CONF_EACK_WITH_SRC_ADDR 1 - -#define TSCH_PACKET_CONF_EB_WITH_SLOTFRAME_AND_LINK 1 - -#define TSCH_CONF_EB_PERIOD (1 * CLOCK_SECOND) -#define TSCH_CONF_MAX_EB_PERIOD (1 * CLOCK_SECOND) - -/*******************************************************/ -/******************* Configure 6top ********************/ -/*******************************************************/ - -#define TSCH_CONF_WITH_SIXTOP 1 -#define SF_PLUGTEST_SFID 0x00 -#define SF_PLUGTEST_TIMEOUT CLOCK_SECOND -#define SIXP_CONF_WITH_PAYLOAD_TERMINATION_IE 0 - -/*******************************************************/ -/************* Platform dependent configuration ********/ -/*******************************************************/ - -/* USB serial takes space, free more space elsewhere */ -#define SICSLOWPAN_CONF_FRAG 0 -#define UIP_CONF_BUFFER_SIZE 160 - -/*******************************************************/ -/******************* Configure 6LoWPAN/IPv6 ************/ -/*******************************************************/ - -#define UIP_CONF_IPV6_CHECKS 1 - -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_6LORH - -/*******************************************************/ -/************* Other system configuration **************/ -/*******************************************************/ - -/* Logging */ -#define LOG_CONF_LEVEL_RPL LOG_LEVEL_INFO -#define LOG_CONF_LEVEL_TCPIP LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_IPV6 LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_6LOWPAN LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_MAC LOG_LEVEL_INFO -#define LOG_CONF_LEVEL_FRAMER LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_6TOP LOG_LEVEL_DBG -#define TSCH_LOG_CONF_PER_SLOT 1 - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/6tisch/etsi-plugtest-2017/sf-plugtest.c b/examples/6tisch/etsi-plugtest-2017/sf-plugtest.c deleted file mode 100644 index 406178d71..000000000 --- a/examples/6tisch/etsi-plugtest-2017/sf-plugtest.c +++ /dev/null @@ -1,993 +0,0 @@ -/* - * Copyright (c) 2017, Toshiba Corporation - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#define LOG_MODULE "6top" -#define LOG_LEVEL LOG_LEVEL_6TOP - -#include -#include -#include -#include - -#define SIXP_PKT_BUFLEN 128 -static uint8_t sixp_pkt_buf[SIXP_PKT_BUFLEN]; - -static shell_output_func *shell_output = NULL; -/* this variable is used for LIST Request */ -static uint16_t cell_list_offset = 0; /* XXX: should be had in sixp_nbr */ - -typedef struct { - uint8_t slot_offset[2]; - uint8_t channel_offset[2]; -} sf_plugtest_cell_t; - -typedef struct { - sixp_pkt_cmd_t cmd; - linkaddr_t peer_addr; - uint16_t slot_offset; - uint16_t channel_offset; -} subcmd_args_t; - -typedef void subcmd(shell_output_func output, subcmd_args_t *args); - -typedef void (req_handler_t)(const linkaddr_t *peer_addr, - const uint8_t *body, size_t body_len); -typedef void (res_handler_t)(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc, - const uint8_t *body, size_t body_len); - -static void add_res_sent_callback(void *arg, uint16_t arg_len, - const linkaddr_t *dest_addr, - sixp_output_status_t status); -static void delete_res_sent_callback(void *arg, uint16_t arg_len, - const linkaddr_t *dest_addr, - sixp_output_status_t status); - -static void send_list_req(const linkaddr_t *peer_addr); - -static int add_cell(const linkaddr_t *peer_addr, const sf_plugtest_cell_t *cell, - uint8_t link_options); -static int delete_cell(const linkaddr_t *peer_addr, - const sf_plugtest_cell_t *cell); -static int reserve_cell(const linkaddr_t *peer_addr, - const sf_plugtest_cell_t *cell); -static void clear_cells(const linkaddr_t *peer_addr, - struct tsch_slotframe *slotframe); - -static void help(shell_output_func output, subcmd_args_t *args); -static void add_delete(shell_output_func output, subcmd_args_t *args); -static void count(shell_output_func output, subcmd_args_t *args); -static void list(shell_output_func output, subcmd_args_t *args); -static void clear(shell_output_func output, subcmd_args_t *args); - -static int parse_args(shell_output_func output, - char *args, const char **subcmd, - subcmd_args_t *subcmd_args); - -static const char subcmd_help[] = "help"; -static void shell_subcmd(shell_output_func output, char *args); - -static req_handler_t add_req_handler; -static res_handler_t add_res_handler; -static req_handler_t delete_req_handler; -static res_handler_t delete_res_handler; -static req_handler_t count_req_handler; -static res_handler_t count_res_handler; -static req_handler_t list_req_handler; -static res_handler_t list_res_handler; -static req_handler_t clear_req_handler; -static res_handler_t clear_res_handler; - -static const struct { - char *name; - subcmd *func; - sixp_pkt_cmd_t cmd; -} subcmds[] = { - { "help", help, SIXP_PKT_CMD_UNAVAILABLE }, - { "add", add_delete, SIXP_PKT_CMD_ADD }, - { "delete", add_delete, SIXP_PKT_CMD_DELETE }, - { "count", count, SIXP_PKT_CMD_COUNT }, - { "list", list, SIXP_PKT_CMD_LIST }, - { "clear", clear, SIXP_PKT_CMD_CLEAR }, - { NULL, NULL, SIXP_PKT_CMD_UNAVAILABLE } -}; - -static const struct { - sixp_pkt_cmd_t cmd; - req_handler_t *req; - res_handler_t *res; -} handlers[] = { - { SIXP_PKT_CMD_ADD, add_req_handler, add_res_handler }, - { SIXP_PKT_CMD_DELETE, delete_req_handler, delete_res_handler }, - { SIXP_PKT_CMD_COUNT, count_req_handler, count_res_handler }, - { SIXP_PKT_CMD_LIST, list_req_handler, list_res_handler }, - { SIXP_PKT_CMD_CLEAR, clear_req_handler, clear_res_handler }, - { SIXP_PKT_CMD_UNAVAILABLE, NULL, NULL } -}; - -static void -add_res_sent_callback(void *arg, uint16_t arg_len, - const linkaddr_t *dest_addr, - sixp_output_status_t status) -{ - if(arg_len != sizeof(sf_plugtest_cell_t) || - status == SIXP_OUTPUT_STATUS_FAILURE || - dest_addr == NULL) { - LOG_ERR("error in sending a response\n"); - } else { - add_cell(dest_addr, (sf_plugtest_cell_t *)arg, LINK_OPTION_RX); - } -} - -static void -delete_res_sent_callback(void *arg, uint16_t arg_len, - const linkaddr_t *dest_addr, - sixp_output_status_t status) -{ - if(arg_len != sizeof(sf_plugtest_cell_t) || - status == SIXP_OUTPUT_STATUS_FAILURE || - dest_addr == NULL) { - LOG_ERR("error in sending a response\n"); - } else { - delete_cell(dest_addr, (sf_plugtest_cell_t *)arg); - } -} - -static void -send_list_req(const linkaddr_t *peer_addr) -{ - const sixp_pkt_max_num_cells_t SF_PLUGTEST_MAC_NUM_CELLS = 1; - memset(&sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert(sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - SIXP_PKT_CELL_OPTION_TX, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert(sixp_pkt_set_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - (sixp_pkt_offset_t)cell_list_offset, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert(sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - SF_PLUGTEST_MAC_NUM_CELLS, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - SF_PLUGTEST_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_reserved_t) + - sizeof(sixp_pkt_offset_t) + - sizeof(sixp_pkt_max_num_cells_t), - peer_addr, - NULL, NULL, 0) == 0); -} - -static int -add_cell(const linkaddr_t *peer_addr, const sf_plugtest_cell_t *cell, - uint8_t link_options) -{ - struct tsch_slotframe *slotframe; - uint16_t timeslot; - uint16_t channel_offset; - - assert(peer_addr != NULL && cell != NULL); - if(peer_addr == NULL || cell == NULL) { - return -1; - } - - timeslot = cell->slot_offset[0] + (cell->slot_offset[1] << 8); - channel_offset = cell->channel_offset[0] + (cell->channel_offset[1] << 8); - - if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL || - tsch_schedule_add_link(slotframe, link_options, LINK_TYPE_NORMAL, - peer_addr, timeslot, channel_offset) == NULL) { - LOG_ERR("cannot add a cell\n"); - return -1; - } - LOG_INFO("Succeeded to add a cell [slot:%u]\n", timeslot); - - return 0; -} - -static int -delete_cell(const linkaddr_t *peer_addr, const sf_plugtest_cell_t *cell) -{ - struct tsch_slotframe *slotframe; - uint16_t timeslot; - - assert(peer_addr != NULL && cell != NULL); - if(peer_addr == NULL || cell == NULL) { - return -1; - } - - timeslot = cell->slot_offset[0] + (cell->slot_offset[1] << 8); - - if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL || - tsch_schedule_remove_link_by_timeslot(slotframe, timeslot) == 0) { - LOG_ERR("cannot delete a cell\n"); - return -1; - } - LOG_INFO("Succeeded to delete a cell [slot:%u]\n", timeslot); - - return 0; -} - -static int -reserve_cell(const linkaddr_t *peer_addr, const sf_plugtest_cell_t *cell) -{ - if(add_cell(peer_addr, cell, 0) < 0 || - delete_cell(peer_addr, cell) < 0) { - /* fail to reserve the cell */ - return -1; - } - return 0; -} - -static void -clear_cells(const linkaddr_t *peer_addr, struct tsch_slotframe *slotframe) -{ - struct tsch_link *cell, *next_cell; - - assert(peer_addr != NULL); - if(peer_addr == NULL) { - return; - } - for(cell = (struct tsch_link *)list_head(slotframe->links_list); - cell != NULL; cell = next_cell) { - next_cell = (struct tsch_link *)list_item_next(cell); - if(memcmp(&cell->addr, peer_addr, sizeof(linkaddr_t)) == 0) { - assert(tsch_schedule_remove_link(slotframe, cell) == 1); - } - } -} - -static void -add_req_handler(const linkaddr_t *peer_addr, - const uint8_t *body, size_t body_len) -{ - sixp_pkt_cell_options_t cell_options; - const uint8_t *cell; - sixp_pkt_offset_t cell_list_len; - static sf_plugtest_cell_t pending_cell; - uint16_t timeslot; - struct tsch_slotframe *slotframe; - - - assert(peer_addr != NULL && body != NULL); - if(body_len != (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t) + - sizeof(sf_plugtest_cell_t))) { - LOG_ERR("invalid Add Request length: %lu\n", (unsigned long)body_len); - } - assert( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &cell_options, - body, body_len) == 0); - if(cell_options != SIXP_PKT_CELL_OPTION_TX && - cell_options != (SIXP_PKT_CELL_OPTION_TX | SIXP_PKT_CELL_OPTION_SHARED)) { - LOG_ERR("invalid Cell Options: %u\n", cell_options); - } - assert( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &cell, &cell_list_len, body, body_len) == 0); - assert(cell_list_len == sizeof(sf_plugtest_cell_t)); - memcpy(&pending_cell, cell, sizeof(pending_cell)); - timeslot = pending_cell.slot_offset[0] + (pending_cell.slot_offset[1] << 8); - - if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL || - tsch_schedule_get_link_by_timeslot(slotframe, timeslot) != NULL || - reserve_cell(peer_addr, &pending_cell) < 0) { - LOG_ERR("Failed to add a cell [slot:%u]\n", timeslot); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR_BUSY, - SF_PLUGTEST_SFID, NULL, 0, peer_addr, - NULL, NULL, 0); - } else { - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - SF_PLUGTEST_SFID, cell, cell_list_len, peer_addr, - add_res_sent_callback, &pending_cell, sizeof(pending_cell)); - } -} - -static void -add_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc, - const uint8_t *body, size_t body_len) -{ - const uint8_t *cell; - sixp_pkt_offset_t cell_list_len; - uint16_t timeslot; - struct tsch_slotframe *slotframe; - - if(body_len != 4) { - LOG_ERR("invalid Add Response length: %lu\n", (unsigned long)body_len); - return; - } - - assert(sixp_pkt_get_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &cell, &cell_list_len, body, body_len) == 0); - timeslot = cell[0] + (cell[1] << 8); - - if(rc != SIXP_PKT_RC_SUCCESS) { - LOG_ERR("received return code of %u\n", rc); - return; - } - - if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL || - tsch_schedule_get_link_by_timeslot(slotframe, timeslot) != NULL || - add_cell(peer_addr, (sf_plugtest_cell_t *)cell, LINK_OPTION_TX) < 0) { - LOG_ERR("Failed to add a cell [slot:%u]\n", timeslot); - } -} - -static void -delete_req_handler(const linkaddr_t *peer_addr, - const uint8_t *body, size_t body_len) -{ - sixp_pkt_cell_options_t cell_options; - const uint8_t *cell; - sixp_pkt_offset_t cell_list_len; - static sf_plugtest_cell_t pending_cell; - uint16_t timeslot; - struct tsch_slotframe *slotframe; - struct tsch_link *link; - - - assert(peer_addr != NULL && body != NULL); - if(body_len != (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t) + - sizeof(sf_plugtest_cell_t))) { - LOG_ERR("invalid Delete Request length: %lu\n", (unsigned long)body_len); - } - assert( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &cell_options, - body, body_len) == 0); - if(cell_options != SIXP_PKT_CELL_OPTION_TX && - cell_options != (SIXP_PKT_CELL_OPTION_TX | SIXP_PKT_CELL_OPTION_SHARED)) { - LOG_ERR("invalid Cell Options: %u\n", cell_options); - } - assert( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &cell, &cell_list_len, body, body_len) == 0); - assert(cell_list_len == sizeof(sf_plugtest_cell_t)); - memcpy(&pending_cell, cell, sizeof(pending_cell)); - timeslot = pending_cell.slot_offset[0] + (pending_cell.slot_offset[1] << 8); - - if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL || - (link = tsch_schedule_get_link_by_timeslot(slotframe, timeslot)) == NULL || - memcmp(peer_addr, &link->addr, sizeof(linkaddr_t)) != 0) { - LOG_ERR("Failed to delete a cell [slot:%u]\n", timeslot); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR_BUSY, - SF_PLUGTEST_SFID, NULL, 0, peer_addr, - NULL, NULL, 0); - } else { - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - SF_PLUGTEST_SFID, cell, cell_list_len, peer_addr, - delete_res_sent_callback, &pending_cell, sizeof(pending_cell)); - } -} - -static void -delete_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc, - const uint8_t *body, size_t body_len) -{ - struct tsch_slotframe *slotframe; - struct tsch_link *link; - const sf_plugtest_cell_t *cell; - sixp_pkt_offset_t cell_list_len; - sixp_nbr_t *nbr; - uint16_t timeslot; - - if(body_len != 4) { - LOG_ERR("invalid Delete Response length: %lu\n", (unsigned long)body_len); - return; - } - - assert( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (const uint8_t **)&cell, &cell_list_len, - body, body_len) == 0); - timeslot = cell->slot_offset[0] + (cell->slot_offset[1] << 8); - - if((nbr = sixp_nbr_find(peer_addr)) == NULL) { - LOG_ERR("unexpected error; cannot find nbr\n"); - return; - } - - if(rc != SIXP_PKT_RC_SUCCESS) { - LOG_ERR("received return code of %u\n", rc); - return; - } - - if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL || - (link = tsch_schedule_get_link_by_timeslot(slotframe, timeslot)) == NULL || - memcmp(peer_addr, &link->addr, sizeof(linkaddr_t)) != 0 || - delete_cell(peer_addr, cell) < 0) { - LOG_ERR("Failed to delete a cell [slot:%u]\n", timeslot); - } -} - -static void -count_req_handler(const linkaddr_t *peer_addr, - const uint8_t *body, size_t body_len) -{ - sixp_pkt_cell_options_t cell_options; - struct tsch_slotframe *slotframe; - struct tsch_link *cell; - sixp_pkt_total_num_cells_t total_num_cells = 0; - uint8_t buf[2]; - - assert(peer_addr != NULL && body != NULL); - if(body_len != (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t))) { - LOG_ERR("invalid Count Request length: %lu\n", (unsigned long)body_len); - } - assert( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &cell_options, - body, body_len) == 0); - if(cell_options != SIXP_PKT_CELL_OPTION_TX && - cell_options != (SIXP_PKT_CELL_OPTION_TX | SIXP_PKT_CELL_OPTION_SHARED)) { - LOG_ERR("invalid Cell Options: %u\n", cell_options); - } - - if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL) { - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - SF_PLUGTEST_SFID, NULL, 0, peer_addr, - NULL, NULL, 0); - return; - } - - for(cell = (struct tsch_link *)list_head(slotframe->links_list); - cell != NULL; cell = (struct tsch_link *)list_item_next(cell)) { - if(memcmp(&cell->addr, peer_addr, sizeof(linkaddr_t)) == 0 && - cell->link_options == LINK_OPTION_RX) { - total_num_cells++; - } - } - - /* make sure total_num_cells are set in little-endian */ - buf[0] = (total_num_cells & 0xff); - buf[1] = (total_num_cells >> 8); - - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, SF_PLUGTEST_SFID, - (const uint8_t *)buf, sizeof(buf), - peer_addr, NULL, NULL, 0); -} - -static void -count_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc, - const uint8_t *body, size_t body_len) -{ - sixp_pkt_total_num_cells_t total_num_cells; - - if(body_len != 2) { - LOG_ERR("invalid Count Response length: %lu\n", (unsigned long)body_len); - return; - } - - if(rc != SIXP_PKT_RC_SUCCESS) { - LOG_ERR("received return code of %u\n", rc); - return; - } - - assert( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &total_num_cells, body, body_len) == 0); - - LOG_INFO("Succeeded to get COUNT: %u\n", total_num_cells); -} - -static void -list_req_handler(const linkaddr_t *peer_addr, - const uint8_t *body, size_t body_len) -{ - sixp_pkt_cell_options_t cell_options; - sixp_pkt_offset_t cell_list_offset; - sixp_pkt_max_num_cells_t max_num_cells; - - struct tsch_slotframe *slotframe; - struct tsch_link *link; - sixp_pkt_offset_t cell_nums; - sf_plugtest_cell_t cell; - - assert(peer_addr != NULL && body != NULL); - if(body_len != (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_reserved_t) + - sizeof(sixp_pkt_offset_t) + - sizeof(sixp_pkt_max_num_cells_t))) { - LOG_ERR("invalid List Request length: %lu\n", (unsigned long)body_len); - } - - assert( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &cell_options, - body, body_len) == 0); - assert( - sixp_pkt_get_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &cell_list_offset, - body, body_len) == 0); - assert( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &max_num_cells, - body, body_len) == 0); - - if(cell_options != SIXP_PKT_CELL_OPTION_TX && - cell_options != (SIXP_PKT_CELL_OPTION_TX | SIXP_PKT_CELL_OPTION_SHARED)) { - LOG_ERR("invalid Cell Options: %u\n", cell_options); - return; - } - - if(max_num_cells < 1) { - LOG_ERR("invalid MaxNumCells: %u\n", max_num_cells); - return; - } - - if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL) { - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - SF_PLUGTEST_SFID, NULL, 0, peer_addr, - NULL, NULL, 0); - return; - } - - cell_nums = 0; - for(link = (struct tsch_link *)list_head(slotframe->links_list); - link != NULL; link = (struct tsch_link *)list_item_next(link)) { - if(memcmp(&link->addr, peer_addr, sizeof(linkaddr_t)) == 0 && - link->link_options == LINK_OPTION_RX) { - if(cell_list_offset == cell_nums) { - cell.slot_offset[0] = link->timeslot & 0xff; - cell.slot_offset[1] = link->timeslot >> 8; - cell.channel_offset[0] = link->channel_offset & 0xff; - cell.channel_offset[1] = link->channel_offset >> 8; - } - cell_nums++; - } - } - - if(cell_nums == 0) { - assert(sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_EOL, - SF_PLUGTEST_SFID, NULL, 0, - peer_addr, NULL, NULL, 0) == 0); - } else { - assert(sixp_output(SIXP_PKT_TYPE_RESPONSE, - (cell_list_offset + 1) == cell_nums ? - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_EOL : - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - SF_PLUGTEST_SFID, - (const uint8_t *)&cell, sizeof(cell), - peer_addr, NULL, NULL, 0) == 0); - } -} - -static void -list_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc, - const uint8_t *body, size_t body_len) -{ - sf_plugtest_cell_t *cell; - uint16_t slot_offset, channel_offset; - sixp_pkt_offset_t cell_list_len; - sixp_pkt_offset_t i; - - assert(sixp_pkt_get_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)rc, - (const uint8_t **)&cell, &cell_list_len, - body, body_len) == 0); - - LOG_INFO("Succeeded to get LIST: "); - for(i = 0; i < cell_list_len; i += sizeof(sf_plugtest_cell_t)) { - slot_offset = cell->slot_offset[0] + (cell->slot_offset[1] << 8); - channel_offset = cell->channel_offset[0] + (cell->channel_offset[1] << 8); - LOG_INFO_("[slot:%u, channel:%u]", slot_offset, channel_offset); - } - - if(rc == SIXP_PKT_RC_SUCCESS) { - LOG_INFO_(" continued\n"); - cell_list_offset += (i / sizeof(sf_plugtest_cell_t)); - } else { - /* EOL */ - LOG_INFO_(" EOL\n"); - cell_list_offset = 0; - } -} - -static void -clear_req_handler(const linkaddr_t *peer_addr, - const uint8_t *body, size_t body_len) -{ - struct tsch_slotframe *slotframe; - sixp_nbr_t *nbr; - - assert(peer_addr != NULL && body != NULL); - if(body_len != sizeof(sixp_pkt_metadata_t)) { - LOG_ERR("invalid Clear Request length: %lu\n", (unsigned long)body_len); - } - - if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL) { - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - SF_PLUGTEST_SFID, NULL, 0, peer_addr, - NULL, NULL, 0); - return; - } - - clear_cells(peer_addr, slotframe); - - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - SF_PLUGTEST_SFID, NULL, 0, peer_addr, - NULL, NULL, 0); - - if((nbr = sixp_nbr_find(peer_addr)) != NULL) { - /* clear GEN */ - sixp_nbr_free(nbr); - } -} - -static void -clear_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc, - const uint8_t *body, size_t body_len) -{ - struct tsch_slotframe *slotframe; - sixp_nbr_t *nbr; - - assert(peer_addr != NULL && body != NULL); - - if(peer_addr == NULL) { - return; - } - - if(body_len != 0) { - LOG_ERR("invalid Clear Response length: %lu\n", (unsigned long)body_len); - return; - } - - if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) != NULL) { - clear_cells(peer_addr, slotframe); - } - if((nbr = sixp_nbr_find(peer_addr)) != NULL) { - /* clear GEN */ - sixp_nbr_free(nbr); - } - - LOG_INFO("Succeeded to CLEAR\n"); -} - -static void -help(shell_output_func output, subcmd_args_t *args) -{ - /* help doesn't use peer_addr */ - SHELL_OUTPUT(output, "cmd [slot_offset] [channel_offset] [peer_addr]\n"); - SHELL_OUTPUT(output, "available commands\n"); - SHELL_OUTPUT(output, "add - add a TX cell\n"); - SHELL_OUTPUT(output, "delete - delete a TX cell\n"); - SHELL_OUTPUT(output, "count - get cell count\n"); - SHELL_OUTPUT(output, "list - get a cell list\n"); - SHELL_OUTPUT(output, "clear - clear TX cells\n"); - SHELL_OUTPUT(output, "help - show this usage\n"); - SHELL_OUTPUT(output, "example> 6p add 4 5 01:01:01:01:01:01:01:01\n"); -} - -static void -add_delete(shell_output_func output, subcmd_args_t *args) -{ - assert(args != NULL); - sf_plugtest_cell_t cell; - - /* set cell attributes in little-endian */ - cell.slot_offset[0] = args->slot_offset & 0xff; - cell.slot_offset[1] = args->slot_offset >> 8; - cell.channel_offset[0] = args->channel_offset & 0xff; - cell.channel_offset[1] = args->channel_offset >> 8; - - if(args->cmd == SIXP_PKT_CMD_ADD && - reserve_cell(&(args->peer_addr), &cell) < 0) { - SHELL_OUTPUT(output, "invalid arguments for Add Request\n"); - return; - } - - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert(sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)args->cmd, - SIXP_PKT_CELL_OPTION_TX, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)args->cmd, - 1, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)args->cmd, - (const uint8_t *)&cell, - sizeof(cell), 0, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)args->cmd, - SF_PLUGTEST_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t) + - sizeof(cell), - &(args->peer_addr), - NULL, NULL, 0) == 0); - - SHELL_OUTPUT(output, "sent %s request [slot:%u, channel:%u]\n", - args->cmd == SIXP_PKT_CMD_ADD ? "an Add" : "a Delete", - args->slot_offset, args->channel_offset); -} - -static void -count(shell_output_func output, subcmd_args_t *args) -{ - memset(&sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert(sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)args->cmd, - SIXP_PKT_CELL_OPTION_TX, - sixp_pkt_buf, sizeof(sixp_pkt_buf)) == 0); - - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)args->cmd, - SF_PLUGTEST_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t), - &(args->peer_addr), - NULL, NULL, 0) == 0); - - SHELL_OUTPUT(output, "sent a Count request\n"); -} - -static void -list(shell_output_func output, subcmd_args_t *args) -{ - send_list_req(&(args->peer_addr)); - SHELL_OUTPUT(output, "sent a List request\n"); -} - -static void -clear(shell_output_func output, subcmd_args_t *args) -{ - cell_list_offset = 0; - memset(sixp_pkt_buf, 0, sizeof(sixp_pkt_buf)); - assert(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - SF_PLUGTEST_SFID, sixp_pkt_buf, - sizeof(sixp_pkt_metadata_t), - &(args->peer_addr), - NULL, NULL, 0) == 0); - SHELL_OUTPUT(output, "sent a Clear request\n"); -} - -static int -parse_args(shell_output_func output, - char *args, const char **subcmd, subcmd_args_t *subcmd_args) -{ - struct tsch_neighbor *time_source = NULL; - char *next_args; -#if CONTIKI_TARGET_COOJA - char *saveptr; - char *octet; - int i; -#endif /* CONTIKI_TARGET_COOJA */ - - SHELL_ARGS_INIT(args, next_args); - SHELL_ARGS_NEXT(args, next_args); - - if(args == NULL) { - *subcmd = subcmd_help; - } else { - *subcmd = args; - } - - if(strncmp("help", *subcmd, sizeof("help")) == 0) { - /* we don't need peer_addr for the help sub-command. */ - return 0; - } - - /* add and delete need slot_offset and channel_offset */ - if(strncmp("add", *subcmd, sizeof("add")) == 0 || - strncmp("delete", *subcmd, sizeof("delete")) == 0) { - SHELL_ARGS_NEXT(args, next_args); - if(args != NULL) { - subcmd_args->slot_offset = strtol(args, NULL, 10); - } else { - return -1; - } - SHELL_ARGS_NEXT(args, next_args); - if(args != NULL) { - subcmd_args->channel_offset = strtol(args, NULL, 10); - } else { - return -1; - } - } - - SHELL_ARGS_NEXT(args, next_args); - if(args != NULL) { -#if CONTIKI_TARGET_COOJA - for(octet = strtok_r(args, ":", &saveptr), i = 0; - octet != NULL && i < LINKADDR_SIZE; - octet = strtok_r(NULL, ":", &saveptr), i++) { - subcmd_args->peer_addr.u8[i] = strtol(octet, NULL, 16); - } - if(i > 1 && i != LINKADDR_SIZE) { - /* invalid MAC address */ - memset(&(subcmd_args->peer_addr), 0, sizeof(linkaddr_t)); - return -1; - } -#else - SHELL_OUTPUT(output, "MAC address cannot be specified on this platform\n"); - return -1; -#endif /* CONTIKI_TARGET_COOJA */ - } else { - if((time_source = tsch_queue_get_time_source()) == NULL) { - SHELL_OUTPUT(output, "time source is not available\n"); - return -1; - } else { - memcpy(&(subcmd_args->peer_addr), &(time_source->addr), - sizeof(linkaddr_t)); - } - } - - return 0; -} - -static void -shell_subcmd(shell_output_func output, char *args) -{ - const char *subcmd; - subcmd_args_t subcmd_args; - - int i; - - if(shell_output == NULL) { - shell_output = output; - } - - if(parse_args(output, args, &subcmd, &subcmd_args) < 0) { - SHELL_OUTPUT(output, - "invalid argument; command argument parse error\n"); - return; - } - - for(i = 0; subcmds[i].name != NULL; i++) { - if(strcmp(subcmds[i].name, subcmd) == 0) { - subcmd_args.cmd = subcmds[i].cmd; - subcmds[i].func(output, &subcmd_args); - } - } -} - -static void -init(void) -{ - shell_commands_set_6top_sub_cmd(shell_subcmd); -} - -static void -input(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *body, uint16_t body_len, - const linkaddr_t *src_addr) -{ - sixp_trans_t *trans; - sixp_pkt_cmd_t cmd; - int i; - - switch(type) { - case SIXP_PKT_TYPE_REQUEST: - cmd = code.cmd; - break; - case SIXP_PKT_TYPE_RESPONSE: - if((trans = sixp_trans_find(src_addr)) == NULL) { - LOG_ERR("internal error; cannot find a trans\n"); - return; - } - cmd = sixp_trans_get_cmd(trans); - break; - default: - LOG_ERR("unsupported type %u by sf-plugtest\n", type); - return; - } - - if(type == SIXP_PKT_TYPE_RESPONSE && - code.rc != SIXP_PKT_RC_SUCCESS && - cmd != SIXP_PKT_CMD_LIST && - code.rc != SIXP_PKT_RC_EOL) { - LOG_ERR("received return code of %u\n", code.value); - return; - } - - for(i = 0; i < sizeof(handlers); i++) { - if(handlers[i].cmd == cmd) { - if(type == SIXP_PKT_TYPE_REQUEST && handlers[i].req != NULL) { - handlers[i].req(src_addr, body, body_len); - return; - } - if(type == SIXP_PKT_TYPE_RESPONSE && handlers[i].res != NULL) { - handlers[i].res(src_addr, code.rc, body, body_len); - return; - } - i = sizeof(handlers); - break; - } - } - - if(i == sizeof(handlers)) { - LOG_ERR("unsupported command %u by sf-plugtest\n", - code.cmd); - } -} - -static void -timeout(sixp_pkt_cmd_t cmd, const linkaddr_t *peer_addr) -{ - LOG_ERR("transaction timeout\n"); -} - -const sixtop_sf_t sf_plugtest = { - SF_PLUGTEST_SFID, - SF_PLUGTEST_TIMEOUT, - init, - input, - timeout -}; diff --git a/examples/6tisch/etsi-plugtest-2017/sf-plugtest.h b/examples/6tisch/etsi-plugtest-2017/sf-plugtest.h deleted file mode 100644 index 7a723edbb..000000000 --- a/examples/6tisch/etsi-plugtest-2017/sf-plugtest.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2017, Toshiba Corporation - * 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 _SF_PLUGTEST_H_ -#define _SF_PLUGTEST_H_ - -#include -#include - -extern const sixtop_sf_t sf_plugtest; - -#endif /* _SF_PLUGTEST_H_ */ diff --git a/examples/6tisch/etsi-plugtest-2017/test-with-cooja-mote.csc b/examples/6tisch/etsi-plugtest-2017/test-with-cooja-mote.csc deleted file mode 100644 index e1102b2fa..000000000 --- a/examples/6tisch/etsi-plugtest-2017/test-with-cooja-mote.csc +++ /dev/null @@ -1,170 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - [APPS_DIR]/radiologger-headless - - ETSI Plugtest 2017 with Cooja Mote - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype205 - RPL/TSCH Node - [CONTIKI_DIR]/examples/6tisch/etsi-plugtest-2017/node.c - make TARGET=cooja clean - make TARGET=cooja MAKE_WITH_SIXTOP=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -1.285769821276336 - 38.58045647334346 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype205 - - - - org.contikios.cooja.interfaces.Position - 39.27770695164709 - 38.31253538173354 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - 6top list~;6top add 2 3~;log 6top 3~;6top add 2~;6top add~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype205 - - - - org.contikios.cooja.plugins.SimControl - 242 - 0 - 160 - 11 - 241 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 1.7405603810040515 0.0 0.0 1.7405603810040515 89.95980153208089 14.423865844552461 - - 236 - 2 - 230 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1031 - 4 - 394 - 273 - 6 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - - - - 16529.88882215865 - - 1304 - 5 - 311 - 0 - 412 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - - 500 - 3 - 300 - 255 - 141 - - - org.contikios.cooja.plugins.MoteInterfaceViewer - 1 - - Serial port - 0,0 - - 778 - 1 - 412 - 288 - 98 - - - diff --git a/examples/6tisch/simple-node/Makefile b/examples/6tisch/simple-node/Makefile deleted file mode 100644 index 06a83ebdd..000000000 --- a/examples/6tisch/simple-node/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -CONTIKI_PROJECT = node -all: $(CONTIKI_PROJECT) - -PLATFORMS_EXCLUDE = sky nrf52dk native simplelink - -CONTIKI=../../.. - - # force Orchestra from command line -MAKE_WITH_ORCHESTRA ?= 0 -# force Security from command line -MAKE_WITH_SECURITY ?= 0 - # print #routes periodically, used for regression tests -MAKE_WITH_PERIODIC_ROUTES_PRINT ?= 0 - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/services/shell - -ifeq ($(MAKE_WITH_ORCHESTRA),1) -MODULES += os/services/orchestra -endif - -ifeq ($(MAKE_WITH_SECURITY),1) -CFLAGS += -DWITH_SECURITY=1 -endif - -ifeq ($(MAKE_WITH_PERIODIC_ROUTES_PRINT),1) -CFLAGS += -DWITH_PERIODIC_ROUTES_PRINT=1 -endif - -include $(CONTIKI)/Makefile.include diff --git a/examples/6tisch/simple-node/README.md b/examples/6tisch/simple-node/README.md deleted file mode 100644 index e82db3d63..000000000 --- a/examples/6tisch/simple-node/README.md +++ /dev/null @@ -1,10 +0,0 @@ -A RPL+TSCH node. Will act as basic node by default, but can be configured at startup -using the user button and following instructions from the log output. Every press -of a button toggles the mode as 6ln, 6dr or 6dr-sec (detailled next). After 10s with -no button press, the node starts in the last setting. The modes are: -* 6ln (default): 6lowpan node, will join a RPL+TSCH network and act as router. -* 6dr: 6lowpan DAG Root, will start its own RPL+TSCH network. Note this is not a -border router, i.e. it does not have a serial interface with connection to -the Internet. For a border router, see ../border-router. -* 6dr-sec: 6lowpan DAG Root, starting a RPL+TSCH network with link-layer security -enabled. 6ln nodes are able to join both non-secured or secured networks. diff --git a/examples/6tisch/simple-node/node.c b/examples/6tisch/simple-node/node.c deleted file mode 100644 index b8e29e7f6..000000000 --- a/examples/6tisch/simple-node/node.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A RPL+TSCH node able to act as either a simple node (6ln), - * DAG Root (6dr) or DAG Root with security (6dr-sec) - * Press use button at startup to configure. - * - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "sys/node-id.h" -#include "sys/log.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/ipv6/uip-sr.h" -#include "net/mac/tsch/tsch.h" -#include "net/routing/routing.h" - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -/*---------------------------------------------------------------------------*/ -PROCESS(node_process, "RPL Node"); -AUTOSTART_PROCESSES(&node_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(node_process, ev, data) -{ - int is_coordinator; - - PROCESS_BEGIN(); - - is_coordinator = 0; - -#if CONTIKI_TARGET_COOJA || CONTIKI_TARGET_Z1 - is_coordinator = (node_id == 1); -#endif - - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - -#if WITH_PERIODIC_ROUTES_PRINT - { - static struct etimer et; - /* Print out routing tables every minute */ - etimer_set(&et, CLOCK_SECOND * 60); - while(1) { - /* Used for non-regression testing */ - #if (UIP_MAX_ROUTES != 0) - PRINTF("Routing entries: %u\n", uip_ds6_route_num_routes()); - #endif - #if (UIP_SR_LINK_NUM != 0) - PRINTF("Routing links: %u\n", uip_sr_num_nodes()); - #endif - PROCESS_YIELD_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - } - } -#endif /* WITH_PERIODIC_ROUTES_PRINT */ - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/6tisch/simple-node/project-conf.h b/examples/6tisch/simple-node/project-conf.h deleted file mode 100644 index 3771fb50f..000000000 --- a/examples/6tisch/simple-node/project-conf.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \author Simon Duquennoy - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -/* Set to enable TSCH security */ -#ifndef WITH_SECURITY -#define WITH_SECURITY 0 -#endif /* WITH_SECURITY */ - -/* USB serial takes space, free more space elsewhere */ -#define SICSLOWPAN_CONF_FRAG 0 -#define UIP_CONF_BUFFER_SIZE 160 - -/*******************************************************/ -/******************* Configure TSCH ********************/ -/*******************************************************/ - -/* IEEE802.15.4 PANID */ -#define IEEE802154_CONF_PANID 0x81a5 - -/* Do not start TSCH at init, wait for NETSTACK_MAC.on() */ -#define TSCH_CONF_AUTOSTART 0 - -/* 6TiSCH minimal schedule length. - * Larger values result in less frequent active slots: reduces capacity and saves energy. */ -#define TSCH_SCHEDULE_CONF_DEFAULT_LENGTH 3 - -#if WITH_SECURITY - -/* Enable security */ -#define LLSEC802154_CONF_ENABLED 1 - -#endif /* WITH_SECURITY */ - -/*******************************************************/ -/************* Other system configuration **************/ -/*******************************************************/ - -/* Logging */ -#define LOG_CONF_LEVEL_RPL LOG_LEVEL_INFO -#define LOG_CONF_LEVEL_TCPIP LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_IPV6 LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_6LOWPAN LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_MAC LOG_LEVEL_INFO -#define LOG_CONF_LEVEL_FRAMER LOG_LEVEL_DBG -#define TSCH_LOG_CONF_PER_SLOT 1 - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/6tisch/simple-node/rpl-tsch-cooja.csc b/examples/6tisch/simple-node/rpl-tsch-cooja.csc deleted file mode 100644 index bd5557214..000000000 --- a/examples/6tisch/simple-node/rpl-tsch-cooja.csc +++ /dev/null @@ -1,278 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - [APPS_DIR]/radiologger-headless - - RPL+TSCH - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype660 - RPL/TSCH Node - [CONTIKI_DIR]/examples/6tisch/simple-node/node.c - make TARGET=cooja clean - make TARGET=cooja node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -1.285769821276336 - 38.58045647334346 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype660 - - - - org.contikios.cooja.interfaces.Position - -19.324109516886306 - 76.23135780254927 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype660 - - - - org.contikios.cooja.interfaces.Position - 5.815501305791592 - 76.77463755494317 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype660 - - - - org.contikios.cooja.interfaces.Position - 31.920697784030082 - 50.5212265977149 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype660 - - - - org.contikios.cooja.interfaces.Position - 47.21747673247198 - 30.217765340599726 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype660 - - - - org.contikios.cooja.interfaces.Position - 10.622284947035123 - 109.81862399725188 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype660 - - - - org.contikios.cooja.interfaces.Position - 52.41150716335335 - 109.93228340481916 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype660 - - - - org.contikios.cooja.interfaces.Position - 70.18727461718498 - 70.06861701541145 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype660 - - - - org.contikios.cooja.interfaces.Position - 80.29870484201041 - 99.37351603835938 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype660 - - - - org.contikios.cooja.plugins.SimControl - 242 - 4 - 160 - 11 - 241 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 1.7405603810040515 0.0 0.0 1.7405603810040515 47.95980153208088 -42.576134155447555 - - 236 - 3 - 230 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1031 - 0 - 394 - 273 - 6 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - - - - 16529.88882215865 - - 1304 - 2 - 311 - 0 - 412 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - - 500 - 1 - 300 - 30 - 442 - - - diff --git a/examples/6tisch/sixtop/Makefile b/examples/6tisch/sixtop/Makefile deleted file mode 100644 index 1e6f0ef5f..000000000 --- a/examples/6tisch/sixtop/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -CONTIKI_PROJECT = node-sixtop -all: $(CONTIKI_PROJECT) - -PLATFORMS_EXCLUDE = sky z1 nrf52dk native simplelink - -PROJECT_SOURCEFILES += sf-simple.c -CONTIKI=../../.. - -MAKE_WITH_SECURITY ?= 0 # force Security from command line - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/net/mac/tsch/sixtop - -ifeq ($(MAKE_WITH_SECURITY),1) -CFLAGS += -DWITH_SECURITY=1 -endif - -include $(CONTIKI)/Makefile.include diff --git a/examples/6tisch/sixtop/README.md b/examples/6tisch/sixtop/README.md deleted file mode 100644 index fa390ff19..000000000 --- a/examples/6tisch/sixtop/README.md +++ /dev/null @@ -1,39 +0,0 @@ -6top Example Description ------------------------- - -A RPL+TSCH node will act as basic node by default, but can be configured at startup -using the user button and following instructions from the log output. Every press -of a button toggles the mode as 6ln, 6dr or 6dr-sec (detailled next). After 10s with -no button press, the node starts in the last setting. - -The modes are: - -* 6ln (default): 6lowpan node, will join a RPL+TSCH network and act as router. -* 6dr: 6lowpan DAG Root, will start its own RPL+TSCH network. Note this is not a - border router, i.e. it does not have a serial interface with connection to - the Internet. For a border router, see ../border-router. -* 6dr-sec: 6lowpan DAG Root, starting a RPL+TSCH network with link-layer security - enabled. 6ln nodes are able to join both non-secured or secured networks. - - -6top Operation ---------------- - -If the mode is 6ln (node) - -* The application triggers a 6P Add Request to 6dr (neighbor) -* Following this the application triggers another 6P Add Request to 6dr -* After an interval, the application triggers a 6P Delete Request to 6dr - -For the Cooja simulation, you may use the rpl-tsch-sixtop-cooja.csc file in this folder. -Once you run the simulation, "Mote output" window of Cooja simulator displays the -following messages. - -For a 6P Add transaction, - ID:1 TSCH-sixtop: Sixtop IE received - ID:1 TSCH-sixtop: Send Link Response to node 2 - ID:2 TSCH-sixtop: Sixtop IE received - ID:2 TSCH-sixtop: Schedule link x as RX with node 2 - ID:2 TSCH-sixtop: Schedule link x as TX with node 1 - -Similarly for a 6P Delete transaction. diff --git a/examples/6tisch/sixtop/node-sixtop.c b/examples/6tisch/sixtop/node-sixtop.c deleted file mode 100755 index e2dfe08c2..000000000 --- a/examples/6tisch/sixtop/node-sixtop.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * To test 6P transaction on a RPL+TSCH network - * - * \author - * Simon Duquennoy - * Shalu R - * Lijo Thomas - */ - -#include "contiki.h" -#include "sys/node-id.h" -#include "sys/log.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/mac/tsch/tsch.h" -#include "net/mac/tsch/sixtop/sixtop.h" -#include "net/routing/routing.h" - -#include "sf-simple.h" - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -/*---------------------------------------------------------------------------*/ -PROCESS(node_process, "RPL Node"); -AUTOSTART_PROCESSES(&node_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(node_process, ev, data) -{ - static int is_coordinator; - static int added_num_of_links = 0; - static struct etimer et; - struct tsch_neighbor *n; - - PROCESS_BEGIN(); - - is_coordinator = 0; - -#if CONTIKI_TARGET_COOJA - is_coordinator = (node_id == 1); -#endif - - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - - NETSTACK_MAC.on(); - sixtop_add_sf(&sf_simple_driver); - - etimer_set(&et, CLOCK_SECOND * 30); - while(1) { - PROCESS_YIELD_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - - /* Get time-source neighbor */ - n = tsch_queue_get_time_source(); - - if(!is_coordinator) { - if((added_num_of_links == 1) || (added_num_of_links == 3)) { - printf("App : Add a link\n"); - sf_simple_add_links(&n->addr, 1); - } else if(added_num_of_links == 5) { - printf("App : Delete a link\n"); - sf_simple_remove_links(&n->addr); - } - added_num_of_links++; - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/6tisch/sixtop/project-conf.h b/examples/6tisch/sixtop/project-conf.h deleted file mode 100755 index bb107175f..000000000 --- a/examples/6tisch/sixtop/project-conf.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -/* Set to enable TSCH security */ -#ifndef WITH_SECURITY -#define WITH_SECURITY 0 -#endif /* WITH_SECURITY */ - -/*******************************************************/ -/********************* Enable TSCH *********************/ -/*******************************************************/ - -/* Needed for CC2538 platforms only */ -/* For TSCH we have to use the more accurate crystal oscillator - * by default the RC oscillator is activated */ -#define SYS_CTRL_CONF_OSC32K_USE_XTAL 1 - -/* Needed for cc2420 platforms only */ -/* Disable DCO calibration (uses timerB) */ -#define DCOSYNCH_CONF_ENABLED 0 -/* Enable SFD timestamps (uses timerB) */ -#define CC2420_CONF_SFD_TIMESTAMPS 1 - -/* Enable Sixtop Implementation */ -#define TSCH_CONF_WITH_SIXTOP 1 - -/*******************************************************/ -/******************* Configure TSCH ********************/ -/*******************************************************/ - -/* IEEE802.15.4 PANID */ -#define IEEE802154_CONF_PANID 0xabcd - -/* Do not start TSCH at init, wait for NETSTACK_MAC.on() */ -#define TSCH_CONF_AUTOSTART 0 - -/* 6TiSCH schedule length */ -#define TSCH_SCHEDULE_CONF_DEFAULT_LENGTH 11 - -#if WITH_SECURITY - -/* Enable security */ -#define LLSEC802154_CONF_ENABLED 1 - -#endif /* WITH_SECURITY */ - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/6tisch/sixtop/rpl-tsch-sixtop-cooja.csc b/examples/6tisch/sixtop/rpl-tsch-sixtop-cooja.csc deleted file mode 100644 index 4ef875924..000000000 --- a/examples/6tisch/sixtop/rpl-tsch-sixtop-cooja.csc +++ /dev/null @@ -1,156 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - sixtop example - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype204 - node - [CONTIKI_DIR]/examples/6tisch/sixtop/node-sixtop.c - make node-sixtop.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 11.419305725331853 - 88.17983927138442 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype204 - - - - org.contikios.cooja.interfaces.Position - 36.65377213719183 - 57.06132448464071 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype204 - - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 4.580728081732807 0.0 0.0 4.580728081732807 74.39515112990499 -140.65513872038872 - - 401 - 0 - 400 - 0 - 1 - - - org.contikios.cooja.plugins.LogListener - - sf-simple - - - - 766 - 1 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - - - - 500.0 - - 1166 - 4 - 166 - 0 - 525 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 486 - 3 - 160 - 680 - 0 - - - diff --git a/examples/6tisch/sixtop/sf-simple.c b/examples/6tisch/sixtop/sf-simple.c deleted file mode 100644 index f7393ab4c..000000000 --- a/examples/6tisch/sixtop/sf-simple.c +++ /dev/null @@ -1,617 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * Copyright (c) 2016, Centre for Development of Advanced Computing (C-DAC). - * 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 - * A 6P Simple Schedule Function - * \author - * Shalu R - * Lijo Thomas - * Yasuyuki Tanaka - */ - -#include "contiki-lib.h" - -#include "lib/assert.h" -#include "net/mac/tsch/tsch.h" -#include "net/mac/tsch/sixtop/sixtop.h" -#include "net/mac/tsch/sixtop/sixp.h" -#include "net/mac/tsch/sixtop/sixp-nbr.h" -#include "net/mac/tsch/sixtop/sixp-pkt.h" -#include "net/mac/tsch/sixtop/sixp-trans.h" - -#include "sf-simple.h" - -#define DEBUG DEBUG_PRINT -#include "net/net-debug.h" - -typedef struct { - uint16_t timeslot_offset; - uint16_t channel_offset; -} sf_simple_cell_t; - -static const uint16_t slotframe_handle = 0; -static uint8_t res_storage[4 + SF_SIMPLE_MAX_LINKS * 4]; -static uint8_t req_storage[4 + SF_SIMPLE_MAX_LINKS * 4]; - -static void read_cell(const uint8_t *buf, sf_simple_cell_t *cell); -static void print_cell_list(const uint8_t *cell_list, uint16_t cell_list_len); -static void add_links_to_schedule(const linkaddr_t *peer_addr, - uint8_t link_option, - const uint8_t *cell_list, - uint16_t cell_list_len); -static void remove_links_to_schedule(const uint8_t *cell_list, - uint16_t cell_list_len); -static void add_response_sent_callback(void *arg, uint16_t arg_len, - const linkaddr_t *dest_addr, - sixp_output_status_t status); -static void delete_response_sent_callback(void *arg, uint16_t arg_len, - const linkaddr_t *dest_addr, - sixp_output_status_t status); -static void add_req_input(const uint8_t *body, uint16_t body_len, - const linkaddr_t *peer_addr); -static void delete_req_input(const uint8_t *body, uint16_t body_len, - const linkaddr_t *peer_addr); -static void input(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *body, uint16_t body_len, - const linkaddr_t *src_addr); -static void request_input(sixp_pkt_cmd_t cmd, - const uint8_t *body, uint16_t body_len, - const linkaddr_t *peer_addr); -static void response_input(sixp_pkt_rc_t rc, - const uint8_t *body, uint16_t body_len, - const linkaddr_t *peer_addr); - -/* - * scheduling policy: - * add: if and only if all the requested cells are available, accept the request - * delete: if and only if all the requested cells are in use, accept the request - */ - -static void -read_cell(const uint8_t *buf, sf_simple_cell_t *cell) -{ - cell->timeslot_offset = buf[0] + (buf[1] << 8); - cell->channel_offset = buf[2] + (buf[3] << 8); -} - -static void -print_cell_list(const uint8_t *cell_list, uint16_t cell_list_len) -{ - uint16_t i; - sf_simple_cell_t cell; - - for(i = 0; i < cell_list_len; i += sizeof(cell)) { - read_cell(&cell_list[i], &cell); - PRINTF("%u ", cell.timeslot_offset); - } -} - -static void -add_links_to_schedule(const linkaddr_t *peer_addr, uint8_t link_option, - const uint8_t *cell_list, uint16_t cell_list_len) -{ - /* add only the first valid cell */ - - sf_simple_cell_t cell; - struct tsch_slotframe *slotframe; - int i; - - assert(cell_list != NULL); - - slotframe = tsch_schedule_get_slotframe_by_handle(slotframe_handle); - - if(slotframe == NULL) { - return; - } - - for(i = 0; i < cell_list_len; i += sizeof(cell)) { - read_cell(&cell_list[i], &cell); - if(cell.timeslot_offset == 0xffff) { - continue; - } - - PRINTF("sf-simple: Schedule link %d as %s with node %u\n", - cell.timeslot_offset, - link_option == LINK_OPTION_RX ? "RX" : "TX", - peer_addr->u8[7]); - tsch_schedule_add_link(slotframe, - link_option, LINK_TYPE_NORMAL, peer_addr, - cell.timeslot_offset, cell.channel_offset); - break; - } -} - -static void -remove_links_to_schedule(const uint8_t *cell_list, uint16_t cell_list_len) -{ - /* remove all the cells */ - - sf_simple_cell_t cell; - struct tsch_slotframe *slotframe; - int i; - - assert(cell_list != NULL); - - slotframe = tsch_schedule_get_slotframe_by_handle(slotframe_handle); - - if(slotframe == NULL) { - return; - } - - for(i = 0; i < cell_list_len; i += sizeof(cell)) { - read_cell(&cell_list[i], &cell); - if(cell.timeslot_offset == 0xffff) { - continue; - } - - tsch_schedule_remove_link_by_timeslot(slotframe, - cell.timeslot_offset); - } -} - -static void -add_response_sent_callback(void *arg, uint16_t arg_len, - const linkaddr_t *dest_addr, - sixp_output_status_t status) -{ - uint8_t *body = (uint8_t *)arg; - uint16_t body_len = arg_len; - const uint8_t *cell_list; - uint16_t cell_list_len; - sixp_nbr_t *nbr; - - assert(body != NULL && dest_addr != NULL); - - if(status == SIXP_OUTPUT_STATUS_SUCCESS && - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &cell_list, &cell_list_len, - body, body_len) == 0 && - (nbr = sixp_nbr_find(dest_addr)) != NULL) { - add_links_to_schedule(dest_addr, LINK_OPTION_RX, - cell_list, cell_list_len); - } -} - -static void -delete_response_sent_callback(void *arg, uint16_t arg_len, - const linkaddr_t *dest_addr, - sixp_output_status_t status) -{ - uint8_t *body = (uint8_t *)arg; - uint16_t body_len = arg_len; - const uint8_t *cell_list; - uint16_t cell_list_len; - sixp_nbr_t *nbr; - - assert(body != NULL && dest_addr != NULL); - - if(status == SIXP_OUTPUT_STATUS_SUCCESS && - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &cell_list, &cell_list_len, - body, body_len) == 0 && - (nbr = sixp_nbr_find(dest_addr)) != NULL) { - remove_links_to_schedule(cell_list, cell_list_len); - } -} - -static void -add_req_input(const uint8_t *body, uint16_t body_len, const linkaddr_t *peer_addr) -{ - uint8_t i; - sf_simple_cell_t cell; - struct tsch_slotframe *slotframe; - int feasible_link; - uint8_t num_cells; - const uint8_t *cell_list; - uint16_t cell_list_len; - uint16_t res_len; - - assert(body != NULL && peer_addr != NULL); - - if(sixp_pkt_get_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &num_cells, - body, body_len) != 0 || - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &cell_list, &cell_list_len, - body, body_len) != 0) { - PRINTF("sf-simple: Parse error on add request\n"); - return; - } - - PRINTF("sf-simple: Received a 6P Add Request for %d links from node %d with LinkList : ", - num_cells, peer_addr->u8[7]); - print_cell_list(cell_list, cell_list_len); - PRINTF("\n"); - - slotframe = tsch_schedule_get_slotframe_by_handle(slotframe_handle); - if(slotframe == NULL) { - return; - } - - if(num_cells > 0 && cell_list_len > 0) { - memset(res_storage, 0, sizeof(res_storage)); - res_len = 0; - - /* checking availability for requested slots */ - for(i = 0, feasible_link = 0; - i < cell_list_len && feasible_link < num_cells; - i += sizeof(cell)) { - read_cell(&cell_list[i], &cell); - if(tsch_schedule_get_link_by_timeslot(slotframe, - cell.timeslot_offset) == NULL) { - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (uint8_t *)&cell, sizeof(cell), - feasible_link, - res_storage, sizeof(res_storage)); - res_len += sizeof(cell); - feasible_link++; - } - } - - if(feasible_link == num_cells) { - /* Links are feasible. Create Link Response packet */ - PRINTF("sf-simple: Send a 6P Response to node %d\n", peer_addr->u8[7]); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - SF_SIMPLE_SFID, - res_storage, res_len, peer_addr, - add_response_sent_callback, res_storage, res_len); - } - } -} - -static void -delete_req_input(const uint8_t *body, uint16_t body_len, - const linkaddr_t *peer_addr) -{ - uint8_t i; - sf_simple_cell_t cell; - struct tsch_slotframe *slotframe; - uint8_t num_cells; - const uint8_t *cell_list; - uint16_t cell_list_len; - uint16_t res_len; - int removed_link; - - assert(body != NULL && peer_addr != NULL); - - if(sixp_pkt_get_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &num_cells, - body, body_len) != 0 || - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &cell_list, &cell_list_len, - body, body_len) != 0) { - PRINTF("sf-simple: Parse error on delete request\n"); - return; - } - - PRINTF("sf-simple: Received a 6P Delete Request for %d links from node %d with LinkList : ", - num_cells, peer_addr->u8[7]); - print_cell_list(cell_list, cell_list_len); - PRINTF("\n"); - - slotframe = tsch_schedule_get_slotframe_by_handle(slotframe_handle); - if(slotframe == NULL) { - return; - } - - memset(res_storage, 0, sizeof(res_storage)); - res_len = 0; - - if(num_cells > 0 && cell_list_len > 0) { - /* ensure before delete */ - for(i = 0, removed_link = 0; i < cell_list_len; i += sizeof(cell)) { - read_cell(&cell_list[i], &cell); - if(tsch_schedule_get_link_by_timeslot(slotframe, - cell.timeslot_offset) != NULL) { - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - (uint8_t *)&cell, sizeof(cell), - removed_link, - res_storage, sizeof(res_storage)); - res_len += sizeof(cell); - } - } - } - - /* Links are feasible. Create Link Response packet */ - PRINTF("sf-simple: Send a 6P Response to node %d\n", peer_addr->u8[7]); - sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - SF_SIMPLE_SFID, - res_storage, res_len, peer_addr, - delete_response_sent_callback, res_storage, res_len); -} - -static void -input(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *body, uint16_t body_len, const linkaddr_t *src_addr) -{ - assert(body != NULL && body != NULL); - switch(type) { - case SIXP_PKT_TYPE_REQUEST: - request_input(code.cmd, body, body_len, src_addr); - break; - case SIXP_PKT_TYPE_RESPONSE: - response_input(code.cmd, body, body_len, src_addr); - break; - default: - /* unsupported */ - break; - } -} - -static void -request_input(sixp_pkt_cmd_t cmd, - const uint8_t *body, uint16_t body_len, - const linkaddr_t *peer_addr) -{ - assert(body != NULL && peer_addr != NULL); - - switch(cmd) { - case SIXP_PKT_CMD_ADD: - add_req_input(body, body_len, peer_addr); - break; - case SIXP_PKT_CMD_DELETE: - delete_req_input(body, body_len, peer_addr); - break; - default: - /* unsupported request */ - break; - } -} -static void -response_input(sixp_pkt_rc_t rc, - const uint8_t *body, uint16_t body_len, - const linkaddr_t *peer_addr) -{ - const uint8_t *cell_list; - uint16_t cell_list_len; - sixp_nbr_t *nbr; - sixp_trans_t *trans; - - assert(body != NULL && peer_addr != NULL); - - if((nbr = sixp_nbr_find(peer_addr)) == NULL || - (trans = sixp_trans_find(peer_addr)) == NULL) { - return; - } - - if(rc == SIXP_PKT_RC_SUCCESS) { - switch(sixp_trans_get_cmd(trans)) { - case SIXP_PKT_CMD_ADD: - if(sixp_pkt_get_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &cell_list, &cell_list_len, - body, body_len) != 0) { - PRINTF("sf-simple: Parse error on add response\n"); - return; - } - PRINTF("sf-simple: Received a 6P Add Response with LinkList : "); - print_cell_list(cell_list, cell_list_len); - PRINTF("\n"); - add_links_to_schedule(peer_addr, LINK_OPTION_TX, - cell_list, cell_list_len); - break; - case SIXP_PKT_CMD_DELETE: - if(sixp_pkt_get_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &cell_list, &cell_list_len, - body, body_len) != 0) { - PRINTF("sf-simple: Parse error on add response\n"); - return; - } - PRINTF("sf-simple: Received a 6P Delete Response with LinkList : "); - print_cell_list(cell_list, cell_list_len); - PRINTF("\n"); - remove_links_to_schedule(cell_list, cell_list_len); - break; - case SIXP_PKT_CMD_COUNT: - case SIXP_PKT_CMD_LIST: - case SIXP_PKT_CMD_CLEAR: - default: - PRINTF("sf-simple: unsupported response\n"); - } - } -} -/*---------------------------------------------------------------------------*/ -/* Initiates a Sixtop Link addition - */ -int -sf_simple_add_links(linkaddr_t *peer_addr, uint8_t num_links) -{ - uint8_t i = 0, index = 0; - struct tsch_slotframe *sf = - tsch_schedule_get_slotframe_by_handle(slotframe_handle); - - uint8_t req_len; - sf_simple_cell_t cell_list[SF_SIMPLE_MAX_LINKS]; - - /* Flag to prevent repeated slots */ - uint8_t slot_check = 1; - uint16_t random_slot = 0; - - assert(peer_addr != NULL && sf != NULL); - - do { - /* Randomly select a slot offset within TSCH_SCHEDULE_DEFAULT_LENGTH */ - random_slot = ((random_rand() & 0xFF)) % TSCH_SCHEDULE_DEFAULT_LENGTH; - - if(tsch_schedule_get_link_by_timeslot(sf, random_slot) == NULL) { - - /* To prevent repeated slots */ - for(i = 0; i < index; i++) { - if(cell_list[i].timeslot_offset != random_slot) { - /* Random selection resulted in a free slot */ - if(i == index - 1) { /* Checked till last index of link list */ - slot_check = 1; - break; - } - } else { - /* Slot already present in CandidateLinkList */ - slot_check++; - break; - } - } - - /* Random selection resulted in a free slot, add it to linklist */ - if(slot_check == 1) { - cell_list[index].timeslot_offset = random_slot; - cell_list[index].channel_offset = 0; - - index++; - slot_check++; - } else if(slot_check > TSCH_SCHEDULE_DEFAULT_LENGTH) { - PRINTF("sf-simple:! Number of trials for free slot exceeded...\n"); - return -1; - break; /* exit while loop */ - } - } - } while(index < SF_SIMPLE_MAX_LINKS); - - /* Create a Sixtop Add Request. Return 0 if Success */ - if(index == 0 ) { - return -1; - } - - memset(req_storage, 0, sizeof(req_storage)); - if(sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - SIXP_PKT_CELL_OPTION_TX, - req_storage, - sizeof(req_storage)) != 0 || - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - num_links, - req_storage, - sizeof(req_storage)) != 0 || - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - (const uint8_t *)cell_list, - index * sizeof(sf_simple_cell_t), 0, - req_storage, sizeof(req_storage)) != 0) { - PRINTF("sf-simple: Build error on add request\n"); - return -1; - } - - /* The length of fixed part is 4 bytes: Metadata, CellOptions, and NumCells */ - req_len = 4 + index * sizeof(sf_simple_cell_t); - sixp_output(SIXP_PKT_TYPE_REQUEST, (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - SF_SIMPLE_SFID, - req_storage, req_len, peer_addr, - NULL, NULL, 0); - - PRINTF("sf-simple: Send a 6P Add Request for %d links to node %d with LinkList : ", - num_links, peer_addr->u8[7]); - print_cell_list((const uint8_t *)cell_list, index * sizeof(sf_simple_cell_t)); - PRINTF("\n"); - - return 0; -} -/*---------------------------------------------------------------------------*/ -/* Initiates a Sixtop Link deletion - */ -int -sf_simple_remove_links(linkaddr_t *peer_addr) -{ - uint8_t i = 0, index = 0; - struct tsch_slotframe *sf = - tsch_schedule_get_slotframe_by_handle(slotframe_handle); - struct tsch_link *l; - - uint16_t req_len; - sf_simple_cell_t cell; - - assert(peer_addr != NULL && sf != NULL); - - for(i = 0; i < TSCH_SCHEDULE_DEFAULT_LENGTH; i++) { - l = tsch_schedule_get_link_by_timeslot(sf, i); - - if(l) { - /* Non-zero value indicates a scheduled link */ - if((linkaddr_cmp(&l->addr, peer_addr)) && (l->link_options == LINK_OPTION_TX)) { - /* This link is scheduled as a TX link to the specified neighbor */ - cell.timeslot_offset = i; - cell.channel_offset = l->channel_offset; - index++; - break; /* delete atmost one */ - } - } - } - - if(index == 0) { - return -1; - } - - memset(req_storage, 0, sizeof(req_storage)); - if(sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - 1, - req_storage, - sizeof(req_storage)) != 0 || - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - (const uint8_t *)&cell, sizeof(cell), - 0, - req_storage, sizeof(req_storage)) != 0) { - PRINTF("sf-simple: Build error on add request\n"); - return -1; - } - /* The length of fixed part is 4 bytes: Metadata, CellOptions, and NumCells */ - req_len = 4 + sizeof(sf_simple_cell_t); - - sixp_output(SIXP_PKT_TYPE_REQUEST, (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - SF_SIMPLE_SFID, - req_storage, req_len, peer_addr, - NULL, NULL, 0); - - PRINTF("sf-simple: Send a 6P Delete Request for %d links to node %d with LinkList : ", - 1, peer_addr->u8[7]); - print_cell_list((const uint8_t *)&cell, sizeof(cell)); - PRINTF("\n"); - - return 0; -} - -const sixtop_sf_t sf_simple_driver = { - SF_SIMPLE_SFID, - CLOCK_SECOND, - NULL, - input, - NULL -}; diff --git a/examples/6tisch/sixtop/sf-simple.h b/examples/6tisch/sixtop/sf-simple.h deleted file mode 100644 index d6321fc3f..000000000 --- a/examples/6tisch/sixtop/sf-simple.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * Copyright (c) 2016, Centre for Development of Advanced Computing (C-DAC). - * 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 - * A 6P Simple Schedule Function - * \author - * Shalu R - * Lijo Thomas - * Yasuyuki Tanaka - */ - -#ifndef _SIXTOP_SF_SIMPLE_H_ -#define _SIXTOP_SF_SIMPLE_H_ - -#include "net/linkaddr.h" - -int sf_simple_add_links(linkaddr_t *peer_addr, uint8_t num_links); -int sf_simple_remove_links(linkaddr_t *peer_addr); - -#define SF_SIMPLE_MAX_LINKS 3 -#define SF_SIMPLE_SFID 0xf0 -extern const sixtop_sf_t sf_simple_driver; - -#endif /* !_SIXTOP_SF_SIMPLE_H_ */ diff --git a/examples/6tisch/timesync-demo/Makefile b/examples/6tisch/timesync-demo/Makefile deleted file mode 100644 index 85c29659f..000000000 --- a/examples/6tisch/timesync-demo/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -CONTIKI_PROJECT = node -all: $(CONTIKI_PROJECT) - -CONTIKI=../../.. - -PLATFORMS_EXCLUDE = sky z1 nrf52dk native - -# force Orchestra from command line -MAKE_WITH_ORCHESTRA ?= 0 -# force Security from command line -MAKE_WITH_SECURITY ?= 0 - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/services/shell - -ifeq ($(MAKE_WITH_ORCHESTRA),1) -MODULES += os/services/orchestra -endif - -ifeq ($(MAKE_WITH_SECURITY),1) -CFLAGS += -DWITH_SECURITY=1 -endif - -include $(CONTIKI)/Makefile.include diff --git a/examples/6tisch/timesync-demo/README.md b/examples/6tisch/timesync-demo/README.md deleted file mode 100644 index cf130ee73..000000000 --- a/examples/6tisch/timesync-demo/README.md +++ /dev/null @@ -1,18 +0,0 @@ -This is a demonstration of application-level time synchronization using TSCH. - -In a TSCH network, all nodes are synchronized to a global time counter maintained -by the coordinator. This fact can be exploited to measure properties such as latency. - -The modes periodically send their detected network uptime to the coordinator. -The coordinator receives these packets, prints its local network uptime -and the time difference. This time difference is equal to the end-to-end latency, -which includes both the time to prepare the packet, the time until an appropriate -slot in the TSCH schedule, the over-the-air time (negligible). If the packet -does not arrive with the first attempt, it also includes the retransmission time. - -The nodes in this example do not have any notion of the wall-clock time. -That would need additional synchronization between the TSCH network and an external clock source. -For example, one can periodically distribute UNIX timestamps over the UART interface -on the border router to implement this feature. Alternatively, the data collected from -the TSCH network can be timestamped with just TSCH timestamps, and them on the external gateway -these timestamps could be converted to wall-clock time. \ No newline at end of file diff --git a/examples/6tisch/timesync-demo/node.c b/examples/6tisch/timesync-demo/node.c deleted file mode 100644 index 408421cec..000000000 --- a/examples/6tisch/timesync-demo/node.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * Copyright (c) 2018, University of Bristol - http://www.bristol.ac.uk - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A RPL+TSCH node demonstrating application-level time syncrhonization. - * - * \author Atis Elsts - * Simon Duquennoy - */ - -#include "contiki.h" -#include "net/routing/routing.h" -#include "net/netstack.h" -#include "net/ipv6/simple-udp.h" -#include "net/mac/tsch/tsch.h" -#include "lib/random.h" -#include "sys/node-id.h" - -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#define UDP_CLIENT_PORT 8765 -#define UDP_SERVER_PORT 5678 - -#define SEND_INTERVAL (60 * CLOCK_SECOND) -/*---------------------------------------------------------------------------*/ -static struct simple_udp_connection client_conn, server_conn; - -PROCESS(node_process, "RPL Node"); -AUTOSTART_PROCESSES(&node_process); -/*---------------------------------------------------------------------------*/ -static void -udp_rx_callback(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - uint64_t local_time_clock_ticks = tsch_get_network_uptime_ticks(); - uint64_t remote_time_clock_ticks; - - if(datalen >= sizeof(remote_time_clock_ticks)) { - memcpy(&remote_time_clock_ticks, data, sizeof(remote_time_clock_ticks)); - - LOG_INFO("Received from "); - LOG_INFO_6ADDR(sender_addr); - LOG_INFO_(", created at %lu, now %lu, latency %lu clock ticks\n", - (unsigned long)remote_time_clock_ticks, - (unsigned long)local_time_clock_ticks, - (unsigned long)(local_time_clock_ticks - remote_time_clock_ticks)); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(node_process, ev, data) -{ - static struct etimer periodic_timer; - int is_coordinator; - uip_ipaddr_t dest_ipaddr; - - PROCESS_BEGIN(); - - is_coordinator = 0; - -#if CONTIKI_TARGET_COOJA - is_coordinator = (node_id == 1); -#endif - - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - - /* Initialize UDP connections */ - simple_udp_register(&server_conn, UDP_SERVER_PORT, NULL, - UDP_CLIENT_PORT, udp_rx_callback); - simple_udp_register(&client_conn, UDP_CLIENT_PORT, NULL, - UDP_SERVER_PORT, NULL); - - NETSTACK_MAC.on(); - - etimer_set(&periodic_timer, random_rand() % SEND_INTERVAL); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - - if(tsch_is_coordinator) { - break; - } - - if(NETSTACK_ROUTING.node_is_reachable() && NETSTACK_ROUTING.get_root_ipaddr(&dest_ipaddr)) { - /* Send network uptime timestamp to the DAG root */ - uint64_t network_uptime; - network_uptime = tsch_get_network_uptime_ticks(); - simple_udp_sendto(&client_conn, &network_uptime, sizeof(network_uptime), &dest_ipaddr); - LOG_INFO("Sent network uptime timestamp %lu to ", (unsigned long)network_uptime); - LOG_INFO_6ADDR(&dest_ipaddr); - LOG_INFO_("\n"); - } else { - LOG_INFO("Not reachable yet\n"); - } - - /* Add some jitter */ - etimer_set(&periodic_timer, SEND_INTERVAL - - CLOCK_SECOND + (random_rand() % (2 * CLOCK_SECOND))); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/6tisch/timesync-demo/project-conf.h b/examples/6tisch/timesync-demo/project-conf.h deleted file mode 100644 index f787b8dfe..000000000 --- a/examples/6tisch/timesync-demo/project-conf.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * Copyright (c) 2018, University of Bristol - http://www.bristol.ac.uk - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \author Simon Duquennoy - * Atis Elsts - */ - -#ifndef __PROJECT_CONF_H__ -#define __PROJECT_CONF_H__ - -/* Set to enable TSCH security */ -#ifndef WITH_SECURITY -#define WITH_SECURITY 0 -#endif /* WITH_SECURITY */ - -/* USB serial takes space, free more space elsewhere */ -#define SICSLOWPAN_CONF_FRAG 0 -#define UIP_CONF_BUFFER_SIZE 160 - -/*******************************************************/ -/******************* Configure TSCH ********************/ -/*******************************************************/ - -/* IEEE802.15.4 PANID */ -#define IEEE802154_CONF_PANID 0x81a5 - -/* Do not start TSCH at init, wait for NETSTACK_MAC.on() */ -#define TSCH_CONF_AUTOSTART 0 - -/* 6TiSCH minimal schedule length. - * Larger values result in less frequent active slots: reduces capacity and saves energy. */ -#define TSCH_SCHEDULE_CONF_DEFAULT_LENGTH 3 - -#if WITH_SECURITY - -/* Enable security */ -#define LLSEC802154_CONF_ENABLED 1 - -#endif /* WITH_SECURITY */ - -/*******************************************************/ -/************* Other system configuration **************/ -/*******************************************************/ - -/* Logging */ -#define LOG_CONF_LEVEL_RPL LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_TCPIP LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_IPV6 LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_6LOWPAN LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_MAC LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_FRAMER LOG_LEVEL_WARN -#define TSCH_LOG_CONF_PER_SLOT 0 - -#endif /* __PROJECT_CONF_H__ */ diff --git a/examples/6tisch/tsch-stats/Makefile b/examples/6tisch/tsch-stats/Makefile deleted file mode 100644 index 156c0d526..000000000 --- a/examples/6tisch/tsch-stats/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CONTIKI_PROJECT = node -all: $(CONTIKI_PROJECT) - -CONTIKI=../../.. - -PLATFORMS_EXCLUDE = sky z1 nrf52dk native -BOARDS_EXCLUDE = srf06/cc13x0 launchpad/cc1310 launchpad/cc1350 sensortag/cc2650 sensortag/cc1350 - -# force Orchestra from command line -MAKE_WITH_ORCHESTRA ?= 0 -# force Security from command line -MAKE_WITH_SECURITY ?= 0 -# print #routes periodically, used for regression tests -MAKE_WITH_PERIODIC_ROUTES_PRINT ?= 0 - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/services/shell - -ifeq ($(MAKE_WITH_ORCHESTRA),1) -MODULES += os/services/orchestra -endif - -ifeq ($(MAKE_WITH_SECURITY),1) -CFLAGS += -DWITH_SECURITY=1 -endif - -ifeq ($(MAKE_WITH_PERIODIC_ROUTES_PRINT),1) -CFLAGS += -DWITH_PERIODIC_ROUTES_PRINT=1 -endif - -include $(CONTIKI)/Makefile.include diff --git a/examples/6tisch/tsch-stats/README.md b/examples/6tisch/tsch-stats/README.md deleted file mode 100644 index 1ee915f9d..000000000 --- a/examples/6tisch/tsch-stats/README.md +++ /dev/null @@ -1 +0,0 @@ -Demonstration of TSCH stats. \ No newline at end of file diff --git a/examples/6tisch/tsch-stats/node.c b/examples/6tisch/tsch-stats/node.c deleted file mode 100644 index 92b19306a..000000000 --- a/examples/6tisch/tsch-stats/node.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * Copyright (c) 2018, University of Bristol - http://www.bristol.ac.uk - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A RPL+TSCH node. - * - * \author Simon Duquennoy - * Atis Elsts - */ - -#include "contiki.h" -#include "sys/node-id.h" -#include "sys/log.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/ipv6/uip-sr.h" -#include "net/mac/tsch/tsch.h" -#include "net/routing/routing.h" - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -/*---------------------------------------------------------------------------*/ -PROCESS(node_process, "RPL Node"); -AUTOSTART_PROCESSES(&node_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(node_process, ev, data) -{ - int is_coordinator; - - PROCESS_BEGIN(); - - is_coordinator = 0; - -#if CONTIKI_TARGET_COOJA - is_coordinator = (node_id == 1); -#endif - - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - -#if WITH_PERIODIC_ROUTES_PRINT - { - static struct etimer et; - /* Print out routing tables every minute */ - etimer_set(&et, CLOCK_SECOND * 60); - while(1) { - /* Used for non-regression testing */ - #if (UIP_MAX_ROUTES != 0) - PRINTF("Routing entries: %u\n", uip_ds6_route_num_routes()); - #endif - #if (UIP_SR_LINK_NUM != 0) - PRINTF("Routing links: %u\n", uip_sr_num_nodes()); - #endif - PROCESS_YIELD_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - } - } -#endif /* WITH_PERIODIC_ROUTES_PRINT */ - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/6tisch/tsch-stats/project-conf.h b/examples/6tisch/tsch-stats/project-conf.h deleted file mode 100644 index f3e80dc99..000000000 --- a/examples/6tisch/tsch-stats/project-conf.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * Copyright (c) 2017, University of Bristol - http://www.bristol.ac.uk - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \author Simon Duquennoy - * Atis Elsts - */ - -#ifndef __PROJECT_CONF_H__ -#define __PROJECT_CONF_H__ - -/* Set to enable TSCH security */ -#ifndef WITH_SECURITY -#define WITH_SECURITY 0 -#endif /* WITH_SECURITY */ - -/* USB serial takes space, free more space elsewhere */ -#define SICSLOWPAN_CONF_FRAG 0 -#define UIP_CONF_BUFFER_SIZE 160 - -/*******************************************************/ -/******************* Configure TSCH ********************/ -/*******************************************************/ - -/* IEEE802.15.4 PANID */ -#define IEEE802154_CONF_PANID 0x81a5 - -/* Do not start TSCH at init, wait for NETSTACK_MAC.on() */ -#define TSCH_CONF_AUTOSTART 0 - -/* 6TiSCH minimal schedule length. - * Larger values result in less frequent active slots: reduces capacity and saves energy. */ -#define TSCH_SCHEDULE_CONF_DEFAULT_LENGTH 3 - -#if WITH_SECURITY - -/* Enable security */ -#define LLSEC802154_CONF_ENABLED 1 - -#endif /* WITH_SECURITY */ - -/* Enable TSCH statistics */ -#define TSCH_STATS_CONF_ON 1 - -/* Enable periodic RSSI sampling for TSCH statistics */ -#define TSCH_STATS_CONF_SAMPLE_NOISE_RSSI 1 - -/* Reduce the TSCH stat "decay to normal" period to get printouts more often */ -#define TSCH_STATS_CONF_DECAY_INTERVAL (60 * CLOCK_SECOND) - -/*******************************************************/ -/************* Other system configuration **************/ -/*******************************************************/ - -/* Logging */ -#define LOG_CONF_LEVEL_RPL LOG_LEVEL_INFO -#define LOG_CONF_LEVEL_TCPIP LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_IPV6 LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_6LOWPAN LOG_LEVEL_WARN -#define LOG_CONF_LEVEL_MAC LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_FRAMER LOG_LEVEL_INFO -#define TSCH_LOG_CONF_PER_SLOT 1 - -#endif /* __PROJECT_CONF_H__ */ diff --git a/examples/7/Makefile b/examples/7/Makefile deleted file mode 100644 index 0cf7c6541..000000000 --- a/examples/7/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = networking -PLATFORMS_ONLY = cc26x0-cc13x0 -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. - -PLATFORMS_EXCLUDE = nrf52dk - -#use this to enable TSCH: MAKE_MAC = MAKE_MAC_TSCH -MAKE_MAC ?= MAKE_MAC_CSMA -MAKE_NET = MAKE_NET_NULLNET -include $(CONTIKI)/Makefile.include diff --git a/examples/7/networking.c b/examples/7/networking.c deleted file mode 100644 index ed4ba859f..000000000 --- a/examples/7/networking.c +++ /dev/null @@ -1,65 +0,0 @@ -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" -#include -#include -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#include "os/dev/serial-line.h" -#include "os/net/linkaddr.h" -#include "arch/cpu/cc26x0-cc13x0/dev/cc26xx-uart.h" -//#include "os/dev/leds.h" -//#include "os/dev/button-hal.h" -#include "batmon-sensor.h" - -static linkaddr_t destination_address = {{ 0x00, 0x12, 0x4b, 0x00, 0x0f, 0x8f, 0x18, 0x11 }}; - -PROCESS(contiki_main_process, "Networking connectivity test"); -AUTOSTART_PROCESSES(&contiki_main_process); - -static void input_callback(const void* data, uint16_t len, const linkaddr_t* source_address, const linkaddr_t* destination_address) { - char received_data[strlen((char*)data) + 1]; - if (len == strlen((char*)data) + 1) { - memcpy(&received_data, data, strlen((char*)data) + 1); - LOG_INFO("Received \"%s\" from ", (char*)data); - LOG_INFO_LLADDR(source_address); - LOG_INFO("\n"); - } -} - -PROCESS_THREAD(contiki_main_process, ev, data) { - PROCESS_BEGIN(); - SENSORS_ACTIVATE(batmon_sensor); - - static int counter = 0; - static struct etimer my_timer; - static char message[128]; - - nullnet_buf = (uint8_t*)message; - nullnet_set_input_callback(input_callback); - - etimer_set(&my_timer, 5 * CLOCK_SECOND); - - cc26xx_uart_set_input(serial_line_input_byte); - serial_line_init(); - - printf("Hello world\n"); - - while (true) { - PROCESS_WAIT_EVENT(); - - if (ev == PROCESS_EVENT_TIMER) { - printf("Transmitting %d...\n", counter); - sprintf(message, "#%d Hello. It's me. -- by Adele", counter); - nullnet_len = strlen(message) + 1; - counter++; - NETSTACK_NETWORK.output(&destination_address); - etimer_reset(&my_timer); - } - } - - PROCESS_END(); -} - - diff --git a/examples/7/project-conf.h b/examples/7/project-conf.h deleted file mode 100644 index 3cbc0da86..000000000 --- a/examples/7/project-conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 25 -#define RF_BLE_CONF_ENABLED 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/NES-cooja-exercises/Makefile b/examples/NES-cooja-exercises/Makefile deleted file mode 100644 index f2fb3c3fb..000000000 --- a/examples/NES-cooja-exercises/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -CONTIKI_PROJECT = hello-world -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. - -include $(CONTIKI)/Makefile.include diff --git a/examples/NES-cooja-exercises/test-timers.c b/examples/NES-cooja-exercises/test-timers.c deleted file mode 100644 index dcee4cf90..000000000 --- a/examples/NES-cooja-exercises/test-timers.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" -#include -#include - - - diff --git a/examples/NES-launchpad-exercises/Makefile b/examples/NES-launchpad-exercises/Makefile deleted file mode 100644 index d8745cce8..000000000 --- a/examples/NES-launchpad-exercises/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = launchpad-exercises -PLATFORMS_ONLY = cc26x0-cc13x0 -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. - -PLATFORMS_EXCLUDE = nrf52dk - -#use this to enable TSCH: MAKE_MAC = MAKE_MAC_TSCH -MAKE_MAC ?= MAKE_MAC_CSMA -MAKE_NET = MAKE_NET_NULLNET -include $(CONTIKI)/Makefile.include diff --git a/examples/NES-launchpad-exercises/hello-world.c b/examples/NES-launchpad-exercises/hello-world.c deleted file mode 100644 index 6e0451a46..000000000 --- a/examples/NES-launchpad-exercises/hello-world.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" -#include -#include -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO diff --git a/examples/NES-launchpad-exercises/project-conf.h b/examples/NES-launchpad-exercises/project-conf.h deleted file mode 100644 index 3cbc0da86..000000000 --- a/examples/NES-launchpad-exercises/project-conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 25 -#define RF_BLE_CONF_ENABLED 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/benchmarks/rpl-req-resp/Makefile b/examples/benchmarks/rpl-req-resp/Makefile deleted file mode 100644 index dadd7a2d7..000000000 --- a/examples/benchmarks/rpl-req-resp/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CONTIKI_PROJECT = node -all: $(CONTIKI_PROJECT) - -PLATFORMS_EXCLUDE = sky z1 nrf52dk native simplelink -BOARDS_EXCLUDE = srf06/cc13x0 launchpad/cc1310 launchpad/cc1350 sensortag/cc2650 sensortag/cc1350 - -MODULES_REL += ../testbeds -MODULES += os/services/deployment -MODULES += os/services/simple-energest - -CONFIG?=CONFIG_TSCH_OPTIMS - -ifeq ($(CONFIG),CONFIG_CSMA) -MAKE_MAC = MAKE_MAC_CSMA -else ifeq ($(CONFIG),CONFIG_TSCH) -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/services/orchestra -else ifeq ($(CONFIG),CONFIG_TSCH_OPTIMS) -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/services/orchestra -CFLAGS += -DCONFIG_OPTIMS=1 -else ifeq ($(CONFIG),CONFIG_TSCH_OPTIMS2) -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/services/orchestra -CFLAGS += -DCONFIG_OPTIMS=2 -endif - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/benchmarks/rpl-req-resp/node.c b/examples/benchmarks/rpl-req-resp/node.c deleted file mode 100644 index bc7552797..000000000 --- a/examples/benchmarks/rpl-req-resp/node.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Benchmark: the root sends requests to all nodes in a randomized - * order, and receives resopnses back. - * \author - * Simon Duquennoy - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "services/deployment/deployment.h" - -#include - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#define UDP_PORT 8214 -#define SEND_INTERVAL (CLOCK_SECOND) - -static struct simple_udp_connection udp_conn; - -/*---------------------------------------------------------------------------*/ -PROCESS(app_process, "App process"); -AUTOSTART_PROCESSES(&app_process); - -/*---------------------------------------------------------------------------*/ -static void -udp_rx_callback(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - uint32_t count; - int is_response; - /* Copy and parse payload */ - memcpy(&count, data, sizeof(uint32_t)); - /* Most significant bit: request (0) / response (1) */ - is_response = count & 0x80000000; - count &= 0x7fffffff; - - if(is_response) { - LOG_INFO("Received response %"PRIu32" from ", count); - LOG_INFO_6ADDR(sender_addr); - LOG_INFO_("\n"); - } else { - LOG_INFO("Received request %"PRIu32" from ", count); - LOG_INFO_6ADDR(sender_addr); - LOG_INFO_("\n"); - LOG_INFO("Sending response %"PRIu32" to ", count); - LOG_INFO_6ADDR(sender_addr); - LOG_INFO_("\n"); - /* Set most significant bit to signal a response */ - count |= 0x80000000; - simple_udp_sendto(&udp_conn, &count, sizeof(count), sender_addr); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(app_process, ev, data) -{ - static struct etimer timer; - static uip_ipaddr_t dest_ipaddr; - - PROCESS_BEGIN(); - - /* Initialize UDP connection */ - simple_udp_register(&udp_conn, UDP_PORT, NULL, - UDP_PORT, udp_rx_callback); - - if(node_id == ROOT_ID) { - /* Wait 5 seconds before starting */ - etimer_set(&timer, CLOCK_SECOND * 5); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&timer)); - - /* We are the root, start a DAG */ - NETSTACK_ROUTING.root_start(); - /* Set dest_ipaddr with DODAG ID, so we get the prefix */ - NETSTACK_ROUTING.get_root_ipaddr(&dest_ipaddr); - /* Setup a periodic timer that expires after 10 seconds. */ - etimer_set(&timer, CLOCK_SECOND * 10); - /* Wait until all nodes have joined */ - do { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&timer)); - etimer_reset(&timer); - - if(deployment_node_count() > NETSTACK_MAX_ROUTE_ENTRIES) { - LOG_WARN("Not enough routing entries for deployment: %u/%u\n", - deployment_node_count(), NETSTACK_MAX_ROUTE_ENTRIES); - } - LOG_INFO("Node count: %u/%u\n", uip_sr_num_nodes(), deployment_node_count()); - - } while(uip_sr_num_nodes() < deployment_node_count()); - - /* Now start requesting nodes at random */ - etimer_set(&timer, SEND_INTERVAL); - while(uip_sr_num_nodes() == deployment_node_count()) { - static uint32_t count = 0; - uint16_t dest_id; - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&timer)); - etimer_reset(&timer); - - /* Select a destination at random. Iterate until we do not select ourselve */ - do { - dest_id = deployment_id_from_index(random_rand() % deployment_node_count()); - } while(dest_id == ROOT_ID); - /* Prefix was already set, set IID now */ - deployment_iid_from_id(&dest_ipaddr, dest_id); - - /* Request: most significant bit not unset */ - LOG_INFO("Sending request %"PRIu32" to ", count); - LOG_INFO_6ADDR(&dest_ipaddr); - LOG_INFO_("\n"); - simple_udp_sendto(&udp_conn, &count, sizeof(count), &dest_ipaddr); - count++; - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/benchmarks/rpl-req-resp/parse.py b/examples/benchmarks/rpl-req-resp/parse.py deleted file mode 100644 index dd36ef4c9..000000000 --- a/examples/benchmarks/rpl-req-resp/parse.py +++ /dev/null @@ -1,276 +0,0 @@ -#!/usr/bin/env python - -import re -import os -import fileinput -import math -import yaml -import pandas as pd -from pandas import * -from pylab import * -from datetime import * -from collections import OrderedDict -from IPython import embed -import matplotlib as mpl - -pd.set_option('display.max_rows', 48) -pd.set_option('display.width', None) -pd.set_option('display.max_columns', None) - -networkFormationTime = None -parents = {} - -def calculateHops(node): - hops = 0 - while(parents[node] != None): - node = parents[node] - hops += 1 - # safeguard, in case of scrambled logs - if hops > 50: - return hops - return hops - -def calculateChildren(node): - children = 0 - for n in parents.keys(): - if(parents[n] == node): - children += 1 - return children - -def updateTopology(child, parent): - global parents - if not child in parents: - parents[child] = {} - if not parent in parents: - parents[parent] = None - parents[child] = parent - -def parseRPL(log): - res = re.compile('.*? rank (\d*).*?dioint (\d*).*?nbr count (\d*)').match(log) - if res: - rank = int(res.group(1)) - trickle = (2**int(res.group(2)))/(60*1000.) - nbrCount = int(res.group(3)) - return {'event': 'rank', 'rank': rank, 'trickle': trickle } - res = re.compile('parent switch: .*? -> .*?-(\d*)$').match(log) - if res: - parent = int(res.group(1)) - return {'event': 'switch', 'pswitch': parent } - res = re.compile('sending a (.+?) ').match(log) - if res: - message = res.group(1) - return {'event': 'sending', 'message': message } - res = re.compile('links: 6G-(\d+)\s*to 6G-(\d+)').match(log) - if res: - child = int(res.group(1)) - parent = int(res.group(2)) - updateTopology(child, parent) - return None - res = re.compile('links: end of list').match(log) - if res: - # This was the last line, commit full topology - return {'event': 'topology' } - res = re.compile('initialized DAG').match(log) - if res: - return {'event': 'DAGinit' } - return None - -def parseEnergest(log): - res = re.compile('Radio Tx\s*:\s*(\d*)/\s*(\d+)').match(log) - if res: - tx = float(res.group(1)) - total = float(res.group(2)) - return {'channel-utilization': 100.*tx/total } - res = re.compile('Radio total\s*:\s*(\d*)/\s*(\d+)').match(log) - if res: - radio = float(res.group(1)) - total = float(res.group(2)) - return {'duty-cycle': 100.*radio/total } - return None - -def parseApp(log): - res = re.compile('Sending (.+?) (\d+) to 6G-(\d+)').match(log) - if res: - type = res.group(1) - id = int(res.group(2)) - dest = int(res.group(3)) - return {'event': 'send', 'type': type, 'id': id, 'node': dest } - res = re.compile('Received (.+?) (\d+) from 6G-(\d+)').match(log) - if res: - type = res.group(1) - id = int(res.group(2)) - src = int(res.group(3)) - return {'event': 'recv', 'type': type, 'id': id, 'src': src } - return None - -def parseLine(line): - res = re.compile('\s*([.\d]+)\\tID:(\d+)\\t\[(.*?):(.*?)\](.*)$').match(line) - if res: - time = float(res.group(1)) - nodeid = int(res.group(2)) - level = res.group(3).strip() - module = res.group(4).strip() - log = res.group(5).strip() - return time, nodeid, level, module, log - return None, None, None, None, None - -def doParse(file): - global networkFormationTime - - time = None - lastPrintedTime = 0 - - arrays = { - "packets": [], - "energest": [], - "ranks": [], - "trickle": [], - "switches": [], - "DAGinits": [], - "topology": [], - } - -# print("\nProcessing %s" %(file)) - # Filter out non-printable chars from log file - os.system("cat %s | tr -dc '[:print:]\n\t' | sponge %s" %(file, file)) - for line in open(file, 'r').readlines(): - # match time, id, module, log; The common format for all log lines - time, nodeid, level, module, log = parseLine(line) - - if time == None: - # malformed line - continue - - if time - lastPrintedTime >= 60: -# print("%u, "%(time / 60),end='', flush=True) - lastPrintedTime = time - - entry = { - "timestamp": timedelta(seconds=time), - "node": nodeid, - } - - try: - if module == "App": - ret = parseApp(log) - if(ret != None): - entry.update(ret) - if(ret['event'] == 'send' and ret['type'] == 'request'): - # populate series of sent requests - entry['pdr'] = 0. - arrays["packets"].append(entry) - if networkFormationTime == None: - networkFormationTime = time - elif(ret['event'] == 'recv' and ret['type'] == 'response'): - # update sent request series with latency and PDR - txElement = [x for x in arrays["packets"] if x['event']=='send' and x['id']==ret['id']][0] - txElement['latency'] = time - txElement['timestamp'].seconds - txElement['pdr'] = 100. - - if module == "Energest": - ret = parseEnergest(log) - if(ret != None): - entry.update(ret) - arrays["energest"].append(entry) - - if module == "RPL": - ret = parseRPL(log) - if(ret != None): - entry.update(ret) - if(ret['event'] == 'rank'): - arrays["ranks"].append(entry) - arrays["trickle"].append(entry) - elif(ret['event'] == 'switch'): - arrays["switches"].append(entry) - elif(ret['event'] == 'DAGinit'): - arrays["DAGinits"].append(entry) - elif(ret['event'] == 'sending'): - if not ret['message'] in arrays: - arrays[ret['message']] = [] - arrays[ret['message']].append(entry) - elif(ret['event'] == 'topology'): - for n in parents.keys(): - nodeEntry = entry.copy() - nodeEntry["node"] = n - nodeEntry["hops"] = calculateHops(n) - nodeEntry["children"] = calculateChildren(n) - arrays["topology"].append(nodeEntry) - except: # typical exception: failed str conversion to int, due to lossy logs - print("Exception: %s" %(str(sys.exc_info()[0]))) - continue - -# print("") - - # Remove last few packets -- might be in-flight when test stopped - arrays["packets"] = arrays["packets"][0:-10] - - dfs = {} - for key in arrays.keys(): - if(len(arrays[key]) > 0): - df = DataFrame(arrays[key]) - dfs[key] = df.set_index("timestamp") - - return dfs - -def outputStats(dfs, key, metric, agg, name, metricLabel = None): - if not key in dfs: - return - - df = dfs[key] - perNode = getattr(df.groupby("node")[metric], agg)() - perTime = getattr(df.groupby([pd.Grouper(freq="2Min")])[metric], agg)() - - print(" %s:" %(metricLabel if metricLabel != None else metric)) - print(" name: %s" %(name)) - print(" per-node:") - print(" x: [%s]" %(", ".join(["%u"%x for x in sort(df.node.unique())]))) - print(" y: [%s]" %(', '.join(["%.4f"%(x) for x in perNode]))) - print(" per-time:") - print(" x: [%s]" %(", ".join(["%u"%x for x in range(0, 2*len(df.groupby([pd.Grouper(freq="2Min")]).mean().index), 2)]))) - print(" y: [%s]" %(', '.join(["%.4f"%(x) for x in perTime]).replace("nan", "null"))) - -def main(): - if len(sys.argv) < 1: - return - else: - file = sys.argv[1].rstrip('/') - - # Parse the original log - dfs = doParse(file) - - if len(dfs) == 0: - return - - print("global-stats:") - print(" pdr: %.4f" %(dfs["packets"]["pdr"].mean())) - print(" loss-rate: %.e" %(1-(dfs["packets"]["pdr"].mean()/100))) - print(" packets-sent: %u" %(dfs["packets"]["pdr"].count())) - print(" packets-received: %u" %(dfs["packets"]["pdr"].sum()/100)) - print(" latency: %.4f" %(dfs["packets"]["latency"].mean())) - print(" duty-cycle: %.2f" %(dfs["energest"]["duty-cycle"].mean())) - print(" channel-utilization: %.2f" %(dfs["energest"]["channel-utilization"].mean())) - print(" network-formation-time: %.2f" %(networkFormationTime)) - print("stats:") - - # Output relevant metrics - outputStats(dfs, "packets", "pdr", "mean", "Round-trip PDR (%)") - outputStats(dfs, "packets", "latency", "mean", "Round-trip latency (s)") - - outputStats(dfs, "energest", "duty-cycle", "mean", "Radio duty cycle (%)") - outputStats(dfs, "energest", "channel-utilization", "mean", "Channel utilization (%)") - - outputStats(dfs, "ranks", "rank", "mean", "RPL rank (ETX-128)") - outputStats(dfs, "switches", "pswitch", "count", "RPL parent switches (#)") - outputStats(dfs, "DAGinits", "event", "count", "RPL joining DAG (#)") - outputStats(dfs, "trickle", "trickle", "mean", "RPL Trickle period (min)") - - outputStats(dfs, "DIS", "message", "count", "RPL DIS sent (#)", "rpl-dis") - outputStats(dfs, "unicast-DIO", "message", "count", "RPL uDIO sent (#)", "rpl-udio") - outputStats(dfs, "multicast-DIO", "message", "count", "RPL mDIO sent (#)", "rpl-mdio") - outputStats(dfs, "DAO", "message", "count", "RPL DAO sent (#)", "rpl-dao") - outputStats(dfs, "DAO-ACK", "message", "count", "RPL DAO-ACK sent (#)", "rpl-daoack") - - outputStats(dfs, "topology", "hops", "mean", "RPL hop count (#)") - outputStats(dfs, "topology", "children", "mean", "RPL children count (#)") - -main() diff --git a/examples/benchmarks/rpl-req-resp/project-conf.h b/examples/benchmarks/rpl-req-resp/project-conf.h deleted file mode 100644 index 1140bb9e5..000000000 --- a/examples/benchmarks/rpl-req-resp/project-conf.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -/* Testbed configuration */ -#define ROOT_ID 1 -#if CONTIKI_TARGET_COOJA -#define DEPLOYMENT_MAPPING deployment_cooja8 -#else /* CONTIKI_TARGET_COOJA */ -#define DEPLOYMENT_MAPPING deployment_sics_firefly -#endif /* CONTIKI_TARGET_COOJA */ -#define IEEE802154_CONF_PANID 0x8921 - -/* Logging */ -#define LOG_CONF_LEVEL_RPL LOG_LEVEL_INFO -#define LOG_CONF_LEVEL_MAC LOG_LEVEL_WARN -#define LOG_CONF_WITH_COMPACT_ADDR 1 - -/* Provisioning */ -#define NETSTACK_MAX_ROUTE_ENTRIES 25 -#define NBR_TABLE_CONF_MAX_NEIGHBORS 8 - -#if CONFIG_OPTIMS >= 1 - -/* RPL configuration */ -#define RPL_MRHOF_CONF_SQUARED_ETX 1 -#define RPL_CONF_MAX_RANKINC 0 - -/* TSCH configuration */ -#define TSCH_CONF_RX_WAIT 1000 -#define ORCHESTRA_CONF_UNICAST_PERIOD 7 - -#if CONFIG_OPTIMS == 2 - -/* Five nines reliability paper used the config below */ -#define RPL_CONF_DIO_INTERVAL_MIN 14 /* 2^14 ms = 16.384 s */ -#define RPL_CONF_DIO_INTERVAL_DOUBLINGS 6 /* 2^(14+6) ms = 1048.576 s */ -#define RPL_CONF_PROBING_INTERVAL (60 * CLOCK_SECOND) - -/* Five nines reliability paper used the config below */ -#define TSCH_CONF_KEEPALIVE_TIMEOUT (20 * CLOCK_SECOND) -#define TSCH_CONF_MAX_KEEPALIVE_TIMEOUT (60 * CLOCK_SECOND) -//#define TSCH_CONF_EB_PERIOD (16 * CLOCK_SECOND) -//#define TSCH_CONF_MAX_EB_PERIOD (50 * CLOCK_SECOND) - -#endif -#endif - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/benchmarks/rpl-req-resp/sim.csc b/examples/benchmarks/rpl-req-resp/sim.csc deleted file mode 100644 index d973a1d8d..000000000 --- a/examples/benchmarks/rpl-req-resp/sim.csc +++ /dev/null @@ -1,275 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype90 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/benchmarks/rpl-req-resp/node.c - make node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 12.478629242391953 - 42.201041276604826 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 25.625935608473608 - 82.53975431376661 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 51.615094138350024 - 59.70602651475372 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 41.04314122620578 - 121.24693889311891 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 64.9463558635099 - 104.25039302469283 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 93.59263858654369 - 75.40399148300003 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 75.6297158696234 - 139.97002035548905 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 104.34293924684245 - 116.07658566915099 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 2.4250860844175466 0.0 0.0 2.4250860844175466 35.26895372864869 -46.9106236441515 - - 400 - 3 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - App - - - - 827 - 0 - 665 - 681 - -1 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - - - 500.0 - - 1539 - 1 - 263 - 0 - 709 - - diff --git a/examples/benchmarks/testbeds/cooja8.c b/examples/benchmarks/testbeds/cooja8.c deleted file mode 100644 index f6ccaec97..000000000 --- a/examples/benchmarks/testbeds/cooja8.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "services/deployment/deployment.h" - -/** \brief A mapping table for a 8-node Cooja mote simulation. */ -const struct id_mac deployment_cooja8[] = { - { 1, {{0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01}}}, - { 2, {{0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02}}}, - { 3, {{0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03}}}, - { 4, {{0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04}}}, - { 5, {{0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05}}}, - { 6, {{0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06}}}, - { 7, {{0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07}}}, - { 8, {{0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08}}}, - { 0, {{0}}} -}; diff --git a/examples/benchmarks/testbeds/sics-firefly.c b/examples/benchmarks/testbeds/sics-firefly.c deleted file mode 100644 index 0478dc65d..000000000 --- a/examples/benchmarks/testbeds/sics-firefly.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "services/deployment/deployment.h" - -/** \brief The 25-node RISE SICS node testbed. Firefly-reva nodes. */ -const struct id_mac deployment_sics_firefly[] = { - { 1, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb6,0x14}}}, - { 2, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0xe7}}}, - { 3, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb4,0x35}}}, - { 4, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0xcf}}}, - { 5, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb2,0x06}}}, - { 6, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0x5f}}}, - { 8, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0x91}}}, - { 7, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0x29}}}, - { 9, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0xc6}}}, - { 10, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0x63}}}, - { 12, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb2,0x03}}}, - { 11, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb4,0x3b}}}, - { 13, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb6,0x0d}}}, - { 14, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb5,0x66}}}, - { 15, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb5,0x8a}}}, - { 16, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb4,0x49}}}, - { 17, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0x35}}}, - { 18, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb2,0x15}}}, - { 19, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb5,0xfc}}}, - { 20, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0xa8}}}, - { 21, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0x6a}}}, - { 22, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb4,0x5b}}}, - { 23, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0xe6}}}, - { 24, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb6,0x00}}}, - { 25, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0xb8}}}, - { 0, {{0}}} -}; diff --git a/examples/coap/README.md b/examples/coap/README.md deleted file mode 100644 index 7d0ac47d2..000000000 --- a/examples/coap/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# CoAP examples: client, server, and plugtest server - -* coap-example-server: A CoAP server example showing how to use the CoAP layer to develop server-side applications. -* coap-example-client: A CoAP client that polls the /actuators/toggle resource every 10 seconds and cycles through 4 resources on button press (target address is hard-coded). -* coap-plugtest-server: The server used for draft compliance testing at ETSI IoT CoAP Plugtests. Erbium (Er) participated in Paris, France, March 2012 and Sophia-Antipolis, France, November 2012 (configured for native). - -The examples can run either on a real device or as native. -In the latter case, just start the executable with enough permissions (e.g. sudo), and you will then be able to reach the node via tun. -A tutorial for setting up the CoAP server example and querying it is provided on the wiki. diff --git a/examples/coap/coap-example-client/Makefile b/examples/coap/coap-example-client/Makefile deleted file mode 100644 index 21c9649e7..000000000 --- a/examples/coap/coap-example-client/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = coap-example-client -# coap-example-observe-client is outdated but will be ported at a later point -all: $(CONTIKI_PROJECT) - -# Do not try to build on Sky because of code size limitation -PLATFORMS_EXCLUDE = sky z1 - -# Include the CoAP implementation -MODULES += os/net/app-layer/coap - -CONTIKI=../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/coap/coap-example-client/coap-example-client.c b/examples/coap/coap-example-client/coap-example-client.c deleted file mode 100644 index 645283093..000000000 --- a/examples/coap/coap-example-client/coap-example-client.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Erbium (Er) CoAP client example. - * \author - * Matthias Kovatsch - */ - -#include -#include -#include -#include "contiki.h" -#include "contiki-net.h" -#include "coap-engine.h" -#include "coap-blocking-api.h" -#if PLATFORM_SUPPORTS_BUTTON_HAL -#include "dev/button-hal.h" -#else -#include "dev/button-sensor.h" -#endif - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_APP - -/* FIXME: This server address is hard-coded for Cooja and link-local for unconnected border router. */ -#define SERVER_EP "coap://[fe80::212:7402:0002:0202]" - -#define TOGGLE_INTERVAL 10 - -PROCESS(er_example_client, "Erbium Example Client"); -AUTOSTART_PROCESSES(&er_example_client); - -static struct etimer et; - -/* Example URIs that can be queried. */ -#define NUMBER_OF_URLS 4 -/* leading and ending slashes only for demo purposes, get cropped automatically when setting the Uri-Path */ -char *service_urls[NUMBER_OF_URLS] = -{ ".well-known/core", "/actuators/toggle", "battery/", "error/in//path" }; -#if PLATFORM_HAS_BUTTON -static int uri_switch = 0; -#endif - -/* This function is will be passed to COAP_BLOCKING_REQUEST() to handle responses. */ -void -client_chunk_handler(coap_message_t *response) -{ - const uint8_t *chunk; - - int len = coap_get_payload(response, &chunk); - - printf("|%.*s", len, (char *)chunk); -} -PROCESS_THREAD(er_example_client, ev, data) -{ - static coap_endpoint_t server_ep; - PROCESS_BEGIN(); - - static coap_message_t request[1]; /* This way the packet can be treated as pointer as usual. */ - - coap_endpoint_parse(SERVER_EP, strlen(SERVER_EP), &server_ep); - - etimer_set(&et, TOGGLE_INTERVAL * CLOCK_SECOND); - -#if PLATFORM_HAS_BUTTON -#if !PLATFORM_SUPPORTS_BUTTON_HAL - SENSORS_ACTIVATE(button_sensor); -#endif - printf("Press a button to request %s\n", service_urls[uri_switch]); -#endif /* PLATFORM_HAS_BUTTON */ - - while(1) { - PROCESS_YIELD(); - - if(etimer_expired(&et)) { - printf("--Toggle timer--\n"); - - /* prepare request, TID is set by COAP_BLOCKING_REQUEST() */ - coap_init_message(request, COAP_TYPE_CON, COAP_POST, 0); - coap_set_header_uri_path(request, service_urls[1]); - - const char msg[] = "Toggle!"; - - coap_set_payload(request, (uint8_t *)msg, sizeof(msg) - 1); - - LOG_INFO_COAP_EP(&server_ep); - LOG_INFO_("\n"); - - COAP_BLOCKING_REQUEST(&server_ep, request, client_chunk_handler); - - printf("\n--Done--\n"); - - etimer_reset(&et); - -#if PLATFORM_HAS_BUTTON -#if PLATFORM_SUPPORTS_BUTTON_HAL - } else if(ev == button_hal_release_event) { -#else - } else if(ev == sensors_event && data == &button_sensor) { -#endif - - /* send a request to notify the end of the process */ - - coap_init_message(request, COAP_TYPE_CON, COAP_GET, 0); - coap_set_header_uri_path(request, service_urls[uri_switch]); - - printf("--Requesting %s--\n", service_urls[uri_switch]); - - LOG_INFO_COAP_EP(&server_ep); - LOG_INFO_("\n"); - - COAP_BLOCKING_REQUEST(&server_ep, request, - client_chunk_handler); - - printf("\n--Done--\n"); - - uri_switch = (uri_switch + 1) % NUMBER_OF_URLS; -#endif /* PLATFORM_HAS_BUTTON */ - } - } - - PROCESS_END(); -} diff --git a/examples/coap/coap-example-client/coap-example-observe-client.c b/examples/coap/coap-example-client/coap-example-observe-client.c deleted file mode 100644 index 3b6eb9871..000000000 --- a/examples/coap/coap-example-client/coap-example-observe-client.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2014, Daniele Alessandrelli. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Erbium (Er) CoAP observe client example. - * \author - * Daniele Alessandrelli - */ - -#include -#include -#include -#include "contiki.h" -#include "contiki-net.h" -#include "coap-engine.h" -#if PLATFORM_SUPPORTS_BUTTON_HAL -#include "dev/button-hal.h" -#else -#include "dev/button-sensor.h" -#endif - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_APP - -/*----------------------------------------------------------------------------*/ -/* FIXME: This server address is hard-coded for Cooja */ -#define SERVER_NODE(ipaddr) uip_ip6addr(ipaddr, 0xfe80, 0, 0, 0, 0x0212, \ - 0x7402, 0x0002, 0x0202) -#define REMOTE_PORT UIP_HTONS(COAP_DEFAULT_PORT) -/* Toggle interval in seconds */ -#define TOGGLE_INTERVAL 30 -/* The path of the resource to observe */ -#define OBS_RESOURCE_URI "test/push" - -/*----------------------------------------------------------------------------*/ -static uip_ipaddr_t server_ipaddr[1]; /* holds the server ip address */ -static coap_observee_t *obs; - -/*----------------------------------------------------------------------------*/ -PROCESS(er_example_observe_client, "Erbium Coap Observe Client Example"); -AUTOSTART_PROCESSES(&er_example_observe_client); - -/*----------------------------------------------------------------------------*/ -/* - * Handle the response to the observe request and the following notifications - */ -static void -notification_callback(coap_observee_t *obs, void *notification, - coap_notification_flag_t flag) -{ - int len = 0; - const uint8_t *payload = NULL; - - printf("Notification handler\n"); - printf("Observee URI: %s\n", obs->url); - if(notification) { - len = coap_get_payload(notification, &payload); - } - switch(flag) { - case NOTIFICATION_OK: - printf("NOTIFICATION OK: %*s\n", len, (char *)payload); - break; - case OBSERVE_OK: /* server accepeted observation request */ - printf("OBSERVE_OK: %*s\n", len, (char *)payload); - break; - case OBSERVE_NOT_SUPPORTED: - printf("OBSERVE_NOT_SUPPORTED: %*s\n", len, (char *)payload); - obs = NULL; - break; - case ERROR_RESPONSE_CODE: - printf("ERROR_RESPONSE_CODE: %*s\n", len, (char *)payload); - obs = NULL; - break; - case NO_REPLY_FROM_SERVER: - printf("NO_REPLY_FROM_SERVER: " - "removing observe registration with token %x%x\n", - obs->token[0], obs->token[1]); - obs = NULL; - break; - } -} -/*----------------------------------------------------------------------------*/ -/* - * Toggle the observation of the remote resource - */ -void -toggle_observation(void) -{ - if(obs) { - printf("Stopping observation\n"); - coap_obs_remove_observee(obs); - obs = NULL; - } else { - printf("Starting observation\n"); - obs = coap_obs_request_registration(server_ipaddr, REMOTE_PORT, - OBS_RESOURCE_URI, notification_callback, NULL); - } -} -/*----------------------------------------------------------------------------*/ -/* - * The main (proto-)thread. It starts/stops the observation of the remote - * resource every time the timer elapses or the button (if available) is - * pressed - */ -PROCESS_THREAD(er_example_observe_client, ev, data) -{ - PROCESS_BEGIN(); - - static struct etimer et; - - /* store server address in server_ipaddr */ - SERVER_NODE(server_ipaddr); - /* init timer and button (if available) */ - etimer_set(&et, TOGGLE_INTERVAL * CLOCK_SECOND); -#if PLATFORM_HAS_BUTTON -#if !PLATFORM_SUPPORTS_BUTTON_HAL - SENSORS_ACTIVATE(button_sensor); -#endif - printf("Press a button to start/stop observation of remote resource\n"); -#endif /* PLATFORM_HAS_BUTTON */ - - /* toggle observation every time the timer elapses or the button is pressed */ - while(1) { - PROCESS_YIELD(); - if(etimer_expired(&et)) { - printf("--Toggle timer--\n"); - toggle_observation(); - printf("\n--Done--\n"); - etimer_reset(&et); -#if PLATFORM_HAS_BUTTON -#if PLATFORM_SUPPORTS_BUTTON_HAL - } else if(ev == button_hal_release_event) { -#else - } else if(ev == sensors_event && data == &button_sensor) { -#endif - printf("--Toggle tutton--\n"); - toggle_observation(); - printf("\n--Done--\n"); -#endif /* PLATFORM_HAS_BUTTON */ - } - } - PROCESS_END(); -} diff --git a/examples/coap/coap-example-client/project-conf.h b/examples/coap/coap-example-client/project-conf.h deleted file mode 100644 index 7247ea08c..000000000 --- a/examples/coap/coap-example-client/project-conf.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Erbium (Er) example project configuration. - * \author - * Matthias Kovatsch - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define LOG_LEVEL_APP LOG_LEVEL_DBG - -/* Enable client-side support for COAP observe */ -#define COAP_OBSERVE_CLIENT 1 - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/coap/coap-example-server/Makefile b/examples/coap/coap-example-server/Makefile deleted file mode 100644 index 1647568cb..000000000 --- a/examples/coap/coap-example-server/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CONTIKI_PROJECT = coap-example-server -all: $(CONTIKI_PROJECT) - -# Do not try to build on Sky because of code size limitation -PLATFORMS_EXCLUDE = sky z1 - -# Include the CoAP implementation -MODULES += os/net/app-layer/coap - -# Include CoAP resources -MODULES_REL += ./resources - -CONTIKI=../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/coap/coap-example-server/coap-example-server.c b/examples/coap/coap-example-server/coap-example-server.c deleted file mode 100644 index f32b743f7..000000000 --- a/examples/coap/coap-example-server/coap-example-server.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Erbium (Er) CoAP Engine example. - * \author - * Matthias Kovatsch - */ - -#include -#include -#include -#include "contiki.h" -#include "coap-engine.h" - -#if PLATFORM_SUPPORTS_BUTTON_HAL -#include "dev/button-hal.h" -#else -#include "dev/button-sensor.h" -#endif - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_APP -/* - * Resources to be activated need to be imported through the extern keyword. - * The build system automatically compiles the resources in the corresponding sub-directory. - */ -extern coap_resource_t - res_hello, - res_mirror, - res_chunks, - res_separate, - res_push, - res_event, - res_sub, - res_b1_sep_b2; -#if PLATFORM_HAS_LEDS -extern coap_resource_t res_leds, res_toggle; -#endif -#if PLATFORM_HAS_LIGHT -#include "dev/light-sensor.h" -extern coap_resource_t res_light; -#endif -#if PLATFORM_HAS_BATTERY -#include "dev/battery-sensor.h" -extern coap_resource_t res_battery; -#endif -#if PLATFORM_HAS_TEMPERATURE -#include "dev/temperature-sensor.h" -extern coap_resource_t res_temperature; -#endif - -PROCESS(er_example_server, "Erbium Example Server"); -AUTOSTART_PROCESSES(&er_example_server); - -PROCESS_THREAD(er_example_server, ev, data) -{ - PROCESS_BEGIN(); - - PROCESS_PAUSE(); - - LOG_INFO("Starting Erbium Example Server\n"); - - /* - * Bind the resources to their Uri-Path. - * WARNING: Activating twice only means alternate path, not two instances! - * All static variables are the same for each URI path. - */ - coap_activate_resource(&res_hello, "test/hello"); - coap_activate_resource(&res_mirror, "debug/mirror"); - coap_activate_resource(&res_chunks, "test/chunks"); - coap_activate_resource(&res_separate, "test/separate"); - coap_activate_resource(&res_push, "test/push"); -#if PLATFORM_HAS_BUTTON - coap_activate_resource(&res_event, "sensors/button"); -#endif /* PLATFORM_HAS_BUTTON */ - coap_activate_resource(&res_sub, "test/sub"); - coap_activate_resource(&res_b1_sep_b2, "test/b1sepb2"); -#if PLATFORM_HAS_LEDS -/* coap_activate_resource(&res_leds, "actuators/leds"); */ - coap_activate_resource(&res_toggle, "actuators/toggle"); -#endif -#if PLATFORM_HAS_LIGHT - coap_activate_resource(&res_light, "sensors/light"); - SENSORS_ACTIVATE(light_sensor); -#endif -#if PLATFORM_HAS_BATTERY - coap_activate_resource(&res_battery, "sensors/battery"); - SENSORS_ACTIVATE(battery_sensor); -#endif -#if PLATFORM_HAS_TEMPERATURE - coap_activate_resource(&res_temperature, "sensors/temperature"); - SENSORS_ACTIVATE(temperature_sensor); -#endif - - /* Define application-specific events here. */ - while(1) { - PROCESS_WAIT_EVENT(); -#if PLATFORM_HAS_BUTTON -#if PLATFORM_SUPPORTS_BUTTON_HAL - if(ev == button_hal_release_event) { -#else - if(ev == sensors_event && data == &button_sensor) { -#endif - LOG_DBG("*******BUTTON*******\n"); - - /* Call the event_handler for this application-specific event. */ - res_event.trigger(); - - /* Also call the separate response example handler. */ - res_separate.resume(); - } -#endif /* PLATFORM_HAS_BUTTON */ - } /* while (1) */ - - PROCESS_END(); -} diff --git a/examples/coap/coap-example-server/project-conf.h b/examples/coap/coap-example-server/project-conf.h deleted file mode 100644 index eeec89082..000000000 --- a/examples/coap/coap-example-server/project-conf.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Erbium (Er) example project configuration. - * \author - * Matthias Kovatsch - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define LOG_LEVEL_APP LOG_LEVEL_DBG - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/coap/coap-example-server/resources/res-b1-sep-b2.c b/examples/coap/coap-example-server/resources/res-b1-sep-b2.c deleted file mode 100644 index 0fa76726f..000000000 --- a/examples/coap/coap-example-server/resources/res-b1-sep-b2.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2014, Lars Schmertmann . - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Lars Schmertmann - */ - -#include -#include -#include "coap-engine.h" -#include "coap-block1.h" -#include "coap-separate.h" -#include "coap-transactions.h" - -static void res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -SEPARATE_RESOURCE(res_b1_sep_b2, "title=\"Block1 + Separate + Block2 demo\"", NULL, res_post_handler, NULL, NULL, NULL); - -#define MAX_DATA_LEN 256 - -static uint8_t big_msg[MAX_DATA_LEN]; -static size_t big_msg_len = 0; -static coap_separate_t request_metadata; - -static void -res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - /* Example allows only one request on time. There are no checks for multiply access !!! */ - if(*offset == 0) { - /* Incoming Data */ - if(coap_block1_handler(request, response, big_msg, &big_msg_len, MAX_DATA_LEN)) { - /* More Blocks will follow. Example waits for - * the last block and stores data into big_msg. - */ - return; - } - /* Last block was received. */ - coap_separate_accept(request, &request_metadata); - - /* Need Time for calculation now */ - unsigned i; - for(i = 0; i <= 4096; i++) { - printf("\r%4u\r", i); - } - printf("\n"); - - /* Send first block */ - coap_transaction_t *transaction = NULL; - if((transaction = coap_new_transaction(request_metadata.mid, &request_metadata.endpoint))) { - coap_message_t resp[1]; /* This way the message can be treated as pointer as usual. */ - - /* Restore the request information for the response. */ - coap_separate_resume(resp, &request_metadata, CONTENT_2_05); - - /* Set payload and block info */ - coap_set_payload(resp, big_msg, big_msg_len > request_metadata.block2_size ? request_metadata.block2_size : big_msg_len); - if(big_msg_len > request_metadata.block2_size) { - coap_set_header_block2(resp, 0, 1, request_metadata.block2_size); - } - - /* Warning: No check for serialization error. */ - transaction->message_len = coap_serialize_message(resp, transaction->message); - coap_send_transaction(transaction); - } - } else { - /* request for more blocks */ - if(*offset >= big_msg_len) { - coap_set_status_code(response, BAD_OPTION_4_02); - coap_set_payload(response, "BlockOutOfScope", 15); - return; - } - - memcpy(buffer, big_msg + *offset, 32); - if(big_msg_len - *offset < preferred_size) { - preferred_size = big_msg_len - *offset; - *offset = -1; - } else { - *offset += preferred_size; - } - coap_set_payload(response, buffer, preferred_size); - } -} diff --git a/examples/coap/coap-example-server/resources/res-battery.c b/examples/coap/coap-example-server/resources/res-battery.c deleted file mode 100644 index b4c7623b3..000000000 --- a/examples/coap/coap-example-server/resources/res-battery.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include "contiki.h" - -#if PLATFORM_HAS_BATTERY - -#include -#include -#include "coap-engine.h" -#include "dev/battery-sensor.h" - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* A simple getter example. Returns the reading from light sensor with a simple etag */ -RESOURCE(res_battery, - "title=\"Battery status\";rt=\"Battery\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - int battery = battery_sensor.value(0); - - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "%d", battery); - - coap_set_payload(response, (uint8_t *)buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "{'battery':%d}", battery); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - const char *msg = "Supporting content-types text/plain and application/json"; - coap_set_payload(response, msg, strlen(msg)); - } -} -#endif /* PLATFORM_HAS_BATTERY */ diff --git a/examples/coap/coap-example-server/resources/res-chunks.c b/examples/coap/coap-example-server/resources/res-chunks.c deleted file mode 100644 index 39555d091..000000000 --- a/examples/coap/coap-example-server/resources/res-chunks.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* - * For data larger than COAP_MAX_CHUNK_SIZE (e.g., when stored in flash) resources must be aware of the buffer limitation - * and split their responses by themselves. To transfer the complete resource through a TCP stream or CoAP's blockwise transfer, - * the byte offset where to continue is provided to the handler as int32_t pointer. - * These chunk-wise resources must set the offset value to its new position or -1 of the end is reached. - * (The offset for CoAP's blockwise transfer can go up to 2'147'481'600 = ~2047 M for block size 2048 (reduced to 1024 in observe-03.) - */ -RESOURCE(res_chunks, - "title=\"Blockwise demo\";rt=\"Data\"", - res_get_handler, - NULL, - NULL, - NULL); - -#define CHUNKS_TOTAL 2050 - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - int32_t strpos = 0; - - /* Check the offset for boundaries of the resource data. */ - if(*offset >= CHUNKS_TOTAL) { - coap_set_status_code(response, BAD_OPTION_4_02); - /* A block error message should not exceed the minimum block size (16). */ - - const char *error_msg = "BlockOutOfScope"; - coap_set_payload(response, error_msg, strlen(error_msg)); - return; - } - - /* Generate data until reaching CHUNKS_TOTAL. */ - while(strpos < preferred_size) { - strpos += snprintf((char *)buffer + strpos, preferred_size - strpos + 1, "|%ld|", (long) *offset); - } - - /* snprintf() does not adjust return value if truncated by size. */ - if(strpos > preferred_size) { - strpos = preferred_size; - /* Truncate if above CHUNKS_TOTAL bytes. */ - } - if(*offset + (int32_t)strpos > CHUNKS_TOTAL) { - strpos = CHUNKS_TOTAL - *offset; - } - coap_set_payload(response, buffer, strpos); - - /* IMPORTANT for chunk-wise resources: Signal chunk awareness to REST engine. */ - *offset += strpos; - - /* Signal end of resource representation. */ - if(*offset >= CHUNKS_TOTAL) { - *offset = -1; - } -} diff --git a/examples/coap/coap-example-server/resources/res-event.c b/examples/coap/coap-example-server/resources/res-event.c deleted file mode 100644 index f8f754afa..000000000 --- a/examples/coap/coap-example-server/resources/res-event.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_APP - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_event_handler(void); - -/* - * Example for an event resource. - * Additionally takes a period parameter that defines the interval to call [name]_periodic_handler(). - * A default post_handler takes care of subscriptions and manages a list of subscribers to notify. - */ -EVENT_RESOURCE(res_event, - "title=\"Event demo\";obs", - res_get_handler, - NULL, - NULL, - NULL, - res_event_handler); - -/* - * Use local resource state that is accessed by res_get_handler() and altered by res_event_handler() or PUT or POST. - */ -static int32_t event_counter = 0; - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, buffer, snprintf((char *)buffer, preferred_size, "EVENT %lu", (unsigned long) event_counter)); - - /* A post_handler that handles subscriptions/observing will be called for periodic resources by the framework. */ -} -/* - * Additionally, res_event_handler must be implemented for each EVENT_RESOURCE. - * It is called through .trigger(), usually from the server process. - */ -static void -res_event_handler(void) -{ - /* Do the update triggered by the event here, e.g., sampling a sensor. */ - ++event_counter; - - /* Usually a condition is defined under with subscribers are notified, e.g., event was above a threshold. */ - if(1) { - LOG_DBG("TICK %u for /%s\n", (unsigned)event_counter, res_event.url); - - /* Notify the registered observers which will trigger the res_get_handler to create the response. */ - coap_notify_observers(&res_event); - } -} diff --git a/examples/coap/coap-example-server/resources/res-hello.c b/examples/coap/coap-example-server/resources/res-hello.c deleted file mode 100644 index 914bc28d6..000000000 --- a/examples/coap/coap-example-server/resources/res-hello.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* - * A handler function named [resource name]_handler must be implemented for each RESOURCE. - * A buffer for the response payload is provided through the buffer pointer. Simple resources can ignore - * preferred_size and offset, but must respect the REST_MAX_CHUNK_SIZE limit for the buffer. - * If a smaller block size is requested for CoAP, the REST framework automatically splits the data. - */ -RESOURCE(res_hello, - "title=\"Hello world: ?len=0..\";rt=\"Text\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const char *len = NULL; - /* Some data that has the length up to REST_MAX_CHUNK_SIZE. For more, see the chunk resource. */ - char const *const message = "Hello World! ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy"; - int length = 12; /* |<-------->| */ - - /* The query string can be retrieved by rest_get_query() or parsed for its key-value pairs. */ - if(coap_get_query_variable(request, "len", &len)) { - length = atoi(len); - if(length < 0) { - length = 0; - } - if(length > REST_MAX_CHUNK_SIZE) { - length = REST_MAX_CHUNK_SIZE; - } - memcpy(buffer, message, length); - } else { - memcpy(buffer, message, length); - } - - coap_set_header_content_format(response, TEXT_PLAIN); /* text/plain is the default, hence this option could be omitted. */ - coap_set_header_etag(response, (uint8_t *)&length, 1); - coap_set_payload(response, buffer, length); -} diff --git a/examples/coap/coap-example-server/resources/res-leds.c b/examples/coap/coap-example-server/resources/res-leds.c deleted file mode 100644 index 72dbc8b41..000000000 --- a/examples/coap/coap-example-server/resources/res-leds.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include "contiki.h" -#include "coap-engine.h" -#include "dev/leds.h" - -#include - -#if PLATFORM_HAS_LEDS || LEDS_COUNT - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_APP - -static void res_post_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* A simple actuator example, depending on the color query parameter and post variable mode, corresponding led is activated or deactivated */ -RESOURCE(res_leds, - "title=\"LEDs: ?color=r|g|b, POST/PUT mode=on|off\";rt=\"Control\"", - NULL, - res_post_put_handler, - res_post_put_handler, - NULL); - -static void -res_post_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - size_t len = 0; - const char *color = NULL; - const char *mode = NULL; - uint8_t led = 0; - int success = 1; - - if((len = coap_get_query_variable(request, "color", &color))) { - LOG_DBG("color %.*s\n", (int)len, color); - - if(strncmp(color, "r", len) == 0) { - led = LEDS_RED; - } else if(strncmp(color, "g", len) == 0) { - led = LEDS_GREEN; - } else if(strncmp(color, "b", len) == 0) { - led = LEDS_BLUE; - } else { - success = 0; - } - } else { - success = 0; - } if(success && (len = coap_get_post_variable(request, "mode", &mode))) { - LOG_DBG("mode %s\n", mode); - - if(strncmp(mode, "on", len) == 0) { - leds_on(led); - } else if(strncmp(mode, "off", len) == 0) { - leds_off(led); - } else { - success = 0; - } - } else { - success = 0; - } if(!success) { - coap_set_status_code(response, BAD_REQUEST_4_00); - } -} -#endif /* PLATFORM_HAS_LEDS */ diff --git a/examples/coap/coap-example-server/resources/res-light.c b/examples/coap/coap-example-server/resources/res-light.c deleted file mode 100644 index 3384b2e5f..000000000 --- a/examples/coap/coap-example-server/resources/res-light.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include "contiki.h" - -#if PLATFORM_HAS_LIGHT - -#include -#include -#include "coap-engine.h" -#include "dev/light-sensor.h" - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* A simple getter example. Returns the reading from light sensor with a simple etag */ -RESOURCE(res_light, - "title=\"Photosynthetic and solar light (supports JSON)\";rt=\"LightSensor\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - uint16_t light_photosynthetic = light_sensor.value(LIGHT_SENSOR_PHOTOSYNTHETIC); - uint16_t light_solar = light_sensor.value(LIGHT_SENSOR_TOTAL_SOLAR); - - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "%u;%u", light_photosynthetic, light_solar); - - coap_set_payload(response, (uint8_t *)buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_XML) { - coap_set_header_content_format(response, APPLICATION_XML); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "", light_photosynthetic, light_solar); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "{'light':{'photosynthetic':%u,'solar':%u}}", light_photosynthetic, light_solar); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - const char *msg = "Supporting content-types text/plain, application/xml, and application/json"; - coap_set_payload(response, msg, strlen(msg)); - } -} -#endif /* PLATFORM_HAS_LIGHT */ diff --git a/examples/coap/coap-example-server/resources/res-mirror.c b/examples/coap/coap-example-server/resources/res-mirror.c deleted file mode 100644 index 619ed08a7..000000000 --- a/examples/coap/coap-example-server/resources/res-mirror.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_APP - -static void res_any_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* This resource mirrors the incoming request. It shows how to access the options and how to set them for the response. */ -RESOURCE(res_mirror, - "title=\"Returns your decoded message\";rt=\"Debug\"", - res_any_handler, - res_any_handler, - res_any_handler, - res_any_handler); - -static void -res_any_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - /* The ETag and Token is copied to the header. */ - uint8_t opaque[] = { 0x0A, 0xBC, 0xDE }; - - /* Strings are not copied, so use static string buffers or strings in .text memory (char *str = "string in .text";). */ - static char location[] = { '/', 'f', '/', 'a', '?', 'k', '&', 'e', 0 }; - - /* No default my be assumed for the Content-Format. (Unsigned -1 means all bits set.) */ - unsigned int content_format = -1; - - /* The other getters copy the value (or string/array pointer) to the given pointers and return 1 for success or the length of strings/arrays. */ - uint32_t longint = 0; - const char *str = NULL; - const uint8_t *bytes = NULL; - uint32_t block_num = 0; - uint8_t block_more = 0; - uint16_t block_size = 0; - int len = 0; - - /* Mirror the received header options in the response payload. Unsupported getters (e.g., rest_get_header_observe() with HTTP) will return 0. */ - - int strpos = 0; - /* snprintf() counts the terminating '\0' to the size parameter. - * The additional byte is taken care of by allocating REST_MAX_CHUNK_SIZE+1 bytes in the REST framework. - * Add +1 to fill the complete buffer, as the payload does not need a terminating '\0'. */ - if(coap_get_header_content_format(request, &content_format)) { - strpos += snprintf((char *)buffer, REST_MAX_CHUNK_SIZE + 1, "CF %u\n", content_format); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_accept(request, &content_format))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "Ac %u\n", content_format); - /* Some getters such as for ETag or Location are omitted, as these options should not appear in a request. - * Max-Age might appear in HTTP requests or used for special purposes in CoAP. */ - } - if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_max_age(request, &longint)) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "MA %lu\n", (unsigned long) longint); - /* For HTTP this is the Length option, for CoAP it is the Size option. */ - } - if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_size1(request, &longint)) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "SZ %lu\n", (unsigned long) longint); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_uri_host(request, &str))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "UH %.*s\n", len, str); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_uri_path(request, &str))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "UP %.*s\n", len, str); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_uri_query(request, &str))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "UQ %.*s\n", len, str); - /* Undefined request options for debugging: actions not required for normal RESTful Web service. */ - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_location_path(request, &str))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "LP %.*s\n", len, str); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_location_query(request, &str))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "LQ %.*s\n", len, str); - /* CoAP-specific example: actions not required for normal RESTful Web service. */ - } - coap_message_t *const coap_pkt = (coap_message_t *)request; - - if(strpos <= REST_MAX_CHUNK_SIZE && coap_pkt->token_len > 0) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "To 0x"); - int index = 0; - for(index = 0; index < coap_pkt->token_len; ++index) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "%02X", coap_pkt->token[index]); - } - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "\n"); - } - - if(strpos <= REST_MAX_CHUNK_SIZE && coap_is_option(coap_pkt, COAP_OPTION_OBSERVE)) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "Ob %lu\n", (unsigned long) coap_pkt->observe); - } - if(strpos <= REST_MAX_CHUNK_SIZE && coap_is_option(coap_pkt, COAP_OPTION_ETAG)) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "ET 0x"); - int index = 0; - for(index = 0; index < coap_pkt->etag_len; ++index) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "%02X", coap_pkt->etag[index]); - } - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "\n"); - } - if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_block2(request, &block_num, &block_more, &block_size, NULL)) { /* This getter allows NULL pointers to get only a subset of the block parameters. */ - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "B2 %lu%s (%u)\n", (unsigned long) block_num, block_more ? "+" : "", block_size); - } - if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_block1(request, &block_num, &block_more, &block_size, NULL)) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "B1 %lu%s (%u)\n", (unsigned long) block_num, block_more ? "+" : "", block_size); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_payload(request, &bytes))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "%.*s", len, bytes); - } - if(strpos >= REST_MAX_CHUNK_SIZE) { - buffer[REST_MAX_CHUNK_SIZE - 1] = 0xBB; /* '»' to indicate truncation */ - } - coap_set_payload(response, buffer, strpos); - - LOG_DBG("/mirror options received: %s\n", buffer); - - /* Set dummy header options for response. Like getters, some setters are not implemented for HTTP and have no effect. */ - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_header_max_age(response, 17); /* For HTTP, browsers will not re-request the page for 17 seconds. */ - coap_set_header_etag(response, opaque, 2); - coap_set_header_location_path(response, location); /* Initial slash is omitted by framework */ - coap_set_header_size1(response, strpos); /* For HTTP, browsers will not re-request the page for 10 s. CoAP action depends on the client. */ - -/* CoAP-specific example: actions not required for normal RESTful Web service. */ - coap_set_header_uri_host(response, "tiki"); - coap_set_header_observe(response, 10); - coap_set_header_proxy_uri(response, "ftp://x"); - coap_set_header_block2(response, 42, 0, 64); /* The block option might be overwritten by the framework when blockwise transfer is requested. */ - coap_set_header_block1(response, 23, 0, 16); - coap_set_header_accept(response, TEXT_PLAIN); - coap_set_header_if_none_match(response); -} diff --git a/examples/coap/coap-example-server/resources/res-push.c b/examples/coap/coap-example-server/resources/res-push.c deleted file mode 100644 index 3056f3a0d..000000000 --- a/examples/coap/coap-example-server/resources/res-push.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_periodic_handler(void); - -PERIODIC_RESOURCE(res_push, - "title=\"Periodic demo\";obs", - res_get_handler, - NULL, - NULL, - NULL, - 5000, - res_periodic_handler); - -/* - * Use local resource state that is accessed by res_get_handler() and altered by res_periodic_handler() or PUT or POST. - */ -static int32_t event_counter = 0; - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - /* - * For minimal complexity, request query and options should be ignored for GET on observable resources. - * Otherwise the requests must be stored with the observer list and passed by coap_notify_subscribers(). - * This would be a TODO in the corresponding files in contiki/apps/erbium/! - */ - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_header_max_age(response, res_push.periodic->period / CLOCK_SECOND); - coap_set_payload(response, buffer, snprintf((char *)buffer, preferred_size, "VERY LONG EVENT %lu", (unsigned long) event_counter)); - - /* The coap_subscription_handler() will be called for observable resources by the REST framework. */ -} -/* - * Additionally, a handler function named [resource name]_handler must be implemented for each PERIODIC_RESOURCE. - * It will be called by the REST manager process with the defined period. - */ -static void -res_periodic_handler() -{ - /* Do a periodic task here, e.g., sampling a sensor. */ - ++event_counter; - - /* Usually a condition is defined under with subscribers are notified, e.g., large enough delta in sensor reading. */ - if(1) { - /* Notify the registered observers which will trigger the res_get_handler to create the response. */ - coap_notify_observers(&res_push); - } -} diff --git a/examples/coap/coap-example-server/resources/res-radio.c b/examples/coap/coap-example-server/resources/res-radio.c deleted file mode 100644 index c23436bb6..000000000 --- a/examples/coap/coap-example-server/resources/res-radio.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include "contiki.h" - -#if PLATFORM_HAS_RADIO -#include -#include -#include "coap-engine.h" -#include "net/netstack.h" - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* A simple getter example. Returns the reading of the rssi/lqi from radio sensor */ -RESOURCE(res_radio, - "title=\"RADIO: ?p=rssi\";rt=\"RadioSensor\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - size_t len = 0; - const char *p = NULL; - radio_value_t value; - int8_t rssi = 0; - int success = 0; - unsigned int accept = -1; - - coap_get_header_accept(request, &accept); - - if((len = coap_get_query_variable(request, "p", &p))) { - if(strncmp(p, "rssi", len) == 0) { - if(NETSTACK_RADIO.get_value(RADIO_PARAM_RSSI, &value) == - RADIO_RESULT_OK) { - success = 1; - rssi = (int8_t)value; - } - } - } - - if(success) { - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "%d", rssi); - - coap_set_payload(response, (uint8_t *)buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "{'rssi':%d}", rssi); - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - const char *msg = "Supporting content-types text/plain and application/json"; - coap_set_payload(response, msg, strlen(msg)); - } - } else { - coap_set_status_code(response, BAD_REQUEST_4_00); - } -} -#endif /* PLATFORM_HAS_RADIO */ diff --git a/examples/coap/coap-example-server/resources/res-separate.c b/examples/coap/coap-example-server/resources/res-separate.c deleted file mode 100644 index 6b98345bb..000000000 --- a/examples/coap/coap-example-server/resources/res-separate.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap-separate.h" -#include "coap-transactions.h" - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_resume_handler(void); - -SEPARATE_RESOURCE(res_separate, - "title=\"Separate demo\"", - res_get_handler, - NULL, - NULL, - NULL, - res_resume_handler); - -/* A structure to store the information required for the separate handler */ -typedef struct application_separate_store { - - /* Provided by Erbium to store generic request information such as remote address and token. */ - coap_separate_t request_metadata; - - /* Add fields for addition information to be stored for finalizing, e.g.: */ - char buffer[16]; -} application_separate_store_t; - -#define COAP_MAX_OPEN_SEPARATE 2 - -static uint8_t separate_active = 0; -static application_separate_store_t separate_store[COAP_MAX_OPEN_SEPARATE]; - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - /* - * Example allows only one open separate response. - * For multiple, the application must manage the list of stores. - */ - if(separate_active >= COAP_MAX_OPEN_SEPARATE) { - coap_separate_reject(); - } else { - ++separate_active; - - /* Take over and skip response by engine. */ - coap_separate_accept(request, &separate_store->request_metadata); - /* Be aware to respect the Block2 option, which is also stored in the coap_separate_t. */ - - /* - * At the moment, only the minimal information is stored in the store (client address, port, token, MID, type, and Block2). - * Extend the store, if the application requires additional information from this handler. - * buffer is an example field for custom information. - */ - snprintf(separate_store->buffer, sizeof(separate_store->buffer), "StoredInfo"); - } -} -static void -res_resume_handler() -{ - if(separate_active) { - coap_transaction_t *transaction = NULL; - if((transaction = coap_new_transaction(separate_store->request_metadata.mid, &separate_store->request_metadata.endpoint))) { - coap_message_t response[1]; /* This way the message can be treated as pointer as usual. */ - - /* Restore the request information for the response. */ - coap_separate_resume(response, &separate_store->request_metadata, CONTENT_2_05); - - coap_set_payload(response, separate_store->buffer, strlen(separate_store->buffer)); - - /* - * Be aware to respect the Block2 option, which is also stored in the coap_separate_t. - * As it is a critical option, this example resource pretends to handle it for compliance. - */ - coap_set_header_block2(response, separate_store->request_metadata.block2_num, 0, separate_store->request_metadata.block2_size); - - /* Warning: No check for serialization error. */ - transaction->message_len = coap_serialize_message(response, transaction->message); - coap_send_transaction(transaction); - /* The engine will clear the transaction (right after send for NON, after acked for CON). */ - - /* FIXME there could me more! */ - separate_active = 0; - } else { - /* - * Set timer for retry, send error message, ... - * The example simply waits for another button press. - */ - } - } /* if (separate_active) */ -} diff --git a/examples/coap/coap-example-server/resources/res-sht11.c b/examples/coap/coap-example-server/resources/res-sht11.c deleted file mode 100644 index 4dcf30e70..000000000 --- a/examples/coap/coap-example-server/resources/res-sht11.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2014, Nimbus Centre for Embedded Systems Research, Cork Institute of Technology. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * SHT11 Sensor Resource - * - * This is a simple GET resource that returns the temperature in Celsius - * and the humidity reading from the SHT11. - * \author - * Pablo Corbalan - */ - -#include "contiki.h" - -#if PLATFORM_HAS_SHT11 - -#include -#include -#include "coap-engine.h" -#include "dev/sht11/sht11-sensor.h" - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* Get Method Example. Returns the reading from temperature and humidity sensors. */ -RESOURCE(res_sht11, - "title=\"Temperature and Humidity\";rt=\"Sht11\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - /* Temperature in Celsius (t in 14 bits resolution at 3 Volts) - * T = -39.60 + 0.01*t - */ - uint16_t temperature = ((sht11_sensor.value(SHT11_SENSOR_TEMP) / 10) - 396) / 10; - /* Relative Humidity in percent (h in 12 bits resolution) - * RH = -4 + 0.0405*h - 2.8e-6*(h*h) - */ - uint16_t rh = sht11_sensor.value(SHT11_SENSOR_HUMIDITY); - - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "%u;%u", temperature, rh); - - coap_set_payload(response, (uint8_t *)buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_XML) { - coap_set_header_content_format(response, APPLICATION_XML); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "", temperature, rh); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "{'Sht11':{'Temperature':%u,'Humidity':%u}}", temperature, rh); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - const char *msg = "Supporting content-types text/plain, application/xml, and application/json"; - coap_set_payload(response, msg, strlen(msg)); - } -} -#endif /* PLATFORM_HAS_SHT11 */ diff --git a/examples/coap/coap-example-server/resources/res-sub.c b/examples/coap/coap-example-server/resources/res-sub.c deleted file mode 100644 index 88bc6a584..000000000 --- a/examples/coap/coap-example-server/resources/res-sub.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* - * Example for a resource that also handles all its sub-resources. - * Use coap_get_url() to multiplex the handling of the request depending on the Uri-Path. - */ -PARENT_RESOURCE(res_sub, - "title=\"Sub-resource demo\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_set_header_content_format(response, TEXT_PLAIN); - - const char *uri_path = NULL; - int len = coap_get_header_uri_path(request, &uri_path); - int base_len = strlen(res_sub.url); - - if(len == base_len) { - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "Request any sub-resource of /%s", res_sub.url); - } else { - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, ".%.*s", len - base_len, uri_path + base_len); - } coap_set_payload(response, buffer, strlen((char *)buffer)); -} diff --git a/examples/coap/coap-example-server/resources/res-temperature.c b/examples/coap/coap-example-server/resources/res-temperature.c deleted file mode 100644 index 5616924a6..000000000 --- a/examples/coap/coap-example-server/resources/res-temperature.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example of an observable "on-change" temperature resource - * \author - * Matthias Kovatsch - * \author - * Cristiano De Alti - */ - -#include "contiki.h" - -#if PLATFORM_HAS_TEMPERATURE - -#include -#include -#include -#include -#include "coap-engine.h" -#include "dev/temperature-sensor.h" - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_periodic_handler(void); - -#define MAX_AGE 60 -#define INTERVAL_MIN 5 -#define INTERVAL_MAX (MAX_AGE - 1) -#define CHANGE 1 - -static int32_t interval_counter = INTERVAL_MIN; -static int temperature_old = INT_MIN; - -PERIODIC_RESOURCE(res_temperature, - "title=\"Temperature\";rt=\"Temperature\";obs", - res_get_handler, - NULL, - NULL, - NULL, - 1000, - res_periodic_handler); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - /* - * For minimal complexity, request query and options should be ignored for GET on observable resources. - * Otherwise the requests must be stored with the observer list and passed by coap_notify_observers(). - * This would be a TODO in the corresponding files in contiki/apps/erbium/! - */ - - int temperature = temperature_sensor.value(0); - - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "%d", temperature); - - coap_set_payload(response, (uint8_t *)buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "{'temperature':%d}", temperature); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - const char *msg = "Supporting content-types text/plain and application/json"; - coap_set_payload(response, msg, strlen(msg)); - } - - coap_set_header_max_age(response, MAX_AGE); - - /* The coap_subscription_handler() will be called for observable resources by the coap_framework. */ -} - -/* - * Additionally, a handler function named [resource name]_handler must be implemented for each PERIODIC_RESOURCE. - * It will be called by the coap_manager process with the defined period. - */ -static void -res_periodic_handler() -{ - int temperature = temperature_sensor.value(0); - - ++interval_counter; - - if((abs(temperature - temperature_old) >= CHANGE && interval_counter >= INTERVAL_MIN) || - interval_counter >= INTERVAL_MAX) { - interval_counter = 0; - temperature_old = temperature; - /* Notify the registered observers which will trigger the res_get_handler to create the response. */ - coap_notify_observers(&res_temperature); - } -} -#endif /* PLATFORM_HAS_TEMPERATURE */ diff --git a/examples/coap/coap-example-server/resources/res-toggle.c b/examples/coap/coap-example-server/resources/res-toggle.c deleted file mode 100644 index b90ac77c7..000000000 --- a/examples/coap/coap-example-server/resources/res-toggle.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include "contiki.h" -#include "coap-engine.h" -#include "dev/leds.h" - -#include - -#if PLATFORM_HAS_LEDS || LEDS_COUNT - -static void res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* A simple actuator example. Toggles the red led */ -RESOURCE(res_toggle, - "title=\"Red LED\";rt=\"Control\"", - NULL, - res_post_handler, - NULL, - NULL); - -static void -res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - leds_toggle(LEDS_RED); -} -#endif /* PLATFORM_HAS_LEDS */ diff --git a/examples/coap/coap-plugtest-server/Makefile b/examples/coap/coap-plugtest-server/Makefile deleted file mode 100644 index ee3bc511b..000000000 --- a/examples/coap/coap-plugtest-server/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CONTIKI_PROJECT = coap-plugtest-server -all: $(CONTIKI_PROJECT) - -# Only intended for native -PLATFORMS_ONLY = native - -# Include the CoAP implementation -MODULES += os/net/app-layer/coap - -# Include CoAP resources -MODULES_REL += ./resources - -CONTIKI=../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/coap/coap-plugtest-server/coap-plugtest-server.c b/examples/coap/coap-plugtest-server/coap-plugtest-server.c deleted file mode 100644 index 8783ae6dd..000000000 --- a/examples/coap/coap-plugtest-server/coap-plugtest-server.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Server for the ETSI IoT CoAP Plugtests, Las Vegas, NV, USA, Nov 2013. - * \author - * Matthias Kovatsch - */ - -#include -#include -#include -#include "contiki.h" -#include "contiki-net.h" -#include "coap.h" -#include "coap-transactions.h" -#include "coap-separate.h" -#include "coap-engine.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -/* - * Resources to be activated need to be imported through the extern keyword. - * The build system automatically compiles the resources in the corresponding - * sub-directory. - */ -extern coap_resource_t - res_plugtest_test, - res_plugtest_validate, - res_plugtest_create1, - res_plugtest_create2, - res_plugtest_create3, - res_plugtest_longpath, - res_plugtest_query, - res_plugtest_locquery, - res_plugtest_multi, - res_plugtest_link1, - res_plugtest_link2, - res_plugtest_link3, - res_plugtest_path, - res_plugtest_separate, - res_plugtest_large, - res_plugtest_large_update, - res_plugtest_large_create, - res_plugtest_obs, - res_mirror; - -PROCESS(plugtest_server, "PlugtestServer"); -AUTOSTART_PROCESSES(&plugtest_server); - -PROCESS_THREAD(plugtest_server, ev, data) -{ - PROCESS_BEGIN(); - - LOG_INFO("ETSI IoT CoAP Plugtests Server\n"); - - /* Activate the application-specific resources. */ - coap_activate_resource(&res_plugtest_test, "test"); - coap_activate_resource(&res_plugtest_validate, "validate"); - coap_activate_resource(&res_plugtest_create1, "create1"); - coap_activate_resource(&res_plugtest_create2, "create2"); - coap_activate_resource(&res_plugtest_create3, "create3"); - coap_activate_resource(&res_plugtest_longpath, "seg1/seg2/seg3"); - coap_activate_resource(&res_plugtest_query, "query"); - coap_activate_resource(&res_plugtest_locquery, "location-query"); - coap_activate_resource(&res_plugtest_multi, "multi-format"); - coap_activate_resource(&res_plugtest_link1, "link1"); - coap_activate_resource(&res_plugtest_link2, "link2"); - coap_activate_resource(&res_plugtest_link3, "link3"); - coap_activate_resource(&res_plugtest_path, "path"); - coap_activate_resource(&res_plugtest_separate, "separate"); - coap_activate_resource(&res_plugtest_large, "large"); - coap_activate_resource(&res_plugtest_large_update, "large-update"); - coap_activate_resource(&res_plugtest_large_create, "large-create"); - coap_activate_resource(&res_plugtest_obs, "obs"); - - coap_activate_resource(&res_mirror, "mirror"); - - /* Define application-specific events here. */ - while(1) { - PROCESS_WAIT_EVENT(); - } /* while (1) */ - - PROCESS_END(); -} diff --git a/examples/coap/coap-plugtest-server/project-conf.h b/examples/coap/coap-plugtest-server/project-conf.h deleted file mode 100644 index 5c86ae985..000000000 --- a/examples/coap/coap-plugtest-server/project-conf.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Erbium (Er) CoAP client example - * \author - * Matthias Kovatsch - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define LOG_LEVEL_PLUGTEST LOG_LEVEL_DBG - -/* double expansion */ -#define TO_STRING2(x) # x -#define TO_STRING(x) TO_STRING2(x) - -#define MAX_PLUGFEST_PAYLOAD 64 + 1 /* +1 for the terminating zero, which is not transmitted */ -#define MAX_PLUGFEST_BODY 2048 -#define CHUNKS_TOTAL 2012 - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/coap/coap-plugtest-server/resources/res-mirror.c b/examples/coap/coap-plugtest-server/resources/res-mirror.c deleted file mode 100644 index ea9ddd3ad..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-mirror.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_any_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* This resource mirrors the incoming request. It shows how to access the options and how to set them for the response. */ -RESOURCE(res_mirror, - "title=\"Returns your decoded message\";rt=\"Debug\"", - res_any_handler, - res_any_handler, - res_any_handler, - res_any_handler); - -static void -res_any_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - /* The ETag and Token is copied to the header. */ - uint8_t opaque[] = { 0x0A, 0xBC, 0xDE }; - - /* Strings are not copied, so use static string buffers or strings in .text memory (char *str = "string in .text";). */ - static char location[] = { '/', 'f', '/', 'a', '?', 'k', '&', 'e', 0 }; - - /* No default my be assumed for the Content-Format. (Unsigned -1 means all bits set.) */ - unsigned int content_format = -1; - - /* The other getters copy the value (or string/array pointer) to the given pointers and return 1 for success or the length of strings/arrays. */ - uint32_t longint = 0; - const char *str = NULL; - const uint8_t *bytes = NULL; - uint32_t block_num = 0; - uint8_t block_more = 0; - uint16_t block_size = 0; - int len = 0; - - /* Mirror the received header options in the response payload. Unsupported getters (e.g., rest_get_header_observe() with HTTP) will return 0. */ - - int strpos = 0; - /* snprintf() counts the terminating '\0' to the size parameter. - * The additional byte is taken care of by allocating REST_MAX_CHUNK_SIZE+1 bytes in the REST framework. - * Add +1 to fill the complete buffer, as the payload does not need a terminating '\0'. */ - if(coap_get_header_content_format(request, &content_format)) { - strpos += snprintf((char *)buffer, REST_MAX_CHUNK_SIZE + 1, "CF %u\n", content_format); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_accept(request, &content_format))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "Ac %u\n", content_format); - /* Some getters such as for ETag or Location are omitted, as these options should not appear in a request. - * Max-Age might appear in HTTP requests or used for special purposes in CoAP. */ - } - if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_max_age(request, &longint)) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "MA %lu\n", (unsigned long) longint); - /* For HTTP this is the Length option, for CoAP it is the Size option. */ - } - if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_size1(request, &longint)) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "SZ %lu\n", (unsigned long) longint); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_uri_host(request, &str))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "UH %.*s\n", len, str); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_uri_path(request, &str))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "UP %.*s\n", len, str); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_uri_query(request, &str))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "UQ %.*s\n", len, str); - /* Undefined request options for debugging: actions not required for normal RESTful Web service. */ - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_location_path(request, &str))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "LP %.*s\n", len, str); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_location_query(request, &str))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "LQ %.*s\n", len, str); - /* CoAP-specific example: actions not required for normal RESTful Web service. */ - } - coap_message_t *const coap_pkt = (coap_message_t *)request; - - if(strpos <= REST_MAX_CHUNK_SIZE && coap_pkt->token_len > 0) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "To 0x"); - int index = 0; - for(index = 0; index < coap_pkt->token_len; ++index) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "%02X", coap_pkt->token[index]); - } - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "\n"); - } - - if(strpos <= REST_MAX_CHUNK_SIZE && coap_is_option(coap_pkt, COAP_OPTION_OBSERVE)) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "Ob %lu\n", (unsigned long) coap_pkt->observe); - } - if(strpos <= REST_MAX_CHUNK_SIZE && coap_is_option(coap_pkt, COAP_OPTION_ETAG)) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "ET 0x"); - int index = 0; - for(index = 0; index < coap_pkt->etag_len; ++index) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "%02X", coap_pkt->etag[index]); - } - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "\n"); - } - if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_block2(request, &block_num, &block_more, &block_size, NULL)) { /* This getter allows NULL pointers to get only a subset of the block parameters. */ - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "B2 %lu%s (%u)\n", (unsigned long) block_num, block_more ? "+" : "", block_size); - } - if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_block1(request, &block_num, &block_more, &block_size, NULL)) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "B1 %lu%s (%u)\n", (unsigned long) block_num, block_more ? "+" : "", block_size); - } - if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_payload(request, &bytes))) { - strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "%.*s", len, bytes); - } - if(strpos >= REST_MAX_CHUNK_SIZE) { - buffer[REST_MAX_CHUNK_SIZE - 1] = 0xBB; /* '»' to indicate truncation */ - } - coap_set_payload(response, buffer, strpos); - - LOG_DBG("/mirror options received: %s\n", buffer); - - /* Set dummy header options for response. Like getters, some setters are not implemented for HTTP and have no effect. */ - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_header_max_age(response, 17); /* For HTTP, browsers will not re-request the page for 17 seconds. */ - coap_set_header_etag(response, opaque, 2); - coap_set_header_location_path(response, location); /* Initial slash is omitted by framework */ - coap_set_header_size1(response, strpos); /* For HTTP, browsers will not re-request the page for 10 s. CoAP action depends on the client. */ - -/* CoAP-specific example: actions not required for normal RESTful Web service. */ - coap_set_header_uri_host(response, "tiki"); - coap_set_header_observe(response, 10); - coap_set_header_proxy_uri(response, "ftp://x"); - coap_set_header_block2(response, 42, 0, 64); /* The block option might be overwritten by the framework when blockwise transfer is requested. */ - coap_set_header_block1(response, 23, 0, 16); - coap_set_header_accept(response, TEXT_PLAIN); - coap_set_header_if_none_match(response); -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-create1.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-create1.c deleted file mode 100644 index fe57e4961..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-create1.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_create1, - "title=\"Creates on PUT\"", - NULL, - NULL, - res_put_handler, - res_delete_handler); - -static uint8_t create1_exists = 0; - -static void -res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - LOG_DBG("/create1 PUT"); - - if(coap_get_header_if_none_match(request)) { - if(!create1_exists) { - coap_set_status_code(response, CREATED_2_01); - - create1_exists = 1; - } else { - coap_set_status_code(response, PRECONDITION_FAILED_4_12); - } - } else { - coap_set_status_code(response, CHANGED_2_04); - } -} -static void -res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - LOG_DBG("/create1 DELETE "); - coap_set_status_code(response, DELETED_2_02); - - create1_exists = 0; -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-create2.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-create2.c deleted file mode 100644 index b4520d672..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-create2.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_create2, - "title=\"Creates on POST\"", - NULL, - res_post_handler, - NULL, - NULL); - -static void -res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - LOG_DBG("/create2 "); - - coap_set_status_code(response, CREATED_2_01); - coap_set_header_location_path(response, "/location1/location2/location3"); -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-create3.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-create3.c deleted file mode 100644 index b78fca67e..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-create3.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_create3, - "title=\"Default test resource\"", - NULL, - NULL, - res_put_handler, - res_delete_handler); - -static uint8_t create3_exists = 0; - -static void -res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - LOG_DBG("/create3 PUT "); - - if(coap_get_header_if_none_match(request)) { - if(!create3_exists) { - coap_set_status_code(response, CREATED_2_01); - - create3_exists = 1; - } else { - coap_set_status_code(response, PRECONDITION_FAILED_4_12); - } - } else { - coap_set_status_code(response, CHANGED_2_04); - } -} -static void -res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - LOG_DBG("/create3 DELETE "); - coap_set_status_code(response, DELETED_2_02); - - create3_exists = 0; -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-large-create.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-large-create.c deleted file mode 100644 index 923702f51..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-large-create.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -/* - * Large resource that can be created using POST method - */ -RESOURCE(res_plugtest_large_create, - "title=\"Large resource that can be created using POST method\";rt=\"block\"", - NULL, - res_post_handler, - NULL, - NULL); - -static void -res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - - uint8_t *incoming = NULL; - size_t len = 0; - - unsigned int ct = -1; - - if(!coap_get_header_content_format(request, &ct)) { - coap_set_status_code(response, BAD_REQUEST_4_00); - const char *error_msg = "NoContentType"; - coap_set_payload(response, error_msg, strlen(error_msg)); - return; - } - - if((len = coap_get_payload(request, (const uint8_t **)&incoming))) { - if(coap_req->block1_num * coap_req->block1_size + len <= 2048) { - coap_set_status_code(response, CREATED_2_01); - coap_set_header_location_path(response, "/nirvana"); - coap_set_header_block1(response, coap_req->block1_num, 0, - coap_req->block1_size); - } else { - coap_set_status_code(response, REQUEST_ENTITY_TOO_LARGE_4_13); - const char *error_msg = "2048B max."; - coap_set_payload(response, error_msg, strlen(error_msg)); - return; - } - } else { - coap_set_status_code(response, BAD_REQUEST_4_00); - const char *error_msg = "NoPayload"; - coap_set_payload(response, error_msg, strlen(error_msg)); - return; - } -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-large-update.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-large-update.c deleted file mode 100644 index 289fbdfdf..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-large-update.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "sys/cc.h" -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE( - res_plugtest_large_update, - "title=\"Large resource that can be updated using PUT method\";rt=\"block\";sz=\"" TO_STRING(MAX_PLUGFEST_BODY) "\"", - res_get_handler, - NULL, - res_put_handler, - NULL); - -static int32_t large_update_size = 0; -static uint8_t large_update_store[MAX_PLUGFEST_BODY] = { 0 }; -static unsigned int large_update_ct = APPLICATION_OCTET_STREAM; - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - /* Check the offset for boundaries of the resource data. */ - if(*offset >= large_update_size) { - coap_set_status_code(response, BAD_OPTION_4_02); - /* A block error message should not exceed the minimum block size (16). */ - - const char *error_msg = "BlockOutOfScope"; - coap_set_payload(response, error_msg, strlen(error_msg)); - return; - } - - coap_set_payload(response, large_update_store + *offset, - MIN(large_update_size - *offset, preferred_size)); - coap_set_header_content_format(response, large_update_ct); - - /* IMPORTANT for chunk-wise resources: Signal chunk awareness to REST engine. */ - *offset += preferred_size; - - /* Signal end of resource representation. */ - if(*offset >= large_update_size) { - *offset = -1; - } -} -static void -res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - uint8_t *incoming = NULL; - size_t len = 0; - - unsigned int ct = -1; - - if(!coap_get_header_content_format(request, &ct)) { - coap_set_status_code(response, BAD_REQUEST_4_00); - const char *error_msg = "NoContentType"; - coap_set_payload(response, error_msg, strlen(error_msg)); - return; - } - - if((len = coap_get_payload(request, (const uint8_t **)&incoming))) { - if(coap_req->block1_num * coap_req->block1_size + len <= sizeof(large_update_store)) { - memcpy( - large_update_store + coap_req->block1_num * coap_req->block1_size, - incoming, len); - large_update_size = coap_req->block1_num * coap_req->block1_size + len; - large_update_ct = ct; - - coap_set_status_code(response, CHANGED_2_04); - coap_set_header_block1(response, coap_req->block1_num, 0, - coap_req->block1_size); - } else { - coap_set_status_code(response, - REQUEST_ENTITY_TOO_LARGE_4_13); - coap_set_payload( - response, - buffer, - snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD, "%uB max.", - (unsigned) sizeof(large_update_store))); - return; - } - } else { - coap_set_status_code(response, BAD_REQUEST_4_00); - const char *error_msg = "NoPayload"; - coap_set_payload(response, error_msg, strlen(error_msg)); - return; - } -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-large.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-large.c deleted file mode 100644 index 850f88461..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-large.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_large, - "title=\"Large resource\";rt=\"block\";sz=\"" TO_STRING(CHUNKS_TOTAL) "\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - int32_t strpos = 0; - - /* Check the offset for boundaries of the resource data. */ - if(*offset >= CHUNKS_TOTAL) { - coap_set_status_code(response, BAD_OPTION_4_02); - /* A block error message should not exceed the minimum block size (16). */ - - const char *error_msg = "BlockOutOfScope"; - coap_set_payload(response, error_msg, strlen(error_msg)); - return; - } - - /* Generate data until reaching CHUNKS_TOTAL. */ - while(strpos < preferred_size) { - strpos += snprintf((char *)buffer + strpos, preferred_size - strpos + 1, - "|%ld|", (long) *offset); - } - - /* snprintf() does not adjust return value if truncated by size. */ - if(strpos > preferred_size) { - strpos = preferred_size; - /* Truncate if above CHUNKS_TOTAL bytes. */ - } - if(*offset + (int32_t)strpos > CHUNKS_TOTAL) { - strpos = CHUNKS_TOTAL - *offset; - } - coap_set_payload(response, buffer, strpos); - coap_set_header_content_format(response, TEXT_PLAIN); - - /* IMPORTANT for chunk-wise resources: Signal chunk awareness to REST engine. */ - *offset += strpos; - - /* Signal end of resource representation. */ - if(*offset >= CHUNKS_TOTAL) { - *offset = -1; - } -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-links.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-links.c deleted file mode 100644 index 3bbd2a062..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-links.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_link1, - "rt=\"Type1 Type2\";if=\"If1\"", - res_get_handler, - NULL, - NULL, - NULL); -RESOURCE(res_plugtest_link2, - "rt=\"Type2 Type3\";if=\"If2\"", - res_get_handler, - NULL, - NULL, - NULL); -RESOURCE(res_plugtest_link3, - "rt=\"Type1 Type3\";if=\"foo\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const char *msg = "Dummy link"; - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, msg, strlen(msg)); -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-locquery.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-locquery.c deleted file mode 100644 index e7163e8b1..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-locquery.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_locquery, - "title=\"Resource accepting query parameters\"", - NULL, - res_post_handler, - NULL, - NULL); - -static void -res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - - LOG_DBG( - "/location-query POST (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); - - coap_set_status_code(response, CREATED_2_01); - coap_set_header_location_query(response, "?first=1&second=2"); -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-longpath.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-longpath.c deleted file mode 100644 index 990ad2677..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-longpath.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - - -#include -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_longpath, - "title=\"Long path resource\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - - LOG_DBG("/seg1/seg2/seg3 GET "); - /* Code 2.05 CONTENT is default. */ - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload( - response, - buffer, - snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD, - "Type: %u\nCode: %u\nMID: %u", coap_req->type, coap_req->code, coap_req->mid)); - - LOG_DBG_("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-multi.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-multi.c deleted file mode 100644 index 9606d91a6..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-multi.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_multi, - "title=\"Resource providing text/plain and application/xml\";ct=\"0 41\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - - LOG_DBG("/multi-format GET (%s %u) ", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload( - response, - buffer, - snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD, - "Type: %u\nCode: %u\nMID: %u%s", coap_req->type, coap_req->code, - coap_req->mid, accept != -1 ? "\nAccept: 0" : "")); - LOG_DBG_("PLAIN\n"); - } else if(accept == APPLICATION_XML) { - coap_set_header_content_format(response, APPLICATION_XML); - coap_set_payload( - response, - buffer, - snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD, - "", - coap_req->type, coap_req->code, coap_req->mid, accept)); - LOG_DBG_("XML\n"); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - const char *msg = "Supporting content-types text/plain and application/xml"; - coap_set_payload(response, msg, strlen(msg)); - LOG_DBG_("ERROR\n"); - } -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-obs.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-obs.c deleted file mode 100644 index 3200d1d88..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-obs.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" -#include "coap-observe.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_periodic_handler(void); - -PERIODIC_RESOURCE(res_plugtest_obs, - "title=\"Observable resource which changes every 5 seconds\";obs", - res_get_handler, - NULL, - res_put_handler, - res_delete_handler, - 5000, - res_periodic_handler); - -static int32_t obs_counter = 0; -static char obs_content[MAX_PLUGFEST_BODY]; -static size_t obs_content_len = 0; -static unsigned int obs_format = 0; - -static char obs_status = 0; - -static void -obs_purge_list() -{ - LOG_DBG("### SERVER ACTION ### Purging obs list\n"); - coap_remove_observer_by_uri(NULL, res_plugtest_obs.url); -} -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - /* Keep server log clean from ticking events */ - if(request != NULL) { - LOG_DBG("/obs GET\n"); - } - coap_set_header_content_format(response, obs_format); - coap_set_header_max_age(response, 5); - - if(obs_content_len) { - coap_set_header_content_format(response, obs_format); - coap_set_payload(response, obs_content, obs_content_len); - } else { - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, obs_content, - snprintf(obs_content, MAX_PLUGFEST_PAYLOAD, "TICK %lu", (unsigned long) obs_counter)); - } - /* A post_handler that handles subscriptions will be called for periodic resources by the CoAP framework. */ -} -static void -res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - uint8_t *incoming = NULL; - unsigned int ct = -1; - - coap_get_header_content_format(request, &ct); - - LOG_DBG("/obs PUT\n"); - - if(ct != obs_format) { - obs_status = 1; - obs_format = ct; - } else { - obs_content_len = coap_get_payload(request, - (const uint8_t **)&incoming); - memcpy(obs_content, incoming, obs_content_len); - res_periodic_handler(); - } - - coap_set_status_code(response, CHANGED_2_04); -} -static void -res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - LOG_DBG("/obs DELETE\n"); - - obs_status = 2; - - coap_set_status_code(response, DELETED_2_02); -} -/* - * Additionally, a handler function named [resource name]_handler must be implemented for each PERIODIC_RESOURCE. - * It will be called by the CoAP manager process with the defined period. - */ -static void -res_periodic_handler() -{ - ++obs_counter; - - if(obs_status == 1) { - - /* Notify the registered observers with the given message type, observe option, and payload. */ - coap_notify_observers(&res_plugtest_obs); - - LOG_DBG("######### sending 5.00\n"); - - obs_purge_list(); - } else if(obs_status == 2) { - - /* Notify the registered observers with the given message type, observe option, and payload. */ - coap_notify_observers(&res_plugtest_obs); - - obs_purge_list(); - - obs_counter = 0; - obs_content_len = 0; - } else { - /* Notify the registered observers with the given message type, observe option, and payload. */ - coap_notify_observers(&res_plugtest_obs); - } obs_status = 0; -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-path.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-path.c deleted file mode 100644 index 767609f09..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-path.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -PARENT_RESOURCE(res_plugtest_path, - "title=\"Path test resource\";ct=\"40\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - - const char *uri_path = NULL; - int len = coap_get_header_uri_path(request, &uri_path); - int base_len = strlen(res_plugtest_path.url); - - if(len == base_len) { - coap_set_header_content_format(response, APPLICATION_LINK_FORMAT); - snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD, - ",,"); - } else { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD, "/%.*s", len, uri_path); - } - - coap_set_payload(response, buffer, strlen((char *)buffer)); -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-query.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-query.c deleted file mode 100644 index 1080d3162..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-query.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_query, - "title=\"Resource accepting query parameters\"", - res_get_handler, - NULL, - NULL, - NULL); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - int len = 0; - const char *query = NULL; - - LOG_DBG( - "/query GET (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); - - if((len = coap_get_header_uri_query(request, &query))) { - LOG_DBG("Query: %.*s\n", len, query); - /* Code 2.05 CONTENT is default. */ - } - coap_set_header_content_format(response, - TEXT_PLAIN); - coap_set_payload( - response, - buffer, - snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD, - "Type: %u\nCode: %u\nMID: %u\nQuery: %.*s", coap_req->type, - coap_req->code, coap_req->mid, len, query)); -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-separate.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-separate.c deleted file mode 100644 index bbcfc9d77..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-separate.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" -#include "coap-transactions.h" -#include "coap-separate.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_resume_handler(void); - -PERIODIC_RESOURCE(res_plugtest_separate, - "title=\"Resource which cannot be served immediately and which cannot be acknowledged in a piggy-backed way\"", - res_get_handler, - NULL, - NULL, - NULL, - 3000, - res_resume_handler); - -/* A structure to store the required information */ -typedef struct application_separate_store { - /* Provided by Erbium to store generic request information such as remote address and token. */ - coap_separate_t request_metadata; - /* Add fields for addition information to be stored for finalizing, e.g.: */ - char buffer[MAX_PLUGFEST_PAYLOAD]; -} application_separate_store_t; - -static uint8_t separate_active = 0; -static application_separate_store_t separate_store[1]; - -void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - - LOG_DBG("/separate "); - if(separate_active) { - LOG_DBG_("REJECTED "); - coap_separate_reject(); - } else { - LOG_DBG_("STORED "); - separate_active = 1; - - /* Take over and skip response by engine. */ - coap_separate_accept(request, &separate_store->request_metadata); - /* Be aware to respect the Block2 option, which is also stored in the coap_separate_t. */ - - snprintf(separate_store->buffer, MAX_PLUGFEST_PAYLOAD, - "Type: %u\nCode: %u\nMID: %u", coap_req->type, coap_req->code, - coap_req->mid); - } - - LOG_DBG_("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); -} -static void -res_resume_handler() -{ - if(separate_active) { - LOG_DBG("/separate "); - coap_transaction_t *transaction = NULL; - if((transaction = coap_new_transaction(separate_store->request_metadata.mid, - &separate_store->request_metadata.endpoint))) { - LOG_DBG_( - "RESPONSE (%s %u)\n", separate_store->request_metadata.type == COAP_TYPE_CON ? "CON" : "NON", separate_store->request_metadata.mid); - - coap_message_t response[1]; /* This way the message can be treated as pointer as usual. */ - - /* Restore the request information for the response. */ - coap_separate_resume(response, &separate_store->request_metadata, CONTENT_2_05); - - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, separate_store->buffer, - strlen(separate_store->buffer)); - - /* - * Be aware to respect the Block2 option, which is also stored in the coap_separate_t. - * As it is a critical option, this example resource pretends to handle it for compliance. - */ - coap_set_header_block2(response, - separate_store->request_metadata.block2_num, 0, - separate_store->request_metadata.block2_size); - - /* Warning: No check for serialization error. */ - transaction->message_len = coap_serialize_message(response, - transaction->message); - coap_send_transaction(transaction); - /* The engine will clear the transaction (right after send for NON, after acked for CON). */ - - separate_active = 0; - } else { - LOG_DBG_("ERROR (transaction)\n"); - } - } /* if (separate_active) */ -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-test.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-test.c deleted file mode 100644 index d02b3026d..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-test.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" -#include "random.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_test, "title=\"Default test resource\"", res_get_handler, res_post_handler, res_put_handler, res_delete_handler); - -static uint8_t test_etag[8] = { 0 }; -static uint8_t test_etag_len = 1; -static uint8_t test_change = 1; -static uint8_t test_none_match_okay = 1; - -static const uint8_t *bytes = NULL; -static size_t len = 0; - -static void -test_update_etag() -{ - int i; - test_etag_len = (random_rand() % 8) + 1; - for(i = 0; i < test_etag_len; ++i) { - test_etag[i] = random_rand(); - } - test_change = 0; - - LOG_DBG("### SERVER ACTION ### Changed ETag %u [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n", test_etag_len, test_etag[0], test_etag[1], test_etag[2], test_etag[3], test_etag[4], test_etag[5], test_etag[6], test_etag[7]); -} -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - - if(test_change) { - test_update_etag(); - } - LOG_DBG("/test GET (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); - - if((len = coap_get_header_etag(request, &bytes)) > 0 - && len == test_etag_len - && memcmp(test_etag, bytes, len) == 0) { - LOG_DBG("validate\n"); - coap_set_status_code(response, VALID_2_03); - coap_set_header_etag(response, test_etag, test_etag_len); - - test_change = 1; - LOG_DBG("### SERVER ACTION ### Resource will change\n"); - } else { - /* Code 2.05 CONTENT is default. */ - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_header_etag(response, test_etag, test_etag_len); - coap_set_header_max_age(response, 30); - coap_set_payload( - response, - buffer, - snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD, "Type: %u\nCode: %u\nMID: %u", coap_req->type, coap_req->code, coap_req->mid)); - } -} -static void -res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - LOG_DBG("/test POST (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); - coap_set_status_code(response, CREATED_2_01); - coap_set_header_location_path(response, "/location1/location2/location3"); -} -static void -res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - LOG_DBG("/test PUT (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); - - if(coap_get_header_if_none_match(request)) { - if(test_none_match_okay) { - coap_set_status_code(response, CREATED_2_01); - - test_none_match_okay = 0; - LOG_DBG("### SERVER ACTION ### If-None-Match will FAIL\n"); - } else { - coap_set_status_code(response, PRECONDITION_FAILED_4_12); - - test_none_match_okay = 1; - LOG_DBG("### SERVER ACTION ### If-None-Match will SUCCEED\n"); - } - } else if(((len = coap_get_header_if_match(request, &bytes)) > 0 - && (len == test_etag_len - && memcmp(test_etag, bytes, len) == 0)) - || len == 0) { - test_update_etag(); - coap_set_header_etag(response, test_etag, test_etag_len); - - coap_set_status_code(response, CHANGED_2_04); - - if(len > 0) { - test_change = 1; - LOG_DBG("### SERVER ACTION ### Resource will change\n"); - } - } else { - LOG_DBG("Check %u/%u\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n", - (unsigned)len, - (unsigned)test_etag_len, - bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], - test_etag[0], test_etag[1], test_etag[2], test_etag[3], test_etag[4], test_etag[5], test_etag[6], test_etag[7]); - - coap_set_status_code(response, PRECONDITION_FAILED_4_12); - } -} -static void -res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - LOG_DBG("/test DELETE (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); - coap_set_status_code(response, DELETED_2_02); -} diff --git a/examples/coap/coap-plugtest-server/resources/res-plugtest-validate.c b/examples/coap/coap-plugtest-server/resources/res-plugtest-validate.c deleted file mode 100644 index 7a5920c2b..000000000 --- a/examples/coap/coap-plugtest-server/resources/res-plugtest-validate.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ETSI Plugtest resource - * \author - * Matthias Kovatsch - */ - -#include -#include -#include "coap-engine.h" -#include "coap.h" -#include "random.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Plugtest" -#define LOG_LEVEL LOG_LEVEL_PLUGTEST - -static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -RESOURCE(res_plugtest_validate, - "title=\"Validation test resource\"", - res_get_handler, - NULL, - res_put_handler, - NULL); - -static uint8_t validate_etag[8] = { 0 }; -static uint8_t validate_etag_len = 1; -static uint8_t validate_change = 1; - -static const uint8_t *bytes = NULL; -static size_t len = 0; - -static void -validate_update_etag() -{ - int i; - validate_etag_len = (random_rand() % 8) + 1; - for(i = 0; i < validate_etag_len; ++i) { - validate_etag[i] = random_rand(); - } - validate_change = 0; - - LOG_DBG("### SERVER ACTION ### Changed ETag %u [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n", - validate_etag_len, validate_etag[0], validate_etag[1], validate_etag[2], validate_etag[3], validate_etag[4], validate_etag[5], validate_etag[6], validate_etag[7]); -} -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - - if(validate_change) { - validate_update_etag(); - } - LOG_DBG("/validate GET"); - LOG_DBG_("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); - - if((len = coap_get_header_etag(request, &bytes)) > 0 - && len == validate_etag_len && memcmp(validate_etag, bytes, len) == 0) { - LOG_DBG("validate\n"); - coap_set_status_code(response, VALID_2_03); - coap_set_header_etag(response, validate_etag, validate_etag_len); - - validate_change = 1; - LOG_DBG("### SERVER ACTION ### Resouce will change\n"); - } else { - /* Code 2.05 CONTENT is default. */ - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_header_etag(response, validate_etag, validate_etag_len); - coap_set_header_max_age(response, 30); - coap_set_payload( - response, - buffer, - snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD, - "Type: %u\nCode: %u\nMID: %u", coap_req->type, coap_req->code, - coap_req->mid)); - } -} -static void -res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_message_t *const coap_req = (coap_message_t *)request; - - LOG_DBG("/validate PUT "); - LOG_DBG_("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid); - - if(((len = coap_get_header_if_match(request, &bytes)) > 0 - && (len == validate_etag_len - && memcmp(validate_etag, bytes, len) == 0)) - || len == 0) { - validate_update_etag(); - coap_set_header_etag(response, validate_etag, validate_etag_len); - - coap_set_status_code(response, CHANGED_2_04); - - if(len > 0) { - validate_change = 1; - LOG_DBG("### SERVER ACTION ### Resouce will change\n"); - } - } else { - LOG_DBG( - "Check %u/%u\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n", - (unsigned)len, - (unsigned)validate_etag_len, - bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], - validate_etag[0], validate_etag[1], validate_etag[2], validate_etag[3], validate_etag[4], validate_etag[5], validate_etag[6], validate_etag[7]); - - coap_set_status_code(response, PRECONDITION_FAILED_4_12); - } -} diff --git a/examples/dev/button-hal/Makefile b/examples/dev/button-hal/Makefile deleted file mode 100644 index 263e9ec65..000000000 --- a/examples/dev/button-hal/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CONTIKI_PROJECT = button-hal-example -CONTIKI = ../../.. - -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = cc26x0-cc13x0 cc2538dk openmote-cc2538 zoul native simplelink - -include $(CONTIKI)/Makefile.include diff --git a/examples/dev/button-hal/README.md b/examples/dev/button-hal/README.md deleted file mode 100644 index d741ec73c..000000000 --- a/examples/dev/button-hal/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Button HAL Example -This example demonstrates and tests the functionality of the Button HAL. -You can use this example to: - -* Understand the logic of the button HAL. -* Test your implementation of arch-specific button HAL components if you are -developing a new port. - -This example assumes a device with at least one switch (button or simiar). - -# Supported devices -This example is expected to work off-the-shelf on the following boards: - -* All CC13xx/CC26xx devices -* All CC2538 devices diff --git a/examples/dev/button-hal/button-hal-example.c b/examples/dev/button-hal/button-hal-example.c deleted file mode 100644 index db34b86af..000000000 --- a/examples/dev/button-hal/button-hal-example.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/button-hal.h" - -#include -/*---------------------------------------------------------------------------*/ -PROCESS(button_hal_example, "Button HAL Example"); -AUTOSTART_PROCESSES(&button_hal_example); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(button_hal_example, ev, data) -{ - button_hal_button_t *btn; - - PROCESS_BEGIN(); - - btn = button_hal_get_by_index(0); - - printf("Button HAL example.\n"); - printf("Device button count: %u.\n", button_hal_button_count); - - if(btn) { - printf("%s on pin %u with ID=0, Logic=%s, Pull=%s\n", - BUTTON_HAL_GET_DESCRIPTION(btn), btn->pin, - btn->negative_logic ? "Negative" : "Positive", - btn->pull == GPIO_HAL_PIN_CFG_PULL_UP ? "Pull Up" : "Pull Down"); - } - - while(1) { - - PROCESS_YIELD(); - - if(ev == button_hal_press_event) { - btn = (button_hal_button_t *)data; - printf("Press event (%s)\n", BUTTON_HAL_GET_DESCRIPTION(btn)); - - if(btn == button_hal_get_by_id(BUTTON_HAL_ID_BUTTON_ZERO)) { - printf("This was button 0, on pin %u\n", btn->pin); - } - } else if(ev == button_hal_release_event) { - btn = (button_hal_button_t *)data; - printf("Release event (%s)\n", BUTTON_HAL_GET_DESCRIPTION(btn)); - } else if(ev == button_hal_periodic_event) { - btn = (button_hal_button_t *)data; - printf("Periodic event, %u seconds (%s)\n", btn->press_duration_seconds, - BUTTON_HAL_GET_DESCRIPTION(btn)); - - if(btn->press_duration_seconds > 5) { - printf("%s pressed for more than 5 secs. Do custom action\n", - BUTTON_HAL_GET_DESCRIPTION(btn)); - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/dev/button-hal/project-conf.h b/examples/dev/button-hal/project-conf.h deleted file mode 100644 index 457b42bfc..000000000 --- a/examples/dev/button-hal/project-conf.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Force button descriptions */ -#define BUTTON_HAL_CONF_WITH_DESCRIPTION 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/dev/gpio-hal/Makefile b/examples/dev/gpio-hal/Makefile deleted file mode 100644 index 234388c09..000000000 --- a/examples/dev/gpio-hal/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = gpio-hal-example -CONTIKI = ../../.. - -PLATFORMS_ONLY = cc26x0-cc13x0 cc2538dk openmote-cc2538 zoul native simplelink - -include $(CONTIKI)/Makefile.identify-target - -MODULES_REL += $(TARGET) - -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/dev/gpio-hal/README.md b/examples/dev/gpio-hal/README.md deleted file mode 100644 index 84ab68f88..000000000 --- a/examples/dev/gpio-hal/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# GPIO HAL Example -This example demonstrates and tests the functionality of the GPIO HAL. You can -use it to: - -* Understand the logic of the GPIO HAL. -* Test your implementation of arch-specific GPIO HAL components if you are -developing a new port. - -This example assumes a device with: - -* 3 output pins (e.g. LEDs). -* 1 button. - -# Supported devices -This example is expected to work off-the-shelf on the following boards: - -* All CC13xx/CC26xx devices -* All CC2538 devices - -# Extending for other platforms -Create a sub-directory with the same name as your platform. For example, for -platform `my-new-platform` create a subdirectory called `my-new-platform`. -Source files in this directory will be compiled automatically. In the most -simple case, all you will need is a source file called e.g. `pins.c` (it's OK -to use a different filename). In this file, you will need to provide -definitions of the variables used by the example to manipulate pins. These -variables are: - -* `out_pin1`, `out_pin2` and `out_pin3` for output pins. -* `btn_pin` for the button pin. - -Assign to those variables a value that corresponds to the output pin in your -board that you wish to test with the example. For example, if you have a LED -connected to pin 20, then you will need to - - gpio_hal_pin_t out_pin1 = 20; diff --git a/examples/dev/gpio-hal/cc2538dk/pins.c b/examples/dev/gpio-hal/cc2538dk/pins.c deleted file mode 100644 index 4cb3e9742..000000000 --- a/examples/dev/gpio-hal/cc2538dk/pins.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/gpio-hal.h" -/*---------------------------------------------------------------------------*/ -/* - * LEDs on the SmartRF06 (EB and BB) are connected as follows: - * - LED1 (Red) -> PC0 - * - LED2 (Yellow) -> PC1 (gpio_hal_pin_t 17) - * - LED3 (Green) -> PC2 (gpio_hal_pin_t 18) - * - LED4 (Orange) -> PC3 (gpio_hal_pin_t 19) - * - * LED1 shares the same pin with the USB pullup, so here we'll use PC1, PC2 - * and PC3. - */ -gpio_hal_pin_t out_pin1 = 17; -gpio_hal_pin_t out_pin2 = 18; -gpio_hal_pin_t out_pin3 = 19; -/*---------------------------------------------------------------------------*/ -/* Button pin: Button select, PA3 */ -gpio_hal_pin_t btn_pin = 3; -/*---------------------------------------------------------------------------*/ diff --git a/examples/dev/gpio-hal/cc26x0-cc13x0/pins.c b/examples/dev/gpio-hal/cc26x0-cc13x0/pins.c deleted file mode 100644 index 700f8961b..000000000 --- a/examples/dev/gpio-hal/cc26x0-cc13x0/pins.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/gpio-hal.h" -/*---------------------------------------------------------------------------*/ -#if CONTIKI_BOARD_SENSORTAG_CC1350 -#define PINS2_AND_3 BOARD_IOID_LED_1 -#else -#define PINS2_AND_3 BOARD_IOID_LED_2 -#endif -gpio_hal_pin_t out_pin1 = BOARD_IOID_LED_1; -gpio_hal_pin_t out_pin2 = PINS2_AND_3; -gpio_hal_pin_t out_pin3 = PINS2_AND_3; -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_t btn_pin = BOARD_IOID_KEY_LEFT; -/*---------------------------------------------------------------------------*/ diff --git a/examples/dev/gpio-hal/gpio-hal-example.c b/examples/dev/gpio-hal/gpio-hal-example.c deleted file mode 100644 index 75137e26a..000000000 --- a/examples/dev/gpio-hal/gpio-hal-example.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/gpio-hal.h" -#include "sys/etimer.h" -#include "lib/sensors.h" -#include "dev/button-hal.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -extern gpio_hal_pin_t out_pin1, out_pin2, out_pin3; -extern gpio_hal_pin_t btn_pin; -/*---------------------------------------------------------------------------*/ -static struct etimer et; -static uint8_t counter; -/*---------------------------------------------------------------------------*/ -/* Print gpio_hal_pin_mask_t using the correct format */ -#if GPIO_HAL_PIN_COUNT > 32 -#define PIN_MASK_FMT "0x%016" PRIx64 -#else -#define PIN_MASK_FMT "0x%08" PRIx32 -#endif -/*---------------------------------------------------------------------------*/ -PROCESS(gpio_hal_example, "GPIO HAL Example"); -AUTOSTART_PROCESSES(&gpio_hal_example); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(gpio_hal_example, ev, data) -{ - PROCESS_BEGIN(); - - counter = 0; - - etimer_set(&et, CLOCK_SECOND); - - while(1) { - - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_TIMER && data == &et) { - if((counter & 7) == 0) { - /* Set output and test write, high */ - gpio_hal_arch_pin_set_output(out_pin1); - gpio_hal_arch_pin_set_output(out_pin2); - gpio_hal_arch_pin_set_output(out_pin3); - - gpio_hal_arch_write_pin(out_pin1, 1); - gpio_hal_arch_write_pins( - gpio_hal_pin_to_mask(out_pin2) | gpio_hal_pin_to_mask(out_pin3), - gpio_hal_pin_to_mask(out_pin2) | gpio_hal_pin_to_mask(out_pin3)); - } else if((counter & 7) == 1) { - /* Test write, low */ - gpio_hal_arch_write_pin(out_pin1, 0); - gpio_hal_arch_write_pins( - gpio_hal_pin_to_mask(out_pin2) | gpio_hal_pin_to_mask(out_pin3), 0); - } else if((counter & 7) == 2) { - /* Test set */ - gpio_hal_arch_set_pin(out_pin1); - gpio_hal_arch_set_pins( - gpio_hal_pin_to_mask(out_pin2) | gpio_hal_pin_to_mask(out_pin3)); - } else if((counter & 7) == 3) { - /* Test clear */ - gpio_hal_arch_clear_pin(out_pin1); - gpio_hal_arch_clear_pins( - gpio_hal_pin_to_mask(out_pin2) | gpio_hal_pin_to_mask(out_pin3)); - } else if((counter & 7) == 4) { - /* Test toggle (should go high) */ - gpio_hal_arch_toggle_pin(out_pin1); - gpio_hal_arch_toggle_pins( - gpio_hal_pin_to_mask(out_pin2) | gpio_hal_pin_to_mask(out_pin3)); - } else if((counter & 7) == 5) { - /* Test toggle (should go low) */ - gpio_hal_arch_toggle_pin(out_pin1); - gpio_hal_arch_toggle_pins( - gpio_hal_pin_to_mask(out_pin2) | gpio_hal_pin_to_mask(out_pin3)); - } else if((counter & 7) == 6) { - /* Set to input and then set. Should stay off */ - gpio_hal_arch_pin_set_input(out_pin1); - gpio_hal_arch_pin_set_input(out_pin2); - gpio_hal_arch_pin_set_input(out_pin3); - gpio_hal_arch_set_pin(out_pin1); - gpio_hal_arch_set_pins( - gpio_hal_pin_to_mask(out_pin2) | gpio_hal_pin_to_mask(out_pin3)); - } else if((counter & 7) == 7) { - /* Toggle button interrupt */ - gpio_hal_pin_cfg_t interrupt; - - interrupt = gpio_hal_arch_pin_cfg_get(btn_pin) & - GPIO_HAL_PIN_CFG_INT_ENABLE; - - if(interrupt == 0) { - printf("Enabling button interrupt\n"); - gpio_hal_arch_interrupt_enable(btn_pin); - } else { - printf("Disabling button interrupt\n"); - gpio_hal_arch_interrupt_disable(btn_pin); - } - } - - /* Test read */ - printf("%u: Pins are 1-%u, 2=%u, 3=%u, mask=" PIN_MASK_FMT "\n", - counter & 7, - gpio_hal_arch_read_pin(out_pin1), - gpio_hal_arch_read_pin(out_pin2), - gpio_hal_arch_read_pin(out_pin3), - gpio_hal_arch_read_pins(gpio_hal_pin_to_mask(out_pin1) | - gpio_hal_pin_to_mask(out_pin2) | - gpio_hal_pin_to_mask(out_pin3))); - - counter++; - etimer_set(&et, CLOCK_SECOND); - } else if(ev == button_hal_release_event) { - printf("Button release event %s\n", - BUTTON_HAL_GET_DESCRIPTION((button_hal_button_t *)data)); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/dev/gpio-hal/native/pins.c b/examples/dev/gpio-hal/native/pins.c deleted file mode 100644 index 10472b78a..000000000 --- a/examples/dev/gpio-hal/native/pins.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/gpio-hal.h" -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_t out_pin1 = 0; -gpio_hal_pin_t out_pin2 = 1; -gpio_hal_pin_t out_pin3 = 2; -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_t btn_pin = 4; -/*---------------------------------------------------------------------------*/ diff --git a/examples/dev/gpio-hal/openmote-cc2538/pins.c b/examples/dev/gpio-hal/openmote-cc2538/pins.c deleted file mode 100644 index 340aff15c..000000000 --- a/examples/dev/gpio-hal/openmote-cc2538/pins.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/gpio-hal.h" -/*---------------------------------------------------------------------------*/ -/* - * LEDs on the OpenMote-CC2538 are connected as follows: - * - LED1 (Red) -> PC4 (gpio_hal_pin_t 20) - * - LED2 (Yellow) -> PC6 (gpio_hal_pin_t 22) - * - LED3 (Green) -> PC7 (gpio_hal_pin_t 23) - * - LED4 (Orange) -> PC5 - */ -gpio_hal_pin_t out_pin1 = 20; -gpio_hal_pin_t out_pin2 = 22; -gpio_hal_pin_t out_pin3 = 23; -/*---------------------------------------------------------------------------*/ -/* Button pin: PC3 */ -gpio_hal_pin_t btn_pin = 19; -/*---------------------------------------------------------------------------*/ diff --git a/examples/dev/gpio-hal/simplelink/pins.c b/examples/dev/gpio-hal/simplelink/pins.c deleted file mode 100644 index 16a7afa1f..000000000 --- a/examples/dev/gpio-hal/simplelink/pins.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015-2018, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_t out_pin1 = Board_PIN_LED0; -gpio_hal_pin_t out_pin2 = Board_PIN_LED1; -gpio_hal_pin_t out_pin3 = Board_PIN_LED2; -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_t btn_pin = Board_PIN_BTN1; -/*---------------------------------------------------------------------------*/ diff --git a/examples/dev/gpio-hal/zoul/pins.c b/examples/dev/gpio-hal/zoul/pins.c deleted file mode 100644 index ff44bf4d1..000000000 --- a/examples/dev/gpio-hal/zoul/pins.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/gpio-hal.h" -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_t out_pin1 = (LEDS_ARCH_L1_PORT << 3) + LEDS_ARCH_L1_PIN; -gpio_hal_pin_t out_pin2 = (LEDS_ARCH_L2_PORT << 3) + LEDS_ARCH_L2_PIN; -gpio_hal_pin_t out_pin3 = (LEDS_ARCH_L3_PORT << 3) + LEDS_ARCH_L3_PIN; -/*---------------------------------------------------------------------------*/ -gpio_hal_pin_t btn_pin = (BUTTON_USER_PORT << 3) + BUTTON_USER_PIN; -/*---------------------------------------------------------------------------*/ diff --git a/examples/dev/leds/Makefile b/examples/dev/leds/Makefile deleted file mode 100644 index 7c5f5f592..000000000 --- a/examples/dev/leds/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CONTIKI_PROJECT = leds-example -CONTIKI = ../../.. - -MODULES_REL += $(TARGET) - -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/dev/leds/README.md b/examples/dev/leds/README.md deleted file mode 100644 index 05bdc20ba..000000000 --- a/examples/dev/leds/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# LED HAL Example -This example demonstrates and tests the functionality of the LED HAL. You can -use it to: - -* Understand the logic of the LED HAL. -* Test your implementation of arch-specific LED HAL components if you are -developing a new port. - -This example assumes a device with at least 1 LED. - -# Supported devices -This example is expected to work off-the-shelf on the following boards: - -* All CC13xx/CC26xx devices -* All CC2538 devices diff --git a/examples/dev/leds/leds-example.c b/examples/dev/leds/leds-example.c deleted file mode 100644 index b62668e8b..000000000 --- a/examples/dev/leds/leds-example.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/leds.h" -#include "sys/etimer.h" - -#include -/*---------------------------------------------------------------------------*/ -static struct etimer et; -static uint8_t counter; -/*---------------------------------------------------------------------------*/ -PROCESS(leds_example, "LED HAL Example"); -AUTOSTART_PROCESSES(&leds_example); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(leds_example, ev, data) -{ - PROCESS_BEGIN(); - - counter = 0; - - etimer_set(&et, CLOCK_SECOND); - - while(1) { - - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_TIMER && data == &et) { - if((counter & 7) == 0) { - leds_set(LEDS_ALL); - } else if((counter & 7) == 1) { - leds_off(LEDS_ALL); - } else if((counter & 7) == 2) { - leds_on(LEDS_ALL); - } else if((counter & 7) == 3) { - leds_toggle(LEDS_ALL); -#if !LEDS_LEGACY_API - } else if((counter & 7) == 4) { - leds_single_on(LEDS_LED1); - } else if((counter & 7) == 5) { - leds_single_off(LEDS_LED1); - } else if((counter & 7) == 6) { - leds_single_toggle(LEDS_LED1); -#endif /* LEDS_LEGACY_API */ - } else if((counter & 7) == 7) { - leds_toggle(LEDS_ALL); - } - - counter++; - etimer_set(&et, CLOCK_SECOND); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/dev/rgb-led/Makefile b/examples/dev/rgb-led/Makefile deleted file mode 100644 index e2142cf2d..000000000 --- a/examples/dev/rgb-led/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -CONTIKI_PROJECT = rgb-led-example -CONTIKI = ../../.. - -MODULES_REL += $(TARGET) - -PLATFORMS_ONLY = zoul - -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/dev/rgb-led/Makefile.target b/examples/dev/rgb-led/Makefile.target deleted file mode 100644 index 75430a6e4..000000000 --- a/examples/dev/rgb-led/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = zoul diff --git a/examples/dev/rgb-led/README.md b/examples/dev/rgb-led/README.md deleted file mode 100644 index 1b10926ce..000000000 --- a/examples/dev/rgb-led/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# RGB LED Example -This example demonstrates and tests the functionality of the RGB LED driver. -You can use it to: - -* Understand the logic of the RGB LED driver. -* Test your implementation if you are developing a new port for a device that -features this part. - -This example assumes a device with an RGB LED. - -# Supported devices -This example is expected to work off-the-shelf on the following boards: - -* All Zoul-based devices diff --git a/examples/dev/rgb-led/rgb-led-example.c b/examples/dev/rgb-led/rgb-led-example.c deleted file mode 100644 index e2c2de21e..000000000 --- a/examples/dev/rgb-led/rgb-led-example.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/rgb-led/rgb-led.h" -#include "sys/etimer.h" - -#include -/*---------------------------------------------------------------------------*/ -static struct etimer et; -static uint8_t counter; -/*---------------------------------------------------------------------------*/ -PROCESS(rgb_led_example, "RGB LED Example"); -AUTOSTART_PROCESSES(&rgb_led_example); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(rgb_led_example, ev, data) -{ - PROCESS_BEGIN(); - - counter = 0; - - etimer_set(&et, CLOCK_SECOND); - - while(1) { - - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_TIMER && data == &et) { - if((counter & 7) == 0) { - rgb_led_off(); - } else if((counter & 7) == 1) { - rgb_led_set(RGB_LED_RED); - } else if((counter & 7) == 2) { - rgb_led_set(RGB_LED_GREEN); - } else if((counter & 7) == 3) { - rgb_led_set(RGB_LED_BLUE); - } else if((counter & 7) == 4) { - rgb_led_set(RGB_LED_CYAN); - } else if((counter & 7) == 5) { - rgb_led_set(RGB_LED_MAGENTA); - } else if((counter & 7) == 6) { - rgb_led_set(RGB_LED_YELLOW); - } else if((counter & 7) == 7) { - rgb_led_set(RGB_LED_WHITE); - } - - counter++; - etimer_set(&et, CLOCK_SECOND); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/hello-world/Makefile b/examples/hello-world/Makefile deleted file mode 100644 index 0a79167ae..000000000 --- a/examples/hello-world/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -CONTIKI_PROJECT = hello-world -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/hello-world/README.md b/examples/hello-world/README.md deleted file mode 100644 index 4bc59faea..000000000 --- a/examples/hello-world/README.md +++ /dev/null @@ -1,19 +0,0 @@ -A minimal Contiki-NG example, simple printing out "Hello, world". -This example runs a full IPv6 stack with 6LoWPAN and RPL. -It is possible, for example to ping such a node: - -``` -make TARGET=native && sudo ./hello-world.native -``` - -Look for the node's global IPv6, e.g.: -``` -[INFO: Native ] Added global IPv6 address fd00::302:304:506:708 -``` - -And ping it (over the tun interface): -``` -$ ping6 fd00::302:304:506:708 -PING fd00::302:304:506:708(fd00::302:304:506:708) 56 data bytes -64 bytes from fd00::302:304:506:708: icmp_seq=1 ttl=64 time=0.289 ms -``` diff --git a/examples/hello-world/hello-world.c b/examples/hello-world/hello-world.c deleted file mode 100644 index e6d452d9e..000000000 --- a/examples/hello-world/hello-world.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A very simple Contiki application showing how Contiki programs look - * \author - * Adam Dunkels - */ - -#include "contiki.h" - -#include /* For printf() */ -/*---------------------------------------------------------------------------*/ -PROCESS(hello_world_process, "Hello world process"); -AUTOSTART_PROCESSES(&hello_world_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(hello_world_process, ev, data) -{ - static struct etimer timer; - - PROCESS_BEGIN(); - - /* Setup a periodic timer that expires after 10 seconds. */ - etimer_set(&timer, CLOCK_SECOND * 10); - - while(1) { - printf("Hello, world\n"); - - /* Wait for the periodic timer to expire and then restart the timer. */ - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&timer)); - etimer_reset(&timer); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/ip64-router/Makefile b/examples/ip64-router/Makefile deleted file mode 100644 index 0beea11bd..000000000 --- a/examples/ip64-router/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -CONTIKI_PROJECT = ip64-router -all: $(CONTIKI_PROJECT) -CONTIKI=../.. - -# Currently only supported on Orion, the only platform with 802.15.4 + Ethernet -PLATFORMS_ONLY = zoul -BOARDS_ONLY = orion -BOARD = orion -WITH_IP64 = 1 - -include $(CONTIKI)/Makefile.include diff --git a/examples/ip64-router/ip64-router.c b/examples/ip64-router/ip64-router.c deleted file mode 100644 index 632b9ba2e..000000000 --- a/examples/ip64-router/ip64-router.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "contiki.h" -#include "contiki-net.h" -#include "ip64/ip64.h" -#include "net/netstack.h" -#include "net/routing/routing.h" -#include "sys/autostart.h" - -/*---------------------------------------------------------------------------*/ -PROCESS(router_node_process, "Router node"); -AUTOSTART_PROCESSES(&router_node_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(router_node_process, ev, data) -{ - PROCESS_BEGIN(); - - /* Set us up as a RPL root node. */ - NETSTACK_ROUTING.root_start(); - - /* Initialize the IP64 module so we'll start translating packets */ - ip64_init(); - - /* ... and do nothing more. */ - while(1) { - PROCESS_WAIT_EVENT(); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/ip64-router/project-conf.h b/examples/ip64-router/project-conf.h deleted file mode 100644 index 38f34be86..000000000 --- a/examples/ip64-router/project-conf.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -#define UIP_CONF_TCP 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/libs/data-structures/Makefile b/examples/libs/data-structures/Makefile deleted file mode 100644 index 1f4d6b765..000000000 --- a/examples/libs/data-structures/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -CONTIKI_PROJECT = data-structures - -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../.. - -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/data-structures/data-structures.c b/examples/libs/data-structures/data-structures.c deleted file mode 100644 index 21752762a..000000000 --- a/examples/libs/data-structures/data-structures.c +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * Copyright (c) 2017, James Pope - * 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 "contiki.h" -#include "lib/stack.h" -#include "lib/queue.h" -#include "lib/circular-list.h" -#include "lib/dbl-list.h" -#include "lib/dbl-circ-list.h" -#include "lib/random.h" - -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -PROCESS(data_structure_process, "Data structure process"); -AUTOSTART_PROCESSES(&data_structure_process); -/*---------------------------------------------------------------------------*/ -STACK(demo_stack); -QUEUE(demo_queue); -CIRCULAR_LIST(demo_cll); -DBL_LIST(demo_dbl); -DBL_CIRC_LIST(demo_dblcl); -/*---------------------------------------------------------------------------*/ -typedef struct demo_struct_s { - struct demo_struct_s *next; - struct demo_struct_s *previous; - unsigned short value; -} demo_struct_t; -/*---------------------------------------------------------------------------*/ -#define DATA_STRUCTURE_DEMO_ELEMENT_COUNT 4 -static demo_struct_t elements[DATA_STRUCTURE_DEMO_ELEMENT_COUNT]; -/*---------------------------------------------------------------------------*/ -static void -dbl_circ_list_print(dbl_circ_list_t dblcl) -{ - demo_struct_t *this = *dblcl; - - if(*dblcl == NULL) { - printf("Length=0\n"); - return; - } - - do { - printf("<--(0x%04x)--0x%04x--(0x%04x)-->", this->previous->value, - this->value, this->next->value); - this = this->next; - } while(this != *dblcl); - - printf(" (Length=%lu)\n", dbl_circ_list_length(dblcl)); -} -/*---------------------------------------------------------------------------*/ -static void -demonstrate_dbl_circ_list(void) -{ - int i; - demo_struct_t *this; - - dbl_circ_list_init(demo_dblcl); - printf("============================\n"); - printf("Circular, doubly-linked list\n"); - - for(i = 0; i < DATA_STRUCTURE_DEMO_ELEMENT_COUNT; i++) { - elements[i].next = NULL; - elements[i].previous = NULL; - } - - /* Add elements */ - dbl_circ_list_add_tail(demo_dblcl, &elements[0]); - printf("Add tail : 0x%04x | ", elements[0].value); - dbl_circ_list_print(demo_dblcl); - - dbl_circ_list_add_after(demo_dblcl, &elements[0], &elements[1]); - printf("Add after : 0x%04x | ", elements[1].value); - dbl_circ_list_print(demo_dblcl); - - dbl_circ_list_add_head(demo_dblcl, &elements[2]); - printf("Add head : 0x%04x | ", elements[2].value); - dbl_circ_list_print(demo_dblcl); - - dbl_circ_list_add_before(demo_dblcl, &elements[2], &elements[3]); - printf("Add before: 0x%04x | ", elements[3].value); - dbl_circ_list_print(demo_dblcl); - - /* Remove head */ - this = dbl_circ_list_head(demo_dblcl); - printf("Rm head: (0x%04x) | ", this->value); - dbl_circ_list_remove(demo_dblcl, this); - dbl_circ_list_print(demo_dblcl); - - /* Remove currently second element */ - this = ((demo_struct_t *)dbl_circ_list_head(demo_dblcl))->next; - printf("Rm 2nd : (0x%04x) | ", this->value); - dbl_circ_list_remove(demo_dblcl, this); - dbl_circ_list_print(demo_dblcl); - - /* Remove tail */ - this = dbl_circ_list_tail(demo_dblcl); - printf("Rm tail: (0x%04x) | ", this->value); - dbl_circ_list_remove(demo_dblcl, this); - dbl_circ_list_print(demo_dblcl); - - /* Remove last remaining element */ - this = dbl_circ_list_tail(demo_dblcl); - printf("Rm last: (0x%04x) | ", this->value); - dbl_circ_list_remove(demo_dblcl, this); - dbl_circ_list_print(demo_dblcl); - - printf("Circular, doubly-linked list is%s empty\n", - dbl_circ_list_is_empty(demo_dblcl) ? "" : " not"); -} -/*---------------------------------------------------------------------------*/ -static void -dbl_list_print(dbl_list_t dll) -{ - demo_struct_t *this; - - for(this = *dll; this != NULL; this = this->next) { - printf("<--("); - if(this->previous == NULL) { - printf(" null "); - } else { - printf("0x%04x", this->previous->value); - } - - printf(")--0x%04x--(", this->value); - - if(this->next == NULL) { - printf(" null "); - } else { - printf("0x%04x", this->next->value); - } - printf(")-->"); - } - - printf(" (Length=%lu)\n", dbl_list_length(dll)); -} -/*---------------------------------------------------------------------------*/ -static void -demonstrate_dbl_list(void) -{ - int i; - demo_struct_t *this; - - dbl_list_init(demo_dbl); - printf("==================\n"); - printf("Doubly-linked list\n"); - - for(i = 0; i < DATA_STRUCTURE_DEMO_ELEMENT_COUNT; i++) { - elements[i].next = NULL; - elements[i].previous = NULL; - } - - /* Add elements */ - dbl_list_add_tail(demo_dbl, &elements[0]); - printf("Add tail : 0x%04x | ", elements[0].value); - dbl_list_print(demo_dbl); - - dbl_list_add_after(demo_dbl, &elements[0], &elements[1]); - printf("Add after : 0x%04x | ", elements[1].value); - dbl_list_print(demo_dbl); - - dbl_list_add_head(demo_dbl, &elements[2]); - printf("Add head : 0x%04x | ", elements[2].value); - dbl_list_print(demo_dbl); - - dbl_list_add_before(demo_dbl, &elements[2], &elements[3]); - printf("Add before: 0x%04x | ", elements[3].value); - dbl_list_print(demo_dbl); - - /* Remove head */ - this = dbl_list_head(demo_dbl); - printf("Rm head: (0x%04x) | ", this->value); - dbl_list_remove(demo_dbl, this); - dbl_list_print(demo_dbl); - - /* Remove currently second element */ - this = ((demo_struct_t *)dbl_list_head(demo_dbl))->next; - printf("Rm 2nd : (0x%04x) | ", this->value); - dbl_list_remove(demo_dbl, this); - dbl_list_print(demo_dbl); - - /* Remove tail */ - this = dbl_list_tail(demo_dbl); - printf("Rm tail: (0x%04x) | ", this->value); - dbl_list_remove(demo_dbl, this); - dbl_list_print(demo_dbl); - - /* Remove last remaining element */ - this = dbl_list_tail(demo_dbl); - printf("Rm last: (0x%04x) | ", this->value); - dbl_list_remove(demo_dbl, this); - dbl_list_print(demo_dbl); - - printf("Doubly-linked list is%s empty\n", - dbl_list_is_empty(demo_dbl) ? "" : " not"); -} -/*---------------------------------------------------------------------------*/ -static void -circular_list_print(circular_list_t cl) -{ - demo_struct_t *this = *cl; - - if(*cl == NULL) { - printf("Length=0\n"); - return; - } - - do { - printf("0x%04x-->", this->value); - this = this->next; - } while(this != *cl); - - printf("0x%04x (Length=%lu)\n", this->value, circular_list_length(cl)); -} -/*---------------------------------------------------------------------------*/ -static void -demonstrate_circular_list(void) -{ - int i; - - circular_list_init(demo_cll); - printf("============================\n"); - printf("Circular, singly-linked list\n"); - - /* Add elements */ - for(i = 0; i < DATA_STRUCTURE_DEMO_ELEMENT_COUNT; i++) { - elements[i].next = NULL; - circular_list_add(demo_cll, &elements[i]); - - printf("Add: 0x%04x | ", elements[i].value); - circular_list_print(demo_cll); - } - - /* Remove head */ - circular_list_remove(demo_cll, circular_list_head(demo_cll)); - printf("Remove head | "); - circular_list_print(demo_cll); - - /* Remove currently second element */ - circular_list_remove(demo_cll, - ((demo_struct_t *)circular_list_head(demo_cll))->next); - printf("Remove 2nd | "); - circular_list_print(demo_cll); - - /* Remove tail */ - circular_list_remove(demo_cll, circular_list_tail(demo_cll)); - printf("Remove tail | "); - circular_list_print(demo_cll); - - /* Remove last remaining element */ - circular_list_remove(demo_cll, circular_list_tail(demo_cll)); - printf("Remove last | "); - circular_list_print(demo_cll); - - printf("Circular list is%s empty\n", - circular_list_is_empty(demo_cll) ? "" : " not"); -} -/*---------------------------------------------------------------------------*/ -static void -demonstrate_stack(void) -{ - int i; - demo_struct_t *this; - - printf("=====\n"); - printf("Stack\n"); - - stack_init(demo_stack); - - /* Add elements */ - for(i = 0; i < DATA_STRUCTURE_DEMO_ELEMENT_COUNT; i++) { - elements[i].next = NULL; - stack_push(demo_stack, &elements[i]); - printf("Push: 0x%04x\n", elements[i].value); - } - - printf("Peek: 0x%04x\n", - ((demo_struct_t *)stack_peek(demo_stack))->value); - - for(i = 0; i <= DATA_STRUCTURE_DEMO_ELEMENT_COUNT; i++) { - this = stack_pop(demo_stack); - printf("Pop: "); - if(this == NULL) { - printf("(stack underflow)\n"); - } else { - printf("0x%04x\n", this->value); - } - } - printf("Stack is%s empty\n", - stack_is_empty(demo_stack) ? "" : " not"); -} -/*---------------------------------------------------------------------------*/ -static void -demonstrate_queue(void) -{ - int i; - demo_struct_t *this; - - printf("=====\n"); - printf("Queue\n"); - - queue_init(demo_queue); - - /* Add elements */ - for(i = 0; i < DATA_STRUCTURE_DEMO_ELEMENT_COUNT; i++) { - elements[i].next = NULL; - queue_enqueue(demo_queue, &elements[i]); - printf("Enqueue: 0x%04x\n", elements[i].value); - } - - printf("Peek: 0x%04x\n", - ((demo_struct_t *)queue_peek(demo_queue))->value); - - for(i = 0; i <= DATA_STRUCTURE_DEMO_ELEMENT_COUNT; i++) { - this = queue_dequeue(demo_queue); - printf("Dequeue: "); - if(this == NULL) { - printf("(queue underflow)\n"); - } else { - printf("0x%04lx\n", (unsigned long)this->value); - } - } - - printf("Queue is%s empty\n", - queue_is_empty(demo_queue) ? "" : " not"); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(data_structure_process, ev, data) -{ - int i; - - PROCESS_BEGIN(); - - /* Generate some elements */ - printf("Elements: ["); - - for(i = 0; i < DATA_STRUCTURE_DEMO_ELEMENT_COUNT; i++) { - elements[i].next = NULL; - elements[i].value = random_rand(); - printf(" 0x%04x", elements[i].value); - } - printf(" ]\n"); - - demonstrate_stack(); - demonstrate_queue(); - demonstrate_circular_list(); - demonstrate_dbl_list(); - demonstrate_dbl_circ_list(); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/deployment/Makefile b/examples/libs/deployment/Makefile deleted file mode 100644 index 5ad17e22d..000000000 --- a/examples/libs/deployment/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -CONTIKI_PROJECT = node -all: $(CONTIKI_PROJECT) - -MODULES += os/services/deployment - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/deployment/README.md b/examples/libs/deployment/README.md deleted file mode 100644 index 8484c3aee..000000000 --- a/examples/libs/deployment/README.md +++ /dev/null @@ -1,3 +0,0 @@ -A simple example of how to use the deployment module. Intended for Cooja, -with a Cooja motes, as in the provided simulation file `sim.csc`. For use -in a real deployment, set DEPLOYMENT_MAPPING to your own ID-MAC mapping table. diff --git a/examples/libs/deployment/node.c b/examples/libs/deployment/node.c deleted file mode 100644 index 2cbe1f276..000000000 --- a/examples/libs/deployment/node.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Benchmark: the root sends requests to all nodes in a randomized - * order, and receives resopnses back. - * \author - * Simon Duquennoy - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "services/deployment/deployment.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#include "services/deployment/deployment.h" - -/** \brief A mapping table for a 8-node Cooja mote simulation. - * Define your own for any given deployment environment */ -const struct id_mac deployment_cooja8[] = { - { 1, {{0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01}}}, - { 2, {{0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02}}}, - { 3, {{0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03}}}, - { 4, {{0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04}}}, - { 5, {{0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05}}}, - { 6, {{0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06}}}, - { 7, {{0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07}}}, - { 8, {{0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08}}}, - { 0, {{0}}} -}; - -/** \brief An example mapping for Openmotes in Flocklab. - * To use, set DEPLOYMENT_MAPPING to deployment_flocklab_openmotes */ -const struct id_mac deployment_flocklab_openmotes[] = { - { 3, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0x9b,0x29}}}, - { 6, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0x9b,0x34}}}, - { 8, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0x9b,0x1f}}}, - { 15, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0x9b,0x85}}}, - { 16, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0x9b,0x00}}}, - { 18, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0x9b,0x37}}}, - { 22, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0x9b,0x08}}}, - { 23, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0x9b,0x5f}}}, - { 31, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0x9b,0xb1}}}, - { 0, {{0}}} -}; - -/*---------------------------------------------------------------------------*/ -PROCESS(app_process, "App process"); -AUTOSTART_PROCESSES(&app_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(app_process, ev, data) -{ - static struct etimer timer; - static uip_ipaddr_t ipaddr; - static linkaddr_t lladdr; - static int i; - - PROCESS_BEGIN(); - - if(node_id == ROOT_ID) { - /* We are the root, start a DAG */ - NETSTACK_ROUTING.root_start(); - /* Setup a periodic timer that expires after 10 seconds. */ - etimer_set(&timer, CLOCK_SECOND * 10); - /* Wait until all nodes have joined */ - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&timer)); - etimer_reset(&timer); - /* Log expected IPv6 addresses of all nodes */ - LOG_INFO("Node list:\n"); - for(i = 0; iMAC) */ -#define DEPLOYMENT_MAPPING deployment_cooja8 -/* Compact address logging (both link-layer and IPv6). - * Shows an abbreviated form that contains the node-id */ -#define LOG_CONF_WITH_COMPACT_ADDR 1 - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/libs/deployment/sim.csc b/examples/libs/deployment/sim.csc deleted file mode 100644 index 9daa11426..000000000 --- a/examples/libs/deployment/sim.csc +++ /dev/null @@ -1,275 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype90 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/libs/deployment/node.c - make node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 12.478629242391953 - 42.201041276604826 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 25.625935608473608 - 82.53975431376661 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 51.615094138350024 - 59.70602651475372 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 41.04314122620578 - 121.24693889311891 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 64.9463558635099 - 104.25039302469283 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 93.59263858654369 - 75.40399148300003 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 75.6297158696234 - 139.97002035548905 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.interfaces.Position - 104.34293924684245 - 116.07658566915099 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype90 - - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 2.4250860844175466 0.0 0.0 2.4250860844175466 35.26895372864869 -46.9106236441515 - - 400 - 3 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - App - - - - 827 - 0 - 665 - 681 - -1 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - - - 500.0 - - 1539 - 1 - 263 - 0 - 709 - - diff --git a/examples/libs/energest/Makefile b/examples/libs/energest/Makefile deleted file mode 100644 index 64b84e45e..000000000 --- a/examples/libs/energest/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -CONTIKI_PROJECT = example-energest -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/energest/example-energest.c b/examples/libs/energest/example-energest.c deleted file mode 100644 index 1509493f2..000000000 --- a/examples/libs/energest/example-energest.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 HOLDER 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 - -#include "contiki.h" -#include "sys/energest.h" - -PROCESS(energest_example_process, "energest example process"); -AUTOSTART_PROCESSES(&energest_example_process); -/*---------------------------------------------------------------------------*/ -static inline unsigned long -to_seconds(uint64_t time) -{ - return (unsigned long)(time / ENERGEST_SECOND); -} -/*---------------------------------------------------------------------------*/ -/* - * This Process will periodically print energest values for the last minute. - * - */ -PROCESS_THREAD(energest_example_process, ev, data) -{ - static struct etimer periodic_timer; - - PROCESS_BEGIN(); - - etimer_set(&periodic_timer, CLOCK_SECOND * 10); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_reset(&periodic_timer); - - /* - * Update all energest times. Should always be called before energest - * times are read. - */ - energest_flush(); - - printf("\nEnergest:\n"); - printf(" CPU %4lus LPM %4lus DEEP LPM %4lus Total time %lus\n", - to_seconds(energest_type_time(ENERGEST_TYPE_CPU)), - to_seconds(energest_type_time(ENERGEST_TYPE_LPM)), - to_seconds(energest_type_time(ENERGEST_TYPE_DEEP_LPM)), - to_seconds(ENERGEST_GET_TOTAL_TIME())); - printf(" Radio LISTEN %4lus TRANSMIT %4lus OFF %4lus\n", - to_seconds(energest_type_time(ENERGEST_TYPE_LISTEN)), - to_seconds(energest_type_time(ENERGEST_TYPE_TRANSMIT)), - to_seconds(ENERGEST_GET_TOTAL_TIME() - - energest_type_time(ENERGEST_TYPE_TRANSMIT) - - energest_type_time(ENERGEST_TYPE_LISTEN))); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/energest/project-conf.h b/examples/libs/energest/project-conf.h deleted file mode 100644 index d31cc2030..000000000 --- a/examples/libs/energest/project-conf.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 HOLDER 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define ENERGEST_CONF_ON 1 - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/libs/ipv6-hooks/Makefile b/examples/libs/ipv6-hooks/Makefile deleted file mode 100644 index 63085face..000000000 --- a/examples/libs/ipv6-hooks/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -CONTIKI_PROJECT = ipv6-hooks -all: $(CONTIKI_PROJECT) - -CONTIKI=../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/ipv6-hooks/README.md b/examples/libs/ipv6-hooks/README.md deleted file mode 100644 index 463965d6c..000000000 --- a/examples/libs/ipv6-hooks/README.md +++ /dev/null @@ -1,2 +0,0 @@ -A simple example of how to set up IPv6 packet hooks with netstack_ip_packet_processor_add. -You can run this example as native and then ping the node to see printouts from the hooks, at every packet input/output. diff --git a/examples/libs/ipv6-hooks/ipv6-hooks.c b/examples/libs/ipv6-hooks/ipv6-hooks.c deleted file mode 100644 index 8d8561049..000000000 --- a/examples/libs/ipv6-hooks/ipv6-hooks.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "contiki.h" -#include "net/routing/routing.h" -#include "random.h" -#include "net/netstack.h" -#include "net/ipv6/simple-udp.h" -#include "net/ipv6/uipbuf.h" -#include "net/ipv6/uip-ds6.h" - -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -/*---------------------------------------------------------------------------*/ -PROCESS(ipv6_hooks_process, "IPv6 Hooks"); -AUTOSTART_PROCESSES(&ipv6_hooks_process); -/*---------------------------------------------------------------------------*/ -static enum netstack_ip_action -ip_input(void) -{ - uint8_t proto = 0; - uipbuf_get_last_header(uip_buf, uip_len, &proto); - LOG_INFO("Incoming packet proto: %d from ", proto); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - return NETSTACK_IP_PROCESS; -} -/*---------------------------------------------------------------------------*/ -static enum netstack_ip_action -ip_output(const linkaddr_t *localdest) -{ - uint8_t proto; - uint8_t is_me = 0; - uipbuf_get_last_header(uip_buf, uip_len, &proto); - is_me = uip_ds6_is_my_addr(&UIP_IP_BUF->srcipaddr); - LOG_INFO("Outgoing packet (%s) proto: %d to ", is_me ? "send" : "fwd ", proto); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - return NETSTACK_IP_PROCESS; -} -/*---------------------------------------------------------------------------*/ -struct netstack_ip_packet_processor packet_processor = { - .process_input = ip_input, - .process_output = ip_output -}; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ipv6_hooks_process, ev, data) -{ - PROCESS_BEGIN(); - - /* Register packet processor */ - netstack_ip_packet_processor_add(&packet_processor); - - /* Do nothing */ - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/ipv6-uipbuf/Makefile b/examples/libs/ipv6-uipbuf/Makefile deleted file mode 100644 index b7500284e..000000000 --- a/examples/libs/ipv6-uipbuf/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -CONTIKI_PROJECT = udp-client udp-server -all: $(CONTIKI_PROJECT) - -CONTIKI=../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/ipv6-uipbuf/README.md b/examples/libs/ipv6-uipbuf/README.md deleted file mode 100644 index 6f028202e..000000000 --- a/examples/libs/ipv6-uipbuf/README.md +++ /dev/null @@ -1,5 +0,0 @@ -This example is meant to showcase the capabilities of uipbuf. It currently -focuses only on UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS, which lets an application -set a custom max number of MAC transmissions. Optionally, this information -can be passed on over multiple hops, so that the attribute applies along -the full path. This requires setting UIP_CONF_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS. diff --git a/examples/libs/ipv6-uipbuf/ipv6-uipbuf-cooja.csc b/examples/libs/ipv6-uipbuf/ipv6-uipbuf-cooja.csc deleted file mode 100644 index 71adabb74..000000000 --- a/examples/libs/ipv6-uipbuf/ipv6-uipbuf-cooja.csc +++ /dev/null @@ -1,180 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - IPv6 uipbuf Example - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype829 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/libs/ipv6-uipbuf/udp-server.c - make udp-server.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype405 - Cooja Mote Type #2 - [CONTIKI_DIR]/examples/libs/ipv6-uipbuf/udp-client.c - make udp-client.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 43.291897546941804 - 7.17470867058031 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype829 - - - - org.contikios.cooja.interfaces.Position - 41.0074953544532 - 42.15996473110367 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.plugins.SimControl - 229 - 3 - 157 - 11 - 6 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 1.1719333465234514 0.0 0.0 1.1719333465234514 -4.934308660658031 20.209777273580123 - - 234 - 1 - 257 - 10 - 170 - - - org.contikios.cooja.plugins.LogListener - - App - - - - 1074 - 0 - 713 - 844 - 3 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - - - - 140.4158108891898 - - 1920 - 2 - 384 - 1 - 716 - - - org.contikios.cooja.plugins.RadioLogger - - 407 - - false - false - - 595 - 4 - 706 - 245 - 4 - - diff --git a/examples/libs/ipv6-uipbuf/ipv6-uipbuf-sky.csc b/examples/libs/ipv6-uipbuf/ipv6-uipbuf-sky.csc deleted file mode 100644 index 30fc54e14..000000000 --- a/examples/libs/ipv6-uipbuf/ipv6-uipbuf-sky.csc +++ /dev/null @@ -1,170 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - IPv6 uipbuf Example - generated - 5000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #sky1 - [CONTIKI_DIR]/examples/libs/ipv6-uipbuf/udp-server.c - make udp-server.sky TARGET=sky - [CONTIKI_DIR]/examples/libs/ipv6-uipbuf/udp-server.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - org.contikios.cooja.mspmote.SkyMoteType - sky2 - Sky Mote Type #sky2 - [CONTIKI_DIR]/examples/libs/ipv6-uipbuf/udp-client.c - make udp-client.sky TARGET=sky - [CONTIKI_DIR]/examples/libs/ipv6-uipbuf/udp-client.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 30.051578821079996 - -64.69428746901113 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 21.31366587648077 - -34.91404431659299 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky2 - - - - org.contikios.cooja.plugins.SimControl - 249 - 4 - 184 - 3 - 15 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.AttributeVisualizerSkin - 1.3598488697820064 0.0 0.0 1.3598488697820064 6.142207908179105 118.20877091196155 - - 234 - 1 - 227 - 14 - 210 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1011 - 0 - 556 - 759 - 7 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - - - - 681.712557066089 - - 1804 - 3 - 352 - 0 - 567 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - 500 - 2 - 546 - 259 - 12 - - diff --git a/examples/libs/ipv6-uipbuf/project-conf.h b/examples/libs/ipv6-uipbuf/project-conf.h deleted file mode 100644 index dfbf0d329..000000000 --- a/examples/libs/ipv6-uipbuf/project-conf.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 HOLDER 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -/* Include max MAC Tx in the IPv6 Traffic Class field */ -#define UIP_CONF_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS 1 - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/libs/ipv6-uipbuf/udp-client.c b/examples/libs/ipv6-uipbuf/udp-client.c deleted file mode 100644 index 5616874b5..000000000 --- a/examples/libs/ipv6-uipbuf/udp-client.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "contiki.h" -#include "net/routing/routing.h" -#include "random.h" -#include "net/netstack.h" -#include "net/ipv6/simple-udp.h" - -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#define WITH_SERVER_REPLY 1 -#define UDP_CLIENT_PORT 8765 -#define UDP_SERVER_PORT 5678 - -#define SEND_INTERVAL (60 * CLOCK_SECOND) - -static struct simple_udp_connection udp_conn; - -/*---------------------------------------------------------------------------*/ -PROCESS(udp_client_process, "UDP client"); -AUTOSTART_PROCESSES(&udp_client_process); -/*---------------------------------------------------------------------------*/ -static void -udp_rx_callback(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - unsigned count = *(unsigned *)data; - /* If tagging of traffic class is enabled tc will print number of - transmission - otherwise it will be 0 */ - LOG_INFO("Received response %u (Max MAC Tx: %d) from ", count, - uipbuf_get_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS)); - LOG_INFO_6ADDR(sender_addr); - LOG_INFO_("\n"); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(udp_client_process, ev, data) -{ - static struct etimer periodic_timer; - static unsigned count; - uip_ipaddr_t dest_ipaddr; - - PROCESS_BEGIN(); - - /* Initialize UDP connection */ - simple_udp_register(&udp_conn, UDP_CLIENT_PORT, NULL, - UDP_SERVER_PORT, udp_rx_callback); - - etimer_set(&periodic_timer, random_rand() % SEND_INTERVAL); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - - if(NETSTACK_ROUTING.node_is_reachable() && NETSTACK_ROUTING.get_root_ipaddr(&dest_ipaddr)) { - /* Set the number of transmissions to use for this packet - - this can be used to create more reliable transmissions or - less reliable than the default. Works end-to-end if - UIP_CONF_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS is set to 1. - */ - uipbuf_set_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS, 1 + count % 5); - /* Send to DAG root */ - LOG_INFO("Sending request %u (Max MAC Tx: %d) to ", count, - uipbuf_get_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS)); - LOG_INFO_6ADDR(&dest_ipaddr); - LOG_INFO_("\n"); - simple_udp_sendto(&udp_conn, &count, sizeof(count), &dest_ipaddr); - count++; - } else { - LOG_INFO("Not reachable yet\n"); - } - - /* Add some jitter */ - etimer_set(&periodic_timer, SEND_INTERVAL - - CLOCK_SECOND + (random_rand() % (2 * CLOCK_SECOND))); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/ipv6-uipbuf/udp-server.c b/examples/libs/ipv6-uipbuf/udp-server.c deleted file mode 100644 index 288a0cba9..000000000 --- a/examples/libs/ipv6-uipbuf/udp-server.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "net/routing/routing.h" -#include "net/netstack.h" -#include "net/ipv6/simple-udp.h" - -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#define WITH_SERVER_REPLY 1 -#define UDP_CLIENT_PORT 8765 -#define UDP_SERVER_PORT 5678 - -static struct simple_udp_connection udp_conn; - -PROCESS(udp_server_process, "UDP server"); -AUTOSTART_PROCESSES(&udp_server_process); -/*---------------------------------------------------------------------------*/ -static void -udp_rx_callback(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - unsigned count = *(unsigned *)data; - LOG_INFO("Received request %u (Max MAC Tx: %d) from ", count, - uipbuf_get_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS)); - LOG_INFO_6ADDR(sender_addr); - LOG_INFO_("\n"); -#if WITH_SERVER_REPLY - LOG_INFO("Sending response %u (Max MAC Tx: %d) to ", count, - uipbuf_get_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS)); - LOG_INFO_6ADDR(sender_addr); - LOG_INFO_("\n"); - simple_udp_sendto(&udp_conn, &count, sizeof(count), sender_addr); -#endif /* WITH_SERVER_REPLY */ -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(udp_server_process, ev, data) -{ - PROCESS_BEGIN(); - - /* Initialize DAG root */ - NETSTACK_ROUTING.root_start(); - - /* Initialize UDP connection */ - simple_udp_register(&udp_conn, UDP_SERVER_PORT, NULL, - UDP_CLIENT_PORT, udp_rx_callback); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/logging/Makefile b/examples/libs/logging/Makefile deleted file mode 100644 index eead5bc90..000000000 --- a/examples/libs/logging/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CONTIKI_PROJECT = logging -all: $(CONTIKI_PROJECT) - -# Does not fit on Sky -PLATFORMS_EXCLUDE = sky - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/logging/README.md b/examples/libs/logging/README.md deleted file mode 100644 index 670a07117..000000000 --- a/examples/libs/logging/README.md +++ /dev/null @@ -1,6 +0,0 @@ -Logging -=========== - -This example shows how to configure the logging system. See os/net/sys/log.h -and os/net/sys/log-conf.h more information on logging. Edit project-conf.h -for configure debug levels for the different modules. diff --git a/examples/libs/logging/logging.c b/examples/libs/logging/logging.c deleted file mode 100644 index 92efd9e07..000000000 --- a/examples/libs/logging/logging.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A very simple Contiki application showing how Contiki programs look - * \author - * Adam Dunkels - */ - -#include "contiki.h" - -#include /* For printf() */ -/*---------------------------------------------------------------------------*/ -PROCESS(logging_example_process, "Logging example process"); -AUTOSTART_PROCESSES(&logging_example_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(logging_example_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("Hello, world, from logging example process\n"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/logging/project-conf.h b/examples/libs/logging/project-conf.h deleted file mode 100644 index 8f393c319..000000000 --- a/examples/libs/logging/project-conf.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2015, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -/* Set maximum debug level on all modules. See os/sys/log-conf.h for - * a list of supported modules. The different log levels are defined in - * os/sys/log.h: - * LOG_LEVEL_NONE No log - * LOG_LEVEL_ERR Errors - * LOG_LEVEL_WARN Warnings - * LOG_LEVEL_INFO Basic info - * LOG_LEVEL_DBG Detailled debug - */ -#define LOG_CONF_LEVEL_IPV6 LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_RPL LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_6LOWPAN LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_TCPIP LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_MAC LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_FRAMER LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_COAP LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_LWM2M LOG_LEVEL_DBG -#define LOG_CONF_LEVEL_6TOP LOG_LEVEL_DBG - -/* Enable cooja annotations */ -#define LOG_CONF_WITH_ANNOTATE 1 - -#endif diff --git a/examples/libs/shell/Makefile b/examples/libs/shell/Makefile deleted file mode 100644 index 7be7dd18e..000000000 --- a/examples/libs/shell/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -CONTIKI_PROJECT = example -all: $(CONTIKI_PROJECT) - -MODULES += os/services/shell -CONTIKI = ../../.. - -PLATFORMS_EXCLUDE = sky - -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/shell/README.md b/examples/libs/shell/README.md deleted file mode 100644 index a76aa8c05..000000000 --- a/examples/libs/shell/README.md +++ /dev/null @@ -1 +0,0 @@ -This is a minimal example for the shell. diff --git a/examples/libs/shell/example.c b/examples/libs/shell/example.c deleted file mode 100644 index 51cc98826..000000000 --- a/examples/libs/shell/example.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A very simple example using the shell - * \author - * Simon Duquennoy - */ - -#include "contiki.h" - -#include /* For printf() */ -/*---------------------------------------------------------------------------*/ -PROCESS(example_process, "Example process: shell"); -AUTOSTART_PROCESSES(&example_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(example_process, ev, data) -{ - PROCESS_BEGIN(); - - /* This process does nothing. Connect to the node with `make login` - * to use the shell. */ - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/simple-energest/Makefile b/examples/libs/simple-energest/Makefile deleted file mode 100644 index 056aa5c43..000000000 --- a/examples/libs/simple-energest/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -CONTIKI_PROJECT = example -all: $(CONTIKI_PROJECT) - -MODULES += os/services/simple-energest -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/simple-energest/README.md b/examples/libs/simple-energest/README.md deleted file mode 100644 index 42e382b5f..000000000 --- a/examples/libs/simple-energest/README.md +++ /dev/null @@ -1 +0,0 @@ -This is a minimal example for the module simple-energest. diff --git a/examples/libs/simple-energest/example.c b/examples/libs/simple-energest/example.c deleted file mode 100644 index 35d1f0b8d..000000000 --- a/examples/libs/simple-energest/example.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A very simple example of simple-energest - * \author - * Simon Duquennoy - */ - -#include "contiki.h" - -#include /* For printf() */ -/*---------------------------------------------------------------------------*/ -PROCESS(example_process, "Example process: simple-energest"); -AUTOSTART_PROCESSES(&example_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(example_process, ev, data) -{ - PROCESS_BEGIN(); - - /* Do nothing, just let simple-energest write its summary - * at a period of SIMPLE_ENERGEST_CONF_PERIOD */ - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/stack-check/Makefile b/examples/libs/stack-check/Makefile deleted file mode 100644 index 02b94cfc0..000000000 --- a/examples/libs/stack-check/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -CONTIKI_PROJECT = example-stack-check -all: $(CONTIKI_PROJECT) - -PLATFORMS_EXCLUDE = native cooja - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/stack-check/example-sky.csc b/examples/libs/stack-check/example-sky.csc deleted file mode 100644 index ae09f50bb..000000000 --- a/examples/libs/stack-check/example-sky.csc +++ /dev/null @@ -1,90 +0,0 @@ - - - [CONTIKI_DIR]/tools/cooja/apps/mrm - [CONTIKI_DIR]/tools/cooja/apps/mspsim - [CONTIKI_DIR]/tools/cooja/apps/avrora - [CONTIKI_DIR]/tools/cooja/apps/serial_socket - - Stack checker example - 0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - node - RPL Root - [CONFIG_DIR]/example-stack-check.c - make example-stack-check.sky TARGET=sky - [CONFIG_DIR]/example-stack-check.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 33.260163187353555 - 30.643217359962595 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - node - - - - org.contikios.cooja.plugins.SimControl - 259 - 4 - 179 - 0 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.898638306051894 0.0 0.0 2.898638306051894 -68.40918308040007 -27.82360366026197 - - 258 - 2 - 209 - 0 - 178 - - - org.contikios.cooja.plugins.LogListener - 1024 - 3 - 311 - 0 - 385 - - diff --git a/examples/libs/stack-check/example-stack-check.c b/examples/libs/stack-check/example-stack-check.c deleted file mode 100644 index 8f4b0f0ae..000000000 --- a/examples/libs/stack-check/example-stack-check.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2017, University of Bristol - http://www.bris.ac.uk/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Test of Contiki system's stack checker functionality - * \author - * Atis Elsts - */ - -#include "contiki.h" -#include "sys/stack-check.h" -#include "random.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -PROCESS(example_process, "Stack check example"); -AUTOSTART_PROCESSES(&example_process); -/*---------------------------------------------------------------------------*/ -static void -nested_function(void) -{ - printf("stack usage: %u permitted: %u\n", - stack_check_get_usage(), stack_check_get_reserved_size()); -} -/*---------------------------------------------------------------------------*/ -static void -test_function(void) -{ - void *p; - uint16_t s; - - /* allocate and fill some random bytes */ - s = random_rand() % 1000; - printf("allocating %u bytes on the stack\n", s); - p = alloca(s); - memset(p, 0, s); - - /* call the nested function to print stack usage */ - nested_function(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(example_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - - while(1) { - etimer_set(&et, CLOCK_SECOND * 2); - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - test_function(); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/stack-check/project-conf.h b/examples/libs/stack-check/project-conf.h deleted file mode 100644 index a9cbe2265..000000000 --- a/examples/libs/stack-check/project-conf.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2017, University of Bristol - http://www.bris.ac.uk/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Project config file - * \author - * Atis Elsts - * - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define STACK_CHECK_CONF_ENABLED 1 - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/libs/timers/Makefile b/examples/libs/timers/Makefile deleted file mode 100644 index 60b9c2531..000000000 --- a/examples/libs/timers/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -CONTIKI_PROJECT = all-timers -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/timers/all-timers.c b/examples/libs/timers/all-timers.c deleted file mode 100644 index bb6dfed90..000000000 --- a/examples/libs/timers/all-timers.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2015, Intel Corporation. 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 - -#include "contiki.h" -#include "sys/etimer.h" -#include "sys/stimer.h" -#include "sys/timer.h" -#include "sys/rtimer.h" - -PROCESS(timer_process, "ETimer x Timer x STimer Process"); -AUTOSTART_PROCESSES(&timer_process); - -static int counter_etimer; -static int counter_timer; -static int counter_stimer; -static struct timer timer_timer; -static struct stimer timer_stimer; -static struct ctimer timer_ctimer; -static struct rtimer timer_rtimer; - -/*---------------------------------------------------------------------------*/ -void -ctimer_callback(void *ptr) -{ - /* rearm the ctimer */ - ctimer_reset(&timer_ctimer); - printf("CTimer callback called\n"); -} -/*---------------------------------------------------------------------------*/ -void -rtimer_callback(struct rtimer *timer, void *ptr) -{ - /* Normally avoid printing from rtimer - rather do a process poll */ - printf("RTimer callback called\n"); - - /* Re-arm rtimer */ - rtimer_set(&timer_rtimer, RTIMER_NOW() + RTIMER_SECOND / 2, 0, - rtimer_callback, NULL); -} -/*---------------------------------------------------------------------------*/ -/* - * This Process will count timer expires on one e-timer (that drives the - * events to the process), one timer, and one stimer. - * - */ -PROCESS_THREAD(timer_process, ev, data) -{ - static struct etimer timer_etimer; - - PROCESS_BEGIN(); - - ctimer_set(&timer_ctimer, CLOCK_SECOND, ctimer_callback, NULL); - rtimer_set(&timer_rtimer, RTIMER_NOW() + RTIMER_SECOND / 2, 0, - rtimer_callback, NULL); - - while(1) { - /* set all the timers */ - timer_set(&timer_timer, 3 * CLOCK_SECOND); - stimer_set(&timer_stimer, 3); - etimer_set(&timer_etimer, 3 * CLOCK_SECOND); - - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER); - - counter_etimer++; - if(timer_expired(&timer_timer)) { - counter_timer++; - } - - if(stimer_expired(&timer_stimer)) { - counter_stimer++; - } - - printf("Timer process: %s\n", counter_timer == counter_etimer - && counter_timer == counter_stimer ? "SUCCESS" : "FAIL"); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/trickle-library/Makefile b/examples/libs/trickle-library/Makefile deleted file mode 100644 index aa3b25f9a..000000000 --- a/examples/libs/trickle-library/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -CONTIKI_PROJECT = trickle-library - -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../.. - -include $(CONTIKI)/Makefile.include diff --git a/examples/libs/trickle-library/trickle-library.c b/examples/libs/trickle-library/trickle-library.c deleted file mode 100644 index c449aade9..000000000 --- a/examples/libs/trickle-library/trickle-library.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2012, George Oikonomou - - * 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. - */ - -/* Example trickle-based protocol demonstrating the functionality of the - * trickle (trickle_timer) library (RFC 6206) */ -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" - -#include "lib/trickle-timer.h" -#include "lib/random.h" - -#include - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -/* Trickle variables and constants */ -static struct trickle_timer tt; - -#define IMIN 16 /* ticks */ -#define IMAX 10 /* doublings */ -#define REDUNDANCY_CONST 2 - -/* Networking */ -#define TRICKLE_PROTO_PORT 30001 -static struct uip_udp_conn *trickle_conn; -static uip_ipaddr_t ipaddr; /* destination: link-local all-nodes multicast */ - -/* - * For this 'protocol', nodes exchange a token (1 byte) at a frequency - * governed by trickle. A node detects an inconsistency when it receives a - * token different than the one it knows. - * In this case, either: - * - 'they' have a 'newer' token and we also update our own value, or - * - 'we' have a 'newer' token, in which case we trigger an inconsistency - * without updating our value. - * In this context, 'newer' is defined in serial number arithmetic terms. - * - * Every NEW_TOKEN_INTERVAL clock ticks each node will generate a new token - * with probability 1/NEW_TOKEN_PROB. This is controlled by etimer et. - */ -#define NEW_TOKEN_INTERVAL 10 * CLOCK_SECOND -#define NEW_TOKEN_PROB 2 -static uint8_t token; -static struct etimer et; /* Used to periodically generate inconsistencies */ -/*---------------------------------------------------------------------------*/ -PROCESS(trickle_protocol_process, "Trickle Protocol process"); -AUTOSTART_PROCESSES(&trickle_protocol_process); -/*---------------------------------------------------------------------------*/ -static void -tcpip_handler(void) -{ - if(uip_newdata()) { - PRINTF("At %lu (I=%lu, c=%u): ", - (unsigned long)clock_time(), (unsigned long)tt.i_cur, tt.c); - PRINTF("Our token=0x%02x, theirs=0x%02x\n", token, - ((uint8_t *)uip_appdata)[0]); - if(token == ((uint8_t *)uip_appdata)[0]) { - PRINTF("Consistent RX\n"); - trickle_timer_consistency(&tt); - } else { - if((signed char)(token - ((uint8_t *)uip_appdata)[0]) < 0) { - PRINTF("Theirs is newer. Update\n"); - token = ((uint8_t *)uip_appdata)[0]; - } else { - PRINTF("They are behind\n"); - } - trickle_timer_inconsistency(&tt); - - /* - * Here tt.ct.etimer.timer.{start + interval} points to time t in the - * current interval. However, between t and I it points to the interval's - * end so if you're going to use this, do so with caution. - */ - PRINTF("At %lu: Trickle inconsistency. Scheduled TX for %lu\n", - (unsigned long)clock_time(), - (unsigned long)(tt.ct.etimer.timer.start + - tt.ct.etimer.timer.interval)); - } - } - return; -} -/*---------------------------------------------------------------------------*/ -static void -trickle_tx(void *ptr, uint8_t suppress) -{ - /* *ptr is a pointer to the trickle_timer that triggered this callback. In - * his example we know that ptr points to tt. However, we pretend that we did - * not know (which would be the case if we e.g. had multiple trickle timers) - * and cast it to a local struct trickle_timer* */ - struct trickle_timer *loc_tt = (struct trickle_timer *)ptr; - - if(suppress == TRICKLE_TIMER_TX_SUPPRESS) { - return; - } - - PRINTF("At %lu (I=%lu, c=%u): ", - (unsigned long)clock_time(), (unsigned long)loc_tt->i_cur, - loc_tt->c); - PRINTF("Trickle TX token 0x%02x\n", token); - - /* Instead of changing ->ripaddr around by ourselves, we could have used - * uip_udp_packet_sendto which would have done it for us. However it puts an - * extra ~20 bytes on stack and the cc2x3x micros hate it, so we stick with - * send() */ - - /* Destination IP: link-local all-nodes multicast */ - uip_ipaddr_copy(&trickle_conn->ripaddr, &ipaddr); - uip_udp_packet_send(trickle_conn, &token, sizeof(token)); - - /* Restore to 'accept incoming from any IP' */ - uip_create_unspecified(&trickle_conn->ripaddr); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(trickle_protocol_process, ev, data) -{ - PROCESS_BEGIN(); - - PRINTF("Trickle protocol started\n"); - - uip_create_linklocal_allnodes_mcast(&ipaddr); /* Store for later */ - - trickle_conn = udp_new(NULL, UIP_HTONS(TRICKLE_PROTO_PORT), NULL); - udp_bind(trickle_conn, UIP_HTONS(TRICKLE_PROTO_PORT)); - - PRINTF("Connection: local/remote port %u/%u\n", - UIP_HTONS(trickle_conn->lport), UIP_HTONS(trickle_conn->rport)); - - token = 0; - - trickle_timer_config(&tt, IMIN, IMAX, REDUNDANCY_CONST); - trickle_timer_set(&tt, trickle_tx, &tt); - /* - * At this point trickle is started and is running the first interval. All - * nodes 'agree' that token == 0. This will change when one of them randomly - * decides to generate a new one - */ - etimer_set(&et, NEW_TOKEN_INTERVAL); - - while(1) { - PROCESS_YIELD(); - if(ev == tcpip_event) { - tcpip_handler(); - } else if(etimer_expired(&et)) { - /* Periodically (and randomly) generate a new token. This will trigger - * a trickle inconsistency */ - if((random_rand() % NEW_TOKEN_PROB) == 0) { - token++; - PRINTF("At %lu: Generating a new token 0x%02x\n", - (unsigned long)clock_time(), token); - trickle_timer_reset_event(&tt); - } - etimer_set(&et, NEW_TOKEN_INTERVAL); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/libs/trickle-library/trickle-library.csc b/examples/libs/trickle-library/trickle-library.csc deleted file mode 100644 index a450f15e8..000000000 --- a/examples/libs/trickle-library/trickle-library.csc +++ /dev/null @@ -1,153 +0,0 @@ - - - [CONTIKI_DIR]/tools/cooja/apps/mrm - [CONTIKI_DIR]/tools/cooja/apps/mspsim - [CONTIKI_DIR]/tools/cooja/apps/avrora - [CONTIKI_DIR]/tools/cooja/apps/serial_socket - [CONTIKI_DIR]/tools/cooja/apps/powertracker - - Example Demonstrating the Trickle Library's Functionality - 0 - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - trickle-tester - [CONTIKI_DIR]/examples/libs/trickle-library/trickle-library.c - make trickle-library.sky TARGET=sky - [CONTIKI_DIR]/examples/libs/trickle-library/trickle-library.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 96.8286491032791 - 44.83363764767495 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 26.625418506201424 - 62.32118900834971 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 12.373988266345922 - 40.21870711164037 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 38.44294323221424 - 17.14724376428426 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 68.38248149463341 - 23.506083749222842 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - sky1 - - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.IDVisualizerSkin - 5.862188489126289 0.0 0.0 5.862188489126289 -4.083221885224075 -86.33855683341153 - - 642 - 0 - 369 - 447 - 10 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1235 - 2 - 285 - 4 - 389 - - - org.contikios.cooja.plugins.SimControl - 318 - 1 - 192 - 60 - 60 - - - diff --git a/examples/lwm2m-ipso-objects/Makefile b/examples/lwm2m-ipso-objects/Makefile deleted file mode 100644 index a8d461859..000000000 --- a/examples/lwm2m-ipso-objects/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CONTIKI_PROJECT = example-ipso-objects - -CONTIKI_SOURCEFILES += serial-protocol.c example-ipso-temperature.c - -PLATFORMS_EXCLUDE = sky z1 - -all: $(CONTIKI_PROJECT) - -MODULES += os/net/app-layer/coap -MODULES += os/services/lwm2m -MODULES += os/services/ipso-objects - -CONTIKI=../.. -include $(CONTIKI)/Makefile.identify-target -MODULES_REL += $(TARGET) - -include $(CONTIKI)/Makefile.include diff --git a/examples/lwm2m-ipso-objects/README.md b/examples/lwm2m-ipso-objects/README.md deleted file mode 100644 index d31b3a844..000000000 --- a/examples/lwm2m-ipso-objects/README.md +++ /dev/null @@ -1,10 +0,0 @@ -LWM2M with IPSO Objects Example -============================================ - -This is an OMA LWM2M example implementing IPSO Objects. -It can connect to a Leshan server out-of-the-box. -Important configuration parameters: -* `LWM2M_SERVER_ADDRESS`: the address of the server to register to (or bootstrap from) -* `REGISTER_WITH_LWM2M_BOOTSTRAP_SERVER`: set to bootstrap via `LWM2M_SERVER_ADDRESS` and then obtain the registration server address - -A tutorial for setting up this example is provided on the wiki. diff --git a/examples/lwm2m-ipso-objects/example-ipso-objects.c b/examples/lwm2m-ipso-objects/example-ipso-objects.c deleted file mode 100644 index 60ca4bdb9..000000000 --- a/examples/lwm2m-ipso-objects/example-ipso-objects.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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 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 - * OMA LWM2M and IPSO Objects example. - * \author - * Joakim Eriksson, joakime@sics.se - * Niclas Finne, nfi@sics.se - * Carlos Gonzalo Peces, carlosgp143@gmail.com - */ - -#include "contiki.h" -#include "dev/leds.h" -#include "services/lwm2m/lwm2m-engine.h" -#include "services/lwm2m/lwm2m-rd-client.h" -#include "services/lwm2m/lwm2m-device.h" -#include "services/lwm2m/lwm2m-server.h" -#include "services/lwm2m/lwm2m-security.h" -#include "services/ipso-objects/ipso-objects.h" -#include "services/ipso-objects/ipso-sensor-template.h" -#include "services/ipso-objects/ipso-control-template.h" -#include "dev/leds.h" - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -/* Define this macro to non-zero to register via a bootstrap server */ -#ifndef REGISTER_WITH_LWM2M_BOOTSTRAP_SERVER -#define REGISTER_WITH_LWM2M_BOOTSTRAP_SERVER 0 -#endif - -#if REGISTER_WITH_LWM2M_BOOTSTRAP_SERVER -#define SERVER_TYPE LWM2M_RD_CLIENT_BOOTSTRAP_SERVER -#else -#define SERVER_TYPE LWM2M_RD_CLIENT_LWM2M_SERVER -#endif - -#ifndef LWM2M_SERVER_ADDRESS -#define LWM2M_SERVER_ADDRESS "coap://[fd00::1]" -#endif - -static lwm2m_session_info_t session_info; - -/* Define this macro to register with a second LWM2M server */ -#ifdef LWM2M_SERVER_ADDRESS_SECOND -static lwm2m_session_info_t session_info_second; -#endif - -#if BOARD_SENSORTAG -#include "board-peripherals.h" - -/* Temperature reading */ -static lwm2m_status_t -read_temp_value(const ipso_sensor_t *s, int32_t *value) -{ - *value = 10 * hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_TEMP); - return LWM2M_STATUS_OK; -} -/* Humitidy reading */ -static lwm2m_status_t -read_hum_value(const ipso_sensor_t *s, int32_t *value) -{ - *value = 10 * hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMID); - return LWM2M_STATUS_OK; -} -/* Lux reading */ -static lwm2m_status_t -read_lux_value(const ipso_sensor_t *s, int32_t *value) -{ - *value = 10 * opt_3001_sensor.value(0); - return LWM2M_STATUS_OK; -} -/* Barometer reading */ -static lwm2m_status_t -read_bar_value(const ipso_sensor_t *s, int32_t *value) -{ - *value = 10 * bmp_280_sensor.value(BMP_280_SENSOR_TYPE_PRESS); - return LWM2M_STATUS_OK; -} -/* LED control */ -static lwm2m_status_t -leds_set_val(ipso_control_t *control, uint8_t value) -{ - if(value > 0) { - leds_single_on(LEDS_LED1); - } else { - leds_single_off(LEDS_LED1); - } - return LWM2M_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ - -IPSO_CONTROL(led_control, 3311, 0, leds_set_val); - -IPSO_SENSOR(temp_sensor, 3303, read_temp_value, - .max_range = 100000, /* 100 cel milli celcius */ - .min_range = -10000, /* -10 cel milli celcius */ - .unit = "Cel", - .update_interval = 30 - ); - -IPSO_SENSOR(hum_sensor, 3304, read_hum_value, - .max_range = 100000, /* 100 % RH */ - .min_range = 0, - .unit = "% RH", - .update_interval = 30 - ); - -IPSO_SENSOR(lux_sensor, 3301, read_lux_value, - .max_range = 100000, - .min_range = -10000, - .unit = "LUX", - .update_interval = 30 - ); - -IPSO_SENSOR(bar_sensor, 3315, read_bar_value, - .max_range = 100000, /* 100 cel milli celcius */ - .min_range = -10000, /* -10 cel milli celcius */ - .unit = "hPa", - .update_interval = 30 - ); -#endif /* BOARD_SENSORTAG */ - -PROCESS(example_ipso_objects, "IPSO object example"); -AUTOSTART_PROCESSES(&example_ipso_objects); -/*---------------------------------------------------------------------------*/ -static void -setup_lwm2m_servers(void) -{ -#ifdef LWM2M_SERVER_ADDRESS - coap_endpoint_t server_ep; - if(coap_endpoint_parse(LWM2M_SERVER_ADDRESS, strlen(LWM2M_SERVER_ADDRESS), - &server_ep) != 0) { - lwm2m_rd_client_register_with_server(&session_info, &server_ep, SERVER_TYPE); - } -#endif /* LWM2M_SERVER_ADDRESS */ - -#ifdef LWM2M_SERVER_ADDRESS_SECOND - coap_endpoint_t server_ep_second; - if(coap_endpoint_parse(LWM2M_SERVER_ADDRESS_SECOND, strlen(LWM2M_SERVER_ADDRESS_SECOND), - &server_ep_second) != 0) { - lwm2m_rd_client_register_with_server(&session_info_second, &server_ep_second, SERVER_TYPE); - } -#endif /* LWM2M_SERVER_ADDRESS_SECOND */ -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(example_ipso_objects, ev, data) -{ - static struct etimer periodic; - PROCESS_BEGIN(); - - PROCESS_PAUSE(); - - PRINTF("Starting IPSO objects example%s\n", - REGISTER_WITH_LWM2M_BOOTSTRAP_SERVER ? " (bootstrap)" : ""); - /* Initialize the OMA LWM2M engine */ - lwm2m_engine_init(); - - /* Register default LWM2M objects */ - lwm2m_device_init(); - lwm2m_security_init(); - lwm2m_server_init(); - -#if BOARD_SENSORTAG - ipso_sensor_add(&temp_sensor); - ipso_sensor_add(&hum_sensor); - ipso_sensor_add(&lux_sensor); - ipso_sensor_add(&bar_sensor); - ipso_control_add(&led_control); - ipso_button_init(); - - SENSORS_ACTIVATE(hdc_1000_sensor); - SENSORS_ACTIVATE(opt_3001_sensor); - SENSORS_ACTIVATE(bmp_280_sensor); -#else /* BOARD_SENSORTAG */ - /* Register default IPSO objects - such as button..*/ - ipso_objects_init(); -#endif /* BOARD_SENSORTAG */ - - setup_lwm2m_servers(); - /* Tick loop each 5 seconds */ - etimer_set(&periodic, CLOCK_SECOND * 5); - - while(1) { - PROCESS_WAIT_EVENT(); - if(ev == PROCESS_EVENT_TIMER && etimer_expired(&periodic)) { -#if BOARD_SENSORTAG - /* deactive / activate to do a new reading */ - SENSORS_DEACTIVATE(hdc_1000_sensor); - SENSORS_DEACTIVATE(opt_3001_sensor); - SENSORS_DEACTIVATE(bmp_280_sensor); - - SENSORS_ACTIVATE(hdc_1000_sensor); - SENSORS_ACTIVATE(opt_3001_sensor); - SENSORS_ACTIVATE(bmp_280_sensor); -#endif /* BOARD_SENSORTAG */ - etimer_reset(&periodic); - } - } - PROCESS_END(); -} diff --git a/examples/lwm2m-ipso-objects/example-ipso-temperature.c b/examples/lwm2m-ipso-objects/example-ipso-temperature.c deleted file mode 100644 index 049496d55..000000000 --- a/examples/lwm2m-ipso-objects/example-ipso-temperature.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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 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 - * An dummy temperature driver as example - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include "services/ipso-objects/ipso-objects.h" -#include "lib/random.h" - -static int32_t last_value = 27000; -/*---------------------------------------------------------------------------*/ -static int -read_value(int32_t *value) -{ - last_value = last_value + (random_rand() % 1000) - 500; - if(last_value < 18000) { - last_value = 18000; - } else if(last_value > 35000) { - last_value = 35000; - } - *value = last_value; - return 0; -} -/*---------------------------------------------------------------------------*/ -const struct ipso_objects_sensor example_ipso_temperature = { - .read_value = read_value -}; -/*---------------------------------------------------------------------------*/ diff --git a/examples/lwm2m-ipso-objects/example-server.c b/examples/lwm2m-ipso-objects/example-server.c deleted file mode 100644 index 98e1fef9a..000000000 --- a/examples/lwm2m-ipso-objects/example-server.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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 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 - * IPSO Objects and OMA LWM2M example. - * \author - * Joakim Eriksson, joakime@sics.se - * Niclas Finne, nfi@sics.se - */ - -#include "contiki.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/netstack.h" -#include "net/routing/routing.h" -#include "coap-transport.h" -#include "coap-blocking-api.h" -#include "lwm2m-engine.h" -#include "lwm2m-tlv.h" -#include "dev/serial-line.h" -#include "serial-protocol.h" -#include - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -#define REMOTE_PORT UIP_HTONS(COAP_DEFAULT_PORT) - -#define EVENT_RUN_NOW 0 - -#define URL_WELL_KNOWN ".well-known/core" -#define URL_DEVICE_MODEL "/3/0/1" -#define URL_DEVICE_FIRMWARE_VERSION "/3/0/3" -#define URL_LIGHT_CONTROL "/3311/0/5850" -#define URL_POWER_CONTROL "/3312/0/5850" - -#define MAX_NODES 10 - -#define NODE_HAS_TYPE (1 << 0) - -struct node { - coap_endpoint_t endpoint; - char type[64]; - uint8_t flags; - uint8_t retries; -}; - -static struct node nodes[MAX_NODES]; -static uint8_t node_count; - -static struct node *current_target; -static char current_uri[32] = URL_LIGHT_CONTROL; -static char current_value[32] = "1"; -static int current_request = COAP_PUT; -static uint8_t fetching_type = 0; - -PROCESS(router_process, "router process"); -AUTOSTART_PROCESSES(&router_process); -/*---------------------------------------------------------------------------*/ -static struct node * -add_node(const uip_ipaddr_t *addr) -{ - int i; - for(i = 0; i < node_count; i++) { - if(uip_ipaddr_cmp(&nodes[i].endpoint.ipaddr, addr)) { - /* Node already added */ - return &nodes[i]; - } - } - if(node_count < MAX_NODES) { - memset(&nodes[node_count].endpoint, 0, sizeof(coap_endpoint_t)); - uip_ipaddr_copy(&nodes[node_count].endpoint.ipaddr, addr); - nodes[node_count].endpoint.port = REMOTE_PORT; - return &nodes[node_count++]; - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -void -set_value(const uip_ipaddr_t *addr, char *uri, char *value) -{ - int i; - printf("#set value "); - uip_debug_ipaddr_print(addr); - printf(" URI: %s Value: %s\n", uri, value); - - for(i = 0; i < node_count; i++) { - if(uip_ipaddr_cmp(&nodes[i].endpoint.ipaddr, addr)) { - /* setup command */ - current_target = &nodes[i]; - current_request = COAP_PUT; - strncpy(current_uri, uri, sizeof(current_uri) - 1); - strncpy(current_value, value, sizeof(current_value) - 1); - process_post(&router_process, EVENT_RUN_NOW, NULL); - break; - } - } -} -/*---------------------------------------------------------------------------*/ -void -get_value(const uip_ipaddr_t *addr, char *uri) -{ - int i; - printf("#get value "); - uip_debug_ipaddr_print(addr); - printf(" URI: %s\n", uri); - - for(i = 0; i < node_count; i++) { - if(uip_ipaddr_cmp(&nodes[i].endpoint.ipaddr, addr)) { - /* setup command */ - current_target = &nodes[i]; - current_request = COAP_GET; - strncpy(current_uri, uri, sizeof(current_uri) - 1); - current_value[0] = 0; - process_post(&router_process, EVENT_RUN_NOW, NULL); - break; - } - } -} -/*---------------------------------------------------------------------------*/ -void -print_node_list(void) -{ - int i; - int out = 0; - for(i = 0; i < node_count; i++) { - if(nodes[i].flags & NODE_HAS_TYPE) { - if(out++) { - printf(";"); - } - printf("%s,", nodes[i].type); - uip_debug_ipaddr_print(&nodes[i].endpoint.ipaddr); - } - } - printf("\n"); -} -/*---------------------------------------------------------------------------*/ -/** - * This function is will be passed to COAP_BLOCKING_REQUEST() to - * handle responses. - */ -static void -client_chunk_handler(coap_message_t *response) -{ - const uint8_t *chunk; - unsigned int format; - int len = coap_get_payload(response, &chunk); - coap_get_header_content_format(response, &format); - - /* if(len > 0) { */ - /* printf("|%.*s (%d,%d)", len, (char *)chunk, len, format); */ - /* } */ - if(response->code >= BAD_REQUEST_4_00) { - PRINTF("\nReceived error %u: %.*s\n", response->code, len, (char *)chunk); - } else if(current_target != NULL && fetching_type) { - if(len > sizeof(current_target->type) - 1) { - len = sizeof(current_target->type) - 1; - } - memcpy(current_target->type, chunk, len); - current_target->type[len] = 0; - current_target->flags |= NODE_HAS_TYPE; - - PRINTF("\nNODE "); - PRINT6ADDR(¤t_target->endpoint.ipaddr); - PRINTF(" HAS TYPE %s\n", current_target->type); - } else { - /* otherwise update the current value */ - if(format == LWM2M_TLV) { - lwm2m_tlv_t tlv; - /* we can only read int32 for now ? */ - if(lwm2m_tlv_read(&tlv, chunk, len) > 0) { - /* printf("TLV.type=%d len=%d id=%d value[0]=%d\n", */ - /* tlv.type, tlv.length, tlv.id, tlv.value[0]); */ - - int value = lwm2m_tlv_get_int32(&tlv); - snprintf(current_value, sizeof(current_value) - 1, "%d", value); - } else { - PRINTF("Failed to parse LWM2M TLV\n"); - } - } else { - if(len > sizeof(current_value) - 1) { - len = sizeof(current_value) - 1; - } - memcpy(current_value, chunk, len); - current_value[len] = 0; - } - } -} -/*---------------------------------------------------------------------------*/ -#if UIP_CONF_IPV6_RPL -static bool -check_rpl_routes(void) -{ - uip_sr_node_t *link; - uip_ipaddr_t child_ipaddr; - uip_ipaddr_t parent_ipaddr; - - /* Our routing links */ - for(link = uip_sr_node_head(); link != NULL; link = uip_sr_node_next(link)) { - NETSTACK_ROUTING.get_sr_node_ipaddr(&child_ipaddr, link); - - if(link->parent == NULL) { - /* Igore the DAG root */ - continue; - } - - current_target = add_node(&child_ipaddr); - if(current_target == NULL || - (current_target->flags & NODE_HAS_TYPE) != 0 || - current_target->retries > 5) { - continue; - } - - NETSTACK_ROUTING.get_sr_node_ipaddr(&parent_ipaddr, link->parent); - PRINTF(" "); - PRINT6ADDR(&child_ipaddr); - PRINTF(" -> "); - PRINT6ADDR(&parent_ipaddr); - PRINTF("\n"); - return true; - } - return false; -} -#endif /* UIP_CONF_IPV6_RPL */ -/*---------------------------------------------------------------------------*/ -#if (UIP_MAX_ROUTES != 0) -static bool -check_routes(void) -{ - uip_ds6_route_t *r; - - for(r = uip_ds6_route_head(); r != NULL; r = uip_ds6_route_next(r)) { - current_target = add_node(&r->ipaddr); - if(current_target == NULL || - (current_target->flags & NODE_HAS_TYPE) != 0 || - current_target->retries > 5) { - continue; - } - PRINTF(" "); - PRINT6ADDR(&r->ipaddr); - PRINTF(" -> "); - nexthop = uip_ds6_route_nexthop(r); - if(nexthop != NULL) { - PRINT6ADDR(nexthop); - } else { - PRINTF("-"); - } - PRINTF("\n"); - return true; - } - return false; -} -#endif /* (UIP_MAX_ROUTES != 0) */ -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(router_process, ev, data) -{ - /* This way the message can be treated as pointer as usual. */ - static coap_message_t request[1]; - static struct etimer timer; - - PROCESS_BEGIN(); - - /* Initialize DAG root */ - NETSTACK_ROUTING.root_start(); - - while(1) { - etimer_set(&timer, CLOCK_SECOND * 5); - PROCESS_YIELD(); - - /* Handle serial line input */ - if(ev == serial_line_event_message) { - serial_protocol_input((char *) data); - } - - if(etimer_expired(&timer)) { - current_target = NULL; -#if UIP_CONF_IPV6_RPL - check_rpl_routes(); -#endif /* UIP_CONF_IPV6_RPL */ - -#if (UIP_MAX_ROUTES != 0) - if(current_target == NULL) { - check_routes(); - } -#endif /* (UIP_MAX_ROUTES != 0) */ - } - - /* This is a node type discovery */ - if(current_target != NULL && - (current_target->flags & NODE_HAS_TYPE) == 0 && - current_target->retries < 6) { - - /* prepare request, TID is set by COAP_BLOCKING_REQUEST() */ - coap_init_message(request, COAP_TYPE_CON, COAP_GET, 0); - coap_set_header_uri_path(request, URL_DEVICE_MODEL); - - current_target->retries++; - - PRINTF("CoAP request to ["); - PRINT6ADDR(¤t_target->endpoint.ipaddr); - PRINTF("]:%u (%u tx)\n", UIP_HTONS(current_target->endpoint.port), - current_target->retries); - - fetching_type = 1; - COAP_BLOCKING_REQUEST(¤t_target->endpoint, request, - client_chunk_handler); - fetching_type = 0; - strncpy(current_uri, URL_LIGHT_CONTROL, sizeof(current_uri) - 1); - printf("\n--Done--\n"); - } - - /* If having a type this is another type of request */ - if(current_target != NULL && - (current_target->flags & NODE_HAS_TYPE) && strlen(current_uri) > 0) { - /* prepare request, TID is set by COAP_BLOCKING_REQUEST() */ - coap_init_message(request, COAP_TYPE_CON, current_request, 0); - coap_set_header_uri_path(request, current_uri); - - if(strlen(current_value) > 0) { - coap_set_payload(request, (uint8_t *)current_value, - strlen(current_value)); - } - - PRINTF("CoAP request to ["); - PRINT6ADDR(¤t_target->endpoint.ipaddr); - PRINTF("]:%u %s\n", UIP_HTONS(current_target->endpoint.port), - current_uri); - - COAP_BLOCKING_REQUEST(¤t_target->endpoint, request, - client_chunk_handler); - - /* print out result of command */ - if(current_request == COAP_PUT) { - printf("s "); - } else { - printf("g "); - } - uip_debug_ipaddr_print(¤t_target->endpoint.ipaddr); - printf(" %s %s\n", current_uri, current_value); - - current_target = NULL; - current_uri[0] = 0; - current_value[0] = 0; - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/lwm2m-ipso-objects/project-conf.h b/examples/lwm2m-ipso-objects/project-conf.h deleted file mode 100644 index a8603c67b..000000000 --- a/examples/lwm2m-ipso-objects/project-conf.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#ifdef BOARD_STRING -#define LWM2M_DEVICE_MODEL_NUMBER BOARD_STRING -#elif defined(CONTIKI_TARGET_WISMOTE) -#include "dev/watchdog.h" -#define LWM2M_DEVICE_MODEL_NUMBER "LWM2M_DEVICE_MODEL_NUMBER" -#define LWM2M_DEVICE_MANUFACTURER "LWM2M_DEVICE_MANUFACTURER" -#define LWM2M_DEVICE_SERIAL_NO "LWM2M_DEVICE_SERIAL_NO" -#define PLATFORM_REBOOT watchdog_reboot -#endif - -#if BOARD_SENSORTAG -/* Real sensor is present... */ -#else -#define IPSO_TEMPERATURE example_ipso_temperature -#endif /* BOARD_SENSORTAG */ - -/* Increase rpl-border-router IP-buffer when using more than 64. */ -#define COAP_MAX_CHUNK_SIZE 64 - -/* Multiplies with chunk size, be aware of memory constraints. */ -#define COAP_MAX_OPEN_TRANSACTIONS 4 - -/* Filtering .well-known/core per query can be disabled to save space. */ -#define COAP_LINK_FORMAT_FILTERING 0 -#define COAP_PROXY_OPTION_PROCESSING 0 - -/* Enable client-side support for COAP observe */ -#define COAP_OBSERVE_CLIENT 1 - -/* Definitions to enable Queue Mode, include the dynamic adaptation and change the default parameters */ -/* #define LWM2M_QUEUE_MODE_CONF_ENABLED 1 - #define LWM2M_QUEUE_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION 1 - #define LWM2M_QUEUE_MODE_CONF_DEFAULT_CLIENT_AWAKE_TIME 2000 - #define LWM2M_QUEUE_MODE_CONF_DEFAULT_CLIENT_SLEEP_TIME 10000 - #define LWM2M_QUEUE_MODE_CONF_DEFAULT_DYNAMIC_ADAPTATION_FLAG 0 - #define LWM2M_QUEUE_MODE_OBJECT_CONF_ENABLED 1 */ - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/lwm2m-ipso-objects/serial-protocol.c b/examples/lwm2m-ipso-objects/serial-protocol.c deleted file mode 100644 index 00c7e0139..000000000 --- a/examples/lwm2m-ipso-objects/serial-protocol.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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 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 - * Simple serial protocol to list and interact with devices - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include "contiki.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uiplib.h" -#include - -void print_node_list(void); -void set_value(const uip_ipaddr_t *addr, char *uri, char *value); -void get_value(const uip_ipaddr_t *addr, char *uri); -/*---------------------------------------------------------------------------*/ -int -find_next_sep(const char *str, char sep, int pos) -{ - char c; - while((c = str[pos]) != 0) { - if(c == sep) { - return pos + 1; - } - pos++; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -/* - * l - list all discovered devices - * s - set - * g - get - */ -void -serial_protocol_input(char *data) -{ - /* We assume that we have a string here */ - char cmd = data[0]; - int pos = 0; - - switch(cmd) { - case 'l': - /* list devices */ - print_node_list(); - break; - case 's': { - uip_ip6addr_t ipaddr; - char *uri; - char *value; - pos = find_next_sep(data, ' ', pos); - if(pos > 0) { - /* start of IP */ - int start = pos; - pos = find_next_sep(data, ' ', pos); - if(pos == -1) { - return; - } - data[pos - 1] = 0; - if(uiplib_ip6addrconv(&data[start], &ipaddr) == 0) { - printf("* Error not valid IP\n"); - } - uri = &data[pos]; - pos = find_next_sep(data, ' ', pos); - if(pos == -1) return; - data[pos - 1] = 0; - value = &data[pos]; - /* set the value at the specified node */ - set_value(&ipaddr, uri, value); - } - break; - } - case 'g': { - uip_ip6addr_t ipaddr; - char *uri; - pos = find_next_sep(data, ' ', pos); - if(pos > 0) { - /* start of IP */ - int start = pos; - pos = find_next_sep(data, ' ', pos); - if(pos == -1) return; - data[pos - 1] = 0; - if(uiplib_ip6addrconv((const char *) &data[start], &ipaddr) == 0) { - printf("* Error not valid IP\n"); - } - uri = &data[pos]; - /* get the value at the specified node */ - get_value(&ipaddr, uri); - } - break; - } - case '\0': - /* Ignore empty lines */ - break; - default: - printf("Unknown command\n"); - } - printf("> "); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/lwm2m-ipso-objects/serial-protocol.h b/examples/lwm2m-ipso-objects/serial-protocol.h deleted file mode 100644 index a6dfcc129..000000000 --- a/examples/lwm2m-ipso-objects/serial-protocol.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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 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 - * Simple serial protocol to list and interact with devices - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef SERIAL_PROTOCOL_H_ -#define SERIAL_PROTOCOL_H_ - -void serial_protocol_input(char *data); - -#endif /* SERIAL_PROTOCOL_H_ */ diff --git a/examples/lwm2m-ipso-objects/zoul/module-macros.h b/examples/lwm2m-ipso-objects/zoul/module-macros.h deleted file mode 100644 index 4db4e82fe..000000000 --- a/examples/lwm2m-ipso-objects/zoul/module-macros.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS AB. - * 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 HOLDER 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. - */ -/*---------------------------------------------------------------------------*/ -/* Only sleep mode 1 on Zoul to enable full 32 KiB RAM */ -#define LPM_CONF_MAX_PM 1 -/*---------------------------------------------------------------------------*/ -/* Macros to enter sleep mode and wake up in the Zoul module. Sleep consists - * on turn off the radio and start a RTIMER to wake up, and wake up consists on - * turn on the radio again - */ -#define LWM2M_Q_MODE_WAKE_UP() do { \ - NETSTACK_MAC.on(); \ -} while(0) - -#define LWM2M_Q_MODE_SLEEP_MS(TIME_MS) do { \ - uint64_t aux = TIME_MS * RTIMER_SECOND; \ - NETSTACK_MAC.off(); \ - rtimer_arch_schedule(RTIMER_NOW() + (rtimer_clock_t)(aux / 1000)); \ -} while(0) - - diff --git a/examples/mqtt-client/Makefile b/examples/mqtt-client/Makefile deleted file mode 100644 index 29b3267e1..000000000 --- a/examples/mqtt-client/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -CONTIKI_PROJECT = mqtt-client -all: $(CONTIKI_PROJECT) - -MODULES += os/net/app-layer/mqtt - -CONTIKI = ../.. --include $(CONTIKI)/Makefile.identify-target - -MODULES_REL += arch/platform/$(TARGET) - -PLATFORMS_ONLY = cc26x0-cc13x0 cc2538dk openmote-cc2538 zoul native simplelink - -include $(CONTIKI)/Makefile.include diff --git a/examples/mqtt-client/README.md b/examples/mqtt-client/README.md deleted file mode 100644 index 8312ec024..000000000 --- a/examples/mqtt-client/README.md +++ /dev/null @@ -1,79 +0,0 @@ -MQTT Client Example -=================== -The MQTT client can be used to: - -* Publish sensor readings to an MQTT broker. -* Subscribe to a topic and receive commands from an MQTT broker - -The demo will give some visual feedback with a LED (configurable): -* Very fast blinking: Searching for a network -* Fast blinking: Connecting to broker -* Slow, long blinking: Sending a publish message - -This example is known to work with all platforms that support the new button -API. - -This example can operate in two modes: A default mode to be used with the -mosquitto MQTT broker and a second mode to be used with the IBM Watson IoT -platform. - -To enable Watson mode, define `MQTT_CLIENT_CONF_WITH_IBM_WATSON` as 1 in the -example's `project-conf.h`. - -Publishing ----------- -By default the example will attempt to publish readings to an MQTT broker -running on the IPv6 address specified as `MQTT_CLIENT_CONF_BROKER_IP_ADDR` in -`project-conf.h`. This functionality was tested successfully with -[mosquitto](http://mosquitto.org/). This define will be ignored in IBM Watson -mode. - -The publish messages include sensor readings but also some other information, -such as device uptime in seconds and a message sequence number. The demo will -publish to topic `iot-2/evt/status/fmt/json`. The device will connect using -client-id `d::mqtt-client:`, where `` gets -constructed from the device's IEEE address. `` can be controlled -through the `MQTT_CLIENT_CONF_ORG_ID` define. - -Subscribing ------------ -You can also subscribe to topics and receive commands, but this will only -work if you use "Org ID" != 'quickstart'. To achieve this, you will need to -change `MQTT_CLIENT_CONF_ORG_ID` in `project-conf.h`. In this scenario, the -device will subscribe to: - -`iot-2/cmd/+/fmt/json` - -You can then use this to toggle LEDs. To do this, you can for example -use mosquitto client to publish to `iot-2/cmd/leds/fmt/json`. So, to change -the state of an LED, you would do this: - -`mosquitto_pub -h -m "1" -t iot-2/cmd/leds/fmt/json` - -Where `broker IP` should be replaced with the IP address of your mosquitto -broker (the one where you device has subscribed). Replace `-m "1'` with `-m "0"` -to turn the LED back off. - -Bear in mind that, even though the topic suggests that messages are of json -format, they are in fact not. This was done in order to avoid linking a json -parser into the firmware. This comment only applies to parsing incoming -messages, outgoing publish messages use proper json payload. - -IBM Quickstart Service ----------------------- -It is also possible to publish to IBM's quickstart service. To do so, you need -to enable this mode by setting `MQTT_CLIENT_CONF_WITH_IBM_WATSON` to 1 in -`project-conf.h`. - -The device will then try to connect to IBM's quickstart over NAT64, so you will -need a NAT64 gateway in your network to make this work. A guide on how to -setup NAT64 is out of scope here, but you can find one in the -[Contiki-NG wiki](https://github.com/contiki-ng/contiki-ng/wiki/NAT64-for-Contiki%E2%80%90NG). - -If you want to use IBM's cloud service with a registered device, you will need -to set `MQTT_CLIENT_CONF_ORG_ID` and then also to provide the 'Auth Token' -(`MQTT_CLIENT_CONF_AUTH_TOKEN`), which acts as a 'password'. You will also -need to configure your Organisation / Registered device on Watson such that -TLS is optional. - -Note: The token will be transported in cleartext. diff --git a/examples/mqtt-client/arch/cpu/cc2538/builtin-sensors.c b/examples/mqtt-client/arch/cpu/cc2538/builtin-sensors.c deleted file mode 100644 index f22c33835..000000000 --- a/examples/mqtt-client/arch/cpu/cc2538/builtin-sensors.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/cc2538-sensors.h" -#include "mqtt-client.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define TMP_BUF_SZ 32 -/*---------------------------------------------------------------------------*/ -char tmp_buf[TMP_BUF_SZ]; -/*---------------------------------------------------------------------------*/ -static char * -temp_reading(void) -{ - memset(tmp_buf, 0, TMP_BUF_SZ); - snprintf(tmp_buf, TMP_BUF_SZ, "\"On-Chip Temp (mC)\":%d", - cc2538_temp_sensor.value(CC2538_SENSORS_VALUE_TYPE_CONVERTED)); - return tmp_buf; -} -/*---------------------------------------------------------------------------*/ -static void -temp_init(void) -{ - SENSORS_ACTIVATE(cc2538_temp_sensor); -} -/*---------------------------------------------------------------------------*/ -const mqtt_client_extension_t builtin_sensors_cc2538_temp = { - temp_init, - temp_reading, -}; -/*---------------------------------------------------------------------------*/ -static char * -vdd3_reading(void) -{ - memset(tmp_buf, 0, TMP_BUF_SZ); - snprintf(tmp_buf, TMP_BUF_SZ, "\"VDD3 (mV)\":%d", - vdd3_sensor.value(CC2538_SENSORS_VALUE_TYPE_CONVERTED)); - return tmp_buf; -} -/*---------------------------------------------------------------------------*/ -static void -vdd3_init(void) -{ - SENSORS_ACTIVATE(vdd3_sensor); -} -/*---------------------------------------------------------------------------*/ -const mqtt_client_extension_t builtin_sensors_vdd3 = { - vdd3_init, - vdd3_reading, -}; -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/cpu/cc2538/builtin-sensors.h b/examples/mqtt-client/arch/cpu/cc2538/builtin-sensors.h deleted file mode 100644 index 50a765b52..000000000 --- a/examples/mqtt-client/arch/cpu/cc2538/builtin-sensors.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 BUILTIN_SENSORS_H_ -#define BUILTIN_SENSORS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "mqtt-client.h" -/*---------------------------------------------------------------------------*/ -extern const mqtt_client_extension_t builtin_sensors_vdd3; -extern const mqtt_client_extension_t builtin_sensors_cc2538_temp; -/*---------------------------------------------------------------------------*/ -#endif /* BUILTIN_SENSORS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/cpu/cc26x0-cc13x0/builtin-sensors.c b/examples/mqtt-client/arch/cpu/cc26x0-cc13x0/builtin-sensors.c deleted file mode 100644 index 3b346fc1b..000000000 --- a/examples/mqtt-client/arch/cpu/cc26x0-cc13x0/builtin-sensors.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "batmon-sensor.h" -#include "mqtt-client.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define TMP_BUF_SZ 32 -/*---------------------------------------------------------------------------*/ -char tmp_buf[TMP_BUF_SZ]; -/*---------------------------------------------------------------------------*/ -static char * -temp_reading(void) -{ - memset(tmp_buf, 0, TMP_BUF_SZ); - snprintf(tmp_buf, TMP_BUF_SZ, "\"On-Chip Temp (mC)\":%d", - batmon_sensor.value(BATMON_SENSOR_TYPE_TEMP)); - return tmp_buf; -} -/*---------------------------------------------------------------------------*/ -static void -temp_init(void) -{ - SENSORS_ACTIVATE(batmon_sensor); -} -/*---------------------------------------------------------------------------*/ -const mqtt_client_extension_t builtin_sensors_batmon_temp = { - temp_init, - temp_reading, -}; -/*---------------------------------------------------------------------------*/ -static char * -volt_reading(void) -{ - memset(tmp_buf, 0, TMP_BUF_SZ); - snprintf(tmp_buf, TMP_BUF_SZ, "\"Volt (mV)\":%d", - (batmon_sensor.value(BATMON_SENSOR_TYPE_VOLT) * 125) >> 5); - return tmp_buf; -} -/*---------------------------------------------------------------------------*/ -static void -volt_init(void) -{ - SENSORS_ACTIVATE(batmon_sensor); -} -/*---------------------------------------------------------------------------*/ -const mqtt_client_extension_t builtin_sensors_batmon_volt = { - volt_init, - volt_reading, -}; -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/cpu/cc26x0-cc13x0/builtin-sensors.h b/examples/mqtt-client/arch/cpu/cc26x0-cc13x0/builtin-sensors.h deleted file mode 100644 index 38af3f62a..000000000 --- a/examples/mqtt-client/arch/cpu/cc26x0-cc13x0/builtin-sensors.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 BUILTIN_SENSORS_H_ -#define BUILTIN_SENSORS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "mqtt-client.h" -/*---------------------------------------------------------------------------*/ -extern const mqtt_client_extension_t builtin_sensors_batmon_temp; -extern const mqtt_client_extension_t builtin_sensors_batmon_volt; -/*---------------------------------------------------------------------------*/ -#endif /* BUILTIN_SENSORS_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/platform/cc2538dk/Makefile.cc2538dk b/examples/mqtt-client/arch/platform/cc2538dk/Makefile.cc2538dk deleted file mode 100644 index fcdd0583a..000000000 --- a/examples/mqtt-client/arch/platform/cc2538dk/Makefile.cc2538dk +++ /dev/null @@ -1 +0,0 @@ -MODULES_REL += arch/cpu/cc2538 diff --git a/examples/mqtt-client/arch/platform/cc2538dk/als-extend.c b/examples/mqtt-client/arch/platform/cc2538dk/als-extend.c deleted file mode 100644 index 7f9845a42..000000000 --- a/examples/mqtt-client/arch/platform/cc2538dk/als-extend.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "als-extend.h" -#include "dev/als-sensor.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define TMP_BUF_SZ 32 -/*---------------------------------------------------------------------------*/ -char tmp_buf[TMP_BUF_SZ]; -/*---------------------------------------------------------------------------*/ -static void -als_init(void) -{ - SENSORS_ACTIVATE(als_sensor); -} -/*---------------------------------------------------------------------------*/ -static char * -als_reading(void) -{ - memset(tmp_buf, 0, TMP_BUF_SZ); - snprintf(tmp_buf, TMP_BUF_SZ, "\"ALS (raw)\":%d", als_sensor.value(0)); - return tmp_buf; -} -/*---------------------------------------------------------------------------*/ -const mqtt_client_extension_t als_extend = { - als_init, - als_reading, -}; -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/platform/cc2538dk/als-extend.h b/examples/mqtt-client/arch/platform/cc2538dk/als-extend.h deleted file mode 100644 index f9b8dc9b0..000000000 --- a/examples/mqtt-client/arch/platform/cc2538dk/als-extend.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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 ALS_EXTEND_H_ -#define ALS_EXTEND_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "mqtt-client.h" -/*---------------------------------------------------------------------------*/ -extern const mqtt_client_extension_t als_extend; -/*---------------------------------------------------------------------------*/ -#endif /* ALS_EXTEND_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/platform/cc2538dk/module-macros.h b/examples/mqtt-client/arch/platform/cc2538dk/module-macros.h deleted file mode 100644 index 6f0bce121..000000000 --- a/examples/mqtt-client/arch/platform/cc2538dk/module-macros.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* Enable MQTT client extensions */ -#define MQTT_CLIENT_CONF_WITH_EXTENSIONS 1 -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/platform/cc2538dk/mqtt-client-extensions.c b/examples/mqtt-client/arch/platform/cc2538dk/mqtt-client-extensions.c deleted file mode 100644 index 835b95fa6..000000000 --- a/examples/mqtt-client/arch/platform/cc2538dk/mqtt-client-extensions.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "builtin-sensors.h" -#include "als-extend.h" -#include "mqtt-client.h" - -#include -/*---------------------------------------------------------------------------*/ -MQTT_CLIENT_EXTENSIONS(&builtin_sensors_vdd3, &builtin_sensors_cc2538_temp, - &als_extend); -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/platform/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 b/examples/mqtt-client/arch/platform/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 deleted file mode 100644 index 7c74123c6..000000000 --- a/examples/mqtt-client/arch/platform/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 +++ /dev/null @@ -1 +0,0 @@ -MODULES_REL += arch/cpu/cc26x0-cc13x0 diff --git a/examples/mqtt-client/arch/platform/cc26x0-cc13x0/module-macros.h b/examples/mqtt-client/arch/platform/cc26x0-cc13x0/module-macros.h deleted file mode 100644 index 6f0bce121..000000000 --- a/examples/mqtt-client/arch/platform/cc26x0-cc13x0/module-macros.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* Enable MQTT client extensions */ -#define MQTT_CLIENT_CONF_WITH_EXTENSIONS 1 -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/platform/cc26x0-cc13x0/mqtt-client-extensions.c b/examples/mqtt-client/arch/platform/cc26x0-cc13x0/mqtt-client-extensions.c deleted file mode 100644 index 559a4ee9b..000000000 --- a/examples/mqtt-client/arch/platform/cc26x0-cc13x0/mqtt-client-extensions.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "builtin-sensors.h" -#include "mqtt-client.h" - -#include -/*---------------------------------------------------------------------------*/ -MQTT_CLIENT_EXTENSIONS(&builtin_sensors_batmon_temp, - &builtin_sensors_batmon_volt); -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 b/examples/mqtt-client/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 deleted file mode 100644 index fcdd0583a..000000000 --- a/examples/mqtt-client/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 +++ /dev/null @@ -1 +0,0 @@ -MODULES_REL += arch/cpu/cc2538 diff --git a/examples/mqtt-client/arch/platform/openmote-cc2538/module-macros.h b/examples/mqtt-client/arch/platform/openmote-cc2538/module-macros.h deleted file mode 100644 index 097c26dd8..000000000 --- a/examples/mqtt-client/arch/platform/openmote-cc2538/module-macros.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* Enable MQTT client extensions */ -#define MQTT_CLIENT_CONF_WITH_EXTENSIONS 1 -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/platform/openmote-cc2538/mqtt-client-extensions.c b/examples/mqtt-client/arch/platform/openmote-cc2538/mqtt-client-extensions.c deleted file mode 100644 index 022c28e84..000000000 --- a/examples/mqtt-client/arch/platform/openmote-cc2538/mqtt-client-extensions.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "builtin-sensors.h" -#include "mqtt-client.h" - -#include -/*---------------------------------------------------------------------------*/ -MQTT_CLIENT_EXTENSIONS(&builtin_sensors_vdd3, &builtin_sensors_cc2538_temp); -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/platform/zoul/Makefile.zoul b/examples/mqtt-client/arch/platform/zoul/Makefile.zoul deleted file mode 100644 index fcdd0583a..000000000 --- a/examples/mqtt-client/arch/platform/zoul/Makefile.zoul +++ /dev/null @@ -1 +0,0 @@ -MODULES_REL += arch/cpu/cc2538 diff --git a/examples/mqtt-client/arch/platform/zoul/module-macros.h b/examples/mqtt-client/arch/platform/zoul/module-macros.h deleted file mode 100644 index 6f0bce121..000000000 --- a/examples/mqtt-client/arch/platform/zoul/module-macros.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* Enable MQTT client extensions */ -#define MQTT_CLIENT_CONF_WITH_EXTENSIONS 1 -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/arch/platform/zoul/mqtt-client-extensions.c b/examples/mqtt-client/arch/platform/zoul/mqtt-client-extensions.c deleted file mode 100644 index 022c28e84..000000000 --- a/examples/mqtt-client/arch/platform/zoul/mqtt-client-extensions.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "builtin-sensors.h" -#include "mqtt-client.h" - -#include -/*---------------------------------------------------------------------------*/ -MQTT_CLIENT_EXTENSIONS(&builtin_sensors_vdd3, &builtin_sensors_cc2538_temp); -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/mqtt-client.c b/examples/mqtt-client/mqtt-client.c deleted file mode 100644 index 35e669e24..000000000 --- a/examples/mqtt-client/mqtt-client.c +++ /dev/null @@ -1,791 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "net/routing/routing.h" -#include "mqtt.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-icmp6.h" -#include "net/ipv6/sicslowpan.h" -#include "sys/etimer.h" -#include "sys/ctimer.h" -#include "lib/sensors.h" -#include "dev/button-hal.h" -#include "dev/leds.h" -#include "os/sys/log.h" -#include "mqtt-client.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define LOG_MODULE "mqtt-client" -#ifdef MQTT_CLIENT_CONF_LOG_LEVEL -#define LOG_LEVEL MQTT_CLIENT_CONF_LOG_LEVEL -#else -#define LOG_LEVEL LOG_LEVEL_NONE -#endif -/*---------------------------------------------------------------------------*/ -/* Controls whether the example will work in IBM Watson IoT platform mode */ -#ifdef MQTT_CLIENT_CONF_WITH_IBM_WATSON -#define MQTT_CLIENT_WITH_IBM_WATSON MQTT_CLIENT_CONF_WITH_IBM_WATSON -#else -#define MQTT_CLIENT_WITH_IBM_WATSON 0 -#endif -/*---------------------------------------------------------------------------*/ -/* MQTT broker address. Ignored in Watson mode */ -#ifdef MQTT_CLIENT_CONF_BROKER_IP_ADDR -#define MQTT_CLIENT_BROKER_IP_ADDR MQTT_CLIENT_CONF_BROKER_IP_ADDR -#else -#define MQTT_CLIENT_BROKER_IP_ADDR "fd00::1" -#endif -/*---------------------------------------------------------------------------*/ -/* - * MQTT Org ID. - * - * If it equals "quickstart", the client will connect without authentication. - * In all other cases, the client will connect with authentication mode. - * - * In Watson mode, the username will be "use-token-auth". In non-Watson mode - * the username will be MQTT_CLIENT_USERNAME. - * - * In all cases, the password will be MQTT_CLIENT_AUTH_TOKEN. - */ -#ifdef MQTT_CLIENT_CONF_ORG_ID -#define MQTT_CLIENT_ORG_ID MQTT_CLIENT_CONF_ORG_ID -#else -#define MQTT_CLIENT_ORG_ID "quickstart" -#endif -/*---------------------------------------------------------------------------*/ -/* MQTT token */ -#ifdef MQTT_CLIENT_CONF_AUTH_TOKEN -#define MQTT_CLIENT_AUTH_TOKEN MQTT_CLIENT_CONF_AUTH_TOKEN -#else -#define MQTT_CLIENT_AUTH_TOKEN "AUTHTOKEN" -#endif -/*---------------------------------------------------------------------------*/ -#if MQTT_CLIENT_WITH_IBM_WATSON -/* With IBM Watson support */ -static const char *broker_ip = "0064:ff9b:0000:0000:0000:0000:b8ac:7cbd"; -#define MQTT_CLIENT_USERNAME "use-token-auth" - -#else /* MQTT_CLIENT_WITH_IBM_WATSON */ -/* Without IBM Watson support. To be used with other brokers, e.g. Mosquitto */ -static const char *broker_ip = MQTT_CLIENT_BROKER_IP_ADDR; - -#ifdef MQTT_CLIENT_CONF_USERNAME -#define MQTT_CLIENT_USERNAME MQTT_CLIENT_CONF_USERNAME -#else -#define MQTT_CLIENT_USERNAME "use-token-auth" -#endif - -#endif /* MQTT_CLIENT_WITH_IBM_WATSON */ -/*---------------------------------------------------------------------------*/ -#ifdef MQTT_CLIENT_CONF_STATUS_LED -#define MQTT_CLIENT_STATUS_LED MQTT_CLIENT_CONF_STATUS_LED -#else -#define MQTT_CLIENT_STATUS_LED LEDS_GREEN -#endif -/*---------------------------------------------------------------------------*/ -#ifdef MQTT_CLIENT_CONF_WITH_EXTENSIONS -#define MQTT_CLIENT_WITH_EXTENSIONS MQTT_CLIENT_CONF_WITH_EXTENSIONS -#else -#define MQTT_CLIENT_WITH_EXTENSIONS 0 -#endif -/*---------------------------------------------------------------------------*/ -/* - * A timeout used when waiting for something to happen (e.g. to connect or to - * disconnect) - */ -#define STATE_MACHINE_PERIODIC (CLOCK_SECOND >> 1) -/*---------------------------------------------------------------------------*/ -/* Provide visible feedback via LEDS during various states */ -/* When connecting to broker */ -#define CONNECTING_LED_DURATION (CLOCK_SECOND >> 2) - -/* Each time we try to publish */ -#define PUBLISH_LED_ON_DURATION (CLOCK_SECOND) -/*---------------------------------------------------------------------------*/ -/* Connections and reconnections */ -#define RETRY_FOREVER 0xFF -#define RECONNECT_INTERVAL (CLOCK_SECOND * 2) - -/* - * Number of times to try reconnecting to the broker. - * Can be a limited number (e.g. 3, 10 etc) or can be set to RETRY_FOREVER - */ -#define RECONNECT_ATTEMPTS RETRY_FOREVER -#define CONNECTION_STABLE_TIME (CLOCK_SECOND * 5) -static struct timer connection_life; -static uint8_t connect_attempt; -/*---------------------------------------------------------------------------*/ -/* Various states */ -static uint8_t state; -#define STATE_INIT 0 -#define STATE_REGISTERED 1 -#define STATE_CONNECTING 2 -#define STATE_CONNECTED 3 -#define STATE_PUBLISHING 4 -#define STATE_DISCONNECTED 5 -#define STATE_NEWCONFIG 6 -#define STATE_CONFIG_ERROR 0xFE -#define STATE_ERROR 0xFF -/*---------------------------------------------------------------------------*/ -#define CONFIG_ORG_ID_LEN 32 -#define CONFIG_TYPE_ID_LEN 32 -#define CONFIG_AUTH_TOKEN_LEN 32 -#define CONFIG_EVENT_TYPE_ID_LEN 32 -#define CONFIG_CMD_TYPE_LEN 8 -#define CONFIG_IP_ADDR_STR_LEN 64 -/*---------------------------------------------------------------------------*/ -/* A timeout used when waiting to connect to a network */ -#define NET_CONNECT_PERIODIC (CLOCK_SECOND >> 2) -#define NO_NET_LED_DURATION (NET_CONNECT_PERIODIC >> 1) -/*---------------------------------------------------------------------------*/ -/* Default configuration values */ -#define DEFAULT_TYPE_ID "mqtt-client" -#define DEFAULT_EVENT_TYPE_ID "status" -#define DEFAULT_SUBSCRIBE_CMD_TYPE "+" -#define DEFAULT_BROKER_PORT 1883 -#define DEFAULT_PUBLISH_INTERVAL (30 * CLOCK_SECOND) -#define DEFAULT_KEEP_ALIVE_TIMER 60 -#define DEFAULT_RSSI_MEAS_INTERVAL (CLOCK_SECOND * 30) -/*---------------------------------------------------------------------------*/ -#define MQTT_CLIENT_SENSOR_NONE (void *)0xFFFFFFFF -/*---------------------------------------------------------------------------*/ -/* Payload length of ICMPv6 echo requests used to measure RSSI with def rt */ -#define ECHO_REQ_PAYLOAD_LEN 20 -/*---------------------------------------------------------------------------*/ -PROCESS_NAME(mqtt_client_process); -AUTOSTART_PROCESSES(&mqtt_client_process); -/*---------------------------------------------------------------------------*/ -/** - * \brief Data structure declaration for the MQTT client configuration - */ -typedef struct mqtt_client_config { - char org_id[CONFIG_ORG_ID_LEN]; - char type_id[CONFIG_TYPE_ID_LEN]; - char auth_token[CONFIG_AUTH_TOKEN_LEN]; - char event_type_id[CONFIG_EVENT_TYPE_ID_LEN]; - char broker_ip[CONFIG_IP_ADDR_STR_LEN]; - char cmd_type[CONFIG_CMD_TYPE_LEN]; - clock_time_t pub_interval; - int def_rt_ping_interval; - uint16_t broker_port; -} mqtt_client_config_t; -/*---------------------------------------------------------------------------*/ -/* Maximum TCP segment size for outgoing segments of our socket */ -#define MAX_TCP_SEGMENT_SIZE 32 -/*---------------------------------------------------------------------------*/ -/* - * Buffers for Client ID and Topic. - * Make sure they are large enough to hold the entire respective string - * - * d:quickstart:status:EUI64 is 32 bytes long - * iot-2/evt/status/fmt/json is 25 bytes - * We also need space for the null termination - */ -#define BUFFER_SIZE 64 -static char client_id[BUFFER_SIZE]; -static char pub_topic[BUFFER_SIZE]; -static char sub_topic[BUFFER_SIZE]; -/*---------------------------------------------------------------------------*/ -/* - * The main MQTT buffers. - * We will need to increase if we start publishing more data. - */ -#define APP_BUFFER_SIZE 512 -static struct mqtt_connection conn; -static char app_buffer[APP_BUFFER_SIZE]; -/*---------------------------------------------------------------------------*/ -#define QUICKSTART "quickstart" -/*---------------------------------------------------------------------------*/ -static struct mqtt_message *msg_ptr = 0; -static struct etimer publish_periodic_timer; -static struct ctimer ct; -static char *buf_ptr; -static uint16_t seq_nr_value = 0; -/*---------------------------------------------------------------------------*/ -/* Parent RSSI functionality */ -static struct uip_icmp6_echo_reply_notification echo_reply_notification; -static struct etimer echo_request_timer; -static int def_rt_rssi = 0; -/*---------------------------------------------------------------------------*/ -static mqtt_client_config_t conf; -/*---------------------------------------------------------------------------*/ -#if MQTT_CLIENT_WITH_EXTENSIONS -extern const mqtt_client_extension_t *mqtt_client_extensions[]; -extern const uint8_t mqtt_client_extension_count; -#else -static const mqtt_client_extension_t *mqtt_client_extensions[] = { NULL }; -static const uint8_t mqtt_client_extension_count = 0; -#endif -/*---------------------------------------------------------------------------*/ -PROCESS(mqtt_client_process, "MQTT Client"); -/*---------------------------------------------------------------------------*/ -static int -ipaddr_sprintf(char *buf, uint8_t buf_len, const uip_ipaddr_t *addr) -{ - uint16_t a; - uint8_t len = 0; - int i, f; - for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) { - a = (addr->u8[i] << 8) + addr->u8[i + 1]; - if(a == 0 && f >= 0) { - if(f++ == 0) { - len += snprintf(&buf[len], buf_len - len, "::"); - } - } else { - if(f > 0) { - f = -1; - } else if(i > 0) { - len += snprintf(&buf[len], buf_len - len, ":"); - } - len += snprintf(&buf[len], buf_len - len, "%x", a); - } - } - - return len; -} -/*---------------------------------------------------------------------------*/ -static void -echo_reply_handler(uip_ipaddr_t *source, uint8_t ttl, uint8_t *data, - uint16_t datalen) -{ - if(uip_ip6addr_cmp(source, uip_ds6_defrt_choose())) { - def_rt_rssi = sicslowpan_get_last_rssi(); - } -} -/*---------------------------------------------------------------------------*/ -static void -publish_led_off(void *d) -{ - leds_off(MQTT_CLIENT_STATUS_LED); -} -/*---------------------------------------------------------------------------*/ -static void -pub_handler(const char *topic, uint16_t topic_len, const uint8_t *chunk, - uint16_t chunk_len) -{ - LOG_DBG("Pub Handler: topic='%s' (len=%u), chunk_len=%u\n", topic, - topic_len, chunk_len); - - /* If we don't like the length, ignore */ - if(topic_len != 23 || chunk_len != 1) { - LOG_ERR("Incorrect topic or chunk len. Ignored\n"); - return; - } - - /* If the format != json, ignore */ - if(strncmp(&topic[topic_len - 4], "json", 4) != 0) { - LOG_ERR("Incorrect format\n"); - } - - if(strncmp(&topic[10], "leds", 4) == 0) { - LOG_DBG("Received MQTT SUB\n"); - if(chunk[0] == '1') { - leds_on(LEDS_RED); - } else if(chunk[0] == '0') { - leds_off(LEDS_RED); - } - return; - } -} -/*---------------------------------------------------------------------------*/ -static void -mqtt_event(struct mqtt_connection *m, mqtt_event_t event, void *data) -{ - switch(event) { - case MQTT_EVENT_CONNECTED: { - LOG_DBG("Application has a MQTT connection\n"); - timer_set(&connection_life, CONNECTION_STABLE_TIME); - state = STATE_CONNECTED; - break; - } - case MQTT_EVENT_DISCONNECTED: { - LOG_DBG("MQTT Disconnect. Reason %u\n", *((mqtt_event_t *)data)); - - state = STATE_DISCONNECTED; - process_poll(&mqtt_client_process); - break; - } - case MQTT_EVENT_PUBLISH: { - msg_ptr = data; - - /* Implement first_flag in publish message? */ - if(msg_ptr->first_chunk) { - msg_ptr->first_chunk = 0; - LOG_DBG("Application received publish for topic '%s'. Payload " - "size is %i bytes.\n", msg_ptr->topic, msg_ptr->payload_length); - } - - pub_handler(msg_ptr->topic, strlen(msg_ptr->topic), - msg_ptr->payload_chunk, msg_ptr->payload_length); - break; - } - case MQTT_EVENT_SUBACK: { - LOG_DBG("Application is subscribed to topic successfully\n"); - break; - } - case MQTT_EVENT_UNSUBACK: { - LOG_DBG("Application is unsubscribed to topic successfully\n"); - break; - } - case MQTT_EVENT_PUBACK: { - LOG_DBG("Publishing complete.\n"); - break; - } - default: - LOG_DBG("Application got a unhandled MQTT event: %i\n", event); - break; - } -} -/*---------------------------------------------------------------------------*/ -static int -construct_pub_topic(void) -{ - int len = snprintf(pub_topic, BUFFER_SIZE, "iot-2/evt/%s/fmt/json", - conf.event_type_id); - - /* len < 0: Error. Len >= BUFFER_SIZE: Buffer too small */ - if(len < 0 || len >= BUFFER_SIZE) { - LOG_INFO("Pub Topic: %d, Buffer %d\n", len, BUFFER_SIZE); - return 0; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -construct_sub_topic(void) -{ - int len = snprintf(sub_topic, BUFFER_SIZE, "iot-2/cmd/%s/fmt/json", - conf.cmd_type); - - /* len < 0: Error. Len >= BUFFER_SIZE: Buffer too small */ - if(len < 0 || len >= BUFFER_SIZE) { - LOG_INFO("Sub Topic: %d, Buffer %d\n", len, BUFFER_SIZE); - return 0; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -construct_client_id(void) -{ - int len = snprintf(client_id, BUFFER_SIZE, "d:%s:%s:%02x%02x%02x%02x%02x%02x", - conf.org_id, conf.type_id, - linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], - linkaddr_node_addr.u8[2], linkaddr_node_addr.u8[5], - linkaddr_node_addr.u8[6], linkaddr_node_addr.u8[7]); - - /* len < 0: Error. Len >= BUFFER_SIZE: Buffer too small */ - if(len < 0 || len >= BUFFER_SIZE) { - LOG_ERR("Client ID: %d, Buffer %d\n", len, BUFFER_SIZE); - return 0; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -update_config(void) -{ - if(construct_client_id() == 0) { - /* Fatal error. Client ID larger than the buffer */ - state = STATE_CONFIG_ERROR; - return; - } - - if(construct_sub_topic() == 0) { - /* Fatal error. Topic larger than the buffer */ - state = STATE_CONFIG_ERROR; - return; - } - - if(construct_pub_topic() == 0) { - /* Fatal error. Topic larger than the buffer */ - state = STATE_CONFIG_ERROR; - return; - } - - /* Reset the counter */ - seq_nr_value = 0; - - state = STATE_INIT; - - /* - * Schedule next timer event ASAP - * - * If we entered an error state then we won't do anything when it fires. - * - * Since the error at this stage is a config error, we will only exit this - * error state if we get a new config. - */ - etimer_set(&publish_periodic_timer, 0); - - return; -} -/*---------------------------------------------------------------------------*/ -static int -init_config() -{ - /* Populate configuration with default values */ - memset(&conf, 0, sizeof(mqtt_client_config_t)); - - memcpy(conf.org_id, MQTT_CLIENT_ORG_ID, strlen(MQTT_CLIENT_ORG_ID)); - memcpy(conf.type_id, DEFAULT_TYPE_ID, strlen(DEFAULT_TYPE_ID)); - memcpy(conf.auth_token, MQTT_CLIENT_AUTH_TOKEN, - strlen(MQTT_CLIENT_AUTH_TOKEN)); - memcpy(conf.event_type_id, DEFAULT_EVENT_TYPE_ID, - strlen(DEFAULT_EVENT_TYPE_ID)); - memcpy(conf.broker_ip, broker_ip, strlen(broker_ip)); - memcpy(conf.cmd_type, DEFAULT_SUBSCRIBE_CMD_TYPE, 1); - - conf.broker_port = DEFAULT_BROKER_PORT; - conf.pub_interval = DEFAULT_PUBLISH_INTERVAL; - conf.def_rt_ping_interval = DEFAULT_RSSI_MEAS_INTERVAL; - - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -subscribe(void) -{ - /* Publish MQTT topic in IBM quickstart format */ - mqtt_status_t status; - - status = mqtt_subscribe(&conn, NULL, sub_topic, MQTT_QOS_LEVEL_0); - - LOG_DBG("Subscribing!\n"); - if(status == MQTT_STATUS_OUT_QUEUE_FULL) { - LOG_ERR("Tried to subscribe but command queue was full!\n"); - } -} -/*---------------------------------------------------------------------------*/ -static void -publish(void) -{ - /* Publish MQTT topic in IBM quickstart format */ - int len; - int remaining = APP_BUFFER_SIZE; - int i; - char def_rt_str[64]; - - seq_nr_value++; - - buf_ptr = app_buffer; - - len = snprintf(buf_ptr, remaining, - "{" - "\"d\":{" - "\"Platform\":\""CONTIKI_TARGET_STRING"\"," -#ifdef CONTIKI_BOARD_STRING - "\"Board\":\""CONTIKI_BOARD_STRING"\"," -#endif - "\"Seq #\":%d," - "\"Uptime (sec)\":%lu", - seq_nr_value, clock_seconds()); - - if(len < 0 || len >= remaining) { - LOG_ERR("Buffer too short. Have %d, need %d + \\0\n", remaining, - len); - return; - } - - remaining -= len; - buf_ptr += len; - - /* Put our Default route's string representation in a buffer */ - memset(def_rt_str, 0, sizeof(def_rt_str)); - ipaddr_sprintf(def_rt_str, sizeof(def_rt_str), uip_ds6_defrt_choose()); - - len = snprintf(buf_ptr, remaining, - ",\"Def Route\":\"%s\",\"RSSI (dBm)\":%d", - def_rt_str, def_rt_rssi); - - if(len < 0 || len >= remaining) { - LOG_ERR("Buffer too short. Have %d, need %d + \\0\n", remaining, - len); - return; - } - remaining -= len; - buf_ptr += len; - - for(i = 0; i < mqtt_client_extension_count; i++) { - len = snprintf(buf_ptr, remaining, ",%s", - mqtt_client_extensions[i]->value()); - - if(len < 0 || len >= remaining) { - LOG_ERR("Buffer too short. Have %d, need %d + \\0\n", remaining, - len); - return; - } - remaining -= len; - buf_ptr += len; - } - - len = snprintf(buf_ptr, remaining, "}}"); - - if(len < 0 || len >= remaining) { - LOG_ERR("Buffer too short. Have %d, need %d + \\0\n", remaining, - len); - return; - } - - mqtt_publish(&conn, NULL, pub_topic, (uint8_t *)app_buffer, - strlen(app_buffer), MQTT_QOS_LEVEL_0, MQTT_RETAIN_OFF); - - LOG_DBG("Publish!\n"); -} -/*---------------------------------------------------------------------------*/ -static void -connect_to_broker(void) -{ - /* Connect to MQTT server */ - mqtt_connect(&conn, conf.broker_ip, conf.broker_port, - (conf.pub_interval * 3) / CLOCK_SECOND); - - state = STATE_CONNECTING; -} -/*---------------------------------------------------------------------------*/ -static void -ping_parent(void) -{ - if(uip_ds6_get_global(ADDR_PREFERRED) == NULL) { - return; - } - - uip_icmp6_send(uip_ds6_defrt_choose(), ICMP6_ECHO_REQUEST, 0, - ECHO_REQ_PAYLOAD_LEN); -} -/*---------------------------------------------------------------------------*/ -static void -state_machine(void) -{ - switch(state) { - case STATE_INIT: - /* If we have just been configured register MQTT connection */ - mqtt_register(&conn, &mqtt_client_process, client_id, mqtt_event, - MAX_TCP_SEGMENT_SIZE); - - /* - * If we are not using the quickstart service (thus we are an IBM - * registered device), we need to provide user name and password - */ - if(strncasecmp(conf.org_id, QUICKSTART, strlen(conf.org_id)) != 0) { - if(strlen(conf.auth_token) == 0) { - LOG_ERR("User name set, but empty auth token\n"); - state = STATE_ERROR; - break; - } else { - mqtt_set_username_password(&conn, MQTT_CLIENT_USERNAME, - conf.auth_token); - } - } - - /* _register() will set auto_reconnect. We don't want that. */ - conn.auto_reconnect = 0; - connect_attempt = 1; - - state = STATE_REGISTERED; - LOG_DBG("Init\n"); - /* Continue */ - case STATE_REGISTERED: - if(uip_ds6_get_global(ADDR_PREFERRED) != NULL) { - /* Registered and with a public IP. Connect */ - LOG_DBG("Registered. Connect attempt %u\n", connect_attempt); - ping_parent(); - connect_to_broker(); - } else { - leds_on(MQTT_CLIENT_STATUS_LED); - ctimer_set(&ct, NO_NET_LED_DURATION, publish_led_off, NULL); - } - etimer_set(&publish_periodic_timer, NET_CONNECT_PERIODIC); - return; - break; - case STATE_CONNECTING: - leds_on(MQTT_CLIENT_STATUS_LED); - ctimer_set(&ct, CONNECTING_LED_DURATION, publish_led_off, NULL); - /* Not connected yet. Wait */ - LOG_DBG("Connecting (%u)\n", connect_attempt); - break; - case STATE_CONNECTED: - /* Don't subscribe unless we are a registered device */ - if(strncasecmp(conf.org_id, QUICKSTART, strlen(conf.org_id)) == 0) { - LOG_DBG("Using 'quickstart': Skipping subscribe\n"); - state = STATE_PUBLISHING; - } - /* Continue */ - case STATE_PUBLISHING: - /* If the timer expired, the connection is stable. */ - if(timer_expired(&connection_life)) { - /* - * Intentionally using 0 here instead of 1: We want RECONNECT_ATTEMPTS - * attempts if we disconnect after a successful connect - */ - connect_attempt = 0; - } - - if(mqtt_ready(&conn) && conn.out_buffer_sent) { - /* Connected. Publish */ - if(state == STATE_CONNECTED) { - subscribe(); - state = STATE_PUBLISHING; - } else { - leds_on(MQTT_CLIENT_STATUS_LED); - ctimer_set(&ct, PUBLISH_LED_ON_DURATION, publish_led_off, NULL); - LOG_DBG("Publishing\n"); - publish(); - } - etimer_set(&publish_periodic_timer, conf.pub_interval); - /* Return here so we don't end up rescheduling the timer */ - return; - } else { - /* - * Our publish timer fired, but some MQTT packet is already in flight - * (either not sent at all, or sent but not fully ACKd). - * - * This can mean that we have lost connectivity to our broker or that - * simply there is some network delay. In both cases, we refuse to - * trigger a new message and we wait for TCP to either ACK the entire - * packet after retries, or to timeout and notify us. - */ - LOG_DBG("Publishing... (MQTT state=%d, q=%u)\n", conn.state, - conn.out_queue_full); - } - break; - case STATE_DISCONNECTED: - LOG_DBG("Disconnected\n"); - if(connect_attempt < RECONNECT_ATTEMPTS || - RECONNECT_ATTEMPTS == RETRY_FOREVER) { - /* Disconnect and backoff */ - clock_time_t interval; - mqtt_disconnect(&conn); - connect_attempt++; - - interval = connect_attempt < 3 ? RECONNECT_INTERVAL << connect_attempt : - RECONNECT_INTERVAL << 3; - - LOG_DBG("Disconnected. Attempt %u in %lu ticks\n", connect_attempt, interval); - - etimer_set(&publish_periodic_timer, interval); - - state = STATE_REGISTERED; - return; - } else { - /* Max reconnect attempts reached. Enter error state */ - state = STATE_ERROR; - LOG_DBG("Aborting connection after %u attempts\n", connect_attempt - 1); - } - break; - case STATE_CONFIG_ERROR: - /* Idle away. The only way out is a new config */ - LOG_ERR("Bad configuration.\n"); - return; - case STATE_ERROR: - default: - leds_on(MQTT_CLIENT_STATUS_LED); - /* - * 'default' should never happen. - * - * If we enter here it's because of some error. Stop timers. The only thing - * that can bring us out is a new config event - */ - LOG_ERR("Default case: State=0x%02x\n", state); - return; - } - - /* If we didn't return so far, reschedule ourselves */ - etimer_set(&publish_periodic_timer, STATE_MACHINE_PERIODIC); -} -/*---------------------------------------------------------------------------*/ -static void -init_extensions(void) -{ - int i; - - for(i = 0; i < mqtt_client_extension_count; i++) { - if(mqtt_client_extensions[i]->init) { - mqtt_client_extensions[i]->init(); - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(mqtt_client_process, ev, data) -{ - - PROCESS_BEGIN(); - - printf("MQTT Client Process\n"); - - if(init_config() != 1) { - PROCESS_EXIT(); - } - - init_extensions(); - - update_config(); - - def_rt_rssi = 0x8000000; - uip_icmp6_echo_reply_callback_add(&echo_reply_notification, - echo_reply_handler); - etimer_set(&echo_request_timer, conf.def_rt_ping_interval); - - /* Main loop */ - while(1) { - - PROCESS_YIELD(); - - if(ev == button_hal_release_event && - ((button_hal_button_t *)data)->unique_id == BUTTON_HAL_ID_BUTTON_ZERO) { - if(state == STATE_ERROR) { - connect_attempt = 1; - state = STATE_REGISTERED; - } - } - - if((ev == PROCESS_EVENT_TIMER && data == &publish_periodic_timer) || - ev == PROCESS_EVENT_POLL || - (ev == button_hal_release_event && - ((button_hal_button_t *)data)->unique_id == BUTTON_HAL_ID_BUTTON_ZERO)) { - state_machine(); - } - - if(ev == PROCESS_EVENT_TIMER && data == &echo_request_timer) { - ping_parent(); - etimer_set(&echo_request_timer, conf.def_rt_ping_interval); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/mqtt-client.h b/examples/mqtt-client/mqtt-client.h deleted file mode 100644 index c551c701b..000000000 --- a/examples/mqtt-client/mqtt-client.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 MQTT_CLIENT_H_ -#define MQTT_CLIENT_H_ -/*---------------------------------------------------------------------------*/ -#include -/*---------------------------------------------------------------------------*/ -typedef struct mqtt_client_extension_s { - void (*init)(void); - char *(*value)(void); -} mqtt_client_extension_t; -/*---------------------------------------------------------------------------*/ -#define MQTT_CLIENT_EXTENSIONS(...) \ - const mqtt_client_extension_t *mqtt_client_extensions[] = {__VA_ARGS__}; \ - const uint8_t mqtt_client_extension_count = \ - (sizeof(mqtt_client_extensions) / sizeof(mqtt_client_extensions[0])); -/*---------------------------------------------------------------------------*/ -#endif /* MQTT_CLIENT_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/mqtt-client/project-conf.h b/examples/mqtt-client/project-conf.h deleted file mode 100644 index 6b011f7b0..000000000 --- a/examples/mqtt-client/project-conf.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Enable TCP */ -#define UIP_CONF_TCP 1 - -/* Change to 1 to use with the IBM Watson IoT platform */ -#define MQTT_CLIENT_CONF_WITH_IBM_WATSON 0 - -/* - * The IPv6 address of the MQTT broker to connect to. - * Ignored if MQTT_CLIENT_CONF_WITH_IBM_WATSON is 1 - */ -#define MQTT_CLIENT_CONF_BROKER_IP_ADDR "fd00::1" - -/* - * The Organisation ID. - * - * When in Watson mode, the example will default to Org ID "quickstart" and - * will connect using non-authenticated mode. If you want to use registered - * devices, set your Org ID here and then make sure you set the correct token - * through MQTT_CLIENT_CONF_AUTH_TOKEN. - */ -#ifndef MQTT_CLIENT_CONF_ORG_ID -#define MQTT_CLIENT_CONF_ORG_ID "quickstart" -#endif - -/* - * The MQTT username. - * - * Ignored in Watson mode: In this mode the username is always "use-token-auth" - */ -#define MQTT_CLIENT_CONF_USERNAME "mqtt-client-username" - -/* - * The MQTT auth token (password) used when connecting to the MQTT broker. - * - * Used with as well as without Watson. - * - * Transported in cleartext! - */ -#define MQTT_CLIENT_CONF_AUTH_TOKEN "AUTHTOKEN" -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/examples/multicast/Makefile b/examples/multicast/Makefile deleted file mode 100644 index 3e8a88d4a..000000000 --- a/examples/multicast/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CONTIKI_PROJECT = root intermediate sink -all: $(CONTIKI_PROJECT) - -# nrf52dk only supports slave mode, i.e., with no routing -PLATFORMS_EXCLUDE = nrf52dk -# does not fit on sky and z1 motes -PLATFORMS_EXCLUDE += sky z1 - -CONTIKI = ../.. - -include $(CONTIKI)/Makefile.identify-target -MODULES_REL += $(TARGET) - -MODULES += os/net/ipv6/multicast - -MAKE_ROUTING = MAKE_ROUTING_RPL_CLASSIC -include $(CONTIKI)/Makefile.include diff --git a/examples/multicast/cc26x0-cc13x0/module-macros.h b/examples/multicast/cc26x0-cc13x0/module-macros.h deleted file mode 100644 index 460688ebd..000000000 --- a/examples/multicast/cc26x0-cc13x0/module-macros.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018, University of Bristol - http://www.bristol.ac.uk/ - * 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 HOLDER 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. - */ -/*---------------------------------------------------------------------------*/ -/* Code/RAM footprint savings so that things will fit on sensortags */ -#define NETSTACK_MAX_ROUTE_ENTRIES 4 -#define NBR_TABLE_CONF_MAX_NEIGHBORS 4 -#define QUEUEBUF_CONF_NUM 4 diff --git a/examples/multicast/intermediate.c b/examples/multicast/intermediate.c deleted file mode 100644 index a17b7393c..000000000 --- a/examples/multicast/intermediate.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2010, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * This node is part of the RPL multicast example. It basically - * represents a node that does not join the multicast group - * but still knows how to forward multicast packets - * The example will work with or without any number of these nodes - * - * Also, performs some sanity checks for the contiki configuration - * and generates an error if the conf is bad - * - * \author - * George Oikonomou - - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "net/ipv6/multicast/uip-mcast6.h" - -#if !NETSTACK_CONF_WITH_IPV6 || !UIP_CONF_ROUTER || !UIP_IPV6_MULTICAST || !UIP_CONF_IPV6_RPL -#error "This example can not work with the current contiki configuration" -#error "Check the values of: NETSTACK_CONF_WITH_IPV6, UIP_CONF_ROUTER, UIP_CONF_IPV6_RPL" -#endif -/*---------------------------------------------------------------------------*/ -PROCESS(mcast_intermediate_process, "Intermediate Process"); -AUTOSTART_PROCESSES(&mcast_intermediate_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(mcast_intermediate_process, ev, data) -{ - PROCESS_BEGIN(); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/multicast/multicast.csc b/examples/multicast/multicast.csc deleted file mode 100644 index d59708d54..000000000 --- a/examples/multicast/multicast.csc +++ /dev/null @@ -1,256 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - Example of a uIPv6 network with multicast support - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - root - [CONTIKI_DIR]/examples/multicast/root.c - make root.sky TARGET=sky - [CONTIKI_DIR]/examples/multicast/root.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - org.contikios.cooja.mspmote.SkyMoteType - sky2 - intermediate - [CONTIKI_DIR]/examples/multicast/intermediate.c - make intermediate.sky TARGET=sky - [CONTIKI_DIR]/examples/multicast/intermediate.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - org.contikios.cooja.mspmote.SkyMoteType - sky3 - sink - [CONTIKI_DIR]/examples/multicast/sink.c - make sink.sky TARGET=sky - [CONTIKI_DIR]/examples/multicast/sink.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 5.995813174969022 - 34.43129455447824 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 40.70237155931961 - 16.396742420332068 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 100.3720728044051 - 70.93197095432518 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - sky3 - - - - - org.contikios.cooja.interfaces.Position - 81.7376718406712 - 28.854291358797 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - sky3 - - - - - org.contikios.cooja.interfaces.Position - -26.161520836433183 - 8.116006415286686 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - sky3 - - - - - org.contikios.cooja.interfaces.Position - -34.57705675553882 - 92.87247531485058 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 6 - - sky3 - - - - - org.contikios.cooja.interfaces.Position - 39.86312587077661 - 59.603125741056246 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 7 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 1.4345607604759194 - 75.2481773153879 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 8 - - sky2 - - - - org.contikios.cooja.plugins.SimControl - 318 - 0 - 192 - 0 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.AddressVisualizerSkin - 3.914959956760176 0.0 0.0 3.914959956760176 300.2075734071477 -15.682931033747009 - - 869 - 3 - 441 - 320 - 3 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1281 - 2 - 213 - -1 - 714 - - - org.contikios.cooja.plugins.RadioLogger - - 117 - - false - false - - - 1280 - 1 - 268 - 0 - 445 - - - diff --git a/examples/multicast/project-conf.h b/examples/multicast/project-conf.h deleted file mode 100644 index c1bb6910e..000000000 --- a/examples/multicast/project-conf.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2010, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Project specific configuration defines for the RPl multicast - * example. - * - * \author - * George Oikonomou - - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#include "net/ipv6/multicast/uip-mcast6-engines.h" - -/* Change this to switch engines. Engine codes in uip-mcast6-engines.h */ -#ifndef UIP_MCAST6_CONF_ENGINE -#define UIP_MCAST6_CONF_ENGINE UIP_MCAST6_ENGINE_ROLL_TM -#endif - -/* For Imin: Use 16 over CSMA, 64 over Contiki MAC */ -#define ROLL_TM_CONF_IMIN_1 64 - -#define UIP_MCAST6_ROUTE_CONF_ROUTES 1 - -/* Code/RAM footprint savings so that things will fit on our device */ -#ifndef NETSTACK_MAX_ROUTE_ENTRIES -#define NETSTACK_MAX_ROUTE_ENTRIES 10 -#endif - -#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS -#define NBR_TABLE_CONF_MAX_NEIGHBORS 10 -#endif - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/multicast/root.c b/examples/multicast/root.c deleted file mode 100644 index 59d5d2aa8..000000000 --- a/examples/multicast/root.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2010, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * This node is part of the RPL multicast example. It is an RPL root - * and sends a multicast message periodically. For the example to work, - * we need one of those nodes. - * - * \author - * George Oikonomou - - */ - -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" -#include "net/ipv6/multicast/uip-mcast6.h" - -#include -#include - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" -#include "net/routing/routing.h" - -#define MAX_PAYLOAD_LEN 120 -#define MCAST_SINK_UDP_PORT 3001 /* Host byte order */ -#define SEND_INTERVAL CLOCK_SECOND /* clock ticks */ -#define ITERATIONS 100 /* messages */ - -/* Start sending messages START_DELAY secs after we start so that routing can - * converge */ -#define START_DELAY 60 - -static struct uip_udp_conn * mcast_conn; -static char buf[MAX_PAYLOAD_LEN]; -static uint32_t seq_id; - -#if !NETSTACK_CONF_WITH_IPV6 || !UIP_CONF_ROUTER || !UIP_IPV6_MULTICAST || !UIP_CONF_IPV6_RPL -#error "This example can not work with the current contiki configuration" -#error "Check the values of: NETSTACK_CONF_WITH_IPV6, UIP_CONF_ROUTER, UIP_CONF_IPV6_RPL" -#endif -/*---------------------------------------------------------------------------*/ -PROCESS(rpl_root_process, "RPL ROOT, Multicast Sender"); -AUTOSTART_PROCESSES(&rpl_root_process); -/*---------------------------------------------------------------------------*/ -static void -multicast_send(void) -{ - uint32_t id; - - id = uip_htonl(seq_id); - memset(buf, 0, MAX_PAYLOAD_LEN); - memcpy(buf, &id, sizeof(seq_id)); - - PRINTF("Send to: "); - PRINT6ADDR(&mcast_conn->ripaddr); - PRINTF(" Remote Port %u,", uip_ntohs(mcast_conn->rport)); - PRINTF(" (msg=0x%08"PRIx32")", uip_ntohl(*((uint32_t *)buf))); - PRINTF(" %lu bytes\n", (unsigned long)sizeof(id)); - - seq_id++; - uip_udp_packet_send(mcast_conn, buf, sizeof(id)); -} -/*---------------------------------------------------------------------------*/ -static void -prepare_mcast(void) -{ - uip_ipaddr_t ipaddr; - - /* - * IPHC will use stateless multicast compression for this destination - * (M=1, DAC=0), with 32 inline bits (1E 89 AB CD) - */ - uip_ip6addr(&ipaddr, 0xFF1E,0,0,0,0,0,0x89,0xABCD); - mcast_conn = udp_new(&ipaddr, UIP_HTONS(MCAST_SINK_UDP_PORT), NULL); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(rpl_root_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - - PRINTF("Multicast Engine: '%s'\n", UIP_MCAST6.name); - - NETSTACK_ROUTING.root_start(); - - prepare_mcast(); - - etimer_set(&et, START_DELAY * CLOCK_SECOND); - while(1) { - PROCESS_YIELD(); - if(etimer_expired(&et)) { - if(seq_id == ITERATIONS) { - etimer_stop(&et); - } else { - multicast_send(); - etimer_set(&et, SEND_INTERVAL); - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/multicast/sink.c b/examples/multicast/sink.c deleted file mode 100644 index 2b6f48846..000000000 --- a/examples/multicast/sink.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2010, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * This node is part of the RPL multicast example. It is a node that - * joins a multicast group and listens for messages. It also knows how - * to forward messages down the tree. - * For the example to work, we need one or more of those nodes. - * - * \author - * George Oikonomou - - */ - -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" -#include "net/ipv6/multicast/uip-mcast6.h" - -#include - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -#define MCAST_SINK_UDP_PORT 3001 /* Host byte order */ - -static struct uip_udp_conn *sink_conn; -static uint16_t count; - -#if !NETSTACK_CONF_WITH_IPV6 || !UIP_CONF_ROUTER || !UIP_IPV6_MULTICAST || !UIP_CONF_IPV6_RPL -#error "This example can not work with the current contiki configuration" -#error "Check the values of: NETSTACK_CONF_WITH_IPV6, UIP_CONF_ROUTER, UIP_CONF_IPV6_RPL" -#endif -/*---------------------------------------------------------------------------*/ -PROCESS(mcast_sink_process, "Multicast Sink"); -AUTOSTART_PROCESSES(&mcast_sink_process); -/*---------------------------------------------------------------------------*/ -static void -tcpip_handler(void) -{ - if(uip_newdata()) { - count++; - PRINTF("In: [0x%08lx], TTL %u, total %u\n", - (unsigned long)uip_ntohl((unsigned long) *((uint32_t *)(uip_appdata))), - UIP_IP_BUF->ttl, count); - } - return; -} -/*---------------------------------------------------------------------------*/ -static uip_ds6_maddr_t * -join_mcast_group(void) -{ - uip_ipaddr_t addr; - uip_ds6_maddr_t *rv; - const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix(); - - /* First, set our v6 global */ - uip_ip6addr_copy(&addr, default_prefix); - uip_ds6_set_addr_iid(&addr, &uip_lladdr); - uip_ds6_addr_add(&addr, 0, ADDR_AUTOCONF); - - /* - * IPHC will use stateless multicast compression for this destination - * (M=1, DAC=0), with 32 inline bits (1E 89 AB CD) - */ - uip_ip6addr(&addr, 0xFF1E,0,0,0,0,0,0x89,0xABCD); - rv = uip_ds6_maddr_add(&addr); - - if(rv) { - PRINTF("Joined multicast group "); - PRINT6ADDR(&uip_ds6_maddr_lookup(&addr)->ipaddr); - PRINTF("\n"); - } - return rv; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(mcast_sink_process, ev, data) -{ - PROCESS_BEGIN(); - - PRINTF("Multicast Engine: '%s'\n", UIP_MCAST6.name); - - if(join_mcast_group() == NULL) { - PRINTF("Failed to join multicast group\n"); - PROCESS_EXIT(); - } - - count = 0; - - sink_conn = udp_new(NULL, UIP_HTONS(0), NULL); - udp_bind(sink_conn, UIP_HTONS(MCAST_SINK_UDP_PORT)); - - PRINTF("Listening: "); - PRINT6ADDR(&sink_conn->ripaddr); - PRINTF(" local/remote port %u/%u\n", - UIP_HTONS(sink_conn->lport), UIP_HTONS(sink_conn->rport)); - - while(1) { - PROCESS_YIELD(); - if(ev == tcpip_event) { - tcpip_handler(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/multicast/zoul/module-macros.h b/examples/multicast/zoul/module-macros.h deleted file mode 100644 index 7029c60ea..000000000 --- a/examples/multicast/zoul/module-macros.h +++ /dev/null @@ -1,2 +0,0 @@ -/* Get some extra RAM */ -#define LPM_CONF_MAX_PM 1 diff --git a/examples/nullnet/Makefile b/examples/nullnet/Makefile deleted file mode 100644 index fac592d26..000000000 --- a/examples/nullnet/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = nullnet-unicast nullnet-broadcast -PLATFORMS_ONLY = cc26x0-cc13x0 -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. - -PLATFORMS_EXCLUDE = nrf52dk - -#use this to enable TSCH: MAKE_MAC = MAKE_MAC_TSCH -MAKE_MAC ?= MAKE_MAC_CSMA -MAKE_NET = MAKE_NET_NULLNET -include $(CONTIKI)/Makefile.include diff --git a/examples/nullnet/nullnet-broadcast.c b/examples/nullnet/nullnet-broadcast.c deleted file mode 100644 index 7bb1f1c87..000000000 --- a/examples/nullnet/nullnet-broadcast.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * NullNet broadcast example - * \author -* Simon Duquennoy - * - */ - -#include "contiki.h" -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" -#include -#include /* For printf() */ - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -/* Configuration */ -#define SEND_INTERVAL (8 * CLOCK_SECOND) - -#if MAC_CONF_WITH_TSCH -#include "net/mac/tsch/tsch.h" -static linkaddr_t coordinator_addr = {{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}; -#endif /* MAC_CONF_WITH_TSCH */ - -/*---------------------------------------------------------------------------*/ -PROCESS(nullnet_example_process, "NullNet broadcast example"); -AUTOSTART_PROCESSES(&nullnet_example_process); - -/*---------------------------------------------------------------------------*/ -void input_callback(const void *data, uint16_t len, - const linkaddr_t *src, const linkaddr_t *dest) -{ - if(len == sizeof(unsigned)) { - unsigned count; - memcpy(&count, data, sizeof(count)); - LOG_INFO("Received %u from ", count); - LOG_INFO_LLADDR(src); - LOG_INFO_("\n"); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(nullnet_example_process, ev, data) -{ - static struct etimer periodic_timer; - static unsigned count = 0; - - PROCESS_BEGIN(); - -#if MAC_CONF_WITH_TSCH - tsch_set_coordinator(linkaddr_cmp(&coordinator_addr, &linkaddr_node_addr)); -#endif /* MAC_CONF_WITH_TSCH */ - - /* Initialize NullNet */ - nullnet_buf = (uint8_t *)&count; - nullnet_len = sizeof(count); - nullnet_set_input_callback(input_callback); - - etimer_set(&periodic_timer, SEND_INTERVAL); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - LOG_INFO("Sending %u to ", count); - LOG_INFO_LLADDR(NULL); - LOG_INFO_("\n"); - - memcpy(nullnet_buf, &count, sizeof(count)); - nullnet_len = sizeof(count); - - NETSTACK_NETWORK.output(NULL); - count++; - etimer_reset(&periodic_timer); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/nullnet/nullnet-broadcast.csc b/examples/nullnet/nullnet-broadcast.csc deleted file mode 100644 index 616845525..000000000 --- a/examples/nullnet/nullnet-broadcast.csc +++ /dev/null @@ -1,178 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - NullNet Broadcast Example - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype928 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/nullnet/nullnet-broadcast.c - make nullnet-broadcast.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 41.086521947449974 - 65.60589922041163 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype928 - - - - org.contikios.cooja.interfaces.Position - 28.458497515673685 - 52.43866085432446 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype928 - - - - org.contikios.cooja.interfaces.Position - 6.830522087791668 - 77.15936959931379 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype928 - - - - org.contikios.cooja.plugins.SimControl - 280 - 4 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 6.180735450568881 0.0 0.0 6.180735450568881 49.41871362245591 -238.19717905203652 - - 400 - 3 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1179 - 1 - 704 - 679 - 0 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - - - - 1.7067792216977151 - - 1858 - 0 - 166 - 9 - 723 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - 500 - 2 - 300 - 19 - 409 - - - diff --git a/examples/nullnet/nullnet-unicast.c b/examples/nullnet/nullnet-unicast.c deleted file mode 100644 index c3a495165..000000000 --- a/examples/nullnet/nullnet-unicast.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * NullNet unicast example - * \author -* Simon Duquennoy - * - */ - -#include "contiki.h" -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" - -#include -#include /* For printf() */ - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -/* Configuration */ -#define SEND_INTERVAL (8 * CLOCK_SECOND) -//launchpad_link_layer_address {{ 0x000, 0x0012, 0x004b, 0x0000, 0x000f, 0x0024, 0x0000, 0x0002 }} -static linkaddr_t dest_addr = {{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}; - -#if MAC_CONF_WITH_TSCH -#include "net/mac/tsch/tsch.h" -static linkaddr_t coordinator_addr = {{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}; -#endif /* MAC_CONF_WITH_TSCH */ - -/*---------------------------------------------------------------------------*/ -PROCESS(nullnet_example_process, "NullNet unicast example"); -AUTOSTART_PROCESSES(&nullnet_example_process); - -/*---------------------------------------------------------------------------*/ -void input_callback(const void *data, uint16_t len, - const linkaddr_t *src, const linkaddr_t *dest) -{ - if(len == sizeof(unsigned)) { - unsigned count; - memcpy(&count, data, sizeof(count)); - LOG_INFO("Received %u from ", count); - LOG_INFO_LLADDR(src); - LOG_INFO_("\n"); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(nullnet_example_process, ev, data) -{ - static struct etimer periodic_timer; - static unsigned count = 0; - - PROCESS_BEGIN(); - -#if MAC_CONF_WITH_TSCH - tsch_set_coordinator(linkaddr_cmp(&coordinator_addr, &linkaddr_node_addr)); -#endif /* MAC_CONF_WITH_TSCH */ - - /* Initialize NullNet */ - nullnet_buf = (uint8_t *)&count; - nullnet_len = sizeof(count); - nullnet_set_input_callback(input_callback); - LOG_INFO_LLADDR(&linkaddr_node_addr); - if(!linkaddr_cmp(&dest_addr, &linkaddr_node_addr)) { - etimer_set(&periodic_timer, SEND_INTERVAL); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - LOG_INFO("Sending %u to ", count); - LOG_INFO_LLADDR(&dest_addr); - LOG_INFO_("\n"); - - NETSTACK_NETWORK.output(&dest_addr); - count++; - etimer_reset(&periodic_timer); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/nullnet/nullnet-unicast.csc b/examples/nullnet/nullnet-unicast.csc deleted file mode 100644 index 5a93836cd..000000000 --- a/examples/nullnet/nullnet-unicast.csc +++ /dev/null @@ -1,177 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - NullNet Unicast Example - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype634 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/nullnet/nullnet-unicast.c - make nullnet-unicast.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 41.086521947449974 - 65.60589922041163 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype634 - - - - org.contikios.cooja.interfaces.Position - 28.458497515673685 - 52.43866085432446 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype634 - - - - org.contikios.cooja.interfaces.Position - 6.830522087791668 - 77.15936959931379 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype634 - - - - org.contikios.cooja.plugins.SimControl - 280 - 4 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 6.180735450568881 0.0 0.0 6.180735450568881 49.41871362245591 -238.19717905203652 - - 400 - 1 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1179 - 0 - 704 - 679 - 0 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - - - - 1.7067792216977151 - - 1858 - 3 - 166 - 9 - 723 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - 500 - 2 - 300 - 109 - 408 - - diff --git a/examples/platform-specific/cc2538-common/Makefile b/examples/platform-specific/cc2538-common/Makefile deleted file mode 100644 index c55c65eaf..000000000 --- a/examples/platform-specific/cc2538-common/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CONTIKI_PROJECT = test-pwm timer-test test-uart - -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = cc2538dk openmote-cc2538 zoul - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/cc2538-common/Makefile.target b/examples/platform-specific/cc2538-common/Makefile.target deleted file mode 100644 index 777593c88..000000000 --- a/examples/platform-specific/cc2538-common/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = cc2538dk diff --git a/examples/platform-specific/cc2538-common/README.md b/examples/platform-specific/cc2538-common/README.md deleted file mode 100644 index eec7a4af3..000000000 --- a/examples/platform-specific/cc2538-common/README.md +++ /dev/null @@ -1,18 +0,0 @@ -README file for CC2538 common examples -========= - -The `cc2538-commmon` groups examples common to all cc2538-based platforms. -The examples in this folder are known to work on: - -* cc2538dk (default) -* zoul - -To change the default target at compilation time you can add the following: - -make TARGET=zoul - -Or to define the default platform permanently: - -make TARGET=zoul savetarget - -This will create a `Makefile.target` file with the TARGET predefined. diff --git a/examples/platform-specific/cc2538-common/crypto/Makefile b/examples/platform-specific/cc2538-common/crypto/Makefile deleted file mode 100644 index 2191d44f0..000000000 --- a/examples/platform-specific/cc2538-common/crypto/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -CONTIKI_PROJECT = ecb-test cbc-test ctr-test cbc-mac-test gcm-test ccm-test -CONTIKI_PROJECT += sha256-test - -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = cc2538dk openmote-cc2538 zoul - -CONTIKI = ../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/cc2538-common/crypto/Makefile.target b/examples/platform-specific/cc2538-common/crypto/Makefile.target deleted file mode 100644 index 777593c88..000000000 --- a/examples/platform-specific/cc2538-common/crypto/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = cc2538dk diff --git a/examples/platform-specific/cc2538-common/crypto/cbc-mac-test.c b/examples/platform-specific/cc2538-common/crypto/cbc-mac-test.c deleted file mode 100644 index 98ac8483e..000000000 --- a/examples/platform-specific/cc2538-common/crypto/cbc-mac-test.c +++ /dev/null @@ -1,506 +0,0 @@ -/* - * Copyright (c) 2016, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-cbc-mac-test cc2538 AES-CBC-MAC Test Project - * - * AES-CBC-MAC access example for CC2538-based platforms - * - * This example shows how AES-CBC-MAC should be used. The example also - * verifies the AES-CBC-MAC functionality. - * - * @{ - * - * \file - * Example demonstrating AES-CBC-MAC - */ -#include "contiki.h" -#include "sys/rtimer.h" -#include "dev/rom-util.h" -#include "dev/cbc-mac.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define MDATA_MAX_LEN 160 -/*---------------------------------------------------------------------------*/ -PROCESS(cbc_mac_test_process, "cbc_mac test process"); -AUTOSTART_PROCESSES(&cbc_mac_test_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cbc_mac_test_process, ev, data) -{ - static const char *const str_res[] = { - "success", - "invalid param", - "NULL error", - "resource in use", - "DMA bus error", - "keystore read error", - "keystore write error", - "authentication failed" - }; - static const uint8_t keys128[][128 / 8] = { - { 0x1f, 0x8e, 0x49, 0x73, 0x95, 0x3f, 0x3f, 0xb0, - 0xbd, 0x6b, 0x16, 0x66, 0x2e, 0x9a, 0x3c, 0x17 }, - { 0xb7, 0xf3, 0xc9, 0x57, 0x6e, 0x12, 0xdd, 0x0d, - 0xb6, 0x3e, 0x8f, 0x8f, 0xac, 0x2b, 0x9a, 0x39 }, - { 0x89, 0xa5, 0x53, 0x73, 0x04, 0x33, 0xf7, 0xe6, - 0xd6, 0x7d, 0x16, 0xd3, 0x73, 0xbd, 0x53, 0x60 }, - { 0x2c, 0x14, 0x41, 0x37, 0x51, 0xc3, 0x1e, 0x27, - 0x30, 0x57, 0x0b, 0xa3, 0x36, 0x1c, 0x78, 0x6b }, - { 0x6a, 0x70, 0x82, 0xcf, 0x8c, 0xda, 0x13, 0xef, - 0xf4, 0x8c, 0x81, 0x58, 0xdd, 0xa2, 0x06, 0xae }, - { 0x7b, 0x1a, 0xb9, 0x14, 0x4b, 0x02, 0x39, 0x31, - 0x5c, 0xd5, 0xee, 0xc6, 0xc7, 0x56, 0x63, 0xbd }, - { 0xba, 0xb0, 0xcc, 0xed, 0xdc, 0x0a, 0xbd, 0x63, - 0xe3, 0xf8, 0x2e, 0x9f, 0xbf, 0xf7, 0xb8, 0xaa }, - { 0x97, 0xa1, 0x02, 0x55, 0x29, 0xb9, 0x92, 0x5e, - 0x25, 0xbb, 0xe7, 0x87, 0x70, 0xca, 0x2f, 0x99 } - }; - static const uint8_t keys192[][192 / 8] = { - { 0xba, 0x75, 0xf4, 0xd1, 0xd9, 0xd7, 0xcf, 0x7f, - 0x55, 0x14, 0x45, 0xd5, 0x6c, 0xc1, 0xa8, 0xab, - 0x2a, 0x07, 0x8e, 0x15, 0xe0, 0x49, 0xdc, 0x2c }, - { 0x16, 0x2a, 0xd5, 0x0e, 0xe6, 0x4a, 0x07, 0x02, - 0xaa, 0x55, 0x1f, 0x57, 0x1d, 0xed, 0xc1, 0x6b, - 0x2c, 0x1b, 0x6a, 0x1e, 0x4d, 0x4b, 0x5e, 0xee }, - { 0x8e, 0x27, 0x40, 0xfb, 0xa1, 0x57, 0xae, 0xf2, - 0x42, 0x2e, 0x44, 0x23, 0x12, 0xd1, 0x5c, 0x14, - 0xd3, 0x12, 0x55, 0x36, 0x84, 0xfc, 0xdc, 0x15 }, - { 0x50, 0x9b, 0xaf, 0x46, 0xfb, 0x9d, 0xe3, 0x42, - 0x81, 0xda, 0xfc, 0xc3, 0xdb, 0x79, 0x59, 0x3b, - 0xff, 0xa8, 0x42, 0x69, 0x04, 0x30, 0x26, 0x88 } - }; - static const uint8_t keys256[][256 / 8] = { - { 0x6e, 0xd7, 0x6d, 0x2d, 0x97, 0xc6, 0x9f, 0xd1, - 0x33, 0x95, 0x89, 0x52, 0x39, 0x31, 0xf2, 0xa6, - 0xcf, 0xf5, 0x54, 0xb1, 0x5f, 0x73, 0x8f, 0x21, - 0xec, 0x72, 0xdd, 0x97, 0xa7, 0x33, 0x09, 0x07 }, - { 0x48, 0xbe, 0x59, 0x7e, 0x63, 0x2c, 0x16, 0x77, - 0x23, 0x24, 0xc8, 0xd3, 0xfa, 0x1d, 0x9c, 0x5a, - 0x9e, 0xcd, 0x01, 0x0f, 0x14, 0xec, 0x5d, 0x11, - 0x0d, 0x3b, 0xfe, 0xc3, 0x76, 0xc5, 0x53, 0x2b }, - { 0x43, 0xe9, 0x53, 0xb2, 0xae, 0xa0, 0x8a, 0x3a, - 0xd5, 0x2d, 0x18, 0x2f, 0x58, 0xc7, 0x2b, 0x9c, - 0x60, 0xfb, 0xe4, 0xa9, 0xca, 0x46, 0xa3, 0xcb, - 0x89, 0xe3, 0x86, 0x38, 0x45, 0xe2, 0x2c, 0x9e }, - { 0x87, 0x72, 0x5b, 0xd4, 0x3a, 0x45, 0x60, 0x88, - 0x14, 0x18, 0x07, 0x73, 0xf0, 0xe7, 0xab, 0x95, - 0xa3, 0xc8, 0x59, 0xd8, 0x3a, 0x21, 0x30, 0xe8, - 0x84, 0x19, 0x0e, 0x44, 0xd1, 0x4c, 0x69, 0x96 } - }; - static const struct { - const void *keys; - uint8_t key_size; - uint8_t count; - } keys[] = { - { keys128, AES_KEY_STORE_SIZE_KEY_SIZE_128, - sizeof(keys128) / sizeof(keys128[0]) }, - { keys192, AES_KEY_STORE_SIZE_KEY_SIZE_192, - sizeof(keys192) / sizeof(keys192[0]) }, - { keys256, AES_KEY_STORE_SIZE_KEY_SIZE_256, - sizeof(keys256) / sizeof(keys256[0]) } - }; - static const struct { - uint8_t key_size_index; - uint8_t key_area; - uint8_t mdata[MDATA_MAX_LEN]; - uint16_t mdata_len; - uint8_t mac[CBC_MAC_MAC_LEN]; - } vectors[] = { - { - 0, /* key_size_index */ - 0, /* key_area */ - { 0x45, 0xcf, 0x12, 0x96, 0x4f, 0xc8, 0x24, 0xab, - 0x76, 0x61, 0x6a, 0xe2, 0xf4, 0xbf, 0x08, 0x22 }, /* mdata */ - 16, /* mdata_len */ - { 0x97, 0x67, 0x0c, 0x83, 0x99, 0x24, 0xa4, 0xc6, - 0x15, 0xb0, 0xf6, 0x14, 0xae, 0x75, 0xa8, 0x69 } /* mac */ - }, { - 0, /* key_size_index */ - 1, /* key_area */ - { 0x9a, 0xc1, 0x99, 0x54, 0xce, 0x13, 0x19, 0xb3, - 0x54, 0xd3, 0x22, 0x04, 0x60, 0xf7, 0x1c, 0x1e, - 0x37, 0x3f, 0x1c, 0xd3, 0x36, 0x24, 0x08, 0x81, - 0x16, 0x0c, 0xfd, 0xe4, 0x6e, 0xbf, 0xed, 0x2e, - 0x79, 0x1e, 0x8d, 0x5a, 0x1a, 0x13, 0x6e, 0xbd, - 0x1d, 0xc4, 0x69, 0xde, 0xc0, 0x0c, 0x41, 0x87, - 0x72, 0x2b, 0x84, 0x1c, 0xda, 0xbc, 0xb2, 0x2c, - 0x1b, 0xe8, 0xa1, 0x46, 0x57, 0xda, 0x20, 0x0e }, /* mdata */ - 64, /* mdata_len */ - { 0x9d, 0x15, 0xb9, 0xfb, 0xff, 0xe2, 0x32, 0x97, - 0x56, 0x36, 0x36, 0x6d, 0x13, 0x65, 0x78, 0xb5 } /* mac */ - }, { - 0, /* key_size_index */ - 2, /* key_area */ - { 0x80, 0x7b, 0xc4, 0xea, 0x68, 0x4e, 0xed, 0xcf, - 0xdc, 0xca, 0x30, 0x18, 0x06, 0x80, 0xb0, 0xf1, - 0xae, 0x28, 0x14, 0xf3, 0x5f, 0x36, 0xd0, 0x53, - 0xc5, 0xae, 0xa6, 0x59, 0x5a, 0x38, 0x6c, 0x14, - 0x42, 0x77, 0x0f, 0x4d, 0x72, 0x97, 0xd8, 0xb9, - 0x18, 0x25, 0xee, 0x72, 0x37, 0x24, 0x1d, 0xa8, - 0x92, 0x5d, 0xd5, 0x94, 0xcc, 0xf6, 0x76, 0xae, - 0xcd, 0x46, 0xca, 0x20, 0x68, 0xe8, 0xd3, 0x7a, - 0x3a, 0x0e, 0xc8, 0xa7, 0xd5, 0x18, 0x5a, 0x20, - 0x1e, 0x66, 0x3b, 0x5f, 0xf3, 0x6a, 0xe1, 0x97, - 0x11, 0x01, 0x88, 0xa2, 0x35, 0x03, 0x76, 0x3b, - 0x82, 0x18, 0x82, 0x6d, 0x23, 0xce, 0xd7, 0x4b, - 0x31, 0xe9, 0xf6, 0xe2, 0xd7, 0xfb, 0xfa, 0x6c, - 0xb4, 0x34, 0x20, 0xc7, 0x80, 0x7a, 0x86, 0x25 }, /* mdata */ - 112, /* mdata_len */ - { 0x5f, 0x4f, 0x06, 0xe0, 0x62, 0x65, 0xf2, 0xeb, - 0x16, 0x1c, 0xda, 0x9f, 0x30, 0xe9, 0x79, 0x53 } /* mac */ - }, { - 0, /* key_size_index */ - 3, /* key_area */ - { 0x40, 0xd9, 0x30, 0xf9, 0xa0, 0x53, 0x34, 0xd9, - 0x81, 0x6f, 0xe2, 0x04, 0x99, 0x9c, 0x3f, 0x82, - 0xa0, 0x3f, 0x6a, 0x04, 0x57, 0xa8, 0xc4, 0x75, - 0xc9, 0x45, 0x53, 0xd1, 0xd1, 0x16, 0x69, 0x3a, - 0xdc, 0x61, 0x80, 0x49, 0xf0, 0xa7, 0x69, 0xa2, - 0xee, 0xd6, 0xa6, 0xcb, 0x14, 0xc0, 0x14, 0x3e, - 0xc5, 0xcc, 0xcd, 0xbc, 0x8d, 0xec, 0x4c, 0xe5, - 0x60, 0xcf, 0xd2, 0x06, 0x22, 0x57, 0x09, 0x32, - 0x6d, 0x4d, 0xe7, 0x94, 0x8e, 0x54, 0xd6, 0x03, - 0xd0, 0x1b, 0x12, 0xd7, 0xfe, 0xd7, 0x52, 0xfb, - 0x23, 0xf1, 0xaa, 0x44, 0x94, 0xfb, 0xb0, 0x01, - 0x30, 0xe9, 0xde, 0xd4, 0xe7, 0x7e, 0x37, 0xc0, - 0x79, 0x04, 0x2d, 0x82, 0x80, 0x40, 0xc3, 0x25, - 0xb1, 0xa5, 0xef, 0xd1, 0x5f, 0xc8, 0x42, 0xe4, - 0x40, 0x14, 0xca, 0x43, 0x74, 0xbf, 0x38, 0xf3, - 0xc3, 0xfc, 0x3e, 0xe3, 0x27, 0x73, 0x3b, 0x0c, - 0x8a, 0xee, 0x1a, 0xbc, 0xd0, 0x55, 0x77, 0x2f, - 0x18, 0xdc, 0x04, 0x60, 0x3f, 0x7b, 0x2c, 0x1e, - 0xa6, 0x9f, 0xf6, 0x62, 0x36, 0x1f, 0x2b, 0xe0, - 0xa1, 0x71, 0xbb, 0xdc, 0xea, 0x1e, 0x5d, 0x3f }, /* mdata */ - 160, /* mdata_len */ - { 0xda, 0x15, 0x2d, 0xf1, 0xf5, 0x6a, 0x44, 0x0e, - 0x1c, 0x7e, 0x27, 0x80, 0xed, 0x87, 0xd9, 0x3d } /* mac */ - }, { - 0, /* key_size_index */ - 4, /* key_area */ - { 0xf8, 0xeb, 0x31, 0xb3, 0x1e, 0x37, 0x4e, 0x96, - 0x00, 0x30, 0xcd, 0x1c, 0xad, 0xb0, 0xef, 0x0c }, /* mdata */ - 16, /* mdata_len */ - { 0x11, 0x0b, 0x18, 0xdb, 0xe0, 0x97, 0x56, 0x39, - 0xf7, 0x1d, 0x87, 0x7d, 0x6d, 0x07, 0x27, 0x55 } /* mac */ - }, { - 0, /* key_size_index */ - 5, /* key_area */ - { 0xd3, 0xf8, 0x9b, 0x71, 0xe0, 0x33, 0x07, 0x0f, - 0x9d, 0x75, 0x16, 0xa6, 0xcb, 0x4e, 0xa5, 0xef, - 0x51, 0xd6, 0xfb, 0x63, 0xd4, 0xf0, 0xfe, 0xa0, - 0x89, 0xd0, 0xa6, 0x0e, 0x47, 0xbb, 0xb3, 0xc2, - 0xe1, 0x0e, 0x9b, 0xa3, 0xb2, 0x82, 0xc7, 0xcb, - 0x79, 0xae, 0xfe, 0x30, 0x68, 0xce, 0x22, 0x83, - 0x77, 0xc2, 0x1a, 0x58, 0xfe, 0x5a, 0x0f, 0x88, - 0x83, 0xd0, 0xdb, 0xd3, 0xd0, 0x96, 0xbe, 0xca }, /* mdata */ - 64, /* mdata_len */ - { 0x6d, 0x91, 0x75, 0x52, 0x10, 0xcc, 0x69, 0x4a, - 0xde, 0x6c, 0xf6, 0xa0, 0xcd, 0x2d, 0x51, 0x8e } /* mac */ - }, { - 0, /* key_size_index */ - 6, /* key_area */ - { 0xc6, 0x5b, 0x94, 0xb1, 0xf2, 0x91, 0xfa, 0x9f, - 0x06, 0x00, 0xf2, 0x2c, 0x3c, 0x04, 0x32, 0xc8, - 0x95, 0xad, 0x5d, 0x17, 0x7b, 0xcc, 0xcc, 0x9e, - 0xa4, 0x4e, 0x8e, 0xc3, 0x39, 0xc9, 0xad, 0xf4, - 0x38, 0x55, 0xb3, 0x26, 0x17, 0x9d, 0x6d, 0x81, - 0xaa, 0x36, 0xef, 0x59, 0x46, 0x2f, 0xd8, 0x61, - 0x27, 0xe9, 0xd8, 0x1b, 0x0f, 0x28, 0x6f, 0x93, - 0x30, 0x6b, 0xf7, 0x4d, 0x4c, 0x79, 0xe4, 0x7c, - 0x1b, 0x3d, 0x4b, 0x74, 0xed, 0xd3, 0xa1, 0x62, - 0x90, 0xe3, 0xc6, 0x3b, 0x74, 0x2e, 0x41, 0xf2, - 0x0d, 0x66, 0xce, 0xee, 0x79, 0x43, 0x16, 0xbb, - 0x63, 0xd3, 0xbd, 0x00, 0x27, 0x12, 0xa1, 0xb1, - 0x36, 0xba, 0x61, 0x85, 0xbd, 0x5c, 0x1d, 0xab, - 0x81, 0xb0, 0x7d, 0xb9, 0x0d, 0x2a, 0xf5, 0xe5 }, /* mdata */ - 112, /* mdata_len */ - { 0x47, 0x12, 0x32, 0xdc, 0x47, 0xca, 0x7e, 0xe2, - 0xd8, 0xd6, 0x43, 0x6c, 0xe5, 0x75, 0x03, 0xb9 } /* mac */ - }, { - 0, /* key_size_index */ - 7, /* key_area */ - { 0x22, 0xcd, 0xc3, 0x30, 0x6f, 0xcd, 0x4d, 0x31, - 0xcc, 0xd3, 0x27, 0x20, 0xcb, 0xb6, 0x1b, 0xad, - 0x28, 0xd8, 0x55, 0x67, 0x06, 0x57, 0xc4, 0x8c, - 0x7b, 0x88, 0xc3, 0x1f, 0x4f, 0xa1, 0xf9, 0x3c, - 0x01, 0xb5, 0x7d, 0xa9, 0x0b, 0xe6, 0x3e, 0xad, - 0x67, 0xd6, 0xa3, 0x25, 0x52, 0x5e, 0x6e, 0xd4, - 0x50, 0x83, 0xe6, 0xfb, 0x70, 0xa5, 0x35, 0x29, - 0xd1, 0xfa, 0x0f, 0x55, 0x65, 0x3b, 0x94, 0x2a, - 0xf5, 0x9d, 0x78, 0xa2, 0x66, 0x03, 0x61, 0xd6, - 0x3a, 0x72, 0x90, 0x15, 0x5a, 0xc5, 0xc4, 0x33, - 0x12, 0xa2, 0x5b, 0x23, 0x5d, 0xac, 0xbb, 0xc8, - 0x63, 0xfa, 0xf0, 0x09, 0x40, 0xc9, 0x96, 0x24, - 0x07, 0x6d, 0xfa, 0x44, 0x06, 0x8e, 0x7c, 0x55, - 0x4c, 0x90, 0x38, 0x17, 0x69, 0x53, 0xe5, 0x71, - 0x75, 0x1d, 0xfc, 0x09, 0x54, 0xd4, 0x1d, 0x11, - 0x37, 0x71, 0xb0, 0x64, 0x66, 0xb1, 0xc8, 0xd1, - 0x3e, 0x0d, 0x4c, 0xb6, 0x75, 0xed, 0x58, 0xd1, - 0xa6, 0x19, 0xe1, 0x54, 0x09, 0x70, 0x98, 0x37, - 0x81, 0xdc, 0x11, 0xd2, 0xdd, 0x85, 0x25, 0xab, - 0x57, 0x45, 0x95, 0x8d, 0x61, 0x5d, 0xef, 0xda }, /* mdata */ - 160, /* mdata_len */ - { 0xe9, 0xae, 0x7e, 0x63, 0x54, 0x23, 0xc3, 0x66, - 0xd5, 0x23, 0xf9, 0x7c, 0x0e, 0xdb, 0x18, 0xb0 } /* mac */ - }, { - 1, /* key_size_index */ - 0, /* key_area */ - { 0xc5, 0x1f, 0xc2, 0x76, 0x77, 0x4d, 0xad, 0x94, - 0xbc, 0xdc, 0x1d, 0x28, 0x91, 0xec, 0x86, 0x68 }, /* mdata */ - 16, /* mdata_len */ - { 0x40, 0xd1, 0x7f, 0x9a, 0x6f, 0x5b, 0xc6, 0xaf, - 0x34, 0x1e, 0x6a, 0xc5, 0xe4, 0x9e, 0x71, 0xad } /* mac */ - }, { - 1, /* key_size_index */ - 2, /* key_area */ - { 0xbe, 0x8a, 0xbf, 0x00, 0x90, 0x13, 0x63, 0x98, - 0x7a, 0x82, 0xcc, 0x77, 0xd0, 0xec, 0x91, 0x69, - 0x7b, 0xa3, 0x85, 0x7f, 0x9e, 0x4f, 0x84, 0xbd, - 0x79, 0x40, 0x6c, 0x13, 0x8d, 0x02, 0x69, 0x8f, - 0x00, 0x32, 0x76, 0xd0, 0x44, 0x91, 0x20, 0xbe, - 0xf4, 0x57, 0x8d, 0x78, 0xfe, 0xca, 0xbe, 0x8e, - 0x07, 0x0e, 0x11, 0x71, 0x0b, 0x3f, 0x0a, 0x27, - 0x44, 0xbd, 0x52, 0x43, 0x4e, 0xc7, 0x00, 0x15, - 0x88, 0x4c, 0x18, 0x1e, 0xbd, 0xfd, 0x51, 0xc6, - 0x04, 0xa7, 0x1c, 0x52, 0xe4, 0xc0, 0xe1, 0x10, - 0xbc, 0x40, 0x8c, 0xd4, 0x62, 0xb2, 0x48, 0xa8, - 0x0b, 0x8a, 0x8a, 0xc0, 0x6b, 0xb9, 0x52, 0xac, - 0x1d, 0x7f, 0xae, 0xd1, 0x44, 0x80, 0x7f, 0x1a, - 0x73, 0x1b, 0x7f, 0xeb, 0xca, 0xf7, 0x83, 0x57, - 0x62, 0xde, 0xfe, 0x92, 0xec, 0xcf, 0xc7, 0xa9, - 0x94, 0x4e, 0x1c, 0x70, 0x2c, 0xff, 0xe6, 0xbc, - 0x86, 0x73, 0x3e, 0xd3, 0x21, 0x42, 0x31, 0x21, - 0x08, 0x5a, 0xc0, 0x2d, 0xf8, 0x96, 0x2b, 0xcb, - 0xc1, 0x93, 0x70, 0x92, 0xee, 0xbf, 0x0e, 0x90, - 0xa8, 0xb2, 0x0e, 0x3d, 0xd8, 0xc2, 0x44, 0xae }, /* mdata */ - 160, /* mdata_len */ - { 0xea, 0x57, 0x08, 0xb7, 0x8b, 0xf0, 0x51, 0xd6, - 0x94, 0xeb, 0x37, 0x01, 0xca, 0x6b, 0xd5, 0x7b } /* mac */ - }, { - 1, /* key_size_index */ - 4, /* key_area */ - { 0x39, 0xa9, 0xb4, 0x2d, 0xe1, 0x9e, 0x51, 0x2a, - 0xb7, 0xf3, 0x04, 0x35, 0x64, 0xc3, 0x51, 0x5a }, /* mdata */ - 16, /* mdata_len */ - { 0xa8, 0xd9, 0x3d, 0x9e, 0x1c, 0x14, 0xe4, 0x1e, - 0xa3, 0xf0, 0xaa, 0x50, 0xa4, 0xa3, 0x26, 0x09 } /* mac */ - }, { - 1, /* key_size_index */ - 6, /* key_area */ - { 0x69, 0x28, 0x29, 0x9c, 0x52, 0xb4, 0xf0, 0x47, - 0x92, 0x6f, 0x8a, 0x54, 0x15, 0x29, 0xda, 0x2d, - 0x6b, 0xba, 0xa3, 0x99, 0x14, 0x3c, 0xed, 0x8e, - 0xfb, 0x77, 0xab, 0x47, 0x40, 0x9d, 0x9a, 0x95, - 0x3a, 0x38, 0x6c, 0x7a, 0xbd, 0x60, 0x26, 0xf4, - 0x98, 0x31, 0xc7, 0x17, 0x62, 0x7c, 0x2a, 0x5e, - 0x77, 0xbd, 0x2d, 0x43, 0x3d, 0x4d, 0x13, 0x0d, - 0xac, 0xd9, 0x27, 0xea, 0x0d, 0x13, 0xa2, 0x3d, - 0x01, 0xa7, 0xcf, 0x39, 0xc6, 0x71, 0x6d, 0xaf, - 0xb6, 0xed, 0x55, 0x24, 0x10, 0xef, 0x5d, 0x27, - 0xfb, 0x94, 0x7b, 0xe2, 0xc8, 0x78, 0x2e, 0xee, - 0x78, 0x29, 0x19, 0x6c, 0x7e, 0xdc, 0xf1, 0x51, - 0xc6, 0x5f, 0x9a, 0x01, 0xf5, 0x4f, 0x8d, 0x20, - 0xf3, 0x8b, 0x7d, 0xa4, 0xa7, 0xe8, 0x3a, 0x2f, - 0x01, 0x27, 0xd5, 0x9d, 0x3e, 0x24, 0x05, 0xd8, - 0x67, 0x4f, 0xc9, 0xf4, 0x1b, 0x60, 0x4f, 0x78, - 0x8f, 0x47, 0x15, 0xf9, 0xd3, 0x62, 0x4e, 0xee, - 0x57, 0xf3, 0x87, 0xbf, 0xad, 0xd1, 0x8a, 0x1f, - 0x90, 0x5e, 0x83, 0x9c, 0x26, 0xb8, 0x61, 0x74, - 0x82, 0x34, 0x7f, 0xab, 0x6d, 0x08, 0x84, 0x5a }, /* mdata */ - 160, /* mdata_len */ - { 0x69, 0x27, 0xe7, 0xfb, 0x4c, 0xb9, 0x9d, 0x9c, - 0x54, 0xe2, 0x7f, 0x1c, 0x76, 0x20, 0xa0, 0x07 } /* mac */ - }, { - 2, /* key_size_index */ - 0, /* key_area */ - { 0x62, 0x82, 0xb8, 0xc0, 0x5c, 0x5c, 0x15, 0x30, - 0xb9, 0x7d, 0x48, 0x16, 0xca, 0x43, 0x47, 0x62 }, /* mdata */ - 16, /* mdata_len */ - { 0xa1, 0x07, 0x61, 0x82, 0xc1, 0xf4, 0x33, 0xc3, - 0xda, 0xfb, 0xe1, 0x1d, 0x3e, 0x71, 0xdd, 0x8a } /* mac */ - }, { - 2, /* key_size_index */ - 2, /* key_area */ - { 0x0c, 0x63, 0xd4, 0x13, 0xd3, 0x86, 0x45, 0x70, - 0xe7, 0x0b, 0xb6, 0x61, 0x8b, 0xf8, 0xa4, 0xb9, - 0x58, 0x55, 0x86, 0x68, 0x8c, 0x32, 0xbb, 0xa0, - 0xa5, 0xec, 0xc1, 0x36, 0x2f, 0xad, 0xa7, 0x4a, - 0xda, 0x32, 0xc5, 0x2a, 0xcf, 0xd1, 0xaa, 0x74, - 0x44, 0xba, 0x56, 0x7b, 0x4e, 0x7d, 0xaa, 0xec, - 0xf7, 0xcc, 0x1c, 0xb2, 0x91, 0x82, 0xaf, 0x16, - 0x4a, 0xe5, 0x23, 0x2b, 0x00, 0x28, 0x68, 0x69, - 0x56, 0x35, 0x59, 0x98, 0x07, 0xa9, 0xa7, 0xf0, - 0x7a, 0x1f, 0x13, 0x7e, 0x97, 0xb1, 0xe1, 0xc9, - 0xda, 0xbc, 0x89, 0xb6, 0xa5, 0xe4, 0xaf, 0xa9, - 0xdb, 0x58, 0x55, 0xed, 0xaa, 0x57, 0x50, 0x56, - 0xa8, 0xf4, 0xf8, 0x24, 0x22, 0x16, 0x24, 0x2b, - 0xb0, 0xc2, 0x56, 0x31, 0x0d, 0x9d, 0x32, 0x98, - 0x26, 0xac, 0x35, 0x3d, 0x71, 0x5f, 0xa3, 0x9f, - 0x80, 0xce, 0xc1, 0x44, 0xd6, 0x42, 0x45, 0x58, - 0xf9, 0xf7, 0x0b, 0x98, 0xc9, 0x20, 0x09, 0x6e, - 0x0f, 0x2c, 0x85, 0x5d, 0x59, 0x48, 0x85, 0xa0, - 0x06, 0x25, 0x88, 0x0e, 0x9d, 0xfb, 0x73, 0x41, - 0x63, 0xce, 0xce, 0xf7, 0x2c, 0xf0, 0x30, 0xb8 }, /* mdata */ - 160, /* mdata_len */ - { 0xf2, 0xb7, 0x45, 0x13, 0xd6, 0xcf, 0x2d, 0x80, - 0xe6, 0x72, 0xb8, 0x37, 0x45, 0xfa, 0xdc, 0x0f } /* mac */ - }, { - 2, /* key_size_index */ - 4, /* key_area */ - { 0xd5, 0x1d, 0x19, 0xde, 0xd5, 0xca, 0x4a, 0xe1, - 0x4b, 0x2b, 0x20, 0xb0, 0x27, 0xff, 0xb0, 0x20 }, /* mdata */ - 16, /* mdata_len */ - { 0xb0, 0x52, 0xa1, 0xdf, 0xe6, 0xa4, 0x8e, 0x63, - 0x43, 0x23, 0xdc, 0xaa, 0x85, 0xfa, 0xda, 0x3c } /* mac */ - }, { - 2, /* key_size_index */ - 6, /* key_area */ - { 0x5b, 0x97, 0xa9, 0xd4, 0x23, 0xf4, 0xb9, 0x74, - 0x13, 0xf3, 0x88, 0xd9, 0xa3, 0x41, 0xe7, 0x27, - 0xbb, 0x33, 0x9f, 0x8e, 0x18, 0xa3, 0xfa, 0xc2, - 0xf2, 0xfb, 0x85, 0xab, 0xdc, 0x8f, 0x13, 0x5d, - 0xeb, 0x30, 0x05, 0x4a, 0x1a, 0xfd, 0xc9, 0xb6, - 0xed, 0x7d, 0xa1, 0x6c, 0x55, 0xeb, 0xa6, 0xb0, - 0xd4, 0xd1, 0x0c, 0x74, 0xe1, 0xd9, 0xa7, 0xcf, - 0x8e, 0xdf, 0xae, 0xaa, 0x68, 0x4a, 0xc0, 0xbd, - 0x9f, 0x9d, 0x24, 0xba, 0x67, 0x49, 0x55, 0xc7, - 0x9d, 0xc6, 0xbe, 0x32, 0xae, 0xe1, 0xc2, 0x60, - 0xb5, 0x58, 0xff, 0x07, 0xe3, 0xa4, 0xd4, 0x9d, - 0x24, 0x16, 0x20, 0x11, 0xff, 0x25, 0x4d, 0xb8, - 0xbe, 0x07, 0x8e, 0x8a, 0xd0, 0x7e, 0x64, 0x8e, - 0x6b, 0xf5, 0x67, 0x93, 0x76, 0xcb, 0x43, 0x21, - 0xa5, 0xef, 0x01, 0xaf, 0xe6, 0xad, 0x88, 0x16, - 0xfc, 0xc7, 0x63, 0x46, 0x69, 0xc8, 0xc4, 0x38, - 0x92, 0x95, 0xc9, 0x24, 0x1e, 0x45, 0xff, 0xf3, - 0x9f, 0x32, 0x25, 0xf7, 0x74, 0x50, 0x32, 0xda, - 0xee, 0xbe, 0x99, 0xd4, 0xb1, 0x9b, 0xcb, 0x21, - 0x5d, 0x1b, 0xfd, 0xb3, 0x6e, 0xda, 0x2c, 0x24 }, /* mdata */ - 160, /* mdata_len */ - { 0xc9, 0xa0, 0x14, 0x60, 0xaa, 0x2f, 0x85, 0x25, - 0x88, 0x75, 0xa1, 0x76, 0xcc, 0x85, 0x46, 0xf9 } /* mac */ - } - }; - static uint8_t mdata[MDATA_MAX_LEN]; - static uint8_t mac[CBC_MAC_MAC_LEN]; - static int i; - static uint8_t key_size_index = -1, ret; - static rtimer_clock_t time, time2, total_time; - - PROCESS_BEGIN(); - - puts("-----------------------------------------\n" - "Initializing cryptoprocessor..."); - crypto_init(); - - for(i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) { - if(key_size_index != vectors[i].key_size_index) { - key_size_index = vectors[i].key_size_index; - printf("-----------------------------------------\n" - "Filling %d-bit key store...\n", 128 + (key_size_index << 6)); - time = RTIMER_NOW(); - ret = aes_load_keys(keys[key_size_index].keys, - keys[key_size_index].key_size, keys[key_size_index].count, 0); - time = RTIMER_NOW() - time; - printf("aes_load_keys(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - break; - } - } - - printf("-----------------------------------------\n" - "Test vector #%d:\n" - "key_area=%d mdata_len=%d\n", - i, vectors[i].key_area, vectors[i].mdata_len); - - /* mdata has to be in SRAM. */ - rom_util_memcpy(mdata, vectors[i].mdata, vectors[i].mdata_len); - - time = RTIMER_NOW(); - ret = cbc_mac_auth_start(vectors[i].key_area, mdata, vectors[i].mdata_len, - &cbc_mac_test_process); - time2 = RTIMER_NOW(); - time = time2 - time; - total_time = time; - if(ret == CRYPTO_SUCCESS) { - PROCESS_WAIT_EVENT_UNTIL(cbc_mac_auth_check_status()); - time2 = RTIMER_NOW() - time2; - total_time += time2; - } - printf("cbc_mac_auth_start(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - if(ret != CRYPTO_SUCCESS) { - PROCESS_PAUSE(); - continue; - } - printf("cbc_mac_auth_check_status() wait: %lu us\n", - (uint32_t)((uint64_t)time2 * 1000000 / RTIMER_SECOND)); - - time = RTIMER_NOW(); - ret = cbc_mac_auth_get_result(vectors[i].mac, mac); - time = RTIMER_NOW() - time; - total_time += time; - printf("cbc_mac_auth_get_result(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - continue; - } - - if(rom_util_memcmp(mac, vectors[i].mac, CBC_MAC_MAC_LEN)) { - puts("MAC does not match expected one"); - } else { - puts("MAC OK"); - } - - printf("Total duration: %lu us\n", - (uint32_t)((uint64_t)total_time * 1000000 / RTIMER_SECOND)); - } - - puts("-----------------------------------------\n" - "Disabling cryptoprocessor..."); - crypto_disable(); - - puts("Done!"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/crypto/cbc-test.c b/examples/platform-specific/cc2538-common/crypto/cbc-test.c deleted file mode 100644 index 108b6a775..000000000 --- a/examples/platform-specific/cc2538-common/crypto/cbc-test.c +++ /dev/null @@ -1,696 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-cbc-test cc2538 AES-CBC Test Project - * - * AES-CBC access example for CC2538-based platforms - * - * This example shows how AES-CBC should be used. The example also verifies - * the AES-CBC functionality. - * - * @{ - * - * \file - * Example demonstrating AES-CBC - */ -#include "contiki.h" -#include "sys/rtimer.h" -#include "dev/rom-util.h" -#include "dev/cbc.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define MDATA_MAX_LEN 160 -/*---------------------------------------------------------------------------*/ -PROCESS(cbc_test_process, "cbc test process"); -AUTOSTART_PROCESSES(&cbc_test_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cbc_test_process, ev, data) -{ - static const char *const str_res[] = { - "success", - "invalid param", - "NULL error", - "resource in use", - "DMA bus error", - "keystore read error", - "keystore write error", - "authentication failed" - }; - static const uint8_t keys128[][128 / 8] = { - { 0x1f, 0x8e, 0x49, 0x73, 0x95, 0x3f, 0x3f, 0xb0, - 0xbd, 0x6b, 0x16, 0x66, 0x2e, 0x9a, 0x3c, 0x17 }, - { 0xb7, 0xf3, 0xc9, 0x57, 0x6e, 0x12, 0xdd, 0x0d, - 0xb6, 0x3e, 0x8f, 0x8f, 0xac, 0x2b, 0x9a, 0x39 }, - { 0x89, 0xa5, 0x53, 0x73, 0x04, 0x33, 0xf7, 0xe6, - 0xd6, 0x7d, 0x16, 0xd3, 0x73, 0xbd, 0x53, 0x60 }, - { 0x2c, 0x14, 0x41, 0x37, 0x51, 0xc3, 0x1e, 0x27, - 0x30, 0x57, 0x0b, 0xa3, 0x36, 0x1c, 0x78, 0x6b }, - { 0x6a, 0x70, 0x82, 0xcf, 0x8c, 0xda, 0x13, 0xef, - 0xf4, 0x8c, 0x81, 0x58, 0xdd, 0xa2, 0x06, 0xae }, - { 0x7b, 0x1a, 0xb9, 0x14, 0x4b, 0x02, 0x39, 0x31, - 0x5c, 0xd5, 0xee, 0xc6, 0xc7, 0x56, 0x63, 0xbd }, - { 0xba, 0xb0, 0xcc, 0xed, 0xdc, 0x0a, 0xbd, 0x63, - 0xe3, 0xf8, 0x2e, 0x9f, 0xbf, 0xf7, 0xb8, 0xaa }, - { 0x97, 0xa1, 0x02, 0x55, 0x29, 0xb9, 0x92, 0x5e, - 0x25, 0xbb, 0xe7, 0x87, 0x70, 0xca, 0x2f, 0x99 } - }; - static const uint8_t keys192[][192 / 8] = { - { 0xba, 0x75, 0xf4, 0xd1, 0xd9, 0xd7, 0xcf, 0x7f, - 0x55, 0x14, 0x45, 0xd5, 0x6c, 0xc1, 0xa8, 0xab, - 0x2a, 0x07, 0x8e, 0x15, 0xe0, 0x49, 0xdc, 0x2c }, - { 0x16, 0x2a, 0xd5, 0x0e, 0xe6, 0x4a, 0x07, 0x02, - 0xaa, 0x55, 0x1f, 0x57, 0x1d, 0xed, 0xc1, 0x6b, - 0x2c, 0x1b, 0x6a, 0x1e, 0x4d, 0x4b, 0x5e, 0xee }, - { 0x8e, 0x27, 0x40, 0xfb, 0xa1, 0x57, 0xae, 0xf2, - 0x42, 0x2e, 0x44, 0x23, 0x12, 0xd1, 0x5c, 0x14, - 0xd3, 0x12, 0x55, 0x36, 0x84, 0xfc, 0xdc, 0x15 }, - { 0x50, 0x9b, 0xaf, 0x46, 0xfb, 0x9d, 0xe3, 0x42, - 0x81, 0xda, 0xfc, 0xc3, 0xdb, 0x79, 0x59, 0x3b, - 0xff, 0xa8, 0x42, 0x69, 0x04, 0x30, 0x26, 0x88 } - }; - static const uint8_t keys256[][256 / 8] = { - { 0x6e, 0xd7, 0x6d, 0x2d, 0x97, 0xc6, 0x9f, 0xd1, - 0x33, 0x95, 0x89, 0x52, 0x39, 0x31, 0xf2, 0xa6, - 0xcf, 0xf5, 0x54, 0xb1, 0x5f, 0x73, 0x8f, 0x21, - 0xec, 0x72, 0xdd, 0x97, 0xa7, 0x33, 0x09, 0x07 }, - { 0x48, 0xbe, 0x59, 0x7e, 0x63, 0x2c, 0x16, 0x77, - 0x23, 0x24, 0xc8, 0xd3, 0xfa, 0x1d, 0x9c, 0x5a, - 0x9e, 0xcd, 0x01, 0x0f, 0x14, 0xec, 0x5d, 0x11, - 0x0d, 0x3b, 0xfe, 0xc3, 0x76, 0xc5, 0x53, 0x2b }, - { 0x43, 0xe9, 0x53, 0xb2, 0xae, 0xa0, 0x8a, 0x3a, - 0xd5, 0x2d, 0x18, 0x2f, 0x58, 0xc7, 0x2b, 0x9c, - 0x60, 0xfb, 0xe4, 0xa9, 0xca, 0x46, 0xa3, 0xcb, - 0x89, 0xe3, 0x86, 0x38, 0x45, 0xe2, 0x2c, 0x9e }, - { 0x87, 0x72, 0x5b, 0xd4, 0x3a, 0x45, 0x60, 0x88, - 0x14, 0x18, 0x07, 0x73, 0xf0, 0xe7, 0xab, 0x95, - 0xa3, 0xc8, 0x59, 0xd8, 0x3a, 0x21, 0x30, 0xe8, - 0x84, 0x19, 0x0e, 0x44, 0xd1, 0x4c, 0x69, 0x96 } - }; - static const struct { - const void *keys; - uint8_t key_size; - uint8_t count; - } keys[] = { - { keys128, AES_KEY_STORE_SIZE_KEY_SIZE_128, - sizeof(keys128) / sizeof(keys128[0]) }, - { keys192, AES_KEY_STORE_SIZE_KEY_SIZE_192, - sizeof(keys192) / sizeof(keys192[0]) }, - { keys256, AES_KEY_STORE_SIZE_KEY_SIZE_256, - sizeof(keys256) / sizeof(keys256[0]) } - }; - static const struct { - bool encrypt; - uint8_t key_size_index; - uint8_t key_area; - uint8_t iv[CBC_IV_LEN]; - uint8_t mdata[MDATA_MAX_LEN]; - uint16_t mdata_len; - uint8_t expected[MDATA_MAX_LEN]; - } vectors[] = { - { - true, /* encrypt */ - 0, /* key_size_index */ - 0, /* key_area */ - { 0x2f, 0xe2, 0xb3, 0x33, 0xce, 0xda, 0x8f, 0x98, - 0xf4, 0xa9, 0x9b, 0x40, 0xd2, 0xcd, 0x34, 0xa8 }, /* iv */ - { 0x45, 0xcf, 0x12, 0x96, 0x4f, 0xc8, 0x24, 0xab, - 0x76, 0x61, 0x6a, 0xe2, 0xf4, 0xbf, 0x08, 0x22 }, /* mdata */ - 16, /* mdata_len */ - { 0x0f, 0x61, 0xc4, 0xd4, 0x4c, 0x51, 0x47, 0xc0, - 0x3c, 0x19, 0x5a, 0xd7, 0xe2, 0xcc, 0x12, 0xb2 } /* expected */ - }, { - true, /* encrypt */ - 0, /* key_size_index */ - 1, /* key_area */ - { 0xc8, 0x0f, 0x09, 0x5d, 0x8b, 0xb1, 0xa0, 0x60, - 0x69, 0x9f, 0x7c, 0x19, 0x97, 0x4a, 0x1a, 0xa0 }, /* iv */ - { 0x9a, 0xc1, 0x99, 0x54, 0xce, 0x13, 0x19, 0xb3, - 0x54, 0xd3, 0x22, 0x04, 0x60, 0xf7, 0x1c, 0x1e, - 0x37, 0x3f, 0x1c, 0xd3, 0x36, 0x24, 0x08, 0x81, - 0x16, 0x0c, 0xfd, 0xe4, 0x6e, 0xbf, 0xed, 0x2e, - 0x79, 0x1e, 0x8d, 0x5a, 0x1a, 0x13, 0x6e, 0xbd, - 0x1d, 0xc4, 0x69, 0xde, 0xc0, 0x0c, 0x41, 0x87, - 0x72, 0x2b, 0x84, 0x1c, 0xda, 0xbc, 0xb2, 0x2c, - 0x1b, 0xe8, 0xa1, 0x46, 0x57, 0xda, 0x20, 0x0e }, /* mdata */ - 64, /* mdata_len */ - { 0x19, 0xb9, 0x60, 0x97, 0x72, 0xc6, 0x3f, 0x33, - 0x86, 0x08, 0xbf, 0x6e, 0xb5, 0x2c, 0xa1, 0x0b, - 0xe6, 0x50, 0x97, 0xf8, 0x9c, 0x1e, 0x09, 0x05, - 0xc4, 0x24, 0x01, 0xfd, 0x47, 0x79, 0x1a, 0xe2, - 0xc5, 0x44, 0x0b, 0x2d, 0x47, 0x31, 0x16, 0xca, - 0x78, 0xbd, 0x9f, 0xf2, 0xfb, 0x60, 0x15, 0xcf, - 0xd3, 0x16, 0x52, 0x4e, 0xae, 0x7d, 0xcb, 0x95, - 0xae, 0x73, 0x8e, 0xbe, 0xae, 0x84, 0xa4, 0x67 } /* expected */ - }, { - true, /* encrypt */ - 0, /* key_size_index */ - 2, /* key_area */ - { 0xf7, 0x24, 0x55, 0x8d, 0xb3, 0x43, 0x3a, 0x52, - 0x3f, 0x4e, 0x51, 0xa5, 0xbe, 0xa7, 0x04, 0x97 }, /* iv */ - { 0x80, 0x7b, 0xc4, 0xea, 0x68, 0x4e, 0xed, 0xcf, - 0xdc, 0xca, 0x30, 0x18, 0x06, 0x80, 0xb0, 0xf1, - 0xae, 0x28, 0x14, 0xf3, 0x5f, 0x36, 0xd0, 0x53, - 0xc5, 0xae, 0xa6, 0x59, 0x5a, 0x38, 0x6c, 0x14, - 0x42, 0x77, 0x0f, 0x4d, 0x72, 0x97, 0xd8, 0xb9, - 0x18, 0x25, 0xee, 0x72, 0x37, 0x24, 0x1d, 0xa8, - 0x92, 0x5d, 0xd5, 0x94, 0xcc, 0xf6, 0x76, 0xae, - 0xcd, 0x46, 0xca, 0x20, 0x68, 0xe8, 0xd3, 0x7a, - 0x3a, 0x0e, 0xc8, 0xa7, 0xd5, 0x18, 0x5a, 0x20, - 0x1e, 0x66, 0x3b, 0x5f, 0xf3, 0x6a, 0xe1, 0x97, - 0x11, 0x01, 0x88, 0xa2, 0x35, 0x03, 0x76, 0x3b, - 0x82, 0x18, 0x82, 0x6d, 0x23, 0xce, 0xd7, 0x4b, - 0x31, 0xe9, 0xf6, 0xe2, 0xd7, 0xfb, 0xfa, 0x6c, - 0xb4, 0x34, 0x20, 0xc7, 0x80, 0x7a, 0x86, 0x25 }, /* mdata */ - 112, /* mdata_len */ - { 0x40, 0x6a, 0xf1, 0x42, 0x9a, 0x47, 0x8c, 0x3d, - 0x07, 0xe5, 0x55, 0xc5, 0x28, 0x7a, 0x60, 0x50, - 0x0d, 0x37, 0xfc, 0x39, 0xb6, 0x8e, 0x5b, 0xbb, - 0x9b, 0xaf, 0xd6, 0xdd, 0xb2, 0x23, 0x82, 0x85, - 0x61, 0xd6, 0x17, 0x1a, 0x30, 0x8d, 0x5b, 0x1a, - 0x45, 0x51, 0xe8, 0xa5, 0xe7, 0xd5, 0x72, 0x91, - 0x8d, 0x25, 0xc9, 0x68, 0xd3, 0x87, 0x18, 0x48, - 0xd2, 0xf1, 0x66, 0x35, 0xca, 0xa9, 0x84, 0x7f, - 0x38, 0x59, 0x0b, 0x1d, 0xf5, 0x8a, 0xb5, 0xef, - 0xb9, 0x85, 0xf2, 0xc6, 0x6c, 0xfa, 0xf8, 0x6f, - 0x61, 0xb3, 0xf9, 0xc0, 0xaf, 0xad, 0x6c, 0x96, - 0x3c, 0x49, 0xce, 0xe9, 0xb8, 0xbc, 0x81, 0xa2, - 0xdd, 0xb0, 0x6c, 0x96, 0x7f, 0x32, 0x55, 0x15, - 0xa4, 0x84, 0x9e, 0xec, 0x37, 0xce, 0x72, 0x1a } /* expected */ - }, { - true, /* encrypt */ - 0, /* key_size_index */ - 3, /* key_area */ - { 0x1d, 0xbb, 0xeb, 0x2f, 0x19, 0xab, 0xb4, 0x48, - 0xaf, 0x84, 0x97, 0x96, 0x24, 0x4a, 0x19, 0xd7 }, /* iv */ - { 0x40, 0xd9, 0x30, 0xf9, 0xa0, 0x53, 0x34, 0xd9, - 0x81, 0x6f, 0xe2, 0x04, 0x99, 0x9c, 0x3f, 0x82, - 0xa0, 0x3f, 0x6a, 0x04, 0x57, 0xa8, 0xc4, 0x75, - 0xc9, 0x45, 0x53, 0xd1, 0xd1, 0x16, 0x69, 0x3a, - 0xdc, 0x61, 0x80, 0x49, 0xf0, 0xa7, 0x69, 0xa2, - 0xee, 0xd6, 0xa6, 0xcb, 0x14, 0xc0, 0x14, 0x3e, - 0xc5, 0xcc, 0xcd, 0xbc, 0x8d, 0xec, 0x4c, 0xe5, - 0x60, 0xcf, 0xd2, 0x06, 0x22, 0x57, 0x09, 0x32, - 0x6d, 0x4d, 0xe7, 0x94, 0x8e, 0x54, 0xd6, 0x03, - 0xd0, 0x1b, 0x12, 0xd7, 0xfe, 0xd7, 0x52, 0xfb, - 0x23, 0xf1, 0xaa, 0x44, 0x94, 0xfb, 0xb0, 0x01, - 0x30, 0xe9, 0xde, 0xd4, 0xe7, 0x7e, 0x37, 0xc0, - 0x79, 0x04, 0x2d, 0x82, 0x80, 0x40, 0xc3, 0x25, - 0xb1, 0xa5, 0xef, 0xd1, 0x5f, 0xc8, 0x42, 0xe4, - 0x40, 0x14, 0xca, 0x43, 0x74, 0xbf, 0x38, 0xf3, - 0xc3, 0xfc, 0x3e, 0xe3, 0x27, 0x73, 0x3b, 0x0c, - 0x8a, 0xee, 0x1a, 0xbc, 0xd0, 0x55, 0x77, 0x2f, - 0x18, 0xdc, 0x04, 0x60, 0x3f, 0x7b, 0x2c, 0x1e, - 0xa6, 0x9f, 0xf6, 0x62, 0x36, 0x1f, 0x2b, 0xe0, - 0xa1, 0x71, 0xbb, 0xdc, 0xea, 0x1e, 0x5d, 0x3f }, /* mdata */ - 160, /* mdata_len */ - { 0x6b, 0xe8, 0xa1, 0x28, 0x00, 0x45, 0x5a, 0x32, - 0x05, 0x38, 0x85, 0x3e, 0x0c, 0xba, 0x31, 0xbd, - 0x2d, 0x80, 0xea, 0x0c, 0x85, 0x16, 0x4a, 0x4c, - 0x5c, 0x26, 0x1a, 0xe4, 0x85, 0x41, 0x7d, 0x93, - 0xef, 0xfe, 0x2e, 0xbc, 0x0d, 0x0a, 0x0b, 0x51, - 0xd6, 0xea, 0x18, 0x63, 0x3d, 0x21, 0x0c, 0xf6, - 0x3c, 0x0c, 0x4d, 0xdb, 0xc2, 0x76, 0x07, 0xf2, - 0xe8, 0x1e, 0xd9, 0x11, 0x31, 0x91, 0xef, 0x86, - 0xd5, 0x6f, 0x3b, 0x99, 0xbe, 0x6c, 0x41, 0x5a, - 0x41, 0x50, 0x29, 0x9f, 0xb8, 0x46, 0xce, 0x71, - 0x60, 0xb4, 0x0b, 0x63, 0xba, 0xf1, 0x17, 0x9d, - 0x19, 0x27, 0x5a, 0x2e, 0x83, 0x69, 0x83, 0x76, - 0xd2, 0x8b, 0x92, 0x54, 0x8c, 0x68, 0xe0, 0x6e, - 0x6d, 0x99, 0x4e, 0x2c, 0x15, 0x01, 0xed, 0x29, - 0x70, 0x14, 0xe7, 0x02, 0xcd, 0xef, 0xee, 0x2f, - 0x65, 0x64, 0x47, 0x70, 0x60, 0x09, 0x61, 0x4d, - 0x80, 0x1d, 0xe1, 0xca, 0xaf, 0x73, 0xf8, 0xb7, - 0xfa, 0x56, 0xcf, 0x1b, 0xa9, 0x4b, 0x63, 0x19, - 0x33, 0xbb, 0xe5, 0x77, 0x62, 0x43, 0x80, 0x85, - 0x0f, 0x11, 0x74, 0x35, 0xa0, 0x35, 0x5b, 0x2b } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 4, /* key_area */ - { 0xbd, 0x41, 0x72, 0x93, 0x40, 0x78, 0xc2, 0x01, - 0x1c, 0xb1, 0xf3, 0x1c, 0xff, 0xaf, 0x48, 0x6e }, /* iv */ - { 0xf8, 0xeb, 0x31, 0xb3, 0x1e, 0x37, 0x4e, 0x96, - 0x00, 0x30, 0xcd, 0x1c, 0xad, 0xb0, 0xef, 0x0c }, /* mdata */ - 16, /* mdata_len */ - { 0x94, 0x0b, 0xc7, 0x6d, 0x61, 0xe2, 0xc4, 0x9d, - 0xdd, 0xd5, 0xdf, 0x7f, 0x37, 0xfc, 0xf1, 0x05 } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 5, /* key_area */ - { 0x0b, 0x1e, 0x74, 0xf4, 0x5c, 0x17, 0xff, 0x30, - 0x4d, 0x99, 0xc0, 0x59, 0xce, 0x5c, 0xde, 0x09 }, /* iv */ - { 0xd3, 0xf8, 0x9b, 0x71, 0xe0, 0x33, 0x07, 0x0f, - 0x9d, 0x75, 0x16, 0xa6, 0xcb, 0x4e, 0xa5, 0xef, - 0x51, 0xd6, 0xfb, 0x63, 0xd4, 0xf0, 0xfe, 0xa0, - 0x89, 0xd0, 0xa6, 0x0e, 0x47, 0xbb, 0xb3, 0xc2, - 0xe1, 0x0e, 0x9b, 0xa3, 0xb2, 0x82, 0xc7, 0xcb, - 0x79, 0xae, 0xfe, 0x30, 0x68, 0xce, 0x22, 0x83, - 0x77, 0xc2, 0x1a, 0x58, 0xfe, 0x5a, 0x0f, 0x88, - 0x83, 0xd0, 0xdb, 0xd3, 0xd0, 0x96, 0xbe, 0xca }, /* mdata */ - 64, /* mdata_len */ - { 0xb9, 0x68, 0xae, 0xb1, 0x99, 0xad, 0x6b, 0x3c, - 0x8e, 0x01, 0xf2, 0x6c, 0x2e, 0xda, 0xd4, 0x44, - 0x53, 0x8c, 0x78, 0xbf, 0xa3, 0x6e, 0xd6, 0x8c, - 0xa7, 0x61, 0x23, 0xb8, 0xcd, 0xce, 0x61, 0x5a, - 0x01, 0xf6, 0x11, 0x2b, 0xb8, 0x0b, 0xfc, 0x3f, - 0x17, 0x49, 0x05, 0x78, 0xfb, 0x1f, 0x90, 0x9a, - 0x52, 0xe1, 0x62, 0x63, 0x7b, 0x06, 0x2d, 0xb0, - 0x4e, 0xfe, 0xe2, 0x91, 0xa1, 0xf1, 0xaf, 0x60 } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 6, /* key_area */ - { 0x68, 0xb9, 0x14, 0x0f, 0x30, 0x04, 0x90, 0xc5, - 0xc9, 0x42, 0xf6, 0x6e, 0x77, 0x7e, 0xb8, 0x06 }, /* iv */ - { 0xc6, 0x5b, 0x94, 0xb1, 0xf2, 0x91, 0xfa, 0x9f, - 0x06, 0x00, 0xf2, 0x2c, 0x3c, 0x04, 0x32, 0xc8, - 0x95, 0xad, 0x5d, 0x17, 0x7b, 0xcc, 0xcc, 0x9e, - 0xa4, 0x4e, 0x8e, 0xc3, 0x39, 0xc9, 0xad, 0xf4, - 0x38, 0x55, 0xb3, 0x26, 0x17, 0x9d, 0x6d, 0x81, - 0xaa, 0x36, 0xef, 0x59, 0x46, 0x2f, 0xd8, 0x61, - 0x27, 0xe9, 0xd8, 0x1b, 0x0f, 0x28, 0x6f, 0x93, - 0x30, 0x6b, 0xf7, 0x4d, 0x4c, 0x79, 0xe4, 0x7c, - 0x1b, 0x3d, 0x4b, 0x74, 0xed, 0xd3, 0xa1, 0x62, - 0x90, 0xe3, 0xc6, 0x3b, 0x74, 0x2e, 0x41, 0xf2, - 0x0d, 0x66, 0xce, 0xee, 0x79, 0x43, 0x16, 0xbb, - 0x63, 0xd3, 0xbd, 0x00, 0x27, 0x12, 0xa1, 0xb1, - 0x36, 0xba, 0x61, 0x85, 0xbd, 0x5c, 0x1d, 0xab, - 0x81, 0xb0, 0x7d, 0xb9, 0x0d, 0x2a, 0xf5, 0xe5 }, /* mdata */ - 112, /* mdata_len */ - { 0xc5, 0x58, 0x5f, 0xf2, 0x15, 0xbb, 0xb7, 0x3b, - 0xa5, 0x39, 0x34, 0x40, 0x85, 0x2f, 0xb1, 0x99, - 0x43, 0x6d, 0xe0, 0xd1, 0x5e, 0x55, 0xc6, 0x31, - 0xf8, 0x77, 0x67, 0x0a, 0xa3, 0xed, 0xa9, 0xf6, - 0x72, 0xeb, 0x1f, 0x87, 0x6f, 0x09, 0x54, 0x4e, - 0x63, 0x55, 0x84, 0x36, 0xb8, 0x92, 0x80, 0x00, - 0xdb, 0x2f, 0x02, 0xa5, 0xad, 0x90, 0xf9, 0x5b, - 0x05, 0xac, 0x4c, 0xf4, 0x9e, 0x19, 0x8e, 0x61, - 0x7e, 0x76, 0x78, 0x48, 0x0f, 0xdf, 0x0e, 0xfa, - 0xcc, 0x6a, 0xae, 0x69, 0x12, 0x71, 0xe6, 0xcd, - 0xd3, 0x54, 0x1e, 0xbf, 0x71, 0x9a, 0x1c, 0xca, - 0xed, 0xb2, 0x4e, 0x2f, 0x80, 0xf9, 0x24, 0x55, - 0xdd, 0x59, 0x10, 0xcb, 0x50, 0x86, 0xb0, 0x96, - 0x0a, 0x39, 0x42, 0xec, 0x18, 0x2d, 0xcb, 0xd7 } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 7, /* key_area */ - { 0xd4, 0xb4, 0xea, 0xb9, 0x2a, 0xa9, 0x63, 0x7e, - 0x87, 0xd3, 0x66, 0x38, 0x4e, 0xd6, 0x91, 0x5c }, /* iv */ - { 0x22, 0xcd, 0xc3, 0x30, 0x6f, 0xcd, 0x4d, 0x31, - 0xcc, 0xd3, 0x27, 0x20, 0xcb, 0xb6, 0x1b, 0xad, - 0x28, 0xd8, 0x55, 0x67, 0x06, 0x57, 0xc4, 0x8c, - 0x7b, 0x88, 0xc3, 0x1f, 0x4f, 0xa1, 0xf9, 0x3c, - 0x01, 0xb5, 0x7d, 0xa9, 0x0b, 0xe6, 0x3e, 0xad, - 0x67, 0xd6, 0xa3, 0x25, 0x52, 0x5e, 0x6e, 0xd4, - 0x50, 0x83, 0xe6, 0xfb, 0x70, 0xa5, 0x35, 0x29, - 0xd1, 0xfa, 0x0f, 0x55, 0x65, 0x3b, 0x94, 0x2a, - 0xf5, 0x9d, 0x78, 0xa2, 0x66, 0x03, 0x61, 0xd6, - 0x3a, 0x72, 0x90, 0x15, 0x5a, 0xc5, 0xc4, 0x33, - 0x12, 0xa2, 0x5b, 0x23, 0x5d, 0xac, 0xbb, 0xc8, - 0x63, 0xfa, 0xf0, 0x09, 0x40, 0xc9, 0x96, 0x24, - 0x07, 0x6d, 0xfa, 0x44, 0x06, 0x8e, 0x7c, 0x55, - 0x4c, 0x90, 0x38, 0x17, 0x69, 0x53, 0xe5, 0x71, - 0x75, 0x1d, 0xfc, 0x09, 0x54, 0xd4, 0x1d, 0x11, - 0x37, 0x71, 0xb0, 0x64, 0x66, 0xb1, 0xc8, 0xd1, - 0x3e, 0x0d, 0x4c, 0xb6, 0x75, 0xed, 0x58, 0xd1, - 0xa6, 0x19, 0xe1, 0x54, 0x09, 0x70, 0x98, 0x37, - 0x81, 0xdc, 0x11, 0xd2, 0xdd, 0x85, 0x25, 0xab, - 0x57, 0x45, 0x95, 0x8d, 0x61, 0x5d, 0xef, 0xda }, /* mdata */ - 160, /* mdata_len */ - { 0xe8, 0xb8, 0x91, 0x50, 0xd8, 0x43, 0x8b, 0xf5, - 0xb1, 0x74, 0x49, 0xd6, 0xed, 0x26, 0xbd, 0x72, - 0x12, 0x7e, 0x10, 0xe4, 0xaa, 0x57, 0xca, 0xd8, - 0x52, 0x83, 0xe8, 0x35, 0x9e, 0x08, 0x92, 0x08, - 0xe8, 0x49, 0x21, 0x64, 0x9f, 0x5b, 0x60, 0xea, - 0x21, 0xf7, 0x86, 0x7c, 0xbc, 0x96, 0x20, 0x56, - 0x0c, 0x4c, 0x62, 0x38, 0xdb, 0x02, 0x12, 0x16, - 0xdb, 0x45, 0x3c, 0x99, 0x43, 0xf1, 0xf1, 0xa6, - 0x05, 0x46, 0x17, 0x3d, 0xae, 0xf2, 0x55, 0x7c, - 0x3c, 0xdd, 0x85, 0x50, 0x31, 0xb3, 0x53, 0xd4, - 0xbf, 0x17, 0x6f, 0x28, 0x43, 0x9e, 0x48, 0x78, - 0x5c, 0x37, 0xd3, 0x8f, 0x27, 0x0a, 0xa4, 0xa6, - 0xfa, 0xad, 0x2b, 0xaa, 0xbc, 0xb0, 0xc0, 0xb2, - 0xd1, 0xdd, 0x53, 0x22, 0x93, 0x74, 0x98, 0xce, - 0x80, 0x3b, 0xa1, 0x14, 0x84, 0x40, 0xa5, 0x2e, - 0x22, 0x7d, 0xdb, 0xa4, 0x87, 0x2f, 0xe4, 0xd8, - 0x1d, 0x2d, 0x76, 0xa9, 0x39, 0xd2, 0x47, 0x55, - 0xad, 0xb8, 0xa7, 0xb8, 0x45, 0x2c, 0xee, 0xd2, - 0xd1, 0x79, 0xe1, 0xa5, 0x84, 0x8f, 0x31, 0x6f, - 0x5c, 0x01, 0x63, 0x00, 0xa3, 0x90, 0xbf, 0xa7 } /* expected */ - }, { - true, /* encrypt */ - 1, /* key_size_index */ - 0, /* key_area */ - { 0x53, 0x1c, 0xe7, 0x81, 0x76, 0x40, 0x16, 0x66, - 0xaa, 0x30, 0xdb, 0x94, 0xec, 0x4a, 0x30, 0xeb }, /* iv */ - { 0xc5, 0x1f, 0xc2, 0x76, 0x77, 0x4d, 0xad, 0x94, - 0xbc, 0xdc, 0x1d, 0x28, 0x91, 0xec, 0x86, 0x68 }, /* mdata */ - 16, /* mdata_len */ - { 0x70, 0xdd, 0x95, 0xa1, 0x4e, 0xe9, 0x75, 0xe2, - 0x39, 0xdf, 0x36, 0xff, 0x4a, 0xee, 0x1d, 0x5d } /* expected */ - }, { - true, /* encrypt */ - 1, /* key_size_index */ - 2, /* key_area */ - { 0x24, 0x40, 0x80, 0x38, 0x16, 0x1a, 0x2c, 0xca, - 0xe0, 0x7b, 0x02, 0x9b, 0xb6, 0x63, 0x55, 0xc1 }, /* iv */ - { 0xbe, 0x8a, 0xbf, 0x00, 0x90, 0x13, 0x63, 0x98, - 0x7a, 0x82, 0xcc, 0x77, 0xd0, 0xec, 0x91, 0x69, - 0x7b, 0xa3, 0x85, 0x7f, 0x9e, 0x4f, 0x84, 0xbd, - 0x79, 0x40, 0x6c, 0x13, 0x8d, 0x02, 0x69, 0x8f, - 0x00, 0x32, 0x76, 0xd0, 0x44, 0x91, 0x20, 0xbe, - 0xf4, 0x57, 0x8d, 0x78, 0xfe, 0xca, 0xbe, 0x8e, - 0x07, 0x0e, 0x11, 0x71, 0x0b, 0x3f, 0x0a, 0x27, - 0x44, 0xbd, 0x52, 0x43, 0x4e, 0xc7, 0x00, 0x15, - 0x88, 0x4c, 0x18, 0x1e, 0xbd, 0xfd, 0x51, 0xc6, - 0x04, 0xa7, 0x1c, 0x52, 0xe4, 0xc0, 0xe1, 0x10, - 0xbc, 0x40, 0x8c, 0xd4, 0x62, 0xb2, 0x48, 0xa8, - 0x0b, 0x8a, 0x8a, 0xc0, 0x6b, 0xb9, 0x52, 0xac, - 0x1d, 0x7f, 0xae, 0xd1, 0x44, 0x80, 0x7f, 0x1a, - 0x73, 0x1b, 0x7f, 0xeb, 0xca, 0xf7, 0x83, 0x57, - 0x62, 0xde, 0xfe, 0x92, 0xec, 0xcf, 0xc7, 0xa9, - 0x94, 0x4e, 0x1c, 0x70, 0x2c, 0xff, 0xe6, 0xbc, - 0x86, 0x73, 0x3e, 0xd3, 0x21, 0x42, 0x31, 0x21, - 0x08, 0x5a, 0xc0, 0x2d, 0xf8, 0x96, 0x2b, 0xcb, - 0xc1, 0x93, 0x70, 0x92, 0xee, 0xbf, 0x0e, 0x90, - 0xa8, 0xb2, 0x0e, 0x3d, 0xd8, 0xc2, 0x44, 0xae }, /* mdata */ - 160, /* mdata_len */ - { 0xc8, 0x2c, 0xf2, 0xc4, 0x76, 0xde, 0xa8, 0xcb, - 0x6a, 0x6e, 0x60, 0x7a, 0x40, 0xd2, 0xf0, 0x39, - 0x1b, 0xe8, 0x2e, 0xa9, 0xec, 0x84, 0xa5, 0x37, - 0xa6, 0x82, 0x0f, 0x9a, 0xfb, 0x99, 0x7b, 0x76, - 0x39, 0x7d, 0x00, 0x54, 0x24, 0xfa, 0xa6, 0xa7, - 0x4d, 0xc4, 0xe8, 0xc7, 0xaa, 0x4a, 0x89, 0x00, - 0x69, 0x0f, 0x89, 0x4b, 0x6d, 0x1d, 0xca, 0x80, - 0x67, 0x53, 0x93, 0xd2, 0x24, 0x3a, 0xda, 0xc7, - 0x62, 0xf1, 0x59, 0x30, 0x1e, 0x35, 0x7e, 0x98, - 0xb7, 0x24, 0x76, 0x23, 0x10, 0xcd, 0x5a, 0x7b, - 0xaf, 0xe1, 0xc2, 0xa0, 0x30, 0xdb, 0xa4, 0x6f, - 0xd9, 0x3a, 0x9f, 0xdb, 0x89, 0xcc, 0x13, 0x2c, - 0xa9, 0xc1, 0x7d, 0xc7, 0x20, 0x31, 0xec, 0x68, - 0x22, 0xee, 0x5a, 0x9d, 0x99, 0xdb, 0xca, 0x66, - 0xc7, 0x84, 0xc0, 0x1b, 0x08, 0x85, 0xcb, 0xb6, - 0x2e, 0x29, 0xd9, 0x78, 0x01, 0x92, 0x7e, 0xc4, - 0x15, 0xa5, 0xd2, 0x15, 0x15, 0x8d, 0x32, 0x5f, - 0x9e, 0xe6, 0x89, 0x43, 0x7a, 0xd1, 0xb7, 0x68, - 0x4a, 0xd3, 0x3c, 0x0d, 0x92, 0x73, 0x94, 0x51, - 0xac, 0x87, 0xf3, 0x9f, 0xf8, 0xc3, 0x1b, 0x84 } /* expected */ - }, { - false, /* encrypt */ - 1, /* key_size_index */ - 4, /* key_area */ - { 0x32, 0x40, 0x15, 0x87, 0x8c, 0xdc, 0x82, 0xbf, - 0xae, 0x59, 0xa2, 0xdc, 0x1f, 0xf3, 0x4e, 0xa6 }, /* iv */ - { 0x39, 0xa9, 0xb4, 0x2d, 0xe1, 0x9e, 0x51, 0x2a, - 0xb7, 0xf3, 0x04, 0x35, 0x64, 0xc3, 0x51, 0x5a }, /* mdata */ - 16, /* mdata_len */ - { 0xaa, 0x41, 0x17, 0x9d, 0x88, 0x0e, 0x6f, 0xe3, - 0xb1, 0x48, 0x18, 0xd6, 0xe4, 0xa6, 0x2e, 0xb5 } /* expected */ - }, { - false, /* encrypt */ - 1, /* key_size_index */ - 6, /* key_area */ - { 0xd6, 0xd8, 0x6e, 0x0c, 0x82, 0xdd, 0x87, 0x88, - 0xf4, 0x14, 0x7a, 0x26, 0xf9, 0xa7, 0x1c, 0x74 }, /* iv */ - { 0x69, 0x28, 0x29, 0x9c, 0x52, 0xb4, 0xf0, 0x47, - 0x92, 0x6f, 0x8a, 0x54, 0x15, 0x29, 0xda, 0x2d, - 0x6b, 0xba, 0xa3, 0x99, 0x14, 0x3c, 0xed, 0x8e, - 0xfb, 0x77, 0xab, 0x47, 0x40, 0x9d, 0x9a, 0x95, - 0x3a, 0x38, 0x6c, 0x7a, 0xbd, 0x60, 0x26, 0xf4, - 0x98, 0x31, 0xc7, 0x17, 0x62, 0x7c, 0x2a, 0x5e, - 0x77, 0xbd, 0x2d, 0x43, 0x3d, 0x4d, 0x13, 0x0d, - 0xac, 0xd9, 0x27, 0xea, 0x0d, 0x13, 0xa2, 0x3d, - 0x01, 0xa7, 0xcf, 0x39, 0xc6, 0x71, 0x6d, 0xaf, - 0xb6, 0xed, 0x55, 0x24, 0x10, 0xef, 0x5d, 0x27, - 0xfb, 0x94, 0x7b, 0xe2, 0xc8, 0x78, 0x2e, 0xee, - 0x78, 0x29, 0x19, 0x6c, 0x7e, 0xdc, 0xf1, 0x51, - 0xc6, 0x5f, 0x9a, 0x01, 0xf5, 0x4f, 0x8d, 0x20, - 0xf3, 0x8b, 0x7d, 0xa4, 0xa7, 0xe8, 0x3a, 0x2f, - 0x01, 0x27, 0xd5, 0x9d, 0x3e, 0x24, 0x05, 0xd8, - 0x67, 0x4f, 0xc9, 0xf4, 0x1b, 0x60, 0x4f, 0x78, - 0x8f, 0x47, 0x15, 0xf9, 0xd3, 0x62, 0x4e, 0xee, - 0x57, 0xf3, 0x87, 0xbf, 0xad, 0xd1, 0x8a, 0x1f, - 0x90, 0x5e, 0x83, 0x9c, 0x26, 0xb8, 0x61, 0x74, - 0x82, 0x34, 0x7f, 0xab, 0x6d, 0x08, 0x84, 0x5a }, /* mdata */ - 160, /* mdata_len */ - { 0x67, 0xd2, 0xdd, 0xa6, 0xda, 0x26, 0xe2, 0x13, - 0x07, 0x97, 0x34, 0x00, 0x60, 0x07, 0x25, 0x72, - 0x7a, 0xe8, 0x14, 0x15, 0x51, 0x17, 0x72, 0xf4, - 0xa0, 0x9a, 0xd9, 0x90, 0x3b, 0xcf, 0x90, 0xcc, - 0x2c, 0x0d, 0xac, 0x58, 0xba, 0x55, 0x9a, 0x01, - 0x09, 0xc5, 0x4a, 0x9d, 0x61, 0x17, 0xb1, 0x5b, - 0xb5, 0x74, 0xca, 0x47, 0x3e, 0x84, 0x80, 0x47, - 0xe9, 0xa5, 0x4e, 0xe4, 0xab, 0xde, 0x76, 0xaf, - 0xf9, 0x84, 0x9c, 0x44, 0x10, 0x9d, 0x16, 0x1f, - 0x46, 0x44, 0x2e, 0x16, 0x10, 0xd8, 0xb0, 0x15, - 0xcf, 0x36, 0xa0, 0x10, 0xed, 0x8e, 0xfa, 0x32, - 0x07, 0xfd, 0xfc, 0x8f, 0xcc, 0x54, 0x8f, 0x14, - 0x5c, 0x02, 0x7e, 0x44, 0xc5, 0xb0, 0xec, 0x35, - 0xc9, 0x88, 0x6f, 0x4b, 0x9d, 0x65, 0x13, 0xa5, - 0xbc, 0x10, 0xd0, 0xea, 0x6b, 0xbb, 0xc2, 0x6f, - 0x54, 0xb1, 0x83, 0xbc, 0xae, 0x27, 0xfb, 0x79, - 0x9d, 0x88, 0x72, 0xff, 0x74, 0x8f, 0xc4, 0x59, - 0xd5, 0x5c, 0xfa, 0x25, 0x5a, 0xae, 0x29, 0xd7, - 0x1b, 0x07, 0x6d, 0x9b, 0x44, 0xc1, 0x4d, 0x5c, - 0xeb, 0xa9, 0x33, 0x2a, 0x76, 0x3d, 0x9c, 0x94 } /* expected */ - }, { - true, /* encrypt */ - 2, /* key_size_index */ - 0, /* key_area */ - { 0x85, 0x1e, 0x87, 0x64, 0x77, 0x6e, 0x67, 0x96, - 0xaa, 0xb7, 0x22, 0xdb, 0xb6, 0x44, 0xac, 0xe8 }, /* iv */ - { 0x62, 0x82, 0xb8, 0xc0, 0x5c, 0x5c, 0x15, 0x30, - 0xb9, 0x7d, 0x48, 0x16, 0xca, 0x43, 0x47, 0x62 }, /* mdata */ - 16, /* mdata_len */ - { 0x6a, 0xcc, 0x04, 0x14, 0x2e, 0x10, 0x0a, 0x65, - 0xf5, 0x1b, 0x97, 0xad, 0xf5, 0x17, 0x2c, 0x41 } /* expected */ - }, { - true, /* encrypt */ - 2, /* key_size_index */ - 2, /* key_area */ - { 0xd6, 0xd5, 0x81, 0xb8, 0xcf, 0x04, 0xeb, 0xd3, - 0xb6, 0xea, 0xa1, 0xb5, 0x3f, 0x04, 0x7e, 0xe1 }, /* iv */ - { 0x0c, 0x63, 0xd4, 0x13, 0xd3, 0x86, 0x45, 0x70, - 0xe7, 0x0b, 0xb6, 0x61, 0x8b, 0xf8, 0xa4, 0xb9, - 0x58, 0x55, 0x86, 0x68, 0x8c, 0x32, 0xbb, 0xa0, - 0xa5, 0xec, 0xc1, 0x36, 0x2f, 0xad, 0xa7, 0x4a, - 0xda, 0x32, 0xc5, 0x2a, 0xcf, 0xd1, 0xaa, 0x74, - 0x44, 0xba, 0x56, 0x7b, 0x4e, 0x7d, 0xaa, 0xec, - 0xf7, 0xcc, 0x1c, 0xb2, 0x91, 0x82, 0xaf, 0x16, - 0x4a, 0xe5, 0x23, 0x2b, 0x00, 0x28, 0x68, 0x69, - 0x56, 0x35, 0x59, 0x98, 0x07, 0xa9, 0xa7, 0xf0, - 0x7a, 0x1f, 0x13, 0x7e, 0x97, 0xb1, 0xe1, 0xc9, - 0xda, 0xbc, 0x89, 0xb6, 0xa5, 0xe4, 0xaf, 0xa9, - 0xdb, 0x58, 0x55, 0xed, 0xaa, 0x57, 0x50, 0x56, - 0xa8, 0xf4, 0xf8, 0x24, 0x22, 0x16, 0x24, 0x2b, - 0xb0, 0xc2, 0x56, 0x31, 0x0d, 0x9d, 0x32, 0x98, - 0x26, 0xac, 0x35, 0x3d, 0x71, 0x5f, 0xa3, 0x9f, - 0x80, 0xce, 0xc1, 0x44, 0xd6, 0x42, 0x45, 0x58, - 0xf9, 0xf7, 0x0b, 0x98, 0xc9, 0x20, 0x09, 0x6e, - 0x0f, 0x2c, 0x85, 0x5d, 0x59, 0x48, 0x85, 0xa0, - 0x06, 0x25, 0x88, 0x0e, 0x9d, 0xfb, 0x73, 0x41, - 0x63, 0xce, 0xce, 0xf7, 0x2c, 0xf0, 0x30, 0xb8 }, /* mdata */ - 160, /* mdata_len */ - { 0xfc, 0x58, 0x73, 0xe5, 0x0d, 0xe8, 0xfa, 0xf4, - 0xc6, 0xb8, 0x4b, 0xa7, 0x07, 0xb0, 0x85, 0x4e, - 0x9d, 0xb9, 0xab, 0x2e, 0x9f, 0x7d, 0x70, 0x7f, - 0xbb, 0xa3, 0x38, 0xc6, 0x84, 0x3a, 0x18, 0xfc, - 0x6f, 0xac, 0xeb, 0xaf, 0x66, 0x3d, 0x26, 0x29, - 0x6f, 0xb3, 0x29, 0xb4, 0xd2, 0x6f, 0x18, 0x49, - 0x4c, 0x79, 0xe0, 0x9e, 0x77, 0x96, 0x47, 0xf9, - 0xba, 0xfa, 0x87, 0x48, 0x96, 0x30, 0xd7, 0x9f, - 0x43, 0x01, 0x61, 0x0c, 0x23, 0x00, 0xc1, 0x9d, - 0xbf, 0x31, 0x48, 0xb7, 0xca, 0xc8, 0xc4, 0xf4, - 0x94, 0x41, 0x02, 0x75, 0x4f, 0x33, 0x2e, 0x92, - 0xb6, 0xf7, 0xc5, 0xe7, 0x5b, 0xc6, 0x17, 0x9e, - 0xb8, 0x77, 0xa0, 0x78, 0xd4, 0x71, 0x90, 0x09, - 0x02, 0x17, 0x44, 0xc1, 0x4f, 0x13, 0xfd, 0x2a, - 0x55, 0xa2, 0xb9, 0xc4, 0x4d, 0x18, 0x00, 0x06, - 0x85, 0xa8, 0x45, 0xa4, 0xf6, 0x32, 0xc7, 0xc5, - 0x6a, 0x77, 0x30, 0x6e, 0xfa, 0x66, 0xa2, 0x4d, - 0x05, 0xd0, 0x88, 0xdc, 0xd7, 0xc1, 0x3f, 0xe2, - 0x4f, 0xc4, 0x47, 0x27, 0x59, 0x65, 0xdb, 0x9e, - 0x4d, 0x37, 0xfb, 0xc9, 0x30, 0x44, 0x48, 0xcd } /* expected */ - }, { - false, /* encrypt */ - 2, /* key_size_index */ - 4, /* key_area */ - { 0xdd, 0xbb, 0xb0, 0x17, 0x3f, 0x1e, 0x2d, 0xeb, - 0x23, 0x94, 0xa6, 0x2a, 0xa2, 0xa0, 0x24, 0x0e }, /* iv */ - { 0xd5, 0x1d, 0x19, 0xde, 0xd5, 0xca, 0x4a, 0xe1, - 0x4b, 0x2b, 0x20, 0xb0, 0x27, 0xff, 0xb0, 0x20 }, /* mdata */ - 16, /* mdata_len */ - { 0x07, 0x27, 0x0d, 0x0e, 0x63, 0xaa, 0x36, 0xda, - 0xed, 0x8c, 0x6a, 0xde, 0x13, 0xac, 0x1a, 0xf1 } /* expected */ - }, { - false, /* encrypt */ - 2, /* key_size_index */ - 6, /* key_area */ - { 0xe4, 0x96, 0x51, 0x98, 0x8e, 0xbb, 0xb7, 0x2e, - 0xb8, 0xbb, 0x80, 0xbb, 0x9a, 0xbb, 0xca, 0x34 }, /* iv */ - { 0x5b, 0x97, 0xa9, 0xd4, 0x23, 0xf4, 0xb9, 0x74, - 0x13, 0xf3, 0x88, 0xd9, 0xa3, 0x41, 0xe7, 0x27, - 0xbb, 0x33, 0x9f, 0x8e, 0x18, 0xa3, 0xfa, 0xc2, - 0xf2, 0xfb, 0x85, 0xab, 0xdc, 0x8f, 0x13, 0x5d, - 0xeb, 0x30, 0x05, 0x4a, 0x1a, 0xfd, 0xc9, 0xb6, - 0xed, 0x7d, 0xa1, 0x6c, 0x55, 0xeb, 0xa6, 0xb0, - 0xd4, 0xd1, 0x0c, 0x74, 0xe1, 0xd9, 0xa7, 0xcf, - 0x8e, 0xdf, 0xae, 0xaa, 0x68, 0x4a, 0xc0, 0xbd, - 0x9f, 0x9d, 0x24, 0xba, 0x67, 0x49, 0x55, 0xc7, - 0x9d, 0xc6, 0xbe, 0x32, 0xae, 0xe1, 0xc2, 0x60, - 0xb5, 0x58, 0xff, 0x07, 0xe3, 0xa4, 0xd4, 0x9d, - 0x24, 0x16, 0x20, 0x11, 0xff, 0x25, 0x4d, 0xb8, - 0xbe, 0x07, 0x8e, 0x8a, 0xd0, 0x7e, 0x64, 0x8e, - 0x6b, 0xf5, 0x67, 0x93, 0x76, 0xcb, 0x43, 0x21, - 0xa5, 0xef, 0x01, 0xaf, 0xe6, 0xad, 0x88, 0x16, - 0xfc, 0xc7, 0x63, 0x46, 0x69, 0xc8, 0xc4, 0x38, - 0x92, 0x95, 0xc9, 0x24, 0x1e, 0x45, 0xff, 0xf3, - 0x9f, 0x32, 0x25, 0xf7, 0x74, 0x50, 0x32, 0xda, - 0xee, 0xbe, 0x99, 0xd4, 0xb1, 0x9b, 0xcb, 0x21, - 0x5d, 0x1b, 0xfd, 0xb3, 0x6e, 0xda, 0x2c, 0x24 }, /* mdata */ - 160, /* mdata_len */ - { 0xbf, 0xe5, 0xc6, 0x35, 0x4b, 0x7a, 0x3f, 0xf3, - 0xe1, 0x92, 0xe0, 0x57, 0x75, 0xb9, 0xb7, 0x58, - 0x07, 0xde, 0x12, 0xe3, 0x8a, 0x62, 0x6b, 0x8b, - 0xf0, 0xe1, 0x2d, 0x5f, 0xff, 0x78, 0xe4, 0xf1, - 0x77, 0x5a, 0xa7, 0xd7, 0x92, 0xd8, 0x85, 0x16, - 0x2e, 0x66, 0xd8, 0x89, 0x30, 0xf9, 0xc3, 0xb2, - 0xcd, 0xf8, 0x65, 0x4f, 0x56, 0x97, 0x25, 0x04, - 0x80, 0x31, 0x90, 0x38, 0x62, 0x70, 0xf0, 0xaa, - 0x43, 0x64, 0x5d, 0xb1, 0x87, 0xaf, 0x41, 0xfc, - 0xea, 0x63, 0x9b, 0x1f, 0x80, 0x26, 0xcc, 0xdd, - 0x0c, 0x23, 0xe0, 0xde, 0x37, 0x09, 0x4a, 0x8b, - 0x94, 0x1e, 0xcb, 0x76, 0x02, 0x99, 0x8a, 0x4b, - 0x26, 0x04, 0xe6, 0x9f, 0xc0, 0x42, 0x19, 0x58, - 0x5d, 0x85, 0x46, 0x00, 0xe0, 0xad, 0x6f, 0x99, - 0xa5, 0x3b, 0x25, 0x04, 0x04, 0x3c, 0x08, 0xb1, - 0xc3, 0xe2, 0x14, 0xd1, 0x7c, 0xde, 0x05, 0x3c, - 0xbd, 0xf9, 0x1d, 0xaa, 0x99, 0x9e, 0xd5, 0xb4, - 0x7c, 0x37, 0x98, 0x3b, 0xa3, 0xee, 0x25, 0x4b, - 0xc5, 0xc7, 0x93, 0x83, 0x7d, 0xaa, 0xa8, 0xc8, - 0x5c, 0xfc, 0x12, 0xf7, 0xf5, 0x4f, 0x69, 0x9f } /* expected */ - } - }; - static uint8_t mdata[MDATA_MAX_LEN]; - static int i; - static uint8_t key_size_index = -1, ret; - static int8_t res; - static rtimer_clock_t time, time2, total_time; - - PROCESS_BEGIN(); - - puts("-----------------------------------------\n" - "Initializing cryptoprocessor..."); - crypto_init(); - - for(i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) { - if(key_size_index != vectors[i].key_size_index) { - key_size_index = vectors[i].key_size_index; - printf("-----------------------------------------\n" - "Filling %d-bit key store...\n", 128 + (key_size_index << 6)); - time = RTIMER_NOW(); - ret = aes_load_keys(keys[key_size_index].keys, - keys[key_size_index].key_size, keys[key_size_index].count, 0); - time = RTIMER_NOW() - time; - printf("aes_load_keys(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - break; - } - } - - printf("-----------------------------------------\n" - "Test vector #%d: %s\n" - "key_area=%d mdata_len=%d\n", - i, vectors[i].encrypt ? "encrypt" : "decrypt", - vectors[i].key_area, vectors[i].mdata_len); - - /* mdata has to be in SRAM. */ - rom_util_memcpy(mdata, vectors[i].mdata, vectors[i].mdata_len); - - time = RTIMER_NOW(); - ret = cbc_crypt_start(vectors[i].encrypt, vectors[i].key_area, - vectors[i].iv, mdata, mdata, vectors[i].mdata_len, - &cbc_test_process); - time2 = RTIMER_NOW(); - time = time2 - time; - total_time = time; - if(ret == CRYPTO_SUCCESS) { - PROCESS_WAIT_EVENT_UNTIL((res = cbc_crypt_check_status()) != - CRYPTO_PENDING); - time2 = RTIMER_NOW() - time2; - total_time += time2; - } - printf("cbc_crypt_start(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - if(ret != CRYPTO_SUCCESS) { - PROCESS_PAUSE(); - continue; - } - printf("cbc_crypt_check_status() wait: %s, %lu us\n", str_res[res], - (uint32_t)((uint64_t)time2 * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(res != CRYPTO_SUCCESS) { - continue; - } - - if(rom_util_memcmp(mdata, vectors[i].expected, vectors[i].mdata_len)) { - puts("Output message does not match expected one"); - } else { - puts("Output message OK"); - } - - printf("Total duration: %lu us\n", - (uint32_t)((uint64_t)total_time * 1000000 / RTIMER_SECOND)); - } - - puts("-----------------------------------------\n" - "Disabling cryptoprocessor..."); - crypto_disable(); - - puts("Done!"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/crypto/ccm-test.c b/examples/platform-specific/cc2538-common/crypto/ccm-test.c deleted file mode 100644 index 93cad977c..000000000 --- a/examples/platform-specific/cc2538-common/crypto/ccm-test.c +++ /dev/null @@ -1,708 +0,0 @@ -/* - * Original file: - * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-ccm-test cc2538 AES-CCM Test Project - * - * AES-CCM access example for CC2538-based platforms - * - * This example shows how AES-CCM should be used. The example also verifies - * the AES-CCM functionality. - * - * @{ - * - * \file - * Example demonstrating AES-CCM - */ -#include "contiki.h" -#include "sys/rtimer.h" -#include "dev/rom-util.h" -#include "dev/ccm.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define NONCE_MAX_LEN 13 -#define ADATA_MAX_LEN 32 -#define MDATA_MAX_LEN 40 -#define MIC_MAX_LEN 16 -/*---------------------------------------------------------------------------*/ -PROCESS(ccm_test_process, "ccm test process"); -AUTOSTART_PROCESSES(&ccm_test_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ccm_test_process, ev, data) -{ - static const char *const str_res[] = { - "success", - "invalid param", - "NULL error", - "resource in use", - "DMA bus error", - "keystore read error", - "keystore write error", - "authentication failed" - }; - static const uint8_t keys128[][128 / 8] = { - { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf } - }; - static const uint8_t keys192[][192 / 8] = { - { 0x26, 0x51, 0x1f, 0xb5, 0x1f, 0xcf, 0xa7, 0x5c, - 0xb4, 0xb4, 0x4d, 0xa7, 0x5a, 0x6e, 0x5a, 0x0e, - 0xb8, 0xd9, 0xc8, 0xf3, 0xb9, 0x06, 0xf8, 0x86 }, - { 0x08, 0x6e, 0x29, 0x67, 0xcd, 0xe9, 0x9e, 0x90, - 0xfa, 0xae, 0xa8, 0xa9, 0x4e, 0x16, 0x8b, 0xf0, - 0xe0, 0x66, 0xc5, 0x03, 0xa8, 0x49, 0xa9, 0xf3 }, - { 0xce, 0xb0, 0x09, 0xae, 0xa4, 0x45, 0x44, 0x51, - 0xfe, 0xad, 0xf0, 0xe6, 0xb3, 0x6f, 0x45, 0x55, - 0x5d, 0xd0, 0x47, 0x23, 0xba, 0xa4, 0x48, 0xe8 }, - { 0x11, 0xfd, 0x45, 0x74, 0x3d, 0x94, 0x6e, 0x6d, - 0x37, 0x34, 0x1f, 0xec, 0x49, 0x94, 0x7e, 0x8c, - 0x70, 0x48, 0x24, 0x94, 0xa8, 0xf0, 0x7f, 0xcc } - }; - static const uint8_t keys256[][256 / 8] = { - { 0x26, 0x51, 0x1f, 0xb5, 0x1f, 0xcf, 0xa7, 0x5c, - 0xb4, 0xb4, 0x4d, 0xa7, 0x5a, 0x6e, 0x5a, 0x0e, - 0xb8, 0xd9, 0xc8, 0xf3, 0xb9, 0x06, 0xf8, 0x86, - 0xdf, 0x3b, 0xa3, 0xe6, 0xda, 0x3a, 0x13, 0x89 }, - { 0xc6, 0xc1, 0x4c, 0x65, 0x5e, 0x52, 0xc8, 0xa4, - 0xc7, 0xe8, 0xd5, 0x4e, 0x97, 0x4d, 0x69, 0x8e, - 0x1f, 0x21, 0xee, 0x3b, 0xa7, 0x17, 0xa0, 0xad, - 0xfa, 0x61, 0x36, 0xd0, 0x26, 0x68, 0xc4, 0x76 }, - { 0x55, 0x35, 0x21, 0xa7, 0x65, 0xab, 0x0c, 0x3f, - 0xd2, 0x03, 0x65, 0x4e, 0x99, 0x16, 0x33, 0x0e, - 0x18, 0x9b, 0xdf, 0x95, 0x1f, 0xee, 0xe9, 0xb4, - 0x4b, 0x10, 0xda, 0x20, 0x8f, 0xee, 0x7a, 0xcf }, - { 0x90, 0x74, 0xb1, 0xae, 0x4c, 0xa3, 0x34, 0x2f, - 0xe5, 0xbf, 0x6f, 0x14, 0xbc, 0xf2, 0xf2, 0x79, - 0x04, 0xf0, 0xb1, 0x51, 0x79, 0xd9, 0x5a, 0x65, - 0x4f, 0x61, 0xe6, 0x99, 0x69, 0x2e, 0x6f, 0x71 } - }; - static const struct { - const void *keys; - uint8_t key_size; - uint8_t count; - } keys[] = { - { keys128, AES_KEY_STORE_SIZE_KEY_SIZE_128, - sizeof(keys128) / sizeof(keys128[0]) }, - { keys192, AES_KEY_STORE_SIZE_KEY_SIZE_192, - sizeof(keys192) / sizeof(keys192[0]) }, - { keys256, AES_KEY_STORE_SIZE_KEY_SIZE_256, - sizeof(keys256) / sizeof(keys256[0]) } - }; - static const struct { - bool encrypt; - uint8_t len_len; - uint8_t key_size_index; - uint8_t key_area; - uint8_t nonce[NONCE_MAX_LEN]; - uint8_t adata[ADATA_MAX_LEN]; - uint16_t adata_len; - uint8_t mdata[MDATA_MAX_LEN]; - uint16_t mdata_len; - uint8_t mic_len; - uint8_t expected[MDATA_MAX_LEN]; - } vectors[] = { - { - true, /* encrypt */ - 2, /* len_len */ - 0, /* key_size_index */ - 0, /* key_area */ - { 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0, - 0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */ - {}, /* adata */ - 0, /* adata_len */ - { 0x14, 0xaa, 0xbb, 0x00, 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, - 0x0c, 0x0d, 0x0e, 0x0f }, /* mdata */ - 20, /* mdata_len */ - 0, /* mic_len */ - { 0x92, 0xe8, 0xad, 0xca, 0x53, 0x81, 0xbf, 0xd0, - 0x5b, 0xdd, 0xf3, 0x61, 0x09, 0x09, 0x82, 0xe6, - 0x2c, 0x61, 0x01, 0x4e } /* expected */ - }, { - true, /* encrypt */ - 2, /* len_len */ - 0, /* key_size_index */ - 1, /* key_area */ - { 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x05, 0x02 }, /* nonce */ - { 0x08, 0xd0, 0x84, 0x21, 0x43, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x48, 0xde, 0xac, 0x02, 0x05, 0x00, - 0x00, 0x00, 0x55, 0xcf, 0x00, 0x00, 0x51, 0x52, - 0x53, 0x54 }, /* adata */ - 26, /* adata_len */ - {}, /* mdata */ - 0, /* mdata_len */ - 8, /* mic_len */ - { 0x22, 0x3b, 0xc1, 0xec, 0x84, 0x1a, 0xb5, 0x53 } /* expected */ - }, { - true, /* encrypt */ - 2, /* len_len */ - 0, /* key_size_index */ - 0, /* key_area */ - { 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0, - 0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */ - { 0x69, 0x98, 0x03, 0x33, 0x63, 0xbb, 0xaa, 0x01, - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x03 }, /* adata */ - 15, /* adata_len */ - { 0x14, 0xaa, 0xbb, 0x00, 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, - 0x0c, 0x0d, 0x0e, 0x0f }, /* mdata */ - 20, /* mdata_len */ - 4, /* mic_len */ - { 0x92, 0xe8, 0xad, 0xca, 0x53, 0x81, 0xbf, 0xd0, - 0x5b, 0xdd, 0xf3, 0x61, 0x09, 0x09, 0x82, 0xe6, - 0x2c, 0x61, 0x01, 0x4e, 0x7b, 0x34, 0x4f, 0x09 } /* expected */ - }, { - false, /* decrypt */ - 2, /* len_len */ - 0, /* key_size_index */ - 0, /* key_area */ - { 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0, - 0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */ - {}, /* adata */ - 0, /* adata_len */ - { 0x92, 0xe8, 0xad, 0xca, 0x53, 0x81, 0xbf, 0xd0, - 0x5b, 0xdd, 0xf3, 0x61, 0x09, 0x09, 0x82, 0xe6, - 0x2c, 0x61, 0x01, 0x4e }, /* mdata */ - 20, /* mdata_len */ - 0, /* mic_len */ - { 0x14, 0xaa, 0xbb, 0x00, 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, - 0x0c, 0x0d, 0x0e, 0x0f } /* expected */ - }, { - false, /* decrypt */ - 2, /* len_len */ - 0, /* key_size_index */ - 1, /* key_area */ - { 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x05, 0x02 }, /* nonce */ - { 0x08, 0xd0, 0x84, 0x21, 0x43, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x48, 0xde, 0xac, 0x02, 0x05, 0x00, - 0x00, 0x00, 0x55, 0xcf, 0x00, 0x00, 0x51, 0x52, - 0x53, 0x54 }, /* adata */ - 26, /* adata_len */ - { 0x22, 0x3b, 0xc1, 0xec, 0x84, 0x1a, 0xb5, 0x53 }, /* mdata */ - 8, /* mdata_len */ - 8, /* mic_len */ - {} /* expected */ - }, { - false, /* decrypt */ - 2, /* len_len */ - 0, /* key_size_index */ - 0, /* key_area */ - { 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0, - 0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */ - { 0x69, 0x98, 0x03, 0x33, 0x63, 0xbb, 0xaa, 0x01, - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x03 }, /* adata */ - 15, /* adata_len */ - { 0x92, 0xe8, 0xad, 0xca, 0x53, 0x81, 0xbf, 0xd0, - 0x5b, 0xdd, 0xf3, 0x61, 0x09, 0x09, 0x82, 0xe6, - 0x2c, 0x61, 0x01, 0x4e, 0x7b, 0x34, 0x4f, 0x09 }, /* mdata */ - 24, /* mdata_len */ - 4, /* mic_len */ - { 0x14, 0xaa, 0xbb, 0x00, 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, - 0x0c, 0x0d, 0x0e, 0x0f } /* expected */ - }, { - true, /* encrypt */ - 2, /* len_len */ - 1, /* key_size_index */ - 0, /* key_area */ - { 0x15, 0xb3, 0x69, 0x88, 0x96, 0x99, 0xb6, 0xde, - 0x1f, 0xa3, 0xee, 0x73, 0xe5 }, /* nonce */ - {}, /* adata */ - 0, /* adata_len */ - { 0x39, 0xf0, 0x8a, 0x2a, 0xf1, 0xd8, 0xda, 0x62, - 0x12, 0x55, 0x06, 0x39, 0xb9, 0x1f, 0xb2, 0x57, - 0x3e, 0x39, 0xa8, 0xeb, 0x5d, 0x80, 0x1d, 0xe8 }, /* mdata */ - 24, /* mdata_len */ - 16, /* mic_len */ - { 0x63, 0x42, 0xb8, 0x70, 0x0e, 0xde, 0xc9, 0x7a, - 0x96, 0x0e, 0xb1, 0x6e, 0x7c, 0xb1, 0xeb, 0x44, - 0x12, 0xfb, 0x4e, 0x26, 0x3d, 0xdd, 0x22, 0x06, - 0xb0, 0x90, 0x15, 0x5d, 0x34, 0xa7, 0x6c, 0x83, - 0x24, 0xe5, 0x55, 0x0c, 0x3e, 0xf4, 0x26, 0xed } /* expected */ - }, { - true, /* encrypt */ - 2, /* len_len */ - 1, /* key_size_index */ - 2, /* key_area */ - { 0x92, 0x95, 0x42, 0xcd, 0x69, 0x0f, 0x1b, 0xab, - 0xcf, 0x16, 0x96, 0xcb, 0x03 }, /* nonce */ - { 0x58, 0xf7, 0x0b, 0xab, 0x24, 0xe0, 0xa6, 0x13, - 0x7e, 0x5c, 0xd3, 0xeb, 0x18, 0x65, 0x6f, 0x2b, - 0x5c, 0xcd, 0xdc, 0x3f, 0x53, 0x8a, 0x00, 0x00, - 0xc6, 0x51, 0x90, 0xe4, 0xa3, 0x66, 0x8e, 0x71 }, /* adata */ - 32, /* adata_len */ - {}, /* mdata */ - 0, /* mdata_len */ - 16, /* mic_len */ - { 0x3b, 0xf9, 0xd9, 0x3a, 0xf6, 0xff, 0xac, 0x9a, - 0xc8, 0x4c, 0xd3, 0x20, 0x2d, 0x4e, 0x0c, 0xc8 } /* expected */ - }, { - true, /* encrypt */ - 8, /* len_len */ - 1, /* key_size_index */ - 4, /* key_area */ - { 0x76, 0x40, 0x43, 0xc4, 0x94, 0x60, 0xb7 }, /* nonce */ - { 0x6e, 0x80, 0xdd, 0x7f, 0x1b, 0xad, 0xf3, 0xa1, - 0xc9, 0xab, 0x25, 0xc7, 0x5f, 0x10, 0xbd, 0xe7, - 0x8c, 0x23, 0xfa, 0x0e, 0xb8, 0xf9, 0xaa, 0xa5, - 0x3a, 0xde, 0xfb, 0xf4, 0xcb, 0xf7, 0x8f, 0xe4 }, /* adata */ - 32, /* adata_len */ - { 0xc8, 0xd2, 0x75, 0xf9, 0x19, 0xe1, 0x7d, 0x7f, - 0xe6, 0x9c, 0x2a, 0x1f, 0x58, 0x93, 0x9d, 0xfe, - 0x4d, 0x40, 0x37, 0x91, 0xb5, 0xdf, 0x13, 0x10 }, /* mdata */ - 24, /* mdata_len */ - 16, /* mic_len */ - { 0x8a, 0x0f, 0x3d, 0x82, 0x29, 0xe4, 0x8e, 0x74, - 0x87, 0xfd, 0x95, 0xa2, 0x8a, 0xd3, 0x92, 0xc8, - 0x0b, 0x36, 0x81, 0xd4, 0xfb, 0xc7, 0xbb, 0xfd, - 0x2d, 0xd6, 0xef, 0x1c, 0x45, 0xd4, 0xcc, 0xb7, - 0x23, 0xdc, 0x07, 0x44, 0x14, 0xdb, 0x50, 0x6d } /* expected */ - }, { - true, /* encrypt */ - 2, /* len_len */ - 1, /* key_size_index */ - 6, /* key_area */ - { 0xc6, 0xae, 0xeb, 0xcb, 0x14, 0x6c, 0xfa, 0xfa, - 0xae, 0x66, 0xf7, 0x8a, 0xab }, /* nonce */ - { 0x7d, 0xc8, 0xc5, 0x21, 0x44, 0xa7, 0xcb, 0x65, - 0xb3, 0xe5, 0xa8, 0x46, 0xe8, 0xfd, 0x7e, 0xae, - 0x37, 0xbf, 0x69, 0x96, 0xc2, 0x99, 0xb5, 0x6e, - 0x49, 0x14, 0x4e, 0xbf, 0x43, 0xa1, 0x77, 0x0f }, /* adata */ - 32, /* adata_len */ - { 0xee, 0x7e, 0x60, 0x75, 0xba, 0x52, 0x84, 0x6d, - 0xe5, 0xd6, 0x25, 0x49, 0x59, 0xa1, 0x8a, 0xff, - 0xc4, 0xfa, 0xf5, 0x9c, 0x8e, 0xf6, 0x34, 0x89 }, /* mdata */ - 24, /* mdata_len */ - 4, /* mic_len */ - { 0x13, 0x7d, 0x9d, 0xa5, 0x9b, 0xaf, 0x5c, 0xbf, - 0xd4, 0x66, 0x20, 0xc5, 0xf2, 0x98, 0xfc, 0x76, - 0x6d, 0xe1, 0x0a, 0xc6, 0x8e, 0x77, 0x4e, 0xdf, - 0x1f, 0x2c, 0x5b, 0xad } /* expected */ - }, { - false, /* decrypt */ - 2, /* len_len */ - 1, /* key_size_index */ - 0, /* key_area */ - { 0x15, 0xb3, 0x69, 0x88, 0x96, 0x99, 0xb6, 0xde, - 0x1f, 0xa3, 0xee, 0x73, 0xe5 }, /* nonce */ - {}, /* adata */ - 0, /* adata_len */ - { 0x63, 0x42, 0xb8, 0x70, 0x0e, 0xde, 0xc9, 0x7a, - 0x96, 0x0e, 0xb1, 0x6e, 0x7c, 0xb1, 0xeb, 0x44, - 0x12, 0xfb, 0x4e, 0x26, 0x3d, 0xdd, 0x22, 0x06, - 0xb0, 0x90, 0x15, 0x5d, 0x34, 0xa7, 0x6c, 0x83, - 0x24, 0xe5, 0x55, 0x0c, 0x3e, 0xf4, 0x26, 0xed }, /* mdata */ - 40, /* mdata_len */ - 16, /* mic_len */ - { 0x39, 0xf0, 0x8a, 0x2a, 0xf1, 0xd8, 0xda, 0x62, - 0x12, 0x55, 0x06, 0x39, 0xb9, 0x1f, 0xb2, 0x57, - 0x3e, 0x39, 0xa8, 0xeb, 0x5d, 0x80, 0x1d, 0xe8 } /* expected */ - }, { - false, /* decrypt */ - 2, /* len_len */ - 1, /* key_size_index */ - 2, /* key_area */ - { 0x92, 0x95, 0x42, 0xcd, 0x69, 0x0f, 0x1b, 0xab, - 0xcf, 0x16, 0x96, 0xcb, 0x03 }, /* nonce */ - { 0x58, 0xf7, 0x0b, 0xab, 0x24, 0xe0, 0xa6, 0x13, - 0x7e, 0x5c, 0xd3, 0xeb, 0x18, 0x65, 0x6f, 0x2b, - 0x5c, 0xcd, 0xdc, 0x3f, 0x53, 0x8a, 0x00, 0x00, - 0xc6, 0x51, 0x90, 0xe4, 0xa3, 0x66, 0x8e, 0x71 }, /* adata */ - 32, /* adata_len */ - { 0x3b, 0xf9, 0xd9, 0x3a, 0xf6, 0xff, 0xac, 0x9a, - 0xc8, 0x4c, 0xd3, 0x20, 0x2d, 0x4e, 0x0c, 0xc8 }, /* mdata */ - 16, /* mdata_len */ - 16, /* mic_len */ - {} /* expected */ - }, { - false, /* decrypt */ - 8, /* len_len */ - 1, /* key_size_index */ - 4, /* key_area */ - { 0x76, 0x40, 0x43, 0xc4, 0x94, 0x60, 0xb7 }, /* nonce */ - { 0x6e, 0x80, 0xdd, 0x7f, 0x1b, 0xad, 0xf3, 0xa1, - 0xc9, 0xab, 0x25, 0xc7, 0x5f, 0x10, 0xbd, 0xe7, - 0x8c, 0x23, 0xfa, 0x0e, 0xb8, 0xf9, 0xaa, 0xa5, - 0x3a, 0xde, 0xfb, 0xf4, 0xcb, 0xf7, 0x8f, 0xe4 }, /* adata */ - 32, /* adata_len */ - { 0x8a, 0x0f, 0x3d, 0x82, 0x29, 0xe4, 0x8e, 0x74, - 0x87, 0xfd, 0x95, 0xa2, 0x8a, 0xd3, 0x92, 0xc8, - 0x0b, 0x36, 0x81, 0xd4, 0xfb, 0xc7, 0xbb, 0xfd, - 0x2d, 0xd6, 0xef, 0x1c, 0x45, 0xd4, 0xcc, 0xb7, - 0x23, 0xdc, 0x07, 0x44, 0x14, 0xdb, 0x50, 0x6d }, /* mdata */ - 40, /* mdata_len */ - 16, /* mic_len */ - { 0xc8, 0xd2, 0x75, 0xf9, 0x19, 0xe1, 0x7d, 0x7f, - 0xe6, 0x9c, 0x2a, 0x1f, 0x58, 0x93, 0x9d, 0xfe, - 0x4d, 0x40, 0x37, 0x91, 0xb5, 0xdf, 0x13, 0x10 } /* expected */ - }, { - false, /* decrypt */ - 2, /* len_len */ - 1, /* key_size_index */ - 6, /* key_area */ - { 0xc6, 0xae, 0xeb, 0xcb, 0x14, 0x6c, 0xfa, 0xfa, - 0xae, 0x66, 0xf7, 0x8a, 0xab }, /* nonce */ - { 0x7d, 0xc8, 0xc5, 0x21, 0x44, 0xa7, 0xcb, 0x65, - 0xb3, 0xe5, 0xa8, 0x46, 0xe8, 0xfd, 0x7e, 0xae, - 0x37, 0xbf, 0x69, 0x96, 0xc2, 0x99, 0xb5, 0x6e, - 0x49, 0x14, 0x4e, 0xbf, 0x43, 0xa1, 0x77, 0x0f }, /* adata */ - 32, /* adata_len */ - { 0x13, 0x7d, 0x9d, 0xa5, 0x9b, 0xaf, 0x5c, 0xbf, - 0xd4, 0x66, 0x20, 0xc5, 0xf2, 0x98, 0xfc, 0x76, - 0x6d, 0xe1, 0x0a, 0xc6, 0x8e, 0x77, 0x4e, 0xdf, - 0x1f, 0x2c, 0x5b, 0xad }, /* mdata */ - 28, /* mdata_len */ - 4, /* mic_len */ - { 0xee, 0x7e, 0x60, 0x75, 0xba, 0x52, 0x84, 0x6d, - 0xe5, 0xd6, 0x25, 0x49, 0x59, 0xa1, 0x8a, 0xff, - 0xc4, 0xfa, 0xf5, 0x9c, 0x8e, 0xf6, 0x34, 0x89 } /* expected */ - }, { - true, /* encrypt */ - 2, /* len_len */ - 2, /* key_size_index */ - 0, /* key_area */ - { 0x72, 0xa6, 0x0f, 0x34, 0x5a, 0x19, 0x78, 0xfb, - 0x40, 0xf2, 0x8a, 0x2f, 0xa4 }, /* nonce */ - {}, /* adata */ - 0, /* adata_len */ - { 0x30, 0xd5, 0x6f, 0xf2, 0xa2, 0x5b, 0x83, 0xfe, - 0xe7, 0x91, 0x11, 0x0f, 0xca, 0xea, 0x48, 0xe4, - 0x1d, 0xb7, 0xc7, 0xf0, 0x98, 0xa8, 0x10, 0x00 }, /* mdata */ - 24, /* mdata_len */ - 16, /* mic_len */ - { 0x55, 0xf0, 0x68, 0xc0, 0xbb, 0xba, 0x8b, 0x59, - 0x80, 0x13, 0xdd, 0x18, 0x41, 0xfd, 0x74, 0x0f, - 0xda, 0x29, 0x02, 0x32, 0x21, 0x48, 0xab, 0x5e, - 0x93, 0x57, 0x53, 0xe6, 0x01, 0xb7, 0x9d, 0xb4, - 0xae, 0x73, 0x0b, 0x6a, 0xe3, 0x50, 0x07, 0x31 } /* expected */ - }, { - true, /* encrypt */ - 2, /* len_len */ - 2, /* key_size_index */ - 2, /* key_area */ - { 0x29, 0x1e, 0x91, 0xb1, 0x9d, 0xe5, 0x18, 0xcd, - 0x78, 0x06, 0xde, 0x44, 0xf6 }, /* nonce */ - { 0xb4, 0xf8, 0x32, 0x69, 0x44, 0xa4, 0x5d, 0x95, - 0xf9, 0x18, 0x87, 0xc2, 0xa6, 0xac, 0x36, 0xb6, - 0x0e, 0xea, 0x5e, 0xde, 0xf8, 0x4c, 0x1c, 0x35, - 0x81, 0x46, 0xa6, 0x66, 0xb6, 0x87, 0x83, 0x35 }, /* adata */ - 32, /* adata_len */ - {}, /* mdata */ - 0, /* mdata_len */ - 16, /* mic_len */ - { 0xca, 0x48, 0x2c, 0x67, 0x4b, 0x59, 0x90, 0x46, - 0xcc, 0x7d, 0x7e, 0xe0, 0xd0, 0x0e, 0xec, 0x1e } /* expected */ - }, { - true, /* encrypt */ - 8, /* len_len */ - 2, /* key_size_index */ - 4, /* key_area */ - { 0xaa, 0xa2, 0x3f, 0x10, 0x16, 0x47, 0xd8 }, /* nonce */ - { 0xa3, 0x55, 0xd4, 0xc6, 0x11, 0x81, 0x2e, 0x5f, - 0x92, 0x58, 0xd7, 0x18, 0x8b, 0x3d, 0xf8, 0x85, - 0x14, 0x77, 0x09, 0x4f, 0xfc, 0x2a, 0xf2, 0xcf, - 0x0c, 0x86, 0x70, 0xdb, 0x90, 0x3f, 0xbb, 0xe0 }, /* adata */ - 32, /* adata_len */ - { 0x64, 0x4e, 0xb3, 0x4b, 0x9a, 0x12, 0x6e, 0x43, - 0x7b, 0x5e, 0x01, 0x5e, 0xea, 0x14, 0x1c, 0xa1, - 0xa8, 0x80, 0x20, 0xf2, 0xd5, 0xd6, 0xcc, 0x2c }, /* mdata */ - 24, /* mdata_len */ - 16, /* mic_len */ - { 0x27, 0xed, 0x90, 0x66, 0x81, 0x74, 0xeb, 0xf8, - 0x24, 0x1a, 0x3c, 0x74, 0xb3, 0x5e, 0x12, 0x46, - 0xb6, 0x61, 0x7e, 0x41, 0x23, 0x57, 0x8f, 0x15, - 0x3b, 0xdb, 0x67, 0x06, 0x2a, 0x13, 0xef, 0x4e, - 0x98, 0x6f, 0x5b, 0xb3, 0xd0, 0xbb, 0x43, 0x07 } /* expected */ - }, { - true, /* encrypt */ - 2, /* len_len */ - 2, /* key_size_index */ - 6, /* key_area */ - { 0x2e, 0x1e, 0x01, 0x32, 0x46, 0x85, 0x00, 0xd4, - 0xbd, 0x47, 0x86, 0x25, 0x63 }, /* nonce */ - { 0x3c, 0x5f, 0x54, 0x04, 0x37, 0x0a, 0xbd, 0xcb, - 0x1e, 0xdd, 0xe9, 0x9d, 0xe6, 0x0d, 0x06, 0x82, - 0xc6, 0x00, 0xb0, 0x34, 0xe0, 0x63, 0xb7, 0xd3, - 0x23, 0x77, 0x23, 0xda, 0x70, 0xab, 0x75, 0x52 }, /* adata */ - 32, /* adata_len */ - { 0x23, 0x90, 0x29, 0xf1, 0x50, 0xbc, 0xcb, 0xd6, - 0x7e, 0xdb, 0xb6, 0x7f, 0x8a, 0xe4, 0x56, 0xb4, - 0xea, 0x06, 0x6a, 0x4b, 0xee, 0xe0, 0x65, 0xf9 }, /* mdata */ - 24, /* mdata_len */ - 4, /* mic_len */ - { 0x9c, 0x8d, 0x5d, 0xd2, 0x27, 0xfd, 0x9f, 0x81, - 0x23, 0x76, 0x01, 0x83, 0x0a, 0xfe, 0xe4, 0xf0, - 0x11, 0x56, 0x36, 0xc8, 0xe5, 0xd5, 0xfd, 0x74, - 0x3c, 0xb9, 0xaf, 0xed } /* expected */ - }, { - false, /* decrypt */ - 2, /* len_len */ - 2, /* key_size_index */ - 0, /* key_area */ - { 0x72, 0xa6, 0x0f, 0x34, 0x5a, 0x19, 0x78, 0xfb, - 0x40, 0xf2, 0x8a, 0x2f, 0xa4 }, /* nonce */ - {}, /* adata */ - 0, /* adata_len */ - { 0x55, 0xf0, 0x68, 0xc0, 0xbb, 0xba, 0x8b, 0x59, - 0x80, 0x13, 0xdd, 0x18, 0x41, 0xfd, 0x74, 0x0f, - 0xda, 0x29, 0x02, 0x32, 0x21, 0x48, 0xab, 0x5e, - 0x93, 0x57, 0x53, 0xe6, 0x01, 0xb7, 0x9d, 0xb4, - 0xae, 0x73, 0x0b, 0x6a, 0xe3, 0x50, 0x07, 0x31 }, /* mdata */ - 40, /* mdata_len */ - 16, /* mic_len */ - { 0x30, 0xd5, 0x6f, 0xf2, 0xa2, 0x5b, 0x83, 0xfe, - 0xe7, 0x91, 0x11, 0x0f, 0xca, 0xea, 0x48, 0xe4, - 0x1d, 0xb7, 0xc7, 0xf0, 0x98, 0xa8, 0x10, 0x00 } /* expected */ - }, { - false, /* decrypt */ - 2, /* len_len */ - 2, /* key_size_index */ - 2, /* key_area */ - { 0x29, 0x1e, 0x91, 0xb1, 0x9d, 0xe5, 0x18, 0xcd, - 0x78, 0x06, 0xde, 0x44, 0xf6 }, /* nonce */ - { 0xb4, 0xf8, 0x32, 0x69, 0x44, 0xa4, 0x5d, 0x95, - 0xf9, 0x18, 0x87, 0xc2, 0xa6, 0xac, 0x36, 0xb6, - 0x0e, 0xea, 0x5e, 0xde, 0xf8, 0x4c, 0x1c, 0x35, - 0x81, 0x46, 0xa6, 0x66, 0xb6, 0x87, 0x83, 0x35 }, /* adata */ - 32, /* adata_len */ - { 0xca, 0x48, 0x2c, 0x67, 0x4b, 0x59, 0x90, 0x46, - 0xcc, 0x7d, 0x7e, 0xe0, 0xd0, 0x0e, 0xec, 0x1e }, /* mdata */ - 16, /* mdata_len */ - 16, /* mic_len */ - {} /* expected */ - }, { - false, /* decrypt */ - 8, /* len_len */ - 2, /* key_size_index */ - 4, /* key_area */ - { 0xaa, 0xa2, 0x3f, 0x10, 0x16, 0x47, 0xd8 }, /* nonce */ - { 0xa3, 0x55, 0xd4, 0xc6, 0x11, 0x81, 0x2e, 0x5f, - 0x92, 0x58, 0xd7, 0x18, 0x8b, 0x3d, 0xf8, 0x85, - 0x14, 0x77, 0x09, 0x4f, 0xfc, 0x2a, 0xf2, 0xcf, - 0x0c, 0x86, 0x70, 0xdb, 0x90, 0x3f, 0xbb, 0xe0 }, /* adata */ - 32, /* adata_len */ - { 0x27, 0xed, 0x90, 0x66, 0x81, 0x74, 0xeb, 0xf8, - 0x24, 0x1a, 0x3c, 0x74, 0xb3, 0x5e, 0x12, 0x46, - 0xb6, 0x61, 0x7e, 0x41, 0x23, 0x57, 0x8f, 0x15, - 0x3b, 0xdb, 0x67, 0x06, 0x2a, 0x13, 0xef, 0x4e, - 0x98, 0x6f, 0x5b, 0xb3, 0xd0, 0xbb, 0x43, 0x07 }, /* mdata */ - 40, /* mdata_len */ - 16, /* mic_len */ - { 0x64, 0x4e, 0xb3, 0x4b, 0x9a, 0x12, 0x6e, 0x43, - 0x7b, 0x5e, 0x01, 0x5e, 0xea, 0x14, 0x1c, 0xa1, - 0xa8, 0x80, 0x20, 0xf2, 0xd5, 0xd6, 0xcc, 0x2c } /* expected */ - }, { - false, /* decrypt */ - 2, /* len_len */ - 2, /* key_size_index */ - 6, /* key_area */ - { 0x2e, 0x1e, 0x01, 0x32, 0x46, 0x85, 0x00, 0xd4, - 0xbd, 0x47, 0x86, 0x25, 0x63 }, /* nonce */ - { 0x3c, 0x5f, 0x54, 0x04, 0x37, 0x0a, 0xbd, 0xcb, - 0x1e, 0xdd, 0xe9, 0x9d, 0xe6, 0x0d, 0x06, 0x82, - 0xc6, 0x00, 0xb0, 0x34, 0xe0, 0x63, 0xb7, 0xd3, - 0x23, 0x77, 0x23, 0xda, 0x70, 0xab, 0x75, 0x52 }, /* adata */ - 32, /* adata_len */ - { 0x9c, 0x8d, 0x5d, 0xd2, 0x27, 0xfd, 0x9f, 0x81, - 0x23, 0x76, 0x01, 0x83, 0x0a, 0xfe, 0xe4, 0xf0, - 0x11, 0x56, 0x36, 0xc8, 0xe5, 0xd5, 0xfd, 0x74, - 0x3c, 0xb9, 0xaf, 0xed }, /* mdata */ - 28, /* mdata_len */ - 4, /* mic_len */ - { 0x23, 0x90, 0x29, 0xf1, 0x50, 0xbc, 0xcb, 0xd6, - 0x7e, 0xdb, 0xb6, 0x7f, 0x8a, 0xe4, 0x56, 0xb4, - 0xea, 0x06, 0x6a, 0x4b, 0xee, 0xe0, 0x65, 0xf9 } /* expected */ - } - }; - static uint8_t adata[ADATA_MAX_LEN]; - static uint8_t mdata[MDATA_MAX_LEN]; - static uint8_t mic[MIC_MAX_LEN]; - static int i; - static uint8_t key_size_index = -1, ret; - static rtimer_clock_t time, time2, total_time; - - PROCESS_BEGIN(); - - puts("-----------------------------------------\n" - "Initializing cryptoprocessor..."); - crypto_init(); - - for(i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) { - if(key_size_index != vectors[i].key_size_index) { - key_size_index = vectors[i].key_size_index; - printf("-----------------------------------------\n" - "Filling %d-bit key store...\n", 128 + (key_size_index << 6)); - time = RTIMER_NOW(); - ret = aes_load_keys(keys[key_size_index].keys, - keys[key_size_index].key_size, keys[key_size_index].count, 0); - time = RTIMER_NOW() - time; - printf("aes_load_keys(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - break; - } - } - - printf("-----------------------------------------\n" - "Test vector #%d: %s\n" - "len_len=%d key_area=%d\n" - "adata_len=%d mdata_len=%d mic_len=%d\n", - i, vectors[i].encrypt ? "encrypt" : "decrypt", - vectors[i].len_len, vectors[i].key_area, - vectors[i].adata_len, vectors[i].mdata_len, vectors[i].mic_len); - - /* adata and mdata have to be in SRAM. */ - rom_util_memcpy(adata, vectors[i].adata, vectors[i].adata_len); - rom_util_memcpy(mdata, vectors[i].mdata, vectors[i].mdata_len); - - time = RTIMER_NOW(); - if(vectors[i].encrypt) { - ret = ccm_auth_encrypt_start(vectors[i].len_len, vectors[i].key_area, - vectors[i].nonce, adata, - vectors[i].adata_len, mdata, - vectors[i].mdata_len, mdata, - vectors[i].mic_len, &ccm_test_process); - time2 = RTIMER_NOW(); - time = time2 - time; - total_time = time; - if(ret == CRYPTO_SUCCESS) { - PROCESS_WAIT_EVENT_UNTIL(ccm_auth_encrypt_check_status()); - time2 = RTIMER_NOW() - time2; - total_time += time2; - } - printf("ccm_auth_encrypt_start(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - if(ret != CRYPTO_SUCCESS) { - PROCESS_PAUSE(); - continue; - } - printf("ccm_auth_encrypt_check_status() wait: %lu us\n", - (uint32_t)((uint64_t)time2 * 1000000 / RTIMER_SECOND)); - - time = RTIMER_NOW(); - ret = ccm_auth_encrypt_get_result(mic, vectors[i].mic_len); - time = RTIMER_NOW() - time; - total_time += time; - printf("ccm_auth_encrypt_get_result(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - continue; - } - - if(rom_util_memcmp(mdata, vectors[i].expected, vectors[i].mdata_len)) { - puts("Encrypted message does not match expected one"); - } else { - puts("Encrypted message OK"); - } - - if(rom_util_memcmp(mic, vectors[i].expected + vectors[i].mdata_len, - vectors[i].mic_len)) { - puts("MIC does not match expected one"); - } else { - puts("MIC OK"); - } - } else { - ret = ccm_auth_decrypt_start(vectors[i].len_len, vectors[i].key_area, - vectors[i].nonce, adata, - vectors[i].adata_len, mdata, - vectors[i].mdata_len, mdata, - vectors[i].mic_len, &ccm_test_process); - time2 = RTIMER_NOW(); - time = time2 - time; - total_time = time; - if(ret == CRYPTO_SUCCESS) { - PROCESS_WAIT_EVENT_UNTIL(ccm_auth_decrypt_check_status()); - time2 = RTIMER_NOW() - time2; - total_time += time2; - } - printf("ccm_auth_decrypt_start(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - if(ret != CRYPTO_SUCCESS) { - PROCESS_PAUSE(); - continue; - } - printf("ccm_auth_decrypt_check_status() wait: %lu us\n", - (uint32_t)((uint64_t)time2 * 1000000 / RTIMER_SECOND)); - - time = RTIMER_NOW(); - ret = ccm_auth_decrypt_get_result(mdata, vectors[i].mdata_len, - mic, vectors[i].mic_len); - time = RTIMER_NOW() - time; - total_time += time; - printf("ccm_auth_decrypt_get_result(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - continue; - } - - if(rom_util_memcmp(mdata, vectors[i].expected, - vectors[i].mdata_len - vectors[i].mic_len)) { - puts("Decrypted message does not match expected one"); - } else { - puts("Decrypted message OK"); - } - } - - printf("Total duration: %lu us\n", - (uint32_t)((uint64_t)total_time * 1000000 / RTIMER_SECOND)); - } - - puts("-----------------------------------------\n" - "Disabling cryptoprocessor..."); - crypto_disable(); - - puts("Done!"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/crypto/ctr-test.c b/examples/platform-specific/cc2538-common/crypto/ctr-test.c deleted file mode 100644 index 83ad242c7..000000000 --- a/examples/platform-specific/cc2538-common/crypto/ctr-test.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-ctr-test cc2538d AES-CTR Test Project - * - * AES-CTR access example for CC2538-based platforms - * - * This example shows how AES-CTR should be used. The example also verifies - * the AES-CTR functionality. - * - * @{ - * - * \file - * Example demonstrating AES-CTR - */ -#include "contiki.h" -#include "sys/rtimer.h" -#include "dev/rom-util.h" -#include "dev/ctr.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define NONCE_MAX_LEN 0 -#define ICTR_MAX_LEN 16 -#define MDATA_MAX_LEN 64 -/*---------------------------------------------------------------------------*/ -PROCESS(ctr_test_process, "ctr test process"); -AUTOSTART_PROCESSES(&ctr_test_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ctr_test_process, ev, data) -{ - static const char *const str_res[] = { - "success", - "invalid param", - "NULL error", - "resource in use", - "DMA bus error", - "keystore read error", - "keystore write error", - "authentication failed" - }; - static const uint8_t keys128[][128 / 8] = { - { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, - 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c } - }; - static const uint8_t keys192[][192 / 8] = { - { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, - 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, - 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b } - }; - static const uint8_t keys256[][256 / 8] = { - { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, - 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, - 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, - 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4 } - }; - static const struct { - const void *keys; - uint8_t key_size; - uint8_t count; - } keys[] = { - { keys128, AES_KEY_STORE_SIZE_KEY_SIZE_128, - sizeof(keys128) / sizeof(keys128[0]) }, - { keys192, AES_KEY_STORE_SIZE_KEY_SIZE_192, - sizeof(keys192) / sizeof(keys192[0]) }, - { keys256, AES_KEY_STORE_SIZE_KEY_SIZE_256, - sizeof(keys256) / sizeof(keys256[0]) } - }; - static const struct { - bool encrypt; - uint8_t key_size_index; - uint8_t key_area; - uint8_t nonce[NONCE_MAX_LEN]; - uint8_t ictr[ICTR_MAX_LEN]; - uint8_t ctr_len; - uint8_t mdata[MDATA_MAX_LEN]; - uint16_t mdata_len; - uint8_t expected[MDATA_MAX_LEN]; - } vectors[] = { - { - true, /* encrypt */ - 0, /* key_size_index */ - 0, /* key_area */ - {}, /* nonce */ - { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, /* ictr */ - 16, /* ctr_len */ - { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, - 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, - 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, - 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, - 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, - 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, - 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, - 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }, /* mdata */ - 64, /* mdata_len */ - { 0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26, - 0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce, - 0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff, - 0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff, - 0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e, - 0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab, - 0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1, - 0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 0, /* key_area */ - {}, /* nonce */ - { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, /* ictr */ - 16, /* ctr_len */ - { 0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26, - 0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce, - 0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff, - 0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff, - 0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e, - 0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab, - 0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1, - 0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee }, /* mdata */ - 64, /* mdata_len */ - { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, - 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, - 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, - 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, - 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, - 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, - 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, - 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 } /* expected */ - }, { - true, /* encrypt */ - 1, /* key_size_index */ - 0, /* key_area */ - {}, /* nonce */ - { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, /* ictr */ - 16, /* ctr_len */ - { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, - 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, - 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, - 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, - 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, - 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, - 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, - 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }, /* mdata */ - 64, /* mdata_len */ - { 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2, - 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b, - 0x09, 0x03, 0x39, 0xec, 0x0a, 0xa6, 0xfa, 0xef, - 0xd5, 0xcc, 0xc2, 0xc6, 0xf4, 0xce, 0x8e, 0x94, - 0x1e, 0x36, 0xb2, 0x6b, 0xd1, 0xeb, 0xc6, 0x70, - 0xd1, 0xbd, 0x1d, 0x66, 0x56, 0x20, 0xab, 0xf7, - 0x4f, 0x78, 0xa7, 0xf6, 0xd2, 0x98, 0x09, 0x58, - 0x5a, 0x97, 0xda, 0xec, 0x58, 0xc6, 0xb0, 0x50 } /* expected */ - }, { - false, /* encrypt */ - 1, /* key_size_index */ - 0, /* key_area */ - {}, /* nonce */ - { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, /* ictr */ - 16, /* ctr_len */ - { 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2, - 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b, - 0x09, 0x03, 0x39, 0xec, 0x0a, 0xa6, 0xfa, 0xef, - 0xd5, 0xcc, 0xc2, 0xc6, 0xf4, 0xce, 0x8e, 0x94, - 0x1e, 0x36, 0xb2, 0x6b, 0xd1, 0xeb, 0xc6, 0x70, - 0xd1, 0xbd, 0x1d, 0x66, 0x56, 0x20, 0xab, 0xf7, - 0x4f, 0x78, 0xa7, 0xf6, 0xd2, 0x98, 0x09, 0x58, - 0x5a, 0x97, 0xda, 0xec, 0x58, 0xc6, 0xb0, 0x50 }, /* mdata */ - 64, /* mdata_len */ - { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, - 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, - 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, - 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, - 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, - 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, - 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, - 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 } /* expected */ - }, { - true, /* encrypt */ - 2, /* key_size_index */ - 0, /* key_area */ - {}, /* nonce */ - { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, /* ictr */ - 16, /* ctr_len */ - { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, - 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, - 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, - 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, - 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, - 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, - 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, - 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }, /* mdata */ - 64, /* mdata_len */ - { 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5, - 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28, - 0xf4, 0x43, 0xe3, 0xca, 0x4d, 0x62, 0xb5, 0x9a, - 0xca, 0x84, 0xe9, 0x90, 0xca, 0xca, 0xf5, 0xc5, - 0x2b, 0x09, 0x30, 0xda, 0xa2, 0x3d, 0xe9, 0x4c, - 0xe8, 0x70, 0x17, 0xba, 0x2d, 0x84, 0x98, 0x8d, - 0xdf, 0xc9, 0xc5, 0x8d, 0xb6, 0x7a, 0xad, 0xa6, - 0x13, 0xc2, 0xdd, 0x08, 0x45, 0x79, 0x41, 0xa6 } /* expected */ - }, { - false, /* encrypt */ - 2, /* key_size_index */ - 0, /* key_area */ - {}, /* nonce */ - { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, /* ictr */ - 16, /* ctr_len */ - { 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5, - 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28, - 0xf4, 0x43, 0xe3, 0xca, 0x4d, 0x62, 0xb5, 0x9a, - 0xca, 0x84, 0xe9, 0x90, 0xca, 0xca, 0xf5, 0xc5, - 0x2b, 0x09, 0x30, 0xda, 0xa2, 0x3d, 0xe9, 0x4c, - 0xe8, 0x70, 0x17, 0xba, 0x2d, 0x84, 0x98, 0x8d, - 0xdf, 0xc9, 0xc5, 0x8d, 0xb6, 0x7a, 0xad, 0xa6, - 0x13, 0xc2, 0xdd, 0x08, 0x45, 0x79, 0x41, 0xa6 }, /* mdata */ - 64, /* mdata_len */ - { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, - 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, - 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, - 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, - 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, - 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, - 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, - 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 } /* expected */ - } - }; - static uint8_t mdata[MDATA_MAX_LEN]; - static int i; - static uint8_t key_size_index = -1, ret; - static int8_t res; - static rtimer_clock_t time, time2, total_time; - - PROCESS_BEGIN(); - - puts("-----------------------------------------\n" - "Initializing cryptoprocessor..."); - crypto_init(); - - for(i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) { - if(key_size_index != vectors[i].key_size_index) { - key_size_index = vectors[i].key_size_index; - printf("-----------------------------------------\n" - "Filling %d-bit key store...\n", 128 + (key_size_index << 6)); - time = RTIMER_NOW(); - ret = aes_load_keys(keys[key_size_index].keys, - keys[key_size_index].key_size, keys[key_size_index].count, 0); - time = RTIMER_NOW() - time; - printf("aes_load_keys(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - break; - } - } - - printf("-----------------------------------------\n" - "Test vector #%d: %s\n" - "key_area=%d ctr_len=%d mdata_len=%d\n", - i, vectors[i].encrypt ? "encrypt" : "decrypt", - vectors[i].key_area, vectors[i].ctr_len, vectors[i].mdata_len); - - /* mdata has to be in SRAM. */ - rom_util_memcpy(mdata, vectors[i].mdata, vectors[i].mdata_len); - - time = RTIMER_NOW(); - ret = ctr_crypt_start(vectors[i].encrypt, vectors[i].key_area, - vectors[i].nonce, vectors[i].ictr, vectors[i].ctr_len, - mdata, mdata, vectors[i].mdata_len, - &ctr_test_process); - time2 = RTIMER_NOW(); - time = time2 - time; - total_time = time; - if(ret == CRYPTO_SUCCESS) { - PROCESS_WAIT_EVENT_UNTIL((res = ctr_crypt_check_status()) != - CRYPTO_PENDING); - time2 = RTIMER_NOW() - time2; - total_time += time2; - } - printf("ctr_crypt_start(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - if(ret != CRYPTO_SUCCESS) { - PROCESS_PAUSE(); - continue; - } - printf("ctr_crypt_check_status() wait: %s, %lu us\n", str_res[res], - (uint32_t)((uint64_t)time2 * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(res != CRYPTO_SUCCESS) { - continue; - } - - if(rom_util_memcmp(mdata, vectors[i].expected, vectors[i].mdata_len)) { - puts("Output message does not match expected one"); - } else { - puts("Output message OK"); - } - - printf("Total duration: %lu us\n", - (uint32_t)((uint64_t)total_time * 1000000 / RTIMER_SECOND)); - } - - puts("-----------------------------------------\n" - "Disabling cryptoprocessor..."); - crypto_disable(); - - puts("Done!"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/crypto/ecb-test.c b/examples/platform-specific/cc2538-common/crypto/ecb-test.c deleted file mode 100644 index d7d2841cb..000000000 --- a/examples/platform-specific/cc2538-common/crypto/ecb-test.c +++ /dev/null @@ -1,662 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-ecb-test cc2538 AES-ECB Test Project - * - * AES-ECB access example for CC2538-based platforms - * - * This example shows how AES-ECB should be used. The example also verifies - * the AES-ECB functionality. - * - * @{ - * - * \file - * Example demonstrating AES-ECB - */ -#include "contiki.h" -#include "sys/rtimer.h" -#include "dev/rom-util.h" -#include "dev/ecb.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define MDATA_MAX_LEN 160 -/*---------------------------------------------------------------------------*/ -PROCESS(ecb_test_process, "ecb test process"); -AUTOSTART_PROCESSES(&ecb_test_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ecb_test_process, ev, data) -{ - static const char *const str_res[] = { - "success", - "invalid param", - "NULL error", - "resource in use", - "DMA bus error", - "keystore read error", - "keystore write error", - "authentication failed" - }; - static const uint8_t keys128[][128 / 8] = { - { 0xed, 0xfd, 0xb2, 0x57, 0xcb, 0x37, 0xcd, 0xf1, - 0x82, 0xc5, 0x45, 0x5b, 0x0c, 0x0e, 0xfe, 0xbb }, - { 0xef, 0x60, 0xfb, 0x14, 0x00, 0xc8, 0x39, 0x36, - 0x41, 0x4a, 0x25, 0x65, 0x1e, 0xb5, 0x1a, 0x1b }, - { 0x00, 0xcc, 0x73, 0xc9, 0x90, 0xd3, 0x76, 0xb8, - 0x22, 0x46, 0xe4, 0x5e, 0xa3, 0xae, 0x2e, 0x37 }, - { 0xeb, 0xea, 0x9c, 0x6a, 0x82, 0x21, 0x3a, 0x00, - 0xac, 0x1d, 0x22, 0xfa, 0xea, 0x22, 0x11, 0x6f }, - { 0x54, 0xb7, 0x60, 0xdd, 0x29, 0x68, 0xf0, 0x79, - 0xac, 0x1d, 0x5d, 0xd2, 0x06, 0x26, 0x44, 0x5d }, - { 0x9b, 0xa8, 0x52, 0x52, 0x0c, 0x9f, 0xd1, 0xeb, - 0x36, 0x7b, 0x6a, 0xd2, 0xae, 0xd0, 0x7a, 0xbd }, - { 0x8e, 0xc6, 0xa5, 0xa0, 0x54, 0xfe, 0xa2, 0xfc, - 0x8d, 0xaf, 0xb5, 0x93, 0x9a, 0x4b, 0xd7, 0x88 }, - { 0x44, 0xf0, 0xee, 0x62, 0x6d, 0x04, 0x46, 0xe0, - 0xa3, 0x92, 0x4c, 0xfb, 0x07, 0x89, 0x44, 0xbb } - }; - static const uint8_t keys192[][192 / 8] = { - { 0x61, 0x39, 0x6c, 0x53, 0x0c, 0xc1, 0x74, 0x9a, - 0x5b, 0xab, 0x6f, 0xbc, 0xf9, 0x06, 0xfe, 0x67, - 0x2d, 0x0c, 0x4a, 0xb2, 0x01, 0xaf, 0x45, 0x54 }, - { 0x4f, 0x41, 0xfa, 0x4d, 0x4a, 0x25, 0x10, 0x0b, - 0x58, 0x65, 0x51, 0x82, 0x83, 0x73, 0xbc, 0xca, - 0x55, 0x40, 0xc6, 0x8e, 0x9b, 0xf8, 0x45, 0x62 }, - { 0xf2, 0xd2, 0xb8, 0x22, 0x80, 0xc2, 0x59, 0x2e, - 0xcf, 0xbc, 0xf5, 0x00, 0xae, 0x64, 0x70, 0x78, - 0xc9, 0xc5, 0x76, 0x24, 0xcd, 0xe9, 0xbf, 0x6c }, - { 0x9c, 0xc2, 0x4e, 0xa1, 0xf1, 0x95, 0x9d, 0x9a, - 0x97, 0x2e, 0x71, 0x82, 0xef, 0x3b, 0x4e, 0x22, - 0xa9, 0x7a, 0x87, 0xd0, 0xda, 0x7f, 0xf6, 0x4b } - }; - static const uint8_t keys256[][256 / 8] = { - { 0xcc, 0x22, 0xda, 0x78, 0x7f, 0x37, 0x57, 0x11, - 0xc7, 0x63, 0x02, 0xbe, 0xf0, 0x97, 0x9d, 0x8e, - 0xdd, 0xf8, 0x42, 0x82, 0x9c, 0x2b, 0x99, 0xef, - 0x3d, 0xd0, 0x4e, 0x23, 0xe5, 0x4c, 0xc2, 0x4b }, - { 0x44, 0xa2, 0xb5, 0xa7, 0x45, 0x3e, 0x49, 0xf3, - 0x82, 0x61, 0x90, 0x4f, 0x21, 0xac, 0x79, 0x76, - 0x41, 0xd1, 0xbc, 0xd8, 0xdd, 0xed, 0xd2, 0x93, - 0xf3, 0x19, 0x44, 0x9f, 0xe6, 0x3b, 0x29, 0x48 }, - { 0xa8, 0x1f, 0xd6, 0xca, 0x56, 0x68, 0x3d, 0x0f, - 0x54, 0x45, 0x65, 0x9d, 0xde, 0x4d, 0x99, 0x5d, - 0xc6, 0x5f, 0x4b, 0xce, 0x20, 0x89, 0x63, 0x05, - 0x3e, 0x28, 0xd7, 0xf2, 0xdf, 0x51, 0x7c, 0xe4 }, - { 0xc4, 0xa7, 0x1e, 0x05, 0x5a, 0x72, 0x54, 0xdd, - 0xa3, 0x60, 0x69, 0x3f, 0xe1, 0xbe, 0x49, 0xf1, - 0x0f, 0xaa, 0x67, 0x31, 0xc3, 0x6d, 0xba, 0xa6, - 0x59, 0x0b, 0x05, 0x97, 0x4e, 0x18, 0x5c, 0x5b } - }; - static const struct { - const void *keys; - uint8_t key_size; - uint8_t count; - } keys[] = { - { keys128, AES_KEY_STORE_SIZE_KEY_SIZE_128, - sizeof(keys128) / sizeof(keys128[0]) }, - { keys192, AES_KEY_STORE_SIZE_KEY_SIZE_192, - sizeof(keys192) / sizeof(keys192[0]) }, - { keys256, AES_KEY_STORE_SIZE_KEY_SIZE_256, - sizeof(keys256) / sizeof(keys256[0]) } - }; - static const struct { - bool encrypt; - uint8_t key_size_index; - uint8_t key_area; - uint8_t mdata[MDATA_MAX_LEN]; - uint16_t mdata_len; - uint8_t expected[MDATA_MAX_LEN]; - } vectors[] = { - { - true, /* encrypt */ - 0, /* key_size_index */ - 0, /* key_area */ - { 0x16, 0x95, 0xfe, 0x47, 0x54, 0x21, 0xca, 0xce, - 0x35, 0x57, 0xda, 0xca, 0x01, 0xf4, 0x45, 0xff }, /* mdata */ - 16, /* mdata_len */ - { 0x78, 0x88, 0xbe, 0xae, 0x6e, 0x7a, 0x42, 0x63, - 0x32, 0xa7, 0xea, 0xa2, 0xf8, 0x08, 0xe6, 0x37 } /* expected */ - }, { - true, /* encrypt */ - 0, /* key_size_index */ - 1, /* key_area */ - { 0x59, 0x35, 0x59, 0x31, 0x8c, 0xc6, 0x6b, 0xf6, - 0x95, 0xe4, 0x9f, 0xeb, 0x42, 0x79, 0x4b, 0xdf, - 0xb6, 0x6b, 0xce, 0x89, 0x5e, 0xc2, 0x22, 0xca, - 0x26, 0x09, 0xb1, 0x33, 0xec, 0xf6, 0x6a, 0xc7, - 0x34, 0x4d, 0x13, 0x02, 0x1e, 0x01, 0xe1, 0x1a, - 0x96, 0x9c, 0x46, 0x84, 0xcb, 0xe2, 0x0a, 0xba, - 0xe2, 0xb1, 0x9d, 0x3c, 0xeb, 0x2c, 0xac, 0xd4, - 0x14, 0x19, 0xf2, 0x1f, 0x1c, 0x86, 0x51, 0x49 }, /* mdata */ - 64, /* mdata_len */ - { 0x3e, 0xa6, 0xf4, 0x30, 0x52, 0x17, 0xbd, 0x47, - 0xee, 0xbe, 0x77, 0x3d, 0xa4, 0xb5, 0x78, 0x54, - 0x9c, 0xac, 0x74, 0x4c, 0x00, 0xcb, 0xd8, 0xf9, - 0xd5, 0x96, 0xd3, 0x80, 0x10, 0x30, 0x4b, 0xd8, - 0x50, 0xcc, 0x2f, 0x4b, 0x19, 0xa9, 0x1c, 0x2e, - 0x02, 0x2e, 0xab, 0xf1, 0x00, 0x26, 0x61, 0x85, - 0xca, 0x27, 0x05, 0x12, 0x78, 0x15, 0xdf, 0xd4, - 0x6e, 0xfb, 0xe4, 0xec, 0xd4, 0x6a, 0x30, 0x58 } /* expected */ - }, { - true, /* encrypt */ - 0, /* key_size_index */ - 2, /* key_area */ - { 0x37, 0xa1, 0x20, 0x5e, 0xa9, 0x29, 0x35, 0x5d, - 0x2e, 0x4e, 0xe5, 0x2d, 0x5e, 0x1d, 0x9c, 0xda, - 0x27, 0x9a, 0xe0, 0x1e, 0x64, 0x02, 0x87, 0xcc, - 0xb1, 0x53, 0x27, 0x6e, 0x7e, 0x0e, 0xcf, 0x2d, - 0x63, 0x3c, 0xf4, 0xf2, 0xb3, 0xaf, 0xae, 0xcb, - 0x54, 0x8a, 0x25, 0x90, 0xce, 0x04, 0x45, 0xc6, - 0xa1, 0x68, 0xba, 0xc3, 0xdc, 0x60, 0x18, 0x13, - 0xeb, 0x74, 0x59, 0x1b, 0xb1, 0xce, 0x8d, 0xfc, - 0xd7, 0x40, 0xcd, 0xbb, 0x63, 0x88, 0x71, 0x9e, - 0x8c, 0xd2, 0x83, 0xd9, 0xcc, 0x7e, 0x73, 0x69, - 0x38, 0x24, 0x0b, 0x41, 0x0d, 0xd5, 0xa6, 0xa4, - 0x8b, 0xa4, 0x9d, 0xd2, 0x06, 0x65, 0x03, 0xe6, - 0x3a, 0xb5, 0x92, 0xff, 0xdf, 0x3b, 0xe4, 0x9e, - 0x7d, 0x2d, 0xe7, 0x4f, 0x82, 0x15, 0x8b, 0x8c }, /* mdata */ - 112, /* mdata_len */ - { 0xc8, 0x8e, 0x03, 0x38, 0x3b, 0xa9, 0xda, 0x6f, - 0x98, 0x2c, 0x05, 0x7f, 0xe9, 0x2c, 0x0b, 0xb3, - 0xed, 0x5b, 0x9c, 0xd1, 0x82, 0x95, 0xa1, 0x00, - 0xe1, 0x3a, 0x4e, 0x12, 0xd4, 0x40, 0xb9, 0x19, - 0xbb, 0xb8, 0xb2, 0x21, 0xab, 0xea, 0xd3, 0x62, - 0x90, 0x2c, 0xe4, 0x4d, 0x30, 0xd0, 0xb8, 0x0e, - 0x56, 0xbe, 0xe1, 0xf6, 0x6a, 0x7d, 0x8d, 0xe0, - 0xb1, 0xe1, 0xb4, 0xdb, 0xf7, 0x6c, 0x90, 0xc1, - 0x80, 0x7a, 0x3b, 0xc5, 0xf2, 0x77, 0xe9, 0x81, - 0x4c, 0x82, 0xab, 0x12, 0x0f, 0x7e, 0x10, 0x21, - 0x7d, 0xfd, 0xf6, 0x09, 0x2c, 0xe4, 0x95, 0x8f, - 0x89, 0x06, 0xc5, 0xe3, 0x22, 0x79, 0xc6, 0x53, - 0x7d, 0xd1, 0xfb, 0xae, 0x20, 0xcb, 0x7a, 0x1d, - 0x9f, 0x89, 0xd0, 0x49, 0x0b, 0x6a, 0xef, 0xc1 } /* expected */ - }, { - true, /* encrypt */ - 0, /* key_size_index */ - 3, /* key_area */ - { 0x45, 0x1f, 0x45, 0x66, 0x3b, 0x44, 0xfd, 0x00, - 0x5f, 0x3c, 0x28, 0x8a, 0xe5, 0x7b, 0x38, 0x38, - 0x83, 0xf0, 0x2d, 0x9a, 0xd3, 0xdc, 0x17, 0x15, - 0xf9, 0xe3, 0xd6, 0x94, 0x85, 0x64, 0x25, 0x7b, - 0x9b, 0x06, 0xd7, 0xdd, 0x51, 0x93, 0x5f, 0xee, - 0x58, 0x0a, 0x96, 0xbb, 0xdf, 0xef, 0xb9, 0x18, - 0xb4, 0xe6, 0xb1, 0xda, 0xac, 0x80, 0x98, 0x47, - 0x46, 0x55, 0x78, 0xcb, 0x8b, 0x53, 0x56, 0xed, - 0x38, 0x55, 0x6f, 0x80, 0x1f, 0xf7, 0xc1, 0x1e, - 0xcb, 0xa9, 0xcd, 0xd2, 0x63, 0x03, 0x9c, 0x15, - 0xd0, 0x59, 0x00, 0xfc, 0x22, 0x8e, 0x1c, 0xaf, - 0x30, 0x2d, 0x26, 0x1d, 0x7f, 0xb5, 0x6c, 0xee, - 0x66, 0x35, 0x95, 0xb9, 0x6f, 0x19, 0x2a, 0x78, - 0xff, 0x44, 0x55, 0x39, 0x3a, 0x5f, 0xe8, 0x16, - 0x21, 0x70, 0xa0, 0x66, 0xfd, 0xae, 0xac, 0x35, - 0x01, 0x94, 0x69, 0xf2, 0x2b, 0x34, 0x70, 0x68, - 0x6b, 0xce, 0xd2, 0xf0, 0x07, 0xa1, 0xa2, 0xe4, - 0x3e, 0x01, 0xb4, 0x56, 0x2c, 0xaa, 0xa5, 0x02, - 0xed, 0x54, 0x1b, 0x82, 0x05, 0x87, 0x4e, 0xc1, - 0xff, 0xb1, 0xc8, 0xb2, 0x55, 0x76, 0x69, 0x42 }, /* mdata */ - 160, /* mdata_len */ - { 0x01, 0x04, 0x30, 0x53, 0xf8, 0x32, 0xef, 0x9b, - 0x91, 0x1e, 0xd3, 0x87, 0xba, 0x57, 0x74, 0x51, - 0xe3, 0x0d, 0x51, 0xd4, 0xb6, 0xb1, 0x1f, 0x31, - 0x9d, 0x4c, 0xd5, 0x39, 0xd0, 0x67, 0xb7, 0xf4, - 0xf9, 0xb4, 0xf4, 0x1f, 0x7f, 0x3d, 0x4e, 0x92, - 0x0c, 0x57, 0xcb, 0xe2, 0xb5, 0xe1, 0x88, 0x5a, - 0xa6, 0x62, 0x03, 0xae, 0x49, 0x3e, 0x93, 0xa1, - 0xdf, 0x63, 0x79, 0x3a, 0x95, 0x63, 0xc1, 0x76, - 0xbc, 0x67, 0x75, 0xdd, 0x09, 0xcc, 0x91, 0x61, - 0xe2, 0x78, 0xa0, 0x1b, 0xeb, 0x8f, 0xd8, 0xa1, - 0x92, 0x00, 0x32, 0x6b, 0xd9, 0x5a, 0xbc, 0x5f, - 0x71, 0x67, 0x68, 0xe3, 0x4f, 0x90, 0xb5, 0x05, - 0x23, 0xd3, 0x0f, 0xda, 0xbb, 0x10, 0x3a, 0x3b, - 0xc0, 0x20, 0xaf, 0xbb, 0xb0, 0xcb, 0x3b, 0xd2, - 0xad, 0x51, 0x2a, 0x6f, 0xea, 0x79, 0xf8, 0xd6, - 0x4c, 0xef, 0x34, 0x74, 0x58, 0xde, 0xc4, 0x8b, - 0xe8, 0x94, 0x51, 0xcb, 0x0b, 0x80, 0x7d, 0x73, - 0x59, 0x3f, 0x27, 0x3d, 0x9f, 0xc5, 0x21, 0xb7, - 0x89, 0xa7, 0x75, 0x24, 0x40, 0x4f, 0x43, 0xe0, - 0x0f, 0x20, 0xb3, 0xb7, 0x7b, 0x93, 0x8b, 0x1a } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 4, /* key_area */ - { 0x06, 0x5b, 0xd5, 0xa9, 0x54, 0x0d, 0x22, 0xd5, - 0xd7, 0xb0, 0xf7, 0x5d, 0x66, 0xcb, 0x8b, 0x30 }, /* mdata */ - 16, /* mdata_len */ - { 0x46, 0xf2, 0xc9, 0x89, 0x32, 0x34, 0x9c, 0x33, - 0x8e, 0x9d, 0x67, 0xf7, 0x44, 0xa1, 0xc9, 0x88 } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 5, /* key_area */ - { 0x6c, 0x53, 0x48, 0x9f, 0x6a, 0x4b, 0xd0, 0xf7, - 0xcd, 0x15, 0xd2, 0x0f, 0x6e, 0xbc, 0x7e, 0x64, - 0x9f, 0xd9, 0x5b, 0x76, 0xb1, 0x07, 0xe6, 0xda, - 0xba, 0x96, 0x7c, 0x8a, 0x94, 0x84, 0x79, 0x7f, - 0x29, 0xa8, 0xa2, 0x82, 0xee, 0x31, 0xc0, 0x3f, - 0xae, 0x4f, 0x8e, 0x9b, 0x89, 0x30, 0xd5, 0x47, - 0x3c, 0x2e, 0xd6, 0x95, 0xa3, 0x47, 0xe8, 0x8b, - 0x7c, 0xcd, 0x62, 0x37, 0x6d, 0x5e, 0xbb, 0x41 }, /* mdata */ - 64, /* mdata_len */ - { 0x60, 0x61, 0xdf, 0x5b, 0xcd, 0x42, 0x1f, 0xab, - 0xdb, 0x52, 0x35, 0xfc, 0x03, 0x25, 0x02, 0x65, - 0x04, 0x48, 0xfd, 0x82, 0x33, 0xa0, 0x23, 0x7c, - 0x5f, 0x6f, 0x24, 0x9a, 0x63, 0xd7, 0xdb, 0x3e, - 0x42, 0x83, 0xac, 0x9a, 0x86, 0x84, 0xa3, 0x63, - 0xef, 0x64, 0xe7, 0x60, 0xc5, 0x88, 0x65, 0x64, - 0x65, 0x9d, 0xa6, 0x19, 0x46, 0x68, 0x51, 0x56, - 0x8b, 0x32, 0x09, 0x1d, 0xf5, 0x51, 0x6f, 0x57 } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 6, /* key_area */ - { 0x4d, 0x6f, 0x97, 0x29, 0x46, 0xa2, 0xe4, 0xca, - 0x05, 0xbf, 0xbe, 0xec, 0xd0, 0x05, 0x35, 0xec, - 0xe6, 0xc8, 0x1e, 0xd9, 0x63, 0xc4, 0x16, 0x70, - 0x63, 0xb1, 0xc3, 0x4b, 0x6a, 0x18, 0x5d, 0x55, - 0x04, 0x64, 0x6d, 0x81, 0xa8, 0x3c, 0xd5, 0xbc, - 0xe2, 0x10, 0x11, 0x20, 0xb2, 0xf2, 0xbc, 0x6a, - 0x2f, 0xa8, 0x56, 0xae, 0x6f, 0xff, 0x44, 0x49, - 0xab, 0x62, 0x18, 0x18, 0x9f, 0xaa, 0x13, 0xe7, - 0x30, 0x38, 0xe8, 0x2c, 0x51, 0x41, 0xc3, 0xf6, - 0x27, 0x6a, 0x8a, 0x20, 0x6b, 0x95, 0x63, 0xca, - 0x11, 0xfa, 0x76, 0x09, 0x27, 0x79, 0xf4, 0xde, - 0xff, 0x2e, 0x58, 0x65, 0x90, 0x47, 0xed, 0x4f, - 0x1a, 0x12, 0x90, 0x92, 0x09, 0x5a, 0xb7, 0x5f, - 0x1c, 0xf4, 0xb2, 0x55, 0xc6, 0x95, 0x31, 0xf4 }, /* mdata */ - 112, /* mdata_len */ - { 0x6e, 0x19, 0xce, 0xc7, 0x75, 0x59, 0x5c, 0x2f, - 0x76, 0x8d, 0xe3, 0xbd, 0xa3, 0x68, 0x2f, 0xb4, - 0x02, 0x6e, 0xd1, 0x88, 0x9f, 0xc3, 0xde, 0x11, - 0xbc, 0x45, 0xa2, 0xa3, 0xe2, 0xb2, 0x26, 0x94, - 0xdd, 0xaa, 0xb3, 0x27, 0x4c, 0x81, 0xb2, 0x92, - 0x04, 0xfa, 0x03, 0x4e, 0xed, 0xac, 0x56, 0x4a, - 0x7d, 0xfe, 0x27, 0xaa, 0xbb, 0x6f, 0xf4, 0x20, - 0xf9, 0xaa, 0x5a, 0xba, 0xdf, 0x15, 0xc7, 0x46, - 0x76, 0xef, 0xea, 0xbd, 0x96, 0xa7, 0xff, 0x24, - 0x91, 0x81, 0x3b, 0xa5, 0x3c, 0xb5, 0xab, 0x76, - 0xea, 0xcd, 0x37, 0x25, 0x5a, 0x28, 0xda, 0xec, - 0xbb, 0xe5, 0x80, 0xf5, 0xeb, 0x77, 0xf9, 0xbc, - 0x03, 0x39, 0xe0, 0xda, 0x59, 0xb2, 0xb3, 0x07, - 0xf5, 0x29, 0x74, 0xb6, 0x18, 0x2c, 0xb1, 0x06 } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 7, /* key_area */ - { 0x93, 0x1b, 0x2f, 0x5f, 0x3a, 0x58, 0x20, 0xd5, - 0x3a, 0x6b, 0xea, 0xaa, 0x64, 0x31, 0x08, 0x3a, - 0x34, 0x88, 0xf4, 0xeb, 0x03, 0xb0, 0xf5, 0xb5, - 0x7e, 0xf8, 0x38, 0xe1, 0x57, 0x96, 0x23, 0x10, - 0x3b, 0xd6, 0xe6, 0x80, 0x03, 0x77, 0x53, 0x8b, - 0x2e, 0x51, 0xef, 0x70, 0x8f, 0x3c, 0x49, 0x56, - 0x43, 0x2e, 0x8a, 0x8e, 0xe6, 0xa3, 0x4e, 0x19, - 0x06, 0x42, 0xb2, 0x6a, 0xd8, 0xbd, 0xae, 0x6c, - 0x2a, 0xf9, 0xa6, 0xc7, 0x99, 0x6f, 0x3b, 0x60, - 0x04, 0xd2, 0x67, 0x1e, 0x41, 0xf1, 0xc9, 0xf4, - 0x0e, 0xe0, 0x3d, 0x1c, 0x4a, 0x52, 0xb0, 0xa0, - 0x65, 0x4a, 0x33, 0x1f, 0x15, 0xf3, 0x4d, 0xce, - 0x4a, 0xcb, 0x96, 0xbd, 0x65, 0x07, 0x81, 0x5c, - 0xa4, 0x34, 0x7a, 0x3d, 0xe1, 0x1a, 0x31, 0x1b, - 0x7d, 0xe5, 0x35, 0x1c, 0x97, 0x87, 0xc4, 0x53, - 0x81, 0x58, 0xe2, 0x89, 0x74, 0xff, 0xa8, 0x3d, - 0x82, 0x96, 0xdf, 0xe9, 0xcd, 0x09, 0xcd, 0x87, - 0xf7, 0xbf, 0x4f, 0x54, 0xd9, 0x7d, 0x28, 0xd4, - 0x78, 0x87, 0x99, 0x16, 0x34, 0x08, 0x32, 0x39, - 0x43, 0xb3, 0xe7, 0x2f, 0x5e, 0xab, 0x66, 0xc1 }, /* mdata */ - 160, /* mdata_len */ - { 0x9c, 0x29, 0xee, 0xcb, 0x2d, 0xe0, 0x42, 0x54, - 0xfa, 0xfb, 0x89, 0x6a, 0x99, 0x41, 0x02, 0xd1, - 0xda, 0x30, 0xdd, 0xb4, 0x9d, 0x82, 0x72, 0x8e, - 0xb2, 0x3d, 0xbd, 0x02, 0x99, 0x01, 0xe9, 0xb7, - 0x5b, 0x3d, 0x0a, 0xee, 0x03, 0xf7, 0xa0, 0x5f, - 0x6c, 0x85, 0x2d, 0x8f, 0xad, 0xa0, 0xb5, 0xc2, - 0x8e, 0x8c, 0x9a, 0xed, 0x33, 0x4f, 0xad, 0x11, - 0x82, 0x9d, 0xf3, 0xdf, 0xad, 0xc5, 0xc2, 0xe4, - 0x71, 0xeb, 0x41, 0xaf, 0x9e, 0x48, 0xa8, 0xa4, - 0x65, 0xe0, 0x3d, 0x5e, 0xbd, 0xb0, 0x21, 0x69, - 0x15, 0x08, 0x1f, 0x3b, 0x5a, 0x0e, 0xbb, 0x23, - 0x08, 0xdf, 0xc2, 0xd2, 0x8e, 0x5a, 0x8b, 0xa3, - 0xf3, 0x2a, 0xda, 0xe4, 0xc3, 0x57, 0x59, 0x21, - 0xbc, 0x65, 0x7b, 0x63, 0xd4, 0x6b, 0xa5, 0xa6, - 0x18, 0x88, 0x0e, 0xe9, 0xad, 0x8a, 0xf3, 0xfb, - 0xa5, 0x64, 0x3a, 0x50, 0x26, 0xfa, 0xcd, 0x7d, - 0x66, 0x7c, 0xe5, 0x99, 0x32, 0x7f, 0x93, 0x6c, - 0xdd, 0xa7, 0xe1, 0xbb, 0x74, 0x2a, 0x33, 0xa0, - 0x19, 0x99, 0x0b, 0x76, 0xbe, 0x64, 0x8a, 0x6e, - 0xc7, 0x25, 0xda, 0xed, 0x54, 0x0e, 0xd9, 0xe7 } /* expected */ - }, { - true, /* encrypt */ - 1, /* key_size_index */ - 0, /* key_area */ - { 0x60, 0xbc, 0xdb, 0x94, 0x16, 0xba, 0xc0, 0x8d, - 0x7f, 0xd0, 0xd7, 0x80, 0x35, 0x37, 0x40, 0xa5 }, /* mdata */ - 16, /* mdata_len */ - { 0x24, 0xf4, 0x0c, 0x4e, 0xec, 0xd9, 0xc4, 0x98, - 0x25, 0x00, 0x0f, 0xcb, 0x49, 0x72, 0x64, 0x7a } /* expected */ - }, { - true, /* encrypt */ - 1, /* key_size_index */ - 2, /* key_area */ - { 0x7c, 0x72, 0x7b, 0xd3, 0xe7, 0x04, 0x8e, 0x7a, - 0x89, 0x95, 0xb7, 0xb1, 0x16, 0x9a, 0xe4, 0xb5, - 0xa5, 0x5e, 0x85, 0x4b, 0xb4, 0xf7, 0xa9, 0x57, - 0x6d, 0x78, 0x63, 0xab, 0x28, 0x68, 0x73, 0x1d, - 0x30, 0x73, 0x22, 0xdc, 0xca, 0x60, 0x6e, 0x04, - 0x73, 0x43, 0x67, 0x6f, 0x6a, 0xf4, 0xd9, 0xcf, - 0x6e, 0xbf, 0x2b, 0xf9, 0xc9, 0x5d, 0x87, 0x84, - 0x8d, 0x23, 0x3c, 0x93, 0x1e, 0x7a, 0x60, 0xef, - 0xf0, 0x8f, 0xb9, 0x59, 0x92, 0x4c, 0xde, 0x1e, - 0xec, 0x86, 0x99, 0xeb, 0xc5, 0x78, 0x90, 0xe3, - 0x88, 0x70, 0x24, 0xef, 0x47, 0xc8, 0x9a, 0x55, - 0x00, 0x18, 0x78, 0x8d, 0x1f, 0xaa, 0x32, 0x50, - 0x45, 0x2e, 0x06, 0xf1, 0x48, 0xaf, 0x25, 0xf0, - 0x7b, 0xc6, 0x13, 0xcd, 0x2f, 0x0e, 0x50, 0x1a, - 0x79, 0xd7, 0x38, 0xd4, 0x36, 0x1f, 0x28, 0xf3, - 0x4d, 0xbe, 0xe2, 0x40, 0x34, 0xe0, 0x33, 0x67, - 0xb6, 0xb8, 0xd3, 0x4d, 0xf3, 0x73, 0x8c, 0xa3, - 0xa8, 0x6b, 0x9e, 0xbc, 0xb0, 0x9e, 0x63, 0x9b, - 0xcb, 0x5e, 0x2f, 0x51, 0x9f, 0x4a, 0x7a, 0x86, - 0xfc, 0x7c, 0x41, 0x55, 0x64, 0x04, 0xa9, 0x5d }, /* mdata */ - 160, /* mdata_len */ - { 0x92, 0x28, 0x12, 0xad, 0x5f, 0xea, 0xcd, 0xf1, - 0x1f, 0xe7, 0xfd, 0xae, 0x96, 0x30, 0x01, 0x49, - 0x41, 0x9e, 0x31, 0xcf, 0xf5, 0x40, 0x61, 0xb3, - 0xc5, 0xed, 0x27, 0xfd, 0xb8, 0xb5, 0x0c, 0x9c, - 0x09, 0x32, 0xb5, 0x22, 0xa6, 0xc0, 0x4e, 0x48, - 0x24, 0x99, 0xb0, 0x11, 0xef, 0x3c, 0x3e, 0x9d, - 0xc5, 0x6a, 0x1a, 0x61, 0xcf, 0xeb, 0x78, 0xb3, - 0x40, 0x32, 0xd2, 0x6d, 0xbd, 0xc3, 0xca, 0xc5, - 0x1a, 0x32, 0x79, 0xbc, 0x93, 0x4b, 0x9b, 0xce, - 0x2d, 0x9c, 0x19, 0xbf, 0x85, 0x82, 0x35, 0x61, - 0x3b, 0xa7, 0x84, 0xe4, 0x8e, 0x29, 0x2d, 0x22, - 0xc6, 0xb5, 0xa2, 0x8e, 0x1d, 0x1b, 0xb8, 0x60, - 0x52, 0x4f, 0xb7, 0xb5, 0xf9, 0xb3, 0xd9, 0xa5, - 0xf4, 0xda, 0x66, 0xe3, 0x40, 0x58, 0x5b, 0xd2, - 0x49, 0x6f, 0xe6, 0xd6, 0x94, 0x2d, 0xb8, 0xd0, - 0x5d, 0x71, 0x6f, 0xec, 0x03, 0xb1, 0x7d, 0x19, - 0xab, 0xb5, 0x8b, 0x33, 0x33, 0x2e, 0x24, 0xbe, - 0xae, 0xc7, 0x99, 0x5d, 0x69, 0x52, 0x53, 0x64, - 0xfe, 0x13, 0x9a, 0xa1, 0xfd, 0x62, 0x05, 0x46, - 0x68, 0xc5, 0x8f, 0x23, 0xf1, 0xf9, 0x4c, 0xfd } /* expected */ - }, { - false, /* encrypt */ - 1, /* key_size_index */ - 4, /* key_area */ - { 0x21, 0xc8, 0x22, 0x9a, 0x4d, 0xce, 0xaf, 0x53, - 0x3f, 0xe4, 0xe9, 0x6e, 0xce, 0xd4, 0x82, 0xa6 }, /* mdata */ - 16, /* mdata_len */ - { 0x49, 0xaa, 0xbe, 0x67, 0xda, 0x53, 0x22, 0xb6, - 0xe1, 0x1d, 0x63, 0xb7, 0x8b, 0x5a, 0x0e, 0x15 } /* expected */ - }, { - false, /* encrypt */ - 1, /* key_size_index */ - 6, /* key_area */ - { 0x95, 0x2f, 0x45, 0x46, 0xa8, 0xbf, 0x71, 0x66, - 0x96, 0x49, 0x17, 0xec, 0xe0, 0x1b, 0xda, 0x3c, - 0x68, 0x57, 0xe4, 0x27, 0xce, 0xf5, 0xda, 0x0f, - 0xf9, 0x0b, 0x0e, 0x4b, 0xf4, 0x4c, 0xf7, 0xcc, - 0xfc, 0xcf, 0xdf, 0x01, 0xd7, 0x13, 0xdc, 0xf9, - 0x67, 0x3f, 0x01, 0xc8, 0x7e, 0xae, 0xd5, 0x2b, - 0xf4, 0xaa, 0x04, 0x6f, 0xf7, 0x78, 0x55, 0x8e, - 0xa3, 0x96, 0xdc, 0x9c, 0xd2, 0x40, 0x71, 0x61, - 0x36, 0x38, 0x61, 0x48, 0xa5, 0xc7, 0x63, 0x78, - 0xb3, 0xff, 0xcd, 0x40, 0x86, 0x44, 0x07, 0xb8, - 0xe6, 0x0b, 0x40, 0xa5, 0x94, 0xe0, 0x61, 0x9e, - 0xdd, 0xae, 0x3f, 0x6d, 0x6e, 0x3b, 0x15, 0xb8, - 0x6a, 0xf2, 0x31, 0xe1, 0xba, 0xe5, 0xed, 0x2a, - 0xa5, 0x12, 0xe1, 0x1d, 0xa0, 0xe5, 0x57, 0x2b, - 0x67, 0xff, 0xff, 0x93, 0x4c, 0x36, 0xe5, 0x85, - 0xcf, 0xdd, 0x9f, 0x87, 0x70, 0x45, 0xcb, 0x19, - 0xc1, 0x83, 0xb9, 0x94, 0xbf, 0x74, 0x64, 0x58, - 0x62, 0xff, 0xa7, 0x26, 0x73, 0x9a, 0xad, 0xcb, - 0x9e, 0x10, 0xaa, 0xff, 0xc8, 0x81, 0xc8, 0x8c, - 0xa3, 0xaa, 0x65, 0xb3, 0x7f, 0x66, 0x7b, 0xcb }, /* mdata */ - 160, /* mdata_len */ - { 0xb8, 0xbb, 0x5c, 0xe5, 0x3a, 0x15, 0xaa, 0x6d, - 0xfd, 0xf2, 0xcb, 0x61, 0xbc, 0x8e, 0x36, 0x17, - 0xd1, 0xd0, 0xfe, 0xfe, 0x9b, 0xa5, 0xd1, 0x75, - 0x55, 0x04, 0x70, 0xe3, 0x23, 0x97, 0xf6, 0xf3, - 0xb3, 0xe6, 0x5b, 0x43, 0xbd, 0xed, 0x2b, 0x21, - 0xe5, 0xc1, 0x81, 0xd3, 0xc4, 0xc4, 0xc5, 0x26, - 0xc4, 0x1c, 0xea, 0xb0, 0x44, 0x28, 0x95, 0x08, - 0x45, 0x80, 0x48, 0xb6, 0x33, 0x52, 0xdf, 0xc3, - 0x79, 0xde, 0x37, 0x3f, 0xd1, 0x9a, 0x2c, 0x90, - 0x0c, 0x43, 0x52, 0x4b, 0x75, 0x94, 0x9e, 0x67, - 0x7c, 0xce, 0xda, 0x86, 0x6f, 0x7f, 0x2b, 0xcc, - 0x48, 0x44, 0xef, 0x2e, 0x5d, 0xac, 0x5b, 0x80, - 0x4b, 0x40, 0x45, 0xe6, 0x57, 0xc8, 0x15, 0x6d, - 0x1d, 0xcd, 0xb4, 0x3c, 0xbf, 0x2f, 0x5e, 0x00, - 0xa4, 0xf9, 0x25, 0x5e, 0x3b, 0xe2, 0x43, 0x94, - 0x36, 0xc4, 0xd0, 0x44, 0x9a, 0x8d, 0x2c, 0x4c, - 0x1a, 0x56, 0xbe, 0xce, 0x98, 0xea, 0x0f, 0xd6, - 0x8a, 0xba, 0xf1, 0x23, 0x98, 0x03, 0x99, 0x94, - 0xae, 0xbf, 0xfc, 0x69, 0x2b, 0x90, 0x00, 0xe5, - 0x80, 0x47, 0x9b, 0x4f, 0x4b, 0x28, 0xb5, 0xfe } /* expected */ - }, { - true, /* encrypt */ - 2, /* key_size_index */ - 0, /* key_area */ - { 0xcc, 0xc6, 0x2c, 0x6b, 0x0a, 0x09, 0xa6, 0x71, - 0xd6, 0x44, 0x56, 0x81, 0x8d, 0xb2, 0x9a, 0x4d }, /* mdata */ - 16, /* mdata_len */ - { 0xdf, 0x86, 0x34, 0xca, 0x02, 0xb1, 0x3a, 0x12, - 0x5b, 0x78, 0x6e, 0x1d, 0xce, 0x90, 0x65, 0x8b } /* expected */ - }, { - true, /* encrypt */ - 2, /* key_size_index */ - 2, /* key_area */ - { 0xc9, 0x1b, 0x8a, 0x7b, 0x9c, 0x51, 0x17, 0x84, - 0xb6, 0xa3, 0x7f, 0x73, 0xb2, 0x90, 0x51, 0x6b, - 0xb9, 0xef, 0x1e, 0x8d, 0xf6, 0x8d, 0x89, 0xbf, - 0x49, 0x16, 0x9e, 0xac, 0x40, 0x39, 0x65, 0x0c, - 0x43, 0x07, 0xb6, 0x26, 0x0e, 0x9c, 0x4e, 0x93, - 0x65, 0x02, 0x23, 0x44, 0x02, 0x52, 0xf5, 0xc7, - 0xd3, 0x1c, 0x26, 0xc5, 0x62, 0x09, 0xcb, 0xd0, - 0x95, 0xbf, 0x03, 0x5b, 0x97, 0x05, 0x88, 0x0a, - 0x16, 0x28, 0x83, 0x2d, 0xaf, 0x9d, 0xa5, 0x87, - 0xa6, 0xe7, 0x73, 0x53, 0xdb, 0xbc, 0xe1, 0x89, - 0xf9, 0x63, 0x23, 0x5d, 0xf1, 0x60, 0xc0, 0x08, - 0xa7, 0x53, 0xe8, 0xcc, 0xea, 0x1e, 0x07, 0x32, - 0xaa, 0x46, 0x9a, 0x97, 0x65, 0x9c, 0x42, 0xe6, - 0xe3, 0x1c, 0x16, 0xa7, 0x23, 0x15, 0x3e, 0x39, - 0x95, 0x8a, 0xbe, 0x5b, 0x8a, 0xd8, 0x8f, 0xf2, - 0xe8, 0x9a, 0xf4, 0x06, 0x22, 0xca, 0x0b, 0x0d, - 0x67, 0x29, 0xa2, 0x6c, 0x1a, 0xe0, 0x4d, 0x3b, - 0x83, 0x67, 0xb5, 0x48, 0xc4, 0xa6, 0x33, 0x5f, - 0x0e, 0x5a, 0x9e, 0xc9, 0x14, 0xbb, 0x61, 0x13, - 0xc0, 0x5c, 0xd0, 0x11, 0x25, 0x52, 0xbc, 0x21 }, /* mdata */ - 160, /* mdata_len */ - { 0x05, 0xd5, 0x1a, 0xf0, 0xe2, 0xb6, 0x1e, 0x2c, - 0x06, 0xcb, 0x1e, 0x84, 0x3f, 0xee, 0x31, 0x72, - 0x82, 0x5e, 0x63, 0xb5, 0xd1, 0xce, 0x81, 0x83, - 0xb7, 0xe1, 0xdb, 0x62, 0x68, 0xdb, 0x5a, 0xa7, - 0x26, 0x52, 0x1f, 0x46, 0xe9, 0x48, 0x02, 0x8a, - 0xa4, 0x43, 0xaf, 0x9e, 0xbd, 0x8b, 0x7c, 0x6b, - 0xaf, 0x95, 0x80, 0x67, 0xab, 0x0d, 0x4a, 0x8a, - 0xc5, 0x30, 0xec, 0xbb, 0x68, 0xcd, 0xfc, 0x3e, - 0xb9, 0x30, 0x34, 0xa4, 0x28, 0xeb, 0x7e, 0x8f, - 0x6a, 0x38, 0x13, 0xce, 0xa6, 0x18, 0x90, 0x68, - 0xdf, 0xec, 0xfa, 0x26, 0x8b, 0x7e, 0xcd, 0x59, - 0x87, 0xf8, 0xcb, 0x27, 0x32, 0xc6, 0x88, 0x2b, - 0xbe, 0xc8, 0xf7, 0x16, 0xba, 0xc2, 0x54, 0xd7, - 0x22, 0x69, 0x23, 0x0a, 0xec, 0x5d, 0xc7, 0xf5, - 0xa6, 0xb8, 0x66, 0xfd, 0x30, 0x52, 0x42, 0x55, - 0x2d, 0x40, 0x0f, 0x5b, 0x04, 0x04, 0xf1, 0x9c, - 0xbf, 0xe7, 0x29, 0x1f, 0xab, 0x69, 0x0e, 0xcf, - 0xe6, 0x01, 0x8c, 0x43, 0x09, 0xfc, 0x63, 0x9d, - 0x1b, 0x65, 0xfc, 0xb6, 0x5e, 0x64, 0x3e, 0xdb, - 0x0a, 0xd1, 0xf0, 0x9c, 0xfe, 0x9c, 0xee, 0x4a } /* expected */ - }, { - false, /* encrypt */ - 2, /* key_size_index */ - 4, /* key_area */ - { 0x41, 0x54, 0xc0, 0xbe, 0x71, 0x07, 0x29, 0x45, - 0xd8, 0x15, 0x6f, 0x5f, 0x04, 0x6d, 0x19, 0x8d }, /* mdata */ - 16, /* mdata_len */ - { 0x8b, 0x2b, 0x1b, 0x22, 0xf7, 0x33, 0xac, 0x09, - 0xd1, 0x19, 0x6d, 0x6b, 0xe6, 0xa8, 0x7a, 0x72 } /* expected */ - }, { - false, /* encrypt */ - 2, /* key_size_index */ - 6, /* key_area */ - { 0x2c, 0x48, 0x7f, 0xa9, 0x6f, 0x40, 0x90, 0xc5, - 0x6a, 0xa1, 0xb5, 0xbe, 0x81, 0x91, 0x8a, 0x93, - 0x4c, 0x94, 0x92, 0x87, 0x8f, 0xb0, 0xcd, 0x68, - 0x6d, 0xcf, 0x8d, 0x17, 0xd8, 0x64, 0x85, 0x45, - 0x4c, 0x51, 0x23, 0x7b, 0xbd, 0x09, 0x20, 0x5d, - 0xce, 0xf1, 0x55, 0x2f, 0x43, 0x0d, 0xd0, 0x98, - 0xb9, 0xd8, 0x27, 0xa6, 0x94, 0x73, 0x0c, 0x13, - 0x3a, 0x02, 0x22, 0xc7, 0x7f, 0x54, 0x0f, 0x9d, - 0x5f, 0xc2, 0xd3, 0x6a, 0xf3, 0x59, 0x58, 0x3c, - 0x9e, 0x3b, 0x49, 0xdf, 0x88, 0x42, 0x28, 0xa6, - 0x4d, 0xe7, 0x9b, 0x67, 0xf6, 0x62, 0x07, 0xc8, - 0x28, 0x13, 0x60, 0xb9, 0x9b, 0x21, 0x40, 0x42, - 0xce, 0x61, 0x36, 0x7f, 0xf9, 0x79, 0x60, 0xe9, - 0x44, 0x45, 0x3c, 0xd6, 0x36, 0x79, 0xbb, 0x44, - 0x70, 0x88, 0x97, 0xd2, 0x9b, 0xc5, 0xe7, 0x0f, - 0x9f, 0xc8, 0xf1, 0xf7, 0x15, 0x14, 0x3f, 0xbb, - 0x00, 0xf7, 0xf5, 0xc1, 0xb7, 0xb1, 0x61, 0xec, - 0x26, 0xd8, 0xd4, 0x1d, 0x36, 0xfa, 0xb0, 0xfa, - 0x8a, 0x85, 0xc3, 0xee, 0x6c, 0xe4, 0xd3, 0x70, - 0x07, 0xeb, 0x7a, 0x89, 0xd6, 0x75, 0x35, 0x90 }, /* mdata */ - 160, /* mdata_len */ - { 0x31, 0xfd, 0x5a, 0x30, 0x7e, 0x27, 0x9b, 0x2f, - 0x34, 0x58, 0x1e, 0x2c, 0x43, 0x23, 0x79, 0xdf, - 0x8e, 0xcc, 0xba, 0xf7, 0x95, 0x32, 0x93, 0x89, - 0x16, 0x71, 0x1c, 0xd3, 0x77, 0x54, 0x0b, 0x90, - 0x45, 0x37, 0x3e, 0x47, 0xf2, 0x21, 0x4b, 0x8f, - 0x87, 0x60, 0x40, 0xaf, 0x73, 0x3f, 0x6c, 0x9d, - 0x8f, 0x03, 0xa7, 0xc5, 0x8f, 0x87, 0x14, 0xd2, - 0xfb, 0xb4, 0xc1, 0x4a, 0xf5, 0x9c, 0x75, 0xb4, - 0x83, 0xad, 0xc7, 0x18, 0x94, 0x6e, 0xe9, 0x07, - 0xa1, 0x82, 0x86, 0xcc, 0x4e, 0xfd, 0x20, 0x67, - 0x89, 0x06, 0x4b, 0x6f, 0x1b, 0x19, 0x5f, 0x0d, - 0x0d, 0x23, 0x44, 0x68, 0xe4, 0xf0, 0x0e, 0x6f, - 0x1c, 0xad, 0x5c, 0xd3, 0xb9, 0xc0, 0xa6, 0x43, - 0xb3, 0xc0, 0xdd, 0x09, 0x28, 0x0f, 0xf2, 0xe2, - 0xa5, 0x92, 0x91, 0x83, 0x40, 0x93, 0x84, 0xdd, - 0x72, 0xdc, 0x94, 0xe3, 0x96, 0x87, 0xea, 0x2b, - 0x62, 0x3d, 0x5d, 0x77, 0x67, 0x00, 0xbd, 0x8b, - 0x36, 0xe6, 0x13, 0x0f, 0xfd, 0xe9, 0x66, 0xf1, - 0x34, 0xc4, 0xb1, 0xf3, 0x5f, 0x29, 0xc5, 0xcc, - 0x4a, 0x03, 0x29, 0x7e, 0x1c, 0xcc, 0x95, 0x39 } /* expected */ - } - }; - static uint8_t mdata[MDATA_MAX_LEN]; - static int i; - static uint8_t key_size_index = -1, ret; - static int8_t res; - static rtimer_clock_t time, time2, total_time; - - PROCESS_BEGIN(); - - puts("-----------------------------------------\n" - "Initializing cryptoprocessor..."); - crypto_init(); - - for(i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) { - if(key_size_index != vectors[i].key_size_index) { - key_size_index = vectors[i].key_size_index; - printf("-----------------------------------------\n" - "Filling %d-bit key store...\n", 128 + (key_size_index << 6)); - time = RTIMER_NOW(); - ret = aes_load_keys(keys[key_size_index].keys, - keys[key_size_index].key_size, keys[key_size_index].count, 0); - time = RTIMER_NOW() - time; - printf("aes_load_keys(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - break; - } - } - - printf("-----------------------------------------\n" - "Test vector #%d: %s\n" - "key_area=%d mdata_len=%d\n", - i, vectors[i].encrypt ? "encrypt" : "decrypt", - vectors[i].key_area, vectors[i].mdata_len); - - /* mdata has to be in SRAM. */ - rom_util_memcpy(mdata, vectors[i].mdata, vectors[i].mdata_len); - - time = RTIMER_NOW(); - ret = ecb_crypt_start(vectors[i].encrypt, vectors[i].key_area, mdata, mdata, - vectors[i].mdata_len, &ecb_test_process); - time2 = RTIMER_NOW(); - time = time2 - time; - total_time = time; - if(ret == CRYPTO_SUCCESS) { - PROCESS_WAIT_EVENT_UNTIL((res = ecb_crypt_check_status()) != - CRYPTO_PENDING); - time2 = RTIMER_NOW() - time2; - total_time += time2; - } - printf("ecb_crypt_start(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - if(ret != CRYPTO_SUCCESS) { - PROCESS_PAUSE(); - continue; - } - printf("ecb_crypt_check_status() wait: %s, %lu us\n", str_res[res], - (uint32_t)((uint64_t)time2 * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(res != CRYPTO_SUCCESS) { - continue; - } - - if(rom_util_memcmp(mdata, vectors[i].expected, vectors[i].mdata_len)) { - puts("Output message does not match expected one"); - } else { - puts("Output message OK"); - } - - printf("Total duration: %lu us\n", - (uint32_t)((uint64_t)total_time * 1000000 / RTIMER_SECOND)); - } - - puts("-----------------------------------------\n" - "Disabling cryptoprocessor..."); - crypto_disable(); - - puts("Done!"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/crypto/gcm-test.c b/examples/platform-specific/cc2538-common/crypto/gcm-test.c deleted file mode 100644 index a58158d33..000000000 --- a/examples/platform-specific/cc2538-common/crypto/gcm-test.c +++ /dev/null @@ -1,669 +0,0 @@ -/* - * Copyright (c) 2015, Benoît Thébaudeau - * 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-gcm-test cc2538 AES-GCM Test Project - * - * AES-GCM access example for CC2538-based platforms - * - * This example shows how AES-GCM should be used. The example also verifies - * the AES-GCM functionality. - * - * @{ - * - * \file - * Example demonstrating AES-GCM - */ -#include "contiki.h" -#include "sys/rtimer.h" -#include "dev/rom-util.h" -#include "dev/gcm.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define ADATA_MAX_LEN 90 -#define MDATA_MAX_LEN 51 -/*---------------------------------------------------------------------------*/ -PROCESS(gcm_test_process, "gcm test process"); -AUTOSTART_PROCESSES(&gcm_test_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(gcm_test_process, ev, data) -{ - static const char *const str_res[] = { - "success", - "invalid param", - "NULL error", - "resource in use", - "DMA bus error", - "keystore read error", - "keystore write error", - "authentication failed" - }; - static const uint8_t keys128[][128 / 8] = { - { 0x2f, 0xb4, 0x5e, 0x5b, 0x8f, 0x99, 0x3a, 0x2b, - 0xfe, 0xbc, 0x4b, 0x15, 0xb5, 0x33, 0xe0, 0xb4 }, - { 0xc9, 0x39, 0xcc, 0x13, 0x39, 0x7c, 0x1d, 0x37, - 0xde, 0x6a, 0xe0, 0xe1, 0xcb, 0x7c, 0x42, 0x3c }, - { 0xfe, 0x01, 0x21, 0xf4, 0x2e, 0x59, 0x9f, 0x88, - 0xff, 0x02, 0xa9, 0x85, 0x40, 0x3e, 0x19, 0xbb }, - { 0x99, 0x71, 0x07, 0x10, 0x59, 0xab, 0xc0, 0x09, - 0xe4, 0xf2, 0xbd, 0x69, 0x86, 0x9d, 0xb3, 0x38 }, - { 0x76, 0x2d, 0xa5, 0x8b, 0xb0, 0x00, 0xf5, 0xd4, - 0x99, 0x81, 0x8b, 0xc8, 0x59, 0x98, 0x9a, 0x30 }, - { 0x30, 0x0b, 0x8f, 0xfa, 0xb4, 0x36, 0x8c, 0xc9, - 0x0f, 0x6d, 0x40, 0x63, 0xe4, 0x27, 0x9f, 0x2a }, - { 0xef, 0x1d, 0xa9, 0xdd, 0x79, 0x42, 0x19, 0xeb, - 0xf8, 0xf7, 0x17, 0xd5, 0xa9, 0x8a, 0xb0, 0xaf }, - { 0x93, 0xae, 0x11, 0x40, 0x52, 0xb7, 0x98, 0x5d, - 0x40, 0x9a, 0x39, 0xa4, 0x0d, 0xf8, 0xc7, 0xee } - }; - static const uint8_t keys192[][192 / 8] = { - { 0x5d, 0xaa, 0x89, 0x10, 0xd9, 0xdc, 0x50, 0x68, - 0xf2, 0xf5, 0x5c, 0x16, 0x39, 0x86, 0xd0, 0x71, - 0x45, 0x23, 0x44, 0xa5, 0xea, 0xc5, 0xa8, 0x05 }, - { 0x1b, 0x8f, 0xef, 0x01, 0xcf, 0x6e, 0xfa, 0xbc, - 0x2c, 0x7c, 0xff, 0x16, 0xff, 0x67, 0xa3, 0x30, - 0x13, 0xf0, 0x62, 0x9a, 0x0a, 0xd9, 0x36, 0x95 }, - { 0x51, 0x9d, 0xdb, 0xcf, 0xb3, 0x41, 0x1c, 0x75, - 0x39, 0xdf, 0x0b, 0x61, 0xff, 0x2b, 0x3e, 0x3d, - 0x2b, 0x6a, 0xd8, 0xf0, 0x30, 0xcd, 0xdc, 0xc2 }, - { 0x9b, 0x37, 0xbf, 0x6b, 0x0a, 0xa8, 0xff, 0x75, - 0xf3, 0x04, 0xed, 0xa7, 0xa9, 0x51, 0x2d, 0xba, - 0x7c, 0x9f, 0x80, 0xd6, 0x1e, 0x29, 0x5e, 0x85 } - }; - static const uint8_t keys256[][256 / 8] = { - { 0xdc, 0x77, 0x6f, 0x01, 0x56, 0xc1, 0x5d, 0x03, - 0x26, 0x23, 0x85, 0x4b, 0x62, 0x5c, 0x61, 0x86, - 0x8e, 0x5d, 0xb8, 0x4b, 0x7b, 0x6f, 0x9f, 0xbd, - 0x36, 0x72, 0xf1, 0x2f, 0x00, 0x25, 0xe0, 0xf6 }, - { 0x14, 0x85, 0x79, 0xa3, 0xcb, 0xca, 0x86, 0xd5, - 0x52, 0x0d, 0x66, 0xc0, 0xec, 0x71, 0xca, 0x5f, - 0x7e, 0x41, 0xba, 0x78, 0xe5, 0x6d, 0xc6, 0xee, - 0xbd, 0x56, 0x6f, 0xed, 0x54, 0x7f, 0xe6, 0x91 }, - { 0x42, 0xf6, 0xc2, 0x51, 0x59, 0xb8, 0x65, 0x53, - 0x80, 0xf0, 0x52, 0xdd, 0x5d, 0xad, 0x18, 0x0e, - 0x76, 0x81, 0x3b, 0x60, 0xeb, 0x81, 0x36, 0x65, - 0xc5, 0x01, 0x5f, 0x26, 0xcf, 0x32, 0xe8, 0xf1 }, - { 0x5f, 0x72, 0x04, 0x62, 0x45, 0xd3, 0xf4, 0xa0, - 0x87, 0x7e, 0x50, 0xa8, 0x65, 0x54, 0xbf, 0xd5, - 0x7d, 0x1c, 0x5e, 0x07, 0x3d, 0x1e, 0xd3, 0xb5, - 0x45, 0x1f, 0x6d, 0x0f, 0xc2, 0xa8, 0x50, 0x7a } - }; - static const struct { - const void *keys; - uint8_t key_size; - uint8_t count; - } keys[] = { - { keys128, AES_KEY_STORE_SIZE_KEY_SIZE_128, - sizeof(keys128) / sizeof(keys128[0]) }, - { keys192, AES_KEY_STORE_SIZE_KEY_SIZE_192, - sizeof(keys192) / sizeof(keys192[0]) }, - { keys256, AES_KEY_STORE_SIZE_KEY_SIZE_256, - sizeof(keys256) / sizeof(keys256[0]) } - }; - static const struct { - bool encrypt; - uint8_t key_size_index; - uint8_t key_area; - uint8_t iv[GCM_IV_LEN]; - uint8_t adata[ADATA_MAX_LEN]; - uint16_t adata_len; - uint8_t mdata[MDATA_MAX_LEN]; - uint16_t mdata_len; - uint8_t tag[GCM_TAG_LEN]; - uint8_t expected[MDATA_MAX_LEN]; - } vectors[] = { - { - true, /* encrypt */ - 0, /* key_size_index */ - 0, /* key_area */ - { 0x5b, 0x05, 0x75, 0x5f, 0x98, 0x4d, 0x2b, 0x90, - 0xf9, 0x4b, 0x80, 0x27 }, /* iv */ - { 0xe8, 0x54, 0x91, 0xb2, 0x20, 0x2c, 0xaf, 0x1d, - 0x7d, 0xce, 0x03, 0xb9, 0x7e, 0x09, 0x33, 0x1c, - 0x32, 0x47, 0x39, 0x41 }, /* adata */ - 20, /* adata_len */ - {}, /* mdata */ - 0, /* mdata_len */ - { 0xc7, 0x5b, 0x78, 0x32, 0xb2, 0xa2, 0xd9, 0xbd, - 0x82, 0x74, 0x12, 0xb6, 0xef, 0x57, 0x69, 0xdb }, /* tag */ - {} /* expected */ - }, { - true, /* encrypt */ - 0, /* key_size_index */ - 1, /* key_area */ - { 0xb3, 0xd8, 0xcc, 0x01, 0x7c, 0xbb, 0x89, 0xb3, - 0x9e, 0x0f, 0x67, 0xe2 }, /* iv */ - { 0x24, 0x82, 0x56, 0x02, 0xbd, 0x12, 0xa9, 0x84, - 0xe0, 0x09, 0x2d, 0x3e, 0x44, 0x8e, 0xda, 0x5f }, /* adata */ - 16, /* adata_len */ - { 0xc3, 0xb3, 0xc4, 0x1f, 0x11, 0x3a, 0x31, 0xb7, - 0x3d, 0x9a, 0x5c, 0xd4, 0x32, 0x10, 0x30, 0x69 }, /* mdata */ - 16, /* mdata_len */ - { 0x00, 0x32, 0xa1, 0xdc, 0x85, 0xf1, 0xc9, 0x78, - 0x69, 0x25, 0xa2, 0xe7, 0x1d, 0x82, 0x72, 0xdd }, /* tag */ - { 0x93, 0xfe, 0x7d, 0x9e, 0x9b, 0xfd, 0x10, 0x34, - 0x8a, 0x56, 0x06, 0xe5, 0xca, 0xfa, 0x73, 0x54 } /* expected */ - }, { - true, /* encrypt */ - 0, /* key_size_index */ - 2, /* key_area */ - { 0x3b, 0xb9, 0xeb, 0x77, 0x24, 0xcb, 0xe1, 0x94, - 0x3d, 0x43, 0xde, 0x21 }, /* iv */ - { 0x26, 0x62, 0xd8, 0x95, 0x03, 0x5b, 0x65, 0x19, - 0xf3, 0x51, 0x0e, 0xae, 0x0f, 0xaa, 0x39, 0x00, - 0xad, 0x23, 0xcf, 0xdf }, /* adata */ - 20, /* adata_len */ - { 0xfd, 0x33, 0x1c, 0xa8, 0x64, 0x60, 0x91, 0xc2, - 0x9f, 0x21, 0xe5, 0xf0, 0xa1 }, /* mdata */ - 13, /* mdata_len */ - { 0xd2, 0x4c, 0x3e, 0x9c, 0x1c, 0x73, 0xc0, 0xaf, - 0x10, 0x97, 0xe2, 0x60, 0x61, 0xc8, 0x57, 0xde }, /* tag */ - { 0x59, 0xfe, 0x29, 0xb0, 0x7b, 0x0d, 0xe8, 0xd8, - 0x69, 0xef, 0xbb, 0xd9, 0xb4 } /* expected */ - }, { - true, /* encrypt */ - 0, /* key_size_index */ - 3, /* key_area */ - { 0x07, 0xa9, 0xa9, 0x5e, 0xa3, 0x82, 0x1e, 0x9c, - 0x13, 0xc6, 0x32, 0x51 }, /* iv */ - {}, /* adata */ - 0, /* adata_len */ - { 0xf5, 0x4b, 0xc3, 0x50, 0x1f, 0xed, 0x4f, 0x6f, - 0x6d, 0xfb, 0x5e, 0xa8, 0x01, 0x06, 0xdf, 0x0b, - 0xd8, 0x36, 0xe6, 0x82, 0x62, 0x25, 0xb7, 0x5c, - 0x02, 0x22, 0xf6, 0xe8, 0x59, 0xb3, 0x59, 0x83 }, /* mdata */ - 32, /* mdata_len */ - { 0x78, 0x70, 0xd9, 0x11, 0x7f, 0x54, 0x81, 0x1a, - 0x34, 0x69, 0x70, 0xf1, 0xde, 0x09, 0x0c, 0x41 }, /* tag */ - { 0x05, 0x56, 0xc1, 0x59, 0xf8, 0x4e, 0xf3, 0x6c, - 0xb1, 0x60, 0x2b, 0x45, 0x26, 0xb1, 0x20, 0x09, - 0xc7, 0x75, 0x61, 0x1b, 0xff, 0xb6, 0x4d, 0xc0, - 0xd9, 0xca, 0x92, 0x97, 0xcd, 0x2c, 0x6a, 0x01 } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 4, /* key_area */ - { 0x58, 0x4c, 0x29, 0x1f, 0xf1, 0xaa, 0x38, 0x8a, - 0x51, 0x12, 0x52, 0x1e }, /* iv */ - { 0x91, 0xf9, 0x2e, 0x8b, 0xbd, 0xa7, 0xb5, 0xec, - 0x96, 0x7a, 0xde, 0x76, 0x6f, 0x4f, 0x26, 0xe9, - 0x18, 0x9e, 0xaa, 0xfa, 0xd4, 0x16, 0xf3, 0x7b, - 0x48, 0x91, 0xd3, 0xe3, 0x7d, 0x70, 0xcb, 0x9a, - 0x26, 0x7a, 0xa8, 0x43, 0xdd, 0x20, 0x28, 0x58, - 0xad, 0xe0, 0x20, 0x26, 0x12, 0x23, 0xdf, 0xce }, /* adata */ - 48, /* adata_len */ - {}, /* mdata */ - 0, /* mdata_len */ - { 0x9a, 0xc7, 0xeb, 0x2d, 0x76, 0x2f, 0xac, 0xae, - 0x06, 0x08, 0x6c, 0x95, 0x79, 0x59, 0x88, 0x0e }, /* tag */ - {} /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 5, /* key_area */ - { 0x8e, 0x69, 0xfa, 0x64, 0xe8, 0x71, 0xd0, 0xe9, - 0x8a, 0x18, 0x3a, 0x49 }, /* iv */ - { 0x51, 0x66, 0x30, 0x9e, 0x15, 0x34, 0x47, 0xb2, - 0x7c, 0x67, 0x05, 0x14, 0x53, 0xab, 0xf4, 0x41, - 0xde, 0x3f, 0x4a, 0x7f, 0x6b, 0x63, 0x3e, 0xc6, - 0x12, 0x2f, 0xf8, 0x2d, 0xc1, 0x32, 0xcf, 0xb4, - 0x22, 0xd3, 0x6c, 0x5e, 0xc6, 0xe7, 0xcc, 0x90, - 0xa9, 0xad, 0x55, 0xca, 0xa1, 0xcc, 0xdc, 0xb8, - 0x2d, 0xc5, 0x02, 0x2a, 0x20, 0x06, 0x2a, 0x9c, - 0x6e, 0x92, 0x38, 0xf3, 0x4d, 0x08, 0x5b, 0x1f, - 0x55, 0x4b, 0x5e, 0xac, 0x05, 0xef, 0xf2, 0x5b, - 0x5a, 0x5c, 0xb6, 0xe1, 0x8e, 0x78, 0x27, 0xd7, - 0x01, 0x75, 0xdc, 0x06, 0x62, 0xd7, 0x70, 0x33, - 0xd1, 0x18 }, /* adata */ - 90, /* adata_len */ - { 0x2d, 0x22, 0x92, 0xda, 0x61, 0xc2, 0x80, 0xaf, - 0xf8, 0x67, 0x67, 0xd2, 0x5b, 0x75, 0xe8, 0x14 }, /* mdata */ - 16, /* mdata_len */ - { 0x63, 0x3e, 0xe6, 0x57, 0xa8, 0x98, 0x1a, 0x76, - 0x82, 0xf8, 0x75, 0x05, 0x59, 0x4c, 0x95, 0xad }, /* tag */ - { 0x49, 0x53, 0xb5, 0x48, 0x59, 0x87, 0x06, 0x31, - 0xe8, 0x18, 0xda, 0x71, 0xfc, 0x69, 0xc9, 0x81 } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 6, /* key_area */ - { 0x3f, 0x39, 0x83, 0xdc, 0x63, 0x98, 0x6e, 0x33, - 0xd1, 0xb6, 0xbf, 0xfc }, /* iv */ - { 0x5a, 0xbd, 0x0c, 0x1c, 0x52, 0xb6, 0x87, 0xe9, - 0xa1, 0x67, 0x3b, 0x69, 0x13, 0x78, 0x95, 0xe5, - 0x02, 0x5c, 0x2b, 0xd1, 0x8c, 0xbe, 0xac, 0xdb, - 0x94, 0x72, 0xe9, 0x18, 0xfe, 0x15, 0x87, 0xda, - 0x55, 0x8c, 0x49, 0x2c, 0xc7, 0x08, 0xd2, 0x70, - 0xfd, 0x10, 0x57, 0x2e, 0xea, 0x83, 0xd2, 0xde }, /* adata */ - 48, /* adata_len */ - { 0x95, 0xea, 0x05, 0x70, 0x14, 0x81, 0xe9, 0x15, - 0xc7, 0x24, 0x46, 0xc8, 0x76 }, /* mdata */ - 13, /* mdata_len */ - { 0x5c, 0x86, 0x69, 0x92, 0x66, 0x20, 0x05, 0xca, - 0x88, 0x86, 0x81, 0x0e, 0x27, 0x8c, 0x8a, 0xb4 }, /* tag */ - { 0x55, 0x11, 0x87, 0x29, 0x05, 0x43, 0x6c, 0x7d, - 0xe3, 0x8e, 0x95, 0x01, 0xe7 } /* expected */ - }, { - false, /* encrypt */ - 0, /* key_size_index */ - 7, /* key_area */ - { 0x8a, 0xd7, 0x33, 0xa4, 0xa9, 0xb8, 0x33, 0x06, - 0x90, 0x23, 0x8c, 0x42 }, /* iv */ - {}, /* adata */ - 0, /* adata_len */ - { 0xbb, 0xb5, 0xb6, 0x72, 0xa4, 0x79, 0xaf, 0xca, - 0x2b, 0x11, 0xad, 0xb0, 0xa4, 0xc7, 0x62, 0xb6, - 0x98, 0xdd, 0x56, 0x59, 0x08, 0xfe, 0xe1, 0xd1, - 0x01, 0xf6, 0xa0, 0x1d, 0x63, 0x33, 0x2c, 0x91, - 0xb8, 0x5d, 0x7f, 0x03, 0xac, 0x48, 0xa4, 0x77, - 0x89, 0x7d, 0x51, 0x2b, 0x45, 0x72, 0xf9, 0x04, - 0x2c, 0xb7, 0xea }, /* mdata */ - 51, /* mdata_len */ - { 0x4d, 0x78, 0xbd, 0xcb, 0x13, 0x66, 0xfc, 0xba, - 0x02, 0xfd, 0xcc, 0xee, 0x57, 0xe1, 0xff, 0x44 }, /* tag */ - { 0x3f, 0x3b, 0xb0, 0x64, 0x4e, 0xac, 0x87, 0x8b, - 0x97, 0xd9, 0x90, 0xd2, 0x57, 0xf5, 0xb3, 0x6e, - 0x17, 0x93, 0x49, 0x0d, 0xbc, 0x13, 0xfe, 0xa4, - 0xef, 0xe9, 0x82, 0x2c, 0xeb, 0xba, 0x74, 0x44, - 0xcc, 0xe4, 0xde, 0xe5, 0xa7, 0xf5, 0xdf, 0xdf, - 0x28, 0x5f, 0x96, 0x78, 0x57, 0x92, 0x81, 0x22, - 0x00, 0xc2, 0x79 } /* expected */ - }, { - true, /* encrypt */ - 1, /* key_size_index */ - 0, /* key_area */ - { 0x8f, 0x88, 0xd7, 0x0e, 0x25, 0x0d, 0xbf, 0x12, - 0x82, 0x41, 0x3f, 0xd7 }, /* iv */ - { 0x3b, 0x3b, 0xbb, 0x2c, 0xcd, 0x76, 0x23, 0x6f, - 0x07, 0x4e, 0xec, 0xc1, 0x9f, 0x34, 0x10, 0x57 }, /* adata */ - 16, /* adata_len */ - { 0x42, 0x35, 0xe4, 0x2f, 0x32, 0xcf, 0xf4, 0x4a, - 0x50, 0x7d, 0xd8, 0xa3, 0x66 }, /* mdata */ - 13, /* mdata_len */ - { 0x4c, 0xdd, 0xdb, 0x4a, 0x95, 0x46, 0xa8, 0xd7, - 0x3a, 0xfc, 0x9f, 0x5e, 0x46, 0xa9, 0x26, 0xf3 }, /* tag */ - { 0xe9, 0x2d, 0xf9, 0xd2, 0xfd, 0x43, 0x6e, 0xd2, - 0x54, 0xfa, 0x92, 0x78, 0x9c } /* expected */ - }, { - true, /* encrypt */ - 1, /* key_size_index */ - 2, /* key_area */ - { 0xe9, 0x5e, 0xbb, 0x1e, 0x8d, 0x31, 0xd1, 0xac, - 0x41, 0x4a, 0xd5, 0xf1 }, /* iv */ - { 0x9c, 0x1a, 0x35, 0x60, 0x40, 0xa1, 0x87, 0xb7, - 0xd8, 0x5c, 0x7b, 0xbd, 0xc2, 0x3d, 0x3e, 0x9c, - 0x63, 0x8f, 0x01, 0x4b, 0xd5, 0x62, 0x90, 0x88, - 0x75, 0x7b, 0x57, 0x05, 0xb4, 0xf2, 0x78, 0x33, - 0xb0, 0xa2, 0xb3, 0xfa, 0x4c, 0x9c, 0x43, 0xa7, - 0x7c, 0x69, 0xa3, 0xa2, 0x0a, 0xff, 0xd2, 0xac, - 0x4a, 0xa6, 0xfd, 0xf2, 0xe0, 0x7c, 0x0a, 0x8d, - 0xaf, 0x1a, 0x19, 0xc4, 0x9a, 0x6a, 0x69, 0xfb, - 0xf4, 0x25, 0x1b, 0x77, 0x98, 0x17, 0x31, 0x82, - 0xa5, 0x28, 0xe6, 0xeb, 0x94, 0x19, 0x28, 0xaf, - 0x99, 0x53, 0xbf, 0x59, 0x5b, 0xfb, 0x7b, 0xdf, - 0x5c, 0x3a }, /* adata */ - 90, /* adata_len */ - { 0xc0, 0xc9, 0x22, 0x56, 0x03, 0x2e, 0xd3, 0x11, - 0x3a, 0x79, 0x41, 0x0a, 0x8b, 0x0e, 0x25, 0x0e, - 0x9a, 0x97, 0xfb, 0x47, 0x29, 0x8d, 0x12, 0x29, - 0x32, 0xff, 0x94, 0xd8, 0xf9, 0x40, 0xbc, 0xf8 }, /* mdata */ - 32, /* mdata_len */ - { 0x6b, 0xce, 0x3a, 0xbe, 0xe7, 0xb7, 0xa6, 0x56, - 0x3a, 0xb7, 0x9f, 0x68, 0xa4, 0x19, 0x72, 0xf4 }, /* tag */ - { 0x2c, 0x04, 0x3e, 0xc6, 0x9c, 0x25, 0x5c, 0x7e, - 0xaf, 0x7b, 0xef, 0x47, 0x9b, 0x74, 0x67, 0x4f, - 0xf2, 0x0c, 0x18, 0x5b, 0xcc, 0x6f, 0x94, 0x24, - 0x22, 0xc7, 0xb5, 0xbe, 0x19, 0x99, 0x68, 0x37 } /* expected */ - }, { - false, /* encrypt */ - 1, /* key_size_index */ - 4, /* key_area */ - { 0x78, 0xec, 0x38, 0x73, 0xbd, 0x88, 0x46, 0xac, - 0x42, 0xff, 0x3a, 0x9b }, /* iv */ - { 0x7b, 0x4d, 0x41, 0x23, 0x02, 0xf3, 0x31, 0x96, - 0x53, 0xcc, 0xed, 0x7d, 0xc6, 0xd7, 0xd8, 0x45, - 0xcf, 0x10, 0x71, 0xd3, 0x80, 0x2c, 0xf0, 0x9b, - 0xcd, 0x2b, 0xf3, 0x07, 0x76, 0x09, 0xa1, 0xda, - 0xe1, 0xbf, 0x64, 0xe7, 0x88, 0x20, 0xf3, 0x68, - 0x86, 0x2b, 0x2c, 0x0d, 0xaa, 0x17, 0xff, 0x9b, - 0x33, 0xd1, 0xa7, 0xe4, 0xf6, 0x27, 0x50, 0x7c, - 0x5a, 0x91, 0x6a, 0x80, 0x0e, 0x6d, 0x34, 0x9f, - 0x72, 0xa4, 0x5f, 0x8f, 0x76, 0xb0, 0x1e, 0x63, - 0xdf, 0xcb, 0x44, 0xf0, 0x0a, 0x22, 0x57, 0x41, - 0xd1, 0x72, 0x37, 0x1e, 0xb9, 0x6f, 0x96, 0x49, - 0x87, 0xeb }, /* adata */ - 90, /* adata_len */ - { 0xf1, 0xfb, 0x8d, 0xf2, 0x8f, 0x5a, 0x86, 0x49, - 0xd9, 0x30, 0xb4, 0x77, 0xe6 }, /* mdata */ - 13, /* mdata_len */ - { 0xf7, 0x1b, 0x01, 0x98, 0xae, 0xe9, 0x70, 0xe0, - 0xcb, 0x9f, 0x83, 0x5b, 0x4e, 0xe9, 0xf4, 0x33 }, /* tag */ - { 0x16, 0xea, 0xad, 0xec, 0x26, 0x20, 0x4a, 0x64, - 0x4e, 0x2f, 0x24, 0xb1, 0xee } /* expected */ - }, { - false, /* encrypt */ - 1, /* key_size_index */ - 6, /* key_area */ - { 0x2e, 0x8e, 0xf3, 0x3d, 0x26, 0x5d, 0x48, 0x19, - 0xb6, 0x3c, 0xfd, 0xfc }, /* iv */ - { 0xf2, 0x16, 0xc7, 0xde, 0xf5, 0x5c, 0x8f, 0xf3, - 0x25, 0x93, 0x35, 0x40, 0x96, 0x35, 0x62, 0xef, - 0xe9, 0x6a, 0xe3, 0xf4, 0xb5, 0x4e, 0x6e, 0xc9, - 0x5b, 0x25, 0x19, 0x42, 0x64, 0x67, 0x11, 0xd1, - 0x7e, 0x4e, 0x39, 0xf2, 0x0f, 0xfb, 0x35, 0xd0, - 0x33, 0x4c, 0x9c, 0x03, 0x83, 0x0d, 0x00, 0xc3 }, /* adata */ - 48, /* adata_len */ - { 0x66, 0xd3, 0xe6, 0x06, 0x6c, 0x51, 0xf3, 0x74, - 0xc8, 0xde, 0xf9, 0x1d, 0xdd, 0xd7, 0x76, 0xeb, - 0xc3, 0xbd, 0x9c, 0x96, 0x19, 0xeb, 0xc6, 0x81, - 0x3c, 0x63, 0xd6, 0x9a, 0xac, 0x51, 0xb9, 0x77, - 0x5a, 0x47, 0x19, 0x6e, 0x48, 0x83, 0xce, 0x5e, - 0x32, 0x33, 0x2c, 0xe0, 0x09, 0xe0, 0x27, 0xec, - 0x62, 0x2a, 0xe3 }, /* mdata */ - 51, /* mdata_len */ - { 0xcc, 0xef, 0x02, 0x7c, 0x0a, 0xe1, 0x90, 0x87, - 0xe1, 0x8b, 0x13, 0xab, 0x5e, 0x1c, 0x89, 0xa6 }, /* tag */ - { 0x44, 0x8e, 0x59, 0xef, 0x95, 0x88, 0x67, 0xd6, - 0x99, 0xfa, 0xf7, 0x4a, 0xa0, 0x46, 0x28, 0x1d, - 0xb5, 0x1c, 0x44, 0xbd, 0x7a, 0xac, 0xb0, 0x52, - 0x21, 0xcf, 0x3c, 0x7f, 0x1e, 0xfd, 0x47, 0x04, - 0xf9, 0xb4, 0x79, 0x67, 0xb7, 0x05, 0x16, 0x8b, - 0x5e, 0xd2, 0x52, 0x38, 0x64, 0x48, 0x29, 0xb7, - 0x54, 0xdc, 0x75 } /* expected */ - }, { - true, /* encrypt */ - 2, /* key_size_index */ - 0, /* key_area */ - { 0x67, 0x13, 0x09, 0x51, 0xc4, 0xa5, 0x7f, 0x6a, - 0xe7, 0xf1, 0x32, 0x41 }, /* iv */ - { 0xfd, 0x09, 0x20, 0xfa, 0xeb, 0x7b, 0x21, 0x29, - 0x32, 0x28, 0x0a, 0x00, 0x9b, 0xac, 0x96, 0x91, - 0x45, 0xe5, 0xc3, 0x16, 0xcf, 0x39, 0x22, 0x62, - 0x2c, 0x37, 0x05, 0xc3, 0x45, 0x7c, 0x4e, 0x9f, - 0x12, 0x4b, 0x20, 0x76, 0x99, 0x43, 0x23, 0xfb, - 0xcf, 0xb5, 0x23, 0xf8, 0xed, 0x16, 0xd2, 0x41 }, /* adata */ - 48, /* adata_len */ - { 0x93, 0x78, 0xa7, 0x27, 0xa5, 0x11, 0x95, 0x95, - 0xad, 0x63, 0x1b, 0x12, 0xa5, 0xa6, 0xbc, 0x8a, - 0x91, 0x75, 0x6e, 0xf0, 0x9c, 0x8d, 0x6e, 0xaa, - 0x2b, 0x71, 0x8f, 0xe8, 0x68, 0x76, 0xda, 0x20 }, /* mdata */ - 32, /* mdata_len */ - { 0xb8, 0x76, 0x83, 0x1b, 0x4e, 0xcd, 0x72, 0x42, - 0x96, 0x3b, 0x04, 0x0a, 0xa4, 0x5c, 0x41, 0x14 }, /* tag */ - { 0x6d, 0x95, 0x8c, 0x20, 0x87, 0x0d, 0x40, 0x1a, - 0x3c, 0x1f, 0x7a, 0x0a, 0xc0, 0x92, 0xc9, 0x77, - 0x74, 0xd4, 0x51, 0xc0, 0x9f, 0x7a, 0xae, 0x99, - 0x2a, 0x88, 0x41, 0xff, 0x0a, 0xb9, 0xd6, 0x0d } /* expected */ - }, { - true, /* encrypt */ - 2, /* key_size_index */ - 2, /* key_area */ - { 0xb0, 0x8a, 0x5e, 0xa1, 0x92, 0x74, 0x99, 0xc6, - 0xec, 0xbf, 0xd4, 0xe0 }, /* iv */ - { 0xe4, 0xf9, 0x63, 0xf0, 0x15, 0xff, 0xbb, 0x99, - 0xee, 0x33, 0x49, 0xbb, 0xaf, 0x7e, 0x8e, 0x8e, - 0x6c, 0x2a, 0x71, 0xc2, 0x30, 0xa4, 0x8f, 0x9d, - 0x59, 0x86, 0x0a, 0x29, 0x09, 0x1d, 0x27, 0x47, - 0xe0, 0x1a, 0x5c, 0xa5, 0x72, 0x34, 0x7e, 0x24, - 0x7d, 0x25, 0xf5, 0x6b, 0xa7, 0xae, 0x8e, 0x05, - 0xcd, 0xe2, 0xbe, 0x3c, 0x97, 0x93, 0x12, 0x92, - 0xc0, 0x23, 0x70, 0x20, 0x8e, 0xcd, 0x09, 0x7e, - 0xf6, 0x92, 0x68, 0x7f, 0xec, 0xf2, 0xf4, 0x19, - 0xd3, 0x20, 0x01, 0x62, 0xa6, 0x48, 0x0a, 0x57, - 0xda, 0xd4, 0x08, 0xa0, 0xdf, 0xeb, 0x49, 0x2e, - 0x2c, 0x5d }, /* adata */ - 90, /* adata_len */ - { 0x9d, 0x0b, 0x15, 0xfd, 0xf1, 0xbd, 0x59, 0x5f, - 0x91, 0xf8, 0xb3, 0xab, 0xc0, 0xf7, 0xde, 0xc9, - 0x27, 0xdf, 0xd4, 0x79, 0x99, 0x35, 0xa1, 0x79, - 0x5d, 0x9c, 0xe0, 0x0c, 0x9b, 0x87, 0x94, 0x34, - 0x42, 0x0f, 0xe4, 0x2c, 0x27, 0x5a, 0x7c, 0xd7, - 0xb3, 0x9d, 0x63, 0x8f, 0xb8, 0x1c, 0xa5, 0x2b, - 0x49, 0xdc, 0x41 }, /* mdata */ - 51, /* mdata_len */ - { 0xad, 0xbe, 0xcd, 0xb0, 0xd5, 0xc2, 0x22, 0x4d, - 0x80, 0x4d, 0x28, 0x86, 0xff, 0x9a, 0x57, 0x60 }, /* tag */ - { 0x20, 0x97, 0xe3, 0x72, 0x95, 0x0a, 0x5e, 0x93, - 0x83, 0xc6, 0x75, 0xe8, 0x9e, 0xea, 0x1c, 0x31, - 0x4f, 0x99, 0x91, 0x59, 0xf5, 0x61, 0x13, 0x44, - 0xb2, 0x98, 0xcd, 0xa4, 0x5e, 0x62, 0x84, 0x37, - 0x16, 0xf2, 0x15, 0xf8, 0x2e, 0xe6, 0x63, 0x91, - 0x9c, 0x64, 0x00, 0x2a, 0x5c, 0x19, 0x8d, 0x78, - 0x78, 0xfd, 0x3f } /* expected */ - }, { - false, /* encrypt */ - 2, /* key_size_index */ - 4, /* key_area */ - { 0x72, 0x48, 0xa5, 0xed, 0x48, 0xf4, 0xf1, 0xb4, - 0xa9, 0xdb, 0x38, 0x26 }, /* iv */ - { 0x8e, 0x3c, 0x74, 0xf1, 0x27, 0xdb, 0xfe, 0x29, - 0xac, 0x4d, 0xe0, 0xa7, 0xc3, 0x24, 0x0e, 0xe8, - 0xaa, 0x8d, 0x38, 0xa8, 0x2f, 0x38, 0xad, 0x6b, - 0x48, 0x02, 0x36, 0xc8, 0xcd, 0x42, 0x32, 0x05, - 0x7a, 0x55, 0x02, 0xe9, 0x36, 0xbf, 0xe2, 0x22, - 0x25, 0x83, 0x0f, 0xa1, 0x95, 0xa8, 0xaf, 0xce }, /* adata */ - 48, /* adata_len */ - { 0x26, 0x32, 0x5c, 0x34, 0x63, 0x81, 0x3a, 0x7d, - 0x59, 0xd1, 0x84, 0xa3, 0x30, 0xef, 0x80, 0x95, - 0x96, 0x37, 0xfa, 0x6d, 0xb4, 0xf5, 0xdb, 0x30, - 0x62, 0xd3, 0xd2, 0xec, 0x7e, 0x32, 0xd8, 0x2a }, /* mdata */ - 32, /* mdata_len */ - { 0x4f, 0x39, 0xc6, 0x3d, 0x4f, 0x21, 0x5d, 0x5b, - 0x39, 0xa5, 0x88, 0x53, 0xd3, 0x84, 0x21, 0x75 }, /* tag */ - { 0x9a, 0x32, 0x9c, 0xb4, 0x5b, 0x00, 0x93, 0xe9, - 0xc0, 0x06, 0x15, 0x13, 0x7d, 0xd7, 0xdb, 0xd1, - 0xf8, 0xb5, 0x25, 0x99, 0x9a, 0xf3, 0xbf, 0xc2, - 0x22, 0x31, 0x5f, 0x41, 0x81, 0x77, 0x17, 0xa7 } /* expected */ - }, { - false, /* encrypt */ - 2, /* key_size_index */ - 6, /* key_area */ - { 0xea, 0x6f, 0x5b, 0x39, 0x1e, 0x44, 0xb7, 0x51, - 0xb2, 0x6b, 0xce, 0x6f }, /* iv */ - { 0x9b, 0x3a, 0x68, 0xc9, 0x41, 0xd4, 0x27, 0x44, - 0x67, 0x3f, 0xb6, 0x0f, 0xea, 0x49, 0x07, 0x5e, - 0xae, 0x77, 0x32, 0x2e, 0x7e, 0x70, 0xe3, 0x45, - 0x02, 0xc1, 0x15, 0xb6, 0x49, 0x5e, 0xbf, 0xc7, - 0x96, 0xd6, 0x29, 0x08, 0x07, 0x65, 0x3c, 0x6b, - 0x53, 0xcd, 0x84, 0x28, 0x1b, 0xd0, 0x31, 0x16, - 0x56, 0xd0, 0x01, 0x3f, 0x44, 0x61, 0x9d, 0x27, - 0x48, 0x17, 0x7e, 0x99, 0xe8, 0xf8, 0x34, 0x7c, - 0x98, 0x9a, 0x7b, 0x59, 0xf9, 0xd8, 0xdc, 0xf0, - 0x0f, 0x31, 0xdb, 0x06, 0x84, 0xa4, 0xa8, 0x3e, - 0x03, 0x7e, 0x87, 0x77, 0xba, 0xe5, 0x5f, 0x79, - 0x9b, 0x0d }, /* adata */ - 90, /* adata_len */ - { 0x0e, 0x6e, 0x0b, 0x21, 0x14, 0xc4, 0x07, 0x69, - 0xc1, 0x59, 0x58, 0xd9, 0x65, 0xa1, 0x4d, 0xcf, - 0x50, 0xb6, 0x80, 0xe0, 0x18, 0x5a, 0x44, 0x09, - 0xd7, 0x7d, 0x89, 0x4c, 0xa1, 0x5b, 0x1e, 0x69, - 0x8d, 0xd8, 0x3b, 0x35, 0x36, 0xb1, 0x8c, 0x05, - 0xd8, 0xcd, 0x08, 0x73, 0xd1, 0xed, 0xce, 0x81, - 0x50, 0xec, 0xb5 }, /* mdata */ - 51, /* mdata_len */ - { 0xfd, 0xaa, 0xff, 0x86, 0xce, 0xb9, 0x37, 0x50, - 0x2c, 0xd9, 0x01, 0x2d, 0x03, 0x58, 0x58, 0x00 }, /* tag */ - { 0xb0, 0xa8, 0x81, 0xb7, 0x51, 0xcc, 0x1e, 0xb0, - 0xc9, 0x12, 0xa4, 0xcf, 0x9b, 0xd9, 0x71, 0x98, - 0x37, 0x07, 0xdb, 0xd2, 0x41, 0x17, 0x25, 0x66, - 0x45, 0x03, 0x45, 0x5c, 0x55, 0xdb, 0x25, 0xcd, - 0xb1, 0x9b, 0xc6, 0x69, 0xc2, 0x65, 0x4a, 0x3a, - 0x80, 0x11, 0xde, 0x6b, 0xf7, 0xef, 0xf3, 0xf9, - 0xf0, 0x78, 0x34 } /* expected */ - } - }; - static uint8_t adata[ADATA_MAX_LEN]; - static uint8_t mdata[MDATA_MAX_LEN]; - static uint8_t tag[GCM_TAG_LEN]; - static int i; - static uint8_t key_size_index = -1, ret; - static rtimer_clock_t time, time2, total_time; - - PROCESS_BEGIN(); - - puts("-----------------------------------------\n" - "Initializing cryptoprocessor..."); - crypto_init(); - - for(i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) { - if(key_size_index != vectors[i].key_size_index) { - key_size_index = vectors[i].key_size_index; - printf("-----------------------------------------\n" - "Filling %d-bit key store...\n", 128 + (key_size_index << 6)); - time = RTIMER_NOW(); - ret = aes_load_keys(keys[key_size_index].keys, - keys[key_size_index].key_size, keys[key_size_index].count, 0); - time = RTIMER_NOW() - time; - printf("aes_load_keys(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - break; - } - } - - printf("-----------------------------------------\n" - "Test vector #%d: %s\n" - "key_area=%d adata_len=%d mdata_len=%d\n", - i, vectors[i].encrypt ? "encrypt" : "decrypt", - vectors[i].key_area, vectors[i].adata_len, vectors[i].mdata_len); - - /* adata and mdata have to be in SRAM. */ - rom_util_memcpy(adata, vectors[i].adata, vectors[i].adata_len); - rom_util_memcpy(mdata, vectors[i].mdata, vectors[i].mdata_len); - - time = RTIMER_NOW(); - if(vectors[i].encrypt) { - ret = gcm_auth_encrypt_start(vectors[i].key_area, vectors[i].iv, adata, - vectors[i].adata_len, mdata, - vectors[i].mdata_len, mdata, - &gcm_test_process); - time2 = RTIMER_NOW(); - time = time2 - time; - total_time = time; - if(ret == CRYPTO_SUCCESS) { - PROCESS_WAIT_EVENT_UNTIL(gcm_auth_encrypt_check_status()); - time2 = RTIMER_NOW() - time2; - total_time += time2; - } - printf("gcm_auth_encrypt_start(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - if(ret != CRYPTO_SUCCESS) { - PROCESS_PAUSE(); - continue; - } - printf("gcm_auth_encrypt_check_status() wait: %lu us\n", - (uint32_t)((uint64_t)time2 * 1000000 / RTIMER_SECOND)); - - time = RTIMER_NOW(); - ret = gcm_auth_encrypt_get_result(tag); - time = RTIMER_NOW() - time; - total_time += time; - printf("gcm_auth_encrypt_get_result(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - continue; - } - - if(rom_util_memcmp(mdata, vectors[i].expected, vectors[i].mdata_len)) { - puts("Encrypted message does not match expected one"); - } else { - puts("Encrypted message OK"); - } - - if(rom_util_memcmp(tag, vectors[i].tag, GCM_TAG_LEN)) { - puts("Tag does not match expected one"); - } else { - puts("Tag OK"); - } - } else { - ret = gcm_auth_decrypt_start(vectors[i].key_area, vectors[i].iv, adata, - vectors[i].adata_len, mdata, - vectors[i].mdata_len, mdata, - &gcm_test_process); - time2 = RTIMER_NOW(); - time = time2 - time; - total_time = time; - if(ret == CRYPTO_SUCCESS) { - PROCESS_WAIT_EVENT_UNTIL(gcm_auth_decrypt_check_status()); - time2 = RTIMER_NOW() - time2; - total_time += time2; - } - printf("gcm_auth_decrypt_start(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - if(ret != CRYPTO_SUCCESS) { - PROCESS_PAUSE(); - continue; - } - printf("gcm_auth_decrypt_check_status() wait: %lu us\n", - (uint32_t)((uint64_t)time2 * 1000000 / RTIMER_SECOND)); - - time = RTIMER_NOW(); - ret = gcm_auth_decrypt_get_result(vectors[i].tag, tag); - time = RTIMER_NOW() - time; - total_time += time; - printf("gcm_auth_decrypt_get_result(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - continue; - } - - if(rom_util_memcmp(mdata, vectors[i].expected, vectors[i].mdata_len)) { - puts("Decrypted message does not match expected one"); - } else { - puts("Decrypted message OK"); - } - } - - printf("Total duration: %lu us\n", - (uint32_t)((uint64_t)total_time * 1000000 / RTIMER_SECOND)); - } - - puts("-----------------------------------------\n" - "Disabling cryptoprocessor..."); - crypto_disable(); - - puts("Done!"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/crypto/sha256-test.c b/examples/platform-specific/cc2538-common/crypto/sha256-test.c deleted file mode 100644 index c9498b881..000000000 --- a/examples/platform-specific/cc2538-common/crypto/sha256-test.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Original file: - * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Port to Contiki: - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-sha256-test cc2538 SHA-256 Test Project - * - * SHA-256 access example for CC2538-based platforms - * - * This example shows how SHA-256 should be used. The example also verifies - * the SHA-256 functionality. - * - * @{ - * - * \file - * Example demonstrating SHA-256 - */ -#include "contiki.h" -#include "sys/rtimer.h" -#include "dev/rom-util.h" -#include "dev/sha256.h" - -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -PROCESS(sha256_test_process, "sha256 test process"); -AUTOSTART_PROCESSES(&sha256_test_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sha256_test_process, ev, data) -{ - static const char *const str_res[] = { - "success", - "invalid param", - "NULL error", - "resource in use", - "DMA bus error" - }; - static const struct { - const char *data[3]; - uint8_t sha256[32]; - } vectors[] = { - { /* Simple */ - { - "abc", - NULL, - NULL - }, { - 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, - 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, - 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, - 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad - } - }, { /* Simple */ - { - "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - NULL, - NULL, - }, { - 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, - 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39, - 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, - 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 - } - }, { /* Message of length 130 */ - { - "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklabcd" - "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn", - NULL, - NULL - }, { - 0x15, 0xd2, 0x3e, 0xea, 0x57, 0xb3, 0xd4, 0x61, - 0xbf, 0x38, 0x91, 0x12, 0xab, 0x4c, 0x43, 0xce, - 0x85, 0xe1, 0x68, 0x23, 0x8a, 0xaa, 0x54, 0x8e, - 0xc8, 0x6f, 0x0c, 0x9d, 0x65, 0xf9, 0xb9, 0x23 - } - }, { /* Message of length 128 */ - { - "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklabcd" - "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl", - NULL, - NULL - }, { - 0xf8, 0xa3, 0xf2, 0x26, 0xfc, 0x42, 0x10, 0xe9, - 0x0d, 0x13, 0x0c, 0x7f, 0x41, 0xf2, 0xbe, 0x66, - 0x45, 0x53, 0x85, 0xd2, 0x92, 0x0a, 0xda, 0x78, - 0x15, 0xf8, 0xf7, 0x95, 0xd9, 0x44, 0x90, 0x5f - } - }, { /* Message of length 64 */ - { - "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl", - NULL, - NULL - }, { - 0x2f, 0xcd, 0x5a, 0x0d, 0x60, 0xe4, 0xc9, 0x41, - 0x38, 0x1f, 0xcc, 0x4e, 0x00, 0xa4, 0xbf, 0x8b, - 0xe4, 0x22, 0xc3, 0xdd, 0xfa, 0xfb, 0x93, 0xc8, - 0x09, 0xe8, 0xd1, 0xe2, 0xbf, 0xff, 0xae, 0x8e - } - }, { /* Message of length 66 */ - { - "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn", - NULL, - NULL - }, { - 0x92, 0x90, 0x1c, 0x85, 0x82, 0xe3, 0x1c, 0x05, - 0x69, 0xb5, 0x36, 0x26, 0x9c, 0xe2, 0x2c, 0xc8, - 0x30, 0x8b, 0xa4, 0x17, 0xab, 0x36, 0xc1, 0xbb, - 0xaf, 0x08, 0x4f, 0xf5, 0x8b, 0x18, 0xdc, 0x6a - } - }, { - { - "abcdbcdecdefde", - "fgefghfghighijhijkijkljklmklmnlmnomnopnopq", - NULL - }, { - 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, - 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39, - 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, - 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 - } - }, { - { - "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl", - "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl", - NULL - }, { - 0xf8, 0xa3, 0xf2, 0x26, 0xfc, 0x42, 0x10, 0xe9, - 0x0d, 0x13, 0x0c, 0x7f, 0x41, 0xf2, 0xbe, 0x66, - 0x45, 0x53, 0x85, 0xd2, 0x92, 0x0a, 0xda, 0x78, - 0x15, 0xf8, 0xf7, 0x95, 0xd9, 0x44, 0x90, 0x5f - } - }, { - { - "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh", - "ijkl", - "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl" - }, { - 0xf8, 0xa3, 0xf2, 0x26, 0xfc, 0x42, 0x10, 0xe9, - 0x0d, 0x13, 0x0c, 0x7f, 0x41, 0xf2, 0xbe, 0x66, - 0x45, 0x53, 0x85, 0xd2, 0x92, 0x0a, 0xda, 0x78, - 0x15, 0xf8, 0xf7, 0x95, 0xd9, 0x44, 0x90, 0x5f - } - } - }; - static sha256_state_t state; - static uint8_t sha256[32]; - static int i, j; - static uint8_t ret; - static rtimer_clock_t total_time; - rtimer_clock_t time; - size_t len; - - PROCESS_BEGIN(); - - puts("-----------------------------------------\n" - "Initializing cryptoprocessor..."); - crypto_init(); - - for(i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) { - printf("-----------------------------------------\n" - "Test vector #%d:\n", i); - - time = RTIMER_NOW(); - ret = sha256_init(&state); - time = RTIMER_NOW() - time; - total_time = time; - printf("sha256_init(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - continue; - } - - for(j = 0; j < sizeof(vectors[i].data) / sizeof(vectors[i].data[0]) && - vectors[i].data[j] != NULL; j++) { - len = strlen(vectors[i].data[j]); - printf("Buffer #%d (length: %u):\n", j, len); - time = RTIMER_NOW(); - ret = sha256_process(&state, vectors[i].data[j], len); - time = RTIMER_NOW() - time; - total_time += time; - printf("sha256_process(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - break; - } - } - if(ret != CRYPTO_SUCCESS) { - continue; - } - - time = RTIMER_NOW(); - ret = sha256_done(&state, sha256); - time = RTIMER_NOW() - time; - total_time += time; - printf("sha256_done(): %s, %lu us\n", str_res[ret], - (uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND)); - PROCESS_PAUSE(); - if(ret != CRYPTO_SUCCESS) { - continue; - } - - if(rom_util_memcmp(sha256, vectors[i].sha256, sizeof(sha256))) { - puts("Computed SHA-256 hash does not match expected hash"); - } else { - puts("Computed SHA-256 hash OK"); - } - printf("Total duration: %lu us\n", - (uint32_t)((uint64_t)total_time * 1000000 / RTIMER_SECOND)); - } - - puts("-----------------------------------------\n" - "Disabling cryptoprocessor..."); - crypto_disable(); - - puts("Done!"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/pka/Makefile b/examples/platform-specific/cc2538-common/pka/Makefile deleted file mode 100644 index 01ba6fe62..000000000 --- a/examples/platform-specific/cc2538-common/pka/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CONTIKI_PROJECT = ecc-ecdh ecc-sign ecc-verify - -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = cc2538dk openmote-cc2538 zoul - -CONTIKI = ../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/cc2538-common/pka/Makefile.target b/examples/platform-specific/cc2538-common/pka/Makefile.target deleted file mode 100644 index 777593c88..000000000 --- a/examples/platform-specific/cc2538-common/pka/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = cc2538dk diff --git a/examples/platform-specific/cc2538-common/pka/ecc-ecdh.c b/examples/platform-specific/cc2538-common/pka/ecc-ecdh.c deleted file mode 100644 index a1614b8e4..000000000 --- a/examples/platform-specific/cc2538-common/pka/ecc-ecdh.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2014, Institute for Pervasive Computing, ETH Zurich. - * All rights reserved. - * - * Author: Andreas Dröscher - * - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-ecdh-test cc2538 ECDH Test Project - * - * ECDH example for CC2538-based platforms - * - * This example shows how ECDH should be used. The example also verifies - * the ECDH functionality. - * - * @{ - * - * \file - * Example demonstrating ECDH - */ -#include "contiki.h" -#include "dev/ecc-algorithm.h" -#include "dev/ecc-curve.h" -#include "lib/random.h" -#include "sys/rtimer.h" -#include "sys/pt.h" - -#include -#include - -static void -ecc_set_random(uint32_t *secret) -{ - int i; - for(i = 0; i < 8; ++i) { - secret[i] = (uint32_t)random_rand() | (uint32_t)random_rand() << 16; - } -} - -PROCESS(ecdh_test, "ecdh test"); -AUTOSTART_PROCESSES(&ecdh_test); - -PROCESS_THREAD(ecdh_test, ev, data) { - PROCESS_BEGIN(); - - /* - * Variable for Time Measurement - */ - static rtimer_clock_t time; - - /* - * Activate Engine - */ - puts("-----------------------------------------\n" - "Initializing pka..."); - pka_init(); - - /* - * Generate secrets make sure they are valid (smaller as order) - */ - static ecc_compare_state_t state = { - .process = &ecdh_test, - .size = 8, - }; - memcpy(state.b, nist_p_256.n, sizeof(uint32_t) * 8); - static uint32_t secret_a[8]; - do { - ecc_set_random(secret_a); - memcpy(state.a, secret_a, sizeof(uint32_t) * 8); - PT_SPAWN(&(ecdh_test.pt), &(state.pt), ecc_compare(&state)); - } while(state.result != PKA_STATUS_A_LT_B); - - static uint32_t secret_b[8]; - ecc_set_random(secret_b); - do { - ecc_set_random(secret_b); - memcpy(state.a, secret_b, sizeof(uint32_t) * 8); - PT_SPAWN(&(ecdh_test.pt), &(state.pt), ecc_compare(&state)); - } while(state.result != PKA_STATUS_A_LT_B); - - /* - * Prepare Points - */ - static ecc_multiply_state_t side_a = { - .process = &ecdh_test, - .curve_info = &nist_p_256, - }; - memcpy(side_a.point_in.x, nist_p_256.x, sizeof(uint32_t) * 8); - memcpy(side_a.point_in.y, nist_p_256.y, sizeof(uint32_t) * 8); - memcpy(side_a.secret, secret_a, sizeof(secret_a)); - - static ecc_multiply_state_t side_b = { - .process = &ecdh_test, - .curve_info = &nist_p_256, - }; - memcpy(side_b.point_in.x, nist_p_256.x, sizeof(uint32_t) * 8); - memcpy(side_b.point_in.y, nist_p_256.y, sizeof(uint32_t) * 8); - memcpy(side_b.secret, secret_b, sizeof(secret_b)); - - /* - * Round 1 - */ - time = RTIMER_NOW(); - PT_SPAWN(&(ecdh_test.pt), &(side_a.pt), ecc_multiply(&side_a)); - time = RTIMER_NOW() - time; - printf("Round 1, Side a: %i, %lu ms\n", (unsigned)side_a.result, - (uint32_t)((uint64_t)time * 1000 / RTIMER_SECOND)); - - time = RTIMER_NOW(); - PT_SPAWN(&(ecdh_test.pt), &(side_b.pt), ecc_multiply(&side_b)); - time = RTIMER_NOW() - time; - printf("Round 1, Side b: %i, %lu ms\n", (unsigned)side_b.result, - (uint32_t)((uint64_t)time * 1000 / RTIMER_SECOND)); - - /* - * Key Exchange - */ - memcpy(side_a.point_in.x, side_b.point_out.x, sizeof(uint32_t) * 8); - memcpy(side_a.point_in.y, side_b.point_out.y, sizeof(uint32_t) * 8); - memcpy(side_b.point_in.x, side_a.point_out.x, sizeof(uint32_t) * 8); - memcpy(side_b.point_in.y, side_a.point_out.y, sizeof(uint32_t) * 8); - - /* - * Round 2 - */ - time = RTIMER_NOW(); - PT_SPAWN(&(ecdh_test.pt), &(side_a.pt), ecc_multiply(&side_a)); - time = RTIMER_NOW() - time; - printf("Round 2, Side a: %i, %lu ms\n", (unsigned)side_a.result, - (uint32_t)((uint64_t)time * 1000 / RTIMER_SECOND)); - time = RTIMER_NOW(); - PT_SPAWN(&(ecdh_test.pt), &(side_b.pt), ecc_multiply(&side_b)); - time = RTIMER_NOW() - time; - printf("Round 2, Side b: %i, %lu ms\n", (unsigned)side_b.result, - (uint32_t)((uint64_t)time * 1000 / RTIMER_SECOND)); - - /* - * Check Result - */ - memcpy(state.a, side_a.point_out.x, sizeof(uint32_t) * 8); - memcpy(state.b, side_b.point_out.x, sizeof(uint32_t) * 8); - - PT_SPAWN(&(ecdh_test.pt), &(state.pt), ecc_compare(&state)); - if(state.result) { - puts("shared secrets do not match"); - } else { - puts("shared secrets MATCH"); - } - - puts("-----------------------------------------\n" - "Disabling pka..."); - pka_disable(); - - puts("Done!"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/pka/ecc-sign.c b/examples/platform-specific/cc2538-common/pka/ecc-sign.c deleted file mode 100644 index 2b45854db..000000000 --- a/examples/platform-specific/cc2538-common/pka/ecc-sign.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2014, Institute for Pervasive Computing, ETH Zurich. - * All rights reserved. - * - * Author: Andreas Dröscher - * - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-ecdsa-sign-test cc2538 ECDSA-Sign Test Project - * - * ECDSA-Sign example for CC2538-based platforms - * - * This example shows how ECDSA-Sign should be used. The example also verifies - * the ECDSA-Sign functionality. - * - * @{ - * - * \file - * Example demonstrating ECDSA-Sign - */ -#include "contiki.h" -#include "dev/ecc-algorithm.h" -#include "dev/ecc-curve.h" -#include "sys/rtimer.h" -#include "sys/pt.h" - -#include -#include - -PROCESS(ecdsa_sign_test, "ecdsa sign test"); -AUTOSTART_PROCESSES(&ecdsa_sign_test); - -PROCESS_THREAD(ecdsa_sign_test, ev, data) { - PROCESS_BEGIN(); - - /* - * Variable for Time Measurement - */ - static rtimer_clock_t time; - - /* - * Activate Engine - */ - puts("-----------------------------------------\n" - "Initializing pka..."); - pka_init(); - - /* - * Setup Variables - */ - static ecc_compare_state_t comp_state = { - .process = &ecdsa_sign_test, - .size = 8, - }; - static ecc_dsa_sign_state_t state = { - .process = &ecdsa_sign_test, - .curve_info = &nist_p_256, - .secret = { 0x94A949FA, 0x401455A1, 0xAD7294CA, 0x896A33BB, - 0x7A80E714, 0x4321435B, 0x51247A14, 0x41C1CB6B }, - .k_e = { 0x1D1E1F20, 0x191A1B1C, 0x15161718, 0x11121314, - 0x0D0E0F10, 0x090A0B0C, 0x05060708, 0x01020304 }, - .hash = { 0x65637572, 0x20612073, 0x68206F66, 0x20686173, - 0x69732061, 0x68697320, 0x6F2C2054, 0x48616C6C }, - }; - - /* - * Sign - */ - time = RTIMER_NOW(); - PT_SPAWN(&(ecdsa_sign_test.pt), &(state.pt), ecc_dsa_sign(&state)); - time = RTIMER_NOW() - time; - printf("ecc_dsa_sign(), %lu ms\n", - (uint32_t)((uint64_t)time * 1000 / RTIMER_SECOND)); - - /* - * Check Result - */ - static uint32_t ecdsaTestresultR1[] = { 0xC3B4035F, 0x515AD0A6, 0xBF375DCA, 0x0CC1E997, - 0x7F54FDCD, 0x04D3FECA, 0xB9E396B9, 0x515C3D6E }; - static uint32_t ecdsaTestresultS1[] = { 0x5366B1AB, 0x0F1DBF46, 0xB0C8D3C4, 0xDB755B6F, - 0xB9BF9243, 0xE644A8BE, 0x55159A59, 0x6F9E52A6 }; - - memcpy(comp_state.a, state.point_r.x, sizeof(uint32_t) * 8); - memcpy(comp_state.b, ecdsaTestresultR1, sizeof(uint32_t) * 8); - PT_SPAWN(&(ecdsa_sign_test.pt), &(comp_state.pt), ecc_compare(&comp_state)); - if(comp_state.result) { - puts("r1 of signature does not match"); - } else { - puts("r1 of signature OK"); - } - - memcpy(comp_state.a, state.signature_s, sizeof(uint32_t) * 8); - memcpy(comp_state.b, ecdsaTestresultS1, sizeof(uint32_t) * 8); - PT_SPAWN(&(ecdsa_sign_test.pt), &(comp_state.pt), ecc_compare(&comp_state)); - if(comp_state.result) { - puts("s1 of signature does not match"); - } else { - puts("s1 of signature OK"); - } - - puts("-----------------------------------------\n" - "Disabling pka..."); - pka_disable(); - - puts("Done!"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/pka/ecc-verify.c b/examples/platform-specific/cc2538-common/pka/ecc-verify.c deleted file mode 100644 index ff61b88c1..000000000 --- a/examples/platform-specific/cc2538-common/pka/ecc-verify.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2014, Institute for Pervasive Computing, ETH Zurich. - * All rights reserved. - * - * Author: Andreas Dröscher - * - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-ecdsa-verify-test cc2538 ECDSA-Verify Test Project - * - * ECDSA-Verify example for CC2538-based platforms - * - * This example shows how ECDSA-Verify should be used. The example also verifies - * the ECDSA-Verify functionality. - * - * @{ - * - * \file - * Example demonstrating ECDSA-Verify - */ -#include "contiki.h" -#include "dev/ecc-algorithm.h" -#include "dev/ecc-curve.h" -#include "sys/rtimer.h" -#include "sys/pt.h" - -#include -#include - -PROCESS(ecdsa_verify_test, "ecdsa verify test"); -AUTOSTART_PROCESSES(&ecdsa_verify_test); - -PROCESS_THREAD(ecdsa_verify_test, ev, data) { - PROCESS_BEGIN(); - - /* - * Variable for Time Measurement - */ - static rtimer_clock_t time; - - /* - * Activate Engine - */ - puts("-----------------------------------------\n" - "Initializing pka..."); - pka_init(); - - /* - * Setup Variables - */ - static ecc_dsa_verify_state_t state = { - .process = &ecdsa_verify_test, - .curve_info = &nist_p_256, - .signature_r = { 0xC3B4035F, 0x515AD0A6, 0xBF375DCA, 0x0CC1E997, - 0x7F54FDCD, 0x04D3FECA, 0xB9E396B9, 0x515C3D6E }, - .signature_s = { 0x5366B1AB, 0x0F1DBF46, 0xB0C8D3C4, 0xDB755B6F, - 0xB9BF9243, 0xE644A8BE, 0x55159A59, 0x6F9E52A6 }, - .hash = { 0x65637572, 0x20612073, 0x68206F66, 0x20686173, - 0x69732061, 0x68697320, 0x6F2C2054, 0x48616C6C }, - }; - static uint32_t public_x[8] = { 0x5fa58f52, 0xe47cfbf2, 0x300c28c5, 0x6375ba10, - 0x62684e91, 0xda0a9a8f, 0xf9f2ed29, 0x36dfe2c6 }; - static uint32_t public_y[8] = { 0xc772f829, 0x4fabc36f, 0x09daed0b, 0xe93f9872, - 0x35a7cfab, 0x5a3c7869, 0xde1ab878, 0x71a0d4fc }; - - memcpy(state.public.x, public_x, sizeof(public_x)); - memcpy(state.public.y, public_y, sizeof(public_y)); - - /* - * Verify - */ - time = RTIMER_NOW(); - PT_SPAWN(&(ecdsa_verify_test.pt), &(state.pt), ecc_dsa_verify(&state)); - time = RTIMER_NOW() - time; - printf("ecc_dsa_verify(), %lu ms\n", - (uint32_t)((uint64_t)time * 1000 / RTIMER_SECOND)); - - if(state.result) { - puts("signature verification failed"); - } else { - puts("signature verification OK"); - } - - puts("-----------------------------------------\n" - "Disabling pka..."); - pka_disable(); - - puts("Done!"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/test-pwm.c b/examples/platform-specific/cc2538-common/test-pwm.c deleted file mode 100644 index 61ccab835..000000000 --- a/examples/platform-specific/cc2538-common/test-pwm.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-test-pwm Test the CC2538 PWM driver - * - * Demonstrates the use of the CC2538 PWM driver - * - * @{ - * - * \file - * A quick program for testing the CC2538 PWM driver - * \author - * Javier Sanchez - * Antonio Lignan - */ -#include "contiki.h" -#include "cpu.h" -#include "dev/leds.h" -#include "dev/watchdog.h" -#include "dev/sys-ctrl.h" -#include "pwm.h" -#include "lpm.h" -#include "dev/ioc.h" -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -typedef struct { - uint8_t timer; - uint8_t ab; - uint8_t port; - uint8_t pin; - uint8_t duty; - uint8_t off_state; - uint32_t freq; -} pwm_config_t; -/*---------------------------------------------------------------------------*/ -#define MAX_PWM 4 -static const pwm_config_t pwm_num[MAX_PWM] = { - { - .timer = PWM_TIMER_1, - .ab = PWM_TIMER_A, - .port = GPIO_D_NUM, - .pin = 5, - .duty = 15, - .freq = 1, - .off_state = PWM_OFF_WHEN_STOP, - }, { - .timer = PWM_TIMER_1, - .ab = PWM_TIMER_B, - .port = GPIO_D_NUM, - .pin = 4, - .duty = 35, - .freq = 100, - .off_state = PWM_ON_WHEN_STOP, - }, { - .timer = PWM_TIMER_2, - .ab = PWM_TIMER_A, - .port = GPIO_D_NUM, - .pin = 3, - .duty = 50, - .freq = 1000, - .off_state = PWM_OFF_WHEN_STOP, - }, { - .timer = PWM_TIMER_2, - .ab = PWM_TIMER_B, - .port = GPIO_D_NUM, - .pin = 2, - .duty = 85, - .freq = 160000, - .off_state = PWM_ON_WHEN_STOP, - } -}; -static uint8_t pwm_en[MAX_PWM]; -/*---------------------------------------------------------------------------*/ -#if DEBUG -static const char * -gpt_name(uint8_t timer) -{ - switch(timer) { - case PWM_TIMER_0: - return "PWM TIMER 0"; - case PWM_TIMER_1: - return "PWM TIMER 1"; - case PWM_TIMER_2: - return "PWM TIMER 2"; - case PWM_TIMER_3: - return "PWM TIMER 3"; - default: - return "Unknown"; - } -} -#endif -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS(cc2538_pwm_test, "cc2538 pwm test"); -AUTOSTART_PROCESSES(&cc2538_pwm_test); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cc2538_pwm_test, ev, data) -{ - PROCESS_BEGIN(); - - uint8_t i; - memset(pwm_en, 0, MAX_PWM); - - PRINTF("\nStarting the test\n"); - - for(i = 0; i < MAX_PWM; i++) { - if(pwm_enable(pwm_num[i].freq, pwm_num[i].duty, 0, - pwm_num[i].timer, pwm_num[i].ab) == PWM_SUCCESS) { - pwm_en[i] = 1; - PRINTF("%s (%u) configuration OK\n", gpt_name(pwm_num[i].timer), - pwm_num[i].ab); - } - } - - while(1) { - for(i = 0; i < MAX_PWM; i++) { - if((pwm_en[i]) && - (pwm_start(pwm_num[i].timer, pwm_num[i].ab, - pwm_num[i].port, pwm_num[i].pin) != PWM_SUCCESS)) { - pwm_en[i] = 0; - PRINTF("%s (%u) failed to start \n", gpt_name(pwm_num[i].timer), - pwm_num[i].ab); - } - } - - etimer_set(&et, CLOCK_SECOND * 2); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - for(i = 0; i < MAX_PWM; i++) { - if((pwm_en[i]) && - (pwm_toggle_direction(pwm_num[i].timer, - pwm_num[i].ab) != PWM_SUCCESS)) { - PRINTF("%s (%u) invert failed \n", gpt_name(pwm_num[i].timer), - pwm_num[i].ab); - } - } - - etimer_set(&et, CLOCK_SECOND * 2); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - for(i = 0; i < MAX_PWM; i++) { - if((pwm_en[i]) && - (pwm_stop(pwm_num[i].timer, pwm_num[i].ab, - pwm_num[i].port, pwm_num[i].pin, - pwm_num[i].off_state) != PWM_SUCCESS)) { - pwm_en[i] = 0; - PRINTF("%s (%u) failed to stop\n", gpt_name(pwm_num[i].timer), - pwm_num[i].ab); - } - } - - etimer_set(&et, CLOCK_SECOND * 2); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/test-uart.c b/examples/platform-specific/cc2538-common/test-uart.c deleted file mode 100644 index 712d25cf4..000000000 --- a/examples/platform-specific/cc2538-common/test-uart.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2016, Indian Institute of Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-test-uart Test the CC2538 UART - * - * Demonstrates the use of the CC2538 UART - * - * @{ - * - * \file - * A quick program for testing the UART1 on the cc2538 based - * platform which can be used to interface with sensor with UART - * interface and to communicate with other development boards - * \author - * Akshay P M - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/etimer.h" -#include "dev/leds.h" -#include "dev/uart.h" -#include "dev/serial-line.h" -#include -#include -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS(cc2538_uart_demo_process, "cc2538 uart demo"); -AUTOSTART_PROCESSES(&cc2538_uart_demo_process); -/*---------------------------------------------------------------------------*/ -unsigned int -uart1_send_bytes(const unsigned char *s, unsigned int len) -{ - unsigned int i = 0; - - while(s && *s != 0) { - if(i >= len) { - break; - } - uart_write_byte(1, *s++); - i++; - } - return i; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cc2538_uart_demo_process, ev, data) -{ - char *rxdata; - static uint16_t count=0; - char string[20]; - - PROCESS_BEGIN(); - uart_set_input(1, serial_line_input_byte); - etimer_set(&et, CLOCK_SECOND * 4); - leds_toggle(LEDS_GREEN); - - while(1) { - PROCESS_WAIT_UNTIL(etimer_expired(&et)); - sprintf(string, "sending string %u.\n", ++count); - uart1_send_bytes((uint8_t *)string, sizeof(string) - 1); - etimer_reset(&et); - printf("string is being sent\n"); - - PROCESS_YIELD(); - if(ev == serial_line_event_message) { - leds_toggle(LEDS_RED); - rxdata = data; - printf("Data received over UART %s\n", rxdata); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc2538-common/timer-test.c b/examples/platform-specific/cc2538-common/timer-test.c deleted file mode 100644 index 01cf7eede..000000000 --- a/examples/platform-specific/cc2538-common/timer-test.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-examples - * @{ - * - * \defgroup cc2538-timers cc2538 Timer Test Project - * - * This example tests the correct functionality of clocks and timers. - * - * More specifically, it tests clock_seconds, rtimers, etimers and - * clock_delay_usec. - * - * This is largely-based on the same example of the cc2530 port. - * @{ - * - * \file - * Tests related to clocks and timers - */ -#include "contiki.h" -#include "sys/clock.h" -#include "sys/rtimer.h" -#include "dev/leds.h" - -#include -/*---------------------------------------------------------------------------*/ -#define TIMER_TEST_CONF_TEST_CLOCK_DELAY_USEC 1 -#define TIMER_TEST_CONF_TEST_RTIMER 1 -#define TIMER_TEST_CONF_TEST_ETIMER 1 -#define TIMER_TEST_CONF_TEST_CLOCK_SECONDS 1 -/*---------------------------------------------------------------------------*/ -static struct etimer et; - -#if TIMER_TEST_CONF_TEST_CLOCK_DELAY_USEC -static rtimer_clock_t start_count, end_count, diff; -#endif - -#if TIMER_TEST_CONF_TEST_CLOCK_SECONDS -static unsigned long sec; -#endif - -#if TIMER_TEST_CONF_TEST_ETIMER -static clock_time_t count; -#endif - -#if TIMER_TEST_CONF_TEST_RTIMER -static struct rtimer rt; -rtimer_clock_t rt_now, rt_for; -static clock_time_t ct; -#endif - -static uint8_t i; -/*---------------------------------------------------------------------------*/ -PROCESS(timer_test_process, "Timer test process"); -AUTOSTART_PROCESSES(&timer_test_process); -/*---------------------------------------------------------------------------*/ -#if TIMER_TEST_CONF_TEST_RTIMER -void -rt_callback(struct rtimer *t, void *ptr) -{ - rt_now = RTIMER_NOW(); - ct = clock_time(); - printf("Task called at %lu (clock = %lu)\n", rt_now, ct); -} -#endif -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(timer_test_process, ev, data) -{ - - PROCESS_BEGIN(); - - etimer_set(&et, 2 * CLOCK_SECOND); - - PROCESS_YIELD(); - -#if TIMER_TEST_CONF_TEST_CLOCK_DELAY_USEC - printf("-----------------------------------------\n"); - printf("clock_delay_usec test, (10,000 x i) usec:\n"); - printf("N.B. clock_delay_usec is more accurate than rtimers\n"); - i = 1; - while(i < 7) { - start_count = RTIMER_NOW(); - clock_delay_usec(10000 * i); - end_count = RTIMER_NOW(); - diff = end_count - start_count; - printf("Requested: %u usec, Real: %lu rtimer ticks = ~%lu us\n", - 10000 * i, diff, diff * 1000000 / RTIMER_SECOND); - i++; - } -#endif - -#if TIMER_TEST_CONF_TEST_RTIMER - printf("-----------------------------------------\n"); - printf("Rtimer Test, 1 sec (%u rtimer ticks):\n", RTIMER_SECOND); - i = 0; - while(i < 5) { - etimer_set(&et, 2 * CLOCK_SECOND); - printf("=======================\n"); - ct = clock_time(); - rt_now = RTIMER_NOW(); - rt_for = rt_now + RTIMER_SECOND; - printf("Now=%lu (clock = %lu) - For=%lu\n", rt_now, ct, rt_for); - if(rtimer_set(&rt, rt_for, 1, rt_callback, NULL) != RTIMER_OK) { - printf("Error setting\n"); - } - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - i++; - } -#endif - -#if TIMER_TEST_CONF_TEST_ETIMER - printf("-----------------------------------------\n"); - printf("Clock tick and etimer test, 1 sec (%u clock ticks):\n", - CLOCK_SECOND); - i = 0; - while(i < 10) { - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - - count = clock_time(); - printf("%lu ticks\n", count); - - leds_toggle(LEDS_RED); - i++; - } -#endif - -#if TIMER_TEST_CONF_TEST_CLOCK_SECONDS - printf("-----------------------------------------\n"); - printf("Clock seconds test (5s):\n"); - i = 0; - while(i < 10) { - etimer_set(&et, 5 * CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - - sec = clock_seconds(); - printf("%lu seconds\n", sec); - - leds_toggle(LEDS_GREEN); - i++; - } -#endif - - printf("Done!\n"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/Makefile b/examples/platform-specific/cc26x0-cc13x0/Makefile deleted file mode 100644 index bd9600c78..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CONTIKI_PROJECT = cc26x0-demo - -PLATFORMS_ONLY = cc26x0-cc13x0 - -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/cc26x0-cc13x0/Makefile.target b/examples/platform-specific/cc26x0-cc13x0/Makefile.target deleted file mode 100644 index bd54a4fc7..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = cc26x0-cc13x0 diff --git a/examples/platform-specific/cc26x0-cc13x0/README.md b/examples/platform-specific/cc26x0-cc13x0/README.md deleted file mode 100644 index af20f6e3f..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/README.md +++ /dev/null @@ -1,14 +0,0 @@ -CC26xx Demo -=========== -This example demonstrates basic functionality for the two supported CC26xx -boards. More specifically, the example demonstrates: - -* How to take sensor readings -* How to use buttons and the reed relay (triggered by holding a magnet near S3 - on the SensorTag). -* How to send out BLE advertisements, if the chip has BLE capability. The - device will periodically send out BLE beacons with the platform name as - payload. Those beacons/BLE ADV packets can be captured with any BLE-capable - device. Two such applications for iOS are the TI Multitool and the TI - Sensortag app. They can be found in the Apple App Store. If you have a - BLE-capable Mac, you can also use LightBlue for OS X. diff --git a/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/Makefile b/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/Makefile deleted file mode 100644 index 052927896..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -CONTIKI_PROJECT=client - -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = cc26x0-cc13x0 -BOARDS_ONLY = launchpad/cc2650 sensortag/cc2650 srf06/cc26x0 - -MAKE_MAC = MAKE_MAC_BLE -MAKE_NET = MAKE_NET_IPV6 -CONTIKI = ../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/README.md b/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/README.md deleted file mode 100644 index 078667264..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# BLEach: a fully open-source IPv6-over-BLE stack for Constrained Embedded IoT Devices - -## Overview -In 2015, the IETF released the [RFC 7668][rfc7668] that specifies how IPv6 packets -can be exchanged using BLE connections (IPv6 over BLE). -This Contiki extenstion implements [BLEach][bleachWeb], a fully open-source IPv6-over-BLE stack for Contiki. -BLEach in Contiki-NG can be used for node (BLE slave) devices. - -It was developed by -* [Michael Spoerk](http://www.michaelspoerk.com), Graz University of Technology, michael.spoerk@tugraz.at, github user: [spoerk](https://github.com/spoerk) - -This IPv6-over-BLE stack is presented and evaluated in the paper: -[BLEach: Exploiting the Full Potential of IPv6 over BLE in Constrained Embedded IoT Devices](http://sensys.acm.org/2017/), ACM SenSys'17. - -## Features -This implementation includes: - * IPv6-over-BLE node implementation compliant to [RFC 7668][rfc7668] - * connect to a single IPv6-over-BLE border router - * maximum IPv6 packet length of 1280 bytes - * BLE L2CAP channels in LE credit-based flow control mode - * BLE link layer support for version [4.1][bleSpec]: - * BLE advertisement - * BLE connection slave - -It has been tested on the TI CC2650 SensorTag and the TI CC2650 LaunchPad hardware. - -## Modules -The IPv6-over-BLE stack comes with the following modules: - -### BLE radio -The implementation of the BLE radio for the TI CC26xx platform is implemented in `arch/cpu/cc26x0-cc13x0/rf-core/ble-cc2650.c` -and `arch/cpu/cc26x0-cc13x0/rf-core/ble-hal/*.[ch]`. -These files contain all the hardware specific code for supporting BLE as a link layer. - -### BLE L2CAP layer -The L2CAP LE credit-based flow control support is implemented in `arch/cpu/cc26x0-cc13x0/rf-core/ble-l2cap.c`. -Besides implementing rudimentary L2CAP support, this module handles fragmentation of large IPv6 packets. - -## Using BLEach -Currently, BLEach is only available for the Texas Instruments CC2650 hardware platform. - -The following sections describe how to configure BLEach for IPv6-over-BLE nodes and border routers. - -### IPv6-over-BLE node (BLE slave) -To enable IPv6 over BLE, the project conf needs to contain: -``` -#define PACKETBUF_CONF_SIZE 1280 -#define QUEUEBUF_CONF_NUM 1 -#define UIP_CONF_BUFFER_SIZE 1280 - -#define NETSTACK_CONF_RADIO ble_cc2650_driver -#define NETSTACK_CONF_MAC ble_l2cap_driver - -#define RTIMER_CONF_MULTIPLE_ACCESS 1 - -/* 6LoWPAN settings */ -#define SICSLOWPAN_CONF_MAC_MAX_PAYLOAD 1280 -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 -#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 0 /* always use compression */ -#define SICSLOWPAN_CONF_FRAG 0 -#define SICSLOWPAN_FRAMER_HDRLEN 0 - -/* network stack settings */ -#define UIP_CONF_ROUTER 0 -#define UIP_CONF_ND6_SEND_NA 1 - -``` - -The following optional parameter can be used to configure that BLE advertisement behaviour: -``` -#define BLE_CONF_DEVICE_NAME "TI CC26xx device" -#define BLE_CONF_ADV_INTERVAL 25 -``` -`BLE_CONF_DEVICE_NAME` holds the device name that is used for advertisement, `BLE_CONF_ADV_INTERVAL` -specifies the used advertisement interval in milliseconds. - - -[rfc7668]: https://tools.ietf.org/html/rfc7668 -[bleSpec]: https://www.bluetooth.com/specifications/bluetooth-core-specification/legacy-specifications -[bleachWeb]: http://www.iti.tugraz.at/BLEach diff --git a/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/client.c b/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/client.c deleted file mode 100644 index 79878cf31..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/client.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2017, Graz University of Technology - * 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 - * A simple IPv6-over-BLE UDP-client. - * - * \author - * Michael Spoerk - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" - -#include "net/ipv6/uip-icmp6.h" - -#include -#include - -#include "os/dev/ble-hal.h" -/*---------------------------------------------------------------------------*/ -#define SERVER_IP "::" -#define CLIENT_PORT 61617 -#define SERVER_PORT 61616 - -#define PING_TIMEOUT (CLOCK_SECOND / 4) -#define CLIENT_SEND_INTERVAL (CLOCK_SECOND * 1) - -#define UDP_LEN_MAX 255 -/*---------------------------------------------------------------------------*/ -static uip_ipaddr_t server_addr; -static struct uip_icmp6_echo_reply_notification icmp_notification; -static uint8_t echo_received; -static struct uip_udp_conn *conn; - -static struct etimer timer; -static char buf[UDP_LEN_MAX]; -static uint16_t packet_counter; -/*---------------------------------------------------------------------------*/ -PROCESS(ipv6_ble_client_process, "IPv6 over BLE - client process"); -AUTOSTART_PROCESSES(&ipv6_ble_client_process); -/*---------------------------------------------------------------------------*/ -void -icmp_reply_handler(uip_ipaddr_t *source, uint8_t ttl, - uint8_t *data, uint16_t datalen) -{ - if(uip_ip6addr_cmp(source, &server_addr)) { - printf("echo response received\n"); - echo_received = 1; - } -} -/*---------------------------------------------------------------------------*/ -static void -tcpip_handler(void) -{ - char data[UDP_LEN_MAX]; - if(uip_newdata()) { - strncpy(data, uip_appdata, uip_datalen()); - data[uip_datalen()] = '\0'; - printf("rec. message: <%s>\n", data); - } -} -/*---------------------------------------------------------------------------*/ -static void -timeout_handler(void) -{ - sprintf(buf, "Hello server %04u!", packet_counter); - printf("send message: <%s>\n", buf); - uip_udp_packet_send(conn, buf, strlen(buf)); - packet_counter++; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ipv6_ble_client_process, ev, data) -{ - PROCESS_BEGIN(); - printf("IPv6-over-BLE client started\n"); - - uiplib_ipaddrconv(SERVER_IP, &server_addr); - uip_icmp6_echo_reply_callback_add(&icmp_notification, icmp_reply_handler); - - printf("pinging the IPv6-over-BLE server\n"); - - do { - etimer_set(&timer, PING_TIMEOUT); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&timer)); - uip_icmp6_send(&server_addr, ICMP6_ECHO_REQUEST, 0, 20); - } while(!echo_received); - - conn = udp_new(&server_addr, UIP_HTONS(SERVER_PORT), NULL); - udp_bind(conn, UIP_HTONS(CLIENT_PORT)); - - etimer_set(&timer, CLIENT_SEND_INTERVAL); - - while(1) { - PROCESS_YIELD(); - if((ev == PROCESS_EVENT_TIMER) && (data == &timer)) { - timeout_handler(); - etimer_set(&timer, CLIENT_SEND_INTERVAL); - } else if(ev == tcpip_event) { - tcpip_handler(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/project-conf.h b/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/project-conf.h deleted file mode 100644 index b311a2fa5..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/ble-ipv6/project-conf.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2017, Graz University of Technology - * 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. - */ - -/** - * \author - * Michael Spoerk - */ -/*---------------------------------------------------------------------------*/ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define BOARD_CONF_DEBUGGER_DEVPACK 1 -/*---------------------------------------------------------------------------*/ -#define PACKETBUF_CONF_SIZE 1280 -#define QUEUEBUF_CONF_NUM 1 -#define UIP_CONF_BUFFER_SIZE 1280 - -#define NETSTACK_CONF_RADIO ble_cc2650_driver - -#define LOG_CONF_LEVEL_MAC LOG_LEVEL_INFO - -/* BLE L2CAP settings */ -#define BLE_CONF_DEVICE_NAME "TI CC26xx device" -#define BLE_CONF_ADV_INTERVAL 25 - -/*/ * 6LoWPAN settings * / */ -#define SICSLOWPAN_CONF_MAC_MAX_PAYLOAD 1280 -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_6LORH -#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 0 /* always use compression */ -#define SICSLOWPAN_CONF_FRAG 0 -#define SICSLOWPAN_FRAMER_HDRLEN 0 -/* */ -/*/ * network stack settings * / */ -#define UIP_CONF_ROUTER 0 -#define UIP_CONF_ND6_SEND_NA 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-demo.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-demo.c deleted file mode 100644 index 1b71feeb7..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-demo.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26xx-platforms - * @{ - * - * \defgroup cc26xx-examples CC26xx Example Projects - * - * Example projects for CC26xx-based platforms. - * @{ - * - * \defgroup cc26xx-demo CC26xx Demo Project - * - * Example project demonstrating the CC13xx/CC26xx platforms - * - * This example will work for the following boards: - * - cc26x0-cc13x0: SmartRF06EB + CC13xx/CC26xx EM - * - CC2650 and CC1350 SensorTag - * - CC1310, CC1350, CC2650 LaunchPads - * - * This is an IPv6/RPL-enabled example. Thus, if you have a border router in - * your installation (same RDC layer, same PAN ID and RF channel), you should - * be able to ping6 this demo node. - * - * This example also demonstrates CC26xx BLE operation. The process starts - * the BLE beacon daemon (implemented in the RF driver). The daemon will - * send out a BLE beacon periodically. Use any BLE-enabled application (e.g. - * LightBlue on OS X or the TI BLE Multitool smartphone app) and after a few - * seconds the cc26xx device will be discovered. - * - * - etimer/clock : Every CC26XX_DEMO_LOOP_INTERVAL clock ticks the LED defined - * as CC26XX_DEMO_LEDS_PERIODIC will toggle and the device - * will print out readings from some supported sensors - * - sensors : Some sensortag sensors are read asynchronously (see sensor - * documentation). For those, this example will print out - * readings in a staggered fashion at a random interval - * - Buttons : CC26XX_DEMO_TRIGGER_1 button will toggle CC26XX_DEMO_LEDS_BUTTON - * - CC26XX_DEMO_TRIGGER_2 turns on LEDS_REBOOT and causes a - * watchdog reboot - * - The remaining buttons will just print something - * - The example also shows how to retrieve the duration of a - * button press (in ticks). The driver will generate a - * sensors_changed event upon button release - * - Reed Relay : Will toggle the sensortag buzzer on/off - * - * @{ - * - * \file - * Example demonstrating the cc26xx platforms - */ -#include "contiki.h" -#include "sys/etimer.h" -#include "sys/ctimer.h" -#include "dev/leds.h" -#include "dev/watchdog.h" -#include "dev/button-hal.h" -#include "random.h" -#include "button-sensor.h" -#include "batmon-sensor.h" -#include "board-peripherals.h" -#include "rf-core/rf-ble.h" - -#include "ti-lib.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define CC26XX_DEMO_LOOP_INTERVAL (CLOCK_SECOND * 20) -#define CC26XX_DEMO_LEDS_PERIODIC LEDS_YELLOW -#define CC26XX_DEMO_LEDS_BUTTON LEDS_RED -#define CC26XX_DEMO_LEDS_REBOOT LEDS_ALL -/*---------------------------------------------------------------------------*/ -#define CC26XX_DEMO_TRIGGER_1 BOARD_BUTTON_HAL_INDEX_KEY_LEFT -#define CC26XX_DEMO_TRIGGER_2 BOARD_BUTTON_HAL_INDEX_KEY_RIGHT - -#if BOARD_SENSORTAG -#define CC26XX_DEMO_TRIGGER_3 BOARD_BUTTON_HAL_INDEX_REED_RELAY -#endif -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS(cc26xx_demo_process, "cc26xx demo process"); -AUTOSTART_PROCESSES(&cc26xx_demo_process); -/*---------------------------------------------------------------------------*/ -#if BOARD_SENSORTAG -/*---------------------------------------------------------------------------*/ -/* - * Update sensor readings in a staggered fashion every SENSOR_READING_PERIOD - * ticks + a random interval between 0 and SENSOR_READING_RANDOM ticks - */ -#define SENSOR_READING_PERIOD (CLOCK_SECOND * 20) -#define SENSOR_READING_RANDOM (CLOCK_SECOND << 4) - -static struct ctimer bmp_timer, opt_timer, hdc_timer, tmp_timer, mpu_timer; -/*---------------------------------------------------------------------------*/ -static void init_bmp_reading(void *not_used); -static void init_opt_reading(void *not_used); -static void init_hdc_reading(void *not_used); -static void init_tmp_reading(void *not_used); -static void init_mpu_reading(void *not_used); -/*---------------------------------------------------------------------------*/ -static void -print_mpu_reading(int reading) -{ - if(reading < 0) { - printf("-"); - reading = -reading; - } - - printf("%d.%02d", reading / 100, reading % 100); -} -/*---------------------------------------------------------------------------*/ -static void -get_bmp_reading() -{ - int value; - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - - value = bmp_280_sensor.value(BMP_280_SENSOR_TYPE_PRESS); - if(value != CC26XX_SENSOR_READING_ERROR) { - printf("BAR: Pressure=%d.%02d hPa\n", value / 100, value % 100); - } else { - printf("BAR: Pressure Read Error\n"); - } - - value = bmp_280_sensor.value(BMP_280_SENSOR_TYPE_TEMP); - if(value != CC26XX_SENSOR_READING_ERROR) { - printf("BAR: Temp=%d.%02d C\n", value / 100, value % 100); - } else { - printf("BAR: Temperature Read Error\n"); - } - - SENSORS_DEACTIVATE(bmp_280_sensor); - - ctimer_set(&bmp_timer, next, init_bmp_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -get_tmp_reading() -{ - int value; - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - - value = tmp_007_sensor.value(TMP_007_SENSOR_TYPE_ALL); - - if(value == CC26XX_SENSOR_READING_ERROR) { - printf("TMP: Ambient Read Error\n"); - return; - } - - value = tmp_007_sensor.value(TMP_007_SENSOR_TYPE_AMBIENT); - printf("TMP: Ambient=%d.%03d C\n", value / 1000, value % 1000); - - value = tmp_007_sensor.value(TMP_007_SENSOR_TYPE_OBJECT); - printf("TMP: Object=%d.%03d C\n", value / 1000, value % 1000); - - SENSORS_DEACTIVATE(tmp_007_sensor); - - ctimer_set(&tmp_timer, next, init_tmp_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -get_hdc_reading() -{ - int value; - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - - value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_TEMP); - if(value != CC26XX_SENSOR_READING_ERROR) { - printf("HDC: Temp=%d.%02d C\n", value / 100, value % 100); - } else { - printf("HDC: Temp Read Error\n"); - } - - value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMID); - if(value != CC26XX_SENSOR_READING_ERROR) { - printf("HDC: Humidity=%d.%02d %%RH\n", value / 100, value % 100); - } else { - printf("HDC: Humidity Read Error\n"); - } - - ctimer_set(&hdc_timer, next, init_hdc_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -get_light_reading() -{ - int value; - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - - value = opt_3001_sensor.value(0); - if(value != CC26XX_SENSOR_READING_ERROR) { - printf("OPT: Light=%d.%02d lux\n", value / 100, value % 100); - } else { - printf("OPT: Light Read Error\n"); - } - - /* The OPT will turn itself off, so we don't need to call its DEACTIVATE */ - ctimer_set(&opt_timer, next, init_opt_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -get_mpu_reading() -{ - int value; - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - - printf("MPU Gyro: X="); - value = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_GYRO_X); - print_mpu_reading(value); - printf(" deg/sec\n"); - - printf("MPU Gyro: Y="); - value = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_GYRO_Y); - print_mpu_reading(value); - printf(" deg/sec\n"); - - printf("MPU Gyro: Z="); - value = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_GYRO_Z); - print_mpu_reading(value); - printf(" deg/sec\n"); - - printf("MPU Acc: X="); - value = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_ACC_X); - print_mpu_reading(value); - printf(" G\n"); - - printf("MPU Acc: Y="); - value = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_ACC_Y); - print_mpu_reading(value); - printf(" G\n"); - - printf("MPU Acc: Z="); - value = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_ACC_Z); - print_mpu_reading(value); - printf(" G\n"); - - SENSORS_DEACTIVATE(mpu_9250_sensor); - - ctimer_set(&mpu_timer, next, init_mpu_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -init_bmp_reading(void *not_used) -{ - SENSORS_ACTIVATE(bmp_280_sensor); -} -/*---------------------------------------------------------------------------*/ -static void -init_opt_reading(void *not_used) -{ - SENSORS_ACTIVATE(opt_3001_sensor); -} -/*---------------------------------------------------------------------------*/ -static void -init_hdc_reading(void *not_used) -{ - SENSORS_ACTIVATE(hdc_1000_sensor); -} -/*---------------------------------------------------------------------------*/ -static void -init_tmp_reading(void *not_used) -{ - SENSORS_ACTIVATE(tmp_007_sensor); -} -/*---------------------------------------------------------------------------*/ -static void -init_mpu_reading(void *not_used) -{ - mpu_9250_sensor.configure(SENSORS_ACTIVE, MPU_9250_SENSOR_TYPE_ALL); -} -#endif -/*---------------------------------------------------------------------------*/ -static void -get_sync_sensor_readings(void) -{ - int value; - - printf("-----------------------------------------\n"); - - value = batmon_sensor.value(BATMON_SENSOR_TYPE_TEMP); - printf("Bat: Temp=%d C\n", value); - - value = batmon_sensor.value(BATMON_SENSOR_TYPE_VOLT); - printf("Bat: Volt=%d mV\n", (value * 125) >> 5); - -#if BOARD_SMARTRF06EB - SENSORS_ACTIVATE(als_sensor); - - value = als_sensor.value(0); - printf("ALS: %d raw\n", value); - - SENSORS_DEACTIVATE(als_sensor); -#endif - - return; -} -/*---------------------------------------------------------------------------*/ -static void -init_sensors(void) -{ - SENSORS_ACTIVATE(batmon_sensor); -} -/*---------------------------------------------------------------------------*/ -static void -init_sensor_readings(void) -{ -#if BOARD_SENSORTAG - SENSORS_ACTIVATE(hdc_1000_sensor); - SENSORS_ACTIVATE(tmp_007_sensor); - SENSORS_ACTIVATE(opt_3001_sensor); - SENSORS_ACTIVATE(bmp_280_sensor); - - init_mpu_reading(NULL); -#endif -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cc26xx_demo_process, ev, data) -{ - - PROCESS_BEGIN(); - - printf("CC26XX demo\n"); - - init_sensors(); - - /* Init the BLE advertisement daemon */ - rf_ble_beacond_config(0, BOARD_STRING); - rf_ble_beacond_start(); - - etimer_set(&et, CC26XX_DEMO_LOOP_INTERVAL); - get_sync_sensor_readings(); - init_sensor_readings(); - - while(1) { - - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_TIMER) { - if(data == &et) { - leds_toggle(CC26XX_DEMO_LEDS_PERIODIC); - - get_sync_sensor_readings(); - - etimer_set(&et, CC26XX_DEMO_LOOP_INTERVAL); - } - } else if(ev == button_hal_periodic_event) { - button_hal_button_t *button = data; - - printf("%s periodic event, duration %d seconds\n", - BUTTON_HAL_GET_DESCRIPTION(button), - button->press_duration_seconds); - } else if(ev == button_hal_release_event) { - button_hal_button_t *btn = (button_hal_button_t *)data; - - printf("%s release event\n", BUTTON_HAL_GET_DESCRIPTION(btn)); - - if(btn->unique_id== CC26XX_DEMO_TRIGGER_1) { - leds_toggle(CC26XX_DEMO_LEDS_BUTTON); - } else if(btn->unique_id == CC26XX_DEMO_TRIGGER_2) { - leds_on(CC26XX_DEMO_LEDS_REBOOT); - watchdog_reboot(); -#if BOARD_SENSORTAG - } else if(btn->unique_id == CC26XX_DEMO_TRIGGER_3) { - if(buzzer_state()) { - buzzer_stop(); - } else { - buzzer_start(1000); - } - } - } else if(ev == sensors_event) { - if(data == &bmp_280_sensor) { - get_bmp_reading(); - } else if(data == &opt_3001_sensor) { - get_light_reading(); - } else if(data == &hdc_1000_sensor) { - get_hdc_reading(); - } else if(data == &tmp_007_sensor) { - get_tmp_reading(); - } else if(data == &mpu_9250_sensor) { - get_mpu_reading(); -#endif - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/Makefile b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/Makefile deleted file mode 100644 index 6d70a3a24..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -CONTIKI_PROJECT = cc26x0-web-demo -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = cc26x0-cc13x0 - -MODULES_REL += ./resources - -PROJECT_SOURCEFILES += coap-server.c net-uart.c mqtt-client.c -PROJECT_SOURCEFILES += httpd-simple.c - -ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_CLASSIC) -# 6lbr only supports RPL Classic -PROJECT_SOURCEFILES += cetic-6lbr-client.c -endif - -# REST Engine shall use Erbium CoAP implementation -MODULES += os/net/app-layer/mqtt -MODULES += os/net/app-layer/coap - -CONTIKI=../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/Makefile.target b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/Makefile.target deleted file mode 100644 index bd54a4fc7..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = cc26x0-cc13x0 diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/README.md b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/README.md deleted file mode 100644 index 6a85ee0b5..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/README.md +++ /dev/null @@ -1,185 +0,0 @@ -CC26xx Web Demo Readme -====================== -This demo project combines a number of web-based applications aiming to -demonstrate the CC26xx capability. The applications are: - -* A network-based UART -* A client for [6lbr](http://cetic.github.io/6lbr/) -* A CoAP server -* An MQTT client -* A web server which can be used to display sensor readings but also to - configure MQTT functionality - -The example has been configured to run for all CC26xx-based boards. - -To change between target boards, follow the instructions in the wiki. -Do not forget to `make clean` when switching between the boards. - -Specifically for some older CC2650 SensorTags, you may also need to change -`project-conf.h` such that `SENSORTAG_CC2650_REV_1_2_0` is defined as 1. To -check if your sensortag is one of those older ones, look for "REV: 1.2" -printed on the PCB. There may also be a sticker that reads "HW Rev 1.2.0". An -indication that you may need to do this is if you get a "Could not open flash -to load config" error on device startup. - -You can disable some of those individual components by changing the respective -defines in `project-conf.h`. For instance, to disable the CoAP functionality, -set `#define CC26XX_WEB_DEMO_CONF_COAP_SERVER 0`. The web server cannot be -disabled, all other aforementioned applications can. - -Network UART (net-uart) ------------------------ -This example only makes sense if you are using the Srf or if you have taken -the sensortag out of its case and you have it connected over JTAG to the Srf. - -The net-uart does two things: - -* When you type a string to the UART console, the string will be sent verbatim - to a remote UDP port 7777 listener. This can be for example a netcat listener - on a linux or OS X PC: - `nc -6ulkw 1 7777` -* The net-uart also listens to UDP port 7777 and when it receives a string over - UDP, it will print it verbatim over UART. - -The example will initially send packets to a hard-coded IPv6 address. This can -be changed very easily by entering a different IPv6 address to the console. -Thus, when the serial input string is an IPv6 address, it will not be sent as -any other string would, but instead it will configure the example to send to a -different remote address. This new IPv6 address is not persistent across -device reboots. - -6lbr Client ------------ -This will periodically send a UDP packet to your 6lbr, containing network -information, which will be used by 6lbr to construct a network graph. To see -this in action, fire up a browser and navigate to the 6lbr web page. The -default address is http://[bbbb::100]. Once the page loads, click the 'sensors' -tab, as per the image below. - -![6lbr](img/6lbr-web.png) - -CoAP Server ------------ -For this functionality to work, you will need to install a CoAP client. -You can achieve this by following the guides on how to set up your system -[in the wiki](https://github.com/contiki-ng/contiki-ng/wiki#setting-up-contiki-ng). - -You should start by sending a CoAP GET request for the `.well-known/core` -resource. If you are using libcoap's CoAP client, this can be achieved by: - -``` -coap-client -m get coap://[]/.well-known/core -``` - -Adjust the above command to match the command line arguments of your CoAP -client. - -The Device will respond with a list of all available CoAP resources. This list -will be different between the various CC13x0/CC26x0 boards. - -Send a CoAP GET request for any of those resrouces to retrieve its value. - -Send a CoAP POST to the `lt/g` or `lt/r` to toggle the green/red LED -respectively. - -You can also use CoAP to enable/disable BLE advertisements! This can be done -by sending a PUT or POST request to the `dev/ble_advd` resource. Your request -should contain the desired payload, which can be: - -* `mode=on|off` -* `name=` -* `interval=` - -or a combination of the above delimited with an amp. For example, you can set -as payload `mode=on&name=My CC26xx Device 4&interval=5`. - -Bear in mind that you must set `name` at least once before enabling BLE -advertisements. If you fail to do so, the RF will refuse to enter BLE mode and -the CoAP engine will return 4.03 forbidden. The values of `name` and `interval` -persist across BLE on/off cycles, so you only have to set them once. The values -do _not_ persist through device powercycles. - -HTTPD ------ -Back on the 6lbr page, hit the 'web' link corresponding to your device. This -will take you to a web page served by the CC26xx. The HTTPD serves two pages: - -* index.html: Provides sensor readings and network information -* config.html: Can be used to configure the MQTT client (more below) - -In the navigation bar at the top there is also a third link, which will take -you directly to your device's page on IBM's quickstart service. - -IBM Quickstart / MQTT Client ----------------------------- -The MQTT client can be used to: - -* Publish sensor readings to an MQTT broker. -* Subscribe to a topic and as a result receive commands from an MQTT broker - -The device will try to connect to IBM's quickstart over NAT64, so you will -need a NAT64 gateway in your network to make this work. A guide on how to -setup NAT64 is out of scope here. If this is not an option for you, you can -configure the device to publish to a local MQTT broker over end-to-end IPv6. -See below on how to change the destination broker's address. - -By default the device will publish readings to IBM's quickstart service. The -publish messages include sensor readings but also some other information such -as device uptime in seconds and a message sequence number. Click the "IBM -Quickstart" link in the web page to go directly to your device's page -on Quickstart. After a few seconds, you will see something like this: - -![A SensorTag on IBM Quickstart](img/quickstart-sensortag.png) - -Sensor readings are only published if they have changed since the previous -reading (BatMon is an exception and always gets published). Additionally, you -can turn on/off individual readings from the config.html web page, as per the -figure below. - -![Sensor Readings Configuration](img/sensor-readings-config.png) - -Some of the MQTT client functionality can be configured even further: - -* You can change the broker IP and port. This is useful if you want to use your - own MQTT broker instead of IBM's quickstart. The example has been tested - successfully with [mosquitto](http://mosquitto.org/) -* You can change the publish interval. Recommended values are 10secs or higher. - You will not be allowed to set this to anything less than 5 seconds. -* If you want to use IBM's cloud service with a registered device, change - 'Org ID' and provide an 'Auth Token', which acts as a 'password', but bear in - mind that it gets transported in clear text, both over the web configuration - page as well as inside MQTT messages. -* The remaining configuration options are related to the content of MQTT - messages and in general you won't have to modify them. - -For the SensorTag, changes to the MQTT configuration get saved in external -flash and persist across device restarts. The same does not hold true for -Srf+EM builds. - -You can also subscribe to topics and receive commands, but this will only -work if you use "Org ID" != 'quickstart'. Thus, if you provide a different -Org ID (do not forget the auth token!), the device will subscribe to: - -`iot-2/cmd/+/fmt/json` - -You can then use this to toggle LEDs or to turn the buzzer on and off. -The buzzer is only available on the SensorTag. To do this, you can for example -use mosquitto client to publish to `iot-2/cmd/leds/fmt/json`. So, to turn -the buzzer on, you would do this: - -`mosquitto_pub -h -m "1" -t iot-2/cmd/buzz/fmt/json` - -Where `broker IP` should be replaced with the IP address of your mosquitto -broker (the one where you device has subscribed). Replace `-m "1'` with `-m "0"` -to turn the buzzer back off. Replace `buzz` with `leds` in the topic to change -the state of the LED. - -Bear in mind that, even though the topic suggests that messages are of json -format, they are in fact not. This was done in order to avoid linking a json -parser into the firmware. - -IBM Watson IoT Platform ----------------------------- -To use IBM Watson IoT Platform, you have to go to SECURITY tab of Device page to select "TLS Optional". This step is critical. If you don't do this, you need to use TLS for connection and default cc26x0-web-demo won't work. - -![IBM Watson IoT Platform TLS Optional Configuration](img/ibm-watson-iot-platform-tls-optional.png) diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-web-demo.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-web-demo.c deleted file mode 100644 index 6333d5ad5..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-web-demo.c +++ /dev/null @@ -1,1062 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * Main module for the CC26XX web demo. Activates on-device resources, - * takes sensor readings periodically and caches them for all other modules - * to use. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "contiki-net.h" -#include "coap-engine.h" -#include "board-peripherals.h" -#include "lib/sensors.h" -#include "lib/list.h" -#include "sys/process.h" -#include "net/ipv6/sicslowpan.h" -#include "dev/button-hal.h" -#include "batmon-sensor.h" -#include "httpd-simple.h" -#include "cc26x0-web-demo.h" -#include "mqtt-client.h" -#include "coap-server.h" - -#include -#include -#include -#include - -#include "ti-lib.h" -/*---------------------------------------------------------------------------*/ -PROCESS_NAME(cetic_6lbr_client_process); -PROCESS(cc26xx_web_demo_process, "CC26XX Web Demo"); -/*---------------------------------------------------------------------------*/ -/* - * Update sensor readings in a staggered fashion every SENSOR_READING_PERIOD - * ticks + a random interval between 0 and SENSOR_READING_RANDOM ticks - */ -#define SENSOR_READING_PERIOD (CLOCK_SECOND * 20) -#define SENSOR_READING_RANDOM (CLOCK_SECOND << 4) - -struct ctimer batmon_timer; - -#if BOARD_SENSORTAG -struct ctimer bmp_timer, hdc_timer, tmp_timer, opt_timer, mpu_timer; -#endif -/*---------------------------------------------------------------------------*/ -/* Provide visible feedback via LEDS while searching for a network */ -#define NO_NET_LED_DURATION (CC26XX_WEB_DEMO_NET_CONNECT_PERIODIC >> 1) - -static struct etimer et; -static struct ctimer ct; -/*---------------------------------------------------------------------------*/ -/* Parent RSSI functionality */ -#if CC26XX_WEB_DEMO_READ_PARENT_RSSI -static struct uip_icmp6_echo_reply_notification echo_reply_notification; -static struct etimer echo_request_timer; -int def_rt_rssi = 0; -#endif -/*---------------------------------------------------------------------------*/ -#if CC26XX_WEB_DEMO_ADC_DEMO -PROCESS(adc_process, "ADC process"); - -static uint16_t single_adc_sample; -static struct etimer et_adc; -#endif -/*---------------------------------------------------------------------------*/ -process_event_t cc26xx_web_demo_publish_event; -process_event_t cc26xx_web_demo_config_loaded_event; -process_event_t cc26xx_web_demo_load_config_defaults; -/*---------------------------------------------------------------------------*/ -/* Saved settings on flash: store, offset, magic */ -#define CONFIG_FLASH_OFFSET 0 -#define CONFIG_MAGIC 0xCC265002 - -cc26xx_web_demo_config_t cc26xx_web_demo_config; -/*---------------------------------------------------------------------------*/ -/* A cache of sensor values. Updated periodically or upon key press */ -LIST(sensor_list); -/*---------------------------------------------------------------------------*/ -/* The objects representing sensors used in this demo */ -#define DEMO_SENSOR(name, type, descr, xml_element, form_field, units) \ - cc26xx_web_demo_sensor_reading_t name##_reading = \ - { NULL, 0, 0, descr, xml_element, form_field, units, type, 1, 1 } - -/* CC26xx sensors */ -DEMO_SENSOR(batmon_temp, CC26XX_WEB_DEMO_SENSOR_BATMON_TEMP, - "Battery Temp", "battery-temp", "batmon_temp", - CC26XX_WEB_DEMO_UNIT_TEMP); -DEMO_SENSOR(batmon_volt, CC26XX_WEB_DEMO_SENSOR_BATMON_VOLT, - "Battery Volt", "battery-volt", "batmon_volt", - CC26XX_WEB_DEMO_UNIT_VOLT); - -#if CC26XX_WEB_DEMO_ADC_DEMO -DEMO_SENSOR(adc_dio23, CC26XX_WEB_DEMO_SENSOR_ADC_DIO23, - "ADC DIO23", "adc-dio23", "adc_dio23", - CC26XX_WEB_DEMO_UNIT_VOLT); -#endif - -/* Sensortag sensors */ -#if BOARD_SENSORTAG -DEMO_SENSOR(bmp_pres, CC26XX_WEB_DEMO_SENSOR_BMP_PRES, - "Air Pressure", "air-pressure", "bmp_pres", - CC26XX_WEB_DEMO_UNIT_PRES); -DEMO_SENSOR(bmp_temp, CC26XX_WEB_DEMO_SENSOR_BMP_TEMP, - "Air Temp", "air-temp", "bmp_temp", - CC26XX_WEB_DEMO_UNIT_TEMP); -DEMO_SENSOR(hdc_temp, CC26XX_WEB_DEMO_SENSOR_HDC_TEMP, - "HDC Temp", "hdc-temp", "hdc_temp", - CC26XX_WEB_DEMO_UNIT_TEMP); -DEMO_SENSOR(hdc_hum, CC26XX_WEB_DEMO_SENSOR_HDC_HUMIDITY, - "HDC Humidity", "hdc-humidity", "hdc_hum", - CC26XX_WEB_DEMO_UNIT_HUMIDITY); -DEMO_SENSOR(tmp_amb, CC26XX_WEB_DEMO_SENSOR_TMP_AMBIENT, - "Ambient Temp", "ambient-temp", "tmp_amb", - CC26XX_WEB_DEMO_UNIT_TEMP); -DEMO_SENSOR(tmp_obj, CC26XX_WEB_DEMO_SENSOR_TMP_OBJECT, - "Object Temp", "object-temp", "tmp_obj", - CC26XX_WEB_DEMO_UNIT_TEMP); -DEMO_SENSOR(opt, CC26XX_WEB_DEMO_SENSOR_OPT_LIGHT, - "Light", "light", "light", - CC26XX_WEB_DEMO_UNIT_LIGHT); - -/* MPU Readings */ -DEMO_SENSOR(mpu_acc_x, CC26XX_WEB_DEMO_SENSOR_MPU_ACC_X, - "Acc X", "acc-x", "acc_x", - CC26XX_WEB_DEMO_UNIT_ACC); -DEMO_SENSOR(mpu_acc_y, CC26XX_WEB_DEMO_SENSOR_MPU_ACC_Y, - "Acc Y", "acc-y", "acc_y", - CC26XX_WEB_DEMO_UNIT_ACC); -DEMO_SENSOR(mpu_acc_z, CC26XX_WEB_DEMO_SENSOR_MPU_ACC_Z, - "Acc Z", "acc-z", "acc_z", - CC26XX_WEB_DEMO_UNIT_ACC); - -DEMO_SENSOR(mpu_gyro_x, CC26XX_WEB_DEMO_SENSOR_MPU_GYRO_X, - "Gyro X", "gyro-x", "gyro_x", - CC26XX_WEB_DEMO_UNIT_GYRO); -DEMO_SENSOR(mpu_gyro_y, CC26XX_WEB_DEMO_SENSOR_MPU_GYRO_Y, - "Gyro Y", "gyro-y", "gyro_y", - CC26XX_WEB_DEMO_UNIT_GYRO); -DEMO_SENSOR(mpu_gyro_z, CC26XX_WEB_DEMO_SENSOR_MPU_GYRO_Z, - "Gyro Z", "gyro-z", "gyro_Z", - CC26XX_WEB_DEMO_UNIT_GYRO); -#endif -/*---------------------------------------------------------------------------*/ -#if BOARD_SENSORTAG -static void init_bmp_reading(void *data); -static void init_light_reading(void *data); -static void init_hdc_reading(void *data); -static void init_tmp_reading(void *data); -static void init_mpu_reading(void *data); -#endif -/*---------------------------------------------------------------------------*/ -static void -publish_led_off(void *d) -{ - leds_off(CC26XX_WEB_DEMO_STATUS_LED); -} -/*---------------------------------------------------------------------------*/ -static void -save_config() -{ - /* Dump current running config to flash */ -#if BOARD_SENSORTAG || BOARD_LAUNCHPAD - int rv; - cc26xx_web_demo_sensor_reading_t *reading = NULL; - - rv = ext_flash_open(NULL); - - if(!rv) { - printf("Could not open flash to save config\n"); - ext_flash_close(NULL); - return; - } - - rv = ext_flash_erase(NULL, CONFIG_FLASH_OFFSET, sizeof(cc26xx_web_demo_config_t)); - - if(!rv) { - printf("Error erasing flash\n"); - } else { - cc26xx_web_demo_config.magic = CONFIG_MAGIC; - cc26xx_web_demo_config.len = sizeof(cc26xx_web_demo_config_t); - cc26xx_web_demo_config.sensors_bitmap = 0; - - for(reading = list_head(sensor_list); - reading != NULL; - reading = list_item_next(reading)) { - if(reading->publish) { - cc26xx_web_demo_config.sensors_bitmap |= (1 << reading->type); - } - } - - rv = ext_flash_write(NULL, CONFIG_FLASH_OFFSET, sizeof(cc26xx_web_demo_config_t), - (uint8_t *)&cc26xx_web_demo_config); - if(!rv) { - printf("Error saving config\n"); - } - } - - ext_flash_close(NULL); -#endif -} -/*---------------------------------------------------------------------------*/ -static void -load_config() -{ -#if BOARD_SENSORTAG || BOARD_LAUNCHPAD - /* Read from flash into a temp buffer */ - cc26xx_web_demo_config_t tmp_cfg; - cc26xx_web_demo_sensor_reading_t *reading = NULL; - - int rv = ext_flash_open(NULL); - - if(!rv) { - printf("Could not open flash to load config\n"); - ext_flash_close(NULL); - return; - } - - rv = ext_flash_read(NULL, CONFIG_FLASH_OFFSET, sizeof(tmp_cfg), - (uint8_t *)&tmp_cfg); - - ext_flash_close(NULL); - - if(!rv) { - printf("Error loading config\n"); - return; - } - - if(tmp_cfg.magic == CONFIG_MAGIC && tmp_cfg.len == sizeof(tmp_cfg)) { - memcpy(&cc26xx_web_demo_config, &tmp_cfg, sizeof(cc26xx_web_demo_config)); - } - - for(reading = list_head(sensor_list); - reading != NULL; - reading = list_item_next(reading)) { - if(cc26xx_web_demo_config.sensors_bitmap & (1 << reading->type)) { - reading->publish = 1; - } else { - reading->publish = 0; - snprintf(reading->converted, CC26XX_WEB_DEMO_CONVERTED_LEN, "\"N/A\""); - } - } -#endif -} -/*---------------------------------------------------------------------------*/ -/* Don't start everything here, we need to dictate order of initialisation */ -AUTOSTART_PROCESSES(&cc26xx_web_demo_process); -/*---------------------------------------------------------------------------*/ -int -cc26xx_web_demo_ipaddr_sprintf(char *buf, uint8_t buf_len, - const uip_ipaddr_t *addr) -{ - uint16_t a; - uint8_t len = 0; - int i, f; - for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) { - a = (addr->u8[i] << 8) + addr->u8[i + 1]; - if(a == 0 && f >= 0) { - if(f++ == 0) { - len += snprintf(&buf[len], buf_len - len, "::"); - } - } else { - if(f > 0) { - f = -1; - } else if(i > 0) { - len += snprintf(&buf[len], buf_len - len, ":"); - } - len += snprintf(&buf[len], buf_len - len, "%x", a); - } - } - - return len; -} -/*---------------------------------------------------------------------------*/ -const cc26xx_web_demo_sensor_reading_t * -cc26xx_web_demo_sensor_lookup(int sens_type) -{ - cc26xx_web_demo_sensor_reading_t *reading = NULL; - - for(reading = list_head(sensor_list); - reading != NULL; - reading = list_item_next(reading)) { - if(reading->type == sens_type) { - return reading; - } - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -const cc26xx_web_demo_sensor_reading_t * -cc26xx_web_demo_sensor_first() -{ - return list_head(sensor_list); -} -/*---------------------------------------------------------------------------*/ -void -cc26xx_web_demo_restore_defaults(void) -{ - cc26xx_web_demo_sensor_reading_t *reading = NULL; - - leds_on(LEDS_ALL); - - for(reading = list_head(sensor_list); - reading != NULL; - reading = list_item_next(reading)) { - reading->publish = 1; - } - -#if CC26XX_WEB_DEMO_MQTT_CLIENT - process_post_synch(&mqtt_client_process, - cc26xx_web_demo_load_config_defaults, NULL); -#endif - -#if CC26XX_WEB_DEMO_NET_UART - process_post_synch(&net_uart_process, cc26xx_web_demo_load_config_defaults, - NULL); -#endif - - save_config(); - - leds_off(LEDS_ALL); -} -/*---------------------------------------------------------------------------*/ -static int -defaults_post_handler(char *key, int key_len, char *val, int val_len) -{ - if(key_len != strlen("defaults") || - strncasecmp(key, "defaults", strlen("defaults")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - cc26xx_web_demo_restore_defaults(); - - return HTTPD_SIMPLE_POST_HANDLER_OK; -} -/*---------------------------------------------------------------------------*/ -static int -sensor_readings_handler(char *key, int key_len, char *val, int val_len) -{ - cc26xx_web_demo_sensor_reading_t *reading = NULL; - int rv; - - for(reading = list_head(sensor_list); - reading != NULL; - reading = list_item_next(reading)) { - if(key_len == strlen(reading->form_field) && - strncmp(reading->form_field, key, strlen(key)) == 0) { - - rv = atoi(val); - - /* Be pedantic: only accept 0 and 1, not just any non-zero value */ - if(rv == 0) { - reading->publish = 0; - snprintf(reading->converted, CC26XX_WEB_DEMO_CONVERTED_LEN, "\"N/A\""); - } else if(rv == 1) { - reading->publish = 1; - } else { - return HTTPD_SIMPLE_POST_HANDLER_ERROR; - } - - return HTTPD_SIMPLE_POST_HANDLER_OK; - } - } - - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; -} -/*---------------------------------------------------------------------------*/ -#if CC26XX_WEB_DEMO_READ_PARENT_RSSI -static int -ping_interval_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv = 0; - - if(key_len != strlen("ping_interval") || - strncasecmp(key, "ping_interval", strlen("ping_interval")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - rv = atoi(val); - - if(rv < CC26XX_WEB_DEMO_RSSI_MEASURE_INTERVAL_MIN || - rv > CC26XX_WEB_DEMO_RSSI_MEASURE_INTERVAL_MAX) { - return HTTPD_SIMPLE_POST_HANDLER_ERROR; - } - - cc26xx_web_demo_config.def_rt_ping_interval = rv * CLOCK_SECOND; - - return HTTPD_SIMPLE_POST_HANDLER_OK; -} -#endif -/*---------------------------------------------------------------------------*/ -HTTPD_SIMPLE_POST_HANDLER(sensor, sensor_readings_handler); -HTTPD_SIMPLE_POST_HANDLER(defaults, defaults_post_handler); - -#if CC26XX_WEB_DEMO_READ_PARENT_RSSI -HTTPD_SIMPLE_POST_HANDLER(ping_interval, ping_interval_post_handler); -/*---------------------------------------------------------------------------*/ -static void -echo_reply_handler(uip_ipaddr_t *source, uint8_t ttl, uint8_t *data, - uint16_t datalen) -{ - if(uip_ip6addr_cmp(source, uip_ds6_defrt_choose())) { - def_rt_rssi = sicslowpan_get_last_rssi(); - } -} -/*---------------------------------------------------------------------------*/ -static void -ping_parent(void) -{ - if(uip_ds6_get_global(ADDR_PREFERRED) == NULL) { - return; - } - - uip_icmp6_send(uip_ds6_defrt_choose(), ICMP6_ECHO_REQUEST, 0, - CC26XX_WEB_DEMO_ECHO_REQ_PAYLOAD_LEN); -} -#endif -/*---------------------------------------------------------------------------*/ -static void -get_batmon_reading(void *data) -{ - int value; - char *buf; - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - - if(batmon_temp_reading.publish) { - value = batmon_sensor.value(BATMON_SENSOR_TYPE_TEMP); - if(value != CC26XX_SENSOR_READING_ERROR) { - batmon_temp_reading.raw = value; - - buf = batmon_temp_reading.converted; - memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d", value); - } - } - - if(batmon_volt_reading.publish) { - value = batmon_sensor.value(BATMON_SENSOR_TYPE_VOLT); - if(value != CC26XX_SENSOR_READING_ERROR) { - batmon_volt_reading.raw = value; - - buf = batmon_volt_reading.converted; - memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d", (value * 125) >> 5); - } - } - - ctimer_set(&batmon_timer, next, get_batmon_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -#if CC26XX_WEB_DEMO_ADC_DEMO -static void -get_adc_reading(void *data) -{ - int value; - char *buf; - - if(adc_dio23_reading.publish) { - value = single_adc_sample; - buf = adc_dio23_reading.converted; - memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d", (value * 4300) >> 12); - } -} -#endif -/*---------------------------------------------------------------------------*/ -#if BOARD_SENSORTAG -/*---------------------------------------------------------------------------*/ -static void -compare_and_update(cc26xx_web_demo_sensor_reading_t *reading) -{ - if(reading->last == reading->raw) { - reading->changed = 0; - } else { - reading->last = reading->raw; - reading->changed = 1; - } -} -/*---------------------------------------------------------------------------*/ -static void -print_mpu_reading(int reading, char *buf) -{ - char *loc_buf = buf; - - if(reading < 0) { - sprintf(loc_buf, "-"); - reading = -reading; - loc_buf++; - } - - sprintf(loc_buf, "%d.%02d", reading / 100, reading % 100); -} -/*---------------------------------------------------------------------------*/ -static void -get_bmp_reading() -{ - int value; - char *buf; - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - - if(bmp_pres_reading.publish) { - value = bmp_280_sensor.value(BMP_280_SENSOR_TYPE_PRESS); - if(value != CC26XX_SENSOR_READING_ERROR) { - bmp_pres_reading.raw = value; - - compare_and_update(&bmp_pres_reading); - - buf = bmp_pres_reading.converted; - memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d.%02d", value / 100, - value % 100); - } - } - - if(bmp_temp_reading.publish) { - value = bmp_280_sensor.value(BMP_280_SENSOR_TYPE_TEMP); - if(value != CC26XX_SENSOR_READING_ERROR) { - bmp_temp_reading.raw = value; - - compare_and_update(&bmp_temp_reading); - - buf = bmp_temp_reading.converted; - memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d.%02d", value / 100, - value % 100); - } - } - - SENSORS_DEACTIVATE(bmp_280_sensor); - - ctimer_set(&bmp_timer, next, init_bmp_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -get_tmp_reading() -{ - int value; - char *buf; - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - - if(tmp_amb_reading.publish || tmp_obj_reading.publish) { - if(tmp_007_sensor.value(TMP_007_SENSOR_TYPE_ALL) == - CC26XX_SENSOR_READING_ERROR) { - - SENSORS_DEACTIVATE(tmp_007_sensor); - ctimer_set(&tmp_timer, next, init_tmp_reading, NULL); - } - } - - if(tmp_amb_reading.publish) { - value = tmp_007_sensor.value(TMP_007_SENSOR_TYPE_AMBIENT); - tmp_amb_reading.raw = value; - - compare_and_update(&tmp_amb_reading); - - buf = tmp_amb_reading.converted; - memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d.%03d", value / 1000, - value % 1000); - } - - if(tmp_obj_reading.publish) { - value = tmp_007_sensor.value(TMP_007_SENSOR_TYPE_OBJECT); - tmp_obj_reading.raw = value; - - compare_and_update(&tmp_obj_reading); - - buf = tmp_obj_reading.converted; - memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d.%03d", value / 1000, - value % 1000); - } - - SENSORS_DEACTIVATE(tmp_007_sensor); - - ctimer_set(&tmp_timer, next, init_tmp_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -get_hdc_reading() -{ - int value; - char *buf; - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - - if(hdc_temp_reading.publish) { - value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_TEMP); - if(value != CC26XX_SENSOR_READING_ERROR) { - hdc_temp_reading.raw = value; - - compare_and_update(&hdc_temp_reading); - - buf = hdc_temp_reading.converted; - memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d.%02d", value / 100, - value % 100); - } - } - - if(hdc_hum_reading.publish) { - value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMID); - if(value != CC26XX_SENSOR_READING_ERROR) { - hdc_hum_reading.raw = value; - - compare_and_update(&hdc_hum_reading); - - buf = hdc_hum_reading.converted; - memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d.%02d", value / 100, - value % 100); - } - } - - ctimer_set(&hdc_timer, next, init_hdc_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -get_light_reading() -{ - int value; - char *buf; - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - - value = opt_3001_sensor.value(0); - - if(value != CC26XX_SENSOR_READING_ERROR) { - opt_reading.raw = value; - - compare_and_update(&opt_reading); - - buf = opt_reading.converted; - memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d.%02d", value / 100, - value % 100); - } - - /* The OPT will turn itself off, so we don't need to call its DEACTIVATE */ - ctimer_set(&opt_timer, next, init_light_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -get_mpu_reading() -{ - clock_time_t next = SENSOR_READING_PERIOD + - (random_rand() % SENSOR_READING_RANDOM); - int raw; - - if(mpu_gyro_x_reading.publish) { - raw = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_GYRO_X); - if(raw != CC26XX_SENSOR_READING_ERROR) { - mpu_gyro_x_reading.raw = raw; - } - } - - if(mpu_gyro_y_reading.publish) { - raw = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_GYRO_Y); - if(raw != CC26XX_SENSOR_READING_ERROR) { - mpu_gyro_y_reading.raw = raw; - } - } - - if(mpu_gyro_z_reading.publish) { - raw = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_GYRO_Z); - if(raw != CC26XX_SENSOR_READING_ERROR) { - mpu_gyro_z_reading.raw = raw; - } - } - - if(mpu_acc_x_reading.publish) { - raw = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_ACC_X); - if(raw != CC26XX_SENSOR_READING_ERROR) { - mpu_acc_x_reading.raw = raw; - } - } - - if(mpu_acc_y_reading.publish) { - raw = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_ACC_Y); - if(raw != CC26XX_SENSOR_READING_ERROR) { - mpu_acc_y_reading.raw = raw; - } - } - - if(mpu_acc_z_reading.publish) { - raw = mpu_9250_sensor.value(MPU_9250_SENSOR_TYPE_ACC_Z); - if(raw != CC26XX_SENSOR_READING_ERROR) { - mpu_acc_z_reading.raw = raw; - } - } - - SENSORS_DEACTIVATE(mpu_9250_sensor); - - if(mpu_gyro_x_reading.publish) { - compare_and_update(&mpu_gyro_x_reading); - memset(mpu_gyro_x_reading.converted, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - print_mpu_reading(mpu_gyro_x_reading.raw, mpu_gyro_x_reading.converted); - } - - if(mpu_gyro_y_reading.publish) { - compare_and_update(&mpu_gyro_y_reading); - memset(mpu_gyro_y_reading.converted, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - print_mpu_reading(mpu_gyro_y_reading.raw, mpu_gyro_y_reading.converted); - } - - if(mpu_gyro_z_reading.publish) { - compare_and_update(&mpu_gyro_z_reading); - memset(mpu_gyro_z_reading.converted, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - print_mpu_reading(mpu_gyro_z_reading.raw, mpu_gyro_z_reading.converted); - } - - if(mpu_acc_x_reading.publish) { - compare_and_update(&mpu_acc_x_reading); - memset(mpu_acc_x_reading.converted, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - print_mpu_reading(mpu_acc_x_reading.raw, mpu_acc_x_reading.converted); - } - - if(mpu_acc_y_reading.publish) { - compare_and_update(&mpu_acc_y_reading); - memset(mpu_acc_y_reading.converted, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - print_mpu_reading(mpu_acc_y_reading.raw, mpu_acc_y_reading.converted); - } - - if(mpu_acc_z_reading.publish) { - compare_and_update(&mpu_acc_z_reading); - memset(mpu_acc_z_reading.converted, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - print_mpu_reading(mpu_acc_z_reading.raw, mpu_acc_z_reading.converted); - } - - /* We only use the single timer */ - ctimer_set(&mpu_timer, next, init_mpu_reading, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -init_tmp_reading(void *data) -{ - if(tmp_amb_reading.publish || tmp_obj_reading.publish) { - SENSORS_ACTIVATE(tmp_007_sensor); - } else { - ctimer_set(&tmp_timer, CLOCK_SECOND, init_tmp_reading, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -init_bmp_reading(void *data) -{ - if(bmp_pres_reading.publish || bmp_temp_reading.publish) { - SENSORS_ACTIVATE(bmp_280_sensor); - } else { - ctimer_set(&bmp_timer, CLOCK_SECOND, init_bmp_reading, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -init_hdc_reading(void *data) -{ - if(hdc_hum_reading.publish || hdc_temp_reading.publish) { - SENSORS_ACTIVATE(hdc_1000_sensor); - } else { - ctimer_set(&hdc_timer, CLOCK_SECOND, init_hdc_reading, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -init_light_reading(void *data) -{ - if(opt_reading.publish) { - SENSORS_ACTIVATE(opt_3001_sensor); - } else { - ctimer_set(&opt_timer, CLOCK_SECOND, init_light_reading, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -init_mpu_reading(void *data) -{ - int readings_bitmap = 0; - - if(mpu_acc_x_reading.publish || mpu_acc_y_reading.publish || - mpu_acc_z_reading.publish) { - readings_bitmap |= MPU_9250_SENSOR_TYPE_ACC; - } - - if(mpu_gyro_x_reading.publish || mpu_gyro_y_reading.publish || - mpu_gyro_z_reading.publish) { - readings_bitmap |= MPU_9250_SENSOR_TYPE_GYRO; - } - - if(readings_bitmap) { - mpu_9250_sensor.configure(SENSORS_ACTIVE, readings_bitmap); - } else { - ctimer_set(&mpu_timer, CLOCK_SECOND, init_mpu_reading, NULL); - } -} -#endif -/*---------------------------------------------------------------------------*/ -static void -init_sensor_readings(void) -{ - /* - * Make a first pass and get all initial sensor readings. This will also - * trigger periodic value updates - */ - get_batmon_reading(NULL); - -#if BOARD_SENSORTAG - init_bmp_reading(NULL); - init_light_reading(NULL); - init_hdc_reading(NULL); - init_tmp_reading(NULL); - init_mpu_reading(NULL); -#endif /* BOARD_SENSORTAG */ - - return; -} -/*---------------------------------------------------------------------------*/ -static void -init_sensors(void) -{ - - list_add(sensor_list, &batmon_temp_reading); - list_add(sensor_list, &batmon_volt_reading); - -#if CC26XX_WEB_DEMO_ADC_DEMO - list_add(sensor_list, &adc_dio23_reading); -#endif - - SENSORS_ACTIVATE(batmon_sensor); - -#if BOARD_SENSORTAG - list_add(sensor_list, &bmp_pres_reading); - list_add(sensor_list, &bmp_temp_reading); - - list_add(sensor_list, &tmp_obj_reading); - list_add(sensor_list, &tmp_amb_reading); - - list_add(sensor_list, &opt_reading); - - list_add(sensor_list, &hdc_hum_reading); - list_add(sensor_list, &hdc_temp_reading); - - list_add(sensor_list, &mpu_acc_x_reading); - list_add(sensor_list, &mpu_acc_y_reading); - list_add(sensor_list, &mpu_acc_z_reading); - list_add(sensor_list, &mpu_gyro_x_reading); - list_add(sensor_list, &mpu_gyro_y_reading); - list_add(sensor_list, &mpu_gyro_z_reading); -#endif -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cc26xx_web_demo_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("CC26XX Web Demo Process\n"); - - init_sensors(); - - cc26xx_web_demo_publish_event = process_alloc_event(); - cc26xx_web_demo_config_loaded_event = process_alloc_event(); - cc26xx_web_demo_load_config_defaults = process_alloc_event(); - - /* Start all other (enabled) processes first */ - process_start(&httpd_simple_process, NULL); - -#if CC26XX_WEB_DEMO_COAP_SERVER - process_start(&coap_server_process, NULL); -#endif - -#if CC26XX_WEB_DEMO_6LBR_CLIENT - process_start(&cetic_6lbr_client_process, NULL); -#endif - -#if CC26XX_WEB_DEMO_MQTT_CLIENT - process_start(&mqtt_client_process, NULL); -#endif - -#if CC26XX_WEB_DEMO_NET_UART - process_start(&net_uart_process, NULL); -#endif - -#if CC26XX_WEB_DEMO_ADC_DEMO - process_start(&adc_process, NULL); -#endif - - /* - * Now that processes have set their own config default values, set our - * own defaults and restore saved config from flash... - */ - cc26xx_web_demo_config.sensors_bitmap = 0xFFFFFFFF; /* all on by default */ - cc26xx_web_demo_config.def_rt_ping_interval = - CC26XX_WEB_DEMO_DEFAULT_RSSI_MEAS_INTERVAL; - load_config(); - - /* - * Notify all other processes (basically the ones in this demo) that the - * configuration has been loaded from flash, in case they care - */ - process_post(PROCESS_BROADCAST, cc26xx_web_demo_config_loaded_event, NULL); - - init_sensor_readings(); - - httpd_simple_register_post_handler(&sensor_handler); - httpd_simple_register_post_handler(&defaults_handler); - -#if CC26XX_WEB_DEMO_READ_PARENT_RSSI - httpd_simple_register_post_handler(&ping_interval_handler); - - def_rt_rssi = 0x8000000; - uip_icmp6_echo_reply_callback_add(&echo_reply_notification, - echo_reply_handler); - etimer_set(&echo_request_timer, CC26XX_WEB_DEMO_NET_CONNECT_PERIODIC); -#endif - - etimer_set(&et, CC26XX_WEB_DEMO_NET_CONNECT_PERIODIC); - - /* - * Update all sensor readings on a configurable sensors_event - * (e.g a button press / or reed trigger) - */ - while(1) { - if(ev == PROCESS_EVENT_TIMER && etimer_expired(&et)) { - if(uip_ds6_get_global(ADDR_PREFERRED) == NULL) { - leds_on(CC26XX_WEB_DEMO_STATUS_LED); - ctimer_set(&ct, NO_NET_LED_DURATION, publish_led_off, NULL); - etimer_set(&et, CC26XX_WEB_DEMO_NET_CONNECT_PERIODIC); - } - } - -#if CC26XX_WEB_DEMO_READ_PARENT_RSSI - if(ev == PROCESS_EVENT_TIMER && etimer_expired(&echo_request_timer)) { - if(uip_ds6_get_global(ADDR_PREFERRED) == NULL) { - etimer_set(&echo_request_timer, CC26XX_WEB_DEMO_NET_CONNECT_PERIODIC); - } else { - ping_parent(); - etimer_set(&echo_request_timer, cc26xx_web_demo_config.def_rt_ping_interval); - } - } -#endif - - if(ev == button_hal_release_event && - ((button_hal_button_t *)data)->unique_id == - CC26XX_WEB_DEMO_SENSOR_READING_TRIGGER) { - init_sensor_readings(); - process_post(PROCESS_BROADCAST, cc26xx_web_demo_publish_event, NULL); - } else if(ev == button_hal_periodic_event && - ((button_hal_button_t *)data)->unique_id == - CC26XX_WEB_DEMO_SENSOR_READING_TRIGGER) { - printf("Restoring defaults!\n"); - cc26xx_web_demo_restore_defaults(); - } else if(ev == httpd_simple_event_new_config) { - save_config(); -#if BOARD_SENSORTAG - } else if(ev == sensors_event && data == &bmp_280_sensor) { - get_bmp_reading(); - } else if(ev == sensors_event && data == &opt_3001_sensor) { - get_light_reading(); - } else if(ev == sensors_event && data == &hdc_1000_sensor) { - get_hdc_reading(); - } else if(ev == sensors_event && data == &tmp_007_sensor) { - get_tmp_reading(); - } else if(ev == sensors_event && data == &mpu_9250_sensor) { - get_mpu_reading(); -#endif - } - - PROCESS_YIELD(); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -#if CC26XX_WEB_DEMO_ADC_DEMO -PROCESS_THREAD(adc_process, ev, data) -{ - PROCESS_BEGIN(); - - etimer_set(&et_adc, CLOCK_SECOND * 5); - - while(1) { - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et_adc)); - - /* intialisation of ADC */ - ti_lib_aon_wuc_aux_wakeup_event(AONWUC_AUX_WAKEUP); - while(!(ti_lib_aon_wuc_power_status_get() & AONWUC_AUX_POWER_ON)); - - /* - * Enable clock for ADC digital and analog interface (not currently enabled - * in driver) - */ - ti_lib_aux_wuc_clock_enable(AUX_WUC_ADI_CLOCK | AUX_WUC_ANAIF_CLOCK | - AUX_WUC_SMPH_CLOCK); - while(ti_lib_aux_wuc_clock_status(AUX_WUC_ADI_CLOCK | AUX_WUC_ANAIF_CLOCK | - AUX_WUC_SMPH_CLOCK) - != AUX_WUC_CLOCK_READY); - - /* Connect AUX IO7 (DIO23, but also DP2 on XDS110) as analog input. */ - ti_lib_aux_adc_select_input(ADC_COMPB_IN_AUXIO7); - - /* Set up ADC range, AUXADC_REF_FIXED = nominally 4.3 V */ - ti_lib_aux_adc_enable_sync(AUXADC_REF_FIXED, AUXADC_SAMPLE_TIME_2P7_US, - AUXADC_TRIGGER_MANUAL); - - /* Trigger ADC converting */ - ti_lib_aux_adc_gen_manual_trigger(); - - /* Read value */ - single_adc_sample = ti_lib_aux_adc_read_fifo(); - - /* Shut the adc down */ - ti_lib_aux_adc_disable(); - - get_adc_reading(NULL); - - etimer_reset(&et_adc); - } - - PROCESS_END(); -} -#endif -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-web-demo.h b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-web-demo.h deleted file mode 100644 index e7252496c..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-web-demo.h +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26xx-examples - * @{ - * - * \defgroup cc26x0-web-demo CC26xx Web Demo - * @{ - * - * An example demonstrating: - * * how to use a CC26XX-powered node in a deployment driven by a 6LBR - * * how to expose on-device sensors as CoAP resources - * * how to build a small web page which reports networking and sensory data - * * how to configure functionality through the aforementioned web page using - * HTTP POST requests - * * a network-based UART - * - * \file - * Main header file for the CC26XX web demo. - */ -/*---------------------------------------------------------------------------*/ -#ifndef CC26XX_WEB_DEMO_H_ -#define CC26XX_WEB_DEMO_H_ -/*---------------------------------------------------------------------------*/ -#include "dev/leds.h" -#include "sys/process.h" -#include "mqtt-client.h" -#include "net-uart.h" - -#include -/*---------------------------------------------------------------------------*/ -#ifdef CC26XX_WEB_DEMO_CONF_MQTT_CLIENT -#define CC26XX_WEB_DEMO_MQTT_CLIENT CC26XX_WEB_DEMO_CONF_MQTT_CLIENT -#else -#define CC26XX_WEB_DEMO_MQTT_CLIENT 1 -#endif - -#ifdef CC26XX_WEB_DEMO_CONF_6LBR_CLIENT -#define CC26XX_WEB_DEMO_6LBR_CLIENT CC26XX_WEB_DEMO_CONF_6LBR_CLIENT -#else -#define CC26XX_WEB_DEMO_6LBR_CLIENT 1 -#endif - -#ifdef CC26XX_WEB_DEMO_CONF_COAP_SERVER -#define CC26XX_WEB_DEMO_COAP_SERVER CC26XX_WEB_DEMO_CONF_COAP_SERVER -#else -#define CC26XX_WEB_DEMO_COAP_SERVER 1 -#endif - -#ifdef CC26XX_WEB_DEMO_CONF_NET_UART -#define CC26XX_WEB_DEMO_NET_UART CC26XX_WEB_DEMO_CONF_NET_UART -#else -#define CC26XX_WEB_DEMO_NET_UART 1 -#endif - -#ifdef CC26XX_WEB_DEMO_CONF_ADC_DEMO -#define CC26XX_WEB_DEMO_ADC_DEMO CC26XX_WEB_DEMO_CONF_ADC_DEMO -#else -#define CC26XX_WEB_DEMO_ADC_DEMO 0 -#endif -/*---------------------------------------------------------------------------*/ -/* Active probing of RSSI from our preferred parent */ -#if (CC26XX_WEB_DEMO_COAP_SERVER || CC26XX_WEB_DEMO_MQTT_CLIENT) -#define CC26XX_WEB_DEMO_READ_PARENT_RSSI 1 -#else -#define CC26XX_WEB_DEMO_READ_PARENT_RSSI 0 -#endif - -#define CC26XX_WEB_DEMO_RSSI_MEASURE_INTERVAL_MAX 86400 /* secs: 1 day */ -#define CC26XX_WEB_DEMO_RSSI_MEASURE_INTERVAL_MIN 5 /* secs */ -/*---------------------------------------------------------------------------*/ -/* User configuration */ -/* Take a sensor reading on button press */ -#define CC26XX_WEB_DEMO_SENSOR_READING_TRIGGER BOARD_BUTTON_HAL_INDEX_KEY_LEFT - -/* Payload length of ICMPv6 echo requests used to measure RSSI with def rt */ -#define CC26XX_WEB_DEMO_ECHO_REQ_PAYLOAD_LEN 20 - -#if BOARD_SENSORTAG -/* Force an MQTT publish on sensor event */ -#define CC26XX_WEB_DEMO_MQTT_PUBLISH_TRIGGER BOARD_BUTTON_HAL_INDEX_REED_RELAY -#elif BOARD_LAUNCHPAD -#define CC26XX_WEB_DEMO_MQTT_PUBLISH_TRIGGER BOARD_BUTTON_HAL_INDEX_KEY_LEFT -#else -#define CC26XX_WEB_DEMO_MQTT_PUBLISH_TRIGGER BOARD_BUTTON_HAL_INDEX_KEY_DOWN -#endif - -#define CC26XX_WEB_DEMO_STATUS_LED LEDS_GREEN -/*---------------------------------------------------------------------------*/ -/* A timeout used when waiting to connect to a network */ -#define CC26XX_WEB_DEMO_NET_CONNECT_PERIODIC (CLOCK_SECOND >> 3) -/*---------------------------------------------------------------------------*/ -/* Default configuration values */ -#define CC26XX_WEB_DEMO_DEFAULT_ORG_ID "quickstart" -#if CPU_FAMILY_CC13X0 -#define CC26XX_WEB_DEMO_DEFAULT_TYPE_ID "cc13xx" -#else -#define CC26XX_WEB_DEMO_DEFAULT_TYPE_ID "cc26xx" -#endif -#define CC26XX_WEB_DEMO_DEFAULT_EVENT_TYPE_ID "status" -#define CC26XX_WEB_DEMO_DEFAULT_SUBSCRIBE_CMD_TYPE "+" -#define CC26XX_WEB_DEMO_DEFAULT_BROKER_PORT 1883 -#define CC26XX_WEB_DEMO_DEFAULT_PUBLISH_INTERVAL (30 * CLOCK_SECOND) -#define CC26XX_WEB_DEMO_DEFAULT_KEEP_ALIVE_TIMER 60 -#define CC26XX_WEB_DEMO_DEFAULT_RSSI_MEAS_INTERVAL (CLOCK_SECOND * 30) -/*---------------------------------------------------------------------------*/ -/* - * You normally won't have to change anything from here onwards unless you are - * extending the example - */ -/*---------------------------------------------------------------------------*/ -/* Sensor types */ -#define CC26XX_WEB_DEMO_SENSOR_BATMON_TEMP 0 -#define CC26XX_WEB_DEMO_SENSOR_BATMON_VOLT 1 -#define CC26XX_WEB_DEMO_SENSOR_BMP_PRES 2 -#define CC26XX_WEB_DEMO_SENSOR_BMP_TEMP 3 -#define CC26XX_WEB_DEMO_SENSOR_TMP_AMBIENT 4 -#define CC26XX_WEB_DEMO_SENSOR_TMP_OBJECT 5 -#define CC26XX_WEB_DEMO_SENSOR_HDC_TEMP 6 -#define CC26XX_WEB_DEMO_SENSOR_HDC_HUMIDITY 7 -#define CC26XX_WEB_DEMO_SENSOR_OPT_LIGHT 8 -#define CC26XX_WEB_DEMO_SENSOR_MPU_ACC_X 9 -#define CC26XX_WEB_DEMO_SENSOR_MPU_ACC_Y 10 -#define CC26XX_WEB_DEMO_SENSOR_MPU_ACC_Z 11 -#define CC26XX_WEB_DEMO_SENSOR_MPU_GYRO_X 12 -#define CC26XX_WEB_DEMO_SENSOR_MPU_GYRO_Y 13 -#define CC26XX_WEB_DEMO_SENSOR_MPU_GYRO_Z 14 -#define CC26XX_WEB_DEMO_SENSOR_ADC_DIO23 15 -/*---------------------------------------------------------------------------*/ -extern process_event_t cc26xx_web_demo_publish_event; -extern process_event_t cc26xx_web_demo_config_loaded_event; -extern process_event_t cc26xx_web_demo_load_config_defaults; -/*---------------------------------------------------------------------------*/ -#define CC26XX_WEB_DEMO_UNIT_TEMP "C" -#define CC26XX_WEB_DEMO_UNIT_VOLT "mV" -#define CC26XX_WEB_DEMO_UNIT_PRES "hPa" -#define CC26XX_WEB_DEMO_UNIT_HUMIDITY "%RH" -#define CC26XX_WEB_DEMO_UNIT_LIGHT "lux" -#define CC26XX_WEB_DEMO_UNIT_ACC "G" -#define CC26XX_WEB_DEMO_UNIT_GYRO "deg per sec" -/*---------------------------------------------------------------------------*/ -/* A data type for sensor readings, internally stored in a linked list */ -#define CC26XX_WEB_DEMO_CONVERTED_LEN 12 - -typedef struct cc26xx_web_demo_sensor_reading { - struct cc26xx_web_demo_sensor_reading *next; - int raw; - int last; - const char *descr; - const char *xml_element; - const char *form_field; - char *units; - uint8_t type; - uint8_t publish; - uint8_t changed; - char converted[CC26XX_WEB_DEMO_CONVERTED_LEN]; -} cc26xx_web_demo_sensor_reading_t; -/*---------------------------------------------------------------------------*/ -/* Global configuration */ -typedef struct cc26xx_web_demo_config_s { - uint32_t magic; - int len; - uint32_t sensors_bitmap; - int def_rt_ping_interval; - mqtt_client_config_t mqtt_config; - net_uart_config_t net_uart; -} cc26xx_web_demo_config_t; - -extern cc26xx_web_demo_config_t cc26xx_web_demo_config; -/*---------------------------------------------------------------------------*/ -/** - * \brief Performs a lookup for a reading of a specific type of sensor - * \param sens_type CC26XX_WEB_DEMO_SENSOR_BATMON_TEMP... - * \return A pointer to the reading data structure or NULL - */ -const cc26xx_web_demo_sensor_reading_t *cc26xx_web_demo_sensor_lookup(int sens_type); - -/** - * \brief Returns the first available sensor reading - * \return A pointer to the reading data structure or NULL - */ -const cc26xx_web_demo_sensor_reading_t *cc26xx_web_demo_sensor_first(void); - -/** - * \brief Print an IPv6 address into a buffer - * \param buf A pointer to the buffer where this function will print the IPv6 - * address - * \param buf_len the length of the buffer - * \param addr A pointer to the IPv6 address - * \return The number of bytes written to the buffer - * - * It is the caller's responsibility to allocate enough space for buf - */ -int cc26xx_web_demo_ipaddr_sprintf(char *buf, uint8_t buf_len, - const uip_ipaddr_t *addr); - -/** - * \brief Resets the example to a default configuration - */ -void cc26xx_web_demo_restore_defaults(void); -/*---------------------------------------------------------------------------*/ -#endif /* CC26XX_WEB_DEMO_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cetic-6lbr-client.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cetic-6lbr-client.c deleted file mode 100644 index fc8044380..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cetic-6lbr-client.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * An implementation of a 6LBR UDP client. Is used to populate the 6LBR - * web server's 'sensors' tab - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" -#include "net/routing/routing.h" -#include "net/ipv6/uip.h" -#if ROUTING_CONF_RPL_CLASSIC -#include "net/routing/rpl-classic/rpl.h" -#include "net/routing/rpl-classic/rpl-private.h" -#else -#error The 6LBR client is only meant for RPL Classic. Set MAKE_ROUTING accordingly. -#endif - -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#include "net/ipv6/uip-debug.h" -/*---------------------------------------------------------------------------*/ -#ifndef CETIC_6LBR_NODE_INFO_PORT -#define CETIC_6LBR_NODE_INFO_PORT 3000 -#endif - -#define MAX_PAYLOAD_LEN 40 -#define MSG_INTERVAL (60 * CLOCK_SECOND) -/*---------------------------------------------------------------------------*/ -static struct uip_udp_conn *client_conn = NULL; -static struct etimer et; -static uip_ip6addr_t dest_addr; -/*---------------------------------------------------------------------------*/ -PROCESS(cetic_6lbr_client_process, "6LBR Client Process"); -/*---------------------------------------------------------------------------*/ -static void -tcpip_handler(void) -{ - char *str; - - if(uip_newdata()) { - str = uip_appdata; - str[uip_datalen()] = '\0'; - PRINTF("Response from the server: '%s'\n", str); - } -} -/*---------------------------------------------------------------------------*/ -static char * -add_ipaddr(char *buf, const uip_ipaddr_t *addr) -{ - uint16_t a; - unsigned int i; - int f; - char *p = buf; - - for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) { - a = (addr->u8[i] << 8) + addr->u8[i + 1]; - if(a == 0 && f >= 0) { - if(f++ == 0) { - p += sprintf(p, "::"); - } - } else { - if(f > 0) { - f = -1; - } else if(i > 0) { - p += sprintf(p, ":"); - } - p += sprintf(p, "%04x", a); - } - } - return p; -} -/*---------------------------------------------------------------------------*/ -static void -timeout_handler(void) -{ - static int seq_id; - char buf[MAX_PAYLOAD_LEN]; - int i; - uip_ip6addr_t *globaladdr = NULL; - uint16_t dest_port = CETIC_6LBR_NODE_INFO_PORT; - int has_dest = 0; - rpl_instance_t *instance; - rpl_dag_t *dag; - - uip_ds6_addr_t *addr_desc = uip_ds6_get_global(ADDR_PREFERRED); - if(addr_desc != NULL) { - globaladdr = &addr_desc->ipaddr; - dag = rpl_get_any_dag(); - if(dag) { - uip_ipaddr_copy(&dest_addr, globaladdr); - memcpy(&dest_addr.u8[8], &dag->dag_id.u8[8], sizeof(uip_ipaddr_t) / 2); - has_dest = 1; - } - } - - if(has_dest) { - if(client_conn == NULL) { - PRINTF("UDP-CLIENT: address destination: "); - PRINT6ADDR(&dest_addr); - PRINTF("\n"); - client_conn = udp_new(&dest_addr, UIP_HTONS(dest_port), NULL); - - if(client_conn != NULL) { - PRINTF("Created a connection with the server "); - PRINT6ADDR(&client_conn->ripaddr); - PRINTF(" local/remote port %u/%u\n", - UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport)); - } else { - PRINTF("Could not open connection\n"); - } - } else { - if(memcmp(&client_conn->ripaddr, &dest_addr, sizeof(uip_ipaddr_t)) != 0) { - PRINTF("UDP-CLIENT: new address destination: "); - PRINT6ADDR(&dest_addr); - PRINTF("\n"); - uip_udp_remove(client_conn); - client_conn = udp_new(&dest_addr, UIP_HTONS(dest_port), NULL); - if(client_conn != NULL) { - PRINTF("Created a connection with the server "); - PRINT6ADDR(&client_conn->ripaddr); - PRINTF(" local/remote port %u/%u\n", - UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport)); - } else { - PRINTF("Could not open connection\n"); - } - } - } - if(client_conn != NULL) { - PRINTF("Client sending to: "); - PRINT6ADDR(&client_conn->ripaddr); - i = sprintf(buf, "%d | ", ++seq_id); - instance = rpl_get_default_instance(); - if(instance && instance->current_dag->preferred_parent) { - add_ipaddr(buf + i, rpl_parent_get_ipaddr(instance->current_dag->preferred_parent)); - } else { - sprintf(buf + i, "(null)"); - } - PRINTF(" (msg: %s)\n", buf); - uip_udp_packet_send(client_conn, buf, strlen(buf)); - } else { - PRINTF("No connection created\n"); - } - } else { - PRINTF("No address configured\n"); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cetic_6lbr_client_process, ev, data) -{ - - PROCESS_BEGIN(); - - printf("6LBR Client Process\n"); - - memset(&dest_addr, 0, sizeof(uip_ipaddr_t)); - - etimer_set(&et, MSG_INTERVAL); - while(1) { - PROCESS_YIELD(); - if(etimer_expired(&et)) { - timeout_handler(); - etimer_set(&et, MSG_INTERVAL); - } else if(ev == tcpip_event) { - tcpip_handler(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/coap-server.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/coap-server.c deleted file mode 100644 index bda7eb8ff..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/coap-server.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * A CC26XX-specific CoAP server - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "contiki-net.h" -#include "coap-engine.h" -#include "board-peripherals.h" -#include "rf-core/rf-ble.h" -#include "cc26x0-web-demo.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Common resources */ -extern coap_resource_t res_leds; - -extern coap_resource_t res_batmon_temp; -extern coap_resource_t res_batmon_volt; - -extern coap_resource_t res_device_sw; -extern coap_resource_t res_device_hw; -extern coap_resource_t res_device_uptime; -extern coap_resource_t res_device_cfg_reset; - -extern coap_resource_t res_parent_rssi; -extern coap_resource_t res_parent_ip; - -#if RF_BLE_ENABLED -extern coap_resource_t res_ble_advd; -#endif - -extern coap_resource_t res_toggle_red; -extern coap_resource_t res_toggle_green; - -/* Board-specific resources */ -#if BOARD_SENSORTAG -extern coap_resource_t res_bmp280_temp; -extern coap_resource_t res_bmp280_press; -extern coap_resource_t res_tmp007_amb; -extern coap_resource_t res_tmp007_obj; -extern coap_resource_t res_hdc1000_temp; -extern coap_resource_t res_hdc1000_hum; -extern coap_resource_t res_opt3001_light; -extern coap_resource_t res_mpu_acc_x; -extern coap_resource_t res_mpu_acc_y; -extern coap_resource_t res_mpu_acc_z; -extern coap_resource_t res_mpu_gyro_x; -extern coap_resource_t res_mpu_gyro_y; -extern coap_resource_t res_mpu_gyro_z; -#else -extern coap_resource_t res_toggle_orange; -extern coap_resource_t res_toggle_yellow; -#endif - -#if CC26XX_WEB_DEMO_ADC_DEMO -extern coap_resource_t res_adc_dio23; -#endif -/*---------------------------------------------------------------------------*/ -const char *coap_server_not_found_msg = "Resource not found"; -const char *coap_server_supported_msg = "Supported:" - "text/plain," - "application/json," - "application/xml"; -/*---------------------------------------------------------------------------*/ -static void -start_board_resources(void) -{ - - coap_activate_resource(&res_toggle_green, "lt/g"); - coap_activate_resource(&res_toggle_red, "lt/r"); - coap_activate_resource(&res_leds, "lt"); - -#if BOARD_SENSORTAG - coap_activate_resource(&res_bmp280_temp, "sen/bar/temp"); - coap_activate_resource(&res_bmp280_press, "sen/bar/pres"); - coap_activate_resource(&res_tmp007_amb, "sen/tmp/amb"); - coap_activate_resource(&res_tmp007_obj, "sen/tmp/obj"); - coap_activate_resource(&res_hdc1000_temp, "sen/hdc/t"); - coap_activate_resource(&res_hdc1000_hum, "sen/hdc/h"); - coap_activate_resource(&res_opt3001_light, "sen/opt/light"); - coap_activate_resource(&res_mpu_acc_x, "sen/mpu/acc/x"); - coap_activate_resource(&res_mpu_acc_y, "sen/mpu/acc/y"); - coap_activate_resource(&res_mpu_acc_z, "sen/mpu/acc/z"); - coap_activate_resource(&res_mpu_gyro_x, "sen/mpu/gyro/x"); - coap_activate_resource(&res_mpu_gyro_y, "sen/mpu/gyro/y"); - coap_activate_resource(&res_mpu_gyro_z, "sen/mpu/gyro/z"); -#elif BOARD_SMARTRF06EB - coap_activate_resource(&res_toggle_yellow, "lt/y"); - coap_activate_resource(&res_toggle_orange, "lt/o"); -#endif -} -/*---------------------------------------------------------------------------*/ -PROCESS(coap_server_process, "CC26XX CoAP Server"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(coap_server_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("CC26XX CoAP Server\n"); - - coap_activate_resource(&res_batmon_temp, "sen/batmon/temp"); - coap_activate_resource(&res_batmon_volt, "sen/batmon/voltage"); - -#if CC26XX_WEB_DEMO_ADC_DEMO - coap_activate_resource(&res_adc_dio23, "sen/adc/dio23"); -#endif - - coap_activate_resource(&res_device_hw, "dev/mdl/hw"); - coap_activate_resource(&res_device_sw, "dev/mdl/sw"); - coap_activate_resource(&res_device_uptime, "dev/uptime"); - coap_activate_resource(&res_device_cfg_reset, "dev/cfg_reset"); - - coap_activate_resource(&res_parent_rssi, "net/parent/RSSI"); - coap_activate_resource(&res_parent_ip, "net/parent/IPv6"); - -#if RF_BLE_ENABLED - coap_activate_resource(&res_ble_advd, "dev/ble_advd"); -#endif - - start_board_resources(); - - /* Define application-specific events here. */ - while(1) { - PROCESS_WAIT_EVENT(); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/coap-server.h b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/coap-server.h deleted file mode 100644 index 0d8c1d40b..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/coap-server.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * Header file for the CC26xx web demo CoAP functionality - */ -/*---------------------------------------------------------------------------*/ -#include "sys/process.h" -/*---------------------------------------------------------------------------*/ -#ifndef COAP_SERVER_H_ -#define COAP_SERVER_H_ -/*---------------------------------------------------------------------------*/ -extern const char *coap_server_not_found_msg; -extern const char *coap_server_supported_msg; -/*---------------------------------------------------------------------------*/ -PROCESS_NAME(coap_server_process); -/*---------------------------------------------------------------------------*/ -#endif /* COAP_SERVER_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/httpd-simple.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/httpd-simple.c deleted file mode 100644 index 101b6441b..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/httpd-simple.c +++ /dev/null @@ -1,1350 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * A simple web server which displays network and sensor information - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "httpd-simple.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/ipv6/uip-ds6-route.h" -#include "batmon-sensor.h" -#include "lib/sensors.h" -#include "lib/list.h" -#include "cc26x0-web-demo.h" -#include "mqtt-client.h" -#include "net-uart.h" - -#include -#include -#include -#include -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define SEND_STRING(s, str) PSOCK_SEND(s, (uint8_t *)str, strlen(str)) -/*---------------------------------------------------------------------------*/ -#define CONNS 2 -#define CONTENT_LENGTH_MAX 256 -#define STATE_WAITING 0 -#define STATE_OUTPUT 1 -#define IPADDR_BUF_LEN 64 -/*---------------------------------------------------------------------------*/ -#define RETURN_CODE_OK 0 -#define RETURN_CODE_NF 1 /* Not Found */ -#define RETURN_CODE_SU 2 /* Service Unavailable */ -#define RETURN_CODE_BR 3 /* Bad Request */ -#define RETURN_CODE_LR 4 /* Length Required */ -#define RETURN_CODE_TL 5 /* Content Length too Large */ -/*---------------------------------------------------------------------------*/ -/* POST request machine states */ -#define PARSE_POST_STATE_INIT 0 -#define PARSE_POST_STATE_MORE 1 -#define PARSE_POST_STATE_READING_KEY 2 -#define PARSE_POST_STATE_READING_VAL 3 -#define PARSE_POST_STATE_ERROR 0xFFFFFFFF -/*---------------------------------------------------------------------------*/ -#define PARSE_POST_BUF_SIZES 64 - -/* Last byte always used to null terminate */ -#define PARSE_POST_MAX_POS (PARSE_POST_BUF_SIZES - 2) - -static char key[PARSE_POST_BUF_SIZES]; -static char val_escaped[PARSE_POST_BUF_SIZES]; -static char val[PARSE_POST_BUF_SIZES]; -static int key_len; -static int val_len; -static int state; -/*---------------------------------------------------------------------------*/ -/* Stringified min/max intervals */ -#define STRINGIFY(x) XSTR(x) -#define XSTR(x) #x - -#define RSSI_INT_MAX STRINGIFY(CC26XX_WEB_DEMO_RSSI_MEASURE_INTERVAL_MAX) -#define RSSI_INT_MIN STRINGIFY(CC26XX_WEB_DEMO_RSSI_MEASURE_INTERVAL_MIN) -#define PUB_INT_MAX STRINGIFY(MQTT_CLIENT_PUBLISH_INTERVAL_MAX) -#define PUB_INT_MIN STRINGIFY(MQTT_CLIENT_PUBLISH_INTERVAL_MIN) -/*---------------------------------------------------------------------------*/ -/* - * We can only handle a single POST request at a time. Since a second POST - * request cannot interrupt us while obtaining a lock, we don't really need - * this lock to be atomic. - * - * An HTTP connection will first request a lock before it starts processing - * a POST request. We maintain a global lock which is either NULL or points - * to the http conn which currently has the lock - */ -static struct httpd_state *lock; -/*---------------------------------------------------------------------------*/ -PROCESS(httpd_simple_process, "CC26XX Web Server"); -/*---------------------------------------------------------------------------*/ -#define ISO_nl 0x0A -#define ISO_space 0x20 -#define ISO_slash 0x2F -#define ISO_amp 0x26 -#define ISO_column 0x3A -#define ISO_equal 0x3D -/*---------------------------------------------------------------------------*/ -#define HTTP_200_OK "HTTP/1.0 200 OK\r\n" -#define HTTP_302_FO "HTTP/1.0 302 Found\r\n" -#define HTTP_400_BR "HTTP/1.0 400 Bad Request\r\n" -#define HTTP_404_NF "HTTP/1.0 404 Not Found\r\n" -#define HTTP_411_LR "HTTP/1.0 411 Length Required\r\n" -#define HTTP_413_TL "HTTP/1.0 413 Request Entity Too Large\r\n" -#define HTTP_503_SU "HTTP/1.0 503 Service Unavailable\r\n" -#define CONN_CLOSE "Connection: close\r\n" -/*---------------------------------------------------------------------------*/ -#define SECTION_TAG "div" -#define SECTION_OPEN "<" SECTION_TAG ">" -#define SECTION_CLOSE "" - -#define CONTENT_OPEN "
"
-#define CONTENT_CLOSE "
" -/*---------------------------------------------------------------------------*/ -#define REQUEST_TYPE_GET 1 -#define REQUEST_TYPE_POST 2 -/*---------------------------------------------------------------------------*/ -static const char *NOT_FOUND = "" - "
" - "

404 - file not found

" - "
" - "" - ""; -/*---------------------------------------------------------------------------*/ -/* Page template */ -static const char http_doctype[] = ""; -static const char http_header_200[] = HTTP_200_OK; -static const char http_header_302[] = HTTP_302_FO; -static const char http_header_400[] = HTTP_400_BR; -static const char http_header_404[] = HTTP_404_NF; -static const char http_header_411[] = HTTP_411_LR; -static const char http_header_413[] = HTTP_413_TL; -static const char http_header_503[] = HTTP_503_SU; -static const char http_get[] = "GET "; -static const char http_post[] = "POST "; -static const char http_index_html[] = "/index.html"; -static const char http_html_start[] = ""; -static const char *http_header_srv_str[] = { - "Server: Contiki, ", - BOARD_STRING "\r\n", - NULL -}; - -static const char *http_header_con_close[] = { - CONN_CLOSE, - NULL -}; - -static const char *http_config_css[] = { - "", - NULL -}; -static const char http_head_charset[] = ""; -static const char http_title_start[] = ""; -static const char http_title_end[] = ""; -static const char http_head_end[] = ""; -static const char http_body_start[] = ""; -static const char http_bottom[] = ""; -/*---------------------------------------------------------------------------*/ -static const char http_content_type_html[] = "text/html"; -static const char http_content_type_plain[] = "text/plain"; -/*---------------------------------------------------------------------------*/ -/* For the config page */ -static const char config_div_left[] = "
"; -static const char config_div_right[] = "
"; -static const char config_div_close[] = "
"; -/*---------------------------------------------------------------------------*/ -static char generate_index(struct httpd_state *s); -static char generate_config(struct httpd_state *s); -/*---------------------------------------------------------------------------*/ -typedef struct page { - struct page *next; - char *filename; - char *title; - char (*script)(struct httpd_state *s); -} page_t; - -static page_t http_index_page = { - NULL, - "index.html", - "Index", - generate_index, -}; - -static page_t http_dev_cfg_page = { - NULL, - "config.html", - "Device Config", - generate_config, -}; - -#if CC26XX_WEB_DEMO_NET_UART -static char generate_net_uart_config(struct httpd_state *s); - -static page_t http_net_cfg_page = { - NULL, - "netu.html", - "Net-UART Config", - generate_net_uart_config, -}; -#endif - -#if CC26XX_WEB_DEMO_MQTT_CLIENT -static char generate_mqtt_config(struct httpd_state *s); - -static page_t http_mqtt_cfg_page = { - NULL, - "mqtt.html", - "MQTT/IBM Cloud Config", - generate_mqtt_config, -}; -#endif -/*---------------------------------------------------------------------------*/ -#define IBM_QUICKSTART_LINK_LEN 128 -static char http_mqtt_a[IBM_QUICKSTART_LINK_LEN]; -/*---------------------------------------------------------------------------*/ -static uint16_t numtimes; -static const httpd_simple_post_handler_t *handler; -/*---------------------------------------------------------------------------*/ -static uint8_t config_ok; -process_event_t httpd_simple_event_new_config; -/*---------------------------------------------------------------------------*/ -struct httpd_state; -typedef char (*httpd_simple_script_t)(struct httpd_state *s); - -struct httpd_state { - char buf[HTTPD_SIMPLE_MAIN_BUF_SIZE]; - char tmp_buf[TMP_BUF_SIZE]; - struct timer timer; - struct psock sin, sout; - int blen; - const char **ptr; - const cc26xx_web_demo_sensor_reading_t *reading; - const page_t *page; - uip_ds6_route_t *r; - uip_ds6_nbr_t *nbr; - httpd_simple_script_t script; - int content_length; - int tmp_buf_len; - int tmp_buf_copied; - char filename[HTTPD_PATHLEN]; - char inputbuf[HTTPD_INBUF_LEN]; - struct pt outputpt; - struct pt generate_pt; - struct pt top_matter_pt; - char state; - char request_type; - char return_code; -}; -/*---------------------------------------------------------------------------*/ -LIST(post_handlers); -LIST(pages_list); -MEMB(conns, struct httpd_state, CONNS); -/*---------------------------------------------------------------------------*/ -#define HEX_TO_INT(x) (isdigit(x) ? x - '0' : x - 'W') -static size_t -url_unescape(const char *src, size_t srclen, char *dst, size_t dstlen) -{ - size_t i, j; - int a, b; - - for(i = j = 0; i < srclen && j < dstlen - 1; i++, j++) { - if(src[i] == '%' && isxdigit(*(unsigned char *)(src + i + 1)) - && isxdigit(*(unsigned char *)(src + i + 2))) { - a = tolower(*(unsigned char *)(src + i + 1)); - b = tolower(*(unsigned char *)(src + i + 2)); - dst[j] = ((HEX_TO_INT(a) << 4) | HEX_TO_INT(b)) & 0xff; - i += 2; - } else if(src[i] == '+') { - dst[j] = ' '; - } else { - dst[j] = src[i]; - } - } - - dst[j] = '\0'; - - return i == srclen; -} -/*---------------------------------------------------------------------------*/ -void -httpd_simple_register_post_handler(httpd_simple_post_handler_t *h) -{ - list_add(post_handlers, h); -} -/*---------------------------------------------------------------------------*/ -static void -get_neighbour_state_text(char *buf, uint8_t state) -{ - switch(state) { - case NBR_INCOMPLETE: - memcpy(buf, "INCOMPLETE", strlen("INCOMPLETE")); - break; - case NBR_REACHABLE: - memcpy(buf, "REACHABLE", strlen("REACHABLE")); - break; - case NBR_STALE: - memcpy(buf, "STALE", strlen("STALE")); - break; - case NBR_DELAY: - memcpy(buf, "DELAY", strlen("DELAY")); - break; - case NBR_PROBE: - memcpy(buf, "NBR_PROBE", strlen("NBR_PROBE")); - break; - } -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(enqueue_chunk(struct httpd_state *s, uint8_t immediate, - const char *format, ...)) -{ - va_list ap; - - PSOCK_BEGIN(&s->sout); - - va_start(ap, format); - - s->tmp_buf_len = vsnprintf(s->tmp_buf, TMP_BUF_SIZE, format, ap); - - va_end(ap); - - if(s->blen + s->tmp_buf_len < HTTPD_SIMPLE_MAIN_BUF_SIZE) { - /* Enough space for the entire chunk. Copy over */ - memcpy(&s->buf[s->blen], s->tmp_buf, s->tmp_buf_len); - s->blen += s->tmp_buf_len; - } else { - memcpy(&s->buf[s->blen], s->tmp_buf, HTTPD_SIMPLE_MAIN_BUF_SIZE - s->blen); - s->tmp_buf_copied = HTTPD_SIMPLE_MAIN_BUF_SIZE - s->blen; - s->blen = HTTPD_SIMPLE_MAIN_BUF_SIZE; - PSOCK_SEND(&s->sout, (uint8_t *)s->buf, s->blen); - s->blen = 0; - if(s->tmp_buf_copied < s->tmp_buf_len) { - memcpy(s->buf, &s->tmp_buf[s->tmp_buf_copied], - s->tmp_buf_len - s->tmp_buf_copied); - s->blen += s->tmp_buf_len - s->tmp_buf_copied; - } - } - - if(immediate != 0 && s->blen > 0) { - PSOCK_SEND(&s->sout, (uint8_t *)s->buf, s->blen); - s->blen = 0; - } - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(generate_top_matter(struct httpd_state *s, const char *title, - const char **css)) -{ - - PT_BEGIN(&s->top_matter_pt); - - PT_WAIT_THREAD(&s->top_matter_pt, enqueue_chunk(s, 0, http_doctype)); - PT_WAIT_THREAD(&s->top_matter_pt, enqueue_chunk(s, 0, http_html_start)); - PT_WAIT_THREAD(&s->top_matter_pt, enqueue_chunk(s, 0, http_title_start)); - - PT_WAIT_THREAD(&s->top_matter_pt, enqueue_chunk(s, 0, title)); - PT_WAIT_THREAD(&s->top_matter_pt, enqueue_chunk(s, 0, http_title_end)); - - if(css != NULL) { - for(s->ptr = css; *(s->ptr) != NULL; s->ptr++) { - PT_WAIT_THREAD(&s->top_matter_pt, enqueue_chunk(s, 0, *(s->ptr))); - } - } - - PT_WAIT_THREAD(&s->top_matter_pt, enqueue_chunk(s, 0, http_head_charset)); - PT_WAIT_THREAD(&s->top_matter_pt, enqueue_chunk(s, 0, http_head_end)); - PT_WAIT_THREAD(&s->top_matter_pt, enqueue_chunk(s, 0, http_body_start)); - - /* Links */ - PT_WAIT_THREAD(&s->top_matter_pt, - enqueue_chunk(s, 0, SECTION_OPEN "

")); - - s->page = list_head(pages_list); - PT_WAIT_THREAD(&s->top_matter_pt, - enqueue_chunk(s, 0, "[ %s ]", - s->page->filename, s->page->title)); - - for(s->page = s->page->next; s->page != NULL; s->page = s->page->next) { - PT_WAIT_THREAD(&s->top_matter_pt, - enqueue_chunk(s, 0, " | [ %s ]", - s->page->filename, s->page->title)); - } - -#if CC26XX_WEB_DEMO_MQTT_CLIENT - PT_WAIT_THREAD(&s->top_matter_pt, - enqueue_chunk(s, 0, " | %s", http_mqtt_a)); -#endif - PT_WAIT_THREAD(&s->top_matter_pt, - enqueue_chunk(s, 0, "

" SECTION_CLOSE)); - - PT_END(&s->top_matter_pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(generate_index(struct httpd_state *s)) -{ - char ipaddr_buf[IPADDR_BUF_LEN]; /* Intentionally on stack */ - - PT_BEGIN(&s->generate_pt); - - /* Generate top matter (doctype, title, nav links etc) */ - PT_WAIT_THREAD(&s->generate_pt, - generate_top_matter(s, http_index_page.title, NULL)); - - /* ND Cache */ - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, SECTION_OPEN "Neighbors" CONTENT_OPEN)); - - for(s->nbr = uip_ds6_nbr_head(); s->nbr != NULL; - s->nbr = uip_ds6_nbr_next(s->nbr)) { - - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "\n")); - - memset(ipaddr_buf, 0, IPADDR_BUF_LEN); - cc26xx_web_demo_ipaddr_sprintf(ipaddr_buf, IPADDR_BUF_LEN, &s->nbr->ipaddr); - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "%s", ipaddr_buf)); - - memset(ipaddr_buf, 0, IPADDR_BUF_LEN); - get_neighbour_state_text(ipaddr_buf, s->nbr->state); - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, " %s", ipaddr_buf)); - } - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, CONTENT_CLOSE SECTION_CLOSE)); - - /* Default Route */ - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - SECTION_OPEN "Default Route" CONTENT_OPEN)); - - memset(ipaddr_buf, 0, IPADDR_BUF_LEN); - cc26xx_web_demo_ipaddr_sprintf(ipaddr_buf, IPADDR_BUF_LEN, - uip_ds6_defrt_choose()); - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "%s", ipaddr_buf)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, CONTENT_CLOSE SECTION_CLOSE)); - - /* Routes */ - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, SECTION_OPEN "Routes" CONTENT_OPEN)); - - for(s->r = uip_ds6_route_head(); s->r != NULL; - s->r = uip_ds6_route_next(s->r)) { - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "\n")); - - memset(ipaddr_buf, 0, IPADDR_BUF_LEN); - cc26xx_web_demo_ipaddr_sprintf(ipaddr_buf, IPADDR_BUF_LEN, &s->r->ipaddr); - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "%s", ipaddr_buf)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, " / %u via ", s->r->length)); - - memset(ipaddr_buf, 0, IPADDR_BUF_LEN); - cc26xx_web_demo_ipaddr_sprintf(ipaddr_buf, IPADDR_BUF_LEN, - uip_ds6_route_nexthop(s->r)); - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "%s", ipaddr_buf)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - ", lifetime=%lus", s->r->state.lifetime)); - } - - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, - CONTENT_CLOSE SECTION_CLOSE)); - - /* Sensors */ - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, SECTION_OPEN "Sensors" CONTENT_OPEN)); - - for(s->reading = cc26xx_web_demo_sensor_first(); - s->reading != NULL; s->reading = s->reading->next) { - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "\n%s = %s %s", s->reading->descr, - s->reading->publish ? s->reading->converted : "N/A", - s->reading->units)); - } - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, CONTENT_CLOSE SECTION_CLOSE)); - - /* Footer */ - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, SECTION_OPEN)); - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "Page hits: %u
", - ++numtimes)); - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "Uptime: %lu secs
", - clock_seconds())); - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, SECTION_CLOSE)); - - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 1, http_bottom)); - - PT_END(&s->generate_pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(generate_config(struct httpd_state *s)) -{ - PT_BEGIN(&s->generate_pt); - - /* Generate top matter (doctype, title, nav links etc) */ - PT_WAIT_THREAD(&s->generate_pt, - generate_top_matter(s, http_dev_cfg_page.title, - http_config_css)); - - /* Sensor Settings */ - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "

Sensors

")); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "
generate_pt, - enqueue_chunk(s, 0, "method=\"post\" enctype=\"")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "application/x-www-form-urlencoded\" ")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "accept-charset=\"UTF-8\">")); - - for(s->reading = cc26xx_web_demo_sensor_first(); - s->reading != NULL; s->reading = s->reading->next) { - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%s%s:%s%s", config_div_left, - s->reading->descr, config_div_close, - config_div_right)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "generate_pt, - enqueue_chunk(s, 0, "title=\"On\" name=\"%s\"%s>", - s->reading->form_field, - s->reading->publish ? " Checked" : "")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "generate_pt, - enqueue_chunk(s, 0, "title=\"Off\" name=\"%s\"%s>%s", - s->reading->form_field, - s->reading->publish ? "" : " Checked", - config_div_close)); - } - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "
")); - - /* RSSI measurements */ -#if CC26XX_WEB_DEMO_READ_PARENT_RSSI - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "

RSSI Probing

")); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "
generate_pt, - enqueue_chunk(s, 0, "method=\"post\" enctype=\"")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "application/x-www-form-urlencoded\" ")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "accept-charset=\"UTF-8\">")); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sPeriod (secs):%s", - config_div_left, config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"%lu\" ", - (clock_time_t) - (cc26xx_web_demo_config.def_rt_ping_interval - / CLOCK_SECOND))); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "min=\"" RSSI_INT_MIN "\" " - "max=\"" RSSI_INT_MAX "\" " - "name=\"ping_interval\">%s", - config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "
")); -#endif - - /* Actions */ - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "

Actions

")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "
generate_pt, - enqueue_chunk(s, 0, "method=\"post\" enctype=\"")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "application/x-www-form-urlencoded\" ")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "accept-charset=\"UTF-8\">")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "
")); - - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 1, http_bottom)); - - PT_END(&s->generate_pt); -} -/*---------------------------------------------------------------------------*/ -#if CC26XX_WEB_DEMO_MQTT_CLIENT -static -PT_THREAD(generate_mqtt_config(struct httpd_state *s)) -{ - PT_BEGIN(&s->generate_pt); - - /* Generate top matter (doctype, title, nav links etc) */ - PT_WAIT_THREAD(&s->generate_pt, - generate_top_matter(s, http_mqtt_cfg_page.title, - http_config_css)); - - /* MQTT client settings */ - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "

%s

", http_mqtt_cfg_page.title)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "
generate_pt, - enqueue_chunk(s, 0, "method=\"post\" enctype=\"")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "application/x-www-form-urlencoded\" ")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "accept-charset=\"UTF-8\">")); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sType ID:%s", config_div_left, - config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"%s\" ", - cc26xx_web_demo_config.mqtt_config.type_id)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "name=\"type_id\">%s", config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sOrg ID:%s", config_div_left, - config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"%s\" ", - cc26xx_web_demo_config.mqtt_config.org_id)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "name=\"org_id\">%s", config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sAuth Token:%s", config_div_left, - config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"\" ")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "name=\"auth_token\">%s", - config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sCommand Type:%s", config_div_left, - config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"%s\" ", - cc26xx_web_demo_config.mqtt_config.cmd_type)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "name=\"cmd_type\">%s", - config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sEvent Type ID:%s", config_div_left, - config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"%s\" ", - cc26xx_web_demo_config.mqtt_config.event_type_id)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "name=\"event_type_id\">%s", - config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sInterval (secs):%s", - config_div_left, config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"%lu\" ", - (clock_time_t) - (cc26xx_web_demo_config.mqtt_config.pub_interval - / CLOCK_SECOND))); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "min=\"" PUB_INT_MIN "\" " - "max=\"" PUB_INT_MAX "\" " - "name=\"interval\">%s", - config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sBroker IP:%s", config_div_left, - config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"%s\" ", - cc26xx_web_demo_config.mqtt_config.broker_ip)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "name=\"broker_ip\">%s", - config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sBroker Port:%s", config_div_left, - config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"%d\" ", - cc26xx_web_demo_config.mqtt_config.broker_port)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "min=\"1\" max=\"65535\" " - "name=\"broker_port\">%s", - config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "
")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "
generate_pt, - enqueue_chunk(s, 0, "method=\"post\" enctype=\"")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "application/x-www-form-urlencoded\" ")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "accept-charset=\"UTF-8\">")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "
")); - - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 1, http_bottom)); - - PT_END(&s->generate_pt); -} -#endif -/*---------------------------------------------------------------------------*/ -#if CC26XX_WEB_DEMO_NET_UART -static -PT_THREAD(generate_net_uart_config(struct httpd_state *s)) -{ - - PT_BEGIN(&s->generate_pt); - - /* Generate top matter (doctype, title, nav links etc) */ - PT_WAIT_THREAD(&s->generate_pt, - generate_top_matter(s, http_net_cfg_page.title, - http_config_css)); - - /* Net-UART settings */ - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "

%s

", http_net_cfg_page.title)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "
generate_pt, - enqueue_chunk(s, 0, "method=\"post\" enctype=\"")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "application/x-www-form-urlencoded\" ")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "accept-charset=\"UTF-8\">")); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sRemote IPv6:%s", config_div_left, - config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"%s\" ", - cc26xx_web_demo_config.net_uart.remote_address)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "name=\"net_uart_ip\">%s", - config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sRemote Port:%s", config_div_left, - config_div_close)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%sgenerate_pt, - enqueue_chunk(s, 0, "value=\"%u\" ", - cc26xx_web_demo_config.net_uart.remote_port)); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "min=\"1\" max=\"65535\" " - "name=\"net_uart_port\">%s", - config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "%s%s:%s%s", config_div_left, - "Enable", config_div_close, - config_div_right)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "generate_pt, - enqueue_chunk(s, 0, "title=\"On\" name=\"net_uart_on\"%s>", - cc26xx_web_demo_config.net_uart.enable ? - " Checked" : "")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "generate_pt, - enqueue_chunk(s, 0, "title=\"Off\" name=\"net_uart_on\"" - "%s>%s", - cc26xx_web_demo_config.net_uart.enable ? - "" : " Checked", config_div_close)); - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, - "")); - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "
")); - - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 1, http_bottom)); - - PT_END(&s->generate_pt); -} -#endif -/*---------------------------------------------------------------------------*/ -static void -lock_obtain(struct httpd_state *s) -{ - if(lock == NULL) { - lock = s; - } -} -/*---------------------------------------------------------------------------*/ -static void -lock_release(struct httpd_state *s) -{ - if(lock == s) { - lock = NULL; - } -} -/*---------------------------------------------------------------------------*/ -static void -parse_post_request_chunk(char *buf, int buf_len, int last_chunk) -{ - int i; - int finish; - - for(i = 0; i < buf_len; i++) { - switch(state) { - case PARSE_POST_STATE_INIT: - state = PARSE_POST_STATE_MORE; - /* continue */ - case PARSE_POST_STATE_MORE: - memset(key, 0, PARSE_POST_BUF_SIZES); - memset(val, 0, PARSE_POST_BUF_SIZES); - memset(val_escaped, 0, PARSE_POST_BUF_SIZES); - key_len = 0; - val_len = 0; - state = PARSE_POST_STATE_READING_KEY; - /* continue */ - case PARSE_POST_STATE_READING_KEY: - if(buf[i] == ISO_equal) { - state = PARSE_POST_STATE_READING_VAL; - } else if(buf[i] == ISO_amp) { - /* Don't accept an amp while reading a key */ - state = PARSE_POST_STATE_ERROR; - } else { - /* Make sure we don't overshoot key's boundary */ - if(key_len <= PARSE_POST_MAX_POS) { - key[key_len] = buf[i]; - key_len++; - } else { - /* Not enough space for the key. Abort */ - state = PARSE_POST_STATE_ERROR; - } - } - break; - case PARSE_POST_STATE_READING_VAL: - finish = 0; - if(buf[i] == ISO_amp) { - finish = 1; - } else if(buf[i] == ISO_equal) { - /* Don't accept an '=' while reading a val */ - state = PARSE_POST_STATE_ERROR; - } else { - /* Make sure we don't overshoot key's boundary */ - if(val_len <= PARSE_POST_MAX_POS) { - val[val_len] = buf[i]; - val_len++; - /* Last character of the last chunk */ - if((i == buf_len - 1) && (last_chunk == 1)) { - finish = 1; - } - } else { - /* Not enough space for the value. Abort */ - state = PARSE_POST_STATE_ERROR; - } - } - - if(finish == 1) { - /* - * Done reading a key=value pair, either because we encountered an amp - * or because we reached the end of the message body. - * - * First, unescape the value. - * - * Then invoke handlers. We will bail out with PARSE_POST_STATE_ERROR, - * unless the key-val gets correctly processed - */ - url_unescape(val, val_len, val_escaped, PARSE_POST_BUF_SIZES); - val_len = strlen(val_escaped); - - for(handler = list_head(post_handlers); handler != NULL; - handler = list_item_next((void *)handler)) { - if(handler->handler != NULL) { - finish = handler->handler(key, key_len, val_escaped, val_len); - } - if(finish == HTTPD_SIMPLE_POST_HANDLER_ERROR) { - state = PARSE_POST_STATE_ERROR; - break; - } else if(finish == HTTPD_SIMPLE_POST_HANDLER_OK) { - /* Restart the state machine to expect the next pair */ - state = PARSE_POST_STATE_MORE; - - /* - * At least one handler returned OK, therefore we must generate a - * new config event when we're done. - */ - config_ok = 1; - break; - } - /* Else, continue */ - } - } - break; - case PARSE_POST_STATE_ERROR: - /* If we entered the error state earlier, do nothing */ - return; - default: - break; - } - } -} -/*---------------------------------------------------------------------------*/ -static httpd_simple_script_t -get_script(const char *name) -{ - page_t *page; - - for(page = list_head(pages_list); page != NULL; - page = list_item_next(page)) { - if(strncmp(name, page->filename, strlen(page->filename)) == 0) { - return page->script; - } - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_string(struct httpd_state *s, const char *str)) -{ - PSOCK_BEGIN(&s->sout); - - SEND_STRING(&s->sout, str); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr, - const char *content_type, const char *redir, - const char **additional)) -{ - PT_BEGIN(&s->generate_pt); - - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, statushdr)); - - for(s->ptr = http_header_srv_str; *(s->ptr) != NULL; s->ptr++) { - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, *(s->ptr))); - } - - if(redir) { - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "Location: %s\r\n", redir)); - } - - if(additional) { - for(s->ptr = additional; *(s->ptr) != NULL; s->ptr++) { - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, *(s->ptr))); - } - } - - PT_WAIT_THREAD(&s->generate_pt, - enqueue_chunk(s, 0, "Content-type: %s; ", content_type)); - - PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 1, "charset=UTF-8\r\n\r\n")); - - PT_END(&s->generate_pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_output(struct httpd_state *s)) -{ - PT_BEGIN(&s->outputpt); - - s->script = NULL; - - PT_INIT(&s->generate_pt); - PT_INIT(&s->top_matter_pt); - - if(s->request_type == REQUEST_TYPE_POST) { - if(s->return_code == RETURN_CODE_OK) { - PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_302, - http_content_type_plain, - s->filename, - NULL)); - } else if(s->return_code == RETURN_CODE_LR) { - PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_411, - http_content_type_plain, - NULL, - http_header_con_close)); - PT_WAIT_THREAD(&s->outputpt, send_string(s, "Content-Length Required\n")); - } else if(s->return_code == RETURN_CODE_TL) { - PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_413, - http_content_type_plain, - NULL, - http_header_con_close)); - PT_WAIT_THREAD(&s->outputpt, send_string(s, "Content-Length too Large\n")); - } else if(s->return_code == RETURN_CODE_SU) { - PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_503, - http_content_type_plain, - NULL, - http_header_con_close)); - PT_WAIT_THREAD(&s->outputpt, send_string(s, "Service Unavailable\n")); - } else { - PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_400, - http_content_type_plain, - NULL, - http_header_con_close)); - PT_WAIT_THREAD(&s->outputpt, send_string(s, "Bad Request\n")); - } - } else if(s->request_type == REQUEST_TYPE_GET) { - s->script = get_script(&s->filename[1]); - if(s->script == NULL) { - strncpy(s->filename, "/notfound.html", sizeof(s->filename)); - PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_404, - http_content_type_html, - NULL, - http_header_con_close)); - PT_WAIT_THREAD(&s->outputpt, - send_string(s, NOT_FOUND)); - uip_close(); - PT_EXIT(&s->outputpt); - } else { - PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_200, - http_content_type_html, - NULL, - http_header_con_close)); - PT_WAIT_THREAD(&s->outputpt, s->script(s)); - } - } - s->script = NULL; - PSOCK_CLOSE(&s->sout); - PT_END(&s->outputpt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_input(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sin); - - PSOCK_READTO(&s->sin, ISO_space); - - if(strncasecmp(s->inputbuf, http_get, 4) == 0) { - s->request_type = REQUEST_TYPE_GET; - PSOCK_READTO(&s->sin, ISO_space); - - if(s->inputbuf[0] != ISO_slash) { - PSOCK_CLOSE_EXIT(&s->sin); - } - - if(s->inputbuf[1] == ISO_space) { - strncpy(s->filename, http_index_html, sizeof(s->filename)); - } else { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - strncpy(s->filename, s->inputbuf, sizeof(s->filename)); - } - } else if(strncasecmp(s->inputbuf, http_post, 5) == 0) { - s->request_type = REQUEST_TYPE_POST; - PSOCK_READTO(&s->sin, ISO_space); - - if(s->inputbuf[0] != ISO_slash) { - PSOCK_CLOSE_EXIT(&s->sin); - } - - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - strncpy(s->filename, s->inputbuf, sizeof(s->filename)); - - /* POST: Read out the rest of the line and ignore it */ - PSOCK_READTO(&s->sin, ISO_nl); - - /* - * Start parsing headers. We look for Content-Length and ignore everything - * else until we hit the start of the message body. - * - * We will return 411 if the client doesn't send Content-Length and 413 - * if Content-Length is too high - */ - s->content_length = 0; - s->return_code = RETURN_CODE_LR; - do { - s->inputbuf[PSOCK_DATALEN(&s->sin)] = 0; - /* We anticipate a content length */ - if((PSOCK_DATALEN(&s->sin) > 14) && - strncasecmp(s->inputbuf, "Content-Length:", 15) == 0) { - char *val_start = &s->inputbuf[15]; - s->content_length = atoi(val_start); - - /* So far so good */ - s->return_code = RETURN_CODE_OK; - } - PSOCK_READTO(&s->sin, ISO_nl); - } while(PSOCK_DATALEN(&s->sin) != 2); - - /* - * Done reading headers. - * Reject content length greater than CONTENT_LENGTH_MAX bytes - */ - if(s->content_length > CONTENT_LENGTH_MAX) { - s->content_length = 0; - s->return_code = RETURN_CODE_TL; - } - - if(s->return_code == RETURN_CODE_OK) { - /* Acceptable Content Length. Try to obtain a lock */ - lock_obtain(s); - - if(lock == s) { - state = PARSE_POST_STATE_INIT; - } else { - s->return_code = RETURN_CODE_SU; - } - } - - /* Parse the message body, unless we have detected an error. */ - while(s->content_length > 0 && lock == s && - s->return_code == RETURN_CODE_OK) { - PSOCK_READBUF_LEN(&s->sin, s->content_length); - s->content_length -= PSOCK_DATALEN(&s->sin); - - /* Parse the message body */ - parse_post_request_chunk(s->inputbuf, PSOCK_DATALEN(&s->sin), - (s->content_length == 0)); - if(state == PARSE_POST_STATE_ERROR) { - /* Could not parse: Bad Request and stop parsing */ - s->return_code = RETURN_CODE_BR; - } - } - - /* - * Done. If our return code is OK but the state machine is not in - * STATE_MORE, it means that the message body ended half-way reading a key - * or value. Set 'Bad Request' - */ - if(s->return_code == RETURN_CODE_OK && state != PARSE_POST_STATE_MORE) { - s->return_code = RETURN_CODE_BR; - } - - /* If the flag is set, we had at least 1 configuration value accepted */ - if(config_ok) { - process_post(PROCESS_BROADCAST, httpd_simple_event_new_config, NULL); - } - config_ok = 0; - - lock_release(s); - } else { - PSOCK_CLOSE_EXIT(&s->sin); - } - - s->state = STATE_OUTPUT; - - while(1) { - PSOCK_READTO(&s->sin, ISO_nl); - } - - PSOCK_END(&s->sin); -} -/*---------------------------------------------------------------------------*/ -static void -handle_connection(struct httpd_state *s) -{ - handle_input(s); - if(s->state == STATE_OUTPUT) { - handle_output(s); - } -} -/*---------------------------------------------------------------------------*/ -static void -appcall(void *state) -{ - struct httpd_state *s = (struct httpd_state *)state; - - if(uip_closed() || uip_aborted() || uip_timedout()) { - if(s != NULL) { - memset(s, 0, sizeof(struct httpd_state)); - memb_free(&conns, s); - } - } else if(uip_connected()) { - s = (struct httpd_state *)memb_alloc(&conns); - if(s == NULL) { - uip_abort(); - return; - } - tcp_markconn(uip_conn, s); - PSOCK_INIT(&s->sin, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); - PSOCK_INIT(&s->sout, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); - PT_INIT(&s->outputpt); - s->script = NULL; - s->state = STATE_WAITING; - timer_set(&s->timer, CLOCK_SECOND * 10); - handle_connection(s); - } else if(s != NULL) { - if(uip_poll()) { - if(timer_expired(&s->timer)) { - uip_abort(); - memset(s, 0, sizeof(struct httpd_state)); - memb_free(&conns, s); - } - } else { - timer_restart(&s->timer); - } - handle_connection(s); - } else { - uip_abort(); - } -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - tcp_listen(UIP_HTONS(80)); - memb_init(&conns); - - list_add(pages_list, &http_index_page); - list_add(pages_list, &http_dev_cfg_page); - -#if CC26XX_WEB_DEMO_NET_UART - list_add(pages_list, &http_net_cfg_page); -#endif - -#if CC26XX_WEB_DEMO_MQTT_CLIENT - list_add(pages_list, &http_mqtt_cfg_page); -#endif -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(httpd_simple_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("CC26XX Web Server\n"); - - httpd_simple_event_new_config = process_alloc_event(); - - init(); - - snprintf(http_mqtt_a, IBM_QUICKSTART_LINK_LEN, - "[ IBM Quickstart ]", - linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], - linkaddr_node_addr.u8[2], linkaddr_node_addr.u8[5], - linkaddr_node_addr.u8[6], linkaddr_node_addr.u8[7]); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); - appcall(data); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/httpd-simple.h b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/httpd-simple.h deleted file mode 100644 index 2b04b264c..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/httpd-simple.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Header file for the HTTPD of the cc26xx web demo example. - * \author - * Adam Dunkels - * Niclas Finne - * Joakim Eriksson - * Texas Instruments Incorporated - http://www.ti.com/ - */ -/*---------------------------------------------------------------------------*/ -#ifndef HTTPD_SIMPLE_H_ -#define HTTPD_SIMPLE_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki-net.h" -#include "sys/process.h" -#include "cc26x0-web-demo.h" -/*---------------------------------------------------------------------------*/ -/* Ideally a multiple of TCP_MSS */ -#ifdef HTTPD_SIMPLE_CONF_MAIN_BUF_SIZE -#define HTTPD_SIMPLE_MAIN_BUF_SIZE HTTPD_SIMPLE_CONF_MAIN_BUF_SIZE -#else -#define HTTPD_SIMPLE_MAIN_BUF_SIZE UIP_TCP_MSS -#endif -/*---------------------------------------------------------------------------*/ -#define HTTPD_PATHLEN 16 -#define HTTPD_INBUF_LEN (HTTPD_PATHLEN + 10) - -#define TMP_BUF_SIZE (UIP_TCP_MSS + 1) -/*---------------------------------------------------------------------------*/ -/* POST request handlers */ -#define HTTPD_SIMPLE_POST_HANDLER_OK 1 -#define HTTPD_SIMPLE_POST_HANDLER_UNKNOWN 0 -#define HTTPD_SIMPLE_POST_HANDLER_ERROR 0xFFFFFFFF - -/** - * \brief Datatype for a handler which can process incoming POST requests - * \param key The configuration key to be updated - * \param key_len The length of the key argument - * \param val The new configuration value for key - * \param val_len The length of the value argument - * - * \return 1: HTTPD_SIMPLE_POST_HANDLER_OK if the function can handle the - * request, HTTPD_SIMPLE_POST_HANDLER_UNKNOWN if it does not know how to handle - * it. HTTPD_SIMPLE_POST_HANDLER_ERROR if it does know how to handle it but - * the request was malformed. - */ -typedef struct httpd_simple_post_handler { - struct httpd_simple_post_handler *next; - int (*handler)(char *key, int key_len, char *val, int val_len); -} httpd_simple_post_handler_t; - -/* Declare a handler */ -#define HTTPD_SIMPLE_POST_HANDLER(name, fp) \ - httpd_simple_post_handler_t name##_handler = { NULL, fp } - -/** - * \brief Register a handler for POST requests - * \param h A pointer to the handler structure - */ -void httpd_simple_register_post_handler(httpd_simple_post_handler_t *h); -/*---------------------------------------------------------------------------*/ -/* - * An event generated by the HTTPD when a new configuration request has been - * received - */ -extern process_event_t httpd_simple_event_new_config; -/*---------------------------------------------------------------------------*/ -PROCESS_NAME(httpd_simple_process); -/*---------------------------------------------------------------------------*/ -#endif /* HTTPD_SIMPLE_H_ */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/6lbr-web.png b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/6lbr-web.png deleted file mode 100644 index 5308c412b..000000000 Binary files a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/6lbr-web.png and /dev/null differ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/ibm-watson-iot-platform-tls-optional.png b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/ibm-watson-iot-platform-tls-optional.png deleted file mode 100644 index 93c98624f..000000000 Binary files a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/ibm-watson-iot-platform-tls-optional.png and /dev/null differ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/quickstart-sensortag.png b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/quickstart-sensortag.png deleted file mode 100644 index a7ce7dabe..000000000 Binary files a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/quickstart-sensortag.png and /dev/null differ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/sensor-readings-config.png b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/sensor-readings-config.png deleted file mode 100644 index 79c8e61e3..000000000 Binary files a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/sensor-readings-config.png and /dev/null differ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/well-known-core.png b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/well-known-core.png deleted file mode 100644 index 93552e502..000000000 Binary files a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/img/well-known-core.png and /dev/null differ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/mqtt-client.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/mqtt-client.c deleted file mode 100644 index 0250de322..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/mqtt-client.c +++ /dev/null @@ -1,925 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * MQTT/IBM cloud service client for the CC26XX web demo. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "net/routing/routing.h" -#include "mqtt.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-icmp6.h" -#include "sys/etimer.h" -#include "sys/ctimer.h" -#include "lib/sensors.h" -#include "dev/button-hal.h" -#include "board-peripherals.h" -#include "cc26x0-web-demo.h" -#include "dev/leds.h" -#include "mqtt-client.h" -#include "httpd-simple.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/* - * IBM server: messaging.quickstart.internetofthings.ibmcloud.com - * (184.172.124.189) mapped in an NAT64 (prefix 64:ff9b::/96) IPv6 address - * Note: If not able to connect; lookup the IP address again as it may change. - * - * If the node has a broker IP setting saved on flash, this value here will - * get ignored - */ -static const char *broker_ip = "0064:ff9b:0000:0000:0000:0000:b8ac:7cbd"; -/*---------------------------------------------------------------------------*/ -/* - * A timeout used when waiting for something to happen (e.g. to connect or to - * disconnect) - */ -#define STATE_MACHINE_PERIODIC (CLOCK_SECOND >> 1) -/*---------------------------------------------------------------------------*/ -/* Provide visible feedback via LEDS during various states */ -/* When connecting to broker */ -#define CONNECTING_LED_DURATION (CLOCK_SECOND >> 3) - -/* Each time we try to publish */ -#define PUBLISH_LED_ON_DURATION (CLOCK_SECOND) -/*---------------------------------------------------------------------------*/ -/* Connections and reconnections */ -#define RETRY_FOREVER 0xFF -#define RECONNECT_INTERVAL (CLOCK_SECOND * 2) - -/* - * Number of times to try reconnecting to the broker. - * Can be a limited number (e.g. 3, 10 etc) or can be set to RETRY_FOREVER - */ -#define RECONNECT_ATTEMPTS 5 -#define CONNECTION_STABLE_TIME (CLOCK_SECOND * 5) -#define NEW_CONFIG_WAIT_INTERVAL (CLOCK_SECOND * 20) -static struct timer connection_life; -static uint8_t connect_attempt; -/*---------------------------------------------------------------------------*/ -/* Various states */ -static uint8_t state; -#define MQTT_CLIENT_STATE_INIT 0 -#define MQTT_CLIENT_STATE_REGISTERED 1 -#define MQTT_CLIENT_STATE_CONNECTING 2 -#define MQTT_CLIENT_STATE_CONNECTED 3 -#define MQTT_CLIENT_STATE_PUBLISHING 4 -#define MQTT_CLIENT_STATE_DISCONNECTED 5 -#define MQTT_CLIENT_STATE_NEWCONFIG 6 -#define MQTT_CLIENT_STATE_CONFIG_ERROR 0xFE -#define MQTT_CLIENT_STATE_ERROR 0xFF -/*---------------------------------------------------------------------------*/ -/* Maximum TCP segment size for outgoing segments of our socket */ -#define MQTT_CLIENT_MAX_SEGMENT_SIZE 32 -/*---------------------------------------------------------------------------*/ -/* - * Buffers for Client ID and Topic. - * Make sure they are large enough to hold the entire respective string - * - * d:quickstart:status:EUI64 is 32 bytes long - * iot-2/evt/status/fmt/json is 25 bytes - * We also need space for the null termination - */ -#define BUFFER_SIZE 64 -static char client_id[BUFFER_SIZE]; -static char pub_topic[BUFFER_SIZE]; -static char sub_topic[BUFFER_SIZE]; -/*---------------------------------------------------------------------------*/ -/* - * The main MQTT buffers. - * We will need to increase if we start publishing more data. - */ -#define APP_BUFFER_SIZE 512 -static struct mqtt_connection conn; -static char app_buffer[APP_BUFFER_SIZE]; -/*---------------------------------------------------------------------------*/ -#define QUICKSTART "quickstart" -/*---------------------------------------------------------------------------*/ -static struct mqtt_message *msg_ptr = 0; -static struct etimer publish_periodic_timer; -static struct ctimer ct; -static char *buf_ptr; -static uint16_t seq_nr_value = 0; -/*---------------------------------------------------------------------------*/ -static uip_ip6addr_t def_route; -/*---------------------------------------------------------------------------*/ -/* Parent RSSI functionality */ -extern int def_rt_rssi; -/*---------------------------------------------------------------------------*/ -const static cc26xx_web_demo_sensor_reading_t *reading; -/*---------------------------------------------------------------------------*/ -mqtt_client_config_t *conf; -/*---------------------------------------------------------------------------*/ -PROCESS(mqtt_client_process, "CC26XX MQTT Client"); -/*---------------------------------------------------------------------------*/ -static void -publish_led_off(void *d) -{ - leds_off(CC26XX_WEB_DEMO_STATUS_LED); -} -/*---------------------------------------------------------------------------*/ -static void -new_net_config(void) -{ - /* - * We got a new configuration over the net. - * - * Disconnect from the current broker and stop the periodic timer. - * - * When the source of the new configuration is done, we will get notified - * via an event. - */ - if(state == MQTT_CLIENT_STATE_NEWCONFIG) { - return; - } - - state = MQTT_CLIENT_STATE_NEWCONFIG; - - etimer_stop(&publish_periodic_timer); - mqtt_disconnect(&conn); -} -/*---------------------------------------------------------------------------*/ -static int -org_id_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv = HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - if(key_len != strlen("org_id") || - strncasecmp(key, "org_id", strlen("org_id")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - if(val_len > MQTT_CLIENT_CONFIG_ORG_ID_LEN) { - /* Ours but bad value */ - rv = HTTPD_SIMPLE_POST_HANDLER_ERROR; - } else { - memset(conf->org_id, 0, MQTT_CLIENT_CONFIG_ORG_ID_LEN); - memcpy(conf->org_id, val, val_len); - - rv = HTTPD_SIMPLE_POST_HANDLER_OK; - } - - new_net_config(); - - return rv; -} -/*---------------------------------------------------------------------------*/ -static int -type_id_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv = HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - if(key_len != strlen("type_id") || - strncasecmp(key, "type_id", strlen("type_id")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - if(val_len > MQTT_CLIENT_CONFIG_TYPE_ID_LEN) { - /* Ours but bad value */ - rv = HTTPD_SIMPLE_POST_HANDLER_ERROR; - } else { - memset(conf->type_id, 0, MQTT_CLIENT_CONFIG_TYPE_ID_LEN); - memcpy(conf->type_id, val, val_len); - - rv = HTTPD_SIMPLE_POST_HANDLER_OK; - } - - new_net_config(); - - return rv; -} -/*---------------------------------------------------------------------------*/ -static int -event_type_id_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv = HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - if(key_len != strlen("event_type_id") || - strncasecmp(key, "event_type_id", strlen("event_type_id")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - if(val_len > MQTT_CLIENT_CONFIG_EVENT_TYPE_ID_LEN) { - /* Ours but bad value */ - rv = HTTPD_SIMPLE_POST_HANDLER_ERROR; - } else { - memset(conf->event_type_id, 0, MQTT_CLIENT_CONFIG_EVENT_TYPE_ID_LEN); - memcpy(conf->event_type_id, val, val_len); - - rv = HTTPD_SIMPLE_POST_HANDLER_OK; - } - - new_net_config(); - - return rv; -} -/*---------------------------------------------------------------------------*/ -static int -cmd_type_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv = HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - if(key_len != strlen("cmd_type") || - strncasecmp(key, "cmd_type", strlen("cmd_type")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - if(val_len > MQTT_CLIENT_CONFIG_CMD_TYPE_LEN) { - /* Ours but bad value */ - rv = HTTPD_SIMPLE_POST_HANDLER_ERROR; - } else { - memset(conf->cmd_type, 0, MQTT_CLIENT_CONFIG_CMD_TYPE_LEN); - memcpy(conf->cmd_type, val, val_len); - - rv = HTTPD_SIMPLE_POST_HANDLER_OK; - } - - new_net_config(); - - return rv; -} -/*---------------------------------------------------------------------------*/ -static int -auth_token_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv = HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - if(key_len != strlen("auth_token") || - strncasecmp(key, "auth_token", strlen("auth_token")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - if(val_len > MQTT_CLIENT_CONFIG_AUTH_TOKEN_LEN) { - /* Ours but bad value */ - rv = HTTPD_SIMPLE_POST_HANDLER_ERROR; - } else { - memset(conf->auth_token, 0, MQTT_CLIENT_CONFIG_AUTH_TOKEN_LEN); - memcpy(conf->auth_token, val, val_len); - - rv = HTTPD_SIMPLE_POST_HANDLER_OK; - } - - new_net_config(); - - return rv; -} -/*---------------------------------------------------------------------------*/ -static int -interval_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv = 0; - - if(key_len != strlen("interval") || - strncasecmp(key, "interval", strlen("interval")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - rv = atoi(val); - - if(rv < MQTT_CLIENT_PUBLISH_INTERVAL_MIN || - rv > MQTT_CLIENT_PUBLISH_INTERVAL_MAX) { - return HTTPD_SIMPLE_POST_HANDLER_ERROR; - } - - conf->pub_interval = rv * CLOCK_SECOND; - - return HTTPD_SIMPLE_POST_HANDLER_OK; -} -/*---------------------------------------------------------------------------*/ -static int -port_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv = 0; - - if(key_len != strlen("broker_port") || - strncasecmp(key, "broker_port", strlen("broker_port")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - rv = atoi(val); - - if(rv <= 65535 && rv > 0) { - conf->broker_port = rv; - } else { - return HTTPD_SIMPLE_POST_HANDLER_ERROR; - } - - new_net_config(); - - return HTTPD_SIMPLE_POST_HANDLER_OK; -} -/*---------------------------------------------------------------------------*/ -static int -ip_addr_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv = HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - - if(key_len != strlen("broker_ip") || - strncasecmp(key, "broker_ip", strlen("broker_ip")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - if(val_len > MQTT_CLIENT_CONFIG_IP_ADDR_STR_LEN) { - /* Ours but bad value */ - rv = HTTPD_SIMPLE_POST_HANDLER_ERROR; - } else { - memset(conf->broker_ip, 0, MQTT_CLIENT_CONFIG_IP_ADDR_STR_LEN); - memcpy(conf->broker_ip, val, val_len); - - rv = HTTPD_SIMPLE_POST_HANDLER_OK; - } - - new_net_config(); - - return rv; -} -/*---------------------------------------------------------------------------*/ -static int -reconnect_post_handler(char *key, int key_len, char *val, int val_len) -{ - if(key_len != strlen("reconnect") || - strncasecmp(key, "reconnect", strlen("reconnect")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - new_net_config(); - - return HTTPD_SIMPLE_POST_HANDLER_OK; -} -/*---------------------------------------------------------------------------*/ -HTTPD_SIMPLE_POST_HANDLER(org_id, org_id_post_handler); -HTTPD_SIMPLE_POST_HANDLER(type_id, type_id_post_handler); -HTTPD_SIMPLE_POST_HANDLER(event_type_id, event_type_id_post_handler); -HTTPD_SIMPLE_POST_HANDLER(cmd_type, cmd_type_post_handler); -HTTPD_SIMPLE_POST_HANDLER(auth_token, auth_token_post_handler); -HTTPD_SIMPLE_POST_HANDLER(ip_addr, ip_addr_post_handler); -HTTPD_SIMPLE_POST_HANDLER(port, port_post_handler); -HTTPD_SIMPLE_POST_HANDLER(interval, interval_post_handler); -HTTPD_SIMPLE_POST_HANDLER(reconnect, reconnect_post_handler); -/*---------------------------------------------------------------------------*/ -static void -pub_handler(const char *topic, uint16_t topic_len, const uint8_t *chunk, - uint16_t chunk_len) -{ - DBG("Pub Handler: topic='%s' (len=%u), chunk_len=%u\n", topic, topic_len, - chunk_len); - - /* If we don't like the length, ignore */ - if(topic_len != 23 || chunk_len != 1) { - printf("Incorrect topic or chunk len. Ignored\n"); - return; - } - - /* If the format != json, ignore */ - if(strncmp(&topic[topic_len - 4], "json", 4) != 0) { - printf("Incorrect format\n"); - } - - if(strncmp(&topic[10], "leds", 4) == 0) { - if(chunk[0] == '1') { - leds_on(LEDS_RED); - } else if(chunk[0] == '0') { - leds_off(LEDS_RED); - } - return; - } - -#if BOARD_SENSORTAG - if(strncmp(&topic[10], "buzz", 4) == 0) { - if(chunk[0] == '1') { - buzzer_start(1000); - } else if(chunk[0] == '0') { - buzzer_stop(); - } - return; - } -#endif -} -/*---------------------------------------------------------------------------*/ -static void -mqtt_event(struct mqtt_connection *m, mqtt_event_t event, void *data) -{ - switch(event) { - case MQTT_EVENT_CONNECTED: { - DBG("APP - Application has a MQTT connection\n"); - timer_set(&connection_life, CONNECTION_STABLE_TIME); - state = MQTT_CLIENT_STATE_CONNECTED; - break; - } - case MQTT_EVENT_DISCONNECTED: { - DBG("APP - MQTT Disconnect. Reason %u\n", *((mqtt_event_t *)data)); - - /* Do nothing if the disconnect was the result of an incoming config */ - if(state != MQTT_CLIENT_STATE_NEWCONFIG) { - state = MQTT_CLIENT_STATE_DISCONNECTED; - process_poll(&mqtt_client_process); - } - break; - } - case MQTT_EVENT_PUBLISH: { - msg_ptr = data; - - /* Implement first_flag in publish message? */ - if(msg_ptr->first_chunk) { - msg_ptr->first_chunk = 0; - DBG("APP - Application received a publish on topic '%s'. Payload " - "size is %i bytes. Content:\n\n", - msg_ptr->topic, msg_ptr->payload_length); - } - - pub_handler(msg_ptr->topic, strlen(msg_ptr->topic), msg_ptr->payload_chunk, - msg_ptr->payload_length); - break; - } - case MQTT_EVENT_SUBACK: { - DBG("APP - Application is subscribed to topic successfully\n"); - break; - } - case MQTT_EVENT_UNSUBACK: { - DBG("APP - Application is unsubscribed to topic successfully\n"); - break; - } - case MQTT_EVENT_PUBACK: { - DBG("APP - Publishing complete.\n"); - break; - } - default: - DBG("APP - Application got a unhandled MQTT event: %i\n", event); - break; - } -} -/*---------------------------------------------------------------------------*/ -static int -construct_pub_topic(void) -{ - int len = snprintf(pub_topic, BUFFER_SIZE, "iot-2/evt/%s/fmt/json", - conf->event_type_id); - - /* len < 0: Error. Len >= BUFFER_SIZE: Buffer too small */ - if(len < 0 || len >= BUFFER_SIZE) { - printf("Pub Topic: %d, Buffer %d\n", len, BUFFER_SIZE); - return 0; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -construct_sub_topic(void) -{ - int len = snprintf(sub_topic, BUFFER_SIZE, "iot-2/cmd/%s/fmt/json", - conf->cmd_type); - - /* len < 0: Error. Len >= BUFFER_SIZE: Buffer too small */ - if(len < 0 || len >= BUFFER_SIZE) { - printf("Sub Topic: %d, Buffer %d\n", len, BUFFER_SIZE); - return 0; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -construct_client_id(void) -{ - int len = snprintf(client_id, BUFFER_SIZE, "d:%s:%s:%02x%02x%02x%02x%02x%02x", - conf->org_id, conf->type_id, - linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], - linkaddr_node_addr.u8[2], linkaddr_node_addr.u8[5], - linkaddr_node_addr.u8[6], linkaddr_node_addr.u8[7]); - - /* len < 0: Error. Len >= BUFFER_SIZE: Buffer too small */ - if(len < 0 || len >= BUFFER_SIZE) { - printf("Client ID: %d, Buffer %d\n", len, BUFFER_SIZE); - return 0; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -update_config(void) -{ - if(construct_client_id() == 0) { - /* Fatal error. Client ID larger than the buffer */ - state = MQTT_CLIENT_STATE_CONFIG_ERROR; - return; - } - - if(construct_sub_topic() == 0) { - /* Fatal error. Topic larger than the buffer */ - state = MQTT_CLIENT_STATE_CONFIG_ERROR; - return; - } - - if(construct_pub_topic() == 0) { - /* Fatal error. Topic larger than the buffer */ - state = MQTT_CLIENT_STATE_CONFIG_ERROR; - return; - } - - /* Reset the counter */ - seq_nr_value = 0; - - state = MQTT_CLIENT_STATE_INIT; - - /* - * Schedule next timer event ASAP - * - * If we entered an error state then we won't do anything when it fires. - * - * Since the error at this stage is a config error, we will only exit this - * error state if we get a new config. - */ - etimer_set(&publish_periodic_timer, 0); - - return; -} -/*---------------------------------------------------------------------------*/ -static int -init_config() -{ - /* Populate configuration with default values */ - memset(conf, 0, sizeof(mqtt_client_config_t)); - - memcpy(conf->org_id, CC26XX_WEB_DEMO_DEFAULT_ORG_ID, 11); - memcpy(conf->type_id, CC26XX_WEB_DEMO_DEFAULT_TYPE_ID, 7); - memcpy(conf->event_type_id, CC26XX_WEB_DEMO_DEFAULT_EVENT_TYPE_ID, 7); - memcpy(conf->broker_ip, broker_ip, strlen(broker_ip)); - memcpy(conf->cmd_type, CC26XX_WEB_DEMO_DEFAULT_SUBSCRIBE_CMD_TYPE, 1); - - conf->broker_port = CC26XX_WEB_DEMO_DEFAULT_BROKER_PORT; - conf->pub_interval = CC26XX_WEB_DEMO_DEFAULT_PUBLISH_INTERVAL; - - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -register_http_post_handlers(void) -{ - httpd_simple_register_post_handler(&org_id_handler); - httpd_simple_register_post_handler(&type_id_handler); - httpd_simple_register_post_handler(&event_type_id_handler); - httpd_simple_register_post_handler(&cmd_type_handler); - httpd_simple_register_post_handler(&auth_token_handler); - httpd_simple_register_post_handler(&interval_handler); - httpd_simple_register_post_handler(&port_handler); - httpd_simple_register_post_handler(&ip_addr_handler); - httpd_simple_register_post_handler(&reconnect_handler); -} -/*---------------------------------------------------------------------------*/ -static void -subscribe(void) -{ - /* Publish MQTT topic in IBM quickstart format */ - mqtt_status_t status; - - status = mqtt_subscribe(&conn, NULL, sub_topic, MQTT_QOS_LEVEL_0); - - DBG("APP - Subscribing!\n"); - if(status == MQTT_STATUS_OUT_QUEUE_FULL) { - DBG("APP - Tried to subscribe but command queue was full!\n"); - } -} -/*---------------------------------------------------------------------------*/ -static void -publish(void) -{ - /* Publish MQTT topic in IBM quickstart format */ - int len; - int remaining = APP_BUFFER_SIZE; - char def_rt_str[64]; - - seq_nr_value++; - - buf_ptr = app_buffer; - - len = snprintf(buf_ptr, remaining, - "{" - "\"d\":{" - "\"myName\":\"%s\"," - "\"Seq #\":%d," - "\"Uptime (sec)\":%lu", - BOARD_STRING, seq_nr_value, clock_seconds()); - - if(len < 0 || len >= remaining) { - printf("Buffer too short. Have %d, need %d + \\0\n", remaining, len); - return; - } - - remaining -= len; - buf_ptr += len; - - /* Put our Default route's string representation in a buffer */ - memset(def_rt_str, 0, sizeof(def_rt_str)); - cc26xx_web_demo_ipaddr_sprintf(def_rt_str, sizeof(def_rt_str), - uip_ds6_defrt_choose()); - - len = snprintf(buf_ptr, remaining, ",\"Def Route\":\"%s\",\"RSSI (dBm)\":%d", - def_rt_str, def_rt_rssi); - - if(len < 0 || len >= remaining) { - printf("Buffer too short. Have %d, need %d + \\0\n", remaining, len); - return; - } - remaining -= len; - buf_ptr += len; - - memcpy(&def_route, uip_ds6_defrt_choose(), sizeof(uip_ip6addr_t)); - - for(reading = cc26xx_web_demo_sensor_first(); - reading != NULL; reading = reading->next) { - if(reading->publish && reading->raw != CC26XX_SENSOR_READING_ERROR) { - len = snprintf(buf_ptr, remaining, - ",\"%s (%s)\":%s", reading->descr, reading->units, - reading->converted); - - if(len < 0 || len >= remaining) { - printf("Buffer too short. Have %d, need %d + \\0\n", remaining, len); - return; - } - remaining -= len; - buf_ptr += len; - } - } - - len = snprintf(buf_ptr, remaining, "}}"); - - if(len < 0 || len >= remaining) { - printf("Buffer too short. Have %d, need %d + \\0\n", remaining, len); - return; - } - - mqtt_publish(&conn, NULL, pub_topic, (uint8_t *)app_buffer, - strlen(app_buffer), MQTT_QOS_LEVEL_0, MQTT_RETAIN_OFF); - - DBG("APP - Publish!\n"); -} -/*---------------------------------------------------------------------------*/ -static void -connect_to_broker(void) -{ - /* Connect to MQTT server */ - mqtt_status_t conn_attempt_result = mqtt_connect(&conn, conf->broker_ip, - conf->broker_port, - conf->pub_interval * 3); - - if(conn_attempt_result == MQTT_STATUS_OK) { - state = MQTT_CLIENT_STATE_CONNECTING; - } else { - state = MQTT_CLIENT_STATE_CONFIG_ERROR; - } -} -/*---------------------------------------------------------------------------*/ -static void -state_machine(void) -{ - switch(state) { - case MQTT_CLIENT_STATE_INIT: - /* If we have just been configured register MQTT connection */ - mqtt_register(&conn, &mqtt_client_process, client_id, mqtt_event, - MQTT_CLIENT_MAX_SEGMENT_SIZE); - - /* - * If we are not using the quickstart service (thus we are an IBM - * registered device), we need to provide user name and password - */ - if(strncasecmp(conf->org_id, QUICKSTART, strlen(conf->org_id)) != 0) { - if(strlen(conf->auth_token) == 0) { - printf("User name set, but empty auth token\n"); - state = MQTT_CLIENT_STATE_ERROR; - break; - } else { - mqtt_set_username_password(&conn, "use-token-auth", - conf->auth_token); - } - } - - /* _register() will set auto_reconnect. We don't want that. */ - conn.auto_reconnect = 0; - connect_attempt = 1; - - /* - * Wipe out the default route so we'll republish it every time we switch to - * a new broker - */ - memset(&def_route, 0, sizeof(def_route)); - - state = MQTT_CLIENT_STATE_REGISTERED; - DBG("Init\n"); - /* Continue */ - case MQTT_CLIENT_STATE_REGISTERED: - if(uip_ds6_get_global(ADDR_PREFERRED) != NULL) { - /* Registered and with a public IP. Connect */ - DBG("Registered. Connect attempt %u\n", connect_attempt); - connect_to_broker(); - } - etimer_set(&publish_periodic_timer, CC26XX_WEB_DEMO_NET_CONNECT_PERIODIC); - return; - break; - case MQTT_CLIENT_STATE_CONNECTING: - leds_on(CC26XX_WEB_DEMO_STATUS_LED); - ctimer_set(&ct, CONNECTING_LED_DURATION, publish_led_off, NULL); - /* Not connected yet. Wait */ - DBG("Connecting (%u)\n", connect_attempt); - break; - case MQTT_CLIENT_STATE_CONNECTED: - /* Don't subscribe unless we are a registered device */ - if(strncasecmp(conf->org_id, QUICKSTART, strlen(conf->org_id)) == 0) { - DBG("Using 'quickstart': Skipping subscribe\n"); - state = MQTT_CLIENT_STATE_PUBLISHING; - } - /* Continue */ - case MQTT_CLIENT_STATE_PUBLISHING: - /* If the timer expired, the connection is stable. */ - if(timer_expired(&connection_life)) { - /* - * Intentionally using 0 here instead of 1: We want RECONNECT_ATTEMPTS - * attempts if we disconnect after a successful connect - */ - connect_attempt = 0; - } - - if(mqtt_ready(&conn) && conn.out_buffer_sent) { - /* Connected. Publish */ - if(state == MQTT_CLIENT_STATE_CONNECTED) { - subscribe(); - state = MQTT_CLIENT_STATE_PUBLISHING; - } else { - leds_on(CC26XX_WEB_DEMO_STATUS_LED); - ctimer_set(&ct, PUBLISH_LED_ON_DURATION, publish_led_off, NULL); - publish(); - } - etimer_set(&publish_periodic_timer, conf->pub_interval); - - DBG("Publishing\n"); - /* Return here so we don't end up rescheduling the timer */ - return; - } else { - /* - * Our publish timer fired, but some MQTT packet is already in flight - * (either not sent at all, or sent but not fully ACKd). - * - * This can mean that we have lost connectivity to our broker or that - * simply there is some network delay. In both cases, we refuse to - * trigger a new message and we wait for TCP to either ACK the entire - * packet after retries, or to timeout and notify us. - */ - DBG("Publishing... (MQTT state=%d, q=%u)\n", conn.state, - conn.out_queue_full); - } - break; - case MQTT_CLIENT_STATE_DISCONNECTED: - DBG("Disconnected\n"); - if(connect_attempt < RECONNECT_ATTEMPTS || - RECONNECT_ATTEMPTS == RETRY_FOREVER) { - /* Disconnect and backoff */ - clock_time_t interval; - mqtt_disconnect(&conn); - connect_attempt++; - - interval = connect_attempt < 3 ? RECONNECT_INTERVAL << connect_attempt : - RECONNECT_INTERVAL << 3; - - DBG("Disconnected. Attempt %u in %lu ticks\n", connect_attempt, interval); - - etimer_set(&publish_periodic_timer, interval); - - state = MQTT_CLIENT_STATE_REGISTERED; - return; - } else { - /* Max reconnect attempts reached. Enter error state */ - state = MQTT_CLIENT_STATE_ERROR; - DBG("Aborting connection after %u attempts\n", connect_attempt - 1); - } - break; - case MQTT_CLIENT_STATE_NEWCONFIG: - /* Only update config after we have disconnected or in the case of an error */ - if(conn.state == MQTT_CONN_STATE_NOT_CONNECTED || conn.state == MQTT_CONN_STATE_ERROR) { - update_config(); - DBG("New config\n"); - - /* update_config() scheduled next pass. Return */ - return; - } - break; - case MQTT_CLIENT_STATE_CONFIG_ERROR: - /* Idle away. The only way out is a new config */ - printf("Bad configuration.\n"); - return; - case MQTT_CLIENT_STATE_ERROR: - default: - leds_on(CC26XX_WEB_DEMO_STATUS_LED); - /* - * 'default' should never happen. - * - * If we enter here it's because of some error. Stop timers. The only thing - * that can bring us out is a new config event - */ - printf("Default case: State=0x%02x\n", state); - return; - } - - /* If we didn't return so far, reschedule ourselves */ - etimer_set(&publish_periodic_timer, STATE_MACHINE_PERIODIC); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(mqtt_client_process, ev, data) -{ - - PROCESS_BEGIN(); - - printf("CC26XX MQTT Client Process\n"); - - conf = &cc26xx_web_demo_config.mqtt_config; - if(init_config() != 1) { - PROCESS_EXIT(); - } - - register_http_post_handlers(); - - update_config(); - - /* Main loop */ - while(1) { - - PROCESS_YIELD(); - - if(ev == button_hal_release_event) { - button_hal_button_t *btn = (button_hal_button_t *)data; - - if(btn->unique_id == CC26XX_WEB_DEMO_MQTT_PUBLISH_TRIGGER) { - if(state == MQTT_CLIENT_STATE_ERROR) { - connect_attempt = 1; - state = MQTT_CLIENT_STATE_REGISTERED; - } - } - } - - if(ev == httpd_simple_event_new_config) { - /* - * Schedule next pass in a while. When HTTPD sends us this event, it is - * also in the process of sending the config page. Wait a little before - * reconnecting, so as to not cause congestion. - */ - etimer_set(&publish_periodic_timer, NEW_CONFIG_WAIT_INTERVAL); - } - - if((ev == PROCESS_EVENT_TIMER && data == &publish_periodic_timer) || - ev == PROCESS_EVENT_POLL || - ev == cc26xx_web_demo_publish_event || - (ev == button_hal_release_event && - ((button_hal_button_t *)data)->unique_id == - CC26XX_WEB_DEMO_MQTT_PUBLISH_TRIGGER)) { - state_machine(); - } - - if(ev == cc26xx_web_demo_load_config_defaults) { - init_config(); - etimer_set(&publish_periodic_timer, NEW_CONFIG_WAIT_INTERVAL); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/mqtt-client.h b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/mqtt-client.h deleted file mode 100644 index 68b26af6d..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/mqtt-client.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * Header file for the CC26xx web demo MQTT client functionality - */ -/*---------------------------------------------------------------------------*/ -#ifndef MQTT_CLIENT_H_ -#define MQTT_CLIENT_H_ -/*---------------------------------------------------------------------------*/ -#define MQTT_CLIENT_CONFIG_ORG_ID_LEN 32 -#define MQTT_CLIENT_CONFIG_TYPE_ID_LEN 32 -#define MQTT_CLIENT_CONFIG_AUTH_TOKEN_LEN 32 -#define MQTT_CLIENT_CONFIG_EVENT_TYPE_ID_LEN 32 -#define MQTT_CLIENT_CONFIG_CMD_TYPE_LEN 8 -#define MQTT_CLIENT_CONFIG_IP_ADDR_STR_LEN 64 -/*---------------------------------------------------------------------------*/ -#define MQTT_CLIENT_PUBLISH_INTERVAL_MAX 86400 /* secs: 1 day */ -#define MQTT_CLIENT_PUBLISH_INTERVAL_MIN 5 /* secs */ -/*---------------------------------------------------------------------------*/ -PROCESS_NAME(mqtt_client_process); -/*---------------------------------------------------------------------------*/ -/** - * \brief Data structure declaration for the MQTT client configuration - */ -typedef struct mqtt_client_config { - char org_id[MQTT_CLIENT_CONFIG_ORG_ID_LEN]; - char type_id[MQTT_CLIENT_CONFIG_TYPE_ID_LEN]; - char auth_token[MQTT_CLIENT_CONFIG_AUTH_TOKEN_LEN]; - char event_type_id[MQTT_CLIENT_CONFIG_EVENT_TYPE_ID_LEN]; - char broker_ip[MQTT_CLIENT_CONFIG_IP_ADDR_STR_LEN]; - char cmd_type[MQTT_CLIENT_CONFIG_CMD_TYPE_LEN]; - clock_time_t pub_interval; - uint16_t broker_port; -} mqtt_client_config_t; -/*---------------------------------------------------------------------------*/ -#endif /* MQTT_CLIENT_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/net-uart.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/net-uart.c deleted file mode 100644 index a2ea899da..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/net-uart.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * A process which receives data over UART and transmits them over UDP - * to a pre-defined IPv6 address and port. It also listens on the same UDP - * port for messages, which it prints out over UART. - * - * For this example to work, you will have to modify the destination IPv6 - * address by adjusting the set_dest_addr() macro below. - * - * To listen on your linux or OS X box: - * nc -6ulkw 1 REMOTE_PORT - * - * (REMOTE_PORT should be the actual value of the define below, e.g. 7777) - * - * Once netcat is up and listening, type something to the CC26xx's terminal - * Bear in mind that the datagram will only be sent after a 0x0a (LF) char - * has been received. Therefore, if you are on Win, do NOT use PuTTY for - * this purpose, since it does not send 0x0a as part of the line end. On - * Win XP use hyperterm. On Win 7 use some other software (e.g. Tera Term, - * which can be configured to send CRLF on enter keystrokes). - * - * To send data in the other direction from your linux or OS X box: - * - * nc -6u \ REMOTE_PORT - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/process.h" -#include "dev/serial-line.h" -#include "dev/cc26xx-uart.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-udp-packet.h" -#include "net/ipv6/uiplib.h" -#include "net-uart.h" -#include "httpd-simple.h" -#include "sys/cc.h" - -#include "ti-lib.h" - -#include -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" -/*---------------------------------------------------------------------------*/ -#define REMOTE_PORT 7777 -#define MAX_MSG_SIZE 100 - -#define set_dest_addr() uip_ip6addr(&remote_addr, \ - 0xBBBB, 0x0000, 0x0000, 0x0000, \ - 0x3E07, 0x54FF, 0xFE74, 0x4885); -/*---------------------------------------------------------------------------*/ -#define ADDRESS_CONVERSION_OK 1 -#define ADDRESS_CONVERSION_ERROR 0 -/*---------------------------------------------------------------------------*/ -static struct uip_udp_conn *udp_conn = NULL; - -static uint8_t buffer[MAX_MSG_SIZE]; -static uint8_t msg_len; -static uip_ip6addr_t remote_addr; -/*---------------------------------------------------------------------------*/ -#define IPV6_ADDR_STR_LEN 64 -/*---------------------------------------------------------------------------*/ -PROCESS(net_uart_process, "Net UART Process"); -/*---------------------------------------------------------------------------*/ -/* - * \brief Attempts to convert a string representation of an IPv6 address to a - * numeric one. - * \param buf The buffer with the string to be converted. - * \return ADDRESS_CONVERSION_OK or ADDRESS_CONVERSION_ERROR - * - * ToDo: Add support for NAT64 conversion in case the incoming address is a v4 - * This is now supported in the current master, so when we pull it in this will - * be very straightforward. - */ -static int -set_new_ip_address(char *buf) -{ - /* - * uiplib_ip6addrconv will immediately start writing into the supplied buffer - * even if it subsequently fails. Thus, pass an intermediate buffer - */ - uip_ip6addr_t tmp_addr; - - int rv = uiplib_ip6addrconv(buf, &tmp_addr); - - if(rv == ADDRESS_CONVERSION_OK) { - /* Conversion OK, copy to our main buffer */ - memcpy(&remote_addr, &tmp_addr, sizeof(remote_addr)); - - PRINTF("Updated remote address "); - PRINT6ADDR(&remote_addr); - PRINTF("\n"); - } - - return rv; -} -/*---------------------------------------------------------------------------*/ -static void -net_input(void) -{ - if(uip_newdata()) { - memset(buffer, 0, MAX_MSG_SIZE); - msg_len = MIN(uip_datalen(), MAX_MSG_SIZE - 1); - - /* Copy data */ - memcpy(buffer, uip_appdata, msg_len); - printf("%s", (char *)buffer); - } - - return; -} -/*---------------------------------------------------------------------------*/ -static void -release_uart(void) -{ - cc26xx_uart_set_input(NULL); -} -/*---------------------------------------------------------------------------*/ -static void -keep_uart_on(void) -{ - cc26xx_uart_set_input(serial_line_input_byte); -} -/*---------------------------------------------------------------------------*/ -static int -remote_port_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv; - - if(key_len != strlen("net_uart_port") || - strncasecmp(key, "net_uart_port", strlen("net_uart_port")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - rv = atoi(val); - - if(rv <= 65535 && rv > 0) { - cc26xx_web_demo_config.net_uart.remote_port = (uint16_t)rv; - } else { - return HTTPD_SIMPLE_POST_HANDLER_ERROR; - } - - return HTTPD_SIMPLE_POST_HANDLER_OK; -} -/*---------------------------------------------------------------------------*/ -static int -remote_ipv6_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv = HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - - if(key_len != strlen("net_uart_ip") || - strncasecmp(key, "net_uart_ip", strlen("net_uart_ip")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - if(val_len > IPV6_ADDR_STR_LEN) { - /* Ours but bad value */ - rv = HTTPD_SIMPLE_POST_HANDLER_ERROR; - } else { - if(set_new_ip_address(val)) { - memset(cc26xx_web_demo_config.net_uart.remote_address, 0, - NET_UART_IP_ADDR_STRLEN); - memcpy(cc26xx_web_demo_config.net_uart.remote_address, val, val_len); - rv = HTTPD_SIMPLE_POST_HANDLER_OK; - } - } - - return rv; -} -/*---------------------------------------------------------------------------*/ -static int -on_off_post_handler(char *key, int key_len, char *val, int val_len) -{ - int rv; - - if(key_len != strlen("net_uart_on") || - strncasecmp(key, "net_uart_on", strlen("net_uart_on")) != 0) { - /* Not ours */ - return HTTPD_SIMPLE_POST_HANDLER_UNKNOWN; - } - - rv = atoi(val); - - /* Be pedantic: only accept 0 and 1, not just any non-zero value */ - if(rv == 0) { - cc26xx_web_demo_config.net_uart.enable = 0; - release_uart(); - } else if(rv == 1) { - cc26xx_web_demo_config.net_uart.enable = 1; - keep_uart_on(); - } else { - return HTTPD_SIMPLE_POST_HANDLER_ERROR; - } - - return HTTPD_SIMPLE_POST_HANDLER_OK; -} -/*---------------------------------------------------------------------------*/ -HTTPD_SIMPLE_POST_HANDLER(remote_port, remote_port_post_handler); -HTTPD_SIMPLE_POST_HANDLER(remote_ipv6, remote_ipv6_post_handler); -HTTPD_SIMPLE_POST_HANDLER(on_off, on_off_post_handler); -/*---------------------------------------------------------------------------*/ -static void -set_config_defaults(void) -{ - /* Set a hard-coded destination address to start with */ - set_dest_addr(); - - /* Set config defaults */ - cc26xx_web_demo_ipaddr_sprintf(cc26xx_web_demo_config.net_uart.remote_address, - NET_UART_IP_ADDR_STRLEN, &remote_addr); - cc26xx_web_demo_config.net_uart.remote_port = REMOTE_PORT; - cc26xx_web_demo_config.net_uart.enable = 1; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(net_uart_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("CC26XX Net UART Process\n"); - - set_config_defaults(); - - udp_conn = udp_new(NULL, UIP_HTONS(0), NULL); - udp_bind(udp_conn, UIP_HTONS(REMOTE_PORT)); - - if(udp_conn == NULL) { - printf("No UDP connection available, exiting the process!\n"); - PROCESS_EXIT(); - } - - httpd_simple_register_post_handler(&remote_port_handler); - httpd_simple_register_post_handler(&remote_ipv6_handler); - httpd_simple_register_post_handler(&on_off_handler); - - while(1) { - - PROCESS_YIELD(); - - if(ev == serial_line_event_message) { - /* - * If the message contains a new IP address, save it and go back to - * waiting. - */ - if(set_new_ip_address((char *)data) == ADDRESS_CONVERSION_ERROR) { - /* Not an IP address in the message. Send to current destination */ - memset(buffer, 0, MAX_MSG_SIZE); - - /* We need to add a line feed, thus never fill the entire buffer */ - msg_len = MIN(strlen(data), MAX_MSG_SIZE - 1); - memcpy(buffer, data, msg_len); - - /* Add a line feed */ - buffer[msg_len] = 0x0A; - msg_len++; - - uip_udp_packet_sendto( - udp_conn, buffer, msg_len, &remote_addr, - UIP_HTONS(cc26xx_web_demo_config.net_uart.remote_port)); - } - } else if(ev == tcpip_event) { - net_input(); - } else if(ev == cc26xx_web_demo_config_loaded_event) { - /* - * New config. Check if it's possible to update the remote address. - * The port will have been updated already - */ - set_new_ip_address(cc26xx_web_demo_config.net_uart.remote_address); - - if(cc26xx_web_demo_config.net_uart.enable == 1) { - keep_uart_on(); - } - } else if(ev == cc26xx_web_demo_load_config_defaults) { - set_config_defaults(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/net-uart.h b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/net-uart.h deleted file mode 100644 index 663e81eaa..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/net-uart.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 NET_UART_H_ -#define NET_UART_H_ -/*---------------------------------------------------------------------------*/ -#include "net/ipv6/uip.h" - -#include -/*---------------------------------------------------------------------------*/ -#define NET_UART_IP_ADDR_STRLEN 64 -/*---------------------------------------------------------------------------*/ -PROCESS_NAME(net_uart_process); -/*---------------------------------------------------------------------------*/ -typedef struct net_uart_config_s { - char remote_address[NET_UART_IP_ADDR_STRLEN]; - uint16_t remote_port; - uint8_t enable; -} net_uart_config_t; -/*---------------------------------------------------------------------------*/ -#endif /* NET_UART_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/project-conf.h b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/project-conf.h deleted file mode 100644 index ee40e1749..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/project-conf.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 26 -#define RF_BLE_CONF_ENABLED 1 -/*---------------------------------------------------------------------------*/ - -/* Enable TCP */ -#define UIP_CONF_TCP 1 - -/* Enable/Disable Components of this Demo */ -#define CC26XX_WEB_DEMO_CONF_MQTT_CLIENT 1 -#define CC26XX_WEB_DEMO_CONF_6LBR_CLIENT ROUTING_CONF_RPL_CLASSIC -#define CC26XX_WEB_DEMO_CONF_COAP_SERVER 1 -#define CC26XX_WEB_DEMO_CONF_NET_UART 1 - -/* - * ADC sensor functionality. To test this, an external voltage source should be - * connected to DIO23 - * Enable/Disable DIO23 ADC reading by setting CC26XX_WEB_DEMO_CONF_ADC_DEMO - */ -#define CC26XX_WEB_DEMO_CONF_ADC_DEMO 0 -/*---------------------------------------------------------------------------*/ -/* - * Change to 1 if you are using an older CC2650 Sensortag (look for Rev: 1.2 - * printed on the PCB, or for a sticker reading "HW Rev 1.2.0"). - * - * This may be the case if you are getting this error: - * "Could not open flash to load config" - * when your sensortag is starting up. - */ -#define SENSORTAG_CC2650_REV_1_2_0 0 -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* - * Shrink the size of the uIP buffer, routing table and ND cache. - * Set the TCP MSS - */ -#define UIP_CONF_BUFFER_SIZE 500 -#define NETSTACK_MAX_ROUTE_ENTRIES 5 -#define NBR_TABLE_CONF_MAX_NEIGHBORS 5 -#define UIP_CONF_TCP_MSS 128 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-ble-advd.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-ble-advd.c deleted file mode 100644 index b32cb82ec..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-ble-advd.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * CoAP resource to start/stop/configure BLE advertisements - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "coap-engine.h" -#include "coap.h" -#include "rf-core/rf-ble.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define BLE_NAME_BUF_LEN 32 -/*---------------------------------------------------------------------------*/ -const char *forbidden_payload = "Name to advertise unspecified.\n" - "Use name= in the request"; -/*---------------------------------------------------------------------------*/ -static void -res_ble_post_put_handler(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - size_t len = 0; - const char *text = NULL; - char name[BLE_NAME_BUF_LEN]; - int success = 0; - int rv; - - memset(name, 0, BLE_NAME_BUF_LEN); - - len = coap_get_post_variable(request, "name", &text); - - if(len > 0 && len < BLE_NAME_BUF_LEN) { - memcpy(name, text, len); - rf_ble_beacond_config(0, name); - success = 1; - } - - len = coap_get_post_variable(request, "interval", &text); - - rv = atoi(text); - - if(rv > 0) { - rf_ble_beacond_config((clock_time_t)(rv * CLOCK_SECOND), NULL); - success = 1; - } - - len = coap_get_post_variable(request, "mode", &text); - - if(len) { - if(strncmp(text, "on", len) == 0) { - if(rf_ble_beacond_start()) { - success = 1; - } else { - coap_set_status_code(response, FORBIDDEN_4_03); - coap_set_payload(response, forbidden_payload, - strlen(forbidden_payload)); - return; - } - } else if(strncmp(text, "off", len) == 0) { - rf_ble_beacond_stop(); - success = 1; - } else { - success = 0; - } - } - - if(!success) { - coap_set_status_code(response, BAD_REQUEST_4_00); - } -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_ble_advd, - "title=\"BLE advd config: POST/PUT name=&mode=on|off" - "&interval=\";rt=\"Control\"", - NULL, - res_ble_post_put_handler, - res_ble_post_put_handler, - NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-device.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-device.c deleted file mode 100644 index bc61b8510..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-device.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * CoAP resource handler for CC26XX software and hardware version - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "coap-engine.h" -#include "coap.h" -#include "sys/clock.h" -#include "coap-server.h" -#include "cc26x0-web-demo.h" - -#include "ti-lib.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -static uint16_t -detect_chip(void) -{ - if(ti_lib_chipinfo_chip_family_is_cc26xx()) { - if(ti_lib_chipinfo_supports_ieee_802_15_4() == true) { - if(ti_lib_chipinfo_supports_ble() == true) { - return 2650; - } else { - return 2630; - } - } else { - return 2640; - } - } else if(ti_lib_chipinfo_chip_family_is_cc13xx()) { - if(ti_lib_chipinfo_supports_ble() == false && - ti_lib_chipinfo_supports_ieee_802_15_4() == false) { - return 1310; - } else if(ti_lib_chipinfo_supports_ble() == true && - ti_lib_chipinfo_supports_ieee_802_15_4() == true) { - return 1350; - } - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_hw(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - uint16_t chip = detect_chip(); - - coap_get_header_accept(request, &accept); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "%s on CC%u", BOARD_STRING, - chip); - - coap_set_payload(response, (uint8_t *)buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "{\"HW Ver\":\"%s on CC%u\"}", - BOARD_STRING, chip); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_XML) { - coap_set_header_content_format(response, APPLICATION_XML); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, - "", BOARD_STRING, - chip); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - coap_set_payload(response, coap_server_supported_msg, - strlen(coap_server_supported_msg)); - } -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_sw(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - - coap_get_header_accept(request, &accept); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "%s", CONTIKI_VERSION_STRING); - - coap_set_payload(response, (uint8_t *)buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "{\"SW Ver\":\"%s\"}", - CONTIKI_VERSION_STRING); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_XML) { - coap_set_header_content_format(response, APPLICATION_XML); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, - "", CONTIKI_VERSION_STRING); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - coap_set_payload(response, coap_server_supported_msg, - strlen(coap_server_supported_msg)); - } -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_uptime(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - - coap_get_header_accept(request, &accept); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "%lu", clock_seconds()); - - coap_set_payload(response, (uint8_t *)buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "{\"uptime\":%lu}", - clock_seconds()); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_XML) { - coap_set_header_content_format(response, APPLICATION_XML); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, - "", clock_seconds()); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - coap_set_payload(response, coap_server_supported_msg, - strlen(coap_server_supported_msg)); - } -} -/*---------------------------------------------------------------------------*/ -static void -res_post_handler_cfg_reset(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - cc26xx_web_demo_restore_defaults(); -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_device_sw, - "title=\"Software version\";rt=\"text\"", - res_get_handler_sw, - NULL, - NULL, - NULL); -/*---------------------------------------------------------------------------*/ -RESOURCE(res_device_uptime, - "title=\"Uptime\";rt=\"seconds\"", - res_get_handler_uptime, - NULL, - NULL, - NULL); -/*---------------------------------------------------------------------------*/ -RESOURCE(res_device_hw, - "title=\"Hardware version\";rt=\"text\"", - res_get_handler_hw, - NULL, - NULL, - NULL); -/*---------------------------------------------------------------------------*/ -RESOURCE(res_device_cfg_reset, - "title=\"Reset Device Config: POST\";rt=\"Control\"", - NULL, res_post_handler_cfg_reset, NULL, NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-leds.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-leds.c deleted file mode 100644 index 538ecc0bd..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-leds.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * CoAP resource handler for the CC26xx LEDs. Slightly modified copy of - * the one found in Contiki's original CoAP example. - * \author - * Matthias Kovatsch (original) - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "coap-engine.h" -#include "dev/leds.h" - -#include -/*---------------------------------------------------------------------------*/ -static void -res_post_put_handler(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - size_t len = 0; - const char *color = NULL; - const char *mode = NULL; - uint8_t led = 0; - int success = 1; - - if((len = coap_get_query_variable(request, "color", &color))) { - if(strncmp(color, "r", len) == 0) { - led = LEDS_RED; - } else if(strncmp(color, "g", len) == 0) { - led = LEDS_GREEN; -#if BOARD_SMARTRF06EB - } else if(strncmp(color, "y", len) == 0) { - led = LEDS_YELLOW; - } else if(strncmp(color, "o", len) == 0) { - led = LEDS_ORANGE; -#endif - } else { - success = 0; - } - } else { - success = 0; - } - - if(success && (len = coap_get_post_variable(request, "mode", &mode))) { - if(strncmp(mode, "on", len) == 0) { - leds_on(led); - } else if(strncmp(mode, "off", len) == 0) { - leds_off(led); - } else { - success = 0; - } - } else { - success = 0; - } - - if(!success) { - coap_set_status_code(response, BAD_REQUEST_4_00); - } -} -/*---------------------------------------------------------------------------*/ -/* - * A simple actuator example, depending on the color query parameter and post - * variable mode, corresponding led is activated or deactivated - */ -#if BOARD_SENSORTAG || BOARD_LAUNCHPAD -#define RESOURCE_PARAMS "r|g" -#elif BOARD_SMARTRF06EB -#define RESOURCE_PARAMS "r|g|y|o" -#endif - -RESOURCE(res_leds, - "title=\"LEDs: ?color=" RESOURCE_PARAMS ", POST/PUT mode=on|off\";rt=\"Control\"", - NULL, - res_post_put_handler, - res_post_put_handler, - NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-net.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-net.c deleted file mode 100644 index 43a4da354..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-net.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * CoAP resource handler for network-related resources - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "coap-engine.h" -#include "coap.h" -#include "net/ipv6/uip-ds6.h" -#include "coap-server.h" -#include "cc26x0-web-demo.h" - -#include "ti-lib.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -extern int def_rt_rssi; -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_parent_rssi(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - - coap_get_header_accept(request, &accept); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "%d", def_rt_rssi); - - coap_set_payload(response, (uint8_t *)buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "{\"Parent RSSI\":\"%d\"}", - def_rt_rssi); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_XML) { - coap_set_header_content_format(response, APPLICATION_XML); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, - "", def_rt_rssi); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - coap_set_payload(response, coap_server_supported_msg, - strlen(coap_server_supported_msg)); - } -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_pref_parent(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - char def_rt_str[64]; - - coap_get_header_accept(request, &accept); - - memset(def_rt_str, 0, sizeof(def_rt_str)); - cc26xx_web_demo_ipaddr_sprintf(def_rt_str, sizeof(def_rt_str), - uip_ds6_defrt_choose()); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "%s", def_rt_str); - - coap_set_payload(response, (uint8_t *)buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "{\"Parent\":\"%s\"}", - def_rt_str); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_XML) { - coap_set_header_content_format(response, APPLICATION_XML); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, - "", def_rt_str); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - coap_set_payload(response, coap_server_supported_msg, - strlen(coap_server_supported_msg)); - } -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_parent_rssi, "title=\"Parent RSSI\";rt=\"dBm\"", - res_get_handler_parent_rssi, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -RESOURCE(res_parent_ip, "title=\"Preferred Parent\";rt=\"IPv6 address\"", - res_get_handler_pref_parent, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-sensors.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-sensors.c deleted file mode 100644 index 1852f7cb6..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-sensors.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * CoAP resource handler for the Sensortag-CC26xx sensors - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "coap-engine.h" -#include "coap.h" -#include "cc26x0-web-demo.h" -#include "coap-server.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* - * Generic resource handler for any sensor in this example. Ultimately gets - * called by all handlers and populates the CoAP response - */ -static void -res_get_handler_all(int sens_type, coap_message_t *request, - coap_message_t *response, - uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - const cc26xx_web_demo_sensor_reading_t *reading; - - reading = cc26xx_web_demo_sensor_lookup(sens_type); - - if(reading == NULL) { - coap_set_status_code(response, NOT_FOUND_4_04); - coap_set_payload(response, coap_server_not_found_msg, - strlen(coap_server_not_found_msg)); - return; - } - - coap_get_header_accept(request, &accept); - - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "%s", reading->converted); - - coap_set_payload(response, (uint8_t *)buffer, - strlen((char *)buffer)); - } else if(accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "{\"%s\":%s}", - reading->descr, reading->converted); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else if(accept == APPLICATION_XML) { - coap_set_header_content_format(response, APPLICATION_XML); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, - "<%s val=\"%s\" unit=\"%s\"/>", reading->xml_element, - reading->converted, reading->units); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - coap_set_payload(response, coap_server_supported_msg, - strlen(coap_server_supported_msg)); - } -} -/*---------------------------------------------------------------------------*/ -/* BatMon resources and handler: Temperature, Voltage */ -static void -res_get_handler_batmon_temp(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_BATMON_TEMP, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_batmon_volt(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_BATMON_VOLT, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_batmon_temp, "title=\"Battery Temp\";rt=\"C\"", - res_get_handler_batmon_temp, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -RESOURCE(res_batmon_volt, "title=\"Battery Voltage\";rt=\"mV\"", - res_get_handler_batmon_volt, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -#if CC26XX_WEB_DEMO_ADC_DEMO -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_adc_dio23(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_ADC_DIO23, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_adc_dio23, "title=\"ADC DIO23\";rt=\"mV\"", - res_get_handler_adc_dio23, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -#endif -/*---------------------------------------------------------------------------*/ -#if BOARD_SENSORTAG -/*---------------------------------------------------------------------------*/ -/* MPU resources and handler: Accelerometer and Gyro */ -static void -res_get_handler_mpu_acc_x(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_MPU_ACC_X, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_mpu_acc_y(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_MPU_ACC_Y, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_mpu_acc_z(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_MPU_ACC_Z, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_mpu_gyro_x(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_MPU_GYRO_X, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_mpu_gyro_y(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_MPU_GYRO_Y, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_mpu_gyro_z(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_MPU_GYRO_Z, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_mpu_acc_x, "title=\"Acc X\";rt=\"G\"", res_get_handler_mpu_acc_x, - NULL, NULL, NULL); -RESOURCE(res_mpu_acc_y, "title=\"Acc Y\";rt=\"G\"", res_get_handler_mpu_acc_y, - NULL, NULL, NULL); -RESOURCE(res_mpu_acc_z, "title=\"Acc Z\";rt=\"G\"", res_get_handler_mpu_acc_z, - NULL, NULL, NULL); - -RESOURCE(res_mpu_gyro_x, "title=\"Gyro X\";rt=\"deg/sec\"", - res_get_handler_mpu_gyro_x, NULL, NULL, NULL); -RESOURCE(res_mpu_gyro_y, "title=\"Gyro Y\";rt=\"deg/sec\"", - res_get_handler_mpu_gyro_y, NULL, NULL, NULL); -RESOURCE(res_mpu_gyro_z, "title=\"Gyro Z\";rt=\"deg/sec\"", - res_get_handler_mpu_gyro_z, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -/* TMP sensor resources and handlers: Object, Ambient */ -static void -res_get_handler_obj_temp(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_TMP_OBJECT, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_amb_temp(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_TMP_AMBIENT, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_tmp007_obj, "title=\"Temperature (Object)\";rt=\"C\"", - res_get_handler_obj_temp, NULL, NULL, NULL); - -RESOURCE(res_tmp007_amb, "title=\"Temperature (Ambient)\";rt=\"C\"", - res_get_handler_amb_temp, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -/* BMP sensor resources: Temperature, Pressure */ -static void -res_get_handler_bmp_temp(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_BMP_TEMP, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_bmp_press(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_BMP_PRES, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_bmp280_temp, "title=\"Barometer (Temperature)\";rt=\"C\"", - res_get_handler_bmp_temp, NULL, NULL, NULL); - -RESOURCE(res_bmp280_press, - "title=\"Barometer (Pressure)\";rt=\"hPa (hectopascal / millibar)\"", - res_get_handler_bmp_press, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -/* HDC1000 sensor resources and handler: Temperature, Pressure */ -static void -res_get_handler_hdc_temp(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_HDC_TEMP, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -static void -res_get_handler_hdc_humidity(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_HDC_HUMIDITY, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_hdc1000_temp, "title=\"Temperature\";rt=\"C\"", - res_get_handler_hdc_temp, NULL, NULL, NULL); - -RESOURCE(res_hdc1000_hum, "title=\"Humidity\";rt=\"%RH\"", - res_get_handler_hdc_humidity, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -/* Illuminance resources and handler */ -static void -res_get_handler_opt(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - res_get_handler_all(CC26XX_WEB_DEMO_SENSOR_OPT_LIGHT, request, response, - buffer, preferred_size, offset); -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_opt3001_light, "title=\"Illuminance\";rt=\"Lux\"", - res_get_handler_opt, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -#endif /* BOARD_SENSORTAG */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-toggle-leds.c b/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-toggle-leds.c deleted file mode 100644 index 00e632cef..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/cc26x0-web-demo/resources/res-toggle-leds.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc26x0-web-demo - * @{ - * - * \file - * CoAP resource to toggle LEDs. Slightly modified copy of the one found - * in Contiki's original CoAP example. - * \author - * Matthias Kovatsch (original) - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "coap-engine.h" -#include "dev/leds.h" - -#include -/*---------------------------------------------------------------------------*/ -static void -res_post_handler_red(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - leds_toggle(LEDS_RED); -} -/*---------------------------------------------------------------------------*/ -static void -res_post_handler_green(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - leds_toggle(LEDS_GREEN); -} -/*---------------------------------------------------------------------------*/ -/* Toggles the red led */ -RESOURCE(res_toggle_red, - "title=\"Red LED\";rt=\"Control\"", - NULL, - res_post_handler_red, - NULL, - NULL); - -/* Toggles the green led */ -RESOURCE(res_toggle_green, - "title=\"Green LED\";rt=\"Control\"", - NULL, - res_post_handler_green, - NULL, - NULL); -/*---------------------------------------------------------------------------*/ -/* An additional 2 LEDs on the Srf */ -#if BOARD_SMARTRF06EB -/*---------------------------------------------------------------------------*/ -static void -res_post_handler_yellow(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - leds_toggle(LEDS_YELLOW); -} -/*---------------------------------------------------------------------------*/ -static void -res_post_handler_orange(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset) -{ - leds_toggle(LEDS_ORANGE); -} -/*---------------------------------------------------------------------------*/ -/* Toggles the yellow led */ -RESOURCE(res_toggle_yellow, - "title=\"Yellow LED\";rt=\"Control\"", - NULL, - res_post_handler_yellow, - NULL, - NULL); - -/* Toggles the orange led */ -RESOURCE(res_toggle_orange, - "title=\"Orange LED\";rt=\"Control\"", - NULL, - res_post_handler_orange, - NULL, - NULL); -#endif -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/examples/platform-specific/cc26x0-cc13x0/project-conf.h b/examples/platform-specific/cc26x0-cc13x0/project-conf.h deleted file mode 100644 index 3cbc0da86..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/project-conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 25 -#define RF_BLE_CONF_ENABLED 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/Makefile b/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/Makefile deleted file mode 100644 index d62dff3e3..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -CONTIKI_PROJECT = very-sleepy-demo - -PLATFORMS_ONLY = cc26x0-cc13x0 - -all: $(CONTIKI_PROJECT) - -MODULES += os/net/app-layer/coap - -CONTIKI = ../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/Makefile.target b/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/Makefile.target deleted file mode 100644 index bd54a4fc7..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = cc26x0-cc13x0 diff --git a/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/README.md b/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/README.md deleted file mode 100644 index 851150432..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# CC13xx/CC26xx Very Sleepy Demo - -This example demonstrates a way of deploying a very low-consuming, very sleepy -node. The node has two modes of operation: - -* Normal: ContikiMAC duty-cycles the radio as usual. The node is reachable. -* Very Sleepy: Radio cycling mostly off, except when we need to perform network - maintenance tasks. In this mode, the node is unreachable for most of the time. - -The node will operate in RPL leaf mode. This means that it will be reachable -downwards, but it will not advertise the DODAG and it will not participate in -routing. - -After booting, the node will enter "normal" mode. - -The node exposes an OBSERVEable CoAP resource. It will notify subscribers with -a new value for this resource every `interval` seconds. It will then stay in -normal mode for `duration` seconds. During this time window, it will be -reachable over the network in order to e.g. receive a new configuration. -When this time window expires, the node will switch back to very sleepy mode. -This will only happen if very sleepy mode has been enabled by setting `mode=1` -as per the instructions below. - -When the node is duty-cycling the radio, either because it is in normal mode or -because network maintenance is taking place, it will keep its green LED on thus -providing an indication that it is reachable (red LED for the CC1350 tag). - -A normal mode stint can be manually triggered by pressing the left button. - -## Requirements - -To run this example you will need: - -* A border router operating with the same RDC, same channel, same radio mode - (e.g. IEEE or sub-ghz), same PAN ID. Alternatively, you can - use [6lbr](https://github.com/cetic/6lbr) with a suitable slip-radio. -* The [Copper (Cu)](https://addons.mozilla.org/en-US/firefox/addon/copper-270430/) - addon for Firefox - -## Configuration - -To configure the node, send a CoAP POST message to the `very_sleepy_config` -resource. The POST message's payload must specify _at least one_ of: - -* `mode=0|1`: Send `mode=1` to enable very sleepy mode, `mode=0` to disable it. -* `interval=n` where `n` is the number of seconds between two consecutive normal - mode periods. This interval also dictates the OBSERVEr notification period. -* `duration=n` where `n` is the number of seconds that the node will stay in - normal mode before dropping to very sleepy mode. This value is only relevant - if `mode==1`. - -A POST request must contain at least one of the above, but they are otherwise -all optional. So, for example, a POST may simply specify `interval=n`. To send -multiple values, delimit them with `&`. So you can send something like -`mode=1&interval=60&duration=20` - -The current running configuration can be retrieved by sending a GET request to -the same CoAP resource. - -## Running the example - -* Deploy your border router or 6lbr -* Turn on the very sleepy node. -* Fire up the Copper addon -* Select `.well-known/core` and hit `GET` -* Configure very sleepy operation: - * Select the `very_sleepy_config` resource - * In the `Outgoing` pane, type your POST payload as per the instructions - above. For example, you can type: `mode=1&interval=30&duration=10` - * Hit `POST` -* Select the `sen/readings` resource and hit `OBSERVE` - -## Caveats - -If you click on a resource in the Copper resources tree while you are observing -a different resource, the OBSERVEr for the latter will be stopped without -notifying the CoAP server. This will result in the server sending out OBSERVE -notifications that will be responded to with port unreachable ICMPv6 messages. -This will continue for quite a while, until the server detects that the -OBSERVEr has been lost (a test currently performed once every 20 notifications). -In order to prevent this from happening, hit the "Cancel" button for the -OBSERVE before switching views to a different resource. This will unregister -the observer. - -In very sleepy mode, the radio is not truly always off. The contiki core needs -to perform other periodic tasks in order to maintain network connectivity. For -that reason, this example will allow the radio to turn on periodically even -while in very sleepy mode. Thus, you may see that the node becomes briefly -reachable every now and then. However, do not count on those periods of -reachability to perform any tasks, as they will be brief and will be disrupted -without warning. diff --git a/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/project-conf.h b/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/project-conf.h deleted file mode 100644 index 0f8467a68..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/project-conf.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 25 -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* For very sleepy operation */ -#define RF_BLE_CONF_ENABLED 0 -#define UIP_DS6_CONF_PERIOD CLOCK_SECOND -#define UIP_CONF_TCP 0 -#define RPL_CONF_LEAF_ONLY 1 - -/* - * We'll fail without RPL probing, so turn it on explicitly even though it's - * on by default - */ -#define RPL_CONF_WITH_PROBING 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/very-sleepy-demo.c b/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/very-sleepy-demo.c deleted file mode 100644 index ebd55712b..000000000 --- a/examples/platform-specific/cc26x0-cc13x0/very-sleepy-demo/very-sleepy-demo.c +++ /dev/null @@ -1,424 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 "contiki.h" -#include "sys/etimer.h" -#include "sys/stimer.h" -#include "sys/process.h" -#include "dev/leds.h" -#include "dev/watchdog.h" -#include "dev/button-hal.h" -#include "batmon-sensor.h" -#include "board-peripherals.h" -#include "net/netstack.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/routing/routing.h" -#include "coap-engine.h" -#include "coap.h" - -#include "ti-lib.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Normal mode duration params in seconds */ -#define NORMAL_OP_DURATION_DEFAULT 10 -#define NORMAL_OP_DURATION_MIN 10 -#define NORMAL_OP_DURATION_MAX 60 -/*---------------------------------------------------------------------------*/ -/* Observer notification period params in seconds */ -#define PERIODIC_INTERVAL_DEFAULT 30 -#define PERIODIC_INTERVAL_MIN 30 -#define PERIODIC_INTERVAL_MAX 86400 /* 1 day */ -/*---------------------------------------------------------------------------*/ -#define VERY_SLEEPY_MODE_OFF 0 -#define VERY_SLEEPY_MODE_ON 1 -/*---------------------------------------------------------------------------*/ -#define BUTTON_TRIGGER BOARD_BUTTON_HAL_INDEX_KEY_LEFT -/*---------------------------------------------------------------------------*/ -#define MAC_CAN_BE_TURNED_OFF 0 -#define MAC_MUST_STAY_ON 1 - -#define KEEP_MAC_ON_MIN_PERIOD 10 /* secs */ -/*---------------------------------------------------------------------------*/ -#define PERIODIC_INTERVAL CLOCK_SECOND -/*---------------------------------------------------------------------------*/ -#define POST_STATUS_BAD 0x80 -#define POST_STATUS_HAS_MODE 0x40 -#define POST_STATUS_HAS_DURATION 0x20 -#define POST_STATUS_HAS_INTERVAL 0x10 -#define POST_STATUS_NONE 0x00 -/*---------------------------------------------------------------------------*/ -typedef struct sleepy_config_s { - unsigned long interval; - unsigned long duration; - uint8_t mode; -} sleepy_config_t; - -sleepy_config_t config; -/*---------------------------------------------------------------------------*/ -#define STATE_NORMAL 0 -#define STATE_NOTIFY_OBSERVERS 1 -#define STATE_VERY_SLEEPY 2 -/*---------------------------------------------------------------------------*/ -static struct stimer st_duration; -static struct stimer st_interval; -static struct stimer st_min_mac_on_duration; -static struct etimer et_periodic; -static process_event_t event_new_config; -static uint8_t state; -/*---------------------------------------------------------------------------*/ -const char *not_supported_msg = "Supported:text/plain,application/json"; -/*---------------------------------------------------------------------------*/ -PROCESS(very_sleepy_demo_process, "CC13xx/CC26xx very sleepy process"); -AUTOSTART_PROCESSES(&very_sleepy_demo_process); -/*---------------------------------------------------------------------------*/ -static void -readings_get_handler(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - int temp; - int voltage; - - if(request != NULL) { - coap_get_header_accept(request, &accept); - } - - temp = batmon_sensor.value(BATMON_SENSOR_TYPE_TEMP); - - voltage = batmon_sensor.value(BATMON_SENSOR_TYPE_VOLT); - - if(accept == -1 || accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, - "{\"temp\":{\"v\":%d,\"u\":\"C\"}," - "\"voltage\":{\"v\":%d,\"u\":\"mV\"}}", - temp, (voltage * 125) >> 5); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else if(accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, "Temp=%dC, Voltage=%dmV", - temp, (voltage * 125) >> 5); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - coap_set_payload(response, not_supported_msg, - strlen(not_supported_msg)); - } -} -/*---------------------------------------------------------------------------*/ -RESOURCE(readings_resource, "title=\"Sensor Readings\";obs", - readings_get_handler, NULL, NULL, NULL); -/*---------------------------------------------------------------------------*/ -static void -conf_get_handler(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - - if(request != NULL) { - coap_get_header_accept(request, &accept); - } - - if(accept == -1 || accept == APPLICATION_JSON) { - coap_set_header_content_format(response, APPLICATION_JSON); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, - "{\"config\":{\"mode\":%u,\"duration\":%lu,\"interval\":%lu}}", - config.mode, config.duration, config.interval); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else if(accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, - "Mode=%u, Duration=%lusecs, Interval=%lusecs", - config.mode, config.duration, config.interval); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - } else { - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - coap_set_payload(response, not_supported_msg, - strlen(not_supported_msg)); - } -} -/*---------------------------------------------------------------------------*/ -static void -conf_post_handler(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const char *ptr = NULL; - char tmp_buf[16]; - unsigned long interval = 0; - unsigned long duration = 0; - uint8_t mode = VERY_SLEEPY_MODE_OFF; - uint8_t post_status = POST_STATUS_NONE; - int rv; - - rv = coap_get_post_variable(request, "mode", &ptr); - if(rv && rv < 16) { - memset(tmp_buf, 0, sizeof(tmp_buf)); - memcpy(tmp_buf, ptr, rv); - rv = atoi(tmp_buf); - - if(rv == 1) { - mode = VERY_SLEEPY_MODE_ON; - post_status |= POST_STATUS_HAS_MODE; - } else if(rv == 0) { - mode = VERY_SLEEPY_MODE_OFF; - post_status |= POST_STATUS_HAS_MODE; - } else { - post_status = POST_STATUS_BAD; - } - } - - rv = coap_get_post_variable(request, "duration", &ptr); - if(rv && rv < 16) { - memset(tmp_buf, 0, sizeof(tmp_buf)); - memcpy(tmp_buf, ptr, rv); - rv = atoi(tmp_buf); - - duration = (unsigned long)rv; - if(duration < NORMAL_OP_DURATION_MIN || duration > NORMAL_OP_DURATION_MAX) { - post_status = POST_STATUS_BAD; - } else { - post_status |= POST_STATUS_HAS_DURATION; - } - } - - rv = coap_get_post_variable(request, "interval", &ptr); - if(rv && rv < 16) { - memset(tmp_buf, 0, sizeof(tmp_buf)); - memcpy(tmp_buf, ptr, rv); - rv = atoi(tmp_buf); - interval = (unsigned long)rv; - if(interval < PERIODIC_INTERVAL_MIN || interval > PERIODIC_INTERVAL_MAX) { - post_status = POST_STATUS_BAD; - } else { - post_status |= POST_STATUS_HAS_INTERVAL; - } - } - - if((post_status & POST_STATUS_BAD) == POST_STATUS_BAD || - post_status == POST_STATUS_NONE) { - coap_set_status_code(response, BAD_REQUEST_4_00); - snprintf((char *)buffer, COAP_MAX_CHUNK_SIZE, - "mode=0|1&duration=[%u,%u]&interval=[%u,%u]", - NORMAL_OP_DURATION_MIN, NORMAL_OP_DURATION_MAX, - PERIODIC_INTERVAL_MIN, PERIODIC_INTERVAL_MAX); - - coap_set_payload(response, buffer, strlen((char *)buffer)); - return; - } - - /* Values are sane. Update the config and notify the process */ - if(post_status & POST_STATUS_HAS_MODE) { - config.mode = mode; - } - - if(post_status & POST_STATUS_HAS_INTERVAL) { - config.interval = interval; - } - - if(post_status & POST_STATUS_HAS_DURATION) { - config.duration = duration; - } - - process_post(&very_sleepy_demo_process, event_new_config, NULL); -} -/*---------------------------------------------------------------------------*/ -RESOURCE(very_sleepy_conf, - "title=\"Very sleepy conf: " - "GET|POST mode=0|1&interval=&duration=\";rt=\"Control\"", - conf_get_handler, conf_post_handler, NULL, NULL); -/*---------------------------------------------------------------------------*/ -/* - * If our preferred parent is not NBR_REACHABLE in the ND cache, NUD will send - * a unicast NS and wait for NA. If NA fails then the neighbour will be removed - * from the ND cache and the default route will be deleted. To prevent this, - * keep the MAC on until the parent becomes NBR_REACHABLE. We also keep the MAC - * on if we are about to do RPL probing. - * - * In all cases, the radio will be locked on for KEEP_MAC_ON_MIN_PERIOD secs - */ -static uint8_t -keep_mac_on(void) -{ - uip_ds6_nbr_t *nbr; - uint8_t rv = MAC_CAN_BE_TURNED_OFF; - - if(!stimer_expired(&st_min_mac_on_duration)) { - return MAC_MUST_STAY_ON; - } - -#if RPL_WITH_PROBING - /* Determine if we are about to send a RPL probe */ - if(CLOCK_LT(etimer_expiration_time( - &rpl_get_default_instance()->dag.probing_timer.etimer), - (clock_time() + PERIODIC_INTERVAL))) { - rv = MAC_MUST_STAY_ON; - } -#endif - - /* It's OK to pass a NULL pointer, the callee checks and returns NULL */ - nbr = uip_ds6_nbr_lookup(uip_ds6_defrt_choose()); - - if(nbr == NULL) { - /* We don't have a default route, or it's not reachable (NUD likely). */ - rv = MAC_MUST_STAY_ON; - } else { - if(nbr->state != NBR_REACHABLE) { - rv = MAC_MUST_STAY_ON; - } - } - - if(rv == MAC_MUST_STAY_ON && stimer_expired(&st_min_mac_on_duration)) { - stimer_set(&st_min_mac_on_duration, KEEP_MAC_ON_MIN_PERIOD); - } - - return rv; -} -/*---------------------------------------------------------------------------*/ -static void -switch_to_normal(void) -{ - state = STATE_NOTIFY_OBSERVERS; - - /* - * Stay in normal mode for 'duration' secs. - * Transition back to normal in 'interval' secs, _including_ 'duration' - */ - stimer_set(&st_duration, config.duration); - stimer_set(&st_interval, config.interval); -} -/*---------------------------------------------------------------------------*/ -static void -switch_to_very_sleepy(void) -{ - state = STATE_VERY_SLEEPY; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(very_sleepy_demo_process, ev, data) -{ - uint8_t mac_keep_on; - - PROCESS_BEGIN(); - - SENSORS_ACTIVATE(batmon_sensor); - - config.mode = VERY_SLEEPY_MODE_OFF; - config.interval = PERIODIC_INTERVAL_DEFAULT; - config.duration = NORMAL_OP_DURATION_DEFAULT; - - state = STATE_NORMAL; - - event_new_config = process_alloc_event(); - - readings_resource.flags += IS_OBSERVABLE; - coap_activate_resource(&readings_resource, "sen/readings"); - coap_activate_resource(&very_sleepy_conf, "very_sleepy_config"); - - printf("Very Sleepy Demo Process\n"); - - switch_to_normal(); - - etimer_set(&et_periodic, PERIODIC_INTERVAL); - - while(1) { - - PROCESS_YIELD(); - - if(ev == button_hal_release_event && - ((button_hal_button_t *)data)->unique_id == BUTTON_TRIGGER) { - switch_to_normal(); - } - - if(ev == event_new_config) { - stimer_set(&st_interval, config.interval); - stimer_set(&st_duration, config.duration); - } - - if((ev == PROCESS_EVENT_TIMER && data == &et_periodic) || - (ev == button_hal_release_event && - ((button_hal_button_t *)data)->unique_id == BUTTON_TRIGGER) || - (ev == event_new_config)) { - - /* - * Determine if the stack is about to do essential network maintenance - * and, if so, keep the MAC layer on - */ - mac_keep_on = keep_mac_on(); - - if(mac_keep_on == MAC_MUST_STAY_ON || state != STATE_VERY_SLEEPY) { - leds_on(LEDS_GREEN); - NETSTACK_MAC.on(); - } - - /* - * Next, switch between normal and very sleepy mode depending on config, - * send notifications to observers as required. - */ - if(state == STATE_NOTIFY_OBSERVERS) { - coap_notify_observers(&readings_resource); - state = STATE_NORMAL; - } - - if(state == STATE_NORMAL) { - if(stimer_expired(&st_duration)) { - stimer_set(&st_duration, config.duration); - if(config.mode == VERY_SLEEPY_MODE_ON) { - switch_to_very_sleepy(); - } - } - } else if(state == STATE_VERY_SLEEPY) { - if(stimer_expired(&st_interval)) { - switch_to_normal(); - } - } - - if(mac_keep_on == MAC_CAN_BE_TURNED_OFF && state == STATE_VERY_SLEEPY) { - leds_off(LEDS_GREEN); - NETSTACK_MAC.off(); - } else { - leds_on(LEDS_GREEN); - NETSTACK_MAC.on(); - } - - /* Schedule next pass */ - etimer_set(&et_periodic, PERIODIC_INTERVAL); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/platform-specific/jn516x/README.md b/examples/platform-specific/jn516x/README.md deleted file mode 100644 index 0a7c6bb9e..000000000 --- a/examples/platform-specific/jn516x/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Examples for the JN516x platform. -* dr1175: simple Contiki application for the DR1175 evaluation board. Prints out sensor values periodically. -* rime: simple Rime example. Works with ContikiMAC (default) or NullRDC -* RPL: RPL examples, including border router, simple node, and coap resources. More information under rpl/README.md -* tsch: Examples of applications using TSCH \ No newline at end of file diff --git a/examples/platform-specific/jn516x/dr1175-sensors/Makefile b/examples/platform-specific/jn516x/dr1175-sensors/Makefile deleted file mode 100644 index 23b1c50d7..000000000 --- a/examples/platform-specific/jn516x/dr1175-sensors/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -CONTIKI=../../../.. -CONTIKI_PROJECT = node - -PLATFORMS_ONLY = jn516x - -TARGET ?= jn516x -JN516x_WITH_DR1175 = 1 - -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/jn516x/dr1175-sensors/README.md b/examples/platform-specific/jn516x/dr1175-sensors/README.md deleted file mode 100644 index 0b49024c2..000000000 --- a/examples/platform-specific/jn516x/dr1175-sensors/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Sensor test for DR1175 evaluation board (light + temp/humidity). -Reads and prints out various sensor samples every second. diff --git a/examples/platform-specific/jn516x/dr1175-sensors/node.c b/examples/platform-specific/jn516x/dr1175-sensors/node.c deleted file mode 100644 index e30bfea3d..000000000 --- a/examples/platform-specific/jn516x/dr1175-sensors/node.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \author Atis Elsts - * \file - * Sensor test for DR1175 evaluation board (light + temp/humidity). - */ - -#include "contiki.h" - -#include "light-sensor.h" -#include "ht-sensor.h" -#include "leds.h" -#include "leds-extension.h" - -/*---------------------------------------------------------------------------*/ -PROCESS(test_process, "Sensor test process"); -AUTOSTART_PROCESSES(&test_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_process, ev, data) -{ - static struct etimer et; - static uint8_t led_status; - uint8_t r, g, b; - int val; - - PROCESS_BEGIN(); - - puts("initializing sensors..."); - - /* Make sensor active for measuring */ - SENSORS_ACTIVATE(light_sensor); - SENSORS_ACTIVATE(ht_sensor); - - /* Set level for LEDSs */ - leds_set_level(255, LEDS_RED | LEDS_GREEN | LEDS_BLUE | LEDS_WHITE); - - while(1) { - etimer_set(&et, CLOCK_SECOND * 1); - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - puts("reading sensors..."); - - val = ht_sensor.value(HT_SENSOR_HUM); - printf("humidity: %d\n", val); - - val = ht_sensor.value(HT_SENSOR_TEMP); - printf("temperature: %d\n", val); - - led_status++; - r = ((led_status & 0x1) ? LEDS_RED : 0); - g = ((led_status & 0x2) ? LEDS_GREEN : 0); - b = ((led_status & 0x4) ? LEDS_BLUE : 0); - - leds_toggle((leds_get() ^ (r | g | b)) | LEDS_WHITE); - - puts(""); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/platform-specific/jn516x/rpl/README.md b/examples/platform-specific/jn516x/rpl/README.md deleted file mode 100644 index fb8cd49b4..000000000 --- a/examples/platform-specific/jn516x/rpl/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# HOWTO - Setting up the RPL Border router and other nodes - -In this folder we have a fully functional demonstrator with the components: - -1. **RPL border router**: to start the wireless network and connect it to other networks. -2. and a **wireless node** that acts as a basic RPL node by default (but can optionally be used configured as DAG Root) - -## RICH RPL Border Router - -Setup the UART flow-control mode for the router from border-router/project-conf.h - -* Enable either **HW flow control** -```C -#define UART_HW_FLOW_CTRL 1 -#define UART_XONXOFF_FLOW_CTRL 0 -``` -* or **SW flow control** -```C -#define UART_HW_FLOW_CTRL 0 -#define UART_XONXOFF_FLOW_CTRL 1 -``` -* You can disable both, but it is not recommended. - -Compile and flash a node with the rpl-border-router.jn516x.bin image. Either a USB dongle or a dev-board would work. - -From a Linux terminal, go to `contiki/examples/jn516x/rpl/border-router` and do either -`make connect-router-hw` if you have **HW flow control** -or `make connect-router-sw` if you have **SW flow control** - -This will start a tunnel interface (tun0) on the host machine. -All traffic towards our network (prefix fd00::1/64) will now be routed to the border router. - -## RPL Node - -The directory contiki-private/examples/jn516x/rpl/node contains a basic RICH node running TSCH and RPL. -You can compile and program more NXP nodes to run this, forming a larger network. -You should be able to ping the nodes (you can obtain their IPv6 address either directly from their log output -or by enabling DEBUG output in rpl-icmp6.c and looking at DAO prefixes being added. - -## RPL+CoAP Nodes - -coap-*-node are example nodes that expose their sensors as CoAP resources. See README.md files from the sub-directories -for more details. diff --git a/examples/platform-specific/jn516x/rpl/coap-dongle-node/Makefile b/examples/platform-specific/jn516x/rpl/coap-dongle-node/Makefile deleted file mode 100644 index d0437d869..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dongle-node/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CONTIKI_PROJECT = dongle-node -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = jn516x - -TARGET ?= jn516x -JN516x_WITH_DONGLE = 1 - -CONTIKI=../../../../.. - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/lib/json -MODULES_REL += .. - -MODULES += os/net/app-layer/coap - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/jn516x/rpl/coap-dongle-node/README.md b/examples/platform-specific/jn516x/rpl/coap-dongle-node/README.md deleted file mode 100644 index 2a4ed6183..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dongle-node/README.md +++ /dev/null @@ -1,16 +0,0 @@ -dongle-node is an example of a RICH node containing a JN516x microcontroller on a USB dongle. -The dongle is part of the NXP JN516x Evaluation Kit (see http://www.nxp.com/documents/leaflet/75017368.pdf) -The dongle-node connects to the network in the same way as described in `examples\jn5168/rpl/README.md` - -The dongle contains 2 LEDs that are available as a CoAP resource. They can be accessed via a CoAP client at the IPv6 interface -of the border router (e.g. via Copper plug-in on Firefox). -The following list gives an overview of the resources: - -URI Description ---- ----------- -Dongle\LED-toggle When doing a PUT/POST method on this resource (no payload needed), the LEDs will run through - the following states with wrap-around: - - GREEN LED on - - RED LED on - - All LEDs off - - RED and GREEN LED alternatively on with 1 sec period time diff --git a/examples/platform-specific/jn516x/rpl/coap-dongle-node/dongle-node.c b/examples/platform-specific/jn516x/rpl/coap-dongle-node/dongle-node.c deleted file mode 100644 index 9c7cbb7aa..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dongle-node/dongle-node.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "contiki.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/routing/routing.h" -#include "coap-engine.h" -#include "sys/ctimer.h" -#include -#include "dev/leds.h" - -static void ct_callback(void *ptr); -static void put_post_led_toggle_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -static char content[COAP_MAX_CHUNK_SIZE]; -static int content_len = 0; -static struct ctimer ct; - -#define CONTENT_PRINTF(...) { if(content_len < sizeof(content)) { content_len += snprintf(content + content_len, sizeof(content) - content_len, __VA_ARGS__); } } - -/* On dongle, LEDs are connected anti-parallel to DIO pins. */ - -#define TOGGLE_TIME CLOCK_SECOND -/*---------------------------------------------------------------------------*/ -PROCESS(start_app, "START_APP"); -AUTOSTART_PROCESSES(&start_app); -/*---------------------------------------------------------------------------*/ - -/* Call back for led toggle timer to toggle leds */ -static void -ct_callback(void *ptr) -{ - static uint8 toggle_status = 0; - if(toggle_status) { - leds_set(LEDS_RED); - } else { - leds_set(LEDS_GREEN); - } ctimer_restart(&ct); - toggle_status ^= 0x01; -} -/*********** CoAP sensor/ resource ************************************************/ -RESOURCE(resource_led_toggle, - "title=\"Led_toggle\"", - NULL, - put_post_led_toggle_handler, - put_post_led_toggle_handler, - NULL); -static void -put_post_led_toggle_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - static int led_state = 0; - unsigned int accept = -1; - - /* Given the way the LEDs are connected to the DIO ports, the LEDs are controlled via direct DIO access. */ - content_len = 0; - switch(led_state) { - case (0): - ctimer_stop(&ct); - leds_set(LEDS_GREEN); /* Only LEDS_GREEN on */ - CONTENT_PRINTF("Message from resource: Green LED on"); - led_state = 1; - break; - case (1): - leds_set(LEDS_RED); /* Only LEDS_RED on */ - CONTENT_PRINTF("Message from resource: Red LED on"); - led_state = 2; - break; - case (2): - leds_set(0); /* All LEDS off */ - CONTENT_PRINTF("Message from resource: All LEDs off"); - led_state = 3; - break; - case 3: - /* Both leds toggle */ - CONTENT_PRINTF("Message from resource: LEDs toggle"); - ctimer_restart(&ct); - led_state = 0; - default: - break; - } - /* Return message */ - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(start_app, ev, data) -{ - PROCESS_BEGIN(); - static int is_coordinator = 0; - - /* Switch off dongle leds */ - - /* Initialise ct timer, but don't let it run yet */ - ctimer_set(&ct, TOGGLE_TIME, ct_callback, NULL); - ctimer_stop(&ct); - - /* Start net stack */ - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - printf("Starting RPL node\n"); - - coap_activate_resource(&resource_led_toggle, "Dongle/LED-toggle"); - - PROCESS_END(); -} diff --git a/examples/platform-specific/jn516x/rpl/coap-dongle-node/project-conf.h b/examples/platform-specific/jn516x/rpl/coap-dongle-node/project-conf.h deleted file mode 100644 index bb7d4d785..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dongle-node/project-conf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \author Simon Duquennoy - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UIP_CONF_TCP 0 - -#include "../common-conf.h" - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/platform-specific/jn516x/rpl/coap-dr1175-node/Makefile b/examples/platform-specific/jn516x/rpl/coap-dr1175-node/Makefile deleted file mode 100644 index 3670d12c4..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dr1175-node/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CONTIKI_PROJECT = dr1175-node -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = jn516x - -TARGET ?= jn516x -JN516x_WITH_DR1175 = 1 - -CONTIKI=../../../../.. - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/lib/json -MODULES_REL += .. - -MODULES += os/net/app-layer/coap - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/jn516x/rpl/coap-dr1175-node/README.md b/examples/platform-specific/jn516x/rpl/coap-dr1175-node/README.md deleted file mode 100644 index 6be19ab6d..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dr1175-node/README.md +++ /dev/null @@ -1,24 +0,0 @@ -dr1175-node is an example of a RICH node containing a JN516x microcontroller on a DR1174 baseboard. -A DR1175 shield is mounted on the baseboard. -The boards are part of the NXP JN516x Evaluation Kit (see http://www.nxp.com/documents/leaflet/75017368.pdf) -The dr1175-node connects to the network in the same way as described in `examples\jn5168/rpl/README.md` - -The resources on the DR1175 are available as CoAP resources. They can be accessed via a CoAP client at the IPv6 interface -of the border router (e.g. via Copper plug-in on Firefox). -The following list gives an overview of the resources: - -URI Description ---- ----------- -DR1175\AllSensors This is an observable resource that shows the status of the humidity, light and temperature sensor. - The resource is automatically updated when a change in the value of the sensor data occurs. -DR1175\ColorLED\RGBValue With this resource, the level and color of the RGB LED can be set. - The output is set as 3 numbers (R, G and B) from 0..255, separated with a space -DR1175\Humidity\Unit This resource will return the unit of the humidity sensor -DR1175\Humidity\Value This resource will return the value of the humidity sensor -DR1175\LightSensor\Unit This resource will return the unit of the light sensor -DR1175\LightSensor\Value This resource will return the value of the light sensor -DR1175\Temperature\Unit This resource will return the unit of the temperature sensor -DR1175\Temperature\Value This resource will return the value of the temperature sensor -DR1175\WhiteLED This resource will set the level of 3 white power LEDs. Level is from 0..255 -DR1174\D3On1174 This resource control LED D3 on the base board -DR1174\D6On1174 This resource control LED D6 on the base board \ No newline at end of file diff --git a/examples/platform-specific/jn516x/rpl/coap-dr1175-node/dr1175-node.c b/examples/platform-specific/jn516x/rpl/coap-dr1175-node/dr1175-node.c deleted file mode 100644 index 4a8432099..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dr1175-node/dr1175-node.c +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ - -#include "contiki.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/routing/routing.h" -#include "coap-engine.h" -#include "light-sensor.h" -#include "ht-sensor.h" -#include "dev/leds.h" -#include "dev/leds-extension.h" -#include "sys/etimer.h" -#include -#include - -static void event_sensors_dr1175_handler(void); -static void get_sensors_dr1175_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_light_sensor_value_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_light_sensor_unit_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_temperature_value_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_temperature_unit_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_humidity_value_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_humidity_unit_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void put_post_white_led_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void put_post_rgb_led_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void put_post_led_d3_1174_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void put_post_led_d6_1174_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -static char content[COAP_MAX_CHUNK_SIZE]; -static int content_len = 0; - -#define CONTENT_PRINTF(...) { if(content_len < sizeof(content)) { content_len += snprintf(content + content_len, sizeof(content) - content_len, __VA_ARGS__); } } - -#define CLIP(value, level) if(value > level) { \ - value = level; \ -} -#define SET_LED(LED) if(atoi((const char *)request_content) != 0) { \ - leds_on(LED); \ - } else { \ - leds_off(LED); \ - } -/*---------------------------------------------------------------------------*/ -PROCESS(start_app, "START_APP"); -AUTOSTART_PROCESSES(&start_app, &sensors_process); - -/*---------------------------------------------------------------------------*/ - -/*********** CoAP sensor/ resource *************************************************/ - -/*******************************************************************/ -/* Observable resource and event handler to obtain all sensor data */ -/*******************************************************************/ -EVENT_RESOURCE(resource_sensors_dr1175, /* name */ - "obs;title=\"All_DR1175_sensors\"", /* attributes */ - get_sensors_dr1175_handler, /* GET handler */ - NULL, /* POST handler */ - NULL, /* PUT handler */ - NULL, /* DELETE handler */ - event_sensors_dr1175_handler); /* event handler */ -static void -get_sensors_dr1175_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == APPLICATION_JSON) { - content_len = 0; - CONTENT_PRINTF("{\"DR1175\":["); - CONTENT_PRINTF("{\"Humidity\":\"%d\"},", ht_sensor.value(HT_SENSOR_HUM)); - CONTENT_PRINTF("{\"Light\":\"%d\"},", light_sensor.value(0)); - CONTENT_PRINTF("{\"Temp\":\"%d\"}", ht_sensor.value(HT_SENSOR_TEMP)); - CONTENT_PRINTF("]}"); - coap_set_header_content_format(response, APPLICATION_JSON); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -static void -event_sensors_dr1175_handler() -{ - /* Registered observers are notified and will trigger the GET handler to create the response. */ - coap_notify_observers(&resource_sensors_dr1175); -} -/*****************************************************/ -/* Resource and handler to obtain light sensor value */ -/*****************************************************/ -RESOURCE(resource_light_sensor_value, - "title=\"light sensor value\"", - get_light_sensor_value_handler, - NULL, - NULL, - NULL); -static void -get_light_sensor_value_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - content_len = 0; - CONTENT_PRINTF("%d", light_sensor.value(0)); - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -/***************************************************/ -/* Resource and handler to obtain light unit value */ -/***************************************************/ -RESOURCE(resource_light_sensor_unit, - "title=\"light sensor unit\"", - get_light_sensor_unit_handler, - NULL, - NULL, - NULL); -static void -get_light_sensor_unit_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - content_len = 0; - CONTENT_PRINTF("Lux"); - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -/***********************************************************/ -/* Resource and handler to obtain temperature sensor value */ -/***********************************************************/ -RESOURCE(resource_temperature_value, - "title=\"temperature value\"", - get_temperature_value_handler, - NULL, - NULL, - NULL); -static void -get_temperature_value_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - content_len = 0; - CONTENT_PRINTF("%d", ht_sensor.value(HT_SENSOR_TEMP)); - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -/*********************************************************/ -/* Resource and handler to obtain temperature unit value */ -/*********************************************************/ -RESOURCE(resource_temperature_unit, - "title=\"temperature unit\"", - get_temperature_unit_handler, - NULL, - NULL, - NULL); -static void -get_temperature_unit_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - content_len = 0; - CONTENT_PRINTF("degrees C"); - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -/********************************************************/ -/* Resource and handler to obtain humidity sensor value */ -/********************************************************/ -RESOURCE(resource_humidity_value, - "title=\"humidity value\"", - get_humidity_value_handler, - NULL, - NULL, - NULL); -static void -get_humidity_value_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - content_len = 0; - CONTENT_PRINTF("%d", ht_sensor.value(HT_SENSOR_HUM)); - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -/******************************************************/ -/* Resource and handler to obtain humidity unit value */ -/******************************************************/ -RESOURCE(resource_humidity_unit, - "title=\"humidity unit\"", - get_humidity_unit_handler, - NULL, - NULL, - NULL); -static void -get_humidity_unit_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - content_len = 0; - CONTENT_PRINTF("relative %%"); - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -/***************************************************/ -/* Resource and handler to control White LED level */ -/***************************************************/ -RESOURCE(resource_white_led, - "title=\"WhiteLED <[0..255]>\"", - NULL, - put_post_white_led_handler, - put_post_white_led_handler, - NULL); -static void -put_post_white_led_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content = NULL; - int level; - - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - level = atoi((const char *)request_content); - CLIP(level, 255) - leds_set_level(level, LEDS_WHITE); - } -} -/*************************************************/ -/* Resource and handler to control RGB LED level */ -/*************************************************/ -RESOURCE(resource_rgb_led, - "title=\"RGB LED <[0..255] [0..255] [0..255]>\"", - NULL, - put_post_rgb_led_handler, - put_post_rgb_led_handler, - NULL); -static void -put_post_rgb_led_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content = NULL; - char *pch; - int RGB[] = { 0, 0, 0 }; - int index = 0; - - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - pch = strtok((char *)request_content, " "); - while((pch != NULL) && (index != sizeof(RGB) / sizeof(int))) { - /* Convert token to int */ - RGB[index] = atoi(pch); - CLIP(RGB[index], 255) - index++; - /* Get next token */ - pch = strtok(NULL, " "); - } - leds_set_level(RGB[0], LEDS_RED); - leds_set_level(RGB[1], LEDS_GREEN); - leds_set_level(RGB[2], LEDS_BLUE); - } -} -/************************************************/ -/* Resource and handler to control D3 on DR1174 */ -/************************************************/ -RESOURCE(resource_led_d3_1174, - "title=\"LED D3 1174<[0,1]>\"", - NULL, - put_post_led_d3_1174_handler, - put_post_led_d3_1174_handler, - NULL); -static void -put_post_led_d3_1174_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - SET_LED(LEDS_GP0); - } -} -/************************************************/ -/* Resource and handler to control D6 on DR1174 */ -/************************************************/ -RESOURCE(resource_led_d6_1174, - "title=\"LED D6 1174<[0,1]>\"", - NULL, - put_post_led_d6_1174_handler, - put_post_led_d6_1174_handler, - NULL); -static void -put_post_led_d6_1174_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - SET_LED(LEDS_GP1); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(start_app, ev, data) -{ - PROCESS_BEGIN(); - - static int is_coordinator = 0; - static struct etimer et; - - /* Make sensor active for measuring */ - SENSORS_ACTIVATE(light_sensor); - SENSORS_ACTIVATE(ht_sensor); - - /* Start net stack */ - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - printf("Starting RPL node\n"); - - coap_activate_resource(&resource_light_sensor_value, "DR1175/LightSensor/Value"); - coap_activate_resource(&resource_light_sensor_unit, "DR1175/LightSensor/Unit"); - coap_activate_resource(&resource_temperature_unit, "DR1175/Temperature/Unit"); - coap_activate_resource(&resource_temperature_value, "DR1175/Temperature/Value"); - coap_activate_resource(&resource_humidity_unit, "DR1175/Humidity/Unit"); - coap_activate_resource(&resource_humidity_value, "DR1175/Humidity/Value"); - coap_activate_resource(&resource_white_led, "DR1175/WhiteLED"); - coap_activate_resource(&resource_rgb_led, "DR1175/ColorLED/RGBValue"); - coap_activate_resource(&resource_led_d3_1174, "DR1175/LED/D3On1174"); - coap_activate_resource(&resource_led_d6_1174, "DR1175/LED/D6On1174"); - coap_activate_resource(&resource_sensors_dr1175, "DR1175/AllSensors"); - - /* Level of LEDS=0, so no light after start-up */ - leds_on(LEDS_WHITE | LEDS_RED | LEDS_GREEN | LEDS_BLUE); - - /* contiki-jn516x-main switches all leds off after process start-up. - Switch on required leds after rescheduling, otherwise level change needs to be - accompanied with leds_on() at least once in resource handler. */ - etimer_set(&et, CLOCK_SECOND / 10); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - /* Level of LEDS=0, so no light after start-up. However, they are enabled - A level change will directly be visible. */ - leds_on(LEDS_WHITE | LEDS_RED | LEDS_GREEN | LEDS_BLUE); - - /* If sensor process generates an event, call event_handler of resource. - This will make this resource observable by the client */ - while(1) { - PROCESS_WAIT_EVENT_UNTIL((ev == sensors_event) && - ((data == &light_sensor) || (data == &ht_sensor))); - event_sensors_dr1175_handler(); - } - - PROCESS_END(); -} diff --git a/examples/platform-specific/jn516x/rpl/coap-dr1175-node/project-conf.h b/examples/platform-specific/jn516x/rpl/coap-dr1175-node/project-conf.h deleted file mode 100644 index bb7d4d785..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dr1175-node/project-conf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \author Simon Duquennoy - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UIP_CONF_TCP 0 - -#include "../common-conf.h" - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/platform-specific/jn516x/rpl/coap-dr1199-node/Makefile b/examples/platform-specific/jn516x/rpl/coap-dr1199-node/Makefile deleted file mode 100644 index b2286e272..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dr1199-node/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CONTIKI_PROJECT = dr1199-node -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = jn516x - -TARGET ?= jn516x -JN516x_WITH_DR1199 = 1 - -CONTIKI=../../../../.. - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/lib/json -MODULES_REL += .. - -MODULES += os/net/app-layer/coap - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/jn516x/rpl/coap-dr1199-node/README.md b/examples/platform-specific/jn516x/rpl/coap-dr1199-node/README.md deleted file mode 100644 index e9a6ee66b..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dr1199-node/README.md +++ /dev/null @@ -1,33 +0,0 @@ -dr1199-node is an example of a RICH node containing a JN516x microcontroller on a DR1174 baseboard. -A DR1199 shield is mounted on the baseboard. -The boards are part of the NXP JN516x Evaluation Kit (see http://www.nxp.com/documents/leaflet/75017368.pdf) -The dr1199-node connects to the network in the same way as described in `examples\jn5168/rpl/README.md` - -The resources on the DR1199 are available as CoAP resources. They can be accessed via a CoAP client at the IPv6 interface -of the border router (e.g. via Copper plug-in on Firefox). -The following list gives an overview of the resources: - -URI Description ---- ----------- -DR1199\AllSensors This is an observable resource that shows the status of all switches and the potentiometer on the board - The resource is automatically updated when a change of the status/value of the switches and potentiometer - takes place. -DR1199\LED\All When writing a '1', LEDs D1..D3 will switch ON - When writing a '0', LEDs D1..D3 will switch OFF -DR1199\LED\D1 When writing a '1', LED D1 will switch ON - When writing a '0', LED D1 will switch OFF -DR1199\LED\D2 When writing a '1', LED D2 will switch ON - When writing a '0', LED D2 will switch OFF -DR1199\LED\D3 When writing a '1', LED D3 will switch ON - When writing a '0', LED D3 will switch OFF -DR1199\D3On1174 This resource control LED D3 on the base board -DR1199\D6On1174 This resource control LED D6 on the base board -DR1199\Potentiometer The resource will show the value of the potentiometer -DR1199\Switch\DIO8 This resource shows the status of the DIO8 switch (on DR1174) -DR1199\Switch\SW1 This resource shows the status of the SW1 switch -DR1199\Switch\SW2 This resource shows the status of the SW2 switch -DR1199\Switch\SW3 This resource shows the status of the SW3 switch -DR1199\Switch\SW4 This resource shows the status of the SW4 switch - - - diff --git a/examples/platform-specific/jn516x/rpl/coap-dr1199-node/dr1199-node.c b/examples/platform-specific/jn516x/rpl/coap-dr1199-node/dr1199-node.c deleted file mode 100644 index d493636b5..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dr1199-node/dr1199-node.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2015 NXP B.V. - * 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Theo van Daele - * - */ -#include "contiki.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/routing/routing.h" -#include "coap-engine.h" -#include "dev/leds.h" -#include "button-sensor.h" -#include "pot-sensor.h" -#include -#include - -static char content[COAP_MAX_CHUNK_SIZE]; -static int content_len = 0; - -static void event_sensors_dr1199_handler(); -static void get_sensors_dr1199_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_switch_sw1_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_switch_sw2_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_switch_sw3_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_switch_sw4_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_switch_dio8_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_pot_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void put_post_led_d1_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void put_post_led_d2_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void put_post_led_d3_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void put_post_led_d3_1174_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void put_post_led_d6_1174_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void put_post_led_all_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -#define CONTENT_PRINTF(...) { if(content_len < sizeof(content)) { content_len += snprintf(content + content_len, sizeof(content) - content_len, __VA_ARGS__); } } - -#define PARSE_SWITCH(POSITION) if(button_sensor.value(0) & (1 << POSITION)) { \ - CONTENT_PRINTF("PRESSED"); \ - } else { \ - CONTENT_PRINTF("RELEASED"); \ - } - -#define SET_LED(LED) if(atoi((const char *)request_content) != 0) { \ - leds_on(LED); \ - } else { \ - leds_off(LED); \ - } - -/*---------------------------------------------------------------------------*/ -PROCESS(start_app, "START_APP"); -AUTOSTART_PROCESSES(&sensors_process, &start_app); - -/*---------------------------------------------------------------------------*/ - -/*********** CoAP sensor/ resource *************************************************/ - -/*******************************************************************/ -/* Observable resource and event handler to obtain all sensor data */ -/*******************************************************************/ -EVENT_RESOURCE(resource_sensors_dr1199, /* name */ - "obs;title=\"All_DR1199_sensors\"", /* attributes */ - get_sensors_dr1199_handler, /* GET handler */ - NULL, /* POST handler */ - NULL, /* PUT handler */ - NULL, /* DELETE handler */ - event_sensors_dr1199_handler); /* event handler */ -static void -get_sensors_dr1199_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == APPLICATION_JSON) { - content_len = 0; - CONTENT_PRINTF("{\"DR1199\":["); - CONTENT_PRINTF("{\"Switch\":\"0x%X\"},", button_sensor.value(0)); - CONTENT_PRINTF("{\"Pot\":\"%d\"}", pot_sensor.value(0)); - CONTENT_PRINTF("]}"); - coap_set_header_content_format(response, APPLICATION_JSON); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -static void -event_sensors_dr1199_handler() -{ - /* Registered observers are notified and will trigger the GET handler to create the response. */ - coap_notify_observers(&resource_sensors_dr1199); -} -/***********************************************/ -/* Resource and handler to obtain switch value */ -/***********************************************/ -RESOURCE(resource_switch_sw1, - "title=\"SW1\"", - get_switch_sw1_handler, - NULL, - NULL, - NULL); -static void -get_switch_sw1_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - content_len = 0; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - PARSE_SWITCH(1) - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -RESOURCE(resource_switch_sw2, - "title=\"SW2\"", - get_switch_sw2_handler, - NULL, - NULL, - NULL); -static void -get_switch_sw2_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - content_len = 0; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - PARSE_SWITCH(2) - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -RESOURCE(resource_switch_sw3, - "title=\"SW3\"", - get_switch_sw3_handler, - NULL, - NULL, - NULL); -static void -get_switch_sw3_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - content_len = 0; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - PARSE_SWITCH(3) - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -RESOURCE(resource_switch_sw4, - "title=\"SW4\"", - get_switch_sw4_handler, - NULL, - NULL, - NULL); -static void -get_switch_sw4_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - content_len = 0; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - PARSE_SWITCH(4) - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -RESOURCE(resource_switch_dio8, - "title=\"DIO8\"", - get_switch_dio8_handler, - NULL, - NULL, - NULL); -static void -get_switch_dio8_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - content_len = 0; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - PARSE_SWITCH(0) - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -/*******************************************************/ -/* Resource and handler to obtain potentiometer value */ -/*******************************************************/ -RESOURCE(resource_pot, - "title=\"Potentiometer\"", - get_pot_handler, - NULL, - NULL, - NULL); -static void -get_pot_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - content_len = 0; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - CONTENT_PRINTF("%d", pot_sensor.value(0)); - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -/************************************/ -/* Resource and handler to set leds */ -/************************************/ -RESOURCE(resource_led_d1, - "title=\"LED D1 <[0,1]>\"", - NULL, - put_post_led_d1_handler, - put_post_led_d1_handler, - NULL); -static void -put_post_led_d1_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - SET_LED(LEDS_GREEN) - } -} -RESOURCE(resource_led_d2, - "title=\"LED D2 <[0,1]>\"", - NULL, - put_post_led_d2_handler, - put_post_led_d2_handler, - NULL); -static void -put_post_led_d2_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - SET_LED(LEDS_BLUE) - } -} -RESOURCE(resource_led_d3, - "title=\"LED D3 <[0,1]>\"", - NULL, - put_post_led_d3_handler, - put_post_led_d3_handler, - NULL); -static void -put_post_led_d3_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - SET_LED(LEDS_RED) - } -} -RESOURCE(resource_led_d3_1174, - "title=\"LED D3 1174<[0,1]>\"", - NULL, - put_post_led_d3_1174_handler, - put_post_led_d3_1174_handler, - NULL); -static void -put_post_led_d3_1174_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - SET_LED(LEDS_GP0); - } -} -RESOURCE(resource_led_d6_1174, - "title=\"LED D6 1174<[0,1]>\"", - NULL, - put_post_led_d6_1174_handler, - put_post_led_d6_1174_handler, - NULL); -static void -put_post_led_d6_1174_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - SET_LED(LEDS_GP1); - } -} -RESOURCE(resource_led_all, - "title=\"LED All <[0,1]>\"", - NULL, - put_post_led_all_handler, - put_post_led_all_handler, - NULL); -static void -put_post_led_all_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - if(atoi((const char *)request_content) != 0) { - leds_on(LEDS_ALL); - } else { - leds_off(LEDS_ALL); - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(start_app, ev, data) -{ - PROCESS_BEGIN(); - - static int is_coordinator = 0; - - /* is_coordinator = node_id == 1; */ - - /* Make sensor active for measuring */ - SENSORS_ACTIVATE(button_sensor); - SENSORS_ACTIVATE(pot_sensor); - - /* Start net stack */ - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - printf("Starting RPL node\n"); - - coap_activate_resource(&resource_switch_sw1, "DR1199/Switch/SW1"); - coap_activate_resource(&resource_switch_sw2, "DR1199/Switch/SW2"); - coap_activate_resource(&resource_switch_sw3, "DR1199/Switch/SW3"); - coap_activate_resource(&resource_switch_sw4, "DR1199/Switch/SW4"); - coap_activate_resource(&resource_switch_dio8, "DR1199/Switch/DIO8"); - coap_activate_resource(&resource_pot, "DR1199/Potentiometer"); - coap_activate_resource(&resource_led_d1, "DR1199/LED/D1"); - coap_activate_resource(&resource_led_d2, "DR1199/LED/D2"); - coap_activate_resource(&resource_led_d3, "DR1199/LED/D3"); - coap_activate_resource(&resource_led_d3_1174, "DR1199/LED/D3On1174"); - coap_activate_resource(&resource_led_d6_1174, "DR1199/LED/D6On1174"); - coap_activate_resource(&resource_led_all, "DR1199/LED/All"); - coap_activate_resource(&resource_sensors_dr1199, "DR1199/AllSensors"); - /* If sensor process generates an event, call event_handler of resource. - This will make this resource observable by the client */ - while(1) { - PROCESS_WAIT_EVENT_UNTIL((ev == sensors_event) && - ((data == &button_sensor) || (data == &pot_sensor))); - event_sensors_dr1199_handler(); - } - - PROCESS_END(); -} diff --git a/examples/platform-specific/jn516x/rpl/coap-dr1199-node/project-conf.h b/examples/platform-specific/jn516x/rpl/coap-dr1199-node/project-conf.h deleted file mode 100644 index bb7d4d785..000000000 --- a/examples/platform-specific/jn516x/rpl/coap-dr1199-node/project-conf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \author Simon Duquennoy - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UIP_CONF_TCP 0 - -#include "../common-conf.h" - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/platform-specific/jn516x/rpl/common-conf.h b/examples/platform-specific/jn516x/rpl/common-conf.h deleted file mode 100644 index 8ffb3b4f5..000000000 --- a/examples/platform-specific/jn516x/rpl/common-conf.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \author Simon Duquennoy - */ - -#ifndef __COMMON_CONF_H__ -#define __COMMON_CONF_H__ - -#define MAC_CONFIG_CSMA 0 -#define MAC_CONFIG_TSCH 1 -/* Select a MAC configuration */ -#define MAC_CONFIG MAC_CONFIG_TSCH - -#if MAC_CONFIG == MAC_CONFIG_CSMA - -#elif MAC_CONFIG == MAC_CONFIG_TSCH - -/* Set to enable TSCH security */ -#ifndef WITH_SECURITY -#define WITH_SECURITY 0 -#endif /* WITH_SECURITY */ - -/* Do not start TSCH at init, wait for NETSTACK_MAC.on() */ -#define TSCH_CONF_AUTOSTART 0 - -/* 6TiSCH minimal schedule length. - * Larger values result in less frequent active slots: reduces capacity and saves energy. */ -#define TSCH_SCHEDULE_CONF_DEFAULT_LENGTH 3 - -#if WITH_SECURITY - -/* Enable security */ -#define LLSEC802154_CONF_SECURITY_LEVEL 1 - -#endif /* WITH_SECURITY */ - -#else - -#error Unsupported MAC configuration - -#endif /* MAC_CONFIG */ - -/* IEEE802.15.4 PANID and channel */ - -#define IEEE802154_CONF_PANID 0xabcd - -/* UART Configuration */ - -#define UART_HW_FLOW_CTRL 0 - -#define UART_XONXOFF_FLOW_CTRL 1 - -#define UART_BAUD_RATE UART_RATE_1000000 - -#endif /* __COMMON_CONF_H__ */ diff --git a/examples/platform-specific/jn516x/rpl/node/Makefile b/examples/platform-specific/jn516x/rpl/node/Makefile deleted file mode 100644 index b5a14023a..000000000 --- a/examples/platform-specific/jn516x/rpl/node/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -CONTIKI_PROJECT = node -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = jn516x - -TARGET ?= jn516x - -CONTIKI=../../../../.. - -MAKE_MAC = MAKE_MAC_TSCH -MODULES_REL += .. - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/jn516x/rpl/node/README.md b/examples/platform-specific/jn516x/rpl/node/README.md deleted file mode 100644 index e9bded1d6..000000000 --- a/examples/platform-specific/jn516x/rpl/node/README.md +++ /dev/null @@ -1,18 +0,0 @@ -A RPL node. Will act as basic node by default, but can be configured at startup -using the user button and following instructions from the log output. Every press -of a button toggles the mode as 6ln and 6dr. After 10s with no button press, -the node starts in the last setting. The modes are: -* 6ln (default): 6lowpan node, will join a RPL network and act as router. -* 6dr: 6lowpan DAG Root, will start its own RPL network. Note this is not a -border router, i.e. it does not have a serial interface with connection to -the Internet. For a border router, see ../border-router. - -To indicate the hardware target for the node, add one of the following -options in the command line: -If rpl-border-router runs on dongle: -JN516x_WITH_DONGLE=1 -If rpl-border-router runs on DR1174: -JN516x_WITH_DR1174=1 -If building for a new platform, first execute : make clean - -For more information, see ../README.md. diff --git a/examples/platform-specific/jn516x/rpl/node/node.c b/examples/platform-specific/jn516x/rpl/node/node.c deleted file mode 100644 index 71e015e6d..000000000 --- a/examples/platform-specific/jn516x/rpl/node/node.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A RPL node able to act as either DAG Root (6dr) or simple node (6ln). - * Press use button at startup to configure. - * - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "net/ipv6/uip-ds6.h" -#include "net/routing/routing.h" - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -#define CONFIG_VIA_BUTTON PLATFORM_HAS_BUTTON -#if CONFIG_VIA_BUTTON -#include "button-sensor.h" -#endif /* CONFIG_VIA_BUTTON */ - -/*---------------------------------------------------------------------------*/ -PROCESS(node_process, "RPL Node"); -#if CONFIG_VIA_BUTTON -AUTOSTART_PROCESSES(&node_process, &sensors_process); -#else /* CONFIG_VIA_BUTTON */ -AUTOSTART_PROCESSES(&node_process); -#endif /* CONFIG_VIA_BUTTON */ - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(node_process, ev, data) -{ - PROCESS_BEGIN(); - - /* 3 possible roles: - * - role_6ln: simple node, will join any network, secured or not - * - role_6dg: DAG root, will advertise (unsecured) beacons - * */ - static int is_coordinator = 0; - static enum { role_6ln, role_6dr } node_role; - node_role = role_6ln; - -#if CONFIG_VIA_BUTTON - { -#define CONFIG_WAIT_TIME 5 - static struct etimer et; - SENSORS_ACTIVATE(button_sensor); - etimer_set(&et, CLOCK_SECOND * CONFIG_WAIT_TIME); - - while(!etimer_expired(&et)) { - printf("Init: current role: %s. Will start in %u seconds.\n", - node_role == role_6ln ? "6ln" : "6dr", - CONFIG_WAIT_TIME); - PROCESS_WAIT_EVENT_UNTIL(((ev == sensors_event) && - (data == &button_sensor) && button_sensor.value(0) > 0) - || etimer_expired(&et)); - if(ev == sensors_event && data == &button_sensor && button_sensor.value(0) > 0) { - node_role = (node_role + 1) % 2; - etimer_restart(&et); - } - } - } - -#endif /* CONFIG_VIA_BUTTON */ - - printf("Init: node starting with role %s\n", - node_role == role_6ln ? "6ln" : "6dr"); - - is_coordinator = node_role > role_6ln; - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/platform-specific/jn516x/rpl/node/project-conf.h b/examples/platform-specific/jn516x/rpl/node/project-conf.h deleted file mode 100644 index 52adee3b9..000000000 --- a/examples/platform-specific/jn516x/rpl/node/project-conf.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \author Simon Duquennoy - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#include "../common-conf.h" - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/platform-specific/jn516x/tsch/README.md b/examples/platform-specific/jn516x/tsch/README.md deleted file mode 100644 index 2bfcc036a..000000000 --- a/examples/platform-specific/jn516x/tsch/README.md +++ /dev/null @@ -1,8 +0,0 @@ -Examples for tsch on jn516x - -simple-sensor-network: This example shows a simple sensor network consisting of node(s),an rpl-border-router and a host connected to -the IPv6 network. -tx-power-verfication: Example on TX power control and RSSI reading on JN516x. Resource available on coap client. -uart1-test-node: Example on exposing uart1 of JN516x node to a coap client - - \ No newline at end of file diff --git a/examples/platform-specific/jn516x/tsch/common-conf-jn516x.h b/examples/platform-specific/jn516x/tsch/common-conf-jn516x.h deleted file mode 100644 index 32f7534e7..000000000 --- a/examples/platform-specific/jn516x/tsch/common-conf-jn516x.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2014, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \author Simon Duquennoy - */ - -#ifndef __COMMON_CONF_JN516X_H__ -#define __COMMON_CONF_JN516X_H__ - -/* Shall we restart after exception, or stall? - * in production code we should restart, so set this to 0 */ -#define EXCEPTION_STALLS_SYSTEM 1 - - /* CoAP */ -#define COAP_MAX_OPEN_TRANSACTIONS 4 - -#define REST_MAX_CHUNK_SIZE 256 - -/* Network config */ -//#define UIP_CONF_BUFFER_SIZE (REST_MAX_CHUNK_SIZE + UIP_IPUDPH_LEN + COAP_MAX_HEADER_SIZE) -//#define UIP_CONF_BUFFER_SIZE (REST_MAX_CHUNK_SIZE + 0 + 48 + 70) -#define UIP_CONF_BUFFER_SIZE 1280 /* ipv6 required minimum */ - -/* Queues */ -#ifndef QUEUEBUF_CONF_NUM -#define QUEUEBUF_CONF_NUM 32 -#endif - -#define TSCH_QUEUE_CONF_NUM_PER_NEIGHBOR 32 - -#define TSCH_CONF_DEQUEUED_ARRAY_SIZE 32 - -#define TSCH_QUEUE_CONF_MAX_NEIGHBOR_QUEUES 8 - -/* Radio */ - -#define ENABLE_COOJA_DEBUG 0 - -/* max 3, min 0 */ - -#define UART_HW_FLOW_CTRL 0 - -#define UART_XONXOFF_FLOW_CTRL 1 - -#ifndef UART_BAUD_RATE -#define UART_BAUD_RATE UART_RATE_1000000 -#endif - -#endif /* __COMMON_CONF_JN516X_H__ */ diff --git a/examples/platform-specific/jn516x/tsch/common-conf.h b/examples/platform-specific/jn516x/tsch/common-conf.h deleted file mode 100644 index 5911f34ee..000000000 --- a/examples/platform-specific/jn516x/tsch/common-conf.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2014, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \author Simon Duquennoy - */ - -#ifndef __COMMON_CONF_H__ -#define __COMMON_CONF_H__ - -/* Global config flags */ - -#define WITH_TSCH_SECURITY 0 -#define WITH_COAP_RESOURCES 0 - -#define ENABLE_COOJA_DEBUG 0 - -#define IEEE802154_CONF_PANID 0x5254 - -#define TSCH_HOPPING_SEQUENCE_MY_SEQUENCE (uint8_t[]){17, 23, 15, 25, 19, 11, 13, 21} -#define TSCH_CONF_DEFAULT_HOPPING_SEQUENCE TSCH_HOPPING_SEQUENCE_MY_SEQUENCE - -#define TSCH_CONF_JOIN_MY_PANID_ONLY 1 - -#define TSCH_CONF_AUTOSTART 0 - -/* RPL Trickle timer tuning */ -#define RPL_CONF_DIO_INTERVAL_MIN 12 /* 4.096 s */ - -#define RPL_CONF_DIO_INTERVAL_DOUBLINGS 2 /* Max factor: x4. 4.096 s * 4 = 16.384 s */ - -#define TSCH_CONF_EB_PERIOD (4 * CLOCK_SECOND) -#define TSCH_CONF_KEEPALIVE_TIMEOUT (24 * CLOCK_SECOND) - -/* Dimensioning */ -#define ORCHESTRA_CONF_EBSF_PERIOD 41 -#define ORCHESTRA_CONF_COMMON_SHARED_PERIOD 7 /* Common shared slot, 7 is a very short slotframe (high energy, high capacity). Must be prime and at least equal to number of nodes (incl. BR) */ -#define ORCHESTRA_CONF_UNICAST_PERIOD 11 /* First prime greater than 10 */ - -/* Use sender-based slots */ -#define ORCHESTRA_CONF_UNICAST_SENDER_BASED 1 -/* Our "hash" is collision-free */ -#define ORCHESTRA_CONF_COLLISION_FREE_HASH 1 -/* Max hash value */ -#define ORCHESTRA_CONF_MAX_HASH (ORCHESTRA_CONF_UNICAST_PERIOD - 1) - -/* CoAP */ - -#define COAP_SERVER_PORT 5684 - -#define COAP_OBSERVE_RETURNS_REPRESENTATION 1 - -/* RPL */ -#define UIP_CONF_ROUTER 1 - -/* RPL storing mode */ -#define RPL_CONF_MOP RPL_MOP_STORING_NO_MULTICAST - -/* Default link metric */ -#define RPL_CONF_INIT_LINK_METRIC 2 /* default 5 */ - -#define RPL_CONF_MAX_INSTANCES 1 /* default 1 */ -#define RPL_CONF_MAX_DAG_PER_INSTANCE 1 /* default 2 */ - -/* No RA, No NS */ -#define UIP_CONF_TCP 0 -#define UIP_CONF_DS6_ADDR_NBU 1 -#define UIP_CONF_UDP_CHECKSUMS 1 - -/* Link-layer security */ - -#if WITH_TSCH_SECURITY -/* Set security level to the maximum, even if unused, to all crypto code */ -#define LLSEC802154_CONF_ENABLED 1 -/* Attempt to associate from both secured and non-secured EBs */ -#define TSCH_CONF_JOIN_SECURED_ONLY 0 -#endif /* WITH_TSCH_SECURITY */ - -#if MAC_CONF_WITH_CSMA /* Configure Csma with ACK (default MAC) */ - -#define MICROMAC_CONF_AUTOACK 1 - -/* increase internal radio buffering */ -#define MIRCOMAC_CONF_BUF_NUM 4 - -#endif /* MAC_CONF_WITH_CSMA */ - -#include "common-conf-jn516x.h" - -#endif /* __COMMON_CONF_H__ */ diff --git a/examples/platform-specific/jn516x/tsch/simple-sensor-network/README.md b/examples/platform-specific/jn516x/tsch/simple-sensor-network/README.md deleted file mode 100644 index b9bf2588c..000000000 --- a/examples/platform-specific/jn516x/tsch/simple-sensor-network/README.md +++ /dev/null @@ -1,25 +0,0 @@ -This example shows a simple sensor network consisting of node(s),an rpl-border-router and a host connected to -the IPv6 network. The nodes (see also node/README.md) regularly transmit simulated sensor data to the host. -The host visualises the received data. - -The Python script tools/Output-Visualisation.py visualises the received data from the nodes. -The script runs on Python27 and uses gnuplot for visualisation. -The following installations are needed (tested with Win32 versions: -- Python 27 (https://www.python.org/download/releases/2.7/) -- gnuplot (http://sourceforge.net/projects/gnuplot/files/gnuplot/) -- gnuplot.py (http://gnuplot-py.sourceforge.net/) -- numpy.py (e.g. http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy) -Manual modification: -Python27\Lib\site-packages\Gnuplot\gp_win32.py -Modify gnuplot_command as in example below - gnuplot_command = r'"C:\Program Files (x86)\gnuplot\bin\gnuplot.exe"' - -- The IPv6 addresses of nodes need to be entered in the dictionary "node_data" of tools/Output-Visualisation.py - A user name for the node can be entered in this table as well. -- The script will send a ping message to the next node in the list every 5 seconds. The nodes will obtain - the IPv6 address from this message and start sending "sensor" data to the host. -- Received sensor data is plotted. When no data has been received for more than 30seconds, the plot line - will be dashed. -- Plots are updated once per second. - - \ No newline at end of file diff --git a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/Makefile b/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/Makefile deleted file mode 100644 index 2880a76de..000000000 --- a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CONTIKI_PROJECT = node - -PLATFORMS_ONLY = jn516x - -TARGET ?= jn516x -JN516x_WITH_DONGLE = 1 - -CONTIKI=../../../../../.. - -MODULES_REL += .. -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/net/app-layer/coap -MODULES += os/services/orchestra os/lib/json - -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/README.md b/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/README.md deleted file mode 100644 index a49a8970c..000000000 --- a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/README.md +++ /dev/null @@ -1,10 +0,0 @@ -Node is part of Simple-Sensor-Network -When node is connected to border-router (TSCH), it will wait to be addressed by a host -on port 8185. -When addressed, IPv6 address of host is acquired. Node will start to transmit samples of -a waveform ("simulated" sensor data) to the host on port 8186 at a rate of once per -10 seconds. Type of waveform and phase depend on mac address of node in order to better -distinguish the waveforms at the host side. -LED is flashed every time a sample is transmitted. -Nodes are tested with configuration JN516x_WITH_DONGLE=1 - diff --git a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/node.c b/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/node.c deleted file mode 100644 index b3ef311fd..000000000 --- a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/node.c +++ /dev/null @@ -1,227 +0,0 @@ -/* -* Copyright (c) 2015 NXP B.V. -* 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* -* This file is part of the Contiki operating system. -* -* Author: Theo van Daele -* -*/ - -#include "contiki.h" -#include "net/netstack.h" -#include "net/mac/tsch/tsch.h" -#include "net/routing/routing.h" -#include "net/ipv6/uip-debug.h" -#include "lib/random.h" -#include "sys/node-id.h" -#include "waveform.h" -#include "leds.h" -#include "net/ipv6/uiplib.h" -#include "net/ipv6/uip-udp-packet.h" -#include -#include -#include - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -#define INTERVAL (10) -#define BLINK_TIME (CLOCK_SECOND/4) - -typedef enum { - WAVEFORM_SIN = 0, - WAVEFORM_TRIANGLE = 1, - WAVEFORM_POS_SAWTOOTH = 2, - WAVEFORM_NEG_SAWTOOTH = 3, - NUMBER_OF_WAVEFORMS = 4 -} waveform_t; - -typedef struct { - const int8 * table; - char * str; -} wave_t; - -static const wave_t waveform_table[] = { {sin_table, "SINE"}, /* WAVEFORM_SIN */ - {triangle_table, "TRIANGLE"}, /* WAVEFORM_TRIANGLE */ - {pos_sawtooth_table, "POS-SAWTOOTH"}, /* WAVEFORM_POS_SAWTOOTH */ - {neg_sawtooth_table, "NEG_SAWTOOTH"}}; /* WAVEFORM_NEG_SAWTOOTH */ - -static int total_time = 0; -static int selected_waveform = 0; - -static void udp_rx_handler(void); -static void my_sprintf(char * udp_buf, int8_t value); - -static struct uip_udp_conn *udp_conn_rx; -static struct uip_udp_conn *udp_conn_tx; -static uip_ip6addr_t ip6addr_host; -static int host_found = 0; -static char udp_buf[120]; -static char *post_mssg = "Trigger"; - -/*******************************************************************************/ -/* Local functions */ -/*******************************************************************************/ -static void -udp_rx_handler(void) -{ - if(uip_newdata()) { - ((char *)uip_appdata)[uip_datalen()] = '\0'; - printf("UDP data from host: %s\n", (char *)uip_appdata); - if (!host_found) { - /* Create socket to talk back to host */ - uip_ipaddr_copy(&ip6addr_host, &UIP_IP_BUF->srcipaddr); - udp_conn_tx = udp_new(&ip6addr_host, UIP_HTONS(8186), NULL); - host_found = 1; - } - } -} - -static void -my_sprintf(char * udp_buf, int8_t value) -{ - /* Fill the buffer with 4 ASCII chars */ - if (value < 0) { - *udp_buf++ = '-'; - } else { - *udp_buf++ = '+'; - } - value = abs(value); - *udp_buf++ = value/100 + '0'; - value %= 100; - *udp_buf++ = value/10 + '0'; - value %= 10; - *udp_buf++ = value + '0'; - *udp_buf = 0; -} - -/*---------------------------------------------------------------------------*/ -PROCESS(node_process, "Node"); -PROCESS(led_process, "LED"); -AUTOSTART_PROCESSES(&node_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(node_process, ev, data) -{ - PROCESS_BEGIN(); - - static int sample_count = 0; - static struct etimer et; - extern unsigned char node_mac[8]; - - leds_init(); - - /* 3 possible roles: - * - role_6ln: simple node, will join any network, secured or not - * - role_6dr: DAG root, will advertise (unsecured) beacons - * - role_6dr_sec: DAG root, will advertise secured beacons - * */ - static int is_coordinator = 0; - static enum { role_6ln, role_6dr, role_6dr_sec } node_role; - - /* Set node with ID == 1 as coordinator, handy in Cooja. */ - if(node_id == 1) { - if(LLSEC802154_ENABLED) { - node_role = role_6dr_sec; - } else { - node_role = role_6dr; - } - } else { - node_role = role_6ln; - } - - printf("Init: node starting with role %s\n", - node_role == role_6ln ? "6ln" : (node_role == role_6dr) ? "6dr" : "6dr-sec"); - -#if MAC_CONF_WITH_TSCH - tsch_set_pan_secured(LLSEC802154_ENABLED && (node_role == role_6dr_sec)); -#endif /* MAC_CONF_WITH_TSCH */ - is_coordinator = node_role > role_6ln; - - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - - /* Selected waveform depends on LS byte of MAC */ - selected_waveform = node_mac[7] % NUMBER_OF_WAVEFORMS; - printf("LS-Byte=0x%x; waveform=%d\n", node_mac[7], selected_waveform); - - process_start(&led_process, NULL); - - /* Listen to any host on 8185 */ - udp_conn_rx = udp_new(NULL, 0, NULL); - udp_bind(udp_conn_rx, UIP_HTONS(8185)); - - /* Wait for timer event - On timer event, handle next sample */ - etimer_set(&et, INTERVAL*CLOCK_SECOND); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et) || (ev == tcpip_event)); - if (ev == tcpip_event) { - udp_rx_handler(); - } - if (etimer_expired(&et) ) { - /* Restart timer */ - total_time += INTERVAL; - if (host_found) { - /* Make sample count dependent on asn. After a disconnect, waveforms remain - synchronous. Use node_mac to create phase offset between waveforms in different nodes */ - sample_count = ((tsch_current_asn.ls4b/((1000/(tsch_timing_us[tsch_ts_timeslot_length]/1000)))/INTERVAL)+node_mac[7]) % (SIZE_OF_WAVEFORM-1); - printf("%d sec. waveform=%s. cnt=%d. value=%d\n", total_time, waveform_table[selected_waveform].str, sample_count, waveform_table[selected_waveform].table[sample_count]); - my_sprintf(udp_buf, waveform_table[selected_waveform].table[sample_count]); - uip_udp_packet_send(udp_conn_tx, udp_buf, strlen(udp_buf)); - /* Switch LED on and start blink timer (callback timer) */ - process_post(&led_process, PROCESS_EVENT_CONTINUE, post_mssg); - } else { - printf("No host\n"); - } - etimer_restart(&et); - } - } - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(led_process, ev, data) -{ - PROCESS_BEGIN(); - - /* Switch on leds for 0.25msec after event posted. */ - static struct etimer led_et; - - while(1) { - PROCESS_WAIT_EVENT_UNTIL((ev == PROCESS_EVENT_CONTINUE) && (!strcmp(data, post_mssg))); - leds_on(LEDS_RED); - etimer_set(&led_et, CLOCK_SECOND/4); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&led_et)); - etimer_stop(&led_et); - leds_off(LEDS_RED); - } - PROCESS_END(); -} diff --git a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/project-conf.h b/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/project-conf.h deleted file mode 100644 index 65ddcef46..000000000 --- a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/project-conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2015 NXP B.V. -* 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* -* This file is part of the Contiki operating system. -* -* Author: Theo van Daele -* -*/ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UIP_CONF_TCP 0 -#define UART_BAUD_RATE UART_RATE_115200 - -#include "../../common-conf.h" - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/waveform.h b/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/waveform.h deleted file mode 100644 index a171ff54a..000000000 --- a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/waveform.h +++ /dev/null @@ -1,214 +0,0 @@ -/* -* Copyright (c) 2015 NXP B.V. -* 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* -* This file is part of the Contiki operating system. -* -* Author: Theo van Daele -* -*/ - - -/* This file contains arrays with waveforms. - The arrays are of type int8. No limit on size, but for convenience of demonstrating take care that sample - period may be 10secs or more. Size for all tables should be equal !! */ - -#define SIZE_OF_WAVEFORM 40 - -static const int8 sin_table[] = { -0, -19, -39, -57, -74, -89, -102, -113, -120, -125, -127, -125, -120, -113, -102, -89, -74, -57, -39, -19, -0, --20, --40, --58, --75, --90, --103, --114, --121, --126, --127, --126, --121, --114, --103, --90, --75, --58, --40, --20 -}; - -static const int8 triangle_table[] = { --127, --114, --101, --87, --74, --61, --47, --34, --21, --7, -6, -20, -33, -46, -60, -73, -86, -100, -113, -127, -127, -113, -100, -86, -73, -60, -46, -33, -20, -6, --7, --21, --34, --47, --61, --74, --87, --101, --114, --127 -}; - -static const int8 pos_sawtooth_table[] = { --127, --121, --115, --108, --102, --96, --89, --83, --76, --70, --64, --57, --51, --45, --38, --32, --25, --19, --13, --6, -0, -6, -13, -19, -26, -32, -38, -45, -51, -57, -64, -70, -77, -83, -89, -96, -102, -108, -115, -121 -}; - -static const int8 neg_sawtooth_table[] = { -127, -120, -114, -107, -101, -95, -88, -82, -76, -69, -63, -56, -50, -44, -37, -31, -25, -18, -12, -5, --1, --7, --14, --20, --26, --33, --39, --46, --52, --58, --65, --71, --77, --84, --90, --97, --103, --109, --116, --122 -}; - - diff --git a/examples/platform-specific/jn516x/tsch/simple-sensor-network/script/Output-Visualisation.py b/examples/platform-specific/jn516x/tsch/simple-sensor-network/script/Output-Visualisation.py deleted file mode 100644 index 4e1699d53..000000000 --- a/examples/platform-specific/jn516x/tsch/simple-sensor-network/script/Output-Visualisation.py +++ /dev/null @@ -1,148 +0,0 @@ -# -# Copyright (c) 2015 NXP B.V. -# 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# This file is part of the Contiki operating system. -# -# Author: Theo van Daele -# -# - -import sys -import time -import socket -import thread -import numpy as np -import Gnuplot - -# Plot buffer length for each node buffer -SIZE_NODE_DATA = 600 - -# Repeat time for connect watchdog and ping -TICK = 5 -# Connect watchdog. Unit: [TICK] -CONNECT_WATCHDOG = 30/TICK - -TX_PORT = 8185 -RX_PORT = 8186 - -last_sample_value = 0 -x_range = np.arange(SIZE_NODE_DATA) -dummy_data = np.zeros(SIZE_NODE_DATA, dtype=np.int) -plot = Gnuplot.Data(x_range,dummy_data) -g = Gnuplot.Gnuplot() - -# Attention: Skip leading zero's in IPv6 address list, otherwise address comparison with received UDP packet address goes wrong -NODE_ALIAS = 0 # node name in plot -NODE_DATA = 1 # Time line with data to plot -NODE_CONNECTED = 2 # If 0, not connected, else connect_watchdog value -NODE_LAST_DATA = 3 # Storage for received sample -NODE_PLOT = 4 # Plot instance -node_data = {"bbbb::215:8d00:36:180" : ["NODE-001", np.zeros(SIZE_NODE_DATA, dtype=np.int), 0, last_sample_value, plot], - "bbbb::215:8d00:36:892" : ["NODE-196", np.zeros(SIZE_NODE_DATA, dtype=np.int), 0, last_sample_value, plot], - "bbbb::215:8d00:36:8b1" : ["NODE-193", np.zeros(SIZE_NODE_DATA, dtype=np.int), 0, last_sample_value, plot], - "bbbb::215:8d00:36:8b3" : ["NODE-198", np.zeros(SIZE_NODE_DATA, dtype=np.int), 0, last_sample_value, plot]} - -# List of all nodes derived from node_data list -node_list = node_data.keys() - -def initPlots(): - for node in range(len(node_list)): - node_data_key = node_data[node_list[node]] - g.title('Sensor Network Output') - g.ylabel('Value') - g.xlabel('Time-Span[s]') - g("set yrange [-150:150]") - g("set xrange [0:"+str(SIZE_NODE_DATA)+"]") - node_data_key[NODE_PLOT] = Gnuplot.Data(x_range,node_data_key[NODE_DATA], title=node_data_key[NODE_ALIAS] , with_='lines lw 2') - nodes = [ node_data[node_list[i]][NODE_PLOT] for i in xrange(len(node_list)) ] - g.plot(*nodes) - - - -def udpReceive(): - """RUNS ON SEPARATE THREAD """ - while True: - data, addr = s_rx.recvfrom(128) - data = data.replace("\"","").strip("\0") # strip termination byte and possible - node_data_key = node_data[addr[0]] - # Indicate node is connected - node_data_key[NODE_CONNECTED] = CONNECT_WATCHDOG - print addr[0] + ' (' + node_data_key[NODE_ALIAS] + ') : ' + data - # Write new data at index in data buffer. Data buffer is view of plot - data_lock.acquire() - node_data_key[NODE_LAST_DATA] = int(data) - data_lock.release() - -def plotGraphs(): - while True: - data_lock.acquire() - for node in range(len(node_list)): - node_data_key = node_data[node_list[node]] - for k in range(1,SIZE_NODE_DATA,1): - node_data_key[NODE_DATA][k-1] = node_data_key[NODE_DATA][k] - node_data_key[NODE_DATA][SIZE_NODE_DATA-1] = node_data_key[NODE_LAST_DATA] - if node_data_key[NODE_CONNECTED] == 0: - node_data_key[NODE_PLOT] = Gnuplot.Data(x_range,node_data_key[NODE_DATA], title=node_data_key[NODE_ALIAS], with_='dots') - else: - node_data_key[NODE_PLOT] = Gnuplot.Data(x_range,node_data_key[NODE_DATA], title=node_data_key[NODE_ALIAS], with_='lines lw 2') - nodes = [ node_data[node_list[i]][NODE_PLOT] for i in xrange(len(node_list)) ] - g.plot(*nodes) - data_lock.release() - time.sleep(1) - - -##### MAIN ##### -s_tx = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) -s_rx = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) -s_rx.bind(('', RX_PORT)) -initPlots() -data_lock = thread.allocate_lock() -thread.start_new_thread(udpReceive, ()) -thread.start_new_thread(plotGraphs, ()) -ping_node_index = 0 -ping_msg = "ping" -while True: - # Every 5 secs, one node of the list in pinged - if (ping_node_index >=len(node_list)): - ping_node_index = 0; - try: - print "ping " + node_data[node_list[ping_node_index]][NODE_ALIAS] - s_tx.sendto(ping_msg, (node_list[ping_node_index], TX_PORT)) - except: - print 'Failed to send to ' + node_list[ping_node_index] - ping_node_index += 1 - # Update connect watchdog - for node in range(len(node_list)): - node_data_key = node_data[node_list[node]] - if (node_data_key[NODE_CONNECTED] > 0): - node_data_key[NODE_CONNECTED] -= 1 - time.sleep(TICK) - - - - - diff --git a/examples/platform-specific/jn516x/tsch/tx-power-verification/README.md b/examples/platform-specific/jn516x/tsch/tx-power-verification/README.md deleted file mode 100644 index 8a3f7e008..000000000 --- a/examples/platform-specific/jn516x/tsch/tx-power-verification/README.md +++ /dev/null @@ -1,13 +0,0 @@ -The tx-power-control example can be used to check the link between a node and an rpl-border-router. -After a link is established, the following coap rresources are exposed: - -node: -Set-Tx-Power: a PUT/POST resource to set the TX power of the device. The firmware in the device will set the - TX power to the nearest available value. -Get-Tx-Power: a GET resource to retrieve the actual Tx power that is set. - - -rpl-border-router: -Get-RSSI: a GET resource that shows the detected energy level -Get-Last-RSSI:a GET resource that shows the RSSI of the last received packet. When there is only 1 node, Get-Last-RSSI will - show the effect of changing the TX power level on that node. diff --git a/examples/platform-specific/jn516x/tsch/tx-power-verification/node/Makefile b/examples/platform-specific/jn516x/tsch/tx-power-verification/node/Makefile deleted file mode 100644 index d19228f4d..000000000 --- a/examples/platform-specific/jn516x/tsch/tx-power-verification/node/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -CONTIKI_PROJECT = node - -PLATFORMS_ONLY = jn516x - -TARGET ?= jn516x -JN516x_WITH_DONGLE = 1 - -CONTIKI=../../../../../.. - -MODULES_REL += .. - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/net/app-layer/coap -MODULES += os/services/orchestra os/lib/json - -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/jn516x/tsch/tx-power-verification/node/node.c b/examples/platform-specific/jn516x/tsch/tx-power-verification/node/node.c deleted file mode 100644 index 2230f4831..000000000 --- a/examples/platform-specific/jn516x/tsch/tx-power-verification/node/node.c +++ /dev/null @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2015 NXP B.V. -* 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* -* This file is part of the Contiki operating system. -* -* Author: Theo van Daele -* -*/ -#include "contiki.h" -#include "net/ipv6/uip-ds6.h" -#include "net/routing/routing.h" -#include "net/netstack.h" -#include "net/ipv6/uip.h" -#include "net/linkaddr.h" -#include "coap-engine.h" -#include -#include -#include - -static void set_tx_power_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void get_tx_power_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); - -static char content[COAP_MAX_CHUNK_SIZE]; -static int content_len = 0; - -#define CONTENT_PRINTF(...) { if(content_len < sizeof(content)) content_len += snprintf(content+content_len, sizeof(content)-content_len, __VA_ARGS__); } - -/*---------------------------------------------------------------------------*/ -PROCESS(start_app, "START_APP"); -AUTOSTART_PROCESSES(&start_app); -/*---------------------------------------------------------------------------*/ - -/*********** sensor/ resource ************************************************/ -RESOURCE(resource_set_tx_power, - "title=\"Set TX Power\"", - NULL, - set_tx_power_handler, - set_tx_power_handler, - NULL); -static void -set_tx_power_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content = NULL; - int tx_level; - - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - tx_level = atoi((const char *)request_content); - NETSTACK_RADIO.set_value(RADIO_PARAM_TXPOWER, tx_level); - } -} - -RESOURCE(resource_get_tx_power, - "title=\"Get TX Power\"", - get_tx_power_handler, - NULL, - NULL, - NULL); -static void -get_tx_power_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - int tx_level; - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - content_len = 0; - NETSTACK_RADIO.get_value(RADIO_PARAM_TXPOWER, &tx_level); - CONTENT_PRINTF("%d", tx_level); - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(start_app, ev, data) -{ - PROCESS_BEGIN(); - static int is_coordinator = 0; - - /* Start network stack */ - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - printf("Starting RPL node\n"); - - coap_activate_resource(&resource_set_tx_power, "Set-TX-Power"); - coap_activate_resource(&resource_get_tx_power, "Get-TX-Power"); - - PROCESS_END(); -} diff --git a/examples/platform-specific/jn516x/tsch/tx-power-verification/node/project-conf.h b/examples/platform-specific/jn516x/tsch/tx-power-verification/node/project-conf.h deleted file mode 100644 index 94e17dc1c..000000000 --- a/examples/platform-specific/jn516x/tsch/tx-power-verification/node/project-conf.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2014, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \author Simon Duquennoy - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UIP_CONF_TCP 0 -#define UART_BAUD_RATE UART_RATE_115200 - -#include "../../common-conf.h" - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/platform-specific/jn516x/tsch/uart1-test-node/Makefile b/examples/platform-specific/jn516x/tsch/uart1-test-node/Makefile deleted file mode 100644 index 22c5ee216..000000000 --- a/examples/platform-specific/jn516x/tsch/uart1-test-node/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -CONTIKI_PROJECT = uart1-test-node - -PLATFORMS_ONLY = jn516x - -TARGET = jn516x -JN516x_WITH_DR1174 = 1 -TARGET_WITH_UART1 = 1 - -CONTIKI=../../../../.. - -MODULES_REL += .. - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/net/app-layer/coap -MODULES += os/services/orchestra os/lib/json - -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/jn516x/tsch/uart1-test-node/README.md b/examples/platform-specific/jn516x/tsch/uart1-test-node/README.md deleted file mode 100644 index 73eefd1ac..000000000 --- a/examples/platform-specific/jn516x/tsch/uart1-test-node/README.md +++ /dev/null @@ -1,16 +0,0 @@ -This example is a simple TSCH node used to test uart1 functionality of a JN516x on a node. -Note: uart0 is usually configured as serial port for flashing the JN516x and for logging and debug output. - -The TX output of uart1 is represented as a PUT/POST resource for a Coap client. -A string entered on a Coap plug-in of a browser will be forwarded over the wireless TSCH network to the -the TX output of UART1. - -The RX input of uart1 is represented as an OBSERVABLE resource for a Coap client. -If a string is entered on uart1 that is terminated with a Line Feed or Carriage Return, -a Coap event will notify Coap clients to issue a GET event. -This will make string available at the Coap client side. - -The example has been verified on a DR1174 evaluation board - - - \ No newline at end of file diff --git a/examples/platform-specific/jn516x/tsch/uart1-test-node/project-conf.h b/examples/platform-specific/jn516x/tsch/uart1-test-node/project-conf.h deleted file mode 100644 index d833869bb..000000000 --- a/examples/platform-specific/jn516x/tsch/uart1-test-node/project-conf.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/** - * \author Simon Duquennoy - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UIP_CONF_TCP 0 - -#define UART_BAUD_RATE UART_RATE_115200 - -#define UART1_BAUD_RATE UART_RATE_115200 - -#define UART1_CONF_TX_BUFFER_SIZE 32 - -#define UART1_CONF_RX_BUFFER_SIZE 32 - -#include "../common-conf.h" - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/platform-specific/jn516x/tsch/uart1-test-node/uart1-test-node.c b/examples/platform-specific/jn516x/tsch/uart1-test-node/uart1-test-node.c deleted file mode 100644 index 8759e8307..000000000 --- a/examples/platform-specific/jn516x/tsch/uart1-test-node/uart1-test-node.c +++ /dev/null @@ -1,254 +0,0 @@ -/* -* Copyright (c) 2015 NXP B.V. -* 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 NXP B.V. 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 NXP B.V. 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 NXP B.V. OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* -* This file is part of the Contiki operating system. -* -* Author: Theo van Daele -* -*/ -#include "contiki.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip.h" -#include "net/routing/routing.h" -#include "net/linkaddr.h" -#include "coap-engine.h" -#include "sys/ctimer.h" -#include "dev/uart-driver.h" -#include "uart1.h" -#include - -static void get_coap_rx_uart1_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void event_coap_rx_uart1_handler(void); -static void put_post_tx_uart1_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); -static void string2uart1(uint8_t *c); -static int handleRxChar(uint8_t c); -static int get_ringbuf(uint8_t *c); -static int put_ringbuf(uint8_t c); - -/* COAP helpers */ -static char content[COAP_MAX_CHUNK_SIZE]; -static int content_len = 0; -#define CONTENT_PRINTF(...) { if(content_len < sizeof(content)) content_len += snprintf(content+content_len, sizeof(content)-content_len, __VA_ARGS__); } - -/* Ringbuf: written to by uart isr. Size must be power of 2 */ -#define RINGBUF_SIZE 32 -#define RINGBUF_MAX_INDEX (RINGBUF_SIZE-1) -static char ringbuf[RINGBUF_SIZE]; -static int head_index = 1; /* index to write next data */ -static int tail_index = 0; /* index where last read took place */ - -/* String aligned buffer */ -#define RX_BUFFER_SIZE RINGBUF_SIZE -static uint8_t rx_buf[RX_BUFFER_SIZE+1]; -static uint8_t rx_buf_index = 0; /* index for rx_buf */ - -/*---------------------------------------------------------------------------*/ -PROCESS(start_app, "START_APP"); -PROCESS(rx_data_process, "RX_DATA"); -AUTOSTART_PROCESSES(&start_app, &rx_data_process); -/*---------------------------------------------------------------------------*/ - -/*********** COAP resources *************************************************/ -/*****************************************************************************/ -/* Observable resource and event handler to obtain terminal input from UART1 */ -/*****************************************************************************/ -EVENT_RESOURCE(resource_coap_rx_uart1, /* name */ - "obs;title=\"rx_uart1\"", /* attributes */ - get_coap_rx_uart1_handler, /* GET handler */ - NULL, /* POST handler */ - NULL, /* PUT handler */ - NULL, /* DELETE handler */ - event_coap_rx_uart1_handler); /* event handler */ -static void -get_coap_rx_uart1_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - unsigned int accept = -1; - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - content_len = 0; - CONTENT_PRINTF("%s", rx_buf); - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, (uint8_t *)content, content_len); - } -} - -static void -event_coap_rx_uart1_handler(void) -{ - /* Registered observers are notified and will trigger the GET handler to create the response. */ - coap_notify_observers(&resource_coap_rx_uart1); -} - -/*****************************************************************************/ -/* GET/PUT resource to send data to terminal on UART1 */ -/*****************************************************************************/ -RESOURCE(resource_coap_tx_uart1, /* name */ - "obs;title=\"tx_uart1\"", /* attributes */ - NULL, /* GET handler */ - put_post_tx_uart1_handler, /* POST handler */ - put_post_tx_uart1_handler, /* PUT handler */ - NULL); /* DELETE handler */ - -static void -put_post_tx_uart1_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *request_content = NULL; - unsigned int accept = -1; - - coap_get_header_accept(request, &accept); - if(accept == -1 || accept == TEXT_PLAIN) { - coap_get_payload(request, &request_content); - string2uart1((uint8_t *)request_content); - } -} - - -/*********** End COAP resources *********************************************/ - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(start_app, ev, data) -{ - PROCESS_BEGIN(); - static int is_coordinator = 0; - - memset(rx_buf, '\0', sizeof(rx_buf)); - /* Define process that handles data */ - process_start(&rx_data_process ,NULL); - /* Initialise UART1 */ - uart1_init(UART1_BAUD_RATE); - /* Callback received byte */ - uart1_set_input(handleRxChar); - - /* Start network stack */ - if(is_coordinator) { - NETSTACK_ROUTING.root_start(); - } - NETSTACK_MAC.on(); - printf("Starting RPL node\n"); - - coap_activate_resource(&resource_coap_rx_uart1, "UART1-RX"); - coap_activate_resource(&resource_coap_tx_uart1, "UART1-TX"); - - PROCESS_END(); -} - - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(rx_data_process, ev, data) -{ - PROCESS_BEGIN(); - - /* Process is polled whenever data is available from uart isr */ - uint8_t c; - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - /* Read RX ringbuffer. ASCII chars Output when LF is seen. - If overflowed, strings are skipped */ - do { - if (get_ringbuf(&c) == -1) { - break; /* No more rx char's in ringbuffer */ - } else { - if (rx_buf_index == RX_BUFFER_SIZE) { /* Skip current content if buffer full */ - rx_buf_index = 0; - } - rx_buf[rx_buf_index++] = c; - if ((c == '\n')||(c == '\r')) { - rx_buf[rx_buf_index] = '\0'; - printf("RX on UART1: %s", rx_buf); - /* Signal event to coap clients. - Demo assumes data is consumed before new data comes in */ - event_coap_rx_uart1_handler(); - rx_buf_index = 0; - } - } - } while (1); - } - PROCESS_END(); -} - -/*************************************************************************/ -/* Local test functions */ -/*************************************************************************/ -/* TX function for UART1 */ -static void -string2uart1(uint8_t *c) -{ - while (*c!= '\0') { - uart1_writeb(*c); - c++; - } -} - -/* handleRxChar runs on uart isr */ -static int -handleRxChar(uint8_t c) -{ - if (put_ringbuf(c) == -1) { - printf("Ringbuf full. Skip char\n"); - } else { - /* Send event to rx data handler */ - process_poll(&rx_data_process); - } - return 0; -} - -/* Simple ringbuffer - if tail==head, no data has been written yet on that position. So, empty buffer - is also initial state */ -static int -get_ringbuf(uint8_t *c) -{ - int return_val = 0; - - uart1_disable_interrupts(); - if (head_index != ((tail_index + 1)&RINGBUF_MAX_INDEX)) { - tail_index = ((tail_index + 1)& RINGBUF_MAX_INDEX); - *c = ringbuf[tail_index]; - } else { - return_val = -1; - } - uart1_enable_interrupts(); - return return_val; -} - -static int -put_ringbuf(uint8_t c) -{ - int return_val = 0; - - uart1_disable_interrupts(); - if (head_index != tail_index) { - ringbuf[head_index] = c; - head_index = ((head_index+1)&RINGBUF_MAX_INDEX); - } else { - return_val = -1; - } - uart1_enable_interrupts(); - return return_val; -} diff --git a/examples/platform-specific/nrf52dk/blink-hello/Makefile b/examples/platform-specific/nrf52dk/blink-hello/Makefile deleted file mode 100644 index 393a385c3..000000000 --- a/examples/platform-specific/nrf52dk/blink-hello/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = blink-hello - -MAKE_ROUTING = MAKE_ROUTING_NULLROUTING -MAKE_MAC=MAKE_MAC_NULLMAC -NRF52_WITHOUT_SOFTDEVICE=1 - -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = nrf52dk - -CONTIKI = ../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/nrf52dk/blink-hello/Makefile.target b/examples/platform-specific/nrf52dk/blink-hello/Makefile.target deleted file mode 100644 index 3853b313a..000000000 --- a/examples/platform-specific/nrf52dk/blink-hello/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = nrf52dk diff --git a/examples/platform-specific/nrf52dk/blink-hello/README.md b/examples/platform-specific/nrf52dk/blink-hello/README.md deleted file mode 100644 index 00064f993..000000000 --- a/examples/platform-specific/nrf52dk/blink-hello/README.md +++ /dev/null @@ -1,14 +0,0 @@ -Blink Hello example -=================== -This example shows basic usage of DK's buttons and LEDs. It also shows basic -usage of Contiki's processes. The application autostarts 5 processes: 4 processes -for button and LED control and 1 to display current temperature to the console. - -A process reacts to a press of a respective button (process 1 reacts to button 1, etc.) -and doubles the current blinking frequency. The cycle restarts for beginning when blinking -frequency is greater than 8Hz. - -The example requires one DK and it doesn't use SoftDevice. To compile and flash the -example run: - - make TARGET=nrf52dk blink-hello.flash \ No newline at end of file diff --git a/examples/platform-specific/nrf52dk/blink-hello/blink-hello.c b/examples/platform-specific/nrf52dk/blink-hello/blink-hello.c deleted file mode 100644 index ebc1e451c..000000000 --- a/examples/platform-specific/nrf52dk/blink-hello/blink-hello.c +++ /dev/null @@ -1,182 +0,0 @@ -/* This is a very simple hello_world program. - * It aims to demonstrate the co-existence of two processes: - * One of them prints a hello world message and the other blinks the LEDs - * - * It is largely based on hello_world in $(CONTIKI)/examples/sensinode - * - * Author: George Oikonomou - - */ - -/** - * \addtogroup nrf52dk nRF52 Development Kit - * @{ - * - * \addtogroup nrf52dk-examples Demo projects for nRF52 DK - * @{ - * - * \defgroup nrf52dk-blink-hello Basic sensors and LEDs demo - * @{ - * - * This demo demonstrates use of Contiki processes, sensors, and LEDs - * on nRF52 DK. Pressing a button will start a timer that blinks a - * respective LED (e.g., button 1 controls LED 1). Each time the button - * is pressed blinking frequency is doubled. On 4th press the LED is - * switched off and the sequence can be started from the beginning. - * - * \file Main file for Basic sensors and LEDs demo. - */ -#include /* For printf() */ -#include -#include "contiki.h" -#include "dev/leds.h" -#include "dev/temperature-sensor.h" -#include "lib/sensors.h" -#include "button-sensor.h" - -/*---------------------------------------------------------------------------*/ -PROCESS(blink_process_1, "LED1 blink process"); -PROCESS(blink_process_2, "LED2 blink process"); -PROCESS(blink_process_3, "LED3 blink process"); -PROCESS(blink_process_4, "LED4 blink process"); -PROCESS(temp, "Temperautre"); - -AUTOSTART_PROCESSES( - &blink_process_1, - &blink_process_2, - &blink_process_3, - &blink_process_4, - &temp -); - -struct blink_process_ctx { - struct etimer et_blink; - unsigned char c; - const struct sensors_sensor *button; - unsigned char led; -}; - -static void handle_event(process_event_t ev, process_data_t data, struct blink_process_ctx *ctx) -{ - if (ev == PROCESS_EVENT_TIMER && etimer_expired(&ctx->et_blink)) { - leds_toggle(ctx->led); - etimer_set(&ctx->et_blink, CLOCK_SECOND / ctx->c); - printf("Blink %d\n", ctx->led); - } else if (ev == sensors_event && data == ctx->button) { - if (ctx->button->value(BUTTON_SENSOR_VALUE_STATE) == 0) { - if (ctx->c == 0) { - ctx->c = 1; - } else if (ctx->c < 8){ - ctx->c <<= 1; - } else { - ctx->c = 0; - leds_off(ctx->led); - } - if (ctx->c) { - etimer_set(&ctx->et_blink, CLOCK_SECOND / ctx->c); - } else { - etimer_stop(&ctx->et_blink); - } - } - } -} - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(blink_process_1, ev, data) -{ - static struct blink_process_ctx ctx; - - PROCESS_BEGIN(); - - ctx.button = &button_1; - ctx.c = 0; - ctx.led = LEDS_1; - ctx.button->configure(SENSORS_ACTIVE, 1); - - while (1) { - PROCESS_WAIT_EVENT(); - handle_event(ev, data, &ctx); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(blink_process_2, ev, data) -{ - static struct blink_process_ctx ctx; - - PROCESS_BEGIN(); - - ctx.button = &button_2; - ctx.c = 0; - ctx.led = LEDS_2; - ctx.button->configure(SENSORS_ACTIVE, 1); - - while (1) { - PROCESS_WAIT_EVENT(); - handle_event(ev, data, &ctx); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(blink_process_3, ev, data) -{ - static struct blink_process_ctx ctx; - - PROCESS_BEGIN(); - - ctx.button = &button_3; - ctx.c = 0; - ctx.led = LEDS_3; - ctx.button->configure(SENSORS_ACTIVE, 1); - - while (1) { - PROCESS_WAIT_EVENT(); - handle_event(ev, data, &ctx); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(blink_process_4, ev, data) -{ - static struct blink_process_ctx ctx; - - PROCESS_BEGIN(); - - ctx.button = &button_4; - ctx.c = 0; - ctx.led = LEDS_4; - ctx.button->configure(SENSORS_ACTIVE, 1); - - while (1) { - PROCESS_WAIT_EVENT(); - handle_event(ev, data, &ctx); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(temp, ev, data) -{ - static struct etimer tick; - PROCESS_BEGIN(); - - etimer_set(&tick, CLOCK_SECOND); - - while (1) { - PROCESS_WAIT_EVENT(); - if (ev == PROCESS_EVENT_TIMER && etimer_expired(&tick)) { - int32_t temp = temperature_sensor.value(0); - printf("temp: %"PRId32".%02"PRId32"\n", temp >> 2, (temp & 0x03)*25); - etimer_reset(&tick); - } - } - - PROCESS_END(); -} -/** - * @} - * @} - * @} - */ diff --git a/examples/platform-specific/nrf52dk/coap-demo/README.md b/examples/platform-specific/nrf52dk/coap-demo/README.md deleted file mode 100644 index 1262ce114..000000000 --- a/examples/platform-specific/nrf52dk/coap-demo/README.md +++ /dev/null @@ -1,63 +0,0 @@ -A CoAP demo for nRF52 DK -======================== -This demo contains two applications: coap-server and coap-client which are similar to -[Coap Observable Server] and [Coap Observer Client] examples provided by the nRF5 IoT SDK. - -Note that before any CoAP requests can be made you'll need to configure an IPv6 connection -to the device and assign a routable IPv6 address. - -For details how to do this please refer to sections 'Establishing an IPv6 connection' -and 'Distributing routable IPv6 prefix' in `platform/nrf52dk/README-BLE-6LoWPAN.md`. - -CoAP Server -=========== -The server exposes the following resources: - - host - |-- .well-known - | `-- core - `-- lights - `-- led3 - -The state of LED 3 can be set and queried via CoAP through the observable resource `lights/led3`. Current -state of LED 3 is returned as a text string in the payload. The value 0 means that LED 3 is off, 1 otherwise. - -Button 1 can be used to toggle state of the LED 3. This will cause a notification to be sent to -any subscriber observing `lights/led3`. The state of the resource can also be changed by using POST/PUT to -the resource with desired state encoded as a text in the payload. Send 1 to switch on and 0 to switch off. - -In order to compile and flash the CoAP server to a DK execute: - - make TARGET=nrf52dk coap-server.flash - -Note, if you haven't previously used a given device with Contiki it is recommended -to erase the device and flash SoftDevice before flashing CoAP application, i.e., - - make TARGET=nrf52dk erase - make TARGET=nrf52dk softdevice.flash - -Please refer to the *Testing* and *Python Example* sections of [Coap Observable Server] tutorial for detailed description how to query the Coap Server using a PC. - -CoAP Client -=========== -CoAP client compliments the CoAP server application. When Button 1 on the DK is pressed the the -client subscribes to `lights/led3` resource. If successful the LED 4 will blink briefly. From this moment -any change of the `lights/led3` resource will be automatically reflected by the client's LED 3. - -Note that the client must know the server's IPv6 address. The address is specified as a make variable -during compliation. - -In order to compile and flash the CoAP client to DK execute: - - make TARGET=nrf52dk SERVER_IPV6_ADDR= coap-client.flash - -Note, that you can use `NRF52_JLINK_SN=` to select a particular devkit in a case when -you have more than one boards connected to PC. Please refer to `platform/README.md` for -details. - -Please refer to the *Testing* and *Python Server Example* sections of [Coap Observer Client] tutorial for detailed description how to use CoAP client demo with a PC. - -Resources -========= -[Coap Observable Server] http://developer.nordicsemi.com/nRF5_IoT_SDK/doc/0.9.0/html/a00054.html -[Coap Observer Client] http://developer.nordicsemi.com/nRF5_IoT_SDK/doc/0.9.0/html/a00051.html diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile b/examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile deleted file mode 100644 index b7a5ff778..000000000 --- a/examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -CONTIKI_PROJECT = coap-client -CONTIKI=../../../../.. - -PLATFORMS_ONLY = nrf52dk - -ifeq ($(SERVER_IPV6_EP),) -$(warning Please define SERVER_IPV6_EP=) -$(warning Using default SERVER_IPV6_EP=fd00::1) -SERVER_IPV6_EP=fd00::1 -endif - -CFLAGS += -DSERVER_IPV6_EP=\"$(SERVER_IPV6_EP)\" - -CFLAGS += -DDEVICE_NAME=\"nRF52_DK_CoAP_Client\" - -CFLAGS += -DCOAP_OBSERVE_CLIENT=1 - -# automatically build RESTful resources -MODULES_REL += ./resources - -# REST Engine shall use Erbium CoAP implementation -MODULES += os/net/app-layer/coap - -MAKE_ROUTING = MAKE_ROUTING_NULLROUTING - -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile.target b/examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile.target deleted file mode 100644 index 3853b313a..000000000 --- a/examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = nrf52dk diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-client/coap-client.c b/examples/platform-specific/nrf52dk/coap-demo/coap-client/coap-client.c deleted file mode 100644 index 916c06603..000000000 --- a/examples/platform-specific/nrf52dk/coap-demo/coap-client/coap-client.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2014, Daniele Alessandrelli. - * Copyright (c) 2015, Nordic Semiconductor - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup nrf52dk-examples Demo projects for nRF52 DK - * @{ - * - * \defgroup nrf52dk-coap-demo CoAP demo for nRF52 DK - * @{ - * - * \file - * Erbium (Er) CoAP observe client example. - * \author - * Daniele Alessandrelli - * \author - * Wojciech Bober - */ - -#include -#include -#include -#include "contiki.h" -#include "contiki-net.h" -#include "coap-engine.h" -#include "coap-endpoint.h" -#include "dev/button-sensor.h" -#include "dev/leds.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/*----------------------------------------------------------------------------*/ -#define OBS_RESOURCE_URI "lights/led3" -#define SUBS_LED LEDS_4 -#define OBS_LED LEDS_3 - -/*----------------------------------------------------------------------------*/ -static coap_observee_t *obs; -static struct ctimer ct; -/*----------------------------------------------------------------------------*/ -PROCESS(er_example_observe_client, "nRF52 DK Coap Observer Client"); -AUTOSTART_PROCESSES(&er_example_observe_client); -/*----------------------------------------------------------------------------*/ -static void -observe_led_off(void *d) -{ - leds_off(SUBS_LED); -} -/*----------------------------------------------------------------------------*/ -/* - * Handle the response to the observe request and the following notifications - */ -static void -notification_callback(coap_observee_t *obs, void *notification, - coap_notification_flag_t flag) -{ - int len = 0; - const uint8_t *payload = NULL; - - - PRINTF("Notification handler\n"); - PRINTF("Observee URI: %s\n", obs->url); - - if (notification) { - len = coap_get_payload(notification, &payload); - } - - (void)len; - - switch (flag) { - case NOTIFICATION_OK: - PRINTF("NOTIFICATION OK: %*s\n", len, (char *)payload); - if (*payload == '1') { - leds_on(OBS_LED); - } else { - leds_off(OBS_LED); - } - break; - case OBSERVE_OK: /* server accepeted observation request */ - PRINTF("OBSERVE_OK: %*s\n", len, (char *)payload); - if (*payload == '1') { - leds_on(OBS_LED); - } else { - leds_off(OBS_LED); - } - leds_on(SUBS_LED); - ctimer_set(&ct, CLOCK_SECOND, observe_led_off, NULL); - break; - case OBSERVE_NOT_SUPPORTED: - PRINTF("OBSERVE_NOT_SUPPORTED: %*s\n", len, (char *)payload); - obs = NULL; - break; - case ERROR_RESPONSE_CODE: - PRINTF("ERROR_RESPONSE_CODE: %*s\n", len, (char *)payload); - obs = NULL; - break; - case NO_REPLY_FROM_SERVER: - PRINTF("NO_REPLY_FROM_SERVER: " - "removing observe registration with token %x%x\n", - obs->token[0], obs->token[1]); - obs = NULL; - break; - } -} -/*----------------------------------------------------------------------------*/ -/* - * The main (proto-)thread. It starts/stops the observation of the remote - * resource every time the timer elapses or the button (if available) is - * pressed - */ -PROCESS_THREAD(er_example_observe_client, ev, data) -{ - PROCESS_BEGIN(); - static coap_endpoint_t server_endpoint; - coap_endpoint_parse(SERVER_IPV6_EP, strlen(SERVER_IPV6_EP), &server_endpoint); - -#if PLATFORM_HAS_BUTTON - SENSORS_ACTIVATE(button_1); - SENSORS_ACTIVATE(button_2); -#endif - - /* toggle observation every time the timer elapses or the button is pressed */ - while (1) { - PROCESS_YIELD(); -#if PLATFORM_HAS_BUTTON - if (ev == sensors_event) { - if (data == &button_1 && button_1.value(BUTTON_SENSOR_VALUE_STATE) == 0) { - PRINTF("Starting observation\n"); - obs = coap_obs_request_registration(&server_endpoint, - OBS_RESOURCE_URI, notification_callback, - NULL); - } - if (data == &button_2 && button_2.value(BUTTON_SENSOR_VALUE_STATE) == 0) { - PRINTF("Stopping observation\n"); - coap_obs_remove_observee(obs); - obs = NULL; - } - } -#endif - } - PROCESS_END(); -} - -/** - * @} - * @} - */ diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile b/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile deleted file mode 100644 index 0202f0e92..000000000 --- a/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -CONTIKI_PROJECT = coap-server -CONTIKI=../../../../.. - -PLATFORMS_ONLY = nrf52dk - -CFLAGS += -DDEVICE_NAME=\"nRF52-DK-CoAP-Server\" - -# automatically build RESTful resources -REST_RESOURCES_DIR = ../resources -REST_RESOURCES_FILES = $(notdir $(shell find $(REST_RESOURCES_DIR) -name '*.c' ! -name 'res-plugtest*')) - -PROJECTDIRS += $(REST_RESOURCES_DIR) -PROJECT_SOURCEFILES += $(REST_RESOURCES_FILES) - -# REST Engine shall use Erbium CoAP implementation -MODULES += os/net/app-layer/coap - -MAKE_ROUTING = MAKE_ROUTING_NULLROUTING - -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile.target b/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile.target deleted file mode 100644 index 3853b313a..000000000 --- a/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = nrf52dk diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-server/coap-server.c b/examples/platform-specific/nrf52dk/coap-demo/coap-server/coap-server.c deleted file mode 100644 index 9e38d5d3a..000000000 --- a/examples/platform-specific/nrf52dk/coap-demo/coap-server/coap-server.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * Copyright (c) 2015, Nordic Semiconductor - * - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup nrf52dk-examples Demo projects for nRF52 DK - * @{ - * - * \defgroup nrf52dk-coap-demo CoAP demo for nRF52dk - * @{ - * - * \file - * Erbium (Er) REST Engine example. - * \author - * Matthias Kovatsch - * \author - * Wojciech Bober - */ - -#include -#include -#include -#include "contiki.h" -#include "contiki-net.h" -#include "coap-engine.h" -#include "uip.h" -#include "dev/button-sensor.h" -#include "dev/leds.h" - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -/* - * Resources to be activated need to be imported through the extern keyword. - * The build system automatically compiles the resources in the corresponding sub-directory. - */ -extern coap_resource_t res_led3; - -static void -print_local_addresses(void) -{ - int i; - uint8_t state; - - PRINTF("Server IPv6 addresses:\n"); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && (state == ADDR_TENTATIVE || state - == ADDR_PREFERRED)) { - PRINTF(" "); - PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr); - PRINTF("\n"); - if(state == ADDR_TENTATIVE) { - uip_ds6_if.addr_list[i].state = ADDR_PREFERRED; - } - } - } -} - -PROCESS(er_example_server, "nRF52 DK Coap Server"); -AUTOSTART_PROCESSES(&er_example_server); - -PROCESS_THREAD(er_example_server, ev, data) -{ - PROCESS_BEGIN(); - PROCESS_PAUSE(); - - PRINTF("Starting Erbium Example Server\n"); - - PRINTF("uIP buffer: %u\n", UIP_BUFSIZE); - PRINTF("IP+UDP header: %u\n", UIP_IPUDPH_LEN); - PRINTF("REST max chunk: %u\n", COAP_MAX_CHUNK_SIZE); - - print_local_addresses(); - - coap_activate_resource(&res_led3, "lights/led3"); - - SENSORS_ACTIVATE(button_1); - - /* Define application-specific events here. */ - while (1) { - PROCESS_WAIT_EVENT(); - - if (ev == sensors_event) { - if (data == &button_1 && button_1.value(BUTTON_SENSOR_VALUE_STATE) == 0) { - leds_toggle(LEDS_3); - res_led3.trigger(); - } - } - } - - PROCESS_END(); -} - -/** - * @} - * @} - */ diff --git a/examples/platform-specific/nrf52dk/coap-demo/project-conf.h b/examples/platform-specific/nrf52dk/coap-demo/project-conf.h deleted file mode 100644 index 3de6ff08e..000000000 --- a/examples/platform-specific/nrf52dk/coap-demo/project-conf.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup nrf52dk-examples Demo projects for nRF52 DK - * @{ - * - * \defgroup nrf52dk-coap-demo CoAP demo for nRF52dk - * @{ - * - * \file - * Erbium (Er) example project configuration. - * \author - * Matthias Kovatsch - */ - -#ifndef __PROJECT_ERBIUM_CONF_H__ -#define __PROJECT_ERBIUM_CONF_H__ - -/* Disabling TCP on CoAP nodes. */ -#define UIP_CONF_TCP 0 - -/* Increase rpl-border-router IP-buffer when using more than 64. */ -#define REST_MAX_CHUNK_SIZE 48 - -/* Estimate your header size, especially when using Proxy-Uri. */ -/* - #define COAP_MAX_HEADER_SIZE 70 - */ - -/* Multiplies with chunk size, be aware of memory constraints. */ -#define COAP_MAX_OPEN_TRANSACTIONS 4 - -/* Must be <= open transactions, default is COAP_MAX_OPEN_TRANSACTIONS-1. */ -/* - #define COAP_MAX_OBSERVERS 2 - */ - -/* Filtering .well-known/core per query can be disabled to save space. */ -#define COAP_LINK_FORMAT_FILTERING 0 -#define COAP_PROXY_OPTION_PROCESSING 0 - -/* Enable client-side support for COAP observe */ -#define COAP_OBSERVE_CLIENT 1 -#endif /* __PROJECT_ERBIUM_CONF_H__ */ - -/** - * @} - * @} - */ diff --git a/examples/platform-specific/nrf52dk/coap-demo/resources/res-leds.c b/examples/platform-specific/nrf52dk/coap-demo/resources/res-leds.c deleted file mode 100644 index 695eca6a2..000000000 --- a/examples/platform-specific/nrf52dk/coap-demo/resources/res-leds.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Example resource - * \author - * Matthias Kovatsch - * \author - * Wojciech Bober - */ - -#include -#include "contiki.h" -#include "coap.h" -#include "coap-engine.h" -#include "dev/leds.h" - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -static void -res_post_put_handler(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset); - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, int32_t *offset); - -static void -res_event_handler(void); - -/*A simple actuator example, depending on the color query parameter and post variable mode, corresponding led is activated or deactivated*/ -EVENT_RESOURCE(res_led3, - "title=\"LED3\"; obs", - res_get_handler, - res_post_put_handler, - res_post_put_handler, - NULL, - res_event_handler - ); - -static void -res_post_put_handler(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - const uint8_t *payload; - coap_get_payload(request, &payload); - - if(*payload == '0' || *payload == '1') { - if(*payload == '1') { - leds_on(LEDS_3); - } else { - leds_off(LEDS_3); - } - coap_notify_observers(&res_led3); - coap_set_status_code(response, CHANGED_2_04); - } else { - coap_set_status_code(response, BAD_REQUEST_4_00); - } -} - -static void -res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) -{ - coap_set_header_content_format(response, TEXT_PLAIN); - coap_set_payload(response, buffer, snprintf((char *)buffer, preferred_size, "%d", (leds_get() & LEDS_3) ? 1 : 0)); -} - -/* - * Additionally, res_event_handler must be implemented for each EVENT_RESOURCE. - * It is called through .trigger(), usually from the server process. - */ -static void -res_event_handler() -{ - /* Notify the registered observers which will trigger the res_get_handler to create the response. */ - coap_notify_observers(&res_led3); -} diff --git a/examples/platform-specific/nrf52dk/mqtt-demo/Makefile b/examples/platform-specific/nrf52dk/mqtt-demo/Makefile deleted file mode 100644 index dc3e23e67..000000000 --- a/examples/platform-specific/nrf52dk/mqtt-demo/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -CONTIKI_PROJECT = mqtt-demo -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = nrf52dk - -MAKE_ROUTING = MAKE_ROUTING_NULLROUTING - -MODULES += os/net/app-layer/mqtt - -CONTIKI=../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/nrf52dk/mqtt-demo/Makefile.target b/examples/platform-specific/nrf52dk/mqtt-demo/Makefile.target deleted file mode 100644 index 3853b313a..000000000 --- a/examples/platform-specific/nrf52dk/mqtt-demo/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = nrf52dk diff --git a/examples/platform-specific/nrf52dk/mqtt-demo/README.md b/examples/platform-specific/nrf52dk/mqtt-demo/README.md deleted file mode 100644 index a4a9a6ff1..000000000 --- a/examples/platform-specific/nrf52dk/mqtt-demo/README.md +++ /dev/null @@ -1,74 +0,0 @@ -MQTT Demo -========= -The MQTT client can be used to: - -* Publish sensor readings to an MQTT broker. -* Subscribe to a topic and receive commands from an MQTT broker - -The demo will give some visual feedback with the green LED: -* Very fast blinking: Searching for a network -* Fast blinking: Connecting to broker -* Slow, long blinking: Sending a publish message - -Note that before any MQTT messages can be sent or received you'll -need to configure an IPv6 connection to the device and assign a routable -IPv6 address. - -For details how to do this please refer to sections 'Establishing an IPv6 connection' -and 'Distributing routable IPv6 prefix' in `platform/nrf52dk/README-BLE-6LoWPAN.md`. - -Broker setup ------------- -By default the example will attempt to publish readings to an MQTT broker -running on the IPv6 address specified as `MQTT_DEMO_BROKER_IP_ADDR` in -`project-conf.h`. This functionality was tested successfully with -[mosquitto](http://mosquitto.org/). - -On Ubuntu you can install and run mosquitto broker using the following -commands: - - apt-get install mosquitto mosquitto_clients - killall mosquitto - mosquitto -p 1883 -v - -Publishing ----------- -The publish messages include sensor readings but also some other information, -such as device uptime in seconds and a message sequence number. The demo will -publish to topic `iot-2/evt/status/fmt/json`. The device will connect using -client-id `d:quickstart:cc2538:`, where `` gets -constructed from the device's IEEE address. - -Subscribing ------------ -You can also subscribe to topics and receive commands, but this will only -work if you use "Org ID" != 'quickstart'. To achieve this, you will need to -change 'Org ID' (`DEFAULT_ORG_ID`). In this scenario, the device will subscribe -to: - -`iot-2/cmd/+/fmt/json` - -You can then use this to toggle LEDs. To do this, you can for example -use mosquitto client to publish to `iot-2/cmd/leds/fmt/json`. So, to change -the state of an LED, you would do this: - -`mosquitto_pub -h -m "1" -t iot-2/cmd/leds/fmt/json` - -Where `broker IP` should be replaced with the IP address of your mosquitto -broker (the one where you device has subscribed). Replace `-m "1'` with `-m "0"` -to turn the LED back off. - -Bear in mind that, even though the topic suggests that messages are of json -format, they are in fact not. This was done in order to avoid linking a json -parser into the firmware. This comment only applies to parsing incoming -messages, outgoing publish messages use proper json payload. - -IBM Quickstart Service ----------------------- -It is also possible to publish to IBM's quickstart service. To do so, you need -to undefine `MQTT_DEMO_BROKER_IP_ADDR`. - -If you want to use IBM's cloud service with a registered device, change -'Org ID' (`DEFAULT_ORG_ID`) and provide the 'Auth Token' (`DEFAULT_AUTH_TOKEN`), -which acts as a 'password', but bear in mind that it gets transported in clear -text. \ No newline at end of file diff --git a/examples/platform-specific/nrf52dk/mqtt-demo/mqtt-demo.c b/examples/platform-specific/nrf52dk/mqtt-demo/mqtt-demo.c deleted file mode 100644 index 6fa071617..000000000 --- a/examples/platform-specific/nrf52dk/mqtt-demo/mqtt-demo.c +++ /dev/null @@ -1,722 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2015, Nordic Semiconductor - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup nrf52dk-examples Demo projects for nRF52 DK - * @{ - * - * \defgroup nrf52dk-mqtt-demo nRF52 DK MQTT Demo Project - * - * Demonstrates MQTT functionality. Works with mosquitto. - * @{ - * - * \file - * An MQTT example for the nrf52dk platform - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "mqtt.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-icmp6.h" -#include "net/ipv6/sicslowpan.h" -#include "sys/etimer.h" -#include "sys/ctimer.h" -#include "lib/sensors.h" -#include "dev/button-sensor.h" -#include "dev/temperature-sensor.h" -#include "dev/leds.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/* - * IBM server: quickstart.messaging.internetofthings.ibmcloud.com - * (184.172.124.189) mapped in an NAT64 (prefix 64:ff9b::/96) IPv6 address - * Note: If not able to connect; lookup the IP address again as it may change. - * - * Alternatively, publish to a local MQTT broker (e.g. mosquitto) running on - * the node that hosts your border router - */ -#ifdef MQTT_DEMO_BROKER_IP_ADDR -static const char *broker_ip = MQTT_DEMO_BROKER_IP_ADDR; -#define DEFAULT_ORG_ID "mqtt-demo" -#else -static const char *broker_ip = "0064:ff9b:0000:0000:0000:0000:b8ac:7cbd"; -#define DEFAULT_ORG_ID "quickstart" -#endif -/*---------------------------------------------------------------------------*/ -/* - * A timeout used when waiting for something to happen (e.g. to connect or to - * disconnect) - */ -#define STATE_MACHINE_PERIODIC (CLOCK_SECOND >> 1) -/*---------------------------------------------------------------------------*/ -/* Provide visible feedback via LEDS during various states */ -/* When connecting to broker */ -#define CONNECTING_LED_DURATION (CLOCK_SECOND >> 2) - -/* Each time we try to publish */ -#define PUBLISH_LED_ON_DURATION (CLOCK_SECOND) -/*---------------------------------------------------------------------------*/ -/* Connections and reconnections */ -#define RETRY_FOREVER 0xFF -#define RECONNECT_INTERVAL (CLOCK_SECOND * 2) - -/* - * Number of times to try reconnecting to the broker. - * Can be a limited number (e.g. 3, 10 etc) or can be set to RETRY_FOREVER - */ -#define RECONNECT_ATTEMPTS RETRY_FOREVER -#define CONNECTION_STABLE_TIME (CLOCK_SECOND * 5) -static struct timer connection_life; -static uint8_t connect_attempt; -/*---------------------------------------------------------------------------*/ -/* Various states */ -static uint8_t state; -#define STATE_INIT 0 -#define STATE_REGISTERED 1 -#define STATE_CONNECTING 2 -#define STATE_CONNECTED 3 -#define STATE_PUBLISHING 4 -#define STATE_DISCONNECTED 5 -#define STATE_NEWCONFIG 6 -#define STATE_CONFIG_ERROR 0xFE -#define STATE_ERROR 0xFF -/*---------------------------------------------------------------------------*/ -#define CONFIG_ORG_ID_LEN 32 -#define CONFIG_TYPE_ID_LEN 32 -#define CONFIG_AUTH_TOKEN_LEN 32 -#define CONFIG_EVENT_TYPE_ID_LEN 32 -#define CONFIG_CMD_TYPE_LEN 8 -#define CONFIG_IP_ADDR_STR_LEN 64 -/*---------------------------------------------------------------------------*/ -#define RSSI_MEASURE_INTERVAL_MAX 86400 /* secs: 1 day */ -#define RSSI_MEASURE_INTERVAL_MIN 5 /* secs */ -#define PUBLISH_INTERVAL_MAX 86400 /* secs: 1 day */ -#define PUBLISH_INTERVAL_MIN 5 /* secs */ -/*---------------------------------------------------------------------------*/ -/* A timeout used when waiting to connect to a network */ -#define NET_CONNECT_PERIODIC CLOCK_SECOND -#define NO_NET_LED_DURATION (NET_CONNECT_PERIODIC >> 1) -/*---------------------------------------------------------------------------*/ -/* Default configuration values */ -#define DEFAULT_TYPE_ID "nrf52dk" -#define DEFAULT_AUTH_TOKEN "AUTHZ" -#define DEFAULT_EVENT_TYPE_ID "status" -#define DEFAULT_SUBSCRIBE_CMD_TYPE "+" -#define DEFAULT_BROKER_PORT 1883 -#define DEFAULT_PUBLISH_INTERVAL (30 * CLOCK_SECOND) -#define DEFAULT_KEEP_ALIVE_TIMER 60 -#define DEFAULT_RSSI_MEAS_INTERVAL (CLOCK_SECOND * 30) -/*---------------------------------------------------------------------------*/ -/* Take a sensor reading on button press */ -#define PUBLISH_TRIGGER (&button_sensor) - -/* Payload length of ICMPv6 echo requests used to measure RSSI with def rt */ -#define ECHO_REQ_PAYLOAD_LEN 20 -/*---------------------------------------------------------------------------*/ -PROCESS_NAME(mqtt_demo_process); -AUTOSTART_PROCESSES(&mqtt_demo_process); -/*---------------------------------------------------------------------------*/ -/** - * \brief Data structure declaration for the MQTT client configuration - */ -typedef struct mqtt_client_config { - char org_id[CONFIG_ORG_ID_LEN]; - char type_id[CONFIG_TYPE_ID_LEN]; - char auth_token[CONFIG_AUTH_TOKEN_LEN]; - char event_type_id[CONFIG_EVENT_TYPE_ID_LEN]; - char broker_ip[CONFIG_IP_ADDR_STR_LEN]; - char cmd_type[CONFIG_CMD_TYPE_LEN]; - clock_time_t pub_interval; - int def_rt_ping_interval; - uint16_t broker_port; -} mqtt_client_config_t; -/*---------------------------------------------------------------------------*/ -/* Maximum TCP segment size for outgoing segments of our socket */ -#define MAX_TCP_SEGMENT_SIZE 32 -/*---------------------------------------------------------------------------*/ -#define STATUS_LED LEDS_GREEN -/*---------------------------------------------------------------------------*/ -/* - * Buffers for Client ID and Topic. - * Make sure they are large enough to hold the entire respective string - * - * d:quickstart:status:EUI64 is 32 bytes long - * iot-2/evt/status/fmt/json is 25 bytes - * We also need space for the null termination - */ -#define BUFFER_SIZE 64 -static char client_id[BUFFER_SIZE]; -static char pub_topic[BUFFER_SIZE]; -static char sub_topic[BUFFER_SIZE]; -/*---------------------------------------------------------------------------*/ -/* - * The main MQTT buffers. - * We will need to increase if we start publishing more data. - */ -#define APP_BUFFER_SIZE 128 -static struct mqtt_connection conn; -static char app_buffer[APP_BUFFER_SIZE]; -/*---------------------------------------------------------------------------*/ -#define QUICKSTART "quickstart" -/*---------------------------------------------------------------------------*/ -static struct mqtt_message *msg_ptr = 0; -static struct etimer publish_periodic_timer; -static struct ctimer ct; -static char *buf_ptr; -static uint16_t seq_nr_value = 0; -/*---------------------------------------------------------------------------*/ -/* Parent RSSI functionality */ -static struct uip_icmp6_echo_reply_notification echo_reply_notification; -static struct etimer echo_request_timer; -static int def_rt_rssi = 0; -/*---------------------------------------------------------------------------*/ -static mqtt_client_config_t conf; -/*---------------------------------------------------------------------------*/ -PROCESS(mqtt_demo_process, "MQTT Demo"); -/*---------------------------------------------------------------------------*/ -int -ipaddr_sprintf(char *buf, uint8_t buf_len, const uip_ipaddr_t *addr) -{ - uint16_t a; - uint8_t len = 0; - int i, f; - for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) { - a = (addr->u8[i] << 8) + addr->u8[i + 1]; - if(a == 0 && f >= 0) { - if(f++ == 0) { - len += snprintf(&buf[len], buf_len - len, "::"); - } - } else { - if(f > 0) { - f = -1; - } else if(i > 0) { - len += snprintf(&buf[len], buf_len - len, ":"); - } - len += snprintf(&buf[len], buf_len - len, "%x", a); - } - } - - return len; -} -/*---------------------------------------------------------------------------*/ -static void -echo_reply_handler(uip_ipaddr_t *source, uint8_t ttl, uint8_t *data, - uint16_t datalen) -{ - if(uip_ip6addr_cmp(source, uip_ds6_defrt_choose())) { - def_rt_rssi = sicslowpan_get_last_rssi(); - } -} -/*---------------------------------------------------------------------------*/ -static void -publish_led_off(void *d) -{ - leds_off(STATUS_LED); -} -/*---------------------------------------------------------------------------*/ -static void -pub_handler(const char *topic, uint16_t topic_len, const uint8_t *chunk, - uint16_t chunk_len) -{ - DBG("Pub Handler: topic='%s' (len=%u), chunk_len=%u\n", topic, topic_len, - chunk_len); - - /* If we don't like the length, ignore */ - if(topic_len != 23 || chunk_len != 1) { - printf("Incorrect topic or chunk len. Ignored\n"); - return; - } - - /* If the format != json, ignore */ - if(strncmp(&topic[topic_len - 4], "json", 4) != 0) { - printf("Incorrect format\n"); - } - - if(strncmp(&topic[10], "leds", 4) == 0) { - if(chunk[0] == '1') { - leds_on(LEDS_RED); - } else if(chunk[0] == '0') { - leds_off(LEDS_RED); - } - return; - } -} -/*---------------------------------------------------------------------------*/ -static void -mqtt_event(struct mqtt_connection *m, mqtt_event_t event, void *data) -{ - switch(event) { - case MQTT_EVENT_CONNECTED: { - DBG("APP - Application has a MQTT connection\n"); - timer_set(&connection_life, CONNECTION_STABLE_TIME); - state = STATE_CONNECTED; - break; - } - case MQTT_EVENT_DISCONNECTED: { - DBG("APP - MQTT Disconnect. Reason %u\n", *((mqtt_event_t *)data)); - - state = STATE_DISCONNECTED; - process_poll(&mqtt_demo_process); - break; - } - case MQTT_EVENT_PUBLISH: { - msg_ptr = data; - - /* Implement first_flag in publish message? */ - if(msg_ptr->first_chunk) { - msg_ptr->first_chunk = 0; - DBG("APP - Application received a publish on topic '%s'. Payload " - "size is %i bytes. Content:\n\n", - msg_ptr->topic, msg_ptr->payload_length); - } - - pub_handler(msg_ptr->topic, strlen(msg_ptr->topic), msg_ptr->payload_chunk, - msg_ptr->payload_length); - break; - } - case MQTT_EVENT_SUBACK: { - DBG("APP - Application is subscribed to topic successfully\n"); - break; - } - case MQTT_EVENT_UNSUBACK: { - DBG("APP - Application is unsubscribed to topic successfully\n"); - break; - } - case MQTT_EVENT_PUBACK: { - DBG("APP - Publishing complete\n"); - break; - } - default: - DBG("APP - Application got a unhandled MQTT event: %i\n", event); - break; - } -} -/*---------------------------------------------------------------------------*/ -static int -construct_pub_topic(void) -{ - int len = snprintf(pub_topic, BUFFER_SIZE, "iot-2/evt/%s/fmt/json", - conf.event_type_id); - - /* len < 0: Error. Len >= BUFFER_SIZE: Buffer too small */ - if(len < 0 || len >= BUFFER_SIZE) { - printf("Pub Topic: %d, Buffer %d\n", len, BUFFER_SIZE); - return 0; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -construct_sub_topic(void) -{ - int len = snprintf(sub_topic, BUFFER_SIZE, "iot-2/cmd/%s/fmt/json", - conf.cmd_type); - - /* len < 0: Error. Len >= BUFFER_SIZE: Buffer too small */ - if(len < 0 || len >= BUFFER_SIZE) { - printf("Sub Topic: %d, Buffer %d\n", len, BUFFER_SIZE); - return 0; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -construct_client_id(void) -{ - int len = snprintf(client_id, BUFFER_SIZE, "d:%s:%s:%02x%02x%02x%02x%02x%02x", - conf.org_id, conf.type_id, - linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], - linkaddr_node_addr.u8[2], linkaddr_node_addr.u8[5], - linkaddr_node_addr.u8[6], linkaddr_node_addr.u8[7]); - - /* len < 0: Error. Len >= BUFFER_SIZE: Buffer too small */ - if(len < 0 || len >= BUFFER_SIZE) { - printf("Client ID: %d, Buffer %d\n", len, BUFFER_SIZE); - return 0; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -update_config(void) -{ - if(construct_client_id() == 0) { - /* Fatal error. Client ID larger than the buffer */ - state = STATE_CONFIG_ERROR; - return; - } - - if(construct_sub_topic() == 0) { - /* Fatal error. Topic larger than the buffer */ - state = STATE_CONFIG_ERROR; - return; - } - - if(construct_pub_topic() == 0) { - /* Fatal error. Topic larger than the buffer */ - state = STATE_CONFIG_ERROR; - return; - } - - /* Reset the counter */ - seq_nr_value = 0; - - state = STATE_INIT; - - /* - * Schedule next timer event ASAP - * - * If we entered an error state then we won't do anything when it fires. - * - * Since the error at this stage is a config error, we will only exit this - * error state if we get a new config. - */ - etimer_set(&publish_periodic_timer, 0); - - return; -} -/*---------------------------------------------------------------------------*/ -static int -init_config() -{ - /* Populate configuration with default values */ - memset(&conf, 0, sizeof(mqtt_client_config_t)); - - memcpy(conf.org_id, DEFAULT_ORG_ID, strlen(DEFAULT_ORG_ID)); - memcpy(conf.type_id, DEFAULT_TYPE_ID, strlen(DEFAULT_TYPE_ID)); - memcpy(conf.auth_token, DEFAULT_AUTH_TOKEN, strlen(DEFAULT_AUTH_TOKEN)); - memcpy(conf.event_type_id, DEFAULT_EVENT_TYPE_ID, - strlen(DEFAULT_EVENT_TYPE_ID)); - memcpy(conf.broker_ip, broker_ip, strlen(broker_ip)); - memcpy(conf.cmd_type, DEFAULT_SUBSCRIBE_CMD_TYPE, 1); - - conf.broker_port = DEFAULT_BROKER_PORT; - conf.pub_interval = DEFAULT_PUBLISH_INTERVAL; - conf.def_rt_ping_interval = DEFAULT_RSSI_MEAS_INTERVAL; - - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -subscribe(void) -{ - /* Publish MQTT topic in IBM quickstart format */ - mqtt_status_t status; - - status = mqtt_subscribe(&conn, NULL, sub_topic, MQTT_QOS_LEVEL_0); - - DBG("APP - Subscribing!\n"); - if(status == MQTT_STATUS_OUT_QUEUE_FULL) { - DBG("APP - Tried to subscribe but command queue was full!\n"); - } -} -/*---------------------------------------------------------------------------*/ -static void -publish(void) -{ - /* Publish MQTT topic in IBM quickstart format */ - int len; - int remaining = APP_BUFFER_SIZE; - - seq_nr_value++; - - buf_ptr = app_buffer; - - len = snprintf(buf_ptr, remaining, - "{" - "\"d\":{" - "\"Seq #\":%d," - "\"Uptime (sec)\":%lu", seq_nr_value, clock_seconds()); - - if(len < 0 || len >= remaining) { - printf("Buffer too short. Have %d, need %d + \\0\n", remaining, len); - return; - } - - remaining -= len; - buf_ptr += len; - - /* Put our Default route's string representation in a buffer */ - char def_rt_str[64]; - memset(def_rt_str, 0, sizeof(def_rt_str)); - ipaddr_sprintf(def_rt_str, sizeof(def_rt_str), uip_ds6_defrt_choose()); - - len = snprintf(buf_ptr, remaining, ",\"Def Route\":\"%s\",\"RSSI (dBm)\":%d", - def_rt_str, def_rt_rssi); - - if(len < 0 || len >= remaining) { - printf("Buffer too short. Have %d, need %d + \\0\n", remaining, len); - return; - } - remaining -= len; - buf_ptr += len; - - len = snprintf(buf_ptr, remaining, ",\"On-Chip Temp (deg.C)\":%d", - temperature_sensor.value(0)); - - if(len < 0 || len >= remaining) { - printf("Buffer too short. Have %d, need %d + \\0\n", remaining, len); - return; - } - remaining -= len; - buf_ptr += len; - - len = snprintf(buf_ptr, remaining, "}}"); - - if(len < 0 || len >= remaining) { - printf("Buffer too short. Have %d, need %d + \\0\n", remaining, len); - return; - } - - mqtt_publish(&conn, NULL, pub_topic, (uint8_t *)app_buffer, - strlen(app_buffer), MQTT_QOS_LEVEL_0, MQTT_RETAIN_OFF); - - DBG("APP - Publish!\n"); -} -/*---------------------------------------------------------------------------*/ -static void -connect_to_broker(void) -{ - /* Connect to MQTT server */ - mqtt_connect(&conn, conf.broker_ip, conf.broker_port, - conf.pub_interval * 3); - - state = STATE_CONNECTING; -} -/*---------------------------------------------------------------------------*/ -static void -ping_parent(void) -{ - if(uip_ds6_get_global(ADDR_PREFERRED) == NULL) { - return; - } - - uip_icmp6_send(uip_ds6_defrt_choose(), ICMP6_ECHO_REQUEST, 0, - ECHO_REQ_PAYLOAD_LEN); -} -/*---------------------------------------------------------------------------*/ -static void -state_machine(void) -{ - switch(state) { - case STATE_INIT: - /* If we have just been configured register MQTT connection */ - mqtt_register(&conn, &mqtt_demo_process, client_id, mqtt_event, - MAX_TCP_SEGMENT_SIZE); - - /* - * If we are not using the quickstart service (thus we are an IBM - * registered device), we need to provide user name and password - */ - if(strncasecmp(conf.org_id, QUICKSTART, strlen(conf.org_id)) != 0) { - if(strlen(conf.auth_token) == 0) { - printf("User name set, but empty auth token\n"); - state = STATE_ERROR; - break; - } else { - mqtt_set_username_password(&conn, "use-token-auth", - conf.auth_token); - } - } - - /* _register() will set auto_reconnect. We don't want that. */ - conn.auto_reconnect = 0; - connect_attempt = 1; - - state = STATE_REGISTERED; - DBG("Init\n"); - /* Continue */ - case STATE_REGISTERED: - if(uip_ds6_get_global(ADDR_PREFERRED) != NULL) { - /* Registered and with a public IP. Connect */ - DBG("Registered. Connect attempt %u\n", connect_attempt); - ping_parent(); - connect_to_broker(); - } else { - leds_on(STATUS_LED); - ctimer_set(&ct, NO_NET_LED_DURATION, publish_led_off, NULL); - } - etimer_set(&publish_periodic_timer, NET_CONNECT_PERIODIC); - return; - break; - case STATE_CONNECTING: - leds_on(STATUS_LED); - ctimer_set(&ct, CONNECTING_LED_DURATION, publish_led_off, NULL); - /* Not connected yet. Wait */ - DBG("Connecting (%u)\n", connect_attempt); - break; - case STATE_CONNECTED: - /* Don't subscribe unless we are a registered device */ - if(strncasecmp(conf.org_id, QUICKSTART, strlen(conf.org_id)) == 0) { - DBG("Using 'quickstart': Skipping subscribe\n"); - state = STATE_PUBLISHING; - } - /* Continue */ - case STATE_PUBLISHING: - /* If the timer expired, the connection is stable. */ - if(timer_expired(&connection_life)) { - /* - * Intentionally using 0 here instead of 1: We want RECONNECT_ATTEMPTS - * attempts if we disconnect after a successful connect - */ - connect_attempt = 0; - } - - if(mqtt_ready(&conn) && conn.out_buffer_sent) { - /* Connected. Publish */ - if(state == STATE_CONNECTED) { - subscribe(); - state = STATE_PUBLISHING; - } else { - leds_on(STATUS_LED); - ctimer_set(&ct, PUBLISH_LED_ON_DURATION, publish_led_off, NULL); - publish(); - } - etimer_set(&publish_periodic_timer, conf.pub_interval); - - DBG("Publishing\n"); - /* Return here so we don't end up rescheduling the timer */ - return; - } else { - /* - * Our publish timer fired, but some MQTT packet is already in flight - * (either not sent at all, or sent but not fully ACKd). - * - * This can mean that we have lost connectivity to our broker or that - * simply there is some network delay. In both cases, we refuse to - * trigger a new message and we wait for TCP to either ACK the entire - * packet after retries, or to timeout and notify us. - */ - DBG("Publishing... (MQTT state=%d, q=%u)\n", conn.state, - conn.out_queue_full); - } - break; - case STATE_DISCONNECTED: - DBG("Disconnected\n"); - if(connect_attempt < RECONNECT_ATTEMPTS || - RECONNECT_ATTEMPTS == RETRY_FOREVER) { - /* Disconnect and backoff */ - clock_time_t interval; - mqtt_disconnect(&conn); - connect_attempt++; - - interval = connect_attempt < 3 ? RECONNECT_INTERVAL << connect_attempt : - RECONNECT_INTERVAL << 3; - - DBG("Disconnected. Attempt %u in %lu ticks\n", connect_attempt, interval); - - etimer_set(&publish_periodic_timer, interval); - - state = STATE_REGISTERED; - return; - } else { - /* Max reconnect attempts reached. Enter error state */ - state = STATE_ERROR; - DBG("Aborting connection after %u attempts\n", connect_attempt - 1); - } - break; - case STATE_CONFIG_ERROR: - /* Idle away. The only way out is a new config */ - printf("Bad configuration\n"); - return; - case STATE_ERROR: - default: - leds_on(STATUS_LED); - /* - * 'default' should never happen. - * - * If we enter here it's because of some error. Stop timers. The only thing - * that can bring us out is a new config event - */ - printf("Default case: State=0x%02x\n", state); - return; - } - - /* If we didn't return so far, reschedule ourselves */ - etimer_set(&publish_periodic_timer, STATE_MACHINE_PERIODIC); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(mqtt_demo_process, ev, data) -{ - - PROCESS_BEGIN(); - - printf("MQTT Demo Process\n"); - - if(init_config() != 1) { - PROCESS_EXIT(); - } - - update_config(); - - def_rt_rssi = 0x8000000; - uip_icmp6_echo_reply_callback_add(&echo_reply_notification, - echo_reply_handler); - etimer_set(&echo_request_timer, conf.def_rt_ping_interval); - - PUBLISH_TRIGGER->configure(SENSORS_ACTIVE, 1); - - /* Main loop */ - while(1) { - - PROCESS_YIELD(); - - if(ev == sensors_event && data == PUBLISH_TRIGGER) { - if(state == STATE_ERROR) { - connect_attempt = 1; - state = STATE_REGISTERED; - } - } - - if((ev == PROCESS_EVENT_TIMER && data == &publish_periodic_timer) || - ev == PROCESS_EVENT_POLL || - (ev == sensors_event && data == PUBLISH_TRIGGER && PUBLISH_TRIGGER->value(BUTTON_SENSOR_VALUE_STATE) == 0)) { - state_machine(); - } - - if(ev == PROCESS_EVENT_TIMER && data == &echo_request_timer) { - ping_parent(); - etimer_set(&echo_request_timer, conf.def_rt_ping_interval); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/nrf52dk/mqtt-demo/project-conf.h b/examples/platform-specific/nrf52dk/mqtt-demo/project-conf.h deleted file mode 100644 index 14e4749da..000000000 --- a/examples/platform-specific/nrf52dk/mqtt-demo/project-conf.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup cc2538-mqtt-demo - * @{ - * - * \file - * Project specific configuration defines for the MQTT demo - */ -/*---------------------------------------------------------------------------*/ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ - -/* Enable TCP */ -#define UIP_CONF_TCP 1 - -/* User configuration */ -#define MQTT_DEMO_STATUS_LED LEDS_GREEN - -/* If undefined, the demo will attempt to connect to IBM's quickstart */ -#define MQTT_DEMO_BROKER_IP_ADDR "fd00::215:83ff:fed2:dbd7" -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/examples/platform-specific/nrf52dk/timer-test/Makefile b/examples/platform-specific/nrf52dk/timer-test/Makefile deleted file mode 100644 index da515a62e..000000000 --- a/examples/platform-specific/nrf52dk/timer-test/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = timer-test - -PLATFORMS_ONLY = nrf52dk - -MAKE_ROUTING = MAKE_ROUTING_NULLROUTING -MAKE_MAC=MAKE_MAC_NULLMAC -NRF52_WITHOUT_SOFTDEVICE=1 - -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/nrf52dk/timer-test/Makefile.target b/examples/platform-specific/nrf52dk/timer-test/Makefile.target deleted file mode 100644 index 3853b313a..000000000 --- a/examples/platform-specific/nrf52dk/timer-test/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = nrf52dk diff --git a/examples/platform-specific/nrf52dk/timer-test/README.md b/examples/platform-specific/nrf52dk/timer-test/README.md deleted file mode 100644 index 9ce7cad94..000000000 --- a/examples/platform-specific/nrf52dk/timer-test/README.md +++ /dev/null @@ -1,20 +0,0 @@ -Timers test -=========== -Timers test is an application allows for testing clocks implementation for nRF52 DK. -The results of different tests are output to the console. - -There are 4 tests performed: - - 1) TEST clock_delay_usec() - measures duration of a NOP delay using rtimer. It's expected - that difference is close to 0. - - 2) TEST rtimer - schedules an rtimer callback after 1 second. Prints actual time difference - in rtimer and clock ticks. It's expected that both values are close to 0. - - 3) TEST etimer - schedules an event timer and measures time difference. It is expected that - the value is close to 0. - -The example requires one DK and it doesn't use SoftDevice. To compile and flash the -example run: - - make TARGET=nrf52dk timer-test.flash \ No newline at end of file diff --git a/examples/platform-specific/nrf52dk/timer-test/timer-test.c b/examples/platform-specific/nrf52dk/timer-test/timer-test.c deleted file mode 100644 index e0ced7293..000000000 --- a/examples/platform-specific/nrf52dk/timer-test/timer-test.c +++ /dev/null @@ -1,131 +0,0 @@ -/** - * \file - * Tests related to clocks and timers - * This is based on clock_test.c from the original sensinode port - * - * \author - * Zach Shelby (Original) - * George Oikonomou - (rtimer code) - * Wojciech Bober (nRF52 DK adaptation) - * - */ - -/** - * \addtogroup nrf52dk-examples Demo projects for nRF52 DK - * @{ - */ -#include "contiki.h" -#include "sys/clock.h" -#include "sys/rtimer.h" -#include "dev/leds.h" - -#include "nrf_delay.h" - -#include -/*---------------------------------------------------------------------------*/ -#define TEST_CLOCK_DELAY_USEC 1 -#define TEST_RTIMER 1 -#define TEST_ETIMER 1 -/*---------------------------------------------------------------------------*/ -static struct etimer et; - -#if TEST_CLOCK_DELAY_USEC -static rtimer_clock_t start_count, end_count, diff; -#endif - -#if TEST_ETIMER -static clock_time_t count; -#endif - -#if TEST_RTIMER -static struct rtimer rt; -static clock_time_t ct_now; -rtimer_clock_t rt_now, rt_until; - -static volatile rtimer_clock_t rt_now_cb; -static volatile clock_time_t ct_cb; -#endif - -static uint8_t i; -/*---------------------------------------------------------------------------*/ -PROCESS(clock_test_process, "Clock test process"); -AUTOSTART_PROCESSES(&clock_test_process); -/*---------------------------------------------------------------------------*/ -#if TEST_RTIMER -void -rt_callback(struct rtimer *t, void *ptr) -{ - rt_now_cb = RTIMER_NOW(); - ct_cb = clock_time(); -} -#endif -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(clock_test_process, ev, data) -{ - - PROCESS_BEGIN(); - etimer_set(&et, 2 * CLOCK_SECOND); - PROCESS_YIELD(); - - printf("RTIMER_SECOND=%d CLOCK_SECOND=%d\n", RTIMER_SECOND, CLOCK_SECOND); - -#if TEST_CLOCK_DELAY_USEC - printf("=======================\n"); - printf("TEST clock_delay_usec()\n"); - printf("=======================\n"); - i = 1; - while(i < 7) { - start_count = RTIMER_NOW(); - clock_delay_usec(10000 * i); - end_count = RTIMER_NOW(); - diff = end_count - start_count; - printf("difference [usec]: %ld\n", 10000 * i - (diff*(1000000/RTIMER_SECOND))); - i++; - } -#endif - -#if TEST_RTIMER - printf("=======================\n"); - printf("TEST rtimer\n"); - printf("=======================\n"); - i = 0; - while(i < 5) { - etimer_set(&et, 2 * CLOCK_SECOND); - rt_now = RTIMER_NOW(); - ct_now = clock_time(); - rt_until = rt_now + RTIMER_SECOND; - printf("now [ticks]: %lu until[ticks]: %lu\n", rt_now, rt_until); - if (rtimer_set(&rt, rt_until, 1, rt_callback, NULL) != RTIMER_OK) { - printf("Error setting\n"); - } - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - printf("rtimer difference [ticks]: %ld\n", RTIMER_SECOND - (rt_now_cb - rt_now)); - printf("clock difference [ticks]: %ld\n", CLOCK_SECOND - (ct_cb - ct_now)); - i++; - } -#endif - -#if TEST_ETIMER - printf("=======================\n"); - printf("TEST etimer\n"); - printf("=======================\n"); - i = 0; - while(i < 5) { - etimer_set(&et, i*CLOCK_SECOND); - count = clock_time(); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - printf("difference [ticks]: %lu\n", i*CLOCK_SECOND - (clock_time() - count)); - leds_toggle(LEDS_RED); - i++; - } -#endif - - printf("Done!\n"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/examples/platform-specific/zoul/Makefile b/examples/platform-specific/zoul/Makefile deleted file mode 100644 index 3b57eb035..000000000 --- a/examples/platform-specific/zoul/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -CONTIKI_PROJECT = test-tsl256x test-sht25 test-servo -CONTIKI_PROJECT += test-bmp085-bmp180 test-motion test-rotation-sensor -CONTIKI_PROJECT += test-grove-light-sensor test-grove-loudness-sensor -CONTIKI_PROJECT += test-weather-meter test-grove-gyro test-lcd test-iaq -CONTIKI_PROJECT += test-pm10-sensor test-vac-sensor test-aac-sensor -CONTIKI_PROJECT += test-zonik test-dht22 test-ac-dimmer -CONTIKI_PROJECT += test-bme280 - -CONTIKI_TARGET_SOURCEFILES += tsl256x.c sht25.c bmpx8x.c motion-sensor.c -CONTIKI_TARGET_SOURCEFILES += adc-sensors.c weather-meter.c grove-gyro.c -CONTIKI_TARGET_SOURCEFILES += rgb-bl-lcd.c pm10-sensor.c iaq.c zonik.c relay.c -CONTIKI_TARGET_SOURCEFILES += dht22.c servo.c ac-dimmer.c bme280-arch.c - -MODULES += arch/dev/bme280 - -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = zoul - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/zoul/Makefile.target b/examples/platform-specific/zoul/Makefile.target deleted file mode 100644 index 75430a6e4..000000000 --- a/examples/platform-specific/zoul/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = zoul diff --git a/examples/platform-specific/zoul/README.md b/examples/platform-specific/zoul/README.md deleted file mode 100644 index a44218b3f..000000000 --- a/examples/platform-specific/zoul/README.md +++ /dev/null @@ -1,59 +0,0 @@ -Zolertia Zoul test examples -============================================ - -The following tests are valid for the following platforms: - -* RE-Mote revision A -* RE-Mote revision B -* Firefly - -Specific RE-mote revision A examples are available at the `rev-a` folder. - -Compile and install an example -------------------- - -To flash either hardware platform use the same `TARGET=zoul` and the following: - -* RE-Mote revision A : `BOARD=remote-reva` -* RE-Mote revision B : `BOARD=remote-revb` -* Zolertia Firefly : `BOARD=firefly` - -An example on how to compile is shown next: - -`make TARGET=zoul BOARD=remote-revb` - -Or alternatively if you just type `make`, it will default to use the `BOARD=remote-revb`. - -For backward compatibility with the previous `remote` target corresponding to the -RE-Mote revision A, using `BOARD=remote` will default to `BOARD=remote-reva`. - -To upload an example to your Zolertia device, just add the `.upload` target as: - -`make TARGET=zoul BOARD=remote-revb zoul-demo.upload` - -Optionally you can select a specific USB port to flash a given device, in Linux -and assuming there is a device at the `/dev/ttyUSB0`: - -`make TARGET=zoul BOARD=remote-revb zoul-demo.upload PORT=/dev/ttyUSB0` - -If you ommit the `PORT` argument, the system will flash all Zolertia devices connected over USB. - -Visualize the console output -------------------- - -Just type `make login` to open a connection to the console via USB. -As above to specify a given port use the `PORT=/dev/ttyUSB0` argument. - -Alternatively you can save the above `PORT`, `TARGET` or `BOARD` as follows: - -`export TARGET=zoul BOARD=remote-revb PORT=/dev/ttyUSB0` - -This will save you to type these when running a command on the terminal - -Documentation and guides -------------------- - -More information about the platforms, guides and specific documentation can be found at [Zolertia Wiki][wiki] - -[wiki]: https://github.com/Zolertia/Resources/wiki "Zolertia Wiki" - diff --git a/examples/platform-specific/zoul/at-test/Makefile b/examples/platform-specific/zoul/at-test/Makefile deleted file mode 100644 index df8ef9da8..000000000 --- a/examples/platform-specific/zoul/at-test/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CONTIKI_PROJECT = at-master-test -MODULES = os/services/at-master -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = zoul - -CONTIKI = ../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/zoul/at-test/Makefile.target b/examples/platform-specific/zoul/at-test/Makefile.target deleted file mode 100644 index 75430a6e4..000000000 --- a/examples/platform-specific/zoul/at-test/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = zoul diff --git a/examples/platform-specific/zoul/at-test/at-master-test.c b/examples/platform-specific/zoul/at-test/at-master-test.c deleted file mode 100644 index b7a1acddc..000000000 --- a/examples/platform-specific/zoul/at-test/at-master-test.c +++ /dev/null @@ -1,486 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-AT-master-test - * @{ - * - * Test the Zoul hardware using AT commands - * @{ - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cpu.h" -#include "at-master.h" -#include "sys/ctimer.h" -#include "sys/process.h" -#include "dev/adc.h" -#include "dev/leds.h" -#include "dev/watchdog.h" -#include "dev/sys-ctrl.h" -#include "dev/gpio.h" -#include "dev/ioc.h" -#include "lib/list.h" -#include "dev/sha256.h" -#include "net/linkaddr.h" -#include -#include -#include -/*---------------------------------------------------------------------------*/ -PROCESS(at_test_process, "AT test process"); -AUTOSTART_PROCESSES(&at_test_process); -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -static struct at_cmd at_cmd_test; -static struct at_cmd at_cmd_board; -static struct at_cmd at_cmd_led; -static struct at_cmd at_cmd_addr; -static struct at_cmd at_cmd_gpio; -static struct at_cmd at_cmd_read; -static struct at_cmd at_cmd_flop; -static struct at_cmd at_cmd_reset; -static struct at_cmd at_cmd_sha256; -static struct at_cmd at_cmd_adc; -/*---------------------------------------------------------------------------*/ -#define HWTEST_GPIO_INPUT 0 -#define HWTEST_GPIO_OUTPUT 1 -#define HWTEST_GPIO_OUTPUT_ODD 3 -#define HWTEST_GPIO_OUTPUT_LIST 4 -#define HWTEST_GPIO_OUTPUT_MASK 0x55 -#define HWTEST_GPIO_OUTPUT_ODD_MASK 0xAA -/*---------------------------------------------------------------------------*/ -typedef struct { - char *name; - uint8_t port; - uint8_t pin; -} gpio_list_t; -/*---------------------------------------------------------------------------*/ -static struct ctimer ct; -/*---------------------------------------------------------------------------*/ -static void -floppin(uint8_t port, uint8_t pin) -{ - uint8_t i; - GPIO_CLR_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - clock_delay_usec(500); - for(i = 0; i < 50; i++) { - GPIO_SET_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - clock_delay_usec(500); - GPIO_CLR_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - clock_delay_usec(500); - } -} -/*---------------------------------------------------------------------------*/ -#if DEBUG -static char * -pname(uint8_t num) -{ - if(num == GPIO_A_NUM) { - return "PA"; - } - if(num == GPIO_B_NUM) { - return "PB"; - } - if(num == GPIO_C_NUM) { - return "PC"; - } - if(num == GPIO_D_NUM) { - return "PD"; - } - return "INVALID"; -} -#endif -/*---------------------------------------------------------------------------*/ -static void -config_gpio(uint8_t port, uint8_t pin, uint8_t type) -{ - GPIO_SOFTWARE_CONTROL(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - if(type == HWTEST_GPIO_OUTPUT) { - GPIO_SET_OUTPUT(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - } else if(type == HWTEST_GPIO_INPUT) { - GPIO_SET_INPUT(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - } -} -/*---------------------------------------------------------------------------*/ -static void -at_cmd_test_callback(struct at_cmd *cmd, uint8_t len, char *data) -{ - AT_RESPONSE("Hello!"); - AT_RESPONSE(AT_DEFAULT_RESPONSE_OK); -} -/*---------------------------------------------------------------------------*/ -static void -at_cmd_board_callback(struct at_cmd *cmd, uint8_t len, char *data) -{ - AT_RESPONSE(BOARD_STRING); - AT_RESPONSE(AT_DEFAULT_RESPONSE_OK); -} -/*---------------------------------------------------------------------------*/ -static void -at_cmd_flop_callback(struct at_cmd *cmd, uint8_t len, char *data) -{ - /* Format: AT&FLOP=PN where P(ort)N(number) */ - uint8_t port; - uint8_t pin = atoi(&data[9]); - - if((pin < 0) || (pin > 9)) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - if(strncmp(&data[8], "A", 1) == 0) { - port = GPIO_A_NUM; - } else if(strncmp(&data[8], "B", 1) == 0) { - port = GPIO_B_NUM; - } else if(strncmp(&data[8], "C", 1) == 0) { - port = GPIO_C_NUM; - } else if(strncmp(&data[8], "D", 1) == 0) { - port = GPIO_D_NUM; - } else { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - config_gpio(port, pin, HWTEST_GPIO_OUTPUT); - floppin(port, pin); - - AT_RESPONSE(AT_DEFAULT_RESPONSE_OK); -} -/*---------------------------------------------------------------------------*/ -static void -at_cmd_address_callback(struct at_cmd *cmd, uint8_t len, char *data) -{ - static char _lladdr[17]; - snprintf(_lladdr, 17, "%02x%02x%02x%02x%02x%02x%02x%02x", - linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], - linkaddr_node_addr.u8[2], linkaddr_node_addr.u8[3], - linkaddr_node_addr.u8[4], linkaddr_node_addr.u8[5], - linkaddr_node_addr.u8[6], linkaddr_node_addr.u8[7]); - - AT_RESPONSE(_lladdr); - AT_RESPONSE(AT_DEFAULT_RESPONSE_OK); -} -/*---------------------------------------------------------------------------*/ -static void -at_cmd_reset_callback(struct at_cmd *cmd, uint8_t len, char *data) -{ - uint8_t reset_val = atoi(&data[9]); - /* AT&RESET=n, where n: - * 0 : CC2538 soft reset - */ - if((reset_val != 0) && (reset_val != 1)) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - /* Send the response and wait a second until executing the command */ - AT_RESPONSE(AT_DEFAULT_RESPONSE_OK); - - if(reset_val == 0) { - ctimer_set(&ct, CLOCK_SECOND, sys_ctrl_reset, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -at_cmd_leds_callback(struct at_cmd *cmd, uint8_t len, char *data) -{ - /* Format: AT&LED=L,s where L(ed)=R/G/B, s(tate)=1/0*/ - uint8_t led; - uint8_t state = strncmp(&data[9], "1", 1) ? 0 : 1; - - if(strncmp(&data[8], ",", 1) != 0) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - if(strncmp(&data[7], "R", 1) == 0) { - led = LEDS_RED; - } else if(strncmp(&data[7], "G", 1) == 0) { - led = LEDS_GREEN; - } else if(strncmp(&data[7], "B", 1) == 0) { - led = LEDS_BLUE; - } else { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - if(state) { - leds_on(led); - } else { - leds_off(led); - } - AT_RESPONSE(AT_DEFAULT_RESPONSE_OK); -} -/*---------------------------------------------------------------------------*/ -static void -at_cmd_gpio_callback(struct at_cmd *cmd, uint8_t len, char *data) -{ - /* Format: AT&GPIO=PN,s where P(ort)N(number), s(tate)=1/0 */ - uint8_t port; - uint8_t state = strncmp(&data[11], "1", 1) ? 0 : 1; - uint8_t pin = atoi(&data[9]); - - if(strncmp(&data[10], ",", 1) != 0) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - if((pin < 0) || (pin > 7)) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - if((state < 0) || (state > 1)) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - if(strncmp(&data[8], "A", 1) == 0) { - port = GPIO_A_NUM; - } else if(strncmp(&data[8], "B", 1) == 0) { - port = GPIO_B_NUM; - } else if(strncmp(&data[8], "C", 1) == 0) { - port = GPIO_C_NUM; - } else if(strncmp(&data[8], "D", 1) == 0) { - port = GPIO_D_NUM; - } else { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - config_gpio(port, pin, HWTEST_GPIO_OUTPUT); - - if(state) { - GPIO_SET_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - } else { - GPIO_CLR_PIN(GPIO_PORT_TO_BASE(port), GPIO_PIN_MASK(pin)); - } - - AT_RESPONSE(AT_DEFAULT_RESPONSE_OK); -} -/*---------------------------------------------------------------------------*/ -static void -at_cmd_adc_callback(struct at_cmd *cmd, uint8_t len, char *data) -{ - /* Format: AT&ADC=N where N is 4-7, it can be "*" to read all */ - uint8_t i, pin; - uint16_t res[4]; - char read_result[24]; - - if(strncmp(&data[7], "*", 1) == 0) { - pin = 8; - } else { - pin = atoi(&data[7]); - } - - if((pin < 4) || (pin > 8)) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - if(pin < 8) { - config_gpio(GPIO_A_NUM, pin, HWTEST_GPIO_INPUT); - ioc_set_over(GPIO_A_NUM, pin, IOC_OVERRIDE_ANA); - res[pin - 4] = adc_get((SOC_ADC_ADCCON_CH_AIN0 + pin), - SOC_ADC_ADCCON_REF_AVDD5, - SOC_ADC_ADCCON_DIV_512); - res[pin - 4] = res[pin - 4] / 10; - PRINTF("ADC%u: %04d\n", pin, res[pin - 4]); - snprintf(read_result, 5, "%04d", res[pin - 4]); - } else { - for(i = 4; i < 8; i++) { - config_gpio(GPIO_A_NUM, i, HWTEST_GPIO_INPUT); - ioc_set_over(GPIO_A_NUM, i, IOC_OVERRIDE_ANA); - res[i - 4] = adc_get((SOC_ADC_ADCCON_CH_AIN0 + i), - SOC_ADC_ADCCON_REF_AVDD5, - SOC_ADC_ADCCON_DIV_512); - res[i - 4] = res[i - 4] / 10; - } - snprintf(read_result, 24, "%04d %04d %04d %04d", res[0], res[1], - res[2], res[3]); - } - - AT_RESPONSE(read_result); - AT_RESPONSE(AT_DEFAULT_RESPONSE_OK); -} -/*---------------------------------------------------------------------------*/ -static void -at_cmd_read_callback(struct at_cmd *cmd, uint8_t len, char *data) -{ - /* Format: AT&READ=PN where P(ort)N(number), N can be "*" to read all */ - uint8_t port, pin; - char read_result[5]; - - if(strncmp(&data[9], "*", 1) == 0) { - pin = 0xFF; - } else { - pin = atoi(&data[9]); - } - - if((pin < 0) || (pin > 7)) { - if(pin != 0xFF) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - } - - if(pin < 8) { - pin = GPIO_PIN_MASK(pin); - } - - /* Exclude PA0-PA3 */ - if(strncmp(&data[8], "A", 1) == 0) { - port = GPIO_A_NUM; - if(pin < 0x1F) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } else { - if(pin == 0xFF) { - pin = 0xF0; - } - } - } else if(strncmp(&data[8], "B", 1) == 0) { - port = GPIO_B_NUM; - } else if(strncmp(&data[8], "C", 1) == 0) { - port = GPIO_C_NUM; - } else if(strncmp(&data[8], "D", 1) == 0) { - port = GPIO_D_NUM; - } else { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - config_gpio(port, pin, HWTEST_GPIO_INPUT); - snprintf(read_result, 5, "0x%02X", - (uint16_t)GPIO_READ_PIN(GPIO_PORT_TO_BASE(port), pin)); - AT_RESPONSE(read_result); - AT_RESPONSE(AT_DEFAULT_RESPONSE_OK); -} -/*---------------------------------------------------------------------------*/ -static void -at_cmd_sha256_callback(struct at_cmd *cmd, uint8_t len, char *data) -{ - /* Format: AT&SHA256=s, where s is a string up to 64 bytes */ - uint8_t i; - char tmp[4], sha256[32], sha256_res[64]; - static sha256_state_t state; - - crypto_init(); - if(sha256_init(&state) != CRYPTO_SUCCESS) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - if(sha256_process(&state, &data[10], - len - (cmd->cmd_hdr_len)) != CRYPTO_SUCCESS) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - if(sha256_done(&state, sha256) != CRYPTO_SUCCESS) { - AT_RESPONSE(AT_DEFAULT_RESPONSE_ERROR); - return; - } - - crypto_disable(); - - PRINTF("Input: %s:\n", &data[10]); - snprintf(tmp, 3, "%02X", sha256[0]); - strncpy(sha256_res, tmp, 3); - for(i = 1; i < 32; i++) { - PRINTF("0x%02X ", sha256[i]); - snprintf(tmp, 3, "%02X", sha256[i]); - strcat(sha256_res, tmp); - } - PRINTF("\nSHA256: %s\n", sha256_res); - AT_RESPONSE(sha256_res); - AT_RESPONSE(AT_DEFAULT_RESPONSE_OK); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(at_test_process, ev, data) -{ - PROCESS_BEGIN(); - struct at_cmd *a; - - /* Initialize the driver, default is UART0 */ - at_init(0); - - /* Register a list of commands, is mandatory to start with "AT" */ - at_register(&at_cmd_test, &at_test_process, "AT", 2, 2, - at_cmd_test_callback); - at_register(&at_cmd_board, &at_test_process, "AT&V", 4, 4, - at_cmd_board_callback); - at_register(&at_cmd_led, &at_test_process, "AT&LED", 6, 10, - at_cmd_leds_callback); - at_register(&at_cmd_addr, &at_test_process, "AT&A", 4, 4, - at_cmd_address_callback); - at_register(&at_cmd_gpio, &at_test_process, "AT&GPIO=", 8, 12, - at_cmd_gpio_callback); - at_register(&at_cmd_read, &at_test_process, "AT&READ=", 8, 10, - at_cmd_read_callback); - at_register(&at_cmd_adc, &at_test_process, "AT&ADC=", 7, 8, - at_cmd_adc_callback); - at_register(&at_cmd_flop, &at_test_process, "AT&FLOP=", 8, 10, - at_cmd_flop_callback); - at_register(&at_cmd_reset, &at_test_process, "AT&RESET=", 9, 10, - at_cmd_reset_callback); - at_register(&at_cmd_sha256, &at_test_process, "AT&SHA256=", 10, 64, - at_cmd_sha256_callback); - - /* Print the command list */ - PRINTF("AT command list:\n"); - for(a = at_list(); a != NULL; a = list_item_next(a)) { - PRINTF("* HDR %s LEN %u MAX %u\n", a->cmd_header, a->cmd_hdr_len, - a->cmd_max_len); - } - - /* - * When an AT command is received over the serial line, the registered - * callbacks will be invoked, let the process spin until then - */ - while(1) { - PROCESS_YIELD(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/zoul/at-test/project-conf.h b/examples/platform-specific/zoul/at-test/project-conf.h deleted file mode 100644 index 3b756a01b..000000000 --- a/examples/platform-specific/zoul/at-test/project-conf.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-AT-master-test - * - * Test the Zoul hardware over AT API - * @{ - * - * \file - * Test the Zoul hardware over AT API - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -/* Drop maximum to PM1 to have the UART on all the time */ -#define LPM_CONF_MAX_PM 1 - -/* the radio is not used */ -#define CONTIKI_NO_NET 1 - -/* Override serial-line defaults */ -#define SERIAL_LINE_CONF_BUFSIZE 128 -#define IGNORE_CHAR(c) (c == 0x0d) -#define END 0x0a - -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/zoul/node-red/README.md b/examples/platform-specific/zoul/node-red/README.md deleted file mode 100644 index f99458ac7..000000000 --- a/examples/platform-specific/zoul/node-red/README.md +++ /dev/null @@ -1,38 +0,0 @@ -RE-Mote + Node Red README -======================== - -A very basic example of how to use MQTT-Demo + Mosquitto + Node Red - -Install Mosquitto ------------------ -* Install and run [mosquitto](http://mosquitto.org/). Default configuration - options should work. - -Fire up a Re-Mote ------------------ -* Compile the MQTT demo example from `../../../cc2538dk/mqtt-demo.c` following - the instructions of the README.md therein. -* Program your RE-Mote. -* If you are running mosquitto with `-v`, a few seconds later you should see - the Re-Mote connect, subscribe and start publishing. - -Deploy your Node Red --------------------- -* Install and run [Node Red](https://github.com/node-red/node-red) as per the - instructions -* Open `mqtt-remote-demo.json` from this directory with your favourite text - editor, select all and copy. -* Once you have the opened the Node Red page, click the menu icon on the top - right and go to Import -> Clipboard. Paste the copied text. -* Double click the `MQTT input from Re-Mote` box on the top left. Set `Broker` - IP and port to those corresponding to your running mosquitto. -* Hit Deploy -* Optionally, export the flow to a file for future use - -Browse ------- -Fire up a browser and browse to `http:///remote` - -Do more cool stuff ------------------- -Come up with more cool flows and share! diff --git a/examples/platform-specific/zoul/node-red/mqtt-remote-demo.json b/examples/platform-specific/zoul/node-red/mqtt-remote-demo.json deleted file mode 100644 index a121cc6c2..000000000 --- a/examples/platform-specific/zoul/node-red/mqtt-remote-demo.json +++ /dev/null @@ -1,2 +0,0 @@ -[{"id":"d95a1e7f.43a","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":""},{"id":"ddd5cc1c.723e18","type":"mqtt in","name":"MQTT input from Re-Mote","topic":"iot-2/evt/status/fmt/json","broker":"d95a1e7f.43a","x":131.11109924316406,"y":98.88890075683594,"z":"9b2868a4.2cef5","wires":[["12ea094e.3c2447"]]},{"id":"7728d120.25c64","type":"function","name":"Parse and Store Data","func":"var dat = msg.payload.d;\n\nif(dat) {\n var ret = [\n {\n name: \"Name\",\n value: dat.myName,\n unit: \"\",\n },\n {\n name: \"Seq #\",\n value: dat[\"Seq #\"],\n unit: \"\",\n },\n {\n name: \"Uptime\",\n value: dat[\"Uptime (sec)\"],\n unit: \"sec\",\n },\n {\n name: \"On-Chip Temp\",\n value: dat[\"On-Chip Temp (mC)\"],\n unit: \"C\",\n },\n {\n name: \"VDD/3\",\n value: dat[\"VDD3 (mV)\"],\n unit: \"V\",\n },\n {\n name: \"Parent RSSI\",\n value: dat[\"RSSI (dBm)\"],\n unit: \"dBm\",\n },\n ];\n \n context.ret = ret;\n} else {\n if(context.ret) {\n msg.has_data = true;\n msg.payload = context.ret;\n } else {\n msg.payload = \"No Data!\";\n }\n return [msg, msg];\n}\nreturn [msg, null];","outputs":"2","x":545.1110992431641,"y":346.38890075683594,"z":"9b2868a4.2cef5","wires":[["4249c5c.35b5c3c"],["dacab617.9133c8"]]},{"id":"12ea094e.3c2447","type":"json","name":"Convert to JS Object","x":305.61109924316406,"y":263.13890075683594,"z":"9b2868a4.2cef5","wires":[["7728d120.25c64"]]},{"id":"e5e8271c.99c2d","type":"http response","name":"Send HTTP Reponse","x":1252.2220611572266,"y":488.38890075683594,"z":"9b2868a4.2cef5","wires":[]},{"id":"4b2260f8.436808","type":"http in","name":"","url":"/remote","method":"get","x":327.11109924316406,"y":429.88890075683594,"z":"9b2868a4.2cef5","wires":[["8a3f88a9.ec77d8","7728d120.25c64"]]},{"id":"8a3f88a9.ec77d8","type":"debug","name":"","active":false,"console":"false","complete":"req","x":459.61109924316406,"y":522.3889007568359,"z":"9b2868a4.2cef5","wires":[]},{"id":"ac349e33.beb47","type":"template","name":"Render HTML from Data","field":"payload","template":"\n\n
    \n {{#payload}}\n
  • {{name}}: {{value}}{{#unit}} {{unit}}{{/unit}}
  • \n {{/payload}}\n
\n\n","x":1046.361099243164,"y":347.13890075683594,"z":"9b2868a4.2cef5","wires":[["e5e8271c.99c2d","530bf522.d773dc"]]},{"id":"4249c5c.35b5c3c","type":"debug","name":"","active":false,"console":"false","complete":"false","x":620.1110992431641,"y":247.88890075683594,"z":"9b2868a4.2cef5","wires":[]},{"id":"dacab617.9133c8","type":"switch","name":"","property":"has_data","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","outputs":2,"x":765.1110992431641,"y":352.88890075683594,"z":"9b2868a4.2cef5","wires":[["124554c4.5b82b3","ac349e33.beb47"],["e5e8271c.99c2d"]]},{"id":"530bf522.d773dc","type":"debug","name":"","active":false,"console":"false","complete":"payload","x":1228.361099243164,"y":217.88890075683594,"z":"9b2868a4.2cef5","wires":[]},{"id":"124554c4.5b82b3","type":"debug","name":"","active":false,"console":"false","complete":"payload","x":898.1110992431641,"y":220.88890075683594,"z":"9b2868a4.2cef5","wires":[]}] - diff --git a/examples/platform-specific/zoul/orion/README.md b/examples/platform-specific/zoul/orion/README.md deleted file mode 100644 index d32cc4bcb..000000000 --- a/examples/platform-specific/zoul/orion/README.md +++ /dev/null @@ -1,56 +0,0 @@ -RE-Mote IP64 README file -======================== - -This example shows how to use the Zolertia's Orion Ethernet router, based on the Zoul and ENC28J60 modules, with active POE support. - -IP64 router ------------------ -The router packs a built-in webserver and optionally can run on 2.4GHz or with the Sub-1GHz radio interface. In the `project-conf.h` file you can alternatively enable one or another as follows: - -* RF 2.4GHz (cc2538 built-in) - -```` -#define NETSTACK_CONF_RADIO cc2538_rf_driver -#define ANTENNA_SW_SELECT_DEF_CONF ANTENNA_SW_SELECT_2_4GHZ -```` - -* RF Sub-1GHz (CC1200) - -```` -#define NETSTACK_CONF_RADIO cc1200_driver -#define ANTENNA_SW_SELECT_DEF_CONF ANTENNA_SW_SELECT_SUBGHZ -```` - -To compile and flash run: - -```` -cd ip64-router -make TARGET=zoul BOARD=orion ip64-router.upload -```` - -As default we enable the `DHCP` support for autoconfiguration. Just connect to a DHCP-enabled device to obtain an IPv4 IP address and that's it!. - -HTTP client examples ------------------ - -There are available 2 examples ready to use using the `http-socket` library: - -* The `client` example just makes a HTTP `GET` request to a know page and retrieves - the result. - -* The `ifttt-client` example sends a HTTP `POST` request to [IFTTT](https://ifttt.com/recipes) whenever the user button is pressed, building an Internet button to connect to several channels and applications, such as `Drive`, `Evernote` and many others. - -To configure the `IFTTT` demo just edit the `project-conf.h` file and change the name of the event and write your API key: - -```` -#define IFTTT_EVENT "button" -#define IFTTT_KEY "XXXXXX" -```` - -To compile and flash: - -```` -cd client -make TARGET=zoul ifttt-client.upload -```` - diff --git a/examples/platform-specific/zoul/orion/client/Makefile b/examples/platform-specific/zoul/orion/client/Makefile deleted file mode 100644 index 22354dc98..000000000 --- a/examples/platform-specific/zoul/orion/client/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CONTIKI_PROJECT = client ifttt-client -all: $(CONTIKI_PROJECT) - -BOARD = orion - -MODULES += os/net/app-layer/http-socket - -WITH_IP64 = 1 - -PLATFORMS_ONLY = zoul -BOARDS_ONLY = orion - -CONTIKI = ../../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/zoul/orion/client/Makefile.target b/examples/platform-specific/zoul/orion/client/Makefile.target deleted file mode 100644 index 75430a6e4..000000000 --- a/examples/platform-specific/zoul/orion/client/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = zoul diff --git a/examples/platform-specific/zoul/orion/client/client.c b/examples/platform-specific/zoul/orion/client/client.c deleted file mode 100644 index ebbd34fb0..000000000 --- a/examples/platform-specific/zoul/orion/client/client.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 "contiki-net.h" -#include "http-socket.h" -#include "ipv6/ip64-addr.h" -#include "dev/leds.h" -#include "net/routing/routing.h" -#include -/*---------------------------------------------------------------------------*/ -static struct http_socket s; -static char data_received[HTTP_CLIENT_BUFFER_LEN]; -static int bytes_received = 0; -static int restarts; -static struct ctimer reconnect_timer; -static const char *url = "http://httpbin.org/ip"; -/*---------------------------------------------------------------------------*/ -static void callback(struct http_socket *s, void *ptr, - http_socket_event_t e, - const uint8_t *data, uint16_t datalen); -/*---------------------------------------------------------------------------*/ -PROCESS(http_example_process, "HTTP Example"); -AUTOSTART_PROCESSES(&http_example_process); -/*---------------------------------------------------------------------------*/ -static void -reconnect(void *dummy) -{ - http_socket_get(&s, url, 0, 0, callback, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -restart(void) -{ - int scale; - restarts++; - printf("Number of restarts %d\n", restarts); - - scale = restarts; - if(scale > 5) { - scale = 5; - } - ctimer_set(&reconnect_timer, random_rand() % ((CLOCK_SECOND * 10) << scale), - reconnect, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -callback(struct http_socket *s, void *ptr, - http_socket_event_t e, - const uint8_t *data, uint16_t datalen) -{ - uint8_t i; - - if(e == HTTP_SOCKET_ERR) { - printf("HTTP socket error\n"); - } else if(e == HTTP_SOCKET_TIMEDOUT) { - printf("HTTP socket error: timed out\n"); - restart(); - } else if(e == HTTP_SOCKET_ABORTED) { - printf("HTTP socket error: aborted\n"); - restart(); - } else if(e == HTTP_SOCKET_HOSTNAME_NOT_FOUND) { - printf("HTTP socket error: hostname not found\n"); - restart(); - } else if(e == HTTP_SOCKET_CLOSED) { - - if(bytes_received) { - printf("HTTP socket received data:\n\n"); - for(i=0; i -/*---------------------------------------------------------------------------*/ -static struct http_socket s; -static char data_received[HTTP_CLIENT_BUFFER_LEN]; -static char url_buffer[HTTP_CLIENT_BUFFER_LEN]; -static int bytes_received = 0; -static int restarts; -static struct ctimer reconnect_timer; -/*---------------------------------------------------------------------------*/ -static void callback(struct http_socket *s, void *ptr, - http_socket_event_t e, - const uint8_t *data, uint16_t datalen); -/*---------------------------------------------------------------------------*/ -PROCESS(http_example_process, "IFTTT HTTP Example"); -AUTOSTART_PROCESSES(&http_example_process); -/*---------------------------------------------------------------------------*/ -static void -reconnect(void *dummy) -{ - leds_on(LEDS_GREEN); - http_socket_post(&s, url_buffer, NULL, 0, NULL, callback, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -restart(void) -{ - int scale; - restarts++; - printf("Number of restarts %d\n", restarts); - leds_off(LEDS_GREEN); - - scale = restarts; - if(scale > 5) { - scale = 5; - } - - ctimer_set(&reconnect_timer, random_rand() % ((CLOCK_SECOND * 10) << scale), - reconnect, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -callback(struct http_socket *s, void *ptr, - http_socket_event_t e, - const uint8_t *data, uint16_t datalen) -{ - uint8_t i; - - if(e == HTTP_SOCKET_ERR) { - printf("HTTP socket error\n"); - } else if(e == HTTP_SOCKET_TIMEDOUT) { - printf("HTTP socket error: timed out\n"); - restart(); - } else if(e == HTTP_SOCKET_ABORTED) { - printf("HTTP socket error: aborted\n"); - restart(); - } else if(e == HTTP_SOCKET_HOSTNAME_NOT_FOUND) { - printf("HTTP socket error: hostname not found\n"); - restart(); - } else if(e == HTTP_SOCKET_CLOSED) { - - if(bytes_received) { - printf("HTTP socket received data:\n\n"); - for(i=0; i - * Niclas Finne - * Joakim Eriksson - */ -/*---------------------------------------------------------------------------*/ -#include -#include -#include "contiki-net.h" -#include "httpd-simple.h" -#define webserver_log_file(...) -#define webserver_log(...) - -#ifndef WEBSERVER_CONF_CFS_CONNS -#define CONNS UIP_TCP_CONNS -#else /* WEBSERVER_CONF_CFS_CONNS */ -#define CONNS WEBSERVER_CONF_CFS_CONNS -#endif /* WEBSERVER_CONF_CFS_CONNS */ - -#ifndef WEBSERVER_CONF_CFS_URLCONV -#define URLCONV 0 -#else /* WEBSERVER_CONF_CFS_URLCONV */ -#define URLCONV WEBSERVER_CONF_CFS_URLCONV -#endif /* WEBSERVER_CONF_CFS_URLCONV */ -/*---------------------------------------------------------------------------*/ -#define STATE_WAITING 0 -#define STATE_OUTPUT 1 -/*---------------------------------------------------------------------------*/ -MEMB(conns, struct httpd_state, CONNS); -/*---------------------------------------------------------------------------*/ -#define ISO_nl 0x0a -#define ISO_space 0x20 -#define ISO_period 0x2e -#define ISO_slash 0x2f -/*---------------------------------------------------------------------------*/ -static const char *NOT_FOUND = "" -"
" -"

404 - file not found

" -"
" -"" -""; -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_string(struct httpd_state *s, const char *str)) -{ - PSOCK_BEGIN(&s->sout); - - SEND_STRING(&s->sout, str); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -const char http_content_type_html[] = "Content-type: text/html\r\n\r\n"; -static -PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr)) -{ - /* char *ptr; */ - - PSOCK_BEGIN(&s->sout); - - SEND_STRING(&s->sout, statushdr); - SEND_STRING(&s->sout, http_content_type_html); - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -const char http_header_200[] = "HTTP/1.0 200 OK\r\nServer: Contiki/Zolertia/\r\nConnection: close\r\n"; -const char http_header_404[] = "HTTP/1.0 404 Not found\r\nServer: Contiki/Zolertia/\r\nConnection: close\r\n"; -static -PT_THREAD(handle_output(struct httpd_state *s)) -{ - PT_BEGIN(&s->outputpt); - - s->script = NULL; - s->script = httpd_simple_get_script(&s->filename[1]); - if(s->script == NULL) { - strncpy(s->filename, "/notfound.html", sizeof(s->filename)); - PT_WAIT_THREAD(&s->outputpt, - send_headers(s, http_header_404)); - PT_WAIT_THREAD(&s->outputpt, - send_string(s, NOT_FOUND)); - uip_close(); - webserver_log_file(&uip_conn->ripaddr, "404 - not found"); - PT_EXIT(&s->outputpt); - } else { - PT_WAIT_THREAD(&s->outputpt, - send_headers(s, http_header_200)); - PT_WAIT_THREAD(&s->outputpt, s->script(s)); - } - s->script = NULL; - PSOCK_CLOSE(&s->sout); - PT_END(&s->outputpt); -} -/*---------------------------------------------------------------------------*/ -const char http_get[] = "GET "; -const char http_index_html[] = "/index.html"; -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_input(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sin); - - PSOCK_READTO(&s->sin, ISO_space); - - if(strncmp(s->inputbuf, http_get, 4) != 0) { - PSOCK_CLOSE_EXIT(&s->sin); - } - PSOCK_READTO(&s->sin, ISO_space); - - if(s->inputbuf[0] != ISO_slash) { - PSOCK_CLOSE_EXIT(&s->sin); - } - -#if URLCONV - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - urlconv_tofilename(s->filename, s->inputbuf, sizeof(s->filename)); -#else /* URLCONV */ - if(s->inputbuf[1] == ISO_space) { - strncpy(s->filename, http_index_html, sizeof(s->filename)); - } else { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - strncpy(s->filename, s->inputbuf, sizeof(s->filename)); - } -#endif /* URLCONV */ - - webserver_log_file(&uip_conn->ripaddr, s->filename); - - s->state = STATE_OUTPUT; - - while(1) { - PSOCK_READTO(&s->sin, ISO_nl); - } - - PSOCK_END(&s->sin); -} -/*---------------------------------------------------------------------------*/ -static void -handle_connection(struct httpd_state *s) -{ - handle_input(s); - if(s->state == STATE_OUTPUT) { - handle_output(s); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_appcall(void *state) -{ - struct httpd_state *s = (struct httpd_state *)state; - - if(uip_closed() || uip_aborted() || uip_timedout()) { - if(s != NULL) { - s->script = NULL; - memb_free(&conns, s); - } - } else if(uip_connected()) { - s = (struct httpd_state *)memb_alloc(&conns); - if(s == NULL) { - uip_abort(); - webserver_log_file(&uip_conn->ripaddr, "reset (no memory block)"); - return; - } - tcp_markconn(uip_conn, s); - PSOCK_INIT(&s->sin, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); - PSOCK_INIT(&s->sout, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); - PT_INIT(&s->outputpt); - s->script = NULL; - s->state = STATE_WAITING; - timer_set(&s->timer, CLOCK_SECOND * 10); - handle_connection(s); - } else if(s != NULL) { - if(uip_poll()) { - if(timer_expired(&s->timer)) { - uip_abort(); - s->script = NULL; - memb_free(&conns, s); - webserver_log_file(&uip_conn->ripaddr, "reset (timeout)"); - } - } else { - timer_restart(&s->timer); - } - handle_connection(s); - } else { - uip_abort(); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_init(void) -{ - tcp_listen(UIP_HTONS(80)); - memb_init(&conns); -#if URLCONV - urlconv_init(); -#endif /* URLCONV */ -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/platform-specific/zoul/orion/ip64-router/httpd-simple.h b/examples/platform-specific/zoul/orion/ip64-router/httpd-simple.h deleted file mode 100644 index c3e2a0769..000000000 --- a/examples/platform-specific/zoul/orion/ip64-router/httpd-simple.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A simple webserver - * \author - * Adam Dunkels - * Niclas Finne - * Joakim Eriksson - */ -/*---------------------------------------------------------------------------*/ -#ifndef HTTPD_SIMPLE_H_ -#define HTTPD_SIMPLE_H_ - -#include "contiki-net.h" -#ifndef WEBSERVER_CONF_CFS_PATHLEN -#define HTTPD_PATHLEN 2 -#else /* WEBSERVER_CONF_CFS_CONNS */ -#define HTTPD_PATHLEN WEBSERVER_CONF_CFS_PATHLEN -#endif /* WEBSERVER_CONF_CFS_CONNS */ -/*---------------------------------------------------------------------------*/ -struct httpd_state; -typedef char (* httpd_simple_script_t)(struct httpd_state *s); -/*---------------------------------------------------------------------------*/ -struct httpd_state { - struct timer timer; - struct psock sin, sout; - struct pt outputpt; - char inputbuf[HTTPD_PATHLEN + 24]; -/*char outputbuf[UIP_TCP_MSS]; */ - char filename[HTTPD_PATHLEN]; - httpd_simple_script_t script; - char state; -}; -/*---------------------------------------------------------------------------*/ -void httpd_init(void); -void httpd_appcall(void *state); -httpd_simple_script_t httpd_simple_get_script(const char *name); -/*---------------------------------------------------------------------------*/ -#define SEND_STRING(s, str) PSOCK_SEND(s, (uint8_t *)str, strlen(str)) -/*---------------------------------------------------------------------------*/ -#endif /* HTTPD_SIMPLE_H_ */ diff --git a/examples/platform-specific/zoul/orion/ip64-router/ip64-router.c b/examples/platform-specific/zoul/orion/ip64-router/ip64-router.c deleted file mode 100644 index 4b3279e44..000000000 --- a/examples/platform-specific/zoul/orion/ip64-router/ip64-router.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zolertia-orion-router - * @{ - * - * \file - * Example of an Ethernet IP64 router with weberver - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/routing/routing.h" -#include "dev/leds.h" -#include "ip64/ip64.h" -#include "net/netstack.h" -#include "httpd-simple.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define BUFFER_LENGTH 256 -/*---------------------------------------------------------------------------*/ -#define LEDS_DHCP LEDS_GREEN -#define WEBSERVER_CONF_LOADTIME 0 -#define WEBSERVER_CONF_FILESTATS 0 -#define WEBSERVER_CONF_NEIGHBOR_STATUS 0 -/*---------------------------------------------------------------------------*/ -PROCESS(router_node_process, "Router node w/ webserver"); -/*---------------------------------------------------------------------------*/ -#if WEBSERVER_CONF_ROUTE_LINKS - #define BUF_USES_STACK 1 -#endif - -PROCESS(webserver_nogui_process, "Web server"); -PROCESS_THREAD(webserver_nogui_process, ev, data) -{ - PROCESS_BEGIN(); - - httpd_init(); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); - httpd_appcall(data); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -AUTOSTART_PROCESSES(&router_node_process,&webserver_nogui_process); -/*---------------------------------------------------------------------------*/ -static const char *TOP = "Zolertia IP64 Router\n"; -static const char *BOTTOM = "\n"; -#if BUF_USES_STACK -static char *bufptr, *bufend; -#define ADD(...) do { \ - bufptr += snprintf(bufptr, bufend - bufptr, __VA_ARGS__); \ - } while(0) -#else -static char buf[BUFFER_LENGTH]; -static int blen; -#define ADD(...) do { \ - blen += snprintf(&buf[blen], sizeof(buf) - blen, __VA_ARGS__); \ - } while(0) -#endif - -/*---------------------------------------------------------------------------*/ -static void -ipaddr_add(const uip_ipaddr_t *addr) -{ - uint16_t a; - int i, f; - for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) { - a = (addr->u8[i] << 8) + addr->u8[i + 1]; - if(a == 0 && f >= 0) { - if(f++ == 0) ADD("::"); - } else { - if(f > 0) { - f = -1; - } else if(i > 0) { - ADD(":"); - } - ADD("%x", a); - } - } -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(generate_routes(struct httpd_state *s)) -{ - static uip_ds6_route_t *r; - static uip_ds6_nbr_t *nbr; -#if BUF_USES_STACK - char buf[BUFFER_LENGTH]; -#endif -#if WEBSERVER_CONF_LOADTIME - static clock_time_t numticks; - numticks = clock_time(); -#endif - - PSOCK_BEGIN(&s->sout); - SEND_STRING(&s->sout, TOP); -#if BUF_USES_STACK - bufptr = buf;bufend=bufptr+sizeof(buf); -#else - blen = 0; -#endif - ADD("Neighbors
");
-
-  for(nbr = uip_ds6_nbr_head();
-      nbr != NULL;
-      nbr = uip_ds6_nbr_next(nbr)) {
-
-#if WEBSERVER_CONF_NEIGHBOR_STATUS
-#if BUF_USES_STACK
-      {
-        char* j = bufptr + 25;
-        ipaddr_add(&nbr->ipaddr);
-        while (bufptr < j) ADD(" ");
-        switch (nbr->state) {
-          case NBR_INCOMPLETE: ADD(" INCOMPLETE");break;
-          case NBR_REACHABLE: ADD(" REACHABLE");break;
-          case NBR_STALE: ADD(" STALE");break;
-          case NBR_DELAY: ADD(" DELAY");break;
-          case NBR_PROBE: ADD(" NBR_PROBE");break;
-        }
-      }
-#else
-      {
-        uint8_t j = blen + 25;
-        ipaddr_add(&nbr->ipaddr);
-        while (blen < j) ADD(" ");
-        switch (nbr->state) {
-          case NBR_INCOMPLETE: ADD(" INCOMPLETE");break;
-          case NBR_REACHABLE: ADD(" REACHABLE");break;
-          case NBR_STALE: ADD(" STALE");break;
-          case NBR_DELAY: ADD(" DELAY");break;
-          case NBR_PROBE: ADD(" NBR_PROBE");break;
-        }
-      }
-#endif
-#else
-      ipaddr_add(&nbr->ipaddr);
-#endif
-
-      ADD("\n");
-#if BUF_USES_STACK
-      if(bufptr > bufend - 45) {
-        SEND_STRING(&s->sout, buf);
-        bufptr = buf; bufend = bufptr + sizeof(buf);
-      }
-#else
-      if(blen > sizeof(buf) - 45) {
-        SEND_STRING(&s->sout, buf);
-        blen = 0;
-      }
-#endif
-  }
-  ADD("
Routes
");
-  SEND_STRING(&s->sout, buf);
-#if BUF_USES_STACK
-  bufptr = buf; bufend = bufptr + sizeof(buf);
-#else
-  blen = 0;
-#endif
-
-  for(r = uip_ds6_route_head(); r != NULL; r = uip_ds6_route_next(r)) {
-
-#if BUF_USES_STACK
-#if WEBSERVER_CONF_ROUTE_LINKS
-    ADD("ipaddr);
-    ADD("]/status.shtml>");
-    ipaddr_add(&r->ipaddr);
-    ADD("");
-#else
-    ipaddr_add(&r->ipaddr);
-#endif
-#else
-#if WEBSERVER_CONF_ROUTE_LINKS
-    ADD("ipaddr);
-    ADD("]/status.shtml>");
-    SEND_STRING(&s->sout, buf);
-    blen = 0;
-    ipaddr_add(&r->ipaddr);
-    ADD("");
-#else
-    ipaddr_add(&r->ipaddr);
-#endif
-#endif
-    ADD("/%u (via ", r->length);
-    ipaddr_add(uip_ds6_route_nexthop(r));
-    if(1 || (r->state.lifetime < 600)) {
-      ADD(") %lus\n", (unsigned long)r->state.lifetime);
-    } else {
-      ADD(")\n");
-    }
-    SEND_STRING(&s->sout, buf);
-#if BUF_USES_STACK
-    bufptr = buf; bufend = bufptr + sizeof(buf);
-#else
-    blen = 0;
-#endif
-  }
-  ADD("
"); - -#if WEBSERVER_CONF_FILESTATS - static uint16_t numtimes; - ADD("
This page sent %u times",++numtimes); -#endif - -#if WEBSERVER_CONF_LOADTIME - numticks = clock_time() - numticks + 1; - ADD(" (%u.%02u sec)", numticks / CLOCK_SECOND, - (100 * (numticks % CLOCK_SECOND)) / CLOCK_SECOND)); -#endif - - SEND_STRING(&s->sout, buf); - SEND_STRING(&s->sout, BOTTOM); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -httpd_simple_script_t -httpd_simple_get_script(const char *name) -{ - return generate_routes; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(router_node_process, ev, data) -{ - PROCESS_BEGIN(); - - static struct etimer et; - - /* Turn radio off while initialazing */ - NETSTACK_MAC.off(); - - /* Initialize the IP64 module so we'll start translating packets */ - ip64_init(); - - printf("Waiting for an address...\n"); - - /* Wait to get a DHCP address */ - etimer_set(&et, CLOCK_SECOND * 5); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - leds_toggle(LEDS_DHCP); - - if(ip64_hostaddr_is_configured()) { - - const uip_ip4addr_t *hostaddr = ip64_get_hostaddr(); - const uip_ip4addr_t *netmask = ip64_get_netmask(); - const uip_ip4addr_t *gwaddr = ip64_get_draddr(); - - printf("IPv4 DHCP address: %d.%d.%d.%d\n", hostaddr->u8[0], - hostaddr->u8[1], - hostaddr->u8[2], - hostaddr->u8[3]); - printf("Netmask : %d.%d.%d.%d\n", netmask->u8[0], netmask->u8[1], - netmask->u8[2], netmask->u8[3]); - printf("Gateway: %d.%d.%d.%d\n", gwaddr->u8[0], gwaddr->u8[1], - gwaddr->u8[2], gwaddr->u8[3]); - break; - } - etimer_reset(&et); - } - - leds_off(LEDS_DHCP); - - /* Set us up as a RPL root node. */ - NETSTACK_ROUTING.root_start(); - - /* ... and do nothing more. */ - while(1) { - PROCESS_WAIT_EVENT(); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/examples/platform-specific/zoul/orion/ip64-router/project-conf.h b/examples/platform-specific/zoul/orion/ip64-router/project-conf.h deleted file mode 100644 index bbec833ad..000000000 --- a/examples/platform-specific/zoul/orion/ip64-router/project-conf.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zolertia-orion-router Zolertia's Orion border router - * - * Implements a simple IP64 router with a webserver - * - * @{ - * - * \file - * Configuration file for the Zolertia's Orion IP64 router - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -/* Prevent the router from dropping below LPM2 to avoid RAM overflow */ -#define LPM_CONF_MAX_PM 0 - -/* Use either the cc1200_driver for sub-1GHz, or cc2538_rf_driver (default) - * for 2.4GHz built-in radio interface - */ -#define NETSTACK_CONF_RADIO cc2538_rf_driver - -/* USe DHCP */ -#define IP64_CONF_DHCP 1 - -/* Webserver settings */ -#define WEBSERVER_CONF_ROUTE_LINKS 0 -#define UIP_CONF_RECEIVE_WINDOW 128 -#define WEBSERVER_CONF_CFS_CONNS 2 -#define UIP_CONF_BUFFER_SIZE 900 -#define UIP_CONF_TCP 1 -#define UIP_CONF_TCP_MSS 128 - -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/zoul/project-conf.h b/examples/platform-specific/zoul/project-conf.h deleted file mode 100644 index 8f3914f20..000000000 --- a/examples/platform-specific/zoul/project-conf.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \file - * Project specific configuration defines for the basic RE-Mote examples - */ -/*---------------------------------------------------------------------------*/ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define BROADCAST_CHANNEL 129 - -/* Pin definition for the test-motion example, for the RE-Mote it uses the - * ADC1 pin - */ -#define MOTION_SENSOR_PORT GPIO_A_NUM -#define MOTION_SENSOR_PIN 5 -#define MOTION_SENSOR_VECTOR GPIO_A_IRQn - -/* Specify the digital light sensor model to use: TSL2561 (default) or TSL2563 */ -#define TSL256X_CONF_REF TSL2561_SENSOR_REF - -/* Use the following I2C address for the BME280 sensor (from MikroElektronika) */ -#define BME280_CONF_ADDR 0x76 - -#endif /* PROJECT_CONF_H_ */ - -/** @} */ diff --git a/examples/platform-specific/zoul/rev-b/Makefile b/examples/platform-specific/zoul/rev-b/Makefile deleted file mode 100644 index 43d381c3f..000000000 --- a/examples/platform-specific/zoul/rev-b/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -CONTIKI_PROJECT = test-power-mgmt - -BOARD ?= remote-revb - -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = zoul -BOARDS_ONLY = remote-revb - -CONTIKI = ../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/zoul/rev-b/Makefile.target b/examples/platform-specific/zoul/rev-b/Makefile.target deleted file mode 100644 index cb458a6d9..000000000 --- a/examples/platform-specific/zoul/rev-b/Makefile.target +++ /dev/null @@ -1,2 +0,0 @@ -TARGET = zoul -BOARD = remote-revb diff --git a/examples/platform-specific/zoul/rev-b/project-conf.h b/examples/platform-specific/zoul/rev-b/project-conf.h deleted file mode 100644 index ee6c93165..000000000 --- a/examples/platform-specific/zoul/rev-b/project-conf.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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. - */ -/** - * \addtogroup remote-examples - * @{ - * - * \defgroup remote-power-mgmt-revb-test RE-Mote rev.B power management test - * - * Test the RE-Mote revision B power management implementation - * @{ - * - * \file - * Project specific configuration defines for the basic RE-Mote examples - */ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define BROADCAST_CHANNEL 129 - -#define RTC_CONF_INIT 1 -#define RTC_CONF_SET_FROM_SYS 1 - -#endif /* PROJECT_CONF_H_ */ - -/** - * @} - * @} - */ diff --git a/examples/platform-specific/zoul/rev-b/test-power-mgmt.c b/examples/platform-specific/zoul/rev-b/test-power-mgmt.c deleted file mode 100644 index 942a01933..000000000 --- a/examples/platform-specific/zoul/rev-b/test-power-mgmt.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-power-mgmt-revb-test - * @{ - * - * Test the RE-Mote's power management features, shutdown mode and battery - * management. - * - * @{ - * - * \author - * Aitor Mejias - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cpu.h" -#include "sys/process.h" -#include "dev/leds.h" -#include "dev/sys-ctrl.h" -#include "lib/list.h" -#include "power-mgmt.h" -#include "rtcc.h" -#include -#include -#include -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -/* RE-Mote revision B, low-power PIC version */ -#define PM_EXPECTED_VERSION 0x20 -/*---------------------------------------------------------------------------*/ -#define TEST_LEDS_FAIL leds_off(LEDS_ALL); \ - leds_on(LEDS_RED); \ - PROCESS_EXIT(); -/*---------------------------------------------------------------------------*/ -#define TEST_ALARM_SECOND 15 -/*---------------------------------------------------------------------------*/ -PROCESS(test_remote_pm, "RE-Mote rev.B Power Management Test"); -AUTOSTART_PROCESSES(&test_remote_pm); -/*---------------------------------------------------------------------------*/ -static uint8_t rtc_buffer[sizeof(simple_td_map)]; -static simple_td_map *simple_td = (simple_td_map *)rtc_buffer; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_remote_pm, ev, data) -{ - static uint8_t aux; - static uint16_t voltage; - static uint32_t cycles; - - PROCESS_BEGIN(); - - aux = 0; - cycles = 0; - - /* Initialize the power management block and signal the low-power PIC */ - if(pm_enable() != PM_SUCCESS) { - printf("PM: Failed to initialize\n"); - TEST_LEDS_FAIL; - } - - printf("PM: enabled!\n"); - - /* Retrieve the firmware version and check expected */ - if((pm_get_fw_ver(&aux) == PM_ERROR) || - (aux != PM_EXPECTED_VERSION)) { - printf("PM: unexpected version 0x%02X\n", aux); - TEST_LEDS_FAIL; - } - - printf("PM: firmware version 0x%02X OK\n", aux); - - /* Read the battery voltage level */ - if(pm_get_voltage(&voltage) != PM_SUCCESS) { - printf("PM: error retrieving voltage\n"); - TEST_LEDS_FAIL; - } - - printf("PM: Voltage (raw) = %u\n", voltage); - - /* Note: if running the following test while the RE-Mote is powered over USB - * will show the command execution, but it will not put the board in shutdown - * mode. If powering the RE-Mote with an external battery the shutdown mode - * will operate as intended, and the RE-Mote will restart and run the tests - * from the start after waking-up off the shutdown mode. - * - * The first test shows how to use the "soft" shutdown mode, being the low - * power PIC the one counting cycles and restarting the system off shutdown - * mode. - * - * Each restart cycle is tracked by the low-power PIC, we can use this value - * to determine how many times we have entered shutdown mode, thus choosing - * a specific configuration or behaviour. For the next examples we are going - * to trigger a "soft" mode each even number, and "hard" if odd. - */ - - cycles = pm_get_num_cycles(); - printf("PM: cycle number %lu\n", cycles); - - if((cycles % 2) == 0) { - /* Set the timeout */ - if(pm_set_timeout(PM_SOFT_SHTDN_5_7_SEC) != PM_SUCCESS) { - printf("PM: error setting timeout for soft shutdown mode\n"); - TEST_LEDS_FAIL; - } - - printf("PM: Soft shutdown, timeout set to %lu\n", pm_get_timeout()); - - leds_off(LEDS_ALL); - leds_on(LEDS_RED); - - /* Wait just enough to be able to check the LED result */ - etimer_set(&et, CLOCK_SECOND * 3); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Enter soft shut*/ - if(pm_shutdown_now(PM_SOFT_SLEEP_CONFIG) == PM_SUCCESS) { - printf("PM: Good night!\n"); - } else { - printf("PM: error shutting down the system!\n"); - TEST_LEDS_FAIL; - } - - /* Exit and wait the next cycle */ - PROCESS_EXIT(); - } - - /* Configure the RTCC to schedule a "hard" restart of the shutdown mode, - * waking up from a RTCC interrupt to the low-power PIC - */ - printf("PM\n"); - - if(rtcc_get_time_date(simple_td) == AB08_ERROR) { - printf("PM: Couldn't read time and date\n"); - TEST_LEDS_FAIL; - } - - printf("PM: Configured time: "); - rtcc_print(RTCC_PRINT_DATE_DEC); - - /* Configure the RTCC to trigger an alarm tick */ - printf("\nPM: Setting an alarm to tick in %u seconds\n", TEST_ALARM_SECOND); - if(rtcc_date_increment_seconds(simple_td, TEST_ALARM_SECOND) == AB08_ERROR) { - printf("PM: could not increment the next alarm date\n"); - TEST_LEDS_FAIL; - } - - /* Set the timeout to zero to avoid the PIC being awake while waiting for the - * RTCC system to kick-in - */ - if(pm_set_timeout(0x00) != PM_SUCCESS) { - printf("PM: couldn't clear the shutdown period\n"); - TEST_LEDS_FAIL; - } - - /* We use the RTCC_REPEAT_DAY as we want the RTCC to match the given date */ - if(rtcc_set_alarm_time_date(simple_td, RTCC_ALARM_ON, RTCC_REPEAT_DAY, - RTCC_TRIGGER_INT2) == AB08_ERROR) { - printf("PM: couldn't set the alarm\n"); - TEST_LEDS_FAIL; - } - - printf("PM: Alarm set to match: "); - rtcc_print(RTCC_PRINT_ALARM_DEC); - - leds_off(LEDS_ALL); - leds_on(LEDS_BLUE); - - etimer_set(&et, CLOCK_SECOND * 3); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - if(pm_shutdown_now(PM_HARD_SLEEP_CONFIG) == PM_SUCCESS) { - printf("PM: good night!\n"); - } else { - printf("PM: error shutting down the system!\n"); - TEST_LEDS_FAIL; - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** -* @} -* @} -*/ diff --git a/examples/platform-specific/zoul/rtcc/Makefile b/examples/platform-specific/zoul/rtcc/Makefile deleted file mode 100644 index 9a3bc0aec..000000000 --- a/examples/platform-specific/zoul/rtcc/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CONTIKI_PROJECT = test-rtcc - -TARGET = zoul - -all: $(CONTIKI_PROJECT) - -PLATFORMS_ONLY = zoul -# Only the Re-Mote is equiped with an RTCC -BOARDS_ONLY = remote-reva remote-revb - -CONTIKI = ../../../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/zoul/rtcc/Makefile.target b/examples/platform-specific/zoul/rtcc/Makefile.target deleted file mode 100644 index 75430a6e4..000000000 --- a/examples/platform-specific/zoul/rtcc/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = zoul diff --git a/examples/platform-specific/zoul/rtcc/project-conf.h b/examples/platform-specific/zoul/rtcc/project-conf.h deleted file mode 100644 index 365c851f8..000000000 --- a/examples/platform-specific/zoul/rtcc/project-conf.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup remote-rtcc-test RE-Mote on-board RTCC test application - * - * Test the Real-Time-Clock-Calendar built in the RE-Motes revision A and B - * @{ - * - * \file - * Project specific configuration defines for the RTCC RE-Mote example - */ -/*---------------------------------------------------------------------------*/ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define RTC_CONF_INIT 1 -#define RTC_CONF_SET_FROM_SYS 1 - -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/zoul/rtcc/test-rtcc.c b/examples/platform-specific/zoul/rtcc/test-rtcc.c deleted file mode 100644 index 36ca2b324..000000000 --- a/examples/platform-specific/zoul/rtcc/test-rtcc.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-rtcc-test - * @{ - * - * Example project to show the on-board RTCC configuration and operation - * Retrieves the current time and date from the system, then sets an alarm to - * trigger every TEST_ALARM_SECOND match, generating an interrupt event and - * printing the current time/date, toggling also the LEDs - * - * @{ - * - * \file - * RE-Mote on-board RTCC test application - * \author - * Antonio Lignan - * Aitor Mejias - * Toni Lozano - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "rtcc.h" -#include "dev/i2c.h" -#include "dev/leds.h" -#include -#include -/*---------------------------------------------------------------------------*/ -#define LOOP_PERIOD 60L -#define LOOP_INTERVAL (CLOCK_SECOND * LOOP_PERIOD) -#define TEST_ALARM_SECOND 15 -/*---------------------------------------------------------------------------*/ -/* Enable to match a given second number every minute, else it will trigger an - * interrupt every TEST_ALARM_SECOND - */ -#define TEST_ALARM_MATCH_MIN 0 -/*---------------------------------------------------------------------------*/ -PROCESS(test_remote_rtcc_process, "Test RTC driver process"); -AUTOSTART_PROCESSES(&test_remote_rtcc_process); -/*---------------------------------------------------------------------------*/ -static uint8_t rtc_buffer[sizeof(simple_td_map)]; -static simple_td_map *simple_td = (simple_td_map *)rtc_buffer; -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -void -configure_new_alarm(void) -{ - if(rtcc_date_increment_seconds(simple_td, TEST_ALARM_SECOND) == AB08_ERROR) { - printf("Fail: could not increment the next alarm date\n"); - return; - } - - /* We use the RTCC_REPEAT_DAY as we want the RTCC to match the given date */ - if(rtcc_set_alarm_time_date(simple_td, RTCC_ALARM_ON, RTCC_REPEAT_DAY, - RTCC_TRIGGER_INT1) == AB08_ERROR) { - printf("Fail: couldn't set the alarm\n"); - return; - } - - printf("Alarm set to match: "); - rtcc_print(RTCC_PRINT_ALARM_DEC); -} -/*---------------------------------------------------------------------------*/ -void -rtcc_interrupt_callback(uint8_t value) -{ - printf("A RTCC interrupt just happened! time/date: "); - rtcc_print(RTCC_PRINT_DATE_DEC); - leds_toggle(LEDS_ALL); - -#if !TEST_ALARM_MATCH_MIN - configure_new_alarm(); -#endif -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_remote_rtcc_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("RE-Mote RTC test\n"); - - /* Map interrupt callback handler */ - RTCC_REGISTER_INT1(rtcc_interrupt_callback); - - /* Wait a bit */ - etimer_set(&et, (CLOCK_SECOND * 2)); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Retrieve the configured time and date, this doesn't overwrites the - * mode and century values - */ - if(rtcc_get_time_date(simple_td) == AB08_ERROR) { - printf("Fail: Couldn't read time and date\n"); - PROCESS_EXIT(); - } - - /* ...or for visualization only, just print the date directly from the RTCC */ - printf("Configured time: "); - rtcc_print(RTCC_PRINT_DATE_DEC); - -#if TEST_ALARM_MATCH_MIN - /* Configure the RTCC to trigger an alarm every TEST_ALARM_SECOND match */ - printf("Setting an alarm to tick every %u seconds match\n", TEST_ALARM_SECOND); - - simple_td->seconds = TEST_ALARM_SECOND; - - /* Notice the arguments, we want to trigger the alarm every time the clock - * matches the seconds values, so the alarm would have to be repeated every - * minute. In case we would want to trigger the alarm on a specific time, - * then we would want to set a daily repeat interval - */ - if(rtcc_set_alarm_time_date(simple_td, RTCC_ALARM_ON, RTCC_REPEAT_MINUTE, - RTCC_TRIGGER_INT1) == AB08_ERROR) { - printf("Fail: couldn't set the alarm\n"); - PROCESS_EXIT(); - } - -#else - /* Configure the RTCC to trigger an alarm every TEST_ALARM_SECOND tick */ - printf("Setting an alarm to tick every %u seconds\n", TEST_ALARM_SECOND); - - configure_new_alarm(); -#endif - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/zoul/test-aac-sensor.c b/examples/platform-specific/zoul/test-aac-sensor.c deleted file mode 100644 index d6d8bda01..000000000 --- a/examples/platform-specific/zoul/test-aac-sensor.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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. - */ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-aac-sensor-test Test AAC sensor - * - * Demonstrates the operation of the current AAC analog sensor - * @{ - * - * \file - * Example demonstrating the RE-Mote & AAC sensor 0-5V 50Amps AC - * - * \author - * Javier Sánchez - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/etimer.h" -#include "sys/rtimer.h" -#include "dev/leds.h" -#include "dev/adc-sensors.h" -#include -#include -/*---------------------------------------------------------------------------*/ -#define ADC_PIN 2 -#define LOOP_PERIOD 2 -#define LOOP_INTERVAL (CLOCK_SECOND * LOOP_PERIOD) -#define LEDS_PERIODIC LEDS_GREEN -/*---------------------------------------------------------------------------*/ -static struct etimer et; - -static uint16_t counter; -/*---------------------------------------------------------------------------*/ -PROCESS(test_aac_sensor_process, "Test AAC sensor process"); -AUTOSTART_PROCESSES(&test_aac_sensor_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_aac_sensor_process, ev, data) -{ - - PROCESS_BEGIN(); - - counter = 0; - - /* Configure the ADC ports */ - /* Use pin number not mask, for example if using the PA5 pin then use 5 */ - adc_sensors.configure(ANALOG_AAC_SENSOR, ADC_PIN); - - printf("AAC test application\n"); - leds_on(LEDS_PERIODIC); - etimer_set(&et, LOOP_INTERVAL); - - while(1) { - - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_TIMER) { - leds_toggle(LEDS_PERIODIC); - - printf("-----------------------------------------\n" - "Counter = 0x%08x\n", counter); - - printf("AC Amps = %d mA\n", adc_sensors.value(ANALOG_AAC_SENSOR)); - - etimer_set(&et, LOOP_INTERVAL); - counter++; - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-ac-dimmer.c b/examples/platform-specific/zoul/test-ac-dimmer.c deleted file mode 100644 index 6fd28faa7..000000000 --- a/examples/platform-specific/zoul/test-ac-dimmer.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-ac-dimmer-test Krida Electronics AC light dimmer test example - * - * Demonstrates the use of an AC dimmer with zero-crossing, connected to the - * ADC1 and ADC2 pins (PA5 and PA4 respectively), powered over the D+5.1 pin - * - * @{ - * - * \file - * A quick program to test an AC dimmer - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/ac-dimmer.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -PROCESS(remote_ac_dimmer_process, "AC light dimmer test"); -AUTOSTART_PROCESSES(&remote_ac_dimmer_process); -/*---------------------------------------------------------------------------*/ -static uint8_t dimming; -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_ac_dimmer_process, ev, data) -{ - PROCESS_BEGIN(); - - dimming = 0; - SENSORS_ACTIVATE(ac_dimmer); - - printf("AC dimmer: min %u%% max %u%%\n", DIMMER_DEFAULT_MIN_DIMM_VALUE, - DIMMER_DEFAULT_MAX_DIMM_VALUE); - - /* Set the lamp to 10% and wait a few seconds */ - ac_dimmer.value(DIMMER_DEFAULT_MIN_DIMM_VALUE); - etimer_set(&et, CLOCK_SECOND * 5); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Upon testing for duty cycles lower than 10% there was noise (probably from - * the triac), causing the driver to skip a beat, and from time to time made - * the test lamp blink. This is easily reproducible by setting the dimmer to - * 5% and using a logic analyzer on the SYNC and GATE pins. The noise was - * picked-up also by the non-connected test probes of the logic analyser. - * Nevertheless the difference between 10% and 2% bright-wise is almost - * negligible - */ - while(1) { - - dimming += DIMMER_DEFAULT_MIN_DIMM_VALUE; - if(dimming > DIMMER_DEFAULT_MAX_DIMM_VALUE) { - dimming = DIMMER_DEFAULT_MIN_DIMM_VALUE; - } - - ac_dimmer.value(dimming); - printf("AC dimmer: light is now --> %u\n", ac_dimmer.status(SENSORS_ACTIVE)); - - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-bme280.c b/examples/platform-specific/zoul/test-bme280.c deleted file mode 100644 index fe5e46542..000000000 --- a/examples/platform-specific/zoul/test-bme280.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-bme280-test BME280 temperature and humidity sensor test - * - * Demonstrates the use of the BME280 digital temperature and humidity sensor - * @{ - * - * \file - * A quick program for testing the BME280 temperature and humidity sensor - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/bme280/bme280.h" -#include "dev/bme280/bme280-sensor.h" -/*---------------------------------------------------------------------------*/ -#define BME280_USE_STD_API 1 -/*---------------------------------------------------------------------------*/ -PROCESS(zoul_bme280_process, "BME280 test"); -AUTOSTART_PROCESSES(&zoul_bme280_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(zoul_bme280_process, ev, data) -{ - PROCESS_BEGIN(); - SENSORS_ACTIVATE(bme280_sensor); - - /* Let it spin and read sensor data */ - - while(1) { - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); -#if BME280_USE_STD_API - printf("temperature = %-d ", bme280_sensor.value(BME280_SENSOR_TEMP)); - printf("humidity = %-d ", bme280_sensor.value(BME280_SENSOR_HUMIDITY)); - printf("pressure = %-d\n", bme280_sensor.value(BME280_SENSOR_PRESSURE)); -#else /* BME280_USE_STD_API */ - /* Trigger burst read */ - bme280_sensor.value(BME280_SENSOR_TEMP); - printf("temperature = %5.2f" , (double)bme280_mea.t_overscale100 / 100.); - printf("humidity = %5.2f ", (double)bme280_mea.h_overscale1024 / 1024.); -#ifdef BME280_64BIT - printf("pressure = %5.2f\n", (double)bme280_mea.p_overscale256 / 256.); -#else /* BME280_64BIT */ - printf("pressure = %5.2f\n", (double)bme280_mea.p); -#endif /* BME280_64BIT */ -#endif /* BME280_USE_STD_API */ - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-bmp085-bmp180.c b/examples/platform-specific/zoul/test-bmp085-bmp180.c deleted file mode 100644 index 81d54b31e..000000000 --- a/examples/platform-specific/zoul/test-bmp085-bmp180.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-bmpx8x-test BMP085/BMP180 pressure and temperature sensor test - * - * Demonstrates the use of the BMP085/BMP180 pressure and temperature sensor - * @{ - * - * \file - * Test file for the BMP085/BMP180 digital pressure and temp sensor - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/i2c.h" -#include "dev/leds.h" -#include "dev/bmpx8x.h" -/*---------------------------------------------------------------------------*/ -#define SENSOR_READ_INTERVAL (CLOCK_SECOND) -/*---------------------------------------------------------------------------*/ -PROCESS(remote_bmpx8x_process, "BMP085/BMP180 test process"); -AUTOSTART_PROCESSES(&remote_bmpx8x_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_bmpx8x_process, ev, data) -{ - PROCESS_BEGIN(); - static uint16_t pressure; - static int16_t temperature; - - /* Use Contiki's sensor macro to enable the sensor */ - SENSORS_ACTIVATE(bmpx8x); - - /* And periodically poll the sensor */ - - while(1) { - etimer_set(&et, SENSOR_READ_INTERVAL); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - pressure = bmpx8x.value(BMPx8x_READ_PRESSURE); - temperature = bmpx8x.value(BMPx8x_READ_TEMP); - - if((pressure != BMPx8x_ERROR) && (temperature != BMPx8x_ERROR)) { - printf("Pressure = %u.%u(hPa), ", pressure / 10, pressure % 10); - printf("Temperature = %d.%u(ºC)\n", temperature / 10, temperature % 10); - } else { - printf("Error, enable the DEBUG flag in the BMPx8x driver for info, "); - printf("or check if the sensor is properly connected\n"); - PROCESS_EXIT(); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-dht22.c b/examples/platform-specific/zoul/test-dht22.c deleted file mode 100644 index 43048eba3..000000000 --- a/examples/platform-specific/zoul/test-dht22.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-dht22-test DHT22 temperature and humidity sensor test - * - * Demonstrates the use of the DHT22 digital temperature and humidity sensor - * @{ - * - * \file - * A quick program for testing the DHT22 temperature and humidity sensor - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/dht22.h" -/*---------------------------------------------------------------------------*/ -PROCESS(remote_dht22_process, "DHT22 test"); -AUTOSTART_PROCESSES(&remote_dht22_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_dht22_process, ev, data) -{ - int16_t temperature, humidity; - - PROCESS_BEGIN(); - SENSORS_ACTIVATE(dht22); - - /* Let it spin and read sensor data */ - - while(1) { - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* The standard sensor API may be used to read sensors individually, using - * the `dht22.value(DHT22_READ_TEMP)` and `dht22.value(DHT22_READ_HUM)`, - * however a single read operation (5ms) returns both values, so by using - * the function below we save one extra operation - */ - if(dht22_read_all(&temperature, &humidity) != DHT22_ERROR) { - printf("Temperature %02d.%02d ºC, ", temperature / 10, temperature % 10); - printf("Humidity %02d.%02d RH\n", humidity / 10, humidity % 10); - } else { - printf("Failed to read the sensor\n"); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-grove-gyro.c b/examples/platform-specific/zoul/test-grove-gyro.c deleted file mode 100644 index 74ff66e03..000000000 --- a/examples/platform-specific/zoul/test-grove-gyro.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-grove-gyro-test Grove's 3-axis gyroscope test application - * - * Demonstrates the use of the Grove's 3-axis gyroscope based on the ITG-3200 - * @{ - * - * \file - * Test file for the external Grove gyroscope - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/i2c.h" -#include "dev/leds.h" -#include "dev/grove-gyro.h" -/*---------------------------------------------------------------------------*/ -#define SENSOR_READ_INTERVAL (CLOCK_SECOND) -#define GROVE_GYRO_EXPECTED_ADDR GROVE_GYRO_ADDR -/*---------------------------------------------------------------------------*/ -PROCESS(remote_grove_gyro_process, "Grove gyro test process"); -AUTOSTART_PROCESSES(&remote_grove_gyro_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -static void -gyro_interrupt_callback(uint8_t status) -{ - /* The interrupt indicates that new data is available, the status value - * returns the outcome of the read operation, check to validate if the - * data is valid to read - */ - leds_toggle(LEDS_RED); - - printf("Gyro: X_axis %u, Y_axis %u, Z_axis %u\n", gyro_values.x, - gyro_values.y, - gyro_values.z); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_grove_gyro_process, ev, data) -{ - PROCESS_BEGIN(); - - uint8_t aux; - - /* Use Contiki's sensor macro to enable the sensor */ - SENSORS_ACTIVATE(grove_gyro); - - /* The sensor itself is in low-power mode, to power on just the sensor and not - * the 3 gyroscope axis use GROVE_GYRO_SENSOR. Alternatively the value - * GROVE_GYRO_ALL could also be used to power everything at once - */ - grove_gyro.configure(GROVE_GYRO_POWER_ON, GROVE_GYRO_SENSOR); - - /* Read back the configured sensor I2C address to check if the sensor is - * working OK, this is the only case in which the value() returns a value - */ - aux = grove_gyro.value(GROVE_GYRO_ADDR); - if(aux == GROVE_GYRO_EXPECTED_ADDR) { - printf("Gyro sensor started with addr 0x%02X\n", GROVE_GYRO_EXPECTED_ADDR); - } else { - printf("Gyro sensor with unrecognized address 0x%02X\n", aux); - PROCESS_EXIT(); - } - - /* Register the interrupt handler */ - GROVE_GYRO_REGISTER_INT(gyro_interrupt_callback); - - /* The gyroscope sensor should be on now but the three gyroscope axis should - * be off, to enable a single axis or any combination of the 3 you can use as - * argument either GROVE_GYRO_X, GROVE_GYRO_Y, GROVE_GYRO_Z. To enable or - * disable the three axis alternatively use GROVE_GYRO_XYZ - */ - grove_gyro.configure(GROVE_GYRO_POWER_ON, GROVE_GYRO_XYZ); - - /* Calibrate the sensor taking 200 samples every 5ms for the zero-point offset - * value, this has to be done manually and is up to the user - */ - grove_gyro.configure(GROVE_GYRO_CALIBRATE_ZERO, 1); - - /* Enabling the data interrupt will feed data directly to the extern data - * structure and notify us about it, depending on the sampling rate and - * divisor this could generate many interrupts/second. A zero argument would - * disable the interrupts - */ - grove_gyro.configure(GROVE_GYRO_DATA_INTERRUPT, 1); - - /* And periodically poll the sensor, values are in º/s */ - - while(1) { - etimer_set(&et, SENSOR_READ_INTERVAL); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* This sensor has a different operation from others using Contiki's sensor - * API, to make data acquisition we write the readings directly to the - * extern data structure, allowing to write more than 1 value at the same - * operation, and also allowing upon a data interrupt event to immediatly - * access the data. The return value of the value() call is then the status - * result of the read operation - */ - if(grove_gyro.value(GROVE_GYRO_XYZ) == GROVE_GYRO_SUCCESS) { - - /* Converted values with a 2-digit precision */ - printf("Gyro: X: %u.%u, Y: %u.%u, Z: %u.%u\n", gyro_values.x / 100, - gyro_values.x % 100, - gyro_values.y / 100, - gyro_values.y % 100, - gyro_values.z / 100, - gyro_values.z % 100); - } else { - printf("Error, enable the DEBUG flag in the grove-gyro driver for info,"); - printf(" or check if the sensor is properly connected\n"); - PROCESS_EXIT(); - } - - if(grove_gyro.value(GROVE_GYRO_TEMP) == GROVE_GYRO_SUCCESS) { - printf("Gyro: temperature %d.%02u C\n", gyro_values.temp / 100, - gyro_values.temp % 100); - } else { - printf("Error, enable the DEBUG flag in the grove-gyro driver for info,"); - printf(" or check if the sensor is properly connected\n"); - PROCESS_EXIT(); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-grove-light-sensor.c b/examples/platform-specific/zoul/test-grove-light-sensor.c deleted file mode 100644 index b4104f2b8..000000000 --- a/examples/platform-specific/zoul/test-grove-light-sensor.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-grove-light-sensor-test Grove's LDR sensor v.1.0 test - * - * Demonstrates the operation of the Grove's analog LDR - * @{ - * - * \file - * Grove's LDR sensor example using the ADC sensors wrapper - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/leds.h" -#include "dev/adc-sensors.h" -/*---------------------------------------------------------------------------*/ -#define ADC_PIN 5 -#define SENSOR_READ_INTERVAL (CLOCK_SECOND / 4) -/*---------------------------------------------------------------------------*/ -PROCESS(remote_grove_light_process, "Grove LDR test process"); -AUTOSTART_PROCESSES(&remote_grove_light_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_grove_light_process, ev, data) -{ - PROCESS_BEGIN(); - - uint16_t ldr; - - /* Use pin number not mask, for example if using the PA5 pin then use 5 */ - adc_sensors.configure(ANALOG_GROVE_LIGHT, 5); - - /* And periodically poll the sensor */ - - while(1) { - etimer_set(&et, SENSOR_READ_INTERVAL); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - ldr = adc_sensors.value(ANALOG_GROVE_LIGHT); - - if(ldr != ADC_WRAPPER_ERROR) { - printf("LDR (resistor) = %u\n", ldr); - } else { - printf("Error, enable the DEBUG flag in adc-wrapper.c for info\n"); - PROCESS_EXIT(); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-grove-loudness-sensor.c b/examples/platform-specific/zoul/test-grove-loudness-sensor.c deleted file mode 100644 index b5042f814..000000000 --- a/examples/platform-specific/zoul/test-grove-loudness-sensor.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-grove-loudness-sensor-test Grove's loudness sensor - * - * Demonstrates the operation of the Grove's analog loudness sensor - * @{ - * - * \file - * Grove's loudness sensor example using the ADC sensors wrapper - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/leds.h" -#include "dev/adc-sensors.h" -/*---------------------------------------------------------------------------*/ -#define ADC_PIN 5 -#define SENSOR_READ_INTERVAL (CLOCK_SECOND / 8) -/*---------------------------------------------------------------------------*/ -PROCESS(remote_grove_loudness_process, "Grove loudness test process"); -AUTOSTART_PROCESSES(&remote_grove_loudness_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_grove_loudness_process, ev, data) -{ - PROCESS_BEGIN(); - - uint16_t loudness; - - /* Use pin number not mask, for example if using the PA5 pin then use 5 */ - adc_sensors.configure(ANALOG_GROVE_LOUDNESS, ADC_PIN); - - /* And periodically poll the sensor */ - - while(1) { - etimer_set(&et, SENSOR_READ_INTERVAL); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - loudness = adc_sensors.value(ANALOG_GROVE_LOUDNESS); - - if(loudness != ADC_WRAPPER_ERROR) { - printf("%u\n", loudness); - } else { - printf("Error, enable the DEBUG flag in adc-wrapper.c for info\n"); - PROCESS_EXIT(); - } - - if(loudness < 100) { - leds_off(LEDS_ALL); - } - - if((loudness >= 100) && (loudness < 500)) { - leds_on(LEDS_BLUE); - leds_off(LEDS_GREEN | LEDS_RED); - } - - if((loudness >= 500) && (loudness < 1000)) { - leds_on(LEDS_GREEN); - leds_off(LEDS_BLUE | LEDS_RED); - } - - if(loudness >= 1000) { - leds_on(LEDS_RED); - leds_off(LEDS_BLUE | LEDS_GREEN); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-iaq.c b/examples/platform-specific/zoul/test-iaq.c deleted file mode 100644 index 9940448ce..000000000 --- a/examples/platform-specific/zoul/test-iaq.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-iaq-test - * - * RE-Mote external IAQ test application - * Example of iAQ-Core implementation and simple operation reading the value - * of CO2, TVOC sensor and Status. The test checks for a each 5 minutes in - * order to get the first true measurement as datasheet recomendation - * (standard result of 0x82 is obtained in first time). - * Then, once initialized, periodically each 5 seconds reads - * the values of the IAQ sensor and shows in the screen, toggling the LED - * red if CO2 was not initialized and LED green if the reading was succeed. - * - * @{ - * \file - * RE-Mote implementation of external IAQ-CORE-C test application - * \author - * Aitor Mejias - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "iaq.h" -#include "dev/i2c.h" -#include "dev/leds.h" -#include -#include -/*---------------------------------------------------------------------------*/ -/* Standard warm up time iAQ Sensor */ -#define IAQ_INIT_WAIT 325L -#define LOOP_PERIOD 5L -#define LOOP_INTERVAL (CLOCK_SECOND * LOOP_PERIOD) -/*---------------------------------------------------------------------------*/ -PROCESS(test_remote_iaq_process, "Test IAQ driver process"); -AUTOSTART_PROCESSES(&test_remote_iaq_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_remote_iaq_process, ev, data) -{ - static uint16_t count_delay = 0; - static uint16_t status = 0; - - PROCESS_BEGIN(); - - /* Configure IAQ and return structure with all parameters */ - SENSORS_ACTIVATE(iaq); - - while(1) { - /* Wait a bit */ - etimer_set(&et, (LOOP_INTERVAL)); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - status = iaq.status(IAQ_DRIVER_STATUS); - - if(status == IAQ_INIT_STATE) { - count_delay += LOOP_PERIOD; - leds_toggle(LEDS_RED); - printf("Test-IAQ: Initializing Time-elapsed: %u seconds of aprox. %lu sec.\n", - count_delay, IAQ_INIT_WAIT); - } else if(status == IAQ_ACTIVE) { - leds_off(LEDS_RED); - leds_toggle(LEDS_GREEN); - - /* Get data from sensor: VOC, CO2 and internal status */ - printf("CO2 current value is: %d ppm\n", iaq.value(IAQ_VOC_VALUE)); - printf("TIAQ current value is: %d ppb\n", iaq.value(IAQ_CO2_VALUE)); - printf("Status is: 0x%0X\n", iaq.value(IAQ_STATUS)); - } else { - printf("iAQ-Core Error: 0x%02X\n", status); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-lcd.c b/examples/platform-specific/zoul/test-lcd.c deleted file mode 100644 index 9b30ab25a..000000000 --- a/examples/platform-specific/zoul/test-lcd.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-rgb-lcd-test Test the LCD with RGB backlight - * - * Demonstrates the use of the LCD with on-board RGB backlight - * @{ - * - * \file - * A quick program for testing the Grove's LCD with RGB backlight - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/rgb-bl-lcd.h" -#include "dev/button-hal.h" -/*---------------------------------------------------------------------------*/ -#define SCROLL_PERIOD (CLOCK_SECOND / 6) -/*---------------------------------------------------------------------------*/ -PROCESS(remote_lcd_process, "Grove LCD backlight test"); -AUTOSTART_PROCESSES(&remote_lcd_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_lcd_process, ev, data) -{ - PROCESS_BEGIN(); - - static uint8_t i = 0; - static char buf[16]; - static uint16_t counter; - - /* Enable the LCD, default configuration is 2 rows and 16 columns, RGB - * backlight on with red color, no cursor/blink */ - SENSORS_ACTIVATE(rgb_bl_lcd); - - /* Set the cursor to column 17 and row 0 to not make it visible yet */ - lcd_set_cursor(17, LCD_RGB_1ST_ROW); - lcd_write("Hello Contiki!"); - - /* Now make the text appear from right to left and stay aligned left */ - while(i < 16) { - etimer_set(&et, SCROLL_PERIOD); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - lcd_scroll_display(LCD_RGB_CURSOR_MOVE_LEFT, 1); - i++; - etimer_restart(&et); - } - - /* wait 2 seconds */ - etimer_set(&et, (CLOCK_SECOND * 2)); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Clear the welcome message */ - lcd_clear_display(); - - /* Spin the timer and print the counter value on the LCD */ - etimer_set(&et, CLOCK_SECOND); - - lcd_set_cursor(0, LCD_RGB_1ST_ROW); - lcd_write("Press the button!"); - - while(1) { - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_TIMER) { - snprintf(buf, 15, "Counter: %05u", counter); - lcd_set_cursor(0, LCD_RGB_2ND_ROW); - lcd_write(buf); - printf("Counter: %05u\n", counter); - counter++; - etimer_restart(&et); - } else if(ev == button_hal_press_event) { - printf("Button pressed!!\n"); - lcd_set_cursor(0, LCD_RGB_1ST_ROW); - lcd_write("Button pressed!!"); - } else if(ev == button_hal_release_event) { - lcd_set_cursor(0, LCD_RGB_1ST_ROW); - lcd_write("Press the button!"); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-motion.c b/examples/platform-specific/zoul/test-motion.c deleted file mode 100644 index 1a4edfcc5..000000000 --- a/examples/platform-specific/zoul/test-motion.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-motion-test Digital motion sensor test - * - * The example application shows how to use any digital motion sensor, basically - * driving a signal high when motion is detected. - * - * @{ - * - * \file - * Test application for the digital motion/presence sensor - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cpu.h" -#include "sys/rtimer.h" -#include "dev/leds.h" -#include "dev/motion-sensor.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define LEDS_OFF_HYSTERISIS RTIMER_SECOND -/*---------------------------------------------------------------------------*/ -static struct rtimer rt; -/*---------------------------------------------------------------------------*/ -PROCESS(test_presence_sensor, "Test digital motion sensor"); -AUTOSTART_PROCESSES(&test_presence_sensor); -/*---------------------------------------------------------------------------*/ -void -rt_callback(struct rtimer *t, void *ptr) -{ - leds_off(LEDS_RED); -} -/*---------------------------------------------------------------------------*/ -static void -presence_callback(uint8_t value) -{ - printf("*** Presence detected!\n"); - leds_on(LEDS_RED); - rtimer_set(&rt, RTIMER_NOW() + LEDS_OFF_HYSTERISIS, 1, rt_callback, NULL); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_presence_sensor, ev, data) -{ - PROCESS_BEGIN(); - - /* Register the callback handler when presence is detected */ - MOTION_REGISTER_INT(presence_callback); - - /* Enable the sensor, as default it assumes the signal pin has a pull-down - * resistor and a rising interrupt (signal goes high when motion is detected), - * this is the case of the Grove's PIR sensor v.1.0. If the sensor has an - * inverse logic, change at the motion-sensor.c driver file - * GPIO_DETECT_FALLING instead of GPIO_DETECT_RISING if using an external - * pull-up resistor - */ - SENSORS_ACTIVATE(motion_sensor); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-pm10-sensor.c b/examples/platform-specific/zoul/test-pm10-sensor.c deleted file mode 100644 index 2f6dfae42..000000000 --- a/examples/platform-specific/zoul/test-pm10-sensor.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-pm10-sensor-test Test PM10 sensor - * - * Demonstrates the operation of the Sharp PM10 analog sensor - * @{ - * - * \file - * GP2Y1010AU0F PM10 sensor example using the ADC sensors wrapper - * - * \author - * Toni Lozano - */ -/*---------------------------------------------------------------------------*/ -#include -#include "cpu.h" -#include "contiki.h" -#include "dev/leds.h" -#include "dev/adc-sensors.h" -#include "dev/zoul-sensors.h" -#include "lib/sensors.h" -#include "dev/sys-ctrl.h" -#include "dev/pm10-sensor.h" -/*---------------------------------------------------------------------------*/ -#define ADC_PIN 2 -#define SENSOR_READ_INTERVAL (CLOCK_SECOND) -/*---------------------------------------------------------------------------*/ -PROCESS(test_pm10_sensor_process, "Test PM10 sensor process"); -AUTOSTART_PROCESSES(&test_pm10_sensor_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_pm10_sensor_process, ev, data) -{ - PROCESS_BEGIN(); - - static uint16_t pm10_value; - - /* Use pin number not mask, for example if using the PA5 pin then use 2 */ - pm10.configure(SENSORS_ACTIVE, ADC_PIN); - - /* And periodically poll the sensor */ - - while(1) { - etimer_set(&et, SENSOR_READ_INTERVAL); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - leds_toggle(LEDS_GREEN); - pm10_value = pm10.value(1); - - if(pm10_value != ADC_WRAPPER_ERROR) { - printf("PM10 value = %u ppm\n", pm10_value); - } else { - printf("Error, enable the DEBUG flag in adc-wrapper.c for info\n"); - PROCESS_EXIT(); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-relay.c b/examples/platform-specific/zoul/test-relay.c deleted file mode 100644 index 51f55e537..000000000 --- a/examples/platform-specific/zoul/test-relay.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-relay-test A simple program to test a generic relay - * - * Demonstrates the use of a generic relay, connected by default at the ADC1 - * connector of the RE-Mote - * - * @{ - * - * \file - * A quick program to test a generic relay - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/relay.h" -#include "lib/sensors.h" -/*---------------------------------------------------------------------------*/ -PROCESS(remote_relay_process, "Generic relay test"); -AUTOSTART_PROCESSES(&remote_relay_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_relay_process, ev, data) -{ - PROCESS_BEGIN(); - SENSORS_ACTIVATE(relay); - - /* Activate the relay and wait for 5 seconds */ - relay.value(RELAY_ON); - etimer_set(&et, CLOCK_SECOND * 5); - printf("\nRelay: switch should be ON --> %u\n", relay.status(SENSORS_ACTIVE)); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Now turn off and wait 5 seconds more */ - relay.value(RELAY_OFF); - etimer_set(&et, CLOCK_SECOND * 5); - printf("Relay: switch should be OFF --> %u\n\n", relay.status(SENSORS_ACTIVE)); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Let it spin and toggle each second */ - while(1) { - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - relay.value(RELAY_TOGGLE); - printf("Relay: switch is now --> %u\n", relay.status(SENSORS_ACTIVE)); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-rotation-sensor.c b/examples/platform-specific/zoul/test-rotation-sensor.c deleted file mode 100644 index 6e03d44ea..000000000 --- a/examples/platform-specific/zoul/test-rotation-sensor.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-rotation-sensor-test Phidget 1109 rotation sensor example - * - * Demonstrates the operation of the analog phidget 1109 rotation sensor - * @{ - * - * \file - * Phidget analog rotation sensor example using the ADC sensor wrapper - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/leds.h" -#include "dev/adc-sensors.h" -/*---------------------------------------------------------------------------*/ -#define ADC_PIN 5 -#define SENSOR_READ_INTERVAL (CLOCK_SECOND / 4) -/*---------------------------------------------------------------------------*/ -PROCESS(remote_rotation_process, "Phidget rotation test process"); -AUTOSTART_PROCESSES(&remote_rotation_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_rotation_process, ev, data) -{ - PROCESS_BEGIN(); - - uint16_t rotation; - - /* Use pin number not mask, for example if using the PA5 pin then use 5 */ - adc_sensors.configure(ANALOG_PHIDGET_ROTATION_1109, 5); - - /* And periodically poll the sensor */ - - while(1) { - etimer_set(&et, SENSOR_READ_INTERVAL); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - rotation = adc_sensors.value(ANALOG_PHIDGET_ROTATION_1109); - - if(rotation != ADC_WRAPPER_ERROR) { - printf("Rotation = %u\n", rotation); - } else { - printf("Error, enable the DEBUG flag in adc-wrapper.c for info\n"); - PROCESS_EXIT(); - } - - if(rotation <= 45) { - leds_off(LEDS_ALL); - } - - if((rotation > 45) && (rotation < 150)) { - leds_on(LEDS_GREEN); - leds_off(LEDS_BLUE | LEDS_RED); - } - - if((rotation > 150) && (rotation < 250)) { - leds_on(LEDS_RED | LEDS_GREEN); - leds_off(LEDS_BLUE); - } - - if(rotation >= 250) { - leds_on(LEDS_RED); - leds_off(LEDS_BLUE | LEDS_GREEN); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-servo.c b/examples/platform-specific/zoul/test-servo.c deleted file mode 100644 index ab201c06d..000000000 --- a/examples/platform-specific/zoul/test-servo.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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. - */ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-servo-test Test the EMAX ES08A II servo motor - * - * Demonstrates the use of the EMAX ES08A servo motor. This servo requires a - * +5V voltage, it can be powered from D+5.1 pin (of the ADC3 connector), but - * it requires either an external power supply other than the USB for programing - * or it can be powered by the USB 2.0 connector, which allows a higher current - * draw. - * - * This test uses the default servo values (freq 50Hz, traveling time 1.5-1.9ms) - * for 0-180º movement, tested with the EMAX ES08A. Depending on the servo used - * you might need to adjust these parameters in the servo.h header file. - * - * @{ - * - * \file - * A quick program for testing a servo motor - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/leds.h" -#include "dev/servo.h" -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 1 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS(servo_test_process, "Zolertia servo test process"); -AUTOSTART_PROCESSES(&servo_test_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(servo_test_process, ev, data) -{ - PROCESS_BEGIN(); - - static uint8_t deg = 0; - - PRINTF("\nStarting the test\n"); - - while(1) { - - servo_position(SERVO_CHANNEL_5, GPIO_A_NUM, 5, deg); - PRINTF("Current position --> %03uº\n", deg); - - etimer_set(&et, CLOCK_SECOND / 2); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Increase the position by 10º each iteration */ - deg += 10; - if(deg > SERVO_MAX_DEGREES) { - deg = 0; - servo_stop(SERVO_CHANNEL_5, GPIO_A_NUM, 5); - - /* Stop the servo and wait 2 seconds before resuming from start */ - etimer_set(&et, CLOCK_SECOND * 2); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-sht25.c b/examples/platform-specific/zoul/test-sht25.c deleted file mode 100644 index ea853c30b..000000000 --- a/examples/platform-specific/zoul/test-sht25.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-sht25-test SHT25 temperature and humidity sensor test - * - * Demonstrates the use of the SHT25 digital temperature and humidity sensor - * @{ - * - * \file - * A quick program for testing the SHT25 temperature and humidity sensor - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/sht25.h" -/*---------------------------------------------------------------------------*/ -PROCESS(remote_sht25_process, "SHT25 test"); -AUTOSTART_PROCESSES(&remote_sht25_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_sht25_process, ev, data) -{ - int16_t temperature, humidity; - - PROCESS_BEGIN(); - SENSORS_ACTIVATE(sht25); - - /* Check if the sensor voltage operation is over 2.25V */ - if(sht25.value(SHT25_VOLTAGE_ALARM)) { - printf("Voltage is lower than recommended for the sensor operation\n"); - PROCESS_EXIT(); - } - - /* Configure the sensor for maximum resolution (14-bit temperature, 12-bit - * relative humidity), this will require up to 85ms for the temperature - * integration, and 29ms for the relative humidity (this is the default - * setting at power on). To achieve a faster integration time at the cost - * of a lower resolution, change the value below accordingly, see sht25.h. - */ - sht25.configure(SHT25_RESOLUTION, SHT2X_RES_14T_12RH); - - /* Let it spin and read sensor data */ - - while(1) { - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - temperature = sht25.value(SHT25_VAL_TEMP); - printf("Temperature %02d.%02d ºC, ", temperature / 100, temperature % 100); - humidity = sht25.value(SHT25_VAL_HUM); - printf("Humidity %02d.%02d RH\n", humidity / 100, humidity % 100); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-tsl256x.c b/examples/platform-specific/zoul/test-tsl256x.c deleted file mode 100644 index 0e6fce588..000000000 --- a/examples/platform-specific/zoul/test-tsl256x.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-tsl256x-test TSL256X light sensor test (TSL2561/TSL2563) - * - * Demonstrates the use of the TSL256X digital ambient light sensor - * @{ - * - * \file - * Test file for the external TSL256X light sensor - * - * \author - * Antonio Lignan - * Toni Lozano - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include "dev/i2c.h" -#include "dev/leds.h" -#include "dev/tsl256x.h" -/*---------------------------------------------------------------------------*/ -/* Default sensor's integration cycle is 402ms */ -#define SENSOR_READ_INTERVAL (CLOCK_SECOND) -/*---------------------------------------------------------------------------*/ -PROCESS(remote_tsl256x_process, "TSL256X test process"); -AUTOSTART_PROCESSES(&remote_tsl256x_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -void -light_interrupt_callback(uint8_t value) -{ - printf("* Light sensor interrupt!\n"); - leds_toggle(LEDS_RED); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(remote_tsl256x_process, ev, data) -{ - PROCESS_BEGIN(); - static uint16_t light; - - /* Print the sensor used, teh default is the TSL2561 (from Grove) */ - if(TSL256X_REF == TSL2561_SENSOR_REF) { - printf("Light sensor test --> TSL2561\n"); - } else if(TSL256X_REF == TSL2563_SENSOR_REF) { - printf("Light sensor test --> TSL2563\n"); - } else { - printf("Unknown light sensor reference, aborting\n"); - PROCESS_EXIT(); - } - - /* Use Contiki's sensor macro to enable the sensor */ - SENSORS_ACTIVATE(tsl256x); - - /* Default integration time is 402ms with 1x gain, use the below call to - * change the gain and timming, see tsl2563.h for more options - */ - /* tsl256x.configure(TSL256X_TIMMING_CFG, TSL256X_G16X_402MS); */ - - /* Register the interrupt handler */ - TSL256X_REGISTER_INT(light_interrupt_callback); - - /* Enable the interrupt source for values over the threshold. The sensor - * compares against the value of CH0, one way to find out the required - * threshold for a given lux quantity is to enable the DEBUG flag and see - * the CH0 value for a given measurement. The other is to reverse the - * calculations done in the calculate_lux() function. The below value roughly - * represents a 2500 lux threshold, same as pointing a flashlight directly - */ - tsl256x.configure(TSL256X_INT_OVER, 0x15B8); - - /* And periodically poll the sensor */ - - while(1) { - etimer_set(&et, SENSOR_READ_INTERVAL); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - light = tsl256x.value(TSL256X_VAL_READ); - if(light != TSL256X_ERROR) { - printf("Light = %u\n", (uint16_t)light); - } else { - printf("Error, enable the DEBUG flag in the tsl256x driver for info, "); - printf("or check if the sensor is properly connected\n"); - PROCESS_EXIT(); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-vac-sensor.c b/examples/platform-specific/zoul/test-vac-sensor.c deleted file mode 100644 index 5be57e44b..000000000 --- a/examples/platform-specific/zoul/test-vac-sensor.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-vac-sensor-test Test VAC sensor - * - * Demonstrates the operation of the voltage VAC analog sensor - * @{ - * - * \file - * Example demonstrating the RE-Mote & VAC sensor 0-5V 250V AC - * - * \author - * Javier Sánchez - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/etimer.h" -#include "sys/rtimer.h" -#include "dev/leds.h" -#include "dev/adc-sensors.h" -#include -#include -/*---------------------------------------------------------------------------*/ -#define ADC_PIN 2 -#define LOOP_PERIOD 2 -#define LOOP_INTERVAL (CLOCK_SECOND * LOOP_PERIOD) -#define LEDS_PERIODIC LEDS_GREEN -#define BUTTON_PRESS_EVENT_INTERVAL (CLOCK_SECOND) -/*---------------------------------------------------------------------------*/ -static struct etimer et; - -static uint16_t counter; -/*---------------------------------------------------------------------------*/ -PROCESS(test_vac_sensor_process, "test VAC sensor process"); -AUTOSTART_PROCESSES(&test_vac_sensor_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_vac_sensor_process, ev, data) -{ - - PROCESS_BEGIN(); - - counter = 0; - - /* Configure the ADC ports */ - /* Use pin number not mask, for example if using the PA5 pin then use 5 */ - adc_sensors.configure(ANALOG_VAC_SENSOR, ADC_PIN); - - printf("VAC test application\n"); - leds_on(LEDS_PERIODIC); - etimer_set(&et, LOOP_INTERVAL); - - while(1) { - - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_TIMER) { - leds_toggle(LEDS_PERIODIC); - - printf("-----------------------------------------\n" - "Counter = 0x%08x\n", counter); - - /*AC voltage value, with applied corresponding sensor algorithm*/ - printf("AC voltage = %d V\n", adc_sensors.value(ANALOG_VAC_SENSOR)); - - etimer_set(&et, LOOP_INTERVAL); - counter++; - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-weather-meter.c b/examples/platform-specific/zoul/test-weather-meter.c deleted file mode 100644 index 637ba8571..000000000 --- a/examples/platform-specific/zoul/test-weather-meter.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup zoul-weather-meter-test Test the Sparkfun's weather meter - * - * The example application shows how to read data from the anemometer, wind vane - * and rain gauge, on board the Sparkfun's weater meter - * - * @{ - * - * \file - * Test application for the Sparkfun's weather meter - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cpu.h" -#include "sys/etimer.h" -#include "dev/leds.h" -#include "dev/weather-meter.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define READ_SENSOR_PERIOD CLOCK_SECOND -#define ANEMOMETER_THRESHOLD_TICK 13 /**< 16 Km/h */ -#define RAIN_GAUGE_THRESHOLD_TICK 15 /**< each increment of 4.19 mm */ -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS(test_weather_meter_sensors, "Test Weather meter sensors"); -AUTOSTART_PROCESSES(&test_weather_meter_sensors); -/*---------------------------------------------------------------------------*/ -static void -rain_callback(uint16_t value) -{ - /* To calculate ticks from mm of rain, divide by 0.2794 mm */ - printf("*** Rain gauge over threshold (%u ticks)\n", value); - weather_meter.configure(WEATHER_METER_RAIN_GAUGE_INT_OVER, - (value + RAIN_GAUGE_THRESHOLD_TICK)); -} -/*---------------------------------------------------------------------------*/ -static void -wind_speed_callback(uint16_t value) -{ - /* This checks for instant wind speed values (over a second), the minimum - * value is 1.2 Km/h (one tick), as the reference is 2.4KM/h per rotation, and - * the anemometer makes 2 ticks per rotation. Instant speed is calculated as - * multiples of this, so if you want to check for 16Km/h, then it would be 13 - * ticks - */ - printf("*** Wind speed over threshold (%u ticks)\n", value); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_weather_meter_sensors, ev, data) -{ - PROCESS_BEGIN(); - - static uint32_t rain; - static uint16_t wind_speed; - static uint16_t wind_dir; - static uint16_t wind_dir_avg_2m; - static uint16_t wind_speed_avg; - static uint16_t wind_speed_avg_2m; - static uint16_t wind_speed_max; - - printf("Weather meter test example, integration period %u\n", - WEATHER_METER_AVG_PERIOD); - - /* Register the callback handler when thresholds are met */ - WEATHER_METER_REGISTER_ANEMOMETER_INT(wind_speed_callback); - WEATHER_METER_REGISTER_RAIN_GAUGE_INT(rain_callback); - - /* Enable the sensors, this has to be called before any of the interrupt calls - * like the ones below - */ - SENSORS_ACTIVATE(weather_meter); - - /* And the upper threshold value to compare and generate an interrupt */ - weather_meter.configure(WEATHER_METER_ANEMOMETER_INT_OVER, - ANEMOMETER_THRESHOLD_TICK); - weather_meter.configure(WEATHER_METER_RAIN_GAUGE_INT_OVER, - RAIN_GAUGE_THRESHOLD_TICK); - - etimer_set(&et, READ_SENSOR_PERIOD); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - rain = weather_meter.value(WEATHER_METER_RAIN_GAUGE); - wind_speed = weather_meter.value(WEATHER_METER_ANEMOMETER); - wind_dir = weather_meter.value(WEATHER_METER_WIND_VANE); - wind_dir_avg_2m = weather_meter.value(WEATHER_METER_WIND_VANE_AVG_X); - wind_speed_avg = weather_meter.value(WEATHER_METER_ANEMOMETER_AVG); - wind_speed_avg_2m = weather_meter.value(WEATHER_METER_ANEMOMETER_AVG_X); - wind_speed_max = weather_meter.value(WEATHER_METER_ANEMOMETER_MAX); - -#if WEATHER_METER_RAIN_RETURN_TICKS - rain *= WEATHER_METER_AUX_RAIN_MM; - if(rain > (WEATHER_METER_AUX_RAIN_MM * 3)) { - printf("Rain: %lu.%lu mm, ", (rain / 10000), (rain % 10000)); -#else - if(rain >= 10) { - printf("Rain: %u.%u mm, ", (rain / 10), (rain % 10)); -#endif - } else { - printf("Rain: 0.%lu mm, ", rain); - } - - printf("Wind dir: %u.%01u deg, ", (wind_dir / 10), (wind_dir % 10)); - printf("(%u.%01u deg avg)\n", (wind_dir_avg_2m / 10), (wind_dir_avg_2m % 10)); - printf("Wind speed: %u m/h ", wind_speed); - printf("(%u m/h avg, %u m/h 2m avg, %u m/h max)\n\n", wind_speed_avg, - wind_speed_avg_2m, - wind_speed_max); - etimer_reset(&et); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/platform-specific/zoul/test-zonik.c b/examples/platform-specific/zoul/test-zonik.c deleted file mode 100644 index a046a950c..000000000 --- a/examples/platform-specific/zoul/test-zonik.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - http://www.zolertia.com - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup remote-zonik-test Zolertia Zonik sonometer test application - * - * Example of Zonik board implementation and simple operation: Infinite loop - * enablinkg the sensor and rading few times, acquiring the dBA of sensor - * The first value acquired is invalid, because it's in hw init state awaiting - * a valid internal reading.Once the driver is initialized, posterior readings - * are valid.Finally in the loop disables the board with standard call and - * shows the error, and loop again enabling it. - * - * @{ - * \file - * RE-Mote test application of Zolertia Zonik sound sensor - * \author - * Aitor Mejias - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "zonik.h" -#include "dev/i2c.h" -#include "dev/leds.h" -#include -#include -/*---------------------------------------------------------------------------*/ -#define MAX_VALID_READINGS 10L -#define MAX_INVALID_READINGS 3L -/*---------------------------------------------------------------------------*/ -PROCESS(test_remote_zonik_process, "Test Zonik driver process"); -AUTOSTART_PROCESSES(&test_remote_zonik_process); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_remote_zonik_process, ev, data) -{ - static int16_t zonik_val; - static uint8_t i; - - PROCESS_BEGIN(); - - printf("Initial status of sensor is: 0x%04X\n", - zonik.status(SENSORS_ACTIVE)); - - while(1) { - /* Configure Zonik and activate the internal process readings */ - SENSORS_ACTIVATE(zonik); - - printf("Initialized. Sensor status: 0x%04X\n", - zonik.status(SENSORS_ACTIVE)); - - /* Read sensor value dBA multiple times */ - for(i = 0; i < MAX_VALID_READINGS; i++) { - /* Wait a bit */ - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Get data from sensor */ - zonik_val = zonik.value(ZONIK_DBA_LEQ_VALUE); - leds_toggle(LEDS_GREEN); - printf("Value (dBA): %d\n", zonik_val); - } - - printf("Sensor status is: 0x%04X\n", - zonik.status(SENSORS_ACTIVE)); - - /* Disable Zonik sensor */ - SENSORS_DEACTIVATE(zonik); - printf("Process Stopped: 0x%04X\n", zonik.status(SENSORS_ACTIVE)); - - for(i = 0; i < MAX_INVALID_READINGS; i++) { - /* Wait a bit */ - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - /* Get data from sensor */ - zonik_val = zonik.value(ZONIK_DBA_LEQ_VALUE); - leds_toggle(LEDS_GREEN); - printf("Value (dBA): %d\n", zonik_val); - } - - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ - diff --git a/examples/rpl-border-router/Makefile b/examples/rpl-border-router/Makefile deleted file mode 100644 index 8d210dd3c..000000000 --- a/examples/rpl-border-router/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -CONTIKI_PROJECT = border-router -all: $(CONTIKI_PROJECT) -CONTIKI = ../.. - -# The BR is either native or embedded, and in the latter case must support SLIP -PLATFORMS_EXCLUDE = nrf52dk z1 - -# Include RPL BR module -MODULES += os/services/rpl-border-router -# Include webserver module -MODULES_REL += webserver -# Include optional target-specific module -include $(CONTIKI)/Makefile.identify-target -MODULES_REL += $(TARGET) - -include $(CONTIKI)/Makefile.include diff --git a/examples/rpl-border-router/README.md b/examples/rpl-border-router/README.md deleted file mode 100644 index 2ad4dbff5..000000000 --- a/examples/rpl-border-router/README.md +++ /dev/null @@ -1,27 +0,0 @@ -This is the Contiki-NG border router. It supports two main modes of operation: -embedded and native. In both cases, the border router runs a simple Web server -that exposes a list of currently connected nodes via HTTP. - -See https://github.com/contiki-ng/contiki-ng/wiki/Tutorial:-RPL-border-router - -# Embedded border router - -The embedded border router runs on a node. It is connected to the host via SLIP. -The host simply runs a tun gateway (`tunslip6`). To use, program a node, and -then start `tunslip6` on the host via the make command `connect-router`. -See embedded/README.md for more. - -# Native border router - -The native border router runs directly at the host. The node simply runs a -SLIP-radio interface (`examples/slip-radio`). The host, on the other hand, runs -a full 6LoWPAN stack. -See native/README.md for more. - -# RPL node - -As RPL node, you may use any Contiki-NG example with RPL enabled, but which -does not start its own DAG (as this is the responsibility of the border router). -For instance `examples/hello-world` or `examples-coap` are great starting -points. This is not intended to run with `examples/rpl-udp` however, as this -examples builds its own stand-alone, border-router-free RPL network. diff --git a/examples/rpl-border-router/border-router.c b/examples/rpl-border-router/border-router.c deleted file mode 100644 index 416d18093..000000000 --- a/examples/rpl-border-router/border-router.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 201, RISE SICS - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL BR" -#define LOG_LEVEL LOG_LEVEL_INFO - -/* Declare and auto-start this file's process */ -PROCESS(contiki_ng_br, "Contiki-NG Border Router"); -AUTOSTART_PROCESSES(&contiki_ng_br); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(contiki_ng_br, ev, data) -{ - PROCESS_BEGIN(); - -#if BORDER_ROUTER_CONF_WEBSERVER - PROCESS_NAME(webserver_nogui_process); - process_start(&webserver_nogui_process, NULL); -#endif /* BORDER_ROUTER_CONF_WEBSERVER */ - - LOG_INFO("Contiki-NG Border Router started\n"); - - PROCESS_END(); -} diff --git a/examples/rpl-border-router/project-conf.h b/examples/rpl-border-router/project-conf.h deleted file mode 100644 index a2ffcc950..000000000 --- a/examples/rpl-border-router/project-conf.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#ifndef WEBSERVER_CONF_CFS_CONNS -#define WEBSERVER_CONF_CFS_CONNS 2 -#endif - -#ifndef BORDER_ROUTER_CONF_WEBSERVER -#define BORDER_ROUTER_CONF_WEBSERVER 1 -#endif - -#if BORDER_ROUTER_CONF_WEBSERVER -#define UIP_CONF_TCP 1 -#endif - -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/rpl-border-router/sky/module-macros.h b/examples/rpl-border-router/sky/module-macros.h deleted file mode 100644 index f9c7b408c..000000000 --- a/examples/rpl-border-router/sky/module-macros.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* Save some RAM and ROM */ -#define QUEUEBUF_CONF_NUM 4 -#define UIP_CONF_BUFFER_SIZE 140 -#define BORDER_ROUTER_CONF_WEBSERVER 0 -/*---------------------------------------------------------------------------*/ diff --git a/examples/rpl-border-router/webserver/httpd-simple.c b/examples/rpl-border-router/webserver/httpd-simple.c deleted file mode 100644 index 7ce984e6a..000000000 --- a/examples/rpl-border-router/webserver/httpd-simple.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A simple web server forwarding page generation to a protothread - * \author - * Adam Dunkels - * Niclas Finne - * Joakim Eriksson - */ - -#include "contiki.h" -#include "contiki-net.h" - -#include -#include - -#include "httpd-simple.h" -#define webserver_log_file(...) -#define webserver_log(...) - -#ifndef WEBSERVER_CONF_CFS_CONNS -#define CONNS UIP_TCP_CONNS -#else /* WEBSERVER_CONF_CFS_CONNS */ -#define CONNS WEBSERVER_CONF_CFS_CONNS -#endif /* WEBSERVER_CONF_CFS_CONNS */ - -#ifndef WEBSERVER_CONF_CFS_URLCONV -#define URLCONV 0 -#else /* WEBSERVER_CONF_CFS_URLCONV */ -#define URLCONV WEBSERVER_CONF_CFS_URLCONV -#endif /* WEBSERVER_CONF_CFS_URLCONV */ - -#define STATE_WAITING 0 -#define STATE_OUTPUT 1 - -MEMB(conns, struct httpd_state, CONNS); - -#define ISO_nl 0x0a -#define ISO_space 0x20 -#define ISO_period 0x2e -#define ISO_slash 0x2f - -/*---------------------------------------------------------------------------*/ -static const char *NOT_FOUND = "" -"
" -"

404 - file not found

" -"
" -"" -""; -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_string(struct httpd_state *s, const char *str)) -{ - PSOCK_BEGIN(&s->sout); - - SEND_STRING(&s->sout, str); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -const char http_content_type_html[] = "Content-type: text/html\r\n\r\n"; -static -PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr)) -{ - /* char *ptr; */ - - PSOCK_BEGIN(&s->sout); - - SEND_STRING(&s->sout, statushdr); - - /* ptr = strrchr(s->filename, ISO_period); */ - /* if(ptr == NULL) { */ - /* s->ptr = http_content_type_plain; */ - /* } else if(strcmp(http_html, ptr) == 0) { */ - /* s->ptr = http_content_type_html; */ - /* } else if(strcmp(http_css, ptr) == 0) { */ - /* s->ptr = http_content_type_css; */ - /* } else if(strcmp(http_png, ptr) == 0) { */ - /* s->ptr = http_content_type_png; */ - /* } else if(strcmp(http_gif, ptr) == 0) { */ - /* s->ptr = http_content_type_gif; */ - /* } else if(strcmp(http_jpg, ptr) == 0) { */ - /* s->ptr = http_content_type_jpg; */ - /* } else { */ - /* s->ptr = http_content_type_binary; */ - /* } */ - /* SEND_STRING(&s->sout, s->ptr); */ - SEND_STRING(&s->sout, http_content_type_html); - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -const char http_header_200[] = "HTTP/1.0 200 OK\r\nServer: Contiki/2.4 http://www.sics.se/contiki/\r\nConnection: close\r\n"; -const char http_header_404[] = "HTTP/1.0 404 Not found\r\nServer: Contiki/2.4 http://www.sics.se/contiki/\r\nConnection: close\r\n"; -static -PT_THREAD(handle_output(struct httpd_state *s)) -{ - PT_BEGIN(&s->outputpt); - - s->script = NULL; - s->script = httpd_simple_get_script(&s->filename[1]); - if(s->script == NULL) { - strncpy(s->filename, "/notfound.html", sizeof(s->filename) - 1); - s->filename[sizeof(s->filename) - 1] = '\0'; - PT_WAIT_THREAD(&s->outputpt, - send_headers(s, http_header_404)); - PT_WAIT_THREAD(&s->outputpt, - send_string(s, NOT_FOUND)); - uip_close(); - webserver_log_file(&uip_conn->ripaddr, "404 - not found"); - PT_EXIT(&s->outputpt); - } else { - PT_WAIT_THREAD(&s->outputpt, - send_headers(s, http_header_200)); - PT_WAIT_THREAD(&s->outputpt, s->script(s)); - } - s->script = NULL; - PSOCK_CLOSE(&s->sout); - PT_END(&s->outputpt); -} -/*---------------------------------------------------------------------------*/ -const char http_get[] = "GET "; -const char http_index_html[] = "/index.html"; - -static -PT_THREAD(handle_input(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sin); - - PSOCK_READTO(&s->sin, ISO_space); - - if(strncmp(s->inputbuf, http_get, 4) != 0) { - PSOCK_CLOSE_EXIT(&s->sin); - } - PSOCK_READTO(&s->sin, ISO_space); - - if(s->inputbuf[0] != ISO_slash) { - PSOCK_CLOSE_EXIT(&s->sin); - } - -#if URLCONV - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - urlconv_tofilename(s->filename, s->inputbuf, sizeof(s->filename)); -#else /* URLCONV */ - if(s->inputbuf[1] == ISO_space) { - strncpy(s->filename, http_index_html, sizeof(s->filename) - 1); - s->filename[sizeof(s->filename) - 1] = '\0'; - } else { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - strncpy(s->filename, s->inputbuf, sizeof(s->filename)); - } -#endif /* URLCONV */ - - webserver_log_file(&uip_conn->ripaddr, s->filename); - - s->state = STATE_OUTPUT; - - while(1) { - PSOCK_READTO(&s->sin, ISO_nl); -#if 0 - if(strncmp(s->inputbuf, http_referer, 8) == 0) { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0; - webserver_log(s->inputbuf); - } -#endif - } - - PSOCK_END(&s->sin); -} -/*---------------------------------------------------------------------------*/ -static void -handle_connection(struct httpd_state *s) -{ - handle_input(s); - if(s->state == STATE_OUTPUT) { - handle_output(s); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_appcall(void *state) -{ - struct httpd_state *s = (struct httpd_state *)state; - - if(uip_closed() || uip_aborted() || uip_timedout()) { - if(s != NULL) { - s->script = NULL; - memb_free(&conns, s); - } - } else if(uip_connected()) { - s = (struct httpd_state *)memb_alloc(&conns); - if(s == NULL) { - uip_abort(); - webserver_log_file(&uip_conn->ripaddr, "reset (no memory block)"); - return; - } - tcp_markconn(uip_conn, s); - PSOCK_INIT(&s->sin, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); - PSOCK_INIT(&s->sout, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); - PT_INIT(&s->outputpt); - s->script = NULL; - s->state = STATE_WAITING; - timer_set(&s->timer, CLOCK_SECOND * 10); - handle_connection(s); - } else if(s != NULL) { - if(uip_poll()) { - if(timer_expired(&s->timer)) { - uip_abort(); - s->script = NULL; - memb_free(&conns, s); - webserver_log_file(&uip_conn->ripaddr, "reset (timeout)"); - } - } else { - timer_restart(&s->timer); - } - handle_connection(s); - } else { - uip_abort(); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_init(void) -{ - - tcp_listen(UIP_HTONS(80)); - memb_init(&conns); -#if URLCONV - urlconv_init(); -#endif /* URLCONV */ -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/rpl-border-router/webserver/httpd-simple.h b/examples/rpl-border-router/webserver/httpd-simple.h deleted file mode 100644 index 7dbe46bfd..000000000 --- a/examples/rpl-border-router/webserver/httpd-simple.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A simple webserver - * \author - * Adam Dunkels - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef HTTPD_SIMPLE_H_ -#define HTTPD_SIMPLE_H_ - -#include "contiki-net.h" - -/* The current internal border router webserver ignores the requested file name */ -/* and needs no per-connection output buffer, so save some RAM */ -#ifndef WEBSERVER_CONF_CFS_PATHLEN -#define HTTPD_PATHLEN 2 -#else /* WEBSERVER_CONF_CFS_CONNS */ -#define HTTPD_PATHLEN WEBSERVER_CONF_CFS_PATHLEN -#endif /* WEBSERVER_CONF_CFS_CONNS */ - -struct httpd_state; -typedef char (*httpd_simple_script_t)(struct httpd_state *s); - -struct httpd_state { - struct timer timer; - struct psock sin, sout; - struct pt outputpt; - char inputbuf[HTTPD_PATHLEN + 24]; -/*char outputbuf[UIP_TCP_MSS]; */ - char filename[HTTPD_PATHLEN]; - httpd_simple_script_t script; - char state; -}; - -void httpd_init(void); -void httpd_appcall(void *state); - -httpd_simple_script_t httpd_simple_get_script(const char *name); - -#define SEND_STRING(s, str) PSOCK_SEND(s, (uint8_t *)str, strlen(str)) - -#endif /* HTTPD_SIMPLE_H_ */ diff --git a/examples/rpl-border-router/webserver/webserver.c b/examples/rpl-border-router/webserver/webserver.c deleted file mode 100644 index c4b472837..000000000 --- a/examples/rpl-border-router/webserver/webserver.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "net/routing/routing.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/ipv6/uip-sr.h" - -#include -#include - -/*---------------------------------------------------------------------------*/ -static const char *TOP = "\n \n Contiki-NG\n \n\n"; -static const char *BOTTOM = "\n\n\n"; -static char buf[256]; -static int blen; -#define ADD(...) do { \ - blen += snprintf(&buf[blen], sizeof(buf) - blen, __VA_ARGS__); \ - } while(0) -#define SEND(s) do { \ - SEND_STRING(s, buf); \ - blen = 0; \ -} while(0); - -/* Use simple webserver with only one page for minimum footprint. - * Multiple connections can result in interleaved tcp segments since - * a single static buffer is used for all segments. - */ -#include "httpd-simple.h" - -/*---------------------------------------------------------------------------*/ -static void -ipaddr_add(const uip_ipaddr_t *addr) -{ - uint16_t a; - int i, f; - for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) { - a = (addr->u8[i] << 8) + addr->u8[i + 1]; - if(a == 0 && f >= 0) { - if(f++ == 0) { - ADD("::"); - } - } else { - if(f > 0) { - f = -1; - } else if(i > 0) { - ADD(":"); - } - ADD("%x", a); - } - } -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(generate_routes(struct httpd_state *s)) -{ - static uip_ds6_nbr_t *nbr; - - PSOCK_BEGIN(&s->sout); - SEND_STRING(&s->sout, TOP); - - ADD(" Neighbors\n
    \n"); - SEND(&s->sout); - for(nbr = uip_ds6_nbr_head(); - nbr != NULL; - nbr = uip_ds6_nbr_next(nbr)) { - ADD("
  • "); - ipaddr_add(&nbr->ipaddr); - ADD("
  • \n"); - SEND(&s->sout); - } - ADD("
\n"); - SEND(&s->sout); - -#if (UIP_MAX_ROUTES != 0) - { - static uip_ds6_route_t *r; - ADD(" Routes\n
    \n"); - SEND(&s->sout); - for(r = uip_ds6_route_head(); r != NULL; r = uip_ds6_route_next(r)) { - ADD("
  • "); - ipaddr_add(&r->ipaddr); - ADD("/%u (via ", r->length); - ipaddr_add(uip_ds6_route_nexthop(r)); - ADD(") %lus", (unsigned long)r->state.lifetime); - ADD("
  • \n"); - SEND(&s->sout); - } - ADD("
\n"); - SEND(&s->sout); - } -#endif /* UIP_MAX_ROUTES != 0 */ - -#if (UIP_SR_LINK_NUM != 0) - if(uip_sr_num_nodes() > 0) { - static uip_sr_node_t *link; - ADD(" Routing links\n
    \n"); - SEND(&s->sout); - for(link = uip_sr_node_head(); link != NULL; link = uip_sr_node_next(link)) { - if(link->parent != NULL) { - uip_ipaddr_t child_ipaddr; - uip_ipaddr_t parent_ipaddr; - - NETSTACK_ROUTING.get_sr_node_ipaddr(&child_ipaddr, link); - NETSTACK_ROUTING.get_sr_node_ipaddr(&parent_ipaddr, link->parent); - - ADD("
  • "); - ipaddr_add(&child_ipaddr); - - ADD(" (parent: "); - ipaddr_add(&parent_ipaddr); - ADD(") %us", (unsigned int)link->lifetime); - - ADD("
  • \n"); - SEND(&s->sout); - } - } - ADD("
"); - SEND(&s->sout); - } -#endif /* UIP_SR_LINK_NUM != 0 */ - - SEND_STRING(&s->sout, BOTTOM); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -PROCESS(webserver_nogui_process, "Web server"); -PROCESS_THREAD(webserver_nogui_process, ev, data) -{ - PROCESS_BEGIN(); - - httpd_init(); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); - httpd_appcall(data); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -httpd_simple_script_t -httpd_simple_get_script(const char *name) -{ - return generate_routes; -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/rpl-udp/Makefile b/examples/rpl-udp/Makefile deleted file mode 100644 index 78e6d1653..000000000 --- a/examples/rpl-udp/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -CONTIKI_PROJECT = udp-client udp-server -all: $(CONTIKI_PROJECT) - -CONTIKI=../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/rpl-udp/README.md b/examples/rpl-udp/README.md deleted file mode 100644 index baabcdc93..000000000 --- a/examples/rpl-udp/README.md +++ /dev/null @@ -1,17 +0,0 @@ -A simple RPL network with UDP communication. This is a self-contained example: -it includes a DAG root (`udp-server.c`) and DAG nodes (`udp-clients.c`). -This example runs without a border router -- this is a stand-alone RPL network. - -The DAG root also acts as UDP server. The DAG nodes are UDP client. The clients -send a UDP request periodically, that simply includes a counter as payload. -When receiving a request, The server sends a response with the same counter -back to the originator. - -The `.csc` files show example networks in the Cooja simulator, for sky motes and -for cooja motes. - -For this example a "renode" make target is available, to run a two node -emulation in the Renode framework. For further instructions on installing and -using Renode please refer to [Contiki-NG wiki][1]. - -[1]: https://github.com/contiki-ng/contiki-ng/wiki/Tutorial:-Running-Contiki%E2%80%90NG-in-Renode diff --git a/examples/rpl-udp/cc2538-node.resc b/examples/rpl-udp/cc2538-node.resc deleted file mode 100644 index 8d5b94329..000000000 --- a/examples/rpl-udp/cc2538-node.resc +++ /dev/null @@ -1,30 +0,0 @@ -mach create $name -using sysbus -machine LoadPlatformDescription @platforms/cpus/cc2538.repl -machine SetClockSource sysbus.cpu -machine SetSyncDomainFromEmulation $domain -connector Connect radio wireless - -machine PyDevFromFile @scripts/pydev/rolling-bit.py 0x400D2004 0x4 True "sysctrl" - -$id = `next_value 1` - -macro reset -""" - #set node address. 0x00 0x12 0x4B is TI OUI - sysbus WriteByte 0x00280028 $id - sysbus WriteByte 0x0028002C 0x00 - sysbus WriteByte 0x00280030 0xAB - sysbus WriteByte 0x00280034 0x89 - sysbus WriteByte 0x00280038 0x00 - sysbus WriteByte 0x0028003C 0x4B - sysbus WriteByte 0x00280040 0x12 - sysbus WriteByte 0x00280044 0x00 - - sysbus LoadBinary @http://antmicro.com/projects/renode/cc2538_rom_dump.bin-s_524288-0c196cdc21b5397f82e0ff42b206d1cc4b6d7522 0x0 - sysbus LoadELF $bin - - cpu VectorTableOffset `sysbus GetSymbolAddress "vectors"` -""" - -runMacro $reset diff --git a/examples/rpl-udp/rpl-udp-cooja.csc b/examples/rpl-udp/rpl-udp-cooja.csc deleted file mode 100644 index a17dd6f45..000000000 --- a/examples/rpl-udp/rpl-udp-cooja.csc +++ /dev/null @@ -1,489 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - RPL-UDP Example - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype829 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/rpl-udp/udp-server.c - make udp-server.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype405 - Cooja Mote Type #2 - [CONTIKI_DIR]/examples/rpl-udp/udp-client.c - make udp-client.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 43.291897546941804 - 7.17470867058031 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype829 - - - - org.contikios.cooja.interfaces.Position - 41.0074953544532 - 42.15996473110367 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 62.14716228260997 - 33.4762563475895 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 82.83122911981513 - 21.68868709116004 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 93.05570620505483 - 4.903395862706303 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 60.028650247913106 - 64.79735069148343 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 91.52155150461668 - 49.56589548717288 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 115.1617201005399 - 27.558102517230267 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 79.769185504542 - 89.87729413135577 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 110.48190239338045 - 65.8032531235721 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 10 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 143.9761935729208 - 42.641465330274904 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 11 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 86.50153244156061 - 123.66419289301187 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 12 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 126.037024944843 - 96.93550668179564 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 13 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 152.60700326115108 - 74.05981478947481 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 14 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 128.68994157412354 - 133.7555584169505 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 15 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.interfaces.Position - 158.72888550793317 - 118.52885363776664 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 16 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype405 - - - - org.contikios.cooja.plugins.SimControl - 229 - 3 - 157 - 11 - 6 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 1.1719333465234514 0.0 0.0 1.1719333465234514 -4.934308660658031 20.209777273580123 - - 234 - 1 - 257 - 10 - 170 - - - org.contikios.cooja.plugins.LogListener - - App - - - - 1074 - 0 - 713 - 844 - 3 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - - - - 140.4158108891898 - - 1920 - 2 - 384 - 1 - 716 - - - org.contikios.cooja.plugins.RadioLogger - - 407 - - false - false - - 595 - 4 - 706 - 245 - 4 - - - diff --git a/examples/rpl-udp/rpl-udp-sky.csc b/examples/rpl-udp/rpl-udp-sky.csc deleted file mode 100644 index 4b9ce6099..000000000 --- a/examples/rpl-udp/rpl-udp-sky.csc +++ /dev/null @@ -1,285 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - RPL-UDP Example - generated - 5000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #sky1 - [CONTIKI_DIR]/examples/rpl-udp/udp-server.c - make udp-server.sky TARGET=sky - [CONTIKI_DIR]/examples/rpl-udp/udp-server.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - org.contikios.cooja.mspmote.SkyMoteType - sky2 - Sky Mote Type #sky2 - [CONTIKI_DIR]/examples/rpl-udp/udp-client.c - make udp-client.sky TARGET=sky - [CONTIKI_DIR]/examples/rpl-udp/udp-client.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 30.051578821079996 - -64.69428746901113 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 21.31366587648077 - -34.91404431659299 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 57.165216906562264 - -34.02362118358309 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 75.1786320042507 - -60.441618586411096 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 59.11488934836 - -7.544844766953879 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 91.720430365082 - -22.736406051209734 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 6 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 92.90372351580778 - 2.532304558933846 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 7 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 120.28246466847423 - 19.133402903417824 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 8 - - sky2 - - - - org.contikios.cooja.plugins.SimControl - 249 - 4 - 184 - 3 - 15 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.AttributeVisualizerSkin - 1.3598488697820064 0.0 0.0 1.3598488697820064 6.142207908179105 118.20877091196155 - - 234 - 1 - 227 - 14 - 210 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1011 - 0 - 556 - 759 - 7 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - - - 681.712557066089 - - 1804 - 3 - 352 - 0 - 567 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - 500 - 2 - 546 - 259 - 12 - - - diff --git a/examples/rpl-udp/rpl-udp.resc b/examples/rpl-udp/rpl-udp.resc deleted file mode 100644 index 828610549..000000000 --- a/examples/rpl-udp/rpl-udp.resc +++ /dev/null @@ -1,45 +0,0 @@ -:name: cc2538 range medium 2 nodes - -###################################################################### -# -# Sample script creating 1 server node and 1 client node using a -# range-based medium function - transmission is possible if nodes are -# in range. Nodes are positioned in a 3D space (x,y,z), -# at a distance of 10 (units) from each other (on the X axis). -# -# Differences in SyncUnit values in machines represent the differences -# in their relative speed. This prevents the machines from -# synchronizing in 100%, which is crucial for Contiki network stack -# stability. -# -###################################################################### - -path add $CWD -emulation CreateWirelessMedium "wireless" -$domain = `emulation AddSyncDomain` -wireless SetSyncDomainFromEmulation $domain - -# The radio is using a range-based medium (with the `Range` set to `11`) -# If not set, the default SimpleMediumFunction will be used (where range is not relevant) -wireless SetRangeWirelessFunction 11 - -######################### UDP SERVER - begin ######################### -$bin=@udp-server.cc2538dk -$name="server" -i $ORIGIN/cc2538-node.resc -wireless SetPosition radio 0 0 0 -machine SyncUnit 100 -showAnalyzer sysbus.uart0 -mach clear -########################## UDP SERVER - end ########################## - -######################### UDP CLIENT - begin ######################### -$bin=@udp-client.cc2538dk -$name="client" - -i $ORIGIN/cc2538-node.resc -wireless SetPosition radio 10 0 0 -machine SyncUnit 110 -showAnalyzer sysbus.uart0 -mach clear -########################## UDP CLIENT - end ########################## diff --git a/examples/rpl-udp/udp-client.c b/examples/rpl-udp/udp-client.c deleted file mode 100644 index 5dc7a0763..000000000 --- a/examples/rpl-udp/udp-client.c +++ /dev/null @@ -1,78 +0,0 @@ -#include "contiki.h" -#include "net/routing/routing.h" -#include "random.h" -#include "net/netstack.h" -#include "net/ipv6/simple-udp.h" - -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#define WITH_SERVER_REPLY 1 -#define UDP_CLIENT_PORT 8765 -#define UDP_SERVER_PORT 5678 - -#define SEND_INTERVAL (60 * CLOCK_SECOND) - -static struct simple_udp_connection udp_conn; - -/*---------------------------------------------------------------------------*/ -PROCESS(udp_client_process, "UDP client"); -AUTOSTART_PROCESSES(&udp_client_process); -/*---------------------------------------------------------------------------*/ -static void -udp_rx_callback(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - - LOG_INFO("Received response '%.*s' from ", datalen, (char *) data); - LOG_INFO_6ADDR(sender_addr); -#if LLSEC802154_CONF_ENABLED - LOG_INFO_(" LLSEC LV:%d", uipbuf_get_attr(UIPBUF_ATTR_LLSEC_LEVEL)); -#endif - LOG_INFO_("\n"); - -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(udp_client_process, ev, data) -{ - static struct etimer periodic_timer; - static unsigned count; - static char str[32]; - uip_ipaddr_t dest_ipaddr; - - PROCESS_BEGIN(); - - /* Initialize UDP connection */ - simple_udp_register(&udp_conn, UDP_CLIENT_PORT, NULL, - UDP_SERVER_PORT, udp_rx_callback); - - etimer_set(&periodic_timer, random_rand() % SEND_INTERVAL); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - - if(NETSTACK_ROUTING.node_is_reachable() && NETSTACK_ROUTING.get_root_ipaddr(&dest_ipaddr)) { - /* Send to DAG root */ - LOG_INFO("Sending request %u to ", count); - LOG_INFO_6ADDR(&dest_ipaddr); - LOG_INFO_("\n"); - snprintf(str, sizeof(str), "hello %d", count); - simple_udp_sendto(&udp_conn, str, strlen(str), &dest_ipaddr); - count++; - } else { - LOG_INFO("Not reachable yet\n"); - } - - /* Add some jitter */ - etimer_set(&periodic_timer, SEND_INTERVAL - - CLOCK_SECOND + (random_rand() % (2 * CLOCK_SECOND))); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/rpl-udp/udp-server.c b/examples/rpl-udp/udp-server.c deleted file mode 100644 index 072eb8ae8..000000000 --- a/examples/rpl-udp/udp-server.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "net/routing/routing.h" -#include "net/netstack.h" -#include "net/ipv6/simple-udp.h" - -#include "sys/log.h" -#define LOG_MODULE "App" -#define LOG_LEVEL LOG_LEVEL_INFO - -#define WITH_SERVER_REPLY 1 -#define UDP_CLIENT_PORT 8765 -#define UDP_SERVER_PORT 5678 - -static struct simple_udp_connection udp_conn; - -PROCESS(udp_server_process, "UDP server"); -AUTOSTART_PROCESSES(&udp_server_process); -/*---------------------------------------------------------------------------*/ -static void -udp_rx_callback(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - LOG_INFO("Received request '%.*s' from ", datalen, (char *) data); - LOG_INFO_6ADDR(sender_addr); - LOG_INFO_("\n"); -#if WITH_SERVER_REPLY - /* send back the same string to the client as an echo reply */ - LOG_INFO("Sending response.\n"); - simple_udp_sendto(&udp_conn, data, datalen, sender_addr); -#endif /* WITH_SERVER_REPLY */ -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(udp_server_process, ev, data) -{ - PROCESS_BEGIN(); - - /* Initialize DAG root */ - NETSTACK_ROUTING.root_start(); - - /* Initialize UDP connection */ - simple_udp_register(&udp_conn, UDP_SERVER_PORT, NULL, - UDP_CLIENT_PORT, udp_rx_callback); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/Makefile b/examples/sensniff/Makefile deleted file mode 100644 index 78cb41a3e..000000000 --- a/examples/sensniff/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -CONTIKI_PROJECT = sensniff -CONTIKI = ../.. - -PLATFORMS_ONLY = cc2538dk openmote-cc2538 z1 zoul cc26x0-cc13x0 jn516x simplelink - -PROJECT_SOURCEFILES += sensniff-mac.c netstack.c -MODULES_REL += pool $(TARGET) - -include $(CONTIKI)/Makefile.identify-target - -all: $(CONTIKI_PROJECT) - -# use a custom MAC driver: sensniff_mac_driver -MAKE_MAC = MAKE_MAC_OTHER -include $(CONTIKI)/Makefile.include - -PYTHON ?= python -SENSNIFF = $(CONTIKI)/tools/sensniff/sensniff.py - -ifeq ($(BAUDRATE),) - BAUDRATE = 460800 -endif - -SENSNIFF_FLAGS += -b $(BAUDRATE) - -ifneq ($(PORT),) - SENSNIFF_FLAGS += -d $(PORT) -endif - -sniff: -ifeq ($(wildcard $(SENSNIFF)), ) - $(error Could not find the sensniff script. Did you run 'git submodule update --init' ?") -else - $(PYTHON) $(SENSNIFF) $(SENSNIFF_FLAGS) -endif diff --git a/examples/sensniff/README.md b/examples/sensniff/README.md deleted file mode 100644 index 01b3de54c..000000000 --- a/examples/sensniff/README.md +++ /dev/null @@ -1,98 +0,0 @@ -sensniff Contiki Project -======================== -This example can be used to create an IEEE 802.15.4 wireless sniffer firmware, -meant to be used in parallel with -[sensniff](https://github.com/g-oikonomou/sensniff). Sensniff is distributed -standalone, but also as part of Contiki-NG under `tools/sensniff`. - -Running -======= -* Build this example and program your device -* Connect your device to a host -* Run sensniff on your host -* Fire up wireshark and enjoy. - -You can run sensniff manually, or you can simply run `make sniff` from within -this directory. If you choose the latter option, you may have to specify the -port where you device is connected by using the PORT variable. For example, if -your device is connected to `/dev/ttyUSB1` then you should run -`make PORT=/dev/ttyUSB1 sniff`. - -Make sure your device's UART baud rate matches the `-b` argument passed to -sensniff. I strongly recommend using at least 460800. This comment does not -apply if your device is using native USB. - -Subsequently, make absolutely certain that your device is tuned to the same RF -channel as the network you are trying to sniff. You can change sniffing channel -through sensniff's text interface. - -More details in sensniff's README. - -Adding support for more platforms -================================= -Firstly, this example will try to turn off frame filtering and automatic h/w -ACKs by calling `NETSTACK_RADIO.set_value(RADIO_PARAM_RX_MODE, 0)`. If your -radio does not support this, then implementing this is your first step towards -running this example on your board. - -Secondly, in order to be able to switch channels and retrieve current/min/max -RF channel supported from sensniff's text interface, your device's radio driver -must also support: - - NETSTACK_RADIO.get_value(RADIO_PARAM_CHANNEL, ...) - NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, ...) - NETSTACK_RADIO.get_value(RADIO_CONST_CHANNEL_MIN, ...) - NETSTACK_RADIO.get_value(RADIO_CONST_CHANNEL_MAX, ...) - -The following radios have been tested: - -* CC13xx/CC26xx in PROP and IEEE modes -* CC2538 -* CC2530/CC2531 -* CC1200 -* RF233 - -Once you have the radio sorted out, you also need to configure character I/O. -The firmware captures wireless frames and streams them over a serial line to -the host where your device is connected. This can be achieved over UART or over -CDC-ACM. The example makes zero assumptions about your hardware's capability, -you have to configure thnigs explicitly. - -* Firstly, create a directory named the same as your platform. Crate a header -file therein called `target-conf.h`. This will get included automatically. -* Then look at the header files under `pool`, perhaps your device's CPU is -already supported. If that's the case, then within your `target-conf.h` you -simply need to add a line like this: - - #define SENSNIFF_IO_DRIVER_H "pool/cc2538-io.h" - -choosing the header that corresponds to your device's CPU. Just look for any of -the platforms already supported to see how you can configure things in a more -fine-grained fashion (e.g. to select UART instance, switch between UART/USB -etc). - -* If your CPU is not already supported, then you need to create an additional -header file. In that header file, you will need to define the following three: - - #define sensniff_io_byte_out() - #define sensniff_io_flush() - #define sensniff_io_set_input() - -Those should map to functions implemented by your device's peripheral driver, -e.g. your UART driver. `_byte_out()` and `set_input()` are required, but -`_flush()` is optional and is only really helpful in case of drivers/hardware -that support buffered I/O (as is the case for some Contiki's USB drivers). Once -you have provided those defines, then simple go back to your `target-conf.h` -and: - - #define SENSNIFF_IO_DRIVER_H "header-with-my-own-defines.h" - -* The build system will also try to include `platform/Makefile.platform`. You -can create this Makefile if you want to extend the build system e.g. by adding -source files to the build, or by specifying Make variables. A common reason why -you may wish to do so would be to specify your device's baudrate. In doing so, -`make sniff` will pass the correct value as the argument to `-b`. You do not -have to create this file if you don't need to do so. - -That should be it! - diff --git a/examples/sensniff/cc2538dk/target-conf.h b/examples/sensniff/cc2538dk/target-conf.h deleted file mode 100644 index f498bb00b..000000000 --- a/examples/sensniff/cc2538dk/target-conf.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 TARGET_CONF_H_ -#define TARGET_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* - * Selection of Sensniff I/O Interface. - * Define CC2538_IO_CONF_USB as 0 to use UART as sensniff's interface. - * This will default to using UART0, unless you also define - * CC2538_IO_CONF_USE_UART_1 as 1. - * - * Don't forget to also set a correct baud rate (460800 or higher) by defining - * the corresponding UART0_CONF_BAUD_RATE or UART1_CONF_BAUD_RATE - */ -#define CC2538_IO_CONF_USB 1 -#define CC2538_IO_CONF_USE_UART1 0 -/*---------------------------------------------------------------------------*/ -#if CC2538_IO_CONF_USB -#define USB_SERIAL_CONF_ENABLE 1 -#else -#define UART0_CONF_BAUD_RATE 460800 -#endif -/*---------------------------------------------------------------------------*/ -#define SENSNIFF_IO_DRIVER_H "pool/cc2538-io.h" -/*---------------------------------------------------------------------------*/ -#endif /* TARGET_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/cc26x0-cc13x0/target-conf.h b/examples/sensniff/cc26x0-cc13x0/target-conf.h deleted file mode 100644 index b86df35c5..000000000 --- a/examples/sensniff/cc26x0-cc13x0/target-conf.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 TARGET_CONF_H_ -#define TARGET_CONF_H_ -/*---------------------------------------------------------------------------*/ -#define CC26XX_UART_CONF_BAUD_RATE 460800 -#define RF_BLE_CONF_ENABLED 0 -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -#define SENSNIFF_IO_DRIVER_H "pool/cc13xx-cc26xx-io.h" -/*---------------------------------------------------------------------------*/ -#endif /* TARGET_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/jn516x/Makefile.jn516x b/examples/sensniff/jn516x/Makefile.jn516x deleted file mode 100644 index 3d53f4cc0..000000000 --- a/examples/sensniff/jn516x/Makefile.jn516x +++ /dev/null @@ -1 +0,0 @@ -BAUDRATE = 1000000 diff --git a/examples/sensniff/jn516x/jn516x-io.h b/examples/sensniff/jn516x/jn516x-io.h deleted file mode 100644 index 89ee9dfda..000000000 --- a/examples/sensniff/jn516x/jn516x-io.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 JN516X_IO_H_ -#define JN516X_IO_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/uart0.h" -#include "dev/uart1.h" -/*---------------------------------------------------------------------------*/ -#ifdef JN516X_IO_CONF_USE_UART1 -#define JN516X_IO_USE_UART1 JN516X_IO_CONF_USE_UART1 -#else -#define JN516X_IO_USE_UART1 0 -#endif -/*---------------------------------------------------------------------------*/ -#if JN516X_IO_USE_UART1 -#define sensniff_io_byte_out(b) uart1_writeb(b) -#define sensniff_io_flush() -#define sensniff_io_set_input(f) uart1_set_input(f) -#else -#define sensniff_io_byte_out(b) uart0_writeb(b) -#define sensniff_io_flush() -#define sensniff_io_set_input(f) uart0_set_input(f) -#endif -/*---------------------------------------------------------------------------*/ -#endif /* JN516X_IO_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/jn516x/target-conf.h b/examples/sensniff/jn516x/target-conf.h deleted file mode 100644 index 8f30be7b2..000000000 --- a/examples/sensniff/jn516x/target-conf.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 TARGET_CONF_H_ -#define TARGET_CONF_H_ -/*---------------------------------------------------------------------------*/ -#define SENSNIFF_IO_DRIVER_H "jn516x/jn516x-io.h" -/*---------------------------------------------------------------------------*/ -#endif /* TARGET_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/openmote-cc2538/target-conf.h b/examples/sensniff/openmote-cc2538/target-conf.h deleted file mode 100644 index c4591eacb..000000000 --- a/examples/sensniff/openmote-cc2538/target-conf.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 TARGET_CONF_H_ -#define TARGET_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* - * Selection of Sensniff I/O Interface. - * Define CC2538_IO_CONF_USB as 0 to use UART as sensniff's interface. - * This will default to using UART0, unless you also define - * CC2538_IO_CONF_USE_UART1 as 1. - * - * Don't forget to also set a correct baud rate (460800 or higher) by defining - * the corresponding UART0_CONF_BAUD_RATE or UART1_CONF_BAUD_RATE - */ -#define CC2538_IO_CONF_USB 0 -#define CC2538_IO_CONF_USE_UART1 0 -/*---------------------------------------------------------------------------*/ -#if CC2538_IO_CONF_USB -#define USB_SERIAL_CONF_ENABLE 1 -#else -#define UART0_CONF_BAUD_RATE 460800 -#endif -/*---------------------------------------------------------------------------*/ -#define SENSNIFF_IO_DRIVER_H "pool/cc2538-io.h" -/*---------------------------------------------------------------------------*/ -#endif /* TARGET_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/pool/cc13xx-cc26xx-io.h b/examples/sensniff/pool/cc13xx-cc26xx-io.h deleted file mode 100644 index e9935a8ae..000000000 --- a/examples/sensniff/pool/cc13xx-cc26xx-io.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 CC13XX_CC26XX_IO_H_ -#define CC13XX_CC26XX_IO_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/cc26xx-uart.h" -/*---------------------------------------------------------------------------*/ -#define sensniff_io_byte_out(b) cc26xx_uart_write_byte(b) -#define sensniff_io_flush() -#define sensniff_io_set_input(f) cc26xx_uart_set_input(f) -/*---------------------------------------------------------------------------*/ -#endif /* CC13XX_CC26XX_IO_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/pool/cc2538-io.h b/examples/sensniff/pool/cc2538-io.h deleted file mode 100644 index 1238a23e2..000000000 --- a/examples/sensniff/pool/cc2538-io.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "dev/uart.h" -#include "usb/usb-serial.h" -/*---------------------------------------------------------------------------*/ -#ifndef CC2538_IO_H_ -#define CC2538_IO_H_ -/*---------------------------------------------------------------------------*/ -/* - * Select whether to use native USB as sensniff's I/O interface. - * If defined as 0, UART will be used. Set to 1 to use USB. - */ -#ifdef CC2538_IO_CONF_USB -#define CC2538_IO_USB CC2538_IO_CONF_USB -#else -#define CC2538_IO_USB 0 -#endif -/*---------------------------------------------------------------------------*/ -/* - * UART instance selection. Set to 1 to use UART1. - * Ignored unless CC2538_IO_USB is 0. - */ -#ifdef CC2538_IO_CONF_USE_UART1 -#define CC2538_IO_USE_UART1 CC2538_IO_CONF_USE_UART1 -#else -#define CC2538_IO_USE_UART1 0 -#endif -/*---------------------------------------------------------------------------*/ -#if CC2538_IO_USB -#define sensniff_io_byte_out(b) usb_serial_writeb(b) -#define sensniff_io_flush() usb_serial_flush() -#define sensniff_io_set_input(f) usb_serial_set_input(f) -#else -#if CC2538_IO_USE_UART1 -#define sensniff_io_byte_out(b) uart_write_byte(1, b) -#define sensniff_io_flush() -#define sensniff_io_set_input(f) uart_set_input(1, f) -#else -#define sensniff_io_byte_out(b) uart_write_byte(0, b) -#define sensniff_io_flush() -#define sensniff_io_set_input(f) uart_set_input(0, f) -#endif /* CC2538_IO_USE_UART_1 */ -#endif /* CC2538_IO_USB */ -/*---------------------------------------------------------------------------*/ -#endif /* CC2538_IO_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/pool/msp430-io.h b/examples/sensniff/pool/msp430-io.h deleted file mode 100644 index 0a8f15c9f..000000000 --- a/examples/sensniff/pool/msp430-io.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 MSP430_IO_H_ -#define MSP430_IO_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/uart0.h" -#include "dev/uart1.h" -/*---------------------------------------------------------------------------*/ -#ifdef MSP430_IO_CONF_USE_UART1 -#define MSP430_IO_USE_UART1 MSP430_IO_CONF_USE_UART1 -#else -#define MSP430_IO_USE_UART1 0 -#endif -/*---------------------------------------------------------------------------*/ -#if MSP430_IO_USE_UART1 -#define sensniff_io_byte_out(b) uart1_writeb(b) -#define sensniff_io_flush() -#define sensniff_io_set_input(f) uart1_set_input(f) -#else -#define sensniff_io_byte_out(b) uart0_writeb(b) -#define sensniff_io_flush() -#define sensniff_io_set_input(f) uart0_set_input(f) -#endif -/*---------------------------------------------------------------------------*/ -#endif /* MSP430_IO_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/pool/simplelink-cc13xx-cc26xx-io.h b/examples/sensniff/pool/simplelink-cc13xx-cc26xx-io.h deleted file mode 100644 index a77f9eb76..000000000 --- a/examples/sensniff/pool/simplelink-cc13xx-cc26xx-io.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 SIMPLELINK_CC13XX_CC26XX_IO_H_ -#define SIMPLELINK_CC13XX_CC26XX_IO_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#include "dev/uart0-arch.h" -/*---------------------------------------------------------------------------*/ -#define sensniff_io_byte_out(b) uart0_write_byte(b) -#define sensniff_io_flush() -#define sensniff_io_set_input(f) uart0_set_callback(f) -/*---------------------------------------------------------------------------*/ -#endif /* SIMPLELINK_CC13XX_CC26XX_IO_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/project-conf.h b/examples/sensniff/project-conf.h deleted file mode 100644 index f9097d465..000000000 --- a/examples/sensniff/project-conf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Configure the sensniff_mac_driver for netstack.h */ -#define NETSTACK_CONF_MAC sensniff_mac_driver -/*---------------------------------------------------------------------------*/ -/* Include platform-specific header */ -#include "target-conf.h" -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/sensniff/sensniff-mac.c b/examples/sensniff/sensniff-mac.c deleted file mode 100644 index aa78897b6..000000000 --- a/examples/sensniff/sensniff-mac.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * Copyright (c) 2012-2013, Centre National de la Recherche Scientifique. - * 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. - */ -/*---------------------------------------------------------------------------*/ -/* - * Author: George Oikonomou - * Loosely based on the example contributed by Etienne Duble (CNRS / LIG), as - * part of the work done for the ANR ARESA2 project. - */ -/*---------------------------------------------------------------------------*/ -#include "net/mac/mac.h" -#include "net/netstack.h" -#include "sensniff.h" -/*---------------------------------------------------------------------------*/ -static void -send(mac_callback_t sent, void *ptr) -{ -} -/*---------------------------------------------------------------------------*/ -static void -input(void) -{ - sensniff_output_frame(); -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - NETSTACK_RADIO.on(); - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - on(); -} -/*---------------------------------------------------------------------------*/ -const struct mac_driver sensniff_mac_driver = { - "sensniff-rdc", - init, - send, - input, - on, - off -}; -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/sensniff.c b/examples/sensniff/sensniff.c deleted file mode 100644 index 4eea07d78..000000000 --- a/examples/sensniff/sensniff.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "sensniff.h" -#include "dev/radio.h" -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "sys/process.h" -#include "sys/ctimer.h" -#include "lib/ringbuf.h" - -#include SENSNIFF_IO_DRIVER_H - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -PROCESS(sensniff_process, "sensniff process"); -AUTOSTART_PROCESSES(&sensniff_process); -/*---------------------------------------------------------------------------*/ -/* Timeout handling for incoming characters. */ -#define TIMEOUT (CLOCK_SECOND >> 1) -static struct ctimer ct; -/*---------------------------------------------------------------------------*/ -#define STATE_WAITING_FOR_MAGIC 0x00 -#define STATE_WAITING_FOR_VERSION 0x01 -#define STATE_WAITING_FOR_CMD 0x02 -#define STATE_WAITING_FOR_LEN_1 0x03 -#define STATE_WAITING_FOR_LEN_2 0x04 -#define STATE_WAITING_FOR_DATA 0x05 - -static uint8_t state; -static uint8_t in_ct; -/*---------------------------------------------------------------------------*/ -#define CMD_FRAME 0x00 -#define CMD_CHANNEL 0x01 -#define CMD_CHANNEL_MIN 0x02 -#define CMD_CHANNEL_MAX 0x03 -#define CMD_ERR_NOT_SUPPORTED 0x7F -#define CMD_GET_CHANNEL 0x81 -#define CMD_GET_CHANNEL_MIN 0x82 -#define CMD_GET_CHANNEL_MAX 0x83 -#define CMD_SET_CHANNEL 0x84 -/*---------------------------------------------------------------------------*/ -#define PROTOCOL_VERSION 2 -/*---------------------------------------------------------------------------*/ -#define BUFSIZE 32 - -static struct ringbuf rxbuf; - -typedef struct cmd_in_s { - uint8_t cmd; - uint16_t len; - uint8_t data; -} cmd_in_t; - -static cmd_in_t command; - -uint8_t cmd_buf[BUFSIZE]; -/*---------------------------------------------------------------------------*/ -static const uint8_t magic[] = { 0xC1, 0x1F, 0xFE, 0x72 }; -/*---------------------------------------------------------------------------*/ -static void -reset_state(void *byte) -{ - state = STATE_WAITING_FOR_MAGIC; - in_ct = 0; - memset(&command, 0, sizeof(command)); -} -/*---------------------------------------------------------------------------*/ -static void -send_header(uint8_t cmd, uint16_t len) -{ - uint16_t i; - - /* Send the magic */ - for(i = 0; i < 4; i++) { - sensniff_io_byte_out(magic[i]); - } - - /* Send the protocol version */ - sensniff_io_byte_out(PROTOCOL_VERSION); - - /* Send the command byte */ - sensniff_io_byte_out(cmd); - - /* Send the length, network endianness */ - sensniff_io_byte_out(len >> 8); - sensniff_io_byte_out(len & 0xFF); -} -/*---------------------------------------------------------------------------*/ -static void -send_error(void) -{ - send_header(CMD_ERR_NOT_SUPPORTED, 0); - - sensniff_io_flush(); -} -/*---------------------------------------------------------------------------*/ -static void -send_channel(void) -{ - radio_value_t chan; - - if(NETSTACK_RADIO.get_value(RADIO_PARAM_CHANNEL, &chan) == - RADIO_RESULT_OK) { - send_header(CMD_CHANNEL, 1); - sensniff_io_byte_out(chan & 0xFF); - sensniff_io_flush(); - return; - } - - send_error(); -} -/*---------------------------------------------------------------------------*/ -static void -set_channel(uint8_t channel) -{ - if(NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, channel) == - RADIO_RESULT_OK) { - send_channel(); - return; - } - - send_error(); -} -/*---------------------------------------------------------------------------*/ -static void -send_channel_min(void) -{ - radio_value_t chan; - - if(NETSTACK_RADIO.get_value(RADIO_CONST_CHANNEL_MIN, &chan) == - RADIO_RESULT_OK) { - send_header(CMD_CHANNEL_MIN, 1); - sensniff_io_byte_out(chan & 0xFF); - sensniff_io_flush(); - return; - } - - send_error(); -} -/*---------------------------------------------------------------------------*/ -static void -send_channel_max(void) -{ - radio_value_t chan; - - if(NETSTACK_RADIO.get_value(RADIO_CONST_CHANNEL_MAX, &chan) == - RADIO_RESULT_OK) { - send_header(CMD_CHANNEL_MAX, 1); - sensniff_io_byte_out(chan & 0xFF); - sensniff_io_flush(); - return; - } - - send_error(); -} -/*---------------------------------------------------------------------------*/ -static int -char_in(unsigned char c) -{ - /* Bump the timeout counter */ - ctimer_set(&ct, TIMEOUT, reset_state, NULL); - - /* Add the character to our ringbuf and poll the consumer process. */ - ringbuf_put(&rxbuf, c); - - process_poll(&sensniff_process); - return 1; -} -/*---------------------------------------------------------------------------*/ -void -sensniff_output_frame() -{ - int i; - uint8_t len = packetbuf_datalen() & 0xFF; - - send_header(CMD_FRAME, len + 2); - - for(i = 0; i < len; i++) { - sensniff_io_byte_out(((uint8_t *)packetbuf_dataptr())[i]); - } - - sensniff_io_byte_out(packetbuf_attr(PACKETBUF_ATTR_RSSI) & 0xFF); - sensniff_io_byte_out(0x80 | - (packetbuf_attr(PACKETBUF_ATTR_LINK_QUALITY) & 0xFF)); - - sensniff_io_flush(); -} -/*---------------------------------------------------------------------------*/ -static void -execute_command(void) -{ - switch(command.cmd) { - case CMD_GET_CHANNEL: - send_channel(); - break; - case CMD_GET_CHANNEL_MIN: - send_channel_min(); - break; - case CMD_GET_CHANNEL_MAX: - send_channel_max(); - break; - case CMD_SET_CHANNEL: - set_channel(command.data); - break; - default: - send_error(); - break; - } -} -/*---------------------------------------------------------------------------*/ -static void -process_incoming_data(void) -{ - int c = 0; - uint8_t byte_in; - - c = ringbuf_get(&rxbuf); - - while(c != -1) { - byte_in = (uint8_t)c; - switch(state) { - case STATE_WAITING_FOR_MAGIC: - if(byte_in == magic[in_ct]) { - in_ct++; - if(in_ct == sizeof(magic)) { - state = STATE_WAITING_FOR_VERSION; - in_ct = 0; - } - } else { - reset_state(&byte_in); - } - break; - case STATE_WAITING_FOR_VERSION: - if(byte_in == PROTOCOL_VERSION) { - state = STATE_WAITING_FOR_CMD; - } else { - reset_state(&byte_in); - } - break; - case STATE_WAITING_FOR_CMD: - command.cmd = byte_in; - - if(command.cmd == CMD_GET_CHANNEL || - command.cmd == CMD_GET_CHANNEL_MIN || - command.cmd == CMD_GET_CHANNEL_MAX) { - execute_command(); - reset_state(&byte_in); - } else { - state = STATE_WAITING_FOR_LEN_1; - } - break; - case STATE_WAITING_FOR_LEN_1: - command.len = byte_in << 8; - state = STATE_WAITING_FOR_LEN_2; - break; - case STATE_WAITING_FOR_LEN_2: - command.len |= byte_in; - if(command.len == 1) { - state = STATE_WAITING_FOR_DATA; - } else { - reset_state(&byte_in); - } - break; - case STATE_WAITING_FOR_DATA: - command.data = byte_in; - execute_command(); - reset_state(&byte_in); - break; - default: - break; - } - c = ringbuf_get(&rxbuf); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sensniff_process, ev, data) -{ - PROCESS_BEGIN(); - - /* Turn off RF frame filtering and H/W ACKs */ - if(NETSTACK_RADIO.set_value(RADIO_PARAM_RX_MODE, 0) != RADIO_RESULT_OK) { - printf("sensniff: Error setting RF in promiscuous mode\n"); - PROCESS_EXIT(); - } - - /* Initialise the ring buffer */ - ringbuf_init(&rxbuf, cmd_buf, sizeof(cmd_buf)); - - /* Initialise the state machine */ - reset_state(NULL); - - /* Register for char inputs with the character I/O peripheral */ - sensniff_io_set_input(&char_in); - - while(1) { - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_POLL) { - process_incoming_data(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/sensniff.h b/examples/sensniff/sensniff.h deleted file mode 100644 index 68831ff70..000000000 --- a/examples/sensniff/sensniff.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 SENSNIFF_H_ -#define SENSNIFF_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -#define SENSNIFF_ERROR 0xFF -#define SENSNIFF_OK 0x00 -/*---------------------------------------------------------------------------*/ -void sensniff_output_frame(void); -/*---------------------------------------------------------------------------*/ -#endif /* SENSNIFF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/simplelink/target-conf.h b/examples/sensniff/simplelink/target-conf.h deleted file mode 100644 index 043e5a08f..000000000 --- a/examples/sensniff/simplelink/target-conf.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/ - * 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 TARGET_CONF_H_ -#define TARGET_CONF_H_ -/*---------------------------------------------------------------------------*/ -#define TI_UART_CONF_BAUD_RATE 460800 -#define RF_CONF_BLE_BEACON_ENABLE 0 -/*---------------------------------------------------------------------------*/ -#define SENSNIFF_IO_DRIVER_H "pool/simplelink-cc13xx-cc26xx-io.h" -/*---------------------------------------------------------------------------*/ -#endif /* TARGET_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/z1/target-conf.h b/examples/sensniff/z1/target-conf.h deleted file mode 100644 index 6e3db2b48..000000000 --- a/examples/sensniff/z1/target-conf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 TARGET_CONF_H_ -#define TARGET_CONF_H_ -/*---------------------------------------------------------------------------*/ -#define MSP430_IO_CONF_USE_UART1 0 -#define UART0_CONF_BAUD_RATE 460800 -/*---------------------------------------------------------------------------*/ -#define SENSNIFF_IO_DRIVER_H "pool/msp430-io.h" -/*---------------------------------------------------------------------------*/ -#endif /* TARGET_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/zoul/target-conf.h b/examples/sensniff/zoul/target-conf.h deleted file mode 100644 index 9f978b4c7..000000000 --- a/examples/sensniff/zoul/target-conf.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2016, George Oikonomou - http://www.spd.gr - * 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 TARGET_CONF_H_ -#define TARGET_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Set to 1 for a sub-ghz sniffer with the CC1200 */ -#ifndef ZOUL_CONF_SUB_GHZ_SNIFFER -#define ZOUL_CONF_SUB_GHZ_SNIFFER 0 -#endif -/*---------------------------------------------------------------------------*/ -#if ZOUL_CONF_SUB_GHZ_SNIFFER -#define NETSTACK_CONF_RADIO cc1200_driver - -/* - * You will need to configure the defines below to match the configuration of - * your sub-ghz network. - */ -#define CC1200_CONF_RF_CFG cc1200_802154g_863_870_fsk_50kbps -#define CC1200_CONF_USE_GPIO2 0 -#define CC1200_CONF_USE_RX_WATCHDOG 0 -#define CC1200_CONF_802154G 0 -#define CC1200_CONF_802154G_CRC16 0 -#define CC1200_CONF_802154G_WHITENING 0 -#define ANTENNA_SW_SELECT_DEF_CONF ANTENNA_SW_SELECT_SUBGHZ -#endif -/*---------------------------------------------------------------------------*/ -/* - * Selection of Sensniff I/O Interface. - * Define CC2538_IO_CONF_USB as 0 to use UART0 as sensniff's interface. - */ -#define CC2538_IO_CONF_USB 0 -/*---------------------------------------------------------------------------*/ -#if CC2538_IO_CONF_USB -#define USB_SERIAL_CONF_ENABLE 1 -#else -#define UART0_CONF_BAUD_RATE 460800 -#endif -/*---------------------------------------------------------------------------*/ -#define SENSNIFF_IO_DRIVER_H "pool/cc2538-io.h" -/*---------------------------------------------------------------------------*/ -#endif /* TARGET_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/simulations/02.csc b/examples/simulations/02.csc deleted file mode 100644 index cea5c6b24..000000000 --- a/examples/simulations/02.csc +++ /dev/null @@ -1,135 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype729 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/2/test-timers.c - make test-timers.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 81.3697454254841 - 81.4544588714536 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype729 - - - - org.contikios.cooja.plugins.SimControl - 280 - 0 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 120.02750415865083 98.9504919350422 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 290 - 3 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - - - - 500.0 - - 690 - 1 - 166 - 0 - 453 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 10 - 2 - 160 - 680 - 0 - - - diff --git a/examples/simulations/04.csc b/examples/simulations/04.csc deleted file mode 100644 index de7af767c..000000000 --- a/examples/simulations/04.csc +++ /dev/null @@ -1,139 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - MySerialSimulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype595 - Mote01 - [CONTIKI_DIR]/examples/4/serial-test.c - make serial-test.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 18.150756713050274 - 50.63752762734578 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - hello~;hey~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype595 - - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 177.4993120790452 126.96588397514022 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 290 - 1 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - - - - 500.0 - - 690 - 4 - 166 - 0 - 453 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 10 - 3 - 160 - 680 - 0 - - - diff --git a/examples/slip-radio/Makefile b/examples/slip-radio/Makefile deleted file mode 100644 index 877b109f1..000000000 --- a/examples/slip-radio/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CONTIKI_PROJECT=slip-radio -all: $(CONTIKI_PROJECT) -MODULES += os/services/slip-cmd - -# slip-radio is only intended for platforms with SLIP support -PLATFORMS_EXCLUDE = native nrf52dk - -CONTIKI=../.. -include $(CONTIKI)/Makefile.identify-target - -MODULES_REL += $(TARGET) -PROJECT_SOURCEFILES += slip-net.c - -# custom net layer, but with IPv6 enabled -MAKE_NET = MAKE_NET_IPV6 -MAKE_ROUTING = MAKE_ROUTING_NULLROUTING -include $(CONTIKI)/Makefile.include diff --git a/examples/slip-radio/README.md b/examples/slip-radio/README.md deleted file mode 100644 index 3839dbab9..000000000 --- a/examples/slip-radio/README.md +++ /dev/null @@ -1,5 +0,0 @@ -This example is intended to run on a mode that is connected to a native host -system by SLIP. Full IEEE 802.15.4 packets are transmitted over slip, turning -the mote into a simple radio, with the RPL and 6LoWPAN stack running on the -host. This is typically used with the native border router (example -`rpl-border-router` on target native). diff --git a/examples/slip-radio/project-conf.h b/examples/slip-radio/project-conf.h deleted file mode 100644 index 4283d0249..000000000 --- a/examples/slip-radio/project-conf.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -/*---------------------------------------------------------------------------*/ -#define UIP_CONF_ROUTER 0 - -#define CMD_CONF_OUTPUT slip_write - -/* Default CMD handlers if the target did not specify them */ -#ifndef CMD_CONF_HANDLERS -#define CMD_CONF_HANDLERS slip_radio_cmd_handler -#endif - -/* Configuration for the slipradio/network driver. */ -#define NETSTACK_CONF_NETWORK slipnet_driver - -#define NETSTACK_CONF_FRAMER no_framer -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/slip-radio/sky/module-macros.h b/examples/slip-radio/sky/module-macros.h deleted file mode 100644 index 1fabdf1cf..000000000 --- a/examples/slip-radio/sky/module-macros.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 QUEUEBUF_CONF_NUM 4 -#define UIP_CONF_BUFFER_SIZE 140 - -#define UART1_CONF_RX_WITH_DMA 1 -/*---------------------------------------------------------------------------*/ diff --git a/examples/slip-radio/sky/slip-radio-putchar.c b/examples/slip-radio/sky/slip-radio-putchar.c deleted file mode 100644 index 7d688cdd1..000000000 --- a/examples/slip-radio/sky/slip-radio-putchar.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "dev/slip.h" - -#include -/*---------------------------------------------------------------------------*/ -#define SLIP_END 0300 -#undef putchar -/*---------------------------------------------------------------------------*/ -int -putchar(int c) -{ - static char debug_frame = 0; - - if(!debug_frame) { /* Start of debug output */ - slip_arch_writeb(SLIP_END); - slip_arch_writeb('\r'); /* Type debug line == '\r' */ - debug_frame = 1; - } - - /* Need to also print '\n' because for example COOJA will not show - any output before line end */ - slip_arch_writeb((char)c); - - /* - * Line buffered output, a newline marks the end of debug output and - * implicitly flushes debug output. - */ - if(c == '\n') { - slip_arch_writeb(SLIP_END); - debug_frame = 0; - } - return c; -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/slip-radio/slip-net.c b/examples/slip-radio/slip-net.c deleted file mode 100644 index edf219106..000000000 --- a/examples/slip-radio/slip-net.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "net/netstack.h" -#include "net/ipv6/uip.h" -#include "net/packetbuf.h" -#include "dev/slip.h" -#include "os/sys/log.h" - -#include - -#define LOG_MODULE "slip-net" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -#define SLIP_END 0300 -#define SLIP_ESC 0333 -#define SLIP_ESC_END 0334 -#define SLIP_ESC_ESC 0335 -/*---------------------------------------------------------------------------*/ -static void -slipnet_init(void) -{ -} -/*---------------------------------------------------------------------------*/ -static void -slipnet_input(void) -{ - int i; - /* radio should be configured for filtering so this should be simple */ - /* this should be sent over SLIP! */ - /* so just copy into uip-but and send!!! */ - /* Format: !R ? */ - uip_len = packetbuf_datalen(); - i = packetbuf_copyto(uip_buf); - - LOG_DBG("Slipnet got input of len: %d, copied: %d\n", - packetbuf_datalen(), i); - - for(i = 0; i < uip_len; i++) { - LOG_DBG_("%02x", (unsigned char)uip_buf[i]); - if((i & 15) == 15) { - LOG_DBG_("\n"); - } else if((i & 7) == 7) { - LOG_DBG_(" "); - } - } - LOG_DBG_("\n"); - - slip_write(uip_buf, uip_len); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -slipnet_output(const linkaddr_t *localdest) -{ - /* do nothing... */ - return 1; -} -/*---------------------------------------------------------------------------*/ -const struct network_driver slipnet_driver = { - "slipnet", - slipnet_init, - slipnet_input, - /* output is likely never called - or at least not used as no IP packets - should be produced in slip-radio */ - slipnet_output -}; -/*---------------------------------------------------------------------------*/ diff --git a/examples/slip-radio/slip-radio.c b/examples/slip-radio/slip-radio.c deleted file mode 100644 index 8ef22ff55..000000000 --- a/examples/slip-radio/slip-radio.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Slip-radio driver - * \author - * Niclas Finne - * Joakim Eriksson - */ -#include "contiki.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "dev/slip.h" -#include -#include "net/netstack.h" -#include "net/packetbuf.h" - -#include "cmd.h" -#include "slip-radio.h" -#include "packetutils.h" -#include "os/sys/log.h" - -#include - -#define LOG_MODULE "slip-radio" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -#ifdef SLIP_RADIO_CONF_SENSORS -extern const struct slip_radio_sensors SLIP_RADIO_CONF_SENSORS; -#endif - -/* max 16 packets at the same time??? */ -uint8_t packet_ids[16]; -int packet_pos; - -static int slip_radio_cmd_handler(const uint8_t *data, int len); - -int cmd_handler_cc2420(const uint8_t *data, int len); -/*---------------------------------------------------------------------------*/ -#ifdef CMD_CONF_HANDLERS -CMD_HANDLERS(CMD_CONF_HANDLERS); -#else -CMD_HANDLERS(slip_radio_cmd_handler); -#endif - -static const uint16_t mac_src_pan_id = IEEE802154_PANID; -/*---------------------------------------------------------------------------*/ -static int -is_broadcast_addr(uint8_t mode, uint8_t *addr) -{ - int i = mode == FRAME802154_SHORTADDRMODE ? 2 : 8; - while(i-- > 0) { - if(addr[i] != 0xff) { - return 0; - } - } - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -parse_frame(void) -{ - frame802154_t frame; - int len; - len = packetbuf_datalen(); - if(frame802154_parse(packetbuf_dataptr(), len, &frame)) { - if(frame.fcf.dest_addr_mode) { - if(frame.dest_pid != mac_src_pan_id && - frame.dest_pid != FRAME802154_BROADCASTPANDID) { - /* Packet to another PAN */ - return 0; - } - if(!is_broadcast_addr(frame.fcf.dest_addr_mode, frame.dest_addr)) { - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (linkaddr_t *)&frame.dest_addr); - } - } - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr); - packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq); - - return 0; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -packet_sent(void *ptr, int status, int transmissions) -{ - uint8_t buf[20]; - uint8_t sid; - int pos; - sid = *((uint8_t *)ptr); - LOG_DBG("Slip-radio: packet sent! sid: %d, status: %d, tx: %d\n", - sid, status, transmissions); - /* packet callback from lower layers */ - /* neighbor_info_packet_sent(status, transmissions); */ - pos = 0; - buf[pos++] = '!'; - buf[pos++] = 'R'; - buf[pos++] = sid; - buf[pos++] = status; /* one byte ? */ - buf[pos++] = transmissions; - cmd_send(buf, pos); -} -/*---------------------------------------------------------------------------*/ -static int -slip_radio_cmd_handler(const uint8_t *data, int len) -{ - int i; - if(data[0] == '!') { - /* should send out stuff to the radio - ignore it as IP */ - /* --- s e n d --- */ - if(data[1] == 'S') { - int pos; - packet_ids[packet_pos] = data[2]; - - packetbuf_clear(); - pos = packetutils_deserialize_atts(&data[3], len - 3); - if(pos < 0) { - LOG_ERR("illegal packet attributes\n"); - return 1; - } - pos += 3; - len -= pos; - if(len > PACKETBUF_SIZE) { - len = PACKETBUF_SIZE; - } - memcpy(packetbuf_dataptr(), &data[pos], len); - packetbuf_set_datalen(len); - - LOG_DBG("sending %u (%d bytes)\n", - data[2], packetbuf_datalen()); - - /* parse frame before sending to get addresses, etc. */ - parse_frame(); - NETSTACK_MAC.send(packet_sent, &packet_ids[packet_pos]); - - packet_pos++; - if(packet_pos >= sizeof(packet_ids)) { - packet_pos = 0; - } - - return 1; - } else if(data[1] == 'V') { - int type = ((uint16_t)data[2] << 8) | data[3]; - int value = ((uint16_t)data[4] << 8) | data[5]; - int param = type; /* packetutils_to_radio_param(type); */ - if(param < 0) { - printf("radio: unknown parameter %d (can not set to %d)\n", type, value); - } else { - if(param == RADIO_PARAM_RX_MODE) { - printf("radio: setting rxmode to 0x%x\n", value); - } else if(param == RADIO_PARAM_PAN_ID) { - printf("radio: setting pan id to 0x%04x\n", value); - } else if(param == RADIO_PARAM_CHANNEL) { - printf("radio: setting channel: %u\n", value); - } else { - printf("radio: setting param %d to %d (0x%02x)\n", param, value, value); - } - NETSTACK_RADIO.set_value(param, value); - } - return 1; - } - } else if(data[0] == '?') { - LOG_DBG("Got request message of type %c\n", data[1]); - if(data[1] == 'M') { - /* this is just a test so far... just to see if it works */ - uip_buf[0] = '!'; - uip_buf[1] = 'M'; - for(i = 0; i < UIP_LLADDR_LEN; i++) { - uip_buf[2 + i] = uip_lladdr.addr[i]; - } - uip_len = 10; - cmd_send(uip_buf, uip_len); - return 1; - } else if(data[1] == 'V') { - /* ask the radio about the specific parameter and send it back... */ - int type = ((uint16_t)data[2] << 8) | data[3]; - int value; - int param = type; /* packetutils_to_radio_param(type); */ - if(param < 0) { - printf("radio: unknown parameter %d\n", type); - } - - NETSTACK_RADIO.get_value(param, &value); - - uip_buf[0] = '!'; - uip_buf[1] = 'V'; - uip_buf[2] = type >> 8; - uip_buf[3] = type & 0xff; - uip_buf[4] = value >> 8; - uip_buf[5] = value & 0xff; - uip_len = 6; - cmd_send(uip_buf, uip_len); - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -slip_input_callback(void) -{ - LOG_DBG("SR-SIN: %u '%c%c'\n", uip_len, uip_buf[0], uip_buf[1]); - if(!cmd_input(uip_buf, uip_len)) { - cmd_send((uint8_t *)"EUnknown command", 16); - } - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - slip_arch_init(); - process_start(&slip_process, NULL); - slip_set_input_callback(slip_input_callback); - packet_pos = 0; -} -/*---------------------------------------------------------------------------*/ -PROCESS(slip_radio_process, "Slip radio process"); -AUTOSTART_PROCESSES(&slip_radio_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(slip_radio_process, ev, data) -{ - static struct etimer et; - PROCESS_BEGIN(); - - init(); -#ifdef SLIP_RADIO_CONF_SENSORS - SLIP_RADIO_CONF_SENSORS.init(); -#endif - LOG_INFO("Slip Radio started\n"); - - etimer_set(&et, CLOCK_SECOND * 3); - - while(1) { - PROCESS_YIELD(); - - if(etimer_expired(&et)) { - etimer_reset(&et); -#ifdef SLIP_RADIO_CONF_SENSORS - SLIP_RADIO_CONF_SENSORS.send(); -#endif - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/slip-radio/slip-radio.h b/examples/slip-radio/slip-radio.h deleted file mode 100644 index 18f55a077..000000000 --- a/examples/slip-radio/slip-radio.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 SLIP_RADIO_H_ -#define SLIP_RADIO_H_ - -struct slip_radio_sensors { - /** Initialize the driver */ - void (*init)(void); - /** Send the sensor data packet via the command send */ - void (*send)(void); -}; - -#endif /* SLIP_RADIO_H_ */ diff --git a/examples/storage/antelope-shell/Makefile b/examples/storage/antelope-shell/Makefile deleted file mode 100644 index 5eff3dcd3..000000000 --- a/examples/storage/antelope-shell/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -CONTIKI = ../../.. - -MODULES += os/storage/antelope os/services/unit-test - -# does not fit on Sky -PLATFORMS_ONLY= cc2538dk zoul - -CONTIKI_PROJECT = shell-db -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/storage/antelope-shell/shell-db.c b/examples/storage/antelope-shell/shell-db.c deleted file mode 100644 index 72583c90a..000000000 --- a/examples/storage/antelope-shell/shell-db.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A small command-line interface for the database system. - * \author - * Nicolas Tsiftes - */ - -#include - -#include "contiki.h" -#include "dev/serial-line.h" - -#include "antelope.h" - -PROCESS(db_shell, "DB shell"); -AUTOSTART_PROCESSES(&db_shell); - -PROCESS_THREAD(db_shell, ev, data) -{ - static db_handle_t handle; - db_result_t result; - static tuple_id_t matching; - static tuple_id_t processed; - - PROCESS_BEGIN(); - - db_init(); - - for(;;) { - PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message && data != NULL); - - result = db_query(&handle, data); - if(DB_ERROR(result)) { - printf("Query \"%s\" failed: %s\n", - (char *)data, db_get_result_message(result)); - db_free(&handle); - continue; - } - - if(!db_processing(&handle)) { - printf("OK\n"); - continue; - } - - db_print_header(&handle); - - matching = 0; - processed = 0; - - while(db_processing(&handle)) { - PROCESS_PAUSE(); - result = db_process(&handle); - switch(result) { - case DB_GOT_ROW: - /* The processed tuple matched the condition in the query. */ - matching++; - processed++; - db_print_tuple(&handle); - break; - case DB_OK: - /* A tuple was processed, but did not match the condition. */ - processed++; - continue; - case DB_FINISHED: - /* The processing has finished. Wait for a new command. */ - printf("[%ld tuples returned; %ld tuples processed]\n", - (long)matching, (long)processed); - printf("OK\n"); - default: - if(DB_ERROR(result)) { - printf("Processing error: %s\n", db_get_result_message(result)); - } - db_free(&handle); - break; - } - } - } - - PROCESS_END(); -} diff --git a/examples/storage/cfs-coffee/Makefile b/examples/storage/cfs-coffee/Makefile deleted file mode 100644 index b6d22f5ac..000000000 --- a/examples/storage/cfs-coffee/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -CONTIKI = ../../.. - -PLATFORMS_ONLY= cc2538dk zoul sky - -MODULES += os/services/unit-test -MODULES += os/storage/cfs - -CONTIKI_PROJECT = test-cfs test-coffee example-coffee -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/storage/cfs-coffee/README.md b/examples/storage/cfs-coffee/README.md deleted file mode 100644 index 640124d56..000000000 --- a/examples/storage/cfs-coffee/README.md +++ /dev/null @@ -1,32 +0,0 @@ -Contiki File System (CFS) and Coffee Examples -============================================= - -Coffee is a very simple, relatively small and easy to use file system that you -are most likely going to be very familiar with if you have done any C file -access in the past. The notion is the same as on a normal PC: you open a file, -read and write to it and close it. Contiki will take care of the underlying -flash memory, giving you more time to focus on the real issues. - -Coffee is a full implementation of the CFS API. - -An extended explanation on CFS and Coffee internals and how they work can be -found at the [CFS](https://github.com/contiki-os/contiki/wiki/File-systems) and -[Coffee](https://github.com/contiki-os/contiki/wiki/Coffee-filesystem-example) -wiki pages. - -Supported Hardware (tested or known to work) --------------------------------------------- -* sky -* z1 -* wismote -* avr-raven -* cc2538dk -* openmote-cc2538 -* zoul -* TI cc26x0-cc13x0 - - sensortag - - launchpad - -The examples are known to build for the 'avr-raven' platform. However, -some of them currently fail at runtime due to file system overflow. -Tweaking the file sizes in the examples is necessary. diff --git a/examples/storage/cfs-coffee/example-coffee.c b/examples/storage/cfs-coffee/example-coffee.c deleted file mode 100644 index 7adc8d62c..000000000 --- a/examples/storage/cfs-coffee/example-coffee.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ -/*---------------------------------------------------------------------------*/ -/** - * \file - * Example on how to use CFS/Coffee. - * \author - * Nicolas Tsiftes - */ -/*---------------------------------------------------------------------------*/ -#include -#include -#include "contiki.h" -#include "cfs/cfs.h" -#include "cfs/cfs-coffee.h" -/*---------------------------------------------------------------------------*/ -PROCESS(example_coffee_process, "Coffee example"); -AUTOSTART_PROCESSES(&example_coffee_process); -/*---------------------------------------------------------------------------*/ -#define FILENAME "test" - -/* Formatting is needed if the storage device is in an unknown state; - e.g., when using Coffee on the storage device for the first time. */ -#ifndef NEED_FORMATTING -#define NEED_FORMATTING 0 -#endif -/*---------------------------------------------------------------------------*/ -static int -file_test(const char *filename, char *msg) -{ - static uint8_t sequence; - int fd; - int r; - struct record { - char message[16]; - uint8_t sequence; - } record; - - /* - * Coffee determines the file length by finding the last non-zero byte - * of the file. This I/O semantic requires that each record should end - * with a non-zero, if we are writing multiple records and closing the - * file descriptor in between. - * - * In this example, in which the file_test function can be called - * multiple times, we ensure that the sequence counter starts at 1. - */ - - if(sequence == 255) { - /* No more sequence numbers available. */ - return -1; - } - sequence++; - - strncpy(record.message, msg, sizeof(record.message) - 1); - record.message[sizeof(record.message) - 1] = '\0'; - record.sequence = sequence; - - /* Obtain a file descriptor for the file, capable of handling both - reads and writes. */ - fd = cfs_open(FILENAME, CFS_WRITE | CFS_APPEND | CFS_READ); - if(fd < 0) { - printf("failed to open %s\n", FILENAME); - return 0; - } - - r = cfs_write(fd, &record, sizeof(record)); - if(r != sizeof(record)) { - printf("failed to write %d bytes to %s\n", - (int)sizeof(record), FILENAME); - cfs_close(fd); - return 0; - } - - printf("Wrote message \"%s\", sequence %u\n", - record.message, record.sequence); - - /* To read back the message, we need to move the file pointer to the - beginning of the file. */ - if(cfs_seek(fd, 0, CFS_SEEK_SET) != 0) { - printf("seek failed\n"); - cfs_close(fd); - return 0; - } - - /* Read all written records and print their contents. */ - for(;;) { - r = cfs_read(fd, &record, sizeof(record)); - if(r == 0) { - break; - } else if(r < sizeof(record)) { - printf("failed to read %d bytes from %s, got %d\n", - (int)sizeof(record), FILENAME, r); - cfs_close(fd); - return 0; - } - - printf("Read message \"%s\", sequence %u\n", - record.message, record.sequence); - } - - /* Release the internal resources held by Coffee for - the file descriptor. */ - cfs_close(fd); - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -dir_test(void) -{ - struct cfs_dir dir; - struct cfs_dirent dirent; - - /* Coffee provides a root directory only. */ - if(cfs_opendir(&dir, "/") != 0) { - printf("failed to open the root directory\n"); - return 0; - } - - /* List all files and their file sizes. */ - printf("Available files\n"); - while(cfs_readdir(&dir, &dirent) == 0) { - printf("%s (%lu bytes)\n", dirent.name, (unsigned long)dirent.size); - } - - cfs_closedir(&dir); - - return 1; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(example_coffee_process, ev, data) -{ - PROCESS_BEGIN(); - -#if NEED_FORMATTING - cfs_coffee_format(); -#endif - - /* Ensure that we will be working with a new file. */ - cfs_remove(FILENAME); - - if(file_test(FILENAME, "The first test") == 0) { - printf("file test 1 failed\n"); - } - if(file_test(FILENAME, "The second test") == 0) { - printf("file test 2 failed\n"); - } - if(dir_test() == 0) { - printf("dir test failed\n"); - } - - PROCESS_END(); -} diff --git a/examples/storage/cfs-coffee/project-conf.h b/examples/storage/cfs-coffee/project-conf.h deleted file mode 100644 index 4dd98edcb..000000000 --- a/examples/storage/cfs-coffee/project-conf.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -#if CONTIKI_TARGET_CC2538DK || CONTIKI_TARGET_OPENMOTE_CC2538 || \ - CONTIKI_TARGET_ZOUL -#define COFFEE_CONF_SIZE (CC2538_DEV_FLASH_SIZE / 2) -#define COFFEE_CONF_MICRO_LOGS 1 -#define COFFEE_CONF_APPEND_ONLY 0 -#endif /* CONTIKI_TARGET_CC2538DK || CONTIKI_TARGET_ZOUL */ - -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/examples/storage/cfs-coffee/test-cfs.c b/examples/storage/cfs-coffee/test-cfs.c deleted file mode 100644 index 2d44b6696..000000000 --- a/examples/storage/cfs-coffee/test-cfs.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \file - * A quick program for testing the CFS xmem driver - * \author - * Adam Dunkels - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cfs/cfs.h" -#include -/*---------------------------------------------------------------------------*/ -PROCESS(cfs_process, "Test CFS process"); -AUTOSTART_PROCESSES(&cfs_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cfs_process, ev, data) -{ - PROCESS_BEGIN(); - - { - int i, j, fd; - int errors = 0; - uint16_t filesize = 65000; -#define CHUNKSIZE 128 - - cfs_remove("hej"); - fd = cfs_open("hej", CFS_WRITE); - if(fd < 0) { - printf("could not open file for writing, aborting\n"); - errors++; - } else { - unsigned char buf[CHUNKSIZE]; - for(i = 0; i < filesize; i += CHUNKSIZE) { - for(j = 0; j < CHUNKSIZE; ++j) { - buf[j] = i + j; - } - if(cfs_write(fd, buf, CHUNKSIZE) < CHUNKSIZE) { - printf("failed to write at offset %d, aborting\n", i); - errors++; - break; - } - } - cfs_close(fd); - } - - fd = cfs_open("hej", CFS_READ); - if(fd < 0) { - printf("could not open file for reading, aborting\n"); - errors++; - } else { - for(i = 0; i < filesize; ++i) { - unsigned char buf; - if(cfs_read(fd, &buf, 1) < 1) { - printf("failed to read at offset %d, aborting\n", i); - errors++; - break; - } - if(buf != (i & 0xff)) { - errors++; - printf("error: diff at %d, %d != %d\n", i, i & 0xff, buf); - } - } - } - printf("CFS test 1 completed with %d errors\n", errors); - cfs_remove("hej"); - errors = 0; - - fd = cfs_open("hej", CFS_WRITE); - if(fd < 0) { - printf("could not open file for writing, aborting\n"); - } else { - unsigned char buf[CHUNKSIZE]; - for(i = 0; i < filesize; i += CHUNKSIZE) { - for(j = 0; j < CHUNKSIZE; ++j) { - buf[j] = i + j + 1; - } - if(cfs_write(fd, buf, CHUNKSIZE) < CHUNKSIZE) { - printf("failed to write at offset %d, aborting\n", i); - errors++; - break; - } - } - cfs_close(fd); - } - - fd = cfs_open("hej", CFS_READ); - if(fd < 0) { - printf("could not open file for reading, aborting\n"); - } else { - for(i = 0; i < filesize; ++i) { - unsigned char buf; - if(cfs_read(fd, &buf, 1) < 1) { - printf("failed to read at offset %d, aborting\n", i); - errors++; - break; - } - if(buf != ((i + 1) & 0xff)) { - errors++; - printf("error: diff at %d, %d != %d\n", i, (i + 1) & 0xff, buf); - } - } - } - printf("CFS test 2 completed with %d errors\n", errors); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/storage/cfs-coffee/test-coffee.c b/examples/storage/cfs-coffee/test-coffee.c deleted file mode 100644 index 3fcc40cfd..000000000 --- a/examples/storage/cfs-coffee/test-coffee.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \file - * Basic test for CFS/Coffee. - * \author - * Nicolas Tsiftes - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cfs/cfs.h" -#include "cfs/cfs-coffee.h" -#include "lib/crc16.h" -#include "lib/random.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -PROCESS(testcoffee_process, "Test CFS/Coffee process"); -AUTOSTART_PROCESSES(&testcoffee_process); -/*---------------------------------------------------------------------------*/ -#define TEST_FAIL(x) error = (x); goto end; -#define FILE_SIZE 4096 -/*---------------------------------------------------------------------------*/ -static int -coffee_test_basic(void) -{ - int error; - int wfd, rfd, afd; - unsigned char buf[256]; - int r; - - wfd = rfd = afd = -1; - - for(r = 0; r < sizeof(buf); r++) { - buf[r] = r; - } - - /* Test 1: Open for writing. */ - wfd = cfs_open("T1", CFS_WRITE); - if(wfd < 0) { - TEST_FAIL(1); - } - - /* Test 2 and 3: Write buffer. */ - r = cfs_write(wfd, buf, sizeof(buf)); - if(r < 0) { - TEST_FAIL(2); - } else if(r < sizeof(buf)) { - TEST_FAIL(3); - } - - /* Test 4: Deny reading. */ - r = cfs_read(wfd, buf, sizeof(buf)); - if(r >= 0) { - TEST_FAIL(4); - } - - /* Test 5: Open for reading. */ - rfd = cfs_open("T1", CFS_READ); - if(rfd < 0) { - TEST_FAIL(5); - } - - /* Test 6: Write to read-only file. */ - r = cfs_write(rfd, buf, sizeof(buf)); - if(r >= 0) { - TEST_FAIL(6); - } - - /* Test 7 and 8: Read the buffer written in Test 2. */ - memset(buf, 0, sizeof(buf)); - r = cfs_read(rfd, buf, sizeof(buf)); - if(r < 0) { - TEST_FAIL(7); - } else if(r < sizeof(buf)) { - printf("r=%d\n", r); - TEST_FAIL(8); - } - - /* Test 9: Verify that the buffer is correct. */ - for(r = 0; r < sizeof(buf); r++) { - if(buf[r] != r) { - printf("r=%d. buf[r]=%d\n", r, buf[r]); - TEST_FAIL(9); - } - } - - /* Test 10: Seek to beginning. */ - if(cfs_seek(wfd, 0, CFS_SEEK_SET) != 0) { - TEST_FAIL(10); - } - - /* Test 11 and 12: Write to the log. */ - r = cfs_write(wfd, buf, sizeof(buf)); - if(r < 0) { - TEST_FAIL(11); - } else if(r < sizeof(buf)) { - TEST_FAIL(12); - } - - /* Test 13 and 14: Read the data from the log. */ - cfs_seek(rfd, 0, CFS_SEEK_SET); - memset(buf, 0, sizeof(buf)); - r = cfs_read(rfd, buf, sizeof(buf)); - if(r < 0) { - TEST_FAIL(13); - } else if(r < sizeof(buf)) { - TEST_FAIL(14); - } - - /* Test 16: Verify that the data is correct. */ - for(r = 0; r < sizeof(buf); r++) { - if(buf[r] != r) { - TEST_FAIL(15); - } - } - - /* Test 17 to 20: Write a reversed buffer to the file. */ - for(r = 0; r < sizeof(buf); r++) { - buf[r] = sizeof(buf) - r - 1; - } - if(cfs_seek(wfd, 0, CFS_SEEK_SET) != 0) { - TEST_FAIL(16); - } - r = cfs_write(wfd, buf, sizeof(buf)); - if(r < 0) { - TEST_FAIL(17); - } else if(r < sizeof(buf)) { - TEST_FAIL(18); - } - if(cfs_seek(rfd, 0, CFS_SEEK_SET) != 0) { - TEST_FAIL(19); - } - - /* Test 21 and 22: Read the reversed buffer. */ - cfs_seek(rfd, 0, CFS_SEEK_SET); - memset(buf, 0, sizeof(buf)); - r = cfs_read(rfd, buf, sizeof(buf)); - if(r < 0) { - TEST_FAIL(20); - } else if(r < sizeof(buf)) { - printf("r = %d\n", r); - TEST_FAIL(21); - } - - /* Test 23: Verify that the data is correct. */ - for(r = 0; r < sizeof(buf); r++) { - if(buf[r] != sizeof(buf) - r - 1) { - TEST_FAIL(22); - } - } - - error = 0; -end: - cfs_close(wfd); - cfs_close(rfd); - cfs_remove("T1"); - return error; -} -/*---------------------------------------------------------------------------*/ -static int -coffee_test_append(void) -{ - int error; - int afd; - unsigned char buf[256], buf2[11]; - int r, i, j, total_read; -#define APPEND_BYTES 1000 -#define BULK_SIZE 10 - - /* Test 1 and 2: Append data to the same file many times. */ - for(i = 0; i < APPEND_BYTES; i += BULK_SIZE) { - afd = cfs_open("T2", CFS_WRITE | CFS_APPEND); - if(afd < 0) { - TEST_FAIL(1); - } - for(j = 0; j < BULK_SIZE; j++) { - buf[j] = 1 + ((i + j) & 0x7f); - } - if((r = cfs_write(afd, buf, BULK_SIZE)) != BULK_SIZE) { - printf("r=%d\n", r); - TEST_FAIL(2); - } - cfs_close(afd); - } - - /* Test 3-6: Read back the data written previously and verify that it - is correct. */ - afd = cfs_open("T2", CFS_READ); - if(afd < 0) { - TEST_FAIL(3); - } - total_read = 0; - while((r = cfs_read(afd, buf2, sizeof(buf2))) > 0) { - for(j = 0; j < r; j++) { - if(buf2[j] != 1 + ((total_read + j) & 0x7f)) { - TEST_FAIL(4); - } - } - total_read += r; - } - if(r < 0) { - TEST_FAIL(5); - } - if(total_read != APPEND_BYTES) { - TEST_FAIL(6); - } - cfs_close(afd); - - error = 0; -end: - cfs_close(afd); - cfs_remove("T2"); - return error; -} -/*---------------------------------------------------------------------------*/ -static int -coffee_test_modify(void) -{ - int error; - int wfd; - unsigned char buf[256]; - int r, i; - unsigned offset; - - wfd = -1; - - if(cfs_coffee_reserve("T3", FILE_SIZE) < 0) { - TEST_FAIL(1); - } - - if(cfs_coffee_configure_log("T3", FILE_SIZE / 2, 11) < 0) { - TEST_FAIL(2); - } - - /* Test 16: Test multiple writes at random offset. */ - for(r = 0; r < 100; r++) { - wfd = cfs_open("T3", CFS_WRITE | CFS_READ); - if(wfd < 0) { - TEST_FAIL(3); - } - - offset = random_rand() % FILE_SIZE; - - for(i = 0; i < sizeof(buf); i++) { - buf[i] = i; - } - - if(cfs_seek(wfd, offset, CFS_SEEK_SET) != offset) { - TEST_FAIL(4); - } - - if(cfs_write(wfd, buf, sizeof(buf)) != sizeof(buf)) { - TEST_FAIL(5); - } - - if(cfs_seek(wfd, offset, CFS_SEEK_SET) != offset) { - TEST_FAIL(6); - } - - memset(buf, 0, sizeof(buf)); - if(cfs_read(wfd, buf, sizeof(buf)) != sizeof(buf)) { - TEST_FAIL(7); - } - - for(i = 0; i < sizeof(buf); i++) { - if(buf[i] != i) { - printf("buf[%d] != %d\n", i, buf[i]); - TEST_FAIL(8); - } - } - - cfs_close(wfd); - } - - error = 0; -end: - cfs_close(wfd); - cfs_remove("T3"); - return error; -} -/*---------------------------------------------------------------------------*/ -static int -coffee_test_gc(void) -{ - int i; - - for (i = 0; i < 100; i++) { - if (i & 1) { - if(cfs_coffee_reserve("beta", random_rand() & 0xffff) < 0) { - return i; - } - cfs_remove("alpha"); - } else { - if(cfs_coffee_reserve("alpha", 93171) < 0) { - return i; - } - cfs_remove("beta"); - } - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -print_result(const char *test_name, int result) -{ - printf("%s: ", test_name); - if(result == 0) { - printf("OK\n"); - } else { - printf("ERROR (test %d)\n", result); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(testcoffee_process, ev, data) -{ - int start; - int result; - - PROCESS_BEGIN(); - - start = clock_seconds(); - - printf("Coffee test started\n"); - - result = cfs_coffee_format(); - print_result("Formatting", result); - - result = coffee_test_basic(); - print_result("Basic operations", result); - - result = coffee_test_append(); - print_result("File append", result); - - result = coffee_test_modify(); - print_result("File modification", result); - - result = coffee_test_gc(); - print_result("Garbage collection", result); - - printf("Coffee test finished. Duration: %d seconds\n", - (int)(clock_seconds() - start)); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/storage/eeprom-test/Makefile b/examples/storage/eeprom-test/Makefile deleted file mode 100644 index 343a62165..000000000 --- a/examples/storage/eeprom-test/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -CONTIKI_PROJECT = eeprom-test -CONTIKI = ../../.. -all: $(CONTIKI_PROJECT) - -include $(CONTIKI)/Makefile.include diff --git a/examples/storage/eeprom-test/eeprom-test.c b/examples/storage/eeprom-test/eeprom-test.c deleted file mode 100644 index b5883eff5..000000000 --- a/examples/storage/eeprom-test/eeprom-test.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2013, Robert Quattlebaum - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A very simple Contiki application showing how to read and write - * data using Contiki's EEPROM API. - * \author - * Robert Quattlebaum - */ - -#include "contiki.h" -#include "dev/eeprom.h" - -#include /* For printf() */ - -void -print_content() -{ - eeprom_addr_t addr_row = 0, j; - uint8_t i; - uint8_t byte; - - printf("\t"); - for(i = 0; i < 16; i++) - printf("0x%x\t", i); - printf - ("\n-----------------------------------------------------------------------------------------------------------------------------------------\n"); - - for(addr_row = 0; addr_row < EEPROM_SIZE / 16; ++addr_row) { - printf("0x%x\t|", addr_row * 16); - - for(j = 0; j < 16; j++) { - eeprom_read(addr_row * 16 + j, &byte, 1); - printf("0x%x\t", byte); - } - printf("\n"); - } -} - -void -erase_content() -{ - static eeprom_addr_t addr = 0; - - for(addr = 0; addr < EEPROM_SIZE; ++addr) { - eeprom_write(addr, 0, 1); - } -} - -/*---------------------------------------------------------------------------*/ -PROCESS(eeprom_test_process, "EEPROM Test Process"); -AUTOSTART_PROCESSES(&eeprom_test_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(eeprom_test_process, ev, data) -{ - static uint8_t counter = 0, error = 0; - static eeprom_addr_t addr = 0; - uint8_t byte; - - uint8_t buffer[] = - { 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0xBB, 0xCC, 0xCC, 0xCC, 0xBB, - 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xFF, 0xAA, 0xAA, 0xAA, 0xBB, - 0xBB, 0xBB, 0xCC, 0xCC, 0xCC, 0xBB, 0xBB, 0xBB, 0xAA, 0xAA, - 0xAA, 0xFF, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0xBB, 0xCC, 0xCC, - 0xCC, 0xBB, 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xFF - }; - - PROCESS_BEGIN(); - - printf("eeprom-test: Size = %d bytes\n", EEPROM_SIZE); - - print_content(); - - printf("\nErase EEPROM content\n"); - erase_content(); - - print_content(); - - counter = 0; - for(addr = 0; addr < EEPROM_SIZE; ++addr) { - eeprom_write(addr, &counter, 1); - counter += 1; - } - - counter = 0; - for(addr = 0; addr < EEPROM_SIZE; ++addr) { - byte = 0; - eeprom_read(addr, &byte, 1); - if(byte != counter) { - error++; - eeprom_read(addr, &byte, 1); - printf - ("eeprom-test: EEPROM write failure! 0x%x =/= 0x%x at address 0x%x\n", - byte, counter, addr); - break; - } - counter += 1; - } - - if(error) - printf("eeprom-test: EEPROM write test FAIL!\n%d errors", error); - else - printf("eeprom-test: EEPROM write test success!\n"); - - - print_content(); - - printf("Fill memory with buffer\n"); - - for(addr = 0; addr < EEPROM_SIZE; addr += sizeof(buffer)) { - eeprom_write(addr, ((unsigned char *)buffer), sizeof(buffer)); - } -/* - printf("Write data buffer %d at address 0x0\n", sizeof(buffer)); - eeprom_write(0x0, ((unsigned char *)buffer), sizeof(buffer)); - - printf("Write data buffer %d at address 0x40\n", sizeof(buffer)); - eeprom_write(0x40, ((unsigned char *)buffer), sizeof(buffer)); - - printf("Write data buffer %d at address 0x95\n", sizeof(buffer)); - eeprom_write(0x95, ((unsigned char *)buffer), sizeof(buffer)); -*/ - print_content(); - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/websocket/Makefile b/examples/websocket/Makefile deleted file mode 100644 index d0b38d95d..000000000 --- a/examples/websocket/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CONTIKI_PROJECT = http-example websocket-example -all: $(CONTIKI_PROJECT) -CONTIKI=../.. -MODULES += os/net/app-layer/http-socket - -PLATFORMS_EXCLUDE = sky z1 - -include $(CONTIKI)/Makefile.include diff --git a/examples/websocket/http-example.c b/examples/websocket/http-example.c deleted file mode 100644 index 2891bff88..000000000 --- a/examples/websocket/http-example.c +++ /dev/null @@ -1,62 +0,0 @@ -#include "contiki-net.h" -#include "http-socket.h" -#include "ipv6/ip64-addr.h" - -#include - -static struct http_socket s; -static int bytes_received = 0; - -/*---------------------------------------------------------------------------*/ -PROCESS(http_example_process, "HTTP Example"); -AUTOSTART_PROCESSES(&http_example_process); -/*---------------------------------------------------------------------------*/ -static void -callback(struct http_socket *s, void *ptr, - http_socket_event_t e, - const uint8_t *data, uint16_t datalen) -{ - if(e == HTTP_SOCKET_ERR) { - printf("HTTP socket error\n"); - } else if(e == HTTP_SOCKET_TIMEDOUT) { - printf("HTTP socket error: timed out\n"); - } else if(e == HTTP_SOCKET_ABORTED) { - printf("HTTP socket error: aborted\n"); - } else if(e == HTTP_SOCKET_HOSTNAME_NOT_FOUND) { - printf("HTTP socket error: hostname not found\n"); - } else if(e == HTTP_SOCKET_CLOSED) { - printf("HTTP socket closed, %d bytes received\n", bytes_received); - } else if(e == HTTP_SOCKET_DATA) { - bytes_received += datalen; - printf("HTTP socket received %d bytes of data\n", datalen); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(http_example_process, ev, data) -{ - static struct etimer et; - uip_ip4addr_t ip4addr; - uip_ip6addr_t ip6addr; - - PROCESS_BEGIN(); - - uip_ipaddr(&ip4addr, 8,8,8,8); - ip64_addr_4to6(&ip4addr, &ip6addr); - uip_nameserver_update(&ip6addr, UIP_NAMESERVER_INFINITE_LIFETIME); - - etimer_set(&et, CLOCK_SECOND * 60); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - http_socket_init(&s); - http_socket_get(&s, "http://www.contiki-os.org/", 0, 0, - callback, NULL); - - etimer_set(&et, CLOCK_SECOND); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/websocket/project-conf.h b/examples/websocket/project-conf.h deleted file mode 100644 index 38f34be86..000000000 --- a/examples/websocket/project-conf.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -#define UIP_CONF_TCP 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ diff --git a/examples/websocket/websocket-example.c b/examples/websocket/websocket-example.c deleted file mode 100644 index 010712b06..000000000 --- a/examples/websocket/websocket-example.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 "contiki.h" - -#include "websocket.h" - -#include - -static struct websocket s; - -static void callback(struct websocket *s, websocket_result_t r, - const uint8_t *data, uint16_t datalen); - -#define RECONNECT_INTERVAL 10 * CLOCK_SECOND -static struct ctimer reconnect_timer; - -/*---------------------------------------------------------------------------*/ -PROCESS(websocket_example_process, "Websocket Example"); -AUTOSTART_PROCESSES(&websocket_example_process); -/*---------------------------------------------------------------------------*/ -static void -reconnect_callback(void *ptr) -{ - websocket_open(&s, "ws://172.16.0.1:8080/", - "contiki", NULL, callback); -} -/*---------------------------------------------------------------------------*/ -static void -callback(struct websocket *s, websocket_result_t r, - const uint8_t *data, uint16_t datalen) -{ - if(r == WEBSOCKET_CLOSED || - r == WEBSOCKET_RESET || - r == WEBSOCKET_HOSTNAME_NOT_FOUND || - r == WEBSOCKET_TIMEDOUT) { - ctimer_set(&reconnect_timer, RECONNECT_INTERVAL, reconnect_callback, s); - } else if(r == WEBSOCKET_CONNECTED) { - websocket_send_str(s, "Connected"); - } else if(r == WEBSOCKET_DATA) { - printf("websocket-example: Received data '%.*s' (len %d)\n", datalen, - data, datalen); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(websocket_example_process, ev, data) -{ - static struct etimer et; - PROCESS_BEGIN(); - - ctimer_set(&reconnect_timer, RECONNECT_INTERVAL, reconnect_callback, &s); - - websocket_init(&s); - while(1) { - etimer_set(&et, CLOCK_SECOND / 8); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - char buf[] = "012345678"; - static int count; - buf[0] = (count % 9) + '0'; - count++; - websocket_send_str(&s, buf); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/websocket/websocket-node/Makefile b/examples/websocket/websocket-node/Makefile deleted file mode 100644 index 9dcc1def8..000000000 --- a/examples/websocket/websocket-node/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -install: - npm install websocket - - -run: - nodejs example-server.js - -# Needed by the build all script -all: - true - -clean: - rm -rf node_modules diff --git a/examples/websocket/websocket-node/example-server.js b/examples/websocket/websocket-node/example-server.js deleted file mode 100644 index c7bac0d44..000000000 --- a/examples/websocket/websocket-node/example-server.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; - -var serverPort = 8080; - -var websocket = require('websocket').server; -var http = require('http'); - -var server = http.createServer(function(request, response) { - response.writeHead(200, {'Content-Type': 'text/plain'}); - response.write('This is a websocket server, not intended for http\n'); - response.end(); -}); - -server.listen(serverPort, function() { - console.log('Server is listening on port ' + serverPort); -}); - -var wsServer = new websocket({ - httpServer: server -}); - - -var connections = []; - -function broadcastMessage(message) { - for (var i = 0; i < connections.length; i++) { - connections[i].sendUTF(message); - } -} - -wsServer.on('request', function(request) { - /* Save the connection */ - var connection = request.accept(null, request.origin); - - /* Store the connection in the list of connections */ - var connectionIndex = connections.push(connection) - 1; - - console.log('Connection from ' + connection.remoteAddress + '.'); - - broadcastMessage('Connection from ' + connection.remoteAddress + '.'); - - connection.on('message', function(message) { - if (message.type === 'utf8') { - console.log((new Date()) + ' Message received: ' + - message.utf8Data); - broadcastMessage(message.utf8Data); - } - }); - - // user disconnected - connection.on('close', function(connection) { - console.log((new Date()) + ' Connection lost: ' + - connection.remoteAddress); - connections.splice(connectionIndex, 1); - }); - -}); diff --git a/os/contiki-default-conf.h b/os/contiki-default-conf.h deleted file mode 100644 index f8fbc9933..000000000 --- a/os/contiki-default-conf.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 CONTIKI_DEFAULT_CONF_H -#define CONTIKI_DEFAULT_CONF_H - -/*---------------------------------------------------------------------------*/ -/* Link-layer options - */ - -/* IEEE802154_CONF_PANID defines the default PAN ID for IEEE 802.15.4 networks */ -#ifndef IEEE802154_CONF_PANID -#define IEEE802154_CONF_PANID 0xabcd -#endif /* IEEE802154_CONF_PANID */ - -/* IEEE802154_CONF_DEFAULT_CHANNEL defines the default channel for IEEE 802.15.4 - * networks, for MAC layers without a channel selection or channel hopping - * mechanism. Current 802.15.4 MAC layers: - * - CSMA: uses IEEE802154_CONF_DEFAULT_CHANNEL - * - TSCH: uses its own TSCH_DEFAULT_HOPPING_SEQUENCE instead - */ -#ifndef IEEE802154_CONF_DEFAULT_CHANNEL -#define IEEE802154_CONF_DEFAULT_CHANNEL 26 -#endif /* IEEE802154_CONF_DEF_CHANNEL */ - -/* QUEUEBUF_CONF_NUM specifies the number of queue buffers. Queue - buffers are used throughout the Contiki netstack but the - configuration option can be tweaked to save memory. Performance can - suffer with a too low number of queue buffers though. */ -#ifndef QUEUEBUF_CONF_NUM -#define QUEUEBUF_CONF_NUM 8 -#endif /* QUEUEBUF_CONF_NUM */ -/*---------------------------------------------------------------------------*/ -/* uIPv6 configuration options. - * - * Many of the uIPv6 configuration options can be overriden by a - * project-specific configuration to save memory. - */ - - /* NBR_TABLE_CONF_MAX_NEIGHBORS specifies the maximum number of neighbors - that each node will be able to handle. */ -#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS -#define NBR_TABLE_CONF_MAX_NEIGHBORS 16 -#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ - -/* NETSTACK_MAX_ROUTE_ENTRIES specifies the maximum number of entries - the routing module will handle. Applies to uIP routing tables if they are - used, or to RPL non-storing mode links instead */ -#ifndef NETSTACK_MAX_ROUTE_ENTRIES -#define NETSTACK_MAX_ROUTE_ENTRIES 16 -#endif /* NETSTACK_MAX_ROUTE_ENTRIES */ - -/* UIP_CONF_BUFFER_SIZE specifies how much memory should be reserved - for the uIP packet buffer. This sets an upper bound on the largest - IP packet that can be received by the system. */ -#ifndef UIP_CONF_BUFFER_SIZE -#define UIP_CONF_BUFFER_SIZE 1280 -#endif /* UIP_CONF_BUFFER_SIZE */ - -/* UIP_CONF_ROUTER specifies if the IPv6 node should be a router or - not. By default, all Contiki nodes are routers. */ -#ifndef UIP_CONF_ROUTER -#define UIP_CONF_ROUTER 1 -#endif /* UIP_CONF_ROUTER */ - -/* UIP_CONF_IPV6_RPL tells whether the RPL routing protocol is running, - whether implemented as RPL Lite or RPL Classic */ -#define UIP_CONF_IPV6_RPL (ROUTING_CONF_RPL_LITE || ROUTING_CONF_RPL_CLASSIC) - -/* If RPL is enabled also enable the RPL NBR Policy */ -#if UIP_CONF_IPV6_RPL -#ifndef NBR_TABLE_FIND_REMOVABLE -#define NBR_TABLE_FIND_REMOVABLE rpl_nbr_policy_find_removable -#endif /* NBR_TABLE_FIND_REMOVABLE */ -#endif /* UIP_CONF_IPV6_RPL */ - -/* UIP_CONF_UDP specifies if UDP support should be included or - not. Disabling UDP saves memory but breaks a lot of stuff. */ -#ifndef UIP_CONF_UDP -#define UIP_CONF_UDP 1 -#endif /* UIP_CONF_UDP */ - -/* UIP_CONF_UDP_CONNS specifies the maximum number of - simultaneous UDP connections. */ -#ifndef UIP_CONF_UDP_CONNS -#define UIP_CONF_UDP_CONNS 8 -#endif /* UIP_CONF_UDP_CONNS */ - -/* UIP_CONF_TCP specifies if TCP support should be included or - not. Disabling TCP saves memory. */ -#ifndef UIP_CONF_TCP -#define UIP_CONF_TCP 0 -#endif /* UIP_CONF_TCP */ - -/* UIP_CONF_TCP_CONNS specifies the maximum number of - simultaneous TCP connections. */ -#ifndef UIP_CONF_TCP_CONNS -#if UIP_CONF_TCP -#define UIP_CONF_TCP_CONNS 8 -#else /* UIP_CONF_TCP */ -#define UIP_CONF_TCP_CONNS 0 -#endif /* UIP_CONF_TCP */ -#endif /* UIP_CONF_TCP_CONNS */ - -/* UIP_CONF_ND6_SEND_RA enables standard IPv6 Router Advertisement. - * We enable it by default when IPv6 is used without RPL. */ -#ifndef UIP_CONF_ND6_SEND_RA -#if (NETSTACK_CONF_WITH_IPV6 && !UIP_CONF_IPV6_RPL) -#define UIP_CONF_ND6_SEND_RA 1 -#else /* NETSTACK_CONF_WITH_IPV6 && !UIP_CONF_IPV6_RPL */ -#define UIP_CONF_ND6_SEND_RA 0 -#endif /* NETSTACK_CONF_WITH_IPV6 && !UIP_CONF_IPV6_RPL */ -#endif /* UIP_CONF_ND6_SEND_RA */ - -/* UIP_CONF_ND6_SEND_NS enables standard IPv6 Neighbor Discovery Protocol - (RFC 4861). We enable it by default when IPv6 is used without RPL. - With RPL, the neighbor cache (link-local IPv6 <-> MAC address mapping) - is fed whenever receiving DIO. This is often sufficient - for RPL routing, i.e. to send to the preferred parent or any child. - Link-local unicast to other neighbors may, however, not be possible if - we never receive any DIO from them. This may happen if the link from the - neighbor to us is weak, if DIO transmissions are suppressed (Trickle - timer) or if the neighbor chooses not to transmit DIOs because it is - a leaf node or for any reason. */ -#ifndef UIP_CONF_ND6_SEND_NS -#if (NETSTACK_CONF_WITH_IPV6 && !UIP_CONF_IPV6_RPL) -#define UIP_CONF_ND6_SEND_NS 1 -#else /* (NETSTACK_CONF_WITH_IPV6 && !UIP_CONF_IPV6_RPL) */ -#define UIP_CONF_ND6_SEND_NS 0 -#endif /* (NETSTACK_CONF_WITH_IPV6 && !UIP_CONF_IPV6_RPL) */ -#endif /* UIP_CONF_ND6_SEND_NS */ -/* To speed up the neighbor cache construction, - enable UIP_CONF_ND6_AUTOFILL_NBR_CACHE. When a node does not the link-layer - address of a neighbor, it will infer it from the link-local IPv6, assuming - the node used autoconfiguration. Note that RPL uses its own freshness - mechanism to select whether neighbors are still usable as a parent - or not, regardless of the neighbor cache. Note that this is not - standard-compliant (RFC 4861), as neighbors will be added regardless of - their reachability and liveness. */ -#ifndef UIP_CONF_ND6_AUTOFILL_NBR_CACHE -#if UIP_CONF_ND6_SEND_NS -#define UIP_CONF_ND6_AUTOFILL_NBR_CACHE 0 -#else /* UIP_CONF_ND6_SEND_NS */ -#define UIP_CONF_ND6_AUTOFILL_NBR_CACHE 1 -#endif /* UIP_CONF_ND6_SEND_NS */ -#endif /* UIP_CONF_ND6_AUTOFILL_NBR_CACHE */ -/* UIP_CONF_ND6_SEND_NA allows to still comply with NDP even if the host does - not perform NUD or DAD processes. By default it is activated so the host - can still communicate with a full NDP peer. */ -#ifndef UIP_CONF_ND6_SEND_NA -#if NETSTACK_CONF_WITH_IPV6 -#define UIP_CONF_ND6_SEND_NA 1 -#else /* NETSTACK_CONF_WITH_IPV6 */ -#define UIP_CONF_ND6_SEND_NA 0 -#endif /* NETSTACK_CONF_WITH_IPV6 */ -#endif /* UIP_CONF_ND6_SEND_NS */ - -/*---------------------------------------------------------------------------*/ -/* 6lowpan configuration options. - * - * These options change the behavior of the 6lowpan header compression - * code (sicslowpan). They typically depend on the type of radio used - * on the target platform, and are therefore platform-specific. - */ - -/* SICSLOWPAN_CONF_FRAG specifies if 6lowpan fragmentation should be - used or not. Fragmentation is on by default. */ -#ifndef SICSLOWPAN_CONF_FRAG -#define SICSLOWPAN_CONF_FRAG 1 -#endif /* SICSLOWPAN_CONF_FRAG */ - -/* SICSLOWPAN_CONF_MAC_MAX_PAYLOAD is the maximum available size for - frame headers, link layer security-related overhead, as well as - 6LoWPAN payload. By default, SICSLOWPAN_CONF_MAC_MAX_PAYLOAD is - 127 bytes (MTU of 802.15.4) - 2 bytes (Footer of 802.15.4). */ -#ifndef SICSLOWPAN_CONF_MAC_MAX_PAYLOAD -#define SICSLOWPAN_CONF_MAC_MAX_PAYLOAD (127 - 2) -#endif /* SICSLOWPAN_CONF_MAC_MAX_PAYLOAD */ - -/* SICSLOWPAN_CONF_COMPRESSION specifies what 6lowpan compression - mechanism to be used. 6lowpan hc06 is the default in Contiki. */ -#ifndef SICSLOWPAN_CONF_COMPRESSION -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_IPHC -#endif /* SICSLOWPAN_CONF_COMPRESSION */ - -#endif /* CONTIKI_DEFAULT_CONF_H */ diff --git a/os/contiki-lib.h b/os/contiki-lib.h deleted file mode 100644 index 01837a0ab..000000000 --- a/os/contiki-lib.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ -#ifndef CONTIKI_LIB_H_ -#define CONTIKI_LIB_H_ - -#include "contiki.h" -#include "lib/list.h" -#include "lib/memb.h" -#include "lib/random.h" - -#endif /* CONTIKI_LIB_H_ */ diff --git a/os/contiki-main.c b/os/contiki-main.c deleted file mode 100644 index 43e301746..000000000 --- a/os/contiki-main.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup main - * @{ - */ -/*---------------------------------------------------------------------------*/ -/** - * \file - * - * Implementation of \os's main routine - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "contiki-net.h" -#include "sys/node-id.h" -#include "sys/platform.h" -#include "sys/energest.h" -#include "sys/stack-check.h" -#include "dev/watchdog.h" - -#include "net/queuebuf.h" -#include "net/app-layer/coap/coap-engine.h" -#include "services/rpl-border-router/rpl-border-router.h" -#include "services/orchestra/orchestra.h" -#include "services/shell/serial-shell.h" -#include "services/simple-energest/simple-energest.h" -#include "services/tsch-cs/tsch-cs.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Main" -#define LOG_LEVEL LOG_LEVEL_MAIN -/*---------------------------------------------------------------------------*/ -int -#if PLATFORM_MAIN_ACCEPTS_ARGS -main(int argc, char **argv) -{ - platform_process_args(argc, argv); -#else -main(void) -{ -#endif - platform_init_stage_one(); - - clock_init(); - rtimer_init(); - process_init(); - process_start(&etimer_process, NULL); - ctimer_init(); - watchdog_init(); - - energest_init(); - -#if STACK_CHECK_ENABLED - stack_check_init(); -#endif - - platform_init_stage_two(); - -#if QUEUEBUF_ENABLED - queuebuf_init(); -#endif /* QUEUEBUF_ENABLED */ - netstack_init(); - node_id_init(); - - LOG_INFO("Starting " CONTIKI_VERSION_STRING "\n"); - LOG_INFO("- Routing: %s\n", NETSTACK_ROUTING.name); - LOG_INFO("- Net: %s\n", NETSTACK_NETWORK.name); - LOG_INFO("- MAC: %s\n", NETSTACK_MAC.name); - LOG_INFO("- 802.15.4 PANID: 0x%04x\n", IEEE802154_PANID); -#if MAC_CONF_WITH_TSCH - LOG_INFO("- 802.15.4 TSCH default hopping sequence length: %u\n", (unsigned)sizeof(TSCH_DEFAULT_HOPPING_SEQUENCE)); -#else /* MAC_CONF_WITH_TSCH */ - LOG_INFO("- 802.15.4 Default channel: %u\n", IEEE802154_DEFAULT_CHANNEL); -#endif /* MAC_CONF_WITH_TSCH */ - - LOG_INFO("Node ID: %u\n", node_id); - LOG_INFO("Link-layer address: "); - LOG_INFO_LLADDR(&linkaddr_node_addr); - LOG_INFO_("\n"); - -#if NETSTACK_CONF_WITH_IPV6 - { - uip_ds6_addr_t *lladdr; - memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr)); - process_start(&tcpip_process, NULL); - - lladdr = uip_ds6_get_link_local(-1); - LOG_INFO("Tentative link-local IPv6 address: "); - LOG_INFO_6ADDR(lladdr != NULL ? &lladdr->ipaddr : NULL); - LOG_INFO_("\n"); - } -#endif /* NETSTACK_CONF_WITH_IPV6 */ - - platform_init_stage_three(); - -#if BUILD_WITH_RPL_BORDER_ROUTER - rpl_border_router_init(); - LOG_DBG("With RPL Border Router\n"); -#endif /* BUILD_WITH_RPL_BORDER_ROUTER */ - -#if BUILD_WITH_ORCHESTRA - orchestra_init(); - LOG_DBG("With Orchestra\n"); -#endif /* BUILD_WITH_ORCHESTRA */ - -#if BUILD_WITH_SHELL - serial_shell_init(); - LOG_DBG("With Shell\n"); -#endif /* BUILD_WITH_SHELL */ - -#if BUILD_WITH_COAP - coap_engine_init(); - LOG_DBG("With CoAP\n"); -#endif /* BUILD_WITH_SHELL */ - -#if BUILD_WITH_SIMPLE_ENERGEST - simple_energest_init(); -#endif /* BUILD_WITH_SIMPLE_ENERGEST */ - -#if BUILD_WITH_TSCH_CS - /* Initialize the channel selection module */ - tsch_cs_adaptations_init(); -#endif /* BUILD_WITH_TSCH_CS */ - - autostart_start(autostart_processes); - - watchdog_start(); - -#if PLATFORM_PROVIDES_MAIN_LOOP - platform_main_loop(); -#else - while(1) { - uint8_t r; - do { - r = process_run(); - watchdog_periodic(); - } while(r > 0); - - platform_idle(); - } -#endif - - return 0; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/os/contiki-net.h b/os/contiki-net.h deleted file mode 100644 index 6384c51ef..000000000 --- a/os/contiki-net.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ -#ifndef CONTIKI_NET_H_ -#define CONTIKI_NET_H_ - -#include "contiki.h" - -#include "net/ipv6/tcpip.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uiplib.h" -#include "net/ipv6/uip-udp-packet.h" -#include "net/ipv6/simple-udp.h" -#include "net/ipv6/uip-nameserver.h" -#include "net/routing/routing.h" - -#include "net/ipv6/uip-icmp6.h" -#include "net/ipv6/uip-ds6.h" - -#include "net/ipv6/resolv.h" - -#include "net/ipv6/psock.h" - -#include "net/ipv6/udp-socket.h" -#include "net/ipv6/tcp-socket.h" - -#include "net/netstack.h" - -#endif /* CONTIKI_NET_H_ */ diff --git a/os/contiki.h b/os/contiki.h deleted file mode 100644 index a964758f4..000000000 --- a/os/contiki.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ -#ifndef CONTIKI_H_ -#define CONTIKI_H_ - -#include "contiki-conf.h" -#include "contiki-default-conf.h" - -#include "sys/process.h" -#include "sys/autostart.h" - -#include "sys/timer.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "sys/rtimer.h" - -#include "sys/pt.h" - -#include "sys/clock.h" - -#endif /* CONTIKI_H_ */ diff --git a/os/dev/battery-sensor.h b/os/dev/battery-sensor.h deleted file mode 100644 index 3f65928de..000000000 --- a/os/dev/battery-sensor.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2007/11/13 20:36:40 $ - * $Revision: 1.1 $ - */ - -#ifndef BATTERY_SENSOR_H_ -#define BATTERY_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor battery_sensor; - -#define BATTERY_SENSOR "Battery" - -#endif /* BATTERY_SENSOR_H_ */ diff --git a/os/dev/ble-hal.h b/os/dev/ble-hal.h deleted file mode 100644 index ce5f5e8b1..000000000 --- a/os/dev/ble-hal.h +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Copyright (c) 2017, Graz University of Technology - * 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 - * hardware abstraction for a BLE controller - * - * \author - * Michael Spoerk - */ -/*---------------------------------------------------------------------------*/ - -#ifndef BLE_HAL_H_ -#define BLE_HAL_H_ - -#include - -/*---------------------------------------------------------------------------*/ -/* BLE device address size */ -#define BLE_ADDR_SIZE 6 -/*---------------------------------------------------------------------------*/ -/* Advertisement channel definitions */ -#define BLE_ADV_DATA_LEN 31 -#define BLE_SCAN_RESP_DATA_LEN 31 -#define BLE_ADV_CHANNEL_1 37 -#define BLE_ADV_CHANNEL_1_MASK 0b001 -#define BLE_ADV_CHANNEL_2 38 -#define BLE_ADV_CHANNEL_2_MASK 0b010 -#define BLE_ADV_CHANNEL_3 39 -#define BLE_ADV_CHANNEL_3_MASK 0b100 -#define BLE_ADV_INTERVAL_MIN 20 -#define BLE_ADV_INTERVAL_MAX 0x4000 -#define BLE_SCAN_INTERVAL_MIN 0x0004 -#define BLE_SCAN_INTERVAL_MAX 0x4000 -/*---------------------------------------------------------------------------*/ -/* Data channel definitions */ -#define BLE_DATA_CHANNEL_MIN 0 -#define BLE_DATA_CHANNEL_MAX 36 -/* Types of data PDU frames */ -#define BLE_DATA_PDU_LLID_DATA_FRAGMENT 0b01 -#define BLE_DATA_PDU_LLID_DATA_MESSAGE 0b10 -#define BLE_DATA_PDU_LLID_CONTROL 0b11 -/*---------------------------------------------------------------------------*/ -/* Types of LL control PDUs */ -#define BLE_LL_CONN_UPDATE_REQ 0x00 -#define BLE_LL_CHANNEL_MAP_REQ 0x01 -#define BLE_LL_TERMINATE_IND 0x02 -#define BLE_LL_ENC_REQ 0x03 -#define BLE_LL_ENC_RSP 0x04 -#define BLE_LL_START_ENC_REQ 0x05 -#define BLE_LL_START_ENC_RSP 0x06 -#define BLE_LL_UNKNOWN_RSP 0x07 -#define BLE_LL_FEATURE_REQ 0x08 -#define BLE_LL_FEATURE_RSP 0x09 -#define BLE_LL_PAUSE_ENC_REQ 0x0A -#define BLE_LL_PAUSE_ENC_RSP 0x0B -#define BLE_LL_VERSION_IND 0x0C -#define BLE_LL_REJECT_IND 0x0D -#define BLE_LL_SLAVE_FEATURE_REQ 0x0E -#define BLE_LL_CONN_PARAM_REQ 0x0F -#define BLE_LL_CONN_PARAM_RSP 0x10 -#define BLE_LL_REJECT_IND_EXT 0x11 -#define BLE_LL_PING_REQ 0x12 -#define BLE_LL_PING_RSP 0x13 -/*---------------------------------------------------------------------------*/ -#define FRAME_BLE_RX_EVENT 0x00 /* signaling that data was received (standard) */ -#define FRAME_BLE_TX_EVENT 0x10 /* signaling that data was successfully sent */ -#define FRAME_BLE_CONNECTION_EVENT 0x20 /* signaling that a new BLE connection was established */ -#define FRAME_BLE_CONNECTION_UPDATED 0x30 /* signaling that the BLE connection parameter were successfully updated */ -/*---------------------------------------------------------------------------*/ -/* Return values for functions of ble_controller_driver implementations */ -typedef enum { - BLE_RESULT_OK, - BLE_RESULT_NOT_SUPPORTED, - BLE_RESULT_INVALID_PARAM, - BLE_RESULT_ERROR -} ble_result_t; - -/*---------------------------------------------------------------------------*/ -/* Type of BLE device address */ -typedef enum { - BLE_ADDR_TYPE_PUBLIC, - BLE_ADDR_TYPE_RANDOM -} ble_addr_type_t; - -/*---------------------------------------------------------------------------*/ -/* Advertising modes of BLE */ -typedef enum { - /* connectable undirected advertising */ - BLE_ADV_IND, - - /* connectable directed advertising (high duty cycle) */ - BLE_ADV_DIR_IND_HDC, - - /* scannable undirected advertising */ - BLE_ADV_SCAN_IND, - - /* non connectable undirected advertising */ - BLE_ADV_NONCONN_IND, - - /* connectable directed advertising (low duty cycle) */ - BLE_ADV_DIR_IND_LDC -} ble_adv_type_t; - -/*---------------------------------------------------------------------------*/ -/* Scanning modes of BLE */ -typedef enum { - /* no SCAN REQUESTS are sent */ - BLE_SCAN_PASSIVE, - /* SCAN REQUESTS may be sent */ - BLE_SCAN_ACTIVE -} ble_scan_type_t; - -/*---------------------------------------------------------------------------*/ -/* Scanning filter policy */ -typedef enum { - /* accept all advertisement packets */ - BLE_SCAN_FILTER_POLICY_ACCEPT, - /* ignore all advertisement packets from devices not on the white list */ - BLE_SCAN_FILTER_POLICY_IGNORE -} ble_scan_filter_policy_t; -/*---------------------------------------------------------------------------*/ -/* List of packets to be sent by RDC layer */ -struct ble_buf_list { - struct ble_buf_list *next; - struct queuebuf *buf; - void *ptr; -}; - -/*---------------------------------------------------------------------------*/ -/* Extension of the RADIO_PARAM fields for the BLE radios */ -enum { - /* start with 100 to be sure to not interfere with the standard values*/ - /*-----------------------------------------------------------------------*/ - /* BLE controller general */ - /* The bluetooth device address */ - RADIO_CONST_BLE_BD_ADDR = 100, - - /* the size of a single BLE command buffer */ - RADIO_CONST_BLE_BUFFER_SIZE, - - /* the amount of single BLE command buffers */ - RADIO_CONST_BLE_BUFFER_AMOUNT, - - /*-----------------------------------------------------------------------*/ - /* BLE advertisement */ - - /* advertisement interval */ - RADIO_PARAM_BLE_ADV_INTERVAL, - - /* BLE advertisement type (directed/undirected, ...) */ - RADIO_PARAM_BLE_ADV_TYPE, - - /* type of own address during advertisement */ - RADIO_PARAM_BLE_ADV_OWN_ADDR_TYPE, - - /* advertisement channel map */ - RADIO_PARAM_BLE_ADV_CHANNEL_MAP, - - /* advertisement payload */ - RADIO_PARAM_BLE_ADV_PAYLOAD, - - /* scan response payload */ - RADIO_PARAM_BLE_ADV_SCAN_RESPONSE, - - /* 1: enable advertisement / 0: disable advertisement */ - RADIO_PARAM_BLE_ADV_ENABLE, - - /*-----------------------------------------------------------------------*/ - /* BLE scanning */ - - /* scanning interval */ - RADIO_PARAM_BLE_SCAN_INTERVAL, - - /* scanning window */ - RADIO_PARAM_BLE_SCAN_WINDOW, - - /* BLE scanning type (active/passive) */ - RADIO_PARAM_BLE_SCAN_TYPE, - - /* type of own address during scanning */ - RADIO_PARAM_BLE_SCAN_OWN_ADDR_TYPE, - - /* scanning channel */ - RADIO_PARAM_BLE_SCAN_CHANNEL, - - /* 1: enable scanning / 0: disable scanning */ - RADIO_PARAM_BLE_SCAN_ENABLE, - - /*-----------------------------------------------------------------------*/ - /* BLE initiating */ - /* The initiating command uses some parameters from scanning */ - /* (scan interval, window, address type) */ - - /* address type of the advertising device */ - RADIO_PARAM_BLE_PEER_ADDR_TYPE, - - /* address of the advertising device */ - RADIO_PARAM_BLE_PEER_ADDR, - - /* connection interval */ - RADIO_PARAM_BLE_CONN_INTERVAL, - - /* slave latency */ - RADIO_PARAM_BLE_CONN_LATENCY, - - /* supervision timeout */ - RADIO_PARAM_BLE_CONN_SUPERVISION_TIMEOUT, - - /* 1: start connection / 0: cancel connection creation */ - RADIO_PARAM_BLE_INITIATOR_ENABLE, - - RADIO_PARAM_BLE_CONN_UPDATE -}; - -/*---------------------------------------------------------------------------*/ -/** - * The structure of a ble radio controller driver in Contiki. - */ -struct ble_hal_driver { - - /*------------------------------------------------------------------------*/ - /* GENERAL COMMANDS */ - /** - * Resets the BLE controller - */ - ble_result_t (*reset)(void); - - /** - * Reads the static BLE device address. - * - * \param addr the static device address - */ - ble_result_t (*read_bd_addr)(uint8_t *addr); - - /** - * Reads the size of the data buffers. - * - * \param buf_len the length of a single data buffer - * \param num_buf the number of data buffers - */ - ble_result_t (*read_buffer_size) (unsigned int *buf_len, - unsigned int *num_buf); - - /*------------------------------------------------------------------------*/ - /* ADVERTISING COMMANDS */ - /** - * Sets the parameter for advertising. - * - * \param adv_interval advertising interval - * (interval = adv_interval * 0.625 ms) - * \param type type of advertising - * \param own_addr_type indicator if own address is public/random - * \param adv_channel_map map of advertising channels to use - */ - ble_result_t (*set_adv_param) (unsigned int adv_interval, - ble_adv_type_t type, - ble_addr_type_t own_addr_type, - unsigned short adv_channel_map); - - /** - * Reads the used power on the advertisement channels. - * - * \param power the used power in dBm - */ - ble_result_t (*read_adv_channel_tx_power) (short *power); - - /** - * Sets the advertising data. - * - * \param data_len the length of the advertising data - * \param data the data to advertise - */ - ble_result_t (*set_adv_data) (unsigned short data_len, - char *data); - - /** - * Sets the scan response data. - * - * \param data_len the length of the scan response data - * \param data the data of a scan response - */ - ble_result_t (*set_scan_resp_data) (unsigned short data_len, - char *data); - - /** - * Enables/disables advertising. - * - * \param enable if 1 then enable advertising, otherwise disable - */ - ble_result_t (*set_adv_enable) (unsigned short enable); - - /*------------------------------------------------------------------------*/ - /* SCANNING COMMANDS */ - /** - * Sets the parameter for scanning. - * - * \param type scan mode - * \param scan_interval scan interval (interval = scan_interval * 0.625 ms) - * \param scan_window scan window (window = scan_window * 0.625 ms) - * \param own_addr_type indicator if own address is public/random - */ - ble_result_t (*set_scan_param) (ble_scan_type_t type, - unsigned int scan_interval, - unsigned int scan_window, - ble_addr_type_t own_addr_type); - - /** - * Enables/disables scanning. - * - * \param enable 1: enable scanning, otherwise disable - * \param filter_duplicates: 1: filter duplicates, otherwise no filtering - */ - ble_result_t (*set_scan_enable) (unsigned short enable, - unsigned short filter_duplicates); - - /*------------------------------------------------------------------------*/ - /* INITIATING COMMANDS */ - /** - * Initiates the creation of a BLE connection. - * - * \param scan_interval scan interval (interval = scan_interval * 0.625 ms) - * \param scan_window scan window (window = scan_window * 0.625 ms) - * \param peer_addr_type indicator if peer address is public/random - * \param peer_addr ble address of the device to connect to - * \param own_addr_type indicator if own address is public/random - * \param conn_interval connection interval - * (interval = conn_interval * 1.25 ms) - * \param conn_latency slave latency - * \param supervision_timeout (timeout = supervision_timeout * 10 ms) - */ - ble_result_t (*create_connection) (unsigned int scan_interval, - unsigned int scan_window, - ble_addr_type_t peer_addr_type, - uint8_t *peer_addr, - ble_addr_type_t own_addr_type, - unsigned int conn_interval, - unsigned int conn_latency, - unsigned int supervision_timeout); - - /** - * Cancels the initiation of a BLE connection. - */ - ble_result_t (*create_connection_cancel) (void); - - /*------------------------------------------------------------------------*/ - /* CONNECTION COMMANDS */ - /** - * Updates the connection parameters. - * \param conn_interval connection interval - * (interval = conn_interval * 1.25 ms) - * \param conn_latency slave latency - * \param supervision_timeout (timeout = supervision_timeout * 10 ms) - */ - ble_result_t (*connection_update) (unsigned int connection_handle, - unsigned int conn_interval, - unsigned int conn_latency, - unsigned int supervision_timeout); - - /** - * Disconnects the connection. - * - * \param connection_handle - * \param reason see error codes of Bluetooth specification - */ - ble_result_t (*disconnect) (unsigned int connection_handle, - unsigned short reason); - - ble_result_t (*send) (void *buf, unsigned short buf_len); - - ble_result_t (*send_list) (struct ble_buf_list *list); - - ble_result_t (*read_connection_interval) (unsigned int conn_handle, - unsigned int *conn_interval_ms); -}; - -#endif /* BLE_HAL_H_ */ diff --git a/os/dev/button-hal.c b/os/dev/button-hal.c deleted file mode 100644 index 58cded790..000000000 --- a/os/dev/button-hal.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup button_hal - * @{ - * - * \file - * Platform-independent button driver. - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/process.h" -#include "sys/ctimer.h" -#include "sys/critical.h" -#include "dev/gpio-hal.h" -#include "dev/button-hal.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -PROCESS(button_hal_process, "Button HAL process"); -/*---------------------------------------------------------------------------*/ -process_event_t button_hal_press_event; -process_event_t button_hal_release_event; -process_event_t button_hal_periodic_event; -/*---------------------------------------------------------------------------*/ -/* A mask of all pins that have changed state since the last process poll */ -static volatile gpio_hal_pin_mask_t pmask; -/*---------------------------------------------------------------------------*/ -extern button_hal_button_t *button_hal_buttons[]; -/*---------------------------------------------------------------------------*/ -/* Common handler for all handler events, and register it with the GPIO HAL */ -static gpio_hal_event_handler_t button_event_handler; -/*---------------------------------------------------------------------------*/ -static void -duration_exceeded_callback(void *btn) -{ - button_hal_button_t *button = (button_hal_button_t *)btn; - - button->press_duration_seconds++; - ctimer_set(&button->duration_ctimer, CLOCK_SECOND, - duration_exceeded_callback, button); - process_post(PROCESS_BROADCAST, button_hal_periodic_event, button); -} -/*---------------------------------------------------------------------------*/ -static void -debounce_handler(void *btn) -{ - button_hal_button_t *button; - int expired; - uint8_t button_state; - - button = (button_hal_button_t *)btn; - - /* - * A new debounce may have been triggered after expiration of the previous - * one but before we got called. - */ - if(!ctimer_expired(&button->debounce_ctimer)) { - return; - } - - expired = ctimer_expired(&button->duration_ctimer); - - button_state = button_hal_get_state(button); - - /* - * A debounce timer expired. Inspect the button's state. If the button's - * state is the same as it was before, then we ignore this as noise. - */ - if(button_state == BUTTON_HAL_STATE_PRESSED && expired) { - /* - * Button is pressed and no tick counter running. Treat as new press. - * Include the debounce duration in the first periodic, so that the - * callback will happen 1 second after the button press, not 1 second - * after the end of the debounce. Notify process about the press event. - */ - button->press_duration_seconds = 0; - ctimer_set(&button->duration_ctimer, - CLOCK_SECOND - BUTTON_HAL_DEBOUNCE_DURATION, - duration_exceeded_callback, button); - process_post(PROCESS_BROADCAST, button_hal_press_event, button); - } else if(button_state == BUTTON_HAL_STATE_RELEASED && expired == 0) { - /* - * Button is released and there is a duration_ctimer running. Treat this - * as a new release and notify processes. - */ - ctimer_stop(&button->duration_ctimer); - process_post(PROCESS_BROADCAST, button_hal_release_event, button); - } -} -/*---------------------------------------------------------------------------*/ -static void -press_release_handler(gpio_hal_pin_mask_t pin_mask) -{ - pmask |= pin_mask; - process_poll(&button_hal_process); -} -/*---------------------------------------------------------------------------*/ -button_hal_button_t * -button_hal_get_by_id(uint8_t unique_id) -{ - button_hal_button_t **button; - - for(button = button_hal_buttons; *button != NULL; button++) { - if((*button)->unique_id == unique_id) { - return *button; - } - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -button_hal_button_t * -button_hal_get_by_index(uint8_t index) -{ - if(index >= button_hal_button_count) { - return NULL; - } - - return button_hal_buttons[index]; -} -/*---------------------------------------------------------------------------*/ -uint8_t -button_hal_get_state(button_hal_button_t *button) -{ - uint8_t pin_state = gpio_hal_arch_read_pin(button->pin); - - if((pin_state == 0 && button->negative_logic == true) || - (pin_state == 1 && button->negative_logic == false)) { - return BUTTON_HAL_STATE_PRESSED; - } - - return BUTTON_HAL_STATE_RELEASED; -} -/*---------------------------------------------------------------------------*/ -void -button_hal_init() -{ - button_hal_button_t **button; - gpio_hal_pin_cfg_t cfg; - - button_hal_press_event = process_alloc_event(); - button_hal_release_event = process_alloc_event(); - button_hal_periodic_event = process_alloc_event(); - - button_event_handler.pin_mask = 0; - button_event_handler.handler = press_release_handler; - - for(button = button_hal_buttons; *button != NULL; button++) { - cfg = GPIO_HAL_PIN_CFG_EDGE_BOTH | GPIO_HAL_PIN_CFG_INT_ENABLE | - (*button)->pull; - gpio_hal_arch_pin_set_input((*button)->pin); - gpio_hal_arch_pin_cfg_set((*button)->pin, cfg); - gpio_hal_arch_interrupt_enable((*button)->pin); - button_event_handler.pin_mask |= gpio_hal_pin_to_mask((*button)->pin); - } - - process_start(&button_hal_process, NULL); - - gpio_hal_register_handler(&button_event_handler); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(button_hal_process, ev, data) -{ - int_master_status_t status; - gpio_hal_pin_mask_t pins; - button_hal_button_t **button; - - PROCESS_BEGIN(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - - status = critical_enter(); - pins = pmask; - pmask = 0; - critical_exit(status); - - for(button = button_hal_buttons; *button != NULL; button++) { - if(gpio_hal_pin_to_mask((*button)->pin) & pins) { - /* Ignore all button presses/releases during its debounce */ - if(ctimer_expired(&(*button)->debounce_ctimer)) { - /* - * Here we merely set a debounce timer. At the end of the debounce we - * will inspect the button's state and we will take action only if it - * has changed. - * - * This is to prevent erroneous edge detections due to interference. - */ - ctimer_set(&(*button)->debounce_ctimer, BUTTON_HAL_DEBOUNCE_DURATION, - debounce_handler, *button); - } - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/dev/button-hal.h b/os/dev/button-hal.h deleted file mode 100644 index c1822ff8e..000000000 --- a/os/dev/button-hal.h +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup dev - * @{ - */ -/*---------------------------------------------------------------------------*/ -/** - * \defgroup button_hal Button HAL - * - * Hardware abstraction layer for user buttons. - * - * This HAL enables an abstraction of general-purpose / user buttons or - * similar peripherals (e.g. a reed relay can also be abstracted through this - * HAL). The HAL handles software debounce timers internally, therefore the - * platform-specific button driver does not need to worry about debouncing. - * - * The platform developer needs to define a variable of type - * \c button_hal_button_t for each user button. Within this variable, the - * developer needs to specify the GPIO pin where the button is attached, - * whether the button uses negative logic, and whether the GPIO pin should - * be configured with internal pullup/down. The developer also needs to provide - * a unique index for each button, as well as a description. - * - * With those in place, the HAL will generate the following process events: - * - * - button_hal_press_event: Upon press of the button - * - button_hal_release_event: Upon release of the button - * - button_hal_periodic_event: Generated every second that the user button is - * kept pressed. - * - * With those events in place, an application can perform an action: - * - * - Immediately after the button gets pressed. - * - After the button has been pressed for N seconds. - * - Immediately upon release of the button. This action can vary depending - * on how long the button had been pressed for. - * - * A platform with user buttons can either implement this API (recommended) or - * the older button_sensor API. Some examples will not work if this API is not - * implemented. - * - * This API requires the platform to first support the GPIO HAL API. - * @{ - * - * \file - * Header file for the button HAL - */ -/*---------------------------------------------------------------------------*/ -#ifndef BUTTON_HAL_H_ -#define BUTTON_HAL_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" -#include "sys/clock.h" -#include "sys/ctimer.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Controls the software debounce timer duration. - * - * The platform can provide a more suitable value. This value will apply to - * all buttons. - */ -#ifdef BUTTON_HAL_CONF_DEBOUNCE_DURATION -#define BUTTON_HAL_DEBOUNCE_DURATION BUTTON_HAL_CONF_DEBOUNCE_DURATION -#else -#define BUTTON_HAL_DEBOUNCE_DURATION (CLOCK_SECOND >> 6) -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief Controls whether buttons will have human-readable names - * - * Define this to zero to save code space - */ -#if BUTTON_HAL_CONF_WITH_DESCRIPTION -#define BUTTON_HAL_WITH_DESCRIPTION BUTTON_HAL_CONF_WITH_DESCRIPTION -#else -#define BUTTON_HAL_WITH_DESCRIPTION 1 -#endif -/*---------------------------------------------------------------------------*/ -#define BUTTON_HAL_STATE_RELEASED 0 -#define BUTTON_HAL_STATE_PRESSED 1 -/*---------------------------------------------------------------------------*/ -/** - * Optional button IDs - */ -#define BUTTON_HAL_ID_BUTTON_ZERO 0x00 -#define BUTTON_HAL_ID_BUTTON_ONE 0x01 -#define BUTTON_HAL_ID_BUTTON_TWO 0x02 -#define BUTTON_HAL_ID_BUTTON_THREE 0x03 -#define BUTTON_HAL_ID_BUTTON_FOUR 0x04 -#define BUTTON_HAL_ID_BUTTON_FIVE 0x05 - -#define BUTTON_HAL_ID_USER_BUTTON BUTTON_HAL_ID_BUTTON_ZERO -/*---------------------------------------------------------------------------*/ -/** - * \brief A logical representation of a user button - */ -typedef struct button_hal_button_s button_hal_button_t; - -struct button_hal_button_s { - /** Used by the s/w debounce functionality */ - struct ctimer debounce_ctimer; - - /** A callback timer used to count duration of button presses */ - struct ctimer duration_ctimer; - -#if BUTTON_HAL_WITH_DESCRIPTION - /** - * \brief A textual description of the button - * - * This field may only be accessed using the BUTTON_HAL_GET_DESCRIPTION() - * macro. - */ - const char *description; -#endif - - /** True if the button uses negative logic (active: low) */ - const bool negative_logic; - - /** The gpio pin connected to the button */ - const gpio_hal_pin_t pin; - - /** The pin's pull configuration */ - const gpio_hal_pin_cfg_t pull; - - /** A counter of the duration (in seconds) of a button press */ - uint8_t press_duration_seconds; - - /** - * \brief A unique identifier for this button. - * - * The platform code is responsible of setting unique values here. This can - * be used later to determine which button generated an event. Many examples - * assume the existence of a button with ID == BUTTON_HAL_ID_BUTTON_ZERO, - * so it is good idea to use this ID for one of your platform's buttons. - */ - const uint8_t unique_id; -}; -/*---------------------------------------------------------------------------*/ -#if BUTTON_HAL_WITH_DESCRIPTION -/** - * \brief Define a button to be used by the HAL - * \param name The variable name for the button - * \param descr A textual description - * \param p The pin connected to the button - * \param nl True if the button is connected using negative logic - * \param u The button's pull configuration - * \param id A unique numeric identifier - */ -#define BUTTON_HAL_BUTTON(name, descr, p, u, id, nl) \ - static button_hal_button_t name = { \ - .description = descr, \ - .pin = p, \ - .pull = u, \ - .unique_id = id, \ - .negative_logic = nl, \ - } - -/** - * \brief Retrieve the textual description of a button - * \param b A pointer to the button button_hal_button_t - * - * This macro will return the value of the description field for b. If - * BUTTON_HAL_WITH_DESCRIPTION is 0 then this macro will return "" - */ -#define BUTTON_HAL_GET_DESCRIPTION(b) (b)->description -#else -#define BUTTON_HAL_BUTTON(name, descr, p, u, id, nl) \ - static button_hal_button_t name = { \ - .pin = p, \ - .pull = u, \ - .unique_id = id, \ - .negative_logic = nl, \ - } - -#define BUTTON_HAL_GET_DESCRIPTION(b) "" -#endif -/*---------------------------------------------------------------------------*/ -#define BUTTON_HAL_BUTTONS(...) \ - button_hal_button_t *button_hal_buttons[] = {__VA_ARGS__, NULL}; \ - const uint8_t button_hal_button_count = \ - (sizeof(button_hal_buttons) / sizeof(button_hal_buttons[0])) - 1; -/*---------------------------------------------------------------------------*/ -/** - * \brief The number of buttons on a device - */ -extern const uint8_t button_hal_button_count; -/*---------------------------------------------------------------------------*/ -/** - * \brief A broadcast event generated when a button gets pressed - */ -extern process_event_t button_hal_press_event; - -/** - * \brief A broadcast event generated when a button gets released - */ -extern process_event_t button_hal_release_event; - -/** - * \brief A broadcast event generated every second while a button is kept pressed - */ -extern process_event_t button_hal_periodic_event; -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise the button HAL - */ -void button_hal_init(void); - -/** - * \brief Retrieve a button by ID - * \param unique_id The button unique ID to search for - * \return A pointer to the button or NULL if not found - */ -button_hal_button_t *button_hal_get_by_id(uint8_t unique_id); - -/** - * \brief Retrieve a button by its index - * \param index The button's index (0, 1, ... button_hal_button_count - 1) - * \return A pointer to the button or NULL if not found - */ -button_hal_button_t *button_hal_get_by_index(uint8_t index); - -/** - * \brief Get the state of a button (pressed / released) - * \param button A pointer to the button - * \retval BUTTON_HAL_STATE_RELEASED The button is currently released - * \retval BUTTON_HAL_STATE_PRESSED The button is currently pressed - */ -uint8_t button_hal_get_state(button_hal_button_t *button); -/*---------------------------------------------------------------------------*/ -#endif /* BUTTON_HAL_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/dev/button-sensor.h b/os/dev/button-sensor.h deleted file mode 100644 index 34a51d7d5..000000000 --- a/os/dev/button-sensor.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#ifndef BUTTON_SENSOR_H_ -#define BUTTON_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor button_sensor; -extern const struct sensors_sensor button_sensor2; - -#define BUTTON_SENSOR "Button" - -#endif /* BUTTON_SENSOR_H_ */ diff --git a/os/dev/eeprom.h b/os/dev/eeprom.h deleted file mode 100644 index 0a57117be..000000000 --- a/os/dev/eeprom.h +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright (c) 2004 Swedish Institute of Computer Science. - * 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. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - * - * - * Author: Adam Dunkels - * - */ - -/** - * \file - * EEPROM functions. - * \author Adam Dunkels - */ - -/** - * \addtogroup dev - * @{ - */ - -/** - * \defgroup eeprom EEPROM API - * - * The EEPROM API defines a common interface for EEPROM access on - * Contiki platforms. - * - * A platform with EEPROM support must implement this API. - * - * @{ - */ - -#ifndef EEPROM_H_ -#define EEPROM_H_ - -typedef unsigned short eeprom_addr_t; - -#define EEPROM_NULL 0 - -#ifdef EEPROM_CONF_SIZE -#define EEPROM_SIZE (EEPROM_CONF_SIZE) -#else -#define EEPROM_SIZE 0 /* Default to no EEPROM */ -#endif - -#ifdef EEPROM_CONF_END_ADDR -#define EEPROM_END_ADDR (EEPROM_CONF_END_ADDR) -#else -#define EEPROM_END_ADDR (EEPROM_SIZE - 1) -#endif - -/** - * Write a buffer into EEPROM. - * - * This function writes a buffer of the specified size into EEPROM. - * - * \param addr The address in EEPROM to which the buffer should be written. - * - * \param buf A pointer to the buffer from which data is to be read. - * - * \param size The number of bytes to write into EEPROM. - * - * - */ -void eeprom_write(eeprom_addr_t addr, unsigned char *buf, int size); - -/** - * Read data from the EEPROM. - * - * This function reads a number of bytes from the specified address in - * EEPROM and into a buffer in memory. - * - * \param addr The address in EEPROM from which the data should be read. - * - * \param buf A pointer to the buffer to which the data should be stored. - * - * \param size The number of bytes to read. - * - * - */ -void eeprom_read(eeprom_addr_t addr, unsigned char *buf, int size); - -/** - * Initialize the EEPROM module - * - * This function initializes the EEPROM module and is called from the - * bootup code. - * - */ - -void eeprom_init(void); - -#endif /* EEPROM_H_ */ - -/** @} */ -/** @} */ diff --git a/os/dev/gpio-hal.c b/os/dev/gpio-hal.c deleted file mode 100644 index 949d829a7..000000000 --- a/os/dev/gpio-hal.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup gpio-hal - * @{ - * - * \file - * Implementation of the platform-independent aspects of the GPIO HAL - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" -#include "lib/list.h" -#include "sys/log.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#define LOG_MODULE "GPIO HAL" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -LIST(handlers); -/*---------------------------------------------------------------------------*/ -void -gpio_hal_register_handler(gpio_hal_event_handler_t *handler) -{ - list_add(handlers, handler); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_event_handler(gpio_hal_pin_mask_t pins) -{ - gpio_hal_event_handler_t *this; - - for(this = list_head(handlers); this != NULL; this = this->next) { - if(pins & this->pin_mask) { - if(this->handler != NULL) { - this->handler(pins & this->pin_mask); - } - } - } -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_init() -{ - list_init(handlers); - gpio_hal_arch_init(); -} -/*---------------------------------------------------------------------------*/ -#if GPIO_HAL_ARCH_SW_TOGGLE -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_toggle_pin(gpio_hal_pin_t pin) -{ - if(pin >= GPIO_HAL_PIN_COUNT) { - LOG_ERR("Pin %u out of bounds\n", pin); - return; - } - - gpio_hal_arch_write_pin(pin, gpio_hal_arch_read_pin(pin) ^ 1); -} -/*---------------------------------------------------------------------------*/ -void -gpio_hal_arch_toggle_pins(gpio_hal_pin_mask_t pins) -{ - gpio_hal_arch_write_pins(pins, ~gpio_hal_arch_read_pins(pins)); -} -/*---------------------------------------------------------------------------*/ -#endif /* GPIO_HAL_ARCH_SW_TOGGLE */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/os/dev/gpio-hal.h b/os/dev/gpio-hal.h deleted file mode 100644 index 5ad9f472b..000000000 --- a/os/dev/gpio-hal.h +++ /dev/null @@ -1,516 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup dev - * @{ - * - * \defgroup gpio-hal GPIO Hardware Abstraction Layer - * - * The GPIO HAL provides a set of common functions that can be used in a - * platform-independent fashion. - * - * Internally, the GPIO HAL handles edge detection handling and also provides - * fallback functions for GPIO pin toggling if the hardware does not have - * a direct method of toggling pins through direct register access. - * - * @{ - * - * \file - * Header file for the GPIO HAL - */ -/*---------------------------------------------------------------------------*/ -#ifndef GPIO_HAL_H_ -#define GPIO_HAL_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Specifies whether software-based pin toggle is required - * - * Some MCUs allow GPIO pin toggling via direct register access. For these - * MCUs, define GPIO_HAL_CONF_ARCH_SW_TOGGLE to 0 and then implement - * gpio_hal_arch_toggle_pin() and gpio_hal_arch_toggle_pins() - * - * \sa gpio_hal_arch_toggle_pin() - * \sa gpio_hal_arch_toggle_pins() - */ -#ifdef GPIO_HAL_CONF_ARCH_SW_TOGGLE -#define GPIO_HAL_ARCH_SW_TOGGLE GPIO_HAL_CONF_ARCH_SW_TOGGLE -#else -#define GPIO_HAL_ARCH_SW_TOGGLE 1 -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief GPIO pin number representation - */ -typedef uint8_t gpio_hal_pin_t; - -/** - * \brief GPIO pin configuration - * - * A logical representation of a pin's configuration. It is an OR combination - * of GPIO_HAL_PIN_CFG_xyz macros. - */ -typedef uint32_t gpio_hal_pin_cfg_t; - -#ifdef GPIO_HAL_CONF_PIN_COUNT -#define GPIO_HAL_PIN_COUNT GPIO_HAL_CONF_PIN_COUNT -#else -#define GPIO_HAL_PIN_COUNT 32 -#endif - -#if GPIO_HAL_PIN_COUNT > 32 -typedef uint64_t gpio_hal_pin_mask_t; -#else -/** - * \brief GPIO pin mask representation - */ -typedef uint32_t gpio_hal_pin_mask_t; -#endif - -typedef void (*gpio_hal_callback_t)(gpio_hal_pin_mask_t pin_mask); -/*---------------------------------------------------------------------------*/ -#define GPIO_HAL_PIN_CFG_PULL_NONE 0x00 -#define GPIO_HAL_PIN_CFG_PULL_UP 0x01 -#define GPIO_HAL_PIN_CFG_PULL_DOWN 0x02 -#define GPIO_HAL_PIN_CFG_PULL_MASK (GPIO_HAL_PIN_CFG_PULL_UP | \ - GPIO_HAL_PIN_CFG_PULL_DOWN) - -#define GPIO_HAL_PIN_CFG_HYSTERESIS 0x10 - -#define GPIO_HAL_PIN_CFG_EDGE_NONE 0x00 -#define GPIO_HAL_PIN_CFG_EDGE_RISING 0x04 -#define GPIO_HAL_PIN_CFG_EDGE_FALLING 0x08 -#define GPIO_HAL_PIN_CFG_EDGE_BOTH (GPIO_HAL_PIN_CFG_EDGE_RISING | \ - GPIO_HAL_PIN_CFG_EDGE_FALLING) - -#define GPIO_HAL_PIN_CFG_INT_DISABLE 0x00 -#define GPIO_HAL_PIN_CFG_INT_ENABLE 0x80 -#define GPIO_HAL_PIN_CFG_INT_MASK 0x80 -/*---------------------------------------------------------------------------*/ -/** - * \brief Datatype for GPIO event handlers - * - * A GPIO event handler is a function that gets called whenever a pin triggers - * an event. The same handler can be registered to handle events for more than - * one pin by setting the respective pin's position but in \e pin_mask. - */ -typedef struct gpio_hal_event_handler_s { - struct gpio_hal_event_handler_s *next; - gpio_hal_callback_t handler; - gpio_hal_pin_mask_t pin_mask; -} gpio_hal_event_handler_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Unknown GPIO - * - * A default GPIO value for unknown GPIO - */ -#define GPIO_HAL_PIN_UNKNOWN 0xFF -/*---------------------------------------------------------------------------*/ -/** - * \name Core GPIO functions - * - * Functions implemented by the HAL itself - * @{ - */ -/** - * \brief Initialise the GPIO HAL - */ -void gpio_hal_init(void); - -/** - * \brief Register a function to be called whenever a pin triggers an event - * \param handler The handler representation - * - * The handler must be pre-allocated statically by the caller. - * - * This function can be used to register a function to be called by the HAL - * whenever a GPIO interrupt occurs. - * - * \sa gpio_hal_event_handler - */ -void gpio_hal_register_handler(gpio_hal_event_handler_t *handler); - -/** - * \brief The platform-independent GPIO event handler - * \param pins OR mask of pins that generated an event - * - * Whenever a GPIO input interrupt occurs (edge or level detection) and an ISR - * is triggered, the ISR must call this function, passing as argument an ORd - * mask of the pins that triggered the interrupt. This function will then - * call the registered event handlers (if any) for the pins that triggered the - * event. The platform code should make no assumptions as to the order that - * the handlers will be called. - * - * If a pin set in the mask has an event handler registered, this function - * will call the registered handler. - * - * This function will not clear any CPU interrupt flags, this should be done - * by the calling ISR. - * - * \sa gpio_hal_register_handler - */ -void gpio_hal_event_handler(gpio_hal_pin_mask_t pins); - -/** - * \brief Convert a pin to a pin mask - * \param pin The pin - * \return The corresponding mask - */ -#define gpio_hal_pin_to_mask(pin) ((gpio_hal_pin_mask_t)1 << (pin)) -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Functions to be provided by the platform - * - * All the functions below must be provided by the platform's developer. The - * HAL offers the developer a number of options of how to provide the required - * functionality. - * - * - The developer can provide a symbol. For example, the developer can create - * a .c file and implement a function called gpio_hal_arch_set_pin() - * - The developer can provide a function-like macro that has the same name as - * the function declared here. In this scenario, the declaration here will - * be removed by the pre-processor. For example, the developer can do - * something like: - * - * \code - * #define gpio_hal_arch_write_pin(p, v) platform_sdk_function(p, v) - * \endcode - * - * - The developer can provide a static inline implementation. For this to - * work, the developer can do something like: - * - * \code - * #define gpio_hal_arch_set_pin(p) set_pin(p) - * static inline void set_pin(gpio_hal_pin_t pin) { ... } - * \endcode - * - * In the latter two cases, the developer will likely provide implementations - * in a header file. In this scenario, one of the platform's configuration - * files must define GPIO_HAL_CONF_ARCH_HDR_PATH to the name of this header - * file. For example: - * - * \code - * #define GPIO_HAL_CONF_ARCH_HDR_PATH "dev/gpio-hal-arch.h" - * \endcode - * - * @{ - */ -/*---------------------------------------------------------------------------*/ -/* Include Arch-Specific conf */ -#ifdef GPIO_HAL_CONF_ARCH_HDR_PATH -#include GPIO_HAL_CONF_ARCH_HDR_PATH -#endif /* GPIO_HAL_CONF_ARCH_HDR_PATH */ -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_init -/** - * \brief Perform architecture specific gpio initaliaztion - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_init(void); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_interrupt_enable -/** - * \brief Enable interrupts for a gpio pin - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_interrupt_enable(gpio_hal_pin_t pin); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_interrupt_disable -/** - * \brief Disable interrupts for a gpio pin - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_interrupt_disable(gpio_hal_pin_t pin); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_pin_cfg_set -/** - * \brief Configure a gpio pin - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * \param cfg The configuration - * - * \e cfg is an OR mask of GPIO_HAL_PIN_CFG_xyz - * - * The implementation of this function also has to make sure that \e pin is - * configured as software-controlled GPIO. - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_pin_cfg_set(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_pin_cfg_get -/** - * \brief Read the configuration of a GPIO pin - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * \return An OR mask of GPIO_HAL_PIN_CFG_xyz - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -gpio_hal_pin_cfg_t gpio_hal_arch_pin_cfg_get(gpio_hal_pin_t pin); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_pin_set_input -/** - * \brief Configure a pin as GPIO input - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * - * The implementation of this function also has to make sure that \e pin is - * configured as software-controlled GPIO. - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_pin_set_input(gpio_hal_pin_t pin); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_pin_set_output -/** - * \brief Configure a pin as GPIO output - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * - * The implementation of this function also has to make sure that \e pin is - * configured as software-controlled GPIO. - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_pin_set_output(gpio_hal_pin_t pin); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_set_pin -/** - * \brief Set a GPIO pin to logical high - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_set_pin(gpio_hal_pin_t pin); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_clear_pin -/** - * \brief Clear a GPIO pin (logical low) - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_clear_pin(gpio_hal_pin_t pin); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_toggle_pin -/** - * \brief Toggle a GPIO pin - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * - * Some MCUs allow GPIO pin toggling directly via register access. In this - * case, it is a good idea to provide an implementation of this function. - * However, a default, software-based implementation is also provided by the - * HAL and can be used if the MCU does not have a pin toggle register. To use - * the HAL function, define GPIO_HAL_ARCH_SW_TOGGLE as 1. To provide your own - * implementation, define GPIO_HAL_ARCH_SW_TOGGLE as 0. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_toggle_pin(gpio_hal_pin_t pin); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_read_pin -/** - * \brief Read a GPIO pin - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * \retval 0 The pin is logical low - * \retval 1 The pin is logical high - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -uint8_t gpio_hal_arch_read_pin(gpio_hal_pin_t pin); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_write_pin -/** - * \brief Write a GPIO pin - * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1) - * \param value 0: Logical low; 1: Logical high - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_write_pin(gpio_hal_pin_t pin, uint8_t value); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_set_pins -/** - * \brief Set multiple pins to logical high - * \param pins An ORd pin mask of the pins to set - * - * A pin will be set to logical high if its position in \e pins is set. For - * example you can set pins 0 and 3 by passing 0x09. - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_set_pins(gpio_hal_pin_mask_t pins); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_clear_pins -/** - * \brief Clear multiple pins to logical low - * \param pins An ORd pin mask of the pins to clear - * - * A pin will be set to logical low if its position in \e pins is set. For - * example you can clear pins 0 and 3 by passing 0x09. - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_clear_pins(gpio_hal_pin_mask_t pins); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_toggle_pins -/** - * \brief Toggle multiple pins - * \param pins An ORd pin mask of the pins to toggle - * - * A pin will be toggled if its position in \e pins is set. For example you - * can toggle pins 0 and 3 by passing 0x09. - * - * Some MCUs allow GPIO pin toggling directly via register access. In this - * case, it is a good idea to provide an implementation of this function. - * However, a default, software-based implementation is also provided by the - * HAL and can be used if the MCU does not have a pin toggle register. To use - * the HAL function, define GPIO_HAL_ARCH_SW_TOGGLE as 1. To provide your own - * implementation, define GPIO_HAL_ARCH_SW_TOGGLE as 0. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_toggle_pins(gpio_hal_pin_mask_t pins); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_read_pins -/** - * \brief Read multiple pins - * \param pins An ORd pin mask of the pins to read - * \retval An ORd mask of the pins that are high - * - * If the position of the pin in \e pins is set and the pin is logical high - * then the position of the pin in the return value will be set. For example, - * if you pass 0x09 as the value of \e pins and the return value is 0x08 then - * pin 3 is logical high and pin 0 is logical low. - * - * It is the platform developer's responsibility to provide an implementation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -gpio_hal_pin_mask_t gpio_hal_arch_read_pins(gpio_hal_pin_mask_t pins); -#endif -/*---------------------------------------------------------------------------*/ -#ifndef gpio_hal_arch_write_pins -/** - * \brief Write multiple pins - * \param pins An ORd pin mask of the pins to write - * \param value An ORd mask of the value to write - * - * The function will modify GPIO pins that have their position in the mask set. - * pins, the function will write the value specified in the corresponding - * position in \e value. - - * For example, you can set pin 3 and clear pin 0 by a single call to this - * function. To achieve this, \e pins must be 0x09 and \e value 0x08. - * - * It is the platform developer's responsibility to provide an implementation. - * - * There is no guarantee that this function will result in an atomic operation. - * - * The implementation can be provided as a global symbol, an inline function - * or a function-like macro, as described above. - */ -void gpio_hal_arch_write_pins(gpio_hal_pin_mask_t pins, - gpio_hal_pin_mask_t value); -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -#endif /* GPIO_HAL_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/dev/leds.c b/os/dev/leds.c deleted file mode 100644 index f2ce82c29..000000000 --- a/os/dev/leds.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup leds - * @{ - * - * \file - * Implementation of the platform-independent aspects of the LED HAL - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" -#include "dev/leds.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#if LEDS_LEGACY_API -/*---------------------------------------------------------------------------*/ -void -leds_init(void) -{ - leds_arch_init(); -} -/*---------------------------------------------------------------------------*/ -void -leds_blink(void) -{ - /* Blink all leds that were initially off. */ - unsigned char blink; - blink = ~leds_arch_get(); - leds_toggle(blink); - - clock_delay(400); - - leds_toggle(blink); -} -/*---------------------------------------------------------------------------*/ -unsigned char -leds_get(void) { - return leds_arch_get(); -} -/*---------------------------------------------------------------------------*/ -void -leds_set(leds_mask_t ledv) -{ - leds_arch_set(ledv); -} -/*---------------------------------------------------------------------------*/ -void -leds_on(leds_mask_t ledv) -{ - leds_arch_set(leds_arch_get() | ledv); -} -/*---------------------------------------------------------------------------*/ -void -leds_off(leds_mask_t ledv) -{ - leds_arch_set(leds_arch_get() & ~ledv); -} -/*---------------------------------------------------------------------------*/ -void -leds_toggle(leds_mask_t ledv) -{ - leds_arch_set(leds_arch_get() ^ ledv); -} -/*---------------------------------------------------------------------------*/ -#else /* LEDS_LEGACY_API */ -/*---------------------------------------------------------------------------*/ -#if LEDS_COUNT -extern const leds_t leds_arch_leds[]; -#else -static const leds_t *leds_arch_leds = NULL; -#endif -/*---------------------------------------------------------------------------*/ -void -leds_init() -{ - leds_num_t led; - - for(led = 0; led < LEDS_COUNT; led++) { - gpio_hal_arch_pin_set_output(leds_arch_leds[led].pin); - } - leds_off(LEDS_ALL); -} -/*---------------------------------------------------------------------------*/ -void -leds_single_on(leds_num_t led) -{ - if(led >= LEDS_COUNT) { - return; - } - - if(leds_arch_leds[led].negative_logic) { - gpio_hal_arch_clear_pin(leds_arch_leds[led].pin); - } else { - gpio_hal_arch_set_pin(leds_arch_leds[led].pin); - } -} -/*---------------------------------------------------------------------------*/ -void -leds_single_off(leds_num_t led) -{ - if(led >= LEDS_COUNT) { - return; - } - - if(leds_arch_leds[led].negative_logic) { - gpio_hal_arch_set_pin(leds_arch_leds[led].pin); - } else { - gpio_hal_arch_clear_pin(leds_arch_leds[led].pin); - } -} -/*---------------------------------------------------------------------------*/ -void -leds_single_toggle(leds_num_t led) -{ - if(led >= LEDS_COUNT) { - return; - } - - gpio_hal_arch_toggle_pin(leds_arch_leds[led].pin); -} -/*---------------------------------------------------------------------------*/ -void -leds_on(leds_mask_t leds) -{ - leds_num_t led; - - for(led = 0; led < LEDS_COUNT; led++) { - if((1 << led) & leds) { - if(leds_arch_leds[led].negative_logic) { - gpio_hal_arch_clear_pin(leds_arch_leds[led].pin); - } else { - gpio_hal_arch_set_pin(leds_arch_leds[led].pin); - } - } - } -} -/*---------------------------------------------------------------------------*/ -void -leds_off(leds_mask_t leds) -{ - leds_num_t led; - - for(led = 0; led < LEDS_COUNT; led++) { - if((1 << led) & leds) { - if(leds_arch_leds[led].negative_logic) { - gpio_hal_arch_set_pin(leds_arch_leds[led].pin); - } else { - gpio_hal_arch_clear_pin(leds_arch_leds[led].pin); - } - } - } -} -/*---------------------------------------------------------------------------*/ -void -leds_toggle(leds_mask_t leds) -{ - leds_num_t led; - - for(led = 0; led < LEDS_COUNT; led++) { - if((1 << led) & leds) { - gpio_hal_arch_toggle_pin(leds_arch_leds[led].pin); - } - } -} -/*---------------------------------------------------------------------------*/ -void -leds_set(leds_mask_t leds) -{ - leds_off(LEDS_ALL); - leds_on(leds); -} -/*---------------------------------------------------------------------------*/ -leds_mask_t -leds_get() -{ - leds_mask_t rv = 0; - leds_num_t led; - uint8_t pin_state; - - for(led = 0; led < LEDS_COUNT; led++) { - pin_state = gpio_hal_arch_read_pin(leds_arch_leds[led].pin); - - if((leds_arch_leds[led].negative_logic == false && pin_state == 1) || - (leds_arch_leds[led].negative_logic == true && pin_state == 0)) { - rv |= 1 << led; - } - } - - return rv; -} -/*---------------------------------------------------------------------------*/ -#endif /* LEDS_LEGACY_API */ -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/os/dev/leds.h b/os/dev/leds.h deleted file mode 100644 index 654ed250e..000000000 --- a/os/dev/leds.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * Copyright (c) 2018, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup dev - * @{ - */ -/*---------------------------------------------------------------------------*/ -/** - * \defgroup leds LED Hardware Abstraction Layer - * - * The LED HAL provides a set of functions that can manipulate LEDS. - * - * Currently, the LED HAL supports two APIs: - * - * - The new, platform-independent API (recommended for all new platforms). - * - The legacy API (supported until all existing platforms have been ported - * to support the new API). - * - * The two APIs use very similar semantics and have an overlapping set of - * function calls. This is done so that platform-independent examples can - * work on all platforms, irrespective of which API each platform supports. - * - * The legacy API can be enabled by the platform code by defining - * LEDS_CONF_LEGACY_API 1. - * - * Once all platforms supported in contiki-ng/contiki-ng have been ported to - * the new API, the legacy API will be deleted without warning. For this - * reason, it is strongly recommended to use the new API for new platforms and - * for platforms hosted in external repositories. - * - * The new API provides a set of common LED manipulation functions that can be - * used in a platform-independent fashion. Functions exist to manipulate one - * LED at a time (\c leds_single_XYZ), as well as to manipulate multiple LEDs - * at a time (\c leds_XYZ). - * - * The assumption is that each LED is connected to a GPIO pin using either - * positive or negative logic. - * - * LEDs on a device are numbered incrementally, starting from 0 and counting - * upwards. Thus, if a device has 3 LEDs they will be numbered 0, 1 and 2. - * Convenience macros (LEDS_LED_n) are provided to refer to LEDs. These macros - * can be used as arguments to functions that manipulate a single LED, such - * as leds_single_on() but \e not leds_on(). - * - * The legacy scheme that uses colours to refer to LEDs is maintained, without - * semantic changes, but with minor changes in logic: - * - * - Firstly, we now define 5 LED colours: Red, Green, Blue, Yellow, Orange. - * These are sufficient to cover all currently-supported platforms. - * - Secondly, unless a platform specifies that a LED of a specific colour - * exists, the HAL will assume that it does not. - * - Trying to manipulate a non-existent LED will not cause build errors, but - * will not cause any changes to LED state either. - * - We no longer map non-existing LED colours to existing ones. - * - * Note that, in order to avoid changes to LED colour semantics between the - * two APIs, references to LED by colour are bitwise OR masks and should - * therefore only be used as argument to functions that manipulate multiple - * LEDS (e.g. leds_off() and \e not leds_single_off()). - * - * In terms of porting for new platforms, developers simply have to: - * - * - Define variables of type leds_t to represent their platform's LEDs - * - Specify the number of LEDs on their device by defining LEDS_CONF_COUNT - * - Map red colours to numbers (e.g. \#define LEDS_CONF_RED 1) - * - * \file - * Header file for the LED HAL - * @{ - */ -/*---------------------------------------------------------------------------*/ -#ifndef LEDS_H_ -#define LEDS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "dev/gpio-hal.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#if LEDS_CONF_LEGACY_API -/** - * \brief Define to 1 to enabled the legacy LED API. - */ -#define LEDS_LEGACY_API LEDS_CONF_LEGACY_API -#else -#define LEDS_LEGACY_API 0 -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief A default LED colour for non-existing LEDs - */ -#define LEDS_COLOUR_NONE 0x00 -/*---------------------------------------------------------------------------*/ -/* LED colour to number mappings. Applicable to both APIs */ -#ifdef LEDS_CONF_RED -#define LEDS_RED LEDS_CONF_RED -#else -#define LEDS_RED LEDS_COLOUR_NONE -#endif - -#ifdef LEDS_CONF_GREEN -#define LEDS_GREEN LEDS_CONF_GREEN -#else -#define LEDS_GREEN LEDS_COLOUR_NONE -#endif - -#ifdef LEDS_CONF_BLUE -#define LEDS_BLUE LEDS_CONF_BLUE -#else -#define LEDS_BLUE LEDS_COLOUR_NONE -#endif - -#ifdef LEDS_CONF_YELLOW -#define LEDS_YELLOW LEDS_CONF_YELLOW -#else -#define LEDS_YELLOW LEDS_COLOUR_NONE -#endif - -#ifdef LEDS_CONF_ORANGE -#define LEDS_ORANGE LEDS_CONF_ORANGE -#else -#define LEDS_ORANGE LEDS_COLOUR_NONE -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief The LED number - */ -typedef uint8_t leds_num_t; - -/** - * \brief An OR mask datatype to represents multiple LEDs. - */ -typedef uint8_t leds_mask_t; -/*---------------------------------------------------------------------------*/ -#if LEDS_LEGACY_API -/*---------------------------------------------------------------------------*/ -#ifdef LEDS_CONF_ALL -#define LEDS_ALL LEDS_CONF_ALL -#else -#define LEDS_ALL 7 -#endif -/*---------------------------------------------------------------------------*/ -void leds_blink(void); - -/* Legacy LED API arch-specific functions */ -void leds_arch_init(void); -leds_mask_t leds_arch_get(void); -void leds_arch_set(leds_mask_t leds); -/*---------------------------------------------------------------------------*/ -#else /* LEDS_LEGACY_API */ -/*---------------------------------------------------------------------------*/ -#ifdef LEDS_CONF_COUNT -#define LEDS_COUNT LEDS_CONF_COUNT -#else -/** - * \brief The number of LEDs present on a device - */ -#define LEDS_COUNT 0 -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief The OR mask representation of all device LEDs - */ -#define LEDS_ALL ((1 << LEDS_COUNT) - 1) -/*---------------------------------------------------------------------------*/ -#endif /* LEDS_LEGACY_API */ -/*---------------------------------------------------------------------------*/ -#define LEDS_LED1 0x00 /**< Convenience macro to refer to the 1st LED (LED 1) */ -#define LEDS_LED2 0x01 /**< Convenience macro to refer to the 2nd LED (LED 2) */ -#define LEDS_LED3 0x02 /**< Convenience macro to refer to the 3rd LED (LED 3) */ -#define LEDS_LED4 0x03 /**< Convenience macro to refer to the 4th LED (LED 4) */ -#define LEDS_LED5 0x04 /**< Convenience macro to refer to the 5th LED (LED 5) */ -/*---------------------------------------------------------------------------*/ -/** - * \brief A LED logical representation - * - * \e pin corresponds to the GPIO pin a LED is driven by, using GPIO HAL pin - * representation. - * - * \e negative_logic should be set to false if the LED is active low. - */ -typedef struct leds_s { - gpio_hal_pin_t pin; - bool negative_logic; -} leds_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Convert a LED number to a mask representation - * \param l The pin number (normally a variable of type leds_num_t) - * \return An OR mask of type leds_mask_t - */ -#define LEDS_NUM_TO_MASK(l) (1 << (l)) -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise the LED HAL - * - * This function will set corresponding LED GPIO pins to output and will also - * set the initial state of all LEDs to off. - */ -void leds_init(void); - -/** - * \brief Turn a single LED on - * \param led The led - * - * The \e led argument should be the LED's number, in other words one of the - * LED_Ln macros. - * - * This function will not change the state of other LEDs. - */ -void leds_single_on(leds_num_t led); - -/** - * \brief Turn a single LED off - * \param led The led - * - * The \e led argument should be the LED's number, in other words one of the - * LED_Ln macros. - * - * This function will not change the state of other LEDs. - */ -void leds_single_off(leds_num_t led); - -/** - * \brief Toggle a single LED - * \param led The led - * - * The \e led argument should be the LED's number, in other words one of the - * LED_Ln macros. - * - * This function will not change the state of other LEDs. - */ -void leds_single_toggle(leds_num_t led); - -/** - * \brief Turn on multiple LEDs - * \param leds The leds to be turned on as an OR mask - * - * The \e led argument should be a bitwise mask of the LEDs to be changed. - * For example, to turn on LEDs 1 and 3, you should pass - * LED_NUM_TO_MASK(LED_L1) | LED_NUM_TO_MASK(LED_L3) = 1 | 4 = 5 - * - * This function will not change the state of other LEDs. - */ -void leds_on(leds_mask_t leds); - -/** - * \brief Turn off multiple LEDs - * \param leds The leds to be turned off as an OR mask - * - * The \e led argument should be a bitwise mask of the LEDs to be changed. - * For example, to turn on LEDs 1 and 3, you should pass - * LED_NUM_TO_MASK(LED_L1) | LED_NUM_TO_MASK(LED_L3) = 1 | 4 = 5 - * - * This function will not change the state of other LEDs. - */ -void leds_off(leds_mask_t leds); - -/** - * \brief Toggle multiple LEDs - * \param leds The leds to be toggled as an OR mask - * - * The \e led argument should be a bitwise mask of the LEDs to be changed. - * For example, to turn on LEDs 1 and 3, you should pass - * LED_NUM_TO_MASK(LED_L1) | LED_NUM_TO_MASK(LED_L3) = 1 | 4 = 5 - * - * This function will not change the state of other LEDs. - */ -void leds_toggle(leds_mask_t leds); - -/** - * \brief Set all LEDs to a specific state - * \param leds The state of all LEDs afer this function returns - * - * The \e led argument should be a bitwise mask of the LEDs to be changed. - * For example, to turn on LEDs 1 and 3, you should pass - * LED_NUM_TO_MASK(LED_L1) | LED_NUM_TO_MASK(LED_L3) = 1 | 4 = 5 - * - * This function will change the state of all LEDs. LEDs not set in the \e leds - * mask will be turned off. - */ -void leds_set(leds_mask_t leds); - -/** - * \brief Get the status of LEDs - * \return A bitwise mask indicating whether each individual LED is on or off - * - * The return value is a bitwise mask. If a bit is set then the corresponding - * LED is on. - */ -leds_mask_t leds_get(void); -/*---------------------------------------------------------------------------*/ -#endif /* LEDS_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/dev/nullradio.c b/os/dev/nullradio.c deleted file mode 100644 index 7f17d5638..000000000 --- a/os/dev/nullradio.c +++ /dev/null @@ -1,107 +0,0 @@ -#include "dev/nullradio.h" - - -/*---------------------------------------------------------------------------*/ -static int -init(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -prepare(const void *payload, unsigned short payload_len) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -transmit(unsigned short transmit_len) -{ - return RADIO_TX_OK; -} -/*---------------------------------------------------------------------------*/ -static int -send(const void *payload, unsigned short payload_len) -{ - prepare(payload, payload_len); - return transmit(payload_len); -} -/*---------------------------------------------------------------------------*/ -static int -radio_read(void *buf, unsigned short buf_len) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_value(radio_param_t param, radio_value_t *value) -{ - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_value(radio_param_t param, radio_value_t value) -{ - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -get_object(radio_param_t param, void *dest, size_t size) -{ - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -static radio_result_t -set_object(radio_param_t param, const void *src, size_t size) -{ - return RADIO_RESULT_NOT_SUPPORTED; -} -/*---------------------------------------------------------------------------*/ -const struct radio_driver nullradio_driver = - { - init, - prepare, - transmit, - send, - radio_read, - channel_clear, - receiving_packet, - pending_packet, - on, - off, - get_value, - set_value, - get_object, - set_object - }; -/*---------------------------------------------------------------------------*/ diff --git a/os/dev/nullradio.h b/os/dev/nullradio.h deleted file mode 100644 index 87acb3450..000000000 --- a/os/dev/nullradio.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef NULLRADIO_H -#define NULLRADIO_H - -#include "dev/radio.h" - -extern const struct radio_driver nullradio_driver; - -#endif /* NULLRADIO_H */ diff --git a/os/dev/radio.h b/os/dev/radio.h deleted file mode 100644 index 4cb266608..000000000 --- a/os/dev/radio.h +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the radio API - * \author - * Adam Dunkels - * Joakim Eriksson - * Niclas Finne - * Nicolas Tsiftes - */ - -/** - * \addtogroup dev - * @{ - */ - -/** - * \defgroup radio Radio API - * - * The radio API module defines a set of functions that a radio device - * driver must implement. - * - * @{ - */ - -#ifndef RADIO_H_ -#define RADIO_H_ - -#include - -/** - * Each radio has a set of parameters that designate the current - * configuration and state of the radio. Parameters can either have - * values of type radio_value_t, or, when this type is insufficient, a - * generic object that is specified by a memory pointer and the size - * of the object. - * - * The radio_value_t type is set to an integer type that can hold most - * values used to configure the radio, and is therefore the most - * common type used for a parameter. Certain parameters require - * objects of a considerably larger size than radio_value_t, however, - * and in these cases the documentation below for the parameter will - * indicate this. - * - * All radio parameters that can vary during runtime are prefixed by - * "RADIO_PARAM", whereas those "parameters" that are guaranteed to - * remain immutable are prefixed by "RADIO_CONST". Each mutable - * parameter has a set of valid parameter values. When attempting to - * set a parameter to an invalid value, the radio will return - * RADIO_RESULT_INVALID_VALUE. - * - * Some radios support only a subset of the defined radio parameters. - * When trying to set or get such an unsupported parameter, the radio - * will return RADIO_RESULT_NOT_SUPPORTED. - */ - -typedef int radio_value_t; -typedef unsigned radio_param_t; - -enum { - - /* Radio power mode determines if the radio is on - (RADIO_POWER_MODE_ON) or off (RADIO_POWER_MODE_OFF). */ - RADIO_PARAM_POWER_MODE, - - /* - * Channel used for radio communication. The channel depends on the - * communication standard used by the radio. The values can range - * from RADIO_CONST_CHANNEL_MIN to RADIO_CONST_CHANNEL_MAX. - */ - RADIO_PARAM_CHANNEL, - - /* Personal area network identifier, which is used by the address filter. */ - RADIO_PARAM_PAN_ID, - - /* Short address (16 bits) for the radio, which is used by the address - filter. */ - RADIO_PARAM_16BIT_ADDR, - - /* - * Radio receiver mode determines if the radio has address filter - * (RADIO_RX_MODE_ADDRESS_FILTER) and auto-ACK (RADIO_RX_MODE_AUTOACK) - * enabled. This parameter is set as a bit mask. - */ - RADIO_PARAM_RX_MODE, - - /* - * Radio transmission mode determines if the radio has send on CCA - * (RADIO_TX_MODE_SEND_ON_CCA) enabled or not. This parameter is set - * as a bit mask. - */ - RADIO_PARAM_TX_MODE, - - /* - * Transmission power in dBm. The values can range from - * RADIO_CONST_TXPOWER_MIN to RADIO_CONST_TXPOWER_MAX. - * - * Some radios restrict the available values to a subset of this - * range. If an unavailable TXPOWER value is requested to be set, - * the radio may select another TXPOWER close to the requested - * one. When getting the value of this parameter, the actual value - * used by the radio will be returned. - */ - RADIO_PARAM_TXPOWER, - - /* - * Clear channel assessment threshold in dBm. This threshold - * determines the minimum RSSI level at which the radio will assume - * that there is a packet in the air. - * - * The CCA threshold must be set to a level above the noise floor of - * the deployment. Otherwise mechanisms such as send-on-CCA and - * low-power-listening duty cycling protocols may not work - * correctly. Hence, the default value of the system may not be - * optimal for any given deployment. - */ - RADIO_PARAM_CCA_THRESHOLD, - - /* Received signal strength indicator in dBm. */ - RADIO_PARAM_RSSI, - - /* RSSI of the last received packet */ - RADIO_PARAM_LAST_RSSI, - - /* Link quality of the last received packet */ - RADIO_PARAM_LAST_LINK_QUALITY, - - /* - * Long (64 bits) address for the radio, which is used by the address filter. - * The address is specified in network byte order. - * - * Because this parameter value is larger than what fits in radio_value_t, - * it needs to be used with radio.get_object()/set_object(). - */ - RADIO_PARAM_64BIT_ADDR, - - /* Last packet timestamp, of type rtimer_clock_t. - * Because this parameter value mat be larger than what fits in radio_value_t, - * it needs to be used with radio.get_object()/set_object(). */ - RADIO_PARAM_LAST_PACKET_TIMESTAMP, - - /* For enabling and disabling the SHR search */ - RADIO_PARAM_SHR_SEARCH, - - /* Constants (read only) */ - - /* The lowest radio channel. */ - RADIO_CONST_CHANNEL_MIN, - /* The highest radio channel. */ - RADIO_CONST_CHANNEL_MAX, - - /* The minimum transmission power in dBm. */ - RADIO_CONST_TXPOWER_MIN, - /* The maximum transmission power in dBm. */ - RADIO_CONST_TXPOWER_MAX, - - /* A pointer to TSCH timings in micro-seconds (tsch_timeslot_timing_usec *) */ - RADIO_CONST_TSCH_TIMING, - - /* The physical layer header+footer overhead in bytes, after SFD. - * On IEEE 802.15.4 at 2.4 GHz: 1 byte for len + 2 for CRC => 3 */ - RADIO_CONST_PHY_OVERHEAD, - - /* The air time of one byte in usec, e.g. 32 for IEEE 802.15.4 at 2.4 GHz */ - RADIO_CONST_BYTE_AIR_TIME, - - /* The delay in usec between a call to the radio API's transmit function and - * the end of SFD transmission */ - RADIO_CONST_DELAY_BEFORE_TX, - - /* The delay in usec between turning on the radio and it being actually - * listening (able to hear a preamble) */ - RADIO_CONST_DELAY_BEFORE_RX, - - /* The delay in usec between the end of SFD reception for an incoming frame - * and the radio API starting to return receiving_packet() != 0 */ - RADIO_CONST_DELAY_BEFORE_DETECT, -}; - -/* Radio power modes */ -enum { - RADIO_POWER_MODE_OFF, - RADIO_POWER_MODE_ON, - RADIO_POWER_MODE_CARRIER_ON, - RADIO_POWER_MODE_CARRIER_OFF -}; - -/** - * The radio reception mode controls address filtering and automatic - * transmission of acknowledgements in the radio (if such operations - * are supported by the radio). A single parameter is used to allow - * setting these features simultaneously as an atomic operation. - * - * To enable both address filter and transmissions of automatic - * acknowledgments: - * - * NETSTACK_RADIO.set_value(RADIO_PARAM_RX_MODE, - * RADIO_RX_MODE_ADDRESS_FILTER | RADIO_RX_MODE_AUTOACK); - */ -#define RADIO_RX_MODE_ADDRESS_FILTER (1 << 0) -#define RADIO_RX_MODE_AUTOACK (1 << 1) -#define RADIO_RX_MODE_POLL_MODE (1 << 2) - -/** - * The radio transmission mode controls whether transmissions should - * be done using clear channel assessment (if supported by the - * radio). If send-on-CCA is enabled, the radio's send function will - * wait for a radio-specific time window for the channel to become - * clear. If this does not happen, the send function will return - * RADIO_TX_COLLISION. - */ -#define RADIO_TX_MODE_SEND_ON_CCA (1 << 0) - -/* Radio return values when setting or getting radio parameters. */ -typedef enum { - RADIO_RESULT_OK, - RADIO_RESULT_NOT_SUPPORTED, - RADIO_RESULT_INVALID_VALUE, - RADIO_RESULT_ERROR -} radio_result_t; - -/* Radio return values for transmissions. */ -enum { - RADIO_TX_OK, - RADIO_TX_ERR, - RADIO_TX_COLLISION, - RADIO_TX_NOACK, -}; - -/** - * The structure of a device driver for a radio in Contiki. - */ -struct radio_driver { - - int (* init)(void); - - /** Prepare the radio with a packet to be sent. */ - int (* prepare)(const void *payload, unsigned short payload_len); - - /** Send the packet that has previously been prepared. */ - int (* transmit)(unsigned short transmit_len); - - /** Prepare & transmit a packet. */ - int (* send)(const void *payload, unsigned short payload_len); - - /** Read a received packet into a buffer. */ - int (* read)(void *buf, unsigned short buf_len); - - /** Perform a Clear-Channel Assessment (CCA) to find out if there is - a packet in the air or not. */ - int (* channel_clear)(void); - - /** Check if the radio driver is currently receiving a packet */ - int (* receiving_packet)(void); - - /** Check if the radio driver has just received a packet */ - int (* pending_packet)(void); - - /** Turn the radio on. */ - int (* on)(void); - - /** Turn the radio off. */ - int (* off)(void); - - /** Get a radio parameter value. */ - radio_result_t (* get_value)(radio_param_t param, radio_value_t *value); - - /** Set a radio parameter value. */ - radio_result_t (* set_value)(radio_param_t param, radio_value_t value); - - /** - * Get a radio parameter object. The argument 'dest' must point to a - * memory area of at least 'size' bytes, and this memory area will - * contain the parameter object if the function succeeds. - */ - radio_result_t (* get_object)(radio_param_t param, void *dest, size_t size); - - /** - * Set a radio parameter object. The memory area referred to by the - * argument 'src' will not be accessed after the function returns. - */ - radio_result_t (* set_object)(radio_param_t param, const void *src, - size_t size); - -}; - -#endif /* RADIO_H_ */ - -/** @} */ -/** @} */ diff --git a/os/dev/rom.h b/os/dev/rom.h deleted file mode 100644 index 1cb65d3db..000000000 --- a/os/dev/rom.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 ROM_H -#define ROM_H - -int rom_pread(void *buf, int nbytes, off_t offset); - -int rom_pwrite(const void *buf, int nbytes, off_t offset); - -int rom_erase(long nbytes, off_t offset); - -#endif /* ROM_H */ diff --git a/os/dev/serial-line.c b/os/dev/serial-line.c deleted file mode 100644 index 80ff5510b..000000000 --- a/os/dev/serial-line.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#include "dev/serial-line.h" -#include /* for memcpy() */ - -#include "lib/ringbuf.h" - -#ifdef SERIAL_LINE_CONF_BUFSIZE -#define BUFSIZE SERIAL_LINE_CONF_BUFSIZE -#else /* SERIAL_LINE_CONF_BUFSIZE */ -#define BUFSIZE 128 -#endif /* SERIAL_LINE_CONF_BUFSIZE */ - -#if (BUFSIZE & (BUFSIZE - 1)) != 0 -#error SERIAL_LINE_CONF_BUFSIZE must be a power of two (i.e., 1, 2, 4, 8, 16, 32, 64, ...). -#error Change SERIAL_LINE_CONF_BUFSIZE in contiki-conf.h. -#endif - -#ifndef IGNORE_CHAR -#define IGNORE_CHAR(c) (c == 0x0d) -#endif - -#ifndef END -#define END 0x0a -#endif - -static struct ringbuf rxbuf; -static uint8_t rxbuf_data[BUFSIZE]; - -PROCESS(serial_line_process, "Serial driver"); - -process_event_t serial_line_event_message; - -/*---------------------------------------------------------------------------*/ -int -serial_line_input_byte(unsigned char c) -{ - static uint8_t overflow = 0; /* Buffer overflow: ignore until END */ - - if(IGNORE_CHAR(c)) { - return 0; - } - - if(!overflow) { - /* Add character */ - if(ringbuf_put(&rxbuf, c) == 0) { - /* Buffer overflow: ignore the rest of the line */ - overflow = 1; - } - } else { - /* Buffer overflowed: - * Only (try to) add terminator characters, otherwise skip */ - if(c == END && ringbuf_put(&rxbuf, c) != 0) { - overflow = 0; - } - } - - /* Wake up consumer process */ - process_poll(&serial_line_process); - return 1; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(serial_line_process, ev, data) -{ - static char buf[BUFSIZE]; - static int ptr; - - PROCESS_BEGIN(); - - serial_line_event_message = process_alloc_event(); - ptr = 0; - - while(1) { - /* Fill application buffer until newline or empty */ - int c = ringbuf_get(&rxbuf); - - if(c == -1) { - /* Buffer empty, wait for poll */ - PROCESS_YIELD(); - } else { - if(c != END) { - if(ptr < BUFSIZE-1) { - buf[ptr++] = (uint8_t)c; - } else { - /* Ignore character (wait for EOL) */ - } - } else { - /* Terminate */ - buf[ptr++] = (uint8_t)'\0'; - - /* Broadcast event */ - process_post(PROCESS_BROADCAST, serial_line_event_message, buf); - - /* Wait until all processes have handled the serial line event */ - if(PROCESS_ERR_OK == - process_post(PROCESS_CURRENT(), PROCESS_EVENT_CONTINUE, NULL)) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_CONTINUE); - } - ptr = 0; - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -serial_line_init(void) -{ - ringbuf_init(&rxbuf, rxbuf_data, sizeof(rxbuf_data)); - process_start(&serial_line_process, NULL); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/dev/serial-line.h b/os/dev/serial-line.h deleted file mode 100644 index 4d4cec346..000000000 --- a/os/dev/serial-line.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * Generic serial I/O process header filer - * \author - * Adam Dunkels - * - */ -#ifndef SERIAL_LINE_H_ -#define SERIAL_LINE_H_ - -#include "contiki.h" - -/** - * Event posted when a line of input has been received. - * - * This event is posted when an entire line of input has been received - * from the serial port. A data pointer to the incoming line of input - * is sent together with the event. - */ -extern process_event_t serial_line_event_message; - -/** - * Get one byte of input from the serial driver. - * - * This function is to be called from the actual RS232 driver to get - * one byte of serial data input. - * - * For systems using low-power CPU modes, the return value of the - * function can be used to determine if the CPU should be woken up or - * not. If the function returns non-zero, the CPU should be powered - * up. If the function returns zero, the CPU can continue to be - * powered down. - * - * \param c The data that is received. - * - * \return Non-zero if the CPU should be powered up, zero otherwise. - */ - -int serial_line_input_byte(unsigned char c); - -void serial_line_init(void); - -PROCESS_NAME(serial_line_process); - -#endif /* SERIAL_LINE_H_ */ diff --git a/os/dev/slip.c b/os/dev/slip.c deleted file mode 100644 index 7426151c4..000000000 --- a/os/dev/slip.c +++ /dev/null @@ -1,331 +0,0 @@ -/* -*- C -*- */ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "net/ipv6/uip.h" -#include "dev/slip.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define SLIP_END 0300 -#define SLIP_ESC 0333 -#define SLIP_ESC_END 0334 -#define SLIP_ESC_ESC 0335 -/*---------------------------------------------------------------------------*/ -PROCESS(slip_process, "SLIP driver"); -/*---------------------------------------------------------------------------*/ -static uint8_t slip_active; -/*---------------------------------------------------------------------------*/ -#if SLIP_CONF_WITH_STATS -static uint16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop; -#define SLIP_STATISTICS(statement) statement -#else -#define SLIP_STATISTICS(statement) -#endif -/*---------------------------------------------------------------------------*/ -/* Must be at least one byte larger than UIP_BUFSIZE! */ -#define RX_BUFSIZE (UIP_BUFSIZE + 16) -/*---------------------------------------------------------------------------*/ -enum { - STATE_TWOPACKETS = 0, /* We have 2 packets and drop incoming data. */ - STATE_OK = 1, - STATE_ESC = 2, - STATE_RUBBISH = 3, -}; -/*---------------------------------------------------------------------------*/ -/* - * Variables begin and end manage the buffer space in a cyclic - * fashion. The first used byte is at begin and end is one byte past - * the last. I.e. [begin, end) is the actively used space. - * - * If begin != pkt_end we have a packet at [begin, pkt_end), - * furthermore, if state == STATE_TWOPACKETS we have one more packet at - * [pkt_end, end). If more bytes arrive in state STATE_TWOPACKETS - * they are discarded. - */ -static uint8_t state = STATE_TWOPACKETS; -static uint16_t begin, next_free; -static uint8_t rxbuf[RX_BUFSIZE]; -static uint16_t pkt_end; /* SLIP_END tracker. */ - -static void (*input_callback)(void) = NULL; -/*---------------------------------------------------------------------------*/ -void -slip_set_input_callback(void (*c)(void)) -{ - input_callback = c; -} -/*---------------------------------------------------------------------------*/ -void -slip_send(void) -{ - slip_write(uip_buf, uip_len); -} -/*---------------------------------------------------------------------------*/ -void -slip_write(const void *_ptr, int len) -{ - const uint8_t *ptr = _ptr; - uint16_t i; - uint8_t c; - - slip_arch_writeb(SLIP_END); - - for(i = 0; i < len; ++i) { - c = *ptr++; - if(c == SLIP_END) { - slip_arch_writeb(SLIP_ESC); - c = SLIP_ESC_END; - } else if(c == SLIP_ESC) { - slip_arch_writeb(SLIP_ESC); - c = SLIP_ESC_ESC; - } - slip_arch_writeb(c); - } - - slip_arch_writeb(SLIP_END); -} -/*---------------------------------------------------------------------------*/ -static void -rxbuf_init(void) -{ - begin = next_free = pkt_end = 0; - state = STATE_OK; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -slip_poll_handler(uint8_t *outbuf, uint16_t blen) -{ - /* - * Interrupt can not change begin but may change pkt_end. - * If pkt_end != begin it will not change again. - */ - if(begin != pkt_end) { - uint16_t len; - uint16_t cur_next_free; - uint16_t cur_ptr; - int esc = 0; - - if(begin < pkt_end) { - uint16_t i; - len = 0; - for(i = begin; i < pkt_end; ++i) { - if(len > blen) { - len = 0; - break; - } - if(esc) { - if(rxbuf[i] == SLIP_ESC_ESC) { - outbuf[len] = SLIP_ESC; - len++; - } else if(rxbuf[i] == SLIP_ESC_END) { - outbuf[len] = SLIP_END; - len++; - } - esc = 0; - } else if(rxbuf[i] == SLIP_ESC) { - esc = 1; - } else { - outbuf[len] = rxbuf[i]; - len++; - } - } - } else { - uint16_t i; - len = 0; - for(i = begin; i < RX_BUFSIZE; ++i) { - if(len > blen) { - len = 0; - break; - } - if(esc) { - if(rxbuf[i] == SLIP_ESC_ESC) { - outbuf[len] = SLIP_ESC; - len++; - } else if(rxbuf[i] == SLIP_ESC_END) { - outbuf[len] = SLIP_END; - len++; - } - esc = 0; - } else if(rxbuf[i] == SLIP_ESC) { - esc = 1; - } else { - outbuf[len] = rxbuf[i]; - len++; - } - } - for(i = 0; i < pkt_end; ++i) { - if(len > blen) { - len = 0; - break; - } - if(esc) { - if(rxbuf[i] == SLIP_ESC_ESC) { - outbuf[len] = SLIP_ESC; - len++; - } else if(rxbuf[i] == SLIP_ESC_END) { - outbuf[len] = SLIP_END; - len++; - } - esc = 0; - } else if(rxbuf[i] == SLIP_ESC) { - esc = 1; - } else { - outbuf[len] = rxbuf[i]; - len++; - } - } - } - - /* Remove data from buffer together with the copied packet. */ - pkt_end = pkt_end + 1; - if(pkt_end == RX_BUFSIZE) { - pkt_end = 0; - } - if(pkt_end != next_free) { - cur_next_free = next_free; - cur_ptr = pkt_end; - while(cur_ptr != cur_next_free) { - if(rxbuf[cur_ptr] == SLIP_END) { - uint16_t tmp_begin = pkt_end; - pkt_end = cur_ptr; - begin = tmp_begin; - /* One more packet is buffered, need to be polled again! */ - process_poll(&slip_process); - break; - } - cur_ptr++; - if(cur_ptr == RX_BUFSIZE) { - cur_ptr = 0; - } - } - if(cur_ptr == cur_next_free) { - /* no more pending full packet found */ - begin = pkt_end; - } - } else { - begin = pkt_end; - } - return len; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(slip_process, ev, data) -{ - PROCESS_BEGIN(); - - rxbuf_init(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - - slip_active = 1; - - /* Move packet from rxbuf to buffer provided by uIP. */ - uip_len = slip_poll_handler(uip_buf, UIP_BUFSIZE); - - if(uip_len > 0) { - if(input_callback) { - input_callback(); - } - tcpip_input(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -int -slip_input_byte(unsigned char c) -{ - uint16_t cur_end; - switch(state) { - case STATE_RUBBISH: - if(c == SLIP_END) { - state = STATE_OK; - } - return 0; - - case STATE_ESC: - if(c != SLIP_ESC_END && c != SLIP_ESC_ESC) { - state = STATE_RUBBISH; - SLIP_STATISTICS(slip_rubbish++); - next_free = pkt_end; /* remove rubbish */ - return 0; - } - state = STATE_OK; - break; - } - - if(c == SLIP_ESC) { - state = STATE_ESC; - } - - /* add_char: */ - cur_end = next_free; - next_free = next_free + 1; - if(next_free == RX_BUFSIZE) { - next_free = 0; - } - if(next_free == begin) { /* rxbuf is full */ - state = STATE_RUBBISH; - SLIP_STATISTICS(slip_overflow++); - next_free = pkt_end; /* remove rubbish */ - return 0; - } - rxbuf[cur_end] = c; - - if(c == SLIP_END) { - /* - * We have a new packet, possibly of zero length. - * - * There may already be one packet buffered. - */ - if(cur_end != pkt_end) { /* Non zero length. */ - if(begin == pkt_end) { /* None buffered. */ - pkt_end = cur_end; - } else { - SLIP_STATISTICS(slip_twopackets++); - } - process_poll(&slip_process); - return 1; - } else { - /* Empty packet, reset the pointer */ - next_free = cur_end; - } - return 0; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/dev/slip.h b/os/dev/slip.h deleted file mode 100644 index bb0ca3baf..000000000 --- a/os/dev/slip.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- C -*- */ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef SLIP_H_ -#define SLIP_H_ - -#include "contiki.h" - -PROCESS_NAME(slip_process); - -/** - * Send an IP packet from the uIP buffer with SLIP. - */ -void slip_send(void); - -/** - * Input a SLIP byte. - * - * This function is called by the RS232/SIO device driver to pass - * incoming bytes to the SLIP driver. The function can be called from - * an interrupt context. - * - * For systems using low-power CPU modes, the return value of the - * function can be used to determine if the CPU should be woken up or - * not. If the function returns non-zero, the CPU should be powered - * up. If the function returns zero, the CPU can continue to be - * powered down. - * - * \param c The data that is to be passed to the SLIP driver - * - * \return Non-zero if the CPU should be powered up, zero otherwise. - */ -int slip_input_byte(unsigned char c); - -/** - * Send using SLIP len bytes starting from the location pointed to by ptr - */ -void slip_write(const void *ptr, int len); - -/** - * Set a function to be called when there is activity on the SLIP - * interface; used for detecting if a node is a gateway node. - */ -void slip_set_input_callback(void (*callback)(void)); - -/* - * These machine dependent functions and an interrupt service routine - * must be provided externally (slip_arch.c). - */ -void slip_arch_init(void); -void slip_arch_writeb(unsigned char c); - -#endif /* SLIP_H_ */ diff --git a/os/dev/spi-legacy.h b/os/dev/spi-legacy.h deleted file mode 100644 index d1600c785..000000000 --- a/os/dev/spi-legacy.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Basic SPI macros - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef SPI_LEGACY_H_ -#define SPI_LEGACY_H_ - -/* Define macros to use for checking SPI transmission status depending - on if it is possible to wait for TX buffer ready. This is possible - on for example MSP430 but not on AVR. */ -#ifdef SPI_WAITFORTxREADY -#define SPI_WAITFORTx_BEFORE() SPI_WAITFORTxREADY() -#define SPI_WAITFORTx_AFTER() -#define SPI_WAITFORTx_ENDED() SPI_WAITFOREOTx() -#else /* SPI_WAITFORTxREADY */ -#define SPI_WAITFORTx_BEFORE() -#define SPI_WAITFORTx_AFTER() SPI_WAITFOREOTx() -#define SPI_WAITFORTx_ENDED() -#endif /* SPI_WAITFORTxREADY */ - -extern unsigned char spi_busy; - -void spi_init(void); - -/* Write one character to SPI */ -#define SPI_WRITE(data) \ - do { \ - SPI_WAITFORTx_BEFORE(); \ - SPI_TXBUF = data; \ - SPI_WAITFOREOTx(); \ - } while(0) - -/* Write one character to SPI - will not wait for end - useful for multiple writes with wait after final */ -#define SPI_WRITE_FAST(data) \ - do { \ - SPI_WAITFORTx_BEFORE(); \ - SPI_TXBUF = data; \ - SPI_WAITFORTx_AFTER(); \ - } while(0) - -/* Read one character from SPI */ -#define SPI_READ(data) \ - do { \ - SPI_TXBUF = 0; \ - SPI_WAITFOREORx(); \ - data = SPI_RXBUF; \ - } while(0) - -/* Flush the SPI read register */ -#ifndef SPI_FLUSH -#define SPI_FLUSH() \ - do { \ - SPI_RXBUF; \ - } while(0) -#endif - -#endif /* SPI_LEGACY_H_ */ diff --git a/os/dev/spi.c b/os/dev/spi.c deleted file mode 100644 index 091cf8e51..000000000 --- a/os/dev/spi.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2016-2017, Yanzi Networks. - * Copyright (c) 2017, University of Bristol - http://www.bristol.ac.uk/ - * 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 HOLDER 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup spi-hal - * @{ - * - * \file - * Implementation of the platform-independent aspects of the SPI HAL - */ -/*---------------------------------------------------------------------------*/ -#include -#include "contiki.h" -#include -#include -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_acquire(const spi_device_t *dev) -{ - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return SPI_DEV_STATUS_EINVAL; - } - - /* lock and open the bus */ - return spi_arch_lock_and_open(dev); -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_release(const spi_device_t *dev) -{ - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return SPI_DEV_STATUS_EINVAL; - } - - /* close and unlock the bus */ - return spi_arch_close_and_unlock(dev); -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_select(const spi_device_t *dev) -{ - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_NOT_OWNED; - } - - gpio_hal_arch_clear_pin(dev->pin_spi_cs); - - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_deselect(const spi_device_t *dev) -{ - gpio_hal_arch_set_pin(dev->pin_spi_cs); - - return SPI_DEV_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -bool -spi_has_bus(const spi_device_t *dev) -{ - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return false; - } - - return spi_arch_has_lock(dev); -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_write_byte(const spi_device_t *dev, uint8_t data) -{ - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return SPI_DEV_STATUS_EINVAL; - } - - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_LOCKED; - } - - return spi_arch_transfer(dev, &data, 1, 0, 0, 0); -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_write(const spi_device_t *dev, const uint8_t *data, int size) -{ - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return SPI_DEV_STATUS_EINVAL; - } - - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_LOCKED; - } - - return spi_arch_transfer(dev, data, size, 0, 0, 0); -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_read_byte(const spi_device_t *dev, uint8_t *buf) -{ - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return SPI_DEV_STATUS_EINVAL; - } - - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_LOCKED; - } - - return spi_arch_transfer(dev, NULL, 0, buf, 1, 0); -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_read(const spi_device_t *dev, uint8_t *buf, int size) -{ - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return SPI_DEV_STATUS_EINVAL; - } - - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_LOCKED; - } - - return spi_arch_transfer(dev, NULL, 0, buf, size, 0); -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_read_skip(const spi_device_t *dev, int size) -{ - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return SPI_DEV_STATUS_EINVAL; - } - - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_LOCKED; - } - - return spi_arch_transfer(dev, NULL, 0, NULL, 0, size); -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_transfer(const spi_device_t *dev, - const uint8_t *wdata, int wsize, - uint8_t *rbuf, int rsize, int ignore) -{ - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return SPI_DEV_STATUS_EINVAL; - } - - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_LOCKED; - } - - if(wdata == NULL && wsize > 0) { - return SPI_DEV_STATUS_EINVAL; - } - - if(rbuf == NULL && rsize > 0) { - return SPI_DEV_STATUS_EINVAL; - } - - return spi_arch_transfer(dev, wdata, wsize, rbuf, rsize, ignore); -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_read_register(const spi_device_t *dev, uint8_t reg, uint8_t *data, int size) -{ - spi_status_t status; - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return SPI_DEV_STATUS_EINVAL; - } - - /* write the register first (will read a status) */ - status = spi_write_byte(dev, reg); - if(status != SPI_DEV_STATUS_OK) { - return status; - } - - /* then read the value (will read the value) */ - status = spi_read(dev, data, size); - if(status != SPI_DEV_STATUS_OK) { - return status; - } - - return status; -} -/*---------------------------------------------------------------------------*/ -spi_status_t -spi_strobe(const spi_device_t *dev, uint8_t strobe, uint8_t *result) -{ - if(dev == NULL || dev->spi_controller >= SPI_CONTROLLER_COUNT) { - return SPI_DEV_STATUS_EINVAL; - } - - if(!spi_arch_has_lock(dev)) { - return SPI_DEV_STATUS_BUS_LOCKED; - } - - return spi_arch_transfer(dev, &strobe, 1, result, 1, 0); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/os/dev/spi.h b/os/dev/spi.h deleted file mode 100644 index 9dda05b8e..000000000 --- a/os/dev/spi.h +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright (c) 2016-2017, Yanzi Networks. - * Copyright (c) 2017, University of Bristol - http://www.bristol.ac.uk/ - * 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 HOLDER 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup dev - * @{ - * - * \defgroup spi-hal SPI Hardware Abstraction Layer - * - * The SPI HAL provides a set of common functions that can be used in a - * platform-independent fashion. - * - * - * @{ - * - * \file - * Header file for the SPI HAL - */ -/*---------------------------------------------------------------------------*/ -#ifndef SPI_H_ -#define SPI_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "gpio-hal.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/* Include Arch-Specific conf */ -#ifdef SPI_HAL_CONF_ARCH_HDR_PATH -#include SPI_HAL_CONF_ARCH_HDR_PATH -#endif /* SPI_HAL_CONF_ARCH_HDR_PATH */ -/*---------------------------------------------------------------------------*/ -#ifdef SPI_CONF_CONTROLLER_COUNT -/** - * \brief Number of SPI module instances on a chip - */ -#define SPI_CONTROLLER_COUNT SPI_CONF_CONTROLLER_COUNT -#else -#define SPI_CONTROLLER_COUNT 0 -#endif -/*---------------------------------------------------------------------------*/ -/* Convenience macros to enumerate SPI module instances on a chip */ -#define SPI_CONTROLLER_SPI0 0 -#define SPI_CONTROLLER_SPI1 1 -/*---------------------------------------------------------------------------*/ -/** - * \brief SPI return codes - * - * @{ - */ -typedef enum { - SPI_DEV_STATUS_OK, /* Everything OK */ - SPI_DEV_STATUS_EINVAL, /* Erroneous input value */ - SPI_DEV_STATUS_TRANSFER_ERR, /* Error during SPI transfer */ - SPI_DEV_STATUS_BUS_LOCKED, /* SPI bus is already locked */ - SPI_DEV_STATUS_BUS_NOT_OWNED, /* SPI bus is locked by someone else */ - SPI_DEV_STATUS_CLOSED /* SPI bus has not opened properly */ -} spi_status_t; -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief SPI Device Configuration - * - * This is a structure to an architecture-independent SPI configuration. - * - * @{ - */ - -typedef struct spi_device { - gpio_hal_pin_t pin_spi_sck; /* SPI SCK pin */ - gpio_hal_pin_t pin_spi_miso; /* SPI MISO pin */ - gpio_hal_pin_t pin_spi_mosi; /* SPI MOSI pin */ - gpio_hal_pin_t pin_spi_cs; /* SPI Chip Select pin */ - uint32_t spi_bit_rate; /* SPI bit rate */ - uint8_t spi_pha; /* SPI mode phase */ - uint8_t spi_pol; /* SPI mode polarity */ - uint8_t spi_controller; /* ID of SPI controller to use */ -} spi_device_t; -/** @} */ -/*---------------------------------------------------------------------------*/ -/* These are architecture-independent functions to be used by SPI devices. */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Locks and then opens an SPI controller - * \param dev An SPI device configuration which defines the controller - * to be locked and the opening configuration. - * \return SPI return code - */ -spi_status_t spi_acquire(const spi_device_t *dev); - -/** - * \brief Closes and then unlocks an SPI controller - * \param dev An SPI device configuration which defines the controller - * to be closed and unlocked. - * \return SPI return code - * - * Releasing an SPI controller should put it in low-power mode. - * This should work only if the device has already locked the SPI - * controller. - */ -spi_status_t spi_release(const spi_device_t *dev); - -/** - * \brief Selects the SPI peripheral - * \param dev An SPI device configuration which defines the CS pin. - * \return SPI return code - * - * Clears the CS pin. This should work only if the device has - * already locked the SPI controller. - */ -spi_status_t spi_select(const spi_device_t *dev); - -/** - * \brief Deselects the SPI peripheral - * \param dev An SPI device configuration which defines the CS pin. - * \return SPI return code - * - * Sets the CS pin. Lock is not required. - */ -spi_status_t spi_deselect(const spi_device_t *dev); - -/** - * \brief Checks if a device has locked an SPI controller - * \param dev An SPI device configuration which defines the controller. - * \return true if the device has the lock, false otherwise. - */ -bool spi_has_bus(const spi_device_t *dev); - -/** - * \brief Writes a single byte to an SPI device - * \param dev An SPI device configuration. - * \param data A byte of data - * \return SPI return code - * - * It should work only if the device has already locked the SPI controller. - */ -spi_status_t spi_write_byte(const spi_device_t *dev, uint8_t data); - -/** - * \brief Reads a single byte from an SPI device - * \param dev An SPI device configuration. - * \param data A pointer to a byte of data - * \return SPI return code - * - * It should work only if the device has already locked the SPI controller. - */ -spi_status_t spi_read_byte(const spi_device_t *dev, uint8_t *data); - -/** - * \brief Writes a buffer to an SPI device - * \param dev An SPI device configuration. - * \param data A pointer to the data - * \param size Size of the data to write - * \return SPI return code - * - * It should work only if the device has already locked the SPI controller. - */ -spi_status_t spi_write(const spi_device_t *dev, - const uint8_t *data, int size); - -/** - * \brief Reads a buffer from an SPI device - * \param dev An SPI device configuration. - * \param data A pointer to the data - * \param size Size of the data to read - * \return SPI return code - * - * It should work only if the device has already locked the SPI controller. - */ -spi_status_t spi_read(const spi_device_t *dev, uint8_t *data, int size); - -/** - * \brief Reads and ignores data from an SPI device - * \param dev An SPI device configuration. - * \param size Size of the data to read and ignore - * \return SPI return code - * - * Reads size bytes from the SPI and throws them away. - * It should work only if the device has already locked the SPI controller. - */ -spi_status_t spi_read_skip(const spi_device_t *dev, int size); - -/** - * \brief Performs a generic SPI transfer - * \param dev An SPI device configuration. - * \param data A pointer to the data to be written. Set it to NULL to - * skip writing. - * \param wsize Size of data to write. - * \param buf A pointer to buffer to copy the data read. Set to NULL - * to skip reading. - * \param rsize Size of data to read. - * \param ignore Size of data to read and ignore. - * \return SPI return code - * - * It should work only if the device has already locked the SPI controller. - * A total of rlen+ignore_len bytes will be read. The first rlen bytes will - * be copied to buf. The remaining ignore_len bytes won't be copied to the - * buffer. The maximum of wlen and rlen+ignore_len of bytes will be transfered. - */ -spi_status_t spi_transfer(const spi_device_t *dev, - const uint8_t *data, int wsize, - uint8_t *buf, int rsize, int ignore); - -/** - * \brief Reads and Writes one byte from/to an SPI device - * \param dev An SPI device configuration. - * \param strobe Byte to write - * \param status Pointer to byte to read - * \return SPI return code - * - * It should work only if the device has already locked the SPI controller. - */ -spi_status_t spi_strobe(const spi_device_t *dev, uint8_t strobe, - uint8_t *status); - -/** - * \brief Reads a buffer of bytes from a register of an SPI device - * \param dev An SPI device configuration. - * \param reg Register - * \param data A pointer to the data - * \param size Size of the data to read - * \return SPI return code - * - * It should work only if the device has already locked the SPI controller. - */ -spi_status_t spi_read_register(const spi_device_t *dev, uint8_t reg, - uint8_t *data, int size); - -/*---------------------------------------------------------------------------*/ -/* These are architecture-specific functions to be implemented by each CPU. */ -/*---------------------------------------------------------------------------*/ - -/** - * \brief Checks if a device has locked an SPI controller - * \param dev An SPI device configuration which defines the controller - * to be checked if it is locked and the respective device. - * \return 1 if the device has the lock, 0 otherwise. - * - */ -bool spi_arch_has_lock(const spi_device_t *dev); - -/** - * \brief Checks if an SPI controller is locked by any device - * \param dev An SPI device configuration which defines the controller - * to be checked. - * \return 1 if the controller is locked, 0 otherwise. - * - */ -bool spi_arch_is_bus_locked(const spi_device_t *dev); - -/** - * \brief Locks and opens an SPI controller to the configuration specified. - * \param dev An SPI device configuration. - * \return SPI return code - * - * This should work only if the device has already locked the SPI - * controller. - * - */ -spi_status_t spi_arch_lock_and_open(const spi_device_t *dev); - -/** - * \brief Closes and unlocks an SPI controller - * \param dev An SPI device configuration that specifies the controller. - * \return SPI return code - * - * This should turn off the SPI controller to put it in low power mode - * and unlock it. - * It should work only if the device has already locked the SPI - * controller. - * - */ -spi_status_t spi_arch_close_and_unlock(const spi_device_t *dev); - -/** - * \brief Performs an SPI transfer - * \param dev An SPI device configuration that specifies the controller. - * \param data A pointer to the data to be written. Set it to NULL to - * skip writing. - * \param wlen Length of data to write. - * \param buf A pointer to buffer to copy the data read. Set to NULL - * to skip reading. - * \param rlen Length of data to read. - * \param ignore_len Length of data to read and ignore. - * \return SPI return code - * - * It should work only if the device has already locked the SPI controller. - * A total of rlen+ignore_len bytes will be read. The first rlen bytes will - * be copied to buf. The remaining ignore_len bytes won't be copied to the - * buffer. The maximum of wlen and rlen+ignore_len of bytes will be transfered. - */ -spi_status_t spi_arch_transfer(const spi_device_t *dev, - const uint8_t *data, int wlen, - uint8_t *buf, int rlen, - int ignore_len); - -#endif /* SPI_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/dev/watchdog.h b/os/dev/watchdog.h deleted file mode 100644 index 3985239aa..000000000 --- a/os/dev/watchdog.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#ifndef WATCHDOG_H_ -#define WATCHDOG_H_ - -void watchdog_init(void); -void watchdog_start(void); -void watchdog_periodic(void); -void watchdog_stop(void); - -void watchdog_reboot(void); - -#endif /* WATCHDOG_H_ */ diff --git a/os/dev/xmem.h b/os/dev/xmem.h deleted file mode 100644 index 235cb8607..000000000 --- a/os/dev/xmem.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 XMEM_H -#define XMEM_H - -void xmem_init(void); - -int xmem_pread(void *buf, int nbytes, unsigned long offset); - -int xmem_pwrite(const void *buf, int nbytes, unsigned long offset); - -int xmem_erase(long nbytes, unsigned long offset); - -#endif /* XMEM_H */ diff --git a/os/lib/aes-128.c b/os/lib/aes-128.c deleted file mode 100644 index 3b0082e7c..000000000 --- a/os/lib/aes-128.c +++ /dev/null @@ -1,173 +0,0 @@ -/* --COPYRIGHT--,BSD - * Copyright (c) 2011, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * --/COPYRIGHT--*/ -/* - * TI_aes_128_encr_only.c - * - * Created on: Nov 3, 2011 - * Author: Eric Peeters - */ - -/** - * \file - * Wrapped AES-128 implementation from Texas Instruments. - * \author - * Konrad Krentz - */ - -#include "lib/aes-128.h" -#include - -static const uint8_t sbox[256] = { -0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, -0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, -0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, -0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, -0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, -0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, -0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, -0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, -0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, -0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, -0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, -0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, -0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, -0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, -0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, -0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; - -static uint8_t round_keys[11][AES_128_KEY_LENGTH]; - -/*---------------------------------------------------------------------------*/ -/* multiplies by 2 in GF(2) */ -static uint8_t -galois_mul2(uint8_t value) -{ - uint8_t xor_val = (value >> 7) * 0x1b; - return ((value << 1) ^ xor_val); -} -/*---------------------------------------------------------------------------*/ -static void -set_key(const uint8_t *key) -{ - uint8_t i; - uint8_t j; - uint8_t rcon; - - rcon = 0x01; - memcpy(round_keys[0], key, AES_128_KEY_LENGTH); - for(i = 1; i <= 10; i++) { - round_keys[i][0] = sbox[round_keys[i - 1][13]] ^ round_keys[i - 1][0] ^ rcon; - round_keys[i][1] = sbox[round_keys[i - 1][14]] ^ round_keys[i - 1][1]; - round_keys[i][2] = sbox[round_keys[i - 1][15]] ^ round_keys[i - 1][2]; - round_keys[i][3] = sbox[round_keys[i - 1][12]] ^ round_keys[i - 1][3]; - for(j = 4; j < AES_128_BLOCK_SIZE; j++) { - round_keys[i][j] = round_keys[i - 1][j] ^ round_keys[i][j - 4]; - } - rcon = galois_mul2(rcon); - } -} -/*---------------------------------------------------------------------------*/ -static void -encrypt(uint8_t *state) -{ - uint8_t buf1, buf2, buf3, buf4, round, i; - - /* round 0 */ - /* AddRoundKey */ - for(i = 0; i < AES_128_BLOCK_SIZE; i++) { - state[i] = state[i] ^ round_keys[0][i]; - } - - for(round = 1; round <= 10; round++) { - /* ByteSub */ - for(i = 0; i < AES_128_BLOCK_SIZE; i++) { - state[i] = sbox[state[i]]; - } - - /* ShiftRow */ - buf1 = state[1]; - state[1] = state[5]; - state[5] = state[9]; - state[9] = state[13]; - state[13] = buf1; - - buf1 = state[2]; - buf2 = state[6]; - state[2] = state[10]; - state[6] = state[14]; - state[10] = buf1; - state[14] = buf2; - - buf1 = state[15]; - state[15] = state[11]; - state[11] = state[7]; - state[7] = state[3]; - state[3] = buf1; - - /* last round skips MixColumn */ - if(round < 10) { - /* MixColumn */ - for(i = 0; i < 4; i++) { - buf4 = (i << 2); - buf1 = state[buf4] ^ state[buf4 + 1] ^ state[buf4 + 2] ^ state[buf4 + 3]; - buf2 = state[buf4]; - buf3 = state[buf4] ^ state[buf4 + 1]; - buf3 = galois_mul2(buf3); - - state[buf4] = state[buf4] ^ buf3 ^ buf1; - - buf3 = state[buf4 + 1] ^ state[buf4 + 2]; - buf3 = galois_mul2(buf3); - state[buf4 + 1] = state[buf4 + 1] ^ buf3 ^ buf1; - - buf3 = state[buf4 + 2] ^ state[buf4 + 3]; - buf3 = galois_mul2(buf3); - state[buf4 + 2] = state[buf4 + 2] ^ buf3 ^ buf1; - - buf3 = state[buf4 + 3] ^ buf2; - buf3 = galois_mul2(buf3); - state[buf4 + 3] = state[buf4 + 3] ^ buf3 ^ buf1; - } - } - - /* AddRoundKey */ - for(i = 0; i < AES_128_BLOCK_SIZE; i++) { - state[i] = state[i] ^ round_keys[round][i]; - } - } -} -/*---------------------------------------------------------------------------*/ -const struct aes_128_driver aes_128_driver = { - set_key, - encrypt -}; -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/aes-128.h b/os/lib/aes-128.h deleted file mode 100644 index e003c2b25..000000000 --- a/os/lib/aes-128.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013, Hasso-Plattner-Institut. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * AES-128. - * \author - * Konrad Krentz - */ - -#ifndef AES_128_H_ -#define AES_128_H_ - -#include "contiki.h" - -#define AES_128_BLOCK_SIZE 16 -#define AES_128_KEY_LENGTH 16 - -#ifdef AES_128_CONF -#define AES_128 AES_128_CONF -#else /* AES_128_CONF */ -#define AES_128 aes_128_driver -#endif /* AES_128_CONF */ - -/** - * Structure of AES drivers. - */ -struct aes_128_driver { - - /** - * \brief Sets the current key. - */ - void (* set_key)(const uint8_t *key); - - /** - * \brief Encrypts. - */ - void (* encrypt)(uint8_t *plaintext_and_result); -}; - -extern const struct aes_128_driver AES_128; - -#endif /* AES_128_H_ */ diff --git a/os/lib/assert.c b/os/lib/assert.c deleted file mode 100644 index 8268f15e1..000000000 --- a/os/lib/assert.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - -void -_xassert(const char *file, int lineno) -{ - printf("Assertion failed: file %s, line %d.\n", file, lineno); - /* - * loop for a while; - * call _reset_vector__(); - */ -} diff --git a/os/lib/assert.h b/os/lib/assert.h deleted file mode 100644 index 3689a8b1d..000000000 --- a/os/lib/assert.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 ASSERT_H_ -#define ASSERT_H_ - -#undef assert -#ifdef NDEBUG -#define assert(e) ((void)0) -#else -#define assert(e) ((e) ? (void)0 : _xassert(__FILE__, __LINE__)) -void _xassert(const char *, int); -#endif - -#ifndef CTASSERT /* Allow lint to override */ -#define CTASSERT(x) _CTASSERT(x, __LINE__) -#define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] -#endif - -#endif /* ASSERT_H_ */ diff --git a/os/lib/ccm-star.c b/os/lib/ccm-star.c deleted file mode 100644 index 4cc8723a1..000000000 --- a/os/lib/ccm-star.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2013, Hasso-Plattner-Institut. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * AES_128-based CCM* implementation. - * \author - * Original: Konrad Krentz - * Generified version: Justin King-Lacroix - */ - -#include "ccm-star.h" -#include "lib/aes-128.h" -#include - -/* see RFC 3610 */ -#define CCM_STAR_AUTH_FLAGS(Adata, M) ((Adata ? (1u << 6) : 0) | (((M - 2u) >> 1) << 3) | 1u) -#define CCM_STAR_ENCRYPTION_FLAGS 1 - -/*---------------------------------------------------------------------------*/ -static void -set_iv(uint8_t *iv, - uint8_t flags, - const uint8_t *nonce, - uint8_t counter) -{ - iv[0] = flags; - memcpy(iv + 1, nonce, CCM_STAR_NONCE_LENGTH); - iv[14] = 0; - iv[15] = counter; -} -/*---------------------------------------------------------------------------*/ -/* XORs the block m[pos] ... m[pos + 15] with K_{counter} */ -static void -ctr_step(const uint8_t *nonce, - uint8_t pos, - uint8_t *m_and_result, - uint8_t m_len, - uint8_t counter) -{ - uint8_t a[AES_128_BLOCK_SIZE]; - uint8_t i; - - set_iv(a, CCM_STAR_ENCRYPTION_FLAGS, nonce, counter); - AES_128.encrypt(a); - - for(i = 0; (pos + i < m_len) && (i < AES_128_BLOCK_SIZE); i++) { - m_and_result[pos + i] ^= a[i]; - } -} -/*---------------------------------------------------------------------------*/ -static void -mic(const uint8_t *nonce, - const uint8_t *m, uint8_t m_len, - const uint8_t *a, uint8_t a_len, - uint8_t *result, - uint8_t mic_len) -{ - uint8_t x[AES_128_BLOCK_SIZE]; - uint8_t pos; - uint8_t i; - - set_iv(x, CCM_STAR_AUTH_FLAGS(a_len, mic_len), nonce, m_len); - AES_128.encrypt(x); - - if(a_len) { - x[1] = x[1] ^ a_len; - for(i = 2; (i - 2 < a_len) && (i < AES_128_BLOCK_SIZE); i++) { - x[i] ^= a[i - 2]; - } - - AES_128.encrypt(x); - - pos = 14; - while(pos < a_len) { - for(i = 0; (pos + i < a_len) && (i < AES_128_BLOCK_SIZE); i++) { - x[i] ^= a[pos + i]; - } - pos += AES_128_BLOCK_SIZE; - AES_128.encrypt(x); - } - } - - if(m_len) { - pos = 0; - while(pos < m_len) { - for(i = 0; (pos + i < m_len) && (i < AES_128_BLOCK_SIZE); i++) { - x[i] ^= m[pos + i]; - } - pos += AES_128_BLOCK_SIZE; - AES_128.encrypt(x); - } - } - - ctr_step(nonce, 0, x, AES_128_BLOCK_SIZE, 0); - - memcpy(result, x, mic_len); -} -/*---------------------------------------------------------------------------*/ -static void -ctr(const uint8_t *nonce, uint8_t *m, uint8_t m_len) -{ - uint8_t pos; - uint8_t counter; - - pos = 0; - counter = 1; - while(pos < m_len) { - ctr_step(nonce, pos, m, m_len, counter++); - pos += AES_128_BLOCK_SIZE; - } -} -/*---------------------------------------------------------------------------*/ -static void -set_key(const uint8_t *key) -{ - AES_128.set_key(key); -} -/*---------------------------------------------------------------------------*/ -static void -aead(const uint8_t* nonce, - uint8_t* m, uint8_t m_len, - const uint8_t* a, uint8_t a_len, - uint8_t *result, uint8_t mic_len, - int forward) -{ - if(!forward) { - /* decrypt */ - ctr(nonce, m, m_len); - } - - mic(nonce, - m, m_len, - a, a_len, - result, - mic_len); - - if(forward) { - /* encrypt */ - ctr(nonce, m, m_len); - } -} -/*---------------------------------------------------------------------------*/ -const struct ccm_star_driver ccm_star_driver = { - set_key, - aead -}; -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/ccm-star.h b/os/lib/ccm-star.h deleted file mode 100644 index 06296fb44..000000000 --- a/os/lib/ccm-star.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013, Hasso-Plattner-Institut. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * CCM* header file. - * \author - * Original: Konrad Krentz - * Generified version: Justin King-Lacroix - */ -#ifndef CCM_STAR_H_ -#define CCM_STAR_H_ - -#include "contiki.h" - -#ifdef CCM_STAR_CONF -#define CCM_STAR CCM_STAR_CONF -#else /* CCM_STAR_CONF */ -#define CCM_STAR ccm_star_driver -#endif /* CCM_STAR_CONF */ - -#define CCM_STAR_NONCE_LENGTH 13 - -/** - * Structure of CCM* drivers. - */ -struct ccm_star_driver { - - /** - * \brief Sets the key in use. Default implementation calls AES_128.set_key(). - * \param key The key to use. - */ - void (* set_key)(const uint8_t* key); - - /** - * \brief Combines authentication and encryption. - * \param nonce The nonce to use. CCM_STAR_NONCE_LENGTH bytes long. - * \param m message to encrypt or decrypt - * \param a Additional authenticated data - * \param result The generated MIC will be put here - * \param mic_len The size of the MIC to be generated. <= 16. - * \param forward != 0 if used in forward direction. - */ - void (* aead)(const uint8_t* nonce, - uint8_t* m, uint8_t m_len, - const uint8_t* a, uint8_t a_len, - uint8_t *result, uint8_t mic_len, - int forward); -}; - -extern const struct ccm_star_driver CCM_STAR; - -#endif /* CCM_STAR_H_ */ diff --git a/os/lib/circular-list.c b/os/lib/circular-list.c deleted file mode 100644 index 2c04d8418..000000000 --- a/os/lib/circular-list.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * Copyright (c) 2017, James Pope - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup circular-singly-linked-list - * @{ - * - * \file - * Implementation of circular singly linked lists - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/circular-list.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -struct cl { - struct cl *next; -}; -/*---------------------------------------------------------------------------*/ -void -circular_list_init(circular_list_t cl) -{ - *cl = NULL; -} -/*---------------------------------------------------------------------------*/ -void * -circular_list_head(circular_list_t cl) -{ - return *cl; -} -/*---------------------------------------------------------------------------*/ -void * -circular_list_tail(circular_list_t cl) -{ - struct cl *this; - - if(*cl == NULL) { - return NULL; - } - - for(this = *cl; this->next != *cl; this = this->next); - - return this; -} -/*---------------------------------------------------------------------------*/ -void -circular_list_remove(circular_list_t cl, void *element) -{ - struct cl *this, *previous; - - if(*cl == NULL) { - return; - } - - /* - * We start traversing from the second element. - * The head will be visited last. We always update the list's head after - * removal, just in case we have just removed the head. - */ - previous = *cl; - this = previous->next; - - do { - if(this == element) { - previous->next = this->next; - *cl = this->next == this ? NULL : previous; - return; - } - previous = this; - this = this->next; - } while(this != ((struct cl *)*cl)->next); -} -/*---------------------------------------------------------------------------*/ -void -circular_list_add(circular_list_t cl, void *element) -{ - struct cl *head; - - if(element == NULL) { - return; - } - - /* Don't add twice */ - circular_list_remove(cl, element); - - head = *cl; - - if(head == NULL) { - /* If the list was empty, we update the new element to point to itself */ - ((struct cl *)element)->next = element; - } else { - /* If the list exists, we add the new element between the current head and - * the previously second element. */ - ((struct cl *)element)->next = head->next; - head->next = element; - } - - /* In all cases, the new element becomes the list's new head */ - *cl = element; -} -/*---------------------------------------------------------------------------*/ -unsigned long -circular_list_length(circular_list_t cl) -{ - unsigned long len = 1; - struct cl *this; - - if(circular_list_is_empty(cl)) { - return 0; - } - - for(this = *cl; this->next != *cl; this = this->next) { - len++; - } - - return len; -} -/*---------------------------------------------------------------------------*/ -bool -circular_list_is_empty(circular_list_t cl) -{ - return *cl == NULL ? true : false; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/lib/circular-list.h b/os/lib/circular-list.h deleted file mode 100644 index 2edcaf808..000000000 --- a/os/lib/circular-list.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * Copyright (c) 2017, James Pope - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup data - * @{ - * - * \defgroup circular-singly-linked-list Circular, singly-linked list - * - * This library provides functions for the creation and manipulation of - * circular, singly-linked lists. - * - * A circular, singly-linked list is declared using the CIRCULAR_LIST macro. - * Elements must be allocated by the calling code and must be of a C struct - * datatype. In this struct, the first field must be a pointer called \e next. - * This field will be used by the library to maintain the list. Application - * code must not modify this field directly. - * - * Functions that modify the list (add / remove) will, in the general case, - * update the list's head and item order. If you call one of these functions - * as part of a list traversal, it is advised to stop / restart traversing - * after the respective function returns. - * @{ - */ -/*---------------------------------------------------------------------------*/ -#ifndef CIRCULAR_LIST_H_ -#define CIRCULAR_LIST_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Define a circular, singly-linked list. - * - * This macro defines a circular, singly-linked list. - * - * The datatype for elements must be a C struct. The struct's first member must - * be a pointer called \e next. This is used internally by the library to - * maintain data structure integrity and must not be modified directly by - * application code. - * - * \param name The name of the circular, singly-linked list. - */ -#define CIRCULAR_LIST(name) \ - static void *name##_circular_list = NULL; \ - static circular_list_t name = (circular_list_t)&name##_circular_list -/*---------------------------------------------------------------------------*/ -/** - * \brief The circular, singly-linked list datatype - */ -typedef void **circular_list_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise a circular, singly-linked list. - * \param cl The circular, singly-linked list. - */ -void circular_list_init(circular_list_t cl); - -/** - * \brief Return the tail of a circular, singly-linked list. - * \param cl The circular, singly-linked list. - * \return A pointer to the list's head, or NULL if the list is empty - */ -void *circular_list_head(circular_list_t cl); - -/** - * \brief Return the tail of a circular, singly-linked list. - * \param cl The circular, singly-linked list. - * \return A pointer to the list's tail, or NULL if the list is empty - */ -void *circular_list_tail(circular_list_t cl); - -/** - * \brief Add an element to a circular, singly-linked list. - * \param cl The circular, singly-linked list. - * \param element A pointer to the element to be added. - * - * The caller should make no assumptions as to the position in the list of the - * new element. - * - * After this function returns, the list's head is not guaranteed to be the - * same as it was before the addition. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void circular_list_add(circular_list_t cl, void *element); - -/** - * \brief Remove an element from a circular, singly-linked list. - * \param cl The circular, singly-linked list. - * \param element A pointer to the element to be removed. - * - * After this function returns, the list's head is not guaranteed to be the - * same as it was before the addition. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void circular_list_remove(circular_list_t cl, void *element); - -/** - * \brief Get the length of a circular, singly-linked list. - * \param cl The circular, singly-linked list. - * \return The number of elements in the list - */ -unsigned long circular_list_length(circular_list_t cl); - -/** - * \brief Determine whether a circular, singly-linked list is empty. - * \param cl The circular, singly-linked list. - * \retval true The list is empty - * \retval false The list is not empty - */ -bool circular_list_is_empty(circular_list_t cl); -/*---------------------------------------------------------------------------*/ -#endif /* CIRCULAR_LIST_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/lib/crc16.c b/os/lib/crc16.c deleted file mode 100644 index 22a665103..000000000 --- a/os/lib/crc16.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** \addtogroup crc16 - * @{ */ - -/** - * \file - * Implementation of the CRC16 calculcation - * \author - * Adam Dunkels - * - */ - -/* CITT CRC16 polynomial ^16 + ^12 + ^5 + 1 */ -/*---------------------------------------------------------------------------*/ -unsigned short -crc16_add(unsigned char b, unsigned short acc) -{ - /* - acc = (unsigned char)(acc >> 8) | (acc << 8); - acc ^= b; - acc ^= (unsigned char)(acc & 0xff) >> 4; - acc ^= (acc << 8) << 4; - acc ^= ((acc & 0xff) << 4) << 1; - */ - - acc ^= b; - acc = (acc >> 8) | (acc << 8); - acc ^= (acc & 0xff00) << 4; - acc ^= (acc >> 8) >> 4; - acc ^= (acc & 0xff00) >> 5; - return acc; -} -/*---------------------------------------------------------------------------*/ -unsigned short -crc16_data(const unsigned char *data, int len, unsigned short acc) -{ - int i; - - for(i = 0; i < len; ++i) { - acc = crc16_add(*data, acc); - ++data; - } - return acc; -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/os/lib/crc16.h b/os/lib/crc16.h deleted file mode 100644 index f8ce5b7ae..000000000 --- a/os/lib/crc16.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the CRC16 calculcation - * \author - * Adam Dunkels - * - */ - -/** \addtogroup lib - * @{ */ - -/** - * \defgroup crc16 CRC16 calculation - * - * The Cyclic Redundancy Check 16 is a hash function that produces a - * checksum that is used to detect errors in transmissions. The CRC16 - * calculation module is an iterative CRC calculator that can be used - * to cumulatively update a CRC checksum for every incoming byte. - * - * @{ - */ - -#ifndef CRC16_H_ -#define CRC16_H_ - -/** - * \brief Update an accumulated CRC16 checksum with one byte. - * \param b The byte to be added to the checksum - * \param crc The accumulated CRC that is to be updated. - * \return The updated CRC checksum. - * - * This function updates an accumulated CRC16 checksum - * with one byte. It can be used as a running checksum, or - * to checksum an entire data block. - * - * \note The algorithm used in this implementation is - * tailored for a running checksum and does not perform as - * well as a table-driven algorithm when checksumming an - * entire data block. - * - */ -unsigned short crc16_add(unsigned char b, unsigned short crc); - -/** - * \brief Calculate the CRC16 over a data area - * \param data Pointer to the data - * \param datalen The length of the data - * \param acc The accumulated CRC that is to be updated (or zero). - * \return The CRC16 checksum. - * - * This function calculates the CRC16 checksum of a data area. - * - * \note The algorithm used in this implementation is - * tailored for a running checksum and does not perform as - * well as a table-driven algorithm when checksumming an - * entire data block. - */ -unsigned short crc16_data(const unsigned char *data, int datalen, - unsigned short acc); - -#endif /* CRC16_H_ */ - -/** @} */ -/** @} */ diff --git a/os/lib/dbg-io/dbg.h b/os/lib/dbg-io/dbg.h deleted file mode 100644 index 6440b5eca..000000000 --- a/os/lib/dbg-io/dbg.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2015, Nordic Semiconductor - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup lib - * @{ - * - * \addtogroup dbg-io Portable debugging output functons - * @{ - * - * \file - * Header file for the dbg-io module. - * \author - * Wojciech Bober - * - */ -#ifndef DBG_H_ -#define DBG_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -/** - * \brief Print a stream of bytes - * \param seq A pointer to the stream - * \param len The number of bytes to print - * \return The number of printed bytes - */ -unsigned int dbg_send_bytes(const unsigned char *seq, unsigned int len); -/** - * \brief Print a character to debug output - * \param c Character to print - * \return Printed character - */ -int dbg_putchar(int c); -/*---------------------------------------------------------------------------*/ -#endif /* DBG_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/lib/dbg-io/printf.c b/os/lib/dbg-io/printf.c deleted file mode 100644 index 9749f1f7d..000000000 --- a/os/lib/dbg-io/printf.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2009, Simon Berg - * 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 "contiki.h" -#include "lib/dbg-io/dbg.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -static strformat_result -write_str(void *user_data, const char *data, unsigned int len) -{ - if(len > 0) { - dbg_send_bytes((unsigned char *)data, len); - } - return STRFORMAT_OK; -} -/*---------------------------------------------------------------------------*/ -static strformat_context_t ctxt = -{ - write_str, - NULL -}; -/*---------------------------------------------------------------------------*/ -int -printf(const char *fmt, ...) -{ - int res; - va_list ap; - va_start(ap, fmt); - res = format_str_v(&ctxt, fmt, ap); - va_end(ap); - return res; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/dbg-io/putchar.c b/os/lib/dbg-io/putchar.c deleted file mode 100644 index 26a35446d..000000000 --- a/os/lib/dbg-io/putchar.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2009, Simon Berg - * 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 "contiki.h" -#include "lib/dbg-io/dbg.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -int -putchar(int c) -{ - dbg_putchar(c); - return c; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/dbg-io/puts.c b/os/lib/dbg-io/puts.c deleted file mode 100644 index 93d73d3a5..000000000 --- a/os/lib/dbg-io/puts.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2009, Simon Berg - * 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 "contiki.h" -#include "lib/dbg-io/dbg.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -int -puts(const char *str) -{ - dbg_send_bytes((unsigned char *)str, strlen(str)); - dbg_putchar('\n'); - return 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/dbg-io/snprintf.c b/os/lib/dbg-io/snprintf.c deleted file mode 100644 index 96f99e568..000000000 --- a/os/lib/dbg-io/snprintf.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2009, Simon Berg - * 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 "contiki.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -struct fmt_buffer { - char *pos; - size_t left; -}; -/*---------------------------------------------------------------------------*/ -static strformat_result -buffer_str(void *user_data, const char *data, unsigned int len) -{ - struct fmt_buffer *buffer = (struct fmt_buffer *)user_data; - if(len >= buffer->left) { - len = buffer->left; - len--; - } - - memcpy(buffer->pos, data, len); - buffer->pos += len; - buffer->left -= len; - return STRFORMAT_OK; -} -/*---------------------------------------------------------------------------*/ -int -snprintf(char *str, size_t size, const char *format, ...) -{ - int res; - va_list ap; - va_start(ap, format); - res = vsnprintf(str, size, format, ap); - va_end(ap); - return res; -} -/*---------------------------------------------------------------------------*/ -int -vsnprintf(char *str, size_t size, const char *format, va_list ap) -{ - struct fmt_buffer buffer; - strformat_context_t ctxt; - int res; - ctxt.write_str = buffer_str; - ctxt.user_data = &buffer; - buffer.pos = str; - buffer.left = size; - res = format_str_v(&ctxt, format, ap); - *buffer.pos = '\0'; - return res; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/dbg-io/sprintf.c b/os/lib/dbg-io/sprintf.c deleted file mode 100644 index 4ecf5b540..000000000 --- a/os/lib/dbg-io/sprintf.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2009, Simon Berg - * 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 "contiki.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -static strformat_result -buffer_str(void *user_data, const char *data, unsigned int len) -{ - memcpy(*(char **)user_data, data, len); - (*(char **)user_data) += len; - return STRFORMAT_OK; -} -/*---------------------------------------------------------------------------*/ -int -sprintf(char *str, const char *format, ...) -{ - strformat_context_t ctxt; - int res; - va_list ap; - va_start(ap, format); - ctxt.write_str = buffer_str; - ctxt.user_data = &str; - res = format_str_v(&ctxt, format, ap); - *str = '\0'; - va_end(ap); - return res; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/dbg-io/strformat.c b/os/lib/dbg-io/strformat.c deleted file mode 100644 index b5ad18f89..000000000 --- a/os/lib/dbg-io/strformat.c +++ /dev/null @@ -1,707 +0,0 @@ -/* - * Copyright (c) 2009, Simon Berg - * 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 "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -#define HAVE_DOUBLE -#define HAVE_LONGLONG - -#ifndef LARGEST_SIGNED -#ifdef HAVE_LONGLONG -#define LARGEST_SIGNED long long int -#else -#define LARGEST_UNSIGNED long int -#endif /* HAVE_LONGLONG */ -#endif /* LARGEST_SIGNED */ - -#ifndef LARGEST_UNSIGNED -#ifdef HAVE_LONGLONG -#define LARGEST_UNSIGNED unsigned long long int -#else -#define LARGEST_UNSIGNED unsigned long int -#endif /* HAVE_LONGLONG */ -#endif /* LARGEST_UNSIGNED */ - -#ifndef POINTER_INT -#define POINTER_INT unsigned long -#endif -/*---------------------------------------------------------------------------*/ -typedef unsigned int FormatFlags; -/*---------------------------------------------------------------------------*/ -#define MAKE_MASK(shift, size) (((1 << size) - 1) << (shift)) -/*---------------------------------------------------------------------------*/ -#define JUSTIFY_SHIFT 0 -#define JUSTIFY_SIZE 1 -#define JUSTIFY_RIGHT 0x0000 -#define JUSTIFY_LEFT 0x0001 -#define JUSTIFY_MASK MAKE_MASK(JUSTIFY_SHIFT, JUSTIFY_SIZE) -/*---------------------------------------------------------------------------*/ -/* How a positive number is prefixed */ -#define POSITIVE_SHIFT (JUSTIFY_SHIFT + JUSTIFY_SIZE) -#define POSITIVE_NONE (0x0000 << POSITIVE_SHIFT) -#define POSITIVE_SPACE (0x0001 << POSITIVE_SHIFT) -#define POSITIVE_PLUS (0x0003 << POSITIVE_SHIFT) -#define POSITIVE_MASK MAKE_MASK(POSITIVE_SHIFT, POSITIVE_SIZE) - -#define POSITIVE_SIZE 2 -/*---------------------------------------------------------------------------*/ -#define ALTERNATE_FORM_SHIFT (POSITIVE_SHIFT + POSITIVE_SIZE) -#define ALTERNATE_FORM_SIZE 1 -#define ALTERNATE_FORM (0x0001 << ALTERNATE_FORM_SHIFT) -/*---------------------------------------------------------------------------*/ -#define PAD_SHIFT (ALTERNATE_FORM_SHIFT + ALTERNATE_FORM_SIZE) -#define PAD_SIZE 1 -#define PAD_SPACE (0x0000 << PAD_SHIFT) -#define PAD_ZERO (0x0001 << PAD_SHIFT) -/*---------------------------------------------------------------------------*/ -#define SIZE_SHIFT (PAD_SHIFT + PAD_SIZE) -#define SIZE_SIZE 3 -#define SIZE_CHAR (0x0001 << SIZE_SHIFT) -#define SIZE_SHORT (0x0002 << SIZE_SHIFT) -#define SIZE_INT (0x0000 << SIZE_SHIFT) -#define SIZE_LONG (0x0003 << SIZE_SHIFT) -#define SIZE_LONGLONG (0x0004 << SIZE_SHIFT) -#define SIZE_MASK MAKE_MASK(SIZE_SHIFT, SIZE_SIZE) -/*---------------------------------------------------------------------------*/ -#define CONV_SHIFT (SIZE_SHIFT + SIZE_SIZE) -#define CONV_SIZE 3 -#define CONV_INTEGER (0x0001 << CONV_SHIFT) -#define CONV_FLOAT (0x0002 << CONV_SHIFT) -#define CONV_POINTER (0x0003 << CONV_SHIFT) -#define CONV_STRING (0x0004 << CONV_SHIFT) -#define CONV_CHAR (0x0005 << CONV_SHIFT) -#define CONV_PERCENT (0x0006 << CONV_SHIFT) -#define CONV_WRITTEN (0x0007 << CONV_SHIFT) -#define CONV_MASK MAKE_MASK(CONV_SHIFT, CONV_SIZE) -/*---------------------------------------------------------------------------*/ -#define RADIX_SHIFT (CONV_SHIFT + CONV_SIZE) -#define RADIX_SIZE 2 -#define RADIX_DECIMAL (0x0001 << RADIX_SHIFT) -#define RADIX_OCTAL (0x0002 << RADIX_SHIFT) -#define RADIX_HEX (0x0003 << RADIX_SHIFT) -#define RADIX_MASK MAKE_MASK(RADIX_SHIFT, RADIX_SIZE) -/*---------------------------------------------------------------------------*/ -#define SIGNED_SHIFT (RADIX_SHIFT + RADIX_SIZE) -#define SIGNED_SIZE 1 -#define SIGNED_NO (0x0000 << SIGNED_SHIFT) -#define SIGNED_YES (0x0001 << SIGNED_SHIFT) -#define SIGNED_MASK MAKE_MASK(SIGNED_SHIFT, SIGNED_SIZE) -/*---------------------------------------------------------------------------*/ -#define CAPS_SHIFT (SIGNED_SHIFT + SIGNED_SIZE) -#define CAPS_SIZE 1 -#define CAPS_NO (0x0000 << CAPS_SHIFT) -#define CAPS_YES (0x0001 << CAPS_SHIFT) -#define CAPS_MASK MAKE_MASK(CAPS_SHIFT, CAPS_SIZE) -/*---------------------------------------------------------------------------*/ -#define FLOAT_SHIFT (CAPS_SHIFT + CAPS_SIZE) -#define FLOAT_SIZE 2 -#define FLOAT_NORMAL (0x0000 << FLOAT_SHIFT) -#define FLOAT_EXPONENT (0x0001 << FLOAT_SHIFT) -#define FLOAT_DEPENDANT (0x0002 << FLOAT_SHIFT) -#define FLOAT_HEX (0x0003 << FLOAT_SHIFT) -#define FLOAT_MASK MAKE_MASK(FLOAT_SHIFT, FLOAT_SIZE) -/*---------------------------------------------------------------------------*/ -#define CHECKCB(res) { if((res) != STRFORMAT_OK) { va_end(ap); return -1; } } -/*---------------------------------------------------------------------------*/ -#define MAXCHARS_HEX ((sizeof(LARGEST_UNSIGNED) * 8) / 4) - -/* Largest number of characters needed for converting an unsigned integer. */ -#define MAXCHARS ((sizeof(LARGEST_UNSIGNED) * 8 + 2) / 3) -/*---------------------------------------------------------------------------*/ -static FormatFlags -parse_flags(const char **posp) -{ - FormatFlags flags = 0; - const char *pos = *posp; - - while(1) { - switch(*pos) { - case '-': - flags |= JUSTIFY_LEFT; - break; - case '+': - flags |= POSITIVE_PLUS; - break; - case ' ': - flags |= POSITIVE_SPACE; - break; - case '#': - flags |= ALTERNATE_FORM; - break; - case '0': - flags |= PAD_ZERO; - break; - default: - *posp = pos; - return flags; - } - - pos++; - } -} -/*---------------------------------------------------------------------------*/ -static unsigned int -parse_uint(const char **posp) -{ - unsigned v = 0; - const char *pos = *posp; - char ch; - - while((ch = *pos) >= '0' && ch <= '9') { - v = v * 10 + (ch - '0'); - pos++; - } - - *posp = pos; - - return v; -} -/*---------------------------------------------------------------------------*/ -static unsigned int -output_uint_decimal(char **posp, LARGEST_UNSIGNED v) -{ - unsigned int len; - char *pos = *posp; - - while(v > 0) { - *--pos = (v % 10) + '0'; - v /= 10; - } - - len = *posp - pos; - *posp = pos; - - return len; -} -/*---------------------------------------------------------------------------*/ -static unsigned int -output_uint_hex(char **posp, LARGEST_UNSIGNED v, unsigned int flags) -{ - unsigned int len; - const char *hex = (flags & CAPS_YES) ? "0123456789ABCDEF" : "0123456789abcdef"; - char *pos = *posp; - - while(v > 0) { - *--pos = hex[(v % 16)]; - v /= 16; - } - - len = *posp - pos; - *posp = pos; - - return len; -} -/*---------------------------------------------------------------------------*/ -static unsigned int -output_uint_octal(char **posp, LARGEST_UNSIGNED v) -{ - unsigned int len; - char *pos = *posp; - - while(v > 0) { - *--pos = (v % 8) + '0'; - v /= 8; - } - - len = *posp - pos; - *posp = pos; - - return len; -} -/*---------------------------------------------------------------------------*/ -static strformat_result -fill_space(const strformat_context_t *ctxt, unsigned int len) -{ - strformat_result res; - static const char buffer[16] = " "; - - while(len > 16) { - res = ctxt->write_str(ctxt->user_data, buffer, 16); - if(res != STRFORMAT_OK) { - return res; - } - len -= 16; - } - - if(len == 0) { - return STRFORMAT_OK; - } - - return ctxt->write_str(ctxt->user_data, buffer, len); -} -/*---------------------------------------------------------------------------*/ -static strformat_result -fill_zero(const strformat_context_t *ctxt, unsigned int len) -{ - strformat_result res; - static const char buffer[16] = "0000000000000000"; - - while(len > 16) { - res = ctxt->write_str(ctxt->user_data, buffer, 16); - if(res != STRFORMAT_OK) { - return res; - } - len -= 16; - } - - if(len == 0) { - return STRFORMAT_OK; - } - return ctxt->write_str(ctxt->user_data, buffer, len); -} -/*---------------------------------------------------------------------------*/ -int -format_str(const strformat_context_t *ctxt, const char *format, ...) -{ - int ret; - va_list ap; - va_start(ap, format); - ret = format_str_v(ctxt, format, ap); - va_end(ap); - return ret; -} -/*---------------------------------------------------------------------------*/ -int -format_str_v(const strformat_context_t *ctxt, const char *format, va_list ap) -{ - unsigned int written = 0; - const char *pos = format; - - while(*pos != '\0') { - FormatFlags flags; - unsigned int minwidth = 0; - int precision = -1; /* Negative means no precision */ - char ch; - const char *start = pos; - - while((ch = *pos) != '\0' && ch != '%') { - pos++; - } - - if(pos != start) { - CHECKCB(ctxt->write_str(ctxt->user_data, start, pos - start)); - written += pos - start; - } - - if(*pos == '\0') { - va_end(ap); - return written; - } - - pos++; - - if(*pos == '\0') { - va_end(ap); - return written; - } - - flags = parse_flags(&pos); - - /* parse width */ - if(*pos >= '1' && *pos <= '9') { - minwidth = parse_uint(&pos); - } else if(*pos == '*') { - int w = va_arg(ap, int); - - if(w < 0) { - flags |= JUSTIFY_LEFT; - minwidth = w; - } else { - minwidth = w; - } - - pos++; - } - - /* parse precision */ - if(*pos == '.') { - pos++; - - if(*pos >= '0' && *pos <= '9') { - precision = parse_uint(&pos); - } else if(*pos == '*') { - pos++; - precision = va_arg(ap, int); - } - } - - if(*pos == 'l') { - pos++; - - if(*pos == 'l') { - flags |= SIZE_LONGLONG; - pos++; - } else { - flags |= SIZE_LONG; - } - } else if(*pos == 'h') { - pos++; - - if(*pos == 'h') { - flags |= SIZE_CHAR; - pos++; - } else { - flags |= SIZE_SHORT; - } - } - - /* parse conversion specifier */ - switch(*pos) { - case 'd': - case 'i': - flags |= CONV_INTEGER | RADIX_DECIMAL | SIGNED_YES; - break; - case 'u': - flags |= CONV_INTEGER | RADIX_DECIMAL | SIGNED_NO; - break; - case 'o': - flags |= CONV_INTEGER | RADIX_OCTAL | SIGNED_NO; - break; - case 'x': - flags |= CONV_INTEGER | RADIX_HEX | SIGNED_NO; - break; - case 'X': - flags |= CONV_INTEGER | RADIX_HEX | SIGNED_NO | CAPS_YES; - break; -#ifdef HAVE_DOUBLE - case 'f': - flags |= CONV_FLOAT | FLOAT_NORMAL; - break; - case 'F': - flags |= CONV_FLOAT | FLOAT_NORMAL | CAPS_YES; - break; - case 'e': - flags |= CONV_FLOAT | FLOAT_EXPONENT; - break; - case 'E': - flags |= CONV_FLOAT | FLOAT_EXPONENT | CAPS_YES; - break; - case 'g': - flags |= CONV_FLOAT | FLOAT_DEPENDANT; - break; - case 'G': - flags |= CONV_FLOAT | FLOAT_DEPENDANT | CAPS_YES; - break; - case 'a': - flags |= CONV_FLOAT | FLOAT_HEX; - break; - case 'A': - flags |= CONV_FLOAT | FLOAT_HEX | CAPS_YES; - break; -#endif - case 'c': - flags |= CONV_CHAR; - break; - case 's': - flags |= CONV_STRING; - break; - case 'p': - flags |= CONV_POINTER; - break; - case 'n': - flags |= CONV_WRITTEN; - break; - case '%': - flags |= CONV_PERCENT; - break; - case '\0': - va_end(ap); - return written; - } - pos++; - - switch(flags & CONV_MASK) { - case CONV_PERCENT: - CHECKCB(ctxt->write_str(ctxt->user_data, "%", 1)); - written++; - break; - case CONV_INTEGER: - { - /* unsigned integers */ - char *prefix = 0; /* sign, "0x" or "0X" */ - unsigned int prefix_len = 0; - char buffer[MAXCHARS]; - char *conv_pos = buffer + MAXCHARS; - unsigned int conv_len = 0; - unsigned int width = 0; - unsigned int precision_fill; - unsigned int field_fill; - LARGEST_UNSIGNED uvalue = 0; - int negative = 0; - - if(precision < 0) { - precision = 1; - } else { - flags &= ~PAD_ZERO; - } - - if(flags & SIGNED_YES) { - /* signed integers */ - LARGEST_SIGNED value = 0; - switch(flags & SIZE_MASK) { - case SIZE_CHAR: - value = (signed char)va_arg(ap, int); - break; - case SIZE_SHORT: - value = (short)va_arg(ap, int); - break; - case SIZE_INT: - value = va_arg(ap, int); - break; -#ifndef HAVE_LONGLONG - case SIZE_LONGLONG: /* Treat long long the same as long */ -#endif - case SIZE_LONG: - value = va_arg(ap, long); - break; -#ifdef HAVE_LONGLONG - case SIZE_LONGLONG: - value = va_arg(ap, long long); - break; -#endif - } - if(value < 0) { - uvalue = -value; - negative = 1; - } else { - uvalue = value; - } - } else { - - switch(flags & SIZE_MASK) { - case SIZE_CHAR: - uvalue = (unsigned char)va_arg(ap, unsigned int); - break; - case SIZE_SHORT: - uvalue = (unsigned short)va_arg(ap, unsigned int); - break; - case SIZE_INT: - uvalue = va_arg(ap, unsigned int); - break; -#ifndef HAVE_LONGLONG - case SIZE_LONGLONG: /* Treat long long the same as long */ -#endif - case SIZE_LONG: - uvalue = va_arg(ap, unsigned long); - break; -#ifdef HAVE_LONGLONG - case SIZE_LONGLONG: - uvalue = va_arg(ap, unsigned long long); - break; -#endif - } - } - - switch(flags & (RADIX_MASK)) { - case RADIX_DECIMAL: - conv_len = output_uint_decimal(&conv_pos, uvalue); - break; - case RADIX_OCTAL: - conv_len = output_uint_octal(&conv_pos, uvalue); - break; - case RADIX_HEX: - conv_len = output_uint_hex(&conv_pos, uvalue, flags); - break; - } - - width += conv_len; - precision_fill = (precision > conv_len) ? precision - conv_len : 0; - if((flags & (RADIX_MASK | ALTERNATE_FORM)) - == (RADIX_OCTAL | ALTERNATE_FORM)) { - if(precision_fill < 1) { - precision_fill = 1; - } - } - - width += precision_fill; - - if((flags & (RADIX_MASK | ALTERNATE_FORM)) - == (RADIX_HEX | ALTERNATE_FORM) && uvalue != 0) { - prefix_len = 2; - if(flags & CAPS_YES) { - prefix = "0X"; - } else { - prefix = "0x"; - } - } - - if(flags & SIGNED_YES) { - if(negative) { - prefix = "-"; - prefix_len = 1; - } else { - switch(flags & POSITIVE_MASK) { - case POSITIVE_SPACE: - prefix = " "; - prefix_len = 1; - break; - case POSITIVE_PLUS: - prefix = "+"; - prefix_len = 1; - break; - } - } - } - - width += prefix_len; - - field_fill = (minwidth > width) ? minwidth - width : 0; - - if((flags & JUSTIFY_MASK) == JUSTIFY_RIGHT) { - if(flags & PAD_ZERO) { - precision_fill += field_fill; - field_fill = 0; /* Do not double count padding */ - } else { - CHECKCB(fill_space(ctxt, field_fill)); - } - } - - if(prefix_len > 0) { - CHECKCB(ctxt->write_str(ctxt->user_data, prefix, prefix_len)); - } - written += prefix_len; - - CHECKCB(fill_zero(ctxt, precision_fill)); - written += precision_fill; - - CHECKCB(ctxt->write_str(ctxt->user_data, conv_pos, conv_len)); - written += conv_len; - - if((flags & JUSTIFY_MASK) == JUSTIFY_LEFT) { - CHECKCB(fill_space(ctxt, field_fill)); - } - written += field_fill; - } - break; - case CONV_STRING: - { - unsigned int field_fill; - unsigned int len; - char *str = va_arg(ap, char *); - - if(str) { - char *pos = str; - while(*pos != '\0') pos++; - len = pos - str; - } else { - str = "(null)"; - len = 6; - } - - if(precision >= 0 && precision < len) { - len = precision; - } - - field_fill = (minwidth > len) ? minwidth - len : 0; - - if((flags & JUSTIFY_MASK) == JUSTIFY_RIGHT) { - CHECKCB(fill_space(ctxt, field_fill)); - } - - CHECKCB(ctxt->write_str(ctxt->user_data, str, len)); - written += len; - - if((flags & JUSTIFY_MASK) == JUSTIFY_LEFT) { - CHECKCB(fill_space(ctxt, field_fill)); - } - written += field_fill; - } - break; - case CONV_POINTER: - { - LARGEST_UNSIGNED uvalue = - (LARGEST_UNSIGNED)(POINTER_INT)va_arg(ap, void *); - char buffer[MAXCHARS_HEX + 3]; - char *conv_pos = buffer + MAXCHARS_HEX + 3; - unsigned int conv_len; - unsigned int field_fill; - - conv_len = output_uint_hex(&conv_pos, uvalue, flags); - - if(conv_len == 0) { - *--conv_pos = '0'; - conv_len++; - } - - *--conv_pos = 'x'; - *--conv_pos = '0'; - *--conv_pos = '#'; - conv_len += 3; - - field_fill = (minwidth > conv_len) ? minwidth - conv_len : 0; - - if((flags & JUSTIFY_MASK) == JUSTIFY_RIGHT) { - CHECKCB(fill_space(ctxt, field_fill)); - } - - CHECKCB(ctxt->write_str(ctxt->user_data, conv_pos, conv_len)); - written += conv_len; - - if((flags & JUSTIFY_MASK) == JUSTIFY_LEFT) { - CHECKCB(fill_space(ctxt, field_fill)); - } - - written += field_fill; - } - break; - case CONV_CHAR: - { - char ch = va_arg(ap, int); - unsigned int field_fill = (minwidth > 1) ? minwidth - 1 : 0; - - if((flags & JUSTIFY_MASK) == JUSTIFY_RIGHT) { - CHECKCB(fill_space(ctxt, field_fill)); - written += field_fill; - } - - CHECKCB(ctxt->write_str(ctxt->user_data, &ch, 1)); - written++; - - if((flags & JUSTIFY_MASK) == JUSTIFY_LEFT) { - CHECKCB(fill_space(ctxt, field_fill)); - } - written += field_fill; - } - break; - case CONV_WRITTEN: - { - int *p = va_arg(ap, int *); - *p = written; - } - break; - } - } - - return written; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/dbg-io/strformat.h b/os/lib/dbg-io/strformat.h deleted file mode 100644 index 478fb7af7..000000000 --- a/os/lib/dbg-io/strformat.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2009, Simon Berg - * 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 STRFORMAT_H_ -#define STRFORMAT_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -#define STRFORMAT_OK 0 -#define STRFORMAT_FAILED 1 -/*---------------------------------------------------------------------------*/ -typedef unsigned int strformat_result; -/*---------------------------------------------------------------------------*/ -/* The data argument may only be considered valid during the function call */ -typedef strformat_result (*strformat_write)(void *user_data, - const char *data, - unsigned int len); - -typedef struct strformat_context_s { - strformat_write write_str; - void *user_data; -} strformat_context_t; -/*---------------------------------------------------------------------------*/ -int format_str(const strformat_context_t *ctxt, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2,3))); - -int -format_str_v(const strformat_context_t *ctxt, const char *format, va_list ap); -/*---------------------------------------------------------------------------*/ -#endif /* STRFORMAT_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/dbl-circ-list.c b/os/lib/dbl-circ-list.c deleted file mode 100644 index 35b33a801..000000000 --- a/os/lib/dbl-circ-list.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * Copyright (c) 2017, James Pope - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup doubly-linked-circular-list - * @{ - * - * \file - * Implementation of circular, doubly-linked lists - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/dbl-circ-list.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -struct dblcl { - struct dblcl *next; - struct dblcl *previous; -}; -/*---------------------------------------------------------------------------*/ -void -dbl_circ_list_init(dbl_circ_list_t dblcl) -{ - *dblcl = NULL; -} -/*---------------------------------------------------------------------------*/ -void * -dbl_circ_list_head(dbl_circ_list_t dblcl) -{ - return *dblcl; -} -/*---------------------------------------------------------------------------*/ -void * -dbl_circ_list_tail(dbl_circ_list_t dblcl) -{ - struct dblcl *this; - - if(*dblcl == NULL) { - return NULL; - } - - for(this = *dblcl; this->next != *dblcl; this = this->next); - - return this; -} -/*---------------------------------------------------------------------------*/ -void -dbl_circ_list_remove(dbl_circ_list_t dblcl, void *element) -{ - struct dblcl *this; - - if(*dblcl == NULL || element == NULL) { - return; - } - - this = *dblcl; - - do { - if(this == element) { - this->previous->next = this->next; - this->next->previous = this->previous; - - /* We need to update the head of the list if we removed the head */ - if(*dblcl == element) { - *dblcl = this->next == this ? NULL : this->next; - } - - this->next = NULL; - this->previous = NULL; - - return; - } - - this = this->next; - } while(this != *dblcl); -} -/*---------------------------------------------------------------------------*/ -void -dbl_circ_list_add_head(dbl_circ_list_t dblcl, void *element) -{ - struct dblcl *head; - - if(element == NULL) { - return; - } - - /* Don't add twice */ - dbl_circ_list_remove(dblcl, element); - - head = dbl_circ_list_head(dblcl); - - if(head == NULL) { - /* If the list was empty */ - ((struct dblcl *)element)->next = element; - ((struct dblcl *)element)->previous = element; - } else { - /* If the list was not empty */ - ((struct dblcl *)element)->next = head; - ((struct dblcl *)element)->previous = head->previous; - head->previous->next = element; - head->previous = element; - } - - *dblcl = element; -} -/*---------------------------------------------------------------------------*/ -void -dbl_circ_list_add_tail(dbl_circ_list_t dblcl, void *element) -{ - struct dblcl *tail; - - if(element == NULL) { - return; - } - - /* Don't add twice */ - dbl_circ_list_remove(dblcl, element); - - tail = dbl_circ_list_tail(dblcl); - - if(tail == NULL) { - /* If the list was empty */ - ((struct dblcl *)element)->next = element; - ((struct dblcl *)element)->previous = element; - *dblcl = element; - } else { - /* If the list was not empty */ - ((struct dblcl *)element)->next = *dblcl; - ((struct dblcl *)element)->previous = tail; - tail->next->previous = element; - tail->next = element; - } -} -/*---------------------------------------------------------------------------*/ -void -dbl_circ_list_add_after(dbl_circ_list_t dblcl, void *existing, void *element) -{ - if(element == NULL || existing == NULL) { - return; - } - - /* Don't add twice */ - dbl_circ_list_remove(dblcl, element); - - ((struct dblcl *)element)->next = ((struct dblcl *)existing)->next; - ((struct dblcl *)element)->previous = existing; - ((struct dblcl *)existing)->next->previous = element; - ((struct dblcl *)existing)->next = element; -} -/*---------------------------------------------------------------------------*/ -void -dbl_circ_list_add_before(dbl_circ_list_t dblcl, void *existing, void *element) -{ - if(element == NULL || existing == NULL) { - return; - } - - /* Don't add twice */ - dbl_circ_list_remove(dblcl, element); - - ((struct dblcl *)element)->next = existing; - ((struct dblcl *)element)->previous = ((struct dblcl *)existing)->previous; - ((struct dblcl *)existing)->previous->next = element; - ((struct dblcl *)existing)->previous = element; - - /* If we added before the list's head, we must update the head */ - if(*dblcl == existing) { - *dblcl = element; - } -} -/*---------------------------------------------------------------------------*/ -unsigned long -dbl_circ_list_length(dbl_circ_list_t dblcl) -{ - unsigned long len = 1; - struct dblcl *this; - - if(*dblcl == NULL) { - return 0; - } - - for(this = *dblcl; this->next != *dblcl; this = this->next) { - len++; - } - - return len; -} -/*---------------------------------------------------------------------------*/ -bool -dbl_circ_list_is_empty(dbl_circ_list_t dblcl) -{ - return *dblcl == NULL ? true : false; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/lib/dbl-circ-list.h b/os/lib/dbl-circ-list.h deleted file mode 100644 index 08eba8188..000000000 --- a/os/lib/dbl-circ-list.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * Copyright (c) 2017, James Pope - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup data - * @{ - * - * \defgroup doubly-linked-circular-list Circular, doubly-linked list - * - * This library provides functions for the creation and manipulation of - * circular, doubly-linked lists. - * - * A circular, doubly-linked list is declared using the DBL_CIRC_LIST macro. - * Elements must be allocated by the calling code and must be of a C struct - * datatype. In this struct, the first field must be a pointer called \e next. - * The second field must be a pointer called \e previous. - * These fields will be used by the library to maintain the list. Application - * code must not modify these fields directly. - * - * Functions that modify the list (add / remove) will, in the general case, - * update the list's head and item order. If you call one of these functions - * as part of a list traversal, it is advised to stop / restart traversing - * after the respective function returns. - * @{ - */ -/*---------------------------------------------------------------------------*/ -#ifndef DBL_CIRC_LIST_H_ -#define DBL_CIRC_LIST_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Define a circular, doubly-linked list. - * - * This macro defines a circular, doubly-linked list. - * - * The datatype for elements must be a C struct. - * The struct's first member must be a pointer called \e next. - * The second field must be a pointer called \e previous. - * These fields will be used by the library to maintain the list. Application - * code must not modify these fields directly. - * - * \param name The name of the circular, doubly-linked list. - */ -#define DBL_CIRC_LIST(name) \ - static void *name##_dbl_circ_list = NULL; \ - static dbl_list_t name = (dbl_circ_list_t)&name##_dbl_circ_list -/*---------------------------------------------------------------------------*/ -/** - * \brief The doubly-linked list datatype - */ -typedef void **dbl_circ_list_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise a circular, doubly-linked list. - * \param dblcl The circular, doubly-linked list. - */ -void dbl_circ_list_init(dbl_circ_list_t dblcl); - -/** - * \brief Return the tail of a circular, doubly-linked list. - * \param dblcl The circular, doubly-linked list. - * \return A pointer to the list's head, or NULL if the list is empty - */ -void *dbl_circ_list_head(dbl_circ_list_t dblcl); - -/** - * \brief Return the tail of a circular, doubly-linked list. - * \param dblcl The circular, doubly-linked list. - * \return A pointer to the list's tail, or NULL if the list is empty - */ -void *dbl_circ_list_tail(dbl_circ_list_t dblcl); - -/** - * \brief Add an element to the head of a circular, doubly-linked list. - * \param dblcl The circular, doubly-linked list. - * \param element A pointer to the element to be added. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void dbl_circ_list_add_head(dbl_circ_list_t dblcl, void *element); - -/** - * \brief Add an element to the tail of a circular, doubly-linked list. - * \param dblcl The circular, doubly-linked list. - * \param element A pointer to the element to be added. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void dbl_circ_list_add_tail(dbl_circ_list_t dblcl, void *element); - -/** - * \brief Add an element to a circular, doubly linked list after an existing element. - * \param dblcl The circular, doubly-linked list. - * \param existing A pointer to the existing element. - * \param element A pointer to the element to be added. - * - * This function will add \e element after \e existing - * - * The function will not verify that \e existing is already part of the list. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void dbl_circ_list_add_after(dbl_circ_list_t dblcl, void *existing, - void *element); - -/** - * \brief Add an element to a circular, doubly linked list before an existing element. - * \param dblcl The circular, doubly-linked list. - * \param existing A pointer to the existing element. - * \param element A pointer to the element to be added. - * - * This function will add \e element before \e existing - * - * The function will not verify that \e existing is already part of the list. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void dbl_circ_list_add_before(dbl_circ_list_t dblcl, void *existing, - void *element); - -/** - * \brief Remove an element from a circular, doubly-linked list. - * \param dblcl The circular, doubly-linked list. - * \param element A pointer to the element to be removed. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void dbl_circ_list_remove(dbl_circ_list_t dblcl, void *element); - -/** - * \brief Get the length of a circular, doubly-linked list. - * \param dblcl The circular, doubly-linked list. - * \return The number of elements in the list - */ -unsigned long dbl_circ_list_length(dbl_circ_list_t dblcl); - -/** - * \brief Determine whether a circular, doubly-linked list is empty. - * \param dblcl The circular, doubly-linked list. - * \retval true The list is empty - * \retval false The list is not empty - */ -bool dbl_circ_list_is_empty(dbl_circ_list_t dblcl); -/*---------------------------------------------------------------------------*/ -#endif /* DBL_CIRC_LIST_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/lib/dbl-list.c b/os/lib/dbl-list.c deleted file mode 100644 index 7f2f4b587..000000000 --- a/os/lib/dbl-list.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * Copyright (c) 2017, James Pope - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup doubly-linked-list - * @{ - * - * \file - * Implementation of doubly-linked lists - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/dbl-list.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -struct dll { - struct dll *next; - struct dll *previous; -}; -/*---------------------------------------------------------------------------*/ -void -dbl_list_init(dbl_list_t dll) -{ - *dll = NULL; -} -/*---------------------------------------------------------------------------*/ -void * -dbl_list_head(dbl_list_t dll) -{ - return *dll; -} -/*---------------------------------------------------------------------------*/ -void * -dbl_list_tail(dbl_list_t dll) -{ - struct dll *this; - - if(*dll == NULL) { - return NULL; - } - - for(this = *dll; this->next != NULL; this = this->next); - - return this; -} -/*---------------------------------------------------------------------------*/ -void -dbl_list_remove(dbl_list_t dll, void *element) -{ - struct dll *this, *previous, *next; - - if(*dll == NULL || element == NULL) { - return; - } - - for(this = *dll; this != NULL; this = this->next) { - if(this == element) { - previous = this->previous; - next = this->next; - - if(previous) { - previous->next = this->next; - } - - if(next) { - next->previous = this->previous; - } - - if(*dll == this) { - *dll = next; - } - - return; - } - } -} -/*---------------------------------------------------------------------------*/ -void -dbl_list_add_head(dbl_list_t dll, void *element) -{ - struct dll *head; - - if(element == NULL) { - return; - } - - /* Don't add twice */ - dbl_list_remove(dll, element); - - head = dbl_list_head(dll); - - ((struct dll *)element)->previous = NULL; - ((struct dll *)element)->next = head; - - if(head) { - /* If the list was not empty, update ->previous on the old head */ - head->previous = element; - } - - *dll = element; -} -/*---------------------------------------------------------------------------*/ -void -dbl_list_add_tail(dbl_list_t dll, void *element) -{ - struct dll *tail; - - if(element == NULL) { - return; - } - - /* Don't add twice */ - dbl_list_remove(dll, element); - - tail = dbl_list_tail(dll); - - if(tail == NULL) { - /* The list was empty */ - *dll = element; - } else { - tail->next = element; - } - - ((struct dll *)element)->previous = tail; - ((struct dll *)element)->next = NULL; -} -/*---------------------------------------------------------------------------*/ -void -dbl_list_add_after(dbl_list_t dll, void *existing, void *element) -{ - if(element == NULL || existing == NULL) { - return; - } - - /* Don't add twice */ - dbl_list_remove(dll, element); - - ((struct dll *)element)->next = ((struct dll *)existing)->next; - ((struct dll *)element)->previous = existing; - - if(((struct dll *)existing)->next) { - ((struct dll *)existing)->next->previous = element; - } - ((struct dll *)existing)->next = element; -} -/*---------------------------------------------------------------------------*/ -void -dbl_list_add_before(dbl_list_t dll, void *existing, void *element) -{ - if(element == NULL || existing == NULL) { - return; - } - - /* Don't add twice */ - dbl_list_remove(dll, element); - - ((struct dll *)element)->next = existing; - ((struct dll *)element)->previous = ((struct dll *)existing)->previous; - - if(((struct dll *)existing)->previous) { - ((struct dll *)existing)->previous->next = element; - } - ((struct dll *)existing)->previous = element; - - /* If we added before the list's head, we must update the head */ - if(*dll == existing) { - *dll = element; - } -} -/*---------------------------------------------------------------------------*/ -unsigned long -dbl_list_length(dbl_list_t dll) -{ - unsigned long len = 0; - struct dll *this; - - if(*dll == NULL) { - return 0; - } - - for(this = *dll; this != NULL; this = this->next) { - len++; - } - - return len; -} -/*---------------------------------------------------------------------------*/ -bool -dbl_list_is_empty(dbl_list_t dll) -{ - return *dll == NULL ? true : false; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/lib/dbl-list.h b/os/lib/dbl-list.h deleted file mode 100644 index 88caf30ce..000000000 --- a/os/lib/dbl-list.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * Copyright (c) 2017, James Pope - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup data - * @{ - * - * \defgroup doubly-linked-list Doubly-linked list - * - * This library provides functions for the creation and manipulation of - * doubly-linked lists. - * - * A doubly-linked list is declared using the DBL_LIST macro. - * Elements must be allocated by the calling code and must be of a C struct - * datatype. In this struct, the first field must be a pointer called \e next. - * The second field must be a pointer called \e previous. - * These fields will be used by the library to maintain the list. Application - * code must not modify these fields directly. - * - * Functions that modify the list (add / remove) will, in the general case, - * update the list's head and item order. If you call one of these functions - * as part of a list traversal, it is advised to stop / restart traversing - * after the respective function returns. - * @{ - */ -/*---------------------------------------------------------------------------*/ -#ifndef DBL_LIST_H_ -#define DBL_LIST_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Define a doubly-linked list. - * - * This macro defines a doubly-linked list. - * - * The datatype for elements must be a C struct. - * The struct's first member must be a pointer called \e next. - * The second field must be a pointer called \e previous. - * These fields will be used by the library to maintain the list. Application - * code must not modify these fields directly. - * - * \param name The name of the doubly-linked list. - */ -#define DBL_LIST(name) \ - static void *name##_dbl_list = NULL; \ - static dbl_list_t name = (dbl_list_t)&name##_dbl_list -/*---------------------------------------------------------------------------*/ -/** - * \brief The doubly-linked list datatype - */ -typedef void **dbl_list_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise a doubly-linked list. - * \param dll The doubly-linked list. - */ -void dbl_list_init(dbl_list_t dll); - -/** - * \brief Return the tail of a doubly-linked list. - * \param dll The doubly-linked list. - * \return A pointer to the list's head, or NULL if the list is empty - */ -void *dbl_list_head(dbl_list_t dll); - -/** - * \brief Return the tail of a doubly-linked list. - * \param dll The doubly-linked list. - * \return A pointer to the list's tail, or NULL if the list is empty - */ -void *dbl_list_tail(dbl_list_t dll); - -/** - * \brief Add an element to the head of a doubly-linked list. - * \param dll The doubly-linked list. - * \param element A pointer to the element to be added. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void dbl_list_add_head(dbl_list_t dll, void *element); - -/** - * \brief Add an element to the tail of a doubly-linked list. - * \param dll The doubly-linked list. - * \param element A pointer to the element to be added. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void dbl_list_add_tail(dbl_list_t dll, void *element); - -/** - * \brief Add an element to a doubly linked list after an existing element. - * \param dll The doubly-linked list. - * \param existing A pointer to the existing element. - * \param element A pointer to the element to be added. - * - * This function will add \e element after \e existing - * - * The function will not verify that \e existing is already part of the list. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void dbl_list_add_after(dbl_list_t dll, void *existing, void *element); - -/** - * \brief Add an element to a doubly linked list before an existing element. - * \param dll The doubly-linked list. - * \param existing A pointer to the existing element. - * \param element A pointer to the element to be added. - * - * This function will add \e element before \e existing - * - * The function will not verify that \e existing is already part of the list. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void dbl_list_add_before(dbl_list_t dll, void *existing, void *element); - -/** - * \brief Remove an element from a doubly-linked list. - * \param dll The doubly-linked list. - * \param element A pointer to the element to be removed. - * - * Calling this function will update the list's head and item order. If you - * call this function as part of a list traversal, it is advised to stop - * traversing after this function returns. - */ -void dbl_list_remove(dbl_list_t dll, void *element); - -/** - * \brief Get the length of a doubly-linked list. - * \param dll The doubly-linked list. - * \return The number of elements in the list - */ -unsigned long dbl_list_length(dbl_list_t dll); - -/** - * \brief Determine whether a doubly-linked list is empty. - * \param dll The doubly-linked list. - * \retval true The list is empty - * \retval false The list is not empty - */ -bool dbl_list_is_empty(dbl_list_t dll); -/*---------------------------------------------------------------------------*/ -#endif /* DBL_LIST_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/lib/fs/fat/00history.txt b/os/lib/fs/fat/00history.txt deleted file mode 100644 index ab22088e4..000000000 --- a/os/lib/fs/fat/00history.txt +++ /dev/null @@ -1,279 +0,0 @@ ----------------------------------------------------------------------------- - Revision history of FatFs module ----------------------------------------------------------------------------- - -R0.00 (February 26, 2006) - - Prototype. - - - -R0.01 (April 29, 2006) - - The first release. - - - -R0.02 (June 01, 2006) - - Added FAT12 support. - Removed unbuffered mode. - Fixed a problem on small (<32M) partition. - - - -R0.02a (June 10, 2006) - - Added a configuration option (_FS_MINIMUM). - - - -R0.03 (September 22, 2006) - - Added f_rename(). - Changed option _FS_MINIMUM to _FS_MINIMIZE. - - - -R0.03a (December 11, 2006) - - Improved cluster scan algorithm to write files fast. - Fixed f_mkdir() creates incorrect directory on FAT32. - - - -R0.04 (February 04, 2007) - - Added f_mkfs(). - Supported multiple drive system. - Changed some interfaces for multiple drive system. - Changed f_mountdrv() to f_mount(). - - - -R0.04a (April 01, 2007) - - Supported multiple partitions on a physical drive. - Added a capability of extending file size to f_lseek(). - Added minimization level 3. - Fixed an endian sensitive code in f_mkfs(). - - - -R0.04b (May 05, 2007) - - Added a configuration option _USE_NTFLAG. - Added FSINFO support. - Fixed DBCS name can result FR_INVALID_NAME. - Fixed short seek (<= csize) collapses the file object. - - - -R0.05 (August 25, 2007) - - Changed arguments of f_read(), f_write() and f_mkfs(). - Fixed f_mkfs() on FAT32 creates incorrect FSINFO. - Fixed f_mkdir() on FAT32 creates incorrect directory. - - - -R0.05a (February 03, 2008) - - Added f_truncate() and f_utime(). - Fixed off by one error at FAT sub-type determination. - Fixed btr in f_read() can be mistruncated. - Fixed cached sector is not flushed when create and close without write. - - - -R0.06 (April 01, 2008) - - Added fputc(), fputs(), fprintf() and fgets(). - Improved performance of f_lseek() on moving to the same or following cluster. - - - -R0.07 (April 01, 2009) - - Merged Tiny-FatFs as a configuration option. (_FS_TINY) - Added long file name feature. (_USE_LFN) - Added multiple code page feature. (_CODE_PAGE) - Added re-entrancy for multitask operation. (_FS_REENTRANT) - Added auto cluster size selection to f_mkfs(). - Added rewind option to f_readdir(). - Changed result code of critical errors. - Renamed string functions to avoid name collision. - - - -R0.07a (April 14, 2009) - - Septemberarated out OS dependent code on reentrant cfg. - Added multiple sector size feature. - - - -R0.07c (June 21, 2009) - - Fixed f_unlink() can return FR_OK on error. - Fixed wrong cache control in f_lseek(). - Added relative path feature. - Added f_chdir() and f_chdrive(). - Added proper case conversion to extended character. - - - -R0.07e (November 03, 2009) - - Septemberarated out configuration options from ff.h to ffconf.h. - Fixed f_unlink() fails to remove a sub-directory on _FS_RPATH. - Fixed name matching error on the 13 character boundary. - Added a configuration option, _LFN_UNICODE. - Changed f_readdir() to return the SFN with always upper case on non-LFN cfg. - - - -R0.08 (May 15, 2010) - - Added a memory configuration option. (_USE_LFN = 3) - Added file lock feature. (_FS_SHARE) - Added fast seek feature. (_USE_FASTSEEK) - Changed some types on the API, XCHAR->TCHAR. - Changed .fname in the FILINFO structure on Unicode cfg. - String functions support UTF-8 encoding files on Unicode cfg. - - - -R0.08a (August 16, 2010) - - Added f_getcwd(). (_FS_RPATH = 2) - Added sector erase feature. (_USE_ERASE) - Moved file lock semaphore table from fs object to the bss. - Fixed f_mkfs() creates wrong FAT32 volume. - - - -R0.08b (January 15, 2011) - - Fast seek feature is also applied to f_read() and f_write(). - f_lseek() reports required table size on creating CLMP. - Extended format syntax of f_printf(). - Ignores duplicated directory separators in given path name. - - - -R0.09 (September 06, 2011) - - f_mkfs() supports multiple partition to complete the multiple partition feature. - Added f_fdisk(). - - - -R0.09a (August 27, 2012) - - Changed f_open() and f_opendir() reject null object pointer to avoid crash. - Changed option name _FS_SHARE to _FS_LOCK. - Fixed assertion failure due to OS/2 EA on FAT12/16 volume. - - - -R0.09b (January 24, 2013) - - Added f_setlabel() and f_getlabel(). - - - -R0.10 (October 02, 2013) - - Added selection of character encoding on the file. (_STRF_ENCODE) - Added f_closedir(). - Added forced full FAT scan for f_getfree(). (_FS_NOFSINFO) - Added forced mount feature with changes of f_mount(). - Improved behavior of volume auto detection. - Improved write throughput of f_puts() and f_printf(). - Changed argument of f_chdrive(), f_mkfs(), disk_read() and disk_write(). - Fixed f_write() can be truncated when the file size is close to 4GB. - Fixed f_open(), f_mkdir() and f_setlabel() can return incorrect value on error. - - - -R0.10a (January 15, 2014) - - Added arbitrary strings as drive number in the path name. (_STR_VOLUME_ID) - Added a configuration option of minimum sector size. (_MIN_SS) - 2nd argument of f_rename() can have a drive number and it will be ignored. - Fixed f_mount() with forced mount fails when drive number is >= 1. (appeared at R0.10) - Fixed f_close() invalidates the file object without volume lock. - Fixed f_closedir() returns but the volume lock is left acquired. (appeared at R0.10) - Fixed creation of an entry with LFN fails on too many SFN collisions. (appeared at R0.07) - - - -R0.10b (May 19, 2014) - - Fixed a hard error in the disk I/O layer can collapse the directory entry. - Fixed LFN entry is not deleted on delete/rename an object with lossy converted SFN. (appeared at R0.07) - - - -R0.10c (November 09, 2014) - - Added a configuration option for the platforms without RTC. (_FS_NORTC) - Changed option name _USE_ERASE to _USE_TRIM. - Fixed volume label created by Mac OS X cannot be retrieved with f_getlabel(). (appeared at R0.09b) - Fixed a potential problem of FAT access that can appear on disk error. - Fixed null pointer dereference on attempting to delete the root direcotry. (appeared at R0.08) - - - -R0.11 (February 09, 2015) - - Added f_findfirst(), f_findnext() and f_findclose(). (_USE_FIND) - Fixed f_unlink() does not remove cluster chain of the file. (appeared at R0.10c) - Fixed _FS_NORTC option does not work properly. (appeared at R0.10c) - - - -R0.11a (September 05, 2015) - - Fixed wrong media change can lead a deadlock at thread-safe configuration. - Added code page 771, 860, 861, 863, 864, 865 and 869. (_CODE_PAGE) - Removed some code pages actually not exist on the standard systems. (_CODE_PAGE) - Fixed errors in the case conversion teble of code page 437 and 850 (ff.c). - Fixed errors in the case conversion teble of Unicode (cc*.c). - - - -R0.12 (April 12, 2016) - - Added support for exFAT file system. (_FS_EXFAT) - Added f_expand(). (_USE_EXPAND) - Changed some members in FINFO structure and behavior of f_readdir(). - Added an option _USE_CHMOD. - Removed an option _WORD_ACCESS. - Fixed errors in the case conversion table of Unicode (cc*.c). - - - -R0.12a (July 10, 2016) - - Added support for creating exFAT volume with some changes of f_mkfs(). - Added a file open method FA_OPEN_APPEND. An f_lseek() following f_open() is no longer needed. - f_forward() is available regardless of _FS_TINY. - Fixed f_mkfs() creates wrong volume. (appeared at R0.12) - Fixed wrong memory read in create_name(). (appeared at R0.12) - Fixed compilation fails at some configurations, _USE_FASTSEEK and _USE_FORWARD. - - - -R0.12b (September 04, 2016) - - Improved f_rename() to be able to rename objects with the same name but case. - Fixed an error in the case conversion teble of code page 866. (ff.c) - Fixed writing data is truncated at the file offset 4GiB on the exFAT volume. (appeared at R0.12) - Fixed creating a file in the root directory of exFAT volume can fail. (appeared at R0.12) - Fixed f_mkfs() creating exFAT volume with too small cluster size can collapse unallocated memory. (appeared at R0.12) - Fixed wrong object name can be returned when read directory at Unicode cfg. (appeared at R0.12) - Fixed large file allocation/removing on the exFAT volume collapses allocation bitmap. (appeared at R0.12) - Fixed some internal errors in f_expand() and f_lseek(). (appeared at R0.12) - diff --git a/os/lib/fs/fat/README.md b/os/lib/fs/fat/README.md deleted file mode 100644 index 817929067..000000000 --- a/os/lib/fs/fat/README.md +++ /dev/null @@ -1,4 +0,0 @@ -FatFs - Generic FAT File System Module -====================================== - -See the documentation on the [official FatFs Module website](http://elm-chan.org/fsw/ff/00index_e.html). diff --git a/os/lib/fs/fat/diskio.h b/os/lib/fs/fat/diskio.h deleted file mode 100644 index 20ebde941..000000000 --- a/os/lib/fs/fat/diskio.h +++ /dev/null @@ -1,80 +0,0 @@ -/*-----------------------------------------------------------------------/ -/ Low level disk interface modlue include file (C)ChaN, 2014 / -/-----------------------------------------------------------------------*/ - -#ifndef _DISKIO_DEFINED -#define _DISKIO_DEFINED - -#ifdef __cplusplus -extern "C" { -#endif - -#include "integer.h" - - -/* Status of Disk Functions */ -typedef BYTE DSTATUS; - -/* Results of Disk Functions */ -typedef enum { - RES_OK = 0, /* 0: Successful */ - RES_ERROR, /* 1: R/W Error */ - RES_WRPRT, /* 2: Write Protected */ - RES_NOTRDY, /* 3: Not Ready */ - RES_PARERR /* 4: Invalid Parameter */ -} DRESULT; - - -/*---------------------------------------*/ -/* Prototypes for disk control functions */ - - -DSTATUS disk_initialize (BYTE pdrv); -DSTATUS disk_status (BYTE pdrv); -DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count); -DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); -DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); - - -/* Disk Status Bits (DSTATUS) */ - -#define STA_NOINIT 0x01 /* Drive not initialized */ -#define STA_NODISK 0x02 /* No medium in the drive */ -#define STA_PROTECT 0x04 /* Write protected */ - - -/* Command code for disk_ioctrl fucntion */ - -/* Generic command (Used by FatFs) */ -#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */ -#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */ -#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */ -#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */ -#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */ - -/* Generic command (Not used by FatFs) */ -#define CTRL_POWER 5 /* Get/Set power status */ -#define CTRL_LOCK 6 /* Lock/Unlock media removal */ -#define CTRL_EJECT 7 /* Eject media */ -#define CTRL_FORMAT 8 /* Create physical format on the media */ - -/* MMC/SDC specific ioctl command */ -#define MMC_GET_TYPE 10 /* Get card type */ -#define MMC_GET_CSD 11 /* Get CSD */ -#define MMC_GET_CID 12 /* Get CID */ -#define MMC_GET_OCR 13 /* Get OCR */ -#define MMC_GET_SDSTAT 14 /* Get SD status */ -#define ISDIO_READ 55 /* Read data form SD iSDIO register */ -#define ISDIO_WRITE 56 /* Write data to SD iSDIO register */ -#define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */ - -/* ATA/CF specific ioctl command */ -#define ATA_GET_REV 20 /* Get F/W revision */ -#define ATA_GET_MODEL 21 /* Get model name */ -#define ATA_GET_SN 22 /* Get serial number */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/os/lib/fs/fat/ff.c b/os/lib/fs/fat/ff.c deleted file mode 100644 index 9d1eca723..000000000 --- a/os/lib/fs/fat/ff.c +++ /dev/null @@ -1,6042 +0,0 @@ -/*----------------------------------------------------------------------------/ -/ FatFs - Generic FAT file system module R0.12b / -/-----------------------------------------------------------------------------/ -/ -/ Copyright (C) 2016, ChaN, all right reserved. -/ -/ FatFs module is an open source software. Redistribution and use of FatFs in -/ source and binary forms, with or without modification, are permitted provided -/ that the following condition is met: - -/ 1. Redistributions of source code must retain the above copyright notice, -/ this condition and the following disclaimer. -/ -/ This software is provided by the copyright holder and contributors "AS IS" -/ and any warranties related to this software are DISCLAIMED. -/ The copyright owner or contributors be NOT LIABLE for any damages caused -/ by use of this software. -/----------------------------------------------------------------------------*/ - - -#include "ff.h" /* Declarations of FatFs API */ -#include "diskio.h" /* Declarations of device I/O functions */ - - -/*-------------------------------------------------------------------------- - - Module Private Definitions - ----------------------------------------------------------------------------*/ - -#if _FATFS != 68020 /* Revision ID */ -#error Wrong include file (ff.h). -#endif - - -#define ABORT(fs, res) { fp->err = (BYTE)(res); LEAVE_FF(fs, res); } - - -/* Reentrancy related */ -#if _FS_REENTRANT -#if _USE_LFN == 1 -#error Static LFN work area cannot be used at thread-safe configuration -#endif -#define ENTER_FF(fs) { if (!lock_fs(fs)) return FR_TIMEOUT; } -#define LEAVE_FF(fs, res) { unlock_fs(fs, res); return res; } -#else -#define ENTER_FF(fs) -#define LEAVE_FF(fs, res) return res -#endif - - - -/* Definitions of sector size */ -#if (_MAX_SS < _MIN_SS) || (_MAX_SS != 512 && _MAX_SS != 1024 && _MAX_SS != 2048 && _MAX_SS != 4096) || (_MIN_SS != 512 && _MIN_SS != 1024 && _MIN_SS != 2048 && _MIN_SS != 4096) -#error Wrong sector size configuration -#endif -#if _MAX_SS == _MIN_SS -#define SS(fs) ((UINT)_MAX_SS) /* Fixed sector size */ -#else -#define SS(fs) ((fs)->ssize) /* Variable sector size */ -#endif - - -/* Timestamp */ -#if _FS_NORTC == 1 -#if _NORTC_YEAR < 1980 || _NORTC_YEAR > 2107 || _NORTC_MON < 1 || _NORTC_MON > 12 || _NORTC_MDAY < 1 || _NORTC_MDAY > 31 -#error Invalid _FS_NORTC settings -#endif -#define GET_FATTIME() ((DWORD)(_NORTC_YEAR - 1980) << 25 | (DWORD)_NORTC_MON << 21 | (DWORD)_NORTC_MDAY << 16) -#else -#define GET_FATTIME() get_fattime() -#endif - - -/* File lock controls */ -#if _FS_LOCK != 0 -#if _FS_READONLY -#error _FS_LOCK must be 0 at read-only configuration -#endif -typedef struct { - FATFS *fs; /* Object ID 1, volume (NULL:blank entry) */ - DWORD clu; /* Object ID 2, directory (0:root) */ - DWORD ofs; /* Object ID 3, directory offset */ - WORD ctr; /* Object open counter, 0:none, 0x01..0xFF:read mode open count, 0x100:write mode */ -} FILESEM; -#endif - - - -/* DBCS code ranges and SBCS upper conversion tables */ - -#if _CODE_PAGE == 932 /* Japanese Shift-JIS */ -#define _DF1S 0x81 /* DBC 1st byte range 1 start */ -#define _DF1E 0x9F /* DBC 1st byte range 1 end */ -#define _DF2S 0xE0 /* DBC 1st byte range 2 start */ -#define _DF2E 0xFC /* DBC 1st byte range 2 end */ -#define _DS1S 0x40 /* DBC 2nd byte range 1 start */ -#define _DS1E 0x7E /* DBC 2nd byte range 1 end */ -#define _DS2S 0x80 /* DBC 2nd byte range 2 start */ -#define _DS2E 0xFC /* DBC 2nd byte range 2 end */ - -#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */ -#define _DF1S 0x81 -#define _DF1E 0xFE -#define _DS1S 0x40 -#define _DS1E 0x7E -#define _DS2S 0x80 -#define _DS2E 0xFE - -#elif _CODE_PAGE == 949 /* Korean */ -#define _DF1S 0x81 -#define _DF1E 0xFE -#define _DS1S 0x41 -#define _DS1E 0x5A -#define _DS2S 0x61 -#define _DS2E 0x7A -#define _DS3S 0x81 -#define _DS3E 0xFE - -#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */ -#define _DF1S 0x81 -#define _DF1E 0xFE -#define _DS1S 0x40 -#define _DS1E 0x7E -#define _DS2S 0xA1 -#define _DS2E 0xFE - -#elif _CODE_PAGE == 437 /* U.S. */ -#define _DF1S 0 -#define _EXCVT {0x80,0x9A,0x45,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \ - 0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ - 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 720 /* Arabic */ -#define _DF1S 0 -#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ - 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 737 /* Greek */ -#define _DF1S 0 -#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ - 0x90,0x92,0x92,0x93,0x94,0x95,0x96,0x97,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, \ - 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0xAA,0x92,0x93,0x94,0x95,0x96, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0x97,0xEA,0xEB,0xEC,0xE4,0xED,0xEE,0xEF,0xF5,0xF0,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 771 /* KBL */ -#define _DF1S 0 -#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDC,0xDE,0xDE, \ - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ - 0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFE,0xFF} - -#elif _CODE_PAGE == 775 /* Baltic */ -#define _DF1S 0 -#define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0x95,0x8F,0x80,0xAD,0xED,0x8A,0x8A,0xA1,0x8D,0x8E,0x8F, \ - 0x90,0x92,0x92,0xE2,0x99,0x95,0x96,0x97,0x97,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \ - 0xA0,0xA1,0xE0,0xA3,0xA3,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xB5,0xB6,0xB7,0xB8,0xBD,0xBE,0xC6,0xC7,0xA5,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE3,0xE8,0xE8,0xEA,0xEA,0xEE,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 850 /* Latin 1 */ -#define _DF1S 0 -#define _EXCVT {0x43,0x55,0x45,0x41,0x41,0x41,0x41,0x43,0x45,0x45,0x45,0x49,0x49,0x49,0x41,0x41, \ - 0x45,0x92,0x92,0x4F,0x4F,0x4F,0x55,0x55,0x59,0x4F,0x55,0x4F,0x9C,0x4F,0x9E,0x9F, \ - 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0x41,0x41,0x41,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0x41,0x41,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD1,0xD1,0x45,0x45,0x45,0x49,0x49,0x49,0x49,0xD9,0xDA,0xDB,0xDC,0xDD,0x49,0xDF, \ - 0x4F,0xE1,0x4F,0x4F,0x4F,0x4F,0xE6,0xE8,0xE8,0x55,0x55,0x55,0x59,0x59,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 852 /* Latin 2 */ -#define _DF1S 0 -#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F, \ - 0x90,0x91,0x91,0xE2,0x99,0x95,0x95,0x97,0x97,0x99,0x9A,0x9B,0x9B,0x9D,0x9E,0xAC, \ - 0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8,0xA8,0xAA,0x8D,0xAC,0xB8,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBD,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC6,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD1,0xD1,0xD2,0xD3,0xD2,0xD5,0xD6,0xD7,0xB7,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE3,0xD5,0xE6,0xE6,0xE8,0xE9,0xE8,0xEB,0xED,0xED,0xDD,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF} - -#elif _CODE_PAGE == 855 /* Cyrillic */ -#define _DF1S 0 -#define _EXCVT {0x81,0x81,0x83,0x83,0x85,0x85,0x87,0x87,0x89,0x89,0x8B,0x8B,0x8D,0x8D,0x8F,0x8F, \ - 0x91,0x91,0x93,0x93,0x95,0x95,0x97,0x97,0x99,0x99,0x9B,0x9B,0x9D,0x9D,0x9F,0x9F, \ - 0xA1,0xA1,0xA3,0xA3,0xA5,0xA5,0xA7,0xA7,0xA9,0xA9,0xAB,0xAB,0xAD,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB6,0xB6,0xB8,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD1,0xD1,0xD3,0xD3,0xD5,0xD5,0xD7,0xD7,0xDD,0xD9,0xDA,0xDB,0xDC,0xDD,0xE0,0xDF, \ - 0xE0,0xE2,0xE2,0xE4,0xE4,0xE6,0xE6,0xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE,0xEF, \ - 0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 857 /* Turkish */ -#define _DF1S 0 -#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0x49,0x8E,0x8F, \ - 0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x98,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9E, \ - 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA6,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0x49,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xDE,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 860 /* Portuguese */ -#define _DF1S 0 -#define _EXCVT {0x80,0x9A,0x90,0x8F,0x8E,0x91,0x86,0x80,0x89,0x89,0x92,0x8B,0x8C,0x98,0x8E,0x8F, \ - 0x90,0x91,0x92,0x8C,0x99,0xA9,0x96,0x9D,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ - 0x86,0x8B,0x9F,0x96,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 861 /* Icelandic */ -#define _DF1S 0 -#define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x8B,0x8B,0x8D,0x8E,0x8F, \ - 0x90,0x92,0x92,0x4F,0x99,0x8D,0x55,0x97,0x97,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \ - 0xA4,0xA5,0xA6,0xA7,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 862 /* Hebrew */ -#define _DF1S 0 -#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ - 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 863 /* Canadian-French */ -#define _DF1S 0 -#define _EXCVT {0x43,0x55,0x45,0x41,0x41,0x41,0x86,0x43,0x45,0x45,0x45,0x49,0x49,0x8D,0x41,0x8F, \ - 0x45,0x45,0x45,0x4F,0x45,0x49,0x55,0x55,0x98,0x4F,0x55,0x9B,0x9C,0x55,0x55,0x9F, \ - 0xA0,0xA1,0x4F,0x55,0xA4,0xA5,0xA6,0xA7,0x49,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 864 /* Arabic */ -#define _DF1S 0 -#define _EXCVT {0x80,0x9A,0x45,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \ - 0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ - 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 865 /* Nordic */ -#define _DF1S 0 -#define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \ - 0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ - 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, \ - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 866 /* Russian */ -#define _DF1S 0 -#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ - 0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} - -#elif _CODE_PAGE == 869 /* Greek 2 */ -#define _DF1S 0 -#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x86,0x9C,0x8D,0x8F,0x90, \ - 0x91,0x90,0x92,0x95,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \ - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, \ - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xA4,0xA5,0xA6,0xD9,0xDA,0xDB,0xDC,0xA7,0xA8,0xDF, \ - 0xA9,0xAA,0xAC,0xAD,0xB5,0xB6,0xB7,0xB8,0xBD,0xBE,0xC6,0xC7,0xCF,0xCF,0xD0,0xEF, \ - 0xF0,0xF1,0xD1,0xD2,0xD3,0xF5,0xD4,0xF7,0xF8,0xF9,0xD5,0x96,0x95,0x98,0xFE,0xFF} - -#elif _CODE_PAGE == 1 /* ASCII (for only non-LFN cfg) */ -#if _USE_LFN != 0 -#error Cannot enable LFN without valid code page. -#endif -#define _DF1S 0 - -#else -#error Unknown code page - -#endif - - -/* Character code support macros */ -#define IsUpper(c) (((c)>='A')&&((c)<='Z')) -#define IsLower(c) (((c)>='a')&&((c)<='z')) -#define IsDigit(c) (((c)>='0')&&((c)<='9')) - -#if _DF1S != 0 /* Code page is DBCS */ - -#ifdef _DF2S /* Two 1st byte areas */ -#define IsDBCS1(c) (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E)) -#else /* One 1st byte area */ -#define IsDBCS1(c) ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) -#endif - -#ifdef _DS3S /* Three 2nd byte areas */ -#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E)) -#else /* Two 2nd byte areas */ -#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E)) -#endif - -#else /* Code page is SBCS */ - -#define IsDBCS1(c) 0 -#define IsDBCS2(c) 0 - -#endif /* _DF1S */ - - -/* File attribute bits (internal use) */ -#define AM_VOL 0x08 /* Volume label */ -#define AM_LFN 0x0F /* LFN entry */ -#define AM_MASK 0x3F /* Mask of defined bits */ - - -/* File access control and file status flags (internal use) */ -#define FA_SEEKEND 0x20 /* Seek to end of the file on file open */ -#define FA_MODIFIED 0x40 /* File has been modified */ -#define FA_DIRTY 0x80 /* FIL.buf[] needs to be written-back */ - - -/* Name status flags */ -#define NSFLAG 11 /* Index of name status byte in fn[] */ -#define NS_LOSS 0x01 /* Out of 8.3 format */ -#define NS_LFN 0x02 /* Force to create LFN entry */ -#define NS_LAST 0x04 /* Last segment */ -#define NS_BODY 0x08 /* Lower case flag (body) */ -#define NS_EXT 0x10 /* Lower case flag (ext) */ -#define NS_DOT 0x20 /* Dot entry */ -#define NS_NOLFN 0x40 /* Do not find LFN */ -#define NS_NONAME 0x80 /* Not followed */ - - -/* Limits and boundaries (differ from specs but correct for real DOS/Windows) */ -#define MAX_FAT12 0xFF5 /* Maximum number of FAT12 clusters */ -#define MAX_FAT16 0xFFF5 /* Maximum number of FAT16 clusters */ -#define MAX_FAT32 0xFFFFFF5 /* Maximum number of FAT32 clusters */ -#define MAX_EXFAT 0x7FFFFFFD /* Maximum number of exFAT clusters (limited by implementation) */ -#define MAX_DIR 0x200000 /* Maximum size of FAT directory */ -#define MAX_DIR_EX 0x10000000 /* Maximum size of exFAT directory */ - - -/* FatFs refers the members in the FAT structures as byte array instead of -/ structure members because the structure is not binary compatible between -/ different platforms */ - -#define BS_JmpBoot 0 /* x86 jump instruction (3-byte) */ -#define BS_OEMName 3 /* OEM name (8-byte) */ -#define BPB_BytsPerSec 11 /* Sector size [byte] (WORD) */ -#define BPB_SecPerClus 13 /* Cluster size [sector] (BYTE) */ -#define BPB_RsvdSecCnt 14 /* Size of reserved area [sector] (WORD) */ -#define BPB_NumFATs 16 /* Number of FATs (BYTE) */ -#define BPB_RootEntCnt 17 /* Size of root directory area for FAT12/16 [entry] (WORD) */ -#define BPB_TotSec16 19 /* Volume size (16-bit) [sector] (WORD) */ -#define BPB_Media 21 /* Media descriptor byte (BYTE) */ -#define BPB_FATSz16 22 /* FAT size (16-bit) [sector] (WORD) */ -#define BPB_SecPerTrk 24 /* Track size for int13h [sector] (WORD) */ -#define BPB_NumHeads 26 /* Number of heads for int13h (WORD) */ -#define BPB_HiddSec 28 /* Volume offset from top of the drive (DWORD) */ -#define BPB_TotSec32 32 /* Volume size (32-bit) [sector] (DWORD) */ -#define BS_DrvNum 36 /* Physical drive number for int13h (BYTE) */ -#define BS_NTres 37 /* Error flag (BYTE) */ -#define BS_BootSig 38 /* Extended boot signature (BYTE) */ -#define BS_VolID 39 /* Volume serial number (DWORD) */ -#define BS_VolLab 43 /* Volume label string (8-byte) */ -#define BS_FilSysType 54 /* File system type string (8-byte) */ -#define BS_BootCode 62 /* Boot code (448-byte) */ -#define BS_55AA 510 /* Signature word (WORD) */ - -#define BPB_FATSz32 36 /* FAT32: FAT size [sector] (DWORD) */ -#define BPB_ExtFlags32 40 /* FAT32: Extended flags (WORD) */ -#define BPB_FSVer32 42 /* FAT32: File system version (WORD) */ -#define BPB_RootClus32 44 /* FAT32: Root directory cluster (DWORD) */ -#define BPB_FSInfo32 48 /* FAT32: Offset of FSINFO sector (WORD) */ -#define BPB_BkBootSec32 50 /* FAT32: Offset of backup boot sector (WORD) */ -#define BS_DrvNum32 64 /* FAT32: Physical drive number for int13h (BYTE) */ -#define BS_NTres32 65 /* FAT32: Error flag (BYTE) */ -#define BS_BootSig32 66 /* FAT32: Extended boot signature (BYTE) */ -#define BS_VolID32 67 /* FAT32: Volume serial number (DWORD) */ -#define BS_VolLab32 71 /* FAT32: Volume label string (8-byte) */ -#define BS_FilSysType32 82 /* FAT32: File system type string (8-byte) */ -#define BS_BootCode32 90 /* FAT32: Boot code (420-byte) */ - -#define BPB_ZeroedEx 11 /* exFAT: MBZ field (53-byte) */ -#define BPB_VolOfsEx 64 /* exFAT: Volume offset from top of the drive [sector] (QWORD) */ -#define BPB_TotSecEx 72 /* exFAT: Volume size [sector] (QWORD) */ -#define BPB_FatOfsEx 80 /* exFAT: FAT offset from top of the volume [sector] (DWORD) */ -#define BPB_FatSzEx 84 /* exFAT: FAT size [sector] (DWORD) */ -#define BPB_DataOfsEx 88 /* exFAT: Data offset from top of the volume [sector] (DWORD) */ -#define BPB_NumClusEx 92 /* exFAT: Number of clusters (DWORD) */ -#define BPB_RootClusEx 96 /* exFAT: Root directory cluster (DWORD) */ -#define BPB_VolIDEx 100 /* exFAT: Volume serial number (DWORD) */ -#define BPB_FSVerEx 104 /* exFAT: File system version (WORD) */ -#define BPB_VolFlagEx 106 /* exFAT: Volume flags (BYTE) */ -#define BPB_ActFatEx 107 /* exFAT: Active FAT flags (BYTE) */ -#define BPB_BytsPerSecEx 108 /* exFAT: Log2 of sector size in byte (BYTE) */ -#define BPB_SecPerClusEx 109 /* exFAT: Log2 of cluster size in sector (BYTE) */ -#define BPB_NumFATsEx 110 /* exFAT: Number of FATs (BYTE) */ -#define BPB_DrvNumEx 111 /* exFAT: Physical drive number for int13h (BYTE) */ -#define BPB_PercInUseEx 112 /* exFAT: Percent in use (BYTE) */ -#define BPB_RsvdEx 113 /* exFAT: Reserved (7-byte) */ -#define BS_BootCodeEx 120 /* exFAT: Boot code (390-byte) */ - -#define FSI_LeadSig 0 /* FAT32 FSI: Leading signature (DWORD) */ -#define FSI_StrucSig 484 /* FAT32 FSI: Structure signature (DWORD) */ -#define FSI_Free_Count 488 /* FAT32 FSI: Number of free clusters (DWORD) */ -#define FSI_Nxt_Free 492 /* FAT32 FSI: Last allocated cluster (DWORD) */ - -#define MBR_Table 446 /* MBR: Offset of partition table in the MBR */ -#define SZ_PTE 16 /* MBR: Size of a partition table entry */ -#define PTE_Boot 0 /* MBR PTE: Boot indicator */ -#define PTE_StHead 1 /* MBR PTE: Start head */ -#define PTE_StSec 2 /* MBR PTE: Start sector */ -#define PTE_StCyl 3 /* MBR PTE: Start cylinder */ -#define PTE_System 4 /* MBR PTE: System ID */ -#define PTE_EdHead 5 /* MBR PTE: End head */ -#define PTE_EdSec 6 /* MBR PTE: End sector */ -#define PTE_EdCyl 7 /* MBR PTE: End cylinder */ -#define PTE_StLba 8 /* MBR PTE: Start in LBA */ -#define PTE_SizLba 12 /* MBR PTE: Size in LBA */ - -#define DIR_Name 0 /* Short file name (11-byte) */ -#define DIR_Attr 11 /* Attribute (BYTE) */ -#define DIR_NTres 12 /* Lower case flag (BYTE) */ -#define DIR_CrtTime10 13 /* Created time sub-second (BYTE) */ -#define DIR_CrtTime 14 /* Created time (DWORD) */ -#define DIR_LstAccDate 18 /* Last accessed date (WORD) */ -#define DIR_FstClusHI 20 /* Higher 16-bit of first cluster (WORD) */ -#define DIR_ModTime 22 /* Modified time (DWORD) */ -#define DIR_FstClusLO 26 /* Lower 16-bit of first cluster (WORD) */ -#define DIR_FileSize 28 /* File size (DWORD) */ -#define LDIR_Ord 0 /* LFN entry order and LLE flag (BYTE) */ -#define LDIR_Attr 11 /* LFN attribute (BYTE) */ -#define LDIR_Type 12 /* LFN type (BYTE) */ -#define LDIR_Chksum 13 /* Checksum of the SFN entry (BYTE) */ -#define LDIR_FstClusLO 26 /* Must be zero (WORD) */ -#define XDIR_Type 0 /* Type of exFAT directory entry (BYTE) */ -#define XDIR_NumLabel 1 /* Number of volume label characters (BYTE) */ -#define XDIR_Label 2 /* Volume label (11-WORD) */ -#define XDIR_CaseSum 4 /* Sum of case conversion table (DWORD) */ -#define XDIR_NumSec 1 /* Number of secondary entries (BYTE) */ -#define XDIR_SetSum 2 /* Sum of the set of directory entries (WORD) */ -#define XDIR_Attr 4 /* File attribute (WORD) */ -#define XDIR_CrtTime 8 /* Created time (DWORD) */ -#define XDIR_ModTime 12 /* Modified time (DWORD) */ -#define XDIR_AccTime 16 /* Last accessed time (DWORD) */ -#define XDIR_CrtTime10 20 /* Created time subsecond (BYTE) */ -#define XDIR_ModTime10 21 /* Modified time subsecond (BYTE) */ -#define XDIR_CrtTZ 22 /* Created timezone (BYTE) */ -#define XDIR_ModTZ 23 /* Modified timezone (BYTE) */ -#define XDIR_AccTZ 24 /* Last accessed timezone (BYTE) */ -#define XDIR_GenFlags 33 /* Gneral secondary flags (WORD) */ -#define XDIR_NumName 35 /* Number of file name characters (BYTE) */ -#define XDIR_NameHash 36 /* Hash of file name (WORD) */ -#define XDIR_ValidFileSize 40 /* Valid file size (QWORD) */ -#define XDIR_FstClus 52 /* First cluster of the file data (DWORD) */ -#define XDIR_FileSize 56 /* File/Directory size (QWORD) */ - -#define SZDIRE 32 /* Size of a directory entry */ -#define LLEF 0x40 /* Last long entry flag in LDIR_Ord */ -#define DDEM 0xE5 /* Deleted directory entry mark set to DIR_Name[0] */ -#define RDDEM 0x05 /* Replacement of the character collides with DDEM */ - - - - - -/*-------------------------------------------------------------------------- - - Module Private Work Area - ----------------------------------------------------------------------------*/ - -/* Remark: Variables here without initial value shall be guaranteed zero/null -/ at start-up. If not, either the linker or start-up routine being used is -/ not compliance with C standard. */ - -#if _VOLUMES < 1 || _VOLUMES > 9 -#error Wrong _VOLUMES setting -#endif -static FATFS *FatFs[_VOLUMES]; /* Pointer to the file system objects (logical drives) */ -static WORD Fsid; /* File system mount ID */ - -#if _FS_RPATH != 0 && _VOLUMES >= 2 -static BYTE CurrVol; /* Current drive */ -#endif - -#if _FS_LOCK != 0 -static FILESEM Files[_FS_LOCK]; /* Open object lock semaphores */ -#endif - -#if _USE_LFN == 0 /* Non-LFN configuration */ -#define DEF_NAMBUF -#define INIT_NAMBUF(fs) -#define FREE_NAMBUF() -#else -#if _MAX_LFN < 12 || _MAX_LFN > 255 -#error Wrong _MAX_LFN setting -#endif - -#if _USE_LFN == 1 /* LFN enabled with static working buffer */ -#if _FS_EXFAT -static BYTE DirBuf[SZDIRE*19]; /* Directory entry block scratchpad buffer (19 entries in size) */ -#endif -static WCHAR LfnBuf[_MAX_LFN+1]; /* LFN enabled with static working buffer */ -#define DEF_NAMBUF -#define INIT_NAMBUF(fs) -#define FREE_NAMBUF() - -#elif _USE_LFN == 2 /* LFN enabled with dynamic working buffer on the stack */ -#if _FS_EXFAT -#define DEF_NAMBUF WCHAR lbuf[_MAX_LFN+1]; BYTE dbuf[SZDIRE*19]; -#define INIT_NAMBUF(fs) { (fs)->lfnbuf = lbuf; (fs)->dirbuf = dbuf; } -#define FREE_NAMBUF() -#else -#define DEF_NAMBUF WCHAR lbuf[_MAX_LFN+1]; -#define INIT_NAMBUF(fs) { (fs)->lfnbuf = lbuf; } -#define FREE_NAMBUF() -#endif - -#elif _USE_LFN == 3 /* LFN enabled with dynamic working buffer on the heap */ -#if _FS_EXFAT -#define DEF_NAMBUF WCHAR *lfn; -#define INIT_NAMBUF(fs) { lfn = ff_memalloc((_MAX_LFN+1)*2 + SZDIRE*19); if (!lfn) LEAVE_FF(fs, FR_NOT_ENOUGH_CORE); (fs)->lfnbuf = lfn; (fs)->dirbuf = (BYTE*)(lfn+_MAX_LFN+1); } -#define FREE_NAMBUF() ff_memfree(lfn) -#else -#define DEF_NAMBUF WCHAR *lfn; -#define INIT_NAMBUF(fs) { lfn = ff_memalloc((_MAX_LFN+1)*2); if (!lfn) LEAVE_FF(fs, FR_NOT_ENOUGH_CORE); (fs)->lfnbuf = lfn; } -#define FREE_NAMBUF() ff_memfree(lfn) -#endif - -#else -#error Wrong _USE_LFN setting -#endif -#endif - -#ifdef _EXCVT -static const BYTE ExCvt[] = _EXCVT; /* Upper conversion table for SBCS extended characters */ -#endif - - - - - - -/*-------------------------------------------------------------------------- - - Module Private Functions - ----------------------------------------------------------------------------*/ - - -/*-----------------------------------------------------------------------*/ -/* Load/Store multi-byte word in the FAT structure */ -/*-----------------------------------------------------------------------*/ - -static -WORD ld_word (const BYTE* ptr) /* Load a 2-byte little-endian word */ -{ - WORD rv; - - rv = ptr[1]; - rv = rv << 8 | ptr[0]; - return rv; -} - -static -DWORD ld_dword (const BYTE* ptr) /* Load a 4-byte little-endian word */ -{ - DWORD rv; - - rv = ptr[3]; - rv = rv << 8 | ptr[2]; - rv = rv << 8 | ptr[1]; - rv = rv << 8 | ptr[0]; - return rv; -} - -#if _FS_EXFAT -static -QWORD ld_qword (const BYTE* ptr) /* Load an 8-byte little-endian word */ -{ - QWORD rv; - - rv = ptr[7]; - rv = rv << 8 | ptr[6]; - rv = rv << 8 | ptr[5]; - rv = rv << 8 | ptr[4]; - rv = rv << 8 | ptr[3]; - rv = rv << 8 | ptr[2]; - rv = rv << 8 | ptr[1]; - rv = rv << 8 | ptr[0]; - return rv; -} -#endif - -#if !_FS_READONLY -static -void st_word (BYTE* ptr, WORD val) /* Store a 2-byte word in little-endian */ -{ - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; -} - -static -void st_dword (BYTE* ptr, DWORD val) /* Store a 4-byte word in little-endian */ -{ - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; -} - -#if _FS_EXFAT -static -void st_qword (BYTE* ptr, QWORD val) /* Store an 8-byte word in little-endian */ -{ - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; val >>= 8; - *ptr++ = (BYTE)val; -} -#endif -#endif /* !_FS_READONLY */ - - - -/*-----------------------------------------------------------------------*/ -/* String functions */ -/*-----------------------------------------------------------------------*/ - -/* Copy memory to memory */ -static -void mem_cpy (void* dst, const void* src, UINT cnt) { - BYTE *d = (BYTE*)dst; - const BYTE *s = (const BYTE*)src; - - if (cnt) { - do *d++ = *s++; while (--cnt); - } -} - -/* Fill memory block */ -static -void mem_set (void* dst, int val, UINT cnt) { - BYTE *d = (BYTE*)dst; - - do *d++ = (BYTE)val; while (--cnt); -} - -/* Compare memory block */ -static -int mem_cmp (const void* dst, const void* src, UINT cnt) { /* ZR:same, NZ:different */ - const BYTE *d = (const BYTE *)dst, *s = (const BYTE *)src; - int r = 0; - - do { - r = *d++ - *s++; - } while (--cnt && r == 0); - - return r; -} - -/* Check if chr is contained in the string */ -static -int chk_chr (const char* str, int chr) { /* NZ:contained, ZR:not contained */ - while (*str && *str != chr) str++; - return *str; -} - - - - -#if _FS_REENTRANT -/*-----------------------------------------------------------------------*/ -/* Request/Release grant to access the volume */ -/*-----------------------------------------------------------------------*/ -static -int lock_fs ( - FATFS* fs /* File system object */ -) -{ - return ff_req_grant(fs->sobj); -} - - -static -void unlock_fs ( - FATFS* fs, /* File system object */ - FRESULT res /* Result code to be returned */ -) -{ - if (fs && res != FR_NOT_ENABLED && res != FR_INVALID_DRIVE && res != FR_TIMEOUT) { - ff_rel_grant(fs->sobj); - } -} - -#endif - - - -#if _FS_LOCK != 0 -/*-----------------------------------------------------------------------*/ -/* File lock control functions */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT chk_lock ( /* Check if the file can be accessed */ - DIR* dp, /* Directory object pointing the file to be checked */ - int acc /* Desired access type (0:Read, 1:Write, 2:Delete/Rename) */ -) -{ - UINT i, be; - - /* Search file semaphore table */ - for (i = be = 0; i < _FS_LOCK; i++) { - if (Files[i].fs) { /* Existing entry */ - if (Files[i].fs == dp->obj.fs && /* Check if the object matched with an open object */ - Files[i].clu == dp->obj.sclust && - Files[i].ofs == dp->dptr) break; - } else { /* Blank entry */ - be = 1; - } - } - if (i == _FS_LOCK) { /* The object is not opened */ - return (be || acc == 2) ? FR_OK : FR_TOO_MANY_OPEN_FILES; /* Is there a blank entry for new object? */ - } - - /* The object has been opened. Reject any open against writing file and all write mode open */ - return (acc || Files[i].ctr == 0x100) ? FR_LOCKED : FR_OK; -} - - -static -int enq_lock (void) /* Check if an entry is available for a new object */ -{ - UINT i; - - for (i = 0; i < _FS_LOCK && Files[i].fs; i++) ; - return (i == _FS_LOCK) ? 0 : 1; -} - - -static -UINT inc_lock ( /* Increment object open counter and returns its index (0:Internal error) */ - DIR* dp, /* Directory object pointing the file to register or increment */ - int acc /* Desired access (0:Read, 1:Write, 2:Delete/Rename) */ -) -{ - UINT i; - - - for (i = 0; i < _FS_LOCK; i++) { /* Find the object */ - if (Files[i].fs == dp->obj.fs && - Files[i].clu == dp->obj.sclust && - Files[i].ofs == dp->dptr) break; - } - - if (i == _FS_LOCK) { /* Not opened. Register it as new. */ - for (i = 0; i < _FS_LOCK && Files[i].fs; i++) ; - if (i == _FS_LOCK) return 0; /* No free entry to register (int err) */ - Files[i].fs = dp->obj.fs; - Files[i].clu = dp->obj.sclust; - Files[i].ofs = dp->dptr; - Files[i].ctr = 0; - } - - if (acc && Files[i].ctr) return 0; /* Access violation (int err) */ - - Files[i].ctr = acc ? 0x100 : Files[i].ctr + 1; /* Set semaphore value */ - - return i + 1; -} - - -static -FRESULT dec_lock ( /* Decrement object open counter */ - UINT i /* Semaphore index (1..) */ -) -{ - WORD n; - FRESULT res; - - - if (--i < _FS_LOCK) { /* Shift index number origin from 0 */ - n = Files[i].ctr; - if (n == 0x100) n = 0; /* If write mode open, delete the entry */ - if (n > 0) n--; /* Decrement read mode open count */ - Files[i].ctr = n; - if (n == 0) Files[i].fs = 0; /* Delete the entry if open count gets zero */ - res = FR_OK; - } else { - res = FR_INT_ERR; /* Invalid index nunber */ - } - return res; -} - - -static -void clear_lock ( /* Clear lock entries of the volume */ - FATFS *fs -) -{ - UINT i; - - for (i = 0; i < _FS_LOCK; i++) { - if (Files[i].fs == fs) Files[i].fs = 0; - } -} - -#endif /* _FS_LOCK != 0 */ - - - -/*-----------------------------------------------------------------------*/ -/* Move/Flush disk access window in the file system object */ -/*-----------------------------------------------------------------------*/ -#if !_FS_READONLY -static -FRESULT sync_window ( /* Returns FR_OK or FR_DISK_ERROR */ - FATFS* fs /* File system object */ -) -{ - DWORD wsect; - UINT nf; - FRESULT res = FR_OK; - - - if (fs->wflag) { /* Write back the sector if it is dirty */ - wsect = fs->winsect; /* Current sector number */ - if (disk_write(fs->drv, fs->win, wsect, 1) != RES_OK) { - res = FR_DISK_ERR; - } else { - fs->wflag = 0; - if (wsect - fs->fatbase < fs->fsize) { /* Is it in the FAT area? */ - for (nf = fs->n_fats; nf >= 2; nf--) { /* Reflect the change to all FAT copies */ - wsect += fs->fsize; - disk_write(fs->drv, fs->win, wsect, 1); - } - } - } - } - return res; -} -#endif - - -static -FRESULT move_window ( /* Returns FR_OK or FR_DISK_ERROR */ - FATFS* fs, /* File system object */ - DWORD sector /* Sector number to make appearance in the fs->win[] */ -) -{ - FRESULT res = FR_OK; - - - if (sector != fs->winsect) { /* Window offset changed? */ -#if !_FS_READONLY - res = sync_window(fs); /* Write-back changes */ -#endif - if (res == FR_OK) { /* Fill sector window with new data */ - if (disk_read(fs->drv, fs->win, sector, 1) != RES_OK) { - sector = 0xFFFFFFFF; /* Invalidate window if data is not reliable */ - res = FR_DISK_ERR; - } - fs->winsect = sector; - } - } - return res; -} - - - - -#if !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* Synchronize file system and strage device */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT sync_fs ( /* FR_OK:succeeded, !=0:error */ - FATFS* fs /* File system object */ -) -{ - FRESULT res; - - - res = sync_window(fs); - if (res == FR_OK) { - /* Update FSInfo sector if needed */ - if (fs->fs_type == FS_FAT32 && fs->fsi_flag == 1) { - /* Create FSInfo structure */ - mem_set(fs->win, 0, SS(fs)); - st_word(fs->win + BS_55AA, 0xAA55); - st_dword(fs->win + FSI_LeadSig, 0x41615252); - st_dword(fs->win + FSI_StrucSig, 0x61417272); - st_dword(fs->win + FSI_Free_Count, fs->free_clst); - st_dword(fs->win + FSI_Nxt_Free, fs->last_clst); - /* Write it into the FSInfo sector */ - fs->winsect = fs->volbase + 1; - disk_write(fs->drv, fs->win, fs->winsect, 1); - fs->fsi_flag = 0; - } - /* Make sure that no pending write process in the physical drive */ - if (disk_ioctl(fs->drv, CTRL_SYNC, 0) != RES_OK) res = FR_DISK_ERR; - } - - return res; -} - -#endif - - - -/*-----------------------------------------------------------------------*/ -/* Get sector# from cluster# */ -/*-----------------------------------------------------------------------*/ - -static -DWORD clust2sect ( /* !=0:Sector number, 0:Failed (invalid cluster#) */ - FATFS* fs, /* File system object */ - DWORD clst /* Cluster# to be converted */ -) -{ - clst -= 2; - if (clst >= fs->n_fatent - 2) return 0; /* Invalid cluster# */ - return clst * fs->csize + fs->database; -} - - - - -/*-----------------------------------------------------------------------*/ -/* FAT access - Read value of a FAT entry */ -/*-----------------------------------------------------------------------*/ - -static -DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Internal error, 2..0x7FFFFFFF:Cluster status */ - _FDID* obj, /* Corresponding object */ - DWORD clst /* Cluster number to get the value */ -) -{ - UINT wc, bc; - DWORD val; - FATFS *fs = obj->fs; - - - if (clst < 2 || clst >= fs->n_fatent) { /* Check if in valid range */ - val = 1; /* Internal error */ - - } else { - val = 0xFFFFFFFF; /* Default value falls on disk error */ - - switch (fs->fs_type) { - case FS_FAT12 : - bc = (UINT)clst; bc += bc / 2; - if (move_window(fs, fs->fatbase + (bc / SS(fs))) != FR_OK) break; - wc = fs->win[bc++ % SS(fs)]; - if (move_window(fs, fs->fatbase + (bc / SS(fs))) != FR_OK) break; - wc |= fs->win[bc % SS(fs)] << 8; - val = (clst & 1) ? (wc >> 4) : (wc & 0xFFF); - break; - - case FS_FAT16 : - if (move_window(fs, fs->fatbase + (clst / (SS(fs) / 2))) != FR_OK) break; - val = ld_word(fs->win + clst * 2 % SS(fs)); - break; - - case FS_FAT32 : - if (move_window(fs, fs->fatbase + (clst / (SS(fs) / 4))) != FR_OK) break; - val = ld_dword(fs->win + clst * 4 % SS(fs)) & 0x0FFFFFFF; - break; -#if _FS_EXFAT - case FS_EXFAT : - if (obj->objsize) { - DWORD cofs = clst - obj->sclust; /* Offset from start cluster */ - DWORD clen = (DWORD)((obj->objsize - 1) / SS(fs)) / fs->csize; /* Number of clusters - 1 */ - - if (obj->stat == 2) { /* Is there no valid chain on the FAT? */ - if (cofs <= clen) { - val = (cofs == clen) ? 0x7FFFFFFF : clst + 1; /* Generate the value */ - break; - } - } - if (obj->stat == 3 && cofs < obj->n_cont) { /* Is it in the contiguous part? */ - val = clst + 1; /* Generate the value */ - break; - } - if (obj->stat != 2) { /* Get value from FAT if FAT chain is valid */ - if (move_window(fs, fs->fatbase + (clst / (SS(fs) / 4))) != FR_OK) break; - val = ld_dword(fs->win + clst * 4 % SS(fs)) & 0x7FFFFFFF; - break; - } - } - /* go next */ -#endif - default: - val = 1; /* Internal error */ - } - } - - return val; -} - - - - -#if !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* FAT access - Change value of a FAT entry */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT put_fat ( /* FR_OK(0):succeeded, !=0:error */ - FATFS* fs, /* Corresponding file system object */ - DWORD clst, /* FAT index number (cluster number) to be changed */ - DWORD val /* New value to be set to the entry */ -) -{ - UINT bc; - BYTE *p; - FRESULT res = FR_INT_ERR; - - - if (clst >= 2 && clst < fs->n_fatent) { /* Check if in valid range */ - switch (fs->fs_type) { - case FS_FAT12 : /* Bitfield items */ - bc = (UINT)clst; bc += bc / 2; - res = move_window(fs, fs->fatbase + (bc / SS(fs))); - if (res != FR_OK) break; - p = fs->win + bc++ % SS(fs); - *p = (clst & 1) ? ((*p & 0x0F) | ((BYTE)val << 4)) : (BYTE)val; - fs->wflag = 1; - res = move_window(fs, fs->fatbase + (bc / SS(fs))); - if (res != FR_OK) break; - p = fs->win + bc % SS(fs); - *p = (clst & 1) ? (BYTE)(val >> 4) : ((*p & 0xF0) | ((BYTE)(val >> 8) & 0x0F)); - fs->wflag = 1; - break; - - case FS_FAT16 : /* WORD aligned items */ - res = move_window(fs, fs->fatbase + (clst / (SS(fs) / 2))); - if (res != FR_OK) break; - st_word(fs->win + clst * 2 % SS(fs), (WORD)val); - fs->wflag = 1; - break; - - case FS_FAT32 : /* DWORD aligned items */ -#if _FS_EXFAT - case FS_EXFAT : -#endif - res = move_window(fs, fs->fatbase + (clst / (SS(fs) / 4))); - if (res != FR_OK) break; - if (!_FS_EXFAT || fs->fs_type != FS_EXFAT) { - val = (val & 0x0FFFFFFF) | (ld_dword(fs->win + clst * 4 % SS(fs)) & 0xF0000000); - } - st_dword(fs->win + clst * 4 % SS(fs), val); - fs->wflag = 1; - break; - } - } - return res; -} - -#endif /* !_FS_READONLY */ - - - - -#if _FS_EXFAT && !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* exFAT: Accessing FAT and Allocation Bitmap */ -/*-----------------------------------------------------------------------*/ - -/*---------------------------------------------*/ -/* exFAT: Find a contiguous free cluster block */ -/*---------------------------------------------*/ - -static -DWORD find_bitmap ( /* 0:No free cluster, 2..:Free cluster found, 0xFFFFFFFF:Disk error */ - FATFS* fs, /* File system object */ - DWORD clst, /* Cluster number to scan from */ - DWORD ncl /* Number of contiguous clusters to find (1..) */ -) -{ - BYTE bm, bv; - UINT i; - DWORD val, scl, ctr; - - - clst -= 2; /* The first bit in the bitmap corresponds to cluster #2 */ - if (clst >= fs->n_fatent - 2) clst = 0; - scl = val = clst; ctr = 0; - for (;;) { - if (move_window(fs, fs->database + val / 8 / SS(fs)) != FR_OK) return 0xFFFFFFFF; /* (assuming bitmap is located top of the cluster heap) */ - i = val / 8 % SS(fs); bm = 1 << (val % 8); - do { - do { - bv = fs->win[i] & bm; bm <<= 1; /* Get bit value */ - if (++val >= fs->n_fatent - 2) { /* Next cluster (with wrap-around) */ - val = 0; bm = 0; i = 4096; - } - if (!bv) { /* Is it a free cluster? */ - if (++ctr == ncl) return scl + 2; /* Check run length */ - } else { - scl = val; ctr = 0; /* Encountered a live cluster, restart to scan */ - } - if (val == clst) return 0; /* All cluster scanned? */ - } while (bm); - bm = 1; - } while (++i < SS(fs)); - } -} - - -/*------------------------------------*/ -/* exFAT: Set/Clear a block of bitmap */ -/*------------------------------------*/ - -static -FRESULT change_bitmap ( - FATFS* fs, /* File system object */ - DWORD clst, /* Cluster number to change from */ - DWORD ncl, /* Number of clusters to be changed */ - int bv /* bit value to be set (0 or 1) */ -) -{ - BYTE bm; - UINT i; - DWORD sect; - - - clst -= 2; /* The first bit corresponds to cluster #2 */ - sect = fs->database + clst / 8 / SS(fs); /* Sector address (assuming bitmap is located top of the cluster heap) */ - i = clst / 8 % SS(fs); /* Byte offset in the sector */ - bm = 1 << (clst % 8); /* Bit mask in the byte */ - for (;;) { - if (move_window(fs, sect++) != FR_OK) return FR_DISK_ERR; - do { - do { - if (bv == (int)((fs->win[i] & bm) != 0)) return FR_INT_ERR; /* Is the bit expected value? */ - fs->win[i] ^= bm; /* Flip the bit */ - fs->wflag = 1; - if (--ncl == 0) return FR_OK; /* All bits processed? */ - } while (bm <<= 1); /* Next bit */ - bm = 1; - } while (++i < SS(fs)); /* Next byte */ - i = 0; - } -} - - -/*---------------------------------------------*/ -/* Complement contiguous part of the FAT chain */ -/*---------------------------------------------*/ - -static -FRESULT fill_fat_chain ( - _FDID* obj /* Pointer to the corresponding object */ -) -{ - FRESULT res; - DWORD cl, n; - - if (obj->stat == 3) { /* Has the object been changed 'fragmented'? */ - for (cl = obj->sclust, n = obj->n_cont; n; cl++, n--) { /* Create cluster chain on the FAT */ - res = put_fat(obj->fs, cl, cl + 1); - if (res != FR_OK) return res; - } - obj->stat = 0; /* Change status 'FAT chain is valid' */ - } - return FR_OK; -} - -#endif /* _FS_EXFAT && !_FS_READONLY */ - - - -#if !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* FAT handling - Remove a cluster chain */ -/*-----------------------------------------------------------------------*/ -static -FRESULT remove_chain ( /* FR_OK(0):succeeded, !=0:error */ - _FDID* obj, /* Corresponding object */ - DWORD clst, /* Cluster to remove a chain from */ - DWORD pclst /* Previous cluster of clst (0:an entire chain) */ -) -{ - FRESULT res = FR_OK; - DWORD nxt; - FATFS *fs = obj->fs; -#if _FS_EXFAT || _USE_TRIM - DWORD scl = clst, ecl = clst; -#endif -#if _USE_TRIM - DWORD rt[2]; -#endif - - if (clst < 2 || clst >= fs->n_fatent) return FR_INT_ERR; /* Check if in valid range */ - - /* Mark the previous cluster 'EOC' on the FAT if it exists */ - if (pclst && (!_FS_EXFAT || fs->fs_type != FS_EXFAT || obj->stat != 2)) { - res = put_fat(fs, pclst, 0xFFFFFFFF); - if (res != FR_OK) return res; - } - - /* Remove the chain */ - do { - nxt = get_fat(obj, clst); /* Get cluster status */ - if (nxt == 0) break; /* Empty cluster? */ - if (nxt == 1) return FR_INT_ERR; /* Internal error? */ - if (nxt == 0xFFFFFFFF) return FR_DISK_ERR; /* Disk error? */ - if (!_FS_EXFAT || fs->fs_type != FS_EXFAT) { - res = put_fat(fs, clst, 0); /* Mark the cluster 'free' on the FAT */ - if (res != FR_OK) return res; - } - if (fs->free_clst < fs->n_fatent - 2) { /* Update FSINFO */ - fs->free_clst++; - fs->fsi_flag |= 1; - } -#if _FS_EXFAT || _USE_TRIM - if (ecl + 1 == nxt) { /* Is next cluster contiguous? */ - ecl = nxt; - } else { /* End of contiguous cluster block */ -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - res = change_bitmap(fs, scl, ecl - scl + 1, 0); /* Mark the cluster block 'free' on the bitmap */ - if (res != FR_OK) return res; - } -#endif -#if _USE_TRIM - rt[0] = clust2sect(fs, scl); /* Start sector */ - rt[1] = clust2sect(fs, ecl) + fs->csize - 1; /* End sector */ - disk_ioctl(fs->drv, CTRL_TRIM, rt); /* Inform device the block can be erased */ -#endif - scl = ecl = nxt; - } -#endif - clst = nxt; /* Next cluster */ - } while (clst < fs->n_fatent); /* Repeat while not the last link */ - -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - if (pclst == 0) { /* Does object have no chain? */ - obj->stat = 0; /* Change the object status 'initial' */ - } else { - if (obj->stat == 3 && pclst >= obj->sclust && pclst <= obj->sclust + obj->n_cont) { /* Did the chain got contiguous? */ - obj->stat = 2; /* Change the object status 'contiguous' */ - } - } - } -#endif - return FR_OK; -} - - - - -/*-----------------------------------------------------------------------*/ -/* FAT handling - Stretch a chain or Create a new chain */ -/*-----------------------------------------------------------------------*/ -static -DWORD create_chain ( /* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:Disk error, >=2:New cluster# */ - _FDID* obj, /* Corresponding object */ - DWORD clst /* Cluster# to stretch, 0:Create a new chain */ -) -{ - DWORD cs, ncl, scl; - FRESULT res; - FATFS *fs = obj->fs; - - - if (clst == 0) { /* Create a new chain */ - scl = fs->last_clst; /* Get suggested cluster to start from */ - if (scl == 0 || scl >= fs->n_fatent) scl = 1; - } - else { /* Stretch current chain */ - cs = get_fat(obj, clst); /* Check the cluster status */ - if (cs < 2) return 1; /* Invalid value */ - if (cs == 0xFFFFFFFF) return cs; /* A disk error occurred */ - if (cs < fs->n_fatent) return cs; /* It is already followed by next cluster */ - scl = clst; - } - -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { /* On the exFAT volume */ - ncl = find_bitmap(fs, scl, 1); /* Find a free cluster */ - if (ncl == 0 || ncl == 0xFFFFFFFF) return ncl; /* No free cluster or hard error? */ - res = change_bitmap(fs, ncl, 1, 1); /* Mark the cluster 'in use' */ - if (res == FR_INT_ERR) return 1; - if (res == FR_DISK_ERR) return 0xFFFFFFFF; - if (clst == 0) { /* Is it a new chain? */ - obj->stat = 2; /* Set status 'contiguous chain' */ - } else { /* This is a stretched chain */ - if (obj->stat == 2 && ncl != scl + 1) { /* Is the chain got fragmented? */ - obj->n_cont = scl - obj->sclust; /* Set size of the contiguous part */ - obj->stat = 3; /* Change status 'just fragmented' */ - } - } - } else -#endif - { /* On the FAT12/16/32 volume */ - ncl = scl; /* Start cluster */ - for (;;) { - ncl++; /* Next cluster */ - if (ncl >= fs->n_fatent) { /* Check wrap-around */ - ncl = 2; - if (ncl > scl) return 0; /* No free cluster */ - } - cs = get_fat(obj, ncl); /* Get the cluster status */ - if (cs == 0) break; /* Found a free cluster */ - if (cs == 1 || cs == 0xFFFFFFFF) return cs; /* An error occurred */ - if (ncl == scl) return 0; /* No free cluster */ - } - } - - if (_FS_EXFAT && fs->fs_type == FS_EXFAT && obj->stat == 2) { /* Is it a contiguous chain? */ - res = FR_OK; /* FAT does not need to be written */ - } else { - res = put_fat(fs, ncl, 0xFFFFFFFF); /* Mark the new cluster 'EOC' */ - if (res == FR_OK && clst) { - res = put_fat(fs, clst, ncl); /* Link it from the previous one if needed */ - } - } - - if (res == FR_OK) { /* Update FSINFO if function succeeded. */ - fs->last_clst = ncl; - if (fs->free_clst < fs->n_fatent - 2) fs->free_clst--; - fs->fsi_flag |= 1; - } else { - ncl = (res == FR_DISK_ERR) ? 0xFFFFFFFF : 1; /* Failed. Create error status */ - } - - return ncl; /* Return new cluster number or error status */ -} - -#endif /* !_FS_READONLY */ - - - - -#if _USE_FASTSEEK -/*-----------------------------------------------------------------------*/ -/* FAT handling - Convert offset into cluster with link map table */ -/*-----------------------------------------------------------------------*/ - -static -DWORD clmt_clust ( /* <2:Error, >=2:Cluster number */ - FIL* fp, /* Pointer to the file object */ - FSIZE_t ofs /* File offset to be converted to cluster# */ -) -{ - DWORD cl, ncl, *tbl; - FATFS *fs = fp->obj.fs; - - - tbl = fp->cltbl + 1; /* Top of CLMT */ - cl = (DWORD)(ofs / SS(fs) / fs->csize); /* Cluster order from top of the file */ - for (;;) { - ncl = *tbl++; /* Number of cluters in the fragment */ - if (ncl == 0) return 0; /* End of table? (error) */ - if (cl < ncl) break; /* In this fragment? */ - cl -= ncl; tbl++; /* Next fragment */ - } - return cl + *tbl; /* Return the cluster number */ -} - -#endif /* _USE_FASTSEEK */ - - - - -/*-----------------------------------------------------------------------*/ -/* Directory handling - Set directory index */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT dir_sdi ( /* FR_OK(0):succeeded, !=0:error */ - DIR* dp, /* Pointer to directory object */ - DWORD ofs /* Offset of directory table */ -) -{ - DWORD csz, clst; - FATFS *fs = dp->obj.fs; - - - if (ofs >= (DWORD)((_FS_EXFAT && fs->fs_type == FS_EXFAT) ? MAX_DIR_EX : MAX_DIR) || ofs % SZDIRE) { /* Check range of offset and alignment */ - return FR_INT_ERR; - } - dp->dptr = ofs; /* Set current offset */ - clst = dp->obj.sclust; /* Table start cluster (0:root) */ - if (clst == 0 && fs->fs_type >= FS_FAT32) { /* Replace cluster# 0 with root cluster# */ - clst = fs->dirbase; - if (_FS_EXFAT) dp->obj.stat = 0; /* exFAT: Root dir has an FAT chain */ - } - - if (clst == 0) { /* Static table (root-directory in FAT12/16) */ - if (ofs / SZDIRE >= fs->n_rootdir) return FR_INT_ERR; /* Is index out of range? */ - dp->sect = fs->dirbase; - - } else { /* Dynamic table (sub-directory or root-directory in FAT32+) */ - csz = (DWORD)fs->csize * SS(fs); /* Bytes per cluster */ - while (ofs >= csz) { /* Follow cluster chain */ - clst = get_fat(&dp->obj, clst); /* Get next cluster */ - if (clst == 0xFFFFFFFF) return FR_DISK_ERR; /* Disk error */ - if (clst < 2 || clst >= fs->n_fatent) return FR_INT_ERR; /* Reached to end of table or internal error */ - ofs -= csz; - } - dp->sect = clust2sect(fs, clst); - } - dp->clust = clst; /* Current cluster# */ - if (!dp->sect) return FR_INT_ERR; - dp->sect += ofs / SS(fs); /* Sector# of the directory entry */ - dp->dir = fs->win + (ofs % SS(fs)); /* Pointer to the entry in the win[] */ - - return FR_OK; -} - - - - -/*-----------------------------------------------------------------------*/ -/* Directory handling - Move directory table index next */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT dir_next ( /* FR_OK(0):succeeded, FR_NO_FILE:End of table, FR_DENIED:Could not stretch */ - DIR* dp, /* Pointer to the directory object */ - int stretch /* 0: Do not stretch table, 1: Stretch table if needed */ -) -{ - DWORD ofs, clst; - FATFS *fs = dp->obj.fs; -#if !_FS_READONLY - UINT n; -#endif - - ofs = dp->dptr + SZDIRE; /* Next entry */ - if (!dp->sect || ofs >= (DWORD)((_FS_EXFAT && fs->fs_type == FS_EXFAT) ? MAX_DIR_EX : MAX_DIR)) return FR_NO_FILE; /* Report EOT when offset has reached max value */ - - if (ofs % SS(fs) == 0) { /* Sector changed? */ - dp->sect++; /* Next sector */ - - if (!dp->clust) { /* Static table */ - if (ofs / SZDIRE >= fs->n_rootdir) { /* Report EOT if it reached end of static table */ - dp->sect = 0; return FR_NO_FILE; - } - } - else { /* Dynamic table */ - if ((ofs / SS(fs) & (fs->csize - 1)) == 0) { /* Cluster changed? */ - clst = get_fat(&dp->obj, dp->clust); /* Get next cluster */ - if (clst <= 1) return FR_INT_ERR; /* Internal error */ - if (clst == 0xFFFFFFFF) return FR_DISK_ERR; /* Disk error */ - if (clst >= fs->n_fatent) { /* Reached end of dynamic table */ -#if !_FS_READONLY - if (!stretch) { /* If no stretch, report EOT */ - dp->sect = 0; return FR_NO_FILE; - } - clst = create_chain(&dp->obj, dp->clust); /* Allocate a cluster */ - if (clst == 0) return FR_DENIED; /* No free cluster */ - if (clst == 1) return FR_INT_ERR; /* Internal error */ - if (clst == 0xFFFFFFFF) return FR_DISK_ERR; /* Disk error */ - /* Clean-up the stretched table */ - if (_FS_EXFAT) dp->obj.stat |= 4; /* The directory needs to be updated */ - if (sync_window(fs) != FR_OK) return FR_DISK_ERR; /* Flush disk access window */ - mem_set(fs->win, 0, SS(fs)); /* Clear window buffer */ - for (n = 0, fs->winsect = clust2sect(fs, clst); n < fs->csize; n++, fs->winsect++) { /* Fill the new cluster with 0 */ - fs->wflag = 1; - if (sync_window(fs) != FR_OK) return FR_DISK_ERR; - } - fs->winsect -= n; /* Restore window offset */ -#else - if (!stretch) dp->sect = 0; /* If no stretch, report EOT (this is to suppress warning) */ - dp->sect = 0; return FR_NO_FILE; /* Report EOT */ -#endif - } - dp->clust = clst; /* Initialize data for new cluster */ - dp->sect = clust2sect(fs, clst); - } - } - } - dp->dptr = ofs; /* Current entry */ - dp->dir = fs->win + ofs % SS(fs); /* Pointer to the entry in the win[] */ - - return FR_OK; -} - - - - -#if !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* Directory handling - Reserve a block of directory entries */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT dir_alloc ( /* FR_OK(0):succeeded, !=0:error */ - DIR* dp, /* Pointer to the directory object */ - UINT nent /* Number of contiguous entries to allocate */ -) -{ - FRESULT res; - UINT n; - FATFS *fs = dp->obj.fs; - - - res = dir_sdi(dp, 0); - if (res == FR_OK) { - n = 0; - do { - res = move_window(fs, dp->sect); - if (res != FR_OK) break; -#if _FS_EXFAT - if ((fs->fs_type == FS_EXFAT) ? (int)((dp->dir[XDIR_Type] & 0x80) == 0) : (int)(dp->dir[DIR_Name] == DDEM || dp->dir[DIR_Name] == 0)) { -#else - if (dp->dir[DIR_Name] == DDEM || dp->dir[DIR_Name] == 0) { -#endif - if (++n == nent) break; /* A block of contiguous free entries is found */ - } else { - n = 0; /* Not a blank entry. Restart to search */ - } - res = dir_next(dp, 1); - } while (res == FR_OK); /* Next entry with table stretch enabled */ - } - - if (res == FR_NO_FILE) res = FR_DENIED; /* No directory entry to allocate */ - return res; -} - -#endif /* !_FS_READONLY */ - - - - -/*-----------------------------------------------------------------------*/ -/* FAT: Directory handling - Load/Store start cluster number */ -/*-----------------------------------------------------------------------*/ - -static -DWORD ld_clust ( /* Returns the top cluster value of the SFN entry */ - FATFS* fs, /* Pointer to the fs object */ - const BYTE* dir /* Pointer to the key entry */ -) -{ - DWORD cl; - - cl = ld_word(dir + DIR_FstClusLO); - if (fs->fs_type == FS_FAT32) { - cl |= (DWORD)ld_word(dir + DIR_FstClusHI) << 16; - } - - return cl; -} - - -#if !_FS_READONLY -static -void st_clust ( - FATFS* fs, /* Pointer to the fs object */ - BYTE* dir, /* Pointer to the key entry */ - DWORD cl /* Value to be set */ -) -{ - st_word(dir + DIR_FstClusLO, (WORD)cl); - if (fs->fs_type == FS_FAT32) { - st_word(dir + DIR_FstClusHI, (WORD)(cl >> 16)); - } -} -#endif - - - -#if _USE_LFN != 0 -/*------------------------------------------------------------------------*/ -/* FAT-LFN: LFN handling */ -/*------------------------------------------------------------------------*/ -static -const BYTE LfnOfs[] = {1,3,5,7,9,14,16,18,20,22,24,28,30}; /* Offset of LFN characters in the directory entry */ - - -/*--------------------------------------------------------*/ -/* FAT-LFN: Compare a part of file name with an LFN entry */ -/*--------------------------------------------------------*/ -static -int cmp_lfn ( /* 1:matched, 0:not matched */ - const WCHAR* lfnbuf, /* Pointer to the LFN working buffer to be compared */ - BYTE* dir /* Pointer to the directory entry containing the part of LFN */ -) -{ - UINT i, s; - WCHAR wc, uc; - - - if (ld_word(dir + LDIR_FstClusLO) != 0) return 0; /* Check LDIR_FstClusLO */ - - i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */ - - for (wc = 1, s = 0; s < 13; s++) { /* Process all characters in the entry */ - uc = ld_word(dir + LfnOfs[s]); /* Pick an LFN character */ - if (wc) { - if (i >= _MAX_LFN || ff_wtoupper(uc) != ff_wtoupper(lfnbuf[i++])) { /* Compare it */ - return 0; /* Not matched */ - } - wc = uc; - } else { - if (uc != 0xFFFF) return 0; /* Check filler */ - } - } - - if ((dir[LDIR_Ord] & LLEF) && wc && lfnbuf[i]) return 0; /* Last segment matched but different length */ - - return 1; /* The part of LFN matched */ -} - - -#if _FS_MINIMIZE <= 1 || _FS_RPATH >= 2 || _USE_LABEL || _FS_EXFAT -/*-----------------------------------------------------*/ -/* FAT-LFN: Pick a part of file name from an LFN entry */ -/*-----------------------------------------------------*/ -static -int pick_lfn ( /* 1:succeeded, 0:buffer overflow or invalid LFN entry */ - WCHAR* lfnbuf, /* Pointer to the LFN working buffer */ - BYTE* dir /* Pointer to the LFN entry */ -) -{ - UINT i, s; - WCHAR wc, uc; - - - if (ld_word(dir + LDIR_FstClusLO) != 0) return 0; /* Check LDIR_FstClusLO */ - - i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */ - - for (wc = 1, s = 0; s < 13; s++) { /* Process all characters in the entry */ - uc = ld_word(dir + LfnOfs[s]); /* Pick an LFN character */ - if (wc) { - if (i >= _MAX_LFN) return 0; /* Buffer overflow? */ - lfnbuf[i++] = wc = uc; /* Store it */ - } else { - if (uc != 0xFFFF) return 0; /* Check filler */ - } - } - - if (dir[LDIR_Ord] & LLEF) { /* Put terminator if it is the last LFN part */ - if (i >= _MAX_LFN) return 0; /* Buffer overflow? */ - lfnbuf[i] = 0; - } - - return 1; /* The part of LFN is valid */ -} -#endif - - -#if !_FS_READONLY -/*-----------------------------------------*/ -/* FAT-LFN: Create an entry of LFN entries */ -/*-----------------------------------------*/ -static -void put_lfn ( - const WCHAR* lfn, /* Pointer to the LFN */ - BYTE* dir, /* Pointer to the LFN entry to be created */ - BYTE ord, /* LFN order (1-20) */ - BYTE sum /* Checksum of the corresponding SFN */ -) -{ - UINT i, s; - WCHAR wc; - - - dir[LDIR_Chksum] = sum; /* Set checksum */ - dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */ - dir[LDIR_Type] = 0; - st_word(dir + LDIR_FstClusLO, 0); - - i = (ord - 1) * 13; /* Get offset in the LFN working buffer */ - s = wc = 0; - do { - if (wc != 0xFFFF) wc = lfn[i++]; /* Get an effective character */ - st_word(dir + LfnOfs[s], wc); /* Put it */ - if (wc == 0) wc = 0xFFFF; /* Padding characters for left locations */ - } while (++s < 13); - if (wc == 0xFFFF || !lfn[i]) ord |= LLEF; /* Last LFN part is the start of LFN sequence */ - dir[LDIR_Ord] = ord; /* Set the LFN order */ -} - -#endif /* !_FS_READONLY */ -#endif /* _USE_LFN != 0 */ - - - -#if _USE_LFN != 0 && !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* FAT-LFN: Create a Numbered SFN */ -/*-----------------------------------------------------------------------*/ - -static -void gen_numname ( - BYTE* dst, /* Pointer to the buffer to store numbered SFN */ - const BYTE* src, /* Pointer to SFN */ - const WCHAR* lfn, /* Pointer to LFN */ - UINT seq /* Sequence number */ -) -{ - BYTE ns[8], c; - UINT i, j; - WCHAR wc; - DWORD sr; - - - mem_cpy(dst, src, 11); - - if (seq > 5) { /* In case of many collisions, generate a hash number instead of sequential number */ - sr = seq; - while (*lfn) { /* Create a CRC */ - wc = *lfn++; - for (i = 0; i < 16; i++) { - sr = (sr << 1) + (wc & 1); - wc >>= 1; - if (sr & 0x10000) sr ^= 0x11021; - } - } - seq = (UINT)sr; - } - - /* itoa (hexdecimal) */ - i = 7; - do { - c = (BYTE)((seq % 16) + '0'); - if (c > '9') c += 7; - ns[i--] = c; - seq /= 16; - } while (seq); - ns[i] = '~'; - - /* Append the number */ - for (j = 0; j < i && dst[j] != ' '; j++) { - if (IsDBCS1(dst[j])) { - if (j == i - 1) break; - j++; - } - } - do { - dst[j++] = (i < 8) ? ns[i++] : ' '; - } while (j < 8); -} -#endif /* _USE_LFN != 0 && !_FS_READONLY */ - - - -#if _USE_LFN != 0 -/*-----------------------------------------------------------------------*/ -/* FAT-LFN: Calculate checksum of an SFN entry */ -/*-----------------------------------------------------------------------*/ - -static -BYTE sum_sfn ( - const BYTE* dir /* Pointer to the SFN entry */ -) -{ - BYTE sum = 0; - UINT n = 11; - - do sum = (sum >> 1) + (sum << 7) + *dir++; while (--n); - return sum; -} - -#endif /* _USE_LFN != 0 */ - - - -#if _FS_EXFAT -/*-----------------------------------------------------------------------*/ -/* exFAT: Checksum */ -/*-----------------------------------------------------------------------*/ - -static -WORD xdir_sum ( /* Get checksum of the directoly block */ - const BYTE* dir /* Directory entry block to be calculated */ -) -{ - UINT i, szblk; - WORD sum; - - - szblk = (dir[XDIR_NumSec] + 1) * SZDIRE; - for (i = sum = 0; i < szblk; i++) { - if (i == XDIR_SetSum) { /* Skip sum field */ - i++; - } else { - sum = ((sum & 1) ? 0x8000 : 0) + (sum >> 1) + dir[i]; - } - } - return sum; -} - - - -static -WORD xname_sum ( /* Get check sum (to be used as hash) of the name */ - const WCHAR* name /* File name to be calculated */ -) -{ - WCHAR chr; - WORD sum = 0; - - - while ((chr = *name++) != 0) { - chr = ff_wtoupper(chr); /* File name needs to be ignored case */ - sum = ((sum & 1) ? 0x8000 : 0) + (sum >> 1) + (chr & 0xFF); - sum = ((sum & 1) ? 0x8000 : 0) + (sum >> 1) + (chr >> 8); - } - return sum; -} - - -#if !_FS_READONLY && _USE_MKFS -static -DWORD xsum32 ( - BYTE dat, /* Data to be sumed */ - DWORD sum /* Previous value */ -) -{ - sum = ((sum & 1) ? 0x80000000 : 0) + (sum >> 1) + dat; - return sum; -} -#endif - - -#if _FS_MINIMIZE <= 1 || _FS_RPATH >= 2 -/*------------------------------------------------------*/ -/* exFAT: Get object information from a directory block */ -/*------------------------------------------------------*/ - -static -void get_xdir_info ( - BYTE* dirb, /* Pointer to the direcotry entry block 85+C0+C1s */ - FILINFO* fno /* Buffer to store the extracted file information */ -) -{ - UINT di, si; - WCHAR w; -#if !_LFN_UNICODE - UINT nc; -#endif - - /* Get file name */ -#if _LFN_UNICODE - if (dirb[XDIR_NumName] <= _MAX_LFN) { - for (si = SZDIRE * 2, di = 0; di < dirb[XDIR_NumName]; si += 2, di++) { - if ((si % SZDIRE) == 0) si += 2; /* Skip entry type field */ - w = ld_word(dirb + si); /* Get a character */ - fno->fname[di] = w; /* Store it */ - } - } else { - di = 0; /* Buffer overflow and inaccessible object */ - } -#else - for (si = SZDIRE * 2, di = nc = 0; nc < dirb[XDIR_NumName]; si += 2, nc++) { - if ((si % SZDIRE) == 0) si += 2; /* Skip entry type field */ - w = ld_word(dirb + si); /* Get a character */ - w = ff_convert(w, 0); /* Unicode -> OEM */ - if (w == 0) { di = 0; break; } /* Could not be converted and inaccessible object */ - if (_DF1S && w >= 0x100) { /* Put 1st byte if it is a DBC (always false at SBCS cfg) */ - fno->fname[di++] = (char)(w >> 8); - } - if (di >= _MAX_LFN) { di = 0; break; } /* Buffer overflow and inaccessible object */ - fno->fname[di++] = (char)w; - } -#endif - if (di == 0) fno->fname[di++] = '?'; /* Inaccessible object? */ - fno->fname[di] = 0; /* Terminate file name */ - - fno->altname[0] = 0; /* No SFN */ - fno->fattrib = dirb[XDIR_Attr]; /* Attribute */ - fno->fsize = (fno->fattrib & AM_DIR) ? 0 : ld_qword(dirb + XDIR_FileSize); /* Size */ - fno->ftime = ld_word(dirb + XDIR_ModTime + 0); /* Time */ - fno->fdate = ld_word(dirb + XDIR_ModTime + 2); /* Date */ -} - -#endif /* _FS_MINIMIZE <= 1 || _FS_RPATH >= 2 */ - - -/*-----------------------------------*/ -/* exFAT: Get a directry entry block */ -/*-----------------------------------*/ - -static -FRESULT load_xdir ( /* FR_INT_ERR: invalid entry block */ - DIR* dp /* Pointer to the reading direcotry object pointing the 85 entry */ -) -{ - FRESULT res; - UINT i, nent; - BYTE* dirb = dp->obj.fs->dirbuf; /* Pointer to the on-memory direcotry entry block 85+C0+C1s */ - - - /* Load 85 entry */ - res = move_window(dp->obj.fs, dp->sect); - if (res != FR_OK) return res; - if (dp->dir[XDIR_Type] != 0x85) return FR_INT_ERR; - mem_cpy(dirb, dp->dir, SZDIRE); - nent = dirb[XDIR_NumSec] + 1; - - /* Load C0 entry */ - res = dir_next(dp, 0); - if (res != FR_OK) return res; - res = move_window(dp->obj.fs, dp->sect); - if (res != FR_OK) return res; - if (dp->dir[XDIR_Type] != 0xC0) return FR_INT_ERR; - mem_cpy(dirb + SZDIRE, dp->dir, SZDIRE); - - /* Load C1 entries */ - if (nent < 3 || nent > 19) return FR_NO_FILE; - i = SZDIRE * 2; nent *= SZDIRE; - do { - res = dir_next(dp, 0); - if (res != FR_OK) return res; - res = move_window(dp->obj.fs, dp->sect); - if (res != FR_OK) return res; - if (dp->dir[XDIR_Type] != 0xC1) return FR_INT_ERR; - mem_cpy(dirb + i, dp->dir, SZDIRE); - i += SZDIRE; - } while (i < nent); - - /* Sanity check */ - if (xdir_sum(dirb) != ld_word(dirb + XDIR_SetSum)) return FR_INT_ERR; - - return FR_OK; -} - - -#if !_FS_READONLY || _FS_RPATH != 0 -/*------------------------------------------------*/ -/* exFAT: Load the object's directory entry block */ -/*------------------------------------------------*/ -static -FRESULT load_obj_dir ( - DIR* dp, /* Blank directory object to be used to access containing direcotry */ - const _FDID* obj /* Object with containing directory information */ -) -{ - FRESULT res; - - - /* Open object containing directory */ - dp->obj.fs = obj->fs; - dp->obj.sclust = obj->c_scl; - dp->obj.stat = (BYTE)obj->c_size; - dp->obj.objsize = obj->c_size & 0xFFFFFF00; - dp->blk_ofs = obj->c_ofs; - - res = dir_sdi(dp, dp->blk_ofs); /* Goto the block location */ - if (res == FR_OK) { - res = load_xdir(dp); /* Load the object's entry block */ - } - return res; -} -#endif - - -#if !_FS_READONLY -/*-----------------------------------------------*/ -/* exFAT: Store the directory block to the media */ -/*-----------------------------------------------*/ -static -FRESULT store_xdir ( - DIR* dp /* Pointer to the direcotry object */ -) -{ - FRESULT res; - UINT nent; - BYTE* dirb = dp->obj.fs->dirbuf; /* Pointer to the direcotry entry block 85+C0+C1s */ - - /* Create set sum */ - st_word(dirb + XDIR_SetSum, xdir_sum(dirb)); - nent = dirb[XDIR_NumSec] + 1; - - /* Store the set of directory to the volume */ - res = dir_sdi(dp, dp->blk_ofs); - while (res == FR_OK) { - res = move_window(dp->obj.fs, dp->sect); - if (res != FR_OK) break; - mem_cpy(dp->dir, dirb, SZDIRE); - dp->obj.fs->wflag = 1; - if (--nent == 0) break; - dirb += SZDIRE; - res = dir_next(dp, 0); - } - return (res == FR_OK || res == FR_DISK_ERR) ? res : FR_INT_ERR; -} - - - -/*-------------------------------------------*/ -/* exFAT: Create a new directory enrty block */ -/*-------------------------------------------*/ - -static -void create_xdir ( - BYTE* dirb, /* Pointer to the direcotry entry block buffer */ - const WCHAR* lfn /* Pointer to the nul terminated file name */ -) -{ - UINT i; - BYTE nb, nc; - WCHAR chr; - - - mem_set(dirb, 0, 2 * SZDIRE); /* Initialize 85+C0 entry */ - dirb[XDIR_Type] = 0x85; - dirb[XDIR_Type + SZDIRE] = 0xC0; - st_word(dirb + XDIR_NameHash, xname_sum(lfn)); /* Set name hash */ - - i = SZDIRE * 2; /* C1 offset */ - nc = 0; nb = 1; chr = 1; - do { - dirb[i++] = 0xC1; dirb[i++] = 0; /* Entry type C1 */ - do { /* Fill name field */ - if (chr && (chr = lfn[nc]) != 0) nc++; /* Get a character if exist */ - st_word(dirb + i, chr); i += 2; /* Store it */ - } while (i % SZDIRE); - nb++; - } while (lfn[nc]); /* Fill next entry if any char follows */ - - dirb[XDIR_NumName] = nc; /* Set name length */ - dirb[XDIR_NumSec] = nb; /* Set number of C0+C1s */ -} - -#endif /* !_FS_READONLY */ -#endif /* _FS_EXFAT */ - - - -#if _FS_MINIMIZE <= 1 || _FS_RPATH >= 2 || _USE_LABEL || _FS_EXFAT -/*-----------------------------------------------------------------------*/ -/* Read an object from the directory */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT dir_read ( - DIR* dp, /* Pointer to the directory object */ - int vol /* Filtered by 0:file/directory or 1:volume label */ -) -{ - FRESULT res = FR_NO_FILE; - FATFS *fs = dp->obj.fs; - BYTE a, c; -#if _USE_LFN != 0 - BYTE ord = 0xFF, sum = 0xFF; -#endif - - while (dp->sect) { - res = move_window(fs, dp->sect); - if (res != FR_OK) break; - c = dp->dir[DIR_Name]; /* Test for the entry type */ - if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of the directory */ -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { /* On the exFAT volume */ - if (_USE_LABEL && vol) { - if (c == 0x83) break; /* Volume label entry? */ - } else { - if (c == 0x85) { /* Start of the file entry block? */ - dp->blk_ofs = dp->dptr; /* Get location of the block */ - res = load_xdir(dp); /* Load the entry block */ - if (res == FR_OK) { - dp->obj.attr = fs->dirbuf[XDIR_Attr] & AM_MASK; /* Get attribute */ - } - break; - } - } - } else -#endif - { /* On the FAT12/16/32 volume */ - dp->obj.attr = a = dp->dir[DIR_Attr] & AM_MASK; /* Get attribute */ -#if _USE_LFN != 0 /* LFN configuration */ - if (c == DDEM || c == '.' || (int)((a & ~AM_ARC) == AM_VOL) != vol) { /* An entry without valid data */ - ord = 0xFF; - } else { - if (a == AM_LFN) { /* An LFN entry is found */ - if (c & LLEF) { /* Is it start of an LFN sequence? */ - sum = dp->dir[LDIR_Chksum]; - c &= (BYTE)~LLEF; ord = c; - dp->blk_ofs = dp->dptr; - } - /* Check LFN validity and capture it */ - ord = (c == ord && sum == dp->dir[LDIR_Chksum] && pick_lfn(fs->lfnbuf, dp->dir)) ? ord - 1 : 0xFF; - } else { /* An SFN entry is found */ - if (ord || sum != sum_sfn(dp->dir)) { /* Is there a valid LFN? */ - dp->blk_ofs = 0xFFFFFFFF; /* It has no LFN. */ - } - break; - } - } -#else /* Non LFN configuration */ - if (c != DDEM && c != '.' && a != AM_LFN && (int)((a & ~AM_ARC) == AM_VOL) == vol) { /* Is it a valid entry? */ - break; - } -#endif - } - res = dir_next(dp, 0); /* Next entry */ - if (res != FR_OK) break; - } - - if (res != FR_OK) dp->sect = 0; /* Terminate the read operation on error or EOT */ - return res; -} - -#endif /* _FS_MINIMIZE <= 1 || _USE_LABEL || _FS_RPATH >= 2 */ - - - -/*-----------------------------------------------------------------------*/ -/* Directory handling - Find an object in the directory */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT dir_find ( /* FR_OK(0):succeeded, !=0:error */ - DIR* dp /* Pointer to the directory object with the file name */ -) -{ - FRESULT res; - FATFS *fs = dp->obj.fs; - BYTE c; -#if _USE_LFN != 0 - BYTE a, ord, sum; -#endif - - res = dir_sdi(dp, 0); /* Rewind directory object */ - if (res != FR_OK) return res; -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { /* On the exFAT volume */ - BYTE nc; - UINT di, ni; - WORD hash = xname_sum(fs->lfnbuf); /* Hash value of the name to find */ - - while ((res = dir_read(dp, 0)) == FR_OK) { /* Read an item */ - if (ld_word(fs->dirbuf + XDIR_NameHash) != hash) continue; /* Skip the comparison if hash value mismatched */ - for (nc = fs->dirbuf[XDIR_NumName], di = SZDIRE * 2, ni = 0; nc; nc--, di += 2, ni++) { /* Compare the name */ - if ((di % SZDIRE) == 0) di += 2; - if (ff_wtoupper(ld_word(fs->dirbuf + di)) != ff_wtoupper(fs->lfnbuf[ni])) break; - } - if (nc == 0 && !fs->lfnbuf[ni]) break; /* Name matched? */ - } - return res; - } -#endif - /* On the FAT12/16/32 volume */ -#if _USE_LFN != 0 - ord = sum = 0xFF; dp->blk_ofs = 0xFFFFFFFF; /* Reset LFN sequence */ -#endif - do { - res = move_window(fs, dp->sect); - if (res != FR_OK) break; - c = dp->dir[DIR_Name]; - if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */ -#if _USE_LFN != 0 /* LFN configuration */ - dp->obj.attr = a = dp->dir[DIR_Attr] & AM_MASK; - if (c == DDEM || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */ - ord = 0xFF; dp->blk_ofs = 0xFFFFFFFF; /* Reset LFN sequence */ - } else { - if (a == AM_LFN) { /* An LFN entry is found */ - if (!(dp->fn[NSFLAG] & NS_NOLFN)) { - if (c & LLEF) { /* Is it start of LFN sequence? */ - sum = dp->dir[LDIR_Chksum]; - c &= (BYTE)~LLEF; ord = c; /* LFN start order */ - dp->blk_ofs = dp->dptr; /* Start offset of LFN */ - } - /* Check validity of the LFN entry and compare it with given name */ - ord = (c == ord && sum == dp->dir[LDIR_Chksum] && cmp_lfn(fs->lfnbuf, dp->dir)) ? ord - 1 : 0xFF; - } - } else { /* An SFN entry is found */ - if (!ord && sum == sum_sfn(dp->dir)) break; /* LFN matched? */ - if (!(dp->fn[NSFLAG] & NS_LOSS) && !mem_cmp(dp->dir, dp->fn, 11)) break; /* SFN matched? */ - ord = 0xFF; dp->blk_ofs = 0xFFFFFFFF; /* Reset LFN sequence */ - } - } -#else /* Non LFN configuration */ - dp->obj.attr = dp->dir[DIR_Attr] & AM_MASK; - if (!(dp->dir[DIR_Attr] & AM_VOL) && !mem_cmp(dp->dir, dp->fn, 11)) break; /* Is it a valid entry? */ -#endif - res = dir_next(dp, 0); /* Next entry */ - } while (res == FR_OK); - - return res; -} - - - - -#if !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* Register an object to the directory */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT dir_register ( /* FR_OK:succeeded, FR_DENIED:no free entry or too many SFN collision, FR_DISK_ERR:disk error */ - DIR* dp /* Target directory with object name to be created */ -) -{ - FRESULT res; - FATFS *fs = dp->obj.fs; -#if _USE_LFN != 0 /* LFN configuration */ - UINT n, nlen, nent; - BYTE sn[12], sum; - - - if (dp->fn[NSFLAG] & (NS_DOT | NS_NONAME)) return FR_INVALID_NAME; /* Check name validity */ - for (nlen = 0; fs->lfnbuf[nlen]; nlen++) ; /* Get lfn length */ - -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { /* On the exFAT volume */ - DIR dj; - - nent = (nlen + 14) / 15 + 2; /* Number of entries to allocate (85+C0+C1s) */ - res = dir_alloc(dp, nent); /* Allocate entries */ - if (res != FR_OK) return res; - dp->blk_ofs = dp->dptr - SZDIRE * (nent - 1); /* Set block position */ - - if (dp->obj.sclust != 0 && (dp->obj.stat & 4)) { /* Has the sub-directory been stretched? */ - dp->obj.stat &= 3; - dp->obj.objsize += (DWORD)fs->csize * SS(fs); /* Increase object size by cluster size */ - res = fill_fat_chain(&dp->obj); /* Complement FAT chain if needed */ - if (res != FR_OK) return res; - res = load_obj_dir(&dj, &dp->obj); - if (res != FR_OK) return res; /* Load the object status */ - st_qword(fs->dirbuf + XDIR_FileSize, dp->obj.objsize); /* Update the allocation status */ - st_qword(fs->dirbuf + XDIR_ValidFileSize, dp->obj.objsize); - fs->dirbuf[XDIR_GenFlags] = dp->obj.stat | 1; - res = store_xdir(&dj); /* Store the object status */ - if (res != FR_OK) return res; - } - - create_xdir(fs->dirbuf, fs->lfnbuf); /* Create on-memory directory block to be written later */ - return FR_OK; - } -#endif - /* On the FAT12/16/32 volume */ - mem_cpy(sn, dp->fn, 12); - if (sn[NSFLAG] & NS_LOSS) { /* When LFN is out of 8.3 format, generate a numbered name */ - dp->fn[NSFLAG] = NS_NOLFN; /* Find only SFN */ - for (n = 1; n < 100; n++) { - gen_numname(dp->fn, sn, fs->lfnbuf, n); /* Generate a numbered name */ - res = dir_find(dp); /* Check if the name collides with existing SFN */ - if (res != FR_OK) break; - } - if (n == 100) return FR_DENIED; /* Abort if too many collisions */ - if (res != FR_NO_FILE) return res; /* Abort if the result is other than 'not collided' */ - dp->fn[NSFLAG] = sn[NSFLAG]; - } - - /* Create an SFN with/without LFNs. */ - nent = (sn[NSFLAG] & NS_LFN) ? (nlen + 12) / 13 + 1 : 1; /* Number of entries to allocate */ - res = dir_alloc(dp, nent); /* Allocate entries */ - if (res == FR_OK && --nent) { /* Set LFN entry if needed */ - res = dir_sdi(dp, dp->dptr - nent * SZDIRE); - if (res == FR_OK) { - sum = sum_sfn(dp->fn); /* Checksum value of the SFN tied to the LFN */ - do { /* Store LFN entries in bottom first */ - res = move_window(fs, dp->sect); - if (res != FR_OK) break; - put_lfn(fs->lfnbuf, dp->dir, (BYTE)nent, sum); - fs->wflag = 1; - res = dir_next(dp, 0); /* Next entry */ - } while (res == FR_OK && --nent); - } - } - -#else /* Non LFN configuration */ - res = dir_alloc(dp, 1); /* Allocate an entry for SFN */ - -#endif - - /* Set SFN entry */ - if (res == FR_OK) { - res = move_window(fs, dp->sect); - if (res == FR_OK) { - mem_set(dp->dir, 0, SZDIRE); /* Clean the entry */ - mem_cpy(dp->dir + DIR_Name, dp->fn, 11); /* Put SFN */ -#if _USE_LFN != 0 - dp->dir[DIR_NTres] = dp->fn[NSFLAG] & (NS_BODY | NS_EXT); /* Put NT flag */ -#endif - fs->wflag = 1; - } - } - - return res; -} - -#endif /* !_FS_READONLY */ - - - -#if !_FS_READONLY && _FS_MINIMIZE == 0 -/*-----------------------------------------------------------------------*/ -/* Remove an object from the directory */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT dir_remove ( /* FR_OK:Succeeded, FR_DISK_ERR:A disk error */ - DIR* dp /* Directory object pointing the entry to be removed */ -) -{ - FRESULT res; - FATFS *fs = dp->obj.fs; -#if _USE_LFN != 0 /* LFN configuration */ - DWORD last = dp->dptr; - - res = (dp->blk_ofs == 0xFFFFFFFF) ? FR_OK : dir_sdi(dp, dp->blk_ofs); /* Goto top of the entry block if LFN is exist */ - if (res == FR_OK) { - do { - res = move_window(fs, dp->sect); - if (res != FR_OK) break; - /* Mark an entry 'deleted' */ - if (_FS_EXFAT && fs->fs_type == FS_EXFAT) { /* On the exFAT volume */ - dp->dir[XDIR_Type] &= 0x7F; - } else { /* On the FAT12/16/32 volume */ - dp->dir[DIR_Name] = DDEM; - } - fs->wflag = 1; - if (dp->dptr >= last) break; /* If reached last entry then all entries of the object has been deleted. */ - res = dir_next(dp, 0); /* Next entry */ - } while (res == FR_OK); - if (res == FR_NO_FILE) res = FR_INT_ERR; - } -#else /* Non LFN configuration */ - - res = move_window(fs, dp->sect); - if (res == FR_OK) { - dp->dir[DIR_Name] = DDEM; - fs->wflag = 1; - } -#endif - - return res; -} - -#endif /* !_FS_READONLY && _FS_MINIMIZE == 0 */ - - - -#if _FS_MINIMIZE <= 1 || _FS_RPATH >= 2 -/*-----------------------------------------------------------------------*/ -/* Get file information from directory entry */ -/*-----------------------------------------------------------------------*/ - -static -void get_fileinfo ( /* No return code */ - DIR* dp, /* Pointer to the directory object */ - FILINFO* fno /* Pointer to the file information to be filled */ -) -{ - UINT i, j; - TCHAR c; - DWORD tm; -#if _USE_LFN != 0 - WCHAR w, lfv; - FATFS *fs = dp->obj.fs; -#endif - - - fno->fname[0] = 0; /* Invaidate file info */ - if (!dp->sect) return; /* Exit if read pointer has reached end of directory */ - -#if _USE_LFN != 0 /* LFN configuration */ -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { /* On the exFAT volume */ - get_xdir_info(fs->dirbuf, fno); - return; - } else -#endif - { /* On the FAT12/16/32 volume */ - if (dp->blk_ofs != 0xFFFFFFFF) { /* Get LFN if available */ - i = j = 0; - while ((w = fs->lfnbuf[j++]) != 0) { /* Get an LFN character */ -#if !_LFN_UNICODE - w = ff_convert(w, 0); /* Unicode -> OEM */ - if (w == 0) { i = 0; break; } /* No LFN if it could not be converted */ - if (_DF1S && w >= 0x100) { /* Put 1st byte if it is a DBC (always false at SBCS cfg) */ - fno->fname[i++] = (char)(w >> 8); - } -#endif - if (i >= _MAX_LFN) { i = 0; break; } /* No LFN if buffer overflow */ - fno->fname[i++] = (TCHAR)w; - } - fno->fname[i] = 0; /* Terminate the LFN */ - } - } - - i = j = 0; - lfv = fno->fname[i]; /* LFN is exist if non-zero */ - while (i < 11) { /* Copy name body and extension */ - c = (TCHAR)dp->dir[i++]; - if (c == ' ') continue; /* Skip padding spaces */ - if (c == RDDEM) c = (TCHAR)DDEM; /* Restore replaced DDEM character */ - if (i == 9) { /* Insert a . if extension is exist */ - if (!lfv) fno->fname[j] = '.'; - fno->altname[j++] = '.'; - } -#if _LFN_UNICODE - if (IsDBCS1(c) && i != 8 && i != 11 && IsDBCS2(dp->dir[i])) { - c = c << 8 | dp->dir[i++]; - } - c = ff_convert(c, 1); /* OEM -> Unicode */ - if (!c) c = '?'; -#endif - fno->altname[j] = c; - if (!lfv) { - if (IsUpper(c) && (dp->dir[DIR_NTres] & (i >= 9 ? NS_EXT : NS_BODY))) { - c += 0x20; /* To lower */ - } - fno->fname[j] = c; - } - j++; - } - if (!lfv) { - fno->fname[j] = 0; - if (!dp->dir[DIR_NTres]) j = 0; /* Altname is no longer needed if neither LFN nor case info is exist. */ - } - fno->altname[j] = 0; /* Terminate the SFN */ - -#else /* Non-LFN configuration */ - i = j = 0; - while (i < 11) { /* Copy name body and extension */ - c = (TCHAR)dp->dir[i++]; - if (c == ' ') continue; /* Skip padding spaces */ - if (c == RDDEM) c = (TCHAR)DDEM; /* Restore replaced DDEM character */ - if (i == 9) fno->fname[j++] = '.'; /* Insert a . if extension is exist */ - fno->fname[j++] = c; - } - fno->fname[j] = 0; -#endif - - fno->fattrib = dp->dir[DIR_Attr]; /* Attribute */ - fno->fsize = ld_dword(dp->dir + DIR_FileSize); /* Size */ - tm = ld_dword(dp->dir + DIR_ModTime); /* Timestamp */ - fno->ftime = (WORD)tm; fno->fdate = (WORD)(tm >> 16); -} - -#endif /* _FS_MINIMIZE <= 1 || _FS_RPATH >= 2 */ - - - -#if _USE_FIND && _FS_MINIMIZE <= 1 -/*-----------------------------------------------------------------------*/ -/* Pattern matching */ -/*-----------------------------------------------------------------------*/ - -static -WCHAR get_achar ( /* Get a character and advances ptr 1 or 2 */ - const TCHAR** ptr /* Pointer to pointer to the SBCS/DBCS/Unicode string */ -) -{ -#if !_LFN_UNICODE - WCHAR chr; - - chr = (BYTE)*(*ptr)++; /* Get a byte */ - if (IsLower(chr)) chr -= 0x20; /* To upper ASCII char */ -#ifdef _EXCVT - if (chr >= 0x80) chr = ExCvt[chr - 0x80]; /* To upper SBCS extended char */ -#else - if (IsDBCS1(chr) && IsDBCS2(**ptr)) { /* Get DBC 2nd byte if needed */ - chr = chr << 8 | (BYTE)*(*ptr)++; - } -#endif - return chr; -#else - return ff_wtoupper(*(*ptr)++); /* Get a word and to upper */ -#endif -} - - -static -int pattern_matching ( /* 0:not matched, 1:matched */ - const TCHAR* pat, /* Matching pattern */ - const TCHAR* nam, /* String to be tested */ - int skip, /* Number of pre-skip chars (number of ?s) */ - int inf /* Infinite search (* specified) */ -) -{ - const TCHAR *pp, *np; - WCHAR pc, nc; - int nm, nx; - - - while (skip--) { /* Pre-skip name chars */ - if (!get_achar(&nam)) return 0; /* Branch mismatched if less name chars */ - } - if (!*pat && inf) return 1; /* (short circuit) */ - - do { - pp = pat; np = nam; /* Top of pattern and name to match */ - for (;;) { - if (*pp == '?' || *pp == '*') { /* Wildcard? */ - nm = nx = 0; - do { /* Analyze the wildcard chars */ - if (*pp++ == '?') nm++; else nx = 1; - } while (*pp == '?' || *pp == '*'); - if (pattern_matching(pp, np, nm, nx)) return 1; /* Test new branch (recurs upto number of wildcard blocks in the pattern) */ - nc = *np; break; /* Branch mismatched */ - } - pc = get_achar(&pp); /* Get a pattern char */ - nc = get_achar(&np); /* Get a name char */ - if (pc != nc) break; /* Branch mismatched? */ - if (pc == 0) return 1; /* Branch matched? (matched at end of both strings) */ - } - get_achar(&nam); /* nam++ */ - } while (inf && nc); /* Retry until end of name if infinite search is specified */ - - return 0; -} - -#endif /* _USE_FIND && _FS_MINIMIZE <= 1 */ - - - -/*-----------------------------------------------------------------------*/ -/* Pick a top segment and create the object name in directory form */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT create_name ( /* FR_OK: successful, FR_INVALID_NAME: could not create */ - DIR* dp, /* Pointer to the directory object */ - const TCHAR** path /* Pointer to pointer to the segment in the path string */ -) -{ -#if _USE_LFN != 0 /* LFN configuration */ - BYTE b, cf; - WCHAR w, *lfn; - UINT i, ni, si, di; - const TCHAR *p; - - /* Create LFN in Unicode */ - p = *path; lfn = dp->obj.fs->lfnbuf; si = di = 0; - for (;;) { - w = p[si++]; /* Get a character */ - if (w < ' ') break; /* Break if end of the path name */ - if (w == '/' || w == '\\') { /* Break if a separator is found */ - while (p[si] == '/' || p[si] == '\\') si++; /* Skip duplicated separator if exist */ - break; - } - if (di >= _MAX_LFN) return FR_INVALID_NAME; /* Reject too long name */ -#if !_LFN_UNICODE - w &= 0xFF; - if (IsDBCS1(w)) { /* Check if it is a DBC 1st byte (always false on SBCS cfg) */ - b = (BYTE)p[si++]; /* Get 2nd byte */ - w = (w << 8) + b; /* Create a DBC */ - if (!IsDBCS2(b)) return FR_INVALID_NAME; /* Reject invalid sequence */ - } - w = ff_convert(w, 1); /* Convert ANSI/OEM to Unicode */ - if (!w) return FR_INVALID_NAME; /* Reject invalid code */ -#endif - if (w < 0x80 && chk_chr("\"*:<>\?|\x7F", w)) return FR_INVALID_NAME; /* Reject illegal characters for LFN */ - lfn[di++] = w; /* Store the Unicode character */ - } - *path = &p[si]; /* Return pointer to the next segment */ - cf = (w < ' ') ? NS_LAST : 0; /* Set last segment flag if end of the path */ -#if _FS_RPATH != 0 - if ((di == 1 && lfn[di - 1] == '.') || - (di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) { /* Is this segment a dot name? */ - lfn[di] = 0; - for (i = 0; i < 11; i++) /* Create dot name for SFN entry */ - dp->fn[i] = (i < di) ? '.' : ' '; - dp->fn[i] = cf | NS_DOT; /* This is a dot entry */ - return FR_OK; - } -#endif - while (di) { /* Snip off trailing spaces and dots if exist */ - w = lfn[di - 1]; - if (w != ' ' && w != '.') break; - di--; - } - lfn[di] = 0; /* LFN is created */ - if (di == 0) return FR_INVALID_NAME; /* Reject nul name */ - - /* Create SFN in directory form */ - mem_set(dp->fn, ' ', 11); - for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) ; /* Strip leading spaces and dots */ - if (si) cf |= NS_LOSS | NS_LFN; - while (di && lfn[di - 1] != '.') di--; /* Find extension (di<=si: no extension) */ - - i = b = 0; ni = 8; - for (;;) { - w = lfn[si++]; /* Get an LFN character */ - if (!w) break; /* Break on end of the LFN */ - if (w == ' ' || (w == '.' && si != di)) { /* Remove spaces and dots */ - cf |= NS_LOSS | NS_LFN; continue; - } - - if (i >= ni || si == di) { /* Extension or end of SFN */ - if (ni == 11) { /* Long extension */ - cf |= NS_LOSS | NS_LFN; break; - } - if (si != di) cf |= NS_LOSS | NS_LFN; /* Out of 8.3 format */ - if (si > di) break; /* No extension */ - si = di; i = 8; ni = 11; /* Enter extension section */ - b <<= 2; continue; - } - - if (w >= 0x80) { /* Non ASCII character */ -#ifdef _EXCVT - w = ff_convert(w, 0); /* Unicode -> OEM code */ - if (w) w = ExCvt[w - 0x80]; /* Convert extended character to upper (SBCS) */ -#else - w = ff_convert(ff_wtoupper(w), 0); /* Upper converted Unicode -> OEM code */ -#endif - cf |= NS_LFN; /* Force create LFN entry */ - } - - if (_DF1S && w >= 0x100) { /* Is this DBC? (always false at SBCS cfg) */ - if (i >= ni - 1) { - cf |= NS_LOSS | NS_LFN; i = ni; continue; - } - dp->fn[i++] = (BYTE)(w >> 8); - } else { /* SBC */ - if (!w || chk_chr("+,;=[]", w)) { /* Replace illegal characters for SFN */ - w = '_'; cf |= NS_LOSS | NS_LFN;/* Lossy conversion */ - } else { - if (IsUpper(w)) { /* ASCII large capital */ - b |= 2; - } else { - if (IsLower(w)) { /* ASCII small capital */ - b |= 1; w -= 0x20; - } - } - } - } - dp->fn[i++] = (BYTE)w; - } - - if (dp->fn[0] == DDEM) dp->fn[0] = RDDEM; /* If the first character collides with DDEM, replace it with RDDEM */ - - if (ni == 8) b <<= 2; - if ((b & 0x0C) == 0x0C || (b & 0x03) == 0x03) cf |= NS_LFN; /* Create LFN entry when there are composite capitals */ - if (!(cf & NS_LFN)) { /* When LFN is in 8.3 format without extended character, NT flags are created */ - if ((b & 0x03) == 0x01) cf |= NS_EXT; /* NT flag (Extension has only small capital) */ - if ((b & 0x0C) == 0x04) cf |= NS_BODY; /* NT flag (Filename has only small capital) */ - } - - dp->fn[NSFLAG] = cf; /* SFN is created */ - - return FR_OK; - - -#else /* _USE_LFN != 0 : Non-LFN configuration */ - BYTE c, d, *sfn; - UINT ni, si, i; - const char *p; - - /* Create file name in directory form */ - p = *path; sfn = dp->fn; - mem_set(sfn, ' ', 11); - si = i = 0; ni = 8; -#if _FS_RPATH != 0 - if (p[si] == '.') { /* Is this a dot entry? */ - for (;;) { - c = (BYTE)p[si++]; - if (c != '.' || si >= 3) break; - sfn[i++] = c; - } - if (c != '/' && c != '\\' && c > ' ') return FR_INVALID_NAME; - *path = p + si; /* Return pointer to the next segment */ - sfn[NSFLAG] = (c <= ' ') ? NS_LAST | NS_DOT : NS_DOT; /* Set last segment flag if end of the path */ - return FR_OK; - } -#endif - for (;;) { - c = (BYTE)p[si++]; - if (c <= ' ') break; /* Break if end of the path name */ - if (c == '/' || c == '\\') { /* Break if a separator is found */ - while (p[si] == '/' || p[si] == '\\') si++; /* Skip duplicated separator if exist */ - break; - } - if (c == '.' || i >= ni) { /* End of body or over size? */ - if (ni == 11 || c != '.') return FR_INVALID_NAME; /* Over size or invalid dot */ - i = 8; ni = 11; /* Goto extension */ - continue; - } - if (c >= 0x80) { /* Extended character? */ -#ifdef _EXCVT - c = ExCvt[c - 0x80]; /* To upper extended characters (SBCS cfg) */ -#else -#if !_DF1S - return FR_INVALID_NAME; /* Reject extended characters (ASCII only cfg) */ -#endif -#endif - } - if (IsDBCS1(c)) { /* Check if it is a DBC 1st byte (always false at SBCS cfg.) */ - d = (BYTE)p[si++]; /* Get 2nd byte */ - if (!IsDBCS2(d) || i >= ni - 1) return FR_INVALID_NAME; /* Reject invalid DBC */ - sfn[i++] = c; - sfn[i++] = d; - } else { /* SBC */ - if (chk_chr("\"*+,:;<=>\?[]|\x7F", c)) return FR_INVALID_NAME; /* Reject illegal chrs for SFN */ - if (IsLower(c)) c -= 0x20; /* To upper */ - sfn[i++] = c; - } - } - *path = p + si; /* Return pointer to the next segment */ - if (i == 0) return FR_INVALID_NAME; /* Reject nul string */ - - if (sfn[0] == DDEM) sfn[0] = RDDEM; /* If the first character collides with DDEM, replace it with RDDEM */ - sfn[NSFLAG] = (c <= ' ') ? NS_LAST : 0; /* Set last segment flag if end of the path */ - - return FR_OK; -#endif /* _USE_LFN != 0 */ -} - - - - -/*-----------------------------------------------------------------------*/ -/* Follow a file path */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */ - DIR* dp, /* Directory object to return last directory and found object */ - const TCHAR* path /* Full-path string to find a file or directory */ -) -{ - FRESULT res; - BYTE ns; - _FDID *obj = &dp->obj; - FATFS *fs = obj->fs; - - -#if _FS_RPATH != 0 - if (*path != '/' && *path != '\\') { /* Without heading separator */ - obj->sclust = fs->cdir; /* Start from the current directory */ - } else -#endif - { /* With heading separator */ - while (*path == '/' || *path == '\\') path++; /* Strip heading separator */ - obj->sclust = 0; /* Start from the root directory */ - } -#if _FS_EXFAT && _FS_RPATH != 0 - if (fs->fs_type == FS_EXFAT && obj->sclust) { /* Retrieve the sub-directory status if needed */ - DIR dj; - - obj->c_scl = fs->cdc_scl; - obj->c_size = fs->cdc_size; - obj->c_ofs = fs->cdc_ofs; - res = load_obj_dir(&dj, obj); - if (res != FR_OK) return res; - obj->objsize = ld_dword(fs->dirbuf + XDIR_FileSize); - obj->stat = fs->dirbuf[XDIR_GenFlags] & 2; - } -#endif - - if ((UINT)*path < ' ') { /* Null path name is the origin directory itself */ - dp->fn[NSFLAG] = NS_NONAME; - res = dir_sdi(dp, 0); - - } else { /* Follow path */ - for (;;) { - res = create_name(dp, &path); /* Get a segment name of the path */ - if (res != FR_OK) break; - res = dir_find(dp); /* Find an object with the segment name */ - ns = dp->fn[NSFLAG]; - if (res != FR_OK) { /* Failed to find the object */ - if (res == FR_NO_FILE) { /* Object is not found */ - if (_FS_RPATH && (ns & NS_DOT)) { /* If dot entry is not exist, stay there */ - if (!(ns & NS_LAST)) continue; /* Continue to follow if not last segment */ - dp->fn[NSFLAG] = NS_NONAME; - res = FR_OK; - } else { /* Could not find the object */ - if (!(ns & NS_LAST)) res = FR_NO_PATH; /* Adjust error code if not last segment */ - } - } - break; - } - if (ns & NS_LAST) break; /* Last segment matched. Function completed. */ - /* Get into the sub-directory */ - if (!(obj->attr & AM_DIR)) { /* It is not a sub-directory and cannot follow */ - res = FR_NO_PATH; break; - } -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - obj->c_scl = obj->sclust; /* Save containing directory information for next dir */ - obj->c_size = ((DWORD)obj->objsize & 0xFFFFFF00) | obj->stat; - obj->c_ofs = dp->blk_ofs; - obj->sclust = ld_dword(fs->dirbuf + XDIR_FstClus); /* Open next directory */ - obj->stat = fs->dirbuf[XDIR_GenFlags] & 2; - obj->objsize = ld_qword(fs->dirbuf + XDIR_FileSize); - } else -#endif - { - obj->sclust = ld_clust(fs, fs->win + dp->dptr % SS(fs)); /* Open next directory */ - } - } - } - - return res; -} - - - - -/*-----------------------------------------------------------------------*/ -/* Get logical drive number from path name */ -/*-----------------------------------------------------------------------*/ - -static -int get_ldnumber ( /* Returns logical drive number (-1:invalid drive) */ - const TCHAR** path /* Pointer to pointer to the path name */ -) -{ - const TCHAR *tp, *tt; - UINT i; - int vol = -1; -#if _STR_VOLUME_ID /* Find string drive id */ - static const char* const str[] = {_VOLUME_STRS}; - const char *sp; - char c; - TCHAR tc; -#endif - - - if (*path) { /* If the pointer is not a null */ - for (tt = *path; (UINT)*tt >= (_USE_LFN ? ' ' : '!') && *tt != ':'; tt++) ; /* Find ':' in the path */ - if (*tt == ':') { /* If a ':' is exist in the path name */ - tp = *path; - i = *tp++ - '0'; - if (i < 10 && tp == tt) { /* Is there a numeric drive id? */ - if (i < _VOLUMES) { /* If a drive id is found, get the value and strip it */ - vol = (int)i; - *path = ++tt; - } - } -#if _STR_VOLUME_ID - else { /* No numeric drive number, find string drive id */ - i = 0; tt++; - do { - sp = str[i]; tp = *path; - do { /* Compare a string drive id with path name */ - c = *sp++; tc = *tp++; - if (IsLower(tc)) tc -= 0x20; - } while (c && (TCHAR)c == tc); - } while ((c || tp != tt) && ++i < _VOLUMES); /* Repeat for each id until pattern match */ - if (i < _VOLUMES) { /* If a drive id is found, get the value and strip it */ - vol = (int)i; - *path = tt; - } - } -#endif - return vol; - } -#if _FS_RPATH != 0 && _VOLUMES >= 2 - vol = CurrVol; /* Current drive */ -#else - vol = 0; /* Drive 0 */ -#endif - } - return vol; -} - - - - -/*-----------------------------------------------------------------------*/ -/* Load a sector and check if it is an FAT boot sector */ -/*-----------------------------------------------------------------------*/ - -static -BYTE check_fs ( /* 0:FAT, 1:exFAT, 2:Valid BS but not FAT, 3:Not a BS, 4:Disk error */ - FATFS* fs, /* File system object */ - DWORD sect /* Sector# (lba) to check if it is an FAT-VBR or not */ -) -{ - fs->wflag = 0; fs->winsect = 0xFFFFFFFF; /* Invaidate window */ - if (move_window(fs, sect) != FR_OK) return 4; /* Load boot record */ - - if (ld_word(fs->win + BS_55AA) != 0xAA55) return 3; /* Check boot record signature (always placed at offset 510 even if the sector size is >512) */ - - if (fs->win[BS_JmpBoot] == 0xE9 || (fs->win[BS_JmpBoot] == 0xEB && fs->win[BS_JmpBoot + 2] == 0x90)) { - if ((ld_dword(fs->win + BS_FilSysType) & 0xFFFFFF) == 0x544146) return 0; /* Check "FAT" string */ - if (ld_dword(fs->win + BS_FilSysType32) == 0x33544146) return 0; /* Check "FAT3" string */ - } -#if _FS_EXFAT - if (!mem_cmp(fs->win + BS_JmpBoot, "\xEB\x76\x90" "EXFAT ", 11)) return 1; -#endif - return 2; -} - - - - -/*-----------------------------------------------------------------------*/ -/* Find logical drive and check if the volume is mounted */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */ - const TCHAR** path, /* Pointer to pointer to the path name (drive number) */ - FATFS** rfs, /* Pointer to pointer to the found file system object */ - BYTE mode /* !=0: Check write protection for write access */ -) -{ - BYTE fmt, *pt; - int vol; - DSTATUS stat; - DWORD bsect, fasize, tsect, sysect, nclst, szbfat, br[4]; - WORD nrsv; - FATFS *fs; - UINT i; - - - /* Get logical drive number */ - *rfs = 0; - vol = get_ldnumber(path); - if (vol < 0) return FR_INVALID_DRIVE; - - /* Check if the file system object is valid or not */ - fs = FatFs[vol]; /* Get pointer to the file system object */ - if (!fs) return FR_NOT_ENABLED; /* Is the file system object available? */ - - ENTER_FF(fs); /* Lock the volume */ - *rfs = fs; /* Return pointer to the file system object */ - - mode &= (BYTE)~FA_READ; /* Desired access mode, write access or not */ - if (fs->fs_type) { /* If the volume has been mounted */ - stat = disk_status(fs->drv); - if (!(stat & STA_NOINIT)) { /* and the physical drive is kept initialized */ - if (!_FS_READONLY && mode && (stat & STA_PROTECT)) { /* Check write protection if needed */ - return FR_WRITE_PROTECTED; - } - return FR_OK; /* The file system object is valid */ - } - } - - /* The file system object is not valid. */ - /* Following code attempts to mount the volume. (analyze BPB and initialize the fs object) */ - - fs->fs_type = 0; /* Clear the file system object */ - fs->drv = LD2PD(vol); /* Bind the logical drive and a physical drive */ - stat = disk_initialize(fs->drv); /* Initialize the physical drive */ - if (stat & STA_NOINIT) { /* Check if the initialization succeeded */ - return FR_NOT_READY; /* Failed to initialize due to no medium or hard error */ - } - if (!_FS_READONLY && mode && (stat & STA_PROTECT)) { /* Check disk write protection if needed */ - return FR_WRITE_PROTECTED; - } -#if _MAX_SS != _MIN_SS /* Get sector size (multiple sector size cfg only) */ - if (disk_ioctl(fs->drv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK) return FR_DISK_ERR; - if (SS(fs) > _MAX_SS || SS(fs) < _MIN_SS || (SS(fs) & (SS(fs) - 1))) return FR_DISK_ERR; -#endif - /* Find an FAT partition on the drive. Supports only generic partitioning, FDISK and SFD. */ - bsect = 0; - fmt = check_fs(fs, bsect); /* Load sector 0 and check if it is an FAT-VBR as SFD */ - if (fmt == 2 || (fmt < 2 && LD2PT(vol) != 0)) { /* Not an FAT-VBR or forced partition number */ - for (i = 0; i < 4; i++) { /* Get partition offset */ - pt = fs->win + (MBR_Table + i * SZ_PTE); - br[i] = pt[PTE_System] ? ld_dword(pt + PTE_StLba) : 0; - } - i = LD2PT(vol); /* Partition number: 0:auto, 1-4:forced */ - if (i) i--; - do { /* Find an FAT volume */ - bsect = br[i]; - fmt = bsect ? check_fs(fs, bsect) : 3; /* Check the partition */ - } while (!LD2PT(vol) && fmt >= 2 && ++i < 4); - } - if (fmt == 4) return FR_DISK_ERR; /* An error occured in the disk I/O layer */ - if (fmt >= 2) return FR_NO_FILESYSTEM; /* No FAT volume is found */ - - /* An FAT volume is found. Following code initializes the file system object */ - -#if _FS_EXFAT - if (fmt == 1) { - QWORD maxlba; - - for (i = BPB_ZeroedEx; i < BPB_ZeroedEx + 53 && fs->win[i] == 0; i++) ; /* Check zero filler */ - if (i < BPB_ZeroedEx + 53) return FR_NO_FILESYSTEM; - - if (ld_word(fs->win + BPB_FSVerEx) != 0x100) return FR_NO_FILESYSTEM; /* Check exFAT revision (Must be 1.0) */ - - if (1 << fs->win[BPB_BytsPerSecEx] != SS(fs)) /* (BPB_BytsPerSecEx must be equal to the physical sector size) */ - return FR_NO_FILESYSTEM; - - maxlba = ld_qword(fs->win + BPB_TotSecEx) + bsect; /* Last LBA + 1 of the volume */ - if (maxlba >= 0x100000000) return FR_NO_FILESYSTEM; /* (It cannot be handled in 32-bit LBA) */ - - fs->fsize = ld_dword(fs->win + BPB_FatSzEx); /* Number of sectors per FAT */ - - fs->n_fats = fs->win[BPB_NumFATsEx]; /* Number of FATs */ - if (fs->n_fats != 1) return FR_NO_FILESYSTEM; /* (Supports only 1 FAT) */ - - fs->csize = 1 << fs->win[BPB_SecPerClusEx]; /* Cluster size */ - if (fs->csize == 0) return FR_NO_FILESYSTEM; /* (Must be 1..32768) */ - - nclst = ld_dword(fs->win + BPB_NumClusEx); /* Number of clusters */ - if (nclst > MAX_EXFAT) return FR_NO_FILESYSTEM; /* (Too many clusters) */ - fs->n_fatent = nclst + 2; - - /* Boundaries and Limits */ - fs->volbase = bsect; - fs->database = bsect + ld_dword(fs->win + BPB_DataOfsEx); - fs->fatbase = bsect + ld_dword(fs->win + BPB_FatOfsEx); - if (maxlba < (QWORD)fs->database + nclst * fs->csize) return FR_NO_FILESYSTEM; /* (Volume size must not be smaller than the size requiered) */ - fs->dirbase = ld_dword(fs->win + BPB_RootClusEx); - - /* Check if bitmap location is in assumption (at the first cluster) */ - if (move_window(fs, clust2sect(fs, fs->dirbase)) != FR_OK) return FR_DISK_ERR; - for (i = 0; i < SS(fs); i += SZDIRE) { - if (fs->win[i] == 0x81 && ld_dword(fs->win + i + 20) == 2) break; /* 81 entry with cluster #2? */ - } - if (i == SS(fs)) return FR_NO_FILESYSTEM; -#if !_FS_READONLY - fs->last_clst = fs->free_clst = 0xFFFFFFFF; /* Initialize cluster allocation information */ -#endif - fmt = FS_EXFAT; /* FAT sub-type */ - } else -#endif /* _FS_EXFAT */ - { - if (ld_word(fs->win + BPB_BytsPerSec) != SS(fs)) return FR_NO_FILESYSTEM; /* (BPB_BytsPerSec must be equal to the physical sector size) */ - - fasize = ld_word(fs->win + BPB_FATSz16); /* Number of sectors per FAT */ - if (fasize == 0) fasize = ld_dword(fs->win + BPB_FATSz32); - fs->fsize = fasize; - - fs->n_fats = fs->win[BPB_NumFATs]; /* Number of FATs */ - if (fs->n_fats != 1 && fs->n_fats != 2) return FR_NO_FILESYSTEM; /* (Must be 1 or 2) */ - fasize *= fs->n_fats; /* Number of sectors for FAT area */ - - fs->csize = fs->win[BPB_SecPerClus]; /* Cluster size */ - if (fs->csize == 0 || (fs->csize & (fs->csize - 1))) return FR_NO_FILESYSTEM; /* (Must be power of 2) */ - - fs->n_rootdir = ld_word(fs->win + BPB_RootEntCnt); /* Number of root directory entries */ - if (fs->n_rootdir % (SS(fs) / SZDIRE)) return FR_NO_FILESYSTEM; /* (Must be sector aligned) */ - - tsect = ld_word(fs->win + BPB_TotSec16); /* Number of sectors on the volume */ - if (tsect == 0) tsect = ld_dword(fs->win + BPB_TotSec32); - - nrsv = ld_word(fs->win + BPB_RsvdSecCnt); /* Number of reserved sectors */ - if (nrsv == 0) return FR_NO_FILESYSTEM; /* (Must not be 0) */ - - /* Determine the FAT sub type */ - sysect = nrsv + fasize + fs->n_rootdir / (SS(fs) / SZDIRE); /* RSV + FAT + DIR */ - if (tsect < sysect) return FR_NO_FILESYSTEM; /* (Invalid volume size) */ - nclst = (tsect - sysect) / fs->csize; /* Number of clusters */ - if (nclst == 0) return FR_NO_FILESYSTEM; /* (Invalid volume size) */ - fmt = FS_FAT32; - if (nclst <= MAX_FAT16) fmt = FS_FAT16; - if (nclst <= MAX_FAT12) fmt = FS_FAT12; - - /* Boundaries and Limits */ - fs->n_fatent = nclst + 2; /* Number of FAT entries */ - fs->volbase = bsect; /* Volume start sector */ - fs->fatbase = bsect + nrsv; /* FAT start sector */ - fs->database = bsect + sysect; /* Data start sector */ - if (fmt == FS_FAT32) { - if (ld_word(fs->win + BPB_FSVer32) != 0) return FR_NO_FILESYSTEM; /* (Must be FAT32 revision 0.0) */ - if (fs->n_rootdir) return FR_NO_FILESYSTEM; /* (BPB_RootEntCnt must be 0) */ - fs->dirbase = ld_dword(fs->win + BPB_RootClus32); /* Root directory start cluster */ - szbfat = fs->n_fatent * 4; /* (Needed FAT size) */ - } else { - if (fs->n_rootdir == 0) return FR_NO_FILESYSTEM;/* (BPB_RootEntCnt must not be 0) */ - fs->dirbase = fs->fatbase + fasize; /* Root directory start sector */ - szbfat = (fmt == FS_FAT16) ? /* (Needed FAT size) */ - fs->n_fatent * 2 : fs->n_fatent * 3 / 2 + (fs->n_fatent & 1); - } - if (fs->fsize < (szbfat + (SS(fs) - 1)) / SS(fs)) return FR_NO_FILESYSTEM; /* (BPB_FATSz must not be less than the size needed) */ - -#if !_FS_READONLY - /* Get FSINFO if available */ - fs->last_clst = fs->free_clst = 0xFFFFFFFF; /* Initialize cluster allocation information */ - fs->fsi_flag = 0x80; -#if (_FS_NOFSINFO & 3) != 3 - if (fmt == FS_FAT32 /* Enable FSINFO only if FAT32 and BPB_FSInfo32 == 1 */ - && ld_word(fs->win + BPB_FSInfo32) == 1 - && move_window(fs, bsect + 1) == FR_OK) - { - fs->fsi_flag = 0; - if (ld_word(fs->win + BS_55AA) == 0xAA55 /* Load FSINFO data if available */ - && ld_dword(fs->win + FSI_LeadSig) == 0x41615252 - && ld_dword(fs->win + FSI_StrucSig) == 0x61417272) - { -#if (_FS_NOFSINFO & 1) == 0 - fs->free_clst = ld_dword(fs->win + FSI_Free_Count); -#endif -#if (_FS_NOFSINFO & 2) == 0 - fs->last_clst = ld_dword(fs->win + FSI_Nxt_Free); -#endif - } - } -#endif /* (_FS_NOFSINFO & 3) != 3 */ -#endif /* !_FS_READONLY */ - } - - fs->fs_type = fmt; /* FAT sub-type */ - fs->id = ++Fsid; /* File system mount ID */ -#if _USE_LFN == 1 - fs->lfnbuf = LfnBuf; /* Static LFN working buffer */ -#if _FS_EXFAT - fs->dirbuf = DirBuf; /* Static directory block working buuffer */ -#endif -#endif -#if _FS_RPATH != 0 - fs->cdir = 0; /* Initialize current directory */ -#endif -#if _FS_LOCK != 0 /* Clear file lock semaphores */ - clear_lock(fs); -#endif - return FR_OK; -} - - - - -/*-----------------------------------------------------------------------*/ -/* Check if the file/directory object is valid or not */ -/*-----------------------------------------------------------------------*/ - -static -FRESULT validate ( /* Returns FR_OK or FR_INVALID_OBJECT */ - _FDID* obj, /* Pointer to the _OBJ, the 1st member in the FIL/DIR object, to check validity */ - FATFS** fs /* Pointer to pointer to the owner file system object to return */ -) -{ - FRESULT res; - - - if (!obj || !obj->fs || !obj->fs->fs_type || obj->fs->id != obj->id || (disk_status(obj->fs->drv) & STA_NOINIT)) { - *fs = 0; /* The object is invalid */ - res = FR_INVALID_OBJECT; - } else { - *fs = obj->fs; /* Owner file sytem object */ - ENTER_FF(obj->fs); /* Lock file system */ - res = FR_OK; - } - return res; -} - - - - -/*--------------------------------------------------------------------------- - - Public Functions (FatFs API) - -----------------------------------------------------------------------------*/ - - - -/*-----------------------------------------------------------------------*/ -/* Mount/Unmount a Logical Drive */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_mount ( - FATFS* fs, /* Pointer to the file system object (NULL:unmount)*/ - const TCHAR* path, /* Logical drive number to be mounted/unmounted */ - BYTE opt /* Mode option 0:Do not mount (delayed mount), 1:Mount immediately */ -) -{ - FATFS *cfs; - int vol; - FRESULT res; - const TCHAR *rp = path; - - - /* Get logical drive number */ - vol = get_ldnumber(&rp); - if (vol < 0) return FR_INVALID_DRIVE; - cfs = FatFs[vol]; /* Pointer to fs object */ - - if (cfs) { -#if _FS_LOCK != 0 - clear_lock(cfs); -#endif -#if _FS_REENTRANT /* Discard sync object of the current volume */ - if (!ff_del_syncobj(cfs->sobj)) return FR_INT_ERR; -#endif - cfs->fs_type = 0; /* Clear old fs object */ - } - - if (fs) { - fs->fs_type = 0; /* Clear new fs object */ -#if _FS_REENTRANT /* Create sync object for the new volume */ - if (!ff_cre_syncobj((BYTE)vol, &fs->sobj)) return FR_INT_ERR; -#endif - } - FatFs[vol] = fs; /* Register new fs object */ - - if (!fs || opt != 1) return FR_OK; /* Do not mount now, it will be mounted later */ - - res = find_volume(&path, &fs, 0); /* Force mounted the volume */ - LEAVE_FF(fs, res); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Open or Create a File */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_open ( - FIL* fp, /* Pointer to the blank file object */ - const TCHAR* path, /* Pointer to the file name */ - BYTE mode /* Access mode and file open mode flags */ -) -{ - FRESULT res; - DIR dj; - FATFS *fs; -#if !_FS_READONLY - DWORD dw, cl, bcs, clst, sc; - FSIZE_t ofs; -#endif - DEF_NAMBUF - - - if (!fp) return FR_INVALID_OBJECT; - - /* Get logical drive */ - mode &= _FS_READONLY ? FA_READ : FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_CREATE_NEW | FA_OPEN_ALWAYS | FA_OPEN_APPEND | FA_SEEKEND; - res = find_volume(&path, &fs, mode); - if (res == FR_OK) { - dj.obj.fs = fs; - INIT_NAMBUF(fs); - res = follow_path(&dj, path); /* Follow the file path */ -#if !_FS_READONLY /* R/W configuration */ - if (res == FR_OK) { - if (dj.fn[NSFLAG] & NS_NONAME) { /* Origin directory itself? */ - res = FR_INVALID_NAME; - } -#if _FS_LOCK != 0 - else { - res = chk_lock(&dj, (mode & ~FA_READ) ? 1 : 0); - } -#endif - } - /* Create or Open a file */ - if (mode & (FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)) { - if (res != FR_OK) { /* No file, create new */ - if (res == FR_NO_FILE) /* There is no file to open, create a new entry */ -#if _FS_LOCK != 0 - res = enq_lock() ? dir_register(&dj) : FR_TOO_MANY_OPEN_FILES; -#else - res = dir_register(&dj); -#endif - mode |= FA_CREATE_ALWAYS; /* File is created */ - } - else { /* Any object is already existing */ - if (dj.obj.attr & (AM_RDO | AM_DIR)) { /* Cannot overwrite it (R/O or DIR) */ - res = FR_DENIED; - } else { - if (mode & FA_CREATE_NEW) res = FR_EXIST; /* Cannot create as new file */ - } - } - if (res == FR_OK && (mode & FA_CREATE_ALWAYS)) { /* Truncate it if overwrite mode */ - dw = GET_FATTIME(); -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - /* Get current allocation info */ - fp->obj.fs = fs; - fp->obj.sclust = ld_dword(fs->dirbuf + XDIR_FstClus); - fp->obj.objsize = ld_qword(fs->dirbuf + XDIR_FileSize); - fp->obj.stat = fs->dirbuf[XDIR_GenFlags] & 2; - /* Initialize directory entry block */ - st_dword(fs->dirbuf + XDIR_CrtTime, dw); /* Set created time */ - fs->dirbuf[XDIR_CrtTime10] = 0; - st_dword(fs->dirbuf + XDIR_ModTime, dw); /* Set modified time */ - fs->dirbuf[XDIR_ModTime10] = 0; - fs->dirbuf[XDIR_Attr] = AM_ARC; /* Reset attribute */ - st_dword(fs->dirbuf + XDIR_FstClus, 0); /* Reset file allocation info */ - st_qword(fs->dirbuf + XDIR_FileSize, 0); - st_qword(fs->dirbuf + XDIR_ValidFileSize, 0); - fs->dirbuf[XDIR_GenFlags] = 1; - res = store_xdir(&dj); - if (res == FR_OK && fp->obj.sclust) { /* Remove the cluster chain if exist */ - res = remove_chain(&fp->obj, fp->obj.sclust, 0); - fs->last_clst = fp->obj.sclust - 1; /* Reuse the cluster hole */ - } - } else -#endif - { - /* Clean directory info */ - st_dword(dj.dir + DIR_CrtTime, dw); /* Set created time */ - st_dword(dj.dir + DIR_ModTime, dw); /* Set modified time */ - dj.dir[DIR_Attr] = AM_ARC; /* Reset attribute */ - cl = ld_clust(fs, dj.dir); /* Get cluster chain */ - st_clust(fs, dj.dir, 0); /* Reset file allocation info */ - st_dword(dj.dir + DIR_FileSize, 0); - fs->wflag = 1; - - if (cl) { /* Remove the cluster chain if exist */ - dw = fs->winsect; - res = remove_chain(&dj.obj, cl, 0); - if (res == FR_OK) { - res = move_window(fs, dw); - fs->last_clst = cl - 1; /* Reuse the cluster hole */ - } - } - } - } - } - else { /* Open an existing file */ - if (res == FR_OK) { /* Following succeeded */ - if (dj.obj.attr & AM_DIR) { /* It is a directory */ - res = FR_NO_FILE; - } else { - if ((mode & FA_WRITE) && (dj.obj.attr & AM_RDO)) { /* R/O violation */ - res = FR_DENIED; - } - } - } - } - if (res == FR_OK) { - if (mode & FA_CREATE_ALWAYS) /* Set file change flag if created or overwritten */ - mode |= FA_MODIFIED; - fp->dir_sect = fs->winsect; /* Pointer to the directory entry */ - fp->dir_ptr = dj.dir; -#if _FS_LOCK != 0 - fp->obj.lockid = inc_lock(&dj, (mode & ~FA_READ) ? 1 : 0); - if (!fp->obj.lockid) res = FR_INT_ERR; -#endif - } -#else /* R/O configuration */ - if (res == FR_OK) { - if (dj.fn[NSFLAG] & NS_NONAME) { /* Origin directory itself? */ - res = FR_INVALID_NAME; - } else { - if (dj.obj.attr & AM_DIR) { /* It is a directory */ - res = FR_NO_FILE; - } - } - } -#endif - - if (res == FR_OK) { -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - fp->obj.sclust = ld_dword(fs->dirbuf + XDIR_FstClus); /* Get allocation info */ - fp->obj.objsize = ld_qword(fs->dirbuf + XDIR_FileSize); - fp->obj.stat = fs->dirbuf[XDIR_GenFlags] & 2; - fp->obj.c_scl = dj.obj.sclust; - fp->obj.c_size = ((DWORD)dj.obj.objsize & 0xFFFFFF00) | dj.obj.stat; - fp->obj.c_ofs = dj.blk_ofs; - } else -#endif - { - fp->obj.sclust = ld_clust(fs, dj.dir); /* Get allocation info */ - fp->obj.objsize = ld_dword(dj.dir + DIR_FileSize); - } -#if _USE_FASTSEEK - fp->cltbl = 0; /* Disable fast seek mode */ -#endif - fp->obj.fs = fs; /* Validate the file object */ - fp->obj.id = fs->id; - fp->flag = mode; /* Set file access mode */ - fp->err = 0; /* Clear error flag */ - fp->sect = 0; /* Invalidate current data sector */ - fp->fptr = 0; /* Set file pointer top of the file */ -#if !_FS_READONLY -#if !_FS_TINY - mem_set(fp->buf, 0, _MAX_SS); /* Clear sector buffer */ -#endif - if ((mode & FA_SEEKEND) && fp->obj.objsize > 0) { /* Seek to end of file if FA_OPEN_APPEND is specified */ - fp->fptr = fp->obj.objsize; /* Offset to seek */ - bcs = (DWORD)fs->csize * SS(fs); /* Cluster size in byte */ - clst = fp->obj.sclust; /* Follow the cluster chain */ - for (ofs = fp->obj.objsize; res == FR_OK && ofs > bcs; ofs -= bcs) { - clst = get_fat(&fp->obj, clst); - if (clst <= 1) res = FR_INT_ERR; - if (clst == 0xFFFFFFFF) res = FR_DISK_ERR; - } - fp->clust = clst; - if (res == FR_OK && ofs % SS(fs)) { /* Fill sector buffer if not on the sector boundary */ - if ((sc = clust2sect(fs, clst)) == 0) { - res = FR_INT_ERR; - } else { - fp->sect = sc + (DWORD)(ofs / SS(fs)); -#if !_FS_TINY - if (disk_read(fs->drv, fp->buf, fp->sect, 1) != RES_OK) res = FR_DISK_ERR; -#endif - } - } - } -#endif - } - - FREE_NAMBUF(); - } - - if (res != FR_OK) fp->obj.fs = 0; /* Invalidate file object on error */ - - LEAVE_FF(fs, res); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Read File */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_read ( - FIL* fp, /* Pointer to the file object */ - void* buff, /* Pointer to data buffer */ - UINT btr, /* Number of bytes to read */ - UINT* br /* Pointer to number of bytes read */ -) -{ - FRESULT res; - FATFS *fs; - DWORD clst, sect; - FSIZE_t remain; - UINT rcnt, cc, csect; - BYTE *rbuff = (BYTE*)buff; - - - *br = 0; /* Clear read byte counter */ - res = validate(&fp->obj, &fs); /* Check validity of the file object */ - if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); /* Check validity */ - if (!(fp->flag & FA_READ)) LEAVE_FF(fs, FR_DENIED); /* Check access mode */ - remain = fp->obj.objsize - fp->fptr; - if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */ - - for ( ; btr; /* Repeat until all data read */ - rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) { - if (fp->fptr % SS(fs) == 0) { /* On the sector boundary? */ - csect = (UINT)(fp->fptr / SS(fs) & (fs->csize - 1)); /* Sector offset in the cluster */ - if (csect == 0) { /* On the cluster boundary? */ - if (fp->fptr == 0) { /* On the top of the file? */ - clst = fp->obj.sclust; /* Follow cluster chain from the origin */ - } else { /* Middle or end of the file */ -#if _USE_FASTSEEK - if (fp->cltbl) { - clst = clmt_clust(fp, fp->fptr); /* Get cluster# from the CLMT */ - } else -#endif - { - clst = get_fat(&fp->obj, fp->clust); /* Follow cluster chain on the FAT */ - } - } - if (clst < 2) ABORT(fs, FR_INT_ERR); - if (clst == 0xFFFFFFFF) ABORT(fs, FR_DISK_ERR); - fp->clust = clst; /* Update current cluster */ - } - sect = clust2sect(fs, fp->clust); /* Get current sector */ - if (!sect) ABORT(fs, FR_INT_ERR); - sect += csect; - cc = btr / SS(fs); /* When remaining bytes >= sector size, */ - if (cc) { /* Read maximum contiguous sectors directly */ - if (csect + cc > fs->csize) { /* Clip at cluster boundary */ - cc = fs->csize - csect; - } - if (disk_read(fs->drv, rbuff, sect, cc) != RES_OK) ABORT(fs, FR_DISK_ERR); -#if !_FS_READONLY && _FS_MINIMIZE <= 2 /* Replace one of the read sectors with cached data if it contains a dirty sector */ -#if _FS_TINY - if (fs->wflag && fs->winsect - sect < cc) { - mem_cpy(rbuff + ((fs->winsect - sect) * SS(fs)), fs->win, SS(fs)); - } -#else - if ((fp->flag & FA_DIRTY) && fp->sect - sect < cc) { - mem_cpy(rbuff + ((fp->sect - sect) * SS(fs)), fp->buf, SS(fs)); - } -#endif -#endif - rcnt = SS(fs) * cc; /* Number of bytes transferred */ - continue; - } -#if !_FS_TINY - if (fp->sect != sect) { /* Load data sector if not in cache */ -#if !_FS_READONLY - if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */ - if (disk_write(fs->drv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); - fp->flag &= (BYTE)~FA_DIRTY; - } -#endif - if (disk_read(fs->drv, fp->buf, sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); /* Fill sector cache */ - } -#endif - fp->sect = sect; - } - rcnt = SS(fs) - (UINT)fp->fptr % SS(fs); /* Number of bytes left in the sector */ - if (rcnt > btr) rcnt = btr; /* Clip it by btr if needed */ -#if _FS_TINY - if (move_window(fs, fp->sect) != FR_OK) ABORT(fs, FR_DISK_ERR); /* Move sector window */ - mem_cpy(rbuff, fs->win + fp->fptr % SS(fs), rcnt); /* Extract partial sector */ -#else - mem_cpy(rbuff, fp->buf + fp->fptr % SS(fs), rcnt); /* Extract partial sector */ -#endif - } - - LEAVE_FF(fs, FR_OK); -} - - - - -#if !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* Write File */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_write ( - FIL* fp, /* Pointer to the file object */ - const void* buff, /* Pointer to the data to be written */ - UINT btw, /* Number of bytes to write */ - UINT* bw /* Pointer to number of bytes written */ -) -{ - FRESULT res; - FATFS *fs; - DWORD clst, sect; - UINT wcnt, cc, csect; - const BYTE *wbuff = (const BYTE*)buff; - - - *bw = 0; /* Clear write byte counter */ - res = validate(&fp->obj, &fs); /* Check validity of the file object */ - if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); /* Check validity */ - if (!(fp->flag & FA_WRITE)) LEAVE_FF(fs, FR_DENIED); /* Check access mode */ - - /* Check fptr wrap-around (file size cannot reach 4GiB on FATxx) */ - if ((!_FS_EXFAT || fs->fs_type != FS_EXFAT) && (DWORD)(fp->fptr + btw) < (DWORD)fp->fptr) { - btw = (UINT)(0xFFFFFFFF - (DWORD)fp->fptr); - } - - for ( ; btw; /* Repeat until all data written */ - wbuff += wcnt, fp->fptr += wcnt, fp->obj.objsize = (fp->fptr > fp->obj.objsize) ? fp->fptr : fp->obj.objsize, *bw += wcnt, btw -= wcnt) { - if (fp->fptr % SS(fs) == 0) { /* On the sector boundary? */ - csect = (UINT)(fp->fptr / SS(fs)) & (fs->csize - 1); /* Sector offset in the cluster */ - if (csect == 0) { /* On the cluster boundary? */ - if (fp->fptr == 0) { /* On the top of the file? */ - clst = fp->obj.sclust; /* Follow from the origin */ - if (clst == 0) { /* If no cluster is allocated, */ - clst = create_chain(&fp->obj, 0); /* create a new cluster chain */ - } - } else { /* On the middle or end of the file */ -#if _USE_FASTSEEK - if (fp->cltbl) { - clst = clmt_clust(fp, fp->fptr); /* Get cluster# from the CLMT */ - } else -#endif - { - clst = create_chain(&fp->obj, fp->clust); /* Follow or stretch cluster chain on the FAT */ - } - } - if (clst == 0) break; /* Could not allocate a new cluster (disk full) */ - if (clst == 1) ABORT(fs, FR_INT_ERR); - if (clst == 0xFFFFFFFF) ABORT(fs, FR_DISK_ERR); - fp->clust = clst; /* Update current cluster */ - if (fp->obj.sclust == 0) fp->obj.sclust = clst; /* Set start cluster if the first write */ - } -#if _FS_TINY - if (fs->winsect == fp->sect && sync_window(fs) != FR_OK) ABORT(fs, FR_DISK_ERR); /* Write-back sector cache */ -#else - if (fp->flag & FA_DIRTY) { /* Write-back sector cache */ - if (disk_write(fs->drv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); - fp->flag &= (BYTE)~FA_DIRTY; - } -#endif - sect = clust2sect(fs, fp->clust); /* Get current sector */ - if (!sect) ABORT(fs, FR_INT_ERR); - sect += csect; - cc = btw / SS(fs); /* When remaining bytes >= sector size, */ - if (cc) { /* Write maximum contiguous sectors directly */ - if (csect + cc > fs->csize) { /* Clip at cluster boundary */ - cc = fs->csize - csect; - } - if (disk_write(fs->drv, wbuff, sect, cc) != RES_OK) ABORT(fs, FR_DISK_ERR); -#if _FS_MINIMIZE <= 2 -#if _FS_TINY - if (fs->winsect - sect < cc) { /* Refill sector cache if it gets invalidated by the direct write */ - mem_cpy(fs->win, wbuff + ((fs->winsect - sect) * SS(fs)), SS(fs)); - fs->wflag = 0; - } -#else - if (fp->sect - sect < cc) { /* Refill sector cache if it gets invalidated by the direct write */ - mem_cpy(fp->buf, wbuff + ((fp->sect - sect) * SS(fs)), SS(fs)); - fp->flag &= (BYTE)~FA_DIRTY; - } -#endif -#endif - wcnt = SS(fs) * cc; /* Number of bytes transferred */ - continue; - } -#if _FS_TINY - if (fp->fptr >= fp->obj.objsize) { /* Avoid silly cache filling on the growing edge */ - if (sync_window(fs) != FR_OK) ABORT(fs, FR_DISK_ERR); - fs->winsect = sect; - } -#else - if (fp->sect != sect && /* Fill sector cache with file data */ - fp->fptr < fp->obj.objsize && - disk_read(fs->drv, fp->buf, sect, 1) != RES_OK) { - ABORT(fs, FR_DISK_ERR); - } -#endif - fp->sect = sect; - } - wcnt = SS(fs) - (UINT)fp->fptr % SS(fs); /* Number of bytes left in the sector */ - if (wcnt > btw) wcnt = btw; /* Clip it by btw if needed */ -#if _FS_TINY - if (move_window(fs, fp->sect) != FR_OK) ABORT(fs, FR_DISK_ERR); /* Move sector window */ - mem_cpy(fs->win + fp->fptr % SS(fs), wbuff, wcnt); /* Fit data to the sector */ - fs->wflag = 1; -#else - mem_cpy(fp->buf + fp->fptr % SS(fs), wbuff, wcnt); /* Fit data to the sector */ - fp->flag |= FA_DIRTY; -#endif - } - - fp->flag |= FA_MODIFIED; /* Set file change flag */ - - LEAVE_FF(fs, FR_OK); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Synchronize the File */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_sync ( - FIL* fp /* Pointer to the file object */ -) -{ - FRESULT res; - FATFS *fs; - DWORD tm; - BYTE *dir; -#if _FS_EXFAT - DEF_NAMBUF -#endif - - res = validate(&fp->obj, &fs); /* Check validity of the file object */ - if (res == FR_OK) { - if (fp->flag & FA_MODIFIED) { /* Is there any change to the file? */ -#if !_FS_TINY - if (fp->flag & FA_DIRTY) { /* Write-back cached data if needed */ - if (disk_write(fs->drv, fp->buf, fp->sect, 1) != RES_OK) LEAVE_FF(fs, FR_DISK_ERR); - fp->flag &= (BYTE)~FA_DIRTY; - } -#endif - /* Update the directory entry */ - tm = GET_FATTIME(); /* Modified time */ -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - res = fill_fat_chain(&fp->obj); /* Create FAT chain if needed */ - if (res == FR_OK) { - DIR dj; - - INIT_NAMBUF(fs); - res = load_obj_dir(&dj, &fp->obj); /* Load directory entry block */ - if (res == FR_OK) { - fs->dirbuf[XDIR_Attr] |= AM_ARC; /* Set archive bit */ - fs->dirbuf[XDIR_GenFlags] = fp->obj.stat | 1; /* Update file allocation info */ - st_dword(fs->dirbuf + XDIR_FstClus, fp->obj.sclust); - st_qword(fs->dirbuf + XDIR_FileSize, fp->obj.objsize); - st_qword(fs->dirbuf + XDIR_ValidFileSize, fp->obj.objsize); - st_dword(fs->dirbuf + XDIR_ModTime, tm); /* Update modified time */ - fs->dirbuf[XDIR_ModTime10] = 0; - st_dword(fs->dirbuf + XDIR_AccTime, 0); - res = store_xdir(&dj); /* Restore it to the directory */ - if (res == FR_OK) { - res = sync_fs(fs); - fp->flag &= (BYTE)~FA_MODIFIED; - } - } - FREE_NAMBUF(); - } - } else -#endif - { - res = move_window(fs, fp->dir_sect); - if (res == FR_OK) { - dir = fp->dir_ptr; - dir[DIR_Attr] |= AM_ARC; /* Set archive bit */ - st_clust(fp->obj.fs, dir, fp->obj.sclust); /* Update file allocation info */ - st_dword(dir + DIR_FileSize, (DWORD)fp->obj.objsize); /* Update file size */ - st_dword(dir + DIR_ModTime, tm); /* Update modified time */ - st_word(dir + DIR_LstAccDate, 0); - fs->wflag = 1; - res = sync_fs(fs); /* Restore it to the directory */ - fp->flag &= (BYTE)~FA_MODIFIED; - } - } - } - } - - LEAVE_FF(fs, res); -} - -#endif /* !_FS_READONLY */ - - - - -/*-----------------------------------------------------------------------*/ -/* Close File */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_close ( - FIL* fp /* Pointer to the file object to be closed */ -) -{ - FRESULT res; - FATFS *fs; - -#if !_FS_READONLY - res = f_sync(fp); /* Flush cached data */ - if (res == FR_OK) -#endif - { - res = validate(&fp->obj, &fs); /* Lock volume */ - if (res == FR_OK) { -#if _FS_LOCK != 0 - res = dec_lock(fp->obj.lockid); /* Decrement file open counter */ - if (res == FR_OK) -#endif - { - fp->obj.fs = 0; /* Invalidate file object */ - } -#if _FS_REENTRANT - unlock_fs(fs, FR_OK); /* Unlock volume */ -#endif - } - } - return res; -} - - - - -#if _FS_RPATH >= 1 -/*-----------------------------------------------------------------------*/ -/* Change Current Directory or Current Drive, Get Current Directory */ -/*-----------------------------------------------------------------------*/ - -#if _VOLUMES >= 2 -FRESULT f_chdrive ( - const TCHAR* path /* Drive number */ -) -{ - int vol; - - - /* Get logical drive number */ - vol = get_ldnumber(&path); - if (vol < 0) return FR_INVALID_DRIVE; - - CurrVol = (BYTE)vol; /* Set it as current volume */ - - return FR_OK; -} -#endif - - -FRESULT f_chdir ( - const TCHAR* path /* Pointer to the directory path */ -) -{ - FRESULT res; - DIR dj; - FATFS *fs; - DEF_NAMBUF - - /* Get logical drive */ - res = find_volume(&path, &fs, 0); - if (res == FR_OK) { - dj.obj.fs = fs; - INIT_NAMBUF(fs); - res = follow_path(&dj, path); /* Follow the path */ - if (res == FR_OK) { /* Follow completed */ - if (dj.fn[NSFLAG] & NS_NONAME) { - fs->cdir = dj.obj.sclust; /* It is the start directory itself */ -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - fs->cdc_scl = dj.obj.c_scl; - fs->cdc_size = dj.obj.c_size; - fs->cdc_ofs = dj.obj.c_ofs; - } -#endif - } else { - if (dj.obj.attr & AM_DIR) { /* It is a sub-directory */ -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - fs->cdir = ld_dword(fs->dirbuf + XDIR_FstClus); /* Sub-directory cluster */ - fs->cdc_scl = dj.obj.sclust; /* Save containing directory information */ - fs->cdc_size = ((DWORD)dj.obj.objsize & 0xFFFFFF00) | dj.obj.stat; - fs->cdc_ofs = dj.blk_ofs; - } else -#endif - { - fs->cdir = ld_clust(fs, dj.dir); /* Sub-directory cluster */ - } - } else { - res = FR_NO_PATH; /* Reached but a file */ - } - } - } - FREE_NAMBUF(); - if (res == FR_NO_FILE) res = FR_NO_PATH; - } - - LEAVE_FF(fs, res); -} - - -#if _FS_RPATH >= 2 -FRESULT f_getcwd ( - TCHAR* buff, /* Pointer to the directory path */ - UINT len /* Size of path */ -) -{ - FRESULT res; - DIR dj; - FATFS *fs; - UINT i, n; - DWORD ccl; - TCHAR *tp; - FILINFO fno; - DEF_NAMBUF - - - *buff = 0; - /* Get logical drive */ - res = find_volume((const TCHAR**)&buff, &fs, 0); /* Get current volume */ - if (res == FR_OK) { - dj.obj.fs = fs; - INIT_NAMBUF(fs); - i = len; /* Bottom of buffer (directory stack base) */ - if (!_FS_EXFAT || fs->fs_type != FS_EXFAT) { /* (Cannot do getcwd on exFAT and returns root path) */ - dj.obj.sclust = fs->cdir; /* Start to follow upper directory from current directory */ - while ((ccl = dj.obj.sclust) != 0) { /* Repeat while current directory is a sub-directory */ - res = dir_sdi(&dj, 1 * SZDIRE); /* Get parent directory */ - if (res != FR_OK) break; - res = move_window(fs, dj.sect); - if (res != FR_OK) break; - dj.obj.sclust = ld_clust(fs, dj.dir); /* Goto parent directory */ - res = dir_sdi(&dj, 0); - if (res != FR_OK) break; - do { /* Find the entry links to the child directory */ - res = dir_read(&dj, 0); - if (res != FR_OK) break; - if (ccl == ld_clust(fs, dj.dir)) break; /* Found the entry */ - res = dir_next(&dj, 0); - } while (res == FR_OK); - if (res == FR_NO_FILE) res = FR_INT_ERR;/* It cannot be 'not found'. */ - if (res != FR_OK) break; - get_fileinfo(&dj, &fno); /* Get the directory name and push it to the buffer */ - for (n = 0; fno.fname[n]; n++) ; - if (i < n + 3) { - res = FR_NOT_ENOUGH_CORE; break; - } - while (n) buff[--i] = fno.fname[--n]; - buff[--i] = '/'; - } - } - tp = buff; - if (res == FR_OK) { -#if _VOLUMES >= 2 - *tp++ = '0' + CurrVol; /* Put drive number */ - *tp++ = ':'; -#endif - if (i == len) { /* Root-directory */ - *tp++ = '/'; - } else { /* Sub-directroy */ - do /* Add stacked path str */ - *tp++ = buff[i++]; - while (i < len); - } - } - *tp = 0; - FREE_NAMBUF(); - } - - LEAVE_FF(fs, res); -} - -#endif /* _FS_RPATH >= 2 */ -#endif /* _FS_RPATH >= 1 */ - - - -#if _FS_MINIMIZE <= 2 -/*-----------------------------------------------------------------------*/ -/* Seek File R/W Pointer */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_lseek ( - FIL* fp, /* Pointer to the file object */ - FSIZE_t ofs /* File pointer from top of file */ -) -{ - FRESULT res; - FATFS *fs; - DWORD clst, bcs, nsect; - FSIZE_t ifptr; -#if _USE_FASTSEEK - DWORD cl, pcl, ncl, tcl, dsc, tlen, ulen, *tbl; -#endif - - res = validate(&fp->obj, &fs); /* Check validity of the file object */ - if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); /* Check validity */ -#if _USE_FASTSEEK - if (fp->cltbl) { /* Fast seek */ - if (ofs == CREATE_LINKMAP) { /* Create CLMT */ - tbl = fp->cltbl; - tlen = *tbl++; ulen = 2; /* Given table size and required table size */ - cl = fp->obj.sclust; /* Origin of the chain */ - if (cl) { - do { - /* Get a fragment */ - tcl = cl; ncl = 0; ulen += 2; /* Top, length and used items */ - do { - pcl = cl; ncl++; - cl = get_fat(&fp->obj, cl); - if (cl <= 1) ABORT(fs, FR_INT_ERR); - if (cl == 0xFFFFFFFF) ABORT(fs, FR_DISK_ERR); - } while (cl == pcl + 1); - if (ulen <= tlen) { /* Store the length and top of the fragment */ - *tbl++ = ncl; *tbl++ = tcl; - } - } while (cl < fs->n_fatent); /* Repeat until end of chain */ - } - *fp->cltbl = ulen; /* Number of items used */ - if (ulen <= tlen) { - *tbl = 0; /* Terminate table */ - } else { - res = FR_NOT_ENOUGH_CORE; /* Given table size is smaller than required */ - } - } else { /* Fast seek */ - if (ofs > fp->obj.objsize) ofs = fp->obj.objsize; /* Clip offset at the file size */ - fp->fptr = ofs; /* Set file pointer */ - if (ofs) { - fp->clust = clmt_clust(fp, ofs - 1); - dsc = clust2sect(fs, fp->clust); - if (!dsc) ABORT(fs, FR_INT_ERR); - dsc += (DWORD)((ofs - 1) / SS(fs)) & (fs->csize - 1); - if (fp->fptr % SS(fs) && dsc != fp->sect) { /* Refill sector cache if needed */ -#if !_FS_TINY -#if !_FS_READONLY - if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */ - if (disk_write(fs->drv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); - fp->flag &= (BYTE)~FA_DIRTY; - } -#endif - if (disk_read(fs->drv, fp->buf, dsc, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); /* Load current sector */ -#endif - fp->sect = dsc; - } - } - } - } else -#endif - - /* Normal Seek */ - { -#if _FS_EXFAT - if (fs->fs_type != FS_EXFAT && ofs >= 0x100000000) ofs = 0xFFFFFFFF; /* Clip at 4GiB-1 if at FATxx */ -#endif - if (ofs > fp->obj.objsize && (_FS_READONLY || !(fp->flag & FA_WRITE))) { /* In read-only mode, clip offset with the file size */ - ofs = fp->obj.objsize; - } - ifptr = fp->fptr; - fp->fptr = nsect = 0; - if (ofs) { - bcs = (DWORD)fs->csize * SS(fs); /* Cluster size (byte) */ - if (ifptr > 0 && - (ofs - 1) / bcs >= (ifptr - 1) / bcs) { /* When seek to same or following cluster, */ - fp->fptr = (ifptr - 1) & ~(FSIZE_t)(bcs - 1); /* start from the current cluster */ - ofs -= fp->fptr; - clst = fp->clust; - } else { /* When seek to back cluster, */ - clst = fp->obj.sclust; /* start from the first cluster */ -#if !_FS_READONLY - if (clst == 0) { /* If no cluster chain, create a new chain */ - clst = create_chain(&fp->obj, 0); - if (clst == 1) ABORT(fs, FR_INT_ERR); - if (clst == 0xFFFFFFFF) ABORT(fs, FR_DISK_ERR); - fp->obj.sclust = clst; - } -#endif - fp->clust = clst; - } - if (clst != 0) { - while (ofs > bcs) { /* Cluster following loop */ - ofs -= bcs; fp->fptr += bcs; -#if !_FS_READONLY - if (fp->flag & FA_WRITE) { /* Check if in write mode or not */ - if (_FS_EXFAT && fp->fptr > fp->obj.objsize) { /* No FAT chain object needs correct objsize to generate FAT value */ - fp->obj.objsize = fp->fptr; - fp->flag |= FA_MODIFIED; - } - clst = create_chain(&fp->obj, clst); /* Follow chain with forceed stretch */ - if (clst == 0) { /* Clip file size in case of disk full */ - ofs = 0; break; - } - } else -#endif - { - clst = get_fat(&fp->obj, clst); /* Follow cluster chain if not in write mode */ - } - if (clst == 0xFFFFFFFF) ABORT(fs, FR_DISK_ERR); - if (clst <= 1 || clst >= fs->n_fatent) ABORT(fs, FR_INT_ERR); - fp->clust = clst; - } - fp->fptr += ofs; - if (ofs % SS(fs)) { - nsect = clust2sect(fs, clst); /* Current sector */ - if (!nsect) ABORT(fs, FR_INT_ERR); - nsect += (DWORD)(ofs / SS(fs)); - } - } - } - if (!_FS_READONLY && fp->fptr > fp->obj.objsize) { /* Set file change flag if the file size is extended */ - fp->obj.objsize = fp->fptr; - fp->flag |= FA_MODIFIED; - } - if (fp->fptr % SS(fs) && nsect != fp->sect) { /* Fill sector cache if needed */ -#if !_FS_TINY -#if !_FS_READONLY - if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */ - if (disk_write(fs->drv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); - fp->flag &= (BYTE)~FA_DIRTY; - } -#endif - if (disk_read(fs->drv, fp->buf, nsect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); /* Fill sector cache */ -#endif - fp->sect = nsect; - } - } - - LEAVE_FF(fs, res); -} - - - -#if _FS_MINIMIZE <= 1 -/*-----------------------------------------------------------------------*/ -/* Create a Directory Object */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_opendir ( - DIR* dp, /* Pointer to directory object to create */ - const TCHAR* path /* Pointer to the directory path */ -) -{ - FRESULT res; - FATFS *fs; - _FDID *obj; - DEF_NAMBUF - - - if (!dp) return FR_INVALID_OBJECT; - - /* Get logical drive */ - obj = &dp->obj; - res = find_volume(&path, &fs, 0); - if (res == FR_OK) { - obj->fs = fs; - INIT_NAMBUF(fs); - res = follow_path(dp, path); /* Follow the path to the directory */ - if (res == FR_OK) { /* Follow completed */ - if (!(dp->fn[NSFLAG] & NS_NONAME)) { /* It is not the origin directory itself */ - if (obj->attr & AM_DIR) { /* This object is a sub-directory */ -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - obj->c_scl = obj->sclust; /* Save containing directory inforamation */ - obj->c_size = ((DWORD)obj->objsize & 0xFFFFFF00) | obj->stat; - obj->c_ofs = dp->blk_ofs; - obj->sclust = ld_dword(fs->dirbuf + XDIR_FstClus); /* Get object location and status */ - obj->objsize = ld_qword(fs->dirbuf + XDIR_FileSize); - obj->stat = fs->dirbuf[XDIR_GenFlags] & 2; - } else -#endif - { - obj->sclust = ld_clust(fs, dp->dir); /* Get object location */ - } - } else { /* This object is a file */ - res = FR_NO_PATH; - } - } - if (res == FR_OK) { - obj->id = fs->id; - res = dir_sdi(dp, 0); /* Rewind directory */ -#if _FS_LOCK != 0 - if (res == FR_OK) { - if (obj->sclust) { - obj->lockid = inc_lock(dp, 0); /* Lock the sub directory */ - if (!obj->lockid) res = FR_TOO_MANY_OPEN_FILES; - } else { - obj->lockid = 0; /* Root directory need not to be locked */ - } - } -#endif - } - } - FREE_NAMBUF(); - if (res == FR_NO_FILE) res = FR_NO_PATH; - } - if (res != FR_OK) obj->fs = 0; /* Invalidate the directory object if function faild */ - - LEAVE_FF(fs, res); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Close Directory */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_closedir ( - DIR *dp /* Pointer to the directory object to be closed */ -) -{ - FRESULT res; - FATFS *fs; - - - res = validate(&dp->obj, &fs); /* Check validity of the file object */ - if (res == FR_OK) { -#if _FS_LOCK != 0 - if (dp->obj.lockid) { /* Decrement sub-directory open counter */ - res = dec_lock(dp->obj.lockid); - } - if (res == FR_OK) -#endif - { - dp->obj.fs = 0; /* Invalidate directory object */ - } -#if _FS_REENTRANT - unlock_fs(fs, FR_OK); /* Unlock volume */ -#endif - } - return res; -} - - - - -/*-----------------------------------------------------------------------*/ -/* Read Directory Entries in Sequence */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_readdir ( - DIR* dp, /* Pointer to the open directory object */ - FILINFO* fno /* Pointer to file information to return */ -) -{ - FRESULT res; - FATFS *fs; - DEF_NAMBUF - - - res = validate(&dp->obj, &fs); /* Check validity of the directory object */ - if (res == FR_OK) { - if (!fno) { - res = dir_sdi(dp, 0); /* Rewind the directory object */ - } else { - INIT_NAMBUF(fs); - res = dir_read(dp, 0); /* Read an item */ - if (res == FR_NO_FILE) res = FR_OK; /* Ignore end of directory */ - if (res == FR_OK) { /* A valid entry is found */ - get_fileinfo(dp, fno); /* Get the object information */ - res = dir_next(dp, 0); /* Increment index for next */ - if (res == FR_NO_FILE) res = FR_OK; /* Ignore end of directory now */ - } - FREE_NAMBUF(); - } - } - LEAVE_FF(fs, res); -} - - - -#if _USE_FIND -/*-----------------------------------------------------------------------*/ -/* Find Next File */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_findnext ( - DIR* dp, /* Pointer to the open directory object */ - FILINFO* fno /* Pointer to the file information structure */ -) -{ - FRESULT res; - - - for (;;) { - res = f_readdir(dp, fno); /* Get a directory item */ - if (res != FR_OK || !fno || !fno->fname[0]) break; /* Terminate if any error or end of directory */ - if (pattern_matching(dp->pat, fno->fname, 0, 0)) break; /* Test for the file name */ -#if _USE_LFN != 0 && _USE_FIND == 2 - if (pattern_matching(dp->pat, fno->altname, 0, 0)) break; /* Test for alternative name if exist */ -#endif - } - return res; -} - - - -/*-----------------------------------------------------------------------*/ -/* Find First File */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_findfirst ( - DIR* dp, /* Pointer to the blank directory object */ - FILINFO* fno, /* Pointer to the file information structure */ - const TCHAR* path, /* Pointer to the directory to open */ - const TCHAR* pattern /* Pointer to the matching pattern */ -) -{ - FRESULT res; - - - dp->pat = pattern; /* Save pointer to pattern string */ - res = f_opendir(dp, path); /* Open the target directory */ - if (res == FR_OK) { - res = f_findnext(dp, fno); /* Find the first item */ - } - return res; -} - -#endif /* _USE_FIND */ - - - -#if _FS_MINIMIZE == 0 -/*-----------------------------------------------------------------------*/ -/* Get File Status */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_stat ( - const TCHAR* path, /* Pointer to the file path */ - FILINFO* fno /* Pointer to file information to return */ -) -{ - FRESULT res; - DIR dj; - DEF_NAMBUF - - - /* Get logical drive */ - res = find_volume(&path, &dj.obj.fs, 0); - if (res == FR_OK) { - INIT_NAMBUF(dj.obj.fs); - res = follow_path(&dj, path); /* Follow the file path */ - if (res == FR_OK) { /* Follow completed */ - if (dj.fn[NSFLAG] & NS_NONAME) { /* It is origin directory */ - res = FR_INVALID_NAME; - } else { /* Found an object */ - if (fno) get_fileinfo(&dj, fno); - } - } - FREE_NAMBUF(); - } - - LEAVE_FF(dj.obj.fs, res); -} - - - -#if !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* Get Number of Free Clusters */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_getfree ( - const TCHAR* path, /* Path name of the logical drive number */ - DWORD* nclst, /* Pointer to a variable to return number of free clusters */ - FATFS** fatfs /* Pointer to return pointer to corresponding file system object */ -) -{ - FRESULT res; - FATFS *fs; - DWORD nfree, clst, sect, stat; - UINT i; - BYTE *p; - _FDID obj; - - - /* Get logical drive */ - res = find_volume(&path, &fs, 0); - if (res == FR_OK) { - *fatfs = fs; /* Return ptr to the fs object */ - /* If free_clst is valid, return it without full cluster scan */ - if (fs->free_clst <= fs->n_fatent - 2) { - *nclst = fs->free_clst; - } else { - /* Get number of free clusters */ - nfree = 0; - if (fs->fs_type == FS_FAT12) { /* FAT12: Sector unalighed FAT entries */ - clst = 2; obj.fs = fs; - do { - stat = get_fat(&obj, clst); - if (stat == 0xFFFFFFFF) { res = FR_DISK_ERR; break; } - if (stat == 1) { res = FR_INT_ERR; break; } - if (stat == 0) nfree++; - } while (++clst < fs->n_fatent); - } else { -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { /* exFAT: Scan bitmap table */ - BYTE bm; - UINT b; - - clst = fs->n_fatent - 2; - sect = fs->database; - i = 0; - do { - if (i == 0 && (res = move_window(fs, sect++)) != FR_OK) break; - for (b = 8, bm = fs->win[i]; b && clst; b--, clst--) { - if (!(bm & 1)) nfree++; - bm >>= 1; - } - i = (i + 1) % SS(fs); - } while (clst); - } else -#endif - { /* FAT16/32: Sector alighed FAT entries */ - clst = fs->n_fatent; sect = fs->fatbase; - i = 0; p = 0; - do { - if (i == 0) { - res = move_window(fs, sect++); - if (res != FR_OK) break; - p = fs->win; - i = SS(fs); - } - if (fs->fs_type == FS_FAT16) { - if (ld_word(p) == 0) nfree++; - p += 2; i -= 2; - } else { - if ((ld_dword(p) & 0x0FFFFFFF) == 0) nfree++; - p += 4; i -= 4; - } - } while (--clst); - } - } - *nclst = nfree; /* Return the free clusters */ - fs->free_clst = nfree; /* Now free_clst is valid */ - fs->fsi_flag |= 1; /* FSInfo is to be updated */ - } - } - - LEAVE_FF(fs, res); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Truncate File */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_truncate ( - FIL* fp /* Pointer to the file object */ -) -{ - FRESULT res; - FATFS *fs; - DWORD ncl; - - - res = validate(&fp->obj, &fs); /* Check validity of the file object */ - if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); - if (!(fp->flag & FA_WRITE)) LEAVE_FF(fs, FR_DENIED); /* Check access mode */ - - if (fp->obj.objsize > fp->fptr) { - if (fp->fptr == 0) { /* When set file size to zero, remove entire cluster chain */ - res = remove_chain(&fp->obj, fp->obj.sclust, 0); - fp->obj.sclust = 0; - } else { /* When truncate a part of the file, remove remaining clusters */ - ncl = get_fat(&fp->obj, fp->clust); - res = FR_OK; - if (ncl == 0xFFFFFFFF) res = FR_DISK_ERR; - if (ncl == 1) res = FR_INT_ERR; - if (res == FR_OK && ncl < fs->n_fatent) { - res = remove_chain(&fp->obj, ncl, fp->clust); - } - } - fp->obj.objsize = fp->fptr; /* Set file size to current R/W point */ - fp->flag |= FA_MODIFIED; -#if !_FS_TINY - if (res == FR_OK && (fp->flag & FA_DIRTY)) { - if (disk_write(fs->drv, fp->buf, fp->sect, 1) != RES_OK) { - res = FR_DISK_ERR; - } else { - fp->flag &= (BYTE)~FA_DIRTY; - } - } -#endif - if (res != FR_OK) ABORT(fs, res); - } - - LEAVE_FF(fs, res); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Delete a File/Directory */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_unlink ( - const TCHAR* path /* Pointer to the file or directory path */ -) -{ - FRESULT res; - DIR dj, sdj; - DWORD dclst = 0; - FATFS *fs; -#if _FS_EXFAT - _FDID obj; -#endif - DEF_NAMBUF - - - /* Get logical drive */ - res = find_volume(&path, &fs, FA_WRITE); - dj.obj.fs = fs; - if (res == FR_OK) { - INIT_NAMBUF(fs); - res = follow_path(&dj, path); /* Follow the file path */ - if (_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT)) { - res = FR_INVALID_NAME; /* Cannot remove dot entry */ - } -#if _FS_LOCK != 0 - if (res == FR_OK) res = chk_lock(&dj, 2); /* Check if it is an open object */ -#endif - if (res == FR_OK) { /* The object is accessible */ - if (dj.fn[NSFLAG] & NS_NONAME) { - res = FR_INVALID_NAME; /* Cannot remove the origin directory */ - } else { - if (dj.obj.attr & AM_RDO) { - res = FR_DENIED; /* Cannot remove R/O object */ - } - } - if (res == FR_OK) { -#if _FS_EXFAT - obj.fs = fs; - if (fs->fs_type == FS_EXFAT) { - obj.sclust = dclst = ld_dword(fs->dirbuf + XDIR_FstClus); - obj.objsize = ld_qword(fs->dirbuf + XDIR_FileSize); - obj.stat = fs->dirbuf[XDIR_GenFlags] & 2; - } else -#endif - { - dclst = ld_clust(fs, dj.dir); - } - if (dj.obj.attr & AM_DIR) { /* Is it a sub-directory ? */ -#if _FS_RPATH != 0 - if (dclst == fs->cdir) { /* Is it the current directory? */ - res = FR_DENIED; - } else -#endif - { - sdj.obj.fs = fs; /* Open the sub-directory */ - sdj.obj.sclust = dclst; -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - sdj.obj.objsize = obj.objsize; - sdj.obj.stat = obj.stat; - } -#endif - res = dir_sdi(&sdj, 0); - if (res == FR_OK) { - res = dir_read(&sdj, 0); /* Read an item */ - if (res == FR_OK) res = FR_DENIED; /* Not empty? */ - if (res == FR_NO_FILE) res = FR_OK; /* Empty? */ - } - } - } - } - if (res == FR_OK) { - res = dir_remove(&dj); /* Remove the directory entry */ - if (res == FR_OK && dclst) { /* Remove the cluster chain if exist */ -#if _FS_EXFAT - res = remove_chain(&obj, dclst, 0); -#else - res = remove_chain(&dj.obj, dclst, 0); -#endif - } - if (res == FR_OK) res = sync_fs(fs); - } - } - FREE_NAMBUF(); - } - - LEAVE_FF(fs, res); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Create a Directory */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_mkdir ( - const TCHAR* path /* Pointer to the directory path */ -) -{ - FRESULT res; - DIR dj; - FATFS *fs; - BYTE *dir; - UINT n; - DWORD dsc, dcl, pcl, tm; - DEF_NAMBUF - - - /* Get logical drive */ - res = find_volume(&path, &fs, FA_WRITE); - dj.obj.fs = fs; - if (res == FR_OK) { - INIT_NAMBUF(fs); - res = follow_path(&dj, path); /* Follow the file path */ - if (res == FR_OK) res = FR_EXIST; /* Any object with same name is already existing */ - if (_FS_RPATH && res == FR_NO_FILE && (dj.fn[NSFLAG] & NS_DOT)) { - res = FR_INVALID_NAME; - } - if (res == FR_NO_FILE) { /* Can create a new directory */ - dcl = create_chain(&dj.obj, 0); /* Allocate a cluster for the new directory table */ - dj.obj.objsize = (DWORD)fs->csize * SS(fs); - res = FR_OK; - if (dcl == 0) res = FR_DENIED; /* No space to allocate a new cluster */ - if (dcl == 1) res = FR_INT_ERR; - if (dcl == 0xFFFFFFFF) res = FR_DISK_ERR; - if (res == FR_OK) res = sync_window(fs); /* Flush FAT */ - tm = GET_FATTIME(); - if (res == FR_OK) { /* Initialize the new directory table */ - dsc = clust2sect(fs, dcl); - dir = fs->win; - mem_set(dir, 0, SS(fs)); - if (!_FS_EXFAT || fs->fs_type != FS_EXFAT) { - mem_set(dir + DIR_Name, ' ', 11); /* Create "." entry */ - dir[DIR_Name] = '.'; - dir[DIR_Attr] = AM_DIR; - st_dword(dir + DIR_ModTime, tm); - st_clust(fs, dir, dcl); - mem_cpy(dir + SZDIRE, dir, SZDIRE); /* Create ".." entry */ - dir[SZDIRE + 1] = '.'; pcl = dj.obj.sclust; - if (fs->fs_type == FS_FAT32 && pcl == fs->dirbase) pcl = 0; - st_clust(fs, dir + SZDIRE, pcl); - } - for (n = fs->csize; n; n--) { /* Write dot entries and clear following sectors */ - fs->winsect = dsc++; - fs->wflag = 1; - res = sync_window(fs); - if (res != FR_OK) break; - mem_set(dir, 0, SS(fs)); - } - } - if (res == FR_OK) res = dir_register(&dj); /* Register the object to the directoy */ - if (res == FR_OK) { -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { /* Initialize directory entry block */ - st_dword(fs->dirbuf + XDIR_ModTime, tm); /* Created time */ - st_dword(fs->dirbuf + XDIR_FstClus, dcl); /* Table start cluster */ - st_dword(fs->dirbuf + XDIR_FileSize, (DWORD)dj.obj.objsize); /* File size needs to be valid */ - st_dword(fs->dirbuf + XDIR_ValidFileSize, (DWORD)dj.obj.objsize); - fs->dirbuf[XDIR_GenFlags] = 3; /* Initialize the object flag (contiguous) */ - fs->dirbuf[XDIR_Attr] = AM_DIR; /* Attribute */ - res = store_xdir(&dj); - } else -#endif - { - dir = dj.dir; - st_dword(dir + DIR_ModTime, tm); /* Created time */ - st_clust(fs, dir, dcl); /* Table start cluster */ - dir[DIR_Attr] = AM_DIR; /* Attribute */ - fs->wflag = 1; - } - if (res == FR_OK) res = sync_fs(fs); - } else { - remove_chain(&dj.obj, dcl, 0); /* Could not register, remove cluster chain */ - } - } - FREE_NAMBUF(); - } - - LEAVE_FF(fs, res); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Rename a File/Directory */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_rename ( - const TCHAR* path_old, /* Pointer to the object name to be renamed */ - const TCHAR* path_new /* Pointer to the new name */ -) -{ - FRESULT res; - DIR djo, djn; - FATFS *fs; - BYTE buf[_FS_EXFAT ? SZDIRE * 2 : 24], *dir; - DWORD dw; - DEF_NAMBUF - - - get_ldnumber(&path_new); /* Ignore drive number of new name */ - res = find_volume(&path_old, &fs, FA_WRITE); /* Get logical drive of the old object */ - if (res == FR_OK) { - djo.obj.fs = fs; - INIT_NAMBUF(fs); - res = follow_path(&djo, path_old); /* Check old object */ - if (res == FR_OK && (djo.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME; /* Check validity of name */ -#if _FS_LOCK != 0 - if (res == FR_OK) res = chk_lock(&djo, 2); -#endif - if (res == FR_OK) { /* Object to be renamed is found */ -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { /* At exFAT */ - BYTE nf, nn; - WORD nh; - - mem_cpy(buf, fs->dirbuf, SZDIRE * 2); /* Save 85+C0 entry of old object */ - mem_cpy(&djn, &djo, sizeof djo); - res = follow_path(&djn, path_new); /* Make sure if new object name is not in use */ - if (res == FR_OK) { /* Is new name already in use by any other object? */ - res = (djn.obj.sclust == djo.obj.sclust && djn.dptr == djo.dptr) ? FR_NO_FILE : FR_EXIST; - } - if (res == FR_NO_FILE) { /* It is a valid path and no name collision */ - res = dir_register(&djn); /* Register the new entry */ - if (res == FR_OK) { - nf = fs->dirbuf[XDIR_NumSec]; nn = fs->dirbuf[XDIR_NumName]; - nh = ld_word(fs->dirbuf + XDIR_NameHash); - mem_cpy(fs->dirbuf, buf, SZDIRE * 2); - fs->dirbuf[XDIR_NumSec] = nf; fs->dirbuf[XDIR_NumName] = nn; - st_word(fs->dirbuf + XDIR_NameHash, nh); -/* Start of critical section where any interruption can cause a cross-link */ - res = store_xdir(&djn); - } - } - } else -#endif - { /* At FAT12/FAT16/FAT32 */ - mem_cpy(buf, djo.dir + DIR_Attr, 21); /* Save information about the object except name */ - mem_cpy(&djn, &djo, sizeof (DIR)); /* Duplicate the directory object */ - res = follow_path(&djn, path_new); /* Make sure if new object name is not in use */ - if (res == FR_OK) { /* Is new name already in use by any other object? */ - res = (djn.obj.sclust == djo.obj.sclust && djn.dptr == djo.dptr) ? FR_NO_FILE : FR_EXIST; - } - if (res == FR_NO_FILE) { /* It is a valid path and no name collision */ - res = dir_register(&djn); /* Register the new entry */ - if (res == FR_OK) { - dir = djn.dir; /* Copy information about object except name */ - mem_cpy(dir + 13, buf + 2, 19); - dir[DIR_Attr] = buf[0] | AM_ARC; - fs->wflag = 1; - if ((dir[DIR_Attr] & AM_DIR) && djo.obj.sclust != djn.obj.sclust) { /* Update .. entry in the sub-directory if needed */ - dw = clust2sect(fs, ld_clust(fs, dir)); - if (!dw) { - res = FR_INT_ERR; - } else { -/* Start of critical section where any interruption can cause a cross-link */ - res = move_window(fs, dw); - dir = fs->win + SZDIRE * 1; /* Ptr to .. entry */ - if (res == FR_OK && dir[1] == '.') { - st_clust(fs, dir, djn.obj.sclust); - fs->wflag = 1; - } - } - } - } - } - } - if (res == FR_OK) { - res = dir_remove(&djo); /* Remove old entry */ - if (res == FR_OK) { - res = sync_fs(fs); - } - } -/* End of critical section */ - } - FREE_NAMBUF(); - } - - LEAVE_FF(fs, res); -} - -#endif /* !_FS_READONLY */ -#endif /* _FS_MINIMIZE == 0 */ -#endif /* _FS_MINIMIZE <= 1 */ -#endif /* _FS_MINIMIZE <= 2 */ - - - -#if _USE_CHMOD && !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* Change Attribute */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_chmod ( - const TCHAR* path, /* Pointer to the file path */ - BYTE attr, /* Attribute bits */ - BYTE mask /* Attribute mask to change */ -) -{ - FRESULT res; - DIR dj; - FATFS *fs; - DEF_NAMBUF - - - res = find_volume(&path, &fs, FA_WRITE); /* Get logical drive */ - dj.obj.fs = fs; - if (res == FR_OK) { - INIT_NAMBUF(fs); - res = follow_path(&dj, path); /* Follow the file path */ - if (res == FR_OK && (dj.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME; /* Check object validity */ - if (res == FR_OK) { - mask &= AM_RDO|AM_HID|AM_SYS|AM_ARC; /* Valid attribute mask */ -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - fs->dirbuf[XDIR_Attr] = (attr & mask) | (fs->dirbuf[XDIR_Attr] & (BYTE)~mask); /* Apply attribute change */ - res = store_xdir(&dj); - } else -#endif - { - dj.dir[DIR_Attr] = (attr & mask) | (dj.dir[DIR_Attr] & (BYTE)~mask); /* Apply attribute change */ - fs->wflag = 1; - } - if (res == FR_OK) res = sync_fs(fs); - } - FREE_NAMBUF(); - } - - LEAVE_FF(fs, res); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Change Timestamp */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_utime ( - const TCHAR* path, /* Pointer to the file/directory name */ - const FILINFO* fno /* Pointer to the time stamp to be set */ -) -{ - FRESULT res; - DIR dj; - FATFS *fs; - DEF_NAMBUF - - - res = find_volume(&path, &fs, FA_WRITE); /* Get logical drive */ - dj.obj.fs = fs; - if (res == FR_OK) { - INIT_NAMBUF(fs); - res = follow_path(&dj, path); /* Follow the file path */ - if (res == FR_OK && (dj.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME; /* Check object validity */ - if (res == FR_OK) { -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - st_dword(fs->dirbuf + XDIR_ModTime, (DWORD)fno->fdate << 16 | fno->ftime); - res = store_xdir(&dj); - } else -#endif - { - st_dword(dj.dir + DIR_ModTime, (DWORD)fno->fdate << 16 | fno->ftime); - fs->wflag = 1; - } - if (res == FR_OK) res = sync_fs(fs); - } - FREE_NAMBUF(); - } - - LEAVE_FF(fs, res); -} - -#endif /* _USE_CHMOD && !_FS_READONLY */ - - - -#if _USE_LABEL -/*-----------------------------------------------------------------------*/ -/* Get Volume Label */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_getlabel ( - const TCHAR* path, /* Path name of the logical drive number */ - TCHAR* label, /* Pointer to a buffer to return the volume label */ - DWORD* vsn /* Pointer to a variable to return the volume serial number */ -) -{ - FRESULT res; - DIR dj; - FATFS *fs; - UINT si, di; -#if _LFN_UNICODE || _FS_EXFAT - WCHAR w; -#endif - - /* Get logical drive */ - res = find_volume(&path, &fs, 0); - - /* Get volume label */ - if (res == FR_OK && label) { - dj.obj.fs = fs; dj.obj.sclust = 0; /* Open root directory */ - res = dir_sdi(&dj, 0); - if (res == FR_OK) { - res = dir_read(&dj, 1); /* Find a volume label entry */ - if (res == FR_OK) { -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - for (si = di = 0; si < dj.dir[XDIR_NumLabel]; si++) { /* Extract volume label from 83 entry */ - w = ld_word(dj.dir + XDIR_Label + si * 2); -#if _LFN_UNICODE - label[di++] = w; -#else - w = ff_convert(w, 0); /* Unicode -> OEM */ - if (w == 0) w = '?'; /* Replace wrong character */ - if (_DF1S && w >= 0x100) label[di++] = (char)(w >> 8); - label[di++] = (char)w; -#endif - } - label[di] = 0; - } else -#endif - { - si = di = 0; /* Extract volume label from AM_VOL entry with code comversion */ - do { -#if _LFN_UNICODE - w = (si < 11) ? dj.dir[si++] : ' '; - if (IsDBCS1(w) && si < 11 && IsDBCS2(dj.dir[si])) { - w = w << 8 | dj.dir[si++]; - } - label[di++] = ff_convert(w, 1); /* OEM -> Unicode */ -#else - label[di++] = dj.dir[si++]; -#endif - } while (di < 11); - do { /* Truncate trailing spaces */ - label[di] = 0; - if (di == 0) break; - } while (label[--di] == ' '); - } - } - } - if (res == FR_NO_FILE) { /* No label entry and return nul string */ - label[0] = 0; - res = FR_OK; - } - } - - /* Get volume serial number */ - if (res == FR_OK && vsn) { - res = move_window(fs, fs->volbase); - if (res == FR_OK) { - switch (fs->fs_type) { - case FS_EXFAT: di = BPB_VolIDEx; break; - case FS_FAT32: di = BS_VolID32; break; - default: di = BS_VolID; - } - *vsn = ld_dword(fs->win + di); - } - } - - LEAVE_FF(fs, res); -} - - - -#if !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* Set Volume Label */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_setlabel ( - const TCHAR* label /* Pointer to the volume label to set */ -) -{ - FRESULT res; - DIR dj; - FATFS *fs; - BYTE dirvn[22]; - UINT i, j, slen; - WCHAR w; - static const char badchr[] = "\"*+,.:;<=>\?[]|\x7F"; - - - /* Get logical drive */ - res = find_volume(&label, &fs, FA_WRITE); - if (res != FR_OK) LEAVE_FF(fs, res); - dj.obj.fs = fs; - - /* Get length of given volume label */ - for (slen = 0; (UINT)label[slen] >= ' '; slen++) ; /* Get name length */ - -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { /* On the exFAT volume */ - for (i = j = 0; i < slen; ) { /* Create volume label in directory form */ - w = label[i++]; -#if !_LFN_UNICODE - if (IsDBCS1(w)) { - w = (i < slen && IsDBCS2(label[i])) ? w << 8 | (BYTE)label[i++] : 0; - } - w = ff_convert(w, 1); -#endif - if (w == 0 || chk_chr(badchr, w) || j == 22) { /* Check validity check validity of the volume label */ - LEAVE_FF(fs, FR_INVALID_NAME); - } - st_word(dirvn + j, w); j += 2; - } - slen = j; - } else -#endif - { /* On the FAT12/16/32 volume */ - for ( ; slen && label[slen - 1] == ' '; slen--) ; /* Remove trailing spaces */ - if (slen) { /* Is there a volume label to be set? */ - dirvn[0] = 0; i = j = 0; /* Create volume label in directory form */ - do { -#if _LFN_UNICODE - w = ff_convert(ff_wtoupper(label[i++]), 0); -#else - w = (BYTE)label[i++]; - if (IsDBCS1(w)) { - w = (j < 10 && i < slen && IsDBCS2(label[i])) ? w << 8 | (BYTE)label[i++] : 0; - } -#if _USE_LFN != 0 - w = ff_convert(ff_wtoupper(ff_convert(w, 1)), 0); -#else - if (IsLower(w)) w -= 0x20; /* To upper ASCII characters */ -#ifdef _EXCVT - if (w >= 0x80) w = ExCvt[w - 0x80]; /* To upper extended characters (SBCS cfg) */ -#else - if (!_DF1S && w >= 0x80) w = 0; /* Reject extended characters (ASCII cfg) */ -#endif -#endif -#endif - if (w == 0 || chk_chr(badchr, w) || j >= (UINT)((w >= 0x100) ? 10 : 11)) { /* Reject invalid characters for volume label */ - LEAVE_FF(fs, FR_INVALID_NAME); - } - if (w >= 0x100) dirvn[j++] = (BYTE)(w >> 8); - dirvn[j++] = (BYTE)w; - } while (i < slen); - while (j < 11) dirvn[j++] = ' '; /* Fill remaining name field */ - if (dirvn[0] == DDEM) LEAVE_FF(fs, FR_INVALID_NAME); /* Reject illegal name (heading DDEM) */ - } - } - - /* Set volume label */ - dj.obj.sclust = 0; /* Open root directory */ - res = dir_sdi(&dj, 0); - if (res == FR_OK) { - res = dir_read(&dj, 1); /* Get volume label entry */ - if (res == FR_OK) { - if (_FS_EXFAT && fs->fs_type == FS_EXFAT) { - dj.dir[XDIR_NumLabel] = (BYTE)(slen / 2); /* Change the volume label */ - mem_cpy(dj.dir + XDIR_Label, dirvn, slen); - } else { - if (slen) { - mem_cpy(dj.dir, dirvn, 11); /* Change the volume label */ - } else { - dj.dir[DIR_Name] = DDEM; /* Remove the volume label */ - } - } - fs->wflag = 1; - res = sync_fs(fs); - } else { /* No volume label entry is found or error */ - if (res == FR_NO_FILE) { - res = FR_OK; - if (slen) { /* Create a volume label entry */ - res = dir_alloc(&dj, 1); /* Allocate an entry */ - if (res == FR_OK) { - mem_set(dj.dir, 0, SZDIRE); /* Clear the entry */ - if (_FS_EXFAT && fs->fs_type == FS_EXFAT) { - dj.dir[XDIR_Type] = 0x83; /* Create 83 entry */ - dj.dir[XDIR_NumLabel] = (BYTE)(slen / 2); - mem_cpy(dj.dir + XDIR_Label, dirvn, slen); - } else { - dj.dir[DIR_Attr] = AM_VOL; /* Create volume label entry */ - mem_cpy(dj.dir, dirvn, 11); - } - fs->wflag = 1; - res = sync_fs(fs); - } - } - } - } - } - - LEAVE_FF(fs, res); -} - -#endif /* !_FS_READONLY */ -#endif /* _USE_LABEL */ - - - -#if _USE_EXPAND && !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* Allocate a Contiguous Blocks to the File */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_expand ( - FIL* fp, /* Pointer to the file object */ - FSIZE_t fsz, /* File size to be expanded to */ - BYTE opt /* Operation mode 0:Find and prepare or 1:Find and allocate */ -) -{ - FRESULT res; - FATFS *fs; - DWORD n, clst, stcl, scl, ncl, tcl, lclst; - - - res = validate(&fp->obj, &fs); /* Check validity of the file object */ - if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); - if (fsz == 0 || fp->obj.objsize != 0 || !(fp->flag & FA_WRITE)) LEAVE_FF(fs, FR_DENIED); -#if _FS_EXFAT - if (fs->fs_type != FS_EXFAT && fsz >= 0x100000000) LEAVE_FF(fs, FR_DENIED); /* Check if in size limit */ -#endif - n = (DWORD)fs->csize * SS(fs); /* Cluster size */ - tcl = (DWORD)(fsz / n) + ((fsz & (n - 1)) ? 1 : 0); /* Number of clusters required */ - stcl = fs->last_clst; lclst = 0; - if (stcl < 2 || stcl >= fs->n_fatent) stcl = 2; - -#if _FS_EXFAT - if (fs->fs_type == FS_EXFAT) { - scl = find_bitmap(fs, stcl, tcl); /* Find a contiguous cluster block */ - if (scl == 0) res = FR_DENIED; /* No contiguous cluster block was found */ - if (scl == 0xFFFFFFFF) res = FR_DISK_ERR; - if (res == FR_OK) { - if (opt) { - res = change_bitmap(fs, scl, tcl, 1); /* Mark the cluster block 'in use' */ - lclst = scl + tcl - 1; - } else { - lclst = scl - 1; - } - } - } else -#endif - { - scl = clst = stcl; ncl = 0; - for (;;) { /* Find a contiguous cluster block */ - n = get_fat(&fp->obj, clst); - if (++clst >= fs->n_fatent) clst = 2; - if (n == 1) { res = FR_INT_ERR; break; } - if (n == 0xFFFFFFFF) { res = FR_DISK_ERR; break; } - if (n == 0) { /* Is it a free cluster? */ - if (++ncl == tcl) break; /* Break if a contiguous cluster block is found */ - } else { - scl = clst; ncl = 0; /* Not a free cluster */ - } - if (clst == stcl) { res = FR_DENIED; break; } /* No contiguous cluster? */ - } - if (res == FR_OK) { - if (opt) { - for (clst = scl, n = tcl; n; clst++, n--) { /* Create a cluster chain on the FAT */ - res = put_fat(fs, clst, (n == 1) ? 0xFFFFFFFF : clst + 1); - if (res != FR_OK) break; - lclst = clst; - } - } else { - lclst = scl - 1; - } - } - } - - if (res == FR_OK) { - fs->last_clst = lclst; /* Set suggested start cluster to start next */ - if (opt) { - fp->obj.sclust = scl; /* Update object allocation information */ - fp->obj.objsize = fsz; - if (_FS_EXFAT) fp->obj.stat = 2; /* Set status 'contiguous chain' */ - fp->flag |= FA_MODIFIED; - if (fs->free_clst < fs->n_fatent - 2) { /* Update FSINFO */ - fs->free_clst -= tcl; - fs->fsi_flag |= 1; - } - } - } - - LEAVE_FF(fs, res); -} - -#endif /* _USE_EXPAND && !_FS_READONLY */ - - - -#if _USE_FORWARD -/*-----------------------------------------------------------------------*/ -/* Forward data to the stream directly */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_forward ( - FIL* fp, /* Pointer to the file object */ - UINT (*func)(const BYTE*,UINT), /* Pointer to the streaming function */ - UINT btf, /* Number of bytes to forward */ - UINT* bf /* Pointer to number of bytes forwarded */ -) -{ - FRESULT res; - FATFS *fs; - DWORD clst, sect; - FSIZE_t remain; - UINT rcnt, csect; - BYTE *dbuf; - - - *bf = 0; /* Clear transfer byte counter */ - res = validate(&fp->obj, &fs); /* Check validity of the file object */ - if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); - if (!(fp->flag & FA_READ)) LEAVE_FF(fs, FR_DENIED); /* Check access mode */ - - remain = fp->obj.objsize - fp->fptr; - if (btf > remain) btf = (UINT)remain; /* Truncate btf by remaining bytes */ - - for ( ; btf && (*func)(0, 0); /* Repeat until all data transferred or stream goes busy */ - fp->fptr += rcnt, *bf += rcnt, btf -= rcnt) { - csect = (UINT)(fp->fptr / SS(fs) & (fs->csize - 1)); /* Sector offset in the cluster */ - if (fp->fptr % SS(fs) == 0) { /* On the sector boundary? */ - if (csect == 0) { /* On the cluster boundary? */ - clst = (fp->fptr == 0) ? /* On the top of the file? */ - fp->obj.sclust : get_fat(&fp->obj, fp->clust); - if (clst <= 1) ABORT(fs, FR_INT_ERR); - if (clst == 0xFFFFFFFF) ABORT(fs, FR_DISK_ERR); - fp->clust = clst; /* Update current cluster */ - } - } - sect = clust2sect(fs, fp->clust); /* Get current data sector */ - if (!sect) ABORT(fs, FR_INT_ERR); - sect += csect; -#if _FS_TINY - if (move_window(fs, sect) != FR_OK) ABORT(fs, FR_DISK_ERR); /* Move sector window to the file data */ - dbuf = fs->win; -#else - if (fp->sect != sect) { /* Fill sector cache with file data */ -#if !_FS_READONLY - if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */ - if (disk_write(fs->drv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); - fp->flag &= (BYTE)~FA_DIRTY; - } -#endif - if (disk_read(fs->drv, fp->buf, sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); - } - dbuf = fp->buf; -#endif - fp->sect = sect; - rcnt = SS(fs) - (UINT)fp->fptr % SS(fs); /* Number of bytes left in the sector */ - if (rcnt > btf) rcnt = btf; /* Clip it by btr if needed */ - rcnt = (*func)(dbuf + ((UINT)fp->fptr % SS(fs)), rcnt); /* Forward the file data */ - if (!rcnt) ABORT(fs, FR_INT_ERR); - } - - LEAVE_FF(fs, FR_OK); -} -#endif /* _USE_FORWARD */ - - - -#if _USE_MKFS && !_FS_READONLY -/*-----------------------------------------------------------------------*/ -/* Create FAT file system on the logical drive */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_mkfs ( - const TCHAR* path, /* Logical drive number */ - BYTE opt, /* Format option */ - DWORD au, /* Size of allocation unit [byte] */ - void* work, /* Pointer to working buffer */ - UINT len /* Size of working buffer */ -) -{ - const UINT n_fats = 1; /* Number of FATs for FAT12/16/32 volume (1 or 2) */ - const UINT n_rootdir = 512; /* Number of root directory entries for FAT12/16 volume */ - static const WORD cst[] = {1, 4, 16, 64, 256, 512, 0}; /* Cluster size boundary for FAT12/16 volume (4Ks unit) */ - static const WORD cst32[] = {1, 2, 4, 8, 16, 32, 0}; /* Cluster size boundary for FAT32 volume (128Ks unit) */ - BYTE fmt, sys, *buf, *pte, pdrv, part; - WORD ss; - DWORD szb_buf, sz_buf, sz_blk, n_clst, pau, sect, nsect, n; - DWORD b_vol, b_fat, b_data; /* Base LBA for volume, fat, data */ - DWORD sz_vol, sz_rsv, sz_fat, sz_dir; /* Size for volume, fat, dir, data */ - UINT i; - int vol; - DSTATUS stat; -#if _USE_TRIM || _FS_EXFAT - DWORD tbl[3]; -#endif - - - /* Check mounted drive and clear work area */ - vol = get_ldnumber(&path); /* Get target logical drive */ - if (vol < 0) return FR_INVALID_DRIVE; - if (FatFs[vol]) FatFs[vol]->fs_type = 0; /* Clear mounted volume */ - pdrv = LD2PD(vol); /* Physical drive */ - part = LD2PT(vol); /* Partition (0:create as new, 1-4:get from partition table) */ - - /* Check physical drive status */ - stat = disk_initialize(pdrv); - if (stat & STA_NOINIT) return FR_NOT_READY; - if (stat & STA_PROTECT) return FR_WRITE_PROTECTED; - if (disk_ioctl(pdrv, GET_BLOCK_SIZE, &sz_blk) != RES_OK || !sz_blk || sz_blk > 32768 || (sz_blk & (sz_blk - 1))) sz_blk = 1; /* Erase block to align data area */ -#if _MAX_SS != _MIN_SS /* Get sector size of the medium */ - if (disk_ioctl(pdrv, GET_SECTOR_SIZE, &ss) != RES_OK) return FR_DISK_ERR; - if (ss > _MAX_SS || ss < _MIN_SS || (ss & (ss - 1))) return FR_DISK_ERR; -#else - ss = _MAX_SS; -#endif - if ((au != 0 && au < ss) || au > 0x1000000 || (au & (au - 1))) return FR_INVALID_PARAMETER; /* Check if au is valid */ - au /= ss; /* Cluster size in unit of sector */ - - /* Get working buffer */ - buf = (BYTE*)work; /* Working buffer */ - sz_buf = len / ss; /* Size of working buffer (sector) */ - szb_buf = sz_buf * ss; /* Size of working buffer (byte) */ - if (!szb_buf) return FR_MKFS_ABORTED; - - /* Determine where the volume to be located (b_vol, sz_vol) */ - if (_MULTI_PARTITION && part != 0) { - /* Get partition information from partition table in the MBR */ - if (disk_read(pdrv, buf, 0, 1) != RES_OK) return FR_DISK_ERR; /* Load MBR */ - if (ld_word(buf + BS_55AA) != 0xAA55) return FR_MKFS_ABORTED; /* Check if MBR is valid */ - pte = buf + (MBR_Table + (part - 1) * SZ_PTE); - if (!pte[PTE_System]) return FR_MKFS_ABORTED; /* No partition? */ - b_vol = ld_dword(pte + PTE_StLba); /* Get volume start sector */ - sz_vol = ld_dword(pte + PTE_SizLba); /* Get volume size */ - } else { - /* Create a single-partition in this function */ - if (disk_ioctl(pdrv, GET_SECTOR_COUNT, &sz_vol) != RES_OK) return FR_DISK_ERR; - b_vol = (opt & FM_SFD) ? 0 : 63; /* Volume start sector */ - if (sz_vol < b_vol) return FR_MKFS_ABORTED; - sz_vol -= b_vol; /* Volume size */ - } - if (sz_vol < 128) return FR_MKFS_ABORTED; /* Check if volume size is >=128s */ - - /* Pre-determine the FAT type */ - do { - if (_FS_EXFAT && (opt & FM_EXFAT)) { /* exFAT possible? */ - if ((opt & FM_ANY) == FM_EXFAT || sz_vol >= 0x4000000 || au > 128) { /* exFAT only, vol >= 64Ms or au > 128s ? */ - fmt = FS_EXFAT; break; - } - } - if (au > 128) return FR_INVALID_PARAMETER; /* Too large au for FAT/FAT32 */ - if (opt & FM_FAT32) { /* FAT32 possible? */ - if ((opt & FM_ANY) == FM_FAT32 || !(opt & FM_FAT)) { /* FAT32 only or no-FAT? */ - fmt = FS_FAT32; break; - } - } - if (!(opt & FM_FAT)) return FR_INVALID_PARAMETER; /* no-FAT? */ - fmt = FS_FAT16; - } while (0); - -#if _FS_EXFAT - if (fmt == FS_EXFAT) { /* Create an exFAT volume */ - DWORD szb_bit, szb_case, sum, nb, cl; - WCHAR ch, si; - UINT j, st; - BYTE b; - - if (sz_vol < 0x1000) return FR_MKFS_ABORTED; /* Too small volume? */ -#if _USE_TRIM - tbl[0] = b_vol; tbl[1] = b_vol + sz_vol - 1; /* Inform the device the volume area can be erased */ - disk_ioctl(pdrv, CTRL_TRIM, tbl); -#endif - /* Determine FAT location, data location and number of clusters */ - if (!au) { /* au auto-selection */ - au = 8; - if (sz_vol >= 0x80000) au = 64; /* >= 512Ks */ - if (sz_vol >= 0x4000000) au = 256; /* >= 64Ms */ - } - b_fat = b_vol + 32; /* FAT start at offset 32 */ - sz_fat = ((sz_vol / au + 2) * 4 + ss - 1) / ss; /* Number of FAT sectors */ - b_data = (b_fat + sz_fat + sz_blk - 1) & ~(sz_blk - 1); /* Align data area to the erase block boundary */ - if (b_data >= sz_vol / 2) return FR_MKFS_ABORTED; /* Too small volume? */ - n_clst = (sz_vol - (b_data - b_vol)) / au; /* Number of clusters */ - if (n_clst <16) return FR_MKFS_ABORTED; /* Too few clusters? */ - if (n_clst > MAX_EXFAT) return FR_MKFS_ABORTED; /* Too many clusters? */ - - szb_bit = (n_clst + 7) / 8; /* Size of allocation bitmap */ - tbl[0] = (szb_bit + au * ss - 1) / (au * ss); /* Number of allocation bitmap clusters */ - - /* Create a compressed up-case table */ - sect = b_data + au * tbl[0]; /* Table start sector */ - sum = 0; /* Table checksum to be stored in the 82 entry */ - st = si = i = j = szb_case = 0; - do { - switch (st) { - case 0: - ch = ff_wtoupper(si); /* Get an up-case char */ - if (ch != si) { - si++; break; /* Store the up-case char if exist */ - } - for (j = 1; (WCHAR)(si + j) && (WCHAR)(si + j) == ff_wtoupper((WCHAR)(si + j)); j++) ; /* Get run length of no-case block */ - if (j >= 128) { - ch = 0xFFFF; st = 2; break; /* Compress the no-case block if run is >= 128 */ - } - st = 1; /* Do not compress short run */ - /* continue */ - case 1: - ch = si++; /* Fill the short run */ - if (--j == 0) st = 0; - break; - default: - ch = (WCHAR)j; si += j; /* Number of chars to skip */ - st = 0; - } - sum = xsum32(buf[i + 0] = (BYTE)ch, sum); /* Put it into the write buffer */ - sum = xsum32(buf[i + 1] = (BYTE)(ch >> 8), sum); - i += 2; szb_case += 2; - if (!si || i == szb_buf) { /* Write buffered data when buffer full or end of process */ - n = (i + ss - 1) / ss; - if (disk_write(pdrv, buf, sect, n) != RES_OK) return FR_DISK_ERR; - sect += n; i = 0; - } - } while (si); - tbl[1] = (szb_case + au * ss - 1) / (au * ss); /* Number of up-case table clusters */ - tbl[2] = 1; /* Number of root dir clusters */ - - /* Initialize the allocation bitmap */ - sect = b_data; nsect = (szb_bit + ss - 1) / ss; /* Start of bitmap and number of sectors */ - nb = tbl[0] + tbl[1] + tbl[2]; /* Number of clusters in-use by system */ - do { - mem_set(buf, 0, szb_buf); - for (i = 0; nb >= 8 && i < szb_buf; buf[i++] = 0xFF, nb -= 8) ; - for (b = 1; nb && i < szb_buf; buf[i] |= b, b <<= 1, nb--) ; - n = (nsect > sz_buf) ? sz_buf : nsect; /* Write the buffered data */ - if (disk_write(pdrv, buf, sect, n) != RES_OK) return FR_DISK_ERR; - sect += n; nsect -= n; - } while (nsect); - - /* Initialize the FAT */ - sect = b_fat; nsect = sz_fat; /* Start of FAT and number of FAT sectors */ - j = nb = cl = 0; - do { - mem_set(buf, 0, szb_buf); i = 0; /* Clear work area and reset write index */ - if (cl == 0) { /* Set entry 0 and 1 */ - st_dword(buf + i, 0xFFFFFFF8); i += 4; cl++; - st_dword(buf + i, 0xFFFFFFFF); i += 4; cl++; - } - do { /* Create chains of bitmap, up-case and root dir */ - while (nb && i < szb_buf) { /* Create a chain */ - st_dword(buf + i, (nb > 1) ? cl + 1 : 0xFFFFFFFF); - i += 4; cl++; nb--; - } - if (!nb && j < 3) nb = tbl[j++]; /* Next chain */ - } while (nb && i < szb_buf); - n = (nsect > sz_buf) ? sz_buf : nsect; /* Write the buffered data */ - if (disk_write(pdrv, buf, sect, n) != RES_OK) return FR_DISK_ERR; - sect += n; nsect -= n; - } while (nsect); - - /* Initialize the root directory */ - mem_set(buf, 0, szb_buf); - buf[SZDIRE * 0 + 0] = 0x83; /* 83 entry (volume label) */ - buf[SZDIRE * 1 + 0] = 0x81; /* 81 entry (allocation bitmap) */ - st_dword(buf + SZDIRE * 1 + 20, 2); - st_dword(buf + SZDIRE * 1 + 24, szb_bit); - buf[SZDIRE * 2 + 0] = 0x82; /* 82 entry (up-case table) */ - st_dword(buf + SZDIRE * 2 + 4, sum); - st_dword(buf + SZDIRE * 2 + 20, 2 + tbl[0]); - st_dword(buf + SZDIRE * 2 + 24, szb_case); - sect = b_data + au * (tbl[0] + tbl[1]); nsect = au; /* Start of the root directory and number of sectors */ - do { /* Fill root directory sectors */ - n = (nsect > sz_buf) ? sz_buf : nsect; - if (disk_write(pdrv, buf, sect, n) != RES_OK) return FR_DISK_ERR; - mem_set(buf, 0, ss); - sect += n; nsect -= n; - } while (nsect); - - /* Create two set of the exFAT VBR blocks */ - sect = b_vol; - for (n = 0; n < 2; n++) { - /* Main record (+0) */ - mem_set(buf, 0, ss); - mem_cpy(buf + BS_JmpBoot, "\xEB\x76\x90" "EXFAT ", 11); /* Boot jump code (x86), OEM name */ - st_dword(buf + BPB_VolOfsEx, b_vol); /* Volume offset in the physical drive [sector] */ - st_dword(buf + BPB_TotSecEx, sz_vol); /* Volume size [sector] */ - st_dword(buf + BPB_FatOfsEx, b_fat - b_vol); /* FAT offset [sector] */ - st_dword(buf + BPB_FatSzEx, sz_fat); /* FAT size [sector] */ - st_dword(buf + BPB_DataOfsEx, b_data - b_vol); /* Data offset [sector] */ - st_dword(buf + BPB_NumClusEx, n_clst); /* Number of clusters */ - st_dword(buf + BPB_RootClusEx, 2 + tbl[0] + tbl[1]); /* Root dir cluster # */ - st_dword(buf + BPB_VolIDEx, GET_FATTIME()); /* VSN */ - st_word(buf + BPB_FSVerEx, 0x100); /* File system version (1.00) */ - for (buf[BPB_BytsPerSecEx] = 0, i = ss; i >>= 1; buf[BPB_BytsPerSecEx]++) ; /* Log2 of sector size [byte] */ - for (buf[BPB_SecPerClusEx] = 0, i = au; i >>= 1; buf[BPB_SecPerClusEx]++) ; /* Log2 of cluster size [sector] */ - buf[BPB_NumFATsEx] = 1; /* Number of FATs */ - buf[BPB_DrvNumEx] = 0x80; /* Drive number (for int13) */ - st_word(buf + BS_BootCodeEx, 0xFEEB); /* Boot code (x86) */ - st_word(buf + BS_55AA, 0xAA55); /* Signature (placed here regardless of sector size) */ - for (i = sum = 0; i < ss; i++) { /* VBR checksum */ - if (i != BPB_VolFlagEx && i != BPB_VolFlagEx + 1 && i != BPB_PercInUseEx) sum = xsum32(buf[i], sum); - } - if (disk_write(pdrv, buf, sect++, 1) != RES_OK) return FR_DISK_ERR; - /* Extended bootstrap record (+1..+8) */ - mem_set(buf, 0, ss); - st_word(buf + ss - 2, 0xAA55); /* Signature (placed at end of sector) */ - for (j = 1; j < 9; j++) { - for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) ; /* VBR checksum */ - if (disk_write(pdrv, buf, sect++, 1) != RES_OK) return FR_DISK_ERR; - } - /* OEM/Reserved record (+9..+10) */ - mem_set(buf, 0, ss); - for ( ; j < 11; j++) { - for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) ; /* VBR checksum */ - if (disk_write(pdrv, buf, sect++, 1) != RES_OK) return FR_DISK_ERR; - } - /* Sum record (+11) */ - for (i = 0; i < ss; i += 4) st_dword(buf + i, sum); /* Fill with checksum value */ - if (disk_write(pdrv, buf, sect++, 1) != RES_OK) return FR_DISK_ERR; - } - - } else -#endif /* _FS_EXFAT */ - { /* Create an FAT12/16/32 volume */ - do { - pau = au; - /* Pre-determine number of clusters and FAT sub-type */ - if (fmt == FS_FAT32) { /* FAT32 volume */ - if (!pau) { /* au auto-selection */ - n = sz_vol / 0x20000; /* Volume size in unit of 128KS */ - for (i = 0, pau = 1; cst32[i] && cst32[i] <= n; i++, pau <<= 1) ; /* Get from table */ - } - n_clst = sz_vol / pau; /* Number of clusters */ - sz_fat = (n_clst * 4 + 8 + ss - 1) / ss; /* FAT size [sector] */ - sz_rsv = 32; /* Number of reserved sectors */ - sz_dir = 0; /* No static directory */ - if (n_clst <= MAX_FAT16 || n_clst > MAX_FAT32) return FR_MKFS_ABORTED; - } else { /* FAT12/16 volume */ - if (!pau) { /* au auto-selection */ - n = sz_vol / 0x1000; /* Volume size in unit of 4KS */ - for (i = 0, pau = 1; cst[i] && cst[i] <= n; i++, pau <<= 1) ; /* Get from table */ - } - n_clst = sz_vol / pau; - if (n_clst > MAX_FAT12) { - n = n_clst * 2 + 4; /* FAT size [byte] */ - } else { - fmt = FS_FAT12; - n = (n_clst * 3 + 1) / 2 + 3; /* FAT size [byte] */ - } - sz_fat = (n + ss - 1) / ss; /* FAT size [sector] */ - sz_rsv = 1; /* Number of reserved sectors */ - sz_dir = (DWORD)n_rootdir * SZDIRE / ss; /* Rootdir size [sector] */ - } - b_fat = b_vol + sz_rsv; /* FAT base */ - b_data = b_fat + sz_fat * n_fats + sz_dir; /* Data base */ - - /* Align data base to erase block boundary (for flash memory media) */ - n = ((b_data + sz_blk - 1) & ~(sz_blk - 1)) - b_data; /* Next nearest erase block from current data base */ - if (fmt == FS_FAT32) { /* FAT32: Move FAT base */ - sz_rsv += n; b_fat += n; - } else { /* FAT12/16: Expand FAT size */ - sz_fat += n / n_fats; - } - - /* Determine number of clusters and final check of validity of the FAT sub-type */ - if (sz_vol < b_data + pau * 16 - b_vol) return FR_MKFS_ABORTED; /* Too small volume */ - n_clst = (sz_vol - sz_rsv - sz_fat * n_fats - sz_dir) / pau; - if (fmt == FS_FAT32) { - if (n_clst <= MAX_FAT16) { /* Too few clusters for FAT32 */ - if (!au && (au = pau / 2) != 0) continue; /* Adjust cluster size and retry */ - return FR_MKFS_ABORTED; - } - } - if (fmt == FS_FAT16) { - if (n_clst > MAX_FAT16) { /* Too many clusters for FAT16 */ - if (!au && (pau * 2) <= 64) { - au = pau * 2; continue; /* Adjust cluster size and retry */ - } - if ((opt & FM_FAT32)) { - fmt = FS_FAT32; continue; /* Switch type to FAT32 and retry */ - } - if (!au && (au = pau * 2) <= 128) continue; /* Adjust cluster size and retry */ - return FR_MKFS_ABORTED; - } - if (n_clst <= MAX_FAT12) { /* Too few clusters for FAT16 */ - if (!au && (au = pau * 2) <= 128) continue; /* Adjust cluster size and retry */ - return FR_MKFS_ABORTED; - } - } - if (fmt == FS_FAT12 && n_clst > MAX_FAT12) return FR_MKFS_ABORTED; /* Too many clusters for FAT12 */ - - /* Ok, it is the valid cluster configuration */ - break; - } while (1); - -#if _USE_TRIM - tbl[0] = b_vol; tbl[1] = b_vol + sz_vol - 1; /* Inform the device the volume area can be erased */ - disk_ioctl(pdrv, CTRL_TRIM, tbl); -#endif - /* Create FAT VBR */ - mem_set(buf, 0, ss); - mem_cpy(buf + BS_JmpBoot, "\xEB\xFE\x90" "MSDOS5.0", 11);/* Boot jump code (x86), OEM name */ - st_word(buf + BPB_BytsPerSec, ss); /* Sector size [byte] */ - buf[BPB_SecPerClus] = (BYTE)pau; /* Cluster size [sector] */ - st_word(buf + BPB_RsvdSecCnt, (WORD)sz_rsv); /* Size of reserved area */ - buf[BPB_NumFATs] = (BYTE)n_fats; /* Number of FATs */ - st_word(buf + BPB_RootEntCnt, (WORD)((fmt == FS_FAT32) ? 0 : n_rootdir)); /* Number of root directory entries */ - if (sz_vol < 0x10000) { - st_word(buf + BPB_TotSec16, (WORD)sz_vol); /* Volume size in 16-bit LBA */ - } else { - st_dword(buf + BPB_TotSec32, sz_vol); /* Volume size in 32-bit LBA */ - } - buf[BPB_Media] = 0xF8; /* Media descriptor byte */ - st_word(buf + BPB_SecPerTrk, 63); /* Number of sectors per track (for int13) */ - st_word(buf + BPB_NumHeads, 255); /* Number of heads (for int13) */ - st_dword(buf + BPB_HiddSec, b_vol); /* Volume offset in the physical drive [sector] */ - if (fmt == FS_FAT32) { - st_dword(buf + BS_VolID32, GET_FATTIME()); /* VSN */ - st_dword(buf + BPB_FATSz32, sz_fat); /* FAT size [sector] */ - st_dword(buf + BPB_RootClus32, 2); /* Root directory cluster # (2) */ - st_word(buf + BPB_FSInfo32, 1); /* Offset of FSINFO sector (VBR + 1) */ - st_word(buf + BPB_BkBootSec32, 6); /* Offset of backup VBR (VBR + 6) */ - buf[BS_DrvNum32] = 0x80; /* Drive number (for int13) */ - buf[BS_BootSig32] = 0x29; /* Extended boot signature */ - mem_cpy(buf + BS_VolLab32, "NO NAME " "FAT32 ", 19); /* Volume label, FAT signature */ - } else { - st_dword(buf + BS_VolID, GET_FATTIME()); /* VSN */ - st_word(buf + BPB_FATSz16, (WORD)sz_fat); /* FAT size [sector] */ - buf[BS_DrvNum] = 0x80; /* Drive number (for int13) */ - buf[BS_BootSig] = 0x29; /* Extended boot signature */ - mem_cpy(buf + BS_VolLab, "NO NAME " "FAT ", 19); /* Volume label, FAT signature */ - } - st_word(buf + BS_55AA, 0xAA55); /* Signature (offset is fixed here regardless of sector size) */ - if (disk_write(pdrv, buf, b_vol, 1) != RES_OK) return FR_DISK_ERR; /* Write it to the VBR sector */ - - /* Create FSINFO record if needed */ - if (fmt == FS_FAT32) { - disk_write(pdrv, buf, b_vol + 6, 1); /* Write backup VBR (VBR + 6) */ - mem_set(buf, 0, ss); - st_dword(buf + FSI_LeadSig, 0x41615252); - st_dword(buf + FSI_StrucSig, 0x61417272); - st_dword(buf + FSI_Free_Count, n_clst - 1); /* Number of free clusters */ - st_dword(buf + FSI_Nxt_Free, 2); /* Last allocated cluster# */ - st_word(buf + BS_55AA, 0xAA55); - disk_write(pdrv, buf, b_vol + 7, 1); /* Write backup FSINFO (VBR + 7) */ - disk_write(pdrv, buf, b_vol + 1, 1); /* Write original FSINFO (VBR + 1) */ - } - - /* Initialize FAT area */ - mem_set(buf, 0, (UINT)szb_buf); - sect = b_fat; /* FAT start sector */ - for (i = 0; i < n_fats; i++) { /* Initialize FATs each */ - if (fmt == FS_FAT32) { - st_dword(buf + 0, 0xFFFFFFF8); /* Entry 0 */ - st_dword(buf + 4, 0xFFFFFFFF); /* Entry 1 */ - st_dword(buf + 8, 0x0FFFFFFF); /* Entry 2 (root directory) */ - } else { - st_dword(buf + 0, (fmt == FS_FAT12) ? 0xFFFFF8 : 0xFFFFFFF8); /* Entry 0 and 1 */ - } - nsect = sz_fat; /* Number of FAT sectors */ - do { /* Fill FAT sectors */ - n = (nsect > sz_buf) ? sz_buf : nsect; - if (disk_write(pdrv, buf, sect, (UINT)n) != RES_OK) return FR_DISK_ERR; - mem_set(buf, 0, ss); - sect += n; nsect -= n; - } while (nsect); - } - - /* Initialize root directory (fill with zero) */ - nsect = (fmt == FS_FAT32) ? pau : sz_dir; /* Number of root directory sectors */ - do { - n = (nsect > sz_buf) ? sz_buf : nsect; - if (disk_write(pdrv, buf, sect, (UINT)n) != RES_OK) return FR_DISK_ERR; - sect += n; nsect -= n; - } while (nsect); - } - - /* Determine system ID in the partition table */ - if (_FS_EXFAT && fmt == FS_EXFAT) { - sys = 0x07; /* HPFS/NTFS/exFAT */ - } else { - if (fmt == FS_FAT32) { - sys = 0x0C; /* FAT32X */ - } else { - if (sz_vol >= 0x10000) { - sys = 0x06; /* FAT12/16 (>=64KS) */ - } else { - sys = (fmt == FS_FAT16) ? 0x04 : 0x01; /* FAT16 (<64KS) : FAT12 (<64KS) */ - } - } - } - - if (_MULTI_PARTITION && part != 0) { - /* Update system ID in the partition table */ - if (disk_read(pdrv, buf, 0, 1) != RES_OK) return FR_DISK_ERR; /* Read the MBR */ - buf[MBR_Table + (part - 1) * SZ_PTE + PTE_System] = sys; /* Set system type */ - if (disk_write(pdrv, buf, 0, 1) != RES_OK) return FR_DISK_ERR; /* Write it back to the MBR */ - } else { - if (!(opt & FM_SFD)) { - /* Create partition table in FDISK format */ - mem_set(buf, 0, ss); - st_word(buf + BS_55AA, 0xAA55); /* MBR signature */ - pte = buf + MBR_Table; /* Create partition table for single partition in the drive */ - pte[PTE_Boot] = 0; /* Boot indicator */ - pte[PTE_StHead] = 1; /* Start head */ - pte[PTE_StSec] = 1; /* Start sector */ - pte[PTE_StCyl] = 0; /* Start cylinder */ - pte[PTE_System] = sys; /* System type */ - n = (b_vol + sz_vol) / (63 * 255); /* (End CHS is incorrect) */ - pte[PTE_EdHead] = 254; /* End head */ - pte[PTE_EdSec] = (BYTE)(n >> 2 | 63); /* End sector */ - pte[PTE_EdCyl] = (BYTE)n; /* End cylinder */ - st_dword(pte + PTE_StLba, b_vol); /* Start offset in LBA */ - st_dword(pte + PTE_SizLba, sz_vol); /* Size in sectors */ - if (disk_write(pdrv, buf, 0, 1) != RES_OK) return FR_DISK_ERR; /* Write it to the MBR */ - } - } - - if (disk_ioctl(pdrv, CTRL_SYNC, 0) != RES_OK) return FR_DISK_ERR; - - return FR_OK; -} - - - -#if _MULTI_PARTITION -/*-----------------------------------------------------------------------*/ -/* Create partition table on the physical drive */ -/*-----------------------------------------------------------------------*/ - -FRESULT f_fdisk ( - BYTE pdrv, /* Physical drive number */ - const DWORD* szt, /* Pointer to the size table for each partitions */ - void* work /* Pointer to the working buffer */ -) -{ - UINT i, n, sz_cyl, tot_cyl, b_cyl, e_cyl, p_cyl; - BYTE s_hd, e_hd, *p, *buf = (BYTE*)work; - DSTATUS stat; - DWORD sz_disk, sz_part, s_part; - - - stat = disk_initialize(pdrv); - if (stat & STA_NOINIT) return FR_NOT_READY; - if (stat & STA_PROTECT) return FR_WRITE_PROTECTED; - if (disk_ioctl(pdrv, GET_SECTOR_COUNT, &sz_disk)) return FR_DISK_ERR; - - /* Determine the CHS without any care of the drive geometry */ - for (n = 16; n < 256 && sz_disk / n / 63 > 1024; n *= 2) ; - if (n == 256) n--; - e_hd = n - 1; - sz_cyl = 63 * n; - tot_cyl = sz_disk / sz_cyl; - - /* Create partition table */ - mem_set(buf, 0, _MAX_SS); - p = buf + MBR_Table; b_cyl = 0; - for (i = 0; i < 4; i++, p += SZ_PTE) { - p_cyl = (szt[i] <= 100U) ? (DWORD)tot_cyl * szt[i] / 100 : szt[i] / sz_cyl; - if (!p_cyl) continue; - s_part = (DWORD)sz_cyl * b_cyl; - sz_part = (DWORD)sz_cyl * p_cyl; - if (i == 0) { /* Exclude first track of cylinder 0 */ - s_hd = 1; - s_part += 63; sz_part -= 63; - } else { - s_hd = 0; - } - e_cyl = b_cyl + p_cyl - 1; - if (e_cyl >= tot_cyl) return FR_INVALID_PARAMETER; - - /* Set partition table */ - p[1] = s_hd; /* Start head */ - p[2] = (BYTE)((b_cyl >> 2) + 1); /* Start sector */ - p[3] = (BYTE)b_cyl; /* Start cylinder */ - p[4] = 0x06; /* System type (temporary setting) */ - p[5] = e_hd; /* End head */ - p[6] = (BYTE)((e_cyl >> 2) + 63); /* End sector */ - p[7] = (BYTE)e_cyl; /* End cylinder */ - st_dword(p + 8, s_part); /* Start sector in LBA */ - st_dword(p + 12, sz_part); /* Partition size */ - - /* Next partition */ - b_cyl += p_cyl; - } - st_word(p, 0xAA55); - - /* Write it to the MBR */ - return (disk_write(pdrv, buf, 0, 1) != RES_OK || disk_ioctl(pdrv, CTRL_SYNC, 0) != RES_OK) ? FR_DISK_ERR : FR_OK; -} - -#endif /* _MULTI_PARTITION */ -#endif /* _USE_MKFS && !_FS_READONLY */ - - - - -#if _USE_STRFUNC -/*-----------------------------------------------------------------------*/ -/* Get a string from the file */ -/*-----------------------------------------------------------------------*/ - -TCHAR* f_gets ( - TCHAR* buff, /* Pointer to the string buffer to read */ - int len, /* Size of string buffer (characters) */ - FIL* fp /* Pointer to the file object */ -) -{ - int n = 0; - TCHAR c, *p = buff; - BYTE s[2]; - UINT rc; - - - while (n < len - 1) { /* Read characters until buffer gets filled */ -#if _LFN_UNICODE -#if _STRF_ENCODE == 3 /* Read a character in UTF-8 */ - f_read(fp, s, 1, &rc); - if (rc != 1) break; - c = s[0]; - if (c >= 0x80) { - if (c < 0xC0) continue; /* Skip stray trailer */ - if (c < 0xE0) { /* Two-byte sequence */ - f_read(fp, s, 1, &rc); - if (rc != 1) break; - c = (c & 0x1F) << 6 | (s[0] & 0x3F); - if (c < 0x80) c = '?'; - } else { - if (c < 0xF0) { /* Three-byte sequence */ - f_read(fp, s, 2, &rc); - if (rc != 2) break; - c = c << 12 | (s[0] & 0x3F) << 6 | (s[1] & 0x3F); - if (c < 0x800) c = '?'; - } else { /* Reject four-byte sequence */ - c = '?'; - } - } - } -#elif _STRF_ENCODE == 2 /* Read a character in UTF-16BE */ - f_read(fp, s, 2, &rc); - if (rc != 2) break; - c = s[1] + (s[0] << 8); -#elif _STRF_ENCODE == 1 /* Read a character in UTF-16LE */ - f_read(fp, s, 2, &rc); - if (rc != 2) break; - c = s[0] + (s[1] << 8); -#else /* Read a character in ANSI/OEM */ - f_read(fp, s, 1, &rc); - if (rc != 1) break; - c = s[0]; - if (IsDBCS1(c)) { - f_read(fp, s, 1, &rc); - if (rc != 1) break; - c = (c << 8) + s[0]; - } - c = ff_convert(c, 1); /* OEM -> Unicode */ - if (!c) c = '?'; -#endif -#else /* Read a character without conversion */ - f_read(fp, s, 1, &rc); - if (rc != 1) break; - c = s[0]; -#endif - if (_USE_STRFUNC == 2 && c == '\r') continue; /* Strip '\r' */ - *p++ = c; - n++; - if (c == '\n') break; /* Break on EOL */ - } - *p = 0; - return n ? buff : 0; /* When no data read (eof or error), return with error. */ -} - - - - -#if !_FS_READONLY -#include -/*-----------------------------------------------------------------------*/ -/* Put a character to the file */ -/*-----------------------------------------------------------------------*/ - -typedef struct { - FIL *fp; /* Ptr to the writing file */ - int idx, nchr; /* Write index of buf[] (-1:error), number of chars written */ - BYTE buf[64]; /* Write buffer */ -} putbuff; - - -static -void putc_bfd ( /* Buffered write with code conversion */ - putbuff* pb, - TCHAR c -) -{ - UINT bw; - int i; - - - if (_USE_STRFUNC == 2 && c == '\n') { /* LF -> CRLF conversion */ - putc_bfd(pb, '\r'); - } - - i = pb->idx; /* Write index of pb->buf[] */ - if (i < 0) return; - -#if _LFN_UNICODE -#if _STRF_ENCODE == 3 /* Write a character in UTF-8 */ - if (c < 0x80) { /* 7-bit */ - pb->buf[i++] = (BYTE)c; - } else { - if (c < 0x800) { /* 11-bit */ - pb->buf[i++] = (BYTE)(0xC0 | c >> 6); - } else { /* 16-bit */ - pb->buf[i++] = (BYTE)(0xE0 | c >> 12); - pb->buf[i++] = (BYTE)(0x80 | (c >> 6 & 0x3F)); - } - pb->buf[i++] = (BYTE)(0x80 | (c & 0x3F)); - } -#elif _STRF_ENCODE == 2 /* Write a character in UTF-16BE */ - pb->buf[i++] = (BYTE)(c >> 8); - pb->buf[i++] = (BYTE)c; -#elif _STRF_ENCODE == 1 /* Write a character in UTF-16LE */ - pb->buf[i++] = (BYTE)c; - pb->buf[i++] = (BYTE)(c >> 8); -#else /* Write a character in ANSI/OEM */ - c = ff_convert(c, 0); /* Unicode -> OEM */ - if (!c) c = '?'; - if (c >= 0x100) - pb->buf[i++] = (BYTE)(c >> 8); - pb->buf[i++] = (BYTE)c; -#endif -#else /* Write a character without conversion */ - pb->buf[i++] = (BYTE)c; -#endif - - if (i >= (int)(sizeof pb->buf) - 3) { /* Write buffered characters to the file */ - f_write(pb->fp, pb->buf, (UINT)i, &bw); - i = (bw == (UINT)i) ? 0 : -1; - } - pb->idx = i; - pb->nchr++; -} - - -static -int putc_flush ( /* Flush left characters in the buffer */ - putbuff* pb -) -{ - UINT nw; - - if ( pb->idx >= 0 /* Flush buffered characters to the file */ - && f_write(pb->fp, pb->buf, (UINT)pb->idx, &nw) == FR_OK - && (UINT)pb->idx == nw) return pb->nchr; - return EOF; -} - - -static -void putc_init ( /* Initialize write buffer */ - putbuff* pb, - FIL* fp -) -{ - pb->fp = fp; - pb->nchr = pb->idx = 0; -} - - - -int f_putc ( - TCHAR c, /* A character to be output */ - FIL* fp /* Pointer to the file object */ -) -{ - putbuff pb; - - - putc_init(&pb, fp); - putc_bfd(&pb, c); /* Put the character */ - return putc_flush(&pb); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Put a string to the file */ -/*-----------------------------------------------------------------------*/ - -int f_puts ( - const TCHAR* str, /* Pointer to the string to be output */ - FIL* fp /* Pointer to the file object */ -) -{ - putbuff pb; - - - putc_init(&pb, fp); - while (*str) putc_bfd(&pb, *str++); /* Put the string */ - return putc_flush(&pb); -} - - - - -/*-----------------------------------------------------------------------*/ -/* Put a formatted string to the file */ -/*-----------------------------------------------------------------------*/ - -int f_printf ( - FIL* fp, /* Pointer to the file object */ - const TCHAR* fmt, /* Pointer to the format string */ - ... /* Optional arguments... */ -) -{ - va_list arp; - putbuff pb; - BYTE f, r; - UINT i, j, w; - DWORD v; - TCHAR c, d, str[32], *p; - - - putc_init(&pb, fp); - - va_start(arp, fmt); - - for (;;) { - c = *fmt++; - if (c == 0) break; /* End of string */ - if (c != '%') { /* Non escape character */ - putc_bfd(&pb, c); - continue; - } - w = f = 0; - c = *fmt++; - if (c == '0') { /* Flag: '0' padding */ - f = 1; c = *fmt++; - } else { - if (c == '-') { /* Flag: left justified */ - f = 2; c = *fmt++; - } - } - while (IsDigit(c)) { /* Precision */ - w = w * 10 + c - '0'; - c = *fmt++; - } - if (c == 'l' || c == 'L') { /* Prefix: Size is long int */ - f |= 4; c = *fmt++; - } - if (!c) break; - d = c; - if (IsLower(d)) d -= 0x20; - switch (d) { /* Type is... */ - case 'S' : /* String */ - p = va_arg(arp, TCHAR*); - for (j = 0; p[j]; j++) ; - if (!(f & 2)) { - while (j++ < w) putc_bfd(&pb, ' '); - } - while (*p) putc_bfd(&pb, *p++); - while (j++ < w) putc_bfd(&pb, ' '); - continue; - case 'C' : /* Character */ - putc_bfd(&pb, (TCHAR)va_arg(arp, int)); continue; - case 'B' : /* Binary */ - r = 2; break; - case 'O' : /* Octal */ - r = 8; break; - case 'D' : /* Signed decimal */ - case 'U' : /* Unsigned decimal */ - r = 10; break; - case 'X' : /* Hexdecimal */ - r = 16; break; - default: /* Unknown type (pass-through) */ - putc_bfd(&pb, c); continue; - } - - /* Get an argument and put it in numeral */ - v = (f & 4) ? (DWORD)va_arg(arp, long) : ((d == 'D') ? (DWORD)(long)va_arg(arp, int) : (DWORD)va_arg(arp, unsigned int)); - if (d == 'D' && (v & 0x80000000)) { - v = 0 - v; - f |= 8; - } - i = 0; - do { - d = (TCHAR)(v % r); v /= r; - if (d > 9) d += (c == 'x') ? 0x27 : 0x07; - str[i++] = d + '0'; - } while (v && i < sizeof str / sizeof str[0]); - if (f & 8) str[i++] = '-'; - j = i; d = (f & 1) ? '0' : ' '; - while (!(f & 2) && j++ < w) putc_bfd(&pb, d); - do putc_bfd(&pb, str[--i]); while (i); - while (j++ < w) putc_bfd(&pb, d); - } - - va_end(arp); - - return putc_flush(&pb); -} - -#endif /* !_FS_READONLY */ -#endif /* _USE_STRFUNC */ diff --git a/os/lib/fs/fat/ff.h b/os/lib/fs/fat/ff.h deleted file mode 100644 index 905dd6623..000000000 --- a/os/lib/fs/fat/ff.h +++ /dev/null @@ -1,366 +0,0 @@ -/*----------------------------------------------------------------------------/ -/ FatFs - Generic FAT file system module R0.12b / -/-----------------------------------------------------------------------------/ -/ -/ Copyright (C) 2016, ChaN, all right reserved. -/ -/ FatFs module is an open source software. Redistribution and use of FatFs in -/ source and binary forms, with or without modification, are permitted provided -/ that the following condition is met: - -/ 1. Redistributions of source code must retain the above copyright notice, -/ this condition and the following disclaimer. -/ -/ This software is provided by the copyright holder and contributors "AS IS" -/ and any warranties related to this software are DISCLAIMED. -/ The copyright owner or contributors be NOT LIABLE for any damages caused -/ by use of this software. -/----------------------------------------------------------------------------*/ - - -#ifndef _FATFS -#define _FATFS 68020 /* Revision ID */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "integer.h" /* Basic integer types */ -#include "ffconf.h" /* FatFs configuration options */ - -#if _FATFS != _FFCONF -#error Wrong configuration file (ffconf.h). -#endif - - - -/* Definitions of volume management */ - -#if _MULTI_PARTITION /* Multiple partition configuration */ -typedef struct { - BYTE pd; /* Physical drive number */ - BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */ -} PARTITION; -extern PARTITION VolToPart[]; /* Volume - Partition resolution table */ -#define LD2PD(vol) (VolToPart[vol].pd) /* Get physical drive number */ -#define LD2PT(vol) (VolToPart[vol].pt) /* Get partition index */ - -#else /* Single partition configuration */ -#define LD2PD(vol) (BYTE)(vol) /* Each logical drive is bound to the same physical drive number */ -#define LD2PT(vol) 0 /* Find first valid partition or in SFD */ - -#endif - - - -/* Type of path name strings on FatFs API */ - -#if _LFN_UNICODE /* Unicode (UTF-16) string */ -#if _USE_LFN == 0 -#error _LFN_UNICODE must be 0 at non-LFN cfg. -#endif -#ifndef _INC_TCHAR -typedef WCHAR TCHAR; -#define _T(x) L ## x -#define _TEXT(x) L ## x -#endif -#else /* ANSI/OEM string */ -#ifndef _INC_TCHAR -typedef char TCHAR; -#define _T(x) x -#define _TEXT(x) x -#endif -#endif - - - -/* Type of file size variables */ - -#if _FS_EXFAT -#if _USE_LFN == 0 -#error LFN must be enabled when enable exFAT -#endif -typedef QWORD FSIZE_t; -#else -typedef DWORD FSIZE_t; -#endif - - - -/* File system object structure (FATFS) */ - -typedef struct { - BYTE fs_type; /* File system type (0:N/A) */ - BYTE drv; /* Physical drive number */ - BYTE n_fats; /* Number of FATs (1 or 2) */ - BYTE wflag; /* win[] flag (b0:dirty) */ - BYTE fsi_flag; /* FSINFO flags (b7:disabled, b0:dirty) */ - WORD id; /* File system mount ID */ - WORD n_rootdir; /* Number of root directory entries (FAT12/16) */ - WORD csize; /* Cluster size [sectors] */ -#if _MAX_SS != _MIN_SS - WORD ssize; /* Sector size (512, 1024, 2048 or 4096) */ -#endif -#if _USE_LFN != 0 - WCHAR* lfnbuf; /* LFN working buffer */ -#endif -#if _FS_EXFAT - BYTE* dirbuf; /* Directory entry block scratchpad buffer */ -#endif -#if _FS_REENTRANT - _SYNC_t sobj; /* Identifier of sync object */ -#endif -#if !_FS_READONLY - DWORD last_clst; /* Last allocated cluster */ - DWORD free_clst; /* Number of free clusters */ -#endif -#if _FS_RPATH != 0 - DWORD cdir; /* Current directory start cluster (0:root) */ -#if _FS_EXFAT - DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */ - DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */ - DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */ -#endif -#endif - DWORD n_fatent; /* Number of FAT entries (number of clusters + 2) */ - DWORD fsize; /* Size of an FAT [sectors] */ - DWORD volbase; /* Volume base sector */ - DWORD fatbase; /* FAT base sector */ - DWORD dirbase; /* Root directory base sector/cluster */ - DWORD database; /* Data base sector */ - DWORD winsect; /* Current sector appearing in the win[] */ - BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */ -} FATFS; - - - -/* Object ID and allocation information (_FDID) */ - -typedef struct { - FATFS* fs; /* Pointer to the owner file system object */ - WORD id; /* Owner file system mount ID */ - BYTE attr; /* Object attribute */ - BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous (no data on FAT), =3:got flagmented, b2:sub-directory stretched) */ - DWORD sclust; /* Object start cluster (0:no cluster or root directory) */ - FSIZE_t objsize; /* Object size (valid when sclust != 0) */ -#if _FS_EXFAT - DWORD n_cont; /* Size of coutiguous part, clusters - 1 (valid when stat == 3) */ - DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */ - DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */ - DWORD c_ofs; /* Offset in the containing directory (valid when sclust != 0) */ -#endif -#if _FS_LOCK != 0 - UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */ -#endif -} _FDID; - - - -/* File object structure (FIL) */ - -typedef struct { - _FDID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */ - BYTE flag; /* File status flags */ - BYTE err; /* Abort flag (error code) */ - FSIZE_t fptr; /* File read/write pointer (Zeroed on file open) */ - DWORD clust; /* Current cluster of fpter (invalid when fprt is 0) */ - DWORD sect; /* Sector number appearing in buf[] (0:invalid) */ -#if !_FS_READONLY - DWORD dir_sect; /* Sector number containing the directory entry */ - BYTE* dir_ptr; /* Pointer to the directory entry in the win[] */ -#endif -#if _USE_FASTSEEK - DWORD* cltbl; /* Pointer to the cluster link map table (nulled on open, set by application) */ -#endif -#if !_FS_TINY - BYTE buf[_MAX_SS]; /* File private data read/write window */ -#endif -} FIL; - - - -/* Directory object structure (DIR) */ - -typedef struct { - _FDID obj; /* Object identifier */ - DWORD dptr; /* Current read/write offset */ - DWORD clust; /* Current cluster */ - DWORD sect; /* Current sector */ - BYTE* dir; /* Pointer to the directory item in the win[] */ - BYTE fn[12]; /* SFN (in/out) {body[8],ext[3],status[1]} */ -#if _USE_LFN != 0 - DWORD blk_ofs; /* Offset of current entry block being processed (0xFFFFFFFF:Invalid) */ -#endif -#if _USE_FIND - const TCHAR* pat; /* Pointer to the name matching pattern */ -#endif -} DIR; - - - -/* File information structure (FILINFO) */ - -typedef struct { - FSIZE_t fsize; /* File size */ - WORD fdate; /* Modified date */ - WORD ftime; /* Modified time */ - BYTE fattrib; /* File attribute */ -#if _USE_LFN != 0 - TCHAR altname[13]; /* Altenative file name */ - TCHAR fname[_MAX_LFN + 1]; /* Primary file name */ -#else - TCHAR fname[13]; /* File name */ -#endif -} FILINFO; - - - -/* File function return code (FRESULT) */ - -typedef enum { - FR_OK = 0, /* (0) Succeeded */ - FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */ - FR_INT_ERR, /* (2) Assertion failed */ - FR_NOT_READY, /* (3) The physical drive cannot work */ - FR_NO_FILE, /* (4) Could not find the file */ - FR_NO_PATH, /* (5) Could not find the path */ - FR_INVALID_NAME, /* (6) The path name format is invalid */ - FR_DENIED, /* (7) Access denied due to prohibited access or directory full */ - FR_EXIST, /* (8) Access denied due to prohibited access */ - FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */ - FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */ - FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */ - FR_NOT_ENABLED, /* (12) The volume has no work area */ - FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */ - FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any problem */ - FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */ - FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */ - FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */ - FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_LOCK */ - FR_INVALID_PARAMETER /* (19) Given parameter is invalid */ -} FRESULT; - - - -/*--------------------------------------------------------------*/ -/* FatFs module application interface */ - -FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */ -FRESULT f_close (FIL* fp); /* Close an open file object */ -FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */ -FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */ -FRESULT f_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */ -FRESULT f_truncate (FIL* fp); /* Truncate the file */ -FRESULT f_sync (FIL* fp); /* Flush cached data of the writing file */ -FRESULT f_opendir (DIR* dp, const TCHAR* path); /* Open a directory */ -FRESULT f_closedir (DIR* dp); /* Close an open directory */ -FRESULT f_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */ -FRESULT f_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */ -FRESULT f_findnext (DIR* dp, FILINFO* fno); /* Find next file */ -FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */ -FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */ -FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */ -FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */ -FRESULT f_chmod (const TCHAR* path, BYTE attr, BYTE mask); /* Change attribute of a file/dir */ -FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change timestamp of a file/dir */ -FRESULT f_chdir (const TCHAR* path); /* Change current directory */ -FRESULT f_chdrive (const TCHAR* path); /* Change current drive */ -FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */ -FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */ -FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */ -FRESULT f_setlabel (const TCHAR* label); /* Set volume label */ -FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */ -FRESULT f_expand (FIL* fp, FSIZE_t szf, BYTE opt); /* Allocate a contiguous block to the file */ -FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */ -FRESULT f_mkfs (const TCHAR* path, BYTE opt, DWORD au, void* work, UINT len); /* Create a FAT volume */ -FRESULT f_fdisk (BYTE pdrv, const DWORD* szt, void* work); /* Divide a physical drive into some partitions */ -int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */ -int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */ -int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */ -TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */ - -#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize)) -#define f_error(fp) ((fp)->err) -#define f_tell(fp) ((fp)->fptr) -#define f_size(fp) ((fp)->obj.objsize) -#define f_rewind(fp) f_lseek((fp), 0) -#define f_rewinddir(dp) f_readdir((dp), 0) - -#ifndef EOF -#define EOF (-1) -#endif - - - - -/*--------------------------------------------------------------*/ -/* Additional user defined functions */ - -/* RTC function */ -#if !_FS_READONLY && !_FS_NORTC -DWORD get_fattime (void); -#endif - -/* Unicode support functions */ -#if _USE_LFN != 0 /* Unicode - OEM code conversion */ -WCHAR ff_convert (WCHAR chr, UINT dir); /* OEM-Unicode bidirectional conversion */ -WCHAR ff_wtoupper (WCHAR chr); /* Unicode upper-case conversion */ -#if _USE_LFN == 3 /* Memory functions */ -void* ff_memalloc (UINT msize); /* Allocate memory block */ -void ff_memfree (void* mblock); /* Free memory block */ -#endif -#endif - -/* Sync functions */ -#if _FS_REENTRANT -int ff_cre_syncobj (BYTE vol, _SYNC_t* sobj); /* Create a sync object */ -int ff_req_grant (_SYNC_t sobj); /* Lock sync object */ -void ff_rel_grant (_SYNC_t sobj); /* Unlock sync object */ -int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */ -#endif - - - - -/*--------------------------------------------------------------*/ -/* Flags and offset address */ - - -/* File access mode and open method flags (3rd argument of f_open) */ -#define FA_READ 0x01 -#define FA_WRITE 0x02 -#define FA_OPEN_EXISTING 0x00 -#define FA_CREATE_NEW 0x04 -#define FA_CREATE_ALWAYS 0x08 -#define FA_OPEN_ALWAYS 0x10 -#define FA_OPEN_APPEND 0x30 - -/* Fast seek controls (2nd argument of f_lseek) */ -#define CREATE_LINKMAP ((FSIZE_t)0 - 1) - -/* Format options (2nd argument of f_mkfs) */ -#define FM_FAT 0x01 -#define FM_FAT32 0x02 -#define FM_EXFAT 0x04 -#define FM_ANY 0x07 -#define FM_SFD 0x08 - -/* Filesystem type (FATFS.fs_type) */ -#define FS_FAT12 1 -#define FS_FAT16 2 -#define FS_FAT32 3 -#define FS_EXFAT 4 - -/* File attribute bits for directory entry (FILINFO.fattrib) */ -#define AM_RDO 0x01 /* Read only */ -#define AM_HID 0x02 /* Hidden */ -#define AM_SYS 0x04 /* System */ -#define AM_DIR 0x10 /* Directory */ -#define AM_ARC 0x20 /* Archive */ - - -#ifdef __cplusplus -} -#endif - -#endif /* _FATFS */ diff --git a/os/lib/fs/fat/integer.h b/os/lib/fs/fat/integer.h deleted file mode 100644 index 5dd8ec316..000000000 --- a/os/lib/fs/fat/integer.h +++ /dev/null @@ -1,38 +0,0 @@ -/*-------------------------------------------*/ -/* Integer type definitions for FatFs module */ -/*-------------------------------------------*/ - -#ifndef _FF_INTEGER -#define _FF_INTEGER - -#ifdef _WIN32 /* FatFs development platform */ - -#include -#include -typedef unsigned __int64 QWORD; - - -#else /* Embedded platform */ - -/* These types MUST be 16-bit or 32-bit */ -typedef int INT; -typedef unsigned int UINT; - -/* This type MUST be 8-bit */ -typedef unsigned char BYTE; - -/* These types MUST be 16-bit */ -typedef short SHORT; -typedef unsigned short WORD; -typedef unsigned short WCHAR; - -/* These types MUST be 32-bit */ -typedef long LONG; -typedef unsigned long DWORD; - -/* This type MUST be 64-bit (Remove this for C89 compatibility) */ -typedef unsigned long long QWORD; - -#endif - -#endif diff --git a/os/lib/fs/fat/option/syscall.c b/os/lib/fs/fat/option/syscall.c deleted file mode 100644 index 5825052f5..000000000 --- a/os/lib/fs/fat/option/syscall.c +++ /dev/null @@ -1,152 +0,0 @@ -/*------------------------------------------------------------------------*/ -/* Sample code of OS dependent controls for FatFs */ -/* (C)ChaN, 2014 */ -/*------------------------------------------------------------------------*/ - - -#include -#include "../ff.h" - - -#if _FS_REENTRANT -/*------------------------------------------------------------------------*/ -/* Create a Synchronization Object */ -/*------------------------------------------------------------------------*/ -/* This function is called in f_mount() function to create a new -/ synchronization object, such as semaphore and mutex. When a 0 is returned, -/ the f_mount() function fails with FR_INT_ERR. -*/ - -int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create the sync object */ - BYTE vol, /* Corresponding volume (logical drive number) */ - _SYNC_t *sobj /* Pointer to return the created sync object */ -) -{ - int ret; - - - *sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */ - ret = (int)(*sobj != INVALID_HANDLE_VALUE); - -// *sobj = SyncObjects[vol]; /* uITRON (give a static sync object) */ -// ret = 1; /* The initial value of the semaphore must be 1. */ - -// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */ -// ret = (int)(err == OS_NO_ERR); - -// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */ -// ret = (int)(*sobj != NULL); - - return ret; -} - - - -/*------------------------------------------------------------------------*/ -/* Delete a Synchronization Object */ -/*------------------------------------------------------------------------*/ -/* This function is called in f_mount() function to delete a synchronization -/ object that created with ff_cre_syncobj() function. When a 0 is returned, -/ the f_mount() function fails with FR_INT_ERR. -*/ - -int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any error */ - _SYNC_t sobj /* Sync object tied to the logical drive to be deleted */ -) -{ - int ret; - - - ret = CloseHandle(sobj); /* Win32 */ - -// ret = 1; /* uITRON (nothing to do) */ - -// OSMutexDel(sobj, OS_DEL_ALWAYS, &err); /* uC/OS-II */ -// ret = (int)(err == OS_NO_ERR); - -// vSemaphoreDelete(sobj); /* FreeRTOS */ -// ret = 1; - - return ret; -} - - - -/*------------------------------------------------------------------------*/ -/* Request Grant to Access the Volume */ -/*------------------------------------------------------------------------*/ -/* This function is called on entering file functions to lock the volume. -/ When a 0 is returned, the file function fails with FR_TIMEOUT. -*/ - -int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */ - _SYNC_t sobj /* Sync object to wait */ -) -{ - int ret; - - ret = (int)(WaitForSingleObject(sobj, _FS_TIMEOUT) == WAIT_OBJECT_0); /* Win32 */ - -// ret = (int)(wai_sem(sobj) == E_OK); /* uITRON */ - -// OSMutexPend(sobj, _FS_TIMEOUT, &err)); /* uC/OS-II */ -// ret = (int)(err == OS_NO_ERR); - -// ret = (int)(xSemaphoreTake(sobj, _FS_TIMEOUT) == pdTRUE); /* FreeRTOS */ - - return ret; -} - - - -/*------------------------------------------------------------------------*/ -/* Release Grant to Access the Volume */ -/*------------------------------------------------------------------------*/ -/* This function is called on leaving file functions to unlock the volume. -*/ - -void ff_rel_grant ( - _SYNC_t sobj /* Sync object to be signaled */ -) -{ - ReleaseMutex(sobj); /* Win32 */ - -// sig_sem(sobj); /* uITRON */ - -// OSMutexPost(sobj); /* uC/OS-II */ - -// xSemaphoreGive(sobj); /* FreeRTOS */ -} - -#endif - - - - -#if _USE_LFN == 3 /* LFN with a working buffer on the heap */ -/*------------------------------------------------------------------------*/ -/* Allocate a memory block */ -/*------------------------------------------------------------------------*/ -/* If a NULL is returned, the file function fails with FR_NOT_ENOUGH_CORE. -*/ - -void* ff_memalloc ( /* Returns pointer to the allocated memory block */ - UINT msize /* Number of bytes to allocate */ -) -{ - return malloc(msize); /* Allocate a new memory block with POSIX API */ -} - - -/*------------------------------------------------------------------------*/ -/* Free a memory block */ -/*------------------------------------------------------------------------*/ - -void ff_memfree ( - void* mblock /* Pointer to the memory block to free */ -) -{ - free(mblock); /* Discard the memory block with POSIX API */ -} - -#endif diff --git a/os/lib/fs/fat/option/unicode.c b/os/lib/fs/fat/option/unicode.c deleted file mode 100644 index 7e6f5b442..000000000 --- a/os/lib/fs/fat/option/unicode.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "../ff.h" - -#if _USE_LFN != 0 - -#if _CODE_PAGE == 932 /* Japanese Shift_JIS */ -#include "unicode/cc932.c" -#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */ -#include "unicode/cc936.c" -#elif _CODE_PAGE == 949 /* Korean */ -#include "unicode/cc949.c" -#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */ -#include "unicode/cc950.c" -#else /* Single Byte Character-Set */ -#include "unicode/ccsbcs.c" -#endif - -#endif diff --git a/os/lib/fs/fat/option/unicode/cc932.c b/os/lib/fs/fat/option/unicode/cc932.c deleted file mode 100644 index 7cffba204..000000000 --- a/os/lib/fs/fat/option/unicode/cc932.c +++ /dev/null @@ -1,3870 +0,0 @@ -/*------------------------------------------------------------------------*/ -/* Unicode - OEM code bidirectional converter (C)ChaN, 2015 */ -/* CP932 (Japanese Shift-JIS) */ -/*------------------------------------------------------------------------*/ - -#include "../../ff.h" - -#define _TINY_TABLE 0 - -#if !_USE_LFN || _CODE_PAGE != 932 -#error This file is not needed in current configuration. Remove from the project. -#endif - - -static -const WCHAR uni2sjis[] = { -/* Unicode - Sjis, Unicode - Sjis, Unicode - Sjis, Unicode - Sjis, */ - 0x00A7, 0x8198, 0x00A8, 0x814E, 0x00B0, 0x818B, 0x00B1, 0x817D, - 0x00B4, 0x814C, 0x00B6, 0x81F7, 0x00D7, 0x817E, 0x00F7, 0x8180, - 0x0391, 0x839F, 0x0392, 0x83A0, 0x0393, 0x83A1, 0x0394, 0x83A2, - 0x0395, 0x83A3, 0x0396, 0x83A4, 0x0397, 0x83A5, 0x0398, 0x83A6, - 0x0399, 0x83A7, 0x039A, 0x83A8, 0x039B, 0x83A9, 0x039C, 0x83AA, - 0x039D, 0x83AB, 0x039E, 0x83AC, 0x039F, 0x83AD, 0x03A0, 0x83AE, - 0x03A1, 0x83AF, 0x03A3, 0x83B0, 0x03A4, 0x83B1, 0x03A5, 0x83B2, - 0x03A6, 0x83B3, 0x03A7, 0x83B4, 0x03A8, 0x83B5, 0x03A9, 0x83B6, - 0x03B1, 0x83BF, 0x03B2, 0x83C0, 0x03B3, 0x83C1, 0x03B4, 0x83C2, - 0x03B5, 0x83C3, 0x03B6, 0x83C4, 0x03B7, 0x83C5, 0x03B8, 0x83C6, - 0x03B9, 0x83C7, 0x03BA, 0x83C8, 0x03BB, 0x83C9, 0x03BC, 0x83CA, - 0x03BD, 0x83CB, 0x03BE, 0x83CC, 0x03BF, 0x83CD, 0x03C0, 0x83CE, - 0x03C1, 0x83CF, 0x03C3, 0x83D0, 0x03C4, 0x83D1, 0x03C5, 0x83D2, - 0x03C6, 0x83D3, 0x03C7, 0x83D4, 0x03C8, 0x83D5, 0x03C9, 0x83D6, - 0x0401, 0x8446, 0x0410, 0x8440, 0x0411, 0x8441, 0x0412, 0x8442, - 0x0413, 0x8443, 0x0414, 0x8444, 0x0415, 0x8445, 0x0416, 0x8447, - 0x0417, 0x8448, 0x0418, 0x8449, 0x0419, 0x844A, 0x041A, 0x844B, - 0x041B, 0x844C, 0x041C, 0x844D, 0x041D, 0x844E, 0x041E, 0x844F, - 0x041F, 0x8450, 0x0420, 0x8451, 0x0421, 0x8452, 0x0422, 0x8453, - 0x0423, 0x8454, 0x0424, 0x8455, 0x0425, 0x8456, 0x0426, 0x8457, - 0x0427, 0x8458, 0x0428, 0x8459, 0x0429, 0x845A, 0x042A, 0x845B, - 0x042B, 0x845C, 0x042C, 0x845D, 0x042D, 0x845E, 0x042E, 0x845F, - 0x042F, 0x8460, 0x0430, 0x8470, 0x0431, 0x8471, 0x0432, 0x8472, - 0x0433, 0x8473, 0x0434, 0x8474, 0x0435, 0x8475, 0x0436, 0x8477, - 0x0437, 0x8478, 0x0438, 0x8479, 0x0439, 0x847A, 0x043A, 0x847B, - 0x043B, 0x847C, 0x043C, 0x847D, 0x043D, 0x847E, 0x043E, 0x8480, - 0x043F, 0x8481, 0x0440, 0x8482, 0x0441, 0x8483, 0x0442, 0x8484, - 0x0443, 0x8485, 0x0444, 0x8486, 0x0445, 0x8487, 0x0446, 0x8488, - 0x0447, 0x8489, 0x0448, 0x848A, 0x0449, 0x848B, 0x044A, 0x848C, - 0x044B, 0x848D, 0x044C, 0x848E, 0x044D, 0x848F, 0x044E, 0x8490, - 0x044F, 0x8491, 0x0451, 0x8476, 0x2010, 0x815D, 0x2015, 0x815C, - 0x2018, 0x8165, 0x2019, 0x8166, 0x201C, 0x8167, 0x201D, 0x8168, - 0x2020, 0x81F5, 0x2021, 0x81F6, 0x2025, 0x8164, 0x2026, 0x8163, - 0x2030, 0x81F1, 0x2032, 0x818C, 0x2033, 0x818D, 0x203B, 0x81A6, - 0x2103, 0x818E, 0x2116, 0x8782, 0x2121, 0x8784, 0x212B, 0x81F0, - 0x2160, 0x8754, 0x2161, 0x8755, 0x2162, 0x8756, 0x2163, 0x8757, - 0x2164, 0x8758, 0x2165, 0x8759, 0x2166, 0x875A, 0x2167, 0x875B, - 0x2168, 0x875C, 0x2169, 0x875D, 0x2170, 0xFA40, 0x2171, 0xFA41, - 0x2172, 0xFA42, 0x2173, 0xFA43, 0x2174, 0xFA44, 0x2175, 0xFA45, - 0x2176, 0xFA46, 0x2177, 0xFA47, 0x2178, 0xFA48, 0x2179, 0xFA49, - 0x2190, 0x81A9, 0x2191, 0x81AA, 0x2192, 0x81A8, 0x2193, 0x81AB, - 0x21D2, 0x81CB, 0x21D4, 0x81CC, 0x2200, 0x81CD, 0x2202, 0x81DD, - 0x2203, 0x81CE, 0x2207, 0x81DE, 0x2208, 0x81B8, 0x220B, 0x81B9, - 0x2211, 0x8794, 0x221A, 0x81E3, 0x221D, 0x81E5, 0x221E, 0x8187, - 0x221F, 0x8798, 0x2220, 0x81DA, 0x2225, 0x8161, 0x2227, 0x81C8, - 0x2228, 0x81C9, 0x2229, 0x81BF, 0x222A, 0x81BE, 0x222B, 0x81E7, - 0x222C, 0x81E8, 0x222E, 0x8793, 0x2234, 0x8188, 0x2235, 0x81E6, - 0x223D, 0x81E4, 0x2252, 0x81E0, 0x2260, 0x8182, 0x2261, 0x81DF, - 0x2266, 0x8185, 0x2267, 0x8186, 0x226A, 0x81E1, 0x226B, 0x81E2, - 0x2282, 0x81BC, 0x2283, 0x81BD, 0x2286, 0x81BA, 0x2287, 0x81BB, - 0x22A5, 0x81DB, 0x22BF, 0x8799, 0x2312, 0x81DC, 0x2460, 0x8740, - 0x2461, 0x8741, 0x2462, 0x8742, 0x2463, 0x8743, 0x2464, 0x8744, - 0x2465, 0x8745, 0x2466, 0x8746, 0x2467, 0x8747, 0x2468, 0x8748, - 0x2469, 0x8749, 0x246A, 0x874A, 0x246B, 0x874B, 0x246C, 0x874C, - 0x246D, 0x874D, 0x246E, 0x874E, 0x246F, 0x874F, 0x2470, 0x8750, - 0x2471, 0x8751, 0x2472, 0x8752, 0x2473, 0x8753, 0x2500, 0x849F, - 0x2501, 0x84AA, 0x2502, 0x84A0, 0x2503, 0x84AB, 0x250C, 0x84A1, - 0x250F, 0x84AC, 0x2510, 0x84A2, 0x2513, 0x84AD, 0x2514, 0x84A4, - 0x2517, 0x84AF, 0x2518, 0x84A3, 0x251B, 0x84AE, 0x251C, 0x84A5, - 0x251D, 0x84BA, 0x2520, 0x84B5, 0x2523, 0x84B0, 0x2524, 0x84A7, - 0x2525, 0x84BC, 0x2528, 0x84B7, 0x252B, 0x84B2, 0x252C, 0x84A6, - 0x252F, 0x84B6, 0x2530, 0x84BB, 0x2533, 0x84B1, 0x2534, 0x84A8, - 0x2537, 0x84B8, 0x2538, 0x84BD, 0x253B, 0x84B3, 0x253C, 0x84A9, - 0x253F, 0x84B9, 0x2542, 0x84BE, 0x254B, 0x84B4, 0x25A0, 0x81A1, - 0x25A1, 0x81A0, 0x25B2, 0x81A3, 0x25B3, 0x81A2, 0x25BC, 0x81A5, - 0x25BD, 0x81A4, 0x25C6, 0x819F, 0x25C7, 0x819E, 0x25CB, 0x819B, - 0x25CE, 0x819D, 0x25CF, 0x819C, 0x25EF, 0x81FC, 0x2605, 0x819A, - 0x2606, 0x8199, 0x2640, 0x818A, 0x2642, 0x8189, 0x266A, 0x81F4, - 0x266D, 0x81F3, 0x266F, 0x81F2, 0x3000, 0x8140, 0x3001, 0x8141, - 0x3002, 0x8142, 0x3003, 0x8156, 0x3005, 0x8158, 0x3006, 0x8159, - 0x3007, 0x815A, 0x3008, 0x8171, 0x3009, 0x8172, 0x300A, 0x8173, - 0x300B, 0x8174, 0x300C, 0x8175, 0x300D, 0x8176, 0x300E, 0x8177, - 0x300F, 0x8178, 0x3010, 0x8179, 0x3011, 0x817A, 0x3012, 0x81A7, - 0x3013, 0x81AC, 0x3014, 0x816B, 0x3015, 0x816C, 0x301D, 0x8780, - 0x301F, 0x8781, 0x3041, 0x829F, 0x3042, 0x82A0, 0x3043, 0x82A1, - 0x3044, 0x82A2, 0x3045, 0x82A3, 0x3046, 0x82A4, 0x3047, 0x82A5, - 0x3048, 0x82A6, 0x3049, 0x82A7, 0x304A, 0x82A8, 0x304B, 0x82A9, - 0x304C, 0x82AA, 0x304D, 0x82AB, 0x304E, 0x82AC, 0x304F, 0x82AD, - 0x3050, 0x82AE, 0x3051, 0x82AF, 0x3052, 0x82B0, 0x3053, 0x82B1, - 0x3054, 0x82B2, 0x3055, 0x82B3, 0x3056, 0x82B4, 0x3057, 0x82B5, - 0x3058, 0x82B6, 0x3059, 0x82B7, 0x305A, 0x82B8, 0x305B, 0x82B9, - 0x305C, 0x82BA, 0x305D, 0x82BB, 0x305E, 0x82BC, 0x305F, 0x82BD, - 0x3060, 0x82BE, 0x3061, 0x82BF, 0x3062, 0x82C0, 0x3063, 0x82C1, - 0x3064, 0x82C2, 0x3065, 0x82C3, 0x3066, 0x82C4, 0x3067, 0x82C5, - 0x3068, 0x82C6, 0x3069, 0x82C7, 0x306A, 0x82C8, 0x306B, 0x82C9, - 0x306C, 0x82CA, 0x306D, 0x82CB, 0x306E, 0x82CC, 0x306F, 0x82CD, - 0x3070, 0x82CE, 0x3071, 0x82CF, 0x3072, 0x82D0, 0x3073, 0x82D1, - 0x3074, 0x82D2, 0x3075, 0x82D3, 0x3076, 0x82D4, 0x3077, 0x82D5, - 0x3078, 0x82D6, 0x3079, 0x82D7, 0x307A, 0x82D8, 0x307B, 0x82D9, - 0x307C, 0x82DA, 0x307D, 0x82DB, 0x307E, 0x82DC, 0x307F, 0x82DD, - 0x3080, 0x82DE, 0x3081, 0x82DF, 0x3082, 0x82E0, 0x3083, 0x82E1, - 0x3084, 0x82E2, 0x3085, 0x82E3, 0x3086, 0x82E4, 0x3087, 0x82E5, - 0x3088, 0x82E6, 0x3089, 0x82E7, 0x308A, 0x82E8, 0x308B, 0x82E9, - 0x308C, 0x82EA, 0x308D, 0x82EB, 0x308E, 0x82EC, 0x308F, 0x82ED, - 0x3090, 0x82EE, 0x3091, 0x82EF, 0x3092, 0x82F0, 0x3093, 0x82F1, - 0x309B, 0x814A, 0x309C, 0x814B, 0x309D, 0x8154, 0x309E, 0x8155, - 0x30A1, 0x8340, 0x30A2, 0x8341, 0x30A3, 0x8342, 0x30A4, 0x8343, - 0x30A5, 0x8344, 0x30A6, 0x8345, 0x30A7, 0x8346, 0x30A8, 0x8347, - 0x30A9, 0x8348, 0x30AA, 0x8349, 0x30AB, 0x834A, 0x30AC, 0x834B, - 0x30AD, 0x834C, 0x30AE, 0x834D, 0x30AF, 0x834E, 0x30B0, 0x834F, - 0x30B1, 0x8350, 0x30B2, 0x8351, 0x30B3, 0x8352, 0x30B4, 0x8353, - 0x30B5, 0x8354, 0x30B6, 0x8355, 0x30B7, 0x8356, 0x30B8, 0x8357, - 0x30B9, 0x8358, 0x30BA, 0x8359, 0x30BB, 0x835A, 0x30BC, 0x835B, - 0x30BD, 0x835C, 0x30BE, 0x835D, 0x30BF, 0x835E, 0x30C0, 0x835F, - 0x30C1, 0x8360, 0x30C2, 0x8361, 0x30C3, 0x8362, 0x30C4, 0x8363, - 0x30C5, 0x8364, 0x30C6, 0x8365, 0x30C7, 0x8366, 0x30C8, 0x8367, - 0x30C9, 0x8368, 0x30CA, 0x8369, 0x30CB, 0x836A, 0x30CC, 0x836B, - 0x30CD, 0x836C, 0x30CE, 0x836D, 0x30CF, 0x836E, 0x30D0, 0x836F, - 0x30D1, 0x8370, 0x30D2, 0x8371, 0x30D3, 0x8372, 0x30D4, 0x8373, - 0x30D5, 0x8374, 0x30D6, 0x8375, 0x30D7, 0x8376, 0x30D8, 0x8377, - 0x30D9, 0x8378, 0x30DA, 0x8379, 0x30DB, 0x837A, 0x30DC, 0x837B, - 0x30DD, 0x837C, 0x30DE, 0x837D, 0x30DF, 0x837E, 0x30E0, 0x8380, - 0x30E1, 0x8381, 0x30E2, 0x8382, 0x30E3, 0x8383, 0x30E4, 0x8384, - 0x30E5, 0x8385, 0x30E6, 0x8386, 0x30E7, 0x8387, 0x30E8, 0x8388, - 0x30E9, 0x8389, 0x30EA, 0x838A, 0x30EB, 0x838B, 0x30EC, 0x838C, - 0x30ED, 0x838D, 0x30EE, 0x838E, 0x30EF, 0x838F, 0x30F0, 0x8390, - 0x30F1, 0x8391, 0x30F2, 0x8392, 0x30F3, 0x8393, 0x30F4, 0x8394, - 0x30F5, 0x8395, 0x30F6, 0x8396, 0x30FB, 0x8145, 0x30FC, 0x815B, - 0x30FD, 0x8152, 0x30FE, 0x8153, 0x3231, 0x878A, 0x3232, 0x878B, - 0x3239, 0x878C, 0x32A4, 0x8785, 0x32A5, 0x8786, 0x32A6, 0x8787, - 0x32A7, 0x8788, 0x32A8, 0x8789, 0x3303, 0x8765, 0x330D, 0x8769, - 0x3314, 0x8760, 0x3318, 0x8763, 0x3322, 0x8761, 0x3323, 0x876B, - 0x3326, 0x876A, 0x3327, 0x8764, 0x332B, 0x876C, 0x3336, 0x8766, - 0x333B, 0x876E, 0x3349, 0x875F, 0x334A, 0x876D, 0x334D, 0x8762, - 0x3351, 0x8767, 0x3357, 0x8768, 0x337B, 0x877E, 0x337C, 0x878F, - 0x337D, 0x878E, 0x337E, 0x878D, 0x338E, 0x8772, 0x338F, 0x8773, - 0x339C, 0x876F, 0x339D, 0x8770, 0x339E, 0x8771, 0x33A1, 0x8775, - 0x33C4, 0x8774, 0x33CD, 0x8783, 0x4E00, 0x88EA, 0x4E01, 0x929A, - 0x4E03, 0x8EB5, 0x4E07, 0x969C, 0x4E08, 0x8FE4, 0x4E09, 0x8E4F, - 0x4E0A, 0x8FE3, 0x4E0B, 0x89BA, 0x4E0D, 0x9573, 0x4E0E, 0x975E, - 0x4E10, 0x98A0, 0x4E11, 0x894E, 0x4E14, 0x8A8E, 0x4E15, 0x98A1, - 0x4E16, 0x90A2, 0x4E17, 0x99C0, 0x4E18, 0x8B75, 0x4E19, 0x95B8, - 0x4E1E, 0x8FE5, 0x4E21, 0x97BC, 0x4E26, 0x95C0, 0x4E28, 0xFA68, - 0x4E2A, 0x98A2, 0x4E2D, 0x9286, 0x4E31, 0x98A3, 0x4E32, 0x8BF8, - 0x4E36, 0x98A4, 0x4E38, 0x8ADB, 0x4E39, 0x924F, 0x4E3B, 0x8EE5, - 0x4E3C, 0x98A5, 0x4E3F, 0x98A6, 0x4E42, 0x98A7, 0x4E43, 0x9454, - 0x4E45, 0x8B76, 0x4E4B, 0x9456, 0x4E4D, 0x93E1, 0x4E4E, 0x8CC1, - 0x4E4F, 0x9652, 0x4E55, 0xE568, 0x4E56, 0x98A8, 0x4E57, 0x8FE6, - 0x4E58, 0x98A9, 0x4E59, 0x89B3, 0x4E5D, 0x8BE3, 0x4E5E, 0x8CEE, - 0x4E5F, 0x96E7, 0x4E62, 0x9BA4, 0x4E71, 0x9790, 0x4E73, 0x93FB, - 0x4E7E, 0x8AA3, 0x4E80, 0x8B54, 0x4E82, 0x98AA, 0x4E85, 0x98AB, - 0x4E86, 0x97B9, 0x4E88, 0x975C, 0x4E89, 0x9188, 0x4E8A, 0x98AD, - 0x4E8B, 0x8E96, 0x4E8C, 0x93F1, 0x4E8E, 0x98B0, 0x4E91, 0x895D, - 0x4E92, 0x8CDD, 0x4E94, 0x8CDC, 0x4E95, 0x88E4, 0x4E98, 0x986A, - 0x4E99, 0x9869, 0x4E9B, 0x8DB1, 0x4E9C, 0x889F, 0x4E9E, 0x98B1, - 0x4E9F, 0x98B2, 0x4EA0, 0x98B3, 0x4EA1, 0x9653, 0x4EA2, 0x98B4, - 0x4EA4, 0x8CF0, 0x4EA5, 0x88E5, 0x4EA6, 0x9692, 0x4EA8, 0x8B9C, - 0x4EAB, 0x8B9D, 0x4EAC, 0x8B9E, 0x4EAD, 0x92E0, 0x4EAE, 0x97BA, - 0x4EB0, 0x98B5, 0x4EB3, 0x98B6, 0x4EB6, 0x98B7, 0x4EBA, 0x906C, - 0x4EC0, 0x8F59, 0x4EC1, 0x906D, 0x4EC2, 0x98BC, 0x4EC4, 0x98BA, - 0x4EC6, 0x98BB, 0x4EC7, 0x8B77, 0x4ECA, 0x8DA1, 0x4ECB, 0x89EE, - 0x4ECD, 0x98B9, 0x4ECE, 0x98B8, 0x4ECF, 0x95A7, 0x4ED4, 0x8E65, - 0x4ED5, 0x8E64, 0x4ED6, 0x91BC, 0x4ED7, 0x98BD, 0x4ED8, 0x9574, - 0x4ED9, 0x90E5, 0x4EDD, 0x8157, 0x4EDE, 0x98BE, 0x4EDF, 0x98C0, - 0x4EE1, 0xFA69, 0x4EE3, 0x91E3, 0x4EE4, 0x97DF, 0x4EE5, 0x88C8, - 0x4EED, 0x98BF, 0x4EEE, 0x89BC, 0x4EF0, 0x8BC2, 0x4EF2, 0x9287, - 0x4EF6, 0x8C8F, 0x4EF7, 0x98C1, 0x4EFB, 0x9443, 0x4EFC, 0xFA6A, - 0x4F00, 0xFA6B, 0x4F01, 0x8AE9, 0x4F03, 0xFA6C, 0x4F09, 0x98C2, - 0x4F0A, 0x88C9, 0x4F0D, 0x8CDE, 0x4F0E, 0x8AEA, 0x4F0F, 0x959A, - 0x4F10, 0x94B0, 0x4F11, 0x8B78, 0x4F1A, 0x89EF, 0x4F1C, 0x98E5, - 0x4F1D, 0x9360, 0x4F2F, 0x948C, 0x4F30, 0x98C4, 0x4F34, 0x94BA, - 0x4F36, 0x97E0, 0x4F38, 0x904C, 0x4F39, 0xFA6D, 0x4F3A, 0x8E66, - 0x4F3C, 0x8E97, 0x4F3D, 0x89BE, 0x4F43, 0x92CF, 0x4F46, 0x9241, - 0x4F47, 0x98C8, 0x4F4D, 0x88CA, 0x4F4E, 0x92E1, 0x4F4F, 0x8F5A, - 0x4F50, 0x8DB2, 0x4F51, 0x9743, 0x4F53, 0x91CC, 0x4F55, 0x89BD, - 0x4F56, 0xFA6E, 0x4F57, 0x98C7, 0x4F59, 0x975D, 0x4F5A, 0x98C3, - 0x4F5B, 0x98C5, 0x4F5C, 0x8DEC, 0x4F5D, 0x98C6, 0x4F5E, 0x9B43, - 0x4F69, 0x98CE, 0x4F6F, 0x98D1, 0x4F70, 0x98CF, 0x4F73, 0x89C0, - 0x4F75, 0x95B9, 0x4F76, 0x98C9, 0x4F7B, 0x98CD, 0x4F7C, 0x8CF1, - 0x4F7F, 0x8E67, 0x4F83, 0x8AA4, 0x4F86, 0x98D2, 0x4F88, 0x98CA, - 0x4F8A, 0xFA70, 0x4F8B, 0x97E1, 0x4F8D, 0x8E98, 0x4F8F, 0x98CB, - 0x4F91, 0x98D0, 0x4F92, 0xFA6F, 0x4F94, 0xFA72, 0x4F96, 0x98D3, - 0x4F98, 0x98CC, 0x4F9A, 0xFA71, 0x4F9B, 0x8B9F, 0x4F9D, 0x88CB, - 0x4FA0, 0x8BA0, 0x4FA1, 0x89BF, 0x4FAB, 0x9B44, 0x4FAD, 0x9699, - 0x4FAE, 0x958E, 0x4FAF, 0x8CF2, 0x4FB5, 0x904E, 0x4FB6, 0x97B5, - 0x4FBF, 0x95D6, 0x4FC2, 0x8C57, 0x4FC3, 0x91A3, 0x4FC4, 0x89E2, - 0x4FC9, 0xFA61, 0x4FCA, 0x8F72, 0x4FCD, 0xFA73, 0x4FCE, 0x98D7, - 0x4FD0, 0x98DC, 0x4FD1, 0x98DA, 0x4FD4, 0x98D5, 0x4FD7, 0x91AD, - 0x4FD8, 0x98D8, 0x4FDA, 0x98DB, 0x4FDB, 0x98D9, 0x4FDD, 0x95DB, - 0x4FDF, 0x98D6, 0x4FE1, 0x904D, 0x4FE3, 0x9693, 0x4FE4, 0x98DD, - 0x4FE5, 0x98DE, 0x4FEE, 0x8F43, 0x4FEF, 0x98EB, 0x4FF3, 0x946F, - 0x4FF5, 0x9555, 0x4FF6, 0x98E6, 0x4FF8, 0x95EE, 0x4FFA, 0x89B4, - 0x4FFE, 0x98EA, 0x4FFF, 0xFA76, 0x5005, 0x98E4, 0x5006, 0x98ED, - 0x5009, 0x9171, 0x500B, 0x8CC2, 0x500D, 0x947B, 0x500F, 0xE0C5, - 0x5011, 0x98EC, 0x5012, 0x937C, 0x5014, 0x98E1, 0x5016, 0x8CF4, - 0x5019, 0x8CF3, 0x501A, 0x98DF, 0x501E, 0xFA77, 0x501F, 0x8ED8, - 0x5021, 0x98E7, 0x5022, 0xFA75, 0x5023, 0x95ED, 0x5024, 0x926C, - 0x5025, 0x98E3, 0x5026, 0x8C91, 0x5028, 0x98E0, 0x5029, 0x98E8, - 0x502A, 0x98E2, 0x502B, 0x97CF, 0x502C, 0x98E9, 0x502D, 0x9860, - 0x5036, 0x8BE4, 0x5039, 0x8C90, 0x5040, 0xFA74, 0x5042, 0xFA7A, - 0x5043, 0x98EE, 0x5046, 0xFA78, 0x5047, 0x98EF, 0x5048, 0x98F3, - 0x5049, 0x88CC, 0x504F, 0x95CE, 0x5050, 0x98F2, 0x5055, 0x98F1, - 0x5056, 0x98F5, 0x505A, 0x98F4, 0x505C, 0x92E2, 0x5065, 0x8C92, - 0x506C, 0x98F6, 0x5070, 0xFA79, 0x5072, 0x8EC3, 0x5074, 0x91A4, - 0x5075, 0x92E3, 0x5076, 0x8BF4, 0x5078, 0x98F7, 0x507D, 0x8B55, - 0x5080, 0x98F8, 0x5085, 0x98FA, 0x508D, 0x9654, 0x5091, 0x8C86, - 0x5094, 0xFA7B, 0x5098, 0x8E50, 0x5099, 0x94F5, 0x509A, 0x98F9, - 0x50AC, 0x8DC3, 0x50AD, 0x9762, 0x50B2, 0x98FC, 0x50B3, 0x9942, - 0x50B4, 0x98FB, 0x50B5, 0x8DC2, 0x50B7, 0x8F9D, 0x50BE, 0x8C58, - 0x50C2, 0x9943, 0x50C5, 0x8BCD, 0x50C9, 0x9940, 0x50CA, 0x9941, - 0x50CD, 0x93AD, 0x50CF, 0x919C, 0x50D1, 0x8BA1, 0x50D5, 0x966C, - 0x50D6, 0x9944, 0x50D8, 0xFA7D, 0x50DA, 0x97BB, 0x50DE, 0x9945, - 0x50E3, 0x9948, 0x50E5, 0x9946, 0x50E7, 0x916D, 0x50ED, 0x9947, - 0x50EE, 0x9949, 0x50F4, 0xFA7C, 0x50F5, 0x994B, 0x50F9, 0x994A, - 0x50FB, 0x95C6, 0x5100, 0x8B56, 0x5101, 0x994D, 0x5102, 0x994E, - 0x5104, 0x89AD, 0x5109, 0x994C, 0x5112, 0x8EF2, 0x5114, 0x9951, - 0x5115, 0x9950, 0x5116, 0x994F, 0x5118, 0x98D4, 0x511A, 0x9952, - 0x511F, 0x8F9E, 0x5121, 0x9953, 0x512A, 0x9744, 0x5132, 0x96D7, - 0x5137, 0x9955, 0x513A, 0x9954, 0x513B, 0x9957, 0x513C, 0x9956, - 0x513F, 0x9958, 0x5140, 0x9959, 0x5141, 0x88F2, 0x5143, 0x8CB3, - 0x5144, 0x8C5A, 0x5145, 0x8F5B, 0x5146, 0x929B, 0x5147, 0x8BA2, - 0x5148, 0x90E6, 0x5149, 0x8CF5, 0x514A, 0xFA7E, 0x514B, 0x8D8E, - 0x514C, 0x995B, 0x514D, 0x96C6, 0x514E, 0x9365, 0x5150, 0x8E99, - 0x5152, 0x995A, 0x5154, 0x995C, 0x515A, 0x937D, 0x515C, 0x8A95, - 0x5162, 0x995D, 0x5164, 0xFA80, 0x5165, 0x93FC, 0x5168, 0x9153, - 0x5169, 0x995F, 0x516A, 0x9960, 0x516B, 0x94AA, 0x516C, 0x8CF6, - 0x516D, 0x985A, 0x516E, 0x9961, 0x5171, 0x8BA4, 0x5175, 0x95BA, - 0x5176, 0x91B4, 0x5177, 0x8BEF, 0x5178, 0x9354, 0x517C, 0x8C93, - 0x5180, 0x9962, 0x5182, 0x9963, 0x5185, 0x93E0, 0x5186, 0x897E, - 0x5189, 0x9966, 0x518A, 0x8DFB, 0x518C, 0x9965, 0x518D, 0x8DC4, - 0x518F, 0x9967, 0x5190, 0xE3EC, 0x5191, 0x9968, 0x5192, 0x9660, - 0x5193, 0x9969, 0x5195, 0x996A, 0x5196, 0x996B, 0x5197, 0x8FE7, - 0x5199, 0x8ECA, 0x519D, 0xFA81, 0x51A0, 0x8AA5, 0x51A2, 0x996E, - 0x51A4, 0x996C, 0x51A5, 0x96BB, 0x51A6, 0x996D, 0x51A8, 0x9579, - 0x51A9, 0x996F, 0x51AA, 0x9970, 0x51AB, 0x9971, 0x51AC, 0x937E, - 0x51B0, 0x9975, 0x51B1, 0x9973, 0x51B2, 0x9974, 0x51B3, 0x9972, - 0x51B4, 0x8DE1, 0x51B5, 0x9976, 0x51B6, 0x96E8, 0x51B7, 0x97E2, - 0x51BD, 0x9977, 0x51BE, 0xFA82, 0x51C4, 0x90A6, 0x51C5, 0x9978, - 0x51C6, 0x8F79, 0x51C9, 0x9979, 0x51CB, 0x929C, 0x51CC, 0x97BD, - 0x51CD, 0x9380, 0x51D6, 0x99C3, 0x51DB, 0x997A, 0x51DC, 0xEAA3, - 0x51DD, 0x8BC3, 0x51E0, 0x997B, 0x51E1, 0x967D, 0x51E6, 0x8F88, - 0x51E7, 0x91FA, 0x51E9, 0x997D, 0x51EA, 0x93E2, 0x51EC, 0xFA83, - 0x51ED, 0x997E, 0x51F0, 0x9980, 0x51F1, 0x8A4D, 0x51F5, 0x9981, - 0x51F6, 0x8BA5, 0x51F8, 0x93CA, 0x51F9, 0x899A, 0x51FA, 0x8F6F, - 0x51FD, 0x949F, 0x51FE, 0x9982, 0x5200, 0x9381, 0x5203, 0x906E, - 0x5204, 0x9983, 0x5206, 0x95AA, 0x5207, 0x90D8, 0x5208, 0x8AA0, - 0x520A, 0x8AA7, 0x520B, 0x9984, 0x520E, 0x9986, 0x5211, 0x8C59, - 0x5214, 0x9985, 0x5215, 0xFA84, 0x5217, 0x97F1, 0x521D, 0x8F89, - 0x5224, 0x94BB, 0x5225, 0x95CA, 0x5227, 0x9987, 0x5229, 0x9798, - 0x522A, 0x9988, 0x522E, 0x9989, 0x5230, 0x939E, 0x5233, 0x998A, - 0x5236, 0x90A7, 0x5237, 0x8DFC, 0x5238, 0x8C94, 0x5239, 0x998B, - 0x523A, 0x8E68, 0x523B, 0x8D8F, 0x5243, 0x92E4, 0x5244, 0x998D, - 0x5247, 0x91A5, 0x524A, 0x8DED, 0x524B, 0x998E, 0x524C, 0x998F, - 0x524D, 0x914F, 0x524F, 0x998C, 0x5254, 0x9991, 0x5256, 0x9655, - 0x525B, 0x8D84, 0x525E, 0x9990, 0x5263, 0x8C95, 0x5264, 0x8DDC, - 0x5265, 0x948D, 0x5269, 0x9994, 0x526A, 0x9992, 0x526F, 0x959B, - 0x5270, 0x8FE8, 0x5271, 0x999B, 0x5272, 0x8A84, 0x5273, 0x9995, - 0x5274, 0x9993, 0x5275, 0x916E, 0x527D, 0x9997, 0x527F, 0x9996, - 0x5283, 0x8A63, 0x5287, 0x8C80, 0x5288, 0x999C, 0x5289, 0x97AB, - 0x528D, 0x9998, 0x5291, 0x999D, 0x5292, 0x999A, 0x5294, 0x9999, - 0x529B, 0x97CD, 0x529C, 0xFA85, 0x529F, 0x8CF7, 0x52A0, 0x89C1, - 0x52A3, 0x97F2, 0x52A6, 0xFA86, 0x52A9, 0x8F95, 0x52AA, 0x9377, - 0x52AB, 0x8D85, 0x52AC, 0x99A0, 0x52AD, 0x99A1, 0x52AF, 0xFB77, - 0x52B1, 0x97E3, 0x52B4, 0x984A, 0x52B5, 0x99A3, 0x52B9, 0x8CF8, - 0x52BC, 0x99A2, 0x52BE, 0x8A4E, 0x52C0, 0xFA87, 0x52C1, 0x99A4, - 0x52C3, 0x9675, 0x52C5, 0x92BA, 0x52C7, 0x9745, 0x52C9, 0x95D7, - 0x52CD, 0x99A5, 0x52D2, 0xE8D3, 0x52D5, 0x93AE, 0x52D7, 0x99A6, - 0x52D8, 0x8AA8, 0x52D9, 0x96B1, 0x52DB, 0xFA88, 0x52DD, 0x8F9F, - 0x52DE, 0x99A7, 0x52DF, 0x95E5, 0x52E0, 0x99AB, 0x52E2, 0x90A8, - 0x52E3, 0x99A8, 0x52E4, 0x8BCE, 0x52E6, 0x99A9, 0x52E7, 0x8AA9, - 0x52F2, 0x8C4D, 0x52F3, 0x99AC, 0x52F5, 0x99AD, 0x52F8, 0x99AE, - 0x52F9, 0x99AF, 0x52FA, 0x8ED9, 0x52FE, 0x8CF9, 0x52FF, 0x96DC, - 0x5300, 0xFA89, 0x5301, 0x96E6, 0x5302, 0x93F5, 0x5305, 0x95EF, - 0x5306, 0x99B0, 0x5307, 0xFA8A, 0x5308, 0x99B1, 0x530D, 0x99B3, - 0x530F, 0x99B5, 0x5310, 0x99B4, 0x5315, 0x99B6, 0x5316, 0x89BB, - 0x5317, 0x966B, 0x5319, 0x8DFA, 0x531A, 0x99B7, 0x531D, 0x9178, - 0x5320, 0x8FA0, 0x5321, 0x8BA7, 0x5323, 0x99B8, 0x5324, 0xFA8B, - 0x532A, 0x94D9, 0x532F, 0x99B9, 0x5331, 0x99BA, 0x5333, 0x99BB, - 0x5338, 0x99BC, 0x5339, 0x9543, 0x533A, 0x8BE6, 0x533B, 0x88E3, - 0x533F, 0x93BD, 0x5340, 0x99BD, 0x5341, 0x8F5C, 0x5343, 0x90E7, - 0x5345, 0x99BF, 0x5346, 0x99BE, 0x5347, 0x8FA1, 0x5348, 0x8CDF, - 0x5349, 0x99C1, 0x534A, 0x94BC, 0x534D, 0x99C2, 0x5351, 0x94DA, - 0x5352, 0x91B2, 0x5353, 0x91EC, 0x5354, 0x8BA6, 0x5357, 0x93EC, - 0x5358, 0x9250, 0x535A, 0x948E, 0x535C, 0x966D, 0x535E, 0x99C4, - 0x5360, 0x90E8, 0x5366, 0x8C54, 0x5369, 0x99C5, 0x536E, 0x99C6, - 0x536F, 0x894B, 0x5370, 0x88F3, 0x5371, 0x8AEB, 0x5372, 0xFA8C, - 0x5373, 0x91A6, 0x5374, 0x8B70, 0x5375, 0x9791, 0x5377, 0x99C9, - 0x5378, 0x89B5, 0x537B, 0x99C8, 0x537F, 0x8BA8, 0x5382, 0x99CA, - 0x5384, 0x96EF, 0x5393, 0xFA8D, 0x5396, 0x99CB, 0x5398, 0x97D0, - 0x539A, 0x8CFA, 0x539F, 0x8CB4, 0x53A0, 0x99CC, 0x53A5, 0x99CE, - 0x53A6, 0x99CD, 0x53A8, 0x907E, 0x53A9, 0x8958, 0x53AD, 0x897D, - 0x53AE, 0x99CF, 0x53B0, 0x99D0, 0x53B2, 0xFA8E, 0x53B3, 0x8CB5, - 0x53B6, 0x99D1, 0x53BB, 0x8B8E, 0x53C2, 0x8E51, 0x53C3, 0x99D2, - 0x53C8, 0x9694, 0x53C9, 0x8DB3, 0x53CA, 0x8B79, 0x53CB, 0x9746, - 0x53CC, 0x916F, 0x53CD, 0x94BD, 0x53CE, 0x8EFB, 0x53D4, 0x8F66, - 0x53D6, 0x8EE6, 0x53D7, 0x8EF3, 0x53D9, 0x8F96, 0x53DB, 0x94BE, - 0x53DD, 0xFA8F, 0x53DF, 0x99D5, 0x53E1, 0x8962, 0x53E2, 0x9170, - 0x53E3, 0x8CFB, 0x53E4, 0x8CC3, 0x53E5, 0x8BE5, 0x53E8, 0x99D9, - 0x53E9, 0x9240, 0x53EA, 0x91FC, 0x53EB, 0x8BA9, 0x53EC, 0x8FA2, - 0x53ED, 0x99DA, 0x53EE, 0x99D8, 0x53EF, 0x89C2, 0x53F0, 0x91E4, - 0x53F1, 0x8EB6, 0x53F2, 0x8E6A, 0x53F3, 0x8945, 0x53F6, 0x8A90, - 0x53F7, 0x8D86, 0x53F8, 0x8E69, 0x53FA, 0x99DB, 0x5401, 0x99DC, - 0x5403, 0x8B68, 0x5404, 0x8A65, 0x5408, 0x8D87, 0x5409, 0x8B67, - 0x540A, 0x92DD, 0x540B, 0x8944, 0x540C, 0x93AF, 0x540D, 0x96BC, - 0x540E, 0x8D40, 0x540F, 0x9799, 0x5410, 0x9366, 0x5411, 0x8CFC, - 0x541B, 0x8C4E, 0x541D, 0x99E5, 0x541F, 0x8BE1, 0x5420, 0x9669, - 0x5426, 0x94DB, 0x5429, 0x99E4, 0x542B, 0x8ADC, 0x542C, 0x99DF, - 0x542D, 0x99E0, 0x542E, 0x99E2, 0x5436, 0x99E3, 0x5438, 0x8B7A, - 0x5439, 0x9081, 0x543B, 0x95AB, 0x543C, 0x99E1, 0x543D, 0x99DD, - 0x543E, 0x8CE1, 0x5440, 0x99DE, 0x5442, 0x9843, 0x5446, 0x95F0, - 0x5448, 0x92E6, 0x5449, 0x8CE0, 0x544A, 0x8D90, 0x544E, 0x99E6, - 0x5451, 0x93DB, 0x545F, 0x99EA, 0x5468, 0x8EFC, 0x546A, 0x8EF4, - 0x5470, 0x99ED, 0x5471, 0x99EB, 0x5473, 0x96A1, 0x5475, 0x99E8, - 0x5476, 0x99F1, 0x5477, 0x99EC, 0x547B, 0x99EF, 0x547C, 0x8CC4, - 0x547D, 0x96BD, 0x5480, 0x99F0, 0x5484, 0x99F2, 0x5486, 0x99F4, - 0x548A, 0xFA92, 0x548B, 0x8DEE, 0x548C, 0x9861, 0x548E, 0x99E9, - 0x548F, 0x99E7, 0x5490, 0x99F3, 0x5492, 0x99EE, 0x549C, 0xFA91, - 0x54A2, 0x99F6, 0x54A4, 0x9A42, 0x54A5, 0x99F8, 0x54A8, 0x99FC, - 0x54A9, 0xFA93, 0x54AB, 0x9A40, 0x54AC, 0x99F9, 0x54AF, 0x9A5D, - 0x54B2, 0x8DE7, 0x54B3, 0x8A50, 0x54B8, 0x99F7, 0x54BC, 0x9A44, - 0x54BD, 0x88F4, 0x54BE, 0x9A43, 0x54C0, 0x88A3, 0x54C1, 0x9569, - 0x54C2, 0x9A41, 0x54C4, 0x99FA, 0x54C7, 0x99F5, 0x54C8, 0x99FB, - 0x54C9, 0x8DC6, 0x54D8, 0x9A45, 0x54E1, 0x88F5, 0x54E2, 0x9A4E, - 0x54E5, 0x9A46, 0x54E6, 0x9A47, 0x54E8, 0x8FA3, 0x54E9, 0x9689, - 0x54ED, 0x9A4C, 0x54EE, 0x9A4B, 0x54F2, 0x934E, 0x54FA, 0x9A4D, - 0x54FD, 0x9A4A, 0x54FF, 0xFA94, 0x5504, 0x8953, 0x5506, 0x8DB4, - 0x5507, 0x904F, 0x550F, 0x9A48, 0x5510, 0x9382, 0x5514, 0x9A49, - 0x5516, 0x88A0, 0x552E, 0x9A53, 0x552F, 0x9742, 0x5531, 0x8FA5, - 0x5533, 0x9A59, 0x5538, 0x9A58, 0x5539, 0x9A4F, 0x553E, 0x91C1, - 0x5540, 0x9A50, 0x5544, 0x91ED, 0x5545, 0x9A55, 0x5546, 0x8FA4, - 0x554C, 0x9A52, 0x554F, 0x96E2, 0x5553, 0x8C5B, 0x5556, 0x9A56, - 0x5557, 0x9A57, 0x555C, 0x9A54, 0x555D, 0x9A5A, 0x5563, 0x9A51, - 0x557B, 0x9A60, 0x557C, 0x9A65, 0x557E, 0x9A61, 0x5580, 0x9A5C, - 0x5583, 0x9A66, 0x5584, 0x9150, 0x5586, 0xFA95, 0x5587, 0x9A68, - 0x5589, 0x8D41, 0x558A, 0x9A5E, 0x558B, 0x929D, 0x5598, 0x9A62, - 0x5599, 0x9A5B, 0x559A, 0x8AAB, 0x559C, 0x8AEC, 0x559D, 0x8A85, - 0x559E, 0x9A63, 0x559F, 0x9A5F, 0x55A7, 0x8C96, 0x55A8, 0x9A69, - 0x55A9, 0x9A67, 0x55AA, 0x9172, 0x55AB, 0x8B69, 0x55AC, 0x8BAA, - 0x55AE, 0x9A64, 0x55B0, 0x8BF2, 0x55B6, 0x8963, 0x55C4, 0x9A6D, - 0x55C5, 0x9A6B, 0x55C7, 0x9AA5, 0x55D4, 0x9A70, 0x55DA, 0x9A6A, - 0x55DC, 0x9A6E, 0x55DF, 0x9A6C, 0x55E3, 0x8E6B, 0x55E4, 0x9A6F, - 0x55F7, 0x9A72, 0x55F9, 0x9A77, 0x55FD, 0x9A75, 0x55FE, 0x9A74, - 0x5606, 0x9251, 0x5609, 0x89C3, 0x5614, 0x9A71, 0x5616, 0x9A73, - 0x5617, 0x8FA6, 0x5618, 0x8952, 0x561B, 0x9A76, 0x5629, 0x89DC, - 0x562F, 0x9A82, 0x5631, 0x8FFA, 0x5632, 0x9A7D, 0x5634, 0x9A7B, - 0x5636, 0x9A7C, 0x5638, 0x9A7E, 0x5642, 0x895C, 0x564C, 0x9158, - 0x564E, 0x9A78, 0x5650, 0x9A79, 0x565B, 0x8A9A, 0x5664, 0x9A81, - 0x5668, 0x8AED, 0x566A, 0x9A84, 0x566B, 0x9A80, 0x566C, 0x9A83, - 0x5674, 0x95AC, 0x5678, 0x93D3, 0x567A, 0x94B6, 0x5680, 0x9A86, - 0x5686, 0x9A85, 0x5687, 0x8A64, 0x568A, 0x9A87, 0x568F, 0x9A8A, - 0x5694, 0x9A89, 0x56A0, 0x9A88, 0x56A2, 0x9458, 0x56A5, 0x9A8B, - 0x56AE, 0x9A8C, 0x56B4, 0x9A8E, 0x56B6, 0x9A8D, 0x56BC, 0x9A90, - 0x56C0, 0x9A93, 0x56C1, 0x9A91, 0x56C2, 0x9A8F, 0x56C3, 0x9A92, - 0x56C8, 0x9A94, 0x56CE, 0x9A95, 0x56D1, 0x9A96, 0x56D3, 0x9A97, - 0x56D7, 0x9A98, 0x56D8, 0x9964, 0x56DA, 0x8EFA, 0x56DB, 0x8E6C, - 0x56DE, 0x89F1, 0x56E0, 0x88F6, 0x56E3, 0x9263, 0x56EE, 0x9A99, - 0x56F0, 0x8DA2, 0x56F2, 0x88CD, 0x56F3, 0x907D, 0x56F9, 0x9A9A, - 0x56FA, 0x8CC5, 0x56FD, 0x8D91, 0x56FF, 0x9A9C, 0x5700, 0x9A9B, - 0x5703, 0x95DE, 0x5704, 0x9A9D, 0x5708, 0x9A9F, 0x5709, 0x9A9E, - 0x570B, 0x9AA0, 0x570D, 0x9AA1, 0x570F, 0x8C97, 0x5712, 0x8980, - 0x5713, 0x9AA2, 0x5716, 0x9AA4, 0x5718, 0x9AA3, 0x571C, 0x9AA6, - 0x571F, 0x9379, 0x5726, 0x9AA7, 0x5727, 0x88B3, 0x5728, 0x8DDD, - 0x572D, 0x8C5C, 0x5730, 0x926E, 0x5737, 0x9AA8, 0x5738, 0x9AA9, - 0x573B, 0x9AAB, 0x5740, 0x9AAC, 0x5742, 0x8DE2, 0x5747, 0x8BCF, - 0x574A, 0x9656, 0x574E, 0x9AAA, 0x574F, 0x9AAD, 0x5750, 0x8DBF, - 0x5751, 0x8D42, 0x5759, 0xFA96, 0x5761, 0x9AB1, 0x5764, 0x8DA3, - 0x5765, 0xFA97, 0x5766, 0x9252, 0x5769, 0x9AAE, 0x576A, 0x92D8, - 0x577F, 0x9AB2, 0x5782, 0x9082, 0x5788, 0x9AB0, 0x5789, 0x9AB3, - 0x578B, 0x8C5E, 0x5793, 0x9AB4, 0x57A0, 0x9AB5, 0x57A2, 0x8D43, - 0x57A3, 0x8A5F, 0x57A4, 0x9AB7, 0x57AA, 0x9AB8, 0x57AC, 0xFA98, - 0x57B0, 0x9AB9, 0x57B3, 0x9AB6, 0x57C0, 0x9AAF, 0x57C3, 0x9ABA, - 0x57C6, 0x9ABB, 0x57C7, 0xFA9A, 0x57C8, 0xFA99, 0x57CB, 0x9684, - 0x57CE, 0x8FE9, 0x57D2, 0x9ABD, 0x57D3, 0x9ABE, 0x57D4, 0x9ABC, - 0x57D6, 0x9AC0, 0x57DC, 0x9457, 0x57DF, 0x88E6, 0x57E0, 0x9575, - 0x57E3, 0x9AC1, 0x57F4, 0x8FFB, 0x57F7, 0x8EB7, 0x57F9, 0x947C, - 0x57FA, 0x8AEE, 0x57FC, 0x8DE9, 0x5800, 0x9678, 0x5802, 0x93B0, - 0x5805, 0x8C98, 0x5806, 0x91CD, 0x580A, 0x9ABF, 0x580B, 0x9AC2, - 0x5815, 0x91C2, 0x5819, 0x9AC3, 0x581D, 0x9AC4, 0x5821, 0x9AC6, - 0x5824, 0x92E7, 0x582A, 0x8AAC, 0x582F, 0xEA9F, 0x5830, 0x8981, - 0x5831, 0x95F1, 0x5834, 0x8FEA, 0x5835, 0x9367, 0x583A, 0x8DE4, - 0x583D, 0x9ACC, 0x5840, 0x95BB, 0x5841, 0x97DB, 0x584A, 0x89F2, - 0x584B, 0x9AC8, 0x5851, 0x9159, 0x5852, 0x9ACB, 0x5854, 0x9383, - 0x5857, 0x9368, 0x5858, 0x9384, 0x5859, 0x94B7, 0x585A, 0x92CB, - 0x585E, 0x8DC7, 0x5862, 0x9AC7, 0x5869, 0x8996, 0x586B, 0x9355, - 0x5870, 0x9AC9, 0x5872, 0x9AC5, 0x5875, 0x906F, 0x5879, 0x9ACD, - 0x587E, 0x8F6D, 0x5883, 0x8BAB, 0x5885, 0x9ACE, 0x5893, 0x95E6, - 0x5897, 0x919D, 0x589C, 0x92C4, 0x589E, 0xFA9D, 0x589F, 0x9AD0, - 0x58A8, 0x966E, 0x58AB, 0x9AD1, 0x58AE, 0x9AD6, 0x58B2, 0xFA9E, - 0x58B3, 0x95AD, 0x58B8, 0x9AD5, 0x58B9, 0x9ACF, 0x58BA, 0x9AD2, - 0x58BB, 0x9AD4, 0x58BE, 0x8DA4, 0x58C1, 0x95C7, 0x58C5, 0x9AD7, - 0x58C7, 0x9264, 0x58CA, 0x89F3, 0x58CC, 0x8FEB, 0x58D1, 0x9AD9, - 0x58D3, 0x9AD8, 0x58D5, 0x8D88, 0x58D7, 0x9ADA, 0x58D8, 0x9ADC, - 0x58D9, 0x9ADB, 0x58DC, 0x9ADE, 0x58DE, 0x9AD3, 0x58DF, 0x9AE0, - 0x58E4, 0x9ADF, 0x58E5, 0x9ADD, 0x58EB, 0x8E6D, 0x58EC, 0x9070, - 0x58EE, 0x9173, 0x58EF, 0x9AE1, 0x58F0, 0x90BA, 0x58F1, 0x88EB, - 0x58F2, 0x9484, 0x58F7, 0x92D9, 0x58F9, 0x9AE3, 0x58FA, 0x9AE2, - 0x58FB, 0x9AE4, 0x58FC, 0x9AE5, 0x58FD, 0x9AE6, 0x5902, 0x9AE7, - 0x5909, 0x95CF, 0x590A, 0x9AE8, 0x590B, 0xFA9F, 0x590F, 0x89C4, - 0x5910, 0x9AE9, 0x5915, 0x975B, 0x5916, 0x8A4F, 0x5918, 0x99C7, - 0x5919, 0x8F67, 0x591A, 0x91BD, 0x591B, 0x9AEA, 0x591C, 0x96E9, - 0x5922, 0x96B2, 0x5925, 0x9AEC, 0x5927, 0x91E5, 0x5929, 0x9356, - 0x592A, 0x91BE, 0x592B, 0x9576, 0x592C, 0x9AED, 0x592D, 0x9AEE, - 0x592E, 0x899B, 0x5931, 0x8EB8, 0x5932, 0x9AEF, 0x5937, 0x88CE, - 0x5938, 0x9AF0, 0x593E, 0x9AF1, 0x5944, 0x8982, 0x5947, 0x8AEF, - 0x5948, 0x93DE, 0x5949, 0x95F2, 0x594E, 0x9AF5, 0x594F, 0x9174, - 0x5950, 0x9AF4, 0x5951, 0x8C5F, 0x5953, 0xFAA0, 0x5954, 0x967A, - 0x5955, 0x9AF3, 0x5957, 0x9385, 0x5958, 0x9AF7, 0x595A, 0x9AF6, - 0x595B, 0xFAA1, 0x595D, 0xFAA2, 0x5960, 0x9AF9, 0x5962, 0x9AF8, - 0x5963, 0xFAA3, 0x5965, 0x899C, 0x5967, 0x9AFA, 0x5968, 0x8FA7, - 0x5969, 0x9AFC, 0x596A, 0x9244, 0x596C, 0x9AFB, 0x596E, 0x95B1, - 0x5973, 0x8F97, 0x5974, 0x937A, 0x5978, 0x9B40, 0x597D, 0x8D44, - 0x5981, 0x9B41, 0x5982, 0x9440, 0x5983, 0x94DC, 0x5984, 0x96CF, - 0x598A, 0x9444, 0x598D, 0x9B4A, 0x5993, 0x8B57, 0x5996, 0x9764, - 0x5999, 0x96AD, 0x599B, 0x9BAA, 0x599D, 0x9B42, 0x59A3, 0x9B45, - 0x59A4, 0xFAA4, 0x59A5, 0x91C3, 0x59A8, 0x9657, 0x59AC, 0x9369, - 0x59B2, 0x9B46, 0x59B9, 0x9685, 0x59BA, 0xFAA5, 0x59BB, 0x8DC8, - 0x59BE, 0x8FA8, 0x59C6, 0x9B47, 0x59C9, 0x8E6F, 0x59CB, 0x8E6E, - 0x59D0, 0x88B7, 0x59D1, 0x8CC6, 0x59D3, 0x90A9, 0x59D4, 0x88CF, - 0x59D9, 0x9B4B, 0x59DA, 0x9B4C, 0x59DC, 0x9B49, 0x59E5, 0x8957, - 0x59E6, 0x8AAD, 0x59E8, 0x9B48, 0x59EA, 0x96C3, 0x59EB, 0x9550, - 0x59F6, 0x88A6, 0x59FB, 0x88F7, 0x59FF, 0x8E70, 0x5A01, 0x88D0, - 0x5A03, 0x88A1, 0x5A09, 0x9B51, 0x5A11, 0x9B4F, 0x5A18, 0x96BA, - 0x5A1A, 0x9B52, 0x5A1C, 0x9B50, 0x5A1F, 0x9B4E, 0x5A20, 0x9050, - 0x5A25, 0x9B4D, 0x5A29, 0x95D8, 0x5A2F, 0x8CE2, 0x5A35, 0x9B56, - 0x5A36, 0x9B57, 0x5A3C, 0x8FA9, 0x5A40, 0x9B53, 0x5A41, 0x984B, - 0x5A46, 0x946B, 0x5A49, 0x9B55, 0x5A5A, 0x8DA5, 0x5A62, 0x9B58, - 0x5A66, 0x9577, 0x5A6A, 0x9B59, 0x5A6C, 0x9B54, 0x5A7F, 0x96B9, - 0x5A92, 0x947D, 0x5A9A, 0x9B5A, 0x5A9B, 0x9551, 0x5ABC, 0x9B5B, - 0x5ABD, 0x9B5F, 0x5ABE, 0x9B5C, 0x5AC1, 0x89C5, 0x5AC2, 0x9B5E, - 0x5AC9, 0x8EB9, 0x5ACB, 0x9B5D, 0x5ACC, 0x8C99, 0x5AD0, 0x9B6B, - 0x5AD6, 0x9B64, 0x5AD7, 0x9B61, 0x5AE1, 0x9284, 0x5AE3, 0x9B60, - 0x5AE6, 0x9B62, 0x5AE9, 0x9B63, 0x5AFA, 0x9B65, 0x5AFB, 0x9B66, - 0x5B09, 0x8AF0, 0x5B0B, 0x9B68, 0x5B0C, 0x9B67, 0x5B16, 0x9B69, - 0x5B22, 0x8FEC, 0x5B2A, 0x9B6C, 0x5B2C, 0x92DA, 0x5B30, 0x8964, - 0x5B32, 0x9B6A, 0x5B36, 0x9B6D, 0x5B3E, 0x9B6E, 0x5B40, 0x9B71, - 0x5B43, 0x9B6F, 0x5B45, 0x9B70, 0x5B50, 0x8E71, 0x5B51, 0x9B72, - 0x5B54, 0x8D45, 0x5B55, 0x9B73, 0x5B56, 0xFAA6, 0x5B57, 0x8E9A, - 0x5B58, 0x91B6, 0x5B5A, 0x9B74, 0x5B5B, 0x9B75, 0x5B5C, 0x8E79, - 0x5B5D, 0x8D46, 0x5B5F, 0x96D0, 0x5B63, 0x8B47, 0x5B64, 0x8CC7, - 0x5B65, 0x9B76, 0x5B66, 0x8A77, 0x5B69, 0x9B77, 0x5B6B, 0x91B7, - 0x5B70, 0x9B78, 0x5B71, 0x9BA1, 0x5B73, 0x9B79, 0x5B75, 0x9B7A, - 0x5B78, 0x9B7B, 0x5B7A, 0x9B7D, 0x5B80, 0x9B7E, 0x5B83, 0x9B80, - 0x5B85, 0x91EE, 0x5B87, 0x8946, 0x5B88, 0x8EE7, 0x5B89, 0x88C0, - 0x5B8B, 0x9176, 0x5B8C, 0x8AAE, 0x5B8D, 0x8EB3, 0x5B8F, 0x8D47, - 0x5B95, 0x9386, 0x5B97, 0x8F40, 0x5B98, 0x8AAF, 0x5B99, 0x9288, - 0x5B9A, 0x92E8, 0x5B9B, 0x88B6, 0x5B9C, 0x8B58, 0x5B9D, 0x95F3, - 0x5B9F, 0x8EC0, 0x5BA2, 0x8B71, 0x5BA3, 0x90E9, 0x5BA4, 0x8EBA, - 0x5BA5, 0x9747, 0x5BA6, 0x9B81, 0x5BAE, 0x8B7B, 0x5BB0, 0x8DC9, - 0x5BB3, 0x8A51, 0x5BB4, 0x8983, 0x5BB5, 0x8FAA, 0x5BB6, 0x89C6, - 0x5BB8, 0x9B82, 0x5BB9, 0x9765, 0x5BBF, 0x8F68, 0x5BC0, 0xFAA7, - 0x5BC2, 0x8EE2, 0x5BC3, 0x9B83, 0x5BC4, 0x8AF1, 0x5BC5, 0x93D0, - 0x5BC6, 0x96A7, 0x5BC7, 0x9B84, 0x5BC9, 0x9B85, 0x5BCC, 0x9578, - 0x5BD0, 0x9B87, 0x5BD2, 0x8AA6, 0x5BD3, 0x8BF5, 0x5BD4, 0x9B86, - 0x5BD8, 0xFAA9, 0x5BDB, 0x8AB0, 0x5BDD, 0x9051, 0x5BDE, 0x9B8B, - 0x5BDF, 0x8E40, 0x5BE1, 0x89C7, 0x5BE2, 0x9B8A, 0x5BE4, 0x9B88, - 0x5BE5, 0x9B8C, 0x5BE6, 0x9B89, 0x5BE7, 0x944A, 0x5BE8, 0x9ECB, - 0x5BE9, 0x9052, 0x5BEB, 0x9B8D, 0x5BEC, 0xFAAA, 0x5BEE, 0x97BE, - 0x5BF0, 0x9B8E, 0x5BF3, 0x9B90, 0x5BF5, 0x929E, 0x5BF6, 0x9B8F, - 0x5BF8, 0x90A1, 0x5BFA, 0x8E9B, 0x5BFE, 0x91CE, 0x5BFF, 0x8EF5, - 0x5C01, 0x9595, 0x5C02, 0x90EA, 0x5C04, 0x8ECB, 0x5C05, 0x9B91, - 0x5C06, 0x8FAB, 0x5C07, 0x9B92, 0x5C08, 0x9B93, 0x5C09, 0x88D1, - 0x5C0A, 0x91B8, 0x5C0B, 0x9071, 0x5C0D, 0x9B94, 0x5C0E, 0x93B1, - 0x5C0F, 0x8FAC, 0x5C11, 0x8FAD, 0x5C13, 0x9B95, 0x5C16, 0x90EB, - 0x5C1A, 0x8FAE, 0x5C1E, 0xFAAB, 0x5C20, 0x9B96, 0x5C22, 0x9B97, - 0x5C24, 0x96DE, 0x5C28, 0x9B98, 0x5C2D, 0x8BC4, 0x5C31, 0x8F41, - 0x5C38, 0x9B99, 0x5C39, 0x9B9A, 0x5C3A, 0x8EDA, 0x5C3B, 0x904B, - 0x5C3C, 0x93F2, 0x5C3D, 0x9073, 0x5C3E, 0x94F6, 0x5C3F, 0x9441, - 0x5C40, 0x8BC7, 0x5C41, 0x9B9B, 0x5C45, 0x8B8F, 0x5C46, 0x9B9C, - 0x5C48, 0x8BFC, 0x5C4A, 0x93CD, 0x5C4B, 0x89AE, 0x5C4D, 0x8E72, - 0x5C4E, 0x9B9D, 0x5C4F, 0x9BA0, 0x5C50, 0x9B9F, 0x5C51, 0x8BFB, - 0x5C53, 0x9B9E, 0x5C55, 0x9357, 0x5C5E, 0x91AE, 0x5C60, 0x936A, - 0x5C61, 0x8EC6, 0x5C64, 0x9177, 0x5C65, 0x979A, 0x5C6C, 0x9BA2, - 0x5C6E, 0x9BA3, 0x5C6F, 0x93D4, 0x5C71, 0x8E52, 0x5C76, 0x9BA5, - 0x5C79, 0x9BA6, 0x5C8C, 0x9BA7, 0x5C90, 0x8AF2, 0x5C91, 0x9BA8, - 0x5C94, 0x9BA9, 0x5CA1, 0x89AA, 0x5CA6, 0xFAAC, 0x5CA8, 0x915A, - 0x5CA9, 0x8AE2, 0x5CAB, 0x9BAB, 0x5CAC, 0x96A6, 0x5CB1, 0x91D0, - 0x5CB3, 0x8A78, 0x5CB6, 0x9BAD, 0x5CB7, 0x9BAF, 0x5CB8, 0x8ADD, - 0x5CBA, 0xFAAD, 0x5CBB, 0x9BAC, 0x5CBC, 0x9BAE, 0x5CBE, 0x9BB1, - 0x5CC5, 0x9BB0, 0x5CC7, 0x9BB2, 0x5CD9, 0x9BB3, 0x5CE0, 0x93BB, - 0x5CE1, 0x8BAC, 0x5CE8, 0x89E3, 0x5CE9, 0x9BB4, 0x5CEA, 0x9BB9, - 0x5CED, 0x9BB7, 0x5CEF, 0x95F5, 0x5CF0, 0x95F4, 0x5CF5, 0xFAAE, - 0x5CF6, 0x9387, 0x5CFA, 0x9BB6, 0x5CFB, 0x8F73, 0x5CFD, 0x9BB5, - 0x5D07, 0x9092, 0x5D0B, 0x9BBA, 0x5D0E, 0x8DE8, 0x5D11, 0x9BC0, - 0x5D14, 0x9BC1, 0x5D15, 0x9BBB, 0x5D16, 0x8A52, 0x5D17, 0x9BBC, - 0x5D18, 0x9BC5, 0x5D19, 0x9BC4, 0x5D1A, 0x9BC3, 0x5D1B, 0x9BBF, - 0x5D1F, 0x9BBE, 0x5D22, 0x9BC2, 0x5D27, 0xFAAF, 0x5D29, 0x95F6, - 0x5D42, 0xFAB2, 0x5D4B, 0x9BC9, 0x5D4C, 0x9BC6, 0x5D4E, 0x9BC8, - 0x5D50, 0x9792, 0x5D52, 0x9BC7, 0x5D53, 0xFAB0, 0x5D5C, 0x9BBD, - 0x5D69, 0x9093, 0x5D6C, 0x9BCA, 0x5D6D, 0xFAB3, 0x5D6F, 0x8DB5, - 0x5D73, 0x9BCB, 0x5D76, 0x9BCC, 0x5D82, 0x9BCF, 0x5D84, 0x9BCE, - 0x5D87, 0x9BCD, 0x5D8B, 0x9388, 0x5D8C, 0x9BB8, 0x5D90, 0x9BD5, - 0x5D9D, 0x9BD1, 0x5DA2, 0x9BD0, 0x5DAC, 0x9BD2, 0x5DAE, 0x9BD3, - 0x5DB7, 0x9BD6, 0x5DB8, 0xFAB4, 0x5DB9, 0xFAB5, 0x5DBA, 0x97E4, - 0x5DBC, 0x9BD7, 0x5DBD, 0x9BD4, 0x5DC9, 0x9BD8, 0x5DCC, 0x8ADE, - 0x5DCD, 0x9BD9, 0x5DD0, 0xFAB6, 0x5DD2, 0x9BDB, 0x5DD3, 0x9BDA, - 0x5DD6, 0x9BDC, 0x5DDB, 0x9BDD, 0x5DDD, 0x90EC, 0x5DDE, 0x8F42, - 0x5DE1, 0x8F84, 0x5DE3, 0x9183, 0x5DE5, 0x8D48, 0x5DE6, 0x8DB6, - 0x5DE7, 0x8D49, 0x5DE8, 0x8B90, 0x5DEB, 0x9BDE, 0x5DEE, 0x8DB7, - 0x5DF1, 0x8CC8, 0x5DF2, 0x9BDF, 0x5DF3, 0x96A4, 0x5DF4, 0x9462, - 0x5DF5, 0x9BE0, 0x5DF7, 0x8D4A, 0x5DFB, 0x8AAA, 0x5DFD, 0x9246, - 0x5DFE, 0x8BD0, 0x5E02, 0x8E73, 0x5E03, 0x957A, 0x5E06, 0x94BF, - 0x5E0B, 0x9BE1, 0x5E0C, 0x8AF3, 0x5E11, 0x9BE4, 0x5E16, 0x929F, - 0x5E19, 0x9BE3, 0x5E1A, 0x9BE2, 0x5E1B, 0x9BE5, 0x5E1D, 0x92E9, - 0x5E25, 0x9083, 0x5E2B, 0x8E74, 0x5E2D, 0x90C8, 0x5E2F, 0x91D1, - 0x5E30, 0x8B41, 0x5E33, 0x92A0, 0x5E36, 0x9BE6, 0x5E37, 0x9BE7, - 0x5E38, 0x8FED, 0x5E3D, 0x9658, 0x5E40, 0x9BEA, 0x5E43, 0x9BE9, - 0x5E44, 0x9BE8, 0x5E45, 0x959D, 0x5E47, 0x9BF1, 0x5E4C, 0x9679, - 0x5E4E, 0x9BEB, 0x5E54, 0x9BED, 0x5E55, 0x968B, 0x5E57, 0x9BEC, - 0x5E5F, 0x9BEE, 0x5E61, 0x94A6, 0x5E62, 0x9BEF, 0x5E63, 0x95BC, - 0x5E64, 0x9BF0, 0x5E72, 0x8AB1, 0x5E73, 0x95BD, 0x5E74, 0x944E, - 0x5E75, 0x9BF2, 0x5E76, 0x9BF3, 0x5E78, 0x8D4B, 0x5E79, 0x8AB2, - 0x5E7A, 0x9BF4, 0x5E7B, 0x8CB6, 0x5E7C, 0x9763, 0x5E7D, 0x9748, - 0x5E7E, 0x8AF4, 0x5E7F, 0x9BF6, 0x5E81, 0x92A1, 0x5E83, 0x8D4C, - 0x5E84, 0x8FAF, 0x5E87, 0x94DD, 0x5E8A, 0x8FB0, 0x5E8F, 0x8F98, - 0x5E95, 0x92EA, 0x5E96, 0x95F7, 0x5E97, 0x9358, 0x5E9A, 0x8D4D, - 0x5E9C, 0x957B, 0x5EA0, 0x9BF7, 0x5EA6, 0x9378, 0x5EA7, 0x8DC0, - 0x5EAB, 0x8CC9, 0x5EAD, 0x92EB, 0x5EB5, 0x88C1, 0x5EB6, 0x8F8E, - 0x5EB7, 0x8D4E, 0x5EB8, 0x9766, 0x5EC1, 0x9BF8, 0x5EC2, 0x9BF9, - 0x5EC3, 0x9470, 0x5EC8, 0x9BFA, 0x5EC9, 0x97F5, 0x5ECA, 0x984C, - 0x5ECF, 0x9BFC, 0x5ED0, 0x9BFB, 0x5ED3, 0x8A66, 0x5ED6, 0x9C40, - 0x5EDA, 0x9C43, 0x5EDB, 0x9C44, 0x5EDD, 0x9C42, 0x5EDF, 0x955F, - 0x5EE0, 0x8FB1, 0x5EE1, 0x9C46, 0x5EE2, 0x9C45, 0x5EE3, 0x9C41, - 0x5EE8, 0x9C47, 0x5EE9, 0x9C48, 0x5EEC, 0x9C49, 0x5EF0, 0x9C4C, - 0x5EF1, 0x9C4A, 0x5EF3, 0x9C4B, 0x5EF4, 0x9C4D, 0x5EF6, 0x8984, - 0x5EF7, 0x92EC, 0x5EF8, 0x9C4E, 0x5EFA, 0x8C9A, 0x5EFB, 0x89F4, - 0x5EFC, 0x9455, 0x5EFE, 0x9C4F, 0x5EFF, 0x93F9, 0x5F01, 0x95D9, - 0x5F03, 0x9C50, 0x5F04, 0x984D, 0x5F09, 0x9C51, 0x5F0A, 0x95BE, - 0x5F0B, 0x9C54, 0x5F0C, 0x989F, 0x5F0D, 0x98AF, 0x5F0F, 0x8EAE, - 0x5F10, 0x93F3, 0x5F11, 0x9C55, 0x5F13, 0x8B7C, 0x5F14, 0x92A2, - 0x5F15, 0x88F8, 0x5F16, 0x9C56, 0x5F17, 0x95A4, 0x5F18, 0x8D4F, - 0x5F1B, 0x926F, 0x5F1F, 0x92ED, 0x5F21, 0xFAB7, 0x5F25, 0x96ED, - 0x5F26, 0x8CB7, 0x5F27, 0x8CCA, 0x5F29, 0x9C57, 0x5F2D, 0x9C58, - 0x5F2F, 0x9C5E, 0x5F31, 0x8EE3, 0x5F34, 0xFAB8, 0x5F35, 0x92A3, - 0x5F37, 0x8BAD, 0x5F38, 0x9C59, 0x5F3C, 0x954A, 0x5F3E, 0x9265, - 0x5F41, 0x9C5A, 0x5F45, 0xFA67, 0x5F48, 0x9C5B, 0x5F4A, 0x8BAE, - 0x5F4C, 0x9C5C, 0x5F4E, 0x9C5D, 0x5F51, 0x9C5F, 0x5F53, 0x9396, - 0x5F56, 0x9C60, 0x5F57, 0x9C61, 0x5F59, 0x9C62, 0x5F5C, 0x9C53, - 0x5F5D, 0x9C52, 0x5F61, 0x9C63, 0x5F62, 0x8C60, 0x5F66, 0x9546, - 0x5F67, 0xFAB9, 0x5F69, 0x8DCA, 0x5F6A, 0x9556, 0x5F6B, 0x92A4, - 0x5F6C, 0x956A, 0x5F6D, 0x9C64, 0x5F70, 0x8FB2, 0x5F71, 0x8965, - 0x5F73, 0x9C65, 0x5F77, 0x9C66, 0x5F79, 0x96F0, 0x5F7C, 0x94DE, - 0x5F7F, 0x9C69, 0x5F80, 0x899D, 0x5F81, 0x90AA, 0x5F82, 0x9C68, - 0x5F83, 0x9C67, 0x5F84, 0x8C61, 0x5F85, 0x91D2, 0x5F87, 0x9C6D, - 0x5F88, 0x9C6B, 0x5F8A, 0x9C6A, 0x5F8B, 0x97A5, 0x5F8C, 0x8CE3, - 0x5F90, 0x8F99, 0x5F91, 0x9C6C, 0x5F92, 0x936B, 0x5F93, 0x8F5D, - 0x5F97, 0x93BE, 0x5F98, 0x9C70, 0x5F99, 0x9C6F, 0x5F9E, 0x9C6E, - 0x5FA0, 0x9C71, 0x5FA1, 0x8CE4, 0x5FA8, 0x9C72, 0x5FA9, 0x959C, - 0x5FAA, 0x8F7A, 0x5FAD, 0x9C73, 0x5FAE, 0x94F7, 0x5FB3, 0x93BF, - 0x5FB4, 0x92A5, 0x5FB7, 0xFABA, 0x5FB9, 0x934F, 0x5FBC, 0x9C74, - 0x5FBD, 0x8B4A, 0x5FC3, 0x9053, 0x5FC5, 0x954B, 0x5FCC, 0x8AF5, - 0x5FCD, 0x9445, 0x5FD6, 0x9C75, 0x5FD7, 0x8E75, 0x5FD8, 0x9659, - 0x5FD9, 0x965A, 0x5FDC, 0x899E, 0x5FDD, 0x9C7A, 0x5FDE, 0xFABB, - 0x5FE0, 0x9289, 0x5FE4, 0x9C77, 0x5FEB, 0x89F5, 0x5FF0, 0x9CAB, - 0x5FF1, 0x9C79, 0x5FF5, 0x944F, 0x5FF8, 0x9C78, 0x5FFB, 0x9C76, - 0x5FFD, 0x8D9A, 0x5FFF, 0x9C7C, 0x600E, 0x9C83, 0x600F, 0x9C89, - 0x6010, 0x9C81, 0x6012, 0x937B, 0x6015, 0x9C86, 0x6016, 0x957C, - 0x6019, 0x9C80, 0x601B, 0x9C85, 0x601C, 0x97E5, 0x601D, 0x8E76, - 0x6020, 0x91D3, 0x6021, 0x9C7D, 0x6025, 0x8B7D, 0x6026, 0x9C88, - 0x6027, 0x90AB, 0x6028, 0x8985, 0x6029, 0x9C82, 0x602A, 0x89F6, - 0x602B, 0x9C87, 0x602F, 0x8BAF, 0x6031, 0x9C84, 0x603A, 0x9C8A, - 0x6041, 0x9C8C, 0x6042, 0x9C96, 0x6043, 0x9C94, 0x6046, 0x9C91, - 0x604A, 0x9C90, 0x604B, 0x97F6, 0x604D, 0x9C92, 0x6050, 0x8BB0, - 0x6052, 0x8D50, 0x6055, 0x8F9A, 0x6059, 0x9C99, 0x605A, 0x9C8B, - 0x605D, 0xFABC, 0x605F, 0x9C8F, 0x6060, 0x9C7E, 0x6062, 0x89F8, - 0x6063, 0x9C93, 0x6064, 0x9C95, 0x6065, 0x9270, 0x6068, 0x8DA6, - 0x6069, 0x89B6, 0x606A, 0x9C8D, 0x606B, 0x9C98, 0x606C, 0x9C97, - 0x606D, 0x8BB1, 0x606F, 0x91A7, 0x6070, 0x8A86, 0x6075, 0x8C62, - 0x6077, 0x9C8E, 0x6081, 0x9C9A, 0x6083, 0x9C9D, 0x6084, 0x9C9F, - 0x6085, 0xFABD, 0x6089, 0x8EBB, 0x608A, 0xFABE, 0x608B, 0x9CA5, - 0x608C, 0x92EE, 0x608D, 0x9C9B, 0x6092, 0x9CA3, 0x6094, 0x89F7, - 0x6096, 0x9CA1, 0x6097, 0x9CA2, 0x609A, 0x9C9E, 0x609B, 0x9CA0, - 0x609F, 0x8CE5, 0x60A0, 0x9749, 0x60A3, 0x8AB3, 0x60A6, 0x8978, - 0x60A7, 0x9CA4, 0x60A9, 0x9459, 0x60AA, 0x88AB, 0x60B2, 0x94DF, - 0x60B3, 0x9C7B, 0x60B4, 0x9CAA, 0x60B5, 0x9CAE, 0x60B6, 0x96E3, - 0x60B8, 0x9CA7, 0x60BC, 0x9389, 0x60BD, 0x9CAC, 0x60C5, 0x8FEE, - 0x60C6, 0x9CAD, 0x60C7, 0x93D5, 0x60D1, 0x9866, 0x60D3, 0x9CA9, - 0x60D5, 0xFAC0, 0x60D8, 0x9CAF, 0x60DA, 0x8D9B, 0x60DC, 0x90C9, - 0x60DE, 0xFABF, 0x60DF, 0x88D2, 0x60E0, 0x9CA8, 0x60E1, 0x9CA6, - 0x60E3, 0x9179, 0x60E7, 0x9C9C, 0x60E8, 0x8E53, 0x60F0, 0x91C4, - 0x60F1, 0x9CBB, 0x60F2, 0xFAC2, 0x60F3, 0x917A, 0x60F4, 0x9CB6, - 0x60F6, 0x9CB3, 0x60F7, 0x9CB4, 0x60F9, 0x8EE4, 0x60FA, 0x9CB7, - 0x60FB, 0x9CBA, 0x6100, 0x9CB5, 0x6101, 0x8F44, 0x6103, 0x9CB8, - 0x6106, 0x9CB2, 0x6108, 0x96FA, 0x6109, 0x96F9, 0x610D, 0x9CBC, - 0x610E, 0x9CBD, 0x610F, 0x88D3, 0x6111, 0xFAC3, 0x6115, 0x9CB1, - 0x611A, 0x8BF0, 0x611B, 0x88A4, 0x611F, 0x8AB4, 0x6120, 0xFAC1, - 0x6121, 0x9CB9, 0x6127, 0x9CC1, 0x6128, 0x9CC0, 0x612C, 0x9CC5, - 0x6130, 0xFAC5, 0x6134, 0x9CC6, 0x6137, 0xFAC4, 0x613C, 0x9CC4, - 0x613D, 0x9CC7, 0x613E, 0x9CBF, 0x613F, 0x9CC3, 0x6142, 0x9CC8, - 0x6144, 0x9CC9, 0x6147, 0x9CBE, 0x6148, 0x8E9C, 0x614A, 0x9CC2, - 0x614B, 0x91D4, 0x614C, 0x8D51, 0x614D, 0x9CB0, 0x614E, 0x9054, - 0x6153, 0x9CD6, 0x6155, 0x95E7, 0x6158, 0x9CCC, 0x6159, 0x9CCD, - 0x615A, 0x9CCE, 0x615D, 0x9CD5, 0x615F, 0x9CD4, 0x6162, 0x969D, - 0x6163, 0x8AB5, 0x6165, 0x9CD2, 0x6167, 0x8C64, 0x6168, 0x8A53, - 0x616B, 0x9CCF, 0x616E, 0x97B6, 0x616F, 0x9CD1, 0x6170, 0x88D4, - 0x6171, 0x9CD3, 0x6173, 0x9CCA, 0x6174, 0x9CD0, 0x6175, 0x9CD7, - 0x6176, 0x8C63, 0x6177, 0x9CCB, 0x617E, 0x977C, 0x6182, 0x974A, - 0x6187, 0x9CDA, 0x618A, 0x9CDE, 0x618E, 0x919E, 0x6190, 0x97F7, - 0x6191, 0x9CDF, 0x6194, 0x9CDC, 0x6196, 0x9CD9, 0x6198, 0xFAC6, - 0x6199, 0x9CD8, 0x619A, 0x9CDD, 0x61A4, 0x95AE, 0x61A7, 0x93B2, - 0x61A9, 0x8C65, 0x61AB, 0x9CE0, 0x61AC, 0x9CDB, 0x61AE, 0x9CE1, - 0x61B2, 0x8C9B, 0x61B6, 0x89AF, 0x61BA, 0x9CE9, 0x61BE, 0x8AB6, - 0x61C3, 0x9CE7, 0x61C6, 0x9CE8, 0x61C7, 0x8DA7, 0x61C8, 0x9CE6, - 0x61C9, 0x9CE4, 0x61CA, 0x9CE3, 0x61CB, 0x9CEA, 0x61CC, 0x9CE2, - 0x61CD, 0x9CEC, 0x61D0, 0x89F9, 0x61E3, 0x9CEE, 0x61E6, 0x9CED, - 0x61F2, 0x92A6, 0x61F4, 0x9CF1, 0x61F6, 0x9CEF, 0x61F7, 0x9CE5, - 0x61F8, 0x8C9C, 0x61FA, 0x9CF0, 0x61FC, 0x9CF4, 0x61FD, 0x9CF3, - 0x61FE, 0x9CF5, 0x61FF, 0x9CF2, 0x6200, 0x9CF6, 0x6208, 0x9CF7, - 0x6209, 0x9CF8, 0x620A, 0x95E8, 0x620C, 0x9CFA, 0x620D, 0x9CF9, - 0x620E, 0x8F5E, 0x6210, 0x90AC, 0x6211, 0x89E4, 0x6212, 0x89FA, - 0x6213, 0xFAC7, 0x6214, 0x9CFB, 0x6216, 0x88BD, 0x621A, 0x90CA, - 0x621B, 0x9CFC, 0x621D, 0xE6C1, 0x621E, 0x9D40, 0x621F, 0x8C81, - 0x6221, 0x9D41, 0x6226, 0x90ED, 0x622A, 0x9D42, 0x622E, 0x9D43, - 0x622F, 0x8B59, 0x6230, 0x9D44, 0x6232, 0x9D45, 0x6233, 0x9D46, - 0x6234, 0x91D5, 0x6238, 0x8CCB, 0x623B, 0x96DF, 0x623F, 0x965B, - 0x6240, 0x8F8A, 0x6241, 0x9D47, 0x6247, 0x90EE, 0x6248, 0xE7BB, - 0x6249, 0x94E0, 0x624B, 0x8EE8, 0x624D, 0x8DCB, 0x624E, 0x9D48, - 0x6253, 0x91C5, 0x6255, 0x95A5, 0x6258, 0x91EF, 0x625B, 0x9D4B, - 0x625E, 0x9D49, 0x6260, 0x9D4C, 0x6263, 0x9D4A, 0x6268, 0x9D4D, - 0x626E, 0x95AF, 0x6271, 0x88B5, 0x6276, 0x957D, 0x6279, 0x94E1, - 0x627C, 0x9D4E, 0x627E, 0x9D51, 0x627F, 0x8FB3, 0x6280, 0x8B5A, - 0x6282, 0x9D4F, 0x6283, 0x9D56, 0x6284, 0x8FB4, 0x6289, 0x9D50, - 0x628A, 0x9463, 0x6291, 0x977D, 0x6292, 0x9D52, 0x6293, 0x9D53, - 0x6294, 0x9D57, 0x6295, 0x938A, 0x6296, 0x9D54, 0x6297, 0x8D52, - 0x6298, 0x90DC, 0x629B, 0x9D65, 0x629C, 0x94B2, 0x629E, 0x91F0, - 0x62A6, 0xFAC8, 0x62AB, 0x94E2, 0x62AC, 0x9DAB, 0x62B1, 0x95F8, - 0x62B5, 0x92EF, 0x62B9, 0x9695, 0x62BB, 0x9D5A, 0x62BC, 0x899F, - 0x62BD, 0x928A, 0x62C2, 0x9D63, 0x62C5, 0x9253, 0x62C6, 0x9D5D, - 0x62C7, 0x9D64, 0x62C8, 0x9D5F, 0x62C9, 0x9D66, 0x62CA, 0x9D62, - 0x62CC, 0x9D61, 0x62CD, 0x948F, 0x62CF, 0x9D5B, 0x62D0, 0x89FB, - 0x62D1, 0x9D59, 0x62D2, 0x8B91, 0x62D3, 0x91F1, 0x62D4, 0x9D55, - 0x62D7, 0x9D58, 0x62D8, 0x8D53, 0x62D9, 0x90D9, 0x62DB, 0x8FB5, - 0x62DC, 0x9D60, 0x62DD, 0x9471, 0x62E0, 0x8B92, 0x62E1, 0x8A67, - 0x62EC, 0x8A87, 0x62ED, 0x9040, 0x62EE, 0x9D68, 0x62EF, 0x9D6D, - 0x62F1, 0x9D69, 0x62F3, 0x8C9D, 0x62F5, 0x9D6E, 0x62F6, 0x8E41, - 0x62F7, 0x8D89, 0x62FE, 0x8F45, 0x62FF, 0x9D5C, 0x6301, 0x8E9D, - 0x6302, 0x9D6B, 0x6307, 0x8E77, 0x6308, 0x9D6C, 0x6309, 0x88C2, - 0x630C, 0x9D67, 0x6311, 0x92A7, 0x6319, 0x8B93, 0x631F, 0x8BB2, - 0x6327, 0x9D6A, 0x6328, 0x88A5, 0x632B, 0x8DC1, 0x632F, 0x9055, - 0x633A, 0x92F0, 0x633D, 0x94D2, 0x633E, 0x9D70, 0x633F, 0x917D, - 0x6349, 0x91A8, 0x634C, 0x8E4A, 0x634D, 0x9D71, 0x634F, 0x9D73, - 0x6350, 0x9D6F, 0x6355, 0x95DF, 0x6357, 0x92BB, 0x635C, 0x917B, - 0x6367, 0x95F9, 0x6368, 0x8ECC, 0x6369, 0x9D80, 0x636B, 0x9D7E, - 0x636E, 0x9098, 0x6372, 0x8C9E, 0x6376, 0x9D78, 0x6377, 0x8FB7, - 0x637A, 0x93E6, 0x637B, 0x9450, 0x6380, 0x9D76, 0x6383, 0x917C, - 0x6388, 0x8EF6, 0x6389, 0x9D7B, 0x638C, 0x8FB6, 0x638E, 0x9D75, - 0x638F, 0x9D7A, 0x6392, 0x9472, 0x6396, 0x9D74, 0x6398, 0x8C40, - 0x639B, 0x8A7C, 0x639F, 0x9D7C, 0x63A0, 0x97A9, 0x63A1, 0x8DCC, - 0x63A2, 0x9254, 0x63A3, 0x9D79, 0x63A5, 0x90DA, 0x63A7, 0x8D54, - 0x63A8, 0x9084, 0x63A9, 0x8986, 0x63AA, 0x915B, 0x63AB, 0x9D77, - 0x63AC, 0x8B64, 0x63B2, 0x8C66, 0x63B4, 0x92CD, 0x63B5, 0x9D7D, - 0x63BB, 0x917E, 0x63BE, 0x9D81, 0x63C0, 0x9D83, 0x63C3, 0x91B5, - 0x63C4, 0x9D89, 0x63C6, 0x9D84, 0x63C9, 0x9D86, 0x63CF, 0x9560, - 0x63D0, 0x92F1, 0x63D2, 0x9D87, 0x63D6, 0x974B, 0x63DA, 0x9767, - 0x63DB, 0x8AB7, 0x63E1, 0x88AC, 0x63E3, 0x9D85, 0x63E9, 0x9D82, - 0x63EE, 0x8AF6, 0x63F4, 0x8987, 0x63F5, 0xFAC9, 0x63F6, 0x9D88, - 0x63FA, 0x9768, 0x6406, 0x9D8C, 0x640D, 0x91B9, 0x640F, 0x9D93, - 0x6413, 0x9D8D, 0x6416, 0x9D8A, 0x6417, 0x9D91, 0x641C, 0x9D72, - 0x6426, 0x9D8E, 0x6428, 0x9D92, 0x642C, 0x94C0, 0x642D, 0x938B, - 0x6434, 0x9D8B, 0x6436, 0x9D8F, 0x643A, 0x8C67, 0x643E, 0x8DEF, - 0x6442, 0x90DB, 0x644E, 0x9D97, 0x6458, 0x9345, 0x6460, 0xFACA, - 0x6467, 0x9D94, 0x6469, 0x9680, 0x646F, 0x9D95, 0x6476, 0x9D96, - 0x6478, 0x96CC, 0x647A, 0x90A0, 0x6483, 0x8C82, 0x6488, 0x9D9D, - 0x6492, 0x8E54, 0x6493, 0x9D9A, 0x6495, 0x9D99, 0x649A, 0x9451, - 0x649D, 0xFACB, 0x649E, 0x93B3, 0x64A4, 0x9350, 0x64A5, 0x9D9B, - 0x64A9, 0x9D9C, 0x64AB, 0x958F, 0x64AD, 0x9464, 0x64AE, 0x8E42, - 0x64B0, 0x90EF, 0x64B2, 0x966F, 0x64B9, 0x8A68, 0x64BB, 0x9DA3, - 0x64BC, 0x9D9E, 0x64C1, 0x9769, 0x64C2, 0x9DA5, 0x64C5, 0x9DA1, - 0x64C7, 0x9DA2, 0x64CD, 0x9180, 0x64CE, 0xFACC, 0x64D2, 0x9DA0, - 0x64D4, 0x9D5E, 0x64D8, 0x9DA4, 0x64DA, 0x9D9F, 0x64E0, 0x9DA9, - 0x64E1, 0x9DAA, 0x64E2, 0x9346, 0x64E3, 0x9DAC, 0x64E6, 0x8E43, - 0x64E7, 0x9DA7, 0x64EC, 0x8B5B, 0x64EF, 0x9DAD, 0x64F1, 0x9DA6, - 0x64F2, 0x9DB1, 0x64F4, 0x9DB0, 0x64F6, 0x9DAF, 0x64FA, 0x9DB2, - 0x64FD, 0x9DB4, 0x64FE, 0x8FEF, 0x6500, 0x9DB3, 0x6505, 0x9DB7, - 0x6518, 0x9DB5, 0x651C, 0x9DB6, 0x651D, 0x9D90, 0x6523, 0x9DB9, - 0x6524, 0x9DB8, 0x652A, 0x9D98, 0x652B, 0x9DBA, 0x652C, 0x9DAE, - 0x652F, 0x8E78, 0x6534, 0x9DBB, 0x6535, 0x9DBC, 0x6536, 0x9DBE, - 0x6537, 0x9DBD, 0x6538, 0x9DBF, 0x6539, 0x89FC, 0x653B, 0x8D55, - 0x653E, 0x95FA, 0x653F, 0x90AD, 0x6545, 0x8CCC, 0x6548, 0x9DC1, - 0x654D, 0x9DC4, 0x654E, 0xFACD, 0x654F, 0x9571, 0x6551, 0x8B7E, - 0x6555, 0x9DC3, 0x6556, 0x9DC2, 0x6557, 0x9473, 0x6558, 0x9DC5, - 0x6559, 0x8BB3, 0x655D, 0x9DC7, 0x655E, 0x9DC6, 0x6562, 0x8AB8, - 0x6563, 0x8E55, 0x6566, 0x93D6, 0x656C, 0x8C68, 0x6570, 0x9094, - 0x6572, 0x9DC8, 0x6574, 0x90AE, 0x6575, 0x9347, 0x6577, 0x957E, - 0x6578, 0x9DC9, 0x6582, 0x9DCA, 0x6583, 0x9DCB, 0x6587, 0x95B6, - 0x6588, 0x9B7C, 0x6589, 0x90C4, 0x658C, 0x956B, 0x658E, 0x8DD6, - 0x6590, 0x94E3, 0x6591, 0x94C1, 0x6597, 0x936C, 0x6599, 0x97BF, - 0x659B, 0x9DCD, 0x659C, 0x8ECE, 0x659F, 0x9DCE, 0x65A1, 0x88B4, - 0x65A4, 0x8BD2, 0x65A5, 0x90CB, 0x65A7, 0x9580, 0x65AB, 0x9DCF, - 0x65AC, 0x8E61, 0x65AD, 0x9266, 0x65AF, 0x8E7A, 0x65B0, 0x9056, - 0x65B7, 0x9DD0, 0x65B9, 0x95FB, 0x65BC, 0x8997, 0x65BD, 0x8E7B, - 0x65C1, 0x9DD3, 0x65C3, 0x9DD1, 0x65C4, 0x9DD4, 0x65C5, 0x97B7, - 0x65C6, 0x9DD2, 0x65CB, 0x90F9, 0x65CC, 0x9DD5, 0x65CF, 0x91B0, - 0x65D2, 0x9DD6, 0x65D7, 0x8AF8, 0x65D9, 0x9DD8, 0x65DB, 0x9DD7, - 0x65E0, 0x9DD9, 0x65E1, 0x9DDA, 0x65E2, 0x8AF9, 0x65E5, 0x93FA, - 0x65E6, 0x9255, 0x65E7, 0x8B8C, 0x65E8, 0x8E7C, 0x65E9, 0x9181, - 0x65EC, 0x8F7B, 0x65ED, 0x88AE, 0x65F1, 0x9DDB, 0x65FA, 0x89A0, - 0x65FB, 0x9DDF, 0x6600, 0xFACE, 0x6602, 0x8D56, 0x6603, 0x9DDE, - 0x6606, 0x8DA9, 0x6607, 0x8FB8, 0x6609, 0xFAD1, 0x660A, 0x9DDD, - 0x660C, 0x8FB9, 0x660E, 0x96BE, 0x660F, 0x8DA8, 0x6613, 0x88D5, - 0x6614, 0x90CC, 0x6615, 0xFACF, 0x661C, 0x9DE4, 0x661E, 0xFAD3, - 0x661F, 0x90AF, 0x6620, 0x8966, 0x6624, 0xFAD4, 0x6625, 0x8F74, - 0x6627, 0x9686, 0x6628, 0x8DF0, 0x662D, 0x8FBA, 0x662E, 0xFAD2, - 0x662F, 0x90A5, 0x6631, 0xFA63, 0x6634, 0x9DE3, 0x6635, 0x9DE1, - 0x6636, 0x9DE2, 0x663B, 0xFAD0, 0x663C, 0x928B, 0x663F, 0x9E45, - 0x6641, 0x9DE8, 0x6642, 0x8E9E, 0x6643, 0x8D57, 0x6644, 0x9DE6, - 0x6649, 0x9DE7, 0x664B, 0x9057, 0x664F, 0x9DE5, 0x6652, 0x8E4E, - 0x6657, 0xFAD6, 0x6659, 0xFAD7, 0x665D, 0x9DEA, 0x665E, 0x9DE9, - 0x665F, 0x9DEE, 0x6662, 0x9DEF, 0x6664, 0x9DEB, 0x6665, 0xFAD5, - 0x6666, 0x8A41, 0x6667, 0x9DEC, 0x6668, 0x9DED, 0x6669, 0x94D3, - 0x666E, 0x9581, 0x666F, 0x8C69, 0x6670, 0x9DF0, 0x6673, 0xFAD9, - 0x6674, 0x90B0, 0x6676, 0x8FBB, 0x667A, 0x9271, 0x6681, 0x8BC5, - 0x6683, 0x9DF1, 0x6684, 0x9DF5, 0x6687, 0x89C9, 0x6688, 0x9DF2, - 0x6689, 0x9DF4, 0x668E, 0x9DF3, 0x6691, 0x8F8B, 0x6696, 0x9267, - 0x6697, 0x88C3, 0x6698, 0x9DF6, 0x6699, 0xFADA, 0x669D, 0x9DF7, - 0x66A0, 0xFADB, 0x66A2, 0x92A8, 0x66A6, 0x97EF, 0x66AB, 0x8E62, - 0x66AE, 0x95E9, 0x66B2, 0xFADC, 0x66B4, 0x965C, 0x66B8, 0x9E41, - 0x66B9, 0x9DF9, 0x66BC, 0x9DFC, 0x66BE, 0x9DFB, 0x66BF, 0xFADD, - 0x66C1, 0x9DF8, 0x66C4, 0x9E40, 0x66C7, 0x93DC, 0x66C9, 0x9DFA, - 0x66D6, 0x9E42, 0x66D9, 0x8F8C, 0x66DA, 0x9E43, 0x66DC, 0x976A, - 0x66DD, 0x9498, 0x66E0, 0x9E44, 0x66E6, 0x9E46, 0x66E9, 0x9E47, - 0x66F0, 0x9E48, 0x66F2, 0x8BC8, 0x66F3, 0x8967, 0x66F4, 0x8D58, - 0x66F5, 0x9E49, 0x66F7, 0x9E4A, 0x66F8, 0x8F91, 0x66F9, 0x9182, - 0x66FA, 0xFADE, 0x66FB, 0xFA66, 0x66FC, 0x99D6, 0x66FD, 0x915D, - 0x66FE, 0x915C, 0x66FF, 0x91D6, 0x6700, 0x8DC5, 0x6703, 0x98F0, - 0x6708, 0x8C8E, 0x6709, 0x974C, 0x670B, 0x95FC, 0x670D, 0x959E, - 0x670E, 0xFADF, 0x670F, 0x9E4B, 0x6714, 0x8DF1, 0x6715, 0x92BD, - 0x6716, 0x9E4C, 0x6717, 0x984E, 0x671B, 0x965D, 0x671D, 0x92A9, - 0x671E, 0x9E4D, 0x671F, 0x8AFA, 0x6726, 0x9E4E, 0x6727, 0x9E4F, - 0x6728, 0x96D8, 0x672A, 0x96A2, 0x672B, 0x9696, 0x672C, 0x967B, - 0x672D, 0x8E44, 0x672E, 0x9E51, 0x6731, 0x8EE9, 0x6734, 0x9670, - 0x6736, 0x9E53, 0x6737, 0x9E56, 0x6738, 0x9E55, 0x673A, 0x8AF7, - 0x673D, 0x8B80, 0x673F, 0x9E52, 0x6741, 0x9E54, 0x6746, 0x9E57, - 0x6749, 0x9099, 0x674E, 0x979B, 0x674F, 0x88C7, 0x6750, 0x8DDE, - 0x6751, 0x91BA, 0x6753, 0x8EDB, 0x6756, 0x8FF1, 0x6759, 0x9E5A, - 0x675C, 0x936D, 0x675E, 0x9E58, 0x675F, 0x91A9, 0x6760, 0x9E59, - 0x6761, 0x8FF0, 0x6762, 0x96DB, 0x6763, 0x9E5B, 0x6764, 0x9E5C, - 0x6765, 0x9788, 0x6766, 0xFAE1, 0x676A, 0x9E61, 0x676D, 0x8D59, - 0x676F, 0x9474, 0x6770, 0x9E5E, 0x6771, 0x938C, 0x6772, 0x9DDC, - 0x6773, 0x9DE0, 0x6775, 0x8B6E, 0x6777, 0x9466, 0x677C, 0x9E60, - 0x677E, 0x8FBC, 0x677F, 0x94C2, 0x6785, 0x9E66, 0x6787, 0x94F8, - 0x6789, 0x9E5D, 0x678B, 0x9E63, 0x678C, 0x9E62, 0x6790, 0x90CD, - 0x6795, 0x968D, 0x6797, 0x97D1, 0x679A, 0x9687, 0x679C, 0x89CA, - 0x679D, 0x8E7D, 0x67A0, 0x9867, 0x67A1, 0x9E65, 0x67A2, 0x9095, - 0x67A6, 0x9E64, 0x67A9, 0x9E5F, 0x67AF, 0x8CCD, 0x67B3, 0x9E6B, - 0x67B4, 0x9E69, 0x67B6, 0x89CB, 0x67B7, 0x9E67, 0x67B8, 0x9E6D, - 0x67B9, 0x9E73, 0x67BB, 0xFAE2, 0x67C0, 0xFAE4, 0x67C1, 0x91C6, - 0x67C4, 0x95BF, 0x67C6, 0x9E75, 0x67CA, 0x9541, 0x67CE, 0x9E74, - 0x67CF, 0x9490, 0x67D0, 0x965E, 0x67D1, 0x8AB9, 0x67D3, 0x90F5, - 0x67D4, 0x8F5F, 0x67D8, 0x92D1, 0x67DA, 0x974D, 0x67DD, 0x9E70, - 0x67DE, 0x9E6F, 0x67E2, 0x9E71, 0x67E4, 0x9E6E, 0x67E7, 0x9E76, - 0x67E9, 0x9E6C, 0x67EC, 0x9E6A, 0x67EE, 0x9E72, 0x67EF, 0x9E68, - 0x67F1, 0x928C, 0x67F3, 0x96F6, 0x67F4, 0x8EC4, 0x67F5, 0x8DF2, - 0x67FB, 0x8DB8, 0x67FE, 0x968F, 0x67FF, 0x8A60, 0x6801, 0xFAE5, - 0x6802, 0x92CC, 0x6803, 0x93C8, 0x6804, 0x8968, 0x6813, 0x90F0, - 0x6816, 0x90B2, 0x6817, 0x8C49, 0x681E, 0x9E78, 0x6821, 0x8D5A, - 0x6822, 0x8A9C, 0x6829, 0x9E7A, 0x682A, 0x8A94, 0x682B, 0x9E81, - 0x6832, 0x9E7D, 0x6834, 0x90F1, 0x6838, 0x8A6A, 0x6839, 0x8DAA, - 0x683C, 0x8A69, 0x683D, 0x8DCD, 0x6840, 0x9E7B, 0x6841, 0x8C85, - 0x6842, 0x8C6A, 0x6843, 0x938D, 0x6844, 0xFAE6, 0x6846, 0x9E79, - 0x6848, 0x88C4, 0x684D, 0x9E7C, 0x684E, 0x9E7E, 0x6850, 0x8BCB, - 0x6851, 0x8C4B, 0x6852, 0xFAE3, 0x6853, 0x8ABA, 0x6854, 0x8B6A, - 0x6859, 0x9E82, 0x685C, 0x8DF7, 0x685D, 0x9691, 0x685F, 0x8E56, - 0x6863, 0x9E83, 0x6867, 0x954F, 0x6874, 0x9E8F, 0x6876, 0x89B1, - 0x6877, 0x9E84, 0x687E, 0x9E95, 0x687F, 0x9E85, 0x6881, 0x97C0, - 0x6883, 0x9E8C, 0x6885, 0x947E, 0x688D, 0x9E94, 0x688F, 0x9E87, - 0x6893, 0x88B2, 0x6894, 0x9E89, 0x6897, 0x8D5B, 0x689B, 0x9E8B, - 0x689D, 0x9E8A, 0x689F, 0x9E86, 0x68A0, 0x9E91, 0x68A2, 0x8FBD, - 0x68A6, 0x9AEB, 0x68A7, 0x8CE6, 0x68A8, 0x979C, 0x68AD, 0x9E88, - 0x68AF, 0x92F2, 0x68B0, 0x8A42, 0x68B1, 0x8DAB, 0x68B3, 0x9E80, - 0x68B5, 0x9E90, 0x68B6, 0x8A81, 0x68B9, 0x9E8E, 0x68BA, 0x9E92, - 0x68BC, 0x938E, 0x68C4, 0x8AFC, 0x68C6, 0x9EB0, 0x68C8, 0xFA64, - 0x68C9, 0x96C7, 0x68CA, 0x9E97, 0x68CB, 0x8AFB, 0x68CD, 0x9E9E, - 0x68CF, 0xFAE7, 0x68D2, 0x965F, 0x68D4, 0x9E9F, 0x68D5, 0x9EA1, - 0x68D7, 0x9EA5, 0x68D8, 0x9E99, 0x68DA, 0x9249, 0x68DF, 0x938F, - 0x68E0, 0x9EA9, 0x68E1, 0x9E9C, 0x68E3, 0x9EA6, 0x68E7, 0x9EA0, - 0x68EE, 0x9058, 0x68EF, 0x9EAA, 0x68F2, 0x90B1, 0x68F9, 0x9EA8, - 0x68FA, 0x8ABB, 0x6900, 0x986F, 0x6901, 0x9E96, 0x6904, 0x9EA4, - 0x6905, 0x88D6, 0x6908, 0x9E98, 0x690B, 0x96B8, 0x690C, 0x9E9D, - 0x690D, 0x9041, 0x690E, 0x92C5, 0x690F, 0x9E93, 0x6912, 0x9EA3, - 0x6919, 0x909A, 0x691A, 0x9EAD, 0x691B, 0x8A91, 0x691C, 0x8C9F, - 0x6921, 0x9EAF, 0x6922, 0x9E9A, 0x6923, 0x9EAE, 0x6925, 0x9EA7, - 0x6926, 0x9E9B, 0x6928, 0x9EAB, 0x692A, 0x9EAC, 0x6930, 0x9EBD, - 0x6934, 0x93CC, 0x6936, 0x9EA2, 0x6939, 0x9EB9, 0x693D, 0x9EBB, - 0x693F, 0x92D6, 0x694A, 0x976B, 0x6953, 0x9596, 0x6954, 0x9EB6, - 0x6955, 0x91C8, 0x6959, 0x9EBC, 0x695A, 0x915E, 0x695C, 0x9EB3, - 0x695D, 0x9EC0, 0x695E, 0x9EBF, 0x6960, 0x93ED, 0x6961, 0x9EBE, - 0x6962, 0x93E8, 0x6968, 0xFAE9, 0x696A, 0x9EC2, 0x696B, 0x9EB5, - 0x696D, 0x8BC6, 0x696E, 0x9EB8, 0x696F, 0x8F7C, 0x6973, 0x9480, - 0x6974, 0x9EBA, 0x6975, 0x8BC9, 0x6977, 0x9EB2, 0x6978, 0x9EB4, - 0x6979, 0x9EB1, 0x697C, 0x984F, 0x697D, 0x8A79, 0x697E, 0x9EB7, - 0x6981, 0x9EC1, 0x6982, 0x8A54, 0x698A, 0x8DE5, 0x698E, 0x897C, - 0x6991, 0x9ED2, 0x6994, 0x9850, 0x6995, 0x9ED5, 0x6998, 0xFAEB, - 0x699B, 0x9059, 0x699C, 0x9ED4, 0x69A0, 0x9ED3, 0x69A7, 0x9ED0, - 0x69AE, 0x9EC4, 0x69B1, 0x9EE1, 0x69B2, 0x9EC3, 0x69B4, 0x9ED6, - 0x69BB, 0x9ECE, 0x69BE, 0x9EC9, 0x69BF, 0x9EC6, 0x69C1, 0x9EC7, - 0x69C3, 0x9ECF, 0x69C7, 0xEAA0, 0x69CA, 0x9ECC, 0x69CB, 0x8D5C, - 0x69CC, 0x92C6, 0x69CD, 0x9184, 0x69CE, 0x9ECA, 0x69D0, 0x9EC5, - 0x69D3, 0x9EC8, 0x69D8, 0x976C, 0x69D9, 0x968A, 0x69DD, 0x9ECD, - 0x69DE, 0x9ED7, 0x69E2, 0xFAEC, 0x69E7, 0x9EDF, 0x69E8, 0x9ED8, - 0x69EB, 0x9EE5, 0x69ED, 0x9EE3, 0x69F2, 0x9EDE, 0x69F9, 0x9EDD, - 0x69FB, 0x92CE, 0x69FD, 0x9185, 0x69FF, 0x9EDB, 0x6A02, 0x9ED9, - 0x6A05, 0x9EE0, 0x6A0A, 0x9EE6, 0x6A0B, 0x94F3, 0x6A0C, 0x9EEC, - 0x6A12, 0x9EE7, 0x6A13, 0x9EEA, 0x6A14, 0x9EE4, 0x6A17, 0x9294, - 0x6A19, 0x9557, 0x6A1B, 0x9EDA, 0x6A1E, 0x9EE2, 0x6A1F, 0x8FBE, - 0x6A21, 0x96CD, 0x6A22, 0x9EF6, 0x6A23, 0x9EE9, 0x6A29, 0x8CA0, - 0x6A2A, 0x89A1, 0x6A2B, 0x8A7E, 0x6A2E, 0x9ED1, 0x6A30, 0xFAED, - 0x6A35, 0x8FBF, 0x6A36, 0x9EEE, 0x6A38, 0x9EF5, 0x6A39, 0x8EF7, - 0x6A3A, 0x8A92, 0x6A3D, 0x924D, 0x6A44, 0x9EEB, 0x6A46, 0xFAEF, - 0x6A47, 0x9EF0, 0x6A48, 0x9EF4, 0x6A4B, 0x8BB4, 0x6A58, 0x8B6B, - 0x6A59, 0x9EF2, 0x6A5F, 0x8B40, 0x6A61, 0x93C9, 0x6A62, 0x9EF1, - 0x6A66, 0x9EF3, 0x6A6B, 0xFAEE, 0x6A72, 0x9EED, 0x6A73, 0xFAF0, - 0x6A78, 0x9EEF, 0x6A7E, 0xFAF1, 0x6A7F, 0x8A80, 0x6A80, 0x9268, - 0x6A84, 0x9EFA, 0x6A8D, 0x9EF8, 0x6A8E, 0x8CE7, 0x6A90, 0x9EF7, - 0x6A97, 0x9F40, 0x6A9C, 0x9E77, 0x6AA0, 0x9EF9, 0x6AA2, 0x9EFB, - 0x6AA3, 0x9EFC, 0x6AAA, 0x9F4B, 0x6AAC, 0x9F47, 0x6AAE, 0x9E8D, - 0x6AB3, 0x9F46, 0x6AB8, 0x9F45, 0x6ABB, 0x9F42, 0x6AC1, 0x9EE8, - 0x6AC2, 0x9F44, 0x6AC3, 0x9F43, 0x6AD1, 0x9F49, 0x6AD3, 0x9845, - 0x6ADA, 0x9F4C, 0x6ADB, 0x8BF9, 0x6ADE, 0x9F48, 0x6ADF, 0x9F4A, - 0x6AE2, 0xFAF2, 0x6AE4, 0xFAF3, 0x6AE8, 0x94A5, 0x6AEA, 0x9F4D, - 0x6AFA, 0x9F51, 0x6AFB, 0x9F4E, 0x6B04, 0x9793, 0x6B05, 0x9F4F, - 0x6B0A, 0x9EDC, 0x6B12, 0x9F52, 0x6B16, 0x9F53, 0x6B1D, 0x8954, - 0x6B1F, 0x9F55, 0x6B20, 0x8C87, 0x6B21, 0x8E9F, 0x6B23, 0x8BD3, - 0x6B27, 0x89A2, 0x6B32, 0x977E, 0x6B37, 0x9F57, 0x6B38, 0x9F56, - 0x6B39, 0x9F59, 0x6B3A, 0x8B5C, 0x6B3D, 0x8BD4, 0x6B3E, 0x8ABC, - 0x6B43, 0x9F5C, 0x6B47, 0x9F5B, 0x6B49, 0x9F5D, 0x6B4C, 0x89CC, - 0x6B4E, 0x9256, 0x6B50, 0x9F5E, 0x6B53, 0x8ABD, 0x6B54, 0x9F60, - 0x6B59, 0x9F5F, 0x6B5B, 0x9F61, 0x6B5F, 0x9F62, 0x6B61, 0x9F63, - 0x6B62, 0x8E7E, 0x6B63, 0x90B3, 0x6B64, 0x8D9F, 0x6B66, 0x9590, - 0x6B69, 0x95E0, 0x6B6A, 0x9863, 0x6B6F, 0x8E95, 0x6B73, 0x8DCE, - 0x6B74, 0x97F0, 0x6B78, 0x9F64, 0x6B79, 0x9F65, 0x6B7B, 0x8E80, - 0x6B7F, 0x9F66, 0x6B80, 0x9F67, 0x6B83, 0x9F69, 0x6B84, 0x9F68, - 0x6B86, 0x9677, 0x6B89, 0x8F7D, 0x6B8A, 0x8EEA, 0x6B8B, 0x8E63, - 0x6B8D, 0x9F6A, 0x6B95, 0x9F6C, 0x6B96, 0x9042, 0x6B98, 0x9F6B, - 0x6B9E, 0x9F6D, 0x6BA4, 0x9F6E, 0x6BAA, 0x9F6F, 0x6BAB, 0x9F70, - 0x6BAF, 0x9F71, 0x6BB1, 0x9F73, 0x6BB2, 0x9F72, 0x6BB3, 0x9F74, - 0x6BB4, 0x89A3, 0x6BB5, 0x9269, 0x6BB7, 0x9F75, 0x6BBA, 0x8E45, - 0x6BBB, 0x8A6B, 0x6BBC, 0x9F76, 0x6BBF, 0x9361, 0x6BC0, 0x9ACA, - 0x6BC5, 0x8B42, 0x6BC6, 0x9F77, 0x6BCB, 0x9F78, 0x6BCD, 0x95EA, - 0x6BCE, 0x9688, 0x6BD2, 0x93C5, 0x6BD3, 0x9F79, 0x6BD4, 0x94E4, - 0x6BD6, 0xFAF4, 0x6BD8, 0x94F9, 0x6BDB, 0x96D1, 0x6BDF, 0x9F7A, - 0x6BEB, 0x9F7C, 0x6BEC, 0x9F7B, 0x6BEF, 0x9F7E, 0x6BF3, 0x9F7D, - 0x6C08, 0x9F81, 0x6C0F, 0x8E81, 0x6C11, 0x96AF, 0x6C13, 0x9F82, - 0x6C14, 0x9F83, 0x6C17, 0x8B43, 0x6C1B, 0x9F84, 0x6C23, 0x9F86, - 0x6C24, 0x9F85, 0x6C34, 0x9085, 0x6C37, 0x9558, 0x6C38, 0x8969, - 0x6C3E, 0x94C3, 0x6C3F, 0xFAF5, 0x6C40, 0x92F3, 0x6C41, 0x8F60, - 0x6C42, 0x8B81, 0x6C4E, 0x94C4, 0x6C50, 0x8EAC, 0x6C55, 0x9F88, - 0x6C57, 0x8ABE, 0x6C5A, 0x8998, 0x6C5C, 0xFAF6, 0x6C5D, 0x93F0, - 0x6C5E, 0x9F87, 0x6C5F, 0x8D5D, 0x6C60, 0x9272, 0x6C62, 0x9F89, - 0x6C68, 0x9F91, 0x6C6A, 0x9F8A, 0x6C6F, 0xFAF8, 0x6C70, 0x91BF, - 0x6C72, 0x8B82, 0x6C73, 0x9F92, 0x6C7A, 0x8C88, 0x6C7D, 0x8B44, - 0x6C7E, 0x9F90, 0x6C81, 0x9F8E, 0x6C82, 0x9F8B, 0x6C83, 0x9780, - 0x6C86, 0xFAF7, 0x6C88, 0x92BE, 0x6C8C, 0x93D7, 0x6C8D, 0x9F8C, - 0x6C90, 0x9F94, 0x6C92, 0x9F93, 0x6C93, 0x8C42, 0x6C96, 0x89AB, - 0x6C99, 0x8DB9, 0x6C9A, 0x9F8D, 0x6C9B, 0x9F8F, 0x6CA1, 0x9676, - 0x6CA2, 0x91F2, 0x6CAB, 0x9697, 0x6CAE, 0x9F9C, 0x6CB1, 0x9F9D, - 0x6CB3, 0x89CD, 0x6CB8, 0x95A6, 0x6CB9, 0x96FB, 0x6CBA, 0x9F9F, - 0x6CBB, 0x8EA1, 0x6CBC, 0x8FC0, 0x6CBD, 0x9F98, 0x6CBE, 0x9F9E, - 0x6CBF, 0x8988, 0x6CC1, 0x8BB5, 0x6CC4, 0x9F95, 0x6CC5, 0x9F9A, - 0x6CC9, 0x90F2, 0x6CCA, 0x9491, 0x6CCC, 0x94E5, 0x6CD3, 0x9F97, - 0x6CD5, 0x9640, 0x6CD7, 0x9F99, 0x6CD9, 0x9FA2, 0x6CDA, 0xFAF9, - 0x6CDB, 0x9FA0, 0x6CDD, 0x9F9B, 0x6CE1, 0x9641, 0x6CE2, 0x9467, - 0x6CE3, 0x8B83, 0x6CE5, 0x9344, 0x6CE8, 0x928D, 0x6CEA, 0x9FA3, - 0x6CEF, 0x9FA1, 0x6CF0, 0x91D7, 0x6CF1, 0x9F96, 0x6CF3, 0x896A, - 0x6D04, 0xFAFA, 0x6D0B, 0x976D, 0x6D0C, 0x9FAE, 0x6D12, 0x9FAD, - 0x6D17, 0x90F4, 0x6D19, 0x9FAA, 0x6D1B, 0x978C, 0x6D1E, 0x93B4, - 0x6D1F, 0x9FA4, 0x6D25, 0x92C3, 0x6D29, 0x896B, 0x6D2A, 0x8D5E, - 0x6D2B, 0x9FA7, 0x6D32, 0x8F46, 0x6D33, 0x9FAC, 0x6D35, 0x9FAB, - 0x6D36, 0x9FA6, 0x6D38, 0x9FA9, 0x6D3B, 0x8A88, 0x6D3D, 0x9FA8, - 0x6D3E, 0x9468, 0x6D41, 0x97AC, 0x6D44, 0x8FF2, 0x6D45, 0x90F3, - 0x6D59, 0x9FB4, 0x6D5A, 0x9FB2, 0x6D5C, 0x956C, 0x6D63, 0x9FAF, - 0x6D64, 0x9FB1, 0x6D66, 0x8959, 0x6D69, 0x8D5F, 0x6D6A, 0x9851, - 0x6D6C, 0x8A5C, 0x6D6E, 0x9582, 0x6D6F, 0xFAFC, 0x6D74, 0x9781, - 0x6D77, 0x8A43, 0x6D78, 0x905A, 0x6D79, 0x9FB3, 0x6D85, 0x9FB8, - 0x6D87, 0xFAFB, 0x6D88, 0x8FC1, 0x6D8C, 0x974F, 0x6D8E, 0x9FB5, - 0x6D93, 0x9FB0, 0x6D95, 0x9FB6, 0x6D96, 0xFB40, 0x6D99, 0x97DC, - 0x6D9B, 0x9393, 0x6D9C, 0x93C0, 0x6DAC, 0xFB41, 0x6DAF, 0x8A55, - 0x6DB2, 0x8974, 0x6DB5, 0x9FBC, 0x6DB8, 0x9FBF, 0x6DBC, 0x97C1, - 0x6DC0, 0x9784, 0x6DC5, 0x9FC6, 0x6DC6, 0x9FC0, 0x6DC7, 0x9FBD, - 0x6DCB, 0x97D2, 0x6DCC, 0x9FC3, 0x6DCF, 0xFB42, 0x6DD1, 0x8F69, - 0x6DD2, 0x9FC5, 0x6DD5, 0x9FCA, 0x6DD8, 0x9391, 0x6DD9, 0x9FC8, - 0x6DDE, 0x9FC2, 0x6DE1, 0x9257, 0x6DE4, 0x9FC9, 0x6DE6, 0x9FBE, - 0x6DE8, 0x9FC4, 0x6DEA, 0x9FCB, 0x6DEB, 0x88FA, 0x6DEC, 0x9FC1, - 0x6DEE, 0x9FCC, 0x6DF1, 0x905B, 0x6DF2, 0xFB44, 0x6DF3, 0x8F7E, - 0x6DF5, 0x95A3, 0x6DF7, 0x8DAC, 0x6DF8, 0xFB43, 0x6DF9, 0x9FB9, - 0x6DFA, 0x9FC7, 0x6DFB, 0x9359, 0x6DFC, 0xFB45, 0x6E05, 0x90B4, - 0x6E07, 0x8A89, 0x6E08, 0x8DCF, 0x6E09, 0x8FC2, 0x6E0A, 0x9FBB, - 0x6E0B, 0x8F61, 0x6E13, 0x8C6B, 0x6E15, 0x9FBA, 0x6E19, 0x9FD0, - 0x6E1A, 0x8F8D, 0x6E1B, 0x8CB8, 0x6E1D, 0x9FDF, 0x6E1F, 0x9FD9, - 0x6E20, 0x8B94, 0x6E21, 0x936E, 0x6E23, 0x9FD4, 0x6E24, 0x9FDD, - 0x6E25, 0x88AD, 0x6E26, 0x8951, 0x6E27, 0xFB48, 0x6E29, 0x89B7, - 0x6E2B, 0x9FD6, 0x6E2C, 0x91AA, 0x6E2D, 0x9FCD, 0x6E2E, 0x9FCF, - 0x6E2F, 0x8D60, 0x6E38, 0x9FE0, 0x6E39, 0xFB46, 0x6E3A, 0x9FDB, - 0x6E3C, 0xFB49, 0x6E3E, 0x9FD3, 0x6E43, 0x9FDA, 0x6E4A, 0x96A9, - 0x6E4D, 0x9FD8, 0x6E4E, 0x9FDC, 0x6E56, 0x8CCE, 0x6E58, 0x8FC3, - 0x6E5B, 0x9258, 0x6E5C, 0xFB47, 0x6E5F, 0x9FD2, 0x6E67, 0x974E, - 0x6E6B, 0x9FD5, 0x6E6E, 0x9FCE, 0x6E6F, 0x9392, 0x6E72, 0x9FD1, - 0x6E76, 0x9FD7, 0x6E7E, 0x9870, 0x6E7F, 0x8EBC, 0x6E80, 0x969E, - 0x6E82, 0x9FE1, 0x6E8C, 0x94AC, 0x6E8F, 0x9FED, 0x6E90, 0x8CB9, - 0x6E96, 0x8F80, 0x6E98, 0x9FE3, 0x6E9C, 0x97AD, 0x6E9D, 0x8D61, - 0x6E9F, 0x9FF0, 0x6EA2, 0x88EC, 0x6EA5, 0x9FEE, 0x6EAA, 0x9FE2, - 0x6EAF, 0x9FE8, 0x6EB2, 0x9FEA, 0x6EB6, 0x976E, 0x6EB7, 0x9FE5, - 0x6EBA, 0x934D, 0x6EBD, 0x9FE7, 0x6EBF, 0xFB4A, 0x6EC2, 0x9FEF, - 0x6EC4, 0x9FE9, 0x6EC5, 0x96C5, 0x6EC9, 0x9FE4, 0x6ECB, 0x8EA0, - 0x6ECC, 0x9FFC, 0x6ED1, 0x8A8A, 0x6ED3, 0x9FE6, 0x6ED4, 0x9FEB, - 0x6ED5, 0x9FEC, 0x6EDD, 0x91EA, 0x6EDE, 0x91D8, 0x6EEC, 0x9FF4, - 0x6EEF, 0x9FFA, 0x6EF2, 0x9FF8, 0x6EF4, 0x9348, 0x6EF7, 0xE042, - 0x6EF8, 0x9FF5, 0x6EFE, 0x9FF6, 0x6EFF, 0x9FDE, 0x6F01, 0x8B99, - 0x6F02, 0x9559, 0x6F06, 0x8EBD, 0x6F09, 0x8D97, 0x6F0F, 0x9852, - 0x6F11, 0x9FF2, 0x6F13, 0xE041, 0x6F14, 0x8989, 0x6F15, 0x9186, - 0x6F20, 0x9499, 0x6F22, 0x8ABF, 0x6F23, 0x97F8, 0x6F2B, 0x969F, - 0x6F2C, 0x92D0, 0x6F31, 0x9FF9, 0x6F32, 0x9FFB, 0x6F38, 0x9151, - 0x6F3E, 0xE040, 0x6F3F, 0x9FF7, 0x6F41, 0x9FF1, 0x6F45, 0x8AC1, - 0x6F54, 0x8C89, 0x6F58, 0xE04E, 0x6F5B, 0xE049, 0x6F5C, 0x90F6, - 0x6F5F, 0x8A83, 0x6F64, 0x8F81, 0x6F66, 0xE052, 0x6F6D, 0xE04B, - 0x6F6E, 0x92AA, 0x6F6F, 0xE048, 0x6F70, 0x92D7, 0x6F74, 0xE06B, - 0x6F78, 0xE045, 0x6F7A, 0xE044, 0x6F7C, 0xE04D, 0x6F80, 0xE047, - 0x6F81, 0xE046, 0x6F82, 0xE04C, 0x6F84, 0x909F, 0x6F86, 0xE043, - 0x6F88, 0xFB4B, 0x6F8E, 0xE04F, 0x6F91, 0xE050, 0x6F97, 0x8AC0, - 0x6FA1, 0xE055, 0x6FA3, 0xE054, 0x6FA4, 0xE056, 0x6FAA, 0xE059, - 0x6FB1, 0x9362, 0x6FB3, 0xE053, 0x6FB5, 0xFB4C, 0x6FB9, 0xE057, - 0x6FC0, 0x8C83, 0x6FC1, 0x91F7, 0x6FC2, 0xE051, 0x6FC3, 0x945A, - 0x6FC6, 0xE058, 0x6FD4, 0xE05D, 0x6FD5, 0xE05B, 0x6FD8, 0xE05E, - 0x6FDB, 0xE061, 0x6FDF, 0xE05A, 0x6FE0, 0x8D8A, 0x6FE1, 0x9447, - 0x6FE4, 0x9FB7, 0x6FEB, 0x9794, 0x6FEC, 0xE05C, 0x6FEE, 0xE060, - 0x6FEF, 0x91F3, 0x6FF1, 0xE05F, 0x6FF3, 0xE04A, 0x6FF5, 0xFB4D, - 0x6FF6, 0xE889, 0x6FFA, 0xE064, 0x6FFE, 0xE068, 0x7001, 0xE066, - 0x7005, 0xFB4E, 0x7007, 0xFB4F, 0x7009, 0xE062, 0x700B, 0xE063, - 0x700F, 0xE067, 0x7011, 0xE065, 0x7015, 0x956D, 0x7018, 0xE06D, - 0x701A, 0xE06A, 0x701B, 0xE069, 0x701D, 0xE06C, 0x701E, 0x93D2, - 0x701F, 0xE06E, 0x7026, 0x9295, 0x7027, 0x91EB, 0x7028, 0xFB50, - 0x702C, 0x90A3, 0x7030, 0xE06F, 0x7032, 0xE071, 0x703E, 0xE070, - 0x704C, 0x9FF3, 0x7051, 0xE072, 0x7058, 0x93E5, 0x7063, 0xE073, - 0x706B, 0x89CE, 0x706F, 0x9394, 0x7070, 0x8A44, 0x7078, 0x8B84, - 0x707C, 0x8EDC, 0x707D, 0x8DD0, 0x7085, 0xFB51, 0x7089, 0x9846, - 0x708A, 0x9086, 0x708E, 0x898A, 0x7092, 0xE075, 0x7099, 0xE074, - 0x70AB, 0xFB52, 0x70AC, 0xE078, 0x70AD, 0x9259, 0x70AE, 0xE07B, - 0x70AF, 0xE076, 0x70B3, 0xE07A, 0x70B8, 0xE079, 0x70B9, 0x935F, - 0x70BA, 0x88D7, 0x70BB, 0xFA62, 0x70C8, 0x97F3, 0x70CB, 0xE07D, - 0x70CF, 0x8947, 0x70D9, 0xE080, 0x70DD, 0xE07E, 0x70DF, 0xE07C, - 0x70F1, 0xE077, 0x70F9, 0x9642, 0x70FD, 0xE082, 0x7104, 0xFB54, - 0x7109, 0xE081, 0x710F, 0xFB53, 0x7114, 0x898B, 0x7119, 0xE084, - 0x711A, 0x95B0, 0x711C, 0xE083, 0x7121, 0x96B3, 0x7126, 0x8FC5, - 0x7136, 0x9152, 0x713C, 0x8FC4, 0x7146, 0xFB56, 0x7147, 0xFB57, - 0x7149, 0x97F9, 0x714C, 0xE08A, 0x714E, 0x90F7, 0x7155, 0xE086, - 0x7156, 0xE08B, 0x7159, 0x898C, 0x715C, 0xFB55, 0x7162, 0xE089, - 0x7164, 0x9481, 0x7165, 0xE085, 0x7166, 0xE088, 0x7167, 0x8FC6, - 0x7169, 0x94CF, 0x716C, 0xE08C, 0x716E, 0x8ECF, 0x717D, 0x90F8, - 0x7184, 0xE08F, 0x7188, 0xE087, 0x718A, 0x8C46, 0x718F, 0xE08D, - 0x7194, 0x976F, 0x7195, 0xE090, 0x7199, 0xEAA4, 0x719F, 0x8F6E, - 0x71A8, 0xE091, 0x71AC, 0xE092, 0x71B1, 0x944D, 0x71B9, 0xE094, - 0x71BE, 0xE095, 0x71C1, 0xFB59, 0x71C3, 0x9452, 0x71C8, 0x9395, - 0x71C9, 0xE097, 0x71CE, 0xE099, 0x71D0, 0x97D3, 0x71D2, 0xE096, - 0x71D4, 0xE098, 0x71D5, 0x898D, 0x71D7, 0xE093, 0x71DF, 0x9A7A, - 0x71E0, 0xE09A, 0x71E5, 0x9187, 0x71E6, 0x8E57, 0x71E7, 0xE09C, - 0x71EC, 0xE09B, 0x71ED, 0x9043, 0x71EE, 0x99D7, 0x71F5, 0xE09D, - 0x71F9, 0xE09F, 0x71FB, 0xE08E, 0x71FC, 0xE09E, 0x71FE, 0xFB5A, - 0x71FF, 0xE0A0, 0x7206, 0x949A, 0x720D, 0xE0A1, 0x7210, 0xE0A2, - 0x721B, 0xE0A3, 0x7228, 0xE0A4, 0x722A, 0x92DC, 0x722C, 0xE0A6, - 0x722D, 0xE0A5, 0x7230, 0xE0A7, 0x7232, 0xE0A8, 0x7235, 0x8EDD, - 0x7236, 0x9583, 0x723A, 0x96EA, 0x723B, 0xE0A9, 0x723C, 0xE0AA, - 0x723D, 0x9175, 0x723E, 0x8EA2, 0x723F, 0xE0AB, 0x7240, 0xE0AC, - 0x7246, 0xE0AD, 0x7247, 0x95D0, 0x7248, 0x94C5, 0x724B, 0xE0AE, - 0x724C, 0x9476, 0x7252, 0x92AB, 0x7258, 0xE0AF, 0x7259, 0x89E5, - 0x725B, 0x8B8D, 0x725D, 0x96C4, 0x725F, 0x96B4, 0x7261, 0x89B2, - 0x7262, 0x9853, 0x7267, 0x9671, 0x7269, 0x95A8, 0x7272, 0x90B5, - 0x7274, 0xE0B0, 0x7279, 0x93C1, 0x727D, 0x8CA1, 0x727E, 0xE0B1, - 0x7280, 0x8DD2, 0x7281, 0xE0B3, 0x7282, 0xE0B2, 0x7287, 0xE0B4, - 0x7292, 0xE0B5, 0x7296, 0xE0B6, 0x72A0, 0x8B5D, 0x72A2, 0xE0B7, - 0x72A7, 0xE0B8, 0x72AC, 0x8CA2, 0x72AF, 0x94C6, 0x72B1, 0xFB5B, - 0x72B2, 0xE0BA, 0x72B6, 0x8FF3, 0x72B9, 0xE0B9, 0x72BE, 0xFB5C, - 0x72C2, 0x8BB6, 0x72C3, 0xE0BB, 0x72C4, 0xE0BD, 0x72C6, 0xE0BC, - 0x72CE, 0xE0BE, 0x72D0, 0x8CCF, 0x72D2, 0xE0BF, 0x72D7, 0x8BE7, - 0x72D9, 0x915F, 0x72DB, 0x8D9D, 0x72E0, 0xE0C1, 0x72E1, 0xE0C2, - 0x72E2, 0xE0C0, 0x72E9, 0x8EEB, 0x72EC, 0x93C6, 0x72ED, 0x8BB7, - 0x72F7, 0xE0C4, 0x72F8, 0x924B, 0x72F9, 0xE0C3, 0x72FC, 0x9854, - 0x72FD, 0x9482, 0x730A, 0xE0C7, 0x7316, 0xE0C9, 0x7317, 0xE0C6, - 0x731B, 0x96D2, 0x731C, 0xE0C8, 0x731D, 0xE0CA, 0x731F, 0x97C2, - 0x7324, 0xFB5D, 0x7325, 0xE0CE, 0x7329, 0xE0CD, 0x732A, 0x9296, - 0x732B, 0x944C, 0x732E, 0x8CA3, 0x732F, 0xE0CC, 0x7334, 0xE0CB, - 0x7336, 0x9750, 0x7337, 0x9751, 0x733E, 0xE0CF, 0x733F, 0x898E, - 0x7344, 0x8D96, 0x7345, 0x8E82, 0x734E, 0xE0D0, 0x734F, 0xE0D1, - 0x7357, 0xE0D3, 0x7363, 0x8F62, 0x7368, 0xE0D5, 0x736A, 0xE0D4, - 0x7370, 0xE0D6, 0x7372, 0x8A6C, 0x7375, 0xE0D8, 0x7377, 0xFB5F, - 0x7378, 0xE0D7, 0x737A, 0xE0DA, 0x737B, 0xE0D9, 0x7384, 0x8CBA, - 0x7387, 0x97A6, 0x7389, 0x8BCA, 0x738B, 0x89A4, 0x7396, 0x8BE8, - 0x73A9, 0x8ADF, 0x73B2, 0x97E6, 0x73B3, 0xE0DC, 0x73BB, 0xE0DE, - 0x73BD, 0xFB60, 0x73C0, 0xE0DF, 0x73C2, 0x89CF, 0x73C8, 0xE0DB, - 0x73C9, 0xFB61, 0x73CA, 0x8E58, 0x73CD, 0x92BF, 0x73CE, 0xE0DD, - 0x73D2, 0xFB64, 0x73D6, 0xFB62, 0x73DE, 0xE0E2, 0x73E0, 0x8EEC, - 0x73E3, 0xFB63, 0x73E5, 0xE0E0, 0x73EA, 0x8C5D, 0x73ED, 0x94C7, - 0x73EE, 0xE0E1, 0x73F1, 0xE0FC, 0x73F5, 0xFB66, 0x73F8, 0xE0E7, - 0x73FE, 0x8CBB, 0x7403, 0x8B85, 0x7405, 0xE0E4, 0x7406, 0x979D, - 0x7407, 0xFB65, 0x7409, 0x97AE, 0x7422, 0x91F4, 0x7425, 0xE0E6, - 0x7426, 0xFB67, 0x7429, 0xFB69, 0x742A, 0xFB68, 0x742E, 0xFB6A, - 0x7432, 0xE0E8, 0x7433, 0x97D4, 0x7434, 0x8BD5, 0x7435, 0x94FA, - 0x7436, 0x9469, 0x743A, 0xE0E9, 0x743F, 0xE0EB, 0x7441, 0xE0EE, - 0x7455, 0xE0EA, 0x7459, 0xE0ED, 0x745A, 0x8CE8, 0x745B, 0x896C, - 0x745C, 0xE0EF, 0x745E, 0x9090, 0x745F, 0xE0EC, 0x7460, 0x97DA, - 0x7462, 0xFB6B, 0x7463, 0xE0F2, 0x7464, 0xEAA2, 0x7469, 0xE0F0, - 0x746A, 0xE0F3, 0x746F, 0xE0E5, 0x7470, 0xE0F1, 0x7473, 0x8DBA, - 0x7476, 0xE0F4, 0x747E, 0xE0F5, 0x7483, 0x979E, 0x7489, 0xFB6C, - 0x748B, 0xE0F6, 0x749E, 0xE0F7, 0x749F, 0xFB6D, 0x74A2, 0xE0E3, - 0x74A7, 0xE0F8, 0x74B0, 0x8AC2, 0x74BD, 0x8EA3, 0x74CA, 0xE0F9, - 0x74CF, 0xE0FA, 0x74D4, 0xE0FB, 0x74DC, 0x895A, 0x74E0, 0xE140, - 0x74E2, 0x955A, 0x74E3, 0xE141, 0x74E6, 0x8AA2, 0x74E7, 0xE142, - 0x74E9, 0xE143, 0x74EE, 0xE144, 0x74F0, 0xE146, 0x74F1, 0xE147, - 0x74F2, 0xE145, 0x74F6, 0x9572, 0x74F7, 0xE149, 0x74F8, 0xE148, - 0x7501, 0xFB6E, 0x7503, 0xE14B, 0x7504, 0xE14A, 0x7505, 0xE14C, - 0x750C, 0xE14D, 0x750D, 0xE14F, 0x750E, 0xE14E, 0x7511, 0x8D99, - 0x7513, 0xE151, 0x7515, 0xE150, 0x7518, 0x8AC3, 0x751A, 0x9072, - 0x751C, 0x935B, 0x751E, 0xE152, 0x751F, 0x90B6, 0x7523, 0x8E59, - 0x7525, 0x8999, 0x7526, 0xE153, 0x7528, 0x9770, 0x752B, 0x95E1, - 0x752C, 0xE154, 0x752F, 0xFAA8, 0x7530, 0x9363, 0x7531, 0x9752, - 0x7532, 0x8D62, 0x7533, 0x905C, 0x7537, 0x926A, 0x7538, 0x99B2, - 0x753A, 0x92AC, 0x753B, 0x89E6, 0x753C, 0xE155, 0x7544, 0xE156, - 0x7546, 0xE15B, 0x7549, 0xE159, 0x754A, 0xE158, 0x754B, 0x9DC0, - 0x754C, 0x8A45, 0x754D, 0xE157, 0x754F, 0x88D8, 0x7551, 0x94A8, - 0x7554, 0x94C8, 0x7559, 0x97AF, 0x755A, 0xE15C, 0x755B, 0xE15A, - 0x755C, 0x927B, 0x755D, 0x90A4, 0x7560, 0x94A9, 0x7562, 0x954C, - 0x7564, 0xE15E, 0x7565, 0x97AA, 0x7566, 0x8C6C, 0x7567, 0xE15F, - 0x7569, 0xE15D, 0x756A, 0x94D4, 0x756B, 0xE160, 0x756D, 0xE161, - 0x756F, 0xFB6F, 0x7570, 0x88D9, 0x7573, 0x8FF4, 0x7574, 0xE166, - 0x7576, 0xE163, 0x7577, 0x93EB, 0x7578, 0xE162, 0x757F, 0x8B45, - 0x7582, 0xE169, 0x7586, 0xE164, 0x7587, 0xE165, 0x7589, 0xE168, - 0x758A, 0xE167, 0x758B, 0x9544, 0x758E, 0x9161, 0x758F, 0x9160, - 0x7591, 0x8B5E, 0x7594, 0xE16A, 0x759A, 0xE16B, 0x759D, 0xE16C, - 0x75A3, 0xE16E, 0x75A5, 0xE16D, 0x75AB, 0x8975, 0x75B1, 0xE176, - 0x75B2, 0x94E6, 0x75B3, 0xE170, 0x75B5, 0xE172, 0x75B8, 0xE174, - 0x75B9, 0x905D, 0x75BC, 0xE175, 0x75BD, 0xE173, 0x75BE, 0x8EBE, - 0x75C2, 0xE16F, 0x75C3, 0xE171, 0x75C5, 0x9561, 0x75C7, 0x8FC7, - 0x75CA, 0xE178, 0x75CD, 0xE177, 0x75D2, 0xE179, 0x75D4, 0x8EA4, - 0x75D5, 0x8DAD, 0x75D8, 0x9397, 0x75D9, 0xE17A, 0x75DB, 0x92C9, - 0x75DE, 0xE17C, 0x75E2, 0x979F, 0x75E3, 0xE17B, 0x75E9, 0x9189, - 0x75F0, 0xE182, 0x75F2, 0xE184, 0x75F3, 0xE185, 0x75F4, 0x9273, - 0x75FA, 0xE183, 0x75FC, 0xE180, 0x75FE, 0xE17D, 0x75FF, 0xE17E, - 0x7601, 0xE181, 0x7609, 0xE188, 0x760B, 0xE186, 0x760D, 0xE187, - 0x761F, 0xE189, 0x7620, 0xE18B, 0x7621, 0xE18C, 0x7622, 0xE18D, - 0x7624, 0xE18E, 0x7627, 0xE18A, 0x7630, 0xE190, 0x7634, 0xE18F, - 0x763B, 0xE191, 0x7642, 0x97C3, 0x7646, 0xE194, 0x7647, 0xE192, - 0x7648, 0xE193, 0x764C, 0x8AE0, 0x7652, 0x96FC, 0x7656, 0x95C8, - 0x7658, 0xE196, 0x765C, 0xE195, 0x7661, 0xE197, 0x7662, 0xE198, - 0x7667, 0xE19C, 0x7668, 0xE199, 0x7669, 0xE19A, 0x766A, 0xE19B, - 0x766C, 0xE19D, 0x7670, 0xE19E, 0x7672, 0xE19F, 0x7676, 0xE1A0, - 0x7678, 0xE1A1, 0x767A, 0x94AD, 0x767B, 0x936F, 0x767C, 0xE1A2, - 0x767D, 0x9492, 0x767E, 0x9553, 0x7680, 0xE1A3, 0x7682, 0xFB70, - 0x7683, 0xE1A4, 0x7684, 0x9349, 0x7686, 0x8A46, 0x7687, 0x8D63, - 0x7688, 0xE1A5, 0x768B, 0xE1A6, 0x768E, 0xE1A7, 0x7690, 0x8E48, - 0x7693, 0xE1A9, 0x7696, 0xE1A8, 0x7699, 0xE1AA, 0x769A, 0xE1AB, - 0x769B, 0xFB73, 0x769C, 0xFB71, 0x769E, 0xFB72, 0x76A6, 0xFB74, - 0x76AE, 0x94E7, 0x76B0, 0xE1AC, 0x76B4, 0xE1AD, 0x76B7, 0xEA89, - 0x76B8, 0xE1AE, 0x76B9, 0xE1AF, 0x76BA, 0xE1B0, 0x76BF, 0x8E4D, - 0x76C2, 0xE1B1, 0x76C3, 0x9475, 0x76C6, 0x967E, 0x76C8, 0x896D, - 0x76CA, 0x8976, 0x76CD, 0xE1B2, 0x76D2, 0xE1B4, 0x76D6, 0xE1B3, - 0x76D7, 0x9390, 0x76DB, 0x90B7, 0x76DC, 0x9F58, 0x76DE, 0xE1B5, - 0x76DF, 0x96BF, 0x76E1, 0xE1B6, 0x76E3, 0x8AC4, 0x76E4, 0x94D5, - 0x76E5, 0xE1B7, 0x76E7, 0xE1B8, 0x76EA, 0xE1B9, 0x76EE, 0x96DA, - 0x76F2, 0x96D3, 0x76F4, 0x92BC, 0x76F8, 0x918A, 0x76FB, 0xE1BB, - 0x76FE, 0x8F82, 0x7701, 0x8FC8, 0x7704, 0xE1BE, 0x7707, 0xE1BD, - 0x7708, 0xE1BC, 0x7709, 0x94FB, 0x770B, 0x8AC5, 0x770C, 0x8CA7, - 0x771B, 0xE1C4, 0x771E, 0xE1C1, 0x771F, 0x905E, 0x7720, 0x96B0, - 0x7724, 0xE1C0, 0x7725, 0xE1C2, 0x7726, 0xE1C3, 0x7729, 0xE1BF, - 0x7737, 0xE1C5, 0x7738, 0xE1C6, 0x773A, 0x92AD, 0x773C, 0x8AE1, - 0x7740, 0x9285, 0x7746, 0xFB76, 0x7747, 0xE1C7, 0x775A, 0xE1C8, - 0x775B, 0xE1CB, 0x7761, 0x9087, 0x7763, 0x93C2, 0x7765, 0xE1CC, - 0x7766, 0x9672, 0x7768, 0xE1C9, 0x776B, 0xE1CA, 0x7779, 0xE1CF, - 0x777E, 0xE1CE, 0x777F, 0xE1CD, 0x778B, 0xE1D1, 0x778E, 0xE1D0, - 0x7791, 0xE1D2, 0x779E, 0xE1D4, 0x77A0, 0xE1D3, 0x77A5, 0x95CB, - 0x77AC, 0x8F75, 0x77AD, 0x97C4, 0x77B0, 0xE1D5, 0x77B3, 0x93B5, - 0x77B6, 0xE1D6, 0x77B9, 0xE1D7, 0x77BB, 0xE1DB, 0x77BC, 0xE1D9, - 0x77BD, 0xE1DA, 0x77BF, 0xE1D8, 0x77C7, 0xE1DC, 0x77CD, 0xE1DD, - 0x77D7, 0xE1DE, 0x77DA, 0xE1DF, 0x77DB, 0x96B5, 0x77DC, 0xE1E0, - 0x77E2, 0x96EE, 0x77E3, 0xE1E1, 0x77E5, 0x926D, 0x77E7, 0x948A, - 0x77E9, 0x8BE9, 0x77ED, 0x925A, 0x77EE, 0xE1E2, 0x77EF, 0x8BB8, - 0x77F3, 0x90CE, 0x77FC, 0xE1E3, 0x7802, 0x8DBB, 0x780C, 0xE1E4, - 0x7812, 0xE1E5, 0x7814, 0x8CA4, 0x7815, 0x8DD3, 0x7820, 0xE1E7, - 0x7821, 0xFB78, 0x7825, 0x9375, 0x7826, 0x8DD4, 0x7827, 0x8B6D, - 0x7832, 0x9643, 0x7834, 0x946A, 0x783A, 0x9376, 0x783F, 0x8D7B, - 0x7845, 0xE1E9, 0x784E, 0xFB79, 0x785D, 0x8FC9, 0x7864, 0xFB7A, - 0x786B, 0x97B0, 0x786C, 0x8D64, 0x786F, 0x8CA5, 0x7872, 0x94A1, - 0x7874, 0xE1EB, 0x787A, 0xFB7B, 0x787C, 0xE1ED, 0x7881, 0x8CE9, - 0x7886, 0xE1EC, 0x7887, 0x92F4, 0x788C, 0xE1EF, 0x788D, 0x8A56, - 0x788E, 0xE1EA, 0x7891, 0x94E8, 0x7893, 0x894F, 0x7895, 0x8DEA, - 0x7897, 0x9871, 0x789A, 0xE1EE, 0x78A3, 0xE1F0, 0x78A7, 0x95C9, - 0x78A9, 0x90D7, 0x78AA, 0xE1F2, 0x78AF, 0xE1F3, 0x78B5, 0xE1F1, - 0x78BA, 0x8A6D, 0x78BC, 0xE1F9, 0x78BE, 0xE1F8, 0x78C1, 0x8EA5, - 0x78C5, 0xE1FA, 0x78C6, 0xE1F5, 0x78CA, 0xE1FB, 0x78CB, 0xE1F6, - 0x78D0, 0x94D6, 0x78D1, 0xE1F4, 0x78D4, 0xE1F7, 0x78DA, 0xE241, - 0x78E7, 0xE240, 0x78E8, 0x9681, 0x78EC, 0xE1FC, 0x78EF, 0x88E9, - 0x78F4, 0xE243, 0x78FD, 0xE242, 0x7901, 0x8FCA, 0x7907, 0xE244, - 0x790E, 0x9162, 0x7911, 0xE246, 0x7912, 0xE245, 0x7919, 0xE247, - 0x7926, 0xE1E6, 0x792A, 0xE1E8, 0x792B, 0xE249, 0x792C, 0xE248, - 0x7930, 0xFB7C, 0x793A, 0x8EA6, 0x793C, 0x97E7, 0x793E, 0x8ED0, - 0x7940, 0xE24A, 0x7941, 0x8C56, 0x7947, 0x8B5F, 0x7948, 0x8B46, - 0x7949, 0x8E83, 0x7950, 0x9753, 0x7953, 0xE250, 0x7955, 0xE24F, - 0x7956, 0x9163, 0x7957, 0xE24C, 0x795A, 0xE24E, 0x795D, 0x8F6A, - 0x795E, 0x905F, 0x795F, 0xE24D, 0x7960, 0xE24B, 0x7962, 0x9449, - 0x7965, 0x8FCB, 0x7968, 0x955B, 0x796D, 0x8DD5, 0x7977, 0x9398, - 0x797A, 0xE251, 0x797F, 0xE252, 0x7980, 0xE268, 0x7981, 0x8BD6, - 0x7984, 0x985C, 0x7985, 0x9154, 0x798A, 0xE253, 0x798D, 0x89D0, - 0x798E, 0x92F5, 0x798F, 0x959F, 0x7994, 0xFB81, 0x799B, 0xFB83, - 0x799D, 0xE254, 0x79A6, 0x8B9A, 0x79A7, 0xE255, 0x79AA, 0xE257, - 0x79AE, 0xE258, 0x79B0, 0x9448, 0x79B3, 0xE259, 0x79B9, 0xE25A, - 0x79BA, 0xE25B, 0x79BD, 0x8BD7, 0x79BE, 0x89D1, 0x79BF, 0x93C3, - 0x79C0, 0x8F47, 0x79C1, 0x8E84, 0x79C9, 0xE25C, 0x79CB, 0x8F48, - 0x79D1, 0x89C8, 0x79D2, 0x9562, 0x79D5, 0xE25D, 0x79D8, 0x94E9, - 0x79DF, 0x9164, 0x79E1, 0xE260, 0x79E3, 0xE261, 0x79E4, 0x9489, - 0x79E6, 0x9060, 0x79E7, 0xE25E, 0x79E9, 0x9281, 0x79EC, 0xE25F, - 0x79F0, 0x8FCC, 0x79FB, 0x88DA, 0x7A00, 0x8B48, 0x7A08, 0xE262, - 0x7A0B, 0x92F6, 0x7A0D, 0xE263, 0x7A0E, 0x90C5, 0x7A14, 0x96AB, - 0x7A17, 0x9542, 0x7A18, 0xE264, 0x7A19, 0xE265, 0x7A1A, 0x9274, - 0x7A1C, 0x97C5, 0x7A1F, 0xE267, 0x7A20, 0xE266, 0x7A2E, 0x8EED, - 0x7A31, 0xE269, 0x7A32, 0x88EE, 0x7A37, 0xE26C, 0x7A3B, 0xE26A, - 0x7A3C, 0x89D2, 0x7A3D, 0x8C6D, 0x7A3E, 0xE26B, 0x7A3F, 0x8D65, - 0x7A40, 0x8D92, 0x7A42, 0x95E4, 0x7A43, 0xE26D, 0x7A46, 0x9673, - 0x7A49, 0xE26F, 0x7A4D, 0x90CF, 0x7A4E, 0x896E, 0x7A4F, 0x89B8, - 0x7A50, 0x88AA, 0x7A57, 0xE26E, 0x7A61, 0xE270, 0x7A62, 0xE271, - 0x7A63, 0x8FF5, 0x7A69, 0xE272, 0x7A6B, 0x8A6E, 0x7A70, 0xE274, - 0x7A74, 0x8C8A, 0x7A76, 0x8B86, 0x7A79, 0xE275, 0x7A7A, 0x8BF3, - 0x7A7D, 0xE276, 0x7A7F, 0x90FA, 0x7A81, 0x93CB, 0x7A83, 0x90DE, - 0x7A84, 0x8DF3, 0x7A88, 0xE277, 0x7A92, 0x9282, 0x7A93, 0x918B, - 0x7A95, 0xE279, 0x7A96, 0xE27B, 0x7A97, 0xE278, 0x7A98, 0xE27A, - 0x7A9F, 0x8C41, 0x7AA9, 0xE27C, 0x7AAA, 0x8C45, 0x7AAE, 0x8B87, - 0x7AAF, 0x9771, 0x7AB0, 0xE27E, 0x7AB6, 0xE280, 0x7ABA, 0x894D, - 0x7ABF, 0xE283, 0x7AC3, 0x8A96, 0x7AC4, 0xE282, 0x7AC5, 0xE281, - 0x7AC7, 0xE285, 0x7AC8, 0xE27D, 0x7ACA, 0xE286, 0x7ACB, 0x97A7, - 0x7ACD, 0xE287, 0x7ACF, 0xE288, 0x7AD1, 0xFB84, 0x7AD2, 0x9AF2, - 0x7AD3, 0xE28A, 0x7AD5, 0xE289, 0x7AD9, 0xE28B, 0x7ADA, 0xE28C, - 0x7ADC, 0x97B3, 0x7ADD, 0xE28D, 0x7ADF, 0xE8ED, 0x7AE0, 0x8FCD, - 0x7AE1, 0xE28E, 0x7AE2, 0xE28F, 0x7AE3, 0x8F76, 0x7AE5, 0x93B6, - 0x7AE6, 0xE290, 0x7AE7, 0xFB85, 0x7AEA, 0x9247, 0x7AEB, 0xFB87, - 0x7AED, 0xE291, 0x7AEF, 0x925B, 0x7AF0, 0xE292, 0x7AF6, 0x8BA3, - 0x7AF8, 0x995E, 0x7AF9, 0x927C, 0x7AFA, 0x8EB1, 0x7AFF, 0x8AC6, - 0x7B02, 0xE293, 0x7B04, 0xE2A0, 0x7B06, 0xE296, 0x7B08, 0x8B88, - 0x7B0A, 0xE295, 0x7B0B, 0xE2A2, 0x7B0F, 0xE294, 0x7B11, 0x8FCE, - 0x7B18, 0xE298, 0x7B19, 0xE299, 0x7B1B, 0x934A, 0x7B1E, 0xE29A, - 0x7B20, 0x8A7D, 0x7B25, 0x9079, 0x7B26, 0x9584, 0x7B28, 0xE29C, - 0x7B2C, 0x91E6, 0x7B33, 0xE297, 0x7B35, 0xE29B, 0x7B36, 0xE29D, - 0x7B39, 0x8DF9, 0x7B45, 0xE2A4, 0x7B46, 0x954D, 0x7B48, 0x94A4, - 0x7B49, 0x9399, 0x7B4B, 0x8BD8, 0x7B4C, 0xE2A3, 0x7B4D, 0xE2A1, - 0x7B4F, 0x94B3, 0x7B50, 0xE29E, 0x7B51, 0x927D, 0x7B52, 0x939B, - 0x7B54, 0x939A, 0x7B56, 0x8DF4, 0x7B5D, 0xE2B6, 0x7B65, 0xE2A6, - 0x7B67, 0xE2A8, 0x7B6C, 0xE2AB, 0x7B6E, 0xE2AC, 0x7B70, 0xE2A9, - 0x7B71, 0xE2AA, 0x7B74, 0xE2A7, 0x7B75, 0xE2A5, 0x7B7A, 0xE29F, - 0x7B86, 0x95CD, 0x7B87, 0x89D3, 0x7B8B, 0xE2B3, 0x7B8D, 0xE2B0, - 0x7B8F, 0xE2B5, 0x7B92, 0xE2B4, 0x7B94, 0x9493, 0x7B95, 0x96A5, - 0x7B97, 0x8E5A, 0x7B98, 0xE2AE, 0x7B99, 0xE2B7, 0x7B9A, 0xE2B2, - 0x7B9C, 0xE2B1, 0x7B9D, 0xE2AD, 0x7B9E, 0xFB88, 0x7B9F, 0xE2AF, - 0x7BA1, 0x8AC7, 0x7BAA, 0x925C, 0x7BAD, 0x90FB, 0x7BB1, 0x94A0, - 0x7BB4, 0xE2BC, 0x7BB8, 0x94A2, 0x7BC0, 0x90DF, 0x7BC1, 0xE2B9, - 0x7BC4, 0x94CD, 0x7BC6, 0xE2BD, 0x7BC7, 0x95D1, 0x7BC9, 0x927A, - 0x7BCB, 0xE2B8, 0x7BCC, 0xE2BA, 0x7BCF, 0xE2BB, 0x7BDD, 0xE2BE, - 0x7BE0, 0x8EC2, 0x7BE4, 0x93C4, 0x7BE5, 0xE2C3, 0x7BE6, 0xE2C2, - 0x7BE9, 0xE2BF, 0x7BED, 0x9855, 0x7BF3, 0xE2C8, 0x7BF6, 0xE2CC, - 0x7BF7, 0xE2C9, 0x7C00, 0xE2C5, 0x7C07, 0xE2C6, 0x7C0D, 0xE2CB, - 0x7C11, 0xE2C0, 0x7C12, 0x99D3, 0x7C13, 0xE2C7, 0x7C14, 0xE2C1, - 0x7C17, 0xE2CA, 0x7C1F, 0xE2D0, 0x7C21, 0x8AC8, 0x7C23, 0xE2CD, - 0x7C27, 0xE2CE, 0x7C2A, 0xE2CF, 0x7C2B, 0xE2D2, 0x7C37, 0xE2D1, - 0x7C38, 0x94F4, 0x7C3D, 0xE2D3, 0x7C3E, 0x97FA, 0x7C3F, 0x95EB, - 0x7C40, 0xE2D8, 0x7C43, 0xE2D5, 0x7C4C, 0xE2D4, 0x7C4D, 0x90D0, - 0x7C4F, 0xE2D7, 0x7C50, 0xE2D9, 0x7C54, 0xE2D6, 0x7C56, 0xE2DD, - 0x7C58, 0xE2DA, 0x7C5F, 0xE2DB, 0x7C60, 0xE2C4, 0x7C64, 0xE2DC, - 0x7C65, 0xE2DE, 0x7C6C, 0xE2DF, 0x7C73, 0x95C4, 0x7C75, 0xE2E0, - 0x7C7E, 0x96E0, 0x7C81, 0x8BCC, 0x7C82, 0x8C48, 0x7C83, 0xE2E1, - 0x7C89, 0x95B2, 0x7C8B, 0x9088, 0x7C8D, 0x96AE, 0x7C90, 0xE2E2, - 0x7C92, 0x97B1, 0x7C95, 0x9494, 0x7C97, 0x9165, 0x7C98, 0x9453, - 0x7C9B, 0x8F6C, 0x7C9F, 0x88BE, 0x7CA1, 0xE2E7, 0x7CA2, 0xE2E5, - 0x7CA4, 0xE2E3, 0x7CA5, 0x8A9F, 0x7CA7, 0x8FCF, 0x7CA8, 0xE2E8, - 0x7CAB, 0xE2E6, 0x7CAD, 0xE2E4, 0x7CAE, 0xE2EC, 0x7CB1, 0xE2EB, - 0x7CB2, 0xE2EA, 0x7CB3, 0xE2E9, 0x7CB9, 0xE2ED, 0x7CBD, 0xE2EE, - 0x7CBE, 0x90B8, 0x7CC0, 0xE2EF, 0x7CC2, 0xE2F1, 0x7CC5, 0xE2F0, - 0x7CCA, 0x8CD0, 0x7CCE, 0x9157, 0x7CD2, 0xE2F3, 0x7CD6, 0x939C, - 0x7CD8, 0xE2F2, 0x7CDC, 0xE2F4, 0x7CDE, 0x95B3, 0x7CDF, 0x918C, - 0x7CE0, 0x8D66, 0x7CE2, 0xE2F5, 0x7CE7, 0x97C6, 0x7CEF, 0xE2F7, - 0x7CF2, 0xE2F8, 0x7CF4, 0xE2F9, 0x7CF6, 0xE2FA, 0x7CF8, 0x8E85, - 0x7CFA, 0xE2FB, 0x7CFB, 0x8C6E, 0x7CFE, 0x8B8A, 0x7D00, 0x8B49, - 0x7D02, 0xE340, 0x7D04, 0x96F1, 0x7D05, 0x8D67, 0x7D06, 0xE2FC, - 0x7D0A, 0xE343, 0x7D0B, 0x96E4, 0x7D0D, 0x945B, 0x7D10, 0x9552, - 0x7D14, 0x8F83, 0x7D15, 0xE342, 0x7D17, 0x8ED1, 0x7D18, 0x8D68, - 0x7D19, 0x8E86, 0x7D1A, 0x8B89, 0x7D1B, 0x95B4, 0x7D1C, 0xE341, - 0x7D20, 0x9166, 0x7D21, 0x9661, 0x7D22, 0x8DF5, 0x7D2B, 0x8E87, - 0x7D2C, 0x92DB, 0x7D2E, 0xE346, 0x7D2F, 0x97DD, 0x7D30, 0x8DD7, - 0x7D32, 0xE347, 0x7D33, 0x9061, 0x7D35, 0xE349, 0x7D39, 0x8FD0, - 0x7D3A, 0x8DAE, 0x7D3F, 0xE348, 0x7D42, 0x8F49, 0x7D43, 0x8CBC, - 0x7D44, 0x9167, 0x7D45, 0xE344, 0x7D46, 0xE34A, 0x7D48, 0xFB8A, - 0x7D4B, 0xE345, 0x7D4C, 0x8C6F, 0x7D4E, 0xE34D, 0x7D4F, 0xE351, - 0x7D50, 0x8C8B, 0x7D56, 0xE34C, 0x7D5B, 0xE355, 0x7D5C, 0xFB8B, - 0x7D5E, 0x8D69, 0x7D61, 0x978D, 0x7D62, 0x88BA, 0x7D63, 0xE352, - 0x7D66, 0x8B8B, 0x7D68, 0xE34F, 0x7D6E, 0xE350, 0x7D71, 0x939D, - 0x7D72, 0xE34E, 0x7D73, 0xE34B, 0x7D75, 0x8A47, 0x7D76, 0x90E2, - 0x7D79, 0x8CA6, 0x7D7D, 0xE357, 0x7D89, 0xE354, 0x7D8F, 0xE356, - 0x7D93, 0xE353, 0x7D99, 0x8C70, 0x7D9A, 0x91B1, 0x7D9B, 0xE358, - 0x7D9C, 0x918E, 0x7D9F, 0xE365, 0x7DA0, 0xFB8D, 0x7DA2, 0xE361, - 0x7DA3, 0xE35B, 0x7DAB, 0xE35F, 0x7DAC, 0x8EF8, 0x7DAD, 0x88DB, - 0x7DAE, 0xE35A, 0x7DAF, 0xE362, 0x7DB0, 0xE366, 0x7DB1, 0x8D6A, - 0x7DB2, 0x96D4, 0x7DB4, 0x92D4, 0x7DB5, 0xE35C, 0x7DB7, 0xFB8C, - 0x7DB8, 0xE364, 0x7DBA, 0xE359, 0x7DBB, 0x925D, 0x7DBD, 0xE35E, - 0x7DBE, 0x88BB, 0x7DBF, 0x96C8, 0x7DC7, 0xE35D, 0x7DCA, 0x8BD9, - 0x7DCB, 0x94EA, 0x7DCF, 0x918D, 0x7DD1, 0x97CE, 0x7DD2, 0x8F8F, - 0x7DD5, 0xE38E, 0x7DD6, 0xFB8E, 0x7DD8, 0xE367, 0x7DDA, 0x90FC, - 0x7DDC, 0xE363, 0x7DDD, 0xE368, 0x7DDE, 0xE36A, 0x7DE0, 0x92F7, - 0x7DE1, 0xE36D, 0x7DE4, 0xE369, 0x7DE8, 0x95D2, 0x7DE9, 0x8AC9, - 0x7DEC, 0x96C9, 0x7DEF, 0x88DC, 0x7DF2, 0xE36C, 0x7DF4, 0x97FB, - 0x7DFB, 0xE36B, 0x7E01, 0x898F, 0x7E04, 0x93EA, 0x7E05, 0xE36E, - 0x7E09, 0xE375, 0x7E0A, 0xE36F, 0x7E0B, 0xE376, 0x7E12, 0xE372, - 0x7E1B, 0x949B, 0x7E1E, 0x8EC8, 0x7E1F, 0xE374, 0x7E21, 0xE371, - 0x7E22, 0xE377, 0x7E23, 0xE370, 0x7E26, 0x8F63, 0x7E2B, 0x9644, - 0x7E2E, 0x8F6B, 0x7E31, 0xE373, 0x7E32, 0xE380, 0x7E35, 0xE37B, - 0x7E37, 0xE37E, 0x7E39, 0xE37C, 0x7E3A, 0xE381, 0x7E3B, 0xE37A, - 0x7E3D, 0xE360, 0x7E3E, 0x90D1, 0x7E41, 0x94C9, 0x7E43, 0xE37D, - 0x7E46, 0xE378, 0x7E4A, 0x9140, 0x7E4B, 0x8C71, 0x7E4D, 0x8F4A, - 0x7E52, 0xFB8F, 0x7E54, 0x9044, 0x7E55, 0x9155, 0x7E56, 0xE384, - 0x7E59, 0xE386, 0x7E5A, 0xE387, 0x7E5D, 0xE383, 0x7E5E, 0xE385, - 0x7E66, 0xE379, 0x7E67, 0xE382, 0x7E69, 0xE38A, 0x7E6A, 0xE389, - 0x7E6D, 0x969A, 0x7E70, 0x8C4A, 0x7E79, 0xE388, 0x7E7B, 0xE38C, - 0x7E7C, 0xE38B, 0x7E7D, 0xE38F, 0x7E7F, 0xE391, 0x7E82, 0x8E5B, - 0x7E83, 0xE38D, 0x7E88, 0xE392, 0x7E89, 0xE393, 0x7E8A, 0xFA5C, - 0x7E8C, 0xE394, 0x7E8E, 0xE39A, 0x7E8F, 0x935A, 0x7E90, 0xE396, - 0x7E92, 0xE395, 0x7E93, 0xE397, 0x7E94, 0xE398, 0x7E96, 0xE399, - 0x7E9B, 0xE39B, 0x7E9C, 0xE39C, 0x7F36, 0x8ACA, 0x7F38, 0xE39D, - 0x7F3A, 0xE39E, 0x7F45, 0xE39F, 0x7F47, 0xFB90, 0x7F4C, 0xE3A0, - 0x7F4D, 0xE3A1, 0x7F4E, 0xE3A2, 0x7F50, 0xE3A3, 0x7F51, 0xE3A4, - 0x7F54, 0xE3A6, 0x7F55, 0xE3A5, 0x7F58, 0xE3A7, 0x7F5F, 0xE3A8, - 0x7F60, 0xE3A9, 0x7F67, 0xE3AC, 0x7F68, 0xE3AA, 0x7F69, 0xE3AB, - 0x7F6A, 0x8DDF, 0x7F6B, 0x8C72, 0x7F6E, 0x9275, 0x7F70, 0x94B1, - 0x7F72, 0x8F90, 0x7F75, 0x946C, 0x7F77, 0x94EB, 0x7F78, 0xE3AD, - 0x7F79, 0x9CEB, 0x7F82, 0xE3AE, 0x7F83, 0xE3B0, 0x7F85, 0x9785, - 0x7F86, 0xE3AF, 0x7F87, 0xE3B2, 0x7F88, 0xE3B1, 0x7F8A, 0x9772, - 0x7F8C, 0xE3B3, 0x7F8E, 0x94FC, 0x7F94, 0xE3B4, 0x7F9A, 0xE3B7, - 0x7F9D, 0xE3B6, 0x7F9E, 0xE3B5, 0x7FA1, 0xFB91, 0x7FA3, 0xE3B8, - 0x7FA4, 0x8C51, 0x7FA8, 0x9141, 0x7FA9, 0x8B60, 0x7FAE, 0xE3BC, - 0x7FAF, 0xE3B9, 0x7FB2, 0xE3BA, 0x7FB6, 0xE3BD, 0x7FB8, 0xE3BE, - 0x7FB9, 0xE3BB, 0x7FBD, 0x8948, 0x7FC1, 0x89A5, 0x7FC5, 0xE3C0, - 0x7FC6, 0xE3C1, 0x7FCA, 0xE3C2, 0x7FCC, 0x9782, 0x7FD2, 0x8F4B, - 0x7FD4, 0xE3C4, 0x7FD5, 0xE3C3, 0x7FE0, 0x9089, 0x7FE1, 0xE3C5, - 0x7FE6, 0xE3C6, 0x7FE9, 0xE3C7, 0x7FEB, 0x8AE3, 0x7FF0, 0x8ACB, - 0x7FF3, 0xE3C8, 0x7FF9, 0xE3C9, 0x7FFB, 0x967C, 0x7FFC, 0x9783, - 0x8000, 0x9773, 0x8001, 0x9856, 0x8003, 0x8D6C, 0x8004, 0xE3CC, - 0x8005, 0x8ED2, 0x8006, 0xE3CB, 0x800B, 0xE3CD, 0x800C, 0x8EA7, - 0x8010, 0x91CF, 0x8012, 0xE3CE, 0x8015, 0x8D6B, 0x8017, 0x96D5, - 0x8018, 0xE3CF, 0x8019, 0xE3D0, 0x801C, 0xE3D1, 0x8021, 0xE3D2, - 0x8028, 0xE3D3, 0x8033, 0x8EA8, 0x8036, 0x96EB, 0x803B, 0xE3D5, - 0x803D, 0x925E, 0x803F, 0xE3D4, 0x8046, 0xE3D7, 0x804A, 0xE3D6, - 0x8052, 0xE3D8, 0x8056, 0x90B9, 0x8058, 0xE3D9, 0x805A, 0xE3DA, - 0x805E, 0x95B7, 0x805F, 0xE3DB, 0x8061, 0x918F, 0x8062, 0xE3DC, - 0x8068, 0xE3DD, 0x806F, 0x97FC, 0x8070, 0xE3E0, 0x8072, 0xE3DF, - 0x8073, 0xE3DE, 0x8074, 0x92AE, 0x8076, 0xE3E1, 0x8077, 0x9045, - 0x8079, 0xE3E2, 0x807D, 0xE3E3, 0x807E, 0x9857, 0x807F, 0xE3E4, - 0x8084, 0xE3E5, 0x8085, 0xE3E7, 0x8086, 0xE3E6, 0x8087, 0x94A3, - 0x8089, 0x93F7, 0x808B, 0x985D, 0x808C, 0x94A7, 0x8093, 0xE3E9, - 0x8096, 0x8FD1, 0x8098, 0x9549, 0x809A, 0xE3EA, 0x809B, 0xE3E8, - 0x809D, 0x8ACC, 0x80A1, 0x8CD2, 0x80A2, 0x8E88, 0x80A5, 0x94EC, - 0x80A9, 0x8CA8, 0x80AA, 0x9662, 0x80AC, 0xE3ED, 0x80AD, 0xE3EB, - 0x80AF, 0x8D6D, 0x80B1, 0x8D6E, 0x80B2, 0x88E7, 0x80B4, 0x8DE6, - 0x80BA, 0x9478, 0x80C3, 0x88DD, 0x80C4, 0xE3F2, 0x80C6, 0x925F, - 0x80CC, 0x9477, 0x80CE, 0x91D9, 0x80D6, 0xE3F4, 0x80D9, 0xE3F0, - 0x80DA, 0xE3F3, 0x80DB, 0xE3EE, 0x80DD, 0xE3F1, 0x80DE, 0x9645, - 0x80E1, 0x8CD3, 0x80E4, 0x88FB, 0x80E5, 0xE3EF, 0x80EF, 0xE3F6, - 0x80F1, 0xE3F7, 0x80F4, 0x93B7, 0x80F8, 0x8BB9, 0x80FC, 0xE445, - 0x80FD, 0x945C, 0x8102, 0x8E89, 0x8105, 0x8BBA, 0x8106, 0x90C6, - 0x8107, 0x9865, 0x8108, 0x96AC, 0x8109, 0xE3F5, 0x810A, 0x90D2, - 0x811A, 0x8B72, 0x811B, 0xE3F8, 0x8123, 0xE3FA, 0x8129, 0xE3F9, - 0x812F, 0xE3FB, 0x8131, 0x9245, 0x8133, 0x945D, 0x8139, 0x92AF, - 0x813E, 0xE442, 0x8146, 0xE441, 0x814B, 0xE3FC, 0x814E, 0x9074, - 0x8150, 0x9585, 0x8151, 0xE444, 0x8153, 0xE443, 0x8154, 0x8D6F, - 0x8155, 0x9872, 0x815F, 0xE454, 0x8165, 0xE448, 0x8166, 0xE449, - 0x816B, 0x8EEE, 0x816E, 0xE447, 0x8170, 0x8D98, 0x8171, 0xE446, - 0x8174, 0xE44A, 0x8178, 0x92B0, 0x8179, 0x95A0, 0x817A, 0x9142, - 0x817F, 0x91DA, 0x8180, 0xE44E, 0x8182, 0xE44F, 0x8183, 0xE44B, - 0x8188, 0xE44C, 0x818A, 0xE44D, 0x818F, 0x8D70, 0x8193, 0xE455, - 0x8195, 0xE451, 0x819A, 0x9586, 0x819C, 0x968C, 0x819D, 0x9547, - 0x81A0, 0xE450, 0x81A3, 0xE453, 0x81A4, 0xE452, 0x81A8, 0x9663, - 0x81A9, 0xE456, 0x81B0, 0xE457, 0x81B3, 0x9156, 0x81B5, 0xE458, - 0x81B8, 0xE45A, 0x81BA, 0xE45E, 0x81BD, 0xE45B, 0x81BE, 0xE459, - 0x81BF, 0x945E, 0x81C0, 0xE45C, 0x81C2, 0xE45D, 0x81C6, 0x89B0, - 0x81C8, 0xE464, 0x81C9, 0xE45F, 0x81CD, 0xE460, 0x81D1, 0xE461, - 0x81D3, 0x919F, 0x81D8, 0xE463, 0x81D9, 0xE462, 0x81DA, 0xE465, - 0x81DF, 0xE466, 0x81E0, 0xE467, 0x81E3, 0x9062, 0x81E5, 0x89E7, - 0x81E7, 0xE468, 0x81E8, 0x97D5, 0x81EA, 0x8EA9, 0x81ED, 0x8F4C, - 0x81F3, 0x8E8A, 0x81F4, 0x9276, 0x81FA, 0xE469, 0x81FB, 0xE46A, - 0x81FC, 0x8950, 0x81FE, 0xE46B, 0x8201, 0xE46C, 0x8202, 0xE46D, - 0x8205, 0xE46E, 0x8207, 0xE46F, 0x8208, 0x8BBB, 0x8209, 0x9DA8, - 0x820A, 0xE470, 0x820C, 0x90E3, 0x820D, 0xE471, 0x820E, 0x8EC9, - 0x8210, 0xE472, 0x8212, 0x98AE, 0x8216, 0xE473, 0x8217, 0x95DC, - 0x8218, 0x8ADA, 0x821B, 0x9143, 0x821C, 0x8F77, 0x821E, 0x9591, - 0x821F, 0x8F4D, 0x8229, 0xE474, 0x822A, 0x8D71, 0x822B, 0xE475, - 0x822C, 0x94CA, 0x822E, 0xE484, 0x8233, 0xE477, 0x8235, 0x91C7, - 0x8236, 0x9495, 0x8237, 0x8CBD, 0x8238, 0xE476, 0x8239, 0x9144, - 0x8240, 0xE478, 0x8247, 0x92F8, 0x8258, 0xE47A, 0x8259, 0xE479, - 0x825A, 0xE47C, 0x825D, 0xE47B, 0x825F, 0xE47D, 0x8262, 0xE480, - 0x8264, 0xE47E, 0x8266, 0x8ACD, 0x8268, 0xE481, 0x826A, 0xE482, - 0x826B, 0xE483, 0x826E, 0x8DAF, 0x826F, 0x97C7, 0x8271, 0xE485, - 0x8272, 0x9046, 0x8276, 0x8990, 0x8277, 0xE486, 0x8278, 0xE487, - 0x827E, 0xE488, 0x828B, 0x88F0, 0x828D, 0xE489, 0x8292, 0xE48A, - 0x8299, 0x9587, 0x829D, 0x8EC5, 0x829F, 0xE48C, 0x82A5, 0x8A48, - 0x82A6, 0x88B0, 0x82AB, 0xE48B, 0x82AC, 0xE48E, 0x82AD, 0x946D, - 0x82AF, 0x9063, 0x82B1, 0x89D4, 0x82B3, 0x9646, 0x82B8, 0x8C7C, - 0x82B9, 0x8BDA, 0x82BB, 0xE48D, 0x82BD, 0x89E8, 0x82C5, 0x8AA1, - 0x82D1, 0x8991, 0x82D2, 0xE492, 0x82D3, 0x97E8, 0x82D4, 0x91DB, - 0x82D7, 0x9563, 0x82D9, 0xE49E, 0x82DB, 0x89D5, 0x82DC, 0xE49C, - 0x82DE, 0xE49A, 0x82DF, 0xE491, 0x82E1, 0xE48F, 0x82E3, 0xE490, - 0x82E5, 0x8EE1, 0x82E6, 0x8BEA, 0x82E7, 0x9297, 0x82EB, 0x93CF, - 0x82F1, 0x8970, 0x82F3, 0xE494, 0x82F4, 0xE493, 0x82F9, 0xE499, - 0x82FA, 0xE495, 0x82FB, 0xE498, 0x8301, 0xFB93, 0x8302, 0x96CE, - 0x8303, 0xE497, 0x8304, 0x89D6, 0x8305, 0x8A9D, 0x8306, 0xE49B, - 0x8309, 0xE49D, 0x830E, 0x8C73, 0x8316, 0xE4A1, 0x8317, 0xE4AA, - 0x8318, 0xE4AB, 0x831C, 0x88A9, 0x8323, 0xE4B2, 0x8328, 0x88EF, - 0x832B, 0xE4A9, 0x832F, 0xE4A8, 0x8331, 0xE4A3, 0x8332, 0xE4A2, - 0x8334, 0xE4A0, 0x8335, 0xE49F, 0x8336, 0x9283, 0x8338, 0x91F9, - 0x8339, 0xE4A5, 0x8340, 0xE4A4, 0x8345, 0xE4A7, 0x8349, 0x9190, - 0x834A, 0x8C74, 0x834F, 0x8960, 0x8350, 0xE4A6, 0x8352, 0x8D72, - 0x8358, 0x9191, 0x8362, 0xFB94, 0x8373, 0xE4B8, 0x8375, 0xE4B9, - 0x8377, 0x89D7, 0x837B, 0x89AC, 0x837C, 0xE4B6, 0x837F, 0xFB95, - 0x8385, 0xE4AC, 0x8387, 0xE4B4, 0x8389, 0xE4BB, 0x838A, 0xE4B5, - 0x838E, 0xE4B3, 0x8393, 0xE496, 0x8396, 0xE4B1, 0x839A, 0xE4AD, - 0x839E, 0x8ACE, 0x839F, 0xE4AF, 0x83A0, 0xE4BA, 0x83A2, 0xE4B0, - 0x83A8, 0xE4BC, 0x83AA, 0xE4AE, 0x83AB, 0x949C, 0x83B1, 0x9789, - 0x83B5, 0xE4B7, 0x83BD, 0xE4CD, 0x83C1, 0xE4C5, 0x83C5, 0x909B, - 0x83C7, 0xFB96, 0x83CA, 0x8B65, 0x83CC, 0x8BDB, 0x83CE, 0xE4C0, - 0x83D3, 0x89D9, 0x83D6, 0x8FD2, 0x83D8, 0xE4C3, 0x83DC, 0x8DD8, - 0x83DF, 0x9370, 0x83E0, 0xE4C8, 0x83E9, 0x95EC, 0x83EB, 0xE4BF, - 0x83EF, 0x89D8, 0x83F0, 0x8CD4, 0x83F1, 0x9548, 0x83F2, 0xE4C9, - 0x83F4, 0xE4BD, 0x83F6, 0xFB97, 0x83F7, 0xE4C6, 0x83FB, 0xE4D0, - 0x83FD, 0xE4C1, 0x8403, 0xE4C2, 0x8404, 0x93B8, 0x8407, 0xE4C7, - 0x840B, 0xE4C4, 0x840C, 0x9647, 0x840D, 0xE4CA, 0x840E, 0x88DE, - 0x8413, 0xE4BE, 0x8420, 0xE4CC, 0x8422, 0xE4CB, 0x8429, 0x948B, - 0x842A, 0xE4D2, 0x842C, 0xE4DD, 0x8431, 0x8A9E, 0x8435, 0xE4E0, - 0x8438, 0xE4CE, 0x843C, 0xE4D3, 0x843D, 0x978E, 0x8446, 0xE4DC, - 0x8448, 0xFB98, 0x8449, 0x9774, 0x844E, 0x97A8, 0x8457, 0x9298, - 0x845B, 0x8A8B, 0x8461, 0x9592, 0x8462, 0xE4E2, 0x8463, 0x939F, - 0x8466, 0x88AF, 0x8469, 0xE4DB, 0x846B, 0xE4D7, 0x846C, 0x9192, - 0x846D, 0xE4D1, 0x846E, 0xE4D9, 0x846F, 0xE4DE, 0x8471, 0x944B, - 0x8475, 0x88A8, 0x8477, 0xE4D6, 0x8479, 0xE4DF, 0x847A, 0x9598, - 0x8482, 0xE4DA, 0x8484, 0xE4D5, 0x848B, 0x8FD3, 0x8490, 0x8F4E, - 0x8494, 0x8EAA, 0x8499, 0x96D6, 0x849C, 0x9566, 0x849F, 0xE4E5, - 0x84A1, 0xE4EE, 0x84AD, 0xE4D8, 0x84B2, 0x8A97, 0x84B4, 0xFB99, - 0x84B8, 0x8FF6, 0x84B9, 0xE4E3, 0x84BB, 0xE4E8, 0x84BC, 0x9193, - 0x84BF, 0xE4E4, 0x84C1, 0xE4EB, 0x84C4, 0x927E, 0x84C6, 0xE4EC, - 0x84C9, 0x9775, 0x84CA, 0xE4E1, 0x84CB, 0x8A57, 0x84CD, 0xE4E7, - 0x84D0, 0xE4EA, 0x84D1, 0x96AA, 0x84D6, 0xE4ED, 0x84D9, 0xE4E6, - 0x84DA, 0xE4E9, 0x84DC, 0xFA60, 0x84EC, 0x9648, 0x84EE, 0x9840, - 0x84F4, 0xE4F1, 0x84FC, 0xE4F8, 0x84FF, 0xE4F0, 0x8500, 0x8EC1, - 0x8506, 0xE4CF, 0x8511, 0x95CC, 0x8513, 0x96A0, 0x8514, 0xE4F7, - 0x8515, 0xE4F6, 0x8517, 0xE4F2, 0x8518, 0xE4F3, 0x851A, 0x8955, - 0x851F, 0xE4F5, 0x8521, 0xE4EF, 0x8526, 0x92D3, 0x852C, 0xE4F4, - 0x852D, 0x88FC, 0x8535, 0x91A0, 0x853D, 0x95C1, 0x8540, 0xE4F9, - 0x8541, 0xE540, 0x8543, 0x94D7, 0x8548, 0xE4FC, 0x8549, 0x8FD4, - 0x854A, 0x8EC7, 0x854B, 0xE542, 0x854E, 0x8BBC, 0x8553, 0xFB9A, - 0x8555, 0xE543, 0x8557, 0x9599, 0x8558, 0xE4FB, 0x8559, 0xFB9B, - 0x855A, 0xE4D4, 0x8563, 0xE4FA, 0x8568, 0x986E, 0x8569, 0x93A0, - 0x856A, 0x9593, 0x856B, 0xFB9C, 0x856D, 0xE54A, 0x8577, 0xE550, - 0x857E, 0xE551, 0x8580, 0xE544, 0x8584, 0x9496, 0x8587, 0xE54E, - 0x8588, 0xE546, 0x858A, 0xE548, 0x8590, 0xE552, 0x8591, 0xE547, - 0x8594, 0xE54B, 0x8597, 0x8992, 0x8599, 0x93E3, 0x859B, 0xE54C, - 0x859C, 0xE54F, 0x85A4, 0xE545, 0x85A6, 0x9145, 0x85A8, 0xE549, - 0x85A9, 0x8E46, 0x85AA, 0x9064, 0x85AB, 0x8C4F, 0x85AC, 0x96F2, - 0x85AE, 0x96F7, 0x85AF, 0x8F92, 0x85B0, 0xFB9E, 0x85B9, 0xE556, - 0x85BA, 0xE554, 0x85C1, 0x986D, 0x85C9, 0xE553, 0x85CD, 0x9795, - 0x85CF, 0xE555, 0x85D0, 0xE557, 0x85D5, 0xE558, 0x85DC, 0xE55B, - 0x85DD, 0xE559, 0x85E4, 0x93A1, 0x85E5, 0xE55A, 0x85E9, 0x94CB, - 0x85EA, 0xE54D, 0x85F7, 0x8F93, 0x85F9, 0xE55C, 0x85FA, 0xE561, - 0x85FB, 0x9194, 0x85FE, 0xE560, 0x8602, 0xE541, 0x8606, 0xE562, - 0x8607, 0x9168, 0x860A, 0xE55D, 0x860B, 0xE55F, 0x8613, 0xE55E, - 0x8616, 0x9F50, 0x8617, 0x9F41, 0x861A, 0xE564, 0x8622, 0xE563, - 0x862D, 0x9796, 0x862F, 0xE1BA, 0x8630, 0xE565, 0x863F, 0xE566, - 0x864D, 0xE567, 0x864E, 0x8CD5, 0x8650, 0x8B73, 0x8654, 0xE569, - 0x8655, 0x997C, 0x865A, 0x8B95, 0x865C, 0x97B8, 0x865E, 0x8BF1, - 0x865F, 0xE56A, 0x8667, 0xE56B, 0x866B, 0x928E, 0x8671, 0xE56C, - 0x8679, 0x93F8, 0x867B, 0x88B8, 0x868A, 0x89E1, 0x868B, 0xE571, - 0x868C, 0xE572, 0x8693, 0xE56D, 0x8695, 0x8E5C, 0x86A3, 0xE56E, - 0x86A4, 0x9461, 0x86A9, 0xE56F, 0x86AA, 0xE570, 0x86AB, 0xE57A, - 0x86AF, 0xE574, 0x86B0, 0xE577, 0x86B6, 0xE573, 0x86C4, 0xE575, - 0x86C6, 0xE576, 0x86C7, 0x8ED6, 0x86C9, 0xE578, 0x86CB, 0x9260, - 0x86CD, 0x8C75, 0x86CE, 0x8A61, 0x86D4, 0xE57B, 0x86D9, 0x8A5E, - 0x86DB, 0xE581, 0x86DE, 0xE57C, 0x86DF, 0xE580, 0x86E4, 0x94B8, - 0x86E9, 0xE57D, 0x86EC, 0xE57E, 0x86ED, 0x9567, 0x86EE, 0x94D8, - 0x86EF, 0xE582, 0x86F8, 0x91FB, 0x86F9, 0xE58C, 0x86FB, 0xE588, - 0x86FE, 0x89E9, 0x8700, 0xE586, 0x8702, 0x9649, 0x8703, 0xE587, - 0x8706, 0xE584, 0x8708, 0xE585, 0x8709, 0xE58A, 0x870A, 0xE58D, - 0x870D, 0xE58B, 0x8711, 0xE589, 0x8712, 0xE583, 0x8718, 0x9277, - 0x871A, 0xE594, 0x871C, 0x96A8, 0x8725, 0xE592, 0x8729, 0xE593, - 0x8734, 0xE58E, 0x8737, 0xE590, 0x873B, 0xE591, 0x873F, 0xE58F, - 0x8749, 0x90E4, 0x874B, 0x9858, 0x874C, 0xE598, 0x874E, 0xE599, - 0x8753, 0xE59F, 0x8755, 0x9049, 0x8757, 0xE59B, 0x8759, 0xE59E, - 0x875F, 0xE596, 0x8760, 0xE595, 0x8763, 0xE5A0, 0x8766, 0x89DA, - 0x8768, 0xE59C, 0x876A, 0xE5A1, 0x876E, 0xE59D, 0x8774, 0xE59A, - 0x8776, 0x92B1, 0x8778, 0xE597, 0x877F, 0x9488, 0x8782, 0xE5A5, - 0x878D, 0x975A, 0x879F, 0xE5A4, 0x87A2, 0xE5A3, 0x87AB, 0xE5AC, - 0x87AF, 0xE5A6, 0x87B3, 0xE5AE, 0x87BA, 0x9786, 0x87BB, 0xE5B1, - 0x87BD, 0xE5A8, 0x87C0, 0xE5A9, 0x87C4, 0xE5AD, 0x87C6, 0xE5B0, - 0x87C7, 0xE5AF, 0x87CB, 0xE5A7, 0x87D0, 0xE5AA, 0x87D2, 0xE5BB, - 0x87E0, 0xE5B4, 0x87EF, 0xE5B2, 0x87F2, 0xE5B3, 0x87F6, 0xE5B8, - 0x87F7, 0xE5B9, 0x87F9, 0x8A49, 0x87FB, 0x8B61, 0x87FE, 0xE5B7, - 0x8805, 0xE5A2, 0x8807, 0xFBA1, 0x880D, 0xE5B6, 0x880E, 0xE5BA, - 0x880F, 0xE5B5, 0x8811, 0xE5BC, 0x8815, 0xE5BE, 0x8816, 0xE5BD, - 0x8821, 0xE5C0, 0x8822, 0xE5BF, 0x8823, 0xE579, 0x8827, 0xE5C4, - 0x8831, 0xE5C1, 0x8836, 0xE5C2, 0x8839, 0xE5C3, 0x883B, 0xE5C5, - 0x8840, 0x8C8C, 0x8842, 0xE5C7, 0x8844, 0xE5C6, 0x8846, 0x8F4F, - 0x884C, 0x8D73, 0x884D, 0x9FA5, 0x8852, 0xE5C8, 0x8853, 0x8F70, - 0x8857, 0x8A58, 0x8859, 0xE5C9, 0x885B, 0x8971, 0x885D, 0x8FD5, - 0x885E, 0xE5CA, 0x8861, 0x8D74, 0x8862, 0xE5CB, 0x8863, 0x88DF, - 0x8868, 0x955C, 0x886B, 0xE5CC, 0x8870, 0x908A, 0x8872, 0xE5D3, - 0x8875, 0xE5D0, 0x8877, 0x928F, 0x887D, 0xE5D1, 0x887E, 0xE5CE, - 0x887F, 0x8BDC, 0x8881, 0xE5CD, 0x8882, 0xE5D4, 0x8888, 0x8C55, - 0x888B, 0x91DC, 0x888D, 0xE5DA, 0x8892, 0xE5D6, 0x8896, 0x91B3, - 0x8897, 0xE5D5, 0x8899, 0xE5D8, 0x889E, 0xE5CF, 0x88A2, 0xE5D9, - 0x88A4, 0xE5DB, 0x88AB, 0x94ED, 0x88AE, 0xE5D7, 0x88B0, 0xE5DC, - 0x88B1, 0xE5DE, 0x88B4, 0x8CD1, 0x88B5, 0xE5D2, 0x88B7, 0x88BF, - 0x88BF, 0xE5DD, 0x88C1, 0x8DD9, 0x88C2, 0x97F4, 0x88C3, 0xE5DF, - 0x88C4, 0xE5E0, 0x88C5, 0x9195, 0x88CF, 0x97A0, 0x88D4, 0xE5E1, - 0x88D5, 0x9754, 0x88D8, 0xE5E2, 0x88D9, 0xE5E3, 0x88DC, 0x95E2, - 0x88DD, 0xE5E4, 0x88DF, 0x8DBE, 0x88E1, 0x97A1, 0x88E8, 0xE5E9, - 0x88F2, 0xE5EA, 0x88F3, 0x8FD6, 0x88F4, 0xE5E8, 0x88F5, 0xFBA2, - 0x88F8, 0x9787, 0x88F9, 0xE5E5, 0x88FC, 0xE5E7, 0x88FD, 0x90BB, - 0x88FE, 0x909E, 0x8902, 0xE5E6, 0x8904, 0xE5EB, 0x8907, 0x95A1, - 0x890A, 0xE5ED, 0x890C, 0xE5EC, 0x8910, 0x8A8C, 0x8912, 0x964A, - 0x8913, 0xE5EE, 0x891C, 0xFA5D, 0x891D, 0xE5FA, 0x891E, 0xE5F0, - 0x8925, 0xE5F1, 0x892A, 0xE5F2, 0x892B, 0xE5F3, 0x8936, 0xE5F7, - 0x8938, 0xE5F8, 0x893B, 0xE5F6, 0x8941, 0xE5F4, 0x8943, 0xE5EF, - 0x8944, 0xE5F5, 0x894C, 0xE5F9, 0x894D, 0xE8B5, 0x8956, 0x89A6, - 0x895E, 0xE5FC, 0x895F, 0x8BDD, 0x8960, 0xE5FB, 0x8964, 0xE641, - 0x8966, 0xE640, 0x896A, 0xE643, 0x896D, 0xE642, 0x896F, 0xE644, - 0x8972, 0x8F50, 0x8974, 0xE645, 0x8977, 0xE646, 0x897E, 0xE647, - 0x897F, 0x90BC, 0x8981, 0x9776, 0x8983, 0xE648, 0x8986, 0x95A2, - 0x8987, 0x9465, 0x8988, 0xE649, 0x898A, 0xE64A, 0x898B, 0x8CA9, - 0x898F, 0x8B4B, 0x8993, 0xE64B, 0x8996, 0x8E8B, 0x8997, 0x9460, - 0x8998, 0xE64C, 0x899A, 0x8A6F, 0x89A1, 0xE64D, 0x89A6, 0xE64F, - 0x89A7, 0x9797, 0x89A9, 0xE64E, 0x89AA, 0x9065, 0x89AC, 0xE650, - 0x89AF, 0xE651, 0x89B2, 0xE652, 0x89B3, 0x8ACF, 0x89BA, 0xE653, - 0x89BD, 0xE654, 0x89BF, 0xE655, 0x89C0, 0xE656, 0x89D2, 0x8A70, - 0x89DA, 0xE657, 0x89DC, 0xE658, 0x89DD, 0xE659, 0x89E3, 0x89F0, - 0x89E6, 0x9047, 0x89E7, 0xE65A, 0x89F4, 0xE65B, 0x89F8, 0xE65C, - 0x8A00, 0x8CBE, 0x8A02, 0x92F9, 0x8A03, 0xE65D, 0x8A08, 0x8C76, - 0x8A0A, 0x9075, 0x8A0C, 0xE660, 0x8A0E, 0x93A2, 0x8A10, 0xE65F, - 0x8A12, 0xFBA3, 0x8A13, 0x8C50, 0x8A16, 0xE65E, 0x8A17, 0x91F5, - 0x8A18, 0x8B4C, 0x8A1B, 0xE661, 0x8A1D, 0xE662, 0x8A1F, 0x8FD7, - 0x8A23, 0x8C8D, 0x8A25, 0xE663, 0x8A2A, 0x964B, 0x8A2D, 0x90DD, - 0x8A31, 0x8B96, 0x8A33, 0x96F3, 0x8A34, 0x9169, 0x8A36, 0xE664, - 0x8A37, 0xFBA4, 0x8A3A, 0x9066, 0x8A3B, 0x9290, 0x8A3C, 0x8FD8, - 0x8A41, 0xE665, 0x8A46, 0xE668, 0x8A48, 0xE669, 0x8A50, 0x8DBC, - 0x8A51, 0x91C0, 0x8A52, 0xE667, 0x8A54, 0x8FD9, 0x8A55, 0x955D, - 0x8A5B, 0xE666, 0x8A5E, 0x8E8C, 0x8A60, 0x8972, 0x8A62, 0xE66D, - 0x8A63, 0x8C77, 0x8A66, 0x8E8E, 0x8A69, 0x8E8D, 0x8A6B, 0x986C, - 0x8A6C, 0xE66C, 0x8A6D, 0xE66B, 0x8A6E, 0x9146, 0x8A70, 0x8B6C, - 0x8A71, 0x9862, 0x8A72, 0x8A59, 0x8A73, 0x8FDA, 0x8A79, 0xFBA5, - 0x8A7C, 0xE66A, 0x8A82, 0xE66F, 0x8A84, 0xE670, 0x8A85, 0xE66E, - 0x8A87, 0x8CD6, 0x8A89, 0x975F, 0x8A8C, 0x8E8F, 0x8A8D, 0x9446, - 0x8A91, 0xE673, 0x8A93, 0x90BE, 0x8A95, 0x9261, 0x8A98, 0x9755, - 0x8A9A, 0xE676, 0x8A9E, 0x8CEA, 0x8AA0, 0x90BD, 0x8AA1, 0xE672, - 0x8AA3, 0xE677, 0x8AA4, 0x8CEB, 0x8AA5, 0xE674, 0x8AA6, 0xE675, - 0x8AA7, 0xFBA6, 0x8AA8, 0xE671, 0x8AAC, 0x90E0, 0x8AAD, 0x93C7, - 0x8AB0, 0x924E, 0x8AB2, 0x89DB, 0x8AB9, 0x94EE, 0x8ABC, 0x8B62, - 0x8ABE, 0xFBA7, 0x8ABF, 0x92B2, 0x8AC2, 0xE67A, 0x8AC4, 0xE678, - 0x8AC7, 0x926B, 0x8ACB, 0x90BF, 0x8ACC, 0x8AD0, 0x8ACD, 0xE679, - 0x8ACF, 0x907A, 0x8AD2, 0x97C8, 0x8AD6, 0x985F, 0x8ADA, 0xE67B, - 0x8ADB, 0xE687, 0x8ADC, 0x92B3, 0x8ADE, 0xE686, 0x8ADF, 0xFBA8, - 0x8AE0, 0xE683, 0x8AE1, 0xE68B, 0x8AE2, 0xE684, 0x8AE4, 0xE680, - 0x8AE6, 0x92FA, 0x8AE7, 0xE67E, 0x8AEB, 0xE67C, 0x8AED, 0x9740, - 0x8AEE, 0x8E90, 0x8AF1, 0xE681, 0x8AF3, 0xE67D, 0x8AF6, 0xFBAA, - 0x8AF7, 0xE685, 0x8AF8, 0x8F94, 0x8AFA, 0x8CBF, 0x8AFE, 0x91F8, - 0x8B00, 0x9664, 0x8B01, 0x8979, 0x8B02, 0x88E0, 0x8B04, 0x93A3, - 0x8B07, 0xE689, 0x8B0C, 0xE688, 0x8B0E, 0x93E4, 0x8B10, 0xE68D, - 0x8B14, 0xE682, 0x8B16, 0xE68C, 0x8B17, 0xE68E, 0x8B19, 0x8CAA, - 0x8B1A, 0xE68A, 0x8B1B, 0x8D75, 0x8B1D, 0x8ED3, 0x8B20, 0xE68F, - 0x8B21, 0x9777, 0x8B26, 0xE692, 0x8B28, 0xE695, 0x8B2B, 0xE693, - 0x8B2C, 0x9554, 0x8B33, 0xE690, 0x8B39, 0x8BDE, 0x8B3E, 0xE694, - 0x8B41, 0xE696, 0x8B49, 0xE69A, 0x8B4C, 0xE697, 0x8B4E, 0xE699, - 0x8B4F, 0xE698, 0x8B53, 0xFBAB, 0x8B56, 0xE69B, 0x8B58, 0x8EAF, - 0x8B5A, 0xE69D, 0x8B5B, 0xE69C, 0x8B5C, 0x9588, 0x8B5F, 0xE69F, - 0x8B66, 0x8C78, 0x8B6B, 0xE69E, 0x8B6C, 0xE6A0, 0x8B6F, 0xE6A1, - 0x8B70, 0x8B63, 0x8B71, 0xE3BF, 0x8B72, 0x8FF7, 0x8B74, 0xE6A2, - 0x8B77, 0x8CEC, 0x8B7D, 0xE6A3, 0x8B7F, 0xFBAC, 0x8B80, 0xE6A4, - 0x8B83, 0x8E5D, 0x8B8A, 0x9DCC, 0x8B8C, 0xE6A5, 0x8B8E, 0xE6A6, - 0x8B90, 0x8F51, 0x8B92, 0xE6A7, 0x8B93, 0xE6A8, 0x8B96, 0xE6A9, - 0x8B99, 0xE6AA, 0x8B9A, 0xE6AB, 0x8C37, 0x924A, 0x8C3A, 0xE6AC, - 0x8C3F, 0xE6AE, 0x8C41, 0xE6AD, 0x8C46, 0x93A4, 0x8C48, 0xE6AF, - 0x8C4A, 0x964C, 0x8C4C, 0xE6B0, 0x8C4E, 0xE6B1, 0x8C50, 0xE6B2, - 0x8C55, 0xE6B3, 0x8C5A, 0x93D8, 0x8C61, 0x8FDB, 0x8C62, 0xE6B4, - 0x8C6A, 0x8D8B, 0x8C6B, 0x98AC, 0x8C6C, 0xE6B5, 0x8C78, 0xE6B6, - 0x8C79, 0x955E, 0x8C7A, 0xE6B7, 0x8C7C, 0xE6BF, 0x8C82, 0xE6B8, - 0x8C85, 0xE6BA, 0x8C89, 0xE6B9, 0x8C8A, 0xE6BB, 0x8C8C, 0x9665, - 0x8C8D, 0xE6BC, 0x8C8E, 0xE6BD, 0x8C94, 0xE6BE, 0x8C98, 0xE6C0, - 0x8C9D, 0x8A4C, 0x8C9E, 0x92E5, 0x8CA0, 0x9589, 0x8CA1, 0x8DE0, - 0x8CA2, 0x8D76, 0x8CA7, 0x956E, 0x8CA8, 0x89DD, 0x8CA9, 0x94CC, - 0x8CAA, 0xE6C3, 0x8CAB, 0x8AD1, 0x8CAC, 0x90D3, 0x8CAD, 0xE6C2, - 0x8CAE, 0xE6C7, 0x8CAF, 0x9299, 0x8CB0, 0x96E1, 0x8CB2, 0xE6C5, - 0x8CB3, 0xE6C6, 0x8CB4, 0x8B4D, 0x8CB6, 0xE6C8, 0x8CB7, 0x9483, - 0x8CB8, 0x91DD, 0x8CBB, 0x94EF, 0x8CBC, 0x935C, 0x8CBD, 0xE6C4, - 0x8CBF, 0x9666, 0x8CC0, 0x89EA, 0x8CC1, 0xE6CA, 0x8CC2, 0x9847, - 0x8CC3, 0x92C0, 0x8CC4, 0x9864, 0x8CC7, 0x8E91, 0x8CC8, 0xE6C9, - 0x8CCA, 0x91AF, 0x8CCD, 0xE6DA, 0x8CCE, 0x9147, 0x8CD1, 0x93F6, - 0x8CD3, 0x956F, 0x8CDA, 0xE6CD, 0x8CDB, 0x8E5E, 0x8CDC, 0x8E92, - 0x8CDE, 0x8FDC, 0x8CE0, 0x9485, 0x8CE2, 0x8CAB, 0x8CE3, 0xE6CC, - 0x8CE4, 0xE6CB, 0x8CE6, 0x958A, 0x8CEA, 0x8EBF, 0x8CED, 0x9371, - 0x8CF0, 0xFBAD, 0x8CF4, 0xFBAE, 0x8CFA, 0xE6CF, 0x8CFB, 0xE6D0, - 0x8CFC, 0x8D77, 0x8CFD, 0xE6CE, 0x8D04, 0xE6D1, 0x8D05, 0xE6D2, - 0x8D07, 0xE6D4, 0x8D08, 0x91A1, 0x8D0A, 0xE6D3, 0x8D0B, 0x8AE4, - 0x8D0D, 0xE6D6, 0x8D0F, 0xE6D5, 0x8D10, 0xE6D7, 0x8D12, 0xFBAF, - 0x8D13, 0xE6D9, 0x8D14, 0xE6DB, 0x8D16, 0xE6DC, 0x8D64, 0x90D4, - 0x8D66, 0x8ECD, 0x8D67, 0xE6DD, 0x8D6B, 0x8A71, 0x8D6D, 0xE6DE, - 0x8D70, 0x9196, 0x8D71, 0xE6DF, 0x8D73, 0xE6E0, 0x8D74, 0x958B, - 0x8D76, 0xFBB0, 0x8D77, 0x8B4E, 0x8D81, 0xE6E1, 0x8D85, 0x92B4, - 0x8D8A, 0x897A, 0x8D99, 0xE6E2, 0x8DA3, 0x8EEF, 0x8DA8, 0x9096, - 0x8DB3, 0x91AB, 0x8DBA, 0xE6E5, 0x8DBE, 0xE6E4, 0x8DC2, 0xE6E3, - 0x8DCB, 0xE6EB, 0x8DCC, 0xE6E9, 0x8DCF, 0xE6E6, 0x8DD6, 0xE6E8, - 0x8DDA, 0xE6E7, 0x8DDB, 0xE6EA, 0x8DDD, 0x8B97, 0x8DDF, 0xE6EE, - 0x8DE1, 0x90D5, 0x8DE3, 0xE6EF, 0x8DE8, 0x8CD7, 0x8DEA, 0xE6EC, - 0x8DEB, 0xE6ED, 0x8DEF, 0x9848, 0x8DF3, 0x92B5, 0x8DF5, 0x9148, - 0x8DFC, 0xE6F0, 0x8DFF, 0xE6F3, 0x8E08, 0xE6F1, 0x8E09, 0xE6F2, - 0x8E0A, 0x9778, 0x8E0F, 0x93A5, 0x8E10, 0xE6F6, 0x8E1D, 0xE6F4, - 0x8E1E, 0xE6F5, 0x8E1F, 0xE6F7, 0x8E2A, 0xE748, 0x8E30, 0xE6FA, - 0x8E34, 0xE6FB, 0x8E35, 0xE6F9, 0x8E42, 0xE6F8, 0x8E44, 0x92FB, - 0x8E47, 0xE740, 0x8E48, 0xE744, 0x8E49, 0xE741, 0x8E4A, 0xE6FC, - 0x8E4C, 0xE742, 0x8E50, 0xE743, 0x8E55, 0xE74A, 0x8E59, 0xE745, - 0x8E5F, 0x90D6, 0x8E60, 0xE747, 0x8E63, 0xE749, 0x8E64, 0xE746, - 0x8E72, 0xE74C, 0x8E74, 0x8F52, 0x8E76, 0xE74B, 0x8E7C, 0xE74D, - 0x8E81, 0xE74E, 0x8E84, 0xE751, 0x8E85, 0xE750, 0x8E87, 0xE74F, - 0x8E8A, 0xE753, 0x8E8B, 0xE752, 0x8E8D, 0x96F4, 0x8E91, 0xE755, - 0x8E93, 0xE754, 0x8E94, 0xE756, 0x8E99, 0xE757, 0x8EA1, 0xE759, - 0x8EAA, 0xE758, 0x8EAB, 0x9067, 0x8EAC, 0xE75A, 0x8EAF, 0x8BEB, - 0x8EB0, 0xE75B, 0x8EB1, 0xE75D, 0x8EBE, 0xE75E, 0x8EC5, 0xE75F, - 0x8EC6, 0xE75C, 0x8EC8, 0xE760, 0x8ECA, 0x8ED4, 0x8ECB, 0xE761, - 0x8ECC, 0x8B4F, 0x8ECD, 0x8C52, 0x8ECF, 0xFBB2, 0x8ED2, 0x8CAC, - 0x8EDB, 0xE762, 0x8EDF, 0x93EE, 0x8EE2, 0x935D, 0x8EE3, 0xE763, - 0x8EEB, 0xE766, 0x8EF8, 0x8EB2, 0x8EFB, 0xE765, 0x8EFC, 0xE764, - 0x8EFD, 0x8C79, 0x8EFE, 0xE767, 0x8F03, 0x8A72, 0x8F05, 0xE769, - 0x8F09, 0x8DDA, 0x8F0A, 0xE768, 0x8F0C, 0xE771, 0x8F12, 0xE76B, - 0x8F13, 0xE76D, 0x8F14, 0x95E3, 0x8F15, 0xE76A, 0x8F19, 0xE76C, - 0x8F1B, 0xE770, 0x8F1C, 0xE76E, 0x8F1D, 0x8B50, 0x8F1F, 0xE76F, - 0x8F26, 0xE772, 0x8F29, 0x9479, 0x8F2A, 0x97D6, 0x8F2F, 0x8F53, - 0x8F33, 0xE773, 0x8F38, 0x9741, 0x8F39, 0xE775, 0x8F3B, 0xE774, - 0x8F3E, 0xE778, 0x8F3F, 0x9760, 0x8F42, 0xE777, 0x8F44, 0x8A8D, - 0x8F45, 0xE776, 0x8F46, 0xE77B, 0x8F49, 0xE77A, 0x8F4C, 0xE779, - 0x8F4D, 0x9351, 0x8F4E, 0xE77C, 0x8F57, 0xE77D, 0x8F5C, 0xE77E, - 0x8F5F, 0x8D8C, 0x8F61, 0x8C44, 0x8F62, 0xE780, 0x8F63, 0xE781, - 0x8F64, 0xE782, 0x8F9B, 0x9068, 0x8F9C, 0xE783, 0x8F9E, 0x8EAB, - 0x8F9F, 0xE784, 0x8FA3, 0xE785, 0x8FA7, 0x999F, 0x8FA8, 0x999E, - 0x8FAD, 0xE786, 0x8FAE, 0xE390, 0x8FAF, 0xE787, 0x8FB0, 0x9243, - 0x8FB1, 0x904A, 0x8FB2, 0x945F, 0x8FB7, 0xE788, 0x8FBA, 0x95D3, - 0x8FBB, 0x92D2, 0x8FBC, 0x8D9E, 0x8FBF, 0x9248, 0x8FC2, 0x8949, - 0x8FC4, 0x9698, 0x8FC5, 0x9076, 0x8FCE, 0x8C7D, 0x8FD1, 0x8BDF, - 0x8FD4, 0x95D4, 0x8FDA, 0xE789, 0x8FE2, 0xE78B, 0x8FE5, 0xE78A, - 0x8FE6, 0x89DE, 0x8FE9, 0x93F4, 0x8FEA, 0xE78C, 0x8FEB, 0x9497, - 0x8FED, 0x9352, 0x8FEF, 0xE78D, 0x8FF0, 0x8F71, 0x8FF4, 0xE78F, - 0x8FF7, 0x96C0, 0x8FF8, 0xE79E, 0x8FF9, 0xE791, 0x8FFA, 0xE792, - 0x8FFD, 0x92C7, 0x9000, 0x91DE, 0x9001, 0x9197, 0x9003, 0x93A6, - 0x9005, 0xE790, 0x9006, 0x8B74, 0x900B, 0xE799, 0x900D, 0xE796, - 0x900E, 0xE7A3, 0x900F, 0x93A7, 0x9010, 0x9280, 0x9011, 0xE793, - 0x9013, 0x92FC, 0x9014, 0x9372, 0x9015, 0xE794, 0x9016, 0xE798, - 0x9017, 0x9080, 0x9019, 0x9487, 0x901A, 0x92CA, 0x901D, 0x90C0, - 0x901E, 0xE797, 0x901F, 0x91AC, 0x9020, 0x91A2, 0x9021, 0xE795, - 0x9022, 0x88A7, 0x9023, 0x9841, 0x9027, 0xE79A, 0x902E, 0x91DF, - 0x9031, 0x8F54, 0x9032, 0x9069, 0x9035, 0xE79C, 0x9036, 0xE79B, - 0x9038, 0x88ED, 0x9039, 0xE79D, 0x903C, 0x954E, 0x903E, 0xE7A5, - 0x9041, 0x93D9, 0x9042, 0x908B, 0x9045, 0x9278, 0x9047, 0x8BF6, - 0x9049, 0xE7A4, 0x904A, 0x9756, 0x904B, 0x895E, 0x904D, 0x95D5, - 0x904E, 0x89DF, 0x904F, 0xE79F, 0x9050, 0xE7A0, 0x9051, 0xE7A1, - 0x9052, 0xE7A2, 0x9053, 0x93B9, 0x9054, 0x9242, 0x9055, 0x88E1, - 0x9056, 0xE7A6, 0x9058, 0xE7A7, 0x9059, 0xEAA1, 0x905C, 0x91BB, - 0x905E, 0xE7A8, 0x9060, 0x8993, 0x9061, 0x916B, 0x9063, 0x8CAD, - 0x9065, 0x9779, 0x9067, 0xFBB5, 0x9068, 0xE7A9, 0x9069, 0x934B, - 0x906D, 0x9198, 0x906E, 0x8ED5, 0x906F, 0xE7AA, 0x9072, 0xE7AD, - 0x9075, 0x8F85, 0x9076, 0xE7AB, 0x9077, 0x914A, 0x9078, 0x9149, - 0x907A, 0x88E2, 0x907C, 0x97C9, 0x907D, 0xE7AF, 0x907F, 0x94F0, - 0x9080, 0xE7B1, 0x9081, 0xE7B0, 0x9082, 0xE7AE, 0x9083, 0xE284, - 0x9084, 0x8AD2, 0x9087, 0xE78E, 0x9089, 0xE7B3, 0x908A, 0xE7B2, - 0x908F, 0xE7B4, 0x9091, 0x9757, 0x90A3, 0x93DF, 0x90A6, 0x964D, - 0x90A8, 0xE7B5, 0x90AA, 0x8ED7, 0x90AF, 0xE7B6, 0x90B1, 0xE7B7, - 0x90B5, 0xE7B8, 0x90B8, 0x9340, 0x90C1, 0x88E8, 0x90CA, 0x8D78, - 0x90CE, 0x9859, 0x90DB, 0xE7BC, 0x90DE, 0xFBB6, 0x90E1, 0x8C53, - 0x90E2, 0xE7B9, 0x90E4, 0xE7BA, 0x90E8, 0x9594, 0x90ED, 0x8A73, - 0x90F5, 0x9758, 0x90F7, 0x8BBD, 0x90FD, 0x9373, 0x9102, 0xE7BD, - 0x9112, 0xE7BE, 0x9115, 0xFBB8, 0x9119, 0xE7BF, 0x9127, 0xFBB9, - 0x912D, 0x9341, 0x9130, 0xE7C1, 0x9132, 0xE7C0, 0x9149, 0x93D1, - 0x914A, 0xE7C2, 0x914B, 0x8F55, 0x914C, 0x8EDE, 0x914D, 0x947A, - 0x914E, 0x9291, 0x9152, 0x8EF0, 0x9154, 0x908C, 0x9156, 0xE7C3, - 0x9158, 0xE7C4, 0x9162, 0x907C, 0x9163, 0xE7C5, 0x9165, 0xE7C6, - 0x9169, 0xE7C7, 0x916A, 0x978F, 0x916C, 0x8F56, 0x9172, 0xE7C9, - 0x9173, 0xE7C8, 0x9175, 0x8D79, 0x9177, 0x8D93, 0x9178, 0x8E5F, - 0x9182, 0xE7CC, 0x9187, 0x8F86, 0x9189, 0xE7CB, 0x918B, 0xE7CA, - 0x918D, 0x91E7, 0x9190, 0x8CED, 0x9192, 0x90C1, 0x9197, 0x94AE, - 0x919C, 0x8F58, 0x91A2, 0xE7CD, 0x91A4, 0x8FDD, 0x91AA, 0xE7D0, - 0x91AB, 0xE7CE, 0x91AF, 0xE7CF, 0x91B4, 0xE7D2, 0x91B5, 0xE7D1, - 0x91B8, 0x8FF8, 0x91BA, 0xE7D3, 0x91C0, 0xE7D4, 0x91C1, 0xE7D5, - 0x91C6, 0x94CE, 0x91C7, 0x8DD1, 0x91C8, 0x8EDF, 0x91C9, 0xE7D6, - 0x91CB, 0xE7D7, 0x91CC, 0x97A2, 0x91CD, 0x8F64, 0x91CE, 0x96EC, - 0x91CF, 0x97CA, 0x91D0, 0xE7D8, 0x91D1, 0x8BE0, 0x91D6, 0xE7D9, - 0x91D7, 0xFBBB, 0x91D8, 0x9342, 0x91DA, 0xFBBA, 0x91DB, 0xE7DC, - 0x91DC, 0x8A98, 0x91DD, 0x906A, 0x91DE, 0xFBBC, 0x91DF, 0xE7DA, - 0x91E1, 0xE7DB, 0x91E3, 0x92DE, 0x91E4, 0xFBBF, 0x91E5, 0xFBC0, - 0x91E6, 0x9674, 0x91E7, 0x8BFA, 0x91ED, 0xFBBD, 0x91EE, 0xFBBE, - 0x91F5, 0xE7DE, 0x91F6, 0xE7DF, 0x91FC, 0xE7DD, 0x91FF, 0xE7E1, - 0x9206, 0xFBC1, 0x920A, 0xFBC3, 0x920D, 0x93DD, 0x920E, 0x8A62, - 0x9210, 0xFBC2, 0x9211, 0xE7E5, 0x9214, 0xE7E2, 0x9215, 0xE7E4, - 0x921E, 0xE7E0, 0x9229, 0xE86E, 0x922C, 0xE7E3, 0x9234, 0x97E9, - 0x9237, 0x8CD8, 0x9239, 0xFBCA, 0x923A, 0xFBC4, 0x923C, 0xFBC6, - 0x923F, 0xE7ED, 0x9240, 0xFBC5, 0x9244, 0x9353, 0x9245, 0xE7E8, - 0x9248, 0xE7EB, 0x9249, 0xE7E9, 0x924B, 0xE7EE, 0x924E, 0xFBC7, - 0x9250, 0xE7EF, 0x9251, 0xFBC9, 0x9257, 0xE7E7, 0x9259, 0xFBC8, - 0x925A, 0xE7F4, 0x925B, 0x8994, 0x925E, 0xE7E6, 0x9262, 0x94AB, - 0x9264, 0xE7EA, 0x9266, 0x8FDE, 0x9267, 0xFBCB, 0x9271, 0x8D7A, - 0x9277, 0xFBCD, 0x9278, 0xFBCE, 0x927E, 0x9667, 0x9280, 0x8BE2, - 0x9283, 0x8F65, 0x9285, 0x93BA, 0x9288, 0xFA5F, 0x9291, 0x914C, - 0x9293, 0xE7F2, 0x9295, 0xE7EC, 0x9296, 0xE7F1, 0x9298, 0x96C1, - 0x929A, 0x92B6, 0x929B, 0xE7F3, 0x929C, 0xE7F0, 0x92A7, 0xFBCC, - 0x92AD, 0x914B, 0x92B7, 0xE7F7, 0x92B9, 0xE7F6, 0x92CF, 0xE7F5, - 0x92D0, 0xFBD2, 0x92D2, 0x964E, 0x92D3, 0xFBD6, 0x92D5, 0xFBD4, - 0x92D7, 0xFBD0, 0x92D9, 0xFBD1, 0x92E0, 0xFBD5, 0x92E4, 0x8F9B, - 0x92E7, 0xFBCF, 0x92E9, 0xE7F8, 0x92EA, 0x95DD, 0x92ED, 0x8973, - 0x92F2, 0x9565, 0x92F3, 0x9292, 0x92F8, 0x8B98, 0x92F9, 0xFA65, - 0x92FA, 0xE7FA, 0x92FB, 0xFBD9, 0x92FC, 0x8D7C, 0x92FF, 0xFBDC, - 0x9302, 0xFBDE, 0x9306, 0x8E4B, 0x930F, 0xE7F9, 0x9310, 0x908D, - 0x9318, 0x908E, 0x9319, 0xE840, 0x931A, 0xE842, 0x931D, 0xFBDD, - 0x931E, 0xFBDB, 0x9320, 0x8FF9, 0x9321, 0xFBD8, 0x9322, 0xE841, - 0x9323, 0xE843, 0x9325, 0xFBD7, 0x9326, 0x8BD1, 0x9328, 0x9564, - 0x932B, 0x8EE0, 0x932C, 0x9842, 0x932E, 0xE7FC, 0x932F, 0x8DF6, - 0x9332, 0x985E, 0x9335, 0xE845, 0x933A, 0xE844, 0x933B, 0xE846, - 0x9344, 0xE7FB, 0x9348, 0xFA5E, 0x934B, 0x93E7, 0x934D, 0x9374, - 0x9354, 0x92D5, 0x9356, 0xE84B, 0x9357, 0xFBE0, 0x935B, 0x9262, - 0x935C, 0xE847, 0x9360, 0xE848, 0x936C, 0x8C4C, 0x936E, 0xE84A, - 0x9370, 0xFBDF, 0x9375, 0x8CAE, 0x937C, 0xE849, 0x937E, 0x8FDF, - 0x938C, 0x8A99, 0x9394, 0xE84F, 0x9396, 0x8DBD, 0x9397, 0x9199, - 0x939A, 0x92C8, 0x93A4, 0xFBE1, 0x93A7, 0x8A5A, 0x93AC, 0xE84D, - 0x93AD, 0xE84E, 0x93AE, 0x92C1, 0x93B0, 0xE84C, 0x93B9, 0xE850, - 0x93C3, 0xE856, 0x93C6, 0xFBE2, 0x93C8, 0xE859, 0x93D0, 0xE858, - 0x93D1, 0x934C, 0x93D6, 0xE851, 0x93D7, 0xE852, 0x93D8, 0xE855, - 0x93DD, 0xE857, 0x93DE, 0xFBE3, 0x93E1, 0x8BBE, 0x93E4, 0xE85A, - 0x93E5, 0xE854, 0x93E8, 0xE853, 0x93F8, 0xFBE4, 0x9403, 0xE85E, - 0x9407, 0xE85F, 0x9410, 0xE860, 0x9413, 0xE85D, 0x9414, 0xE85C, - 0x9418, 0x8FE0, 0x9419, 0x93A8, 0x941A, 0xE85B, 0x9421, 0xE864, - 0x942B, 0xE862, 0x9431, 0xFBE5, 0x9435, 0xE863, 0x9436, 0xE861, - 0x9438, 0x91F6, 0x943A, 0xE865, 0x9441, 0xE866, 0x9444, 0xE868, - 0x9445, 0xFBE6, 0x9448, 0xFBE7, 0x9451, 0x8AD3, 0x9452, 0xE867, - 0x9453, 0x96F8, 0x945A, 0xE873, 0x945B, 0xE869, 0x945E, 0xE86C, - 0x9460, 0xE86A, 0x9462, 0xE86B, 0x946A, 0xE86D, 0x9470, 0xE86F, - 0x9475, 0xE870, 0x9477, 0xE871, 0x947C, 0xE874, 0x947D, 0xE872, - 0x947E, 0xE875, 0x947F, 0xE877, 0x9481, 0xE876, 0x9577, 0x92B7, - 0x9580, 0x96E5, 0x9582, 0xE878, 0x9583, 0x914D, 0x9587, 0xE879, - 0x9589, 0x95C2, 0x958A, 0xE87A, 0x958B, 0x8A4A, 0x958F, 0x895B, - 0x9591, 0x8AD5, 0x9592, 0xFBE8, 0x9593, 0x8AD4, 0x9594, 0xE87B, - 0x9596, 0xE87C, 0x9598, 0xE87D, 0x9599, 0xE87E, 0x95A0, 0xE880, - 0x95A2, 0x8AD6, 0x95A3, 0x8A74, 0x95A4, 0x8D7D, 0x95A5, 0x94B4, - 0x95A7, 0xE882, 0x95A8, 0xE881, 0x95AD, 0xE883, 0x95B2, 0x897B, - 0x95B9, 0xE886, 0x95BB, 0xE885, 0x95BC, 0xE884, 0x95BE, 0xE887, - 0x95C3, 0xE88A, 0x95C7, 0x88C5, 0x95CA, 0xE888, 0x95CC, 0xE88C, - 0x95CD, 0xE88B, 0x95D4, 0xE88E, 0x95D5, 0xE88D, 0x95D6, 0xE88F, - 0x95D8, 0x93AC, 0x95DC, 0xE890, 0x95E1, 0xE891, 0x95E2, 0xE893, - 0x95E5, 0xE892, 0x961C, 0x958C, 0x9621, 0xE894, 0x9628, 0xE895, - 0x962A, 0x8DE3, 0x962E, 0xE896, 0x962F, 0xE897, 0x9632, 0x9668, - 0x963B, 0x916A, 0x963F, 0x88A2, 0x9640, 0x91C9, 0x9642, 0xE898, - 0x9644, 0x958D, 0x964B, 0xE89B, 0x964C, 0xE899, 0x964D, 0x8D7E, - 0x964F, 0xE89A, 0x9650, 0x8CC0, 0x965B, 0x95C3, 0x965C, 0xE89D, - 0x965D, 0xE89F, 0x965E, 0xE89E, 0x965F, 0xE8A0, 0x9662, 0x8940, - 0x9663, 0x9077, 0x9664, 0x8F9C, 0x9665, 0x8AD7, 0x9666, 0xE8A1, - 0x966A, 0x9486, 0x966C, 0xE8A3, 0x9670, 0x8941, 0x9672, 0xE8A2, - 0x9673, 0x92C2, 0x9675, 0x97CB, 0x9676, 0x93A9, 0x9677, 0xE89C, - 0x9678, 0x97A4, 0x967A, 0x8CAF, 0x967D, 0x977A, 0x9685, 0x8BF7, - 0x9686, 0x97B2, 0x9688, 0x8C47, 0x968A, 0x91E0, 0x968B, 0xE440, - 0x968D, 0xE8A4, 0x968E, 0x8A4B, 0x968F, 0x908F, 0x9694, 0x8A75, - 0x9695, 0xE8A6, 0x9697, 0xE8A7, 0x9698, 0xE8A5, 0x9699, 0x8C84, - 0x969B, 0x8DDB, 0x969C, 0x8FE1, 0x969D, 0xFBEB, 0x96A0, 0x8942, - 0x96A3, 0x97D7, 0x96A7, 0xE8A9, 0x96A8, 0xE7AC, 0x96AA, 0xE8A8, - 0x96AF, 0xFBEC, 0x96B0, 0xE8AC, 0x96B1, 0xE8AA, 0x96B2, 0xE8AB, - 0x96B4, 0xE8AD, 0x96B6, 0xE8AE, 0x96B7, 0x97EA, 0x96B8, 0xE8AF, - 0x96B9, 0xE8B0, 0x96BB, 0x90C7, 0x96BC, 0x94B9, 0x96C0, 0x909D, - 0x96C1, 0x8AE5, 0x96C4, 0x9759, 0x96C5, 0x89EB, 0x96C6, 0x8F57, - 0x96C7, 0x8CD9, 0x96C9, 0xE8B3, 0x96CB, 0xE8B2, 0x96CC, 0x8E93, - 0x96CD, 0xE8B4, 0x96CE, 0xE8B1, 0x96D1, 0x8E47, 0x96D5, 0xE8B8, - 0x96D6, 0xE5AB, 0x96D9, 0x99D4, 0x96DB, 0x9097, 0x96DC, 0xE8B6, - 0x96E2, 0x97A3, 0x96E3, 0x93EF, 0x96E8, 0x894A, 0x96EA, 0x90E1, - 0x96EB, 0x8EB4, 0x96F0, 0x95B5, 0x96F2, 0x895F, 0x96F6, 0x97EB, - 0x96F7, 0x978B, 0x96F9, 0xE8B9, 0x96FB, 0x9364, 0x9700, 0x8EF9, - 0x9704, 0xE8BA, 0x9706, 0xE8BB, 0x9707, 0x906B, 0x9708, 0xE8BC, - 0x970A, 0x97EC, 0x970D, 0xE8B7, 0x970E, 0xE8BE, 0x970F, 0xE8C0, - 0x9711, 0xE8BF, 0x9713, 0xE8BD, 0x9716, 0xE8C1, 0x9719, 0xE8C2, - 0x971C, 0x919A, 0x971E, 0x89E0, 0x9724, 0xE8C3, 0x9727, 0x96B6, - 0x972A, 0xE8C4, 0x9730, 0xE8C5, 0x9732, 0x9849, 0x9733, 0xFBED, - 0x9738, 0x9E50, 0x9739, 0xE8C6, 0x973B, 0xFBEE, 0x973D, 0xE8C7, - 0x973E, 0xE8C8, 0x9742, 0xE8CC, 0x9743, 0xFBEF, 0x9744, 0xE8C9, - 0x9746, 0xE8CA, 0x9748, 0xE8CB, 0x9749, 0xE8CD, 0x974D, 0xFBF0, - 0x974F, 0xFBF1, 0x9751, 0xFBF2, 0x9752, 0x90C2, 0x9755, 0xFBF3, - 0x9756, 0x96F5, 0x9759, 0x90C3, 0x975C, 0xE8CE, 0x975E, 0x94F1, - 0x9760, 0xE8CF, 0x9761, 0xEA72, 0x9762, 0x96CA, 0x9764, 0xE8D0, - 0x9766, 0xE8D1, 0x9768, 0xE8D2, 0x9769, 0x8A76, 0x976B, 0xE8D4, - 0x976D, 0x9078, 0x9771, 0xE8D5, 0x9774, 0x8C43, 0x9779, 0xE8D6, - 0x977A, 0xE8DA, 0x977C, 0xE8D8, 0x9781, 0xE8D9, 0x9784, 0x8A93, - 0x9785, 0xE8D7, 0x9786, 0xE8DB, 0x978B, 0xE8DC, 0x978D, 0x88C6, - 0x978F, 0xE8DD, 0x9790, 0xE8DE, 0x9798, 0x8FE2, 0x979C, 0xE8DF, - 0x97A0, 0x8B66, 0x97A3, 0xE8E2, 0x97A6, 0xE8E1, 0x97A8, 0xE8E0, - 0x97AB, 0xE691, 0x97AD, 0x95DA, 0x97B3, 0xE8E3, 0x97B4, 0xE8E4, - 0x97C3, 0xE8E5, 0x97C6, 0xE8E6, 0x97C8, 0xE8E7, 0x97CB, 0xE8E8, - 0x97D3, 0x8AD8, 0x97DC, 0xE8E9, 0x97ED, 0xE8EA, 0x97EE, 0x9442, - 0x97F2, 0xE8EC, 0x97F3, 0x89B9, 0x97F5, 0xE8EF, 0x97F6, 0xE8EE, - 0x97FB, 0x8943, 0x97FF, 0x8BBF, 0x9801, 0x95C5, 0x9802, 0x92B8, - 0x9803, 0x8DA0, 0x9805, 0x8D80, 0x9806, 0x8F87, 0x9808, 0x907B, - 0x980C, 0xE8F1, 0x980F, 0xE8F0, 0x9810, 0x9761, 0x9811, 0x8AE6, - 0x9812, 0x94D0, 0x9813, 0x93DA, 0x9817, 0x909C, 0x9818, 0x97CC, - 0x981A, 0x8C7A, 0x9821, 0xE8F4, 0x9824, 0xE8F3, 0x982C, 0x966A, - 0x982D, 0x93AA, 0x9834, 0x896F, 0x9837, 0xE8F5, 0x9838, 0xE8F2, - 0x983B, 0x9570, 0x983C, 0x978A, 0x983D, 0xE8F6, 0x9846, 0xE8F7, - 0x984B, 0xE8F9, 0x984C, 0x91E8, 0x984D, 0x8A7A, 0x984E, 0x8A7B, - 0x984F, 0xE8F8, 0x9854, 0x8AE7, 0x9855, 0x8CB0, 0x9857, 0xFBF4, - 0x9858, 0x8AE8, 0x985B, 0x935E, 0x985E, 0x97DE, 0x9865, 0xFBF5, - 0x9867, 0x8CDA, 0x986B, 0xE8FA, 0x986F, 0xE8FB, 0x9870, 0xE8FC, - 0x9871, 0xE940, 0x9873, 0xE942, 0x9874, 0xE941, 0x98A8, 0x9597, - 0x98AA, 0xE943, 0x98AF, 0xE944, 0x98B1, 0xE945, 0x98B6, 0xE946, - 0x98C3, 0xE948, 0x98C4, 0xE947, 0x98C6, 0xE949, 0x98DB, 0x94F2, - 0x98DC, 0xE3CA, 0x98DF, 0x9048, 0x98E2, 0x8B51, 0x98E9, 0xE94A, - 0x98EB, 0xE94B, 0x98ED, 0x99AA, 0x98EE, 0x9F5A, 0x98EF, 0x94D1, - 0x98F2, 0x88F9, 0x98F4, 0x88B9, 0x98FC, 0x8E94, 0x98FD, 0x964F, - 0x98FE, 0x8FFC, 0x9903, 0xE94C, 0x9905, 0x96DD, 0x9909, 0xE94D, - 0x990A, 0x977B, 0x990C, 0x8961, 0x9910, 0x8E60, 0x9912, 0xE94E, - 0x9913, 0x89EC, 0x9914, 0xE94F, 0x9918, 0xE950, 0x991D, 0xE952, - 0x991E, 0xE953, 0x9920, 0xE955, 0x9921, 0xE951, 0x9924, 0xE954, - 0x9927, 0xFBF8, 0x9928, 0x8AD9, 0x992C, 0xE956, 0x992E, 0xE957, - 0x993D, 0xE958, 0x993E, 0xE959, 0x9942, 0xE95A, 0x9945, 0xE95C, - 0x9949, 0xE95B, 0x994B, 0xE95E, 0x994C, 0xE961, 0x9950, 0xE95D, - 0x9951, 0xE95F, 0x9952, 0xE960, 0x9955, 0xE962, 0x9957, 0x8BC0, - 0x9996, 0x8EF1, 0x9997, 0xE963, 0x9998, 0xE964, 0x9999, 0x8D81, - 0x999E, 0xFBFA, 0x99A5, 0xE965, 0x99A8, 0x8A5D, 0x99AC, 0x946E, - 0x99AD, 0xE966, 0x99AE, 0xE967, 0x99B3, 0x9279, 0x99B4, 0x93E9, - 0x99BC, 0xE968, 0x99C1, 0x949D, 0x99C4, 0x91CA, 0x99C5, 0x8977, - 0x99C6, 0x8BEC, 0x99C8, 0x8BED, 0x99D0, 0x9293, 0x99D1, 0xE96D, - 0x99D2, 0x8BEE, 0x99D5, 0x89ED, 0x99D8, 0xE96C, 0x99DB, 0xE96A, - 0x99DD, 0xE96B, 0x99DF, 0xE969, 0x99E2, 0xE977, 0x99ED, 0xE96E, - 0x99EE, 0xE96F, 0x99F1, 0xE970, 0x99F2, 0xE971, 0x99F8, 0xE973, - 0x99FB, 0xE972, 0x99FF, 0x8F78, 0x9A01, 0xE974, 0x9A05, 0xE976, - 0x9A0E, 0x8B52, 0x9A0F, 0xE975, 0x9A12, 0x919B, 0x9A13, 0x8CB1, - 0x9A19, 0xE978, 0x9A28, 0x91CB, 0x9A2B, 0xE979, 0x9A30, 0x93AB, - 0x9A37, 0xE97A, 0x9A3E, 0xE980, 0x9A40, 0xE97D, 0x9A42, 0xE97C, - 0x9A43, 0xE97E, 0x9A45, 0xE97B, 0x9A4D, 0xE982, 0x9A4E, 0xFBFB, - 0x9A55, 0xE981, 0x9A57, 0xE984, 0x9A5A, 0x8BC1, 0x9A5B, 0xE983, - 0x9A5F, 0xE985, 0x9A62, 0xE986, 0x9A64, 0xE988, 0x9A65, 0xE987, - 0x9A69, 0xE989, 0x9A6A, 0xE98B, 0x9A6B, 0xE98A, 0x9AA8, 0x8D9C, - 0x9AAD, 0xE98C, 0x9AB0, 0xE98D, 0x9AB8, 0x8A5B, 0x9ABC, 0xE98E, - 0x9AC0, 0xE98F, 0x9AC4, 0x9091, 0x9ACF, 0xE990, 0x9AD1, 0xE991, - 0x9AD3, 0xE992, 0x9AD4, 0xE993, 0x9AD8, 0x8D82, 0x9AD9, 0xFBFC, - 0x9ADC, 0xFC40, 0x9ADE, 0xE994, 0x9ADF, 0xE995, 0x9AE2, 0xE996, - 0x9AE3, 0xE997, 0x9AE6, 0xE998, 0x9AEA, 0x94AF, 0x9AEB, 0xE99A, - 0x9AED, 0x9545, 0x9AEE, 0xE99B, 0x9AEF, 0xE999, 0x9AF1, 0xE99D, - 0x9AF4, 0xE99C, 0x9AF7, 0xE99E, 0x9AFB, 0xE99F, 0x9B06, 0xE9A0, - 0x9B18, 0xE9A1, 0x9B1A, 0xE9A2, 0x9B1F, 0xE9A3, 0x9B22, 0xE9A4, - 0x9B23, 0xE9A5, 0x9B25, 0xE9A6, 0x9B27, 0xE9A7, 0x9B28, 0xE9A8, - 0x9B29, 0xE9A9, 0x9B2A, 0xE9AA, 0x9B2E, 0xE9AB, 0x9B2F, 0xE9AC, - 0x9B31, 0x9F54, 0x9B32, 0xE9AD, 0x9B3B, 0xE2F6, 0x9B3C, 0x8B53, - 0x9B41, 0x8A40, 0x9B42, 0x8DB0, 0x9B43, 0xE9AF, 0x9B44, 0xE9AE, - 0x9B45, 0x96A3, 0x9B4D, 0xE9B1, 0x9B4E, 0xE9B2, 0x9B4F, 0xE9B0, - 0x9B51, 0xE9B3, 0x9B54, 0x9682, 0x9B58, 0xE9B4, 0x9B5A, 0x8B9B, - 0x9B6F, 0x9844, 0x9B72, 0xFC42, 0x9B74, 0xE9B5, 0x9B75, 0xFC41, - 0x9B83, 0xE9B7, 0x9B8E, 0x88BC, 0x9B8F, 0xFC43, 0x9B91, 0xE9B8, - 0x9B92, 0x95A9, 0x9B93, 0xE9B6, 0x9B96, 0xE9B9, 0x9B97, 0xE9BA, - 0x9B9F, 0xE9BB, 0x9BA0, 0xE9BC, 0x9BA8, 0xE9BD, 0x9BAA, 0x968E, - 0x9BAB, 0x8E4C, 0x9BAD, 0x8DF8, 0x9BAE, 0x914E, 0x9BB1, 0xFC44, - 0x9BB4, 0xE9BE, 0x9BB9, 0xE9C1, 0x9BBB, 0xFC45, 0x9BC0, 0xE9BF, - 0x9BC6, 0xE9C2, 0x9BC9, 0x8CEF, 0x9BCA, 0xE9C0, 0x9BCF, 0xE9C3, - 0x9BD1, 0xE9C4, 0x9BD2, 0xE9C5, 0x9BD4, 0xE9C9, 0x9BD6, 0x8E49, - 0x9BDB, 0x91E2, 0x9BE1, 0xE9CA, 0x9BE2, 0xE9C7, 0x9BE3, 0xE9C6, - 0x9BE4, 0xE9C8, 0x9BE8, 0x8C7E, 0x9BF0, 0xE9CE, 0x9BF1, 0xE9CD, - 0x9BF2, 0xE9CC, 0x9BF5, 0x88B1, 0x9C00, 0xFC46, 0x9C04, 0xE9D8, - 0x9C06, 0xE9D4, 0x9C08, 0xE9D5, 0x9C09, 0xE9D1, 0x9C0A, 0xE9D7, - 0x9C0C, 0xE9D3, 0x9C0D, 0x8A82, 0x9C10, 0x986B, 0x9C12, 0xE9D6, - 0x9C13, 0xE9D2, 0x9C14, 0xE9D0, 0x9C15, 0xE9CF, 0x9C1B, 0xE9DA, - 0x9C21, 0xE9DD, 0x9C24, 0xE9DC, 0x9C25, 0xE9DB, 0x9C2D, 0x9568, - 0x9C2E, 0xE9D9, 0x9C2F, 0x88F1, 0x9C30, 0xE9DE, 0x9C32, 0xE9E0, - 0x9C39, 0x8A8F, 0x9C3A, 0xE9CB, 0x9C3B, 0x8956, 0x9C3E, 0xE9E2, - 0x9C46, 0xE9E1, 0x9C47, 0xE9DF, 0x9C48, 0x924C, 0x9C52, 0x9690, - 0x9C57, 0x97D8, 0x9C5A, 0xE9E3, 0x9C60, 0xE9E4, 0x9C67, 0xE9E5, - 0x9C76, 0xE9E6, 0x9C78, 0xE9E7, 0x9CE5, 0x92B9, 0x9CE7, 0xE9E8, - 0x9CE9, 0x94B5, 0x9CEB, 0xE9ED, 0x9CEC, 0xE9E9, 0x9CF0, 0xE9EA, - 0x9CF3, 0x9650, 0x9CF4, 0x96C2, 0x9CF6, 0x93CE, 0x9D03, 0xE9EE, - 0x9D06, 0xE9EF, 0x9D07, 0x93BC, 0x9D08, 0xE9EC, 0x9D09, 0xE9EB, - 0x9D0E, 0x89A8, 0x9D12, 0xE9F7, 0x9D15, 0xE9F6, 0x9D1B, 0x8995, - 0x9D1F, 0xE9F4, 0x9D23, 0xE9F3, 0x9D26, 0xE9F1, 0x9D28, 0x8A9B, - 0x9D2A, 0xE9F0, 0x9D2B, 0x8EB0, 0x9D2C, 0x89A7, 0x9D3B, 0x8D83, - 0x9D3E, 0xE9FA, 0x9D3F, 0xE9F9, 0x9D41, 0xE9F8, 0x9D44, 0xE9F5, - 0x9D46, 0xE9FB, 0x9D48, 0xE9FC, 0x9D50, 0xEA44, 0x9D51, 0xEA43, - 0x9D59, 0xEA45, 0x9D5C, 0x894C, 0x9D5D, 0xEA40, 0x9D5E, 0xEA41, - 0x9D60, 0x8D94, 0x9D61, 0x96B7, 0x9D64, 0xEA42, 0x9D6B, 0xFC48, - 0x9D6C, 0x9651, 0x9D6F, 0xEA4A, 0x9D70, 0xFC47, 0x9D72, 0xEA46, - 0x9D7A, 0xEA4B, 0x9D87, 0xEA48, 0x9D89, 0xEA47, 0x9D8F, 0x8C7B, - 0x9D9A, 0xEA4C, 0x9DA4, 0xEA4D, 0x9DA9, 0xEA4E, 0x9DAB, 0xEA49, - 0x9DAF, 0xE9F2, 0x9DB2, 0xEA4F, 0x9DB4, 0x92DF, 0x9DB8, 0xEA53, - 0x9DBA, 0xEA54, 0x9DBB, 0xEA52, 0x9DC1, 0xEA51, 0x9DC2, 0xEA57, - 0x9DC4, 0xEA50, 0x9DC6, 0xEA55, 0x9DCF, 0xEA56, 0x9DD3, 0xEA59, - 0x9DD9, 0xEA58, 0x9DE6, 0xEA5B, 0x9DED, 0xEA5C, 0x9DEF, 0xEA5D, - 0x9DF2, 0x9868, 0x9DF8, 0xEA5A, 0x9DF9, 0x91E9, 0x9DFA, 0x8DEB, - 0x9DFD, 0xEA5E, 0x9E19, 0xFC4A, 0x9E1A, 0xEA5F, 0x9E1B, 0xEA60, - 0x9E1E, 0xEA61, 0x9E75, 0xEA62, 0x9E78, 0x8CB2, 0x9E79, 0xEA63, - 0x9E7D, 0xEA64, 0x9E7F, 0x8EAD, 0x9E81, 0xEA65, 0x9E88, 0xEA66, - 0x9E8B, 0xEA67, 0x9E8C, 0xEA68, 0x9E91, 0xEA6B, 0x9E92, 0xEA69, - 0x9E93, 0x985B, 0x9E95, 0xEA6A, 0x9E97, 0x97ED, 0x9E9D, 0xEA6C, - 0x9E9F, 0x97D9, 0x9EA5, 0xEA6D, 0x9EA6, 0x949E, 0x9EA9, 0xEA6E, - 0x9EAA, 0xEA70, 0x9EAD, 0xEA71, 0x9EB8, 0xEA6F, 0x9EB9, 0x8D8D, - 0x9EBA, 0x96CB, 0x9EBB, 0x9683, 0x9EBC, 0x9BF5, 0x9EBE, 0x9F80, - 0x9EBF, 0x969B, 0x9EC4, 0x89A9, 0x9ECC, 0xEA73, 0x9ECD, 0x8B6F, - 0x9ECE, 0xEA74, 0x9ECF, 0xEA75, 0x9ED0, 0xEA76, 0x9ED1, 0xFC4B, - 0x9ED2, 0x8D95, 0x9ED4, 0xEA77, 0x9ED8, 0xE0D2, 0x9ED9, 0x96D9, - 0x9EDB, 0x91E1, 0x9EDC, 0xEA78, 0x9EDD, 0xEA7A, 0x9EDE, 0xEA79, - 0x9EE0, 0xEA7B, 0x9EE5, 0xEA7C, 0x9EE8, 0xEA7D, 0x9EEF, 0xEA7E, - 0x9EF4, 0xEA80, 0x9EF6, 0xEA81, 0x9EF7, 0xEA82, 0x9EF9, 0xEA83, - 0x9EFB, 0xEA84, 0x9EFC, 0xEA85, 0x9EFD, 0xEA86, 0x9F07, 0xEA87, - 0x9F08, 0xEA88, 0x9F0E, 0x9343, 0x9F13, 0x8CDB, 0x9F15, 0xEA8A, - 0x9F20, 0x916C, 0x9F21, 0xEA8B, 0x9F2C, 0xEA8C, 0x9F3B, 0x9540, - 0x9F3E, 0xEA8D, 0x9F4A, 0xEA8E, 0x9F4B, 0xE256, 0x9F4E, 0xE6D8, - 0x9F4F, 0xE8EB, 0x9F52, 0xEA8F, 0x9F54, 0xEA90, 0x9F5F, 0xEA92, - 0x9F60, 0xEA93, 0x9F61, 0xEA94, 0x9F62, 0x97EE, 0x9F63, 0xEA91, - 0x9F66, 0xEA95, 0x9F67, 0xEA96, 0x9F6A, 0xEA98, 0x9F6C, 0xEA97, - 0x9F72, 0xEA9A, 0x9F76, 0xEA9B, 0x9F77, 0xEA99, 0x9F8D, 0x97B4, - 0x9F95, 0xEA9C, 0x9F9C, 0xEA9D, 0x9F9D, 0xE273, 0x9FA0, 0xEA9E, - 0xF929, 0xFAE0, 0xF9DC, 0xFBE9, 0xFA0E, 0xFA90, 0xFA0F, 0xFA9B, - 0xFA10, 0xFA9C, 0xFA11, 0xFAB1, 0xFA12, 0xFAD8, 0xFA13, 0xFAE8, - 0xFA14, 0xFAEA, 0xFA15, 0xFB58, 0xFA16, 0xFB5E, 0xFA17, 0xFB75, - 0xFA18, 0xFB7D, 0xFA19, 0xFB7E, 0xFA1A, 0xFB80, 0xFA1B, 0xFB82, - 0xFA1C, 0xFB86, 0xFA1D, 0xFB89, 0xFA1E, 0xFB92, 0xFA1F, 0xFB9D, - 0xFA20, 0xFB9F, 0xFA21, 0xFBA0, 0xFA22, 0xFBA9, 0xFA23, 0xFBB1, - 0xFA24, 0xFBB3, 0xFA25, 0xFBB4, 0xFA26, 0xFBB7, 0xFA27, 0xFBD3, - 0xFA28, 0xFBDA, 0xFA29, 0xFBEA, 0xFA2A, 0xFBF6, 0xFA2B, 0xFBF7, - 0xFA2C, 0xFBF9, 0xFA2D, 0xFC49, 0xFF01, 0x8149, 0xFF02, 0xFA57, - 0xFF03, 0x8194, 0xFF04, 0x8190, 0xFF05, 0x8193, 0xFF06, 0x8195, - 0xFF07, 0xFA56, 0xFF08, 0x8169, 0xFF09, 0x816A, 0xFF0A, 0x8196, - 0xFF0B, 0x817B, 0xFF0C, 0x8143, 0xFF0D, 0x817C, 0xFF0E, 0x8144, - 0xFF0F, 0x815E, 0xFF10, 0x824F, 0xFF11, 0x8250, 0xFF12, 0x8251, - 0xFF13, 0x8252, 0xFF14, 0x8253, 0xFF15, 0x8254, 0xFF16, 0x8255, - 0xFF17, 0x8256, 0xFF18, 0x8257, 0xFF19, 0x8258, 0xFF1A, 0x8146, - 0xFF1B, 0x8147, 0xFF1C, 0x8183, 0xFF1D, 0x8181, 0xFF1E, 0x8184, - 0xFF1F, 0x8148, 0xFF20, 0x8197, 0xFF21, 0x8260, 0xFF22, 0x8261, - 0xFF23, 0x8262, 0xFF24, 0x8263, 0xFF25, 0x8264, 0xFF26, 0x8265, - 0xFF27, 0x8266, 0xFF28, 0x8267, 0xFF29, 0x8268, 0xFF2A, 0x8269, - 0xFF2B, 0x826A, 0xFF2C, 0x826B, 0xFF2D, 0x826C, 0xFF2E, 0x826D, - 0xFF2F, 0x826E, 0xFF30, 0x826F, 0xFF31, 0x8270, 0xFF32, 0x8271, - 0xFF33, 0x8272, 0xFF34, 0x8273, 0xFF35, 0x8274, 0xFF36, 0x8275, - 0xFF37, 0x8276, 0xFF38, 0x8277, 0xFF39, 0x8278, 0xFF3A, 0x8279, - 0xFF3B, 0x816D, 0xFF3C, 0x815F, 0xFF3D, 0x816E, 0xFF3E, 0x814F, - 0xFF3F, 0x8151, 0xFF40, 0x814D, 0xFF41, 0x8281, 0xFF42, 0x8282, - 0xFF43, 0x8283, 0xFF44, 0x8284, 0xFF45, 0x8285, 0xFF46, 0x8286, - 0xFF47, 0x8287, 0xFF48, 0x8288, 0xFF49, 0x8289, 0xFF4A, 0x828A, - 0xFF4B, 0x828B, 0xFF4C, 0x828C, 0xFF4D, 0x828D, 0xFF4E, 0x828E, - 0xFF4F, 0x828F, 0xFF50, 0x8290, 0xFF51, 0x8291, 0xFF52, 0x8292, - 0xFF53, 0x8293, 0xFF54, 0x8294, 0xFF55, 0x8295, 0xFF56, 0x8296, - 0xFF57, 0x8297, 0xFF58, 0x8298, 0xFF59, 0x8299, 0xFF5A, 0x829A, - 0xFF5B, 0x816F, 0xFF5C, 0x8162, 0xFF5D, 0x8170, 0xFF5E, 0x8160, - 0xFF61, 0x00A1, 0xFF62, 0x00A2, 0xFF63, 0x00A3, 0xFF64, 0x00A4, - 0xFF65, 0x00A5, 0xFF66, 0x00A6, 0xFF67, 0x00A7, 0xFF68, 0x00A8, - 0xFF69, 0x00A9, 0xFF6A, 0x00AA, 0xFF6B, 0x00AB, 0xFF6C, 0x00AC, - 0xFF6D, 0x00AD, 0xFF6E, 0x00AE, 0xFF6F, 0x00AF, 0xFF70, 0x00B0, - 0xFF71, 0x00B1, 0xFF72, 0x00B2, 0xFF73, 0x00B3, 0xFF74, 0x00B4, - 0xFF75, 0x00B5, 0xFF76, 0x00B6, 0xFF77, 0x00B7, 0xFF78, 0x00B8, - 0xFF79, 0x00B9, 0xFF7A, 0x00BA, 0xFF7B, 0x00BB, 0xFF7C, 0x00BC, - 0xFF7D, 0x00BD, 0xFF7E, 0x00BE, 0xFF7F, 0x00BF, 0xFF80, 0x00C0, - 0xFF81, 0x00C1, 0xFF82, 0x00C2, 0xFF83, 0x00C3, 0xFF84, 0x00C4, - 0xFF85, 0x00C5, 0xFF86, 0x00C6, 0xFF87, 0x00C7, 0xFF88, 0x00C8, - 0xFF89, 0x00C9, 0xFF8A, 0x00CA, 0xFF8B, 0x00CB, 0xFF8C, 0x00CC, - 0xFF8D, 0x00CD, 0xFF8E, 0x00CE, 0xFF8F, 0x00CF, 0xFF90, 0x00D0, - 0xFF91, 0x00D1, 0xFF92, 0x00D2, 0xFF93, 0x00D3, 0xFF94, 0x00D4, - 0xFF95, 0x00D5, 0xFF96, 0x00D6, 0xFF97, 0x00D7, 0xFF98, 0x00D8, - 0xFF99, 0x00D9, 0xFF9A, 0x00DA, 0xFF9B, 0x00DB, 0xFF9C, 0x00DC, - 0xFF9D, 0x00DD, 0xFF9E, 0x00DE, 0xFF9F, 0x00DF, 0xFFE0, 0x8191, - 0xFFE1, 0x8192, 0xFFE2, 0x81CA, 0xFFE3, 0x8150, 0xFFE4, 0xFA55, - 0xFFE5, 0x818F, 0, 0 -}; - -#if !_TINY_TABLE -static -const WCHAR sjis2uni[] = { -/* SJIS - Unicode, SJIS - Unicode, SJIS - Unicode, SJIS - Unicode, */ - 0x00A1, 0xFF61, 0x00A2, 0xFF62, 0x00A3, 0xFF63, 0x00A4, 0xFF64, - 0x00A5, 0xFF65, 0x00A6, 0xFF66, 0x00A7, 0xFF67, 0x00A8, 0xFF68, - 0x00A9, 0xFF69, 0x00AA, 0xFF6A, 0x00AB, 0xFF6B, 0x00AC, 0xFF6C, - 0x00AD, 0xFF6D, 0x00AE, 0xFF6E, 0x00AF, 0xFF6F, 0x00B0, 0xFF70, - 0x00B1, 0xFF71, 0x00B2, 0xFF72, 0x00B3, 0xFF73, 0x00B4, 0xFF74, - 0x00B5, 0xFF75, 0x00B6, 0xFF76, 0x00B7, 0xFF77, 0x00B8, 0xFF78, - 0x00B9, 0xFF79, 0x00BA, 0xFF7A, 0x00BB, 0xFF7B, 0x00BC, 0xFF7C, - 0x00BD, 0xFF7D, 0x00BE, 0xFF7E, 0x00BF, 0xFF7F, 0x00C0, 0xFF80, - 0x00C1, 0xFF81, 0x00C2, 0xFF82, 0x00C3, 0xFF83, 0x00C4, 0xFF84, - 0x00C5, 0xFF85, 0x00C6, 0xFF86, 0x00C7, 0xFF87, 0x00C8, 0xFF88, - 0x00C9, 0xFF89, 0x00CA, 0xFF8A, 0x00CB, 0xFF8B, 0x00CC, 0xFF8C, - 0x00CD, 0xFF8D, 0x00CE, 0xFF8E, 0x00CF, 0xFF8F, 0x00D0, 0xFF90, - 0x00D1, 0xFF91, 0x00D2, 0xFF92, 0x00D3, 0xFF93, 0x00D4, 0xFF94, - 0x00D5, 0xFF95, 0x00D6, 0xFF96, 0x00D7, 0xFF97, 0x00D8, 0xFF98, - 0x00D9, 0xFF99, 0x00DA, 0xFF9A, 0x00DB, 0xFF9B, 0x00DC, 0xFF9C, - 0x00DD, 0xFF9D, 0x00DE, 0xFF9E, 0x00DF, 0xFF9F, 0x8140, 0x3000, - 0x8141, 0x3001, 0x8142, 0x3002, 0x8143, 0xFF0C, 0x8144, 0xFF0E, - 0x8145, 0x30FB, 0x8146, 0xFF1A, 0x8147, 0xFF1B, 0x8148, 0xFF1F, - 0x8149, 0xFF01, 0x814A, 0x309B, 0x814B, 0x309C, 0x814C, 0x00B4, - 0x814D, 0xFF40, 0x814E, 0x00A8, 0x814F, 0xFF3E, 0x8150, 0xFFE3, - 0x8151, 0xFF3F, 0x8152, 0x30FD, 0x8153, 0x30FE, 0x8154, 0x309D, - 0x8155, 0x309E, 0x8156, 0x3003, 0x8157, 0x4EDD, 0x8158, 0x3005, - 0x8159, 0x3006, 0x815A, 0x3007, 0x815B, 0x30FC, 0x815C, 0x2015, - 0x815D, 0x2010, 0x815E, 0xFF0F, 0x815F, 0xFF3C, 0x8160, 0xFF5E, - 0x8161, 0x2225, 0x8162, 0xFF5C, 0x8163, 0x2026, 0x8164, 0x2025, - 0x8165, 0x2018, 0x8166, 0x2019, 0x8167, 0x201C, 0x8168, 0x201D, - 0x8169, 0xFF08, 0x816A, 0xFF09, 0x816B, 0x3014, 0x816C, 0x3015, - 0x816D, 0xFF3B, 0x816E, 0xFF3D, 0x816F, 0xFF5B, 0x8170, 0xFF5D, - 0x8171, 0x3008, 0x8172, 0x3009, 0x8173, 0x300A, 0x8174, 0x300B, - 0x8175, 0x300C, 0x8176, 0x300D, 0x8177, 0x300E, 0x8178, 0x300F, - 0x8179, 0x3010, 0x817A, 0x3011, 0x817B, 0xFF0B, 0x817C, 0xFF0D, - 0x817D, 0x00B1, 0x817E, 0x00D7, 0x8180, 0x00F7, 0x8181, 0xFF1D, - 0x8182, 0x2260, 0x8183, 0xFF1C, 0x8184, 0xFF1E, 0x8185, 0x2266, - 0x8186, 0x2267, 0x8187, 0x221E, 0x8188, 0x2234, 0x8189, 0x2642, - 0x818A, 0x2640, 0x818B, 0x00B0, 0x818C, 0x2032, 0x818D, 0x2033, - 0x818E, 0x2103, 0x818F, 0xFFE5, 0x8190, 0xFF04, 0x8191, 0xFFE0, - 0x8192, 0xFFE1, 0x8193, 0xFF05, 0x8194, 0xFF03, 0x8195, 0xFF06, - 0x8196, 0xFF0A, 0x8197, 0xFF20, 0x8198, 0x00A7, 0x8199, 0x2606, - 0x819A, 0x2605, 0x819B, 0x25CB, 0x819C, 0x25CF, 0x819D, 0x25CE, - 0x819E, 0x25C7, 0x819F, 0x25C6, 0x81A0, 0x25A1, 0x81A1, 0x25A0, - 0x81A2, 0x25B3, 0x81A3, 0x25B2, 0x81A4, 0x25BD, 0x81A5, 0x25BC, - 0x81A6, 0x203B, 0x81A7, 0x3012, 0x81A8, 0x2192, 0x81A9, 0x2190, - 0x81AA, 0x2191, 0x81AB, 0x2193, 0x81AC, 0x3013, 0x81B8, 0x2208, - 0x81B9, 0x220B, 0x81BA, 0x2286, 0x81BB, 0x2287, 0x81BC, 0x2282, - 0x81BD, 0x2283, 0x81BE, 0x222A, 0x81BF, 0x2229, 0x81C8, 0x2227, - 0x81C9, 0x2228, 0x81CA, 0xFFE2, 0x81CB, 0x21D2, 0x81CC, 0x21D4, - 0x81CD, 0x2200, 0x81CE, 0x2203, 0x81DA, 0x2220, 0x81DB, 0x22A5, - 0x81DC, 0x2312, 0x81DD, 0x2202, 0x81DE, 0x2207, 0x81DF, 0x2261, - 0x81E0, 0x2252, 0x81E1, 0x226A, 0x81E2, 0x226B, 0x81E3, 0x221A, - 0x81E4, 0x223D, 0x81E5, 0x221D, 0x81E6, 0x2235, 0x81E7, 0x222B, - 0x81E8, 0x222C, 0x81F0, 0x212B, 0x81F1, 0x2030, 0x81F2, 0x266F, - 0x81F3, 0x266D, 0x81F4, 0x266A, 0x81F5, 0x2020, 0x81F6, 0x2021, - 0x81F7, 0x00B6, 0x81FC, 0x25EF, 0x824F, 0xFF10, 0x8250, 0xFF11, - 0x8251, 0xFF12, 0x8252, 0xFF13, 0x8253, 0xFF14, 0x8254, 0xFF15, - 0x8255, 0xFF16, 0x8256, 0xFF17, 0x8257, 0xFF18, 0x8258, 0xFF19, - 0x8260, 0xFF21, 0x8261, 0xFF22, 0x8262, 0xFF23, 0x8263, 0xFF24, - 0x8264, 0xFF25, 0x8265, 0xFF26, 0x8266, 0xFF27, 0x8267, 0xFF28, - 0x8268, 0xFF29, 0x8269, 0xFF2A, 0x826A, 0xFF2B, 0x826B, 0xFF2C, - 0x826C, 0xFF2D, 0x826D, 0xFF2E, 0x826E, 0xFF2F, 0x826F, 0xFF30, - 0x8270, 0xFF31, 0x8271, 0xFF32, 0x8272, 0xFF33, 0x8273, 0xFF34, - 0x8274, 0xFF35, 0x8275, 0xFF36, 0x8276, 0xFF37, 0x8277, 0xFF38, - 0x8278, 0xFF39, 0x8279, 0xFF3A, 0x8281, 0xFF41, 0x8282, 0xFF42, - 0x8283, 0xFF43, 0x8284, 0xFF44, 0x8285, 0xFF45, 0x8286, 0xFF46, - 0x8287, 0xFF47, 0x8288, 0xFF48, 0x8289, 0xFF49, 0x828A, 0xFF4A, - 0x828B, 0xFF4B, 0x828C, 0xFF4C, 0x828D, 0xFF4D, 0x828E, 0xFF4E, - 0x828F, 0xFF4F, 0x8290, 0xFF50, 0x8291, 0xFF51, 0x8292, 0xFF52, - 0x8293, 0xFF53, 0x8294, 0xFF54, 0x8295, 0xFF55, 0x8296, 0xFF56, - 0x8297, 0xFF57, 0x8298, 0xFF58, 0x8299, 0xFF59, 0x829A, 0xFF5A, - 0x829F, 0x3041, 0x82A0, 0x3042, 0x82A1, 0x3043, 0x82A2, 0x3044, - 0x82A3, 0x3045, 0x82A4, 0x3046, 0x82A5, 0x3047, 0x82A6, 0x3048, - 0x82A7, 0x3049, 0x82A8, 0x304A, 0x82A9, 0x304B, 0x82AA, 0x304C, - 0x82AB, 0x304D, 0x82AC, 0x304E, 0x82AD, 0x304F, 0x82AE, 0x3050, - 0x82AF, 0x3051, 0x82B0, 0x3052, 0x82B1, 0x3053, 0x82B2, 0x3054, - 0x82B3, 0x3055, 0x82B4, 0x3056, 0x82B5, 0x3057, 0x82B6, 0x3058, - 0x82B7, 0x3059, 0x82B8, 0x305A, 0x82B9, 0x305B, 0x82BA, 0x305C, - 0x82BB, 0x305D, 0x82BC, 0x305E, 0x82BD, 0x305F, 0x82BE, 0x3060, - 0x82BF, 0x3061, 0x82C0, 0x3062, 0x82C1, 0x3063, 0x82C2, 0x3064, - 0x82C3, 0x3065, 0x82C4, 0x3066, 0x82C5, 0x3067, 0x82C6, 0x3068, - 0x82C7, 0x3069, 0x82C8, 0x306A, 0x82C9, 0x306B, 0x82CA, 0x306C, - 0x82CB, 0x306D, 0x82CC, 0x306E, 0x82CD, 0x306F, 0x82CE, 0x3070, - 0x82CF, 0x3071, 0x82D0, 0x3072, 0x82D1, 0x3073, 0x82D2, 0x3074, - 0x82D3, 0x3075, 0x82D4, 0x3076, 0x82D5, 0x3077, 0x82D6, 0x3078, - 0x82D7, 0x3079, 0x82D8, 0x307A, 0x82D9, 0x307B, 0x82DA, 0x307C, - 0x82DB, 0x307D, 0x82DC, 0x307E, 0x82DD, 0x307F, 0x82DE, 0x3080, - 0x82DF, 0x3081, 0x82E0, 0x3082, 0x82E1, 0x3083, 0x82E2, 0x3084, - 0x82E3, 0x3085, 0x82E4, 0x3086, 0x82E5, 0x3087, 0x82E6, 0x3088, - 0x82E7, 0x3089, 0x82E8, 0x308A, 0x82E9, 0x308B, 0x82EA, 0x308C, - 0x82EB, 0x308D, 0x82EC, 0x308E, 0x82ED, 0x308F, 0x82EE, 0x3090, - 0x82EF, 0x3091, 0x82F0, 0x3092, 0x82F1, 0x3093, 0x8340, 0x30A1, - 0x8341, 0x30A2, 0x8342, 0x30A3, 0x8343, 0x30A4, 0x8344, 0x30A5, - 0x8345, 0x30A6, 0x8346, 0x30A7, 0x8347, 0x30A8, 0x8348, 0x30A9, - 0x8349, 0x30AA, 0x834A, 0x30AB, 0x834B, 0x30AC, 0x834C, 0x30AD, - 0x834D, 0x30AE, 0x834E, 0x30AF, 0x834F, 0x30B0, 0x8350, 0x30B1, - 0x8351, 0x30B2, 0x8352, 0x30B3, 0x8353, 0x30B4, 0x8354, 0x30B5, - 0x8355, 0x30B6, 0x8356, 0x30B7, 0x8357, 0x30B8, 0x8358, 0x30B9, - 0x8359, 0x30BA, 0x835A, 0x30BB, 0x835B, 0x30BC, 0x835C, 0x30BD, - 0x835D, 0x30BE, 0x835E, 0x30BF, 0x835F, 0x30C0, 0x8360, 0x30C1, - 0x8361, 0x30C2, 0x8362, 0x30C3, 0x8363, 0x30C4, 0x8364, 0x30C5, - 0x8365, 0x30C6, 0x8366, 0x30C7, 0x8367, 0x30C8, 0x8368, 0x30C9, - 0x8369, 0x30CA, 0x836A, 0x30CB, 0x836B, 0x30CC, 0x836C, 0x30CD, - 0x836D, 0x30CE, 0x836E, 0x30CF, 0x836F, 0x30D0, 0x8370, 0x30D1, - 0x8371, 0x30D2, 0x8372, 0x30D3, 0x8373, 0x30D4, 0x8374, 0x30D5, - 0x8375, 0x30D6, 0x8376, 0x30D7, 0x8377, 0x30D8, 0x8378, 0x30D9, - 0x8379, 0x30DA, 0x837A, 0x30DB, 0x837B, 0x30DC, 0x837C, 0x30DD, - 0x837D, 0x30DE, 0x837E, 0x30DF, 0x8380, 0x30E0, 0x8381, 0x30E1, - 0x8382, 0x30E2, 0x8383, 0x30E3, 0x8384, 0x30E4, 0x8385, 0x30E5, - 0x8386, 0x30E6, 0x8387, 0x30E7, 0x8388, 0x30E8, 0x8389, 0x30E9, - 0x838A, 0x30EA, 0x838B, 0x30EB, 0x838C, 0x30EC, 0x838D, 0x30ED, - 0x838E, 0x30EE, 0x838F, 0x30EF, 0x8390, 0x30F0, 0x8391, 0x30F1, - 0x8392, 0x30F2, 0x8393, 0x30F3, 0x8394, 0x30F4, 0x8395, 0x30F5, - 0x8396, 0x30F6, 0x839F, 0x0391, 0x83A0, 0x0392, 0x83A1, 0x0393, - 0x83A2, 0x0394, 0x83A3, 0x0395, 0x83A4, 0x0396, 0x83A5, 0x0397, - 0x83A6, 0x0398, 0x83A7, 0x0399, 0x83A8, 0x039A, 0x83A9, 0x039B, - 0x83AA, 0x039C, 0x83AB, 0x039D, 0x83AC, 0x039E, 0x83AD, 0x039F, - 0x83AE, 0x03A0, 0x83AF, 0x03A1, 0x83B0, 0x03A3, 0x83B1, 0x03A4, - 0x83B2, 0x03A5, 0x83B3, 0x03A6, 0x83B4, 0x03A7, 0x83B5, 0x03A8, - 0x83B6, 0x03A9, 0x83BF, 0x03B1, 0x83C0, 0x03B2, 0x83C1, 0x03B3, - 0x83C2, 0x03B4, 0x83C3, 0x03B5, 0x83C4, 0x03B6, 0x83C5, 0x03B7, - 0x83C6, 0x03B8, 0x83C7, 0x03B9, 0x83C8, 0x03BA, 0x83C9, 0x03BB, - 0x83CA, 0x03BC, 0x83CB, 0x03BD, 0x83CC, 0x03BE, 0x83CD, 0x03BF, - 0x83CE, 0x03C0, 0x83CF, 0x03C1, 0x83D0, 0x03C3, 0x83D1, 0x03C4, - 0x83D2, 0x03C5, 0x83D3, 0x03C6, 0x83D4, 0x03C7, 0x83D5, 0x03C8, - 0x83D6, 0x03C9, 0x8440, 0x0410, 0x8441, 0x0411, 0x8442, 0x0412, - 0x8443, 0x0413, 0x8444, 0x0414, 0x8445, 0x0415, 0x8446, 0x0401, - 0x8447, 0x0416, 0x8448, 0x0417, 0x8449, 0x0418, 0x844A, 0x0419, - 0x844B, 0x041A, 0x844C, 0x041B, 0x844D, 0x041C, 0x844E, 0x041D, - 0x844F, 0x041E, 0x8450, 0x041F, 0x8451, 0x0420, 0x8452, 0x0421, - 0x8453, 0x0422, 0x8454, 0x0423, 0x8455, 0x0424, 0x8456, 0x0425, - 0x8457, 0x0426, 0x8458, 0x0427, 0x8459, 0x0428, 0x845A, 0x0429, - 0x845B, 0x042A, 0x845C, 0x042B, 0x845D, 0x042C, 0x845E, 0x042D, - 0x845F, 0x042E, 0x8460, 0x042F, 0x8470, 0x0430, 0x8471, 0x0431, - 0x8472, 0x0432, 0x8473, 0x0433, 0x8474, 0x0434, 0x8475, 0x0435, - 0x8476, 0x0451, 0x8477, 0x0436, 0x8478, 0x0437, 0x8479, 0x0438, - 0x847A, 0x0439, 0x847B, 0x043A, 0x847C, 0x043B, 0x847D, 0x043C, - 0x847E, 0x043D, 0x8480, 0x043E, 0x8481, 0x043F, 0x8482, 0x0440, - 0x8483, 0x0441, 0x8484, 0x0442, 0x8485, 0x0443, 0x8486, 0x0444, - 0x8487, 0x0445, 0x8488, 0x0446, 0x8489, 0x0447, 0x848A, 0x0448, - 0x848B, 0x0449, 0x848C, 0x044A, 0x848D, 0x044B, 0x848E, 0x044C, - 0x848F, 0x044D, 0x8490, 0x044E, 0x8491, 0x044F, 0x849F, 0x2500, - 0x84A0, 0x2502, 0x84A1, 0x250C, 0x84A2, 0x2510, 0x84A3, 0x2518, - 0x84A4, 0x2514, 0x84A5, 0x251C, 0x84A6, 0x252C, 0x84A7, 0x2524, - 0x84A8, 0x2534, 0x84A9, 0x253C, 0x84AA, 0x2501, 0x84AB, 0x2503, - 0x84AC, 0x250F, 0x84AD, 0x2513, 0x84AE, 0x251B, 0x84AF, 0x2517, - 0x84B0, 0x2523, 0x84B1, 0x2533, 0x84B2, 0x252B, 0x84B3, 0x253B, - 0x84B4, 0x254B, 0x84B5, 0x2520, 0x84B6, 0x252F, 0x84B7, 0x2528, - 0x84B8, 0x2537, 0x84B9, 0x253F, 0x84BA, 0x251D, 0x84BB, 0x2530, - 0x84BC, 0x2525, 0x84BD, 0x2538, 0x84BE, 0x2542, 0x8740, 0x2460, - 0x8741, 0x2461, 0x8742, 0x2462, 0x8743, 0x2463, 0x8744, 0x2464, - 0x8745, 0x2465, 0x8746, 0x2466, 0x8747, 0x2467, 0x8748, 0x2468, - 0x8749, 0x2469, 0x874A, 0x246A, 0x874B, 0x246B, 0x874C, 0x246C, - 0x874D, 0x246D, 0x874E, 0x246E, 0x874F, 0x246F, 0x8750, 0x2470, - 0x8751, 0x2471, 0x8752, 0x2472, 0x8753, 0x2473, 0x8754, 0x2160, - 0x8755, 0x2161, 0x8756, 0x2162, 0x8757, 0x2163, 0x8758, 0x2164, - 0x8759, 0x2165, 0x875A, 0x2166, 0x875B, 0x2167, 0x875C, 0x2168, - 0x875D, 0x2169, 0x875F, 0x3349, 0x8760, 0x3314, 0x8761, 0x3322, - 0x8762, 0x334D, 0x8763, 0x3318, 0x8764, 0x3327, 0x8765, 0x3303, - 0x8766, 0x3336, 0x8767, 0x3351, 0x8768, 0x3357, 0x8769, 0x330D, - 0x876A, 0x3326, 0x876B, 0x3323, 0x876C, 0x332B, 0x876D, 0x334A, - 0x876E, 0x333B, 0x876F, 0x339C, 0x8770, 0x339D, 0x8771, 0x339E, - 0x8772, 0x338E, 0x8773, 0x338F, 0x8774, 0x33C4, 0x8775, 0x33A1, - 0x877E, 0x337B, 0x8780, 0x301D, 0x8781, 0x301F, 0x8782, 0x2116, - 0x8783, 0x33CD, 0x8784, 0x2121, 0x8785, 0x32A4, 0x8786, 0x32A5, - 0x8787, 0x32A6, 0x8788, 0x32A7, 0x8789, 0x32A8, 0x878A, 0x3231, - 0x878B, 0x3232, 0x878C, 0x3239, 0x878D, 0x337E, 0x878E, 0x337D, - 0x878F, 0x337C, 0x8793, 0x222E, 0x8794, 0x2211, 0x8798, 0x221F, - 0x8799, 0x22BF, 0x889F, 0x4E9C, 0x88A0, 0x5516, 0x88A1, 0x5A03, - 0x88A2, 0x963F, 0x88A3, 0x54C0, 0x88A4, 0x611B, 0x88A5, 0x6328, - 0x88A6, 0x59F6, 0x88A7, 0x9022, 0x88A8, 0x8475, 0x88A9, 0x831C, - 0x88AA, 0x7A50, 0x88AB, 0x60AA, 0x88AC, 0x63E1, 0x88AD, 0x6E25, - 0x88AE, 0x65ED, 0x88AF, 0x8466, 0x88B0, 0x82A6, 0x88B1, 0x9BF5, - 0x88B2, 0x6893, 0x88B3, 0x5727, 0x88B4, 0x65A1, 0x88B5, 0x6271, - 0x88B6, 0x5B9B, 0x88B7, 0x59D0, 0x88B8, 0x867B, 0x88B9, 0x98F4, - 0x88BA, 0x7D62, 0x88BB, 0x7DBE, 0x88BC, 0x9B8E, 0x88BD, 0x6216, - 0x88BE, 0x7C9F, 0x88BF, 0x88B7, 0x88C0, 0x5B89, 0x88C1, 0x5EB5, - 0x88C2, 0x6309, 0x88C3, 0x6697, 0x88C4, 0x6848, 0x88C5, 0x95C7, - 0x88C6, 0x978D, 0x88C7, 0x674F, 0x88C8, 0x4EE5, 0x88C9, 0x4F0A, - 0x88CA, 0x4F4D, 0x88CB, 0x4F9D, 0x88CC, 0x5049, 0x88CD, 0x56F2, - 0x88CE, 0x5937, 0x88CF, 0x59D4, 0x88D0, 0x5A01, 0x88D1, 0x5C09, - 0x88D2, 0x60DF, 0x88D3, 0x610F, 0x88D4, 0x6170, 0x88D5, 0x6613, - 0x88D6, 0x6905, 0x88D7, 0x70BA, 0x88D8, 0x754F, 0x88D9, 0x7570, - 0x88DA, 0x79FB, 0x88DB, 0x7DAD, 0x88DC, 0x7DEF, 0x88DD, 0x80C3, - 0x88DE, 0x840E, 0x88DF, 0x8863, 0x88E0, 0x8B02, 0x88E1, 0x9055, - 0x88E2, 0x907A, 0x88E3, 0x533B, 0x88E4, 0x4E95, 0x88E5, 0x4EA5, - 0x88E6, 0x57DF, 0x88E7, 0x80B2, 0x88E8, 0x90C1, 0x88E9, 0x78EF, - 0x88EA, 0x4E00, 0x88EB, 0x58F1, 0x88EC, 0x6EA2, 0x88ED, 0x9038, - 0x88EE, 0x7A32, 0x88EF, 0x8328, 0x88F0, 0x828B, 0x88F1, 0x9C2F, - 0x88F2, 0x5141, 0x88F3, 0x5370, 0x88F4, 0x54BD, 0x88F5, 0x54E1, - 0x88F6, 0x56E0, 0x88F7, 0x59FB, 0x88F8, 0x5F15, 0x88F9, 0x98F2, - 0x88FA, 0x6DEB, 0x88FB, 0x80E4, 0x88FC, 0x852D, 0x8940, 0x9662, - 0x8941, 0x9670, 0x8942, 0x96A0, 0x8943, 0x97FB, 0x8944, 0x540B, - 0x8945, 0x53F3, 0x8946, 0x5B87, 0x8947, 0x70CF, 0x8948, 0x7FBD, - 0x8949, 0x8FC2, 0x894A, 0x96E8, 0x894B, 0x536F, 0x894C, 0x9D5C, - 0x894D, 0x7ABA, 0x894E, 0x4E11, 0x894F, 0x7893, 0x8950, 0x81FC, - 0x8951, 0x6E26, 0x8952, 0x5618, 0x8953, 0x5504, 0x8954, 0x6B1D, - 0x8955, 0x851A, 0x8956, 0x9C3B, 0x8957, 0x59E5, 0x8958, 0x53A9, - 0x8959, 0x6D66, 0x895A, 0x74DC, 0x895B, 0x958F, 0x895C, 0x5642, - 0x895D, 0x4E91, 0x895E, 0x904B, 0x895F, 0x96F2, 0x8960, 0x834F, - 0x8961, 0x990C, 0x8962, 0x53E1, 0x8963, 0x55B6, 0x8964, 0x5B30, - 0x8965, 0x5F71, 0x8966, 0x6620, 0x8967, 0x66F3, 0x8968, 0x6804, - 0x8969, 0x6C38, 0x896A, 0x6CF3, 0x896B, 0x6D29, 0x896C, 0x745B, - 0x896D, 0x76C8, 0x896E, 0x7A4E, 0x896F, 0x9834, 0x8970, 0x82F1, - 0x8971, 0x885B, 0x8972, 0x8A60, 0x8973, 0x92ED, 0x8974, 0x6DB2, - 0x8975, 0x75AB, 0x8976, 0x76CA, 0x8977, 0x99C5, 0x8978, 0x60A6, - 0x8979, 0x8B01, 0x897A, 0x8D8A, 0x897B, 0x95B2, 0x897C, 0x698E, - 0x897D, 0x53AD, 0x897E, 0x5186, 0x8980, 0x5712, 0x8981, 0x5830, - 0x8982, 0x5944, 0x8983, 0x5BB4, 0x8984, 0x5EF6, 0x8985, 0x6028, - 0x8986, 0x63A9, 0x8987, 0x63F4, 0x8988, 0x6CBF, 0x8989, 0x6F14, - 0x898A, 0x708E, 0x898B, 0x7114, 0x898C, 0x7159, 0x898D, 0x71D5, - 0x898E, 0x733F, 0x898F, 0x7E01, 0x8990, 0x8276, 0x8991, 0x82D1, - 0x8992, 0x8597, 0x8993, 0x9060, 0x8994, 0x925B, 0x8995, 0x9D1B, - 0x8996, 0x5869, 0x8997, 0x65BC, 0x8998, 0x6C5A, 0x8999, 0x7525, - 0x899A, 0x51F9, 0x899B, 0x592E, 0x899C, 0x5965, 0x899D, 0x5F80, - 0x899E, 0x5FDC, 0x899F, 0x62BC, 0x89A0, 0x65FA, 0x89A1, 0x6A2A, - 0x89A2, 0x6B27, 0x89A3, 0x6BB4, 0x89A4, 0x738B, 0x89A5, 0x7FC1, - 0x89A6, 0x8956, 0x89A7, 0x9D2C, 0x89A8, 0x9D0E, 0x89A9, 0x9EC4, - 0x89AA, 0x5CA1, 0x89AB, 0x6C96, 0x89AC, 0x837B, 0x89AD, 0x5104, - 0x89AE, 0x5C4B, 0x89AF, 0x61B6, 0x89B0, 0x81C6, 0x89B1, 0x6876, - 0x89B2, 0x7261, 0x89B3, 0x4E59, 0x89B4, 0x4FFA, 0x89B5, 0x5378, - 0x89B6, 0x6069, 0x89B7, 0x6E29, 0x89B8, 0x7A4F, 0x89B9, 0x97F3, - 0x89BA, 0x4E0B, 0x89BB, 0x5316, 0x89BC, 0x4EEE, 0x89BD, 0x4F55, - 0x89BE, 0x4F3D, 0x89BF, 0x4FA1, 0x89C0, 0x4F73, 0x89C1, 0x52A0, - 0x89C2, 0x53EF, 0x89C3, 0x5609, 0x89C4, 0x590F, 0x89C5, 0x5AC1, - 0x89C6, 0x5BB6, 0x89C7, 0x5BE1, 0x89C8, 0x79D1, 0x89C9, 0x6687, - 0x89CA, 0x679C, 0x89CB, 0x67B6, 0x89CC, 0x6B4C, 0x89CD, 0x6CB3, - 0x89CE, 0x706B, 0x89CF, 0x73C2, 0x89D0, 0x798D, 0x89D1, 0x79BE, - 0x89D2, 0x7A3C, 0x89D3, 0x7B87, 0x89D4, 0x82B1, 0x89D5, 0x82DB, - 0x89D6, 0x8304, 0x89D7, 0x8377, 0x89D8, 0x83EF, 0x89D9, 0x83D3, - 0x89DA, 0x8766, 0x89DB, 0x8AB2, 0x89DC, 0x5629, 0x89DD, 0x8CA8, - 0x89DE, 0x8FE6, 0x89DF, 0x904E, 0x89E0, 0x971E, 0x89E1, 0x868A, - 0x89E2, 0x4FC4, 0x89E3, 0x5CE8, 0x89E4, 0x6211, 0x89E5, 0x7259, - 0x89E6, 0x753B, 0x89E7, 0x81E5, 0x89E8, 0x82BD, 0x89E9, 0x86FE, - 0x89EA, 0x8CC0, 0x89EB, 0x96C5, 0x89EC, 0x9913, 0x89ED, 0x99D5, - 0x89EE, 0x4ECB, 0x89EF, 0x4F1A, 0x89F0, 0x89E3, 0x89F1, 0x56DE, - 0x89F2, 0x584A, 0x89F3, 0x58CA, 0x89F4, 0x5EFB, 0x89F5, 0x5FEB, - 0x89F6, 0x602A, 0x89F7, 0x6094, 0x89F8, 0x6062, 0x89F9, 0x61D0, - 0x89FA, 0x6212, 0x89FB, 0x62D0, 0x89FC, 0x6539, 0x8A40, 0x9B41, - 0x8A41, 0x6666, 0x8A42, 0x68B0, 0x8A43, 0x6D77, 0x8A44, 0x7070, - 0x8A45, 0x754C, 0x8A46, 0x7686, 0x8A47, 0x7D75, 0x8A48, 0x82A5, - 0x8A49, 0x87F9, 0x8A4A, 0x958B, 0x8A4B, 0x968E, 0x8A4C, 0x8C9D, - 0x8A4D, 0x51F1, 0x8A4E, 0x52BE, 0x8A4F, 0x5916, 0x8A50, 0x54B3, - 0x8A51, 0x5BB3, 0x8A52, 0x5D16, 0x8A53, 0x6168, 0x8A54, 0x6982, - 0x8A55, 0x6DAF, 0x8A56, 0x788D, 0x8A57, 0x84CB, 0x8A58, 0x8857, - 0x8A59, 0x8A72, 0x8A5A, 0x93A7, 0x8A5B, 0x9AB8, 0x8A5C, 0x6D6C, - 0x8A5D, 0x99A8, 0x8A5E, 0x86D9, 0x8A5F, 0x57A3, 0x8A60, 0x67FF, - 0x8A61, 0x86CE, 0x8A62, 0x920E, 0x8A63, 0x5283, 0x8A64, 0x5687, - 0x8A65, 0x5404, 0x8A66, 0x5ED3, 0x8A67, 0x62E1, 0x8A68, 0x64B9, - 0x8A69, 0x683C, 0x8A6A, 0x6838, 0x8A6B, 0x6BBB, 0x8A6C, 0x7372, - 0x8A6D, 0x78BA, 0x8A6E, 0x7A6B, 0x8A6F, 0x899A, 0x8A70, 0x89D2, - 0x8A71, 0x8D6B, 0x8A72, 0x8F03, 0x8A73, 0x90ED, 0x8A74, 0x95A3, - 0x8A75, 0x9694, 0x8A76, 0x9769, 0x8A77, 0x5B66, 0x8A78, 0x5CB3, - 0x8A79, 0x697D, 0x8A7A, 0x984D, 0x8A7B, 0x984E, 0x8A7C, 0x639B, - 0x8A7D, 0x7B20, 0x8A7E, 0x6A2B, 0x8A80, 0x6A7F, 0x8A81, 0x68B6, - 0x8A82, 0x9C0D, 0x8A83, 0x6F5F, 0x8A84, 0x5272, 0x8A85, 0x559D, - 0x8A86, 0x6070, 0x8A87, 0x62EC, 0x8A88, 0x6D3B, 0x8A89, 0x6E07, - 0x8A8A, 0x6ED1, 0x8A8B, 0x845B, 0x8A8C, 0x8910, 0x8A8D, 0x8F44, - 0x8A8E, 0x4E14, 0x8A8F, 0x9C39, 0x8A90, 0x53F6, 0x8A91, 0x691B, - 0x8A92, 0x6A3A, 0x8A93, 0x9784, 0x8A94, 0x682A, 0x8A95, 0x515C, - 0x8A96, 0x7AC3, 0x8A97, 0x84B2, 0x8A98, 0x91DC, 0x8A99, 0x938C, - 0x8A9A, 0x565B, 0x8A9B, 0x9D28, 0x8A9C, 0x6822, 0x8A9D, 0x8305, - 0x8A9E, 0x8431, 0x8A9F, 0x7CA5, 0x8AA0, 0x5208, 0x8AA1, 0x82C5, - 0x8AA2, 0x74E6, 0x8AA3, 0x4E7E, 0x8AA4, 0x4F83, 0x8AA5, 0x51A0, - 0x8AA6, 0x5BD2, 0x8AA7, 0x520A, 0x8AA8, 0x52D8, 0x8AA9, 0x52E7, - 0x8AAA, 0x5DFB, 0x8AAB, 0x559A, 0x8AAC, 0x582A, 0x8AAD, 0x59E6, - 0x8AAE, 0x5B8C, 0x8AAF, 0x5B98, 0x8AB0, 0x5BDB, 0x8AB1, 0x5E72, - 0x8AB2, 0x5E79, 0x8AB3, 0x60A3, 0x8AB4, 0x611F, 0x8AB5, 0x6163, - 0x8AB6, 0x61BE, 0x8AB7, 0x63DB, 0x8AB8, 0x6562, 0x8AB9, 0x67D1, - 0x8ABA, 0x6853, 0x8ABB, 0x68FA, 0x8ABC, 0x6B3E, 0x8ABD, 0x6B53, - 0x8ABE, 0x6C57, 0x8ABF, 0x6F22, 0x8AC0, 0x6F97, 0x8AC1, 0x6F45, - 0x8AC2, 0x74B0, 0x8AC3, 0x7518, 0x8AC4, 0x76E3, 0x8AC5, 0x770B, - 0x8AC6, 0x7AFF, 0x8AC7, 0x7BA1, 0x8AC8, 0x7C21, 0x8AC9, 0x7DE9, - 0x8ACA, 0x7F36, 0x8ACB, 0x7FF0, 0x8ACC, 0x809D, 0x8ACD, 0x8266, - 0x8ACE, 0x839E, 0x8ACF, 0x89B3, 0x8AD0, 0x8ACC, 0x8AD1, 0x8CAB, - 0x8AD2, 0x9084, 0x8AD3, 0x9451, 0x8AD4, 0x9593, 0x8AD5, 0x9591, - 0x8AD6, 0x95A2, 0x8AD7, 0x9665, 0x8AD8, 0x97D3, 0x8AD9, 0x9928, - 0x8ADA, 0x8218, 0x8ADB, 0x4E38, 0x8ADC, 0x542B, 0x8ADD, 0x5CB8, - 0x8ADE, 0x5DCC, 0x8ADF, 0x73A9, 0x8AE0, 0x764C, 0x8AE1, 0x773C, - 0x8AE2, 0x5CA9, 0x8AE3, 0x7FEB, 0x8AE4, 0x8D0B, 0x8AE5, 0x96C1, - 0x8AE6, 0x9811, 0x8AE7, 0x9854, 0x8AE8, 0x9858, 0x8AE9, 0x4F01, - 0x8AEA, 0x4F0E, 0x8AEB, 0x5371, 0x8AEC, 0x559C, 0x8AED, 0x5668, - 0x8AEE, 0x57FA, 0x8AEF, 0x5947, 0x8AF0, 0x5B09, 0x8AF1, 0x5BC4, - 0x8AF2, 0x5C90, 0x8AF3, 0x5E0C, 0x8AF4, 0x5E7E, 0x8AF5, 0x5FCC, - 0x8AF6, 0x63EE, 0x8AF7, 0x673A, 0x8AF8, 0x65D7, 0x8AF9, 0x65E2, - 0x8AFA, 0x671F, 0x8AFB, 0x68CB, 0x8AFC, 0x68C4, 0x8B40, 0x6A5F, - 0x8B41, 0x5E30, 0x8B42, 0x6BC5, 0x8B43, 0x6C17, 0x8B44, 0x6C7D, - 0x8B45, 0x757F, 0x8B46, 0x7948, 0x8B47, 0x5B63, 0x8B48, 0x7A00, - 0x8B49, 0x7D00, 0x8B4A, 0x5FBD, 0x8B4B, 0x898F, 0x8B4C, 0x8A18, - 0x8B4D, 0x8CB4, 0x8B4E, 0x8D77, 0x8B4F, 0x8ECC, 0x8B50, 0x8F1D, - 0x8B51, 0x98E2, 0x8B52, 0x9A0E, 0x8B53, 0x9B3C, 0x8B54, 0x4E80, - 0x8B55, 0x507D, 0x8B56, 0x5100, 0x8B57, 0x5993, 0x8B58, 0x5B9C, - 0x8B59, 0x622F, 0x8B5A, 0x6280, 0x8B5B, 0x64EC, 0x8B5C, 0x6B3A, - 0x8B5D, 0x72A0, 0x8B5E, 0x7591, 0x8B5F, 0x7947, 0x8B60, 0x7FA9, - 0x8B61, 0x87FB, 0x8B62, 0x8ABC, 0x8B63, 0x8B70, 0x8B64, 0x63AC, - 0x8B65, 0x83CA, 0x8B66, 0x97A0, 0x8B67, 0x5409, 0x8B68, 0x5403, - 0x8B69, 0x55AB, 0x8B6A, 0x6854, 0x8B6B, 0x6A58, 0x8B6C, 0x8A70, - 0x8B6D, 0x7827, 0x8B6E, 0x6775, 0x8B6F, 0x9ECD, 0x8B70, 0x5374, - 0x8B71, 0x5BA2, 0x8B72, 0x811A, 0x8B73, 0x8650, 0x8B74, 0x9006, - 0x8B75, 0x4E18, 0x8B76, 0x4E45, 0x8B77, 0x4EC7, 0x8B78, 0x4F11, - 0x8B79, 0x53CA, 0x8B7A, 0x5438, 0x8B7B, 0x5BAE, 0x8B7C, 0x5F13, - 0x8B7D, 0x6025, 0x8B7E, 0x6551, 0x8B80, 0x673D, 0x8B81, 0x6C42, - 0x8B82, 0x6C72, 0x8B83, 0x6CE3, 0x8B84, 0x7078, 0x8B85, 0x7403, - 0x8B86, 0x7A76, 0x8B87, 0x7AAE, 0x8B88, 0x7B08, 0x8B89, 0x7D1A, - 0x8B8A, 0x7CFE, 0x8B8B, 0x7D66, 0x8B8C, 0x65E7, 0x8B8D, 0x725B, - 0x8B8E, 0x53BB, 0x8B8F, 0x5C45, 0x8B90, 0x5DE8, 0x8B91, 0x62D2, - 0x8B92, 0x62E0, 0x8B93, 0x6319, 0x8B94, 0x6E20, 0x8B95, 0x865A, - 0x8B96, 0x8A31, 0x8B97, 0x8DDD, 0x8B98, 0x92F8, 0x8B99, 0x6F01, - 0x8B9A, 0x79A6, 0x8B9B, 0x9B5A, 0x8B9C, 0x4EA8, 0x8B9D, 0x4EAB, - 0x8B9E, 0x4EAC, 0x8B9F, 0x4F9B, 0x8BA0, 0x4FA0, 0x8BA1, 0x50D1, - 0x8BA2, 0x5147, 0x8BA3, 0x7AF6, 0x8BA4, 0x5171, 0x8BA5, 0x51F6, - 0x8BA6, 0x5354, 0x8BA7, 0x5321, 0x8BA8, 0x537F, 0x8BA9, 0x53EB, - 0x8BAA, 0x55AC, 0x8BAB, 0x5883, 0x8BAC, 0x5CE1, 0x8BAD, 0x5F37, - 0x8BAE, 0x5F4A, 0x8BAF, 0x602F, 0x8BB0, 0x6050, 0x8BB1, 0x606D, - 0x8BB2, 0x631F, 0x8BB3, 0x6559, 0x8BB4, 0x6A4B, 0x8BB5, 0x6CC1, - 0x8BB6, 0x72C2, 0x8BB7, 0x72ED, 0x8BB8, 0x77EF, 0x8BB9, 0x80F8, - 0x8BBA, 0x8105, 0x8BBB, 0x8208, 0x8BBC, 0x854E, 0x8BBD, 0x90F7, - 0x8BBE, 0x93E1, 0x8BBF, 0x97FF, 0x8BC0, 0x9957, 0x8BC1, 0x9A5A, - 0x8BC2, 0x4EF0, 0x8BC3, 0x51DD, 0x8BC4, 0x5C2D, 0x8BC5, 0x6681, - 0x8BC6, 0x696D, 0x8BC7, 0x5C40, 0x8BC8, 0x66F2, 0x8BC9, 0x6975, - 0x8BCA, 0x7389, 0x8BCB, 0x6850, 0x8BCC, 0x7C81, 0x8BCD, 0x50C5, - 0x8BCE, 0x52E4, 0x8BCF, 0x5747, 0x8BD0, 0x5DFE, 0x8BD1, 0x9326, - 0x8BD2, 0x65A4, 0x8BD3, 0x6B23, 0x8BD4, 0x6B3D, 0x8BD5, 0x7434, - 0x8BD6, 0x7981, 0x8BD7, 0x79BD, 0x8BD8, 0x7B4B, 0x8BD9, 0x7DCA, - 0x8BDA, 0x82B9, 0x8BDB, 0x83CC, 0x8BDC, 0x887F, 0x8BDD, 0x895F, - 0x8BDE, 0x8B39, 0x8BDF, 0x8FD1, 0x8BE0, 0x91D1, 0x8BE1, 0x541F, - 0x8BE2, 0x9280, 0x8BE3, 0x4E5D, 0x8BE4, 0x5036, 0x8BE5, 0x53E5, - 0x8BE6, 0x533A, 0x8BE7, 0x72D7, 0x8BE8, 0x7396, 0x8BE9, 0x77E9, - 0x8BEA, 0x82E6, 0x8BEB, 0x8EAF, 0x8BEC, 0x99C6, 0x8BED, 0x99C8, - 0x8BEE, 0x99D2, 0x8BEF, 0x5177, 0x8BF0, 0x611A, 0x8BF1, 0x865E, - 0x8BF2, 0x55B0, 0x8BF3, 0x7A7A, 0x8BF4, 0x5076, 0x8BF5, 0x5BD3, - 0x8BF6, 0x9047, 0x8BF7, 0x9685, 0x8BF8, 0x4E32, 0x8BF9, 0x6ADB, - 0x8BFA, 0x91E7, 0x8BFB, 0x5C51, 0x8BFC, 0x5C48, 0x8C40, 0x6398, - 0x8C41, 0x7A9F, 0x8C42, 0x6C93, 0x8C43, 0x9774, 0x8C44, 0x8F61, - 0x8C45, 0x7AAA, 0x8C46, 0x718A, 0x8C47, 0x9688, 0x8C48, 0x7C82, - 0x8C49, 0x6817, 0x8C4A, 0x7E70, 0x8C4B, 0x6851, 0x8C4C, 0x936C, - 0x8C4D, 0x52F2, 0x8C4E, 0x541B, 0x8C4F, 0x85AB, 0x8C50, 0x8A13, - 0x8C51, 0x7FA4, 0x8C52, 0x8ECD, 0x8C53, 0x90E1, 0x8C54, 0x5366, - 0x8C55, 0x8888, 0x8C56, 0x7941, 0x8C57, 0x4FC2, 0x8C58, 0x50BE, - 0x8C59, 0x5211, 0x8C5A, 0x5144, 0x8C5B, 0x5553, 0x8C5C, 0x572D, - 0x8C5D, 0x73EA, 0x8C5E, 0x578B, 0x8C5F, 0x5951, 0x8C60, 0x5F62, - 0x8C61, 0x5F84, 0x8C62, 0x6075, 0x8C63, 0x6176, 0x8C64, 0x6167, - 0x8C65, 0x61A9, 0x8C66, 0x63B2, 0x8C67, 0x643A, 0x8C68, 0x656C, - 0x8C69, 0x666F, 0x8C6A, 0x6842, 0x8C6B, 0x6E13, 0x8C6C, 0x7566, - 0x8C6D, 0x7A3D, 0x8C6E, 0x7CFB, 0x8C6F, 0x7D4C, 0x8C70, 0x7D99, - 0x8C71, 0x7E4B, 0x8C72, 0x7F6B, 0x8C73, 0x830E, 0x8C74, 0x834A, - 0x8C75, 0x86CD, 0x8C76, 0x8A08, 0x8C77, 0x8A63, 0x8C78, 0x8B66, - 0x8C79, 0x8EFD, 0x8C7A, 0x981A, 0x8C7B, 0x9D8F, 0x8C7C, 0x82B8, - 0x8C7D, 0x8FCE, 0x8C7E, 0x9BE8, 0x8C80, 0x5287, 0x8C81, 0x621F, - 0x8C82, 0x6483, 0x8C83, 0x6FC0, 0x8C84, 0x9699, 0x8C85, 0x6841, - 0x8C86, 0x5091, 0x8C87, 0x6B20, 0x8C88, 0x6C7A, 0x8C89, 0x6F54, - 0x8C8A, 0x7A74, 0x8C8B, 0x7D50, 0x8C8C, 0x8840, 0x8C8D, 0x8A23, - 0x8C8E, 0x6708, 0x8C8F, 0x4EF6, 0x8C90, 0x5039, 0x8C91, 0x5026, - 0x8C92, 0x5065, 0x8C93, 0x517C, 0x8C94, 0x5238, 0x8C95, 0x5263, - 0x8C96, 0x55A7, 0x8C97, 0x570F, 0x8C98, 0x5805, 0x8C99, 0x5ACC, - 0x8C9A, 0x5EFA, 0x8C9B, 0x61B2, 0x8C9C, 0x61F8, 0x8C9D, 0x62F3, - 0x8C9E, 0x6372, 0x8C9F, 0x691C, 0x8CA0, 0x6A29, 0x8CA1, 0x727D, - 0x8CA2, 0x72AC, 0x8CA3, 0x732E, 0x8CA4, 0x7814, 0x8CA5, 0x786F, - 0x8CA6, 0x7D79, 0x8CA7, 0x770C, 0x8CA8, 0x80A9, 0x8CA9, 0x898B, - 0x8CAA, 0x8B19, 0x8CAB, 0x8CE2, 0x8CAC, 0x8ED2, 0x8CAD, 0x9063, - 0x8CAE, 0x9375, 0x8CAF, 0x967A, 0x8CB0, 0x9855, 0x8CB1, 0x9A13, - 0x8CB2, 0x9E78, 0x8CB3, 0x5143, 0x8CB4, 0x539F, 0x8CB5, 0x53B3, - 0x8CB6, 0x5E7B, 0x8CB7, 0x5F26, 0x8CB8, 0x6E1B, 0x8CB9, 0x6E90, - 0x8CBA, 0x7384, 0x8CBB, 0x73FE, 0x8CBC, 0x7D43, 0x8CBD, 0x8237, - 0x8CBE, 0x8A00, 0x8CBF, 0x8AFA, 0x8CC0, 0x9650, 0x8CC1, 0x4E4E, - 0x8CC2, 0x500B, 0x8CC3, 0x53E4, 0x8CC4, 0x547C, 0x8CC5, 0x56FA, - 0x8CC6, 0x59D1, 0x8CC7, 0x5B64, 0x8CC8, 0x5DF1, 0x8CC9, 0x5EAB, - 0x8CCA, 0x5F27, 0x8CCB, 0x6238, 0x8CCC, 0x6545, 0x8CCD, 0x67AF, - 0x8CCE, 0x6E56, 0x8CCF, 0x72D0, 0x8CD0, 0x7CCA, 0x8CD1, 0x88B4, - 0x8CD2, 0x80A1, 0x8CD3, 0x80E1, 0x8CD4, 0x83F0, 0x8CD5, 0x864E, - 0x8CD6, 0x8A87, 0x8CD7, 0x8DE8, 0x8CD8, 0x9237, 0x8CD9, 0x96C7, - 0x8CDA, 0x9867, 0x8CDB, 0x9F13, 0x8CDC, 0x4E94, 0x8CDD, 0x4E92, - 0x8CDE, 0x4F0D, 0x8CDF, 0x5348, 0x8CE0, 0x5449, 0x8CE1, 0x543E, - 0x8CE2, 0x5A2F, 0x8CE3, 0x5F8C, 0x8CE4, 0x5FA1, 0x8CE5, 0x609F, - 0x8CE6, 0x68A7, 0x8CE7, 0x6A8E, 0x8CE8, 0x745A, 0x8CE9, 0x7881, - 0x8CEA, 0x8A9E, 0x8CEB, 0x8AA4, 0x8CEC, 0x8B77, 0x8CED, 0x9190, - 0x8CEE, 0x4E5E, 0x8CEF, 0x9BC9, 0x8CF0, 0x4EA4, 0x8CF1, 0x4F7C, - 0x8CF2, 0x4FAF, 0x8CF3, 0x5019, 0x8CF4, 0x5016, 0x8CF5, 0x5149, - 0x8CF6, 0x516C, 0x8CF7, 0x529F, 0x8CF8, 0x52B9, 0x8CF9, 0x52FE, - 0x8CFA, 0x539A, 0x8CFB, 0x53E3, 0x8CFC, 0x5411, 0x8D40, 0x540E, - 0x8D41, 0x5589, 0x8D42, 0x5751, 0x8D43, 0x57A2, 0x8D44, 0x597D, - 0x8D45, 0x5B54, 0x8D46, 0x5B5D, 0x8D47, 0x5B8F, 0x8D48, 0x5DE5, - 0x8D49, 0x5DE7, 0x8D4A, 0x5DF7, 0x8D4B, 0x5E78, 0x8D4C, 0x5E83, - 0x8D4D, 0x5E9A, 0x8D4E, 0x5EB7, 0x8D4F, 0x5F18, 0x8D50, 0x6052, - 0x8D51, 0x614C, 0x8D52, 0x6297, 0x8D53, 0x62D8, 0x8D54, 0x63A7, - 0x8D55, 0x653B, 0x8D56, 0x6602, 0x8D57, 0x6643, 0x8D58, 0x66F4, - 0x8D59, 0x676D, 0x8D5A, 0x6821, 0x8D5B, 0x6897, 0x8D5C, 0x69CB, - 0x8D5D, 0x6C5F, 0x8D5E, 0x6D2A, 0x8D5F, 0x6D69, 0x8D60, 0x6E2F, - 0x8D61, 0x6E9D, 0x8D62, 0x7532, 0x8D63, 0x7687, 0x8D64, 0x786C, - 0x8D65, 0x7A3F, 0x8D66, 0x7CE0, 0x8D67, 0x7D05, 0x8D68, 0x7D18, - 0x8D69, 0x7D5E, 0x8D6A, 0x7DB1, 0x8D6B, 0x8015, 0x8D6C, 0x8003, - 0x8D6D, 0x80AF, 0x8D6E, 0x80B1, 0x8D6F, 0x8154, 0x8D70, 0x818F, - 0x8D71, 0x822A, 0x8D72, 0x8352, 0x8D73, 0x884C, 0x8D74, 0x8861, - 0x8D75, 0x8B1B, 0x8D76, 0x8CA2, 0x8D77, 0x8CFC, 0x8D78, 0x90CA, - 0x8D79, 0x9175, 0x8D7A, 0x9271, 0x8D7B, 0x783F, 0x8D7C, 0x92FC, - 0x8D7D, 0x95A4, 0x8D7E, 0x964D, 0x8D80, 0x9805, 0x8D81, 0x9999, - 0x8D82, 0x9AD8, 0x8D83, 0x9D3B, 0x8D84, 0x525B, 0x8D85, 0x52AB, - 0x8D86, 0x53F7, 0x8D87, 0x5408, 0x8D88, 0x58D5, 0x8D89, 0x62F7, - 0x8D8A, 0x6FE0, 0x8D8B, 0x8C6A, 0x8D8C, 0x8F5F, 0x8D8D, 0x9EB9, - 0x8D8E, 0x514B, 0x8D8F, 0x523B, 0x8D90, 0x544A, 0x8D91, 0x56FD, - 0x8D92, 0x7A40, 0x8D93, 0x9177, 0x8D94, 0x9D60, 0x8D95, 0x9ED2, - 0x8D96, 0x7344, 0x8D97, 0x6F09, 0x8D98, 0x8170, 0x8D99, 0x7511, - 0x8D9A, 0x5FFD, 0x8D9B, 0x60DA, 0x8D9C, 0x9AA8, 0x8D9D, 0x72DB, - 0x8D9E, 0x8FBC, 0x8D9F, 0x6B64, 0x8DA0, 0x9803, 0x8DA1, 0x4ECA, - 0x8DA2, 0x56F0, 0x8DA3, 0x5764, 0x8DA4, 0x58BE, 0x8DA5, 0x5A5A, - 0x8DA6, 0x6068, 0x8DA7, 0x61C7, 0x8DA8, 0x660F, 0x8DA9, 0x6606, - 0x8DAA, 0x6839, 0x8DAB, 0x68B1, 0x8DAC, 0x6DF7, 0x8DAD, 0x75D5, - 0x8DAE, 0x7D3A, 0x8DAF, 0x826E, 0x8DB0, 0x9B42, 0x8DB1, 0x4E9B, - 0x8DB2, 0x4F50, 0x8DB3, 0x53C9, 0x8DB4, 0x5506, 0x8DB5, 0x5D6F, - 0x8DB6, 0x5DE6, 0x8DB7, 0x5DEE, 0x8DB8, 0x67FB, 0x8DB9, 0x6C99, - 0x8DBA, 0x7473, 0x8DBB, 0x7802, 0x8DBC, 0x8A50, 0x8DBD, 0x9396, - 0x8DBE, 0x88DF, 0x8DBF, 0x5750, 0x8DC0, 0x5EA7, 0x8DC1, 0x632B, - 0x8DC2, 0x50B5, 0x8DC3, 0x50AC, 0x8DC4, 0x518D, 0x8DC5, 0x6700, - 0x8DC6, 0x54C9, 0x8DC7, 0x585E, 0x8DC8, 0x59BB, 0x8DC9, 0x5BB0, - 0x8DCA, 0x5F69, 0x8DCB, 0x624D, 0x8DCC, 0x63A1, 0x8DCD, 0x683D, - 0x8DCE, 0x6B73, 0x8DCF, 0x6E08, 0x8DD0, 0x707D, 0x8DD1, 0x91C7, - 0x8DD2, 0x7280, 0x8DD3, 0x7815, 0x8DD4, 0x7826, 0x8DD5, 0x796D, - 0x8DD6, 0x658E, 0x8DD7, 0x7D30, 0x8DD8, 0x83DC, 0x8DD9, 0x88C1, - 0x8DDA, 0x8F09, 0x8DDB, 0x969B, 0x8DDC, 0x5264, 0x8DDD, 0x5728, - 0x8DDE, 0x6750, 0x8DDF, 0x7F6A, 0x8DE0, 0x8CA1, 0x8DE1, 0x51B4, - 0x8DE2, 0x5742, 0x8DE3, 0x962A, 0x8DE4, 0x583A, 0x8DE5, 0x698A, - 0x8DE6, 0x80B4, 0x8DE7, 0x54B2, 0x8DE8, 0x5D0E, 0x8DE9, 0x57FC, - 0x8DEA, 0x7895, 0x8DEB, 0x9DFA, 0x8DEC, 0x4F5C, 0x8DED, 0x524A, - 0x8DEE, 0x548B, 0x8DEF, 0x643E, 0x8DF0, 0x6628, 0x8DF1, 0x6714, - 0x8DF2, 0x67F5, 0x8DF3, 0x7A84, 0x8DF4, 0x7B56, 0x8DF5, 0x7D22, - 0x8DF6, 0x932F, 0x8DF7, 0x685C, 0x8DF8, 0x9BAD, 0x8DF9, 0x7B39, - 0x8DFA, 0x5319, 0x8DFB, 0x518A, 0x8DFC, 0x5237, 0x8E40, 0x5BDF, - 0x8E41, 0x62F6, 0x8E42, 0x64AE, 0x8E43, 0x64E6, 0x8E44, 0x672D, - 0x8E45, 0x6BBA, 0x8E46, 0x85A9, 0x8E47, 0x96D1, 0x8E48, 0x7690, - 0x8E49, 0x9BD6, 0x8E4A, 0x634C, 0x8E4B, 0x9306, 0x8E4C, 0x9BAB, - 0x8E4D, 0x76BF, 0x8E4E, 0x6652, 0x8E4F, 0x4E09, 0x8E50, 0x5098, - 0x8E51, 0x53C2, 0x8E52, 0x5C71, 0x8E53, 0x60E8, 0x8E54, 0x6492, - 0x8E55, 0x6563, 0x8E56, 0x685F, 0x8E57, 0x71E6, 0x8E58, 0x73CA, - 0x8E59, 0x7523, 0x8E5A, 0x7B97, 0x8E5B, 0x7E82, 0x8E5C, 0x8695, - 0x8E5D, 0x8B83, 0x8E5E, 0x8CDB, 0x8E5F, 0x9178, 0x8E60, 0x9910, - 0x8E61, 0x65AC, 0x8E62, 0x66AB, 0x8E63, 0x6B8B, 0x8E64, 0x4ED5, - 0x8E65, 0x4ED4, 0x8E66, 0x4F3A, 0x8E67, 0x4F7F, 0x8E68, 0x523A, - 0x8E69, 0x53F8, 0x8E6A, 0x53F2, 0x8E6B, 0x55E3, 0x8E6C, 0x56DB, - 0x8E6D, 0x58EB, 0x8E6E, 0x59CB, 0x8E6F, 0x59C9, 0x8E70, 0x59FF, - 0x8E71, 0x5B50, 0x8E72, 0x5C4D, 0x8E73, 0x5E02, 0x8E74, 0x5E2B, - 0x8E75, 0x5FD7, 0x8E76, 0x601D, 0x8E77, 0x6307, 0x8E78, 0x652F, - 0x8E79, 0x5B5C, 0x8E7A, 0x65AF, 0x8E7B, 0x65BD, 0x8E7C, 0x65E8, - 0x8E7D, 0x679D, 0x8E7E, 0x6B62, 0x8E80, 0x6B7B, 0x8E81, 0x6C0F, - 0x8E82, 0x7345, 0x8E83, 0x7949, 0x8E84, 0x79C1, 0x8E85, 0x7CF8, - 0x8E86, 0x7D19, 0x8E87, 0x7D2B, 0x8E88, 0x80A2, 0x8E89, 0x8102, - 0x8E8A, 0x81F3, 0x8E8B, 0x8996, 0x8E8C, 0x8A5E, 0x8E8D, 0x8A69, - 0x8E8E, 0x8A66, 0x8E8F, 0x8A8C, 0x8E90, 0x8AEE, 0x8E91, 0x8CC7, - 0x8E92, 0x8CDC, 0x8E93, 0x96CC, 0x8E94, 0x98FC, 0x8E95, 0x6B6F, - 0x8E96, 0x4E8B, 0x8E97, 0x4F3C, 0x8E98, 0x4F8D, 0x8E99, 0x5150, - 0x8E9A, 0x5B57, 0x8E9B, 0x5BFA, 0x8E9C, 0x6148, 0x8E9D, 0x6301, - 0x8E9E, 0x6642, 0x8E9F, 0x6B21, 0x8EA0, 0x6ECB, 0x8EA1, 0x6CBB, - 0x8EA2, 0x723E, 0x8EA3, 0x74BD, 0x8EA4, 0x75D4, 0x8EA5, 0x78C1, - 0x8EA6, 0x793A, 0x8EA7, 0x800C, 0x8EA8, 0x8033, 0x8EA9, 0x81EA, - 0x8EAA, 0x8494, 0x8EAB, 0x8F9E, 0x8EAC, 0x6C50, 0x8EAD, 0x9E7F, - 0x8EAE, 0x5F0F, 0x8EAF, 0x8B58, 0x8EB0, 0x9D2B, 0x8EB1, 0x7AFA, - 0x8EB2, 0x8EF8, 0x8EB3, 0x5B8D, 0x8EB4, 0x96EB, 0x8EB5, 0x4E03, - 0x8EB6, 0x53F1, 0x8EB7, 0x57F7, 0x8EB8, 0x5931, 0x8EB9, 0x5AC9, - 0x8EBA, 0x5BA4, 0x8EBB, 0x6089, 0x8EBC, 0x6E7F, 0x8EBD, 0x6F06, - 0x8EBE, 0x75BE, 0x8EBF, 0x8CEA, 0x8EC0, 0x5B9F, 0x8EC1, 0x8500, - 0x8EC2, 0x7BE0, 0x8EC3, 0x5072, 0x8EC4, 0x67F4, 0x8EC5, 0x829D, - 0x8EC6, 0x5C61, 0x8EC7, 0x854A, 0x8EC8, 0x7E1E, 0x8EC9, 0x820E, - 0x8ECA, 0x5199, 0x8ECB, 0x5C04, 0x8ECC, 0x6368, 0x8ECD, 0x8D66, - 0x8ECE, 0x659C, 0x8ECF, 0x716E, 0x8ED0, 0x793E, 0x8ED1, 0x7D17, - 0x8ED2, 0x8005, 0x8ED3, 0x8B1D, 0x8ED4, 0x8ECA, 0x8ED5, 0x906E, - 0x8ED6, 0x86C7, 0x8ED7, 0x90AA, 0x8ED8, 0x501F, 0x8ED9, 0x52FA, - 0x8EDA, 0x5C3A, 0x8EDB, 0x6753, 0x8EDC, 0x707C, 0x8EDD, 0x7235, - 0x8EDE, 0x914C, 0x8EDF, 0x91C8, 0x8EE0, 0x932B, 0x8EE1, 0x82E5, - 0x8EE2, 0x5BC2, 0x8EE3, 0x5F31, 0x8EE4, 0x60F9, 0x8EE5, 0x4E3B, - 0x8EE6, 0x53D6, 0x8EE7, 0x5B88, 0x8EE8, 0x624B, 0x8EE9, 0x6731, - 0x8EEA, 0x6B8A, 0x8EEB, 0x72E9, 0x8EEC, 0x73E0, 0x8EED, 0x7A2E, - 0x8EEE, 0x816B, 0x8EEF, 0x8DA3, 0x8EF0, 0x9152, 0x8EF1, 0x9996, - 0x8EF2, 0x5112, 0x8EF3, 0x53D7, 0x8EF4, 0x546A, 0x8EF5, 0x5BFF, - 0x8EF6, 0x6388, 0x8EF7, 0x6A39, 0x8EF8, 0x7DAC, 0x8EF9, 0x9700, - 0x8EFA, 0x56DA, 0x8EFB, 0x53CE, 0x8EFC, 0x5468, 0x8F40, 0x5B97, - 0x8F41, 0x5C31, 0x8F42, 0x5DDE, 0x8F43, 0x4FEE, 0x8F44, 0x6101, - 0x8F45, 0x62FE, 0x8F46, 0x6D32, 0x8F47, 0x79C0, 0x8F48, 0x79CB, - 0x8F49, 0x7D42, 0x8F4A, 0x7E4D, 0x8F4B, 0x7FD2, 0x8F4C, 0x81ED, - 0x8F4D, 0x821F, 0x8F4E, 0x8490, 0x8F4F, 0x8846, 0x8F50, 0x8972, - 0x8F51, 0x8B90, 0x8F52, 0x8E74, 0x8F53, 0x8F2F, 0x8F54, 0x9031, - 0x8F55, 0x914B, 0x8F56, 0x916C, 0x8F57, 0x96C6, 0x8F58, 0x919C, - 0x8F59, 0x4EC0, 0x8F5A, 0x4F4F, 0x8F5B, 0x5145, 0x8F5C, 0x5341, - 0x8F5D, 0x5F93, 0x8F5E, 0x620E, 0x8F5F, 0x67D4, 0x8F60, 0x6C41, - 0x8F61, 0x6E0B, 0x8F62, 0x7363, 0x8F63, 0x7E26, 0x8F64, 0x91CD, - 0x8F65, 0x9283, 0x8F66, 0x53D4, 0x8F67, 0x5919, 0x8F68, 0x5BBF, - 0x8F69, 0x6DD1, 0x8F6A, 0x795D, 0x8F6B, 0x7E2E, 0x8F6C, 0x7C9B, - 0x8F6D, 0x587E, 0x8F6E, 0x719F, 0x8F6F, 0x51FA, 0x8F70, 0x8853, - 0x8F71, 0x8FF0, 0x8F72, 0x4FCA, 0x8F73, 0x5CFB, 0x8F74, 0x6625, - 0x8F75, 0x77AC, 0x8F76, 0x7AE3, 0x8F77, 0x821C, 0x8F78, 0x99FF, - 0x8F79, 0x51C6, 0x8F7A, 0x5FAA, 0x8F7B, 0x65EC, 0x8F7C, 0x696F, - 0x8F7D, 0x6B89, 0x8F7E, 0x6DF3, 0x8F80, 0x6E96, 0x8F81, 0x6F64, - 0x8F82, 0x76FE, 0x8F83, 0x7D14, 0x8F84, 0x5DE1, 0x8F85, 0x9075, - 0x8F86, 0x9187, 0x8F87, 0x9806, 0x8F88, 0x51E6, 0x8F89, 0x521D, - 0x8F8A, 0x6240, 0x8F8B, 0x6691, 0x8F8C, 0x66D9, 0x8F8D, 0x6E1A, - 0x8F8E, 0x5EB6, 0x8F8F, 0x7DD2, 0x8F90, 0x7F72, 0x8F91, 0x66F8, - 0x8F92, 0x85AF, 0x8F93, 0x85F7, 0x8F94, 0x8AF8, 0x8F95, 0x52A9, - 0x8F96, 0x53D9, 0x8F97, 0x5973, 0x8F98, 0x5E8F, 0x8F99, 0x5F90, - 0x8F9A, 0x6055, 0x8F9B, 0x92E4, 0x8F9C, 0x9664, 0x8F9D, 0x50B7, - 0x8F9E, 0x511F, 0x8F9F, 0x52DD, 0x8FA0, 0x5320, 0x8FA1, 0x5347, - 0x8FA2, 0x53EC, 0x8FA3, 0x54E8, 0x8FA4, 0x5546, 0x8FA5, 0x5531, - 0x8FA6, 0x5617, 0x8FA7, 0x5968, 0x8FA8, 0x59BE, 0x8FA9, 0x5A3C, - 0x8FAA, 0x5BB5, 0x8FAB, 0x5C06, 0x8FAC, 0x5C0F, 0x8FAD, 0x5C11, - 0x8FAE, 0x5C1A, 0x8FAF, 0x5E84, 0x8FB0, 0x5E8A, 0x8FB1, 0x5EE0, - 0x8FB2, 0x5F70, 0x8FB3, 0x627F, 0x8FB4, 0x6284, 0x8FB5, 0x62DB, - 0x8FB6, 0x638C, 0x8FB7, 0x6377, 0x8FB8, 0x6607, 0x8FB9, 0x660C, - 0x8FBA, 0x662D, 0x8FBB, 0x6676, 0x8FBC, 0x677E, 0x8FBD, 0x68A2, - 0x8FBE, 0x6A1F, 0x8FBF, 0x6A35, 0x8FC0, 0x6CBC, 0x8FC1, 0x6D88, - 0x8FC2, 0x6E09, 0x8FC3, 0x6E58, 0x8FC4, 0x713C, 0x8FC5, 0x7126, - 0x8FC6, 0x7167, 0x8FC7, 0x75C7, 0x8FC8, 0x7701, 0x8FC9, 0x785D, - 0x8FCA, 0x7901, 0x8FCB, 0x7965, 0x8FCC, 0x79F0, 0x8FCD, 0x7AE0, - 0x8FCE, 0x7B11, 0x8FCF, 0x7CA7, 0x8FD0, 0x7D39, 0x8FD1, 0x8096, - 0x8FD2, 0x83D6, 0x8FD3, 0x848B, 0x8FD4, 0x8549, 0x8FD5, 0x885D, - 0x8FD6, 0x88F3, 0x8FD7, 0x8A1F, 0x8FD8, 0x8A3C, 0x8FD9, 0x8A54, - 0x8FDA, 0x8A73, 0x8FDB, 0x8C61, 0x8FDC, 0x8CDE, 0x8FDD, 0x91A4, - 0x8FDE, 0x9266, 0x8FDF, 0x937E, 0x8FE0, 0x9418, 0x8FE1, 0x969C, - 0x8FE2, 0x9798, 0x8FE3, 0x4E0A, 0x8FE4, 0x4E08, 0x8FE5, 0x4E1E, - 0x8FE6, 0x4E57, 0x8FE7, 0x5197, 0x8FE8, 0x5270, 0x8FE9, 0x57CE, - 0x8FEA, 0x5834, 0x8FEB, 0x58CC, 0x8FEC, 0x5B22, 0x8FED, 0x5E38, - 0x8FEE, 0x60C5, 0x8FEF, 0x64FE, 0x8FF0, 0x6761, 0x8FF1, 0x6756, - 0x8FF2, 0x6D44, 0x8FF3, 0x72B6, 0x8FF4, 0x7573, 0x8FF5, 0x7A63, - 0x8FF6, 0x84B8, 0x8FF7, 0x8B72, 0x8FF8, 0x91B8, 0x8FF9, 0x9320, - 0x8FFA, 0x5631, 0x8FFB, 0x57F4, 0x8FFC, 0x98FE, 0x9040, 0x62ED, - 0x9041, 0x690D, 0x9042, 0x6B96, 0x9043, 0x71ED, 0x9044, 0x7E54, - 0x9045, 0x8077, 0x9046, 0x8272, 0x9047, 0x89E6, 0x9048, 0x98DF, - 0x9049, 0x8755, 0x904A, 0x8FB1, 0x904B, 0x5C3B, 0x904C, 0x4F38, - 0x904D, 0x4FE1, 0x904E, 0x4FB5, 0x904F, 0x5507, 0x9050, 0x5A20, - 0x9051, 0x5BDD, 0x9052, 0x5BE9, 0x9053, 0x5FC3, 0x9054, 0x614E, - 0x9055, 0x632F, 0x9056, 0x65B0, 0x9057, 0x664B, 0x9058, 0x68EE, - 0x9059, 0x699B, 0x905A, 0x6D78, 0x905B, 0x6DF1, 0x905C, 0x7533, - 0x905D, 0x75B9, 0x905E, 0x771F, 0x905F, 0x795E, 0x9060, 0x79E6, - 0x9061, 0x7D33, 0x9062, 0x81E3, 0x9063, 0x82AF, 0x9064, 0x85AA, - 0x9065, 0x89AA, 0x9066, 0x8A3A, 0x9067, 0x8EAB, 0x9068, 0x8F9B, - 0x9069, 0x9032, 0x906A, 0x91DD, 0x906B, 0x9707, 0x906C, 0x4EBA, - 0x906D, 0x4EC1, 0x906E, 0x5203, 0x906F, 0x5875, 0x9070, 0x58EC, - 0x9071, 0x5C0B, 0x9072, 0x751A, 0x9073, 0x5C3D, 0x9074, 0x814E, - 0x9075, 0x8A0A, 0x9076, 0x8FC5, 0x9077, 0x9663, 0x9078, 0x976D, - 0x9079, 0x7B25, 0x907A, 0x8ACF, 0x907B, 0x9808, 0x907C, 0x9162, - 0x907D, 0x56F3, 0x907E, 0x53A8, 0x9080, 0x9017, 0x9081, 0x5439, - 0x9082, 0x5782, 0x9083, 0x5E25, 0x9084, 0x63A8, 0x9085, 0x6C34, - 0x9086, 0x708A, 0x9087, 0x7761, 0x9088, 0x7C8B, 0x9089, 0x7FE0, - 0x908A, 0x8870, 0x908B, 0x9042, 0x908C, 0x9154, 0x908D, 0x9310, - 0x908E, 0x9318, 0x908F, 0x968F, 0x9090, 0x745E, 0x9091, 0x9AC4, - 0x9092, 0x5D07, 0x9093, 0x5D69, 0x9094, 0x6570, 0x9095, 0x67A2, - 0x9096, 0x8DA8, 0x9097, 0x96DB, 0x9098, 0x636E, 0x9099, 0x6749, - 0x909A, 0x6919, 0x909B, 0x83C5, 0x909C, 0x9817, 0x909D, 0x96C0, - 0x909E, 0x88FE, 0x909F, 0x6F84, 0x90A0, 0x647A, 0x90A1, 0x5BF8, - 0x90A2, 0x4E16, 0x90A3, 0x702C, 0x90A4, 0x755D, 0x90A5, 0x662F, - 0x90A6, 0x51C4, 0x90A7, 0x5236, 0x90A8, 0x52E2, 0x90A9, 0x59D3, - 0x90AA, 0x5F81, 0x90AB, 0x6027, 0x90AC, 0x6210, 0x90AD, 0x653F, - 0x90AE, 0x6574, 0x90AF, 0x661F, 0x90B0, 0x6674, 0x90B1, 0x68F2, - 0x90B2, 0x6816, 0x90B3, 0x6B63, 0x90B4, 0x6E05, 0x90B5, 0x7272, - 0x90B6, 0x751F, 0x90B7, 0x76DB, 0x90B8, 0x7CBE, 0x90B9, 0x8056, - 0x90BA, 0x58F0, 0x90BB, 0x88FD, 0x90BC, 0x897F, 0x90BD, 0x8AA0, - 0x90BE, 0x8A93, 0x90BF, 0x8ACB, 0x90C0, 0x901D, 0x90C1, 0x9192, - 0x90C2, 0x9752, 0x90C3, 0x9759, 0x90C4, 0x6589, 0x90C5, 0x7A0E, - 0x90C6, 0x8106, 0x90C7, 0x96BB, 0x90C8, 0x5E2D, 0x90C9, 0x60DC, - 0x90CA, 0x621A, 0x90CB, 0x65A5, 0x90CC, 0x6614, 0x90CD, 0x6790, - 0x90CE, 0x77F3, 0x90CF, 0x7A4D, 0x90D0, 0x7C4D, 0x90D1, 0x7E3E, - 0x90D2, 0x810A, 0x90D3, 0x8CAC, 0x90D4, 0x8D64, 0x90D5, 0x8DE1, - 0x90D6, 0x8E5F, 0x90D7, 0x78A9, 0x90D8, 0x5207, 0x90D9, 0x62D9, - 0x90DA, 0x63A5, 0x90DB, 0x6442, 0x90DC, 0x6298, 0x90DD, 0x8A2D, - 0x90DE, 0x7A83, 0x90DF, 0x7BC0, 0x90E0, 0x8AAC, 0x90E1, 0x96EA, - 0x90E2, 0x7D76, 0x90E3, 0x820C, 0x90E4, 0x8749, 0x90E5, 0x4ED9, - 0x90E6, 0x5148, 0x90E7, 0x5343, 0x90E8, 0x5360, 0x90E9, 0x5BA3, - 0x90EA, 0x5C02, 0x90EB, 0x5C16, 0x90EC, 0x5DDD, 0x90ED, 0x6226, - 0x90EE, 0x6247, 0x90EF, 0x64B0, 0x90F0, 0x6813, 0x90F1, 0x6834, - 0x90F2, 0x6CC9, 0x90F3, 0x6D45, 0x90F4, 0x6D17, 0x90F5, 0x67D3, - 0x90F6, 0x6F5C, 0x90F7, 0x714E, 0x90F8, 0x717D, 0x90F9, 0x65CB, - 0x90FA, 0x7A7F, 0x90FB, 0x7BAD, 0x90FC, 0x7DDA, 0x9140, 0x7E4A, - 0x9141, 0x7FA8, 0x9142, 0x817A, 0x9143, 0x821B, 0x9144, 0x8239, - 0x9145, 0x85A6, 0x9146, 0x8A6E, 0x9147, 0x8CCE, 0x9148, 0x8DF5, - 0x9149, 0x9078, 0x914A, 0x9077, 0x914B, 0x92AD, 0x914C, 0x9291, - 0x914D, 0x9583, 0x914E, 0x9BAE, 0x914F, 0x524D, 0x9150, 0x5584, - 0x9151, 0x6F38, 0x9152, 0x7136, 0x9153, 0x5168, 0x9154, 0x7985, - 0x9155, 0x7E55, 0x9156, 0x81B3, 0x9157, 0x7CCE, 0x9158, 0x564C, - 0x9159, 0x5851, 0x915A, 0x5CA8, 0x915B, 0x63AA, 0x915C, 0x66FE, - 0x915D, 0x66FD, 0x915E, 0x695A, 0x915F, 0x72D9, 0x9160, 0x758F, - 0x9161, 0x758E, 0x9162, 0x790E, 0x9163, 0x7956, 0x9164, 0x79DF, - 0x9165, 0x7C97, 0x9166, 0x7D20, 0x9167, 0x7D44, 0x9168, 0x8607, - 0x9169, 0x8A34, 0x916A, 0x963B, 0x916B, 0x9061, 0x916C, 0x9F20, - 0x916D, 0x50E7, 0x916E, 0x5275, 0x916F, 0x53CC, 0x9170, 0x53E2, - 0x9171, 0x5009, 0x9172, 0x55AA, 0x9173, 0x58EE, 0x9174, 0x594F, - 0x9175, 0x723D, 0x9176, 0x5B8B, 0x9177, 0x5C64, 0x9178, 0x531D, - 0x9179, 0x60E3, 0x917A, 0x60F3, 0x917B, 0x635C, 0x917C, 0x6383, - 0x917D, 0x633F, 0x917E, 0x63BB, 0x9180, 0x64CD, 0x9181, 0x65E9, - 0x9182, 0x66F9, 0x9183, 0x5DE3, 0x9184, 0x69CD, 0x9185, 0x69FD, - 0x9186, 0x6F15, 0x9187, 0x71E5, 0x9188, 0x4E89, 0x9189, 0x75E9, - 0x918A, 0x76F8, 0x918B, 0x7A93, 0x918C, 0x7CDF, 0x918D, 0x7DCF, - 0x918E, 0x7D9C, 0x918F, 0x8061, 0x9190, 0x8349, 0x9191, 0x8358, - 0x9192, 0x846C, 0x9193, 0x84BC, 0x9194, 0x85FB, 0x9195, 0x88C5, - 0x9196, 0x8D70, 0x9197, 0x9001, 0x9198, 0x906D, 0x9199, 0x9397, - 0x919A, 0x971C, 0x919B, 0x9A12, 0x919C, 0x50CF, 0x919D, 0x5897, - 0x919E, 0x618E, 0x919F, 0x81D3, 0x91A0, 0x8535, 0x91A1, 0x8D08, - 0x91A2, 0x9020, 0x91A3, 0x4FC3, 0x91A4, 0x5074, 0x91A5, 0x5247, - 0x91A6, 0x5373, 0x91A7, 0x606F, 0x91A8, 0x6349, 0x91A9, 0x675F, - 0x91AA, 0x6E2C, 0x91AB, 0x8DB3, 0x91AC, 0x901F, 0x91AD, 0x4FD7, - 0x91AE, 0x5C5E, 0x91AF, 0x8CCA, 0x91B0, 0x65CF, 0x91B1, 0x7D9A, - 0x91B2, 0x5352, 0x91B3, 0x8896, 0x91B4, 0x5176, 0x91B5, 0x63C3, - 0x91B6, 0x5B58, 0x91B7, 0x5B6B, 0x91B8, 0x5C0A, 0x91B9, 0x640D, - 0x91BA, 0x6751, 0x91BB, 0x905C, 0x91BC, 0x4ED6, 0x91BD, 0x591A, - 0x91BE, 0x592A, 0x91BF, 0x6C70, 0x91C0, 0x8A51, 0x91C1, 0x553E, - 0x91C2, 0x5815, 0x91C3, 0x59A5, 0x91C4, 0x60F0, 0x91C5, 0x6253, - 0x91C6, 0x67C1, 0x91C7, 0x8235, 0x91C8, 0x6955, 0x91C9, 0x9640, - 0x91CA, 0x99C4, 0x91CB, 0x9A28, 0x91CC, 0x4F53, 0x91CD, 0x5806, - 0x91CE, 0x5BFE, 0x91CF, 0x8010, 0x91D0, 0x5CB1, 0x91D1, 0x5E2F, - 0x91D2, 0x5F85, 0x91D3, 0x6020, 0x91D4, 0x614B, 0x91D5, 0x6234, - 0x91D6, 0x66FF, 0x91D7, 0x6CF0, 0x91D8, 0x6EDE, 0x91D9, 0x80CE, - 0x91DA, 0x817F, 0x91DB, 0x82D4, 0x91DC, 0x888B, 0x91DD, 0x8CB8, - 0x91DE, 0x9000, 0x91DF, 0x902E, 0x91E0, 0x968A, 0x91E1, 0x9EDB, - 0x91E2, 0x9BDB, 0x91E3, 0x4EE3, 0x91E4, 0x53F0, 0x91E5, 0x5927, - 0x91E6, 0x7B2C, 0x91E7, 0x918D, 0x91E8, 0x984C, 0x91E9, 0x9DF9, - 0x91EA, 0x6EDD, 0x91EB, 0x7027, 0x91EC, 0x5353, 0x91ED, 0x5544, - 0x91EE, 0x5B85, 0x91EF, 0x6258, 0x91F0, 0x629E, 0x91F1, 0x62D3, - 0x91F2, 0x6CA2, 0x91F3, 0x6FEF, 0x91F4, 0x7422, 0x91F5, 0x8A17, - 0x91F6, 0x9438, 0x91F7, 0x6FC1, 0x91F8, 0x8AFE, 0x91F9, 0x8338, - 0x91FA, 0x51E7, 0x91FB, 0x86F8, 0x91FC, 0x53EA, 0x9240, 0x53E9, - 0x9241, 0x4F46, 0x9242, 0x9054, 0x9243, 0x8FB0, 0x9244, 0x596A, - 0x9245, 0x8131, 0x9246, 0x5DFD, 0x9247, 0x7AEA, 0x9248, 0x8FBF, - 0x9249, 0x68DA, 0x924A, 0x8C37, 0x924B, 0x72F8, 0x924C, 0x9C48, - 0x924D, 0x6A3D, 0x924E, 0x8AB0, 0x924F, 0x4E39, 0x9250, 0x5358, - 0x9251, 0x5606, 0x9252, 0x5766, 0x9253, 0x62C5, 0x9254, 0x63A2, - 0x9255, 0x65E6, 0x9256, 0x6B4E, 0x9257, 0x6DE1, 0x9258, 0x6E5B, - 0x9259, 0x70AD, 0x925A, 0x77ED, 0x925B, 0x7AEF, 0x925C, 0x7BAA, - 0x925D, 0x7DBB, 0x925E, 0x803D, 0x925F, 0x80C6, 0x9260, 0x86CB, - 0x9261, 0x8A95, 0x9262, 0x935B, 0x9263, 0x56E3, 0x9264, 0x58C7, - 0x9265, 0x5F3E, 0x9266, 0x65AD, 0x9267, 0x6696, 0x9268, 0x6A80, - 0x9269, 0x6BB5, 0x926A, 0x7537, 0x926B, 0x8AC7, 0x926C, 0x5024, - 0x926D, 0x77E5, 0x926E, 0x5730, 0x926F, 0x5F1B, 0x9270, 0x6065, - 0x9271, 0x667A, 0x9272, 0x6C60, 0x9273, 0x75F4, 0x9274, 0x7A1A, - 0x9275, 0x7F6E, 0x9276, 0x81F4, 0x9277, 0x8718, 0x9278, 0x9045, - 0x9279, 0x99B3, 0x927A, 0x7BC9, 0x927B, 0x755C, 0x927C, 0x7AF9, - 0x927D, 0x7B51, 0x927E, 0x84C4, 0x9280, 0x9010, 0x9281, 0x79E9, - 0x9282, 0x7A92, 0x9283, 0x8336, 0x9284, 0x5AE1, 0x9285, 0x7740, - 0x9286, 0x4E2D, 0x9287, 0x4EF2, 0x9288, 0x5B99, 0x9289, 0x5FE0, - 0x928A, 0x62BD, 0x928B, 0x663C, 0x928C, 0x67F1, 0x928D, 0x6CE8, - 0x928E, 0x866B, 0x928F, 0x8877, 0x9290, 0x8A3B, 0x9291, 0x914E, - 0x9292, 0x92F3, 0x9293, 0x99D0, 0x9294, 0x6A17, 0x9295, 0x7026, - 0x9296, 0x732A, 0x9297, 0x82E7, 0x9298, 0x8457, 0x9299, 0x8CAF, - 0x929A, 0x4E01, 0x929B, 0x5146, 0x929C, 0x51CB, 0x929D, 0x558B, - 0x929E, 0x5BF5, 0x929F, 0x5E16, 0x92A0, 0x5E33, 0x92A1, 0x5E81, - 0x92A2, 0x5F14, 0x92A3, 0x5F35, 0x92A4, 0x5F6B, 0x92A5, 0x5FB4, - 0x92A6, 0x61F2, 0x92A7, 0x6311, 0x92A8, 0x66A2, 0x92A9, 0x671D, - 0x92AA, 0x6F6E, 0x92AB, 0x7252, 0x92AC, 0x753A, 0x92AD, 0x773A, - 0x92AE, 0x8074, 0x92AF, 0x8139, 0x92B0, 0x8178, 0x92B1, 0x8776, - 0x92B2, 0x8ABF, 0x92B3, 0x8ADC, 0x92B4, 0x8D85, 0x92B5, 0x8DF3, - 0x92B6, 0x929A, 0x92B7, 0x9577, 0x92B8, 0x9802, 0x92B9, 0x9CE5, - 0x92BA, 0x52C5, 0x92BB, 0x6357, 0x92BC, 0x76F4, 0x92BD, 0x6715, - 0x92BE, 0x6C88, 0x92BF, 0x73CD, 0x92C0, 0x8CC3, 0x92C1, 0x93AE, - 0x92C2, 0x9673, 0x92C3, 0x6D25, 0x92C4, 0x589C, 0x92C5, 0x690E, - 0x92C6, 0x69CC, 0x92C7, 0x8FFD, 0x92C8, 0x939A, 0x92C9, 0x75DB, - 0x92CA, 0x901A, 0x92CB, 0x585A, 0x92CC, 0x6802, 0x92CD, 0x63B4, - 0x92CE, 0x69FB, 0x92CF, 0x4F43, 0x92D0, 0x6F2C, 0x92D1, 0x67D8, - 0x92D2, 0x8FBB, 0x92D3, 0x8526, 0x92D4, 0x7DB4, 0x92D5, 0x9354, - 0x92D6, 0x693F, 0x92D7, 0x6F70, 0x92D8, 0x576A, 0x92D9, 0x58F7, - 0x92DA, 0x5B2C, 0x92DB, 0x7D2C, 0x92DC, 0x722A, 0x92DD, 0x540A, - 0x92DE, 0x91E3, 0x92DF, 0x9DB4, 0x92E0, 0x4EAD, 0x92E1, 0x4F4E, - 0x92E2, 0x505C, 0x92E3, 0x5075, 0x92E4, 0x5243, 0x92E5, 0x8C9E, - 0x92E6, 0x5448, 0x92E7, 0x5824, 0x92E8, 0x5B9A, 0x92E9, 0x5E1D, - 0x92EA, 0x5E95, 0x92EB, 0x5EAD, 0x92EC, 0x5EF7, 0x92ED, 0x5F1F, - 0x92EE, 0x608C, 0x92EF, 0x62B5, 0x92F0, 0x633A, 0x92F1, 0x63D0, - 0x92F2, 0x68AF, 0x92F3, 0x6C40, 0x92F4, 0x7887, 0x92F5, 0x798E, - 0x92F6, 0x7A0B, 0x92F7, 0x7DE0, 0x92F8, 0x8247, 0x92F9, 0x8A02, - 0x92FA, 0x8AE6, 0x92FB, 0x8E44, 0x92FC, 0x9013, 0x9340, 0x90B8, - 0x9341, 0x912D, 0x9342, 0x91D8, 0x9343, 0x9F0E, 0x9344, 0x6CE5, - 0x9345, 0x6458, 0x9346, 0x64E2, 0x9347, 0x6575, 0x9348, 0x6EF4, - 0x9349, 0x7684, 0x934A, 0x7B1B, 0x934B, 0x9069, 0x934C, 0x93D1, - 0x934D, 0x6EBA, 0x934E, 0x54F2, 0x934F, 0x5FB9, 0x9350, 0x64A4, - 0x9351, 0x8F4D, 0x9352, 0x8FED, 0x9353, 0x9244, 0x9354, 0x5178, - 0x9355, 0x586B, 0x9356, 0x5929, 0x9357, 0x5C55, 0x9358, 0x5E97, - 0x9359, 0x6DFB, 0x935A, 0x7E8F, 0x935B, 0x751C, 0x935C, 0x8CBC, - 0x935D, 0x8EE2, 0x935E, 0x985B, 0x935F, 0x70B9, 0x9360, 0x4F1D, - 0x9361, 0x6BBF, 0x9362, 0x6FB1, 0x9363, 0x7530, 0x9364, 0x96FB, - 0x9365, 0x514E, 0x9366, 0x5410, 0x9367, 0x5835, 0x9368, 0x5857, - 0x9369, 0x59AC, 0x936A, 0x5C60, 0x936B, 0x5F92, 0x936C, 0x6597, - 0x936D, 0x675C, 0x936E, 0x6E21, 0x936F, 0x767B, 0x9370, 0x83DF, - 0x9371, 0x8CED, 0x9372, 0x9014, 0x9373, 0x90FD, 0x9374, 0x934D, - 0x9375, 0x7825, 0x9376, 0x783A, 0x9377, 0x52AA, 0x9378, 0x5EA6, - 0x9379, 0x571F, 0x937A, 0x5974, 0x937B, 0x6012, 0x937C, 0x5012, - 0x937D, 0x515A, 0x937E, 0x51AC, 0x9380, 0x51CD, 0x9381, 0x5200, - 0x9382, 0x5510, 0x9383, 0x5854, 0x9384, 0x5858, 0x9385, 0x5957, - 0x9386, 0x5B95, 0x9387, 0x5CF6, 0x9388, 0x5D8B, 0x9389, 0x60BC, - 0x938A, 0x6295, 0x938B, 0x642D, 0x938C, 0x6771, 0x938D, 0x6843, - 0x938E, 0x68BC, 0x938F, 0x68DF, 0x9390, 0x76D7, 0x9391, 0x6DD8, - 0x9392, 0x6E6F, 0x9393, 0x6D9B, 0x9394, 0x706F, 0x9395, 0x71C8, - 0x9396, 0x5F53, 0x9397, 0x75D8, 0x9398, 0x7977, 0x9399, 0x7B49, - 0x939A, 0x7B54, 0x939B, 0x7B52, 0x939C, 0x7CD6, 0x939D, 0x7D71, - 0x939E, 0x5230, 0x939F, 0x8463, 0x93A0, 0x8569, 0x93A1, 0x85E4, - 0x93A2, 0x8A0E, 0x93A3, 0x8B04, 0x93A4, 0x8C46, 0x93A5, 0x8E0F, - 0x93A6, 0x9003, 0x93A7, 0x900F, 0x93A8, 0x9419, 0x93A9, 0x9676, - 0x93AA, 0x982D, 0x93AB, 0x9A30, 0x93AC, 0x95D8, 0x93AD, 0x50CD, - 0x93AE, 0x52D5, 0x93AF, 0x540C, 0x93B0, 0x5802, 0x93B1, 0x5C0E, - 0x93B2, 0x61A7, 0x93B3, 0x649E, 0x93B4, 0x6D1E, 0x93B5, 0x77B3, - 0x93B6, 0x7AE5, 0x93B7, 0x80F4, 0x93B8, 0x8404, 0x93B9, 0x9053, - 0x93BA, 0x9285, 0x93BB, 0x5CE0, 0x93BC, 0x9D07, 0x93BD, 0x533F, - 0x93BE, 0x5F97, 0x93BF, 0x5FB3, 0x93C0, 0x6D9C, 0x93C1, 0x7279, - 0x93C2, 0x7763, 0x93C3, 0x79BF, 0x93C4, 0x7BE4, 0x93C5, 0x6BD2, - 0x93C6, 0x72EC, 0x93C7, 0x8AAD, 0x93C8, 0x6803, 0x93C9, 0x6A61, - 0x93CA, 0x51F8, 0x93CB, 0x7A81, 0x93CC, 0x6934, 0x93CD, 0x5C4A, - 0x93CE, 0x9CF6, 0x93CF, 0x82EB, 0x93D0, 0x5BC5, 0x93D1, 0x9149, - 0x93D2, 0x701E, 0x93D3, 0x5678, 0x93D4, 0x5C6F, 0x93D5, 0x60C7, - 0x93D6, 0x6566, 0x93D7, 0x6C8C, 0x93D8, 0x8C5A, 0x93D9, 0x9041, - 0x93DA, 0x9813, 0x93DB, 0x5451, 0x93DC, 0x66C7, 0x93DD, 0x920D, - 0x93DE, 0x5948, 0x93DF, 0x90A3, 0x93E0, 0x5185, 0x93E1, 0x4E4D, - 0x93E2, 0x51EA, 0x93E3, 0x8599, 0x93E4, 0x8B0E, 0x93E5, 0x7058, - 0x93E6, 0x637A, 0x93E7, 0x934B, 0x93E8, 0x6962, 0x93E9, 0x99B4, - 0x93EA, 0x7E04, 0x93EB, 0x7577, 0x93EC, 0x5357, 0x93ED, 0x6960, - 0x93EE, 0x8EDF, 0x93EF, 0x96E3, 0x93F0, 0x6C5D, 0x93F1, 0x4E8C, - 0x93F2, 0x5C3C, 0x93F3, 0x5F10, 0x93F4, 0x8FE9, 0x93F5, 0x5302, - 0x93F6, 0x8CD1, 0x93F7, 0x8089, 0x93F8, 0x8679, 0x93F9, 0x5EFF, - 0x93FA, 0x65E5, 0x93FB, 0x4E73, 0x93FC, 0x5165, 0x9440, 0x5982, - 0x9441, 0x5C3F, 0x9442, 0x97EE, 0x9443, 0x4EFB, 0x9444, 0x598A, - 0x9445, 0x5FCD, 0x9446, 0x8A8D, 0x9447, 0x6FE1, 0x9448, 0x79B0, - 0x9449, 0x7962, 0x944A, 0x5BE7, 0x944B, 0x8471, 0x944C, 0x732B, - 0x944D, 0x71B1, 0x944E, 0x5E74, 0x944F, 0x5FF5, 0x9450, 0x637B, - 0x9451, 0x649A, 0x9452, 0x71C3, 0x9453, 0x7C98, 0x9454, 0x4E43, - 0x9455, 0x5EFC, 0x9456, 0x4E4B, 0x9457, 0x57DC, 0x9458, 0x56A2, - 0x9459, 0x60A9, 0x945A, 0x6FC3, 0x945B, 0x7D0D, 0x945C, 0x80FD, - 0x945D, 0x8133, 0x945E, 0x81BF, 0x945F, 0x8FB2, 0x9460, 0x8997, - 0x9461, 0x86A4, 0x9462, 0x5DF4, 0x9463, 0x628A, 0x9464, 0x64AD, - 0x9465, 0x8987, 0x9466, 0x6777, 0x9467, 0x6CE2, 0x9468, 0x6D3E, - 0x9469, 0x7436, 0x946A, 0x7834, 0x946B, 0x5A46, 0x946C, 0x7F75, - 0x946D, 0x82AD, 0x946E, 0x99AC, 0x946F, 0x4FF3, 0x9470, 0x5EC3, - 0x9471, 0x62DD, 0x9472, 0x6392, 0x9473, 0x6557, 0x9474, 0x676F, - 0x9475, 0x76C3, 0x9476, 0x724C, 0x9477, 0x80CC, 0x9478, 0x80BA, - 0x9479, 0x8F29, 0x947A, 0x914D, 0x947B, 0x500D, 0x947C, 0x57F9, - 0x947D, 0x5A92, 0x947E, 0x6885, 0x9480, 0x6973, 0x9481, 0x7164, - 0x9482, 0x72FD, 0x9483, 0x8CB7, 0x9484, 0x58F2, 0x9485, 0x8CE0, - 0x9486, 0x966A, 0x9487, 0x9019, 0x9488, 0x877F, 0x9489, 0x79E4, - 0x948A, 0x77E7, 0x948B, 0x8429, 0x948C, 0x4F2F, 0x948D, 0x5265, - 0x948E, 0x535A, 0x948F, 0x62CD, 0x9490, 0x67CF, 0x9491, 0x6CCA, - 0x9492, 0x767D, 0x9493, 0x7B94, 0x9494, 0x7C95, 0x9495, 0x8236, - 0x9496, 0x8584, 0x9497, 0x8FEB, 0x9498, 0x66DD, 0x9499, 0x6F20, - 0x949A, 0x7206, 0x949B, 0x7E1B, 0x949C, 0x83AB, 0x949D, 0x99C1, - 0x949E, 0x9EA6, 0x949F, 0x51FD, 0x94A0, 0x7BB1, 0x94A1, 0x7872, - 0x94A2, 0x7BB8, 0x94A3, 0x8087, 0x94A4, 0x7B48, 0x94A5, 0x6AE8, - 0x94A6, 0x5E61, 0x94A7, 0x808C, 0x94A8, 0x7551, 0x94A9, 0x7560, - 0x94AA, 0x516B, 0x94AB, 0x9262, 0x94AC, 0x6E8C, 0x94AD, 0x767A, - 0x94AE, 0x9197, 0x94AF, 0x9AEA, 0x94B0, 0x4F10, 0x94B1, 0x7F70, - 0x94B2, 0x629C, 0x94B3, 0x7B4F, 0x94B4, 0x95A5, 0x94B5, 0x9CE9, - 0x94B6, 0x567A, 0x94B7, 0x5859, 0x94B8, 0x86E4, 0x94B9, 0x96BC, - 0x94BA, 0x4F34, 0x94BB, 0x5224, 0x94BC, 0x534A, 0x94BD, 0x53CD, - 0x94BE, 0x53DB, 0x94BF, 0x5E06, 0x94C0, 0x642C, 0x94C1, 0x6591, - 0x94C2, 0x677F, 0x94C3, 0x6C3E, 0x94C4, 0x6C4E, 0x94C5, 0x7248, - 0x94C6, 0x72AF, 0x94C7, 0x73ED, 0x94C8, 0x7554, 0x94C9, 0x7E41, - 0x94CA, 0x822C, 0x94CB, 0x85E9, 0x94CC, 0x8CA9, 0x94CD, 0x7BC4, - 0x94CE, 0x91C6, 0x94CF, 0x7169, 0x94D0, 0x9812, 0x94D1, 0x98EF, - 0x94D2, 0x633D, 0x94D3, 0x6669, 0x94D4, 0x756A, 0x94D5, 0x76E4, - 0x94D6, 0x78D0, 0x94D7, 0x8543, 0x94D8, 0x86EE, 0x94D9, 0x532A, - 0x94DA, 0x5351, 0x94DB, 0x5426, 0x94DC, 0x5983, 0x94DD, 0x5E87, - 0x94DE, 0x5F7C, 0x94DF, 0x60B2, 0x94E0, 0x6249, 0x94E1, 0x6279, - 0x94E2, 0x62AB, 0x94E3, 0x6590, 0x94E4, 0x6BD4, 0x94E5, 0x6CCC, - 0x94E6, 0x75B2, 0x94E7, 0x76AE, 0x94E8, 0x7891, 0x94E9, 0x79D8, - 0x94EA, 0x7DCB, 0x94EB, 0x7F77, 0x94EC, 0x80A5, 0x94ED, 0x88AB, - 0x94EE, 0x8AB9, 0x94EF, 0x8CBB, 0x94F0, 0x907F, 0x94F1, 0x975E, - 0x94F2, 0x98DB, 0x94F3, 0x6A0B, 0x94F4, 0x7C38, 0x94F5, 0x5099, - 0x94F6, 0x5C3E, 0x94F7, 0x5FAE, 0x94F8, 0x6787, 0x94F9, 0x6BD8, - 0x94FA, 0x7435, 0x94FB, 0x7709, 0x94FC, 0x7F8E, 0x9540, 0x9F3B, - 0x9541, 0x67CA, 0x9542, 0x7A17, 0x9543, 0x5339, 0x9544, 0x758B, - 0x9545, 0x9AED, 0x9546, 0x5F66, 0x9547, 0x819D, 0x9548, 0x83F1, - 0x9549, 0x8098, 0x954A, 0x5F3C, 0x954B, 0x5FC5, 0x954C, 0x7562, - 0x954D, 0x7B46, 0x954E, 0x903C, 0x954F, 0x6867, 0x9550, 0x59EB, - 0x9551, 0x5A9B, 0x9552, 0x7D10, 0x9553, 0x767E, 0x9554, 0x8B2C, - 0x9555, 0x4FF5, 0x9556, 0x5F6A, 0x9557, 0x6A19, 0x9558, 0x6C37, - 0x9559, 0x6F02, 0x955A, 0x74E2, 0x955B, 0x7968, 0x955C, 0x8868, - 0x955D, 0x8A55, 0x955E, 0x8C79, 0x955F, 0x5EDF, 0x9560, 0x63CF, - 0x9561, 0x75C5, 0x9562, 0x79D2, 0x9563, 0x82D7, 0x9564, 0x9328, - 0x9565, 0x92F2, 0x9566, 0x849C, 0x9567, 0x86ED, 0x9568, 0x9C2D, - 0x9569, 0x54C1, 0x956A, 0x5F6C, 0x956B, 0x658C, 0x956C, 0x6D5C, - 0x956D, 0x7015, 0x956E, 0x8CA7, 0x956F, 0x8CD3, 0x9570, 0x983B, - 0x9571, 0x654F, 0x9572, 0x74F6, 0x9573, 0x4E0D, 0x9574, 0x4ED8, - 0x9575, 0x57E0, 0x9576, 0x592B, 0x9577, 0x5A66, 0x9578, 0x5BCC, - 0x9579, 0x51A8, 0x957A, 0x5E03, 0x957B, 0x5E9C, 0x957C, 0x6016, - 0x957D, 0x6276, 0x957E, 0x6577, 0x9580, 0x65A7, 0x9581, 0x666E, - 0x9582, 0x6D6E, 0x9583, 0x7236, 0x9584, 0x7B26, 0x9585, 0x8150, - 0x9586, 0x819A, 0x9587, 0x8299, 0x9588, 0x8B5C, 0x9589, 0x8CA0, - 0x958A, 0x8CE6, 0x958B, 0x8D74, 0x958C, 0x961C, 0x958D, 0x9644, - 0x958E, 0x4FAE, 0x958F, 0x64AB, 0x9590, 0x6B66, 0x9591, 0x821E, - 0x9592, 0x8461, 0x9593, 0x856A, 0x9594, 0x90E8, 0x9595, 0x5C01, - 0x9596, 0x6953, 0x9597, 0x98A8, 0x9598, 0x847A, 0x9599, 0x8557, - 0x959A, 0x4F0F, 0x959B, 0x526F, 0x959C, 0x5FA9, 0x959D, 0x5E45, - 0x959E, 0x670D, 0x959F, 0x798F, 0x95A0, 0x8179, 0x95A1, 0x8907, - 0x95A2, 0x8986, 0x95A3, 0x6DF5, 0x95A4, 0x5F17, 0x95A5, 0x6255, - 0x95A6, 0x6CB8, 0x95A7, 0x4ECF, 0x95A8, 0x7269, 0x95A9, 0x9B92, - 0x95AA, 0x5206, 0x95AB, 0x543B, 0x95AC, 0x5674, 0x95AD, 0x58B3, - 0x95AE, 0x61A4, 0x95AF, 0x626E, 0x95B0, 0x711A, 0x95B1, 0x596E, - 0x95B2, 0x7C89, 0x95B3, 0x7CDE, 0x95B4, 0x7D1B, 0x95B5, 0x96F0, - 0x95B6, 0x6587, 0x95B7, 0x805E, 0x95B8, 0x4E19, 0x95B9, 0x4F75, - 0x95BA, 0x5175, 0x95BB, 0x5840, 0x95BC, 0x5E63, 0x95BD, 0x5E73, - 0x95BE, 0x5F0A, 0x95BF, 0x67C4, 0x95C0, 0x4E26, 0x95C1, 0x853D, - 0x95C2, 0x9589, 0x95C3, 0x965B, 0x95C4, 0x7C73, 0x95C5, 0x9801, - 0x95C6, 0x50FB, 0x95C7, 0x58C1, 0x95C8, 0x7656, 0x95C9, 0x78A7, - 0x95CA, 0x5225, 0x95CB, 0x77A5, 0x95CC, 0x8511, 0x95CD, 0x7B86, - 0x95CE, 0x504F, 0x95CF, 0x5909, 0x95D0, 0x7247, 0x95D1, 0x7BC7, - 0x95D2, 0x7DE8, 0x95D3, 0x8FBA, 0x95D4, 0x8FD4, 0x95D5, 0x904D, - 0x95D6, 0x4FBF, 0x95D7, 0x52C9, 0x95D8, 0x5A29, 0x95D9, 0x5F01, - 0x95DA, 0x97AD, 0x95DB, 0x4FDD, 0x95DC, 0x8217, 0x95DD, 0x92EA, - 0x95DE, 0x5703, 0x95DF, 0x6355, 0x95E0, 0x6B69, 0x95E1, 0x752B, - 0x95E2, 0x88DC, 0x95E3, 0x8F14, 0x95E4, 0x7A42, 0x95E5, 0x52DF, - 0x95E6, 0x5893, 0x95E7, 0x6155, 0x95E8, 0x620A, 0x95E9, 0x66AE, - 0x95EA, 0x6BCD, 0x95EB, 0x7C3F, 0x95EC, 0x83E9, 0x95ED, 0x5023, - 0x95EE, 0x4FF8, 0x95EF, 0x5305, 0x95F0, 0x5446, 0x95F1, 0x5831, - 0x95F2, 0x5949, 0x95F3, 0x5B9D, 0x95F4, 0x5CF0, 0x95F5, 0x5CEF, - 0x95F6, 0x5D29, 0x95F7, 0x5E96, 0x95F8, 0x62B1, 0x95F9, 0x6367, - 0x95FA, 0x653E, 0x95FB, 0x65B9, 0x95FC, 0x670B, 0x9640, 0x6CD5, - 0x9641, 0x6CE1, 0x9642, 0x70F9, 0x9643, 0x7832, 0x9644, 0x7E2B, - 0x9645, 0x80DE, 0x9646, 0x82B3, 0x9647, 0x840C, 0x9648, 0x84EC, - 0x9649, 0x8702, 0x964A, 0x8912, 0x964B, 0x8A2A, 0x964C, 0x8C4A, - 0x964D, 0x90A6, 0x964E, 0x92D2, 0x964F, 0x98FD, 0x9650, 0x9CF3, - 0x9651, 0x9D6C, 0x9652, 0x4E4F, 0x9653, 0x4EA1, 0x9654, 0x508D, - 0x9655, 0x5256, 0x9656, 0x574A, 0x9657, 0x59A8, 0x9658, 0x5E3D, - 0x9659, 0x5FD8, 0x965A, 0x5FD9, 0x965B, 0x623F, 0x965C, 0x66B4, - 0x965D, 0x671B, 0x965E, 0x67D0, 0x965F, 0x68D2, 0x9660, 0x5192, - 0x9661, 0x7D21, 0x9662, 0x80AA, 0x9663, 0x81A8, 0x9664, 0x8B00, - 0x9665, 0x8C8C, 0x9666, 0x8CBF, 0x9667, 0x927E, 0x9668, 0x9632, - 0x9669, 0x5420, 0x966A, 0x982C, 0x966B, 0x5317, 0x966C, 0x50D5, - 0x966D, 0x535C, 0x966E, 0x58A8, 0x966F, 0x64B2, 0x9670, 0x6734, - 0x9671, 0x7267, 0x9672, 0x7766, 0x9673, 0x7A46, 0x9674, 0x91E6, - 0x9675, 0x52C3, 0x9676, 0x6CA1, 0x9677, 0x6B86, 0x9678, 0x5800, - 0x9679, 0x5E4C, 0x967A, 0x5954, 0x967B, 0x672C, 0x967C, 0x7FFB, - 0x967D, 0x51E1, 0x967E, 0x76C6, 0x9680, 0x6469, 0x9681, 0x78E8, - 0x9682, 0x9B54, 0x9683, 0x9EBB, 0x9684, 0x57CB, 0x9685, 0x59B9, - 0x9686, 0x6627, 0x9687, 0x679A, 0x9688, 0x6BCE, 0x9689, 0x54E9, - 0x968A, 0x69D9, 0x968B, 0x5E55, 0x968C, 0x819C, 0x968D, 0x6795, - 0x968E, 0x9BAA, 0x968F, 0x67FE, 0x9690, 0x9C52, 0x9691, 0x685D, - 0x9692, 0x4EA6, 0x9693, 0x4FE3, 0x9694, 0x53C8, 0x9695, 0x62B9, - 0x9696, 0x672B, 0x9697, 0x6CAB, 0x9698, 0x8FC4, 0x9699, 0x4FAD, - 0x969A, 0x7E6D, 0x969B, 0x9EBF, 0x969C, 0x4E07, 0x969D, 0x6162, - 0x969E, 0x6E80, 0x969F, 0x6F2B, 0x96A0, 0x8513, 0x96A1, 0x5473, - 0x96A2, 0x672A, 0x96A3, 0x9B45, 0x96A4, 0x5DF3, 0x96A5, 0x7B95, - 0x96A6, 0x5CAC, 0x96A7, 0x5BC6, 0x96A8, 0x871C, 0x96A9, 0x6E4A, - 0x96AA, 0x84D1, 0x96AB, 0x7A14, 0x96AC, 0x8108, 0x96AD, 0x5999, - 0x96AE, 0x7C8D, 0x96AF, 0x6C11, 0x96B0, 0x7720, 0x96B1, 0x52D9, - 0x96B2, 0x5922, 0x96B3, 0x7121, 0x96B4, 0x725F, 0x96B5, 0x77DB, - 0x96B6, 0x9727, 0x96B7, 0x9D61, 0x96B8, 0x690B, 0x96B9, 0x5A7F, - 0x96BA, 0x5A18, 0x96BB, 0x51A5, 0x96BC, 0x540D, 0x96BD, 0x547D, - 0x96BE, 0x660E, 0x96BF, 0x76DF, 0x96C0, 0x8FF7, 0x96C1, 0x9298, - 0x96C2, 0x9CF4, 0x96C3, 0x59EA, 0x96C4, 0x725D, 0x96C5, 0x6EC5, - 0x96C6, 0x514D, 0x96C7, 0x68C9, 0x96C8, 0x7DBF, 0x96C9, 0x7DEC, - 0x96CA, 0x9762, 0x96CB, 0x9EBA, 0x96CC, 0x6478, 0x96CD, 0x6A21, - 0x96CE, 0x8302, 0x96CF, 0x5984, 0x96D0, 0x5B5F, 0x96D1, 0x6BDB, - 0x96D2, 0x731B, 0x96D3, 0x76F2, 0x96D4, 0x7DB2, 0x96D5, 0x8017, - 0x96D6, 0x8499, 0x96D7, 0x5132, 0x96D8, 0x6728, 0x96D9, 0x9ED9, - 0x96DA, 0x76EE, 0x96DB, 0x6762, 0x96DC, 0x52FF, 0x96DD, 0x9905, - 0x96DE, 0x5C24, 0x96DF, 0x623B, 0x96E0, 0x7C7E, 0x96E1, 0x8CB0, - 0x96E2, 0x554F, 0x96E3, 0x60B6, 0x96E4, 0x7D0B, 0x96E5, 0x9580, - 0x96E6, 0x5301, 0x96E7, 0x4E5F, 0x96E8, 0x51B6, 0x96E9, 0x591C, - 0x96EA, 0x723A, 0x96EB, 0x8036, 0x96EC, 0x91CE, 0x96ED, 0x5F25, - 0x96EE, 0x77E2, 0x96EF, 0x5384, 0x96F0, 0x5F79, 0x96F1, 0x7D04, - 0x96F2, 0x85AC, 0x96F3, 0x8A33, 0x96F4, 0x8E8D, 0x96F5, 0x9756, - 0x96F6, 0x67F3, 0x96F7, 0x85AE, 0x96F8, 0x9453, 0x96F9, 0x6109, - 0x96FA, 0x6108, 0x96FB, 0x6CB9, 0x96FC, 0x7652, 0x9740, 0x8AED, - 0x9741, 0x8F38, 0x9742, 0x552F, 0x9743, 0x4F51, 0x9744, 0x512A, - 0x9745, 0x52C7, 0x9746, 0x53CB, 0x9747, 0x5BA5, 0x9748, 0x5E7D, - 0x9749, 0x60A0, 0x974A, 0x6182, 0x974B, 0x63D6, 0x974C, 0x6709, - 0x974D, 0x67DA, 0x974E, 0x6E67, 0x974F, 0x6D8C, 0x9750, 0x7336, - 0x9751, 0x7337, 0x9752, 0x7531, 0x9753, 0x7950, 0x9754, 0x88D5, - 0x9755, 0x8A98, 0x9756, 0x904A, 0x9757, 0x9091, 0x9758, 0x90F5, - 0x9759, 0x96C4, 0x975A, 0x878D, 0x975B, 0x5915, 0x975C, 0x4E88, - 0x975D, 0x4F59, 0x975E, 0x4E0E, 0x975F, 0x8A89, 0x9760, 0x8F3F, - 0x9761, 0x9810, 0x9762, 0x50AD, 0x9763, 0x5E7C, 0x9764, 0x5996, - 0x9765, 0x5BB9, 0x9766, 0x5EB8, 0x9767, 0x63DA, 0x9768, 0x63FA, - 0x9769, 0x64C1, 0x976A, 0x66DC, 0x976B, 0x694A, 0x976C, 0x69D8, - 0x976D, 0x6D0B, 0x976E, 0x6EB6, 0x976F, 0x7194, 0x9770, 0x7528, - 0x9771, 0x7AAF, 0x9772, 0x7F8A, 0x9773, 0x8000, 0x9774, 0x8449, - 0x9775, 0x84C9, 0x9776, 0x8981, 0x9777, 0x8B21, 0x9778, 0x8E0A, - 0x9779, 0x9065, 0x977A, 0x967D, 0x977B, 0x990A, 0x977C, 0x617E, - 0x977D, 0x6291, 0x977E, 0x6B32, 0x9780, 0x6C83, 0x9781, 0x6D74, - 0x9782, 0x7FCC, 0x9783, 0x7FFC, 0x9784, 0x6DC0, 0x9785, 0x7F85, - 0x9786, 0x87BA, 0x9787, 0x88F8, 0x9788, 0x6765, 0x9789, 0x83B1, - 0x978A, 0x983C, 0x978B, 0x96F7, 0x978C, 0x6D1B, 0x978D, 0x7D61, - 0x978E, 0x843D, 0x978F, 0x916A, 0x9790, 0x4E71, 0x9791, 0x5375, - 0x9792, 0x5D50, 0x9793, 0x6B04, 0x9794, 0x6FEB, 0x9795, 0x85CD, - 0x9796, 0x862D, 0x9797, 0x89A7, 0x9798, 0x5229, 0x9799, 0x540F, - 0x979A, 0x5C65, 0x979B, 0x674E, 0x979C, 0x68A8, 0x979D, 0x7406, - 0x979E, 0x7483, 0x979F, 0x75E2, 0x97A0, 0x88CF, 0x97A1, 0x88E1, - 0x97A2, 0x91CC, 0x97A3, 0x96E2, 0x97A4, 0x9678, 0x97A5, 0x5F8B, - 0x97A6, 0x7387, 0x97A7, 0x7ACB, 0x97A8, 0x844E, 0x97A9, 0x63A0, - 0x97AA, 0x7565, 0x97AB, 0x5289, 0x97AC, 0x6D41, 0x97AD, 0x6E9C, - 0x97AE, 0x7409, 0x97AF, 0x7559, 0x97B0, 0x786B, 0x97B1, 0x7C92, - 0x97B2, 0x9686, 0x97B3, 0x7ADC, 0x97B4, 0x9F8D, 0x97B5, 0x4FB6, - 0x97B6, 0x616E, 0x97B7, 0x65C5, 0x97B8, 0x865C, 0x97B9, 0x4E86, - 0x97BA, 0x4EAE, 0x97BB, 0x50DA, 0x97BC, 0x4E21, 0x97BD, 0x51CC, - 0x97BE, 0x5BEE, 0x97BF, 0x6599, 0x97C0, 0x6881, 0x97C1, 0x6DBC, - 0x97C2, 0x731F, 0x97C3, 0x7642, 0x97C4, 0x77AD, 0x97C5, 0x7A1C, - 0x97C6, 0x7CE7, 0x97C7, 0x826F, 0x97C8, 0x8AD2, 0x97C9, 0x907C, - 0x97CA, 0x91CF, 0x97CB, 0x9675, 0x97CC, 0x9818, 0x97CD, 0x529B, - 0x97CE, 0x7DD1, 0x97CF, 0x502B, 0x97D0, 0x5398, 0x97D1, 0x6797, - 0x97D2, 0x6DCB, 0x97D3, 0x71D0, 0x97D4, 0x7433, 0x97D5, 0x81E8, - 0x97D6, 0x8F2A, 0x97D7, 0x96A3, 0x97D8, 0x9C57, 0x97D9, 0x9E9F, - 0x97DA, 0x7460, 0x97DB, 0x5841, 0x97DC, 0x6D99, 0x97DD, 0x7D2F, - 0x97DE, 0x985E, 0x97DF, 0x4EE4, 0x97E0, 0x4F36, 0x97E1, 0x4F8B, - 0x97E2, 0x51B7, 0x97E3, 0x52B1, 0x97E4, 0x5DBA, 0x97E5, 0x601C, - 0x97E6, 0x73B2, 0x97E7, 0x793C, 0x97E8, 0x82D3, 0x97E9, 0x9234, - 0x97EA, 0x96B7, 0x97EB, 0x96F6, 0x97EC, 0x970A, 0x97ED, 0x9E97, - 0x97EE, 0x9F62, 0x97EF, 0x66A6, 0x97F0, 0x6B74, 0x97F1, 0x5217, - 0x97F2, 0x52A3, 0x97F3, 0x70C8, 0x97F4, 0x88C2, 0x97F5, 0x5EC9, - 0x97F6, 0x604B, 0x97F7, 0x6190, 0x97F8, 0x6F23, 0x97F9, 0x7149, - 0x97FA, 0x7C3E, 0x97FB, 0x7DF4, 0x97FC, 0x806F, 0x9840, 0x84EE, - 0x9841, 0x9023, 0x9842, 0x932C, 0x9843, 0x5442, 0x9844, 0x9B6F, - 0x9845, 0x6AD3, 0x9846, 0x7089, 0x9847, 0x8CC2, 0x9848, 0x8DEF, - 0x9849, 0x9732, 0x984A, 0x52B4, 0x984B, 0x5A41, 0x984C, 0x5ECA, - 0x984D, 0x5F04, 0x984E, 0x6717, 0x984F, 0x697C, 0x9850, 0x6994, - 0x9851, 0x6D6A, 0x9852, 0x6F0F, 0x9853, 0x7262, 0x9854, 0x72FC, - 0x9855, 0x7BED, 0x9856, 0x8001, 0x9857, 0x807E, 0x9858, 0x874B, - 0x9859, 0x90CE, 0x985A, 0x516D, 0x985B, 0x9E93, 0x985C, 0x7984, - 0x985D, 0x808B, 0x985E, 0x9332, 0x985F, 0x8AD6, 0x9860, 0x502D, - 0x9861, 0x548C, 0x9862, 0x8A71, 0x9863, 0x6B6A, 0x9864, 0x8CC4, - 0x9865, 0x8107, 0x9866, 0x60D1, 0x9867, 0x67A0, 0x9868, 0x9DF2, - 0x9869, 0x4E99, 0x986A, 0x4E98, 0x986B, 0x9C10, 0x986C, 0x8A6B, - 0x986D, 0x85C1, 0x986E, 0x8568, 0x986F, 0x6900, 0x9870, 0x6E7E, - 0x9871, 0x7897, 0x9872, 0x8155, 0x989F, 0x5F0C, 0x98A0, 0x4E10, - 0x98A1, 0x4E15, 0x98A2, 0x4E2A, 0x98A3, 0x4E31, 0x98A4, 0x4E36, - 0x98A5, 0x4E3C, 0x98A6, 0x4E3F, 0x98A7, 0x4E42, 0x98A8, 0x4E56, - 0x98A9, 0x4E58, 0x98AA, 0x4E82, 0x98AB, 0x4E85, 0x98AC, 0x8C6B, - 0x98AD, 0x4E8A, 0x98AE, 0x8212, 0x98AF, 0x5F0D, 0x98B0, 0x4E8E, - 0x98B1, 0x4E9E, 0x98B2, 0x4E9F, 0x98B3, 0x4EA0, 0x98B4, 0x4EA2, - 0x98B5, 0x4EB0, 0x98B6, 0x4EB3, 0x98B7, 0x4EB6, 0x98B8, 0x4ECE, - 0x98B9, 0x4ECD, 0x98BA, 0x4EC4, 0x98BB, 0x4EC6, 0x98BC, 0x4EC2, - 0x98BD, 0x4ED7, 0x98BE, 0x4EDE, 0x98BF, 0x4EED, 0x98C0, 0x4EDF, - 0x98C1, 0x4EF7, 0x98C2, 0x4F09, 0x98C3, 0x4F5A, 0x98C4, 0x4F30, - 0x98C5, 0x4F5B, 0x98C6, 0x4F5D, 0x98C7, 0x4F57, 0x98C8, 0x4F47, - 0x98C9, 0x4F76, 0x98CA, 0x4F88, 0x98CB, 0x4F8F, 0x98CC, 0x4F98, - 0x98CD, 0x4F7B, 0x98CE, 0x4F69, 0x98CF, 0x4F70, 0x98D0, 0x4F91, - 0x98D1, 0x4F6F, 0x98D2, 0x4F86, 0x98D3, 0x4F96, 0x98D4, 0x5118, - 0x98D5, 0x4FD4, 0x98D6, 0x4FDF, 0x98D7, 0x4FCE, 0x98D8, 0x4FD8, - 0x98D9, 0x4FDB, 0x98DA, 0x4FD1, 0x98DB, 0x4FDA, 0x98DC, 0x4FD0, - 0x98DD, 0x4FE4, 0x98DE, 0x4FE5, 0x98DF, 0x501A, 0x98E0, 0x5028, - 0x98E1, 0x5014, 0x98E2, 0x502A, 0x98E3, 0x5025, 0x98E4, 0x5005, - 0x98E5, 0x4F1C, 0x98E6, 0x4FF6, 0x98E7, 0x5021, 0x98E8, 0x5029, - 0x98E9, 0x502C, 0x98EA, 0x4FFE, 0x98EB, 0x4FEF, 0x98EC, 0x5011, - 0x98ED, 0x5006, 0x98EE, 0x5043, 0x98EF, 0x5047, 0x98F0, 0x6703, - 0x98F1, 0x5055, 0x98F2, 0x5050, 0x98F3, 0x5048, 0x98F4, 0x505A, - 0x98F5, 0x5056, 0x98F6, 0x506C, 0x98F7, 0x5078, 0x98F8, 0x5080, - 0x98F9, 0x509A, 0x98FA, 0x5085, 0x98FB, 0x50B4, 0x98FC, 0x50B2, - 0x9940, 0x50C9, 0x9941, 0x50CA, 0x9942, 0x50B3, 0x9943, 0x50C2, - 0x9944, 0x50D6, 0x9945, 0x50DE, 0x9946, 0x50E5, 0x9947, 0x50ED, - 0x9948, 0x50E3, 0x9949, 0x50EE, 0x994A, 0x50F9, 0x994B, 0x50F5, - 0x994C, 0x5109, 0x994D, 0x5101, 0x994E, 0x5102, 0x994F, 0x5116, - 0x9950, 0x5115, 0x9951, 0x5114, 0x9952, 0x511A, 0x9953, 0x5121, - 0x9954, 0x513A, 0x9955, 0x5137, 0x9956, 0x513C, 0x9957, 0x513B, - 0x9958, 0x513F, 0x9959, 0x5140, 0x995A, 0x5152, 0x995B, 0x514C, - 0x995C, 0x5154, 0x995D, 0x5162, 0x995E, 0x7AF8, 0x995F, 0x5169, - 0x9960, 0x516A, 0x9961, 0x516E, 0x9962, 0x5180, 0x9963, 0x5182, - 0x9964, 0x56D8, 0x9965, 0x518C, 0x9966, 0x5189, 0x9967, 0x518F, - 0x9968, 0x5191, 0x9969, 0x5193, 0x996A, 0x5195, 0x996B, 0x5196, - 0x996C, 0x51A4, 0x996D, 0x51A6, 0x996E, 0x51A2, 0x996F, 0x51A9, - 0x9970, 0x51AA, 0x9971, 0x51AB, 0x9972, 0x51B3, 0x9973, 0x51B1, - 0x9974, 0x51B2, 0x9975, 0x51B0, 0x9976, 0x51B5, 0x9977, 0x51BD, - 0x9978, 0x51C5, 0x9979, 0x51C9, 0x997A, 0x51DB, 0x997B, 0x51E0, - 0x997C, 0x8655, 0x997D, 0x51E9, 0x997E, 0x51ED, 0x9980, 0x51F0, - 0x9981, 0x51F5, 0x9982, 0x51FE, 0x9983, 0x5204, 0x9984, 0x520B, - 0x9985, 0x5214, 0x9986, 0x520E, 0x9987, 0x5227, 0x9988, 0x522A, - 0x9989, 0x522E, 0x998A, 0x5233, 0x998B, 0x5239, 0x998C, 0x524F, - 0x998D, 0x5244, 0x998E, 0x524B, 0x998F, 0x524C, 0x9990, 0x525E, - 0x9991, 0x5254, 0x9992, 0x526A, 0x9993, 0x5274, 0x9994, 0x5269, - 0x9995, 0x5273, 0x9996, 0x527F, 0x9997, 0x527D, 0x9998, 0x528D, - 0x9999, 0x5294, 0x999A, 0x5292, 0x999B, 0x5271, 0x999C, 0x5288, - 0x999D, 0x5291, 0x999E, 0x8FA8, 0x999F, 0x8FA7, 0x99A0, 0x52AC, - 0x99A1, 0x52AD, 0x99A2, 0x52BC, 0x99A3, 0x52B5, 0x99A4, 0x52C1, - 0x99A5, 0x52CD, 0x99A6, 0x52D7, 0x99A7, 0x52DE, 0x99A8, 0x52E3, - 0x99A9, 0x52E6, 0x99AA, 0x98ED, 0x99AB, 0x52E0, 0x99AC, 0x52F3, - 0x99AD, 0x52F5, 0x99AE, 0x52F8, 0x99AF, 0x52F9, 0x99B0, 0x5306, - 0x99B1, 0x5308, 0x99B2, 0x7538, 0x99B3, 0x530D, 0x99B4, 0x5310, - 0x99B5, 0x530F, 0x99B6, 0x5315, 0x99B7, 0x531A, 0x99B8, 0x5323, - 0x99B9, 0x532F, 0x99BA, 0x5331, 0x99BB, 0x5333, 0x99BC, 0x5338, - 0x99BD, 0x5340, 0x99BE, 0x5346, 0x99BF, 0x5345, 0x99C0, 0x4E17, - 0x99C1, 0x5349, 0x99C2, 0x534D, 0x99C3, 0x51D6, 0x99C4, 0x535E, - 0x99C5, 0x5369, 0x99C6, 0x536E, 0x99C7, 0x5918, 0x99C8, 0x537B, - 0x99C9, 0x5377, 0x99CA, 0x5382, 0x99CB, 0x5396, 0x99CC, 0x53A0, - 0x99CD, 0x53A6, 0x99CE, 0x53A5, 0x99CF, 0x53AE, 0x99D0, 0x53B0, - 0x99D1, 0x53B6, 0x99D2, 0x53C3, 0x99D3, 0x7C12, 0x99D4, 0x96D9, - 0x99D5, 0x53DF, 0x99D6, 0x66FC, 0x99D7, 0x71EE, 0x99D8, 0x53EE, - 0x99D9, 0x53E8, 0x99DA, 0x53ED, 0x99DB, 0x53FA, 0x99DC, 0x5401, - 0x99DD, 0x543D, 0x99DE, 0x5440, 0x99DF, 0x542C, 0x99E0, 0x542D, - 0x99E1, 0x543C, 0x99E2, 0x542E, 0x99E3, 0x5436, 0x99E4, 0x5429, - 0x99E5, 0x541D, 0x99E6, 0x544E, 0x99E7, 0x548F, 0x99E8, 0x5475, - 0x99E9, 0x548E, 0x99EA, 0x545F, 0x99EB, 0x5471, 0x99EC, 0x5477, - 0x99ED, 0x5470, 0x99EE, 0x5492, 0x99EF, 0x547B, 0x99F0, 0x5480, - 0x99F1, 0x5476, 0x99F2, 0x5484, 0x99F3, 0x5490, 0x99F4, 0x5486, - 0x99F5, 0x54C7, 0x99F6, 0x54A2, 0x99F7, 0x54B8, 0x99F8, 0x54A5, - 0x99F9, 0x54AC, 0x99FA, 0x54C4, 0x99FB, 0x54C8, 0x99FC, 0x54A8, - 0x9A40, 0x54AB, 0x9A41, 0x54C2, 0x9A42, 0x54A4, 0x9A43, 0x54BE, - 0x9A44, 0x54BC, 0x9A45, 0x54D8, 0x9A46, 0x54E5, 0x9A47, 0x54E6, - 0x9A48, 0x550F, 0x9A49, 0x5514, 0x9A4A, 0x54FD, 0x9A4B, 0x54EE, - 0x9A4C, 0x54ED, 0x9A4D, 0x54FA, 0x9A4E, 0x54E2, 0x9A4F, 0x5539, - 0x9A50, 0x5540, 0x9A51, 0x5563, 0x9A52, 0x554C, 0x9A53, 0x552E, - 0x9A54, 0x555C, 0x9A55, 0x5545, 0x9A56, 0x5556, 0x9A57, 0x5557, - 0x9A58, 0x5538, 0x9A59, 0x5533, 0x9A5A, 0x555D, 0x9A5B, 0x5599, - 0x9A5C, 0x5580, 0x9A5D, 0x54AF, 0x9A5E, 0x558A, 0x9A5F, 0x559F, - 0x9A60, 0x557B, 0x9A61, 0x557E, 0x9A62, 0x5598, 0x9A63, 0x559E, - 0x9A64, 0x55AE, 0x9A65, 0x557C, 0x9A66, 0x5583, 0x9A67, 0x55A9, - 0x9A68, 0x5587, 0x9A69, 0x55A8, 0x9A6A, 0x55DA, 0x9A6B, 0x55C5, - 0x9A6C, 0x55DF, 0x9A6D, 0x55C4, 0x9A6E, 0x55DC, 0x9A6F, 0x55E4, - 0x9A70, 0x55D4, 0x9A71, 0x5614, 0x9A72, 0x55F7, 0x9A73, 0x5616, - 0x9A74, 0x55FE, 0x9A75, 0x55FD, 0x9A76, 0x561B, 0x9A77, 0x55F9, - 0x9A78, 0x564E, 0x9A79, 0x5650, 0x9A7A, 0x71DF, 0x9A7B, 0x5634, - 0x9A7C, 0x5636, 0x9A7D, 0x5632, 0x9A7E, 0x5638, 0x9A80, 0x566B, - 0x9A81, 0x5664, 0x9A82, 0x562F, 0x9A83, 0x566C, 0x9A84, 0x566A, - 0x9A85, 0x5686, 0x9A86, 0x5680, 0x9A87, 0x568A, 0x9A88, 0x56A0, - 0x9A89, 0x5694, 0x9A8A, 0x568F, 0x9A8B, 0x56A5, 0x9A8C, 0x56AE, - 0x9A8D, 0x56B6, 0x9A8E, 0x56B4, 0x9A8F, 0x56C2, 0x9A90, 0x56BC, - 0x9A91, 0x56C1, 0x9A92, 0x56C3, 0x9A93, 0x56C0, 0x9A94, 0x56C8, - 0x9A95, 0x56CE, 0x9A96, 0x56D1, 0x9A97, 0x56D3, 0x9A98, 0x56D7, - 0x9A99, 0x56EE, 0x9A9A, 0x56F9, 0x9A9B, 0x5700, 0x9A9C, 0x56FF, - 0x9A9D, 0x5704, 0x9A9E, 0x5709, 0x9A9F, 0x5708, 0x9AA0, 0x570B, - 0x9AA1, 0x570D, 0x9AA2, 0x5713, 0x9AA3, 0x5718, 0x9AA4, 0x5716, - 0x9AA5, 0x55C7, 0x9AA6, 0x571C, 0x9AA7, 0x5726, 0x9AA8, 0x5737, - 0x9AA9, 0x5738, 0x9AAA, 0x574E, 0x9AAB, 0x573B, 0x9AAC, 0x5740, - 0x9AAD, 0x574F, 0x9AAE, 0x5769, 0x9AAF, 0x57C0, 0x9AB0, 0x5788, - 0x9AB1, 0x5761, 0x9AB2, 0x577F, 0x9AB3, 0x5789, 0x9AB4, 0x5793, - 0x9AB5, 0x57A0, 0x9AB6, 0x57B3, 0x9AB7, 0x57A4, 0x9AB8, 0x57AA, - 0x9AB9, 0x57B0, 0x9ABA, 0x57C3, 0x9ABB, 0x57C6, 0x9ABC, 0x57D4, - 0x9ABD, 0x57D2, 0x9ABE, 0x57D3, 0x9ABF, 0x580A, 0x9AC0, 0x57D6, - 0x9AC1, 0x57E3, 0x9AC2, 0x580B, 0x9AC3, 0x5819, 0x9AC4, 0x581D, - 0x9AC5, 0x5872, 0x9AC6, 0x5821, 0x9AC7, 0x5862, 0x9AC8, 0x584B, - 0x9AC9, 0x5870, 0x9ACA, 0x6BC0, 0x9ACB, 0x5852, 0x9ACC, 0x583D, - 0x9ACD, 0x5879, 0x9ACE, 0x5885, 0x9ACF, 0x58B9, 0x9AD0, 0x589F, - 0x9AD1, 0x58AB, 0x9AD2, 0x58BA, 0x9AD3, 0x58DE, 0x9AD4, 0x58BB, - 0x9AD5, 0x58B8, 0x9AD6, 0x58AE, 0x9AD7, 0x58C5, 0x9AD8, 0x58D3, - 0x9AD9, 0x58D1, 0x9ADA, 0x58D7, 0x9ADB, 0x58D9, 0x9ADC, 0x58D8, - 0x9ADD, 0x58E5, 0x9ADE, 0x58DC, 0x9ADF, 0x58E4, 0x9AE0, 0x58DF, - 0x9AE1, 0x58EF, 0x9AE2, 0x58FA, 0x9AE3, 0x58F9, 0x9AE4, 0x58FB, - 0x9AE5, 0x58FC, 0x9AE6, 0x58FD, 0x9AE7, 0x5902, 0x9AE8, 0x590A, - 0x9AE9, 0x5910, 0x9AEA, 0x591B, 0x9AEB, 0x68A6, 0x9AEC, 0x5925, - 0x9AED, 0x592C, 0x9AEE, 0x592D, 0x9AEF, 0x5932, 0x9AF0, 0x5938, - 0x9AF1, 0x593E, 0x9AF2, 0x7AD2, 0x9AF3, 0x5955, 0x9AF4, 0x5950, - 0x9AF5, 0x594E, 0x9AF6, 0x595A, 0x9AF7, 0x5958, 0x9AF8, 0x5962, - 0x9AF9, 0x5960, 0x9AFA, 0x5967, 0x9AFB, 0x596C, 0x9AFC, 0x5969, - 0x9B40, 0x5978, 0x9B41, 0x5981, 0x9B42, 0x599D, 0x9B43, 0x4F5E, - 0x9B44, 0x4FAB, 0x9B45, 0x59A3, 0x9B46, 0x59B2, 0x9B47, 0x59C6, - 0x9B48, 0x59E8, 0x9B49, 0x59DC, 0x9B4A, 0x598D, 0x9B4B, 0x59D9, - 0x9B4C, 0x59DA, 0x9B4D, 0x5A25, 0x9B4E, 0x5A1F, 0x9B4F, 0x5A11, - 0x9B50, 0x5A1C, 0x9B51, 0x5A09, 0x9B52, 0x5A1A, 0x9B53, 0x5A40, - 0x9B54, 0x5A6C, 0x9B55, 0x5A49, 0x9B56, 0x5A35, 0x9B57, 0x5A36, - 0x9B58, 0x5A62, 0x9B59, 0x5A6A, 0x9B5A, 0x5A9A, 0x9B5B, 0x5ABC, - 0x9B5C, 0x5ABE, 0x9B5D, 0x5ACB, 0x9B5E, 0x5AC2, 0x9B5F, 0x5ABD, - 0x9B60, 0x5AE3, 0x9B61, 0x5AD7, 0x9B62, 0x5AE6, 0x9B63, 0x5AE9, - 0x9B64, 0x5AD6, 0x9B65, 0x5AFA, 0x9B66, 0x5AFB, 0x9B67, 0x5B0C, - 0x9B68, 0x5B0B, 0x9B69, 0x5B16, 0x9B6A, 0x5B32, 0x9B6B, 0x5AD0, - 0x9B6C, 0x5B2A, 0x9B6D, 0x5B36, 0x9B6E, 0x5B3E, 0x9B6F, 0x5B43, - 0x9B70, 0x5B45, 0x9B71, 0x5B40, 0x9B72, 0x5B51, 0x9B73, 0x5B55, - 0x9B74, 0x5B5A, 0x9B75, 0x5B5B, 0x9B76, 0x5B65, 0x9B77, 0x5B69, - 0x9B78, 0x5B70, 0x9B79, 0x5B73, 0x9B7A, 0x5B75, 0x9B7B, 0x5B78, - 0x9B7C, 0x6588, 0x9B7D, 0x5B7A, 0x9B7E, 0x5B80, 0x9B80, 0x5B83, - 0x9B81, 0x5BA6, 0x9B82, 0x5BB8, 0x9B83, 0x5BC3, 0x9B84, 0x5BC7, - 0x9B85, 0x5BC9, 0x9B86, 0x5BD4, 0x9B87, 0x5BD0, 0x9B88, 0x5BE4, - 0x9B89, 0x5BE6, 0x9B8A, 0x5BE2, 0x9B8B, 0x5BDE, 0x9B8C, 0x5BE5, - 0x9B8D, 0x5BEB, 0x9B8E, 0x5BF0, 0x9B8F, 0x5BF6, 0x9B90, 0x5BF3, - 0x9B91, 0x5C05, 0x9B92, 0x5C07, 0x9B93, 0x5C08, 0x9B94, 0x5C0D, - 0x9B95, 0x5C13, 0x9B96, 0x5C20, 0x9B97, 0x5C22, 0x9B98, 0x5C28, - 0x9B99, 0x5C38, 0x9B9A, 0x5C39, 0x9B9B, 0x5C41, 0x9B9C, 0x5C46, - 0x9B9D, 0x5C4E, 0x9B9E, 0x5C53, 0x9B9F, 0x5C50, 0x9BA0, 0x5C4F, - 0x9BA1, 0x5B71, 0x9BA2, 0x5C6C, 0x9BA3, 0x5C6E, 0x9BA4, 0x4E62, - 0x9BA5, 0x5C76, 0x9BA6, 0x5C79, 0x9BA7, 0x5C8C, 0x9BA8, 0x5C91, - 0x9BA9, 0x5C94, 0x9BAA, 0x599B, 0x9BAB, 0x5CAB, 0x9BAC, 0x5CBB, - 0x9BAD, 0x5CB6, 0x9BAE, 0x5CBC, 0x9BAF, 0x5CB7, 0x9BB0, 0x5CC5, - 0x9BB1, 0x5CBE, 0x9BB2, 0x5CC7, 0x9BB3, 0x5CD9, 0x9BB4, 0x5CE9, - 0x9BB5, 0x5CFD, 0x9BB6, 0x5CFA, 0x9BB7, 0x5CED, 0x9BB8, 0x5D8C, - 0x9BB9, 0x5CEA, 0x9BBA, 0x5D0B, 0x9BBB, 0x5D15, 0x9BBC, 0x5D17, - 0x9BBD, 0x5D5C, 0x9BBE, 0x5D1F, 0x9BBF, 0x5D1B, 0x9BC0, 0x5D11, - 0x9BC1, 0x5D14, 0x9BC2, 0x5D22, 0x9BC3, 0x5D1A, 0x9BC4, 0x5D19, - 0x9BC5, 0x5D18, 0x9BC6, 0x5D4C, 0x9BC7, 0x5D52, 0x9BC8, 0x5D4E, - 0x9BC9, 0x5D4B, 0x9BCA, 0x5D6C, 0x9BCB, 0x5D73, 0x9BCC, 0x5D76, - 0x9BCD, 0x5D87, 0x9BCE, 0x5D84, 0x9BCF, 0x5D82, 0x9BD0, 0x5DA2, - 0x9BD1, 0x5D9D, 0x9BD2, 0x5DAC, 0x9BD3, 0x5DAE, 0x9BD4, 0x5DBD, - 0x9BD5, 0x5D90, 0x9BD6, 0x5DB7, 0x9BD7, 0x5DBC, 0x9BD8, 0x5DC9, - 0x9BD9, 0x5DCD, 0x9BDA, 0x5DD3, 0x9BDB, 0x5DD2, 0x9BDC, 0x5DD6, - 0x9BDD, 0x5DDB, 0x9BDE, 0x5DEB, 0x9BDF, 0x5DF2, 0x9BE0, 0x5DF5, - 0x9BE1, 0x5E0B, 0x9BE2, 0x5E1A, 0x9BE3, 0x5E19, 0x9BE4, 0x5E11, - 0x9BE5, 0x5E1B, 0x9BE6, 0x5E36, 0x9BE7, 0x5E37, 0x9BE8, 0x5E44, - 0x9BE9, 0x5E43, 0x9BEA, 0x5E40, 0x9BEB, 0x5E4E, 0x9BEC, 0x5E57, - 0x9BED, 0x5E54, 0x9BEE, 0x5E5F, 0x9BEF, 0x5E62, 0x9BF0, 0x5E64, - 0x9BF1, 0x5E47, 0x9BF2, 0x5E75, 0x9BF3, 0x5E76, 0x9BF4, 0x5E7A, - 0x9BF5, 0x9EBC, 0x9BF6, 0x5E7F, 0x9BF7, 0x5EA0, 0x9BF8, 0x5EC1, - 0x9BF9, 0x5EC2, 0x9BFA, 0x5EC8, 0x9BFB, 0x5ED0, 0x9BFC, 0x5ECF, - 0x9C40, 0x5ED6, 0x9C41, 0x5EE3, 0x9C42, 0x5EDD, 0x9C43, 0x5EDA, - 0x9C44, 0x5EDB, 0x9C45, 0x5EE2, 0x9C46, 0x5EE1, 0x9C47, 0x5EE8, - 0x9C48, 0x5EE9, 0x9C49, 0x5EEC, 0x9C4A, 0x5EF1, 0x9C4B, 0x5EF3, - 0x9C4C, 0x5EF0, 0x9C4D, 0x5EF4, 0x9C4E, 0x5EF8, 0x9C4F, 0x5EFE, - 0x9C50, 0x5F03, 0x9C51, 0x5F09, 0x9C52, 0x5F5D, 0x9C53, 0x5F5C, - 0x9C54, 0x5F0B, 0x9C55, 0x5F11, 0x9C56, 0x5F16, 0x9C57, 0x5F29, - 0x9C58, 0x5F2D, 0x9C59, 0x5F38, 0x9C5A, 0x5F41, 0x9C5B, 0x5F48, - 0x9C5C, 0x5F4C, 0x9C5D, 0x5F4E, 0x9C5E, 0x5F2F, 0x9C5F, 0x5F51, - 0x9C60, 0x5F56, 0x9C61, 0x5F57, 0x9C62, 0x5F59, 0x9C63, 0x5F61, - 0x9C64, 0x5F6D, 0x9C65, 0x5F73, 0x9C66, 0x5F77, 0x9C67, 0x5F83, - 0x9C68, 0x5F82, 0x9C69, 0x5F7F, 0x9C6A, 0x5F8A, 0x9C6B, 0x5F88, - 0x9C6C, 0x5F91, 0x9C6D, 0x5F87, 0x9C6E, 0x5F9E, 0x9C6F, 0x5F99, - 0x9C70, 0x5F98, 0x9C71, 0x5FA0, 0x9C72, 0x5FA8, 0x9C73, 0x5FAD, - 0x9C74, 0x5FBC, 0x9C75, 0x5FD6, 0x9C76, 0x5FFB, 0x9C77, 0x5FE4, - 0x9C78, 0x5FF8, 0x9C79, 0x5FF1, 0x9C7A, 0x5FDD, 0x9C7B, 0x60B3, - 0x9C7C, 0x5FFF, 0x9C7D, 0x6021, 0x9C7E, 0x6060, 0x9C80, 0x6019, - 0x9C81, 0x6010, 0x9C82, 0x6029, 0x9C83, 0x600E, 0x9C84, 0x6031, - 0x9C85, 0x601B, 0x9C86, 0x6015, 0x9C87, 0x602B, 0x9C88, 0x6026, - 0x9C89, 0x600F, 0x9C8A, 0x603A, 0x9C8B, 0x605A, 0x9C8C, 0x6041, - 0x9C8D, 0x606A, 0x9C8E, 0x6077, 0x9C8F, 0x605F, 0x9C90, 0x604A, - 0x9C91, 0x6046, 0x9C92, 0x604D, 0x9C93, 0x6063, 0x9C94, 0x6043, - 0x9C95, 0x6064, 0x9C96, 0x6042, 0x9C97, 0x606C, 0x9C98, 0x606B, - 0x9C99, 0x6059, 0x9C9A, 0x6081, 0x9C9B, 0x608D, 0x9C9C, 0x60E7, - 0x9C9D, 0x6083, 0x9C9E, 0x609A, 0x9C9F, 0x6084, 0x9CA0, 0x609B, - 0x9CA1, 0x6096, 0x9CA2, 0x6097, 0x9CA3, 0x6092, 0x9CA4, 0x60A7, - 0x9CA5, 0x608B, 0x9CA6, 0x60E1, 0x9CA7, 0x60B8, 0x9CA8, 0x60E0, - 0x9CA9, 0x60D3, 0x9CAA, 0x60B4, 0x9CAB, 0x5FF0, 0x9CAC, 0x60BD, - 0x9CAD, 0x60C6, 0x9CAE, 0x60B5, 0x9CAF, 0x60D8, 0x9CB0, 0x614D, - 0x9CB1, 0x6115, 0x9CB2, 0x6106, 0x9CB3, 0x60F6, 0x9CB4, 0x60F7, - 0x9CB5, 0x6100, 0x9CB6, 0x60F4, 0x9CB7, 0x60FA, 0x9CB8, 0x6103, - 0x9CB9, 0x6121, 0x9CBA, 0x60FB, 0x9CBB, 0x60F1, 0x9CBC, 0x610D, - 0x9CBD, 0x610E, 0x9CBE, 0x6147, 0x9CBF, 0x613E, 0x9CC0, 0x6128, - 0x9CC1, 0x6127, 0x9CC2, 0x614A, 0x9CC3, 0x613F, 0x9CC4, 0x613C, - 0x9CC5, 0x612C, 0x9CC6, 0x6134, 0x9CC7, 0x613D, 0x9CC8, 0x6142, - 0x9CC9, 0x6144, 0x9CCA, 0x6173, 0x9CCB, 0x6177, 0x9CCC, 0x6158, - 0x9CCD, 0x6159, 0x9CCE, 0x615A, 0x9CCF, 0x616B, 0x9CD0, 0x6174, - 0x9CD1, 0x616F, 0x9CD2, 0x6165, 0x9CD3, 0x6171, 0x9CD4, 0x615F, - 0x9CD5, 0x615D, 0x9CD6, 0x6153, 0x9CD7, 0x6175, 0x9CD8, 0x6199, - 0x9CD9, 0x6196, 0x9CDA, 0x6187, 0x9CDB, 0x61AC, 0x9CDC, 0x6194, - 0x9CDD, 0x619A, 0x9CDE, 0x618A, 0x9CDF, 0x6191, 0x9CE0, 0x61AB, - 0x9CE1, 0x61AE, 0x9CE2, 0x61CC, 0x9CE3, 0x61CA, 0x9CE4, 0x61C9, - 0x9CE5, 0x61F7, 0x9CE6, 0x61C8, 0x9CE7, 0x61C3, 0x9CE8, 0x61C6, - 0x9CE9, 0x61BA, 0x9CEA, 0x61CB, 0x9CEB, 0x7F79, 0x9CEC, 0x61CD, - 0x9CED, 0x61E6, 0x9CEE, 0x61E3, 0x9CEF, 0x61F6, 0x9CF0, 0x61FA, - 0x9CF1, 0x61F4, 0x9CF2, 0x61FF, 0x9CF3, 0x61FD, 0x9CF4, 0x61FC, - 0x9CF5, 0x61FE, 0x9CF6, 0x6200, 0x9CF7, 0x6208, 0x9CF8, 0x6209, - 0x9CF9, 0x620D, 0x9CFA, 0x620C, 0x9CFB, 0x6214, 0x9CFC, 0x621B, - 0x9D40, 0x621E, 0x9D41, 0x6221, 0x9D42, 0x622A, 0x9D43, 0x622E, - 0x9D44, 0x6230, 0x9D45, 0x6232, 0x9D46, 0x6233, 0x9D47, 0x6241, - 0x9D48, 0x624E, 0x9D49, 0x625E, 0x9D4A, 0x6263, 0x9D4B, 0x625B, - 0x9D4C, 0x6260, 0x9D4D, 0x6268, 0x9D4E, 0x627C, 0x9D4F, 0x6282, - 0x9D50, 0x6289, 0x9D51, 0x627E, 0x9D52, 0x6292, 0x9D53, 0x6293, - 0x9D54, 0x6296, 0x9D55, 0x62D4, 0x9D56, 0x6283, 0x9D57, 0x6294, - 0x9D58, 0x62D7, 0x9D59, 0x62D1, 0x9D5A, 0x62BB, 0x9D5B, 0x62CF, - 0x9D5C, 0x62FF, 0x9D5D, 0x62C6, 0x9D5E, 0x64D4, 0x9D5F, 0x62C8, - 0x9D60, 0x62DC, 0x9D61, 0x62CC, 0x9D62, 0x62CA, 0x9D63, 0x62C2, - 0x9D64, 0x62C7, 0x9D65, 0x629B, 0x9D66, 0x62C9, 0x9D67, 0x630C, - 0x9D68, 0x62EE, 0x9D69, 0x62F1, 0x9D6A, 0x6327, 0x9D6B, 0x6302, - 0x9D6C, 0x6308, 0x9D6D, 0x62EF, 0x9D6E, 0x62F5, 0x9D6F, 0x6350, - 0x9D70, 0x633E, 0x9D71, 0x634D, 0x9D72, 0x641C, 0x9D73, 0x634F, - 0x9D74, 0x6396, 0x9D75, 0x638E, 0x9D76, 0x6380, 0x9D77, 0x63AB, - 0x9D78, 0x6376, 0x9D79, 0x63A3, 0x9D7A, 0x638F, 0x9D7B, 0x6389, - 0x9D7C, 0x639F, 0x9D7D, 0x63B5, 0x9D7E, 0x636B, 0x9D80, 0x6369, - 0x9D81, 0x63BE, 0x9D82, 0x63E9, 0x9D83, 0x63C0, 0x9D84, 0x63C6, - 0x9D85, 0x63E3, 0x9D86, 0x63C9, 0x9D87, 0x63D2, 0x9D88, 0x63F6, - 0x9D89, 0x63C4, 0x9D8A, 0x6416, 0x9D8B, 0x6434, 0x9D8C, 0x6406, - 0x9D8D, 0x6413, 0x9D8E, 0x6426, 0x9D8F, 0x6436, 0x9D90, 0x651D, - 0x9D91, 0x6417, 0x9D92, 0x6428, 0x9D93, 0x640F, 0x9D94, 0x6467, - 0x9D95, 0x646F, 0x9D96, 0x6476, 0x9D97, 0x644E, 0x9D98, 0x652A, - 0x9D99, 0x6495, 0x9D9A, 0x6493, 0x9D9B, 0x64A5, 0x9D9C, 0x64A9, - 0x9D9D, 0x6488, 0x9D9E, 0x64BC, 0x9D9F, 0x64DA, 0x9DA0, 0x64D2, - 0x9DA1, 0x64C5, 0x9DA2, 0x64C7, 0x9DA3, 0x64BB, 0x9DA4, 0x64D8, - 0x9DA5, 0x64C2, 0x9DA6, 0x64F1, 0x9DA7, 0x64E7, 0x9DA8, 0x8209, - 0x9DA9, 0x64E0, 0x9DAA, 0x64E1, 0x9DAB, 0x62AC, 0x9DAC, 0x64E3, - 0x9DAD, 0x64EF, 0x9DAE, 0x652C, 0x9DAF, 0x64F6, 0x9DB0, 0x64F4, - 0x9DB1, 0x64F2, 0x9DB2, 0x64FA, 0x9DB3, 0x6500, 0x9DB4, 0x64FD, - 0x9DB5, 0x6518, 0x9DB6, 0x651C, 0x9DB7, 0x6505, 0x9DB8, 0x6524, - 0x9DB9, 0x6523, 0x9DBA, 0x652B, 0x9DBB, 0x6534, 0x9DBC, 0x6535, - 0x9DBD, 0x6537, 0x9DBE, 0x6536, 0x9DBF, 0x6538, 0x9DC0, 0x754B, - 0x9DC1, 0x6548, 0x9DC2, 0x6556, 0x9DC3, 0x6555, 0x9DC4, 0x654D, - 0x9DC5, 0x6558, 0x9DC6, 0x655E, 0x9DC7, 0x655D, 0x9DC8, 0x6572, - 0x9DC9, 0x6578, 0x9DCA, 0x6582, 0x9DCB, 0x6583, 0x9DCC, 0x8B8A, - 0x9DCD, 0x659B, 0x9DCE, 0x659F, 0x9DCF, 0x65AB, 0x9DD0, 0x65B7, - 0x9DD1, 0x65C3, 0x9DD2, 0x65C6, 0x9DD3, 0x65C1, 0x9DD4, 0x65C4, - 0x9DD5, 0x65CC, 0x9DD6, 0x65D2, 0x9DD7, 0x65DB, 0x9DD8, 0x65D9, - 0x9DD9, 0x65E0, 0x9DDA, 0x65E1, 0x9DDB, 0x65F1, 0x9DDC, 0x6772, - 0x9DDD, 0x660A, 0x9DDE, 0x6603, 0x9DDF, 0x65FB, 0x9DE0, 0x6773, - 0x9DE1, 0x6635, 0x9DE2, 0x6636, 0x9DE3, 0x6634, 0x9DE4, 0x661C, - 0x9DE5, 0x664F, 0x9DE6, 0x6644, 0x9DE7, 0x6649, 0x9DE8, 0x6641, - 0x9DE9, 0x665E, 0x9DEA, 0x665D, 0x9DEB, 0x6664, 0x9DEC, 0x6667, - 0x9DED, 0x6668, 0x9DEE, 0x665F, 0x9DEF, 0x6662, 0x9DF0, 0x6670, - 0x9DF1, 0x6683, 0x9DF2, 0x6688, 0x9DF3, 0x668E, 0x9DF4, 0x6689, - 0x9DF5, 0x6684, 0x9DF6, 0x6698, 0x9DF7, 0x669D, 0x9DF8, 0x66C1, - 0x9DF9, 0x66B9, 0x9DFA, 0x66C9, 0x9DFB, 0x66BE, 0x9DFC, 0x66BC, - 0x9E40, 0x66C4, 0x9E41, 0x66B8, 0x9E42, 0x66D6, 0x9E43, 0x66DA, - 0x9E44, 0x66E0, 0x9E45, 0x663F, 0x9E46, 0x66E6, 0x9E47, 0x66E9, - 0x9E48, 0x66F0, 0x9E49, 0x66F5, 0x9E4A, 0x66F7, 0x9E4B, 0x670F, - 0x9E4C, 0x6716, 0x9E4D, 0x671E, 0x9E4E, 0x6726, 0x9E4F, 0x6727, - 0x9E50, 0x9738, 0x9E51, 0x672E, 0x9E52, 0x673F, 0x9E53, 0x6736, - 0x9E54, 0x6741, 0x9E55, 0x6738, 0x9E56, 0x6737, 0x9E57, 0x6746, - 0x9E58, 0x675E, 0x9E59, 0x6760, 0x9E5A, 0x6759, 0x9E5B, 0x6763, - 0x9E5C, 0x6764, 0x9E5D, 0x6789, 0x9E5E, 0x6770, 0x9E5F, 0x67A9, - 0x9E60, 0x677C, 0x9E61, 0x676A, 0x9E62, 0x678C, 0x9E63, 0x678B, - 0x9E64, 0x67A6, 0x9E65, 0x67A1, 0x9E66, 0x6785, 0x9E67, 0x67B7, - 0x9E68, 0x67EF, 0x9E69, 0x67B4, 0x9E6A, 0x67EC, 0x9E6B, 0x67B3, - 0x9E6C, 0x67E9, 0x9E6D, 0x67B8, 0x9E6E, 0x67E4, 0x9E6F, 0x67DE, - 0x9E70, 0x67DD, 0x9E71, 0x67E2, 0x9E72, 0x67EE, 0x9E73, 0x67B9, - 0x9E74, 0x67CE, 0x9E75, 0x67C6, 0x9E76, 0x67E7, 0x9E77, 0x6A9C, - 0x9E78, 0x681E, 0x9E79, 0x6846, 0x9E7A, 0x6829, 0x9E7B, 0x6840, - 0x9E7C, 0x684D, 0x9E7D, 0x6832, 0x9E7E, 0x684E, 0x9E80, 0x68B3, - 0x9E81, 0x682B, 0x9E82, 0x6859, 0x9E83, 0x6863, 0x9E84, 0x6877, - 0x9E85, 0x687F, 0x9E86, 0x689F, 0x9E87, 0x688F, 0x9E88, 0x68AD, - 0x9E89, 0x6894, 0x9E8A, 0x689D, 0x9E8B, 0x689B, 0x9E8C, 0x6883, - 0x9E8D, 0x6AAE, 0x9E8E, 0x68B9, 0x9E8F, 0x6874, 0x9E90, 0x68B5, - 0x9E91, 0x68A0, 0x9E92, 0x68BA, 0x9E93, 0x690F, 0x9E94, 0x688D, - 0x9E95, 0x687E, 0x9E96, 0x6901, 0x9E97, 0x68CA, 0x9E98, 0x6908, - 0x9E99, 0x68D8, 0x9E9A, 0x6922, 0x9E9B, 0x6926, 0x9E9C, 0x68E1, - 0x9E9D, 0x690C, 0x9E9E, 0x68CD, 0x9E9F, 0x68D4, 0x9EA0, 0x68E7, - 0x9EA1, 0x68D5, 0x9EA2, 0x6936, 0x9EA3, 0x6912, 0x9EA4, 0x6904, - 0x9EA5, 0x68D7, 0x9EA6, 0x68E3, 0x9EA7, 0x6925, 0x9EA8, 0x68F9, - 0x9EA9, 0x68E0, 0x9EAA, 0x68EF, 0x9EAB, 0x6928, 0x9EAC, 0x692A, - 0x9EAD, 0x691A, 0x9EAE, 0x6923, 0x9EAF, 0x6921, 0x9EB0, 0x68C6, - 0x9EB1, 0x6979, 0x9EB2, 0x6977, 0x9EB3, 0x695C, 0x9EB4, 0x6978, - 0x9EB5, 0x696B, 0x9EB6, 0x6954, 0x9EB7, 0x697E, 0x9EB8, 0x696E, - 0x9EB9, 0x6939, 0x9EBA, 0x6974, 0x9EBB, 0x693D, 0x9EBC, 0x6959, - 0x9EBD, 0x6930, 0x9EBE, 0x6961, 0x9EBF, 0x695E, 0x9EC0, 0x695D, - 0x9EC1, 0x6981, 0x9EC2, 0x696A, 0x9EC3, 0x69B2, 0x9EC4, 0x69AE, - 0x9EC5, 0x69D0, 0x9EC6, 0x69BF, 0x9EC7, 0x69C1, 0x9EC8, 0x69D3, - 0x9EC9, 0x69BE, 0x9ECA, 0x69CE, 0x9ECB, 0x5BE8, 0x9ECC, 0x69CA, - 0x9ECD, 0x69DD, 0x9ECE, 0x69BB, 0x9ECF, 0x69C3, 0x9ED0, 0x69A7, - 0x9ED1, 0x6A2E, 0x9ED2, 0x6991, 0x9ED3, 0x69A0, 0x9ED4, 0x699C, - 0x9ED5, 0x6995, 0x9ED6, 0x69B4, 0x9ED7, 0x69DE, 0x9ED8, 0x69E8, - 0x9ED9, 0x6A02, 0x9EDA, 0x6A1B, 0x9EDB, 0x69FF, 0x9EDC, 0x6B0A, - 0x9EDD, 0x69F9, 0x9EDE, 0x69F2, 0x9EDF, 0x69E7, 0x9EE0, 0x6A05, - 0x9EE1, 0x69B1, 0x9EE2, 0x6A1E, 0x9EE3, 0x69ED, 0x9EE4, 0x6A14, - 0x9EE5, 0x69EB, 0x9EE6, 0x6A0A, 0x9EE7, 0x6A12, 0x9EE8, 0x6AC1, - 0x9EE9, 0x6A23, 0x9EEA, 0x6A13, 0x9EEB, 0x6A44, 0x9EEC, 0x6A0C, - 0x9EED, 0x6A72, 0x9EEE, 0x6A36, 0x9EEF, 0x6A78, 0x9EF0, 0x6A47, - 0x9EF1, 0x6A62, 0x9EF2, 0x6A59, 0x9EF3, 0x6A66, 0x9EF4, 0x6A48, - 0x9EF5, 0x6A38, 0x9EF6, 0x6A22, 0x9EF7, 0x6A90, 0x9EF8, 0x6A8D, - 0x9EF9, 0x6AA0, 0x9EFA, 0x6A84, 0x9EFB, 0x6AA2, 0x9EFC, 0x6AA3, - 0x9F40, 0x6A97, 0x9F41, 0x8617, 0x9F42, 0x6ABB, 0x9F43, 0x6AC3, - 0x9F44, 0x6AC2, 0x9F45, 0x6AB8, 0x9F46, 0x6AB3, 0x9F47, 0x6AAC, - 0x9F48, 0x6ADE, 0x9F49, 0x6AD1, 0x9F4A, 0x6ADF, 0x9F4B, 0x6AAA, - 0x9F4C, 0x6ADA, 0x9F4D, 0x6AEA, 0x9F4E, 0x6AFB, 0x9F4F, 0x6B05, - 0x9F50, 0x8616, 0x9F51, 0x6AFA, 0x9F52, 0x6B12, 0x9F53, 0x6B16, - 0x9F54, 0x9B31, 0x9F55, 0x6B1F, 0x9F56, 0x6B38, 0x9F57, 0x6B37, - 0x9F58, 0x76DC, 0x9F59, 0x6B39, 0x9F5A, 0x98EE, 0x9F5B, 0x6B47, - 0x9F5C, 0x6B43, 0x9F5D, 0x6B49, 0x9F5E, 0x6B50, 0x9F5F, 0x6B59, - 0x9F60, 0x6B54, 0x9F61, 0x6B5B, 0x9F62, 0x6B5F, 0x9F63, 0x6B61, - 0x9F64, 0x6B78, 0x9F65, 0x6B79, 0x9F66, 0x6B7F, 0x9F67, 0x6B80, - 0x9F68, 0x6B84, 0x9F69, 0x6B83, 0x9F6A, 0x6B8D, 0x9F6B, 0x6B98, - 0x9F6C, 0x6B95, 0x9F6D, 0x6B9E, 0x9F6E, 0x6BA4, 0x9F6F, 0x6BAA, - 0x9F70, 0x6BAB, 0x9F71, 0x6BAF, 0x9F72, 0x6BB2, 0x9F73, 0x6BB1, - 0x9F74, 0x6BB3, 0x9F75, 0x6BB7, 0x9F76, 0x6BBC, 0x9F77, 0x6BC6, - 0x9F78, 0x6BCB, 0x9F79, 0x6BD3, 0x9F7A, 0x6BDF, 0x9F7B, 0x6BEC, - 0x9F7C, 0x6BEB, 0x9F7D, 0x6BF3, 0x9F7E, 0x6BEF, 0x9F80, 0x9EBE, - 0x9F81, 0x6C08, 0x9F82, 0x6C13, 0x9F83, 0x6C14, 0x9F84, 0x6C1B, - 0x9F85, 0x6C24, 0x9F86, 0x6C23, 0x9F87, 0x6C5E, 0x9F88, 0x6C55, - 0x9F89, 0x6C62, 0x9F8A, 0x6C6A, 0x9F8B, 0x6C82, 0x9F8C, 0x6C8D, - 0x9F8D, 0x6C9A, 0x9F8E, 0x6C81, 0x9F8F, 0x6C9B, 0x9F90, 0x6C7E, - 0x9F91, 0x6C68, 0x9F92, 0x6C73, 0x9F93, 0x6C92, 0x9F94, 0x6C90, - 0x9F95, 0x6CC4, 0x9F96, 0x6CF1, 0x9F97, 0x6CD3, 0x9F98, 0x6CBD, - 0x9F99, 0x6CD7, 0x9F9A, 0x6CC5, 0x9F9B, 0x6CDD, 0x9F9C, 0x6CAE, - 0x9F9D, 0x6CB1, 0x9F9E, 0x6CBE, 0x9F9F, 0x6CBA, 0x9FA0, 0x6CDB, - 0x9FA1, 0x6CEF, 0x9FA2, 0x6CD9, 0x9FA3, 0x6CEA, 0x9FA4, 0x6D1F, - 0x9FA5, 0x884D, 0x9FA6, 0x6D36, 0x9FA7, 0x6D2B, 0x9FA8, 0x6D3D, - 0x9FA9, 0x6D38, 0x9FAA, 0x6D19, 0x9FAB, 0x6D35, 0x9FAC, 0x6D33, - 0x9FAD, 0x6D12, 0x9FAE, 0x6D0C, 0x9FAF, 0x6D63, 0x9FB0, 0x6D93, - 0x9FB1, 0x6D64, 0x9FB2, 0x6D5A, 0x9FB3, 0x6D79, 0x9FB4, 0x6D59, - 0x9FB5, 0x6D8E, 0x9FB6, 0x6D95, 0x9FB7, 0x6FE4, 0x9FB8, 0x6D85, - 0x9FB9, 0x6DF9, 0x9FBA, 0x6E15, 0x9FBB, 0x6E0A, 0x9FBC, 0x6DB5, - 0x9FBD, 0x6DC7, 0x9FBE, 0x6DE6, 0x9FBF, 0x6DB8, 0x9FC0, 0x6DC6, - 0x9FC1, 0x6DEC, 0x9FC2, 0x6DDE, 0x9FC3, 0x6DCC, 0x9FC4, 0x6DE8, - 0x9FC5, 0x6DD2, 0x9FC6, 0x6DC5, 0x9FC7, 0x6DFA, 0x9FC8, 0x6DD9, - 0x9FC9, 0x6DE4, 0x9FCA, 0x6DD5, 0x9FCB, 0x6DEA, 0x9FCC, 0x6DEE, - 0x9FCD, 0x6E2D, 0x9FCE, 0x6E6E, 0x9FCF, 0x6E2E, 0x9FD0, 0x6E19, - 0x9FD1, 0x6E72, 0x9FD2, 0x6E5F, 0x9FD3, 0x6E3E, 0x9FD4, 0x6E23, - 0x9FD5, 0x6E6B, 0x9FD6, 0x6E2B, 0x9FD7, 0x6E76, 0x9FD8, 0x6E4D, - 0x9FD9, 0x6E1F, 0x9FDA, 0x6E43, 0x9FDB, 0x6E3A, 0x9FDC, 0x6E4E, - 0x9FDD, 0x6E24, 0x9FDE, 0x6EFF, 0x9FDF, 0x6E1D, 0x9FE0, 0x6E38, - 0x9FE1, 0x6E82, 0x9FE2, 0x6EAA, 0x9FE3, 0x6E98, 0x9FE4, 0x6EC9, - 0x9FE5, 0x6EB7, 0x9FE6, 0x6ED3, 0x9FE7, 0x6EBD, 0x9FE8, 0x6EAF, - 0x9FE9, 0x6EC4, 0x9FEA, 0x6EB2, 0x9FEB, 0x6ED4, 0x9FEC, 0x6ED5, - 0x9FED, 0x6E8F, 0x9FEE, 0x6EA5, 0x9FEF, 0x6EC2, 0x9FF0, 0x6E9F, - 0x9FF1, 0x6F41, 0x9FF2, 0x6F11, 0x9FF3, 0x704C, 0x9FF4, 0x6EEC, - 0x9FF5, 0x6EF8, 0x9FF6, 0x6EFE, 0x9FF7, 0x6F3F, 0x9FF8, 0x6EF2, - 0x9FF9, 0x6F31, 0x9FFA, 0x6EEF, 0x9FFB, 0x6F32, 0x9FFC, 0x6ECC, - 0xE040, 0x6F3E, 0xE041, 0x6F13, 0xE042, 0x6EF7, 0xE043, 0x6F86, - 0xE044, 0x6F7A, 0xE045, 0x6F78, 0xE046, 0x6F81, 0xE047, 0x6F80, - 0xE048, 0x6F6F, 0xE049, 0x6F5B, 0xE04A, 0x6FF3, 0xE04B, 0x6F6D, - 0xE04C, 0x6F82, 0xE04D, 0x6F7C, 0xE04E, 0x6F58, 0xE04F, 0x6F8E, - 0xE050, 0x6F91, 0xE051, 0x6FC2, 0xE052, 0x6F66, 0xE053, 0x6FB3, - 0xE054, 0x6FA3, 0xE055, 0x6FA1, 0xE056, 0x6FA4, 0xE057, 0x6FB9, - 0xE058, 0x6FC6, 0xE059, 0x6FAA, 0xE05A, 0x6FDF, 0xE05B, 0x6FD5, - 0xE05C, 0x6FEC, 0xE05D, 0x6FD4, 0xE05E, 0x6FD8, 0xE05F, 0x6FF1, - 0xE060, 0x6FEE, 0xE061, 0x6FDB, 0xE062, 0x7009, 0xE063, 0x700B, - 0xE064, 0x6FFA, 0xE065, 0x7011, 0xE066, 0x7001, 0xE067, 0x700F, - 0xE068, 0x6FFE, 0xE069, 0x701B, 0xE06A, 0x701A, 0xE06B, 0x6F74, - 0xE06C, 0x701D, 0xE06D, 0x7018, 0xE06E, 0x701F, 0xE06F, 0x7030, - 0xE070, 0x703E, 0xE071, 0x7032, 0xE072, 0x7051, 0xE073, 0x7063, - 0xE074, 0x7099, 0xE075, 0x7092, 0xE076, 0x70AF, 0xE077, 0x70F1, - 0xE078, 0x70AC, 0xE079, 0x70B8, 0xE07A, 0x70B3, 0xE07B, 0x70AE, - 0xE07C, 0x70DF, 0xE07D, 0x70CB, 0xE07E, 0x70DD, 0xE080, 0x70D9, - 0xE081, 0x7109, 0xE082, 0x70FD, 0xE083, 0x711C, 0xE084, 0x7119, - 0xE085, 0x7165, 0xE086, 0x7155, 0xE087, 0x7188, 0xE088, 0x7166, - 0xE089, 0x7162, 0xE08A, 0x714C, 0xE08B, 0x7156, 0xE08C, 0x716C, - 0xE08D, 0x718F, 0xE08E, 0x71FB, 0xE08F, 0x7184, 0xE090, 0x7195, - 0xE091, 0x71A8, 0xE092, 0x71AC, 0xE093, 0x71D7, 0xE094, 0x71B9, - 0xE095, 0x71BE, 0xE096, 0x71D2, 0xE097, 0x71C9, 0xE098, 0x71D4, - 0xE099, 0x71CE, 0xE09A, 0x71E0, 0xE09B, 0x71EC, 0xE09C, 0x71E7, - 0xE09D, 0x71F5, 0xE09E, 0x71FC, 0xE09F, 0x71F9, 0xE0A0, 0x71FF, - 0xE0A1, 0x720D, 0xE0A2, 0x7210, 0xE0A3, 0x721B, 0xE0A4, 0x7228, - 0xE0A5, 0x722D, 0xE0A6, 0x722C, 0xE0A7, 0x7230, 0xE0A8, 0x7232, - 0xE0A9, 0x723B, 0xE0AA, 0x723C, 0xE0AB, 0x723F, 0xE0AC, 0x7240, - 0xE0AD, 0x7246, 0xE0AE, 0x724B, 0xE0AF, 0x7258, 0xE0B0, 0x7274, - 0xE0B1, 0x727E, 0xE0B2, 0x7282, 0xE0B3, 0x7281, 0xE0B4, 0x7287, - 0xE0B5, 0x7292, 0xE0B6, 0x7296, 0xE0B7, 0x72A2, 0xE0B8, 0x72A7, - 0xE0B9, 0x72B9, 0xE0BA, 0x72B2, 0xE0BB, 0x72C3, 0xE0BC, 0x72C6, - 0xE0BD, 0x72C4, 0xE0BE, 0x72CE, 0xE0BF, 0x72D2, 0xE0C0, 0x72E2, - 0xE0C1, 0x72E0, 0xE0C2, 0x72E1, 0xE0C3, 0x72F9, 0xE0C4, 0x72F7, - 0xE0C5, 0x500F, 0xE0C6, 0x7317, 0xE0C7, 0x730A, 0xE0C8, 0x731C, - 0xE0C9, 0x7316, 0xE0CA, 0x731D, 0xE0CB, 0x7334, 0xE0CC, 0x732F, - 0xE0CD, 0x7329, 0xE0CE, 0x7325, 0xE0CF, 0x733E, 0xE0D0, 0x734E, - 0xE0D1, 0x734F, 0xE0D2, 0x9ED8, 0xE0D3, 0x7357, 0xE0D4, 0x736A, - 0xE0D5, 0x7368, 0xE0D6, 0x7370, 0xE0D7, 0x7378, 0xE0D8, 0x7375, - 0xE0D9, 0x737B, 0xE0DA, 0x737A, 0xE0DB, 0x73C8, 0xE0DC, 0x73B3, - 0xE0DD, 0x73CE, 0xE0DE, 0x73BB, 0xE0DF, 0x73C0, 0xE0E0, 0x73E5, - 0xE0E1, 0x73EE, 0xE0E2, 0x73DE, 0xE0E3, 0x74A2, 0xE0E4, 0x7405, - 0xE0E5, 0x746F, 0xE0E6, 0x7425, 0xE0E7, 0x73F8, 0xE0E8, 0x7432, - 0xE0E9, 0x743A, 0xE0EA, 0x7455, 0xE0EB, 0x743F, 0xE0EC, 0x745F, - 0xE0ED, 0x7459, 0xE0EE, 0x7441, 0xE0EF, 0x745C, 0xE0F0, 0x7469, - 0xE0F1, 0x7470, 0xE0F2, 0x7463, 0xE0F3, 0x746A, 0xE0F4, 0x7476, - 0xE0F5, 0x747E, 0xE0F6, 0x748B, 0xE0F7, 0x749E, 0xE0F8, 0x74A7, - 0xE0F9, 0x74CA, 0xE0FA, 0x74CF, 0xE0FB, 0x74D4, 0xE0FC, 0x73F1, - 0xE140, 0x74E0, 0xE141, 0x74E3, 0xE142, 0x74E7, 0xE143, 0x74E9, - 0xE144, 0x74EE, 0xE145, 0x74F2, 0xE146, 0x74F0, 0xE147, 0x74F1, - 0xE148, 0x74F8, 0xE149, 0x74F7, 0xE14A, 0x7504, 0xE14B, 0x7503, - 0xE14C, 0x7505, 0xE14D, 0x750C, 0xE14E, 0x750E, 0xE14F, 0x750D, - 0xE150, 0x7515, 0xE151, 0x7513, 0xE152, 0x751E, 0xE153, 0x7526, - 0xE154, 0x752C, 0xE155, 0x753C, 0xE156, 0x7544, 0xE157, 0x754D, - 0xE158, 0x754A, 0xE159, 0x7549, 0xE15A, 0x755B, 0xE15B, 0x7546, - 0xE15C, 0x755A, 0xE15D, 0x7569, 0xE15E, 0x7564, 0xE15F, 0x7567, - 0xE160, 0x756B, 0xE161, 0x756D, 0xE162, 0x7578, 0xE163, 0x7576, - 0xE164, 0x7586, 0xE165, 0x7587, 0xE166, 0x7574, 0xE167, 0x758A, - 0xE168, 0x7589, 0xE169, 0x7582, 0xE16A, 0x7594, 0xE16B, 0x759A, - 0xE16C, 0x759D, 0xE16D, 0x75A5, 0xE16E, 0x75A3, 0xE16F, 0x75C2, - 0xE170, 0x75B3, 0xE171, 0x75C3, 0xE172, 0x75B5, 0xE173, 0x75BD, - 0xE174, 0x75B8, 0xE175, 0x75BC, 0xE176, 0x75B1, 0xE177, 0x75CD, - 0xE178, 0x75CA, 0xE179, 0x75D2, 0xE17A, 0x75D9, 0xE17B, 0x75E3, - 0xE17C, 0x75DE, 0xE17D, 0x75FE, 0xE17E, 0x75FF, 0xE180, 0x75FC, - 0xE181, 0x7601, 0xE182, 0x75F0, 0xE183, 0x75FA, 0xE184, 0x75F2, - 0xE185, 0x75F3, 0xE186, 0x760B, 0xE187, 0x760D, 0xE188, 0x7609, - 0xE189, 0x761F, 0xE18A, 0x7627, 0xE18B, 0x7620, 0xE18C, 0x7621, - 0xE18D, 0x7622, 0xE18E, 0x7624, 0xE18F, 0x7634, 0xE190, 0x7630, - 0xE191, 0x763B, 0xE192, 0x7647, 0xE193, 0x7648, 0xE194, 0x7646, - 0xE195, 0x765C, 0xE196, 0x7658, 0xE197, 0x7661, 0xE198, 0x7662, - 0xE199, 0x7668, 0xE19A, 0x7669, 0xE19B, 0x766A, 0xE19C, 0x7667, - 0xE19D, 0x766C, 0xE19E, 0x7670, 0xE19F, 0x7672, 0xE1A0, 0x7676, - 0xE1A1, 0x7678, 0xE1A2, 0x767C, 0xE1A3, 0x7680, 0xE1A4, 0x7683, - 0xE1A5, 0x7688, 0xE1A6, 0x768B, 0xE1A7, 0x768E, 0xE1A8, 0x7696, - 0xE1A9, 0x7693, 0xE1AA, 0x7699, 0xE1AB, 0x769A, 0xE1AC, 0x76B0, - 0xE1AD, 0x76B4, 0xE1AE, 0x76B8, 0xE1AF, 0x76B9, 0xE1B0, 0x76BA, - 0xE1B1, 0x76C2, 0xE1B2, 0x76CD, 0xE1B3, 0x76D6, 0xE1B4, 0x76D2, - 0xE1B5, 0x76DE, 0xE1B6, 0x76E1, 0xE1B7, 0x76E5, 0xE1B8, 0x76E7, - 0xE1B9, 0x76EA, 0xE1BA, 0x862F, 0xE1BB, 0x76FB, 0xE1BC, 0x7708, - 0xE1BD, 0x7707, 0xE1BE, 0x7704, 0xE1BF, 0x7729, 0xE1C0, 0x7724, - 0xE1C1, 0x771E, 0xE1C2, 0x7725, 0xE1C3, 0x7726, 0xE1C4, 0x771B, - 0xE1C5, 0x7737, 0xE1C6, 0x7738, 0xE1C7, 0x7747, 0xE1C8, 0x775A, - 0xE1C9, 0x7768, 0xE1CA, 0x776B, 0xE1CB, 0x775B, 0xE1CC, 0x7765, - 0xE1CD, 0x777F, 0xE1CE, 0x777E, 0xE1CF, 0x7779, 0xE1D0, 0x778E, - 0xE1D1, 0x778B, 0xE1D2, 0x7791, 0xE1D3, 0x77A0, 0xE1D4, 0x779E, - 0xE1D5, 0x77B0, 0xE1D6, 0x77B6, 0xE1D7, 0x77B9, 0xE1D8, 0x77BF, - 0xE1D9, 0x77BC, 0xE1DA, 0x77BD, 0xE1DB, 0x77BB, 0xE1DC, 0x77C7, - 0xE1DD, 0x77CD, 0xE1DE, 0x77D7, 0xE1DF, 0x77DA, 0xE1E0, 0x77DC, - 0xE1E1, 0x77E3, 0xE1E2, 0x77EE, 0xE1E3, 0x77FC, 0xE1E4, 0x780C, - 0xE1E5, 0x7812, 0xE1E6, 0x7926, 0xE1E7, 0x7820, 0xE1E8, 0x792A, - 0xE1E9, 0x7845, 0xE1EA, 0x788E, 0xE1EB, 0x7874, 0xE1EC, 0x7886, - 0xE1ED, 0x787C, 0xE1EE, 0x789A, 0xE1EF, 0x788C, 0xE1F0, 0x78A3, - 0xE1F1, 0x78B5, 0xE1F2, 0x78AA, 0xE1F3, 0x78AF, 0xE1F4, 0x78D1, - 0xE1F5, 0x78C6, 0xE1F6, 0x78CB, 0xE1F7, 0x78D4, 0xE1F8, 0x78BE, - 0xE1F9, 0x78BC, 0xE1FA, 0x78C5, 0xE1FB, 0x78CA, 0xE1FC, 0x78EC, - 0xE240, 0x78E7, 0xE241, 0x78DA, 0xE242, 0x78FD, 0xE243, 0x78F4, - 0xE244, 0x7907, 0xE245, 0x7912, 0xE246, 0x7911, 0xE247, 0x7919, - 0xE248, 0x792C, 0xE249, 0x792B, 0xE24A, 0x7940, 0xE24B, 0x7960, - 0xE24C, 0x7957, 0xE24D, 0x795F, 0xE24E, 0x795A, 0xE24F, 0x7955, - 0xE250, 0x7953, 0xE251, 0x797A, 0xE252, 0x797F, 0xE253, 0x798A, - 0xE254, 0x799D, 0xE255, 0x79A7, 0xE256, 0x9F4B, 0xE257, 0x79AA, - 0xE258, 0x79AE, 0xE259, 0x79B3, 0xE25A, 0x79B9, 0xE25B, 0x79BA, - 0xE25C, 0x79C9, 0xE25D, 0x79D5, 0xE25E, 0x79E7, 0xE25F, 0x79EC, - 0xE260, 0x79E1, 0xE261, 0x79E3, 0xE262, 0x7A08, 0xE263, 0x7A0D, - 0xE264, 0x7A18, 0xE265, 0x7A19, 0xE266, 0x7A20, 0xE267, 0x7A1F, - 0xE268, 0x7980, 0xE269, 0x7A31, 0xE26A, 0x7A3B, 0xE26B, 0x7A3E, - 0xE26C, 0x7A37, 0xE26D, 0x7A43, 0xE26E, 0x7A57, 0xE26F, 0x7A49, - 0xE270, 0x7A61, 0xE271, 0x7A62, 0xE272, 0x7A69, 0xE273, 0x9F9D, - 0xE274, 0x7A70, 0xE275, 0x7A79, 0xE276, 0x7A7D, 0xE277, 0x7A88, - 0xE278, 0x7A97, 0xE279, 0x7A95, 0xE27A, 0x7A98, 0xE27B, 0x7A96, - 0xE27C, 0x7AA9, 0xE27D, 0x7AC8, 0xE27E, 0x7AB0, 0xE280, 0x7AB6, - 0xE281, 0x7AC5, 0xE282, 0x7AC4, 0xE283, 0x7ABF, 0xE284, 0x9083, - 0xE285, 0x7AC7, 0xE286, 0x7ACA, 0xE287, 0x7ACD, 0xE288, 0x7ACF, - 0xE289, 0x7AD5, 0xE28A, 0x7AD3, 0xE28B, 0x7AD9, 0xE28C, 0x7ADA, - 0xE28D, 0x7ADD, 0xE28E, 0x7AE1, 0xE28F, 0x7AE2, 0xE290, 0x7AE6, - 0xE291, 0x7AED, 0xE292, 0x7AF0, 0xE293, 0x7B02, 0xE294, 0x7B0F, - 0xE295, 0x7B0A, 0xE296, 0x7B06, 0xE297, 0x7B33, 0xE298, 0x7B18, - 0xE299, 0x7B19, 0xE29A, 0x7B1E, 0xE29B, 0x7B35, 0xE29C, 0x7B28, - 0xE29D, 0x7B36, 0xE29E, 0x7B50, 0xE29F, 0x7B7A, 0xE2A0, 0x7B04, - 0xE2A1, 0x7B4D, 0xE2A2, 0x7B0B, 0xE2A3, 0x7B4C, 0xE2A4, 0x7B45, - 0xE2A5, 0x7B75, 0xE2A6, 0x7B65, 0xE2A7, 0x7B74, 0xE2A8, 0x7B67, - 0xE2A9, 0x7B70, 0xE2AA, 0x7B71, 0xE2AB, 0x7B6C, 0xE2AC, 0x7B6E, - 0xE2AD, 0x7B9D, 0xE2AE, 0x7B98, 0xE2AF, 0x7B9F, 0xE2B0, 0x7B8D, - 0xE2B1, 0x7B9C, 0xE2B2, 0x7B9A, 0xE2B3, 0x7B8B, 0xE2B4, 0x7B92, - 0xE2B5, 0x7B8F, 0xE2B6, 0x7B5D, 0xE2B7, 0x7B99, 0xE2B8, 0x7BCB, - 0xE2B9, 0x7BC1, 0xE2BA, 0x7BCC, 0xE2BB, 0x7BCF, 0xE2BC, 0x7BB4, - 0xE2BD, 0x7BC6, 0xE2BE, 0x7BDD, 0xE2BF, 0x7BE9, 0xE2C0, 0x7C11, - 0xE2C1, 0x7C14, 0xE2C2, 0x7BE6, 0xE2C3, 0x7BE5, 0xE2C4, 0x7C60, - 0xE2C5, 0x7C00, 0xE2C6, 0x7C07, 0xE2C7, 0x7C13, 0xE2C8, 0x7BF3, - 0xE2C9, 0x7BF7, 0xE2CA, 0x7C17, 0xE2CB, 0x7C0D, 0xE2CC, 0x7BF6, - 0xE2CD, 0x7C23, 0xE2CE, 0x7C27, 0xE2CF, 0x7C2A, 0xE2D0, 0x7C1F, - 0xE2D1, 0x7C37, 0xE2D2, 0x7C2B, 0xE2D3, 0x7C3D, 0xE2D4, 0x7C4C, - 0xE2D5, 0x7C43, 0xE2D6, 0x7C54, 0xE2D7, 0x7C4F, 0xE2D8, 0x7C40, - 0xE2D9, 0x7C50, 0xE2DA, 0x7C58, 0xE2DB, 0x7C5F, 0xE2DC, 0x7C64, - 0xE2DD, 0x7C56, 0xE2DE, 0x7C65, 0xE2DF, 0x7C6C, 0xE2E0, 0x7C75, - 0xE2E1, 0x7C83, 0xE2E2, 0x7C90, 0xE2E3, 0x7CA4, 0xE2E4, 0x7CAD, - 0xE2E5, 0x7CA2, 0xE2E6, 0x7CAB, 0xE2E7, 0x7CA1, 0xE2E8, 0x7CA8, - 0xE2E9, 0x7CB3, 0xE2EA, 0x7CB2, 0xE2EB, 0x7CB1, 0xE2EC, 0x7CAE, - 0xE2ED, 0x7CB9, 0xE2EE, 0x7CBD, 0xE2EF, 0x7CC0, 0xE2F0, 0x7CC5, - 0xE2F1, 0x7CC2, 0xE2F2, 0x7CD8, 0xE2F3, 0x7CD2, 0xE2F4, 0x7CDC, - 0xE2F5, 0x7CE2, 0xE2F6, 0x9B3B, 0xE2F7, 0x7CEF, 0xE2F8, 0x7CF2, - 0xE2F9, 0x7CF4, 0xE2FA, 0x7CF6, 0xE2FB, 0x7CFA, 0xE2FC, 0x7D06, - 0xE340, 0x7D02, 0xE341, 0x7D1C, 0xE342, 0x7D15, 0xE343, 0x7D0A, - 0xE344, 0x7D45, 0xE345, 0x7D4B, 0xE346, 0x7D2E, 0xE347, 0x7D32, - 0xE348, 0x7D3F, 0xE349, 0x7D35, 0xE34A, 0x7D46, 0xE34B, 0x7D73, - 0xE34C, 0x7D56, 0xE34D, 0x7D4E, 0xE34E, 0x7D72, 0xE34F, 0x7D68, - 0xE350, 0x7D6E, 0xE351, 0x7D4F, 0xE352, 0x7D63, 0xE353, 0x7D93, - 0xE354, 0x7D89, 0xE355, 0x7D5B, 0xE356, 0x7D8F, 0xE357, 0x7D7D, - 0xE358, 0x7D9B, 0xE359, 0x7DBA, 0xE35A, 0x7DAE, 0xE35B, 0x7DA3, - 0xE35C, 0x7DB5, 0xE35D, 0x7DC7, 0xE35E, 0x7DBD, 0xE35F, 0x7DAB, - 0xE360, 0x7E3D, 0xE361, 0x7DA2, 0xE362, 0x7DAF, 0xE363, 0x7DDC, - 0xE364, 0x7DB8, 0xE365, 0x7D9F, 0xE366, 0x7DB0, 0xE367, 0x7DD8, - 0xE368, 0x7DDD, 0xE369, 0x7DE4, 0xE36A, 0x7DDE, 0xE36B, 0x7DFB, - 0xE36C, 0x7DF2, 0xE36D, 0x7DE1, 0xE36E, 0x7E05, 0xE36F, 0x7E0A, - 0xE370, 0x7E23, 0xE371, 0x7E21, 0xE372, 0x7E12, 0xE373, 0x7E31, - 0xE374, 0x7E1F, 0xE375, 0x7E09, 0xE376, 0x7E0B, 0xE377, 0x7E22, - 0xE378, 0x7E46, 0xE379, 0x7E66, 0xE37A, 0x7E3B, 0xE37B, 0x7E35, - 0xE37C, 0x7E39, 0xE37D, 0x7E43, 0xE37E, 0x7E37, 0xE380, 0x7E32, - 0xE381, 0x7E3A, 0xE382, 0x7E67, 0xE383, 0x7E5D, 0xE384, 0x7E56, - 0xE385, 0x7E5E, 0xE386, 0x7E59, 0xE387, 0x7E5A, 0xE388, 0x7E79, - 0xE389, 0x7E6A, 0xE38A, 0x7E69, 0xE38B, 0x7E7C, 0xE38C, 0x7E7B, - 0xE38D, 0x7E83, 0xE38E, 0x7DD5, 0xE38F, 0x7E7D, 0xE390, 0x8FAE, - 0xE391, 0x7E7F, 0xE392, 0x7E88, 0xE393, 0x7E89, 0xE394, 0x7E8C, - 0xE395, 0x7E92, 0xE396, 0x7E90, 0xE397, 0x7E93, 0xE398, 0x7E94, - 0xE399, 0x7E96, 0xE39A, 0x7E8E, 0xE39B, 0x7E9B, 0xE39C, 0x7E9C, - 0xE39D, 0x7F38, 0xE39E, 0x7F3A, 0xE39F, 0x7F45, 0xE3A0, 0x7F4C, - 0xE3A1, 0x7F4D, 0xE3A2, 0x7F4E, 0xE3A3, 0x7F50, 0xE3A4, 0x7F51, - 0xE3A5, 0x7F55, 0xE3A6, 0x7F54, 0xE3A7, 0x7F58, 0xE3A8, 0x7F5F, - 0xE3A9, 0x7F60, 0xE3AA, 0x7F68, 0xE3AB, 0x7F69, 0xE3AC, 0x7F67, - 0xE3AD, 0x7F78, 0xE3AE, 0x7F82, 0xE3AF, 0x7F86, 0xE3B0, 0x7F83, - 0xE3B1, 0x7F88, 0xE3B2, 0x7F87, 0xE3B3, 0x7F8C, 0xE3B4, 0x7F94, - 0xE3B5, 0x7F9E, 0xE3B6, 0x7F9D, 0xE3B7, 0x7F9A, 0xE3B8, 0x7FA3, - 0xE3B9, 0x7FAF, 0xE3BA, 0x7FB2, 0xE3BB, 0x7FB9, 0xE3BC, 0x7FAE, - 0xE3BD, 0x7FB6, 0xE3BE, 0x7FB8, 0xE3BF, 0x8B71, 0xE3C0, 0x7FC5, - 0xE3C1, 0x7FC6, 0xE3C2, 0x7FCA, 0xE3C3, 0x7FD5, 0xE3C4, 0x7FD4, - 0xE3C5, 0x7FE1, 0xE3C6, 0x7FE6, 0xE3C7, 0x7FE9, 0xE3C8, 0x7FF3, - 0xE3C9, 0x7FF9, 0xE3CA, 0x98DC, 0xE3CB, 0x8006, 0xE3CC, 0x8004, - 0xE3CD, 0x800B, 0xE3CE, 0x8012, 0xE3CF, 0x8018, 0xE3D0, 0x8019, - 0xE3D1, 0x801C, 0xE3D2, 0x8021, 0xE3D3, 0x8028, 0xE3D4, 0x803F, - 0xE3D5, 0x803B, 0xE3D6, 0x804A, 0xE3D7, 0x8046, 0xE3D8, 0x8052, - 0xE3D9, 0x8058, 0xE3DA, 0x805A, 0xE3DB, 0x805F, 0xE3DC, 0x8062, - 0xE3DD, 0x8068, 0xE3DE, 0x8073, 0xE3DF, 0x8072, 0xE3E0, 0x8070, - 0xE3E1, 0x8076, 0xE3E2, 0x8079, 0xE3E3, 0x807D, 0xE3E4, 0x807F, - 0xE3E5, 0x8084, 0xE3E6, 0x8086, 0xE3E7, 0x8085, 0xE3E8, 0x809B, - 0xE3E9, 0x8093, 0xE3EA, 0x809A, 0xE3EB, 0x80AD, 0xE3EC, 0x5190, - 0xE3ED, 0x80AC, 0xE3EE, 0x80DB, 0xE3EF, 0x80E5, 0xE3F0, 0x80D9, - 0xE3F1, 0x80DD, 0xE3F2, 0x80C4, 0xE3F3, 0x80DA, 0xE3F4, 0x80D6, - 0xE3F5, 0x8109, 0xE3F6, 0x80EF, 0xE3F7, 0x80F1, 0xE3F8, 0x811B, - 0xE3F9, 0x8129, 0xE3FA, 0x8123, 0xE3FB, 0x812F, 0xE3FC, 0x814B, - 0xE440, 0x968B, 0xE441, 0x8146, 0xE442, 0x813E, 0xE443, 0x8153, - 0xE444, 0x8151, 0xE445, 0x80FC, 0xE446, 0x8171, 0xE447, 0x816E, - 0xE448, 0x8165, 0xE449, 0x8166, 0xE44A, 0x8174, 0xE44B, 0x8183, - 0xE44C, 0x8188, 0xE44D, 0x818A, 0xE44E, 0x8180, 0xE44F, 0x8182, - 0xE450, 0x81A0, 0xE451, 0x8195, 0xE452, 0x81A4, 0xE453, 0x81A3, - 0xE454, 0x815F, 0xE455, 0x8193, 0xE456, 0x81A9, 0xE457, 0x81B0, - 0xE458, 0x81B5, 0xE459, 0x81BE, 0xE45A, 0x81B8, 0xE45B, 0x81BD, - 0xE45C, 0x81C0, 0xE45D, 0x81C2, 0xE45E, 0x81BA, 0xE45F, 0x81C9, - 0xE460, 0x81CD, 0xE461, 0x81D1, 0xE462, 0x81D9, 0xE463, 0x81D8, - 0xE464, 0x81C8, 0xE465, 0x81DA, 0xE466, 0x81DF, 0xE467, 0x81E0, - 0xE468, 0x81E7, 0xE469, 0x81FA, 0xE46A, 0x81FB, 0xE46B, 0x81FE, - 0xE46C, 0x8201, 0xE46D, 0x8202, 0xE46E, 0x8205, 0xE46F, 0x8207, - 0xE470, 0x820A, 0xE471, 0x820D, 0xE472, 0x8210, 0xE473, 0x8216, - 0xE474, 0x8229, 0xE475, 0x822B, 0xE476, 0x8238, 0xE477, 0x8233, - 0xE478, 0x8240, 0xE479, 0x8259, 0xE47A, 0x8258, 0xE47B, 0x825D, - 0xE47C, 0x825A, 0xE47D, 0x825F, 0xE47E, 0x8264, 0xE480, 0x8262, - 0xE481, 0x8268, 0xE482, 0x826A, 0xE483, 0x826B, 0xE484, 0x822E, - 0xE485, 0x8271, 0xE486, 0x8277, 0xE487, 0x8278, 0xE488, 0x827E, - 0xE489, 0x828D, 0xE48A, 0x8292, 0xE48B, 0x82AB, 0xE48C, 0x829F, - 0xE48D, 0x82BB, 0xE48E, 0x82AC, 0xE48F, 0x82E1, 0xE490, 0x82E3, - 0xE491, 0x82DF, 0xE492, 0x82D2, 0xE493, 0x82F4, 0xE494, 0x82F3, - 0xE495, 0x82FA, 0xE496, 0x8393, 0xE497, 0x8303, 0xE498, 0x82FB, - 0xE499, 0x82F9, 0xE49A, 0x82DE, 0xE49B, 0x8306, 0xE49C, 0x82DC, - 0xE49D, 0x8309, 0xE49E, 0x82D9, 0xE49F, 0x8335, 0xE4A0, 0x8334, - 0xE4A1, 0x8316, 0xE4A2, 0x8332, 0xE4A3, 0x8331, 0xE4A4, 0x8340, - 0xE4A5, 0x8339, 0xE4A6, 0x8350, 0xE4A7, 0x8345, 0xE4A8, 0x832F, - 0xE4A9, 0x832B, 0xE4AA, 0x8317, 0xE4AB, 0x8318, 0xE4AC, 0x8385, - 0xE4AD, 0x839A, 0xE4AE, 0x83AA, 0xE4AF, 0x839F, 0xE4B0, 0x83A2, - 0xE4B1, 0x8396, 0xE4B2, 0x8323, 0xE4B3, 0x838E, 0xE4B4, 0x8387, - 0xE4B5, 0x838A, 0xE4B6, 0x837C, 0xE4B7, 0x83B5, 0xE4B8, 0x8373, - 0xE4B9, 0x8375, 0xE4BA, 0x83A0, 0xE4BB, 0x8389, 0xE4BC, 0x83A8, - 0xE4BD, 0x83F4, 0xE4BE, 0x8413, 0xE4BF, 0x83EB, 0xE4C0, 0x83CE, - 0xE4C1, 0x83FD, 0xE4C2, 0x8403, 0xE4C3, 0x83D8, 0xE4C4, 0x840B, - 0xE4C5, 0x83C1, 0xE4C6, 0x83F7, 0xE4C7, 0x8407, 0xE4C8, 0x83E0, - 0xE4C9, 0x83F2, 0xE4CA, 0x840D, 0xE4CB, 0x8422, 0xE4CC, 0x8420, - 0xE4CD, 0x83BD, 0xE4CE, 0x8438, 0xE4CF, 0x8506, 0xE4D0, 0x83FB, - 0xE4D1, 0x846D, 0xE4D2, 0x842A, 0xE4D3, 0x843C, 0xE4D4, 0x855A, - 0xE4D5, 0x8484, 0xE4D6, 0x8477, 0xE4D7, 0x846B, 0xE4D8, 0x84AD, - 0xE4D9, 0x846E, 0xE4DA, 0x8482, 0xE4DB, 0x8469, 0xE4DC, 0x8446, - 0xE4DD, 0x842C, 0xE4DE, 0x846F, 0xE4DF, 0x8479, 0xE4E0, 0x8435, - 0xE4E1, 0x84CA, 0xE4E2, 0x8462, 0xE4E3, 0x84B9, 0xE4E4, 0x84BF, - 0xE4E5, 0x849F, 0xE4E6, 0x84D9, 0xE4E7, 0x84CD, 0xE4E8, 0x84BB, - 0xE4E9, 0x84DA, 0xE4EA, 0x84D0, 0xE4EB, 0x84C1, 0xE4EC, 0x84C6, - 0xE4ED, 0x84D6, 0xE4EE, 0x84A1, 0xE4EF, 0x8521, 0xE4F0, 0x84FF, - 0xE4F1, 0x84F4, 0xE4F2, 0x8517, 0xE4F3, 0x8518, 0xE4F4, 0x852C, - 0xE4F5, 0x851F, 0xE4F6, 0x8515, 0xE4F7, 0x8514, 0xE4F8, 0x84FC, - 0xE4F9, 0x8540, 0xE4FA, 0x8563, 0xE4FB, 0x8558, 0xE4FC, 0x8548, - 0xE540, 0x8541, 0xE541, 0x8602, 0xE542, 0x854B, 0xE543, 0x8555, - 0xE544, 0x8580, 0xE545, 0x85A4, 0xE546, 0x8588, 0xE547, 0x8591, - 0xE548, 0x858A, 0xE549, 0x85A8, 0xE54A, 0x856D, 0xE54B, 0x8594, - 0xE54C, 0x859B, 0xE54D, 0x85EA, 0xE54E, 0x8587, 0xE54F, 0x859C, - 0xE550, 0x8577, 0xE551, 0x857E, 0xE552, 0x8590, 0xE553, 0x85C9, - 0xE554, 0x85BA, 0xE555, 0x85CF, 0xE556, 0x85B9, 0xE557, 0x85D0, - 0xE558, 0x85D5, 0xE559, 0x85DD, 0xE55A, 0x85E5, 0xE55B, 0x85DC, - 0xE55C, 0x85F9, 0xE55D, 0x860A, 0xE55E, 0x8613, 0xE55F, 0x860B, - 0xE560, 0x85FE, 0xE561, 0x85FA, 0xE562, 0x8606, 0xE563, 0x8622, - 0xE564, 0x861A, 0xE565, 0x8630, 0xE566, 0x863F, 0xE567, 0x864D, - 0xE568, 0x4E55, 0xE569, 0x8654, 0xE56A, 0x865F, 0xE56B, 0x8667, - 0xE56C, 0x8671, 0xE56D, 0x8693, 0xE56E, 0x86A3, 0xE56F, 0x86A9, - 0xE570, 0x86AA, 0xE571, 0x868B, 0xE572, 0x868C, 0xE573, 0x86B6, - 0xE574, 0x86AF, 0xE575, 0x86C4, 0xE576, 0x86C6, 0xE577, 0x86B0, - 0xE578, 0x86C9, 0xE579, 0x8823, 0xE57A, 0x86AB, 0xE57B, 0x86D4, - 0xE57C, 0x86DE, 0xE57D, 0x86E9, 0xE57E, 0x86EC, 0xE580, 0x86DF, - 0xE581, 0x86DB, 0xE582, 0x86EF, 0xE583, 0x8712, 0xE584, 0x8706, - 0xE585, 0x8708, 0xE586, 0x8700, 0xE587, 0x8703, 0xE588, 0x86FB, - 0xE589, 0x8711, 0xE58A, 0x8709, 0xE58B, 0x870D, 0xE58C, 0x86F9, - 0xE58D, 0x870A, 0xE58E, 0x8734, 0xE58F, 0x873F, 0xE590, 0x8737, - 0xE591, 0x873B, 0xE592, 0x8725, 0xE593, 0x8729, 0xE594, 0x871A, - 0xE595, 0x8760, 0xE596, 0x875F, 0xE597, 0x8778, 0xE598, 0x874C, - 0xE599, 0x874E, 0xE59A, 0x8774, 0xE59B, 0x8757, 0xE59C, 0x8768, - 0xE59D, 0x876E, 0xE59E, 0x8759, 0xE59F, 0x8753, 0xE5A0, 0x8763, - 0xE5A1, 0x876A, 0xE5A2, 0x8805, 0xE5A3, 0x87A2, 0xE5A4, 0x879F, - 0xE5A5, 0x8782, 0xE5A6, 0x87AF, 0xE5A7, 0x87CB, 0xE5A8, 0x87BD, - 0xE5A9, 0x87C0, 0xE5AA, 0x87D0, 0xE5AB, 0x96D6, 0xE5AC, 0x87AB, - 0xE5AD, 0x87C4, 0xE5AE, 0x87B3, 0xE5AF, 0x87C7, 0xE5B0, 0x87C6, - 0xE5B1, 0x87BB, 0xE5B2, 0x87EF, 0xE5B3, 0x87F2, 0xE5B4, 0x87E0, - 0xE5B5, 0x880F, 0xE5B6, 0x880D, 0xE5B7, 0x87FE, 0xE5B8, 0x87F6, - 0xE5B9, 0x87F7, 0xE5BA, 0x880E, 0xE5BB, 0x87D2, 0xE5BC, 0x8811, - 0xE5BD, 0x8816, 0xE5BE, 0x8815, 0xE5BF, 0x8822, 0xE5C0, 0x8821, - 0xE5C1, 0x8831, 0xE5C2, 0x8836, 0xE5C3, 0x8839, 0xE5C4, 0x8827, - 0xE5C5, 0x883B, 0xE5C6, 0x8844, 0xE5C7, 0x8842, 0xE5C8, 0x8852, - 0xE5C9, 0x8859, 0xE5CA, 0x885E, 0xE5CB, 0x8862, 0xE5CC, 0x886B, - 0xE5CD, 0x8881, 0xE5CE, 0x887E, 0xE5CF, 0x889E, 0xE5D0, 0x8875, - 0xE5D1, 0x887D, 0xE5D2, 0x88B5, 0xE5D3, 0x8872, 0xE5D4, 0x8882, - 0xE5D5, 0x8897, 0xE5D6, 0x8892, 0xE5D7, 0x88AE, 0xE5D8, 0x8899, - 0xE5D9, 0x88A2, 0xE5DA, 0x888D, 0xE5DB, 0x88A4, 0xE5DC, 0x88B0, - 0xE5DD, 0x88BF, 0xE5DE, 0x88B1, 0xE5DF, 0x88C3, 0xE5E0, 0x88C4, - 0xE5E1, 0x88D4, 0xE5E2, 0x88D8, 0xE5E3, 0x88D9, 0xE5E4, 0x88DD, - 0xE5E5, 0x88F9, 0xE5E6, 0x8902, 0xE5E7, 0x88FC, 0xE5E8, 0x88F4, - 0xE5E9, 0x88E8, 0xE5EA, 0x88F2, 0xE5EB, 0x8904, 0xE5EC, 0x890C, - 0xE5ED, 0x890A, 0xE5EE, 0x8913, 0xE5EF, 0x8943, 0xE5F0, 0x891E, - 0xE5F1, 0x8925, 0xE5F2, 0x892A, 0xE5F3, 0x892B, 0xE5F4, 0x8941, - 0xE5F5, 0x8944, 0xE5F6, 0x893B, 0xE5F7, 0x8936, 0xE5F8, 0x8938, - 0xE5F9, 0x894C, 0xE5FA, 0x891D, 0xE5FB, 0x8960, 0xE5FC, 0x895E, - 0xE640, 0x8966, 0xE641, 0x8964, 0xE642, 0x896D, 0xE643, 0x896A, - 0xE644, 0x896F, 0xE645, 0x8974, 0xE646, 0x8977, 0xE647, 0x897E, - 0xE648, 0x8983, 0xE649, 0x8988, 0xE64A, 0x898A, 0xE64B, 0x8993, - 0xE64C, 0x8998, 0xE64D, 0x89A1, 0xE64E, 0x89A9, 0xE64F, 0x89A6, - 0xE650, 0x89AC, 0xE651, 0x89AF, 0xE652, 0x89B2, 0xE653, 0x89BA, - 0xE654, 0x89BD, 0xE655, 0x89BF, 0xE656, 0x89C0, 0xE657, 0x89DA, - 0xE658, 0x89DC, 0xE659, 0x89DD, 0xE65A, 0x89E7, 0xE65B, 0x89F4, - 0xE65C, 0x89F8, 0xE65D, 0x8A03, 0xE65E, 0x8A16, 0xE65F, 0x8A10, - 0xE660, 0x8A0C, 0xE661, 0x8A1B, 0xE662, 0x8A1D, 0xE663, 0x8A25, - 0xE664, 0x8A36, 0xE665, 0x8A41, 0xE666, 0x8A5B, 0xE667, 0x8A52, - 0xE668, 0x8A46, 0xE669, 0x8A48, 0xE66A, 0x8A7C, 0xE66B, 0x8A6D, - 0xE66C, 0x8A6C, 0xE66D, 0x8A62, 0xE66E, 0x8A85, 0xE66F, 0x8A82, - 0xE670, 0x8A84, 0xE671, 0x8AA8, 0xE672, 0x8AA1, 0xE673, 0x8A91, - 0xE674, 0x8AA5, 0xE675, 0x8AA6, 0xE676, 0x8A9A, 0xE677, 0x8AA3, - 0xE678, 0x8AC4, 0xE679, 0x8ACD, 0xE67A, 0x8AC2, 0xE67B, 0x8ADA, - 0xE67C, 0x8AEB, 0xE67D, 0x8AF3, 0xE67E, 0x8AE7, 0xE680, 0x8AE4, - 0xE681, 0x8AF1, 0xE682, 0x8B14, 0xE683, 0x8AE0, 0xE684, 0x8AE2, - 0xE685, 0x8AF7, 0xE686, 0x8ADE, 0xE687, 0x8ADB, 0xE688, 0x8B0C, - 0xE689, 0x8B07, 0xE68A, 0x8B1A, 0xE68B, 0x8AE1, 0xE68C, 0x8B16, - 0xE68D, 0x8B10, 0xE68E, 0x8B17, 0xE68F, 0x8B20, 0xE690, 0x8B33, - 0xE691, 0x97AB, 0xE692, 0x8B26, 0xE693, 0x8B2B, 0xE694, 0x8B3E, - 0xE695, 0x8B28, 0xE696, 0x8B41, 0xE697, 0x8B4C, 0xE698, 0x8B4F, - 0xE699, 0x8B4E, 0xE69A, 0x8B49, 0xE69B, 0x8B56, 0xE69C, 0x8B5B, - 0xE69D, 0x8B5A, 0xE69E, 0x8B6B, 0xE69F, 0x8B5F, 0xE6A0, 0x8B6C, - 0xE6A1, 0x8B6F, 0xE6A2, 0x8B74, 0xE6A3, 0x8B7D, 0xE6A4, 0x8B80, - 0xE6A5, 0x8B8C, 0xE6A6, 0x8B8E, 0xE6A7, 0x8B92, 0xE6A8, 0x8B93, - 0xE6A9, 0x8B96, 0xE6AA, 0x8B99, 0xE6AB, 0x8B9A, 0xE6AC, 0x8C3A, - 0xE6AD, 0x8C41, 0xE6AE, 0x8C3F, 0xE6AF, 0x8C48, 0xE6B0, 0x8C4C, - 0xE6B1, 0x8C4E, 0xE6B2, 0x8C50, 0xE6B3, 0x8C55, 0xE6B4, 0x8C62, - 0xE6B5, 0x8C6C, 0xE6B6, 0x8C78, 0xE6B7, 0x8C7A, 0xE6B8, 0x8C82, - 0xE6B9, 0x8C89, 0xE6BA, 0x8C85, 0xE6BB, 0x8C8A, 0xE6BC, 0x8C8D, - 0xE6BD, 0x8C8E, 0xE6BE, 0x8C94, 0xE6BF, 0x8C7C, 0xE6C0, 0x8C98, - 0xE6C1, 0x621D, 0xE6C2, 0x8CAD, 0xE6C3, 0x8CAA, 0xE6C4, 0x8CBD, - 0xE6C5, 0x8CB2, 0xE6C6, 0x8CB3, 0xE6C7, 0x8CAE, 0xE6C8, 0x8CB6, - 0xE6C9, 0x8CC8, 0xE6CA, 0x8CC1, 0xE6CB, 0x8CE4, 0xE6CC, 0x8CE3, - 0xE6CD, 0x8CDA, 0xE6CE, 0x8CFD, 0xE6CF, 0x8CFA, 0xE6D0, 0x8CFB, - 0xE6D1, 0x8D04, 0xE6D2, 0x8D05, 0xE6D3, 0x8D0A, 0xE6D4, 0x8D07, - 0xE6D5, 0x8D0F, 0xE6D6, 0x8D0D, 0xE6D7, 0x8D10, 0xE6D8, 0x9F4E, - 0xE6D9, 0x8D13, 0xE6DA, 0x8CCD, 0xE6DB, 0x8D14, 0xE6DC, 0x8D16, - 0xE6DD, 0x8D67, 0xE6DE, 0x8D6D, 0xE6DF, 0x8D71, 0xE6E0, 0x8D73, - 0xE6E1, 0x8D81, 0xE6E2, 0x8D99, 0xE6E3, 0x8DC2, 0xE6E4, 0x8DBE, - 0xE6E5, 0x8DBA, 0xE6E6, 0x8DCF, 0xE6E7, 0x8DDA, 0xE6E8, 0x8DD6, - 0xE6E9, 0x8DCC, 0xE6EA, 0x8DDB, 0xE6EB, 0x8DCB, 0xE6EC, 0x8DEA, - 0xE6ED, 0x8DEB, 0xE6EE, 0x8DDF, 0xE6EF, 0x8DE3, 0xE6F0, 0x8DFC, - 0xE6F1, 0x8E08, 0xE6F2, 0x8E09, 0xE6F3, 0x8DFF, 0xE6F4, 0x8E1D, - 0xE6F5, 0x8E1E, 0xE6F6, 0x8E10, 0xE6F7, 0x8E1F, 0xE6F8, 0x8E42, - 0xE6F9, 0x8E35, 0xE6FA, 0x8E30, 0xE6FB, 0x8E34, 0xE6FC, 0x8E4A, - 0xE740, 0x8E47, 0xE741, 0x8E49, 0xE742, 0x8E4C, 0xE743, 0x8E50, - 0xE744, 0x8E48, 0xE745, 0x8E59, 0xE746, 0x8E64, 0xE747, 0x8E60, - 0xE748, 0x8E2A, 0xE749, 0x8E63, 0xE74A, 0x8E55, 0xE74B, 0x8E76, - 0xE74C, 0x8E72, 0xE74D, 0x8E7C, 0xE74E, 0x8E81, 0xE74F, 0x8E87, - 0xE750, 0x8E85, 0xE751, 0x8E84, 0xE752, 0x8E8B, 0xE753, 0x8E8A, - 0xE754, 0x8E93, 0xE755, 0x8E91, 0xE756, 0x8E94, 0xE757, 0x8E99, - 0xE758, 0x8EAA, 0xE759, 0x8EA1, 0xE75A, 0x8EAC, 0xE75B, 0x8EB0, - 0xE75C, 0x8EC6, 0xE75D, 0x8EB1, 0xE75E, 0x8EBE, 0xE75F, 0x8EC5, - 0xE760, 0x8EC8, 0xE761, 0x8ECB, 0xE762, 0x8EDB, 0xE763, 0x8EE3, - 0xE764, 0x8EFC, 0xE765, 0x8EFB, 0xE766, 0x8EEB, 0xE767, 0x8EFE, - 0xE768, 0x8F0A, 0xE769, 0x8F05, 0xE76A, 0x8F15, 0xE76B, 0x8F12, - 0xE76C, 0x8F19, 0xE76D, 0x8F13, 0xE76E, 0x8F1C, 0xE76F, 0x8F1F, - 0xE770, 0x8F1B, 0xE771, 0x8F0C, 0xE772, 0x8F26, 0xE773, 0x8F33, - 0xE774, 0x8F3B, 0xE775, 0x8F39, 0xE776, 0x8F45, 0xE777, 0x8F42, - 0xE778, 0x8F3E, 0xE779, 0x8F4C, 0xE77A, 0x8F49, 0xE77B, 0x8F46, - 0xE77C, 0x8F4E, 0xE77D, 0x8F57, 0xE77E, 0x8F5C, 0xE780, 0x8F62, - 0xE781, 0x8F63, 0xE782, 0x8F64, 0xE783, 0x8F9C, 0xE784, 0x8F9F, - 0xE785, 0x8FA3, 0xE786, 0x8FAD, 0xE787, 0x8FAF, 0xE788, 0x8FB7, - 0xE789, 0x8FDA, 0xE78A, 0x8FE5, 0xE78B, 0x8FE2, 0xE78C, 0x8FEA, - 0xE78D, 0x8FEF, 0xE78E, 0x9087, 0xE78F, 0x8FF4, 0xE790, 0x9005, - 0xE791, 0x8FF9, 0xE792, 0x8FFA, 0xE793, 0x9011, 0xE794, 0x9015, - 0xE795, 0x9021, 0xE796, 0x900D, 0xE797, 0x901E, 0xE798, 0x9016, - 0xE799, 0x900B, 0xE79A, 0x9027, 0xE79B, 0x9036, 0xE79C, 0x9035, - 0xE79D, 0x9039, 0xE79E, 0x8FF8, 0xE79F, 0x904F, 0xE7A0, 0x9050, - 0xE7A1, 0x9051, 0xE7A2, 0x9052, 0xE7A3, 0x900E, 0xE7A4, 0x9049, - 0xE7A5, 0x903E, 0xE7A6, 0x9056, 0xE7A7, 0x9058, 0xE7A8, 0x905E, - 0xE7A9, 0x9068, 0xE7AA, 0x906F, 0xE7AB, 0x9076, 0xE7AC, 0x96A8, - 0xE7AD, 0x9072, 0xE7AE, 0x9082, 0xE7AF, 0x907D, 0xE7B0, 0x9081, - 0xE7B1, 0x9080, 0xE7B2, 0x908A, 0xE7B3, 0x9089, 0xE7B4, 0x908F, - 0xE7B5, 0x90A8, 0xE7B6, 0x90AF, 0xE7B7, 0x90B1, 0xE7B8, 0x90B5, - 0xE7B9, 0x90E2, 0xE7BA, 0x90E4, 0xE7BB, 0x6248, 0xE7BC, 0x90DB, - 0xE7BD, 0x9102, 0xE7BE, 0x9112, 0xE7BF, 0x9119, 0xE7C0, 0x9132, - 0xE7C1, 0x9130, 0xE7C2, 0x914A, 0xE7C3, 0x9156, 0xE7C4, 0x9158, - 0xE7C5, 0x9163, 0xE7C6, 0x9165, 0xE7C7, 0x9169, 0xE7C8, 0x9173, - 0xE7C9, 0x9172, 0xE7CA, 0x918B, 0xE7CB, 0x9189, 0xE7CC, 0x9182, - 0xE7CD, 0x91A2, 0xE7CE, 0x91AB, 0xE7CF, 0x91AF, 0xE7D0, 0x91AA, - 0xE7D1, 0x91B5, 0xE7D2, 0x91B4, 0xE7D3, 0x91BA, 0xE7D4, 0x91C0, - 0xE7D5, 0x91C1, 0xE7D6, 0x91C9, 0xE7D7, 0x91CB, 0xE7D8, 0x91D0, - 0xE7D9, 0x91D6, 0xE7DA, 0x91DF, 0xE7DB, 0x91E1, 0xE7DC, 0x91DB, - 0xE7DD, 0x91FC, 0xE7DE, 0x91F5, 0xE7DF, 0x91F6, 0xE7E0, 0x921E, - 0xE7E1, 0x91FF, 0xE7E2, 0x9214, 0xE7E3, 0x922C, 0xE7E4, 0x9215, - 0xE7E5, 0x9211, 0xE7E6, 0x925E, 0xE7E7, 0x9257, 0xE7E8, 0x9245, - 0xE7E9, 0x9249, 0xE7EA, 0x9264, 0xE7EB, 0x9248, 0xE7EC, 0x9295, - 0xE7ED, 0x923F, 0xE7EE, 0x924B, 0xE7EF, 0x9250, 0xE7F0, 0x929C, - 0xE7F1, 0x9296, 0xE7F2, 0x9293, 0xE7F3, 0x929B, 0xE7F4, 0x925A, - 0xE7F5, 0x92CF, 0xE7F6, 0x92B9, 0xE7F7, 0x92B7, 0xE7F8, 0x92E9, - 0xE7F9, 0x930F, 0xE7FA, 0x92FA, 0xE7FB, 0x9344, 0xE7FC, 0x932E, - 0xE840, 0x9319, 0xE841, 0x9322, 0xE842, 0x931A, 0xE843, 0x9323, - 0xE844, 0x933A, 0xE845, 0x9335, 0xE846, 0x933B, 0xE847, 0x935C, - 0xE848, 0x9360, 0xE849, 0x937C, 0xE84A, 0x936E, 0xE84B, 0x9356, - 0xE84C, 0x93B0, 0xE84D, 0x93AC, 0xE84E, 0x93AD, 0xE84F, 0x9394, - 0xE850, 0x93B9, 0xE851, 0x93D6, 0xE852, 0x93D7, 0xE853, 0x93E8, - 0xE854, 0x93E5, 0xE855, 0x93D8, 0xE856, 0x93C3, 0xE857, 0x93DD, - 0xE858, 0x93D0, 0xE859, 0x93C8, 0xE85A, 0x93E4, 0xE85B, 0x941A, - 0xE85C, 0x9414, 0xE85D, 0x9413, 0xE85E, 0x9403, 0xE85F, 0x9407, - 0xE860, 0x9410, 0xE861, 0x9436, 0xE862, 0x942B, 0xE863, 0x9435, - 0xE864, 0x9421, 0xE865, 0x943A, 0xE866, 0x9441, 0xE867, 0x9452, - 0xE868, 0x9444, 0xE869, 0x945B, 0xE86A, 0x9460, 0xE86B, 0x9462, - 0xE86C, 0x945E, 0xE86D, 0x946A, 0xE86E, 0x9229, 0xE86F, 0x9470, - 0xE870, 0x9475, 0xE871, 0x9477, 0xE872, 0x947D, 0xE873, 0x945A, - 0xE874, 0x947C, 0xE875, 0x947E, 0xE876, 0x9481, 0xE877, 0x947F, - 0xE878, 0x9582, 0xE879, 0x9587, 0xE87A, 0x958A, 0xE87B, 0x9594, - 0xE87C, 0x9596, 0xE87D, 0x9598, 0xE87E, 0x9599, 0xE880, 0x95A0, - 0xE881, 0x95A8, 0xE882, 0x95A7, 0xE883, 0x95AD, 0xE884, 0x95BC, - 0xE885, 0x95BB, 0xE886, 0x95B9, 0xE887, 0x95BE, 0xE888, 0x95CA, - 0xE889, 0x6FF6, 0xE88A, 0x95C3, 0xE88B, 0x95CD, 0xE88C, 0x95CC, - 0xE88D, 0x95D5, 0xE88E, 0x95D4, 0xE88F, 0x95D6, 0xE890, 0x95DC, - 0xE891, 0x95E1, 0xE892, 0x95E5, 0xE893, 0x95E2, 0xE894, 0x9621, - 0xE895, 0x9628, 0xE896, 0x962E, 0xE897, 0x962F, 0xE898, 0x9642, - 0xE899, 0x964C, 0xE89A, 0x964F, 0xE89B, 0x964B, 0xE89C, 0x9677, - 0xE89D, 0x965C, 0xE89E, 0x965E, 0xE89F, 0x965D, 0xE8A0, 0x965F, - 0xE8A1, 0x9666, 0xE8A2, 0x9672, 0xE8A3, 0x966C, 0xE8A4, 0x968D, - 0xE8A5, 0x9698, 0xE8A6, 0x9695, 0xE8A7, 0x9697, 0xE8A8, 0x96AA, - 0xE8A9, 0x96A7, 0xE8AA, 0x96B1, 0xE8AB, 0x96B2, 0xE8AC, 0x96B0, - 0xE8AD, 0x96B4, 0xE8AE, 0x96B6, 0xE8AF, 0x96B8, 0xE8B0, 0x96B9, - 0xE8B1, 0x96CE, 0xE8B2, 0x96CB, 0xE8B3, 0x96C9, 0xE8B4, 0x96CD, - 0xE8B5, 0x894D, 0xE8B6, 0x96DC, 0xE8B7, 0x970D, 0xE8B8, 0x96D5, - 0xE8B9, 0x96F9, 0xE8BA, 0x9704, 0xE8BB, 0x9706, 0xE8BC, 0x9708, - 0xE8BD, 0x9713, 0xE8BE, 0x970E, 0xE8BF, 0x9711, 0xE8C0, 0x970F, - 0xE8C1, 0x9716, 0xE8C2, 0x9719, 0xE8C3, 0x9724, 0xE8C4, 0x972A, - 0xE8C5, 0x9730, 0xE8C6, 0x9739, 0xE8C7, 0x973D, 0xE8C8, 0x973E, - 0xE8C9, 0x9744, 0xE8CA, 0x9746, 0xE8CB, 0x9748, 0xE8CC, 0x9742, - 0xE8CD, 0x9749, 0xE8CE, 0x975C, 0xE8CF, 0x9760, 0xE8D0, 0x9764, - 0xE8D1, 0x9766, 0xE8D2, 0x9768, 0xE8D3, 0x52D2, 0xE8D4, 0x976B, - 0xE8D5, 0x9771, 0xE8D6, 0x9779, 0xE8D7, 0x9785, 0xE8D8, 0x977C, - 0xE8D9, 0x9781, 0xE8DA, 0x977A, 0xE8DB, 0x9786, 0xE8DC, 0x978B, - 0xE8DD, 0x978F, 0xE8DE, 0x9790, 0xE8DF, 0x979C, 0xE8E0, 0x97A8, - 0xE8E1, 0x97A6, 0xE8E2, 0x97A3, 0xE8E3, 0x97B3, 0xE8E4, 0x97B4, - 0xE8E5, 0x97C3, 0xE8E6, 0x97C6, 0xE8E7, 0x97C8, 0xE8E8, 0x97CB, - 0xE8E9, 0x97DC, 0xE8EA, 0x97ED, 0xE8EB, 0x9F4F, 0xE8EC, 0x97F2, - 0xE8ED, 0x7ADF, 0xE8EE, 0x97F6, 0xE8EF, 0x97F5, 0xE8F0, 0x980F, - 0xE8F1, 0x980C, 0xE8F2, 0x9838, 0xE8F3, 0x9824, 0xE8F4, 0x9821, - 0xE8F5, 0x9837, 0xE8F6, 0x983D, 0xE8F7, 0x9846, 0xE8F8, 0x984F, - 0xE8F9, 0x984B, 0xE8FA, 0x986B, 0xE8FB, 0x986F, 0xE8FC, 0x9870, - 0xE940, 0x9871, 0xE941, 0x9874, 0xE942, 0x9873, 0xE943, 0x98AA, - 0xE944, 0x98AF, 0xE945, 0x98B1, 0xE946, 0x98B6, 0xE947, 0x98C4, - 0xE948, 0x98C3, 0xE949, 0x98C6, 0xE94A, 0x98E9, 0xE94B, 0x98EB, - 0xE94C, 0x9903, 0xE94D, 0x9909, 0xE94E, 0x9912, 0xE94F, 0x9914, - 0xE950, 0x9918, 0xE951, 0x9921, 0xE952, 0x991D, 0xE953, 0x991E, - 0xE954, 0x9924, 0xE955, 0x9920, 0xE956, 0x992C, 0xE957, 0x992E, - 0xE958, 0x993D, 0xE959, 0x993E, 0xE95A, 0x9942, 0xE95B, 0x9949, - 0xE95C, 0x9945, 0xE95D, 0x9950, 0xE95E, 0x994B, 0xE95F, 0x9951, - 0xE960, 0x9952, 0xE961, 0x994C, 0xE962, 0x9955, 0xE963, 0x9997, - 0xE964, 0x9998, 0xE965, 0x99A5, 0xE966, 0x99AD, 0xE967, 0x99AE, - 0xE968, 0x99BC, 0xE969, 0x99DF, 0xE96A, 0x99DB, 0xE96B, 0x99DD, - 0xE96C, 0x99D8, 0xE96D, 0x99D1, 0xE96E, 0x99ED, 0xE96F, 0x99EE, - 0xE970, 0x99F1, 0xE971, 0x99F2, 0xE972, 0x99FB, 0xE973, 0x99F8, - 0xE974, 0x9A01, 0xE975, 0x9A0F, 0xE976, 0x9A05, 0xE977, 0x99E2, - 0xE978, 0x9A19, 0xE979, 0x9A2B, 0xE97A, 0x9A37, 0xE97B, 0x9A45, - 0xE97C, 0x9A42, 0xE97D, 0x9A40, 0xE97E, 0x9A43, 0xE980, 0x9A3E, - 0xE981, 0x9A55, 0xE982, 0x9A4D, 0xE983, 0x9A5B, 0xE984, 0x9A57, - 0xE985, 0x9A5F, 0xE986, 0x9A62, 0xE987, 0x9A65, 0xE988, 0x9A64, - 0xE989, 0x9A69, 0xE98A, 0x9A6B, 0xE98B, 0x9A6A, 0xE98C, 0x9AAD, - 0xE98D, 0x9AB0, 0xE98E, 0x9ABC, 0xE98F, 0x9AC0, 0xE990, 0x9ACF, - 0xE991, 0x9AD1, 0xE992, 0x9AD3, 0xE993, 0x9AD4, 0xE994, 0x9ADE, - 0xE995, 0x9ADF, 0xE996, 0x9AE2, 0xE997, 0x9AE3, 0xE998, 0x9AE6, - 0xE999, 0x9AEF, 0xE99A, 0x9AEB, 0xE99B, 0x9AEE, 0xE99C, 0x9AF4, - 0xE99D, 0x9AF1, 0xE99E, 0x9AF7, 0xE99F, 0x9AFB, 0xE9A0, 0x9B06, - 0xE9A1, 0x9B18, 0xE9A2, 0x9B1A, 0xE9A3, 0x9B1F, 0xE9A4, 0x9B22, - 0xE9A5, 0x9B23, 0xE9A6, 0x9B25, 0xE9A7, 0x9B27, 0xE9A8, 0x9B28, - 0xE9A9, 0x9B29, 0xE9AA, 0x9B2A, 0xE9AB, 0x9B2E, 0xE9AC, 0x9B2F, - 0xE9AD, 0x9B32, 0xE9AE, 0x9B44, 0xE9AF, 0x9B43, 0xE9B0, 0x9B4F, - 0xE9B1, 0x9B4D, 0xE9B2, 0x9B4E, 0xE9B3, 0x9B51, 0xE9B4, 0x9B58, - 0xE9B5, 0x9B74, 0xE9B6, 0x9B93, 0xE9B7, 0x9B83, 0xE9B8, 0x9B91, - 0xE9B9, 0x9B96, 0xE9BA, 0x9B97, 0xE9BB, 0x9B9F, 0xE9BC, 0x9BA0, - 0xE9BD, 0x9BA8, 0xE9BE, 0x9BB4, 0xE9BF, 0x9BC0, 0xE9C0, 0x9BCA, - 0xE9C1, 0x9BB9, 0xE9C2, 0x9BC6, 0xE9C3, 0x9BCF, 0xE9C4, 0x9BD1, - 0xE9C5, 0x9BD2, 0xE9C6, 0x9BE3, 0xE9C7, 0x9BE2, 0xE9C8, 0x9BE4, - 0xE9C9, 0x9BD4, 0xE9CA, 0x9BE1, 0xE9CB, 0x9C3A, 0xE9CC, 0x9BF2, - 0xE9CD, 0x9BF1, 0xE9CE, 0x9BF0, 0xE9CF, 0x9C15, 0xE9D0, 0x9C14, - 0xE9D1, 0x9C09, 0xE9D2, 0x9C13, 0xE9D3, 0x9C0C, 0xE9D4, 0x9C06, - 0xE9D5, 0x9C08, 0xE9D6, 0x9C12, 0xE9D7, 0x9C0A, 0xE9D8, 0x9C04, - 0xE9D9, 0x9C2E, 0xE9DA, 0x9C1B, 0xE9DB, 0x9C25, 0xE9DC, 0x9C24, - 0xE9DD, 0x9C21, 0xE9DE, 0x9C30, 0xE9DF, 0x9C47, 0xE9E0, 0x9C32, - 0xE9E1, 0x9C46, 0xE9E2, 0x9C3E, 0xE9E3, 0x9C5A, 0xE9E4, 0x9C60, - 0xE9E5, 0x9C67, 0xE9E6, 0x9C76, 0xE9E7, 0x9C78, 0xE9E8, 0x9CE7, - 0xE9E9, 0x9CEC, 0xE9EA, 0x9CF0, 0xE9EB, 0x9D09, 0xE9EC, 0x9D08, - 0xE9ED, 0x9CEB, 0xE9EE, 0x9D03, 0xE9EF, 0x9D06, 0xE9F0, 0x9D2A, - 0xE9F1, 0x9D26, 0xE9F2, 0x9DAF, 0xE9F3, 0x9D23, 0xE9F4, 0x9D1F, - 0xE9F5, 0x9D44, 0xE9F6, 0x9D15, 0xE9F7, 0x9D12, 0xE9F8, 0x9D41, - 0xE9F9, 0x9D3F, 0xE9FA, 0x9D3E, 0xE9FB, 0x9D46, 0xE9FC, 0x9D48, - 0xEA40, 0x9D5D, 0xEA41, 0x9D5E, 0xEA42, 0x9D64, 0xEA43, 0x9D51, - 0xEA44, 0x9D50, 0xEA45, 0x9D59, 0xEA46, 0x9D72, 0xEA47, 0x9D89, - 0xEA48, 0x9D87, 0xEA49, 0x9DAB, 0xEA4A, 0x9D6F, 0xEA4B, 0x9D7A, - 0xEA4C, 0x9D9A, 0xEA4D, 0x9DA4, 0xEA4E, 0x9DA9, 0xEA4F, 0x9DB2, - 0xEA50, 0x9DC4, 0xEA51, 0x9DC1, 0xEA52, 0x9DBB, 0xEA53, 0x9DB8, - 0xEA54, 0x9DBA, 0xEA55, 0x9DC6, 0xEA56, 0x9DCF, 0xEA57, 0x9DC2, - 0xEA58, 0x9DD9, 0xEA59, 0x9DD3, 0xEA5A, 0x9DF8, 0xEA5B, 0x9DE6, - 0xEA5C, 0x9DED, 0xEA5D, 0x9DEF, 0xEA5E, 0x9DFD, 0xEA5F, 0x9E1A, - 0xEA60, 0x9E1B, 0xEA61, 0x9E1E, 0xEA62, 0x9E75, 0xEA63, 0x9E79, - 0xEA64, 0x9E7D, 0xEA65, 0x9E81, 0xEA66, 0x9E88, 0xEA67, 0x9E8B, - 0xEA68, 0x9E8C, 0xEA69, 0x9E92, 0xEA6A, 0x9E95, 0xEA6B, 0x9E91, - 0xEA6C, 0x9E9D, 0xEA6D, 0x9EA5, 0xEA6E, 0x9EA9, 0xEA6F, 0x9EB8, - 0xEA70, 0x9EAA, 0xEA71, 0x9EAD, 0xEA72, 0x9761, 0xEA73, 0x9ECC, - 0xEA74, 0x9ECE, 0xEA75, 0x9ECF, 0xEA76, 0x9ED0, 0xEA77, 0x9ED4, - 0xEA78, 0x9EDC, 0xEA79, 0x9EDE, 0xEA7A, 0x9EDD, 0xEA7B, 0x9EE0, - 0xEA7C, 0x9EE5, 0xEA7D, 0x9EE8, 0xEA7E, 0x9EEF, 0xEA80, 0x9EF4, - 0xEA81, 0x9EF6, 0xEA82, 0x9EF7, 0xEA83, 0x9EF9, 0xEA84, 0x9EFB, - 0xEA85, 0x9EFC, 0xEA86, 0x9EFD, 0xEA87, 0x9F07, 0xEA88, 0x9F08, - 0xEA89, 0x76B7, 0xEA8A, 0x9F15, 0xEA8B, 0x9F21, 0xEA8C, 0x9F2C, - 0xEA8D, 0x9F3E, 0xEA8E, 0x9F4A, 0xEA8F, 0x9F52, 0xEA90, 0x9F54, - 0xEA91, 0x9F63, 0xEA92, 0x9F5F, 0xEA93, 0x9F60, 0xEA94, 0x9F61, - 0xEA95, 0x9F66, 0xEA96, 0x9F67, 0xEA97, 0x9F6C, 0xEA98, 0x9F6A, - 0xEA99, 0x9F77, 0xEA9A, 0x9F72, 0xEA9B, 0x9F76, 0xEA9C, 0x9F95, - 0xEA9D, 0x9F9C, 0xEA9E, 0x9FA0, 0xEA9F, 0x582F, 0xEAA0, 0x69C7, - 0xEAA1, 0x9059, 0xEAA2, 0x7464, 0xEAA3, 0x51DC, 0xEAA4, 0x7199, - 0xFA40, 0x2170, 0xFA41, 0x2171, 0xFA42, 0x2172, 0xFA43, 0x2173, - 0xFA44, 0x2174, 0xFA45, 0x2175, 0xFA46, 0x2176, 0xFA47, 0x2177, - 0xFA48, 0x2178, 0xFA49, 0x2179, 0xFA55, 0xFFE4, 0xFA56, 0xFF07, - 0xFA57, 0xFF02, 0xFA5C, 0x7E8A, 0xFA5D, 0x891C, 0xFA5E, 0x9348, - 0xFA5F, 0x9288, 0xFA60, 0x84DC, 0xFA61, 0x4FC9, 0xFA62, 0x70BB, - 0xFA63, 0x6631, 0xFA64, 0x68C8, 0xFA65, 0x92F9, 0xFA66, 0x66FB, - 0xFA67, 0x5F45, 0xFA68, 0x4E28, 0xFA69, 0x4EE1, 0xFA6A, 0x4EFC, - 0xFA6B, 0x4F00, 0xFA6C, 0x4F03, 0xFA6D, 0x4F39, 0xFA6E, 0x4F56, - 0xFA6F, 0x4F92, 0xFA70, 0x4F8A, 0xFA71, 0x4F9A, 0xFA72, 0x4F94, - 0xFA73, 0x4FCD, 0xFA74, 0x5040, 0xFA75, 0x5022, 0xFA76, 0x4FFF, - 0xFA77, 0x501E, 0xFA78, 0x5046, 0xFA79, 0x5070, 0xFA7A, 0x5042, - 0xFA7B, 0x5094, 0xFA7C, 0x50F4, 0xFA7D, 0x50D8, 0xFA7E, 0x514A, - 0xFA80, 0x5164, 0xFA81, 0x519D, 0xFA82, 0x51BE, 0xFA83, 0x51EC, - 0xFA84, 0x5215, 0xFA85, 0x529C, 0xFA86, 0x52A6, 0xFA87, 0x52C0, - 0xFA88, 0x52DB, 0xFA89, 0x5300, 0xFA8A, 0x5307, 0xFA8B, 0x5324, - 0xFA8C, 0x5372, 0xFA8D, 0x5393, 0xFA8E, 0x53B2, 0xFA8F, 0x53DD, - 0xFA90, 0xFA0E, 0xFA91, 0x549C, 0xFA92, 0x548A, 0xFA93, 0x54A9, - 0xFA94, 0x54FF, 0xFA95, 0x5586, 0xFA96, 0x5759, 0xFA97, 0x5765, - 0xFA98, 0x57AC, 0xFA99, 0x57C8, 0xFA9A, 0x57C7, 0xFA9B, 0xFA0F, - 0xFA9C, 0xFA10, 0xFA9D, 0x589E, 0xFA9E, 0x58B2, 0xFA9F, 0x590B, - 0xFAA0, 0x5953, 0xFAA1, 0x595B, 0xFAA2, 0x595D, 0xFAA3, 0x5963, - 0xFAA4, 0x59A4, 0xFAA5, 0x59BA, 0xFAA6, 0x5B56, 0xFAA7, 0x5BC0, - 0xFAA8, 0x752F, 0xFAA9, 0x5BD8, 0xFAAA, 0x5BEC, 0xFAAB, 0x5C1E, - 0xFAAC, 0x5CA6, 0xFAAD, 0x5CBA, 0xFAAE, 0x5CF5, 0xFAAF, 0x5D27, - 0xFAB0, 0x5D53, 0xFAB1, 0xFA11, 0xFAB2, 0x5D42, 0xFAB3, 0x5D6D, - 0xFAB4, 0x5DB8, 0xFAB5, 0x5DB9, 0xFAB6, 0x5DD0, 0xFAB7, 0x5F21, - 0xFAB8, 0x5F34, 0xFAB9, 0x5F67, 0xFABA, 0x5FB7, 0xFABB, 0x5FDE, - 0xFABC, 0x605D, 0xFABD, 0x6085, 0xFABE, 0x608A, 0xFABF, 0x60DE, - 0xFAC0, 0x60D5, 0xFAC1, 0x6120, 0xFAC2, 0x60F2, 0xFAC3, 0x6111, - 0xFAC4, 0x6137, 0xFAC5, 0x6130, 0xFAC6, 0x6198, 0xFAC7, 0x6213, - 0xFAC8, 0x62A6, 0xFAC9, 0x63F5, 0xFACA, 0x6460, 0xFACB, 0x649D, - 0xFACC, 0x64CE, 0xFACD, 0x654E, 0xFACE, 0x6600, 0xFACF, 0x6615, - 0xFAD0, 0x663B, 0xFAD1, 0x6609, 0xFAD2, 0x662E, 0xFAD3, 0x661E, - 0xFAD4, 0x6624, 0xFAD5, 0x6665, 0xFAD6, 0x6657, 0xFAD7, 0x6659, - 0xFAD8, 0xFA12, 0xFAD9, 0x6673, 0xFADA, 0x6699, 0xFADB, 0x66A0, - 0xFADC, 0x66B2, 0xFADD, 0x66BF, 0xFADE, 0x66FA, 0xFADF, 0x670E, - 0xFAE0, 0xF929, 0xFAE1, 0x6766, 0xFAE2, 0x67BB, 0xFAE3, 0x6852, - 0xFAE4, 0x67C0, 0xFAE5, 0x6801, 0xFAE6, 0x6844, 0xFAE7, 0x68CF, - 0xFAE8, 0xFA13, 0xFAE9, 0x6968, 0xFAEA, 0xFA14, 0xFAEB, 0x6998, - 0xFAEC, 0x69E2, 0xFAED, 0x6A30, 0xFAEE, 0x6A6B, 0xFAEF, 0x6A46, - 0xFAF0, 0x6A73, 0xFAF1, 0x6A7E, 0xFAF2, 0x6AE2, 0xFAF3, 0x6AE4, - 0xFAF4, 0x6BD6, 0xFAF5, 0x6C3F, 0xFAF6, 0x6C5C, 0xFAF7, 0x6C86, - 0xFAF8, 0x6C6F, 0xFAF9, 0x6CDA, 0xFAFA, 0x6D04, 0xFAFB, 0x6D87, - 0xFAFC, 0x6D6F, 0xFB40, 0x6D96, 0xFB41, 0x6DAC, 0xFB42, 0x6DCF, - 0xFB43, 0x6DF8, 0xFB44, 0x6DF2, 0xFB45, 0x6DFC, 0xFB46, 0x6E39, - 0xFB47, 0x6E5C, 0xFB48, 0x6E27, 0xFB49, 0x6E3C, 0xFB4A, 0x6EBF, - 0xFB4B, 0x6F88, 0xFB4C, 0x6FB5, 0xFB4D, 0x6FF5, 0xFB4E, 0x7005, - 0xFB4F, 0x7007, 0xFB50, 0x7028, 0xFB51, 0x7085, 0xFB52, 0x70AB, - 0xFB53, 0x710F, 0xFB54, 0x7104, 0xFB55, 0x715C, 0xFB56, 0x7146, - 0xFB57, 0x7147, 0xFB58, 0xFA15, 0xFB59, 0x71C1, 0xFB5A, 0x71FE, - 0xFB5B, 0x72B1, 0xFB5C, 0x72BE, 0xFB5D, 0x7324, 0xFB5E, 0xFA16, - 0xFB5F, 0x7377, 0xFB60, 0x73BD, 0xFB61, 0x73C9, 0xFB62, 0x73D6, - 0xFB63, 0x73E3, 0xFB64, 0x73D2, 0xFB65, 0x7407, 0xFB66, 0x73F5, - 0xFB67, 0x7426, 0xFB68, 0x742A, 0xFB69, 0x7429, 0xFB6A, 0x742E, - 0xFB6B, 0x7462, 0xFB6C, 0x7489, 0xFB6D, 0x749F, 0xFB6E, 0x7501, - 0xFB6F, 0x756F, 0xFB70, 0x7682, 0xFB71, 0x769C, 0xFB72, 0x769E, - 0xFB73, 0x769B, 0xFB74, 0x76A6, 0xFB75, 0xFA17, 0xFB76, 0x7746, - 0xFB77, 0x52AF, 0xFB78, 0x7821, 0xFB79, 0x784E, 0xFB7A, 0x7864, - 0xFB7B, 0x787A, 0xFB7C, 0x7930, 0xFB7D, 0xFA18, 0xFB7E, 0xFA19, - 0xFB80, 0xFA1A, 0xFB81, 0x7994, 0xFB82, 0xFA1B, 0xFB83, 0x799B, - 0xFB84, 0x7AD1, 0xFB85, 0x7AE7, 0xFB86, 0xFA1C, 0xFB87, 0x7AEB, - 0xFB88, 0x7B9E, 0xFB89, 0xFA1D, 0xFB8A, 0x7D48, 0xFB8B, 0x7D5C, - 0xFB8C, 0x7DB7, 0xFB8D, 0x7DA0, 0xFB8E, 0x7DD6, 0xFB8F, 0x7E52, - 0xFB90, 0x7F47, 0xFB91, 0x7FA1, 0xFB92, 0xFA1E, 0xFB93, 0x8301, - 0xFB94, 0x8362, 0xFB95, 0x837F, 0xFB96, 0x83C7, 0xFB97, 0x83F6, - 0xFB98, 0x8448, 0xFB99, 0x84B4, 0xFB9A, 0x8553, 0xFB9B, 0x8559, - 0xFB9C, 0x856B, 0xFB9D, 0xFA1F, 0xFB9E, 0x85B0, 0xFB9F, 0xFA20, - 0xFBA0, 0xFA21, 0xFBA1, 0x8807, 0xFBA2, 0x88F5, 0xFBA3, 0x8A12, - 0xFBA4, 0x8A37, 0xFBA5, 0x8A79, 0xFBA6, 0x8AA7, 0xFBA7, 0x8ABE, - 0xFBA8, 0x8ADF, 0xFBA9, 0xFA22, 0xFBAA, 0x8AF6, 0xFBAB, 0x8B53, - 0xFBAC, 0x8B7F, 0xFBAD, 0x8CF0, 0xFBAE, 0x8CF4, 0xFBAF, 0x8D12, - 0xFBB0, 0x8D76, 0xFBB1, 0xFA23, 0xFBB2, 0x8ECF, 0xFBB3, 0xFA24, - 0xFBB4, 0xFA25, 0xFBB5, 0x9067, 0xFBB6, 0x90DE, 0xFBB7, 0xFA26, - 0xFBB8, 0x9115, 0xFBB9, 0x9127, 0xFBBA, 0x91DA, 0xFBBB, 0x91D7, - 0xFBBC, 0x91DE, 0xFBBD, 0x91ED, 0xFBBE, 0x91EE, 0xFBBF, 0x91E4, - 0xFBC0, 0x91E5, 0xFBC1, 0x9206, 0xFBC2, 0x9210, 0xFBC3, 0x920A, - 0xFBC4, 0x923A, 0xFBC5, 0x9240, 0xFBC6, 0x923C, 0xFBC7, 0x924E, - 0xFBC8, 0x9259, 0xFBC9, 0x9251, 0xFBCA, 0x9239, 0xFBCB, 0x9267, - 0xFBCC, 0x92A7, 0xFBCD, 0x9277, 0xFBCE, 0x9278, 0xFBCF, 0x92E7, - 0xFBD0, 0x92D7, 0xFBD1, 0x92D9, 0xFBD2, 0x92D0, 0xFBD3, 0xFA27, - 0xFBD4, 0x92D5, 0xFBD5, 0x92E0, 0xFBD6, 0x92D3, 0xFBD7, 0x9325, - 0xFBD8, 0x9321, 0xFBD9, 0x92FB, 0xFBDA, 0xFA28, 0xFBDB, 0x931E, - 0xFBDC, 0x92FF, 0xFBDD, 0x931D, 0xFBDE, 0x9302, 0xFBDF, 0x9370, - 0xFBE0, 0x9357, 0xFBE1, 0x93A4, 0xFBE2, 0x93C6, 0xFBE3, 0x93DE, - 0xFBE4, 0x93F8, 0xFBE5, 0x9431, 0xFBE6, 0x9445, 0xFBE7, 0x9448, - 0xFBE8, 0x9592, 0xFBE9, 0xF9DC, 0xFBEA, 0xFA29, 0xFBEB, 0x969D, - 0xFBEC, 0x96AF, 0xFBED, 0x9733, 0xFBEE, 0x973B, 0xFBEF, 0x9743, - 0xFBF0, 0x974D, 0xFBF1, 0x974F, 0xFBF2, 0x9751, 0xFBF3, 0x9755, - 0xFBF4, 0x9857, 0xFBF5, 0x9865, 0xFBF6, 0xFA2A, 0xFBF7, 0xFA2B, - 0xFBF8, 0x9927, 0xFBF9, 0xFA2C, 0xFBFA, 0x999E, 0xFBFB, 0x9A4E, - 0xFBFC, 0x9AD9, 0xFC40, 0x9ADC, 0xFC41, 0x9B75, 0xFC42, 0x9B72, - 0xFC43, 0x9B8F, 0xFC44, 0x9BB1, 0xFC45, 0x9BBB, 0xFC46, 0x9C00, - 0xFC47, 0x9D70, 0xFC48, 0x9D6B, 0xFC49, 0xFA2D, 0xFC4A, 0x9E19, - 0xFC4B, 0x9ED1, 0, 0 -}; -#endif - - - -WCHAR ff_convert ( /* Converted code, 0 means conversion error */ - WCHAR chr, /* Character code to be converted */ - UINT dir /* 0: Unicode to OEM code, 1: OEM code to Unicode */ -) -{ - const WCHAR *p; - WCHAR c; - int i, n, li, hi; - - - if (chr <= 0x80) { /* ASCII */ - c = chr; - } else { -#if !_TINY_TABLE - if (dir) { /* OEM code to unicode */ - p = sjis2uni; - hi = sizeof sjis2uni / 4 - 1; - } else { /* Unicode to OEM code */ - p = uni2sjis; - hi = sizeof uni2sjis / 4 - 1; - } - li = 0; - for (n = 16; n; n--) { - i = li + (hi - li) / 2; - if (chr == p[i * 2]) break; - if (chr > p[i * 2]) - li = i; - else - hi = i; - } - c = n ? p[i * 2 + 1] : 0; -#else - if (dir) { /* OEM code to unicode (Incremental search)*/ - p = &uni2sjis[1]; - do { - c = *p; - p += 2; - } while (c && c != chr); - p -= 3; - c = *p; - } else { /* Unicode to OEM code */ - li = 0; hi = sizeof uni2sjis / 4 - 1; - for (n = 16; n; n--) { - i = li + (hi - li) / 2; - if (chr == uni2sjis[i * 2]) break; - if (chr > uni2sjis[i * 2]) - li = i; - else - hi = i; - } - c = n ? uni2sjis[i * 2 + 1] : 0; - } -#endif - } - - return c; -} - - - -WCHAR ff_wtoupper ( /* Returns upper converted character */ - WCHAR chr /* Unicode character to be upper converted (BMP only) */ -) -{ - /* Compressed upper conversion table */ - static const WCHAR cvt1[] = { /* U+0000 - U+0FFF */ - /* Basic Latin */ - 0x0061,0x031A, - /* Latin-1 Supplement */ - 0x00E0,0x0317, 0x00F8,0x0307, 0x00FF,0x0001,0x0178, - /* Latin Extended-A */ - 0x0100,0x0130, 0x0132,0x0106, 0x0139,0x0110, 0x014A,0x012E, 0x0179,0x0106, - /* Latin Extended-B */ - 0x0180,0x004D,0x0243,0x0181,0x0182,0x0182,0x0184,0x0184,0x0186,0x0187,0x0187,0x0189,0x018A,0x018B,0x018B,0x018D,0x018E,0x018F,0x0190,0x0191,0x0191,0x0193,0x0194,0x01F6,0x0196,0x0197,0x0198,0x0198,0x023D,0x019B,0x019C,0x019D,0x0220,0x019F,0x01A0,0x01A0,0x01A2,0x01A2,0x01A4,0x01A4,0x01A6,0x01A7,0x01A7,0x01A9,0x01AA,0x01AB,0x01AC,0x01AC,0x01AE,0x01AF,0x01AF,0x01B1,0x01B2,0x01B3,0x01B3,0x01B5,0x01B5,0x01B7,0x01B8,0x01B8,0x01BA,0x01BB,0x01BC,0x01BC,0x01BE,0x01F7,0x01C0,0x01C1,0x01C2,0x01C3,0x01C4,0x01C5,0x01C4,0x01C7,0x01C8,0x01C7,0x01CA,0x01CB,0x01CA, - 0x01CD,0x0110, 0x01DD,0x0001,0x018E, 0x01DE,0x0112, 0x01F3,0x0003,0x01F1,0x01F4,0x01F4, 0x01F8,0x0128, - 0x0222,0x0112, 0x023A,0x0009,0x2C65,0x023B,0x023B,0x023D,0x2C66,0x023F,0x0240,0x0241,0x0241, 0x0246,0x010A, - /* IPA Extensions */ - 0x0253,0x0040,0x0181,0x0186,0x0255,0x0189,0x018A,0x0258,0x018F,0x025A,0x0190,0x025C,0x025D,0x025E,0x025F,0x0193,0x0261,0x0262,0x0194,0x0264,0x0265,0x0266,0x0267,0x0197,0x0196,0x026A,0x2C62,0x026C,0x026D,0x026E,0x019C,0x0270,0x0271,0x019D,0x0273,0x0274,0x019F,0x0276,0x0277,0x0278,0x0279,0x027A,0x027B,0x027C,0x2C64,0x027E,0x027F,0x01A6,0x0281,0x0282,0x01A9,0x0284,0x0285,0x0286,0x0287,0x01AE,0x0244,0x01B1,0x01B2,0x0245,0x028D,0x028E,0x028F,0x0290,0x0291,0x01B7, - /* Greek, Coptic */ - 0x037B,0x0003,0x03FD,0x03FE,0x03FF, 0x03AC,0x0004,0x0386,0x0388,0x0389,0x038A, 0x03B1,0x0311, - 0x03C2,0x0002,0x03A3,0x03A3, 0x03C4,0x0308, 0x03CC,0x0003,0x038C,0x038E,0x038F, 0x03D8,0x0118, - 0x03F2,0x000A,0x03F9,0x03F3,0x03F4,0x03F5,0x03F6,0x03F7,0x03F7,0x03F9,0x03FA,0x03FA, - /* Cyrillic */ - 0x0430,0x0320, 0x0450,0x0710, 0x0460,0x0122, 0x048A,0x0136, 0x04C1,0x010E, 0x04CF,0x0001,0x04C0, 0x04D0,0x0144, - /* Armenian */ - 0x0561,0x0426, - - 0x0000 - }; - static const WCHAR cvt2[] = { /* U+1000 - U+FFFF */ - /* Phonetic Extensions */ - 0x1D7D,0x0001,0x2C63, - /* Latin Extended Additional */ - 0x1E00,0x0196, 0x1EA0,0x015A, - /* Greek Extended */ - 0x1F00,0x0608, 0x1F10,0x0606, 0x1F20,0x0608, 0x1F30,0x0608, 0x1F40,0x0606, - 0x1F51,0x0007,0x1F59,0x1F52,0x1F5B,0x1F54,0x1F5D,0x1F56,0x1F5F, 0x1F60,0x0608, - 0x1F70,0x000E,0x1FBA,0x1FBB,0x1FC8,0x1FC9,0x1FCA,0x1FCB,0x1FDA,0x1FDB,0x1FF8,0x1FF9,0x1FEA,0x1FEB,0x1FFA,0x1FFB, - 0x1F80,0x0608, 0x1F90,0x0608, 0x1FA0,0x0608, 0x1FB0,0x0004,0x1FB8,0x1FB9,0x1FB2,0x1FBC, - 0x1FCC,0x0001,0x1FC3, 0x1FD0,0x0602, 0x1FE0,0x0602, 0x1FE5,0x0001,0x1FEC, 0x1FF2,0x0001,0x1FFC, - /* Letterlike Symbols */ - 0x214E,0x0001,0x2132, - /* Number forms */ - 0x2170,0x0210, 0x2184,0x0001,0x2183, - /* Enclosed Alphanumerics */ - 0x24D0,0x051A, 0x2C30,0x042F, - /* Latin Extended-C */ - 0x2C60,0x0102, 0x2C67,0x0106, 0x2C75,0x0102, - /* Coptic */ - 0x2C80,0x0164, - /* Georgian Supplement */ - 0x2D00,0x0826, - /* Full-width */ - 0xFF41,0x031A, - - 0x0000 - }; - const WCHAR *p; - WCHAR bc, nc, cmd; - - - p = chr < 0x1000 ? cvt1 : cvt2; - for (;;) { - bc = *p++; /* Get block base */ - if (!bc || chr < bc) break; - nc = *p++; cmd = nc >> 8; nc &= 0xFF; /* Get processing command and block size */ - if (chr < bc + nc) { /* In the block? */ - switch (cmd) { - case 0: chr = p[chr - bc]; break; /* Table conversion */ - case 1: chr -= (chr - bc) & 1; break; /* Case pairs */ - case 2: chr -= 16; break; /* Shift -16 */ - case 3: chr -= 32; break; /* Shift -32 */ - case 4: chr -= 48; break; /* Shift -48 */ - case 5: chr -= 26; break; /* Shift -26 */ - case 6: chr += 8; break; /* Shift +8 */ - case 7: chr -= 80; break; /* Shift -80 */ - case 8: chr -= 0x1C60; break; /* Shift -0x1C60 */ - } - break; - } - if (!cmd) p += nc; - } - - return chr; -} - diff --git a/os/lib/fs/fat/option/unicode/cc936.c b/os/lib/fs/fat/option/unicode/cc936.c deleted file mode 100644 index 52a595af0..000000000 --- a/os/lib/fs/fat/option/unicode/cc936.c +++ /dev/null @@ -1,11045 +0,0 @@ -/*------------------------------------------------------------------------*/ -/* Unicode - OEM code bidirectional converter (C)ChaN, 2015 */ -/* CP936 (Simplified Chinese GBK) */ -/*------------------------------------------------------------------------*/ - -#include "../../ff.h" - - -#if !_USE_LFN || _CODE_PAGE != 936 -#error This file is not needed in current configuration. Remove from the project. -#endif - -static -const WCHAR uni2oem[] = { -/* Unicode - OEM, Unicode - OEM, Unicode - OEM, Unicode - OEM */ - 0x00A4, 0xA1E8, 0x00A7, 0xA1EC, 0x00A8, 0xA1A7, 0x00B0, 0xA1E3, - 0x00B1, 0xA1C0, 0x00B7, 0xA1A4, 0x00D7, 0xA1C1, 0x00E0, 0xA8A4, - 0x00E1, 0xA8A2, 0x00E8, 0xA8A8, 0x00E9, 0xA8A6, 0x00EA, 0xA8BA, - 0x00EC, 0xA8AC, 0x00ED, 0xA8AA, 0x00F2, 0xA8B0, 0x00F3, 0xA8AE, - 0x00F7, 0xA1C2, 0x00F9, 0xA8B4, 0x00FA, 0xA8B2, 0x00FC, 0xA8B9, - 0x0101, 0xA8A1, 0x0113, 0xA8A5, 0x011B, 0xA8A7, 0x012B, 0xA8A9, - 0x0144, 0xA8BD, 0x0148, 0xA8BE, 0x014D, 0xA8AD, 0x016B, 0xA8B1, - 0x01CE, 0xA8A3, 0x01D0, 0xA8AB, 0x01D2, 0xA8AF, 0x01D4, 0xA8B3, - 0x01D6, 0xA8B5, 0x01D8, 0xA8B6, 0x01DA, 0xA8B7, 0x01DC, 0xA8B8, - 0x0251, 0xA8BB, 0x0261, 0xA8C0, 0x02C7, 0xA1A6, 0x02C9, 0xA1A5, - 0x02CA, 0xA840, 0x02CB, 0xA841, 0x02D9, 0xA842, 0x0391, 0xA6A1, - 0x0392, 0xA6A2, 0x0393, 0xA6A3, 0x0394, 0xA6A4, 0x0395, 0xA6A5, - 0x0396, 0xA6A6, 0x0397, 0xA6A7, 0x0398, 0xA6A8, 0x0399, 0xA6A9, - 0x039A, 0xA6AA, 0x039B, 0xA6AB, 0x039C, 0xA6AC, 0x039D, 0xA6AD, - 0x039E, 0xA6AE, 0x039F, 0xA6AF, 0x03A0, 0xA6B0, 0x03A1, 0xA6B1, - 0x03A3, 0xA6B2, 0x03A4, 0xA6B3, 0x03A5, 0xA6B4, 0x03A6, 0xA6B5, - 0x03A7, 0xA6B6, 0x03A8, 0xA6B7, 0x03A9, 0xA6B8, 0x03B1, 0xA6C1, - 0x03B2, 0xA6C2, 0x03B3, 0xA6C3, 0x03B4, 0xA6C4, 0x03B5, 0xA6C5, - 0x03B6, 0xA6C6, 0x03B7, 0xA6C7, 0x03B8, 0xA6C8, 0x03B9, 0xA6C9, - 0x03BA, 0xA6CA, 0x03BB, 0xA6CB, 0x03BC, 0xA6CC, 0x03BD, 0xA6CD, - 0x03BE, 0xA6CE, 0x03BF, 0xA6CF, 0x03C0, 0xA6D0, 0x03C1, 0xA6D1, - 0x03C3, 0xA6D2, 0x03C4, 0xA6D3, 0x03C5, 0xA6D4, 0x03C6, 0xA6D5, - 0x03C7, 0xA6D6, 0x03C8, 0xA6D7, 0x03C9, 0xA6D8, 0x0401, 0xA7A7, - 0x0410, 0xA7A1, 0x0411, 0xA7A2, 0x0412, 0xA7A3, 0x0413, 0xA7A4, - 0x0414, 0xA7A5, 0x0415, 0xA7A6, 0x0416, 0xA7A8, 0x0417, 0xA7A9, - 0x0418, 0xA7AA, 0x0419, 0xA7AB, 0x041A, 0xA7AC, 0x041B, 0xA7AD, - 0x041C, 0xA7AE, 0x041D, 0xA7AF, 0x041E, 0xA7B0, 0x041F, 0xA7B1, - 0x0420, 0xA7B2, 0x0421, 0xA7B3, 0x0422, 0xA7B4, 0x0423, 0xA7B5, - 0x0424, 0xA7B6, 0x0425, 0xA7B7, 0x0426, 0xA7B8, 0x0427, 0xA7B9, - 0x0428, 0xA7BA, 0x0429, 0xA7BB, 0x042A, 0xA7BC, 0x042B, 0xA7BD, - 0x042C, 0xA7BE, 0x042D, 0xA7BF, 0x042E, 0xA7C0, 0x042F, 0xA7C1, - 0x0430, 0xA7D1, 0x0431, 0xA7D2, 0x0432, 0xA7D3, 0x0433, 0xA7D4, - 0x0434, 0xA7D5, 0x0435, 0xA7D6, 0x0436, 0xA7D8, 0x0437, 0xA7D9, - 0x0438, 0xA7DA, 0x0439, 0xA7DB, 0x043A, 0xA7DC, 0x043B, 0xA7DD, - 0x043C, 0xA7DE, 0x043D, 0xA7DF, 0x043E, 0xA7E0, 0x043F, 0xA7E1, - 0x0440, 0xA7E2, 0x0441, 0xA7E3, 0x0442, 0xA7E4, 0x0443, 0xA7E5, - 0x0444, 0xA7E6, 0x0445, 0xA7E7, 0x0446, 0xA7E8, 0x0447, 0xA7E9, - 0x0448, 0xA7EA, 0x0449, 0xA7EB, 0x044A, 0xA7EC, 0x044B, 0xA7ED, - 0x044C, 0xA7EE, 0x044D, 0xA7EF, 0x044E, 0xA7F0, 0x044F, 0xA7F1, - 0x0451, 0xA7D7, 0x2010, 0xA95C, 0x2013, 0xA843, 0x2014, 0xA1AA, - 0x2015, 0xA844, 0x2016, 0xA1AC, 0x2018, 0xA1AE, 0x2019, 0xA1AF, - 0x201C, 0xA1B0, 0x201D, 0xA1B1, 0x2025, 0xA845, 0x2026, 0xA1AD, - 0x2030, 0xA1EB, 0x2032, 0xA1E4, 0x2033, 0xA1E5, 0x2035, 0xA846, - 0x203B, 0xA1F9, 0x20AC, 0x0080, 0x2103, 0xA1E6, 0x2105, 0xA847, - 0x2109, 0xA848, 0x2116, 0xA1ED, 0x2121, 0xA959, 0x2160, 0xA2F1, - 0x2161, 0xA2F2, 0x2162, 0xA2F3, 0x2163, 0xA2F4, 0x2164, 0xA2F5, - 0x2165, 0xA2F6, 0x2166, 0xA2F7, 0x2167, 0xA2F8, 0x2168, 0xA2F9, - 0x2169, 0xA2FA, 0x216A, 0xA2FB, 0x216B, 0xA2FC, 0x2170, 0xA2A1, - 0x2171, 0xA2A2, 0x2172, 0xA2A3, 0x2173, 0xA2A4, 0x2174, 0xA2A5, - 0x2175, 0xA2A6, 0x2176, 0xA2A7, 0x2177, 0xA2A8, 0x2178, 0xA2A9, - 0x2179, 0xA2AA, 0x2190, 0xA1FB, 0x2191, 0xA1FC, 0x2192, 0xA1FA, - 0x2193, 0xA1FD, 0x2196, 0xA849, 0x2197, 0xA84A, 0x2198, 0xA84B, - 0x2199, 0xA84C, 0x2208, 0xA1CA, 0x220F, 0xA1C7, 0x2211, 0xA1C6, - 0x2215, 0xA84D, 0x221A, 0xA1CC, 0x221D, 0xA1D8, 0x221E, 0xA1DE, - 0x221F, 0xA84E, 0x2220, 0xA1CF, 0x2223, 0xA84F, 0x2225, 0xA1CE, - 0x2227, 0xA1C4, 0x2228, 0xA1C5, 0x2229, 0xA1C9, 0x222A, 0xA1C8, - 0x222B, 0xA1D2, 0x222E, 0xA1D3, 0x2234, 0xA1E0, 0x2235, 0xA1DF, - 0x2236, 0xA1C3, 0x2237, 0xA1CB, 0x223D, 0xA1D7, 0x2248, 0xA1D6, - 0x224C, 0xA1D5, 0x2252, 0xA850, 0x2260, 0xA1D9, 0x2261, 0xA1D4, - 0x2264, 0xA1DC, 0x2265, 0xA1DD, 0x2266, 0xA851, 0x2267, 0xA852, - 0x226E, 0xA1DA, 0x226F, 0xA1DB, 0x2295, 0xA892, 0x2299, 0xA1D1, - 0x22A5, 0xA1CD, 0x22BF, 0xA853, 0x2312, 0xA1D0, 0x2460, 0xA2D9, - 0x2461, 0xA2DA, 0x2462, 0xA2DB, 0x2463, 0xA2DC, 0x2464, 0xA2DD, - 0x2465, 0xA2DE, 0x2466, 0xA2DF, 0x2467, 0xA2E0, 0x2468, 0xA2E1, - 0x2469, 0xA2E2, 0x2474, 0xA2C5, 0x2475, 0xA2C6, 0x2476, 0xA2C7, - 0x2477, 0xA2C8, 0x2478, 0xA2C9, 0x2479, 0xA2CA, 0x247A, 0xA2CB, - 0x247B, 0xA2CC, 0x247C, 0xA2CD, 0x247D, 0xA2CE, 0x247E, 0xA2CF, - 0x247F, 0xA2D0, 0x2480, 0xA2D1, 0x2481, 0xA2D2, 0x2482, 0xA2D3, - 0x2483, 0xA2D4, 0x2484, 0xA2D5, 0x2485, 0xA2D6, 0x2486, 0xA2D7, - 0x2487, 0xA2D8, 0x2488, 0xA2B1, 0x2489, 0xA2B2, 0x248A, 0xA2B3, - 0x248B, 0xA2B4, 0x248C, 0xA2B5, 0x248D, 0xA2B6, 0x248E, 0xA2B7, - 0x248F, 0xA2B8, 0x2490, 0xA2B9, 0x2491, 0xA2BA, 0x2492, 0xA2BB, - 0x2493, 0xA2BC, 0x2494, 0xA2BD, 0x2495, 0xA2BE, 0x2496, 0xA2BF, - 0x2497, 0xA2C0, 0x2498, 0xA2C1, 0x2499, 0xA2C2, 0x249A, 0xA2C3, - 0x249B, 0xA2C4, 0x2500, 0xA9A4, 0x2501, 0xA9A5, 0x2502, 0xA9A6, - 0x2503, 0xA9A7, 0x2504, 0xA9A8, 0x2505, 0xA9A9, 0x2506, 0xA9AA, - 0x2507, 0xA9AB, 0x2508, 0xA9AC, 0x2509, 0xA9AD, 0x250A, 0xA9AE, - 0x250B, 0xA9AF, 0x250C, 0xA9B0, 0x250D, 0xA9B1, 0x250E, 0xA9B2, - 0x250F, 0xA9B3, 0x2510, 0xA9B4, 0x2511, 0xA9B5, 0x2512, 0xA9B6, - 0x2513, 0xA9B7, 0x2514, 0xA9B8, 0x2515, 0xA9B9, 0x2516, 0xA9BA, - 0x2517, 0xA9BB, 0x2518, 0xA9BC, 0x2519, 0xA9BD, 0x251A, 0xA9BE, - 0x251B, 0xA9BF, 0x251C, 0xA9C0, 0x251D, 0xA9C1, 0x251E, 0xA9C2, - 0x251F, 0xA9C3, 0x2520, 0xA9C4, 0x2521, 0xA9C5, 0x2522, 0xA9C6, - 0x2523, 0xA9C7, 0x2524, 0xA9C8, 0x2525, 0xA9C9, 0x2526, 0xA9CA, - 0x2527, 0xA9CB, 0x2528, 0xA9CC, 0x2529, 0xA9CD, 0x252A, 0xA9CE, - 0x252B, 0xA9CF, 0x252C, 0xA9D0, 0x252D, 0xA9D1, 0x252E, 0xA9D2, - 0x252F, 0xA9D3, 0x2530, 0xA9D4, 0x2531, 0xA9D5, 0x2532, 0xA9D6, - 0x2533, 0xA9D7, 0x2534, 0xA9D8, 0x2535, 0xA9D9, 0x2536, 0xA9DA, - 0x2537, 0xA9DB, 0x2538, 0xA9DC, 0x2539, 0xA9DD, 0x253A, 0xA9DE, - 0x253B, 0xA9DF, 0x253C, 0xA9E0, 0x253D, 0xA9E1, 0x253E, 0xA9E2, - 0x253F, 0xA9E3, 0x2540, 0xA9E4, 0x2541, 0xA9E5, 0x2542, 0xA9E6, - 0x2543, 0xA9E7, 0x2544, 0xA9E8, 0x2545, 0xA9E9, 0x2546, 0xA9EA, - 0x2547, 0xA9EB, 0x2548, 0xA9EC, 0x2549, 0xA9ED, 0x254A, 0xA9EE, - 0x254B, 0xA9EF, 0x2550, 0xA854, 0x2551, 0xA855, 0x2552, 0xA856, - 0x2553, 0xA857, 0x2554, 0xA858, 0x2555, 0xA859, 0x2556, 0xA85A, - 0x2557, 0xA85B, 0x2558, 0xA85C, 0x2559, 0xA85D, 0x255A, 0xA85E, - 0x255B, 0xA85F, 0x255C, 0xA860, 0x255D, 0xA861, 0x255E, 0xA862, - 0x255F, 0xA863, 0x2560, 0xA864, 0x2561, 0xA865, 0x2562, 0xA866, - 0x2563, 0xA867, 0x2564, 0xA868, 0x2565, 0xA869, 0x2566, 0xA86A, - 0x2567, 0xA86B, 0x2568, 0xA86C, 0x2569, 0xA86D, 0x256A, 0xA86E, - 0x256B, 0xA86F, 0x256C, 0xA870, 0x256D, 0xA871, 0x256E, 0xA872, - 0x256F, 0xA873, 0x2570, 0xA874, 0x2571, 0xA875, 0x2572, 0xA876, - 0x2573, 0xA877, 0x2581, 0xA878, 0x2582, 0xA879, 0x2583, 0xA87A, - 0x2584, 0xA87B, 0x2585, 0xA87C, 0x2586, 0xA87D, 0x2587, 0xA87E, - 0x2588, 0xA880, 0x2589, 0xA881, 0x258A, 0xA882, 0x258B, 0xA883, - 0x258C, 0xA884, 0x258D, 0xA885, 0x258E, 0xA886, 0x258F, 0xA887, - 0x2593, 0xA888, 0x2594, 0xA889, 0x2595, 0xA88A, 0x25A0, 0xA1F6, - 0x25A1, 0xA1F5, 0x25B2, 0xA1F8, 0x25B3, 0xA1F7, 0x25BC, 0xA88B, - 0x25BD, 0xA88C, 0x25C6, 0xA1F4, 0x25C7, 0xA1F3, 0x25CB, 0xA1F0, - 0x25CE, 0xA1F2, 0x25CF, 0xA1F1, 0x25E2, 0xA88D, 0x25E3, 0xA88E, - 0x25E4, 0xA88F, 0x25E5, 0xA890, 0x2605, 0xA1EF, 0x2606, 0xA1EE, - 0x2609, 0xA891, 0x2640, 0xA1E2, 0x2642, 0xA1E1, 0x3000, 0xA1A1, - 0x3001, 0xA1A2, 0x3002, 0xA1A3, 0x3003, 0xA1A8, 0x3005, 0xA1A9, - 0x3006, 0xA965, 0x3007, 0xA996, 0x3008, 0xA1B4, 0x3009, 0xA1B5, - 0x300A, 0xA1B6, 0x300B, 0xA1B7, 0x300C, 0xA1B8, 0x300D, 0xA1B9, - 0x300E, 0xA1BA, 0x300F, 0xA1BB, 0x3010, 0xA1BE, 0x3011, 0xA1BF, - 0x3012, 0xA893, 0x3013, 0xA1FE, 0x3014, 0xA1B2, 0x3015, 0xA1B3, - 0x3016, 0xA1BC, 0x3017, 0xA1BD, 0x301D, 0xA894, 0x301E, 0xA895, - 0x3021, 0xA940, 0x3022, 0xA941, 0x3023, 0xA942, 0x3024, 0xA943, - 0x3025, 0xA944, 0x3026, 0xA945, 0x3027, 0xA946, 0x3028, 0xA947, - 0x3029, 0xA948, 0x3041, 0xA4A1, 0x3042, 0xA4A2, 0x3043, 0xA4A3, - 0x3044, 0xA4A4, 0x3045, 0xA4A5, 0x3046, 0xA4A6, 0x3047, 0xA4A7, - 0x3048, 0xA4A8, 0x3049, 0xA4A9, 0x304A, 0xA4AA, 0x304B, 0xA4AB, - 0x304C, 0xA4AC, 0x304D, 0xA4AD, 0x304E, 0xA4AE, 0x304F, 0xA4AF, - 0x3050, 0xA4B0, 0x3051, 0xA4B1, 0x3052, 0xA4B2, 0x3053, 0xA4B3, - 0x3054, 0xA4B4, 0x3055, 0xA4B5, 0x3056, 0xA4B6, 0x3057, 0xA4B7, - 0x3058, 0xA4B8, 0x3059, 0xA4B9, 0x305A, 0xA4BA, 0x305B, 0xA4BB, - 0x305C, 0xA4BC, 0x305D, 0xA4BD, 0x305E, 0xA4BE, 0x305F, 0xA4BF, - 0x3060, 0xA4C0, 0x3061, 0xA4C1, 0x3062, 0xA4C2, 0x3063, 0xA4C3, - 0x3064, 0xA4C4, 0x3065, 0xA4C5, 0x3066, 0xA4C6, 0x3067, 0xA4C7, - 0x3068, 0xA4C8, 0x3069, 0xA4C9, 0x306A, 0xA4CA, 0x306B, 0xA4CB, - 0x306C, 0xA4CC, 0x306D, 0xA4CD, 0x306E, 0xA4CE, 0x306F, 0xA4CF, - 0x3070, 0xA4D0, 0x3071, 0xA4D1, 0x3072, 0xA4D2, 0x3073, 0xA4D3, - 0x3074, 0xA4D4, 0x3075, 0xA4D5, 0x3076, 0xA4D6, 0x3077, 0xA4D7, - 0x3078, 0xA4D8, 0x3079, 0xA4D9, 0x307A, 0xA4DA, 0x307B, 0xA4DB, - 0x307C, 0xA4DC, 0x307D, 0xA4DD, 0x307E, 0xA4DE, 0x307F, 0xA4DF, - 0x3080, 0xA4E0, 0x3081, 0xA4E1, 0x3082, 0xA4E2, 0x3083, 0xA4E3, - 0x3084, 0xA4E4, 0x3085, 0xA4E5, 0x3086, 0xA4E6, 0x3087, 0xA4E7, - 0x3088, 0xA4E8, 0x3089, 0xA4E9, 0x308A, 0xA4EA, 0x308B, 0xA4EB, - 0x308C, 0xA4EC, 0x308D, 0xA4ED, 0x308E, 0xA4EE, 0x308F, 0xA4EF, - 0x3090, 0xA4F0, 0x3091, 0xA4F1, 0x3092, 0xA4F2, 0x3093, 0xA4F3, - 0x309B, 0xA961, 0x309C, 0xA962, 0x309D, 0xA966, 0x309E, 0xA967, - 0x30A1, 0xA5A1, 0x30A2, 0xA5A2, 0x30A3, 0xA5A3, 0x30A4, 0xA5A4, - 0x30A5, 0xA5A5, 0x30A6, 0xA5A6, 0x30A7, 0xA5A7, 0x30A8, 0xA5A8, - 0x30A9, 0xA5A9, 0x30AA, 0xA5AA, 0x30AB, 0xA5AB, 0x30AC, 0xA5AC, - 0x30AD, 0xA5AD, 0x30AE, 0xA5AE, 0x30AF, 0xA5AF, 0x30B0, 0xA5B0, - 0x30B1, 0xA5B1, 0x30B2, 0xA5B2, 0x30B3, 0xA5B3, 0x30B4, 0xA5B4, - 0x30B5, 0xA5B5, 0x30B6, 0xA5B6, 0x30B7, 0xA5B7, 0x30B8, 0xA5B8, - 0x30B9, 0xA5B9, 0x30BA, 0xA5BA, 0x30BB, 0xA5BB, 0x30BC, 0xA5BC, - 0x30BD, 0xA5BD, 0x30BE, 0xA5BE, 0x30BF, 0xA5BF, 0x30C0, 0xA5C0, - 0x30C1, 0xA5C1, 0x30C2, 0xA5C2, 0x30C3, 0xA5C3, 0x30C4, 0xA5C4, - 0x30C5, 0xA5C5, 0x30C6, 0xA5C6, 0x30C7, 0xA5C7, 0x30C8, 0xA5C8, - 0x30C9, 0xA5C9, 0x30CA, 0xA5CA, 0x30CB, 0xA5CB, 0x30CC, 0xA5CC, - 0x30CD, 0xA5CD, 0x30CE, 0xA5CE, 0x30CF, 0xA5CF, 0x30D0, 0xA5D0, - 0x30D1, 0xA5D1, 0x30D2, 0xA5D2, 0x30D3, 0xA5D3, 0x30D4, 0xA5D4, - 0x30D5, 0xA5D5, 0x30D6, 0xA5D6, 0x30D7, 0xA5D7, 0x30D8, 0xA5D8, - 0x30D9, 0xA5D9, 0x30DA, 0xA5DA, 0x30DB, 0xA5DB, 0x30DC, 0xA5DC, - 0x30DD, 0xA5DD, 0x30DE, 0xA5DE, 0x30DF, 0xA5DF, 0x30E0, 0xA5E0, - 0x30E1, 0xA5E1, 0x30E2, 0xA5E2, 0x30E3, 0xA5E3, 0x30E4, 0xA5E4, - 0x30E5, 0xA5E5, 0x30E6, 0xA5E6, 0x30E7, 0xA5E7, 0x30E8, 0xA5E8, - 0x30E9, 0xA5E9, 0x30EA, 0xA5EA, 0x30EB, 0xA5EB, 0x30EC, 0xA5EC, - 0x30ED, 0xA5ED, 0x30EE, 0xA5EE, 0x30EF, 0xA5EF, 0x30F0, 0xA5F0, - 0x30F1, 0xA5F1, 0x30F2, 0xA5F2, 0x30F3, 0xA5F3, 0x30F4, 0xA5F4, - 0x30F5, 0xA5F5, 0x30F6, 0xA5F6, 0x30FC, 0xA960, 0x30FD, 0xA963, - 0x30FE, 0xA964, 0x3105, 0xA8C5, 0x3106, 0xA8C6, 0x3107, 0xA8C7, - 0x3108, 0xA8C8, 0x3109, 0xA8C9, 0x310A, 0xA8CA, 0x310B, 0xA8CB, - 0x310C, 0xA8CC, 0x310D, 0xA8CD, 0x310E, 0xA8CE, 0x310F, 0xA8CF, - 0x3110, 0xA8D0, 0x3111, 0xA8D1, 0x3112, 0xA8D2, 0x3113, 0xA8D3, - 0x3114, 0xA8D4, 0x3115, 0xA8D5, 0x3116, 0xA8D6, 0x3117, 0xA8D7, - 0x3118, 0xA8D8, 0x3119, 0xA8D9, 0x311A, 0xA8DA, 0x311B, 0xA8DB, - 0x311C, 0xA8DC, 0x311D, 0xA8DD, 0x311E, 0xA8DE, 0x311F, 0xA8DF, - 0x3120, 0xA8E0, 0x3121, 0xA8E1, 0x3122, 0xA8E2, 0x3123, 0xA8E3, - 0x3124, 0xA8E4, 0x3125, 0xA8E5, 0x3126, 0xA8E6, 0x3127, 0xA8E7, - 0x3128, 0xA8E8, 0x3129, 0xA8E9, 0x3220, 0xA2E5, 0x3221, 0xA2E6, - 0x3222, 0xA2E7, 0x3223, 0xA2E8, 0x3224, 0xA2E9, 0x3225, 0xA2EA, - 0x3226, 0xA2EB, 0x3227, 0xA2EC, 0x3228, 0xA2ED, 0x3229, 0xA2EE, - 0x3231, 0xA95A, 0x32A3, 0xA949, 0x338E, 0xA94A, 0x338F, 0xA94B, - 0x339C, 0xA94C, 0x339D, 0xA94D, 0x339E, 0xA94E, 0x33A1, 0xA94F, - 0x33C4, 0xA950, 0x33CE, 0xA951, 0x33D1, 0xA952, 0x33D2, 0xA953, - 0x33D5, 0xA954, 0x4E00, 0xD2BB, 0x4E01, 0xB6A1, 0x4E02, 0x8140, - 0x4E03, 0xC6DF, 0x4E04, 0x8141, 0x4E05, 0x8142, 0x4E06, 0x8143, - 0x4E07, 0xCDF2, 0x4E08, 0xD5C9, 0x4E09, 0xC8FD, 0x4E0A, 0xC9CF, - 0x4E0B, 0xCFC2, 0x4E0C, 0xD8A2, 0x4E0D, 0xB2BB, 0x4E0E, 0xD3EB, - 0x4E0F, 0x8144, 0x4E10, 0xD8A4, 0x4E11, 0xB3F3, 0x4E12, 0x8145, - 0x4E13, 0xD7A8, 0x4E14, 0xC7D2, 0x4E15, 0xD8A7, 0x4E16, 0xCAC0, - 0x4E17, 0x8146, 0x4E18, 0xC7F0, 0x4E19, 0xB1FB, 0x4E1A, 0xD2B5, - 0x4E1B, 0xB4D4, 0x4E1C, 0xB6AB, 0x4E1D, 0xCBBF, 0x4E1E, 0xD8A9, - 0x4E1F, 0x8147, 0x4E20, 0x8148, 0x4E21, 0x8149, 0x4E22, 0xB6AA, - 0x4E23, 0x814A, 0x4E24, 0xC1BD, 0x4E25, 0xD1CF, 0x4E26, 0x814B, - 0x4E27, 0xC9A5, 0x4E28, 0xD8AD, 0x4E29, 0x814C, 0x4E2A, 0xB8F6, - 0x4E2B, 0xD1BE, 0x4E2C, 0xE3DC, 0x4E2D, 0xD6D0, 0x4E2E, 0x814D, - 0x4E2F, 0x814E, 0x4E30, 0xB7E1, 0x4E31, 0x814F, 0x4E32, 0xB4AE, - 0x4E33, 0x8150, 0x4E34, 0xC1D9, 0x4E35, 0x8151, 0x4E36, 0xD8BC, - 0x4E37, 0x8152, 0x4E38, 0xCDE8, 0x4E39, 0xB5A4, 0x4E3A, 0xCEAA, - 0x4E3B, 0xD6F7, 0x4E3C, 0x8153, 0x4E3D, 0xC0F6, 0x4E3E, 0xBED9, - 0x4E3F, 0xD8AF, 0x4E40, 0x8154, 0x4E41, 0x8155, 0x4E42, 0x8156, - 0x4E43, 0xC4CB, 0x4E44, 0x8157, 0x4E45, 0xBEC3, 0x4E46, 0x8158, - 0x4E47, 0xD8B1, 0x4E48, 0xC3B4, 0x4E49, 0xD2E5, 0x4E4A, 0x8159, - 0x4E4B, 0xD6AE, 0x4E4C, 0xCEDA, 0x4E4D, 0xD5A7, 0x4E4E, 0xBAF5, - 0x4E4F, 0xB7A6, 0x4E50, 0xC0D6, 0x4E51, 0x815A, 0x4E52, 0xC6B9, - 0x4E53, 0xC5D2, 0x4E54, 0xC7C7, 0x4E55, 0x815B, 0x4E56, 0xB9D4, - 0x4E57, 0x815C, 0x4E58, 0xB3CB, 0x4E59, 0xD2D2, 0x4E5A, 0x815D, - 0x4E5B, 0x815E, 0x4E5C, 0xD8BF, 0x4E5D, 0xBEC5, 0x4E5E, 0xC6F2, - 0x4E5F, 0xD2B2, 0x4E60, 0xCFB0, 0x4E61, 0xCFE7, 0x4E62, 0x815F, - 0x4E63, 0x8160, 0x4E64, 0x8161, 0x4E65, 0x8162, 0x4E66, 0xCAE9, - 0x4E67, 0x8163, 0x4E68, 0x8164, 0x4E69, 0xD8C0, 0x4E6A, 0x8165, - 0x4E6B, 0x8166, 0x4E6C, 0x8167, 0x4E6D, 0x8168, 0x4E6E, 0x8169, - 0x4E6F, 0x816A, 0x4E70, 0xC2F2, 0x4E71, 0xC2D2, 0x4E72, 0x816B, - 0x4E73, 0xC8E9, 0x4E74, 0x816C, 0x4E75, 0x816D, 0x4E76, 0x816E, - 0x4E77, 0x816F, 0x4E78, 0x8170, 0x4E79, 0x8171, 0x4E7A, 0x8172, - 0x4E7B, 0x8173, 0x4E7C, 0x8174, 0x4E7D, 0x8175, 0x4E7E, 0xC7AC, - 0x4E7F, 0x8176, 0x4E80, 0x8177, 0x4E81, 0x8178, 0x4E82, 0x8179, - 0x4E83, 0x817A, 0x4E84, 0x817B, 0x4E85, 0x817C, 0x4E86, 0xC1CB, - 0x4E87, 0x817D, 0x4E88, 0xD3E8, 0x4E89, 0xD5F9, 0x4E8A, 0x817E, - 0x4E8B, 0xCAC2, 0x4E8C, 0xB6FE, 0x4E8D, 0xD8A1, 0x4E8E, 0xD3DA, - 0x4E8F, 0xBFF7, 0x4E90, 0x8180, 0x4E91, 0xD4C6, 0x4E92, 0xBBA5, - 0x4E93, 0xD8C1, 0x4E94, 0xCEE5, 0x4E95, 0xBEAE, 0x4E96, 0x8181, - 0x4E97, 0x8182, 0x4E98, 0xD8A8, 0x4E99, 0x8183, 0x4E9A, 0xD1C7, - 0x4E9B, 0xD0A9, 0x4E9C, 0x8184, 0x4E9D, 0x8185, 0x4E9E, 0x8186, - 0x4E9F, 0xD8BD, 0x4EA0, 0xD9EF, 0x4EA1, 0xCDF6, 0x4EA2, 0xBFBA, - 0x4EA3, 0x8187, 0x4EA4, 0xBDBB, 0x4EA5, 0xBAA5, 0x4EA6, 0xD2E0, - 0x4EA7, 0xB2FA, 0x4EA8, 0xBAE0, 0x4EA9, 0xC4B6, 0x4EAA, 0x8188, - 0x4EAB, 0xCFED, 0x4EAC, 0xBEA9, 0x4EAD, 0xCDA4, 0x4EAE, 0xC1C1, - 0x4EAF, 0x8189, 0x4EB0, 0x818A, 0x4EB1, 0x818B, 0x4EB2, 0xC7D7, - 0x4EB3, 0xD9F1, 0x4EB4, 0x818C, 0x4EB5, 0xD9F4, 0x4EB6, 0x818D, - 0x4EB7, 0x818E, 0x4EB8, 0x818F, 0x4EB9, 0x8190, 0x4EBA, 0xC8CB, - 0x4EBB, 0xD8E9, 0x4EBC, 0x8191, 0x4EBD, 0x8192, 0x4EBE, 0x8193, - 0x4EBF, 0xD2DA, 0x4EC0, 0xCAB2, 0x4EC1, 0xC8CA, 0x4EC2, 0xD8EC, - 0x4EC3, 0xD8EA, 0x4EC4, 0xD8C6, 0x4EC5, 0xBDF6, 0x4EC6, 0xC6CD, - 0x4EC7, 0xB3F0, 0x4EC8, 0x8194, 0x4EC9, 0xD8EB, 0x4ECA, 0xBDF1, - 0x4ECB, 0xBDE9, 0x4ECC, 0x8195, 0x4ECD, 0xC8D4, 0x4ECE, 0xB4D3, - 0x4ECF, 0x8196, 0x4ED0, 0x8197, 0x4ED1, 0xC2D8, 0x4ED2, 0x8198, - 0x4ED3, 0xB2D6, 0x4ED4, 0xD7D0, 0x4ED5, 0xCACB, 0x4ED6, 0xCBFB, - 0x4ED7, 0xD5CC, 0x4ED8, 0xB8B6, 0x4ED9, 0xCFC9, 0x4EDA, 0x8199, - 0x4EDB, 0x819A, 0x4EDC, 0x819B, 0x4EDD, 0xD9DA, 0x4EDE, 0xD8F0, - 0x4EDF, 0xC7AA, 0x4EE0, 0x819C, 0x4EE1, 0xD8EE, 0x4EE2, 0x819D, - 0x4EE3, 0xB4FA, 0x4EE4, 0xC1EE, 0x4EE5, 0xD2D4, 0x4EE6, 0x819E, - 0x4EE7, 0x819F, 0x4EE8, 0xD8ED, 0x4EE9, 0x81A0, 0x4EEA, 0xD2C7, - 0x4EEB, 0xD8EF, 0x4EEC, 0xC3C7, 0x4EED, 0x81A1, 0x4EEE, 0x81A2, - 0x4EEF, 0x81A3, 0x4EF0, 0xD1F6, 0x4EF1, 0x81A4, 0x4EF2, 0xD6D9, - 0x4EF3, 0xD8F2, 0x4EF4, 0x81A5, 0x4EF5, 0xD8F5, 0x4EF6, 0xBCFE, - 0x4EF7, 0xBCDB, 0x4EF8, 0x81A6, 0x4EF9, 0x81A7, 0x4EFA, 0x81A8, - 0x4EFB, 0xC8CE, 0x4EFC, 0x81A9, 0x4EFD, 0xB7DD, 0x4EFE, 0x81AA, - 0x4EFF, 0xB7C2, 0x4F00, 0x81AB, 0x4F01, 0xC6F3, 0x4F02, 0x81AC, - 0x4F03, 0x81AD, 0x4F04, 0x81AE, 0x4F05, 0x81AF, 0x4F06, 0x81B0, - 0x4F07, 0x81B1, 0x4F08, 0x81B2, 0x4F09, 0xD8F8, 0x4F0A, 0xD2C1, - 0x4F0B, 0x81B3, 0x4F0C, 0x81B4, 0x4F0D, 0xCEE9, 0x4F0E, 0xBCBF, - 0x4F0F, 0xB7FC, 0x4F10, 0xB7A5, 0x4F11, 0xD0DD, 0x4F12, 0x81B5, - 0x4F13, 0x81B6, 0x4F14, 0x81B7, 0x4F15, 0x81B8, 0x4F16, 0x81B9, - 0x4F17, 0xD6DA, 0x4F18, 0xD3C5, 0x4F19, 0xBBEF, 0x4F1A, 0xBBE1, - 0x4F1B, 0xD8F1, 0x4F1C, 0x81BA, 0x4F1D, 0x81BB, 0x4F1E, 0xC9A1, - 0x4F1F, 0xCEB0, 0x4F20, 0xB4AB, 0x4F21, 0x81BC, 0x4F22, 0xD8F3, - 0x4F23, 0x81BD, 0x4F24, 0xC9CB, 0x4F25, 0xD8F6, 0x4F26, 0xC2D7, - 0x4F27, 0xD8F7, 0x4F28, 0x81BE, 0x4F29, 0x81BF, 0x4F2A, 0xCEB1, - 0x4F2B, 0xD8F9, 0x4F2C, 0x81C0, 0x4F2D, 0x81C1, 0x4F2E, 0x81C2, - 0x4F2F, 0xB2AE, 0x4F30, 0xB9C0, 0x4F31, 0x81C3, 0x4F32, 0xD9A3, - 0x4F33, 0x81C4, 0x4F34, 0xB0E9, 0x4F35, 0x81C5, 0x4F36, 0xC1E6, - 0x4F37, 0x81C6, 0x4F38, 0xC9EC, 0x4F39, 0x81C7, 0x4F3A, 0xCBC5, - 0x4F3B, 0x81C8, 0x4F3C, 0xCBC6, 0x4F3D, 0xD9A4, 0x4F3E, 0x81C9, - 0x4F3F, 0x81CA, 0x4F40, 0x81CB, 0x4F41, 0x81CC, 0x4F42, 0x81CD, - 0x4F43, 0xB5E8, 0x4F44, 0x81CE, 0x4F45, 0x81CF, 0x4F46, 0xB5AB, - 0x4F47, 0x81D0, 0x4F48, 0x81D1, 0x4F49, 0x81D2, 0x4F4A, 0x81D3, - 0x4F4B, 0x81D4, 0x4F4C, 0x81D5, 0x4F4D, 0xCEBB, 0x4F4E, 0xB5CD, - 0x4F4F, 0xD7A1, 0x4F50, 0xD7F4, 0x4F51, 0xD3D3, 0x4F52, 0x81D6, - 0x4F53, 0xCCE5, 0x4F54, 0x81D7, 0x4F55, 0xBACE, 0x4F56, 0x81D8, - 0x4F57, 0xD9A2, 0x4F58, 0xD9DC, 0x4F59, 0xD3E0, 0x4F5A, 0xD8FD, - 0x4F5B, 0xB7F0, 0x4F5C, 0xD7F7, 0x4F5D, 0xD8FE, 0x4F5E, 0xD8FA, - 0x4F5F, 0xD9A1, 0x4F60, 0xC4E3, 0x4F61, 0x81D9, 0x4F62, 0x81DA, - 0x4F63, 0xD3B6, 0x4F64, 0xD8F4, 0x4F65, 0xD9DD, 0x4F66, 0x81DB, - 0x4F67, 0xD8FB, 0x4F68, 0x81DC, 0x4F69, 0xC5E5, 0x4F6A, 0x81DD, - 0x4F6B, 0x81DE, 0x4F6C, 0xC0D0, 0x4F6D, 0x81DF, 0x4F6E, 0x81E0, - 0x4F6F, 0xD1F0, 0x4F70, 0xB0DB, 0x4F71, 0x81E1, 0x4F72, 0x81E2, - 0x4F73, 0xBCD1, 0x4F74, 0xD9A6, 0x4F75, 0x81E3, 0x4F76, 0xD9A5, - 0x4F77, 0x81E4, 0x4F78, 0x81E5, 0x4F79, 0x81E6, 0x4F7A, 0x81E7, - 0x4F7B, 0xD9AC, 0x4F7C, 0xD9AE, 0x4F7D, 0x81E8, 0x4F7E, 0xD9AB, - 0x4F7F, 0xCAB9, 0x4F80, 0x81E9, 0x4F81, 0x81EA, 0x4F82, 0x81EB, - 0x4F83, 0xD9A9, 0x4F84, 0xD6B6, 0x4F85, 0x81EC, 0x4F86, 0x81ED, - 0x4F87, 0x81EE, 0x4F88, 0xB3DE, 0x4F89, 0xD9A8, 0x4F8A, 0x81EF, - 0x4F8B, 0xC0FD, 0x4F8C, 0x81F0, 0x4F8D, 0xCACC, 0x4F8E, 0x81F1, - 0x4F8F, 0xD9AA, 0x4F90, 0x81F2, 0x4F91, 0xD9A7, 0x4F92, 0x81F3, - 0x4F93, 0x81F4, 0x4F94, 0xD9B0, 0x4F95, 0x81F5, 0x4F96, 0x81F6, - 0x4F97, 0xB6B1, 0x4F98, 0x81F7, 0x4F99, 0x81F8, 0x4F9A, 0x81F9, - 0x4F9B, 0xB9A9, 0x4F9C, 0x81FA, 0x4F9D, 0xD2C0, 0x4F9E, 0x81FB, - 0x4F9F, 0x81FC, 0x4FA0, 0xCFC0, 0x4FA1, 0x81FD, 0x4FA2, 0x81FE, - 0x4FA3, 0xC2C2, 0x4FA4, 0x8240, 0x4FA5, 0xBDC4, 0x4FA6, 0xD5EC, - 0x4FA7, 0xB2E0, 0x4FA8, 0xC7C8, 0x4FA9, 0xBFEB, 0x4FAA, 0xD9AD, - 0x4FAB, 0x8241, 0x4FAC, 0xD9AF, 0x4FAD, 0x8242, 0x4FAE, 0xCEEA, - 0x4FAF, 0xBAEE, 0x4FB0, 0x8243, 0x4FB1, 0x8244, 0x4FB2, 0x8245, - 0x4FB3, 0x8246, 0x4FB4, 0x8247, 0x4FB5, 0xC7D6, 0x4FB6, 0x8248, - 0x4FB7, 0x8249, 0x4FB8, 0x824A, 0x4FB9, 0x824B, 0x4FBA, 0x824C, - 0x4FBB, 0x824D, 0x4FBC, 0x824E, 0x4FBD, 0x824F, 0x4FBE, 0x8250, - 0x4FBF, 0xB1E3, 0x4FC0, 0x8251, 0x4FC1, 0x8252, 0x4FC2, 0x8253, - 0x4FC3, 0xB4D9, 0x4FC4, 0xB6ED, 0x4FC5, 0xD9B4, 0x4FC6, 0x8254, - 0x4FC7, 0x8255, 0x4FC8, 0x8256, 0x4FC9, 0x8257, 0x4FCA, 0xBFA1, - 0x4FCB, 0x8258, 0x4FCC, 0x8259, 0x4FCD, 0x825A, 0x4FCE, 0xD9DE, - 0x4FCF, 0xC7CE, 0x4FD0, 0xC0FE, 0x4FD1, 0xD9B8, 0x4FD2, 0x825B, - 0x4FD3, 0x825C, 0x4FD4, 0x825D, 0x4FD5, 0x825E, 0x4FD6, 0x825F, - 0x4FD7, 0xCBD7, 0x4FD8, 0xB7FD, 0x4FD9, 0x8260, 0x4FDA, 0xD9B5, - 0x4FDB, 0x8261, 0x4FDC, 0xD9B7, 0x4FDD, 0xB1A3, 0x4FDE, 0xD3E1, - 0x4FDF, 0xD9B9, 0x4FE0, 0x8262, 0x4FE1, 0xD0C5, 0x4FE2, 0x8263, - 0x4FE3, 0xD9B6, 0x4FE4, 0x8264, 0x4FE5, 0x8265, 0x4FE6, 0xD9B1, - 0x4FE7, 0x8266, 0x4FE8, 0xD9B2, 0x4FE9, 0xC1A9, 0x4FEA, 0xD9B3, - 0x4FEB, 0x8267, 0x4FEC, 0x8268, 0x4FED, 0xBCF3, 0x4FEE, 0xD0DE, - 0x4FEF, 0xB8A9, 0x4FF0, 0x8269, 0x4FF1, 0xBEE3, 0x4FF2, 0x826A, - 0x4FF3, 0xD9BD, 0x4FF4, 0x826B, 0x4FF5, 0x826C, 0x4FF6, 0x826D, - 0x4FF7, 0x826E, 0x4FF8, 0xD9BA, 0x4FF9, 0x826F, 0x4FFA, 0xB0B3, - 0x4FFB, 0x8270, 0x4FFC, 0x8271, 0x4FFD, 0x8272, 0x4FFE, 0xD9C2, - 0x4FFF, 0x8273, 0x5000, 0x8274, 0x5001, 0x8275, 0x5002, 0x8276, - 0x5003, 0x8277, 0x5004, 0x8278, 0x5005, 0x8279, 0x5006, 0x827A, - 0x5007, 0x827B, 0x5008, 0x827C, 0x5009, 0x827D, 0x500A, 0x827E, - 0x500B, 0x8280, 0x500C, 0xD9C4, 0x500D, 0xB1B6, 0x500E, 0x8281, - 0x500F, 0xD9BF, 0x5010, 0x8282, 0x5011, 0x8283, 0x5012, 0xB5B9, - 0x5013, 0x8284, 0x5014, 0xBEF3, 0x5015, 0x8285, 0x5016, 0x8286, - 0x5017, 0x8287, 0x5018, 0xCCC8, 0x5019, 0xBAF2, 0x501A, 0xD2D0, - 0x501B, 0x8288, 0x501C, 0xD9C3, 0x501D, 0x8289, 0x501E, 0x828A, - 0x501F, 0xBDE8, 0x5020, 0x828B, 0x5021, 0xB3AB, 0x5022, 0x828C, - 0x5023, 0x828D, 0x5024, 0x828E, 0x5025, 0xD9C5, 0x5026, 0xBEEB, - 0x5027, 0x828F, 0x5028, 0xD9C6, 0x5029, 0xD9BB, 0x502A, 0xC4DF, - 0x502B, 0x8290, 0x502C, 0xD9BE, 0x502D, 0xD9C1, 0x502E, 0xD9C0, - 0x502F, 0x8291, 0x5030, 0x8292, 0x5031, 0x8293, 0x5032, 0x8294, - 0x5033, 0x8295, 0x5034, 0x8296, 0x5035, 0x8297, 0x5036, 0x8298, - 0x5037, 0x8299, 0x5038, 0x829A, 0x5039, 0x829B, 0x503A, 0xD5AE, - 0x503B, 0x829C, 0x503C, 0xD6B5, 0x503D, 0x829D, 0x503E, 0xC7E3, - 0x503F, 0x829E, 0x5040, 0x829F, 0x5041, 0x82A0, 0x5042, 0x82A1, - 0x5043, 0xD9C8, 0x5044, 0x82A2, 0x5045, 0x82A3, 0x5046, 0x82A4, - 0x5047, 0xBCD9, 0x5048, 0xD9CA, 0x5049, 0x82A5, 0x504A, 0x82A6, - 0x504B, 0x82A7, 0x504C, 0xD9BC, 0x504D, 0x82A8, 0x504E, 0xD9CB, - 0x504F, 0xC6AB, 0x5050, 0x82A9, 0x5051, 0x82AA, 0x5052, 0x82AB, - 0x5053, 0x82AC, 0x5054, 0x82AD, 0x5055, 0xD9C9, 0x5056, 0x82AE, - 0x5057, 0x82AF, 0x5058, 0x82B0, 0x5059, 0x82B1, 0x505A, 0xD7F6, - 0x505B, 0x82B2, 0x505C, 0xCDA3, 0x505D, 0x82B3, 0x505E, 0x82B4, - 0x505F, 0x82B5, 0x5060, 0x82B6, 0x5061, 0x82B7, 0x5062, 0x82B8, - 0x5063, 0x82B9, 0x5064, 0x82BA, 0x5065, 0xBDA1, 0x5066, 0x82BB, - 0x5067, 0x82BC, 0x5068, 0x82BD, 0x5069, 0x82BE, 0x506A, 0x82BF, - 0x506B, 0x82C0, 0x506C, 0xD9CC, 0x506D, 0x82C1, 0x506E, 0x82C2, - 0x506F, 0x82C3, 0x5070, 0x82C4, 0x5071, 0x82C5, 0x5072, 0x82C6, - 0x5073, 0x82C7, 0x5074, 0x82C8, 0x5075, 0x82C9, 0x5076, 0xC5BC, - 0x5077, 0xCDB5, 0x5078, 0x82CA, 0x5079, 0x82CB, 0x507A, 0x82CC, - 0x507B, 0xD9CD, 0x507C, 0x82CD, 0x507D, 0x82CE, 0x507E, 0xD9C7, - 0x507F, 0xB3A5, 0x5080, 0xBFFE, 0x5081, 0x82CF, 0x5082, 0x82D0, - 0x5083, 0x82D1, 0x5084, 0x82D2, 0x5085, 0xB8B5, 0x5086, 0x82D3, - 0x5087, 0x82D4, 0x5088, 0xC0FC, 0x5089, 0x82D5, 0x508A, 0x82D6, - 0x508B, 0x82D7, 0x508C, 0x82D8, 0x508D, 0xB0F8, 0x508E, 0x82D9, - 0x508F, 0x82DA, 0x5090, 0x82DB, 0x5091, 0x82DC, 0x5092, 0x82DD, - 0x5093, 0x82DE, 0x5094, 0x82DF, 0x5095, 0x82E0, 0x5096, 0x82E1, - 0x5097, 0x82E2, 0x5098, 0x82E3, 0x5099, 0x82E4, 0x509A, 0x82E5, - 0x509B, 0x82E6, 0x509C, 0x82E7, 0x509D, 0x82E8, 0x509E, 0x82E9, - 0x509F, 0x82EA, 0x50A0, 0x82EB, 0x50A1, 0x82EC, 0x50A2, 0x82ED, - 0x50A3, 0xB4F6, 0x50A4, 0x82EE, 0x50A5, 0xD9CE, 0x50A6, 0x82EF, - 0x50A7, 0xD9CF, 0x50A8, 0xB4A2, 0x50A9, 0xD9D0, 0x50AA, 0x82F0, - 0x50AB, 0x82F1, 0x50AC, 0xB4DF, 0x50AD, 0x82F2, 0x50AE, 0x82F3, - 0x50AF, 0x82F4, 0x50B0, 0x82F5, 0x50B1, 0x82F6, 0x50B2, 0xB0C1, - 0x50B3, 0x82F7, 0x50B4, 0x82F8, 0x50B5, 0x82F9, 0x50B6, 0x82FA, - 0x50B7, 0x82FB, 0x50B8, 0x82FC, 0x50B9, 0x82FD, 0x50BA, 0xD9D1, - 0x50BB, 0xC9B5, 0x50BC, 0x82FE, 0x50BD, 0x8340, 0x50BE, 0x8341, - 0x50BF, 0x8342, 0x50C0, 0x8343, 0x50C1, 0x8344, 0x50C2, 0x8345, - 0x50C3, 0x8346, 0x50C4, 0x8347, 0x50C5, 0x8348, 0x50C6, 0x8349, - 0x50C7, 0x834A, 0x50C8, 0x834B, 0x50C9, 0x834C, 0x50CA, 0x834D, - 0x50CB, 0x834E, 0x50CC, 0x834F, 0x50CD, 0x8350, 0x50CE, 0x8351, - 0x50CF, 0xCFF1, 0x50D0, 0x8352, 0x50D1, 0x8353, 0x50D2, 0x8354, - 0x50D3, 0x8355, 0x50D4, 0x8356, 0x50D5, 0x8357, 0x50D6, 0xD9D2, - 0x50D7, 0x8358, 0x50D8, 0x8359, 0x50D9, 0x835A, 0x50DA, 0xC1C5, - 0x50DB, 0x835B, 0x50DC, 0x835C, 0x50DD, 0x835D, 0x50DE, 0x835E, - 0x50DF, 0x835F, 0x50E0, 0x8360, 0x50E1, 0x8361, 0x50E2, 0x8362, - 0x50E3, 0x8363, 0x50E4, 0x8364, 0x50E5, 0x8365, 0x50E6, 0xD9D6, - 0x50E7, 0xC9AE, 0x50E8, 0x8366, 0x50E9, 0x8367, 0x50EA, 0x8368, - 0x50EB, 0x8369, 0x50EC, 0xD9D5, 0x50ED, 0xD9D4, 0x50EE, 0xD9D7, - 0x50EF, 0x836A, 0x50F0, 0x836B, 0x50F1, 0x836C, 0x50F2, 0x836D, - 0x50F3, 0xCBDB, 0x50F4, 0x836E, 0x50F5, 0xBDA9, 0x50F6, 0x836F, - 0x50F7, 0x8370, 0x50F8, 0x8371, 0x50F9, 0x8372, 0x50FA, 0x8373, - 0x50FB, 0xC6A7, 0x50FC, 0x8374, 0x50FD, 0x8375, 0x50FE, 0x8376, - 0x50FF, 0x8377, 0x5100, 0x8378, 0x5101, 0x8379, 0x5102, 0x837A, - 0x5103, 0x837B, 0x5104, 0x837C, 0x5105, 0x837D, 0x5106, 0xD9D3, - 0x5107, 0xD9D8, 0x5108, 0x837E, 0x5109, 0x8380, 0x510A, 0x8381, - 0x510B, 0xD9D9, 0x510C, 0x8382, 0x510D, 0x8383, 0x510E, 0x8384, - 0x510F, 0x8385, 0x5110, 0x8386, 0x5111, 0x8387, 0x5112, 0xC8E5, - 0x5113, 0x8388, 0x5114, 0x8389, 0x5115, 0x838A, 0x5116, 0x838B, - 0x5117, 0x838C, 0x5118, 0x838D, 0x5119, 0x838E, 0x511A, 0x838F, - 0x511B, 0x8390, 0x511C, 0x8391, 0x511D, 0x8392, 0x511E, 0x8393, - 0x511F, 0x8394, 0x5120, 0x8395, 0x5121, 0xC0DC, 0x5122, 0x8396, - 0x5123, 0x8397, 0x5124, 0x8398, 0x5125, 0x8399, 0x5126, 0x839A, - 0x5127, 0x839B, 0x5128, 0x839C, 0x5129, 0x839D, 0x512A, 0x839E, - 0x512B, 0x839F, 0x512C, 0x83A0, 0x512D, 0x83A1, 0x512E, 0x83A2, - 0x512F, 0x83A3, 0x5130, 0x83A4, 0x5131, 0x83A5, 0x5132, 0x83A6, - 0x5133, 0x83A7, 0x5134, 0x83A8, 0x5135, 0x83A9, 0x5136, 0x83AA, - 0x5137, 0x83AB, 0x5138, 0x83AC, 0x5139, 0x83AD, 0x513A, 0x83AE, - 0x513B, 0x83AF, 0x513C, 0x83B0, 0x513D, 0x83B1, 0x513E, 0x83B2, - 0x513F, 0xB6F9, 0x5140, 0xD8A3, 0x5141, 0xD4CA, 0x5142, 0x83B3, - 0x5143, 0xD4AA, 0x5144, 0xD0D6, 0x5145, 0xB3E4, 0x5146, 0xD5D7, - 0x5147, 0x83B4, 0x5148, 0xCFC8, 0x5149, 0xB9E2, 0x514A, 0x83B5, - 0x514B, 0xBFCB, 0x514C, 0x83B6, 0x514D, 0xC3E2, 0x514E, 0x83B7, - 0x514F, 0x83B8, 0x5150, 0x83B9, 0x5151, 0xB6D2, 0x5152, 0x83BA, - 0x5153, 0x83BB, 0x5154, 0xCDC3, 0x5155, 0xD9EE, 0x5156, 0xD9F0, - 0x5157, 0x83BC, 0x5158, 0x83BD, 0x5159, 0x83BE, 0x515A, 0xB5B3, - 0x515B, 0x83BF, 0x515C, 0xB6B5, 0x515D, 0x83C0, 0x515E, 0x83C1, - 0x515F, 0x83C2, 0x5160, 0x83C3, 0x5161, 0x83C4, 0x5162, 0xBEA4, - 0x5163, 0x83C5, 0x5164, 0x83C6, 0x5165, 0xC8EB, 0x5166, 0x83C7, - 0x5167, 0x83C8, 0x5168, 0xC8AB, 0x5169, 0x83C9, 0x516A, 0x83CA, - 0x516B, 0xB0CB, 0x516C, 0xB9AB, 0x516D, 0xC1F9, 0x516E, 0xD9E2, - 0x516F, 0x83CB, 0x5170, 0xC0BC, 0x5171, 0xB9B2, 0x5172, 0x83CC, - 0x5173, 0xB9D8, 0x5174, 0xD0CB, 0x5175, 0xB1F8, 0x5176, 0xC6E4, - 0x5177, 0xBEDF, 0x5178, 0xB5E4, 0x5179, 0xD7C8, 0x517A, 0x83CD, - 0x517B, 0xD1F8, 0x517C, 0xBCE6, 0x517D, 0xCADE, 0x517E, 0x83CE, - 0x517F, 0x83CF, 0x5180, 0xBCBD, 0x5181, 0xD9E6, 0x5182, 0xD8E7, - 0x5183, 0x83D0, 0x5184, 0x83D1, 0x5185, 0xC4DA, 0x5186, 0x83D2, - 0x5187, 0x83D3, 0x5188, 0xB8D4, 0x5189, 0xC8BD, 0x518A, 0x83D4, - 0x518B, 0x83D5, 0x518C, 0xB2E1, 0x518D, 0xD4D9, 0x518E, 0x83D6, - 0x518F, 0x83D7, 0x5190, 0x83D8, 0x5191, 0x83D9, 0x5192, 0xC3B0, - 0x5193, 0x83DA, 0x5194, 0x83DB, 0x5195, 0xC3E1, 0x5196, 0xDAA2, - 0x5197, 0xC8DF, 0x5198, 0x83DC, 0x5199, 0xD0B4, 0x519A, 0x83DD, - 0x519B, 0xBEFC, 0x519C, 0xC5A9, 0x519D, 0x83DE, 0x519E, 0x83DF, - 0x519F, 0x83E0, 0x51A0, 0xB9DA, 0x51A1, 0x83E1, 0x51A2, 0xDAA3, - 0x51A3, 0x83E2, 0x51A4, 0xD4A9, 0x51A5, 0xDAA4, 0x51A6, 0x83E3, - 0x51A7, 0x83E4, 0x51A8, 0x83E5, 0x51A9, 0x83E6, 0x51AA, 0x83E7, - 0x51AB, 0xD9FB, 0x51AC, 0xB6AC, 0x51AD, 0x83E8, 0x51AE, 0x83E9, - 0x51AF, 0xB7EB, 0x51B0, 0xB1F9, 0x51B1, 0xD9FC, 0x51B2, 0xB3E5, - 0x51B3, 0xBEF6, 0x51B4, 0x83EA, 0x51B5, 0xBFF6, 0x51B6, 0xD2B1, - 0x51B7, 0xC0E4, 0x51B8, 0x83EB, 0x51B9, 0x83EC, 0x51BA, 0x83ED, - 0x51BB, 0xB6B3, 0x51BC, 0xD9FE, 0x51BD, 0xD9FD, 0x51BE, 0x83EE, - 0x51BF, 0x83EF, 0x51C0, 0xBEBB, 0x51C1, 0x83F0, 0x51C2, 0x83F1, - 0x51C3, 0x83F2, 0x51C4, 0xC6E0, 0x51C5, 0x83F3, 0x51C6, 0xD7BC, - 0x51C7, 0xDAA1, 0x51C8, 0x83F4, 0x51C9, 0xC1B9, 0x51CA, 0x83F5, - 0x51CB, 0xB5F2, 0x51CC, 0xC1E8, 0x51CD, 0x83F6, 0x51CE, 0x83F7, - 0x51CF, 0xBCF5, 0x51D0, 0x83F8, 0x51D1, 0xB4D5, 0x51D2, 0x83F9, - 0x51D3, 0x83FA, 0x51D4, 0x83FB, 0x51D5, 0x83FC, 0x51D6, 0x83FD, - 0x51D7, 0x83FE, 0x51D8, 0x8440, 0x51D9, 0x8441, 0x51DA, 0x8442, - 0x51DB, 0xC1DD, 0x51DC, 0x8443, 0x51DD, 0xC4FD, 0x51DE, 0x8444, - 0x51DF, 0x8445, 0x51E0, 0xBCB8, 0x51E1, 0xB7B2, 0x51E2, 0x8446, - 0x51E3, 0x8447, 0x51E4, 0xB7EF, 0x51E5, 0x8448, 0x51E6, 0x8449, - 0x51E7, 0x844A, 0x51E8, 0x844B, 0x51E9, 0x844C, 0x51EA, 0x844D, - 0x51EB, 0xD9EC, 0x51EC, 0x844E, 0x51ED, 0xC6BE, 0x51EE, 0x844F, - 0x51EF, 0xBFAD, 0x51F0, 0xBBCB, 0x51F1, 0x8450, 0x51F2, 0x8451, - 0x51F3, 0xB5CA, 0x51F4, 0x8452, 0x51F5, 0xDBC9, 0x51F6, 0xD0D7, - 0x51F7, 0x8453, 0x51F8, 0xCDB9, 0x51F9, 0xB0BC, 0x51FA, 0xB3F6, - 0x51FB, 0xBBF7, 0x51FC, 0xDBCA, 0x51FD, 0xBAAF, 0x51FE, 0x8454, - 0x51FF, 0xD4E4, 0x5200, 0xB5B6, 0x5201, 0xB5F3, 0x5202, 0xD8D6, - 0x5203, 0xC8D0, 0x5204, 0x8455, 0x5205, 0x8456, 0x5206, 0xB7D6, - 0x5207, 0xC7D0, 0x5208, 0xD8D7, 0x5209, 0x8457, 0x520A, 0xBFAF, - 0x520B, 0x8458, 0x520C, 0x8459, 0x520D, 0xDBBB, 0x520E, 0xD8D8, - 0x520F, 0x845A, 0x5210, 0x845B, 0x5211, 0xD0CC, 0x5212, 0xBBAE, - 0x5213, 0x845C, 0x5214, 0x845D, 0x5215, 0x845E, 0x5216, 0xEBBE, - 0x5217, 0xC1D0, 0x5218, 0xC1F5, 0x5219, 0xD4F2, 0x521A, 0xB8D5, - 0x521B, 0xB4B4, 0x521C, 0x845F, 0x521D, 0xB3F5, 0x521E, 0x8460, - 0x521F, 0x8461, 0x5220, 0xC9BE, 0x5221, 0x8462, 0x5222, 0x8463, - 0x5223, 0x8464, 0x5224, 0xC5D0, 0x5225, 0x8465, 0x5226, 0x8466, - 0x5227, 0x8467, 0x5228, 0xC5D9, 0x5229, 0xC0FB, 0x522A, 0x8468, - 0x522B, 0xB1F0, 0x522C, 0x8469, 0x522D, 0xD8D9, 0x522E, 0xB9CE, - 0x522F, 0x846A, 0x5230, 0xB5BD, 0x5231, 0x846B, 0x5232, 0x846C, - 0x5233, 0xD8DA, 0x5234, 0x846D, 0x5235, 0x846E, 0x5236, 0xD6C6, - 0x5237, 0xCBA2, 0x5238, 0xC8AF, 0x5239, 0xC9B2, 0x523A, 0xB4CC, - 0x523B, 0xBFCC, 0x523C, 0x846F, 0x523D, 0xB9F4, 0x523E, 0x8470, - 0x523F, 0xD8DB, 0x5240, 0xD8DC, 0x5241, 0xB6E7, 0x5242, 0xBCC1, - 0x5243, 0xCCEA, 0x5244, 0x8471, 0x5245, 0x8472, 0x5246, 0x8473, - 0x5247, 0x8474, 0x5248, 0x8475, 0x5249, 0x8476, 0x524A, 0xCFF7, - 0x524B, 0x8477, 0x524C, 0xD8DD, 0x524D, 0xC7B0, 0x524E, 0x8478, - 0x524F, 0x8479, 0x5250, 0xB9D0, 0x5251, 0xBDA3, 0x5252, 0x847A, - 0x5253, 0x847B, 0x5254, 0xCCDE, 0x5255, 0x847C, 0x5256, 0xC6CA, - 0x5257, 0x847D, 0x5258, 0x847E, 0x5259, 0x8480, 0x525A, 0x8481, - 0x525B, 0x8482, 0x525C, 0xD8E0, 0x525D, 0x8483, 0x525E, 0xD8DE, - 0x525F, 0x8484, 0x5260, 0x8485, 0x5261, 0xD8DF, 0x5262, 0x8486, - 0x5263, 0x8487, 0x5264, 0x8488, 0x5265, 0xB0FE, 0x5266, 0x8489, - 0x5267, 0xBEE7, 0x5268, 0x848A, 0x5269, 0xCAA3, 0x526A, 0xBCF4, - 0x526B, 0x848B, 0x526C, 0x848C, 0x526D, 0x848D, 0x526E, 0x848E, - 0x526F, 0xB8B1, 0x5270, 0x848F, 0x5271, 0x8490, 0x5272, 0xB8EE, - 0x5273, 0x8491, 0x5274, 0x8492, 0x5275, 0x8493, 0x5276, 0x8494, - 0x5277, 0x8495, 0x5278, 0x8496, 0x5279, 0x8497, 0x527A, 0x8498, - 0x527B, 0x8499, 0x527C, 0x849A, 0x527D, 0xD8E2, 0x527E, 0x849B, - 0x527F, 0xBDCB, 0x5280, 0x849C, 0x5281, 0xD8E4, 0x5282, 0xD8E3, - 0x5283, 0x849D, 0x5284, 0x849E, 0x5285, 0x849F, 0x5286, 0x84A0, - 0x5287, 0x84A1, 0x5288, 0xC5FC, 0x5289, 0x84A2, 0x528A, 0x84A3, - 0x528B, 0x84A4, 0x528C, 0x84A5, 0x528D, 0x84A6, 0x528E, 0x84A7, - 0x528F, 0x84A8, 0x5290, 0xD8E5, 0x5291, 0x84A9, 0x5292, 0x84AA, - 0x5293, 0xD8E6, 0x5294, 0x84AB, 0x5295, 0x84AC, 0x5296, 0x84AD, - 0x5297, 0x84AE, 0x5298, 0x84AF, 0x5299, 0x84B0, 0x529A, 0x84B1, - 0x529B, 0xC1A6, 0x529C, 0x84B2, 0x529D, 0xC8B0, 0x529E, 0xB0EC, - 0x529F, 0xB9A6, 0x52A0, 0xBCD3, 0x52A1, 0xCEF1, 0x52A2, 0xDBBD, - 0x52A3, 0xC1D3, 0x52A4, 0x84B3, 0x52A5, 0x84B4, 0x52A6, 0x84B5, - 0x52A7, 0x84B6, 0x52A8, 0xB6AF, 0x52A9, 0xD6FA, 0x52AA, 0xC5AC, - 0x52AB, 0xBDD9, 0x52AC, 0xDBBE, 0x52AD, 0xDBBF, 0x52AE, 0x84B7, - 0x52AF, 0x84B8, 0x52B0, 0x84B9, 0x52B1, 0xC0F8, 0x52B2, 0xBEA2, - 0x52B3, 0xC0CD, 0x52B4, 0x84BA, 0x52B5, 0x84BB, 0x52B6, 0x84BC, - 0x52B7, 0x84BD, 0x52B8, 0x84BE, 0x52B9, 0x84BF, 0x52BA, 0x84C0, - 0x52BB, 0x84C1, 0x52BC, 0x84C2, 0x52BD, 0x84C3, 0x52BE, 0xDBC0, - 0x52BF, 0xCAC6, 0x52C0, 0x84C4, 0x52C1, 0x84C5, 0x52C2, 0x84C6, - 0x52C3, 0xB2AA, 0x52C4, 0x84C7, 0x52C5, 0x84C8, 0x52C6, 0x84C9, - 0x52C7, 0xD3C2, 0x52C8, 0x84CA, 0x52C9, 0xC3E3, 0x52CA, 0x84CB, - 0x52CB, 0xD1AB, 0x52CC, 0x84CC, 0x52CD, 0x84CD, 0x52CE, 0x84CE, - 0x52CF, 0x84CF, 0x52D0, 0xDBC2, 0x52D1, 0x84D0, 0x52D2, 0xC0D5, - 0x52D3, 0x84D1, 0x52D4, 0x84D2, 0x52D5, 0x84D3, 0x52D6, 0xDBC3, - 0x52D7, 0x84D4, 0x52D8, 0xBFB1, 0x52D9, 0x84D5, 0x52DA, 0x84D6, - 0x52DB, 0x84D7, 0x52DC, 0x84D8, 0x52DD, 0x84D9, 0x52DE, 0x84DA, - 0x52DF, 0xC4BC, 0x52E0, 0x84DB, 0x52E1, 0x84DC, 0x52E2, 0x84DD, - 0x52E3, 0x84DE, 0x52E4, 0xC7DA, 0x52E5, 0x84DF, 0x52E6, 0x84E0, - 0x52E7, 0x84E1, 0x52E8, 0x84E2, 0x52E9, 0x84E3, 0x52EA, 0x84E4, - 0x52EB, 0x84E5, 0x52EC, 0x84E6, 0x52ED, 0x84E7, 0x52EE, 0x84E8, - 0x52EF, 0x84E9, 0x52F0, 0xDBC4, 0x52F1, 0x84EA, 0x52F2, 0x84EB, - 0x52F3, 0x84EC, 0x52F4, 0x84ED, 0x52F5, 0x84EE, 0x52F6, 0x84EF, - 0x52F7, 0x84F0, 0x52F8, 0x84F1, 0x52F9, 0xD9E8, 0x52FA, 0xC9D7, - 0x52FB, 0x84F2, 0x52FC, 0x84F3, 0x52FD, 0x84F4, 0x52FE, 0xB9B4, - 0x52FF, 0xCEF0, 0x5300, 0xD4C8, 0x5301, 0x84F5, 0x5302, 0x84F6, - 0x5303, 0x84F7, 0x5304, 0x84F8, 0x5305, 0xB0FC, 0x5306, 0xB4D2, - 0x5307, 0x84F9, 0x5308, 0xD0D9, 0x5309, 0x84FA, 0x530A, 0x84FB, - 0x530B, 0x84FC, 0x530C, 0x84FD, 0x530D, 0xD9E9, 0x530E, 0x84FE, - 0x530F, 0xDECB, 0x5310, 0xD9EB, 0x5311, 0x8540, 0x5312, 0x8541, - 0x5313, 0x8542, 0x5314, 0x8543, 0x5315, 0xD8B0, 0x5316, 0xBBAF, - 0x5317, 0xB1B1, 0x5318, 0x8544, 0x5319, 0xB3D7, 0x531A, 0xD8CE, - 0x531B, 0x8545, 0x531C, 0x8546, 0x531D, 0xD4D1, 0x531E, 0x8547, - 0x531F, 0x8548, 0x5320, 0xBDB3, 0x5321, 0xBFEF, 0x5322, 0x8549, - 0x5323, 0xCFBB, 0x5324, 0x854A, 0x5325, 0x854B, 0x5326, 0xD8D0, - 0x5327, 0x854C, 0x5328, 0x854D, 0x5329, 0x854E, 0x532A, 0xB7CB, - 0x532B, 0x854F, 0x532C, 0x8550, 0x532D, 0x8551, 0x532E, 0xD8D1, - 0x532F, 0x8552, 0x5330, 0x8553, 0x5331, 0x8554, 0x5332, 0x8555, - 0x5333, 0x8556, 0x5334, 0x8557, 0x5335, 0x8558, 0x5336, 0x8559, - 0x5337, 0x855A, 0x5338, 0x855B, 0x5339, 0xC6A5, 0x533A, 0xC7F8, - 0x533B, 0xD2BD, 0x533C, 0x855C, 0x533D, 0x855D, 0x533E, 0xD8D2, - 0x533F, 0xC4E4, 0x5340, 0x855E, 0x5341, 0xCAAE, 0x5342, 0x855F, - 0x5343, 0xC7A7, 0x5344, 0x8560, 0x5345, 0xD8A6, 0x5346, 0x8561, - 0x5347, 0xC9FD, 0x5348, 0xCEE7, 0x5349, 0xBBDC, 0x534A, 0xB0EB, - 0x534B, 0x8562, 0x534C, 0x8563, 0x534D, 0x8564, 0x534E, 0xBBAA, - 0x534F, 0xD0AD, 0x5350, 0x8565, 0x5351, 0xB1B0, 0x5352, 0xD7E4, - 0x5353, 0xD7BF, 0x5354, 0x8566, 0x5355, 0xB5A5, 0x5356, 0xC2F4, - 0x5357, 0xC4CF, 0x5358, 0x8567, 0x5359, 0x8568, 0x535A, 0xB2A9, - 0x535B, 0x8569, 0x535C, 0xB2B7, 0x535D, 0x856A, 0x535E, 0xB1E5, - 0x535F, 0xDFB2, 0x5360, 0xD5BC, 0x5361, 0xBFA8, 0x5362, 0xC2AC, - 0x5363, 0xD8D5, 0x5364, 0xC2B1, 0x5365, 0x856B, 0x5366, 0xD8D4, - 0x5367, 0xCED4, 0x5368, 0x856C, 0x5369, 0xDAE0, 0x536A, 0x856D, - 0x536B, 0xCEC0, 0x536C, 0x856E, 0x536D, 0x856F, 0x536E, 0xD8B4, - 0x536F, 0xC3AE, 0x5370, 0xD3A1, 0x5371, 0xCEA3, 0x5372, 0x8570, - 0x5373, 0xBCB4, 0x5374, 0xC8B4, 0x5375, 0xC2D1, 0x5376, 0x8571, - 0x5377, 0xBEED, 0x5378, 0xD0B6, 0x5379, 0x8572, 0x537A, 0xDAE1, - 0x537B, 0x8573, 0x537C, 0x8574, 0x537D, 0x8575, 0x537E, 0x8576, - 0x537F, 0xC7E4, 0x5380, 0x8577, 0x5381, 0x8578, 0x5382, 0xB3A7, - 0x5383, 0x8579, 0x5384, 0xB6F2, 0x5385, 0xCCFC, 0x5386, 0xC0FA, - 0x5387, 0x857A, 0x5388, 0x857B, 0x5389, 0xC0F7, 0x538A, 0x857C, - 0x538B, 0xD1B9, 0x538C, 0xD1E1, 0x538D, 0xD8C7, 0x538E, 0x857D, - 0x538F, 0x857E, 0x5390, 0x8580, 0x5391, 0x8581, 0x5392, 0x8582, - 0x5393, 0x8583, 0x5394, 0x8584, 0x5395, 0xB2DE, 0x5396, 0x8585, - 0x5397, 0x8586, 0x5398, 0xC0E5, 0x5399, 0x8587, 0x539A, 0xBAF1, - 0x539B, 0x8588, 0x539C, 0x8589, 0x539D, 0xD8C8, 0x539E, 0x858A, - 0x539F, 0xD4AD, 0x53A0, 0x858B, 0x53A1, 0x858C, 0x53A2, 0xCFE1, - 0x53A3, 0xD8C9, 0x53A4, 0x858D, 0x53A5, 0xD8CA, 0x53A6, 0xCFC3, - 0x53A7, 0x858E, 0x53A8, 0xB3F8, 0x53A9, 0xBEC7, 0x53AA, 0x858F, - 0x53AB, 0x8590, 0x53AC, 0x8591, 0x53AD, 0x8592, 0x53AE, 0xD8CB, - 0x53AF, 0x8593, 0x53B0, 0x8594, 0x53B1, 0x8595, 0x53B2, 0x8596, - 0x53B3, 0x8597, 0x53B4, 0x8598, 0x53B5, 0x8599, 0x53B6, 0xDBCC, - 0x53B7, 0x859A, 0x53B8, 0x859B, 0x53B9, 0x859C, 0x53BA, 0x859D, - 0x53BB, 0xC8A5, 0x53BC, 0x859E, 0x53BD, 0x859F, 0x53BE, 0x85A0, - 0x53BF, 0xCFD8, 0x53C0, 0x85A1, 0x53C1, 0xC8FE, 0x53C2, 0xB2CE, - 0x53C3, 0x85A2, 0x53C4, 0x85A3, 0x53C5, 0x85A4, 0x53C6, 0x85A5, - 0x53C7, 0x85A6, 0x53C8, 0xD3D6, 0x53C9, 0xB2E6, 0x53CA, 0xBCB0, - 0x53CB, 0xD3D1, 0x53CC, 0xCBAB, 0x53CD, 0xB7B4, 0x53CE, 0x85A7, - 0x53CF, 0x85A8, 0x53D0, 0x85A9, 0x53D1, 0xB7A2, 0x53D2, 0x85AA, - 0x53D3, 0x85AB, 0x53D4, 0xCAE5, 0x53D5, 0x85AC, 0x53D6, 0xC8A1, - 0x53D7, 0xCADC, 0x53D8, 0xB1E4, 0x53D9, 0xD0F0, 0x53DA, 0x85AD, - 0x53DB, 0xC5D1, 0x53DC, 0x85AE, 0x53DD, 0x85AF, 0x53DE, 0x85B0, - 0x53DF, 0xDBC5, 0x53E0, 0xB5FE, 0x53E1, 0x85B1, 0x53E2, 0x85B2, - 0x53E3, 0xBFDA, 0x53E4, 0xB9C5, 0x53E5, 0xBEE4, 0x53E6, 0xC1ED, - 0x53E7, 0x85B3, 0x53E8, 0xDFB6, 0x53E9, 0xDFB5, 0x53EA, 0xD6BB, - 0x53EB, 0xBDD0, 0x53EC, 0xD5D9, 0x53ED, 0xB0C8, 0x53EE, 0xB6A3, - 0x53EF, 0xBFC9, 0x53F0, 0xCCA8, 0x53F1, 0xDFB3, 0x53F2, 0xCAB7, - 0x53F3, 0xD3D2, 0x53F4, 0x85B4, 0x53F5, 0xD8CF, 0x53F6, 0xD2B6, - 0x53F7, 0xBAC5, 0x53F8, 0xCBBE, 0x53F9, 0xCCBE, 0x53FA, 0x85B5, - 0x53FB, 0xDFB7, 0x53FC, 0xB5F0, 0x53FD, 0xDFB4, 0x53FE, 0x85B6, - 0x53FF, 0x85B7, 0x5400, 0x85B8, 0x5401, 0xD3F5, 0x5402, 0x85B9, - 0x5403, 0xB3D4, 0x5404, 0xB8F7, 0x5405, 0x85BA, 0x5406, 0xDFBA, - 0x5407, 0x85BB, 0x5408, 0xBACF, 0x5409, 0xBCAA, 0x540A, 0xB5F5, - 0x540B, 0x85BC, 0x540C, 0xCDAC, 0x540D, 0xC3FB, 0x540E, 0xBAF3, - 0x540F, 0xC0F4, 0x5410, 0xCDC2, 0x5411, 0xCFF2, 0x5412, 0xDFB8, - 0x5413, 0xCFC5, 0x5414, 0x85BD, 0x5415, 0xC2C0, 0x5416, 0xDFB9, - 0x5417, 0xC2F0, 0x5418, 0x85BE, 0x5419, 0x85BF, 0x541A, 0x85C0, - 0x541B, 0xBEFD, 0x541C, 0x85C1, 0x541D, 0xC1DF, 0x541E, 0xCDCC, - 0x541F, 0xD2F7, 0x5420, 0xB7CD, 0x5421, 0xDFC1, 0x5422, 0x85C2, - 0x5423, 0xDFC4, 0x5424, 0x85C3, 0x5425, 0x85C4, 0x5426, 0xB7F1, - 0x5427, 0xB0C9, 0x5428, 0xB6D6, 0x5429, 0xB7D4, 0x542A, 0x85C5, - 0x542B, 0xBAAC, 0x542C, 0xCCFD, 0x542D, 0xBFD4, 0x542E, 0xCBB1, - 0x542F, 0xC6F4, 0x5430, 0x85C6, 0x5431, 0xD6A8, 0x5432, 0xDFC5, - 0x5433, 0x85C7, 0x5434, 0xCEE2, 0x5435, 0xB3B3, 0x5436, 0x85C8, - 0x5437, 0x85C9, 0x5438, 0xCEFC, 0x5439, 0xB4B5, 0x543A, 0x85CA, - 0x543B, 0xCEC7, 0x543C, 0xBAF0, 0x543D, 0x85CB, 0x543E, 0xCEE1, - 0x543F, 0x85CC, 0x5440, 0xD1BD, 0x5441, 0x85CD, 0x5442, 0x85CE, - 0x5443, 0xDFC0, 0x5444, 0x85CF, 0x5445, 0x85D0, 0x5446, 0xB4F4, - 0x5447, 0x85D1, 0x5448, 0xB3CA, 0x5449, 0x85D2, 0x544A, 0xB8E6, - 0x544B, 0xDFBB, 0x544C, 0x85D3, 0x544D, 0x85D4, 0x544E, 0x85D5, - 0x544F, 0x85D6, 0x5450, 0xC4C5, 0x5451, 0x85D7, 0x5452, 0xDFBC, - 0x5453, 0xDFBD, 0x5454, 0xDFBE, 0x5455, 0xC5BB, 0x5456, 0xDFBF, - 0x5457, 0xDFC2, 0x5458, 0xD4B1, 0x5459, 0xDFC3, 0x545A, 0x85D8, - 0x545B, 0xC7BA, 0x545C, 0xCED8, 0x545D, 0x85D9, 0x545E, 0x85DA, - 0x545F, 0x85DB, 0x5460, 0x85DC, 0x5461, 0x85DD, 0x5462, 0xC4D8, - 0x5463, 0x85DE, 0x5464, 0xDFCA, 0x5465, 0x85DF, 0x5466, 0xDFCF, - 0x5467, 0x85E0, 0x5468, 0xD6DC, 0x5469, 0x85E1, 0x546A, 0x85E2, - 0x546B, 0x85E3, 0x546C, 0x85E4, 0x546D, 0x85E5, 0x546E, 0x85E6, - 0x546F, 0x85E7, 0x5470, 0x85E8, 0x5471, 0xDFC9, 0x5472, 0xDFDA, - 0x5473, 0xCEB6, 0x5474, 0x85E9, 0x5475, 0xBAC7, 0x5476, 0xDFCE, - 0x5477, 0xDFC8, 0x5478, 0xC5DE, 0x5479, 0x85EA, 0x547A, 0x85EB, - 0x547B, 0xC9EB, 0x547C, 0xBAF4, 0x547D, 0xC3FC, 0x547E, 0x85EC, - 0x547F, 0x85ED, 0x5480, 0xBED7, 0x5481, 0x85EE, 0x5482, 0xDFC6, - 0x5483, 0x85EF, 0x5484, 0xDFCD, 0x5485, 0x85F0, 0x5486, 0xC5D8, - 0x5487, 0x85F1, 0x5488, 0x85F2, 0x5489, 0x85F3, 0x548A, 0x85F4, - 0x548B, 0xD5A6, 0x548C, 0xBACD, 0x548D, 0x85F5, 0x548E, 0xBECC, - 0x548F, 0xD3BD, 0x5490, 0xB8C0, 0x5491, 0x85F6, 0x5492, 0xD6E4, - 0x5493, 0x85F7, 0x5494, 0xDFC7, 0x5495, 0xB9BE, 0x5496, 0xBFA7, - 0x5497, 0x85F8, 0x5498, 0x85F9, 0x5499, 0xC1FC, 0x549A, 0xDFCB, - 0x549B, 0xDFCC, 0x549C, 0x85FA, 0x549D, 0xDFD0, 0x549E, 0x85FB, - 0x549F, 0x85FC, 0x54A0, 0x85FD, 0x54A1, 0x85FE, 0x54A2, 0x8640, - 0x54A3, 0xDFDB, 0x54A4, 0xDFE5, 0x54A5, 0x8641, 0x54A6, 0xDFD7, - 0x54A7, 0xDFD6, 0x54A8, 0xD7C9, 0x54A9, 0xDFE3, 0x54AA, 0xDFE4, - 0x54AB, 0xE5EB, 0x54AC, 0xD2A7, 0x54AD, 0xDFD2, 0x54AE, 0x8642, - 0x54AF, 0xBFA9, 0x54B0, 0x8643, 0x54B1, 0xD4DB, 0x54B2, 0x8644, - 0x54B3, 0xBFC8, 0x54B4, 0xDFD4, 0x54B5, 0x8645, 0x54B6, 0x8646, - 0x54B7, 0x8647, 0x54B8, 0xCFCC, 0x54B9, 0x8648, 0x54BA, 0x8649, - 0x54BB, 0xDFDD, 0x54BC, 0x864A, 0x54BD, 0xD1CA, 0x54BE, 0x864B, - 0x54BF, 0xDFDE, 0x54C0, 0xB0A7, 0x54C1, 0xC6B7, 0x54C2, 0xDFD3, - 0x54C3, 0x864C, 0x54C4, 0xBAE5, 0x54C5, 0x864D, 0x54C6, 0xB6DF, - 0x54C7, 0xCDDB, 0x54C8, 0xB9FE, 0x54C9, 0xD4D5, 0x54CA, 0x864E, - 0x54CB, 0x864F, 0x54CC, 0xDFDF, 0x54CD, 0xCFEC, 0x54CE, 0xB0A5, - 0x54CF, 0xDFE7, 0x54D0, 0xDFD1, 0x54D1, 0xD1C6, 0x54D2, 0xDFD5, - 0x54D3, 0xDFD8, 0x54D4, 0xDFD9, 0x54D5, 0xDFDC, 0x54D6, 0x8650, - 0x54D7, 0xBBA9, 0x54D8, 0x8651, 0x54D9, 0xDFE0, 0x54DA, 0xDFE1, - 0x54DB, 0x8652, 0x54DC, 0xDFE2, 0x54DD, 0xDFE6, 0x54DE, 0xDFE8, - 0x54DF, 0xD3B4, 0x54E0, 0x8653, 0x54E1, 0x8654, 0x54E2, 0x8655, - 0x54E3, 0x8656, 0x54E4, 0x8657, 0x54E5, 0xB8E7, 0x54E6, 0xC5B6, - 0x54E7, 0xDFEA, 0x54E8, 0xC9DA, 0x54E9, 0xC1A8, 0x54EA, 0xC4C4, - 0x54EB, 0x8658, 0x54EC, 0x8659, 0x54ED, 0xBFDE, 0x54EE, 0xCFF8, - 0x54EF, 0x865A, 0x54F0, 0x865B, 0x54F1, 0x865C, 0x54F2, 0xD5DC, - 0x54F3, 0xDFEE, 0x54F4, 0x865D, 0x54F5, 0x865E, 0x54F6, 0x865F, - 0x54F7, 0x8660, 0x54F8, 0x8661, 0x54F9, 0x8662, 0x54FA, 0xB2B8, - 0x54FB, 0x8663, 0x54FC, 0xBADF, 0x54FD, 0xDFEC, 0x54FE, 0x8664, - 0x54FF, 0xDBC1, 0x5500, 0x8665, 0x5501, 0xD1E4, 0x5502, 0x8666, - 0x5503, 0x8667, 0x5504, 0x8668, 0x5505, 0x8669, 0x5506, 0xCBF4, - 0x5507, 0xB4BD, 0x5508, 0x866A, 0x5509, 0xB0A6, 0x550A, 0x866B, - 0x550B, 0x866C, 0x550C, 0x866D, 0x550D, 0x866E, 0x550E, 0x866F, - 0x550F, 0xDFF1, 0x5510, 0xCCC6, 0x5511, 0xDFF2, 0x5512, 0x8670, - 0x5513, 0x8671, 0x5514, 0xDFED, 0x5515, 0x8672, 0x5516, 0x8673, - 0x5517, 0x8674, 0x5518, 0x8675, 0x5519, 0x8676, 0x551A, 0x8677, - 0x551B, 0xDFE9, 0x551C, 0x8678, 0x551D, 0x8679, 0x551E, 0x867A, - 0x551F, 0x867B, 0x5520, 0xDFEB, 0x5521, 0x867C, 0x5522, 0xDFEF, - 0x5523, 0xDFF0, 0x5524, 0xBBBD, 0x5525, 0x867D, 0x5526, 0x867E, - 0x5527, 0xDFF3, 0x5528, 0x8680, 0x5529, 0x8681, 0x552A, 0xDFF4, - 0x552B, 0x8682, 0x552C, 0xBBA3, 0x552D, 0x8683, 0x552E, 0xCADB, - 0x552F, 0xCEA8, 0x5530, 0xE0A7, 0x5531, 0xB3AA, 0x5532, 0x8684, - 0x5533, 0xE0A6, 0x5534, 0x8685, 0x5535, 0x8686, 0x5536, 0x8687, - 0x5537, 0xE0A1, 0x5538, 0x8688, 0x5539, 0x8689, 0x553A, 0x868A, - 0x553B, 0x868B, 0x553C, 0xDFFE, 0x553D, 0x868C, 0x553E, 0xCDD9, - 0x553F, 0xDFFC, 0x5540, 0x868D, 0x5541, 0xDFFA, 0x5542, 0x868E, - 0x5543, 0xBFD0, 0x5544, 0xD7C4, 0x5545, 0x868F, 0x5546, 0xC9CC, - 0x5547, 0x8690, 0x5548, 0x8691, 0x5549, 0xDFF8, 0x554A, 0xB0A1, - 0x554B, 0x8692, 0x554C, 0x8693, 0x554D, 0x8694, 0x554E, 0x8695, - 0x554F, 0x8696, 0x5550, 0xDFFD, 0x5551, 0x8697, 0x5552, 0x8698, - 0x5553, 0x8699, 0x5554, 0x869A, 0x5555, 0xDFFB, 0x5556, 0xE0A2, - 0x5557, 0x869B, 0x5558, 0x869C, 0x5559, 0x869D, 0x555A, 0x869E, - 0x555B, 0x869F, 0x555C, 0xE0A8, 0x555D, 0x86A0, 0x555E, 0x86A1, - 0x555F, 0x86A2, 0x5560, 0x86A3, 0x5561, 0xB7C8, 0x5562, 0x86A4, - 0x5563, 0x86A5, 0x5564, 0xC6A1, 0x5565, 0xC9B6, 0x5566, 0xC0B2, - 0x5567, 0xDFF5, 0x5568, 0x86A6, 0x5569, 0x86A7, 0x556A, 0xC5BE, - 0x556B, 0x86A8, 0x556C, 0xD8C4, 0x556D, 0xDFF9, 0x556E, 0xC4F6, - 0x556F, 0x86A9, 0x5570, 0x86AA, 0x5571, 0x86AB, 0x5572, 0x86AC, - 0x5573, 0x86AD, 0x5574, 0x86AE, 0x5575, 0xE0A3, 0x5576, 0xE0A4, - 0x5577, 0xE0A5, 0x5578, 0xD0A5, 0x5579, 0x86AF, 0x557A, 0x86B0, - 0x557B, 0xE0B4, 0x557C, 0xCCE4, 0x557D, 0x86B1, 0x557E, 0xE0B1, - 0x557F, 0x86B2, 0x5580, 0xBFA6, 0x5581, 0xE0AF, 0x5582, 0xCEB9, - 0x5583, 0xE0AB, 0x5584, 0xC9C6, 0x5585, 0x86B3, 0x5586, 0x86B4, - 0x5587, 0xC0AE, 0x5588, 0xE0AE, 0x5589, 0xBAED, 0x558A, 0xBAB0, - 0x558B, 0xE0A9, 0x558C, 0x86B5, 0x558D, 0x86B6, 0x558E, 0x86B7, - 0x558F, 0xDFF6, 0x5590, 0x86B8, 0x5591, 0xE0B3, 0x5592, 0x86B9, - 0x5593, 0x86BA, 0x5594, 0xE0B8, 0x5595, 0x86BB, 0x5596, 0x86BC, - 0x5597, 0x86BD, 0x5598, 0xB4AD, 0x5599, 0xE0B9, 0x559A, 0x86BE, - 0x559B, 0x86BF, 0x559C, 0xCFB2, 0x559D, 0xBAC8, 0x559E, 0x86C0, - 0x559F, 0xE0B0, 0x55A0, 0x86C1, 0x55A1, 0x86C2, 0x55A2, 0x86C3, - 0x55A3, 0x86C4, 0x55A4, 0x86C5, 0x55A5, 0x86C6, 0x55A6, 0x86C7, - 0x55A7, 0xD0FA, 0x55A8, 0x86C8, 0x55A9, 0x86C9, 0x55AA, 0x86CA, - 0x55AB, 0x86CB, 0x55AC, 0x86CC, 0x55AD, 0x86CD, 0x55AE, 0x86CE, - 0x55AF, 0x86CF, 0x55B0, 0x86D0, 0x55B1, 0xE0AC, 0x55B2, 0x86D1, - 0x55B3, 0xD4FB, 0x55B4, 0x86D2, 0x55B5, 0xDFF7, 0x55B6, 0x86D3, - 0x55B7, 0xC5E7, 0x55B8, 0x86D4, 0x55B9, 0xE0AD, 0x55BA, 0x86D5, - 0x55BB, 0xD3F7, 0x55BC, 0x86D6, 0x55BD, 0xE0B6, 0x55BE, 0xE0B7, - 0x55BF, 0x86D7, 0x55C0, 0x86D8, 0x55C1, 0x86D9, 0x55C2, 0x86DA, - 0x55C3, 0x86DB, 0x55C4, 0xE0C4, 0x55C5, 0xD0E1, 0x55C6, 0x86DC, - 0x55C7, 0x86DD, 0x55C8, 0x86DE, 0x55C9, 0xE0BC, 0x55CA, 0x86DF, - 0x55CB, 0x86E0, 0x55CC, 0xE0C9, 0x55CD, 0xE0CA, 0x55CE, 0x86E1, - 0x55CF, 0x86E2, 0x55D0, 0x86E3, 0x55D1, 0xE0BE, 0x55D2, 0xE0AA, - 0x55D3, 0xC9A4, 0x55D4, 0xE0C1, 0x55D5, 0x86E4, 0x55D6, 0xE0B2, - 0x55D7, 0x86E5, 0x55D8, 0x86E6, 0x55D9, 0x86E7, 0x55DA, 0x86E8, - 0x55DB, 0x86E9, 0x55DC, 0xCAC8, 0x55DD, 0xE0C3, 0x55DE, 0x86EA, - 0x55DF, 0xE0B5, 0x55E0, 0x86EB, 0x55E1, 0xCECB, 0x55E2, 0x86EC, - 0x55E3, 0xCBC3, 0x55E4, 0xE0CD, 0x55E5, 0xE0C6, 0x55E6, 0xE0C2, - 0x55E7, 0x86ED, 0x55E8, 0xE0CB, 0x55E9, 0x86EE, 0x55EA, 0xE0BA, - 0x55EB, 0xE0BF, 0x55EC, 0xE0C0, 0x55ED, 0x86EF, 0x55EE, 0x86F0, - 0x55EF, 0xE0C5, 0x55F0, 0x86F1, 0x55F1, 0x86F2, 0x55F2, 0xE0C7, - 0x55F3, 0xE0C8, 0x55F4, 0x86F3, 0x55F5, 0xE0CC, 0x55F6, 0x86F4, - 0x55F7, 0xE0BB, 0x55F8, 0x86F5, 0x55F9, 0x86F6, 0x55FA, 0x86F7, - 0x55FB, 0x86F8, 0x55FC, 0x86F9, 0x55FD, 0xCBD4, 0x55FE, 0xE0D5, - 0x55FF, 0x86FA, 0x5600, 0xE0D6, 0x5601, 0xE0D2, 0x5602, 0x86FB, - 0x5603, 0x86FC, 0x5604, 0x86FD, 0x5605, 0x86FE, 0x5606, 0x8740, - 0x5607, 0x8741, 0x5608, 0xE0D0, 0x5609, 0xBCCE, 0x560A, 0x8742, - 0x560B, 0x8743, 0x560C, 0xE0D1, 0x560D, 0x8744, 0x560E, 0xB8C2, - 0x560F, 0xD8C5, 0x5610, 0x8745, 0x5611, 0x8746, 0x5612, 0x8747, - 0x5613, 0x8748, 0x5614, 0x8749, 0x5615, 0x874A, 0x5616, 0x874B, - 0x5617, 0x874C, 0x5618, 0xD0EA, 0x5619, 0x874D, 0x561A, 0x874E, - 0x561B, 0xC2EF, 0x561C, 0x874F, 0x561D, 0x8750, 0x561E, 0xE0CF, - 0x561F, 0xE0BD, 0x5620, 0x8751, 0x5621, 0x8752, 0x5622, 0x8753, - 0x5623, 0xE0D4, 0x5624, 0xE0D3, 0x5625, 0x8754, 0x5626, 0x8755, - 0x5627, 0xE0D7, 0x5628, 0x8756, 0x5629, 0x8757, 0x562A, 0x8758, - 0x562B, 0x8759, 0x562C, 0xE0DC, 0x562D, 0xE0D8, 0x562E, 0x875A, - 0x562F, 0x875B, 0x5630, 0x875C, 0x5631, 0xD6F6, 0x5632, 0xB3B0, - 0x5633, 0x875D, 0x5634, 0xD7EC, 0x5635, 0x875E, 0x5636, 0xCBBB, - 0x5637, 0x875F, 0x5638, 0x8760, 0x5639, 0xE0DA, 0x563A, 0x8761, - 0x563B, 0xCEFB, 0x563C, 0x8762, 0x563D, 0x8763, 0x563E, 0x8764, - 0x563F, 0xBAD9, 0x5640, 0x8765, 0x5641, 0x8766, 0x5642, 0x8767, - 0x5643, 0x8768, 0x5644, 0x8769, 0x5645, 0x876A, 0x5646, 0x876B, - 0x5647, 0x876C, 0x5648, 0x876D, 0x5649, 0x876E, 0x564A, 0x876F, - 0x564B, 0x8770, 0x564C, 0xE0E1, 0x564D, 0xE0DD, 0x564E, 0xD2AD, - 0x564F, 0x8771, 0x5650, 0x8772, 0x5651, 0x8773, 0x5652, 0x8774, - 0x5653, 0x8775, 0x5654, 0xE0E2, 0x5655, 0x8776, 0x5656, 0x8777, - 0x5657, 0xE0DB, 0x5658, 0xE0D9, 0x5659, 0xE0DF, 0x565A, 0x8778, - 0x565B, 0x8779, 0x565C, 0xE0E0, 0x565D, 0x877A, 0x565E, 0x877B, - 0x565F, 0x877C, 0x5660, 0x877D, 0x5661, 0x877E, 0x5662, 0xE0DE, - 0x5663, 0x8780, 0x5664, 0xE0E4, 0x5665, 0x8781, 0x5666, 0x8782, - 0x5667, 0x8783, 0x5668, 0xC6F7, 0x5669, 0xD8AC, 0x566A, 0xD4EB, - 0x566B, 0xE0E6, 0x566C, 0xCAC9, 0x566D, 0x8784, 0x566E, 0x8785, - 0x566F, 0x8786, 0x5670, 0x8787, 0x5671, 0xE0E5, 0x5672, 0x8788, - 0x5673, 0x8789, 0x5674, 0x878A, 0x5675, 0x878B, 0x5676, 0xB8C1, - 0x5677, 0x878C, 0x5678, 0x878D, 0x5679, 0x878E, 0x567A, 0x878F, - 0x567B, 0xE0E7, 0x567C, 0xE0E8, 0x567D, 0x8790, 0x567E, 0x8791, - 0x567F, 0x8792, 0x5680, 0x8793, 0x5681, 0x8794, 0x5682, 0x8795, - 0x5683, 0x8796, 0x5684, 0x8797, 0x5685, 0xE0E9, 0x5686, 0xE0E3, - 0x5687, 0x8798, 0x5688, 0x8799, 0x5689, 0x879A, 0x568A, 0x879B, - 0x568B, 0x879C, 0x568C, 0x879D, 0x568D, 0x879E, 0x568E, 0xBABF, - 0x568F, 0xCCE7, 0x5690, 0x879F, 0x5691, 0x87A0, 0x5692, 0x87A1, - 0x5693, 0xE0EA, 0x5694, 0x87A2, 0x5695, 0x87A3, 0x5696, 0x87A4, - 0x5697, 0x87A5, 0x5698, 0x87A6, 0x5699, 0x87A7, 0x569A, 0x87A8, - 0x569B, 0x87A9, 0x569C, 0x87AA, 0x569D, 0x87AB, 0x569E, 0x87AC, - 0x569F, 0x87AD, 0x56A0, 0x87AE, 0x56A1, 0x87AF, 0x56A2, 0x87B0, - 0x56A3, 0xCFF9, 0x56A4, 0x87B1, 0x56A5, 0x87B2, 0x56A6, 0x87B3, - 0x56A7, 0x87B4, 0x56A8, 0x87B5, 0x56A9, 0x87B6, 0x56AA, 0x87B7, - 0x56AB, 0x87B8, 0x56AC, 0x87B9, 0x56AD, 0x87BA, 0x56AE, 0x87BB, - 0x56AF, 0xE0EB, 0x56B0, 0x87BC, 0x56B1, 0x87BD, 0x56B2, 0x87BE, - 0x56B3, 0x87BF, 0x56B4, 0x87C0, 0x56B5, 0x87C1, 0x56B6, 0x87C2, - 0x56B7, 0xC8C2, 0x56B8, 0x87C3, 0x56B9, 0x87C4, 0x56BA, 0x87C5, - 0x56BB, 0x87C6, 0x56BC, 0xBDC0, 0x56BD, 0x87C7, 0x56BE, 0x87C8, - 0x56BF, 0x87C9, 0x56C0, 0x87CA, 0x56C1, 0x87CB, 0x56C2, 0x87CC, - 0x56C3, 0x87CD, 0x56C4, 0x87CE, 0x56C5, 0x87CF, 0x56C6, 0x87D0, - 0x56C7, 0x87D1, 0x56C8, 0x87D2, 0x56C9, 0x87D3, 0x56CA, 0xC4D2, - 0x56CB, 0x87D4, 0x56CC, 0x87D5, 0x56CD, 0x87D6, 0x56CE, 0x87D7, - 0x56CF, 0x87D8, 0x56D0, 0x87D9, 0x56D1, 0x87DA, 0x56D2, 0x87DB, - 0x56D3, 0x87DC, 0x56D4, 0xE0EC, 0x56D5, 0x87DD, 0x56D6, 0x87DE, - 0x56D7, 0xE0ED, 0x56D8, 0x87DF, 0x56D9, 0x87E0, 0x56DA, 0xC7F4, - 0x56DB, 0xCBC4, 0x56DC, 0x87E1, 0x56DD, 0xE0EE, 0x56DE, 0xBBD8, - 0x56DF, 0xD8B6, 0x56E0, 0xD2F2, 0x56E1, 0xE0EF, 0x56E2, 0xCDC5, - 0x56E3, 0x87E2, 0x56E4, 0xB6DA, 0x56E5, 0x87E3, 0x56E6, 0x87E4, - 0x56E7, 0x87E5, 0x56E8, 0x87E6, 0x56E9, 0x87E7, 0x56EA, 0x87E8, - 0x56EB, 0xE0F1, 0x56EC, 0x87E9, 0x56ED, 0xD4B0, 0x56EE, 0x87EA, - 0x56EF, 0x87EB, 0x56F0, 0xC0A7, 0x56F1, 0xB4D1, 0x56F2, 0x87EC, - 0x56F3, 0x87ED, 0x56F4, 0xCEA7, 0x56F5, 0xE0F0, 0x56F6, 0x87EE, - 0x56F7, 0x87EF, 0x56F8, 0x87F0, 0x56F9, 0xE0F2, 0x56FA, 0xB9CC, - 0x56FB, 0x87F1, 0x56FC, 0x87F2, 0x56FD, 0xB9FA, 0x56FE, 0xCDBC, - 0x56FF, 0xE0F3, 0x5700, 0x87F3, 0x5701, 0x87F4, 0x5702, 0x87F5, - 0x5703, 0xC6D4, 0x5704, 0xE0F4, 0x5705, 0x87F6, 0x5706, 0xD4B2, - 0x5707, 0x87F7, 0x5708, 0xC8A6, 0x5709, 0xE0F6, 0x570A, 0xE0F5, - 0x570B, 0x87F8, 0x570C, 0x87F9, 0x570D, 0x87FA, 0x570E, 0x87FB, - 0x570F, 0x87FC, 0x5710, 0x87FD, 0x5711, 0x87FE, 0x5712, 0x8840, - 0x5713, 0x8841, 0x5714, 0x8842, 0x5715, 0x8843, 0x5716, 0x8844, - 0x5717, 0x8845, 0x5718, 0x8846, 0x5719, 0x8847, 0x571A, 0x8848, - 0x571B, 0x8849, 0x571C, 0xE0F7, 0x571D, 0x884A, 0x571E, 0x884B, - 0x571F, 0xCDC1, 0x5720, 0x884C, 0x5721, 0x884D, 0x5722, 0x884E, - 0x5723, 0xCAA5, 0x5724, 0x884F, 0x5725, 0x8850, 0x5726, 0x8851, - 0x5727, 0x8852, 0x5728, 0xD4DA, 0x5729, 0xDBD7, 0x572A, 0xDBD9, - 0x572B, 0x8853, 0x572C, 0xDBD8, 0x572D, 0xB9E7, 0x572E, 0xDBDC, - 0x572F, 0xDBDD, 0x5730, 0xB5D8, 0x5731, 0x8854, 0x5732, 0x8855, - 0x5733, 0xDBDA, 0x5734, 0x8856, 0x5735, 0x8857, 0x5736, 0x8858, - 0x5737, 0x8859, 0x5738, 0x885A, 0x5739, 0xDBDB, 0x573A, 0xB3A1, - 0x573B, 0xDBDF, 0x573C, 0x885B, 0x573D, 0x885C, 0x573E, 0xBBF8, - 0x573F, 0x885D, 0x5740, 0xD6B7, 0x5741, 0x885E, 0x5742, 0xDBE0, - 0x5743, 0x885F, 0x5744, 0x8860, 0x5745, 0x8861, 0x5746, 0x8862, - 0x5747, 0xBEF9, 0x5748, 0x8863, 0x5749, 0x8864, 0x574A, 0xB7BB, - 0x574B, 0x8865, 0x574C, 0xDBD0, 0x574D, 0xCCAE, 0x574E, 0xBFB2, - 0x574F, 0xBBB5, 0x5750, 0xD7F8, 0x5751, 0xBFD3, 0x5752, 0x8866, - 0x5753, 0x8867, 0x5754, 0x8868, 0x5755, 0x8869, 0x5756, 0x886A, - 0x5757, 0xBFE9, 0x5758, 0x886B, 0x5759, 0x886C, 0x575A, 0xBCE1, - 0x575B, 0xCCB3, 0x575C, 0xDBDE, 0x575D, 0xB0D3, 0x575E, 0xCEEB, - 0x575F, 0xB7D8, 0x5760, 0xD7B9, 0x5761, 0xC6C2, 0x5762, 0x886D, - 0x5763, 0x886E, 0x5764, 0xC0A4, 0x5765, 0x886F, 0x5766, 0xCCB9, - 0x5767, 0x8870, 0x5768, 0xDBE7, 0x5769, 0xDBE1, 0x576A, 0xC6BA, - 0x576B, 0xDBE3, 0x576C, 0x8871, 0x576D, 0xDBE8, 0x576E, 0x8872, - 0x576F, 0xC5F7, 0x5770, 0x8873, 0x5771, 0x8874, 0x5772, 0x8875, - 0x5773, 0xDBEA, 0x5774, 0x8876, 0x5775, 0x8877, 0x5776, 0xDBE9, - 0x5777, 0xBFC0, 0x5778, 0x8878, 0x5779, 0x8879, 0x577A, 0x887A, - 0x577B, 0xDBE6, 0x577C, 0xDBE5, 0x577D, 0x887B, 0x577E, 0x887C, - 0x577F, 0x887D, 0x5780, 0x887E, 0x5781, 0x8880, 0x5782, 0xB4B9, - 0x5783, 0xC0AC, 0x5784, 0xC2A2, 0x5785, 0xDBE2, 0x5786, 0xDBE4, - 0x5787, 0x8881, 0x5788, 0x8882, 0x5789, 0x8883, 0x578A, 0x8884, - 0x578B, 0xD0CD, 0x578C, 0xDBED, 0x578D, 0x8885, 0x578E, 0x8886, - 0x578F, 0x8887, 0x5790, 0x8888, 0x5791, 0x8889, 0x5792, 0xC0DD, - 0x5793, 0xDBF2, 0x5794, 0x888A, 0x5795, 0x888B, 0x5796, 0x888C, - 0x5797, 0x888D, 0x5798, 0x888E, 0x5799, 0x888F, 0x579A, 0x8890, - 0x579B, 0xB6E2, 0x579C, 0x8891, 0x579D, 0x8892, 0x579E, 0x8893, - 0x579F, 0x8894, 0x57A0, 0xDBF3, 0x57A1, 0xDBD2, 0x57A2, 0xB9B8, - 0x57A3, 0xD4AB, 0x57A4, 0xDBEC, 0x57A5, 0x8895, 0x57A6, 0xBFD1, - 0x57A7, 0xDBF0, 0x57A8, 0x8896, 0x57A9, 0xDBD1, 0x57AA, 0x8897, - 0x57AB, 0xB5E6, 0x57AC, 0x8898, 0x57AD, 0xDBEB, 0x57AE, 0xBFE5, - 0x57AF, 0x8899, 0x57B0, 0x889A, 0x57B1, 0x889B, 0x57B2, 0xDBEE, - 0x57B3, 0x889C, 0x57B4, 0xDBF1, 0x57B5, 0x889D, 0x57B6, 0x889E, - 0x57B7, 0x889F, 0x57B8, 0xDBF9, 0x57B9, 0x88A0, 0x57BA, 0x88A1, - 0x57BB, 0x88A2, 0x57BC, 0x88A3, 0x57BD, 0x88A4, 0x57BE, 0x88A5, - 0x57BF, 0x88A6, 0x57C0, 0x88A7, 0x57C1, 0x88A8, 0x57C2, 0xB9A1, - 0x57C3, 0xB0A3, 0x57C4, 0x88A9, 0x57C5, 0x88AA, 0x57C6, 0x88AB, - 0x57C7, 0x88AC, 0x57C8, 0x88AD, 0x57C9, 0x88AE, 0x57CA, 0x88AF, - 0x57CB, 0xC2F1, 0x57CC, 0x88B0, 0x57CD, 0x88B1, 0x57CE, 0xB3C7, - 0x57CF, 0xDBEF, 0x57D0, 0x88B2, 0x57D1, 0x88B3, 0x57D2, 0xDBF8, - 0x57D3, 0x88B4, 0x57D4, 0xC6D2, 0x57D5, 0xDBF4, 0x57D6, 0x88B5, - 0x57D7, 0x88B6, 0x57D8, 0xDBF5, 0x57D9, 0xDBF7, 0x57DA, 0xDBF6, - 0x57DB, 0x88B7, 0x57DC, 0x88B8, 0x57DD, 0xDBFE, 0x57DE, 0x88B9, - 0x57DF, 0xD3F2, 0x57E0, 0xB2BA, 0x57E1, 0x88BA, 0x57E2, 0x88BB, - 0x57E3, 0x88BC, 0x57E4, 0xDBFD, 0x57E5, 0x88BD, 0x57E6, 0x88BE, - 0x57E7, 0x88BF, 0x57E8, 0x88C0, 0x57E9, 0x88C1, 0x57EA, 0x88C2, - 0x57EB, 0x88C3, 0x57EC, 0x88C4, 0x57ED, 0xDCA4, 0x57EE, 0x88C5, - 0x57EF, 0xDBFB, 0x57F0, 0x88C6, 0x57F1, 0x88C7, 0x57F2, 0x88C8, - 0x57F3, 0x88C9, 0x57F4, 0xDBFA, 0x57F5, 0x88CA, 0x57F6, 0x88CB, - 0x57F7, 0x88CC, 0x57F8, 0xDBFC, 0x57F9, 0xC5E0, 0x57FA, 0xBBF9, - 0x57FB, 0x88CD, 0x57FC, 0x88CE, 0x57FD, 0xDCA3, 0x57FE, 0x88CF, - 0x57FF, 0x88D0, 0x5800, 0xDCA5, 0x5801, 0x88D1, 0x5802, 0xCCC3, - 0x5803, 0x88D2, 0x5804, 0x88D3, 0x5805, 0x88D4, 0x5806, 0xB6D1, - 0x5807, 0xDDC0, 0x5808, 0x88D5, 0x5809, 0x88D6, 0x580A, 0x88D7, - 0x580B, 0xDCA1, 0x580C, 0x88D8, 0x580D, 0xDCA2, 0x580E, 0x88D9, - 0x580F, 0x88DA, 0x5810, 0x88DB, 0x5811, 0xC7B5, 0x5812, 0x88DC, - 0x5813, 0x88DD, 0x5814, 0x88DE, 0x5815, 0xB6E9, 0x5816, 0x88DF, - 0x5817, 0x88E0, 0x5818, 0x88E1, 0x5819, 0xDCA7, 0x581A, 0x88E2, - 0x581B, 0x88E3, 0x581C, 0x88E4, 0x581D, 0x88E5, 0x581E, 0xDCA6, - 0x581F, 0x88E6, 0x5820, 0xDCA9, 0x5821, 0xB1A4, 0x5822, 0x88E7, - 0x5823, 0x88E8, 0x5824, 0xB5CC, 0x5825, 0x88E9, 0x5826, 0x88EA, - 0x5827, 0x88EB, 0x5828, 0x88EC, 0x5829, 0x88ED, 0x582A, 0xBFB0, - 0x582B, 0x88EE, 0x582C, 0x88EF, 0x582D, 0x88F0, 0x582E, 0x88F1, - 0x582F, 0x88F2, 0x5830, 0xD1DF, 0x5831, 0x88F3, 0x5832, 0x88F4, - 0x5833, 0x88F5, 0x5834, 0x88F6, 0x5835, 0xB6C2, 0x5836, 0x88F7, - 0x5837, 0x88F8, 0x5838, 0x88F9, 0x5839, 0x88FA, 0x583A, 0x88FB, - 0x583B, 0x88FC, 0x583C, 0x88FD, 0x583D, 0x88FE, 0x583E, 0x8940, - 0x583F, 0x8941, 0x5840, 0x8942, 0x5841, 0x8943, 0x5842, 0x8944, - 0x5843, 0x8945, 0x5844, 0xDCA8, 0x5845, 0x8946, 0x5846, 0x8947, - 0x5847, 0x8948, 0x5848, 0x8949, 0x5849, 0x894A, 0x584A, 0x894B, - 0x584B, 0x894C, 0x584C, 0xCBFA, 0x584D, 0xEBF3, 0x584E, 0x894D, - 0x584F, 0x894E, 0x5850, 0x894F, 0x5851, 0xCBDC, 0x5852, 0x8950, - 0x5853, 0x8951, 0x5854, 0xCBFE, 0x5855, 0x8952, 0x5856, 0x8953, - 0x5857, 0x8954, 0x5858, 0xCCC1, 0x5859, 0x8955, 0x585A, 0x8956, - 0x585B, 0x8957, 0x585C, 0x8958, 0x585D, 0x8959, 0x585E, 0xC8FB, - 0x585F, 0x895A, 0x5860, 0x895B, 0x5861, 0x895C, 0x5862, 0x895D, - 0x5863, 0x895E, 0x5864, 0x895F, 0x5865, 0xDCAA, 0x5866, 0x8960, - 0x5867, 0x8961, 0x5868, 0x8962, 0x5869, 0x8963, 0x586A, 0x8964, - 0x586B, 0xCCEE, 0x586C, 0xDCAB, 0x586D, 0x8965, 0x586E, 0x8966, - 0x586F, 0x8967, 0x5870, 0x8968, 0x5871, 0x8969, 0x5872, 0x896A, - 0x5873, 0x896B, 0x5874, 0x896C, 0x5875, 0x896D, 0x5876, 0x896E, - 0x5877, 0x896F, 0x5878, 0x8970, 0x5879, 0x8971, 0x587A, 0x8972, - 0x587B, 0x8973, 0x587C, 0x8974, 0x587D, 0x8975, 0x587E, 0xDBD3, - 0x587F, 0x8976, 0x5880, 0xDCAF, 0x5881, 0xDCAC, 0x5882, 0x8977, - 0x5883, 0xBEB3, 0x5884, 0x8978, 0x5885, 0xCAFB, 0x5886, 0x8979, - 0x5887, 0x897A, 0x5888, 0x897B, 0x5889, 0xDCAD, 0x588A, 0x897C, - 0x588B, 0x897D, 0x588C, 0x897E, 0x588D, 0x8980, 0x588E, 0x8981, - 0x588F, 0x8982, 0x5890, 0x8983, 0x5891, 0x8984, 0x5892, 0xC9CA, - 0x5893, 0xC4B9, 0x5894, 0x8985, 0x5895, 0x8986, 0x5896, 0x8987, - 0x5897, 0x8988, 0x5898, 0x8989, 0x5899, 0xC7BD, 0x589A, 0xDCAE, - 0x589B, 0x898A, 0x589C, 0x898B, 0x589D, 0x898C, 0x589E, 0xD4F6, - 0x589F, 0xD0E6, 0x58A0, 0x898D, 0x58A1, 0x898E, 0x58A2, 0x898F, - 0x58A3, 0x8990, 0x58A4, 0x8991, 0x58A5, 0x8992, 0x58A6, 0x8993, - 0x58A7, 0x8994, 0x58A8, 0xC4AB, 0x58A9, 0xB6D5, 0x58AA, 0x8995, - 0x58AB, 0x8996, 0x58AC, 0x8997, 0x58AD, 0x8998, 0x58AE, 0x8999, - 0x58AF, 0x899A, 0x58B0, 0x899B, 0x58B1, 0x899C, 0x58B2, 0x899D, - 0x58B3, 0x899E, 0x58B4, 0x899F, 0x58B5, 0x89A0, 0x58B6, 0x89A1, - 0x58B7, 0x89A2, 0x58B8, 0x89A3, 0x58B9, 0x89A4, 0x58BA, 0x89A5, - 0x58BB, 0x89A6, 0x58BC, 0xDBD4, 0x58BD, 0x89A7, 0x58BE, 0x89A8, - 0x58BF, 0x89A9, 0x58C0, 0x89AA, 0x58C1, 0xB1DA, 0x58C2, 0x89AB, - 0x58C3, 0x89AC, 0x58C4, 0x89AD, 0x58C5, 0xDBD5, 0x58C6, 0x89AE, - 0x58C7, 0x89AF, 0x58C8, 0x89B0, 0x58C9, 0x89B1, 0x58CA, 0x89B2, - 0x58CB, 0x89B3, 0x58CC, 0x89B4, 0x58CD, 0x89B5, 0x58CE, 0x89B6, - 0x58CF, 0x89B7, 0x58D0, 0x89B8, 0x58D1, 0xDBD6, 0x58D2, 0x89B9, - 0x58D3, 0x89BA, 0x58D4, 0x89BB, 0x58D5, 0xBABE, 0x58D6, 0x89BC, - 0x58D7, 0x89BD, 0x58D8, 0x89BE, 0x58D9, 0x89BF, 0x58DA, 0x89C0, - 0x58DB, 0x89C1, 0x58DC, 0x89C2, 0x58DD, 0x89C3, 0x58DE, 0x89C4, - 0x58DF, 0x89C5, 0x58E0, 0x89C6, 0x58E1, 0x89C7, 0x58E2, 0x89C8, - 0x58E3, 0x89C9, 0x58E4, 0xC8C0, 0x58E5, 0x89CA, 0x58E6, 0x89CB, - 0x58E7, 0x89CC, 0x58E8, 0x89CD, 0x58E9, 0x89CE, 0x58EA, 0x89CF, - 0x58EB, 0xCABF, 0x58EC, 0xC8C9, 0x58ED, 0x89D0, 0x58EE, 0xD7B3, - 0x58EF, 0x89D1, 0x58F0, 0xC9F9, 0x58F1, 0x89D2, 0x58F2, 0x89D3, - 0x58F3, 0xBFC7, 0x58F4, 0x89D4, 0x58F5, 0x89D5, 0x58F6, 0xBAF8, - 0x58F7, 0x89D6, 0x58F8, 0x89D7, 0x58F9, 0xD2BC, 0x58FA, 0x89D8, - 0x58FB, 0x89D9, 0x58FC, 0x89DA, 0x58FD, 0x89DB, 0x58FE, 0x89DC, - 0x58FF, 0x89DD, 0x5900, 0x89DE, 0x5901, 0x89DF, 0x5902, 0xE2BA, - 0x5903, 0x89E0, 0x5904, 0xB4A6, 0x5905, 0x89E1, 0x5906, 0x89E2, - 0x5907, 0xB1B8, 0x5908, 0x89E3, 0x5909, 0x89E4, 0x590A, 0x89E5, - 0x590B, 0x89E6, 0x590C, 0x89E7, 0x590D, 0xB8B4, 0x590E, 0x89E8, - 0x590F, 0xCFC4, 0x5910, 0x89E9, 0x5911, 0x89EA, 0x5912, 0x89EB, - 0x5913, 0x89EC, 0x5914, 0xD9E7, 0x5915, 0xCFA6, 0x5916, 0xCDE2, - 0x5917, 0x89ED, 0x5918, 0x89EE, 0x5919, 0xD9ED, 0x591A, 0xB6E0, - 0x591B, 0x89EF, 0x591C, 0xD2B9, 0x591D, 0x89F0, 0x591E, 0x89F1, - 0x591F, 0xB9BB, 0x5920, 0x89F2, 0x5921, 0x89F3, 0x5922, 0x89F4, - 0x5923, 0x89F5, 0x5924, 0xE2B9, 0x5925, 0xE2B7, 0x5926, 0x89F6, - 0x5927, 0xB4F3, 0x5928, 0x89F7, 0x5929, 0xCCEC, 0x592A, 0xCCAB, - 0x592B, 0xB7F2, 0x592C, 0x89F8, 0x592D, 0xD8B2, 0x592E, 0xD1EB, - 0x592F, 0xBABB, 0x5930, 0x89F9, 0x5931, 0xCAA7, 0x5932, 0x89FA, - 0x5933, 0x89FB, 0x5934, 0xCDB7, 0x5935, 0x89FC, 0x5936, 0x89FD, - 0x5937, 0xD2C4, 0x5938, 0xBFE4, 0x5939, 0xBCD0, 0x593A, 0xB6E1, - 0x593B, 0x89FE, 0x593C, 0xDEC5, 0x593D, 0x8A40, 0x593E, 0x8A41, - 0x593F, 0x8A42, 0x5940, 0x8A43, 0x5941, 0xDEC6, 0x5942, 0xDBBC, - 0x5943, 0x8A44, 0x5944, 0xD1D9, 0x5945, 0x8A45, 0x5946, 0x8A46, - 0x5947, 0xC6E6, 0x5948, 0xC4CE, 0x5949, 0xB7EE, 0x594A, 0x8A47, - 0x594B, 0xB7DC, 0x594C, 0x8A48, 0x594D, 0x8A49, 0x594E, 0xBFFC, - 0x594F, 0xD7E0, 0x5950, 0x8A4A, 0x5951, 0xC6F5, 0x5952, 0x8A4B, - 0x5953, 0x8A4C, 0x5954, 0xB1BC, 0x5955, 0xDEC8, 0x5956, 0xBDB1, - 0x5957, 0xCCD7, 0x5958, 0xDECA, 0x5959, 0x8A4D, 0x595A, 0xDEC9, - 0x595B, 0x8A4E, 0x595C, 0x8A4F, 0x595D, 0x8A50, 0x595E, 0x8A51, - 0x595F, 0x8A52, 0x5960, 0xB5EC, 0x5961, 0x8A53, 0x5962, 0xC9DD, - 0x5963, 0x8A54, 0x5964, 0x8A55, 0x5965, 0xB0C2, 0x5966, 0x8A56, - 0x5967, 0x8A57, 0x5968, 0x8A58, 0x5969, 0x8A59, 0x596A, 0x8A5A, - 0x596B, 0x8A5B, 0x596C, 0x8A5C, 0x596D, 0x8A5D, 0x596E, 0x8A5E, - 0x596F, 0x8A5F, 0x5970, 0x8A60, 0x5971, 0x8A61, 0x5972, 0x8A62, - 0x5973, 0xC5AE, 0x5974, 0xC5AB, 0x5975, 0x8A63, 0x5976, 0xC4CC, - 0x5977, 0x8A64, 0x5978, 0xBCE9, 0x5979, 0xCBFD, 0x597A, 0x8A65, - 0x597B, 0x8A66, 0x597C, 0x8A67, 0x597D, 0xBAC3, 0x597E, 0x8A68, - 0x597F, 0x8A69, 0x5980, 0x8A6A, 0x5981, 0xE5F9, 0x5982, 0xC8E7, - 0x5983, 0xE5FA, 0x5984, 0xCDFD, 0x5985, 0x8A6B, 0x5986, 0xD7B1, - 0x5987, 0xB8BE, 0x5988, 0xC2E8, 0x5989, 0x8A6C, 0x598A, 0xC8D1, - 0x598B, 0x8A6D, 0x598C, 0x8A6E, 0x598D, 0xE5FB, 0x598E, 0x8A6F, - 0x598F, 0x8A70, 0x5990, 0x8A71, 0x5991, 0x8A72, 0x5992, 0xB6CA, - 0x5993, 0xBCCB, 0x5994, 0x8A73, 0x5995, 0x8A74, 0x5996, 0xD1FD, - 0x5997, 0xE6A1, 0x5998, 0x8A75, 0x5999, 0xC3EE, 0x599A, 0x8A76, - 0x599B, 0x8A77, 0x599C, 0x8A78, 0x599D, 0x8A79, 0x599E, 0xE6A4, - 0x599F, 0x8A7A, 0x59A0, 0x8A7B, 0x59A1, 0x8A7C, 0x59A2, 0x8A7D, - 0x59A3, 0xE5FE, 0x59A4, 0xE6A5, 0x59A5, 0xCDD7, 0x59A6, 0x8A7E, - 0x59A7, 0x8A80, 0x59A8, 0xB7C1, 0x59A9, 0xE5FC, 0x59AA, 0xE5FD, - 0x59AB, 0xE6A3, 0x59AC, 0x8A81, 0x59AD, 0x8A82, 0x59AE, 0xC4DD, - 0x59AF, 0xE6A8, 0x59B0, 0x8A83, 0x59B1, 0x8A84, 0x59B2, 0xE6A7, - 0x59B3, 0x8A85, 0x59B4, 0x8A86, 0x59B5, 0x8A87, 0x59B6, 0x8A88, - 0x59B7, 0x8A89, 0x59B8, 0x8A8A, 0x59B9, 0xC3C3, 0x59BA, 0x8A8B, - 0x59BB, 0xC6DE, 0x59BC, 0x8A8C, 0x59BD, 0x8A8D, 0x59BE, 0xE6AA, - 0x59BF, 0x8A8E, 0x59C0, 0x8A8F, 0x59C1, 0x8A90, 0x59C2, 0x8A91, - 0x59C3, 0x8A92, 0x59C4, 0x8A93, 0x59C5, 0x8A94, 0x59C6, 0xC4B7, - 0x59C7, 0x8A95, 0x59C8, 0x8A96, 0x59C9, 0x8A97, 0x59CA, 0xE6A2, - 0x59CB, 0xCABC, 0x59CC, 0x8A98, 0x59CD, 0x8A99, 0x59CE, 0x8A9A, - 0x59CF, 0x8A9B, 0x59D0, 0xBDE3, 0x59D1, 0xB9C3, 0x59D2, 0xE6A6, - 0x59D3, 0xD0D5, 0x59D4, 0xCEAF, 0x59D5, 0x8A9C, 0x59D6, 0x8A9D, - 0x59D7, 0xE6A9, 0x59D8, 0xE6B0, 0x59D9, 0x8A9E, 0x59DA, 0xD2A6, - 0x59DB, 0x8A9F, 0x59DC, 0xBDAA, 0x59DD, 0xE6AD, 0x59DE, 0x8AA0, - 0x59DF, 0x8AA1, 0x59E0, 0x8AA2, 0x59E1, 0x8AA3, 0x59E2, 0x8AA4, - 0x59E3, 0xE6AF, 0x59E4, 0x8AA5, 0x59E5, 0xC0D1, 0x59E6, 0x8AA6, - 0x59E7, 0x8AA7, 0x59E8, 0xD2CC, 0x59E9, 0x8AA8, 0x59EA, 0x8AA9, - 0x59EB, 0x8AAA, 0x59EC, 0xBCA7, 0x59ED, 0x8AAB, 0x59EE, 0x8AAC, - 0x59EF, 0x8AAD, 0x59F0, 0x8AAE, 0x59F1, 0x8AAF, 0x59F2, 0x8AB0, - 0x59F3, 0x8AB1, 0x59F4, 0x8AB2, 0x59F5, 0x8AB3, 0x59F6, 0x8AB4, - 0x59F7, 0x8AB5, 0x59F8, 0x8AB6, 0x59F9, 0xE6B1, 0x59FA, 0x8AB7, - 0x59FB, 0xD2F6, 0x59FC, 0x8AB8, 0x59FD, 0x8AB9, 0x59FE, 0x8ABA, - 0x59FF, 0xD7CB, 0x5A00, 0x8ABB, 0x5A01, 0xCDFE, 0x5A02, 0x8ABC, - 0x5A03, 0xCDDE, 0x5A04, 0xC2A6, 0x5A05, 0xE6AB, 0x5A06, 0xE6AC, - 0x5A07, 0xBDBF, 0x5A08, 0xE6AE, 0x5A09, 0xE6B3, 0x5A0A, 0x8ABD, - 0x5A0B, 0x8ABE, 0x5A0C, 0xE6B2, 0x5A0D, 0x8ABF, 0x5A0E, 0x8AC0, - 0x5A0F, 0x8AC1, 0x5A10, 0x8AC2, 0x5A11, 0xE6B6, 0x5A12, 0x8AC3, - 0x5A13, 0xE6B8, 0x5A14, 0x8AC4, 0x5A15, 0x8AC5, 0x5A16, 0x8AC6, - 0x5A17, 0x8AC7, 0x5A18, 0xC4EF, 0x5A19, 0x8AC8, 0x5A1A, 0x8AC9, - 0x5A1B, 0x8ACA, 0x5A1C, 0xC4C8, 0x5A1D, 0x8ACB, 0x5A1E, 0x8ACC, - 0x5A1F, 0xBEEA, 0x5A20, 0xC9EF, 0x5A21, 0x8ACD, 0x5A22, 0x8ACE, - 0x5A23, 0xE6B7, 0x5A24, 0x8ACF, 0x5A25, 0xB6F0, 0x5A26, 0x8AD0, - 0x5A27, 0x8AD1, 0x5A28, 0x8AD2, 0x5A29, 0xC3E4, 0x5A2A, 0x8AD3, - 0x5A2B, 0x8AD4, 0x5A2C, 0x8AD5, 0x5A2D, 0x8AD6, 0x5A2E, 0x8AD7, - 0x5A2F, 0x8AD8, 0x5A30, 0x8AD9, 0x5A31, 0xD3E9, 0x5A32, 0xE6B4, - 0x5A33, 0x8ADA, 0x5A34, 0xE6B5, 0x5A35, 0x8ADB, 0x5A36, 0xC8A2, - 0x5A37, 0x8ADC, 0x5A38, 0x8ADD, 0x5A39, 0x8ADE, 0x5A3A, 0x8ADF, - 0x5A3B, 0x8AE0, 0x5A3C, 0xE6BD, 0x5A3D, 0x8AE1, 0x5A3E, 0x8AE2, - 0x5A3F, 0x8AE3, 0x5A40, 0xE6B9, 0x5A41, 0x8AE4, 0x5A42, 0x8AE5, - 0x5A43, 0x8AE6, 0x5A44, 0x8AE7, 0x5A45, 0x8AE8, 0x5A46, 0xC6C5, - 0x5A47, 0x8AE9, 0x5A48, 0x8AEA, 0x5A49, 0xCDF1, 0x5A4A, 0xE6BB, - 0x5A4B, 0x8AEB, 0x5A4C, 0x8AEC, 0x5A4D, 0x8AED, 0x5A4E, 0x8AEE, - 0x5A4F, 0x8AEF, 0x5A50, 0x8AF0, 0x5A51, 0x8AF1, 0x5A52, 0x8AF2, - 0x5A53, 0x8AF3, 0x5A54, 0x8AF4, 0x5A55, 0xE6BC, 0x5A56, 0x8AF5, - 0x5A57, 0x8AF6, 0x5A58, 0x8AF7, 0x5A59, 0x8AF8, 0x5A5A, 0xBBE9, - 0x5A5B, 0x8AF9, 0x5A5C, 0x8AFA, 0x5A5D, 0x8AFB, 0x5A5E, 0x8AFC, - 0x5A5F, 0x8AFD, 0x5A60, 0x8AFE, 0x5A61, 0x8B40, 0x5A62, 0xE6BE, - 0x5A63, 0x8B41, 0x5A64, 0x8B42, 0x5A65, 0x8B43, 0x5A66, 0x8B44, - 0x5A67, 0xE6BA, 0x5A68, 0x8B45, 0x5A69, 0x8B46, 0x5A6A, 0xC0B7, - 0x5A6B, 0x8B47, 0x5A6C, 0x8B48, 0x5A6D, 0x8B49, 0x5A6E, 0x8B4A, - 0x5A6F, 0x8B4B, 0x5A70, 0x8B4C, 0x5A71, 0x8B4D, 0x5A72, 0x8B4E, - 0x5A73, 0x8B4F, 0x5A74, 0xD3A4, 0x5A75, 0xE6BF, 0x5A76, 0xC9F4, - 0x5A77, 0xE6C3, 0x5A78, 0x8B50, 0x5A79, 0x8B51, 0x5A7A, 0xE6C4, - 0x5A7B, 0x8B52, 0x5A7C, 0x8B53, 0x5A7D, 0x8B54, 0x5A7E, 0x8B55, - 0x5A7F, 0xD0F6, 0x5A80, 0x8B56, 0x5A81, 0x8B57, 0x5A82, 0x8B58, - 0x5A83, 0x8B59, 0x5A84, 0x8B5A, 0x5A85, 0x8B5B, 0x5A86, 0x8B5C, - 0x5A87, 0x8B5D, 0x5A88, 0x8B5E, 0x5A89, 0x8B5F, 0x5A8A, 0x8B60, - 0x5A8B, 0x8B61, 0x5A8C, 0x8B62, 0x5A8D, 0x8B63, 0x5A8E, 0x8B64, - 0x5A8F, 0x8B65, 0x5A90, 0x8B66, 0x5A91, 0x8B67, 0x5A92, 0xC3BD, - 0x5A93, 0x8B68, 0x5A94, 0x8B69, 0x5A95, 0x8B6A, 0x5A96, 0x8B6B, - 0x5A97, 0x8B6C, 0x5A98, 0x8B6D, 0x5A99, 0x8B6E, 0x5A9A, 0xC3C4, - 0x5A9B, 0xE6C2, 0x5A9C, 0x8B6F, 0x5A9D, 0x8B70, 0x5A9E, 0x8B71, - 0x5A9F, 0x8B72, 0x5AA0, 0x8B73, 0x5AA1, 0x8B74, 0x5AA2, 0x8B75, - 0x5AA3, 0x8B76, 0x5AA4, 0x8B77, 0x5AA5, 0x8B78, 0x5AA6, 0x8B79, - 0x5AA7, 0x8B7A, 0x5AA8, 0x8B7B, 0x5AA9, 0x8B7C, 0x5AAA, 0xE6C1, - 0x5AAB, 0x8B7D, 0x5AAC, 0x8B7E, 0x5AAD, 0x8B80, 0x5AAE, 0x8B81, - 0x5AAF, 0x8B82, 0x5AB0, 0x8B83, 0x5AB1, 0x8B84, 0x5AB2, 0xE6C7, - 0x5AB3, 0xCFB1, 0x5AB4, 0x8B85, 0x5AB5, 0xEBF4, 0x5AB6, 0x8B86, - 0x5AB7, 0x8B87, 0x5AB8, 0xE6CA, 0x5AB9, 0x8B88, 0x5ABA, 0x8B89, - 0x5ABB, 0x8B8A, 0x5ABC, 0x8B8B, 0x5ABD, 0x8B8C, 0x5ABE, 0xE6C5, - 0x5ABF, 0x8B8D, 0x5AC0, 0x8B8E, 0x5AC1, 0xBCDE, 0x5AC2, 0xC9A9, - 0x5AC3, 0x8B8F, 0x5AC4, 0x8B90, 0x5AC5, 0x8B91, 0x5AC6, 0x8B92, - 0x5AC7, 0x8B93, 0x5AC8, 0x8B94, 0x5AC9, 0xBCB5, 0x5ACA, 0x8B95, - 0x5ACB, 0x8B96, 0x5ACC, 0xCFD3, 0x5ACD, 0x8B97, 0x5ACE, 0x8B98, - 0x5ACF, 0x8B99, 0x5AD0, 0x8B9A, 0x5AD1, 0x8B9B, 0x5AD2, 0xE6C8, - 0x5AD3, 0x8B9C, 0x5AD4, 0xE6C9, 0x5AD5, 0x8B9D, 0x5AD6, 0xE6CE, - 0x5AD7, 0x8B9E, 0x5AD8, 0xE6D0, 0x5AD9, 0x8B9F, 0x5ADA, 0x8BA0, - 0x5ADB, 0x8BA1, 0x5ADC, 0xE6D1, 0x5ADD, 0x8BA2, 0x5ADE, 0x8BA3, - 0x5ADF, 0x8BA4, 0x5AE0, 0xE6CB, 0x5AE1, 0xB5D5, 0x5AE2, 0x8BA5, - 0x5AE3, 0xE6CC, 0x5AE4, 0x8BA6, 0x5AE5, 0x8BA7, 0x5AE6, 0xE6CF, - 0x5AE7, 0x8BA8, 0x5AE8, 0x8BA9, 0x5AE9, 0xC4DB, 0x5AEA, 0x8BAA, - 0x5AEB, 0xE6C6, 0x5AEC, 0x8BAB, 0x5AED, 0x8BAC, 0x5AEE, 0x8BAD, - 0x5AEF, 0x8BAE, 0x5AF0, 0x8BAF, 0x5AF1, 0xE6CD, 0x5AF2, 0x8BB0, - 0x5AF3, 0x8BB1, 0x5AF4, 0x8BB2, 0x5AF5, 0x8BB3, 0x5AF6, 0x8BB4, - 0x5AF7, 0x8BB5, 0x5AF8, 0x8BB6, 0x5AF9, 0x8BB7, 0x5AFA, 0x8BB8, - 0x5AFB, 0x8BB9, 0x5AFC, 0x8BBA, 0x5AFD, 0x8BBB, 0x5AFE, 0x8BBC, - 0x5AFF, 0x8BBD, 0x5B00, 0x8BBE, 0x5B01, 0x8BBF, 0x5B02, 0x8BC0, - 0x5B03, 0x8BC1, 0x5B04, 0x8BC2, 0x5B05, 0x8BC3, 0x5B06, 0x8BC4, - 0x5B07, 0x8BC5, 0x5B08, 0x8BC6, 0x5B09, 0xE6D2, 0x5B0A, 0x8BC7, - 0x5B0B, 0x8BC8, 0x5B0C, 0x8BC9, 0x5B0D, 0x8BCA, 0x5B0E, 0x8BCB, - 0x5B0F, 0x8BCC, 0x5B10, 0x8BCD, 0x5B11, 0x8BCE, 0x5B12, 0x8BCF, - 0x5B13, 0x8BD0, 0x5B14, 0x8BD1, 0x5B15, 0x8BD2, 0x5B16, 0xE6D4, - 0x5B17, 0xE6D3, 0x5B18, 0x8BD3, 0x5B19, 0x8BD4, 0x5B1A, 0x8BD5, - 0x5B1B, 0x8BD6, 0x5B1C, 0x8BD7, 0x5B1D, 0x8BD8, 0x5B1E, 0x8BD9, - 0x5B1F, 0x8BDA, 0x5B20, 0x8BDB, 0x5B21, 0x8BDC, 0x5B22, 0x8BDD, - 0x5B23, 0x8BDE, 0x5B24, 0x8BDF, 0x5B25, 0x8BE0, 0x5B26, 0x8BE1, - 0x5B27, 0x8BE2, 0x5B28, 0x8BE3, 0x5B29, 0x8BE4, 0x5B2A, 0x8BE5, - 0x5B2B, 0x8BE6, 0x5B2C, 0x8BE7, 0x5B2D, 0x8BE8, 0x5B2E, 0x8BE9, - 0x5B2F, 0x8BEA, 0x5B30, 0x8BEB, 0x5B31, 0x8BEC, 0x5B32, 0xE6D5, - 0x5B33, 0x8BED, 0x5B34, 0xD9F8, 0x5B35, 0x8BEE, 0x5B36, 0x8BEF, - 0x5B37, 0xE6D6, 0x5B38, 0x8BF0, 0x5B39, 0x8BF1, 0x5B3A, 0x8BF2, - 0x5B3B, 0x8BF3, 0x5B3C, 0x8BF4, 0x5B3D, 0x8BF5, 0x5B3E, 0x8BF6, - 0x5B3F, 0x8BF7, 0x5B40, 0xE6D7, 0x5B41, 0x8BF8, 0x5B42, 0x8BF9, - 0x5B43, 0x8BFA, 0x5B44, 0x8BFB, 0x5B45, 0x8BFC, 0x5B46, 0x8BFD, - 0x5B47, 0x8BFE, 0x5B48, 0x8C40, 0x5B49, 0x8C41, 0x5B4A, 0x8C42, - 0x5B4B, 0x8C43, 0x5B4C, 0x8C44, 0x5B4D, 0x8C45, 0x5B4E, 0x8C46, - 0x5B4F, 0x8C47, 0x5B50, 0xD7D3, 0x5B51, 0xE6DD, 0x5B52, 0x8C48, - 0x5B53, 0xE6DE, 0x5B54, 0xBFD7, 0x5B55, 0xD4D0, 0x5B56, 0x8C49, - 0x5B57, 0xD7D6, 0x5B58, 0xB4E6, 0x5B59, 0xCBEF, 0x5B5A, 0xE6DA, - 0x5B5B, 0xD8C3, 0x5B5C, 0xD7CE, 0x5B5D, 0xD0A2, 0x5B5E, 0x8C4A, - 0x5B5F, 0xC3CF, 0x5B60, 0x8C4B, 0x5B61, 0x8C4C, 0x5B62, 0xE6DF, - 0x5B63, 0xBCBE, 0x5B64, 0xB9C2, 0x5B65, 0xE6DB, 0x5B66, 0xD1A7, - 0x5B67, 0x8C4D, 0x5B68, 0x8C4E, 0x5B69, 0xBAA2, 0x5B6A, 0xC2CF, - 0x5B6B, 0x8C4F, 0x5B6C, 0xD8AB, 0x5B6D, 0x8C50, 0x5B6E, 0x8C51, - 0x5B6F, 0x8C52, 0x5B70, 0xCAEB, 0x5B71, 0xE5EE, 0x5B72, 0x8C53, - 0x5B73, 0xE6DC, 0x5B74, 0x8C54, 0x5B75, 0xB7F5, 0x5B76, 0x8C55, - 0x5B77, 0x8C56, 0x5B78, 0x8C57, 0x5B79, 0x8C58, 0x5B7A, 0xC8E6, - 0x5B7B, 0x8C59, 0x5B7C, 0x8C5A, 0x5B7D, 0xC4F5, 0x5B7E, 0x8C5B, - 0x5B7F, 0x8C5C, 0x5B80, 0xE5B2, 0x5B81, 0xC4FE, 0x5B82, 0x8C5D, - 0x5B83, 0xCBFC, 0x5B84, 0xE5B3, 0x5B85, 0xD5AC, 0x5B86, 0x8C5E, - 0x5B87, 0xD3EE, 0x5B88, 0xCAD8, 0x5B89, 0xB0B2, 0x5B8A, 0x8C5F, - 0x5B8B, 0xCBCE, 0x5B8C, 0xCDEA, 0x5B8D, 0x8C60, 0x5B8E, 0x8C61, - 0x5B8F, 0xBAEA, 0x5B90, 0x8C62, 0x5B91, 0x8C63, 0x5B92, 0x8C64, - 0x5B93, 0xE5B5, 0x5B94, 0x8C65, 0x5B95, 0xE5B4, 0x5B96, 0x8C66, - 0x5B97, 0xD7DA, 0x5B98, 0xB9D9, 0x5B99, 0xD6E6, 0x5B9A, 0xB6A8, - 0x5B9B, 0xCDF0, 0x5B9C, 0xD2CB, 0x5B9D, 0xB1A6, 0x5B9E, 0xCAB5, - 0x5B9F, 0x8C67, 0x5BA0, 0xB3E8, 0x5BA1, 0xC9F3, 0x5BA2, 0xBFCD, - 0x5BA3, 0xD0FB, 0x5BA4, 0xCAD2, 0x5BA5, 0xE5B6, 0x5BA6, 0xBBC2, - 0x5BA7, 0x8C68, 0x5BA8, 0x8C69, 0x5BA9, 0x8C6A, 0x5BAA, 0xCFDC, - 0x5BAB, 0xB9AC, 0x5BAC, 0x8C6B, 0x5BAD, 0x8C6C, 0x5BAE, 0x8C6D, - 0x5BAF, 0x8C6E, 0x5BB0, 0xD4D7, 0x5BB1, 0x8C6F, 0x5BB2, 0x8C70, - 0x5BB3, 0xBAA6, 0x5BB4, 0xD1E7, 0x5BB5, 0xCFFC, 0x5BB6, 0xBCD2, - 0x5BB7, 0x8C71, 0x5BB8, 0xE5B7, 0x5BB9, 0xC8DD, 0x5BBA, 0x8C72, - 0x5BBB, 0x8C73, 0x5BBC, 0x8C74, 0x5BBD, 0xBFED, 0x5BBE, 0xB1F6, - 0x5BBF, 0xCBDE, 0x5BC0, 0x8C75, 0x5BC1, 0x8C76, 0x5BC2, 0xBCC5, - 0x5BC3, 0x8C77, 0x5BC4, 0xBCC4, 0x5BC5, 0xD2FA, 0x5BC6, 0xC3DC, - 0x5BC7, 0xBFDC, 0x5BC8, 0x8C78, 0x5BC9, 0x8C79, 0x5BCA, 0x8C7A, - 0x5BCB, 0x8C7B, 0x5BCC, 0xB8BB, 0x5BCD, 0x8C7C, 0x5BCE, 0x8C7D, - 0x5BCF, 0x8C7E, 0x5BD0, 0xC3C2, 0x5BD1, 0x8C80, 0x5BD2, 0xBAAE, - 0x5BD3, 0xD4A2, 0x5BD4, 0x8C81, 0x5BD5, 0x8C82, 0x5BD6, 0x8C83, - 0x5BD7, 0x8C84, 0x5BD8, 0x8C85, 0x5BD9, 0x8C86, 0x5BDA, 0x8C87, - 0x5BDB, 0x8C88, 0x5BDC, 0x8C89, 0x5BDD, 0xC7DE, 0x5BDE, 0xC4AF, - 0x5BDF, 0xB2EC, 0x5BE0, 0x8C8A, 0x5BE1, 0xB9D1, 0x5BE2, 0x8C8B, - 0x5BE3, 0x8C8C, 0x5BE4, 0xE5BB, 0x5BE5, 0xC1C8, 0x5BE6, 0x8C8D, - 0x5BE7, 0x8C8E, 0x5BE8, 0xD5AF, 0x5BE9, 0x8C8F, 0x5BEA, 0x8C90, - 0x5BEB, 0x8C91, 0x5BEC, 0x8C92, 0x5BED, 0x8C93, 0x5BEE, 0xE5BC, - 0x5BEF, 0x8C94, 0x5BF0, 0xE5BE, 0x5BF1, 0x8C95, 0x5BF2, 0x8C96, - 0x5BF3, 0x8C97, 0x5BF4, 0x8C98, 0x5BF5, 0x8C99, 0x5BF6, 0x8C9A, - 0x5BF7, 0x8C9B, 0x5BF8, 0xB4E7, 0x5BF9, 0xB6D4, 0x5BFA, 0xCBC2, - 0x5BFB, 0xD1B0, 0x5BFC, 0xB5BC, 0x5BFD, 0x8C9C, 0x5BFE, 0x8C9D, - 0x5BFF, 0xCAD9, 0x5C00, 0x8C9E, 0x5C01, 0xB7E2, 0x5C02, 0x8C9F, - 0x5C03, 0x8CA0, 0x5C04, 0xC9E4, 0x5C05, 0x8CA1, 0x5C06, 0xBDAB, - 0x5C07, 0x8CA2, 0x5C08, 0x8CA3, 0x5C09, 0xCEBE, 0x5C0A, 0xD7F0, - 0x5C0B, 0x8CA4, 0x5C0C, 0x8CA5, 0x5C0D, 0x8CA6, 0x5C0E, 0x8CA7, - 0x5C0F, 0xD0A1, 0x5C10, 0x8CA8, 0x5C11, 0xC9D9, 0x5C12, 0x8CA9, - 0x5C13, 0x8CAA, 0x5C14, 0xB6FB, 0x5C15, 0xE6D8, 0x5C16, 0xBCE2, - 0x5C17, 0x8CAB, 0x5C18, 0xB3BE, 0x5C19, 0x8CAC, 0x5C1A, 0xC9D0, - 0x5C1B, 0x8CAD, 0x5C1C, 0xE6D9, 0x5C1D, 0xB3A2, 0x5C1E, 0x8CAE, - 0x5C1F, 0x8CAF, 0x5C20, 0x8CB0, 0x5C21, 0x8CB1, 0x5C22, 0xDECC, - 0x5C23, 0x8CB2, 0x5C24, 0xD3C8, 0x5C25, 0xDECD, 0x5C26, 0x8CB3, - 0x5C27, 0xD2A2, 0x5C28, 0x8CB4, 0x5C29, 0x8CB5, 0x5C2A, 0x8CB6, - 0x5C2B, 0x8CB7, 0x5C2C, 0xDECE, 0x5C2D, 0x8CB8, 0x5C2E, 0x8CB9, - 0x5C2F, 0x8CBA, 0x5C30, 0x8CBB, 0x5C31, 0xBECD, 0x5C32, 0x8CBC, - 0x5C33, 0x8CBD, 0x5C34, 0xDECF, 0x5C35, 0x8CBE, 0x5C36, 0x8CBF, - 0x5C37, 0x8CC0, 0x5C38, 0xCAAC, 0x5C39, 0xD2FC, 0x5C3A, 0xB3DF, - 0x5C3B, 0xE5EA, 0x5C3C, 0xC4E1, 0x5C3D, 0xBEA1, 0x5C3E, 0xCEB2, - 0x5C3F, 0xC4F2, 0x5C40, 0xBED6, 0x5C41, 0xC6A8, 0x5C42, 0xB2E3, - 0x5C43, 0x8CC1, 0x5C44, 0x8CC2, 0x5C45, 0xBED3, 0x5C46, 0x8CC3, - 0x5C47, 0x8CC4, 0x5C48, 0xC7FC, 0x5C49, 0xCCEB, 0x5C4A, 0xBDEC, - 0x5C4B, 0xCEDD, 0x5C4C, 0x8CC5, 0x5C4D, 0x8CC6, 0x5C4E, 0xCABA, - 0x5C4F, 0xC6C1, 0x5C50, 0xE5EC, 0x5C51, 0xD0BC, 0x5C52, 0x8CC7, - 0x5C53, 0x8CC8, 0x5C54, 0x8CC9, 0x5C55, 0xD5B9, 0x5C56, 0x8CCA, - 0x5C57, 0x8CCB, 0x5C58, 0x8CCC, 0x5C59, 0xE5ED, 0x5C5A, 0x8CCD, - 0x5C5B, 0x8CCE, 0x5C5C, 0x8CCF, 0x5C5D, 0x8CD0, 0x5C5E, 0xCAF4, - 0x5C5F, 0x8CD1, 0x5C60, 0xCDC0, 0x5C61, 0xC2C5, 0x5C62, 0x8CD2, - 0x5C63, 0xE5EF, 0x5C64, 0x8CD3, 0x5C65, 0xC2C4, 0x5C66, 0xE5F0, - 0x5C67, 0x8CD4, 0x5C68, 0x8CD5, 0x5C69, 0x8CD6, 0x5C6A, 0x8CD7, - 0x5C6B, 0x8CD8, 0x5C6C, 0x8CD9, 0x5C6D, 0x8CDA, 0x5C6E, 0xE5F8, - 0x5C6F, 0xCDCD, 0x5C70, 0x8CDB, 0x5C71, 0xC9BD, 0x5C72, 0x8CDC, - 0x5C73, 0x8CDD, 0x5C74, 0x8CDE, 0x5C75, 0x8CDF, 0x5C76, 0x8CE0, - 0x5C77, 0x8CE1, 0x5C78, 0x8CE2, 0x5C79, 0xD2D9, 0x5C7A, 0xE1A8, - 0x5C7B, 0x8CE3, 0x5C7C, 0x8CE4, 0x5C7D, 0x8CE5, 0x5C7E, 0x8CE6, - 0x5C7F, 0xD3EC, 0x5C80, 0x8CE7, 0x5C81, 0xCBEA, 0x5C82, 0xC6F1, - 0x5C83, 0x8CE8, 0x5C84, 0x8CE9, 0x5C85, 0x8CEA, 0x5C86, 0x8CEB, - 0x5C87, 0x8CEC, 0x5C88, 0xE1AC, 0x5C89, 0x8CED, 0x5C8A, 0x8CEE, - 0x5C8B, 0x8CEF, 0x5C8C, 0xE1A7, 0x5C8D, 0xE1A9, 0x5C8E, 0x8CF0, - 0x5C8F, 0x8CF1, 0x5C90, 0xE1AA, 0x5C91, 0xE1AF, 0x5C92, 0x8CF2, - 0x5C93, 0x8CF3, 0x5C94, 0xB2ED, 0x5C95, 0x8CF4, 0x5C96, 0xE1AB, - 0x5C97, 0xB8DA, 0x5C98, 0xE1AD, 0x5C99, 0xE1AE, 0x5C9A, 0xE1B0, - 0x5C9B, 0xB5BA, 0x5C9C, 0xE1B1, 0x5C9D, 0x8CF5, 0x5C9E, 0x8CF6, - 0x5C9F, 0x8CF7, 0x5CA0, 0x8CF8, 0x5CA1, 0x8CF9, 0x5CA2, 0xE1B3, - 0x5CA3, 0xE1B8, 0x5CA4, 0x8CFA, 0x5CA5, 0x8CFB, 0x5CA6, 0x8CFC, - 0x5CA7, 0x8CFD, 0x5CA8, 0x8CFE, 0x5CA9, 0xD1D2, 0x5CAA, 0x8D40, - 0x5CAB, 0xE1B6, 0x5CAC, 0xE1B5, 0x5CAD, 0xC1EB, 0x5CAE, 0x8D41, - 0x5CAF, 0x8D42, 0x5CB0, 0x8D43, 0x5CB1, 0xE1B7, 0x5CB2, 0x8D44, - 0x5CB3, 0xD4C0, 0x5CB4, 0x8D45, 0x5CB5, 0xE1B2, 0x5CB6, 0x8D46, - 0x5CB7, 0xE1BA, 0x5CB8, 0xB0B6, 0x5CB9, 0x8D47, 0x5CBA, 0x8D48, - 0x5CBB, 0x8D49, 0x5CBC, 0x8D4A, 0x5CBD, 0xE1B4, 0x5CBE, 0x8D4B, - 0x5CBF, 0xBFF9, 0x5CC0, 0x8D4C, 0x5CC1, 0xE1B9, 0x5CC2, 0x8D4D, - 0x5CC3, 0x8D4E, 0x5CC4, 0xE1BB, 0x5CC5, 0x8D4F, 0x5CC6, 0x8D50, - 0x5CC7, 0x8D51, 0x5CC8, 0x8D52, 0x5CC9, 0x8D53, 0x5CCA, 0x8D54, - 0x5CCB, 0xE1BE, 0x5CCC, 0x8D55, 0x5CCD, 0x8D56, 0x5CCE, 0x8D57, - 0x5CCF, 0x8D58, 0x5CD0, 0x8D59, 0x5CD1, 0x8D5A, 0x5CD2, 0xE1BC, - 0x5CD3, 0x8D5B, 0x5CD4, 0x8D5C, 0x5CD5, 0x8D5D, 0x5CD6, 0x8D5E, - 0x5CD7, 0x8D5F, 0x5CD8, 0x8D60, 0x5CD9, 0xD6C5, 0x5CDA, 0x8D61, - 0x5CDB, 0x8D62, 0x5CDC, 0x8D63, 0x5CDD, 0x8D64, 0x5CDE, 0x8D65, - 0x5CDF, 0x8D66, 0x5CE0, 0x8D67, 0x5CE1, 0xCFBF, 0x5CE2, 0x8D68, - 0x5CE3, 0x8D69, 0x5CE4, 0xE1BD, 0x5CE5, 0xE1BF, 0x5CE6, 0xC2CD, - 0x5CE7, 0x8D6A, 0x5CE8, 0xB6EB, 0x5CE9, 0x8D6B, 0x5CEA, 0xD3F8, - 0x5CEB, 0x8D6C, 0x5CEC, 0x8D6D, 0x5CED, 0xC7CD, 0x5CEE, 0x8D6E, - 0x5CEF, 0x8D6F, 0x5CF0, 0xB7E5, 0x5CF1, 0x8D70, 0x5CF2, 0x8D71, - 0x5CF3, 0x8D72, 0x5CF4, 0x8D73, 0x5CF5, 0x8D74, 0x5CF6, 0x8D75, - 0x5CF7, 0x8D76, 0x5CF8, 0x8D77, 0x5CF9, 0x8D78, 0x5CFA, 0x8D79, - 0x5CFB, 0xBEFE, 0x5CFC, 0x8D7A, 0x5CFD, 0x8D7B, 0x5CFE, 0x8D7C, - 0x5CFF, 0x8D7D, 0x5D00, 0x8D7E, 0x5D01, 0x8D80, 0x5D02, 0xE1C0, - 0x5D03, 0xE1C1, 0x5D04, 0x8D81, 0x5D05, 0x8D82, 0x5D06, 0xE1C7, - 0x5D07, 0xB3E7, 0x5D08, 0x8D83, 0x5D09, 0x8D84, 0x5D0A, 0x8D85, - 0x5D0B, 0x8D86, 0x5D0C, 0x8D87, 0x5D0D, 0x8D88, 0x5D0E, 0xC6E9, - 0x5D0F, 0x8D89, 0x5D10, 0x8D8A, 0x5D11, 0x8D8B, 0x5D12, 0x8D8C, - 0x5D13, 0x8D8D, 0x5D14, 0xB4DE, 0x5D15, 0x8D8E, 0x5D16, 0xD1C2, - 0x5D17, 0x8D8F, 0x5D18, 0x8D90, 0x5D19, 0x8D91, 0x5D1A, 0x8D92, - 0x5D1B, 0xE1C8, 0x5D1C, 0x8D93, 0x5D1D, 0x8D94, 0x5D1E, 0xE1C6, - 0x5D1F, 0x8D95, 0x5D20, 0x8D96, 0x5D21, 0x8D97, 0x5D22, 0x8D98, - 0x5D23, 0x8D99, 0x5D24, 0xE1C5, 0x5D25, 0x8D9A, 0x5D26, 0xE1C3, - 0x5D27, 0xE1C2, 0x5D28, 0x8D9B, 0x5D29, 0xB1C0, 0x5D2A, 0x8D9C, - 0x5D2B, 0x8D9D, 0x5D2C, 0x8D9E, 0x5D2D, 0xD5B8, 0x5D2E, 0xE1C4, - 0x5D2F, 0x8D9F, 0x5D30, 0x8DA0, 0x5D31, 0x8DA1, 0x5D32, 0x8DA2, - 0x5D33, 0x8DA3, 0x5D34, 0xE1CB, 0x5D35, 0x8DA4, 0x5D36, 0x8DA5, - 0x5D37, 0x8DA6, 0x5D38, 0x8DA7, 0x5D39, 0x8DA8, 0x5D3A, 0x8DA9, - 0x5D3B, 0x8DAA, 0x5D3C, 0x8DAB, 0x5D3D, 0xE1CC, 0x5D3E, 0xE1CA, - 0x5D3F, 0x8DAC, 0x5D40, 0x8DAD, 0x5D41, 0x8DAE, 0x5D42, 0x8DAF, - 0x5D43, 0x8DB0, 0x5D44, 0x8DB1, 0x5D45, 0x8DB2, 0x5D46, 0x8DB3, - 0x5D47, 0xEFFA, 0x5D48, 0x8DB4, 0x5D49, 0x8DB5, 0x5D4A, 0xE1D3, - 0x5D4B, 0xE1D2, 0x5D4C, 0xC7B6, 0x5D4D, 0x8DB6, 0x5D4E, 0x8DB7, - 0x5D4F, 0x8DB8, 0x5D50, 0x8DB9, 0x5D51, 0x8DBA, 0x5D52, 0x8DBB, - 0x5D53, 0x8DBC, 0x5D54, 0x8DBD, 0x5D55, 0x8DBE, 0x5D56, 0x8DBF, - 0x5D57, 0x8DC0, 0x5D58, 0xE1C9, 0x5D59, 0x8DC1, 0x5D5A, 0x8DC2, - 0x5D5B, 0xE1CE, 0x5D5C, 0x8DC3, 0x5D5D, 0xE1D0, 0x5D5E, 0x8DC4, - 0x5D5F, 0x8DC5, 0x5D60, 0x8DC6, 0x5D61, 0x8DC7, 0x5D62, 0x8DC8, - 0x5D63, 0x8DC9, 0x5D64, 0x8DCA, 0x5D65, 0x8DCB, 0x5D66, 0x8DCC, - 0x5D67, 0x8DCD, 0x5D68, 0x8DCE, 0x5D69, 0xE1D4, 0x5D6A, 0x8DCF, - 0x5D6B, 0xE1D1, 0x5D6C, 0xE1CD, 0x5D6D, 0x8DD0, 0x5D6E, 0x8DD1, - 0x5D6F, 0xE1CF, 0x5D70, 0x8DD2, 0x5D71, 0x8DD3, 0x5D72, 0x8DD4, - 0x5D73, 0x8DD5, 0x5D74, 0xE1D5, 0x5D75, 0x8DD6, 0x5D76, 0x8DD7, - 0x5D77, 0x8DD8, 0x5D78, 0x8DD9, 0x5D79, 0x8DDA, 0x5D7A, 0x8DDB, - 0x5D7B, 0x8DDC, 0x5D7C, 0x8DDD, 0x5D7D, 0x8DDE, 0x5D7E, 0x8DDF, - 0x5D7F, 0x8DE0, 0x5D80, 0x8DE1, 0x5D81, 0x8DE2, 0x5D82, 0xE1D6, - 0x5D83, 0x8DE3, 0x5D84, 0x8DE4, 0x5D85, 0x8DE5, 0x5D86, 0x8DE6, - 0x5D87, 0x8DE7, 0x5D88, 0x8DE8, 0x5D89, 0x8DE9, 0x5D8A, 0x8DEA, - 0x5D8B, 0x8DEB, 0x5D8C, 0x8DEC, 0x5D8D, 0x8DED, 0x5D8E, 0x8DEE, - 0x5D8F, 0x8DEF, 0x5D90, 0x8DF0, 0x5D91, 0x8DF1, 0x5D92, 0x8DF2, - 0x5D93, 0x8DF3, 0x5D94, 0x8DF4, 0x5D95, 0x8DF5, 0x5D96, 0x8DF6, - 0x5D97, 0x8DF7, 0x5D98, 0x8DF8, 0x5D99, 0xE1D7, 0x5D9A, 0x8DF9, - 0x5D9B, 0x8DFA, 0x5D9C, 0x8DFB, 0x5D9D, 0xE1D8, 0x5D9E, 0x8DFC, - 0x5D9F, 0x8DFD, 0x5DA0, 0x8DFE, 0x5DA1, 0x8E40, 0x5DA2, 0x8E41, - 0x5DA3, 0x8E42, 0x5DA4, 0x8E43, 0x5DA5, 0x8E44, 0x5DA6, 0x8E45, - 0x5DA7, 0x8E46, 0x5DA8, 0x8E47, 0x5DA9, 0x8E48, 0x5DAA, 0x8E49, - 0x5DAB, 0x8E4A, 0x5DAC, 0x8E4B, 0x5DAD, 0x8E4C, 0x5DAE, 0x8E4D, - 0x5DAF, 0x8E4E, 0x5DB0, 0x8E4F, 0x5DB1, 0x8E50, 0x5DB2, 0x8E51, - 0x5DB3, 0x8E52, 0x5DB4, 0x8E53, 0x5DB5, 0x8E54, 0x5DB6, 0x8E55, - 0x5DB7, 0xE1DA, 0x5DB8, 0x8E56, 0x5DB9, 0x8E57, 0x5DBA, 0x8E58, - 0x5DBB, 0x8E59, 0x5DBC, 0x8E5A, 0x5DBD, 0x8E5B, 0x5DBE, 0x8E5C, - 0x5DBF, 0x8E5D, 0x5DC0, 0x8E5E, 0x5DC1, 0x8E5F, 0x5DC2, 0x8E60, - 0x5DC3, 0x8E61, 0x5DC4, 0x8E62, 0x5DC5, 0xE1DB, 0x5DC6, 0x8E63, - 0x5DC7, 0x8E64, 0x5DC8, 0x8E65, 0x5DC9, 0x8E66, 0x5DCA, 0x8E67, - 0x5DCB, 0x8E68, 0x5DCC, 0x8E69, 0x5DCD, 0xCEA1, 0x5DCE, 0x8E6A, - 0x5DCF, 0x8E6B, 0x5DD0, 0x8E6C, 0x5DD1, 0x8E6D, 0x5DD2, 0x8E6E, - 0x5DD3, 0x8E6F, 0x5DD4, 0x8E70, 0x5DD5, 0x8E71, 0x5DD6, 0x8E72, - 0x5DD7, 0x8E73, 0x5DD8, 0x8E74, 0x5DD9, 0x8E75, 0x5DDA, 0x8E76, - 0x5DDB, 0xE7DD, 0x5DDC, 0x8E77, 0x5DDD, 0xB4A8, 0x5DDE, 0xD6DD, - 0x5DDF, 0x8E78, 0x5DE0, 0x8E79, 0x5DE1, 0xD1B2, 0x5DE2, 0xB3B2, - 0x5DE3, 0x8E7A, 0x5DE4, 0x8E7B, 0x5DE5, 0xB9A4, 0x5DE6, 0xD7F3, - 0x5DE7, 0xC7C9, 0x5DE8, 0xBEDE, 0x5DE9, 0xB9AE, 0x5DEA, 0x8E7C, - 0x5DEB, 0xCED7, 0x5DEC, 0x8E7D, 0x5DED, 0x8E7E, 0x5DEE, 0xB2EE, - 0x5DEF, 0xDBCF, 0x5DF0, 0x8E80, 0x5DF1, 0xBCBA, 0x5DF2, 0xD2D1, - 0x5DF3, 0xCBC8, 0x5DF4, 0xB0CD, 0x5DF5, 0x8E81, 0x5DF6, 0x8E82, - 0x5DF7, 0xCFEF, 0x5DF8, 0x8E83, 0x5DF9, 0x8E84, 0x5DFA, 0x8E85, - 0x5DFB, 0x8E86, 0x5DFC, 0x8E87, 0x5DFD, 0xD9E3, 0x5DFE, 0xBDED, - 0x5DFF, 0x8E88, 0x5E00, 0x8E89, 0x5E01, 0xB1D2, 0x5E02, 0xCAD0, - 0x5E03, 0xB2BC, 0x5E04, 0x8E8A, 0x5E05, 0xCBA7, 0x5E06, 0xB7AB, - 0x5E07, 0x8E8B, 0x5E08, 0xCAA6, 0x5E09, 0x8E8C, 0x5E0A, 0x8E8D, - 0x5E0B, 0x8E8E, 0x5E0C, 0xCFA3, 0x5E0D, 0x8E8F, 0x5E0E, 0x8E90, - 0x5E0F, 0xE0F8, 0x5E10, 0xD5CA, 0x5E11, 0xE0FB, 0x5E12, 0x8E91, - 0x5E13, 0x8E92, 0x5E14, 0xE0FA, 0x5E15, 0xC5C1, 0x5E16, 0xCCFB, - 0x5E17, 0x8E93, 0x5E18, 0xC1B1, 0x5E19, 0xE0F9, 0x5E1A, 0xD6E3, - 0x5E1B, 0xB2AF, 0x5E1C, 0xD6C4, 0x5E1D, 0xB5DB, 0x5E1E, 0x8E94, - 0x5E1F, 0x8E95, 0x5E20, 0x8E96, 0x5E21, 0x8E97, 0x5E22, 0x8E98, - 0x5E23, 0x8E99, 0x5E24, 0x8E9A, 0x5E25, 0x8E9B, 0x5E26, 0xB4F8, - 0x5E27, 0xD6A1, 0x5E28, 0x8E9C, 0x5E29, 0x8E9D, 0x5E2A, 0x8E9E, - 0x5E2B, 0x8E9F, 0x5E2C, 0x8EA0, 0x5E2D, 0xCFAF, 0x5E2E, 0xB0EF, - 0x5E2F, 0x8EA1, 0x5E30, 0x8EA2, 0x5E31, 0xE0FC, 0x5E32, 0x8EA3, - 0x5E33, 0x8EA4, 0x5E34, 0x8EA5, 0x5E35, 0x8EA6, 0x5E36, 0x8EA7, - 0x5E37, 0xE1A1, 0x5E38, 0xB3A3, 0x5E39, 0x8EA8, 0x5E3A, 0x8EA9, - 0x5E3B, 0xE0FD, 0x5E3C, 0xE0FE, 0x5E3D, 0xC3B1, 0x5E3E, 0x8EAA, - 0x5E3F, 0x8EAB, 0x5E40, 0x8EAC, 0x5E41, 0x8EAD, 0x5E42, 0xC3DD, - 0x5E43, 0x8EAE, 0x5E44, 0xE1A2, 0x5E45, 0xB7F9, 0x5E46, 0x8EAF, - 0x5E47, 0x8EB0, 0x5E48, 0x8EB1, 0x5E49, 0x8EB2, 0x5E4A, 0x8EB3, - 0x5E4B, 0x8EB4, 0x5E4C, 0xBBCF, 0x5E4D, 0x8EB5, 0x5E4E, 0x8EB6, - 0x5E4F, 0x8EB7, 0x5E50, 0x8EB8, 0x5E51, 0x8EB9, 0x5E52, 0x8EBA, - 0x5E53, 0x8EBB, 0x5E54, 0xE1A3, 0x5E55, 0xC4BB, 0x5E56, 0x8EBC, - 0x5E57, 0x8EBD, 0x5E58, 0x8EBE, 0x5E59, 0x8EBF, 0x5E5A, 0x8EC0, - 0x5E5B, 0xE1A4, 0x5E5C, 0x8EC1, 0x5E5D, 0x8EC2, 0x5E5E, 0xE1A5, - 0x5E5F, 0x8EC3, 0x5E60, 0x8EC4, 0x5E61, 0xE1A6, 0x5E62, 0xB4B1, - 0x5E63, 0x8EC5, 0x5E64, 0x8EC6, 0x5E65, 0x8EC7, 0x5E66, 0x8EC8, - 0x5E67, 0x8EC9, 0x5E68, 0x8ECA, 0x5E69, 0x8ECB, 0x5E6A, 0x8ECC, - 0x5E6B, 0x8ECD, 0x5E6C, 0x8ECE, 0x5E6D, 0x8ECF, 0x5E6E, 0x8ED0, - 0x5E6F, 0x8ED1, 0x5E70, 0x8ED2, 0x5E71, 0x8ED3, 0x5E72, 0xB8C9, - 0x5E73, 0xC6BD, 0x5E74, 0xC4EA, 0x5E75, 0x8ED4, 0x5E76, 0xB2A2, - 0x5E77, 0x8ED5, 0x5E78, 0xD0D2, 0x5E79, 0x8ED6, 0x5E7A, 0xE7DB, - 0x5E7B, 0xBBC3, 0x5E7C, 0xD3D7, 0x5E7D, 0xD3C4, 0x5E7E, 0x8ED7, - 0x5E7F, 0xB9E3, 0x5E80, 0xE2CF, 0x5E81, 0x8ED8, 0x5E82, 0x8ED9, - 0x5E83, 0x8EDA, 0x5E84, 0xD7AF, 0x5E85, 0x8EDB, 0x5E86, 0xC7EC, - 0x5E87, 0xB1D3, 0x5E88, 0x8EDC, 0x5E89, 0x8EDD, 0x5E8A, 0xB4B2, - 0x5E8B, 0xE2D1, 0x5E8C, 0x8EDE, 0x5E8D, 0x8EDF, 0x5E8E, 0x8EE0, - 0x5E8F, 0xD0F2, 0x5E90, 0xC2AE, 0x5E91, 0xE2D0, 0x5E92, 0x8EE1, - 0x5E93, 0xBFE2, 0x5E94, 0xD3A6, 0x5E95, 0xB5D7, 0x5E96, 0xE2D2, - 0x5E97, 0xB5EA, 0x5E98, 0x8EE2, 0x5E99, 0xC3ED, 0x5E9A, 0xB8FD, - 0x5E9B, 0x8EE3, 0x5E9C, 0xB8AE, 0x5E9D, 0x8EE4, 0x5E9E, 0xC5D3, - 0x5E9F, 0xB7CF, 0x5EA0, 0xE2D4, 0x5EA1, 0x8EE5, 0x5EA2, 0x8EE6, - 0x5EA3, 0x8EE7, 0x5EA4, 0x8EE8, 0x5EA5, 0xE2D3, 0x5EA6, 0xB6C8, - 0x5EA7, 0xD7F9, 0x5EA8, 0x8EE9, 0x5EA9, 0x8EEA, 0x5EAA, 0x8EEB, - 0x5EAB, 0x8EEC, 0x5EAC, 0x8EED, 0x5EAD, 0xCDA5, 0x5EAE, 0x8EEE, - 0x5EAF, 0x8EEF, 0x5EB0, 0x8EF0, 0x5EB1, 0x8EF1, 0x5EB2, 0x8EF2, - 0x5EB3, 0xE2D8, 0x5EB4, 0x8EF3, 0x5EB5, 0xE2D6, 0x5EB6, 0xCAFC, - 0x5EB7, 0xBFB5, 0x5EB8, 0xD3B9, 0x5EB9, 0xE2D5, 0x5EBA, 0x8EF4, - 0x5EBB, 0x8EF5, 0x5EBC, 0x8EF6, 0x5EBD, 0x8EF7, 0x5EBE, 0xE2D7, - 0x5EBF, 0x8EF8, 0x5EC0, 0x8EF9, 0x5EC1, 0x8EFA, 0x5EC2, 0x8EFB, - 0x5EC3, 0x8EFC, 0x5EC4, 0x8EFD, 0x5EC5, 0x8EFE, 0x5EC6, 0x8F40, - 0x5EC7, 0x8F41, 0x5EC8, 0x8F42, 0x5EC9, 0xC1AE, 0x5ECA, 0xC0C8, - 0x5ECB, 0x8F43, 0x5ECC, 0x8F44, 0x5ECD, 0x8F45, 0x5ECE, 0x8F46, - 0x5ECF, 0x8F47, 0x5ED0, 0x8F48, 0x5ED1, 0xE2DB, 0x5ED2, 0xE2DA, - 0x5ED3, 0xC0AA, 0x5ED4, 0x8F49, 0x5ED5, 0x8F4A, 0x5ED6, 0xC1CE, - 0x5ED7, 0x8F4B, 0x5ED8, 0x8F4C, 0x5ED9, 0x8F4D, 0x5EDA, 0x8F4E, - 0x5EDB, 0xE2DC, 0x5EDC, 0x8F4F, 0x5EDD, 0x8F50, 0x5EDE, 0x8F51, - 0x5EDF, 0x8F52, 0x5EE0, 0x8F53, 0x5EE1, 0x8F54, 0x5EE2, 0x8F55, - 0x5EE3, 0x8F56, 0x5EE4, 0x8F57, 0x5EE5, 0x8F58, 0x5EE6, 0x8F59, - 0x5EE7, 0x8F5A, 0x5EE8, 0xE2DD, 0x5EE9, 0x8F5B, 0x5EEA, 0xE2DE, - 0x5EEB, 0x8F5C, 0x5EEC, 0x8F5D, 0x5EED, 0x8F5E, 0x5EEE, 0x8F5F, - 0x5EEF, 0x8F60, 0x5EF0, 0x8F61, 0x5EF1, 0x8F62, 0x5EF2, 0x8F63, - 0x5EF3, 0x8F64, 0x5EF4, 0xDBC8, 0x5EF5, 0x8F65, 0x5EF6, 0xD1D3, - 0x5EF7, 0xCDA2, 0x5EF8, 0x8F66, 0x5EF9, 0x8F67, 0x5EFA, 0xBDA8, - 0x5EFB, 0x8F68, 0x5EFC, 0x8F69, 0x5EFD, 0x8F6A, 0x5EFE, 0xDEC3, - 0x5EFF, 0xD8A5, 0x5F00, 0xBFAA, 0x5F01, 0xDBCD, 0x5F02, 0xD2EC, - 0x5F03, 0xC6FA, 0x5F04, 0xC5AA, 0x5F05, 0x8F6B, 0x5F06, 0x8F6C, - 0x5F07, 0x8F6D, 0x5F08, 0xDEC4, 0x5F09, 0x8F6E, 0x5F0A, 0xB1D7, - 0x5F0B, 0xDFAE, 0x5F0C, 0x8F6F, 0x5F0D, 0x8F70, 0x5F0E, 0x8F71, - 0x5F0F, 0xCABD, 0x5F10, 0x8F72, 0x5F11, 0xDFB1, 0x5F12, 0x8F73, - 0x5F13, 0xB9AD, 0x5F14, 0x8F74, 0x5F15, 0xD2FD, 0x5F16, 0x8F75, - 0x5F17, 0xB8A5, 0x5F18, 0xBAEB, 0x5F19, 0x8F76, 0x5F1A, 0x8F77, - 0x5F1B, 0xB3DA, 0x5F1C, 0x8F78, 0x5F1D, 0x8F79, 0x5F1E, 0x8F7A, - 0x5F1F, 0xB5DC, 0x5F20, 0xD5C5, 0x5F21, 0x8F7B, 0x5F22, 0x8F7C, - 0x5F23, 0x8F7D, 0x5F24, 0x8F7E, 0x5F25, 0xC3D6, 0x5F26, 0xCFD2, - 0x5F27, 0xBBA1, 0x5F28, 0x8F80, 0x5F29, 0xE5F3, 0x5F2A, 0xE5F2, - 0x5F2B, 0x8F81, 0x5F2C, 0x8F82, 0x5F2D, 0xE5F4, 0x5F2E, 0x8F83, - 0x5F2F, 0xCDE4, 0x5F30, 0x8F84, 0x5F31, 0xC8F5, 0x5F32, 0x8F85, - 0x5F33, 0x8F86, 0x5F34, 0x8F87, 0x5F35, 0x8F88, 0x5F36, 0x8F89, - 0x5F37, 0x8F8A, 0x5F38, 0x8F8B, 0x5F39, 0xB5AF, 0x5F3A, 0xC7BF, - 0x5F3B, 0x8F8C, 0x5F3C, 0xE5F6, 0x5F3D, 0x8F8D, 0x5F3E, 0x8F8E, - 0x5F3F, 0x8F8F, 0x5F40, 0xECB0, 0x5F41, 0x8F90, 0x5F42, 0x8F91, - 0x5F43, 0x8F92, 0x5F44, 0x8F93, 0x5F45, 0x8F94, 0x5F46, 0x8F95, - 0x5F47, 0x8F96, 0x5F48, 0x8F97, 0x5F49, 0x8F98, 0x5F4A, 0x8F99, - 0x5F4B, 0x8F9A, 0x5F4C, 0x8F9B, 0x5F4D, 0x8F9C, 0x5F4E, 0x8F9D, - 0x5F4F, 0x8F9E, 0x5F50, 0xE5E6, 0x5F51, 0x8F9F, 0x5F52, 0xB9E9, - 0x5F53, 0xB5B1, 0x5F54, 0x8FA0, 0x5F55, 0xC2BC, 0x5F56, 0xE5E8, - 0x5F57, 0xE5E7, 0x5F58, 0xE5E9, 0x5F59, 0x8FA1, 0x5F5A, 0x8FA2, - 0x5F5B, 0x8FA3, 0x5F5C, 0x8FA4, 0x5F5D, 0xD2CD, 0x5F5E, 0x8FA5, - 0x5F5F, 0x8FA6, 0x5F60, 0x8FA7, 0x5F61, 0xE1EA, 0x5F62, 0xD0CE, - 0x5F63, 0x8FA8, 0x5F64, 0xCDAE, 0x5F65, 0x8FA9, 0x5F66, 0xD1E5, - 0x5F67, 0x8FAA, 0x5F68, 0x8FAB, 0x5F69, 0xB2CA, 0x5F6A, 0xB1EB, - 0x5F6B, 0x8FAC, 0x5F6C, 0xB1F2, 0x5F6D, 0xC5ED, 0x5F6E, 0x8FAD, - 0x5F6F, 0x8FAE, 0x5F70, 0xD5C3, 0x5F71, 0xD3B0, 0x5F72, 0x8FAF, - 0x5F73, 0xE1DC, 0x5F74, 0x8FB0, 0x5F75, 0x8FB1, 0x5F76, 0x8FB2, - 0x5F77, 0xE1DD, 0x5F78, 0x8FB3, 0x5F79, 0xD2DB, 0x5F7A, 0x8FB4, - 0x5F7B, 0xB3B9, 0x5F7C, 0xB1CB, 0x5F7D, 0x8FB5, 0x5F7E, 0x8FB6, - 0x5F7F, 0x8FB7, 0x5F80, 0xCDF9, 0x5F81, 0xD5F7, 0x5F82, 0xE1DE, - 0x5F83, 0x8FB8, 0x5F84, 0xBEB6, 0x5F85, 0xB4FD, 0x5F86, 0x8FB9, - 0x5F87, 0xE1DF, 0x5F88, 0xBADC, 0x5F89, 0xE1E0, 0x5F8A, 0xBBB2, - 0x5F8B, 0xC2C9, 0x5F8C, 0xE1E1, 0x5F8D, 0x8FBA, 0x5F8E, 0x8FBB, - 0x5F8F, 0x8FBC, 0x5F90, 0xD0EC, 0x5F91, 0x8FBD, 0x5F92, 0xCDBD, - 0x5F93, 0x8FBE, 0x5F94, 0x8FBF, 0x5F95, 0xE1E2, 0x5F96, 0x8FC0, - 0x5F97, 0xB5C3, 0x5F98, 0xC5C7, 0x5F99, 0xE1E3, 0x5F9A, 0x8FC1, - 0x5F9B, 0x8FC2, 0x5F9C, 0xE1E4, 0x5F9D, 0x8FC3, 0x5F9E, 0x8FC4, - 0x5F9F, 0x8FC5, 0x5FA0, 0x8FC6, 0x5FA1, 0xD3F9, 0x5FA2, 0x8FC7, - 0x5FA3, 0x8FC8, 0x5FA4, 0x8FC9, 0x5FA5, 0x8FCA, 0x5FA6, 0x8FCB, - 0x5FA7, 0x8FCC, 0x5FA8, 0xE1E5, 0x5FA9, 0x8FCD, 0x5FAA, 0xD1AD, - 0x5FAB, 0x8FCE, 0x5FAC, 0x8FCF, 0x5FAD, 0xE1E6, 0x5FAE, 0xCEA2, - 0x5FAF, 0x8FD0, 0x5FB0, 0x8FD1, 0x5FB1, 0x8FD2, 0x5FB2, 0x8FD3, - 0x5FB3, 0x8FD4, 0x5FB4, 0x8FD5, 0x5FB5, 0xE1E7, 0x5FB6, 0x8FD6, - 0x5FB7, 0xB5C2, 0x5FB8, 0x8FD7, 0x5FB9, 0x8FD8, 0x5FBA, 0x8FD9, - 0x5FBB, 0x8FDA, 0x5FBC, 0xE1E8, 0x5FBD, 0xBBD5, 0x5FBE, 0x8FDB, - 0x5FBF, 0x8FDC, 0x5FC0, 0x8FDD, 0x5FC1, 0x8FDE, 0x5FC2, 0x8FDF, - 0x5FC3, 0xD0C4, 0x5FC4, 0xE2E0, 0x5FC5, 0xB1D8, 0x5FC6, 0xD2E4, - 0x5FC7, 0x8FE0, 0x5FC8, 0x8FE1, 0x5FC9, 0xE2E1, 0x5FCA, 0x8FE2, - 0x5FCB, 0x8FE3, 0x5FCC, 0xBCC9, 0x5FCD, 0xC8CC, 0x5FCE, 0x8FE4, - 0x5FCF, 0xE2E3, 0x5FD0, 0xECFE, 0x5FD1, 0xECFD, 0x5FD2, 0xDFAF, - 0x5FD3, 0x8FE5, 0x5FD4, 0x8FE6, 0x5FD5, 0x8FE7, 0x5FD6, 0xE2E2, - 0x5FD7, 0xD6BE, 0x5FD8, 0xCDFC, 0x5FD9, 0xC3A6, 0x5FDA, 0x8FE8, - 0x5FDB, 0x8FE9, 0x5FDC, 0x8FEA, 0x5FDD, 0xE3C3, 0x5FDE, 0x8FEB, - 0x5FDF, 0x8FEC, 0x5FE0, 0xD6D2, 0x5FE1, 0xE2E7, 0x5FE2, 0x8FED, - 0x5FE3, 0x8FEE, 0x5FE4, 0xE2E8, 0x5FE5, 0x8FEF, 0x5FE6, 0x8FF0, - 0x5FE7, 0xD3C7, 0x5FE8, 0x8FF1, 0x5FE9, 0x8FF2, 0x5FEA, 0xE2EC, - 0x5FEB, 0xBFEC, 0x5FEC, 0x8FF3, 0x5FED, 0xE2ED, 0x5FEE, 0xE2E5, - 0x5FEF, 0x8FF4, 0x5FF0, 0x8FF5, 0x5FF1, 0xB3C0, 0x5FF2, 0x8FF6, - 0x5FF3, 0x8FF7, 0x5FF4, 0x8FF8, 0x5FF5, 0xC4EE, 0x5FF6, 0x8FF9, - 0x5FF7, 0x8FFA, 0x5FF8, 0xE2EE, 0x5FF9, 0x8FFB, 0x5FFA, 0x8FFC, - 0x5FFB, 0xD0C3, 0x5FFC, 0x8FFD, 0x5FFD, 0xBAF6, 0x5FFE, 0xE2E9, - 0x5FFF, 0xB7DE, 0x6000, 0xBBB3, 0x6001, 0xCCAC, 0x6002, 0xCBCB, - 0x6003, 0xE2E4, 0x6004, 0xE2E6, 0x6005, 0xE2EA, 0x6006, 0xE2EB, - 0x6007, 0x8FFE, 0x6008, 0x9040, 0x6009, 0x9041, 0x600A, 0xE2F7, - 0x600B, 0x9042, 0x600C, 0x9043, 0x600D, 0xE2F4, 0x600E, 0xD4F5, - 0x600F, 0xE2F3, 0x6010, 0x9044, 0x6011, 0x9045, 0x6012, 0xC5AD, - 0x6013, 0x9046, 0x6014, 0xD5FA, 0x6015, 0xC5C2, 0x6016, 0xB2C0, - 0x6017, 0x9047, 0x6018, 0x9048, 0x6019, 0xE2EF, 0x601A, 0x9049, - 0x601B, 0xE2F2, 0x601C, 0xC1AF, 0x601D, 0xCBBC, 0x601E, 0x904A, - 0x601F, 0x904B, 0x6020, 0xB5A1, 0x6021, 0xE2F9, 0x6022, 0x904C, - 0x6023, 0x904D, 0x6024, 0x904E, 0x6025, 0xBCB1, 0x6026, 0xE2F1, - 0x6027, 0xD0D4, 0x6028, 0xD4B9, 0x6029, 0xE2F5, 0x602A, 0xB9D6, - 0x602B, 0xE2F6, 0x602C, 0x904F, 0x602D, 0x9050, 0x602E, 0x9051, - 0x602F, 0xC7D3, 0x6030, 0x9052, 0x6031, 0x9053, 0x6032, 0x9054, - 0x6033, 0x9055, 0x6034, 0x9056, 0x6035, 0xE2F0, 0x6036, 0x9057, - 0x6037, 0x9058, 0x6038, 0x9059, 0x6039, 0x905A, 0x603A, 0x905B, - 0x603B, 0xD7DC, 0x603C, 0xEDA1, 0x603D, 0x905C, 0x603E, 0x905D, - 0x603F, 0xE2F8, 0x6040, 0x905E, 0x6041, 0xEDA5, 0x6042, 0xE2FE, - 0x6043, 0xCAD1, 0x6044, 0x905F, 0x6045, 0x9060, 0x6046, 0x9061, - 0x6047, 0x9062, 0x6048, 0x9063, 0x6049, 0x9064, 0x604A, 0x9065, - 0x604B, 0xC1B5, 0x604C, 0x9066, 0x604D, 0xBBD0, 0x604E, 0x9067, - 0x604F, 0x9068, 0x6050, 0xBFD6, 0x6051, 0x9069, 0x6052, 0xBAE3, - 0x6053, 0x906A, 0x6054, 0x906B, 0x6055, 0xCBA1, 0x6056, 0x906C, - 0x6057, 0x906D, 0x6058, 0x906E, 0x6059, 0xEDA6, 0x605A, 0xEDA3, - 0x605B, 0x906F, 0x605C, 0x9070, 0x605D, 0xEDA2, 0x605E, 0x9071, - 0x605F, 0x9072, 0x6060, 0x9073, 0x6061, 0x9074, 0x6062, 0xBBD6, - 0x6063, 0xEDA7, 0x6064, 0xD0F4, 0x6065, 0x9075, 0x6066, 0x9076, - 0x6067, 0xEDA4, 0x6068, 0xBADE, 0x6069, 0xB6F7, 0x606A, 0xE3A1, - 0x606B, 0xB6B2, 0x606C, 0xCCF1, 0x606D, 0xB9A7, 0x606E, 0x9077, - 0x606F, 0xCFA2, 0x6070, 0xC7A1, 0x6071, 0x9078, 0x6072, 0x9079, - 0x6073, 0xBFD2, 0x6074, 0x907A, 0x6075, 0x907B, 0x6076, 0xB6F1, - 0x6077, 0x907C, 0x6078, 0xE2FA, 0x6079, 0xE2FB, 0x607A, 0xE2FD, - 0x607B, 0xE2FC, 0x607C, 0xC4D5, 0x607D, 0xE3A2, 0x607E, 0x907D, - 0x607F, 0xD3C1, 0x6080, 0x907E, 0x6081, 0x9080, 0x6082, 0x9081, - 0x6083, 0xE3A7, 0x6084, 0xC7C4, 0x6085, 0x9082, 0x6086, 0x9083, - 0x6087, 0x9084, 0x6088, 0x9085, 0x6089, 0xCFA4, 0x608A, 0x9086, - 0x608B, 0x9087, 0x608C, 0xE3A9, 0x608D, 0xBAB7, 0x608E, 0x9088, - 0x608F, 0x9089, 0x6090, 0x908A, 0x6091, 0x908B, 0x6092, 0xE3A8, - 0x6093, 0x908C, 0x6094, 0xBBDA, 0x6095, 0x908D, 0x6096, 0xE3A3, - 0x6097, 0x908E, 0x6098, 0x908F, 0x6099, 0x9090, 0x609A, 0xE3A4, - 0x609B, 0xE3AA, 0x609C, 0x9091, 0x609D, 0xE3A6, 0x609E, 0x9092, - 0x609F, 0xCEF2, 0x60A0, 0xD3C6, 0x60A1, 0x9093, 0x60A2, 0x9094, - 0x60A3, 0xBBBC, 0x60A4, 0x9095, 0x60A5, 0x9096, 0x60A6, 0xD4C3, - 0x60A7, 0x9097, 0x60A8, 0xC4FA, 0x60A9, 0x9098, 0x60AA, 0x9099, - 0x60AB, 0xEDA8, 0x60AC, 0xD0FC, 0x60AD, 0xE3A5, 0x60AE, 0x909A, - 0x60AF, 0xC3F5, 0x60B0, 0x909B, 0x60B1, 0xE3AD, 0x60B2, 0xB1AF, - 0x60B3, 0x909C, 0x60B4, 0xE3B2, 0x60B5, 0x909D, 0x60B6, 0x909E, - 0x60B7, 0x909F, 0x60B8, 0xBCC2, 0x60B9, 0x90A0, 0x60BA, 0x90A1, - 0x60BB, 0xE3AC, 0x60BC, 0xB5BF, 0x60BD, 0x90A2, 0x60BE, 0x90A3, - 0x60BF, 0x90A4, 0x60C0, 0x90A5, 0x60C1, 0x90A6, 0x60C2, 0x90A7, - 0x60C3, 0x90A8, 0x60C4, 0x90A9, 0x60C5, 0xC7E9, 0x60C6, 0xE3B0, - 0x60C7, 0x90AA, 0x60C8, 0x90AB, 0x60C9, 0x90AC, 0x60CA, 0xBEAA, - 0x60CB, 0xCDEF, 0x60CC, 0x90AD, 0x60CD, 0x90AE, 0x60CE, 0x90AF, - 0x60CF, 0x90B0, 0x60D0, 0x90B1, 0x60D1, 0xBBF3, 0x60D2, 0x90B2, - 0x60D3, 0x90B3, 0x60D4, 0x90B4, 0x60D5, 0xCCE8, 0x60D6, 0x90B5, - 0x60D7, 0x90B6, 0x60D8, 0xE3AF, 0x60D9, 0x90B7, 0x60DA, 0xE3B1, - 0x60DB, 0x90B8, 0x60DC, 0xCFA7, 0x60DD, 0xE3AE, 0x60DE, 0x90B9, - 0x60DF, 0xCEA9, 0x60E0, 0xBBDD, 0x60E1, 0x90BA, 0x60E2, 0x90BB, - 0x60E3, 0x90BC, 0x60E4, 0x90BD, 0x60E5, 0x90BE, 0x60E6, 0xB5EB, - 0x60E7, 0xBEE5, 0x60E8, 0xB2D2, 0x60E9, 0xB3CD, 0x60EA, 0x90BF, - 0x60EB, 0xB1B9, 0x60EC, 0xE3AB, 0x60ED, 0xB2D1, 0x60EE, 0xB5AC, - 0x60EF, 0xB9DF, 0x60F0, 0xB6E8, 0x60F1, 0x90C0, 0x60F2, 0x90C1, - 0x60F3, 0xCFEB, 0x60F4, 0xE3B7, 0x60F5, 0x90C2, 0x60F6, 0xBBCC, - 0x60F7, 0x90C3, 0x60F8, 0x90C4, 0x60F9, 0xC8C7, 0x60FA, 0xD0CA, - 0x60FB, 0x90C5, 0x60FC, 0x90C6, 0x60FD, 0x90C7, 0x60FE, 0x90C8, - 0x60FF, 0x90C9, 0x6100, 0xE3B8, 0x6101, 0xB3EE, 0x6102, 0x90CA, - 0x6103, 0x90CB, 0x6104, 0x90CC, 0x6105, 0x90CD, 0x6106, 0xEDA9, - 0x6107, 0x90CE, 0x6108, 0xD3FA, 0x6109, 0xD3E4, 0x610A, 0x90CF, - 0x610B, 0x90D0, 0x610C, 0x90D1, 0x610D, 0xEDAA, 0x610E, 0xE3B9, - 0x610F, 0xD2E2, 0x6110, 0x90D2, 0x6111, 0x90D3, 0x6112, 0x90D4, - 0x6113, 0x90D5, 0x6114, 0x90D6, 0x6115, 0xE3B5, 0x6116, 0x90D7, - 0x6117, 0x90D8, 0x6118, 0x90D9, 0x6119, 0x90DA, 0x611A, 0xD3DE, - 0x611B, 0x90DB, 0x611C, 0x90DC, 0x611D, 0x90DD, 0x611E, 0x90DE, - 0x611F, 0xB8D0, 0x6120, 0xE3B3, 0x6121, 0x90DF, 0x6122, 0x90E0, - 0x6123, 0xE3B6, 0x6124, 0xB7DF, 0x6125, 0x90E1, 0x6126, 0xE3B4, - 0x6127, 0xC0A2, 0x6128, 0x90E2, 0x6129, 0x90E3, 0x612A, 0x90E4, - 0x612B, 0xE3BA, 0x612C, 0x90E5, 0x612D, 0x90E6, 0x612E, 0x90E7, - 0x612F, 0x90E8, 0x6130, 0x90E9, 0x6131, 0x90EA, 0x6132, 0x90EB, - 0x6133, 0x90EC, 0x6134, 0x90ED, 0x6135, 0x90EE, 0x6136, 0x90EF, - 0x6137, 0x90F0, 0x6138, 0x90F1, 0x6139, 0x90F2, 0x613A, 0x90F3, - 0x613B, 0x90F4, 0x613C, 0x90F5, 0x613D, 0x90F6, 0x613E, 0x90F7, - 0x613F, 0xD4B8, 0x6140, 0x90F8, 0x6141, 0x90F9, 0x6142, 0x90FA, - 0x6143, 0x90FB, 0x6144, 0x90FC, 0x6145, 0x90FD, 0x6146, 0x90FE, - 0x6147, 0x9140, 0x6148, 0xB4C8, 0x6149, 0x9141, 0x614A, 0xE3BB, - 0x614B, 0x9142, 0x614C, 0xBBC5, 0x614D, 0x9143, 0x614E, 0xC9F7, - 0x614F, 0x9144, 0x6150, 0x9145, 0x6151, 0xC9E5, 0x6152, 0x9146, - 0x6153, 0x9147, 0x6154, 0x9148, 0x6155, 0xC4BD, 0x6156, 0x9149, - 0x6157, 0x914A, 0x6158, 0x914B, 0x6159, 0x914C, 0x615A, 0x914D, - 0x615B, 0x914E, 0x615C, 0x914F, 0x615D, 0xEDAB, 0x615E, 0x9150, - 0x615F, 0x9151, 0x6160, 0x9152, 0x6161, 0x9153, 0x6162, 0xC2FD, - 0x6163, 0x9154, 0x6164, 0x9155, 0x6165, 0x9156, 0x6166, 0x9157, - 0x6167, 0xBBDB, 0x6168, 0xBFAE, 0x6169, 0x9158, 0x616A, 0x9159, - 0x616B, 0x915A, 0x616C, 0x915B, 0x616D, 0x915C, 0x616E, 0x915D, - 0x616F, 0x915E, 0x6170, 0xCEBF, 0x6171, 0x915F, 0x6172, 0x9160, - 0x6173, 0x9161, 0x6174, 0x9162, 0x6175, 0xE3BC, 0x6176, 0x9163, - 0x6177, 0xBFB6, 0x6178, 0x9164, 0x6179, 0x9165, 0x617A, 0x9166, - 0x617B, 0x9167, 0x617C, 0x9168, 0x617D, 0x9169, 0x617E, 0x916A, - 0x617F, 0x916B, 0x6180, 0x916C, 0x6181, 0x916D, 0x6182, 0x916E, - 0x6183, 0x916F, 0x6184, 0x9170, 0x6185, 0x9171, 0x6186, 0x9172, - 0x6187, 0x9173, 0x6188, 0x9174, 0x6189, 0x9175, 0x618A, 0x9176, - 0x618B, 0xB1EF, 0x618C, 0x9177, 0x618D, 0x9178, 0x618E, 0xD4F7, - 0x618F, 0x9179, 0x6190, 0x917A, 0x6191, 0x917B, 0x6192, 0x917C, - 0x6193, 0x917D, 0x6194, 0xE3BE, 0x6195, 0x917E, 0x6196, 0x9180, - 0x6197, 0x9181, 0x6198, 0x9182, 0x6199, 0x9183, 0x619A, 0x9184, - 0x619B, 0x9185, 0x619C, 0x9186, 0x619D, 0xEDAD, 0x619E, 0x9187, - 0x619F, 0x9188, 0x61A0, 0x9189, 0x61A1, 0x918A, 0x61A2, 0x918B, - 0x61A3, 0x918C, 0x61A4, 0x918D, 0x61A5, 0x918E, 0x61A6, 0x918F, - 0x61A7, 0xE3BF, 0x61A8, 0xBAA9, 0x61A9, 0xEDAC, 0x61AA, 0x9190, - 0x61AB, 0x9191, 0x61AC, 0xE3BD, 0x61AD, 0x9192, 0x61AE, 0x9193, - 0x61AF, 0x9194, 0x61B0, 0x9195, 0x61B1, 0x9196, 0x61B2, 0x9197, - 0x61B3, 0x9198, 0x61B4, 0x9199, 0x61B5, 0x919A, 0x61B6, 0x919B, - 0x61B7, 0xE3C0, 0x61B8, 0x919C, 0x61B9, 0x919D, 0x61BA, 0x919E, - 0x61BB, 0x919F, 0x61BC, 0x91A0, 0x61BD, 0x91A1, 0x61BE, 0xBAB6, - 0x61BF, 0x91A2, 0x61C0, 0x91A3, 0x61C1, 0x91A4, 0x61C2, 0xB6AE, - 0x61C3, 0x91A5, 0x61C4, 0x91A6, 0x61C5, 0x91A7, 0x61C6, 0x91A8, - 0x61C7, 0x91A9, 0x61C8, 0xD0B8, 0x61C9, 0x91AA, 0x61CA, 0xB0C3, - 0x61CB, 0xEDAE, 0x61CC, 0x91AB, 0x61CD, 0x91AC, 0x61CE, 0x91AD, - 0x61CF, 0x91AE, 0x61D0, 0x91AF, 0x61D1, 0xEDAF, 0x61D2, 0xC0C1, - 0x61D3, 0x91B0, 0x61D4, 0xE3C1, 0x61D5, 0x91B1, 0x61D6, 0x91B2, - 0x61D7, 0x91B3, 0x61D8, 0x91B4, 0x61D9, 0x91B5, 0x61DA, 0x91B6, - 0x61DB, 0x91B7, 0x61DC, 0x91B8, 0x61DD, 0x91B9, 0x61DE, 0x91BA, - 0x61DF, 0x91BB, 0x61E0, 0x91BC, 0x61E1, 0x91BD, 0x61E2, 0x91BE, - 0x61E3, 0x91BF, 0x61E4, 0x91C0, 0x61E5, 0x91C1, 0x61E6, 0xC5B3, - 0x61E7, 0x91C2, 0x61E8, 0x91C3, 0x61E9, 0x91C4, 0x61EA, 0x91C5, - 0x61EB, 0x91C6, 0x61EC, 0x91C7, 0x61ED, 0x91C8, 0x61EE, 0x91C9, - 0x61EF, 0x91CA, 0x61F0, 0x91CB, 0x61F1, 0x91CC, 0x61F2, 0x91CD, - 0x61F3, 0x91CE, 0x61F4, 0x91CF, 0x61F5, 0xE3C2, 0x61F6, 0x91D0, - 0x61F7, 0x91D1, 0x61F8, 0x91D2, 0x61F9, 0x91D3, 0x61FA, 0x91D4, - 0x61FB, 0x91D5, 0x61FC, 0x91D6, 0x61FD, 0x91D7, 0x61FE, 0x91D8, - 0x61FF, 0xDCB2, 0x6200, 0x91D9, 0x6201, 0x91DA, 0x6202, 0x91DB, - 0x6203, 0x91DC, 0x6204, 0x91DD, 0x6205, 0x91DE, 0x6206, 0xEDB0, - 0x6207, 0x91DF, 0x6208, 0xB8EA, 0x6209, 0x91E0, 0x620A, 0xCEEC, - 0x620B, 0xEAA7, 0x620C, 0xD0E7, 0x620D, 0xCAF9, 0x620E, 0xC8D6, - 0x620F, 0xCFB7, 0x6210, 0xB3C9, 0x6211, 0xCED2, 0x6212, 0xBDE4, - 0x6213, 0x91E1, 0x6214, 0x91E2, 0x6215, 0xE3DE, 0x6216, 0xBBF2, - 0x6217, 0xEAA8, 0x6218, 0xD5BD, 0x6219, 0x91E3, 0x621A, 0xC6DD, - 0x621B, 0xEAA9, 0x621C, 0x91E4, 0x621D, 0x91E5, 0x621E, 0x91E6, - 0x621F, 0xEAAA, 0x6220, 0x91E7, 0x6221, 0xEAAC, 0x6222, 0xEAAB, - 0x6223, 0x91E8, 0x6224, 0xEAAE, 0x6225, 0xEAAD, 0x6226, 0x91E9, - 0x6227, 0x91EA, 0x6228, 0x91EB, 0x6229, 0x91EC, 0x622A, 0xBDD8, - 0x622B, 0x91ED, 0x622C, 0xEAAF, 0x622D, 0x91EE, 0x622E, 0xC2BE, - 0x622F, 0x91EF, 0x6230, 0x91F0, 0x6231, 0x91F1, 0x6232, 0x91F2, - 0x6233, 0xB4C1, 0x6234, 0xB4F7, 0x6235, 0x91F3, 0x6236, 0x91F4, - 0x6237, 0xBBA7, 0x6238, 0x91F5, 0x6239, 0x91F6, 0x623A, 0x91F7, - 0x623B, 0x91F8, 0x623C, 0x91F9, 0x623D, 0xECE6, 0x623E, 0xECE5, - 0x623F, 0xB7BF, 0x6240, 0xCBF9, 0x6241, 0xB1E2, 0x6242, 0x91FA, - 0x6243, 0xECE7, 0x6244, 0x91FB, 0x6245, 0x91FC, 0x6246, 0x91FD, - 0x6247, 0xC9C8, 0x6248, 0xECE8, 0x6249, 0xECE9, 0x624A, 0x91FE, - 0x624B, 0xCAD6, 0x624C, 0xDED0, 0x624D, 0xB2C5, 0x624E, 0xD4FA, - 0x624F, 0x9240, 0x6250, 0x9241, 0x6251, 0xC6CB, 0x6252, 0xB0C7, - 0x6253, 0xB4F2, 0x6254, 0xC8D3, 0x6255, 0x9242, 0x6256, 0x9243, - 0x6257, 0x9244, 0x6258, 0xCDD0, 0x6259, 0x9245, 0x625A, 0x9246, - 0x625B, 0xBFB8, 0x625C, 0x9247, 0x625D, 0x9248, 0x625E, 0x9249, - 0x625F, 0x924A, 0x6260, 0x924B, 0x6261, 0x924C, 0x6262, 0x924D, - 0x6263, 0xBFDB, 0x6264, 0x924E, 0x6265, 0x924F, 0x6266, 0xC7A4, - 0x6267, 0xD6B4, 0x6268, 0x9250, 0x6269, 0xC0A9, 0x626A, 0xDED1, - 0x626B, 0xC9A8, 0x626C, 0xD1EF, 0x626D, 0xC5A4, 0x626E, 0xB0E7, - 0x626F, 0xB3B6, 0x6270, 0xC8C5, 0x6271, 0x9251, 0x6272, 0x9252, - 0x6273, 0xB0E2, 0x6274, 0x9253, 0x6275, 0x9254, 0x6276, 0xB7F6, - 0x6277, 0x9255, 0x6278, 0x9256, 0x6279, 0xC5FA, 0x627A, 0x9257, - 0x627B, 0x9258, 0x627C, 0xB6F3, 0x627D, 0x9259, 0x627E, 0xD5D2, - 0x627F, 0xB3D0, 0x6280, 0xBCBC, 0x6281, 0x925A, 0x6282, 0x925B, - 0x6283, 0x925C, 0x6284, 0xB3AD, 0x6285, 0x925D, 0x6286, 0x925E, - 0x6287, 0x925F, 0x6288, 0x9260, 0x6289, 0xBEF1, 0x628A, 0xB0D1, - 0x628B, 0x9261, 0x628C, 0x9262, 0x628D, 0x9263, 0x628E, 0x9264, - 0x628F, 0x9265, 0x6290, 0x9266, 0x6291, 0xD2D6, 0x6292, 0xCAE3, - 0x6293, 0xD7A5, 0x6294, 0x9267, 0x6295, 0xCDB6, 0x6296, 0xB6B6, - 0x6297, 0xBFB9, 0x6298, 0xD5DB, 0x6299, 0x9268, 0x629A, 0xB8A7, - 0x629B, 0xC5D7, 0x629C, 0x9269, 0x629D, 0x926A, 0x629E, 0x926B, - 0x629F, 0xDED2, 0x62A0, 0xBFD9, 0x62A1, 0xC2D5, 0x62A2, 0xC7C0, - 0x62A3, 0x926C, 0x62A4, 0xBBA4, 0x62A5, 0xB1A8, 0x62A6, 0x926D, - 0x62A7, 0x926E, 0x62A8, 0xC5EA, 0x62A9, 0x926F, 0x62AA, 0x9270, - 0x62AB, 0xC5FB, 0x62AC, 0xCCA7, 0x62AD, 0x9271, 0x62AE, 0x9272, - 0x62AF, 0x9273, 0x62B0, 0x9274, 0x62B1, 0xB1A7, 0x62B2, 0x9275, - 0x62B3, 0x9276, 0x62B4, 0x9277, 0x62B5, 0xB5D6, 0x62B6, 0x9278, - 0x62B7, 0x9279, 0x62B8, 0x927A, 0x62B9, 0xC4A8, 0x62BA, 0x927B, - 0x62BB, 0xDED3, 0x62BC, 0xD1BA, 0x62BD, 0xB3E9, 0x62BE, 0x927C, - 0x62BF, 0xC3F2, 0x62C0, 0x927D, 0x62C1, 0x927E, 0x62C2, 0xB7F7, - 0x62C3, 0x9280, 0x62C4, 0xD6F4, 0x62C5, 0xB5A3, 0x62C6, 0xB2F0, - 0x62C7, 0xC4B4, 0x62C8, 0xC4E9, 0x62C9, 0xC0AD, 0x62CA, 0xDED4, - 0x62CB, 0x9281, 0x62CC, 0xB0E8, 0x62CD, 0xC5C4, 0x62CE, 0xC1E0, - 0x62CF, 0x9282, 0x62D0, 0xB9D5, 0x62D1, 0x9283, 0x62D2, 0xBEDC, - 0x62D3, 0xCDD8, 0x62D4, 0xB0CE, 0x62D5, 0x9284, 0x62D6, 0xCDCF, - 0x62D7, 0xDED6, 0x62D8, 0xBED0, 0x62D9, 0xD7BE, 0x62DA, 0xDED5, - 0x62DB, 0xD5D0, 0x62DC, 0xB0DD, 0x62DD, 0x9285, 0x62DE, 0x9286, - 0x62DF, 0xC4E2, 0x62E0, 0x9287, 0x62E1, 0x9288, 0x62E2, 0xC2A3, - 0x62E3, 0xBCF0, 0x62E4, 0x9289, 0x62E5, 0xD3B5, 0x62E6, 0xC0B9, - 0x62E7, 0xC5A1, 0x62E8, 0xB2A6, 0x62E9, 0xD4F1, 0x62EA, 0x928A, - 0x62EB, 0x928B, 0x62EC, 0xC0A8, 0x62ED, 0xCAC3, 0x62EE, 0xDED7, - 0x62EF, 0xD5FC, 0x62F0, 0x928C, 0x62F1, 0xB9B0, 0x62F2, 0x928D, - 0x62F3, 0xC8AD, 0x62F4, 0xCBA9, 0x62F5, 0x928E, 0x62F6, 0xDED9, - 0x62F7, 0xBFBD, 0x62F8, 0x928F, 0x62F9, 0x9290, 0x62FA, 0x9291, - 0x62FB, 0x9292, 0x62FC, 0xC6B4, 0x62FD, 0xD7A7, 0x62FE, 0xCAB0, - 0x62FF, 0xC4C3, 0x6300, 0x9293, 0x6301, 0xB3D6, 0x6302, 0xB9D2, - 0x6303, 0x9294, 0x6304, 0x9295, 0x6305, 0x9296, 0x6306, 0x9297, - 0x6307, 0xD6B8, 0x6308, 0xEAFC, 0x6309, 0xB0B4, 0x630A, 0x9298, - 0x630B, 0x9299, 0x630C, 0x929A, 0x630D, 0x929B, 0x630E, 0xBFE6, - 0x630F, 0x929C, 0x6310, 0x929D, 0x6311, 0xCCF4, 0x6312, 0x929E, - 0x6313, 0x929F, 0x6314, 0x92A0, 0x6315, 0x92A1, 0x6316, 0xCDDA, - 0x6317, 0x92A2, 0x6318, 0x92A3, 0x6319, 0x92A4, 0x631A, 0xD6BF, - 0x631B, 0xC2CE, 0x631C, 0x92A5, 0x631D, 0xCECE, 0x631E, 0xCCA2, - 0x631F, 0xD0AE, 0x6320, 0xC4D3, 0x6321, 0xB5B2, 0x6322, 0xDED8, - 0x6323, 0xD5F5, 0x6324, 0xBCB7, 0x6325, 0xBBD3, 0x6326, 0x92A6, - 0x6327, 0x92A7, 0x6328, 0xB0A4, 0x6329, 0x92A8, 0x632A, 0xC5B2, - 0x632B, 0xB4EC, 0x632C, 0x92A9, 0x632D, 0x92AA, 0x632E, 0x92AB, - 0x632F, 0xD5F1, 0x6330, 0x92AC, 0x6331, 0x92AD, 0x6332, 0xEAFD, - 0x6333, 0x92AE, 0x6334, 0x92AF, 0x6335, 0x92B0, 0x6336, 0x92B1, - 0x6337, 0x92B2, 0x6338, 0x92B3, 0x6339, 0xDEDA, 0x633A, 0xCDA6, - 0x633B, 0x92B4, 0x633C, 0x92B5, 0x633D, 0xCDEC, 0x633E, 0x92B6, - 0x633F, 0x92B7, 0x6340, 0x92B8, 0x6341, 0x92B9, 0x6342, 0xCEE6, - 0x6343, 0xDEDC, 0x6344, 0x92BA, 0x6345, 0xCDB1, 0x6346, 0xC0A6, - 0x6347, 0x92BB, 0x6348, 0x92BC, 0x6349, 0xD7BD, 0x634A, 0x92BD, - 0x634B, 0xDEDB, 0x634C, 0xB0C6, 0x634D, 0xBAB4, 0x634E, 0xC9D3, - 0x634F, 0xC4F3, 0x6350, 0xBEE8, 0x6351, 0x92BE, 0x6352, 0x92BF, - 0x6353, 0x92C0, 0x6354, 0x92C1, 0x6355, 0xB2B6, 0x6356, 0x92C2, - 0x6357, 0x92C3, 0x6358, 0x92C4, 0x6359, 0x92C5, 0x635A, 0x92C6, - 0x635B, 0x92C7, 0x635C, 0x92C8, 0x635D, 0x92C9, 0x635E, 0xC0CC, - 0x635F, 0xCBF0, 0x6360, 0x92CA, 0x6361, 0xBCF1, 0x6362, 0xBBBB, - 0x6363, 0xB5B7, 0x6364, 0x92CB, 0x6365, 0x92CC, 0x6366, 0x92CD, - 0x6367, 0xC5F5, 0x6368, 0x92CE, 0x6369, 0xDEE6, 0x636A, 0x92CF, - 0x636B, 0x92D0, 0x636C, 0x92D1, 0x636D, 0xDEE3, 0x636E, 0xBEDD, - 0x636F, 0x92D2, 0x6370, 0x92D3, 0x6371, 0xDEDF, 0x6372, 0x92D4, - 0x6373, 0x92D5, 0x6374, 0x92D6, 0x6375, 0x92D7, 0x6376, 0xB4B7, - 0x6377, 0xBDDD, 0x6378, 0x92D8, 0x6379, 0x92D9, 0x637A, 0xDEE0, - 0x637B, 0xC4ED, 0x637C, 0x92DA, 0x637D, 0x92DB, 0x637E, 0x92DC, - 0x637F, 0x92DD, 0x6380, 0xCFC6, 0x6381, 0x92DE, 0x6382, 0xB5E0, - 0x6383, 0x92DF, 0x6384, 0x92E0, 0x6385, 0x92E1, 0x6386, 0x92E2, - 0x6387, 0xB6DE, 0x6388, 0xCADA, 0x6389, 0xB5F4, 0x638A, 0xDEE5, - 0x638B, 0x92E3, 0x638C, 0xD5C6, 0x638D, 0x92E4, 0x638E, 0xDEE1, - 0x638F, 0xCCCD, 0x6390, 0xC6FE, 0x6391, 0x92E5, 0x6392, 0xC5C5, - 0x6393, 0x92E6, 0x6394, 0x92E7, 0x6395, 0x92E8, 0x6396, 0xD2B4, - 0x6397, 0x92E9, 0x6398, 0xBEF2, 0x6399, 0x92EA, 0x639A, 0x92EB, - 0x639B, 0x92EC, 0x639C, 0x92ED, 0x639D, 0x92EE, 0x639E, 0x92EF, - 0x639F, 0x92F0, 0x63A0, 0xC2D3, 0x63A1, 0x92F1, 0x63A2, 0xCCBD, - 0x63A3, 0xB3B8, 0x63A4, 0x92F2, 0x63A5, 0xBDD3, 0x63A6, 0x92F3, - 0x63A7, 0xBFD8, 0x63A8, 0xCDC6, 0x63A9, 0xD1DA, 0x63AA, 0xB4EB, - 0x63AB, 0x92F4, 0x63AC, 0xDEE4, 0x63AD, 0xDEDD, 0x63AE, 0xDEE7, - 0x63AF, 0x92F5, 0x63B0, 0xEAFE, 0x63B1, 0x92F6, 0x63B2, 0x92F7, - 0x63B3, 0xC2B0, 0x63B4, 0xDEE2, 0x63B5, 0x92F8, 0x63B6, 0x92F9, - 0x63B7, 0xD6C0, 0x63B8, 0xB5A7, 0x63B9, 0x92FA, 0x63BA, 0xB2F4, - 0x63BB, 0x92FB, 0x63BC, 0xDEE8, 0x63BD, 0x92FC, 0x63BE, 0xDEF2, - 0x63BF, 0x92FD, 0x63C0, 0x92FE, 0x63C1, 0x9340, 0x63C2, 0x9341, - 0x63C3, 0x9342, 0x63C4, 0xDEED, 0x63C5, 0x9343, 0x63C6, 0xDEF1, - 0x63C7, 0x9344, 0x63C8, 0x9345, 0x63C9, 0xC8E0, 0x63CA, 0x9346, - 0x63CB, 0x9347, 0x63CC, 0x9348, 0x63CD, 0xD7E1, 0x63CE, 0xDEEF, - 0x63CF, 0xC3E8, 0x63D0, 0xCCE1, 0x63D1, 0x9349, 0x63D2, 0xB2E5, - 0x63D3, 0x934A, 0x63D4, 0x934B, 0x63D5, 0x934C, 0x63D6, 0xD2BE, - 0x63D7, 0x934D, 0x63D8, 0x934E, 0x63D9, 0x934F, 0x63DA, 0x9350, - 0x63DB, 0x9351, 0x63DC, 0x9352, 0x63DD, 0x9353, 0x63DE, 0xDEEE, - 0x63DF, 0x9354, 0x63E0, 0xDEEB, 0x63E1, 0xCED5, 0x63E2, 0x9355, - 0x63E3, 0xB4A7, 0x63E4, 0x9356, 0x63E5, 0x9357, 0x63E6, 0x9358, - 0x63E7, 0x9359, 0x63E8, 0x935A, 0x63E9, 0xBFAB, 0x63EA, 0xBEBE, - 0x63EB, 0x935B, 0x63EC, 0x935C, 0x63ED, 0xBDD2, 0x63EE, 0x935D, - 0x63EF, 0x935E, 0x63F0, 0x935F, 0x63F1, 0x9360, 0x63F2, 0xDEE9, - 0x63F3, 0x9361, 0x63F4, 0xD4AE, 0x63F5, 0x9362, 0x63F6, 0xDEDE, - 0x63F7, 0x9363, 0x63F8, 0xDEEA, 0x63F9, 0x9364, 0x63FA, 0x9365, - 0x63FB, 0x9366, 0x63FC, 0x9367, 0x63FD, 0xC0BF, 0x63FE, 0x9368, - 0x63FF, 0xDEEC, 0x6400, 0xB2F3, 0x6401, 0xB8E9, 0x6402, 0xC2A7, - 0x6403, 0x9369, 0x6404, 0x936A, 0x6405, 0xBDC1, 0x6406, 0x936B, - 0x6407, 0x936C, 0x6408, 0x936D, 0x6409, 0x936E, 0x640A, 0x936F, - 0x640B, 0xDEF5, 0x640C, 0xDEF8, 0x640D, 0x9370, 0x640E, 0x9371, - 0x640F, 0xB2AB, 0x6410, 0xB4A4, 0x6411, 0x9372, 0x6412, 0x9373, - 0x6413, 0xB4EA, 0x6414, 0xC9A6, 0x6415, 0x9374, 0x6416, 0x9375, - 0x6417, 0x9376, 0x6418, 0x9377, 0x6419, 0x9378, 0x641A, 0x9379, - 0x641B, 0xDEF6, 0x641C, 0xCBD1, 0x641D, 0x937A, 0x641E, 0xB8E3, - 0x641F, 0x937B, 0x6420, 0xDEF7, 0x6421, 0xDEFA, 0x6422, 0x937C, - 0x6423, 0x937D, 0x6424, 0x937E, 0x6425, 0x9380, 0x6426, 0xDEF9, - 0x6427, 0x9381, 0x6428, 0x9382, 0x6429, 0x9383, 0x642A, 0xCCC2, - 0x642B, 0x9384, 0x642C, 0xB0E1, 0x642D, 0xB4EE, 0x642E, 0x9385, - 0x642F, 0x9386, 0x6430, 0x9387, 0x6431, 0x9388, 0x6432, 0x9389, - 0x6433, 0x938A, 0x6434, 0xE5BA, 0x6435, 0x938B, 0x6436, 0x938C, - 0x6437, 0x938D, 0x6438, 0x938E, 0x6439, 0x938F, 0x643A, 0xD0AF, - 0x643B, 0x9390, 0x643C, 0x9391, 0x643D, 0xB2EB, 0x643E, 0x9392, - 0x643F, 0xEBA1, 0x6440, 0x9393, 0x6441, 0xDEF4, 0x6442, 0x9394, - 0x6443, 0x9395, 0x6444, 0xC9E3, 0x6445, 0xDEF3, 0x6446, 0xB0DA, - 0x6447, 0xD2A1, 0x6448, 0xB1F7, 0x6449, 0x9396, 0x644A, 0xCCAF, - 0x644B, 0x9397, 0x644C, 0x9398, 0x644D, 0x9399, 0x644E, 0x939A, - 0x644F, 0x939B, 0x6450, 0x939C, 0x6451, 0x939D, 0x6452, 0xDEF0, - 0x6453, 0x939E, 0x6454, 0xCBA4, 0x6455, 0x939F, 0x6456, 0x93A0, - 0x6457, 0x93A1, 0x6458, 0xD5AA, 0x6459, 0x93A2, 0x645A, 0x93A3, - 0x645B, 0x93A4, 0x645C, 0x93A5, 0x645D, 0x93A6, 0x645E, 0xDEFB, - 0x645F, 0x93A7, 0x6460, 0x93A8, 0x6461, 0x93A9, 0x6462, 0x93AA, - 0x6463, 0x93AB, 0x6464, 0x93AC, 0x6465, 0x93AD, 0x6466, 0x93AE, - 0x6467, 0xB4DD, 0x6468, 0x93AF, 0x6469, 0xC4A6, 0x646A, 0x93B0, - 0x646B, 0x93B1, 0x646C, 0x93B2, 0x646D, 0xDEFD, 0x646E, 0x93B3, - 0x646F, 0x93B4, 0x6470, 0x93B5, 0x6471, 0x93B6, 0x6472, 0x93B7, - 0x6473, 0x93B8, 0x6474, 0x93B9, 0x6475, 0x93BA, 0x6476, 0x93BB, - 0x6477, 0x93BC, 0x6478, 0xC3FE, 0x6479, 0xC4A1, 0x647A, 0xDFA1, - 0x647B, 0x93BD, 0x647C, 0x93BE, 0x647D, 0x93BF, 0x647E, 0x93C0, - 0x647F, 0x93C1, 0x6480, 0x93C2, 0x6481, 0x93C3, 0x6482, 0xC1CC, - 0x6483, 0x93C4, 0x6484, 0xDEFC, 0x6485, 0xBEEF, 0x6486, 0x93C5, - 0x6487, 0xC6B2, 0x6488, 0x93C6, 0x6489, 0x93C7, 0x648A, 0x93C8, - 0x648B, 0x93C9, 0x648C, 0x93CA, 0x648D, 0x93CB, 0x648E, 0x93CC, - 0x648F, 0x93CD, 0x6490, 0x93CE, 0x6491, 0xB3C5, 0x6492, 0xC8F6, - 0x6493, 0x93CF, 0x6494, 0x93D0, 0x6495, 0xCBBA, 0x6496, 0xDEFE, - 0x6497, 0x93D1, 0x6498, 0x93D2, 0x6499, 0xDFA4, 0x649A, 0x93D3, - 0x649B, 0x93D4, 0x649C, 0x93D5, 0x649D, 0x93D6, 0x649E, 0xD7B2, - 0x649F, 0x93D7, 0x64A0, 0x93D8, 0x64A1, 0x93D9, 0x64A2, 0x93DA, - 0x64A3, 0x93DB, 0x64A4, 0xB3B7, 0x64A5, 0x93DC, 0x64A6, 0x93DD, - 0x64A7, 0x93DE, 0x64A8, 0x93DF, 0x64A9, 0xC1C3, 0x64AA, 0x93E0, - 0x64AB, 0x93E1, 0x64AC, 0xC7CB, 0x64AD, 0xB2A5, 0x64AE, 0xB4E9, - 0x64AF, 0x93E2, 0x64B0, 0xD7AB, 0x64B1, 0x93E3, 0x64B2, 0x93E4, - 0x64B3, 0x93E5, 0x64B4, 0x93E6, 0x64B5, 0xC4EC, 0x64B6, 0x93E7, - 0x64B7, 0xDFA2, 0x64B8, 0xDFA3, 0x64B9, 0x93E8, 0x64BA, 0xDFA5, - 0x64BB, 0x93E9, 0x64BC, 0xBAB3, 0x64BD, 0x93EA, 0x64BE, 0x93EB, - 0x64BF, 0x93EC, 0x64C0, 0xDFA6, 0x64C1, 0x93ED, 0x64C2, 0xC0DE, - 0x64C3, 0x93EE, 0x64C4, 0x93EF, 0x64C5, 0xC9C3, 0x64C6, 0x93F0, - 0x64C7, 0x93F1, 0x64C8, 0x93F2, 0x64C9, 0x93F3, 0x64CA, 0x93F4, - 0x64CB, 0x93F5, 0x64CC, 0x93F6, 0x64CD, 0xB2D9, 0x64CE, 0xC7E6, - 0x64CF, 0x93F7, 0x64D0, 0xDFA7, 0x64D1, 0x93F8, 0x64D2, 0xC7DC, - 0x64D3, 0x93F9, 0x64D4, 0x93FA, 0x64D5, 0x93FB, 0x64D6, 0x93FC, - 0x64D7, 0xDFA8, 0x64D8, 0xEBA2, 0x64D9, 0x93FD, 0x64DA, 0x93FE, - 0x64DB, 0x9440, 0x64DC, 0x9441, 0x64DD, 0x9442, 0x64DE, 0xCBD3, - 0x64DF, 0x9443, 0x64E0, 0x9444, 0x64E1, 0x9445, 0x64E2, 0xDFAA, - 0x64E3, 0x9446, 0x64E4, 0xDFA9, 0x64E5, 0x9447, 0x64E6, 0xB2C1, - 0x64E7, 0x9448, 0x64E8, 0x9449, 0x64E9, 0x944A, 0x64EA, 0x944B, - 0x64EB, 0x944C, 0x64EC, 0x944D, 0x64ED, 0x944E, 0x64EE, 0x944F, - 0x64EF, 0x9450, 0x64F0, 0x9451, 0x64F1, 0x9452, 0x64F2, 0x9453, - 0x64F3, 0x9454, 0x64F4, 0x9455, 0x64F5, 0x9456, 0x64F6, 0x9457, - 0x64F7, 0x9458, 0x64F8, 0x9459, 0x64F9, 0x945A, 0x64FA, 0x945B, - 0x64FB, 0x945C, 0x64FC, 0x945D, 0x64FD, 0x945E, 0x64FE, 0x945F, - 0x64FF, 0x9460, 0x6500, 0xC5CA, 0x6501, 0x9461, 0x6502, 0x9462, - 0x6503, 0x9463, 0x6504, 0x9464, 0x6505, 0x9465, 0x6506, 0x9466, - 0x6507, 0x9467, 0x6508, 0x9468, 0x6509, 0xDFAB, 0x650A, 0x9469, - 0x650B, 0x946A, 0x650C, 0x946B, 0x650D, 0x946C, 0x650E, 0x946D, - 0x650F, 0x946E, 0x6510, 0x946F, 0x6511, 0x9470, 0x6512, 0xD4DC, - 0x6513, 0x9471, 0x6514, 0x9472, 0x6515, 0x9473, 0x6516, 0x9474, - 0x6517, 0x9475, 0x6518, 0xC8C1, 0x6519, 0x9476, 0x651A, 0x9477, - 0x651B, 0x9478, 0x651C, 0x9479, 0x651D, 0x947A, 0x651E, 0x947B, - 0x651F, 0x947C, 0x6520, 0x947D, 0x6521, 0x947E, 0x6522, 0x9480, - 0x6523, 0x9481, 0x6524, 0x9482, 0x6525, 0xDFAC, 0x6526, 0x9483, - 0x6527, 0x9484, 0x6528, 0x9485, 0x6529, 0x9486, 0x652A, 0x9487, - 0x652B, 0xBEF0, 0x652C, 0x9488, 0x652D, 0x9489, 0x652E, 0xDFAD, - 0x652F, 0xD6A7, 0x6530, 0x948A, 0x6531, 0x948B, 0x6532, 0x948C, - 0x6533, 0x948D, 0x6534, 0xEAB7, 0x6535, 0xEBB6, 0x6536, 0xCAD5, - 0x6537, 0x948E, 0x6538, 0xD8FC, 0x6539, 0xB8C4, 0x653A, 0x948F, - 0x653B, 0xB9A5, 0x653C, 0x9490, 0x653D, 0x9491, 0x653E, 0xB7C5, - 0x653F, 0xD5FE, 0x6540, 0x9492, 0x6541, 0x9493, 0x6542, 0x9494, - 0x6543, 0x9495, 0x6544, 0x9496, 0x6545, 0xB9CA, 0x6546, 0x9497, - 0x6547, 0x9498, 0x6548, 0xD0A7, 0x6549, 0xF4CD, 0x654A, 0x9499, - 0x654B, 0x949A, 0x654C, 0xB5D0, 0x654D, 0x949B, 0x654E, 0x949C, - 0x654F, 0xC3F4, 0x6550, 0x949D, 0x6551, 0xBEC8, 0x6552, 0x949E, - 0x6553, 0x949F, 0x6554, 0x94A0, 0x6555, 0xEBB7, 0x6556, 0xB0BD, - 0x6557, 0x94A1, 0x6558, 0x94A2, 0x6559, 0xBDCC, 0x655A, 0x94A3, - 0x655B, 0xC1B2, 0x655C, 0x94A4, 0x655D, 0xB1D6, 0x655E, 0xB3A8, - 0x655F, 0x94A5, 0x6560, 0x94A6, 0x6561, 0x94A7, 0x6562, 0xB8D2, - 0x6563, 0xC9A2, 0x6564, 0x94A8, 0x6565, 0x94A9, 0x6566, 0xB6D8, - 0x6567, 0x94AA, 0x6568, 0x94AB, 0x6569, 0x94AC, 0x656A, 0x94AD, - 0x656B, 0xEBB8, 0x656C, 0xBEB4, 0x656D, 0x94AE, 0x656E, 0x94AF, - 0x656F, 0x94B0, 0x6570, 0xCAFD, 0x6571, 0x94B1, 0x6572, 0xC7C3, - 0x6573, 0x94B2, 0x6574, 0xD5FB, 0x6575, 0x94B3, 0x6576, 0x94B4, - 0x6577, 0xB7F3, 0x6578, 0x94B5, 0x6579, 0x94B6, 0x657A, 0x94B7, - 0x657B, 0x94B8, 0x657C, 0x94B9, 0x657D, 0x94BA, 0x657E, 0x94BB, - 0x657F, 0x94BC, 0x6580, 0x94BD, 0x6581, 0x94BE, 0x6582, 0x94BF, - 0x6583, 0x94C0, 0x6584, 0x94C1, 0x6585, 0x94C2, 0x6586, 0x94C3, - 0x6587, 0xCEC4, 0x6588, 0x94C4, 0x6589, 0x94C5, 0x658A, 0x94C6, - 0x658B, 0xD5AB, 0x658C, 0xB1F3, 0x658D, 0x94C7, 0x658E, 0x94C8, - 0x658F, 0x94C9, 0x6590, 0xECB3, 0x6591, 0xB0DF, 0x6592, 0x94CA, - 0x6593, 0xECB5, 0x6594, 0x94CB, 0x6595, 0x94CC, 0x6596, 0x94CD, - 0x6597, 0xB6B7, 0x6598, 0x94CE, 0x6599, 0xC1CF, 0x659A, 0x94CF, - 0x659B, 0xF5FA, 0x659C, 0xD0B1, 0x659D, 0x94D0, 0x659E, 0x94D1, - 0x659F, 0xD5E5, 0x65A0, 0x94D2, 0x65A1, 0xCED3, 0x65A2, 0x94D3, - 0x65A3, 0x94D4, 0x65A4, 0xBDEF, 0x65A5, 0xB3E2, 0x65A6, 0x94D5, - 0x65A7, 0xB8AB, 0x65A8, 0x94D6, 0x65A9, 0xD5B6, 0x65AA, 0x94D7, - 0x65AB, 0xEDBD, 0x65AC, 0x94D8, 0x65AD, 0xB6CF, 0x65AE, 0x94D9, - 0x65AF, 0xCBB9, 0x65B0, 0xD0C2, 0x65B1, 0x94DA, 0x65B2, 0x94DB, - 0x65B3, 0x94DC, 0x65B4, 0x94DD, 0x65B5, 0x94DE, 0x65B6, 0x94DF, - 0x65B7, 0x94E0, 0x65B8, 0x94E1, 0x65B9, 0xB7BD, 0x65BA, 0x94E2, - 0x65BB, 0x94E3, 0x65BC, 0xECB6, 0x65BD, 0xCAA9, 0x65BE, 0x94E4, - 0x65BF, 0x94E5, 0x65C0, 0x94E6, 0x65C1, 0xC5D4, 0x65C2, 0x94E7, - 0x65C3, 0xECB9, 0x65C4, 0xECB8, 0x65C5, 0xC2C3, 0x65C6, 0xECB7, - 0x65C7, 0x94E8, 0x65C8, 0x94E9, 0x65C9, 0x94EA, 0x65CA, 0x94EB, - 0x65CB, 0xD0FD, 0x65CC, 0xECBA, 0x65CD, 0x94EC, 0x65CE, 0xECBB, - 0x65CF, 0xD7E5, 0x65D0, 0x94ED, 0x65D1, 0x94EE, 0x65D2, 0xECBC, - 0x65D3, 0x94EF, 0x65D4, 0x94F0, 0x65D5, 0x94F1, 0x65D6, 0xECBD, - 0x65D7, 0xC6EC, 0x65D8, 0x94F2, 0x65D9, 0x94F3, 0x65DA, 0x94F4, - 0x65DB, 0x94F5, 0x65DC, 0x94F6, 0x65DD, 0x94F7, 0x65DE, 0x94F8, - 0x65DF, 0x94F9, 0x65E0, 0xCEDE, 0x65E1, 0x94FA, 0x65E2, 0xBCC8, - 0x65E3, 0x94FB, 0x65E4, 0x94FC, 0x65E5, 0xC8D5, 0x65E6, 0xB5A9, - 0x65E7, 0xBEC9, 0x65E8, 0xD6BC, 0x65E9, 0xD4E7, 0x65EA, 0x94FD, - 0x65EB, 0x94FE, 0x65EC, 0xD1AE, 0x65ED, 0xD0F1, 0x65EE, 0xEAB8, - 0x65EF, 0xEAB9, 0x65F0, 0xEABA, 0x65F1, 0xBAB5, 0x65F2, 0x9540, - 0x65F3, 0x9541, 0x65F4, 0x9542, 0x65F5, 0x9543, 0x65F6, 0xCAB1, - 0x65F7, 0xBFF5, 0x65F8, 0x9544, 0x65F9, 0x9545, 0x65FA, 0xCDFA, - 0x65FB, 0x9546, 0x65FC, 0x9547, 0x65FD, 0x9548, 0x65FE, 0x9549, - 0x65FF, 0x954A, 0x6600, 0xEAC0, 0x6601, 0x954B, 0x6602, 0xB0BA, - 0x6603, 0xEABE, 0x6604, 0x954C, 0x6605, 0x954D, 0x6606, 0xC0A5, - 0x6607, 0x954E, 0x6608, 0x954F, 0x6609, 0x9550, 0x660A, 0xEABB, - 0x660B, 0x9551, 0x660C, 0xB2FD, 0x660D, 0x9552, 0x660E, 0xC3F7, - 0x660F, 0xBBE8, 0x6610, 0x9553, 0x6611, 0x9554, 0x6612, 0x9555, - 0x6613, 0xD2D7, 0x6614, 0xCEF4, 0x6615, 0xEABF, 0x6616, 0x9556, - 0x6617, 0x9557, 0x6618, 0x9558, 0x6619, 0xEABC, 0x661A, 0x9559, - 0x661B, 0x955A, 0x661C, 0x955B, 0x661D, 0xEAC3, 0x661E, 0x955C, - 0x661F, 0xD0C7, 0x6620, 0xD3B3, 0x6621, 0x955D, 0x6622, 0x955E, - 0x6623, 0x955F, 0x6624, 0x9560, 0x6625, 0xB4BA, 0x6626, 0x9561, - 0x6627, 0xC3C1, 0x6628, 0xD7F2, 0x6629, 0x9562, 0x662A, 0x9563, - 0x662B, 0x9564, 0x662C, 0x9565, 0x662D, 0xD5D1, 0x662E, 0x9566, - 0x662F, 0xCAC7, 0x6630, 0x9567, 0x6631, 0xEAC5, 0x6632, 0x9568, - 0x6633, 0x9569, 0x6634, 0xEAC4, 0x6635, 0xEAC7, 0x6636, 0xEAC6, - 0x6637, 0x956A, 0x6638, 0x956B, 0x6639, 0x956C, 0x663A, 0x956D, - 0x663B, 0x956E, 0x663C, 0xD6E7, 0x663D, 0x956F, 0x663E, 0xCFD4, - 0x663F, 0x9570, 0x6640, 0x9571, 0x6641, 0xEACB, 0x6642, 0x9572, - 0x6643, 0xBBCE, 0x6644, 0x9573, 0x6645, 0x9574, 0x6646, 0x9575, - 0x6647, 0x9576, 0x6648, 0x9577, 0x6649, 0x9578, 0x664A, 0x9579, - 0x664B, 0xBDFA, 0x664C, 0xC9CE, 0x664D, 0x957A, 0x664E, 0x957B, - 0x664F, 0xEACC, 0x6650, 0x957C, 0x6651, 0x957D, 0x6652, 0xC9B9, - 0x6653, 0xCFFE, 0x6654, 0xEACA, 0x6655, 0xD4CE, 0x6656, 0xEACD, - 0x6657, 0xEACF, 0x6658, 0x957E, 0x6659, 0x9580, 0x665A, 0xCDED, - 0x665B, 0x9581, 0x665C, 0x9582, 0x665D, 0x9583, 0x665E, 0x9584, - 0x665F, 0xEAC9, 0x6660, 0x9585, 0x6661, 0xEACE, 0x6662, 0x9586, - 0x6663, 0x9587, 0x6664, 0xCEEE, 0x6665, 0x9588, 0x6666, 0xBBDE, - 0x6667, 0x9589, 0x6668, 0xB3BF, 0x6669, 0x958A, 0x666A, 0x958B, - 0x666B, 0x958C, 0x666C, 0x958D, 0x666D, 0x958E, 0x666E, 0xC6D5, - 0x666F, 0xBEB0, 0x6670, 0xCEFA, 0x6671, 0x958F, 0x6672, 0x9590, - 0x6673, 0x9591, 0x6674, 0xC7E7, 0x6675, 0x9592, 0x6676, 0xBEA7, - 0x6677, 0xEAD0, 0x6678, 0x9593, 0x6679, 0x9594, 0x667A, 0xD6C7, - 0x667B, 0x9595, 0x667C, 0x9596, 0x667D, 0x9597, 0x667E, 0xC1C0, - 0x667F, 0x9598, 0x6680, 0x9599, 0x6681, 0x959A, 0x6682, 0xD4DD, - 0x6683, 0x959B, 0x6684, 0xEAD1, 0x6685, 0x959C, 0x6686, 0x959D, - 0x6687, 0xCFBE, 0x6688, 0x959E, 0x6689, 0x959F, 0x668A, 0x95A0, - 0x668B, 0x95A1, 0x668C, 0xEAD2, 0x668D, 0x95A2, 0x668E, 0x95A3, - 0x668F, 0x95A4, 0x6690, 0x95A5, 0x6691, 0xCAEE, 0x6692, 0x95A6, - 0x6693, 0x95A7, 0x6694, 0x95A8, 0x6695, 0x95A9, 0x6696, 0xC5AF, - 0x6697, 0xB0B5, 0x6698, 0x95AA, 0x6699, 0x95AB, 0x669A, 0x95AC, - 0x669B, 0x95AD, 0x669C, 0x95AE, 0x669D, 0xEAD4, 0x669E, 0x95AF, - 0x669F, 0x95B0, 0x66A0, 0x95B1, 0x66A1, 0x95B2, 0x66A2, 0x95B3, - 0x66A3, 0x95B4, 0x66A4, 0x95B5, 0x66A5, 0x95B6, 0x66A6, 0x95B7, - 0x66A7, 0xEAD3, 0x66A8, 0xF4DF, 0x66A9, 0x95B8, 0x66AA, 0x95B9, - 0x66AB, 0x95BA, 0x66AC, 0x95BB, 0x66AD, 0x95BC, 0x66AE, 0xC4BA, - 0x66AF, 0x95BD, 0x66B0, 0x95BE, 0x66B1, 0x95BF, 0x66B2, 0x95C0, - 0x66B3, 0x95C1, 0x66B4, 0xB1A9, 0x66B5, 0x95C2, 0x66B6, 0x95C3, - 0x66B7, 0x95C4, 0x66B8, 0x95C5, 0x66B9, 0xE5DF, 0x66BA, 0x95C6, - 0x66BB, 0x95C7, 0x66BC, 0x95C8, 0x66BD, 0x95C9, 0x66BE, 0xEAD5, - 0x66BF, 0x95CA, 0x66C0, 0x95CB, 0x66C1, 0x95CC, 0x66C2, 0x95CD, - 0x66C3, 0x95CE, 0x66C4, 0x95CF, 0x66C5, 0x95D0, 0x66C6, 0x95D1, - 0x66C7, 0x95D2, 0x66C8, 0x95D3, 0x66C9, 0x95D4, 0x66CA, 0x95D5, - 0x66CB, 0x95D6, 0x66CC, 0x95D7, 0x66CD, 0x95D8, 0x66CE, 0x95D9, - 0x66CF, 0x95DA, 0x66D0, 0x95DB, 0x66D1, 0x95DC, 0x66D2, 0x95DD, - 0x66D3, 0x95DE, 0x66D4, 0x95DF, 0x66D5, 0x95E0, 0x66D6, 0x95E1, - 0x66D7, 0x95E2, 0x66D8, 0x95E3, 0x66D9, 0xCAEF, 0x66DA, 0x95E4, - 0x66DB, 0xEAD6, 0x66DC, 0xEAD7, 0x66DD, 0xC6D8, 0x66DE, 0x95E5, - 0x66DF, 0x95E6, 0x66E0, 0x95E7, 0x66E1, 0x95E8, 0x66E2, 0x95E9, - 0x66E3, 0x95EA, 0x66E4, 0x95EB, 0x66E5, 0x95EC, 0x66E6, 0xEAD8, - 0x66E7, 0x95ED, 0x66E8, 0x95EE, 0x66E9, 0xEAD9, 0x66EA, 0x95EF, - 0x66EB, 0x95F0, 0x66EC, 0x95F1, 0x66ED, 0x95F2, 0x66EE, 0x95F3, - 0x66EF, 0x95F4, 0x66F0, 0xD4BB, 0x66F1, 0x95F5, 0x66F2, 0xC7FA, - 0x66F3, 0xD2B7, 0x66F4, 0xB8FC, 0x66F5, 0x95F6, 0x66F6, 0x95F7, - 0x66F7, 0xEAC2, 0x66F8, 0x95F8, 0x66F9, 0xB2DC, 0x66FA, 0x95F9, - 0x66FB, 0x95FA, 0x66FC, 0xC2FC, 0x66FD, 0x95FB, 0x66FE, 0xD4F8, - 0x66FF, 0xCCE6, 0x6700, 0xD7EE, 0x6701, 0x95FC, 0x6702, 0x95FD, - 0x6703, 0x95FE, 0x6704, 0x9640, 0x6705, 0x9641, 0x6706, 0x9642, - 0x6707, 0x9643, 0x6708, 0xD4C2, 0x6709, 0xD3D0, 0x670A, 0xEBC3, - 0x670B, 0xC5F3, 0x670C, 0x9644, 0x670D, 0xB7FE, 0x670E, 0x9645, - 0x670F, 0x9646, 0x6710, 0xEBD4, 0x6711, 0x9647, 0x6712, 0x9648, - 0x6713, 0x9649, 0x6714, 0xCBB7, 0x6715, 0xEBDE, 0x6716, 0x964A, - 0x6717, 0xC0CA, 0x6718, 0x964B, 0x6719, 0x964C, 0x671A, 0x964D, - 0x671B, 0xCDFB, 0x671C, 0x964E, 0x671D, 0xB3AF, 0x671E, 0x964F, - 0x671F, 0xC6DA, 0x6720, 0x9650, 0x6721, 0x9651, 0x6722, 0x9652, - 0x6723, 0x9653, 0x6724, 0x9654, 0x6725, 0x9655, 0x6726, 0xEBFC, - 0x6727, 0x9656, 0x6728, 0xC4BE, 0x6729, 0x9657, 0x672A, 0xCEB4, - 0x672B, 0xC4A9, 0x672C, 0xB1BE, 0x672D, 0xD4FD, 0x672E, 0x9658, - 0x672F, 0xCAF5, 0x6730, 0x9659, 0x6731, 0xD6EC, 0x6732, 0x965A, - 0x6733, 0x965B, 0x6734, 0xC6D3, 0x6735, 0xB6E4, 0x6736, 0x965C, - 0x6737, 0x965D, 0x6738, 0x965E, 0x6739, 0x965F, 0x673A, 0xBBFA, - 0x673B, 0x9660, 0x673C, 0x9661, 0x673D, 0xD0E0, 0x673E, 0x9662, - 0x673F, 0x9663, 0x6740, 0xC9B1, 0x6741, 0x9664, 0x6742, 0xD4D3, - 0x6743, 0xC8A8, 0x6744, 0x9665, 0x6745, 0x9666, 0x6746, 0xB8CB, - 0x6747, 0x9667, 0x6748, 0xE8BE, 0x6749, 0xC9BC, 0x674A, 0x9668, - 0x674B, 0x9669, 0x674C, 0xE8BB, 0x674D, 0x966A, 0x674E, 0xC0EE, - 0x674F, 0xD0D3, 0x6750, 0xB2C4, 0x6751, 0xB4E5, 0x6752, 0x966B, - 0x6753, 0xE8BC, 0x6754, 0x966C, 0x6755, 0x966D, 0x6756, 0xD5C8, - 0x6757, 0x966E, 0x6758, 0x966F, 0x6759, 0x9670, 0x675A, 0x9671, - 0x675B, 0x9672, 0x675C, 0xB6C5, 0x675D, 0x9673, 0x675E, 0xE8BD, - 0x675F, 0xCAF8, 0x6760, 0xB8DC, 0x6761, 0xCCF5, 0x6762, 0x9674, - 0x6763, 0x9675, 0x6764, 0x9676, 0x6765, 0xC0B4, 0x6766, 0x9677, - 0x6767, 0x9678, 0x6768, 0xD1EE, 0x6769, 0xE8BF, 0x676A, 0xE8C2, - 0x676B, 0x9679, 0x676C, 0x967A, 0x676D, 0xBABC, 0x676E, 0x967B, - 0x676F, 0xB1AD, 0x6770, 0xBDDC, 0x6771, 0x967C, 0x6772, 0xEABD, - 0x6773, 0xE8C3, 0x6774, 0x967D, 0x6775, 0xE8C6, 0x6776, 0x967E, - 0x6777, 0xE8CB, 0x6778, 0x9680, 0x6779, 0x9681, 0x677A, 0x9682, - 0x677B, 0x9683, 0x677C, 0xE8CC, 0x677D, 0x9684, 0x677E, 0xCBC9, - 0x677F, 0xB0E5, 0x6780, 0x9685, 0x6781, 0xBCAB, 0x6782, 0x9686, - 0x6783, 0x9687, 0x6784, 0xB9B9, 0x6785, 0x9688, 0x6786, 0x9689, - 0x6787, 0xE8C1, 0x6788, 0x968A, 0x6789, 0xCDF7, 0x678A, 0x968B, - 0x678B, 0xE8CA, 0x678C, 0x968C, 0x678D, 0x968D, 0x678E, 0x968E, - 0x678F, 0x968F, 0x6790, 0xCEF6, 0x6791, 0x9690, 0x6792, 0x9691, - 0x6793, 0x9692, 0x6794, 0x9693, 0x6795, 0xD5ED, 0x6796, 0x9694, - 0x6797, 0xC1D6, 0x6798, 0xE8C4, 0x6799, 0x9695, 0x679A, 0xC3B6, - 0x679B, 0x9696, 0x679C, 0xB9FB, 0x679D, 0xD6A6, 0x679E, 0xE8C8, - 0x679F, 0x9697, 0x67A0, 0x9698, 0x67A1, 0x9699, 0x67A2, 0xCAE0, - 0x67A3, 0xD4E6, 0x67A4, 0x969A, 0x67A5, 0xE8C0, 0x67A6, 0x969B, - 0x67A7, 0xE8C5, 0x67A8, 0xE8C7, 0x67A9, 0x969C, 0x67AA, 0xC7B9, - 0x67AB, 0xB7E3, 0x67AC, 0x969D, 0x67AD, 0xE8C9, 0x67AE, 0x969E, - 0x67AF, 0xBFDD, 0x67B0, 0xE8D2, 0x67B1, 0x969F, 0x67B2, 0x96A0, - 0x67B3, 0xE8D7, 0x67B4, 0x96A1, 0x67B5, 0xE8D5, 0x67B6, 0xBCDC, - 0x67B7, 0xBCCF, 0x67B8, 0xE8DB, 0x67B9, 0x96A2, 0x67BA, 0x96A3, - 0x67BB, 0x96A4, 0x67BC, 0x96A5, 0x67BD, 0x96A6, 0x67BE, 0x96A7, - 0x67BF, 0x96A8, 0x67C0, 0x96A9, 0x67C1, 0xE8DE, 0x67C2, 0x96AA, - 0x67C3, 0xE8DA, 0x67C4, 0xB1FA, 0x67C5, 0x96AB, 0x67C6, 0x96AC, - 0x67C7, 0x96AD, 0x67C8, 0x96AE, 0x67C9, 0x96AF, 0x67CA, 0x96B0, - 0x67CB, 0x96B1, 0x67CC, 0x96B2, 0x67CD, 0x96B3, 0x67CE, 0x96B4, - 0x67CF, 0xB0D8, 0x67D0, 0xC4B3, 0x67D1, 0xB8CC, 0x67D2, 0xC6E2, - 0x67D3, 0xC8BE, 0x67D4, 0xC8E1, 0x67D5, 0x96B5, 0x67D6, 0x96B6, - 0x67D7, 0x96B7, 0x67D8, 0xE8CF, 0x67D9, 0xE8D4, 0x67DA, 0xE8D6, - 0x67DB, 0x96B8, 0x67DC, 0xB9F1, 0x67DD, 0xE8D8, 0x67DE, 0xD7F5, - 0x67DF, 0x96B9, 0x67E0, 0xC4FB, 0x67E1, 0x96BA, 0x67E2, 0xE8DC, - 0x67E3, 0x96BB, 0x67E4, 0x96BC, 0x67E5, 0xB2E9, 0x67E6, 0x96BD, - 0x67E7, 0x96BE, 0x67E8, 0x96BF, 0x67E9, 0xE8D1, 0x67EA, 0x96C0, - 0x67EB, 0x96C1, 0x67EC, 0xBCED, 0x67ED, 0x96C2, 0x67EE, 0x96C3, - 0x67EF, 0xBFC2, 0x67F0, 0xE8CD, 0x67F1, 0xD6F9, 0x67F2, 0x96C4, - 0x67F3, 0xC1F8, 0x67F4, 0xB2F1, 0x67F5, 0x96C5, 0x67F6, 0x96C6, - 0x67F7, 0x96C7, 0x67F8, 0x96C8, 0x67F9, 0x96C9, 0x67FA, 0x96CA, - 0x67FB, 0x96CB, 0x67FC, 0x96CC, 0x67FD, 0xE8DF, 0x67FE, 0x96CD, - 0x67FF, 0xCAC1, 0x6800, 0xE8D9, 0x6801, 0x96CE, 0x6802, 0x96CF, - 0x6803, 0x96D0, 0x6804, 0x96D1, 0x6805, 0xD5A4, 0x6806, 0x96D2, - 0x6807, 0xB1EA, 0x6808, 0xD5BB, 0x6809, 0xE8CE, 0x680A, 0xE8D0, - 0x680B, 0xB6B0, 0x680C, 0xE8D3, 0x680D, 0x96D3, 0x680E, 0xE8DD, - 0x680F, 0xC0B8, 0x6810, 0x96D4, 0x6811, 0xCAF7, 0x6812, 0x96D5, - 0x6813, 0xCBA8, 0x6814, 0x96D6, 0x6815, 0x96D7, 0x6816, 0xC6DC, - 0x6817, 0xC0F5, 0x6818, 0x96D8, 0x6819, 0x96D9, 0x681A, 0x96DA, - 0x681B, 0x96DB, 0x681C, 0x96DC, 0x681D, 0xE8E9, 0x681E, 0x96DD, - 0x681F, 0x96DE, 0x6820, 0x96DF, 0x6821, 0xD0A3, 0x6822, 0x96E0, - 0x6823, 0x96E1, 0x6824, 0x96E2, 0x6825, 0x96E3, 0x6826, 0x96E4, - 0x6827, 0x96E5, 0x6828, 0x96E6, 0x6829, 0xE8F2, 0x682A, 0xD6EA, - 0x682B, 0x96E7, 0x682C, 0x96E8, 0x682D, 0x96E9, 0x682E, 0x96EA, - 0x682F, 0x96EB, 0x6830, 0x96EC, 0x6831, 0x96ED, 0x6832, 0xE8E0, - 0x6833, 0xE8E1, 0x6834, 0x96EE, 0x6835, 0x96EF, 0x6836, 0x96F0, - 0x6837, 0xD1F9, 0x6838, 0xBACB, 0x6839, 0xB8F9, 0x683A, 0x96F1, - 0x683B, 0x96F2, 0x683C, 0xB8F1, 0x683D, 0xD4D4, 0x683E, 0xE8EF, - 0x683F, 0x96F3, 0x6840, 0xE8EE, 0x6841, 0xE8EC, 0x6842, 0xB9F0, - 0x6843, 0xCCD2, 0x6844, 0xE8E6, 0x6845, 0xCEA6, 0x6846, 0xBFF2, - 0x6847, 0x96F4, 0x6848, 0xB0B8, 0x6849, 0xE8F1, 0x684A, 0xE8F0, - 0x684B, 0x96F5, 0x684C, 0xD7C0, 0x684D, 0x96F6, 0x684E, 0xE8E4, - 0x684F, 0x96F7, 0x6850, 0xCDA9, 0x6851, 0xC9A3, 0x6852, 0x96F8, - 0x6853, 0xBBB8, 0x6854, 0xBDDB, 0x6855, 0xE8EA, 0x6856, 0x96F9, - 0x6857, 0x96FA, 0x6858, 0x96FB, 0x6859, 0x96FC, 0x685A, 0x96FD, - 0x685B, 0x96FE, 0x685C, 0x9740, 0x685D, 0x9741, 0x685E, 0x9742, - 0x685F, 0x9743, 0x6860, 0xE8E2, 0x6861, 0xE8E3, 0x6862, 0xE8E5, - 0x6863, 0xB5B5, 0x6864, 0xE8E7, 0x6865, 0xC7C5, 0x6866, 0xE8EB, - 0x6867, 0xE8ED, 0x6868, 0xBDB0, 0x6869, 0xD7AE, 0x686A, 0x9744, - 0x686B, 0xE8F8, 0x686C, 0x9745, 0x686D, 0x9746, 0x686E, 0x9747, - 0x686F, 0x9748, 0x6870, 0x9749, 0x6871, 0x974A, 0x6872, 0x974B, - 0x6873, 0x974C, 0x6874, 0xE8F5, 0x6875, 0x974D, 0x6876, 0xCDB0, - 0x6877, 0xE8F6, 0x6878, 0x974E, 0x6879, 0x974F, 0x687A, 0x9750, - 0x687B, 0x9751, 0x687C, 0x9752, 0x687D, 0x9753, 0x687E, 0x9754, - 0x687F, 0x9755, 0x6880, 0x9756, 0x6881, 0xC1BA, 0x6882, 0x9757, - 0x6883, 0xE8E8, 0x6884, 0x9758, 0x6885, 0xC3B7, 0x6886, 0xB0F0, - 0x6887, 0x9759, 0x6888, 0x975A, 0x6889, 0x975B, 0x688A, 0x975C, - 0x688B, 0x975D, 0x688C, 0x975E, 0x688D, 0x975F, 0x688E, 0x9760, - 0x688F, 0xE8F4, 0x6890, 0x9761, 0x6891, 0x9762, 0x6892, 0x9763, - 0x6893, 0xE8F7, 0x6894, 0x9764, 0x6895, 0x9765, 0x6896, 0x9766, - 0x6897, 0xB9A3, 0x6898, 0x9767, 0x6899, 0x9768, 0x689A, 0x9769, - 0x689B, 0x976A, 0x689C, 0x976B, 0x689D, 0x976C, 0x689E, 0x976D, - 0x689F, 0x976E, 0x68A0, 0x976F, 0x68A1, 0x9770, 0x68A2, 0xC9D2, - 0x68A3, 0x9771, 0x68A4, 0x9772, 0x68A5, 0x9773, 0x68A6, 0xC3CE, - 0x68A7, 0xCEE0, 0x68A8, 0xC0E6, 0x68A9, 0x9774, 0x68AA, 0x9775, - 0x68AB, 0x9776, 0x68AC, 0x9777, 0x68AD, 0xCBF3, 0x68AE, 0x9778, - 0x68AF, 0xCCDD, 0x68B0, 0xD0B5, 0x68B1, 0x9779, 0x68B2, 0x977A, - 0x68B3, 0xCAE1, 0x68B4, 0x977B, 0x68B5, 0xE8F3, 0x68B6, 0x977C, - 0x68B7, 0x977D, 0x68B8, 0x977E, 0x68B9, 0x9780, 0x68BA, 0x9781, - 0x68BB, 0x9782, 0x68BC, 0x9783, 0x68BD, 0x9784, 0x68BE, 0x9785, - 0x68BF, 0x9786, 0x68C0, 0xBCEC, 0x68C1, 0x9787, 0x68C2, 0xE8F9, - 0x68C3, 0x9788, 0x68C4, 0x9789, 0x68C5, 0x978A, 0x68C6, 0x978B, - 0x68C7, 0x978C, 0x68C8, 0x978D, 0x68C9, 0xC3DE, 0x68CA, 0x978E, - 0x68CB, 0xC6E5, 0x68CC, 0x978F, 0x68CD, 0xB9F7, 0x68CE, 0x9790, - 0x68CF, 0x9791, 0x68D0, 0x9792, 0x68D1, 0x9793, 0x68D2, 0xB0F4, - 0x68D3, 0x9794, 0x68D4, 0x9795, 0x68D5, 0xD7D8, 0x68D6, 0x9796, - 0x68D7, 0x9797, 0x68D8, 0xBCAC, 0x68D9, 0x9798, 0x68DA, 0xC5EF, - 0x68DB, 0x9799, 0x68DC, 0x979A, 0x68DD, 0x979B, 0x68DE, 0x979C, - 0x68DF, 0x979D, 0x68E0, 0xCCC4, 0x68E1, 0x979E, 0x68E2, 0x979F, - 0x68E3, 0xE9A6, 0x68E4, 0x97A0, 0x68E5, 0x97A1, 0x68E6, 0x97A2, - 0x68E7, 0x97A3, 0x68E8, 0x97A4, 0x68E9, 0x97A5, 0x68EA, 0x97A6, - 0x68EB, 0x97A7, 0x68EC, 0x97A8, 0x68ED, 0x97A9, 0x68EE, 0xC9AD, - 0x68EF, 0x97AA, 0x68F0, 0xE9A2, 0x68F1, 0xC0E2, 0x68F2, 0x97AB, - 0x68F3, 0x97AC, 0x68F4, 0x97AD, 0x68F5, 0xBFC3, 0x68F6, 0x97AE, - 0x68F7, 0x97AF, 0x68F8, 0x97B0, 0x68F9, 0xE8FE, 0x68FA, 0xB9D7, - 0x68FB, 0x97B1, 0x68FC, 0xE8FB, 0x68FD, 0x97B2, 0x68FE, 0x97B3, - 0x68FF, 0x97B4, 0x6900, 0x97B5, 0x6901, 0xE9A4, 0x6902, 0x97B6, - 0x6903, 0x97B7, 0x6904, 0x97B8, 0x6905, 0xD2CE, 0x6906, 0x97B9, - 0x6907, 0x97BA, 0x6908, 0x97BB, 0x6909, 0x97BC, 0x690A, 0x97BD, - 0x690B, 0xE9A3, 0x690C, 0x97BE, 0x690D, 0xD6B2, 0x690E, 0xD7B5, - 0x690F, 0x97BF, 0x6910, 0xE9A7, 0x6911, 0x97C0, 0x6912, 0xBDB7, - 0x6913, 0x97C1, 0x6914, 0x97C2, 0x6915, 0x97C3, 0x6916, 0x97C4, - 0x6917, 0x97C5, 0x6918, 0x97C6, 0x6919, 0x97C7, 0x691A, 0x97C8, - 0x691B, 0x97C9, 0x691C, 0x97CA, 0x691D, 0x97CB, 0x691E, 0x97CC, - 0x691F, 0xE8FC, 0x6920, 0xE8FD, 0x6921, 0x97CD, 0x6922, 0x97CE, - 0x6923, 0x97CF, 0x6924, 0xE9A1, 0x6925, 0x97D0, 0x6926, 0x97D1, - 0x6927, 0x97D2, 0x6928, 0x97D3, 0x6929, 0x97D4, 0x692A, 0x97D5, - 0x692B, 0x97D6, 0x692C, 0x97D7, 0x692D, 0xCDD6, 0x692E, 0x97D8, - 0x692F, 0x97D9, 0x6930, 0xD2AC, 0x6931, 0x97DA, 0x6932, 0x97DB, - 0x6933, 0x97DC, 0x6934, 0xE9B2, 0x6935, 0x97DD, 0x6936, 0x97DE, - 0x6937, 0x97DF, 0x6938, 0x97E0, 0x6939, 0xE9A9, 0x693A, 0x97E1, - 0x693B, 0x97E2, 0x693C, 0x97E3, 0x693D, 0xB4AA, 0x693E, 0x97E4, - 0x693F, 0xB4BB, 0x6940, 0x97E5, 0x6941, 0x97E6, 0x6942, 0xE9AB, - 0x6943, 0x97E7, 0x6944, 0x97E8, 0x6945, 0x97E9, 0x6946, 0x97EA, - 0x6947, 0x97EB, 0x6948, 0x97EC, 0x6949, 0x97ED, 0x694A, 0x97EE, - 0x694B, 0x97EF, 0x694C, 0x97F0, 0x694D, 0x97F1, 0x694E, 0x97F2, - 0x694F, 0x97F3, 0x6950, 0x97F4, 0x6951, 0x97F5, 0x6952, 0x97F6, - 0x6953, 0x97F7, 0x6954, 0xD0A8, 0x6955, 0x97F8, 0x6956, 0x97F9, - 0x6957, 0xE9A5, 0x6958, 0x97FA, 0x6959, 0x97FB, 0x695A, 0xB3FE, - 0x695B, 0x97FC, 0x695C, 0x97FD, 0x695D, 0xE9AC, 0x695E, 0xC0E3, - 0x695F, 0x97FE, 0x6960, 0xE9AA, 0x6961, 0x9840, 0x6962, 0x9841, - 0x6963, 0xE9B9, 0x6964, 0x9842, 0x6965, 0x9843, 0x6966, 0xE9B8, - 0x6967, 0x9844, 0x6968, 0x9845, 0x6969, 0x9846, 0x696A, 0x9847, - 0x696B, 0xE9AE, 0x696C, 0x9848, 0x696D, 0x9849, 0x696E, 0xE8FA, - 0x696F, 0x984A, 0x6970, 0x984B, 0x6971, 0xE9A8, 0x6972, 0x984C, - 0x6973, 0x984D, 0x6974, 0x984E, 0x6975, 0x984F, 0x6976, 0x9850, - 0x6977, 0xBFAC, 0x6978, 0xE9B1, 0x6979, 0xE9BA, 0x697A, 0x9851, - 0x697B, 0x9852, 0x697C, 0xC2A5, 0x697D, 0x9853, 0x697E, 0x9854, - 0x697F, 0x9855, 0x6980, 0xE9AF, 0x6981, 0x9856, 0x6982, 0xB8C5, - 0x6983, 0x9857, 0x6984, 0xE9AD, 0x6985, 0x9858, 0x6986, 0xD3DC, - 0x6987, 0xE9B4, 0x6988, 0xE9B5, 0x6989, 0xE9B7, 0x698A, 0x9859, - 0x698B, 0x985A, 0x698C, 0x985B, 0x698D, 0xE9C7, 0x698E, 0x985C, - 0x698F, 0x985D, 0x6990, 0x985E, 0x6991, 0x985F, 0x6992, 0x9860, - 0x6993, 0x9861, 0x6994, 0xC0C6, 0x6995, 0xE9C5, 0x6996, 0x9862, - 0x6997, 0x9863, 0x6998, 0xE9B0, 0x6999, 0x9864, 0x699A, 0x9865, - 0x699B, 0xE9BB, 0x699C, 0xB0F1, 0x699D, 0x9866, 0x699E, 0x9867, - 0x699F, 0x9868, 0x69A0, 0x9869, 0x69A1, 0x986A, 0x69A2, 0x986B, - 0x69A3, 0x986C, 0x69A4, 0x986D, 0x69A5, 0x986E, 0x69A6, 0x986F, - 0x69A7, 0xE9BC, 0x69A8, 0xD5A5, 0x69A9, 0x9870, 0x69AA, 0x9871, - 0x69AB, 0xE9BE, 0x69AC, 0x9872, 0x69AD, 0xE9BF, 0x69AE, 0x9873, - 0x69AF, 0x9874, 0x69B0, 0x9875, 0x69B1, 0xE9C1, 0x69B2, 0x9876, - 0x69B3, 0x9877, 0x69B4, 0xC1F1, 0x69B5, 0x9878, 0x69B6, 0x9879, - 0x69B7, 0xC8B6, 0x69B8, 0x987A, 0x69B9, 0x987B, 0x69BA, 0x987C, - 0x69BB, 0xE9BD, 0x69BC, 0x987D, 0x69BD, 0x987E, 0x69BE, 0x9880, - 0x69BF, 0x9881, 0x69C0, 0x9882, 0x69C1, 0xE9C2, 0x69C2, 0x9883, - 0x69C3, 0x9884, 0x69C4, 0x9885, 0x69C5, 0x9886, 0x69C6, 0x9887, - 0x69C7, 0x9888, 0x69C8, 0x9889, 0x69C9, 0x988A, 0x69CA, 0xE9C3, - 0x69CB, 0x988B, 0x69CC, 0xE9B3, 0x69CD, 0x988C, 0x69CE, 0xE9B6, - 0x69CF, 0x988D, 0x69D0, 0xBBB1, 0x69D1, 0x988E, 0x69D2, 0x988F, - 0x69D3, 0x9890, 0x69D4, 0xE9C0, 0x69D5, 0x9891, 0x69D6, 0x9892, - 0x69D7, 0x9893, 0x69D8, 0x9894, 0x69D9, 0x9895, 0x69DA, 0x9896, - 0x69DB, 0xBCF7, 0x69DC, 0x9897, 0x69DD, 0x9898, 0x69DE, 0x9899, - 0x69DF, 0xE9C4, 0x69E0, 0xE9C6, 0x69E1, 0x989A, 0x69E2, 0x989B, - 0x69E3, 0x989C, 0x69E4, 0x989D, 0x69E5, 0x989E, 0x69E6, 0x989F, - 0x69E7, 0x98A0, 0x69E8, 0x98A1, 0x69E9, 0x98A2, 0x69EA, 0x98A3, - 0x69EB, 0x98A4, 0x69EC, 0x98A5, 0x69ED, 0xE9CA, 0x69EE, 0x98A6, - 0x69EF, 0x98A7, 0x69F0, 0x98A8, 0x69F1, 0x98A9, 0x69F2, 0xE9CE, - 0x69F3, 0x98AA, 0x69F4, 0x98AB, 0x69F5, 0x98AC, 0x69F6, 0x98AD, - 0x69F7, 0x98AE, 0x69F8, 0x98AF, 0x69F9, 0x98B0, 0x69FA, 0x98B1, - 0x69FB, 0x98B2, 0x69FC, 0x98B3, 0x69FD, 0xB2DB, 0x69FE, 0x98B4, - 0x69FF, 0xE9C8, 0x6A00, 0x98B5, 0x6A01, 0x98B6, 0x6A02, 0x98B7, - 0x6A03, 0x98B8, 0x6A04, 0x98B9, 0x6A05, 0x98BA, 0x6A06, 0x98BB, - 0x6A07, 0x98BC, 0x6A08, 0x98BD, 0x6A09, 0x98BE, 0x6A0A, 0xB7AE, - 0x6A0B, 0x98BF, 0x6A0C, 0x98C0, 0x6A0D, 0x98C1, 0x6A0E, 0x98C2, - 0x6A0F, 0x98C3, 0x6A10, 0x98C4, 0x6A11, 0x98C5, 0x6A12, 0x98C6, - 0x6A13, 0x98C7, 0x6A14, 0x98C8, 0x6A15, 0x98C9, 0x6A16, 0x98CA, - 0x6A17, 0xE9CB, 0x6A18, 0xE9CC, 0x6A19, 0x98CB, 0x6A1A, 0x98CC, - 0x6A1B, 0x98CD, 0x6A1C, 0x98CE, 0x6A1D, 0x98CF, 0x6A1E, 0x98D0, - 0x6A1F, 0xD5C1, 0x6A20, 0x98D1, 0x6A21, 0xC4A3, 0x6A22, 0x98D2, - 0x6A23, 0x98D3, 0x6A24, 0x98D4, 0x6A25, 0x98D5, 0x6A26, 0x98D6, - 0x6A27, 0x98D7, 0x6A28, 0xE9D8, 0x6A29, 0x98D8, 0x6A2A, 0xBAE1, - 0x6A2B, 0x98D9, 0x6A2C, 0x98DA, 0x6A2D, 0x98DB, 0x6A2E, 0x98DC, - 0x6A2F, 0xE9C9, 0x6A30, 0x98DD, 0x6A31, 0xD3A3, 0x6A32, 0x98DE, - 0x6A33, 0x98DF, 0x6A34, 0x98E0, 0x6A35, 0xE9D4, 0x6A36, 0x98E1, - 0x6A37, 0x98E2, 0x6A38, 0x98E3, 0x6A39, 0x98E4, 0x6A3A, 0x98E5, - 0x6A3B, 0x98E6, 0x6A3C, 0x98E7, 0x6A3D, 0xE9D7, 0x6A3E, 0xE9D0, - 0x6A3F, 0x98E8, 0x6A40, 0x98E9, 0x6A41, 0x98EA, 0x6A42, 0x98EB, - 0x6A43, 0x98EC, 0x6A44, 0xE9CF, 0x6A45, 0x98ED, 0x6A46, 0x98EE, - 0x6A47, 0xC7C1, 0x6A48, 0x98EF, 0x6A49, 0x98F0, 0x6A4A, 0x98F1, - 0x6A4B, 0x98F2, 0x6A4C, 0x98F3, 0x6A4D, 0x98F4, 0x6A4E, 0x98F5, - 0x6A4F, 0x98F6, 0x6A50, 0xE9D2, 0x6A51, 0x98F7, 0x6A52, 0x98F8, - 0x6A53, 0x98F9, 0x6A54, 0x98FA, 0x6A55, 0x98FB, 0x6A56, 0x98FC, - 0x6A57, 0x98FD, 0x6A58, 0xE9D9, 0x6A59, 0xB3C8, 0x6A5A, 0x98FE, - 0x6A5B, 0xE9D3, 0x6A5C, 0x9940, 0x6A5D, 0x9941, 0x6A5E, 0x9942, - 0x6A5F, 0x9943, 0x6A60, 0x9944, 0x6A61, 0xCFF0, 0x6A62, 0x9945, - 0x6A63, 0x9946, 0x6A64, 0x9947, 0x6A65, 0xE9CD, 0x6A66, 0x9948, - 0x6A67, 0x9949, 0x6A68, 0x994A, 0x6A69, 0x994B, 0x6A6A, 0x994C, - 0x6A6B, 0x994D, 0x6A6C, 0x994E, 0x6A6D, 0x994F, 0x6A6E, 0x9950, - 0x6A6F, 0x9951, 0x6A70, 0x9952, 0x6A71, 0xB3F7, 0x6A72, 0x9953, - 0x6A73, 0x9954, 0x6A74, 0x9955, 0x6A75, 0x9956, 0x6A76, 0x9957, - 0x6A77, 0x9958, 0x6A78, 0x9959, 0x6A79, 0xE9D6, 0x6A7A, 0x995A, - 0x6A7B, 0x995B, 0x6A7C, 0xE9DA, 0x6A7D, 0x995C, 0x6A7E, 0x995D, - 0x6A7F, 0x995E, 0x6A80, 0xCCB4, 0x6A81, 0x995F, 0x6A82, 0x9960, - 0x6A83, 0x9961, 0x6A84, 0xCFAD, 0x6A85, 0x9962, 0x6A86, 0x9963, - 0x6A87, 0x9964, 0x6A88, 0x9965, 0x6A89, 0x9966, 0x6A8A, 0x9967, - 0x6A8B, 0x9968, 0x6A8C, 0x9969, 0x6A8D, 0x996A, 0x6A8E, 0xE9D5, - 0x6A8F, 0x996B, 0x6A90, 0xE9DC, 0x6A91, 0xE9DB, 0x6A92, 0x996C, - 0x6A93, 0x996D, 0x6A94, 0x996E, 0x6A95, 0x996F, 0x6A96, 0x9970, - 0x6A97, 0xE9DE, 0x6A98, 0x9971, 0x6A99, 0x9972, 0x6A9A, 0x9973, - 0x6A9B, 0x9974, 0x6A9C, 0x9975, 0x6A9D, 0x9976, 0x6A9E, 0x9977, - 0x6A9F, 0x9978, 0x6AA0, 0xE9D1, 0x6AA1, 0x9979, 0x6AA2, 0x997A, - 0x6AA3, 0x997B, 0x6AA4, 0x997C, 0x6AA5, 0x997D, 0x6AA6, 0x997E, - 0x6AA7, 0x9980, 0x6AA8, 0x9981, 0x6AA9, 0xE9DD, 0x6AAA, 0x9982, - 0x6AAB, 0xE9DF, 0x6AAC, 0xC3CA, 0x6AAD, 0x9983, 0x6AAE, 0x9984, - 0x6AAF, 0x9985, 0x6AB0, 0x9986, 0x6AB1, 0x9987, 0x6AB2, 0x9988, - 0x6AB3, 0x9989, 0x6AB4, 0x998A, 0x6AB5, 0x998B, 0x6AB6, 0x998C, - 0x6AB7, 0x998D, 0x6AB8, 0x998E, 0x6AB9, 0x998F, 0x6ABA, 0x9990, - 0x6ABB, 0x9991, 0x6ABC, 0x9992, 0x6ABD, 0x9993, 0x6ABE, 0x9994, - 0x6ABF, 0x9995, 0x6AC0, 0x9996, 0x6AC1, 0x9997, 0x6AC2, 0x9998, - 0x6AC3, 0x9999, 0x6AC4, 0x999A, 0x6AC5, 0x999B, 0x6AC6, 0x999C, - 0x6AC7, 0x999D, 0x6AC8, 0x999E, 0x6AC9, 0x999F, 0x6ACA, 0x99A0, - 0x6ACB, 0x99A1, 0x6ACC, 0x99A2, 0x6ACD, 0x99A3, 0x6ACE, 0x99A4, - 0x6ACF, 0x99A5, 0x6AD0, 0x99A6, 0x6AD1, 0x99A7, 0x6AD2, 0x99A8, - 0x6AD3, 0x99A9, 0x6AD4, 0x99AA, 0x6AD5, 0x99AB, 0x6AD6, 0x99AC, - 0x6AD7, 0x99AD, 0x6AD8, 0x99AE, 0x6AD9, 0x99AF, 0x6ADA, 0x99B0, - 0x6ADB, 0x99B1, 0x6ADC, 0x99B2, 0x6ADD, 0x99B3, 0x6ADE, 0x99B4, - 0x6ADF, 0x99B5, 0x6AE0, 0x99B6, 0x6AE1, 0x99B7, 0x6AE2, 0x99B8, - 0x6AE3, 0x99B9, 0x6AE4, 0x99BA, 0x6AE5, 0x99BB, 0x6AE6, 0x99BC, - 0x6AE7, 0x99BD, 0x6AE8, 0x99BE, 0x6AE9, 0x99BF, 0x6AEA, 0x99C0, - 0x6AEB, 0x99C1, 0x6AEC, 0x99C2, 0x6AED, 0x99C3, 0x6AEE, 0x99C4, - 0x6AEF, 0x99C5, 0x6AF0, 0x99C6, 0x6AF1, 0x99C7, 0x6AF2, 0x99C8, - 0x6AF3, 0x99C9, 0x6AF4, 0x99CA, 0x6AF5, 0x99CB, 0x6AF6, 0x99CC, - 0x6AF7, 0x99CD, 0x6AF8, 0x99CE, 0x6AF9, 0x99CF, 0x6AFA, 0x99D0, - 0x6AFB, 0x99D1, 0x6AFC, 0x99D2, 0x6AFD, 0x99D3, 0x6AFE, 0x99D4, - 0x6AFF, 0x99D5, 0x6B00, 0x99D6, 0x6B01, 0x99D7, 0x6B02, 0x99D8, - 0x6B03, 0x99D9, 0x6B04, 0x99DA, 0x6B05, 0x99DB, 0x6B06, 0x99DC, - 0x6B07, 0x99DD, 0x6B08, 0x99DE, 0x6B09, 0x99DF, 0x6B0A, 0x99E0, - 0x6B0B, 0x99E1, 0x6B0C, 0x99E2, 0x6B0D, 0x99E3, 0x6B0E, 0x99E4, - 0x6B0F, 0x99E5, 0x6B10, 0x99E6, 0x6B11, 0x99E7, 0x6B12, 0x99E8, - 0x6B13, 0x99E9, 0x6B14, 0x99EA, 0x6B15, 0x99EB, 0x6B16, 0x99EC, - 0x6B17, 0x99ED, 0x6B18, 0x99EE, 0x6B19, 0x99EF, 0x6B1A, 0x99F0, - 0x6B1B, 0x99F1, 0x6B1C, 0x99F2, 0x6B1D, 0x99F3, 0x6B1E, 0x99F4, - 0x6B1F, 0x99F5, 0x6B20, 0xC7B7, 0x6B21, 0xB4CE, 0x6B22, 0xBBB6, - 0x6B23, 0xD0C0, 0x6B24, 0xECA3, 0x6B25, 0x99F6, 0x6B26, 0x99F7, - 0x6B27, 0xC5B7, 0x6B28, 0x99F8, 0x6B29, 0x99F9, 0x6B2A, 0x99FA, - 0x6B2B, 0x99FB, 0x6B2C, 0x99FC, 0x6B2D, 0x99FD, 0x6B2E, 0x99FE, - 0x6B2F, 0x9A40, 0x6B30, 0x9A41, 0x6B31, 0x9A42, 0x6B32, 0xD3FB, - 0x6B33, 0x9A43, 0x6B34, 0x9A44, 0x6B35, 0x9A45, 0x6B36, 0x9A46, - 0x6B37, 0xECA4, 0x6B38, 0x9A47, 0x6B39, 0xECA5, 0x6B3A, 0xC6DB, - 0x6B3B, 0x9A48, 0x6B3C, 0x9A49, 0x6B3D, 0x9A4A, 0x6B3E, 0xBFEE, - 0x6B3F, 0x9A4B, 0x6B40, 0x9A4C, 0x6B41, 0x9A4D, 0x6B42, 0x9A4E, - 0x6B43, 0xECA6, 0x6B44, 0x9A4F, 0x6B45, 0x9A50, 0x6B46, 0xECA7, - 0x6B47, 0xD0AA, 0x6B48, 0x9A51, 0x6B49, 0xC7B8, 0x6B4A, 0x9A52, - 0x6B4B, 0x9A53, 0x6B4C, 0xB8E8, 0x6B4D, 0x9A54, 0x6B4E, 0x9A55, - 0x6B4F, 0x9A56, 0x6B50, 0x9A57, 0x6B51, 0x9A58, 0x6B52, 0x9A59, - 0x6B53, 0x9A5A, 0x6B54, 0x9A5B, 0x6B55, 0x9A5C, 0x6B56, 0x9A5D, - 0x6B57, 0x9A5E, 0x6B58, 0x9A5F, 0x6B59, 0xECA8, 0x6B5A, 0x9A60, - 0x6B5B, 0x9A61, 0x6B5C, 0x9A62, 0x6B5D, 0x9A63, 0x6B5E, 0x9A64, - 0x6B5F, 0x9A65, 0x6B60, 0x9A66, 0x6B61, 0x9A67, 0x6B62, 0xD6B9, - 0x6B63, 0xD5FD, 0x6B64, 0xB4CB, 0x6B65, 0xB2BD, 0x6B66, 0xCEE4, - 0x6B67, 0xC6E7, 0x6B68, 0x9A68, 0x6B69, 0x9A69, 0x6B6A, 0xCDE1, - 0x6B6B, 0x9A6A, 0x6B6C, 0x9A6B, 0x6B6D, 0x9A6C, 0x6B6E, 0x9A6D, - 0x6B6F, 0x9A6E, 0x6B70, 0x9A6F, 0x6B71, 0x9A70, 0x6B72, 0x9A71, - 0x6B73, 0x9A72, 0x6B74, 0x9A73, 0x6B75, 0x9A74, 0x6B76, 0x9A75, - 0x6B77, 0x9A76, 0x6B78, 0x9A77, 0x6B79, 0xB4F5, 0x6B7A, 0x9A78, - 0x6B7B, 0xCBC0, 0x6B7C, 0xBCDF, 0x6B7D, 0x9A79, 0x6B7E, 0x9A7A, - 0x6B7F, 0x9A7B, 0x6B80, 0x9A7C, 0x6B81, 0xE9E2, 0x6B82, 0xE9E3, - 0x6B83, 0xD1EA, 0x6B84, 0xE9E5, 0x6B85, 0x9A7D, 0x6B86, 0xB4F9, - 0x6B87, 0xE9E4, 0x6B88, 0x9A7E, 0x6B89, 0xD1B3, 0x6B8A, 0xCAE2, - 0x6B8B, 0xB2D0, 0x6B8C, 0x9A80, 0x6B8D, 0xE9E8, 0x6B8E, 0x9A81, - 0x6B8F, 0x9A82, 0x6B90, 0x9A83, 0x6B91, 0x9A84, 0x6B92, 0xE9E6, - 0x6B93, 0xE9E7, 0x6B94, 0x9A85, 0x6B95, 0x9A86, 0x6B96, 0xD6B3, - 0x6B97, 0x9A87, 0x6B98, 0x9A88, 0x6B99, 0x9A89, 0x6B9A, 0xE9E9, - 0x6B9B, 0xE9EA, 0x6B9C, 0x9A8A, 0x6B9D, 0x9A8B, 0x6B9E, 0x9A8C, - 0x6B9F, 0x9A8D, 0x6BA0, 0x9A8E, 0x6BA1, 0xE9EB, 0x6BA2, 0x9A8F, - 0x6BA3, 0x9A90, 0x6BA4, 0x9A91, 0x6BA5, 0x9A92, 0x6BA6, 0x9A93, - 0x6BA7, 0x9A94, 0x6BA8, 0x9A95, 0x6BA9, 0x9A96, 0x6BAA, 0xE9EC, - 0x6BAB, 0x9A97, 0x6BAC, 0x9A98, 0x6BAD, 0x9A99, 0x6BAE, 0x9A9A, - 0x6BAF, 0x9A9B, 0x6BB0, 0x9A9C, 0x6BB1, 0x9A9D, 0x6BB2, 0x9A9E, - 0x6BB3, 0xECAF, 0x6BB4, 0xC5B9, 0x6BB5, 0xB6CE, 0x6BB6, 0x9A9F, - 0x6BB7, 0xD2F3, 0x6BB8, 0x9AA0, 0x6BB9, 0x9AA1, 0x6BBA, 0x9AA2, - 0x6BBB, 0x9AA3, 0x6BBC, 0x9AA4, 0x6BBD, 0x9AA5, 0x6BBE, 0x9AA6, - 0x6BBF, 0xB5EE, 0x6BC0, 0x9AA7, 0x6BC1, 0xBBD9, 0x6BC2, 0xECB1, - 0x6BC3, 0x9AA8, 0x6BC4, 0x9AA9, 0x6BC5, 0xD2E3, 0x6BC6, 0x9AAA, - 0x6BC7, 0x9AAB, 0x6BC8, 0x9AAC, 0x6BC9, 0x9AAD, 0x6BCA, 0x9AAE, - 0x6BCB, 0xCEE3, 0x6BCC, 0x9AAF, 0x6BCD, 0xC4B8, 0x6BCE, 0x9AB0, - 0x6BCF, 0xC3BF, 0x6BD0, 0x9AB1, 0x6BD1, 0x9AB2, 0x6BD2, 0xB6BE, - 0x6BD3, 0xD8B9, 0x6BD4, 0xB1C8, 0x6BD5, 0xB1CF, 0x6BD6, 0xB1D1, - 0x6BD7, 0xC5FE, 0x6BD8, 0x9AB3, 0x6BD9, 0xB1D0, 0x6BDA, 0x9AB4, - 0x6BDB, 0xC3AB, 0x6BDC, 0x9AB5, 0x6BDD, 0x9AB6, 0x6BDE, 0x9AB7, - 0x6BDF, 0x9AB8, 0x6BE0, 0x9AB9, 0x6BE1, 0xD5B1, 0x6BE2, 0x9ABA, - 0x6BE3, 0x9ABB, 0x6BE4, 0x9ABC, 0x6BE5, 0x9ABD, 0x6BE6, 0x9ABE, - 0x6BE7, 0x9ABF, 0x6BE8, 0x9AC0, 0x6BE9, 0x9AC1, 0x6BEA, 0xEBA4, - 0x6BEB, 0xBAC1, 0x6BEC, 0x9AC2, 0x6BED, 0x9AC3, 0x6BEE, 0x9AC4, - 0x6BEF, 0xCCBA, 0x6BF0, 0x9AC5, 0x6BF1, 0x9AC6, 0x6BF2, 0x9AC7, - 0x6BF3, 0xEBA5, 0x6BF4, 0x9AC8, 0x6BF5, 0xEBA7, 0x6BF6, 0x9AC9, - 0x6BF7, 0x9ACA, 0x6BF8, 0x9ACB, 0x6BF9, 0xEBA8, 0x6BFA, 0x9ACC, - 0x6BFB, 0x9ACD, 0x6BFC, 0x9ACE, 0x6BFD, 0xEBA6, 0x6BFE, 0x9ACF, - 0x6BFF, 0x9AD0, 0x6C00, 0x9AD1, 0x6C01, 0x9AD2, 0x6C02, 0x9AD3, - 0x6C03, 0x9AD4, 0x6C04, 0x9AD5, 0x6C05, 0xEBA9, 0x6C06, 0xEBAB, - 0x6C07, 0xEBAA, 0x6C08, 0x9AD6, 0x6C09, 0x9AD7, 0x6C0A, 0x9AD8, - 0x6C0B, 0x9AD9, 0x6C0C, 0x9ADA, 0x6C0D, 0xEBAC, 0x6C0E, 0x9ADB, - 0x6C0F, 0xCACF, 0x6C10, 0xD8B5, 0x6C11, 0xC3F1, 0x6C12, 0x9ADC, - 0x6C13, 0xC3A5, 0x6C14, 0xC6F8, 0x6C15, 0xEBAD, 0x6C16, 0xC4CA, - 0x6C17, 0x9ADD, 0x6C18, 0xEBAE, 0x6C19, 0xEBAF, 0x6C1A, 0xEBB0, - 0x6C1B, 0xB7D5, 0x6C1C, 0x9ADE, 0x6C1D, 0x9ADF, 0x6C1E, 0x9AE0, - 0x6C1F, 0xB7FA, 0x6C20, 0x9AE1, 0x6C21, 0xEBB1, 0x6C22, 0xC7E2, - 0x6C23, 0x9AE2, 0x6C24, 0xEBB3, 0x6C25, 0x9AE3, 0x6C26, 0xBAA4, - 0x6C27, 0xD1F5, 0x6C28, 0xB0B1, 0x6C29, 0xEBB2, 0x6C2A, 0xEBB4, - 0x6C2B, 0x9AE4, 0x6C2C, 0x9AE5, 0x6C2D, 0x9AE6, 0x6C2E, 0xB5AA, - 0x6C2F, 0xC2C8, 0x6C30, 0xC7E8, 0x6C31, 0x9AE7, 0x6C32, 0xEBB5, - 0x6C33, 0x9AE8, 0x6C34, 0xCBAE, 0x6C35, 0xE3DF, 0x6C36, 0x9AE9, - 0x6C37, 0x9AEA, 0x6C38, 0xD3C0, 0x6C39, 0x9AEB, 0x6C3A, 0x9AEC, - 0x6C3B, 0x9AED, 0x6C3C, 0x9AEE, 0x6C3D, 0xD9DB, 0x6C3E, 0x9AEF, - 0x6C3F, 0x9AF0, 0x6C40, 0xCDA1, 0x6C41, 0xD6AD, 0x6C42, 0xC7F3, - 0x6C43, 0x9AF1, 0x6C44, 0x9AF2, 0x6C45, 0x9AF3, 0x6C46, 0xD9E0, - 0x6C47, 0xBBE3, 0x6C48, 0x9AF4, 0x6C49, 0xBABA, 0x6C4A, 0xE3E2, - 0x6C4B, 0x9AF5, 0x6C4C, 0x9AF6, 0x6C4D, 0x9AF7, 0x6C4E, 0x9AF8, - 0x6C4F, 0x9AF9, 0x6C50, 0xCFAB, 0x6C51, 0x9AFA, 0x6C52, 0x9AFB, - 0x6C53, 0x9AFC, 0x6C54, 0xE3E0, 0x6C55, 0xC9C7, 0x6C56, 0x9AFD, - 0x6C57, 0xBAB9, 0x6C58, 0x9AFE, 0x6C59, 0x9B40, 0x6C5A, 0x9B41, - 0x6C5B, 0xD1B4, 0x6C5C, 0xE3E1, 0x6C5D, 0xC8EA, 0x6C5E, 0xB9AF, - 0x6C5F, 0xBDAD, 0x6C60, 0xB3D8, 0x6C61, 0xCEDB, 0x6C62, 0x9B42, - 0x6C63, 0x9B43, 0x6C64, 0xCCC0, 0x6C65, 0x9B44, 0x6C66, 0x9B45, - 0x6C67, 0x9B46, 0x6C68, 0xE3E8, 0x6C69, 0xE3E9, 0x6C6A, 0xCDF4, - 0x6C6B, 0x9B47, 0x6C6C, 0x9B48, 0x6C6D, 0x9B49, 0x6C6E, 0x9B4A, - 0x6C6F, 0x9B4B, 0x6C70, 0xCCAD, 0x6C71, 0x9B4C, 0x6C72, 0xBCB3, - 0x6C73, 0x9B4D, 0x6C74, 0xE3EA, 0x6C75, 0x9B4E, 0x6C76, 0xE3EB, - 0x6C77, 0x9B4F, 0x6C78, 0x9B50, 0x6C79, 0xD0DA, 0x6C7A, 0x9B51, - 0x6C7B, 0x9B52, 0x6C7C, 0x9B53, 0x6C7D, 0xC6FB, 0x6C7E, 0xB7DA, - 0x6C7F, 0x9B54, 0x6C80, 0x9B55, 0x6C81, 0xC7DF, 0x6C82, 0xD2CA, - 0x6C83, 0xCED6, 0x6C84, 0x9B56, 0x6C85, 0xE3E4, 0x6C86, 0xE3EC, - 0x6C87, 0x9B57, 0x6C88, 0xC9F2, 0x6C89, 0xB3C1, 0x6C8A, 0x9B58, - 0x6C8B, 0x9B59, 0x6C8C, 0xE3E7, 0x6C8D, 0x9B5A, 0x6C8E, 0x9B5B, - 0x6C8F, 0xC6E3, 0x6C90, 0xE3E5, 0x6C91, 0x9B5C, 0x6C92, 0x9B5D, - 0x6C93, 0xEDB3, 0x6C94, 0xE3E6, 0x6C95, 0x9B5E, 0x6C96, 0x9B5F, - 0x6C97, 0x9B60, 0x6C98, 0x9B61, 0x6C99, 0xC9B3, 0x6C9A, 0x9B62, - 0x6C9B, 0xC5E6, 0x6C9C, 0x9B63, 0x6C9D, 0x9B64, 0x6C9E, 0x9B65, - 0x6C9F, 0xB9B5, 0x6CA0, 0x9B66, 0x6CA1, 0xC3BB, 0x6CA2, 0x9B67, - 0x6CA3, 0xE3E3, 0x6CA4, 0xC5BD, 0x6CA5, 0xC1A4, 0x6CA6, 0xC2D9, - 0x6CA7, 0xB2D7, 0x6CA8, 0x9B68, 0x6CA9, 0xE3ED, 0x6CAA, 0xBBA6, - 0x6CAB, 0xC4AD, 0x6CAC, 0x9B69, 0x6CAD, 0xE3F0, 0x6CAE, 0xBEDA, - 0x6CAF, 0x9B6A, 0x6CB0, 0x9B6B, 0x6CB1, 0xE3FB, 0x6CB2, 0xE3F5, - 0x6CB3, 0xBAD3, 0x6CB4, 0x9B6C, 0x6CB5, 0x9B6D, 0x6CB6, 0x9B6E, - 0x6CB7, 0x9B6F, 0x6CB8, 0xB7D0, 0x6CB9, 0xD3CD, 0x6CBA, 0x9B70, - 0x6CBB, 0xD6CE, 0x6CBC, 0xD5D3, 0x6CBD, 0xB9C1, 0x6CBE, 0xD5B4, - 0x6CBF, 0xD1D8, 0x6CC0, 0x9B71, 0x6CC1, 0x9B72, 0x6CC2, 0x9B73, - 0x6CC3, 0x9B74, 0x6CC4, 0xD0B9, 0x6CC5, 0xC7F6, 0x6CC6, 0x9B75, - 0x6CC7, 0x9B76, 0x6CC8, 0x9B77, 0x6CC9, 0xC8AA, 0x6CCA, 0xB2B4, - 0x6CCB, 0x9B78, 0x6CCC, 0xC3DA, 0x6CCD, 0x9B79, 0x6CCE, 0x9B7A, - 0x6CCF, 0x9B7B, 0x6CD0, 0xE3EE, 0x6CD1, 0x9B7C, 0x6CD2, 0x9B7D, - 0x6CD3, 0xE3FC, 0x6CD4, 0xE3EF, 0x6CD5, 0xB7A8, 0x6CD6, 0xE3F7, - 0x6CD7, 0xE3F4, 0x6CD8, 0x9B7E, 0x6CD9, 0x9B80, 0x6CDA, 0x9B81, - 0x6CDB, 0xB7BA, 0x6CDC, 0x9B82, 0x6CDD, 0x9B83, 0x6CDE, 0xC5A2, - 0x6CDF, 0x9B84, 0x6CE0, 0xE3F6, 0x6CE1, 0xC5DD, 0x6CE2, 0xB2A8, - 0x6CE3, 0xC6FC, 0x6CE4, 0x9B85, 0x6CE5, 0xC4E0, 0x6CE6, 0x9B86, - 0x6CE7, 0x9B87, 0x6CE8, 0xD7A2, 0x6CE9, 0x9B88, 0x6CEA, 0xC0E1, - 0x6CEB, 0xE3F9, 0x6CEC, 0x9B89, 0x6CED, 0x9B8A, 0x6CEE, 0xE3FA, - 0x6CEF, 0xE3FD, 0x6CF0, 0xCCA9, 0x6CF1, 0xE3F3, 0x6CF2, 0x9B8B, - 0x6CF3, 0xD3BE, 0x6CF4, 0x9B8C, 0x6CF5, 0xB1C3, 0x6CF6, 0xEDB4, - 0x6CF7, 0xE3F1, 0x6CF8, 0xE3F2, 0x6CF9, 0x9B8D, 0x6CFA, 0xE3F8, - 0x6CFB, 0xD0BA, 0x6CFC, 0xC6C3, 0x6CFD, 0xD4F3, 0x6CFE, 0xE3FE, - 0x6CFF, 0x9B8E, 0x6D00, 0x9B8F, 0x6D01, 0xBDE0, 0x6D02, 0x9B90, - 0x6D03, 0x9B91, 0x6D04, 0xE4A7, 0x6D05, 0x9B92, 0x6D06, 0x9B93, - 0x6D07, 0xE4A6, 0x6D08, 0x9B94, 0x6D09, 0x9B95, 0x6D0A, 0x9B96, - 0x6D0B, 0xD1F3, 0x6D0C, 0xE4A3, 0x6D0D, 0x9B97, 0x6D0E, 0xE4A9, - 0x6D0F, 0x9B98, 0x6D10, 0x9B99, 0x6D11, 0x9B9A, 0x6D12, 0xC8F7, - 0x6D13, 0x9B9B, 0x6D14, 0x9B9C, 0x6D15, 0x9B9D, 0x6D16, 0x9B9E, - 0x6D17, 0xCFB4, 0x6D18, 0x9B9F, 0x6D19, 0xE4A8, 0x6D1A, 0xE4AE, - 0x6D1B, 0xC2E5, 0x6D1C, 0x9BA0, 0x6D1D, 0x9BA1, 0x6D1E, 0xB6B4, - 0x6D1F, 0x9BA2, 0x6D20, 0x9BA3, 0x6D21, 0x9BA4, 0x6D22, 0x9BA5, - 0x6D23, 0x9BA6, 0x6D24, 0x9BA7, 0x6D25, 0xBDF2, 0x6D26, 0x9BA8, - 0x6D27, 0xE4A2, 0x6D28, 0x9BA9, 0x6D29, 0x9BAA, 0x6D2A, 0xBAE9, - 0x6D2B, 0xE4AA, 0x6D2C, 0x9BAB, 0x6D2D, 0x9BAC, 0x6D2E, 0xE4AC, - 0x6D2F, 0x9BAD, 0x6D30, 0x9BAE, 0x6D31, 0xB6FD, 0x6D32, 0xD6DE, - 0x6D33, 0xE4B2, 0x6D34, 0x9BAF, 0x6D35, 0xE4AD, 0x6D36, 0x9BB0, - 0x6D37, 0x9BB1, 0x6D38, 0x9BB2, 0x6D39, 0xE4A1, 0x6D3A, 0x9BB3, - 0x6D3B, 0xBBEE, 0x6D3C, 0xCDDD, 0x6D3D, 0xC7A2, 0x6D3E, 0xC5C9, - 0x6D3F, 0x9BB4, 0x6D40, 0x9BB5, 0x6D41, 0xC1F7, 0x6D42, 0x9BB6, - 0x6D43, 0xE4A4, 0x6D44, 0x9BB7, 0x6D45, 0xC7B3, 0x6D46, 0xBDAC, - 0x6D47, 0xBDBD, 0x6D48, 0xE4A5, 0x6D49, 0x9BB8, 0x6D4A, 0xD7C7, - 0x6D4B, 0xB2E2, 0x6D4C, 0x9BB9, 0x6D4D, 0xE4AB, 0x6D4E, 0xBCC3, - 0x6D4F, 0xE4AF, 0x6D50, 0x9BBA, 0x6D51, 0xBBEB, 0x6D52, 0xE4B0, - 0x6D53, 0xC5A8, 0x6D54, 0xE4B1, 0x6D55, 0x9BBB, 0x6D56, 0x9BBC, - 0x6D57, 0x9BBD, 0x6D58, 0x9BBE, 0x6D59, 0xD5E3, 0x6D5A, 0xBFA3, - 0x6D5B, 0x9BBF, 0x6D5C, 0xE4BA, 0x6D5D, 0x9BC0, 0x6D5E, 0xE4B7, - 0x6D5F, 0x9BC1, 0x6D60, 0xE4BB, 0x6D61, 0x9BC2, 0x6D62, 0x9BC3, - 0x6D63, 0xE4BD, 0x6D64, 0x9BC4, 0x6D65, 0x9BC5, 0x6D66, 0xC6D6, - 0x6D67, 0x9BC6, 0x6D68, 0x9BC7, 0x6D69, 0xBAC6, 0x6D6A, 0xC0CB, - 0x6D6B, 0x9BC8, 0x6D6C, 0x9BC9, 0x6D6D, 0x9BCA, 0x6D6E, 0xB8A1, - 0x6D6F, 0xE4B4, 0x6D70, 0x9BCB, 0x6D71, 0x9BCC, 0x6D72, 0x9BCD, - 0x6D73, 0x9BCE, 0x6D74, 0xD4A1, 0x6D75, 0x9BCF, 0x6D76, 0x9BD0, - 0x6D77, 0xBAA3, 0x6D78, 0xBDFE, 0x6D79, 0x9BD1, 0x6D7A, 0x9BD2, - 0x6D7B, 0x9BD3, 0x6D7C, 0xE4BC, 0x6D7D, 0x9BD4, 0x6D7E, 0x9BD5, - 0x6D7F, 0x9BD6, 0x6D80, 0x9BD7, 0x6D81, 0x9BD8, 0x6D82, 0xCDBF, - 0x6D83, 0x9BD9, 0x6D84, 0x9BDA, 0x6D85, 0xC4F9, 0x6D86, 0x9BDB, - 0x6D87, 0x9BDC, 0x6D88, 0xCFFB, 0x6D89, 0xC9E6, 0x6D8A, 0x9BDD, - 0x6D8B, 0x9BDE, 0x6D8C, 0xD3BF, 0x6D8D, 0x9BDF, 0x6D8E, 0xCFD1, - 0x6D8F, 0x9BE0, 0x6D90, 0x9BE1, 0x6D91, 0xE4B3, 0x6D92, 0x9BE2, - 0x6D93, 0xE4B8, 0x6D94, 0xE4B9, 0x6D95, 0xCCE9, 0x6D96, 0x9BE3, - 0x6D97, 0x9BE4, 0x6D98, 0x9BE5, 0x6D99, 0x9BE6, 0x6D9A, 0x9BE7, - 0x6D9B, 0xCCCE, 0x6D9C, 0x9BE8, 0x6D9D, 0xC0D4, 0x6D9E, 0xE4B5, - 0x6D9F, 0xC1B0, 0x6DA0, 0xE4B6, 0x6DA1, 0xCED0, 0x6DA2, 0x9BE9, - 0x6DA3, 0xBBC1, 0x6DA4, 0xB5D3, 0x6DA5, 0x9BEA, 0x6DA6, 0xC8F3, - 0x6DA7, 0xBDA7, 0x6DA8, 0xD5C7, 0x6DA9, 0xC9AC, 0x6DAA, 0xB8A2, - 0x6DAB, 0xE4CA, 0x6DAC, 0x9BEB, 0x6DAD, 0x9BEC, 0x6DAE, 0xE4CC, - 0x6DAF, 0xD1C4, 0x6DB0, 0x9BED, 0x6DB1, 0x9BEE, 0x6DB2, 0xD2BA, - 0x6DB3, 0x9BEF, 0x6DB4, 0x9BF0, 0x6DB5, 0xBAAD, 0x6DB6, 0x9BF1, - 0x6DB7, 0x9BF2, 0x6DB8, 0xBAD4, 0x6DB9, 0x9BF3, 0x6DBA, 0x9BF4, - 0x6DBB, 0x9BF5, 0x6DBC, 0x9BF6, 0x6DBD, 0x9BF7, 0x6DBE, 0x9BF8, - 0x6DBF, 0xE4C3, 0x6DC0, 0xB5ED, 0x6DC1, 0x9BF9, 0x6DC2, 0x9BFA, - 0x6DC3, 0x9BFB, 0x6DC4, 0xD7CD, 0x6DC5, 0xE4C0, 0x6DC6, 0xCFFD, - 0x6DC7, 0xE4BF, 0x6DC8, 0x9BFC, 0x6DC9, 0x9BFD, 0x6DCA, 0x9BFE, - 0x6DCB, 0xC1DC, 0x6DCC, 0xCCCA, 0x6DCD, 0x9C40, 0x6DCE, 0x9C41, - 0x6DCF, 0x9C42, 0x6DD0, 0x9C43, 0x6DD1, 0xCAE7, 0x6DD2, 0x9C44, - 0x6DD3, 0x9C45, 0x6DD4, 0x9C46, 0x6DD5, 0x9C47, 0x6DD6, 0xC4D7, - 0x6DD7, 0x9C48, 0x6DD8, 0xCCD4, 0x6DD9, 0xE4C8, 0x6DDA, 0x9C49, - 0x6DDB, 0x9C4A, 0x6DDC, 0x9C4B, 0x6DDD, 0xE4C7, 0x6DDE, 0xE4C1, - 0x6DDF, 0x9C4C, 0x6DE0, 0xE4C4, 0x6DE1, 0xB5AD, 0x6DE2, 0x9C4D, - 0x6DE3, 0x9C4E, 0x6DE4, 0xD3D9, 0x6DE5, 0x9C4F, 0x6DE6, 0xE4C6, - 0x6DE7, 0x9C50, 0x6DE8, 0x9C51, 0x6DE9, 0x9C52, 0x6DEA, 0x9C53, - 0x6DEB, 0xD2F9, 0x6DEC, 0xB4E3, 0x6DED, 0x9C54, 0x6DEE, 0xBBB4, - 0x6DEF, 0x9C55, 0x6DF0, 0x9C56, 0x6DF1, 0xC9EE, 0x6DF2, 0x9C57, - 0x6DF3, 0xB4BE, 0x6DF4, 0x9C58, 0x6DF5, 0x9C59, 0x6DF6, 0x9C5A, - 0x6DF7, 0xBBEC, 0x6DF8, 0x9C5B, 0x6DF9, 0xD1CD, 0x6DFA, 0x9C5C, - 0x6DFB, 0xCCED, 0x6DFC, 0xEDB5, 0x6DFD, 0x9C5D, 0x6DFE, 0x9C5E, - 0x6DFF, 0x9C5F, 0x6E00, 0x9C60, 0x6E01, 0x9C61, 0x6E02, 0x9C62, - 0x6E03, 0x9C63, 0x6E04, 0x9C64, 0x6E05, 0xC7E5, 0x6E06, 0x9C65, - 0x6E07, 0x9C66, 0x6E08, 0x9C67, 0x6E09, 0x9C68, 0x6E0A, 0xD4A8, - 0x6E0B, 0x9C69, 0x6E0C, 0xE4CB, 0x6E0D, 0xD7D5, 0x6E0E, 0xE4C2, - 0x6E0F, 0x9C6A, 0x6E10, 0xBDA5, 0x6E11, 0xE4C5, 0x6E12, 0x9C6B, - 0x6E13, 0x9C6C, 0x6E14, 0xD3E6, 0x6E15, 0x9C6D, 0x6E16, 0xE4C9, - 0x6E17, 0xC9F8, 0x6E18, 0x9C6E, 0x6E19, 0x9C6F, 0x6E1A, 0xE4BE, - 0x6E1B, 0x9C70, 0x6E1C, 0x9C71, 0x6E1D, 0xD3E5, 0x6E1E, 0x9C72, - 0x6E1F, 0x9C73, 0x6E20, 0xC7FE, 0x6E21, 0xB6C9, 0x6E22, 0x9C74, - 0x6E23, 0xD4FC, 0x6E24, 0xB2B3, 0x6E25, 0xE4D7, 0x6E26, 0x9C75, - 0x6E27, 0x9C76, 0x6E28, 0x9C77, 0x6E29, 0xCEC2, 0x6E2A, 0x9C78, - 0x6E2B, 0xE4CD, 0x6E2C, 0x9C79, 0x6E2D, 0xCEBC, 0x6E2E, 0x9C7A, - 0x6E2F, 0xB8DB, 0x6E30, 0x9C7B, 0x6E31, 0x9C7C, 0x6E32, 0xE4D6, - 0x6E33, 0x9C7D, 0x6E34, 0xBFCA, 0x6E35, 0x9C7E, 0x6E36, 0x9C80, - 0x6E37, 0x9C81, 0x6E38, 0xD3CE, 0x6E39, 0x9C82, 0x6E3A, 0xC3EC, - 0x6E3B, 0x9C83, 0x6E3C, 0x9C84, 0x6E3D, 0x9C85, 0x6E3E, 0x9C86, - 0x6E3F, 0x9C87, 0x6E40, 0x9C88, 0x6E41, 0x9C89, 0x6E42, 0x9C8A, - 0x6E43, 0xC5C8, 0x6E44, 0xE4D8, 0x6E45, 0x9C8B, 0x6E46, 0x9C8C, - 0x6E47, 0x9C8D, 0x6E48, 0x9C8E, 0x6E49, 0x9C8F, 0x6E4A, 0x9C90, - 0x6E4B, 0x9C91, 0x6E4C, 0x9C92, 0x6E4D, 0xCDC4, 0x6E4E, 0xE4CF, - 0x6E4F, 0x9C93, 0x6E50, 0x9C94, 0x6E51, 0x9C95, 0x6E52, 0x9C96, - 0x6E53, 0xE4D4, 0x6E54, 0xE4D5, 0x6E55, 0x9C97, 0x6E56, 0xBAFE, - 0x6E57, 0x9C98, 0x6E58, 0xCFE6, 0x6E59, 0x9C99, 0x6E5A, 0x9C9A, - 0x6E5B, 0xD5BF, 0x6E5C, 0x9C9B, 0x6E5D, 0x9C9C, 0x6E5E, 0x9C9D, - 0x6E5F, 0xE4D2, 0x6E60, 0x9C9E, 0x6E61, 0x9C9F, 0x6E62, 0x9CA0, - 0x6E63, 0x9CA1, 0x6E64, 0x9CA2, 0x6E65, 0x9CA3, 0x6E66, 0x9CA4, - 0x6E67, 0x9CA5, 0x6E68, 0x9CA6, 0x6E69, 0x9CA7, 0x6E6A, 0x9CA8, - 0x6E6B, 0xE4D0, 0x6E6C, 0x9CA9, 0x6E6D, 0x9CAA, 0x6E6E, 0xE4CE, - 0x6E6F, 0x9CAB, 0x6E70, 0x9CAC, 0x6E71, 0x9CAD, 0x6E72, 0x9CAE, - 0x6E73, 0x9CAF, 0x6E74, 0x9CB0, 0x6E75, 0x9CB1, 0x6E76, 0x9CB2, - 0x6E77, 0x9CB3, 0x6E78, 0x9CB4, 0x6E79, 0x9CB5, 0x6E7A, 0x9CB6, - 0x6E7B, 0x9CB7, 0x6E7C, 0x9CB8, 0x6E7D, 0x9CB9, 0x6E7E, 0xCDE5, - 0x6E7F, 0xCAAA, 0x6E80, 0x9CBA, 0x6E81, 0x9CBB, 0x6E82, 0x9CBC, - 0x6E83, 0xC0A3, 0x6E84, 0x9CBD, 0x6E85, 0xBDA6, 0x6E86, 0xE4D3, - 0x6E87, 0x9CBE, 0x6E88, 0x9CBF, 0x6E89, 0xB8C8, 0x6E8A, 0x9CC0, - 0x6E8B, 0x9CC1, 0x6E8C, 0x9CC2, 0x6E8D, 0x9CC3, 0x6E8E, 0x9CC4, - 0x6E8F, 0xE4E7, 0x6E90, 0xD4B4, 0x6E91, 0x9CC5, 0x6E92, 0x9CC6, - 0x6E93, 0x9CC7, 0x6E94, 0x9CC8, 0x6E95, 0x9CC9, 0x6E96, 0x9CCA, - 0x6E97, 0x9CCB, 0x6E98, 0xE4DB, 0x6E99, 0x9CCC, 0x6E9A, 0x9CCD, - 0x6E9B, 0x9CCE, 0x6E9C, 0xC1EF, 0x6E9D, 0x9CCF, 0x6E9E, 0x9CD0, - 0x6E9F, 0xE4E9, 0x6EA0, 0x9CD1, 0x6EA1, 0x9CD2, 0x6EA2, 0xD2E7, - 0x6EA3, 0x9CD3, 0x6EA4, 0x9CD4, 0x6EA5, 0xE4DF, 0x6EA6, 0x9CD5, - 0x6EA7, 0xE4E0, 0x6EA8, 0x9CD6, 0x6EA9, 0x9CD7, 0x6EAA, 0xCFAA, - 0x6EAB, 0x9CD8, 0x6EAC, 0x9CD9, 0x6EAD, 0x9CDA, 0x6EAE, 0x9CDB, - 0x6EAF, 0xCBDD, 0x6EB0, 0x9CDC, 0x6EB1, 0xE4DA, 0x6EB2, 0xE4D1, - 0x6EB3, 0x9CDD, 0x6EB4, 0xE4E5, 0x6EB5, 0x9CDE, 0x6EB6, 0xC8DC, - 0x6EB7, 0xE4E3, 0x6EB8, 0x9CDF, 0x6EB9, 0x9CE0, 0x6EBA, 0xC4E7, - 0x6EBB, 0xE4E2, 0x6EBC, 0x9CE1, 0x6EBD, 0xE4E1, 0x6EBE, 0x9CE2, - 0x6EBF, 0x9CE3, 0x6EC0, 0x9CE4, 0x6EC1, 0xB3FC, 0x6EC2, 0xE4E8, - 0x6EC3, 0x9CE5, 0x6EC4, 0x9CE6, 0x6EC5, 0x9CE7, 0x6EC6, 0x9CE8, - 0x6EC7, 0xB5E1, 0x6EC8, 0x9CE9, 0x6EC9, 0x9CEA, 0x6ECA, 0x9CEB, - 0x6ECB, 0xD7CC, 0x6ECC, 0x9CEC, 0x6ECD, 0x9CED, 0x6ECE, 0x9CEE, - 0x6ECF, 0xE4E6, 0x6ED0, 0x9CEF, 0x6ED1, 0xBBAC, 0x6ED2, 0x9CF0, - 0x6ED3, 0xD7D2, 0x6ED4, 0xCCCF, 0x6ED5, 0xEBF8, 0x6ED6, 0x9CF1, - 0x6ED7, 0xE4E4, 0x6ED8, 0x9CF2, 0x6ED9, 0x9CF3, 0x6EDA, 0xB9F6, - 0x6EDB, 0x9CF4, 0x6EDC, 0x9CF5, 0x6EDD, 0x9CF6, 0x6EDE, 0xD6CD, - 0x6EDF, 0xE4D9, 0x6EE0, 0xE4DC, 0x6EE1, 0xC2FA, 0x6EE2, 0xE4DE, - 0x6EE3, 0x9CF7, 0x6EE4, 0xC2CB, 0x6EE5, 0xC0C4, 0x6EE6, 0xC2D0, - 0x6EE7, 0x9CF8, 0x6EE8, 0xB1F5, 0x6EE9, 0xCCB2, 0x6EEA, 0x9CF9, - 0x6EEB, 0x9CFA, 0x6EEC, 0x9CFB, 0x6EED, 0x9CFC, 0x6EEE, 0x9CFD, - 0x6EEF, 0x9CFE, 0x6EF0, 0x9D40, 0x6EF1, 0x9D41, 0x6EF2, 0x9D42, - 0x6EF3, 0x9D43, 0x6EF4, 0xB5CE, 0x6EF5, 0x9D44, 0x6EF6, 0x9D45, - 0x6EF7, 0x9D46, 0x6EF8, 0x9D47, 0x6EF9, 0xE4EF, 0x6EFA, 0x9D48, - 0x6EFB, 0x9D49, 0x6EFC, 0x9D4A, 0x6EFD, 0x9D4B, 0x6EFE, 0x9D4C, - 0x6EFF, 0x9D4D, 0x6F00, 0x9D4E, 0x6F01, 0x9D4F, 0x6F02, 0xC6AF, - 0x6F03, 0x9D50, 0x6F04, 0x9D51, 0x6F05, 0x9D52, 0x6F06, 0xC6E1, - 0x6F07, 0x9D53, 0x6F08, 0x9D54, 0x6F09, 0xE4F5, 0x6F0A, 0x9D55, - 0x6F0B, 0x9D56, 0x6F0C, 0x9D57, 0x6F0D, 0x9D58, 0x6F0E, 0x9D59, - 0x6F0F, 0xC2A9, 0x6F10, 0x9D5A, 0x6F11, 0x9D5B, 0x6F12, 0x9D5C, - 0x6F13, 0xC0EC, 0x6F14, 0xD1DD, 0x6F15, 0xE4EE, 0x6F16, 0x9D5D, - 0x6F17, 0x9D5E, 0x6F18, 0x9D5F, 0x6F19, 0x9D60, 0x6F1A, 0x9D61, - 0x6F1B, 0x9D62, 0x6F1C, 0x9D63, 0x6F1D, 0x9D64, 0x6F1E, 0x9D65, - 0x6F1F, 0x9D66, 0x6F20, 0xC4AE, 0x6F21, 0x9D67, 0x6F22, 0x9D68, - 0x6F23, 0x9D69, 0x6F24, 0xE4ED, 0x6F25, 0x9D6A, 0x6F26, 0x9D6B, - 0x6F27, 0x9D6C, 0x6F28, 0x9D6D, 0x6F29, 0xE4F6, 0x6F2A, 0xE4F4, - 0x6F2B, 0xC2FE, 0x6F2C, 0x9D6E, 0x6F2D, 0xE4DD, 0x6F2E, 0x9D6F, - 0x6F2F, 0xE4F0, 0x6F30, 0x9D70, 0x6F31, 0xCAFE, 0x6F32, 0x9D71, - 0x6F33, 0xD5C4, 0x6F34, 0x9D72, 0x6F35, 0x9D73, 0x6F36, 0xE4F1, - 0x6F37, 0x9D74, 0x6F38, 0x9D75, 0x6F39, 0x9D76, 0x6F3A, 0x9D77, - 0x6F3B, 0x9D78, 0x6F3C, 0x9D79, 0x6F3D, 0x9D7A, 0x6F3E, 0xD1FA, - 0x6F3F, 0x9D7B, 0x6F40, 0x9D7C, 0x6F41, 0x9D7D, 0x6F42, 0x9D7E, - 0x6F43, 0x9D80, 0x6F44, 0x9D81, 0x6F45, 0x9D82, 0x6F46, 0xE4EB, - 0x6F47, 0xE4EC, 0x6F48, 0x9D83, 0x6F49, 0x9D84, 0x6F4A, 0x9D85, - 0x6F4B, 0xE4F2, 0x6F4C, 0x9D86, 0x6F4D, 0xCEAB, 0x6F4E, 0x9D87, - 0x6F4F, 0x9D88, 0x6F50, 0x9D89, 0x6F51, 0x9D8A, 0x6F52, 0x9D8B, - 0x6F53, 0x9D8C, 0x6F54, 0x9D8D, 0x6F55, 0x9D8E, 0x6F56, 0x9D8F, - 0x6F57, 0x9D90, 0x6F58, 0xC5CB, 0x6F59, 0x9D91, 0x6F5A, 0x9D92, - 0x6F5B, 0x9D93, 0x6F5C, 0xC7B1, 0x6F5D, 0x9D94, 0x6F5E, 0xC2BA, - 0x6F5F, 0x9D95, 0x6F60, 0x9D96, 0x6F61, 0x9D97, 0x6F62, 0xE4EA, - 0x6F63, 0x9D98, 0x6F64, 0x9D99, 0x6F65, 0x9D9A, 0x6F66, 0xC1CA, - 0x6F67, 0x9D9B, 0x6F68, 0x9D9C, 0x6F69, 0x9D9D, 0x6F6A, 0x9D9E, - 0x6F6B, 0x9D9F, 0x6F6C, 0x9DA0, 0x6F6D, 0xCCB6, 0x6F6E, 0xB3B1, - 0x6F6F, 0x9DA1, 0x6F70, 0x9DA2, 0x6F71, 0x9DA3, 0x6F72, 0xE4FB, - 0x6F73, 0x9DA4, 0x6F74, 0xE4F3, 0x6F75, 0x9DA5, 0x6F76, 0x9DA6, - 0x6F77, 0x9DA7, 0x6F78, 0xE4FA, 0x6F79, 0x9DA8, 0x6F7A, 0xE4FD, - 0x6F7B, 0x9DA9, 0x6F7C, 0xE4FC, 0x6F7D, 0x9DAA, 0x6F7E, 0x9DAB, - 0x6F7F, 0x9DAC, 0x6F80, 0x9DAD, 0x6F81, 0x9DAE, 0x6F82, 0x9DAF, - 0x6F83, 0x9DB0, 0x6F84, 0xB3CE, 0x6F85, 0x9DB1, 0x6F86, 0x9DB2, - 0x6F87, 0x9DB3, 0x6F88, 0xB3BA, 0x6F89, 0xE4F7, 0x6F8A, 0x9DB4, - 0x6F8B, 0x9DB5, 0x6F8C, 0xE4F9, 0x6F8D, 0xE4F8, 0x6F8E, 0xC5EC, - 0x6F8F, 0x9DB6, 0x6F90, 0x9DB7, 0x6F91, 0x9DB8, 0x6F92, 0x9DB9, - 0x6F93, 0x9DBA, 0x6F94, 0x9DBB, 0x6F95, 0x9DBC, 0x6F96, 0x9DBD, - 0x6F97, 0x9DBE, 0x6F98, 0x9DBF, 0x6F99, 0x9DC0, 0x6F9A, 0x9DC1, - 0x6F9B, 0x9DC2, 0x6F9C, 0xC0BD, 0x6F9D, 0x9DC3, 0x6F9E, 0x9DC4, - 0x6F9F, 0x9DC5, 0x6FA0, 0x9DC6, 0x6FA1, 0xD4E8, 0x6FA2, 0x9DC7, - 0x6FA3, 0x9DC8, 0x6FA4, 0x9DC9, 0x6FA5, 0x9DCA, 0x6FA6, 0x9DCB, - 0x6FA7, 0xE5A2, 0x6FA8, 0x9DCC, 0x6FA9, 0x9DCD, 0x6FAA, 0x9DCE, - 0x6FAB, 0x9DCF, 0x6FAC, 0x9DD0, 0x6FAD, 0x9DD1, 0x6FAE, 0x9DD2, - 0x6FAF, 0x9DD3, 0x6FB0, 0x9DD4, 0x6FB1, 0x9DD5, 0x6FB2, 0x9DD6, - 0x6FB3, 0xB0C4, 0x6FB4, 0x9DD7, 0x6FB5, 0x9DD8, 0x6FB6, 0xE5A4, - 0x6FB7, 0x9DD9, 0x6FB8, 0x9DDA, 0x6FB9, 0xE5A3, 0x6FBA, 0x9DDB, - 0x6FBB, 0x9DDC, 0x6FBC, 0x9DDD, 0x6FBD, 0x9DDE, 0x6FBE, 0x9DDF, - 0x6FBF, 0x9DE0, 0x6FC0, 0xBCA4, 0x6FC1, 0x9DE1, 0x6FC2, 0xE5A5, - 0x6FC3, 0x9DE2, 0x6FC4, 0x9DE3, 0x6FC5, 0x9DE4, 0x6FC6, 0x9DE5, - 0x6FC7, 0x9DE6, 0x6FC8, 0x9DE7, 0x6FC9, 0xE5A1, 0x6FCA, 0x9DE8, - 0x6FCB, 0x9DE9, 0x6FCC, 0x9DEA, 0x6FCD, 0x9DEB, 0x6FCE, 0x9DEC, - 0x6FCF, 0x9DED, 0x6FD0, 0x9DEE, 0x6FD1, 0xE4FE, 0x6FD2, 0xB1F4, - 0x6FD3, 0x9DEF, 0x6FD4, 0x9DF0, 0x6FD5, 0x9DF1, 0x6FD6, 0x9DF2, - 0x6FD7, 0x9DF3, 0x6FD8, 0x9DF4, 0x6FD9, 0x9DF5, 0x6FDA, 0x9DF6, - 0x6FDB, 0x9DF7, 0x6FDC, 0x9DF8, 0x6FDD, 0x9DF9, 0x6FDE, 0xE5A8, - 0x6FDF, 0x9DFA, 0x6FE0, 0xE5A9, 0x6FE1, 0xE5A6, 0x6FE2, 0x9DFB, - 0x6FE3, 0x9DFC, 0x6FE4, 0x9DFD, 0x6FE5, 0x9DFE, 0x6FE6, 0x9E40, - 0x6FE7, 0x9E41, 0x6FE8, 0x9E42, 0x6FE9, 0x9E43, 0x6FEA, 0x9E44, - 0x6FEB, 0x9E45, 0x6FEC, 0x9E46, 0x6FED, 0x9E47, 0x6FEE, 0xE5A7, - 0x6FEF, 0xE5AA, 0x6FF0, 0x9E48, 0x6FF1, 0x9E49, 0x6FF2, 0x9E4A, - 0x6FF3, 0x9E4B, 0x6FF4, 0x9E4C, 0x6FF5, 0x9E4D, 0x6FF6, 0x9E4E, - 0x6FF7, 0x9E4F, 0x6FF8, 0x9E50, 0x6FF9, 0x9E51, 0x6FFA, 0x9E52, - 0x6FFB, 0x9E53, 0x6FFC, 0x9E54, 0x6FFD, 0x9E55, 0x6FFE, 0x9E56, - 0x6FFF, 0x9E57, 0x7000, 0x9E58, 0x7001, 0x9E59, 0x7002, 0x9E5A, - 0x7003, 0x9E5B, 0x7004, 0x9E5C, 0x7005, 0x9E5D, 0x7006, 0x9E5E, - 0x7007, 0x9E5F, 0x7008, 0x9E60, 0x7009, 0x9E61, 0x700A, 0x9E62, - 0x700B, 0x9E63, 0x700C, 0x9E64, 0x700D, 0x9E65, 0x700E, 0x9E66, - 0x700F, 0x9E67, 0x7010, 0x9E68, 0x7011, 0xC6D9, 0x7012, 0x9E69, - 0x7013, 0x9E6A, 0x7014, 0x9E6B, 0x7015, 0x9E6C, 0x7016, 0x9E6D, - 0x7017, 0x9E6E, 0x7018, 0x9E6F, 0x7019, 0x9E70, 0x701A, 0xE5AB, - 0x701B, 0xE5AD, 0x701C, 0x9E71, 0x701D, 0x9E72, 0x701E, 0x9E73, - 0x701F, 0x9E74, 0x7020, 0x9E75, 0x7021, 0x9E76, 0x7022, 0x9E77, - 0x7023, 0xE5AC, 0x7024, 0x9E78, 0x7025, 0x9E79, 0x7026, 0x9E7A, - 0x7027, 0x9E7B, 0x7028, 0x9E7C, 0x7029, 0x9E7D, 0x702A, 0x9E7E, - 0x702B, 0x9E80, 0x702C, 0x9E81, 0x702D, 0x9E82, 0x702E, 0x9E83, - 0x702F, 0x9E84, 0x7030, 0x9E85, 0x7031, 0x9E86, 0x7032, 0x9E87, - 0x7033, 0x9E88, 0x7034, 0x9E89, 0x7035, 0xE5AF, 0x7036, 0x9E8A, - 0x7037, 0x9E8B, 0x7038, 0x9E8C, 0x7039, 0xE5AE, 0x703A, 0x9E8D, - 0x703B, 0x9E8E, 0x703C, 0x9E8F, 0x703D, 0x9E90, 0x703E, 0x9E91, - 0x703F, 0x9E92, 0x7040, 0x9E93, 0x7041, 0x9E94, 0x7042, 0x9E95, - 0x7043, 0x9E96, 0x7044, 0x9E97, 0x7045, 0x9E98, 0x7046, 0x9E99, - 0x7047, 0x9E9A, 0x7048, 0x9E9B, 0x7049, 0x9E9C, 0x704A, 0x9E9D, - 0x704B, 0x9E9E, 0x704C, 0xB9E0, 0x704D, 0x9E9F, 0x704E, 0x9EA0, - 0x704F, 0xE5B0, 0x7050, 0x9EA1, 0x7051, 0x9EA2, 0x7052, 0x9EA3, - 0x7053, 0x9EA4, 0x7054, 0x9EA5, 0x7055, 0x9EA6, 0x7056, 0x9EA7, - 0x7057, 0x9EA8, 0x7058, 0x9EA9, 0x7059, 0x9EAA, 0x705A, 0x9EAB, - 0x705B, 0x9EAC, 0x705C, 0x9EAD, 0x705D, 0x9EAE, 0x705E, 0xE5B1, - 0x705F, 0x9EAF, 0x7060, 0x9EB0, 0x7061, 0x9EB1, 0x7062, 0x9EB2, - 0x7063, 0x9EB3, 0x7064, 0x9EB4, 0x7065, 0x9EB5, 0x7066, 0x9EB6, - 0x7067, 0x9EB7, 0x7068, 0x9EB8, 0x7069, 0x9EB9, 0x706A, 0x9EBA, - 0x706B, 0xBBF0, 0x706C, 0xECE1, 0x706D, 0xC3F0, 0x706E, 0x9EBB, - 0x706F, 0xB5C6, 0x7070, 0xBBD2, 0x7071, 0x9EBC, 0x7072, 0x9EBD, - 0x7073, 0x9EBE, 0x7074, 0x9EBF, 0x7075, 0xC1E9, 0x7076, 0xD4EE, - 0x7077, 0x9EC0, 0x7078, 0xBEC4, 0x7079, 0x9EC1, 0x707A, 0x9EC2, - 0x707B, 0x9EC3, 0x707C, 0xD7C6, 0x707D, 0x9EC4, 0x707E, 0xD4D6, - 0x707F, 0xB2D3, 0x7080, 0xECBE, 0x7081, 0x9EC5, 0x7082, 0x9EC6, - 0x7083, 0x9EC7, 0x7084, 0x9EC8, 0x7085, 0xEAC1, 0x7086, 0x9EC9, - 0x7087, 0x9ECA, 0x7088, 0x9ECB, 0x7089, 0xC2AF, 0x708A, 0xB4B6, - 0x708B, 0x9ECC, 0x708C, 0x9ECD, 0x708D, 0x9ECE, 0x708E, 0xD1D7, - 0x708F, 0x9ECF, 0x7090, 0x9ED0, 0x7091, 0x9ED1, 0x7092, 0xB3B4, - 0x7093, 0x9ED2, 0x7094, 0xC8B2, 0x7095, 0xBFBB, 0x7096, 0xECC0, - 0x7097, 0x9ED3, 0x7098, 0x9ED4, 0x7099, 0xD6CB, 0x709A, 0x9ED5, - 0x709B, 0x9ED6, 0x709C, 0xECBF, 0x709D, 0xECC1, 0x709E, 0x9ED7, - 0x709F, 0x9ED8, 0x70A0, 0x9ED9, 0x70A1, 0x9EDA, 0x70A2, 0x9EDB, - 0x70A3, 0x9EDC, 0x70A4, 0x9EDD, 0x70A5, 0x9EDE, 0x70A6, 0x9EDF, - 0x70A7, 0x9EE0, 0x70A8, 0x9EE1, 0x70A9, 0x9EE2, 0x70AA, 0x9EE3, - 0x70AB, 0xECC5, 0x70AC, 0xBEE6, 0x70AD, 0xCCBF, 0x70AE, 0xC5DA, - 0x70AF, 0xBEBC, 0x70B0, 0x9EE4, 0x70B1, 0xECC6, 0x70B2, 0x9EE5, - 0x70B3, 0xB1FE, 0x70B4, 0x9EE6, 0x70B5, 0x9EE7, 0x70B6, 0x9EE8, - 0x70B7, 0xECC4, 0x70B8, 0xD5A8, 0x70B9, 0xB5E3, 0x70BA, 0x9EE9, - 0x70BB, 0xECC2, 0x70BC, 0xC1B6, 0x70BD, 0xB3E3, 0x70BE, 0x9EEA, - 0x70BF, 0x9EEB, 0x70C0, 0xECC3, 0x70C1, 0xCBB8, 0x70C2, 0xC0C3, - 0x70C3, 0xCCFE, 0x70C4, 0x9EEC, 0x70C5, 0x9EED, 0x70C6, 0x9EEE, - 0x70C7, 0x9EEF, 0x70C8, 0xC1D2, 0x70C9, 0x9EF0, 0x70CA, 0xECC8, - 0x70CB, 0x9EF1, 0x70CC, 0x9EF2, 0x70CD, 0x9EF3, 0x70CE, 0x9EF4, - 0x70CF, 0x9EF5, 0x70D0, 0x9EF6, 0x70D1, 0x9EF7, 0x70D2, 0x9EF8, - 0x70D3, 0x9EF9, 0x70D4, 0x9EFA, 0x70D5, 0x9EFB, 0x70D6, 0x9EFC, - 0x70D7, 0x9EFD, 0x70D8, 0xBAE6, 0x70D9, 0xC0D3, 0x70DA, 0x9EFE, - 0x70DB, 0xD6F2, 0x70DC, 0x9F40, 0x70DD, 0x9F41, 0x70DE, 0x9F42, - 0x70DF, 0xD1CC, 0x70E0, 0x9F43, 0x70E1, 0x9F44, 0x70E2, 0x9F45, - 0x70E3, 0x9F46, 0x70E4, 0xBFBE, 0x70E5, 0x9F47, 0x70E6, 0xB7B3, - 0x70E7, 0xC9D5, 0x70E8, 0xECC7, 0x70E9, 0xBBE2, 0x70EA, 0x9F48, - 0x70EB, 0xCCCC, 0x70EC, 0xBDFD, 0x70ED, 0xC8C8, 0x70EE, 0x9F49, - 0x70EF, 0xCFA9, 0x70F0, 0x9F4A, 0x70F1, 0x9F4B, 0x70F2, 0x9F4C, - 0x70F3, 0x9F4D, 0x70F4, 0x9F4E, 0x70F5, 0x9F4F, 0x70F6, 0x9F50, - 0x70F7, 0xCDE9, 0x70F8, 0x9F51, 0x70F9, 0xC5EB, 0x70FA, 0x9F52, - 0x70FB, 0x9F53, 0x70FC, 0x9F54, 0x70FD, 0xB7E9, 0x70FE, 0x9F55, - 0x70FF, 0x9F56, 0x7100, 0x9F57, 0x7101, 0x9F58, 0x7102, 0x9F59, - 0x7103, 0x9F5A, 0x7104, 0x9F5B, 0x7105, 0x9F5C, 0x7106, 0x9F5D, - 0x7107, 0x9F5E, 0x7108, 0x9F5F, 0x7109, 0xD1C9, 0x710A, 0xBAB8, - 0x710B, 0x9F60, 0x710C, 0x9F61, 0x710D, 0x9F62, 0x710E, 0x9F63, - 0x710F, 0x9F64, 0x7110, 0xECC9, 0x7111, 0x9F65, 0x7112, 0x9F66, - 0x7113, 0xECCA, 0x7114, 0x9F67, 0x7115, 0xBBC0, 0x7116, 0xECCB, - 0x7117, 0x9F68, 0x7118, 0xECE2, 0x7119, 0xB1BA, 0x711A, 0xB7D9, - 0x711B, 0x9F69, 0x711C, 0x9F6A, 0x711D, 0x9F6B, 0x711E, 0x9F6C, - 0x711F, 0x9F6D, 0x7120, 0x9F6E, 0x7121, 0x9F6F, 0x7122, 0x9F70, - 0x7123, 0x9F71, 0x7124, 0x9F72, 0x7125, 0x9F73, 0x7126, 0xBDB9, - 0x7127, 0x9F74, 0x7128, 0x9F75, 0x7129, 0x9F76, 0x712A, 0x9F77, - 0x712B, 0x9F78, 0x712C, 0x9F79, 0x712D, 0x9F7A, 0x712E, 0x9F7B, - 0x712F, 0xECCC, 0x7130, 0xD1E6, 0x7131, 0xECCD, 0x7132, 0x9F7C, - 0x7133, 0x9F7D, 0x7134, 0x9F7E, 0x7135, 0x9F80, 0x7136, 0xC8BB, - 0x7137, 0x9F81, 0x7138, 0x9F82, 0x7139, 0x9F83, 0x713A, 0x9F84, - 0x713B, 0x9F85, 0x713C, 0x9F86, 0x713D, 0x9F87, 0x713E, 0x9F88, - 0x713F, 0x9F89, 0x7140, 0x9F8A, 0x7141, 0x9F8B, 0x7142, 0x9F8C, - 0x7143, 0x9F8D, 0x7144, 0x9F8E, 0x7145, 0xECD1, 0x7146, 0x9F8F, - 0x7147, 0x9F90, 0x7148, 0x9F91, 0x7149, 0x9F92, 0x714A, 0xECD3, - 0x714B, 0x9F93, 0x714C, 0xBBCD, 0x714D, 0x9F94, 0x714E, 0xBCE5, - 0x714F, 0x9F95, 0x7150, 0x9F96, 0x7151, 0x9F97, 0x7152, 0x9F98, - 0x7153, 0x9F99, 0x7154, 0x9F9A, 0x7155, 0x9F9B, 0x7156, 0x9F9C, - 0x7157, 0x9F9D, 0x7158, 0x9F9E, 0x7159, 0x9F9F, 0x715A, 0x9FA0, - 0x715B, 0x9FA1, 0x715C, 0xECCF, 0x715D, 0x9FA2, 0x715E, 0xC9B7, - 0x715F, 0x9FA3, 0x7160, 0x9FA4, 0x7161, 0x9FA5, 0x7162, 0x9FA6, - 0x7163, 0x9FA7, 0x7164, 0xC3BA, 0x7165, 0x9FA8, 0x7166, 0xECE3, - 0x7167, 0xD5D5, 0x7168, 0xECD0, 0x7169, 0x9FA9, 0x716A, 0x9FAA, - 0x716B, 0x9FAB, 0x716C, 0x9FAC, 0x716D, 0x9FAD, 0x716E, 0xD6F3, - 0x716F, 0x9FAE, 0x7170, 0x9FAF, 0x7171, 0x9FB0, 0x7172, 0xECD2, - 0x7173, 0xECCE, 0x7174, 0x9FB1, 0x7175, 0x9FB2, 0x7176, 0x9FB3, - 0x7177, 0x9FB4, 0x7178, 0xECD4, 0x7179, 0x9FB5, 0x717A, 0xECD5, - 0x717B, 0x9FB6, 0x717C, 0x9FB7, 0x717D, 0xC9BF, 0x717E, 0x9FB8, - 0x717F, 0x9FB9, 0x7180, 0x9FBA, 0x7181, 0x9FBB, 0x7182, 0x9FBC, - 0x7183, 0x9FBD, 0x7184, 0xCFA8, 0x7185, 0x9FBE, 0x7186, 0x9FBF, - 0x7187, 0x9FC0, 0x7188, 0x9FC1, 0x7189, 0x9FC2, 0x718A, 0xD0DC, - 0x718B, 0x9FC3, 0x718C, 0x9FC4, 0x718D, 0x9FC5, 0x718E, 0x9FC6, - 0x718F, 0xD1AC, 0x7190, 0x9FC7, 0x7191, 0x9FC8, 0x7192, 0x9FC9, - 0x7193, 0x9FCA, 0x7194, 0xC8DB, 0x7195, 0x9FCB, 0x7196, 0x9FCC, - 0x7197, 0x9FCD, 0x7198, 0xECD6, 0x7199, 0xCEF5, 0x719A, 0x9FCE, - 0x719B, 0x9FCF, 0x719C, 0x9FD0, 0x719D, 0x9FD1, 0x719E, 0x9FD2, - 0x719F, 0xCAEC, 0x71A0, 0xECDA, 0x71A1, 0x9FD3, 0x71A2, 0x9FD4, - 0x71A3, 0x9FD5, 0x71A4, 0x9FD6, 0x71A5, 0x9FD7, 0x71A6, 0x9FD8, - 0x71A7, 0x9FD9, 0x71A8, 0xECD9, 0x71A9, 0x9FDA, 0x71AA, 0x9FDB, - 0x71AB, 0x9FDC, 0x71AC, 0xB0BE, 0x71AD, 0x9FDD, 0x71AE, 0x9FDE, - 0x71AF, 0x9FDF, 0x71B0, 0x9FE0, 0x71B1, 0x9FE1, 0x71B2, 0x9FE2, - 0x71B3, 0xECD7, 0x71B4, 0x9FE3, 0x71B5, 0xECD8, 0x71B6, 0x9FE4, - 0x71B7, 0x9FE5, 0x71B8, 0x9FE6, 0x71B9, 0xECE4, 0x71BA, 0x9FE7, - 0x71BB, 0x9FE8, 0x71BC, 0x9FE9, 0x71BD, 0x9FEA, 0x71BE, 0x9FEB, - 0x71BF, 0x9FEC, 0x71C0, 0x9FED, 0x71C1, 0x9FEE, 0x71C2, 0x9FEF, - 0x71C3, 0xC8BC, 0x71C4, 0x9FF0, 0x71C5, 0x9FF1, 0x71C6, 0x9FF2, - 0x71C7, 0x9FF3, 0x71C8, 0x9FF4, 0x71C9, 0x9FF5, 0x71CA, 0x9FF6, - 0x71CB, 0x9FF7, 0x71CC, 0x9FF8, 0x71CD, 0x9FF9, 0x71CE, 0xC1C7, - 0x71CF, 0x9FFA, 0x71D0, 0x9FFB, 0x71D1, 0x9FFC, 0x71D2, 0x9FFD, - 0x71D3, 0x9FFE, 0x71D4, 0xECDC, 0x71D5, 0xD1E0, 0x71D6, 0xA040, - 0x71D7, 0xA041, 0x71D8, 0xA042, 0x71D9, 0xA043, 0x71DA, 0xA044, - 0x71DB, 0xA045, 0x71DC, 0xA046, 0x71DD, 0xA047, 0x71DE, 0xA048, - 0x71DF, 0xA049, 0x71E0, 0xECDB, 0x71E1, 0xA04A, 0x71E2, 0xA04B, - 0x71E3, 0xA04C, 0x71E4, 0xA04D, 0x71E5, 0xD4EF, 0x71E6, 0xA04E, - 0x71E7, 0xECDD, 0x71E8, 0xA04F, 0x71E9, 0xA050, 0x71EA, 0xA051, - 0x71EB, 0xA052, 0x71EC, 0xA053, 0x71ED, 0xA054, 0x71EE, 0xDBC6, - 0x71EF, 0xA055, 0x71F0, 0xA056, 0x71F1, 0xA057, 0x71F2, 0xA058, - 0x71F3, 0xA059, 0x71F4, 0xA05A, 0x71F5, 0xA05B, 0x71F6, 0xA05C, - 0x71F7, 0xA05D, 0x71F8, 0xA05E, 0x71F9, 0xECDE, 0x71FA, 0xA05F, - 0x71FB, 0xA060, 0x71FC, 0xA061, 0x71FD, 0xA062, 0x71FE, 0xA063, - 0x71FF, 0xA064, 0x7200, 0xA065, 0x7201, 0xA066, 0x7202, 0xA067, - 0x7203, 0xA068, 0x7204, 0xA069, 0x7205, 0xA06A, 0x7206, 0xB1AC, - 0x7207, 0xA06B, 0x7208, 0xA06C, 0x7209, 0xA06D, 0x720A, 0xA06E, - 0x720B, 0xA06F, 0x720C, 0xA070, 0x720D, 0xA071, 0x720E, 0xA072, - 0x720F, 0xA073, 0x7210, 0xA074, 0x7211, 0xA075, 0x7212, 0xA076, - 0x7213, 0xA077, 0x7214, 0xA078, 0x7215, 0xA079, 0x7216, 0xA07A, - 0x7217, 0xA07B, 0x7218, 0xA07C, 0x7219, 0xA07D, 0x721A, 0xA07E, - 0x721B, 0xA080, 0x721C, 0xA081, 0x721D, 0xECDF, 0x721E, 0xA082, - 0x721F, 0xA083, 0x7220, 0xA084, 0x7221, 0xA085, 0x7222, 0xA086, - 0x7223, 0xA087, 0x7224, 0xA088, 0x7225, 0xA089, 0x7226, 0xA08A, - 0x7227, 0xA08B, 0x7228, 0xECE0, 0x7229, 0xA08C, 0x722A, 0xD7A6, - 0x722B, 0xA08D, 0x722C, 0xC5C0, 0x722D, 0xA08E, 0x722E, 0xA08F, - 0x722F, 0xA090, 0x7230, 0xEBBC, 0x7231, 0xB0AE, 0x7232, 0xA091, - 0x7233, 0xA092, 0x7234, 0xA093, 0x7235, 0xBEF4, 0x7236, 0xB8B8, - 0x7237, 0xD2AF, 0x7238, 0xB0D6, 0x7239, 0xB5F9, 0x723A, 0xA094, - 0x723B, 0xD8B3, 0x723C, 0xA095, 0x723D, 0xCBAC, 0x723E, 0xA096, - 0x723F, 0xE3DD, 0x7240, 0xA097, 0x7241, 0xA098, 0x7242, 0xA099, - 0x7243, 0xA09A, 0x7244, 0xA09B, 0x7245, 0xA09C, 0x7246, 0xA09D, - 0x7247, 0xC6AC, 0x7248, 0xB0E6, 0x7249, 0xA09E, 0x724A, 0xA09F, - 0x724B, 0xA0A0, 0x724C, 0xC5C6, 0x724D, 0xEBB9, 0x724E, 0xA0A1, - 0x724F, 0xA0A2, 0x7250, 0xA0A3, 0x7251, 0xA0A4, 0x7252, 0xEBBA, - 0x7253, 0xA0A5, 0x7254, 0xA0A6, 0x7255, 0xA0A7, 0x7256, 0xEBBB, - 0x7257, 0xA0A8, 0x7258, 0xA0A9, 0x7259, 0xD1C0, 0x725A, 0xA0AA, - 0x725B, 0xC5A3, 0x725C, 0xA0AB, 0x725D, 0xEAF2, 0x725E, 0xA0AC, - 0x725F, 0xC4B2, 0x7260, 0xA0AD, 0x7261, 0xC4B5, 0x7262, 0xC0CE, - 0x7263, 0xA0AE, 0x7264, 0xA0AF, 0x7265, 0xA0B0, 0x7266, 0xEAF3, - 0x7267, 0xC4C1, 0x7268, 0xA0B1, 0x7269, 0xCEEF, 0x726A, 0xA0B2, - 0x726B, 0xA0B3, 0x726C, 0xA0B4, 0x726D, 0xA0B5, 0x726E, 0xEAF0, - 0x726F, 0xEAF4, 0x7270, 0xA0B6, 0x7271, 0xA0B7, 0x7272, 0xC9FC, - 0x7273, 0xA0B8, 0x7274, 0xA0B9, 0x7275, 0xC7A3, 0x7276, 0xA0BA, - 0x7277, 0xA0BB, 0x7278, 0xA0BC, 0x7279, 0xCCD8, 0x727A, 0xCEFE, - 0x727B, 0xA0BD, 0x727C, 0xA0BE, 0x727D, 0xA0BF, 0x727E, 0xEAF5, - 0x727F, 0xEAF6, 0x7280, 0xCFAC, 0x7281, 0xC0E7, 0x7282, 0xA0C0, - 0x7283, 0xA0C1, 0x7284, 0xEAF7, 0x7285, 0xA0C2, 0x7286, 0xA0C3, - 0x7287, 0xA0C4, 0x7288, 0xA0C5, 0x7289, 0xA0C6, 0x728A, 0xB6BF, - 0x728B, 0xEAF8, 0x728C, 0xA0C7, 0x728D, 0xEAF9, 0x728E, 0xA0C8, - 0x728F, 0xEAFA, 0x7290, 0xA0C9, 0x7291, 0xA0CA, 0x7292, 0xEAFB, - 0x7293, 0xA0CB, 0x7294, 0xA0CC, 0x7295, 0xA0CD, 0x7296, 0xA0CE, - 0x7297, 0xA0CF, 0x7298, 0xA0D0, 0x7299, 0xA0D1, 0x729A, 0xA0D2, - 0x729B, 0xA0D3, 0x729C, 0xA0D4, 0x729D, 0xA0D5, 0x729E, 0xA0D6, - 0x729F, 0xEAF1, 0x72A0, 0xA0D7, 0x72A1, 0xA0D8, 0x72A2, 0xA0D9, - 0x72A3, 0xA0DA, 0x72A4, 0xA0DB, 0x72A5, 0xA0DC, 0x72A6, 0xA0DD, - 0x72A7, 0xA0DE, 0x72A8, 0xA0DF, 0x72A9, 0xA0E0, 0x72AA, 0xA0E1, - 0x72AB, 0xA0E2, 0x72AC, 0xC8AE, 0x72AD, 0xE1EB, 0x72AE, 0xA0E3, - 0x72AF, 0xB7B8, 0x72B0, 0xE1EC, 0x72B1, 0xA0E4, 0x72B2, 0xA0E5, - 0x72B3, 0xA0E6, 0x72B4, 0xE1ED, 0x72B5, 0xA0E7, 0x72B6, 0xD7B4, - 0x72B7, 0xE1EE, 0x72B8, 0xE1EF, 0x72B9, 0xD3CC, 0x72BA, 0xA0E8, - 0x72BB, 0xA0E9, 0x72BC, 0xA0EA, 0x72BD, 0xA0EB, 0x72BE, 0xA0EC, - 0x72BF, 0xA0ED, 0x72C0, 0xA0EE, 0x72C1, 0xE1F1, 0x72C2, 0xBFF1, - 0x72C3, 0xE1F0, 0x72C4, 0xB5D2, 0x72C5, 0xA0EF, 0x72C6, 0xA0F0, - 0x72C7, 0xA0F1, 0x72C8, 0xB1B7, 0x72C9, 0xA0F2, 0x72CA, 0xA0F3, - 0x72CB, 0xA0F4, 0x72CC, 0xA0F5, 0x72CD, 0xE1F3, 0x72CE, 0xE1F2, - 0x72CF, 0xA0F6, 0x72D0, 0xBAFC, 0x72D1, 0xA0F7, 0x72D2, 0xE1F4, - 0x72D3, 0xA0F8, 0x72D4, 0xA0F9, 0x72D5, 0xA0FA, 0x72D6, 0xA0FB, - 0x72D7, 0xB9B7, 0x72D8, 0xA0FC, 0x72D9, 0xBED1, 0x72DA, 0xA0FD, - 0x72DB, 0xA0FE, 0x72DC, 0xAA40, 0x72DD, 0xAA41, 0x72DE, 0xC4FC, - 0x72DF, 0xAA42, 0x72E0, 0xBADD, 0x72E1, 0xBDC6, 0x72E2, 0xAA43, - 0x72E3, 0xAA44, 0x72E4, 0xAA45, 0x72E5, 0xAA46, 0x72E6, 0xAA47, - 0x72E7, 0xAA48, 0x72E8, 0xE1F5, 0x72E9, 0xE1F7, 0x72EA, 0xAA49, - 0x72EB, 0xAA4A, 0x72EC, 0xB6C0, 0x72ED, 0xCFC1, 0x72EE, 0xCAA8, - 0x72EF, 0xE1F6, 0x72F0, 0xD5F8, 0x72F1, 0xD3FC, 0x72F2, 0xE1F8, - 0x72F3, 0xE1FC, 0x72F4, 0xE1F9, 0x72F5, 0xAA4B, 0x72F6, 0xAA4C, - 0x72F7, 0xE1FA, 0x72F8, 0xC0EA, 0x72F9, 0xAA4D, 0x72FA, 0xE1FE, - 0x72FB, 0xE2A1, 0x72FC, 0xC0C7, 0x72FD, 0xAA4E, 0x72FE, 0xAA4F, - 0x72FF, 0xAA50, 0x7300, 0xAA51, 0x7301, 0xE1FB, 0x7302, 0xAA52, - 0x7303, 0xE1FD, 0x7304, 0xAA53, 0x7305, 0xAA54, 0x7306, 0xAA55, - 0x7307, 0xAA56, 0x7308, 0xAA57, 0x7309, 0xAA58, 0x730A, 0xE2A5, - 0x730B, 0xAA59, 0x730C, 0xAA5A, 0x730D, 0xAA5B, 0x730E, 0xC1D4, - 0x730F, 0xAA5C, 0x7310, 0xAA5D, 0x7311, 0xAA5E, 0x7312, 0xAA5F, - 0x7313, 0xE2A3, 0x7314, 0xAA60, 0x7315, 0xE2A8, 0x7316, 0xB2FE, - 0x7317, 0xE2A2, 0x7318, 0xAA61, 0x7319, 0xAA62, 0x731A, 0xAA63, - 0x731B, 0xC3CD, 0x731C, 0xB2C2, 0x731D, 0xE2A7, 0x731E, 0xE2A6, - 0x731F, 0xAA64, 0x7320, 0xAA65, 0x7321, 0xE2A4, 0x7322, 0xE2A9, - 0x7323, 0xAA66, 0x7324, 0xAA67, 0x7325, 0xE2AB, 0x7326, 0xAA68, - 0x7327, 0xAA69, 0x7328, 0xAA6A, 0x7329, 0xD0C9, 0x732A, 0xD6ED, - 0x732B, 0xC3A8, 0x732C, 0xE2AC, 0x732D, 0xAA6B, 0x732E, 0xCFD7, - 0x732F, 0xAA6C, 0x7330, 0xAA6D, 0x7331, 0xE2AE, 0x7332, 0xAA6E, - 0x7333, 0xAA6F, 0x7334, 0xBAEF, 0x7335, 0xAA70, 0x7336, 0xAA71, - 0x7337, 0xE9E0, 0x7338, 0xE2AD, 0x7339, 0xE2AA, 0x733A, 0xAA72, - 0x733B, 0xAA73, 0x733C, 0xAA74, 0x733D, 0xAA75, 0x733E, 0xBBAB, - 0x733F, 0xD4B3, 0x7340, 0xAA76, 0x7341, 0xAA77, 0x7342, 0xAA78, - 0x7343, 0xAA79, 0x7344, 0xAA7A, 0x7345, 0xAA7B, 0x7346, 0xAA7C, - 0x7347, 0xAA7D, 0x7348, 0xAA7E, 0x7349, 0xAA80, 0x734A, 0xAA81, - 0x734B, 0xAA82, 0x734C, 0xAA83, 0x734D, 0xE2B0, 0x734E, 0xAA84, - 0x734F, 0xAA85, 0x7350, 0xE2AF, 0x7351, 0xAA86, 0x7352, 0xE9E1, - 0x7353, 0xAA87, 0x7354, 0xAA88, 0x7355, 0xAA89, 0x7356, 0xAA8A, - 0x7357, 0xE2B1, 0x7358, 0xAA8B, 0x7359, 0xAA8C, 0x735A, 0xAA8D, - 0x735B, 0xAA8E, 0x735C, 0xAA8F, 0x735D, 0xAA90, 0x735E, 0xAA91, - 0x735F, 0xAA92, 0x7360, 0xE2B2, 0x7361, 0xAA93, 0x7362, 0xAA94, - 0x7363, 0xAA95, 0x7364, 0xAA96, 0x7365, 0xAA97, 0x7366, 0xAA98, - 0x7367, 0xAA99, 0x7368, 0xAA9A, 0x7369, 0xAA9B, 0x736A, 0xAA9C, - 0x736B, 0xAA9D, 0x736C, 0xE2B3, 0x736D, 0xCCA1, 0x736E, 0xAA9E, - 0x736F, 0xE2B4, 0x7370, 0xAA9F, 0x7371, 0xAAA0, 0x7372, 0xAB40, - 0x7373, 0xAB41, 0x7374, 0xAB42, 0x7375, 0xAB43, 0x7376, 0xAB44, - 0x7377, 0xAB45, 0x7378, 0xAB46, 0x7379, 0xAB47, 0x737A, 0xAB48, - 0x737B, 0xAB49, 0x737C, 0xAB4A, 0x737D, 0xAB4B, 0x737E, 0xE2B5, - 0x737F, 0xAB4C, 0x7380, 0xAB4D, 0x7381, 0xAB4E, 0x7382, 0xAB4F, - 0x7383, 0xAB50, 0x7384, 0xD0FE, 0x7385, 0xAB51, 0x7386, 0xAB52, - 0x7387, 0xC2CA, 0x7388, 0xAB53, 0x7389, 0xD3F1, 0x738A, 0xAB54, - 0x738B, 0xCDF5, 0x738C, 0xAB55, 0x738D, 0xAB56, 0x738E, 0xE7E0, - 0x738F, 0xAB57, 0x7390, 0xAB58, 0x7391, 0xE7E1, 0x7392, 0xAB59, - 0x7393, 0xAB5A, 0x7394, 0xAB5B, 0x7395, 0xAB5C, 0x7396, 0xBEC1, - 0x7397, 0xAB5D, 0x7398, 0xAB5E, 0x7399, 0xAB5F, 0x739A, 0xAB60, - 0x739B, 0xC2EA, 0x739C, 0xAB61, 0x739D, 0xAB62, 0x739E, 0xAB63, - 0x739F, 0xE7E4, 0x73A0, 0xAB64, 0x73A1, 0xAB65, 0x73A2, 0xE7E3, - 0x73A3, 0xAB66, 0x73A4, 0xAB67, 0x73A5, 0xAB68, 0x73A6, 0xAB69, - 0x73A7, 0xAB6A, 0x73A8, 0xAB6B, 0x73A9, 0xCDE6, 0x73AA, 0xAB6C, - 0x73AB, 0xC3B5, 0x73AC, 0xAB6D, 0x73AD, 0xAB6E, 0x73AE, 0xE7E2, - 0x73AF, 0xBBB7, 0x73B0, 0xCFD6, 0x73B1, 0xAB6F, 0x73B2, 0xC1E1, - 0x73B3, 0xE7E9, 0x73B4, 0xAB70, 0x73B5, 0xAB71, 0x73B6, 0xAB72, - 0x73B7, 0xE7E8, 0x73B8, 0xAB73, 0x73B9, 0xAB74, 0x73BA, 0xE7F4, - 0x73BB, 0xB2A3, 0x73BC, 0xAB75, 0x73BD, 0xAB76, 0x73BE, 0xAB77, - 0x73BF, 0xAB78, 0x73C0, 0xE7EA, 0x73C1, 0xAB79, 0x73C2, 0xE7E6, - 0x73C3, 0xAB7A, 0x73C4, 0xAB7B, 0x73C5, 0xAB7C, 0x73C6, 0xAB7D, - 0x73C7, 0xAB7E, 0x73C8, 0xE7EC, 0x73C9, 0xE7EB, 0x73CA, 0xC9BA, - 0x73CB, 0xAB80, 0x73CC, 0xAB81, 0x73CD, 0xD5E4, 0x73CE, 0xAB82, - 0x73CF, 0xE7E5, 0x73D0, 0xB7A9, 0x73D1, 0xE7E7, 0x73D2, 0xAB83, - 0x73D3, 0xAB84, 0x73D4, 0xAB85, 0x73D5, 0xAB86, 0x73D6, 0xAB87, - 0x73D7, 0xAB88, 0x73D8, 0xAB89, 0x73D9, 0xE7EE, 0x73DA, 0xAB8A, - 0x73DB, 0xAB8B, 0x73DC, 0xAB8C, 0x73DD, 0xAB8D, 0x73DE, 0xE7F3, - 0x73DF, 0xAB8E, 0x73E0, 0xD6E9, 0x73E1, 0xAB8F, 0x73E2, 0xAB90, - 0x73E3, 0xAB91, 0x73E4, 0xAB92, 0x73E5, 0xE7ED, 0x73E6, 0xAB93, - 0x73E7, 0xE7F2, 0x73E8, 0xAB94, 0x73E9, 0xE7F1, 0x73EA, 0xAB95, - 0x73EB, 0xAB96, 0x73EC, 0xAB97, 0x73ED, 0xB0E0, 0x73EE, 0xAB98, - 0x73EF, 0xAB99, 0x73F0, 0xAB9A, 0x73F1, 0xAB9B, 0x73F2, 0xE7F5, - 0x73F3, 0xAB9C, 0x73F4, 0xAB9D, 0x73F5, 0xAB9E, 0x73F6, 0xAB9F, - 0x73F7, 0xABA0, 0x73F8, 0xAC40, 0x73F9, 0xAC41, 0x73FA, 0xAC42, - 0x73FB, 0xAC43, 0x73FC, 0xAC44, 0x73FD, 0xAC45, 0x73FE, 0xAC46, - 0x73FF, 0xAC47, 0x7400, 0xAC48, 0x7401, 0xAC49, 0x7402, 0xAC4A, - 0x7403, 0xC7F2, 0x7404, 0xAC4B, 0x7405, 0xC0C5, 0x7406, 0xC0ED, - 0x7407, 0xAC4C, 0x7408, 0xAC4D, 0x7409, 0xC1F0, 0x740A, 0xE7F0, - 0x740B, 0xAC4E, 0x740C, 0xAC4F, 0x740D, 0xAC50, 0x740E, 0xAC51, - 0x740F, 0xE7F6, 0x7410, 0xCBF6, 0x7411, 0xAC52, 0x7412, 0xAC53, - 0x7413, 0xAC54, 0x7414, 0xAC55, 0x7415, 0xAC56, 0x7416, 0xAC57, - 0x7417, 0xAC58, 0x7418, 0xAC59, 0x7419, 0xAC5A, 0x741A, 0xE8A2, - 0x741B, 0xE8A1, 0x741C, 0xAC5B, 0x741D, 0xAC5C, 0x741E, 0xAC5D, - 0x741F, 0xAC5E, 0x7420, 0xAC5F, 0x7421, 0xAC60, 0x7422, 0xD7C1, - 0x7423, 0xAC61, 0x7424, 0xAC62, 0x7425, 0xE7FA, 0x7426, 0xE7F9, - 0x7427, 0xAC63, 0x7428, 0xE7FB, 0x7429, 0xAC64, 0x742A, 0xE7F7, - 0x742B, 0xAC65, 0x742C, 0xE7FE, 0x742D, 0xAC66, 0x742E, 0xE7FD, - 0x742F, 0xAC67, 0x7430, 0xE7FC, 0x7431, 0xAC68, 0x7432, 0xAC69, - 0x7433, 0xC1D5, 0x7434, 0xC7D9, 0x7435, 0xC5FD, 0x7436, 0xC5C3, - 0x7437, 0xAC6A, 0x7438, 0xAC6B, 0x7439, 0xAC6C, 0x743A, 0xAC6D, - 0x743B, 0xAC6E, 0x743C, 0xC7ED, 0x743D, 0xAC6F, 0x743E, 0xAC70, - 0x743F, 0xAC71, 0x7440, 0xAC72, 0x7441, 0xE8A3, 0x7442, 0xAC73, - 0x7443, 0xAC74, 0x7444, 0xAC75, 0x7445, 0xAC76, 0x7446, 0xAC77, - 0x7447, 0xAC78, 0x7448, 0xAC79, 0x7449, 0xAC7A, 0x744A, 0xAC7B, - 0x744B, 0xAC7C, 0x744C, 0xAC7D, 0x744D, 0xAC7E, 0x744E, 0xAC80, - 0x744F, 0xAC81, 0x7450, 0xAC82, 0x7451, 0xAC83, 0x7452, 0xAC84, - 0x7453, 0xAC85, 0x7454, 0xAC86, 0x7455, 0xE8A6, 0x7456, 0xAC87, - 0x7457, 0xE8A5, 0x7458, 0xAC88, 0x7459, 0xE8A7, 0x745A, 0xBAF7, - 0x745B, 0xE7F8, 0x745C, 0xE8A4, 0x745D, 0xAC89, 0x745E, 0xC8F0, - 0x745F, 0xC9AA, 0x7460, 0xAC8A, 0x7461, 0xAC8B, 0x7462, 0xAC8C, - 0x7463, 0xAC8D, 0x7464, 0xAC8E, 0x7465, 0xAC8F, 0x7466, 0xAC90, - 0x7467, 0xAC91, 0x7468, 0xAC92, 0x7469, 0xAC93, 0x746A, 0xAC94, - 0x746B, 0xAC95, 0x746C, 0xAC96, 0x746D, 0xE8A9, 0x746E, 0xAC97, - 0x746F, 0xAC98, 0x7470, 0xB9E5, 0x7471, 0xAC99, 0x7472, 0xAC9A, - 0x7473, 0xAC9B, 0x7474, 0xAC9C, 0x7475, 0xAC9D, 0x7476, 0xD1FE, - 0x7477, 0xE8A8, 0x7478, 0xAC9E, 0x7479, 0xAC9F, 0x747A, 0xACA0, - 0x747B, 0xAD40, 0x747C, 0xAD41, 0x747D, 0xAD42, 0x747E, 0xE8AA, - 0x747F, 0xAD43, 0x7480, 0xE8AD, 0x7481, 0xE8AE, 0x7482, 0xAD44, - 0x7483, 0xC1A7, 0x7484, 0xAD45, 0x7485, 0xAD46, 0x7486, 0xAD47, - 0x7487, 0xE8AF, 0x7488, 0xAD48, 0x7489, 0xAD49, 0x748A, 0xAD4A, - 0x748B, 0xE8B0, 0x748C, 0xAD4B, 0x748D, 0xAD4C, 0x748E, 0xE8AC, - 0x748F, 0xAD4D, 0x7490, 0xE8B4, 0x7491, 0xAD4E, 0x7492, 0xAD4F, - 0x7493, 0xAD50, 0x7494, 0xAD51, 0x7495, 0xAD52, 0x7496, 0xAD53, - 0x7497, 0xAD54, 0x7498, 0xAD55, 0x7499, 0xAD56, 0x749A, 0xAD57, - 0x749B, 0xAD58, 0x749C, 0xE8AB, 0x749D, 0xAD59, 0x749E, 0xE8B1, - 0x749F, 0xAD5A, 0x74A0, 0xAD5B, 0x74A1, 0xAD5C, 0x74A2, 0xAD5D, - 0x74A3, 0xAD5E, 0x74A4, 0xAD5F, 0x74A5, 0xAD60, 0x74A6, 0xAD61, - 0x74A7, 0xE8B5, 0x74A8, 0xE8B2, 0x74A9, 0xE8B3, 0x74AA, 0xAD62, - 0x74AB, 0xAD63, 0x74AC, 0xAD64, 0x74AD, 0xAD65, 0x74AE, 0xAD66, - 0x74AF, 0xAD67, 0x74B0, 0xAD68, 0x74B1, 0xAD69, 0x74B2, 0xAD6A, - 0x74B3, 0xAD6B, 0x74B4, 0xAD6C, 0x74B5, 0xAD6D, 0x74B6, 0xAD6E, - 0x74B7, 0xAD6F, 0x74B8, 0xAD70, 0x74B9, 0xAD71, 0x74BA, 0xE8B7, - 0x74BB, 0xAD72, 0x74BC, 0xAD73, 0x74BD, 0xAD74, 0x74BE, 0xAD75, - 0x74BF, 0xAD76, 0x74C0, 0xAD77, 0x74C1, 0xAD78, 0x74C2, 0xAD79, - 0x74C3, 0xAD7A, 0x74C4, 0xAD7B, 0x74C5, 0xAD7C, 0x74C6, 0xAD7D, - 0x74C7, 0xAD7E, 0x74C8, 0xAD80, 0x74C9, 0xAD81, 0x74CA, 0xAD82, - 0x74CB, 0xAD83, 0x74CC, 0xAD84, 0x74CD, 0xAD85, 0x74CE, 0xAD86, - 0x74CF, 0xAD87, 0x74D0, 0xAD88, 0x74D1, 0xAD89, 0x74D2, 0xE8B6, - 0x74D3, 0xAD8A, 0x74D4, 0xAD8B, 0x74D5, 0xAD8C, 0x74D6, 0xAD8D, - 0x74D7, 0xAD8E, 0x74D8, 0xAD8F, 0x74D9, 0xAD90, 0x74DA, 0xAD91, - 0x74DB, 0xAD92, 0x74DC, 0xB9CF, 0x74DD, 0xAD93, 0x74DE, 0xF0AC, - 0x74DF, 0xAD94, 0x74E0, 0xF0AD, 0x74E1, 0xAD95, 0x74E2, 0xC6B0, - 0x74E3, 0xB0EA, 0x74E4, 0xC8BF, 0x74E5, 0xAD96, 0x74E6, 0xCDDF, - 0x74E7, 0xAD97, 0x74E8, 0xAD98, 0x74E9, 0xAD99, 0x74EA, 0xAD9A, - 0x74EB, 0xAD9B, 0x74EC, 0xAD9C, 0x74ED, 0xAD9D, 0x74EE, 0xCECD, - 0x74EF, 0xEAB1, 0x74F0, 0xAD9E, 0x74F1, 0xAD9F, 0x74F2, 0xADA0, - 0x74F3, 0xAE40, 0x74F4, 0xEAB2, 0x74F5, 0xAE41, 0x74F6, 0xC6BF, - 0x74F7, 0xB4C9, 0x74F8, 0xAE42, 0x74F9, 0xAE43, 0x74FA, 0xAE44, - 0x74FB, 0xAE45, 0x74FC, 0xAE46, 0x74FD, 0xAE47, 0x74FE, 0xAE48, - 0x74FF, 0xEAB3, 0x7500, 0xAE49, 0x7501, 0xAE4A, 0x7502, 0xAE4B, - 0x7503, 0xAE4C, 0x7504, 0xD5E7, 0x7505, 0xAE4D, 0x7506, 0xAE4E, - 0x7507, 0xAE4F, 0x7508, 0xAE50, 0x7509, 0xAE51, 0x750A, 0xAE52, - 0x750B, 0xAE53, 0x750C, 0xAE54, 0x750D, 0xDDF9, 0x750E, 0xAE55, - 0x750F, 0xEAB4, 0x7510, 0xAE56, 0x7511, 0xEAB5, 0x7512, 0xAE57, - 0x7513, 0xEAB6, 0x7514, 0xAE58, 0x7515, 0xAE59, 0x7516, 0xAE5A, - 0x7517, 0xAE5B, 0x7518, 0xB8CA, 0x7519, 0xDFB0, 0x751A, 0xC9F5, - 0x751B, 0xAE5C, 0x751C, 0xCCF0, 0x751D, 0xAE5D, 0x751E, 0xAE5E, - 0x751F, 0xC9FA, 0x7520, 0xAE5F, 0x7521, 0xAE60, 0x7522, 0xAE61, - 0x7523, 0xAE62, 0x7524, 0xAE63, 0x7525, 0xC9FB, 0x7526, 0xAE64, - 0x7527, 0xAE65, 0x7528, 0xD3C3, 0x7529, 0xCBA6, 0x752A, 0xAE66, - 0x752B, 0xB8A6, 0x752C, 0xF0AE, 0x752D, 0xB1C2, 0x752E, 0xAE67, - 0x752F, 0xE5B8, 0x7530, 0xCCEF, 0x7531, 0xD3C9, 0x7532, 0xBCD7, - 0x7533, 0xC9EA, 0x7534, 0xAE68, 0x7535, 0xB5E7, 0x7536, 0xAE69, - 0x7537, 0xC4D0, 0x7538, 0xB5E9, 0x7539, 0xAE6A, 0x753A, 0xEEAE, - 0x753B, 0xBBAD, 0x753C, 0xAE6B, 0x753D, 0xAE6C, 0x753E, 0xE7DE, - 0x753F, 0xAE6D, 0x7540, 0xEEAF, 0x7541, 0xAE6E, 0x7542, 0xAE6F, - 0x7543, 0xAE70, 0x7544, 0xAE71, 0x7545, 0xB3A9, 0x7546, 0xAE72, - 0x7547, 0xAE73, 0x7548, 0xEEB2, 0x7549, 0xAE74, 0x754A, 0xAE75, - 0x754B, 0xEEB1, 0x754C, 0xBDE7, 0x754D, 0xAE76, 0x754E, 0xEEB0, - 0x754F, 0xCEB7, 0x7550, 0xAE77, 0x7551, 0xAE78, 0x7552, 0xAE79, - 0x7553, 0xAE7A, 0x7554, 0xC5CF, 0x7555, 0xAE7B, 0x7556, 0xAE7C, - 0x7557, 0xAE7D, 0x7558, 0xAE7E, 0x7559, 0xC1F4, 0x755A, 0xDBCE, - 0x755B, 0xEEB3, 0x755C, 0xD0F3, 0x755D, 0xAE80, 0x755E, 0xAE81, - 0x755F, 0xAE82, 0x7560, 0xAE83, 0x7561, 0xAE84, 0x7562, 0xAE85, - 0x7563, 0xAE86, 0x7564, 0xAE87, 0x7565, 0xC2D4, 0x7566, 0xC6E8, - 0x7567, 0xAE88, 0x7568, 0xAE89, 0x7569, 0xAE8A, 0x756A, 0xB7AC, - 0x756B, 0xAE8B, 0x756C, 0xAE8C, 0x756D, 0xAE8D, 0x756E, 0xAE8E, - 0x756F, 0xAE8F, 0x7570, 0xAE90, 0x7571, 0xAE91, 0x7572, 0xEEB4, - 0x7573, 0xAE92, 0x7574, 0xB3EB, 0x7575, 0xAE93, 0x7576, 0xAE94, - 0x7577, 0xAE95, 0x7578, 0xBBFB, 0x7579, 0xEEB5, 0x757A, 0xAE96, - 0x757B, 0xAE97, 0x757C, 0xAE98, 0x757D, 0xAE99, 0x757E, 0xAE9A, - 0x757F, 0xE7DC, 0x7580, 0xAE9B, 0x7581, 0xAE9C, 0x7582, 0xAE9D, - 0x7583, 0xEEB6, 0x7584, 0xAE9E, 0x7585, 0xAE9F, 0x7586, 0xBDAE, - 0x7587, 0xAEA0, 0x7588, 0xAF40, 0x7589, 0xAF41, 0x758A, 0xAF42, - 0x758B, 0xF1E2, 0x758C, 0xAF43, 0x758D, 0xAF44, 0x758E, 0xAF45, - 0x758F, 0xCAE8, 0x7590, 0xAF46, 0x7591, 0xD2C9, 0x7592, 0xF0DA, - 0x7593, 0xAF47, 0x7594, 0xF0DB, 0x7595, 0xAF48, 0x7596, 0xF0DC, - 0x7597, 0xC1C6, 0x7598, 0xAF49, 0x7599, 0xB8ED, 0x759A, 0xBECE, - 0x759B, 0xAF4A, 0x759C, 0xAF4B, 0x759D, 0xF0DE, 0x759E, 0xAF4C, - 0x759F, 0xC5B1, 0x75A0, 0xF0DD, 0x75A1, 0xD1F1, 0x75A2, 0xAF4D, - 0x75A3, 0xF0E0, 0x75A4, 0xB0CC, 0x75A5, 0xBDEA, 0x75A6, 0xAF4E, - 0x75A7, 0xAF4F, 0x75A8, 0xAF50, 0x75A9, 0xAF51, 0x75AA, 0xAF52, - 0x75AB, 0xD2DF, 0x75AC, 0xF0DF, 0x75AD, 0xAF53, 0x75AE, 0xB4AF, - 0x75AF, 0xB7E8, 0x75B0, 0xF0E6, 0x75B1, 0xF0E5, 0x75B2, 0xC6A3, - 0x75B3, 0xF0E1, 0x75B4, 0xF0E2, 0x75B5, 0xB4C3, 0x75B6, 0xAF54, - 0x75B7, 0xAF55, 0x75B8, 0xF0E3, 0x75B9, 0xD5EE, 0x75BA, 0xAF56, - 0x75BB, 0xAF57, 0x75BC, 0xCCDB, 0x75BD, 0xBED2, 0x75BE, 0xBCB2, - 0x75BF, 0xAF58, 0x75C0, 0xAF59, 0x75C1, 0xAF5A, 0x75C2, 0xF0E8, - 0x75C3, 0xF0E7, 0x75C4, 0xF0E4, 0x75C5, 0xB2A1, 0x75C6, 0xAF5B, - 0x75C7, 0xD6A2, 0x75C8, 0xD3B8, 0x75C9, 0xBEB7, 0x75CA, 0xC8AC, - 0x75CB, 0xAF5C, 0x75CC, 0xAF5D, 0x75CD, 0xF0EA, 0x75CE, 0xAF5E, - 0x75CF, 0xAF5F, 0x75D0, 0xAF60, 0x75D1, 0xAF61, 0x75D2, 0xD1F7, - 0x75D3, 0xAF62, 0x75D4, 0xD6CC, 0x75D5, 0xBADB, 0x75D6, 0xF0E9, - 0x75D7, 0xAF63, 0x75D8, 0xB6BB, 0x75D9, 0xAF64, 0x75DA, 0xAF65, - 0x75DB, 0xCDB4, 0x75DC, 0xAF66, 0x75DD, 0xAF67, 0x75DE, 0xC6A6, - 0x75DF, 0xAF68, 0x75E0, 0xAF69, 0x75E1, 0xAF6A, 0x75E2, 0xC1A1, - 0x75E3, 0xF0EB, 0x75E4, 0xF0EE, 0x75E5, 0xAF6B, 0x75E6, 0xF0ED, - 0x75E7, 0xF0F0, 0x75E8, 0xF0EC, 0x75E9, 0xAF6C, 0x75EA, 0xBBBE, - 0x75EB, 0xF0EF, 0x75EC, 0xAF6D, 0x75ED, 0xAF6E, 0x75EE, 0xAF6F, - 0x75EF, 0xAF70, 0x75F0, 0xCCB5, 0x75F1, 0xF0F2, 0x75F2, 0xAF71, - 0x75F3, 0xAF72, 0x75F4, 0xB3D5, 0x75F5, 0xAF73, 0x75F6, 0xAF74, - 0x75F7, 0xAF75, 0x75F8, 0xAF76, 0x75F9, 0xB1D4, 0x75FA, 0xAF77, - 0x75FB, 0xAF78, 0x75FC, 0xF0F3, 0x75FD, 0xAF79, 0x75FE, 0xAF7A, - 0x75FF, 0xF0F4, 0x7600, 0xF0F6, 0x7601, 0xB4E1, 0x7602, 0xAF7B, - 0x7603, 0xF0F1, 0x7604, 0xAF7C, 0x7605, 0xF0F7, 0x7606, 0xAF7D, - 0x7607, 0xAF7E, 0x7608, 0xAF80, 0x7609, 0xAF81, 0x760A, 0xF0FA, - 0x760B, 0xAF82, 0x760C, 0xF0F8, 0x760D, 0xAF83, 0x760E, 0xAF84, - 0x760F, 0xAF85, 0x7610, 0xF0F5, 0x7611, 0xAF86, 0x7612, 0xAF87, - 0x7613, 0xAF88, 0x7614, 0xAF89, 0x7615, 0xF0FD, 0x7616, 0xAF8A, - 0x7617, 0xF0F9, 0x7618, 0xF0FC, 0x7619, 0xF0FE, 0x761A, 0xAF8B, - 0x761B, 0xF1A1, 0x761C, 0xAF8C, 0x761D, 0xAF8D, 0x761E, 0xAF8E, - 0x761F, 0xCEC1, 0x7620, 0xF1A4, 0x7621, 0xAF8F, 0x7622, 0xF1A3, - 0x7623, 0xAF90, 0x7624, 0xC1F6, 0x7625, 0xF0FB, 0x7626, 0xCADD, - 0x7627, 0xAF91, 0x7628, 0xAF92, 0x7629, 0xB4F1, 0x762A, 0xB1F1, - 0x762B, 0xCCB1, 0x762C, 0xAF93, 0x762D, 0xF1A6, 0x762E, 0xAF94, - 0x762F, 0xAF95, 0x7630, 0xF1A7, 0x7631, 0xAF96, 0x7632, 0xAF97, - 0x7633, 0xF1AC, 0x7634, 0xD5CE, 0x7635, 0xF1A9, 0x7636, 0xAF98, - 0x7637, 0xAF99, 0x7638, 0xC8B3, 0x7639, 0xAF9A, 0x763A, 0xAF9B, - 0x763B, 0xAF9C, 0x763C, 0xF1A2, 0x763D, 0xAF9D, 0x763E, 0xF1AB, - 0x763F, 0xF1A8, 0x7640, 0xF1A5, 0x7641, 0xAF9E, 0x7642, 0xAF9F, - 0x7643, 0xF1AA, 0x7644, 0xAFA0, 0x7645, 0xB040, 0x7646, 0xB041, - 0x7647, 0xB042, 0x7648, 0xB043, 0x7649, 0xB044, 0x764A, 0xB045, - 0x764B, 0xB046, 0x764C, 0xB0A9, 0x764D, 0xF1AD, 0x764E, 0xB047, - 0x764F, 0xB048, 0x7650, 0xB049, 0x7651, 0xB04A, 0x7652, 0xB04B, - 0x7653, 0xB04C, 0x7654, 0xF1AF, 0x7655, 0xB04D, 0x7656, 0xF1B1, - 0x7657, 0xB04E, 0x7658, 0xB04F, 0x7659, 0xB050, 0x765A, 0xB051, - 0x765B, 0xB052, 0x765C, 0xF1B0, 0x765D, 0xB053, 0x765E, 0xF1AE, - 0x765F, 0xB054, 0x7660, 0xB055, 0x7661, 0xB056, 0x7662, 0xB057, - 0x7663, 0xD1A2, 0x7664, 0xB058, 0x7665, 0xB059, 0x7666, 0xB05A, - 0x7667, 0xB05B, 0x7668, 0xB05C, 0x7669, 0xB05D, 0x766A, 0xB05E, - 0x766B, 0xF1B2, 0x766C, 0xB05F, 0x766D, 0xB060, 0x766E, 0xB061, - 0x766F, 0xF1B3, 0x7670, 0xB062, 0x7671, 0xB063, 0x7672, 0xB064, - 0x7673, 0xB065, 0x7674, 0xB066, 0x7675, 0xB067, 0x7676, 0xB068, - 0x7677, 0xB069, 0x7678, 0xB9EF, 0x7679, 0xB06A, 0x767A, 0xB06B, - 0x767B, 0xB5C7, 0x767C, 0xB06C, 0x767D, 0xB0D7, 0x767E, 0xB0D9, - 0x767F, 0xB06D, 0x7680, 0xB06E, 0x7681, 0xB06F, 0x7682, 0xD4ED, - 0x7683, 0xB070, 0x7684, 0xB5C4, 0x7685, 0xB071, 0x7686, 0xBDD4, - 0x7687, 0xBBCA, 0x7688, 0xF0A7, 0x7689, 0xB072, 0x768A, 0xB073, - 0x768B, 0xB8DE, 0x768C, 0xB074, 0x768D, 0xB075, 0x768E, 0xF0A8, - 0x768F, 0xB076, 0x7690, 0xB077, 0x7691, 0xB0A8, 0x7692, 0xB078, - 0x7693, 0xF0A9, 0x7694, 0xB079, 0x7695, 0xB07A, 0x7696, 0xCDEE, - 0x7697, 0xB07B, 0x7698, 0xB07C, 0x7699, 0xF0AA, 0x769A, 0xB07D, - 0x769B, 0xB07E, 0x769C, 0xB080, 0x769D, 0xB081, 0x769E, 0xB082, - 0x769F, 0xB083, 0x76A0, 0xB084, 0x76A1, 0xB085, 0x76A2, 0xB086, - 0x76A3, 0xB087, 0x76A4, 0xF0AB, 0x76A5, 0xB088, 0x76A6, 0xB089, - 0x76A7, 0xB08A, 0x76A8, 0xB08B, 0x76A9, 0xB08C, 0x76AA, 0xB08D, - 0x76AB, 0xB08E, 0x76AC, 0xB08F, 0x76AD, 0xB090, 0x76AE, 0xC6A4, - 0x76AF, 0xB091, 0x76B0, 0xB092, 0x76B1, 0xD6E5, 0x76B2, 0xF1E4, - 0x76B3, 0xB093, 0x76B4, 0xF1E5, 0x76B5, 0xB094, 0x76B6, 0xB095, - 0x76B7, 0xB096, 0x76B8, 0xB097, 0x76B9, 0xB098, 0x76BA, 0xB099, - 0x76BB, 0xB09A, 0x76BC, 0xB09B, 0x76BD, 0xB09C, 0x76BE, 0xB09D, - 0x76BF, 0xC3F3, 0x76C0, 0xB09E, 0x76C1, 0xB09F, 0x76C2, 0xD3DB, - 0x76C3, 0xB0A0, 0x76C4, 0xB140, 0x76C5, 0xD6D1, 0x76C6, 0xC5E8, - 0x76C7, 0xB141, 0x76C8, 0xD3AF, 0x76C9, 0xB142, 0x76CA, 0xD2E6, - 0x76CB, 0xB143, 0x76CC, 0xB144, 0x76CD, 0xEEC1, 0x76CE, 0xB0BB, - 0x76CF, 0xD5B5, 0x76D0, 0xD1CE, 0x76D1, 0xBCE0, 0x76D2, 0xBAD0, - 0x76D3, 0xB145, 0x76D4, 0xBFF8, 0x76D5, 0xB146, 0x76D6, 0xB8C7, - 0x76D7, 0xB5C1, 0x76D8, 0xC5CC, 0x76D9, 0xB147, 0x76DA, 0xB148, - 0x76DB, 0xCAA2, 0x76DC, 0xB149, 0x76DD, 0xB14A, 0x76DE, 0xB14B, - 0x76DF, 0xC3CB, 0x76E0, 0xB14C, 0x76E1, 0xB14D, 0x76E2, 0xB14E, - 0x76E3, 0xB14F, 0x76E4, 0xB150, 0x76E5, 0xEEC2, 0x76E6, 0xB151, - 0x76E7, 0xB152, 0x76E8, 0xB153, 0x76E9, 0xB154, 0x76EA, 0xB155, - 0x76EB, 0xB156, 0x76EC, 0xB157, 0x76ED, 0xB158, 0x76EE, 0xC4BF, - 0x76EF, 0xB6A2, 0x76F0, 0xB159, 0x76F1, 0xEDEC, 0x76F2, 0xC3A4, - 0x76F3, 0xB15A, 0x76F4, 0xD6B1, 0x76F5, 0xB15B, 0x76F6, 0xB15C, - 0x76F7, 0xB15D, 0x76F8, 0xCFE0, 0x76F9, 0xEDEF, 0x76FA, 0xB15E, - 0x76FB, 0xB15F, 0x76FC, 0xC5CE, 0x76FD, 0xB160, 0x76FE, 0xB6DC, - 0x76FF, 0xB161, 0x7700, 0xB162, 0x7701, 0xCAA1, 0x7702, 0xB163, - 0x7703, 0xB164, 0x7704, 0xEDED, 0x7705, 0xB165, 0x7706, 0xB166, - 0x7707, 0xEDF0, 0x7708, 0xEDF1, 0x7709, 0xC3BC, 0x770A, 0xB167, - 0x770B, 0xBFB4, 0x770C, 0xB168, 0x770D, 0xEDEE, 0x770E, 0xB169, - 0x770F, 0xB16A, 0x7710, 0xB16B, 0x7711, 0xB16C, 0x7712, 0xB16D, - 0x7713, 0xB16E, 0x7714, 0xB16F, 0x7715, 0xB170, 0x7716, 0xB171, - 0x7717, 0xB172, 0x7718, 0xB173, 0x7719, 0xEDF4, 0x771A, 0xEDF2, - 0x771B, 0xB174, 0x771C, 0xB175, 0x771D, 0xB176, 0x771E, 0xB177, - 0x771F, 0xD5E6, 0x7720, 0xC3DF, 0x7721, 0xB178, 0x7722, 0xEDF3, - 0x7723, 0xB179, 0x7724, 0xB17A, 0x7725, 0xB17B, 0x7726, 0xEDF6, - 0x7727, 0xB17C, 0x7728, 0xD5A3, 0x7729, 0xD1A3, 0x772A, 0xB17D, - 0x772B, 0xB17E, 0x772C, 0xB180, 0x772D, 0xEDF5, 0x772E, 0xB181, - 0x772F, 0xC3D0, 0x7730, 0xB182, 0x7731, 0xB183, 0x7732, 0xB184, - 0x7733, 0xB185, 0x7734, 0xB186, 0x7735, 0xEDF7, 0x7736, 0xBFF4, - 0x7737, 0xBEEC, 0x7738, 0xEDF8, 0x7739, 0xB187, 0x773A, 0xCCF7, - 0x773B, 0xB188, 0x773C, 0xD1DB, 0x773D, 0xB189, 0x773E, 0xB18A, - 0x773F, 0xB18B, 0x7740, 0xD7C5, 0x7741, 0xD5F6, 0x7742, 0xB18C, - 0x7743, 0xEDFC, 0x7744, 0xB18D, 0x7745, 0xB18E, 0x7746, 0xB18F, - 0x7747, 0xEDFB, 0x7748, 0xB190, 0x7749, 0xB191, 0x774A, 0xB192, - 0x774B, 0xB193, 0x774C, 0xB194, 0x774D, 0xB195, 0x774E, 0xB196, - 0x774F, 0xB197, 0x7750, 0xEDF9, 0x7751, 0xEDFA, 0x7752, 0xB198, - 0x7753, 0xB199, 0x7754, 0xB19A, 0x7755, 0xB19B, 0x7756, 0xB19C, - 0x7757, 0xB19D, 0x7758, 0xB19E, 0x7759, 0xB19F, 0x775A, 0xEDFD, - 0x775B, 0xBEA6, 0x775C, 0xB1A0, 0x775D, 0xB240, 0x775E, 0xB241, - 0x775F, 0xB242, 0x7760, 0xB243, 0x7761, 0xCBAF, 0x7762, 0xEEA1, - 0x7763, 0xB6BD, 0x7764, 0xB244, 0x7765, 0xEEA2, 0x7766, 0xC4C0, - 0x7767, 0xB245, 0x7768, 0xEDFE, 0x7769, 0xB246, 0x776A, 0xB247, - 0x776B, 0xBDDE, 0x776C, 0xB2C7, 0x776D, 0xB248, 0x776E, 0xB249, - 0x776F, 0xB24A, 0x7770, 0xB24B, 0x7771, 0xB24C, 0x7772, 0xB24D, - 0x7773, 0xB24E, 0x7774, 0xB24F, 0x7775, 0xB250, 0x7776, 0xB251, - 0x7777, 0xB252, 0x7778, 0xB253, 0x7779, 0xB6C3, 0x777A, 0xB254, - 0x777B, 0xB255, 0x777C, 0xB256, 0x777D, 0xEEA5, 0x777E, 0xD8BA, - 0x777F, 0xEEA3, 0x7780, 0xEEA6, 0x7781, 0xB257, 0x7782, 0xB258, - 0x7783, 0xB259, 0x7784, 0xC3E9, 0x7785, 0xB3F2, 0x7786, 0xB25A, - 0x7787, 0xB25B, 0x7788, 0xB25C, 0x7789, 0xB25D, 0x778A, 0xB25E, - 0x778B, 0xB25F, 0x778C, 0xEEA7, 0x778D, 0xEEA4, 0x778E, 0xCFB9, - 0x778F, 0xB260, 0x7790, 0xB261, 0x7791, 0xEEA8, 0x7792, 0xC2F7, - 0x7793, 0xB262, 0x7794, 0xB263, 0x7795, 0xB264, 0x7796, 0xB265, - 0x7797, 0xB266, 0x7798, 0xB267, 0x7799, 0xB268, 0x779A, 0xB269, - 0x779B, 0xB26A, 0x779C, 0xB26B, 0x779D, 0xB26C, 0x779E, 0xB26D, - 0x779F, 0xEEA9, 0x77A0, 0xEEAA, 0x77A1, 0xB26E, 0x77A2, 0xDEAB, - 0x77A3, 0xB26F, 0x77A4, 0xB270, 0x77A5, 0xC6B3, 0x77A6, 0xB271, - 0x77A7, 0xC7C6, 0x77A8, 0xB272, 0x77A9, 0xD6F5, 0x77AA, 0xB5C9, - 0x77AB, 0xB273, 0x77AC, 0xCBB2, 0x77AD, 0xB274, 0x77AE, 0xB275, - 0x77AF, 0xB276, 0x77B0, 0xEEAB, 0x77B1, 0xB277, 0x77B2, 0xB278, - 0x77B3, 0xCDAB, 0x77B4, 0xB279, 0x77B5, 0xEEAC, 0x77B6, 0xB27A, - 0x77B7, 0xB27B, 0x77B8, 0xB27C, 0x77B9, 0xB27D, 0x77BA, 0xB27E, - 0x77BB, 0xD5B0, 0x77BC, 0xB280, 0x77BD, 0xEEAD, 0x77BE, 0xB281, - 0x77BF, 0xF6C4, 0x77C0, 0xB282, 0x77C1, 0xB283, 0x77C2, 0xB284, - 0x77C3, 0xB285, 0x77C4, 0xB286, 0x77C5, 0xB287, 0x77C6, 0xB288, - 0x77C7, 0xB289, 0x77C8, 0xB28A, 0x77C9, 0xB28B, 0x77CA, 0xB28C, - 0x77CB, 0xB28D, 0x77CC, 0xB28E, 0x77CD, 0xDBC7, 0x77CE, 0xB28F, - 0x77CF, 0xB290, 0x77D0, 0xB291, 0x77D1, 0xB292, 0x77D2, 0xB293, - 0x77D3, 0xB294, 0x77D4, 0xB295, 0x77D5, 0xB296, 0x77D6, 0xB297, - 0x77D7, 0xB4A3, 0x77D8, 0xB298, 0x77D9, 0xB299, 0x77DA, 0xB29A, - 0x77DB, 0xC3AC, 0x77DC, 0xF1E6, 0x77DD, 0xB29B, 0x77DE, 0xB29C, - 0x77DF, 0xB29D, 0x77E0, 0xB29E, 0x77E1, 0xB29F, 0x77E2, 0xCAB8, - 0x77E3, 0xD2D3, 0x77E4, 0xB2A0, 0x77E5, 0xD6AA, 0x77E6, 0xB340, - 0x77E7, 0xEFF2, 0x77E8, 0xB341, 0x77E9, 0xBED8, 0x77EA, 0xB342, - 0x77EB, 0xBDC3, 0x77EC, 0xEFF3, 0x77ED, 0xB6CC, 0x77EE, 0xB0AB, - 0x77EF, 0xB343, 0x77F0, 0xB344, 0x77F1, 0xB345, 0x77F2, 0xB346, - 0x77F3, 0xCAAF, 0x77F4, 0xB347, 0x77F5, 0xB348, 0x77F6, 0xEDB6, - 0x77F7, 0xB349, 0x77F8, 0xEDB7, 0x77F9, 0xB34A, 0x77FA, 0xB34B, - 0x77FB, 0xB34C, 0x77FC, 0xB34D, 0x77FD, 0xCEF9, 0x77FE, 0xB7AF, - 0x77FF, 0xBFF3, 0x7800, 0xEDB8, 0x7801, 0xC2EB, 0x7802, 0xC9B0, - 0x7803, 0xB34E, 0x7804, 0xB34F, 0x7805, 0xB350, 0x7806, 0xB351, - 0x7807, 0xB352, 0x7808, 0xB353, 0x7809, 0xEDB9, 0x780A, 0xB354, - 0x780B, 0xB355, 0x780C, 0xC6F6, 0x780D, 0xBFB3, 0x780E, 0xB356, - 0x780F, 0xB357, 0x7810, 0xB358, 0x7811, 0xEDBC, 0x7812, 0xC5F8, - 0x7813, 0xB359, 0x7814, 0xD1D0, 0x7815, 0xB35A, 0x7816, 0xD7A9, - 0x7817, 0xEDBA, 0x7818, 0xEDBB, 0x7819, 0xB35B, 0x781A, 0xD1E2, - 0x781B, 0xB35C, 0x781C, 0xEDBF, 0x781D, 0xEDC0, 0x781E, 0xB35D, - 0x781F, 0xEDC4, 0x7820, 0xB35E, 0x7821, 0xB35F, 0x7822, 0xB360, - 0x7823, 0xEDC8, 0x7824, 0xB361, 0x7825, 0xEDC6, 0x7826, 0xEDCE, - 0x7827, 0xD5E8, 0x7828, 0xB362, 0x7829, 0xEDC9, 0x782A, 0xB363, - 0x782B, 0xB364, 0x782C, 0xEDC7, 0x782D, 0xEDBE, 0x782E, 0xB365, - 0x782F, 0xB366, 0x7830, 0xC5E9, 0x7831, 0xB367, 0x7832, 0xB368, - 0x7833, 0xB369, 0x7834, 0xC6C6, 0x7835, 0xB36A, 0x7836, 0xB36B, - 0x7837, 0xC9E9, 0x7838, 0xD4D2, 0x7839, 0xEDC1, 0x783A, 0xEDC2, - 0x783B, 0xEDC3, 0x783C, 0xEDC5, 0x783D, 0xB36C, 0x783E, 0xC0F9, - 0x783F, 0xB36D, 0x7840, 0xB4A1, 0x7841, 0xB36E, 0x7842, 0xB36F, - 0x7843, 0xB370, 0x7844, 0xB371, 0x7845, 0xB9E8, 0x7846, 0xB372, - 0x7847, 0xEDD0, 0x7848, 0xB373, 0x7849, 0xB374, 0x784A, 0xB375, - 0x784B, 0xB376, 0x784C, 0xEDD1, 0x784D, 0xB377, 0x784E, 0xEDCA, - 0x784F, 0xB378, 0x7850, 0xEDCF, 0x7851, 0xB379, 0x7852, 0xCEF8, - 0x7853, 0xB37A, 0x7854, 0xB37B, 0x7855, 0xCBB6, 0x7856, 0xEDCC, - 0x7857, 0xEDCD, 0x7858, 0xB37C, 0x7859, 0xB37D, 0x785A, 0xB37E, - 0x785B, 0xB380, 0x785C, 0xB381, 0x785D, 0xCFF5, 0x785E, 0xB382, - 0x785F, 0xB383, 0x7860, 0xB384, 0x7861, 0xB385, 0x7862, 0xB386, - 0x7863, 0xB387, 0x7864, 0xB388, 0x7865, 0xB389, 0x7866, 0xB38A, - 0x7867, 0xB38B, 0x7868, 0xB38C, 0x7869, 0xB38D, 0x786A, 0xEDD2, - 0x786B, 0xC1F2, 0x786C, 0xD3B2, 0x786D, 0xEDCB, 0x786E, 0xC8B7, - 0x786F, 0xB38E, 0x7870, 0xB38F, 0x7871, 0xB390, 0x7872, 0xB391, - 0x7873, 0xB392, 0x7874, 0xB393, 0x7875, 0xB394, 0x7876, 0xB395, - 0x7877, 0xBCEF, 0x7878, 0xB396, 0x7879, 0xB397, 0x787A, 0xB398, - 0x787B, 0xB399, 0x787C, 0xC5F0, 0x787D, 0xB39A, 0x787E, 0xB39B, - 0x787F, 0xB39C, 0x7880, 0xB39D, 0x7881, 0xB39E, 0x7882, 0xB39F, - 0x7883, 0xB3A0, 0x7884, 0xB440, 0x7885, 0xB441, 0x7886, 0xB442, - 0x7887, 0xEDD6, 0x7888, 0xB443, 0x7889, 0xB5EF, 0x788A, 0xB444, - 0x788B, 0xB445, 0x788C, 0xC2B5, 0x788D, 0xB0AD, 0x788E, 0xCBE9, - 0x788F, 0xB446, 0x7890, 0xB447, 0x7891, 0xB1AE, 0x7892, 0xB448, - 0x7893, 0xEDD4, 0x7894, 0xB449, 0x7895, 0xB44A, 0x7896, 0xB44B, - 0x7897, 0xCDEB, 0x7898, 0xB5E2, 0x7899, 0xB44C, 0x789A, 0xEDD5, - 0x789B, 0xEDD3, 0x789C, 0xEDD7, 0x789D, 0xB44D, 0x789E, 0xB44E, - 0x789F, 0xB5FA, 0x78A0, 0xB44F, 0x78A1, 0xEDD8, 0x78A2, 0xB450, - 0x78A3, 0xEDD9, 0x78A4, 0xB451, 0x78A5, 0xEDDC, 0x78A6, 0xB452, - 0x78A7, 0xB1CC, 0x78A8, 0xB453, 0x78A9, 0xB454, 0x78AA, 0xB455, - 0x78AB, 0xB456, 0x78AC, 0xB457, 0x78AD, 0xB458, 0x78AE, 0xB459, - 0x78AF, 0xB45A, 0x78B0, 0xC5F6, 0x78B1, 0xBCEE, 0x78B2, 0xEDDA, - 0x78B3, 0xCCBC, 0x78B4, 0xB2EA, 0x78B5, 0xB45B, 0x78B6, 0xB45C, - 0x78B7, 0xB45D, 0x78B8, 0xB45E, 0x78B9, 0xEDDB, 0x78BA, 0xB45F, - 0x78BB, 0xB460, 0x78BC, 0xB461, 0x78BD, 0xB462, 0x78BE, 0xC4EB, - 0x78BF, 0xB463, 0x78C0, 0xB464, 0x78C1, 0xB4C5, 0x78C2, 0xB465, - 0x78C3, 0xB466, 0x78C4, 0xB467, 0x78C5, 0xB0F5, 0x78C6, 0xB468, - 0x78C7, 0xB469, 0x78C8, 0xB46A, 0x78C9, 0xEDDF, 0x78CA, 0xC0DA, - 0x78CB, 0xB4E8, 0x78CC, 0xB46B, 0x78CD, 0xB46C, 0x78CE, 0xB46D, - 0x78CF, 0xB46E, 0x78D0, 0xC5CD, 0x78D1, 0xB46F, 0x78D2, 0xB470, - 0x78D3, 0xB471, 0x78D4, 0xEDDD, 0x78D5, 0xBFC4, 0x78D6, 0xB472, - 0x78D7, 0xB473, 0x78D8, 0xB474, 0x78D9, 0xEDDE, 0x78DA, 0xB475, - 0x78DB, 0xB476, 0x78DC, 0xB477, 0x78DD, 0xB478, 0x78DE, 0xB479, - 0x78DF, 0xB47A, 0x78E0, 0xB47B, 0x78E1, 0xB47C, 0x78E2, 0xB47D, - 0x78E3, 0xB47E, 0x78E4, 0xB480, 0x78E5, 0xB481, 0x78E6, 0xB482, - 0x78E7, 0xB483, 0x78E8, 0xC4A5, 0x78E9, 0xB484, 0x78EA, 0xB485, - 0x78EB, 0xB486, 0x78EC, 0xEDE0, 0x78ED, 0xB487, 0x78EE, 0xB488, - 0x78EF, 0xB489, 0x78F0, 0xB48A, 0x78F1, 0xB48B, 0x78F2, 0xEDE1, - 0x78F3, 0xB48C, 0x78F4, 0xEDE3, 0x78F5, 0xB48D, 0x78F6, 0xB48E, - 0x78F7, 0xC1D7, 0x78F8, 0xB48F, 0x78F9, 0xB490, 0x78FA, 0xBBC7, - 0x78FB, 0xB491, 0x78FC, 0xB492, 0x78FD, 0xB493, 0x78FE, 0xB494, - 0x78FF, 0xB495, 0x7900, 0xB496, 0x7901, 0xBDB8, 0x7902, 0xB497, - 0x7903, 0xB498, 0x7904, 0xB499, 0x7905, 0xEDE2, 0x7906, 0xB49A, - 0x7907, 0xB49B, 0x7908, 0xB49C, 0x7909, 0xB49D, 0x790A, 0xB49E, - 0x790B, 0xB49F, 0x790C, 0xB4A0, 0x790D, 0xB540, 0x790E, 0xB541, - 0x790F, 0xB542, 0x7910, 0xB543, 0x7911, 0xB544, 0x7912, 0xB545, - 0x7913, 0xEDE4, 0x7914, 0xB546, 0x7915, 0xB547, 0x7916, 0xB548, - 0x7917, 0xB549, 0x7918, 0xB54A, 0x7919, 0xB54B, 0x791A, 0xB54C, - 0x791B, 0xB54D, 0x791C, 0xB54E, 0x791D, 0xB54F, 0x791E, 0xEDE6, - 0x791F, 0xB550, 0x7920, 0xB551, 0x7921, 0xB552, 0x7922, 0xB553, - 0x7923, 0xB554, 0x7924, 0xEDE5, 0x7925, 0xB555, 0x7926, 0xB556, - 0x7927, 0xB557, 0x7928, 0xB558, 0x7929, 0xB559, 0x792A, 0xB55A, - 0x792B, 0xB55B, 0x792C, 0xB55C, 0x792D, 0xB55D, 0x792E, 0xB55E, - 0x792F, 0xB55F, 0x7930, 0xB560, 0x7931, 0xB561, 0x7932, 0xB562, - 0x7933, 0xB563, 0x7934, 0xEDE7, 0x7935, 0xB564, 0x7936, 0xB565, - 0x7937, 0xB566, 0x7938, 0xB567, 0x7939, 0xB568, 0x793A, 0xCABE, - 0x793B, 0xECEA, 0x793C, 0xC0F1, 0x793D, 0xB569, 0x793E, 0xC9E7, - 0x793F, 0xB56A, 0x7940, 0xECEB, 0x7941, 0xC6EE, 0x7942, 0xB56B, - 0x7943, 0xB56C, 0x7944, 0xB56D, 0x7945, 0xB56E, 0x7946, 0xECEC, - 0x7947, 0xB56F, 0x7948, 0xC6ED, 0x7949, 0xECED, 0x794A, 0xB570, - 0x794B, 0xB571, 0x794C, 0xB572, 0x794D, 0xB573, 0x794E, 0xB574, - 0x794F, 0xB575, 0x7950, 0xB576, 0x7951, 0xB577, 0x7952, 0xB578, - 0x7953, 0xECF0, 0x7954, 0xB579, 0x7955, 0xB57A, 0x7956, 0xD7E6, - 0x7957, 0xECF3, 0x7958, 0xB57B, 0x7959, 0xB57C, 0x795A, 0xECF1, - 0x795B, 0xECEE, 0x795C, 0xECEF, 0x795D, 0xD7A3, 0x795E, 0xC9F1, - 0x795F, 0xCBEE, 0x7960, 0xECF4, 0x7961, 0xB57D, 0x7962, 0xECF2, - 0x7963, 0xB57E, 0x7964, 0xB580, 0x7965, 0xCFE9, 0x7966, 0xB581, - 0x7967, 0xECF6, 0x7968, 0xC6B1, 0x7969, 0xB582, 0x796A, 0xB583, - 0x796B, 0xB584, 0x796C, 0xB585, 0x796D, 0xBCC0, 0x796E, 0xB586, - 0x796F, 0xECF5, 0x7970, 0xB587, 0x7971, 0xB588, 0x7972, 0xB589, - 0x7973, 0xB58A, 0x7974, 0xB58B, 0x7975, 0xB58C, 0x7976, 0xB58D, - 0x7977, 0xB5BB, 0x7978, 0xBBF6, 0x7979, 0xB58E, 0x797A, 0xECF7, - 0x797B, 0xB58F, 0x797C, 0xB590, 0x797D, 0xB591, 0x797E, 0xB592, - 0x797F, 0xB593, 0x7980, 0xD9F7, 0x7981, 0xBDFB, 0x7982, 0xB594, - 0x7983, 0xB595, 0x7984, 0xC2BB, 0x7985, 0xECF8, 0x7986, 0xB596, - 0x7987, 0xB597, 0x7988, 0xB598, 0x7989, 0xB599, 0x798A, 0xECF9, - 0x798B, 0xB59A, 0x798C, 0xB59B, 0x798D, 0xB59C, 0x798E, 0xB59D, - 0x798F, 0xB8A3, 0x7990, 0xB59E, 0x7991, 0xB59F, 0x7992, 0xB5A0, - 0x7993, 0xB640, 0x7994, 0xB641, 0x7995, 0xB642, 0x7996, 0xB643, - 0x7997, 0xB644, 0x7998, 0xB645, 0x7999, 0xB646, 0x799A, 0xECFA, - 0x799B, 0xB647, 0x799C, 0xB648, 0x799D, 0xB649, 0x799E, 0xB64A, - 0x799F, 0xB64B, 0x79A0, 0xB64C, 0x79A1, 0xB64D, 0x79A2, 0xB64E, - 0x79A3, 0xB64F, 0x79A4, 0xB650, 0x79A5, 0xB651, 0x79A6, 0xB652, - 0x79A7, 0xECFB, 0x79A8, 0xB653, 0x79A9, 0xB654, 0x79AA, 0xB655, - 0x79AB, 0xB656, 0x79AC, 0xB657, 0x79AD, 0xB658, 0x79AE, 0xB659, - 0x79AF, 0xB65A, 0x79B0, 0xB65B, 0x79B1, 0xB65C, 0x79B2, 0xB65D, - 0x79B3, 0xECFC, 0x79B4, 0xB65E, 0x79B5, 0xB65F, 0x79B6, 0xB660, - 0x79B7, 0xB661, 0x79B8, 0xB662, 0x79B9, 0xD3ED, 0x79BA, 0xD8AE, - 0x79BB, 0xC0EB, 0x79BC, 0xB663, 0x79BD, 0xC7DD, 0x79BE, 0xBACC, - 0x79BF, 0xB664, 0x79C0, 0xD0E3, 0x79C1, 0xCBBD, 0x79C2, 0xB665, - 0x79C3, 0xCDBA, 0x79C4, 0xB666, 0x79C5, 0xB667, 0x79C6, 0xB8D1, - 0x79C7, 0xB668, 0x79C8, 0xB669, 0x79C9, 0xB1FC, 0x79CA, 0xB66A, - 0x79CB, 0xC7EF, 0x79CC, 0xB66B, 0x79CD, 0xD6D6, 0x79CE, 0xB66C, - 0x79CF, 0xB66D, 0x79D0, 0xB66E, 0x79D1, 0xBFC6, 0x79D2, 0xC3EB, - 0x79D3, 0xB66F, 0x79D4, 0xB670, 0x79D5, 0xEFF5, 0x79D6, 0xB671, - 0x79D7, 0xB672, 0x79D8, 0xC3D8, 0x79D9, 0xB673, 0x79DA, 0xB674, - 0x79DB, 0xB675, 0x79DC, 0xB676, 0x79DD, 0xB677, 0x79DE, 0xB678, - 0x79DF, 0xD7E2, 0x79E0, 0xB679, 0x79E1, 0xB67A, 0x79E2, 0xB67B, - 0x79E3, 0xEFF7, 0x79E4, 0xB3D3, 0x79E5, 0xB67C, 0x79E6, 0xC7D8, - 0x79E7, 0xD1ED, 0x79E8, 0xB67D, 0x79E9, 0xD6C8, 0x79EA, 0xB67E, - 0x79EB, 0xEFF8, 0x79EC, 0xB680, 0x79ED, 0xEFF6, 0x79EE, 0xB681, - 0x79EF, 0xBBFD, 0x79F0, 0xB3C6, 0x79F1, 0xB682, 0x79F2, 0xB683, - 0x79F3, 0xB684, 0x79F4, 0xB685, 0x79F5, 0xB686, 0x79F6, 0xB687, - 0x79F7, 0xB688, 0x79F8, 0xBDD5, 0x79F9, 0xB689, 0x79FA, 0xB68A, - 0x79FB, 0xD2C6, 0x79FC, 0xB68B, 0x79FD, 0xBBE0, 0x79FE, 0xB68C, - 0x79FF, 0xB68D, 0x7A00, 0xCFA1, 0x7A01, 0xB68E, 0x7A02, 0xEFFC, - 0x7A03, 0xEFFB, 0x7A04, 0xB68F, 0x7A05, 0xB690, 0x7A06, 0xEFF9, - 0x7A07, 0xB691, 0x7A08, 0xB692, 0x7A09, 0xB693, 0x7A0A, 0xB694, - 0x7A0B, 0xB3CC, 0x7A0C, 0xB695, 0x7A0D, 0xC9D4, 0x7A0E, 0xCBB0, - 0x7A0F, 0xB696, 0x7A10, 0xB697, 0x7A11, 0xB698, 0x7A12, 0xB699, - 0x7A13, 0xB69A, 0x7A14, 0xEFFE, 0x7A15, 0xB69B, 0x7A16, 0xB69C, - 0x7A17, 0xB0DE, 0x7A18, 0xB69D, 0x7A19, 0xB69E, 0x7A1A, 0xD6C9, - 0x7A1B, 0xB69F, 0x7A1C, 0xB6A0, 0x7A1D, 0xB740, 0x7A1E, 0xEFFD, - 0x7A1F, 0xB741, 0x7A20, 0xB3ED, 0x7A21, 0xB742, 0x7A22, 0xB743, - 0x7A23, 0xF6D5, 0x7A24, 0xB744, 0x7A25, 0xB745, 0x7A26, 0xB746, - 0x7A27, 0xB747, 0x7A28, 0xB748, 0x7A29, 0xB749, 0x7A2A, 0xB74A, - 0x7A2B, 0xB74B, 0x7A2C, 0xB74C, 0x7A2D, 0xB74D, 0x7A2E, 0xB74E, - 0x7A2F, 0xB74F, 0x7A30, 0xB750, 0x7A31, 0xB751, 0x7A32, 0xB752, - 0x7A33, 0xCEC8, 0x7A34, 0xB753, 0x7A35, 0xB754, 0x7A36, 0xB755, - 0x7A37, 0xF0A2, 0x7A38, 0xB756, 0x7A39, 0xF0A1, 0x7A3A, 0xB757, - 0x7A3B, 0xB5BE, 0x7A3C, 0xBCDA, 0x7A3D, 0xBBFC, 0x7A3E, 0xB758, - 0x7A3F, 0xB8E5, 0x7A40, 0xB759, 0x7A41, 0xB75A, 0x7A42, 0xB75B, - 0x7A43, 0xB75C, 0x7A44, 0xB75D, 0x7A45, 0xB75E, 0x7A46, 0xC4C2, - 0x7A47, 0xB75F, 0x7A48, 0xB760, 0x7A49, 0xB761, 0x7A4A, 0xB762, - 0x7A4B, 0xB763, 0x7A4C, 0xB764, 0x7A4D, 0xB765, 0x7A4E, 0xB766, - 0x7A4F, 0xB767, 0x7A50, 0xB768, 0x7A51, 0xF0A3, 0x7A52, 0xB769, - 0x7A53, 0xB76A, 0x7A54, 0xB76B, 0x7A55, 0xB76C, 0x7A56, 0xB76D, - 0x7A57, 0xCBEB, 0x7A58, 0xB76E, 0x7A59, 0xB76F, 0x7A5A, 0xB770, - 0x7A5B, 0xB771, 0x7A5C, 0xB772, 0x7A5D, 0xB773, 0x7A5E, 0xB774, - 0x7A5F, 0xB775, 0x7A60, 0xB776, 0x7A61, 0xB777, 0x7A62, 0xB778, - 0x7A63, 0xB779, 0x7A64, 0xB77A, 0x7A65, 0xB77B, 0x7A66, 0xB77C, - 0x7A67, 0xB77D, 0x7A68, 0xB77E, 0x7A69, 0xB780, 0x7A6A, 0xB781, - 0x7A6B, 0xB782, 0x7A6C, 0xB783, 0x7A6D, 0xB784, 0x7A6E, 0xB785, - 0x7A6F, 0xB786, 0x7A70, 0xF0A6, 0x7A71, 0xB787, 0x7A72, 0xB788, - 0x7A73, 0xB789, 0x7A74, 0xD1A8, 0x7A75, 0xB78A, 0x7A76, 0xBEBF, - 0x7A77, 0xC7EE, 0x7A78, 0xF1B6, 0x7A79, 0xF1B7, 0x7A7A, 0xBFD5, - 0x7A7B, 0xB78B, 0x7A7C, 0xB78C, 0x7A7D, 0xB78D, 0x7A7E, 0xB78E, - 0x7A7F, 0xB4A9, 0x7A80, 0xF1B8, 0x7A81, 0xCDBB, 0x7A82, 0xB78F, - 0x7A83, 0xC7D4, 0x7A84, 0xD5AD, 0x7A85, 0xB790, 0x7A86, 0xF1B9, - 0x7A87, 0xB791, 0x7A88, 0xF1BA, 0x7A89, 0xB792, 0x7A8A, 0xB793, - 0x7A8B, 0xB794, 0x7A8C, 0xB795, 0x7A8D, 0xC7CF, 0x7A8E, 0xB796, - 0x7A8F, 0xB797, 0x7A90, 0xB798, 0x7A91, 0xD2A4, 0x7A92, 0xD6CF, - 0x7A93, 0xB799, 0x7A94, 0xB79A, 0x7A95, 0xF1BB, 0x7A96, 0xBDD1, - 0x7A97, 0xB4B0, 0x7A98, 0xBEBD, 0x7A99, 0xB79B, 0x7A9A, 0xB79C, - 0x7A9B, 0xB79D, 0x7A9C, 0xB4DC, 0x7A9D, 0xCED1, 0x7A9E, 0xB79E, - 0x7A9F, 0xBFDF, 0x7AA0, 0xF1BD, 0x7AA1, 0xB79F, 0x7AA2, 0xB7A0, - 0x7AA3, 0xB840, 0x7AA4, 0xB841, 0x7AA5, 0xBFFA, 0x7AA6, 0xF1BC, - 0x7AA7, 0xB842, 0x7AA8, 0xF1BF, 0x7AA9, 0xB843, 0x7AAA, 0xB844, - 0x7AAB, 0xB845, 0x7AAC, 0xF1BE, 0x7AAD, 0xF1C0, 0x7AAE, 0xB846, - 0x7AAF, 0xB847, 0x7AB0, 0xB848, 0x7AB1, 0xB849, 0x7AB2, 0xB84A, - 0x7AB3, 0xF1C1, 0x7AB4, 0xB84B, 0x7AB5, 0xB84C, 0x7AB6, 0xB84D, - 0x7AB7, 0xB84E, 0x7AB8, 0xB84F, 0x7AB9, 0xB850, 0x7ABA, 0xB851, - 0x7ABB, 0xB852, 0x7ABC, 0xB853, 0x7ABD, 0xB854, 0x7ABE, 0xB855, - 0x7ABF, 0xC1FE, 0x7AC0, 0xB856, 0x7AC1, 0xB857, 0x7AC2, 0xB858, - 0x7AC3, 0xB859, 0x7AC4, 0xB85A, 0x7AC5, 0xB85B, 0x7AC6, 0xB85C, - 0x7AC7, 0xB85D, 0x7AC8, 0xB85E, 0x7AC9, 0xB85F, 0x7ACA, 0xB860, - 0x7ACB, 0xC1A2, 0x7ACC, 0xB861, 0x7ACD, 0xB862, 0x7ACE, 0xB863, - 0x7ACF, 0xB864, 0x7AD0, 0xB865, 0x7AD1, 0xB866, 0x7AD2, 0xB867, - 0x7AD3, 0xB868, 0x7AD4, 0xB869, 0x7AD5, 0xB86A, 0x7AD6, 0xCAFA, - 0x7AD7, 0xB86B, 0x7AD8, 0xB86C, 0x7AD9, 0xD5BE, 0x7ADA, 0xB86D, - 0x7ADB, 0xB86E, 0x7ADC, 0xB86F, 0x7ADD, 0xB870, 0x7ADE, 0xBEBA, - 0x7ADF, 0xBEB9, 0x7AE0, 0xD5C2, 0x7AE1, 0xB871, 0x7AE2, 0xB872, - 0x7AE3, 0xBFA2, 0x7AE4, 0xB873, 0x7AE5, 0xCDAF, 0x7AE6, 0xF1B5, - 0x7AE7, 0xB874, 0x7AE8, 0xB875, 0x7AE9, 0xB876, 0x7AEA, 0xB877, - 0x7AEB, 0xB878, 0x7AEC, 0xB879, 0x7AED, 0xBDDF, 0x7AEE, 0xB87A, - 0x7AEF, 0xB6CB, 0x7AF0, 0xB87B, 0x7AF1, 0xB87C, 0x7AF2, 0xB87D, - 0x7AF3, 0xB87E, 0x7AF4, 0xB880, 0x7AF5, 0xB881, 0x7AF6, 0xB882, - 0x7AF7, 0xB883, 0x7AF8, 0xB884, 0x7AF9, 0xD6F1, 0x7AFA, 0xF3C3, - 0x7AFB, 0xB885, 0x7AFC, 0xB886, 0x7AFD, 0xF3C4, 0x7AFE, 0xB887, - 0x7AFF, 0xB8CD, 0x7B00, 0xB888, 0x7B01, 0xB889, 0x7B02, 0xB88A, - 0x7B03, 0xF3C6, 0x7B04, 0xF3C7, 0x7B05, 0xB88B, 0x7B06, 0xB0CA, - 0x7B07, 0xB88C, 0x7B08, 0xF3C5, 0x7B09, 0xB88D, 0x7B0A, 0xF3C9, - 0x7B0B, 0xCBF1, 0x7B0C, 0xB88E, 0x7B0D, 0xB88F, 0x7B0E, 0xB890, - 0x7B0F, 0xF3CB, 0x7B10, 0xB891, 0x7B11, 0xD0A6, 0x7B12, 0xB892, - 0x7B13, 0xB893, 0x7B14, 0xB1CA, 0x7B15, 0xF3C8, 0x7B16, 0xB894, - 0x7B17, 0xB895, 0x7B18, 0xB896, 0x7B19, 0xF3CF, 0x7B1A, 0xB897, - 0x7B1B, 0xB5D1, 0x7B1C, 0xB898, 0x7B1D, 0xB899, 0x7B1E, 0xF3D7, - 0x7B1F, 0xB89A, 0x7B20, 0xF3D2, 0x7B21, 0xB89B, 0x7B22, 0xB89C, - 0x7B23, 0xB89D, 0x7B24, 0xF3D4, 0x7B25, 0xF3D3, 0x7B26, 0xB7FB, - 0x7B27, 0xB89E, 0x7B28, 0xB1BF, 0x7B29, 0xB89F, 0x7B2A, 0xF3CE, - 0x7B2B, 0xF3CA, 0x7B2C, 0xB5DA, 0x7B2D, 0xB8A0, 0x7B2E, 0xF3D0, - 0x7B2F, 0xB940, 0x7B30, 0xB941, 0x7B31, 0xF3D1, 0x7B32, 0xB942, - 0x7B33, 0xF3D5, 0x7B34, 0xB943, 0x7B35, 0xB944, 0x7B36, 0xB945, - 0x7B37, 0xB946, 0x7B38, 0xF3CD, 0x7B39, 0xB947, 0x7B3A, 0xBCE3, - 0x7B3B, 0xB948, 0x7B3C, 0xC1FD, 0x7B3D, 0xB949, 0x7B3E, 0xF3D6, - 0x7B3F, 0xB94A, 0x7B40, 0xB94B, 0x7B41, 0xB94C, 0x7B42, 0xB94D, - 0x7B43, 0xB94E, 0x7B44, 0xB94F, 0x7B45, 0xF3DA, 0x7B46, 0xB950, - 0x7B47, 0xF3CC, 0x7B48, 0xB951, 0x7B49, 0xB5C8, 0x7B4A, 0xB952, - 0x7B4B, 0xBDEE, 0x7B4C, 0xF3DC, 0x7B4D, 0xB953, 0x7B4E, 0xB954, - 0x7B4F, 0xB7A4, 0x7B50, 0xBFF0, 0x7B51, 0xD6FE, 0x7B52, 0xCDB2, - 0x7B53, 0xB955, 0x7B54, 0xB4F0, 0x7B55, 0xB956, 0x7B56, 0xB2DF, - 0x7B57, 0xB957, 0x7B58, 0xF3D8, 0x7B59, 0xB958, 0x7B5A, 0xF3D9, - 0x7B5B, 0xC9B8, 0x7B5C, 0xB959, 0x7B5D, 0xF3DD, 0x7B5E, 0xB95A, - 0x7B5F, 0xB95B, 0x7B60, 0xF3DE, 0x7B61, 0xB95C, 0x7B62, 0xF3E1, - 0x7B63, 0xB95D, 0x7B64, 0xB95E, 0x7B65, 0xB95F, 0x7B66, 0xB960, - 0x7B67, 0xB961, 0x7B68, 0xB962, 0x7B69, 0xB963, 0x7B6A, 0xB964, - 0x7B6B, 0xB965, 0x7B6C, 0xB966, 0x7B6D, 0xB967, 0x7B6E, 0xF3DF, - 0x7B6F, 0xB968, 0x7B70, 0xB969, 0x7B71, 0xF3E3, 0x7B72, 0xF3E2, - 0x7B73, 0xB96A, 0x7B74, 0xB96B, 0x7B75, 0xF3DB, 0x7B76, 0xB96C, - 0x7B77, 0xBFEA, 0x7B78, 0xB96D, 0x7B79, 0xB3EF, 0x7B7A, 0xB96E, - 0x7B7B, 0xF3E0, 0x7B7C, 0xB96F, 0x7B7D, 0xB970, 0x7B7E, 0xC7A9, - 0x7B7F, 0xB971, 0x7B80, 0xBCF2, 0x7B81, 0xB972, 0x7B82, 0xB973, - 0x7B83, 0xB974, 0x7B84, 0xB975, 0x7B85, 0xF3EB, 0x7B86, 0xB976, - 0x7B87, 0xB977, 0x7B88, 0xB978, 0x7B89, 0xB979, 0x7B8A, 0xB97A, - 0x7B8B, 0xB97B, 0x7B8C, 0xB97C, 0x7B8D, 0xB9BF, 0x7B8E, 0xB97D, - 0x7B8F, 0xB97E, 0x7B90, 0xF3E4, 0x7B91, 0xB980, 0x7B92, 0xB981, - 0x7B93, 0xB982, 0x7B94, 0xB2AD, 0x7B95, 0xBBFE, 0x7B96, 0xB983, - 0x7B97, 0xCBE3, 0x7B98, 0xB984, 0x7B99, 0xB985, 0x7B9A, 0xB986, - 0x7B9B, 0xB987, 0x7B9C, 0xF3ED, 0x7B9D, 0xF3E9, 0x7B9E, 0xB988, - 0x7B9F, 0xB989, 0x7BA0, 0xB98A, 0x7BA1, 0xB9DC, 0x7BA2, 0xF3EE, - 0x7BA3, 0xB98B, 0x7BA4, 0xB98C, 0x7BA5, 0xB98D, 0x7BA6, 0xF3E5, - 0x7BA7, 0xF3E6, 0x7BA8, 0xF3EA, 0x7BA9, 0xC2E1, 0x7BAA, 0xF3EC, - 0x7BAB, 0xF3EF, 0x7BAC, 0xF3E8, 0x7BAD, 0xBCFD, 0x7BAE, 0xB98E, - 0x7BAF, 0xB98F, 0x7BB0, 0xB990, 0x7BB1, 0xCFE4, 0x7BB2, 0xB991, - 0x7BB3, 0xB992, 0x7BB4, 0xF3F0, 0x7BB5, 0xB993, 0x7BB6, 0xB994, - 0x7BB7, 0xB995, 0x7BB8, 0xF3E7, 0x7BB9, 0xB996, 0x7BBA, 0xB997, - 0x7BBB, 0xB998, 0x7BBC, 0xB999, 0x7BBD, 0xB99A, 0x7BBE, 0xB99B, - 0x7BBF, 0xB99C, 0x7BC0, 0xB99D, 0x7BC1, 0xF3F2, 0x7BC2, 0xB99E, - 0x7BC3, 0xB99F, 0x7BC4, 0xB9A0, 0x7BC5, 0xBA40, 0x7BC6, 0xD7AD, - 0x7BC7, 0xC6AA, 0x7BC8, 0xBA41, 0x7BC9, 0xBA42, 0x7BCA, 0xBA43, - 0x7BCB, 0xBA44, 0x7BCC, 0xF3F3, 0x7BCD, 0xBA45, 0x7BCE, 0xBA46, - 0x7BCF, 0xBA47, 0x7BD0, 0xBA48, 0x7BD1, 0xF3F1, 0x7BD2, 0xBA49, - 0x7BD3, 0xC2A8, 0x7BD4, 0xBA4A, 0x7BD5, 0xBA4B, 0x7BD6, 0xBA4C, - 0x7BD7, 0xBA4D, 0x7BD8, 0xBA4E, 0x7BD9, 0xB8DD, 0x7BDA, 0xF3F5, - 0x7BDB, 0xBA4F, 0x7BDC, 0xBA50, 0x7BDD, 0xF3F4, 0x7BDE, 0xBA51, - 0x7BDF, 0xBA52, 0x7BE0, 0xBA53, 0x7BE1, 0xB4DB, 0x7BE2, 0xBA54, - 0x7BE3, 0xBA55, 0x7BE4, 0xBA56, 0x7BE5, 0xF3F6, 0x7BE6, 0xF3F7, - 0x7BE7, 0xBA57, 0x7BE8, 0xBA58, 0x7BE9, 0xBA59, 0x7BEA, 0xF3F8, - 0x7BEB, 0xBA5A, 0x7BEC, 0xBA5B, 0x7BED, 0xBA5C, 0x7BEE, 0xC0BA, - 0x7BEF, 0xBA5D, 0x7BF0, 0xBA5E, 0x7BF1, 0xC0E9, 0x7BF2, 0xBA5F, - 0x7BF3, 0xBA60, 0x7BF4, 0xBA61, 0x7BF5, 0xBA62, 0x7BF6, 0xBA63, - 0x7BF7, 0xC5F1, 0x7BF8, 0xBA64, 0x7BF9, 0xBA65, 0x7BFA, 0xBA66, - 0x7BFB, 0xBA67, 0x7BFC, 0xF3FB, 0x7BFD, 0xBA68, 0x7BFE, 0xF3FA, - 0x7BFF, 0xBA69, 0x7C00, 0xBA6A, 0x7C01, 0xBA6B, 0x7C02, 0xBA6C, - 0x7C03, 0xBA6D, 0x7C04, 0xBA6E, 0x7C05, 0xBA6F, 0x7C06, 0xBA70, - 0x7C07, 0xB4D8, 0x7C08, 0xBA71, 0x7C09, 0xBA72, 0x7C0A, 0xBA73, - 0x7C0B, 0xF3FE, 0x7C0C, 0xF3F9, 0x7C0D, 0xBA74, 0x7C0E, 0xBA75, - 0x7C0F, 0xF3FC, 0x7C10, 0xBA76, 0x7C11, 0xBA77, 0x7C12, 0xBA78, - 0x7C13, 0xBA79, 0x7C14, 0xBA7A, 0x7C15, 0xBA7B, 0x7C16, 0xF3FD, - 0x7C17, 0xBA7C, 0x7C18, 0xBA7D, 0x7C19, 0xBA7E, 0x7C1A, 0xBA80, - 0x7C1B, 0xBA81, 0x7C1C, 0xBA82, 0x7C1D, 0xBA83, 0x7C1E, 0xBA84, - 0x7C1F, 0xF4A1, 0x7C20, 0xBA85, 0x7C21, 0xBA86, 0x7C22, 0xBA87, - 0x7C23, 0xBA88, 0x7C24, 0xBA89, 0x7C25, 0xBA8A, 0x7C26, 0xF4A3, - 0x7C27, 0xBBC9, 0x7C28, 0xBA8B, 0x7C29, 0xBA8C, 0x7C2A, 0xF4A2, - 0x7C2B, 0xBA8D, 0x7C2C, 0xBA8E, 0x7C2D, 0xBA8F, 0x7C2E, 0xBA90, - 0x7C2F, 0xBA91, 0x7C30, 0xBA92, 0x7C31, 0xBA93, 0x7C32, 0xBA94, - 0x7C33, 0xBA95, 0x7C34, 0xBA96, 0x7C35, 0xBA97, 0x7C36, 0xBA98, - 0x7C37, 0xBA99, 0x7C38, 0xF4A4, 0x7C39, 0xBA9A, 0x7C3A, 0xBA9B, - 0x7C3B, 0xBA9C, 0x7C3C, 0xBA9D, 0x7C3D, 0xBA9E, 0x7C3E, 0xBA9F, - 0x7C3F, 0xB2BE, 0x7C40, 0xF4A6, 0x7C41, 0xF4A5, 0x7C42, 0xBAA0, - 0x7C43, 0xBB40, 0x7C44, 0xBB41, 0x7C45, 0xBB42, 0x7C46, 0xBB43, - 0x7C47, 0xBB44, 0x7C48, 0xBB45, 0x7C49, 0xBB46, 0x7C4A, 0xBB47, - 0x7C4B, 0xBB48, 0x7C4C, 0xBB49, 0x7C4D, 0xBCAE, 0x7C4E, 0xBB4A, - 0x7C4F, 0xBB4B, 0x7C50, 0xBB4C, 0x7C51, 0xBB4D, 0x7C52, 0xBB4E, - 0x7C53, 0xBB4F, 0x7C54, 0xBB50, 0x7C55, 0xBB51, 0x7C56, 0xBB52, - 0x7C57, 0xBB53, 0x7C58, 0xBB54, 0x7C59, 0xBB55, 0x7C5A, 0xBB56, - 0x7C5B, 0xBB57, 0x7C5C, 0xBB58, 0x7C5D, 0xBB59, 0x7C5E, 0xBB5A, - 0x7C5F, 0xBB5B, 0x7C60, 0xBB5C, 0x7C61, 0xBB5D, 0x7C62, 0xBB5E, - 0x7C63, 0xBB5F, 0x7C64, 0xBB60, 0x7C65, 0xBB61, 0x7C66, 0xBB62, - 0x7C67, 0xBB63, 0x7C68, 0xBB64, 0x7C69, 0xBB65, 0x7C6A, 0xBB66, - 0x7C6B, 0xBB67, 0x7C6C, 0xBB68, 0x7C6D, 0xBB69, 0x7C6E, 0xBB6A, - 0x7C6F, 0xBB6B, 0x7C70, 0xBB6C, 0x7C71, 0xBB6D, 0x7C72, 0xBB6E, - 0x7C73, 0xC3D7, 0x7C74, 0xD9E1, 0x7C75, 0xBB6F, 0x7C76, 0xBB70, - 0x7C77, 0xBB71, 0x7C78, 0xBB72, 0x7C79, 0xBB73, 0x7C7A, 0xBB74, - 0x7C7B, 0xC0E0, 0x7C7C, 0xF4CC, 0x7C7D, 0xD7D1, 0x7C7E, 0xBB75, - 0x7C7F, 0xBB76, 0x7C80, 0xBB77, 0x7C81, 0xBB78, 0x7C82, 0xBB79, - 0x7C83, 0xBB7A, 0x7C84, 0xBB7B, 0x7C85, 0xBB7C, 0x7C86, 0xBB7D, - 0x7C87, 0xBB7E, 0x7C88, 0xBB80, 0x7C89, 0xB7DB, 0x7C8A, 0xBB81, - 0x7C8B, 0xBB82, 0x7C8C, 0xBB83, 0x7C8D, 0xBB84, 0x7C8E, 0xBB85, - 0x7C8F, 0xBB86, 0x7C90, 0xBB87, 0x7C91, 0xF4CE, 0x7C92, 0xC1A3, - 0x7C93, 0xBB88, 0x7C94, 0xBB89, 0x7C95, 0xC6C9, 0x7C96, 0xBB8A, - 0x7C97, 0xB4D6, 0x7C98, 0xD5B3, 0x7C99, 0xBB8B, 0x7C9A, 0xBB8C, - 0x7C9B, 0xBB8D, 0x7C9C, 0xF4D0, 0x7C9D, 0xF4CF, 0x7C9E, 0xF4D1, - 0x7C9F, 0xCBDA, 0x7CA0, 0xBB8E, 0x7CA1, 0xBB8F, 0x7CA2, 0xF4D2, - 0x7CA3, 0xBB90, 0x7CA4, 0xD4C1, 0x7CA5, 0xD6E0, 0x7CA6, 0xBB91, - 0x7CA7, 0xBB92, 0x7CA8, 0xBB93, 0x7CA9, 0xBB94, 0x7CAA, 0xB7E0, - 0x7CAB, 0xBB95, 0x7CAC, 0xBB96, 0x7CAD, 0xBB97, 0x7CAE, 0xC1B8, - 0x7CAF, 0xBB98, 0x7CB0, 0xBB99, 0x7CB1, 0xC1BB, 0x7CB2, 0xF4D3, - 0x7CB3, 0xBEAC, 0x7CB4, 0xBB9A, 0x7CB5, 0xBB9B, 0x7CB6, 0xBB9C, - 0x7CB7, 0xBB9D, 0x7CB8, 0xBB9E, 0x7CB9, 0xB4E2, 0x7CBA, 0xBB9F, - 0x7CBB, 0xBBA0, 0x7CBC, 0xF4D4, 0x7CBD, 0xF4D5, 0x7CBE, 0xBEAB, - 0x7CBF, 0xBC40, 0x7CC0, 0xBC41, 0x7CC1, 0xF4D6, 0x7CC2, 0xBC42, - 0x7CC3, 0xBC43, 0x7CC4, 0xBC44, 0x7CC5, 0xF4DB, 0x7CC6, 0xBC45, - 0x7CC7, 0xF4D7, 0x7CC8, 0xF4DA, 0x7CC9, 0xBC46, 0x7CCA, 0xBAFD, - 0x7CCB, 0xBC47, 0x7CCC, 0xF4D8, 0x7CCD, 0xF4D9, 0x7CCE, 0xBC48, - 0x7CCF, 0xBC49, 0x7CD0, 0xBC4A, 0x7CD1, 0xBC4B, 0x7CD2, 0xBC4C, - 0x7CD3, 0xBC4D, 0x7CD4, 0xBC4E, 0x7CD5, 0xB8E2, 0x7CD6, 0xCCC7, - 0x7CD7, 0xF4DC, 0x7CD8, 0xBC4F, 0x7CD9, 0xB2DA, 0x7CDA, 0xBC50, - 0x7CDB, 0xBC51, 0x7CDC, 0xC3D3, 0x7CDD, 0xBC52, 0x7CDE, 0xBC53, - 0x7CDF, 0xD4E3, 0x7CE0, 0xBFB7, 0x7CE1, 0xBC54, 0x7CE2, 0xBC55, - 0x7CE3, 0xBC56, 0x7CE4, 0xBC57, 0x7CE5, 0xBC58, 0x7CE6, 0xBC59, - 0x7CE7, 0xBC5A, 0x7CE8, 0xF4DD, 0x7CE9, 0xBC5B, 0x7CEA, 0xBC5C, - 0x7CEB, 0xBC5D, 0x7CEC, 0xBC5E, 0x7CED, 0xBC5F, 0x7CEE, 0xBC60, - 0x7CEF, 0xC5B4, 0x7CF0, 0xBC61, 0x7CF1, 0xBC62, 0x7CF2, 0xBC63, - 0x7CF3, 0xBC64, 0x7CF4, 0xBC65, 0x7CF5, 0xBC66, 0x7CF6, 0xBC67, - 0x7CF7, 0xBC68, 0x7CF8, 0xF4E9, 0x7CF9, 0xBC69, 0x7CFA, 0xBC6A, - 0x7CFB, 0xCFB5, 0x7CFC, 0xBC6B, 0x7CFD, 0xBC6C, 0x7CFE, 0xBC6D, - 0x7CFF, 0xBC6E, 0x7D00, 0xBC6F, 0x7D01, 0xBC70, 0x7D02, 0xBC71, - 0x7D03, 0xBC72, 0x7D04, 0xBC73, 0x7D05, 0xBC74, 0x7D06, 0xBC75, - 0x7D07, 0xBC76, 0x7D08, 0xBC77, 0x7D09, 0xBC78, 0x7D0A, 0xCEC9, - 0x7D0B, 0xBC79, 0x7D0C, 0xBC7A, 0x7D0D, 0xBC7B, 0x7D0E, 0xBC7C, - 0x7D0F, 0xBC7D, 0x7D10, 0xBC7E, 0x7D11, 0xBC80, 0x7D12, 0xBC81, - 0x7D13, 0xBC82, 0x7D14, 0xBC83, 0x7D15, 0xBC84, 0x7D16, 0xBC85, - 0x7D17, 0xBC86, 0x7D18, 0xBC87, 0x7D19, 0xBC88, 0x7D1A, 0xBC89, - 0x7D1B, 0xBC8A, 0x7D1C, 0xBC8B, 0x7D1D, 0xBC8C, 0x7D1E, 0xBC8D, - 0x7D1F, 0xBC8E, 0x7D20, 0xCBD8, 0x7D21, 0xBC8F, 0x7D22, 0xCBF7, - 0x7D23, 0xBC90, 0x7D24, 0xBC91, 0x7D25, 0xBC92, 0x7D26, 0xBC93, - 0x7D27, 0xBDF4, 0x7D28, 0xBC94, 0x7D29, 0xBC95, 0x7D2A, 0xBC96, - 0x7D2B, 0xD7CF, 0x7D2C, 0xBC97, 0x7D2D, 0xBC98, 0x7D2E, 0xBC99, - 0x7D2F, 0xC0DB, 0x7D30, 0xBC9A, 0x7D31, 0xBC9B, 0x7D32, 0xBC9C, - 0x7D33, 0xBC9D, 0x7D34, 0xBC9E, 0x7D35, 0xBC9F, 0x7D36, 0xBCA0, - 0x7D37, 0xBD40, 0x7D38, 0xBD41, 0x7D39, 0xBD42, 0x7D3A, 0xBD43, - 0x7D3B, 0xBD44, 0x7D3C, 0xBD45, 0x7D3D, 0xBD46, 0x7D3E, 0xBD47, - 0x7D3F, 0xBD48, 0x7D40, 0xBD49, 0x7D41, 0xBD4A, 0x7D42, 0xBD4B, - 0x7D43, 0xBD4C, 0x7D44, 0xBD4D, 0x7D45, 0xBD4E, 0x7D46, 0xBD4F, - 0x7D47, 0xBD50, 0x7D48, 0xBD51, 0x7D49, 0xBD52, 0x7D4A, 0xBD53, - 0x7D4B, 0xBD54, 0x7D4C, 0xBD55, 0x7D4D, 0xBD56, 0x7D4E, 0xBD57, - 0x7D4F, 0xBD58, 0x7D50, 0xBD59, 0x7D51, 0xBD5A, 0x7D52, 0xBD5B, - 0x7D53, 0xBD5C, 0x7D54, 0xBD5D, 0x7D55, 0xBD5E, 0x7D56, 0xBD5F, - 0x7D57, 0xBD60, 0x7D58, 0xBD61, 0x7D59, 0xBD62, 0x7D5A, 0xBD63, - 0x7D5B, 0xBD64, 0x7D5C, 0xBD65, 0x7D5D, 0xBD66, 0x7D5E, 0xBD67, - 0x7D5F, 0xBD68, 0x7D60, 0xBD69, 0x7D61, 0xBD6A, 0x7D62, 0xBD6B, - 0x7D63, 0xBD6C, 0x7D64, 0xBD6D, 0x7D65, 0xBD6E, 0x7D66, 0xBD6F, - 0x7D67, 0xBD70, 0x7D68, 0xBD71, 0x7D69, 0xBD72, 0x7D6A, 0xBD73, - 0x7D6B, 0xBD74, 0x7D6C, 0xBD75, 0x7D6D, 0xBD76, 0x7D6E, 0xD0F5, - 0x7D6F, 0xBD77, 0x7D70, 0xBD78, 0x7D71, 0xBD79, 0x7D72, 0xBD7A, - 0x7D73, 0xBD7B, 0x7D74, 0xBD7C, 0x7D75, 0xBD7D, 0x7D76, 0xBD7E, - 0x7D77, 0xF4EA, 0x7D78, 0xBD80, 0x7D79, 0xBD81, 0x7D7A, 0xBD82, - 0x7D7B, 0xBD83, 0x7D7C, 0xBD84, 0x7D7D, 0xBD85, 0x7D7E, 0xBD86, - 0x7D7F, 0xBD87, 0x7D80, 0xBD88, 0x7D81, 0xBD89, 0x7D82, 0xBD8A, - 0x7D83, 0xBD8B, 0x7D84, 0xBD8C, 0x7D85, 0xBD8D, 0x7D86, 0xBD8E, - 0x7D87, 0xBD8F, 0x7D88, 0xBD90, 0x7D89, 0xBD91, 0x7D8A, 0xBD92, - 0x7D8B, 0xBD93, 0x7D8C, 0xBD94, 0x7D8D, 0xBD95, 0x7D8E, 0xBD96, - 0x7D8F, 0xBD97, 0x7D90, 0xBD98, 0x7D91, 0xBD99, 0x7D92, 0xBD9A, - 0x7D93, 0xBD9B, 0x7D94, 0xBD9C, 0x7D95, 0xBD9D, 0x7D96, 0xBD9E, - 0x7D97, 0xBD9F, 0x7D98, 0xBDA0, 0x7D99, 0xBE40, 0x7D9A, 0xBE41, - 0x7D9B, 0xBE42, 0x7D9C, 0xBE43, 0x7D9D, 0xBE44, 0x7D9E, 0xBE45, - 0x7D9F, 0xBE46, 0x7DA0, 0xBE47, 0x7DA1, 0xBE48, 0x7DA2, 0xBE49, - 0x7DA3, 0xBE4A, 0x7DA4, 0xBE4B, 0x7DA5, 0xBE4C, 0x7DA6, 0xF4EB, - 0x7DA7, 0xBE4D, 0x7DA8, 0xBE4E, 0x7DA9, 0xBE4F, 0x7DAA, 0xBE50, - 0x7DAB, 0xBE51, 0x7DAC, 0xBE52, 0x7DAD, 0xBE53, 0x7DAE, 0xF4EC, - 0x7DAF, 0xBE54, 0x7DB0, 0xBE55, 0x7DB1, 0xBE56, 0x7DB2, 0xBE57, - 0x7DB3, 0xBE58, 0x7DB4, 0xBE59, 0x7DB5, 0xBE5A, 0x7DB6, 0xBE5B, - 0x7DB7, 0xBE5C, 0x7DB8, 0xBE5D, 0x7DB9, 0xBE5E, 0x7DBA, 0xBE5F, - 0x7DBB, 0xBE60, 0x7DBC, 0xBE61, 0x7DBD, 0xBE62, 0x7DBE, 0xBE63, - 0x7DBF, 0xBE64, 0x7DC0, 0xBE65, 0x7DC1, 0xBE66, 0x7DC2, 0xBE67, - 0x7DC3, 0xBE68, 0x7DC4, 0xBE69, 0x7DC5, 0xBE6A, 0x7DC6, 0xBE6B, - 0x7DC7, 0xBE6C, 0x7DC8, 0xBE6D, 0x7DC9, 0xBE6E, 0x7DCA, 0xBE6F, - 0x7DCB, 0xBE70, 0x7DCC, 0xBE71, 0x7DCD, 0xBE72, 0x7DCE, 0xBE73, - 0x7DCF, 0xBE74, 0x7DD0, 0xBE75, 0x7DD1, 0xBE76, 0x7DD2, 0xBE77, - 0x7DD3, 0xBE78, 0x7DD4, 0xBE79, 0x7DD5, 0xBE7A, 0x7DD6, 0xBE7B, - 0x7DD7, 0xBE7C, 0x7DD8, 0xBE7D, 0x7DD9, 0xBE7E, 0x7DDA, 0xBE80, - 0x7DDB, 0xBE81, 0x7DDC, 0xBE82, 0x7DDD, 0xBE83, 0x7DDE, 0xBE84, - 0x7DDF, 0xBE85, 0x7DE0, 0xBE86, 0x7DE1, 0xBE87, 0x7DE2, 0xBE88, - 0x7DE3, 0xBE89, 0x7DE4, 0xBE8A, 0x7DE5, 0xBE8B, 0x7DE6, 0xBE8C, - 0x7DE7, 0xBE8D, 0x7DE8, 0xBE8E, 0x7DE9, 0xBE8F, 0x7DEA, 0xBE90, - 0x7DEB, 0xBE91, 0x7DEC, 0xBE92, 0x7DED, 0xBE93, 0x7DEE, 0xBE94, - 0x7DEF, 0xBE95, 0x7DF0, 0xBE96, 0x7DF1, 0xBE97, 0x7DF2, 0xBE98, - 0x7DF3, 0xBE99, 0x7DF4, 0xBE9A, 0x7DF5, 0xBE9B, 0x7DF6, 0xBE9C, - 0x7DF7, 0xBE9D, 0x7DF8, 0xBE9E, 0x7DF9, 0xBE9F, 0x7DFA, 0xBEA0, - 0x7DFB, 0xBF40, 0x7DFC, 0xBF41, 0x7DFD, 0xBF42, 0x7DFE, 0xBF43, - 0x7DFF, 0xBF44, 0x7E00, 0xBF45, 0x7E01, 0xBF46, 0x7E02, 0xBF47, - 0x7E03, 0xBF48, 0x7E04, 0xBF49, 0x7E05, 0xBF4A, 0x7E06, 0xBF4B, - 0x7E07, 0xBF4C, 0x7E08, 0xBF4D, 0x7E09, 0xBF4E, 0x7E0A, 0xBF4F, - 0x7E0B, 0xBF50, 0x7E0C, 0xBF51, 0x7E0D, 0xBF52, 0x7E0E, 0xBF53, - 0x7E0F, 0xBF54, 0x7E10, 0xBF55, 0x7E11, 0xBF56, 0x7E12, 0xBF57, - 0x7E13, 0xBF58, 0x7E14, 0xBF59, 0x7E15, 0xBF5A, 0x7E16, 0xBF5B, - 0x7E17, 0xBF5C, 0x7E18, 0xBF5D, 0x7E19, 0xBF5E, 0x7E1A, 0xBF5F, - 0x7E1B, 0xBF60, 0x7E1C, 0xBF61, 0x7E1D, 0xBF62, 0x7E1E, 0xBF63, - 0x7E1F, 0xBF64, 0x7E20, 0xBF65, 0x7E21, 0xBF66, 0x7E22, 0xBF67, - 0x7E23, 0xBF68, 0x7E24, 0xBF69, 0x7E25, 0xBF6A, 0x7E26, 0xBF6B, - 0x7E27, 0xBF6C, 0x7E28, 0xBF6D, 0x7E29, 0xBF6E, 0x7E2A, 0xBF6F, - 0x7E2B, 0xBF70, 0x7E2C, 0xBF71, 0x7E2D, 0xBF72, 0x7E2E, 0xBF73, - 0x7E2F, 0xBF74, 0x7E30, 0xBF75, 0x7E31, 0xBF76, 0x7E32, 0xBF77, - 0x7E33, 0xBF78, 0x7E34, 0xBF79, 0x7E35, 0xBF7A, 0x7E36, 0xBF7B, - 0x7E37, 0xBF7C, 0x7E38, 0xBF7D, 0x7E39, 0xBF7E, 0x7E3A, 0xBF80, - 0x7E3B, 0xF7E3, 0x7E3C, 0xBF81, 0x7E3D, 0xBF82, 0x7E3E, 0xBF83, - 0x7E3F, 0xBF84, 0x7E40, 0xBF85, 0x7E41, 0xB7B1, 0x7E42, 0xBF86, - 0x7E43, 0xBF87, 0x7E44, 0xBF88, 0x7E45, 0xBF89, 0x7E46, 0xBF8A, - 0x7E47, 0xF4ED, 0x7E48, 0xBF8B, 0x7E49, 0xBF8C, 0x7E4A, 0xBF8D, - 0x7E4B, 0xBF8E, 0x7E4C, 0xBF8F, 0x7E4D, 0xBF90, 0x7E4E, 0xBF91, - 0x7E4F, 0xBF92, 0x7E50, 0xBF93, 0x7E51, 0xBF94, 0x7E52, 0xBF95, - 0x7E53, 0xBF96, 0x7E54, 0xBF97, 0x7E55, 0xBF98, 0x7E56, 0xBF99, - 0x7E57, 0xBF9A, 0x7E58, 0xBF9B, 0x7E59, 0xBF9C, 0x7E5A, 0xBF9D, - 0x7E5B, 0xBF9E, 0x7E5C, 0xBF9F, 0x7E5D, 0xBFA0, 0x7E5E, 0xC040, - 0x7E5F, 0xC041, 0x7E60, 0xC042, 0x7E61, 0xC043, 0x7E62, 0xC044, - 0x7E63, 0xC045, 0x7E64, 0xC046, 0x7E65, 0xC047, 0x7E66, 0xC048, - 0x7E67, 0xC049, 0x7E68, 0xC04A, 0x7E69, 0xC04B, 0x7E6A, 0xC04C, - 0x7E6B, 0xC04D, 0x7E6C, 0xC04E, 0x7E6D, 0xC04F, 0x7E6E, 0xC050, - 0x7E6F, 0xC051, 0x7E70, 0xC052, 0x7E71, 0xC053, 0x7E72, 0xC054, - 0x7E73, 0xC055, 0x7E74, 0xC056, 0x7E75, 0xC057, 0x7E76, 0xC058, - 0x7E77, 0xC059, 0x7E78, 0xC05A, 0x7E79, 0xC05B, 0x7E7A, 0xC05C, - 0x7E7B, 0xC05D, 0x7E7C, 0xC05E, 0x7E7D, 0xC05F, 0x7E7E, 0xC060, - 0x7E7F, 0xC061, 0x7E80, 0xC062, 0x7E81, 0xC063, 0x7E82, 0xD7EB, - 0x7E83, 0xC064, 0x7E84, 0xC065, 0x7E85, 0xC066, 0x7E86, 0xC067, - 0x7E87, 0xC068, 0x7E88, 0xC069, 0x7E89, 0xC06A, 0x7E8A, 0xC06B, - 0x7E8B, 0xC06C, 0x7E8C, 0xC06D, 0x7E8D, 0xC06E, 0x7E8E, 0xC06F, - 0x7E8F, 0xC070, 0x7E90, 0xC071, 0x7E91, 0xC072, 0x7E92, 0xC073, - 0x7E93, 0xC074, 0x7E94, 0xC075, 0x7E95, 0xC076, 0x7E96, 0xC077, - 0x7E97, 0xC078, 0x7E98, 0xC079, 0x7E99, 0xC07A, 0x7E9A, 0xC07B, - 0x7E9B, 0xF4EE, 0x7E9C, 0xC07C, 0x7E9D, 0xC07D, 0x7E9E, 0xC07E, - 0x7E9F, 0xE6F9, 0x7EA0, 0xBEC0, 0x7EA1, 0xE6FA, 0x7EA2, 0xBAEC, - 0x7EA3, 0xE6FB, 0x7EA4, 0xCFCB, 0x7EA5, 0xE6FC, 0x7EA6, 0xD4BC, - 0x7EA7, 0xBCB6, 0x7EA8, 0xE6FD, 0x7EA9, 0xE6FE, 0x7EAA, 0xBCCD, - 0x7EAB, 0xC8D2, 0x7EAC, 0xCEB3, 0x7EAD, 0xE7A1, 0x7EAE, 0xC080, - 0x7EAF, 0xB4BF, 0x7EB0, 0xE7A2, 0x7EB1, 0xC9B4, 0x7EB2, 0xB8D9, - 0x7EB3, 0xC4C9, 0x7EB4, 0xC081, 0x7EB5, 0xD7DD, 0x7EB6, 0xC2DA, - 0x7EB7, 0xB7D7, 0x7EB8, 0xD6BD, 0x7EB9, 0xCEC6, 0x7EBA, 0xB7C4, - 0x7EBB, 0xC082, 0x7EBC, 0xC083, 0x7EBD, 0xC5A6, 0x7EBE, 0xE7A3, - 0x7EBF, 0xCFDF, 0x7EC0, 0xE7A4, 0x7EC1, 0xE7A5, 0x7EC2, 0xE7A6, - 0x7EC3, 0xC1B7, 0x7EC4, 0xD7E9, 0x7EC5, 0xC9F0, 0x7EC6, 0xCFB8, - 0x7EC7, 0xD6AF, 0x7EC8, 0xD6D5, 0x7EC9, 0xE7A7, 0x7ECA, 0xB0ED, - 0x7ECB, 0xE7A8, 0x7ECC, 0xE7A9, 0x7ECD, 0xC9DC, 0x7ECE, 0xD2EF, - 0x7ECF, 0xBEAD, 0x7ED0, 0xE7AA, 0x7ED1, 0xB0F3, 0x7ED2, 0xC8DE, - 0x7ED3, 0xBDE1, 0x7ED4, 0xE7AB, 0x7ED5, 0xC8C6, 0x7ED6, 0xC084, - 0x7ED7, 0xE7AC, 0x7ED8, 0xBBE6, 0x7ED9, 0xB8F8, 0x7EDA, 0xD1A4, - 0x7EDB, 0xE7AD, 0x7EDC, 0xC2E7, 0x7EDD, 0xBEF8, 0x7EDE, 0xBDCA, - 0x7EDF, 0xCDB3, 0x7EE0, 0xE7AE, 0x7EE1, 0xE7AF, 0x7EE2, 0xBEEE, - 0x7EE3, 0xD0E5, 0x7EE4, 0xC085, 0x7EE5, 0xCBE7, 0x7EE6, 0xCCD0, - 0x7EE7, 0xBCCC, 0x7EE8, 0xE7B0, 0x7EE9, 0xBCA8, 0x7EEA, 0xD0F7, - 0x7EEB, 0xE7B1, 0x7EEC, 0xC086, 0x7EED, 0xD0F8, 0x7EEE, 0xE7B2, - 0x7EEF, 0xE7B3, 0x7EF0, 0xB4C2, 0x7EF1, 0xE7B4, 0x7EF2, 0xE7B5, - 0x7EF3, 0xC9FE, 0x7EF4, 0xCEAC, 0x7EF5, 0xC3E0, 0x7EF6, 0xE7B7, - 0x7EF7, 0xB1C1, 0x7EF8, 0xB3F1, 0x7EF9, 0xC087, 0x7EFA, 0xE7B8, - 0x7EFB, 0xE7B9, 0x7EFC, 0xD7DB, 0x7EFD, 0xD5C0, 0x7EFE, 0xE7BA, - 0x7EFF, 0xC2CC, 0x7F00, 0xD7BA, 0x7F01, 0xE7BB, 0x7F02, 0xE7BC, - 0x7F03, 0xE7BD, 0x7F04, 0xBCEA, 0x7F05, 0xC3E5, 0x7F06, 0xC0C2, - 0x7F07, 0xE7BE, 0x7F08, 0xE7BF, 0x7F09, 0xBCA9, 0x7F0A, 0xC088, - 0x7F0B, 0xE7C0, 0x7F0C, 0xE7C1, 0x7F0D, 0xE7B6, 0x7F0E, 0xB6D0, - 0x7F0F, 0xE7C2, 0x7F10, 0xC089, 0x7F11, 0xE7C3, 0x7F12, 0xE7C4, - 0x7F13, 0xBBBA, 0x7F14, 0xB5DE, 0x7F15, 0xC2C6, 0x7F16, 0xB1E0, - 0x7F17, 0xE7C5, 0x7F18, 0xD4B5, 0x7F19, 0xE7C6, 0x7F1A, 0xB8BF, - 0x7F1B, 0xE7C8, 0x7F1C, 0xE7C7, 0x7F1D, 0xB7EC, 0x7F1E, 0xC08A, - 0x7F1F, 0xE7C9, 0x7F20, 0xB2F8, 0x7F21, 0xE7CA, 0x7F22, 0xE7CB, - 0x7F23, 0xE7CC, 0x7F24, 0xE7CD, 0x7F25, 0xE7CE, 0x7F26, 0xE7CF, - 0x7F27, 0xE7D0, 0x7F28, 0xD3A7, 0x7F29, 0xCBF5, 0x7F2A, 0xE7D1, - 0x7F2B, 0xE7D2, 0x7F2C, 0xE7D3, 0x7F2D, 0xE7D4, 0x7F2E, 0xC9C9, - 0x7F2F, 0xE7D5, 0x7F30, 0xE7D6, 0x7F31, 0xE7D7, 0x7F32, 0xE7D8, - 0x7F33, 0xE7D9, 0x7F34, 0xBDC9, 0x7F35, 0xE7DA, 0x7F36, 0xF3BE, - 0x7F37, 0xC08B, 0x7F38, 0xB8D7, 0x7F39, 0xC08C, 0x7F3A, 0xC8B1, - 0x7F3B, 0xC08D, 0x7F3C, 0xC08E, 0x7F3D, 0xC08F, 0x7F3E, 0xC090, - 0x7F3F, 0xC091, 0x7F40, 0xC092, 0x7F41, 0xC093, 0x7F42, 0xF3BF, - 0x7F43, 0xC094, 0x7F44, 0xF3C0, 0x7F45, 0xF3C1, 0x7F46, 0xC095, - 0x7F47, 0xC096, 0x7F48, 0xC097, 0x7F49, 0xC098, 0x7F4A, 0xC099, - 0x7F4B, 0xC09A, 0x7F4C, 0xC09B, 0x7F4D, 0xC09C, 0x7F4E, 0xC09D, - 0x7F4F, 0xC09E, 0x7F50, 0xB9DE, 0x7F51, 0xCDF8, 0x7F52, 0xC09F, - 0x7F53, 0xC0A0, 0x7F54, 0xD8E8, 0x7F55, 0xBAB1, 0x7F56, 0xC140, - 0x7F57, 0xC2DE, 0x7F58, 0xEEB7, 0x7F59, 0xC141, 0x7F5A, 0xB7A3, - 0x7F5B, 0xC142, 0x7F5C, 0xC143, 0x7F5D, 0xC144, 0x7F5E, 0xC145, - 0x7F5F, 0xEEB9, 0x7F60, 0xC146, 0x7F61, 0xEEB8, 0x7F62, 0xB0D5, - 0x7F63, 0xC147, 0x7F64, 0xC148, 0x7F65, 0xC149, 0x7F66, 0xC14A, - 0x7F67, 0xC14B, 0x7F68, 0xEEBB, 0x7F69, 0xD5D6, 0x7F6A, 0xD7EF, - 0x7F6B, 0xC14C, 0x7F6C, 0xC14D, 0x7F6D, 0xC14E, 0x7F6E, 0xD6C3, - 0x7F6F, 0xC14F, 0x7F70, 0xC150, 0x7F71, 0xEEBD, 0x7F72, 0xCAF0, - 0x7F73, 0xC151, 0x7F74, 0xEEBC, 0x7F75, 0xC152, 0x7F76, 0xC153, - 0x7F77, 0xC154, 0x7F78, 0xC155, 0x7F79, 0xEEBE, 0x7F7A, 0xC156, - 0x7F7B, 0xC157, 0x7F7C, 0xC158, 0x7F7D, 0xC159, 0x7F7E, 0xEEC0, - 0x7F7F, 0xC15A, 0x7F80, 0xC15B, 0x7F81, 0xEEBF, 0x7F82, 0xC15C, - 0x7F83, 0xC15D, 0x7F84, 0xC15E, 0x7F85, 0xC15F, 0x7F86, 0xC160, - 0x7F87, 0xC161, 0x7F88, 0xC162, 0x7F89, 0xC163, 0x7F8A, 0xD1F2, - 0x7F8B, 0xC164, 0x7F8C, 0xC7BC, 0x7F8D, 0xC165, 0x7F8E, 0xC3C0, - 0x7F8F, 0xC166, 0x7F90, 0xC167, 0x7F91, 0xC168, 0x7F92, 0xC169, - 0x7F93, 0xC16A, 0x7F94, 0xB8E1, 0x7F95, 0xC16B, 0x7F96, 0xC16C, - 0x7F97, 0xC16D, 0x7F98, 0xC16E, 0x7F99, 0xC16F, 0x7F9A, 0xC1E7, - 0x7F9B, 0xC170, 0x7F9C, 0xC171, 0x7F9D, 0xF4C6, 0x7F9E, 0xD0DF, - 0x7F9F, 0xF4C7, 0x7FA0, 0xC172, 0x7FA1, 0xCFDB, 0x7FA2, 0xC173, - 0x7FA3, 0xC174, 0x7FA4, 0xC8BA, 0x7FA5, 0xC175, 0x7FA6, 0xC176, - 0x7FA7, 0xF4C8, 0x7FA8, 0xC177, 0x7FA9, 0xC178, 0x7FAA, 0xC179, - 0x7FAB, 0xC17A, 0x7FAC, 0xC17B, 0x7FAD, 0xC17C, 0x7FAE, 0xC17D, - 0x7FAF, 0xF4C9, 0x7FB0, 0xF4CA, 0x7FB1, 0xC17E, 0x7FB2, 0xF4CB, - 0x7FB3, 0xC180, 0x7FB4, 0xC181, 0x7FB5, 0xC182, 0x7FB6, 0xC183, - 0x7FB7, 0xC184, 0x7FB8, 0xD9FA, 0x7FB9, 0xB8FE, 0x7FBA, 0xC185, - 0x7FBB, 0xC186, 0x7FBC, 0xE5F1, 0x7FBD, 0xD3F0, 0x7FBE, 0xC187, - 0x7FBF, 0xF4E0, 0x7FC0, 0xC188, 0x7FC1, 0xCECC, 0x7FC2, 0xC189, - 0x7FC3, 0xC18A, 0x7FC4, 0xC18B, 0x7FC5, 0xB3E1, 0x7FC6, 0xC18C, - 0x7FC7, 0xC18D, 0x7FC8, 0xC18E, 0x7FC9, 0xC18F, 0x7FCA, 0xF1B4, - 0x7FCB, 0xC190, 0x7FCC, 0xD2EE, 0x7FCD, 0xC191, 0x7FCE, 0xF4E1, - 0x7FCF, 0xC192, 0x7FD0, 0xC193, 0x7FD1, 0xC194, 0x7FD2, 0xC195, - 0x7FD3, 0xC196, 0x7FD4, 0xCFE8, 0x7FD5, 0xF4E2, 0x7FD6, 0xC197, - 0x7FD7, 0xC198, 0x7FD8, 0xC7CC, 0x7FD9, 0xC199, 0x7FDA, 0xC19A, - 0x7FDB, 0xC19B, 0x7FDC, 0xC19C, 0x7FDD, 0xC19D, 0x7FDE, 0xC19E, - 0x7FDF, 0xB5D4, 0x7FE0, 0xB4E4, 0x7FE1, 0xF4E4, 0x7FE2, 0xC19F, - 0x7FE3, 0xC1A0, 0x7FE4, 0xC240, 0x7FE5, 0xF4E3, 0x7FE6, 0xF4E5, - 0x7FE7, 0xC241, 0x7FE8, 0xC242, 0x7FE9, 0xF4E6, 0x7FEA, 0xC243, - 0x7FEB, 0xC244, 0x7FEC, 0xC245, 0x7FED, 0xC246, 0x7FEE, 0xF4E7, - 0x7FEF, 0xC247, 0x7FF0, 0xBAB2, 0x7FF1, 0xB0BF, 0x7FF2, 0xC248, - 0x7FF3, 0xF4E8, 0x7FF4, 0xC249, 0x7FF5, 0xC24A, 0x7FF6, 0xC24B, - 0x7FF7, 0xC24C, 0x7FF8, 0xC24D, 0x7FF9, 0xC24E, 0x7FFA, 0xC24F, - 0x7FFB, 0xB7AD, 0x7FFC, 0xD2ED, 0x7FFD, 0xC250, 0x7FFE, 0xC251, - 0x7FFF, 0xC252, 0x8000, 0xD2AB, 0x8001, 0xC0CF, 0x8002, 0xC253, - 0x8003, 0xBFBC, 0x8004, 0xEBA3, 0x8005, 0xD5DF, 0x8006, 0xEAC8, - 0x8007, 0xC254, 0x8008, 0xC255, 0x8009, 0xC256, 0x800A, 0xC257, - 0x800B, 0xF1F3, 0x800C, 0xB6F8, 0x800D, 0xCBA3, 0x800E, 0xC258, - 0x800F, 0xC259, 0x8010, 0xC4CD, 0x8011, 0xC25A, 0x8012, 0xF1E7, - 0x8013, 0xC25B, 0x8014, 0xF1E8, 0x8015, 0xB8FB, 0x8016, 0xF1E9, - 0x8017, 0xBAC4, 0x8018, 0xD4C5, 0x8019, 0xB0D2, 0x801A, 0xC25C, - 0x801B, 0xC25D, 0x801C, 0xF1EA, 0x801D, 0xC25E, 0x801E, 0xC25F, - 0x801F, 0xC260, 0x8020, 0xF1EB, 0x8021, 0xC261, 0x8022, 0xF1EC, - 0x8023, 0xC262, 0x8024, 0xC263, 0x8025, 0xF1ED, 0x8026, 0xF1EE, - 0x8027, 0xF1EF, 0x8028, 0xF1F1, 0x8029, 0xF1F0, 0x802A, 0xC5D5, - 0x802B, 0xC264, 0x802C, 0xC265, 0x802D, 0xC266, 0x802E, 0xC267, - 0x802F, 0xC268, 0x8030, 0xC269, 0x8031, 0xF1F2, 0x8032, 0xC26A, - 0x8033, 0xB6FA, 0x8034, 0xC26B, 0x8035, 0xF1F4, 0x8036, 0xD2AE, - 0x8037, 0xDEC7, 0x8038, 0xCBCA, 0x8039, 0xC26C, 0x803A, 0xC26D, - 0x803B, 0xB3DC, 0x803C, 0xC26E, 0x803D, 0xB5A2, 0x803E, 0xC26F, - 0x803F, 0xB9A2, 0x8040, 0xC270, 0x8041, 0xC271, 0x8042, 0xC4F4, - 0x8043, 0xF1F5, 0x8044, 0xC272, 0x8045, 0xC273, 0x8046, 0xF1F6, - 0x8047, 0xC274, 0x8048, 0xC275, 0x8049, 0xC276, 0x804A, 0xC1C4, - 0x804B, 0xC1FB, 0x804C, 0xD6B0, 0x804D, 0xF1F7, 0x804E, 0xC277, - 0x804F, 0xC278, 0x8050, 0xC279, 0x8051, 0xC27A, 0x8052, 0xF1F8, - 0x8053, 0xC27B, 0x8054, 0xC1AA, 0x8055, 0xC27C, 0x8056, 0xC27D, - 0x8057, 0xC27E, 0x8058, 0xC6B8, 0x8059, 0xC280, 0x805A, 0xBEDB, - 0x805B, 0xC281, 0x805C, 0xC282, 0x805D, 0xC283, 0x805E, 0xC284, - 0x805F, 0xC285, 0x8060, 0xC286, 0x8061, 0xC287, 0x8062, 0xC288, - 0x8063, 0xC289, 0x8064, 0xC28A, 0x8065, 0xC28B, 0x8066, 0xC28C, - 0x8067, 0xC28D, 0x8068, 0xC28E, 0x8069, 0xF1F9, 0x806A, 0xB4CF, - 0x806B, 0xC28F, 0x806C, 0xC290, 0x806D, 0xC291, 0x806E, 0xC292, - 0x806F, 0xC293, 0x8070, 0xC294, 0x8071, 0xF1FA, 0x8072, 0xC295, - 0x8073, 0xC296, 0x8074, 0xC297, 0x8075, 0xC298, 0x8076, 0xC299, - 0x8077, 0xC29A, 0x8078, 0xC29B, 0x8079, 0xC29C, 0x807A, 0xC29D, - 0x807B, 0xC29E, 0x807C, 0xC29F, 0x807D, 0xC2A0, 0x807E, 0xC340, - 0x807F, 0xEDB2, 0x8080, 0xEDB1, 0x8081, 0xC341, 0x8082, 0xC342, - 0x8083, 0xCBE0, 0x8084, 0xD2DE, 0x8085, 0xC343, 0x8086, 0xCBC1, - 0x8087, 0xD5D8, 0x8088, 0xC344, 0x8089, 0xC8E2, 0x808A, 0xC345, - 0x808B, 0xC0DF, 0x808C, 0xBCA1, 0x808D, 0xC346, 0x808E, 0xC347, - 0x808F, 0xC348, 0x8090, 0xC349, 0x8091, 0xC34A, 0x8092, 0xC34B, - 0x8093, 0xEBC1, 0x8094, 0xC34C, 0x8095, 0xC34D, 0x8096, 0xD0A4, - 0x8097, 0xC34E, 0x8098, 0xD6E2, 0x8099, 0xC34F, 0x809A, 0xB6C7, - 0x809B, 0xB8D8, 0x809C, 0xEBC0, 0x809D, 0xB8CE, 0x809E, 0xC350, - 0x809F, 0xEBBF, 0x80A0, 0xB3A6, 0x80A1, 0xB9C9, 0x80A2, 0xD6AB, - 0x80A3, 0xC351, 0x80A4, 0xB7F4, 0x80A5, 0xB7CA, 0x80A6, 0xC352, - 0x80A7, 0xC353, 0x80A8, 0xC354, 0x80A9, 0xBCE7, 0x80AA, 0xB7BE, - 0x80AB, 0xEBC6, 0x80AC, 0xC355, 0x80AD, 0xEBC7, 0x80AE, 0xB0B9, - 0x80AF, 0xBFCF, 0x80B0, 0xC356, 0x80B1, 0xEBC5, 0x80B2, 0xD3FD, - 0x80B3, 0xC357, 0x80B4, 0xEBC8, 0x80B5, 0xC358, 0x80B6, 0xC359, - 0x80B7, 0xEBC9, 0x80B8, 0xC35A, 0x80B9, 0xC35B, 0x80BA, 0xB7CE, - 0x80BB, 0xC35C, 0x80BC, 0xEBC2, 0x80BD, 0xEBC4, 0x80BE, 0xC9F6, - 0x80BF, 0xD6D7, 0x80C0, 0xD5CD, 0x80C1, 0xD0B2, 0x80C2, 0xEBCF, - 0x80C3, 0xCEB8, 0x80C4, 0xEBD0, 0x80C5, 0xC35D, 0x80C6, 0xB5A8, - 0x80C7, 0xC35E, 0x80C8, 0xC35F, 0x80C9, 0xC360, 0x80CA, 0xC361, - 0x80CB, 0xC362, 0x80CC, 0xB1B3, 0x80CD, 0xEBD2, 0x80CE, 0xCCA5, - 0x80CF, 0xC363, 0x80D0, 0xC364, 0x80D1, 0xC365, 0x80D2, 0xC366, - 0x80D3, 0xC367, 0x80D4, 0xC368, 0x80D5, 0xC369, 0x80D6, 0xC5D6, - 0x80D7, 0xEBD3, 0x80D8, 0xC36A, 0x80D9, 0xEBD1, 0x80DA, 0xC5DF, - 0x80DB, 0xEBCE, 0x80DC, 0xCAA4, 0x80DD, 0xEBD5, 0x80DE, 0xB0FB, - 0x80DF, 0xC36B, 0x80E0, 0xC36C, 0x80E1, 0xBAFA, 0x80E2, 0xC36D, - 0x80E3, 0xC36E, 0x80E4, 0xD8B7, 0x80E5, 0xF1E3, 0x80E6, 0xC36F, - 0x80E7, 0xEBCA, 0x80E8, 0xEBCB, 0x80E9, 0xEBCC, 0x80EA, 0xEBCD, - 0x80EB, 0xEBD6, 0x80EC, 0xE6C0, 0x80ED, 0xEBD9, 0x80EE, 0xC370, - 0x80EF, 0xBFE8, 0x80F0, 0xD2C8, 0x80F1, 0xEBD7, 0x80F2, 0xEBDC, - 0x80F3, 0xB8EC, 0x80F4, 0xEBD8, 0x80F5, 0xC371, 0x80F6, 0xBDBA, - 0x80F7, 0xC372, 0x80F8, 0xD0D8, 0x80F9, 0xC373, 0x80FA, 0xB0B7, - 0x80FB, 0xC374, 0x80FC, 0xEBDD, 0x80FD, 0xC4DC, 0x80FE, 0xC375, - 0x80FF, 0xC376, 0x8100, 0xC377, 0x8101, 0xC378, 0x8102, 0xD6AC, - 0x8103, 0xC379, 0x8104, 0xC37A, 0x8105, 0xC37B, 0x8106, 0xB4E0, - 0x8107, 0xC37C, 0x8108, 0xC37D, 0x8109, 0xC2F6, 0x810A, 0xBCB9, - 0x810B, 0xC37E, 0x810C, 0xC380, 0x810D, 0xEBDA, 0x810E, 0xEBDB, - 0x810F, 0xD4E0, 0x8110, 0xC6EA, 0x8111, 0xC4D4, 0x8112, 0xEBDF, - 0x8113, 0xC5A7, 0x8114, 0xD9F5, 0x8115, 0xC381, 0x8116, 0xB2B1, - 0x8117, 0xC382, 0x8118, 0xEBE4, 0x8119, 0xC383, 0x811A, 0xBDC5, - 0x811B, 0xC384, 0x811C, 0xC385, 0x811D, 0xC386, 0x811E, 0xEBE2, - 0x811F, 0xC387, 0x8120, 0xC388, 0x8121, 0xC389, 0x8122, 0xC38A, - 0x8123, 0xC38B, 0x8124, 0xC38C, 0x8125, 0xC38D, 0x8126, 0xC38E, - 0x8127, 0xC38F, 0x8128, 0xC390, 0x8129, 0xC391, 0x812A, 0xC392, - 0x812B, 0xC393, 0x812C, 0xEBE3, 0x812D, 0xC394, 0x812E, 0xC395, - 0x812F, 0xB8AC, 0x8130, 0xC396, 0x8131, 0xCDD1, 0x8132, 0xEBE5, - 0x8133, 0xC397, 0x8134, 0xC398, 0x8135, 0xC399, 0x8136, 0xEBE1, - 0x8137, 0xC39A, 0x8138, 0xC1B3, 0x8139, 0xC39B, 0x813A, 0xC39C, - 0x813B, 0xC39D, 0x813C, 0xC39E, 0x813D, 0xC39F, 0x813E, 0xC6A2, - 0x813F, 0xC3A0, 0x8140, 0xC440, 0x8141, 0xC441, 0x8142, 0xC442, - 0x8143, 0xC443, 0x8144, 0xC444, 0x8145, 0xC445, 0x8146, 0xCCF3, - 0x8147, 0xC446, 0x8148, 0xEBE6, 0x8149, 0xC447, 0x814A, 0xC0B0, - 0x814B, 0xD2B8, 0x814C, 0xEBE7, 0x814D, 0xC448, 0x814E, 0xC449, - 0x814F, 0xC44A, 0x8150, 0xB8AF, 0x8151, 0xB8AD, 0x8152, 0xC44B, - 0x8153, 0xEBE8, 0x8154, 0xC7BB, 0x8155, 0xCDF3, 0x8156, 0xC44C, - 0x8157, 0xC44D, 0x8158, 0xC44E, 0x8159, 0xEBEA, 0x815A, 0xEBEB, - 0x815B, 0xC44F, 0x815C, 0xC450, 0x815D, 0xC451, 0x815E, 0xC452, - 0x815F, 0xC453, 0x8160, 0xEBED, 0x8161, 0xC454, 0x8162, 0xC455, - 0x8163, 0xC456, 0x8164, 0xC457, 0x8165, 0xD0C8, 0x8166, 0xC458, - 0x8167, 0xEBF2, 0x8168, 0xC459, 0x8169, 0xEBEE, 0x816A, 0xC45A, - 0x816B, 0xC45B, 0x816C, 0xC45C, 0x816D, 0xEBF1, 0x816E, 0xC8F9, - 0x816F, 0xC45D, 0x8170, 0xD1FC, 0x8171, 0xEBEC, 0x8172, 0xC45E, - 0x8173, 0xC45F, 0x8174, 0xEBE9, 0x8175, 0xC460, 0x8176, 0xC461, - 0x8177, 0xC462, 0x8178, 0xC463, 0x8179, 0xB8B9, 0x817A, 0xCFD9, - 0x817B, 0xC4E5, 0x817C, 0xEBEF, 0x817D, 0xEBF0, 0x817E, 0xCCDA, - 0x817F, 0xCDC8, 0x8180, 0xB0F2, 0x8181, 0xC464, 0x8182, 0xEBF6, - 0x8183, 0xC465, 0x8184, 0xC466, 0x8185, 0xC467, 0x8186, 0xC468, - 0x8187, 0xC469, 0x8188, 0xEBF5, 0x8189, 0xC46A, 0x818A, 0xB2B2, - 0x818B, 0xC46B, 0x818C, 0xC46C, 0x818D, 0xC46D, 0x818E, 0xC46E, - 0x818F, 0xB8E0, 0x8190, 0xC46F, 0x8191, 0xEBF7, 0x8192, 0xC470, - 0x8193, 0xC471, 0x8194, 0xC472, 0x8195, 0xC473, 0x8196, 0xC474, - 0x8197, 0xC475, 0x8198, 0xB1EC, 0x8199, 0xC476, 0x819A, 0xC477, - 0x819B, 0xCCC5, 0x819C, 0xC4A4, 0x819D, 0xCFA5, 0x819E, 0xC478, - 0x819F, 0xC479, 0x81A0, 0xC47A, 0x81A1, 0xC47B, 0x81A2, 0xC47C, - 0x81A3, 0xEBF9, 0x81A4, 0xC47D, 0x81A5, 0xC47E, 0x81A6, 0xECA2, - 0x81A7, 0xC480, 0x81A8, 0xC5F2, 0x81A9, 0xC481, 0x81AA, 0xEBFA, - 0x81AB, 0xC482, 0x81AC, 0xC483, 0x81AD, 0xC484, 0x81AE, 0xC485, - 0x81AF, 0xC486, 0x81B0, 0xC487, 0x81B1, 0xC488, 0x81B2, 0xC489, - 0x81B3, 0xC9C5, 0x81B4, 0xC48A, 0x81B5, 0xC48B, 0x81B6, 0xC48C, - 0x81B7, 0xC48D, 0x81B8, 0xC48E, 0x81B9, 0xC48F, 0x81BA, 0xE2DF, - 0x81BB, 0xEBFE, 0x81BC, 0xC490, 0x81BD, 0xC491, 0x81BE, 0xC492, - 0x81BF, 0xC493, 0x81C0, 0xCDCE, 0x81C1, 0xECA1, 0x81C2, 0xB1DB, - 0x81C3, 0xD3B7, 0x81C4, 0xC494, 0x81C5, 0xC495, 0x81C6, 0xD2DC, - 0x81C7, 0xC496, 0x81C8, 0xC497, 0x81C9, 0xC498, 0x81CA, 0xEBFD, - 0x81CB, 0xC499, 0x81CC, 0xEBFB, 0x81CD, 0xC49A, 0x81CE, 0xC49B, - 0x81CF, 0xC49C, 0x81D0, 0xC49D, 0x81D1, 0xC49E, 0x81D2, 0xC49F, - 0x81D3, 0xC4A0, 0x81D4, 0xC540, 0x81D5, 0xC541, 0x81D6, 0xC542, - 0x81D7, 0xC543, 0x81D8, 0xC544, 0x81D9, 0xC545, 0x81DA, 0xC546, - 0x81DB, 0xC547, 0x81DC, 0xC548, 0x81DD, 0xC549, 0x81DE, 0xC54A, - 0x81DF, 0xC54B, 0x81E0, 0xC54C, 0x81E1, 0xC54D, 0x81E2, 0xC54E, - 0x81E3, 0xB3BC, 0x81E4, 0xC54F, 0x81E5, 0xC550, 0x81E6, 0xC551, - 0x81E7, 0xEAB0, 0x81E8, 0xC552, 0x81E9, 0xC553, 0x81EA, 0xD7D4, - 0x81EB, 0xC554, 0x81EC, 0xF4AB, 0x81ED, 0xB3F4, 0x81EE, 0xC555, - 0x81EF, 0xC556, 0x81F0, 0xC557, 0x81F1, 0xC558, 0x81F2, 0xC559, - 0x81F3, 0xD6C1, 0x81F4, 0xD6C2, 0x81F5, 0xC55A, 0x81F6, 0xC55B, - 0x81F7, 0xC55C, 0x81F8, 0xC55D, 0x81F9, 0xC55E, 0x81FA, 0xC55F, - 0x81FB, 0xD5E9, 0x81FC, 0xBECA, 0x81FD, 0xC560, 0x81FE, 0xF4A7, - 0x81FF, 0xC561, 0x8200, 0xD2A8, 0x8201, 0xF4A8, 0x8202, 0xF4A9, - 0x8203, 0xC562, 0x8204, 0xF4AA, 0x8205, 0xBECB, 0x8206, 0xD3DF, - 0x8207, 0xC563, 0x8208, 0xC564, 0x8209, 0xC565, 0x820A, 0xC566, - 0x820B, 0xC567, 0x820C, 0xC9E0, 0x820D, 0xC9E1, 0x820E, 0xC568, - 0x820F, 0xC569, 0x8210, 0xF3C2, 0x8211, 0xC56A, 0x8212, 0xCAE6, - 0x8213, 0xC56B, 0x8214, 0xCCF2, 0x8215, 0xC56C, 0x8216, 0xC56D, - 0x8217, 0xC56E, 0x8218, 0xC56F, 0x8219, 0xC570, 0x821A, 0xC571, - 0x821B, 0xE2B6, 0x821C, 0xCBB4, 0x821D, 0xC572, 0x821E, 0xCEE8, - 0x821F, 0xD6DB, 0x8220, 0xC573, 0x8221, 0xF4AD, 0x8222, 0xF4AE, - 0x8223, 0xF4AF, 0x8224, 0xC574, 0x8225, 0xC575, 0x8226, 0xC576, - 0x8227, 0xC577, 0x8228, 0xF4B2, 0x8229, 0xC578, 0x822A, 0xBABD, - 0x822B, 0xF4B3, 0x822C, 0xB0E3, 0x822D, 0xF4B0, 0x822E, 0xC579, - 0x822F, 0xF4B1, 0x8230, 0xBDA2, 0x8231, 0xB2D5, 0x8232, 0xC57A, - 0x8233, 0xF4B6, 0x8234, 0xF4B7, 0x8235, 0xB6E6, 0x8236, 0xB2B0, - 0x8237, 0xCFCF, 0x8238, 0xF4B4, 0x8239, 0xB4AC, 0x823A, 0xC57B, - 0x823B, 0xF4B5, 0x823C, 0xC57C, 0x823D, 0xC57D, 0x823E, 0xF4B8, - 0x823F, 0xC57E, 0x8240, 0xC580, 0x8241, 0xC581, 0x8242, 0xC582, - 0x8243, 0xC583, 0x8244, 0xF4B9, 0x8245, 0xC584, 0x8246, 0xC585, - 0x8247, 0xCDA7, 0x8248, 0xC586, 0x8249, 0xF4BA, 0x824A, 0xC587, - 0x824B, 0xF4BB, 0x824C, 0xC588, 0x824D, 0xC589, 0x824E, 0xC58A, - 0x824F, 0xF4BC, 0x8250, 0xC58B, 0x8251, 0xC58C, 0x8252, 0xC58D, - 0x8253, 0xC58E, 0x8254, 0xC58F, 0x8255, 0xC590, 0x8256, 0xC591, - 0x8257, 0xC592, 0x8258, 0xCBD2, 0x8259, 0xC593, 0x825A, 0xF4BD, - 0x825B, 0xC594, 0x825C, 0xC595, 0x825D, 0xC596, 0x825E, 0xC597, - 0x825F, 0xF4BE, 0x8260, 0xC598, 0x8261, 0xC599, 0x8262, 0xC59A, - 0x8263, 0xC59B, 0x8264, 0xC59C, 0x8265, 0xC59D, 0x8266, 0xC59E, - 0x8267, 0xC59F, 0x8268, 0xF4BF, 0x8269, 0xC5A0, 0x826A, 0xC640, - 0x826B, 0xC641, 0x826C, 0xC642, 0x826D, 0xC643, 0x826E, 0xF4DE, - 0x826F, 0xC1BC, 0x8270, 0xBCE8, 0x8271, 0xC644, 0x8272, 0xC9AB, - 0x8273, 0xD1DE, 0x8274, 0xE5F5, 0x8275, 0xC645, 0x8276, 0xC646, - 0x8277, 0xC647, 0x8278, 0xC648, 0x8279, 0xDCB3, 0x827A, 0xD2D5, - 0x827B, 0xC649, 0x827C, 0xC64A, 0x827D, 0xDCB4, 0x827E, 0xB0AC, - 0x827F, 0xDCB5, 0x8280, 0xC64B, 0x8281, 0xC64C, 0x8282, 0xBDDA, - 0x8283, 0xC64D, 0x8284, 0xDCB9, 0x8285, 0xC64E, 0x8286, 0xC64F, - 0x8287, 0xC650, 0x8288, 0xD8C2, 0x8289, 0xC651, 0x828A, 0xDCB7, - 0x828B, 0xD3F3, 0x828C, 0xC652, 0x828D, 0xC9D6, 0x828E, 0xDCBA, - 0x828F, 0xDCB6, 0x8290, 0xC653, 0x8291, 0xDCBB, 0x8292, 0xC3A2, - 0x8293, 0xC654, 0x8294, 0xC655, 0x8295, 0xC656, 0x8296, 0xC657, - 0x8297, 0xDCBC, 0x8298, 0xDCC5, 0x8299, 0xDCBD, 0x829A, 0xC658, - 0x829B, 0xC659, 0x829C, 0xCEDF, 0x829D, 0xD6A5, 0x829E, 0xC65A, - 0x829F, 0xDCCF, 0x82A0, 0xC65B, 0x82A1, 0xDCCD, 0x82A2, 0xC65C, - 0x82A3, 0xC65D, 0x82A4, 0xDCD2, 0x82A5, 0xBDE6, 0x82A6, 0xC2AB, - 0x82A7, 0xC65E, 0x82A8, 0xDCB8, 0x82A9, 0xDCCB, 0x82AA, 0xDCCE, - 0x82AB, 0xDCBE, 0x82AC, 0xB7D2, 0x82AD, 0xB0C5, 0x82AE, 0xDCC7, - 0x82AF, 0xD0BE, 0x82B0, 0xDCC1, 0x82B1, 0xBBA8, 0x82B2, 0xC65F, - 0x82B3, 0xB7BC, 0x82B4, 0xDCCC, 0x82B5, 0xC660, 0x82B6, 0xC661, - 0x82B7, 0xDCC6, 0x82B8, 0xDCBF, 0x82B9, 0xC7DB, 0x82BA, 0xC662, - 0x82BB, 0xC663, 0x82BC, 0xC664, 0x82BD, 0xD1BF, 0x82BE, 0xDCC0, - 0x82BF, 0xC665, 0x82C0, 0xC666, 0x82C1, 0xDCCA, 0x82C2, 0xC667, - 0x82C3, 0xC668, 0x82C4, 0xDCD0, 0x82C5, 0xC669, 0x82C6, 0xC66A, - 0x82C7, 0xCEAD, 0x82C8, 0xDCC2, 0x82C9, 0xC66B, 0x82CA, 0xDCC3, - 0x82CB, 0xDCC8, 0x82CC, 0xDCC9, 0x82CD, 0xB2D4, 0x82CE, 0xDCD1, - 0x82CF, 0xCBD5, 0x82D0, 0xC66C, 0x82D1, 0xD4B7, 0x82D2, 0xDCDB, - 0x82D3, 0xDCDF, 0x82D4, 0xCCA6, 0x82D5, 0xDCE6, 0x82D6, 0xC66D, - 0x82D7, 0xC3E7, 0x82D8, 0xDCDC, 0x82D9, 0xC66E, 0x82DA, 0xC66F, - 0x82DB, 0xBFC1, 0x82DC, 0xDCD9, 0x82DD, 0xC670, 0x82DE, 0xB0FA, - 0x82DF, 0xB9B6, 0x82E0, 0xDCE5, 0x82E1, 0xDCD3, 0x82E2, 0xC671, - 0x82E3, 0xDCC4, 0x82E4, 0xDCD6, 0x82E5, 0xC8F4, 0x82E6, 0xBFE0, - 0x82E7, 0xC672, 0x82E8, 0xC673, 0x82E9, 0xC674, 0x82EA, 0xC675, - 0x82EB, 0xC9BB, 0x82EC, 0xC676, 0x82ED, 0xC677, 0x82EE, 0xC678, - 0x82EF, 0xB1BD, 0x82F0, 0xC679, 0x82F1, 0xD3A2, 0x82F2, 0xC67A, - 0x82F3, 0xC67B, 0x82F4, 0xDCDA, 0x82F5, 0xC67C, 0x82F6, 0xC67D, - 0x82F7, 0xDCD5, 0x82F8, 0xC67E, 0x82F9, 0xC6BB, 0x82FA, 0xC680, - 0x82FB, 0xDCDE, 0x82FC, 0xC681, 0x82FD, 0xC682, 0x82FE, 0xC683, - 0x82FF, 0xC684, 0x8300, 0xC685, 0x8301, 0xD7C2, 0x8302, 0xC3AF, - 0x8303, 0xB7B6, 0x8304, 0xC7D1, 0x8305, 0xC3A9, 0x8306, 0xDCE2, - 0x8307, 0xDCD8, 0x8308, 0xDCEB, 0x8309, 0xDCD4, 0x830A, 0xC686, - 0x830B, 0xC687, 0x830C, 0xDCDD, 0x830D, 0xC688, 0x830E, 0xBEA5, - 0x830F, 0xDCD7, 0x8310, 0xC689, 0x8311, 0xDCE0, 0x8312, 0xC68A, - 0x8313, 0xC68B, 0x8314, 0xDCE3, 0x8315, 0xDCE4, 0x8316, 0xC68C, - 0x8317, 0xDCF8, 0x8318, 0xC68D, 0x8319, 0xC68E, 0x831A, 0xDCE1, - 0x831B, 0xDDA2, 0x831C, 0xDCE7, 0x831D, 0xC68F, 0x831E, 0xC690, - 0x831F, 0xC691, 0x8320, 0xC692, 0x8321, 0xC693, 0x8322, 0xC694, - 0x8323, 0xC695, 0x8324, 0xC696, 0x8325, 0xC697, 0x8326, 0xC698, - 0x8327, 0xBCEB, 0x8328, 0xB4C4, 0x8329, 0xC699, 0x832A, 0xC69A, - 0x832B, 0xC3A3, 0x832C, 0xB2E7, 0x832D, 0xDCFA, 0x832E, 0xC69B, - 0x832F, 0xDCF2, 0x8330, 0xC69C, 0x8331, 0xDCEF, 0x8332, 0xC69D, - 0x8333, 0xDCFC, 0x8334, 0xDCEE, 0x8335, 0xD2F0, 0x8336, 0xB2E8, - 0x8337, 0xC69E, 0x8338, 0xC8D7, 0x8339, 0xC8E3, 0x833A, 0xDCFB, - 0x833B, 0xC69F, 0x833C, 0xDCED, 0x833D, 0xC6A0, 0x833E, 0xC740, - 0x833F, 0xC741, 0x8340, 0xDCF7, 0x8341, 0xC742, 0x8342, 0xC743, - 0x8343, 0xDCF5, 0x8344, 0xC744, 0x8345, 0xC745, 0x8346, 0xBEA3, - 0x8347, 0xDCF4, 0x8348, 0xC746, 0x8349, 0xB2DD, 0x834A, 0xC747, - 0x834B, 0xC748, 0x834C, 0xC749, 0x834D, 0xC74A, 0x834E, 0xC74B, - 0x834F, 0xDCF3, 0x8350, 0xBCF6, 0x8351, 0xDCE8, 0x8352, 0xBBC4, - 0x8353, 0xC74C, 0x8354, 0xC0F3, 0x8355, 0xC74D, 0x8356, 0xC74E, - 0x8357, 0xC74F, 0x8358, 0xC750, 0x8359, 0xC751, 0x835A, 0xBCD4, - 0x835B, 0xDCE9, 0x835C, 0xDCEA, 0x835D, 0xC752, 0x835E, 0xDCF1, - 0x835F, 0xDCF6, 0x8360, 0xDCF9, 0x8361, 0xB5B4, 0x8362, 0xC753, - 0x8363, 0xC8D9, 0x8364, 0xBBE7, 0x8365, 0xDCFE, 0x8366, 0xDCFD, - 0x8367, 0xD3AB, 0x8368, 0xDDA1, 0x8369, 0xDDA3, 0x836A, 0xDDA5, - 0x836B, 0xD2F1, 0x836C, 0xDDA4, 0x836D, 0xDDA6, 0x836E, 0xDDA7, - 0x836F, 0xD2A9, 0x8370, 0xC754, 0x8371, 0xC755, 0x8372, 0xC756, - 0x8373, 0xC757, 0x8374, 0xC758, 0x8375, 0xC759, 0x8376, 0xC75A, - 0x8377, 0xBAC9, 0x8378, 0xDDA9, 0x8379, 0xC75B, 0x837A, 0xC75C, - 0x837B, 0xDDB6, 0x837C, 0xDDB1, 0x837D, 0xDDB4, 0x837E, 0xC75D, - 0x837F, 0xC75E, 0x8380, 0xC75F, 0x8381, 0xC760, 0x8382, 0xC761, - 0x8383, 0xC762, 0x8384, 0xC763, 0x8385, 0xDDB0, 0x8386, 0xC6CE, - 0x8387, 0xC764, 0x8388, 0xC765, 0x8389, 0xC0F2, 0x838A, 0xC766, - 0x838B, 0xC767, 0x838C, 0xC768, 0x838D, 0xC769, 0x838E, 0xC9AF, - 0x838F, 0xC76A, 0x8390, 0xC76B, 0x8391, 0xC76C, 0x8392, 0xDCEC, - 0x8393, 0xDDAE, 0x8394, 0xC76D, 0x8395, 0xC76E, 0x8396, 0xC76F, - 0x8397, 0xC770, 0x8398, 0xDDB7, 0x8399, 0xC771, 0x839A, 0xC772, - 0x839B, 0xDCF0, 0x839C, 0xDDAF, 0x839D, 0xC773, 0x839E, 0xDDB8, - 0x839F, 0xC774, 0x83A0, 0xDDAC, 0x83A1, 0xC775, 0x83A2, 0xC776, - 0x83A3, 0xC777, 0x83A4, 0xC778, 0x83A5, 0xC779, 0x83A6, 0xC77A, - 0x83A7, 0xC77B, 0x83A8, 0xDDB9, 0x83A9, 0xDDB3, 0x83AA, 0xDDAD, - 0x83AB, 0xC4AA, 0x83AC, 0xC77C, 0x83AD, 0xC77D, 0x83AE, 0xC77E, - 0x83AF, 0xC780, 0x83B0, 0xDDA8, 0x83B1, 0xC0B3, 0x83B2, 0xC1AB, - 0x83B3, 0xDDAA, 0x83B4, 0xDDAB, 0x83B5, 0xC781, 0x83B6, 0xDDB2, - 0x83B7, 0xBBF1, 0x83B8, 0xDDB5, 0x83B9, 0xD3A8, 0x83BA, 0xDDBA, - 0x83BB, 0xC782, 0x83BC, 0xDDBB, 0x83BD, 0xC3A7, 0x83BE, 0xC783, - 0x83BF, 0xC784, 0x83C0, 0xDDD2, 0x83C1, 0xDDBC, 0x83C2, 0xC785, - 0x83C3, 0xC786, 0x83C4, 0xC787, 0x83C5, 0xDDD1, 0x83C6, 0xC788, - 0x83C7, 0xB9BD, 0x83C8, 0xC789, 0x83C9, 0xC78A, 0x83CA, 0xBED5, - 0x83CB, 0xC78B, 0x83CC, 0xBEFA, 0x83CD, 0xC78C, 0x83CE, 0xC78D, - 0x83CF, 0xBACA, 0x83D0, 0xC78E, 0x83D1, 0xC78F, 0x83D2, 0xC790, - 0x83D3, 0xC791, 0x83D4, 0xDDCA, 0x83D5, 0xC792, 0x83D6, 0xDDC5, - 0x83D7, 0xC793, 0x83D8, 0xDDBF, 0x83D9, 0xC794, 0x83DA, 0xC795, - 0x83DB, 0xC796, 0x83DC, 0xB2CB, 0x83DD, 0xDDC3, 0x83DE, 0xC797, - 0x83DF, 0xDDCB, 0x83E0, 0xB2A4, 0x83E1, 0xDDD5, 0x83E2, 0xC798, - 0x83E3, 0xC799, 0x83E4, 0xC79A, 0x83E5, 0xDDBE, 0x83E6, 0xC79B, - 0x83E7, 0xC79C, 0x83E8, 0xC79D, 0x83E9, 0xC6D0, 0x83EA, 0xDDD0, - 0x83EB, 0xC79E, 0x83EC, 0xC79F, 0x83ED, 0xC7A0, 0x83EE, 0xC840, - 0x83EF, 0xC841, 0x83F0, 0xDDD4, 0x83F1, 0xC1E2, 0x83F2, 0xB7C6, - 0x83F3, 0xC842, 0x83F4, 0xC843, 0x83F5, 0xC844, 0x83F6, 0xC845, - 0x83F7, 0xC846, 0x83F8, 0xDDCE, 0x83F9, 0xDDCF, 0x83FA, 0xC847, - 0x83FB, 0xC848, 0x83FC, 0xC849, 0x83FD, 0xDDC4, 0x83FE, 0xC84A, - 0x83FF, 0xC84B, 0x8400, 0xC84C, 0x8401, 0xDDBD, 0x8402, 0xC84D, - 0x8403, 0xDDCD, 0x8404, 0xCCD1, 0x8405, 0xC84E, 0x8406, 0xDDC9, - 0x8407, 0xC84F, 0x8408, 0xC850, 0x8409, 0xC851, 0x840A, 0xC852, - 0x840B, 0xDDC2, 0x840C, 0xC3C8, 0x840D, 0xC6BC, 0x840E, 0xCEAE, - 0x840F, 0xDDCC, 0x8410, 0xC853, 0x8411, 0xDDC8, 0x8412, 0xC854, - 0x8413, 0xC855, 0x8414, 0xC856, 0x8415, 0xC857, 0x8416, 0xC858, - 0x8417, 0xC859, 0x8418, 0xDDC1, 0x8419, 0xC85A, 0x841A, 0xC85B, - 0x841B, 0xC85C, 0x841C, 0xDDC6, 0x841D, 0xC2DC, 0x841E, 0xC85D, - 0x841F, 0xC85E, 0x8420, 0xC85F, 0x8421, 0xC860, 0x8422, 0xC861, - 0x8423, 0xC862, 0x8424, 0xD3A9, 0x8425, 0xD3AA, 0x8426, 0xDDD3, - 0x8427, 0xCFF4, 0x8428, 0xC8F8, 0x8429, 0xC863, 0x842A, 0xC864, - 0x842B, 0xC865, 0x842C, 0xC866, 0x842D, 0xC867, 0x842E, 0xC868, - 0x842F, 0xC869, 0x8430, 0xC86A, 0x8431, 0xDDE6, 0x8432, 0xC86B, - 0x8433, 0xC86C, 0x8434, 0xC86D, 0x8435, 0xC86E, 0x8436, 0xC86F, - 0x8437, 0xC870, 0x8438, 0xDDC7, 0x8439, 0xC871, 0x843A, 0xC872, - 0x843B, 0xC873, 0x843C, 0xDDE0, 0x843D, 0xC2E4, 0x843E, 0xC874, - 0x843F, 0xC875, 0x8440, 0xC876, 0x8441, 0xC877, 0x8442, 0xC878, - 0x8443, 0xC879, 0x8444, 0xC87A, 0x8445, 0xC87B, 0x8446, 0xDDE1, - 0x8447, 0xC87C, 0x8448, 0xC87D, 0x8449, 0xC87E, 0x844A, 0xC880, - 0x844B, 0xC881, 0x844C, 0xC882, 0x844D, 0xC883, 0x844E, 0xC884, - 0x844F, 0xC885, 0x8450, 0xC886, 0x8451, 0xDDD7, 0x8452, 0xC887, - 0x8453, 0xC888, 0x8454, 0xC889, 0x8455, 0xC88A, 0x8456, 0xC88B, - 0x8457, 0xD6F8, 0x8458, 0xC88C, 0x8459, 0xDDD9, 0x845A, 0xDDD8, - 0x845B, 0xB8F0, 0x845C, 0xDDD6, 0x845D, 0xC88D, 0x845E, 0xC88E, - 0x845F, 0xC88F, 0x8460, 0xC890, 0x8461, 0xC6CF, 0x8462, 0xC891, - 0x8463, 0xB6AD, 0x8464, 0xC892, 0x8465, 0xC893, 0x8466, 0xC894, - 0x8467, 0xC895, 0x8468, 0xC896, 0x8469, 0xDDE2, 0x846A, 0xC897, - 0x846B, 0xBAF9, 0x846C, 0xD4E1, 0x846D, 0xDDE7, 0x846E, 0xC898, - 0x846F, 0xC899, 0x8470, 0xC89A, 0x8471, 0xB4D0, 0x8472, 0xC89B, - 0x8473, 0xDDDA, 0x8474, 0xC89C, 0x8475, 0xBFFB, 0x8476, 0xDDE3, - 0x8477, 0xC89D, 0x8478, 0xDDDF, 0x8479, 0xC89E, 0x847A, 0xDDDD, - 0x847B, 0xC89F, 0x847C, 0xC8A0, 0x847D, 0xC940, 0x847E, 0xC941, - 0x847F, 0xC942, 0x8480, 0xC943, 0x8481, 0xC944, 0x8482, 0xB5D9, - 0x8483, 0xC945, 0x8484, 0xC946, 0x8485, 0xC947, 0x8486, 0xC948, - 0x8487, 0xDDDB, 0x8488, 0xDDDC, 0x8489, 0xDDDE, 0x848A, 0xC949, - 0x848B, 0xBDAF, 0x848C, 0xDDE4, 0x848D, 0xC94A, 0x848E, 0xDDE5, - 0x848F, 0xC94B, 0x8490, 0xC94C, 0x8491, 0xC94D, 0x8492, 0xC94E, - 0x8493, 0xC94F, 0x8494, 0xC950, 0x8495, 0xC951, 0x8496, 0xC952, - 0x8497, 0xDDF5, 0x8498, 0xC953, 0x8499, 0xC3C9, 0x849A, 0xC954, - 0x849B, 0xC955, 0x849C, 0xCBE2, 0x849D, 0xC956, 0x849E, 0xC957, - 0x849F, 0xC958, 0x84A0, 0xC959, 0x84A1, 0xDDF2, 0x84A2, 0xC95A, - 0x84A3, 0xC95B, 0x84A4, 0xC95C, 0x84A5, 0xC95D, 0x84A6, 0xC95E, - 0x84A7, 0xC95F, 0x84A8, 0xC960, 0x84A9, 0xC961, 0x84AA, 0xC962, - 0x84AB, 0xC963, 0x84AC, 0xC964, 0x84AD, 0xC965, 0x84AE, 0xC966, - 0x84AF, 0xD8E1, 0x84B0, 0xC967, 0x84B1, 0xC968, 0x84B2, 0xC6D1, - 0x84B3, 0xC969, 0x84B4, 0xDDF4, 0x84B5, 0xC96A, 0x84B6, 0xC96B, - 0x84B7, 0xC96C, 0x84B8, 0xD5F4, 0x84B9, 0xDDF3, 0x84BA, 0xDDF0, - 0x84BB, 0xC96D, 0x84BC, 0xC96E, 0x84BD, 0xDDEC, 0x84BE, 0xC96F, - 0x84BF, 0xDDEF, 0x84C0, 0xC970, 0x84C1, 0xDDE8, 0x84C2, 0xC971, - 0x84C3, 0xC972, 0x84C4, 0xD0EE, 0x84C5, 0xC973, 0x84C6, 0xC974, - 0x84C7, 0xC975, 0x84C8, 0xC976, 0x84C9, 0xC8D8, 0x84CA, 0xDDEE, - 0x84CB, 0xC977, 0x84CC, 0xC978, 0x84CD, 0xDDE9, 0x84CE, 0xC979, - 0x84CF, 0xC97A, 0x84D0, 0xDDEA, 0x84D1, 0xCBF2, 0x84D2, 0xC97B, - 0x84D3, 0xDDED, 0x84D4, 0xC97C, 0x84D5, 0xC97D, 0x84D6, 0xB1CD, - 0x84D7, 0xC97E, 0x84D8, 0xC980, 0x84D9, 0xC981, 0x84DA, 0xC982, - 0x84DB, 0xC983, 0x84DC, 0xC984, 0x84DD, 0xC0B6, 0x84DE, 0xC985, - 0x84DF, 0xBCBB, 0x84E0, 0xDDF1, 0x84E1, 0xC986, 0x84E2, 0xC987, - 0x84E3, 0xDDF7, 0x84E4, 0xC988, 0x84E5, 0xDDF6, 0x84E6, 0xDDEB, - 0x84E7, 0xC989, 0x84E8, 0xC98A, 0x84E9, 0xC98B, 0x84EA, 0xC98C, - 0x84EB, 0xC98D, 0x84EC, 0xC5EE, 0x84ED, 0xC98E, 0x84EE, 0xC98F, - 0x84EF, 0xC990, 0x84F0, 0xDDFB, 0x84F1, 0xC991, 0x84F2, 0xC992, - 0x84F3, 0xC993, 0x84F4, 0xC994, 0x84F5, 0xC995, 0x84F6, 0xC996, - 0x84F7, 0xC997, 0x84F8, 0xC998, 0x84F9, 0xC999, 0x84FA, 0xC99A, - 0x84FB, 0xC99B, 0x84FC, 0xDEA4, 0x84FD, 0xC99C, 0x84FE, 0xC99D, - 0x84FF, 0xDEA3, 0x8500, 0xC99E, 0x8501, 0xC99F, 0x8502, 0xC9A0, - 0x8503, 0xCA40, 0x8504, 0xCA41, 0x8505, 0xCA42, 0x8506, 0xCA43, - 0x8507, 0xCA44, 0x8508, 0xCA45, 0x8509, 0xCA46, 0x850A, 0xCA47, - 0x850B, 0xCA48, 0x850C, 0xDDF8, 0x850D, 0xCA49, 0x850E, 0xCA4A, - 0x850F, 0xCA4B, 0x8510, 0xCA4C, 0x8511, 0xC3EF, 0x8512, 0xCA4D, - 0x8513, 0xC2FB, 0x8514, 0xCA4E, 0x8515, 0xCA4F, 0x8516, 0xCA50, - 0x8517, 0xD5E1, 0x8518, 0xCA51, 0x8519, 0xCA52, 0x851A, 0xCEB5, - 0x851B, 0xCA53, 0x851C, 0xCA54, 0x851D, 0xCA55, 0x851E, 0xCA56, - 0x851F, 0xDDFD, 0x8520, 0xCA57, 0x8521, 0xB2CC, 0x8522, 0xCA58, - 0x8523, 0xCA59, 0x8524, 0xCA5A, 0x8525, 0xCA5B, 0x8526, 0xCA5C, - 0x8527, 0xCA5D, 0x8528, 0xCA5E, 0x8529, 0xCA5F, 0x852A, 0xCA60, - 0x852B, 0xC4E8, 0x852C, 0xCADF, 0x852D, 0xCA61, 0x852E, 0xCA62, - 0x852F, 0xCA63, 0x8530, 0xCA64, 0x8531, 0xCA65, 0x8532, 0xCA66, - 0x8533, 0xCA67, 0x8534, 0xCA68, 0x8535, 0xCA69, 0x8536, 0xCA6A, - 0x8537, 0xC7BE, 0x8538, 0xDDFA, 0x8539, 0xDDFC, 0x853A, 0xDDFE, - 0x853B, 0xDEA2, 0x853C, 0xB0AA, 0x853D, 0xB1CE, 0x853E, 0xCA6B, - 0x853F, 0xCA6C, 0x8540, 0xCA6D, 0x8541, 0xCA6E, 0x8542, 0xCA6F, - 0x8543, 0xDEAC, 0x8544, 0xCA70, 0x8545, 0xCA71, 0x8546, 0xCA72, - 0x8547, 0xCA73, 0x8548, 0xDEA6, 0x8549, 0xBDB6, 0x854A, 0xC8EF, - 0x854B, 0xCA74, 0x854C, 0xCA75, 0x854D, 0xCA76, 0x854E, 0xCA77, - 0x854F, 0xCA78, 0x8550, 0xCA79, 0x8551, 0xCA7A, 0x8552, 0xCA7B, - 0x8553, 0xCA7C, 0x8554, 0xCA7D, 0x8555, 0xCA7E, 0x8556, 0xDEA1, - 0x8557, 0xCA80, 0x8558, 0xCA81, 0x8559, 0xDEA5, 0x855A, 0xCA82, - 0x855B, 0xCA83, 0x855C, 0xCA84, 0x855D, 0xCA85, 0x855E, 0xDEA9, - 0x855F, 0xCA86, 0x8560, 0xCA87, 0x8561, 0xCA88, 0x8562, 0xCA89, - 0x8563, 0xCA8A, 0x8564, 0xDEA8, 0x8565, 0xCA8B, 0x8566, 0xCA8C, - 0x8567, 0xCA8D, 0x8568, 0xDEA7, 0x8569, 0xCA8E, 0x856A, 0xCA8F, - 0x856B, 0xCA90, 0x856C, 0xCA91, 0x856D, 0xCA92, 0x856E, 0xCA93, - 0x856F, 0xCA94, 0x8570, 0xCA95, 0x8571, 0xCA96, 0x8572, 0xDEAD, - 0x8573, 0xCA97, 0x8574, 0xD4CC, 0x8575, 0xCA98, 0x8576, 0xCA99, - 0x8577, 0xCA9A, 0x8578, 0xCA9B, 0x8579, 0xDEB3, 0x857A, 0xDEAA, - 0x857B, 0xDEAE, 0x857C, 0xCA9C, 0x857D, 0xCA9D, 0x857E, 0xC0D9, - 0x857F, 0xCA9E, 0x8580, 0xCA9F, 0x8581, 0xCAA0, 0x8582, 0xCB40, - 0x8583, 0xCB41, 0x8584, 0xB1A1, 0x8585, 0xDEB6, 0x8586, 0xCB42, - 0x8587, 0xDEB1, 0x8588, 0xCB43, 0x8589, 0xCB44, 0x858A, 0xCB45, - 0x858B, 0xCB46, 0x858C, 0xCB47, 0x858D, 0xCB48, 0x858E, 0xCB49, - 0x858F, 0xDEB2, 0x8590, 0xCB4A, 0x8591, 0xCB4B, 0x8592, 0xCB4C, - 0x8593, 0xCB4D, 0x8594, 0xCB4E, 0x8595, 0xCB4F, 0x8596, 0xCB50, - 0x8597, 0xCB51, 0x8598, 0xCB52, 0x8599, 0xCB53, 0x859A, 0xCB54, - 0x859B, 0xD1A6, 0x859C, 0xDEB5, 0x859D, 0xCB55, 0x859E, 0xCB56, - 0x859F, 0xCB57, 0x85A0, 0xCB58, 0x85A1, 0xCB59, 0x85A2, 0xCB5A, - 0x85A3, 0xCB5B, 0x85A4, 0xDEAF, 0x85A5, 0xCB5C, 0x85A6, 0xCB5D, - 0x85A7, 0xCB5E, 0x85A8, 0xDEB0, 0x85A9, 0xCB5F, 0x85AA, 0xD0BD, - 0x85AB, 0xCB60, 0x85AC, 0xCB61, 0x85AD, 0xCB62, 0x85AE, 0xDEB4, - 0x85AF, 0xCAED, 0x85B0, 0xDEB9, 0x85B1, 0xCB63, 0x85B2, 0xCB64, - 0x85B3, 0xCB65, 0x85B4, 0xCB66, 0x85B5, 0xCB67, 0x85B6, 0xCB68, - 0x85B7, 0xDEB8, 0x85B8, 0xCB69, 0x85B9, 0xDEB7, 0x85BA, 0xCB6A, - 0x85BB, 0xCB6B, 0x85BC, 0xCB6C, 0x85BD, 0xCB6D, 0x85BE, 0xCB6E, - 0x85BF, 0xCB6F, 0x85C0, 0xCB70, 0x85C1, 0xDEBB, 0x85C2, 0xCB71, - 0x85C3, 0xCB72, 0x85C4, 0xCB73, 0x85C5, 0xCB74, 0x85C6, 0xCB75, - 0x85C7, 0xCB76, 0x85C8, 0xCB77, 0x85C9, 0xBDE5, 0x85CA, 0xCB78, - 0x85CB, 0xCB79, 0x85CC, 0xCB7A, 0x85CD, 0xCB7B, 0x85CE, 0xCB7C, - 0x85CF, 0xB2D8, 0x85D0, 0xC3EA, 0x85D1, 0xCB7D, 0x85D2, 0xCB7E, - 0x85D3, 0xDEBA, 0x85D4, 0xCB80, 0x85D5, 0xC5BA, 0x85D6, 0xCB81, - 0x85D7, 0xCB82, 0x85D8, 0xCB83, 0x85D9, 0xCB84, 0x85DA, 0xCB85, - 0x85DB, 0xCB86, 0x85DC, 0xDEBC, 0x85DD, 0xCB87, 0x85DE, 0xCB88, - 0x85DF, 0xCB89, 0x85E0, 0xCB8A, 0x85E1, 0xCB8B, 0x85E2, 0xCB8C, - 0x85E3, 0xCB8D, 0x85E4, 0xCCD9, 0x85E5, 0xCB8E, 0x85E6, 0xCB8F, - 0x85E7, 0xCB90, 0x85E8, 0xCB91, 0x85E9, 0xB7AA, 0x85EA, 0xCB92, - 0x85EB, 0xCB93, 0x85EC, 0xCB94, 0x85ED, 0xCB95, 0x85EE, 0xCB96, - 0x85EF, 0xCB97, 0x85F0, 0xCB98, 0x85F1, 0xCB99, 0x85F2, 0xCB9A, - 0x85F3, 0xCB9B, 0x85F4, 0xCB9C, 0x85F5, 0xCB9D, 0x85F6, 0xCB9E, - 0x85F7, 0xCB9F, 0x85F8, 0xCBA0, 0x85F9, 0xCC40, 0x85FA, 0xCC41, - 0x85FB, 0xD4E5, 0x85FC, 0xCC42, 0x85FD, 0xCC43, 0x85FE, 0xCC44, - 0x85FF, 0xDEBD, 0x8600, 0xCC45, 0x8601, 0xCC46, 0x8602, 0xCC47, - 0x8603, 0xCC48, 0x8604, 0xCC49, 0x8605, 0xDEBF, 0x8606, 0xCC4A, - 0x8607, 0xCC4B, 0x8608, 0xCC4C, 0x8609, 0xCC4D, 0x860A, 0xCC4E, - 0x860B, 0xCC4F, 0x860C, 0xCC50, 0x860D, 0xCC51, 0x860E, 0xCC52, - 0x860F, 0xCC53, 0x8610, 0xCC54, 0x8611, 0xC4A2, 0x8612, 0xCC55, - 0x8613, 0xCC56, 0x8614, 0xCC57, 0x8615, 0xCC58, 0x8616, 0xDEC1, - 0x8617, 0xCC59, 0x8618, 0xCC5A, 0x8619, 0xCC5B, 0x861A, 0xCC5C, - 0x861B, 0xCC5D, 0x861C, 0xCC5E, 0x861D, 0xCC5F, 0x861E, 0xCC60, - 0x861F, 0xCC61, 0x8620, 0xCC62, 0x8621, 0xCC63, 0x8622, 0xCC64, - 0x8623, 0xCC65, 0x8624, 0xCC66, 0x8625, 0xCC67, 0x8626, 0xCC68, - 0x8627, 0xDEBE, 0x8628, 0xCC69, 0x8629, 0xDEC0, 0x862A, 0xCC6A, - 0x862B, 0xCC6B, 0x862C, 0xCC6C, 0x862D, 0xCC6D, 0x862E, 0xCC6E, - 0x862F, 0xCC6F, 0x8630, 0xCC70, 0x8631, 0xCC71, 0x8632, 0xCC72, - 0x8633, 0xCC73, 0x8634, 0xCC74, 0x8635, 0xCC75, 0x8636, 0xCC76, - 0x8637, 0xCC77, 0x8638, 0xD5BA, 0x8639, 0xCC78, 0x863A, 0xCC79, - 0x863B, 0xCC7A, 0x863C, 0xDEC2, 0x863D, 0xCC7B, 0x863E, 0xCC7C, - 0x863F, 0xCC7D, 0x8640, 0xCC7E, 0x8641, 0xCC80, 0x8642, 0xCC81, - 0x8643, 0xCC82, 0x8644, 0xCC83, 0x8645, 0xCC84, 0x8646, 0xCC85, - 0x8647, 0xCC86, 0x8648, 0xCC87, 0x8649, 0xCC88, 0x864A, 0xCC89, - 0x864B, 0xCC8A, 0x864C, 0xCC8B, 0x864D, 0xF2AE, 0x864E, 0xBBA2, - 0x864F, 0xC2B2, 0x8650, 0xC5B0, 0x8651, 0xC2C7, 0x8652, 0xCC8C, - 0x8653, 0xCC8D, 0x8654, 0xF2AF, 0x8655, 0xCC8E, 0x8656, 0xCC8F, - 0x8657, 0xCC90, 0x8658, 0xCC91, 0x8659, 0xCC92, 0x865A, 0xD0E9, - 0x865B, 0xCC93, 0x865C, 0xCC94, 0x865D, 0xCC95, 0x865E, 0xD3DD, - 0x865F, 0xCC96, 0x8660, 0xCC97, 0x8661, 0xCC98, 0x8662, 0xEBBD, - 0x8663, 0xCC99, 0x8664, 0xCC9A, 0x8665, 0xCC9B, 0x8666, 0xCC9C, - 0x8667, 0xCC9D, 0x8668, 0xCC9E, 0x8669, 0xCC9F, 0x866A, 0xCCA0, - 0x866B, 0xB3E6, 0x866C, 0xF2B0, 0x866D, 0xCD40, 0x866E, 0xF2B1, - 0x866F, 0xCD41, 0x8670, 0xCD42, 0x8671, 0xCAAD, 0x8672, 0xCD43, - 0x8673, 0xCD44, 0x8674, 0xCD45, 0x8675, 0xCD46, 0x8676, 0xCD47, - 0x8677, 0xCD48, 0x8678, 0xCD49, 0x8679, 0xBAE7, 0x867A, 0xF2B3, - 0x867B, 0xF2B5, 0x867C, 0xF2B4, 0x867D, 0xCBE4, 0x867E, 0xCFBA, - 0x867F, 0xF2B2, 0x8680, 0xCAB4, 0x8681, 0xD2CF, 0x8682, 0xC2EC, - 0x8683, 0xCD4A, 0x8684, 0xCD4B, 0x8685, 0xCD4C, 0x8686, 0xCD4D, - 0x8687, 0xCD4E, 0x8688, 0xCD4F, 0x8689, 0xCD50, 0x868A, 0xCEC3, - 0x868B, 0xF2B8, 0x868C, 0xB0F6, 0x868D, 0xF2B7, 0x868E, 0xCD51, - 0x868F, 0xCD52, 0x8690, 0xCD53, 0x8691, 0xCD54, 0x8692, 0xCD55, - 0x8693, 0xF2BE, 0x8694, 0xCD56, 0x8695, 0xB2CF, 0x8696, 0xCD57, - 0x8697, 0xCD58, 0x8698, 0xCD59, 0x8699, 0xCD5A, 0x869A, 0xCD5B, - 0x869B, 0xCD5C, 0x869C, 0xD1C1, 0x869D, 0xF2BA, 0x869E, 0xCD5D, - 0x869F, 0xCD5E, 0x86A0, 0xCD5F, 0x86A1, 0xCD60, 0x86A2, 0xCD61, - 0x86A3, 0xF2BC, 0x86A4, 0xD4E9, 0x86A5, 0xCD62, 0x86A6, 0xCD63, - 0x86A7, 0xF2BB, 0x86A8, 0xF2B6, 0x86A9, 0xF2BF, 0x86AA, 0xF2BD, - 0x86AB, 0xCD64, 0x86AC, 0xF2B9, 0x86AD, 0xCD65, 0x86AE, 0xCD66, - 0x86AF, 0xF2C7, 0x86B0, 0xF2C4, 0x86B1, 0xF2C6, 0x86B2, 0xCD67, - 0x86B3, 0xCD68, 0x86B4, 0xF2CA, 0x86B5, 0xF2C2, 0x86B6, 0xF2C0, - 0x86B7, 0xCD69, 0x86B8, 0xCD6A, 0x86B9, 0xCD6B, 0x86BA, 0xF2C5, - 0x86BB, 0xCD6C, 0x86BC, 0xCD6D, 0x86BD, 0xCD6E, 0x86BE, 0xCD6F, - 0x86BF, 0xCD70, 0x86C0, 0xD6FB, 0x86C1, 0xCD71, 0x86C2, 0xCD72, - 0x86C3, 0xCD73, 0x86C4, 0xF2C1, 0x86C5, 0xCD74, 0x86C6, 0xC7F9, - 0x86C7, 0xC9DF, 0x86C8, 0xCD75, 0x86C9, 0xF2C8, 0x86CA, 0xB9C6, - 0x86CB, 0xB5B0, 0x86CC, 0xCD76, 0x86CD, 0xCD77, 0x86CE, 0xF2C3, - 0x86CF, 0xF2C9, 0x86D0, 0xF2D0, 0x86D1, 0xF2D6, 0x86D2, 0xCD78, - 0x86D3, 0xCD79, 0x86D4, 0xBBD7, 0x86D5, 0xCD7A, 0x86D6, 0xCD7B, - 0x86D7, 0xCD7C, 0x86D8, 0xF2D5, 0x86D9, 0xCDDC, 0x86DA, 0xCD7D, - 0x86DB, 0xD6EB, 0x86DC, 0xCD7E, 0x86DD, 0xCD80, 0x86DE, 0xF2D2, - 0x86DF, 0xF2D4, 0x86E0, 0xCD81, 0x86E1, 0xCD82, 0x86E2, 0xCD83, - 0x86E3, 0xCD84, 0x86E4, 0xB8F2, 0x86E5, 0xCD85, 0x86E6, 0xCD86, - 0x86E7, 0xCD87, 0x86E8, 0xCD88, 0x86E9, 0xF2CB, 0x86EA, 0xCD89, - 0x86EB, 0xCD8A, 0x86EC, 0xCD8B, 0x86ED, 0xF2CE, 0x86EE, 0xC2F9, - 0x86EF, 0xCD8C, 0x86F0, 0xD5DD, 0x86F1, 0xF2CC, 0x86F2, 0xF2CD, - 0x86F3, 0xF2CF, 0x86F4, 0xF2D3, 0x86F5, 0xCD8D, 0x86F6, 0xCD8E, - 0x86F7, 0xCD8F, 0x86F8, 0xF2D9, 0x86F9, 0xD3BC, 0x86FA, 0xCD90, - 0x86FB, 0xCD91, 0x86FC, 0xCD92, 0x86FD, 0xCD93, 0x86FE, 0xB6EA, - 0x86FF, 0xCD94, 0x8700, 0xCAF1, 0x8701, 0xCD95, 0x8702, 0xB7E4, - 0x8703, 0xF2D7, 0x8704, 0xCD96, 0x8705, 0xCD97, 0x8706, 0xCD98, - 0x8707, 0xF2D8, 0x8708, 0xF2DA, 0x8709, 0xF2DD, 0x870A, 0xF2DB, - 0x870B, 0xCD99, 0x870C, 0xCD9A, 0x870D, 0xF2DC, 0x870E, 0xCD9B, - 0x870F, 0xCD9C, 0x8710, 0xCD9D, 0x8711, 0xCD9E, 0x8712, 0xD1D1, - 0x8713, 0xF2D1, 0x8714, 0xCD9F, 0x8715, 0xCDC9, 0x8716, 0xCDA0, - 0x8717, 0xCECF, 0x8718, 0xD6A9, 0x8719, 0xCE40, 0x871A, 0xF2E3, - 0x871B, 0xCE41, 0x871C, 0xC3DB, 0x871D, 0xCE42, 0x871E, 0xF2E0, - 0x871F, 0xCE43, 0x8720, 0xCE44, 0x8721, 0xC0AF, 0x8722, 0xF2EC, - 0x8723, 0xF2DE, 0x8724, 0xCE45, 0x8725, 0xF2E1, 0x8726, 0xCE46, - 0x8727, 0xCE47, 0x8728, 0xCE48, 0x8729, 0xF2E8, 0x872A, 0xCE49, - 0x872B, 0xCE4A, 0x872C, 0xCE4B, 0x872D, 0xCE4C, 0x872E, 0xF2E2, - 0x872F, 0xCE4D, 0x8730, 0xCE4E, 0x8731, 0xF2E7, 0x8732, 0xCE4F, - 0x8733, 0xCE50, 0x8734, 0xF2E6, 0x8735, 0xCE51, 0x8736, 0xCE52, - 0x8737, 0xF2E9, 0x8738, 0xCE53, 0x8739, 0xCE54, 0x873A, 0xCE55, - 0x873B, 0xF2DF, 0x873C, 0xCE56, 0x873D, 0xCE57, 0x873E, 0xF2E4, - 0x873F, 0xF2EA, 0x8740, 0xCE58, 0x8741, 0xCE59, 0x8742, 0xCE5A, - 0x8743, 0xCE5B, 0x8744, 0xCE5C, 0x8745, 0xCE5D, 0x8746, 0xCE5E, - 0x8747, 0xD3AC, 0x8748, 0xF2E5, 0x8749, 0xB2F5, 0x874A, 0xCE5F, - 0x874B, 0xCE60, 0x874C, 0xF2F2, 0x874D, 0xCE61, 0x874E, 0xD0AB, - 0x874F, 0xCE62, 0x8750, 0xCE63, 0x8751, 0xCE64, 0x8752, 0xCE65, - 0x8753, 0xF2F5, 0x8754, 0xCE66, 0x8755, 0xCE67, 0x8756, 0xCE68, - 0x8757, 0xBBC8, 0x8758, 0xCE69, 0x8759, 0xF2F9, 0x875A, 0xCE6A, - 0x875B, 0xCE6B, 0x875C, 0xCE6C, 0x875D, 0xCE6D, 0x875E, 0xCE6E, - 0x875F, 0xCE6F, 0x8760, 0xF2F0, 0x8761, 0xCE70, 0x8762, 0xCE71, - 0x8763, 0xF2F6, 0x8764, 0xF2F8, 0x8765, 0xF2FA, 0x8766, 0xCE72, - 0x8767, 0xCE73, 0x8768, 0xCE74, 0x8769, 0xCE75, 0x876A, 0xCE76, - 0x876B, 0xCE77, 0x876C, 0xCE78, 0x876D, 0xCE79, 0x876E, 0xF2F3, - 0x876F, 0xCE7A, 0x8770, 0xF2F1, 0x8771, 0xCE7B, 0x8772, 0xCE7C, - 0x8773, 0xCE7D, 0x8774, 0xBAFB, 0x8775, 0xCE7E, 0x8776, 0xB5FB, - 0x8777, 0xCE80, 0x8778, 0xCE81, 0x8779, 0xCE82, 0x877A, 0xCE83, - 0x877B, 0xF2EF, 0x877C, 0xF2F7, 0x877D, 0xF2ED, 0x877E, 0xF2EE, - 0x877F, 0xCE84, 0x8780, 0xCE85, 0x8781, 0xCE86, 0x8782, 0xF2EB, - 0x8783, 0xF3A6, 0x8784, 0xCE87, 0x8785, 0xF3A3, 0x8786, 0xCE88, - 0x8787, 0xCE89, 0x8788, 0xF3A2, 0x8789, 0xCE8A, 0x878A, 0xCE8B, - 0x878B, 0xF2F4, 0x878C, 0xCE8C, 0x878D, 0xC8DA, 0x878E, 0xCE8D, - 0x878F, 0xCE8E, 0x8790, 0xCE8F, 0x8791, 0xCE90, 0x8792, 0xCE91, - 0x8793, 0xF2FB, 0x8794, 0xCE92, 0x8795, 0xCE93, 0x8796, 0xCE94, - 0x8797, 0xF3A5, 0x8798, 0xCE95, 0x8799, 0xCE96, 0x879A, 0xCE97, - 0x879B, 0xCE98, 0x879C, 0xCE99, 0x879D, 0xCE9A, 0x879E, 0xCE9B, - 0x879F, 0xC3F8, 0x87A0, 0xCE9C, 0x87A1, 0xCE9D, 0x87A2, 0xCE9E, - 0x87A3, 0xCE9F, 0x87A4, 0xCEA0, 0x87A5, 0xCF40, 0x87A6, 0xCF41, - 0x87A7, 0xCF42, 0x87A8, 0xF2FD, 0x87A9, 0xCF43, 0x87AA, 0xCF44, - 0x87AB, 0xF3A7, 0x87AC, 0xF3A9, 0x87AD, 0xF3A4, 0x87AE, 0xCF45, - 0x87AF, 0xF2FC, 0x87B0, 0xCF46, 0x87B1, 0xCF47, 0x87B2, 0xCF48, - 0x87B3, 0xF3AB, 0x87B4, 0xCF49, 0x87B5, 0xF3AA, 0x87B6, 0xCF4A, - 0x87B7, 0xCF4B, 0x87B8, 0xCF4C, 0x87B9, 0xCF4D, 0x87BA, 0xC2DD, - 0x87BB, 0xCF4E, 0x87BC, 0xCF4F, 0x87BD, 0xF3AE, 0x87BE, 0xCF50, - 0x87BF, 0xCF51, 0x87C0, 0xF3B0, 0x87C1, 0xCF52, 0x87C2, 0xCF53, - 0x87C3, 0xCF54, 0x87C4, 0xCF55, 0x87C5, 0xCF56, 0x87C6, 0xF3A1, - 0x87C7, 0xCF57, 0x87C8, 0xCF58, 0x87C9, 0xCF59, 0x87CA, 0xF3B1, - 0x87CB, 0xF3AC, 0x87CC, 0xCF5A, 0x87CD, 0xCF5B, 0x87CE, 0xCF5C, - 0x87CF, 0xCF5D, 0x87D0, 0xCF5E, 0x87D1, 0xF3AF, 0x87D2, 0xF2FE, - 0x87D3, 0xF3AD, 0x87D4, 0xCF5F, 0x87D5, 0xCF60, 0x87D6, 0xCF61, - 0x87D7, 0xCF62, 0x87D8, 0xCF63, 0x87D9, 0xCF64, 0x87DA, 0xCF65, - 0x87DB, 0xF3B2, 0x87DC, 0xCF66, 0x87DD, 0xCF67, 0x87DE, 0xCF68, - 0x87DF, 0xCF69, 0x87E0, 0xF3B4, 0x87E1, 0xCF6A, 0x87E2, 0xCF6B, - 0x87E3, 0xCF6C, 0x87E4, 0xCF6D, 0x87E5, 0xF3A8, 0x87E6, 0xCF6E, - 0x87E7, 0xCF6F, 0x87E8, 0xCF70, 0x87E9, 0xCF71, 0x87EA, 0xF3B3, - 0x87EB, 0xCF72, 0x87EC, 0xCF73, 0x87ED, 0xCF74, 0x87EE, 0xF3B5, - 0x87EF, 0xCF75, 0x87F0, 0xCF76, 0x87F1, 0xCF77, 0x87F2, 0xCF78, - 0x87F3, 0xCF79, 0x87F4, 0xCF7A, 0x87F5, 0xCF7B, 0x87F6, 0xCF7C, - 0x87F7, 0xCF7D, 0x87F8, 0xCF7E, 0x87F9, 0xD0B7, 0x87FA, 0xCF80, - 0x87FB, 0xCF81, 0x87FC, 0xCF82, 0x87FD, 0xCF83, 0x87FE, 0xF3B8, - 0x87FF, 0xCF84, 0x8800, 0xCF85, 0x8801, 0xCF86, 0x8802, 0xCF87, - 0x8803, 0xD9F9, 0x8804, 0xCF88, 0x8805, 0xCF89, 0x8806, 0xCF8A, - 0x8807, 0xCF8B, 0x8808, 0xCF8C, 0x8809, 0xCF8D, 0x880A, 0xF3B9, - 0x880B, 0xCF8E, 0x880C, 0xCF8F, 0x880D, 0xCF90, 0x880E, 0xCF91, - 0x880F, 0xCF92, 0x8810, 0xCF93, 0x8811, 0xCF94, 0x8812, 0xCF95, - 0x8813, 0xF3B7, 0x8814, 0xCF96, 0x8815, 0xC8E4, 0x8816, 0xF3B6, - 0x8817, 0xCF97, 0x8818, 0xCF98, 0x8819, 0xCF99, 0x881A, 0xCF9A, - 0x881B, 0xF3BA, 0x881C, 0xCF9B, 0x881D, 0xCF9C, 0x881E, 0xCF9D, - 0x881F, 0xCF9E, 0x8820, 0xCF9F, 0x8821, 0xF3BB, 0x8822, 0xB4C0, - 0x8823, 0xCFA0, 0x8824, 0xD040, 0x8825, 0xD041, 0x8826, 0xD042, - 0x8827, 0xD043, 0x8828, 0xD044, 0x8829, 0xD045, 0x882A, 0xD046, - 0x882B, 0xD047, 0x882C, 0xD048, 0x882D, 0xD049, 0x882E, 0xD04A, - 0x882F, 0xD04B, 0x8830, 0xD04C, 0x8831, 0xD04D, 0x8832, 0xEEC3, - 0x8833, 0xD04E, 0x8834, 0xD04F, 0x8835, 0xD050, 0x8836, 0xD051, - 0x8837, 0xD052, 0x8838, 0xD053, 0x8839, 0xF3BC, 0x883A, 0xD054, - 0x883B, 0xD055, 0x883C, 0xF3BD, 0x883D, 0xD056, 0x883E, 0xD057, - 0x883F, 0xD058, 0x8840, 0xD1AA, 0x8841, 0xD059, 0x8842, 0xD05A, - 0x8843, 0xD05B, 0x8844, 0xF4AC, 0x8845, 0xD0C6, 0x8846, 0xD05C, - 0x8847, 0xD05D, 0x8848, 0xD05E, 0x8849, 0xD05F, 0x884A, 0xD060, - 0x884B, 0xD061, 0x884C, 0xD0D0, 0x884D, 0xD1DC, 0x884E, 0xD062, - 0x884F, 0xD063, 0x8850, 0xD064, 0x8851, 0xD065, 0x8852, 0xD066, - 0x8853, 0xD067, 0x8854, 0xCFCE, 0x8855, 0xD068, 0x8856, 0xD069, - 0x8857, 0xBDD6, 0x8858, 0xD06A, 0x8859, 0xD1C3, 0x885A, 0xD06B, - 0x885B, 0xD06C, 0x885C, 0xD06D, 0x885D, 0xD06E, 0x885E, 0xD06F, - 0x885F, 0xD070, 0x8860, 0xD071, 0x8861, 0xBAE2, 0x8862, 0xE1E9, - 0x8863, 0xD2C2, 0x8864, 0xF1C2, 0x8865, 0xB2B9, 0x8866, 0xD072, - 0x8867, 0xD073, 0x8868, 0xB1ED, 0x8869, 0xF1C3, 0x886A, 0xD074, - 0x886B, 0xC9C0, 0x886C, 0xB3C4, 0x886D, 0xD075, 0x886E, 0xD9F2, - 0x886F, 0xD076, 0x8870, 0xCBA5, 0x8871, 0xD077, 0x8872, 0xF1C4, - 0x8873, 0xD078, 0x8874, 0xD079, 0x8875, 0xD07A, 0x8876, 0xD07B, - 0x8877, 0xD6D4, 0x8878, 0xD07C, 0x8879, 0xD07D, 0x887A, 0xD07E, - 0x887B, 0xD080, 0x887C, 0xD081, 0x887D, 0xF1C5, 0x887E, 0xF4C0, - 0x887F, 0xF1C6, 0x8880, 0xD082, 0x8881, 0xD4AC, 0x8882, 0xF1C7, - 0x8883, 0xD083, 0x8884, 0xB0C0, 0x8885, 0xF4C1, 0x8886, 0xD084, - 0x8887, 0xD085, 0x8888, 0xF4C2, 0x8889, 0xD086, 0x888A, 0xD087, - 0x888B, 0xB4FC, 0x888C, 0xD088, 0x888D, 0xC5DB, 0x888E, 0xD089, - 0x888F, 0xD08A, 0x8890, 0xD08B, 0x8891, 0xD08C, 0x8892, 0xCCBB, - 0x8893, 0xD08D, 0x8894, 0xD08E, 0x8895, 0xD08F, 0x8896, 0xD0E4, - 0x8897, 0xD090, 0x8898, 0xD091, 0x8899, 0xD092, 0x889A, 0xD093, - 0x889B, 0xD094, 0x889C, 0xCDE0, 0x889D, 0xD095, 0x889E, 0xD096, - 0x889F, 0xD097, 0x88A0, 0xD098, 0x88A1, 0xD099, 0x88A2, 0xF1C8, - 0x88A3, 0xD09A, 0x88A4, 0xD9F3, 0x88A5, 0xD09B, 0x88A6, 0xD09C, - 0x88A7, 0xD09D, 0x88A8, 0xD09E, 0x88A9, 0xD09F, 0x88AA, 0xD0A0, - 0x88AB, 0xB1BB, 0x88AC, 0xD140, 0x88AD, 0xCFAE, 0x88AE, 0xD141, - 0x88AF, 0xD142, 0x88B0, 0xD143, 0x88B1, 0xB8A4, 0x88B2, 0xD144, - 0x88B3, 0xD145, 0x88B4, 0xD146, 0x88B5, 0xD147, 0x88B6, 0xD148, - 0x88B7, 0xF1CA, 0x88B8, 0xD149, 0x88B9, 0xD14A, 0x88BA, 0xD14B, - 0x88BB, 0xD14C, 0x88BC, 0xF1CB, 0x88BD, 0xD14D, 0x88BE, 0xD14E, - 0x88BF, 0xD14F, 0x88C0, 0xD150, 0x88C1, 0xB2C3, 0x88C2, 0xC1D1, - 0x88C3, 0xD151, 0x88C4, 0xD152, 0x88C5, 0xD7B0, 0x88C6, 0xF1C9, - 0x88C7, 0xD153, 0x88C8, 0xD154, 0x88C9, 0xF1CC, 0x88CA, 0xD155, - 0x88CB, 0xD156, 0x88CC, 0xD157, 0x88CD, 0xD158, 0x88CE, 0xF1CE, - 0x88CF, 0xD159, 0x88D0, 0xD15A, 0x88D1, 0xD15B, 0x88D2, 0xD9F6, - 0x88D3, 0xD15C, 0x88D4, 0xD2E1, 0x88D5, 0xD4A3, 0x88D6, 0xD15D, - 0x88D7, 0xD15E, 0x88D8, 0xF4C3, 0x88D9, 0xC8B9, 0x88DA, 0xD15F, - 0x88DB, 0xD160, 0x88DC, 0xD161, 0x88DD, 0xD162, 0x88DE, 0xD163, - 0x88DF, 0xF4C4, 0x88E0, 0xD164, 0x88E1, 0xD165, 0x88E2, 0xF1CD, - 0x88E3, 0xF1CF, 0x88E4, 0xBFE3, 0x88E5, 0xF1D0, 0x88E6, 0xD166, - 0x88E7, 0xD167, 0x88E8, 0xF1D4, 0x88E9, 0xD168, 0x88EA, 0xD169, - 0x88EB, 0xD16A, 0x88EC, 0xD16B, 0x88ED, 0xD16C, 0x88EE, 0xD16D, - 0x88EF, 0xD16E, 0x88F0, 0xF1D6, 0x88F1, 0xF1D1, 0x88F2, 0xD16F, - 0x88F3, 0xC9D1, 0x88F4, 0xC5E1, 0x88F5, 0xD170, 0x88F6, 0xD171, - 0x88F7, 0xD172, 0x88F8, 0xC2E3, 0x88F9, 0xB9FC, 0x88FA, 0xD173, - 0x88FB, 0xD174, 0x88FC, 0xF1D3, 0x88FD, 0xD175, 0x88FE, 0xF1D5, - 0x88FF, 0xD176, 0x8900, 0xD177, 0x8901, 0xD178, 0x8902, 0xB9D3, - 0x8903, 0xD179, 0x8904, 0xD17A, 0x8905, 0xD17B, 0x8906, 0xD17C, - 0x8907, 0xD17D, 0x8908, 0xD17E, 0x8909, 0xD180, 0x890A, 0xF1DB, - 0x890B, 0xD181, 0x890C, 0xD182, 0x890D, 0xD183, 0x890E, 0xD184, - 0x890F, 0xD185, 0x8910, 0xBAD6, 0x8911, 0xD186, 0x8912, 0xB0FD, - 0x8913, 0xF1D9, 0x8914, 0xD187, 0x8915, 0xD188, 0x8916, 0xD189, - 0x8917, 0xD18A, 0x8918, 0xD18B, 0x8919, 0xF1D8, 0x891A, 0xF1D2, - 0x891B, 0xF1DA, 0x891C, 0xD18C, 0x891D, 0xD18D, 0x891E, 0xD18E, - 0x891F, 0xD18F, 0x8920, 0xD190, 0x8921, 0xF1D7, 0x8922, 0xD191, - 0x8923, 0xD192, 0x8924, 0xD193, 0x8925, 0xC8EC, 0x8926, 0xD194, - 0x8927, 0xD195, 0x8928, 0xD196, 0x8929, 0xD197, 0x892A, 0xCDCA, - 0x892B, 0xF1DD, 0x892C, 0xD198, 0x892D, 0xD199, 0x892E, 0xD19A, - 0x892F, 0xD19B, 0x8930, 0xE5BD, 0x8931, 0xD19C, 0x8932, 0xD19D, - 0x8933, 0xD19E, 0x8934, 0xF1DC, 0x8935, 0xD19F, 0x8936, 0xF1DE, - 0x8937, 0xD1A0, 0x8938, 0xD240, 0x8939, 0xD241, 0x893A, 0xD242, - 0x893B, 0xD243, 0x893C, 0xD244, 0x893D, 0xD245, 0x893E, 0xD246, - 0x893F, 0xD247, 0x8940, 0xD248, 0x8941, 0xF1DF, 0x8942, 0xD249, - 0x8943, 0xD24A, 0x8944, 0xCFE5, 0x8945, 0xD24B, 0x8946, 0xD24C, - 0x8947, 0xD24D, 0x8948, 0xD24E, 0x8949, 0xD24F, 0x894A, 0xD250, - 0x894B, 0xD251, 0x894C, 0xD252, 0x894D, 0xD253, 0x894E, 0xD254, - 0x894F, 0xD255, 0x8950, 0xD256, 0x8951, 0xD257, 0x8952, 0xD258, - 0x8953, 0xD259, 0x8954, 0xD25A, 0x8955, 0xD25B, 0x8956, 0xD25C, - 0x8957, 0xD25D, 0x8958, 0xD25E, 0x8959, 0xD25F, 0x895A, 0xD260, - 0x895B, 0xD261, 0x895C, 0xD262, 0x895D, 0xD263, 0x895E, 0xF4C5, - 0x895F, 0xBDF3, 0x8960, 0xD264, 0x8961, 0xD265, 0x8962, 0xD266, - 0x8963, 0xD267, 0x8964, 0xD268, 0x8965, 0xD269, 0x8966, 0xF1E0, - 0x8967, 0xD26A, 0x8968, 0xD26B, 0x8969, 0xD26C, 0x896A, 0xD26D, - 0x896B, 0xD26E, 0x896C, 0xD26F, 0x896D, 0xD270, 0x896E, 0xD271, - 0x896F, 0xD272, 0x8970, 0xD273, 0x8971, 0xD274, 0x8972, 0xD275, - 0x8973, 0xD276, 0x8974, 0xD277, 0x8975, 0xD278, 0x8976, 0xD279, - 0x8977, 0xD27A, 0x8978, 0xD27B, 0x8979, 0xD27C, 0x897A, 0xD27D, - 0x897B, 0xF1E1, 0x897C, 0xD27E, 0x897D, 0xD280, 0x897E, 0xD281, - 0x897F, 0xCEF7, 0x8980, 0xD282, 0x8981, 0xD2AA, 0x8982, 0xD283, - 0x8983, 0xF1FB, 0x8984, 0xD284, 0x8985, 0xD285, 0x8986, 0xB8B2, - 0x8987, 0xD286, 0x8988, 0xD287, 0x8989, 0xD288, 0x898A, 0xD289, - 0x898B, 0xD28A, 0x898C, 0xD28B, 0x898D, 0xD28C, 0x898E, 0xD28D, - 0x898F, 0xD28E, 0x8990, 0xD28F, 0x8991, 0xD290, 0x8992, 0xD291, - 0x8993, 0xD292, 0x8994, 0xD293, 0x8995, 0xD294, 0x8996, 0xD295, - 0x8997, 0xD296, 0x8998, 0xD297, 0x8999, 0xD298, 0x899A, 0xD299, - 0x899B, 0xD29A, 0x899C, 0xD29B, 0x899D, 0xD29C, 0x899E, 0xD29D, - 0x899F, 0xD29E, 0x89A0, 0xD29F, 0x89A1, 0xD2A0, 0x89A2, 0xD340, - 0x89A3, 0xD341, 0x89A4, 0xD342, 0x89A5, 0xD343, 0x89A6, 0xD344, - 0x89A7, 0xD345, 0x89A8, 0xD346, 0x89A9, 0xD347, 0x89AA, 0xD348, - 0x89AB, 0xD349, 0x89AC, 0xD34A, 0x89AD, 0xD34B, 0x89AE, 0xD34C, - 0x89AF, 0xD34D, 0x89B0, 0xD34E, 0x89B1, 0xD34F, 0x89B2, 0xD350, - 0x89B3, 0xD351, 0x89B4, 0xD352, 0x89B5, 0xD353, 0x89B6, 0xD354, - 0x89B7, 0xD355, 0x89B8, 0xD356, 0x89B9, 0xD357, 0x89BA, 0xD358, - 0x89BB, 0xD359, 0x89BC, 0xD35A, 0x89BD, 0xD35B, 0x89BE, 0xD35C, - 0x89BF, 0xD35D, 0x89C0, 0xD35E, 0x89C1, 0xBCFB, 0x89C2, 0xB9DB, - 0x89C3, 0xD35F, 0x89C4, 0xB9E6, 0x89C5, 0xC3D9, 0x89C6, 0xCAD3, - 0x89C7, 0xEAE8, 0x89C8, 0xC0C0, 0x89C9, 0xBEF5, 0x89CA, 0xEAE9, - 0x89CB, 0xEAEA, 0x89CC, 0xEAEB, 0x89CD, 0xD360, 0x89CE, 0xEAEC, - 0x89CF, 0xEAED, 0x89D0, 0xEAEE, 0x89D1, 0xEAEF, 0x89D2, 0xBDC7, - 0x89D3, 0xD361, 0x89D4, 0xD362, 0x89D5, 0xD363, 0x89D6, 0xF5FB, - 0x89D7, 0xD364, 0x89D8, 0xD365, 0x89D9, 0xD366, 0x89DA, 0xF5FD, - 0x89DB, 0xD367, 0x89DC, 0xF5FE, 0x89DD, 0xD368, 0x89DE, 0xF5FC, - 0x89DF, 0xD369, 0x89E0, 0xD36A, 0x89E1, 0xD36B, 0x89E2, 0xD36C, - 0x89E3, 0xBDE2, 0x89E4, 0xD36D, 0x89E5, 0xF6A1, 0x89E6, 0xB4A5, - 0x89E7, 0xD36E, 0x89E8, 0xD36F, 0x89E9, 0xD370, 0x89EA, 0xD371, - 0x89EB, 0xF6A2, 0x89EC, 0xD372, 0x89ED, 0xD373, 0x89EE, 0xD374, - 0x89EF, 0xF6A3, 0x89F0, 0xD375, 0x89F1, 0xD376, 0x89F2, 0xD377, - 0x89F3, 0xECB2, 0x89F4, 0xD378, 0x89F5, 0xD379, 0x89F6, 0xD37A, - 0x89F7, 0xD37B, 0x89F8, 0xD37C, 0x89F9, 0xD37D, 0x89FA, 0xD37E, - 0x89FB, 0xD380, 0x89FC, 0xD381, 0x89FD, 0xD382, 0x89FE, 0xD383, - 0x89FF, 0xD384, 0x8A00, 0xD1D4, 0x8A01, 0xD385, 0x8A02, 0xD386, - 0x8A03, 0xD387, 0x8A04, 0xD388, 0x8A05, 0xD389, 0x8A06, 0xD38A, - 0x8A07, 0xD9EA, 0x8A08, 0xD38B, 0x8A09, 0xD38C, 0x8A0A, 0xD38D, - 0x8A0B, 0xD38E, 0x8A0C, 0xD38F, 0x8A0D, 0xD390, 0x8A0E, 0xD391, - 0x8A0F, 0xD392, 0x8A10, 0xD393, 0x8A11, 0xD394, 0x8A12, 0xD395, - 0x8A13, 0xD396, 0x8A14, 0xD397, 0x8A15, 0xD398, 0x8A16, 0xD399, - 0x8A17, 0xD39A, 0x8A18, 0xD39B, 0x8A19, 0xD39C, 0x8A1A, 0xD39D, - 0x8A1B, 0xD39E, 0x8A1C, 0xD39F, 0x8A1D, 0xD3A0, 0x8A1E, 0xD440, - 0x8A1F, 0xD441, 0x8A20, 0xD442, 0x8A21, 0xD443, 0x8A22, 0xD444, - 0x8A23, 0xD445, 0x8A24, 0xD446, 0x8A25, 0xD447, 0x8A26, 0xD448, - 0x8A27, 0xD449, 0x8A28, 0xD44A, 0x8A29, 0xD44B, 0x8A2A, 0xD44C, - 0x8A2B, 0xD44D, 0x8A2C, 0xD44E, 0x8A2D, 0xD44F, 0x8A2E, 0xD450, - 0x8A2F, 0xD451, 0x8A30, 0xD452, 0x8A31, 0xD453, 0x8A32, 0xD454, - 0x8A33, 0xD455, 0x8A34, 0xD456, 0x8A35, 0xD457, 0x8A36, 0xD458, - 0x8A37, 0xD459, 0x8A38, 0xD45A, 0x8A39, 0xD45B, 0x8A3A, 0xD45C, - 0x8A3B, 0xD45D, 0x8A3C, 0xD45E, 0x8A3D, 0xD45F, 0x8A3E, 0xF6A4, - 0x8A3F, 0xD460, 0x8A40, 0xD461, 0x8A41, 0xD462, 0x8A42, 0xD463, - 0x8A43, 0xD464, 0x8A44, 0xD465, 0x8A45, 0xD466, 0x8A46, 0xD467, - 0x8A47, 0xD468, 0x8A48, 0xEEBA, 0x8A49, 0xD469, 0x8A4A, 0xD46A, - 0x8A4B, 0xD46B, 0x8A4C, 0xD46C, 0x8A4D, 0xD46D, 0x8A4E, 0xD46E, - 0x8A4F, 0xD46F, 0x8A50, 0xD470, 0x8A51, 0xD471, 0x8A52, 0xD472, - 0x8A53, 0xD473, 0x8A54, 0xD474, 0x8A55, 0xD475, 0x8A56, 0xD476, - 0x8A57, 0xD477, 0x8A58, 0xD478, 0x8A59, 0xD479, 0x8A5A, 0xD47A, - 0x8A5B, 0xD47B, 0x8A5C, 0xD47C, 0x8A5D, 0xD47D, 0x8A5E, 0xD47E, - 0x8A5F, 0xD480, 0x8A60, 0xD481, 0x8A61, 0xD482, 0x8A62, 0xD483, - 0x8A63, 0xD484, 0x8A64, 0xD485, 0x8A65, 0xD486, 0x8A66, 0xD487, - 0x8A67, 0xD488, 0x8A68, 0xD489, 0x8A69, 0xD48A, 0x8A6A, 0xD48B, - 0x8A6B, 0xD48C, 0x8A6C, 0xD48D, 0x8A6D, 0xD48E, 0x8A6E, 0xD48F, - 0x8A6F, 0xD490, 0x8A70, 0xD491, 0x8A71, 0xD492, 0x8A72, 0xD493, - 0x8A73, 0xD494, 0x8A74, 0xD495, 0x8A75, 0xD496, 0x8A76, 0xD497, - 0x8A77, 0xD498, 0x8A78, 0xD499, 0x8A79, 0xD5B2, 0x8A7A, 0xD49A, - 0x8A7B, 0xD49B, 0x8A7C, 0xD49C, 0x8A7D, 0xD49D, 0x8A7E, 0xD49E, - 0x8A7F, 0xD49F, 0x8A80, 0xD4A0, 0x8A81, 0xD540, 0x8A82, 0xD541, - 0x8A83, 0xD542, 0x8A84, 0xD543, 0x8A85, 0xD544, 0x8A86, 0xD545, - 0x8A87, 0xD546, 0x8A88, 0xD547, 0x8A89, 0xD3FE, 0x8A8A, 0xCCDC, - 0x8A8B, 0xD548, 0x8A8C, 0xD549, 0x8A8D, 0xD54A, 0x8A8E, 0xD54B, - 0x8A8F, 0xD54C, 0x8A90, 0xD54D, 0x8A91, 0xD54E, 0x8A92, 0xD54F, - 0x8A93, 0xCAC4, 0x8A94, 0xD550, 0x8A95, 0xD551, 0x8A96, 0xD552, - 0x8A97, 0xD553, 0x8A98, 0xD554, 0x8A99, 0xD555, 0x8A9A, 0xD556, - 0x8A9B, 0xD557, 0x8A9C, 0xD558, 0x8A9D, 0xD559, 0x8A9E, 0xD55A, - 0x8A9F, 0xD55B, 0x8AA0, 0xD55C, 0x8AA1, 0xD55D, 0x8AA2, 0xD55E, - 0x8AA3, 0xD55F, 0x8AA4, 0xD560, 0x8AA5, 0xD561, 0x8AA6, 0xD562, - 0x8AA7, 0xD563, 0x8AA8, 0xD564, 0x8AA9, 0xD565, 0x8AAA, 0xD566, - 0x8AAB, 0xD567, 0x8AAC, 0xD568, 0x8AAD, 0xD569, 0x8AAE, 0xD56A, - 0x8AAF, 0xD56B, 0x8AB0, 0xD56C, 0x8AB1, 0xD56D, 0x8AB2, 0xD56E, - 0x8AB3, 0xD56F, 0x8AB4, 0xD570, 0x8AB5, 0xD571, 0x8AB6, 0xD572, - 0x8AB7, 0xD573, 0x8AB8, 0xD574, 0x8AB9, 0xD575, 0x8ABA, 0xD576, - 0x8ABB, 0xD577, 0x8ABC, 0xD578, 0x8ABD, 0xD579, 0x8ABE, 0xD57A, - 0x8ABF, 0xD57B, 0x8AC0, 0xD57C, 0x8AC1, 0xD57D, 0x8AC2, 0xD57E, - 0x8AC3, 0xD580, 0x8AC4, 0xD581, 0x8AC5, 0xD582, 0x8AC6, 0xD583, - 0x8AC7, 0xD584, 0x8AC8, 0xD585, 0x8AC9, 0xD586, 0x8ACA, 0xD587, - 0x8ACB, 0xD588, 0x8ACC, 0xD589, 0x8ACD, 0xD58A, 0x8ACE, 0xD58B, - 0x8ACF, 0xD58C, 0x8AD0, 0xD58D, 0x8AD1, 0xD58E, 0x8AD2, 0xD58F, - 0x8AD3, 0xD590, 0x8AD4, 0xD591, 0x8AD5, 0xD592, 0x8AD6, 0xD593, - 0x8AD7, 0xD594, 0x8AD8, 0xD595, 0x8AD9, 0xD596, 0x8ADA, 0xD597, - 0x8ADB, 0xD598, 0x8ADC, 0xD599, 0x8ADD, 0xD59A, 0x8ADE, 0xD59B, - 0x8ADF, 0xD59C, 0x8AE0, 0xD59D, 0x8AE1, 0xD59E, 0x8AE2, 0xD59F, - 0x8AE3, 0xD5A0, 0x8AE4, 0xD640, 0x8AE5, 0xD641, 0x8AE6, 0xD642, - 0x8AE7, 0xD643, 0x8AE8, 0xD644, 0x8AE9, 0xD645, 0x8AEA, 0xD646, - 0x8AEB, 0xD647, 0x8AEC, 0xD648, 0x8AED, 0xD649, 0x8AEE, 0xD64A, - 0x8AEF, 0xD64B, 0x8AF0, 0xD64C, 0x8AF1, 0xD64D, 0x8AF2, 0xD64E, - 0x8AF3, 0xD64F, 0x8AF4, 0xD650, 0x8AF5, 0xD651, 0x8AF6, 0xD652, - 0x8AF7, 0xD653, 0x8AF8, 0xD654, 0x8AF9, 0xD655, 0x8AFA, 0xD656, - 0x8AFB, 0xD657, 0x8AFC, 0xD658, 0x8AFD, 0xD659, 0x8AFE, 0xD65A, - 0x8AFF, 0xD65B, 0x8B00, 0xD65C, 0x8B01, 0xD65D, 0x8B02, 0xD65E, - 0x8B03, 0xD65F, 0x8B04, 0xD660, 0x8B05, 0xD661, 0x8B06, 0xD662, - 0x8B07, 0xE5C0, 0x8B08, 0xD663, 0x8B09, 0xD664, 0x8B0A, 0xD665, - 0x8B0B, 0xD666, 0x8B0C, 0xD667, 0x8B0D, 0xD668, 0x8B0E, 0xD669, - 0x8B0F, 0xD66A, 0x8B10, 0xD66B, 0x8B11, 0xD66C, 0x8B12, 0xD66D, - 0x8B13, 0xD66E, 0x8B14, 0xD66F, 0x8B15, 0xD670, 0x8B16, 0xD671, - 0x8B17, 0xD672, 0x8B18, 0xD673, 0x8B19, 0xD674, 0x8B1A, 0xD675, - 0x8B1B, 0xD676, 0x8B1C, 0xD677, 0x8B1D, 0xD678, 0x8B1E, 0xD679, - 0x8B1F, 0xD67A, 0x8B20, 0xD67B, 0x8B21, 0xD67C, 0x8B22, 0xD67D, - 0x8B23, 0xD67E, 0x8B24, 0xD680, 0x8B25, 0xD681, 0x8B26, 0xF6A5, - 0x8B27, 0xD682, 0x8B28, 0xD683, 0x8B29, 0xD684, 0x8B2A, 0xD685, - 0x8B2B, 0xD686, 0x8B2C, 0xD687, 0x8B2D, 0xD688, 0x8B2E, 0xD689, - 0x8B2F, 0xD68A, 0x8B30, 0xD68B, 0x8B31, 0xD68C, 0x8B32, 0xD68D, - 0x8B33, 0xD68E, 0x8B34, 0xD68F, 0x8B35, 0xD690, 0x8B36, 0xD691, - 0x8B37, 0xD692, 0x8B38, 0xD693, 0x8B39, 0xD694, 0x8B3A, 0xD695, - 0x8B3B, 0xD696, 0x8B3C, 0xD697, 0x8B3D, 0xD698, 0x8B3E, 0xD699, - 0x8B3F, 0xD69A, 0x8B40, 0xD69B, 0x8B41, 0xD69C, 0x8B42, 0xD69D, - 0x8B43, 0xD69E, 0x8B44, 0xD69F, 0x8B45, 0xD6A0, 0x8B46, 0xD740, - 0x8B47, 0xD741, 0x8B48, 0xD742, 0x8B49, 0xD743, 0x8B4A, 0xD744, - 0x8B4B, 0xD745, 0x8B4C, 0xD746, 0x8B4D, 0xD747, 0x8B4E, 0xD748, - 0x8B4F, 0xD749, 0x8B50, 0xD74A, 0x8B51, 0xD74B, 0x8B52, 0xD74C, - 0x8B53, 0xD74D, 0x8B54, 0xD74E, 0x8B55, 0xD74F, 0x8B56, 0xD750, - 0x8B57, 0xD751, 0x8B58, 0xD752, 0x8B59, 0xD753, 0x8B5A, 0xD754, - 0x8B5B, 0xD755, 0x8B5C, 0xD756, 0x8B5D, 0xD757, 0x8B5E, 0xD758, - 0x8B5F, 0xD759, 0x8B60, 0xD75A, 0x8B61, 0xD75B, 0x8B62, 0xD75C, - 0x8B63, 0xD75D, 0x8B64, 0xD75E, 0x8B65, 0xD75F, 0x8B66, 0xBEAF, - 0x8B67, 0xD760, 0x8B68, 0xD761, 0x8B69, 0xD762, 0x8B6A, 0xD763, - 0x8B6B, 0xD764, 0x8B6C, 0xC6A9, 0x8B6D, 0xD765, 0x8B6E, 0xD766, - 0x8B6F, 0xD767, 0x8B70, 0xD768, 0x8B71, 0xD769, 0x8B72, 0xD76A, - 0x8B73, 0xD76B, 0x8B74, 0xD76C, 0x8B75, 0xD76D, 0x8B76, 0xD76E, - 0x8B77, 0xD76F, 0x8B78, 0xD770, 0x8B79, 0xD771, 0x8B7A, 0xD772, - 0x8B7B, 0xD773, 0x8B7C, 0xD774, 0x8B7D, 0xD775, 0x8B7E, 0xD776, - 0x8B7F, 0xD777, 0x8B80, 0xD778, 0x8B81, 0xD779, 0x8B82, 0xD77A, - 0x8B83, 0xD77B, 0x8B84, 0xD77C, 0x8B85, 0xD77D, 0x8B86, 0xD77E, - 0x8B87, 0xD780, 0x8B88, 0xD781, 0x8B89, 0xD782, 0x8B8A, 0xD783, - 0x8B8B, 0xD784, 0x8B8C, 0xD785, 0x8B8D, 0xD786, 0x8B8E, 0xD787, - 0x8B8F, 0xD788, 0x8B90, 0xD789, 0x8B91, 0xD78A, 0x8B92, 0xD78B, - 0x8B93, 0xD78C, 0x8B94, 0xD78D, 0x8B95, 0xD78E, 0x8B96, 0xD78F, - 0x8B97, 0xD790, 0x8B98, 0xD791, 0x8B99, 0xD792, 0x8B9A, 0xD793, - 0x8B9B, 0xD794, 0x8B9C, 0xD795, 0x8B9D, 0xD796, 0x8B9E, 0xD797, - 0x8B9F, 0xD798, 0x8BA0, 0xDAA5, 0x8BA1, 0xBCC6, 0x8BA2, 0xB6A9, - 0x8BA3, 0xB8BC, 0x8BA4, 0xC8CF, 0x8BA5, 0xBCA5, 0x8BA6, 0xDAA6, - 0x8BA7, 0xDAA7, 0x8BA8, 0xCCD6, 0x8BA9, 0xC8C3, 0x8BAA, 0xDAA8, - 0x8BAB, 0xC6FD, 0x8BAC, 0xD799, 0x8BAD, 0xD1B5, 0x8BAE, 0xD2E9, - 0x8BAF, 0xD1B6, 0x8BB0, 0xBCC7, 0x8BB1, 0xD79A, 0x8BB2, 0xBDB2, - 0x8BB3, 0xBBE4, 0x8BB4, 0xDAA9, 0x8BB5, 0xDAAA, 0x8BB6, 0xD1C8, - 0x8BB7, 0xDAAB, 0x8BB8, 0xD0ED, 0x8BB9, 0xB6EF, 0x8BBA, 0xC2DB, - 0x8BBB, 0xD79B, 0x8BBC, 0xCBCF, 0x8BBD, 0xB7ED, 0x8BBE, 0xC9E8, - 0x8BBF, 0xB7C3, 0x8BC0, 0xBEF7, 0x8BC1, 0xD6A4, 0x8BC2, 0xDAAC, - 0x8BC3, 0xDAAD, 0x8BC4, 0xC6C0, 0x8BC5, 0xD7E7, 0x8BC6, 0xCAB6, - 0x8BC7, 0xD79C, 0x8BC8, 0xD5A9, 0x8BC9, 0xCBDF, 0x8BCA, 0xD5EF, - 0x8BCB, 0xDAAE, 0x8BCC, 0xD6DF, 0x8BCD, 0xB4CA, 0x8BCE, 0xDAB0, - 0x8BCF, 0xDAAF, 0x8BD0, 0xD79D, 0x8BD1, 0xD2EB, 0x8BD2, 0xDAB1, - 0x8BD3, 0xDAB2, 0x8BD4, 0xDAB3, 0x8BD5, 0xCAD4, 0x8BD6, 0xDAB4, - 0x8BD7, 0xCAAB, 0x8BD8, 0xDAB5, 0x8BD9, 0xDAB6, 0x8BDA, 0xB3CF, - 0x8BDB, 0xD6EF, 0x8BDC, 0xDAB7, 0x8BDD, 0xBBB0, 0x8BDE, 0xB5AE, - 0x8BDF, 0xDAB8, 0x8BE0, 0xDAB9, 0x8BE1, 0xB9EE, 0x8BE2, 0xD1AF, - 0x8BE3, 0xD2E8, 0x8BE4, 0xDABA, 0x8BE5, 0xB8C3, 0x8BE6, 0xCFEA, - 0x8BE7, 0xB2EF, 0x8BE8, 0xDABB, 0x8BE9, 0xDABC, 0x8BEA, 0xD79E, - 0x8BEB, 0xBDEB, 0x8BEC, 0xCEDC, 0x8BED, 0xD3EF, 0x8BEE, 0xDABD, - 0x8BEF, 0xCEF3, 0x8BF0, 0xDABE, 0x8BF1, 0xD3D5, 0x8BF2, 0xBBE5, - 0x8BF3, 0xDABF, 0x8BF4, 0xCBB5, 0x8BF5, 0xCBD0, 0x8BF6, 0xDAC0, - 0x8BF7, 0xC7EB, 0x8BF8, 0xD6EE, 0x8BF9, 0xDAC1, 0x8BFA, 0xC5B5, - 0x8BFB, 0xB6C1, 0x8BFC, 0xDAC2, 0x8BFD, 0xB7CC, 0x8BFE, 0xBFCE, - 0x8BFF, 0xDAC3, 0x8C00, 0xDAC4, 0x8C01, 0xCBAD, 0x8C02, 0xDAC5, - 0x8C03, 0xB5F7, 0x8C04, 0xDAC6, 0x8C05, 0xC1C2, 0x8C06, 0xD7BB, - 0x8C07, 0xDAC7, 0x8C08, 0xCCB8, 0x8C09, 0xD79F, 0x8C0A, 0xD2EA, - 0x8C0B, 0xC4B1, 0x8C0C, 0xDAC8, 0x8C0D, 0xB5FD, 0x8C0E, 0xBBD1, - 0x8C0F, 0xDAC9, 0x8C10, 0xD0B3, 0x8C11, 0xDACA, 0x8C12, 0xDACB, - 0x8C13, 0xCEBD, 0x8C14, 0xDACC, 0x8C15, 0xDACD, 0x8C16, 0xDACE, - 0x8C17, 0xB2F7, 0x8C18, 0xDAD1, 0x8C19, 0xDACF, 0x8C1A, 0xD1E8, - 0x8C1B, 0xDAD0, 0x8C1C, 0xC3D5, 0x8C1D, 0xDAD2, 0x8C1E, 0xD7A0, - 0x8C1F, 0xDAD3, 0x8C20, 0xDAD4, 0x8C21, 0xDAD5, 0x8C22, 0xD0BB, - 0x8C23, 0xD2A5, 0x8C24, 0xB0F9, 0x8C25, 0xDAD6, 0x8C26, 0xC7AB, - 0x8C27, 0xDAD7, 0x8C28, 0xBDF7, 0x8C29, 0xC3A1, 0x8C2A, 0xDAD8, - 0x8C2B, 0xDAD9, 0x8C2C, 0xC3FD, 0x8C2D, 0xCCB7, 0x8C2E, 0xDADA, - 0x8C2F, 0xDADB, 0x8C30, 0xC0BE, 0x8C31, 0xC6D7, 0x8C32, 0xDADC, - 0x8C33, 0xDADD, 0x8C34, 0xC7B4, 0x8C35, 0xDADE, 0x8C36, 0xDADF, - 0x8C37, 0xB9C8, 0x8C38, 0xD840, 0x8C39, 0xD841, 0x8C3A, 0xD842, - 0x8C3B, 0xD843, 0x8C3C, 0xD844, 0x8C3D, 0xD845, 0x8C3E, 0xD846, - 0x8C3F, 0xD847, 0x8C40, 0xD848, 0x8C41, 0xBBED, 0x8C42, 0xD849, - 0x8C43, 0xD84A, 0x8C44, 0xD84B, 0x8C45, 0xD84C, 0x8C46, 0xB6B9, - 0x8C47, 0xF4F8, 0x8C48, 0xD84D, 0x8C49, 0xF4F9, 0x8C4A, 0xD84E, - 0x8C4B, 0xD84F, 0x8C4C, 0xCDE3, 0x8C4D, 0xD850, 0x8C4E, 0xD851, - 0x8C4F, 0xD852, 0x8C50, 0xD853, 0x8C51, 0xD854, 0x8C52, 0xD855, - 0x8C53, 0xD856, 0x8C54, 0xD857, 0x8C55, 0xF5B9, 0x8C56, 0xD858, - 0x8C57, 0xD859, 0x8C58, 0xD85A, 0x8C59, 0xD85B, 0x8C5A, 0xEBE0, - 0x8C5B, 0xD85C, 0x8C5C, 0xD85D, 0x8C5D, 0xD85E, 0x8C5E, 0xD85F, - 0x8C5F, 0xD860, 0x8C60, 0xD861, 0x8C61, 0xCFF3, 0x8C62, 0xBBBF, - 0x8C63, 0xD862, 0x8C64, 0xD863, 0x8C65, 0xD864, 0x8C66, 0xD865, - 0x8C67, 0xD866, 0x8C68, 0xD867, 0x8C69, 0xD868, 0x8C6A, 0xBAC0, - 0x8C6B, 0xD4A5, 0x8C6C, 0xD869, 0x8C6D, 0xD86A, 0x8C6E, 0xD86B, - 0x8C6F, 0xD86C, 0x8C70, 0xD86D, 0x8C71, 0xD86E, 0x8C72, 0xD86F, - 0x8C73, 0xE1D9, 0x8C74, 0xD870, 0x8C75, 0xD871, 0x8C76, 0xD872, - 0x8C77, 0xD873, 0x8C78, 0xF5F4, 0x8C79, 0xB1AA, 0x8C7A, 0xB2F2, - 0x8C7B, 0xD874, 0x8C7C, 0xD875, 0x8C7D, 0xD876, 0x8C7E, 0xD877, - 0x8C7F, 0xD878, 0x8C80, 0xD879, 0x8C81, 0xD87A, 0x8C82, 0xF5F5, - 0x8C83, 0xD87B, 0x8C84, 0xD87C, 0x8C85, 0xF5F7, 0x8C86, 0xD87D, - 0x8C87, 0xD87E, 0x8C88, 0xD880, 0x8C89, 0xBAD1, 0x8C8A, 0xF5F6, - 0x8C8B, 0xD881, 0x8C8C, 0xC3B2, 0x8C8D, 0xD882, 0x8C8E, 0xD883, - 0x8C8F, 0xD884, 0x8C90, 0xD885, 0x8C91, 0xD886, 0x8C92, 0xD887, - 0x8C93, 0xD888, 0x8C94, 0xF5F9, 0x8C95, 0xD889, 0x8C96, 0xD88A, - 0x8C97, 0xD88B, 0x8C98, 0xF5F8, 0x8C99, 0xD88C, 0x8C9A, 0xD88D, - 0x8C9B, 0xD88E, 0x8C9C, 0xD88F, 0x8C9D, 0xD890, 0x8C9E, 0xD891, - 0x8C9F, 0xD892, 0x8CA0, 0xD893, 0x8CA1, 0xD894, 0x8CA2, 0xD895, - 0x8CA3, 0xD896, 0x8CA4, 0xD897, 0x8CA5, 0xD898, 0x8CA6, 0xD899, - 0x8CA7, 0xD89A, 0x8CA8, 0xD89B, 0x8CA9, 0xD89C, 0x8CAA, 0xD89D, - 0x8CAB, 0xD89E, 0x8CAC, 0xD89F, 0x8CAD, 0xD8A0, 0x8CAE, 0xD940, - 0x8CAF, 0xD941, 0x8CB0, 0xD942, 0x8CB1, 0xD943, 0x8CB2, 0xD944, - 0x8CB3, 0xD945, 0x8CB4, 0xD946, 0x8CB5, 0xD947, 0x8CB6, 0xD948, - 0x8CB7, 0xD949, 0x8CB8, 0xD94A, 0x8CB9, 0xD94B, 0x8CBA, 0xD94C, - 0x8CBB, 0xD94D, 0x8CBC, 0xD94E, 0x8CBD, 0xD94F, 0x8CBE, 0xD950, - 0x8CBF, 0xD951, 0x8CC0, 0xD952, 0x8CC1, 0xD953, 0x8CC2, 0xD954, - 0x8CC3, 0xD955, 0x8CC4, 0xD956, 0x8CC5, 0xD957, 0x8CC6, 0xD958, - 0x8CC7, 0xD959, 0x8CC8, 0xD95A, 0x8CC9, 0xD95B, 0x8CCA, 0xD95C, - 0x8CCB, 0xD95D, 0x8CCC, 0xD95E, 0x8CCD, 0xD95F, 0x8CCE, 0xD960, - 0x8CCF, 0xD961, 0x8CD0, 0xD962, 0x8CD1, 0xD963, 0x8CD2, 0xD964, - 0x8CD3, 0xD965, 0x8CD4, 0xD966, 0x8CD5, 0xD967, 0x8CD6, 0xD968, - 0x8CD7, 0xD969, 0x8CD8, 0xD96A, 0x8CD9, 0xD96B, 0x8CDA, 0xD96C, - 0x8CDB, 0xD96D, 0x8CDC, 0xD96E, 0x8CDD, 0xD96F, 0x8CDE, 0xD970, - 0x8CDF, 0xD971, 0x8CE0, 0xD972, 0x8CE1, 0xD973, 0x8CE2, 0xD974, - 0x8CE3, 0xD975, 0x8CE4, 0xD976, 0x8CE5, 0xD977, 0x8CE6, 0xD978, - 0x8CE7, 0xD979, 0x8CE8, 0xD97A, 0x8CE9, 0xD97B, 0x8CEA, 0xD97C, - 0x8CEB, 0xD97D, 0x8CEC, 0xD97E, 0x8CED, 0xD980, 0x8CEE, 0xD981, - 0x8CEF, 0xD982, 0x8CF0, 0xD983, 0x8CF1, 0xD984, 0x8CF2, 0xD985, - 0x8CF3, 0xD986, 0x8CF4, 0xD987, 0x8CF5, 0xD988, 0x8CF6, 0xD989, - 0x8CF7, 0xD98A, 0x8CF8, 0xD98B, 0x8CF9, 0xD98C, 0x8CFA, 0xD98D, - 0x8CFB, 0xD98E, 0x8CFC, 0xD98F, 0x8CFD, 0xD990, 0x8CFE, 0xD991, - 0x8CFF, 0xD992, 0x8D00, 0xD993, 0x8D01, 0xD994, 0x8D02, 0xD995, - 0x8D03, 0xD996, 0x8D04, 0xD997, 0x8D05, 0xD998, 0x8D06, 0xD999, - 0x8D07, 0xD99A, 0x8D08, 0xD99B, 0x8D09, 0xD99C, 0x8D0A, 0xD99D, - 0x8D0B, 0xD99E, 0x8D0C, 0xD99F, 0x8D0D, 0xD9A0, 0x8D0E, 0xDA40, - 0x8D0F, 0xDA41, 0x8D10, 0xDA42, 0x8D11, 0xDA43, 0x8D12, 0xDA44, - 0x8D13, 0xDA45, 0x8D14, 0xDA46, 0x8D15, 0xDA47, 0x8D16, 0xDA48, - 0x8D17, 0xDA49, 0x8D18, 0xDA4A, 0x8D19, 0xDA4B, 0x8D1A, 0xDA4C, - 0x8D1B, 0xDA4D, 0x8D1C, 0xDA4E, 0x8D1D, 0xB1B4, 0x8D1E, 0xD5EA, - 0x8D1F, 0xB8BA, 0x8D20, 0xDA4F, 0x8D21, 0xB9B1, 0x8D22, 0xB2C6, - 0x8D23, 0xD4F0, 0x8D24, 0xCFCD, 0x8D25, 0xB0DC, 0x8D26, 0xD5CB, - 0x8D27, 0xBBF5, 0x8D28, 0xD6CA, 0x8D29, 0xB7B7, 0x8D2A, 0xCCB0, - 0x8D2B, 0xC6B6, 0x8D2C, 0xB1E1, 0x8D2D, 0xB9BA, 0x8D2E, 0xD6FC, - 0x8D2F, 0xB9E1, 0x8D30, 0xB7A1, 0x8D31, 0xBCFA, 0x8D32, 0xEADA, - 0x8D33, 0xEADB, 0x8D34, 0xCCF9, 0x8D35, 0xB9F3, 0x8D36, 0xEADC, - 0x8D37, 0xB4FB, 0x8D38, 0xC3B3, 0x8D39, 0xB7D1, 0x8D3A, 0xBAD8, - 0x8D3B, 0xEADD, 0x8D3C, 0xD4F4, 0x8D3D, 0xEADE, 0x8D3E, 0xBCD6, - 0x8D3F, 0xBBDF, 0x8D40, 0xEADF, 0x8D41, 0xC1DE, 0x8D42, 0xC2B8, - 0x8D43, 0xD4DF, 0x8D44, 0xD7CA, 0x8D45, 0xEAE0, 0x8D46, 0xEAE1, - 0x8D47, 0xEAE4, 0x8D48, 0xEAE2, 0x8D49, 0xEAE3, 0x8D4A, 0xC9DE, - 0x8D4B, 0xB8B3, 0x8D4C, 0xB6C4, 0x8D4D, 0xEAE5, 0x8D4E, 0xCAEA, - 0x8D4F, 0xC9CD, 0x8D50, 0xB4CD, 0x8D51, 0xDA50, 0x8D52, 0xDA51, - 0x8D53, 0xE2D9, 0x8D54, 0xC5E2, 0x8D55, 0xEAE6, 0x8D56, 0xC0B5, - 0x8D57, 0xDA52, 0x8D58, 0xD7B8, 0x8D59, 0xEAE7, 0x8D5A, 0xD7AC, - 0x8D5B, 0xC8FC, 0x8D5C, 0xD8D3, 0x8D5D, 0xD8CD, 0x8D5E, 0xD4DE, - 0x8D5F, 0xDA53, 0x8D60, 0xD4F9, 0x8D61, 0xC9C4, 0x8D62, 0xD3AE, - 0x8D63, 0xB8D3, 0x8D64, 0xB3E0, 0x8D65, 0xDA54, 0x8D66, 0xC9E2, - 0x8D67, 0xF4F6, 0x8D68, 0xDA55, 0x8D69, 0xDA56, 0x8D6A, 0xDA57, - 0x8D6B, 0xBAD5, 0x8D6C, 0xDA58, 0x8D6D, 0xF4F7, 0x8D6E, 0xDA59, - 0x8D6F, 0xDA5A, 0x8D70, 0xD7DF, 0x8D71, 0xDA5B, 0x8D72, 0xDA5C, - 0x8D73, 0xF4F1, 0x8D74, 0xB8B0, 0x8D75, 0xD5D4, 0x8D76, 0xB8CF, - 0x8D77, 0xC6F0, 0x8D78, 0xDA5D, 0x8D79, 0xDA5E, 0x8D7A, 0xDA5F, - 0x8D7B, 0xDA60, 0x8D7C, 0xDA61, 0x8D7D, 0xDA62, 0x8D7E, 0xDA63, - 0x8D7F, 0xDA64, 0x8D80, 0xDA65, 0x8D81, 0xB3C3, 0x8D82, 0xDA66, - 0x8D83, 0xDA67, 0x8D84, 0xF4F2, 0x8D85, 0xB3AC, 0x8D86, 0xDA68, - 0x8D87, 0xDA69, 0x8D88, 0xDA6A, 0x8D89, 0xDA6B, 0x8D8A, 0xD4BD, - 0x8D8B, 0xC7F7, 0x8D8C, 0xDA6C, 0x8D8D, 0xDA6D, 0x8D8E, 0xDA6E, - 0x8D8F, 0xDA6F, 0x8D90, 0xDA70, 0x8D91, 0xF4F4, 0x8D92, 0xDA71, - 0x8D93, 0xDA72, 0x8D94, 0xF4F3, 0x8D95, 0xDA73, 0x8D96, 0xDA74, - 0x8D97, 0xDA75, 0x8D98, 0xDA76, 0x8D99, 0xDA77, 0x8D9A, 0xDA78, - 0x8D9B, 0xDA79, 0x8D9C, 0xDA7A, 0x8D9D, 0xDA7B, 0x8D9E, 0xDA7C, - 0x8D9F, 0xCCCB, 0x8DA0, 0xDA7D, 0x8DA1, 0xDA7E, 0x8DA2, 0xDA80, - 0x8DA3, 0xC8A4, 0x8DA4, 0xDA81, 0x8DA5, 0xDA82, 0x8DA6, 0xDA83, - 0x8DA7, 0xDA84, 0x8DA8, 0xDA85, 0x8DA9, 0xDA86, 0x8DAA, 0xDA87, - 0x8DAB, 0xDA88, 0x8DAC, 0xDA89, 0x8DAD, 0xDA8A, 0x8DAE, 0xDA8B, - 0x8DAF, 0xDA8C, 0x8DB0, 0xDA8D, 0x8DB1, 0xF4F5, 0x8DB2, 0xDA8E, - 0x8DB3, 0xD7E3, 0x8DB4, 0xC5BF, 0x8DB5, 0xF5C0, 0x8DB6, 0xDA8F, - 0x8DB7, 0xDA90, 0x8DB8, 0xF5BB, 0x8DB9, 0xDA91, 0x8DBA, 0xF5C3, - 0x8DBB, 0xDA92, 0x8DBC, 0xF5C2, 0x8DBD, 0xDA93, 0x8DBE, 0xD6BA, - 0x8DBF, 0xF5C1, 0x8DC0, 0xDA94, 0x8DC1, 0xDA95, 0x8DC2, 0xDA96, - 0x8DC3, 0xD4BE, 0x8DC4, 0xF5C4, 0x8DC5, 0xDA97, 0x8DC6, 0xF5CC, - 0x8DC7, 0xDA98, 0x8DC8, 0xDA99, 0x8DC9, 0xDA9A, 0x8DCA, 0xDA9B, - 0x8DCB, 0xB0CF, 0x8DCC, 0xB5F8, 0x8DCD, 0xDA9C, 0x8DCE, 0xF5C9, - 0x8DCF, 0xF5CA, 0x8DD0, 0xDA9D, 0x8DD1, 0xC5DC, 0x8DD2, 0xDA9E, - 0x8DD3, 0xDA9F, 0x8DD4, 0xDAA0, 0x8DD5, 0xDB40, 0x8DD6, 0xF5C5, - 0x8DD7, 0xF5C6, 0x8DD8, 0xDB41, 0x8DD9, 0xDB42, 0x8DDA, 0xF5C7, - 0x8DDB, 0xF5CB, 0x8DDC, 0xDB43, 0x8DDD, 0xBEE0, 0x8DDE, 0xF5C8, - 0x8DDF, 0xB8FA, 0x8DE0, 0xDB44, 0x8DE1, 0xDB45, 0x8DE2, 0xDB46, - 0x8DE3, 0xF5D0, 0x8DE4, 0xF5D3, 0x8DE5, 0xDB47, 0x8DE6, 0xDB48, - 0x8DE7, 0xDB49, 0x8DE8, 0xBFE7, 0x8DE9, 0xDB4A, 0x8DEA, 0xB9F2, - 0x8DEB, 0xF5BC, 0x8DEC, 0xF5CD, 0x8DED, 0xDB4B, 0x8DEE, 0xDB4C, - 0x8DEF, 0xC2B7, 0x8DF0, 0xDB4D, 0x8DF1, 0xDB4E, 0x8DF2, 0xDB4F, - 0x8DF3, 0xCCF8, 0x8DF4, 0xDB50, 0x8DF5, 0xBCF9, 0x8DF6, 0xDB51, - 0x8DF7, 0xF5CE, 0x8DF8, 0xF5CF, 0x8DF9, 0xF5D1, 0x8DFA, 0xB6E5, - 0x8DFB, 0xF5D2, 0x8DFC, 0xDB52, 0x8DFD, 0xF5D5, 0x8DFE, 0xDB53, - 0x8DFF, 0xDB54, 0x8E00, 0xDB55, 0x8E01, 0xDB56, 0x8E02, 0xDB57, - 0x8E03, 0xDB58, 0x8E04, 0xDB59, 0x8E05, 0xF5BD, 0x8E06, 0xDB5A, - 0x8E07, 0xDB5B, 0x8E08, 0xDB5C, 0x8E09, 0xF5D4, 0x8E0A, 0xD3BB, - 0x8E0B, 0xDB5D, 0x8E0C, 0xB3EC, 0x8E0D, 0xDB5E, 0x8E0E, 0xDB5F, - 0x8E0F, 0xCCA4, 0x8E10, 0xDB60, 0x8E11, 0xDB61, 0x8E12, 0xDB62, - 0x8E13, 0xDB63, 0x8E14, 0xF5D6, 0x8E15, 0xDB64, 0x8E16, 0xDB65, - 0x8E17, 0xDB66, 0x8E18, 0xDB67, 0x8E19, 0xDB68, 0x8E1A, 0xDB69, - 0x8E1B, 0xDB6A, 0x8E1C, 0xDB6B, 0x8E1D, 0xF5D7, 0x8E1E, 0xBEE1, - 0x8E1F, 0xF5D8, 0x8E20, 0xDB6C, 0x8E21, 0xDB6D, 0x8E22, 0xCCDF, - 0x8E23, 0xF5DB, 0x8E24, 0xDB6E, 0x8E25, 0xDB6F, 0x8E26, 0xDB70, - 0x8E27, 0xDB71, 0x8E28, 0xDB72, 0x8E29, 0xB2C8, 0x8E2A, 0xD7D9, - 0x8E2B, 0xDB73, 0x8E2C, 0xF5D9, 0x8E2D, 0xDB74, 0x8E2E, 0xF5DA, - 0x8E2F, 0xF5DC, 0x8E30, 0xDB75, 0x8E31, 0xF5E2, 0x8E32, 0xDB76, - 0x8E33, 0xDB77, 0x8E34, 0xDB78, 0x8E35, 0xF5E0, 0x8E36, 0xDB79, - 0x8E37, 0xDB7A, 0x8E38, 0xDB7B, 0x8E39, 0xF5DF, 0x8E3A, 0xF5DD, - 0x8E3B, 0xDB7C, 0x8E3C, 0xDB7D, 0x8E3D, 0xF5E1, 0x8E3E, 0xDB7E, - 0x8E3F, 0xDB80, 0x8E40, 0xF5DE, 0x8E41, 0xF5E4, 0x8E42, 0xF5E5, - 0x8E43, 0xDB81, 0x8E44, 0xCCE3, 0x8E45, 0xDB82, 0x8E46, 0xDB83, - 0x8E47, 0xE5BF, 0x8E48, 0xB5B8, 0x8E49, 0xF5E3, 0x8E4A, 0xF5E8, - 0x8E4B, 0xCCA3, 0x8E4C, 0xDB84, 0x8E4D, 0xDB85, 0x8E4E, 0xDB86, - 0x8E4F, 0xDB87, 0x8E50, 0xDB88, 0x8E51, 0xF5E6, 0x8E52, 0xF5E7, - 0x8E53, 0xDB89, 0x8E54, 0xDB8A, 0x8E55, 0xDB8B, 0x8E56, 0xDB8C, - 0x8E57, 0xDB8D, 0x8E58, 0xDB8E, 0x8E59, 0xF5BE, 0x8E5A, 0xDB8F, - 0x8E5B, 0xDB90, 0x8E5C, 0xDB91, 0x8E5D, 0xDB92, 0x8E5E, 0xDB93, - 0x8E5F, 0xDB94, 0x8E60, 0xDB95, 0x8E61, 0xDB96, 0x8E62, 0xDB97, - 0x8E63, 0xDB98, 0x8E64, 0xDB99, 0x8E65, 0xDB9A, 0x8E66, 0xB1C4, - 0x8E67, 0xDB9B, 0x8E68, 0xDB9C, 0x8E69, 0xF5BF, 0x8E6A, 0xDB9D, - 0x8E6B, 0xDB9E, 0x8E6C, 0xB5C5, 0x8E6D, 0xB2E4, 0x8E6E, 0xDB9F, - 0x8E6F, 0xF5EC, 0x8E70, 0xF5E9, 0x8E71, 0xDBA0, 0x8E72, 0xB6D7, - 0x8E73, 0xDC40, 0x8E74, 0xF5ED, 0x8E75, 0xDC41, 0x8E76, 0xF5EA, - 0x8E77, 0xDC42, 0x8E78, 0xDC43, 0x8E79, 0xDC44, 0x8E7A, 0xDC45, - 0x8E7B, 0xDC46, 0x8E7C, 0xF5EB, 0x8E7D, 0xDC47, 0x8E7E, 0xDC48, - 0x8E7F, 0xB4DA, 0x8E80, 0xDC49, 0x8E81, 0xD4EA, 0x8E82, 0xDC4A, - 0x8E83, 0xDC4B, 0x8E84, 0xDC4C, 0x8E85, 0xF5EE, 0x8E86, 0xDC4D, - 0x8E87, 0xB3F9, 0x8E88, 0xDC4E, 0x8E89, 0xDC4F, 0x8E8A, 0xDC50, - 0x8E8B, 0xDC51, 0x8E8C, 0xDC52, 0x8E8D, 0xDC53, 0x8E8E, 0xDC54, - 0x8E8F, 0xF5EF, 0x8E90, 0xF5F1, 0x8E91, 0xDC55, 0x8E92, 0xDC56, - 0x8E93, 0xDC57, 0x8E94, 0xF5F0, 0x8E95, 0xDC58, 0x8E96, 0xDC59, - 0x8E97, 0xDC5A, 0x8E98, 0xDC5B, 0x8E99, 0xDC5C, 0x8E9A, 0xDC5D, - 0x8E9B, 0xDC5E, 0x8E9C, 0xF5F2, 0x8E9D, 0xDC5F, 0x8E9E, 0xF5F3, - 0x8E9F, 0xDC60, 0x8EA0, 0xDC61, 0x8EA1, 0xDC62, 0x8EA2, 0xDC63, - 0x8EA3, 0xDC64, 0x8EA4, 0xDC65, 0x8EA5, 0xDC66, 0x8EA6, 0xDC67, - 0x8EA7, 0xDC68, 0x8EA8, 0xDC69, 0x8EA9, 0xDC6A, 0x8EAA, 0xDC6B, - 0x8EAB, 0xC9ED, 0x8EAC, 0xB9AA, 0x8EAD, 0xDC6C, 0x8EAE, 0xDC6D, - 0x8EAF, 0xC7FB, 0x8EB0, 0xDC6E, 0x8EB1, 0xDC6F, 0x8EB2, 0xB6E3, - 0x8EB3, 0xDC70, 0x8EB4, 0xDC71, 0x8EB5, 0xDC72, 0x8EB6, 0xDC73, - 0x8EB7, 0xDC74, 0x8EB8, 0xDC75, 0x8EB9, 0xDC76, 0x8EBA, 0xCCC9, - 0x8EBB, 0xDC77, 0x8EBC, 0xDC78, 0x8EBD, 0xDC79, 0x8EBE, 0xDC7A, - 0x8EBF, 0xDC7B, 0x8EC0, 0xDC7C, 0x8EC1, 0xDC7D, 0x8EC2, 0xDC7E, - 0x8EC3, 0xDC80, 0x8EC4, 0xDC81, 0x8EC5, 0xDC82, 0x8EC6, 0xDC83, - 0x8EC7, 0xDC84, 0x8EC8, 0xDC85, 0x8EC9, 0xDC86, 0x8ECA, 0xDC87, - 0x8ECB, 0xDC88, 0x8ECC, 0xDC89, 0x8ECD, 0xDC8A, 0x8ECE, 0xEAA6, - 0x8ECF, 0xDC8B, 0x8ED0, 0xDC8C, 0x8ED1, 0xDC8D, 0x8ED2, 0xDC8E, - 0x8ED3, 0xDC8F, 0x8ED4, 0xDC90, 0x8ED5, 0xDC91, 0x8ED6, 0xDC92, - 0x8ED7, 0xDC93, 0x8ED8, 0xDC94, 0x8ED9, 0xDC95, 0x8EDA, 0xDC96, - 0x8EDB, 0xDC97, 0x8EDC, 0xDC98, 0x8EDD, 0xDC99, 0x8EDE, 0xDC9A, - 0x8EDF, 0xDC9B, 0x8EE0, 0xDC9C, 0x8EE1, 0xDC9D, 0x8EE2, 0xDC9E, - 0x8EE3, 0xDC9F, 0x8EE4, 0xDCA0, 0x8EE5, 0xDD40, 0x8EE6, 0xDD41, - 0x8EE7, 0xDD42, 0x8EE8, 0xDD43, 0x8EE9, 0xDD44, 0x8EEA, 0xDD45, - 0x8EEB, 0xDD46, 0x8EEC, 0xDD47, 0x8EED, 0xDD48, 0x8EEE, 0xDD49, - 0x8EEF, 0xDD4A, 0x8EF0, 0xDD4B, 0x8EF1, 0xDD4C, 0x8EF2, 0xDD4D, - 0x8EF3, 0xDD4E, 0x8EF4, 0xDD4F, 0x8EF5, 0xDD50, 0x8EF6, 0xDD51, - 0x8EF7, 0xDD52, 0x8EF8, 0xDD53, 0x8EF9, 0xDD54, 0x8EFA, 0xDD55, - 0x8EFB, 0xDD56, 0x8EFC, 0xDD57, 0x8EFD, 0xDD58, 0x8EFE, 0xDD59, - 0x8EFF, 0xDD5A, 0x8F00, 0xDD5B, 0x8F01, 0xDD5C, 0x8F02, 0xDD5D, - 0x8F03, 0xDD5E, 0x8F04, 0xDD5F, 0x8F05, 0xDD60, 0x8F06, 0xDD61, - 0x8F07, 0xDD62, 0x8F08, 0xDD63, 0x8F09, 0xDD64, 0x8F0A, 0xDD65, - 0x8F0B, 0xDD66, 0x8F0C, 0xDD67, 0x8F0D, 0xDD68, 0x8F0E, 0xDD69, - 0x8F0F, 0xDD6A, 0x8F10, 0xDD6B, 0x8F11, 0xDD6C, 0x8F12, 0xDD6D, - 0x8F13, 0xDD6E, 0x8F14, 0xDD6F, 0x8F15, 0xDD70, 0x8F16, 0xDD71, - 0x8F17, 0xDD72, 0x8F18, 0xDD73, 0x8F19, 0xDD74, 0x8F1A, 0xDD75, - 0x8F1B, 0xDD76, 0x8F1C, 0xDD77, 0x8F1D, 0xDD78, 0x8F1E, 0xDD79, - 0x8F1F, 0xDD7A, 0x8F20, 0xDD7B, 0x8F21, 0xDD7C, 0x8F22, 0xDD7D, - 0x8F23, 0xDD7E, 0x8F24, 0xDD80, 0x8F25, 0xDD81, 0x8F26, 0xDD82, - 0x8F27, 0xDD83, 0x8F28, 0xDD84, 0x8F29, 0xDD85, 0x8F2A, 0xDD86, - 0x8F2B, 0xDD87, 0x8F2C, 0xDD88, 0x8F2D, 0xDD89, 0x8F2E, 0xDD8A, - 0x8F2F, 0xDD8B, 0x8F30, 0xDD8C, 0x8F31, 0xDD8D, 0x8F32, 0xDD8E, - 0x8F33, 0xDD8F, 0x8F34, 0xDD90, 0x8F35, 0xDD91, 0x8F36, 0xDD92, - 0x8F37, 0xDD93, 0x8F38, 0xDD94, 0x8F39, 0xDD95, 0x8F3A, 0xDD96, - 0x8F3B, 0xDD97, 0x8F3C, 0xDD98, 0x8F3D, 0xDD99, 0x8F3E, 0xDD9A, - 0x8F3F, 0xDD9B, 0x8F40, 0xDD9C, 0x8F41, 0xDD9D, 0x8F42, 0xDD9E, - 0x8F43, 0xDD9F, 0x8F44, 0xDDA0, 0x8F45, 0xDE40, 0x8F46, 0xDE41, - 0x8F47, 0xDE42, 0x8F48, 0xDE43, 0x8F49, 0xDE44, 0x8F4A, 0xDE45, - 0x8F4B, 0xDE46, 0x8F4C, 0xDE47, 0x8F4D, 0xDE48, 0x8F4E, 0xDE49, - 0x8F4F, 0xDE4A, 0x8F50, 0xDE4B, 0x8F51, 0xDE4C, 0x8F52, 0xDE4D, - 0x8F53, 0xDE4E, 0x8F54, 0xDE4F, 0x8F55, 0xDE50, 0x8F56, 0xDE51, - 0x8F57, 0xDE52, 0x8F58, 0xDE53, 0x8F59, 0xDE54, 0x8F5A, 0xDE55, - 0x8F5B, 0xDE56, 0x8F5C, 0xDE57, 0x8F5D, 0xDE58, 0x8F5E, 0xDE59, - 0x8F5F, 0xDE5A, 0x8F60, 0xDE5B, 0x8F61, 0xDE5C, 0x8F62, 0xDE5D, - 0x8F63, 0xDE5E, 0x8F64, 0xDE5F, 0x8F65, 0xDE60, 0x8F66, 0xB3B5, - 0x8F67, 0xD4FE, 0x8F68, 0xB9EC, 0x8F69, 0xD0F9, 0x8F6A, 0xDE61, - 0x8F6B, 0xE9ED, 0x8F6C, 0xD7AA, 0x8F6D, 0xE9EE, 0x8F6E, 0xC2D6, - 0x8F6F, 0xC8ED, 0x8F70, 0xBAE4, 0x8F71, 0xE9EF, 0x8F72, 0xE9F0, - 0x8F73, 0xE9F1, 0x8F74, 0xD6E1, 0x8F75, 0xE9F2, 0x8F76, 0xE9F3, - 0x8F77, 0xE9F5, 0x8F78, 0xE9F4, 0x8F79, 0xE9F6, 0x8F7A, 0xE9F7, - 0x8F7B, 0xC7E1, 0x8F7C, 0xE9F8, 0x8F7D, 0xD4D8, 0x8F7E, 0xE9F9, - 0x8F7F, 0xBDCE, 0x8F80, 0xDE62, 0x8F81, 0xE9FA, 0x8F82, 0xE9FB, - 0x8F83, 0xBDCF, 0x8F84, 0xE9FC, 0x8F85, 0xB8A8, 0x8F86, 0xC1BE, - 0x8F87, 0xE9FD, 0x8F88, 0xB1B2, 0x8F89, 0xBBD4, 0x8F8A, 0xB9F5, - 0x8F8B, 0xE9FE, 0x8F8C, 0xDE63, 0x8F8D, 0xEAA1, 0x8F8E, 0xEAA2, - 0x8F8F, 0xEAA3, 0x8F90, 0xB7F8, 0x8F91, 0xBCAD, 0x8F92, 0xDE64, - 0x8F93, 0xCAE4, 0x8F94, 0xE0CE, 0x8F95, 0xD4AF, 0x8F96, 0xCFBD, - 0x8F97, 0xD5B7, 0x8F98, 0xEAA4, 0x8F99, 0xD5DE, 0x8F9A, 0xEAA5, - 0x8F9B, 0xD0C1, 0x8F9C, 0xB9BC, 0x8F9D, 0xDE65, 0x8F9E, 0xB4C7, - 0x8F9F, 0xB1D9, 0x8FA0, 0xDE66, 0x8FA1, 0xDE67, 0x8FA2, 0xDE68, - 0x8FA3, 0xC0B1, 0x8FA4, 0xDE69, 0x8FA5, 0xDE6A, 0x8FA6, 0xDE6B, - 0x8FA7, 0xDE6C, 0x8FA8, 0xB1E6, 0x8FA9, 0xB1E7, 0x8FAA, 0xDE6D, - 0x8FAB, 0xB1E8, 0x8FAC, 0xDE6E, 0x8FAD, 0xDE6F, 0x8FAE, 0xDE70, - 0x8FAF, 0xDE71, 0x8FB0, 0xB3BD, 0x8FB1, 0xC8E8, 0x8FB2, 0xDE72, - 0x8FB3, 0xDE73, 0x8FB4, 0xDE74, 0x8FB5, 0xDE75, 0x8FB6, 0xE5C1, - 0x8FB7, 0xDE76, 0x8FB8, 0xDE77, 0x8FB9, 0xB1DF, 0x8FBA, 0xDE78, - 0x8FBB, 0xDE79, 0x8FBC, 0xDE7A, 0x8FBD, 0xC1C9, 0x8FBE, 0xB4EF, - 0x8FBF, 0xDE7B, 0x8FC0, 0xDE7C, 0x8FC1, 0xC7A8, 0x8FC2, 0xD3D8, - 0x8FC3, 0xDE7D, 0x8FC4, 0xC6F9, 0x8FC5, 0xD1B8, 0x8FC6, 0xDE7E, - 0x8FC7, 0xB9FD, 0x8FC8, 0xC2F5, 0x8FC9, 0xDE80, 0x8FCA, 0xDE81, - 0x8FCB, 0xDE82, 0x8FCC, 0xDE83, 0x8FCD, 0xDE84, 0x8FCE, 0xD3AD, - 0x8FCF, 0xDE85, 0x8FD0, 0xD4CB, 0x8FD1, 0xBDFC, 0x8FD2, 0xDE86, - 0x8FD3, 0xE5C2, 0x8FD4, 0xB7B5, 0x8FD5, 0xE5C3, 0x8FD6, 0xDE87, - 0x8FD7, 0xDE88, 0x8FD8, 0xBBB9, 0x8FD9, 0xD5E2, 0x8FDA, 0xDE89, - 0x8FDB, 0xBDF8, 0x8FDC, 0xD4B6, 0x8FDD, 0xCEA5, 0x8FDE, 0xC1AC, - 0x8FDF, 0xB3D9, 0x8FE0, 0xDE8A, 0x8FE1, 0xDE8B, 0x8FE2, 0xCCF6, - 0x8FE3, 0xDE8C, 0x8FE4, 0xE5C6, 0x8FE5, 0xE5C4, 0x8FE6, 0xE5C8, - 0x8FE7, 0xDE8D, 0x8FE8, 0xE5CA, 0x8FE9, 0xE5C7, 0x8FEA, 0xB5CF, - 0x8FEB, 0xC6C8, 0x8FEC, 0xDE8E, 0x8FED, 0xB5FC, 0x8FEE, 0xE5C5, - 0x8FEF, 0xDE8F, 0x8FF0, 0xCAF6, 0x8FF1, 0xDE90, 0x8FF2, 0xDE91, - 0x8FF3, 0xE5C9, 0x8FF4, 0xDE92, 0x8FF5, 0xDE93, 0x8FF6, 0xDE94, - 0x8FF7, 0xC3D4, 0x8FF8, 0xB1C5, 0x8FF9, 0xBCA3, 0x8FFA, 0xDE95, - 0x8FFB, 0xDE96, 0x8FFC, 0xDE97, 0x8FFD, 0xD7B7, 0x8FFE, 0xDE98, - 0x8FFF, 0xDE99, 0x9000, 0xCDCB, 0x9001, 0xCBCD, 0x9002, 0xCACA, - 0x9003, 0xCCD3, 0x9004, 0xE5CC, 0x9005, 0xE5CB, 0x9006, 0xC4E6, - 0x9007, 0xDE9A, 0x9008, 0xDE9B, 0x9009, 0xD1A1, 0x900A, 0xD1B7, - 0x900B, 0xE5CD, 0x900C, 0xDE9C, 0x900D, 0xE5D0, 0x900E, 0xDE9D, - 0x900F, 0xCDB8, 0x9010, 0xD6F0, 0x9011, 0xE5CF, 0x9012, 0xB5DD, - 0x9013, 0xDE9E, 0x9014, 0xCDBE, 0x9015, 0xDE9F, 0x9016, 0xE5D1, - 0x9017, 0xB6BA, 0x9018, 0xDEA0, 0x9019, 0xDF40, 0x901A, 0xCDA8, - 0x901B, 0xB9E4, 0x901C, 0xDF41, 0x901D, 0xCAC5, 0x901E, 0xB3D1, - 0x901F, 0xCBD9, 0x9020, 0xD4EC, 0x9021, 0xE5D2, 0x9022, 0xB7EA, - 0x9023, 0xDF42, 0x9024, 0xDF43, 0x9025, 0xDF44, 0x9026, 0xE5CE, - 0x9027, 0xDF45, 0x9028, 0xDF46, 0x9029, 0xDF47, 0x902A, 0xDF48, - 0x902B, 0xDF49, 0x902C, 0xDF4A, 0x902D, 0xE5D5, 0x902E, 0xB4FE, - 0x902F, 0xE5D6, 0x9030, 0xDF4B, 0x9031, 0xDF4C, 0x9032, 0xDF4D, - 0x9033, 0xDF4E, 0x9034, 0xDF4F, 0x9035, 0xE5D3, 0x9036, 0xE5D4, - 0x9037, 0xDF50, 0x9038, 0xD2DD, 0x9039, 0xDF51, 0x903A, 0xDF52, - 0x903B, 0xC2DF, 0x903C, 0xB1C6, 0x903D, 0xDF53, 0x903E, 0xD3E2, - 0x903F, 0xDF54, 0x9040, 0xDF55, 0x9041, 0xB6DD, 0x9042, 0xCBEC, - 0x9043, 0xDF56, 0x9044, 0xE5D7, 0x9045, 0xDF57, 0x9046, 0xDF58, - 0x9047, 0xD3F6, 0x9048, 0xDF59, 0x9049, 0xDF5A, 0x904A, 0xDF5B, - 0x904B, 0xDF5C, 0x904C, 0xDF5D, 0x904D, 0xB1E9, 0x904E, 0xDF5E, - 0x904F, 0xB6F4, 0x9050, 0xE5DA, 0x9051, 0xE5D8, 0x9052, 0xE5D9, - 0x9053, 0xB5C0, 0x9054, 0xDF5F, 0x9055, 0xDF60, 0x9056, 0xDF61, - 0x9057, 0xD2C5, 0x9058, 0xE5DC, 0x9059, 0xDF62, 0x905A, 0xDF63, - 0x905B, 0xE5DE, 0x905C, 0xDF64, 0x905D, 0xDF65, 0x905E, 0xDF66, - 0x905F, 0xDF67, 0x9060, 0xDF68, 0x9061, 0xDF69, 0x9062, 0xE5DD, - 0x9063, 0xC7B2, 0x9064, 0xDF6A, 0x9065, 0xD2A3, 0x9066, 0xDF6B, - 0x9067, 0xDF6C, 0x9068, 0xE5DB, 0x9069, 0xDF6D, 0x906A, 0xDF6E, - 0x906B, 0xDF6F, 0x906C, 0xDF70, 0x906D, 0xD4E2, 0x906E, 0xD5DA, - 0x906F, 0xDF71, 0x9070, 0xDF72, 0x9071, 0xDF73, 0x9072, 0xDF74, - 0x9073, 0xDF75, 0x9074, 0xE5E0, 0x9075, 0xD7F1, 0x9076, 0xDF76, - 0x9077, 0xDF77, 0x9078, 0xDF78, 0x9079, 0xDF79, 0x907A, 0xDF7A, - 0x907B, 0xDF7B, 0x907C, 0xDF7C, 0x907D, 0xE5E1, 0x907E, 0xDF7D, - 0x907F, 0xB1DC, 0x9080, 0xD1FB, 0x9081, 0xDF7E, 0x9082, 0xE5E2, - 0x9083, 0xE5E4, 0x9084, 0xDF80, 0x9085, 0xDF81, 0x9086, 0xDF82, - 0x9087, 0xDF83, 0x9088, 0xE5E3, 0x9089, 0xDF84, 0x908A, 0xDF85, - 0x908B, 0xE5E5, 0x908C, 0xDF86, 0x908D, 0xDF87, 0x908E, 0xDF88, - 0x908F, 0xDF89, 0x9090, 0xDF8A, 0x9091, 0xD2D8, 0x9092, 0xDF8B, - 0x9093, 0xB5CB, 0x9094, 0xDF8C, 0x9095, 0xE7DF, 0x9096, 0xDF8D, - 0x9097, 0xDAF5, 0x9098, 0xDF8E, 0x9099, 0xDAF8, 0x909A, 0xDF8F, - 0x909B, 0xDAF6, 0x909C, 0xDF90, 0x909D, 0xDAF7, 0x909E, 0xDF91, - 0x909F, 0xDF92, 0x90A0, 0xDF93, 0x90A1, 0xDAFA, 0x90A2, 0xD0CF, - 0x90A3, 0xC4C7, 0x90A4, 0xDF94, 0x90A5, 0xDF95, 0x90A6, 0xB0EE, - 0x90A7, 0xDF96, 0x90A8, 0xDF97, 0x90A9, 0xDF98, 0x90AA, 0xD0B0, - 0x90AB, 0xDF99, 0x90AC, 0xDAF9, 0x90AD, 0xDF9A, 0x90AE, 0xD3CA, - 0x90AF, 0xBAAA, 0x90B0, 0xDBA2, 0x90B1, 0xC7F1, 0x90B2, 0xDF9B, - 0x90B3, 0xDAFC, 0x90B4, 0xDAFB, 0x90B5, 0xC9DB, 0x90B6, 0xDAFD, - 0x90B7, 0xDF9C, 0x90B8, 0xDBA1, 0x90B9, 0xD7DE, 0x90BA, 0xDAFE, - 0x90BB, 0xC1DA, 0x90BC, 0xDF9D, 0x90BD, 0xDF9E, 0x90BE, 0xDBA5, - 0x90BF, 0xDF9F, 0x90C0, 0xDFA0, 0x90C1, 0xD3F4, 0x90C2, 0xE040, - 0x90C3, 0xE041, 0x90C4, 0xDBA7, 0x90C5, 0xDBA4, 0x90C6, 0xE042, - 0x90C7, 0xDBA8, 0x90C8, 0xE043, 0x90C9, 0xE044, 0x90CA, 0xBDBC, - 0x90CB, 0xE045, 0x90CC, 0xE046, 0x90CD, 0xE047, 0x90CE, 0xC0C9, - 0x90CF, 0xDBA3, 0x90D0, 0xDBA6, 0x90D1, 0xD6A3, 0x90D2, 0xE048, - 0x90D3, 0xDBA9, 0x90D4, 0xE049, 0x90D5, 0xE04A, 0x90D6, 0xE04B, - 0x90D7, 0xDBAD, 0x90D8, 0xE04C, 0x90D9, 0xE04D, 0x90DA, 0xE04E, - 0x90DB, 0xDBAE, 0x90DC, 0xDBAC, 0x90DD, 0xBAC2, 0x90DE, 0xE04F, - 0x90DF, 0xE050, 0x90E0, 0xE051, 0x90E1, 0xBFA4, 0x90E2, 0xDBAB, - 0x90E3, 0xE052, 0x90E4, 0xE053, 0x90E5, 0xE054, 0x90E6, 0xDBAA, - 0x90E7, 0xD4C7, 0x90E8, 0xB2BF, 0x90E9, 0xE055, 0x90EA, 0xE056, - 0x90EB, 0xDBAF, 0x90EC, 0xE057, 0x90ED, 0xB9F9, 0x90EE, 0xE058, - 0x90EF, 0xDBB0, 0x90F0, 0xE059, 0x90F1, 0xE05A, 0x90F2, 0xE05B, - 0x90F3, 0xE05C, 0x90F4, 0xB3BB, 0x90F5, 0xE05D, 0x90F6, 0xE05E, - 0x90F7, 0xE05F, 0x90F8, 0xB5A6, 0x90F9, 0xE060, 0x90FA, 0xE061, - 0x90FB, 0xE062, 0x90FC, 0xE063, 0x90FD, 0xB6BC, 0x90FE, 0xDBB1, - 0x90FF, 0xE064, 0x9100, 0xE065, 0x9101, 0xE066, 0x9102, 0xB6F5, - 0x9103, 0xE067, 0x9104, 0xDBB2, 0x9105, 0xE068, 0x9106, 0xE069, - 0x9107, 0xE06A, 0x9108, 0xE06B, 0x9109, 0xE06C, 0x910A, 0xE06D, - 0x910B, 0xE06E, 0x910C, 0xE06F, 0x910D, 0xE070, 0x910E, 0xE071, - 0x910F, 0xE072, 0x9110, 0xE073, 0x9111, 0xE074, 0x9112, 0xE075, - 0x9113, 0xE076, 0x9114, 0xE077, 0x9115, 0xE078, 0x9116, 0xE079, - 0x9117, 0xE07A, 0x9118, 0xE07B, 0x9119, 0xB1C9, 0x911A, 0xE07C, - 0x911B, 0xE07D, 0x911C, 0xE07E, 0x911D, 0xE080, 0x911E, 0xDBB4, - 0x911F, 0xE081, 0x9120, 0xE082, 0x9121, 0xE083, 0x9122, 0xDBB3, - 0x9123, 0xDBB5, 0x9124, 0xE084, 0x9125, 0xE085, 0x9126, 0xE086, - 0x9127, 0xE087, 0x9128, 0xE088, 0x9129, 0xE089, 0x912A, 0xE08A, - 0x912B, 0xE08B, 0x912C, 0xE08C, 0x912D, 0xE08D, 0x912E, 0xE08E, - 0x912F, 0xDBB7, 0x9130, 0xE08F, 0x9131, 0xDBB6, 0x9132, 0xE090, - 0x9133, 0xE091, 0x9134, 0xE092, 0x9135, 0xE093, 0x9136, 0xE094, - 0x9137, 0xE095, 0x9138, 0xE096, 0x9139, 0xDBB8, 0x913A, 0xE097, - 0x913B, 0xE098, 0x913C, 0xE099, 0x913D, 0xE09A, 0x913E, 0xE09B, - 0x913F, 0xE09C, 0x9140, 0xE09D, 0x9141, 0xE09E, 0x9142, 0xE09F, - 0x9143, 0xDBB9, 0x9144, 0xE0A0, 0x9145, 0xE140, 0x9146, 0xDBBA, - 0x9147, 0xE141, 0x9148, 0xE142, 0x9149, 0xD3CF, 0x914A, 0xF4FA, - 0x914B, 0xC7F5, 0x914C, 0xD7C3, 0x914D, 0xC5E4, 0x914E, 0xF4FC, - 0x914F, 0xF4FD, 0x9150, 0xF4FB, 0x9151, 0xE143, 0x9152, 0xBEC6, - 0x9153, 0xE144, 0x9154, 0xE145, 0x9155, 0xE146, 0x9156, 0xE147, - 0x9157, 0xD0EF, 0x9158, 0xE148, 0x9159, 0xE149, 0x915A, 0xB7D3, - 0x915B, 0xE14A, 0x915C, 0xE14B, 0x915D, 0xD4CD, 0x915E, 0xCCAA, - 0x915F, 0xE14C, 0x9160, 0xE14D, 0x9161, 0xF5A2, 0x9162, 0xF5A1, - 0x9163, 0xBAA8, 0x9164, 0xF4FE, 0x9165, 0xCBD6, 0x9166, 0xE14E, - 0x9167, 0xE14F, 0x9168, 0xE150, 0x9169, 0xF5A4, 0x916A, 0xC0D2, - 0x916B, 0xE151, 0x916C, 0xB3EA, 0x916D, 0xE152, 0x916E, 0xCDAA, - 0x916F, 0xF5A5, 0x9170, 0xF5A3, 0x9171, 0xBDB4, 0x9172, 0xF5A8, - 0x9173, 0xE153, 0x9174, 0xF5A9, 0x9175, 0xBDCD, 0x9176, 0xC3B8, - 0x9177, 0xBFE1, 0x9178, 0xCBE1, 0x9179, 0xF5AA, 0x917A, 0xE154, - 0x917B, 0xE155, 0x917C, 0xE156, 0x917D, 0xF5A6, 0x917E, 0xF5A7, - 0x917F, 0xC4F0, 0x9180, 0xE157, 0x9181, 0xE158, 0x9182, 0xE159, - 0x9183, 0xE15A, 0x9184, 0xE15B, 0x9185, 0xF5AC, 0x9186, 0xE15C, - 0x9187, 0xB4BC, 0x9188, 0xE15D, 0x9189, 0xD7ED, 0x918A, 0xE15E, - 0x918B, 0xB4D7, 0x918C, 0xF5AB, 0x918D, 0xF5AE, 0x918E, 0xE15F, - 0x918F, 0xE160, 0x9190, 0xF5AD, 0x9191, 0xF5AF, 0x9192, 0xD0D1, - 0x9193, 0xE161, 0x9194, 0xE162, 0x9195, 0xE163, 0x9196, 0xE164, - 0x9197, 0xE165, 0x9198, 0xE166, 0x9199, 0xE167, 0x919A, 0xC3D1, - 0x919B, 0xC8A9, 0x919C, 0xE168, 0x919D, 0xE169, 0x919E, 0xE16A, - 0x919F, 0xE16B, 0x91A0, 0xE16C, 0x91A1, 0xE16D, 0x91A2, 0xF5B0, - 0x91A3, 0xF5B1, 0x91A4, 0xE16E, 0x91A5, 0xE16F, 0x91A6, 0xE170, - 0x91A7, 0xE171, 0x91A8, 0xE172, 0x91A9, 0xE173, 0x91AA, 0xF5B2, - 0x91AB, 0xE174, 0x91AC, 0xE175, 0x91AD, 0xF5B3, 0x91AE, 0xF5B4, - 0x91AF, 0xF5B5, 0x91B0, 0xE176, 0x91B1, 0xE177, 0x91B2, 0xE178, - 0x91B3, 0xE179, 0x91B4, 0xF5B7, 0x91B5, 0xF5B6, 0x91B6, 0xE17A, - 0x91B7, 0xE17B, 0x91B8, 0xE17C, 0x91B9, 0xE17D, 0x91BA, 0xF5B8, - 0x91BB, 0xE17E, 0x91BC, 0xE180, 0x91BD, 0xE181, 0x91BE, 0xE182, - 0x91BF, 0xE183, 0x91C0, 0xE184, 0x91C1, 0xE185, 0x91C2, 0xE186, - 0x91C3, 0xE187, 0x91C4, 0xE188, 0x91C5, 0xE189, 0x91C6, 0xE18A, - 0x91C7, 0xB2C9, 0x91C8, 0xE18B, 0x91C9, 0xD3D4, 0x91CA, 0xCACD, - 0x91CB, 0xE18C, 0x91CC, 0xC0EF, 0x91CD, 0xD6D8, 0x91CE, 0xD2B0, - 0x91CF, 0xC1BF, 0x91D0, 0xE18D, 0x91D1, 0xBDF0, 0x91D2, 0xE18E, - 0x91D3, 0xE18F, 0x91D4, 0xE190, 0x91D5, 0xE191, 0x91D6, 0xE192, - 0x91D7, 0xE193, 0x91D8, 0xE194, 0x91D9, 0xE195, 0x91DA, 0xE196, - 0x91DB, 0xE197, 0x91DC, 0xB8AA, 0x91DD, 0xE198, 0x91DE, 0xE199, - 0x91DF, 0xE19A, 0x91E0, 0xE19B, 0x91E1, 0xE19C, 0x91E2, 0xE19D, - 0x91E3, 0xE19E, 0x91E4, 0xE19F, 0x91E5, 0xE1A0, 0x91E6, 0xE240, - 0x91E7, 0xE241, 0x91E8, 0xE242, 0x91E9, 0xE243, 0x91EA, 0xE244, - 0x91EB, 0xE245, 0x91EC, 0xE246, 0x91ED, 0xE247, 0x91EE, 0xE248, - 0x91EF, 0xE249, 0x91F0, 0xE24A, 0x91F1, 0xE24B, 0x91F2, 0xE24C, - 0x91F3, 0xE24D, 0x91F4, 0xE24E, 0x91F5, 0xE24F, 0x91F6, 0xE250, - 0x91F7, 0xE251, 0x91F8, 0xE252, 0x91F9, 0xE253, 0x91FA, 0xE254, - 0x91FB, 0xE255, 0x91FC, 0xE256, 0x91FD, 0xE257, 0x91FE, 0xE258, - 0x91FF, 0xE259, 0x9200, 0xE25A, 0x9201, 0xE25B, 0x9202, 0xE25C, - 0x9203, 0xE25D, 0x9204, 0xE25E, 0x9205, 0xE25F, 0x9206, 0xE260, - 0x9207, 0xE261, 0x9208, 0xE262, 0x9209, 0xE263, 0x920A, 0xE264, - 0x920B, 0xE265, 0x920C, 0xE266, 0x920D, 0xE267, 0x920E, 0xE268, - 0x920F, 0xE269, 0x9210, 0xE26A, 0x9211, 0xE26B, 0x9212, 0xE26C, - 0x9213, 0xE26D, 0x9214, 0xE26E, 0x9215, 0xE26F, 0x9216, 0xE270, - 0x9217, 0xE271, 0x9218, 0xE272, 0x9219, 0xE273, 0x921A, 0xE274, - 0x921B, 0xE275, 0x921C, 0xE276, 0x921D, 0xE277, 0x921E, 0xE278, - 0x921F, 0xE279, 0x9220, 0xE27A, 0x9221, 0xE27B, 0x9222, 0xE27C, - 0x9223, 0xE27D, 0x9224, 0xE27E, 0x9225, 0xE280, 0x9226, 0xE281, - 0x9227, 0xE282, 0x9228, 0xE283, 0x9229, 0xE284, 0x922A, 0xE285, - 0x922B, 0xE286, 0x922C, 0xE287, 0x922D, 0xE288, 0x922E, 0xE289, - 0x922F, 0xE28A, 0x9230, 0xE28B, 0x9231, 0xE28C, 0x9232, 0xE28D, - 0x9233, 0xE28E, 0x9234, 0xE28F, 0x9235, 0xE290, 0x9236, 0xE291, - 0x9237, 0xE292, 0x9238, 0xE293, 0x9239, 0xE294, 0x923A, 0xE295, - 0x923B, 0xE296, 0x923C, 0xE297, 0x923D, 0xE298, 0x923E, 0xE299, - 0x923F, 0xE29A, 0x9240, 0xE29B, 0x9241, 0xE29C, 0x9242, 0xE29D, - 0x9243, 0xE29E, 0x9244, 0xE29F, 0x9245, 0xE2A0, 0x9246, 0xE340, - 0x9247, 0xE341, 0x9248, 0xE342, 0x9249, 0xE343, 0x924A, 0xE344, - 0x924B, 0xE345, 0x924C, 0xE346, 0x924D, 0xE347, 0x924E, 0xE348, - 0x924F, 0xE349, 0x9250, 0xE34A, 0x9251, 0xE34B, 0x9252, 0xE34C, - 0x9253, 0xE34D, 0x9254, 0xE34E, 0x9255, 0xE34F, 0x9256, 0xE350, - 0x9257, 0xE351, 0x9258, 0xE352, 0x9259, 0xE353, 0x925A, 0xE354, - 0x925B, 0xE355, 0x925C, 0xE356, 0x925D, 0xE357, 0x925E, 0xE358, - 0x925F, 0xE359, 0x9260, 0xE35A, 0x9261, 0xE35B, 0x9262, 0xE35C, - 0x9263, 0xE35D, 0x9264, 0xE35E, 0x9265, 0xE35F, 0x9266, 0xE360, - 0x9267, 0xE361, 0x9268, 0xE362, 0x9269, 0xE363, 0x926A, 0xE364, - 0x926B, 0xE365, 0x926C, 0xE366, 0x926D, 0xE367, 0x926E, 0xE368, - 0x926F, 0xE369, 0x9270, 0xE36A, 0x9271, 0xE36B, 0x9272, 0xE36C, - 0x9273, 0xE36D, 0x9274, 0xBCF8, 0x9275, 0xE36E, 0x9276, 0xE36F, - 0x9277, 0xE370, 0x9278, 0xE371, 0x9279, 0xE372, 0x927A, 0xE373, - 0x927B, 0xE374, 0x927C, 0xE375, 0x927D, 0xE376, 0x927E, 0xE377, - 0x927F, 0xE378, 0x9280, 0xE379, 0x9281, 0xE37A, 0x9282, 0xE37B, - 0x9283, 0xE37C, 0x9284, 0xE37D, 0x9285, 0xE37E, 0x9286, 0xE380, - 0x9287, 0xE381, 0x9288, 0xE382, 0x9289, 0xE383, 0x928A, 0xE384, - 0x928B, 0xE385, 0x928C, 0xE386, 0x928D, 0xE387, 0x928E, 0xF6C6, - 0x928F, 0xE388, 0x9290, 0xE389, 0x9291, 0xE38A, 0x9292, 0xE38B, - 0x9293, 0xE38C, 0x9294, 0xE38D, 0x9295, 0xE38E, 0x9296, 0xE38F, - 0x9297, 0xE390, 0x9298, 0xE391, 0x9299, 0xE392, 0x929A, 0xE393, - 0x929B, 0xE394, 0x929C, 0xE395, 0x929D, 0xE396, 0x929E, 0xE397, - 0x929F, 0xE398, 0x92A0, 0xE399, 0x92A1, 0xE39A, 0x92A2, 0xE39B, - 0x92A3, 0xE39C, 0x92A4, 0xE39D, 0x92A5, 0xE39E, 0x92A6, 0xE39F, - 0x92A7, 0xE3A0, 0x92A8, 0xE440, 0x92A9, 0xE441, 0x92AA, 0xE442, - 0x92AB, 0xE443, 0x92AC, 0xE444, 0x92AD, 0xE445, 0x92AE, 0xF6C7, - 0x92AF, 0xE446, 0x92B0, 0xE447, 0x92B1, 0xE448, 0x92B2, 0xE449, - 0x92B3, 0xE44A, 0x92B4, 0xE44B, 0x92B5, 0xE44C, 0x92B6, 0xE44D, - 0x92B7, 0xE44E, 0x92B8, 0xE44F, 0x92B9, 0xE450, 0x92BA, 0xE451, - 0x92BB, 0xE452, 0x92BC, 0xE453, 0x92BD, 0xE454, 0x92BE, 0xE455, - 0x92BF, 0xE456, 0x92C0, 0xE457, 0x92C1, 0xE458, 0x92C2, 0xE459, - 0x92C3, 0xE45A, 0x92C4, 0xE45B, 0x92C5, 0xE45C, 0x92C6, 0xE45D, - 0x92C7, 0xE45E, 0x92C8, 0xF6C8, 0x92C9, 0xE45F, 0x92CA, 0xE460, - 0x92CB, 0xE461, 0x92CC, 0xE462, 0x92CD, 0xE463, 0x92CE, 0xE464, - 0x92CF, 0xE465, 0x92D0, 0xE466, 0x92D1, 0xE467, 0x92D2, 0xE468, - 0x92D3, 0xE469, 0x92D4, 0xE46A, 0x92D5, 0xE46B, 0x92D6, 0xE46C, - 0x92D7, 0xE46D, 0x92D8, 0xE46E, 0x92D9, 0xE46F, 0x92DA, 0xE470, - 0x92DB, 0xE471, 0x92DC, 0xE472, 0x92DD, 0xE473, 0x92DE, 0xE474, - 0x92DF, 0xE475, 0x92E0, 0xE476, 0x92E1, 0xE477, 0x92E2, 0xE478, - 0x92E3, 0xE479, 0x92E4, 0xE47A, 0x92E5, 0xE47B, 0x92E6, 0xE47C, - 0x92E7, 0xE47D, 0x92E8, 0xE47E, 0x92E9, 0xE480, 0x92EA, 0xE481, - 0x92EB, 0xE482, 0x92EC, 0xE483, 0x92ED, 0xE484, 0x92EE, 0xE485, - 0x92EF, 0xE486, 0x92F0, 0xE487, 0x92F1, 0xE488, 0x92F2, 0xE489, - 0x92F3, 0xE48A, 0x92F4, 0xE48B, 0x92F5, 0xE48C, 0x92F6, 0xE48D, - 0x92F7, 0xE48E, 0x92F8, 0xE48F, 0x92F9, 0xE490, 0x92FA, 0xE491, - 0x92FB, 0xE492, 0x92FC, 0xE493, 0x92FD, 0xE494, 0x92FE, 0xE495, - 0x92FF, 0xE496, 0x9300, 0xE497, 0x9301, 0xE498, 0x9302, 0xE499, - 0x9303, 0xE49A, 0x9304, 0xE49B, 0x9305, 0xE49C, 0x9306, 0xE49D, - 0x9307, 0xE49E, 0x9308, 0xE49F, 0x9309, 0xE4A0, 0x930A, 0xE540, - 0x930B, 0xE541, 0x930C, 0xE542, 0x930D, 0xE543, 0x930E, 0xE544, - 0x930F, 0xE545, 0x9310, 0xE546, 0x9311, 0xE547, 0x9312, 0xE548, - 0x9313, 0xE549, 0x9314, 0xE54A, 0x9315, 0xE54B, 0x9316, 0xE54C, - 0x9317, 0xE54D, 0x9318, 0xE54E, 0x9319, 0xE54F, 0x931A, 0xE550, - 0x931B, 0xE551, 0x931C, 0xE552, 0x931D, 0xE553, 0x931E, 0xE554, - 0x931F, 0xE555, 0x9320, 0xE556, 0x9321, 0xE557, 0x9322, 0xE558, - 0x9323, 0xE559, 0x9324, 0xE55A, 0x9325, 0xE55B, 0x9326, 0xE55C, - 0x9327, 0xE55D, 0x9328, 0xE55E, 0x9329, 0xE55F, 0x932A, 0xE560, - 0x932B, 0xE561, 0x932C, 0xE562, 0x932D, 0xE563, 0x932E, 0xE564, - 0x932F, 0xE565, 0x9330, 0xE566, 0x9331, 0xE567, 0x9332, 0xE568, - 0x9333, 0xE569, 0x9334, 0xE56A, 0x9335, 0xE56B, 0x9336, 0xE56C, - 0x9337, 0xE56D, 0x9338, 0xE56E, 0x9339, 0xE56F, 0x933A, 0xE570, - 0x933B, 0xE571, 0x933C, 0xE572, 0x933D, 0xE573, 0x933E, 0xF6C9, - 0x933F, 0xE574, 0x9340, 0xE575, 0x9341, 0xE576, 0x9342, 0xE577, - 0x9343, 0xE578, 0x9344, 0xE579, 0x9345, 0xE57A, 0x9346, 0xE57B, - 0x9347, 0xE57C, 0x9348, 0xE57D, 0x9349, 0xE57E, 0x934A, 0xE580, - 0x934B, 0xE581, 0x934C, 0xE582, 0x934D, 0xE583, 0x934E, 0xE584, - 0x934F, 0xE585, 0x9350, 0xE586, 0x9351, 0xE587, 0x9352, 0xE588, - 0x9353, 0xE589, 0x9354, 0xE58A, 0x9355, 0xE58B, 0x9356, 0xE58C, - 0x9357, 0xE58D, 0x9358, 0xE58E, 0x9359, 0xE58F, 0x935A, 0xE590, - 0x935B, 0xE591, 0x935C, 0xE592, 0x935D, 0xE593, 0x935E, 0xE594, - 0x935F, 0xE595, 0x9360, 0xE596, 0x9361, 0xE597, 0x9362, 0xE598, - 0x9363, 0xE599, 0x9364, 0xE59A, 0x9365, 0xE59B, 0x9366, 0xE59C, - 0x9367, 0xE59D, 0x9368, 0xE59E, 0x9369, 0xE59F, 0x936A, 0xF6CA, - 0x936B, 0xE5A0, 0x936C, 0xE640, 0x936D, 0xE641, 0x936E, 0xE642, - 0x936F, 0xE643, 0x9370, 0xE644, 0x9371, 0xE645, 0x9372, 0xE646, - 0x9373, 0xE647, 0x9374, 0xE648, 0x9375, 0xE649, 0x9376, 0xE64A, - 0x9377, 0xE64B, 0x9378, 0xE64C, 0x9379, 0xE64D, 0x937A, 0xE64E, - 0x937B, 0xE64F, 0x937C, 0xE650, 0x937D, 0xE651, 0x937E, 0xE652, - 0x937F, 0xE653, 0x9380, 0xE654, 0x9381, 0xE655, 0x9382, 0xE656, - 0x9383, 0xE657, 0x9384, 0xE658, 0x9385, 0xE659, 0x9386, 0xE65A, - 0x9387, 0xE65B, 0x9388, 0xE65C, 0x9389, 0xE65D, 0x938A, 0xE65E, - 0x938B, 0xE65F, 0x938C, 0xE660, 0x938D, 0xE661, 0x938E, 0xE662, - 0x938F, 0xF6CC, 0x9390, 0xE663, 0x9391, 0xE664, 0x9392, 0xE665, - 0x9393, 0xE666, 0x9394, 0xE667, 0x9395, 0xE668, 0x9396, 0xE669, - 0x9397, 0xE66A, 0x9398, 0xE66B, 0x9399, 0xE66C, 0x939A, 0xE66D, - 0x939B, 0xE66E, 0x939C, 0xE66F, 0x939D, 0xE670, 0x939E, 0xE671, - 0x939F, 0xE672, 0x93A0, 0xE673, 0x93A1, 0xE674, 0x93A2, 0xE675, - 0x93A3, 0xE676, 0x93A4, 0xE677, 0x93A5, 0xE678, 0x93A6, 0xE679, - 0x93A7, 0xE67A, 0x93A8, 0xE67B, 0x93A9, 0xE67C, 0x93AA, 0xE67D, - 0x93AB, 0xE67E, 0x93AC, 0xE680, 0x93AD, 0xE681, 0x93AE, 0xE682, - 0x93AF, 0xE683, 0x93B0, 0xE684, 0x93B1, 0xE685, 0x93B2, 0xE686, - 0x93B3, 0xE687, 0x93B4, 0xE688, 0x93B5, 0xE689, 0x93B6, 0xE68A, - 0x93B7, 0xE68B, 0x93B8, 0xE68C, 0x93B9, 0xE68D, 0x93BA, 0xE68E, - 0x93BB, 0xE68F, 0x93BC, 0xE690, 0x93BD, 0xE691, 0x93BE, 0xE692, - 0x93BF, 0xE693, 0x93C0, 0xE694, 0x93C1, 0xE695, 0x93C2, 0xE696, - 0x93C3, 0xE697, 0x93C4, 0xE698, 0x93C5, 0xE699, 0x93C6, 0xE69A, - 0x93C7, 0xE69B, 0x93C8, 0xE69C, 0x93C9, 0xE69D, 0x93CA, 0xF6CB, - 0x93CB, 0xE69E, 0x93CC, 0xE69F, 0x93CD, 0xE6A0, 0x93CE, 0xE740, - 0x93CF, 0xE741, 0x93D0, 0xE742, 0x93D1, 0xE743, 0x93D2, 0xE744, - 0x93D3, 0xE745, 0x93D4, 0xE746, 0x93D5, 0xE747, 0x93D6, 0xF7E9, - 0x93D7, 0xE748, 0x93D8, 0xE749, 0x93D9, 0xE74A, 0x93DA, 0xE74B, - 0x93DB, 0xE74C, 0x93DC, 0xE74D, 0x93DD, 0xE74E, 0x93DE, 0xE74F, - 0x93DF, 0xE750, 0x93E0, 0xE751, 0x93E1, 0xE752, 0x93E2, 0xE753, - 0x93E3, 0xE754, 0x93E4, 0xE755, 0x93E5, 0xE756, 0x93E6, 0xE757, - 0x93E7, 0xE758, 0x93E8, 0xE759, 0x93E9, 0xE75A, 0x93EA, 0xE75B, - 0x93EB, 0xE75C, 0x93EC, 0xE75D, 0x93ED, 0xE75E, 0x93EE, 0xE75F, - 0x93EF, 0xE760, 0x93F0, 0xE761, 0x93F1, 0xE762, 0x93F2, 0xE763, - 0x93F3, 0xE764, 0x93F4, 0xE765, 0x93F5, 0xE766, 0x93F6, 0xE767, - 0x93F7, 0xE768, 0x93F8, 0xE769, 0x93F9, 0xE76A, 0x93FA, 0xE76B, - 0x93FB, 0xE76C, 0x93FC, 0xE76D, 0x93FD, 0xE76E, 0x93FE, 0xE76F, - 0x93FF, 0xE770, 0x9400, 0xE771, 0x9401, 0xE772, 0x9402, 0xE773, - 0x9403, 0xE774, 0x9404, 0xE775, 0x9405, 0xE776, 0x9406, 0xE777, - 0x9407, 0xE778, 0x9408, 0xE779, 0x9409, 0xE77A, 0x940A, 0xE77B, - 0x940B, 0xE77C, 0x940C, 0xE77D, 0x940D, 0xE77E, 0x940E, 0xE780, - 0x940F, 0xE781, 0x9410, 0xE782, 0x9411, 0xE783, 0x9412, 0xE784, - 0x9413, 0xE785, 0x9414, 0xE786, 0x9415, 0xE787, 0x9416, 0xE788, - 0x9417, 0xE789, 0x9418, 0xE78A, 0x9419, 0xE78B, 0x941A, 0xE78C, - 0x941B, 0xE78D, 0x941C, 0xE78E, 0x941D, 0xE78F, 0x941E, 0xE790, - 0x941F, 0xE791, 0x9420, 0xE792, 0x9421, 0xE793, 0x9422, 0xE794, - 0x9423, 0xE795, 0x9424, 0xE796, 0x9425, 0xE797, 0x9426, 0xE798, - 0x9427, 0xE799, 0x9428, 0xE79A, 0x9429, 0xE79B, 0x942A, 0xE79C, - 0x942B, 0xE79D, 0x942C, 0xE79E, 0x942D, 0xE79F, 0x942E, 0xE7A0, - 0x942F, 0xE840, 0x9430, 0xE841, 0x9431, 0xE842, 0x9432, 0xE843, - 0x9433, 0xE844, 0x9434, 0xE845, 0x9435, 0xE846, 0x9436, 0xE847, - 0x9437, 0xE848, 0x9438, 0xE849, 0x9439, 0xE84A, 0x943A, 0xE84B, - 0x943B, 0xE84C, 0x943C, 0xE84D, 0x943D, 0xE84E, 0x943E, 0xF6CD, - 0x943F, 0xE84F, 0x9440, 0xE850, 0x9441, 0xE851, 0x9442, 0xE852, - 0x9443, 0xE853, 0x9444, 0xE854, 0x9445, 0xE855, 0x9446, 0xE856, - 0x9447, 0xE857, 0x9448, 0xE858, 0x9449, 0xE859, 0x944A, 0xE85A, - 0x944B, 0xE85B, 0x944C, 0xE85C, 0x944D, 0xE85D, 0x944E, 0xE85E, - 0x944F, 0xE85F, 0x9450, 0xE860, 0x9451, 0xE861, 0x9452, 0xE862, - 0x9453, 0xE863, 0x9454, 0xE864, 0x9455, 0xE865, 0x9456, 0xE866, - 0x9457, 0xE867, 0x9458, 0xE868, 0x9459, 0xE869, 0x945A, 0xE86A, - 0x945B, 0xE86B, 0x945C, 0xE86C, 0x945D, 0xE86D, 0x945E, 0xE86E, - 0x945F, 0xE86F, 0x9460, 0xE870, 0x9461, 0xE871, 0x9462, 0xE872, - 0x9463, 0xE873, 0x9464, 0xE874, 0x9465, 0xE875, 0x9466, 0xE876, - 0x9467, 0xE877, 0x9468, 0xE878, 0x9469, 0xE879, 0x946A, 0xE87A, - 0x946B, 0xF6CE, 0x946C, 0xE87B, 0x946D, 0xE87C, 0x946E, 0xE87D, - 0x946F, 0xE87E, 0x9470, 0xE880, 0x9471, 0xE881, 0x9472, 0xE882, - 0x9473, 0xE883, 0x9474, 0xE884, 0x9475, 0xE885, 0x9476, 0xE886, - 0x9477, 0xE887, 0x9478, 0xE888, 0x9479, 0xE889, 0x947A, 0xE88A, - 0x947B, 0xE88B, 0x947C, 0xE88C, 0x947D, 0xE88D, 0x947E, 0xE88E, - 0x947F, 0xE88F, 0x9480, 0xE890, 0x9481, 0xE891, 0x9482, 0xE892, - 0x9483, 0xE893, 0x9484, 0xE894, 0x9485, 0xEEC4, 0x9486, 0xEEC5, - 0x9487, 0xEEC6, 0x9488, 0xD5EB, 0x9489, 0xB6A4, 0x948A, 0xEEC8, - 0x948B, 0xEEC7, 0x948C, 0xEEC9, 0x948D, 0xEECA, 0x948E, 0xC7A5, - 0x948F, 0xEECB, 0x9490, 0xEECC, 0x9491, 0xE895, 0x9492, 0xB7B0, - 0x9493, 0xB5F6, 0x9494, 0xEECD, 0x9495, 0xEECF, 0x9496, 0xE896, - 0x9497, 0xEECE, 0x9498, 0xE897, 0x9499, 0xB8C6, 0x949A, 0xEED0, - 0x949B, 0xEED1, 0x949C, 0xEED2, 0x949D, 0xB6DB, 0x949E, 0xB3AE, - 0x949F, 0xD6D3, 0x94A0, 0xC4C6, 0x94A1, 0xB1B5, 0x94A2, 0xB8D6, - 0x94A3, 0xEED3, 0x94A4, 0xEED4, 0x94A5, 0xD4BF, 0x94A6, 0xC7D5, - 0x94A7, 0xBEFB, 0x94A8, 0xCED9, 0x94A9, 0xB9B3, 0x94AA, 0xEED6, - 0x94AB, 0xEED5, 0x94AC, 0xEED8, 0x94AD, 0xEED7, 0x94AE, 0xC5A5, - 0x94AF, 0xEED9, 0x94B0, 0xEEDA, 0x94B1, 0xC7AE, 0x94B2, 0xEEDB, - 0x94B3, 0xC7AF, 0x94B4, 0xEEDC, 0x94B5, 0xB2A7, 0x94B6, 0xEEDD, - 0x94B7, 0xEEDE, 0x94B8, 0xEEDF, 0x94B9, 0xEEE0, 0x94BA, 0xEEE1, - 0x94BB, 0xD7EA, 0x94BC, 0xEEE2, 0x94BD, 0xEEE3, 0x94BE, 0xBCD8, - 0x94BF, 0xEEE4, 0x94C0, 0xD3CB, 0x94C1, 0xCCFA, 0x94C2, 0xB2AC, - 0x94C3, 0xC1E5, 0x94C4, 0xEEE5, 0x94C5, 0xC7A6, 0x94C6, 0xC3AD, - 0x94C7, 0xE898, 0x94C8, 0xEEE6, 0x94C9, 0xEEE7, 0x94CA, 0xEEE8, - 0x94CB, 0xEEE9, 0x94CC, 0xEEEA, 0x94CD, 0xEEEB, 0x94CE, 0xEEEC, - 0x94CF, 0xE899, 0x94D0, 0xEEED, 0x94D1, 0xEEEE, 0x94D2, 0xEEEF, - 0x94D3, 0xE89A, 0x94D4, 0xE89B, 0x94D5, 0xEEF0, 0x94D6, 0xEEF1, - 0x94D7, 0xEEF2, 0x94D8, 0xEEF4, 0x94D9, 0xEEF3, 0x94DA, 0xE89C, - 0x94DB, 0xEEF5, 0x94DC, 0xCDAD, 0x94DD, 0xC2C1, 0x94DE, 0xEEF6, - 0x94DF, 0xEEF7, 0x94E0, 0xEEF8, 0x94E1, 0xD5A1, 0x94E2, 0xEEF9, - 0x94E3, 0xCFB3, 0x94E4, 0xEEFA, 0x94E5, 0xEEFB, 0x94E6, 0xE89D, - 0x94E7, 0xEEFC, 0x94E8, 0xEEFD, 0x94E9, 0xEFA1, 0x94EA, 0xEEFE, - 0x94EB, 0xEFA2, 0x94EC, 0xB8F5, 0x94ED, 0xC3FA, 0x94EE, 0xEFA3, - 0x94EF, 0xEFA4, 0x94F0, 0xBDC2, 0x94F1, 0xD2BF, 0x94F2, 0xB2F9, - 0x94F3, 0xEFA5, 0x94F4, 0xEFA6, 0x94F5, 0xEFA7, 0x94F6, 0xD2F8, - 0x94F7, 0xEFA8, 0x94F8, 0xD6FD, 0x94F9, 0xEFA9, 0x94FA, 0xC6CC, - 0x94FB, 0xE89E, 0x94FC, 0xEFAA, 0x94FD, 0xEFAB, 0x94FE, 0xC1B4, - 0x94FF, 0xEFAC, 0x9500, 0xCFFA, 0x9501, 0xCBF8, 0x9502, 0xEFAE, - 0x9503, 0xEFAD, 0x9504, 0xB3FA, 0x9505, 0xB9F8, 0x9506, 0xEFAF, - 0x9507, 0xEFB0, 0x9508, 0xD0E2, 0x9509, 0xEFB1, 0x950A, 0xEFB2, - 0x950B, 0xB7E6, 0x950C, 0xD0BF, 0x950D, 0xEFB3, 0x950E, 0xEFB4, - 0x950F, 0xEFB5, 0x9510, 0xC8F1, 0x9511, 0xCCE0, 0x9512, 0xEFB6, - 0x9513, 0xEFB7, 0x9514, 0xEFB8, 0x9515, 0xEFB9, 0x9516, 0xEFBA, - 0x9517, 0xD5E0, 0x9518, 0xEFBB, 0x9519, 0xB4ED, 0x951A, 0xC3AA, - 0x951B, 0xEFBC, 0x951C, 0xE89F, 0x951D, 0xEFBD, 0x951E, 0xEFBE, - 0x951F, 0xEFBF, 0x9520, 0xE8A0, 0x9521, 0xCEFD, 0x9522, 0xEFC0, - 0x9523, 0xC2E0, 0x9524, 0xB4B8, 0x9525, 0xD7B6, 0x9526, 0xBDF5, - 0x9527, 0xE940, 0x9528, 0xCFC7, 0x9529, 0xEFC3, 0x952A, 0xEFC1, - 0x952B, 0xEFC2, 0x952C, 0xEFC4, 0x952D, 0xB6A7, 0x952E, 0xBCFC, - 0x952F, 0xBEE2, 0x9530, 0xC3CC, 0x9531, 0xEFC5, 0x9532, 0xEFC6, - 0x9533, 0xE941, 0x9534, 0xEFC7, 0x9535, 0xEFCF, 0x9536, 0xEFC8, - 0x9537, 0xEFC9, 0x9538, 0xEFCA, 0x9539, 0xC7C2, 0x953A, 0xEFF1, - 0x953B, 0xB6CD, 0x953C, 0xEFCB, 0x953D, 0xE942, 0x953E, 0xEFCC, - 0x953F, 0xEFCD, 0x9540, 0xB6C6, 0x9541, 0xC3BE, 0x9542, 0xEFCE, - 0x9543, 0xE943, 0x9544, 0xEFD0, 0x9545, 0xEFD1, 0x9546, 0xEFD2, - 0x9547, 0xD5F2, 0x9548, 0xE944, 0x9549, 0xEFD3, 0x954A, 0xC4F7, - 0x954B, 0xE945, 0x954C, 0xEFD4, 0x954D, 0xC4F8, 0x954E, 0xEFD5, - 0x954F, 0xEFD6, 0x9550, 0xB8E4, 0x9551, 0xB0F7, 0x9552, 0xEFD7, - 0x9553, 0xEFD8, 0x9554, 0xEFD9, 0x9555, 0xE946, 0x9556, 0xEFDA, - 0x9557, 0xEFDB, 0x9558, 0xEFDC, 0x9559, 0xEFDD, 0x955A, 0xE947, - 0x955B, 0xEFDE, 0x955C, 0xBEB5, 0x955D, 0xEFE1, 0x955E, 0xEFDF, - 0x955F, 0xEFE0, 0x9560, 0xE948, 0x9561, 0xEFE2, 0x9562, 0xEFE3, - 0x9563, 0xC1CD, 0x9564, 0xEFE4, 0x9565, 0xEFE5, 0x9566, 0xEFE6, - 0x9567, 0xEFE7, 0x9568, 0xEFE8, 0x9569, 0xEFE9, 0x956A, 0xEFEA, - 0x956B, 0xEFEB, 0x956C, 0xEFEC, 0x956D, 0xC0D8, 0x956E, 0xE949, - 0x956F, 0xEFED, 0x9570, 0xC1AD, 0x9571, 0xEFEE, 0x9572, 0xEFEF, - 0x9573, 0xEFF0, 0x9574, 0xE94A, 0x9575, 0xE94B, 0x9576, 0xCFE2, - 0x9577, 0xE94C, 0x9578, 0xE94D, 0x9579, 0xE94E, 0x957A, 0xE94F, - 0x957B, 0xE950, 0x957C, 0xE951, 0x957D, 0xE952, 0x957E, 0xE953, - 0x957F, 0xB3A4, 0x9580, 0xE954, 0x9581, 0xE955, 0x9582, 0xE956, - 0x9583, 0xE957, 0x9584, 0xE958, 0x9585, 0xE959, 0x9586, 0xE95A, - 0x9587, 0xE95B, 0x9588, 0xE95C, 0x9589, 0xE95D, 0x958A, 0xE95E, - 0x958B, 0xE95F, 0x958C, 0xE960, 0x958D, 0xE961, 0x958E, 0xE962, - 0x958F, 0xE963, 0x9590, 0xE964, 0x9591, 0xE965, 0x9592, 0xE966, - 0x9593, 0xE967, 0x9594, 0xE968, 0x9595, 0xE969, 0x9596, 0xE96A, - 0x9597, 0xE96B, 0x9598, 0xE96C, 0x9599, 0xE96D, 0x959A, 0xE96E, - 0x959B, 0xE96F, 0x959C, 0xE970, 0x959D, 0xE971, 0x959E, 0xE972, - 0x959F, 0xE973, 0x95A0, 0xE974, 0x95A1, 0xE975, 0x95A2, 0xE976, - 0x95A3, 0xE977, 0x95A4, 0xE978, 0x95A5, 0xE979, 0x95A6, 0xE97A, - 0x95A7, 0xE97B, 0x95A8, 0xE97C, 0x95A9, 0xE97D, 0x95AA, 0xE97E, - 0x95AB, 0xE980, 0x95AC, 0xE981, 0x95AD, 0xE982, 0x95AE, 0xE983, - 0x95AF, 0xE984, 0x95B0, 0xE985, 0x95B1, 0xE986, 0x95B2, 0xE987, - 0x95B3, 0xE988, 0x95B4, 0xE989, 0x95B5, 0xE98A, 0x95B6, 0xE98B, - 0x95B7, 0xE98C, 0x95B8, 0xE98D, 0x95B9, 0xE98E, 0x95BA, 0xE98F, - 0x95BB, 0xE990, 0x95BC, 0xE991, 0x95BD, 0xE992, 0x95BE, 0xE993, - 0x95BF, 0xE994, 0x95C0, 0xE995, 0x95C1, 0xE996, 0x95C2, 0xE997, - 0x95C3, 0xE998, 0x95C4, 0xE999, 0x95C5, 0xE99A, 0x95C6, 0xE99B, - 0x95C7, 0xE99C, 0x95C8, 0xE99D, 0x95C9, 0xE99E, 0x95CA, 0xE99F, - 0x95CB, 0xE9A0, 0x95CC, 0xEA40, 0x95CD, 0xEA41, 0x95CE, 0xEA42, - 0x95CF, 0xEA43, 0x95D0, 0xEA44, 0x95D1, 0xEA45, 0x95D2, 0xEA46, - 0x95D3, 0xEA47, 0x95D4, 0xEA48, 0x95D5, 0xEA49, 0x95D6, 0xEA4A, - 0x95D7, 0xEA4B, 0x95D8, 0xEA4C, 0x95D9, 0xEA4D, 0x95DA, 0xEA4E, - 0x95DB, 0xEA4F, 0x95DC, 0xEA50, 0x95DD, 0xEA51, 0x95DE, 0xEA52, - 0x95DF, 0xEA53, 0x95E0, 0xEA54, 0x95E1, 0xEA55, 0x95E2, 0xEA56, - 0x95E3, 0xEA57, 0x95E4, 0xEA58, 0x95E5, 0xEA59, 0x95E6, 0xEA5A, - 0x95E7, 0xEA5B, 0x95E8, 0xC3C5, 0x95E9, 0xE3C5, 0x95EA, 0xC9C1, - 0x95EB, 0xE3C6, 0x95EC, 0xEA5C, 0x95ED, 0xB1D5, 0x95EE, 0xCECA, - 0x95EF, 0xB4B3, 0x95F0, 0xC8F2, 0x95F1, 0xE3C7, 0x95F2, 0xCFD0, - 0x95F3, 0xE3C8, 0x95F4, 0xBCE4, 0x95F5, 0xE3C9, 0x95F6, 0xE3CA, - 0x95F7, 0xC3C6, 0x95F8, 0xD5A2, 0x95F9, 0xC4D6, 0x95FA, 0xB9EB, - 0x95FB, 0xCEC5, 0x95FC, 0xE3CB, 0x95FD, 0xC3F6, 0x95FE, 0xE3CC, - 0x95FF, 0xEA5D, 0x9600, 0xB7A7, 0x9601, 0xB8F3, 0x9602, 0xBAD2, - 0x9603, 0xE3CD, 0x9604, 0xE3CE, 0x9605, 0xD4C4, 0x9606, 0xE3CF, - 0x9607, 0xEA5E, 0x9608, 0xE3D0, 0x9609, 0xD1CB, 0x960A, 0xE3D1, - 0x960B, 0xE3D2, 0x960C, 0xE3D3, 0x960D, 0xE3D4, 0x960E, 0xD1D6, - 0x960F, 0xE3D5, 0x9610, 0xB2FB, 0x9611, 0xC0BB, 0x9612, 0xE3D6, - 0x9613, 0xEA5F, 0x9614, 0xC0AB, 0x9615, 0xE3D7, 0x9616, 0xE3D8, - 0x9617, 0xE3D9, 0x9618, 0xEA60, 0x9619, 0xE3DA, 0x961A, 0xE3DB, - 0x961B, 0xEA61, 0x961C, 0xB8B7, 0x961D, 0xDAE2, 0x961E, 0xEA62, - 0x961F, 0xB6D3, 0x9620, 0xEA63, 0x9621, 0xDAE4, 0x9622, 0xDAE3, - 0x9623, 0xEA64, 0x9624, 0xEA65, 0x9625, 0xEA66, 0x9626, 0xEA67, - 0x9627, 0xEA68, 0x9628, 0xEA69, 0x9629, 0xEA6A, 0x962A, 0xDAE6, - 0x962B, 0xEA6B, 0x962C, 0xEA6C, 0x962D, 0xEA6D, 0x962E, 0xC8EE, - 0x962F, 0xEA6E, 0x9630, 0xEA6F, 0x9631, 0xDAE5, 0x9632, 0xB7C0, - 0x9633, 0xD1F4, 0x9634, 0xD2F5, 0x9635, 0xD5F3, 0x9636, 0xBDD7, - 0x9637, 0xEA70, 0x9638, 0xEA71, 0x9639, 0xEA72, 0x963A, 0xEA73, - 0x963B, 0xD7E8, 0x963C, 0xDAE8, 0x963D, 0xDAE7, 0x963E, 0xEA74, - 0x963F, 0xB0A2, 0x9640, 0xCDD3, 0x9641, 0xEA75, 0x9642, 0xDAE9, - 0x9643, 0xEA76, 0x9644, 0xB8BD, 0x9645, 0xBCCA, 0x9646, 0xC2BD, - 0x9647, 0xC2A4, 0x9648, 0xB3C2, 0x9649, 0xDAEA, 0x964A, 0xEA77, - 0x964B, 0xC2AA, 0x964C, 0xC4B0, 0x964D, 0xBDB5, 0x964E, 0xEA78, - 0x964F, 0xEA79, 0x9650, 0xCFDE, 0x9651, 0xEA7A, 0x9652, 0xEA7B, - 0x9653, 0xEA7C, 0x9654, 0xDAEB, 0x9655, 0xC9C2, 0x9656, 0xEA7D, - 0x9657, 0xEA7E, 0x9658, 0xEA80, 0x9659, 0xEA81, 0x965A, 0xEA82, - 0x965B, 0xB1DD, 0x965C, 0xEA83, 0x965D, 0xEA84, 0x965E, 0xEA85, - 0x965F, 0xDAEC, 0x9660, 0xEA86, 0x9661, 0xB6B8, 0x9662, 0xD4BA, - 0x9663, 0xEA87, 0x9664, 0xB3FD, 0x9665, 0xEA88, 0x9666, 0xEA89, - 0x9667, 0xDAED, 0x9668, 0xD4C9, 0x9669, 0xCFD5, 0x966A, 0xC5E3, - 0x966B, 0xEA8A, 0x966C, 0xDAEE, 0x966D, 0xEA8B, 0x966E, 0xEA8C, - 0x966F, 0xEA8D, 0x9670, 0xEA8E, 0x9671, 0xEA8F, 0x9672, 0xDAEF, - 0x9673, 0xEA90, 0x9674, 0xDAF0, 0x9675, 0xC1EA, 0x9676, 0xCCD5, - 0x9677, 0xCFDD, 0x9678, 0xEA91, 0x9679, 0xEA92, 0x967A, 0xEA93, - 0x967B, 0xEA94, 0x967C, 0xEA95, 0x967D, 0xEA96, 0x967E, 0xEA97, - 0x967F, 0xEA98, 0x9680, 0xEA99, 0x9681, 0xEA9A, 0x9682, 0xEA9B, - 0x9683, 0xEA9C, 0x9684, 0xEA9D, 0x9685, 0xD3E7, 0x9686, 0xC2A1, - 0x9687, 0xEA9E, 0x9688, 0xDAF1, 0x9689, 0xEA9F, 0x968A, 0xEAA0, - 0x968B, 0xCBE5, 0x968C, 0xEB40, 0x968D, 0xDAF2, 0x968E, 0xEB41, - 0x968F, 0xCBE6, 0x9690, 0xD2FE, 0x9691, 0xEB42, 0x9692, 0xEB43, - 0x9693, 0xEB44, 0x9694, 0xB8F4, 0x9695, 0xEB45, 0x9696, 0xEB46, - 0x9697, 0xDAF3, 0x9698, 0xB0AF, 0x9699, 0xCFB6, 0x969A, 0xEB47, - 0x969B, 0xEB48, 0x969C, 0xD5CF, 0x969D, 0xEB49, 0x969E, 0xEB4A, - 0x969F, 0xEB4B, 0x96A0, 0xEB4C, 0x96A1, 0xEB4D, 0x96A2, 0xEB4E, - 0x96A3, 0xEB4F, 0x96A4, 0xEB50, 0x96A5, 0xEB51, 0x96A6, 0xEB52, - 0x96A7, 0xCBED, 0x96A8, 0xEB53, 0x96A9, 0xEB54, 0x96AA, 0xEB55, - 0x96AB, 0xEB56, 0x96AC, 0xEB57, 0x96AD, 0xEB58, 0x96AE, 0xEB59, - 0x96AF, 0xEB5A, 0x96B0, 0xDAF4, 0x96B1, 0xEB5B, 0x96B2, 0xEB5C, - 0x96B3, 0xE3C4, 0x96B4, 0xEB5D, 0x96B5, 0xEB5E, 0x96B6, 0xC1A5, - 0x96B7, 0xEB5F, 0x96B8, 0xEB60, 0x96B9, 0xF6BF, 0x96BA, 0xEB61, - 0x96BB, 0xEB62, 0x96BC, 0xF6C0, 0x96BD, 0xF6C1, 0x96BE, 0xC4D1, - 0x96BF, 0xEB63, 0x96C0, 0xC8B8, 0x96C1, 0xD1E3, 0x96C2, 0xEB64, - 0x96C3, 0xEB65, 0x96C4, 0xD0DB, 0x96C5, 0xD1C5, 0x96C6, 0xBCAF, - 0x96C7, 0xB9CD, 0x96C8, 0xEB66, 0x96C9, 0xEFF4, 0x96CA, 0xEB67, - 0x96CB, 0xEB68, 0x96CC, 0xB4C6, 0x96CD, 0xD3BA, 0x96CE, 0xF6C2, - 0x96CF, 0xB3FB, 0x96D0, 0xEB69, 0x96D1, 0xEB6A, 0x96D2, 0xF6C3, - 0x96D3, 0xEB6B, 0x96D4, 0xEB6C, 0x96D5, 0xB5F1, 0x96D6, 0xEB6D, - 0x96D7, 0xEB6E, 0x96D8, 0xEB6F, 0x96D9, 0xEB70, 0x96DA, 0xEB71, - 0x96DB, 0xEB72, 0x96DC, 0xEB73, 0x96DD, 0xEB74, 0x96DE, 0xEB75, - 0x96DF, 0xEB76, 0x96E0, 0xF6C5, 0x96E1, 0xEB77, 0x96E2, 0xEB78, - 0x96E3, 0xEB79, 0x96E4, 0xEB7A, 0x96E5, 0xEB7B, 0x96E6, 0xEB7C, - 0x96E7, 0xEB7D, 0x96E8, 0xD3EA, 0x96E9, 0xF6A7, 0x96EA, 0xD1A9, - 0x96EB, 0xEB7E, 0x96EC, 0xEB80, 0x96ED, 0xEB81, 0x96EE, 0xEB82, - 0x96EF, 0xF6A9, 0x96F0, 0xEB83, 0x96F1, 0xEB84, 0x96F2, 0xEB85, - 0x96F3, 0xF6A8, 0x96F4, 0xEB86, 0x96F5, 0xEB87, 0x96F6, 0xC1E3, - 0x96F7, 0xC0D7, 0x96F8, 0xEB88, 0x96F9, 0xB1A2, 0x96FA, 0xEB89, - 0x96FB, 0xEB8A, 0x96FC, 0xEB8B, 0x96FD, 0xEB8C, 0x96FE, 0xCEED, - 0x96FF, 0xEB8D, 0x9700, 0xD0E8, 0x9701, 0xF6AB, 0x9702, 0xEB8E, - 0x9703, 0xEB8F, 0x9704, 0xCFF6, 0x9705, 0xEB90, 0x9706, 0xF6AA, - 0x9707, 0xD5F0, 0x9708, 0xF6AC, 0x9709, 0xC3B9, 0x970A, 0xEB91, - 0x970B, 0xEB92, 0x970C, 0xEB93, 0x970D, 0xBBF4, 0x970E, 0xF6AE, - 0x970F, 0xF6AD, 0x9710, 0xEB94, 0x9711, 0xEB95, 0x9712, 0xEB96, - 0x9713, 0xC4DE, 0x9714, 0xEB97, 0x9715, 0xEB98, 0x9716, 0xC1D8, - 0x9717, 0xEB99, 0x9718, 0xEB9A, 0x9719, 0xEB9B, 0x971A, 0xEB9C, - 0x971B, 0xEB9D, 0x971C, 0xCBAA, 0x971D, 0xEB9E, 0x971E, 0xCFBC, - 0x971F, 0xEB9F, 0x9720, 0xEBA0, 0x9721, 0xEC40, 0x9722, 0xEC41, - 0x9723, 0xEC42, 0x9724, 0xEC43, 0x9725, 0xEC44, 0x9726, 0xEC45, - 0x9727, 0xEC46, 0x9728, 0xEC47, 0x9729, 0xEC48, 0x972A, 0xF6AF, - 0x972B, 0xEC49, 0x972C, 0xEC4A, 0x972D, 0xF6B0, 0x972E, 0xEC4B, - 0x972F, 0xEC4C, 0x9730, 0xF6B1, 0x9731, 0xEC4D, 0x9732, 0xC2B6, - 0x9733, 0xEC4E, 0x9734, 0xEC4F, 0x9735, 0xEC50, 0x9736, 0xEC51, - 0x9737, 0xEC52, 0x9738, 0xB0D4, 0x9739, 0xC5F9, 0x973A, 0xEC53, - 0x973B, 0xEC54, 0x973C, 0xEC55, 0x973D, 0xEC56, 0x973E, 0xF6B2, - 0x973F, 0xEC57, 0x9740, 0xEC58, 0x9741, 0xEC59, 0x9742, 0xEC5A, - 0x9743, 0xEC5B, 0x9744, 0xEC5C, 0x9745, 0xEC5D, 0x9746, 0xEC5E, - 0x9747, 0xEC5F, 0x9748, 0xEC60, 0x9749, 0xEC61, 0x974A, 0xEC62, - 0x974B, 0xEC63, 0x974C, 0xEC64, 0x974D, 0xEC65, 0x974E, 0xEC66, - 0x974F, 0xEC67, 0x9750, 0xEC68, 0x9751, 0xEC69, 0x9752, 0xC7E0, - 0x9753, 0xF6A6, 0x9754, 0xEC6A, 0x9755, 0xEC6B, 0x9756, 0xBEB8, - 0x9757, 0xEC6C, 0x9758, 0xEC6D, 0x9759, 0xBEB2, 0x975A, 0xEC6E, - 0x975B, 0xB5E5, 0x975C, 0xEC6F, 0x975D, 0xEC70, 0x975E, 0xB7C7, - 0x975F, 0xEC71, 0x9760, 0xBFBF, 0x9761, 0xC3D2, 0x9762, 0xC3E6, - 0x9763, 0xEC72, 0x9764, 0xEC73, 0x9765, 0xD8CC, 0x9766, 0xEC74, - 0x9767, 0xEC75, 0x9768, 0xEC76, 0x9769, 0xB8EF, 0x976A, 0xEC77, - 0x976B, 0xEC78, 0x976C, 0xEC79, 0x976D, 0xEC7A, 0x976E, 0xEC7B, - 0x976F, 0xEC7C, 0x9770, 0xEC7D, 0x9771, 0xEC7E, 0x9772, 0xEC80, - 0x9773, 0xBDF9, 0x9774, 0xD1A5, 0x9775, 0xEC81, 0x9776, 0xB0D0, - 0x9777, 0xEC82, 0x9778, 0xEC83, 0x9779, 0xEC84, 0x977A, 0xEC85, - 0x977B, 0xEC86, 0x977C, 0xF7B0, 0x977D, 0xEC87, 0x977E, 0xEC88, - 0x977F, 0xEC89, 0x9780, 0xEC8A, 0x9781, 0xEC8B, 0x9782, 0xEC8C, - 0x9783, 0xEC8D, 0x9784, 0xEC8E, 0x9785, 0xF7B1, 0x9786, 0xEC8F, - 0x9787, 0xEC90, 0x9788, 0xEC91, 0x9789, 0xEC92, 0x978A, 0xEC93, - 0x978B, 0xD0AC, 0x978C, 0xEC94, 0x978D, 0xB0B0, 0x978E, 0xEC95, - 0x978F, 0xEC96, 0x9790, 0xEC97, 0x9791, 0xF7B2, 0x9792, 0xF7B3, - 0x9793, 0xEC98, 0x9794, 0xF7B4, 0x9795, 0xEC99, 0x9796, 0xEC9A, - 0x9797, 0xEC9B, 0x9798, 0xC7CA, 0x9799, 0xEC9C, 0x979A, 0xEC9D, - 0x979B, 0xEC9E, 0x979C, 0xEC9F, 0x979D, 0xECA0, 0x979E, 0xED40, - 0x979F, 0xED41, 0x97A0, 0xBECF, 0x97A1, 0xED42, 0x97A2, 0xED43, - 0x97A3, 0xF7B7, 0x97A4, 0xED44, 0x97A5, 0xED45, 0x97A6, 0xED46, - 0x97A7, 0xED47, 0x97A8, 0xED48, 0x97A9, 0xED49, 0x97AA, 0xED4A, - 0x97AB, 0xF7B6, 0x97AC, 0xED4B, 0x97AD, 0xB1DE, 0x97AE, 0xED4C, - 0x97AF, 0xF7B5, 0x97B0, 0xED4D, 0x97B1, 0xED4E, 0x97B2, 0xF7B8, - 0x97B3, 0xED4F, 0x97B4, 0xF7B9, 0x97B5, 0xED50, 0x97B6, 0xED51, - 0x97B7, 0xED52, 0x97B8, 0xED53, 0x97B9, 0xED54, 0x97BA, 0xED55, - 0x97BB, 0xED56, 0x97BC, 0xED57, 0x97BD, 0xED58, 0x97BE, 0xED59, - 0x97BF, 0xED5A, 0x97C0, 0xED5B, 0x97C1, 0xED5C, 0x97C2, 0xED5D, - 0x97C3, 0xED5E, 0x97C4, 0xED5F, 0x97C5, 0xED60, 0x97C6, 0xED61, - 0x97C7, 0xED62, 0x97C8, 0xED63, 0x97C9, 0xED64, 0x97CA, 0xED65, - 0x97CB, 0xED66, 0x97CC, 0xED67, 0x97CD, 0xED68, 0x97CE, 0xED69, - 0x97CF, 0xED6A, 0x97D0, 0xED6B, 0x97D1, 0xED6C, 0x97D2, 0xED6D, - 0x97D3, 0xED6E, 0x97D4, 0xED6F, 0x97D5, 0xED70, 0x97D6, 0xED71, - 0x97D7, 0xED72, 0x97D8, 0xED73, 0x97D9, 0xED74, 0x97DA, 0xED75, - 0x97DB, 0xED76, 0x97DC, 0xED77, 0x97DD, 0xED78, 0x97DE, 0xED79, - 0x97DF, 0xED7A, 0x97E0, 0xED7B, 0x97E1, 0xED7C, 0x97E2, 0xED7D, - 0x97E3, 0xED7E, 0x97E4, 0xED80, 0x97E5, 0xED81, 0x97E6, 0xCEA4, - 0x97E7, 0xC8CD, 0x97E8, 0xED82, 0x97E9, 0xBAAB, 0x97EA, 0xE8B8, - 0x97EB, 0xE8B9, 0x97EC, 0xE8BA, 0x97ED, 0xBEC2, 0x97EE, 0xED83, - 0x97EF, 0xED84, 0x97F0, 0xED85, 0x97F1, 0xED86, 0x97F2, 0xED87, - 0x97F3, 0xD2F4, 0x97F4, 0xED88, 0x97F5, 0xD4CF, 0x97F6, 0xC9D8, - 0x97F7, 0xED89, 0x97F8, 0xED8A, 0x97F9, 0xED8B, 0x97FA, 0xED8C, - 0x97FB, 0xED8D, 0x97FC, 0xED8E, 0x97FD, 0xED8F, 0x97FE, 0xED90, - 0x97FF, 0xED91, 0x9800, 0xED92, 0x9801, 0xED93, 0x9802, 0xED94, - 0x9803, 0xED95, 0x9804, 0xED96, 0x9805, 0xED97, 0x9806, 0xED98, - 0x9807, 0xED99, 0x9808, 0xED9A, 0x9809, 0xED9B, 0x980A, 0xED9C, - 0x980B, 0xED9D, 0x980C, 0xED9E, 0x980D, 0xED9F, 0x980E, 0xEDA0, - 0x980F, 0xEE40, 0x9810, 0xEE41, 0x9811, 0xEE42, 0x9812, 0xEE43, - 0x9813, 0xEE44, 0x9814, 0xEE45, 0x9815, 0xEE46, 0x9816, 0xEE47, - 0x9817, 0xEE48, 0x9818, 0xEE49, 0x9819, 0xEE4A, 0x981A, 0xEE4B, - 0x981B, 0xEE4C, 0x981C, 0xEE4D, 0x981D, 0xEE4E, 0x981E, 0xEE4F, - 0x981F, 0xEE50, 0x9820, 0xEE51, 0x9821, 0xEE52, 0x9822, 0xEE53, - 0x9823, 0xEE54, 0x9824, 0xEE55, 0x9825, 0xEE56, 0x9826, 0xEE57, - 0x9827, 0xEE58, 0x9828, 0xEE59, 0x9829, 0xEE5A, 0x982A, 0xEE5B, - 0x982B, 0xEE5C, 0x982C, 0xEE5D, 0x982D, 0xEE5E, 0x982E, 0xEE5F, - 0x982F, 0xEE60, 0x9830, 0xEE61, 0x9831, 0xEE62, 0x9832, 0xEE63, - 0x9833, 0xEE64, 0x9834, 0xEE65, 0x9835, 0xEE66, 0x9836, 0xEE67, - 0x9837, 0xEE68, 0x9838, 0xEE69, 0x9839, 0xEE6A, 0x983A, 0xEE6B, - 0x983B, 0xEE6C, 0x983C, 0xEE6D, 0x983D, 0xEE6E, 0x983E, 0xEE6F, - 0x983F, 0xEE70, 0x9840, 0xEE71, 0x9841, 0xEE72, 0x9842, 0xEE73, - 0x9843, 0xEE74, 0x9844, 0xEE75, 0x9845, 0xEE76, 0x9846, 0xEE77, - 0x9847, 0xEE78, 0x9848, 0xEE79, 0x9849, 0xEE7A, 0x984A, 0xEE7B, - 0x984B, 0xEE7C, 0x984C, 0xEE7D, 0x984D, 0xEE7E, 0x984E, 0xEE80, - 0x984F, 0xEE81, 0x9850, 0xEE82, 0x9851, 0xEE83, 0x9852, 0xEE84, - 0x9853, 0xEE85, 0x9854, 0xEE86, 0x9855, 0xEE87, 0x9856, 0xEE88, - 0x9857, 0xEE89, 0x9858, 0xEE8A, 0x9859, 0xEE8B, 0x985A, 0xEE8C, - 0x985B, 0xEE8D, 0x985C, 0xEE8E, 0x985D, 0xEE8F, 0x985E, 0xEE90, - 0x985F, 0xEE91, 0x9860, 0xEE92, 0x9861, 0xEE93, 0x9862, 0xEE94, - 0x9863, 0xEE95, 0x9864, 0xEE96, 0x9865, 0xEE97, 0x9866, 0xEE98, - 0x9867, 0xEE99, 0x9868, 0xEE9A, 0x9869, 0xEE9B, 0x986A, 0xEE9C, - 0x986B, 0xEE9D, 0x986C, 0xEE9E, 0x986D, 0xEE9F, 0x986E, 0xEEA0, - 0x986F, 0xEF40, 0x9870, 0xEF41, 0x9871, 0xEF42, 0x9872, 0xEF43, - 0x9873, 0xEF44, 0x9874, 0xEF45, 0x9875, 0xD2B3, 0x9876, 0xB6A5, - 0x9877, 0xC7EA, 0x9878, 0xF1FC, 0x9879, 0xCFEE, 0x987A, 0xCBB3, - 0x987B, 0xD0EB, 0x987C, 0xE7EF, 0x987D, 0xCDE7, 0x987E, 0xB9CB, - 0x987F, 0xB6D9, 0x9880, 0xF1FD, 0x9881, 0xB0E4, 0x9882, 0xCBCC, - 0x9883, 0xF1FE, 0x9884, 0xD4A4, 0x9885, 0xC2AD, 0x9886, 0xC1EC, - 0x9887, 0xC6C4, 0x9888, 0xBEB1, 0x9889, 0xF2A1, 0x988A, 0xBCD5, - 0x988B, 0xEF46, 0x988C, 0xF2A2, 0x988D, 0xF2A3, 0x988E, 0xEF47, - 0x988F, 0xF2A4, 0x9890, 0xD2C3, 0x9891, 0xC6B5, 0x9892, 0xEF48, - 0x9893, 0xCDC7, 0x9894, 0xF2A5, 0x9895, 0xEF49, 0x9896, 0xD3B1, - 0x9897, 0xBFC5, 0x9898, 0xCCE2, 0x9899, 0xEF4A, 0x989A, 0xF2A6, - 0x989B, 0xF2A7, 0x989C, 0xD1D5, 0x989D, 0xB6EE, 0x989E, 0xF2A8, - 0x989F, 0xF2A9, 0x98A0, 0xB5DF, 0x98A1, 0xF2AA, 0x98A2, 0xF2AB, - 0x98A3, 0xEF4B, 0x98A4, 0xB2FC, 0x98A5, 0xF2AC, 0x98A6, 0xF2AD, - 0x98A7, 0xC8A7, 0x98A8, 0xEF4C, 0x98A9, 0xEF4D, 0x98AA, 0xEF4E, - 0x98AB, 0xEF4F, 0x98AC, 0xEF50, 0x98AD, 0xEF51, 0x98AE, 0xEF52, - 0x98AF, 0xEF53, 0x98B0, 0xEF54, 0x98B1, 0xEF55, 0x98B2, 0xEF56, - 0x98B3, 0xEF57, 0x98B4, 0xEF58, 0x98B5, 0xEF59, 0x98B6, 0xEF5A, - 0x98B7, 0xEF5B, 0x98B8, 0xEF5C, 0x98B9, 0xEF5D, 0x98BA, 0xEF5E, - 0x98BB, 0xEF5F, 0x98BC, 0xEF60, 0x98BD, 0xEF61, 0x98BE, 0xEF62, - 0x98BF, 0xEF63, 0x98C0, 0xEF64, 0x98C1, 0xEF65, 0x98C2, 0xEF66, - 0x98C3, 0xEF67, 0x98C4, 0xEF68, 0x98C5, 0xEF69, 0x98C6, 0xEF6A, - 0x98C7, 0xEF6B, 0x98C8, 0xEF6C, 0x98C9, 0xEF6D, 0x98CA, 0xEF6E, - 0x98CB, 0xEF6F, 0x98CC, 0xEF70, 0x98CD, 0xEF71, 0x98CE, 0xB7E7, - 0x98CF, 0xEF72, 0x98D0, 0xEF73, 0x98D1, 0xECA9, 0x98D2, 0xECAA, - 0x98D3, 0xECAB, 0x98D4, 0xEF74, 0x98D5, 0xECAC, 0x98D6, 0xEF75, - 0x98D7, 0xEF76, 0x98D8, 0xC6AE, 0x98D9, 0xECAD, 0x98DA, 0xECAE, - 0x98DB, 0xEF77, 0x98DC, 0xEF78, 0x98DD, 0xEF79, 0x98DE, 0xB7C9, - 0x98DF, 0xCAB3, 0x98E0, 0xEF7A, 0x98E1, 0xEF7B, 0x98E2, 0xEF7C, - 0x98E3, 0xEF7D, 0x98E4, 0xEF7E, 0x98E5, 0xEF80, 0x98E6, 0xEF81, - 0x98E7, 0xE2B8, 0x98E8, 0xF7CF, 0x98E9, 0xEF82, 0x98EA, 0xEF83, - 0x98EB, 0xEF84, 0x98EC, 0xEF85, 0x98ED, 0xEF86, 0x98EE, 0xEF87, - 0x98EF, 0xEF88, 0x98F0, 0xEF89, 0x98F1, 0xEF8A, 0x98F2, 0xEF8B, - 0x98F3, 0xEF8C, 0x98F4, 0xEF8D, 0x98F5, 0xEF8E, 0x98F6, 0xEF8F, - 0x98F7, 0xEF90, 0x98F8, 0xEF91, 0x98F9, 0xEF92, 0x98FA, 0xEF93, - 0x98FB, 0xEF94, 0x98FC, 0xEF95, 0x98FD, 0xEF96, 0x98FE, 0xEF97, - 0x98FF, 0xEF98, 0x9900, 0xEF99, 0x9901, 0xEF9A, 0x9902, 0xEF9B, - 0x9903, 0xEF9C, 0x9904, 0xEF9D, 0x9905, 0xEF9E, 0x9906, 0xEF9F, - 0x9907, 0xEFA0, 0x9908, 0xF040, 0x9909, 0xF041, 0x990A, 0xF042, - 0x990B, 0xF043, 0x990C, 0xF044, 0x990D, 0xF7D0, 0x990E, 0xF045, - 0x990F, 0xF046, 0x9910, 0xB2CD, 0x9911, 0xF047, 0x9912, 0xF048, - 0x9913, 0xF049, 0x9914, 0xF04A, 0x9915, 0xF04B, 0x9916, 0xF04C, - 0x9917, 0xF04D, 0x9918, 0xF04E, 0x9919, 0xF04F, 0x991A, 0xF050, - 0x991B, 0xF051, 0x991C, 0xF052, 0x991D, 0xF053, 0x991E, 0xF054, - 0x991F, 0xF055, 0x9920, 0xF056, 0x9921, 0xF057, 0x9922, 0xF058, - 0x9923, 0xF059, 0x9924, 0xF05A, 0x9925, 0xF05B, 0x9926, 0xF05C, - 0x9927, 0xF05D, 0x9928, 0xF05E, 0x9929, 0xF05F, 0x992A, 0xF060, - 0x992B, 0xF061, 0x992C, 0xF062, 0x992D, 0xF063, 0x992E, 0xF7D1, - 0x992F, 0xF064, 0x9930, 0xF065, 0x9931, 0xF066, 0x9932, 0xF067, - 0x9933, 0xF068, 0x9934, 0xF069, 0x9935, 0xF06A, 0x9936, 0xF06B, - 0x9937, 0xF06C, 0x9938, 0xF06D, 0x9939, 0xF06E, 0x993A, 0xF06F, - 0x993B, 0xF070, 0x993C, 0xF071, 0x993D, 0xF072, 0x993E, 0xF073, - 0x993F, 0xF074, 0x9940, 0xF075, 0x9941, 0xF076, 0x9942, 0xF077, - 0x9943, 0xF078, 0x9944, 0xF079, 0x9945, 0xF07A, 0x9946, 0xF07B, - 0x9947, 0xF07C, 0x9948, 0xF07D, 0x9949, 0xF07E, 0x994A, 0xF080, - 0x994B, 0xF081, 0x994C, 0xF082, 0x994D, 0xF083, 0x994E, 0xF084, - 0x994F, 0xF085, 0x9950, 0xF086, 0x9951, 0xF087, 0x9952, 0xF088, - 0x9953, 0xF089, 0x9954, 0xF7D3, 0x9955, 0xF7D2, 0x9956, 0xF08A, - 0x9957, 0xF08B, 0x9958, 0xF08C, 0x9959, 0xF08D, 0x995A, 0xF08E, - 0x995B, 0xF08F, 0x995C, 0xF090, 0x995D, 0xF091, 0x995E, 0xF092, - 0x995F, 0xF093, 0x9960, 0xF094, 0x9961, 0xF095, 0x9962, 0xF096, - 0x9963, 0xE2BB, 0x9964, 0xF097, 0x9965, 0xBCA2, 0x9966, 0xF098, - 0x9967, 0xE2BC, 0x9968, 0xE2BD, 0x9969, 0xE2BE, 0x996A, 0xE2BF, - 0x996B, 0xE2C0, 0x996C, 0xE2C1, 0x996D, 0xB7B9, 0x996E, 0xD2FB, - 0x996F, 0xBDA4, 0x9970, 0xCACE, 0x9971, 0xB1A5, 0x9972, 0xCBC7, - 0x9973, 0xF099, 0x9974, 0xE2C2, 0x9975, 0xB6FC, 0x9976, 0xC8C4, - 0x9977, 0xE2C3, 0x9978, 0xF09A, 0x9979, 0xF09B, 0x997A, 0xBDC8, - 0x997B, 0xF09C, 0x997C, 0xB1FD, 0x997D, 0xE2C4, 0x997E, 0xF09D, - 0x997F, 0xB6F6, 0x9980, 0xE2C5, 0x9981, 0xC4D9, 0x9982, 0xF09E, - 0x9983, 0xF09F, 0x9984, 0xE2C6, 0x9985, 0xCFDA, 0x9986, 0xB9DD, - 0x9987, 0xE2C7, 0x9988, 0xC0A1, 0x9989, 0xF0A0, 0x998A, 0xE2C8, - 0x998B, 0xB2F6, 0x998C, 0xF140, 0x998D, 0xE2C9, 0x998E, 0xF141, - 0x998F, 0xC1F3, 0x9990, 0xE2CA, 0x9991, 0xE2CB, 0x9992, 0xC2F8, - 0x9993, 0xE2CC, 0x9994, 0xE2CD, 0x9995, 0xE2CE, 0x9996, 0xCAD7, - 0x9997, 0xD8B8, 0x9998, 0xD9E5, 0x9999, 0xCFE3, 0x999A, 0xF142, - 0x999B, 0xF143, 0x999C, 0xF144, 0x999D, 0xF145, 0x999E, 0xF146, - 0x999F, 0xF147, 0x99A0, 0xF148, 0x99A1, 0xF149, 0x99A2, 0xF14A, - 0x99A3, 0xF14B, 0x99A4, 0xF14C, 0x99A5, 0xF0A5, 0x99A6, 0xF14D, - 0x99A7, 0xF14E, 0x99A8, 0xDCB0, 0x99A9, 0xF14F, 0x99AA, 0xF150, - 0x99AB, 0xF151, 0x99AC, 0xF152, 0x99AD, 0xF153, 0x99AE, 0xF154, - 0x99AF, 0xF155, 0x99B0, 0xF156, 0x99B1, 0xF157, 0x99B2, 0xF158, - 0x99B3, 0xF159, 0x99B4, 0xF15A, 0x99B5, 0xF15B, 0x99B6, 0xF15C, - 0x99B7, 0xF15D, 0x99B8, 0xF15E, 0x99B9, 0xF15F, 0x99BA, 0xF160, - 0x99BB, 0xF161, 0x99BC, 0xF162, 0x99BD, 0xF163, 0x99BE, 0xF164, - 0x99BF, 0xF165, 0x99C0, 0xF166, 0x99C1, 0xF167, 0x99C2, 0xF168, - 0x99C3, 0xF169, 0x99C4, 0xF16A, 0x99C5, 0xF16B, 0x99C6, 0xF16C, - 0x99C7, 0xF16D, 0x99C8, 0xF16E, 0x99C9, 0xF16F, 0x99CA, 0xF170, - 0x99CB, 0xF171, 0x99CC, 0xF172, 0x99CD, 0xF173, 0x99CE, 0xF174, - 0x99CF, 0xF175, 0x99D0, 0xF176, 0x99D1, 0xF177, 0x99D2, 0xF178, - 0x99D3, 0xF179, 0x99D4, 0xF17A, 0x99D5, 0xF17B, 0x99D6, 0xF17C, - 0x99D7, 0xF17D, 0x99D8, 0xF17E, 0x99D9, 0xF180, 0x99DA, 0xF181, - 0x99DB, 0xF182, 0x99DC, 0xF183, 0x99DD, 0xF184, 0x99DE, 0xF185, - 0x99DF, 0xF186, 0x99E0, 0xF187, 0x99E1, 0xF188, 0x99E2, 0xF189, - 0x99E3, 0xF18A, 0x99E4, 0xF18B, 0x99E5, 0xF18C, 0x99E6, 0xF18D, - 0x99E7, 0xF18E, 0x99E8, 0xF18F, 0x99E9, 0xF190, 0x99EA, 0xF191, - 0x99EB, 0xF192, 0x99EC, 0xF193, 0x99ED, 0xF194, 0x99EE, 0xF195, - 0x99EF, 0xF196, 0x99F0, 0xF197, 0x99F1, 0xF198, 0x99F2, 0xF199, - 0x99F3, 0xF19A, 0x99F4, 0xF19B, 0x99F5, 0xF19C, 0x99F6, 0xF19D, - 0x99F7, 0xF19E, 0x99F8, 0xF19F, 0x99F9, 0xF1A0, 0x99FA, 0xF240, - 0x99FB, 0xF241, 0x99FC, 0xF242, 0x99FD, 0xF243, 0x99FE, 0xF244, - 0x99FF, 0xF245, 0x9A00, 0xF246, 0x9A01, 0xF247, 0x9A02, 0xF248, - 0x9A03, 0xF249, 0x9A04, 0xF24A, 0x9A05, 0xF24B, 0x9A06, 0xF24C, - 0x9A07, 0xF24D, 0x9A08, 0xF24E, 0x9A09, 0xF24F, 0x9A0A, 0xF250, - 0x9A0B, 0xF251, 0x9A0C, 0xF252, 0x9A0D, 0xF253, 0x9A0E, 0xF254, - 0x9A0F, 0xF255, 0x9A10, 0xF256, 0x9A11, 0xF257, 0x9A12, 0xF258, - 0x9A13, 0xF259, 0x9A14, 0xF25A, 0x9A15, 0xF25B, 0x9A16, 0xF25C, - 0x9A17, 0xF25D, 0x9A18, 0xF25E, 0x9A19, 0xF25F, 0x9A1A, 0xF260, - 0x9A1B, 0xF261, 0x9A1C, 0xF262, 0x9A1D, 0xF263, 0x9A1E, 0xF264, - 0x9A1F, 0xF265, 0x9A20, 0xF266, 0x9A21, 0xF267, 0x9A22, 0xF268, - 0x9A23, 0xF269, 0x9A24, 0xF26A, 0x9A25, 0xF26B, 0x9A26, 0xF26C, - 0x9A27, 0xF26D, 0x9A28, 0xF26E, 0x9A29, 0xF26F, 0x9A2A, 0xF270, - 0x9A2B, 0xF271, 0x9A2C, 0xF272, 0x9A2D, 0xF273, 0x9A2E, 0xF274, - 0x9A2F, 0xF275, 0x9A30, 0xF276, 0x9A31, 0xF277, 0x9A32, 0xF278, - 0x9A33, 0xF279, 0x9A34, 0xF27A, 0x9A35, 0xF27B, 0x9A36, 0xF27C, - 0x9A37, 0xF27D, 0x9A38, 0xF27E, 0x9A39, 0xF280, 0x9A3A, 0xF281, - 0x9A3B, 0xF282, 0x9A3C, 0xF283, 0x9A3D, 0xF284, 0x9A3E, 0xF285, - 0x9A3F, 0xF286, 0x9A40, 0xF287, 0x9A41, 0xF288, 0x9A42, 0xF289, - 0x9A43, 0xF28A, 0x9A44, 0xF28B, 0x9A45, 0xF28C, 0x9A46, 0xF28D, - 0x9A47, 0xF28E, 0x9A48, 0xF28F, 0x9A49, 0xF290, 0x9A4A, 0xF291, - 0x9A4B, 0xF292, 0x9A4C, 0xF293, 0x9A4D, 0xF294, 0x9A4E, 0xF295, - 0x9A4F, 0xF296, 0x9A50, 0xF297, 0x9A51, 0xF298, 0x9A52, 0xF299, - 0x9A53, 0xF29A, 0x9A54, 0xF29B, 0x9A55, 0xF29C, 0x9A56, 0xF29D, - 0x9A57, 0xF29E, 0x9A58, 0xF29F, 0x9A59, 0xF2A0, 0x9A5A, 0xF340, - 0x9A5B, 0xF341, 0x9A5C, 0xF342, 0x9A5D, 0xF343, 0x9A5E, 0xF344, - 0x9A5F, 0xF345, 0x9A60, 0xF346, 0x9A61, 0xF347, 0x9A62, 0xF348, - 0x9A63, 0xF349, 0x9A64, 0xF34A, 0x9A65, 0xF34B, 0x9A66, 0xF34C, - 0x9A67, 0xF34D, 0x9A68, 0xF34E, 0x9A69, 0xF34F, 0x9A6A, 0xF350, - 0x9A6B, 0xF351, 0x9A6C, 0xC2ED, 0x9A6D, 0xD4A6, 0x9A6E, 0xCDD4, - 0x9A6F, 0xD1B1, 0x9A70, 0xB3DB, 0x9A71, 0xC7FD, 0x9A72, 0xF352, - 0x9A73, 0xB2B5, 0x9A74, 0xC2BF, 0x9A75, 0xE6E0, 0x9A76, 0xCABB, - 0x9A77, 0xE6E1, 0x9A78, 0xE6E2, 0x9A79, 0xBED4, 0x9A7A, 0xE6E3, - 0x9A7B, 0xD7A4, 0x9A7C, 0xCDD5, 0x9A7D, 0xE6E5, 0x9A7E, 0xBCDD, - 0x9A7F, 0xE6E4, 0x9A80, 0xE6E6, 0x9A81, 0xE6E7, 0x9A82, 0xC2EE, - 0x9A83, 0xF353, 0x9A84, 0xBDBE, 0x9A85, 0xE6E8, 0x9A86, 0xC2E6, - 0x9A87, 0xBAA7, 0x9A88, 0xE6E9, 0x9A89, 0xF354, 0x9A8A, 0xE6EA, - 0x9A8B, 0xB3D2, 0x9A8C, 0xD1E9, 0x9A8D, 0xF355, 0x9A8E, 0xF356, - 0x9A8F, 0xBFA5, 0x9A90, 0xE6EB, 0x9A91, 0xC6EF, 0x9A92, 0xE6EC, - 0x9A93, 0xE6ED, 0x9A94, 0xF357, 0x9A95, 0xF358, 0x9A96, 0xE6EE, - 0x9A97, 0xC6AD, 0x9A98, 0xE6EF, 0x9A99, 0xF359, 0x9A9A, 0xC9A7, - 0x9A9B, 0xE6F0, 0x9A9C, 0xE6F1, 0x9A9D, 0xE6F2, 0x9A9E, 0xE5B9, - 0x9A9F, 0xE6F3, 0x9AA0, 0xE6F4, 0x9AA1, 0xC2E2, 0x9AA2, 0xE6F5, - 0x9AA3, 0xE6F6, 0x9AA4, 0xD6E8, 0x9AA5, 0xE6F7, 0x9AA6, 0xF35A, - 0x9AA7, 0xE6F8, 0x9AA8, 0xB9C7, 0x9AA9, 0xF35B, 0x9AAA, 0xF35C, - 0x9AAB, 0xF35D, 0x9AAC, 0xF35E, 0x9AAD, 0xF35F, 0x9AAE, 0xF360, - 0x9AAF, 0xF361, 0x9AB0, 0xF7BB, 0x9AB1, 0xF7BA, 0x9AB2, 0xF362, - 0x9AB3, 0xF363, 0x9AB4, 0xF364, 0x9AB5, 0xF365, 0x9AB6, 0xF7BE, - 0x9AB7, 0xF7BC, 0x9AB8, 0xBAA1, 0x9AB9, 0xF366, 0x9ABA, 0xF7BF, - 0x9ABB, 0xF367, 0x9ABC, 0xF7C0, 0x9ABD, 0xF368, 0x9ABE, 0xF369, - 0x9ABF, 0xF36A, 0x9AC0, 0xF7C2, 0x9AC1, 0xF7C1, 0x9AC2, 0xF7C4, - 0x9AC3, 0xF36B, 0x9AC4, 0xF36C, 0x9AC5, 0xF7C3, 0x9AC6, 0xF36D, - 0x9AC7, 0xF36E, 0x9AC8, 0xF36F, 0x9AC9, 0xF370, 0x9ACA, 0xF371, - 0x9ACB, 0xF7C5, 0x9ACC, 0xF7C6, 0x9ACD, 0xF372, 0x9ACE, 0xF373, - 0x9ACF, 0xF374, 0x9AD0, 0xF375, 0x9AD1, 0xF7C7, 0x9AD2, 0xF376, - 0x9AD3, 0xCBE8, 0x9AD4, 0xF377, 0x9AD5, 0xF378, 0x9AD6, 0xF379, - 0x9AD7, 0xF37A, 0x9AD8, 0xB8DF, 0x9AD9, 0xF37B, 0x9ADA, 0xF37C, - 0x9ADB, 0xF37D, 0x9ADC, 0xF37E, 0x9ADD, 0xF380, 0x9ADE, 0xF381, - 0x9ADF, 0xF7D4, 0x9AE0, 0xF382, 0x9AE1, 0xF7D5, 0x9AE2, 0xF383, - 0x9AE3, 0xF384, 0x9AE4, 0xF385, 0x9AE5, 0xF386, 0x9AE6, 0xF7D6, - 0x9AE7, 0xF387, 0x9AE8, 0xF388, 0x9AE9, 0xF389, 0x9AEA, 0xF38A, - 0x9AEB, 0xF7D8, 0x9AEC, 0xF38B, 0x9AED, 0xF7DA, 0x9AEE, 0xF38C, - 0x9AEF, 0xF7D7, 0x9AF0, 0xF38D, 0x9AF1, 0xF38E, 0x9AF2, 0xF38F, - 0x9AF3, 0xF390, 0x9AF4, 0xF391, 0x9AF5, 0xF392, 0x9AF6, 0xF393, - 0x9AF7, 0xF394, 0x9AF8, 0xF395, 0x9AF9, 0xF7DB, 0x9AFA, 0xF396, - 0x9AFB, 0xF7D9, 0x9AFC, 0xF397, 0x9AFD, 0xF398, 0x9AFE, 0xF399, - 0x9AFF, 0xF39A, 0x9B00, 0xF39B, 0x9B01, 0xF39C, 0x9B02, 0xF39D, - 0x9B03, 0xD7D7, 0x9B04, 0xF39E, 0x9B05, 0xF39F, 0x9B06, 0xF3A0, - 0x9B07, 0xF440, 0x9B08, 0xF7DC, 0x9B09, 0xF441, 0x9B0A, 0xF442, - 0x9B0B, 0xF443, 0x9B0C, 0xF444, 0x9B0D, 0xF445, 0x9B0E, 0xF446, - 0x9B0F, 0xF7DD, 0x9B10, 0xF447, 0x9B11, 0xF448, 0x9B12, 0xF449, - 0x9B13, 0xF7DE, 0x9B14, 0xF44A, 0x9B15, 0xF44B, 0x9B16, 0xF44C, - 0x9B17, 0xF44D, 0x9B18, 0xF44E, 0x9B19, 0xF44F, 0x9B1A, 0xF450, - 0x9B1B, 0xF451, 0x9B1C, 0xF452, 0x9B1D, 0xF453, 0x9B1E, 0xF454, - 0x9B1F, 0xF7DF, 0x9B20, 0xF455, 0x9B21, 0xF456, 0x9B22, 0xF457, - 0x9B23, 0xF7E0, 0x9B24, 0xF458, 0x9B25, 0xF459, 0x9B26, 0xF45A, - 0x9B27, 0xF45B, 0x9B28, 0xF45C, 0x9B29, 0xF45D, 0x9B2A, 0xF45E, - 0x9B2B, 0xF45F, 0x9B2C, 0xF460, 0x9B2D, 0xF461, 0x9B2E, 0xF462, - 0x9B2F, 0xDBCB, 0x9B30, 0xF463, 0x9B31, 0xF464, 0x9B32, 0xD8AA, - 0x9B33, 0xF465, 0x9B34, 0xF466, 0x9B35, 0xF467, 0x9B36, 0xF468, - 0x9B37, 0xF469, 0x9B38, 0xF46A, 0x9B39, 0xF46B, 0x9B3A, 0xF46C, - 0x9B3B, 0xE5F7, 0x9B3C, 0xB9ED, 0x9B3D, 0xF46D, 0x9B3E, 0xF46E, - 0x9B3F, 0xF46F, 0x9B40, 0xF470, 0x9B41, 0xBFFD, 0x9B42, 0xBBEA, - 0x9B43, 0xF7C9, 0x9B44, 0xC6C7, 0x9B45, 0xF7C8, 0x9B46, 0xF471, - 0x9B47, 0xF7CA, 0x9B48, 0xF7CC, 0x9B49, 0xF7CB, 0x9B4A, 0xF472, - 0x9B4B, 0xF473, 0x9B4C, 0xF474, 0x9B4D, 0xF7CD, 0x9B4E, 0xF475, - 0x9B4F, 0xCEBA, 0x9B50, 0xF476, 0x9B51, 0xF7CE, 0x9B52, 0xF477, - 0x9B53, 0xF478, 0x9B54, 0xC4A7, 0x9B55, 0xF479, 0x9B56, 0xF47A, - 0x9B57, 0xF47B, 0x9B58, 0xF47C, 0x9B59, 0xF47D, 0x9B5A, 0xF47E, - 0x9B5B, 0xF480, 0x9B5C, 0xF481, 0x9B5D, 0xF482, 0x9B5E, 0xF483, - 0x9B5F, 0xF484, 0x9B60, 0xF485, 0x9B61, 0xF486, 0x9B62, 0xF487, - 0x9B63, 0xF488, 0x9B64, 0xF489, 0x9B65, 0xF48A, 0x9B66, 0xF48B, - 0x9B67, 0xF48C, 0x9B68, 0xF48D, 0x9B69, 0xF48E, 0x9B6A, 0xF48F, - 0x9B6B, 0xF490, 0x9B6C, 0xF491, 0x9B6D, 0xF492, 0x9B6E, 0xF493, - 0x9B6F, 0xF494, 0x9B70, 0xF495, 0x9B71, 0xF496, 0x9B72, 0xF497, - 0x9B73, 0xF498, 0x9B74, 0xF499, 0x9B75, 0xF49A, 0x9B76, 0xF49B, - 0x9B77, 0xF49C, 0x9B78, 0xF49D, 0x9B79, 0xF49E, 0x9B7A, 0xF49F, - 0x9B7B, 0xF4A0, 0x9B7C, 0xF540, 0x9B7D, 0xF541, 0x9B7E, 0xF542, - 0x9B7F, 0xF543, 0x9B80, 0xF544, 0x9B81, 0xF545, 0x9B82, 0xF546, - 0x9B83, 0xF547, 0x9B84, 0xF548, 0x9B85, 0xF549, 0x9B86, 0xF54A, - 0x9B87, 0xF54B, 0x9B88, 0xF54C, 0x9B89, 0xF54D, 0x9B8A, 0xF54E, - 0x9B8B, 0xF54F, 0x9B8C, 0xF550, 0x9B8D, 0xF551, 0x9B8E, 0xF552, - 0x9B8F, 0xF553, 0x9B90, 0xF554, 0x9B91, 0xF555, 0x9B92, 0xF556, - 0x9B93, 0xF557, 0x9B94, 0xF558, 0x9B95, 0xF559, 0x9B96, 0xF55A, - 0x9B97, 0xF55B, 0x9B98, 0xF55C, 0x9B99, 0xF55D, 0x9B9A, 0xF55E, - 0x9B9B, 0xF55F, 0x9B9C, 0xF560, 0x9B9D, 0xF561, 0x9B9E, 0xF562, - 0x9B9F, 0xF563, 0x9BA0, 0xF564, 0x9BA1, 0xF565, 0x9BA2, 0xF566, - 0x9BA3, 0xF567, 0x9BA4, 0xF568, 0x9BA5, 0xF569, 0x9BA6, 0xF56A, - 0x9BA7, 0xF56B, 0x9BA8, 0xF56C, 0x9BA9, 0xF56D, 0x9BAA, 0xF56E, - 0x9BAB, 0xF56F, 0x9BAC, 0xF570, 0x9BAD, 0xF571, 0x9BAE, 0xF572, - 0x9BAF, 0xF573, 0x9BB0, 0xF574, 0x9BB1, 0xF575, 0x9BB2, 0xF576, - 0x9BB3, 0xF577, 0x9BB4, 0xF578, 0x9BB5, 0xF579, 0x9BB6, 0xF57A, - 0x9BB7, 0xF57B, 0x9BB8, 0xF57C, 0x9BB9, 0xF57D, 0x9BBA, 0xF57E, - 0x9BBB, 0xF580, 0x9BBC, 0xF581, 0x9BBD, 0xF582, 0x9BBE, 0xF583, - 0x9BBF, 0xF584, 0x9BC0, 0xF585, 0x9BC1, 0xF586, 0x9BC2, 0xF587, - 0x9BC3, 0xF588, 0x9BC4, 0xF589, 0x9BC5, 0xF58A, 0x9BC6, 0xF58B, - 0x9BC7, 0xF58C, 0x9BC8, 0xF58D, 0x9BC9, 0xF58E, 0x9BCA, 0xF58F, - 0x9BCB, 0xF590, 0x9BCC, 0xF591, 0x9BCD, 0xF592, 0x9BCE, 0xF593, - 0x9BCF, 0xF594, 0x9BD0, 0xF595, 0x9BD1, 0xF596, 0x9BD2, 0xF597, - 0x9BD3, 0xF598, 0x9BD4, 0xF599, 0x9BD5, 0xF59A, 0x9BD6, 0xF59B, - 0x9BD7, 0xF59C, 0x9BD8, 0xF59D, 0x9BD9, 0xF59E, 0x9BDA, 0xF59F, - 0x9BDB, 0xF5A0, 0x9BDC, 0xF640, 0x9BDD, 0xF641, 0x9BDE, 0xF642, - 0x9BDF, 0xF643, 0x9BE0, 0xF644, 0x9BE1, 0xF645, 0x9BE2, 0xF646, - 0x9BE3, 0xF647, 0x9BE4, 0xF648, 0x9BE5, 0xF649, 0x9BE6, 0xF64A, - 0x9BE7, 0xF64B, 0x9BE8, 0xF64C, 0x9BE9, 0xF64D, 0x9BEA, 0xF64E, - 0x9BEB, 0xF64F, 0x9BEC, 0xF650, 0x9BED, 0xF651, 0x9BEE, 0xF652, - 0x9BEF, 0xF653, 0x9BF0, 0xF654, 0x9BF1, 0xF655, 0x9BF2, 0xF656, - 0x9BF3, 0xF657, 0x9BF4, 0xF658, 0x9BF5, 0xF659, 0x9BF6, 0xF65A, - 0x9BF7, 0xF65B, 0x9BF8, 0xF65C, 0x9BF9, 0xF65D, 0x9BFA, 0xF65E, - 0x9BFB, 0xF65F, 0x9BFC, 0xF660, 0x9BFD, 0xF661, 0x9BFE, 0xF662, - 0x9BFF, 0xF663, 0x9C00, 0xF664, 0x9C01, 0xF665, 0x9C02, 0xF666, - 0x9C03, 0xF667, 0x9C04, 0xF668, 0x9C05, 0xF669, 0x9C06, 0xF66A, - 0x9C07, 0xF66B, 0x9C08, 0xF66C, 0x9C09, 0xF66D, 0x9C0A, 0xF66E, - 0x9C0B, 0xF66F, 0x9C0C, 0xF670, 0x9C0D, 0xF671, 0x9C0E, 0xF672, - 0x9C0F, 0xF673, 0x9C10, 0xF674, 0x9C11, 0xF675, 0x9C12, 0xF676, - 0x9C13, 0xF677, 0x9C14, 0xF678, 0x9C15, 0xF679, 0x9C16, 0xF67A, - 0x9C17, 0xF67B, 0x9C18, 0xF67C, 0x9C19, 0xF67D, 0x9C1A, 0xF67E, - 0x9C1B, 0xF680, 0x9C1C, 0xF681, 0x9C1D, 0xF682, 0x9C1E, 0xF683, - 0x9C1F, 0xF684, 0x9C20, 0xF685, 0x9C21, 0xF686, 0x9C22, 0xF687, - 0x9C23, 0xF688, 0x9C24, 0xF689, 0x9C25, 0xF68A, 0x9C26, 0xF68B, - 0x9C27, 0xF68C, 0x9C28, 0xF68D, 0x9C29, 0xF68E, 0x9C2A, 0xF68F, - 0x9C2B, 0xF690, 0x9C2C, 0xF691, 0x9C2D, 0xF692, 0x9C2E, 0xF693, - 0x9C2F, 0xF694, 0x9C30, 0xF695, 0x9C31, 0xF696, 0x9C32, 0xF697, - 0x9C33, 0xF698, 0x9C34, 0xF699, 0x9C35, 0xF69A, 0x9C36, 0xF69B, - 0x9C37, 0xF69C, 0x9C38, 0xF69D, 0x9C39, 0xF69E, 0x9C3A, 0xF69F, - 0x9C3B, 0xF6A0, 0x9C3C, 0xF740, 0x9C3D, 0xF741, 0x9C3E, 0xF742, - 0x9C3F, 0xF743, 0x9C40, 0xF744, 0x9C41, 0xF745, 0x9C42, 0xF746, - 0x9C43, 0xF747, 0x9C44, 0xF748, 0x9C45, 0xF749, 0x9C46, 0xF74A, - 0x9C47, 0xF74B, 0x9C48, 0xF74C, 0x9C49, 0xF74D, 0x9C4A, 0xF74E, - 0x9C4B, 0xF74F, 0x9C4C, 0xF750, 0x9C4D, 0xF751, 0x9C4E, 0xF752, - 0x9C4F, 0xF753, 0x9C50, 0xF754, 0x9C51, 0xF755, 0x9C52, 0xF756, - 0x9C53, 0xF757, 0x9C54, 0xF758, 0x9C55, 0xF759, 0x9C56, 0xF75A, - 0x9C57, 0xF75B, 0x9C58, 0xF75C, 0x9C59, 0xF75D, 0x9C5A, 0xF75E, - 0x9C5B, 0xF75F, 0x9C5C, 0xF760, 0x9C5D, 0xF761, 0x9C5E, 0xF762, - 0x9C5F, 0xF763, 0x9C60, 0xF764, 0x9C61, 0xF765, 0x9C62, 0xF766, - 0x9C63, 0xF767, 0x9C64, 0xF768, 0x9C65, 0xF769, 0x9C66, 0xF76A, - 0x9C67, 0xF76B, 0x9C68, 0xF76C, 0x9C69, 0xF76D, 0x9C6A, 0xF76E, - 0x9C6B, 0xF76F, 0x9C6C, 0xF770, 0x9C6D, 0xF771, 0x9C6E, 0xF772, - 0x9C6F, 0xF773, 0x9C70, 0xF774, 0x9C71, 0xF775, 0x9C72, 0xF776, - 0x9C73, 0xF777, 0x9C74, 0xF778, 0x9C75, 0xF779, 0x9C76, 0xF77A, - 0x9C77, 0xF77B, 0x9C78, 0xF77C, 0x9C79, 0xF77D, 0x9C7A, 0xF77E, - 0x9C7B, 0xF780, 0x9C7C, 0xD3E3, 0x9C7D, 0xF781, 0x9C7E, 0xF782, - 0x9C7F, 0xF6CF, 0x9C80, 0xF783, 0x9C81, 0xC2B3, 0x9C82, 0xF6D0, - 0x9C83, 0xF784, 0x9C84, 0xF785, 0x9C85, 0xF6D1, 0x9C86, 0xF6D2, - 0x9C87, 0xF6D3, 0x9C88, 0xF6D4, 0x9C89, 0xF786, 0x9C8A, 0xF787, - 0x9C8B, 0xF6D6, 0x9C8C, 0xF788, 0x9C8D, 0xB1AB, 0x9C8E, 0xF6D7, - 0x9C8F, 0xF789, 0x9C90, 0xF6D8, 0x9C91, 0xF6D9, 0x9C92, 0xF6DA, - 0x9C93, 0xF78A, 0x9C94, 0xF6DB, 0x9C95, 0xF6DC, 0x9C96, 0xF78B, - 0x9C97, 0xF78C, 0x9C98, 0xF78D, 0x9C99, 0xF78E, 0x9C9A, 0xF6DD, - 0x9C9B, 0xF6DE, 0x9C9C, 0xCFCA, 0x9C9D, 0xF78F, 0x9C9E, 0xF6DF, - 0x9C9F, 0xF6E0, 0x9CA0, 0xF6E1, 0x9CA1, 0xF6E2, 0x9CA2, 0xF6E3, - 0x9CA3, 0xF6E4, 0x9CA4, 0xC0F0, 0x9CA5, 0xF6E5, 0x9CA6, 0xF6E6, - 0x9CA7, 0xF6E7, 0x9CA8, 0xF6E8, 0x9CA9, 0xF6E9, 0x9CAA, 0xF790, - 0x9CAB, 0xF6EA, 0x9CAC, 0xF791, 0x9CAD, 0xF6EB, 0x9CAE, 0xF6EC, - 0x9CAF, 0xF792, 0x9CB0, 0xF6ED, 0x9CB1, 0xF6EE, 0x9CB2, 0xF6EF, - 0x9CB3, 0xF6F0, 0x9CB4, 0xF6F1, 0x9CB5, 0xF6F2, 0x9CB6, 0xF6F3, - 0x9CB7, 0xF6F4, 0x9CB8, 0xBEA8, 0x9CB9, 0xF793, 0x9CBA, 0xF6F5, - 0x9CBB, 0xF6F6, 0x9CBC, 0xF6F7, 0x9CBD, 0xF6F8, 0x9CBE, 0xF794, - 0x9CBF, 0xF795, 0x9CC0, 0xF796, 0x9CC1, 0xF797, 0x9CC2, 0xF798, - 0x9CC3, 0xC8FA, 0x9CC4, 0xF6F9, 0x9CC5, 0xF6FA, 0x9CC6, 0xF6FB, - 0x9CC7, 0xF6FC, 0x9CC8, 0xF799, 0x9CC9, 0xF79A, 0x9CCA, 0xF6FD, - 0x9CCB, 0xF6FE, 0x9CCC, 0xF7A1, 0x9CCD, 0xF7A2, 0x9CCE, 0xF7A3, - 0x9CCF, 0xF7A4, 0x9CD0, 0xF7A5, 0x9CD1, 0xF79B, 0x9CD2, 0xF79C, - 0x9CD3, 0xF7A6, 0x9CD4, 0xF7A7, 0x9CD5, 0xF7A8, 0x9CD6, 0xB1EE, - 0x9CD7, 0xF7A9, 0x9CD8, 0xF7AA, 0x9CD9, 0xF7AB, 0x9CDA, 0xF79D, - 0x9CDB, 0xF79E, 0x9CDC, 0xF7AC, 0x9CDD, 0xF7AD, 0x9CDE, 0xC1DB, - 0x9CDF, 0xF7AE, 0x9CE0, 0xF79F, 0x9CE1, 0xF7A0, 0x9CE2, 0xF7AF, - 0x9CE3, 0xF840, 0x9CE4, 0xF841, 0x9CE5, 0xF842, 0x9CE6, 0xF843, - 0x9CE7, 0xF844, 0x9CE8, 0xF845, 0x9CE9, 0xF846, 0x9CEA, 0xF847, - 0x9CEB, 0xF848, 0x9CEC, 0xF849, 0x9CED, 0xF84A, 0x9CEE, 0xF84B, - 0x9CEF, 0xF84C, 0x9CF0, 0xF84D, 0x9CF1, 0xF84E, 0x9CF2, 0xF84F, - 0x9CF3, 0xF850, 0x9CF4, 0xF851, 0x9CF5, 0xF852, 0x9CF6, 0xF853, - 0x9CF7, 0xF854, 0x9CF8, 0xF855, 0x9CF9, 0xF856, 0x9CFA, 0xF857, - 0x9CFB, 0xF858, 0x9CFC, 0xF859, 0x9CFD, 0xF85A, 0x9CFE, 0xF85B, - 0x9CFF, 0xF85C, 0x9D00, 0xF85D, 0x9D01, 0xF85E, 0x9D02, 0xF85F, - 0x9D03, 0xF860, 0x9D04, 0xF861, 0x9D05, 0xF862, 0x9D06, 0xF863, - 0x9D07, 0xF864, 0x9D08, 0xF865, 0x9D09, 0xF866, 0x9D0A, 0xF867, - 0x9D0B, 0xF868, 0x9D0C, 0xF869, 0x9D0D, 0xF86A, 0x9D0E, 0xF86B, - 0x9D0F, 0xF86C, 0x9D10, 0xF86D, 0x9D11, 0xF86E, 0x9D12, 0xF86F, - 0x9D13, 0xF870, 0x9D14, 0xF871, 0x9D15, 0xF872, 0x9D16, 0xF873, - 0x9D17, 0xF874, 0x9D18, 0xF875, 0x9D19, 0xF876, 0x9D1A, 0xF877, - 0x9D1B, 0xF878, 0x9D1C, 0xF879, 0x9D1D, 0xF87A, 0x9D1E, 0xF87B, - 0x9D1F, 0xF87C, 0x9D20, 0xF87D, 0x9D21, 0xF87E, 0x9D22, 0xF880, - 0x9D23, 0xF881, 0x9D24, 0xF882, 0x9D25, 0xF883, 0x9D26, 0xF884, - 0x9D27, 0xF885, 0x9D28, 0xF886, 0x9D29, 0xF887, 0x9D2A, 0xF888, - 0x9D2B, 0xF889, 0x9D2C, 0xF88A, 0x9D2D, 0xF88B, 0x9D2E, 0xF88C, - 0x9D2F, 0xF88D, 0x9D30, 0xF88E, 0x9D31, 0xF88F, 0x9D32, 0xF890, - 0x9D33, 0xF891, 0x9D34, 0xF892, 0x9D35, 0xF893, 0x9D36, 0xF894, - 0x9D37, 0xF895, 0x9D38, 0xF896, 0x9D39, 0xF897, 0x9D3A, 0xF898, - 0x9D3B, 0xF899, 0x9D3C, 0xF89A, 0x9D3D, 0xF89B, 0x9D3E, 0xF89C, - 0x9D3F, 0xF89D, 0x9D40, 0xF89E, 0x9D41, 0xF89F, 0x9D42, 0xF8A0, - 0x9D43, 0xF940, 0x9D44, 0xF941, 0x9D45, 0xF942, 0x9D46, 0xF943, - 0x9D47, 0xF944, 0x9D48, 0xF945, 0x9D49, 0xF946, 0x9D4A, 0xF947, - 0x9D4B, 0xF948, 0x9D4C, 0xF949, 0x9D4D, 0xF94A, 0x9D4E, 0xF94B, - 0x9D4F, 0xF94C, 0x9D50, 0xF94D, 0x9D51, 0xF94E, 0x9D52, 0xF94F, - 0x9D53, 0xF950, 0x9D54, 0xF951, 0x9D55, 0xF952, 0x9D56, 0xF953, - 0x9D57, 0xF954, 0x9D58, 0xF955, 0x9D59, 0xF956, 0x9D5A, 0xF957, - 0x9D5B, 0xF958, 0x9D5C, 0xF959, 0x9D5D, 0xF95A, 0x9D5E, 0xF95B, - 0x9D5F, 0xF95C, 0x9D60, 0xF95D, 0x9D61, 0xF95E, 0x9D62, 0xF95F, - 0x9D63, 0xF960, 0x9D64, 0xF961, 0x9D65, 0xF962, 0x9D66, 0xF963, - 0x9D67, 0xF964, 0x9D68, 0xF965, 0x9D69, 0xF966, 0x9D6A, 0xF967, - 0x9D6B, 0xF968, 0x9D6C, 0xF969, 0x9D6D, 0xF96A, 0x9D6E, 0xF96B, - 0x9D6F, 0xF96C, 0x9D70, 0xF96D, 0x9D71, 0xF96E, 0x9D72, 0xF96F, - 0x9D73, 0xF970, 0x9D74, 0xF971, 0x9D75, 0xF972, 0x9D76, 0xF973, - 0x9D77, 0xF974, 0x9D78, 0xF975, 0x9D79, 0xF976, 0x9D7A, 0xF977, - 0x9D7B, 0xF978, 0x9D7C, 0xF979, 0x9D7D, 0xF97A, 0x9D7E, 0xF97B, - 0x9D7F, 0xF97C, 0x9D80, 0xF97D, 0x9D81, 0xF97E, 0x9D82, 0xF980, - 0x9D83, 0xF981, 0x9D84, 0xF982, 0x9D85, 0xF983, 0x9D86, 0xF984, - 0x9D87, 0xF985, 0x9D88, 0xF986, 0x9D89, 0xF987, 0x9D8A, 0xF988, - 0x9D8B, 0xF989, 0x9D8C, 0xF98A, 0x9D8D, 0xF98B, 0x9D8E, 0xF98C, - 0x9D8F, 0xF98D, 0x9D90, 0xF98E, 0x9D91, 0xF98F, 0x9D92, 0xF990, - 0x9D93, 0xF991, 0x9D94, 0xF992, 0x9D95, 0xF993, 0x9D96, 0xF994, - 0x9D97, 0xF995, 0x9D98, 0xF996, 0x9D99, 0xF997, 0x9D9A, 0xF998, - 0x9D9B, 0xF999, 0x9D9C, 0xF99A, 0x9D9D, 0xF99B, 0x9D9E, 0xF99C, - 0x9D9F, 0xF99D, 0x9DA0, 0xF99E, 0x9DA1, 0xF99F, 0x9DA2, 0xF9A0, - 0x9DA3, 0xFA40, 0x9DA4, 0xFA41, 0x9DA5, 0xFA42, 0x9DA6, 0xFA43, - 0x9DA7, 0xFA44, 0x9DA8, 0xFA45, 0x9DA9, 0xFA46, 0x9DAA, 0xFA47, - 0x9DAB, 0xFA48, 0x9DAC, 0xFA49, 0x9DAD, 0xFA4A, 0x9DAE, 0xFA4B, - 0x9DAF, 0xFA4C, 0x9DB0, 0xFA4D, 0x9DB1, 0xFA4E, 0x9DB2, 0xFA4F, - 0x9DB3, 0xFA50, 0x9DB4, 0xFA51, 0x9DB5, 0xFA52, 0x9DB6, 0xFA53, - 0x9DB7, 0xFA54, 0x9DB8, 0xFA55, 0x9DB9, 0xFA56, 0x9DBA, 0xFA57, - 0x9DBB, 0xFA58, 0x9DBC, 0xFA59, 0x9DBD, 0xFA5A, 0x9DBE, 0xFA5B, - 0x9DBF, 0xFA5C, 0x9DC0, 0xFA5D, 0x9DC1, 0xFA5E, 0x9DC2, 0xFA5F, - 0x9DC3, 0xFA60, 0x9DC4, 0xFA61, 0x9DC5, 0xFA62, 0x9DC6, 0xFA63, - 0x9DC7, 0xFA64, 0x9DC8, 0xFA65, 0x9DC9, 0xFA66, 0x9DCA, 0xFA67, - 0x9DCB, 0xFA68, 0x9DCC, 0xFA69, 0x9DCD, 0xFA6A, 0x9DCE, 0xFA6B, - 0x9DCF, 0xFA6C, 0x9DD0, 0xFA6D, 0x9DD1, 0xFA6E, 0x9DD2, 0xFA6F, - 0x9DD3, 0xFA70, 0x9DD4, 0xFA71, 0x9DD5, 0xFA72, 0x9DD6, 0xFA73, - 0x9DD7, 0xFA74, 0x9DD8, 0xFA75, 0x9DD9, 0xFA76, 0x9DDA, 0xFA77, - 0x9DDB, 0xFA78, 0x9DDC, 0xFA79, 0x9DDD, 0xFA7A, 0x9DDE, 0xFA7B, - 0x9DDF, 0xFA7C, 0x9DE0, 0xFA7D, 0x9DE1, 0xFA7E, 0x9DE2, 0xFA80, - 0x9DE3, 0xFA81, 0x9DE4, 0xFA82, 0x9DE5, 0xFA83, 0x9DE6, 0xFA84, - 0x9DE7, 0xFA85, 0x9DE8, 0xFA86, 0x9DE9, 0xFA87, 0x9DEA, 0xFA88, - 0x9DEB, 0xFA89, 0x9DEC, 0xFA8A, 0x9DED, 0xFA8B, 0x9DEE, 0xFA8C, - 0x9DEF, 0xFA8D, 0x9DF0, 0xFA8E, 0x9DF1, 0xFA8F, 0x9DF2, 0xFA90, - 0x9DF3, 0xFA91, 0x9DF4, 0xFA92, 0x9DF5, 0xFA93, 0x9DF6, 0xFA94, - 0x9DF7, 0xFA95, 0x9DF8, 0xFA96, 0x9DF9, 0xFA97, 0x9DFA, 0xFA98, - 0x9DFB, 0xFA99, 0x9DFC, 0xFA9A, 0x9DFD, 0xFA9B, 0x9DFE, 0xFA9C, - 0x9DFF, 0xFA9D, 0x9E00, 0xFA9E, 0x9E01, 0xFA9F, 0x9E02, 0xFAA0, - 0x9E03, 0xFB40, 0x9E04, 0xFB41, 0x9E05, 0xFB42, 0x9E06, 0xFB43, - 0x9E07, 0xFB44, 0x9E08, 0xFB45, 0x9E09, 0xFB46, 0x9E0A, 0xFB47, - 0x9E0B, 0xFB48, 0x9E0C, 0xFB49, 0x9E0D, 0xFB4A, 0x9E0E, 0xFB4B, - 0x9E0F, 0xFB4C, 0x9E10, 0xFB4D, 0x9E11, 0xFB4E, 0x9E12, 0xFB4F, - 0x9E13, 0xFB50, 0x9E14, 0xFB51, 0x9E15, 0xFB52, 0x9E16, 0xFB53, - 0x9E17, 0xFB54, 0x9E18, 0xFB55, 0x9E19, 0xFB56, 0x9E1A, 0xFB57, - 0x9E1B, 0xFB58, 0x9E1C, 0xFB59, 0x9E1D, 0xFB5A, 0x9E1E, 0xFB5B, - 0x9E1F, 0xC4F1, 0x9E20, 0xF0AF, 0x9E21, 0xBCA6, 0x9E22, 0xF0B0, - 0x9E23, 0xC3F9, 0x9E24, 0xFB5C, 0x9E25, 0xC5B8, 0x9E26, 0xD1BB, - 0x9E27, 0xFB5D, 0x9E28, 0xF0B1, 0x9E29, 0xF0B2, 0x9E2A, 0xF0B3, - 0x9E2B, 0xF0B4, 0x9E2C, 0xF0B5, 0x9E2D, 0xD1BC, 0x9E2E, 0xFB5E, - 0x9E2F, 0xD1EC, 0x9E30, 0xFB5F, 0x9E31, 0xF0B7, 0x9E32, 0xF0B6, - 0x9E33, 0xD4A7, 0x9E34, 0xFB60, 0x9E35, 0xCDD2, 0x9E36, 0xF0B8, - 0x9E37, 0xF0BA, 0x9E38, 0xF0B9, 0x9E39, 0xF0BB, 0x9E3A, 0xF0BC, - 0x9E3B, 0xFB61, 0x9E3C, 0xFB62, 0x9E3D, 0xB8EB, 0x9E3E, 0xF0BD, - 0x9E3F, 0xBAE8, 0x9E40, 0xFB63, 0x9E41, 0xF0BE, 0x9E42, 0xF0BF, - 0x9E43, 0xBEE9, 0x9E44, 0xF0C0, 0x9E45, 0xB6EC, 0x9E46, 0xF0C1, - 0x9E47, 0xF0C2, 0x9E48, 0xF0C3, 0x9E49, 0xF0C4, 0x9E4A, 0xC8B5, - 0x9E4B, 0xF0C5, 0x9E4C, 0xF0C6, 0x9E4D, 0xFB64, 0x9E4E, 0xF0C7, - 0x9E4F, 0xC5F4, 0x9E50, 0xFB65, 0x9E51, 0xF0C8, 0x9E52, 0xFB66, - 0x9E53, 0xFB67, 0x9E54, 0xFB68, 0x9E55, 0xF0C9, 0x9E56, 0xFB69, - 0x9E57, 0xF0CA, 0x9E58, 0xF7BD, 0x9E59, 0xFB6A, 0x9E5A, 0xF0CB, - 0x9E5B, 0xF0CC, 0x9E5C, 0xF0CD, 0x9E5D, 0xFB6B, 0x9E5E, 0xF0CE, - 0x9E5F, 0xFB6C, 0x9E60, 0xFB6D, 0x9E61, 0xFB6E, 0x9E62, 0xFB6F, - 0x9E63, 0xF0CF, 0x9E64, 0xBAD7, 0x9E65, 0xFB70, 0x9E66, 0xF0D0, - 0x9E67, 0xF0D1, 0x9E68, 0xF0D2, 0x9E69, 0xF0D3, 0x9E6A, 0xF0D4, - 0x9E6B, 0xF0D5, 0x9E6C, 0xF0D6, 0x9E6D, 0xF0D8, 0x9E6E, 0xFB71, - 0x9E6F, 0xFB72, 0x9E70, 0xD3A5, 0x9E71, 0xF0D7, 0x9E72, 0xFB73, - 0x9E73, 0xF0D9, 0x9E74, 0xFB74, 0x9E75, 0xFB75, 0x9E76, 0xFB76, - 0x9E77, 0xFB77, 0x9E78, 0xFB78, 0x9E79, 0xFB79, 0x9E7A, 0xFB7A, - 0x9E7B, 0xFB7B, 0x9E7C, 0xFB7C, 0x9E7D, 0xFB7D, 0x9E7E, 0xF5BA, - 0x9E7F, 0xC2B9, 0x9E80, 0xFB7E, 0x9E81, 0xFB80, 0x9E82, 0xF7E4, - 0x9E83, 0xFB81, 0x9E84, 0xFB82, 0x9E85, 0xFB83, 0x9E86, 0xFB84, - 0x9E87, 0xF7E5, 0x9E88, 0xF7E6, 0x9E89, 0xFB85, 0x9E8A, 0xFB86, - 0x9E8B, 0xF7E7, 0x9E8C, 0xFB87, 0x9E8D, 0xFB88, 0x9E8E, 0xFB89, - 0x9E8F, 0xFB8A, 0x9E90, 0xFB8B, 0x9E91, 0xFB8C, 0x9E92, 0xF7E8, - 0x9E93, 0xC2B4, 0x9E94, 0xFB8D, 0x9E95, 0xFB8E, 0x9E96, 0xFB8F, - 0x9E97, 0xFB90, 0x9E98, 0xFB91, 0x9E99, 0xFB92, 0x9E9A, 0xFB93, - 0x9E9B, 0xFB94, 0x9E9C, 0xFB95, 0x9E9D, 0xF7EA, 0x9E9E, 0xFB96, - 0x9E9F, 0xF7EB, 0x9EA0, 0xFB97, 0x9EA1, 0xFB98, 0x9EA2, 0xFB99, - 0x9EA3, 0xFB9A, 0x9EA4, 0xFB9B, 0x9EA5, 0xFB9C, 0x9EA6, 0xC2F3, - 0x9EA7, 0xFB9D, 0x9EA8, 0xFB9E, 0x9EA9, 0xFB9F, 0x9EAA, 0xFBA0, - 0x9EAB, 0xFC40, 0x9EAC, 0xFC41, 0x9EAD, 0xFC42, 0x9EAE, 0xFC43, - 0x9EAF, 0xFC44, 0x9EB0, 0xFC45, 0x9EB1, 0xFC46, 0x9EB2, 0xFC47, - 0x9EB3, 0xFC48, 0x9EB4, 0xF4F0, 0x9EB5, 0xFC49, 0x9EB6, 0xFC4A, - 0x9EB7, 0xFC4B, 0x9EB8, 0xF4EF, 0x9EB9, 0xFC4C, 0x9EBA, 0xFC4D, - 0x9EBB, 0xC2E9, 0x9EBC, 0xFC4E, 0x9EBD, 0xF7E1, 0x9EBE, 0xF7E2, - 0x9EBF, 0xFC4F, 0x9EC0, 0xFC50, 0x9EC1, 0xFC51, 0x9EC2, 0xFC52, - 0x9EC3, 0xFC53, 0x9EC4, 0xBBC6, 0x9EC5, 0xFC54, 0x9EC6, 0xFC55, - 0x9EC7, 0xFC56, 0x9EC8, 0xFC57, 0x9EC9, 0xD9E4, 0x9ECA, 0xFC58, - 0x9ECB, 0xFC59, 0x9ECC, 0xFC5A, 0x9ECD, 0xCAF2, 0x9ECE, 0xC0E8, - 0x9ECF, 0xF0A4, 0x9ED0, 0xFC5B, 0x9ED1, 0xBADA, 0x9ED2, 0xFC5C, - 0x9ED3, 0xFC5D, 0x9ED4, 0xC7AD, 0x9ED5, 0xFC5E, 0x9ED6, 0xFC5F, - 0x9ED7, 0xFC60, 0x9ED8, 0xC4AC, 0x9ED9, 0xFC61, 0x9EDA, 0xFC62, - 0x9EDB, 0xF7EC, 0x9EDC, 0xF7ED, 0x9EDD, 0xF7EE, 0x9EDE, 0xFC63, - 0x9EDF, 0xF7F0, 0x9EE0, 0xF7EF, 0x9EE1, 0xFC64, 0x9EE2, 0xF7F1, - 0x9EE3, 0xFC65, 0x9EE4, 0xFC66, 0x9EE5, 0xF7F4, 0x9EE6, 0xFC67, - 0x9EE7, 0xF7F3, 0x9EE8, 0xFC68, 0x9EE9, 0xF7F2, 0x9EEA, 0xF7F5, - 0x9EEB, 0xFC69, 0x9EEC, 0xFC6A, 0x9EED, 0xFC6B, 0x9EEE, 0xFC6C, - 0x9EEF, 0xF7F6, 0x9EF0, 0xFC6D, 0x9EF1, 0xFC6E, 0x9EF2, 0xFC6F, - 0x9EF3, 0xFC70, 0x9EF4, 0xFC71, 0x9EF5, 0xFC72, 0x9EF6, 0xFC73, - 0x9EF7, 0xFC74, 0x9EF8, 0xFC75, 0x9EF9, 0xEDE9, 0x9EFA, 0xFC76, - 0x9EFB, 0xEDEA, 0x9EFC, 0xEDEB, 0x9EFD, 0xFC77, 0x9EFE, 0xF6BC, - 0x9EFF, 0xFC78, 0x9F00, 0xFC79, 0x9F01, 0xFC7A, 0x9F02, 0xFC7B, - 0x9F03, 0xFC7C, 0x9F04, 0xFC7D, 0x9F05, 0xFC7E, 0x9F06, 0xFC80, - 0x9F07, 0xFC81, 0x9F08, 0xFC82, 0x9F09, 0xFC83, 0x9F0A, 0xFC84, - 0x9F0B, 0xF6BD, 0x9F0C, 0xFC85, 0x9F0D, 0xF6BE, 0x9F0E, 0xB6A6, - 0x9F0F, 0xFC86, 0x9F10, 0xD8BE, 0x9F11, 0xFC87, 0x9F12, 0xFC88, - 0x9F13, 0xB9C4, 0x9F14, 0xFC89, 0x9F15, 0xFC8A, 0x9F16, 0xFC8B, - 0x9F17, 0xD8BB, 0x9F18, 0xFC8C, 0x9F19, 0xDCB1, 0x9F1A, 0xFC8D, - 0x9F1B, 0xFC8E, 0x9F1C, 0xFC8F, 0x9F1D, 0xFC90, 0x9F1E, 0xFC91, - 0x9F1F, 0xFC92, 0x9F20, 0xCAF3, 0x9F21, 0xFC93, 0x9F22, 0xF7F7, - 0x9F23, 0xFC94, 0x9F24, 0xFC95, 0x9F25, 0xFC96, 0x9F26, 0xFC97, - 0x9F27, 0xFC98, 0x9F28, 0xFC99, 0x9F29, 0xFC9A, 0x9F2A, 0xFC9B, - 0x9F2B, 0xFC9C, 0x9F2C, 0xF7F8, 0x9F2D, 0xFC9D, 0x9F2E, 0xFC9E, - 0x9F2F, 0xF7F9, 0x9F30, 0xFC9F, 0x9F31, 0xFCA0, 0x9F32, 0xFD40, - 0x9F33, 0xFD41, 0x9F34, 0xFD42, 0x9F35, 0xFD43, 0x9F36, 0xFD44, - 0x9F37, 0xF7FB, 0x9F38, 0xFD45, 0x9F39, 0xF7FA, 0x9F3A, 0xFD46, - 0x9F3B, 0xB1C7, 0x9F3C, 0xFD47, 0x9F3D, 0xF7FC, 0x9F3E, 0xF7FD, - 0x9F3F, 0xFD48, 0x9F40, 0xFD49, 0x9F41, 0xFD4A, 0x9F42, 0xFD4B, - 0x9F43, 0xFD4C, 0x9F44, 0xF7FE, 0x9F45, 0xFD4D, 0x9F46, 0xFD4E, - 0x9F47, 0xFD4F, 0x9F48, 0xFD50, 0x9F49, 0xFD51, 0x9F4A, 0xFD52, - 0x9F4B, 0xFD53, 0x9F4C, 0xFD54, 0x9F4D, 0xFD55, 0x9F4E, 0xFD56, - 0x9F4F, 0xFD57, 0x9F50, 0xC6EB, 0x9F51, 0xECB4, 0x9F52, 0xFD58, - 0x9F53, 0xFD59, 0x9F54, 0xFD5A, 0x9F55, 0xFD5B, 0x9F56, 0xFD5C, - 0x9F57, 0xFD5D, 0x9F58, 0xFD5E, 0x9F59, 0xFD5F, 0x9F5A, 0xFD60, - 0x9F5B, 0xFD61, 0x9F5C, 0xFD62, 0x9F5D, 0xFD63, 0x9F5E, 0xFD64, - 0x9F5F, 0xFD65, 0x9F60, 0xFD66, 0x9F61, 0xFD67, 0x9F62, 0xFD68, - 0x9F63, 0xFD69, 0x9F64, 0xFD6A, 0x9F65, 0xFD6B, 0x9F66, 0xFD6C, - 0x9F67, 0xFD6D, 0x9F68, 0xFD6E, 0x9F69, 0xFD6F, 0x9F6A, 0xFD70, - 0x9F6B, 0xFD71, 0x9F6C, 0xFD72, 0x9F6D, 0xFD73, 0x9F6E, 0xFD74, - 0x9F6F, 0xFD75, 0x9F70, 0xFD76, 0x9F71, 0xFD77, 0x9F72, 0xFD78, - 0x9F73, 0xFD79, 0x9F74, 0xFD7A, 0x9F75, 0xFD7B, 0x9F76, 0xFD7C, - 0x9F77, 0xFD7D, 0x9F78, 0xFD7E, 0x9F79, 0xFD80, 0x9F7A, 0xFD81, - 0x9F7B, 0xFD82, 0x9F7C, 0xFD83, 0x9F7D, 0xFD84, 0x9F7E, 0xFD85, - 0x9F7F, 0xB3DD, 0x9F80, 0xF6B3, 0x9F81, 0xFD86, 0x9F82, 0xFD87, - 0x9F83, 0xF6B4, 0x9F84, 0xC1E4, 0x9F85, 0xF6B5, 0x9F86, 0xF6B6, - 0x9F87, 0xF6B7, 0x9F88, 0xF6B8, 0x9F89, 0xF6B9, 0x9F8A, 0xF6BA, - 0x9F8B, 0xC8A3, 0x9F8C, 0xF6BB, 0x9F8D, 0xFD88, 0x9F8E, 0xFD89, - 0x9F8F, 0xFD8A, 0x9F90, 0xFD8B, 0x9F91, 0xFD8C, 0x9F92, 0xFD8D, - 0x9F93, 0xFD8E, 0x9F94, 0xFD8F, 0x9F95, 0xFD90, 0x9F96, 0xFD91, - 0x9F97, 0xFD92, 0x9F98, 0xFD93, 0x9F99, 0xC1FA, 0x9F9A, 0xB9A8, - 0x9F9B, 0xEDE8, 0x9F9C, 0xFD94, 0x9F9D, 0xFD95, 0x9F9E, 0xFD96, - 0x9F9F, 0xB9EA, 0x9FA0, 0xD9DF, 0x9FA1, 0xFD97, 0x9FA2, 0xFD98, - 0x9FA3, 0xFD99, 0x9FA4, 0xFD9A, 0x9FA5, 0xFD9B, 0xF92C, 0xFD9C, - 0xF979, 0xFD9D, 0xF995, 0xFD9E, 0xF9E7, 0xFD9F, 0xF9F1, 0xFDA0, - 0xFA0C, 0xFE40, 0xFA0D, 0xFE41, 0xFA0E, 0xFE42, 0xFA0F, 0xFE43, - 0xFA11, 0xFE44, 0xFA13, 0xFE45, 0xFA14, 0xFE46, 0xFA18, 0xFE47, - 0xFA1F, 0xFE48, 0xFA20, 0xFE49, 0xFA21, 0xFE4A, 0xFA23, 0xFE4B, - 0xFA24, 0xFE4C, 0xFA27, 0xFE4D, 0xFA28, 0xFE4E, 0xFA29, 0xFE4F, - 0xFE30, 0xA955, 0xFE31, 0xA6F2, 0xFE33, 0xA6F4, 0xFE34, 0xA6F5, - 0xFE35, 0xA6E0, 0xFE36, 0xA6E1, 0xFE37, 0xA6F0, 0xFE38, 0xA6F1, - 0xFE39, 0xA6E2, 0xFE3A, 0xA6E3, 0xFE3B, 0xA6EE, 0xFE3C, 0xA6EF, - 0xFE3D, 0xA6E6, 0xFE3E, 0xA6E7, 0xFE3F, 0xA6E4, 0xFE40, 0xA6E5, - 0xFE41, 0xA6E8, 0xFE42, 0xA6E9, 0xFE43, 0xA6EA, 0xFE44, 0xA6EB, - 0xFE49, 0xA968, 0xFE4A, 0xA969, 0xFE4B, 0xA96A, 0xFE4C, 0xA96B, - 0xFE4D, 0xA96C, 0xFE4E, 0xA96D, 0xFE4F, 0xA96E, 0xFE50, 0xA96F, - 0xFE51, 0xA970, 0xFE52, 0xA971, 0xFE54, 0xA972, 0xFE55, 0xA973, - 0xFE56, 0xA974, 0xFE57, 0xA975, 0xFE59, 0xA976, 0xFE5A, 0xA977, - 0xFE5B, 0xA978, 0xFE5C, 0xA979, 0xFE5D, 0xA97A, 0xFE5E, 0xA97B, - 0xFE5F, 0xA97C, 0xFE60, 0xA97D, 0xFE61, 0xA97E, 0xFE62, 0xA980, - 0xFE63, 0xA981, 0xFE64, 0xA982, 0xFE65, 0xA983, 0xFE66, 0xA984, - 0xFE68, 0xA985, 0xFE69, 0xA986, 0xFE6A, 0xA987, 0xFE6B, 0xA988, - 0xFF01, 0xA3A1, 0xFF02, 0xA3A2, 0xFF03, 0xA3A3, 0xFF04, 0xA1E7, - 0xFF05, 0xA3A5, 0xFF06, 0xA3A6, 0xFF07, 0xA3A7, 0xFF08, 0xA3A8, - 0xFF09, 0xA3A9, 0xFF0A, 0xA3AA, 0xFF0B, 0xA3AB, 0xFF0C, 0xA3AC, - 0xFF0D, 0xA3AD, 0xFF0E, 0xA3AE, 0xFF0F, 0xA3AF, 0xFF10, 0xA3B0, - 0xFF11, 0xA3B1, 0xFF12, 0xA3B2, 0xFF13, 0xA3B3, 0xFF14, 0xA3B4, - 0xFF15, 0xA3B5, 0xFF16, 0xA3B6, 0xFF17, 0xA3B7, 0xFF18, 0xA3B8, - 0xFF19, 0xA3B9, 0xFF1A, 0xA3BA, 0xFF1B, 0xA3BB, 0xFF1C, 0xA3BC, - 0xFF1D, 0xA3BD, 0xFF1E, 0xA3BE, 0xFF1F, 0xA3BF, 0xFF20, 0xA3C0, - 0xFF21, 0xA3C1, 0xFF22, 0xA3C2, 0xFF23, 0xA3C3, 0xFF24, 0xA3C4, - 0xFF25, 0xA3C5, 0xFF26, 0xA3C6, 0xFF27, 0xA3C7, 0xFF28, 0xA3C8, - 0xFF29, 0xA3C9, 0xFF2A, 0xA3CA, 0xFF2B, 0xA3CB, 0xFF2C, 0xA3CC, - 0xFF2D, 0xA3CD, 0xFF2E, 0xA3CE, 0xFF2F, 0xA3CF, 0xFF30, 0xA3D0, - 0xFF31, 0xA3D1, 0xFF32, 0xA3D2, 0xFF33, 0xA3D3, 0xFF34, 0xA3D4, - 0xFF35, 0xA3D5, 0xFF36, 0xA3D6, 0xFF37, 0xA3D7, 0xFF38, 0xA3D8, - 0xFF39, 0xA3D9, 0xFF3A, 0xA3DA, 0xFF3B, 0xA3DB, 0xFF3C, 0xA3DC, - 0xFF3D, 0xA3DD, 0xFF3E, 0xA3DE, 0xFF3F, 0xA3DF, 0xFF40, 0xA3E0, - 0xFF41, 0xA3E1, 0xFF42, 0xA3E2, 0xFF43, 0xA3E3, 0xFF44, 0xA3E4, - 0xFF45, 0xA3E5, 0xFF46, 0xA3E6, 0xFF47, 0xA3E7, 0xFF48, 0xA3E8, - 0xFF49, 0xA3E9, 0xFF4A, 0xA3EA, 0xFF4B, 0xA3EB, 0xFF4C, 0xA3EC, - 0xFF4D, 0xA3ED, 0xFF4E, 0xA3EE, 0xFF4F, 0xA3EF, 0xFF50, 0xA3F0, - 0xFF51, 0xA3F1, 0xFF52, 0xA3F2, 0xFF53, 0xA3F3, 0xFF54, 0xA3F4, - 0xFF55, 0xA3F5, 0xFF56, 0xA3F6, 0xFF57, 0xA3F7, 0xFF58, 0xA3F8, - 0xFF59, 0xA3F9, 0xFF5A, 0xA3FA, 0xFF5B, 0xA3FB, 0xFF5C, 0xA3FC, - 0xFF5D, 0xA3FD, 0xFF5E, 0xA1AB, 0xFFE0, 0xA1E9, 0xFFE1, 0xA1EA, - 0xFFE2, 0xA956, 0xFFE3, 0xA3FE, 0xFFE4, 0xA957, 0xFFE5, 0xA3A4, - 0, 0 -}; - -static -const WCHAR oem2uni[] = { -/* OEM - Unicode, OEM - Unicode, OEM - Unicode, OEM - Unicode */ - 0x0080, 0x20AC, 0x8140, 0x4E02, 0x8141, 0x4E04, 0x8142, 0x4E05, - 0x8143, 0x4E06, 0x8144, 0x4E0F, 0x8145, 0x4E12, 0x8146, 0x4E17, - 0x8147, 0x4E1F, 0x8148, 0x4E20, 0x8149, 0x4E21, 0x814A, 0x4E23, - 0x814B, 0x4E26, 0x814C, 0x4E29, 0x814D, 0x4E2E, 0x814E, 0x4E2F, - 0x814F, 0x4E31, 0x8150, 0x4E33, 0x8151, 0x4E35, 0x8152, 0x4E37, - 0x8153, 0x4E3C, 0x8154, 0x4E40, 0x8155, 0x4E41, 0x8156, 0x4E42, - 0x8157, 0x4E44, 0x8158, 0x4E46, 0x8159, 0x4E4A, 0x815A, 0x4E51, - 0x815B, 0x4E55, 0x815C, 0x4E57, 0x815D, 0x4E5A, 0x815E, 0x4E5B, - 0x815F, 0x4E62, 0x8160, 0x4E63, 0x8161, 0x4E64, 0x8162, 0x4E65, - 0x8163, 0x4E67, 0x8164, 0x4E68, 0x8165, 0x4E6A, 0x8166, 0x4E6B, - 0x8167, 0x4E6C, 0x8168, 0x4E6D, 0x8169, 0x4E6E, 0x816A, 0x4E6F, - 0x816B, 0x4E72, 0x816C, 0x4E74, 0x816D, 0x4E75, 0x816E, 0x4E76, - 0x816F, 0x4E77, 0x8170, 0x4E78, 0x8171, 0x4E79, 0x8172, 0x4E7A, - 0x8173, 0x4E7B, 0x8174, 0x4E7C, 0x8175, 0x4E7D, 0x8176, 0x4E7F, - 0x8177, 0x4E80, 0x8178, 0x4E81, 0x8179, 0x4E82, 0x817A, 0x4E83, - 0x817B, 0x4E84, 0x817C, 0x4E85, 0x817D, 0x4E87, 0x817E, 0x4E8A, - 0x8180, 0x4E90, 0x8181, 0x4E96, 0x8182, 0x4E97, 0x8183, 0x4E99, - 0x8184, 0x4E9C, 0x8185, 0x4E9D, 0x8186, 0x4E9E, 0x8187, 0x4EA3, - 0x8188, 0x4EAA, 0x8189, 0x4EAF, 0x818A, 0x4EB0, 0x818B, 0x4EB1, - 0x818C, 0x4EB4, 0x818D, 0x4EB6, 0x818E, 0x4EB7, 0x818F, 0x4EB8, - 0x8190, 0x4EB9, 0x8191, 0x4EBC, 0x8192, 0x4EBD, 0x8193, 0x4EBE, - 0x8194, 0x4EC8, 0x8195, 0x4ECC, 0x8196, 0x4ECF, 0x8197, 0x4ED0, - 0x8198, 0x4ED2, 0x8199, 0x4EDA, 0x819A, 0x4EDB, 0x819B, 0x4EDC, - 0x819C, 0x4EE0, 0x819D, 0x4EE2, 0x819E, 0x4EE6, 0x819F, 0x4EE7, - 0x81A0, 0x4EE9, 0x81A1, 0x4EED, 0x81A2, 0x4EEE, 0x81A3, 0x4EEF, - 0x81A4, 0x4EF1, 0x81A5, 0x4EF4, 0x81A6, 0x4EF8, 0x81A7, 0x4EF9, - 0x81A8, 0x4EFA, 0x81A9, 0x4EFC, 0x81AA, 0x4EFE, 0x81AB, 0x4F00, - 0x81AC, 0x4F02, 0x81AD, 0x4F03, 0x81AE, 0x4F04, 0x81AF, 0x4F05, - 0x81B0, 0x4F06, 0x81B1, 0x4F07, 0x81B2, 0x4F08, 0x81B3, 0x4F0B, - 0x81B4, 0x4F0C, 0x81B5, 0x4F12, 0x81B6, 0x4F13, 0x81B7, 0x4F14, - 0x81B8, 0x4F15, 0x81B9, 0x4F16, 0x81BA, 0x4F1C, 0x81BB, 0x4F1D, - 0x81BC, 0x4F21, 0x81BD, 0x4F23, 0x81BE, 0x4F28, 0x81BF, 0x4F29, - 0x81C0, 0x4F2C, 0x81C1, 0x4F2D, 0x81C2, 0x4F2E, 0x81C3, 0x4F31, - 0x81C4, 0x4F33, 0x81C5, 0x4F35, 0x81C6, 0x4F37, 0x81C7, 0x4F39, - 0x81C8, 0x4F3B, 0x81C9, 0x4F3E, 0x81CA, 0x4F3F, 0x81CB, 0x4F40, - 0x81CC, 0x4F41, 0x81CD, 0x4F42, 0x81CE, 0x4F44, 0x81CF, 0x4F45, - 0x81D0, 0x4F47, 0x81D1, 0x4F48, 0x81D2, 0x4F49, 0x81D3, 0x4F4A, - 0x81D4, 0x4F4B, 0x81D5, 0x4F4C, 0x81D6, 0x4F52, 0x81D7, 0x4F54, - 0x81D8, 0x4F56, 0x81D9, 0x4F61, 0x81DA, 0x4F62, 0x81DB, 0x4F66, - 0x81DC, 0x4F68, 0x81DD, 0x4F6A, 0x81DE, 0x4F6B, 0x81DF, 0x4F6D, - 0x81E0, 0x4F6E, 0x81E1, 0x4F71, 0x81E2, 0x4F72, 0x81E3, 0x4F75, - 0x81E4, 0x4F77, 0x81E5, 0x4F78, 0x81E6, 0x4F79, 0x81E7, 0x4F7A, - 0x81E8, 0x4F7D, 0x81E9, 0x4F80, 0x81EA, 0x4F81, 0x81EB, 0x4F82, - 0x81EC, 0x4F85, 0x81ED, 0x4F86, 0x81EE, 0x4F87, 0x81EF, 0x4F8A, - 0x81F0, 0x4F8C, 0x81F1, 0x4F8E, 0x81F2, 0x4F90, 0x81F3, 0x4F92, - 0x81F4, 0x4F93, 0x81F5, 0x4F95, 0x81F6, 0x4F96, 0x81F7, 0x4F98, - 0x81F8, 0x4F99, 0x81F9, 0x4F9A, 0x81FA, 0x4F9C, 0x81FB, 0x4F9E, - 0x81FC, 0x4F9F, 0x81FD, 0x4FA1, 0x81FE, 0x4FA2, 0x8240, 0x4FA4, - 0x8241, 0x4FAB, 0x8242, 0x4FAD, 0x8243, 0x4FB0, 0x8244, 0x4FB1, - 0x8245, 0x4FB2, 0x8246, 0x4FB3, 0x8247, 0x4FB4, 0x8248, 0x4FB6, - 0x8249, 0x4FB7, 0x824A, 0x4FB8, 0x824B, 0x4FB9, 0x824C, 0x4FBA, - 0x824D, 0x4FBB, 0x824E, 0x4FBC, 0x824F, 0x4FBD, 0x8250, 0x4FBE, - 0x8251, 0x4FC0, 0x8252, 0x4FC1, 0x8253, 0x4FC2, 0x8254, 0x4FC6, - 0x8255, 0x4FC7, 0x8256, 0x4FC8, 0x8257, 0x4FC9, 0x8258, 0x4FCB, - 0x8259, 0x4FCC, 0x825A, 0x4FCD, 0x825B, 0x4FD2, 0x825C, 0x4FD3, - 0x825D, 0x4FD4, 0x825E, 0x4FD5, 0x825F, 0x4FD6, 0x8260, 0x4FD9, - 0x8261, 0x4FDB, 0x8262, 0x4FE0, 0x8263, 0x4FE2, 0x8264, 0x4FE4, - 0x8265, 0x4FE5, 0x8266, 0x4FE7, 0x8267, 0x4FEB, 0x8268, 0x4FEC, - 0x8269, 0x4FF0, 0x826A, 0x4FF2, 0x826B, 0x4FF4, 0x826C, 0x4FF5, - 0x826D, 0x4FF6, 0x826E, 0x4FF7, 0x826F, 0x4FF9, 0x8270, 0x4FFB, - 0x8271, 0x4FFC, 0x8272, 0x4FFD, 0x8273, 0x4FFF, 0x8274, 0x5000, - 0x8275, 0x5001, 0x8276, 0x5002, 0x8277, 0x5003, 0x8278, 0x5004, - 0x8279, 0x5005, 0x827A, 0x5006, 0x827B, 0x5007, 0x827C, 0x5008, - 0x827D, 0x5009, 0x827E, 0x500A, 0x8280, 0x500B, 0x8281, 0x500E, - 0x8282, 0x5010, 0x8283, 0x5011, 0x8284, 0x5013, 0x8285, 0x5015, - 0x8286, 0x5016, 0x8287, 0x5017, 0x8288, 0x501B, 0x8289, 0x501D, - 0x828A, 0x501E, 0x828B, 0x5020, 0x828C, 0x5022, 0x828D, 0x5023, - 0x828E, 0x5024, 0x828F, 0x5027, 0x8290, 0x502B, 0x8291, 0x502F, - 0x8292, 0x5030, 0x8293, 0x5031, 0x8294, 0x5032, 0x8295, 0x5033, - 0x8296, 0x5034, 0x8297, 0x5035, 0x8298, 0x5036, 0x8299, 0x5037, - 0x829A, 0x5038, 0x829B, 0x5039, 0x829C, 0x503B, 0x829D, 0x503D, - 0x829E, 0x503F, 0x829F, 0x5040, 0x82A0, 0x5041, 0x82A1, 0x5042, - 0x82A2, 0x5044, 0x82A3, 0x5045, 0x82A4, 0x5046, 0x82A5, 0x5049, - 0x82A6, 0x504A, 0x82A7, 0x504B, 0x82A8, 0x504D, 0x82A9, 0x5050, - 0x82AA, 0x5051, 0x82AB, 0x5052, 0x82AC, 0x5053, 0x82AD, 0x5054, - 0x82AE, 0x5056, 0x82AF, 0x5057, 0x82B0, 0x5058, 0x82B1, 0x5059, - 0x82B2, 0x505B, 0x82B3, 0x505D, 0x82B4, 0x505E, 0x82B5, 0x505F, - 0x82B6, 0x5060, 0x82B7, 0x5061, 0x82B8, 0x5062, 0x82B9, 0x5063, - 0x82BA, 0x5064, 0x82BB, 0x5066, 0x82BC, 0x5067, 0x82BD, 0x5068, - 0x82BE, 0x5069, 0x82BF, 0x506A, 0x82C0, 0x506B, 0x82C1, 0x506D, - 0x82C2, 0x506E, 0x82C3, 0x506F, 0x82C4, 0x5070, 0x82C5, 0x5071, - 0x82C6, 0x5072, 0x82C7, 0x5073, 0x82C8, 0x5074, 0x82C9, 0x5075, - 0x82CA, 0x5078, 0x82CB, 0x5079, 0x82CC, 0x507A, 0x82CD, 0x507C, - 0x82CE, 0x507D, 0x82CF, 0x5081, 0x82D0, 0x5082, 0x82D1, 0x5083, - 0x82D2, 0x5084, 0x82D3, 0x5086, 0x82D4, 0x5087, 0x82D5, 0x5089, - 0x82D6, 0x508A, 0x82D7, 0x508B, 0x82D8, 0x508C, 0x82D9, 0x508E, - 0x82DA, 0x508F, 0x82DB, 0x5090, 0x82DC, 0x5091, 0x82DD, 0x5092, - 0x82DE, 0x5093, 0x82DF, 0x5094, 0x82E0, 0x5095, 0x82E1, 0x5096, - 0x82E2, 0x5097, 0x82E3, 0x5098, 0x82E4, 0x5099, 0x82E5, 0x509A, - 0x82E6, 0x509B, 0x82E7, 0x509C, 0x82E8, 0x509D, 0x82E9, 0x509E, - 0x82EA, 0x509F, 0x82EB, 0x50A0, 0x82EC, 0x50A1, 0x82ED, 0x50A2, - 0x82EE, 0x50A4, 0x82EF, 0x50A6, 0x82F0, 0x50AA, 0x82F1, 0x50AB, - 0x82F2, 0x50AD, 0x82F3, 0x50AE, 0x82F4, 0x50AF, 0x82F5, 0x50B0, - 0x82F6, 0x50B1, 0x82F7, 0x50B3, 0x82F8, 0x50B4, 0x82F9, 0x50B5, - 0x82FA, 0x50B6, 0x82FB, 0x50B7, 0x82FC, 0x50B8, 0x82FD, 0x50B9, - 0x82FE, 0x50BC, 0x8340, 0x50BD, 0x8341, 0x50BE, 0x8342, 0x50BF, - 0x8343, 0x50C0, 0x8344, 0x50C1, 0x8345, 0x50C2, 0x8346, 0x50C3, - 0x8347, 0x50C4, 0x8348, 0x50C5, 0x8349, 0x50C6, 0x834A, 0x50C7, - 0x834B, 0x50C8, 0x834C, 0x50C9, 0x834D, 0x50CA, 0x834E, 0x50CB, - 0x834F, 0x50CC, 0x8350, 0x50CD, 0x8351, 0x50CE, 0x8352, 0x50D0, - 0x8353, 0x50D1, 0x8354, 0x50D2, 0x8355, 0x50D3, 0x8356, 0x50D4, - 0x8357, 0x50D5, 0x8358, 0x50D7, 0x8359, 0x50D8, 0x835A, 0x50D9, - 0x835B, 0x50DB, 0x835C, 0x50DC, 0x835D, 0x50DD, 0x835E, 0x50DE, - 0x835F, 0x50DF, 0x8360, 0x50E0, 0x8361, 0x50E1, 0x8362, 0x50E2, - 0x8363, 0x50E3, 0x8364, 0x50E4, 0x8365, 0x50E5, 0x8366, 0x50E8, - 0x8367, 0x50E9, 0x8368, 0x50EA, 0x8369, 0x50EB, 0x836A, 0x50EF, - 0x836B, 0x50F0, 0x836C, 0x50F1, 0x836D, 0x50F2, 0x836E, 0x50F4, - 0x836F, 0x50F6, 0x8370, 0x50F7, 0x8371, 0x50F8, 0x8372, 0x50F9, - 0x8373, 0x50FA, 0x8374, 0x50FC, 0x8375, 0x50FD, 0x8376, 0x50FE, - 0x8377, 0x50FF, 0x8378, 0x5100, 0x8379, 0x5101, 0x837A, 0x5102, - 0x837B, 0x5103, 0x837C, 0x5104, 0x837D, 0x5105, 0x837E, 0x5108, - 0x8380, 0x5109, 0x8381, 0x510A, 0x8382, 0x510C, 0x8383, 0x510D, - 0x8384, 0x510E, 0x8385, 0x510F, 0x8386, 0x5110, 0x8387, 0x5111, - 0x8388, 0x5113, 0x8389, 0x5114, 0x838A, 0x5115, 0x838B, 0x5116, - 0x838C, 0x5117, 0x838D, 0x5118, 0x838E, 0x5119, 0x838F, 0x511A, - 0x8390, 0x511B, 0x8391, 0x511C, 0x8392, 0x511D, 0x8393, 0x511E, - 0x8394, 0x511F, 0x8395, 0x5120, 0x8396, 0x5122, 0x8397, 0x5123, - 0x8398, 0x5124, 0x8399, 0x5125, 0x839A, 0x5126, 0x839B, 0x5127, - 0x839C, 0x5128, 0x839D, 0x5129, 0x839E, 0x512A, 0x839F, 0x512B, - 0x83A0, 0x512C, 0x83A1, 0x512D, 0x83A2, 0x512E, 0x83A3, 0x512F, - 0x83A4, 0x5130, 0x83A5, 0x5131, 0x83A6, 0x5132, 0x83A7, 0x5133, - 0x83A8, 0x5134, 0x83A9, 0x5135, 0x83AA, 0x5136, 0x83AB, 0x5137, - 0x83AC, 0x5138, 0x83AD, 0x5139, 0x83AE, 0x513A, 0x83AF, 0x513B, - 0x83B0, 0x513C, 0x83B1, 0x513D, 0x83B2, 0x513E, 0x83B3, 0x5142, - 0x83B4, 0x5147, 0x83B5, 0x514A, 0x83B6, 0x514C, 0x83B7, 0x514E, - 0x83B8, 0x514F, 0x83B9, 0x5150, 0x83BA, 0x5152, 0x83BB, 0x5153, - 0x83BC, 0x5157, 0x83BD, 0x5158, 0x83BE, 0x5159, 0x83BF, 0x515B, - 0x83C0, 0x515D, 0x83C1, 0x515E, 0x83C2, 0x515F, 0x83C3, 0x5160, - 0x83C4, 0x5161, 0x83C5, 0x5163, 0x83C6, 0x5164, 0x83C7, 0x5166, - 0x83C8, 0x5167, 0x83C9, 0x5169, 0x83CA, 0x516A, 0x83CB, 0x516F, - 0x83CC, 0x5172, 0x83CD, 0x517A, 0x83CE, 0x517E, 0x83CF, 0x517F, - 0x83D0, 0x5183, 0x83D1, 0x5184, 0x83D2, 0x5186, 0x83D3, 0x5187, - 0x83D4, 0x518A, 0x83D5, 0x518B, 0x83D6, 0x518E, 0x83D7, 0x518F, - 0x83D8, 0x5190, 0x83D9, 0x5191, 0x83DA, 0x5193, 0x83DB, 0x5194, - 0x83DC, 0x5198, 0x83DD, 0x519A, 0x83DE, 0x519D, 0x83DF, 0x519E, - 0x83E0, 0x519F, 0x83E1, 0x51A1, 0x83E2, 0x51A3, 0x83E3, 0x51A6, - 0x83E4, 0x51A7, 0x83E5, 0x51A8, 0x83E6, 0x51A9, 0x83E7, 0x51AA, - 0x83E8, 0x51AD, 0x83E9, 0x51AE, 0x83EA, 0x51B4, 0x83EB, 0x51B8, - 0x83EC, 0x51B9, 0x83ED, 0x51BA, 0x83EE, 0x51BE, 0x83EF, 0x51BF, - 0x83F0, 0x51C1, 0x83F1, 0x51C2, 0x83F2, 0x51C3, 0x83F3, 0x51C5, - 0x83F4, 0x51C8, 0x83F5, 0x51CA, 0x83F6, 0x51CD, 0x83F7, 0x51CE, - 0x83F8, 0x51D0, 0x83F9, 0x51D2, 0x83FA, 0x51D3, 0x83FB, 0x51D4, - 0x83FC, 0x51D5, 0x83FD, 0x51D6, 0x83FE, 0x51D7, 0x8440, 0x51D8, - 0x8441, 0x51D9, 0x8442, 0x51DA, 0x8443, 0x51DC, 0x8444, 0x51DE, - 0x8445, 0x51DF, 0x8446, 0x51E2, 0x8447, 0x51E3, 0x8448, 0x51E5, - 0x8449, 0x51E6, 0x844A, 0x51E7, 0x844B, 0x51E8, 0x844C, 0x51E9, - 0x844D, 0x51EA, 0x844E, 0x51EC, 0x844F, 0x51EE, 0x8450, 0x51F1, - 0x8451, 0x51F2, 0x8452, 0x51F4, 0x8453, 0x51F7, 0x8454, 0x51FE, - 0x8455, 0x5204, 0x8456, 0x5205, 0x8457, 0x5209, 0x8458, 0x520B, - 0x8459, 0x520C, 0x845A, 0x520F, 0x845B, 0x5210, 0x845C, 0x5213, - 0x845D, 0x5214, 0x845E, 0x5215, 0x845F, 0x521C, 0x8460, 0x521E, - 0x8461, 0x521F, 0x8462, 0x5221, 0x8463, 0x5222, 0x8464, 0x5223, - 0x8465, 0x5225, 0x8466, 0x5226, 0x8467, 0x5227, 0x8468, 0x522A, - 0x8469, 0x522C, 0x846A, 0x522F, 0x846B, 0x5231, 0x846C, 0x5232, - 0x846D, 0x5234, 0x846E, 0x5235, 0x846F, 0x523C, 0x8470, 0x523E, - 0x8471, 0x5244, 0x8472, 0x5245, 0x8473, 0x5246, 0x8474, 0x5247, - 0x8475, 0x5248, 0x8476, 0x5249, 0x8477, 0x524B, 0x8478, 0x524E, - 0x8479, 0x524F, 0x847A, 0x5252, 0x847B, 0x5253, 0x847C, 0x5255, - 0x847D, 0x5257, 0x847E, 0x5258, 0x8480, 0x5259, 0x8481, 0x525A, - 0x8482, 0x525B, 0x8483, 0x525D, 0x8484, 0x525F, 0x8485, 0x5260, - 0x8486, 0x5262, 0x8487, 0x5263, 0x8488, 0x5264, 0x8489, 0x5266, - 0x848A, 0x5268, 0x848B, 0x526B, 0x848C, 0x526C, 0x848D, 0x526D, - 0x848E, 0x526E, 0x848F, 0x5270, 0x8490, 0x5271, 0x8491, 0x5273, - 0x8492, 0x5274, 0x8493, 0x5275, 0x8494, 0x5276, 0x8495, 0x5277, - 0x8496, 0x5278, 0x8497, 0x5279, 0x8498, 0x527A, 0x8499, 0x527B, - 0x849A, 0x527C, 0x849B, 0x527E, 0x849C, 0x5280, 0x849D, 0x5283, - 0x849E, 0x5284, 0x849F, 0x5285, 0x84A0, 0x5286, 0x84A1, 0x5287, - 0x84A2, 0x5289, 0x84A3, 0x528A, 0x84A4, 0x528B, 0x84A5, 0x528C, - 0x84A6, 0x528D, 0x84A7, 0x528E, 0x84A8, 0x528F, 0x84A9, 0x5291, - 0x84AA, 0x5292, 0x84AB, 0x5294, 0x84AC, 0x5295, 0x84AD, 0x5296, - 0x84AE, 0x5297, 0x84AF, 0x5298, 0x84B0, 0x5299, 0x84B1, 0x529A, - 0x84B2, 0x529C, 0x84B3, 0x52A4, 0x84B4, 0x52A5, 0x84B5, 0x52A6, - 0x84B6, 0x52A7, 0x84B7, 0x52AE, 0x84B8, 0x52AF, 0x84B9, 0x52B0, - 0x84BA, 0x52B4, 0x84BB, 0x52B5, 0x84BC, 0x52B6, 0x84BD, 0x52B7, - 0x84BE, 0x52B8, 0x84BF, 0x52B9, 0x84C0, 0x52BA, 0x84C1, 0x52BB, - 0x84C2, 0x52BC, 0x84C3, 0x52BD, 0x84C4, 0x52C0, 0x84C5, 0x52C1, - 0x84C6, 0x52C2, 0x84C7, 0x52C4, 0x84C8, 0x52C5, 0x84C9, 0x52C6, - 0x84CA, 0x52C8, 0x84CB, 0x52CA, 0x84CC, 0x52CC, 0x84CD, 0x52CD, - 0x84CE, 0x52CE, 0x84CF, 0x52CF, 0x84D0, 0x52D1, 0x84D1, 0x52D3, - 0x84D2, 0x52D4, 0x84D3, 0x52D5, 0x84D4, 0x52D7, 0x84D5, 0x52D9, - 0x84D6, 0x52DA, 0x84D7, 0x52DB, 0x84D8, 0x52DC, 0x84D9, 0x52DD, - 0x84DA, 0x52DE, 0x84DB, 0x52E0, 0x84DC, 0x52E1, 0x84DD, 0x52E2, - 0x84DE, 0x52E3, 0x84DF, 0x52E5, 0x84E0, 0x52E6, 0x84E1, 0x52E7, - 0x84E2, 0x52E8, 0x84E3, 0x52E9, 0x84E4, 0x52EA, 0x84E5, 0x52EB, - 0x84E6, 0x52EC, 0x84E7, 0x52ED, 0x84E8, 0x52EE, 0x84E9, 0x52EF, - 0x84EA, 0x52F1, 0x84EB, 0x52F2, 0x84EC, 0x52F3, 0x84ED, 0x52F4, - 0x84EE, 0x52F5, 0x84EF, 0x52F6, 0x84F0, 0x52F7, 0x84F1, 0x52F8, - 0x84F2, 0x52FB, 0x84F3, 0x52FC, 0x84F4, 0x52FD, 0x84F5, 0x5301, - 0x84F6, 0x5302, 0x84F7, 0x5303, 0x84F8, 0x5304, 0x84F9, 0x5307, - 0x84FA, 0x5309, 0x84FB, 0x530A, 0x84FC, 0x530B, 0x84FD, 0x530C, - 0x84FE, 0x530E, 0x8540, 0x5311, 0x8541, 0x5312, 0x8542, 0x5313, - 0x8543, 0x5314, 0x8544, 0x5318, 0x8545, 0x531B, 0x8546, 0x531C, - 0x8547, 0x531E, 0x8548, 0x531F, 0x8549, 0x5322, 0x854A, 0x5324, - 0x854B, 0x5325, 0x854C, 0x5327, 0x854D, 0x5328, 0x854E, 0x5329, - 0x854F, 0x532B, 0x8550, 0x532C, 0x8551, 0x532D, 0x8552, 0x532F, - 0x8553, 0x5330, 0x8554, 0x5331, 0x8555, 0x5332, 0x8556, 0x5333, - 0x8557, 0x5334, 0x8558, 0x5335, 0x8559, 0x5336, 0x855A, 0x5337, - 0x855B, 0x5338, 0x855C, 0x533C, 0x855D, 0x533D, 0x855E, 0x5340, - 0x855F, 0x5342, 0x8560, 0x5344, 0x8561, 0x5346, 0x8562, 0x534B, - 0x8563, 0x534C, 0x8564, 0x534D, 0x8565, 0x5350, 0x8566, 0x5354, - 0x8567, 0x5358, 0x8568, 0x5359, 0x8569, 0x535B, 0x856A, 0x535D, - 0x856B, 0x5365, 0x856C, 0x5368, 0x856D, 0x536A, 0x856E, 0x536C, - 0x856F, 0x536D, 0x8570, 0x5372, 0x8571, 0x5376, 0x8572, 0x5379, - 0x8573, 0x537B, 0x8574, 0x537C, 0x8575, 0x537D, 0x8576, 0x537E, - 0x8577, 0x5380, 0x8578, 0x5381, 0x8579, 0x5383, 0x857A, 0x5387, - 0x857B, 0x5388, 0x857C, 0x538A, 0x857D, 0x538E, 0x857E, 0x538F, - 0x8580, 0x5390, 0x8581, 0x5391, 0x8582, 0x5392, 0x8583, 0x5393, - 0x8584, 0x5394, 0x8585, 0x5396, 0x8586, 0x5397, 0x8587, 0x5399, - 0x8588, 0x539B, 0x8589, 0x539C, 0x858A, 0x539E, 0x858B, 0x53A0, - 0x858C, 0x53A1, 0x858D, 0x53A4, 0x858E, 0x53A7, 0x858F, 0x53AA, - 0x8590, 0x53AB, 0x8591, 0x53AC, 0x8592, 0x53AD, 0x8593, 0x53AF, - 0x8594, 0x53B0, 0x8595, 0x53B1, 0x8596, 0x53B2, 0x8597, 0x53B3, - 0x8598, 0x53B4, 0x8599, 0x53B5, 0x859A, 0x53B7, 0x859B, 0x53B8, - 0x859C, 0x53B9, 0x859D, 0x53BA, 0x859E, 0x53BC, 0x859F, 0x53BD, - 0x85A0, 0x53BE, 0x85A1, 0x53C0, 0x85A2, 0x53C3, 0x85A3, 0x53C4, - 0x85A4, 0x53C5, 0x85A5, 0x53C6, 0x85A6, 0x53C7, 0x85A7, 0x53CE, - 0x85A8, 0x53CF, 0x85A9, 0x53D0, 0x85AA, 0x53D2, 0x85AB, 0x53D3, - 0x85AC, 0x53D5, 0x85AD, 0x53DA, 0x85AE, 0x53DC, 0x85AF, 0x53DD, - 0x85B0, 0x53DE, 0x85B1, 0x53E1, 0x85B2, 0x53E2, 0x85B3, 0x53E7, - 0x85B4, 0x53F4, 0x85B5, 0x53FA, 0x85B6, 0x53FE, 0x85B7, 0x53FF, - 0x85B8, 0x5400, 0x85B9, 0x5402, 0x85BA, 0x5405, 0x85BB, 0x5407, - 0x85BC, 0x540B, 0x85BD, 0x5414, 0x85BE, 0x5418, 0x85BF, 0x5419, - 0x85C0, 0x541A, 0x85C1, 0x541C, 0x85C2, 0x5422, 0x85C3, 0x5424, - 0x85C4, 0x5425, 0x85C5, 0x542A, 0x85C6, 0x5430, 0x85C7, 0x5433, - 0x85C8, 0x5436, 0x85C9, 0x5437, 0x85CA, 0x543A, 0x85CB, 0x543D, - 0x85CC, 0x543F, 0x85CD, 0x5441, 0x85CE, 0x5442, 0x85CF, 0x5444, - 0x85D0, 0x5445, 0x85D1, 0x5447, 0x85D2, 0x5449, 0x85D3, 0x544C, - 0x85D4, 0x544D, 0x85D5, 0x544E, 0x85D6, 0x544F, 0x85D7, 0x5451, - 0x85D8, 0x545A, 0x85D9, 0x545D, 0x85DA, 0x545E, 0x85DB, 0x545F, - 0x85DC, 0x5460, 0x85DD, 0x5461, 0x85DE, 0x5463, 0x85DF, 0x5465, - 0x85E0, 0x5467, 0x85E1, 0x5469, 0x85E2, 0x546A, 0x85E3, 0x546B, - 0x85E4, 0x546C, 0x85E5, 0x546D, 0x85E6, 0x546E, 0x85E7, 0x546F, - 0x85E8, 0x5470, 0x85E9, 0x5474, 0x85EA, 0x5479, 0x85EB, 0x547A, - 0x85EC, 0x547E, 0x85ED, 0x547F, 0x85EE, 0x5481, 0x85EF, 0x5483, - 0x85F0, 0x5485, 0x85F1, 0x5487, 0x85F2, 0x5488, 0x85F3, 0x5489, - 0x85F4, 0x548A, 0x85F5, 0x548D, 0x85F6, 0x5491, 0x85F7, 0x5493, - 0x85F8, 0x5497, 0x85F9, 0x5498, 0x85FA, 0x549C, 0x85FB, 0x549E, - 0x85FC, 0x549F, 0x85FD, 0x54A0, 0x85FE, 0x54A1, 0x8640, 0x54A2, - 0x8641, 0x54A5, 0x8642, 0x54AE, 0x8643, 0x54B0, 0x8644, 0x54B2, - 0x8645, 0x54B5, 0x8646, 0x54B6, 0x8647, 0x54B7, 0x8648, 0x54B9, - 0x8649, 0x54BA, 0x864A, 0x54BC, 0x864B, 0x54BE, 0x864C, 0x54C3, - 0x864D, 0x54C5, 0x864E, 0x54CA, 0x864F, 0x54CB, 0x8650, 0x54D6, - 0x8651, 0x54D8, 0x8652, 0x54DB, 0x8653, 0x54E0, 0x8654, 0x54E1, - 0x8655, 0x54E2, 0x8656, 0x54E3, 0x8657, 0x54E4, 0x8658, 0x54EB, - 0x8659, 0x54EC, 0x865A, 0x54EF, 0x865B, 0x54F0, 0x865C, 0x54F1, - 0x865D, 0x54F4, 0x865E, 0x54F5, 0x865F, 0x54F6, 0x8660, 0x54F7, - 0x8661, 0x54F8, 0x8662, 0x54F9, 0x8663, 0x54FB, 0x8664, 0x54FE, - 0x8665, 0x5500, 0x8666, 0x5502, 0x8667, 0x5503, 0x8668, 0x5504, - 0x8669, 0x5505, 0x866A, 0x5508, 0x866B, 0x550A, 0x866C, 0x550B, - 0x866D, 0x550C, 0x866E, 0x550D, 0x866F, 0x550E, 0x8670, 0x5512, - 0x8671, 0x5513, 0x8672, 0x5515, 0x8673, 0x5516, 0x8674, 0x5517, - 0x8675, 0x5518, 0x8676, 0x5519, 0x8677, 0x551A, 0x8678, 0x551C, - 0x8679, 0x551D, 0x867A, 0x551E, 0x867B, 0x551F, 0x867C, 0x5521, - 0x867D, 0x5525, 0x867E, 0x5526, 0x8680, 0x5528, 0x8681, 0x5529, - 0x8682, 0x552B, 0x8683, 0x552D, 0x8684, 0x5532, 0x8685, 0x5534, - 0x8686, 0x5535, 0x8687, 0x5536, 0x8688, 0x5538, 0x8689, 0x5539, - 0x868A, 0x553A, 0x868B, 0x553B, 0x868C, 0x553D, 0x868D, 0x5540, - 0x868E, 0x5542, 0x868F, 0x5545, 0x8690, 0x5547, 0x8691, 0x5548, - 0x8692, 0x554B, 0x8693, 0x554C, 0x8694, 0x554D, 0x8695, 0x554E, - 0x8696, 0x554F, 0x8697, 0x5551, 0x8698, 0x5552, 0x8699, 0x5553, - 0x869A, 0x5554, 0x869B, 0x5557, 0x869C, 0x5558, 0x869D, 0x5559, - 0x869E, 0x555A, 0x869F, 0x555B, 0x86A0, 0x555D, 0x86A1, 0x555E, - 0x86A2, 0x555F, 0x86A3, 0x5560, 0x86A4, 0x5562, 0x86A5, 0x5563, - 0x86A6, 0x5568, 0x86A7, 0x5569, 0x86A8, 0x556B, 0x86A9, 0x556F, - 0x86AA, 0x5570, 0x86AB, 0x5571, 0x86AC, 0x5572, 0x86AD, 0x5573, - 0x86AE, 0x5574, 0x86AF, 0x5579, 0x86B0, 0x557A, 0x86B1, 0x557D, - 0x86B2, 0x557F, 0x86B3, 0x5585, 0x86B4, 0x5586, 0x86B5, 0x558C, - 0x86B6, 0x558D, 0x86B7, 0x558E, 0x86B8, 0x5590, 0x86B9, 0x5592, - 0x86BA, 0x5593, 0x86BB, 0x5595, 0x86BC, 0x5596, 0x86BD, 0x5597, - 0x86BE, 0x559A, 0x86BF, 0x559B, 0x86C0, 0x559E, 0x86C1, 0x55A0, - 0x86C2, 0x55A1, 0x86C3, 0x55A2, 0x86C4, 0x55A3, 0x86C5, 0x55A4, - 0x86C6, 0x55A5, 0x86C7, 0x55A6, 0x86C8, 0x55A8, 0x86C9, 0x55A9, - 0x86CA, 0x55AA, 0x86CB, 0x55AB, 0x86CC, 0x55AC, 0x86CD, 0x55AD, - 0x86CE, 0x55AE, 0x86CF, 0x55AF, 0x86D0, 0x55B0, 0x86D1, 0x55B2, - 0x86D2, 0x55B4, 0x86D3, 0x55B6, 0x86D4, 0x55B8, 0x86D5, 0x55BA, - 0x86D6, 0x55BC, 0x86D7, 0x55BF, 0x86D8, 0x55C0, 0x86D9, 0x55C1, - 0x86DA, 0x55C2, 0x86DB, 0x55C3, 0x86DC, 0x55C6, 0x86DD, 0x55C7, - 0x86DE, 0x55C8, 0x86DF, 0x55CA, 0x86E0, 0x55CB, 0x86E1, 0x55CE, - 0x86E2, 0x55CF, 0x86E3, 0x55D0, 0x86E4, 0x55D5, 0x86E5, 0x55D7, - 0x86E6, 0x55D8, 0x86E7, 0x55D9, 0x86E8, 0x55DA, 0x86E9, 0x55DB, - 0x86EA, 0x55DE, 0x86EB, 0x55E0, 0x86EC, 0x55E2, 0x86ED, 0x55E7, - 0x86EE, 0x55E9, 0x86EF, 0x55ED, 0x86F0, 0x55EE, 0x86F1, 0x55F0, - 0x86F2, 0x55F1, 0x86F3, 0x55F4, 0x86F4, 0x55F6, 0x86F5, 0x55F8, - 0x86F6, 0x55F9, 0x86F7, 0x55FA, 0x86F8, 0x55FB, 0x86F9, 0x55FC, - 0x86FA, 0x55FF, 0x86FB, 0x5602, 0x86FC, 0x5603, 0x86FD, 0x5604, - 0x86FE, 0x5605, 0x8740, 0x5606, 0x8741, 0x5607, 0x8742, 0x560A, - 0x8743, 0x560B, 0x8744, 0x560D, 0x8745, 0x5610, 0x8746, 0x5611, - 0x8747, 0x5612, 0x8748, 0x5613, 0x8749, 0x5614, 0x874A, 0x5615, - 0x874B, 0x5616, 0x874C, 0x5617, 0x874D, 0x5619, 0x874E, 0x561A, - 0x874F, 0x561C, 0x8750, 0x561D, 0x8751, 0x5620, 0x8752, 0x5621, - 0x8753, 0x5622, 0x8754, 0x5625, 0x8755, 0x5626, 0x8756, 0x5628, - 0x8757, 0x5629, 0x8758, 0x562A, 0x8759, 0x562B, 0x875A, 0x562E, - 0x875B, 0x562F, 0x875C, 0x5630, 0x875D, 0x5633, 0x875E, 0x5635, - 0x875F, 0x5637, 0x8760, 0x5638, 0x8761, 0x563A, 0x8762, 0x563C, - 0x8763, 0x563D, 0x8764, 0x563E, 0x8765, 0x5640, 0x8766, 0x5641, - 0x8767, 0x5642, 0x8768, 0x5643, 0x8769, 0x5644, 0x876A, 0x5645, - 0x876B, 0x5646, 0x876C, 0x5647, 0x876D, 0x5648, 0x876E, 0x5649, - 0x876F, 0x564A, 0x8770, 0x564B, 0x8771, 0x564F, 0x8772, 0x5650, - 0x8773, 0x5651, 0x8774, 0x5652, 0x8775, 0x5653, 0x8776, 0x5655, - 0x8777, 0x5656, 0x8778, 0x565A, 0x8779, 0x565B, 0x877A, 0x565D, - 0x877B, 0x565E, 0x877C, 0x565F, 0x877D, 0x5660, 0x877E, 0x5661, - 0x8780, 0x5663, 0x8781, 0x5665, 0x8782, 0x5666, 0x8783, 0x5667, - 0x8784, 0x566D, 0x8785, 0x566E, 0x8786, 0x566F, 0x8787, 0x5670, - 0x8788, 0x5672, 0x8789, 0x5673, 0x878A, 0x5674, 0x878B, 0x5675, - 0x878C, 0x5677, 0x878D, 0x5678, 0x878E, 0x5679, 0x878F, 0x567A, - 0x8790, 0x567D, 0x8791, 0x567E, 0x8792, 0x567F, 0x8793, 0x5680, - 0x8794, 0x5681, 0x8795, 0x5682, 0x8796, 0x5683, 0x8797, 0x5684, - 0x8798, 0x5687, 0x8799, 0x5688, 0x879A, 0x5689, 0x879B, 0x568A, - 0x879C, 0x568B, 0x879D, 0x568C, 0x879E, 0x568D, 0x879F, 0x5690, - 0x87A0, 0x5691, 0x87A1, 0x5692, 0x87A2, 0x5694, 0x87A3, 0x5695, - 0x87A4, 0x5696, 0x87A5, 0x5697, 0x87A6, 0x5698, 0x87A7, 0x5699, - 0x87A8, 0x569A, 0x87A9, 0x569B, 0x87AA, 0x569C, 0x87AB, 0x569D, - 0x87AC, 0x569E, 0x87AD, 0x569F, 0x87AE, 0x56A0, 0x87AF, 0x56A1, - 0x87B0, 0x56A2, 0x87B1, 0x56A4, 0x87B2, 0x56A5, 0x87B3, 0x56A6, - 0x87B4, 0x56A7, 0x87B5, 0x56A8, 0x87B6, 0x56A9, 0x87B7, 0x56AA, - 0x87B8, 0x56AB, 0x87B9, 0x56AC, 0x87BA, 0x56AD, 0x87BB, 0x56AE, - 0x87BC, 0x56B0, 0x87BD, 0x56B1, 0x87BE, 0x56B2, 0x87BF, 0x56B3, - 0x87C0, 0x56B4, 0x87C1, 0x56B5, 0x87C2, 0x56B6, 0x87C3, 0x56B8, - 0x87C4, 0x56B9, 0x87C5, 0x56BA, 0x87C6, 0x56BB, 0x87C7, 0x56BD, - 0x87C8, 0x56BE, 0x87C9, 0x56BF, 0x87CA, 0x56C0, 0x87CB, 0x56C1, - 0x87CC, 0x56C2, 0x87CD, 0x56C3, 0x87CE, 0x56C4, 0x87CF, 0x56C5, - 0x87D0, 0x56C6, 0x87D1, 0x56C7, 0x87D2, 0x56C8, 0x87D3, 0x56C9, - 0x87D4, 0x56CB, 0x87D5, 0x56CC, 0x87D6, 0x56CD, 0x87D7, 0x56CE, - 0x87D8, 0x56CF, 0x87D9, 0x56D0, 0x87DA, 0x56D1, 0x87DB, 0x56D2, - 0x87DC, 0x56D3, 0x87DD, 0x56D5, 0x87DE, 0x56D6, 0x87DF, 0x56D8, - 0x87E0, 0x56D9, 0x87E1, 0x56DC, 0x87E2, 0x56E3, 0x87E3, 0x56E5, - 0x87E4, 0x56E6, 0x87E5, 0x56E7, 0x87E6, 0x56E8, 0x87E7, 0x56E9, - 0x87E8, 0x56EA, 0x87E9, 0x56EC, 0x87EA, 0x56EE, 0x87EB, 0x56EF, - 0x87EC, 0x56F2, 0x87ED, 0x56F3, 0x87EE, 0x56F6, 0x87EF, 0x56F7, - 0x87F0, 0x56F8, 0x87F1, 0x56FB, 0x87F2, 0x56FC, 0x87F3, 0x5700, - 0x87F4, 0x5701, 0x87F5, 0x5702, 0x87F6, 0x5705, 0x87F7, 0x5707, - 0x87F8, 0x570B, 0x87F9, 0x570C, 0x87FA, 0x570D, 0x87FB, 0x570E, - 0x87FC, 0x570F, 0x87FD, 0x5710, 0x87FE, 0x5711, 0x8840, 0x5712, - 0x8841, 0x5713, 0x8842, 0x5714, 0x8843, 0x5715, 0x8844, 0x5716, - 0x8845, 0x5717, 0x8846, 0x5718, 0x8847, 0x5719, 0x8848, 0x571A, - 0x8849, 0x571B, 0x884A, 0x571D, 0x884B, 0x571E, 0x884C, 0x5720, - 0x884D, 0x5721, 0x884E, 0x5722, 0x884F, 0x5724, 0x8850, 0x5725, - 0x8851, 0x5726, 0x8852, 0x5727, 0x8853, 0x572B, 0x8854, 0x5731, - 0x8855, 0x5732, 0x8856, 0x5734, 0x8857, 0x5735, 0x8858, 0x5736, - 0x8859, 0x5737, 0x885A, 0x5738, 0x885B, 0x573C, 0x885C, 0x573D, - 0x885D, 0x573F, 0x885E, 0x5741, 0x885F, 0x5743, 0x8860, 0x5744, - 0x8861, 0x5745, 0x8862, 0x5746, 0x8863, 0x5748, 0x8864, 0x5749, - 0x8865, 0x574B, 0x8866, 0x5752, 0x8867, 0x5753, 0x8868, 0x5754, - 0x8869, 0x5755, 0x886A, 0x5756, 0x886B, 0x5758, 0x886C, 0x5759, - 0x886D, 0x5762, 0x886E, 0x5763, 0x886F, 0x5765, 0x8870, 0x5767, - 0x8871, 0x576C, 0x8872, 0x576E, 0x8873, 0x5770, 0x8874, 0x5771, - 0x8875, 0x5772, 0x8876, 0x5774, 0x8877, 0x5775, 0x8878, 0x5778, - 0x8879, 0x5779, 0x887A, 0x577A, 0x887B, 0x577D, 0x887C, 0x577E, - 0x887D, 0x577F, 0x887E, 0x5780, 0x8880, 0x5781, 0x8881, 0x5787, - 0x8882, 0x5788, 0x8883, 0x5789, 0x8884, 0x578A, 0x8885, 0x578D, - 0x8886, 0x578E, 0x8887, 0x578F, 0x8888, 0x5790, 0x8889, 0x5791, - 0x888A, 0x5794, 0x888B, 0x5795, 0x888C, 0x5796, 0x888D, 0x5797, - 0x888E, 0x5798, 0x888F, 0x5799, 0x8890, 0x579A, 0x8891, 0x579C, - 0x8892, 0x579D, 0x8893, 0x579E, 0x8894, 0x579F, 0x8895, 0x57A5, - 0x8896, 0x57A8, 0x8897, 0x57AA, 0x8898, 0x57AC, 0x8899, 0x57AF, - 0x889A, 0x57B0, 0x889B, 0x57B1, 0x889C, 0x57B3, 0x889D, 0x57B5, - 0x889E, 0x57B6, 0x889F, 0x57B7, 0x88A0, 0x57B9, 0x88A1, 0x57BA, - 0x88A2, 0x57BB, 0x88A3, 0x57BC, 0x88A4, 0x57BD, 0x88A5, 0x57BE, - 0x88A6, 0x57BF, 0x88A7, 0x57C0, 0x88A8, 0x57C1, 0x88A9, 0x57C4, - 0x88AA, 0x57C5, 0x88AB, 0x57C6, 0x88AC, 0x57C7, 0x88AD, 0x57C8, - 0x88AE, 0x57C9, 0x88AF, 0x57CA, 0x88B0, 0x57CC, 0x88B1, 0x57CD, - 0x88B2, 0x57D0, 0x88B3, 0x57D1, 0x88B4, 0x57D3, 0x88B5, 0x57D6, - 0x88B6, 0x57D7, 0x88B7, 0x57DB, 0x88B8, 0x57DC, 0x88B9, 0x57DE, - 0x88BA, 0x57E1, 0x88BB, 0x57E2, 0x88BC, 0x57E3, 0x88BD, 0x57E5, - 0x88BE, 0x57E6, 0x88BF, 0x57E7, 0x88C0, 0x57E8, 0x88C1, 0x57E9, - 0x88C2, 0x57EA, 0x88C3, 0x57EB, 0x88C4, 0x57EC, 0x88C5, 0x57EE, - 0x88C6, 0x57F0, 0x88C7, 0x57F1, 0x88C8, 0x57F2, 0x88C9, 0x57F3, - 0x88CA, 0x57F5, 0x88CB, 0x57F6, 0x88CC, 0x57F7, 0x88CD, 0x57FB, - 0x88CE, 0x57FC, 0x88CF, 0x57FE, 0x88D0, 0x57FF, 0x88D1, 0x5801, - 0x88D2, 0x5803, 0x88D3, 0x5804, 0x88D4, 0x5805, 0x88D5, 0x5808, - 0x88D6, 0x5809, 0x88D7, 0x580A, 0x88D8, 0x580C, 0x88D9, 0x580E, - 0x88DA, 0x580F, 0x88DB, 0x5810, 0x88DC, 0x5812, 0x88DD, 0x5813, - 0x88DE, 0x5814, 0x88DF, 0x5816, 0x88E0, 0x5817, 0x88E1, 0x5818, - 0x88E2, 0x581A, 0x88E3, 0x581B, 0x88E4, 0x581C, 0x88E5, 0x581D, - 0x88E6, 0x581F, 0x88E7, 0x5822, 0x88E8, 0x5823, 0x88E9, 0x5825, - 0x88EA, 0x5826, 0x88EB, 0x5827, 0x88EC, 0x5828, 0x88ED, 0x5829, - 0x88EE, 0x582B, 0x88EF, 0x582C, 0x88F0, 0x582D, 0x88F1, 0x582E, - 0x88F2, 0x582F, 0x88F3, 0x5831, 0x88F4, 0x5832, 0x88F5, 0x5833, - 0x88F6, 0x5834, 0x88F7, 0x5836, 0x88F8, 0x5837, 0x88F9, 0x5838, - 0x88FA, 0x5839, 0x88FB, 0x583A, 0x88FC, 0x583B, 0x88FD, 0x583C, - 0x88FE, 0x583D, 0x8940, 0x583E, 0x8941, 0x583F, 0x8942, 0x5840, - 0x8943, 0x5841, 0x8944, 0x5842, 0x8945, 0x5843, 0x8946, 0x5845, - 0x8947, 0x5846, 0x8948, 0x5847, 0x8949, 0x5848, 0x894A, 0x5849, - 0x894B, 0x584A, 0x894C, 0x584B, 0x894D, 0x584E, 0x894E, 0x584F, - 0x894F, 0x5850, 0x8950, 0x5852, 0x8951, 0x5853, 0x8952, 0x5855, - 0x8953, 0x5856, 0x8954, 0x5857, 0x8955, 0x5859, 0x8956, 0x585A, - 0x8957, 0x585B, 0x8958, 0x585C, 0x8959, 0x585D, 0x895A, 0x585F, - 0x895B, 0x5860, 0x895C, 0x5861, 0x895D, 0x5862, 0x895E, 0x5863, - 0x895F, 0x5864, 0x8960, 0x5866, 0x8961, 0x5867, 0x8962, 0x5868, - 0x8963, 0x5869, 0x8964, 0x586A, 0x8965, 0x586D, 0x8966, 0x586E, - 0x8967, 0x586F, 0x8968, 0x5870, 0x8969, 0x5871, 0x896A, 0x5872, - 0x896B, 0x5873, 0x896C, 0x5874, 0x896D, 0x5875, 0x896E, 0x5876, - 0x896F, 0x5877, 0x8970, 0x5878, 0x8971, 0x5879, 0x8972, 0x587A, - 0x8973, 0x587B, 0x8974, 0x587C, 0x8975, 0x587D, 0x8976, 0x587F, - 0x8977, 0x5882, 0x8978, 0x5884, 0x8979, 0x5886, 0x897A, 0x5887, - 0x897B, 0x5888, 0x897C, 0x588A, 0x897D, 0x588B, 0x897E, 0x588C, - 0x8980, 0x588D, 0x8981, 0x588E, 0x8982, 0x588F, 0x8983, 0x5890, - 0x8984, 0x5891, 0x8985, 0x5894, 0x8986, 0x5895, 0x8987, 0x5896, - 0x8988, 0x5897, 0x8989, 0x5898, 0x898A, 0x589B, 0x898B, 0x589C, - 0x898C, 0x589D, 0x898D, 0x58A0, 0x898E, 0x58A1, 0x898F, 0x58A2, - 0x8990, 0x58A3, 0x8991, 0x58A4, 0x8992, 0x58A5, 0x8993, 0x58A6, - 0x8994, 0x58A7, 0x8995, 0x58AA, 0x8996, 0x58AB, 0x8997, 0x58AC, - 0x8998, 0x58AD, 0x8999, 0x58AE, 0x899A, 0x58AF, 0x899B, 0x58B0, - 0x899C, 0x58B1, 0x899D, 0x58B2, 0x899E, 0x58B3, 0x899F, 0x58B4, - 0x89A0, 0x58B5, 0x89A1, 0x58B6, 0x89A2, 0x58B7, 0x89A3, 0x58B8, - 0x89A4, 0x58B9, 0x89A5, 0x58BA, 0x89A6, 0x58BB, 0x89A7, 0x58BD, - 0x89A8, 0x58BE, 0x89A9, 0x58BF, 0x89AA, 0x58C0, 0x89AB, 0x58C2, - 0x89AC, 0x58C3, 0x89AD, 0x58C4, 0x89AE, 0x58C6, 0x89AF, 0x58C7, - 0x89B0, 0x58C8, 0x89B1, 0x58C9, 0x89B2, 0x58CA, 0x89B3, 0x58CB, - 0x89B4, 0x58CC, 0x89B5, 0x58CD, 0x89B6, 0x58CE, 0x89B7, 0x58CF, - 0x89B8, 0x58D0, 0x89B9, 0x58D2, 0x89BA, 0x58D3, 0x89BB, 0x58D4, - 0x89BC, 0x58D6, 0x89BD, 0x58D7, 0x89BE, 0x58D8, 0x89BF, 0x58D9, - 0x89C0, 0x58DA, 0x89C1, 0x58DB, 0x89C2, 0x58DC, 0x89C3, 0x58DD, - 0x89C4, 0x58DE, 0x89C5, 0x58DF, 0x89C6, 0x58E0, 0x89C7, 0x58E1, - 0x89C8, 0x58E2, 0x89C9, 0x58E3, 0x89CA, 0x58E5, 0x89CB, 0x58E6, - 0x89CC, 0x58E7, 0x89CD, 0x58E8, 0x89CE, 0x58E9, 0x89CF, 0x58EA, - 0x89D0, 0x58ED, 0x89D1, 0x58EF, 0x89D2, 0x58F1, 0x89D3, 0x58F2, - 0x89D4, 0x58F4, 0x89D5, 0x58F5, 0x89D6, 0x58F7, 0x89D7, 0x58F8, - 0x89D8, 0x58FA, 0x89D9, 0x58FB, 0x89DA, 0x58FC, 0x89DB, 0x58FD, - 0x89DC, 0x58FE, 0x89DD, 0x58FF, 0x89DE, 0x5900, 0x89DF, 0x5901, - 0x89E0, 0x5903, 0x89E1, 0x5905, 0x89E2, 0x5906, 0x89E3, 0x5908, - 0x89E4, 0x5909, 0x89E5, 0x590A, 0x89E6, 0x590B, 0x89E7, 0x590C, - 0x89E8, 0x590E, 0x89E9, 0x5910, 0x89EA, 0x5911, 0x89EB, 0x5912, - 0x89EC, 0x5913, 0x89ED, 0x5917, 0x89EE, 0x5918, 0x89EF, 0x591B, - 0x89F0, 0x591D, 0x89F1, 0x591E, 0x89F2, 0x5920, 0x89F3, 0x5921, - 0x89F4, 0x5922, 0x89F5, 0x5923, 0x89F6, 0x5926, 0x89F7, 0x5928, - 0x89F8, 0x592C, 0x89F9, 0x5930, 0x89FA, 0x5932, 0x89FB, 0x5933, - 0x89FC, 0x5935, 0x89FD, 0x5936, 0x89FE, 0x593B, 0x8A40, 0x593D, - 0x8A41, 0x593E, 0x8A42, 0x593F, 0x8A43, 0x5940, 0x8A44, 0x5943, - 0x8A45, 0x5945, 0x8A46, 0x5946, 0x8A47, 0x594A, 0x8A48, 0x594C, - 0x8A49, 0x594D, 0x8A4A, 0x5950, 0x8A4B, 0x5952, 0x8A4C, 0x5953, - 0x8A4D, 0x5959, 0x8A4E, 0x595B, 0x8A4F, 0x595C, 0x8A50, 0x595D, - 0x8A51, 0x595E, 0x8A52, 0x595F, 0x8A53, 0x5961, 0x8A54, 0x5963, - 0x8A55, 0x5964, 0x8A56, 0x5966, 0x8A57, 0x5967, 0x8A58, 0x5968, - 0x8A59, 0x5969, 0x8A5A, 0x596A, 0x8A5B, 0x596B, 0x8A5C, 0x596C, - 0x8A5D, 0x596D, 0x8A5E, 0x596E, 0x8A5F, 0x596F, 0x8A60, 0x5970, - 0x8A61, 0x5971, 0x8A62, 0x5972, 0x8A63, 0x5975, 0x8A64, 0x5977, - 0x8A65, 0x597A, 0x8A66, 0x597B, 0x8A67, 0x597C, 0x8A68, 0x597E, - 0x8A69, 0x597F, 0x8A6A, 0x5980, 0x8A6B, 0x5985, 0x8A6C, 0x5989, - 0x8A6D, 0x598B, 0x8A6E, 0x598C, 0x8A6F, 0x598E, 0x8A70, 0x598F, - 0x8A71, 0x5990, 0x8A72, 0x5991, 0x8A73, 0x5994, 0x8A74, 0x5995, - 0x8A75, 0x5998, 0x8A76, 0x599A, 0x8A77, 0x599B, 0x8A78, 0x599C, - 0x8A79, 0x599D, 0x8A7A, 0x599F, 0x8A7B, 0x59A0, 0x8A7C, 0x59A1, - 0x8A7D, 0x59A2, 0x8A7E, 0x59A6, 0x8A80, 0x59A7, 0x8A81, 0x59AC, - 0x8A82, 0x59AD, 0x8A83, 0x59B0, 0x8A84, 0x59B1, 0x8A85, 0x59B3, - 0x8A86, 0x59B4, 0x8A87, 0x59B5, 0x8A88, 0x59B6, 0x8A89, 0x59B7, - 0x8A8A, 0x59B8, 0x8A8B, 0x59BA, 0x8A8C, 0x59BC, 0x8A8D, 0x59BD, - 0x8A8E, 0x59BF, 0x8A8F, 0x59C0, 0x8A90, 0x59C1, 0x8A91, 0x59C2, - 0x8A92, 0x59C3, 0x8A93, 0x59C4, 0x8A94, 0x59C5, 0x8A95, 0x59C7, - 0x8A96, 0x59C8, 0x8A97, 0x59C9, 0x8A98, 0x59CC, 0x8A99, 0x59CD, - 0x8A9A, 0x59CE, 0x8A9B, 0x59CF, 0x8A9C, 0x59D5, 0x8A9D, 0x59D6, - 0x8A9E, 0x59D9, 0x8A9F, 0x59DB, 0x8AA0, 0x59DE, 0x8AA1, 0x59DF, - 0x8AA2, 0x59E0, 0x8AA3, 0x59E1, 0x8AA4, 0x59E2, 0x8AA5, 0x59E4, - 0x8AA6, 0x59E6, 0x8AA7, 0x59E7, 0x8AA8, 0x59E9, 0x8AA9, 0x59EA, - 0x8AAA, 0x59EB, 0x8AAB, 0x59ED, 0x8AAC, 0x59EE, 0x8AAD, 0x59EF, - 0x8AAE, 0x59F0, 0x8AAF, 0x59F1, 0x8AB0, 0x59F2, 0x8AB1, 0x59F3, - 0x8AB2, 0x59F4, 0x8AB3, 0x59F5, 0x8AB4, 0x59F6, 0x8AB5, 0x59F7, - 0x8AB6, 0x59F8, 0x8AB7, 0x59FA, 0x8AB8, 0x59FC, 0x8AB9, 0x59FD, - 0x8ABA, 0x59FE, 0x8ABB, 0x5A00, 0x8ABC, 0x5A02, 0x8ABD, 0x5A0A, - 0x8ABE, 0x5A0B, 0x8ABF, 0x5A0D, 0x8AC0, 0x5A0E, 0x8AC1, 0x5A0F, - 0x8AC2, 0x5A10, 0x8AC3, 0x5A12, 0x8AC4, 0x5A14, 0x8AC5, 0x5A15, - 0x8AC6, 0x5A16, 0x8AC7, 0x5A17, 0x8AC8, 0x5A19, 0x8AC9, 0x5A1A, - 0x8ACA, 0x5A1B, 0x8ACB, 0x5A1D, 0x8ACC, 0x5A1E, 0x8ACD, 0x5A21, - 0x8ACE, 0x5A22, 0x8ACF, 0x5A24, 0x8AD0, 0x5A26, 0x8AD1, 0x5A27, - 0x8AD2, 0x5A28, 0x8AD3, 0x5A2A, 0x8AD4, 0x5A2B, 0x8AD5, 0x5A2C, - 0x8AD6, 0x5A2D, 0x8AD7, 0x5A2E, 0x8AD8, 0x5A2F, 0x8AD9, 0x5A30, - 0x8ADA, 0x5A33, 0x8ADB, 0x5A35, 0x8ADC, 0x5A37, 0x8ADD, 0x5A38, - 0x8ADE, 0x5A39, 0x8ADF, 0x5A3A, 0x8AE0, 0x5A3B, 0x8AE1, 0x5A3D, - 0x8AE2, 0x5A3E, 0x8AE3, 0x5A3F, 0x8AE4, 0x5A41, 0x8AE5, 0x5A42, - 0x8AE6, 0x5A43, 0x8AE7, 0x5A44, 0x8AE8, 0x5A45, 0x8AE9, 0x5A47, - 0x8AEA, 0x5A48, 0x8AEB, 0x5A4B, 0x8AEC, 0x5A4C, 0x8AED, 0x5A4D, - 0x8AEE, 0x5A4E, 0x8AEF, 0x5A4F, 0x8AF0, 0x5A50, 0x8AF1, 0x5A51, - 0x8AF2, 0x5A52, 0x8AF3, 0x5A53, 0x8AF4, 0x5A54, 0x8AF5, 0x5A56, - 0x8AF6, 0x5A57, 0x8AF7, 0x5A58, 0x8AF8, 0x5A59, 0x8AF9, 0x5A5B, - 0x8AFA, 0x5A5C, 0x8AFB, 0x5A5D, 0x8AFC, 0x5A5E, 0x8AFD, 0x5A5F, - 0x8AFE, 0x5A60, 0x8B40, 0x5A61, 0x8B41, 0x5A63, 0x8B42, 0x5A64, - 0x8B43, 0x5A65, 0x8B44, 0x5A66, 0x8B45, 0x5A68, 0x8B46, 0x5A69, - 0x8B47, 0x5A6B, 0x8B48, 0x5A6C, 0x8B49, 0x5A6D, 0x8B4A, 0x5A6E, - 0x8B4B, 0x5A6F, 0x8B4C, 0x5A70, 0x8B4D, 0x5A71, 0x8B4E, 0x5A72, - 0x8B4F, 0x5A73, 0x8B50, 0x5A78, 0x8B51, 0x5A79, 0x8B52, 0x5A7B, - 0x8B53, 0x5A7C, 0x8B54, 0x5A7D, 0x8B55, 0x5A7E, 0x8B56, 0x5A80, - 0x8B57, 0x5A81, 0x8B58, 0x5A82, 0x8B59, 0x5A83, 0x8B5A, 0x5A84, - 0x8B5B, 0x5A85, 0x8B5C, 0x5A86, 0x8B5D, 0x5A87, 0x8B5E, 0x5A88, - 0x8B5F, 0x5A89, 0x8B60, 0x5A8A, 0x8B61, 0x5A8B, 0x8B62, 0x5A8C, - 0x8B63, 0x5A8D, 0x8B64, 0x5A8E, 0x8B65, 0x5A8F, 0x8B66, 0x5A90, - 0x8B67, 0x5A91, 0x8B68, 0x5A93, 0x8B69, 0x5A94, 0x8B6A, 0x5A95, - 0x8B6B, 0x5A96, 0x8B6C, 0x5A97, 0x8B6D, 0x5A98, 0x8B6E, 0x5A99, - 0x8B6F, 0x5A9C, 0x8B70, 0x5A9D, 0x8B71, 0x5A9E, 0x8B72, 0x5A9F, - 0x8B73, 0x5AA0, 0x8B74, 0x5AA1, 0x8B75, 0x5AA2, 0x8B76, 0x5AA3, - 0x8B77, 0x5AA4, 0x8B78, 0x5AA5, 0x8B79, 0x5AA6, 0x8B7A, 0x5AA7, - 0x8B7B, 0x5AA8, 0x8B7C, 0x5AA9, 0x8B7D, 0x5AAB, 0x8B7E, 0x5AAC, - 0x8B80, 0x5AAD, 0x8B81, 0x5AAE, 0x8B82, 0x5AAF, 0x8B83, 0x5AB0, - 0x8B84, 0x5AB1, 0x8B85, 0x5AB4, 0x8B86, 0x5AB6, 0x8B87, 0x5AB7, - 0x8B88, 0x5AB9, 0x8B89, 0x5ABA, 0x8B8A, 0x5ABB, 0x8B8B, 0x5ABC, - 0x8B8C, 0x5ABD, 0x8B8D, 0x5ABF, 0x8B8E, 0x5AC0, 0x8B8F, 0x5AC3, - 0x8B90, 0x5AC4, 0x8B91, 0x5AC5, 0x8B92, 0x5AC6, 0x8B93, 0x5AC7, - 0x8B94, 0x5AC8, 0x8B95, 0x5ACA, 0x8B96, 0x5ACB, 0x8B97, 0x5ACD, - 0x8B98, 0x5ACE, 0x8B99, 0x5ACF, 0x8B9A, 0x5AD0, 0x8B9B, 0x5AD1, - 0x8B9C, 0x5AD3, 0x8B9D, 0x5AD5, 0x8B9E, 0x5AD7, 0x8B9F, 0x5AD9, - 0x8BA0, 0x5ADA, 0x8BA1, 0x5ADB, 0x8BA2, 0x5ADD, 0x8BA3, 0x5ADE, - 0x8BA4, 0x5ADF, 0x8BA5, 0x5AE2, 0x8BA6, 0x5AE4, 0x8BA7, 0x5AE5, - 0x8BA8, 0x5AE7, 0x8BA9, 0x5AE8, 0x8BAA, 0x5AEA, 0x8BAB, 0x5AEC, - 0x8BAC, 0x5AED, 0x8BAD, 0x5AEE, 0x8BAE, 0x5AEF, 0x8BAF, 0x5AF0, - 0x8BB0, 0x5AF2, 0x8BB1, 0x5AF3, 0x8BB2, 0x5AF4, 0x8BB3, 0x5AF5, - 0x8BB4, 0x5AF6, 0x8BB5, 0x5AF7, 0x8BB6, 0x5AF8, 0x8BB7, 0x5AF9, - 0x8BB8, 0x5AFA, 0x8BB9, 0x5AFB, 0x8BBA, 0x5AFC, 0x8BBB, 0x5AFD, - 0x8BBC, 0x5AFE, 0x8BBD, 0x5AFF, 0x8BBE, 0x5B00, 0x8BBF, 0x5B01, - 0x8BC0, 0x5B02, 0x8BC1, 0x5B03, 0x8BC2, 0x5B04, 0x8BC3, 0x5B05, - 0x8BC4, 0x5B06, 0x8BC5, 0x5B07, 0x8BC6, 0x5B08, 0x8BC7, 0x5B0A, - 0x8BC8, 0x5B0B, 0x8BC9, 0x5B0C, 0x8BCA, 0x5B0D, 0x8BCB, 0x5B0E, - 0x8BCC, 0x5B0F, 0x8BCD, 0x5B10, 0x8BCE, 0x5B11, 0x8BCF, 0x5B12, - 0x8BD0, 0x5B13, 0x8BD1, 0x5B14, 0x8BD2, 0x5B15, 0x8BD3, 0x5B18, - 0x8BD4, 0x5B19, 0x8BD5, 0x5B1A, 0x8BD6, 0x5B1B, 0x8BD7, 0x5B1C, - 0x8BD8, 0x5B1D, 0x8BD9, 0x5B1E, 0x8BDA, 0x5B1F, 0x8BDB, 0x5B20, - 0x8BDC, 0x5B21, 0x8BDD, 0x5B22, 0x8BDE, 0x5B23, 0x8BDF, 0x5B24, - 0x8BE0, 0x5B25, 0x8BE1, 0x5B26, 0x8BE2, 0x5B27, 0x8BE3, 0x5B28, - 0x8BE4, 0x5B29, 0x8BE5, 0x5B2A, 0x8BE6, 0x5B2B, 0x8BE7, 0x5B2C, - 0x8BE8, 0x5B2D, 0x8BE9, 0x5B2E, 0x8BEA, 0x5B2F, 0x8BEB, 0x5B30, - 0x8BEC, 0x5B31, 0x8BED, 0x5B33, 0x8BEE, 0x5B35, 0x8BEF, 0x5B36, - 0x8BF0, 0x5B38, 0x8BF1, 0x5B39, 0x8BF2, 0x5B3A, 0x8BF3, 0x5B3B, - 0x8BF4, 0x5B3C, 0x8BF5, 0x5B3D, 0x8BF6, 0x5B3E, 0x8BF7, 0x5B3F, - 0x8BF8, 0x5B41, 0x8BF9, 0x5B42, 0x8BFA, 0x5B43, 0x8BFB, 0x5B44, - 0x8BFC, 0x5B45, 0x8BFD, 0x5B46, 0x8BFE, 0x5B47, 0x8C40, 0x5B48, - 0x8C41, 0x5B49, 0x8C42, 0x5B4A, 0x8C43, 0x5B4B, 0x8C44, 0x5B4C, - 0x8C45, 0x5B4D, 0x8C46, 0x5B4E, 0x8C47, 0x5B4F, 0x8C48, 0x5B52, - 0x8C49, 0x5B56, 0x8C4A, 0x5B5E, 0x8C4B, 0x5B60, 0x8C4C, 0x5B61, - 0x8C4D, 0x5B67, 0x8C4E, 0x5B68, 0x8C4F, 0x5B6B, 0x8C50, 0x5B6D, - 0x8C51, 0x5B6E, 0x8C52, 0x5B6F, 0x8C53, 0x5B72, 0x8C54, 0x5B74, - 0x8C55, 0x5B76, 0x8C56, 0x5B77, 0x8C57, 0x5B78, 0x8C58, 0x5B79, - 0x8C59, 0x5B7B, 0x8C5A, 0x5B7C, 0x8C5B, 0x5B7E, 0x8C5C, 0x5B7F, - 0x8C5D, 0x5B82, 0x8C5E, 0x5B86, 0x8C5F, 0x5B8A, 0x8C60, 0x5B8D, - 0x8C61, 0x5B8E, 0x8C62, 0x5B90, 0x8C63, 0x5B91, 0x8C64, 0x5B92, - 0x8C65, 0x5B94, 0x8C66, 0x5B96, 0x8C67, 0x5B9F, 0x8C68, 0x5BA7, - 0x8C69, 0x5BA8, 0x8C6A, 0x5BA9, 0x8C6B, 0x5BAC, 0x8C6C, 0x5BAD, - 0x8C6D, 0x5BAE, 0x8C6E, 0x5BAF, 0x8C6F, 0x5BB1, 0x8C70, 0x5BB2, - 0x8C71, 0x5BB7, 0x8C72, 0x5BBA, 0x8C73, 0x5BBB, 0x8C74, 0x5BBC, - 0x8C75, 0x5BC0, 0x8C76, 0x5BC1, 0x8C77, 0x5BC3, 0x8C78, 0x5BC8, - 0x8C79, 0x5BC9, 0x8C7A, 0x5BCA, 0x8C7B, 0x5BCB, 0x8C7C, 0x5BCD, - 0x8C7D, 0x5BCE, 0x8C7E, 0x5BCF, 0x8C80, 0x5BD1, 0x8C81, 0x5BD4, - 0x8C82, 0x5BD5, 0x8C83, 0x5BD6, 0x8C84, 0x5BD7, 0x8C85, 0x5BD8, - 0x8C86, 0x5BD9, 0x8C87, 0x5BDA, 0x8C88, 0x5BDB, 0x8C89, 0x5BDC, - 0x8C8A, 0x5BE0, 0x8C8B, 0x5BE2, 0x8C8C, 0x5BE3, 0x8C8D, 0x5BE6, - 0x8C8E, 0x5BE7, 0x8C8F, 0x5BE9, 0x8C90, 0x5BEA, 0x8C91, 0x5BEB, - 0x8C92, 0x5BEC, 0x8C93, 0x5BED, 0x8C94, 0x5BEF, 0x8C95, 0x5BF1, - 0x8C96, 0x5BF2, 0x8C97, 0x5BF3, 0x8C98, 0x5BF4, 0x8C99, 0x5BF5, - 0x8C9A, 0x5BF6, 0x8C9B, 0x5BF7, 0x8C9C, 0x5BFD, 0x8C9D, 0x5BFE, - 0x8C9E, 0x5C00, 0x8C9F, 0x5C02, 0x8CA0, 0x5C03, 0x8CA1, 0x5C05, - 0x8CA2, 0x5C07, 0x8CA3, 0x5C08, 0x8CA4, 0x5C0B, 0x8CA5, 0x5C0C, - 0x8CA6, 0x5C0D, 0x8CA7, 0x5C0E, 0x8CA8, 0x5C10, 0x8CA9, 0x5C12, - 0x8CAA, 0x5C13, 0x8CAB, 0x5C17, 0x8CAC, 0x5C19, 0x8CAD, 0x5C1B, - 0x8CAE, 0x5C1E, 0x8CAF, 0x5C1F, 0x8CB0, 0x5C20, 0x8CB1, 0x5C21, - 0x8CB2, 0x5C23, 0x8CB3, 0x5C26, 0x8CB4, 0x5C28, 0x8CB5, 0x5C29, - 0x8CB6, 0x5C2A, 0x8CB7, 0x5C2B, 0x8CB8, 0x5C2D, 0x8CB9, 0x5C2E, - 0x8CBA, 0x5C2F, 0x8CBB, 0x5C30, 0x8CBC, 0x5C32, 0x8CBD, 0x5C33, - 0x8CBE, 0x5C35, 0x8CBF, 0x5C36, 0x8CC0, 0x5C37, 0x8CC1, 0x5C43, - 0x8CC2, 0x5C44, 0x8CC3, 0x5C46, 0x8CC4, 0x5C47, 0x8CC5, 0x5C4C, - 0x8CC6, 0x5C4D, 0x8CC7, 0x5C52, 0x8CC8, 0x5C53, 0x8CC9, 0x5C54, - 0x8CCA, 0x5C56, 0x8CCB, 0x5C57, 0x8CCC, 0x5C58, 0x8CCD, 0x5C5A, - 0x8CCE, 0x5C5B, 0x8CCF, 0x5C5C, 0x8CD0, 0x5C5D, 0x8CD1, 0x5C5F, - 0x8CD2, 0x5C62, 0x8CD3, 0x5C64, 0x8CD4, 0x5C67, 0x8CD5, 0x5C68, - 0x8CD6, 0x5C69, 0x8CD7, 0x5C6A, 0x8CD8, 0x5C6B, 0x8CD9, 0x5C6C, - 0x8CDA, 0x5C6D, 0x8CDB, 0x5C70, 0x8CDC, 0x5C72, 0x8CDD, 0x5C73, - 0x8CDE, 0x5C74, 0x8CDF, 0x5C75, 0x8CE0, 0x5C76, 0x8CE1, 0x5C77, - 0x8CE2, 0x5C78, 0x8CE3, 0x5C7B, 0x8CE4, 0x5C7C, 0x8CE5, 0x5C7D, - 0x8CE6, 0x5C7E, 0x8CE7, 0x5C80, 0x8CE8, 0x5C83, 0x8CE9, 0x5C84, - 0x8CEA, 0x5C85, 0x8CEB, 0x5C86, 0x8CEC, 0x5C87, 0x8CED, 0x5C89, - 0x8CEE, 0x5C8A, 0x8CEF, 0x5C8B, 0x8CF0, 0x5C8E, 0x8CF1, 0x5C8F, - 0x8CF2, 0x5C92, 0x8CF3, 0x5C93, 0x8CF4, 0x5C95, 0x8CF5, 0x5C9D, - 0x8CF6, 0x5C9E, 0x8CF7, 0x5C9F, 0x8CF8, 0x5CA0, 0x8CF9, 0x5CA1, - 0x8CFA, 0x5CA4, 0x8CFB, 0x5CA5, 0x8CFC, 0x5CA6, 0x8CFD, 0x5CA7, - 0x8CFE, 0x5CA8, 0x8D40, 0x5CAA, 0x8D41, 0x5CAE, 0x8D42, 0x5CAF, - 0x8D43, 0x5CB0, 0x8D44, 0x5CB2, 0x8D45, 0x5CB4, 0x8D46, 0x5CB6, - 0x8D47, 0x5CB9, 0x8D48, 0x5CBA, 0x8D49, 0x5CBB, 0x8D4A, 0x5CBC, - 0x8D4B, 0x5CBE, 0x8D4C, 0x5CC0, 0x8D4D, 0x5CC2, 0x8D4E, 0x5CC3, - 0x8D4F, 0x5CC5, 0x8D50, 0x5CC6, 0x8D51, 0x5CC7, 0x8D52, 0x5CC8, - 0x8D53, 0x5CC9, 0x8D54, 0x5CCA, 0x8D55, 0x5CCC, 0x8D56, 0x5CCD, - 0x8D57, 0x5CCE, 0x8D58, 0x5CCF, 0x8D59, 0x5CD0, 0x8D5A, 0x5CD1, - 0x8D5B, 0x5CD3, 0x8D5C, 0x5CD4, 0x8D5D, 0x5CD5, 0x8D5E, 0x5CD6, - 0x8D5F, 0x5CD7, 0x8D60, 0x5CD8, 0x8D61, 0x5CDA, 0x8D62, 0x5CDB, - 0x8D63, 0x5CDC, 0x8D64, 0x5CDD, 0x8D65, 0x5CDE, 0x8D66, 0x5CDF, - 0x8D67, 0x5CE0, 0x8D68, 0x5CE2, 0x8D69, 0x5CE3, 0x8D6A, 0x5CE7, - 0x8D6B, 0x5CE9, 0x8D6C, 0x5CEB, 0x8D6D, 0x5CEC, 0x8D6E, 0x5CEE, - 0x8D6F, 0x5CEF, 0x8D70, 0x5CF1, 0x8D71, 0x5CF2, 0x8D72, 0x5CF3, - 0x8D73, 0x5CF4, 0x8D74, 0x5CF5, 0x8D75, 0x5CF6, 0x8D76, 0x5CF7, - 0x8D77, 0x5CF8, 0x8D78, 0x5CF9, 0x8D79, 0x5CFA, 0x8D7A, 0x5CFC, - 0x8D7B, 0x5CFD, 0x8D7C, 0x5CFE, 0x8D7D, 0x5CFF, 0x8D7E, 0x5D00, - 0x8D80, 0x5D01, 0x8D81, 0x5D04, 0x8D82, 0x5D05, 0x8D83, 0x5D08, - 0x8D84, 0x5D09, 0x8D85, 0x5D0A, 0x8D86, 0x5D0B, 0x8D87, 0x5D0C, - 0x8D88, 0x5D0D, 0x8D89, 0x5D0F, 0x8D8A, 0x5D10, 0x8D8B, 0x5D11, - 0x8D8C, 0x5D12, 0x8D8D, 0x5D13, 0x8D8E, 0x5D15, 0x8D8F, 0x5D17, - 0x8D90, 0x5D18, 0x8D91, 0x5D19, 0x8D92, 0x5D1A, 0x8D93, 0x5D1C, - 0x8D94, 0x5D1D, 0x8D95, 0x5D1F, 0x8D96, 0x5D20, 0x8D97, 0x5D21, - 0x8D98, 0x5D22, 0x8D99, 0x5D23, 0x8D9A, 0x5D25, 0x8D9B, 0x5D28, - 0x8D9C, 0x5D2A, 0x8D9D, 0x5D2B, 0x8D9E, 0x5D2C, 0x8D9F, 0x5D2F, - 0x8DA0, 0x5D30, 0x8DA1, 0x5D31, 0x8DA2, 0x5D32, 0x8DA3, 0x5D33, - 0x8DA4, 0x5D35, 0x8DA5, 0x5D36, 0x8DA6, 0x5D37, 0x8DA7, 0x5D38, - 0x8DA8, 0x5D39, 0x8DA9, 0x5D3A, 0x8DAA, 0x5D3B, 0x8DAB, 0x5D3C, - 0x8DAC, 0x5D3F, 0x8DAD, 0x5D40, 0x8DAE, 0x5D41, 0x8DAF, 0x5D42, - 0x8DB0, 0x5D43, 0x8DB1, 0x5D44, 0x8DB2, 0x5D45, 0x8DB3, 0x5D46, - 0x8DB4, 0x5D48, 0x8DB5, 0x5D49, 0x8DB6, 0x5D4D, 0x8DB7, 0x5D4E, - 0x8DB8, 0x5D4F, 0x8DB9, 0x5D50, 0x8DBA, 0x5D51, 0x8DBB, 0x5D52, - 0x8DBC, 0x5D53, 0x8DBD, 0x5D54, 0x8DBE, 0x5D55, 0x8DBF, 0x5D56, - 0x8DC0, 0x5D57, 0x8DC1, 0x5D59, 0x8DC2, 0x5D5A, 0x8DC3, 0x5D5C, - 0x8DC4, 0x5D5E, 0x8DC5, 0x5D5F, 0x8DC6, 0x5D60, 0x8DC7, 0x5D61, - 0x8DC8, 0x5D62, 0x8DC9, 0x5D63, 0x8DCA, 0x5D64, 0x8DCB, 0x5D65, - 0x8DCC, 0x5D66, 0x8DCD, 0x5D67, 0x8DCE, 0x5D68, 0x8DCF, 0x5D6A, - 0x8DD0, 0x5D6D, 0x8DD1, 0x5D6E, 0x8DD2, 0x5D70, 0x8DD3, 0x5D71, - 0x8DD4, 0x5D72, 0x8DD5, 0x5D73, 0x8DD6, 0x5D75, 0x8DD7, 0x5D76, - 0x8DD8, 0x5D77, 0x8DD9, 0x5D78, 0x8DDA, 0x5D79, 0x8DDB, 0x5D7A, - 0x8DDC, 0x5D7B, 0x8DDD, 0x5D7C, 0x8DDE, 0x5D7D, 0x8DDF, 0x5D7E, - 0x8DE0, 0x5D7F, 0x8DE1, 0x5D80, 0x8DE2, 0x5D81, 0x8DE3, 0x5D83, - 0x8DE4, 0x5D84, 0x8DE5, 0x5D85, 0x8DE6, 0x5D86, 0x8DE7, 0x5D87, - 0x8DE8, 0x5D88, 0x8DE9, 0x5D89, 0x8DEA, 0x5D8A, 0x8DEB, 0x5D8B, - 0x8DEC, 0x5D8C, 0x8DED, 0x5D8D, 0x8DEE, 0x5D8E, 0x8DEF, 0x5D8F, - 0x8DF0, 0x5D90, 0x8DF1, 0x5D91, 0x8DF2, 0x5D92, 0x8DF3, 0x5D93, - 0x8DF4, 0x5D94, 0x8DF5, 0x5D95, 0x8DF6, 0x5D96, 0x8DF7, 0x5D97, - 0x8DF8, 0x5D98, 0x8DF9, 0x5D9A, 0x8DFA, 0x5D9B, 0x8DFB, 0x5D9C, - 0x8DFC, 0x5D9E, 0x8DFD, 0x5D9F, 0x8DFE, 0x5DA0, 0x8E40, 0x5DA1, - 0x8E41, 0x5DA2, 0x8E42, 0x5DA3, 0x8E43, 0x5DA4, 0x8E44, 0x5DA5, - 0x8E45, 0x5DA6, 0x8E46, 0x5DA7, 0x8E47, 0x5DA8, 0x8E48, 0x5DA9, - 0x8E49, 0x5DAA, 0x8E4A, 0x5DAB, 0x8E4B, 0x5DAC, 0x8E4C, 0x5DAD, - 0x8E4D, 0x5DAE, 0x8E4E, 0x5DAF, 0x8E4F, 0x5DB0, 0x8E50, 0x5DB1, - 0x8E51, 0x5DB2, 0x8E52, 0x5DB3, 0x8E53, 0x5DB4, 0x8E54, 0x5DB5, - 0x8E55, 0x5DB6, 0x8E56, 0x5DB8, 0x8E57, 0x5DB9, 0x8E58, 0x5DBA, - 0x8E59, 0x5DBB, 0x8E5A, 0x5DBC, 0x8E5B, 0x5DBD, 0x8E5C, 0x5DBE, - 0x8E5D, 0x5DBF, 0x8E5E, 0x5DC0, 0x8E5F, 0x5DC1, 0x8E60, 0x5DC2, - 0x8E61, 0x5DC3, 0x8E62, 0x5DC4, 0x8E63, 0x5DC6, 0x8E64, 0x5DC7, - 0x8E65, 0x5DC8, 0x8E66, 0x5DC9, 0x8E67, 0x5DCA, 0x8E68, 0x5DCB, - 0x8E69, 0x5DCC, 0x8E6A, 0x5DCE, 0x8E6B, 0x5DCF, 0x8E6C, 0x5DD0, - 0x8E6D, 0x5DD1, 0x8E6E, 0x5DD2, 0x8E6F, 0x5DD3, 0x8E70, 0x5DD4, - 0x8E71, 0x5DD5, 0x8E72, 0x5DD6, 0x8E73, 0x5DD7, 0x8E74, 0x5DD8, - 0x8E75, 0x5DD9, 0x8E76, 0x5DDA, 0x8E77, 0x5DDC, 0x8E78, 0x5DDF, - 0x8E79, 0x5DE0, 0x8E7A, 0x5DE3, 0x8E7B, 0x5DE4, 0x8E7C, 0x5DEA, - 0x8E7D, 0x5DEC, 0x8E7E, 0x5DED, 0x8E80, 0x5DF0, 0x8E81, 0x5DF5, - 0x8E82, 0x5DF6, 0x8E83, 0x5DF8, 0x8E84, 0x5DF9, 0x8E85, 0x5DFA, - 0x8E86, 0x5DFB, 0x8E87, 0x5DFC, 0x8E88, 0x5DFF, 0x8E89, 0x5E00, - 0x8E8A, 0x5E04, 0x8E8B, 0x5E07, 0x8E8C, 0x5E09, 0x8E8D, 0x5E0A, - 0x8E8E, 0x5E0B, 0x8E8F, 0x5E0D, 0x8E90, 0x5E0E, 0x8E91, 0x5E12, - 0x8E92, 0x5E13, 0x8E93, 0x5E17, 0x8E94, 0x5E1E, 0x8E95, 0x5E1F, - 0x8E96, 0x5E20, 0x8E97, 0x5E21, 0x8E98, 0x5E22, 0x8E99, 0x5E23, - 0x8E9A, 0x5E24, 0x8E9B, 0x5E25, 0x8E9C, 0x5E28, 0x8E9D, 0x5E29, - 0x8E9E, 0x5E2A, 0x8E9F, 0x5E2B, 0x8EA0, 0x5E2C, 0x8EA1, 0x5E2F, - 0x8EA2, 0x5E30, 0x8EA3, 0x5E32, 0x8EA4, 0x5E33, 0x8EA5, 0x5E34, - 0x8EA6, 0x5E35, 0x8EA7, 0x5E36, 0x8EA8, 0x5E39, 0x8EA9, 0x5E3A, - 0x8EAA, 0x5E3E, 0x8EAB, 0x5E3F, 0x8EAC, 0x5E40, 0x8EAD, 0x5E41, - 0x8EAE, 0x5E43, 0x8EAF, 0x5E46, 0x8EB0, 0x5E47, 0x8EB1, 0x5E48, - 0x8EB2, 0x5E49, 0x8EB3, 0x5E4A, 0x8EB4, 0x5E4B, 0x8EB5, 0x5E4D, - 0x8EB6, 0x5E4E, 0x8EB7, 0x5E4F, 0x8EB8, 0x5E50, 0x8EB9, 0x5E51, - 0x8EBA, 0x5E52, 0x8EBB, 0x5E53, 0x8EBC, 0x5E56, 0x8EBD, 0x5E57, - 0x8EBE, 0x5E58, 0x8EBF, 0x5E59, 0x8EC0, 0x5E5A, 0x8EC1, 0x5E5C, - 0x8EC2, 0x5E5D, 0x8EC3, 0x5E5F, 0x8EC4, 0x5E60, 0x8EC5, 0x5E63, - 0x8EC6, 0x5E64, 0x8EC7, 0x5E65, 0x8EC8, 0x5E66, 0x8EC9, 0x5E67, - 0x8ECA, 0x5E68, 0x8ECB, 0x5E69, 0x8ECC, 0x5E6A, 0x8ECD, 0x5E6B, - 0x8ECE, 0x5E6C, 0x8ECF, 0x5E6D, 0x8ED0, 0x5E6E, 0x8ED1, 0x5E6F, - 0x8ED2, 0x5E70, 0x8ED3, 0x5E71, 0x8ED4, 0x5E75, 0x8ED5, 0x5E77, - 0x8ED6, 0x5E79, 0x8ED7, 0x5E7E, 0x8ED8, 0x5E81, 0x8ED9, 0x5E82, - 0x8EDA, 0x5E83, 0x8EDB, 0x5E85, 0x8EDC, 0x5E88, 0x8EDD, 0x5E89, - 0x8EDE, 0x5E8C, 0x8EDF, 0x5E8D, 0x8EE0, 0x5E8E, 0x8EE1, 0x5E92, - 0x8EE2, 0x5E98, 0x8EE3, 0x5E9B, 0x8EE4, 0x5E9D, 0x8EE5, 0x5EA1, - 0x8EE6, 0x5EA2, 0x8EE7, 0x5EA3, 0x8EE8, 0x5EA4, 0x8EE9, 0x5EA8, - 0x8EEA, 0x5EA9, 0x8EEB, 0x5EAA, 0x8EEC, 0x5EAB, 0x8EED, 0x5EAC, - 0x8EEE, 0x5EAE, 0x8EEF, 0x5EAF, 0x8EF0, 0x5EB0, 0x8EF1, 0x5EB1, - 0x8EF2, 0x5EB2, 0x8EF3, 0x5EB4, 0x8EF4, 0x5EBA, 0x8EF5, 0x5EBB, - 0x8EF6, 0x5EBC, 0x8EF7, 0x5EBD, 0x8EF8, 0x5EBF, 0x8EF9, 0x5EC0, - 0x8EFA, 0x5EC1, 0x8EFB, 0x5EC2, 0x8EFC, 0x5EC3, 0x8EFD, 0x5EC4, - 0x8EFE, 0x5EC5, 0x8F40, 0x5EC6, 0x8F41, 0x5EC7, 0x8F42, 0x5EC8, - 0x8F43, 0x5ECB, 0x8F44, 0x5ECC, 0x8F45, 0x5ECD, 0x8F46, 0x5ECE, - 0x8F47, 0x5ECF, 0x8F48, 0x5ED0, 0x8F49, 0x5ED4, 0x8F4A, 0x5ED5, - 0x8F4B, 0x5ED7, 0x8F4C, 0x5ED8, 0x8F4D, 0x5ED9, 0x8F4E, 0x5EDA, - 0x8F4F, 0x5EDC, 0x8F50, 0x5EDD, 0x8F51, 0x5EDE, 0x8F52, 0x5EDF, - 0x8F53, 0x5EE0, 0x8F54, 0x5EE1, 0x8F55, 0x5EE2, 0x8F56, 0x5EE3, - 0x8F57, 0x5EE4, 0x8F58, 0x5EE5, 0x8F59, 0x5EE6, 0x8F5A, 0x5EE7, - 0x8F5B, 0x5EE9, 0x8F5C, 0x5EEB, 0x8F5D, 0x5EEC, 0x8F5E, 0x5EED, - 0x8F5F, 0x5EEE, 0x8F60, 0x5EEF, 0x8F61, 0x5EF0, 0x8F62, 0x5EF1, - 0x8F63, 0x5EF2, 0x8F64, 0x5EF3, 0x8F65, 0x5EF5, 0x8F66, 0x5EF8, - 0x8F67, 0x5EF9, 0x8F68, 0x5EFB, 0x8F69, 0x5EFC, 0x8F6A, 0x5EFD, - 0x8F6B, 0x5F05, 0x8F6C, 0x5F06, 0x8F6D, 0x5F07, 0x8F6E, 0x5F09, - 0x8F6F, 0x5F0C, 0x8F70, 0x5F0D, 0x8F71, 0x5F0E, 0x8F72, 0x5F10, - 0x8F73, 0x5F12, 0x8F74, 0x5F14, 0x8F75, 0x5F16, 0x8F76, 0x5F19, - 0x8F77, 0x5F1A, 0x8F78, 0x5F1C, 0x8F79, 0x5F1D, 0x8F7A, 0x5F1E, - 0x8F7B, 0x5F21, 0x8F7C, 0x5F22, 0x8F7D, 0x5F23, 0x8F7E, 0x5F24, - 0x8F80, 0x5F28, 0x8F81, 0x5F2B, 0x8F82, 0x5F2C, 0x8F83, 0x5F2E, - 0x8F84, 0x5F30, 0x8F85, 0x5F32, 0x8F86, 0x5F33, 0x8F87, 0x5F34, - 0x8F88, 0x5F35, 0x8F89, 0x5F36, 0x8F8A, 0x5F37, 0x8F8B, 0x5F38, - 0x8F8C, 0x5F3B, 0x8F8D, 0x5F3D, 0x8F8E, 0x5F3E, 0x8F8F, 0x5F3F, - 0x8F90, 0x5F41, 0x8F91, 0x5F42, 0x8F92, 0x5F43, 0x8F93, 0x5F44, - 0x8F94, 0x5F45, 0x8F95, 0x5F46, 0x8F96, 0x5F47, 0x8F97, 0x5F48, - 0x8F98, 0x5F49, 0x8F99, 0x5F4A, 0x8F9A, 0x5F4B, 0x8F9B, 0x5F4C, - 0x8F9C, 0x5F4D, 0x8F9D, 0x5F4E, 0x8F9E, 0x5F4F, 0x8F9F, 0x5F51, - 0x8FA0, 0x5F54, 0x8FA1, 0x5F59, 0x8FA2, 0x5F5A, 0x8FA3, 0x5F5B, - 0x8FA4, 0x5F5C, 0x8FA5, 0x5F5E, 0x8FA6, 0x5F5F, 0x8FA7, 0x5F60, - 0x8FA8, 0x5F63, 0x8FA9, 0x5F65, 0x8FAA, 0x5F67, 0x8FAB, 0x5F68, - 0x8FAC, 0x5F6B, 0x8FAD, 0x5F6E, 0x8FAE, 0x5F6F, 0x8FAF, 0x5F72, - 0x8FB0, 0x5F74, 0x8FB1, 0x5F75, 0x8FB2, 0x5F76, 0x8FB3, 0x5F78, - 0x8FB4, 0x5F7A, 0x8FB5, 0x5F7D, 0x8FB6, 0x5F7E, 0x8FB7, 0x5F7F, - 0x8FB8, 0x5F83, 0x8FB9, 0x5F86, 0x8FBA, 0x5F8D, 0x8FBB, 0x5F8E, - 0x8FBC, 0x5F8F, 0x8FBD, 0x5F91, 0x8FBE, 0x5F93, 0x8FBF, 0x5F94, - 0x8FC0, 0x5F96, 0x8FC1, 0x5F9A, 0x8FC2, 0x5F9B, 0x8FC3, 0x5F9D, - 0x8FC4, 0x5F9E, 0x8FC5, 0x5F9F, 0x8FC6, 0x5FA0, 0x8FC7, 0x5FA2, - 0x8FC8, 0x5FA3, 0x8FC9, 0x5FA4, 0x8FCA, 0x5FA5, 0x8FCB, 0x5FA6, - 0x8FCC, 0x5FA7, 0x8FCD, 0x5FA9, 0x8FCE, 0x5FAB, 0x8FCF, 0x5FAC, - 0x8FD0, 0x5FAF, 0x8FD1, 0x5FB0, 0x8FD2, 0x5FB1, 0x8FD3, 0x5FB2, - 0x8FD4, 0x5FB3, 0x8FD5, 0x5FB4, 0x8FD6, 0x5FB6, 0x8FD7, 0x5FB8, - 0x8FD8, 0x5FB9, 0x8FD9, 0x5FBA, 0x8FDA, 0x5FBB, 0x8FDB, 0x5FBE, - 0x8FDC, 0x5FBF, 0x8FDD, 0x5FC0, 0x8FDE, 0x5FC1, 0x8FDF, 0x5FC2, - 0x8FE0, 0x5FC7, 0x8FE1, 0x5FC8, 0x8FE2, 0x5FCA, 0x8FE3, 0x5FCB, - 0x8FE4, 0x5FCE, 0x8FE5, 0x5FD3, 0x8FE6, 0x5FD4, 0x8FE7, 0x5FD5, - 0x8FE8, 0x5FDA, 0x8FE9, 0x5FDB, 0x8FEA, 0x5FDC, 0x8FEB, 0x5FDE, - 0x8FEC, 0x5FDF, 0x8FED, 0x5FE2, 0x8FEE, 0x5FE3, 0x8FEF, 0x5FE5, - 0x8FF0, 0x5FE6, 0x8FF1, 0x5FE8, 0x8FF2, 0x5FE9, 0x8FF3, 0x5FEC, - 0x8FF4, 0x5FEF, 0x8FF5, 0x5FF0, 0x8FF6, 0x5FF2, 0x8FF7, 0x5FF3, - 0x8FF8, 0x5FF4, 0x8FF9, 0x5FF6, 0x8FFA, 0x5FF7, 0x8FFB, 0x5FF9, - 0x8FFC, 0x5FFA, 0x8FFD, 0x5FFC, 0x8FFE, 0x6007, 0x9040, 0x6008, - 0x9041, 0x6009, 0x9042, 0x600B, 0x9043, 0x600C, 0x9044, 0x6010, - 0x9045, 0x6011, 0x9046, 0x6013, 0x9047, 0x6017, 0x9048, 0x6018, - 0x9049, 0x601A, 0x904A, 0x601E, 0x904B, 0x601F, 0x904C, 0x6022, - 0x904D, 0x6023, 0x904E, 0x6024, 0x904F, 0x602C, 0x9050, 0x602D, - 0x9051, 0x602E, 0x9052, 0x6030, 0x9053, 0x6031, 0x9054, 0x6032, - 0x9055, 0x6033, 0x9056, 0x6034, 0x9057, 0x6036, 0x9058, 0x6037, - 0x9059, 0x6038, 0x905A, 0x6039, 0x905B, 0x603A, 0x905C, 0x603D, - 0x905D, 0x603E, 0x905E, 0x6040, 0x905F, 0x6044, 0x9060, 0x6045, - 0x9061, 0x6046, 0x9062, 0x6047, 0x9063, 0x6048, 0x9064, 0x6049, - 0x9065, 0x604A, 0x9066, 0x604C, 0x9067, 0x604E, 0x9068, 0x604F, - 0x9069, 0x6051, 0x906A, 0x6053, 0x906B, 0x6054, 0x906C, 0x6056, - 0x906D, 0x6057, 0x906E, 0x6058, 0x906F, 0x605B, 0x9070, 0x605C, - 0x9071, 0x605E, 0x9072, 0x605F, 0x9073, 0x6060, 0x9074, 0x6061, - 0x9075, 0x6065, 0x9076, 0x6066, 0x9077, 0x606E, 0x9078, 0x6071, - 0x9079, 0x6072, 0x907A, 0x6074, 0x907B, 0x6075, 0x907C, 0x6077, - 0x907D, 0x607E, 0x907E, 0x6080, 0x9080, 0x6081, 0x9081, 0x6082, - 0x9082, 0x6085, 0x9083, 0x6086, 0x9084, 0x6087, 0x9085, 0x6088, - 0x9086, 0x608A, 0x9087, 0x608B, 0x9088, 0x608E, 0x9089, 0x608F, - 0x908A, 0x6090, 0x908B, 0x6091, 0x908C, 0x6093, 0x908D, 0x6095, - 0x908E, 0x6097, 0x908F, 0x6098, 0x9090, 0x6099, 0x9091, 0x609C, - 0x9092, 0x609E, 0x9093, 0x60A1, 0x9094, 0x60A2, 0x9095, 0x60A4, - 0x9096, 0x60A5, 0x9097, 0x60A7, 0x9098, 0x60A9, 0x9099, 0x60AA, - 0x909A, 0x60AE, 0x909B, 0x60B0, 0x909C, 0x60B3, 0x909D, 0x60B5, - 0x909E, 0x60B6, 0x909F, 0x60B7, 0x90A0, 0x60B9, 0x90A1, 0x60BA, - 0x90A2, 0x60BD, 0x90A3, 0x60BE, 0x90A4, 0x60BF, 0x90A5, 0x60C0, - 0x90A6, 0x60C1, 0x90A7, 0x60C2, 0x90A8, 0x60C3, 0x90A9, 0x60C4, - 0x90AA, 0x60C7, 0x90AB, 0x60C8, 0x90AC, 0x60C9, 0x90AD, 0x60CC, - 0x90AE, 0x60CD, 0x90AF, 0x60CE, 0x90B0, 0x60CF, 0x90B1, 0x60D0, - 0x90B2, 0x60D2, 0x90B3, 0x60D3, 0x90B4, 0x60D4, 0x90B5, 0x60D6, - 0x90B6, 0x60D7, 0x90B7, 0x60D9, 0x90B8, 0x60DB, 0x90B9, 0x60DE, - 0x90BA, 0x60E1, 0x90BB, 0x60E2, 0x90BC, 0x60E3, 0x90BD, 0x60E4, - 0x90BE, 0x60E5, 0x90BF, 0x60EA, 0x90C0, 0x60F1, 0x90C1, 0x60F2, - 0x90C2, 0x60F5, 0x90C3, 0x60F7, 0x90C4, 0x60F8, 0x90C5, 0x60FB, - 0x90C6, 0x60FC, 0x90C7, 0x60FD, 0x90C8, 0x60FE, 0x90C9, 0x60FF, - 0x90CA, 0x6102, 0x90CB, 0x6103, 0x90CC, 0x6104, 0x90CD, 0x6105, - 0x90CE, 0x6107, 0x90CF, 0x610A, 0x90D0, 0x610B, 0x90D1, 0x610C, - 0x90D2, 0x6110, 0x90D3, 0x6111, 0x90D4, 0x6112, 0x90D5, 0x6113, - 0x90D6, 0x6114, 0x90D7, 0x6116, 0x90D8, 0x6117, 0x90D9, 0x6118, - 0x90DA, 0x6119, 0x90DB, 0x611B, 0x90DC, 0x611C, 0x90DD, 0x611D, - 0x90DE, 0x611E, 0x90DF, 0x6121, 0x90E0, 0x6122, 0x90E1, 0x6125, - 0x90E2, 0x6128, 0x90E3, 0x6129, 0x90E4, 0x612A, 0x90E5, 0x612C, - 0x90E6, 0x612D, 0x90E7, 0x612E, 0x90E8, 0x612F, 0x90E9, 0x6130, - 0x90EA, 0x6131, 0x90EB, 0x6132, 0x90EC, 0x6133, 0x90ED, 0x6134, - 0x90EE, 0x6135, 0x90EF, 0x6136, 0x90F0, 0x6137, 0x90F1, 0x6138, - 0x90F2, 0x6139, 0x90F3, 0x613A, 0x90F4, 0x613B, 0x90F5, 0x613C, - 0x90F6, 0x613D, 0x90F7, 0x613E, 0x90F8, 0x6140, 0x90F9, 0x6141, - 0x90FA, 0x6142, 0x90FB, 0x6143, 0x90FC, 0x6144, 0x90FD, 0x6145, - 0x90FE, 0x6146, 0x9140, 0x6147, 0x9141, 0x6149, 0x9142, 0x614B, - 0x9143, 0x614D, 0x9144, 0x614F, 0x9145, 0x6150, 0x9146, 0x6152, - 0x9147, 0x6153, 0x9148, 0x6154, 0x9149, 0x6156, 0x914A, 0x6157, - 0x914B, 0x6158, 0x914C, 0x6159, 0x914D, 0x615A, 0x914E, 0x615B, - 0x914F, 0x615C, 0x9150, 0x615E, 0x9151, 0x615F, 0x9152, 0x6160, - 0x9153, 0x6161, 0x9154, 0x6163, 0x9155, 0x6164, 0x9156, 0x6165, - 0x9157, 0x6166, 0x9158, 0x6169, 0x9159, 0x616A, 0x915A, 0x616B, - 0x915B, 0x616C, 0x915C, 0x616D, 0x915D, 0x616E, 0x915E, 0x616F, - 0x915F, 0x6171, 0x9160, 0x6172, 0x9161, 0x6173, 0x9162, 0x6174, - 0x9163, 0x6176, 0x9164, 0x6178, 0x9165, 0x6179, 0x9166, 0x617A, - 0x9167, 0x617B, 0x9168, 0x617C, 0x9169, 0x617D, 0x916A, 0x617E, - 0x916B, 0x617F, 0x916C, 0x6180, 0x916D, 0x6181, 0x916E, 0x6182, - 0x916F, 0x6183, 0x9170, 0x6184, 0x9171, 0x6185, 0x9172, 0x6186, - 0x9173, 0x6187, 0x9174, 0x6188, 0x9175, 0x6189, 0x9176, 0x618A, - 0x9177, 0x618C, 0x9178, 0x618D, 0x9179, 0x618F, 0x917A, 0x6190, - 0x917B, 0x6191, 0x917C, 0x6192, 0x917D, 0x6193, 0x917E, 0x6195, - 0x9180, 0x6196, 0x9181, 0x6197, 0x9182, 0x6198, 0x9183, 0x6199, - 0x9184, 0x619A, 0x9185, 0x619B, 0x9186, 0x619C, 0x9187, 0x619E, - 0x9188, 0x619F, 0x9189, 0x61A0, 0x918A, 0x61A1, 0x918B, 0x61A2, - 0x918C, 0x61A3, 0x918D, 0x61A4, 0x918E, 0x61A5, 0x918F, 0x61A6, - 0x9190, 0x61AA, 0x9191, 0x61AB, 0x9192, 0x61AD, 0x9193, 0x61AE, - 0x9194, 0x61AF, 0x9195, 0x61B0, 0x9196, 0x61B1, 0x9197, 0x61B2, - 0x9198, 0x61B3, 0x9199, 0x61B4, 0x919A, 0x61B5, 0x919B, 0x61B6, - 0x919C, 0x61B8, 0x919D, 0x61B9, 0x919E, 0x61BA, 0x919F, 0x61BB, - 0x91A0, 0x61BC, 0x91A1, 0x61BD, 0x91A2, 0x61BF, 0x91A3, 0x61C0, - 0x91A4, 0x61C1, 0x91A5, 0x61C3, 0x91A6, 0x61C4, 0x91A7, 0x61C5, - 0x91A8, 0x61C6, 0x91A9, 0x61C7, 0x91AA, 0x61C9, 0x91AB, 0x61CC, - 0x91AC, 0x61CD, 0x91AD, 0x61CE, 0x91AE, 0x61CF, 0x91AF, 0x61D0, - 0x91B0, 0x61D3, 0x91B1, 0x61D5, 0x91B2, 0x61D6, 0x91B3, 0x61D7, - 0x91B4, 0x61D8, 0x91B5, 0x61D9, 0x91B6, 0x61DA, 0x91B7, 0x61DB, - 0x91B8, 0x61DC, 0x91B9, 0x61DD, 0x91BA, 0x61DE, 0x91BB, 0x61DF, - 0x91BC, 0x61E0, 0x91BD, 0x61E1, 0x91BE, 0x61E2, 0x91BF, 0x61E3, - 0x91C0, 0x61E4, 0x91C1, 0x61E5, 0x91C2, 0x61E7, 0x91C3, 0x61E8, - 0x91C4, 0x61E9, 0x91C5, 0x61EA, 0x91C6, 0x61EB, 0x91C7, 0x61EC, - 0x91C8, 0x61ED, 0x91C9, 0x61EE, 0x91CA, 0x61EF, 0x91CB, 0x61F0, - 0x91CC, 0x61F1, 0x91CD, 0x61F2, 0x91CE, 0x61F3, 0x91CF, 0x61F4, - 0x91D0, 0x61F6, 0x91D1, 0x61F7, 0x91D2, 0x61F8, 0x91D3, 0x61F9, - 0x91D4, 0x61FA, 0x91D5, 0x61FB, 0x91D6, 0x61FC, 0x91D7, 0x61FD, - 0x91D8, 0x61FE, 0x91D9, 0x6200, 0x91DA, 0x6201, 0x91DB, 0x6202, - 0x91DC, 0x6203, 0x91DD, 0x6204, 0x91DE, 0x6205, 0x91DF, 0x6207, - 0x91E0, 0x6209, 0x91E1, 0x6213, 0x91E2, 0x6214, 0x91E3, 0x6219, - 0x91E4, 0x621C, 0x91E5, 0x621D, 0x91E6, 0x621E, 0x91E7, 0x6220, - 0x91E8, 0x6223, 0x91E9, 0x6226, 0x91EA, 0x6227, 0x91EB, 0x6228, - 0x91EC, 0x6229, 0x91ED, 0x622B, 0x91EE, 0x622D, 0x91EF, 0x622F, - 0x91F0, 0x6230, 0x91F1, 0x6231, 0x91F2, 0x6232, 0x91F3, 0x6235, - 0x91F4, 0x6236, 0x91F5, 0x6238, 0x91F6, 0x6239, 0x91F7, 0x623A, - 0x91F8, 0x623B, 0x91F9, 0x623C, 0x91FA, 0x6242, 0x91FB, 0x6244, - 0x91FC, 0x6245, 0x91FD, 0x6246, 0x91FE, 0x624A, 0x9240, 0x624F, - 0x9241, 0x6250, 0x9242, 0x6255, 0x9243, 0x6256, 0x9244, 0x6257, - 0x9245, 0x6259, 0x9246, 0x625A, 0x9247, 0x625C, 0x9248, 0x625D, - 0x9249, 0x625E, 0x924A, 0x625F, 0x924B, 0x6260, 0x924C, 0x6261, - 0x924D, 0x6262, 0x924E, 0x6264, 0x924F, 0x6265, 0x9250, 0x6268, - 0x9251, 0x6271, 0x9252, 0x6272, 0x9253, 0x6274, 0x9254, 0x6275, - 0x9255, 0x6277, 0x9256, 0x6278, 0x9257, 0x627A, 0x9258, 0x627B, - 0x9259, 0x627D, 0x925A, 0x6281, 0x925B, 0x6282, 0x925C, 0x6283, - 0x925D, 0x6285, 0x925E, 0x6286, 0x925F, 0x6287, 0x9260, 0x6288, - 0x9261, 0x628B, 0x9262, 0x628C, 0x9263, 0x628D, 0x9264, 0x628E, - 0x9265, 0x628F, 0x9266, 0x6290, 0x9267, 0x6294, 0x9268, 0x6299, - 0x9269, 0x629C, 0x926A, 0x629D, 0x926B, 0x629E, 0x926C, 0x62A3, - 0x926D, 0x62A6, 0x926E, 0x62A7, 0x926F, 0x62A9, 0x9270, 0x62AA, - 0x9271, 0x62AD, 0x9272, 0x62AE, 0x9273, 0x62AF, 0x9274, 0x62B0, - 0x9275, 0x62B2, 0x9276, 0x62B3, 0x9277, 0x62B4, 0x9278, 0x62B6, - 0x9279, 0x62B7, 0x927A, 0x62B8, 0x927B, 0x62BA, 0x927C, 0x62BE, - 0x927D, 0x62C0, 0x927E, 0x62C1, 0x9280, 0x62C3, 0x9281, 0x62CB, - 0x9282, 0x62CF, 0x9283, 0x62D1, 0x9284, 0x62D5, 0x9285, 0x62DD, - 0x9286, 0x62DE, 0x9287, 0x62E0, 0x9288, 0x62E1, 0x9289, 0x62E4, - 0x928A, 0x62EA, 0x928B, 0x62EB, 0x928C, 0x62F0, 0x928D, 0x62F2, - 0x928E, 0x62F5, 0x928F, 0x62F8, 0x9290, 0x62F9, 0x9291, 0x62FA, - 0x9292, 0x62FB, 0x9293, 0x6300, 0x9294, 0x6303, 0x9295, 0x6304, - 0x9296, 0x6305, 0x9297, 0x6306, 0x9298, 0x630A, 0x9299, 0x630B, - 0x929A, 0x630C, 0x929B, 0x630D, 0x929C, 0x630F, 0x929D, 0x6310, - 0x929E, 0x6312, 0x929F, 0x6313, 0x92A0, 0x6314, 0x92A1, 0x6315, - 0x92A2, 0x6317, 0x92A3, 0x6318, 0x92A4, 0x6319, 0x92A5, 0x631C, - 0x92A6, 0x6326, 0x92A7, 0x6327, 0x92A8, 0x6329, 0x92A9, 0x632C, - 0x92AA, 0x632D, 0x92AB, 0x632E, 0x92AC, 0x6330, 0x92AD, 0x6331, - 0x92AE, 0x6333, 0x92AF, 0x6334, 0x92B0, 0x6335, 0x92B1, 0x6336, - 0x92B2, 0x6337, 0x92B3, 0x6338, 0x92B4, 0x633B, 0x92B5, 0x633C, - 0x92B6, 0x633E, 0x92B7, 0x633F, 0x92B8, 0x6340, 0x92B9, 0x6341, - 0x92BA, 0x6344, 0x92BB, 0x6347, 0x92BC, 0x6348, 0x92BD, 0x634A, - 0x92BE, 0x6351, 0x92BF, 0x6352, 0x92C0, 0x6353, 0x92C1, 0x6354, - 0x92C2, 0x6356, 0x92C3, 0x6357, 0x92C4, 0x6358, 0x92C5, 0x6359, - 0x92C6, 0x635A, 0x92C7, 0x635B, 0x92C8, 0x635C, 0x92C9, 0x635D, - 0x92CA, 0x6360, 0x92CB, 0x6364, 0x92CC, 0x6365, 0x92CD, 0x6366, - 0x92CE, 0x6368, 0x92CF, 0x636A, 0x92D0, 0x636B, 0x92D1, 0x636C, - 0x92D2, 0x636F, 0x92D3, 0x6370, 0x92D4, 0x6372, 0x92D5, 0x6373, - 0x92D6, 0x6374, 0x92D7, 0x6375, 0x92D8, 0x6378, 0x92D9, 0x6379, - 0x92DA, 0x637C, 0x92DB, 0x637D, 0x92DC, 0x637E, 0x92DD, 0x637F, - 0x92DE, 0x6381, 0x92DF, 0x6383, 0x92E0, 0x6384, 0x92E1, 0x6385, - 0x92E2, 0x6386, 0x92E3, 0x638B, 0x92E4, 0x638D, 0x92E5, 0x6391, - 0x92E6, 0x6393, 0x92E7, 0x6394, 0x92E8, 0x6395, 0x92E9, 0x6397, - 0x92EA, 0x6399, 0x92EB, 0x639A, 0x92EC, 0x639B, 0x92ED, 0x639C, - 0x92EE, 0x639D, 0x92EF, 0x639E, 0x92F0, 0x639F, 0x92F1, 0x63A1, - 0x92F2, 0x63A4, 0x92F3, 0x63A6, 0x92F4, 0x63AB, 0x92F5, 0x63AF, - 0x92F6, 0x63B1, 0x92F7, 0x63B2, 0x92F8, 0x63B5, 0x92F9, 0x63B6, - 0x92FA, 0x63B9, 0x92FB, 0x63BB, 0x92FC, 0x63BD, 0x92FD, 0x63BF, - 0x92FE, 0x63C0, 0x9340, 0x63C1, 0x9341, 0x63C2, 0x9342, 0x63C3, - 0x9343, 0x63C5, 0x9344, 0x63C7, 0x9345, 0x63C8, 0x9346, 0x63CA, - 0x9347, 0x63CB, 0x9348, 0x63CC, 0x9349, 0x63D1, 0x934A, 0x63D3, - 0x934B, 0x63D4, 0x934C, 0x63D5, 0x934D, 0x63D7, 0x934E, 0x63D8, - 0x934F, 0x63D9, 0x9350, 0x63DA, 0x9351, 0x63DB, 0x9352, 0x63DC, - 0x9353, 0x63DD, 0x9354, 0x63DF, 0x9355, 0x63E2, 0x9356, 0x63E4, - 0x9357, 0x63E5, 0x9358, 0x63E6, 0x9359, 0x63E7, 0x935A, 0x63E8, - 0x935B, 0x63EB, 0x935C, 0x63EC, 0x935D, 0x63EE, 0x935E, 0x63EF, - 0x935F, 0x63F0, 0x9360, 0x63F1, 0x9361, 0x63F3, 0x9362, 0x63F5, - 0x9363, 0x63F7, 0x9364, 0x63F9, 0x9365, 0x63FA, 0x9366, 0x63FB, - 0x9367, 0x63FC, 0x9368, 0x63FE, 0x9369, 0x6403, 0x936A, 0x6404, - 0x936B, 0x6406, 0x936C, 0x6407, 0x936D, 0x6408, 0x936E, 0x6409, - 0x936F, 0x640A, 0x9370, 0x640D, 0x9371, 0x640E, 0x9372, 0x6411, - 0x9373, 0x6412, 0x9374, 0x6415, 0x9375, 0x6416, 0x9376, 0x6417, - 0x9377, 0x6418, 0x9378, 0x6419, 0x9379, 0x641A, 0x937A, 0x641D, - 0x937B, 0x641F, 0x937C, 0x6422, 0x937D, 0x6423, 0x937E, 0x6424, - 0x9380, 0x6425, 0x9381, 0x6427, 0x9382, 0x6428, 0x9383, 0x6429, - 0x9384, 0x642B, 0x9385, 0x642E, 0x9386, 0x642F, 0x9387, 0x6430, - 0x9388, 0x6431, 0x9389, 0x6432, 0x938A, 0x6433, 0x938B, 0x6435, - 0x938C, 0x6436, 0x938D, 0x6437, 0x938E, 0x6438, 0x938F, 0x6439, - 0x9390, 0x643B, 0x9391, 0x643C, 0x9392, 0x643E, 0x9393, 0x6440, - 0x9394, 0x6442, 0x9395, 0x6443, 0x9396, 0x6449, 0x9397, 0x644B, - 0x9398, 0x644C, 0x9399, 0x644D, 0x939A, 0x644E, 0x939B, 0x644F, - 0x939C, 0x6450, 0x939D, 0x6451, 0x939E, 0x6453, 0x939F, 0x6455, - 0x93A0, 0x6456, 0x93A1, 0x6457, 0x93A2, 0x6459, 0x93A3, 0x645A, - 0x93A4, 0x645B, 0x93A5, 0x645C, 0x93A6, 0x645D, 0x93A7, 0x645F, - 0x93A8, 0x6460, 0x93A9, 0x6461, 0x93AA, 0x6462, 0x93AB, 0x6463, - 0x93AC, 0x6464, 0x93AD, 0x6465, 0x93AE, 0x6466, 0x93AF, 0x6468, - 0x93B0, 0x646A, 0x93B1, 0x646B, 0x93B2, 0x646C, 0x93B3, 0x646E, - 0x93B4, 0x646F, 0x93B5, 0x6470, 0x93B6, 0x6471, 0x93B7, 0x6472, - 0x93B8, 0x6473, 0x93B9, 0x6474, 0x93BA, 0x6475, 0x93BB, 0x6476, - 0x93BC, 0x6477, 0x93BD, 0x647B, 0x93BE, 0x647C, 0x93BF, 0x647D, - 0x93C0, 0x647E, 0x93C1, 0x647F, 0x93C2, 0x6480, 0x93C3, 0x6481, - 0x93C4, 0x6483, 0x93C5, 0x6486, 0x93C6, 0x6488, 0x93C7, 0x6489, - 0x93C8, 0x648A, 0x93C9, 0x648B, 0x93CA, 0x648C, 0x93CB, 0x648D, - 0x93CC, 0x648E, 0x93CD, 0x648F, 0x93CE, 0x6490, 0x93CF, 0x6493, - 0x93D0, 0x6494, 0x93D1, 0x6497, 0x93D2, 0x6498, 0x93D3, 0x649A, - 0x93D4, 0x649B, 0x93D5, 0x649C, 0x93D6, 0x649D, 0x93D7, 0x649F, - 0x93D8, 0x64A0, 0x93D9, 0x64A1, 0x93DA, 0x64A2, 0x93DB, 0x64A3, - 0x93DC, 0x64A5, 0x93DD, 0x64A6, 0x93DE, 0x64A7, 0x93DF, 0x64A8, - 0x93E0, 0x64AA, 0x93E1, 0x64AB, 0x93E2, 0x64AF, 0x93E3, 0x64B1, - 0x93E4, 0x64B2, 0x93E5, 0x64B3, 0x93E6, 0x64B4, 0x93E7, 0x64B6, - 0x93E8, 0x64B9, 0x93E9, 0x64BB, 0x93EA, 0x64BD, 0x93EB, 0x64BE, - 0x93EC, 0x64BF, 0x93ED, 0x64C1, 0x93EE, 0x64C3, 0x93EF, 0x64C4, - 0x93F0, 0x64C6, 0x93F1, 0x64C7, 0x93F2, 0x64C8, 0x93F3, 0x64C9, - 0x93F4, 0x64CA, 0x93F5, 0x64CB, 0x93F6, 0x64CC, 0x93F7, 0x64CF, - 0x93F8, 0x64D1, 0x93F9, 0x64D3, 0x93FA, 0x64D4, 0x93FB, 0x64D5, - 0x93FC, 0x64D6, 0x93FD, 0x64D9, 0x93FE, 0x64DA, 0x9440, 0x64DB, - 0x9441, 0x64DC, 0x9442, 0x64DD, 0x9443, 0x64DF, 0x9444, 0x64E0, - 0x9445, 0x64E1, 0x9446, 0x64E3, 0x9447, 0x64E5, 0x9448, 0x64E7, - 0x9449, 0x64E8, 0x944A, 0x64E9, 0x944B, 0x64EA, 0x944C, 0x64EB, - 0x944D, 0x64EC, 0x944E, 0x64ED, 0x944F, 0x64EE, 0x9450, 0x64EF, - 0x9451, 0x64F0, 0x9452, 0x64F1, 0x9453, 0x64F2, 0x9454, 0x64F3, - 0x9455, 0x64F4, 0x9456, 0x64F5, 0x9457, 0x64F6, 0x9458, 0x64F7, - 0x9459, 0x64F8, 0x945A, 0x64F9, 0x945B, 0x64FA, 0x945C, 0x64FB, - 0x945D, 0x64FC, 0x945E, 0x64FD, 0x945F, 0x64FE, 0x9460, 0x64FF, - 0x9461, 0x6501, 0x9462, 0x6502, 0x9463, 0x6503, 0x9464, 0x6504, - 0x9465, 0x6505, 0x9466, 0x6506, 0x9467, 0x6507, 0x9468, 0x6508, - 0x9469, 0x650A, 0x946A, 0x650B, 0x946B, 0x650C, 0x946C, 0x650D, - 0x946D, 0x650E, 0x946E, 0x650F, 0x946F, 0x6510, 0x9470, 0x6511, - 0x9471, 0x6513, 0x9472, 0x6514, 0x9473, 0x6515, 0x9474, 0x6516, - 0x9475, 0x6517, 0x9476, 0x6519, 0x9477, 0x651A, 0x9478, 0x651B, - 0x9479, 0x651C, 0x947A, 0x651D, 0x947B, 0x651E, 0x947C, 0x651F, - 0x947D, 0x6520, 0x947E, 0x6521, 0x9480, 0x6522, 0x9481, 0x6523, - 0x9482, 0x6524, 0x9483, 0x6526, 0x9484, 0x6527, 0x9485, 0x6528, - 0x9486, 0x6529, 0x9487, 0x652A, 0x9488, 0x652C, 0x9489, 0x652D, - 0x948A, 0x6530, 0x948B, 0x6531, 0x948C, 0x6532, 0x948D, 0x6533, - 0x948E, 0x6537, 0x948F, 0x653A, 0x9490, 0x653C, 0x9491, 0x653D, - 0x9492, 0x6540, 0x9493, 0x6541, 0x9494, 0x6542, 0x9495, 0x6543, - 0x9496, 0x6544, 0x9497, 0x6546, 0x9498, 0x6547, 0x9499, 0x654A, - 0x949A, 0x654B, 0x949B, 0x654D, 0x949C, 0x654E, 0x949D, 0x6550, - 0x949E, 0x6552, 0x949F, 0x6553, 0x94A0, 0x6554, 0x94A1, 0x6557, - 0x94A2, 0x6558, 0x94A3, 0x655A, 0x94A4, 0x655C, 0x94A5, 0x655F, - 0x94A6, 0x6560, 0x94A7, 0x6561, 0x94A8, 0x6564, 0x94A9, 0x6565, - 0x94AA, 0x6567, 0x94AB, 0x6568, 0x94AC, 0x6569, 0x94AD, 0x656A, - 0x94AE, 0x656D, 0x94AF, 0x656E, 0x94B0, 0x656F, 0x94B1, 0x6571, - 0x94B2, 0x6573, 0x94B3, 0x6575, 0x94B4, 0x6576, 0x94B5, 0x6578, - 0x94B6, 0x6579, 0x94B7, 0x657A, 0x94B8, 0x657B, 0x94B9, 0x657C, - 0x94BA, 0x657D, 0x94BB, 0x657E, 0x94BC, 0x657F, 0x94BD, 0x6580, - 0x94BE, 0x6581, 0x94BF, 0x6582, 0x94C0, 0x6583, 0x94C1, 0x6584, - 0x94C2, 0x6585, 0x94C3, 0x6586, 0x94C4, 0x6588, 0x94C5, 0x6589, - 0x94C6, 0x658A, 0x94C7, 0x658D, 0x94C8, 0x658E, 0x94C9, 0x658F, - 0x94CA, 0x6592, 0x94CB, 0x6594, 0x94CC, 0x6595, 0x94CD, 0x6596, - 0x94CE, 0x6598, 0x94CF, 0x659A, 0x94D0, 0x659D, 0x94D1, 0x659E, - 0x94D2, 0x65A0, 0x94D3, 0x65A2, 0x94D4, 0x65A3, 0x94D5, 0x65A6, - 0x94D6, 0x65A8, 0x94D7, 0x65AA, 0x94D8, 0x65AC, 0x94D9, 0x65AE, - 0x94DA, 0x65B1, 0x94DB, 0x65B2, 0x94DC, 0x65B3, 0x94DD, 0x65B4, - 0x94DE, 0x65B5, 0x94DF, 0x65B6, 0x94E0, 0x65B7, 0x94E1, 0x65B8, - 0x94E2, 0x65BA, 0x94E3, 0x65BB, 0x94E4, 0x65BE, 0x94E5, 0x65BF, - 0x94E6, 0x65C0, 0x94E7, 0x65C2, 0x94E8, 0x65C7, 0x94E9, 0x65C8, - 0x94EA, 0x65C9, 0x94EB, 0x65CA, 0x94EC, 0x65CD, 0x94ED, 0x65D0, - 0x94EE, 0x65D1, 0x94EF, 0x65D3, 0x94F0, 0x65D4, 0x94F1, 0x65D5, - 0x94F2, 0x65D8, 0x94F3, 0x65D9, 0x94F4, 0x65DA, 0x94F5, 0x65DB, - 0x94F6, 0x65DC, 0x94F7, 0x65DD, 0x94F8, 0x65DE, 0x94F9, 0x65DF, - 0x94FA, 0x65E1, 0x94FB, 0x65E3, 0x94FC, 0x65E4, 0x94FD, 0x65EA, - 0x94FE, 0x65EB, 0x9540, 0x65F2, 0x9541, 0x65F3, 0x9542, 0x65F4, - 0x9543, 0x65F5, 0x9544, 0x65F8, 0x9545, 0x65F9, 0x9546, 0x65FB, - 0x9547, 0x65FC, 0x9548, 0x65FD, 0x9549, 0x65FE, 0x954A, 0x65FF, - 0x954B, 0x6601, 0x954C, 0x6604, 0x954D, 0x6605, 0x954E, 0x6607, - 0x954F, 0x6608, 0x9550, 0x6609, 0x9551, 0x660B, 0x9552, 0x660D, - 0x9553, 0x6610, 0x9554, 0x6611, 0x9555, 0x6612, 0x9556, 0x6616, - 0x9557, 0x6617, 0x9558, 0x6618, 0x9559, 0x661A, 0x955A, 0x661B, - 0x955B, 0x661C, 0x955C, 0x661E, 0x955D, 0x6621, 0x955E, 0x6622, - 0x955F, 0x6623, 0x9560, 0x6624, 0x9561, 0x6626, 0x9562, 0x6629, - 0x9563, 0x662A, 0x9564, 0x662B, 0x9565, 0x662C, 0x9566, 0x662E, - 0x9567, 0x6630, 0x9568, 0x6632, 0x9569, 0x6633, 0x956A, 0x6637, - 0x956B, 0x6638, 0x956C, 0x6639, 0x956D, 0x663A, 0x956E, 0x663B, - 0x956F, 0x663D, 0x9570, 0x663F, 0x9571, 0x6640, 0x9572, 0x6642, - 0x9573, 0x6644, 0x9574, 0x6645, 0x9575, 0x6646, 0x9576, 0x6647, - 0x9577, 0x6648, 0x9578, 0x6649, 0x9579, 0x664A, 0x957A, 0x664D, - 0x957B, 0x664E, 0x957C, 0x6650, 0x957D, 0x6651, 0x957E, 0x6658, - 0x9580, 0x6659, 0x9581, 0x665B, 0x9582, 0x665C, 0x9583, 0x665D, - 0x9584, 0x665E, 0x9585, 0x6660, 0x9586, 0x6662, 0x9587, 0x6663, - 0x9588, 0x6665, 0x9589, 0x6667, 0x958A, 0x6669, 0x958B, 0x666A, - 0x958C, 0x666B, 0x958D, 0x666C, 0x958E, 0x666D, 0x958F, 0x6671, - 0x9590, 0x6672, 0x9591, 0x6673, 0x9592, 0x6675, 0x9593, 0x6678, - 0x9594, 0x6679, 0x9595, 0x667B, 0x9596, 0x667C, 0x9597, 0x667D, - 0x9598, 0x667F, 0x9599, 0x6680, 0x959A, 0x6681, 0x959B, 0x6683, - 0x959C, 0x6685, 0x959D, 0x6686, 0x959E, 0x6688, 0x959F, 0x6689, - 0x95A0, 0x668A, 0x95A1, 0x668B, 0x95A2, 0x668D, 0x95A3, 0x668E, - 0x95A4, 0x668F, 0x95A5, 0x6690, 0x95A6, 0x6692, 0x95A7, 0x6693, - 0x95A8, 0x6694, 0x95A9, 0x6695, 0x95AA, 0x6698, 0x95AB, 0x6699, - 0x95AC, 0x669A, 0x95AD, 0x669B, 0x95AE, 0x669C, 0x95AF, 0x669E, - 0x95B0, 0x669F, 0x95B1, 0x66A0, 0x95B2, 0x66A1, 0x95B3, 0x66A2, - 0x95B4, 0x66A3, 0x95B5, 0x66A4, 0x95B6, 0x66A5, 0x95B7, 0x66A6, - 0x95B8, 0x66A9, 0x95B9, 0x66AA, 0x95BA, 0x66AB, 0x95BB, 0x66AC, - 0x95BC, 0x66AD, 0x95BD, 0x66AF, 0x95BE, 0x66B0, 0x95BF, 0x66B1, - 0x95C0, 0x66B2, 0x95C1, 0x66B3, 0x95C2, 0x66B5, 0x95C3, 0x66B6, - 0x95C4, 0x66B7, 0x95C5, 0x66B8, 0x95C6, 0x66BA, 0x95C7, 0x66BB, - 0x95C8, 0x66BC, 0x95C9, 0x66BD, 0x95CA, 0x66BF, 0x95CB, 0x66C0, - 0x95CC, 0x66C1, 0x95CD, 0x66C2, 0x95CE, 0x66C3, 0x95CF, 0x66C4, - 0x95D0, 0x66C5, 0x95D1, 0x66C6, 0x95D2, 0x66C7, 0x95D3, 0x66C8, - 0x95D4, 0x66C9, 0x95D5, 0x66CA, 0x95D6, 0x66CB, 0x95D7, 0x66CC, - 0x95D8, 0x66CD, 0x95D9, 0x66CE, 0x95DA, 0x66CF, 0x95DB, 0x66D0, - 0x95DC, 0x66D1, 0x95DD, 0x66D2, 0x95DE, 0x66D3, 0x95DF, 0x66D4, - 0x95E0, 0x66D5, 0x95E1, 0x66D6, 0x95E2, 0x66D7, 0x95E3, 0x66D8, - 0x95E4, 0x66DA, 0x95E5, 0x66DE, 0x95E6, 0x66DF, 0x95E7, 0x66E0, - 0x95E8, 0x66E1, 0x95E9, 0x66E2, 0x95EA, 0x66E3, 0x95EB, 0x66E4, - 0x95EC, 0x66E5, 0x95ED, 0x66E7, 0x95EE, 0x66E8, 0x95EF, 0x66EA, - 0x95F0, 0x66EB, 0x95F1, 0x66EC, 0x95F2, 0x66ED, 0x95F3, 0x66EE, - 0x95F4, 0x66EF, 0x95F5, 0x66F1, 0x95F6, 0x66F5, 0x95F7, 0x66F6, - 0x95F8, 0x66F8, 0x95F9, 0x66FA, 0x95FA, 0x66FB, 0x95FB, 0x66FD, - 0x95FC, 0x6701, 0x95FD, 0x6702, 0x95FE, 0x6703, 0x9640, 0x6704, - 0x9641, 0x6705, 0x9642, 0x6706, 0x9643, 0x6707, 0x9644, 0x670C, - 0x9645, 0x670E, 0x9646, 0x670F, 0x9647, 0x6711, 0x9648, 0x6712, - 0x9649, 0x6713, 0x964A, 0x6716, 0x964B, 0x6718, 0x964C, 0x6719, - 0x964D, 0x671A, 0x964E, 0x671C, 0x964F, 0x671E, 0x9650, 0x6720, - 0x9651, 0x6721, 0x9652, 0x6722, 0x9653, 0x6723, 0x9654, 0x6724, - 0x9655, 0x6725, 0x9656, 0x6727, 0x9657, 0x6729, 0x9658, 0x672E, - 0x9659, 0x6730, 0x965A, 0x6732, 0x965B, 0x6733, 0x965C, 0x6736, - 0x965D, 0x6737, 0x965E, 0x6738, 0x965F, 0x6739, 0x9660, 0x673B, - 0x9661, 0x673C, 0x9662, 0x673E, 0x9663, 0x673F, 0x9664, 0x6741, - 0x9665, 0x6744, 0x9666, 0x6745, 0x9667, 0x6747, 0x9668, 0x674A, - 0x9669, 0x674B, 0x966A, 0x674D, 0x966B, 0x6752, 0x966C, 0x6754, - 0x966D, 0x6755, 0x966E, 0x6757, 0x966F, 0x6758, 0x9670, 0x6759, - 0x9671, 0x675A, 0x9672, 0x675B, 0x9673, 0x675D, 0x9674, 0x6762, - 0x9675, 0x6763, 0x9676, 0x6764, 0x9677, 0x6766, 0x9678, 0x6767, - 0x9679, 0x676B, 0x967A, 0x676C, 0x967B, 0x676E, 0x967C, 0x6771, - 0x967D, 0x6774, 0x967E, 0x6776, 0x9680, 0x6778, 0x9681, 0x6779, - 0x9682, 0x677A, 0x9683, 0x677B, 0x9684, 0x677D, 0x9685, 0x6780, - 0x9686, 0x6782, 0x9687, 0x6783, 0x9688, 0x6785, 0x9689, 0x6786, - 0x968A, 0x6788, 0x968B, 0x678A, 0x968C, 0x678C, 0x968D, 0x678D, - 0x968E, 0x678E, 0x968F, 0x678F, 0x9690, 0x6791, 0x9691, 0x6792, - 0x9692, 0x6793, 0x9693, 0x6794, 0x9694, 0x6796, 0x9695, 0x6799, - 0x9696, 0x679B, 0x9697, 0x679F, 0x9698, 0x67A0, 0x9699, 0x67A1, - 0x969A, 0x67A4, 0x969B, 0x67A6, 0x969C, 0x67A9, 0x969D, 0x67AC, - 0x969E, 0x67AE, 0x969F, 0x67B1, 0x96A0, 0x67B2, 0x96A1, 0x67B4, - 0x96A2, 0x67B9, 0x96A3, 0x67BA, 0x96A4, 0x67BB, 0x96A5, 0x67BC, - 0x96A6, 0x67BD, 0x96A7, 0x67BE, 0x96A8, 0x67BF, 0x96A9, 0x67C0, - 0x96AA, 0x67C2, 0x96AB, 0x67C5, 0x96AC, 0x67C6, 0x96AD, 0x67C7, - 0x96AE, 0x67C8, 0x96AF, 0x67C9, 0x96B0, 0x67CA, 0x96B1, 0x67CB, - 0x96B2, 0x67CC, 0x96B3, 0x67CD, 0x96B4, 0x67CE, 0x96B5, 0x67D5, - 0x96B6, 0x67D6, 0x96B7, 0x67D7, 0x96B8, 0x67DB, 0x96B9, 0x67DF, - 0x96BA, 0x67E1, 0x96BB, 0x67E3, 0x96BC, 0x67E4, 0x96BD, 0x67E6, - 0x96BE, 0x67E7, 0x96BF, 0x67E8, 0x96C0, 0x67EA, 0x96C1, 0x67EB, - 0x96C2, 0x67ED, 0x96C3, 0x67EE, 0x96C4, 0x67F2, 0x96C5, 0x67F5, - 0x96C6, 0x67F6, 0x96C7, 0x67F7, 0x96C8, 0x67F8, 0x96C9, 0x67F9, - 0x96CA, 0x67FA, 0x96CB, 0x67FB, 0x96CC, 0x67FC, 0x96CD, 0x67FE, - 0x96CE, 0x6801, 0x96CF, 0x6802, 0x96D0, 0x6803, 0x96D1, 0x6804, - 0x96D2, 0x6806, 0x96D3, 0x680D, 0x96D4, 0x6810, 0x96D5, 0x6812, - 0x96D6, 0x6814, 0x96D7, 0x6815, 0x96D8, 0x6818, 0x96D9, 0x6819, - 0x96DA, 0x681A, 0x96DB, 0x681B, 0x96DC, 0x681C, 0x96DD, 0x681E, - 0x96DE, 0x681F, 0x96DF, 0x6820, 0x96E0, 0x6822, 0x96E1, 0x6823, - 0x96E2, 0x6824, 0x96E3, 0x6825, 0x96E4, 0x6826, 0x96E5, 0x6827, - 0x96E6, 0x6828, 0x96E7, 0x682B, 0x96E8, 0x682C, 0x96E9, 0x682D, - 0x96EA, 0x682E, 0x96EB, 0x682F, 0x96EC, 0x6830, 0x96ED, 0x6831, - 0x96EE, 0x6834, 0x96EF, 0x6835, 0x96F0, 0x6836, 0x96F1, 0x683A, - 0x96F2, 0x683B, 0x96F3, 0x683F, 0x96F4, 0x6847, 0x96F5, 0x684B, - 0x96F6, 0x684D, 0x96F7, 0x684F, 0x96F8, 0x6852, 0x96F9, 0x6856, - 0x96FA, 0x6857, 0x96FB, 0x6858, 0x96FC, 0x6859, 0x96FD, 0x685A, - 0x96FE, 0x685B, 0x9740, 0x685C, 0x9741, 0x685D, 0x9742, 0x685E, - 0x9743, 0x685F, 0x9744, 0x686A, 0x9745, 0x686C, 0x9746, 0x686D, - 0x9747, 0x686E, 0x9748, 0x686F, 0x9749, 0x6870, 0x974A, 0x6871, - 0x974B, 0x6872, 0x974C, 0x6873, 0x974D, 0x6875, 0x974E, 0x6878, - 0x974F, 0x6879, 0x9750, 0x687A, 0x9751, 0x687B, 0x9752, 0x687C, - 0x9753, 0x687D, 0x9754, 0x687E, 0x9755, 0x687F, 0x9756, 0x6880, - 0x9757, 0x6882, 0x9758, 0x6884, 0x9759, 0x6887, 0x975A, 0x6888, - 0x975B, 0x6889, 0x975C, 0x688A, 0x975D, 0x688B, 0x975E, 0x688C, - 0x975F, 0x688D, 0x9760, 0x688E, 0x9761, 0x6890, 0x9762, 0x6891, - 0x9763, 0x6892, 0x9764, 0x6894, 0x9765, 0x6895, 0x9766, 0x6896, - 0x9767, 0x6898, 0x9768, 0x6899, 0x9769, 0x689A, 0x976A, 0x689B, - 0x976B, 0x689C, 0x976C, 0x689D, 0x976D, 0x689E, 0x976E, 0x689F, - 0x976F, 0x68A0, 0x9770, 0x68A1, 0x9771, 0x68A3, 0x9772, 0x68A4, - 0x9773, 0x68A5, 0x9774, 0x68A9, 0x9775, 0x68AA, 0x9776, 0x68AB, - 0x9777, 0x68AC, 0x9778, 0x68AE, 0x9779, 0x68B1, 0x977A, 0x68B2, - 0x977B, 0x68B4, 0x977C, 0x68B6, 0x977D, 0x68B7, 0x977E, 0x68B8, - 0x9780, 0x68B9, 0x9781, 0x68BA, 0x9782, 0x68BB, 0x9783, 0x68BC, - 0x9784, 0x68BD, 0x9785, 0x68BE, 0x9786, 0x68BF, 0x9787, 0x68C1, - 0x9788, 0x68C3, 0x9789, 0x68C4, 0x978A, 0x68C5, 0x978B, 0x68C6, - 0x978C, 0x68C7, 0x978D, 0x68C8, 0x978E, 0x68CA, 0x978F, 0x68CC, - 0x9790, 0x68CE, 0x9791, 0x68CF, 0x9792, 0x68D0, 0x9793, 0x68D1, - 0x9794, 0x68D3, 0x9795, 0x68D4, 0x9796, 0x68D6, 0x9797, 0x68D7, - 0x9798, 0x68D9, 0x9799, 0x68DB, 0x979A, 0x68DC, 0x979B, 0x68DD, - 0x979C, 0x68DE, 0x979D, 0x68DF, 0x979E, 0x68E1, 0x979F, 0x68E2, - 0x97A0, 0x68E4, 0x97A1, 0x68E5, 0x97A2, 0x68E6, 0x97A3, 0x68E7, - 0x97A4, 0x68E8, 0x97A5, 0x68E9, 0x97A6, 0x68EA, 0x97A7, 0x68EB, - 0x97A8, 0x68EC, 0x97A9, 0x68ED, 0x97AA, 0x68EF, 0x97AB, 0x68F2, - 0x97AC, 0x68F3, 0x97AD, 0x68F4, 0x97AE, 0x68F6, 0x97AF, 0x68F7, - 0x97B0, 0x68F8, 0x97B1, 0x68FB, 0x97B2, 0x68FD, 0x97B3, 0x68FE, - 0x97B4, 0x68FF, 0x97B5, 0x6900, 0x97B6, 0x6902, 0x97B7, 0x6903, - 0x97B8, 0x6904, 0x97B9, 0x6906, 0x97BA, 0x6907, 0x97BB, 0x6908, - 0x97BC, 0x6909, 0x97BD, 0x690A, 0x97BE, 0x690C, 0x97BF, 0x690F, - 0x97C0, 0x6911, 0x97C1, 0x6913, 0x97C2, 0x6914, 0x97C3, 0x6915, - 0x97C4, 0x6916, 0x97C5, 0x6917, 0x97C6, 0x6918, 0x97C7, 0x6919, - 0x97C8, 0x691A, 0x97C9, 0x691B, 0x97CA, 0x691C, 0x97CB, 0x691D, - 0x97CC, 0x691E, 0x97CD, 0x6921, 0x97CE, 0x6922, 0x97CF, 0x6923, - 0x97D0, 0x6925, 0x97D1, 0x6926, 0x97D2, 0x6927, 0x97D3, 0x6928, - 0x97D4, 0x6929, 0x97D5, 0x692A, 0x97D6, 0x692B, 0x97D7, 0x692C, - 0x97D8, 0x692E, 0x97D9, 0x692F, 0x97DA, 0x6931, 0x97DB, 0x6932, - 0x97DC, 0x6933, 0x97DD, 0x6935, 0x97DE, 0x6936, 0x97DF, 0x6937, - 0x97E0, 0x6938, 0x97E1, 0x693A, 0x97E2, 0x693B, 0x97E3, 0x693C, - 0x97E4, 0x693E, 0x97E5, 0x6940, 0x97E6, 0x6941, 0x97E7, 0x6943, - 0x97E8, 0x6944, 0x97E9, 0x6945, 0x97EA, 0x6946, 0x97EB, 0x6947, - 0x97EC, 0x6948, 0x97ED, 0x6949, 0x97EE, 0x694A, 0x97EF, 0x694B, - 0x97F0, 0x694C, 0x97F1, 0x694D, 0x97F2, 0x694E, 0x97F3, 0x694F, - 0x97F4, 0x6950, 0x97F5, 0x6951, 0x97F6, 0x6952, 0x97F7, 0x6953, - 0x97F8, 0x6955, 0x97F9, 0x6956, 0x97FA, 0x6958, 0x97FB, 0x6959, - 0x97FC, 0x695B, 0x97FD, 0x695C, 0x97FE, 0x695F, 0x9840, 0x6961, - 0x9841, 0x6962, 0x9842, 0x6964, 0x9843, 0x6965, 0x9844, 0x6967, - 0x9845, 0x6968, 0x9846, 0x6969, 0x9847, 0x696A, 0x9848, 0x696C, - 0x9849, 0x696D, 0x984A, 0x696F, 0x984B, 0x6970, 0x984C, 0x6972, - 0x984D, 0x6973, 0x984E, 0x6974, 0x984F, 0x6975, 0x9850, 0x6976, - 0x9851, 0x697A, 0x9852, 0x697B, 0x9853, 0x697D, 0x9854, 0x697E, - 0x9855, 0x697F, 0x9856, 0x6981, 0x9857, 0x6983, 0x9858, 0x6985, - 0x9859, 0x698A, 0x985A, 0x698B, 0x985B, 0x698C, 0x985C, 0x698E, - 0x985D, 0x698F, 0x985E, 0x6990, 0x985F, 0x6991, 0x9860, 0x6992, - 0x9861, 0x6993, 0x9862, 0x6996, 0x9863, 0x6997, 0x9864, 0x6999, - 0x9865, 0x699A, 0x9866, 0x699D, 0x9867, 0x699E, 0x9868, 0x699F, - 0x9869, 0x69A0, 0x986A, 0x69A1, 0x986B, 0x69A2, 0x986C, 0x69A3, - 0x986D, 0x69A4, 0x986E, 0x69A5, 0x986F, 0x69A6, 0x9870, 0x69A9, - 0x9871, 0x69AA, 0x9872, 0x69AC, 0x9873, 0x69AE, 0x9874, 0x69AF, - 0x9875, 0x69B0, 0x9876, 0x69B2, 0x9877, 0x69B3, 0x9878, 0x69B5, - 0x9879, 0x69B6, 0x987A, 0x69B8, 0x987B, 0x69B9, 0x987C, 0x69BA, - 0x987D, 0x69BC, 0x987E, 0x69BD, 0x9880, 0x69BE, 0x9881, 0x69BF, - 0x9882, 0x69C0, 0x9883, 0x69C2, 0x9884, 0x69C3, 0x9885, 0x69C4, - 0x9886, 0x69C5, 0x9887, 0x69C6, 0x9888, 0x69C7, 0x9889, 0x69C8, - 0x988A, 0x69C9, 0x988B, 0x69CB, 0x988C, 0x69CD, 0x988D, 0x69CF, - 0x988E, 0x69D1, 0x988F, 0x69D2, 0x9890, 0x69D3, 0x9891, 0x69D5, - 0x9892, 0x69D6, 0x9893, 0x69D7, 0x9894, 0x69D8, 0x9895, 0x69D9, - 0x9896, 0x69DA, 0x9897, 0x69DC, 0x9898, 0x69DD, 0x9899, 0x69DE, - 0x989A, 0x69E1, 0x989B, 0x69E2, 0x989C, 0x69E3, 0x989D, 0x69E4, - 0x989E, 0x69E5, 0x989F, 0x69E6, 0x98A0, 0x69E7, 0x98A1, 0x69E8, - 0x98A2, 0x69E9, 0x98A3, 0x69EA, 0x98A4, 0x69EB, 0x98A5, 0x69EC, - 0x98A6, 0x69EE, 0x98A7, 0x69EF, 0x98A8, 0x69F0, 0x98A9, 0x69F1, - 0x98AA, 0x69F3, 0x98AB, 0x69F4, 0x98AC, 0x69F5, 0x98AD, 0x69F6, - 0x98AE, 0x69F7, 0x98AF, 0x69F8, 0x98B0, 0x69F9, 0x98B1, 0x69FA, - 0x98B2, 0x69FB, 0x98B3, 0x69FC, 0x98B4, 0x69FE, 0x98B5, 0x6A00, - 0x98B6, 0x6A01, 0x98B7, 0x6A02, 0x98B8, 0x6A03, 0x98B9, 0x6A04, - 0x98BA, 0x6A05, 0x98BB, 0x6A06, 0x98BC, 0x6A07, 0x98BD, 0x6A08, - 0x98BE, 0x6A09, 0x98BF, 0x6A0B, 0x98C0, 0x6A0C, 0x98C1, 0x6A0D, - 0x98C2, 0x6A0E, 0x98C3, 0x6A0F, 0x98C4, 0x6A10, 0x98C5, 0x6A11, - 0x98C6, 0x6A12, 0x98C7, 0x6A13, 0x98C8, 0x6A14, 0x98C9, 0x6A15, - 0x98CA, 0x6A16, 0x98CB, 0x6A19, 0x98CC, 0x6A1A, 0x98CD, 0x6A1B, - 0x98CE, 0x6A1C, 0x98CF, 0x6A1D, 0x98D0, 0x6A1E, 0x98D1, 0x6A20, - 0x98D2, 0x6A22, 0x98D3, 0x6A23, 0x98D4, 0x6A24, 0x98D5, 0x6A25, - 0x98D6, 0x6A26, 0x98D7, 0x6A27, 0x98D8, 0x6A29, 0x98D9, 0x6A2B, - 0x98DA, 0x6A2C, 0x98DB, 0x6A2D, 0x98DC, 0x6A2E, 0x98DD, 0x6A30, - 0x98DE, 0x6A32, 0x98DF, 0x6A33, 0x98E0, 0x6A34, 0x98E1, 0x6A36, - 0x98E2, 0x6A37, 0x98E3, 0x6A38, 0x98E4, 0x6A39, 0x98E5, 0x6A3A, - 0x98E6, 0x6A3B, 0x98E7, 0x6A3C, 0x98E8, 0x6A3F, 0x98E9, 0x6A40, - 0x98EA, 0x6A41, 0x98EB, 0x6A42, 0x98EC, 0x6A43, 0x98ED, 0x6A45, - 0x98EE, 0x6A46, 0x98EF, 0x6A48, 0x98F0, 0x6A49, 0x98F1, 0x6A4A, - 0x98F2, 0x6A4B, 0x98F3, 0x6A4C, 0x98F4, 0x6A4D, 0x98F5, 0x6A4E, - 0x98F6, 0x6A4F, 0x98F7, 0x6A51, 0x98F8, 0x6A52, 0x98F9, 0x6A53, - 0x98FA, 0x6A54, 0x98FB, 0x6A55, 0x98FC, 0x6A56, 0x98FD, 0x6A57, - 0x98FE, 0x6A5A, 0x9940, 0x6A5C, 0x9941, 0x6A5D, 0x9942, 0x6A5E, - 0x9943, 0x6A5F, 0x9944, 0x6A60, 0x9945, 0x6A62, 0x9946, 0x6A63, - 0x9947, 0x6A64, 0x9948, 0x6A66, 0x9949, 0x6A67, 0x994A, 0x6A68, - 0x994B, 0x6A69, 0x994C, 0x6A6A, 0x994D, 0x6A6B, 0x994E, 0x6A6C, - 0x994F, 0x6A6D, 0x9950, 0x6A6E, 0x9951, 0x6A6F, 0x9952, 0x6A70, - 0x9953, 0x6A72, 0x9954, 0x6A73, 0x9955, 0x6A74, 0x9956, 0x6A75, - 0x9957, 0x6A76, 0x9958, 0x6A77, 0x9959, 0x6A78, 0x995A, 0x6A7A, - 0x995B, 0x6A7B, 0x995C, 0x6A7D, 0x995D, 0x6A7E, 0x995E, 0x6A7F, - 0x995F, 0x6A81, 0x9960, 0x6A82, 0x9961, 0x6A83, 0x9962, 0x6A85, - 0x9963, 0x6A86, 0x9964, 0x6A87, 0x9965, 0x6A88, 0x9966, 0x6A89, - 0x9967, 0x6A8A, 0x9968, 0x6A8B, 0x9969, 0x6A8C, 0x996A, 0x6A8D, - 0x996B, 0x6A8F, 0x996C, 0x6A92, 0x996D, 0x6A93, 0x996E, 0x6A94, - 0x996F, 0x6A95, 0x9970, 0x6A96, 0x9971, 0x6A98, 0x9972, 0x6A99, - 0x9973, 0x6A9A, 0x9974, 0x6A9B, 0x9975, 0x6A9C, 0x9976, 0x6A9D, - 0x9977, 0x6A9E, 0x9978, 0x6A9F, 0x9979, 0x6AA1, 0x997A, 0x6AA2, - 0x997B, 0x6AA3, 0x997C, 0x6AA4, 0x997D, 0x6AA5, 0x997E, 0x6AA6, - 0x9980, 0x6AA7, 0x9981, 0x6AA8, 0x9982, 0x6AAA, 0x9983, 0x6AAD, - 0x9984, 0x6AAE, 0x9985, 0x6AAF, 0x9986, 0x6AB0, 0x9987, 0x6AB1, - 0x9988, 0x6AB2, 0x9989, 0x6AB3, 0x998A, 0x6AB4, 0x998B, 0x6AB5, - 0x998C, 0x6AB6, 0x998D, 0x6AB7, 0x998E, 0x6AB8, 0x998F, 0x6AB9, - 0x9990, 0x6ABA, 0x9991, 0x6ABB, 0x9992, 0x6ABC, 0x9993, 0x6ABD, - 0x9994, 0x6ABE, 0x9995, 0x6ABF, 0x9996, 0x6AC0, 0x9997, 0x6AC1, - 0x9998, 0x6AC2, 0x9999, 0x6AC3, 0x999A, 0x6AC4, 0x999B, 0x6AC5, - 0x999C, 0x6AC6, 0x999D, 0x6AC7, 0x999E, 0x6AC8, 0x999F, 0x6AC9, - 0x99A0, 0x6ACA, 0x99A1, 0x6ACB, 0x99A2, 0x6ACC, 0x99A3, 0x6ACD, - 0x99A4, 0x6ACE, 0x99A5, 0x6ACF, 0x99A6, 0x6AD0, 0x99A7, 0x6AD1, - 0x99A8, 0x6AD2, 0x99A9, 0x6AD3, 0x99AA, 0x6AD4, 0x99AB, 0x6AD5, - 0x99AC, 0x6AD6, 0x99AD, 0x6AD7, 0x99AE, 0x6AD8, 0x99AF, 0x6AD9, - 0x99B0, 0x6ADA, 0x99B1, 0x6ADB, 0x99B2, 0x6ADC, 0x99B3, 0x6ADD, - 0x99B4, 0x6ADE, 0x99B5, 0x6ADF, 0x99B6, 0x6AE0, 0x99B7, 0x6AE1, - 0x99B8, 0x6AE2, 0x99B9, 0x6AE3, 0x99BA, 0x6AE4, 0x99BB, 0x6AE5, - 0x99BC, 0x6AE6, 0x99BD, 0x6AE7, 0x99BE, 0x6AE8, 0x99BF, 0x6AE9, - 0x99C0, 0x6AEA, 0x99C1, 0x6AEB, 0x99C2, 0x6AEC, 0x99C3, 0x6AED, - 0x99C4, 0x6AEE, 0x99C5, 0x6AEF, 0x99C6, 0x6AF0, 0x99C7, 0x6AF1, - 0x99C8, 0x6AF2, 0x99C9, 0x6AF3, 0x99CA, 0x6AF4, 0x99CB, 0x6AF5, - 0x99CC, 0x6AF6, 0x99CD, 0x6AF7, 0x99CE, 0x6AF8, 0x99CF, 0x6AF9, - 0x99D0, 0x6AFA, 0x99D1, 0x6AFB, 0x99D2, 0x6AFC, 0x99D3, 0x6AFD, - 0x99D4, 0x6AFE, 0x99D5, 0x6AFF, 0x99D6, 0x6B00, 0x99D7, 0x6B01, - 0x99D8, 0x6B02, 0x99D9, 0x6B03, 0x99DA, 0x6B04, 0x99DB, 0x6B05, - 0x99DC, 0x6B06, 0x99DD, 0x6B07, 0x99DE, 0x6B08, 0x99DF, 0x6B09, - 0x99E0, 0x6B0A, 0x99E1, 0x6B0B, 0x99E2, 0x6B0C, 0x99E3, 0x6B0D, - 0x99E4, 0x6B0E, 0x99E5, 0x6B0F, 0x99E6, 0x6B10, 0x99E7, 0x6B11, - 0x99E8, 0x6B12, 0x99E9, 0x6B13, 0x99EA, 0x6B14, 0x99EB, 0x6B15, - 0x99EC, 0x6B16, 0x99ED, 0x6B17, 0x99EE, 0x6B18, 0x99EF, 0x6B19, - 0x99F0, 0x6B1A, 0x99F1, 0x6B1B, 0x99F2, 0x6B1C, 0x99F3, 0x6B1D, - 0x99F4, 0x6B1E, 0x99F5, 0x6B1F, 0x99F6, 0x6B25, 0x99F7, 0x6B26, - 0x99F8, 0x6B28, 0x99F9, 0x6B29, 0x99FA, 0x6B2A, 0x99FB, 0x6B2B, - 0x99FC, 0x6B2C, 0x99FD, 0x6B2D, 0x99FE, 0x6B2E, 0x9A40, 0x6B2F, - 0x9A41, 0x6B30, 0x9A42, 0x6B31, 0x9A43, 0x6B33, 0x9A44, 0x6B34, - 0x9A45, 0x6B35, 0x9A46, 0x6B36, 0x9A47, 0x6B38, 0x9A48, 0x6B3B, - 0x9A49, 0x6B3C, 0x9A4A, 0x6B3D, 0x9A4B, 0x6B3F, 0x9A4C, 0x6B40, - 0x9A4D, 0x6B41, 0x9A4E, 0x6B42, 0x9A4F, 0x6B44, 0x9A50, 0x6B45, - 0x9A51, 0x6B48, 0x9A52, 0x6B4A, 0x9A53, 0x6B4B, 0x9A54, 0x6B4D, - 0x9A55, 0x6B4E, 0x9A56, 0x6B4F, 0x9A57, 0x6B50, 0x9A58, 0x6B51, - 0x9A59, 0x6B52, 0x9A5A, 0x6B53, 0x9A5B, 0x6B54, 0x9A5C, 0x6B55, - 0x9A5D, 0x6B56, 0x9A5E, 0x6B57, 0x9A5F, 0x6B58, 0x9A60, 0x6B5A, - 0x9A61, 0x6B5B, 0x9A62, 0x6B5C, 0x9A63, 0x6B5D, 0x9A64, 0x6B5E, - 0x9A65, 0x6B5F, 0x9A66, 0x6B60, 0x9A67, 0x6B61, 0x9A68, 0x6B68, - 0x9A69, 0x6B69, 0x9A6A, 0x6B6B, 0x9A6B, 0x6B6C, 0x9A6C, 0x6B6D, - 0x9A6D, 0x6B6E, 0x9A6E, 0x6B6F, 0x9A6F, 0x6B70, 0x9A70, 0x6B71, - 0x9A71, 0x6B72, 0x9A72, 0x6B73, 0x9A73, 0x6B74, 0x9A74, 0x6B75, - 0x9A75, 0x6B76, 0x9A76, 0x6B77, 0x9A77, 0x6B78, 0x9A78, 0x6B7A, - 0x9A79, 0x6B7D, 0x9A7A, 0x6B7E, 0x9A7B, 0x6B7F, 0x9A7C, 0x6B80, - 0x9A7D, 0x6B85, 0x9A7E, 0x6B88, 0x9A80, 0x6B8C, 0x9A81, 0x6B8E, - 0x9A82, 0x6B8F, 0x9A83, 0x6B90, 0x9A84, 0x6B91, 0x9A85, 0x6B94, - 0x9A86, 0x6B95, 0x9A87, 0x6B97, 0x9A88, 0x6B98, 0x9A89, 0x6B99, - 0x9A8A, 0x6B9C, 0x9A8B, 0x6B9D, 0x9A8C, 0x6B9E, 0x9A8D, 0x6B9F, - 0x9A8E, 0x6BA0, 0x9A8F, 0x6BA2, 0x9A90, 0x6BA3, 0x9A91, 0x6BA4, - 0x9A92, 0x6BA5, 0x9A93, 0x6BA6, 0x9A94, 0x6BA7, 0x9A95, 0x6BA8, - 0x9A96, 0x6BA9, 0x9A97, 0x6BAB, 0x9A98, 0x6BAC, 0x9A99, 0x6BAD, - 0x9A9A, 0x6BAE, 0x9A9B, 0x6BAF, 0x9A9C, 0x6BB0, 0x9A9D, 0x6BB1, - 0x9A9E, 0x6BB2, 0x9A9F, 0x6BB6, 0x9AA0, 0x6BB8, 0x9AA1, 0x6BB9, - 0x9AA2, 0x6BBA, 0x9AA3, 0x6BBB, 0x9AA4, 0x6BBC, 0x9AA5, 0x6BBD, - 0x9AA6, 0x6BBE, 0x9AA7, 0x6BC0, 0x9AA8, 0x6BC3, 0x9AA9, 0x6BC4, - 0x9AAA, 0x6BC6, 0x9AAB, 0x6BC7, 0x9AAC, 0x6BC8, 0x9AAD, 0x6BC9, - 0x9AAE, 0x6BCA, 0x9AAF, 0x6BCC, 0x9AB0, 0x6BCE, 0x9AB1, 0x6BD0, - 0x9AB2, 0x6BD1, 0x9AB3, 0x6BD8, 0x9AB4, 0x6BDA, 0x9AB5, 0x6BDC, - 0x9AB6, 0x6BDD, 0x9AB7, 0x6BDE, 0x9AB8, 0x6BDF, 0x9AB9, 0x6BE0, - 0x9ABA, 0x6BE2, 0x9ABB, 0x6BE3, 0x9ABC, 0x6BE4, 0x9ABD, 0x6BE5, - 0x9ABE, 0x6BE6, 0x9ABF, 0x6BE7, 0x9AC0, 0x6BE8, 0x9AC1, 0x6BE9, - 0x9AC2, 0x6BEC, 0x9AC3, 0x6BED, 0x9AC4, 0x6BEE, 0x9AC5, 0x6BF0, - 0x9AC6, 0x6BF1, 0x9AC7, 0x6BF2, 0x9AC8, 0x6BF4, 0x9AC9, 0x6BF6, - 0x9ACA, 0x6BF7, 0x9ACB, 0x6BF8, 0x9ACC, 0x6BFA, 0x9ACD, 0x6BFB, - 0x9ACE, 0x6BFC, 0x9ACF, 0x6BFE, 0x9AD0, 0x6BFF, 0x9AD1, 0x6C00, - 0x9AD2, 0x6C01, 0x9AD3, 0x6C02, 0x9AD4, 0x6C03, 0x9AD5, 0x6C04, - 0x9AD6, 0x6C08, 0x9AD7, 0x6C09, 0x9AD8, 0x6C0A, 0x9AD9, 0x6C0B, - 0x9ADA, 0x6C0C, 0x9ADB, 0x6C0E, 0x9ADC, 0x6C12, 0x9ADD, 0x6C17, - 0x9ADE, 0x6C1C, 0x9ADF, 0x6C1D, 0x9AE0, 0x6C1E, 0x9AE1, 0x6C20, - 0x9AE2, 0x6C23, 0x9AE3, 0x6C25, 0x9AE4, 0x6C2B, 0x9AE5, 0x6C2C, - 0x9AE6, 0x6C2D, 0x9AE7, 0x6C31, 0x9AE8, 0x6C33, 0x9AE9, 0x6C36, - 0x9AEA, 0x6C37, 0x9AEB, 0x6C39, 0x9AEC, 0x6C3A, 0x9AED, 0x6C3B, - 0x9AEE, 0x6C3C, 0x9AEF, 0x6C3E, 0x9AF0, 0x6C3F, 0x9AF1, 0x6C43, - 0x9AF2, 0x6C44, 0x9AF3, 0x6C45, 0x9AF4, 0x6C48, 0x9AF5, 0x6C4B, - 0x9AF6, 0x6C4C, 0x9AF7, 0x6C4D, 0x9AF8, 0x6C4E, 0x9AF9, 0x6C4F, - 0x9AFA, 0x6C51, 0x9AFB, 0x6C52, 0x9AFC, 0x6C53, 0x9AFD, 0x6C56, - 0x9AFE, 0x6C58, 0x9B40, 0x6C59, 0x9B41, 0x6C5A, 0x9B42, 0x6C62, - 0x9B43, 0x6C63, 0x9B44, 0x6C65, 0x9B45, 0x6C66, 0x9B46, 0x6C67, - 0x9B47, 0x6C6B, 0x9B48, 0x6C6C, 0x9B49, 0x6C6D, 0x9B4A, 0x6C6E, - 0x9B4B, 0x6C6F, 0x9B4C, 0x6C71, 0x9B4D, 0x6C73, 0x9B4E, 0x6C75, - 0x9B4F, 0x6C77, 0x9B50, 0x6C78, 0x9B51, 0x6C7A, 0x9B52, 0x6C7B, - 0x9B53, 0x6C7C, 0x9B54, 0x6C7F, 0x9B55, 0x6C80, 0x9B56, 0x6C84, - 0x9B57, 0x6C87, 0x9B58, 0x6C8A, 0x9B59, 0x6C8B, 0x9B5A, 0x6C8D, - 0x9B5B, 0x6C8E, 0x9B5C, 0x6C91, 0x9B5D, 0x6C92, 0x9B5E, 0x6C95, - 0x9B5F, 0x6C96, 0x9B60, 0x6C97, 0x9B61, 0x6C98, 0x9B62, 0x6C9A, - 0x9B63, 0x6C9C, 0x9B64, 0x6C9D, 0x9B65, 0x6C9E, 0x9B66, 0x6CA0, - 0x9B67, 0x6CA2, 0x9B68, 0x6CA8, 0x9B69, 0x6CAC, 0x9B6A, 0x6CAF, - 0x9B6B, 0x6CB0, 0x9B6C, 0x6CB4, 0x9B6D, 0x6CB5, 0x9B6E, 0x6CB6, - 0x9B6F, 0x6CB7, 0x9B70, 0x6CBA, 0x9B71, 0x6CC0, 0x9B72, 0x6CC1, - 0x9B73, 0x6CC2, 0x9B74, 0x6CC3, 0x9B75, 0x6CC6, 0x9B76, 0x6CC7, - 0x9B77, 0x6CC8, 0x9B78, 0x6CCB, 0x9B79, 0x6CCD, 0x9B7A, 0x6CCE, - 0x9B7B, 0x6CCF, 0x9B7C, 0x6CD1, 0x9B7D, 0x6CD2, 0x9B7E, 0x6CD8, - 0x9B80, 0x6CD9, 0x9B81, 0x6CDA, 0x9B82, 0x6CDC, 0x9B83, 0x6CDD, - 0x9B84, 0x6CDF, 0x9B85, 0x6CE4, 0x9B86, 0x6CE6, 0x9B87, 0x6CE7, - 0x9B88, 0x6CE9, 0x9B89, 0x6CEC, 0x9B8A, 0x6CED, 0x9B8B, 0x6CF2, - 0x9B8C, 0x6CF4, 0x9B8D, 0x6CF9, 0x9B8E, 0x6CFF, 0x9B8F, 0x6D00, - 0x9B90, 0x6D02, 0x9B91, 0x6D03, 0x9B92, 0x6D05, 0x9B93, 0x6D06, - 0x9B94, 0x6D08, 0x9B95, 0x6D09, 0x9B96, 0x6D0A, 0x9B97, 0x6D0D, - 0x9B98, 0x6D0F, 0x9B99, 0x6D10, 0x9B9A, 0x6D11, 0x9B9B, 0x6D13, - 0x9B9C, 0x6D14, 0x9B9D, 0x6D15, 0x9B9E, 0x6D16, 0x9B9F, 0x6D18, - 0x9BA0, 0x6D1C, 0x9BA1, 0x6D1D, 0x9BA2, 0x6D1F, 0x9BA3, 0x6D20, - 0x9BA4, 0x6D21, 0x9BA5, 0x6D22, 0x9BA6, 0x6D23, 0x9BA7, 0x6D24, - 0x9BA8, 0x6D26, 0x9BA9, 0x6D28, 0x9BAA, 0x6D29, 0x9BAB, 0x6D2C, - 0x9BAC, 0x6D2D, 0x9BAD, 0x6D2F, 0x9BAE, 0x6D30, 0x9BAF, 0x6D34, - 0x9BB0, 0x6D36, 0x9BB1, 0x6D37, 0x9BB2, 0x6D38, 0x9BB3, 0x6D3A, - 0x9BB4, 0x6D3F, 0x9BB5, 0x6D40, 0x9BB6, 0x6D42, 0x9BB7, 0x6D44, - 0x9BB8, 0x6D49, 0x9BB9, 0x6D4C, 0x9BBA, 0x6D50, 0x9BBB, 0x6D55, - 0x9BBC, 0x6D56, 0x9BBD, 0x6D57, 0x9BBE, 0x6D58, 0x9BBF, 0x6D5B, - 0x9BC0, 0x6D5D, 0x9BC1, 0x6D5F, 0x9BC2, 0x6D61, 0x9BC3, 0x6D62, - 0x9BC4, 0x6D64, 0x9BC5, 0x6D65, 0x9BC6, 0x6D67, 0x9BC7, 0x6D68, - 0x9BC8, 0x6D6B, 0x9BC9, 0x6D6C, 0x9BCA, 0x6D6D, 0x9BCB, 0x6D70, - 0x9BCC, 0x6D71, 0x9BCD, 0x6D72, 0x9BCE, 0x6D73, 0x9BCF, 0x6D75, - 0x9BD0, 0x6D76, 0x9BD1, 0x6D79, 0x9BD2, 0x6D7A, 0x9BD3, 0x6D7B, - 0x9BD4, 0x6D7D, 0x9BD5, 0x6D7E, 0x9BD6, 0x6D7F, 0x9BD7, 0x6D80, - 0x9BD8, 0x6D81, 0x9BD9, 0x6D83, 0x9BDA, 0x6D84, 0x9BDB, 0x6D86, - 0x9BDC, 0x6D87, 0x9BDD, 0x6D8A, 0x9BDE, 0x6D8B, 0x9BDF, 0x6D8D, - 0x9BE0, 0x6D8F, 0x9BE1, 0x6D90, 0x9BE2, 0x6D92, 0x9BE3, 0x6D96, - 0x9BE4, 0x6D97, 0x9BE5, 0x6D98, 0x9BE6, 0x6D99, 0x9BE7, 0x6D9A, - 0x9BE8, 0x6D9C, 0x9BE9, 0x6DA2, 0x9BEA, 0x6DA5, 0x9BEB, 0x6DAC, - 0x9BEC, 0x6DAD, 0x9BED, 0x6DB0, 0x9BEE, 0x6DB1, 0x9BEF, 0x6DB3, - 0x9BF0, 0x6DB4, 0x9BF1, 0x6DB6, 0x9BF2, 0x6DB7, 0x9BF3, 0x6DB9, - 0x9BF4, 0x6DBA, 0x9BF5, 0x6DBB, 0x9BF6, 0x6DBC, 0x9BF7, 0x6DBD, - 0x9BF8, 0x6DBE, 0x9BF9, 0x6DC1, 0x9BFA, 0x6DC2, 0x9BFB, 0x6DC3, - 0x9BFC, 0x6DC8, 0x9BFD, 0x6DC9, 0x9BFE, 0x6DCA, 0x9C40, 0x6DCD, - 0x9C41, 0x6DCE, 0x9C42, 0x6DCF, 0x9C43, 0x6DD0, 0x9C44, 0x6DD2, - 0x9C45, 0x6DD3, 0x9C46, 0x6DD4, 0x9C47, 0x6DD5, 0x9C48, 0x6DD7, - 0x9C49, 0x6DDA, 0x9C4A, 0x6DDB, 0x9C4B, 0x6DDC, 0x9C4C, 0x6DDF, - 0x9C4D, 0x6DE2, 0x9C4E, 0x6DE3, 0x9C4F, 0x6DE5, 0x9C50, 0x6DE7, - 0x9C51, 0x6DE8, 0x9C52, 0x6DE9, 0x9C53, 0x6DEA, 0x9C54, 0x6DED, - 0x9C55, 0x6DEF, 0x9C56, 0x6DF0, 0x9C57, 0x6DF2, 0x9C58, 0x6DF4, - 0x9C59, 0x6DF5, 0x9C5A, 0x6DF6, 0x9C5B, 0x6DF8, 0x9C5C, 0x6DFA, - 0x9C5D, 0x6DFD, 0x9C5E, 0x6DFE, 0x9C5F, 0x6DFF, 0x9C60, 0x6E00, - 0x9C61, 0x6E01, 0x9C62, 0x6E02, 0x9C63, 0x6E03, 0x9C64, 0x6E04, - 0x9C65, 0x6E06, 0x9C66, 0x6E07, 0x9C67, 0x6E08, 0x9C68, 0x6E09, - 0x9C69, 0x6E0B, 0x9C6A, 0x6E0F, 0x9C6B, 0x6E12, 0x9C6C, 0x6E13, - 0x9C6D, 0x6E15, 0x9C6E, 0x6E18, 0x9C6F, 0x6E19, 0x9C70, 0x6E1B, - 0x9C71, 0x6E1C, 0x9C72, 0x6E1E, 0x9C73, 0x6E1F, 0x9C74, 0x6E22, - 0x9C75, 0x6E26, 0x9C76, 0x6E27, 0x9C77, 0x6E28, 0x9C78, 0x6E2A, - 0x9C79, 0x6E2C, 0x9C7A, 0x6E2E, 0x9C7B, 0x6E30, 0x9C7C, 0x6E31, - 0x9C7D, 0x6E33, 0x9C7E, 0x6E35, 0x9C80, 0x6E36, 0x9C81, 0x6E37, - 0x9C82, 0x6E39, 0x9C83, 0x6E3B, 0x9C84, 0x6E3C, 0x9C85, 0x6E3D, - 0x9C86, 0x6E3E, 0x9C87, 0x6E3F, 0x9C88, 0x6E40, 0x9C89, 0x6E41, - 0x9C8A, 0x6E42, 0x9C8B, 0x6E45, 0x9C8C, 0x6E46, 0x9C8D, 0x6E47, - 0x9C8E, 0x6E48, 0x9C8F, 0x6E49, 0x9C90, 0x6E4A, 0x9C91, 0x6E4B, - 0x9C92, 0x6E4C, 0x9C93, 0x6E4F, 0x9C94, 0x6E50, 0x9C95, 0x6E51, - 0x9C96, 0x6E52, 0x9C97, 0x6E55, 0x9C98, 0x6E57, 0x9C99, 0x6E59, - 0x9C9A, 0x6E5A, 0x9C9B, 0x6E5C, 0x9C9C, 0x6E5D, 0x9C9D, 0x6E5E, - 0x9C9E, 0x6E60, 0x9C9F, 0x6E61, 0x9CA0, 0x6E62, 0x9CA1, 0x6E63, - 0x9CA2, 0x6E64, 0x9CA3, 0x6E65, 0x9CA4, 0x6E66, 0x9CA5, 0x6E67, - 0x9CA6, 0x6E68, 0x9CA7, 0x6E69, 0x9CA8, 0x6E6A, 0x9CA9, 0x6E6C, - 0x9CAA, 0x6E6D, 0x9CAB, 0x6E6F, 0x9CAC, 0x6E70, 0x9CAD, 0x6E71, - 0x9CAE, 0x6E72, 0x9CAF, 0x6E73, 0x9CB0, 0x6E74, 0x9CB1, 0x6E75, - 0x9CB2, 0x6E76, 0x9CB3, 0x6E77, 0x9CB4, 0x6E78, 0x9CB5, 0x6E79, - 0x9CB6, 0x6E7A, 0x9CB7, 0x6E7B, 0x9CB8, 0x6E7C, 0x9CB9, 0x6E7D, - 0x9CBA, 0x6E80, 0x9CBB, 0x6E81, 0x9CBC, 0x6E82, 0x9CBD, 0x6E84, - 0x9CBE, 0x6E87, 0x9CBF, 0x6E88, 0x9CC0, 0x6E8A, 0x9CC1, 0x6E8B, - 0x9CC2, 0x6E8C, 0x9CC3, 0x6E8D, 0x9CC4, 0x6E8E, 0x9CC5, 0x6E91, - 0x9CC6, 0x6E92, 0x9CC7, 0x6E93, 0x9CC8, 0x6E94, 0x9CC9, 0x6E95, - 0x9CCA, 0x6E96, 0x9CCB, 0x6E97, 0x9CCC, 0x6E99, 0x9CCD, 0x6E9A, - 0x9CCE, 0x6E9B, 0x9CCF, 0x6E9D, 0x9CD0, 0x6E9E, 0x9CD1, 0x6EA0, - 0x9CD2, 0x6EA1, 0x9CD3, 0x6EA3, 0x9CD4, 0x6EA4, 0x9CD5, 0x6EA6, - 0x9CD6, 0x6EA8, 0x9CD7, 0x6EA9, 0x9CD8, 0x6EAB, 0x9CD9, 0x6EAC, - 0x9CDA, 0x6EAD, 0x9CDB, 0x6EAE, 0x9CDC, 0x6EB0, 0x9CDD, 0x6EB3, - 0x9CDE, 0x6EB5, 0x9CDF, 0x6EB8, 0x9CE0, 0x6EB9, 0x9CE1, 0x6EBC, - 0x9CE2, 0x6EBE, 0x9CE3, 0x6EBF, 0x9CE4, 0x6EC0, 0x9CE5, 0x6EC3, - 0x9CE6, 0x6EC4, 0x9CE7, 0x6EC5, 0x9CE8, 0x6EC6, 0x9CE9, 0x6EC8, - 0x9CEA, 0x6EC9, 0x9CEB, 0x6ECA, 0x9CEC, 0x6ECC, 0x9CED, 0x6ECD, - 0x9CEE, 0x6ECE, 0x9CEF, 0x6ED0, 0x9CF0, 0x6ED2, 0x9CF1, 0x6ED6, - 0x9CF2, 0x6ED8, 0x9CF3, 0x6ED9, 0x9CF4, 0x6EDB, 0x9CF5, 0x6EDC, - 0x9CF6, 0x6EDD, 0x9CF7, 0x6EE3, 0x9CF8, 0x6EE7, 0x9CF9, 0x6EEA, - 0x9CFA, 0x6EEB, 0x9CFB, 0x6EEC, 0x9CFC, 0x6EED, 0x9CFD, 0x6EEE, - 0x9CFE, 0x6EEF, 0x9D40, 0x6EF0, 0x9D41, 0x6EF1, 0x9D42, 0x6EF2, - 0x9D43, 0x6EF3, 0x9D44, 0x6EF5, 0x9D45, 0x6EF6, 0x9D46, 0x6EF7, - 0x9D47, 0x6EF8, 0x9D48, 0x6EFA, 0x9D49, 0x6EFB, 0x9D4A, 0x6EFC, - 0x9D4B, 0x6EFD, 0x9D4C, 0x6EFE, 0x9D4D, 0x6EFF, 0x9D4E, 0x6F00, - 0x9D4F, 0x6F01, 0x9D50, 0x6F03, 0x9D51, 0x6F04, 0x9D52, 0x6F05, - 0x9D53, 0x6F07, 0x9D54, 0x6F08, 0x9D55, 0x6F0A, 0x9D56, 0x6F0B, - 0x9D57, 0x6F0C, 0x9D58, 0x6F0D, 0x9D59, 0x6F0E, 0x9D5A, 0x6F10, - 0x9D5B, 0x6F11, 0x9D5C, 0x6F12, 0x9D5D, 0x6F16, 0x9D5E, 0x6F17, - 0x9D5F, 0x6F18, 0x9D60, 0x6F19, 0x9D61, 0x6F1A, 0x9D62, 0x6F1B, - 0x9D63, 0x6F1C, 0x9D64, 0x6F1D, 0x9D65, 0x6F1E, 0x9D66, 0x6F1F, - 0x9D67, 0x6F21, 0x9D68, 0x6F22, 0x9D69, 0x6F23, 0x9D6A, 0x6F25, - 0x9D6B, 0x6F26, 0x9D6C, 0x6F27, 0x9D6D, 0x6F28, 0x9D6E, 0x6F2C, - 0x9D6F, 0x6F2E, 0x9D70, 0x6F30, 0x9D71, 0x6F32, 0x9D72, 0x6F34, - 0x9D73, 0x6F35, 0x9D74, 0x6F37, 0x9D75, 0x6F38, 0x9D76, 0x6F39, - 0x9D77, 0x6F3A, 0x9D78, 0x6F3B, 0x9D79, 0x6F3C, 0x9D7A, 0x6F3D, - 0x9D7B, 0x6F3F, 0x9D7C, 0x6F40, 0x9D7D, 0x6F41, 0x9D7E, 0x6F42, - 0x9D80, 0x6F43, 0x9D81, 0x6F44, 0x9D82, 0x6F45, 0x9D83, 0x6F48, - 0x9D84, 0x6F49, 0x9D85, 0x6F4A, 0x9D86, 0x6F4C, 0x9D87, 0x6F4E, - 0x9D88, 0x6F4F, 0x9D89, 0x6F50, 0x9D8A, 0x6F51, 0x9D8B, 0x6F52, - 0x9D8C, 0x6F53, 0x9D8D, 0x6F54, 0x9D8E, 0x6F55, 0x9D8F, 0x6F56, - 0x9D90, 0x6F57, 0x9D91, 0x6F59, 0x9D92, 0x6F5A, 0x9D93, 0x6F5B, - 0x9D94, 0x6F5D, 0x9D95, 0x6F5F, 0x9D96, 0x6F60, 0x9D97, 0x6F61, - 0x9D98, 0x6F63, 0x9D99, 0x6F64, 0x9D9A, 0x6F65, 0x9D9B, 0x6F67, - 0x9D9C, 0x6F68, 0x9D9D, 0x6F69, 0x9D9E, 0x6F6A, 0x9D9F, 0x6F6B, - 0x9DA0, 0x6F6C, 0x9DA1, 0x6F6F, 0x9DA2, 0x6F70, 0x9DA3, 0x6F71, - 0x9DA4, 0x6F73, 0x9DA5, 0x6F75, 0x9DA6, 0x6F76, 0x9DA7, 0x6F77, - 0x9DA8, 0x6F79, 0x9DA9, 0x6F7B, 0x9DAA, 0x6F7D, 0x9DAB, 0x6F7E, - 0x9DAC, 0x6F7F, 0x9DAD, 0x6F80, 0x9DAE, 0x6F81, 0x9DAF, 0x6F82, - 0x9DB0, 0x6F83, 0x9DB1, 0x6F85, 0x9DB2, 0x6F86, 0x9DB3, 0x6F87, - 0x9DB4, 0x6F8A, 0x9DB5, 0x6F8B, 0x9DB6, 0x6F8F, 0x9DB7, 0x6F90, - 0x9DB8, 0x6F91, 0x9DB9, 0x6F92, 0x9DBA, 0x6F93, 0x9DBB, 0x6F94, - 0x9DBC, 0x6F95, 0x9DBD, 0x6F96, 0x9DBE, 0x6F97, 0x9DBF, 0x6F98, - 0x9DC0, 0x6F99, 0x9DC1, 0x6F9A, 0x9DC2, 0x6F9B, 0x9DC3, 0x6F9D, - 0x9DC4, 0x6F9E, 0x9DC5, 0x6F9F, 0x9DC6, 0x6FA0, 0x9DC7, 0x6FA2, - 0x9DC8, 0x6FA3, 0x9DC9, 0x6FA4, 0x9DCA, 0x6FA5, 0x9DCB, 0x6FA6, - 0x9DCC, 0x6FA8, 0x9DCD, 0x6FA9, 0x9DCE, 0x6FAA, 0x9DCF, 0x6FAB, - 0x9DD0, 0x6FAC, 0x9DD1, 0x6FAD, 0x9DD2, 0x6FAE, 0x9DD3, 0x6FAF, - 0x9DD4, 0x6FB0, 0x9DD5, 0x6FB1, 0x9DD6, 0x6FB2, 0x9DD7, 0x6FB4, - 0x9DD8, 0x6FB5, 0x9DD9, 0x6FB7, 0x9DDA, 0x6FB8, 0x9DDB, 0x6FBA, - 0x9DDC, 0x6FBB, 0x9DDD, 0x6FBC, 0x9DDE, 0x6FBD, 0x9DDF, 0x6FBE, - 0x9DE0, 0x6FBF, 0x9DE1, 0x6FC1, 0x9DE2, 0x6FC3, 0x9DE3, 0x6FC4, - 0x9DE4, 0x6FC5, 0x9DE5, 0x6FC6, 0x9DE6, 0x6FC7, 0x9DE7, 0x6FC8, - 0x9DE8, 0x6FCA, 0x9DE9, 0x6FCB, 0x9DEA, 0x6FCC, 0x9DEB, 0x6FCD, - 0x9DEC, 0x6FCE, 0x9DED, 0x6FCF, 0x9DEE, 0x6FD0, 0x9DEF, 0x6FD3, - 0x9DF0, 0x6FD4, 0x9DF1, 0x6FD5, 0x9DF2, 0x6FD6, 0x9DF3, 0x6FD7, - 0x9DF4, 0x6FD8, 0x9DF5, 0x6FD9, 0x9DF6, 0x6FDA, 0x9DF7, 0x6FDB, - 0x9DF8, 0x6FDC, 0x9DF9, 0x6FDD, 0x9DFA, 0x6FDF, 0x9DFB, 0x6FE2, - 0x9DFC, 0x6FE3, 0x9DFD, 0x6FE4, 0x9DFE, 0x6FE5, 0x9E40, 0x6FE6, - 0x9E41, 0x6FE7, 0x9E42, 0x6FE8, 0x9E43, 0x6FE9, 0x9E44, 0x6FEA, - 0x9E45, 0x6FEB, 0x9E46, 0x6FEC, 0x9E47, 0x6FED, 0x9E48, 0x6FF0, - 0x9E49, 0x6FF1, 0x9E4A, 0x6FF2, 0x9E4B, 0x6FF3, 0x9E4C, 0x6FF4, - 0x9E4D, 0x6FF5, 0x9E4E, 0x6FF6, 0x9E4F, 0x6FF7, 0x9E50, 0x6FF8, - 0x9E51, 0x6FF9, 0x9E52, 0x6FFA, 0x9E53, 0x6FFB, 0x9E54, 0x6FFC, - 0x9E55, 0x6FFD, 0x9E56, 0x6FFE, 0x9E57, 0x6FFF, 0x9E58, 0x7000, - 0x9E59, 0x7001, 0x9E5A, 0x7002, 0x9E5B, 0x7003, 0x9E5C, 0x7004, - 0x9E5D, 0x7005, 0x9E5E, 0x7006, 0x9E5F, 0x7007, 0x9E60, 0x7008, - 0x9E61, 0x7009, 0x9E62, 0x700A, 0x9E63, 0x700B, 0x9E64, 0x700C, - 0x9E65, 0x700D, 0x9E66, 0x700E, 0x9E67, 0x700F, 0x9E68, 0x7010, - 0x9E69, 0x7012, 0x9E6A, 0x7013, 0x9E6B, 0x7014, 0x9E6C, 0x7015, - 0x9E6D, 0x7016, 0x9E6E, 0x7017, 0x9E6F, 0x7018, 0x9E70, 0x7019, - 0x9E71, 0x701C, 0x9E72, 0x701D, 0x9E73, 0x701E, 0x9E74, 0x701F, - 0x9E75, 0x7020, 0x9E76, 0x7021, 0x9E77, 0x7022, 0x9E78, 0x7024, - 0x9E79, 0x7025, 0x9E7A, 0x7026, 0x9E7B, 0x7027, 0x9E7C, 0x7028, - 0x9E7D, 0x7029, 0x9E7E, 0x702A, 0x9E80, 0x702B, 0x9E81, 0x702C, - 0x9E82, 0x702D, 0x9E83, 0x702E, 0x9E84, 0x702F, 0x9E85, 0x7030, - 0x9E86, 0x7031, 0x9E87, 0x7032, 0x9E88, 0x7033, 0x9E89, 0x7034, - 0x9E8A, 0x7036, 0x9E8B, 0x7037, 0x9E8C, 0x7038, 0x9E8D, 0x703A, - 0x9E8E, 0x703B, 0x9E8F, 0x703C, 0x9E90, 0x703D, 0x9E91, 0x703E, - 0x9E92, 0x703F, 0x9E93, 0x7040, 0x9E94, 0x7041, 0x9E95, 0x7042, - 0x9E96, 0x7043, 0x9E97, 0x7044, 0x9E98, 0x7045, 0x9E99, 0x7046, - 0x9E9A, 0x7047, 0x9E9B, 0x7048, 0x9E9C, 0x7049, 0x9E9D, 0x704A, - 0x9E9E, 0x704B, 0x9E9F, 0x704D, 0x9EA0, 0x704E, 0x9EA1, 0x7050, - 0x9EA2, 0x7051, 0x9EA3, 0x7052, 0x9EA4, 0x7053, 0x9EA5, 0x7054, - 0x9EA6, 0x7055, 0x9EA7, 0x7056, 0x9EA8, 0x7057, 0x9EA9, 0x7058, - 0x9EAA, 0x7059, 0x9EAB, 0x705A, 0x9EAC, 0x705B, 0x9EAD, 0x705C, - 0x9EAE, 0x705D, 0x9EAF, 0x705F, 0x9EB0, 0x7060, 0x9EB1, 0x7061, - 0x9EB2, 0x7062, 0x9EB3, 0x7063, 0x9EB4, 0x7064, 0x9EB5, 0x7065, - 0x9EB6, 0x7066, 0x9EB7, 0x7067, 0x9EB8, 0x7068, 0x9EB9, 0x7069, - 0x9EBA, 0x706A, 0x9EBB, 0x706E, 0x9EBC, 0x7071, 0x9EBD, 0x7072, - 0x9EBE, 0x7073, 0x9EBF, 0x7074, 0x9EC0, 0x7077, 0x9EC1, 0x7079, - 0x9EC2, 0x707A, 0x9EC3, 0x707B, 0x9EC4, 0x707D, 0x9EC5, 0x7081, - 0x9EC6, 0x7082, 0x9EC7, 0x7083, 0x9EC8, 0x7084, 0x9EC9, 0x7086, - 0x9ECA, 0x7087, 0x9ECB, 0x7088, 0x9ECC, 0x708B, 0x9ECD, 0x708C, - 0x9ECE, 0x708D, 0x9ECF, 0x708F, 0x9ED0, 0x7090, 0x9ED1, 0x7091, - 0x9ED2, 0x7093, 0x9ED3, 0x7097, 0x9ED4, 0x7098, 0x9ED5, 0x709A, - 0x9ED6, 0x709B, 0x9ED7, 0x709E, 0x9ED8, 0x709F, 0x9ED9, 0x70A0, - 0x9EDA, 0x70A1, 0x9EDB, 0x70A2, 0x9EDC, 0x70A3, 0x9EDD, 0x70A4, - 0x9EDE, 0x70A5, 0x9EDF, 0x70A6, 0x9EE0, 0x70A7, 0x9EE1, 0x70A8, - 0x9EE2, 0x70A9, 0x9EE3, 0x70AA, 0x9EE4, 0x70B0, 0x9EE5, 0x70B2, - 0x9EE6, 0x70B4, 0x9EE7, 0x70B5, 0x9EE8, 0x70B6, 0x9EE9, 0x70BA, - 0x9EEA, 0x70BE, 0x9EEB, 0x70BF, 0x9EEC, 0x70C4, 0x9EED, 0x70C5, - 0x9EEE, 0x70C6, 0x9EEF, 0x70C7, 0x9EF0, 0x70C9, 0x9EF1, 0x70CB, - 0x9EF2, 0x70CC, 0x9EF3, 0x70CD, 0x9EF4, 0x70CE, 0x9EF5, 0x70CF, - 0x9EF6, 0x70D0, 0x9EF7, 0x70D1, 0x9EF8, 0x70D2, 0x9EF9, 0x70D3, - 0x9EFA, 0x70D4, 0x9EFB, 0x70D5, 0x9EFC, 0x70D6, 0x9EFD, 0x70D7, - 0x9EFE, 0x70DA, 0x9F40, 0x70DC, 0x9F41, 0x70DD, 0x9F42, 0x70DE, - 0x9F43, 0x70E0, 0x9F44, 0x70E1, 0x9F45, 0x70E2, 0x9F46, 0x70E3, - 0x9F47, 0x70E5, 0x9F48, 0x70EA, 0x9F49, 0x70EE, 0x9F4A, 0x70F0, - 0x9F4B, 0x70F1, 0x9F4C, 0x70F2, 0x9F4D, 0x70F3, 0x9F4E, 0x70F4, - 0x9F4F, 0x70F5, 0x9F50, 0x70F6, 0x9F51, 0x70F8, 0x9F52, 0x70FA, - 0x9F53, 0x70FB, 0x9F54, 0x70FC, 0x9F55, 0x70FE, 0x9F56, 0x70FF, - 0x9F57, 0x7100, 0x9F58, 0x7101, 0x9F59, 0x7102, 0x9F5A, 0x7103, - 0x9F5B, 0x7104, 0x9F5C, 0x7105, 0x9F5D, 0x7106, 0x9F5E, 0x7107, - 0x9F5F, 0x7108, 0x9F60, 0x710B, 0x9F61, 0x710C, 0x9F62, 0x710D, - 0x9F63, 0x710E, 0x9F64, 0x710F, 0x9F65, 0x7111, 0x9F66, 0x7112, - 0x9F67, 0x7114, 0x9F68, 0x7117, 0x9F69, 0x711B, 0x9F6A, 0x711C, - 0x9F6B, 0x711D, 0x9F6C, 0x711E, 0x9F6D, 0x711F, 0x9F6E, 0x7120, - 0x9F6F, 0x7121, 0x9F70, 0x7122, 0x9F71, 0x7123, 0x9F72, 0x7124, - 0x9F73, 0x7125, 0x9F74, 0x7127, 0x9F75, 0x7128, 0x9F76, 0x7129, - 0x9F77, 0x712A, 0x9F78, 0x712B, 0x9F79, 0x712C, 0x9F7A, 0x712D, - 0x9F7B, 0x712E, 0x9F7C, 0x7132, 0x9F7D, 0x7133, 0x9F7E, 0x7134, - 0x9F80, 0x7135, 0x9F81, 0x7137, 0x9F82, 0x7138, 0x9F83, 0x7139, - 0x9F84, 0x713A, 0x9F85, 0x713B, 0x9F86, 0x713C, 0x9F87, 0x713D, - 0x9F88, 0x713E, 0x9F89, 0x713F, 0x9F8A, 0x7140, 0x9F8B, 0x7141, - 0x9F8C, 0x7142, 0x9F8D, 0x7143, 0x9F8E, 0x7144, 0x9F8F, 0x7146, - 0x9F90, 0x7147, 0x9F91, 0x7148, 0x9F92, 0x7149, 0x9F93, 0x714B, - 0x9F94, 0x714D, 0x9F95, 0x714F, 0x9F96, 0x7150, 0x9F97, 0x7151, - 0x9F98, 0x7152, 0x9F99, 0x7153, 0x9F9A, 0x7154, 0x9F9B, 0x7155, - 0x9F9C, 0x7156, 0x9F9D, 0x7157, 0x9F9E, 0x7158, 0x9F9F, 0x7159, - 0x9FA0, 0x715A, 0x9FA1, 0x715B, 0x9FA2, 0x715D, 0x9FA3, 0x715F, - 0x9FA4, 0x7160, 0x9FA5, 0x7161, 0x9FA6, 0x7162, 0x9FA7, 0x7163, - 0x9FA8, 0x7165, 0x9FA9, 0x7169, 0x9FAA, 0x716A, 0x9FAB, 0x716B, - 0x9FAC, 0x716C, 0x9FAD, 0x716D, 0x9FAE, 0x716F, 0x9FAF, 0x7170, - 0x9FB0, 0x7171, 0x9FB1, 0x7174, 0x9FB2, 0x7175, 0x9FB3, 0x7176, - 0x9FB4, 0x7177, 0x9FB5, 0x7179, 0x9FB6, 0x717B, 0x9FB7, 0x717C, - 0x9FB8, 0x717E, 0x9FB9, 0x717F, 0x9FBA, 0x7180, 0x9FBB, 0x7181, - 0x9FBC, 0x7182, 0x9FBD, 0x7183, 0x9FBE, 0x7185, 0x9FBF, 0x7186, - 0x9FC0, 0x7187, 0x9FC1, 0x7188, 0x9FC2, 0x7189, 0x9FC3, 0x718B, - 0x9FC4, 0x718C, 0x9FC5, 0x718D, 0x9FC6, 0x718E, 0x9FC7, 0x7190, - 0x9FC8, 0x7191, 0x9FC9, 0x7192, 0x9FCA, 0x7193, 0x9FCB, 0x7195, - 0x9FCC, 0x7196, 0x9FCD, 0x7197, 0x9FCE, 0x719A, 0x9FCF, 0x719B, - 0x9FD0, 0x719C, 0x9FD1, 0x719D, 0x9FD2, 0x719E, 0x9FD3, 0x71A1, - 0x9FD4, 0x71A2, 0x9FD5, 0x71A3, 0x9FD6, 0x71A4, 0x9FD7, 0x71A5, - 0x9FD8, 0x71A6, 0x9FD9, 0x71A7, 0x9FDA, 0x71A9, 0x9FDB, 0x71AA, - 0x9FDC, 0x71AB, 0x9FDD, 0x71AD, 0x9FDE, 0x71AE, 0x9FDF, 0x71AF, - 0x9FE0, 0x71B0, 0x9FE1, 0x71B1, 0x9FE2, 0x71B2, 0x9FE3, 0x71B4, - 0x9FE4, 0x71B6, 0x9FE5, 0x71B7, 0x9FE6, 0x71B8, 0x9FE7, 0x71BA, - 0x9FE8, 0x71BB, 0x9FE9, 0x71BC, 0x9FEA, 0x71BD, 0x9FEB, 0x71BE, - 0x9FEC, 0x71BF, 0x9FED, 0x71C0, 0x9FEE, 0x71C1, 0x9FEF, 0x71C2, - 0x9FF0, 0x71C4, 0x9FF1, 0x71C5, 0x9FF2, 0x71C6, 0x9FF3, 0x71C7, - 0x9FF4, 0x71C8, 0x9FF5, 0x71C9, 0x9FF6, 0x71CA, 0x9FF7, 0x71CB, - 0x9FF8, 0x71CC, 0x9FF9, 0x71CD, 0x9FFA, 0x71CF, 0x9FFB, 0x71D0, - 0x9FFC, 0x71D1, 0x9FFD, 0x71D2, 0x9FFE, 0x71D3, 0xA040, 0x71D6, - 0xA041, 0x71D7, 0xA042, 0x71D8, 0xA043, 0x71D9, 0xA044, 0x71DA, - 0xA045, 0x71DB, 0xA046, 0x71DC, 0xA047, 0x71DD, 0xA048, 0x71DE, - 0xA049, 0x71DF, 0xA04A, 0x71E1, 0xA04B, 0x71E2, 0xA04C, 0x71E3, - 0xA04D, 0x71E4, 0xA04E, 0x71E6, 0xA04F, 0x71E8, 0xA050, 0x71E9, - 0xA051, 0x71EA, 0xA052, 0x71EB, 0xA053, 0x71EC, 0xA054, 0x71ED, - 0xA055, 0x71EF, 0xA056, 0x71F0, 0xA057, 0x71F1, 0xA058, 0x71F2, - 0xA059, 0x71F3, 0xA05A, 0x71F4, 0xA05B, 0x71F5, 0xA05C, 0x71F6, - 0xA05D, 0x71F7, 0xA05E, 0x71F8, 0xA05F, 0x71FA, 0xA060, 0x71FB, - 0xA061, 0x71FC, 0xA062, 0x71FD, 0xA063, 0x71FE, 0xA064, 0x71FF, - 0xA065, 0x7200, 0xA066, 0x7201, 0xA067, 0x7202, 0xA068, 0x7203, - 0xA069, 0x7204, 0xA06A, 0x7205, 0xA06B, 0x7207, 0xA06C, 0x7208, - 0xA06D, 0x7209, 0xA06E, 0x720A, 0xA06F, 0x720B, 0xA070, 0x720C, - 0xA071, 0x720D, 0xA072, 0x720E, 0xA073, 0x720F, 0xA074, 0x7210, - 0xA075, 0x7211, 0xA076, 0x7212, 0xA077, 0x7213, 0xA078, 0x7214, - 0xA079, 0x7215, 0xA07A, 0x7216, 0xA07B, 0x7217, 0xA07C, 0x7218, - 0xA07D, 0x7219, 0xA07E, 0x721A, 0xA080, 0x721B, 0xA081, 0x721C, - 0xA082, 0x721E, 0xA083, 0x721F, 0xA084, 0x7220, 0xA085, 0x7221, - 0xA086, 0x7222, 0xA087, 0x7223, 0xA088, 0x7224, 0xA089, 0x7225, - 0xA08A, 0x7226, 0xA08B, 0x7227, 0xA08C, 0x7229, 0xA08D, 0x722B, - 0xA08E, 0x722D, 0xA08F, 0x722E, 0xA090, 0x722F, 0xA091, 0x7232, - 0xA092, 0x7233, 0xA093, 0x7234, 0xA094, 0x723A, 0xA095, 0x723C, - 0xA096, 0x723E, 0xA097, 0x7240, 0xA098, 0x7241, 0xA099, 0x7242, - 0xA09A, 0x7243, 0xA09B, 0x7244, 0xA09C, 0x7245, 0xA09D, 0x7246, - 0xA09E, 0x7249, 0xA09F, 0x724A, 0xA0A0, 0x724B, 0xA0A1, 0x724E, - 0xA0A2, 0x724F, 0xA0A3, 0x7250, 0xA0A4, 0x7251, 0xA0A5, 0x7253, - 0xA0A6, 0x7254, 0xA0A7, 0x7255, 0xA0A8, 0x7257, 0xA0A9, 0x7258, - 0xA0AA, 0x725A, 0xA0AB, 0x725C, 0xA0AC, 0x725E, 0xA0AD, 0x7260, - 0xA0AE, 0x7263, 0xA0AF, 0x7264, 0xA0B0, 0x7265, 0xA0B1, 0x7268, - 0xA0B2, 0x726A, 0xA0B3, 0x726B, 0xA0B4, 0x726C, 0xA0B5, 0x726D, - 0xA0B6, 0x7270, 0xA0B7, 0x7271, 0xA0B8, 0x7273, 0xA0B9, 0x7274, - 0xA0BA, 0x7276, 0xA0BB, 0x7277, 0xA0BC, 0x7278, 0xA0BD, 0x727B, - 0xA0BE, 0x727C, 0xA0BF, 0x727D, 0xA0C0, 0x7282, 0xA0C1, 0x7283, - 0xA0C2, 0x7285, 0xA0C3, 0x7286, 0xA0C4, 0x7287, 0xA0C5, 0x7288, - 0xA0C6, 0x7289, 0xA0C7, 0x728C, 0xA0C8, 0x728E, 0xA0C9, 0x7290, - 0xA0CA, 0x7291, 0xA0CB, 0x7293, 0xA0CC, 0x7294, 0xA0CD, 0x7295, - 0xA0CE, 0x7296, 0xA0CF, 0x7297, 0xA0D0, 0x7298, 0xA0D1, 0x7299, - 0xA0D2, 0x729A, 0xA0D3, 0x729B, 0xA0D4, 0x729C, 0xA0D5, 0x729D, - 0xA0D6, 0x729E, 0xA0D7, 0x72A0, 0xA0D8, 0x72A1, 0xA0D9, 0x72A2, - 0xA0DA, 0x72A3, 0xA0DB, 0x72A4, 0xA0DC, 0x72A5, 0xA0DD, 0x72A6, - 0xA0DE, 0x72A7, 0xA0DF, 0x72A8, 0xA0E0, 0x72A9, 0xA0E1, 0x72AA, - 0xA0E2, 0x72AB, 0xA0E3, 0x72AE, 0xA0E4, 0x72B1, 0xA0E5, 0x72B2, - 0xA0E6, 0x72B3, 0xA0E7, 0x72B5, 0xA0E8, 0x72BA, 0xA0E9, 0x72BB, - 0xA0EA, 0x72BC, 0xA0EB, 0x72BD, 0xA0EC, 0x72BE, 0xA0ED, 0x72BF, - 0xA0EE, 0x72C0, 0xA0EF, 0x72C5, 0xA0F0, 0x72C6, 0xA0F1, 0x72C7, - 0xA0F2, 0x72C9, 0xA0F3, 0x72CA, 0xA0F4, 0x72CB, 0xA0F5, 0x72CC, - 0xA0F6, 0x72CF, 0xA0F7, 0x72D1, 0xA0F8, 0x72D3, 0xA0F9, 0x72D4, - 0xA0FA, 0x72D5, 0xA0FB, 0x72D6, 0xA0FC, 0x72D8, 0xA0FD, 0x72DA, - 0xA0FE, 0x72DB, 0xA1A1, 0x3000, 0xA1A2, 0x3001, 0xA1A3, 0x3002, - 0xA1A4, 0x00B7, 0xA1A5, 0x02C9, 0xA1A6, 0x02C7, 0xA1A7, 0x00A8, - 0xA1A8, 0x3003, 0xA1A9, 0x3005, 0xA1AA, 0x2014, 0xA1AB, 0xFF5E, - 0xA1AC, 0x2016, 0xA1AD, 0x2026, 0xA1AE, 0x2018, 0xA1AF, 0x2019, - 0xA1B0, 0x201C, 0xA1B1, 0x201D, 0xA1B2, 0x3014, 0xA1B3, 0x3015, - 0xA1B4, 0x3008, 0xA1B5, 0x3009, 0xA1B6, 0x300A, 0xA1B7, 0x300B, - 0xA1B8, 0x300C, 0xA1B9, 0x300D, 0xA1BA, 0x300E, 0xA1BB, 0x300F, - 0xA1BC, 0x3016, 0xA1BD, 0x3017, 0xA1BE, 0x3010, 0xA1BF, 0x3011, - 0xA1C0, 0x00B1, 0xA1C1, 0x00D7, 0xA1C2, 0x00F7, 0xA1C3, 0x2236, - 0xA1C4, 0x2227, 0xA1C5, 0x2228, 0xA1C6, 0x2211, 0xA1C7, 0x220F, - 0xA1C8, 0x222A, 0xA1C9, 0x2229, 0xA1CA, 0x2208, 0xA1CB, 0x2237, - 0xA1CC, 0x221A, 0xA1CD, 0x22A5, 0xA1CE, 0x2225, 0xA1CF, 0x2220, - 0xA1D0, 0x2312, 0xA1D1, 0x2299, 0xA1D2, 0x222B, 0xA1D3, 0x222E, - 0xA1D4, 0x2261, 0xA1D5, 0x224C, 0xA1D6, 0x2248, 0xA1D7, 0x223D, - 0xA1D8, 0x221D, 0xA1D9, 0x2260, 0xA1DA, 0x226E, 0xA1DB, 0x226F, - 0xA1DC, 0x2264, 0xA1DD, 0x2265, 0xA1DE, 0x221E, 0xA1DF, 0x2235, - 0xA1E0, 0x2234, 0xA1E1, 0x2642, 0xA1E2, 0x2640, 0xA1E3, 0x00B0, - 0xA1E4, 0x2032, 0xA1E5, 0x2033, 0xA1E6, 0x2103, 0xA1E7, 0xFF04, - 0xA1E8, 0x00A4, 0xA1E9, 0xFFE0, 0xA1EA, 0xFFE1, 0xA1EB, 0x2030, - 0xA1EC, 0x00A7, 0xA1ED, 0x2116, 0xA1EE, 0x2606, 0xA1EF, 0x2605, - 0xA1F0, 0x25CB, 0xA1F1, 0x25CF, 0xA1F2, 0x25CE, 0xA1F3, 0x25C7, - 0xA1F4, 0x25C6, 0xA1F5, 0x25A1, 0xA1F6, 0x25A0, 0xA1F7, 0x25B3, - 0xA1F8, 0x25B2, 0xA1F9, 0x203B, 0xA1FA, 0x2192, 0xA1FB, 0x2190, - 0xA1FC, 0x2191, 0xA1FD, 0x2193, 0xA1FE, 0x3013, 0xA2A1, 0x2170, - 0xA2A2, 0x2171, 0xA2A3, 0x2172, 0xA2A4, 0x2173, 0xA2A5, 0x2174, - 0xA2A6, 0x2175, 0xA2A7, 0x2176, 0xA2A8, 0x2177, 0xA2A9, 0x2178, - 0xA2AA, 0x2179, 0xA2B1, 0x2488, 0xA2B2, 0x2489, 0xA2B3, 0x248A, - 0xA2B4, 0x248B, 0xA2B5, 0x248C, 0xA2B6, 0x248D, 0xA2B7, 0x248E, - 0xA2B8, 0x248F, 0xA2B9, 0x2490, 0xA2BA, 0x2491, 0xA2BB, 0x2492, - 0xA2BC, 0x2493, 0xA2BD, 0x2494, 0xA2BE, 0x2495, 0xA2BF, 0x2496, - 0xA2C0, 0x2497, 0xA2C1, 0x2498, 0xA2C2, 0x2499, 0xA2C3, 0x249A, - 0xA2C4, 0x249B, 0xA2C5, 0x2474, 0xA2C6, 0x2475, 0xA2C7, 0x2476, - 0xA2C8, 0x2477, 0xA2C9, 0x2478, 0xA2CA, 0x2479, 0xA2CB, 0x247A, - 0xA2CC, 0x247B, 0xA2CD, 0x247C, 0xA2CE, 0x247D, 0xA2CF, 0x247E, - 0xA2D0, 0x247F, 0xA2D1, 0x2480, 0xA2D2, 0x2481, 0xA2D3, 0x2482, - 0xA2D4, 0x2483, 0xA2D5, 0x2484, 0xA2D6, 0x2485, 0xA2D7, 0x2486, - 0xA2D8, 0x2487, 0xA2D9, 0x2460, 0xA2DA, 0x2461, 0xA2DB, 0x2462, - 0xA2DC, 0x2463, 0xA2DD, 0x2464, 0xA2DE, 0x2465, 0xA2DF, 0x2466, - 0xA2E0, 0x2467, 0xA2E1, 0x2468, 0xA2E2, 0x2469, 0xA2E5, 0x3220, - 0xA2E6, 0x3221, 0xA2E7, 0x3222, 0xA2E8, 0x3223, 0xA2E9, 0x3224, - 0xA2EA, 0x3225, 0xA2EB, 0x3226, 0xA2EC, 0x3227, 0xA2ED, 0x3228, - 0xA2EE, 0x3229, 0xA2F1, 0x2160, 0xA2F2, 0x2161, 0xA2F3, 0x2162, - 0xA2F4, 0x2163, 0xA2F5, 0x2164, 0xA2F6, 0x2165, 0xA2F7, 0x2166, - 0xA2F8, 0x2167, 0xA2F9, 0x2168, 0xA2FA, 0x2169, 0xA2FB, 0x216A, - 0xA2FC, 0x216B, 0xA3A1, 0xFF01, 0xA3A2, 0xFF02, 0xA3A3, 0xFF03, - 0xA3A4, 0xFFE5, 0xA3A5, 0xFF05, 0xA3A6, 0xFF06, 0xA3A7, 0xFF07, - 0xA3A8, 0xFF08, 0xA3A9, 0xFF09, 0xA3AA, 0xFF0A, 0xA3AB, 0xFF0B, - 0xA3AC, 0xFF0C, 0xA3AD, 0xFF0D, 0xA3AE, 0xFF0E, 0xA3AF, 0xFF0F, - 0xA3B0, 0xFF10, 0xA3B1, 0xFF11, 0xA3B2, 0xFF12, 0xA3B3, 0xFF13, - 0xA3B4, 0xFF14, 0xA3B5, 0xFF15, 0xA3B6, 0xFF16, 0xA3B7, 0xFF17, - 0xA3B8, 0xFF18, 0xA3B9, 0xFF19, 0xA3BA, 0xFF1A, 0xA3BB, 0xFF1B, - 0xA3BC, 0xFF1C, 0xA3BD, 0xFF1D, 0xA3BE, 0xFF1E, 0xA3BF, 0xFF1F, - 0xA3C0, 0xFF20, 0xA3C1, 0xFF21, 0xA3C2, 0xFF22, 0xA3C3, 0xFF23, - 0xA3C4, 0xFF24, 0xA3C5, 0xFF25, 0xA3C6, 0xFF26, 0xA3C7, 0xFF27, - 0xA3C8, 0xFF28, 0xA3C9, 0xFF29, 0xA3CA, 0xFF2A, 0xA3CB, 0xFF2B, - 0xA3CC, 0xFF2C, 0xA3CD, 0xFF2D, 0xA3CE, 0xFF2E, 0xA3CF, 0xFF2F, - 0xA3D0, 0xFF30, 0xA3D1, 0xFF31, 0xA3D2, 0xFF32, 0xA3D3, 0xFF33, - 0xA3D4, 0xFF34, 0xA3D5, 0xFF35, 0xA3D6, 0xFF36, 0xA3D7, 0xFF37, - 0xA3D8, 0xFF38, 0xA3D9, 0xFF39, 0xA3DA, 0xFF3A, 0xA3DB, 0xFF3B, - 0xA3DC, 0xFF3C, 0xA3DD, 0xFF3D, 0xA3DE, 0xFF3E, 0xA3DF, 0xFF3F, - 0xA3E0, 0xFF40, 0xA3E1, 0xFF41, 0xA3E2, 0xFF42, 0xA3E3, 0xFF43, - 0xA3E4, 0xFF44, 0xA3E5, 0xFF45, 0xA3E6, 0xFF46, 0xA3E7, 0xFF47, - 0xA3E8, 0xFF48, 0xA3E9, 0xFF49, 0xA3EA, 0xFF4A, 0xA3EB, 0xFF4B, - 0xA3EC, 0xFF4C, 0xA3ED, 0xFF4D, 0xA3EE, 0xFF4E, 0xA3EF, 0xFF4F, - 0xA3F0, 0xFF50, 0xA3F1, 0xFF51, 0xA3F2, 0xFF52, 0xA3F3, 0xFF53, - 0xA3F4, 0xFF54, 0xA3F5, 0xFF55, 0xA3F6, 0xFF56, 0xA3F7, 0xFF57, - 0xA3F8, 0xFF58, 0xA3F9, 0xFF59, 0xA3FA, 0xFF5A, 0xA3FB, 0xFF5B, - 0xA3FC, 0xFF5C, 0xA3FD, 0xFF5D, 0xA3FE, 0xFFE3, 0xA4A1, 0x3041, - 0xA4A2, 0x3042, 0xA4A3, 0x3043, 0xA4A4, 0x3044, 0xA4A5, 0x3045, - 0xA4A6, 0x3046, 0xA4A7, 0x3047, 0xA4A8, 0x3048, 0xA4A9, 0x3049, - 0xA4AA, 0x304A, 0xA4AB, 0x304B, 0xA4AC, 0x304C, 0xA4AD, 0x304D, - 0xA4AE, 0x304E, 0xA4AF, 0x304F, 0xA4B0, 0x3050, 0xA4B1, 0x3051, - 0xA4B2, 0x3052, 0xA4B3, 0x3053, 0xA4B4, 0x3054, 0xA4B5, 0x3055, - 0xA4B6, 0x3056, 0xA4B7, 0x3057, 0xA4B8, 0x3058, 0xA4B9, 0x3059, - 0xA4BA, 0x305A, 0xA4BB, 0x305B, 0xA4BC, 0x305C, 0xA4BD, 0x305D, - 0xA4BE, 0x305E, 0xA4BF, 0x305F, 0xA4C0, 0x3060, 0xA4C1, 0x3061, - 0xA4C2, 0x3062, 0xA4C3, 0x3063, 0xA4C4, 0x3064, 0xA4C5, 0x3065, - 0xA4C6, 0x3066, 0xA4C7, 0x3067, 0xA4C8, 0x3068, 0xA4C9, 0x3069, - 0xA4CA, 0x306A, 0xA4CB, 0x306B, 0xA4CC, 0x306C, 0xA4CD, 0x306D, - 0xA4CE, 0x306E, 0xA4CF, 0x306F, 0xA4D0, 0x3070, 0xA4D1, 0x3071, - 0xA4D2, 0x3072, 0xA4D3, 0x3073, 0xA4D4, 0x3074, 0xA4D5, 0x3075, - 0xA4D6, 0x3076, 0xA4D7, 0x3077, 0xA4D8, 0x3078, 0xA4D9, 0x3079, - 0xA4DA, 0x307A, 0xA4DB, 0x307B, 0xA4DC, 0x307C, 0xA4DD, 0x307D, - 0xA4DE, 0x307E, 0xA4DF, 0x307F, 0xA4E0, 0x3080, 0xA4E1, 0x3081, - 0xA4E2, 0x3082, 0xA4E3, 0x3083, 0xA4E4, 0x3084, 0xA4E5, 0x3085, - 0xA4E6, 0x3086, 0xA4E7, 0x3087, 0xA4E8, 0x3088, 0xA4E9, 0x3089, - 0xA4EA, 0x308A, 0xA4EB, 0x308B, 0xA4EC, 0x308C, 0xA4ED, 0x308D, - 0xA4EE, 0x308E, 0xA4EF, 0x308F, 0xA4F0, 0x3090, 0xA4F1, 0x3091, - 0xA4F2, 0x3092, 0xA4F3, 0x3093, 0xA5A1, 0x30A1, 0xA5A2, 0x30A2, - 0xA5A3, 0x30A3, 0xA5A4, 0x30A4, 0xA5A5, 0x30A5, 0xA5A6, 0x30A6, - 0xA5A7, 0x30A7, 0xA5A8, 0x30A8, 0xA5A9, 0x30A9, 0xA5AA, 0x30AA, - 0xA5AB, 0x30AB, 0xA5AC, 0x30AC, 0xA5AD, 0x30AD, 0xA5AE, 0x30AE, - 0xA5AF, 0x30AF, 0xA5B0, 0x30B0, 0xA5B1, 0x30B1, 0xA5B2, 0x30B2, - 0xA5B3, 0x30B3, 0xA5B4, 0x30B4, 0xA5B5, 0x30B5, 0xA5B6, 0x30B6, - 0xA5B7, 0x30B7, 0xA5B8, 0x30B8, 0xA5B9, 0x30B9, 0xA5BA, 0x30BA, - 0xA5BB, 0x30BB, 0xA5BC, 0x30BC, 0xA5BD, 0x30BD, 0xA5BE, 0x30BE, - 0xA5BF, 0x30BF, 0xA5C0, 0x30C0, 0xA5C1, 0x30C1, 0xA5C2, 0x30C2, - 0xA5C3, 0x30C3, 0xA5C4, 0x30C4, 0xA5C5, 0x30C5, 0xA5C6, 0x30C6, - 0xA5C7, 0x30C7, 0xA5C8, 0x30C8, 0xA5C9, 0x30C9, 0xA5CA, 0x30CA, - 0xA5CB, 0x30CB, 0xA5CC, 0x30CC, 0xA5CD, 0x30CD, 0xA5CE, 0x30CE, - 0xA5CF, 0x30CF, 0xA5D0, 0x30D0, 0xA5D1, 0x30D1, 0xA5D2, 0x30D2, - 0xA5D3, 0x30D3, 0xA5D4, 0x30D4, 0xA5D5, 0x30D5, 0xA5D6, 0x30D6, - 0xA5D7, 0x30D7, 0xA5D8, 0x30D8, 0xA5D9, 0x30D9, 0xA5DA, 0x30DA, - 0xA5DB, 0x30DB, 0xA5DC, 0x30DC, 0xA5DD, 0x30DD, 0xA5DE, 0x30DE, - 0xA5DF, 0x30DF, 0xA5E0, 0x30E0, 0xA5E1, 0x30E1, 0xA5E2, 0x30E2, - 0xA5E3, 0x30E3, 0xA5E4, 0x30E4, 0xA5E5, 0x30E5, 0xA5E6, 0x30E6, - 0xA5E7, 0x30E7, 0xA5E8, 0x30E8, 0xA5E9, 0x30E9, 0xA5EA, 0x30EA, - 0xA5EB, 0x30EB, 0xA5EC, 0x30EC, 0xA5ED, 0x30ED, 0xA5EE, 0x30EE, - 0xA5EF, 0x30EF, 0xA5F0, 0x30F0, 0xA5F1, 0x30F1, 0xA5F2, 0x30F2, - 0xA5F3, 0x30F3, 0xA5F4, 0x30F4, 0xA5F5, 0x30F5, 0xA5F6, 0x30F6, - 0xA6A1, 0x0391, 0xA6A2, 0x0392, 0xA6A3, 0x0393, 0xA6A4, 0x0394, - 0xA6A5, 0x0395, 0xA6A6, 0x0396, 0xA6A7, 0x0397, 0xA6A8, 0x0398, - 0xA6A9, 0x0399, 0xA6AA, 0x039A, 0xA6AB, 0x039B, 0xA6AC, 0x039C, - 0xA6AD, 0x039D, 0xA6AE, 0x039E, 0xA6AF, 0x039F, 0xA6B0, 0x03A0, - 0xA6B1, 0x03A1, 0xA6B2, 0x03A3, 0xA6B3, 0x03A4, 0xA6B4, 0x03A5, - 0xA6B5, 0x03A6, 0xA6B6, 0x03A7, 0xA6B7, 0x03A8, 0xA6B8, 0x03A9, - 0xA6C1, 0x03B1, 0xA6C2, 0x03B2, 0xA6C3, 0x03B3, 0xA6C4, 0x03B4, - 0xA6C5, 0x03B5, 0xA6C6, 0x03B6, 0xA6C7, 0x03B7, 0xA6C8, 0x03B8, - 0xA6C9, 0x03B9, 0xA6CA, 0x03BA, 0xA6CB, 0x03BB, 0xA6CC, 0x03BC, - 0xA6CD, 0x03BD, 0xA6CE, 0x03BE, 0xA6CF, 0x03BF, 0xA6D0, 0x03C0, - 0xA6D1, 0x03C1, 0xA6D2, 0x03C3, 0xA6D3, 0x03C4, 0xA6D4, 0x03C5, - 0xA6D5, 0x03C6, 0xA6D6, 0x03C7, 0xA6D7, 0x03C8, 0xA6D8, 0x03C9, - 0xA6E0, 0xFE35, 0xA6E1, 0xFE36, 0xA6E2, 0xFE39, 0xA6E3, 0xFE3A, - 0xA6E4, 0xFE3F, 0xA6E5, 0xFE40, 0xA6E6, 0xFE3D, 0xA6E7, 0xFE3E, - 0xA6E8, 0xFE41, 0xA6E9, 0xFE42, 0xA6EA, 0xFE43, 0xA6EB, 0xFE44, - 0xA6EE, 0xFE3B, 0xA6EF, 0xFE3C, 0xA6F0, 0xFE37, 0xA6F1, 0xFE38, - 0xA6F2, 0xFE31, 0xA6F4, 0xFE33, 0xA6F5, 0xFE34, 0xA7A1, 0x0410, - 0xA7A2, 0x0411, 0xA7A3, 0x0412, 0xA7A4, 0x0413, 0xA7A5, 0x0414, - 0xA7A6, 0x0415, 0xA7A7, 0x0401, 0xA7A8, 0x0416, 0xA7A9, 0x0417, - 0xA7AA, 0x0418, 0xA7AB, 0x0419, 0xA7AC, 0x041A, 0xA7AD, 0x041B, - 0xA7AE, 0x041C, 0xA7AF, 0x041D, 0xA7B0, 0x041E, 0xA7B1, 0x041F, - 0xA7B2, 0x0420, 0xA7B3, 0x0421, 0xA7B4, 0x0422, 0xA7B5, 0x0423, - 0xA7B6, 0x0424, 0xA7B7, 0x0425, 0xA7B8, 0x0426, 0xA7B9, 0x0427, - 0xA7BA, 0x0428, 0xA7BB, 0x0429, 0xA7BC, 0x042A, 0xA7BD, 0x042B, - 0xA7BE, 0x042C, 0xA7BF, 0x042D, 0xA7C0, 0x042E, 0xA7C1, 0x042F, - 0xA7D1, 0x0430, 0xA7D2, 0x0431, 0xA7D3, 0x0432, 0xA7D4, 0x0433, - 0xA7D5, 0x0434, 0xA7D6, 0x0435, 0xA7D7, 0x0451, 0xA7D8, 0x0436, - 0xA7D9, 0x0437, 0xA7DA, 0x0438, 0xA7DB, 0x0439, 0xA7DC, 0x043A, - 0xA7DD, 0x043B, 0xA7DE, 0x043C, 0xA7DF, 0x043D, 0xA7E0, 0x043E, - 0xA7E1, 0x043F, 0xA7E2, 0x0440, 0xA7E3, 0x0441, 0xA7E4, 0x0442, - 0xA7E5, 0x0443, 0xA7E6, 0x0444, 0xA7E7, 0x0445, 0xA7E8, 0x0446, - 0xA7E9, 0x0447, 0xA7EA, 0x0448, 0xA7EB, 0x0449, 0xA7EC, 0x044A, - 0xA7ED, 0x044B, 0xA7EE, 0x044C, 0xA7EF, 0x044D, 0xA7F0, 0x044E, - 0xA7F1, 0x044F, 0xA840, 0x02CA, 0xA841, 0x02CB, 0xA842, 0x02D9, - 0xA843, 0x2013, 0xA844, 0x2015, 0xA845, 0x2025, 0xA846, 0x2035, - 0xA847, 0x2105, 0xA848, 0x2109, 0xA849, 0x2196, 0xA84A, 0x2197, - 0xA84B, 0x2198, 0xA84C, 0x2199, 0xA84D, 0x2215, 0xA84E, 0x221F, - 0xA84F, 0x2223, 0xA850, 0x2252, 0xA851, 0x2266, 0xA852, 0x2267, - 0xA853, 0x22BF, 0xA854, 0x2550, 0xA855, 0x2551, 0xA856, 0x2552, - 0xA857, 0x2553, 0xA858, 0x2554, 0xA859, 0x2555, 0xA85A, 0x2556, - 0xA85B, 0x2557, 0xA85C, 0x2558, 0xA85D, 0x2559, 0xA85E, 0x255A, - 0xA85F, 0x255B, 0xA860, 0x255C, 0xA861, 0x255D, 0xA862, 0x255E, - 0xA863, 0x255F, 0xA864, 0x2560, 0xA865, 0x2561, 0xA866, 0x2562, - 0xA867, 0x2563, 0xA868, 0x2564, 0xA869, 0x2565, 0xA86A, 0x2566, - 0xA86B, 0x2567, 0xA86C, 0x2568, 0xA86D, 0x2569, 0xA86E, 0x256A, - 0xA86F, 0x256B, 0xA870, 0x256C, 0xA871, 0x256D, 0xA872, 0x256E, - 0xA873, 0x256F, 0xA874, 0x2570, 0xA875, 0x2571, 0xA876, 0x2572, - 0xA877, 0x2573, 0xA878, 0x2581, 0xA879, 0x2582, 0xA87A, 0x2583, - 0xA87B, 0x2584, 0xA87C, 0x2585, 0xA87D, 0x2586, 0xA87E, 0x2587, - 0xA880, 0x2588, 0xA881, 0x2589, 0xA882, 0x258A, 0xA883, 0x258B, - 0xA884, 0x258C, 0xA885, 0x258D, 0xA886, 0x258E, 0xA887, 0x258F, - 0xA888, 0x2593, 0xA889, 0x2594, 0xA88A, 0x2595, 0xA88B, 0x25BC, - 0xA88C, 0x25BD, 0xA88D, 0x25E2, 0xA88E, 0x25E3, 0xA88F, 0x25E4, - 0xA890, 0x25E5, 0xA891, 0x2609, 0xA892, 0x2295, 0xA893, 0x3012, - 0xA894, 0x301D, 0xA895, 0x301E, 0xA8A1, 0x0101, 0xA8A2, 0x00E1, - 0xA8A3, 0x01CE, 0xA8A4, 0x00E0, 0xA8A5, 0x0113, 0xA8A6, 0x00E9, - 0xA8A7, 0x011B, 0xA8A8, 0x00E8, 0xA8A9, 0x012B, 0xA8AA, 0x00ED, - 0xA8AB, 0x01D0, 0xA8AC, 0x00EC, 0xA8AD, 0x014D, 0xA8AE, 0x00F3, - 0xA8AF, 0x01D2, 0xA8B0, 0x00F2, 0xA8B1, 0x016B, 0xA8B2, 0x00FA, - 0xA8B3, 0x01D4, 0xA8B4, 0x00F9, 0xA8B5, 0x01D6, 0xA8B6, 0x01D8, - 0xA8B7, 0x01DA, 0xA8B8, 0x01DC, 0xA8B9, 0x00FC, 0xA8BA, 0x00EA, - 0xA8BB, 0x0251, 0xA8BD, 0x0144, 0xA8BE, 0x0148, 0xA8C0, 0x0261, - 0xA8C5, 0x3105, 0xA8C6, 0x3106, 0xA8C7, 0x3107, 0xA8C8, 0x3108, - 0xA8C9, 0x3109, 0xA8CA, 0x310A, 0xA8CB, 0x310B, 0xA8CC, 0x310C, - 0xA8CD, 0x310D, 0xA8CE, 0x310E, 0xA8CF, 0x310F, 0xA8D0, 0x3110, - 0xA8D1, 0x3111, 0xA8D2, 0x3112, 0xA8D3, 0x3113, 0xA8D4, 0x3114, - 0xA8D5, 0x3115, 0xA8D6, 0x3116, 0xA8D7, 0x3117, 0xA8D8, 0x3118, - 0xA8D9, 0x3119, 0xA8DA, 0x311A, 0xA8DB, 0x311B, 0xA8DC, 0x311C, - 0xA8DD, 0x311D, 0xA8DE, 0x311E, 0xA8DF, 0x311F, 0xA8E0, 0x3120, - 0xA8E1, 0x3121, 0xA8E2, 0x3122, 0xA8E3, 0x3123, 0xA8E4, 0x3124, - 0xA8E5, 0x3125, 0xA8E6, 0x3126, 0xA8E7, 0x3127, 0xA8E8, 0x3128, - 0xA8E9, 0x3129, 0xA940, 0x3021, 0xA941, 0x3022, 0xA942, 0x3023, - 0xA943, 0x3024, 0xA944, 0x3025, 0xA945, 0x3026, 0xA946, 0x3027, - 0xA947, 0x3028, 0xA948, 0x3029, 0xA949, 0x32A3, 0xA94A, 0x338E, - 0xA94B, 0x338F, 0xA94C, 0x339C, 0xA94D, 0x339D, 0xA94E, 0x339E, - 0xA94F, 0x33A1, 0xA950, 0x33C4, 0xA951, 0x33CE, 0xA952, 0x33D1, - 0xA953, 0x33D2, 0xA954, 0x33D5, 0xA955, 0xFE30, 0xA956, 0xFFE2, - 0xA957, 0xFFE4, 0xA959, 0x2121, 0xA95A, 0x3231, 0xA95C, 0x2010, - 0xA960, 0x30FC, 0xA961, 0x309B, 0xA962, 0x309C, 0xA963, 0x30FD, - 0xA964, 0x30FE, 0xA965, 0x3006, 0xA966, 0x309D, 0xA967, 0x309E, - 0xA968, 0xFE49, 0xA969, 0xFE4A, 0xA96A, 0xFE4B, 0xA96B, 0xFE4C, - 0xA96C, 0xFE4D, 0xA96D, 0xFE4E, 0xA96E, 0xFE4F, 0xA96F, 0xFE50, - 0xA970, 0xFE51, 0xA971, 0xFE52, 0xA972, 0xFE54, 0xA973, 0xFE55, - 0xA974, 0xFE56, 0xA975, 0xFE57, 0xA976, 0xFE59, 0xA977, 0xFE5A, - 0xA978, 0xFE5B, 0xA979, 0xFE5C, 0xA97A, 0xFE5D, 0xA97B, 0xFE5E, - 0xA97C, 0xFE5F, 0xA97D, 0xFE60, 0xA97E, 0xFE61, 0xA980, 0xFE62, - 0xA981, 0xFE63, 0xA982, 0xFE64, 0xA983, 0xFE65, 0xA984, 0xFE66, - 0xA985, 0xFE68, 0xA986, 0xFE69, 0xA987, 0xFE6A, 0xA988, 0xFE6B, - 0xA996, 0x3007, 0xA9A4, 0x2500, 0xA9A5, 0x2501, 0xA9A6, 0x2502, - 0xA9A7, 0x2503, 0xA9A8, 0x2504, 0xA9A9, 0x2505, 0xA9AA, 0x2506, - 0xA9AB, 0x2507, 0xA9AC, 0x2508, 0xA9AD, 0x2509, 0xA9AE, 0x250A, - 0xA9AF, 0x250B, 0xA9B0, 0x250C, 0xA9B1, 0x250D, 0xA9B2, 0x250E, - 0xA9B3, 0x250F, 0xA9B4, 0x2510, 0xA9B5, 0x2511, 0xA9B6, 0x2512, - 0xA9B7, 0x2513, 0xA9B8, 0x2514, 0xA9B9, 0x2515, 0xA9BA, 0x2516, - 0xA9BB, 0x2517, 0xA9BC, 0x2518, 0xA9BD, 0x2519, 0xA9BE, 0x251A, - 0xA9BF, 0x251B, 0xA9C0, 0x251C, 0xA9C1, 0x251D, 0xA9C2, 0x251E, - 0xA9C3, 0x251F, 0xA9C4, 0x2520, 0xA9C5, 0x2521, 0xA9C6, 0x2522, - 0xA9C7, 0x2523, 0xA9C8, 0x2524, 0xA9C9, 0x2525, 0xA9CA, 0x2526, - 0xA9CB, 0x2527, 0xA9CC, 0x2528, 0xA9CD, 0x2529, 0xA9CE, 0x252A, - 0xA9CF, 0x252B, 0xA9D0, 0x252C, 0xA9D1, 0x252D, 0xA9D2, 0x252E, - 0xA9D3, 0x252F, 0xA9D4, 0x2530, 0xA9D5, 0x2531, 0xA9D6, 0x2532, - 0xA9D7, 0x2533, 0xA9D8, 0x2534, 0xA9D9, 0x2535, 0xA9DA, 0x2536, - 0xA9DB, 0x2537, 0xA9DC, 0x2538, 0xA9DD, 0x2539, 0xA9DE, 0x253A, - 0xA9DF, 0x253B, 0xA9E0, 0x253C, 0xA9E1, 0x253D, 0xA9E2, 0x253E, - 0xA9E3, 0x253F, 0xA9E4, 0x2540, 0xA9E5, 0x2541, 0xA9E6, 0x2542, - 0xA9E7, 0x2543, 0xA9E8, 0x2544, 0xA9E9, 0x2545, 0xA9EA, 0x2546, - 0xA9EB, 0x2547, 0xA9EC, 0x2548, 0xA9ED, 0x2549, 0xA9EE, 0x254A, - 0xA9EF, 0x254B, 0xAA40, 0x72DC, 0xAA41, 0x72DD, 0xAA42, 0x72DF, - 0xAA43, 0x72E2, 0xAA44, 0x72E3, 0xAA45, 0x72E4, 0xAA46, 0x72E5, - 0xAA47, 0x72E6, 0xAA48, 0x72E7, 0xAA49, 0x72EA, 0xAA4A, 0x72EB, - 0xAA4B, 0x72F5, 0xAA4C, 0x72F6, 0xAA4D, 0x72F9, 0xAA4E, 0x72FD, - 0xAA4F, 0x72FE, 0xAA50, 0x72FF, 0xAA51, 0x7300, 0xAA52, 0x7302, - 0xAA53, 0x7304, 0xAA54, 0x7305, 0xAA55, 0x7306, 0xAA56, 0x7307, - 0xAA57, 0x7308, 0xAA58, 0x7309, 0xAA59, 0x730B, 0xAA5A, 0x730C, - 0xAA5B, 0x730D, 0xAA5C, 0x730F, 0xAA5D, 0x7310, 0xAA5E, 0x7311, - 0xAA5F, 0x7312, 0xAA60, 0x7314, 0xAA61, 0x7318, 0xAA62, 0x7319, - 0xAA63, 0x731A, 0xAA64, 0x731F, 0xAA65, 0x7320, 0xAA66, 0x7323, - 0xAA67, 0x7324, 0xAA68, 0x7326, 0xAA69, 0x7327, 0xAA6A, 0x7328, - 0xAA6B, 0x732D, 0xAA6C, 0x732F, 0xAA6D, 0x7330, 0xAA6E, 0x7332, - 0xAA6F, 0x7333, 0xAA70, 0x7335, 0xAA71, 0x7336, 0xAA72, 0x733A, - 0xAA73, 0x733B, 0xAA74, 0x733C, 0xAA75, 0x733D, 0xAA76, 0x7340, - 0xAA77, 0x7341, 0xAA78, 0x7342, 0xAA79, 0x7343, 0xAA7A, 0x7344, - 0xAA7B, 0x7345, 0xAA7C, 0x7346, 0xAA7D, 0x7347, 0xAA7E, 0x7348, - 0xAA80, 0x7349, 0xAA81, 0x734A, 0xAA82, 0x734B, 0xAA83, 0x734C, - 0xAA84, 0x734E, 0xAA85, 0x734F, 0xAA86, 0x7351, 0xAA87, 0x7353, - 0xAA88, 0x7354, 0xAA89, 0x7355, 0xAA8A, 0x7356, 0xAA8B, 0x7358, - 0xAA8C, 0x7359, 0xAA8D, 0x735A, 0xAA8E, 0x735B, 0xAA8F, 0x735C, - 0xAA90, 0x735D, 0xAA91, 0x735E, 0xAA92, 0x735F, 0xAA93, 0x7361, - 0xAA94, 0x7362, 0xAA95, 0x7363, 0xAA96, 0x7364, 0xAA97, 0x7365, - 0xAA98, 0x7366, 0xAA99, 0x7367, 0xAA9A, 0x7368, 0xAA9B, 0x7369, - 0xAA9C, 0x736A, 0xAA9D, 0x736B, 0xAA9E, 0x736E, 0xAA9F, 0x7370, - 0xAAA0, 0x7371, 0xAB40, 0x7372, 0xAB41, 0x7373, 0xAB42, 0x7374, - 0xAB43, 0x7375, 0xAB44, 0x7376, 0xAB45, 0x7377, 0xAB46, 0x7378, - 0xAB47, 0x7379, 0xAB48, 0x737A, 0xAB49, 0x737B, 0xAB4A, 0x737C, - 0xAB4B, 0x737D, 0xAB4C, 0x737F, 0xAB4D, 0x7380, 0xAB4E, 0x7381, - 0xAB4F, 0x7382, 0xAB50, 0x7383, 0xAB51, 0x7385, 0xAB52, 0x7386, - 0xAB53, 0x7388, 0xAB54, 0x738A, 0xAB55, 0x738C, 0xAB56, 0x738D, - 0xAB57, 0x738F, 0xAB58, 0x7390, 0xAB59, 0x7392, 0xAB5A, 0x7393, - 0xAB5B, 0x7394, 0xAB5C, 0x7395, 0xAB5D, 0x7397, 0xAB5E, 0x7398, - 0xAB5F, 0x7399, 0xAB60, 0x739A, 0xAB61, 0x739C, 0xAB62, 0x739D, - 0xAB63, 0x739E, 0xAB64, 0x73A0, 0xAB65, 0x73A1, 0xAB66, 0x73A3, - 0xAB67, 0x73A4, 0xAB68, 0x73A5, 0xAB69, 0x73A6, 0xAB6A, 0x73A7, - 0xAB6B, 0x73A8, 0xAB6C, 0x73AA, 0xAB6D, 0x73AC, 0xAB6E, 0x73AD, - 0xAB6F, 0x73B1, 0xAB70, 0x73B4, 0xAB71, 0x73B5, 0xAB72, 0x73B6, - 0xAB73, 0x73B8, 0xAB74, 0x73B9, 0xAB75, 0x73BC, 0xAB76, 0x73BD, - 0xAB77, 0x73BE, 0xAB78, 0x73BF, 0xAB79, 0x73C1, 0xAB7A, 0x73C3, - 0xAB7B, 0x73C4, 0xAB7C, 0x73C5, 0xAB7D, 0x73C6, 0xAB7E, 0x73C7, - 0xAB80, 0x73CB, 0xAB81, 0x73CC, 0xAB82, 0x73CE, 0xAB83, 0x73D2, - 0xAB84, 0x73D3, 0xAB85, 0x73D4, 0xAB86, 0x73D5, 0xAB87, 0x73D6, - 0xAB88, 0x73D7, 0xAB89, 0x73D8, 0xAB8A, 0x73DA, 0xAB8B, 0x73DB, - 0xAB8C, 0x73DC, 0xAB8D, 0x73DD, 0xAB8E, 0x73DF, 0xAB8F, 0x73E1, - 0xAB90, 0x73E2, 0xAB91, 0x73E3, 0xAB92, 0x73E4, 0xAB93, 0x73E6, - 0xAB94, 0x73E8, 0xAB95, 0x73EA, 0xAB96, 0x73EB, 0xAB97, 0x73EC, - 0xAB98, 0x73EE, 0xAB99, 0x73EF, 0xAB9A, 0x73F0, 0xAB9B, 0x73F1, - 0xAB9C, 0x73F3, 0xAB9D, 0x73F4, 0xAB9E, 0x73F5, 0xAB9F, 0x73F6, - 0xABA0, 0x73F7, 0xAC40, 0x73F8, 0xAC41, 0x73F9, 0xAC42, 0x73FA, - 0xAC43, 0x73FB, 0xAC44, 0x73FC, 0xAC45, 0x73FD, 0xAC46, 0x73FE, - 0xAC47, 0x73FF, 0xAC48, 0x7400, 0xAC49, 0x7401, 0xAC4A, 0x7402, - 0xAC4B, 0x7404, 0xAC4C, 0x7407, 0xAC4D, 0x7408, 0xAC4E, 0x740B, - 0xAC4F, 0x740C, 0xAC50, 0x740D, 0xAC51, 0x740E, 0xAC52, 0x7411, - 0xAC53, 0x7412, 0xAC54, 0x7413, 0xAC55, 0x7414, 0xAC56, 0x7415, - 0xAC57, 0x7416, 0xAC58, 0x7417, 0xAC59, 0x7418, 0xAC5A, 0x7419, - 0xAC5B, 0x741C, 0xAC5C, 0x741D, 0xAC5D, 0x741E, 0xAC5E, 0x741F, - 0xAC5F, 0x7420, 0xAC60, 0x7421, 0xAC61, 0x7423, 0xAC62, 0x7424, - 0xAC63, 0x7427, 0xAC64, 0x7429, 0xAC65, 0x742B, 0xAC66, 0x742D, - 0xAC67, 0x742F, 0xAC68, 0x7431, 0xAC69, 0x7432, 0xAC6A, 0x7437, - 0xAC6B, 0x7438, 0xAC6C, 0x7439, 0xAC6D, 0x743A, 0xAC6E, 0x743B, - 0xAC6F, 0x743D, 0xAC70, 0x743E, 0xAC71, 0x743F, 0xAC72, 0x7440, - 0xAC73, 0x7442, 0xAC74, 0x7443, 0xAC75, 0x7444, 0xAC76, 0x7445, - 0xAC77, 0x7446, 0xAC78, 0x7447, 0xAC79, 0x7448, 0xAC7A, 0x7449, - 0xAC7B, 0x744A, 0xAC7C, 0x744B, 0xAC7D, 0x744C, 0xAC7E, 0x744D, - 0xAC80, 0x744E, 0xAC81, 0x744F, 0xAC82, 0x7450, 0xAC83, 0x7451, - 0xAC84, 0x7452, 0xAC85, 0x7453, 0xAC86, 0x7454, 0xAC87, 0x7456, - 0xAC88, 0x7458, 0xAC89, 0x745D, 0xAC8A, 0x7460, 0xAC8B, 0x7461, - 0xAC8C, 0x7462, 0xAC8D, 0x7463, 0xAC8E, 0x7464, 0xAC8F, 0x7465, - 0xAC90, 0x7466, 0xAC91, 0x7467, 0xAC92, 0x7468, 0xAC93, 0x7469, - 0xAC94, 0x746A, 0xAC95, 0x746B, 0xAC96, 0x746C, 0xAC97, 0x746E, - 0xAC98, 0x746F, 0xAC99, 0x7471, 0xAC9A, 0x7472, 0xAC9B, 0x7473, - 0xAC9C, 0x7474, 0xAC9D, 0x7475, 0xAC9E, 0x7478, 0xAC9F, 0x7479, - 0xACA0, 0x747A, 0xAD40, 0x747B, 0xAD41, 0x747C, 0xAD42, 0x747D, - 0xAD43, 0x747F, 0xAD44, 0x7482, 0xAD45, 0x7484, 0xAD46, 0x7485, - 0xAD47, 0x7486, 0xAD48, 0x7488, 0xAD49, 0x7489, 0xAD4A, 0x748A, - 0xAD4B, 0x748C, 0xAD4C, 0x748D, 0xAD4D, 0x748F, 0xAD4E, 0x7491, - 0xAD4F, 0x7492, 0xAD50, 0x7493, 0xAD51, 0x7494, 0xAD52, 0x7495, - 0xAD53, 0x7496, 0xAD54, 0x7497, 0xAD55, 0x7498, 0xAD56, 0x7499, - 0xAD57, 0x749A, 0xAD58, 0x749B, 0xAD59, 0x749D, 0xAD5A, 0x749F, - 0xAD5B, 0x74A0, 0xAD5C, 0x74A1, 0xAD5D, 0x74A2, 0xAD5E, 0x74A3, - 0xAD5F, 0x74A4, 0xAD60, 0x74A5, 0xAD61, 0x74A6, 0xAD62, 0x74AA, - 0xAD63, 0x74AB, 0xAD64, 0x74AC, 0xAD65, 0x74AD, 0xAD66, 0x74AE, - 0xAD67, 0x74AF, 0xAD68, 0x74B0, 0xAD69, 0x74B1, 0xAD6A, 0x74B2, - 0xAD6B, 0x74B3, 0xAD6C, 0x74B4, 0xAD6D, 0x74B5, 0xAD6E, 0x74B6, - 0xAD6F, 0x74B7, 0xAD70, 0x74B8, 0xAD71, 0x74B9, 0xAD72, 0x74BB, - 0xAD73, 0x74BC, 0xAD74, 0x74BD, 0xAD75, 0x74BE, 0xAD76, 0x74BF, - 0xAD77, 0x74C0, 0xAD78, 0x74C1, 0xAD79, 0x74C2, 0xAD7A, 0x74C3, - 0xAD7B, 0x74C4, 0xAD7C, 0x74C5, 0xAD7D, 0x74C6, 0xAD7E, 0x74C7, - 0xAD80, 0x74C8, 0xAD81, 0x74C9, 0xAD82, 0x74CA, 0xAD83, 0x74CB, - 0xAD84, 0x74CC, 0xAD85, 0x74CD, 0xAD86, 0x74CE, 0xAD87, 0x74CF, - 0xAD88, 0x74D0, 0xAD89, 0x74D1, 0xAD8A, 0x74D3, 0xAD8B, 0x74D4, - 0xAD8C, 0x74D5, 0xAD8D, 0x74D6, 0xAD8E, 0x74D7, 0xAD8F, 0x74D8, - 0xAD90, 0x74D9, 0xAD91, 0x74DA, 0xAD92, 0x74DB, 0xAD93, 0x74DD, - 0xAD94, 0x74DF, 0xAD95, 0x74E1, 0xAD96, 0x74E5, 0xAD97, 0x74E7, - 0xAD98, 0x74E8, 0xAD99, 0x74E9, 0xAD9A, 0x74EA, 0xAD9B, 0x74EB, - 0xAD9C, 0x74EC, 0xAD9D, 0x74ED, 0xAD9E, 0x74F0, 0xAD9F, 0x74F1, - 0xADA0, 0x74F2, 0xAE40, 0x74F3, 0xAE41, 0x74F5, 0xAE42, 0x74F8, - 0xAE43, 0x74F9, 0xAE44, 0x74FA, 0xAE45, 0x74FB, 0xAE46, 0x74FC, - 0xAE47, 0x74FD, 0xAE48, 0x74FE, 0xAE49, 0x7500, 0xAE4A, 0x7501, - 0xAE4B, 0x7502, 0xAE4C, 0x7503, 0xAE4D, 0x7505, 0xAE4E, 0x7506, - 0xAE4F, 0x7507, 0xAE50, 0x7508, 0xAE51, 0x7509, 0xAE52, 0x750A, - 0xAE53, 0x750B, 0xAE54, 0x750C, 0xAE55, 0x750E, 0xAE56, 0x7510, - 0xAE57, 0x7512, 0xAE58, 0x7514, 0xAE59, 0x7515, 0xAE5A, 0x7516, - 0xAE5B, 0x7517, 0xAE5C, 0x751B, 0xAE5D, 0x751D, 0xAE5E, 0x751E, - 0xAE5F, 0x7520, 0xAE60, 0x7521, 0xAE61, 0x7522, 0xAE62, 0x7523, - 0xAE63, 0x7524, 0xAE64, 0x7526, 0xAE65, 0x7527, 0xAE66, 0x752A, - 0xAE67, 0x752E, 0xAE68, 0x7534, 0xAE69, 0x7536, 0xAE6A, 0x7539, - 0xAE6B, 0x753C, 0xAE6C, 0x753D, 0xAE6D, 0x753F, 0xAE6E, 0x7541, - 0xAE6F, 0x7542, 0xAE70, 0x7543, 0xAE71, 0x7544, 0xAE72, 0x7546, - 0xAE73, 0x7547, 0xAE74, 0x7549, 0xAE75, 0x754A, 0xAE76, 0x754D, - 0xAE77, 0x7550, 0xAE78, 0x7551, 0xAE79, 0x7552, 0xAE7A, 0x7553, - 0xAE7B, 0x7555, 0xAE7C, 0x7556, 0xAE7D, 0x7557, 0xAE7E, 0x7558, - 0xAE80, 0x755D, 0xAE81, 0x755E, 0xAE82, 0x755F, 0xAE83, 0x7560, - 0xAE84, 0x7561, 0xAE85, 0x7562, 0xAE86, 0x7563, 0xAE87, 0x7564, - 0xAE88, 0x7567, 0xAE89, 0x7568, 0xAE8A, 0x7569, 0xAE8B, 0x756B, - 0xAE8C, 0x756C, 0xAE8D, 0x756D, 0xAE8E, 0x756E, 0xAE8F, 0x756F, - 0xAE90, 0x7570, 0xAE91, 0x7571, 0xAE92, 0x7573, 0xAE93, 0x7575, - 0xAE94, 0x7576, 0xAE95, 0x7577, 0xAE96, 0x757A, 0xAE97, 0x757B, - 0xAE98, 0x757C, 0xAE99, 0x757D, 0xAE9A, 0x757E, 0xAE9B, 0x7580, - 0xAE9C, 0x7581, 0xAE9D, 0x7582, 0xAE9E, 0x7584, 0xAE9F, 0x7585, - 0xAEA0, 0x7587, 0xAF40, 0x7588, 0xAF41, 0x7589, 0xAF42, 0x758A, - 0xAF43, 0x758C, 0xAF44, 0x758D, 0xAF45, 0x758E, 0xAF46, 0x7590, - 0xAF47, 0x7593, 0xAF48, 0x7595, 0xAF49, 0x7598, 0xAF4A, 0x759B, - 0xAF4B, 0x759C, 0xAF4C, 0x759E, 0xAF4D, 0x75A2, 0xAF4E, 0x75A6, - 0xAF4F, 0x75A7, 0xAF50, 0x75A8, 0xAF51, 0x75A9, 0xAF52, 0x75AA, - 0xAF53, 0x75AD, 0xAF54, 0x75B6, 0xAF55, 0x75B7, 0xAF56, 0x75BA, - 0xAF57, 0x75BB, 0xAF58, 0x75BF, 0xAF59, 0x75C0, 0xAF5A, 0x75C1, - 0xAF5B, 0x75C6, 0xAF5C, 0x75CB, 0xAF5D, 0x75CC, 0xAF5E, 0x75CE, - 0xAF5F, 0x75CF, 0xAF60, 0x75D0, 0xAF61, 0x75D1, 0xAF62, 0x75D3, - 0xAF63, 0x75D7, 0xAF64, 0x75D9, 0xAF65, 0x75DA, 0xAF66, 0x75DC, - 0xAF67, 0x75DD, 0xAF68, 0x75DF, 0xAF69, 0x75E0, 0xAF6A, 0x75E1, - 0xAF6B, 0x75E5, 0xAF6C, 0x75E9, 0xAF6D, 0x75EC, 0xAF6E, 0x75ED, - 0xAF6F, 0x75EE, 0xAF70, 0x75EF, 0xAF71, 0x75F2, 0xAF72, 0x75F3, - 0xAF73, 0x75F5, 0xAF74, 0x75F6, 0xAF75, 0x75F7, 0xAF76, 0x75F8, - 0xAF77, 0x75FA, 0xAF78, 0x75FB, 0xAF79, 0x75FD, 0xAF7A, 0x75FE, - 0xAF7B, 0x7602, 0xAF7C, 0x7604, 0xAF7D, 0x7606, 0xAF7E, 0x7607, - 0xAF80, 0x7608, 0xAF81, 0x7609, 0xAF82, 0x760B, 0xAF83, 0x760D, - 0xAF84, 0x760E, 0xAF85, 0x760F, 0xAF86, 0x7611, 0xAF87, 0x7612, - 0xAF88, 0x7613, 0xAF89, 0x7614, 0xAF8A, 0x7616, 0xAF8B, 0x761A, - 0xAF8C, 0x761C, 0xAF8D, 0x761D, 0xAF8E, 0x761E, 0xAF8F, 0x7621, - 0xAF90, 0x7623, 0xAF91, 0x7627, 0xAF92, 0x7628, 0xAF93, 0x762C, - 0xAF94, 0x762E, 0xAF95, 0x762F, 0xAF96, 0x7631, 0xAF97, 0x7632, - 0xAF98, 0x7636, 0xAF99, 0x7637, 0xAF9A, 0x7639, 0xAF9B, 0x763A, - 0xAF9C, 0x763B, 0xAF9D, 0x763D, 0xAF9E, 0x7641, 0xAF9F, 0x7642, - 0xAFA0, 0x7644, 0xB040, 0x7645, 0xB041, 0x7646, 0xB042, 0x7647, - 0xB043, 0x7648, 0xB044, 0x7649, 0xB045, 0x764A, 0xB046, 0x764B, - 0xB047, 0x764E, 0xB048, 0x764F, 0xB049, 0x7650, 0xB04A, 0x7651, - 0xB04B, 0x7652, 0xB04C, 0x7653, 0xB04D, 0x7655, 0xB04E, 0x7657, - 0xB04F, 0x7658, 0xB050, 0x7659, 0xB051, 0x765A, 0xB052, 0x765B, - 0xB053, 0x765D, 0xB054, 0x765F, 0xB055, 0x7660, 0xB056, 0x7661, - 0xB057, 0x7662, 0xB058, 0x7664, 0xB059, 0x7665, 0xB05A, 0x7666, - 0xB05B, 0x7667, 0xB05C, 0x7668, 0xB05D, 0x7669, 0xB05E, 0x766A, - 0xB05F, 0x766C, 0xB060, 0x766D, 0xB061, 0x766E, 0xB062, 0x7670, - 0xB063, 0x7671, 0xB064, 0x7672, 0xB065, 0x7673, 0xB066, 0x7674, - 0xB067, 0x7675, 0xB068, 0x7676, 0xB069, 0x7677, 0xB06A, 0x7679, - 0xB06B, 0x767A, 0xB06C, 0x767C, 0xB06D, 0x767F, 0xB06E, 0x7680, - 0xB06F, 0x7681, 0xB070, 0x7683, 0xB071, 0x7685, 0xB072, 0x7689, - 0xB073, 0x768A, 0xB074, 0x768C, 0xB075, 0x768D, 0xB076, 0x768F, - 0xB077, 0x7690, 0xB078, 0x7692, 0xB079, 0x7694, 0xB07A, 0x7695, - 0xB07B, 0x7697, 0xB07C, 0x7698, 0xB07D, 0x769A, 0xB07E, 0x769B, - 0xB080, 0x769C, 0xB081, 0x769D, 0xB082, 0x769E, 0xB083, 0x769F, - 0xB084, 0x76A0, 0xB085, 0x76A1, 0xB086, 0x76A2, 0xB087, 0x76A3, - 0xB088, 0x76A5, 0xB089, 0x76A6, 0xB08A, 0x76A7, 0xB08B, 0x76A8, - 0xB08C, 0x76A9, 0xB08D, 0x76AA, 0xB08E, 0x76AB, 0xB08F, 0x76AC, - 0xB090, 0x76AD, 0xB091, 0x76AF, 0xB092, 0x76B0, 0xB093, 0x76B3, - 0xB094, 0x76B5, 0xB095, 0x76B6, 0xB096, 0x76B7, 0xB097, 0x76B8, - 0xB098, 0x76B9, 0xB099, 0x76BA, 0xB09A, 0x76BB, 0xB09B, 0x76BC, - 0xB09C, 0x76BD, 0xB09D, 0x76BE, 0xB09E, 0x76C0, 0xB09F, 0x76C1, - 0xB0A0, 0x76C3, 0xB0A1, 0x554A, 0xB0A2, 0x963F, 0xB0A3, 0x57C3, - 0xB0A4, 0x6328, 0xB0A5, 0x54CE, 0xB0A6, 0x5509, 0xB0A7, 0x54C0, - 0xB0A8, 0x7691, 0xB0A9, 0x764C, 0xB0AA, 0x853C, 0xB0AB, 0x77EE, - 0xB0AC, 0x827E, 0xB0AD, 0x788D, 0xB0AE, 0x7231, 0xB0AF, 0x9698, - 0xB0B0, 0x978D, 0xB0B1, 0x6C28, 0xB0B2, 0x5B89, 0xB0B3, 0x4FFA, - 0xB0B4, 0x6309, 0xB0B5, 0x6697, 0xB0B6, 0x5CB8, 0xB0B7, 0x80FA, - 0xB0B8, 0x6848, 0xB0B9, 0x80AE, 0xB0BA, 0x6602, 0xB0BB, 0x76CE, - 0xB0BC, 0x51F9, 0xB0BD, 0x6556, 0xB0BE, 0x71AC, 0xB0BF, 0x7FF1, - 0xB0C0, 0x8884, 0xB0C1, 0x50B2, 0xB0C2, 0x5965, 0xB0C3, 0x61CA, - 0xB0C4, 0x6FB3, 0xB0C5, 0x82AD, 0xB0C6, 0x634C, 0xB0C7, 0x6252, - 0xB0C8, 0x53ED, 0xB0C9, 0x5427, 0xB0CA, 0x7B06, 0xB0CB, 0x516B, - 0xB0CC, 0x75A4, 0xB0CD, 0x5DF4, 0xB0CE, 0x62D4, 0xB0CF, 0x8DCB, - 0xB0D0, 0x9776, 0xB0D1, 0x628A, 0xB0D2, 0x8019, 0xB0D3, 0x575D, - 0xB0D4, 0x9738, 0xB0D5, 0x7F62, 0xB0D6, 0x7238, 0xB0D7, 0x767D, - 0xB0D8, 0x67CF, 0xB0D9, 0x767E, 0xB0DA, 0x6446, 0xB0DB, 0x4F70, - 0xB0DC, 0x8D25, 0xB0DD, 0x62DC, 0xB0DE, 0x7A17, 0xB0DF, 0x6591, - 0xB0E0, 0x73ED, 0xB0E1, 0x642C, 0xB0E2, 0x6273, 0xB0E3, 0x822C, - 0xB0E4, 0x9881, 0xB0E5, 0x677F, 0xB0E6, 0x7248, 0xB0E7, 0x626E, - 0xB0E8, 0x62CC, 0xB0E9, 0x4F34, 0xB0EA, 0x74E3, 0xB0EB, 0x534A, - 0xB0EC, 0x529E, 0xB0ED, 0x7ECA, 0xB0EE, 0x90A6, 0xB0EF, 0x5E2E, - 0xB0F0, 0x6886, 0xB0F1, 0x699C, 0xB0F2, 0x8180, 0xB0F3, 0x7ED1, - 0xB0F4, 0x68D2, 0xB0F5, 0x78C5, 0xB0F6, 0x868C, 0xB0F7, 0x9551, - 0xB0F8, 0x508D, 0xB0F9, 0x8C24, 0xB0FA, 0x82DE, 0xB0FB, 0x80DE, - 0xB0FC, 0x5305, 0xB0FD, 0x8912, 0xB0FE, 0x5265, 0xB140, 0x76C4, - 0xB141, 0x76C7, 0xB142, 0x76C9, 0xB143, 0x76CB, 0xB144, 0x76CC, - 0xB145, 0x76D3, 0xB146, 0x76D5, 0xB147, 0x76D9, 0xB148, 0x76DA, - 0xB149, 0x76DC, 0xB14A, 0x76DD, 0xB14B, 0x76DE, 0xB14C, 0x76E0, - 0xB14D, 0x76E1, 0xB14E, 0x76E2, 0xB14F, 0x76E3, 0xB150, 0x76E4, - 0xB151, 0x76E6, 0xB152, 0x76E7, 0xB153, 0x76E8, 0xB154, 0x76E9, - 0xB155, 0x76EA, 0xB156, 0x76EB, 0xB157, 0x76EC, 0xB158, 0x76ED, - 0xB159, 0x76F0, 0xB15A, 0x76F3, 0xB15B, 0x76F5, 0xB15C, 0x76F6, - 0xB15D, 0x76F7, 0xB15E, 0x76FA, 0xB15F, 0x76FB, 0xB160, 0x76FD, - 0xB161, 0x76FF, 0xB162, 0x7700, 0xB163, 0x7702, 0xB164, 0x7703, - 0xB165, 0x7705, 0xB166, 0x7706, 0xB167, 0x770A, 0xB168, 0x770C, - 0xB169, 0x770E, 0xB16A, 0x770F, 0xB16B, 0x7710, 0xB16C, 0x7711, - 0xB16D, 0x7712, 0xB16E, 0x7713, 0xB16F, 0x7714, 0xB170, 0x7715, - 0xB171, 0x7716, 0xB172, 0x7717, 0xB173, 0x7718, 0xB174, 0x771B, - 0xB175, 0x771C, 0xB176, 0x771D, 0xB177, 0x771E, 0xB178, 0x7721, - 0xB179, 0x7723, 0xB17A, 0x7724, 0xB17B, 0x7725, 0xB17C, 0x7727, - 0xB17D, 0x772A, 0xB17E, 0x772B, 0xB180, 0x772C, 0xB181, 0x772E, - 0xB182, 0x7730, 0xB183, 0x7731, 0xB184, 0x7732, 0xB185, 0x7733, - 0xB186, 0x7734, 0xB187, 0x7739, 0xB188, 0x773B, 0xB189, 0x773D, - 0xB18A, 0x773E, 0xB18B, 0x773F, 0xB18C, 0x7742, 0xB18D, 0x7744, - 0xB18E, 0x7745, 0xB18F, 0x7746, 0xB190, 0x7748, 0xB191, 0x7749, - 0xB192, 0x774A, 0xB193, 0x774B, 0xB194, 0x774C, 0xB195, 0x774D, - 0xB196, 0x774E, 0xB197, 0x774F, 0xB198, 0x7752, 0xB199, 0x7753, - 0xB19A, 0x7754, 0xB19B, 0x7755, 0xB19C, 0x7756, 0xB19D, 0x7757, - 0xB19E, 0x7758, 0xB19F, 0x7759, 0xB1A0, 0x775C, 0xB1A1, 0x8584, - 0xB1A2, 0x96F9, 0xB1A3, 0x4FDD, 0xB1A4, 0x5821, 0xB1A5, 0x9971, - 0xB1A6, 0x5B9D, 0xB1A7, 0x62B1, 0xB1A8, 0x62A5, 0xB1A9, 0x66B4, - 0xB1AA, 0x8C79, 0xB1AB, 0x9C8D, 0xB1AC, 0x7206, 0xB1AD, 0x676F, - 0xB1AE, 0x7891, 0xB1AF, 0x60B2, 0xB1B0, 0x5351, 0xB1B1, 0x5317, - 0xB1B2, 0x8F88, 0xB1B3, 0x80CC, 0xB1B4, 0x8D1D, 0xB1B5, 0x94A1, - 0xB1B6, 0x500D, 0xB1B7, 0x72C8, 0xB1B8, 0x5907, 0xB1B9, 0x60EB, - 0xB1BA, 0x7119, 0xB1BB, 0x88AB, 0xB1BC, 0x5954, 0xB1BD, 0x82EF, - 0xB1BE, 0x672C, 0xB1BF, 0x7B28, 0xB1C0, 0x5D29, 0xB1C1, 0x7EF7, - 0xB1C2, 0x752D, 0xB1C3, 0x6CF5, 0xB1C4, 0x8E66, 0xB1C5, 0x8FF8, - 0xB1C6, 0x903C, 0xB1C7, 0x9F3B, 0xB1C8, 0x6BD4, 0xB1C9, 0x9119, - 0xB1CA, 0x7B14, 0xB1CB, 0x5F7C, 0xB1CC, 0x78A7, 0xB1CD, 0x84D6, - 0xB1CE, 0x853D, 0xB1CF, 0x6BD5, 0xB1D0, 0x6BD9, 0xB1D1, 0x6BD6, - 0xB1D2, 0x5E01, 0xB1D3, 0x5E87, 0xB1D4, 0x75F9, 0xB1D5, 0x95ED, - 0xB1D6, 0x655D, 0xB1D7, 0x5F0A, 0xB1D8, 0x5FC5, 0xB1D9, 0x8F9F, - 0xB1DA, 0x58C1, 0xB1DB, 0x81C2, 0xB1DC, 0x907F, 0xB1DD, 0x965B, - 0xB1DE, 0x97AD, 0xB1DF, 0x8FB9, 0xB1E0, 0x7F16, 0xB1E1, 0x8D2C, - 0xB1E2, 0x6241, 0xB1E3, 0x4FBF, 0xB1E4, 0x53D8, 0xB1E5, 0x535E, - 0xB1E6, 0x8FA8, 0xB1E7, 0x8FA9, 0xB1E8, 0x8FAB, 0xB1E9, 0x904D, - 0xB1EA, 0x6807, 0xB1EB, 0x5F6A, 0xB1EC, 0x8198, 0xB1ED, 0x8868, - 0xB1EE, 0x9CD6, 0xB1EF, 0x618B, 0xB1F0, 0x522B, 0xB1F1, 0x762A, - 0xB1F2, 0x5F6C, 0xB1F3, 0x658C, 0xB1F4, 0x6FD2, 0xB1F5, 0x6EE8, - 0xB1F6, 0x5BBE, 0xB1F7, 0x6448, 0xB1F8, 0x5175, 0xB1F9, 0x51B0, - 0xB1FA, 0x67C4, 0xB1FB, 0x4E19, 0xB1FC, 0x79C9, 0xB1FD, 0x997C, - 0xB1FE, 0x70B3, 0xB240, 0x775D, 0xB241, 0x775E, 0xB242, 0x775F, - 0xB243, 0x7760, 0xB244, 0x7764, 0xB245, 0x7767, 0xB246, 0x7769, - 0xB247, 0x776A, 0xB248, 0x776D, 0xB249, 0x776E, 0xB24A, 0x776F, - 0xB24B, 0x7770, 0xB24C, 0x7771, 0xB24D, 0x7772, 0xB24E, 0x7773, - 0xB24F, 0x7774, 0xB250, 0x7775, 0xB251, 0x7776, 0xB252, 0x7777, - 0xB253, 0x7778, 0xB254, 0x777A, 0xB255, 0x777B, 0xB256, 0x777C, - 0xB257, 0x7781, 0xB258, 0x7782, 0xB259, 0x7783, 0xB25A, 0x7786, - 0xB25B, 0x7787, 0xB25C, 0x7788, 0xB25D, 0x7789, 0xB25E, 0x778A, - 0xB25F, 0x778B, 0xB260, 0x778F, 0xB261, 0x7790, 0xB262, 0x7793, - 0xB263, 0x7794, 0xB264, 0x7795, 0xB265, 0x7796, 0xB266, 0x7797, - 0xB267, 0x7798, 0xB268, 0x7799, 0xB269, 0x779A, 0xB26A, 0x779B, - 0xB26B, 0x779C, 0xB26C, 0x779D, 0xB26D, 0x779E, 0xB26E, 0x77A1, - 0xB26F, 0x77A3, 0xB270, 0x77A4, 0xB271, 0x77A6, 0xB272, 0x77A8, - 0xB273, 0x77AB, 0xB274, 0x77AD, 0xB275, 0x77AE, 0xB276, 0x77AF, - 0xB277, 0x77B1, 0xB278, 0x77B2, 0xB279, 0x77B4, 0xB27A, 0x77B6, - 0xB27B, 0x77B7, 0xB27C, 0x77B8, 0xB27D, 0x77B9, 0xB27E, 0x77BA, - 0xB280, 0x77BC, 0xB281, 0x77BE, 0xB282, 0x77C0, 0xB283, 0x77C1, - 0xB284, 0x77C2, 0xB285, 0x77C3, 0xB286, 0x77C4, 0xB287, 0x77C5, - 0xB288, 0x77C6, 0xB289, 0x77C7, 0xB28A, 0x77C8, 0xB28B, 0x77C9, - 0xB28C, 0x77CA, 0xB28D, 0x77CB, 0xB28E, 0x77CC, 0xB28F, 0x77CE, - 0xB290, 0x77CF, 0xB291, 0x77D0, 0xB292, 0x77D1, 0xB293, 0x77D2, - 0xB294, 0x77D3, 0xB295, 0x77D4, 0xB296, 0x77D5, 0xB297, 0x77D6, - 0xB298, 0x77D8, 0xB299, 0x77D9, 0xB29A, 0x77DA, 0xB29B, 0x77DD, - 0xB29C, 0x77DE, 0xB29D, 0x77DF, 0xB29E, 0x77E0, 0xB29F, 0x77E1, - 0xB2A0, 0x77E4, 0xB2A1, 0x75C5, 0xB2A2, 0x5E76, 0xB2A3, 0x73BB, - 0xB2A4, 0x83E0, 0xB2A5, 0x64AD, 0xB2A6, 0x62E8, 0xB2A7, 0x94B5, - 0xB2A8, 0x6CE2, 0xB2A9, 0x535A, 0xB2AA, 0x52C3, 0xB2AB, 0x640F, - 0xB2AC, 0x94C2, 0xB2AD, 0x7B94, 0xB2AE, 0x4F2F, 0xB2AF, 0x5E1B, - 0xB2B0, 0x8236, 0xB2B1, 0x8116, 0xB2B2, 0x818A, 0xB2B3, 0x6E24, - 0xB2B4, 0x6CCA, 0xB2B5, 0x9A73, 0xB2B6, 0x6355, 0xB2B7, 0x535C, - 0xB2B8, 0x54FA, 0xB2B9, 0x8865, 0xB2BA, 0x57E0, 0xB2BB, 0x4E0D, - 0xB2BC, 0x5E03, 0xB2BD, 0x6B65, 0xB2BE, 0x7C3F, 0xB2BF, 0x90E8, - 0xB2C0, 0x6016, 0xB2C1, 0x64E6, 0xB2C2, 0x731C, 0xB2C3, 0x88C1, - 0xB2C4, 0x6750, 0xB2C5, 0x624D, 0xB2C6, 0x8D22, 0xB2C7, 0x776C, - 0xB2C8, 0x8E29, 0xB2C9, 0x91C7, 0xB2CA, 0x5F69, 0xB2CB, 0x83DC, - 0xB2CC, 0x8521, 0xB2CD, 0x9910, 0xB2CE, 0x53C2, 0xB2CF, 0x8695, - 0xB2D0, 0x6B8B, 0xB2D1, 0x60ED, 0xB2D2, 0x60E8, 0xB2D3, 0x707F, - 0xB2D4, 0x82CD, 0xB2D5, 0x8231, 0xB2D6, 0x4ED3, 0xB2D7, 0x6CA7, - 0xB2D8, 0x85CF, 0xB2D9, 0x64CD, 0xB2DA, 0x7CD9, 0xB2DB, 0x69FD, - 0xB2DC, 0x66F9, 0xB2DD, 0x8349, 0xB2DE, 0x5395, 0xB2DF, 0x7B56, - 0xB2E0, 0x4FA7, 0xB2E1, 0x518C, 0xB2E2, 0x6D4B, 0xB2E3, 0x5C42, - 0xB2E4, 0x8E6D, 0xB2E5, 0x63D2, 0xB2E6, 0x53C9, 0xB2E7, 0x832C, - 0xB2E8, 0x8336, 0xB2E9, 0x67E5, 0xB2EA, 0x78B4, 0xB2EB, 0x643D, - 0xB2EC, 0x5BDF, 0xB2ED, 0x5C94, 0xB2EE, 0x5DEE, 0xB2EF, 0x8BE7, - 0xB2F0, 0x62C6, 0xB2F1, 0x67F4, 0xB2F2, 0x8C7A, 0xB2F3, 0x6400, - 0xB2F4, 0x63BA, 0xB2F5, 0x8749, 0xB2F6, 0x998B, 0xB2F7, 0x8C17, - 0xB2F8, 0x7F20, 0xB2F9, 0x94F2, 0xB2FA, 0x4EA7, 0xB2FB, 0x9610, - 0xB2FC, 0x98A4, 0xB2FD, 0x660C, 0xB2FE, 0x7316, 0xB340, 0x77E6, - 0xB341, 0x77E8, 0xB342, 0x77EA, 0xB343, 0x77EF, 0xB344, 0x77F0, - 0xB345, 0x77F1, 0xB346, 0x77F2, 0xB347, 0x77F4, 0xB348, 0x77F5, - 0xB349, 0x77F7, 0xB34A, 0x77F9, 0xB34B, 0x77FA, 0xB34C, 0x77FB, - 0xB34D, 0x77FC, 0xB34E, 0x7803, 0xB34F, 0x7804, 0xB350, 0x7805, - 0xB351, 0x7806, 0xB352, 0x7807, 0xB353, 0x7808, 0xB354, 0x780A, - 0xB355, 0x780B, 0xB356, 0x780E, 0xB357, 0x780F, 0xB358, 0x7810, - 0xB359, 0x7813, 0xB35A, 0x7815, 0xB35B, 0x7819, 0xB35C, 0x781B, - 0xB35D, 0x781E, 0xB35E, 0x7820, 0xB35F, 0x7821, 0xB360, 0x7822, - 0xB361, 0x7824, 0xB362, 0x7828, 0xB363, 0x782A, 0xB364, 0x782B, - 0xB365, 0x782E, 0xB366, 0x782F, 0xB367, 0x7831, 0xB368, 0x7832, - 0xB369, 0x7833, 0xB36A, 0x7835, 0xB36B, 0x7836, 0xB36C, 0x783D, - 0xB36D, 0x783F, 0xB36E, 0x7841, 0xB36F, 0x7842, 0xB370, 0x7843, - 0xB371, 0x7844, 0xB372, 0x7846, 0xB373, 0x7848, 0xB374, 0x7849, - 0xB375, 0x784A, 0xB376, 0x784B, 0xB377, 0x784D, 0xB378, 0x784F, - 0xB379, 0x7851, 0xB37A, 0x7853, 0xB37B, 0x7854, 0xB37C, 0x7858, - 0xB37D, 0x7859, 0xB37E, 0x785A, 0xB380, 0x785B, 0xB381, 0x785C, - 0xB382, 0x785E, 0xB383, 0x785F, 0xB384, 0x7860, 0xB385, 0x7861, - 0xB386, 0x7862, 0xB387, 0x7863, 0xB388, 0x7864, 0xB389, 0x7865, - 0xB38A, 0x7866, 0xB38B, 0x7867, 0xB38C, 0x7868, 0xB38D, 0x7869, - 0xB38E, 0x786F, 0xB38F, 0x7870, 0xB390, 0x7871, 0xB391, 0x7872, - 0xB392, 0x7873, 0xB393, 0x7874, 0xB394, 0x7875, 0xB395, 0x7876, - 0xB396, 0x7878, 0xB397, 0x7879, 0xB398, 0x787A, 0xB399, 0x787B, - 0xB39A, 0x787D, 0xB39B, 0x787E, 0xB39C, 0x787F, 0xB39D, 0x7880, - 0xB39E, 0x7881, 0xB39F, 0x7882, 0xB3A0, 0x7883, 0xB3A1, 0x573A, - 0xB3A2, 0x5C1D, 0xB3A3, 0x5E38, 0xB3A4, 0x957F, 0xB3A5, 0x507F, - 0xB3A6, 0x80A0, 0xB3A7, 0x5382, 0xB3A8, 0x655E, 0xB3A9, 0x7545, - 0xB3AA, 0x5531, 0xB3AB, 0x5021, 0xB3AC, 0x8D85, 0xB3AD, 0x6284, - 0xB3AE, 0x949E, 0xB3AF, 0x671D, 0xB3B0, 0x5632, 0xB3B1, 0x6F6E, - 0xB3B2, 0x5DE2, 0xB3B3, 0x5435, 0xB3B4, 0x7092, 0xB3B5, 0x8F66, - 0xB3B6, 0x626F, 0xB3B7, 0x64A4, 0xB3B8, 0x63A3, 0xB3B9, 0x5F7B, - 0xB3BA, 0x6F88, 0xB3BB, 0x90F4, 0xB3BC, 0x81E3, 0xB3BD, 0x8FB0, - 0xB3BE, 0x5C18, 0xB3BF, 0x6668, 0xB3C0, 0x5FF1, 0xB3C1, 0x6C89, - 0xB3C2, 0x9648, 0xB3C3, 0x8D81, 0xB3C4, 0x886C, 0xB3C5, 0x6491, - 0xB3C6, 0x79F0, 0xB3C7, 0x57CE, 0xB3C8, 0x6A59, 0xB3C9, 0x6210, - 0xB3CA, 0x5448, 0xB3CB, 0x4E58, 0xB3CC, 0x7A0B, 0xB3CD, 0x60E9, - 0xB3CE, 0x6F84, 0xB3CF, 0x8BDA, 0xB3D0, 0x627F, 0xB3D1, 0x901E, - 0xB3D2, 0x9A8B, 0xB3D3, 0x79E4, 0xB3D4, 0x5403, 0xB3D5, 0x75F4, - 0xB3D6, 0x6301, 0xB3D7, 0x5319, 0xB3D8, 0x6C60, 0xB3D9, 0x8FDF, - 0xB3DA, 0x5F1B, 0xB3DB, 0x9A70, 0xB3DC, 0x803B, 0xB3DD, 0x9F7F, - 0xB3DE, 0x4F88, 0xB3DF, 0x5C3A, 0xB3E0, 0x8D64, 0xB3E1, 0x7FC5, - 0xB3E2, 0x65A5, 0xB3E3, 0x70BD, 0xB3E4, 0x5145, 0xB3E5, 0x51B2, - 0xB3E6, 0x866B, 0xB3E7, 0x5D07, 0xB3E8, 0x5BA0, 0xB3E9, 0x62BD, - 0xB3EA, 0x916C, 0xB3EB, 0x7574, 0xB3EC, 0x8E0C, 0xB3ED, 0x7A20, - 0xB3EE, 0x6101, 0xB3EF, 0x7B79, 0xB3F0, 0x4EC7, 0xB3F1, 0x7EF8, - 0xB3F2, 0x7785, 0xB3F3, 0x4E11, 0xB3F4, 0x81ED, 0xB3F5, 0x521D, - 0xB3F6, 0x51FA, 0xB3F7, 0x6A71, 0xB3F8, 0x53A8, 0xB3F9, 0x8E87, - 0xB3FA, 0x9504, 0xB3FB, 0x96CF, 0xB3FC, 0x6EC1, 0xB3FD, 0x9664, - 0xB3FE, 0x695A, 0xB440, 0x7884, 0xB441, 0x7885, 0xB442, 0x7886, - 0xB443, 0x7888, 0xB444, 0x788A, 0xB445, 0x788B, 0xB446, 0x788F, - 0xB447, 0x7890, 0xB448, 0x7892, 0xB449, 0x7894, 0xB44A, 0x7895, - 0xB44B, 0x7896, 0xB44C, 0x7899, 0xB44D, 0x789D, 0xB44E, 0x789E, - 0xB44F, 0x78A0, 0xB450, 0x78A2, 0xB451, 0x78A4, 0xB452, 0x78A6, - 0xB453, 0x78A8, 0xB454, 0x78A9, 0xB455, 0x78AA, 0xB456, 0x78AB, - 0xB457, 0x78AC, 0xB458, 0x78AD, 0xB459, 0x78AE, 0xB45A, 0x78AF, - 0xB45B, 0x78B5, 0xB45C, 0x78B6, 0xB45D, 0x78B7, 0xB45E, 0x78B8, - 0xB45F, 0x78BA, 0xB460, 0x78BB, 0xB461, 0x78BC, 0xB462, 0x78BD, - 0xB463, 0x78BF, 0xB464, 0x78C0, 0xB465, 0x78C2, 0xB466, 0x78C3, - 0xB467, 0x78C4, 0xB468, 0x78C6, 0xB469, 0x78C7, 0xB46A, 0x78C8, - 0xB46B, 0x78CC, 0xB46C, 0x78CD, 0xB46D, 0x78CE, 0xB46E, 0x78CF, - 0xB46F, 0x78D1, 0xB470, 0x78D2, 0xB471, 0x78D3, 0xB472, 0x78D6, - 0xB473, 0x78D7, 0xB474, 0x78D8, 0xB475, 0x78DA, 0xB476, 0x78DB, - 0xB477, 0x78DC, 0xB478, 0x78DD, 0xB479, 0x78DE, 0xB47A, 0x78DF, - 0xB47B, 0x78E0, 0xB47C, 0x78E1, 0xB47D, 0x78E2, 0xB47E, 0x78E3, - 0xB480, 0x78E4, 0xB481, 0x78E5, 0xB482, 0x78E6, 0xB483, 0x78E7, - 0xB484, 0x78E9, 0xB485, 0x78EA, 0xB486, 0x78EB, 0xB487, 0x78ED, - 0xB488, 0x78EE, 0xB489, 0x78EF, 0xB48A, 0x78F0, 0xB48B, 0x78F1, - 0xB48C, 0x78F3, 0xB48D, 0x78F5, 0xB48E, 0x78F6, 0xB48F, 0x78F8, - 0xB490, 0x78F9, 0xB491, 0x78FB, 0xB492, 0x78FC, 0xB493, 0x78FD, - 0xB494, 0x78FE, 0xB495, 0x78FF, 0xB496, 0x7900, 0xB497, 0x7902, - 0xB498, 0x7903, 0xB499, 0x7904, 0xB49A, 0x7906, 0xB49B, 0x7907, - 0xB49C, 0x7908, 0xB49D, 0x7909, 0xB49E, 0x790A, 0xB49F, 0x790B, - 0xB4A0, 0x790C, 0xB4A1, 0x7840, 0xB4A2, 0x50A8, 0xB4A3, 0x77D7, - 0xB4A4, 0x6410, 0xB4A5, 0x89E6, 0xB4A6, 0x5904, 0xB4A7, 0x63E3, - 0xB4A8, 0x5DDD, 0xB4A9, 0x7A7F, 0xB4AA, 0x693D, 0xB4AB, 0x4F20, - 0xB4AC, 0x8239, 0xB4AD, 0x5598, 0xB4AE, 0x4E32, 0xB4AF, 0x75AE, - 0xB4B0, 0x7A97, 0xB4B1, 0x5E62, 0xB4B2, 0x5E8A, 0xB4B3, 0x95EF, - 0xB4B4, 0x521B, 0xB4B5, 0x5439, 0xB4B6, 0x708A, 0xB4B7, 0x6376, - 0xB4B8, 0x9524, 0xB4B9, 0x5782, 0xB4BA, 0x6625, 0xB4BB, 0x693F, - 0xB4BC, 0x9187, 0xB4BD, 0x5507, 0xB4BE, 0x6DF3, 0xB4BF, 0x7EAF, - 0xB4C0, 0x8822, 0xB4C1, 0x6233, 0xB4C2, 0x7EF0, 0xB4C3, 0x75B5, - 0xB4C4, 0x8328, 0xB4C5, 0x78C1, 0xB4C6, 0x96CC, 0xB4C7, 0x8F9E, - 0xB4C8, 0x6148, 0xB4C9, 0x74F7, 0xB4CA, 0x8BCD, 0xB4CB, 0x6B64, - 0xB4CC, 0x523A, 0xB4CD, 0x8D50, 0xB4CE, 0x6B21, 0xB4CF, 0x806A, - 0xB4D0, 0x8471, 0xB4D1, 0x56F1, 0xB4D2, 0x5306, 0xB4D3, 0x4ECE, - 0xB4D4, 0x4E1B, 0xB4D5, 0x51D1, 0xB4D6, 0x7C97, 0xB4D7, 0x918B, - 0xB4D8, 0x7C07, 0xB4D9, 0x4FC3, 0xB4DA, 0x8E7F, 0xB4DB, 0x7BE1, - 0xB4DC, 0x7A9C, 0xB4DD, 0x6467, 0xB4DE, 0x5D14, 0xB4DF, 0x50AC, - 0xB4E0, 0x8106, 0xB4E1, 0x7601, 0xB4E2, 0x7CB9, 0xB4E3, 0x6DEC, - 0xB4E4, 0x7FE0, 0xB4E5, 0x6751, 0xB4E6, 0x5B58, 0xB4E7, 0x5BF8, - 0xB4E8, 0x78CB, 0xB4E9, 0x64AE, 0xB4EA, 0x6413, 0xB4EB, 0x63AA, - 0xB4EC, 0x632B, 0xB4ED, 0x9519, 0xB4EE, 0x642D, 0xB4EF, 0x8FBE, - 0xB4F0, 0x7B54, 0xB4F1, 0x7629, 0xB4F2, 0x6253, 0xB4F3, 0x5927, - 0xB4F4, 0x5446, 0xB4F5, 0x6B79, 0xB4F6, 0x50A3, 0xB4F7, 0x6234, - 0xB4F8, 0x5E26, 0xB4F9, 0x6B86, 0xB4FA, 0x4EE3, 0xB4FB, 0x8D37, - 0xB4FC, 0x888B, 0xB4FD, 0x5F85, 0xB4FE, 0x902E, 0xB540, 0x790D, - 0xB541, 0x790E, 0xB542, 0x790F, 0xB543, 0x7910, 0xB544, 0x7911, - 0xB545, 0x7912, 0xB546, 0x7914, 0xB547, 0x7915, 0xB548, 0x7916, - 0xB549, 0x7917, 0xB54A, 0x7918, 0xB54B, 0x7919, 0xB54C, 0x791A, - 0xB54D, 0x791B, 0xB54E, 0x791C, 0xB54F, 0x791D, 0xB550, 0x791F, - 0xB551, 0x7920, 0xB552, 0x7921, 0xB553, 0x7922, 0xB554, 0x7923, - 0xB555, 0x7925, 0xB556, 0x7926, 0xB557, 0x7927, 0xB558, 0x7928, - 0xB559, 0x7929, 0xB55A, 0x792A, 0xB55B, 0x792B, 0xB55C, 0x792C, - 0xB55D, 0x792D, 0xB55E, 0x792E, 0xB55F, 0x792F, 0xB560, 0x7930, - 0xB561, 0x7931, 0xB562, 0x7932, 0xB563, 0x7933, 0xB564, 0x7935, - 0xB565, 0x7936, 0xB566, 0x7937, 0xB567, 0x7938, 0xB568, 0x7939, - 0xB569, 0x793D, 0xB56A, 0x793F, 0xB56B, 0x7942, 0xB56C, 0x7943, - 0xB56D, 0x7944, 0xB56E, 0x7945, 0xB56F, 0x7947, 0xB570, 0x794A, - 0xB571, 0x794B, 0xB572, 0x794C, 0xB573, 0x794D, 0xB574, 0x794E, - 0xB575, 0x794F, 0xB576, 0x7950, 0xB577, 0x7951, 0xB578, 0x7952, - 0xB579, 0x7954, 0xB57A, 0x7955, 0xB57B, 0x7958, 0xB57C, 0x7959, - 0xB57D, 0x7961, 0xB57E, 0x7963, 0xB580, 0x7964, 0xB581, 0x7966, - 0xB582, 0x7969, 0xB583, 0x796A, 0xB584, 0x796B, 0xB585, 0x796C, - 0xB586, 0x796E, 0xB587, 0x7970, 0xB588, 0x7971, 0xB589, 0x7972, - 0xB58A, 0x7973, 0xB58B, 0x7974, 0xB58C, 0x7975, 0xB58D, 0x7976, - 0xB58E, 0x7979, 0xB58F, 0x797B, 0xB590, 0x797C, 0xB591, 0x797D, - 0xB592, 0x797E, 0xB593, 0x797F, 0xB594, 0x7982, 0xB595, 0x7983, - 0xB596, 0x7986, 0xB597, 0x7987, 0xB598, 0x7988, 0xB599, 0x7989, - 0xB59A, 0x798B, 0xB59B, 0x798C, 0xB59C, 0x798D, 0xB59D, 0x798E, - 0xB59E, 0x7990, 0xB59F, 0x7991, 0xB5A0, 0x7992, 0xB5A1, 0x6020, - 0xB5A2, 0x803D, 0xB5A3, 0x62C5, 0xB5A4, 0x4E39, 0xB5A5, 0x5355, - 0xB5A6, 0x90F8, 0xB5A7, 0x63B8, 0xB5A8, 0x80C6, 0xB5A9, 0x65E6, - 0xB5AA, 0x6C2E, 0xB5AB, 0x4F46, 0xB5AC, 0x60EE, 0xB5AD, 0x6DE1, - 0xB5AE, 0x8BDE, 0xB5AF, 0x5F39, 0xB5B0, 0x86CB, 0xB5B1, 0x5F53, - 0xB5B2, 0x6321, 0xB5B3, 0x515A, 0xB5B4, 0x8361, 0xB5B5, 0x6863, - 0xB5B6, 0x5200, 0xB5B7, 0x6363, 0xB5B8, 0x8E48, 0xB5B9, 0x5012, - 0xB5BA, 0x5C9B, 0xB5BB, 0x7977, 0xB5BC, 0x5BFC, 0xB5BD, 0x5230, - 0xB5BE, 0x7A3B, 0xB5BF, 0x60BC, 0xB5C0, 0x9053, 0xB5C1, 0x76D7, - 0xB5C2, 0x5FB7, 0xB5C3, 0x5F97, 0xB5C4, 0x7684, 0xB5C5, 0x8E6C, - 0xB5C6, 0x706F, 0xB5C7, 0x767B, 0xB5C8, 0x7B49, 0xB5C9, 0x77AA, - 0xB5CA, 0x51F3, 0xB5CB, 0x9093, 0xB5CC, 0x5824, 0xB5CD, 0x4F4E, - 0xB5CE, 0x6EF4, 0xB5CF, 0x8FEA, 0xB5D0, 0x654C, 0xB5D1, 0x7B1B, - 0xB5D2, 0x72C4, 0xB5D3, 0x6DA4, 0xB5D4, 0x7FDF, 0xB5D5, 0x5AE1, - 0xB5D6, 0x62B5, 0xB5D7, 0x5E95, 0xB5D8, 0x5730, 0xB5D9, 0x8482, - 0xB5DA, 0x7B2C, 0xB5DB, 0x5E1D, 0xB5DC, 0x5F1F, 0xB5DD, 0x9012, - 0xB5DE, 0x7F14, 0xB5DF, 0x98A0, 0xB5E0, 0x6382, 0xB5E1, 0x6EC7, - 0xB5E2, 0x7898, 0xB5E3, 0x70B9, 0xB5E4, 0x5178, 0xB5E5, 0x975B, - 0xB5E6, 0x57AB, 0xB5E7, 0x7535, 0xB5E8, 0x4F43, 0xB5E9, 0x7538, - 0xB5EA, 0x5E97, 0xB5EB, 0x60E6, 0xB5EC, 0x5960, 0xB5ED, 0x6DC0, - 0xB5EE, 0x6BBF, 0xB5EF, 0x7889, 0xB5F0, 0x53FC, 0xB5F1, 0x96D5, - 0xB5F2, 0x51CB, 0xB5F3, 0x5201, 0xB5F4, 0x6389, 0xB5F5, 0x540A, - 0xB5F6, 0x9493, 0xB5F7, 0x8C03, 0xB5F8, 0x8DCC, 0xB5F9, 0x7239, - 0xB5FA, 0x789F, 0xB5FB, 0x8776, 0xB5FC, 0x8FED, 0xB5FD, 0x8C0D, - 0xB5FE, 0x53E0, 0xB640, 0x7993, 0xB641, 0x7994, 0xB642, 0x7995, - 0xB643, 0x7996, 0xB644, 0x7997, 0xB645, 0x7998, 0xB646, 0x7999, - 0xB647, 0x799B, 0xB648, 0x799C, 0xB649, 0x799D, 0xB64A, 0x799E, - 0xB64B, 0x799F, 0xB64C, 0x79A0, 0xB64D, 0x79A1, 0xB64E, 0x79A2, - 0xB64F, 0x79A3, 0xB650, 0x79A4, 0xB651, 0x79A5, 0xB652, 0x79A6, - 0xB653, 0x79A8, 0xB654, 0x79A9, 0xB655, 0x79AA, 0xB656, 0x79AB, - 0xB657, 0x79AC, 0xB658, 0x79AD, 0xB659, 0x79AE, 0xB65A, 0x79AF, - 0xB65B, 0x79B0, 0xB65C, 0x79B1, 0xB65D, 0x79B2, 0xB65E, 0x79B4, - 0xB65F, 0x79B5, 0xB660, 0x79B6, 0xB661, 0x79B7, 0xB662, 0x79B8, - 0xB663, 0x79BC, 0xB664, 0x79BF, 0xB665, 0x79C2, 0xB666, 0x79C4, - 0xB667, 0x79C5, 0xB668, 0x79C7, 0xB669, 0x79C8, 0xB66A, 0x79CA, - 0xB66B, 0x79CC, 0xB66C, 0x79CE, 0xB66D, 0x79CF, 0xB66E, 0x79D0, - 0xB66F, 0x79D3, 0xB670, 0x79D4, 0xB671, 0x79D6, 0xB672, 0x79D7, - 0xB673, 0x79D9, 0xB674, 0x79DA, 0xB675, 0x79DB, 0xB676, 0x79DC, - 0xB677, 0x79DD, 0xB678, 0x79DE, 0xB679, 0x79E0, 0xB67A, 0x79E1, - 0xB67B, 0x79E2, 0xB67C, 0x79E5, 0xB67D, 0x79E8, 0xB67E, 0x79EA, - 0xB680, 0x79EC, 0xB681, 0x79EE, 0xB682, 0x79F1, 0xB683, 0x79F2, - 0xB684, 0x79F3, 0xB685, 0x79F4, 0xB686, 0x79F5, 0xB687, 0x79F6, - 0xB688, 0x79F7, 0xB689, 0x79F9, 0xB68A, 0x79FA, 0xB68B, 0x79FC, - 0xB68C, 0x79FE, 0xB68D, 0x79FF, 0xB68E, 0x7A01, 0xB68F, 0x7A04, - 0xB690, 0x7A05, 0xB691, 0x7A07, 0xB692, 0x7A08, 0xB693, 0x7A09, - 0xB694, 0x7A0A, 0xB695, 0x7A0C, 0xB696, 0x7A0F, 0xB697, 0x7A10, - 0xB698, 0x7A11, 0xB699, 0x7A12, 0xB69A, 0x7A13, 0xB69B, 0x7A15, - 0xB69C, 0x7A16, 0xB69D, 0x7A18, 0xB69E, 0x7A19, 0xB69F, 0x7A1B, - 0xB6A0, 0x7A1C, 0xB6A1, 0x4E01, 0xB6A2, 0x76EF, 0xB6A3, 0x53EE, - 0xB6A4, 0x9489, 0xB6A5, 0x9876, 0xB6A6, 0x9F0E, 0xB6A7, 0x952D, - 0xB6A8, 0x5B9A, 0xB6A9, 0x8BA2, 0xB6AA, 0x4E22, 0xB6AB, 0x4E1C, - 0xB6AC, 0x51AC, 0xB6AD, 0x8463, 0xB6AE, 0x61C2, 0xB6AF, 0x52A8, - 0xB6B0, 0x680B, 0xB6B1, 0x4F97, 0xB6B2, 0x606B, 0xB6B3, 0x51BB, - 0xB6B4, 0x6D1E, 0xB6B5, 0x515C, 0xB6B6, 0x6296, 0xB6B7, 0x6597, - 0xB6B8, 0x9661, 0xB6B9, 0x8C46, 0xB6BA, 0x9017, 0xB6BB, 0x75D8, - 0xB6BC, 0x90FD, 0xB6BD, 0x7763, 0xB6BE, 0x6BD2, 0xB6BF, 0x728A, - 0xB6C0, 0x72EC, 0xB6C1, 0x8BFB, 0xB6C2, 0x5835, 0xB6C3, 0x7779, - 0xB6C4, 0x8D4C, 0xB6C5, 0x675C, 0xB6C6, 0x9540, 0xB6C7, 0x809A, - 0xB6C8, 0x5EA6, 0xB6C9, 0x6E21, 0xB6CA, 0x5992, 0xB6CB, 0x7AEF, - 0xB6CC, 0x77ED, 0xB6CD, 0x953B, 0xB6CE, 0x6BB5, 0xB6CF, 0x65AD, - 0xB6D0, 0x7F0E, 0xB6D1, 0x5806, 0xB6D2, 0x5151, 0xB6D3, 0x961F, - 0xB6D4, 0x5BF9, 0xB6D5, 0x58A9, 0xB6D6, 0x5428, 0xB6D7, 0x8E72, - 0xB6D8, 0x6566, 0xB6D9, 0x987F, 0xB6DA, 0x56E4, 0xB6DB, 0x949D, - 0xB6DC, 0x76FE, 0xB6DD, 0x9041, 0xB6DE, 0x6387, 0xB6DF, 0x54C6, - 0xB6E0, 0x591A, 0xB6E1, 0x593A, 0xB6E2, 0x579B, 0xB6E3, 0x8EB2, - 0xB6E4, 0x6735, 0xB6E5, 0x8DFA, 0xB6E6, 0x8235, 0xB6E7, 0x5241, - 0xB6E8, 0x60F0, 0xB6E9, 0x5815, 0xB6EA, 0x86FE, 0xB6EB, 0x5CE8, - 0xB6EC, 0x9E45, 0xB6ED, 0x4FC4, 0xB6EE, 0x989D, 0xB6EF, 0x8BB9, - 0xB6F0, 0x5A25, 0xB6F1, 0x6076, 0xB6F2, 0x5384, 0xB6F3, 0x627C, - 0xB6F4, 0x904F, 0xB6F5, 0x9102, 0xB6F6, 0x997F, 0xB6F7, 0x6069, - 0xB6F8, 0x800C, 0xB6F9, 0x513F, 0xB6FA, 0x8033, 0xB6FB, 0x5C14, - 0xB6FC, 0x9975, 0xB6FD, 0x6D31, 0xB6FE, 0x4E8C, 0xB740, 0x7A1D, - 0xB741, 0x7A1F, 0xB742, 0x7A21, 0xB743, 0x7A22, 0xB744, 0x7A24, - 0xB745, 0x7A25, 0xB746, 0x7A26, 0xB747, 0x7A27, 0xB748, 0x7A28, - 0xB749, 0x7A29, 0xB74A, 0x7A2A, 0xB74B, 0x7A2B, 0xB74C, 0x7A2C, - 0xB74D, 0x7A2D, 0xB74E, 0x7A2E, 0xB74F, 0x7A2F, 0xB750, 0x7A30, - 0xB751, 0x7A31, 0xB752, 0x7A32, 0xB753, 0x7A34, 0xB754, 0x7A35, - 0xB755, 0x7A36, 0xB756, 0x7A38, 0xB757, 0x7A3A, 0xB758, 0x7A3E, - 0xB759, 0x7A40, 0xB75A, 0x7A41, 0xB75B, 0x7A42, 0xB75C, 0x7A43, - 0xB75D, 0x7A44, 0xB75E, 0x7A45, 0xB75F, 0x7A47, 0xB760, 0x7A48, - 0xB761, 0x7A49, 0xB762, 0x7A4A, 0xB763, 0x7A4B, 0xB764, 0x7A4C, - 0xB765, 0x7A4D, 0xB766, 0x7A4E, 0xB767, 0x7A4F, 0xB768, 0x7A50, - 0xB769, 0x7A52, 0xB76A, 0x7A53, 0xB76B, 0x7A54, 0xB76C, 0x7A55, - 0xB76D, 0x7A56, 0xB76E, 0x7A58, 0xB76F, 0x7A59, 0xB770, 0x7A5A, - 0xB771, 0x7A5B, 0xB772, 0x7A5C, 0xB773, 0x7A5D, 0xB774, 0x7A5E, - 0xB775, 0x7A5F, 0xB776, 0x7A60, 0xB777, 0x7A61, 0xB778, 0x7A62, - 0xB779, 0x7A63, 0xB77A, 0x7A64, 0xB77B, 0x7A65, 0xB77C, 0x7A66, - 0xB77D, 0x7A67, 0xB77E, 0x7A68, 0xB780, 0x7A69, 0xB781, 0x7A6A, - 0xB782, 0x7A6B, 0xB783, 0x7A6C, 0xB784, 0x7A6D, 0xB785, 0x7A6E, - 0xB786, 0x7A6F, 0xB787, 0x7A71, 0xB788, 0x7A72, 0xB789, 0x7A73, - 0xB78A, 0x7A75, 0xB78B, 0x7A7B, 0xB78C, 0x7A7C, 0xB78D, 0x7A7D, - 0xB78E, 0x7A7E, 0xB78F, 0x7A82, 0xB790, 0x7A85, 0xB791, 0x7A87, - 0xB792, 0x7A89, 0xB793, 0x7A8A, 0xB794, 0x7A8B, 0xB795, 0x7A8C, - 0xB796, 0x7A8E, 0xB797, 0x7A8F, 0xB798, 0x7A90, 0xB799, 0x7A93, - 0xB79A, 0x7A94, 0xB79B, 0x7A99, 0xB79C, 0x7A9A, 0xB79D, 0x7A9B, - 0xB79E, 0x7A9E, 0xB79F, 0x7AA1, 0xB7A0, 0x7AA2, 0xB7A1, 0x8D30, - 0xB7A2, 0x53D1, 0xB7A3, 0x7F5A, 0xB7A4, 0x7B4F, 0xB7A5, 0x4F10, - 0xB7A6, 0x4E4F, 0xB7A7, 0x9600, 0xB7A8, 0x6CD5, 0xB7A9, 0x73D0, - 0xB7AA, 0x85E9, 0xB7AB, 0x5E06, 0xB7AC, 0x756A, 0xB7AD, 0x7FFB, - 0xB7AE, 0x6A0A, 0xB7AF, 0x77FE, 0xB7B0, 0x9492, 0xB7B1, 0x7E41, - 0xB7B2, 0x51E1, 0xB7B3, 0x70E6, 0xB7B4, 0x53CD, 0xB7B5, 0x8FD4, - 0xB7B6, 0x8303, 0xB7B7, 0x8D29, 0xB7B8, 0x72AF, 0xB7B9, 0x996D, - 0xB7BA, 0x6CDB, 0xB7BB, 0x574A, 0xB7BC, 0x82B3, 0xB7BD, 0x65B9, - 0xB7BE, 0x80AA, 0xB7BF, 0x623F, 0xB7C0, 0x9632, 0xB7C1, 0x59A8, - 0xB7C2, 0x4EFF, 0xB7C3, 0x8BBF, 0xB7C4, 0x7EBA, 0xB7C5, 0x653E, - 0xB7C6, 0x83F2, 0xB7C7, 0x975E, 0xB7C8, 0x5561, 0xB7C9, 0x98DE, - 0xB7CA, 0x80A5, 0xB7CB, 0x532A, 0xB7CC, 0x8BFD, 0xB7CD, 0x5420, - 0xB7CE, 0x80BA, 0xB7CF, 0x5E9F, 0xB7D0, 0x6CB8, 0xB7D1, 0x8D39, - 0xB7D2, 0x82AC, 0xB7D3, 0x915A, 0xB7D4, 0x5429, 0xB7D5, 0x6C1B, - 0xB7D6, 0x5206, 0xB7D7, 0x7EB7, 0xB7D8, 0x575F, 0xB7D9, 0x711A, - 0xB7DA, 0x6C7E, 0xB7DB, 0x7C89, 0xB7DC, 0x594B, 0xB7DD, 0x4EFD, - 0xB7DE, 0x5FFF, 0xB7DF, 0x6124, 0xB7E0, 0x7CAA, 0xB7E1, 0x4E30, - 0xB7E2, 0x5C01, 0xB7E3, 0x67AB, 0xB7E4, 0x8702, 0xB7E5, 0x5CF0, - 0xB7E6, 0x950B, 0xB7E7, 0x98CE, 0xB7E8, 0x75AF, 0xB7E9, 0x70FD, - 0xB7EA, 0x9022, 0xB7EB, 0x51AF, 0xB7EC, 0x7F1D, 0xB7ED, 0x8BBD, - 0xB7EE, 0x5949, 0xB7EF, 0x51E4, 0xB7F0, 0x4F5B, 0xB7F1, 0x5426, - 0xB7F2, 0x592B, 0xB7F3, 0x6577, 0xB7F4, 0x80A4, 0xB7F5, 0x5B75, - 0xB7F6, 0x6276, 0xB7F7, 0x62C2, 0xB7F8, 0x8F90, 0xB7F9, 0x5E45, - 0xB7FA, 0x6C1F, 0xB7FB, 0x7B26, 0xB7FC, 0x4F0F, 0xB7FD, 0x4FD8, - 0xB7FE, 0x670D, 0xB840, 0x7AA3, 0xB841, 0x7AA4, 0xB842, 0x7AA7, - 0xB843, 0x7AA9, 0xB844, 0x7AAA, 0xB845, 0x7AAB, 0xB846, 0x7AAE, - 0xB847, 0x7AAF, 0xB848, 0x7AB0, 0xB849, 0x7AB1, 0xB84A, 0x7AB2, - 0xB84B, 0x7AB4, 0xB84C, 0x7AB5, 0xB84D, 0x7AB6, 0xB84E, 0x7AB7, - 0xB84F, 0x7AB8, 0xB850, 0x7AB9, 0xB851, 0x7ABA, 0xB852, 0x7ABB, - 0xB853, 0x7ABC, 0xB854, 0x7ABD, 0xB855, 0x7ABE, 0xB856, 0x7AC0, - 0xB857, 0x7AC1, 0xB858, 0x7AC2, 0xB859, 0x7AC3, 0xB85A, 0x7AC4, - 0xB85B, 0x7AC5, 0xB85C, 0x7AC6, 0xB85D, 0x7AC7, 0xB85E, 0x7AC8, - 0xB85F, 0x7AC9, 0xB860, 0x7ACA, 0xB861, 0x7ACC, 0xB862, 0x7ACD, - 0xB863, 0x7ACE, 0xB864, 0x7ACF, 0xB865, 0x7AD0, 0xB866, 0x7AD1, - 0xB867, 0x7AD2, 0xB868, 0x7AD3, 0xB869, 0x7AD4, 0xB86A, 0x7AD5, - 0xB86B, 0x7AD7, 0xB86C, 0x7AD8, 0xB86D, 0x7ADA, 0xB86E, 0x7ADB, - 0xB86F, 0x7ADC, 0xB870, 0x7ADD, 0xB871, 0x7AE1, 0xB872, 0x7AE2, - 0xB873, 0x7AE4, 0xB874, 0x7AE7, 0xB875, 0x7AE8, 0xB876, 0x7AE9, - 0xB877, 0x7AEA, 0xB878, 0x7AEB, 0xB879, 0x7AEC, 0xB87A, 0x7AEE, - 0xB87B, 0x7AF0, 0xB87C, 0x7AF1, 0xB87D, 0x7AF2, 0xB87E, 0x7AF3, - 0xB880, 0x7AF4, 0xB881, 0x7AF5, 0xB882, 0x7AF6, 0xB883, 0x7AF7, - 0xB884, 0x7AF8, 0xB885, 0x7AFB, 0xB886, 0x7AFC, 0xB887, 0x7AFE, - 0xB888, 0x7B00, 0xB889, 0x7B01, 0xB88A, 0x7B02, 0xB88B, 0x7B05, - 0xB88C, 0x7B07, 0xB88D, 0x7B09, 0xB88E, 0x7B0C, 0xB88F, 0x7B0D, - 0xB890, 0x7B0E, 0xB891, 0x7B10, 0xB892, 0x7B12, 0xB893, 0x7B13, - 0xB894, 0x7B16, 0xB895, 0x7B17, 0xB896, 0x7B18, 0xB897, 0x7B1A, - 0xB898, 0x7B1C, 0xB899, 0x7B1D, 0xB89A, 0x7B1F, 0xB89B, 0x7B21, - 0xB89C, 0x7B22, 0xB89D, 0x7B23, 0xB89E, 0x7B27, 0xB89F, 0x7B29, - 0xB8A0, 0x7B2D, 0xB8A1, 0x6D6E, 0xB8A2, 0x6DAA, 0xB8A3, 0x798F, - 0xB8A4, 0x88B1, 0xB8A5, 0x5F17, 0xB8A6, 0x752B, 0xB8A7, 0x629A, - 0xB8A8, 0x8F85, 0xB8A9, 0x4FEF, 0xB8AA, 0x91DC, 0xB8AB, 0x65A7, - 0xB8AC, 0x812F, 0xB8AD, 0x8151, 0xB8AE, 0x5E9C, 0xB8AF, 0x8150, - 0xB8B0, 0x8D74, 0xB8B1, 0x526F, 0xB8B2, 0x8986, 0xB8B3, 0x8D4B, - 0xB8B4, 0x590D, 0xB8B5, 0x5085, 0xB8B6, 0x4ED8, 0xB8B7, 0x961C, - 0xB8B8, 0x7236, 0xB8B9, 0x8179, 0xB8BA, 0x8D1F, 0xB8BB, 0x5BCC, - 0xB8BC, 0x8BA3, 0xB8BD, 0x9644, 0xB8BE, 0x5987, 0xB8BF, 0x7F1A, - 0xB8C0, 0x5490, 0xB8C1, 0x5676, 0xB8C2, 0x560E, 0xB8C3, 0x8BE5, - 0xB8C4, 0x6539, 0xB8C5, 0x6982, 0xB8C6, 0x9499, 0xB8C7, 0x76D6, - 0xB8C8, 0x6E89, 0xB8C9, 0x5E72, 0xB8CA, 0x7518, 0xB8CB, 0x6746, - 0xB8CC, 0x67D1, 0xB8CD, 0x7AFF, 0xB8CE, 0x809D, 0xB8CF, 0x8D76, - 0xB8D0, 0x611F, 0xB8D1, 0x79C6, 0xB8D2, 0x6562, 0xB8D3, 0x8D63, - 0xB8D4, 0x5188, 0xB8D5, 0x521A, 0xB8D6, 0x94A2, 0xB8D7, 0x7F38, - 0xB8D8, 0x809B, 0xB8D9, 0x7EB2, 0xB8DA, 0x5C97, 0xB8DB, 0x6E2F, - 0xB8DC, 0x6760, 0xB8DD, 0x7BD9, 0xB8DE, 0x768B, 0xB8DF, 0x9AD8, - 0xB8E0, 0x818F, 0xB8E1, 0x7F94, 0xB8E2, 0x7CD5, 0xB8E3, 0x641E, - 0xB8E4, 0x9550, 0xB8E5, 0x7A3F, 0xB8E6, 0x544A, 0xB8E7, 0x54E5, - 0xB8E8, 0x6B4C, 0xB8E9, 0x6401, 0xB8EA, 0x6208, 0xB8EB, 0x9E3D, - 0xB8EC, 0x80F3, 0xB8ED, 0x7599, 0xB8EE, 0x5272, 0xB8EF, 0x9769, - 0xB8F0, 0x845B, 0xB8F1, 0x683C, 0xB8F2, 0x86E4, 0xB8F3, 0x9601, - 0xB8F4, 0x9694, 0xB8F5, 0x94EC, 0xB8F6, 0x4E2A, 0xB8F7, 0x5404, - 0xB8F8, 0x7ED9, 0xB8F9, 0x6839, 0xB8FA, 0x8DDF, 0xB8FB, 0x8015, - 0xB8FC, 0x66F4, 0xB8FD, 0x5E9A, 0xB8FE, 0x7FB9, 0xB940, 0x7B2F, - 0xB941, 0x7B30, 0xB942, 0x7B32, 0xB943, 0x7B34, 0xB944, 0x7B35, - 0xB945, 0x7B36, 0xB946, 0x7B37, 0xB947, 0x7B39, 0xB948, 0x7B3B, - 0xB949, 0x7B3D, 0xB94A, 0x7B3F, 0xB94B, 0x7B40, 0xB94C, 0x7B41, - 0xB94D, 0x7B42, 0xB94E, 0x7B43, 0xB94F, 0x7B44, 0xB950, 0x7B46, - 0xB951, 0x7B48, 0xB952, 0x7B4A, 0xB953, 0x7B4D, 0xB954, 0x7B4E, - 0xB955, 0x7B53, 0xB956, 0x7B55, 0xB957, 0x7B57, 0xB958, 0x7B59, - 0xB959, 0x7B5C, 0xB95A, 0x7B5E, 0xB95B, 0x7B5F, 0xB95C, 0x7B61, - 0xB95D, 0x7B63, 0xB95E, 0x7B64, 0xB95F, 0x7B65, 0xB960, 0x7B66, - 0xB961, 0x7B67, 0xB962, 0x7B68, 0xB963, 0x7B69, 0xB964, 0x7B6A, - 0xB965, 0x7B6B, 0xB966, 0x7B6C, 0xB967, 0x7B6D, 0xB968, 0x7B6F, - 0xB969, 0x7B70, 0xB96A, 0x7B73, 0xB96B, 0x7B74, 0xB96C, 0x7B76, - 0xB96D, 0x7B78, 0xB96E, 0x7B7A, 0xB96F, 0x7B7C, 0xB970, 0x7B7D, - 0xB971, 0x7B7F, 0xB972, 0x7B81, 0xB973, 0x7B82, 0xB974, 0x7B83, - 0xB975, 0x7B84, 0xB976, 0x7B86, 0xB977, 0x7B87, 0xB978, 0x7B88, - 0xB979, 0x7B89, 0xB97A, 0x7B8A, 0xB97B, 0x7B8B, 0xB97C, 0x7B8C, - 0xB97D, 0x7B8E, 0xB97E, 0x7B8F, 0xB980, 0x7B91, 0xB981, 0x7B92, - 0xB982, 0x7B93, 0xB983, 0x7B96, 0xB984, 0x7B98, 0xB985, 0x7B99, - 0xB986, 0x7B9A, 0xB987, 0x7B9B, 0xB988, 0x7B9E, 0xB989, 0x7B9F, - 0xB98A, 0x7BA0, 0xB98B, 0x7BA3, 0xB98C, 0x7BA4, 0xB98D, 0x7BA5, - 0xB98E, 0x7BAE, 0xB98F, 0x7BAF, 0xB990, 0x7BB0, 0xB991, 0x7BB2, - 0xB992, 0x7BB3, 0xB993, 0x7BB5, 0xB994, 0x7BB6, 0xB995, 0x7BB7, - 0xB996, 0x7BB9, 0xB997, 0x7BBA, 0xB998, 0x7BBB, 0xB999, 0x7BBC, - 0xB99A, 0x7BBD, 0xB99B, 0x7BBE, 0xB99C, 0x7BBF, 0xB99D, 0x7BC0, - 0xB99E, 0x7BC2, 0xB99F, 0x7BC3, 0xB9A0, 0x7BC4, 0xB9A1, 0x57C2, - 0xB9A2, 0x803F, 0xB9A3, 0x6897, 0xB9A4, 0x5DE5, 0xB9A5, 0x653B, - 0xB9A6, 0x529F, 0xB9A7, 0x606D, 0xB9A8, 0x9F9A, 0xB9A9, 0x4F9B, - 0xB9AA, 0x8EAC, 0xB9AB, 0x516C, 0xB9AC, 0x5BAB, 0xB9AD, 0x5F13, - 0xB9AE, 0x5DE9, 0xB9AF, 0x6C5E, 0xB9B0, 0x62F1, 0xB9B1, 0x8D21, - 0xB9B2, 0x5171, 0xB9B3, 0x94A9, 0xB9B4, 0x52FE, 0xB9B5, 0x6C9F, - 0xB9B6, 0x82DF, 0xB9B7, 0x72D7, 0xB9B8, 0x57A2, 0xB9B9, 0x6784, - 0xB9BA, 0x8D2D, 0xB9BB, 0x591F, 0xB9BC, 0x8F9C, 0xB9BD, 0x83C7, - 0xB9BE, 0x5495, 0xB9BF, 0x7B8D, 0xB9C0, 0x4F30, 0xB9C1, 0x6CBD, - 0xB9C2, 0x5B64, 0xB9C3, 0x59D1, 0xB9C4, 0x9F13, 0xB9C5, 0x53E4, - 0xB9C6, 0x86CA, 0xB9C7, 0x9AA8, 0xB9C8, 0x8C37, 0xB9C9, 0x80A1, - 0xB9CA, 0x6545, 0xB9CB, 0x987E, 0xB9CC, 0x56FA, 0xB9CD, 0x96C7, - 0xB9CE, 0x522E, 0xB9CF, 0x74DC, 0xB9D0, 0x5250, 0xB9D1, 0x5BE1, - 0xB9D2, 0x6302, 0xB9D3, 0x8902, 0xB9D4, 0x4E56, 0xB9D5, 0x62D0, - 0xB9D6, 0x602A, 0xB9D7, 0x68FA, 0xB9D8, 0x5173, 0xB9D9, 0x5B98, - 0xB9DA, 0x51A0, 0xB9DB, 0x89C2, 0xB9DC, 0x7BA1, 0xB9DD, 0x9986, - 0xB9DE, 0x7F50, 0xB9DF, 0x60EF, 0xB9E0, 0x704C, 0xB9E1, 0x8D2F, - 0xB9E2, 0x5149, 0xB9E3, 0x5E7F, 0xB9E4, 0x901B, 0xB9E5, 0x7470, - 0xB9E6, 0x89C4, 0xB9E7, 0x572D, 0xB9E8, 0x7845, 0xB9E9, 0x5F52, - 0xB9EA, 0x9F9F, 0xB9EB, 0x95FA, 0xB9EC, 0x8F68, 0xB9ED, 0x9B3C, - 0xB9EE, 0x8BE1, 0xB9EF, 0x7678, 0xB9F0, 0x6842, 0xB9F1, 0x67DC, - 0xB9F2, 0x8DEA, 0xB9F3, 0x8D35, 0xB9F4, 0x523D, 0xB9F5, 0x8F8A, - 0xB9F6, 0x6EDA, 0xB9F7, 0x68CD, 0xB9F8, 0x9505, 0xB9F9, 0x90ED, - 0xB9FA, 0x56FD, 0xB9FB, 0x679C, 0xB9FC, 0x88F9, 0xB9FD, 0x8FC7, - 0xB9FE, 0x54C8, 0xBA40, 0x7BC5, 0xBA41, 0x7BC8, 0xBA42, 0x7BC9, - 0xBA43, 0x7BCA, 0xBA44, 0x7BCB, 0xBA45, 0x7BCD, 0xBA46, 0x7BCE, - 0xBA47, 0x7BCF, 0xBA48, 0x7BD0, 0xBA49, 0x7BD2, 0xBA4A, 0x7BD4, - 0xBA4B, 0x7BD5, 0xBA4C, 0x7BD6, 0xBA4D, 0x7BD7, 0xBA4E, 0x7BD8, - 0xBA4F, 0x7BDB, 0xBA50, 0x7BDC, 0xBA51, 0x7BDE, 0xBA52, 0x7BDF, - 0xBA53, 0x7BE0, 0xBA54, 0x7BE2, 0xBA55, 0x7BE3, 0xBA56, 0x7BE4, - 0xBA57, 0x7BE7, 0xBA58, 0x7BE8, 0xBA59, 0x7BE9, 0xBA5A, 0x7BEB, - 0xBA5B, 0x7BEC, 0xBA5C, 0x7BED, 0xBA5D, 0x7BEF, 0xBA5E, 0x7BF0, - 0xBA5F, 0x7BF2, 0xBA60, 0x7BF3, 0xBA61, 0x7BF4, 0xBA62, 0x7BF5, - 0xBA63, 0x7BF6, 0xBA64, 0x7BF8, 0xBA65, 0x7BF9, 0xBA66, 0x7BFA, - 0xBA67, 0x7BFB, 0xBA68, 0x7BFD, 0xBA69, 0x7BFF, 0xBA6A, 0x7C00, - 0xBA6B, 0x7C01, 0xBA6C, 0x7C02, 0xBA6D, 0x7C03, 0xBA6E, 0x7C04, - 0xBA6F, 0x7C05, 0xBA70, 0x7C06, 0xBA71, 0x7C08, 0xBA72, 0x7C09, - 0xBA73, 0x7C0A, 0xBA74, 0x7C0D, 0xBA75, 0x7C0E, 0xBA76, 0x7C10, - 0xBA77, 0x7C11, 0xBA78, 0x7C12, 0xBA79, 0x7C13, 0xBA7A, 0x7C14, - 0xBA7B, 0x7C15, 0xBA7C, 0x7C17, 0xBA7D, 0x7C18, 0xBA7E, 0x7C19, - 0xBA80, 0x7C1A, 0xBA81, 0x7C1B, 0xBA82, 0x7C1C, 0xBA83, 0x7C1D, - 0xBA84, 0x7C1E, 0xBA85, 0x7C20, 0xBA86, 0x7C21, 0xBA87, 0x7C22, - 0xBA88, 0x7C23, 0xBA89, 0x7C24, 0xBA8A, 0x7C25, 0xBA8B, 0x7C28, - 0xBA8C, 0x7C29, 0xBA8D, 0x7C2B, 0xBA8E, 0x7C2C, 0xBA8F, 0x7C2D, - 0xBA90, 0x7C2E, 0xBA91, 0x7C2F, 0xBA92, 0x7C30, 0xBA93, 0x7C31, - 0xBA94, 0x7C32, 0xBA95, 0x7C33, 0xBA96, 0x7C34, 0xBA97, 0x7C35, - 0xBA98, 0x7C36, 0xBA99, 0x7C37, 0xBA9A, 0x7C39, 0xBA9B, 0x7C3A, - 0xBA9C, 0x7C3B, 0xBA9D, 0x7C3C, 0xBA9E, 0x7C3D, 0xBA9F, 0x7C3E, - 0xBAA0, 0x7C42, 0xBAA1, 0x9AB8, 0xBAA2, 0x5B69, 0xBAA3, 0x6D77, - 0xBAA4, 0x6C26, 0xBAA5, 0x4EA5, 0xBAA6, 0x5BB3, 0xBAA7, 0x9A87, - 0xBAA8, 0x9163, 0xBAA9, 0x61A8, 0xBAAA, 0x90AF, 0xBAAB, 0x97E9, - 0xBAAC, 0x542B, 0xBAAD, 0x6DB5, 0xBAAE, 0x5BD2, 0xBAAF, 0x51FD, - 0xBAB0, 0x558A, 0xBAB1, 0x7F55, 0xBAB2, 0x7FF0, 0xBAB3, 0x64BC, - 0xBAB4, 0x634D, 0xBAB5, 0x65F1, 0xBAB6, 0x61BE, 0xBAB7, 0x608D, - 0xBAB8, 0x710A, 0xBAB9, 0x6C57, 0xBABA, 0x6C49, 0xBABB, 0x592F, - 0xBABC, 0x676D, 0xBABD, 0x822A, 0xBABE, 0x58D5, 0xBABF, 0x568E, - 0xBAC0, 0x8C6A, 0xBAC1, 0x6BEB, 0xBAC2, 0x90DD, 0xBAC3, 0x597D, - 0xBAC4, 0x8017, 0xBAC5, 0x53F7, 0xBAC6, 0x6D69, 0xBAC7, 0x5475, - 0xBAC8, 0x559D, 0xBAC9, 0x8377, 0xBACA, 0x83CF, 0xBACB, 0x6838, - 0xBACC, 0x79BE, 0xBACD, 0x548C, 0xBACE, 0x4F55, 0xBACF, 0x5408, - 0xBAD0, 0x76D2, 0xBAD1, 0x8C89, 0xBAD2, 0x9602, 0xBAD3, 0x6CB3, - 0xBAD4, 0x6DB8, 0xBAD5, 0x8D6B, 0xBAD6, 0x8910, 0xBAD7, 0x9E64, - 0xBAD8, 0x8D3A, 0xBAD9, 0x563F, 0xBADA, 0x9ED1, 0xBADB, 0x75D5, - 0xBADC, 0x5F88, 0xBADD, 0x72E0, 0xBADE, 0x6068, 0xBADF, 0x54FC, - 0xBAE0, 0x4EA8, 0xBAE1, 0x6A2A, 0xBAE2, 0x8861, 0xBAE3, 0x6052, - 0xBAE4, 0x8F70, 0xBAE5, 0x54C4, 0xBAE6, 0x70D8, 0xBAE7, 0x8679, - 0xBAE8, 0x9E3F, 0xBAE9, 0x6D2A, 0xBAEA, 0x5B8F, 0xBAEB, 0x5F18, - 0xBAEC, 0x7EA2, 0xBAED, 0x5589, 0xBAEE, 0x4FAF, 0xBAEF, 0x7334, - 0xBAF0, 0x543C, 0xBAF1, 0x539A, 0xBAF2, 0x5019, 0xBAF3, 0x540E, - 0xBAF4, 0x547C, 0xBAF5, 0x4E4E, 0xBAF6, 0x5FFD, 0xBAF7, 0x745A, - 0xBAF8, 0x58F6, 0xBAF9, 0x846B, 0xBAFA, 0x80E1, 0xBAFB, 0x8774, - 0xBAFC, 0x72D0, 0xBAFD, 0x7CCA, 0xBAFE, 0x6E56, 0xBB40, 0x7C43, - 0xBB41, 0x7C44, 0xBB42, 0x7C45, 0xBB43, 0x7C46, 0xBB44, 0x7C47, - 0xBB45, 0x7C48, 0xBB46, 0x7C49, 0xBB47, 0x7C4A, 0xBB48, 0x7C4B, - 0xBB49, 0x7C4C, 0xBB4A, 0x7C4E, 0xBB4B, 0x7C4F, 0xBB4C, 0x7C50, - 0xBB4D, 0x7C51, 0xBB4E, 0x7C52, 0xBB4F, 0x7C53, 0xBB50, 0x7C54, - 0xBB51, 0x7C55, 0xBB52, 0x7C56, 0xBB53, 0x7C57, 0xBB54, 0x7C58, - 0xBB55, 0x7C59, 0xBB56, 0x7C5A, 0xBB57, 0x7C5B, 0xBB58, 0x7C5C, - 0xBB59, 0x7C5D, 0xBB5A, 0x7C5E, 0xBB5B, 0x7C5F, 0xBB5C, 0x7C60, - 0xBB5D, 0x7C61, 0xBB5E, 0x7C62, 0xBB5F, 0x7C63, 0xBB60, 0x7C64, - 0xBB61, 0x7C65, 0xBB62, 0x7C66, 0xBB63, 0x7C67, 0xBB64, 0x7C68, - 0xBB65, 0x7C69, 0xBB66, 0x7C6A, 0xBB67, 0x7C6B, 0xBB68, 0x7C6C, - 0xBB69, 0x7C6D, 0xBB6A, 0x7C6E, 0xBB6B, 0x7C6F, 0xBB6C, 0x7C70, - 0xBB6D, 0x7C71, 0xBB6E, 0x7C72, 0xBB6F, 0x7C75, 0xBB70, 0x7C76, - 0xBB71, 0x7C77, 0xBB72, 0x7C78, 0xBB73, 0x7C79, 0xBB74, 0x7C7A, - 0xBB75, 0x7C7E, 0xBB76, 0x7C7F, 0xBB77, 0x7C80, 0xBB78, 0x7C81, - 0xBB79, 0x7C82, 0xBB7A, 0x7C83, 0xBB7B, 0x7C84, 0xBB7C, 0x7C85, - 0xBB7D, 0x7C86, 0xBB7E, 0x7C87, 0xBB80, 0x7C88, 0xBB81, 0x7C8A, - 0xBB82, 0x7C8B, 0xBB83, 0x7C8C, 0xBB84, 0x7C8D, 0xBB85, 0x7C8E, - 0xBB86, 0x7C8F, 0xBB87, 0x7C90, 0xBB88, 0x7C93, 0xBB89, 0x7C94, - 0xBB8A, 0x7C96, 0xBB8B, 0x7C99, 0xBB8C, 0x7C9A, 0xBB8D, 0x7C9B, - 0xBB8E, 0x7CA0, 0xBB8F, 0x7CA1, 0xBB90, 0x7CA3, 0xBB91, 0x7CA6, - 0xBB92, 0x7CA7, 0xBB93, 0x7CA8, 0xBB94, 0x7CA9, 0xBB95, 0x7CAB, - 0xBB96, 0x7CAC, 0xBB97, 0x7CAD, 0xBB98, 0x7CAF, 0xBB99, 0x7CB0, - 0xBB9A, 0x7CB4, 0xBB9B, 0x7CB5, 0xBB9C, 0x7CB6, 0xBB9D, 0x7CB7, - 0xBB9E, 0x7CB8, 0xBB9F, 0x7CBA, 0xBBA0, 0x7CBB, 0xBBA1, 0x5F27, - 0xBBA2, 0x864E, 0xBBA3, 0x552C, 0xBBA4, 0x62A4, 0xBBA5, 0x4E92, - 0xBBA6, 0x6CAA, 0xBBA7, 0x6237, 0xBBA8, 0x82B1, 0xBBA9, 0x54D7, - 0xBBAA, 0x534E, 0xBBAB, 0x733E, 0xBBAC, 0x6ED1, 0xBBAD, 0x753B, - 0xBBAE, 0x5212, 0xBBAF, 0x5316, 0xBBB0, 0x8BDD, 0xBBB1, 0x69D0, - 0xBBB2, 0x5F8A, 0xBBB3, 0x6000, 0xBBB4, 0x6DEE, 0xBBB5, 0x574F, - 0xBBB6, 0x6B22, 0xBBB7, 0x73AF, 0xBBB8, 0x6853, 0xBBB9, 0x8FD8, - 0xBBBA, 0x7F13, 0xBBBB, 0x6362, 0xBBBC, 0x60A3, 0xBBBD, 0x5524, - 0xBBBE, 0x75EA, 0xBBBF, 0x8C62, 0xBBC0, 0x7115, 0xBBC1, 0x6DA3, - 0xBBC2, 0x5BA6, 0xBBC3, 0x5E7B, 0xBBC4, 0x8352, 0xBBC5, 0x614C, - 0xBBC6, 0x9EC4, 0xBBC7, 0x78FA, 0xBBC8, 0x8757, 0xBBC9, 0x7C27, - 0xBBCA, 0x7687, 0xBBCB, 0x51F0, 0xBBCC, 0x60F6, 0xBBCD, 0x714C, - 0xBBCE, 0x6643, 0xBBCF, 0x5E4C, 0xBBD0, 0x604D, 0xBBD1, 0x8C0E, - 0xBBD2, 0x7070, 0xBBD3, 0x6325, 0xBBD4, 0x8F89, 0xBBD5, 0x5FBD, - 0xBBD6, 0x6062, 0xBBD7, 0x86D4, 0xBBD8, 0x56DE, 0xBBD9, 0x6BC1, - 0xBBDA, 0x6094, 0xBBDB, 0x6167, 0xBBDC, 0x5349, 0xBBDD, 0x60E0, - 0xBBDE, 0x6666, 0xBBDF, 0x8D3F, 0xBBE0, 0x79FD, 0xBBE1, 0x4F1A, - 0xBBE2, 0x70E9, 0xBBE3, 0x6C47, 0xBBE4, 0x8BB3, 0xBBE5, 0x8BF2, - 0xBBE6, 0x7ED8, 0xBBE7, 0x8364, 0xBBE8, 0x660F, 0xBBE9, 0x5A5A, - 0xBBEA, 0x9B42, 0xBBEB, 0x6D51, 0xBBEC, 0x6DF7, 0xBBED, 0x8C41, - 0xBBEE, 0x6D3B, 0xBBEF, 0x4F19, 0xBBF0, 0x706B, 0xBBF1, 0x83B7, - 0xBBF2, 0x6216, 0xBBF3, 0x60D1, 0xBBF4, 0x970D, 0xBBF5, 0x8D27, - 0xBBF6, 0x7978, 0xBBF7, 0x51FB, 0xBBF8, 0x573E, 0xBBF9, 0x57FA, - 0xBBFA, 0x673A, 0xBBFB, 0x7578, 0xBBFC, 0x7A3D, 0xBBFD, 0x79EF, - 0xBBFE, 0x7B95, 0xBC40, 0x7CBF, 0xBC41, 0x7CC0, 0xBC42, 0x7CC2, - 0xBC43, 0x7CC3, 0xBC44, 0x7CC4, 0xBC45, 0x7CC6, 0xBC46, 0x7CC9, - 0xBC47, 0x7CCB, 0xBC48, 0x7CCE, 0xBC49, 0x7CCF, 0xBC4A, 0x7CD0, - 0xBC4B, 0x7CD1, 0xBC4C, 0x7CD2, 0xBC4D, 0x7CD3, 0xBC4E, 0x7CD4, - 0xBC4F, 0x7CD8, 0xBC50, 0x7CDA, 0xBC51, 0x7CDB, 0xBC52, 0x7CDD, - 0xBC53, 0x7CDE, 0xBC54, 0x7CE1, 0xBC55, 0x7CE2, 0xBC56, 0x7CE3, - 0xBC57, 0x7CE4, 0xBC58, 0x7CE5, 0xBC59, 0x7CE6, 0xBC5A, 0x7CE7, - 0xBC5B, 0x7CE9, 0xBC5C, 0x7CEA, 0xBC5D, 0x7CEB, 0xBC5E, 0x7CEC, - 0xBC5F, 0x7CED, 0xBC60, 0x7CEE, 0xBC61, 0x7CF0, 0xBC62, 0x7CF1, - 0xBC63, 0x7CF2, 0xBC64, 0x7CF3, 0xBC65, 0x7CF4, 0xBC66, 0x7CF5, - 0xBC67, 0x7CF6, 0xBC68, 0x7CF7, 0xBC69, 0x7CF9, 0xBC6A, 0x7CFA, - 0xBC6B, 0x7CFC, 0xBC6C, 0x7CFD, 0xBC6D, 0x7CFE, 0xBC6E, 0x7CFF, - 0xBC6F, 0x7D00, 0xBC70, 0x7D01, 0xBC71, 0x7D02, 0xBC72, 0x7D03, - 0xBC73, 0x7D04, 0xBC74, 0x7D05, 0xBC75, 0x7D06, 0xBC76, 0x7D07, - 0xBC77, 0x7D08, 0xBC78, 0x7D09, 0xBC79, 0x7D0B, 0xBC7A, 0x7D0C, - 0xBC7B, 0x7D0D, 0xBC7C, 0x7D0E, 0xBC7D, 0x7D0F, 0xBC7E, 0x7D10, - 0xBC80, 0x7D11, 0xBC81, 0x7D12, 0xBC82, 0x7D13, 0xBC83, 0x7D14, - 0xBC84, 0x7D15, 0xBC85, 0x7D16, 0xBC86, 0x7D17, 0xBC87, 0x7D18, - 0xBC88, 0x7D19, 0xBC89, 0x7D1A, 0xBC8A, 0x7D1B, 0xBC8B, 0x7D1C, - 0xBC8C, 0x7D1D, 0xBC8D, 0x7D1E, 0xBC8E, 0x7D1F, 0xBC8F, 0x7D21, - 0xBC90, 0x7D23, 0xBC91, 0x7D24, 0xBC92, 0x7D25, 0xBC93, 0x7D26, - 0xBC94, 0x7D28, 0xBC95, 0x7D29, 0xBC96, 0x7D2A, 0xBC97, 0x7D2C, - 0xBC98, 0x7D2D, 0xBC99, 0x7D2E, 0xBC9A, 0x7D30, 0xBC9B, 0x7D31, - 0xBC9C, 0x7D32, 0xBC9D, 0x7D33, 0xBC9E, 0x7D34, 0xBC9F, 0x7D35, - 0xBCA0, 0x7D36, 0xBCA1, 0x808C, 0xBCA2, 0x9965, 0xBCA3, 0x8FF9, - 0xBCA4, 0x6FC0, 0xBCA5, 0x8BA5, 0xBCA6, 0x9E21, 0xBCA7, 0x59EC, - 0xBCA8, 0x7EE9, 0xBCA9, 0x7F09, 0xBCAA, 0x5409, 0xBCAB, 0x6781, - 0xBCAC, 0x68D8, 0xBCAD, 0x8F91, 0xBCAE, 0x7C4D, 0xBCAF, 0x96C6, - 0xBCB0, 0x53CA, 0xBCB1, 0x6025, 0xBCB2, 0x75BE, 0xBCB3, 0x6C72, - 0xBCB4, 0x5373, 0xBCB5, 0x5AC9, 0xBCB6, 0x7EA7, 0xBCB7, 0x6324, - 0xBCB8, 0x51E0, 0xBCB9, 0x810A, 0xBCBA, 0x5DF1, 0xBCBB, 0x84DF, - 0xBCBC, 0x6280, 0xBCBD, 0x5180, 0xBCBE, 0x5B63, 0xBCBF, 0x4F0E, - 0xBCC0, 0x796D, 0xBCC1, 0x5242, 0xBCC2, 0x60B8, 0xBCC3, 0x6D4E, - 0xBCC4, 0x5BC4, 0xBCC5, 0x5BC2, 0xBCC6, 0x8BA1, 0xBCC7, 0x8BB0, - 0xBCC8, 0x65E2, 0xBCC9, 0x5FCC, 0xBCCA, 0x9645, 0xBCCB, 0x5993, - 0xBCCC, 0x7EE7, 0xBCCD, 0x7EAA, 0xBCCE, 0x5609, 0xBCCF, 0x67B7, - 0xBCD0, 0x5939, 0xBCD1, 0x4F73, 0xBCD2, 0x5BB6, 0xBCD3, 0x52A0, - 0xBCD4, 0x835A, 0xBCD5, 0x988A, 0xBCD6, 0x8D3E, 0xBCD7, 0x7532, - 0xBCD8, 0x94BE, 0xBCD9, 0x5047, 0xBCDA, 0x7A3C, 0xBCDB, 0x4EF7, - 0xBCDC, 0x67B6, 0xBCDD, 0x9A7E, 0xBCDE, 0x5AC1, 0xBCDF, 0x6B7C, - 0xBCE0, 0x76D1, 0xBCE1, 0x575A, 0xBCE2, 0x5C16, 0xBCE3, 0x7B3A, - 0xBCE4, 0x95F4, 0xBCE5, 0x714E, 0xBCE6, 0x517C, 0xBCE7, 0x80A9, - 0xBCE8, 0x8270, 0xBCE9, 0x5978, 0xBCEA, 0x7F04, 0xBCEB, 0x8327, - 0xBCEC, 0x68C0, 0xBCED, 0x67EC, 0xBCEE, 0x78B1, 0xBCEF, 0x7877, - 0xBCF0, 0x62E3, 0xBCF1, 0x6361, 0xBCF2, 0x7B80, 0xBCF3, 0x4FED, - 0xBCF4, 0x526A, 0xBCF5, 0x51CF, 0xBCF6, 0x8350, 0xBCF7, 0x69DB, - 0xBCF8, 0x9274, 0xBCF9, 0x8DF5, 0xBCFA, 0x8D31, 0xBCFB, 0x89C1, - 0xBCFC, 0x952E, 0xBCFD, 0x7BAD, 0xBCFE, 0x4EF6, 0xBD40, 0x7D37, - 0xBD41, 0x7D38, 0xBD42, 0x7D39, 0xBD43, 0x7D3A, 0xBD44, 0x7D3B, - 0xBD45, 0x7D3C, 0xBD46, 0x7D3D, 0xBD47, 0x7D3E, 0xBD48, 0x7D3F, - 0xBD49, 0x7D40, 0xBD4A, 0x7D41, 0xBD4B, 0x7D42, 0xBD4C, 0x7D43, - 0xBD4D, 0x7D44, 0xBD4E, 0x7D45, 0xBD4F, 0x7D46, 0xBD50, 0x7D47, - 0xBD51, 0x7D48, 0xBD52, 0x7D49, 0xBD53, 0x7D4A, 0xBD54, 0x7D4B, - 0xBD55, 0x7D4C, 0xBD56, 0x7D4D, 0xBD57, 0x7D4E, 0xBD58, 0x7D4F, - 0xBD59, 0x7D50, 0xBD5A, 0x7D51, 0xBD5B, 0x7D52, 0xBD5C, 0x7D53, - 0xBD5D, 0x7D54, 0xBD5E, 0x7D55, 0xBD5F, 0x7D56, 0xBD60, 0x7D57, - 0xBD61, 0x7D58, 0xBD62, 0x7D59, 0xBD63, 0x7D5A, 0xBD64, 0x7D5B, - 0xBD65, 0x7D5C, 0xBD66, 0x7D5D, 0xBD67, 0x7D5E, 0xBD68, 0x7D5F, - 0xBD69, 0x7D60, 0xBD6A, 0x7D61, 0xBD6B, 0x7D62, 0xBD6C, 0x7D63, - 0xBD6D, 0x7D64, 0xBD6E, 0x7D65, 0xBD6F, 0x7D66, 0xBD70, 0x7D67, - 0xBD71, 0x7D68, 0xBD72, 0x7D69, 0xBD73, 0x7D6A, 0xBD74, 0x7D6B, - 0xBD75, 0x7D6C, 0xBD76, 0x7D6D, 0xBD77, 0x7D6F, 0xBD78, 0x7D70, - 0xBD79, 0x7D71, 0xBD7A, 0x7D72, 0xBD7B, 0x7D73, 0xBD7C, 0x7D74, - 0xBD7D, 0x7D75, 0xBD7E, 0x7D76, 0xBD80, 0x7D78, 0xBD81, 0x7D79, - 0xBD82, 0x7D7A, 0xBD83, 0x7D7B, 0xBD84, 0x7D7C, 0xBD85, 0x7D7D, - 0xBD86, 0x7D7E, 0xBD87, 0x7D7F, 0xBD88, 0x7D80, 0xBD89, 0x7D81, - 0xBD8A, 0x7D82, 0xBD8B, 0x7D83, 0xBD8C, 0x7D84, 0xBD8D, 0x7D85, - 0xBD8E, 0x7D86, 0xBD8F, 0x7D87, 0xBD90, 0x7D88, 0xBD91, 0x7D89, - 0xBD92, 0x7D8A, 0xBD93, 0x7D8B, 0xBD94, 0x7D8C, 0xBD95, 0x7D8D, - 0xBD96, 0x7D8E, 0xBD97, 0x7D8F, 0xBD98, 0x7D90, 0xBD99, 0x7D91, - 0xBD9A, 0x7D92, 0xBD9B, 0x7D93, 0xBD9C, 0x7D94, 0xBD9D, 0x7D95, - 0xBD9E, 0x7D96, 0xBD9F, 0x7D97, 0xBDA0, 0x7D98, 0xBDA1, 0x5065, - 0xBDA2, 0x8230, 0xBDA3, 0x5251, 0xBDA4, 0x996F, 0xBDA5, 0x6E10, - 0xBDA6, 0x6E85, 0xBDA7, 0x6DA7, 0xBDA8, 0x5EFA, 0xBDA9, 0x50F5, - 0xBDAA, 0x59DC, 0xBDAB, 0x5C06, 0xBDAC, 0x6D46, 0xBDAD, 0x6C5F, - 0xBDAE, 0x7586, 0xBDAF, 0x848B, 0xBDB0, 0x6868, 0xBDB1, 0x5956, - 0xBDB2, 0x8BB2, 0xBDB3, 0x5320, 0xBDB4, 0x9171, 0xBDB5, 0x964D, - 0xBDB6, 0x8549, 0xBDB7, 0x6912, 0xBDB8, 0x7901, 0xBDB9, 0x7126, - 0xBDBA, 0x80F6, 0xBDBB, 0x4EA4, 0xBDBC, 0x90CA, 0xBDBD, 0x6D47, - 0xBDBE, 0x9A84, 0xBDBF, 0x5A07, 0xBDC0, 0x56BC, 0xBDC1, 0x6405, - 0xBDC2, 0x94F0, 0xBDC3, 0x77EB, 0xBDC4, 0x4FA5, 0xBDC5, 0x811A, - 0xBDC6, 0x72E1, 0xBDC7, 0x89D2, 0xBDC8, 0x997A, 0xBDC9, 0x7F34, - 0xBDCA, 0x7EDE, 0xBDCB, 0x527F, 0xBDCC, 0x6559, 0xBDCD, 0x9175, - 0xBDCE, 0x8F7F, 0xBDCF, 0x8F83, 0xBDD0, 0x53EB, 0xBDD1, 0x7A96, - 0xBDD2, 0x63ED, 0xBDD3, 0x63A5, 0xBDD4, 0x7686, 0xBDD5, 0x79F8, - 0xBDD6, 0x8857, 0xBDD7, 0x9636, 0xBDD8, 0x622A, 0xBDD9, 0x52AB, - 0xBDDA, 0x8282, 0xBDDB, 0x6854, 0xBDDC, 0x6770, 0xBDDD, 0x6377, - 0xBDDE, 0x776B, 0xBDDF, 0x7AED, 0xBDE0, 0x6D01, 0xBDE1, 0x7ED3, - 0xBDE2, 0x89E3, 0xBDE3, 0x59D0, 0xBDE4, 0x6212, 0xBDE5, 0x85C9, - 0xBDE6, 0x82A5, 0xBDE7, 0x754C, 0xBDE8, 0x501F, 0xBDE9, 0x4ECB, - 0xBDEA, 0x75A5, 0xBDEB, 0x8BEB, 0xBDEC, 0x5C4A, 0xBDED, 0x5DFE, - 0xBDEE, 0x7B4B, 0xBDEF, 0x65A4, 0xBDF0, 0x91D1, 0xBDF1, 0x4ECA, - 0xBDF2, 0x6D25, 0xBDF3, 0x895F, 0xBDF4, 0x7D27, 0xBDF5, 0x9526, - 0xBDF6, 0x4EC5, 0xBDF7, 0x8C28, 0xBDF8, 0x8FDB, 0xBDF9, 0x9773, - 0xBDFA, 0x664B, 0xBDFB, 0x7981, 0xBDFC, 0x8FD1, 0xBDFD, 0x70EC, - 0xBDFE, 0x6D78, 0xBE40, 0x7D99, 0xBE41, 0x7D9A, 0xBE42, 0x7D9B, - 0xBE43, 0x7D9C, 0xBE44, 0x7D9D, 0xBE45, 0x7D9E, 0xBE46, 0x7D9F, - 0xBE47, 0x7DA0, 0xBE48, 0x7DA1, 0xBE49, 0x7DA2, 0xBE4A, 0x7DA3, - 0xBE4B, 0x7DA4, 0xBE4C, 0x7DA5, 0xBE4D, 0x7DA7, 0xBE4E, 0x7DA8, - 0xBE4F, 0x7DA9, 0xBE50, 0x7DAA, 0xBE51, 0x7DAB, 0xBE52, 0x7DAC, - 0xBE53, 0x7DAD, 0xBE54, 0x7DAF, 0xBE55, 0x7DB0, 0xBE56, 0x7DB1, - 0xBE57, 0x7DB2, 0xBE58, 0x7DB3, 0xBE59, 0x7DB4, 0xBE5A, 0x7DB5, - 0xBE5B, 0x7DB6, 0xBE5C, 0x7DB7, 0xBE5D, 0x7DB8, 0xBE5E, 0x7DB9, - 0xBE5F, 0x7DBA, 0xBE60, 0x7DBB, 0xBE61, 0x7DBC, 0xBE62, 0x7DBD, - 0xBE63, 0x7DBE, 0xBE64, 0x7DBF, 0xBE65, 0x7DC0, 0xBE66, 0x7DC1, - 0xBE67, 0x7DC2, 0xBE68, 0x7DC3, 0xBE69, 0x7DC4, 0xBE6A, 0x7DC5, - 0xBE6B, 0x7DC6, 0xBE6C, 0x7DC7, 0xBE6D, 0x7DC8, 0xBE6E, 0x7DC9, - 0xBE6F, 0x7DCA, 0xBE70, 0x7DCB, 0xBE71, 0x7DCC, 0xBE72, 0x7DCD, - 0xBE73, 0x7DCE, 0xBE74, 0x7DCF, 0xBE75, 0x7DD0, 0xBE76, 0x7DD1, - 0xBE77, 0x7DD2, 0xBE78, 0x7DD3, 0xBE79, 0x7DD4, 0xBE7A, 0x7DD5, - 0xBE7B, 0x7DD6, 0xBE7C, 0x7DD7, 0xBE7D, 0x7DD8, 0xBE7E, 0x7DD9, - 0xBE80, 0x7DDA, 0xBE81, 0x7DDB, 0xBE82, 0x7DDC, 0xBE83, 0x7DDD, - 0xBE84, 0x7DDE, 0xBE85, 0x7DDF, 0xBE86, 0x7DE0, 0xBE87, 0x7DE1, - 0xBE88, 0x7DE2, 0xBE89, 0x7DE3, 0xBE8A, 0x7DE4, 0xBE8B, 0x7DE5, - 0xBE8C, 0x7DE6, 0xBE8D, 0x7DE7, 0xBE8E, 0x7DE8, 0xBE8F, 0x7DE9, - 0xBE90, 0x7DEA, 0xBE91, 0x7DEB, 0xBE92, 0x7DEC, 0xBE93, 0x7DED, - 0xBE94, 0x7DEE, 0xBE95, 0x7DEF, 0xBE96, 0x7DF0, 0xBE97, 0x7DF1, - 0xBE98, 0x7DF2, 0xBE99, 0x7DF3, 0xBE9A, 0x7DF4, 0xBE9B, 0x7DF5, - 0xBE9C, 0x7DF6, 0xBE9D, 0x7DF7, 0xBE9E, 0x7DF8, 0xBE9F, 0x7DF9, - 0xBEA0, 0x7DFA, 0xBEA1, 0x5C3D, 0xBEA2, 0x52B2, 0xBEA3, 0x8346, - 0xBEA4, 0x5162, 0xBEA5, 0x830E, 0xBEA6, 0x775B, 0xBEA7, 0x6676, - 0xBEA8, 0x9CB8, 0xBEA9, 0x4EAC, 0xBEAA, 0x60CA, 0xBEAB, 0x7CBE, - 0xBEAC, 0x7CB3, 0xBEAD, 0x7ECF, 0xBEAE, 0x4E95, 0xBEAF, 0x8B66, - 0xBEB0, 0x666F, 0xBEB1, 0x9888, 0xBEB2, 0x9759, 0xBEB3, 0x5883, - 0xBEB4, 0x656C, 0xBEB5, 0x955C, 0xBEB6, 0x5F84, 0xBEB7, 0x75C9, - 0xBEB8, 0x9756, 0xBEB9, 0x7ADF, 0xBEBA, 0x7ADE, 0xBEBB, 0x51C0, - 0xBEBC, 0x70AF, 0xBEBD, 0x7A98, 0xBEBE, 0x63EA, 0xBEBF, 0x7A76, - 0xBEC0, 0x7EA0, 0xBEC1, 0x7396, 0xBEC2, 0x97ED, 0xBEC3, 0x4E45, - 0xBEC4, 0x7078, 0xBEC5, 0x4E5D, 0xBEC6, 0x9152, 0xBEC7, 0x53A9, - 0xBEC8, 0x6551, 0xBEC9, 0x65E7, 0xBECA, 0x81FC, 0xBECB, 0x8205, - 0xBECC, 0x548E, 0xBECD, 0x5C31, 0xBECE, 0x759A, 0xBECF, 0x97A0, - 0xBED0, 0x62D8, 0xBED1, 0x72D9, 0xBED2, 0x75BD, 0xBED3, 0x5C45, - 0xBED4, 0x9A79, 0xBED5, 0x83CA, 0xBED6, 0x5C40, 0xBED7, 0x5480, - 0xBED8, 0x77E9, 0xBED9, 0x4E3E, 0xBEDA, 0x6CAE, 0xBEDB, 0x805A, - 0xBEDC, 0x62D2, 0xBEDD, 0x636E, 0xBEDE, 0x5DE8, 0xBEDF, 0x5177, - 0xBEE0, 0x8DDD, 0xBEE1, 0x8E1E, 0xBEE2, 0x952F, 0xBEE3, 0x4FF1, - 0xBEE4, 0x53E5, 0xBEE5, 0x60E7, 0xBEE6, 0x70AC, 0xBEE7, 0x5267, - 0xBEE8, 0x6350, 0xBEE9, 0x9E43, 0xBEEA, 0x5A1F, 0xBEEB, 0x5026, - 0xBEEC, 0x7737, 0xBEED, 0x5377, 0xBEEE, 0x7EE2, 0xBEEF, 0x6485, - 0xBEF0, 0x652B, 0xBEF1, 0x6289, 0xBEF2, 0x6398, 0xBEF3, 0x5014, - 0xBEF4, 0x7235, 0xBEF5, 0x89C9, 0xBEF6, 0x51B3, 0xBEF7, 0x8BC0, - 0xBEF8, 0x7EDD, 0xBEF9, 0x5747, 0xBEFA, 0x83CC, 0xBEFB, 0x94A7, - 0xBEFC, 0x519B, 0xBEFD, 0x541B, 0xBEFE, 0x5CFB, 0xBF40, 0x7DFB, - 0xBF41, 0x7DFC, 0xBF42, 0x7DFD, 0xBF43, 0x7DFE, 0xBF44, 0x7DFF, - 0xBF45, 0x7E00, 0xBF46, 0x7E01, 0xBF47, 0x7E02, 0xBF48, 0x7E03, - 0xBF49, 0x7E04, 0xBF4A, 0x7E05, 0xBF4B, 0x7E06, 0xBF4C, 0x7E07, - 0xBF4D, 0x7E08, 0xBF4E, 0x7E09, 0xBF4F, 0x7E0A, 0xBF50, 0x7E0B, - 0xBF51, 0x7E0C, 0xBF52, 0x7E0D, 0xBF53, 0x7E0E, 0xBF54, 0x7E0F, - 0xBF55, 0x7E10, 0xBF56, 0x7E11, 0xBF57, 0x7E12, 0xBF58, 0x7E13, - 0xBF59, 0x7E14, 0xBF5A, 0x7E15, 0xBF5B, 0x7E16, 0xBF5C, 0x7E17, - 0xBF5D, 0x7E18, 0xBF5E, 0x7E19, 0xBF5F, 0x7E1A, 0xBF60, 0x7E1B, - 0xBF61, 0x7E1C, 0xBF62, 0x7E1D, 0xBF63, 0x7E1E, 0xBF64, 0x7E1F, - 0xBF65, 0x7E20, 0xBF66, 0x7E21, 0xBF67, 0x7E22, 0xBF68, 0x7E23, - 0xBF69, 0x7E24, 0xBF6A, 0x7E25, 0xBF6B, 0x7E26, 0xBF6C, 0x7E27, - 0xBF6D, 0x7E28, 0xBF6E, 0x7E29, 0xBF6F, 0x7E2A, 0xBF70, 0x7E2B, - 0xBF71, 0x7E2C, 0xBF72, 0x7E2D, 0xBF73, 0x7E2E, 0xBF74, 0x7E2F, - 0xBF75, 0x7E30, 0xBF76, 0x7E31, 0xBF77, 0x7E32, 0xBF78, 0x7E33, - 0xBF79, 0x7E34, 0xBF7A, 0x7E35, 0xBF7B, 0x7E36, 0xBF7C, 0x7E37, - 0xBF7D, 0x7E38, 0xBF7E, 0x7E39, 0xBF80, 0x7E3A, 0xBF81, 0x7E3C, - 0xBF82, 0x7E3D, 0xBF83, 0x7E3E, 0xBF84, 0x7E3F, 0xBF85, 0x7E40, - 0xBF86, 0x7E42, 0xBF87, 0x7E43, 0xBF88, 0x7E44, 0xBF89, 0x7E45, - 0xBF8A, 0x7E46, 0xBF8B, 0x7E48, 0xBF8C, 0x7E49, 0xBF8D, 0x7E4A, - 0xBF8E, 0x7E4B, 0xBF8F, 0x7E4C, 0xBF90, 0x7E4D, 0xBF91, 0x7E4E, - 0xBF92, 0x7E4F, 0xBF93, 0x7E50, 0xBF94, 0x7E51, 0xBF95, 0x7E52, - 0xBF96, 0x7E53, 0xBF97, 0x7E54, 0xBF98, 0x7E55, 0xBF99, 0x7E56, - 0xBF9A, 0x7E57, 0xBF9B, 0x7E58, 0xBF9C, 0x7E59, 0xBF9D, 0x7E5A, - 0xBF9E, 0x7E5B, 0xBF9F, 0x7E5C, 0xBFA0, 0x7E5D, 0xBFA1, 0x4FCA, - 0xBFA2, 0x7AE3, 0xBFA3, 0x6D5A, 0xBFA4, 0x90E1, 0xBFA5, 0x9A8F, - 0xBFA6, 0x5580, 0xBFA7, 0x5496, 0xBFA8, 0x5361, 0xBFA9, 0x54AF, - 0xBFAA, 0x5F00, 0xBFAB, 0x63E9, 0xBFAC, 0x6977, 0xBFAD, 0x51EF, - 0xBFAE, 0x6168, 0xBFAF, 0x520A, 0xBFB0, 0x582A, 0xBFB1, 0x52D8, - 0xBFB2, 0x574E, 0xBFB3, 0x780D, 0xBFB4, 0x770B, 0xBFB5, 0x5EB7, - 0xBFB6, 0x6177, 0xBFB7, 0x7CE0, 0xBFB8, 0x625B, 0xBFB9, 0x6297, - 0xBFBA, 0x4EA2, 0xBFBB, 0x7095, 0xBFBC, 0x8003, 0xBFBD, 0x62F7, - 0xBFBE, 0x70E4, 0xBFBF, 0x9760, 0xBFC0, 0x5777, 0xBFC1, 0x82DB, - 0xBFC2, 0x67EF, 0xBFC3, 0x68F5, 0xBFC4, 0x78D5, 0xBFC5, 0x9897, - 0xBFC6, 0x79D1, 0xBFC7, 0x58F3, 0xBFC8, 0x54B3, 0xBFC9, 0x53EF, - 0xBFCA, 0x6E34, 0xBFCB, 0x514B, 0xBFCC, 0x523B, 0xBFCD, 0x5BA2, - 0xBFCE, 0x8BFE, 0xBFCF, 0x80AF, 0xBFD0, 0x5543, 0xBFD1, 0x57A6, - 0xBFD2, 0x6073, 0xBFD3, 0x5751, 0xBFD4, 0x542D, 0xBFD5, 0x7A7A, - 0xBFD6, 0x6050, 0xBFD7, 0x5B54, 0xBFD8, 0x63A7, 0xBFD9, 0x62A0, - 0xBFDA, 0x53E3, 0xBFDB, 0x6263, 0xBFDC, 0x5BC7, 0xBFDD, 0x67AF, - 0xBFDE, 0x54ED, 0xBFDF, 0x7A9F, 0xBFE0, 0x82E6, 0xBFE1, 0x9177, - 0xBFE2, 0x5E93, 0xBFE3, 0x88E4, 0xBFE4, 0x5938, 0xBFE5, 0x57AE, - 0xBFE6, 0x630E, 0xBFE7, 0x8DE8, 0xBFE8, 0x80EF, 0xBFE9, 0x5757, - 0xBFEA, 0x7B77, 0xBFEB, 0x4FA9, 0xBFEC, 0x5FEB, 0xBFED, 0x5BBD, - 0xBFEE, 0x6B3E, 0xBFEF, 0x5321, 0xBFF0, 0x7B50, 0xBFF1, 0x72C2, - 0xBFF2, 0x6846, 0xBFF3, 0x77FF, 0xBFF4, 0x7736, 0xBFF5, 0x65F7, - 0xBFF6, 0x51B5, 0xBFF7, 0x4E8F, 0xBFF8, 0x76D4, 0xBFF9, 0x5CBF, - 0xBFFA, 0x7AA5, 0xBFFB, 0x8475, 0xBFFC, 0x594E, 0xBFFD, 0x9B41, - 0xBFFE, 0x5080, 0xC040, 0x7E5E, 0xC041, 0x7E5F, 0xC042, 0x7E60, - 0xC043, 0x7E61, 0xC044, 0x7E62, 0xC045, 0x7E63, 0xC046, 0x7E64, - 0xC047, 0x7E65, 0xC048, 0x7E66, 0xC049, 0x7E67, 0xC04A, 0x7E68, - 0xC04B, 0x7E69, 0xC04C, 0x7E6A, 0xC04D, 0x7E6B, 0xC04E, 0x7E6C, - 0xC04F, 0x7E6D, 0xC050, 0x7E6E, 0xC051, 0x7E6F, 0xC052, 0x7E70, - 0xC053, 0x7E71, 0xC054, 0x7E72, 0xC055, 0x7E73, 0xC056, 0x7E74, - 0xC057, 0x7E75, 0xC058, 0x7E76, 0xC059, 0x7E77, 0xC05A, 0x7E78, - 0xC05B, 0x7E79, 0xC05C, 0x7E7A, 0xC05D, 0x7E7B, 0xC05E, 0x7E7C, - 0xC05F, 0x7E7D, 0xC060, 0x7E7E, 0xC061, 0x7E7F, 0xC062, 0x7E80, - 0xC063, 0x7E81, 0xC064, 0x7E83, 0xC065, 0x7E84, 0xC066, 0x7E85, - 0xC067, 0x7E86, 0xC068, 0x7E87, 0xC069, 0x7E88, 0xC06A, 0x7E89, - 0xC06B, 0x7E8A, 0xC06C, 0x7E8B, 0xC06D, 0x7E8C, 0xC06E, 0x7E8D, - 0xC06F, 0x7E8E, 0xC070, 0x7E8F, 0xC071, 0x7E90, 0xC072, 0x7E91, - 0xC073, 0x7E92, 0xC074, 0x7E93, 0xC075, 0x7E94, 0xC076, 0x7E95, - 0xC077, 0x7E96, 0xC078, 0x7E97, 0xC079, 0x7E98, 0xC07A, 0x7E99, - 0xC07B, 0x7E9A, 0xC07C, 0x7E9C, 0xC07D, 0x7E9D, 0xC07E, 0x7E9E, - 0xC080, 0x7EAE, 0xC081, 0x7EB4, 0xC082, 0x7EBB, 0xC083, 0x7EBC, - 0xC084, 0x7ED6, 0xC085, 0x7EE4, 0xC086, 0x7EEC, 0xC087, 0x7EF9, - 0xC088, 0x7F0A, 0xC089, 0x7F10, 0xC08A, 0x7F1E, 0xC08B, 0x7F37, - 0xC08C, 0x7F39, 0xC08D, 0x7F3B, 0xC08E, 0x7F3C, 0xC08F, 0x7F3D, - 0xC090, 0x7F3E, 0xC091, 0x7F3F, 0xC092, 0x7F40, 0xC093, 0x7F41, - 0xC094, 0x7F43, 0xC095, 0x7F46, 0xC096, 0x7F47, 0xC097, 0x7F48, - 0xC098, 0x7F49, 0xC099, 0x7F4A, 0xC09A, 0x7F4B, 0xC09B, 0x7F4C, - 0xC09C, 0x7F4D, 0xC09D, 0x7F4E, 0xC09E, 0x7F4F, 0xC09F, 0x7F52, - 0xC0A0, 0x7F53, 0xC0A1, 0x9988, 0xC0A2, 0x6127, 0xC0A3, 0x6E83, - 0xC0A4, 0x5764, 0xC0A5, 0x6606, 0xC0A6, 0x6346, 0xC0A7, 0x56F0, - 0xC0A8, 0x62EC, 0xC0A9, 0x6269, 0xC0AA, 0x5ED3, 0xC0AB, 0x9614, - 0xC0AC, 0x5783, 0xC0AD, 0x62C9, 0xC0AE, 0x5587, 0xC0AF, 0x8721, - 0xC0B0, 0x814A, 0xC0B1, 0x8FA3, 0xC0B2, 0x5566, 0xC0B3, 0x83B1, - 0xC0B4, 0x6765, 0xC0B5, 0x8D56, 0xC0B6, 0x84DD, 0xC0B7, 0x5A6A, - 0xC0B8, 0x680F, 0xC0B9, 0x62E6, 0xC0BA, 0x7BEE, 0xC0BB, 0x9611, - 0xC0BC, 0x5170, 0xC0BD, 0x6F9C, 0xC0BE, 0x8C30, 0xC0BF, 0x63FD, - 0xC0C0, 0x89C8, 0xC0C1, 0x61D2, 0xC0C2, 0x7F06, 0xC0C3, 0x70C2, - 0xC0C4, 0x6EE5, 0xC0C5, 0x7405, 0xC0C6, 0x6994, 0xC0C7, 0x72FC, - 0xC0C8, 0x5ECA, 0xC0C9, 0x90CE, 0xC0CA, 0x6717, 0xC0CB, 0x6D6A, - 0xC0CC, 0x635E, 0xC0CD, 0x52B3, 0xC0CE, 0x7262, 0xC0CF, 0x8001, - 0xC0D0, 0x4F6C, 0xC0D1, 0x59E5, 0xC0D2, 0x916A, 0xC0D3, 0x70D9, - 0xC0D4, 0x6D9D, 0xC0D5, 0x52D2, 0xC0D6, 0x4E50, 0xC0D7, 0x96F7, - 0xC0D8, 0x956D, 0xC0D9, 0x857E, 0xC0DA, 0x78CA, 0xC0DB, 0x7D2F, - 0xC0DC, 0x5121, 0xC0DD, 0x5792, 0xC0DE, 0x64C2, 0xC0DF, 0x808B, - 0xC0E0, 0x7C7B, 0xC0E1, 0x6CEA, 0xC0E2, 0x68F1, 0xC0E3, 0x695E, - 0xC0E4, 0x51B7, 0xC0E5, 0x5398, 0xC0E6, 0x68A8, 0xC0E7, 0x7281, - 0xC0E8, 0x9ECE, 0xC0E9, 0x7BF1, 0xC0EA, 0x72F8, 0xC0EB, 0x79BB, - 0xC0EC, 0x6F13, 0xC0ED, 0x7406, 0xC0EE, 0x674E, 0xC0EF, 0x91CC, - 0xC0F0, 0x9CA4, 0xC0F1, 0x793C, 0xC0F2, 0x8389, 0xC0F3, 0x8354, - 0xC0F4, 0x540F, 0xC0F5, 0x6817, 0xC0F6, 0x4E3D, 0xC0F7, 0x5389, - 0xC0F8, 0x52B1, 0xC0F9, 0x783E, 0xC0FA, 0x5386, 0xC0FB, 0x5229, - 0xC0FC, 0x5088, 0xC0FD, 0x4F8B, 0xC0FE, 0x4FD0, 0xC140, 0x7F56, - 0xC141, 0x7F59, 0xC142, 0x7F5B, 0xC143, 0x7F5C, 0xC144, 0x7F5D, - 0xC145, 0x7F5E, 0xC146, 0x7F60, 0xC147, 0x7F63, 0xC148, 0x7F64, - 0xC149, 0x7F65, 0xC14A, 0x7F66, 0xC14B, 0x7F67, 0xC14C, 0x7F6B, - 0xC14D, 0x7F6C, 0xC14E, 0x7F6D, 0xC14F, 0x7F6F, 0xC150, 0x7F70, - 0xC151, 0x7F73, 0xC152, 0x7F75, 0xC153, 0x7F76, 0xC154, 0x7F77, - 0xC155, 0x7F78, 0xC156, 0x7F7A, 0xC157, 0x7F7B, 0xC158, 0x7F7C, - 0xC159, 0x7F7D, 0xC15A, 0x7F7F, 0xC15B, 0x7F80, 0xC15C, 0x7F82, - 0xC15D, 0x7F83, 0xC15E, 0x7F84, 0xC15F, 0x7F85, 0xC160, 0x7F86, - 0xC161, 0x7F87, 0xC162, 0x7F88, 0xC163, 0x7F89, 0xC164, 0x7F8B, - 0xC165, 0x7F8D, 0xC166, 0x7F8F, 0xC167, 0x7F90, 0xC168, 0x7F91, - 0xC169, 0x7F92, 0xC16A, 0x7F93, 0xC16B, 0x7F95, 0xC16C, 0x7F96, - 0xC16D, 0x7F97, 0xC16E, 0x7F98, 0xC16F, 0x7F99, 0xC170, 0x7F9B, - 0xC171, 0x7F9C, 0xC172, 0x7FA0, 0xC173, 0x7FA2, 0xC174, 0x7FA3, - 0xC175, 0x7FA5, 0xC176, 0x7FA6, 0xC177, 0x7FA8, 0xC178, 0x7FA9, - 0xC179, 0x7FAA, 0xC17A, 0x7FAB, 0xC17B, 0x7FAC, 0xC17C, 0x7FAD, - 0xC17D, 0x7FAE, 0xC17E, 0x7FB1, 0xC180, 0x7FB3, 0xC181, 0x7FB4, - 0xC182, 0x7FB5, 0xC183, 0x7FB6, 0xC184, 0x7FB7, 0xC185, 0x7FBA, - 0xC186, 0x7FBB, 0xC187, 0x7FBE, 0xC188, 0x7FC0, 0xC189, 0x7FC2, - 0xC18A, 0x7FC3, 0xC18B, 0x7FC4, 0xC18C, 0x7FC6, 0xC18D, 0x7FC7, - 0xC18E, 0x7FC8, 0xC18F, 0x7FC9, 0xC190, 0x7FCB, 0xC191, 0x7FCD, - 0xC192, 0x7FCF, 0xC193, 0x7FD0, 0xC194, 0x7FD1, 0xC195, 0x7FD2, - 0xC196, 0x7FD3, 0xC197, 0x7FD6, 0xC198, 0x7FD7, 0xC199, 0x7FD9, - 0xC19A, 0x7FDA, 0xC19B, 0x7FDB, 0xC19C, 0x7FDC, 0xC19D, 0x7FDD, - 0xC19E, 0x7FDE, 0xC19F, 0x7FE2, 0xC1A0, 0x7FE3, 0xC1A1, 0x75E2, - 0xC1A2, 0x7ACB, 0xC1A3, 0x7C92, 0xC1A4, 0x6CA5, 0xC1A5, 0x96B6, - 0xC1A6, 0x529B, 0xC1A7, 0x7483, 0xC1A8, 0x54E9, 0xC1A9, 0x4FE9, - 0xC1AA, 0x8054, 0xC1AB, 0x83B2, 0xC1AC, 0x8FDE, 0xC1AD, 0x9570, - 0xC1AE, 0x5EC9, 0xC1AF, 0x601C, 0xC1B0, 0x6D9F, 0xC1B1, 0x5E18, - 0xC1B2, 0x655B, 0xC1B3, 0x8138, 0xC1B4, 0x94FE, 0xC1B5, 0x604B, - 0xC1B6, 0x70BC, 0xC1B7, 0x7EC3, 0xC1B8, 0x7CAE, 0xC1B9, 0x51C9, - 0xC1BA, 0x6881, 0xC1BB, 0x7CB1, 0xC1BC, 0x826F, 0xC1BD, 0x4E24, - 0xC1BE, 0x8F86, 0xC1BF, 0x91CF, 0xC1C0, 0x667E, 0xC1C1, 0x4EAE, - 0xC1C2, 0x8C05, 0xC1C3, 0x64A9, 0xC1C4, 0x804A, 0xC1C5, 0x50DA, - 0xC1C6, 0x7597, 0xC1C7, 0x71CE, 0xC1C8, 0x5BE5, 0xC1C9, 0x8FBD, - 0xC1CA, 0x6F66, 0xC1CB, 0x4E86, 0xC1CC, 0x6482, 0xC1CD, 0x9563, - 0xC1CE, 0x5ED6, 0xC1CF, 0x6599, 0xC1D0, 0x5217, 0xC1D1, 0x88C2, - 0xC1D2, 0x70C8, 0xC1D3, 0x52A3, 0xC1D4, 0x730E, 0xC1D5, 0x7433, - 0xC1D6, 0x6797, 0xC1D7, 0x78F7, 0xC1D8, 0x9716, 0xC1D9, 0x4E34, - 0xC1DA, 0x90BB, 0xC1DB, 0x9CDE, 0xC1DC, 0x6DCB, 0xC1DD, 0x51DB, - 0xC1DE, 0x8D41, 0xC1DF, 0x541D, 0xC1E0, 0x62CE, 0xC1E1, 0x73B2, - 0xC1E2, 0x83F1, 0xC1E3, 0x96F6, 0xC1E4, 0x9F84, 0xC1E5, 0x94C3, - 0xC1E6, 0x4F36, 0xC1E7, 0x7F9A, 0xC1E8, 0x51CC, 0xC1E9, 0x7075, - 0xC1EA, 0x9675, 0xC1EB, 0x5CAD, 0xC1EC, 0x9886, 0xC1ED, 0x53E6, - 0xC1EE, 0x4EE4, 0xC1EF, 0x6E9C, 0xC1F0, 0x7409, 0xC1F1, 0x69B4, - 0xC1F2, 0x786B, 0xC1F3, 0x998F, 0xC1F4, 0x7559, 0xC1F5, 0x5218, - 0xC1F6, 0x7624, 0xC1F7, 0x6D41, 0xC1F8, 0x67F3, 0xC1F9, 0x516D, - 0xC1FA, 0x9F99, 0xC1FB, 0x804B, 0xC1FC, 0x5499, 0xC1FD, 0x7B3C, - 0xC1FE, 0x7ABF, 0xC240, 0x7FE4, 0xC241, 0x7FE7, 0xC242, 0x7FE8, - 0xC243, 0x7FEA, 0xC244, 0x7FEB, 0xC245, 0x7FEC, 0xC246, 0x7FED, - 0xC247, 0x7FEF, 0xC248, 0x7FF2, 0xC249, 0x7FF4, 0xC24A, 0x7FF5, - 0xC24B, 0x7FF6, 0xC24C, 0x7FF7, 0xC24D, 0x7FF8, 0xC24E, 0x7FF9, - 0xC24F, 0x7FFA, 0xC250, 0x7FFD, 0xC251, 0x7FFE, 0xC252, 0x7FFF, - 0xC253, 0x8002, 0xC254, 0x8007, 0xC255, 0x8008, 0xC256, 0x8009, - 0xC257, 0x800A, 0xC258, 0x800E, 0xC259, 0x800F, 0xC25A, 0x8011, - 0xC25B, 0x8013, 0xC25C, 0x801A, 0xC25D, 0x801B, 0xC25E, 0x801D, - 0xC25F, 0x801E, 0xC260, 0x801F, 0xC261, 0x8021, 0xC262, 0x8023, - 0xC263, 0x8024, 0xC264, 0x802B, 0xC265, 0x802C, 0xC266, 0x802D, - 0xC267, 0x802E, 0xC268, 0x802F, 0xC269, 0x8030, 0xC26A, 0x8032, - 0xC26B, 0x8034, 0xC26C, 0x8039, 0xC26D, 0x803A, 0xC26E, 0x803C, - 0xC26F, 0x803E, 0xC270, 0x8040, 0xC271, 0x8041, 0xC272, 0x8044, - 0xC273, 0x8045, 0xC274, 0x8047, 0xC275, 0x8048, 0xC276, 0x8049, - 0xC277, 0x804E, 0xC278, 0x804F, 0xC279, 0x8050, 0xC27A, 0x8051, - 0xC27B, 0x8053, 0xC27C, 0x8055, 0xC27D, 0x8056, 0xC27E, 0x8057, - 0xC280, 0x8059, 0xC281, 0x805B, 0xC282, 0x805C, 0xC283, 0x805D, - 0xC284, 0x805E, 0xC285, 0x805F, 0xC286, 0x8060, 0xC287, 0x8061, - 0xC288, 0x8062, 0xC289, 0x8063, 0xC28A, 0x8064, 0xC28B, 0x8065, - 0xC28C, 0x8066, 0xC28D, 0x8067, 0xC28E, 0x8068, 0xC28F, 0x806B, - 0xC290, 0x806C, 0xC291, 0x806D, 0xC292, 0x806E, 0xC293, 0x806F, - 0xC294, 0x8070, 0xC295, 0x8072, 0xC296, 0x8073, 0xC297, 0x8074, - 0xC298, 0x8075, 0xC299, 0x8076, 0xC29A, 0x8077, 0xC29B, 0x8078, - 0xC29C, 0x8079, 0xC29D, 0x807A, 0xC29E, 0x807B, 0xC29F, 0x807C, - 0xC2A0, 0x807D, 0xC2A1, 0x9686, 0xC2A2, 0x5784, 0xC2A3, 0x62E2, - 0xC2A4, 0x9647, 0xC2A5, 0x697C, 0xC2A6, 0x5A04, 0xC2A7, 0x6402, - 0xC2A8, 0x7BD3, 0xC2A9, 0x6F0F, 0xC2AA, 0x964B, 0xC2AB, 0x82A6, - 0xC2AC, 0x5362, 0xC2AD, 0x9885, 0xC2AE, 0x5E90, 0xC2AF, 0x7089, - 0xC2B0, 0x63B3, 0xC2B1, 0x5364, 0xC2B2, 0x864F, 0xC2B3, 0x9C81, - 0xC2B4, 0x9E93, 0xC2B5, 0x788C, 0xC2B6, 0x9732, 0xC2B7, 0x8DEF, - 0xC2B8, 0x8D42, 0xC2B9, 0x9E7F, 0xC2BA, 0x6F5E, 0xC2BB, 0x7984, - 0xC2BC, 0x5F55, 0xC2BD, 0x9646, 0xC2BE, 0x622E, 0xC2BF, 0x9A74, - 0xC2C0, 0x5415, 0xC2C1, 0x94DD, 0xC2C2, 0x4FA3, 0xC2C3, 0x65C5, - 0xC2C4, 0x5C65, 0xC2C5, 0x5C61, 0xC2C6, 0x7F15, 0xC2C7, 0x8651, - 0xC2C8, 0x6C2F, 0xC2C9, 0x5F8B, 0xC2CA, 0x7387, 0xC2CB, 0x6EE4, - 0xC2CC, 0x7EFF, 0xC2CD, 0x5CE6, 0xC2CE, 0x631B, 0xC2CF, 0x5B6A, - 0xC2D0, 0x6EE6, 0xC2D1, 0x5375, 0xC2D2, 0x4E71, 0xC2D3, 0x63A0, - 0xC2D4, 0x7565, 0xC2D5, 0x62A1, 0xC2D6, 0x8F6E, 0xC2D7, 0x4F26, - 0xC2D8, 0x4ED1, 0xC2D9, 0x6CA6, 0xC2DA, 0x7EB6, 0xC2DB, 0x8BBA, - 0xC2DC, 0x841D, 0xC2DD, 0x87BA, 0xC2DE, 0x7F57, 0xC2DF, 0x903B, - 0xC2E0, 0x9523, 0xC2E1, 0x7BA9, 0xC2E2, 0x9AA1, 0xC2E3, 0x88F8, - 0xC2E4, 0x843D, 0xC2E5, 0x6D1B, 0xC2E6, 0x9A86, 0xC2E7, 0x7EDC, - 0xC2E8, 0x5988, 0xC2E9, 0x9EBB, 0xC2EA, 0x739B, 0xC2EB, 0x7801, - 0xC2EC, 0x8682, 0xC2ED, 0x9A6C, 0xC2EE, 0x9A82, 0xC2EF, 0x561B, - 0xC2F0, 0x5417, 0xC2F1, 0x57CB, 0xC2F2, 0x4E70, 0xC2F3, 0x9EA6, - 0xC2F4, 0x5356, 0xC2F5, 0x8FC8, 0xC2F6, 0x8109, 0xC2F7, 0x7792, - 0xC2F8, 0x9992, 0xC2F9, 0x86EE, 0xC2FA, 0x6EE1, 0xC2FB, 0x8513, - 0xC2FC, 0x66FC, 0xC2FD, 0x6162, 0xC2FE, 0x6F2B, 0xC340, 0x807E, - 0xC341, 0x8081, 0xC342, 0x8082, 0xC343, 0x8085, 0xC344, 0x8088, - 0xC345, 0x808A, 0xC346, 0x808D, 0xC347, 0x808E, 0xC348, 0x808F, - 0xC349, 0x8090, 0xC34A, 0x8091, 0xC34B, 0x8092, 0xC34C, 0x8094, - 0xC34D, 0x8095, 0xC34E, 0x8097, 0xC34F, 0x8099, 0xC350, 0x809E, - 0xC351, 0x80A3, 0xC352, 0x80A6, 0xC353, 0x80A7, 0xC354, 0x80A8, - 0xC355, 0x80AC, 0xC356, 0x80B0, 0xC357, 0x80B3, 0xC358, 0x80B5, - 0xC359, 0x80B6, 0xC35A, 0x80B8, 0xC35B, 0x80B9, 0xC35C, 0x80BB, - 0xC35D, 0x80C5, 0xC35E, 0x80C7, 0xC35F, 0x80C8, 0xC360, 0x80C9, - 0xC361, 0x80CA, 0xC362, 0x80CB, 0xC363, 0x80CF, 0xC364, 0x80D0, - 0xC365, 0x80D1, 0xC366, 0x80D2, 0xC367, 0x80D3, 0xC368, 0x80D4, - 0xC369, 0x80D5, 0xC36A, 0x80D8, 0xC36B, 0x80DF, 0xC36C, 0x80E0, - 0xC36D, 0x80E2, 0xC36E, 0x80E3, 0xC36F, 0x80E6, 0xC370, 0x80EE, - 0xC371, 0x80F5, 0xC372, 0x80F7, 0xC373, 0x80F9, 0xC374, 0x80FB, - 0xC375, 0x80FE, 0xC376, 0x80FF, 0xC377, 0x8100, 0xC378, 0x8101, - 0xC379, 0x8103, 0xC37A, 0x8104, 0xC37B, 0x8105, 0xC37C, 0x8107, - 0xC37D, 0x8108, 0xC37E, 0x810B, 0xC380, 0x810C, 0xC381, 0x8115, - 0xC382, 0x8117, 0xC383, 0x8119, 0xC384, 0x811B, 0xC385, 0x811C, - 0xC386, 0x811D, 0xC387, 0x811F, 0xC388, 0x8120, 0xC389, 0x8121, - 0xC38A, 0x8122, 0xC38B, 0x8123, 0xC38C, 0x8124, 0xC38D, 0x8125, - 0xC38E, 0x8126, 0xC38F, 0x8127, 0xC390, 0x8128, 0xC391, 0x8129, - 0xC392, 0x812A, 0xC393, 0x812B, 0xC394, 0x812D, 0xC395, 0x812E, - 0xC396, 0x8130, 0xC397, 0x8133, 0xC398, 0x8134, 0xC399, 0x8135, - 0xC39A, 0x8137, 0xC39B, 0x8139, 0xC39C, 0x813A, 0xC39D, 0x813B, - 0xC39E, 0x813C, 0xC39F, 0x813D, 0xC3A0, 0x813F, 0xC3A1, 0x8C29, - 0xC3A2, 0x8292, 0xC3A3, 0x832B, 0xC3A4, 0x76F2, 0xC3A5, 0x6C13, - 0xC3A6, 0x5FD9, 0xC3A7, 0x83BD, 0xC3A8, 0x732B, 0xC3A9, 0x8305, - 0xC3AA, 0x951A, 0xC3AB, 0x6BDB, 0xC3AC, 0x77DB, 0xC3AD, 0x94C6, - 0xC3AE, 0x536F, 0xC3AF, 0x8302, 0xC3B0, 0x5192, 0xC3B1, 0x5E3D, - 0xC3B2, 0x8C8C, 0xC3B3, 0x8D38, 0xC3B4, 0x4E48, 0xC3B5, 0x73AB, - 0xC3B6, 0x679A, 0xC3B7, 0x6885, 0xC3B8, 0x9176, 0xC3B9, 0x9709, - 0xC3BA, 0x7164, 0xC3BB, 0x6CA1, 0xC3BC, 0x7709, 0xC3BD, 0x5A92, - 0xC3BE, 0x9541, 0xC3BF, 0x6BCF, 0xC3C0, 0x7F8E, 0xC3C1, 0x6627, - 0xC3C2, 0x5BD0, 0xC3C3, 0x59B9, 0xC3C4, 0x5A9A, 0xC3C5, 0x95E8, - 0xC3C6, 0x95F7, 0xC3C7, 0x4EEC, 0xC3C8, 0x840C, 0xC3C9, 0x8499, - 0xC3CA, 0x6AAC, 0xC3CB, 0x76DF, 0xC3CC, 0x9530, 0xC3CD, 0x731B, - 0xC3CE, 0x68A6, 0xC3CF, 0x5B5F, 0xC3D0, 0x772F, 0xC3D1, 0x919A, - 0xC3D2, 0x9761, 0xC3D3, 0x7CDC, 0xC3D4, 0x8FF7, 0xC3D5, 0x8C1C, - 0xC3D6, 0x5F25, 0xC3D7, 0x7C73, 0xC3D8, 0x79D8, 0xC3D9, 0x89C5, - 0xC3DA, 0x6CCC, 0xC3DB, 0x871C, 0xC3DC, 0x5BC6, 0xC3DD, 0x5E42, - 0xC3DE, 0x68C9, 0xC3DF, 0x7720, 0xC3E0, 0x7EF5, 0xC3E1, 0x5195, - 0xC3E2, 0x514D, 0xC3E3, 0x52C9, 0xC3E4, 0x5A29, 0xC3E5, 0x7F05, - 0xC3E6, 0x9762, 0xC3E7, 0x82D7, 0xC3E8, 0x63CF, 0xC3E9, 0x7784, - 0xC3EA, 0x85D0, 0xC3EB, 0x79D2, 0xC3EC, 0x6E3A, 0xC3ED, 0x5E99, - 0xC3EE, 0x5999, 0xC3EF, 0x8511, 0xC3F0, 0x706D, 0xC3F1, 0x6C11, - 0xC3F2, 0x62BF, 0xC3F3, 0x76BF, 0xC3F4, 0x654F, 0xC3F5, 0x60AF, - 0xC3F6, 0x95FD, 0xC3F7, 0x660E, 0xC3F8, 0x879F, 0xC3F9, 0x9E23, - 0xC3FA, 0x94ED, 0xC3FB, 0x540D, 0xC3FC, 0x547D, 0xC3FD, 0x8C2C, - 0xC3FE, 0x6478, 0xC440, 0x8140, 0xC441, 0x8141, 0xC442, 0x8142, - 0xC443, 0x8143, 0xC444, 0x8144, 0xC445, 0x8145, 0xC446, 0x8147, - 0xC447, 0x8149, 0xC448, 0x814D, 0xC449, 0x814E, 0xC44A, 0x814F, - 0xC44B, 0x8152, 0xC44C, 0x8156, 0xC44D, 0x8157, 0xC44E, 0x8158, - 0xC44F, 0x815B, 0xC450, 0x815C, 0xC451, 0x815D, 0xC452, 0x815E, - 0xC453, 0x815F, 0xC454, 0x8161, 0xC455, 0x8162, 0xC456, 0x8163, - 0xC457, 0x8164, 0xC458, 0x8166, 0xC459, 0x8168, 0xC45A, 0x816A, - 0xC45B, 0x816B, 0xC45C, 0x816C, 0xC45D, 0x816F, 0xC45E, 0x8172, - 0xC45F, 0x8173, 0xC460, 0x8175, 0xC461, 0x8176, 0xC462, 0x8177, - 0xC463, 0x8178, 0xC464, 0x8181, 0xC465, 0x8183, 0xC466, 0x8184, - 0xC467, 0x8185, 0xC468, 0x8186, 0xC469, 0x8187, 0xC46A, 0x8189, - 0xC46B, 0x818B, 0xC46C, 0x818C, 0xC46D, 0x818D, 0xC46E, 0x818E, - 0xC46F, 0x8190, 0xC470, 0x8192, 0xC471, 0x8193, 0xC472, 0x8194, - 0xC473, 0x8195, 0xC474, 0x8196, 0xC475, 0x8197, 0xC476, 0x8199, - 0xC477, 0x819A, 0xC478, 0x819E, 0xC479, 0x819F, 0xC47A, 0x81A0, - 0xC47B, 0x81A1, 0xC47C, 0x81A2, 0xC47D, 0x81A4, 0xC47E, 0x81A5, - 0xC480, 0x81A7, 0xC481, 0x81A9, 0xC482, 0x81AB, 0xC483, 0x81AC, - 0xC484, 0x81AD, 0xC485, 0x81AE, 0xC486, 0x81AF, 0xC487, 0x81B0, - 0xC488, 0x81B1, 0xC489, 0x81B2, 0xC48A, 0x81B4, 0xC48B, 0x81B5, - 0xC48C, 0x81B6, 0xC48D, 0x81B7, 0xC48E, 0x81B8, 0xC48F, 0x81B9, - 0xC490, 0x81BC, 0xC491, 0x81BD, 0xC492, 0x81BE, 0xC493, 0x81BF, - 0xC494, 0x81C4, 0xC495, 0x81C5, 0xC496, 0x81C7, 0xC497, 0x81C8, - 0xC498, 0x81C9, 0xC499, 0x81CB, 0xC49A, 0x81CD, 0xC49B, 0x81CE, - 0xC49C, 0x81CF, 0xC49D, 0x81D0, 0xC49E, 0x81D1, 0xC49F, 0x81D2, - 0xC4A0, 0x81D3, 0xC4A1, 0x6479, 0xC4A2, 0x8611, 0xC4A3, 0x6A21, - 0xC4A4, 0x819C, 0xC4A5, 0x78E8, 0xC4A6, 0x6469, 0xC4A7, 0x9B54, - 0xC4A8, 0x62B9, 0xC4A9, 0x672B, 0xC4AA, 0x83AB, 0xC4AB, 0x58A8, - 0xC4AC, 0x9ED8, 0xC4AD, 0x6CAB, 0xC4AE, 0x6F20, 0xC4AF, 0x5BDE, - 0xC4B0, 0x964C, 0xC4B1, 0x8C0B, 0xC4B2, 0x725F, 0xC4B3, 0x67D0, - 0xC4B4, 0x62C7, 0xC4B5, 0x7261, 0xC4B6, 0x4EA9, 0xC4B7, 0x59C6, - 0xC4B8, 0x6BCD, 0xC4B9, 0x5893, 0xC4BA, 0x66AE, 0xC4BB, 0x5E55, - 0xC4BC, 0x52DF, 0xC4BD, 0x6155, 0xC4BE, 0x6728, 0xC4BF, 0x76EE, - 0xC4C0, 0x7766, 0xC4C1, 0x7267, 0xC4C2, 0x7A46, 0xC4C3, 0x62FF, - 0xC4C4, 0x54EA, 0xC4C5, 0x5450, 0xC4C6, 0x94A0, 0xC4C7, 0x90A3, - 0xC4C8, 0x5A1C, 0xC4C9, 0x7EB3, 0xC4CA, 0x6C16, 0xC4CB, 0x4E43, - 0xC4CC, 0x5976, 0xC4CD, 0x8010, 0xC4CE, 0x5948, 0xC4CF, 0x5357, - 0xC4D0, 0x7537, 0xC4D1, 0x96BE, 0xC4D2, 0x56CA, 0xC4D3, 0x6320, - 0xC4D4, 0x8111, 0xC4D5, 0x607C, 0xC4D6, 0x95F9, 0xC4D7, 0x6DD6, - 0xC4D8, 0x5462, 0xC4D9, 0x9981, 0xC4DA, 0x5185, 0xC4DB, 0x5AE9, - 0xC4DC, 0x80FD, 0xC4DD, 0x59AE, 0xC4DE, 0x9713, 0xC4DF, 0x502A, - 0xC4E0, 0x6CE5, 0xC4E1, 0x5C3C, 0xC4E2, 0x62DF, 0xC4E3, 0x4F60, - 0xC4E4, 0x533F, 0xC4E5, 0x817B, 0xC4E6, 0x9006, 0xC4E7, 0x6EBA, - 0xC4E8, 0x852B, 0xC4E9, 0x62C8, 0xC4EA, 0x5E74, 0xC4EB, 0x78BE, - 0xC4EC, 0x64B5, 0xC4ED, 0x637B, 0xC4EE, 0x5FF5, 0xC4EF, 0x5A18, - 0xC4F0, 0x917F, 0xC4F1, 0x9E1F, 0xC4F2, 0x5C3F, 0xC4F3, 0x634F, - 0xC4F4, 0x8042, 0xC4F5, 0x5B7D, 0xC4F6, 0x556E, 0xC4F7, 0x954A, - 0xC4F8, 0x954D, 0xC4F9, 0x6D85, 0xC4FA, 0x60A8, 0xC4FB, 0x67E0, - 0xC4FC, 0x72DE, 0xC4FD, 0x51DD, 0xC4FE, 0x5B81, 0xC540, 0x81D4, - 0xC541, 0x81D5, 0xC542, 0x81D6, 0xC543, 0x81D7, 0xC544, 0x81D8, - 0xC545, 0x81D9, 0xC546, 0x81DA, 0xC547, 0x81DB, 0xC548, 0x81DC, - 0xC549, 0x81DD, 0xC54A, 0x81DE, 0xC54B, 0x81DF, 0xC54C, 0x81E0, - 0xC54D, 0x81E1, 0xC54E, 0x81E2, 0xC54F, 0x81E4, 0xC550, 0x81E5, - 0xC551, 0x81E6, 0xC552, 0x81E8, 0xC553, 0x81E9, 0xC554, 0x81EB, - 0xC555, 0x81EE, 0xC556, 0x81EF, 0xC557, 0x81F0, 0xC558, 0x81F1, - 0xC559, 0x81F2, 0xC55A, 0x81F5, 0xC55B, 0x81F6, 0xC55C, 0x81F7, - 0xC55D, 0x81F8, 0xC55E, 0x81F9, 0xC55F, 0x81FA, 0xC560, 0x81FD, - 0xC561, 0x81FF, 0xC562, 0x8203, 0xC563, 0x8207, 0xC564, 0x8208, - 0xC565, 0x8209, 0xC566, 0x820A, 0xC567, 0x820B, 0xC568, 0x820E, - 0xC569, 0x820F, 0xC56A, 0x8211, 0xC56B, 0x8213, 0xC56C, 0x8215, - 0xC56D, 0x8216, 0xC56E, 0x8217, 0xC56F, 0x8218, 0xC570, 0x8219, - 0xC571, 0x821A, 0xC572, 0x821D, 0xC573, 0x8220, 0xC574, 0x8224, - 0xC575, 0x8225, 0xC576, 0x8226, 0xC577, 0x8227, 0xC578, 0x8229, - 0xC579, 0x822E, 0xC57A, 0x8232, 0xC57B, 0x823A, 0xC57C, 0x823C, - 0xC57D, 0x823D, 0xC57E, 0x823F, 0xC580, 0x8240, 0xC581, 0x8241, - 0xC582, 0x8242, 0xC583, 0x8243, 0xC584, 0x8245, 0xC585, 0x8246, - 0xC586, 0x8248, 0xC587, 0x824A, 0xC588, 0x824C, 0xC589, 0x824D, - 0xC58A, 0x824E, 0xC58B, 0x8250, 0xC58C, 0x8251, 0xC58D, 0x8252, - 0xC58E, 0x8253, 0xC58F, 0x8254, 0xC590, 0x8255, 0xC591, 0x8256, - 0xC592, 0x8257, 0xC593, 0x8259, 0xC594, 0x825B, 0xC595, 0x825C, - 0xC596, 0x825D, 0xC597, 0x825E, 0xC598, 0x8260, 0xC599, 0x8261, - 0xC59A, 0x8262, 0xC59B, 0x8263, 0xC59C, 0x8264, 0xC59D, 0x8265, - 0xC59E, 0x8266, 0xC59F, 0x8267, 0xC5A0, 0x8269, 0xC5A1, 0x62E7, - 0xC5A2, 0x6CDE, 0xC5A3, 0x725B, 0xC5A4, 0x626D, 0xC5A5, 0x94AE, - 0xC5A6, 0x7EBD, 0xC5A7, 0x8113, 0xC5A8, 0x6D53, 0xC5A9, 0x519C, - 0xC5AA, 0x5F04, 0xC5AB, 0x5974, 0xC5AC, 0x52AA, 0xC5AD, 0x6012, - 0xC5AE, 0x5973, 0xC5AF, 0x6696, 0xC5B0, 0x8650, 0xC5B1, 0x759F, - 0xC5B2, 0x632A, 0xC5B3, 0x61E6, 0xC5B4, 0x7CEF, 0xC5B5, 0x8BFA, - 0xC5B6, 0x54E6, 0xC5B7, 0x6B27, 0xC5B8, 0x9E25, 0xC5B9, 0x6BB4, - 0xC5BA, 0x85D5, 0xC5BB, 0x5455, 0xC5BC, 0x5076, 0xC5BD, 0x6CA4, - 0xC5BE, 0x556A, 0xC5BF, 0x8DB4, 0xC5C0, 0x722C, 0xC5C1, 0x5E15, - 0xC5C2, 0x6015, 0xC5C3, 0x7436, 0xC5C4, 0x62CD, 0xC5C5, 0x6392, - 0xC5C6, 0x724C, 0xC5C7, 0x5F98, 0xC5C8, 0x6E43, 0xC5C9, 0x6D3E, - 0xC5CA, 0x6500, 0xC5CB, 0x6F58, 0xC5CC, 0x76D8, 0xC5CD, 0x78D0, - 0xC5CE, 0x76FC, 0xC5CF, 0x7554, 0xC5D0, 0x5224, 0xC5D1, 0x53DB, - 0xC5D2, 0x4E53, 0xC5D3, 0x5E9E, 0xC5D4, 0x65C1, 0xC5D5, 0x802A, - 0xC5D6, 0x80D6, 0xC5D7, 0x629B, 0xC5D8, 0x5486, 0xC5D9, 0x5228, - 0xC5DA, 0x70AE, 0xC5DB, 0x888D, 0xC5DC, 0x8DD1, 0xC5DD, 0x6CE1, - 0xC5DE, 0x5478, 0xC5DF, 0x80DA, 0xC5E0, 0x57F9, 0xC5E1, 0x88F4, - 0xC5E2, 0x8D54, 0xC5E3, 0x966A, 0xC5E4, 0x914D, 0xC5E5, 0x4F69, - 0xC5E6, 0x6C9B, 0xC5E7, 0x55B7, 0xC5E8, 0x76C6, 0xC5E9, 0x7830, - 0xC5EA, 0x62A8, 0xC5EB, 0x70F9, 0xC5EC, 0x6F8E, 0xC5ED, 0x5F6D, - 0xC5EE, 0x84EC, 0xC5EF, 0x68DA, 0xC5F0, 0x787C, 0xC5F1, 0x7BF7, - 0xC5F2, 0x81A8, 0xC5F3, 0x670B, 0xC5F4, 0x9E4F, 0xC5F5, 0x6367, - 0xC5F6, 0x78B0, 0xC5F7, 0x576F, 0xC5F8, 0x7812, 0xC5F9, 0x9739, - 0xC5FA, 0x6279, 0xC5FB, 0x62AB, 0xC5FC, 0x5288, 0xC5FD, 0x7435, - 0xC5FE, 0x6BD7, 0xC640, 0x826A, 0xC641, 0x826B, 0xC642, 0x826C, - 0xC643, 0x826D, 0xC644, 0x8271, 0xC645, 0x8275, 0xC646, 0x8276, - 0xC647, 0x8277, 0xC648, 0x8278, 0xC649, 0x827B, 0xC64A, 0x827C, - 0xC64B, 0x8280, 0xC64C, 0x8281, 0xC64D, 0x8283, 0xC64E, 0x8285, - 0xC64F, 0x8286, 0xC650, 0x8287, 0xC651, 0x8289, 0xC652, 0x828C, - 0xC653, 0x8290, 0xC654, 0x8293, 0xC655, 0x8294, 0xC656, 0x8295, - 0xC657, 0x8296, 0xC658, 0x829A, 0xC659, 0x829B, 0xC65A, 0x829E, - 0xC65B, 0x82A0, 0xC65C, 0x82A2, 0xC65D, 0x82A3, 0xC65E, 0x82A7, - 0xC65F, 0x82B2, 0xC660, 0x82B5, 0xC661, 0x82B6, 0xC662, 0x82BA, - 0xC663, 0x82BB, 0xC664, 0x82BC, 0xC665, 0x82BF, 0xC666, 0x82C0, - 0xC667, 0x82C2, 0xC668, 0x82C3, 0xC669, 0x82C5, 0xC66A, 0x82C6, - 0xC66B, 0x82C9, 0xC66C, 0x82D0, 0xC66D, 0x82D6, 0xC66E, 0x82D9, - 0xC66F, 0x82DA, 0xC670, 0x82DD, 0xC671, 0x82E2, 0xC672, 0x82E7, - 0xC673, 0x82E8, 0xC674, 0x82E9, 0xC675, 0x82EA, 0xC676, 0x82EC, - 0xC677, 0x82ED, 0xC678, 0x82EE, 0xC679, 0x82F0, 0xC67A, 0x82F2, - 0xC67B, 0x82F3, 0xC67C, 0x82F5, 0xC67D, 0x82F6, 0xC67E, 0x82F8, - 0xC680, 0x82FA, 0xC681, 0x82FC, 0xC682, 0x82FD, 0xC683, 0x82FE, - 0xC684, 0x82FF, 0xC685, 0x8300, 0xC686, 0x830A, 0xC687, 0x830B, - 0xC688, 0x830D, 0xC689, 0x8310, 0xC68A, 0x8312, 0xC68B, 0x8313, - 0xC68C, 0x8316, 0xC68D, 0x8318, 0xC68E, 0x8319, 0xC68F, 0x831D, - 0xC690, 0x831E, 0xC691, 0x831F, 0xC692, 0x8320, 0xC693, 0x8321, - 0xC694, 0x8322, 0xC695, 0x8323, 0xC696, 0x8324, 0xC697, 0x8325, - 0xC698, 0x8326, 0xC699, 0x8329, 0xC69A, 0x832A, 0xC69B, 0x832E, - 0xC69C, 0x8330, 0xC69D, 0x8332, 0xC69E, 0x8337, 0xC69F, 0x833B, - 0xC6A0, 0x833D, 0xC6A1, 0x5564, 0xC6A2, 0x813E, 0xC6A3, 0x75B2, - 0xC6A4, 0x76AE, 0xC6A5, 0x5339, 0xC6A6, 0x75DE, 0xC6A7, 0x50FB, - 0xC6A8, 0x5C41, 0xC6A9, 0x8B6C, 0xC6AA, 0x7BC7, 0xC6AB, 0x504F, - 0xC6AC, 0x7247, 0xC6AD, 0x9A97, 0xC6AE, 0x98D8, 0xC6AF, 0x6F02, - 0xC6B0, 0x74E2, 0xC6B1, 0x7968, 0xC6B2, 0x6487, 0xC6B3, 0x77A5, - 0xC6B4, 0x62FC, 0xC6B5, 0x9891, 0xC6B6, 0x8D2B, 0xC6B7, 0x54C1, - 0xC6B8, 0x8058, 0xC6B9, 0x4E52, 0xC6BA, 0x576A, 0xC6BB, 0x82F9, - 0xC6BC, 0x840D, 0xC6BD, 0x5E73, 0xC6BE, 0x51ED, 0xC6BF, 0x74F6, - 0xC6C0, 0x8BC4, 0xC6C1, 0x5C4F, 0xC6C2, 0x5761, 0xC6C3, 0x6CFC, - 0xC6C4, 0x9887, 0xC6C5, 0x5A46, 0xC6C6, 0x7834, 0xC6C7, 0x9B44, - 0xC6C8, 0x8FEB, 0xC6C9, 0x7C95, 0xC6CA, 0x5256, 0xC6CB, 0x6251, - 0xC6CC, 0x94FA, 0xC6CD, 0x4EC6, 0xC6CE, 0x8386, 0xC6CF, 0x8461, - 0xC6D0, 0x83E9, 0xC6D1, 0x84B2, 0xC6D2, 0x57D4, 0xC6D3, 0x6734, - 0xC6D4, 0x5703, 0xC6D5, 0x666E, 0xC6D6, 0x6D66, 0xC6D7, 0x8C31, - 0xC6D8, 0x66DD, 0xC6D9, 0x7011, 0xC6DA, 0x671F, 0xC6DB, 0x6B3A, - 0xC6DC, 0x6816, 0xC6DD, 0x621A, 0xC6DE, 0x59BB, 0xC6DF, 0x4E03, - 0xC6E0, 0x51C4, 0xC6E1, 0x6F06, 0xC6E2, 0x67D2, 0xC6E3, 0x6C8F, - 0xC6E4, 0x5176, 0xC6E5, 0x68CB, 0xC6E6, 0x5947, 0xC6E7, 0x6B67, - 0xC6E8, 0x7566, 0xC6E9, 0x5D0E, 0xC6EA, 0x8110, 0xC6EB, 0x9F50, - 0xC6EC, 0x65D7, 0xC6ED, 0x7948, 0xC6EE, 0x7941, 0xC6EF, 0x9A91, - 0xC6F0, 0x8D77, 0xC6F1, 0x5C82, 0xC6F2, 0x4E5E, 0xC6F3, 0x4F01, - 0xC6F4, 0x542F, 0xC6F5, 0x5951, 0xC6F6, 0x780C, 0xC6F7, 0x5668, - 0xC6F8, 0x6C14, 0xC6F9, 0x8FC4, 0xC6FA, 0x5F03, 0xC6FB, 0x6C7D, - 0xC6FC, 0x6CE3, 0xC6FD, 0x8BAB, 0xC6FE, 0x6390, 0xC740, 0x833E, - 0xC741, 0x833F, 0xC742, 0x8341, 0xC743, 0x8342, 0xC744, 0x8344, - 0xC745, 0x8345, 0xC746, 0x8348, 0xC747, 0x834A, 0xC748, 0x834B, - 0xC749, 0x834C, 0xC74A, 0x834D, 0xC74B, 0x834E, 0xC74C, 0x8353, - 0xC74D, 0x8355, 0xC74E, 0x8356, 0xC74F, 0x8357, 0xC750, 0x8358, - 0xC751, 0x8359, 0xC752, 0x835D, 0xC753, 0x8362, 0xC754, 0x8370, - 0xC755, 0x8371, 0xC756, 0x8372, 0xC757, 0x8373, 0xC758, 0x8374, - 0xC759, 0x8375, 0xC75A, 0x8376, 0xC75B, 0x8379, 0xC75C, 0x837A, - 0xC75D, 0x837E, 0xC75E, 0x837F, 0xC75F, 0x8380, 0xC760, 0x8381, - 0xC761, 0x8382, 0xC762, 0x8383, 0xC763, 0x8384, 0xC764, 0x8387, - 0xC765, 0x8388, 0xC766, 0x838A, 0xC767, 0x838B, 0xC768, 0x838C, - 0xC769, 0x838D, 0xC76A, 0x838F, 0xC76B, 0x8390, 0xC76C, 0x8391, - 0xC76D, 0x8394, 0xC76E, 0x8395, 0xC76F, 0x8396, 0xC770, 0x8397, - 0xC771, 0x8399, 0xC772, 0x839A, 0xC773, 0x839D, 0xC774, 0x839F, - 0xC775, 0x83A1, 0xC776, 0x83A2, 0xC777, 0x83A3, 0xC778, 0x83A4, - 0xC779, 0x83A5, 0xC77A, 0x83A6, 0xC77B, 0x83A7, 0xC77C, 0x83AC, - 0xC77D, 0x83AD, 0xC77E, 0x83AE, 0xC780, 0x83AF, 0xC781, 0x83B5, - 0xC782, 0x83BB, 0xC783, 0x83BE, 0xC784, 0x83BF, 0xC785, 0x83C2, - 0xC786, 0x83C3, 0xC787, 0x83C4, 0xC788, 0x83C6, 0xC789, 0x83C8, - 0xC78A, 0x83C9, 0xC78B, 0x83CB, 0xC78C, 0x83CD, 0xC78D, 0x83CE, - 0xC78E, 0x83D0, 0xC78F, 0x83D1, 0xC790, 0x83D2, 0xC791, 0x83D3, - 0xC792, 0x83D5, 0xC793, 0x83D7, 0xC794, 0x83D9, 0xC795, 0x83DA, - 0xC796, 0x83DB, 0xC797, 0x83DE, 0xC798, 0x83E2, 0xC799, 0x83E3, - 0xC79A, 0x83E4, 0xC79B, 0x83E6, 0xC79C, 0x83E7, 0xC79D, 0x83E8, - 0xC79E, 0x83EB, 0xC79F, 0x83EC, 0xC7A0, 0x83ED, 0xC7A1, 0x6070, - 0xC7A2, 0x6D3D, 0xC7A3, 0x7275, 0xC7A4, 0x6266, 0xC7A5, 0x948E, - 0xC7A6, 0x94C5, 0xC7A7, 0x5343, 0xC7A8, 0x8FC1, 0xC7A9, 0x7B7E, - 0xC7AA, 0x4EDF, 0xC7AB, 0x8C26, 0xC7AC, 0x4E7E, 0xC7AD, 0x9ED4, - 0xC7AE, 0x94B1, 0xC7AF, 0x94B3, 0xC7B0, 0x524D, 0xC7B1, 0x6F5C, - 0xC7B2, 0x9063, 0xC7B3, 0x6D45, 0xC7B4, 0x8C34, 0xC7B5, 0x5811, - 0xC7B6, 0x5D4C, 0xC7B7, 0x6B20, 0xC7B8, 0x6B49, 0xC7B9, 0x67AA, - 0xC7BA, 0x545B, 0xC7BB, 0x8154, 0xC7BC, 0x7F8C, 0xC7BD, 0x5899, - 0xC7BE, 0x8537, 0xC7BF, 0x5F3A, 0xC7C0, 0x62A2, 0xC7C1, 0x6A47, - 0xC7C2, 0x9539, 0xC7C3, 0x6572, 0xC7C4, 0x6084, 0xC7C5, 0x6865, - 0xC7C6, 0x77A7, 0xC7C7, 0x4E54, 0xC7C8, 0x4FA8, 0xC7C9, 0x5DE7, - 0xC7CA, 0x9798, 0xC7CB, 0x64AC, 0xC7CC, 0x7FD8, 0xC7CD, 0x5CED, - 0xC7CE, 0x4FCF, 0xC7CF, 0x7A8D, 0xC7D0, 0x5207, 0xC7D1, 0x8304, - 0xC7D2, 0x4E14, 0xC7D3, 0x602F, 0xC7D4, 0x7A83, 0xC7D5, 0x94A6, - 0xC7D6, 0x4FB5, 0xC7D7, 0x4EB2, 0xC7D8, 0x79E6, 0xC7D9, 0x7434, - 0xC7DA, 0x52E4, 0xC7DB, 0x82B9, 0xC7DC, 0x64D2, 0xC7DD, 0x79BD, - 0xC7DE, 0x5BDD, 0xC7DF, 0x6C81, 0xC7E0, 0x9752, 0xC7E1, 0x8F7B, - 0xC7E2, 0x6C22, 0xC7E3, 0x503E, 0xC7E4, 0x537F, 0xC7E5, 0x6E05, - 0xC7E6, 0x64CE, 0xC7E7, 0x6674, 0xC7E8, 0x6C30, 0xC7E9, 0x60C5, - 0xC7EA, 0x9877, 0xC7EB, 0x8BF7, 0xC7EC, 0x5E86, 0xC7ED, 0x743C, - 0xC7EE, 0x7A77, 0xC7EF, 0x79CB, 0xC7F0, 0x4E18, 0xC7F1, 0x90B1, - 0xC7F2, 0x7403, 0xC7F3, 0x6C42, 0xC7F4, 0x56DA, 0xC7F5, 0x914B, - 0xC7F6, 0x6CC5, 0xC7F7, 0x8D8B, 0xC7F8, 0x533A, 0xC7F9, 0x86C6, - 0xC7FA, 0x66F2, 0xC7FB, 0x8EAF, 0xC7FC, 0x5C48, 0xC7FD, 0x9A71, - 0xC7FE, 0x6E20, 0xC840, 0x83EE, 0xC841, 0x83EF, 0xC842, 0x83F3, - 0xC843, 0x83F4, 0xC844, 0x83F5, 0xC845, 0x83F6, 0xC846, 0x83F7, - 0xC847, 0x83FA, 0xC848, 0x83FB, 0xC849, 0x83FC, 0xC84A, 0x83FE, - 0xC84B, 0x83FF, 0xC84C, 0x8400, 0xC84D, 0x8402, 0xC84E, 0x8405, - 0xC84F, 0x8407, 0xC850, 0x8408, 0xC851, 0x8409, 0xC852, 0x840A, - 0xC853, 0x8410, 0xC854, 0x8412, 0xC855, 0x8413, 0xC856, 0x8414, - 0xC857, 0x8415, 0xC858, 0x8416, 0xC859, 0x8417, 0xC85A, 0x8419, - 0xC85B, 0x841A, 0xC85C, 0x841B, 0xC85D, 0x841E, 0xC85E, 0x841F, - 0xC85F, 0x8420, 0xC860, 0x8421, 0xC861, 0x8422, 0xC862, 0x8423, - 0xC863, 0x8429, 0xC864, 0x842A, 0xC865, 0x842B, 0xC866, 0x842C, - 0xC867, 0x842D, 0xC868, 0x842E, 0xC869, 0x842F, 0xC86A, 0x8430, - 0xC86B, 0x8432, 0xC86C, 0x8433, 0xC86D, 0x8434, 0xC86E, 0x8435, - 0xC86F, 0x8436, 0xC870, 0x8437, 0xC871, 0x8439, 0xC872, 0x843A, - 0xC873, 0x843B, 0xC874, 0x843E, 0xC875, 0x843F, 0xC876, 0x8440, - 0xC877, 0x8441, 0xC878, 0x8442, 0xC879, 0x8443, 0xC87A, 0x8444, - 0xC87B, 0x8445, 0xC87C, 0x8447, 0xC87D, 0x8448, 0xC87E, 0x8449, - 0xC880, 0x844A, 0xC881, 0x844B, 0xC882, 0x844C, 0xC883, 0x844D, - 0xC884, 0x844E, 0xC885, 0x844F, 0xC886, 0x8450, 0xC887, 0x8452, - 0xC888, 0x8453, 0xC889, 0x8454, 0xC88A, 0x8455, 0xC88B, 0x8456, - 0xC88C, 0x8458, 0xC88D, 0x845D, 0xC88E, 0x845E, 0xC88F, 0x845F, - 0xC890, 0x8460, 0xC891, 0x8462, 0xC892, 0x8464, 0xC893, 0x8465, - 0xC894, 0x8466, 0xC895, 0x8467, 0xC896, 0x8468, 0xC897, 0x846A, - 0xC898, 0x846E, 0xC899, 0x846F, 0xC89A, 0x8470, 0xC89B, 0x8472, - 0xC89C, 0x8474, 0xC89D, 0x8477, 0xC89E, 0x8479, 0xC89F, 0x847B, - 0xC8A0, 0x847C, 0xC8A1, 0x53D6, 0xC8A2, 0x5A36, 0xC8A3, 0x9F8B, - 0xC8A4, 0x8DA3, 0xC8A5, 0x53BB, 0xC8A6, 0x5708, 0xC8A7, 0x98A7, - 0xC8A8, 0x6743, 0xC8A9, 0x919B, 0xC8AA, 0x6CC9, 0xC8AB, 0x5168, - 0xC8AC, 0x75CA, 0xC8AD, 0x62F3, 0xC8AE, 0x72AC, 0xC8AF, 0x5238, - 0xC8B0, 0x529D, 0xC8B1, 0x7F3A, 0xC8B2, 0x7094, 0xC8B3, 0x7638, - 0xC8B4, 0x5374, 0xC8B5, 0x9E4A, 0xC8B6, 0x69B7, 0xC8B7, 0x786E, - 0xC8B8, 0x96C0, 0xC8B9, 0x88D9, 0xC8BA, 0x7FA4, 0xC8BB, 0x7136, - 0xC8BC, 0x71C3, 0xC8BD, 0x5189, 0xC8BE, 0x67D3, 0xC8BF, 0x74E4, - 0xC8C0, 0x58E4, 0xC8C1, 0x6518, 0xC8C2, 0x56B7, 0xC8C3, 0x8BA9, - 0xC8C4, 0x9976, 0xC8C5, 0x6270, 0xC8C6, 0x7ED5, 0xC8C7, 0x60F9, - 0xC8C8, 0x70ED, 0xC8C9, 0x58EC, 0xC8CA, 0x4EC1, 0xC8CB, 0x4EBA, - 0xC8CC, 0x5FCD, 0xC8CD, 0x97E7, 0xC8CE, 0x4EFB, 0xC8CF, 0x8BA4, - 0xC8D0, 0x5203, 0xC8D1, 0x598A, 0xC8D2, 0x7EAB, 0xC8D3, 0x6254, - 0xC8D4, 0x4ECD, 0xC8D5, 0x65E5, 0xC8D6, 0x620E, 0xC8D7, 0x8338, - 0xC8D8, 0x84C9, 0xC8D9, 0x8363, 0xC8DA, 0x878D, 0xC8DB, 0x7194, - 0xC8DC, 0x6EB6, 0xC8DD, 0x5BB9, 0xC8DE, 0x7ED2, 0xC8DF, 0x5197, - 0xC8E0, 0x63C9, 0xC8E1, 0x67D4, 0xC8E2, 0x8089, 0xC8E3, 0x8339, - 0xC8E4, 0x8815, 0xC8E5, 0x5112, 0xC8E6, 0x5B7A, 0xC8E7, 0x5982, - 0xC8E8, 0x8FB1, 0xC8E9, 0x4E73, 0xC8EA, 0x6C5D, 0xC8EB, 0x5165, - 0xC8EC, 0x8925, 0xC8ED, 0x8F6F, 0xC8EE, 0x962E, 0xC8EF, 0x854A, - 0xC8F0, 0x745E, 0xC8F1, 0x9510, 0xC8F2, 0x95F0, 0xC8F3, 0x6DA6, - 0xC8F4, 0x82E5, 0xC8F5, 0x5F31, 0xC8F6, 0x6492, 0xC8F7, 0x6D12, - 0xC8F8, 0x8428, 0xC8F9, 0x816E, 0xC8FA, 0x9CC3, 0xC8FB, 0x585E, - 0xC8FC, 0x8D5B, 0xC8FD, 0x4E09, 0xC8FE, 0x53C1, 0xC940, 0x847D, - 0xC941, 0x847E, 0xC942, 0x847F, 0xC943, 0x8480, 0xC944, 0x8481, - 0xC945, 0x8483, 0xC946, 0x8484, 0xC947, 0x8485, 0xC948, 0x8486, - 0xC949, 0x848A, 0xC94A, 0x848D, 0xC94B, 0x848F, 0xC94C, 0x8490, - 0xC94D, 0x8491, 0xC94E, 0x8492, 0xC94F, 0x8493, 0xC950, 0x8494, - 0xC951, 0x8495, 0xC952, 0x8496, 0xC953, 0x8498, 0xC954, 0x849A, - 0xC955, 0x849B, 0xC956, 0x849D, 0xC957, 0x849E, 0xC958, 0x849F, - 0xC959, 0x84A0, 0xC95A, 0x84A2, 0xC95B, 0x84A3, 0xC95C, 0x84A4, - 0xC95D, 0x84A5, 0xC95E, 0x84A6, 0xC95F, 0x84A7, 0xC960, 0x84A8, - 0xC961, 0x84A9, 0xC962, 0x84AA, 0xC963, 0x84AB, 0xC964, 0x84AC, - 0xC965, 0x84AD, 0xC966, 0x84AE, 0xC967, 0x84B0, 0xC968, 0x84B1, - 0xC969, 0x84B3, 0xC96A, 0x84B5, 0xC96B, 0x84B6, 0xC96C, 0x84B7, - 0xC96D, 0x84BB, 0xC96E, 0x84BC, 0xC96F, 0x84BE, 0xC970, 0x84C0, - 0xC971, 0x84C2, 0xC972, 0x84C3, 0xC973, 0x84C5, 0xC974, 0x84C6, - 0xC975, 0x84C7, 0xC976, 0x84C8, 0xC977, 0x84CB, 0xC978, 0x84CC, - 0xC979, 0x84CE, 0xC97A, 0x84CF, 0xC97B, 0x84D2, 0xC97C, 0x84D4, - 0xC97D, 0x84D5, 0xC97E, 0x84D7, 0xC980, 0x84D8, 0xC981, 0x84D9, - 0xC982, 0x84DA, 0xC983, 0x84DB, 0xC984, 0x84DC, 0xC985, 0x84DE, - 0xC986, 0x84E1, 0xC987, 0x84E2, 0xC988, 0x84E4, 0xC989, 0x84E7, - 0xC98A, 0x84E8, 0xC98B, 0x84E9, 0xC98C, 0x84EA, 0xC98D, 0x84EB, - 0xC98E, 0x84ED, 0xC98F, 0x84EE, 0xC990, 0x84EF, 0xC991, 0x84F1, - 0xC992, 0x84F2, 0xC993, 0x84F3, 0xC994, 0x84F4, 0xC995, 0x84F5, - 0xC996, 0x84F6, 0xC997, 0x84F7, 0xC998, 0x84F8, 0xC999, 0x84F9, - 0xC99A, 0x84FA, 0xC99B, 0x84FB, 0xC99C, 0x84FD, 0xC99D, 0x84FE, - 0xC99E, 0x8500, 0xC99F, 0x8501, 0xC9A0, 0x8502, 0xC9A1, 0x4F1E, - 0xC9A2, 0x6563, 0xC9A3, 0x6851, 0xC9A4, 0x55D3, 0xC9A5, 0x4E27, - 0xC9A6, 0x6414, 0xC9A7, 0x9A9A, 0xC9A8, 0x626B, 0xC9A9, 0x5AC2, - 0xC9AA, 0x745F, 0xC9AB, 0x8272, 0xC9AC, 0x6DA9, 0xC9AD, 0x68EE, - 0xC9AE, 0x50E7, 0xC9AF, 0x838E, 0xC9B0, 0x7802, 0xC9B1, 0x6740, - 0xC9B2, 0x5239, 0xC9B3, 0x6C99, 0xC9B4, 0x7EB1, 0xC9B5, 0x50BB, - 0xC9B6, 0x5565, 0xC9B7, 0x715E, 0xC9B8, 0x7B5B, 0xC9B9, 0x6652, - 0xC9BA, 0x73CA, 0xC9BB, 0x82EB, 0xC9BC, 0x6749, 0xC9BD, 0x5C71, - 0xC9BE, 0x5220, 0xC9BF, 0x717D, 0xC9C0, 0x886B, 0xC9C1, 0x95EA, - 0xC9C2, 0x9655, 0xC9C3, 0x64C5, 0xC9C4, 0x8D61, 0xC9C5, 0x81B3, - 0xC9C6, 0x5584, 0xC9C7, 0x6C55, 0xC9C8, 0x6247, 0xC9C9, 0x7F2E, - 0xC9CA, 0x5892, 0xC9CB, 0x4F24, 0xC9CC, 0x5546, 0xC9CD, 0x8D4F, - 0xC9CE, 0x664C, 0xC9CF, 0x4E0A, 0xC9D0, 0x5C1A, 0xC9D1, 0x88F3, - 0xC9D2, 0x68A2, 0xC9D3, 0x634E, 0xC9D4, 0x7A0D, 0xC9D5, 0x70E7, - 0xC9D6, 0x828D, 0xC9D7, 0x52FA, 0xC9D8, 0x97F6, 0xC9D9, 0x5C11, - 0xC9DA, 0x54E8, 0xC9DB, 0x90B5, 0xC9DC, 0x7ECD, 0xC9DD, 0x5962, - 0xC9DE, 0x8D4A, 0xC9DF, 0x86C7, 0xC9E0, 0x820C, 0xC9E1, 0x820D, - 0xC9E2, 0x8D66, 0xC9E3, 0x6444, 0xC9E4, 0x5C04, 0xC9E5, 0x6151, - 0xC9E6, 0x6D89, 0xC9E7, 0x793E, 0xC9E8, 0x8BBE, 0xC9E9, 0x7837, - 0xC9EA, 0x7533, 0xC9EB, 0x547B, 0xC9EC, 0x4F38, 0xC9ED, 0x8EAB, - 0xC9EE, 0x6DF1, 0xC9EF, 0x5A20, 0xC9F0, 0x7EC5, 0xC9F1, 0x795E, - 0xC9F2, 0x6C88, 0xC9F3, 0x5BA1, 0xC9F4, 0x5A76, 0xC9F5, 0x751A, - 0xC9F6, 0x80BE, 0xC9F7, 0x614E, 0xC9F8, 0x6E17, 0xC9F9, 0x58F0, - 0xC9FA, 0x751F, 0xC9FB, 0x7525, 0xC9FC, 0x7272, 0xC9FD, 0x5347, - 0xC9FE, 0x7EF3, 0xCA40, 0x8503, 0xCA41, 0x8504, 0xCA42, 0x8505, - 0xCA43, 0x8506, 0xCA44, 0x8507, 0xCA45, 0x8508, 0xCA46, 0x8509, - 0xCA47, 0x850A, 0xCA48, 0x850B, 0xCA49, 0x850D, 0xCA4A, 0x850E, - 0xCA4B, 0x850F, 0xCA4C, 0x8510, 0xCA4D, 0x8512, 0xCA4E, 0x8514, - 0xCA4F, 0x8515, 0xCA50, 0x8516, 0xCA51, 0x8518, 0xCA52, 0x8519, - 0xCA53, 0x851B, 0xCA54, 0x851C, 0xCA55, 0x851D, 0xCA56, 0x851E, - 0xCA57, 0x8520, 0xCA58, 0x8522, 0xCA59, 0x8523, 0xCA5A, 0x8524, - 0xCA5B, 0x8525, 0xCA5C, 0x8526, 0xCA5D, 0x8527, 0xCA5E, 0x8528, - 0xCA5F, 0x8529, 0xCA60, 0x852A, 0xCA61, 0x852D, 0xCA62, 0x852E, - 0xCA63, 0x852F, 0xCA64, 0x8530, 0xCA65, 0x8531, 0xCA66, 0x8532, - 0xCA67, 0x8533, 0xCA68, 0x8534, 0xCA69, 0x8535, 0xCA6A, 0x8536, - 0xCA6B, 0x853E, 0xCA6C, 0x853F, 0xCA6D, 0x8540, 0xCA6E, 0x8541, - 0xCA6F, 0x8542, 0xCA70, 0x8544, 0xCA71, 0x8545, 0xCA72, 0x8546, - 0xCA73, 0x8547, 0xCA74, 0x854B, 0xCA75, 0x854C, 0xCA76, 0x854D, - 0xCA77, 0x854E, 0xCA78, 0x854F, 0xCA79, 0x8550, 0xCA7A, 0x8551, - 0xCA7B, 0x8552, 0xCA7C, 0x8553, 0xCA7D, 0x8554, 0xCA7E, 0x8555, - 0xCA80, 0x8557, 0xCA81, 0x8558, 0xCA82, 0x855A, 0xCA83, 0x855B, - 0xCA84, 0x855C, 0xCA85, 0x855D, 0xCA86, 0x855F, 0xCA87, 0x8560, - 0xCA88, 0x8561, 0xCA89, 0x8562, 0xCA8A, 0x8563, 0xCA8B, 0x8565, - 0xCA8C, 0x8566, 0xCA8D, 0x8567, 0xCA8E, 0x8569, 0xCA8F, 0x856A, - 0xCA90, 0x856B, 0xCA91, 0x856C, 0xCA92, 0x856D, 0xCA93, 0x856E, - 0xCA94, 0x856F, 0xCA95, 0x8570, 0xCA96, 0x8571, 0xCA97, 0x8573, - 0xCA98, 0x8575, 0xCA99, 0x8576, 0xCA9A, 0x8577, 0xCA9B, 0x8578, - 0xCA9C, 0x857C, 0xCA9D, 0x857D, 0xCA9E, 0x857F, 0xCA9F, 0x8580, - 0xCAA0, 0x8581, 0xCAA1, 0x7701, 0xCAA2, 0x76DB, 0xCAA3, 0x5269, - 0xCAA4, 0x80DC, 0xCAA5, 0x5723, 0xCAA6, 0x5E08, 0xCAA7, 0x5931, - 0xCAA8, 0x72EE, 0xCAA9, 0x65BD, 0xCAAA, 0x6E7F, 0xCAAB, 0x8BD7, - 0xCAAC, 0x5C38, 0xCAAD, 0x8671, 0xCAAE, 0x5341, 0xCAAF, 0x77F3, - 0xCAB0, 0x62FE, 0xCAB1, 0x65F6, 0xCAB2, 0x4EC0, 0xCAB3, 0x98DF, - 0xCAB4, 0x8680, 0xCAB5, 0x5B9E, 0xCAB6, 0x8BC6, 0xCAB7, 0x53F2, - 0xCAB8, 0x77E2, 0xCAB9, 0x4F7F, 0xCABA, 0x5C4E, 0xCABB, 0x9A76, - 0xCABC, 0x59CB, 0xCABD, 0x5F0F, 0xCABE, 0x793A, 0xCABF, 0x58EB, - 0xCAC0, 0x4E16, 0xCAC1, 0x67FF, 0xCAC2, 0x4E8B, 0xCAC3, 0x62ED, - 0xCAC4, 0x8A93, 0xCAC5, 0x901D, 0xCAC6, 0x52BF, 0xCAC7, 0x662F, - 0xCAC8, 0x55DC, 0xCAC9, 0x566C, 0xCACA, 0x9002, 0xCACB, 0x4ED5, - 0xCACC, 0x4F8D, 0xCACD, 0x91CA, 0xCACE, 0x9970, 0xCACF, 0x6C0F, - 0xCAD0, 0x5E02, 0xCAD1, 0x6043, 0xCAD2, 0x5BA4, 0xCAD3, 0x89C6, - 0xCAD4, 0x8BD5, 0xCAD5, 0x6536, 0xCAD6, 0x624B, 0xCAD7, 0x9996, - 0xCAD8, 0x5B88, 0xCAD9, 0x5BFF, 0xCADA, 0x6388, 0xCADB, 0x552E, - 0xCADC, 0x53D7, 0xCADD, 0x7626, 0xCADE, 0x517D, 0xCADF, 0x852C, - 0xCAE0, 0x67A2, 0xCAE1, 0x68B3, 0xCAE2, 0x6B8A, 0xCAE3, 0x6292, - 0xCAE4, 0x8F93, 0xCAE5, 0x53D4, 0xCAE6, 0x8212, 0xCAE7, 0x6DD1, - 0xCAE8, 0x758F, 0xCAE9, 0x4E66, 0xCAEA, 0x8D4E, 0xCAEB, 0x5B70, - 0xCAEC, 0x719F, 0xCAED, 0x85AF, 0xCAEE, 0x6691, 0xCAEF, 0x66D9, - 0xCAF0, 0x7F72, 0xCAF1, 0x8700, 0xCAF2, 0x9ECD, 0xCAF3, 0x9F20, - 0xCAF4, 0x5C5E, 0xCAF5, 0x672F, 0xCAF6, 0x8FF0, 0xCAF7, 0x6811, - 0xCAF8, 0x675F, 0xCAF9, 0x620D, 0xCAFA, 0x7AD6, 0xCAFB, 0x5885, - 0xCAFC, 0x5EB6, 0xCAFD, 0x6570, 0xCAFE, 0x6F31, 0xCB40, 0x8582, - 0xCB41, 0x8583, 0xCB42, 0x8586, 0xCB43, 0x8588, 0xCB44, 0x8589, - 0xCB45, 0x858A, 0xCB46, 0x858B, 0xCB47, 0x858C, 0xCB48, 0x858D, - 0xCB49, 0x858E, 0xCB4A, 0x8590, 0xCB4B, 0x8591, 0xCB4C, 0x8592, - 0xCB4D, 0x8593, 0xCB4E, 0x8594, 0xCB4F, 0x8595, 0xCB50, 0x8596, - 0xCB51, 0x8597, 0xCB52, 0x8598, 0xCB53, 0x8599, 0xCB54, 0x859A, - 0xCB55, 0x859D, 0xCB56, 0x859E, 0xCB57, 0x859F, 0xCB58, 0x85A0, - 0xCB59, 0x85A1, 0xCB5A, 0x85A2, 0xCB5B, 0x85A3, 0xCB5C, 0x85A5, - 0xCB5D, 0x85A6, 0xCB5E, 0x85A7, 0xCB5F, 0x85A9, 0xCB60, 0x85AB, - 0xCB61, 0x85AC, 0xCB62, 0x85AD, 0xCB63, 0x85B1, 0xCB64, 0x85B2, - 0xCB65, 0x85B3, 0xCB66, 0x85B4, 0xCB67, 0x85B5, 0xCB68, 0x85B6, - 0xCB69, 0x85B8, 0xCB6A, 0x85BA, 0xCB6B, 0x85BB, 0xCB6C, 0x85BC, - 0xCB6D, 0x85BD, 0xCB6E, 0x85BE, 0xCB6F, 0x85BF, 0xCB70, 0x85C0, - 0xCB71, 0x85C2, 0xCB72, 0x85C3, 0xCB73, 0x85C4, 0xCB74, 0x85C5, - 0xCB75, 0x85C6, 0xCB76, 0x85C7, 0xCB77, 0x85C8, 0xCB78, 0x85CA, - 0xCB79, 0x85CB, 0xCB7A, 0x85CC, 0xCB7B, 0x85CD, 0xCB7C, 0x85CE, - 0xCB7D, 0x85D1, 0xCB7E, 0x85D2, 0xCB80, 0x85D4, 0xCB81, 0x85D6, - 0xCB82, 0x85D7, 0xCB83, 0x85D8, 0xCB84, 0x85D9, 0xCB85, 0x85DA, - 0xCB86, 0x85DB, 0xCB87, 0x85DD, 0xCB88, 0x85DE, 0xCB89, 0x85DF, - 0xCB8A, 0x85E0, 0xCB8B, 0x85E1, 0xCB8C, 0x85E2, 0xCB8D, 0x85E3, - 0xCB8E, 0x85E5, 0xCB8F, 0x85E6, 0xCB90, 0x85E7, 0xCB91, 0x85E8, - 0xCB92, 0x85EA, 0xCB93, 0x85EB, 0xCB94, 0x85EC, 0xCB95, 0x85ED, - 0xCB96, 0x85EE, 0xCB97, 0x85EF, 0xCB98, 0x85F0, 0xCB99, 0x85F1, - 0xCB9A, 0x85F2, 0xCB9B, 0x85F3, 0xCB9C, 0x85F4, 0xCB9D, 0x85F5, - 0xCB9E, 0x85F6, 0xCB9F, 0x85F7, 0xCBA0, 0x85F8, 0xCBA1, 0x6055, - 0xCBA2, 0x5237, 0xCBA3, 0x800D, 0xCBA4, 0x6454, 0xCBA5, 0x8870, - 0xCBA6, 0x7529, 0xCBA7, 0x5E05, 0xCBA8, 0x6813, 0xCBA9, 0x62F4, - 0xCBAA, 0x971C, 0xCBAB, 0x53CC, 0xCBAC, 0x723D, 0xCBAD, 0x8C01, - 0xCBAE, 0x6C34, 0xCBAF, 0x7761, 0xCBB0, 0x7A0E, 0xCBB1, 0x542E, - 0xCBB2, 0x77AC, 0xCBB3, 0x987A, 0xCBB4, 0x821C, 0xCBB5, 0x8BF4, - 0xCBB6, 0x7855, 0xCBB7, 0x6714, 0xCBB8, 0x70C1, 0xCBB9, 0x65AF, - 0xCBBA, 0x6495, 0xCBBB, 0x5636, 0xCBBC, 0x601D, 0xCBBD, 0x79C1, - 0xCBBE, 0x53F8, 0xCBBF, 0x4E1D, 0xCBC0, 0x6B7B, 0xCBC1, 0x8086, - 0xCBC2, 0x5BFA, 0xCBC3, 0x55E3, 0xCBC4, 0x56DB, 0xCBC5, 0x4F3A, - 0xCBC6, 0x4F3C, 0xCBC7, 0x9972, 0xCBC8, 0x5DF3, 0xCBC9, 0x677E, - 0xCBCA, 0x8038, 0xCBCB, 0x6002, 0xCBCC, 0x9882, 0xCBCD, 0x9001, - 0xCBCE, 0x5B8B, 0xCBCF, 0x8BBC, 0xCBD0, 0x8BF5, 0xCBD1, 0x641C, - 0xCBD2, 0x8258, 0xCBD3, 0x64DE, 0xCBD4, 0x55FD, 0xCBD5, 0x82CF, - 0xCBD6, 0x9165, 0xCBD7, 0x4FD7, 0xCBD8, 0x7D20, 0xCBD9, 0x901F, - 0xCBDA, 0x7C9F, 0xCBDB, 0x50F3, 0xCBDC, 0x5851, 0xCBDD, 0x6EAF, - 0xCBDE, 0x5BBF, 0xCBDF, 0x8BC9, 0xCBE0, 0x8083, 0xCBE1, 0x9178, - 0xCBE2, 0x849C, 0xCBE3, 0x7B97, 0xCBE4, 0x867D, 0xCBE5, 0x968B, - 0xCBE6, 0x968F, 0xCBE7, 0x7EE5, 0xCBE8, 0x9AD3, 0xCBE9, 0x788E, - 0xCBEA, 0x5C81, 0xCBEB, 0x7A57, 0xCBEC, 0x9042, 0xCBED, 0x96A7, - 0xCBEE, 0x795F, 0xCBEF, 0x5B59, 0xCBF0, 0x635F, 0xCBF1, 0x7B0B, - 0xCBF2, 0x84D1, 0xCBF3, 0x68AD, 0xCBF4, 0x5506, 0xCBF5, 0x7F29, - 0xCBF6, 0x7410, 0xCBF7, 0x7D22, 0xCBF8, 0x9501, 0xCBF9, 0x6240, - 0xCBFA, 0x584C, 0xCBFB, 0x4ED6, 0xCBFC, 0x5B83, 0xCBFD, 0x5979, - 0xCBFE, 0x5854, 0xCC40, 0x85F9, 0xCC41, 0x85FA, 0xCC42, 0x85FC, - 0xCC43, 0x85FD, 0xCC44, 0x85FE, 0xCC45, 0x8600, 0xCC46, 0x8601, - 0xCC47, 0x8602, 0xCC48, 0x8603, 0xCC49, 0x8604, 0xCC4A, 0x8606, - 0xCC4B, 0x8607, 0xCC4C, 0x8608, 0xCC4D, 0x8609, 0xCC4E, 0x860A, - 0xCC4F, 0x860B, 0xCC50, 0x860C, 0xCC51, 0x860D, 0xCC52, 0x860E, - 0xCC53, 0x860F, 0xCC54, 0x8610, 0xCC55, 0x8612, 0xCC56, 0x8613, - 0xCC57, 0x8614, 0xCC58, 0x8615, 0xCC59, 0x8617, 0xCC5A, 0x8618, - 0xCC5B, 0x8619, 0xCC5C, 0x861A, 0xCC5D, 0x861B, 0xCC5E, 0x861C, - 0xCC5F, 0x861D, 0xCC60, 0x861E, 0xCC61, 0x861F, 0xCC62, 0x8620, - 0xCC63, 0x8621, 0xCC64, 0x8622, 0xCC65, 0x8623, 0xCC66, 0x8624, - 0xCC67, 0x8625, 0xCC68, 0x8626, 0xCC69, 0x8628, 0xCC6A, 0x862A, - 0xCC6B, 0x862B, 0xCC6C, 0x862C, 0xCC6D, 0x862D, 0xCC6E, 0x862E, - 0xCC6F, 0x862F, 0xCC70, 0x8630, 0xCC71, 0x8631, 0xCC72, 0x8632, - 0xCC73, 0x8633, 0xCC74, 0x8634, 0xCC75, 0x8635, 0xCC76, 0x8636, - 0xCC77, 0x8637, 0xCC78, 0x8639, 0xCC79, 0x863A, 0xCC7A, 0x863B, - 0xCC7B, 0x863D, 0xCC7C, 0x863E, 0xCC7D, 0x863F, 0xCC7E, 0x8640, - 0xCC80, 0x8641, 0xCC81, 0x8642, 0xCC82, 0x8643, 0xCC83, 0x8644, - 0xCC84, 0x8645, 0xCC85, 0x8646, 0xCC86, 0x8647, 0xCC87, 0x8648, - 0xCC88, 0x8649, 0xCC89, 0x864A, 0xCC8A, 0x864B, 0xCC8B, 0x864C, - 0xCC8C, 0x8652, 0xCC8D, 0x8653, 0xCC8E, 0x8655, 0xCC8F, 0x8656, - 0xCC90, 0x8657, 0xCC91, 0x8658, 0xCC92, 0x8659, 0xCC93, 0x865B, - 0xCC94, 0x865C, 0xCC95, 0x865D, 0xCC96, 0x865F, 0xCC97, 0x8660, - 0xCC98, 0x8661, 0xCC99, 0x8663, 0xCC9A, 0x8664, 0xCC9B, 0x8665, - 0xCC9C, 0x8666, 0xCC9D, 0x8667, 0xCC9E, 0x8668, 0xCC9F, 0x8669, - 0xCCA0, 0x866A, 0xCCA1, 0x736D, 0xCCA2, 0x631E, 0xCCA3, 0x8E4B, - 0xCCA4, 0x8E0F, 0xCCA5, 0x80CE, 0xCCA6, 0x82D4, 0xCCA7, 0x62AC, - 0xCCA8, 0x53F0, 0xCCA9, 0x6CF0, 0xCCAA, 0x915E, 0xCCAB, 0x592A, - 0xCCAC, 0x6001, 0xCCAD, 0x6C70, 0xCCAE, 0x574D, 0xCCAF, 0x644A, - 0xCCB0, 0x8D2A, 0xCCB1, 0x762B, 0xCCB2, 0x6EE9, 0xCCB3, 0x575B, - 0xCCB4, 0x6A80, 0xCCB5, 0x75F0, 0xCCB6, 0x6F6D, 0xCCB7, 0x8C2D, - 0xCCB8, 0x8C08, 0xCCB9, 0x5766, 0xCCBA, 0x6BEF, 0xCCBB, 0x8892, - 0xCCBC, 0x78B3, 0xCCBD, 0x63A2, 0xCCBE, 0x53F9, 0xCCBF, 0x70AD, - 0xCCC0, 0x6C64, 0xCCC1, 0x5858, 0xCCC2, 0x642A, 0xCCC3, 0x5802, - 0xCCC4, 0x68E0, 0xCCC5, 0x819B, 0xCCC6, 0x5510, 0xCCC7, 0x7CD6, - 0xCCC8, 0x5018, 0xCCC9, 0x8EBA, 0xCCCA, 0x6DCC, 0xCCCB, 0x8D9F, - 0xCCCC, 0x70EB, 0xCCCD, 0x638F, 0xCCCE, 0x6D9B, 0xCCCF, 0x6ED4, - 0xCCD0, 0x7EE6, 0xCCD1, 0x8404, 0xCCD2, 0x6843, 0xCCD3, 0x9003, - 0xCCD4, 0x6DD8, 0xCCD5, 0x9676, 0xCCD6, 0x8BA8, 0xCCD7, 0x5957, - 0xCCD8, 0x7279, 0xCCD9, 0x85E4, 0xCCDA, 0x817E, 0xCCDB, 0x75BC, - 0xCCDC, 0x8A8A, 0xCCDD, 0x68AF, 0xCCDE, 0x5254, 0xCCDF, 0x8E22, - 0xCCE0, 0x9511, 0xCCE1, 0x63D0, 0xCCE2, 0x9898, 0xCCE3, 0x8E44, - 0xCCE4, 0x557C, 0xCCE5, 0x4F53, 0xCCE6, 0x66FF, 0xCCE7, 0x568F, - 0xCCE8, 0x60D5, 0xCCE9, 0x6D95, 0xCCEA, 0x5243, 0xCCEB, 0x5C49, - 0xCCEC, 0x5929, 0xCCED, 0x6DFB, 0xCCEE, 0x586B, 0xCCEF, 0x7530, - 0xCCF0, 0x751C, 0xCCF1, 0x606C, 0xCCF2, 0x8214, 0xCCF3, 0x8146, - 0xCCF4, 0x6311, 0xCCF5, 0x6761, 0xCCF6, 0x8FE2, 0xCCF7, 0x773A, - 0xCCF8, 0x8DF3, 0xCCF9, 0x8D34, 0xCCFA, 0x94C1, 0xCCFB, 0x5E16, - 0xCCFC, 0x5385, 0xCCFD, 0x542C, 0xCCFE, 0x70C3, 0xCD40, 0x866D, - 0xCD41, 0x866F, 0xCD42, 0x8670, 0xCD43, 0x8672, 0xCD44, 0x8673, - 0xCD45, 0x8674, 0xCD46, 0x8675, 0xCD47, 0x8676, 0xCD48, 0x8677, - 0xCD49, 0x8678, 0xCD4A, 0x8683, 0xCD4B, 0x8684, 0xCD4C, 0x8685, - 0xCD4D, 0x8686, 0xCD4E, 0x8687, 0xCD4F, 0x8688, 0xCD50, 0x8689, - 0xCD51, 0x868E, 0xCD52, 0x868F, 0xCD53, 0x8690, 0xCD54, 0x8691, - 0xCD55, 0x8692, 0xCD56, 0x8694, 0xCD57, 0x8696, 0xCD58, 0x8697, - 0xCD59, 0x8698, 0xCD5A, 0x8699, 0xCD5B, 0x869A, 0xCD5C, 0x869B, - 0xCD5D, 0x869E, 0xCD5E, 0x869F, 0xCD5F, 0x86A0, 0xCD60, 0x86A1, - 0xCD61, 0x86A2, 0xCD62, 0x86A5, 0xCD63, 0x86A6, 0xCD64, 0x86AB, - 0xCD65, 0x86AD, 0xCD66, 0x86AE, 0xCD67, 0x86B2, 0xCD68, 0x86B3, - 0xCD69, 0x86B7, 0xCD6A, 0x86B8, 0xCD6B, 0x86B9, 0xCD6C, 0x86BB, - 0xCD6D, 0x86BC, 0xCD6E, 0x86BD, 0xCD6F, 0x86BE, 0xCD70, 0x86BF, - 0xCD71, 0x86C1, 0xCD72, 0x86C2, 0xCD73, 0x86C3, 0xCD74, 0x86C5, - 0xCD75, 0x86C8, 0xCD76, 0x86CC, 0xCD77, 0x86CD, 0xCD78, 0x86D2, - 0xCD79, 0x86D3, 0xCD7A, 0x86D5, 0xCD7B, 0x86D6, 0xCD7C, 0x86D7, - 0xCD7D, 0x86DA, 0xCD7E, 0x86DC, 0xCD80, 0x86DD, 0xCD81, 0x86E0, - 0xCD82, 0x86E1, 0xCD83, 0x86E2, 0xCD84, 0x86E3, 0xCD85, 0x86E5, - 0xCD86, 0x86E6, 0xCD87, 0x86E7, 0xCD88, 0x86E8, 0xCD89, 0x86EA, - 0xCD8A, 0x86EB, 0xCD8B, 0x86EC, 0xCD8C, 0x86EF, 0xCD8D, 0x86F5, - 0xCD8E, 0x86F6, 0xCD8F, 0x86F7, 0xCD90, 0x86FA, 0xCD91, 0x86FB, - 0xCD92, 0x86FC, 0xCD93, 0x86FD, 0xCD94, 0x86FF, 0xCD95, 0x8701, - 0xCD96, 0x8704, 0xCD97, 0x8705, 0xCD98, 0x8706, 0xCD99, 0x870B, - 0xCD9A, 0x870C, 0xCD9B, 0x870E, 0xCD9C, 0x870F, 0xCD9D, 0x8710, - 0xCD9E, 0x8711, 0xCD9F, 0x8714, 0xCDA0, 0x8716, 0xCDA1, 0x6C40, - 0xCDA2, 0x5EF7, 0xCDA3, 0x505C, 0xCDA4, 0x4EAD, 0xCDA5, 0x5EAD, - 0xCDA6, 0x633A, 0xCDA7, 0x8247, 0xCDA8, 0x901A, 0xCDA9, 0x6850, - 0xCDAA, 0x916E, 0xCDAB, 0x77B3, 0xCDAC, 0x540C, 0xCDAD, 0x94DC, - 0xCDAE, 0x5F64, 0xCDAF, 0x7AE5, 0xCDB0, 0x6876, 0xCDB1, 0x6345, - 0xCDB2, 0x7B52, 0xCDB3, 0x7EDF, 0xCDB4, 0x75DB, 0xCDB5, 0x5077, - 0xCDB6, 0x6295, 0xCDB7, 0x5934, 0xCDB8, 0x900F, 0xCDB9, 0x51F8, - 0xCDBA, 0x79C3, 0xCDBB, 0x7A81, 0xCDBC, 0x56FE, 0xCDBD, 0x5F92, - 0xCDBE, 0x9014, 0xCDBF, 0x6D82, 0xCDC0, 0x5C60, 0xCDC1, 0x571F, - 0xCDC2, 0x5410, 0xCDC3, 0x5154, 0xCDC4, 0x6E4D, 0xCDC5, 0x56E2, - 0xCDC6, 0x63A8, 0xCDC7, 0x9893, 0xCDC8, 0x817F, 0xCDC9, 0x8715, - 0xCDCA, 0x892A, 0xCDCB, 0x9000, 0xCDCC, 0x541E, 0xCDCD, 0x5C6F, - 0xCDCE, 0x81C0, 0xCDCF, 0x62D6, 0xCDD0, 0x6258, 0xCDD1, 0x8131, - 0xCDD2, 0x9E35, 0xCDD3, 0x9640, 0xCDD4, 0x9A6E, 0xCDD5, 0x9A7C, - 0xCDD6, 0x692D, 0xCDD7, 0x59A5, 0xCDD8, 0x62D3, 0xCDD9, 0x553E, - 0xCDDA, 0x6316, 0xCDDB, 0x54C7, 0xCDDC, 0x86D9, 0xCDDD, 0x6D3C, - 0xCDDE, 0x5A03, 0xCDDF, 0x74E6, 0xCDE0, 0x889C, 0xCDE1, 0x6B6A, - 0xCDE2, 0x5916, 0xCDE3, 0x8C4C, 0xCDE4, 0x5F2F, 0xCDE5, 0x6E7E, - 0xCDE6, 0x73A9, 0xCDE7, 0x987D, 0xCDE8, 0x4E38, 0xCDE9, 0x70F7, - 0xCDEA, 0x5B8C, 0xCDEB, 0x7897, 0xCDEC, 0x633D, 0xCDED, 0x665A, - 0xCDEE, 0x7696, 0xCDEF, 0x60CB, 0xCDF0, 0x5B9B, 0xCDF1, 0x5A49, - 0xCDF2, 0x4E07, 0xCDF3, 0x8155, 0xCDF4, 0x6C6A, 0xCDF5, 0x738B, - 0xCDF6, 0x4EA1, 0xCDF7, 0x6789, 0xCDF8, 0x7F51, 0xCDF9, 0x5F80, - 0xCDFA, 0x65FA, 0xCDFB, 0x671B, 0xCDFC, 0x5FD8, 0xCDFD, 0x5984, - 0xCDFE, 0x5A01, 0xCE40, 0x8719, 0xCE41, 0x871B, 0xCE42, 0x871D, - 0xCE43, 0x871F, 0xCE44, 0x8720, 0xCE45, 0x8724, 0xCE46, 0x8726, - 0xCE47, 0x8727, 0xCE48, 0x8728, 0xCE49, 0x872A, 0xCE4A, 0x872B, - 0xCE4B, 0x872C, 0xCE4C, 0x872D, 0xCE4D, 0x872F, 0xCE4E, 0x8730, - 0xCE4F, 0x8732, 0xCE50, 0x8733, 0xCE51, 0x8735, 0xCE52, 0x8736, - 0xCE53, 0x8738, 0xCE54, 0x8739, 0xCE55, 0x873A, 0xCE56, 0x873C, - 0xCE57, 0x873D, 0xCE58, 0x8740, 0xCE59, 0x8741, 0xCE5A, 0x8742, - 0xCE5B, 0x8743, 0xCE5C, 0x8744, 0xCE5D, 0x8745, 0xCE5E, 0x8746, - 0xCE5F, 0x874A, 0xCE60, 0x874B, 0xCE61, 0x874D, 0xCE62, 0x874F, - 0xCE63, 0x8750, 0xCE64, 0x8751, 0xCE65, 0x8752, 0xCE66, 0x8754, - 0xCE67, 0x8755, 0xCE68, 0x8756, 0xCE69, 0x8758, 0xCE6A, 0x875A, - 0xCE6B, 0x875B, 0xCE6C, 0x875C, 0xCE6D, 0x875D, 0xCE6E, 0x875E, - 0xCE6F, 0x875F, 0xCE70, 0x8761, 0xCE71, 0x8762, 0xCE72, 0x8766, - 0xCE73, 0x8767, 0xCE74, 0x8768, 0xCE75, 0x8769, 0xCE76, 0x876A, - 0xCE77, 0x876B, 0xCE78, 0x876C, 0xCE79, 0x876D, 0xCE7A, 0x876F, - 0xCE7B, 0x8771, 0xCE7C, 0x8772, 0xCE7D, 0x8773, 0xCE7E, 0x8775, - 0xCE80, 0x8777, 0xCE81, 0x8778, 0xCE82, 0x8779, 0xCE83, 0x877A, - 0xCE84, 0x877F, 0xCE85, 0x8780, 0xCE86, 0x8781, 0xCE87, 0x8784, - 0xCE88, 0x8786, 0xCE89, 0x8787, 0xCE8A, 0x8789, 0xCE8B, 0x878A, - 0xCE8C, 0x878C, 0xCE8D, 0x878E, 0xCE8E, 0x878F, 0xCE8F, 0x8790, - 0xCE90, 0x8791, 0xCE91, 0x8792, 0xCE92, 0x8794, 0xCE93, 0x8795, - 0xCE94, 0x8796, 0xCE95, 0x8798, 0xCE96, 0x8799, 0xCE97, 0x879A, - 0xCE98, 0x879B, 0xCE99, 0x879C, 0xCE9A, 0x879D, 0xCE9B, 0x879E, - 0xCE9C, 0x87A0, 0xCE9D, 0x87A1, 0xCE9E, 0x87A2, 0xCE9F, 0x87A3, - 0xCEA0, 0x87A4, 0xCEA1, 0x5DCD, 0xCEA2, 0x5FAE, 0xCEA3, 0x5371, - 0xCEA4, 0x97E6, 0xCEA5, 0x8FDD, 0xCEA6, 0x6845, 0xCEA7, 0x56F4, - 0xCEA8, 0x552F, 0xCEA9, 0x60DF, 0xCEAA, 0x4E3A, 0xCEAB, 0x6F4D, - 0xCEAC, 0x7EF4, 0xCEAD, 0x82C7, 0xCEAE, 0x840E, 0xCEAF, 0x59D4, - 0xCEB0, 0x4F1F, 0xCEB1, 0x4F2A, 0xCEB2, 0x5C3E, 0xCEB3, 0x7EAC, - 0xCEB4, 0x672A, 0xCEB5, 0x851A, 0xCEB6, 0x5473, 0xCEB7, 0x754F, - 0xCEB8, 0x80C3, 0xCEB9, 0x5582, 0xCEBA, 0x9B4F, 0xCEBB, 0x4F4D, - 0xCEBC, 0x6E2D, 0xCEBD, 0x8C13, 0xCEBE, 0x5C09, 0xCEBF, 0x6170, - 0xCEC0, 0x536B, 0xCEC1, 0x761F, 0xCEC2, 0x6E29, 0xCEC3, 0x868A, - 0xCEC4, 0x6587, 0xCEC5, 0x95FB, 0xCEC6, 0x7EB9, 0xCEC7, 0x543B, - 0xCEC8, 0x7A33, 0xCEC9, 0x7D0A, 0xCECA, 0x95EE, 0xCECB, 0x55E1, - 0xCECC, 0x7FC1, 0xCECD, 0x74EE, 0xCECE, 0x631D, 0xCECF, 0x8717, - 0xCED0, 0x6DA1, 0xCED1, 0x7A9D, 0xCED2, 0x6211, 0xCED3, 0x65A1, - 0xCED4, 0x5367, 0xCED5, 0x63E1, 0xCED6, 0x6C83, 0xCED7, 0x5DEB, - 0xCED8, 0x545C, 0xCED9, 0x94A8, 0xCEDA, 0x4E4C, 0xCEDB, 0x6C61, - 0xCEDC, 0x8BEC, 0xCEDD, 0x5C4B, 0xCEDE, 0x65E0, 0xCEDF, 0x829C, - 0xCEE0, 0x68A7, 0xCEE1, 0x543E, 0xCEE2, 0x5434, 0xCEE3, 0x6BCB, - 0xCEE4, 0x6B66, 0xCEE5, 0x4E94, 0xCEE6, 0x6342, 0xCEE7, 0x5348, - 0xCEE8, 0x821E, 0xCEE9, 0x4F0D, 0xCEEA, 0x4FAE, 0xCEEB, 0x575E, - 0xCEEC, 0x620A, 0xCEED, 0x96FE, 0xCEEE, 0x6664, 0xCEEF, 0x7269, - 0xCEF0, 0x52FF, 0xCEF1, 0x52A1, 0xCEF2, 0x609F, 0xCEF3, 0x8BEF, - 0xCEF4, 0x6614, 0xCEF5, 0x7199, 0xCEF6, 0x6790, 0xCEF7, 0x897F, - 0xCEF8, 0x7852, 0xCEF9, 0x77FD, 0xCEFA, 0x6670, 0xCEFB, 0x563B, - 0xCEFC, 0x5438, 0xCEFD, 0x9521, 0xCEFE, 0x727A, 0xCF40, 0x87A5, - 0xCF41, 0x87A6, 0xCF42, 0x87A7, 0xCF43, 0x87A9, 0xCF44, 0x87AA, - 0xCF45, 0x87AE, 0xCF46, 0x87B0, 0xCF47, 0x87B1, 0xCF48, 0x87B2, - 0xCF49, 0x87B4, 0xCF4A, 0x87B6, 0xCF4B, 0x87B7, 0xCF4C, 0x87B8, - 0xCF4D, 0x87B9, 0xCF4E, 0x87BB, 0xCF4F, 0x87BC, 0xCF50, 0x87BE, - 0xCF51, 0x87BF, 0xCF52, 0x87C1, 0xCF53, 0x87C2, 0xCF54, 0x87C3, - 0xCF55, 0x87C4, 0xCF56, 0x87C5, 0xCF57, 0x87C7, 0xCF58, 0x87C8, - 0xCF59, 0x87C9, 0xCF5A, 0x87CC, 0xCF5B, 0x87CD, 0xCF5C, 0x87CE, - 0xCF5D, 0x87CF, 0xCF5E, 0x87D0, 0xCF5F, 0x87D4, 0xCF60, 0x87D5, - 0xCF61, 0x87D6, 0xCF62, 0x87D7, 0xCF63, 0x87D8, 0xCF64, 0x87D9, - 0xCF65, 0x87DA, 0xCF66, 0x87DC, 0xCF67, 0x87DD, 0xCF68, 0x87DE, - 0xCF69, 0x87DF, 0xCF6A, 0x87E1, 0xCF6B, 0x87E2, 0xCF6C, 0x87E3, - 0xCF6D, 0x87E4, 0xCF6E, 0x87E6, 0xCF6F, 0x87E7, 0xCF70, 0x87E8, - 0xCF71, 0x87E9, 0xCF72, 0x87EB, 0xCF73, 0x87EC, 0xCF74, 0x87ED, - 0xCF75, 0x87EF, 0xCF76, 0x87F0, 0xCF77, 0x87F1, 0xCF78, 0x87F2, - 0xCF79, 0x87F3, 0xCF7A, 0x87F4, 0xCF7B, 0x87F5, 0xCF7C, 0x87F6, - 0xCF7D, 0x87F7, 0xCF7E, 0x87F8, 0xCF80, 0x87FA, 0xCF81, 0x87FB, - 0xCF82, 0x87FC, 0xCF83, 0x87FD, 0xCF84, 0x87FF, 0xCF85, 0x8800, - 0xCF86, 0x8801, 0xCF87, 0x8802, 0xCF88, 0x8804, 0xCF89, 0x8805, - 0xCF8A, 0x8806, 0xCF8B, 0x8807, 0xCF8C, 0x8808, 0xCF8D, 0x8809, - 0xCF8E, 0x880B, 0xCF8F, 0x880C, 0xCF90, 0x880D, 0xCF91, 0x880E, - 0xCF92, 0x880F, 0xCF93, 0x8810, 0xCF94, 0x8811, 0xCF95, 0x8812, - 0xCF96, 0x8814, 0xCF97, 0x8817, 0xCF98, 0x8818, 0xCF99, 0x8819, - 0xCF9A, 0x881A, 0xCF9B, 0x881C, 0xCF9C, 0x881D, 0xCF9D, 0x881E, - 0xCF9E, 0x881F, 0xCF9F, 0x8820, 0xCFA0, 0x8823, 0xCFA1, 0x7A00, - 0xCFA2, 0x606F, 0xCFA3, 0x5E0C, 0xCFA4, 0x6089, 0xCFA5, 0x819D, - 0xCFA6, 0x5915, 0xCFA7, 0x60DC, 0xCFA8, 0x7184, 0xCFA9, 0x70EF, - 0xCFAA, 0x6EAA, 0xCFAB, 0x6C50, 0xCFAC, 0x7280, 0xCFAD, 0x6A84, - 0xCFAE, 0x88AD, 0xCFAF, 0x5E2D, 0xCFB0, 0x4E60, 0xCFB1, 0x5AB3, - 0xCFB2, 0x559C, 0xCFB3, 0x94E3, 0xCFB4, 0x6D17, 0xCFB5, 0x7CFB, - 0xCFB6, 0x9699, 0xCFB7, 0x620F, 0xCFB8, 0x7EC6, 0xCFB9, 0x778E, - 0xCFBA, 0x867E, 0xCFBB, 0x5323, 0xCFBC, 0x971E, 0xCFBD, 0x8F96, - 0xCFBE, 0x6687, 0xCFBF, 0x5CE1, 0xCFC0, 0x4FA0, 0xCFC1, 0x72ED, - 0xCFC2, 0x4E0B, 0xCFC3, 0x53A6, 0xCFC4, 0x590F, 0xCFC5, 0x5413, - 0xCFC6, 0x6380, 0xCFC7, 0x9528, 0xCFC8, 0x5148, 0xCFC9, 0x4ED9, - 0xCFCA, 0x9C9C, 0xCFCB, 0x7EA4, 0xCFCC, 0x54B8, 0xCFCD, 0x8D24, - 0xCFCE, 0x8854, 0xCFCF, 0x8237, 0xCFD0, 0x95F2, 0xCFD1, 0x6D8E, - 0xCFD2, 0x5F26, 0xCFD3, 0x5ACC, 0xCFD4, 0x663E, 0xCFD5, 0x9669, - 0xCFD6, 0x73B0, 0xCFD7, 0x732E, 0xCFD8, 0x53BF, 0xCFD9, 0x817A, - 0xCFDA, 0x9985, 0xCFDB, 0x7FA1, 0xCFDC, 0x5BAA, 0xCFDD, 0x9677, - 0xCFDE, 0x9650, 0xCFDF, 0x7EBF, 0xCFE0, 0x76F8, 0xCFE1, 0x53A2, - 0xCFE2, 0x9576, 0xCFE3, 0x9999, 0xCFE4, 0x7BB1, 0xCFE5, 0x8944, - 0xCFE6, 0x6E58, 0xCFE7, 0x4E61, 0xCFE8, 0x7FD4, 0xCFE9, 0x7965, - 0xCFEA, 0x8BE6, 0xCFEB, 0x60F3, 0xCFEC, 0x54CD, 0xCFED, 0x4EAB, - 0xCFEE, 0x9879, 0xCFEF, 0x5DF7, 0xCFF0, 0x6A61, 0xCFF1, 0x50CF, - 0xCFF2, 0x5411, 0xCFF3, 0x8C61, 0xCFF4, 0x8427, 0xCFF5, 0x785D, - 0xCFF6, 0x9704, 0xCFF7, 0x524A, 0xCFF8, 0x54EE, 0xCFF9, 0x56A3, - 0xCFFA, 0x9500, 0xCFFB, 0x6D88, 0xCFFC, 0x5BB5, 0xCFFD, 0x6DC6, - 0xCFFE, 0x6653, 0xD040, 0x8824, 0xD041, 0x8825, 0xD042, 0x8826, - 0xD043, 0x8827, 0xD044, 0x8828, 0xD045, 0x8829, 0xD046, 0x882A, - 0xD047, 0x882B, 0xD048, 0x882C, 0xD049, 0x882D, 0xD04A, 0x882E, - 0xD04B, 0x882F, 0xD04C, 0x8830, 0xD04D, 0x8831, 0xD04E, 0x8833, - 0xD04F, 0x8834, 0xD050, 0x8835, 0xD051, 0x8836, 0xD052, 0x8837, - 0xD053, 0x8838, 0xD054, 0x883A, 0xD055, 0x883B, 0xD056, 0x883D, - 0xD057, 0x883E, 0xD058, 0x883F, 0xD059, 0x8841, 0xD05A, 0x8842, - 0xD05B, 0x8843, 0xD05C, 0x8846, 0xD05D, 0x8847, 0xD05E, 0x8848, - 0xD05F, 0x8849, 0xD060, 0x884A, 0xD061, 0x884B, 0xD062, 0x884E, - 0xD063, 0x884F, 0xD064, 0x8850, 0xD065, 0x8851, 0xD066, 0x8852, - 0xD067, 0x8853, 0xD068, 0x8855, 0xD069, 0x8856, 0xD06A, 0x8858, - 0xD06B, 0x885A, 0xD06C, 0x885B, 0xD06D, 0x885C, 0xD06E, 0x885D, - 0xD06F, 0x885E, 0xD070, 0x885F, 0xD071, 0x8860, 0xD072, 0x8866, - 0xD073, 0x8867, 0xD074, 0x886A, 0xD075, 0x886D, 0xD076, 0x886F, - 0xD077, 0x8871, 0xD078, 0x8873, 0xD079, 0x8874, 0xD07A, 0x8875, - 0xD07B, 0x8876, 0xD07C, 0x8878, 0xD07D, 0x8879, 0xD07E, 0x887A, - 0xD080, 0x887B, 0xD081, 0x887C, 0xD082, 0x8880, 0xD083, 0x8883, - 0xD084, 0x8886, 0xD085, 0x8887, 0xD086, 0x8889, 0xD087, 0x888A, - 0xD088, 0x888C, 0xD089, 0x888E, 0xD08A, 0x888F, 0xD08B, 0x8890, - 0xD08C, 0x8891, 0xD08D, 0x8893, 0xD08E, 0x8894, 0xD08F, 0x8895, - 0xD090, 0x8897, 0xD091, 0x8898, 0xD092, 0x8899, 0xD093, 0x889A, - 0xD094, 0x889B, 0xD095, 0x889D, 0xD096, 0x889E, 0xD097, 0x889F, - 0xD098, 0x88A0, 0xD099, 0x88A1, 0xD09A, 0x88A3, 0xD09B, 0x88A5, - 0xD09C, 0x88A6, 0xD09D, 0x88A7, 0xD09E, 0x88A8, 0xD09F, 0x88A9, - 0xD0A0, 0x88AA, 0xD0A1, 0x5C0F, 0xD0A2, 0x5B5D, 0xD0A3, 0x6821, - 0xD0A4, 0x8096, 0xD0A5, 0x5578, 0xD0A6, 0x7B11, 0xD0A7, 0x6548, - 0xD0A8, 0x6954, 0xD0A9, 0x4E9B, 0xD0AA, 0x6B47, 0xD0AB, 0x874E, - 0xD0AC, 0x978B, 0xD0AD, 0x534F, 0xD0AE, 0x631F, 0xD0AF, 0x643A, - 0xD0B0, 0x90AA, 0xD0B1, 0x659C, 0xD0B2, 0x80C1, 0xD0B3, 0x8C10, - 0xD0B4, 0x5199, 0xD0B5, 0x68B0, 0xD0B6, 0x5378, 0xD0B7, 0x87F9, - 0xD0B8, 0x61C8, 0xD0B9, 0x6CC4, 0xD0BA, 0x6CFB, 0xD0BB, 0x8C22, - 0xD0BC, 0x5C51, 0xD0BD, 0x85AA, 0xD0BE, 0x82AF, 0xD0BF, 0x950C, - 0xD0C0, 0x6B23, 0xD0C1, 0x8F9B, 0xD0C2, 0x65B0, 0xD0C3, 0x5FFB, - 0xD0C4, 0x5FC3, 0xD0C5, 0x4FE1, 0xD0C6, 0x8845, 0xD0C7, 0x661F, - 0xD0C8, 0x8165, 0xD0C9, 0x7329, 0xD0CA, 0x60FA, 0xD0CB, 0x5174, - 0xD0CC, 0x5211, 0xD0CD, 0x578B, 0xD0CE, 0x5F62, 0xD0CF, 0x90A2, - 0xD0D0, 0x884C, 0xD0D1, 0x9192, 0xD0D2, 0x5E78, 0xD0D3, 0x674F, - 0xD0D4, 0x6027, 0xD0D5, 0x59D3, 0xD0D6, 0x5144, 0xD0D7, 0x51F6, - 0xD0D8, 0x80F8, 0xD0D9, 0x5308, 0xD0DA, 0x6C79, 0xD0DB, 0x96C4, - 0xD0DC, 0x718A, 0xD0DD, 0x4F11, 0xD0DE, 0x4FEE, 0xD0DF, 0x7F9E, - 0xD0E0, 0x673D, 0xD0E1, 0x55C5, 0xD0E2, 0x9508, 0xD0E3, 0x79C0, - 0xD0E4, 0x8896, 0xD0E5, 0x7EE3, 0xD0E6, 0x589F, 0xD0E7, 0x620C, - 0xD0E8, 0x9700, 0xD0E9, 0x865A, 0xD0EA, 0x5618, 0xD0EB, 0x987B, - 0xD0EC, 0x5F90, 0xD0ED, 0x8BB8, 0xD0EE, 0x84C4, 0xD0EF, 0x9157, - 0xD0F0, 0x53D9, 0xD0F1, 0x65ED, 0xD0F2, 0x5E8F, 0xD0F3, 0x755C, - 0xD0F4, 0x6064, 0xD0F5, 0x7D6E, 0xD0F6, 0x5A7F, 0xD0F7, 0x7EEA, - 0xD0F8, 0x7EED, 0xD0F9, 0x8F69, 0xD0FA, 0x55A7, 0xD0FB, 0x5BA3, - 0xD0FC, 0x60AC, 0xD0FD, 0x65CB, 0xD0FE, 0x7384, 0xD140, 0x88AC, - 0xD141, 0x88AE, 0xD142, 0x88AF, 0xD143, 0x88B0, 0xD144, 0x88B2, - 0xD145, 0x88B3, 0xD146, 0x88B4, 0xD147, 0x88B5, 0xD148, 0x88B6, - 0xD149, 0x88B8, 0xD14A, 0x88B9, 0xD14B, 0x88BA, 0xD14C, 0x88BB, - 0xD14D, 0x88BD, 0xD14E, 0x88BE, 0xD14F, 0x88BF, 0xD150, 0x88C0, - 0xD151, 0x88C3, 0xD152, 0x88C4, 0xD153, 0x88C7, 0xD154, 0x88C8, - 0xD155, 0x88CA, 0xD156, 0x88CB, 0xD157, 0x88CC, 0xD158, 0x88CD, - 0xD159, 0x88CF, 0xD15A, 0x88D0, 0xD15B, 0x88D1, 0xD15C, 0x88D3, - 0xD15D, 0x88D6, 0xD15E, 0x88D7, 0xD15F, 0x88DA, 0xD160, 0x88DB, - 0xD161, 0x88DC, 0xD162, 0x88DD, 0xD163, 0x88DE, 0xD164, 0x88E0, - 0xD165, 0x88E1, 0xD166, 0x88E6, 0xD167, 0x88E7, 0xD168, 0x88E9, - 0xD169, 0x88EA, 0xD16A, 0x88EB, 0xD16B, 0x88EC, 0xD16C, 0x88ED, - 0xD16D, 0x88EE, 0xD16E, 0x88EF, 0xD16F, 0x88F2, 0xD170, 0x88F5, - 0xD171, 0x88F6, 0xD172, 0x88F7, 0xD173, 0x88FA, 0xD174, 0x88FB, - 0xD175, 0x88FD, 0xD176, 0x88FF, 0xD177, 0x8900, 0xD178, 0x8901, - 0xD179, 0x8903, 0xD17A, 0x8904, 0xD17B, 0x8905, 0xD17C, 0x8906, - 0xD17D, 0x8907, 0xD17E, 0x8908, 0xD180, 0x8909, 0xD181, 0x890B, - 0xD182, 0x890C, 0xD183, 0x890D, 0xD184, 0x890E, 0xD185, 0x890F, - 0xD186, 0x8911, 0xD187, 0x8914, 0xD188, 0x8915, 0xD189, 0x8916, - 0xD18A, 0x8917, 0xD18B, 0x8918, 0xD18C, 0x891C, 0xD18D, 0x891D, - 0xD18E, 0x891E, 0xD18F, 0x891F, 0xD190, 0x8920, 0xD191, 0x8922, - 0xD192, 0x8923, 0xD193, 0x8924, 0xD194, 0x8926, 0xD195, 0x8927, - 0xD196, 0x8928, 0xD197, 0x8929, 0xD198, 0x892C, 0xD199, 0x892D, - 0xD19A, 0x892E, 0xD19B, 0x892F, 0xD19C, 0x8931, 0xD19D, 0x8932, - 0xD19E, 0x8933, 0xD19F, 0x8935, 0xD1A0, 0x8937, 0xD1A1, 0x9009, - 0xD1A2, 0x7663, 0xD1A3, 0x7729, 0xD1A4, 0x7EDA, 0xD1A5, 0x9774, - 0xD1A6, 0x859B, 0xD1A7, 0x5B66, 0xD1A8, 0x7A74, 0xD1A9, 0x96EA, - 0xD1AA, 0x8840, 0xD1AB, 0x52CB, 0xD1AC, 0x718F, 0xD1AD, 0x5FAA, - 0xD1AE, 0x65EC, 0xD1AF, 0x8BE2, 0xD1B0, 0x5BFB, 0xD1B1, 0x9A6F, - 0xD1B2, 0x5DE1, 0xD1B3, 0x6B89, 0xD1B4, 0x6C5B, 0xD1B5, 0x8BAD, - 0xD1B6, 0x8BAF, 0xD1B7, 0x900A, 0xD1B8, 0x8FC5, 0xD1B9, 0x538B, - 0xD1BA, 0x62BC, 0xD1BB, 0x9E26, 0xD1BC, 0x9E2D, 0xD1BD, 0x5440, - 0xD1BE, 0x4E2B, 0xD1BF, 0x82BD, 0xD1C0, 0x7259, 0xD1C1, 0x869C, - 0xD1C2, 0x5D16, 0xD1C3, 0x8859, 0xD1C4, 0x6DAF, 0xD1C5, 0x96C5, - 0xD1C6, 0x54D1, 0xD1C7, 0x4E9A, 0xD1C8, 0x8BB6, 0xD1C9, 0x7109, - 0xD1CA, 0x54BD, 0xD1CB, 0x9609, 0xD1CC, 0x70DF, 0xD1CD, 0x6DF9, - 0xD1CE, 0x76D0, 0xD1CF, 0x4E25, 0xD1D0, 0x7814, 0xD1D1, 0x8712, - 0xD1D2, 0x5CA9, 0xD1D3, 0x5EF6, 0xD1D4, 0x8A00, 0xD1D5, 0x989C, - 0xD1D6, 0x960E, 0xD1D7, 0x708E, 0xD1D8, 0x6CBF, 0xD1D9, 0x5944, - 0xD1DA, 0x63A9, 0xD1DB, 0x773C, 0xD1DC, 0x884D, 0xD1DD, 0x6F14, - 0xD1DE, 0x8273, 0xD1DF, 0x5830, 0xD1E0, 0x71D5, 0xD1E1, 0x538C, - 0xD1E2, 0x781A, 0xD1E3, 0x96C1, 0xD1E4, 0x5501, 0xD1E5, 0x5F66, - 0xD1E6, 0x7130, 0xD1E7, 0x5BB4, 0xD1E8, 0x8C1A, 0xD1E9, 0x9A8C, - 0xD1EA, 0x6B83, 0xD1EB, 0x592E, 0xD1EC, 0x9E2F, 0xD1ED, 0x79E7, - 0xD1EE, 0x6768, 0xD1EF, 0x626C, 0xD1F0, 0x4F6F, 0xD1F1, 0x75A1, - 0xD1F2, 0x7F8A, 0xD1F3, 0x6D0B, 0xD1F4, 0x9633, 0xD1F5, 0x6C27, - 0xD1F6, 0x4EF0, 0xD1F7, 0x75D2, 0xD1F8, 0x517B, 0xD1F9, 0x6837, - 0xD1FA, 0x6F3E, 0xD1FB, 0x9080, 0xD1FC, 0x8170, 0xD1FD, 0x5996, - 0xD1FE, 0x7476, 0xD240, 0x8938, 0xD241, 0x8939, 0xD242, 0x893A, - 0xD243, 0x893B, 0xD244, 0x893C, 0xD245, 0x893D, 0xD246, 0x893E, - 0xD247, 0x893F, 0xD248, 0x8940, 0xD249, 0x8942, 0xD24A, 0x8943, - 0xD24B, 0x8945, 0xD24C, 0x8946, 0xD24D, 0x8947, 0xD24E, 0x8948, - 0xD24F, 0x8949, 0xD250, 0x894A, 0xD251, 0x894B, 0xD252, 0x894C, - 0xD253, 0x894D, 0xD254, 0x894E, 0xD255, 0x894F, 0xD256, 0x8950, - 0xD257, 0x8951, 0xD258, 0x8952, 0xD259, 0x8953, 0xD25A, 0x8954, - 0xD25B, 0x8955, 0xD25C, 0x8956, 0xD25D, 0x8957, 0xD25E, 0x8958, - 0xD25F, 0x8959, 0xD260, 0x895A, 0xD261, 0x895B, 0xD262, 0x895C, - 0xD263, 0x895D, 0xD264, 0x8960, 0xD265, 0x8961, 0xD266, 0x8962, - 0xD267, 0x8963, 0xD268, 0x8964, 0xD269, 0x8965, 0xD26A, 0x8967, - 0xD26B, 0x8968, 0xD26C, 0x8969, 0xD26D, 0x896A, 0xD26E, 0x896B, - 0xD26F, 0x896C, 0xD270, 0x896D, 0xD271, 0x896E, 0xD272, 0x896F, - 0xD273, 0x8970, 0xD274, 0x8971, 0xD275, 0x8972, 0xD276, 0x8973, - 0xD277, 0x8974, 0xD278, 0x8975, 0xD279, 0x8976, 0xD27A, 0x8977, - 0xD27B, 0x8978, 0xD27C, 0x8979, 0xD27D, 0x897A, 0xD27E, 0x897C, - 0xD280, 0x897D, 0xD281, 0x897E, 0xD282, 0x8980, 0xD283, 0x8982, - 0xD284, 0x8984, 0xD285, 0x8985, 0xD286, 0x8987, 0xD287, 0x8988, - 0xD288, 0x8989, 0xD289, 0x898A, 0xD28A, 0x898B, 0xD28B, 0x898C, - 0xD28C, 0x898D, 0xD28D, 0x898E, 0xD28E, 0x898F, 0xD28F, 0x8990, - 0xD290, 0x8991, 0xD291, 0x8992, 0xD292, 0x8993, 0xD293, 0x8994, - 0xD294, 0x8995, 0xD295, 0x8996, 0xD296, 0x8997, 0xD297, 0x8998, - 0xD298, 0x8999, 0xD299, 0x899A, 0xD29A, 0x899B, 0xD29B, 0x899C, - 0xD29C, 0x899D, 0xD29D, 0x899E, 0xD29E, 0x899F, 0xD29F, 0x89A0, - 0xD2A0, 0x89A1, 0xD2A1, 0x6447, 0xD2A2, 0x5C27, 0xD2A3, 0x9065, - 0xD2A4, 0x7A91, 0xD2A5, 0x8C23, 0xD2A6, 0x59DA, 0xD2A7, 0x54AC, - 0xD2A8, 0x8200, 0xD2A9, 0x836F, 0xD2AA, 0x8981, 0xD2AB, 0x8000, - 0xD2AC, 0x6930, 0xD2AD, 0x564E, 0xD2AE, 0x8036, 0xD2AF, 0x7237, - 0xD2B0, 0x91CE, 0xD2B1, 0x51B6, 0xD2B2, 0x4E5F, 0xD2B3, 0x9875, - 0xD2B4, 0x6396, 0xD2B5, 0x4E1A, 0xD2B6, 0x53F6, 0xD2B7, 0x66F3, - 0xD2B8, 0x814B, 0xD2B9, 0x591C, 0xD2BA, 0x6DB2, 0xD2BB, 0x4E00, - 0xD2BC, 0x58F9, 0xD2BD, 0x533B, 0xD2BE, 0x63D6, 0xD2BF, 0x94F1, - 0xD2C0, 0x4F9D, 0xD2C1, 0x4F0A, 0xD2C2, 0x8863, 0xD2C3, 0x9890, - 0xD2C4, 0x5937, 0xD2C5, 0x9057, 0xD2C6, 0x79FB, 0xD2C7, 0x4EEA, - 0xD2C8, 0x80F0, 0xD2C9, 0x7591, 0xD2CA, 0x6C82, 0xD2CB, 0x5B9C, - 0xD2CC, 0x59E8, 0xD2CD, 0x5F5D, 0xD2CE, 0x6905, 0xD2CF, 0x8681, - 0xD2D0, 0x501A, 0xD2D1, 0x5DF2, 0xD2D2, 0x4E59, 0xD2D3, 0x77E3, - 0xD2D4, 0x4EE5, 0xD2D5, 0x827A, 0xD2D6, 0x6291, 0xD2D7, 0x6613, - 0xD2D8, 0x9091, 0xD2D9, 0x5C79, 0xD2DA, 0x4EBF, 0xD2DB, 0x5F79, - 0xD2DC, 0x81C6, 0xD2DD, 0x9038, 0xD2DE, 0x8084, 0xD2DF, 0x75AB, - 0xD2E0, 0x4EA6, 0xD2E1, 0x88D4, 0xD2E2, 0x610F, 0xD2E3, 0x6BC5, - 0xD2E4, 0x5FC6, 0xD2E5, 0x4E49, 0xD2E6, 0x76CA, 0xD2E7, 0x6EA2, - 0xD2E8, 0x8BE3, 0xD2E9, 0x8BAE, 0xD2EA, 0x8C0A, 0xD2EB, 0x8BD1, - 0xD2EC, 0x5F02, 0xD2ED, 0x7FFC, 0xD2EE, 0x7FCC, 0xD2EF, 0x7ECE, - 0xD2F0, 0x8335, 0xD2F1, 0x836B, 0xD2F2, 0x56E0, 0xD2F3, 0x6BB7, - 0xD2F4, 0x97F3, 0xD2F5, 0x9634, 0xD2F6, 0x59FB, 0xD2F7, 0x541F, - 0xD2F8, 0x94F6, 0xD2F9, 0x6DEB, 0xD2FA, 0x5BC5, 0xD2FB, 0x996E, - 0xD2FC, 0x5C39, 0xD2FD, 0x5F15, 0xD2FE, 0x9690, 0xD340, 0x89A2, - 0xD341, 0x89A3, 0xD342, 0x89A4, 0xD343, 0x89A5, 0xD344, 0x89A6, - 0xD345, 0x89A7, 0xD346, 0x89A8, 0xD347, 0x89A9, 0xD348, 0x89AA, - 0xD349, 0x89AB, 0xD34A, 0x89AC, 0xD34B, 0x89AD, 0xD34C, 0x89AE, - 0xD34D, 0x89AF, 0xD34E, 0x89B0, 0xD34F, 0x89B1, 0xD350, 0x89B2, - 0xD351, 0x89B3, 0xD352, 0x89B4, 0xD353, 0x89B5, 0xD354, 0x89B6, - 0xD355, 0x89B7, 0xD356, 0x89B8, 0xD357, 0x89B9, 0xD358, 0x89BA, - 0xD359, 0x89BB, 0xD35A, 0x89BC, 0xD35B, 0x89BD, 0xD35C, 0x89BE, - 0xD35D, 0x89BF, 0xD35E, 0x89C0, 0xD35F, 0x89C3, 0xD360, 0x89CD, - 0xD361, 0x89D3, 0xD362, 0x89D4, 0xD363, 0x89D5, 0xD364, 0x89D7, - 0xD365, 0x89D8, 0xD366, 0x89D9, 0xD367, 0x89DB, 0xD368, 0x89DD, - 0xD369, 0x89DF, 0xD36A, 0x89E0, 0xD36B, 0x89E1, 0xD36C, 0x89E2, - 0xD36D, 0x89E4, 0xD36E, 0x89E7, 0xD36F, 0x89E8, 0xD370, 0x89E9, - 0xD371, 0x89EA, 0xD372, 0x89EC, 0xD373, 0x89ED, 0xD374, 0x89EE, - 0xD375, 0x89F0, 0xD376, 0x89F1, 0xD377, 0x89F2, 0xD378, 0x89F4, - 0xD379, 0x89F5, 0xD37A, 0x89F6, 0xD37B, 0x89F7, 0xD37C, 0x89F8, - 0xD37D, 0x89F9, 0xD37E, 0x89FA, 0xD380, 0x89FB, 0xD381, 0x89FC, - 0xD382, 0x89FD, 0xD383, 0x89FE, 0xD384, 0x89FF, 0xD385, 0x8A01, - 0xD386, 0x8A02, 0xD387, 0x8A03, 0xD388, 0x8A04, 0xD389, 0x8A05, - 0xD38A, 0x8A06, 0xD38B, 0x8A08, 0xD38C, 0x8A09, 0xD38D, 0x8A0A, - 0xD38E, 0x8A0B, 0xD38F, 0x8A0C, 0xD390, 0x8A0D, 0xD391, 0x8A0E, - 0xD392, 0x8A0F, 0xD393, 0x8A10, 0xD394, 0x8A11, 0xD395, 0x8A12, - 0xD396, 0x8A13, 0xD397, 0x8A14, 0xD398, 0x8A15, 0xD399, 0x8A16, - 0xD39A, 0x8A17, 0xD39B, 0x8A18, 0xD39C, 0x8A19, 0xD39D, 0x8A1A, - 0xD39E, 0x8A1B, 0xD39F, 0x8A1C, 0xD3A0, 0x8A1D, 0xD3A1, 0x5370, - 0xD3A2, 0x82F1, 0xD3A3, 0x6A31, 0xD3A4, 0x5A74, 0xD3A5, 0x9E70, - 0xD3A6, 0x5E94, 0xD3A7, 0x7F28, 0xD3A8, 0x83B9, 0xD3A9, 0x8424, - 0xD3AA, 0x8425, 0xD3AB, 0x8367, 0xD3AC, 0x8747, 0xD3AD, 0x8FCE, - 0xD3AE, 0x8D62, 0xD3AF, 0x76C8, 0xD3B0, 0x5F71, 0xD3B1, 0x9896, - 0xD3B2, 0x786C, 0xD3B3, 0x6620, 0xD3B4, 0x54DF, 0xD3B5, 0x62E5, - 0xD3B6, 0x4F63, 0xD3B7, 0x81C3, 0xD3B8, 0x75C8, 0xD3B9, 0x5EB8, - 0xD3BA, 0x96CD, 0xD3BB, 0x8E0A, 0xD3BC, 0x86F9, 0xD3BD, 0x548F, - 0xD3BE, 0x6CF3, 0xD3BF, 0x6D8C, 0xD3C0, 0x6C38, 0xD3C1, 0x607F, - 0xD3C2, 0x52C7, 0xD3C3, 0x7528, 0xD3C4, 0x5E7D, 0xD3C5, 0x4F18, - 0xD3C6, 0x60A0, 0xD3C7, 0x5FE7, 0xD3C8, 0x5C24, 0xD3C9, 0x7531, - 0xD3CA, 0x90AE, 0xD3CB, 0x94C0, 0xD3CC, 0x72B9, 0xD3CD, 0x6CB9, - 0xD3CE, 0x6E38, 0xD3CF, 0x9149, 0xD3D0, 0x6709, 0xD3D1, 0x53CB, - 0xD3D2, 0x53F3, 0xD3D3, 0x4F51, 0xD3D4, 0x91C9, 0xD3D5, 0x8BF1, - 0xD3D6, 0x53C8, 0xD3D7, 0x5E7C, 0xD3D8, 0x8FC2, 0xD3D9, 0x6DE4, - 0xD3DA, 0x4E8E, 0xD3DB, 0x76C2, 0xD3DC, 0x6986, 0xD3DD, 0x865E, - 0xD3DE, 0x611A, 0xD3DF, 0x8206, 0xD3E0, 0x4F59, 0xD3E1, 0x4FDE, - 0xD3E2, 0x903E, 0xD3E3, 0x9C7C, 0xD3E4, 0x6109, 0xD3E5, 0x6E1D, - 0xD3E6, 0x6E14, 0xD3E7, 0x9685, 0xD3E8, 0x4E88, 0xD3E9, 0x5A31, - 0xD3EA, 0x96E8, 0xD3EB, 0x4E0E, 0xD3EC, 0x5C7F, 0xD3ED, 0x79B9, - 0xD3EE, 0x5B87, 0xD3EF, 0x8BED, 0xD3F0, 0x7FBD, 0xD3F1, 0x7389, - 0xD3F2, 0x57DF, 0xD3F3, 0x828B, 0xD3F4, 0x90C1, 0xD3F5, 0x5401, - 0xD3F6, 0x9047, 0xD3F7, 0x55BB, 0xD3F8, 0x5CEA, 0xD3F9, 0x5FA1, - 0xD3FA, 0x6108, 0xD3FB, 0x6B32, 0xD3FC, 0x72F1, 0xD3FD, 0x80B2, - 0xD3FE, 0x8A89, 0xD440, 0x8A1E, 0xD441, 0x8A1F, 0xD442, 0x8A20, - 0xD443, 0x8A21, 0xD444, 0x8A22, 0xD445, 0x8A23, 0xD446, 0x8A24, - 0xD447, 0x8A25, 0xD448, 0x8A26, 0xD449, 0x8A27, 0xD44A, 0x8A28, - 0xD44B, 0x8A29, 0xD44C, 0x8A2A, 0xD44D, 0x8A2B, 0xD44E, 0x8A2C, - 0xD44F, 0x8A2D, 0xD450, 0x8A2E, 0xD451, 0x8A2F, 0xD452, 0x8A30, - 0xD453, 0x8A31, 0xD454, 0x8A32, 0xD455, 0x8A33, 0xD456, 0x8A34, - 0xD457, 0x8A35, 0xD458, 0x8A36, 0xD459, 0x8A37, 0xD45A, 0x8A38, - 0xD45B, 0x8A39, 0xD45C, 0x8A3A, 0xD45D, 0x8A3B, 0xD45E, 0x8A3C, - 0xD45F, 0x8A3D, 0xD460, 0x8A3F, 0xD461, 0x8A40, 0xD462, 0x8A41, - 0xD463, 0x8A42, 0xD464, 0x8A43, 0xD465, 0x8A44, 0xD466, 0x8A45, - 0xD467, 0x8A46, 0xD468, 0x8A47, 0xD469, 0x8A49, 0xD46A, 0x8A4A, - 0xD46B, 0x8A4B, 0xD46C, 0x8A4C, 0xD46D, 0x8A4D, 0xD46E, 0x8A4E, - 0xD46F, 0x8A4F, 0xD470, 0x8A50, 0xD471, 0x8A51, 0xD472, 0x8A52, - 0xD473, 0x8A53, 0xD474, 0x8A54, 0xD475, 0x8A55, 0xD476, 0x8A56, - 0xD477, 0x8A57, 0xD478, 0x8A58, 0xD479, 0x8A59, 0xD47A, 0x8A5A, - 0xD47B, 0x8A5B, 0xD47C, 0x8A5C, 0xD47D, 0x8A5D, 0xD47E, 0x8A5E, - 0xD480, 0x8A5F, 0xD481, 0x8A60, 0xD482, 0x8A61, 0xD483, 0x8A62, - 0xD484, 0x8A63, 0xD485, 0x8A64, 0xD486, 0x8A65, 0xD487, 0x8A66, - 0xD488, 0x8A67, 0xD489, 0x8A68, 0xD48A, 0x8A69, 0xD48B, 0x8A6A, - 0xD48C, 0x8A6B, 0xD48D, 0x8A6C, 0xD48E, 0x8A6D, 0xD48F, 0x8A6E, - 0xD490, 0x8A6F, 0xD491, 0x8A70, 0xD492, 0x8A71, 0xD493, 0x8A72, - 0xD494, 0x8A73, 0xD495, 0x8A74, 0xD496, 0x8A75, 0xD497, 0x8A76, - 0xD498, 0x8A77, 0xD499, 0x8A78, 0xD49A, 0x8A7A, 0xD49B, 0x8A7B, - 0xD49C, 0x8A7C, 0xD49D, 0x8A7D, 0xD49E, 0x8A7E, 0xD49F, 0x8A7F, - 0xD4A0, 0x8A80, 0xD4A1, 0x6D74, 0xD4A2, 0x5BD3, 0xD4A3, 0x88D5, - 0xD4A4, 0x9884, 0xD4A5, 0x8C6B, 0xD4A6, 0x9A6D, 0xD4A7, 0x9E33, - 0xD4A8, 0x6E0A, 0xD4A9, 0x51A4, 0xD4AA, 0x5143, 0xD4AB, 0x57A3, - 0xD4AC, 0x8881, 0xD4AD, 0x539F, 0xD4AE, 0x63F4, 0xD4AF, 0x8F95, - 0xD4B0, 0x56ED, 0xD4B1, 0x5458, 0xD4B2, 0x5706, 0xD4B3, 0x733F, - 0xD4B4, 0x6E90, 0xD4B5, 0x7F18, 0xD4B6, 0x8FDC, 0xD4B7, 0x82D1, - 0xD4B8, 0x613F, 0xD4B9, 0x6028, 0xD4BA, 0x9662, 0xD4BB, 0x66F0, - 0xD4BC, 0x7EA6, 0xD4BD, 0x8D8A, 0xD4BE, 0x8DC3, 0xD4BF, 0x94A5, - 0xD4C0, 0x5CB3, 0xD4C1, 0x7CA4, 0xD4C2, 0x6708, 0xD4C3, 0x60A6, - 0xD4C4, 0x9605, 0xD4C5, 0x8018, 0xD4C6, 0x4E91, 0xD4C7, 0x90E7, - 0xD4C8, 0x5300, 0xD4C9, 0x9668, 0xD4CA, 0x5141, 0xD4CB, 0x8FD0, - 0xD4CC, 0x8574, 0xD4CD, 0x915D, 0xD4CE, 0x6655, 0xD4CF, 0x97F5, - 0xD4D0, 0x5B55, 0xD4D1, 0x531D, 0xD4D2, 0x7838, 0xD4D3, 0x6742, - 0xD4D4, 0x683D, 0xD4D5, 0x54C9, 0xD4D6, 0x707E, 0xD4D7, 0x5BB0, - 0xD4D8, 0x8F7D, 0xD4D9, 0x518D, 0xD4DA, 0x5728, 0xD4DB, 0x54B1, - 0xD4DC, 0x6512, 0xD4DD, 0x6682, 0xD4DE, 0x8D5E, 0xD4DF, 0x8D43, - 0xD4E0, 0x810F, 0xD4E1, 0x846C, 0xD4E2, 0x906D, 0xD4E3, 0x7CDF, - 0xD4E4, 0x51FF, 0xD4E5, 0x85FB, 0xD4E6, 0x67A3, 0xD4E7, 0x65E9, - 0xD4E8, 0x6FA1, 0xD4E9, 0x86A4, 0xD4EA, 0x8E81, 0xD4EB, 0x566A, - 0xD4EC, 0x9020, 0xD4ED, 0x7682, 0xD4EE, 0x7076, 0xD4EF, 0x71E5, - 0xD4F0, 0x8D23, 0xD4F1, 0x62E9, 0xD4F2, 0x5219, 0xD4F3, 0x6CFD, - 0xD4F4, 0x8D3C, 0xD4F5, 0x600E, 0xD4F6, 0x589E, 0xD4F7, 0x618E, - 0xD4F8, 0x66FE, 0xD4F9, 0x8D60, 0xD4FA, 0x624E, 0xD4FB, 0x55B3, - 0xD4FC, 0x6E23, 0xD4FD, 0x672D, 0xD4FE, 0x8F67, 0xD540, 0x8A81, - 0xD541, 0x8A82, 0xD542, 0x8A83, 0xD543, 0x8A84, 0xD544, 0x8A85, - 0xD545, 0x8A86, 0xD546, 0x8A87, 0xD547, 0x8A88, 0xD548, 0x8A8B, - 0xD549, 0x8A8C, 0xD54A, 0x8A8D, 0xD54B, 0x8A8E, 0xD54C, 0x8A8F, - 0xD54D, 0x8A90, 0xD54E, 0x8A91, 0xD54F, 0x8A92, 0xD550, 0x8A94, - 0xD551, 0x8A95, 0xD552, 0x8A96, 0xD553, 0x8A97, 0xD554, 0x8A98, - 0xD555, 0x8A99, 0xD556, 0x8A9A, 0xD557, 0x8A9B, 0xD558, 0x8A9C, - 0xD559, 0x8A9D, 0xD55A, 0x8A9E, 0xD55B, 0x8A9F, 0xD55C, 0x8AA0, - 0xD55D, 0x8AA1, 0xD55E, 0x8AA2, 0xD55F, 0x8AA3, 0xD560, 0x8AA4, - 0xD561, 0x8AA5, 0xD562, 0x8AA6, 0xD563, 0x8AA7, 0xD564, 0x8AA8, - 0xD565, 0x8AA9, 0xD566, 0x8AAA, 0xD567, 0x8AAB, 0xD568, 0x8AAC, - 0xD569, 0x8AAD, 0xD56A, 0x8AAE, 0xD56B, 0x8AAF, 0xD56C, 0x8AB0, - 0xD56D, 0x8AB1, 0xD56E, 0x8AB2, 0xD56F, 0x8AB3, 0xD570, 0x8AB4, - 0xD571, 0x8AB5, 0xD572, 0x8AB6, 0xD573, 0x8AB7, 0xD574, 0x8AB8, - 0xD575, 0x8AB9, 0xD576, 0x8ABA, 0xD577, 0x8ABB, 0xD578, 0x8ABC, - 0xD579, 0x8ABD, 0xD57A, 0x8ABE, 0xD57B, 0x8ABF, 0xD57C, 0x8AC0, - 0xD57D, 0x8AC1, 0xD57E, 0x8AC2, 0xD580, 0x8AC3, 0xD581, 0x8AC4, - 0xD582, 0x8AC5, 0xD583, 0x8AC6, 0xD584, 0x8AC7, 0xD585, 0x8AC8, - 0xD586, 0x8AC9, 0xD587, 0x8ACA, 0xD588, 0x8ACB, 0xD589, 0x8ACC, - 0xD58A, 0x8ACD, 0xD58B, 0x8ACE, 0xD58C, 0x8ACF, 0xD58D, 0x8AD0, - 0xD58E, 0x8AD1, 0xD58F, 0x8AD2, 0xD590, 0x8AD3, 0xD591, 0x8AD4, - 0xD592, 0x8AD5, 0xD593, 0x8AD6, 0xD594, 0x8AD7, 0xD595, 0x8AD8, - 0xD596, 0x8AD9, 0xD597, 0x8ADA, 0xD598, 0x8ADB, 0xD599, 0x8ADC, - 0xD59A, 0x8ADD, 0xD59B, 0x8ADE, 0xD59C, 0x8ADF, 0xD59D, 0x8AE0, - 0xD59E, 0x8AE1, 0xD59F, 0x8AE2, 0xD5A0, 0x8AE3, 0xD5A1, 0x94E1, - 0xD5A2, 0x95F8, 0xD5A3, 0x7728, 0xD5A4, 0x6805, 0xD5A5, 0x69A8, - 0xD5A6, 0x548B, 0xD5A7, 0x4E4D, 0xD5A8, 0x70B8, 0xD5A9, 0x8BC8, - 0xD5AA, 0x6458, 0xD5AB, 0x658B, 0xD5AC, 0x5B85, 0xD5AD, 0x7A84, - 0xD5AE, 0x503A, 0xD5AF, 0x5BE8, 0xD5B0, 0x77BB, 0xD5B1, 0x6BE1, - 0xD5B2, 0x8A79, 0xD5B3, 0x7C98, 0xD5B4, 0x6CBE, 0xD5B5, 0x76CF, - 0xD5B6, 0x65A9, 0xD5B7, 0x8F97, 0xD5B8, 0x5D2D, 0xD5B9, 0x5C55, - 0xD5BA, 0x8638, 0xD5BB, 0x6808, 0xD5BC, 0x5360, 0xD5BD, 0x6218, - 0xD5BE, 0x7AD9, 0xD5BF, 0x6E5B, 0xD5C0, 0x7EFD, 0xD5C1, 0x6A1F, - 0xD5C2, 0x7AE0, 0xD5C3, 0x5F70, 0xD5C4, 0x6F33, 0xD5C5, 0x5F20, - 0xD5C6, 0x638C, 0xD5C7, 0x6DA8, 0xD5C8, 0x6756, 0xD5C9, 0x4E08, - 0xD5CA, 0x5E10, 0xD5CB, 0x8D26, 0xD5CC, 0x4ED7, 0xD5CD, 0x80C0, - 0xD5CE, 0x7634, 0xD5CF, 0x969C, 0xD5D0, 0x62DB, 0xD5D1, 0x662D, - 0xD5D2, 0x627E, 0xD5D3, 0x6CBC, 0xD5D4, 0x8D75, 0xD5D5, 0x7167, - 0xD5D6, 0x7F69, 0xD5D7, 0x5146, 0xD5D8, 0x8087, 0xD5D9, 0x53EC, - 0xD5DA, 0x906E, 0xD5DB, 0x6298, 0xD5DC, 0x54F2, 0xD5DD, 0x86F0, - 0xD5DE, 0x8F99, 0xD5DF, 0x8005, 0xD5E0, 0x9517, 0xD5E1, 0x8517, - 0xD5E2, 0x8FD9, 0xD5E3, 0x6D59, 0xD5E4, 0x73CD, 0xD5E5, 0x659F, - 0xD5E6, 0x771F, 0xD5E7, 0x7504, 0xD5E8, 0x7827, 0xD5E9, 0x81FB, - 0xD5EA, 0x8D1E, 0xD5EB, 0x9488, 0xD5EC, 0x4FA6, 0xD5ED, 0x6795, - 0xD5EE, 0x75B9, 0xD5EF, 0x8BCA, 0xD5F0, 0x9707, 0xD5F1, 0x632F, - 0xD5F2, 0x9547, 0xD5F3, 0x9635, 0xD5F4, 0x84B8, 0xD5F5, 0x6323, - 0xD5F6, 0x7741, 0xD5F7, 0x5F81, 0xD5F8, 0x72F0, 0xD5F9, 0x4E89, - 0xD5FA, 0x6014, 0xD5FB, 0x6574, 0xD5FC, 0x62EF, 0xD5FD, 0x6B63, - 0xD5FE, 0x653F, 0xD640, 0x8AE4, 0xD641, 0x8AE5, 0xD642, 0x8AE6, - 0xD643, 0x8AE7, 0xD644, 0x8AE8, 0xD645, 0x8AE9, 0xD646, 0x8AEA, - 0xD647, 0x8AEB, 0xD648, 0x8AEC, 0xD649, 0x8AED, 0xD64A, 0x8AEE, - 0xD64B, 0x8AEF, 0xD64C, 0x8AF0, 0xD64D, 0x8AF1, 0xD64E, 0x8AF2, - 0xD64F, 0x8AF3, 0xD650, 0x8AF4, 0xD651, 0x8AF5, 0xD652, 0x8AF6, - 0xD653, 0x8AF7, 0xD654, 0x8AF8, 0xD655, 0x8AF9, 0xD656, 0x8AFA, - 0xD657, 0x8AFB, 0xD658, 0x8AFC, 0xD659, 0x8AFD, 0xD65A, 0x8AFE, - 0xD65B, 0x8AFF, 0xD65C, 0x8B00, 0xD65D, 0x8B01, 0xD65E, 0x8B02, - 0xD65F, 0x8B03, 0xD660, 0x8B04, 0xD661, 0x8B05, 0xD662, 0x8B06, - 0xD663, 0x8B08, 0xD664, 0x8B09, 0xD665, 0x8B0A, 0xD666, 0x8B0B, - 0xD667, 0x8B0C, 0xD668, 0x8B0D, 0xD669, 0x8B0E, 0xD66A, 0x8B0F, - 0xD66B, 0x8B10, 0xD66C, 0x8B11, 0xD66D, 0x8B12, 0xD66E, 0x8B13, - 0xD66F, 0x8B14, 0xD670, 0x8B15, 0xD671, 0x8B16, 0xD672, 0x8B17, - 0xD673, 0x8B18, 0xD674, 0x8B19, 0xD675, 0x8B1A, 0xD676, 0x8B1B, - 0xD677, 0x8B1C, 0xD678, 0x8B1D, 0xD679, 0x8B1E, 0xD67A, 0x8B1F, - 0xD67B, 0x8B20, 0xD67C, 0x8B21, 0xD67D, 0x8B22, 0xD67E, 0x8B23, - 0xD680, 0x8B24, 0xD681, 0x8B25, 0xD682, 0x8B27, 0xD683, 0x8B28, - 0xD684, 0x8B29, 0xD685, 0x8B2A, 0xD686, 0x8B2B, 0xD687, 0x8B2C, - 0xD688, 0x8B2D, 0xD689, 0x8B2E, 0xD68A, 0x8B2F, 0xD68B, 0x8B30, - 0xD68C, 0x8B31, 0xD68D, 0x8B32, 0xD68E, 0x8B33, 0xD68F, 0x8B34, - 0xD690, 0x8B35, 0xD691, 0x8B36, 0xD692, 0x8B37, 0xD693, 0x8B38, - 0xD694, 0x8B39, 0xD695, 0x8B3A, 0xD696, 0x8B3B, 0xD697, 0x8B3C, - 0xD698, 0x8B3D, 0xD699, 0x8B3E, 0xD69A, 0x8B3F, 0xD69B, 0x8B40, - 0xD69C, 0x8B41, 0xD69D, 0x8B42, 0xD69E, 0x8B43, 0xD69F, 0x8B44, - 0xD6A0, 0x8B45, 0xD6A1, 0x5E27, 0xD6A2, 0x75C7, 0xD6A3, 0x90D1, - 0xD6A4, 0x8BC1, 0xD6A5, 0x829D, 0xD6A6, 0x679D, 0xD6A7, 0x652F, - 0xD6A8, 0x5431, 0xD6A9, 0x8718, 0xD6AA, 0x77E5, 0xD6AB, 0x80A2, - 0xD6AC, 0x8102, 0xD6AD, 0x6C41, 0xD6AE, 0x4E4B, 0xD6AF, 0x7EC7, - 0xD6B0, 0x804C, 0xD6B1, 0x76F4, 0xD6B2, 0x690D, 0xD6B3, 0x6B96, - 0xD6B4, 0x6267, 0xD6B5, 0x503C, 0xD6B6, 0x4F84, 0xD6B7, 0x5740, - 0xD6B8, 0x6307, 0xD6B9, 0x6B62, 0xD6BA, 0x8DBE, 0xD6BB, 0x53EA, - 0xD6BC, 0x65E8, 0xD6BD, 0x7EB8, 0xD6BE, 0x5FD7, 0xD6BF, 0x631A, - 0xD6C0, 0x63B7, 0xD6C1, 0x81F3, 0xD6C2, 0x81F4, 0xD6C3, 0x7F6E, - 0xD6C4, 0x5E1C, 0xD6C5, 0x5CD9, 0xD6C6, 0x5236, 0xD6C7, 0x667A, - 0xD6C8, 0x79E9, 0xD6C9, 0x7A1A, 0xD6CA, 0x8D28, 0xD6CB, 0x7099, - 0xD6CC, 0x75D4, 0xD6CD, 0x6EDE, 0xD6CE, 0x6CBB, 0xD6CF, 0x7A92, - 0xD6D0, 0x4E2D, 0xD6D1, 0x76C5, 0xD6D2, 0x5FE0, 0xD6D3, 0x949F, - 0xD6D4, 0x8877, 0xD6D5, 0x7EC8, 0xD6D6, 0x79CD, 0xD6D7, 0x80BF, - 0xD6D8, 0x91CD, 0xD6D9, 0x4EF2, 0xD6DA, 0x4F17, 0xD6DB, 0x821F, - 0xD6DC, 0x5468, 0xD6DD, 0x5DDE, 0xD6DE, 0x6D32, 0xD6DF, 0x8BCC, - 0xD6E0, 0x7CA5, 0xD6E1, 0x8F74, 0xD6E2, 0x8098, 0xD6E3, 0x5E1A, - 0xD6E4, 0x5492, 0xD6E5, 0x76B1, 0xD6E6, 0x5B99, 0xD6E7, 0x663C, - 0xD6E8, 0x9AA4, 0xD6E9, 0x73E0, 0xD6EA, 0x682A, 0xD6EB, 0x86DB, - 0xD6EC, 0x6731, 0xD6ED, 0x732A, 0xD6EE, 0x8BF8, 0xD6EF, 0x8BDB, - 0xD6F0, 0x9010, 0xD6F1, 0x7AF9, 0xD6F2, 0x70DB, 0xD6F3, 0x716E, - 0xD6F4, 0x62C4, 0xD6F5, 0x77A9, 0xD6F6, 0x5631, 0xD6F7, 0x4E3B, - 0xD6F8, 0x8457, 0xD6F9, 0x67F1, 0xD6FA, 0x52A9, 0xD6FB, 0x86C0, - 0xD6FC, 0x8D2E, 0xD6FD, 0x94F8, 0xD6FE, 0x7B51, 0xD740, 0x8B46, - 0xD741, 0x8B47, 0xD742, 0x8B48, 0xD743, 0x8B49, 0xD744, 0x8B4A, - 0xD745, 0x8B4B, 0xD746, 0x8B4C, 0xD747, 0x8B4D, 0xD748, 0x8B4E, - 0xD749, 0x8B4F, 0xD74A, 0x8B50, 0xD74B, 0x8B51, 0xD74C, 0x8B52, - 0xD74D, 0x8B53, 0xD74E, 0x8B54, 0xD74F, 0x8B55, 0xD750, 0x8B56, - 0xD751, 0x8B57, 0xD752, 0x8B58, 0xD753, 0x8B59, 0xD754, 0x8B5A, - 0xD755, 0x8B5B, 0xD756, 0x8B5C, 0xD757, 0x8B5D, 0xD758, 0x8B5E, - 0xD759, 0x8B5F, 0xD75A, 0x8B60, 0xD75B, 0x8B61, 0xD75C, 0x8B62, - 0xD75D, 0x8B63, 0xD75E, 0x8B64, 0xD75F, 0x8B65, 0xD760, 0x8B67, - 0xD761, 0x8B68, 0xD762, 0x8B69, 0xD763, 0x8B6A, 0xD764, 0x8B6B, - 0xD765, 0x8B6D, 0xD766, 0x8B6E, 0xD767, 0x8B6F, 0xD768, 0x8B70, - 0xD769, 0x8B71, 0xD76A, 0x8B72, 0xD76B, 0x8B73, 0xD76C, 0x8B74, - 0xD76D, 0x8B75, 0xD76E, 0x8B76, 0xD76F, 0x8B77, 0xD770, 0x8B78, - 0xD771, 0x8B79, 0xD772, 0x8B7A, 0xD773, 0x8B7B, 0xD774, 0x8B7C, - 0xD775, 0x8B7D, 0xD776, 0x8B7E, 0xD777, 0x8B7F, 0xD778, 0x8B80, - 0xD779, 0x8B81, 0xD77A, 0x8B82, 0xD77B, 0x8B83, 0xD77C, 0x8B84, - 0xD77D, 0x8B85, 0xD77E, 0x8B86, 0xD780, 0x8B87, 0xD781, 0x8B88, - 0xD782, 0x8B89, 0xD783, 0x8B8A, 0xD784, 0x8B8B, 0xD785, 0x8B8C, - 0xD786, 0x8B8D, 0xD787, 0x8B8E, 0xD788, 0x8B8F, 0xD789, 0x8B90, - 0xD78A, 0x8B91, 0xD78B, 0x8B92, 0xD78C, 0x8B93, 0xD78D, 0x8B94, - 0xD78E, 0x8B95, 0xD78F, 0x8B96, 0xD790, 0x8B97, 0xD791, 0x8B98, - 0xD792, 0x8B99, 0xD793, 0x8B9A, 0xD794, 0x8B9B, 0xD795, 0x8B9C, - 0xD796, 0x8B9D, 0xD797, 0x8B9E, 0xD798, 0x8B9F, 0xD799, 0x8BAC, - 0xD79A, 0x8BB1, 0xD79B, 0x8BBB, 0xD79C, 0x8BC7, 0xD79D, 0x8BD0, - 0xD79E, 0x8BEA, 0xD79F, 0x8C09, 0xD7A0, 0x8C1E, 0xD7A1, 0x4F4F, - 0xD7A2, 0x6CE8, 0xD7A3, 0x795D, 0xD7A4, 0x9A7B, 0xD7A5, 0x6293, - 0xD7A6, 0x722A, 0xD7A7, 0x62FD, 0xD7A8, 0x4E13, 0xD7A9, 0x7816, - 0xD7AA, 0x8F6C, 0xD7AB, 0x64B0, 0xD7AC, 0x8D5A, 0xD7AD, 0x7BC6, - 0xD7AE, 0x6869, 0xD7AF, 0x5E84, 0xD7B0, 0x88C5, 0xD7B1, 0x5986, - 0xD7B2, 0x649E, 0xD7B3, 0x58EE, 0xD7B4, 0x72B6, 0xD7B5, 0x690E, - 0xD7B6, 0x9525, 0xD7B7, 0x8FFD, 0xD7B8, 0x8D58, 0xD7B9, 0x5760, - 0xD7BA, 0x7F00, 0xD7BB, 0x8C06, 0xD7BC, 0x51C6, 0xD7BD, 0x6349, - 0xD7BE, 0x62D9, 0xD7BF, 0x5353, 0xD7C0, 0x684C, 0xD7C1, 0x7422, - 0xD7C2, 0x8301, 0xD7C3, 0x914C, 0xD7C4, 0x5544, 0xD7C5, 0x7740, - 0xD7C6, 0x707C, 0xD7C7, 0x6D4A, 0xD7C8, 0x5179, 0xD7C9, 0x54A8, - 0xD7CA, 0x8D44, 0xD7CB, 0x59FF, 0xD7CC, 0x6ECB, 0xD7CD, 0x6DC4, - 0xD7CE, 0x5B5C, 0xD7CF, 0x7D2B, 0xD7D0, 0x4ED4, 0xD7D1, 0x7C7D, - 0xD7D2, 0x6ED3, 0xD7D3, 0x5B50, 0xD7D4, 0x81EA, 0xD7D5, 0x6E0D, - 0xD7D6, 0x5B57, 0xD7D7, 0x9B03, 0xD7D8, 0x68D5, 0xD7D9, 0x8E2A, - 0xD7DA, 0x5B97, 0xD7DB, 0x7EFC, 0xD7DC, 0x603B, 0xD7DD, 0x7EB5, - 0xD7DE, 0x90B9, 0xD7DF, 0x8D70, 0xD7E0, 0x594F, 0xD7E1, 0x63CD, - 0xD7E2, 0x79DF, 0xD7E3, 0x8DB3, 0xD7E4, 0x5352, 0xD7E5, 0x65CF, - 0xD7E6, 0x7956, 0xD7E7, 0x8BC5, 0xD7E8, 0x963B, 0xD7E9, 0x7EC4, - 0xD7EA, 0x94BB, 0xD7EB, 0x7E82, 0xD7EC, 0x5634, 0xD7ED, 0x9189, - 0xD7EE, 0x6700, 0xD7EF, 0x7F6A, 0xD7F0, 0x5C0A, 0xD7F1, 0x9075, - 0xD7F2, 0x6628, 0xD7F3, 0x5DE6, 0xD7F4, 0x4F50, 0xD7F5, 0x67DE, - 0xD7F6, 0x505A, 0xD7F7, 0x4F5C, 0xD7F8, 0x5750, 0xD7F9, 0x5EA7, - 0xD840, 0x8C38, 0xD841, 0x8C39, 0xD842, 0x8C3A, 0xD843, 0x8C3B, - 0xD844, 0x8C3C, 0xD845, 0x8C3D, 0xD846, 0x8C3E, 0xD847, 0x8C3F, - 0xD848, 0x8C40, 0xD849, 0x8C42, 0xD84A, 0x8C43, 0xD84B, 0x8C44, - 0xD84C, 0x8C45, 0xD84D, 0x8C48, 0xD84E, 0x8C4A, 0xD84F, 0x8C4B, - 0xD850, 0x8C4D, 0xD851, 0x8C4E, 0xD852, 0x8C4F, 0xD853, 0x8C50, - 0xD854, 0x8C51, 0xD855, 0x8C52, 0xD856, 0x8C53, 0xD857, 0x8C54, - 0xD858, 0x8C56, 0xD859, 0x8C57, 0xD85A, 0x8C58, 0xD85B, 0x8C59, - 0xD85C, 0x8C5B, 0xD85D, 0x8C5C, 0xD85E, 0x8C5D, 0xD85F, 0x8C5E, - 0xD860, 0x8C5F, 0xD861, 0x8C60, 0xD862, 0x8C63, 0xD863, 0x8C64, - 0xD864, 0x8C65, 0xD865, 0x8C66, 0xD866, 0x8C67, 0xD867, 0x8C68, - 0xD868, 0x8C69, 0xD869, 0x8C6C, 0xD86A, 0x8C6D, 0xD86B, 0x8C6E, - 0xD86C, 0x8C6F, 0xD86D, 0x8C70, 0xD86E, 0x8C71, 0xD86F, 0x8C72, - 0xD870, 0x8C74, 0xD871, 0x8C75, 0xD872, 0x8C76, 0xD873, 0x8C77, - 0xD874, 0x8C7B, 0xD875, 0x8C7C, 0xD876, 0x8C7D, 0xD877, 0x8C7E, - 0xD878, 0x8C7F, 0xD879, 0x8C80, 0xD87A, 0x8C81, 0xD87B, 0x8C83, - 0xD87C, 0x8C84, 0xD87D, 0x8C86, 0xD87E, 0x8C87, 0xD880, 0x8C88, - 0xD881, 0x8C8B, 0xD882, 0x8C8D, 0xD883, 0x8C8E, 0xD884, 0x8C8F, - 0xD885, 0x8C90, 0xD886, 0x8C91, 0xD887, 0x8C92, 0xD888, 0x8C93, - 0xD889, 0x8C95, 0xD88A, 0x8C96, 0xD88B, 0x8C97, 0xD88C, 0x8C99, - 0xD88D, 0x8C9A, 0xD88E, 0x8C9B, 0xD88F, 0x8C9C, 0xD890, 0x8C9D, - 0xD891, 0x8C9E, 0xD892, 0x8C9F, 0xD893, 0x8CA0, 0xD894, 0x8CA1, - 0xD895, 0x8CA2, 0xD896, 0x8CA3, 0xD897, 0x8CA4, 0xD898, 0x8CA5, - 0xD899, 0x8CA6, 0xD89A, 0x8CA7, 0xD89B, 0x8CA8, 0xD89C, 0x8CA9, - 0xD89D, 0x8CAA, 0xD89E, 0x8CAB, 0xD89F, 0x8CAC, 0xD8A0, 0x8CAD, - 0xD8A1, 0x4E8D, 0xD8A2, 0x4E0C, 0xD8A3, 0x5140, 0xD8A4, 0x4E10, - 0xD8A5, 0x5EFF, 0xD8A6, 0x5345, 0xD8A7, 0x4E15, 0xD8A8, 0x4E98, - 0xD8A9, 0x4E1E, 0xD8AA, 0x9B32, 0xD8AB, 0x5B6C, 0xD8AC, 0x5669, - 0xD8AD, 0x4E28, 0xD8AE, 0x79BA, 0xD8AF, 0x4E3F, 0xD8B0, 0x5315, - 0xD8B1, 0x4E47, 0xD8B2, 0x592D, 0xD8B3, 0x723B, 0xD8B4, 0x536E, - 0xD8B5, 0x6C10, 0xD8B6, 0x56DF, 0xD8B7, 0x80E4, 0xD8B8, 0x9997, - 0xD8B9, 0x6BD3, 0xD8BA, 0x777E, 0xD8BB, 0x9F17, 0xD8BC, 0x4E36, - 0xD8BD, 0x4E9F, 0xD8BE, 0x9F10, 0xD8BF, 0x4E5C, 0xD8C0, 0x4E69, - 0xD8C1, 0x4E93, 0xD8C2, 0x8288, 0xD8C3, 0x5B5B, 0xD8C4, 0x556C, - 0xD8C5, 0x560F, 0xD8C6, 0x4EC4, 0xD8C7, 0x538D, 0xD8C8, 0x539D, - 0xD8C9, 0x53A3, 0xD8CA, 0x53A5, 0xD8CB, 0x53AE, 0xD8CC, 0x9765, - 0xD8CD, 0x8D5D, 0xD8CE, 0x531A, 0xD8CF, 0x53F5, 0xD8D0, 0x5326, - 0xD8D1, 0x532E, 0xD8D2, 0x533E, 0xD8D3, 0x8D5C, 0xD8D4, 0x5366, - 0xD8D5, 0x5363, 0xD8D6, 0x5202, 0xD8D7, 0x5208, 0xD8D8, 0x520E, - 0xD8D9, 0x522D, 0xD8DA, 0x5233, 0xD8DB, 0x523F, 0xD8DC, 0x5240, - 0xD8DD, 0x524C, 0xD8DE, 0x525E, 0xD8DF, 0x5261, 0xD8E0, 0x525C, - 0xD8E1, 0x84AF, 0xD8E2, 0x527D, 0xD8E3, 0x5282, 0xD8E4, 0x5281, - 0xD8E5, 0x5290, 0xD8E6, 0x5293, 0xD8E7, 0x5182, 0xD8E8, 0x7F54, - 0xD8E9, 0x4EBB, 0xD8EA, 0x4EC3, 0xD8EB, 0x4EC9, 0xD8EC, 0x4EC2, - 0xD8ED, 0x4EE8, 0xD8EE, 0x4EE1, 0xD8EF, 0x4EEB, 0xD8F0, 0x4EDE, - 0xD8F1, 0x4F1B, 0xD8F2, 0x4EF3, 0xD8F3, 0x4F22, 0xD8F4, 0x4F64, - 0xD8F5, 0x4EF5, 0xD8F6, 0x4F25, 0xD8F7, 0x4F27, 0xD8F8, 0x4F09, - 0xD8F9, 0x4F2B, 0xD8FA, 0x4F5E, 0xD8FB, 0x4F67, 0xD8FC, 0x6538, - 0xD8FD, 0x4F5A, 0xD8FE, 0x4F5D, 0xD940, 0x8CAE, 0xD941, 0x8CAF, - 0xD942, 0x8CB0, 0xD943, 0x8CB1, 0xD944, 0x8CB2, 0xD945, 0x8CB3, - 0xD946, 0x8CB4, 0xD947, 0x8CB5, 0xD948, 0x8CB6, 0xD949, 0x8CB7, - 0xD94A, 0x8CB8, 0xD94B, 0x8CB9, 0xD94C, 0x8CBA, 0xD94D, 0x8CBB, - 0xD94E, 0x8CBC, 0xD94F, 0x8CBD, 0xD950, 0x8CBE, 0xD951, 0x8CBF, - 0xD952, 0x8CC0, 0xD953, 0x8CC1, 0xD954, 0x8CC2, 0xD955, 0x8CC3, - 0xD956, 0x8CC4, 0xD957, 0x8CC5, 0xD958, 0x8CC6, 0xD959, 0x8CC7, - 0xD95A, 0x8CC8, 0xD95B, 0x8CC9, 0xD95C, 0x8CCA, 0xD95D, 0x8CCB, - 0xD95E, 0x8CCC, 0xD95F, 0x8CCD, 0xD960, 0x8CCE, 0xD961, 0x8CCF, - 0xD962, 0x8CD0, 0xD963, 0x8CD1, 0xD964, 0x8CD2, 0xD965, 0x8CD3, - 0xD966, 0x8CD4, 0xD967, 0x8CD5, 0xD968, 0x8CD6, 0xD969, 0x8CD7, - 0xD96A, 0x8CD8, 0xD96B, 0x8CD9, 0xD96C, 0x8CDA, 0xD96D, 0x8CDB, - 0xD96E, 0x8CDC, 0xD96F, 0x8CDD, 0xD970, 0x8CDE, 0xD971, 0x8CDF, - 0xD972, 0x8CE0, 0xD973, 0x8CE1, 0xD974, 0x8CE2, 0xD975, 0x8CE3, - 0xD976, 0x8CE4, 0xD977, 0x8CE5, 0xD978, 0x8CE6, 0xD979, 0x8CE7, - 0xD97A, 0x8CE8, 0xD97B, 0x8CE9, 0xD97C, 0x8CEA, 0xD97D, 0x8CEB, - 0xD97E, 0x8CEC, 0xD980, 0x8CED, 0xD981, 0x8CEE, 0xD982, 0x8CEF, - 0xD983, 0x8CF0, 0xD984, 0x8CF1, 0xD985, 0x8CF2, 0xD986, 0x8CF3, - 0xD987, 0x8CF4, 0xD988, 0x8CF5, 0xD989, 0x8CF6, 0xD98A, 0x8CF7, - 0xD98B, 0x8CF8, 0xD98C, 0x8CF9, 0xD98D, 0x8CFA, 0xD98E, 0x8CFB, - 0xD98F, 0x8CFC, 0xD990, 0x8CFD, 0xD991, 0x8CFE, 0xD992, 0x8CFF, - 0xD993, 0x8D00, 0xD994, 0x8D01, 0xD995, 0x8D02, 0xD996, 0x8D03, - 0xD997, 0x8D04, 0xD998, 0x8D05, 0xD999, 0x8D06, 0xD99A, 0x8D07, - 0xD99B, 0x8D08, 0xD99C, 0x8D09, 0xD99D, 0x8D0A, 0xD99E, 0x8D0B, - 0xD99F, 0x8D0C, 0xD9A0, 0x8D0D, 0xD9A1, 0x4F5F, 0xD9A2, 0x4F57, - 0xD9A3, 0x4F32, 0xD9A4, 0x4F3D, 0xD9A5, 0x4F76, 0xD9A6, 0x4F74, - 0xD9A7, 0x4F91, 0xD9A8, 0x4F89, 0xD9A9, 0x4F83, 0xD9AA, 0x4F8F, - 0xD9AB, 0x4F7E, 0xD9AC, 0x4F7B, 0xD9AD, 0x4FAA, 0xD9AE, 0x4F7C, - 0xD9AF, 0x4FAC, 0xD9B0, 0x4F94, 0xD9B1, 0x4FE6, 0xD9B2, 0x4FE8, - 0xD9B3, 0x4FEA, 0xD9B4, 0x4FC5, 0xD9B5, 0x4FDA, 0xD9B6, 0x4FE3, - 0xD9B7, 0x4FDC, 0xD9B8, 0x4FD1, 0xD9B9, 0x4FDF, 0xD9BA, 0x4FF8, - 0xD9BB, 0x5029, 0xD9BC, 0x504C, 0xD9BD, 0x4FF3, 0xD9BE, 0x502C, - 0xD9BF, 0x500F, 0xD9C0, 0x502E, 0xD9C1, 0x502D, 0xD9C2, 0x4FFE, - 0xD9C3, 0x501C, 0xD9C4, 0x500C, 0xD9C5, 0x5025, 0xD9C6, 0x5028, - 0xD9C7, 0x507E, 0xD9C8, 0x5043, 0xD9C9, 0x5055, 0xD9CA, 0x5048, - 0xD9CB, 0x504E, 0xD9CC, 0x506C, 0xD9CD, 0x507B, 0xD9CE, 0x50A5, - 0xD9CF, 0x50A7, 0xD9D0, 0x50A9, 0xD9D1, 0x50BA, 0xD9D2, 0x50D6, - 0xD9D3, 0x5106, 0xD9D4, 0x50ED, 0xD9D5, 0x50EC, 0xD9D6, 0x50E6, - 0xD9D7, 0x50EE, 0xD9D8, 0x5107, 0xD9D9, 0x510B, 0xD9DA, 0x4EDD, - 0xD9DB, 0x6C3D, 0xD9DC, 0x4F58, 0xD9DD, 0x4F65, 0xD9DE, 0x4FCE, - 0xD9DF, 0x9FA0, 0xD9E0, 0x6C46, 0xD9E1, 0x7C74, 0xD9E2, 0x516E, - 0xD9E3, 0x5DFD, 0xD9E4, 0x9EC9, 0xD9E5, 0x9998, 0xD9E6, 0x5181, - 0xD9E7, 0x5914, 0xD9E8, 0x52F9, 0xD9E9, 0x530D, 0xD9EA, 0x8A07, - 0xD9EB, 0x5310, 0xD9EC, 0x51EB, 0xD9ED, 0x5919, 0xD9EE, 0x5155, - 0xD9EF, 0x4EA0, 0xD9F0, 0x5156, 0xD9F1, 0x4EB3, 0xD9F2, 0x886E, - 0xD9F3, 0x88A4, 0xD9F4, 0x4EB5, 0xD9F5, 0x8114, 0xD9F6, 0x88D2, - 0xD9F7, 0x7980, 0xD9F8, 0x5B34, 0xD9F9, 0x8803, 0xD9FA, 0x7FB8, - 0xD9FB, 0x51AB, 0xD9FC, 0x51B1, 0xD9FD, 0x51BD, 0xD9FE, 0x51BC, - 0xDA40, 0x8D0E, 0xDA41, 0x8D0F, 0xDA42, 0x8D10, 0xDA43, 0x8D11, - 0xDA44, 0x8D12, 0xDA45, 0x8D13, 0xDA46, 0x8D14, 0xDA47, 0x8D15, - 0xDA48, 0x8D16, 0xDA49, 0x8D17, 0xDA4A, 0x8D18, 0xDA4B, 0x8D19, - 0xDA4C, 0x8D1A, 0xDA4D, 0x8D1B, 0xDA4E, 0x8D1C, 0xDA4F, 0x8D20, - 0xDA50, 0x8D51, 0xDA51, 0x8D52, 0xDA52, 0x8D57, 0xDA53, 0x8D5F, - 0xDA54, 0x8D65, 0xDA55, 0x8D68, 0xDA56, 0x8D69, 0xDA57, 0x8D6A, - 0xDA58, 0x8D6C, 0xDA59, 0x8D6E, 0xDA5A, 0x8D6F, 0xDA5B, 0x8D71, - 0xDA5C, 0x8D72, 0xDA5D, 0x8D78, 0xDA5E, 0x8D79, 0xDA5F, 0x8D7A, - 0xDA60, 0x8D7B, 0xDA61, 0x8D7C, 0xDA62, 0x8D7D, 0xDA63, 0x8D7E, - 0xDA64, 0x8D7F, 0xDA65, 0x8D80, 0xDA66, 0x8D82, 0xDA67, 0x8D83, - 0xDA68, 0x8D86, 0xDA69, 0x8D87, 0xDA6A, 0x8D88, 0xDA6B, 0x8D89, - 0xDA6C, 0x8D8C, 0xDA6D, 0x8D8D, 0xDA6E, 0x8D8E, 0xDA6F, 0x8D8F, - 0xDA70, 0x8D90, 0xDA71, 0x8D92, 0xDA72, 0x8D93, 0xDA73, 0x8D95, - 0xDA74, 0x8D96, 0xDA75, 0x8D97, 0xDA76, 0x8D98, 0xDA77, 0x8D99, - 0xDA78, 0x8D9A, 0xDA79, 0x8D9B, 0xDA7A, 0x8D9C, 0xDA7B, 0x8D9D, - 0xDA7C, 0x8D9E, 0xDA7D, 0x8DA0, 0xDA7E, 0x8DA1, 0xDA80, 0x8DA2, - 0xDA81, 0x8DA4, 0xDA82, 0x8DA5, 0xDA83, 0x8DA6, 0xDA84, 0x8DA7, - 0xDA85, 0x8DA8, 0xDA86, 0x8DA9, 0xDA87, 0x8DAA, 0xDA88, 0x8DAB, - 0xDA89, 0x8DAC, 0xDA8A, 0x8DAD, 0xDA8B, 0x8DAE, 0xDA8C, 0x8DAF, - 0xDA8D, 0x8DB0, 0xDA8E, 0x8DB2, 0xDA8F, 0x8DB6, 0xDA90, 0x8DB7, - 0xDA91, 0x8DB9, 0xDA92, 0x8DBB, 0xDA93, 0x8DBD, 0xDA94, 0x8DC0, - 0xDA95, 0x8DC1, 0xDA96, 0x8DC2, 0xDA97, 0x8DC5, 0xDA98, 0x8DC7, - 0xDA99, 0x8DC8, 0xDA9A, 0x8DC9, 0xDA9B, 0x8DCA, 0xDA9C, 0x8DCD, - 0xDA9D, 0x8DD0, 0xDA9E, 0x8DD2, 0xDA9F, 0x8DD3, 0xDAA0, 0x8DD4, - 0xDAA1, 0x51C7, 0xDAA2, 0x5196, 0xDAA3, 0x51A2, 0xDAA4, 0x51A5, - 0xDAA5, 0x8BA0, 0xDAA6, 0x8BA6, 0xDAA7, 0x8BA7, 0xDAA8, 0x8BAA, - 0xDAA9, 0x8BB4, 0xDAAA, 0x8BB5, 0xDAAB, 0x8BB7, 0xDAAC, 0x8BC2, - 0xDAAD, 0x8BC3, 0xDAAE, 0x8BCB, 0xDAAF, 0x8BCF, 0xDAB0, 0x8BCE, - 0xDAB1, 0x8BD2, 0xDAB2, 0x8BD3, 0xDAB3, 0x8BD4, 0xDAB4, 0x8BD6, - 0xDAB5, 0x8BD8, 0xDAB6, 0x8BD9, 0xDAB7, 0x8BDC, 0xDAB8, 0x8BDF, - 0xDAB9, 0x8BE0, 0xDABA, 0x8BE4, 0xDABB, 0x8BE8, 0xDABC, 0x8BE9, - 0xDABD, 0x8BEE, 0xDABE, 0x8BF0, 0xDABF, 0x8BF3, 0xDAC0, 0x8BF6, - 0xDAC1, 0x8BF9, 0xDAC2, 0x8BFC, 0xDAC3, 0x8BFF, 0xDAC4, 0x8C00, - 0xDAC5, 0x8C02, 0xDAC6, 0x8C04, 0xDAC7, 0x8C07, 0xDAC8, 0x8C0C, - 0xDAC9, 0x8C0F, 0xDACA, 0x8C11, 0xDACB, 0x8C12, 0xDACC, 0x8C14, - 0xDACD, 0x8C15, 0xDACE, 0x8C16, 0xDACF, 0x8C19, 0xDAD0, 0x8C1B, - 0xDAD1, 0x8C18, 0xDAD2, 0x8C1D, 0xDAD3, 0x8C1F, 0xDAD4, 0x8C20, - 0xDAD5, 0x8C21, 0xDAD6, 0x8C25, 0xDAD7, 0x8C27, 0xDAD8, 0x8C2A, - 0xDAD9, 0x8C2B, 0xDADA, 0x8C2E, 0xDADB, 0x8C2F, 0xDADC, 0x8C32, - 0xDADD, 0x8C33, 0xDADE, 0x8C35, 0xDADF, 0x8C36, 0xDAE0, 0x5369, - 0xDAE1, 0x537A, 0xDAE2, 0x961D, 0xDAE3, 0x9622, 0xDAE4, 0x9621, - 0xDAE5, 0x9631, 0xDAE6, 0x962A, 0xDAE7, 0x963D, 0xDAE8, 0x963C, - 0xDAE9, 0x9642, 0xDAEA, 0x9649, 0xDAEB, 0x9654, 0xDAEC, 0x965F, - 0xDAED, 0x9667, 0xDAEE, 0x966C, 0xDAEF, 0x9672, 0xDAF0, 0x9674, - 0xDAF1, 0x9688, 0xDAF2, 0x968D, 0xDAF3, 0x9697, 0xDAF4, 0x96B0, - 0xDAF5, 0x9097, 0xDAF6, 0x909B, 0xDAF7, 0x909D, 0xDAF8, 0x9099, - 0xDAF9, 0x90AC, 0xDAFA, 0x90A1, 0xDAFB, 0x90B4, 0xDAFC, 0x90B3, - 0xDAFD, 0x90B6, 0xDAFE, 0x90BA, 0xDB40, 0x8DD5, 0xDB41, 0x8DD8, - 0xDB42, 0x8DD9, 0xDB43, 0x8DDC, 0xDB44, 0x8DE0, 0xDB45, 0x8DE1, - 0xDB46, 0x8DE2, 0xDB47, 0x8DE5, 0xDB48, 0x8DE6, 0xDB49, 0x8DE7, - 0xDB4A, 0x8DE9, 0xDB4B, 0x8DED, 0xDB4C, 0x8DEE, 0xDB4D, 0x8DF0, - 0xDB4E, 0x8DF1, 0xDB4F, 0x8DF2, 0xDB50, 0x8DF4, 0xDB51, 0x8DF6, - 0xDB52, 0x8DFC, 0xDB53, 0x8DFE, 0xDB54, 0x8DFF, 0xDB55, 0x8E00, - 0xDB56, 0x8E01, 0xDB57, 0x8E02, 0xDB58, 0x8E03, 0xDB59, 0x8E04, - 0xDB5A, 0x8E06, 0xDB5B, 0x8E07, 0xDB5C, 0x8E08, 0xDB5D, 0x8E0B, - 0xDB5E, 0x8E0D, 0xDB5F, 0x8E0E, 0xDB60, 0x8E10, 0xDB61, 0x8E11, - 0xDB62, 0x8E12, 0xDB63, 0x8E13, 0xDB64, 0x8E15, 0xDB65, 0x8E16, - 0xDB66, 0x8E17, 0xDB67, 0x8E18, 0xDB68, 0x8E19, 0xDB69, 0x8E1A, - 0xDB6A, 0x8E1B, 0xDB6B, 0x8E1C, 0xDB6C, 0x8E20, 0xDB6D, 0x8E21, - 0xDB6E, 0x8E24, 0xDB6F, 0x8E25, 0xDB70, 0x8E26, 0xDB71, 0x8E27, - 0xDB72, 0x8E28, 0xDB73, 0x8E2B, 0xDB74, 0x8E2D, 0xDB75, 0x8E30, - 0xDB76, 0x8E32, 0xDB77, 0x8E33, 0xDB78, 0x8E34, 0xDB79, 0x8E36, - 0xDB7A, 0x8E37, 0xDB7B, 0x8E38, 0xDB7C, 0x8E3B, 0xDB7D, 0x8E3C, - 0xDB7E, 0x8E3E, 0xDB80, 0x8E3F, 0xDB81, 0x8E43, 0xDB82, 0x8E45, - 0xDB83, 0x8E46, 0xDB84, 0x8E4C, 0xDB85, 0x8E4D, 0xDB86, 0x8E4E, - 0xDB87, 0x8E4F, 0xDB88, 0x8E50, 0xDB89, 0x8E53, 0xDB8A, 0x8E54, - 0xDB8B, 0x8E55, 0xDB8C, 0x8E56, 0xDB8D, 0x8E57, 0xDB8E, 0x8E58, - 0xDB8F, 0x8E5A, 0xDB90, 0x8E5B, 0xDB91, 0x8E5C, 0xDB92, 0x8E5D, - 0xDB93, 0x8E5E, 0xDB94, 0x8E5F, 0xDB95, 0x8E60, 0xDB96, 0x8E61, - 0xDB97, 0x8E62, 0xDB98, 0x8E63, 0xDB99, 0x8E64, 0xDB9A, 0x8E65, - 0xDB9B, 0x8E67, 0xDB9C, 0x8E68, 0xDB9D, 0x8E6A, 0xDB9E, 0x8E6B, - 0xDB9F, 0x8E6E, 0xDBA0, 0x8E71, 0xDBA1, 0x90B8, 0xDBA2, 0x90B0, - 0xDBA3, 0x90CF, 0xDBA4, 0x90C5, 0xDBA5, 0x90BE, 0xDBA6, 0x90D0, - 0xDBA7, 0x90C4, 0xDBA8, 0x90C7, 0xDBA9, 0x90D3, 0xDBAA, 0x90E6, - 0xDBAB, 0x90E2, 0xDBAC, 0x90DC, 0xDBAD, 0x90D7, 0xDBAE, 0x90DB, - 0xDBAF, 0x90EB, 0xDBB0, 0x90EF, 0xDBB1, 0x90FE, 0xDBB2, 0x9104, - 0xDBB3, 0x9122, 0xDBB4, 0x911E, 0xDBB5, 0x9123, 0xDBB6, 0x9131, - 0xDBB7, 0x912F, 0xDBB8, 0x9139, 0xDBB9, 0x9143, 0xDBBA, 0x9146, - 0xDBBB, 0x520D, 0xDBBC, 0x5942, 0xDBBD, 0x52A2, 0xDBBE, 0x52AC, - 0xDBBF, 0x52AD, 0xDBC0, 0x52BE, 0xDBC1, 0x54FF, 0xDBC2, 0x52D0, - 0xDBC3, 0x52D6, 0xDBC4, 0x52F0, 0xDBC5, 0x53DF, 0xDBC6, 0x71EE, - 0xDBC7, 0x77CD, 0xDBC8, 0x5EF4, 0xDBC9, 0x51F5, 0xDBCA, 0x51FC, - 0xDBCB, 0x9B2F, 0xDBCC, 0x53B6, 0xDBCD, 0x5F01, 0xDBCE, 0x755A, - 0xDBCF, 0x5DEF, 0xDBD0, 0x574C, 0xDBD1, 0x57A9, 0xDBD2, 0x57A1, - 0xDBD3, 0x587E, 0xDBD4, 0x58BC, 0xDBD5, 0x58C5, 0xDBD6, 0x58D1, - 0xDBD7, 0x5729, 0xDBD8, 0x572C, 0xDBD9, 0x572A, 0xDBDA, 0x5733, - 0xDBDB, 0x5739, 0xDBDC, 0x572E, 0xDBDD, 0x572F, 0xDBDE, 0x575C, - 0xDBDF, 0x573B, 0xDBE0, 0x5742, 0xDBE1, 0x5769, 0xDBE2, 0x5785, - 0xDBE3, 0x576B, 0xDBE4, 0x5786, 0xDBE5, 0x577C, 0xDBE6, 0x577B, - 0xDBE7, 0x5768, 0xDBE8, 0x576D, 0xDBE9, 0x5776, 0xDBEA, 0x5773, - 0xDBEB, 0x57AD, 0xDBEC, 0x57A4, 0xDBED, 0x578C, 0xDBEE, 0x57B2, - 0xDBEF, 0x57CF, 0xDBF0, 0x57A7, 0xDBF1, 0x57B4, 0xDBF2, 0x5793, - 0xDBF3, 0x57A0, 0xDBF4, 0x57D5, 0xDBF5, 0x57D8, 0xDBF6, 0x57DA, - 0xDBF7, 0x57D9, 0xDBF8, 0x57D2, 0xDBF9, 0x57B8, 0xDBFA, 0x57F4, - 0xDBFB, 0x57EF, 0xDBFC, 0x57F8, 0xDBFD, 0x57E4, 0xDBFE, 0x57DD, - 0xDC40, 0x8E73, 0xDC41, 0x8E75, 0xDC42, 0x8E77, 0xDC43, 0x8E78, - 0xDC44, 0x8E79, 0xDC45, 0x8E7A, 0xDC46, 0x8E7B, 0xDC47, 0x8E7D, - 0xDC48, 0x8E7E, 0xDC49, 0x8E80, 0xDC4A, 0x8E82, 0xDC4B, 0x8E83, - 0xDC4C, 0x8E84, 0xDC4D, 0x8E86, 0xDC4E, 0x8E88, 0xDC4F, 0x8E89, - 0xDC50, 0x8E8A, 0xDC51, 0x8E8B, 0xDC52, 0x8E8C, 0xDC53, 0x8E8D, - 0xDC54, 0x8E8E, 0xDC55, 0x8E91, 0xDC56, 0x8E92, 0xDC57, 0x8E93, - 0xDC58, 0x8E95, 0xDC59, 0x8E96, 0xDC5A, 0x8E97, 0xDC5B, 0x8E98, - 0xDC5C, 0x8E99, 0xDC5D, 0x8E9A, 0xDC5E, 0x8E9B, 0xDC5F, 0x8E9D, - 0xDC60, 0x8E9F, 0xDC61, 0x8EA0, 0xDC62, 0x8EA1, 0xDC63, 0x8EA2, - 0xDC64, 0x8EA3, 0xDC65, 0x8EA4, 0xDC66, 0x8EA5, 0xDC67, 0x8EA6, - 0xDC68, 0x8EA7, 0xDC69, 0x8EA8, 0xDC6A, 0x8EA9, 0xDC6B, 0x8EAA, - 0xDC6C, 0x8EAD, 0xDC6D, 0x8EAE, 0xDC6E, 0x8EB0, 0xDC6F, 0x8EB1, - 0xDC70, 0x8EB3, 0xDC71, 0x8EB4, 0xDC72, 0x8EB5, 0xDC73, 0x8EB6, - 0xDC74, 0x8EB7, 0xDC75, 0x8EB8, 0xDC76, 0x8EB9, 0xDC77, 0x8EBB, - 0xDC78, 0x8EBC, 0xDC79, 0x8EBD, 0xDC7A, 0x8EBE, 0xDC7B, 0x8EBF, - 0xDC7C, 0x8EC0, 0xDC7D, 0x8EC1, 0xDC7E, 0x8EC2, 0xDC80, 0x8EC3, - 0xDC81, 0x8EC4, 0xDC82, 0x8EC5, 0xDC83, 0x8EC6, 0xDC84, 0x8EC7, - 0xDC85, 0x8EC8, 0xDC86, 0x8EC9, 0xDC87, 0x8ECA, 0xDC88, 0x8ECB, - 0xDC89, 0x8ECC, 0xDC8A, 0x8ECD, 0xDC8B, 0x8ECF, 0xDC8C, 0x8ED0, - 0xDC8D, 0x8ED1, 0xDC8E, 0x8ED2, 0xDC8F, 0x8ED3, 0xDC90, 0x8ED4, - 0xDC91, 0x8ED5, 0xDC92, 0x8ED6, 0xDC93, 0x8ED7, 0xDC94, 0x8ED8, - 0xDC95, 0x8ED9, 0xDC96, 0x8EDA, 0xDC97, 0x8EDB, 0xDC98, 0x8EDC, - 0xDC99, 0x8EDD, 0xDC9A, 0x8EDE, 0xDC9B, 0x8EDF, 0xDC9C, 0x8EE0, - 0xDC9D, 0x8EE1, 0xDC9E, 0x8EE2, 0xDC9F, 0x8EE3, 0xDCA0, 0x8EE4, - 0xDCA1, 0x580B, 0xDCA2, 0x580D, 0xDCA3, 0x57FD, 0xDCA4, 0x57ED, - 0xDCA5, 0x5800, 0xDCA6, 0x581E, 0xDCA7, 0x5819, 0xDCA8, 0x5844, - 0xDCA9, 0x5820, 0xDCAA, 0x5865, 0xDCAB, 0x586C, 0xDCAC, 0x5881, - 0xDCAD, 0x5889, 0xDCAE, 0x589A, 0xDCAF, 0x5880, 0xDCB0, 0x99A8, - 0xDCB1, 0x9F19, 0xDCB2, 0x61FF, 0xDCB3, 0x8279, 0xDCB4, 0x827D, - 0xDCB5, 0x827F, 0xDCB6, 0x828F, 0xDCB7, 0x828A, 0xDCB8, 0x82A8, - 0xDCB9, 0x8284, 0xDCBA, 0x828E, 0xDCBB, 0x8291, 0xDCBC, 0x8297, - 0xDCBD, 0x8299, 0xDCBE, 0x82AB, 0xDCBF, 0x82B8, 0xDCC0, 0x82BE, - 0xDCC1, 0x82B0, 0xDCC2, 0x82C8, 0xDCC3, 0x82CA, 0xDCC4, 0x82E3, - 0xDCC5, 0x8298, 0xDCC6, 0x82B7, 0xDCC7, 0x82AE, 0xDCC8, 0x82CB, - 0xDCC9, 0x82CC, 0xDCCA, 0x82C1, 0xDCCB, 0x82A9, 0xDCCC, 0x82B4, - 0xDCCD, 0x82A1, 0xDCCE, 0x82AA, 0xDCCF, 0x829F, 0xDCD0, 0x82C4, - 0xDCD1, 0x82CE, 0xDCD2, 0x82A4, 0xDCD3, 0x82E1, 0xDCD4, 0x8309, - 0xDCD5, 0x82F7, 0xDCD6, 0x82E4, 0xDCD7, 0x830F, 0xDCD8, 0x8307, - 0xDCD9, 0x82DC, 0xDCDA, 0x82F4, 0xDCDB, 0x82D2, 0xDCDC, 0x82D8, - 0xDCDD, 0x830C, 0xDCDE, 0x82FB, 0xDCDF, 0x82D3, 0xDCE0, 0x8311, - 0xDCE1, 0x831A, 0xDCE2, 0x8306, 0xDCE3, 0x8314, 0xDCE4, 0x8315, - 0xDCE5, 0x82E0, 0xDCE6, 0x82D5, 0xDCE7, 0x831C, 0xDCE8, 0x8351, - 0xDCE9, 0x835B, 0xDCEA, 0x835C, 0xDCEB, 0x8308, 0xDCEC, 0x8392, - 0xDCED, 0x833C, 0xDCEE, 0x8334, 0xDCEF, 0x8331, 0xDCF0, 0x839B, - 0xDCF1, 0x835E, 0xDCF2, 0x832F, 0xDCF3, 0x834F, 0xDCF4, 0x8347, - 0xDCF5, 0x8343, 0xDCF6, 0x835F, 0xDCF7, 0x8340, 0xDCF8, 0x8317, - 0xDCF9, 0x8360, 0xDCFA, 0x832D, 0xDCFB, 0x833A, 0xDCFC, 0x8333, - 0xDCFD, 0x8366, 0xDCFE, 0x8365, 0xDD40, 0x8EE5, 0xDD41, 0x8EE6, - 0xDD42, 0x8EE7, 0xDD43, 0x8EE8, 0xDD44, 0x8EE9, 0xDD45, 0x8EEA, - 0xDD46, 0x8EEB, 0xDD47, 0x8EEC, 0xDD48, 0x8EED, 0xDD49, 0x8EEE, - 0xDD4A, 0x8EEF, 0xDD4B, 0x8EF0, 0xDD4C, 0x8EF1, 0xDD4D, 0x8EF2, - 0xDD4E, 0x8EF3, 0xDD4F, 0x8EF4, 0xDD50, 0x8EF5, 0xDD51, 0x8EF6, - 0xDD52, 0x8EF7, 0xDD53, 0x8EF8, 0xDD54, 0x8EF9, 0xDD55, 0x8EFA, - 0xDD56, 0x8EFB, 0xDD57, 0x8EFC, 0xDD58, 0x8EFD, 0xDD59, 0x8EFE, - 0xDD5A, 0x8EFF, 0xDD5B, 0x8F00, 0xDD5C, 0x8F01, 0xDD5D, 0x8F02, - 0xDD5E, 0x8F03, 0xDD5F, 0x8F04, 0xDD60, 0x8F05, 0xDD61, 0x8F06, - 0xDD62, 0x8F07, 0xDD63, 0x8F08, 0xDD64, 0x8F09, 0xDD65, 0x8F0A, - 0xDD66, 0x8F0B, 0xDD67, 0x8F0C, 0xDD68, 0x8F0D, 0xDD69, 0x8F0E, - 0xDD6A, 0x8F0F, 0xDD6B, 0x8F10, 0xDD6C, 0x8F11, 0xDD6D, 0x8F12, - 0xDD6E, 0x8F13, 0xDD6F, 0x8F14, 0xDD70, 0x8F15, 0xDD71, 0x8F16, - 0xDD72, 0x8F17, 0xDD73, 0x8F18, 0xDD74, 0x8F19, 0xDD75, 0x8F1A, - 0xDD76, 0x8F1B, 0xDD77, 0x8F1C, 0xDD78, 0x8F1D, 0xDD79, 0x8F1E, - 0xDD7A, 0x8F1F, 0xDD7B, 0x8F20, 0xDD7C, 0x8F21, 0xDD7D, 0x8F22, - 0xDD7E, 0x8F23, 0xDD80, 0x8F24, 0xDD81, 0x8F25, 0xDD82, 0x8F26, - 0xDD83, 0x8F27, 0xDD84, 0x8F28, 0xDD85, 0x8F29, 0xDD86, 0x8F2A, - 0xDD87, 0x8F2B, 0xDD88, 0x8F2C, 0xDD89, 0x8F2D, 0xDD8A, 0x8F2E, - 0xDD8B, 0x8F2F, 0xDD8C, 0x8F30, 0xDD8D, 0x8F31, 0xDD8E, 0x8F32, - 0xDD8F, 0x8F33, 0xDD90, 0x8F34, 0xDD91, 0x8F35, 0xDD92, 0x8F36, - 0xDD93, 0x8F37, 0xDD94, 0x8F38, 0xDD95, 0x8F39, 0xDD96, 0x8F3A, - 0xDD97, 0x8F3B, 0xDD98, 0x8F3C, 0xDD99, 0x8F3D, 0xDD9A, 0x8F3E, - 0xDD9B, 0x8F3F, 0xDD9C, 0x8F40, 0xDD9D, 0x8F41, 0xDD9E, 0x8F42, - 0xDD9F, 0x8F43, 0xDDA0, 0x8F44, 0xDDA1, 0x8368, 0xDDA2, 0x831B, - 0xDDA3, 0x8369, 0xDDA4, 0x836C, 0xDDA5, 0x836A, 0xDDA6, 0x836D, - 0xDDA7, 0x836E, 0xDDA8, 0x83B0, 0xDDA9, 0x8378, 0xDDAA, 0x83B3, - 0xDDAB, 0x83B4, 0xDDAC, 0x83A0, 0xDDAD, 0x83AA, 0xDDAE, 0x8393, - 0xDDAF, 0x839C, 0xDDB0, 0x8385, 0xDDB1, 0x837C, 0xDDB2, 0x83B6, - 0xDDB3, 0x83A9, 0xDDB4, 0x837D, 0xDDB5, 0x83B8, 0xDDB6, 0x837B, - 0xDDB7, 0x8398, 0xDDB8, 0x839E, 0xDDB9, 0x83A8, 0xDDBA, 0x83BA, - 0xDDBB, 0x83BC, 0xDDBC, 0x83C1, 0xDDBD, 0x8401, 0xDDBE, 0x83E5, - 0xDDBF, 0x83D8, 0xDDC0, 0x5807, 0xDDC1, 0x8418, 0xDDC2, 0x840B, - 0xDDC3, 0x83DD, 0xDDC4, 0x83FD, 0xDDC5, 0x83D6, 0xDDC6, 0x841C, - 0xDDC7, 0x8438, 0xDDC8, 0x8411, 0xDDC9, 0x8406, 0xDDCA, 0x83D4, - 0xDDCB, 0x83DF, 0xDDCC, 0x840F, 0xDDCD, 0x8403, 0xDDCE, 0x83F8, - 0xDDCF, 0x83F9, 0xDDD0, 0x83EA, 0xDDD1, 0x83C5, 0xDDD2, 0x83C0, - 0xDDD3, 0x8426, 0xDDD4, 0x83F0, 0xDDD5, 0x83E1, 0xDDD6, 0x845C, - 0xDDD7, 0x8451, 0xDDD8, 0x845A, 0xDDD9, 0x8459, 0xDDDA, 0x8473, - 0xDDDB, 0x8487, 0xDDDC, 0x8488, 0xDDDD, 0x847A, 0xDDDE, 0x8489, - 0xDDDF, 0x8478, 0xDDE0, 0x843C, 0xDDE1, 0x8446, 0xDDE2, 0x8469, - 0xDDE3, 0x8476, 0xDDE4, 0x848C, 0xDDE5, 0x848E, 0xDDE6, 0x8431, - 0xDDE7, 0x846D, 0xDDE8, 0x84C1, 0xDDE9, 0x84CD, 0xDDEA, 0x84D0, - 0xDDEB, 0x84E6, 0xDDEC, 0x84BD, 0xDDED, 0x84D3, 0xDDEE, 0x84CA, - 0xDDEF, 0x84BF, 0xDDF0, 0x84BA, 0xDDF1, 0x84E0, 0xDDF2, 0x84A1, - 0xDDF3, 0x84B9, 0xDDF4, 0x84B4, 0xDDF5, 0x8497, 0xDDF6, 0x84E5, - 0xDDF7, 0x84E3, 0xDDF8, 0x850C, 0xDDF9, 0x750D, 0xDDFA, 0x8538, - 0xDDFB, 0x84F0, 0xDDFC, 0x8539, 0xDDFD, 0x851F, 0xDDFE, 0x853A, - 0xDE40, 0x8F45, 0xDE41, 0x8F46, 0xDE42, 0x8F47, 0xDE43, 0x8F48, - 0xDE44, 0x8F49, 0xDE45, 0x8F4A, 0xDE46, 0x8F4B, 0xDE47, 0x8F4C, - 0xDE48, 0x8F4D, 0xDE49, 0x8F4E, 0xDE4A, 0x8F4F, 0xDE4B, 0x8F50, - 0xDE4C, 0x8F51, 0xDE4D, 0x8F52, 0xDE4E, 0x8F53, 0xDE4F, 0x8F54, - 0xDE50, 0x8F55, 0xDE51, 0x8F56, 0xDE52, 0x8F57, 0xDE53, 0x8F58, - 0xDE54, 0x8F59, 0xDE55, 0x8F5A, 0xDE56, 0x8F5B, 0xDE57, 0x8F5C, - 0xDE58, 0x8F5D, 0xDE59, 0x8F5E, 0xDE5A, 0x8F5F, 0xDE5B, 0x8F60, - 0xDE5C, 0x8F61, 0xDE5D, 0x8F62, 0xDE5E, 0x8F63, 0xDE5F, 0x8F64, - 0xDE60, 0x8F65, 0xDE61, 0x8F6A, 0xDE62, 0x8F80, 0xDE63, 0x8F8C, - 0xDE64, 0x8F92, 0xDE65, 0x8F9D, 0xDE66, 0x8FA0, 0xDE67, 0x8FA1, - 0xDE68, 0x8FA2, 0xDE69, 0x8FA4, 0xDE6A, 0x8FA5, 0xDE6B, 0x8FA6, - 0xDE6C, 0x8FA7, 0xDE6D, 0x8FAA, 0xDE6E, 0x8FAC, 0xDE6F, 0x8FAD, - 0xDE70, 0x8FAE, 0xDE71, 0x8FAF, 0xDE72, 0x8FB2, 0xDE73, 0x8FB3, - 0xDE74, 0x8FB4, 0xDE75, 0x8FB5, 0xDE76, 0x8FB7, 0xDE77, 0x8FB8, - 0xDE78, 0x8FBA, 0xDE79, 0x8FBB, 0xDE7A, 0x8FBC, 0xDE7B, 0x8FBF, - 0xDE7C, 0x8FC0, 0xDE7D, 0x8FC3, 0xDE7E, 0x8FC6, 0xDE80, 0x8FC9, - 0xDE81, 0x8FCA, 0xDE82, 0x8FCB, 0xDE83, 0x8FCC, 0xDE84, 0x8FCD, - 0xDE85, 0x8FCF, 0xDE86, 0x8FD2, 0xDE87, 0x8FD6, 0xDE88, 0x8FD7, - 0xDE89, 0x8FDA, 0xDE8A, 0x8FE0, 0xDE8B, 0x8FE1, 0xDE8C, 0x8FE3, - 0xDE8D, 0x8FE7, 0xDE8E, 0x8FEC, 0xDE8F, 0x8FEF, 0xDE90, 0x8FF1, - 0xDE91, 0x8FF2, 0xDE92, 0x8FF4, 0xDE93, 0x8FF5, 0xDE94, 0x8FF6, - 0xDE95, 0x8FFA, 0xDE96, 0x8FFB, 0xDE97, 0x8FFC, 0xDE98, 0x8FFE, - 0xDE99, 0x8FFF, 0xDE9A, 0x9007, 0xDE9B, 0x9008, 0xDE9C, 0x900C, - 0xDE9D, 0x900E, 0xDE9E, 0x9013, 0xDE9F, 0x9015, 0xDEA0, 0x9018, - 0xDEA1, 0x8556, 0xDEA2, 0x853B, 0xDEA3, 0x84FF, 0xDEA4, 0x84FC, - 0xDEA5, 0x8559, 0xDEA6, 0x8548, 0xDEA7, 0x8568, 0xDEA8, 0x8564, - 0xDEA9, 0x855E, 0xDEAA, 0x857A, 0xDEAB, 0x77A2, 0xDEAC, 0x8543, - 0xDEAD, 0x8572, 0xDEAE, 0x857B, 0xDEAF, 0x85A4, 0xDEB0, 0x85A8, - 0xDEB1, 0x8587, 0xDEB2, 0x858F, 0xDEB3, 0x8579, 0xDEB4, 0x85AE, - 0xDEB5, 0x859C, 0xDEB6, 0x8585, 0xDEB7, 0x85B9, 0xDEB8, 0x85B7, - 0xDEB9, 0x85B0, 0xDEBA, 0x85D3, 0xDEBB, 0x85C1, 0xDEBC, 0x85DC, - 0xDEBD, 0x85FF, 0xDEBE, 0x8627, 0xDEBF, 0x8605, 0xDEC0, 0x8629, - 0xDEC1, 0x8616, 0xDEC2, 0x863C, 0xDEC3, 0x5EFE, 0xDEC4, 0x5F08, - 0xDEC5, 0x593C, 0xDEC6, 0x5941, 0xDEC7, 0x8037, 0xDEC8, 0x5955, - 0xDEC9, 0x595A, 0xDECA, 0x5958, 0xDECB, 0x530F, 0xDECC, 0x5C22, - 0xDECD, 0x5C25, 0xDECE, 0x5C2C, 0xDECF, 0x5C34, 0xDED0, 0x624C, - 0xDED1, 0x626A, 0xDED2, 0x629F, 0xDED3, 0x62BB, 0xDED4, 0x62CA, - 0xDED5, 0x62DA, 0xDED6, 0x62D7, 0xDED7, 0x62EE, 0xDED8, 0x6322, - 0xDED9, 0x62F6, 0xDEDA, 0x6339, 0xDEDB, 0x634B, 0xDEDC, 0x6343, - 0xDEDD, 0x63AD, 0xDEDE, 0x63F6, 0xDEDF, 0x6371, 0xDEE0, 0x637A, - 0xDEE1, 0x638E, 0xDEE2, 0x63B4, 0xDEE3, 0x636D, 0xDEE4, 0x63AC, - 0xDEE5, 0x638A, 0xDEE6, 0x6369, 0xDEE7, 0x63AE, 0xDEE8, 0x63BC, - 0xDEE9, 0x63F2, 0xDEEA, 0x63F8, 0xDEEB, 0x63E0, 0xDEEC, 0x63FF, - 0xDEED, 0x63C4, 0xDEEE, 0x63DE, 0xDEEF, 0x63CE, 0xDEF0, 0x6452, - 0xDEF1, 0x63C6, 0xDEF2, 0x63BE, 0xDEF3, 0x6445, 0xDEF4, 0x6441, - 0xDEF5, 0x640B, 0xDEF6, 0x641B, 0xDEF7, 0x6420, 0xDEF8, 0x640C, - 0xDEF9, 0x6426, 0xDEFA, 0x6421, 0xDEFB, 0x645E, 0xDEFC, 0x6484, - 0xDEFD, 0x646D, 0xDEFE, 0x6496, 0xDF40, 0x9019, 0xDF41, 0x901C, - 0xDF42, 0x9023, 0xDF43, 0x9024, 0xDF44, 0x9025, 0xDF45, 0x9027, - 0xDF46, 0x9028, 0xDF47, 0x9029, 0xDF48, 0x902A, 0xDF49, 0x902B, - 0xDF4A, 0x902C, 0xDF4B, 0x9030, 0xDF4C, 0x9031, 0xDF4D, 0x9032, - 0xDF4E, 0x9033, 0xDF4F, 0x9034, 0xDF50, 0x9037, 0xDF51, 0x9039, - 0xDF52, 0x903A, 0xDF53, 0x903D, 0xDF54, 0x903F, 0xDF55, 0x9040, - 0xDF56, 0x9043, 0xDF57, 0x9045, 0xDF58, 0x9046, 0xDF59, 0x9048, - 0xDF5A, 0x9049, 0xDF5B, 0x904A, 0xDF5C, 0x904B, 0xDF5D, 0x904C, - 0xDF5E, 0x904E, 0xDF5F, 0x9054, 0xDF60, 0x9055, 0xDF61, 0x9056, - 0xDF62, 0x9059, 0xDF63, 0x905A, 0xDF64, 0x905C, 0xDF65, 0x905D, - 0xDF66, 0x905E, 0xDF67, 0x905F, 0xDF68, 0x9060, 0xDF69, 0x9061, - 0xDF6A, 0x9064, 0xDF6B, 0x9066, 0xDF6C, 0x9067, 0xDF6D, 0x9069, - 0xDF6E, 0x906A, 0xDF6F, 0x906B, 0xDF70, 0x906C, 0xDF71, 0x906F, - 0xDF72, 0x9070, 0xDF73, 0x9071, 0xDF74, 0x9072, 0xDF75, 0x9073, - 0xDF76, 0x9076, 0xDF77, 0x9077, 0xDF78, 0x9078, 0xDF79, 0x9079, - 0xDF7A, 0x907A, 0xDF7B, 0x907B, 0xDF7C, 0x907C, 0xDF7D, 0x907E, - 0xDF7E, 0x9081, 0xDF80, 0x9084, 0xDF81, 0x9085, 0xDF82, 0x9086, - 0xDF83, 0x9087, 0xDF84, 0x9089, 0xDF85, 0x908A, 0xDF86, 0x908C, - 0xDF87, 0x908D, 0xDF88, 0x908E, 0xDF89, 0x908F, 0xDF8A, 0x9090, - 0xDF8B, 0x9092, 0xDF8C, 0x9094, 0xDF8D, 0x9096, 0xDF8E, 0x9098, - 0xDF8F, 0x909A, 0xDF90, 0x909C, 0xDF91, 0x909E, 0xDF92, 0x909F, - 0xDF93, 0x90A0, 0xDF94, 0x90A4, 0xDF95, 0x90A5, 0xDF96, 0x90A7, - 0xDF97, 0x90A8, 0xDF98, 0x90A9, 0xDF99, 0x90AB, 0xDF9A, 0x90AD, - 0xDF9B, 0x90B2, 0xDF9C, 0x90B7, 0xDF9D, 0x90BC, 0xDF9E, 0x90BD, - 0xDF9F, 0x90BF, 0xDFA0, 0x90C0, 0xDFA1, 0x647A, 0xDFA2, 0x64B7, - 0xDFA3, 0x64B8, 0xDFA4, 0x6499, 0xDFA5, 0x64BA, 0xDFA6, 0x64C0, - 0xDFA7, 0x64D0, 0xDFA8, 0x64D7, 0xDFA9, 0x64E4, 0xDFAA, 0x64E2, - 0xDFAB, 0x6509, 0xDFAC, 0x6525, 0xDFAD, 0x652E, 0xDFAE, 0x5F0B, - 0xDFAF, 0x5FD2, 0xDFB0, 0x7519, 0xDFB1, 0x5F11, 0xDFB2, 0x535F, - 0xDFB3, 0x53F1, 0xDFB4, 0x53FD, 0xDFB5, 0x53E9, 0xDFB6, 0x53E8, - 0xDFB7, 0x53FB, 0xDFB8, 0x5412, 0xDFB9, 0x5416, 0xDFBA, 0x5406, - 0xDFBB, 0x544B, 0xDFBC, 0x5452, 0xDFBD, 0x5453, 0xDFBE, 0x5454, - 0xDFBF, 0x5456, 0xDFC0, 0x5443, 0xDFC1, 0x5421, 0xDFC2, 0x5457, - 0xDFC3, 0x5459, 0xDFC4, 0x5423, 0xDFC5, 0x5432, 0xDFC6, 0x5482, - 0xDFC7, 0x5494, 0xDFC8, 0x5477, 0xDFC9, 0x5471, 0xDFCA, 0x5464, - 0xDFCB, 0x549A, 0xDFCC, 0x549B, 0xDFCD, 0x5484, 0xDFCE, 0x5476, - 0xDFCF, 0x5466, 0xDFD0, 0x549D, 0xDFD1, 0x54D0, 0xDFD2, 0x54AD, - 0xDFD3, 0x54C2, 0xDFD4, 0x54B4, 0xDFD5, 0x54D2, 0xDFD6, 0x54A7, - 0xDFD7, 0x54A6, 0xDFD8, 0x54D3, 0xDFD9, 0x54D4, 0xDFDA, 0x5472, - 0xDFDB, 0x54A3, 0xDFDC, 0x54D5, 0xDFDD, 0x54BB, 0xDFDE, 0x54BF, - 0xDFDF, 0x54CC, 0xDFE0, 0x54D9, 0xDFE1, 0x54DA, 0xDFE2, 0x54DC, - 0xDFE3, 0x54A9, 0xDFE4, 0x54AA, 0xDFE5, 0x54A4, 0xDFE6, 0x54DD, - 0xDFE7, 0x54CF, 0xDFE8, 0x54DE, 0xDFE9, 0x551B, 0xDFEA, 0x54E7, - 0xDFEB, 0x5520, 0xDFEC, 0x54FD, 0xDFED, 0x5514, 0xDFEE, 0x54F3, - 0xDFEF, 0x5522, 0xDFF0, 0x5523, 0xDFF1, 0x550F, 0xDFF2, 0x5511, - 0xDFF3, 0x5527, 0xDFF4, 0x552A, 0xDFF5, 0x5567, 0xDFF6, 0x558F, - 0xDFF7, 0x55B5, 0xDFF8, 0x5549, 0xDFF9, 0x556D, 0xDFFA, 0x5541, - 0xDFFB, 0x5555, 0xDFFC, 0x553F, 0xDFFD, 0x5550, 0xDFFE, 0x553C, - 0xE040, 0x90C2, 0xE041, 0x90C3, 0xE042, 0x90C6, 0xE043, 0x90C8, - 0xE044, 0x90C9, 0xE045, 0x90CB, 0xE046, 0x90CC, 0xE047, 0x90CD, - 0xE048, 0x90D2, 0xE049, 0x90D4, 0xE04A, 0x90D5, 0xE04B, 0x90D6, - 0xE04C, 0x90D8, 0xE04D, 0x90D9, 0xE04E, 0x90DA, 0xE04F, 0x90DE, - 0xE050, 0x90DF, 0xE051, 0x90E0, 0xE052, 0x90E3, 0xE053, 0x90E4, - 0xE054, 0x90E5, 0xE055, 0x90E9, 0xE056, 0x90EA, 0xE057, 0x90EC, - 0xE058, 0x90EE, 0xE059, 0x90F0, 0xE05A, 0x90F1, 0xE05B, 0x90F2, - 0xE05C, 0x90F3, 0xE05D, 0x90F5, 0xE05E, 0x90F6, 0xE05F, 0x90F7, - 0xE060, 0x90F9, 0xE061, 0x90FA, 0xE062, 0x90FB, 0xE063, 0x90FC, - 0xE064, 0x90FF, 0xE065, 0x9100, 0xE066, 0x9101, 0xE067, 0x9103, - 0xE068, 0x9105, 0xE069, 0x9106, 0xE06A, 0x9107, 0xE06B, 0x9108, - 0xE06C, 0x9109, 0xE06D, 0x910A, 0xE06E, 0x910B, 0xE06F, 0x910C, - 0xE070, 0x910D, 0xE071, 0x910E, 0xE072, 0x910F, 0xE073, 0x9110, - 0xE074, 0x9111, 0xE075, 0x9112, 0xE076, 0x9113, 0xE077, 0x9114, - 0xE078, 0x9115, 0xE079, 0x9116, 0xE07A, 0x9117, 0xE07B, 0x9118, - 0xE07C, 0x911A, 0xE07D, 0x911B, 0xE07E, 0x911C, 0xE080, 0x911D, - 0xE081, 0x911F, 0xE082, 0x9120, 0xE083, 0x9121, 0xE084, 0x9124, - 0xE085, 0x9125, 0xE086, 0x9126, 0xE087, 0x9127, 0xE088, 0x9128, - 0xE089, 0x9129, 0xE08A, 0x912A, 0xE08B, 0x912B, 0xE08C, 0x912C, - 0xE08D, 0x912D, 0xE08E, 0x912E, 0xE08F, 0x9130, 0xE090, 0x9132, - 0xE091, 0x9133, 0xE092, 0x9134, 0xE093, 0x9135, 0xE094, 0x9136, - 0xE095, 0x9137, 0xE096, 0x9138, 0xE097, 0x913A, 0xE098, 0x913B, - 0xE099, 0x913C, 0xE09A, 0x913D, 0xE09B, 0x913E, 0xE09C, 0x913F, - 0xE09D, 0x9140, 0xE09E, 0x9141, 0xE09F, 0x9142, 0xE0A0, 0x9144, - 0xE0A1, 0x5537, 0xE0A2, 0x5556, 0xE0A3, 0x5575, 0xE0A4, 0x5576, - 0xE0A5, 0x5577, 0xE0A6, 0x5533, 0xE0A7, 0x5530, 0xE0A8, 0x555C, - 0xE0A9, 0x558B, 0xE0AA, 0x55D2, 0xE0AB, 0x5583, 0xE0AC, 0x55B1, - 0xE0AD, 0x55B9, 0xE0AE, 0x5588, 0xE0AF, 0x5581, 0xE0B0, 0x559F, - 0xE0B1, 0x557E, 0xE0B2, 0x55D6, 0xE0B3, 0x5591, 0xE0B4, 0x557B, - 0xE0B5, 0x55DF, 0xE0B6, 0x55BD, 0xE0B7, 0x55BE, 0xE0B8, 0x5594, - 0xE0B9, 0x5599, 0xE0BA, 0x55EA, 0xE0BB, 0x55F7, 0xE0BC, 0x55C9, - 0xE0BD, 0x561F, 0xE0BE, 0x55D1, 0xE0BF, 0x55EB, 0xE0C0, 0x55EC, - 0xE0C1, 0x55D4, 0xE0C2, 0x55E6, 0xE0C3, 0x55DD, 0xE0C4, 0x55C4, - 0xE0C5, 0x55EF, 0xE0C6, 0x55E5, 0xE0C7, 0x55F2, 0xE0C8, 0x55F3, - 0xE0C9, 0x55CC, 0xE0CA, 0x55CD, 0xE0CB, 0x55E8, 0xE0CC, 0x55F5, - 0xE0CD, 0x55E4, 0xE0CE, 0x8F94, 0xE0CF, 0x561E, 0xE0D0, 0x5608, - 0xE0D1, 0x560C, 0xE0D2, 0x5601, 0xE0D3, 0x5624, 0xE0D4, 0x5623, - 0xE0D5, 0x55FE, 0xE0D6, 0x5600, 0xE0D7, 0x5627, 0xE0D8, 0x562D, - 0xE0D9, 0x5658, 0xE0DA, 0x5639, 0xE0DB, 0x5657, 0xE0DC, 0x562C, - 0xE0DD, 0x564D, 0xE0DE, 0x5662, 0xE0DF, 0x5659, 0xE0E0, 0x565C, - 0xE0E1, 0x564C, 0xE0E2, 0x5654, 0xE0E3, 0x5686, 0xE0E4, 0x5664, - 0xE0E5, 0x5671, 0xE0E6, 0x566B, 0xE0E7, 0x567B, 0xE0E8, 0x567C, - 0xE0E9, 0x5685, 0xE0EA, 0x5693, 0xE0EB, 0x56AF, 0xE0EC, 0x56D4, - 0xE0ED, 0x56D7, 0xE0EE, 0x56DD, 0xE0EF, 0x56E1, 0xE0F0, 0x56F5, - 0xE0F1, 0x56EB, 0xE0F2, 0x56F9, 0xE0F3, 0x56FF, 0xE0F4, 0x5704, - 0xE0F5, 0x570A, 0xE0F6, 0x5709, 0xE0F7, 0x571C, 0xE0F8, 0x5E0F, - 0xE0F9, 0x5E19, 0xE0FA, 0x5E14, 0xE0FB, 0x5E11, 0xE0FC, 0x5E31, - 0xE0FD, 0x5E3B, 0xE0FE, 0x5E3C, 0xE140, 0x9145, 0xE141, 0x9147, - 0xE142, 0x9148, 0xE143, 0x9151, 0xE144, 0x9153, 0xE145, 0x9154, - 0xE146, 0x9155, 0xE147, 0x9156, 0xE148, 0x9158, 0xE149, 0x9159, - 0xE14A, 0x915B, 0xE14B, 0x915C, 0xE14C, 0x915F, 0xE14D, 0x9160, - 0xE14E, 0x9166, 0xE14F, 0x9167, 0xE150, 0x9168, 0xE151, 0x916B, - 0xE152, 0x916D, 0xE153, 0x9173, 0xE154, 0x917A, 0xE155, 0x917B, - 0xE156, 0x917C, 0xE157, 0x9180, 0xE158, 0x9181, 0xE159, 0x9182, - 0xE15A, 0x9183, 0xE15B, 0x9184, 0xE15C, 0x9186, 0xE15D, 0x9188, - 0xE15E, 0x918A, 0xE15F, 0x918E, 0xE160, 0x918F, 0xE161, 0x9193, - 0xE162, 0x9194, 0xE163, 0x9195, 0xE164, 0x9196, 0xE165, 0x9197, - 0xE166, 0x9198, 0xE167, 0x9199, 0xE168, 0x919C, 0xE169, 0x919D, - 0xE16A, 0x919E, 0xE16B, 0x919F, 0xE16C, 0x91A0, 0xE16D, 0x91A1, - 0xE16E, 0x91A4, 0xE16F, 0x91A5, 0xE170, 0x91A6, 0xE171, 0x91A7, - 0xE172, 0x91A8, 0xE173, 0x91A9, 0xE174, 0x91AB, 0xE175, 0x91AC, - 0xE176, 0x91B0, 0xE177, 0x91B1, 0xE178, 0x91B2, 0xE179, 0x91B3, - 0xE17A, 0x91B6, 0xE17B, 0x91B7, 0xE17C, 0x91B8, 0xE17D, 0x91B9, - 0xE17E, 0x91BB, 0xE180, 0x91BC, 0xE181, 0x91BD, 0xE182, 0x91BE, - 0xE183, 0x91BF, 0xE184, 0x91C0, 0xE185, 0x91C1, 0xE186, 0x91C2, - 0xE187, 0x91C3, 0xE188, 0x91C4, 0xE189, 0x91C5, 0xE18A, 0x91C6, - 0xE18B, 0x91C8, 0xE18C, 0x91CB, 0xE18D, 0x91D0, 0xE18E, 0x91D2, - 0xE18F, 0x91D3, 0xE190, 0x91D4, 0xE191, 0x91D5, 0xE192, 0x91D6, - 0xE193, 0x91D7, 0xE194, 0x91D8, 0xE195, 0x91D9, 0xE196, 0x91DA, - 0xE197, 0x91DB, 0xE198, 0x91DD, 0xE199, 0x91DE, 0xE19A, 0x91DF, - 0xE19B, 0x91E0, 0xE19C, 0x91E1, 0xE19D, 0x91E2, 0xE19E, 0x91E3, - 0xE19F, 0x91E4, 0xE1A0, 0x91E5, 0xE1A1, 0x5E37, 0xE1A2, 0x5E44, - 0xE1A3, 0x5E54, 0xE1A4, 0x5E5B, 0xE1A5, 0x5E5E, 0xE1A6, 0x5E61, - 0xE1A7, 0x5C8C, 0xE1A8, 0x5C7A, 0xE1A9, 0x5C8D, 0xE1AA, 0x5C90, - 0xE1AB, 0x5C96, 0xE1AC, 0x5C88, 0xE1AD, 0x5C98, 0xE1AE, 0x5C99, - 0xE1AF, 0x5C91, 0xE1B0, 0x5C9A, 0xE1B1, 0x5C9C, 0xE1B2, 0x5CB5, - 0xE1B3, 0x5CA2, 0xE1B4, 0x5CBD, 0xE1B5, 0x5CAC, 0xE1B6, 0x5CAB, - 0xE1B7, 0x5CB1, 0xE1B8, 0x5CA3, 0xE1B9, 0x5CC1, 0xE1BA, 0x5CB7, - 0xE1BB, 0x5CC4, 0xE1BC, 0x5CD2, 0xE1BD, 0x5CE4, 0xE1BE, 0x5CCB, - 0xE1BF, 0x5CE5, 0xE1C0, 0x5D02, 0xE1C1, 0x5D03, 0xE1C2, 0x5D27, - 0xE1C3, 0x5D26, 0xE1C4, 0x5D2E, 0xE1C5, 0x5D24, 0xE1C6, 0x5D1E, - 0xE1C7, 0x5D06, 0xE1C8, 0x5D1B, 0xE1C9, 0x5D58, 0xE1CA, 0x5D3E, - 0xE1CB, 0x5D34, 0xE1CC, 0x5D3D, 0xE1CD, 0x5D6C, 0xE1CE, 0x5D5B, - 0xE1CF, 0x5D6F, 0xE1D0, 0x5D5D, 0xE1D1, 0x5D6B, 0xE1D2, 0x5D4B, - 0xE1D3, 0x5D4A, 0xE1D4, 0x5D69, 0xE1D5, 0x5D74, 0xE1D6, 0x5D82, - 0xE1D7, 0x5D99, 0xE1D8, 0x5D9D, 0xE1D9, 0x8C73, 0xE1DA, 0x5DB7, - 0xE1DB, 0x5DC5, 0xE1DC, 0x5F73, 0xE1DD, 0x5F77, 0xE1DE, 0x5F82, - 0xE1DF, 0x5F87, 0xE1E0, 0x5F89, 0xE1E1, 0x5F8C, 0xE1E2, 0x5F95, - 0xE1E3, 0x5F99, 0xE1E4, 0x5F9C, 0xE1E5, 0x5FA8, 0xE1E6, 0x5FAD, - 0xE1E7, 0x5FB5, 0xE1E8, 0x5FBC, 0xE1E9, 0x8862, 0xE1EA, 0x5F61, - 0xE1EB, 0x72AD, 0xE1EC, 0x72B0, 0xE1ED, 0x72B4, 0xE1EE, 0x72B7, - 0xE1EF, 0x72B8, 0xE1F0, 0x72C3, 0xE1F1, 0x72C1, 0xE1F2, 0x72CE, - 0xE1F3, 0x72CD, 0xE1F4, 0x72D2, 0xE1F5, 0x72E8, 0xE1F6, 0x72EF, - 0xE1F7, 0x72E9, 0xE1F8, 0x72F2, 0xE1F9, 0x72F4, 0xE1FA, 0x72F7, - 0xE1FB, 0x7301, 0xE1FC, 0x72F3, 0xE1FD, 0x7303, 0xE1FE, 0x72FA, - 0xE240, 0x91E6, 0xE241, 0x91E7, 0xE242, 0x91E8, 0xE243, 0x91E9, - 0xE244, 0x91EA, 0xE245, 0x91EB, 0xE246, 0x91EC, 0xE247, 0x91ED, - 0xE248, 0x91EE, 0xE249, 0x91EF, 0xE24A, 0x91F0, 0xE24B, 0x91F1, - 0xE24C, 0x91F2, 0xE24D, 0x91F3, 0xE24E, 0x91F4, 0xE24F, 0x91F5, - 0xE250, 0x91F6, 0xE251, 0x91F7, 0xE252, 0x91F8, 0xE253, 0x91F9, - 0xE254, 0x91FA, 0xE255, 0x91FB, 0xE256, 0x91FC, 0xE257, 0x91FD, - 0xE258, 0x91FE, 0xE259, 0x91FF, 0xE25A, 0x9200, 0xE25B, 0x9201, - 0xE25C, 0x9202, 0xE25D, 0x9203, 0xE25E, 0x9204, 0xE25F, 0x9205, - 0xE260, 0x9206, 0xE261, 0x9207, 0xE262, 0x9208, 0xE263, 0x9209, - 0xE264, 0x920A, 0xE265, 0x920B, 0xE266, 0x920C, 0xE267, 0x920D, - 0xE268, 0x920E, 0xE269, 0x920F, 0xE26A, 0x9210, 0xE26B, 0x9211, - 0xE26C, 0x9212, 0xE26D, 0x9213, 0xE26E, 0x9214, 0xE26F, 0x9215, - 0xE270, 0x9216, 0xE271, 0x9217, 0xE272, 0x9218, 0xE273, 0x9219, - 0xE274, 0x921A, 0xE275, 0x921B, 0xE276, 0x921C, 0xE277, 0x921D, - 0xE278, 0x921E, 0xE279, 0x921F, 0xE27A, 0x9220, 0xE27B, 0x9221, - 0xE27C, 0x9222, 0xE27D, 0x9223, 0xE27E, 0x9224, 0xE280, 0x9225, - 0xE281, 0x9226, 0xE282, 0x9227, 0xE283, 0x9228, 0xE284, 0x9229, - 0xE285, 0x922A, 0xE286, 0x922B, 0xE287, 0x922C, 0xE288, 0x922D, - 0xE289, 0x922E, 0xE28A, 0x922F, 0xE28B, 0x9230, 0xE28C, 0x9231, - 0xE28D, 0x9232, 0xE28E, 0x9233, 0xE28F, 0x9234, 0xE290, 0x9235, - 0xE291, 0x9236, 0xE292, 0x9237, 0xE293, 0x9238, 0xE294, 0x9239, - 0xE295, 0x923A, 0xE296, 0x923B, 0xE297, 0x923C, 0xE298, 0x923D, - 0xE299, 0x923E, 0xE29A, 0x923F, 0xE29B, 0x9240, 0xE29C, 0x9241, - 0xE29D, 0x9242, 0xE29E, 0x9243, 0xE29F, 0x9244, 0xE2A0, 0x9245, - 0xE2A1, 0x72FB, 0xE2A2, 0x7317, 0xE2A3, 0x7313, 0xE2A4, 0x7321, - 0xE2A5, 0x730A, 0xE2A6, 0x731E, 0xE2A7, 0x731D, 0xE2A8, 0x7315, - 0xE2A9, 0x7322, 0xE2AA, 0x7339, 0xE2AB, 0x7325, 0xE2AC, 0x732C, - 0xE2AD, 0x7338, 0xE2AE, 0x7331, 0xE2AF, 0x7350, 0xE2B0, 0x734D, - 0xE2B1, 0x7357, 0xE2B2, 0x7360, 0xE2B3, 0x736C, 0xE2B4, 0x736F, - 0xE2B5, 0x737E, 0xE2B6, 0x821B, 0xE2B7, 0x5925, 0xE2B8, 0x98E7, - 0xE2B9, 0x5924, 0xE2BA, 0x5902, 0xE2BB, 0x9963, 0xE2BC, 0x9967, - 0xE2BD, 0x9968, 0xE2BE, 0x9969, 0xE2BF, 0x996A, 0xE2C0, 0x996B, - 0xE2C1, 0x996C, 0xE2C2, 0x9974, 0xE2C3, 0x9977, 0xE2C4, 0x997D, - 0xE2C5, 0x9980, 0xE2C6, 0x9984, 0xE2C7, 0x9987, 0xE2C8, 0x998A, - 0xE2C9, 0x998D, 0xE2CA, 0x9990, 0xE2CB, 0x9991, 0xE2CC, 0x9993, - 0xE2CD, 0x9994, 0xE2CE, 0x9995, 0xE2CF, 0x5E80, 0xE2D0, 0x5E91, - 0xE2D1, 0x5E8B, 0xE2D2, 0x5E96, 0xE2D3, 0x5EA5, 0xE2D4, 0x5EA0, - 0xE2D5, 0x5EB9, 0xE2D6, 0x5EB5, 0xE2D7, 0x5EBE, 0xE2D8, 0x5EB3, - 0xE2D9, 0x8D53, 0xE2DA, 0x5ED2, 0xE2DB, 0x5ED1, 0xE2DC, 0x5EDB, - 0xE2DD, 0x5EE8, 0xE2DE, 0x5EEA, 0xE2DF, 0x81BA, 0xE2E0, 0x5FC4, - 0xE2E1, 0x5FC9, 0xE2E2, 0x5FD6, 0xE2E3, 0x5FCF, 0xE2E4, 0x6003, - 0xE2E5, 0x5FEE, 0xE2E6, 0x6004, 0xE2E7, 0x5FE1, 0xE2E8, 0x5FE4, - 0xE2E9, 0x5FFE, 0xE2EA, 0x6005, 0xE2EB, 0x6006, 0xE2EC, 0x5FEA, - 0xE2ED, 0x5FED, 0xE2EE, 0x5FF8, 0xE2EF, 0x6019, 0xE2F0, 0x6035, - 0xE2F1, 0x6026, 0xE2F2, 0x601B, 0xE2F3, 0x600F, 0xE2F4, 0x600D, - 0xE2F5, 0x6029, 0xE2F6, 0x602B, 0xE2F7, 0x600A, 0xE2F8, 0x603F, - 0xE2F9, 0x6021, 0xE2FA, 0x6078, 0xE2FB, 0x6079, 0xE2FC, 0x607B, - 0xE2FD, 0x607A, 0xE2FE, 0x6042, 0xE340, 0x9246, 0xE341, 0x9247, - 0xE342, 0x9248, 0xE343, 0x9249, 0xE344, 0x924A, 0xE345, 0x924B, - 0xE346, 0x924C, 0xE347, 0x924D, 0xE348, 0x924E, 0xE349, 0x924F, - 0xE34A, 0x9250, 0xE34B, 0x9251, 0xE34C, 0x9252, 0xE34D, 0x9253, - 0xE34E, 0x9254, 0xE34F, 0x9255, 0xE350, 0x9256, 0xE351, 0x9257, - 0xE352, 0x9258, 0xE353, 0x9259, 0xE354, 0x925A, 0xE355, 0x925B, - 0xE356, 0x925C, 0xE357, 0x925D, 0xE358, 0x925E, 0xE359, 0x925F, - 0xE35A, 0x9260, 0xE35B, 0x9261, 0xE35C, 0x9262, 0xE35D, 0x9263, - 0xE35E, 0x9264, 0xE35F, 0x9265, 0xE360, 0x9266, 0xE361, 0x9267, - 0xE362, 0x9268, 0xE363, 0x9269, 0xE364, 0x926A, 0xE365, 0x926B, - 0xE366, 0x926C, 0xE367, 0x926D, 0xE368, 0x926E, 0xE369, 0x926F, - 0xE36A, 0x9270, 0xE36B, 0x9271, 0xE36C, 0x9272, 0xE36D, 0x9273, - 0xE36E, 0x9275, 0xE36F, 0x9276, 0xE370, 0x9277, 0xE371, 0x9278, - 0xE372, 0x9279, 0xE373, 0x927A, 0xE374, 0x927B, 0xE375, 0x927C, - 0xE376, 0x927D, 0xE377, 0x927E, 0xE378, 0x927F, 0xE379, 0x9280, - 0xE37A, 0x9281, 0xE37B, 0x9282, 0xE37C, 0x9283, 0xE37D, 0x9284, - 0xE37E, 0x9285, 0xE380, 0x9286, 0xE381, 0x9287, 0xE382, 0x9288, - 0xE383, 0x9289, 0xE384, 0x928A, 0xE385, 0x928B, 0xE386, 0x928C, - 0xE387, 0x928D, 0xE388, 0x928F, 0xE389, 0x9290, 0xE38A, 0x9291, - 0xE38B, 0x9292, 0xE38C, 0x9293, 0xE38D, 0x9294, 0xE38E, 0x9295, - 0xE38F, 0x9296, 0xE390, 0x9297, 0xE391, 0x9298, 0xE392, 0x9299, - 0xE393, 0x929A, 0xE394, 0x929B, 0xE395, 0x929C, 0xE396, 0x929D, - 0xE397, 0x929E, 0xE398, 0x929F, 0xE399, 0x92A0, 0xE39A, 0x92A1, - 0xE39B, 0x92A2, 0xE39C, 0x92A3, 0xE39D, 0x92A4, 0xE39E, 0x92A5, - 0xE39F, 0x92A6, 0xE3A0, 0x92A7, 0xE3A1, 0x606A, 0xE3A2, 0x607D, - 0xE3A3, 0x6096, 0xE3A4, 0x609A, 0xE3A5, 0x60AD, 0xE3A6, 0x609D, - 0xE3A7, 0x6083, 0xE3A8, 0x6092, 0xE3A9, 0x608C, 0xE3AA, 0x609B, - 0xE3AB, 0x60EC, 0xE3AC, 0x60BB, 0xE3AD, 0x60B1, 0xE3AE, 0x60DD, - 0xE3AF, 0x60D8, 0xE3B0, 0x60C6, 0xE3B1, 0x60DA, 0xE3B2, 0x60B4, - 0xE3B3, 0x6120, 0xE3B4, 0x6126, 0xE3B5, 0x6115, 0xE3B6, 0x6123, - 0xE3B7, 0x60F4, 0xE3B8, 0x6100, 0xE3B9, 0x610E, 0xE3BA, 0x612B, - 0xE3BB, 0x614A, 0xE3BC, 0x6175, 0xE3BD, 0x61AC, 0xE3BE, 0x6194, - 0xE3BF, 0x61A7, 0xE3C0, 0x61B7, 0xE3C1, 0x61D4, 0xE3C2, 0x61F5, - 0xE3C3, 0x5FDD, 0xE3C4, 0x96B3, 0xE3C5, 0x95E9, 0xE3C6, 0x95EB, - 0xE3C7, 0x95F1, 0xE3C8, 0x95F3, 0xE3C9, 0x95F5, 0xE3CA, 0x95F6, - 0xE3CB, 0x95FC, 0xE3CC, 0x95FE, 0xE3CD, 0x9603, 0xE3CE, 0x9604, - 0xE3CF, 0x9606, 0xE3D0, 0x9608, 0xE3D1, 0x960A, 0xE3D2, 0x960B, - 0xE3D3, 0x960C, 0xE3D4, 0x960D, 0xE3D5, 0x960F, 0xE3D6, 0x9612, - 0xE3D7, 0x9615, 0xE3D8, 0x9616, 0xE3D9, 0x9617, 0xE3DA, 0x9619, - 0xE3DB, 0x961A, 0xE3DC, 0x4E2C, 0xE3DD, 0x723F, 0xE3DE, 0x6215, - 0xE3DF, 0x6C35, 0xE3E0, 0x6C54, 0xE3E1, 0x6C5C, 0xE3E2, 0x6C4A, - 0xE3E3, 0x6CA3, 0xE3E4, 0x6C85, 0xE3E5, 0x6C90, 0xE3E6, 0x6C94, - 0xE3E7, 0x6C8C, 0xE3E8, 0x6C68, 0xE3E9, 0x6C69, 0xE3EA, 0x6C74, - 0xE3EB, 0x6C76, 0xE3EC, 0x6C86, 0xE3ED, 0x6CA9, 0xE3EE, 0x6CD0, - 0xE3EF, 0x6CD4, 0xE3F0, 0x6CAD, 0xE3F1, 0x6CF7, 0xE3F2, 0x6CF8, - 0xE3F3, 0x6CF1, 0xE3F4, 0x6CD7, 0xE3F5, 0x6CB2, 0xE3F6, 0x6CE0, - 0xE3F7, 0x6CD6, 0xE3F8, 0x6CFA, 0xE3F9, 0x6CEB, 0xE3FA, 0x6CEE, - 0xE3FB, 0x6CB1, 0xE3FC, 0x6CD3, 0xE3FD, 0x6CEF, 0xE3FE, 0x6CFE, - 0xE440, 0x92A8, 0xE441, 0x92A9, 0xE442, 0x92AA, 0xE443, 0x92AB, - 0xE444, 0x92AC, 0xE445, 0x92AD, 0xE446, 0x92AF, 0xE447, 0x92B0, - 0xE448, 0x92B1, 0xE449, 0x92B2, 0xE44A, 0x92B3, 0xE44B, 0x92B4, - 0xE44C, 0x92B5, 0xE44D, 0x92B6, 0xE44E, 0x92B7, 0xE44F, 0x92B8, - 0xE450, 0x92B9, 0xE451, 0x92BA, 0xE452, 0x92BB, 0xE453, 0x92BC, - 0xE454, 0x92BD, 0xE455, 0x92BE, 0xE456, 0x92BF, 0xE457, 0x92C0, - 0xE458, 0x92C1, 0xE459, 0x92C2, 0xE45A, 0x92C3, 0xE45B, 0x92C4, - 0xE45C, 0x92C5, 0xE45D, 0x92C6, 0xE45E, 0x92C7, 0xE45F, 0x92C9, - 0xE460, 0x92CA, 0xE461, 0x92CB, 0xE462, 0x92CC, 0xE463, 0x92CD, - 0xE464, 0x92CE, 0xE465, 0x92CF, 0xE466, 0x92D0, 0xE467, 0x92D1, - 0xE468, 0x92D2, 0xE469, 0x92D3, 0xE46A, 0x92D4, 0xE46B, 0x92D5, - 0xE46C, 0x92D6, 0xE46D, 0x92D7, 0xE46E, 0x92D8, 0xE46F, 0x92D9, - 0xE470, 0x92DA, 0xE471, 0x92DB, 0xE472, 0x92DC, 0xE473, 0x92DD, - 0xE474, 0x92DE, 0xE475, 0x92DF, 0xE476, 0x92E0, 0xE477, 0x92E1, - 0xE478, 0x92E2, 0xE479, 0x92E3, 0xE47A, 0x92E4, 0xE47B, 0x92E5, - 0xE47C, 0x92E6, 0xE47D, 0x92E7, 0xE47E, 0x92E8, 0xE480, 0x92E9, - 0xE481, 0x92EA, 0xE482, 0x92EB, 0xE483, 0x92EC, 0xE484, 0x92ED, - 0xE485, 0x92EE, 0xE486, 0x92EF, 0xE487, 0x92F0, 0xE488, 0x92F1, - 0xE489, 0x92F2, 0xE48A, 0x92F3, 0xE48B, 0x92F4, 0xE48C, 0x92F5, - 0xE48D, 0x92F6, 0xE48E, 0x92F7, 0xE48F, 0x92F8, 0xE490, 0x92F9, - 0xE491, 0x92FA, 0xE492, 0x92FB, 0xE493, 0x92FC, 0xE494, 0x92FD, - 0xE495, 0x92FE, 0xE496, 0x92FF, 0xE497, 0x9300, 0xE498, 0x9301, - 0xE499, 0x9302, 0xE49A, 0x9303, 0xE49B, 0x9304, 0xE49C, 0x9305, - 0xE49D, 0x9306, 0xE49E, 0x9307, 0xE49F, 0x9308, 0xE4A0, 0x9309, - 0xE4A1, 0x6D39, 0xE4A2, 0x6D27, 0xE4A3, 0x6D0C, 0xE4A4, 0x6D43, - 0xE4A5, 0x6D48, 0xE4A6, 0x6D07, 0xE4A7, 0x6D04, 0xE4A8, 0x6D19, - 0xE4A9, 0x6D0E, 0xE4AA, 0x6D2B, 0xE4AB, 0x6D4D, 0xE4AC, 0x6D2E, - 0xE4AD, 0x6D35, 0xE4AE, 0x6D1A, 0xE4AF, 0x6D4F, 0xE4B0, 0x6D52, - 0xE4B1, 0x6D54, 0xE4B2, 0x6D33, 0xE4B3, 0x6D91, 0xE4B4, 0x6D6F, - 0xE4B5, 0x6D9E, 0xE4B6, 0x6DA0, 0xE4B7, 0x6D5E, 0xE4B8, 0x6D93, - 0xE4B9, 0x6D94, 0xE4BA, 0x6D5C, 0xE4BB, 0x6D60, 0xE4BC, 0x6D7C, - 0xE4BD, 0x6D63, 0xE4BE, 0x6E1A, 0xE4BF, 0x6DC7, 0xE4C0, 0x6DC5, - 0xE4C1, 0x6DDE, 0xE4C2, 0x6E0E, 0xE4C3, 0x6DBF, 0xE4C4, 0x6DE0, - 0xE4C5, 0x6E11, 0xE4C6, 0x6DE6, 0xE4C7, 0x6DDD, 0xE4C8, 0x6DD9, - 0xE4C9, 0x6E16, 0xE4CA, 0x6DAB, 0xE4CB, 0x6E0C, 0xE4CC, 0x6DAE, - 0xE4CD, 0x6E2B, 0xE4CE, 0x6E6E, 0xE4CF, 0x6E4E, 0xE4D0, 0x6E6B, - 0xE4D1, 0x6EB2, 0xE4D2, 0x6E5F, 0xE4D3, 0x6E86, 0xE4D4, 0x6E53, - 0xE4D5, 0x6E54, 0xE4D6, 0x6E32, 0xE4D7, 0x6E25, 0xE4D8, 0x6E44, - 0xE4D9, 0x6EDF, 0xE4DA, 0x6EB1, 0xE4DB, 0x6E98, 0xE4DC, 0x6EE0, - 0xE4DD, 0x6F2D, 0xE4DE, 0x6EE2, 0xE4DF, 0x6EA5, 0xE4E0, 0x6EA7, - 0xE4E1, 0x6EBD, 0xE4E2, 0x6EBB, 0xE4E3, 0x6EB7, 0xE4E4, 0x6ED7, - 0xE4E5, 0x6EB4, 0xE4E6, 0x6ECF, 0xE4E7, 0x6E8F, 0xE4E8, 0x6EC2, - 0xE4E9, 0x6E9F, 0xE4EA, 0x6F62, 0xE4EB, 0x6F46, 0xE4EC, 0x6F47, - 0xE4ED, 0x6F24, 0xE4EE, 0x6F15, 0xE4EF, 0x6EF9, 0xE4F0, 0x6F2F, - 0xE4F1, 0x6F36, 0xE4F2, 0x6F4B, 0xE4F3, 0x6F74, 0xE4F4, 0x6F2A, - 0xE4F5, 0x6F09, 0xE4F6, 0x6F29, 0xE4F7, 0x6F89, 0xE4F8, 0x6F8D, - 0xE4F9, 0x6F8C, 0xE4FA, 0x6F78, 0xE4FB, 0x6F72, 0xE4FC, 0x6F7C, - 0xE4FD, 0x6F7A, 0xE4FE, 0x6FD1, 0xE540, 0x930A, 0xE541, 0x930B, - 0xE542, 0x930C, 0xE543, 0x930D, 0xE544, 0x930E, 0xE545, 0x930F, - 0xE546, 0x9310, 0xE547, 0x9311, 0xE548, 0x9312, 0xE549, 0x9313, - 0xE54A, 0x9314, 0xE54B, 0x9315, 0xE54C, 0x9316, 0xE54D, 0x9317, - 0xE54E, 0x9318, 0xE54F, 0x9319, 0xE550, 0x931A, 0xE551, 0x931B, - 0xE552, 0x931C, 0xE553, 0x931D, 0xE554, 0x931E, 0xE555, 0x931F, - 0xE556, 0x9320, 0xE557, 0x9321, 0xE558, 0x9322, 0xE559, 0x9323, - 0xE55A, 0x9324, 0xE55B, 0x9325, 0xE55C, 0x9326, 0xE55D, 0x9327, - 0xE55E, 0x9328, 0xE55F, 0x9329, 0xE560, 0x932A, 0xE561, 0x932B, - 0xE562, 0x932C, 0xE563, 0x932D, 0xE564, 0x932E, 0xE565, 0x932F, - 0xE566, 0x9330, 0xE567, 0x9331, 0xE568, 0x9332, 0xE569, 0x9333, - 0xE56A, 0x9334, 0xE56B, 0x9335, 0xE56C, 0x9336, 0xE56D, 0x9337, - 0xE56E, 0x9338, 0xE56F, 0x9339, 0xE570, 0x933A, 0xE571, 0x933B, - 0xE572, 0x933C, 0xE573, 0x933D, 0xE574, 0x933F, 0xE575, 0x9340, - 0xE576, 0x9341, 0xE577, 0x9342, 0xE578, 0x9343, 0xE579, 0x9344, - 0xE57A, 0x9345, 0xE57B, 0x9346, 0xE57C, 0x9347, 0xE57D, 0x9348, - 0xE57E, 0x9349, 0xE580, 0x934A, 0xE581, 0x934B, 0xE582, 0x934C, - 0xE583, 0x934D, 0xE584, 0x934E, 0xE585, 0x934F, 0xE586, 0x9350, - 0xE587, 0x9351, 0xE588, 0x9352, 0xE589, 0x9353, 0xE58A, 0x9354, - 0xE58B, 0x9355, 0xE58C, 0x9356, 0xE58D, 0x9357, 0xE58E, 0x9358, - 0xE58F, 0x9359, 0xE590, 0x935A, 0xE591, 0x935B, 0xE592, 0x935C, - 0xE593, 0x935D, 0xE594, 0x935E, 0xE595, 0x935F, 0xE596, 0x9360, - 0xE597, 0x9361, 0xE598, 0x9362, 0xE599, 0x9363, 0xE59A, 0x9364, - 0xE59B, 0x9365, 0xE59C, 0x9366, 0xE59D, 0x9367, 0xE59E, 0x9368, - 0xE59F, 0x9369, 0xE5A0, 0x936B, 0xE5A1, 0x6FC9, 0xE5A2, 0x6FA7, - 0xE5A3, 0x6FB9, 0xE5A4, 0x6FB6, 0xE5A5, 0x6FC2, 0xE5A6, 0x6FE1, - 0xE5A7, 0x6FEE, 0xE5A8, 0x6FDE, 0xE5A9, 0x6FE0, 0xE5AA, 0x6FEF, - 0xE5AB, 0x701A, 0xE5AC, 0x7023, 0xE5AD, 0x701B, 0xE5AE, 0x7039, - 0xE5AF, 0x7035, 0xE5B0, 0x704F, 0xE5B1, 0x705E, 0xE5B2, 0x5B80, - 0xE5B3, 0x5B84, 0xE5B4, 0x5B95, 0xE5B5, 0x5B93, 0xE5B6, 0x5BA5, - 0xE5B7, 0x5BB8, 0xE5B8, 0x752F, 0xE5B9, 0x9A9E, 0xE5BA, 0x6434, - 0xE5BB, 0x5BE4, 0xE5BC, 0x5BEE, 0xE5BD, 0x8930, 0xE5BE, 0x5BF0, - 0xE5BF, 0x8E47, 0xE5C0, 0x8B07, 0xE5C1, 0x8FB6, 0xE5C2, 0x8FD3, - 0xE5C3, 0x8FD5, 0xE5C4, 0x8FE5, 0xE5C5, 0x8FEE, 0xE5C6, 0x8FE4, - 0xE5C7, 0x8FE9, 0xE5C8, 0x8FE6, 0xE5C9, 0x8FF3, 0xE5CA, 0x8FE8, - 0xE5CB, 0x9005, 0xE5CC, 0x9004, 0xE5CD, 0x900B, 0xE5CE, 0x9026, - 0xE5CF, 0x9011, 0xE5D0, 0x900D, 0xE5D1, 0x9016, 0xE5D2, 0x9021, - 0xE5D3, 0x9035, 0xE5D4, 0x9036, 0xE5D5, 0x902D, 0xE5D6, 0x902F, - 0xE5D7, 0x9044, 0xE5D8, 0x9051, 0xE5D9, 0x9052, 0xE5DA, 0x9050, - 0xE5DB, 0x9068, 0xE5DC, 0x9058, 0xE5DD, 0x9062, 0xE5DE, 0x905B, - 0xE5DF, 0x66B9, 0xE5E0, 0x9074, 0xE5E1, 0x907D, 0xE5E2, 0x9082, - 0xE5E3, 0x9088, 0xE5E4, 0x9083, 0xE5E5, 0x908B, 0xE5E6, 0x5F50, - 0xE5E7, 0x5F57, 0xE5E8, 0x5F56, 0xE5E9, 0x5F58, 0xE5EA, 0x5C3B, - 0xE5EB, 0x54AB, 0xE5EC, 0x5C50, 0xE5ED, 0x5C59, 0xE5EE, 0x5B71, - 0xE5EF, 0x5C63, 0xE5F0, 0x5C66, 0xE5F1, 0x7FBC, 0xE5F2, 0x5F2A, - 0xE5F3, 0x5F29, 0xE5F4, 0x5F2D, 0xE5F5, 0x8274, 0xE5F6, 0x5F3C, - 0xE5F7, 0x9B3B, 0xE5F8, 0x5C6E, 0xE5F9, 0x5981, 0xE5FA, 0x5983, - 0xE5FB, 0x598D, 0xE5FC, 0x59A9, 0xE5FD, 0x59AA, 0xE5FE, 0x59A3, - 0xE640, 0x936C, 0xE641, 0x936D, 0xE642, 0x936E, 0xE643, 0x936F, - 0xE644, 0x9370, 0xE645, 0x9371, 0xE646, 0x9372, 0xE647, 0x9373, - 0xE648, 0x9374, 0xE649, 0x9375, 0xE64A, 0x9376, 0xE64B, 0x9377, - 0xE64C, 0x9378, 0xE64D, 0x9379, 0xE64E, 0x937A, 0xE64F, 0x937B, - 0xE650, 0x937C, 0xE651, 0x937D, 0xE652, 0x937E, 0xE653, 0x937F, - 0xE654, 0x9380, 0xE655, 0x9381, 0xE656, 0x9382, 0xE657, 0x9383, - 0xE658, 0x9384, 0xE659, 0x9385, 0xE65A, 0x9386, 0xE65B, 0x9387, - 0xE65C, 0x9388, 0xE65D, 0x9389, 0xE65E, 0x938A, 0xE65F, 0x938B, - 0xE660, 0x938C, 0xE661, 0x938D, 0xE662, 0x938E, 0xE663, 0x9390, - 0xE664, 0x9391, 0xE665, 0x9392, 0xE666, 0x9393, 0xE667, 0x9394, - 0xE668, 0x9395, 0xE669, 0x9396, 0xE66A, 0x9397, 0xE66B, 0x9398, - 0xE66C, 0x9399, 0xE66D, 0x939A, 0xE66E, 0x939B, 0xE66F, 0x939C, - 0xE670, 0x939D, 0xE671, 0x939E, 0xE672, 0x939F, 0xE673, 0x93A0, - 0xE674, 0x93A1, 0xE675, 0x93A2, 0xE676, 0x93A3, 0xE677, 0x93A4, - 0xE678, 0x93A5, 0xE679, 0x93A6, 0xE67A, 0x93A7, 0xE67B, 0x93A8, - 0xE67C, 0x93A9, 0xE67D, 0x93AA, 0xE67E, 0x93AB, 0xE680, 0x93AC, - 0xE681, 0x93AD, 0xE682, 0x93AE, 0xE683, 0x93AF, 0xE684, 0x93B0, - 0xE685, 0x93B1, 0xE686, 0x93B2, 0xE687, 0x93B3, 0xE688, 0x93B4, - 0xE689, 0x93B5, 0xE68A, 0x93B6, 0xE68B, 0x93B7, 0xE68C, 0x93B8, - 0xE68D, 0x93B9, 0xE68E, 0x93BA, 0xE68F, 0x93BB, 0xE690, 0x93BC, - 0xE691, 0x93BD, 0xE692, 0x93BE, 0xE693, 0x93BF, 0xE694, 0x93C0, - 0xE695, 0x93C1, 0xE696, 0x93C2, 0xE697, 0x93C3, 0xE698, 0x93C4, - 0xE699, 0x93C5, 0xE69A, 0x93C6, 0xE69B, 0x93C7, 0xE69C, 0x93C8, - 0xE69D, 0x93C9, 0xE69E, 0x93CB, 0xE69F, 0x93CC, 0xE6A0, 0x93CD, - 0xE6A1, 0x5997, 0xE6A2, 0x59CA, 0xE6A3, 0x59AB, 0xE6A4, 0x599E, - 0xE6A5, 0x59A4, 0xE6A6, 0x59D2, 0xE6A7, 0x59B2, 0xE6A8, 0x59AF, - 0xE6A9, 0x59D7, 0xE6AA, 0x59BE, 0xE6AB, 0x5A05, 0xE6AC, 0x5A06, - 0xE6AD, 0x59DD, 0xE6AE, 0x5A08, 0xE6AF, 0x59E3, 0xE6B0, 0x59D8, - 0xE6B1, 0x59F9, 0xE6B2, 0x5A0C, 0xE6B3, 0x5A09, 0xE6B4, 0x5A32, - 0xE6B5, 0x5A34, 0xE6B6, 0x5A11, 0xE6B7, 0x5A23, 0xE6B8, 0x5A13, - 0xE6B9, 0x5A40, 0xE6BA, 0x5A67, 0xE6BB, 0x5A4A, 0xE6BC, 0x5A55, - 0xE6BD, 0x5A3C, 0xE6BE, 0x5A62, 0xE6BF, 0x5A75, 0xE6C0, 0x80EC, - 0xE6C1, 0x5AAA, 0xE6C2, 0x5A9B, 0xE6C3, 0x5A77, 0xE6C4, 0x5A7A, - 0xE6C5, 0x5ABE, 0xE6C6, 0x5AEB, 0xE6C7, 0x5AB2, 0xE6C8, 0x5AD2, - 0xE6C9, 0x5AD4, 0xE6CA, 0x5AB8, 0xE6CB, 0x5AE0, 0xE6CC, 0x5AE3, - 0xE6CD, 0x5AF1, 0xE6CE, 0x5AD6, 0xE6CF, 0x5AE6, 0xE6D0, 0x5AD8, - 0xE6D1, 0x5ADC, 0xE6D2, 0x5B09, 0xE6D3, 0x5B17, 0xE6D4, 0x5B16, - 0xE6D5, 0x5B32, 0xE6D6, 0x5B37, 0xE6D7, 0x5B40, 0xE6D8, 0x5C15, - 0xE6D9, 0x5C1C, 0xE6DA, 0x5B5A, 0xE6DB, 0x5B65, 0xE6DC, 0x5B73, - 0xE6DD, 0x5B51, 0xE6DE, 0x5B53, 0xE6DF, 0x5B62, 0xE6E0, 0x9A75, - 0xE6E1, 0x9A77, 0xE6E2, 0x9A78, 0xE6E3, 0x9A7A, 0xE6E4, 0x9A7F, - 0xE6E5, 0x9A7D, 0xE6E6, 0x9A80, 0xE6E7, 0x9A81, 0xE6E8, 0x9A85, - 0xE6E9, 0x9A88, 0xE6EA, 0x9A8A, 0xE6EB, 0x9A90, 0xE6EC, 0x9A92, - 0xE6ED, 0x9A93, 0xE6EE, 0x9A96, 0xE6EF, 0x9A98, 0xE6F0, 0x9A9B, - 0xE6F1, 0x9A9C, 0xE6F2, 0x9A9D, 0xE6F3, 0x9A9F, 0xE6F4, 0x9AA0, - 0xE6F5, 0x9AA2, 0xE6F6, 0x9AA3, 0xE6F7, 0x9AA5, 0xE6F8, 0x9AA7, - 0xE6F9, 0x7E9F, 0xE6FA, 0x7EA1, 0xE6FB, 0x7EA3, 0xE6FC, 0x7EA5, - 0xE6FD, 0x7EA8, 0xE6FE, 0x7EA9, 0xE740, 0x93CE, 0xE741, 0x93CF, - 0xE742, 0x93D0, 0xE743, 0x93D1, 0xE744, 0x93D2, 0xE745, 0x93D3, - 0xE746, 0x93D4, 0xE747, 0x93D5, 0xE748, 0x93D7, 0xE749, 0x93D8, - 0xE74A, 0x93D9, 0xE74B, 0x93DA, 0xE74C, 0x93DB, 0xE74D, 0x93DC, - 0xE74E, 0x93DD, 0xE74F, 0x93DE, 0xE750, 0x93DF, 0xE751, 0x93E0, - 0xE752, 0x93E1, 0xE753, 0x93E2, 0xE754, 0x93E3, 0xE755, 0x93E4, - 0xE756, 0x93E5, 0xE757, 0x93E6, 0xE758, 0x93E7, 0xE759, 0x93E8, - 0xE75A, 0x93E9, 0xE75B, 0x93EA, 0xE75C, 0x93EB, 0xE75D, 0x93EC, - 0xE75E, 0x93ED, 0xE75F, 0x93EE, 0xE760, 0x93EF, 0xE761, 0x93F0, - 0xE762, 0x93F1, 0xE763, 0x93F2, 0xE764, 0x93F3, 0xE765, 0x93F4, - 0xE766, 0x93F5, 0xE767, 0x93F6, 0xE768, 0x93F7, 0xE769, 0x93F8, - 0xE76A, 0x93F9, 0xE76B, 0x93FA, 0xE76C, 0x93FB, 0xE76D, 0x93FC, - 0xE76E, 0x93FD, 0xE76F, 0x93FE, 0xE770, 0x93FF, 0xE771, 0x9400, - 0xE772, 0x9401, 0xE773, 0x9402, 0xE774, 0x9403, 0xE775, 0x9404, - 0xE776, 0x9405, 0xE777, 0x9406, 0xE778, 0x9407, 0xE779, 0x9408, - 0xE77A, 0x9409, 0xE77B, 0x940A, 0xE77C, 0x940B, 0xE77D, 0x940C, - 0xE77E, 0x940D, 0xE780, 0x940E, 0xE781, 0x940F, 0xE782, 0x9410, - 0xE783, 0x9411, 0xE784, 0x9412, 0xE785, 0x9413, 0xE786, 0x9414, - 0xE787, 0x9415, 0xE788, 0x9416, 0xE789, 0x9417, 0xE78A, 0x9418, - 0xE78B, 0x9419, 0xE78C, 0x941A, 0xE78D, 0x941B, 0xE78E, 0x941C, - 0xE78F, 0x941D, 0xE790, 0x941E, 0xE791, 0x941F, 0xE792, 0x9420, - 0xE793, 0x9421, 0xE794, 0x9422, 0xE795, 0x9423, 0xE796, 0x9424, - 0xE797, 0x9425, 0xE798, 0x9426, 0xE799, 0x9427, 0xE79A, 0x9428, - 0xE79B, 0x9429, 0xE79C, 0x942A, 0xE79D, 0x942B, 0xE79E, 0x942C, - 0xE79F, 0x942D, 0xE7A0, 0x942E, 0xE7A1, 0x7EAD, 0xE7A2, 0x7EB0, - 0xE7A3, 0x7EBE, 0xE7A4, 0x7EC0, 0xE7A5, 0x7EC1, 0xE7A6, 0x7EC2, - 0xE7A7, 0x7EC9, 0xE7A8, 0x7ECB, 0xE7A9, 0x7ECC, 0xE7AA, 0x7ED0, - 0xE7AB, 0x7ED4, 0xE7AC, 0x7ED7, 0xE7AD, 0x7EDB, 0xE7AE, 0x7EE0, - 0xE7AF, 0x7EE1, 0xE7B0, 0x7EE8, 0xE7B1, 0x7EEB, 0xE7B2, 0x7EEE, - 0xE7B3, 0x7EEF, 0xE7B4, 0x7EF1, 0xE7B5, 0x7EF2, 0xE7B6, 0x7F0D, - 0xE7B7, 0x7EF6, 0xE7B8, 0x7EFA, 0xE7B9, 0x7EFB, 0xE7BA, 0x7EFE, - 0xE7BB, 0x7F01, 0xE7BC, 0x7F02, 0xE7BD, 0x7F03, 0xE7BE, 0x7F07, - 0xE7BF, 0x7F08, 0xE7C0, 0x7F0B, 0xE7C1, 0x7F0C, 0xE7C2, 0x7F0F, - 0xE7C3, 0x7F11, 0xE7C4, 0x7F12, 0xE7C5, 0x7F17, 0xE7C6, 0x7F19, - 0xE7C7, 0x7F1C, 0xE7C8, 0x7F1B, 0xE7C9, 0x7F1F, 0xE7CA, 0x7F21, - 0xE7CB, 0x7F22, 0xE7CC, 0x7F23, 0xE7CD, 0x7F24, 0xE7CE, 0x7F25, - 0xE7CF, 0x7F26, 0xE7D0, 0x7F27, 0xE7D1, 0x7F2A, 0xE7D2, 0x7F2B, - 0xE7D3, 0x7F2C, 0xE7D4, 0x7F2D, 0xE7D5, 0x7F2F, 0xE7D6, 0x7F30, - 0xE7D7, 0x7F31, 0xE7D8, 0x7F32, 0xE7D9, 0x7F33, 0xE7DA, 0x7F35, - 0xE7DB, 0x5E7A, 0xE7DC, 0x757F, 0xE7DD, 0x5DDB, 0xE7DE, 0x753E, - 0xE7DF, 0x9095, 0xE7E0, 0x738E, 0xE7E1, 0x7391, 0xE7E2, 0x73AE, - 0xE7E3, 0x73A2, 0xE7E4, 0x739F, 0xE7E5, 0x73CF, 0xE7E6, 0x73C2, - 0xE7E7, 0x73D1, 0xE7E8, 0x73B7, 0xE7E9, 0x73B3, 0xE7EA, 0x73C0, - 0xE7EB, 0x73C9, 0xE7EC, 0x73C8, 0xE7ED, 0x73E5, 0xE7EE, 0x73D9, - 0xE7EF, 0x987C, 0xE7F0, 0x740A, 0xE7F1, 0x73E9, 0xE7F2, 0x73E7, - 0xE7F3, 0x73DE, 0xE7F4, 0x73BA, 0xE7F5, 0x73F2, 0xE7F6, 0x740F, - 0xE7F7, 0x742A, 0xE7F8, 0x745B, 0xE7F9, 0x7426, 0xE7FA, 0x7425, - 0xE7FB, 0x7428, 0xE7FC, 0x7430, 0xE7FD, 0x742E, 0xE7FE, 0x742C, - 0xE840, 0x942F, 0xE841, 0x9430, 0xE842, 0x9431, 0xE843, 0x9432, - 0xE844, 0x9433, 0xE845, 0x9434, 0xE846, 0x9435, 0xE847, 0x9436, - 0xE848, 0x9437, 0xE849, 0x9438, 0xE84A, 0x9439, 0xE84B, 0x943A, - 0xE84C, 0x943B, 0xE84D, 0x943C, 0xE84E, 0x943D, 0xE84F, 0x943F, - 0xE850, 0x9440, 0xE851, 0x9441, 0xE852, 0x9442, 0xE853, 0x9443, - 0xE854, 0x9444, 0xE855, 0x9445, 0xE856, 0x9446, 0xE857, 0x9447, - 0xE858, 0x9448, 0xE859, 0x9449, 0xE85A, 0x944A, 0xE85B, 0x944B, - 0xE85C, 0x944C, 0xE85D, 0x944D, 0xE85E, 0x944E, 0xE85F, 0x944F, - 0xE860, 0x9450, 0xE861, 0x9451, 0xE862, 0x9452, 0xE863, 0x9453, - 0xE864, 0x9454, 0xE865, 0x9455, 0xE866, 0x9456, 0xE867, 0x9457, - 0xE868, 0x9458, 0xE869, 0x9459, 0xE86A, 0x945A, 0xE86B, 0x945B, - 0xE86C, 0x945C, 0xE86D, 0x945D, 0xE86E, 0x945E, 0xE86F, 0x945F, - 0xE870, 0x9460, 0xE871, 0x9461, 0xE872, 0x9462, 0xE873, 0x9463, - 0xE874, 0x9464, 0xE875, 0x9465, 0xE876, 0x9466, 0xE877, 0x9467, - 0xE878, 0x9468, 0xE879, 0x9469, 0xE87A, 0x946A, 0xE87B, 0x946C, - 0xE87C, 0x946D, 0xE87D, 0x946E, 0xE87E, 0x946F, 0xE880, 0x9470, - 0xE881, 0x9471, 0xE882, 0x9472, 0xE883, 0x9473, 0xE884, 0x9474, - 0xE885, 0x9475, 0xE886, 0x9476, 0xE887, 0x9477, 0xE888, 0x9478, - 0xE889, 0x9479, 0xE88A, 0x947A, 0xE88B, 0x947B, 0xE88C, 0x947C, - 0xE88D, 0x947D, 0xE88E, 0x947E, 0xE88F, 0x947F, 0xE890, 0x9480, - 0xE891, 0x9481, 0xE892, 0x9482, 0xE893, 0x9483, 0xE894, 0x9484, - 0xE895, 0x9491, 0xE896, 0x9496, 0xE897, 0x9498, 0xE898, 0x94C7, - 0xE899, 0x94CF, 0xE89A, 0x94D3, 0xE89B, 0x94D4, 0xE89C, 0x94DA, - 0xE89D, 0x94E6, 0xE89E, 0x94FB, 0xE89F, 0x951C, 0xE8A0, 0x9520, - 0xE8A1, 0x741B, 0xE8A2, 0x741A, 0xE8A3, 0x7441, 0xE8A4, 0x745C, - 0xE8A5, 0x7457, 0xE8A6, 0x7455, 0xE8A7, 0x7459, 0xE8A8, 0x7477, - 0xE8A9, 0x746D, 0xE8AA, 0x747E, 0xE8AB, 0x749C, 0xE8AC, 0x748E, - 0xE8AD, 0x7480, 0xE8AE, 0x7481, 0xE8AF, 0x7487, 0xE8B0, 0x748B, - 0xE8B1, 0x749E, 0xE8B2, 0x74A8, 0xE8B3, 0x74A9, 0xE8B4, 0x7490, - 0xE8B5, 0x74A7, 0xE8B6, 0x74D2, 0xE8B7, 0x74BA, 0xE8B8, 0x97EA, - 0xE8B9, 0x97EB, 0xE8BA, 0x97EC, 0xE8BB, 0x674C, 0xE8BC, 0x6753, - 0xE8BD, 0x675E, 0xE8BE, 0x6748, 0xE8BF, 0x6769, 0xE8C0, 0x67A5, - 0xE8C1, 0x6787, 0xE8C2, 0x676A, 0xE8C3, 0x6773, 0xE8C4, 0x6798, - 0xE8C5, 0x67A7, 0xE8C6, 0x6775, 0xE8C7, 0x67A8, 0xE8C8, 0x679E, - 0xE8C9, 0x67AD, 0xE8CA, 0x678B, 0xE8CB, 0x6777, 0xE8CC, 0x677C, - 0xE8CD, 0x67F0, 0xE8CE, 0x6809, 0xE8CF, 0x67D8, 0xE8D0, 0x680A, - 0xE8D1, 0x67E9, 0xE8D2, 0x67B0, 0xE8D3, 0x680C, 0xE8D4, 0x67D9, - 0xE8D5, 0x67B5, 0xE8D6, 0x67DA, 0xE8D7, 0x67B3, 0xE8D8, 0x67DD, - 0xE8D9, 0x6800, 0xE8DA, 0x67C3, 0xE8DB, 0x67B8, 0xE8DC, 0x67E2, - 0xE8DD, 0x680E, 0xE8DE, 0x67C1, 0xE8DF, 0x67FD, 0xE8E0, 0x6832, - 0xE8E1, 0x6833, 0xE8E2, 0x6860, 0xE8E3, 0x6861, 0xE8E4, 0x684E, - 0xE8E5, 0x6862, 0xE8E6, 0x6844, 0xE8E7, 0x6864, 0xE8E8, 0x6883, - 0xE8E9, 0x681D, 0xE8EA, 0x6855, 0xE8EB, 0x6866, 0xE8EC, 0x6841, - 0xE8ED, 0x6867, 0xE8EE, 0x6840, 0xE8EF, 0x683E, 0xE8F0, 0x684A, - 0xE8F1, 0x6849, 0xE8F2, 0x6829, 0xE8F3, 0x68B5, 0xE8F4, 0x688F, - 0xE8F5, 0x6874, 0xE8F6, 0x6877, 0xE8F7, 0x6893, 0xE8F8, 0x686B, - 0xE8F9, 0x68C2, 0xE8FA, 0x696E, 0xE8FB, 0x68FC, 0xE8FC, 0x691F, - 0xE8FD, 0x6920, 0xE8FE, 0x68F9, 0xE940, 0x9527, 0xE941, 0x9533, - 0xE942, 0x953D, 0xE943, 0x9543, 0xE944, 0x9548, 0xE945, 0x954B, - 0xE946, 0x9555, 0xE947, 0x955A, 0xE948, 0x9560, 0xE949, 0x956E, - 0xE94A, 0x9574, 0xE94B, 0x9575, 0xE94C, 0x9577, 0xE94D, 0x9578, - 0xE94E, 0x9579, 0xE94F, 0x957A, 0xE950, 0x957B, 0xE951, 0x957C, - 0xE952, 0x957D, 0xE953, 0x957E, 0xE954, 0x9580, 0xE955, 0x9581, - 0xE956, 0x9582, 0xE957, 0x9583, 0xE958, 0x9584, 0xE959, 0x9585, - 0xE95A, 0x9586, 0xE95B, 0x9587, 0xE95C, 0x9588, 0xE95D, 0x9589, - 0xE95E, 0x958A, 0xE95F, 0x958B, 0xE960, 0x958C, 0xE961, 0x958D, - 0xE962, 0x958E, 0xE963, 0x958F, 0xE964, 0x9590, 0xE965, 0x9591, - 0xE966, 0x9592, 0xE967, 0x9593, 0xE968, 0x9594, 0xE969, 0x9595, - 0xE96A, 0x9596, 0xE96B, 0x9597, 0xE96C, 0x9598, 0xE96D, 0x9599, - 0xE96E, 0x959A, 0xE96F, 0x959B, 0xE970, 0x959C, 0xE971, 0x959D, - 0xE972, 0x959E, 0xE973, 0x959F, 0xE974, 0x95A0, 0xE975, 0x95A1, - 0xE976, 0x95A2, 0xE977, 0x95A3, 0xE978, 0x95A4, 0xE979, 0x95A5, - 0xE97A, 0x95A6, 0xE97B, 0x95A7, 0xE97C, 0x95A8, 0xE97D, 0x95A9, - 0xE97E, 0x95AA, 0xE980, 0x95AB, 0xE981, 0x95AC, 0xE982, 0x95AD, - 0xE983, 0x95AE, 0xE984, 0x95AF, 0xE985, 0x95B0, 0xE986, 0x95B1, - 0xE987, 0x95B2, 0xE988, 0x95B3, 0xE989, 0x95B4, 0xE98A, 0x95B5, - 0xE98B, 0x95B6, 0xE98C, 0x95B7, 0xE98D, 0x95B8, 0xE98E, 0x95B9, - 0xE98F, 0x95BA, 0xE990, 0x95BB, 0xE991, 0x95BC, 0xE992, 0x95BD, - 0xE993, 0x95BE, 0xE994, 0x95BF, 0xE995, 0x95C0, 0xE996, 0x95C1, - 0xE997, 0x95C2, 0xE998, 0x95C3, 0xE999, 0x95C4, 0xE99A, 0x95C5, - 0xE99B, 0x95C6, 0xE99C, 0x95C7, 0xE99D, 0x95C8, 0xE99E, 0x95C9, - 0xE99F, 0x95CA, 0xE9A0, 0x95CB, 0xE9A1, 0x6924, 0xE9A2, 0x68F0, - 0xE9A3, 0x690B, 0xE9A4, 0x6901, 0xE9A5, 0x6957, 0xE9A6, 0x68E3, - 0xE9A7, 0x6910, 0xE9A8, 0x6971, 0xE9A9, 0x6939, 0xE9AA, 0x6960, - 0xE9AB, 0x6942, 0xE9AC, 0x695D, 0xE9AD, 0x6984, 0xE9AE, 0x696B, - 0xE9AF, 0x6980, 0xE9B0, 0x6998, 0xE9B1, 0x6978, 0xE9B2, 0x6934, - 0xE9B3, 0x69CC, 0xE9B4, 0x6987, 0xE9B5, 0x6988, 0xE9B6, 0x69CE, - 0xE9B7, 0x6989, 0xE9B8, 0x6966, 0xE9B9, 0x6963, 0xE9BA, 0x6979, - 0xE9BB, 0x699B, 0xE9BC, 0x69A7, 0xE9BD, 0x69BB, 0xE9BE, 0x69AB, - 0xE9BF, 0x69AD, 0xE9C0, 0x69D4, 0xE9C1, 0x69B1, 0xE9C2, 0x69C1, - 0xE9C3, 0x69CA, 0xE9C4, 0x69DF, 0xE9C5, 0x6995, 0xE9C6, 0x69E0, - 0xE9C7, 0x698D, 0xE9C8, 0x69FF, 0xE9C9, 0x6A2F, 0xE9CA, 0x69ED, - 0xE9CB, 0x6A17, 0xE9CC, 0x6A18, 0xE9CD, 0x6A65, 0xE9CE, 0x69F2, - 0xE9CF, 0x6A44, 0xE9D0, 0x6A3E, 0xE9D1, 0x6AA0, 0xE9D2, 0x6A50, - 0xE9D3, 0x6A5B, 0xE9D4, 0x6A35, 0xE9D5, 0x6A8E, 0xE9D6, 0x6A79, - 0xE9D7, 0x6A3D, 0xE9D8, 0x6A28, 0xE9D9, 0x6A58, 0xE9DA, 0x6A7C, - 0xE9DB, 0x6A91, 0xE9DC, 0x6A90, 0xE9DD, 0x6AA9, 0xE9DE, 0x6A97, - 0xE9DF, 0x6AAB, 0xE9E0, 0x7337, 0xE9E1, 0x7352, 0xE9E2, 0x6B81, - 0xE9E3, 0x6B82, 0xE9E4, 0x6B87, 0xE9E5, 0x6B84, 0xE9E6, 0x6B92, - 0xE9E7, 0x6B93, 0xE9E8, 0x6B8D, 0xE9E9, 0x6B9A, 0xE9EA, 0x6B9B, - 0xE9EB, 0x6BA1, 0xE9EC, 0x6BAA, 0xE9ED, 0x8F6B, 0xE9EE, 0x8F6D, - 0xE9EF, 0x8F71, 0xE9F0, 0x8F72, 0xE9F1, 0x8F73, 0xE9F2, 0x8F75, - 0xE9F3, 0x8F76, 0xE9F4, 0x8F78, 0xE9F5, 0x8F77, 0xE9F6, 0x8F79, - 0xE9F7, 0x8F7A, 0xE9F8, 0x8F7C, 0xE9F9, 0x8F7E, 0xE9FA, 0x8F81, - 0xE9FB, 0x8F82, 0xE9FC, 0x8F84, 0xE9FD, 0x8F87, 0xE9FE, 0x8F8B, - 0xEA40, 0x95CC, 0xEA41, 0x95CD, 0xEA42, 0x95CE, 0xEA43, 0x95CF, - 0xEA44, 0x95D0, 0xEA45, 0x95D1, 0xEA46, 0x95D2, 0xEA47, 0x95D3, - 0xEA48, 0x95D4, 0xEA49, 0x95D5, 0xEA4A, 0x95D6, 0xEA4B, 0x95D7, - 0xEA4C, 0x95D8, 0xEA4D, 0x95D9, 0xEA4E, 0x95DA, 0xEA4F, 0x95DB, - 0xEA50, 0x95DC, 0xEA51, 0x95DD, 0xEA52, 0x95DE, 0xEA53, 0x95DF, - 0xEA54, 0x95E0, 0xEA55, 0x95E1, 0xEA56, 0x95E2, 0xEA57, 0x95E3, - 0xEA58, 0x95E4, 0xEA59, 0x95E5, 0xEA5A, 0x95E6, 0xEA5B, 0x95E7, - 0xEA5C, 0x95EC, 0xEA5D, 0x95FF, 0xEA5E, 0x9607, 0xEA5F, 0x9613, - 0xEA60, 0x9618, 0xEA61, 0x961B, 0xEA62, 0x961E, 0xEA63, 0x9620, - 0xEA64, 0x9623, 0xEA65, 0x9624, 0xEA66, 0x9625, 0xEA67, 0x9626, - 0xEA68, 0x9627, 0xEA69, 0x9628, 0xEA6A, 0x9629, 0xEA6B, 0x962B, - 0xEA6C, 0x962C, 0xEA6D, 0x962D, 0xEA6E, 0x962F, 0xEA6F, 0x9630, - 0xEA70, 0x9637, 0xEA71, 0x9638, 0xEA72, 0x9639, 0xEA73, 0x963A, - 0xEA74, 0x963E, 0xEA75, 0x9641, 0xEA76, 0x9643, 0xEA77, 0x964A, - 0xEA78, 0x964E, 0xEA79, 0x964F, 0xEA7A, 0x9651, 0xEA7B, 0x9652, - 0xEA7C, 0x9653, 0xEA7D, 0x9656, 0xEA7E, 0x9657, 0xEA80, 0x9658, - 0xEA81, 0x9659, 0xEA82, 0x965A, 0xEA83, 0x965C, 0xEA84, 0x965D, - 0xEA85, 0x965E, 0xEA86, 0x9660, 0xEA87, 0x9663, 0xEA88, 0x9665, - 0xEA89, 0x9666, 0xEA8A, 0x966B, 0xEA8B, 0x966D, 0xEA8C, 0x966E, - 0xEA8D, 0x966F, 0xEA8E, 0x9670, 0xEA8F, 0x9671, 0xEA90, 0x9673, - 0xEA91, 0x9678, 0xEA92, 0x9679, 0xEA93, 0x967A, 0xEA94, 0x967B, - 0xEA95, 0x967C, 0xEA96, 0x967D, 0xEA97, 0x967E, 0xEA98, 0x967F, - 0xEA99, 0x9680, 0xEA9A, 0x9681, 0xEA9B, 0x9682, 0xEA9C, 0x9683, - 0xEA9D, 0x9684, 0xEA9E, 0x9687, 0xEA9F, 0x9689, 0xEAA0, 0x968A, - 0xEAA1, 0x8F8D, 0xEAA2, 0x8F8E, 0xEAA3, 0x8F8F, 0xEAA4, 0x8F98, - 0xEAA5, 0x8F9A, 0xEAA6, 0x8ECE, 0xEAA7, 0x620B, 0xEAA8, 0x6217, - 0xEAA9, 0x621B, 0xEAAA, 0x621F, 0xEAAB, 0x6222, 0xEAAC, 0x6221, - 0xEAAD, 0x6225, 0xEAAE, 0x6224, 0xEAAF, 0x622C, 0xEAB0, 0x81E7, - 0xEAB1, 0x74EF, 0xEAB2, 0x74F4, 0xEAB3, 0x74FF, 0xEAB4, 0x750F, - 0xEAB5, 0x7511, 0xEAB6, 0x7513, 0xEAB7, 0x6534, 0xEAB8, 0x65EE, - 0xEAB9, 0x65EF, 0xEABA, 0x65F0, 0xEABB, 0x660A, 0xEABC, 0x6619, - 0xEABD, 0x6772, 0xEABE, 0x6603, 0xEABF, 0x6615, 0xEAC0, 0x6600, - 0xEAC1, 0x7085, 0xEAC2, 0x66F7, 0xEAC3, 0x661D, 0xEAC4, 0x6634, - 0xEAC5, 0x6631, 0xEAC6, 0x6636, 0xEAC7, 0x6635, 0xEAC8, 0x8006, - 0xEAC9, 0x665F, 0xEACA, 0x6654, 0xEACB, 0x6641, 0xEACC, 0x664F, - 0xEACD, 0x6656, 0xEACE, 0x6661, 0xEACF, 0x6657, 0xEAD0, 0x6677, - 0xEAD1, 0x6684, 0xEAD2, 0x668C, 0xEAD3, 0x66A7, 0xEAD4, 0x669D, - 0xEAD5, 0x66BE, 0xEAD6, 0x66DB, 0xEAD7, 0x66DC, 0xEAD8, 0x66E6, - 0xEAD9, 0x66E9, 0xEADA, 0x8D32, 0xEADB, 0x8D33, 0xEADC, 0x8D36, - 0xEADD, 0x8D3B, 0xEADE, 0x8D3D, 0xEADF, 0x8D40, 0xEAE0, 0x8D45, - 0xEAE1, 0x8D46, 0xEAE2, 0x8D48, 0xEAE3, 0x8D49, 0xEAE4, 0x8D47, - 0xEAE5, 0x8D4D, 0xEAE6, 0x8D55, 0xEAE7, 0x8D59, 0xEAE8, 0x89C7, - 0xEAE9, 0x89CA, 0xEAEA, 0x89CB, 0xEAEB, 0x89CC, 0xEAEC, 0x89CE, - 0xEAED, 0x89CF, 0xEAEE, 0x89D0, 0xEAEF, 0x89D1, 0xEAF0, 0x726E, - 0xEAF1, 0x729F, 0xEAF2, 0x725D, 0xEAF3, 0x7266, 0xEAF4, 0x726F, - 0xEAF5, 0x727E, 0xEAF6, 0x727F, 0xEAF7, 0x7284, 0xEAF8, 0x728B, - 0xEAF9, 0x728D, 0xEAFA, 0x728F, 0xEAFB, 0x7292, 0xEAFC, 0x6308, - 0xEAFD, 0x6332, 0xEAFE, 0x63B0, 0xEB40, 0x968C, 0xEB41, 0x968E, - 0xEB42, 0x9691, 0xEB43, 0x9692, 0xEB44, 0x9693, 0xEB45, 0x9695, - 0xEB46, 0x9696, 0xEB47, 0x969A, 0xEB48, 0x969B, 0xEB49, 0x969D, - 0xEB4A, 0x969E, 0xEB4B, 0x969F, 0xEB4C, 0x96A0, 0xEB4D, 0x96A1, - 0xEB4E, 0x96A2, 0xEB4F, 0x96A3, 0xEB50, 0x96A4, 0xEB51, 0x96A5, - 0xEB52, 0x96A6, 0xEB53, 0x96A8, 0xEB54, 0x96A9, 0xEB55, 0x96AA, - 0xEB56, 0x96AB, 0xEB57, 0x96AC, 0xEB58, 0x96AD, 0xEB59, 0x96AE, - 0xEB5A, 0x96AF, 0xEB5B, 0x96B1, 0xEB5C, 0x96B2, 0xEB5D, 0x96B4, - 0xEB5E, 0x96B5, 0xEB5F, 0x96B7, 0xEB60, 0x96B8, 0xEB61, 0x96BA, - 0xEB62, 0x96BB, 0xEB63, 0x96BF, 0xEB64, 0x96C2, 0xEB65, 0x96C3, - 0xEB66, 0x96C8, 0xEB67, 0x96CA, 0xEB68, 0x96CB, 0xEB69, 0x96D0, - 0xEB6A, 0x96D1, 0xEB6B, 0x96D3, 0xEB6C, 0x96D4, 0xEB6D, 0x96D6, - 0xEB6E, 0x96D7, 0xEB6F, 0x96D8, 0xEB70, 0x96D9, 0xEB71, 0x96DA, - 0xEB72, 0x96DB, 0xEB73, 0x96DC, 0xEB74, 0x96DD, 0xEB75, 0x96DE, - 0xEB76, 0x96DF, 0xEB77, 0x96E1, 0xEB78, 0x96E2, 0xEB79, 0x96E3, - 0xEB7A, 0x96E4, 0xEB7B, 0x96E5, 0xEB7C, 0x96E6, 0xEB7D, 0x96E7, - 0xEB7E, 0x96EB, 0xEB80, 0x96EC, 0xEB81, 0x96ED, 0xEB82, 0x96EE, - 0xEB83, 0x96F0, 0xEB84, 0x96F1, 0xEB85, 0x96F2, 0xEB86, 0x96F4, - 0xEB87, 0x96F5, 0xEB88, 0x96F8, 0xEB89, 0x96FA, 0xEB8A, 0x96FB, - 0xEB8B, 0x96FC, 0xEB8C, 0x96FD, 0xEB8D, 0x96FF, 0xEB8E, 0x9702, - 0xEB8F, 0x9703, 0xEB90, 0x9705, 0xEB91, 0x970A, 0xEB92, 0x970B, - 0xEB93, 0x970C, 0xEB94, 0x9710, 0xEB95, 0x9711, 0xEB96, 0x9712, - 0xEB97, 0x9714, 0xEB98, 0x9715, 0xEB99, 0x9717, 0xEB9A, 0x9718, - 0xEB9B, 0x9719, 0xEB9C, 0x971A, 0xEB9D, 0x971B, 0xEB9E, 0x971D, - 0xEB9F, 0x971F, 0xEBA0, 0x9720, 0xEBA1, 0x643F, 0xEBA2, 0x64D8, - 0xEBA3, 0x8004, 0xEBA4, 0x6BEA, 0xEBA5, 0x6BF3, 0xEBA6, 0x6BFD, - 0xEBA7, 0x6BF5, 0xEBA8, 0x6BF9, 0xEBA9, 0x6C05, 0xEBAA, 0x6C07, - 0xEBAB, 0x6C06, 0xEBAC, 0x6C0D, 0xEBAD, 0x6C15, 0xEBAE, 0x6C18, - 0xEBAF, 0x6C19, 0xEBB0, 0x6C1A, 0xEBB1, 0x6C21, 0xEBB2, 0x6C29, - 0xEBB3, 0x6C24, 0xEBB4, 0x6C2A, 0xEBB5, 0x6C32, 0xEBB6, 0x6535, - 0xEBB7, 0x6555, 0xEBB8, 0x656B, 0xEBB9, 0x724D, 0xEBBA, 0x7252, - 0xEBBB, 0x7256, 0xEBBC, 0x7230, 0xEBBD, 0x8662, 0xEBBE, 0x5216, - 0xEBBF, 0x809F, 0xEBC0, 0x809C, 0xEBC1, 0x8093, 0xEBC2, 0x80BC, - 0xEBC3, 0x670A, 0xEBC4, 0x80BD, 0xEBC5, 0x80B1, 0xEBC6, 0x80AB, - 0xEBC7, 0x80AD, 0xEBC8, 0x80B4, 0xEBC9, 0x80B7, 0xEBCA, 0x80E7, - 0xEBCB, 0x80E8, 0xEBCC, 0x80E9, 0xEBCD, 0x80EA, 0xEBCE, 0x80DB, - 0xEBCF, 0x80C2, 0xEBD0, 0x80C4, 0xEBD1, 0x80D9, 0xEBD2, 0x80CD, - 0xEBD3, 0x80D7, 0xEBD4, 0x6710, 0xEBD5, 0x80DD, 0xEBD6, 0x80EB, - 0xEBD7, 0x80F1, 0xEBD8, 0x80F4, 0xEBD9, 0x80ED, 0xEBDA, 0x810D, - 0xEBDB, 0x810E, 0xEBDC, 0x80F2, 0xEBDD, 0x80FC, 0xEBDE, 0x6715, - 0xEBDF, 0x8112, 0xEBE0, 0x8C5A, 0xEBE1, 0x8136, 0xEBE2, 0x811E, - 0xEBE3, 0x812C, 0xEBE4, 0x8118, 0xEBE5, 0x8132, 0xEBE6, 0x8148, - 0xEBE7, 0x814C, 0xEBE8, 0x8153, 0xEBE9, 0x8174, 0xEBEA, 0x8159, - 0xEBEB, 0x815A, 0xEBEC, 0x8171, 0xEBED, 0x8160, 0xEBEE, 0x8169, - 0xEBEF, 0x817C, 0xEBF0, 0x817D, 0xEBF1, 0x816D, 0xEBF2, 0x8167, - 0xEBF3, 0x584D, 0xEBF4, 0x5AB5, 0xEBF5, 0x8188, 0xEBF6, 0x8182, - 0xEBF7, 0x8191, 0xEBF8, 0x6ED5, 0xEBF9, 0x81A3, 0xEBFA, 0x81AA, - 0xEBFB, 0x81CC, 0xEBFC, 0x6726, 0xEBFD, 0x81CA, 0xEBFE, 0x81BB, - 0xEC40, 0x9721, 0xEC41, 0x9722, 0xEC42, 0x9723, 0xEC43, 0x9724, - 0xEC44, 0x9725, 0xEC45, 0x9726, 0xEC46, 0x9727, 0xEC47, 0x9728, - 0xEC48, 0x9729, 0xEC49, 0x972B, 0xEC4A, 0x972C, 0xEC4B, 0x972E, - 0xEC4C, 0x972F, 0xEC4D, 0x9731, 0xEC4E, 0x9733, 0xEC4F, 0x9734, - 0xEC50, 0x9735, 0xEC51, 0x9736, 0xEC52, 0x9737, 0xEC53, 0x973A, - 0xEC54, 0x973B, 0xEC55, 0x973C, 0xEC56, 0x973D, 0xEC57, 0x973F, - 0xEC58, 0x9740, 0xEC59, 0x9741, 0xEC5A, 0x9742, 0xEC5B, 0x9743, - 0xEC5C, 0x9744, 0xEC5D, 0x9745, 0xEC5E, 0x9746, 0xEC5F, 0x9747, - 0xEC60, 0x9748, 0xEC61, 0x9749, 0xEC62, 0x974A, 0xEC63, 0x974B, - 0xEC64, 0x974C, 0xEC65, 0x974D, 0xEC66, 0x974E, 0xEC67, 0x974F, - 0xEC68, 0x9750, 0xEC69, 0x9751, 0xEC6A, 0x9754, 0xEC6B, 0x9755, - 0xEC6C, 0x9757, 0xEC6D, 0x9758, 0xEC6E, 0x975A, 0xEC6F, 0x975C, - 0xEC70, 0x975D, 0xEC71, 0x975F, 0xEC72, 0x9763, 0xEC73, 0x9764, - 0xEC74, 0x9766, 0xEC75, 0x9767, 0xEC76, 0x9768, 0xEC77, 0x976A, - 0xEC78, 0x976B, 0xEC79, 0x976C, 0xEC7A, 0x976D, 0xEC7B, 0x976E, - 0xEC7C, 0x976F, 0xEC7D, 0x9770, 0xEC7E, 0x9771, 0xEC80, 0x9772, - 0xEC81, 0x9775, 0xEC82, 0x9777, 0xEC83, 0x9778, 0xEC84, 0x9779, - 0xEC85, 0x977A, 0xEC86, 0x977B, 0xEC87, 0x977D, 0xEC88, 0x977E, - 0xEC89, 0x977F, 0xEC8A, 0x9780, 0xEC8B, 0x9781, 0xEC8C, 0x9782, - 0xEC8D, 0x9783, 0xEC8E, 0x9784, 0xEC8F, 0x9786, 0xEC90, 0x9787, - 0xEC91, 0x9788, 0xEC92, 0x9789, 0xEC93, 0x978A, 0xEC94, 0x978C, - 0xEC95, 0x978E, 0xEC96, 0x978F, 0xEC97, 0x9790, 0xEC98, 0x9793, - 0xEC99, 0x9795, 0xEC9A, 0x9796, 0xEC9B, 0x9797, 0xEC9C, 0x9799, - 0xEC9D, 0x979A, 0xEC9E, 0x979B, 0xEC9F, 0x979C, 0xECA0, 0x979D, - 0xECA1, 0x81C1, 0xECA2, 0x81A6, 0xECA3, 0x6B24, 0xECA4, 0x6B37, - 0xECA5, 0x6B39, 0xECA6, 0x6B43, 0xECA7, 0x6B46, 0xECA8, 0x6B59, - 0xECA9, 0x98D1, 0xECAA, 0x98D2, 0xECAB, 0x98D3, 0xECAC, 0x98D5, - 0xECAD, 0x98D9, 0xECAE, 0x98DA, 0xECAF, 0x6BB3, 0xECB0, 0x5F40, - 0xECB1, 0x6BC2, 0xECB2, 0x89F3, 0xECB3, 0x6590, 0xECB4, 0x9F51, - 0xECB5, 0x6593, 0xECB6, 0x65BC, 0xECB7, 0x65C6, 0xECB8, 0x65C4, - 0xECB9, 0x65C3, 0xECBA, 0x65CC, 0xECBB, 0x65CE, 0xECBC, 0x65D2, - 0xECBD, 0x65D6, 0xECBE, 0x7080, 0xECBF, 0x709C, 0xECC0, 0x7096, - 0xECC1, 0x709D, 0xECC2, 0x70BB, 0xECC3, 0x70C0, 0xECC4, 0x70B7, - 0xECC5, 0x70AB, 0xECC6, 0x70B1, 0xECC7, 0x70E8, 0xECC8, 0x70CA, - 0xECC9, 0x7110, 0xECCA, 0x7113, 0xECCB, 0x7116, 0xECCC, 0x712F, - 0xECCD, 0x7131, 0xECCE, 0x7173, 0xECCF, 0x715C, 0xECD0, 0x7168, - 0xECD1, 0x7145, 0xECD2, 0x7172, 0xECD3, 0x714A, 0xECD4, 0x7178, - 0xECD5, 0x717A, 0xECD6, 0x7198, 0xECD7, 0x71B3, 0xECD8, 0x71B5, - 0xECD9, 0x71A8, 0xECDA, 0x71A0, 0xECDB, 0x71E0, 0xECDC, 0x71D4, - 0xECDD, 0x71E7, 0xECDE, 0x71F9, 0xECDF, 0x721D, 0xECE0, 0x7228, - 0xECE1, 0x706C, 0xECE2, 0x7118, 0xECE3, 0x7166, 0xECE4, 0x71B9, - 0xECE5, 0x623E, 0xECE6, 0x623D, 0xECE7, 0x6243, 0xECE8, 0x6248, - 0xECE9, 0x6249, 0xECEA, 0x793B, 0xECEB, 0x7940, 0xECEC, 0x7946, - 0xECED, 0x7949, 0xECEE, 0x795B, 0xECEF, 0x795C, 0xECF0, 0x7953, - 0xECF1, 0x795A, 0xECF2, 0x7962, 0xECF3, 0x7957, 0xECF4, 0x7960, - 0xECF5, 0x796F, 0xECF6, 0x7967, 0xECF7, 0x797A, 0xECF8, 0x7985, - 0xECF9, 0x798A, 0xECFA, 0x799A, 0xECFB, 0x79A7, 0xECFC, 0x79B3, - 0xECFD, 0x5FD1, 0xECFE, 0x5FD0, 0xED40, 0x979E, 0xED41, 0x979F, - 0xED42, 0x97A1, 0xED43, 0x97A2, 0xED44, 0x97A4, 0xED45, 0x97A5, - 0xED46, 0x97A6, 0xED47, 0x97A7, 0xED48, 0x97A8, 0xED49, 0x97A9, - 0xED4A, 0x97AA, 0xED4B, 0x97AC, 0xED4C, 0x97AE, 0xED4D, 0x97B0, - 0xED4E, 0x97B1, 0xED4F, 0x97B3, 0xED50, 0x97B5, 0xED51, 0x97B6, - 0xED52, 0x97B7, 0xED53, 0x97B8, 0xED54, 0x97B9, 0xED55, 0x97BA, - 0xED56, 0x97BB, 0xED57, 0x97BC, 0xED58, 0x97BD, 0xED59, 0x97BE, - 0xED5A, 0x97BF, 0xED5B, 0x97C0, 0xED5C, 0x97C1, 0xED5D, 0x97C2, - 0xED5E, 0x97C3, 0xED5F, 0x97C4, 0xED60, 0x97C5, 0xED61, 0x97C6, - 0xED62, 0x97C7, 0xED63, 0x97C8, 0xED64, 0x97C9, 0xED65, 0x97CA, - 0xED66, 0x97CB, 0xED67, 0x97CC, 0xED68, 0x97CD, 0xED69, 0x97CE, - 0xED6A, 0x97CF, 0xED6B, 0x97D0, 0xED6C, 0x97D1, 0xED6D, 0x97D2, - 0xED6E, 0x97D3, 0xED6F, 0x97D4, 0xED70, 0x97D5, 0xED71, 0x97D6, - 0xED72, 0x97D7, 0xED73, 0x97D8, 0xED74, 0x97D9, 0xED75, 0x97DA, - 0xED76, 0x97DB, 0xED77, 0x97DC, 0xED78, 0x97DD, 0xED79, 0x97DE, - 0xED7A, 0x97DF, 0xED7B, 0x97E0, 0xED7C, 0x97E1, 0xED7D, 0x97E2, - 0xED7E, 0x97E3, 0xED80, 0x97E4, 0xED81, 0x97E5, 0xED82, 0x97E8, - 0xED83, 0x97EE, 0xED84, 0x97EF, 0xED85, 0x97F0, 0xED86, 0x97F1, - 0xED87, 0x97F2, 0xED88, 0x97F4, 0xED89, 0x97F7, 0xED8A, 0x97F8, - 0xED8B, 0x97F9, 0xED8C, 0x97FA, 0xED8D, 0x97FB, 0xED8E, 0x97FC, - 0xED8F, 0x97FD, 0xED90, 0x97FE, 0xED91, 0x97FF, 0xED92, 0x9800, - 0xED93, 0x9801, 0xED94, 0x9802, 0xED95, 0x9803, 0xED96, 0x9804, - 0xED97, 0x9805, 0xED98, 0x9806, 0xED99, 0x9807, 0xED9A, 0x9808, - 0xED9B, 0x9809, 0xED9C, 0x980A, 0xED9D, 0x980B, 0xED9E, 0x980C, - 0xED9F, 0x980D, 0xEDA0, 0x980E, 0xEDA1, 0x603C, 0xEDA2, 0x605D, - 0xEDA3, 0x605A, 0xEDA4, 0x6067, 0xEDA5, 0x6041, 0xEDA6, 0x6059, - 0xEDA7, 0x6063, 0xEDA8, 0x60AB, 0xEDA9, 0x6106, 0xEDAA, 0x610D, - 0xEDAB, 0x615D, 0xEDAC, 0x61A9, 0xEDAD, 0x619D, 0xEDAE, 0x61CB, - 0xEDAF, 0x61D1, 0xEDB0, 0x6206, 0xEDB1, 0x8080, 0xEDB2, 0x807F, - 0xEDB3, 0x6C93, 0xEDB4, 0x6CF6, 0xEDB5, 0x6DFC, 0xEDB6, 0x77F6, - 0xEDB7, 0x77F8, 0xEDB8, 0x7800, 0xEDB9, 0x7809, 0xEDBA, 0x7817, - 0xEDBB, 0x7818, 0xEDBC, 0x7811, 0xEDBD, 0x65AB, 0xEDBE, 0x782D, - 0xEDBF, 0x781C, 0xEDC0, 0x781D, 0xEDC1, 0x7839, 0xEDC2, 0x783A, - 0xEDC3, 0x783B, 0xEDC4, 0x781F, 0xEDC5, 0x783C, 0xEDC6, 0x7825, - 0xEDC7, 0x782C, 0xEDC8, 0x7823, 0xEDC9, 0x7829, 0xEDCA, 0x784E, - 0xEDCB, 0x786D, 0xEDCC, 0x7856, 0xEDCD, 0x7857, 0xEDCE, 0x7826, - 0xEDCF, 0x7850, 0xEDD0, 0x7847, 0xEDD1, 0x784C, 0xEDD2, 0x786A, - 0xEDD3, 0x789B, 0xEDD4, 0x7893, 0xEDD5, 0x789A, 0xEDD6, 0x7887, - 0xEDD7, 0x789C, 0xEDD8, 0x78A1, 0xEDD9, 0x78A3, 0xEDDA, 0x78B2, - 0xEDDB, 0x78B9, 0xEDDC, 0x78A5, 0xEDDD, 0x78D4, 0xEDDE, 0x78D9, - 0xEDDF, 0x78C9, 0xEDE0, 0x78EC, 0xEDE1, 0x78F2, 0xEDE2, 0x7905, - 0xEDE3, 0x78F4, 0xEDE4, 0x7913, 0xEDE5, 0x7924, 0xEDE6, 0x791E, - 0xEDE7, 0x7934, 0xEDE8, 0x9F9B, 0xEDE9, 0x9EF9, 0xEDEA, 0x9EFB, - 0xEDEB, 0x9EFC, 0xEDEC, 0x76F1, 0xEDED, 0x7704, 0xEDEE, 0x770D, - 0xEDEF, 0x76F9, 0xEDF0, 0x7707, 0xEDF1, 0x7708, 0xEDF2, 0x771A, - 0xEDF3, 0x7722, 0xEDF4, 0x7719, 0xEDF5, 0x772D, 0xEDF6, 0x7726, - 0xEDF7, 0x7735, 0xEDF8, 0x7738, 0xEDF9, 0x7750, 0xEDFA, 0x7751, - 0xEDFB, 0x7747, 0xEDFC, 0x7743, 0xEDFD, 0x775A, 0xEDFE, 0x7768, - 0xEE40, 0x980F, 0xEE41, 0x9810, 0xEE42, 0x9811, 0xEE43, 0x9812, - 0xEE44, 0x9813, 0xEE45, 0x9814, 0xEE46, 0x9815, 0xEE47, 0x9816, - 0xEE48, 0x9817, 0xEE49, 0x9818, 0xEE4A, 0x9819, 0xEE4B, 0x981A, - 0xEE4C, 0x981B, 0xEE4D, 0x981C, 0xEE4E, 0x981D, 0xEE4F, 0x981E, - 0xEE50, 0x981F, 0xEE51, 0x9820, 0xEE52, 0x9821, 0xEE53, 0x9822, - 0xEE54, 0x9823, 0xEE55, 0x9824, 0xEE56, 0x9825, 0xEE57, 0x9826, - 0xEE58, 0x9827, 0xEE59, 0x9828, 0xEE5A, 0x9829, 0xEE5B, 0x982A, - 0xEE5C, 0x982B, 0xEE5D, 0x982C, 0xEE5E, 0x982D, 0xEE5F, 0x982E, - 0xEE60, 0x982F, 0xEE61, 0x9830, 0xEE62, 0x9831, 0xEE63, 0x9832, - 0xEE64, 0x9833, 0xEE65, 0x9834, 0xEE66, 0x9835, 0xEE67, 0x9836, - 0xEE68, 0x9837, 0xEE69, 0x9838, 0xEE6A, 0x9839, 0xEE6B, 0x983A, - 0xEE6C, 0x983B, 0xEE6D, 0x983C, 0xEE6E, 0x983D, 0xEE6F, 0x983E, - 0xEE70, 0x983F, 0xEE71, 0x9840, 0xEE72, 0x9841, 0xEE73, 0x9842, - 0xEE74, 0x9843, 0xEE75, 0x9844, 0xEE76, 0x9845, 0xEE77, 0x9846, - 0xEE78, 0x9847, 0xEE79, 0x9848, 0xEE7A, 0x9849, 0xEE7B, 0x984A, - 0xEE7C, 0x984B, 0xEE7D, 0x984C, 0xEE7E, 0x984D, 0xEE80, 0x984E, - 0xEE81, 0x984F, 0xEE82, 0x9850, 0xEE83, 0x9851, 0xEE84, 0x9852, - 0xEE85, 0x9853, 0xEE86, 0x9854, 0xEE87, 0x9855, 0xEE88, 0x9856, - 0xEE89, 0x9857, 0xEE8A, 0x9858, 0xEE8B, 0x9859, 0xEE8C, 0x985A, - 0xEE8D, 0x985B, 0xEE8E, 0x985C, 0xEE8F, 0x985D, 0xEE90, 0x985E, - 0xEE91, 0x985F, 0xEE92, 0x9860, 0xEE93, 0x9861, 0xEE94, 0x9862, - 0xEE95, 0x9863, 0xEE96, 0x9864, 0xEE97, 0x9865, 0xEE98, 0x9866, - 0xEE99, 0x9867, 0xEE9A, 0x9868, 0xEE9B, 0x9869, 0xEE9C, 0x986A, - 0xEE9D, 0x986B, 0xEE9E, 0x986C, 0xEE9F, 0x986D, 0xEEA0, 0x986E, - 0xEEA1, 0x7762, 0xEEA2, 0x7765, 0xEEA3, 0x777F, 0xEEA4, 0x778D, - 0xEEA5, 0x777D, 0xEEA6, 0x7780, 0xEEA7, 0x778C, 0xEEA8, 0x7791, - 0xEEA9, 0x779F, 0xEEAA, 0x77A0, 0xEEAB, 0x77B0, 0xEEAC, 0x77B5, - 0xEEAD, 0x77BD, 0xEEAE, 0x753A, 0xEEAF, 0x7540, 0xEEB0, 0x754E, - 0xEEB1, 0x754B, 0xEEB2, 0x7548, 0xEEB3, 0x755B, 0xEEB4, 0x7572, - 0xEEB5, 0x7579, 0xEEB6, 0x7583, 0xEEB7, 0x7F58, 0xEEB8, 0x7F61, - 0xEEB9, 0x7F5F, 0xEEBA, 0x8A48, 0xEEBB, 0x7F68, 0xEEBC, 0x7F74, - 0xEEBD, 0x7F71, 0xEEBE, 0x7F79, 0xEEBF, 0x7F81, 0xEEC0, 0x7F7E, - 0xEEC1, 0x76CD, 0xEEC2, 0x76E5, 0xEEC3, 0x8832, 0xEEC4, 0x9485, - 0xEEC5, 0x9486, 0xEEC6, 0x9487, 0xEEC7, 0x948B, 0xEEC8, 0x948A, - 0xEEC9, 0x948C, 0xEECA, 0x948D, 0xEECB, 0x948F, 0xEECC, 0x9490, - 0xEECD, 0x9494, 0xEECE, 0x9497, 0xEECF, 0x9495, 0xEED0, 0x949A, - 0xEED1, 0x949B, 0xEED2, 0x949C, 0xEED3, 0x94A3, 0xEED4, 0x94A4, - 0xEED5, 0x94AB, 0xEED6, 0x94AA, 0xEED7, 0x94AD, 0xEED8, 0x94AC, - 0xEED9, 0x94AF, 0xEEDA, 0x94B0, 0xEEDB, 0x94B2, 0xEEDC, 0x94B4, - 0xEEDD, 0x94B6, 0xEEDE, 0x94B7, 0xEEDF, 0x94B8, 0xEEE0, 0x94B9, - 0xEEE1, 0x94BA, 0xEEE2, 0x94BC, 0xEEE3, 0x94BD, 0xEEE4, 0x94BF, - 0xEEE5, 0x94C4, 0xEEE6, 0x94C8, 0xEEE7, 0x94C9, 0xEEE8, 0x94CA, - 0xEEE9, 0x94CB, 0xEEEA, 0x94CC, 0xEEEB, 0x94CD, 0xEEEC, 0x94CE, - 0xEEED, 0x94D0, 0xEEEE, 0x94D1, 0xEEEF, 0x94D2, 0xEEF0, 0x94D5, - 0xEEF1, 0x94D6, 0xEEF2, 0x94D7, 0xEEF3, 0x94D9, 0xEEF4, 0x94D8, - 0xEEF5, 0x94DB, 0xEEF6, 0x94DE, 0xEEF7, 0x94DF, 0xEEF8, 0x94E0, - 0xEEF9, 0x94E2, 0xEEFA, 0x94E4, 0xEEFB, 0x94E5, 0xEEFC, 0x94E7, - 0xEEFD, 0x94E8, 0xEEFE, 0x94EA, 0xEF40, 0x986F, 0xEF41, 0x9870, - 0xEF42, 0x9871, 0xEF43, 0x9872, 0xEF44, 0x9873, 0xEF45, 0x9874, - 0xEF46, 0x988B, 0xEF47, 0x988E, 0xEF48, 0x9892, 0xEF49, 0x9895, - 0xEF4A, 0x9899, 0xEF4B, 0x98A3, 0xEF4C, 0x98A8, 0xEF4D, 0x98A9, - 0xEF4E, 0x98AA, 0xEF4F, 0x98AB, 0xEF50, 0x98AC, 0xEF51, 0x98AD, - 0xEF52, 0x98AE, 0xEF53, 0x98AF, 0xEF54, 0x98B0, 0xEF55, 0x98B1, - 0xEF56, 0x98B2, 0xEF57, 0x98B3, 0xEF58, 0x98B4, 0xEF59, 0x98B5, - 0xEF5A, 0x98B6, 0xEF5B, 0x98B7, 0xEF5C, 0x98B8, 0xEF5D, 0x98B9, - 0xEF5E, 0x98BA, 0xEF5F, 0x98BB, 0xEF60, 0x98BC, 0xEF61, 0x98BD, - 0xEF62, 0x98BE, 0xEF63, 0x98BF, 0xEF64, 0x98C0, 0xEF65, 0x98C1, - 0xEF66, 0x98C2, 0xEF67, 0x98C3, 0xEF68, 0x98C4, 0xEF69, 0x98C5, - 0xEF6A, 0x98C6, 0xEF6B, 0x98C7, 0xEF6C, 0x98C8, 0xEF6D, 0x98C9, - 0xEF6E, 0x98CA, 0xEF6F, 0x98CB, 0xEF70, 0x98CC, 0xEF71, 0x98CD, - 0xEF72, 0x98CF, 0xEF73, 0x98D0, 0xEF74, 0x98D4, 0xEF75, 0x98D6, - 0xEF76, 0x98D7, 0xEF77, 0x98DB, 0xEF78, 0x98DC, 0xEF79, 0x98DD, - 0xEF7A, 0x98E0, 0xEF7B, 0x98E1, 0xEF7C, 0x98E2, 0xEF7D, 0x98E3, - 0xEF7E, 0x98E4, 0xEF80, 0x98E5, 0xEF81, 0x98E6, 0xEF82, 0x98E9, - 0xEF83, 0x98EA, 0xEF84, 0x98EB, 0xEF85, 0x98EC, 0xEF86, 0x98ED, - 0xEF87, 0x98EE, 0xEF88, 0x98EF, 0xEF89, 0x98F0, 0xEF8A, 0x98F1, - 0xEF8B, 0x98F2, 0xEF8C, 0x98F3, 0xEF8D, 0x98F4, 0xEF8E, 0x98F5, - 0xEF8F, 0x98F6, 0xEF90, 0x98F7, 0xEF91, 0x98F8, 0xEF92, 0x98F9, - 0xEF93, 0x98FA, 0xEF94, 0x98FB, 0xEF95, 0x98FC, 0xEF96, 0x98FD, - 0xEF97, 0x98FE, 0xEF98, 0x98FF, 0xEF99, 0x9900, 0xEF9A, 0x9901, - 0xEF9B, 0x9902, 0xEF9C, 0x9903, 0xEF9D, 0x9904, 0xEF9E, 0x9905, - 0xEF9F, 0x9906, 0xEFA0, 0x9907, 0xEFA1, 0x94E9, 0xEFA2, 0x94EB, - 0xEFA3, 0x94EE, 0xEFA4, 0x94EF, 0xEFA5, 0x94F3, 0xEFA6, 0x94F4, - 0xEFA7, 0x94F5, 0xEFA8, 0x94F7, 0xEFA9, 0x94F9, 0xEFAA, 0x94FC, - 0xEFAB, 0x94FD, 0xEFAC, 0x94FF, 0xEFAD, 0x9503, 0xEFAE, 0x9502, - 0xEFAF, 0x9506, 0xEFB0, 0x9507, 0xEFB1, 0x9509, 0xEFB2, 0x950A, - 0xEFB3, 0x950D, 0xEFB4, 0x950E, 0xEFB5, 0x950F, 0xEFB6, 0x9512, - 0xEFB7, 0x9513, 0xEFB8, 0x9514, 0xEFB9, 0x9515, 0xEFBA, 0x9516, - 0xEFBB, 0x9518, 0xEFBC, 0x951B, 0xEFBD, 0x951D, 0xEFBE, 0x951E, - 0xEFBF, 0x951F, 0xEFC0, 0x9522, 0xEFC1, 0x952A, 0xEFC2, 0x952B, - 0xEFC3, 0x9529, 0xEFC4, 0x952C, 0xEFC5, 0x9531, 0xEFC6, 0x9532, - 0xEFC7, 0x9534, 0xEFC8, 0x9536, 0xEFC9, 0x9537, 0xEFCA, 0x9538, - 0xEFCB, 0x953C, 0xEFCC, 0x953E, 0xEFCD, 0x953F, 0xEFCE, 0x9542, - 0xEFCF, 0x9535, 0xEFD0, 0x9544, 0xEFD1, 0x9545, 0xEFD2, 0x9546, - 0xEFD3, 0x9549, 0xEFD4, 0x954C, 0xEFD5, 0x954E, 0xEFD6, 0x954F, - 0xEFD7, 0x9552, 0xEFD8, 0x9553, 0xEFD9, 0x9554, 0xEFDA, 0x9556, - 0xEFDB, 0x9557, 0xEFDC, 0x9558, 0xEFDD, 0x9559, 0xEFDE, 0x955B, - 0xEFDF, 0x955E, 0xEFE0, 0x955F, 0xEFE1, 0x955D, 0xEFE2, 0x9561, - 0xEFE3, 0x9562, 0xEFE4, 0x9564, 0xEFE5, 0x9565, 0xEFE6, 0x9566, - 0xEFE7, 0x9567, 0xEFE8, 0x9568, 0xEFE9, 0x9569, 0xEFEA, 0x956A, - 0xEFEB, 0x956B, 0xEFEC, 0x956C, 0xEFED, 0x956F, 0xEFEE, 0x9571, - 0xEFEF, 0x9572, 0xEFF0, 0x9573, 0xEFF1, 0x953A, 0xEFF2, 0x77E7, - 0xEFF3, 0x77EC, 0xEFF4, 0x96C9, 0xEFF5, 0x79D5, 0xEFF6, 0x79ED, - 0xEFF7, 0x79E3, 0xEFF8, 0x79EB, 0xEFF9, 0x7A06, 0xEFFA, 0x5D47, - 0xEFFB, 0x7A03, 0xEFFC, 0x7A02, 0xEFFD, 0x7A1E, 0xEFFE, 0x7A14, - 0xF040, 0x9908, 0xF041, 0x9909, 0xF042, 0x990A, 0xF043, 0x990B, - 0xF044, 0x990C, 0xF045, 0x990E, 0xF046, 0x990F, 0xF047, 0x9911, - 0xF048, 0x9912, 0xF049, 0x9913, 0xF04A, 0x9914, 0xF04B, 0x9915, - 0xF04C, 0x9916, 0xF04D, 0x9917, 0xF04E, 0x9918, 0xF04F, 0x9919, - 0xF050, 0x991A, 0xF051, 0x991B, 0xF052, 0x991C, 0xF053, 0x991D, - 0xF054, 0x991E, 0xF055, 0x991F, 0xF056, 0x9920, 0xF057, 0x9921, - 0xF058, 0x9922, 0xF059, 0x9923, 0xF05A, 0x9924, 0xF05B, 0x9925, - 0xF05C, 0x9926, 0xF05D, 0x9927, 0xF05E, 0x9928, 0xF05F, 0x9929, - 0xF060, 0x992A, 0xF061, 0x992B, 0xF062, 0x992C, 0xF063, 0x992D, - 0xF064, 0x992F, 0xF065, 0x9930, 0xF066, 0x9931, 0xF067, 0x9932, - 0xF068, 0x9933, 0xF069, 0x9934, 0xF06A, 0x9935, 0xF06B, 0x9936, - 0xF06C, 0x9937, 0xF06D, 0x9938, 0xF06E, 0x9939, 0xF06F, 0x993A, - 0xF070, 0x993B, 0xF071, 0x993C, 0xF072, 0x993D, 0xF073, 0x993E, - 0xF074, 0x993F, 0xF075, 0x9940, 0xF076, 0x9941, 0xF077, 0x9942, - 0xF078, 0x9943, 0xF079, 0x9944, 0xF07A, 0x9945, 0xF07B, 0x9946, - 0xF07C, 0x9947, 0xF07D, 0x9948, 0xF07E, 0x9949, 0xF080, 0x994A, - 0xF081, 0x994B, 0xF082, 0x994C, 0xF083, 0x994D, 0xF084, 0x994E, - 0xF085, 0x994F, 0xF086, 0x9950, 0xF087, 0x9951, 0xF088, 0x9952, - 0xF089, 0x9953, 0xF08A, 0x9956, 0xF08B, 0x9957, 0xF08C, 0x9958, - 0xF08D, 0x9959, 0xF08E, 0x995A, 0xF08F, 0x995B, 0xF090, 0x995C, - 0xF091, 0x995D, 0xF092, 0x995E, 0xF093, 0x995F, 0xF094, 0x9960, - 0xF095, 0x9961, 0xF096, 0x9962, 0xF097, 0x9964, 0xF098, 0x9966, - 0xF099, 0x9973, 0xF09A, 0x9978, 0xF09B, 0x9979, 0xF09C, 0x997B, - 0xF09D, 0x997E, 0xF09E, 0x9982, 0xF09F, 0x9983, 0xF0A0, 0x9989, - 0xF0A1, 0x7A39, 0xF0A2, 0x7A37, 0xF0A3, 0x7A51, 0xF0A4, 0x9ECF, - 0xF0A5, 0x99A5, 0xF0A6, 0x7A70, 0xF0A7, 0x7688, 0xF0A8, 0x768E, - 0xF0A9, 0x7693, 0xF0AA, 0x7699, 0xF0AB, 0x76A4, 0xF0AC, 0x74DE, - 0xF0AD, 0x74E0, 0xF0AE, 0x752C, 0xF0AF, 0x9E20, 0xF0B0, 0x9E22, - 0xF0B1, 0x9E28, 0xF0B2, 0x9E29, 0xF0B3, 0x9E2A, 0xF0B4, 0x9E2B, - 0xF0B5, 0x9E2C, 0xF0B6, 0x9E32, 0xF0B7, 0x9E31, 0xF0B8, 0x9E36, - 0xF0B9, 0x9E38, 0xF0BA, 0x9E37, 0xF0BB, 0x9E39, 0xF0BC, 0x9E3A, - 0xF0BD, 0x9E3E, 0xF0BE, 0x9E41, 0xF0BF, 0x9E42, 0xF0C0, 0x9E44, - 0xF0C1, 0x9E46, 0xF0C2, 0x9E47, 0xF0C3, 0x9E48, 0xF0C4, 0x9E49, - 0xF0C5, 0x9E4B, 0xF0C6, 0x9E4C, 0xF0C7, 0x9E4E, 0xF0C8, 0x9E51, - 0xF0C9, 0x9E55, 0xF0CA, 0x9E57, 0xF0CB, 0x9E5A, 0xF0CC, 0x9E5B, - 0xF0CD, 0x9E5C, 0xF0CE, 0x9E5E, 0xF0CF, 0x9E63, 0xF0D0, 0x9E66, - 0xF0D1, 0x9E67, 0xF0D2, 0x9E68, 0xF0D3, 0x9E69, 0xF0D4, 0x9E6A, - 0xF0D5, 0x9E6B, 0xF0D6, 0x9E6C, 0xF0D7, 0x9E71, 0xF0D8, 0x9E6D, - 0xF0D9, 0x9E73, 0xF0DA, 0x7592, 0xF0DB, 0x7594, 0xF0DC, 0x7596, - 0xF0DD, 0x75A0, 0xF0DE, 0x759D, 0xF0DF, 0x75AC, 0xF0E0, 0x75A3, - 0xF0E1, 0x75B3, 0xF0E2, 0x75B4, 0xF0E3, 0x75B8, 0xF0E4, 0x75C4, - 0xF0E5, 0x75B1, 0xF0E6, 0x75B0, 0xF0E7, 0x75C3, 0xF0E8, 0x75C2, - 0xF0E9, 0x75D6, 0xF0EA, 0x75CD, 0xF0EB, 0x75E3, 0xF0EC, 0x75E8, - 0xF0ED, 0x75E6, 0xF0EE, 0x75E4, 0xF0EF, 0x75EB, 0xF0F0, 0x75E7, - 0xF0F1, 0x7603, 0xF0F2, 0x75F1, 0xF0F3, 0x75FC, 0xF0F4, 0x75FF, - 0xF0F5, 0x7610, 0xF0F6, 0x7600, 0xF0F7, 0x7605, 0xF0F8, 0x760C, - 0xF0F9, 0x7617, 0xF0FA, 0x760A, 0xF0FB, 0x7625, 0xF0FC, 0x7618, - 0xF0FD, 0x7615, 0xF0FE, 0x7619, 0xF140, 0x998C, 0xF141, 0x998E, - 0xF142, 0x999A, 0xF143, 0x999B, 0xF144, 0x999C, 0xF145, 0x999D, - 0xF146, 0x999E, 0xF147, 0x999F, 0xF148, 0x99A0, 0xF149, 0x99A1, - 0xF14A, 0x99A2, 0xF14B, 0x99A3, 0xF14C, 0x99A4, 0xF14D, 0x99A6, - 0xF14E, 0x99A7, 0xF14F, 0x99A9, 0xF150, 0x99AA, 0xF151, 0x99AB, - 0xF152, 0x99AC, 0xF153, 0x99AD, 0xF154, 0x99AE, 0xF155, 0x99AF, - 0xF156, 0x99B0, 0xF157, 0x99B1, 0xF158, 0x99B2, 0xF159, 0x99B3, - 0xF15A, 0x99B4, 0xF15B, 0x99B5, 0xF15C, 0x99B6, 0xF15D, 0x99B7, - 0xF15E, 0x99B8, 0xF15F, 0x99B9, 0xF160, 0x99BA, 0xF161, 0x99BB, - 0xF162, 0x99BC, 0xF163, 0x99BD, 0xF164, 0x99BE, 0xF165, 0x99BF, - 0xF166, 0x99C0, 0xF167, 0x99C1, 0xF168, 0x99C2, 0xF169, 0x99C3, - 0xF16A, 0x99C4, 0xF16B, 0x99C5, 0xF16C, 0x99C6, 0xF16D, 0x99C7, - 0xF16E, 0x99C8, 0xF16F, 0x99C9, 0xF170, 0x99CA, 0xF171, 0x99CB, - 0xF172, 0x99CC, 0xF173, 0x99CD, 0xF174, 0x99CE, 0xF175, 0x99CF, - 0xF176, 0x99D0, 0xF177, 0x99D1, 0xF178, 0x99D2, 0xF179, 0x99D3, - 0xF17A, 0x99D4, 0xF17B, 0x99D5, 0xF17C, 0x99D6, 0xF17D, 0x99D7, - 0xF17E, 0x99D8, 0xF180, 0x99D9, 0xF181, 0x99DA, 0xF182, 0x99DB, - 0xF183, 0x99DC, 0xF184, 0x99DD, 0xF185, 0x99DE, 0xF186, 0x99DF, - 0xF187, 0x99E0, 0xF188, 0x99E1, 0xF189, 0x99E2, 0xF18A, 0x99E3, - 0xF18B, 0x99E4, 0xF18C, 0x99E5, 0xF18D, 0x99E6, 0xF18E, 0x99E7, - 0xF18F, 0x99E8, 0xF190, 0x99E9, 0xF191, 0x99EA, 0xF192, 0x99EB, - 0xF193, 0x99EC, 0xF194, 0x99ED, 0xF195, 0x99EE, 0xF196, 0x99EF, - 0xF197, 0x99F0, 0xF198, 0x99F1, 0xF199, 0x99F2, 0xF19A, 0x99F3, - 0xF19B, 0x99F4, 0xF19C, 0x99F5, 0xF19D, 0x99F6, 0xF19E, 0x99F7, - 0xF19F, 0x99F8, 0xF1A0, 0x99F9, 0xF1A1, 0x761B, 0xF1A2, 0x763C, - 0xF1A3, 0x7622, 0xF1A4, 0x7620, 0xF1A5, 0x7640, 0xF1A6, 0x762D, - 0xF1A7, 0x7630, 0xF1A8, 0x763F, 0xF1A9, 0x7635, 0xF1AA, 0x7643, - 0xF1AB, 0x763E, 0xF1AC, 0x7633, 0xF1AD, 0x764D, 0xF1AE, 0x765E, - 0xF1AF, 0x7654, 0xF1B0, 0x765C, 0xF1B1, 0x7656, 0xF1B2, 0x766B, - 0xF1B3, 0x766F, 0xF1B4, 0x7FCA, 0xF1B5, 0x7AE6, 0xF1B6, 0x7A78, - 0xF1B7, 0x7A79, 0xF1B8, 0x7A80, 0xF1B9, 0x7A86, 0xF1BA, 0x7A88, - 0xF1BB, 0x7A95, 0xF1BC, 0x7AA6, 0xF1BD, 0x7AA0, 0xF1BE, 0x7AAC, - 0xF1BF, 0x7AA8, 0xF1C0, 0x7AAD, 0xF1C1, 0x7AB3, 0xF1C2, 0x8864, - 0xF1C3, 0x8869, 0xF1C4, 0x8872, 0xF1C5, 0x887D, 0xF1C6, 0x887F, - 0xF1C7, 0x8882, 0xF1C8, 0x88A2, 0xF1C9, 0x88C6, 0xF1CA, 0x88B7, - 0xF1CB, 0x88BC, 0xF1CC, 0x88C9, 0xF1CD, 0x88E2, 0xF1CE, 0x88CE, - 0xF1CF, 0x88E3, 0xF1D0, 0x88E5, 0xF1D1, 0x88F1, 0xF1D2, 0x891A, - 0xF1D3, 0x88FC, 0xF1D4, 0x88E8, 0xF1D5, 0x88FE, 0xF1D6, 0x88F0, - 0xF1D7, 0x8921, 0xF1D8, 0x8919, 0xF1D9, 0x8913, 0xF1DA, 0x891B, - 0xF1DB, 0x890A, 0xF1DC, 0x8934, 0xF1DD, 0x892B, 0xF1DE, 0x8936, - 0xF1DF, 0x8941, 0xF1E0, 0x8966, 0xF1E1, 0x897B, 0xF1E2, 0x758B, - 0xF1E3, 0x80E5, 0xF1E4, 0x76B2, 0xF1E5, 0x76B4, 0xF1E6, 0x77DC, - 0xF1E7, 0x8012, 0xF1E8, 0x8014, 0xF1E9, 0x8016, 0xF1EA, 0x801C, - 0xF1EB, 0x8020, 0xF1EC, 0x8022, 0xF1ED, 0x8025, 0xF1EE, 0x8026, - 0xF1EF, 0x8027, 0xF1F0, 0x8029, 0xF1F1, 0x8028, 0xF1F2, 0x8031, - 0xF1F3, 0x800B, 0xF1F4, 0x8035, 0xF1F5, 0x8043, 0xF1F6, 0x8046, - 0xF1F7, 0x804D, 0xF1F8, 0x8052, 0xF1F9, 0x8069, 0xF1FA, 0x8071, - 0xF1FB, 0x8983, 0xF1FC, 0x9878, 0xF1FD, 0x9880, 0xF1FE, 0x9883, - 0xF240, 0x99FA, 0xF241, 0x99FB, 0xF242, 0x99FC, 0xF243, 0x99FD, - 0xF244, 0x99FE, 0xF245, 0x99FF, 0xF246, 0x9A00, 0xF247, 0x9A01, - 0xF248, 0x9A02, 0xF249, 0x9A03, 0xF24A, 0x9A04, 0xF24B, 0x9A05, - 0xF24C, 0x9A06, 0xF24D, 0x9A07, 0xF24E, 0x9A08, 0xF24F, 0x9A09, - 0xF250, 0x9A0A, 0xF251, 0x9A0B, 0xF252, 0x9A0C, 0xF253, 0x9A0D, - 0xF254, 0x9A0E, 0xF255, 0x9A0F, 0xF256, 0x9A10, 0xF257, 0x9A11, - 0xF258, 0x9A12, 0xF259, 0x9A13, 0xF25A, 0x9A14, 0xF25B, 0x9A15, - 0xF25C, 0x9A16, 0xF25D, 0x9A17, 0xF25E, 0x9A18, 0xF25F, 0x9A19, - 0xF260, 0x9A1A, 0xF261, 0x9A1B, 0xF262, 0x9A1C, 0xF263, 0x9A1D, - 0xF264, 0x9A1E, 0xF265, 0x9A1F, 0xF266, 0x9A20, 0xF267, 0x9A21, - 0xF268, 0x9A22, 0xF269, 0x9A23, 0xF26A, 0x9A24, 0xF26B, 0x9A25, - 0xF26C, 0x9A26, 0xF26D, 0x9A27, 0xF26E, 0x9A28, 0xF26F, 0x9A29, - 0xF270, 0x9A2A, 0xF271, 0x9A2B, 0xF272, 0x9A2C, 0xF273, 0x9A2D, - 0xF274, 0x9A2E, 0xF275, 0x9A2F, 0xF276, 0x9A30, 0xF277, 0x9A31, - 0xF278, 0x9A32, 0xF279, 0x9A33, 0xF27A, 0x9A34, 0xF27B, 0x9A35, - 0xF27C, 0x9A36, 0xF27D, 0x9A37, 0xF27E, 0x9A38, 0xF280, 0x9A39, - 0xF281, 0x9A3A, 0xF282, 0x9A3B, 0xF283, 0x9A3C, 0xF284, 0x9A3D, - 0xF285, 0x9A3E, 0xF286, 0x9A3F, 0xF287, 0x9A40, 0xF288, 0x9A41, - 0xF289, 0x9A42, 0xF28A, 0x9A43, 0xF28B, 0x9A44, 0xF28C, 0x9A45, - 0xF28D, 0x9A46, 0xF28E, 0x9A47, 0xF28F, 0x9A48, 0xF290, 0x9A49, - 0xF291, 0x9A4A, 0xF292, 0x9A4B, 0xF293, 0x9A4C, 0xF294, 0x9A4D, - 0xF295, 0x9A4E, 0xF296, 0x9A4F, 0xF297, 0x9A50, 0xF298, 0x9A51, - 0xF299, 0x9A52, 0xF29A, 0x9A53, 0xF29B, 0x9A54, 0xF29C, 0x9A55, - 0xF29D, 0x9A56, 0xF29E, 0x9A57, 0xF29F, 0x9A58, 0xF2A0, 0x9A59, - 0xF2A1, 0x9889, 0xF2A2, 0x988C, 0xF2A3, 0x988D, 0xF2A4, 0x988F, - 0xF2A5, 0x9894, 0xF2A6, 0x989A, 0xF2A7, 0x989B, 0xF2A8, 0x989E, - 0xF2A9, 0x989F, 0xF2AA, 0x98A1, 0xF2AB, 0x98A2, 0xF2AC, 0x98A5, - 0xF2AD, 0x98A6, 0xF2AE, 0x864D, 0xF2AF, 0x8654, 0xF2B0, 0x866C, - 0xF2B1, 0x866E, 0xF2B2, 0x867F, 0xF2B3, 0x867A, 0xF2B4, 0x867C, - 0xF2B5, 0x867B, 0xF2B6, 0x86A8, 0xF2B7, 0x868D, 0xF2B8, 0x868B, - 0xF2B9, 0x86AC, 0xF2BA, 0x869D, 0xF2BB, 0x86A7, 0xF2BC, 0x86A3, - 0xF2BD, 0x86AA, 0xF2BE, 0x8693, 0xF2BF, 0x86A9, 0xF2C0, 0x86B6, - 0xF2C1, 0x86C4, 0xF2C2, 0x86B5, 0xF2C3, 0x86CE, 0xF2C4, 0x86B0, - 0xF2C5, 0x86BA, 0xF2C6, 0x86B1, 0xF2C7, 0x86AF, 0xF2C8, 0x86C9, - 0xF2C9, 0x86CF, 0xF2CA, 0x86B4, 0xF2CB, 0x86E9, 0xF2CC, 0x86F1, - 0xF2CD, 0x86F2, 0xF2CE, 0x86ED, 0xF2CF, 0x86F3, 0xF2D0, 0x86D0, - 0xF2D1, 0x8713, 0xF2D2, 0x86DE, 0xF2D3, 0x86F4, 0xF2D4, 0x86DF, - 0xF2D5, 0x86D8, 0xF2D6, 0x86D1, 0xF2D7, 0x8703, 0xF2D8, 0x8707, - 0xF2D9, 0x86F8, 0xF2DA, 0x8708, 0xF2DB, 0x870A, 0xF2DC, 0x870D, - 0xF2DD, 0x8709, 0xF2DE, 0x8723, 0xF2DF, 0x873B, 0xF2E0, 0x871E, - 0xF2E1, 0x8725, 0xF2E2, 0x872E, 0xF2E3, 0x871A, 0xF2E4, 0x873E, - 0xF2E5, 0x8748, 0xF2E6, 0x8734, 0xF2E7, 0x8731, 0xF2E8, 0x8729, - 0xF2E9, 0x8737, 0xF2EA, 0x873F, 0xF2EB, 0x8782, 0xF2EC, 0x8722, - 0xF2ED, 0x877D, 0xF2EE, 0x877E, 0xF2EF, 0x877B, 0xF2F0, 0x8760, - 0xF2F1, 0x8770, 0xF2F2, 0x874C, 0xF2F3, 0x876E, 0xF2F4, 0x878B, - 0xF2F5, 0x8753, 0xF2F6, 0x8763, 0xF2F7, 0x877C, 0xF2F8, 0x8764, - 0xF2F9, 0x8759, 0xF2FA, 0x8765, 0xF2FB, 0x8793, 0xF2FC, 0x87AF, - 0xF2FD, 0x87A8, 0xF2FE, 0x87D2, 0xF340, 0x9A5A, 0xF341, 0x9A5B, - 0xF342, 0x9A5C, 0xF343, 0x9A5D, 0xF344, 0x9A5E, 0xF345, 0x9A5F, - 0xF346, 0x9A60, 0xF347, 0x9A61, 0xF348, 0x9A62, 0xF349, 0x9A63, - 0xF34A, 0x9A64, 0xF34B, 0x9A65, 0xF34C, 0x9A66, 0xF34D, 0x9A67, - 0xF34E, 0x9A68, 0xF34F, 0x9A69, 0xF350, 0x9A6A, 0xF351, 0x9A6B, - 0xF352, 0x9A72, 0xF353, 0x9A83, 0xF354, 0x9A89, 0xF355, 0x9A8D, - 0xF356, 0x9A8E, 0xF357, 0x9A94, 0xF358, 0x9A95, 0xF359, 0x9A99, - 0xF35A, 0x9AA6, 0xF35B, 0x9AA9, 0xF35C, 0x9AAA, 0xF35D, 0x9AAB, - 0xF35E, 0x9AAC, 0xF35F, 0x9AAD, 0xF360, 0x9AAE, 0xF361, 0x9AAF, - 0xF362, 0x9AB2, 0xF363, 0x9AB3, 0xF364, 0x9AB4, 0xF365, 0x9AB5, - 0xF366, 0x9AB9, 0xF367, 0x9ABB, 0xF368, 0x9ABD, 0xF369, 0x9ABE, - 0xF36A, 0x9ABF, 0xF36B, 0x9AC3, 0xF36C, 0x9AC4, 0xF36D, 0x9AC6, - 0xF36E, 0x9AC7, 0xF36F, 0x9AC8, 0xF370, 0x9AC9, 0xF371, 0x9ACA, - 0xF372, 0x9ACD, 0xF373, 0x9ACE, 0xF374, 0x9ACF, 0xF375, 0x9AD0, - 0xF376, 0x9AD2, 0xF377, 0x9AD4, 0xF378, 0x9AD5, 0xF379, 0x9AD6, - 0xF37A, 0x9AD7, 0xF37B, 0x9AD9, 0xF37C, 0x9ADA, 0xF37D, 0x9ADB, - 0xF37E, 0x9ADC, 0xF380, 0x9ADD, 0xF381, 0x9ADE, 0xF382, 0x9AE0, - 0xF383, 0x9AE2, 0xF384, 0x9AE3, 0xF385, 0x9AE4, 0xF386, 0x9AE5, - 0xF387, 0x9AE7, 0xF388, 0x9AE8, 0xF389, 0x9AE9, 0xF38A, 0x9AEA, - 0xF38B, 0x9AEC, 0xF38C, 0x9AEE, 0xF38D, 0x9AF0, 0xF38E, 0x9AF1, - 0xF38F, 0x9AF2, 0xF390, 0x9AF3, 0xF391, 0x9AF4, 0xF392, 0x9AF5, - 0xF393, 0x9AF6, 0xF394, 0x9AF7, 0xF395, 0x9AF8, 0xF396, 0x9AFA, - 0xF397, 0x9AFC, 0xF398, 0x9AFD, 0xF399, 0x9AFE, 0xF39A, 0x9AFF, - 0xF39B, 0x9B00, 0xF39C, 0x9B01, 0xF39D, 0x9B02, 0xF39E, 0x9B04, - 0xF39F, 0x9B05, 0xF3A0, 0x9B06, 0xF3A1, 0x87C6, 0xF3A2, 0x8788, - 0xF3A3, 0x8785, 0xF3A4, 0x87AD, 0xF3A5, 0x8797, 0xF3A6, 0x8783, - 0xF3A7, 0x87AB, 0xF3A8, 0x87E5, 0xF3A9, 0x87AC, 0xF3AA, 0x87B5, - 0xF3AB, 0x87B3, 0xF3AC, 0x87CB, 0xF3AD, 0x87D3, 0xF3AE, 0x87BD, - 0xF3AF, 0x87D1, 0xF3B0, 0x87C0, 0xF3B1, 0x87CA, 0xF3B2, 0x87DB, - 0xF3B3, 0x87EA, 0xF3B4, 0x87E0, 0xF3B5, 0x87EE, 0xF3B6, 0x8816, - 0xF3B7, 0x8813, 0xF3B8, 0x87FE, 0xF3B9, 0x880A, 0xF3BA, 0x881B, - 0xF3BB, 0x8821, 0xF3BC, 0x8839, 0xF3BD, 0x883C, 0xF3BE, 0x7F36, - 0xF3BF, 0x7F42, 0xF3C0, 0x7F44, 0xF3C1, 0x7F45, 0xF3C2, 0x8210, - 0xF3C3, 0x7AFA, 0xF3C4, 0x7AFD, 0xF3C5, 0x7B08, 0xF3C6, 0x7B03, - 0xF3C7, 0x7B04, 0xF3C8, 0x7B15, 0xF3C9, 0x7B0A, 0xF3CA, 0x7B2B, - 0xF3CB, 0x7B0F, 0xF3CC, 0x7B47, 0xF3CD, 0x7B38, 0xF3CE, 0x7B2A, - 0xF3CF, 0x7B19, 0xF3D0, 0x7B2E, 0xF3D1, 0x7B31, 0xF3D2, 0x7B20, - 0xF3D3, 0x7B25, 0xF3D4, 0x7B24, 0xF3D5, 0x7B33, 0xF3D6, 0x7B3E, - 0xF3D7, 0x7B1E, 0xF3D8, 0x7B58, 0xF3D9, 0x7B5A, 0xF3DA, 0x7B45, - 0xF3DB, 0x7B75, 0xF3DC, 0x7B4C, 0xF3DD, 0x7B5D, 0xF3DE, 0x7B60, - 0xF3DF, 0x7B6E, 0xF3E0, 0x7B7B, 0xF3E1, 0x7B62, 0xF3E2, 0x7B72, - 0xF3E3, 0x7B71, 0xF3E4, 0x7B90, 0xF3E5, 0x7BA6, 0xF3E6, 0x7BA7, - 0xF3E7, 0x7BB8, 0xF3E8, 0x7BAC, 0xF3E9, 0x7B9D, 0xF3EA, 0x7BA8, - 0xF3EB, 0x7B85, 0xF3EC, 0x7BAA, 0xF3ED, 0x7B9C, 0xF3EE, 0x7BA2, - 0xF3EF, 0x7BAB, 0xF3F0, 0x7BB4, 0xF3F1, 0x7BD1, 0xF3F2, 0x7BC1, - 0xF3F3, 0x7BCC, 0xF3F4, 0x7BDD, 0xF3F5, 0x7BDA, 0xF3F6, 0x7BE5, - 0xF3F7, 0x7BE6, 0xF3F8, 0x7BEA, 0xF3F9, 0x7C0C, 0xF3FA, 0x7BFE, - 0xF3FB, 0x7BFC, 0xF3FC, 0x7C0F, 0xF3FD, 0x7C16, 0xF3FE, 0x7C0B, - 0xF440, 0x9B07, 0xF441, 0x9B09, 0xF442, 0x9B0A, 0xF443, 0x9B0B, - 0xF444, 0x9B0C, 0xF445, 0x9B0D, 0xF446, 0x9B0E, 0xF447, 0x9B10, - 0xF448, 0x9B11, 0xF449, 0x9B12, 0xF44A, 0x9B14, 0xF44B, 0x9B15, - 0xF44C, 0x9B16, 0xF44D, 0x9B17, 0xF44E, 0x9B18, 0xF44F, 0x9B19, - 0xF450, 0x9B1A, 0xF451, 0x9B1B, 0xF452, 0x9B1C, 0xF453, 0x9B1D, - 0xF454, 0x9B1E, 0xF455, 0x9B20, 0xF456, 0x9B21, 0xF457, 0x9B22, - 0xF458, 0x9B24, 0xF459, 0x9B25, 0xF45A, 0x9B26, 0xF45B, 0x9B27, - 0xF45C, 0x9B28, 0xF45D, 0x9B29, 0xF45E, 0x9B2A, 0xF45F, 0x9B2B, - 0xF460, 0x9B2C, 0xF461, 0x9B2D, 0xF462, 0x9B2E, 0xF463, 0x9B30, - 0xF464, 0x9B31, 0xF465, 0x9B33, 0xF466, 0x9B34, 0xF467, 0x9B35, - 0xF468, 0x9B36, 0xF469, 0x9B37, 0xF46A, 0x9B38, 0xF46B, 0x9B39, - 0xF46C, 0x9B3A, 0xF46D, 0x9B3D, 0xF46E, 0x9B3E, 0xF46F, 0x9B3F, - 0xF470, 0x9B40, 0xF471, 0x9B46, 0xF472, 0x9B4A, 0xF473, 0x9B4B, - 0xF474, 0x9B4C, 0xF475, 0x9B4E, 0xF476, 0x9B50, 0xF477, 0x9B52, - 0xF478, 0x9B53, 0xF479, 0x9B55, 0xF47A, 0x9B56, 0xF47B, 0x9B57, - 0xF47C, 0x9B58, 0xF47D, 0x9B59, 0xF47E, 0x9B5A, 0xF480, 0x9B5B, - 0xF481, 0x9B5C, 0xF482, 0x9B5D, 0xF483, 0x9B5E, 0xF484, 0x9B5F, - 0xF485, 0x9B60, 0xF486, 0x9B61, 0xF487, 0x9B62, 0xF488, 0x9B63, - 0xF489, 0x9B64, 0xF48A, 0x9B65, 0xF48B, 0x9B66, 0xF48C, 0x9B67, - 0xF48D, 0x9B68, 0xF48E, 0x9B69, 0xF48F, 0x9B6A, 0xF490, 0x9B6B, - 0xF491, 0x9B6C, 0xF492, 0x9B6D, 0xF493, 0x9B6E, 0xF494, 0x9B6F, - 0xF495, 0x9B70, 0xF496, 0x9B71, 0xF497, 0x9B72, 0xF498, 0x9B73, - 0xF499, 0x9B74, 0xF49A, 0x9B75, 0xF49B, 0x9B76, 0xF49C, 0x9B77, - 0xF49D, 0x9B78, 0xF49E, 0x9B79, 0xF49F, 0x9B7A, 0xF4A0, 0x9B7B, - 0xF4A1, 0x7C1F, 0xF4A2, 0x7C2A, 0xF4A3, 0x7C26, 0xF4A4, 0x7C38, - 0xF4A5, 0x7C41, 0xF4A6, 0x7C40, 0xF4A7, 0x81FE, 0xF4A8, 0x8201, - 0xF4A9, 0x8202, 0xF4AA, 0x8204, 0xF4AB, 0x81EC, 0xF4AC, 0x8844, - 0xF4AD, 0x8221, 0xF4AE, 0x8222, 0xF4AF, 0x8223, 0xF4B0, 0x822D, - 0xF4B1, 0x822F, 0xF4B2, 0x8228, 0xF4B3, 0x822B, 0xF4B4, 0x8238, - 0xF4B5, 0x823B, 0xF4B6, 0x8233, 0xF4B7, 0x8234, 0xF4B8, 0x823E, - 0xF4B9, 0x8244, 0xF4BA, 0x8249, 0xF4BB, 0x824B, 0xF4BC, 0x824F, - 0xF4BD, 0x825A, 0xF4BE, 0x825F, 0xF4BF, 0x8268, 0xF4C0, 0x887E, - 0xF4C1, 0x8885, 0xF4C2, 0x8888, 0xF4C3, 0x88D8, 0xF4C4, 0x88DF, - 0xF4C5, 0x895E, 0xF4C6, 0x7F9D, 0xF4C7, 0x7F9F, 0xF4C8, 0x7FA7, - 0xF4C9, 0x7FAF, 0xF4CA, 0x7FB0, 0xF4CB, 0x7FB2, 0xF4CC, 0x7C7C, - 0xF4CD, 0x6549, 0xF4CE, 0x7C91, 0xF4CF, 0x7C9D, 0xF4D0, 0x7C9C, - 0xF4D1, 0x7C9E, 0xF4D2, 0x7CA2, 0xF4D3, 0x7CB2, 0xF4D4, 0x7CBC, - 0xF4D5, 0x7CBD, 0xF4D6, 0x7CC1, 0xF4D7, 0x7CC7, 0xF4D8, 0x7CCC, - 0xF4D9, 0x7CCD, 0xF4DA, 0x7CC8, 0xF4DB, 0x7CC5, 0xF4DC, 0x7CD7, - 0xF4DD, 0x7CE8, 0xF4DE, 0x826E, 0xF4DF, 0x66A8, 0xF4E0, 0x7FBF, - 0xF4E1, 0x7FCE, 0xF4E2, 0x7FD5, 0xF4E3, 0x7FE5, 0xF4E4, 0x7FE1, - 0xF4E5, 0x7FE6, 0xF4E6, 0x7FE9, 0xF4E7, 0x7FEE, 0xF4E8, 0x7FF3, - 0xF4E9, 0x7CF8, 0xF4EA, 0x7D77, 0xF4EB, 0x7DA6, 0xF4EC, 0x7DAE, - 0xF4ED, 0x7E47, 0xF4EE, 0x7E9B, 0xF4EF, 0x9EB8, 0xF4F0, 0x9EB4, - 0xF4F1, 0x8D73, 0xF4F2, 0x8D84, 0xF4F3, 0x8D94, 0xF4F4, 0x8D91, - 0xF4F5, 0x8DB1, 0xF4F6, 0x8D67, 0xF4F7, 0x8D6D, 0xF4F8, 0x8C47, - 0xF4F9, 0x8C49, 0xF4FA, 0x914A, 0xF4FB, 0x9150, 0xF4FC, 0x914E, - 0xF4FD, 0x914F, 0xF4FE, 0x9164, 0xF540, 0x9B7C, 0xF541, 0x9B7D, - 0xF542, 0x9B7E, 0xF543, 0x9B7F, 0xF544, 0x9B80, 0xF545, 0x9B81, - 0xF546, 0x9B82, 0xF547, 0x9B83, 0xF548, 0x9B84, 0xF549, 0x9B85, - 0xF54A, 0x9B86, 0xF54B, 0x9B87, 0xF54C, 0x9B88, 0xF54D, 0x9B89, - 0xF54E, 0x9B8A, 0xF54F, 0x9B8B, 0xF550, 0x9B8C, 0xF551, 0x9B8D, - 0xF552, 0x9B8E, 0xF553, 0x9B8F, 0xF554, 0x9B90, 0xF555, 0x9B91, - 0xF556, 0x9B92, 0xF557, 0x9B93, 0xF558, 0x9B94, 0xF559, 0x9B95, - 0xF55A, 0x9B96, 0xF55B, 0x9B97, 0xF55C, 0x9B98, 0xF55D, 0x9B99, - 0xF55E, 0x9B9A, 0xF55F, 0x9B9B, 0xF560, 0x9B9C, 0xF561, 0x9B9D, - 0xF562, 0x9B9E, 0xF563, 0x9B9F, 0xF564, 0x9BA0, 0xF565, 0x9BA1, - 0xF566, 0x9BA2, 0xF567, 0x9BA3, 0xF568, 0x9BA4, 0xF569, 0x9BA5, - 0xF56A, 0x9BA6, 0xF56B, 0x9BA7, 0xF56C, 0x9BA8, 0xF56D, 0x9BA9, - 0xF56E, 0x9BAA, 0xF56F, 0x9BAB, 0xF570, 0x9BAC, 0xF571, 0x9BAD, - 0xF572, 0x9BAE, 0xF573, 0x9BAF, 0xF574, 0x9BB0, 0xF575, 0x9BB1, - 0xF576, 0x9BB2, 0xF577, 0x9BB3, 0xF578, 0x9BB4, 0xF579, 0x9BB5, - 0xF57A, 0x9BB6, 0xF57B, 0x9BB7, 0xF57C, 0x9BB8, 0xF57D, 0x9BB9, - 0xF57E, 0x9BBA, 0xF580, 0x9BBB, 0xF581, 0x9BBC, 0xF582, 0x9BBD, - 0xF583, 0x9BBE, 0xF584, 0x9BBF, 0xF585, 0x9BC0, 0xF586, 0x9BC1, - 0xF587, 0x9BC2, 0xF588, 0x9BC3, 0xF589, 0x9BC4, 0xF58A, 0x9BC5, - 0xF58B, 0x9BC6, 0xF58C, 0x9BC7, 0xF58D, 0x9BC8, 0xF58E, 0x9BC9, - 0xF58F, 0x9BCA, 0xF590, 0x9BCB, 0xF591, 0x9BCC, 0xF592, 0x9BCD, - 0xF593, 0x9BCE, 0xF594, 0x9BCF, 0xF595, 0x9BD0, 0xF596, 0x9BD1, - 0xF597, 0x9BD2, 0xF598, 0x9BD3, 0xF599, 0x9BD4, 0xF59A, 0x9BD5, - 0xF59B, 0x9BD6, 0xF59C, 0x9BD7, 0xF59D, 0x9BD8, 0xF59E, 0x9BD9, - 0xF59F, 0x9BDA, 0xF5A0, 0x9BDB, 0xF5A1, 0x9162, 0xF5A2, 0x9161, - 0xF5A3, 0x9170, 0xF5A4, 0x9169, 0xF5A5, 0x916F, 0xF5A6, 0x917D, - 0xF5A7, 0x917E, 0xF5A8, 0x9172, 0xF5A9, 0x9174, 0xF5AA, 0x9179, - 0xF5AB, 0x918C, 0xF5AC, 0x9185, 0xF5AD, 0x9190, 0xF5AE, 0x918D, - 0xF5AF, 0x9191, 0xF5B0, 0x91A2, 0xF5B1, 0x91A3, 0xF5B2, 0x91AA, - 0xF5B3, 0x91AD, 0xF5B4, 0x91AE, 0xF5B5, 0x91AF, 0xF5B6, 0x91B5, - 0xF5B7, 0x91B4, 0xF5B8, 0x91BA, 0xF5B9, 0x8C55, 0xF5BA, 0x9E7E, - 0xF5BB, 0x8DB8, 0xF5BC, 0x8DEB, 0xF5BD, 0x8E05, 0xF5BE, 0x8E59, - 0xF5BF, 0x8E69, 0xF5C0, 0x8DB5, 0xF5C1, 0x8DBF, 0xF5C2, 0x8DBC, - 0xF5C3, 0x8DBA, 0xF5C4, 0x8DC4, 0xF5C5, 0x8DD6, 0xF5C6, 0x8DD7, - 0xF5C7, 0x8DDA, 0xF5C8, 0x8DDE, 0xF5C9, 0x8DCE, 0xF5CA, 0x8DCF, - 0xF5CB, 0x8DDB, 0xF5CC, 0x8DC6, 0xF5CD, 0x8DEC, 0xF5CE, 0x8DF7, - 0xF5CF, 0x8DF8, 0xF5D0, 0x8DE3, 0xF5D1, 0x8DF9, 0xF5D2, 0x8DFB, - 0xF5D3, 0x8DE4, 0xF5D4, 0x8E09, 0xF5D5, 0x8DFD, 0xF5D6, 0x8E14, - 0xF5D7, 0x8E1D, 0xF5D8, 0x8E1F, 0xF5D9, 0x8E2C, 0xF5DA, 0x8E2E, - 0xF5DB, 0x8E23, 0xF5DC, 0x8E2F, 0xF5DD, 0x8E3A, 0xF5DE, 0x8E40, - 0xF5DF, 0x8E39, 0xF5E0, 0x8E35, 0xF5E1, 0x8E3D, 0xF5E2, 0x8E31, - 0xF5E3, 0x8E49, 0xF5E4, 0x8E41, 0xF5E5, 0x8E42, 0xF5E6, 0x8E51, - 0xF5E7, 0x8E52, 0xF5E8, 0x8E4A, 0xF5E9, 0x8E70, 0xF5EA, 0x8E76, - 0xF5EB, 0x8E7C, 0xF5EC, 0x8E6F, 0xF5ED, 0x8E74, 0xF5EE, 0x8E85, - 0xF5EF, 0x8E8F, 0xF5F0, 0x8E94, 0xF5F1, 0x8E90, 0xF5F2, 0x8E9C, - 0xF5F3, 0x8E9E, 0xF5F4, 0x8C78, 0xF5F5, 0x8C82, 0xF5F6, 0x8C8A, - 0xF5F7, 0x8C85, 0xF5F8, 0x8C98, 0xF5F9, 0x8C94, 0xF5FA, 0x659B, - 0xF5FB, 0x89D6, 0xF5FC, 0x89DE, 0xF5FD, 0x89DA, 0xF5FE, 0x89DC, - 0xF640, 0x9BDC, 0xF641, 0x9BDD, 0xF642, 0x9BDE, 0xF643, 0x9BDF, - 0xF644, 0x9BE0, 0xF645, 0x9BE1, 0xF646, 0x9BE2, 0xF647, 0x9BE3, - 0xF648, 0x9BE4, 0xF649, 0x9BE5, 0xF64A, 0x9BE6, 0xF64B, 0x9BE7, - 0xF64C, 0x9BE8, 0xF64D, 0x9BE9, 0xF64E, 0x9BEA, 0xF64F, 0x9BEB, - 0xF650, 0x9BEC, 0xF651, 0x9BED, 0xF652, 0x9BEE, 0xF653, 0x9BEF, - 0xF654, 0x9BF0, 0xF655, 0x9BF1, 0xF656, 0x9BF2, 0xF657, 0x9BF3, - 0xF658, 0x9BF4, 0xF659, 0x9BF5, 0xF65A, 0x9BF6, 0xF65B, 0x9BF7, - 0xF65C, 0x9BF8, 0xF65D, 0x9BF9, 0xF65E, 0x9BFA, 0xF65F, 0x9BFB, - 0xF660, 0x9BFC, 0xF661, 0x9BFD, 0xF662, 0x9BFE, 0xF663, 0x9BFF, - 0xF664, 0x9C00, 0xF665, 0x9C01, 0xF666, 0x9C02, 0xF667, 0x9C03, - 0xF668, 0x9C04, 0xF669, 0x9C05, 0xF66A, 0x9C06, 0xF66B, 0x9C07, - 0xF66C, 0x9C08, 0xF66D, 0x9C09, 0xF66E, 0x9C0A, 0xF66F, 0x9C0B, - 0xF670, 0x9C0C, 0xF671, 0x9C0D, 0xF672, 0x9C0E, 0xF673, 0x9C0F, - 0xF674, 0x9C10, 0xF675, 0x9C11, 0xF676, 0x9C12, 0xF677, 0x9C13, - 0xF678, 0x9C14, 0xF679, 0x9C15, 0xF67A, 0x9C16, 0xF67B, 0x9C17, - 0xF67C, 0x9C18, 0xF67D, 0x9C19, 0xF67E, 0x9C1A, 0xF680, 0x9C1B, - 0xF681, 0x9C1C, 0xF682, 0x9C1D, 0xF683, 0x9C1E, 0xF684, 0x9C1F, - 0xF685, 0x9C20, 0xF686, 0x9C21, 0xF687, 0x9C22, 0xF688, 0x9C23, - 0xF689, 0x9C24, 0xF68A, 0x9C25, 0xF68B, 0x9C26, 0xF68C, 0x9C27, - 0xF68D, 0x9C28, 0xF68E, 0x9C29, 0xF68F, 0x9C2A, 0xF690, 0x9C2B, - 0xF691, 0x9C2C, 0xF692, 0x9C2D, 0xF693, 0x9C2E, 0xF694, 0x9C2F, - 0xF695, 0x9C30, 0xF696, 0x9C31, 0xF697, 0x9C32, 0xF698, 0x9C33, - 0xF699, 0x9C34, 0xF69A, 0x9C35, 0xF69B, 0x9C36, 0xF69C, 0x9C37, - 0xF69D, 0x9C38, 0xF69E, 0x9C39, 0xF69F, 0x9C3A, 0xF6A0, 0x9C3B, - 0xF6A1, 0x89E5, 0xF6A2, 0x89EB, 0xF6A3, 0x89EF, 0xF6A4, 0x8A3E, - 0xF6A5, 0x8B26, 0xF6A6, 0x9753, 0xF6A7, 0x96E9, 0xF6A8, 0x96F3, - 0xF6A9, 0x96EF, 0xF6AA, 0x9706, 0xF6AB, 0x9701, 0xF6AC, 0x9708, - 0xF6AD, 0x970F, 0xF6AE, 0x970E, 0xF6AF, 0x972A, 0xF6B0, 0x972D, - 0xF6B1, 0x9730, 0xF6B2, 0x973E, 0xF6B3, 0x9F80, 0xF6B4, 0x9F83, - 0xF6B5, 0x9F85, 0xF6B6, 0x9F86, 0xF6B7, 0x9F87, 0xF6B8, 0x9F88, - 0xF6B9, 0x9F89, 0xF6BA, 0x9F8A, 0xF6BB, 0x9F8C, 0xF6BC, 0x9EFE, - 0xF6BD, 0x9F0B, 0xF6BE, 0x9F0D, 0xF6BF, 0x96B9, 0xF6C0, 0x96BC, - 0xF6C1, 0x96BD, 0xF6C2, 0x96CE, 0xF6C3, 0x96D2, 0xF6C4, 0x77BF, - 0xF6C5, 0x96E0, 0xF6C6, 0x928E, 0xF6C7, 0x92AE, 0xF6C8, 0x92C8, - 0xF6C9, 0x933E, 0xF6CA, 0x936A, 0xF6CB, 0x93CA, 0xF6CC, 0x938F, - 0xF6CD, 0x943E, 0xF6CE, 0x946B, 0xF6CF, 0x9C7F, 0xF6D0, 0x9C82, - 0xF6D1, 0x9C85, 0xF6D2, 0x9C86, 0xF6D3, 0x9C87, 0xF6D4, 0x9C88, - 0xF6D5, 0x7A23, 0xF6D6, 0x9C8B, 0xF6D7, 0x9C8E, 0xF6D8, 0x9C90, - 0xF6D9, 0x9C91, 0xF6DA, 0x9C92, 0xF6DB, 0x9C94, 0xF6DC, 0x9C95, - 0xF6DD, 0x9C9A, 0xF6DE, 0x9C9B, 0xF6DF, 0x9C9E, 0xF6E0, 0x9C9F, - 0xF6E1, 0x9CA0, 0xF6E2, 0x9CA1, 0xF6E3, 0x9CA2, 0xF6E4, 0x9CA3, - 0xF6E5, 0x9CA5, 0xF6E6, 0x9CA6, 0xF6E7, 0x9CA7, 0xF6E8, 0x9CA8, - 0xF6E9, 0x9CA9, 0xF6EA, 0x9CAB, 0xF6EB, 0x9CAD, 0xF6EC, 0x9CAE, - 0xF6ED, 0x9CB0, 0xF6EE, 0x9CB1, 0xF6EF, 0x9CB2, 0xF6F0, 0x9CB3, - 0xF6F1, 0x9CB4, 0xF6F2, 0x9CB5, 0xF6F3, 0x9CB6, 0xF6F4, 0x9CB7, - 0xF6F5, 0x9CBA, 0xF6F6, 0x9CBB, 0xF6F7, 0x9CBC, 0xF6F8, 0x9CBD, - 0xF6F9, 0x9CC4, 0xF6FA, 0x9CC5, 0xF6FB, 0x9CC6, 0xF6FC, 0x9CC7, - 0xF6FD, 0x9CCA, 0xF6FE, 0x9CCB, 0xF740, 0x9C3C, 0xF741, 0x9C3D, - 0xF742, 0x9C3E, 0xF743, 0x9C3F, 0xF744, 0x9C40, 0xF745, 0x9C41, - 0xF746, 0x9C42, 0xF747, 0x9C43, 0xF748, 0x9C44, 0xF749, 0x9C45, - 0xF74A, 0x9C46, 0xF74B, 0x9C47, 0xF74C, 0x9C48, 0xF74D, 0x9C49, - 0xF74E, 0x9C4A, 0xF74F, 0x9C4B, 0xF750, 0x9C4C, 0xF751, 0x9C4D, - 0xF752, 0x9C4E, 0xF753, 0x9C4F, 0xF754, 0x9C50, 0xF755, 0x9C51, - 0xF756, 0x9C52, 0xF757, 0x9C53, 0xF758, 0x9C54, 0xF759, 0x9C55, - 0xF75A, 0x9C56, 0xF75B, 0x9C57, 0xF75C, 0x9C58, 0xF75D, 0x9C59, - 0xF75E, 0x9C5A, 0xF75F, 0x9C5B, 0xF760, 0x9C5C, 0xF761, 0x9C5D, - 0xF762, 0x9C5E, 0xF763, 0x9C5F, 0xF764, 0x9C60, 0xF765, 0x9C61, - 0xF766, 0x9C62, 0xF767, 0x9C63, 0xF768, 0x9C64, 0xF769, 0x9C65, - 0xF76A, 0x9C66, 0xF76B, 0x9C67, 0xF76C, 0x9C68, 0xF76D, 0x9C69, - 0xF76E, 0x9C6A, 0xF76F, 0x9C6B, 0xF770, 0x9C6C, 0xF771, 0x9C6D, - 0xF772, 0x9C6E, 0xF773, 0x9C6F, 0xF774, 0x9C70, 0xF775, 0x9C71, - 0xF776, 0x9C72, 0xF777, 0x9C73, 0xF778, 0x9C74, 0xF779, 0x9C75, - 0xF77A, 0x9C76, 0xF77B, 0x9C77, 0xF77C, 0x9C78, 0xF77D, 0x9C79, - 0xF77E, 0x9C7A, 0xF780, 0x9C7B, 0xF781, 0x9C7D, 0xF782, 0x9C7E, - 0xF783, 0x9C80, 0xF784, 0x9C83, 0xF785, 0x9C84, 0xF786, 0x9C89, - 0xF787, 0x9C8A, 0xF788, 0x9C8C, 0xF789, 0x9C8F, 0xF78A, 0x9C93, - 0xF78B, 0x9C96, 0xF78C, 0x9C97, 0xF78D, 0x9C98, 0xF78E, 0x9C99, - 0xF78F, 0x9C9D, 0xF790, 0x9CAA, 0xF791, 0x9CAC, 0xF792, 0x9CAF, - 0xF793, 0x9CB9, 0xF794, 0x9CBE, 0xF795, 0x9CBF, 0xF796, 0x9CC0, - 0xF797, 0x9CC1, 0xF798, 0x9CC2, 0xF799, 0x9CC8, 0xF79A, 0x9CC9, - 0xF79B, 0x9CD1, 0xF79C, 0x9CD2, 0xF79D, 0x9CDA, 0xF79E, 0x9CDB, - 0xF79F, 0x9CE0, 0xF7A0, 0x9CE1, 0xF7A1, 0x9CCC, 0xF7A2, 0x9CCD, - 0xF7A3, 0x9CCE, 0xF7A4, 0x9CCF, 0xF7A5, 0x9CD0, 0xF7A6, 0x9CD3, - 0xF7A7, 0x9CD4, 0xF7A8, 0x9CD5, 0xF7A9, 0x9CD7, 0xF7AA, 0x9CD8, - 0xF7AB, 0x9CD9, 0xF7AC, 0x9CDC, 0xF7AD, 0x9CDD, 0xF7AE, 0x9CDF, - 0xF7AF, 0x9CE2, 0xF7B0, 0x977C, 0xF7B1, 0x9785, 0xF7B2, 0x9791, - 0xF7B3, 0x9792, 0xF7B4, 0x9794, 0xF7B5, 0x97AF, 0xF7B6, 0x97AB, - 0xF7B7, 0x97A3, 0xF7B8, 0x97B2, 0xF7B9, 0x97B4, 0xF7BA, 0x9AB1, - 0xF7BB, 0x9AB0, 0xF7BC, 0x9AB7, 0xF7BD, 0x9E58, 0xF7BE, 0x9AB6, - 0xF7BF, 0x9ABA, 0xF7C0, 0x9ABC, 0xF7C1, 0x9AC1, 0xF7C2, 0x9AC0, - 0xF7C3, 0x9AC5, 0xF7C4, 0x9AC2, 0xF7C5, 0x9ACB, 0xF7C6, 0x9ACC, - 0xF7C7, 0x9AD1, 0xF7C8, 0x9B45, 0xF7C9, 0x9B43, 0xF7CA, 0x9B47, - 0xF7CB, 0x9B49, 0xF7CC, 0x9B48, 0xF7CD, 0x9B4D, 0xF7CE, 0x9B51, - 0xF7CF, 0x98E8, 0xF7D0, 0x990D, 0xF7D1, 0x992E, 0xF7D2, 0x9955, - 0xF7D3, 0x9954, 0xF7D4, 0x9ADF, 0xF7D5, 0x9AE1, 0xF7D6, 0x9AE6, - 0xF7D7, 0x9AEF, 0xF7D8, 0x9AEB, 0xF7D9, 0x9AFB, 0xF7DA, 0x9AED, - 0xF7DB, 0x9AF9, 0xF7DC, 0x9B08, 0xF7DD, 0x9B0F, 0xF7DE, 0x9B13, - 0xF7DF, 0x9B1F, 0xF7E0, 0x9B23, 0xF7E1, 0x9EBD, 0xF7E2, 0x9EBE, - 0xF7E3, 0x7E3B, 0xF7E4, 0x9E82, 0xF7E5, 0x9E87, 0xF7E6, 0x9E88, - 0xF7E7, 0x9E8B, 0xF7E8, 0x9E92, 0xF7E9, 0x93D6, 0xF7EA, 0x9E9D, - 0xF7EB, 0x9E9F, 0xF7EC, 0x9EDB, 0xF7ED, 0x9EDC, 0xF7EE, 0x9EDD, - 0xF7EF, 0x9EE0, 0xF7F0, 0x9EDF, 0xF7F1, 0x9EE2, 0xF7F2, 0x9EE9, - 0xF7F3, 0x9EE7, 0xF7F4, 0x9EE5, 0xF7F5, 0x9EEA, 0xF7F6, 0x9EEF, - 0xF7F7, 0x9F22, 0xF7F8, 0x9F2C, 0xF7F9, 0x9F2F, 0xF7FA, 0x9F39, - 0xF7FB, 0x9F37, 0xF7FC, 0x9F3D, 0xF7FD, 0x9F3E, 0xF7FE, 0x9F44, - 0xF840, 0x9CE3, 0xF841, 0x9CE4, 0xF842, 0x9CE5, 0xF843, 0x9CE6, - 0xF844, 0x9CE7, 0xF845, 0x9CE8, 0xF846, 0x9CE9, 0xF847, 0x9CEA, - 0xF848, 0x9CEB, 0xF849, 0x9CEC, 0xF84A, 0x9CED, 0xF84B, 0x9CEE, - 0xF84C, 0x9CEF, 0xF84D, 0x9CF0, 0xF84E, 0x9CF1, 0xF84F, 0x9CF2, - 0xF850, 0x9CF3, 0xF851, 0x9CF4, 0xF852, 0x9CF5, 0xF853, 0x9CF6, - 0xF854, 0x9CF7, 0xF855, 0x9CF8, 0xF856, 0x9CF9, 0xF857, 0x9CFA, - 0xF858, 0x9CFB, 0xF859, 0x9CFC, 0xF85A, 0x9CFD, 0xF85B, 0x9CFE, - 0xF85C, 0x9CFF, 0xF85D, 0x9D00, 0xF85E, 0x9D01, 0xF85F, 0x9D02, - 0xF860, 0x9D03, 0xF861, 0x9D04, 0xF862, 0x9D05, 0xF863, 0x9D06, - 0xF864, 0x9D07, 0xF865, 0x9D08, 0xF866, 0x9D09, 0xF867, 0x9D0A, - 0xF868, 0x9D0B, 0xF869, 0x9D0C, 0xF86A, 0x9D0D, 0xF86B, 0x9D0E, - 0xF86C, 0x9D0F, 0xF86D, 0x9D10, 0xF86E, 0x9D11, 0xF86F, 0x9D12, - 0xF870, 0x9D13, 0xF871, 0x9D14, 0xF872, 0x9D15, 0xF873, 0x9D16, - 0xF874, 0x9D17, 0xF875, 0x9D18, 0xF876, 0x9D19, 0xF877, 0x9D1A, - 0xF878, 0x9D1B, 0xF879, 0x9D1C, 0xF87A, 0x9D1D, 0xF87B, 0x9D1E, - 0xF87C, 0x9D1F, 0xF87D, 0x9D20, 0xF87E, 0x9D21, 0xF880, 0x9D22, - 0xF881, 0x9D23, 0xF882, 0x9D24, 0xF883, 0x9D25, 0xF884, 0x9D26, - 0xF885, 0x9D27, 0xF886, 0x9D28, 0xF887, 0x9D29, 0xF888, 0x9D2A, - 0xF889, 0x9D2B, 0xF88A, 0x9D2C, 0xF88B, 0x9D2D, 0xF88C, 0x9D2E, - 0xF88D, 0x9D2F, 0xF88E, 0x9D30, 0xF88F, 0x9D31, 0xF890, 0x9D32, - 0xF891, 0x9D33, 0xF892, 0x9D34, 0xF893, 0x9D35, 0xF894, 0x9D36, - 0xF895, 0x9D37, 0xF896, 0x9D38, 0xF897, 0x9D39, 0xF898, 0x9D3A, - 0xF899, 0x9D3B, 0xF89A, 0x9D3C, 0xF89B, 0x9D3D, 0xF89C, 0x9D3E, - 0xF89D, 0x9D3F, 0xF89E, 0x9D40, 0xF89F, 0x9D41, 0xF8A0, 0x9D42, - 0xF940, 0x9D43, 0xF941, 0x9D44, 0xF942, 0x9D45, 0xF943, 0x9D46, - 0xF944, 0x9D47, 0xF945, 0x9D48, 0xF946, 0x9D49, 0xF947, 0x9D4A, - 0xF948, 0x9D4B, 0xF949, 0x9D4C, 0xF94A, 0x9D4D, 0xF94B, 0x9D4E, - 0xF94C, 0x9D4F, 0xF94D, 0x9D50, 0xF94E, 0x9D51, 0xF94F, 0x9D52, - 0xF950, 0x9D53, 0xF951, 0x9D54, 0xF952, 0x9D55, 0xF953, 0x9D56, - 0xF954, 0x9D57, 0xF955, 0x9D58, 0xF956, 0x9D59, 0xF957, 0x9D5A, - 0xF958, 0x9D5B, 0xF959, 0x9D5C, 0xF95A, 0x9D5D, 0xF95B, 0x9D5E, - 0xF95C, 0x9D5F, 0xF95D, 0x9D60, 0xF95E, 0x9D61, 0xF95F, 0x9D62, - 0xF960, 0x9D63, 0xF961, 0x9D64, 0xF962, 0x9D65, 0xF963, 0x9D66, - 0xF964, 0x9D67, 0xF965, 0x9D68, 0xF966, 0x9D69, 0xF967, 0x9D6A, - 0xF968, 0x9D6B, 0xF969, 0x9D6C, 0xF96A, 0x9D6D, 0xF96B, 0x9D6E, - 0xF96C, 0x9D6F, 0xF96D, 0x9D70, 0xF96E, 0x9D71, 0xF96F, 0x9D72, - 0xF970, 0x9D73, 0xF971, 0x9D74, 0xF972, 0x9D75, 0xF973, 0x9D76, - 0xF974, 0x9D77, 0xF975, 0x9D78, 0xF976, 0x9D79, 0xF977, 0x9D7A, - 0xF978, 0x9D7B, 0xF979, 0x9D7C, 0xF97A, 0x9D7D, 0xF97B, 0x9D7E, - 0xF97C, 0x9D7F, 0xF97D, 0x9D80, 0xF97E, 0x9D81, 0xF980, 0x9D82, - 0xF981, 0x9D83, 0xF982, 0x9D84, 0xF983, 0x9D85, 0xF984, 0x9D86, - 0xF985, 0x9D87, 0xF986, 0x9D88, 0xF987, 0x9D89, 0xF988, 0x9D8A, - 0xF989, 0x9D8B, 0xF98A, 0x9D8C, 0xF98B, 0x9D8D, 0xF98C, 0x9D8E, - 0xF98D, 0x9D8F, 0xF98E, 0x9D90, 0xF98F, 0x9D91, 0xF990, 0x9D92, - 0xF991, 0x9D93, 0xF992, 0x9D94, 0xF993, 0x9D95, 0xF994, 0x9D96, - 0xF995, 0x9D97, 0xF996, 0x9D98, 0xF997, 0x9D99, 0xF998, 0x9D9A, - 0xF999, 0x9D9B, 0xF99A, 0x9D9C, 0xF99B, 0x9D9D, 0xF99C, 0x9D9E, - 0xF99D, 0x9D9F, 0xF99E, 0x9DA0, 0xF99F, 0x9DA1, 0xF9A0, 0x9DA2, - 0xFA40, 0x9DA3, 0xFA41, 0x9DA4, 0xFA42, 0x9DA5, 0xFA43, 0x9DA6, - 0xFA44, 0x9DA7, 0xFA45, 0x9DA8, 0xFA46, 0x9DA9, 0xFA47, 0x9DAA, - 0xFA48, 0x9DAB, 0xFA49, 0x9DAC, 0xFA4A, 0x9DAD, 0xFA4B, 0x9DAE, - 0xFA4C, 0x9DAF, 0xFA4D, 0x9DB0, 0xFA4E, 0x9DB1, 0xFA4F, 0x9DB2, - 0xFA50, 0x9DB3, 0xFA51, 0x9DB4, 0xFA52, 0x9DB5, 0xFA53, 0x9DB6, - 0xFA54, 0x9DB7, 0xFA55, 0x9DB8, 0xFA56, 0x9DB9, 0xFA57, 0x9DBA, - 0xFA58, 0x9DBB, 0xFA59, 0x9DBC, 0xFA5A, 0x9DBD, 0xFA5B, 0x9DBE, - 0xFA5C, 0x9DBF, 0xFA5D, 0x9DC0, 0xFA5E, 0x9DC1, 0xFA5F, 0x9DC2, - 0xFA60, 0x9DC3, 0xFA61, 0x9DC4, 0xFA62, 0x9DC5, 0xFA63, 0x9DC6, - 0xFA64, 0x9DC7, 0xFA65, 0x9DC8, 0xFA66, 0x9DC9, 0xFA67, 0x9DCA, - 0xFA68, 0x9DCB, 0xFA69, 0x9DCC, 0xFA6A, 0x9DCD, 0xFA6B, 0x9DCE, - 0xFA6C, 0x9DCF, 0xFA6D, 0x9DD0, 0xFA6E, 0x9DD1, 0xFA6F, 0x9DD2, - 0xFA70, 0x9DD3, 0xFA71, 0x9DD4, 0xFA72, 0x9DD5, 0xFA73, 0x9DD6, - 0xFA74, 0x9DD7, 0xFA75, 0x9DD8, 0xFA76, 0x9DD9, 0xFA77, 0x9DDA, - 0xFA78, 0x9DDB, 0xFA79, 0x9DDC, 0xFA7A, 0x9DDD, 0xFA7B, 0x9DDE, - 0xFA7C, 0x9DDF, 0xFA7D, 0x9DE0, 0xFA7E, 0x9DE1, 0xFA80, 0x9DE2, - 0xFA81, 0x9DE3, 0xFA82, 0x9DE4, 0xFA83, 0x9DE5, 0xFA84, 0x9DE6, - 0xFA85, 0x9DE7, 0xFA86, 0x9DE8, 0xFA87, 0x9DE9, 0xFA88, 0x9DEA, - 0xFA89, 0x9DEB, 0xFA8A, 0x9DEC, 0xFA8B, 0x9DED, 0xFA8C, 0x9DEE, - 0xFA8D, 0x9DEF, 0xFA8E, 0x9DF0, 0xFA8F, 0x9DF1, 0xFA90, 0x9DF2, - 0xFA91, 0x9DF3, 0xFA92, 0x9DF4, 0xFA93, 0x9DF5, 0xFA94, 0x9DF6, - 0xFA95, 0x9DF7, 0xFA96, 0x9DF8, 0xFA97, 0x9DF9, 0xFA98, 0x9DFA, - 0xFA99, 0x9DFB, 0xFA9A, 0x9DFC, 0xFA9B, 0x9DFD, 0xFA9C, 0x9DFE, - 0xFA9D, 0x9DFF, 0xFA9E, 0x9E00, 0xFA9F, 0x9E01, 0xFAA0, 0x9E02, - 0xFB40, 0x9E03, 0xFB41, 0x9E04, 0xFB42, 0x9E05, 0xFB43, 0x9E06, - 0xFB44, 0x9E07, 0xFB45, 0x9E08, 0xFB46, 0x9E09, 0xFB47, 0x9E0A, - 0xFB48, 0x9E0B, 0xFB49, 0x9E0C, 0xFB4A, 0x9E0D, 0xFB4B, 0x9E0E, - 0xFB4C, 0x9E0F, 0xFB4D, 0x9E10, 0xFB4E, 0x9E11, 0xFB4F, 0x9E12, - 0xFB50, 0x9E13, 0xFB51, 0x9E14, 0xFB52, 0x9E15, 0xFB53, 0x9E16, - 0xFB54, 0x9E17, 0xFB55, 0x9E18, 0xFB56, 0x9E19, 0xFB57, 0x9E1A, - 0xFB58, 0x9E1B, 0xFB59, 0x9E1C, 0xFB5A, 0x9E1D, 0xFB5B, 0x9E1E, - 0xFB5C, 0x9E24, 0xFB5D, 0x9E27, 0xFB5E, 0x9E2E, 0xFB5F, 0x9E30, - 0xFB60, 0x9E34, 0xFB61, 0x9E3B, 0xFB62, 0x9E3C, 0xFB63, 0x9E40, - 0xFB64, 0x9E4D, 0xFB65, 0x9E50, 0xFB66, 0x9E52, 0xFB67, 0x9E53, - 0xFB68, 0x9E54, 0xFB69, 0x9E56, 0xFB6A, 0x9E59, 0xFB6B, 0x9E5D, - 0xFB6C, 0x9E5F, 0xFB6D, 0x9E60, 0xFB6E, 0x9E61, 0xFB6F, 0x9E62, - 0xFB70, 0x9E65, 0xFB71, 0x9E6E, 0xFB72, 0x9E6F, 0xFB73, 0x9E72, - 0xFB74, 0x9E74, 0xFB75, 0x9E75, 0xFB76, 0x9E76, 0xFB77, 0x9E77, - 0xFB78, 0x9E78, 0xFB79, 0x9E79, 0xFB7A, 0x9E7A, 0xFB7B, 0x9E7B, - 0xFB7C, 0x9E7C, 0xFB7D, 0x9E7D, 0xFB7E, 0x9E80, 0xFB80, 0x9E81, - 0xFB81, 0x9E83, 0xFB82, 0x9E84, 0xFB83, 0x9E85, 0xFB84, 0x9E86, - 0xFB85, 0x9E89, 0xFB86, 0x9E8A, 0xFB87, 0x9E8C, 0xFB88, 0x9E8D, - 0xFB89, 0x9E8E, 0xFB8A, 0x9E8F, 0xFB8B, 0x9E90, 0xFB8C, 0x9E91, - 0xFB8D, 0x9E94, 0xFB8E, 0x9E95, 0xFB8F, 0x9E96, 0xFB90, 0x9E97, - 0xFB91, 0x9E98, 0xFB92, 0x9E99, 0xFB93, 0x9E9A, 0xFB94, 0x9E9B, - 0xFB95, 0x9E9C, 0xFB96, 0x9E9E, 0xFB97, 0x9EA0, 0xFB98, 0x9EA1, - 0xFB99, 0x9EA2, 0xFB9A, 0x9EA3, 0xFB9B, 0x9EA4, 0xFB9C, 0x9EA5, - 0xFB9D, 0x9EA7, 0xFB9E, 0x9EA8, 0xFB9F, 0x9EA9, 0xFBA0, 0x9EAA, - 0xFC40, 0x9EAB, 0xFC41, 0x9EAC, 0xFC42, 0x9EAD, 0xFC43, 0x9EAE, - 0xFC44, 0x9EAF, 0xFC45, 0x9EB0, 0xFC46, 0x9EB1, 0xFC47, 0x9EB2, - 0xFC48, 0x9EB3, 0xFC49, 0x9EB5, 0xFC4A, 0x9EB6, 0xFC4B, 0x9EB7, - 0xFC4C, 0x9EB9, 0xFC4D, 0x9EBA, 0xFC4E, 0x9EBC, 0xFC4F, 0x9EBF, - 0xFC50, 0x9EC0, 0xFC51, 0x9EC1, 0xFC52, 0x9EC2, 0xFC53, 0x9EC3, - 0xFC54, 0x9EC5, 0xFC55, 0x9EC6, 0xFC56, 0x9EC7, 0xFC57, 0x9EC8, - 0xFC58, 0x9ECA, 0xFC59, 0x9ECB, 0xFC5A, 0x9ECC, 0xFC5B, 0x9ED0, - 0xFC5C, 0x9ED2, 0xFC5D, 0x9ED3, 0xFC5E, 0x9ED5, 0xFC5F, 0x9ED6, - 0xFC60, 0x9ED7, 0xFC61, 0x9ED9, 0xFC62, 0x9EDA, 0xFC63, 0x9EDE, - 0xFC64, 0x9EE1, 0xFC65, 0x9EE3, 0xFC66, 0x9EE4, 0xFC67, 0x9EE6, - 0xFC68, 0x9EE8, 0xFC69, 0x9EEB, 0xFC6A, 0x9EEC, 0xFC6B, 0x9EED, - 0xFC6C, 0x9EEE, 0xFC6D, 0x9EF0, 0xFC6E, 0x9EF1, 0xFC6F, 0x9EF2, - 0xFC70, 0x9EF3, 0xFC71, 0x9EF4, 0xFC72, 0x9EF5, 0xFC73, 0x9EF6, - 0xFC74, 0x9EF7, 0xFC75, 0x9EF8, 0xFC76, 0x9EFA, 0xFC77, 0x9EFD, - 0xFC78, 0x9EFF, 0xFC79, 0x9F00, 0xFC7A, 0x9F01, 0xFC7B, 0x9F02, - 0xFC7C, 0x9F03, 0xFC7D, 0x9F04, 0xFC7E, 0x9F05, 0xFC80, 0x9F06, - 0xFC81, 0x9F07, 0xFC82, 0x9F08, 0xFC83, 0x9F09, 0xFC84, 0x9F0A, - 0xFC85, 0x9F0C, 0xFC86, 0x9F0F, 0xFC87, 0x9F11, 0xFC88, 0x9F12, - 0xFC89, 0x9F14, 0xFC8A, 0x9F15, 0xFC8B, 0x9F16, 0xFC8C, 0x9F18, - 0xFC8D, 0x9F1A, 0xFC8E, 0x9F1B, 0xFC8F, 0x9F1C, 0xFC90, 0x9F1D, - 0xFC91, 0x9F1E, 0xFC92, 0x9F1F, 0xFC93, 0x9F21, 0xFC94, 0x9F23, - 0xFC95, 0x9F24, 0xFC96, 0x9F25, 0xFC97, 0x9F26, 0xFC98, 0x9F27, - 0xFC99, 0x9F28, 0xFC9A, 0x9F29, 0xFC9B, 0x9F2A, 0xFC9C, 0x9F2B, - 0xFC9D, 0x9F2D, 0xFC9E, 0x9F2E, 0xFC9F, 0x9F30, 0xFCA0, 0x9F31, - 0xFD40, 0x9F32, 0xFD41, 0x9F33, 0xFD42, 0x9F34, 0xFD43, 0x9F35, - 0xFD44, 0x9F36, 0xFD45, 0x9F38, 0xFD46, 0x9F3A, 0xFD47, 0x9F3C, - 0xFD48, 0x9F3F, 0xFD49, 0x9F40, 0xFD4A, 0x9F41, 0xFD4B, 0x9F42, - 0xFD4C, 0x9F43, 0xFD4D, 0x9F45, 0xFD4E, 0x9F46, 0xFD4F, 0x9F47, - 0xFD50, 0x9F48, 0xFD51, 0x9F49, 0xFD52, 0x9F4A, 0xFD53, 0x9F4B, - 0xFD54, 0x9F4C, 0xFD55, 0x9F4D, 0xFD56, 0x9F4E, 0xFD57, 0x9F4F, - 0xFD58, 0x9F52, 0xFD59, 0x9F53, 0xFD5A, 0x9F54, 0xFD5B, 0x9F55, - 0xFD5C, 0x9F56, 0xFD5D, 0x9F57, 0xFD5E, 0x9F58, 0xFD5F, 0x9F59, - 0xFD60, 0x9F5A, 0xFD61, 0x9F5B, 0xFD62, 0x9F5C, 0xFD63, 0x9F5D, - 0xFD64, 0x9F5E, 0xFD65, 0x9F5F, 0xFD66, 0x9F60, 0xFD67, 0x9F61, - 0xFD68, 0x9F62, 0xFD69, 0x9F63, 0xFD6A, 0x9F64, 0xFD6B, 0x9F65, - 0xFD6C, 0x9F66, 0xFD6D, 0x9F67, 0xFD6E, 0x9F68, 0xFD6F, 0x9F69, - 0xFD70, 0x9F6A, 0xFD71, 0x9F6B, 0xFD72, 0x9F6C, 0xFD73, 0x9F6D, - 0xFD74, 0x9F6E, 0xFD75, 0x9F6F, 0xFD76, 0x9F70, 0xFD77, 0x9F71, - 0xFD78, 0x9F72, 0xFD79, 0x9F73, 0xFD7A, 0x9F74, 0xFD7B, 0x9F75, - 0xFD7C, 0x9F76, 0xFD7D, 0x9F77, 0xFD7E, 0x9F78, 0xFD80, 0x9F79, - 0xFD81, 0x9F7A, 0xFD82, 0x9F7B, 0xFD83, 0x9F7C, 0xFD84, 0x9F7D, - 0xFD85, 0x9F7E, 0xFD86, 0x9F81, 0xFD87, 0x9F82, 0xFD88, 0x9F8D, - 0xFD89, 0x9F8E, 0xFD8A, 0x9F8F, 0xFD8B, 0x9F90, 0xFD8C, 0x9F91, - 0xFD8D, 0x9F92, 0xFD8E, 0x9F93, 0xFD8F, 0x9F94, 0xFD90, 0x9F95, - 0xFD91, 0x9F96, 0xFD92, 0x9F97, 0xFD93, 0x9F98, 0xFD94, 0x9F9C, - 0xFD95, 0x9F9D, 0xFD96, 0x9F9E, 0xFD97, 0x9FA1, 0xFD98, 0x9FA2, - 0xFD99, 0x9FA3, 0xFD9A, 0x9FA4, 0xFD9B, 0x9FA5, 0xFD9C, 0xF92C, - 0xFD9D, 0xF979, 0xFD9E, 0xF995, 0xFD9F, 0xF9E7, 0xFDA0, 0xF9F1, - 0xFE40, 0xFA0C, 0xFE41, 0xFA0D, 0xFE42, 0xFA0E, 0xFE43, 0xFA0F, - 0xFE44, 0xFA11, 0xFE45, 0xFA13, 0xFE46, 0xFA14, 0xFE47, 0xFA18, - 0xFE48, 0xFA1F, 0xFE49, 0xFA20, 0xFE4A, 0xFA21, 0xFE4B, 0xFA23, - 0xFE4C, 0xFA24, 0xFE4D, 0xFA27, 0xFE4E, 0xFA28, 0xFE4F, 0xFA29, - 0, 0 -}; - - - -WCHAR ff_convert ( /* Converted code, 0 means conversion error */ - WCHAR chr, /* Character code to be converted */ - UINT dir /* 0: Unicode to OEM code, 1: OEM code to Unicode */ -) -{ - const WCHAR *p; - WCHAR c; - int i, n, li, hi; - - - if (chr < 0x80) { /* ASCII */ - c = chr; - } else { - if (dir) { /* OEM code to unicode */ - p = oem2uni; - hi = sizeof oem2uni / 4 - 1; - } else { /* Unicode to OEM code */ - p = uni2oem; - hi = sizeof uni2oem / 4 - 1; - } - li = 0; - for (n = 16; n; n--) { - i = li + (hi - li) / 2; - if (chr == p[i * 2]) break; - if (chr > p[i * 2]) - li = i; - else - hi = i; - } - c = n ? p[i * 2 + 1] : 0; - } - - return c; -} - - - -WCHAR ff_wtoupper ( /* Returns upper converted character */ - WCHAR chr /* Unicode character to be upper converted (BMP only) */ -) -{ - /* Compressed upper conversion table */ - static const WCHAR cvt1[] = { /* U+0000 - U+0FFF */ - /* Basic Latin */ - 0x0061,0x031A, - /* Latin-1 Supplement */ - 0x00E0,0x0317, 0x00F8,0x0307, 0x00FF,0x0001,0x0178, - /* Latin Extended-A */ - 0x0100,0x0130, 0x0132,0x0106, 0x0139,0x0110, 0x014A,0x012E, 0x0179,0x0106, - /* Latin Extended-B */ - 0x0180,0x004D,0x0243,0x0181,0x0182,0x0182,0x0184,0x0184,0x0186,0x0187,0x0187,0x0189,0x018A,0x018B,0x018B,0x018D,0x018E,0x018F,0x0190,0x0191,0x0191,0x0193,0x0194,0x01F6,0x0196,0x0197,0x0198,0x0198,0x023D,0x019B,0x019C,0x019D,0x0220,0x019F,0x01A0,0x01A0,0x01A2,0x01A2,0x01A4,0x01A4,0x01A6,0x01A7,0x01A7,0x01A9,0x01AA,0x01AB,0x01AC,0x01AC,0x01AE,0x01AF,0x01AF,0x01B1,0x01B2,0x01B3,0x01B3,0x01B5,0x01B5,0x01B7,0x01B8,0x01B8,0x01BA,0x01BB,0x01BC,0x01BC,0x01BE,0x01F7,0x01C0,0x01C1,0x01C2,0x01C3,0x01C4,0x01C5,0x01C4,0x01C7,0x01C8,0x01C7,0x01CA,0x01CB,0x01CA, - 0x01CD,0x0110, 0x01DD,0x0001,0x018E, 0x01DE,0x0112, 0x01F3,0x0003,0x01F1,0x01F4,0x01F4, 0x01F8,0x0128, - 0x0222,0x0112, 0x023A,0x0009,0x2C65,0x023B,0x023B,0x023D,0x2C66,0x023F,0x0240,0x0241,0x0241, 0x0246,0x010A, - /* IPA Extensions */ - 0x0253,0x0040,0x0181,0x0186,0x0255,0x0189,0x018A,0x0258,0x018F,0x025A,0x0190,0x025C,0x025D,0x025E,0x025F,0x0193,0x0261,0x0262,0x0194,0x0264,0x0265,0x0266,0x0267,0x0197,0x0196,0x026A,0x2C62,0x026C,0x026D,0x026E,0x019C,0x0270,0x0271,0x019D,0x0273,0x0274,0x019F,0x0276,0x0277,0x0278,0x0279,0x027A,0x027B,0x027C,0x2C64,0x027E,0x027F,0x01A6,0x0281,0x0282,0x01A9,0x0284,0x0285,0x0286,0x0287,0x01AE,0x0244,0x01B1,0x01B2,0x0245,0x028D,0x028E,0x028F,0x0290,0x0291,0x01B7, - /* Greek, Coptic */ - 0x037B,0x0003,0x03FD,0x03FE,0x03FF, 0x03AC,0x0004,0x0386,0x0388,0x0389,0x038A, 0x03B1,0x0311, - 0x03C2,0x0002,0x03A3,0x03A3, 0x03C4,0x0308, 0x03CC,0x0003,0x038C,0x038E,0x038F, 0x03D8,0x0118, - 0x03F2,0x000A,0x03F9,0x03F3,0x03F4,0x03F5,0x03F6,0x03F7,0x03F7,0x03F9,0x03FA,0x03FA, - /* Cyrillic */ - 0x0430,0x0320, 0x0450,0x0710, 0x0460,0x0122, 0x048A,0x0136, 0x04C1,0x010E, 0x04CF,0x0001,0x04C0, 0x04D0,0x0144, - /* Armenian */ - 0x0561,0x0426, - - 0x0000 - }; - static const WCHAR cvt2[] = { /* U+1000 - U+FFFF */ - /* Phonetic Extensions */ - 0x1D7D,0x0001,0x2C63, - /* Latin Extended Additional */ - 0x1E00,0x0196, 0x1EA0,0x015A, - /* Greek Extended */ - 0x1F00,0x0608, 0x1F10,0x0606, 0x1F20,0x0608, 0x1F30,0x0608, 0x1F40,0x0606, - 0x1F51,0x0007,0x1F59,0x1F52,0x1F5B,0x1F54,0x1F5D,0x1F56,0x1F5F, 0x1F60,0x0608, - 0x1F70,0x000E,0x1FBA,0x1FBB,0x1FC8,0x1FC9,0x1FCA,0x1FCB,0x1FDA,0x1FDB,0x1FF8,0x1FF9,0x1FEA,0x1FEB,0x1FFA,0x1FFB, - 0x1F80,0x0608, 0x1F90,0x0608, 0x1FA0,0x0608, 0x1FB0,0x0004,0x1FB8,0x1FB9,0x1FB2,0x1FBC, - 0x1FCC,0x0001,0x1FC3, 0x1FD0,0x0602, 0x1FE0,0x0602, 0x1FE5,0x0001,0x1FEC, 0x1FF2,0x0001,0x1FFC, - /* Letterlike Symbols */ - 0x214E,0x0001,0x2132, - /* Number forms */ - 0x2170,0x0210, 0x2184,0x0001,0x2183, - /* Enclosed Alphanumerics */ - 0x24D0,0x051A, 0x2C30,0x042F, - /* Latin Extended-C */ - 0x2C60,0x0102, 0x2C67,0x0106, 0x2C75,0x0102, - /* Coptic */ - 0x2C80,0x0164, - /* Georgian Supplement */ - 0x2D00,0x0826, - /* Full-width */ - 0xFF41,0x031A, - - 0x0000 - }; - const WCHAR *p; - WCHAR bc, nc, cmd; - - - p = chr < 0x1000 ? cvt1 : cvt2; - for (;;) { - bc = *p++; /* Get block base */ - if (!bc || chr < bc) break; - nc = *p++; cmd = nc >> 8; nc &= 0xFF; /* Get processing command and block size */ - if (chr < bc + nc) { /* In the block? */ - switch (cmd) { - case 0: chr = p[chr - bc]; break; /* Table conversion */ - case 1: chr -= (chr - bc) & 1; break; /* Case pairs */ - case 2: chr -= 16; break; /* Shift -16 */ - case 3: chr -= 32; break; /* Shift -32 */ - case 4: chr -= 48; break; /* Shift -48 */ - case 5: chr -= 26; break; /* Shift -26 */ - case 6: chr += 8; break; /* Shift +8 */ - case 7: chr -= 80; break; /* Shift -80 */ - case 8: chr -= 0x1C60; break; /* Shift -0x1C60 */ - } - break; - } - if (!cmd) p += nc; - } - - return chr; -} - diff --git a/os/lib/fs/fat/option/unicode/cc949.c b/os/lib/fs/fat/option/unicode/cc949.c deleted file mode 100644 index 084ba456c..000000000 --- a/os/lib/fs/fat/option/unicode/cc949.c +++ /dev/null @@ -1,8674 +0,0 @@ -/*------------------------------------------------------------------------*/ -/* Unicode - OEM code bidirectional converter (C)ChaN, 2015 */ -/* CP949 (Korean EUC-KR) */ -/*------------------------------------------------------------------------*/ - -#include "../../ff.h" - - -#if !_USE_LFN || _CODE_PAGE != 949 -#error This file is not needed in current configuration. Remove from the project. -#endif - - -static -const WCHAR uni2oem[] = { -/* Unicode - OEM, Unicode - OEM, Unicode - OEM, Unicode - OEM */ - 0x00A1, 0xA2AE, 0x00A4, 0xA2B4, 0x00A7, 0xA1D7, 0x00A8, 0xA1A7, - 0x00AA, 0xA8A3, 0x00AD, 0xA1A9, 0x00AE, 0xA2E7, 0x00B0, 0xA1C6, - 0x00B1, 0xA1BE, 0x00B2, 0xA9F7, 0x00B3, 0xA9F8, 0x00B4, 0xA2A5, - 0x00B6, 0xA2D2, 0x00B7, 0xA1A4, 0x00B8, 0xA2AC, 0x00B9, 0xA9F6, - 0x00BA, 0xA8AC, 0x00BC, 0xA8F9, 0x00BD, 0xA8F6, 0x00BE, 0xA8FA, - 0x00BF, 0xA2AF, 0x00C6, 0xA8A1, 0x00D0, 0xA8A2, 0x00D7, 0xA1BF, - 0x00D8, 0xA8AA, 0x00DE, 0xA8AD, 0x00DF, 0xA9AC, 0x00E6, 0xA9A1, - 0x00F0, 0xA9A3, 0x00F7, 0xA1C0, 0x00F8, 0xA9AA, 0x00FE, 0xA9AD, - 0x0111, 0xA9A2, 0x0126, 0xA8A4, 0x0127, 0xA9A4, 0x0131, 0xA9A5, - 0x0132, 0xA8A6, 0x0133, 0xA9A6, 0x0138, 0xA9A7, 0x013F, 0xA8A8, - 0x0140, 0xA9A8, 0x0141, 0xA8A9, 0x0142, 0xA9A9, 0x0149, 0xA9B0, - 0x014A, 0xA8AF, 0x014B, 0xA9AF, 0x0152, 0xA8AB, 0x0153, 0xA9AB, - 0x0166, 0xA8AE, 0x0167, 0xA9AE, 0x02C7, 0xA2A7, 0x02D0, 0xA2B0, - 0x02D8, 0xA2A8, 0x02D9, 0xA2AB, 0x02DA, 0xA2AA, 0x02DB, 0xA2AD, - 0x02DD, 0xA2A9, 0x0391, 0xA5C1, 0x0392, 0xA5C2, 0x0393, 0xA5C3, - 0x0394, 0xA5C4, 0x0395, 0xA5C5, 0x0396, 0xA5C6, 0x0397, 0xA5C7, - 0x0398, 0xA5C8, 0x0399, 0xA5C9, 0x039A, 0xA5CA, 0x039B, 0xA5CB, - 0x039C, 0xA5CC, 0x039D, 0xA5CD, 0x039E, 0xA5CE, 0x039F, 0xA5CF, - 0x03A0, 0xA5D0, 0x03A1, 0xA5D1, 0x03A3, 0xA5D2, 0x03A4, 0xA5D3, - 0x03A5, 0xA5D4, 0x03A6, 0xA5D5, 0x03A7, 0xA5D6, 0x03A8, 0xA5D7, - 0x03A9, 0xA5D8, 0x03B1, 0xA5E1, 0x03B2, 0xA5E2, 0x03B3, 0xA5E3, - 0x03B4, 0xA5E4, 0x03B5, 0xA5E5, 0x03B6, 0xA5E6, 0x03B7, 0xA5E7, - 0x03B8, 0xA5E8, 0x03B9, 0xA5E9, 0x03BA, 0xA5EA, 0x03BB, 0xA5EB, - 0x03BC, 0xA5EC, 0x03BD, 0xA5ED, 0x03BE, 0xA5EE, 0x03BF, 0xA5EF, - 0x03C0, 0xA5F0, 0x03C1, 0xA5F1, 0x03C3, 0xA5F2, 0x03C4, 0xA5F3, - 0x03C5, 0xA5F4, 0x03C6, 0xA5F5, 0x03C7, 0xA5F6, 0x03C8, 0xA5F7, - 0x03C9, 0xA5F8, 0x0401, 0xACA7, 0x0410, 0xACA1, 0x0411, 0xACA2, - 0x0412, 0xACA3, 0x0413, 0xACA4, 0x0414, 0xACA5, 0x0415, 0xACA6, - 0x0416, 0xACA8, 0x0417, 0xACA9, 0x0418, 0xACAA, 0x0419, 0xACAB, - 0x041A, 0xACAC, 0x041B, 0xACAD, 0x041C, 0xACAE, 0x041D, 0xACAF, - 0x041E, 0xACB0, 0x041F, 0xACB1, 0x0420, 0xACB2, 0x0421, 0xACB3, - 0x0422, 0xACB4, 0x0423, 0xACB5, 0x0424, 0xACB6, 0x0425, 0xACB7, - 0x0426, 0xACB8, 0x0427, 0xACB9, 0x0428, 0xACBA, 0x0429, 0xACBB, - 0x042A, 0xACBC, 0x042B, 0xACBD, 0x042C, 0xACBE, 0x042D, 0xACBF, - 0x042E, 0xACC0, 0x042F, 0xACC1, 0x0430, 0xACD1, 0x0431, 0xACD2, - 0x0432, 0xACD3, 0x0433, 0xACD4, 0x0434, 0xACD5, 0x0435, 0xACD6, - 0x0436, 0xACD8, 0x0437, 0xACD9, 0x0438, 0xACDA, 0x0439, 0xACDB, - 0x043A, 0xACDC, 0x043B, 0xACDD, 0x043C, 0xACDE, 0x043D, 0xACDF, - 0x043E, 0xACE0, 0x043F, 0xACE1, 0x0440, 0xACE2, 0x0441, 0xACE3, - 0x0442, 0xACE4, 0x0443, 0xACE5, 0x0444, 0xACE6, 0x0445, 0xACE7, - 0x0446, 0xACE8, 0x0447, 0xACE9, 0x0448, 0xACEA, 0x0449, 0xACEB, - 0x044A, 0xACEC, 0x044B, 0xACED, 0x044C, 0xACEE, 0x044D, 0xACEF, - 0x044E, 0xACF0, 0x044F, 0xACF1, 0x0451, 0xACD7, 0x2015, 0xA1AA, - 0x2018, 0xA1AE, 0x2019, 0xA1AF, 0x201C, 0xA1B0, 0x201D, 0xA1B1, - 0x2020, 0xA2D3, 0x2021, 0xA2D4, 0x2025, 0xA1A5, 0x2026, 0xA1A6, - 0x2030, 0xA2B6, 0x2032, 0xA1C7, 0x2033, 0xA1C8, 0x203B, 0xA1D8, - 0x2074, 0xA9F9, 0x207F, 0xA9FA, 0x2081, 0xA9FB, 0x2082, 0xA9FC, - 0x2083, 0xA9FD, 0x2084, 0xA9FE, 0x20AC, 0xA2E6, 0x2103, 0xA1C9, - 0x2109, 0xA2B5, 0x2113, 0xA7A4, 0x2116, 0xA2E0, 0x2121, 0xA2E5, - 0x2122, 0xA2E2, 0x2126, 0xA7D9, 0x212B, 0xA1CA, 0x2153, 0xA8F7, - 0x2154, 0xA8F8, 0x215B, 0xA8FB, 0x215C, 0xA8FC, 0x215D, 0xA8FD, - 0x215E, 0xA8FE, 0x2160, 0xA5B0, 0x2161, 0xA5B1, 0x2162, 0xA5B2, - 0x2163, 0xA5B3, 0x2164, 0xA5B4, 0x2165, 0xA5B5, 0x2166, 0xA5B6, - 0x2167, 0xA5B7, 0x2168, 0xA5B8, 0x2169, 0xA5B9, 0x2170, 0xA5A1, - 0x2171, 0xA5A2, 0x2172, 0xA5A3, 0x2173, 0xA5A4, 0x2174, 0xA5A5, - 0x2175, 0xA5A6, 0x2176, 0xA5A7, 0x2177, 0xA5A8, 0x2178, 0xA5A9, - 0x2179, 0xA5AA, 0x2190, 0xA1E7, 0x2191, 0xA1E8, 0x2192, 0xA1E6, - 0x2193, 0xA1E9, 0x2194, 0xA1EA, 0x2195, 0xA2D5, 0x2196, 0xA2D8, - 0x2197, 0xA2D6, 0x2198, 0xA2D9, 0x2199, 0xA2D7, 0x21D2, 0xA2A1, - 0x21D4, 0xA2A2, 0x2200, 0xA2A3, 0x2202, 0xA1D3, 0x2203, 0xA2A4, - 0x2207, 0xA1D4, 0x2208, 0xA1F4, 0x220B, 0xA1F5, 0x220F, 0xA2B3, - 0x2211, 0xA2B2, 0x221A, 0xA1EE, 0x221D, 0xA1F0, 0x221E, 0xA1C4, - 0x2220, 0xA1D0, 0x2225, 0xA1AB, 0x2227, 0xA1FC, 0x2228, 0xA1FD, - 0x2229, 0xA1FB, 0x222A, 0xA1FA, 0x222B, 0xA1F2, 0x222C, 0xA1F3, - 0x222E, 0xA2B1, 0x2234, 0xA1C5, 0x2235, 0xA1F1, 0x223C, 0xA1AD, - 0x223D, 0xA1EF, 0x2252, 0xA1D6, 0x2260, 0xA1C1, 0x2261, 0xA1D5, - 0x2264, 0xA1C2, 0x2265, 0xA1C3, 0x226A, 0xA1EC, 0x226B, 0xA1ED, - 0x2282, 0xA1F8, 0x2283, 0xA1F9, 0x2286, 0xA1F6, 0x2287, 0xA1F7, - 0x2299, 0xA2C1, 0x22A5, 0xA1D1, 0x2312, 0xA1D2, 0x2460, 0xA8E7, - 0x2461, 0xA8E8, 0x2462, 0xA8E9, 0x2463, 0xA8EA, 0x2464, 0xA8EB, - 0x2465, 0xA8EC, 0x2466, 0xA8ED, 0x2467, 0xA8EE, 0x2468, 0xA8EF, - 0x2469, 0xA8F0, 0x246A, 0xA8F1, 0x246B, 0xA8F2, 0x246C, 0xA8F3, - 0x246D, 0xA8F4, 0x246E, 0xA8F5, 0x2474, 0xA9E7, 0x2475, 0xA9E8, - 0x2476, 0xA9E9, 0x2477, 0xA9EA, 0x2478, 0xA9EB, 0x2479, 0xA9EC, - 0x247A, 0xA9ED, 0x247B, 0xA9EE, 0x247C, 0xA9EF, 0x247D, 0xA9F0, - 0x247E, 0xA9F1, 0x247F, 0xA9F2, 0x2480, 0xA9F3, 0x2481, 0xA9F4, - 0x2482, 0xA9F5, 0x249C, 0xA9CD, 0x249D, 0xA9CE, 0x249E, 0xA9CF, - 0x249F, 0xA9D0, 0x24A0, 0xA9D1, 0x24A1, 0xA9D2, 0x24A2, 0xA9D3, - 0x24A3, 0xA9D4, 0x24A4, 0xA9D5, 0x24A5, 0xA9D6, 0x24A6, 0xA9D7, - 0x24A7, 0xA9D8, 0x24A8, 0xA9D9, 0x24A9, 0xA9DA, 0x24AA, 0xA9DB, - 0x24AB, 0xA9DC, 0x24AC, 0xA9DD, 0x24AD, 0xA9DE, 0x24AE, 0xA9DF, - 0x24AF, 0xA9E0, 0x24B0, 0xA9E1, 0x24B1, 0xA9E2, 0x24B2, 0xA9E3, - 0x24B3, 0xA9E4, 0x24B4, 0xA9E5, 0x24B5, 0xA9E6, 0x24D0, 0xA8CD, - 0x24D1, 0xA8CE, 0x24D2, 0xA8CF, 0x24D3, 0xA8D0, 0x24D4, 0xA8D1, - 0x24D5, 0xA8D2, 0x24D6, 0xA8D3, 0x24D7, 0xA8D4, 0x24D8, 0xA8D5, - 0x24D9, 0xA8D6, 0x24DA, 0xA8D7, 0x24DB, 0xA8D8, 0x24DC, 0xA8D9, - 0x24DD, 0xA8DA, 0x24DE, 0xA8DB, 0x24DF, 0xA8DC, 0x24E0, 0xA8DD, - 0x24E1, 0xA8DE, 0x24E2, 0xA8DF, 0x24E3, 0xA8E0, 0x24E4, 0xA8E1, - 0x24E5, 0xA8E2, 0x24E6, 0xA8E3, 0x24E7, 0xA8E4, 0x24E8, 0xA8E5, - 0x24E9, 0xA8E6, 0x2500, 0xA6A1, 0x2501, 0xA6AC, 0x2502, 0xA6A2, - 0x2503, 0xA6AD, 0x250C, 0xA6A3, 0x250D, 0xA6C8, 0x250E, 0xA6C7, - 0x250F, 0xA6AE, 0x2510, 0xA6A4, 0x2511, 0xA6C2, 0x2512, 0xA6C1, - 0x2513, 0xA6AF, 0x2514, 0xA6A6, 0x2515, 0xA6C6, 0x2516, 0xA6C5, - 0x2517, 0xA6B1, 0x2518, 0xA6A5, 0x2519, 0xA6C4, 0x251A, 0xA6C3, - 0x251B, 0xA6B0, 0x251C, 0xA6A7, 0x251D, 0xA6BC, 0x251E, 0xA6C9, - 0x251F, 0xA6CA, 0x2520, 0xA6B7, 0x2521, 0xA6CB, 0x2522, 0xA6CC, - 0x2523, 0xA6B2, 0x2524, 0xA6A9, 0x2525, 0xA6BE, 0x2526, 0xA6CD, - 0x2527, 0xA6CE, 0x2528, 0xA6B9, 0x2529, 0xA6CF, 0x252A, 0xA6D0, - 0x252B, 0xA6B4, 0x252C, 0xA6A8, 0x252D, 0xA6D1, 0x252E, 0xA6D2, - 0x252F, 0xA6B8, 0x2530, 0xA6BD, 0x2531, 0xA6D3, 0x2532, 0xA6D4, - 0x2533, 0xA6B3, 0x2534, 0xA6AA, 0x2535, 0xA6D5, 0x2536, 0xA6D6, - 0x2537, 0xA6BA, 0x2538, 0xA6BF, 0x2539, 0xA6D7, 0x253A, 0xA6D8, - 0x253B, 0xA6B5, 0x253C, 0xA6AB, 0x253D, 0xA6D9, 0x253E, 0xA6DA, - 0x253F, 0xA6BB, 0x2540, 0xA6DB, 0x2541, 0xA6DC, 0x2542, 0xA6C0, - 0x2543, 0xA6DD, 0x2544, 0xA6DE, 0x2545, 0xA6DF, 0x2546, 0xA6E0, - 0x2547, 0xA6E1, 0x2548, 0xA6E2, 0x2549, 0xA6E3, 0x254A, 0xA6E4, - 0x254B, 0xA6B6, 0x2592, 0xA2C6, 0x25A0, 0xA1E1, 0x25A1, 0xA1E0, - 0x25A3, 0xA2C3, 0x25A4, 0xA2C7, 0x25A5, 0xA2C8, 0x25A6, 0xA2CB, - 0x25A7, 0xA2CA, 0x25A8, 0xA2C9, 0x25A9, 0xA2CC, 0x25B2, 0xA1E3, - 0x25B3, 0xA1E2, 0x25B6, 0xA2BA, 0x25B7, 0xA2B9, 0x25BC, 0xA1E5, - 0x25BD, 0xA1E4, 0x25C0, 0xA2B8, 0x25C1, 0xA2B7, 0x25C6, 0xA1DF, - 0x25C7, 0xA1DE, 0x25C8, 0xA2C2, 0x25CB, 0xA1DB, 0x25CE, 0xA1DD, - 0x25CF, 0xA1DC, 0x25D0, 0xA2C4, 0x25D1, 0xA2C5, 0x2605, 0xA1DA, - 0x2606, 0xA1D9, 0x260E, 0xA2CF, 0x260F, 0xA2CE, 0x261C, 0xA2D0, - 0x261E, 0xA2D1, 0x2640, 0xA1CF, 0x2642, 0xA1CE, 0x2660, 0xA2BC, - 0x2661, 0xA2BD, 0x2663, 0xA2C0, 0x2664, 0xA2BB, 0x2665, 0xA2BE, - 0x2667, 0xA2BF, 0x2668, 0xA2CD, 0x2669, 0xA2DB, 0x266A, 0xA2DC, - 0x266C, 0xA2DD, 0x266D, 0xA2DA, 0x3000, 0xA1A1, 0x3001, 0xA1A2, - 0x3002, 0xA1A3, 0x3003, 0xA1A8, 0x3008, 0xA1B4, 0x3009, 0xA1B5, - 0x300A, 0xA1B6, 0x300B, 0xA1B7, 0x300C, 0xA1B8, 0x300D, 0xA1B9, - 0x300E, 0xA1BA, 0x300F, 0xA1BB, 0x3010, 0xA1BC, 0x3011, 0xA1BD, - 0x3013, 0xA1EB, 0x3014, 0xA1B2, 0x3015, 0xA1B3, 0x3041, 0xAAA1, - 0x3042, 0xAAA2, 0x3043, 0xAAA3, 0x3044, 0xAAA4, 0x3045, 0xAAA5, - 0x3046, 0xAAA6, 0x3047, 0xAAA7, 0x3048, 0xAAA8, 0x3049, 0xAAA9, - 0x304A, 0xAAAA, 0x304B, 0xAAAB, 0x304C, 0xAAAC, 0x304D, 0xAAAD, - 0x304E, 0xAAAE, 0x304F, 0xAAAF, 0x3050, 0xAAB0, 0x3051, 0xAAB1, - 0x3052, 0xAAB2, 0x3053, 0xAAB3, 0x3054, 0xAAB4, 0x3055, 0xAAB5, - 0x3056, 0xAAB6, 0x3057, 0xAAB7, 0x3058, 0xAAB8, 0x3059, 0xAAB9, - 0x305A, 0xAABA, 0x305B, 0xAABB, 0x305C, 0xAABC, 0x305D, 0xAABD, - 0x305E, 0xAABE, 0x305F, 0xAABF, 0x3060, 0xAAC0, 0x3061, 0xAAC1, - 0x3062, 0xAAC2, 0x3063, 0xAAC3, 0x3064, 0xAAC4, 0x3065, 0xAAC5, - 0x3066, 0xAAC6, 0x3067, 0xAAC7, 0x3068, 0xAAC8, 0x3069, 0xAAC9, - 0x306A, 0xAACA, 0x306B, 0xAACB, 0x306C, 0xAACC, 0x306D, 0xAACD, - 0x306E, 0xAACE, 0x306F, 0xAACF, 0x3070, 0xAAD0, 0x3071, 0xAAD1, - 0x3072, 0xAAD2, 0x3073, 0xAAD3, 0x3074, 0xAAD4, 0x3075, 0xAAD5, - 0x3076, 0xAAD6, 0x3077, 0xAAD7, 0x3078, 0xAAD8, 0x3079, 0xAAD9, - 0x307A, 0xAADA, 0x307B, 0xAADB, 0x307C, 0xAADC, 0x307D, 0xAADD, - 0x307E, 0xAADE, 0x307F, 0xAADF, 0x3080, 0xAAE0, 0x3081, 0xAAE1, - 0x3082, 0xAAE2, 0x3083, 0xAAE3, 0x3084, 0xAAE4, 0x3085, 0xAAE5, - 0x3086, 0xAAE6, 0x3087, 0xAAE7, 0x3088, 0xAAE8, 0x3089, 0xAAE9, - 0x308A, 0xAAEA, 0x308B, 0xAAEB, 0x308C, 0xAAEC, 0x308D, 0xAAED, - 0x308E, 0xAAEE, 0x308F, 0xAAEF, 0x3090, 0xAAF0, 0x3091, 0xAAF1, - 0x3092, 0xAAF2, 0x3093, 0xAAF3, 0x30A1, 0xABA1, 0x30A2, 0xABA2, - 0x30A3, 0xABA3, 0x30A4, 0xABA4, 0x30A5, 0xABA5, 0x30A6, 0xABA6, - 0x30A7, 0xABA7, 0x30A8, 0xABA8, 0x30A9, 0xABA9, 0x30AA, 0xABAA, - 0x30AB, 0xABAB, 0x30AC, 0xABAC, 0x30AD, 0xABAD, 0x30AE, 0xABAE, - 0x30AF, 0xABAF, 0x30B0, 0xABB0, 0x30B1, 0xABB1, 0x30B2, 0xABB2, - 0x30B3, 0xABB3, 0x30B4, 0xABB4, 0x30B5, 0xABB5, 0x30B6, 0xABB6, - 0x30B7, 0xABB7, 0x30B8, 0xABB8, 0x30B9, 0xABB9, 0x30BA, 0xABBA, - 0x30BB, 0xABBB, 0x30BC, 0xABBC, 0x30BD, 0xABBD, 0x30BE, 0xABBE, - 0x30BF, 0xABBF, 0x30C0, 0xABC0, 0x30C1, 0xABC1, 0x30C2, 0xABC2, - 0x30C3, 0xABC3, 0x30C4, 0xABC4, 0x30C5, 0xABC5, 0x30C6, 0xABC6, - 0x30C7, 0xABC7, 0x30C8, 0xABC8, 0x30C9, 0xABC9, 0x30CA, 0xABCA, - 0x30CB, 0xABCB, 0x30CC, 0xABCC, 0x30CD, 0xABCD, 0x30CE, 0xABCE, - 0x30CF, 0xABCF, 0x30D0, 0xABD0, 0x30D1, 0xABD1, 0x30D2, 0xABD2, - 0x30D3, 0xABD3, 0x30D4, 0xABD4, 0x30D5, 0xABD5, 0x30D6, 0xABD6, - 0x30D7, 0xABD7, 0x30D8, 0xABD8, 0x30D9, 0xABD9, 0x30DA, 0xABDA, - 0x30DB, 0xABDB, 0x30DC, 0xABDC, 0x30DD, 0xABDD, 0x30DE, 0xABDE, - 0x30DF, 0xABDF, 0x30E0, 0xABE0, 0x30E1, 0xABE1, 0x30E2, 0xABE2, - 0x30E3, 0xABE3, 0x30E4, 0xABE4, 0x30E5, 0xABE5, 0x30E6, 0xABE6, - 0x30E7, 0xABE7, 0x30E8, 0xABE8, 0x30E9, 0xABE9, 0x30EA, 0xABEA, - 0x30EB, 0xABEB, 0x30EC, 0xABEC, 0x30ED, 0xABED, 0x30EE, 0xABEE, - 0x30EF, 0xABEF, 0x30F0, 0xABF0, 0x30F1, 0xABF1, 0x30F2, 0xABF2, - 0x30F3, 0xABF3, 0x30F4, 0xABF4, 0x30F5, 0xABF5, 0x30F6, 0xABF6, - 0x3131, 0xA4A1, 0x3132, 0xA4A2, 0x3133, 0xA4A3, 0x3134, 0xA4A4, - 0x3135, 0xA4A5, 0x3136, 0xA4A6, 0x3137, 0xA4A7, 0x3138, 0xA4A8, - 0x3139, 0xA4A9, 0x313A, 0xA4AA, 0x313B, 0xA4AB, 0x313C, 0xA4AC, - 0x313D, 0xA4AD, 0x313E, 0xA4AE, 0x313F, 0xA4AF, 0x3140, 0xA4B0, - 0x3141, 0xA4B1, 0x3142, 0xA4B2, 0x3143, 0xA4B3, 0x3144, 0xA4B4, - 0x3145, 0xA4B5, 0x3146, 0xA4B6, 0x3147, 0xA4B7, 0x3148, 0xA4B8, - 0x3149, 0xA4B9, 0x314A, 0xA4BA, 0x314B, 0xA4BB, 0x314C, 0xA4BC, - 0x314D, 0xA4BD, 0x314E, 0xA4BE, 0x314F, 0xA4BF, 0x3150, 0xA4C0, - 0x3151, 0xA4C1, 0x3152, 0xA4C2, 0x3153, 0xA4C3, 0x3154, 0xA4C4, - 0x3155, 0xA4C5, 0x3156, 0xA4C6, 0x3157, 0xA4C7, 0x3158, 0xA4C8, - 0x3159, 0xA4C9, 0x315A, 0xA4CA, 0x315B, 0xA4CB, 0x315C, 0xA4CC, - 0x315D, 0xA4CD, 0x315E, 0xA4CE, 0x315F, 0xA4CF, 0x3160, 0xA4D0, - 0x3161, 0xA4D1, 0x3162, 0xA4D2, 0x3163, 0xA4D3, 0x3164, 0xA4D4, - 0x3165, 0xA4D5, 0x3166, 0xA4D6, 0x3167, 0xA4D7, 0x3168, 0xA4D8, - 0x3169, 0xA4D9, 0x316A, 0xA4DA, 0x316B, 0xA4DB, 0x316C, 0xA4DC, - 0x316D, 0xA4DD, 0x316E, 0xA4DE, 0x316F, 0xA4DF, 0x3170, 0xA4E0, - 0x3171, 0xA4E1, 0x3172, 0xA4E2, 0x3173, 0xA4E3, 0x3174, 0xA4E4, - 0x3175, 0xA4E5, 0x3176, 0xA4E6, 0x3177, 0xA4E7, 0x3178, 0xA4E8, - 0x3179, 0xA4E9, 0x317A, 0xA4EA, 0x317B, 0xA4EB, 0x317C, 0xA4EC, - 0x317D, 0xA4ED, 0x317E, 0xA4EE, 0x317F, 0xA4EF, 0x3180, 0xA4F0, - 0x3181, 0xA4F1, 0x3182, 0xA4F2, 0x3183, 0xA4F3, 0x3184, 0xA4F4, - 0x3185, 0xA4F5, 0x3186, 0xA4F6, 0x3187, 0xA4F7, 0x3188, 0xA4F8, - 0x3189, 0xA4F9, 0x318A, 0xA4FA, 0x318B, 0xA4FB, 0x318C, 0xA4FC, - 0x318D, 0xA4FD, 0x318E, 0xA4FE, 0x3200, 0xA9B1, 0x3201, 0xA9B2, - 0x3202, 0xA9B3, 0x3203, 0xA9B4, 0x3204, 0xA9B5, 0x3205, 0xA9B6, - 0x3206, 0xA9B7, 0x3207, 0xA9B8, 0x3208, 0xA9B9, 0x3209, 0xA9BA, - 0x320A, 0xA9BB, 0x320B, 0xA9BC, 0x320C, 0xA9BD, 0x320D, 0xA9BE, - 0x320E, 0xA9BF, 0x320F, 0xA9C0, 0x3210, 0xA9C1, 0x3211, 0xA9C2, - 0x3212, 0xA9C3, 0x3213, 0xA9C4, 0x3214, 0xA9C5, 0x3215, 0xA9C6, - 0x3216, 0xA9C7, 0x3217, 0xA9C8, 0x3218, 0xA9C9, 0x3219, 0xA9CA, - 0x321A, 0xA9CB, 0x321B, 0xA9CC, 0x321C, 0xA2DF, 0x3260, 0xA8B1, - 0x3261, 0xA8B2, 0x3262, 0xA8B3, 0x3263, 0xA8B4, 0x3264, 0xA8B5, - 0x3265, 0xA8B6, 0x3266, 0xA8B7, 0x3267, 0xA8B8, 0x3268, 0xA8B9, - 0x3269, 0xA8BA, 0x326A, 0xA8BB, 0x326B, 0xA8BC, 0x326C, 0xA8BD, - 0x326D, 0xA8BE, 0x326E, 0xA8BF, 0x326F, 0xA8C0, 0x3270, 0xA8C1, - 0x3271, 0xA8C2, 0x3272, 0xA8C3, 0x3273, 0xA8C4, 0x3274, 0xA8C5, - 0x3275, 0xA8C6, 0x3276, 0xA8C7, 0x3277, 0xA8C8, 0x3278, 0xA8C9, - 0x3279, 0xA8CA, 0x327A, 0xA8CB, 0x327B, 0xA8CC, 0x327F, 0xA2DE, - 0x3380, 0xA7C9, 0x3381, 0xA7CA, 0x3382, 0xA7CB, 0x3383, 0xA7CC, - 0x3384, 0xA7CD, 0x3388, 0xA7BA, 0x3389, 0xA7BB, 0x338A, 0xA7DC, - 0x338B, 0xA7DD, 0x338C, 0xA7DE, 0x338D, 0xA7B6, 0x338E, 0xA7B7, - 0x338F, 0xA7B8, 0x3390, 0xA7D4, 0x3391, 0xA7D5, 0x3392, 0xA7D6, - 0x3393, 0xA7D7, 0x3394, 0xA7D8, 0x3395, 0xA7A1, 0x3396, 0xA7A2, - 0x3397, 0xA7A3, 0x3398, 0xA7A5, 0x3399, 0xA7AB, 0x339A, 0xA7AC, - 0x339B, 0xA7AD, 0x339C, 0xA7AE, 0x339D, 0xA7AF, 0x339E, 0xA7B0, - 0x339F, 0xA7B1, 0x33A0, 0xA7B2, 0x33A1, 0xA7B3, 0x33A2, 0xA7B4, - 0x33A3, 0xA7A7, 0x33A4, 0xA7A8, 0x33A5, 0xA7A9, 0x33A6, 0xA7AA, - 0x33A7, 0xA7BD, 0x33A8, 0xA7BE, 0x33A9, 0xA7E5, 0x33AA, 0xA7E6, - 0x33AB, 0xA7E7, 0x33AC, 0xA7E8, 0x33AD, 0xA7E1, 0x33AE, 0xA7E2, - 0x33AF, 0xA7E3, 0x33B0, 0xA7BF, 0x33B1, 0xA7C0, 0x33B2, 0xA7C1, - 0x33B3, 0xA7C2, 0x33B4, 0xA7C3, 0x33B5, 0xA7C4, 0x33B6, 0xA7C5, - 0x33B7, 0xA7C6, 0x33B8, 0xA7C7, 0x33B9, 0xA7C8, 0x33BA, 0xA7CE, - 0x33BB, 0xA7CF, 0x33BC, 0xA7D0, 0x33BD, 0xA7D1, 0x33BE, 0xA7D2, - 0x33BF, 0xA7D3, 0x33C0, 0xA7DA, 0x33C1, 0xA7DB, 0x33C2, 0xA2E3, - 0x33C3, 0xA7EC, 0x33C4, 0xA7A6, 0x33C5, 0xA7E0, 0x33C6, 0xA7EF, - 0x33C7, 0xA2E1, 0x33C8, 0xA7BC, 0x33C9, 0xA7ED, 0x33CA, 0xA7B5, - 0x33CF, 0xA7B9, 0x33D0, 0xA7EA, 0x33D3, 0xA7EB, 0x33D6, 0xA7DF, - 0x33D8, 0xA2E4, 0x33DB, 0xA7E4, 0x33DC, 0xA7EE, 0x33DD, 0xA7E9, - 0x4E00, 0xECE9, 0x4E01, 0xEFCB, 0x4E03, 0xF6D2, 0x4E07, 0xD8B2, - 0x4E08, 0xEDDB, 0x4E09, 0xDFB2, 0x4E0A, 0xDFBE, 0x4E0B, 0xF9BB, - 0x4E0D, 0xDCF4, 0x4E11, 0xF5E4, 0x4E14, 0xF3A6, 0x4E15, 0xDDE0, - 0x4E16, 0xE1A6, 0x4E18, 0xCEF8, 0x4E19, 0xDCB0, 0x4E1E, 0xE3AA, - 0x4E2D, 0xF1E9, 0x4E32, 0xCDFA, 0x4E38, 0xFCAF, 0x4E39, 0xD3A1, - 0x4E3B, 0xF1AB, 0x4E42, 0xE7D1, 0x4E43, 0xD2AC, 0x4E45, 0xCEF9, - 0x4E4B, 0xF1FD, 0x4E4D, 0xDEBF, 0x4E4E, 0xFBBA, 0x4E4F, 0xF9B9, - 0x4E56, 0xCED2, 0x4E58, 0xE3AB, 0x4E59, 0xEBE0, 0x4E5D, 0xCEFA, - 0x4E5E, 0xCBF7, 0x4E5F, 0xE5A5, 0x4E6B, 0xCAE1, 0x4E6D, 0xD4CC, - 0x4E73, 0xEAE1, 0x4E76, 0xDCE3, 0x4E77, 0xDFAD, 0x4E7E, 0xCBEB, - 0x4E82, 0xD5AF, 0x4E86, 0xD6F5, 0x4E88, 0xE5F8, 0x4E8B, 0xDEC0, - 0x4E8C, 0xECA3, 0x4E8E, 0xE9CD, 0x4E90, 0xEAA7, 0x4E91, 0xE9F6, - 0x4E92, 0xFBBB, 0x4E94, 0xE7E9, 0x4E95, 0xEFCC, 0x4E98, 0xD0E6, - 0x4E9B, 0xDEC1, 0x4E9E, 0xE4AC, 0x4EA1, 0xD8CC, 0x4EA2, 0xF9F1, - 0x4EA4, 0xCEDF, 0x4EA5, 0xFAA4, 0x4EA6, 0xE6B2, 0x4EA8, 0xFAFB, - 0x4EAB, 0xFABD, 0x4EAC, 0xCCC8, 0x4EAD, 0xEFCD, 0x4EAE, 0xD5D5, - 0x4EB6, 0xD3A2, 0x4EBA, 0xECD1, 0x4EC0, 0xE4A7, 0x4EC1, 0xECD2, - 0x4EC4, 0xF6B1, 0x4EC7, 0xCEFB, 0x4ECA, 0xD0D1, 0x4ECB, 0xCBBF, - 0x4ECD, 0xEDA4, 0x4ED4, 0xEDA8, 0x4ED5, 0xDEC2, 0x4ED6, 0xF6E2, - 0x4ED7, 0xEDDC, 0x4ED8, 0xDCF5, 0x4ED9, 0xE0B9, 0x4EDD, 0xD4CE, - 0x4EDF, 0xF4B5, 0x4EE3, 0xD3DB, 0x4EE4, 0xD6B5, 0x4EE5, 0xECA4, - 0x4EF0, 0xE4E6, 0x4EF2, 0xF1EA, 0x4EF6, 0xCBEC, 0x4EF7, 0xCBC0, - 0x4EFB, 0xECF2, 0x4F01, 0xD0EA, 0x4F09, 0xF9F2, 0x4F0A, 0xECA5, - 0x4F0B, 0xD0DF, 0x4F0D, 0xE7EA, 0x4F0E, 0xD0EB, 0x4F0F, 0xDCD1, - 0x4F10, 0xDBE9, 0x4F11, 0xFDCC, 0x4F2F, 0xDBD7, 0x4F34, 0xDAE1, - 0x4F36, 0xD6B6, 0x4F38, 0xE3DF, 0x4F3A, 0xDEC3, 0x4F3C, 0xDEC4, - 0x4F3D, 0xCAA1, 0x4F43, 0xEEEC, 0x4F46, 0xD3A3, 0x4F47, 0xEEB7, - 0x4F48, 0xF8CF, 0x4F4D, 0xEAC8, 0x4F4E, 0xEEB8, 0x4F4F, 0xF1AC, - 0x4F50, 0xF1A5, 0x4F51, 0xE9CE, 0x4F55, 0xF9BC, 0x4F59, 0xE5F9, - 0x4F5A, 0xECEA, 0x4F5B, 0xDDD6, 0x4F5C, 0xEDC2, 0x4F69, 0xF8A5, - 0x4F6F, 0xE5BA, 0x4F70, 0xDBD8, 0x4F73, 0xCAA2, 0x4F76, 0xD1CD, - 0x4F7A, 0xEEED, 0x4F7E, 0xECEB, 0x4F7F, 0xDEC5, 0x4F81, 0xE3E0, - 0x4F83, 0xCAC9, 0x4F84, 0xF2E9, 0x4F86, 0xD5CE, 0x4F88, 0xF6B6, - 0x4F8A, 0xCEC2, 0x4F8B, 0xD6C7, 0x4F8D, 0xE3B4, 0x4F8F, 0xF1AD, - 0x4F91, 0xEAE2, 0x4F96, 0xD7C2, 0x4F98, 0xF3A7, 0x4F9B, 0xCDEA, - 0x4F9D, 0xEBEE, 0x4FAE, 0xD9B2, 0x4FAF, 0xFDA5, 0x4FB5, 0xF6D5, - 0x4FB6, 0xD5E2, 0x4FBF, 0xF8B5, 0x4FC2, 0xCCF5, 0x4FC3, 0xF5B5, - 0x4FC4, 0xE4AD, 0x4FC9, 0xE7EB, 0x4FCA, 0xF1D5, 0x4FCE, 0xF0BB, - 0x4FD1, 0xE9B5, 0x4FD3, 0xCCC9, 0x4FD4, 0xFAD5, 0x4FD7, 0xE1D4, - 0x4FDA, 0xD7D6, 0x4FDD, 0xDCC1, 0x4FDF, 0xDEC6, 0x4FE0, 0xFAEF, - 0x4FE1, 0xE3E1, 0x4FEE, 0xE1F3, 0x4FEF, 0xDCF6, 0x4FF1, 0xCEFC, - 0x4FF3, 0xDBC4, 0x4FF5, 0xF8F1, 0x4FF8, 0xDCE4, 0x4FFA, 0xE5EF, - 0x5002, 0xDCB1, 0x5006, 0xD5D6, 0x5009, 0xF3DA, 0x500B, 0xCBC1, - 0x500D, 0xDBC3, 0x5011, 0xD9FA, 0x5012, 0xD3EE, 0x5016, 0xFAB8, - 0x5019, 0xFDA6, 0x501A, 0xEBEF, 0x501C, 0xF4A6, 0x501E, 0xCCCA, - 0x501F, 0xF3A8, 0x5021, 0xF3DB, 0x5023, 0xDBA7, 0x5024, 0xF6B7, - 0x5026, 0xCFE6, 0x5027, 0xF0F2, 0x5028, 0xCBDA, 0x502A, 0xE7D2, - 0x502B, 0xD7C3, 0x502C, 0xF6F0, 0x502D, 0xE8DE, 0x503B, 0xE5A6, - 0x5043, 0xE5E7, 0x5047, 0xCAA3, 0x5048, 0xCCA7, 0x5049, 0xEAC9, - 0x504F, 0xF8B6, 0x5055, 0xFAA5, 0x505A, 0xF1AE, 0x505C, 0xEFCE, - 0x5065, 0xCBED, 0x5074, 0xF6B0, 0x5075, 0xEFCF, 0x5076, 0xE9CF, - 0x5078, 0xF7DE, 0x5080, 0xCED3, 0x5085, 0xDCF7, 0x508D, 0xDBA8, - 0x5091, 0xCBF8, 0x5098, 0xDFA1, 0x5099, 0xDDE1, 0x50AC, 0xF5CA, - 0x50AD, 0xE9B6, 0x50B2, 0xE7EC, 0x50B3, 0xEEEE, 0x50B5, 0xF3F0, - 0x50B7, 0xDFBF, 0x50BE, 0xCCCB, 0x50C5, 0xD0C1, 0x50C9, 0xF4D2, - 0x50CA, 0xE0BA, 0x50CF, 0xDFC0, 0x50D1, 0xCEE0, 0x50D5, 0xDCD2, - 0x50D6, 0xFDEA, 0x50DA, 0xD6F6, 0x50DE, 0xEACA, 0x50E5, 0xE8E9, - 0x50E7, 0xE3AC, 0x50ED, 0xF3D0, 0x50F9, 0xCAA4, 0x50FB, 0xDBF8, - 0x50FF, 0xDEC7, 0x5100, 0xEBF0, 0x5101, 0xF1D6, 0x5104, 0xE5E2, - 0x5106, 0xCCCC, 0x5109, 0xCBFB, 0x5112, 0xEAE3, 0x511F, 0xDFC1, - 0x5121, 0xD6ED, 0x512A, 0xE9D0, 0x5132, 0xEEB9, 0x5137, 0xD5E3, - 0x513A, 0xD1D3, 0x513C, 0xE5F0, 0x5140, 0xE8B4, 0x5141, 0xEBC3, - 0x5143, 0xEAAA, 0x5144, 0xFAFC, 0x5145, 0xF5F6, 0x5146, 0xF0BC, - 0x5147, 0xFDD4, 0x5148, 0xE0BB, 0x5149, 0xCEC3, 0x514B, 0xD0BA, - 0x514C, 0xF7BA, 0x514D, 0xD8F3, 0x514E, 0xF7CD, 0x5152, 0xE4AE, - 0x515C, 0xD4DF, 0x5162, 0xD0E7, 0x5165, 0xECFD, 0x5167, 0xD2AE, - 0x5168, 0xEEEF, 0x5169, 0xD5D7, 0x516A, 0xEAE4, 0x516B, 0xF8A2, - 0x516C, 0xCDEB, 0x516D, 0xD7BF, 0x516E, 0xFBB1, 0x5171, 0xCDEC, - 0x5175, 0xDCB2, 0x5176, 0xD0EC, 0x5177, 0xCEFD, 0x5178, 0xEEF0, - 0x517C, 0xCCC2, 0x5180, 0xD0ED, 0x5186, 0xE5F7, 0x518A, 0xF3FC, - 0x518D, 0xEEA2, 0x5192, 0xD9B3, 0x5195, 0xD8F4, 0x5197, 0xE9B7, - 0x51A0, 0xCEAE, 0x51A5, 0xD9A2, 0x51AA, 0xD8F1, 0x51AC, 0xD4CF, - 0x51B6, 0xE5A7, 0x51B7, 0xD5D2, 0x51BD, 0xD6A9, 0x51C4, 0xF4A2, - 0x51C6, 0xF1D7, 0x51C9, 0xD5D8, 0x51CB, 0xF0BD, 0x51CC, 0xD7D0, - 0x51CD, 0xD4D0, 0x51DC, 0xD7CF, 0x51DD, 0xEBEA, 0x51DE, 0xFDEB, - 0x51E1, 0xDBED, 0x51F0, 0xFCC5, 0x51F1, 0xCBC2, 0x51F6, 0xFDD5, - 0x51F8, 0xF4C8, 0x51F9, 0xE8EA, 0x51FA, 0xF5F3, 0x51FD, 0xF9DE, - 0x5200, 0xD3EF, 0x5203, 0xECD3, 0x5206, 0xDDC2, 0x5207, 0xEFB7, - 0x5208, 0xE7D4, 0x520A, 0xCACA, 0x520E, 0xD9FB, 0x5211, 0xFAFD, - 0x5217, 0xD6AA, 0x521D, 0xF4F8, 0x5224, 0xF7F7, 0x5225, 0xDCAC, - 0x5229, 0xD7D7, 0x522A, 0xDFA2, 0x522E, 0xCEBE, 0x5230, 0xD3F0, - 0x5236, 0xF0A4, 0x5237, 0xE1EC, 0x5238, 0xCFE7, 0x5239, 0xF3CB, - 0x523A, 0xEDA9, 0x523B, 0xCABE, 0x5243, 0xF4EF, 0x5247, 0xF6CE, - 0x524A, 0xDEFB, 0x524B, 0xD0BB, 0x524C, 0xD5B7, 0x524D, 0xEEF1, - 0x5254, 0xF4A8, 0x5256, 0xDCF8, 0x525B, 0xCBA7, 0x525D, 0xDACE, - 0x5261, 0xE0E6, 0x5269, 0xEDA5, 0x526A, 0xEEF2, 0x526F, 0xDCF9, - 0x5272, 0xF9DC, 0x5275, 0xF3DC, 0x527D, 0xF8F2, 0x527F, 0xF4F9, - 0x5283, 0xFCF1, 0x5287, 0xD0BC, 0x5288, 0xDBF9, 0x5289, 0xD7B1, - 0x528D, 0xCBFC, 0x5291, 0xF0A5, 0x5292, 0xCBFD, 0x529B, 0xD5F4, - 0x529F, 0xCDED, 0x52A0, 0xCAA5, 0x52A3, 0xD6AB, 0x52A4, 0xD0C2, - 0x52A9, 0xF0BE, 0x52AA, 0xD2BD, 0x52AB, 0xCCA4, 0x52BE, 0xFAB6, - 0x52C1, 0xCCCD, 0x52C3, 0xDAFA, 0x52C5, 0xF6CF, 0x52C7, 0xE9B8, - 0x52C9, 0xD8F5, 0x52CD, 0xCCCE, 0x52D2, 0xD7CD, 0x52D5, 0xD4D1, - 0x52D6, 0xE9ED, 0x52D8, 0xCAEB, 0x52D9, 0xD9E2, 0x52DB, 0xFDB2, - 0x52DD, 0xE3AD, 0x52DE, 0xD6CC, 0x52DF, 0xD9B4, 0x52E2, 0xE1A7, - 0x52E3, 0xEED3, 0x52E4, 0xD0C3, 0x52F3, 0xFDB3, 0x52F5, 0xD5E4, - 0x52F8, 0xCFE8, 0x52FA, 0xEDC3, 0x52FB, 0xD0B2, 0x52FE, 0xCEFE, - 0x52FF, 0xDAA8, 0x5305, 0xF8D0, 0x5308, 0xFDD6, 0x530D, 0xF8D1, - 0x530F, 0xF8D2, 0x5310, 0xDCD3, 0x5315, 0xDDE2, 0x5316, 0xFBF9, - 0x5317, 0xDDC1, 0x5319, 0xE3B5, 0x5320, 0xEDDD, 0x5321, 0xCEC4, - 0x5323, 0xCBA1, 0x532A, 0xDDE3, 0x532F, 0xFCDD, 0x5339, 0xF9AF, - 0x533F, 0xD2FB, 0x5340, 0xCFA1, 0x5341, 0xE4A8, 0x5343, 0xF4B6, - 0x5344, 0xECFE, 0x5347, 0xE3AE, 0x5348, 0xE7ED, 0x5349, 0xFDC1, - 0x534A, 0xDAE2, 0x534D, 0xD8B3, 0x5351, 0xDDE4, 0x5352, 0xF0EF, - 0x5353, 0xF6F1, 0x5354, 0xFAF0, 0x5357, 0xD1F5, 0x535A, 0xDACF, - 0x535C, 0xDCD4, 0x535E, 0xDCA6, 0x5360, 0xEFBF, 0x5366, 0xCECF, - 0x5368, 0xE0D9, 0x536F, 0xD9D6, 0x5370, 0xECD4, 0x5371, 0xEACB, - 0x5374, 0xCABF, 0x5375, 0xD5B0, 0x5377, 0xCFE9, 0x537D, 0xF1ED, - 0x537F, 0xCCCF, 0x5384, 0xE4F8, 0x5393, 0xE4ED, 0x5398, 0xD7D8, - 0x539A, 0xFDA7, 0x539F, 0xEAAB, 0x53A0, 0xF6B2, 0x53A5, 0xCFF0, - 0x53A6, 0xF9BD, 0x53AD, 0xE6F4, 0x53BB, 0xCBDB, 0x53C3, 0xF3D1, - 0x53C8, 0xE9D1, 0x53C9, 0xF3A9, 0x53CA, 0xD0E0, 0x53CB, 0xE9D2, - 0x53CD, 0xDAE3, 0x53D4, 0xE2D2, 0x53D6, 0xF6A2, 0x53D7, 0xE1F4, - 0x53DB, 0xDAE4, 0x53E1, 0xE7D5, 0x53E2, 0xF5BF, 0x53E3, 0xCFA2, - 0x53E4, 0xCDAF, 0x53E5, 0xCFA3, 0x53E9, 0xCDB0, 0x53EA, 0xF1FE, - 0x53EB, 0xD0A3, 0x53EC, 0xE1AF, 0x53ED, 0xF8A3, 0x53EF, 0xCAA6, - 0x53F0, 0xF7BB, 0x53F1, 0xF2EA, 0x53F2, 0xDEC8, 0x53F3, 0xE9D3, - 0x53F8, 0xDEC9, 0x5403, 0xFDDE, 0x5404, 0xCAC0, 0x5408, 0xF9EA, - 0x5409, 0xD1CE, 0x540A, 0xEED4, 0x540C, 0xD4D2, 0x540D, 0xD9A3, - 0x540E, 0xFDA8, 0x540F, 0xD7D9, 0x5410, 0xF7CE, 0x5411, 0xFABE, - 0x541B, 0xCFD6, 0x541D, 0xD7F0, 0x541F, 0xEBE1, 0x5420, 0xF8C5, - 0x5426, 0xDCFA, 0x5429, 0xDDC3, 0x542B, 0xF9DF, 0x5433, 0xE7EF, - 0x5438, 0xFDE5, 0x5439, 0xF6A3, 0x543B, 0xD9FC, 0x543C, 0xFDA9, - 0x543E, 0xE7EE, 0x5442, 0xD5E5, 0x5448, 0xEFD0, 0x544A, 0xCDB1, - 0x5451, 0xF7A2, 0x5468, 0xF1B2, 0x546A, 0xF1B1, 0x5471, 0xCDB2, - 0x5473, 0xDAAB, 0x5475, 0xCAA7, 0x547B, 0xE3E2, 0x547C, 0xFBBC, - 0x547D, 0xD9A4, 0x5480, 0xEEBA, 0x5486, 0xF8D3, 0x548C, 0xFBFA, - 0x548E, 0xCFA4, 0x5490, 0xDCFB, 0x54A4, 0xF6E3, 0x54A8, 0xEDAA, - 0x54AB, 0xF2A1, 0x54AC, 0xCEE1, 0x54B3, 0xFAA6, 0x54B8, 0xF9E0, - 0x54BD, 0xECD6, 0x54C0, 0xE4EE, 0x54C1, 0xF9A1, 0x54C4, 0xFBEF, - 0x54C8, 0xF9EB, 0x54C9, 0xEEA3, 0x54E1, 0xEAAC, 0x54E5, 0xCAA8, - 0x54E8, 0xF4FA, 0x54ED, 0xCDD6, 0x54EE, 0xFCF6, 0x54F2, 0xF4C9, - 0x54FA, 0xF8D4, 0x5504, 0xF8A6, 0x5506, 0xDECA, 0x5507, 0xF2C6, - 0x550E, 0xD7DA, 0x5510, 0xD3D0, 0x551C, 0xD8C5, 0x552F, 0xEAE6, - 0x5531, 0xF3DD, 0x5535, 0xE4DA, 0x553E, 0xF6E4, 0x5544, 0xF6F2, - 0x5546, 0xDFC2, 0x554F, 0xD9FD, 0x5553, 0xCCF6, 0x5556, 0xD3BA, - 0x555E, 0xE4AF, 0x5563, 0xF9E1, 0x557C, 0xF0A6, 0x5580, 0xCBD3, - 0x5584, 0xE0BC, 0x5586, 0xF4CA, 0x5587, 0xD4FA, 0x5589, 0xFDAA, - 0x558A, 0xF9E2, 0x5598, 0xF4B7, 0x5599, 0xFDC2, 0x559A, 0xFCB0, - 0x559C, 0xFDEC, 0x559D, 0xCAE2, 0x55A7, 0xFDBD, 0x55A9, 0xEAE7, - 0x55AA, 0xDFC3, 0x55AB, 0xD1D2, 0x55AC, 0xCEE2, 0x55AE, 0xD3A4, - 0x55C5, 0xFDAB, 0x55C7, 0xDFE0, 0x55D4, 0xF2C7, 0x55DA, 0xE7F0, - 0x55DC, 0xD0EE, 0x55DF, 0xF3AA, 0x55E3, 0xDECB, 0x55E4, 0xF6B8, - 0x55FD, 0xE1F5, 0x55FE, 0xF1B3, 0x5606, 0xF7A3, 0x5609, 0xCAA9, - 0x5614, 0xCFA5, 0x5617, 0xDFC4, 0x562F, 0xE1B0, 0x5632, 0xF0BF, - 0x5634, 0xF6A4, 0x5636, 0xE3B6, 0x5653, 0xFAC6, 0x5668, 0xD0EF, - 0x566B, 0xFDED, 0x5674, 0xDDC4, 0x5686, 0xFCF7, 0x56A5, 0xE6BF, - 0x56AC, 0xDEAD, 0x56AE, 0xFABF, 0x56B4, 0xE5F1, 0x56BC, 0xEDC4, - 0x56CA, 0xD2A5, 0x56CD, 0xFDEE, 0x56D1, 0xF5B6, 0x56DA, 0xE1F6, - 0x56DB, 0xDECC, 0x56DE, 0xFCDE, 0x56E0, 0xECD7, 0x56F0, 0xCDDD, - 0x56F9, 0xD6B7, 0x56FA, 0xCDB3, 0x5703, 0xF8D5, 0x5704, 0xE5D8, - 0x5708, 0xCFEA, 0x570B, 0xCFD0, 0x570D, 0xEACC, 0x5712, 0xEAAE, - 0x5713, 0xEAAD, 0x5716, 0xD3F1, 0x5718, 0xD3A5, 0x571F, 0xF7CF, - 0x5728, 0xEEA4, 0x572D, 0xD0A4, 0x5730, 0xF2A2, 0x573B, 0xD0F0, - 0x5740, 0xF2A3, 0x5742, 0xF7F8, 0x5747, 0xD0B3, 0x574A, 0xDBA9, - 0x574D, 0xD3BB, 0x574E, 0xCAEC, 0x5750, 0xF1A6, 0x5751, 0xCBD5, - 0x5761, 0xF7E7, 0x5764, 0xCDDE, 0x5766, 0xF7A4, 0x576A, 0xF8C0, - 0x576E, 0xD3DD, 0x5770, 0xCCD0, 0x5775, 0xCFA6, 0x577C, 0xF6F3, - 0x5782, 0xE1F7, 0x5788, 0xD3DC, 0x578B, 0xFAFE, 0x5793, 0xFAA7, - 0x57A0, 0xEBD9, 0x57A2, 0xCFA7, 0x57A3, 0xEAAF, 0x57C3, 0xE4EF, - 0x57C7, 0xE9B9, 0x57C8, 0xF1D8, 0x57CB, 0xD8D8, 0x57CE, 0xE0F2, - 0x57DF, 0xE6B4, 0x57E0, 0xDCFC, 0x57F0, 0xF3F1, 0x57F4, 0xE3D0, - 0x57F7, 0xF2FB, 0x57F9, 0xDBC6, 0x57FA, 0xD0F1, 0x57FC, 0xD0F2, - 0x5800, 0xCFDC, 0x5802, 0xD3D1, 0x5805, 0xCCB1, 0x5806, 0xF7D8, - 0x5808, 0xCBA8, 0x5809, 0xEBBC, 0x580A, 0xE4BE, 0x581E, 0xF4DC, - 0x5821, 0xDCC2, 0x5824, 0xF0A7, 0x5827, 0xE6C0, 0x582A, 0xCAED, - 0x582F, 0xE8EB, 0x5830, 0xE5E8, 0x5831, 0xDCC3, 0x5834, 0xEDDE, - 0x5835, 0xD3F2, 0x583A, 0xCCF7, 0x584A, 0xCED4, 0x584B, 0xE7AB, - 0x584F, 0xCBC3, 0x5851, 0xE1B1, 0x5854, 0xF7B2, 0x5857, 0xD3F3, - 0x5858, 0xD3D2, 0x585A, 0xF5C0, 0x585E, 0xDFDD, 0x5861, 0xEEF3, - 0x5862, 0xE7F1, 0x5864, 0xFDB4, 0x5875, 0xF2C8, 0x5879, 0xF3D2, - 0x587C, 0xEEF4, 0x587E, 0xE2D3, 0x5883, 0xCCD1, 0x5885, 0xDFEA, - 0x5889, 0xE9BA, 0x5893, 0xD9D7, 0x589C, 0xF5CD, 0x589E, 0xF1F2, - 0x589F, 0xFAC7, 0x58A8, 0xD9F8, 0x58A9, 0xD4C2, 0x58AE, 0xF6E5, - 0x58B3, 0xDDC5, 0x58BA, 0xE7F2, 0x58BB, 0xEDDF, 0x58BE, 0xCACB, - 0x58C1, 0xDBFA, 0x58C5, 0xE8B5, 0x58C7, 0xD3A6, 0x58CE, 0xFDB5, - 0x58D1, 0xF9C9, 0x58D3, 0xE4E2, 0x58D5, 0xFBBD, 0x58D8, 0xD7A4, - 0x58D9, 0xCEC5, 0x58DE, 0xCED5, 0x58DF, 0xD6E6, 0x58E4, 0xE5BD, - 0x58EB, 0xDECD, 0x58EC, 0xECF3, 0x58EF, 0xEDE0, 0x58F9, 0xECEC, - 0x58FA, 0xFBBE, 0x58FB, 0xDFEB, 0x58FD, 0xE1F8, 0x590F, 0xF9BE, - 0x5914, 0xD0F3, 0x5915, 0xE0AA, 0x5916, 0xE8E2, 0x5919, 0xE2D4, - 0x591A, 0xD2FD, 0x591C, 0xE5A8, 0x5922, 0xD9D3, 0x5927, 0xD3DE, - 0x5929, 0xF4B8, 0x592A, 0xF7BC, 0x592B, 0xDCFD, 0x592D, 0xE8EC, - 0x592E, 0xE4E7, 0x5931, 0xE3F7, 0x5937, 0xECA8, 0x593E, 0xFAF1, - 0x5944, 0xE5F2, 0x5947, 0xD0F4, 0x5948, 0xD2AF, 0x5949, 0xDCE5, - 0x594E, 0xD0A5, 0x594F, 0xF1B4, 0x5950, 0xFCB1, 0x5951, 0xCCF8, - 0x5954, 0xDDC6, 0x5955, 0xFAD1, 0x5957, 0xF7DF, 0x595A, 0xFAA8, - 0x5960, 0xEEF5, 0x5962, 0xDECE, 0x5967, 0xE7F3, 0x596A, 0xF7AC, - 0x596B, 0xEBC4, 0x596C, 0xEDE1, 0x596D, 0xE0AB, 0x596E, 0xDDC7, - 0x5973, 0xD2B3, 0x5974, 0xD2BF, 0x5978, 0xCACC, 0x597D, 0xFBBF, - 0x5982, 0xE5FD, 0x5983, 0xDDE5, 0x5984, 0xD8CD, 0x598A, 0xECF4, - 0x5993, 0xD0F5, 0x5996, 0xE8ED, 0x5997, 0xD0D2, 0x5999, 0xD9D8, - 0x59A5, 0xF6E6, 0x59A8, 0xDBAA, 0x59AC, 0xF7E0, 0x59B9, 0xD8D9, - 0x59BB, 0xF4A3, 0x59BE, 0xF4DD, 0x59C3, 0xEFD1, 0x59C6, 0xD9B5, - 0x59C9, 0xEDAB, 0x59CB, 0xE3B7, 0x59D0, 0xEEBB, 0x59D1, 0xCDB4, - 0x59D3, 0xE0F3, 0x59D4, 0xEACD, 0x59D9, 0xECF5, 0x59DA, 0xE8EE, - 0x59DC, 0xCBA9, 0x59DD, 0xF1AF, 0x59E6, 0xCACD, 0x59E8, 0xECA9, - 0x59EA, 0xF2EB, 0x59EC, 0xFDEF, 0x59EE, 0xF9F3, 0x59F8, 0xE6C1, - 0x59FB, 0xECD8, 0x59FF, 0xEDAC, 0x5A01, 0xEACE, 0x5A03, 0xE8DF, - 0x5A11, 0xDECF, 0x5A18, 0xD2A6, 0x5A1B, 0xE7F4, 0x5A1C, 0xD1D6, - 0x5A1F, 0xE6C2, 0x5A20, 0xE3E3, 0x5A25, 0xE4B0, 0x5A29, 0xD8B4, - 0x5A36, 0xF6A5, 0x5A3C, 0xF3DE, 0x5A41, 0xD7A5, 0x5A46, 0xF7E8, - 0x5A49, 0xE8C6, 0x5A5A, 0xFBE6, 0x5A62, 0xDDE6, 0x5A66, 0xDCFE, - 0x5A92, 0xD8DA, 0x5A9A, 0xDAAC, 0x5A9B, 0xEAB0, 0x5AA4, 0xE3B8, - 0x5AC1, 0xCAAA, 0x5AC2, 0xE1F9, 0x5AC4, 0xEAB1, 0x5AC9, 0xF2EC, - 0x5ACC, 0xFAEE, 0x5AE1, 0xEED5, 0x5AE6, 0xF9F4, 0x5AE9, 0xD2EC, - 0x5B05, 0xFBFB, 0x5B09, 0xFDF0, 0x5B0B, 0xE0BD, 0x5B0C, 0xCEE3, - 0x5B16, 0xF8C6, 0x5B2A, 0xDEAE, 0x5B40, 0xDFC5, 0x5B43, 0xE5BE, - 0x5B50, 0xEDAD, 0x5B51, 0xFAEA, 0x5B54, 0xCDEE, 0x5B55, 0xEDA6, - 0x5B57, 0xEDAE, 0x5B58, 0xF0ED, 0x5B5A, 0xDDA1, 0x5B5C, 0xEDAF, - 0x5B5D, 0xFCF8, 0x5B5F, 0xD8EB, 0x5B63, 0xCCF9, 0x5B64, 0xCDB5, - 0x5B69, 0xFAA9, 0x5B6B, 0xE1DD, 0x5B70, 0xE2D5, 0x5B71, 0xEDCF, - 0x5B75, 0xDDA2, 0x5B78, 0xF9CA, 0x5B7A, 0xEAE8, 0x5B7C, 0xE5ED, - 0x5B85, 0xD3EB, 0x5B87, 0xE9D4, 0x5B88, 0xE1FA, 0x5B89, 0xE4CC, - 0x5B8B, 0xE1E4, 0x5B8C, 0xE8C7, 0x5B8F, 0xCEDB, 0x5B93, 0xDCD5, - 0x5B95, 0xF7B5, 0x5B96, 0xFCF3, 0x5B97, 0xF0F3, 0x5B98, 0xCEAF, - 0x5B99, 0xF1B5, 0x5B9A, 0xEFD2, 0x5B9B, 0xE8C8, 0x5B9C, 0xEBF1, - 0x5BA2, 0xCBD4, 0x5BA3, 0xE0BE, 0x5BA4, 0xE3F8, 0x5BA5, 0xEAE9, - 0x5BA6, 0xFCB2, 0x5BAC, 0xE0F4, 0x5BAE, 0xCFE0, 0x5BB0, 0xEEA5, - 0x5BB3, 0xFAAA, 0x5BB4, 0xE6C3, 0x5BB5, 0xE1B2, 0x5BB6, 0xCAAB, - 0x5BB8, 0xE3E4, 0x5BB9, 0xE9BB, 0x5BBF, 0xE2D6, 0x5BC0, 0xF3F2, - 0x5BC2, 0xEED6, 0x5BC3, 0xEAB2, 0x5BC4, 0xD0F6, 0x5BC5, 0xECD9, - 0x5BC6, 0xDACB, 0x5BC7, 0xCFA8, 0x5BCC, 0xDDA3, 0x5BD0, 0xD8DB, - 0x5BD2, 0xF9CE, 0x5BD3, 0xE9D5, 0x5BD4, 0xE3D1, 0x5BD7, 0xD2BC, - 0x5BDE, 0xD8AC, 0x5BDF, 0xF3CC, 0x5BE1, 0xCDFB, 0x5BE2, 0xF6D6, - 0x5BE4, 0xE7F5, 0x5BE5, 0xE8EF, 0x5BE6, 0xE3F9, 0x5BE7, 0xD2BB, - 0x5BE8, 0xF3F3, 0x5BE9, 0xE3FB, 0x5BEB, 0xDED0, 0x5BEC, 0xCEB0, - 0x5BEE, 0xD6F7, 0x5BEF, 0xF1D9, 0x5BF5, 0xF5C1, 0x5BF6, 0xDCC4, - 0x5BF8, 0xF5BB, 0x5BFA, 0xDED1, 0x5C01, 0xDCE6, 0x5C04, 0xDED2, - 0x5C07, 0xEDE2, 0x5C08, 0xEEF6, 0x5C09, 0xEACF, 0x5C0A, 0xF0EE, - 0x5C0B, 0xE3FC, 0x5C0D, 0xD3DF, 0x5C0E, 0xD3F4, 0x5C0F, 0xE1B3, - 0x5C11, 0xE1B4, 0x5C16, 0xF4D3, 0x5C19, 0xDFC6, 0x5C24, 0xE9D6, - 0x5C28, 0xDBAB, 0x5C31, 0xF6A6, 0x5C38, 0xE3B9, 0x5C39, 0xEBC5, - 0x5C3A, 0xF4A9, 0x5C3B, 0xCDB6, 0x5C3C, 0xD2F9, 0x5C3E, 0xDAAD, - 0x5C3F, 0xD2E3, 0x5C40, 0xCFD1, 0x5C45, 0xCBDC, 0x5C46, 0xCCFA, - 0x5C48, 0xCFDD, 0x5C4B, 0xE8A9, 0x5C4D, 0xE3BB, 0x5C4E, 0xE3BA, - 0x5C51, 0xE0DA, 0x5C55, 0xEEF7, 0x5C5B, 0xDCB3, 0x5C60, 0xD3F5, - 0x5C62, 0xD7A6, 0x5C64, 0xF6B5, 0x5C65, 0xD7DB, 0x5C6C, 0xE1D5, - 0x5C6F, 0xD4EA, 0x5C71, 0xDFA3, 0x5C79, 0xFDDF, 0x5C90, 0xD0F7, - 0x5C91, 0xEDD4, 0x5CA1, 0xCBAA, 0x5CA9, 0xE4DB, 0x5CAB, 0xE1FB, - 0x5CAC, 0xCBA2, 0x5CB1, 0xD3E0, 0x5CB3, 0xE4BF, 0x5CB5, 0xFBC0, - 0x5CB7, 0xDABE, 0x5CB8, 0xE4CD, 0x5CBA, 0xD6B9, 0x5CBE, 0xEFC0, - 0x5CC0, 0xE1FC, 0x5CD9, 0xF6B9, 0x5CE0, 0xDFC7, 0x5CE8, 0xE4B1, - 0x5CEF, 0xDCE7, 0x5CF0, 0xDCE8, 0x5CF4, 0xFAD6, 0x5CF6, 0xD3F6, - 0x5CFB, 0xF1DA, 0x5CFD, 0xFAF2, 0x5D07, 0xE2FD, 0x5D0D, 0xD5CF, - 0x5D0E, 0xD0F8, 0x5D11, 0xCDDF, 0x5D14, 0xF5CB, 0x5D16, 0xE4F0, - 0x5D17, 0xCBAB, 0x5D19, 0xD7C4, 0x5D27, 0xE2FE, 0x5D29, 0xDDDA, - 0x5D4B, 0xDAAE, 0x5D4C, 0xCAEE, 0x5D50, 0xD5B9, 0x5D69, 0xE3A1, - 0x5D6C, 0xE8E3, 0x5D6F, 0xF3AB, 0x5D87, 0xCFA9, 0x5D8B, 0xD3F7, - 0x5D9D, 0xD4F1, 0x5DA0, 0xCEE4, 0x5DA2, 0xE8F2, 0x5DAA, 0xE5F5, - 0x5DB8, 0xE7AE, 0x5DBA, 0xD6BA, 0x5DBC, 0xDFEC, 0x5DBD, 0xE4C0, - 0x5DCD, 0xE8E4, 0x5DD2, 0xD8B5, 0x5DD6, 0xE4DC, 0x5DDD, 0xF4B9, - 0x5DDE, 0xF1B6, 0x5DE1, 0xE2DE, 0x5DE2, 0xE1B5, 0x5DE5, 0xCDEF, - 0x5DE6, 0xF1A7, 0x5DE7, 0xCEE5, 0x5DE8, 0xCBDD, 0x5DEB, 0xD9E3, - 0x5DEE, 0xF3AC, 0x5DF1, 0xD0F9, 0x5DF2, 0xECAB, 0x5DF3, 0xDED3, - 0x5DF4, 0xF7E9, 0x5DF7, 0xF9F5, 0x5DFD, 0xE1DE, 0x5DFE, 0xCBEE, - 0x5E02, 0xE3BC, 0x5E03, 0xF8D6, 0x5E06, 0xDBEE, 0x5E0C, 0xFDF1, - 0x5E11, 0xF7B6, 0x5E16, 0xF4DE, 0x5E19, 0xF2ED, 0x5E1B, 0xDBD9, - 0x5E1D, 0xF0A8, 0x5E25, 0xE1FD, 0x5E2B, 0xDED4, 0x5E2D, 0xE0AC, - 0x5E33, 0xEDE3, 0x5E36, 0xD3E1, 0x5E38, 0xDFC8, 0x5E3D, 0xD9B6, - 0x5E3F, 0xFDAC, 0x5E40, 0xEFD3, 0x5E44, 0xE4C1, 0x5E45, 0xF8EB, - 0x5E47, 0xDBAC, 0x5E4C, 0xFCC6, 0x5E55, 0xD8AD, 0x5E5F, 0xF6BA, - 0x5E61, 0xDBDF, 0x5E62, 0xD3D3, 0x5E63, 0xF8C7, 0x5E72, 0xCACE, - 0x5E73, 0xF8C1, 0x5E74, 0xD2B4, 0x5E77, 0xDCB4, 0x5E78, 0xFAB9, - 0x5E79, 0xCACF, 0x5E7B, 0xFCB3, 0x5E7C, 0xEAEA, 0x5E7D, 0xEAEB, - 0x5E7E, 0xD0FA, 0x5E84, 0xEDE4, 0x5E87, 0xDDE7, 0x5E8A, 0xDFC9, - 0x5E8F, 0xDFED, 0x5E95, 0xEEBC, 0x5E97, 0xEFC1, 0x5E9A, 0xCCD2, - 0x5E9C, 0xDDA4, 0x5EA0, 0xDFCA, 0x5EA6, 0xD3F8, 0x5EA7, 0xF1A8, - 0x5EAB, 0xCDB7, 0x5EAD, 0xEFD4, 0x5EB5, 0xE4DD, 0x5EB6, 0xDFEE, - 0x5EB7, 0xCBAC, 0x5EB8, 0xE9BC, 0x5EBE, 0xEAEC, 0x5EC2, 0xDFCB, - 0x5EC8, 0xF9BF, 0x5EC9, 0xD6AF, 0x5ECA, 0xD5C6, 0x5ED0, 0xCFAA, - 0x5ED3, 0xCEA9, 0x5ED6, 0xD6F8, 0x5EDA, 0xF1B7, 0x5EDB, 0xEEF8, - 0x5EDF, 0xD9D9, 0x5EE0, 0xF3DF, 0x5EE2, 0xF8C8, 0x5EE3, 0xCEC6, - 0x5EEC, 0xD5E6, 0x5EF3, 0xF4E6, 0x5EF6, 0xE6C5, 0x5EF7, 0xEFD5, - 0x5EFA, 0xCBEF, 0x5EFB, 0xFCDF, 0x5F01, 0xDCA7, 0x5F04, 0xD6E7, - 0x5F0A, 0xF8C9, 0x5F0F, 0xE3D2, 0x5F11, 0xE3BD, 0x5F13, 0xCFE1, - 0x5F14, 0xF0C0, 0x5F15, 0xECDA, 0x5F17, 0xDDD7, 0x5F18, 0xFBF0, - 0x5F1B, 0xECAC, 0x5F1F, 0xF0A9, 0x5F26, 0xFAD7, 0x5F27, 0xFBC1, - 0x5F29, 0xD2C0, 0x5F31, 0xE5B0, 0x5F35, 0xEDE5, 0x5F3A, 0xCBAD, - 0x5F3C, 0xF9B0, 0x5F48, 0xF7A5, 0x5F4A, 0xCBAE, 0x5F4C, 0xDAAF, - 0x5F4E, 0xD8B6, 0x5F56, 0xD3A7, 0x5F57, 0xFBB2, 0x5F59, 0xFDC4, - 0x5F5B, 0xECAD, 0x5F62, 0xFBA1, 0x5F66, 0xE5E9, 0x5F67, 0xE9EE, - 0x5F69, 0xF3F4, 0x5F6A, 0xF8F3, 0x5F6B, 0xF0C1, 0x5F6C, 0xDEAF, - 0x5F6D, 0xF8B0, 0x5F70, 0xF3E0, 0x5F71, 0xE7AF, 0x5F77, 0xDBAD, - 0x5F79, 0xE6B5, 0x5F7C, 0xF9A8, 0x5F7F, 0xDDD8, 0x5F80, 0xE8D9, - 0x5F81, 0xEFD6, 0x5F85, 0xD3E2, 0x5F87, 0xE2DF, 0x5F8A, 0xFCE0, - 0x5F8B, 0xD7C8, 0x5F8C, 0xFDAD, 0x5F90, 0xDFEF, 0x5F91, 0xCCD3, - 0x5F92, 0xD3F9, 0x5F97, 0xD4F0, 0x5F98, 0xDBC7, 0x5F99, 0xDED5, - 0x5F9E, 0xF0F4, 0x5FA0, 0xD5D0, 0x5FA1, 0xE5D9, 0x5FA8, 0xFCC7, - 0x5FA9, 0xDCD6, 0x5FAA, 0xE2E0, 0x5FAE, 0xDAB0, 0x5FB5, 0xF3A3, - 0x5FB7, 0xD3EC, 0x5FB9, 0xF4CB, 0x5FBD, 0xFDC5, 0x5FC3, 0xE3FD, - 0x5FC5, 0xF9B1, 0x5FCC, 0xD0FB, 0x5FCD, 0xECDB, 0x5FD6, 0xF5BC, - 0x5FD7, 0xF2A4, 0x5FD8, 0xD8CE, 0x5FD9, 0xD8CF, 0x5FE0, 0xF5F7, - 0x5FEB, 0xF6E1, 0x5FF5, 0xD2B7, 0x5FFD, 0xFBEC, 0x5FFF, 0xDDC8, - 0x600F, 0xE4E8, 0x6012, 0xD2C1, 0x6016, 0xF8D7, 0x601C, 0xD6BB, - 0x601D, 0xDED6, 0x6020, 0xF7BD, 0x6021, 0xECAE, 0x6025, 0xD0E1, - 0x6027, 0xE0F5, 0x6028, 0xEAB3, 0x602A, 0xCED6, 0x602F, 0xCCA5, - 0x6041, 0xECF6, 0x6042, 0xE2E1, 0x6043, 0xE3BE, 0x604D, 0xFCC8, - 0x6050, 0xCDF0, 0x6052, 0xF9F6, 0x6055, 0xDFF0, 0x6059, 0xE5BF, - 0x605D, 0xCEBF, 0x6062, 0xFCE1, 0x6063, 0xEDB0, 0x6064, 0xFDD1, - 0x6065, 0xF6BB, 0x6068, 0xF9CF, 0x6069, 0xEBDA, 0x606A, 0xCAC1, - 0x606C, 0xD2B8, 0x606D, 0xCDF1, 0x606F, 0xE3D3, 0x6070, 0xFDE6, - 0x6085, 0xE6ED, 0x6089, 0xE3FA, 0x608C, 0xF0AA, 0x608D, 0xF9D0, - 0x6094, 0xFCE2, 0x6096, 0xF8A7, 0x609A, 0xE1E5, 0x609B, 0xEEF9, - 0x609F, 0xE7F6, 0x60A0, 0xEAED, 0x60A3, 0xFCB4, 0x60A4, 0xF5C2, - 0x60A7, 0xD7DC, 0x60B0, 0xF0F5, 0x60B2, 0xDDE8, 0x60B3, 0xD3ED, - 0x60B4, 0xF5FC, 0x60B6, 0xDABF, 0x60B8, 0xCCFB, 0x60BC, 0xD3FA, - 0x60BD, 0xF4A4, 0x60C5, 0xEFD7, 0x60C7, 0xD4C3, 0x60D1, 0xFBE3, - 0x60DA, 0xFBED, 0x60DC, 0xE0AD, 0x60DF, 0xEAEE, 0x60E0, 0xFBB3, - 0x60E1, 0xE4C2, 0x60F0, 0xF6E7, 0x60F1, 0xD2DD, 0x60F3, 0xDFCC, - 0x60F6, 0xFCC9, 0x60F9, 0xE5A9, 0x60FA, 0xE0F6, 0x60FB, 0xF6B3, - 0x6101, 0xE1FE, 0x6106, 0xCBF0, 0x6108, 0xEAEF, 0x6109, 0xEAF0, - 0x610D, 0xDAC0, 0x610E, 0xF8B4, 0x610F, 0xEBF2, 0x6115, 0xE4C3, - 0x611A, 0xE9D7, 0x611B, 0xE4F1, 0x611F, 0xCAEF, 0x6127, 0xCED7, - 0x6130, 0xFCCA, 0x6134, 0xF3E1, 0x6137, 0xCBC4, 0x613C, 0xE3E5, - 0x613E, 0xCBC5, 0x613F, 0xEAB4, 0x6142, 0xE9BD, 0x6144, 0xD7C9, - 0x6147, 0xEBDB, 0x6148, 0xEDB1, 0x614A, 0xCCC3, 0x614B, 0xF7BE, - 0x614C, 0xFCCB, 0x6153, 0xF8F4, 0x6155, 0xD9B7, 0x6158, 0xF3D3, - 0x6159, 0xF3D4, 0x615D, 0xF7E4, 0x615F, 0xF7D1, 0x6162, 0xD8B7, - 0x6163, 0xCEB1, 0x6164, 0xCAC2, 0x6167, 0xFBB4, 0x6168, 0xCBC6, - 0x616B, 0xF0F6, 0x616E, 0xD5E7, 0x6170, 0xEAD0, 0x6176, 0xCCD4, - 0x6177, 0xCBAF, 0x617D, 0xF4AA, 0x617E, 0xE9AF, 0x6181, 0xF5C3, - 0x6182, 0xE9D8, 0x618A, 0xDDE9, 0x618E, 0xF1F3, 0x6190, 0xD5FB, - 0x6191, 0xDEBB, 0x6194, 0xF4FB, 0x6198, 0xFDF3, 0x6199, 0xFDF2, - 0x619A, 0xF7A6, 0x61A4, 0xDDC9, 0x61A7, 0xD4D3, 0x61A9, 0xCCA8, - 0x61AB, 0xDAC1, 0x61AC, 0xCCD5, 0x61AE, 0xD9E4, 0x61B2, 0xFACA, - 0x61B6, 0xE5E3, 0x61BA, 0xD3BC, 0x61BE, 0xCAF0, 0x61C3, 0xD0C4, - 0x61C7, 0xCAD0, 0x61C8, 0xFAAB, 0x61C9, 0xEBEB, 0x61CA, 0xE7F8, - 0x61CB, 0xD9E5, 0x61E6, 0xD1D7, 0x61F2, 0xF3A4, 0x61F6, 0xD4FB, - 0x61F7, 0xFCE3, 0x61F8, 0xFAD8, 0x61FA, 0xF3D5, 0x61FC, 0xCFAB, - 0x61FF, 0xEBF3, 0x6200, 0xD5FC, 0x6207, 0xD3D4, 0x6208, 0xCDFC, - 0x620A, 0xD9E6, 0x620C, 0xE2F9, 0x620D, 0xE2A1, 0x620E, 0xEBD4, - 0x6210, 0xE0F7, 0x6211, 0xE4B2, 0x6212, 0xCCFC, 0x6216, 0xFBE4, - 0x621A, 0xF4AB, 0x621F, 0xD0BD, 0x6221, 0xCAF1, 0x622A, 0xEFB8, - 0x622E, 0xD7C0, 0x6230, 0xEEFA, 0x6231, 0xFDF4, 0x6234, 0xD3E3, - 0x6236, 0xFBC2, 0x623E, 0xD5E8, 0x623F, 0xDBAE, 0x6240, 0xE1B6, - 0x6241, 0xF8B7, 0x6247, 0xE0BF, 0x6248, 0xFBC3, 0x6249, 0xDDEA, - 0x624B, 0xE2A2, 0x624D, 0xEEA6, 0x6253, 0xF6E8, 0x6258, 0xF6F5, - 0x626E, 0xDDCA, 0x6271, 0xD0E2, 0x6276, 0xDDA6, 0x6279, 0xDDEB, - 0x627C, 0xE4F9, 0x627F, 0xE3AF, 0x6280, 0xD0FC, 0x6284, 0xF4FC, - 0x6289, 0xCCBC, 0x628A, 0xF7EA, 0x6291, 0xE5E4, 0x6292, 0xDFF1, - 0x6295, 0xF7E1, 0x6297, 0xF9F7, 0x6298, 0xEFB9, 0x629B, 0xF8D8, - 0x62AB, 0xF9A9, 0x62B1, 0xF8D9, 0x62B5, 0xEEBD, 0x62B9, 0xD8C6, - 0x62BC, 0xE4E3, 0x62BD, 0xF5CE, 0x62C2, 0xDDD9, 0x62C7, 0xD9E7, - 0x62C8, 0xD2B9, 0x62C9, 0xD5C3, 0x62CC, 0xDAE5, 0x62CD, 0xDAD0, - 0x62CF, 0xD1D9, 0x62D0, 0xCED8, 0x62D2, 0xCBDE, 0x62D3, 0xF4AC, - 0x62D4, 0xDAFB, 0x62D6, 0xF6E9, 0x62D7, 0xE8F3, 0x62D8, 0xCFAC, - 0x62D9, 0xF0F0, 0x62DB, 0xF4FD, 0x62DC, 0xDBC8, 0x62EC, 0xCEC0, - 0x62ED, 0xE3D4, 0x62EE, 0xD1CF, 0x62EF, 0xF1F5, 0x62F1, 0xCDF2, - 0x62F3, 0xCFEB, 0x62F7, 0xCDB8, 0x62FE, 0xE3A6, 0x62FF, 0xD1DA, - 0x6301, 0xF2A5, 0x6307, 0xF2A6, 0x6309, 0xE4CE, 0x6311, 0xD3FB, - 0x632B, 0xF1A9, 0x632F, 0xF2C9, 0x633A, 0xEFD8, 0x633B, 0xE6C9, - 0x633D, 0xD8B8, 0x633E, 0xFAF3, 0x6349, 0xF3B5, 0x634C, 0xF8A4, - 0x634F, 0xD1F3, 0x6350, 0xE6C8, 0x6355, 0xF8DA, 0x6367, 0xDCE9, - 0x6368, 0xDED7, 0x636E, 0xCBDF, 0x6372, 0xCFEC, 0x6377, 0xF4DF, - 0x637A, 0xD1F4, 0x637B, 0xD2BA, 0x637F, 0xDFF2, 0x6383, 0xE1B7, - 0x6388, 0xE2A3, 0x6389, 0xD3FC, 0x638C, 0xEDE6, 0x6392, 0xDBC9, - 0x6396, 0xE4FA, 0x6398, 0xCFDE, 0x639B, 0xCED0, 0x63A0, 0xD5D3, - 0x63A1, 0xF3F5, 0x63A2, 0xF7AE, 0x63A5, 0xEFC8, 0x63A7, 0xCDF3, - 0x63A8, 0xF5CF, 0x63A9, 0xE5F3, 0x63AA, 0xF0C2, 0x63C0, 0xCAD1, - 0x63C4, 0xEAF1, 0x63C6, 0xD0A6, 0x63CF, 0xD9DA, 0x63D0, 0xF0AB, - 0x63D6, 0xEBE7, 0x63DA, 0xE5C0, 0x63DB, 0xFCB5, 0x63E1, 0xE4C4, - 0x63ED, 0xCCA9, 0x63EE, 0xFDC6, 0x63F4, 0xEAB5, 0x63F6, 0xE5AA, - 0x63F7, 0xDFBA, 0x640D, 0xE1DF, 0x640F, 0xDAD1, 0x6414, 0xE1B8, - 0x6416, 0xE8F4, 0x6417, 0xD3FD, 0x641C, 0xE2A4, 0x6422, 0xF2CA, - 0x642C, 0xDAE6, 0x642D, 0xF7B3, 0x643A, 0xFDCD, 0x643E, 0xF3B6, - 0x6458, 0xEED7, 0x6460, 0xF5C4, 0x6469, 0xD8A4, 0x646F, 0xF2A7, - 0x6478, 0xD9B8, 0x6479, 0xD9B9, 0x647A, 0xEFC9, 0x6488, 0xD6CE, - 0x6491, 0xF7CB, 0x6492, 0xDFAE, 0x6493, 0xE8F5, 0x649A, 0xD2B5, - 0x649E, 0xD3D5, 0x64A4, 0xF4CC, 0x64A5, 0xDAFC, 0x64AB, 0xD9E8, - 0x64AD, 0xF7EB, 0x64AE, 0xF5C9, 0x64B0, 0xF3BC, 0x64B2, 0xDAD2, - 0x64BB, 0xD3B5, 0x64C1, 0xE8B6, 0x64C4, 0xD6CF, 0x64C5, 0xF4BA, - 0x64C7, 0xF7C9, 0x64CA, 0xCCAA, 0x64CD, 0xF0C3, 0x64CE, 0xCCD6, - 0x64D2, 0xD0D3, 0x64D4, 0xD3BD, 0x64D8, 0xDBFB, 0x64DA, 0xCBE0, - 0x64E1, 0xD3E4, 0x64E2, 0xF6F7, 0x64E5, 0xD5BA, 0x64E6, 0xF3CD, - 0x64E7, 0xCBE1, 0x64EC, 0xEBF4, 0x64F2, 0xF4AD, 0x64F4, 0xFCAA, - 0x64FA, 0xF7EC, 0x64FE, 0xE8F6, 0x6500, 0xDAE7, 0x6504, 0xF7CC, - 0x6518, 0xE5C1, 0x651D, 0xE0EE, 0x6523, 0xD5FD, 0x652A, 0xCEE6, - 0x652B, 0xFCAB, 0x652C, 0xD5BB, 0x652F, 0xF2A8, 0x6536, 0xE2A5, - 0x6537, 0xCDB9, 0x6538, 0xEAF2, 0x6539, 0xCBC7, 0x653B, 0xCDF4, - 0x653E, 0xDBAF, 0x653F, 0xEFD9, 0x6545, 0xCDBA, 0x6548, 0xFCF9, - 0x654D, 0xDFF3, 0x654E, 0xCEE7, 0x654F, 0xDAC2, 0x6551, 0xCFAD, - 0x6556, 0xE7F9, 0x6557, 0xF8A8, 0x655E, 0xF3E2, 0x6562, 0xCAF2, - 0x6563, 0xDFA4, 0x6566, 0xD4C4, 0x656C, 0xCCD7, 0x656D, 0xE5C2, - 0x6572, 0xCDBB, 0x6574, 0xEFDA, 0x6575, 0xEED8, 0x6577, 0xDDA7, - 0x6578, 0xE2A6, 0x657E, 0xE0C0, 0x6582, 0xD6B0, 0x6583, 0xF8CA, - 0x6585, 0xFCFA, 0x6587, 0xD9FE, 0x658C, 0xDEB0, 0x6590, 0xDDEC, - 0x6591, 0xDAE8, 0x6597, 0xD4E0, 0x6599, 0xD6F9, 0x659B, 0xCDD7, - 0x659C, 0xDED8, 0x659F, 0xF2F8, 0x65A1, 0xE4D6, 0x65A4, 0xD0C5, - 0x65A5, 0xF4AE, 0x65A7, 0xDDA8, 0x65AB, 0xEDC5, 0x65AC, 0xF3D6, - 0x65AF, 0xDED9, 0x65B0, 0xE3E6, 0x65B7, 0xD3A8, 0x65B9, 0xDBB0, - 0x65BC, 0xE5DA, 0x65BD, 0xE3BF, 0x65C1, 0xDBB1, 0x65C5, 0xD5E9, - 0x65CB, 0xE0C1, 0x65CC, 0xEFDB, 0x65CF, 0xF0E9, 0x65D2, 0xD7B2, - 0x65D7, 0xD0FD, 0x65E0, 0xD9E9, 0x65E3, 0xD0FE, 0x65E5, 0xECED, - 0x65E6, 0xD3A9, 0x65E8, 0xF2A9, 0x65E9, 0xF0C4, 0x65EC, 0xE2E2, - 0x65ED, 0xE9EF, 0x65F1, 0xF9D1, 0x65F4, 0xE9D9, 0x65FA, 0xE8DA, - 0x65FB, 0xDAC3, 0x65FC, 0xDAC4, 0x65FD, 0xD4C5, 0x65FF, 0xE7FA, - 0x6606, 0xCDE0, 0x6607, 0xE3B0, 0x6609, 0xDBB2, 0x660A, 0xFBC4, - 0x660C, 0xF3E3, 0x660E, 0xD9A5, 0x660F, 0xFBE7, 0x6610, 0xDDCB, - 0x6611, 0xD0D4, 0x6613, 0xE6B6, 0x6614, 0xE0AE, 0x6615, 0xFDDA, - 0x661E, 0xDCB5, 0x661F, 0xE0F8, 0x6620, 0xE7B1, 0x6625, 0xF5F0, - 0x6627, 0xD8DC, 0x6628, 0xEDC6, 0x662D, 0xE1B9, 0x662F, 0xE3C0, - 0x6630, 0xF9C0, 0x6631, 0xE9F0, 0x6634, 0xD9DB, 0x6636, 0xF3E4, - 0x663A, 0xDCB6, 0x663B, 0xE4E9, 0x6641, 0xF0C5, 0x6642, 0xE3C1, - 0x6643, 0xFCCC, 0x6644, 0xFCCD, 0x6649, 0xF2CB, 0x664B, 0xF2CC, - 0x664F, 0xE4CF, 0x6659, 0xF1DB, 0x665B, 0xFAD9, 0x665D, 0xF1B8, - 0x665E, 0xFDF5, 0x665F, 0xE0F9, 0x6664, 0xE7FB, 0x6665, 0xFCB7, - 0x6666, 0xFCE4, 0x6667, 0xFBC5, 0x6668, 0xE3E7, 0x6669, 0xD8B9, - 0x666B, 0xF6F8, 0x666E, 0xDCC5, 0x666F, 0xCCD8, 0x6673, 0xE0AF, - 0x6674, 0xF4E7, 0x6676, 0xEFDC, 0x6677, 0xCFFC, 0x6678, 0xEFDD, - 0x667A, 0xF2AA, 0x6684, 0xFDBE, 0x6687, 0xCAAC, 0x6688, 0xFDBB, - 0x6689, 0xFDC7, 0x668E, 0xE7B2, 0x6690, 0xEAD1, 0x6691, 0xDFF4, - 0x6696, 0xD1EC, 0x6697, 0xE4DE, 0x6698, 0xE5C3, 0x669D, 0xD9A6, - 0x66A0, 0xCDBC, 0x66A2, 0xF3E5, 0x66AB, 0xEDD5, 0x66AE, 0xD9BA, - 0x66B2, 0xEDE7, 0x66B3, 0xFBB5, 0x66B4, 0xF8EC, 0x66B9, 0xE0E7, - 0x66BB, 0xCCD9, 0x66BE, 0xD4C6, 0x66C4, 0xE7A5, 0x66C6, 0xD5F5, - 0x66C7, 0xD3BE, 0x66C9, 0xFCFB, 0x66D6, 0xE4F2, 0x66D9, 0xDFF5, - 0x66DC, 0xE8F8, 0x66DD, 0xF8ED, 0x66E0, 0xCEC7, 0x66E6, 0xFDF6, - 0x66F0, 0xE8D8, 0x66F2, 0xCDD8, 0x66F3, 0xE7D6, 0x66F4, 0xCCDA, - 0x66F7, 0xCAE3, 0x66F8, 0xDFF6, 0x66F9, 0xF0C7, 0x66FA, 0xF0C6, - 0x66FC, 0xD8BA, 0x66FE, 0xF1F4, 0x66FF, 0xF4F0, 0x6700, 0xF5CC, - 0x6703, 0xFCE5, 0x6708, 0xEAC5, 0x6709, 0xEAF3, 0x670B, 0xDDDB, - 0x670D, 0xDCD7, 0x6714, 0xDEFD, 0x6715, 0xF2F9, 0x6717, 0xD5C7, - 0x671B, 0xD8D0, 0x671D, 0xF0C8, 0x671E, 0xD1A1, 0x671F, 0xD1A2, - 0x6726, 0xD9D4, 0x6727, 0xD6E8, 0x6728, 0xD9CA, 0x672A, 0xDAB1, - 0x672B, 0xD8C7, 0x672C, 0xDCE2, 0x672D, 0xF3CE, 0x672E, 0xF5F4, - 0x6731, 0xF1B9, 0x6734, 0xDAD3, 0x6736, 0xF6EA, 0x673A, 0xCFF5, - 0x673D, 0xFDAE, 0x6746, 0xCAD2, 0x6749, 0xDFB4, 0x674E, 0xD7DD, - 0x674F, 0xFABA, 0x6750, 0xEEA7, 0x6751, 0xF5BD, 0x6753, 0xF8F5, - 0x6756, 0xEDE8, 0x675C, 0xD4E1, 0x675E, 0xD1A3, 0x675F, 0xE1D6, - 0x676D, 0xF9F8, 0x676F, 0xDBCA, 0x6770, 0xCBF9, 0x6771, 0xD4D4, - 0x6773, 0xD9DC, 0x6775, 0xEEBE, 0x6777, 0xF7ED, 0x677B, 0xD2EE, - 0x677E, 0xE1E6, 0x677F, 0xF7F9, 0x6787, 0xDDED, 0x6789, 0xE8DB, - 0x678B, 0xDBB3, 0x678F, 0xD1F7, 0x6790, 0xE0B0, 0x6793, 0xD4E2, - 0x6795, 0xF6D7, 0x6797, 0xD7F9, 0x679A, 0xD8DD, 0x679C, 0xCDFD, - 0x679D, 0xF2AB, 0x67AF, 0xCDBD, 0x67B0, 0xF8C2, 0x67B3, 0xF2AC, - 0x67B6, 0xCAAD, 0x67B7, 0xCAAE, 0x67B8, 0xCFAE, 0x67BE, 0xE3C2, - 0x67C4, 0xDCB7, 0x67CF, 0xDBDA, 0x67D0, 0xD9BB, 0x67D1, 0xCAF3, - 0x67D2, 0xF6D3, 0x67D3, 0xE6F8, 0x67D4, 0xEAF5, 0x67DA, 0xEAF6, - 0x67DD, 0xF6F9, 0x67E9, 0xCFAF, 0x67EC, 0xCAD3, 0x67EF, 0xCAAF, - 0x67F0, 0xD2B0, 0x67F1, 0xF1BA, 0x67F3, 0xD7B3, 0x67F4, 0xE3C3, - 0x67F5, 0xF3FD, 0x67F6, 0xDEDA, 0x67FB, 0xDEDB, 0x67FE, 0xEFDE, - 0x6812, 0xE2E3, 0x6813, 0xEEFB, 0x6816, 0xDFF7, 0x6817, 0xD7CA, - 0x6821, 0xCEE8, 0x6822, 0xDBDB, 0x682A, 0xF1BB, 0x682F, 0xE9F1, - 0x6838, 0xFAB7, 0x6839, 0xD0C6, 0x683C, 0xCCAB, 0x683D, 0xEEA8, - 0x6840, 0xCBFA, 0x6841, 0xF9F9, 0x6842, 0xCCFD, 0x6843, 0xD3FE, - 0x6848, 0xE4D0, 0x684E, 0xF2EE, 0x6850, 0xD4D5, 0x6851, 0xDFCD, - 0x6853, 0xFCB8, 0x6854, 0xD1D0, 0x686D, 0xF2CD, 0x6876, 0xF7D2, - 0x687F, 0xCAD4, 0x6881, 0xD5D9, 0x6885, 0xD8DE, 0x688F, 0xCDD9, - 0x6893, 0xEEA9, 0x6894, 0xF6BC, 0x6897, 0xCCDB, 0x689D, 0xF0C9, - 0x689F, 0xFCFC, 0x68A1, 0xE8C9, 0x68A2, 0xF4FE, 0x68A7, 0xE7FC, - 0x68A8, 0xD7DE, 0x68AD, 0xDEDC, 0x68AF, 0xF0AC, 0x68B0, 0xCCFE, - 0x68B1, 0xCDE1, 0x68B3, 0xE1BA, 0x68B5, 0xDBEF, 0x68B6, 0xDAB2, - 0x68C4, 0xD1A5, 0x68C5, 0xDCB8, 0x68C9, 0xD8F6, 0x68CB, 0xD1A4, - 0x68CD, 0xCDE2, 0x68D2, 0xDCEA, 0x68D5, 0xF0F7, 0x68D7, 0xF0CA, - 0x68D8, 0xD0BE, 0x68DA, 0xDDDC, 0x68DF, 0xD4D6, 0x68E0, 0xD3D6, - 0x68E7, 0xEDD0, 0x68E8, 0xCDA1, 0x68EE, 0xDFB5, 0x68F2, 0xDFF8, - 0x68F9, 0xD4A1, 0x68FA, 0xCEB2, 0x6900, 0xE8CA, 0x6905, 0xEBF5, - 0x690D, 0xE3D5, 0x690E, 0xF5D0, 0x6912, 0xF5A1, 0x6927, 0xD9A7, - 0x6930, 0xE5AB, 0x693D, 0xE6CB, 0x693F, 0xF5F1, 0x694A, 0xE5C5, - 0x6953, 0xF9A3, 0x6954, 0xE0DB, 0x6955, 0xF6EB, 0x6957, 0xCBF1, - 0x6959, 0xD9EA, 0x695A, 0xF5A2, 0x695E, 0xD7D1, 0x6960, 0xD1F8, - 0x6961, 0xEAF8, 0x6962, 0xEAF9, 0x6963, 0xDAB3, 0x6968, 0xEFDF, - 0x696B, 0xF1EF, 0x696D, 0xE5F6, 0x696E, 0xEEBF, 0x696F, 0xE2E4, - 0x6975, 0xD0BF, 0x6977, 0xFAAC, 0x6978, 0xF5D1, 0x6979, 0xE7B3, - 0x6995, 0xE9BE, 0x699B, 0xF2CE, 0x699C, 0xDBB4, 0x69A5, 0xFCCE, - 0x69A7, 0xDDEE, 0x69AE, 0xE7B4, 0x69B4, 0xD7B4, 0x69BB, 0xF7B4, - 0x69C1, 0xCDBE, 0x69C3, 0xDAE9, 0x69CB, 0xCFB0, 0x69CC, 0xF7D9, - 0x69CD, 0xF3E6, 0x69D0, 0xCED9, 0x69E8, 0xCEAA, 0x69EA, 0xCBC8, - 0x69FB, 0xD0A7, 0x69FD, 0xF0CB, 0x69FF, 0xD0C7, 0x6A02, 0xE4C5, - 0x6A0A, 0xDBE0, 0x6A11, 0xD5DA, 0x6A13, 0xD7A7, 0x6A17, 0xEEC0, - 0x6A19, 0xF8F6, 0x6A1E, 0xF5D2, 0x6A1F, 0xEDE9, 0x6A21, 0xD9BC, - 0x6A23, 0xE5C6, 0x6A35, 0xF5A3, 0x6A38, 0xDAD4, 0x6A39, 0xE2A7, - 0x6A3A, 0xFBFC, 0x6A3D, 0xF1DC, 0x6A44, 0xCAF4, 0x6A48, 0xE8FA, - 0x6A4B, 0xCEE9, 0x6A52, 0xE9F8, 0x6A53, 0xE2E5, 0x6A58, 0xD0B9, - 0x6A59, 0xD4F2, 0x6A5F, 0xD1A6, 0x6A61, 0xDFCE, 0x6A6B, 0xFCF4, - 0x6A80, 0xD3AA, 0x6A84, 0xCCAC, 0x6A89, 0xEFE0, 0x6A8D, 0xE5E5, - 0x6A8E, 0xD0D5, 0x6A97, 0xDBFC, 0x6A9C, 0xFCE6, 0x6AA2, 0xCBFE, - 0x6AA3, 0xEDEA, 0x6AB3, 0xDEB1, 0x6ABB, 0xF9E3, 0x6AC2, 0xD4A2, - 0x6AC3, 0xCFF6, 0x6AD3, 0xD6D0, 0x6ADA, 0xD5EA, 0x6ADB, 0xF1EE, - 0x6AF6, 0xFACB, 0x6AFB, 0xE5A1, 0x6B04, 0xD5B1, 0x6B0A, 0xCFED, - 0x6B0C, 0xEDEB, 0x6B12, 0xD5B2, 0x6B16, 0xD5BC, 0x6B20, 0xFDE2, - 0x6B21, 0xF3AD, 0x6B23, 0xFDDB, 0x6B32, 0xE9B0, 0x6B3A, 0xD1A7, - 0x6B3D, 0xFDE3, 0x6B3E, 0xCEB3, 0x6B46, 0xFDE4, 0x6B47, 0xFACE, - 0x6B4C, 0xCAB0, 0x6B4E, 0xF7A7, 0x6B50, 0xCFB1, 0x6B5F, 0xE6A2, - 0x6B61, 0xFCB6, 0x6B62, 0xF2AD, 0x6B63, 0xEFE1, 0x6B64, 0xF3AE, - 0x6B65, 0xDCC6, 0x6B66, 0xD9EB, 0x6B6A, 0xE8E0, 0x6B72, 0xE1A8, - 0x6B77, 0xD5F6, 0x6B78, 0xCFFD, 0x6B7B, 0xDEDD, 0x6B7F, 0xD9D1, - 0x6B83, 0xE4EA, 0x6B84, 0xF2CF, 0x6B86, 0xF7BF, 0x6B89, 0xE2E6, - 0x6B8A, 0xE2A8, 0x6B96, 0xE3D6, 0x6B98, 0xEDD1, 0x6B9E, 0xE9F9, - 0x6BAE, 0xD6B1, 0x6BAF, 0xDEB2, 0x6BB2, 0xE0E8, 0x6BB5, 0xD3AB, - 0x6BB7, 0xEBDC, 0x6BBA, 0xDFAF, 0x6BBC, 0xCAC3, 0x6BBF, 0xEEFC, - 0x6BC1, 0xFDC3, 0x6BC5, 0xEBF6, 0x6BC6, 0xCFB2, 0x6BCB, 0xD9EC, - 0x6BCD, 0xD9BD, 0x6BCF, 0xD8DF, 0x6BD2, 0xD4B8, 0x6BD3, 0xEBBE, - 0x6BD4, 0xDDEF, 0x6BD6, 0xDDF0, 0x6BD7, 0xDDF1, 0x6BD8, 0xDDF2, - 0x6BDB, 0xD9BE, 0x6BEB, 0xFBC6, 0x6BEC, 0xCFB3, 0x6C08, 0xEEFD, - 0x6C0F, 0xE4AB, 0x6C11, 0xDAC5, 0x6C13, 0xD8EC, 0x6C23, 0xD1A8, - 0x6C34, 0xE2A9, 0x6C37, 0xDEBC, 0x6C38, 0xE7B5, 0x6C3E, 0xDBF0, - 0x6C40, 0xEFE2, 0x6C41, 0xF1F0, 0x6C42, 0xCFB4, 0x6C4E, 0xDBF1, - 0x6C50, 0xE0B1, 0x6C55, 0xDFA5, 0x6C57, 0xF9D2, 0x6C5A, 0xE7FD, - 0x6C5D, 0xE6A3, 0x6C5E, 0xFBF1, 0x6C5F, 0xCBB0, 0x6C60, 0xF2AE, - 0x6C68, 0xCDE7, 0x6C6A, 0xE8DC, 0x6C6D, 0xE7D7, 0x6C70, 0xF7C0, - 0x6C72, 0xD0E3, 0x6C76, 0xDAA1, 0x6C7A, 0xCCBD, 0x6C7D, 0xD1A9, - 0x6C7E, 0xDDCC, 0x6C81, 0xE3FE, 0x6C82, 0xD1AA, 0x6C83, 0xE8AA, - 0x6C85, 0xEAB6, 0x6C86, 0xF9FA, 0x6C87, 0xE6CC, 0x6C88, 0xF6D8, - 0x6C8C, 0xD4C7, 0x6C90, 0xD9CB, 0x6C92, 0xD9D2, 0x6C93, 0xD3CB, - 0x6C94, 0xD8F7, 0x6C95, 0xDAA9, 0x6C96, 0xF5F8, 0x6C99, 0xDEDE, - 0x6C9A, 0xF2AF, 0x6C9B, 0xF8A9, 0x6CAB, 0xD8C8, 0x6CAE, 0xEEC1, - 0x6CB3, 0xF9C1, 0x6CB8, 0xDDF3, 0x6CB9, 0xEAFA, 0x6CBB, 0xF6BD, - 0x6CBC, 0xE1BB, 0x6CBD, 0xCDBF, 0x6CBE, 0xF4D4, 0x6CBF, 0xE6CD, - 0x6CC1, 0xFCCF, 0x6CC2, 0xFBA2, 0x6CC4, 0xE0DC, 0x6CC9, 0xF4BB, - 0x6CCA, 0xDAD5, 0x6CCC, 0xF9B2, 0x6CD3, 0xFBF2, 0x6CD5, 0xDBF6, - 0x6CD7, 0xDEDF, 0x6CDB, 0xDBF2, 0x6CE1, 0xF8DC, 0x6CE2, 0xF7EE, - 0x6CE3, 0xEBE8, 0x6CE5, 0xD2FA, 0x6CE8, 0xF1BC, 0x6CEB, 0xFADA, - 0x6CEE, 0xDAEA, 0x6CEF, 0xDAC6, 0x6CF0, 0xF7C1, 0x6CF3, 0xE7B6, - 0x6D0B, 0xE5C7, 0x6D0C, 0xD6AC, 0x6D11, 0xDCC7, 0x6D17, 0xE1A9, - 0x6D19, 0xE2AA, 0x6D1B, 0xD5A6, 0x6D1E, 0xD4D7, 0x6D25, 0xF2D0, - 0x6D27, 0xEAFB, 0x6D29, 0xE0DD, 0x6D2A, 0xFBF3, 0x6D32, 0xF1BD, - 0x6D35, 0xE2E7, 0x6D36, 0xFDD7, 0x6D38, 0xCEC8, 0x6D39, 0xEAB7, - 0x6D3B, 0xFCC0, 0x6D3D, 0xFDE7, 0x6D3E, 0xF7EF, 0x6D41, 0xD7B5, - 0x6D59, 0xEFBA, 0x6D5A, 0xF1DD, 0x6D5C, 0xDEB3, 0x6D63, 0xE8CB, - 0x6D66, 0xF8DD, 0x6D69, 0xFBC7, 0x6D6A, 0xD5C8, 0x6D6C, 0xD7DF, - 0x6D6E, 0xDDA9, 0x6D74, 0xE9B1, 0x6D77, 0xFAAD, 0x6D78, 0xF6D9, - 0x6D79, 0xFAF4, 0x6D7F, 0xF8AA, 0x6D85, 0xE6EE, 0x6D87, 0xCCDC, - 0x6D88, 0xE1BC, 0x6D89, 0xE0EF, 0x6D8C, 0xE9BF, 0x6D8D, 0xFCFD, - 0x6D8E, 0xE6CE, 0x6D91, 0xE1D7, 0x6D93, 0xE6CF, 0x6D95, 0xF4F1, - 0x6DAF, 0xE4F3, 0x6DB2, 0xE4FB, 0x6DB5, 0xF9E4, 0x6DC0, 0xEFE3, - 0x6DC3, 0xCFEE, 0x6DC4, 0xF6BE, 0x6DC5, 0xE0B2, 0x6DC6, 0xFCFE, - 0x6DC7, 0xD1AB, 0x6DCB, 0xD7FA, 0x6DCF, 0xFBC8, 0x6DD1, 0xE2D7, - 0x6DD8, 0xD4A3, 0x6DD9, 0xF0F8, 0x6DDA, 0xD7A8, 0x6DDE, 0xE1E7, - 0x6DE1, 0xD3BF, 0x6DE8, 0xEFE4, 0x6DEA, 0xD7C5, 0x6DEB, 0xEBE2, - 0x6DEE, 0xFCE7, 0x6DF1, 0xE4A2, 0x6DF3, 0xE2E8, 0x6DF5, 0xE6D0, - 0x6DF7, 0xFBE8, 0x6DF8, 0xF4E8, 0x6DF9, 0xE5F4, 0x6DFA, 0xF4BC, - 0x6DFB, 0xF4D5, 0x6E17, 0xDFB6, 0x6E19, 0xFCB9, 0x6E1A, 0xEEC2, - 0x6E1B, 0xCAF5, 0x6E1F, 0xEFE5, 0x6E20, 0xCBE2, 0x6E21, 0xD4A4, - 0x6E23, 0xDEE0, 0x6E24, 0xDAFD, 0x6E25, 0xE4C6, 0x6E26, 0xE8BE, - 0x6E2B, 0xE0DE, 0x6E2C, 0xF6B4, 0x6E2D, 0xEAD2, 0x6E2F, 0xF9FB, - 0x6E32, 0xE0C2, 0x6E34, 0xCAE4, 0x6E36, 0xE7B7, 0x6E38, 0xEAFD, - 0x6E3A, 0xD9DD, 0x6E3C, 0xDAB4, 0x6E3D, 0xEEAA, 0x6E3E, 0xFBE9, - 0x6E43, 0xDBCB, 0x6E44, 0xDAB5, 0x6E4A, 0xF1BE, 0x6E4D, 0xD3AC, - 0x6E56, 0xFBC9, 0x6E58, 0xDFCF, 0x6E5B, 0xD3C0, 0x6E5C, 0xE3D7, - 0x6E5E, 0xEFE6, 0x6E5F, 0xFCD0, 0x6E67, 0xE9C0, 0x6E6B, 0xF5D3, - 0x6E6E, 0xECDC, 0x6E6F, 0xF7B7, 0x6E72, 0xEAB8, 0x6E73, 0xD1F9, - 0x6E7A, 0xDCC8, 0x6E90, 0xEAB9, 0x6E96, 0xF1DE, 0x6E9C, 0xD7B6, - 0x6E9D, 0xCFB5, 0x6E9F, 0xD9A8, 0x6EA2, 0xECEE, 0x6EA5, 0xDDAA, - 0x6EAA, 0xCDA2, 0x6EAB, 0xE8AE, 0x6EAF, 0xE1BD, 0x6EB1, 0xF2D1, - 0x6EB6, 0xE9C1, 0x6EBA, 0xD2FC, 0x6EC2, 0xDBB5, 0x6EC4, 0xF3E7, - 0x6EC5, 0xD8FE, 0x6EC9, 0xFCD1, 0x6ECB, 0xEDB2, 0x6ECC, 0xF4AF, - 0x6ECE, 0xFBA3, 0x6ED1, 0xFCC1, 0x6ED3, 0xEEAB, 0x6ED4, 0xD4A5, - 0x6EEF, 0xF4F2, 0x6EF4, 0xEED9, 0x6EF8, 0xFBCA, 0x6EFE, 0xCDE3, - 0x6EFF, 0xD8BB, 0x6F01, 0xE5DB, 0x6F02, 0xF8F7, 0x6F06, 0xF6D4, - 0x6F0F, 0xD7A9, 0x6F11, 0xCBC9, 0x6F14, 0xE6D1, 0x6F15, 0xF0CC, - 0x6F20, 0xD8AE, 0x6F22, 0xF9D3, 0x6F23, 0xD5FE, 0x6F2B, 0xD8BC, - 0x6F2C, 0xF2B0, 0x6F31, 0xE2AB, 0x6F32, 0xF3E8, 0x6F38, 0xEFC2, - 0x6F3F, 0xEDEC, 0x6F41, 0xE7B8, 0x6F51, 0xDAFE, 0x6F54, 0xCCBE, - 0x6F57, 0xF2FC, 0x6F58, 0xDAEB, 0x6F5A, 0xE2D8, 0x6F5B, 0xEDD6, - 0x6F5E, 0xD6D1, 0x6F5F, 0xE0B3, 0x6F62, 0xFCD2, 0x6F64, 0xEBC8, - 0x6F6D, 0xD3C1, 0x6F6E, 0xF0CD, 0x6F70, 0xCFF7, 0x6F7A, 0xEDD2, - 0x6F7C, 0xD4D8, 0x6F7D, 0xDCC9, 0x6F7E, 0xD7F1, 0x6F81, 0xDFBB, - 0x6F84, 0xF3A5, 0x6F88, 0xF4CD, 0x6F8D, 0xF1BF, 0x6F8E, 0xF8B1, - 0x6F90, 0xE9FA, 0x6F94, 0xFBCB, 0x6F97, 0xCAD5, 0x6FA3, 0xF9D4, - 0x6FA4, 0xF7CA, 0x6FA7, 0xD6C8, 0x6FAE, 0xFCE8, 0x6FAF, 0xF3BD, - 0x6FB1, 0xEEFE, 0x6FB3, 0xE7FE, 0x6FB9, 0xD3C2, 0x6FBE, 0xD3B6, - 0x6FC0, 0xCCAD, 0x6FC1, 0xF6FA, 0x6FC2, 0xD6B2, 0x6FC3, 0xD2D8, - 0x6FCA, 0xE7D8, 0x6FD5, 0xE3A5, 0x6FDA, 0xE7B9, 0x6FDF, 0xF0AD, - 0x6FE0, 0xFBCC, 0x6FE1, 0xEBA1, 0x6FE4, 0xD4A6, 0x6FE9, 0xFBCD, - 0x6FEB, 0xD5BD, 0x6FEC, 0xF1DF, 0x6FEF, 0xF6FB, 0x6FF1, 0xDEB4, - 0x6FFE, 0xD5EB, 0x7001, 0xE5C8, 0x7005, 0xFBA4, 0x7006, 0xD4B9, - 0x7009, 0xDEE1, 0x700B, 0xE4A3, 0x700F, 0xD7B7, 0x7011, 0xF8EE, - 0x7015, 0xDEB5, 0x7018, 0xD6D2, 0x701A, 0xF9D5, 0x701B, 0xE7BA, - 0x701C, 0xEBD5, 0x701D, 0xD5F7, 0x701E, 0xEFE7, 0x701F, 0xE1BE, - 0x7023, 0xFAAE, 0x7027, 0xD6E9, 0x7028, 0xD6EE, 0x702F, 0xE7BB, - 0x7037, 0xECCB, 0x703E, 0xD5B3, 0x704C, 0xCEB4, 0x7050, 0xFBA5, - 0x7051, 0xE1EE, 0x7058, 0xF7A8, 0x705D, 0xFBCE, 0x7063, 0xD8BD, - 0x706B, 0xFBFD, 0x7070, 0xFCE9, 0x7078, 0xCFB6, 0x707C, 0xEDC7, - 0x707D, 0xEEAC, 0x7085, 0xCCDD, 0x708A, 0xF6A7, 0x708E, 0xE6FA, - 0x7092, 0xF5A4, 0x7098, 0xFDDC, 0x7099, 0xEDB3, 0x709A, 0xCEC9, - 0x70A1, 0xEFE8, 0x70A4, 0xE1BF, 0x70AB, 0xFADB, 0x70AC, 0xCBE3, - 0x70AD, 0xF7A9, 0x70AF, 0xFBA6, 0x70B3, 0xDCB9, 0x70B7, 0xF1C0, - 0x70B8, 0xEDC8, 0x70B9, 0xEFC3, 0x70C8, 0xD6AD, 0x70CB, 0xFDCE, - 0x70CF, 0xE8A1, 0x70D8, 0xFBF4, 0x70D9, 0xD5A7, 0x70DD, 0xF1F6, - 0x70DF, 0xE6D3, 0x70F1, 0xCCDE, 0x70F9, 0xF8B2, 0x70FD, 0xDCEB, - 0x7104, 0xFDB6, 0x7109, 0xE5EA, 0x710C, 0xF1E0, 0x7119, 0xDBCC, - 0x711A, 0xDDCD, 0x711E, 0xD4C8, 0x7121, 0xD9ED, 0x7126, 0xF5A5, - 0x7130, 0xE6FB, 0x7136, 0xE6D4, 0x7147, 0xFDC8, 0x7149, 0xD6A1, - 0x714A, 0xFDBF, 0x714C, 0xFCD3, 0x714E, 0xEFA1, 0x7150, 0xE7BC, - 0x7156, 0xD1EE, 0x7159, 0xE6D5, 0x715C, 0xE9F2, 0x715E, 0xDFB0, - 0x7164, 0xD8E0, 0x7165, 0xFCBA, 0x7166, 0xFDAF, 0x7167, 0xF0CE, - 0x7169, 0xDBE1, 0x716C, 0xE5C9, 0x716E, 0xEDB4, 0x717D, 0xE0C3, - 0x7184, 0xE3D8, 0x7189, 0xE9FB, 0x718A, 0xEAA8, 0x718F, 0xFDB7, - 0x7192, 0xFBA7, 0x7194, 0xE9C2, 0x7199, 0xFDF7, 0x719F, 0xE2D9, - 0x71A2, 0xDCEC, 0x71AC, 0xE8A2, 0x71B1, 0xE6F0, 0x71B9, 0xFDF8, - 0x71BA, 0xFDF9, 0x71BE, 0xF6BF, 0x71C1, 0xE7A7, 0x71C3, 0xE6D7, - 0x71C8, 0xD4F3, 0x71C9, 0xD4C9, 0x71CE, 0xD6FA, 0x71D0, 0xD7F2, - 0x71D2, 0xE1C0, 0x71D4, 0xDBE2, 0x71D5, 0xE6D8, 0x71DF, 0xE7BD, - 0x71E5, 0xF0CF, 0x71E6, 0xF3BE, 0x71E7, 0xE2AC, 0x71ED, 0xF5B7, - 0x71EE, 0xE0F0, 0x71FB, 0xFDB8, 0x71FC, 0xE3E8, 0x71FE, 0xD4A7, - 0x71FF, 0xE8FC, 0x7200, 0xFAD2, 0x7206, 0xF8EF, 0x7210, 0xD6D3, - 0x721B, 0xD5B4, 0x722A, 0xF0D0, 0x722C, 0xF7F0, 0x722D, 0xEEB3, - 0x7230, 0xEABA, 0x7232, 0xEAD3, 0x7235, 0xEDC9, 0x7236, 0xDDAB, - 0x723A, 0xE5AC, 0x723B, 0xFDA1, 0x723D, 0xDFD0, 0x723E, 0xECB3, - 0x7240, 0xDFD1, 0x7246, 0xEDED, 0x7247, 0xF8B8, 0x7248, 0xF7FA, - 0x724C, 0xF8AB, 0x7252, 0xF4E0, 0x7258, 0xD4BA, 0x7259, 0xE4B3, - 0x725B, 0xE9DA, 0x725D, 0xDEB6, 0x725F, 0xD9BF, 0x7261, 0xD9C0, - 0x7262, 0xD6EF, 0x7267, 0xD9CC, 0x7269, 0xDAAA, 0x7272, 0xDFE5, - 0x7279, 0xF7E5, 0x727D, 0xCCB2, 0x7280, 0xDFF9, 0x7281, 0xD7E0, - 0x72A2, 0xD4BB, 0x72A7, 0xFDFA, 0x72AC, 0xCCB3, 0x72AF, 0xDBF3, - 0x72C0, 0xDFD2, 0x72C2, 0xCECA, 0x72C4, 0xEEDA, 0x72CE, 0xE4E4, - 0x72D0, 0xFBCF, 0x72D7, 0xCFB7, 0x72D9, 0xEEC3, 0x72E1, 0xCEEA, - 0x72E9, 0xE2AD, 0x72F8, 0xD7E1, 0x72F9, 0xFAF5, 0x72FC, 0xD5C9, - 0x72FD, 0xF8AC, 0x730A, 0xE7D9, 0x7316, 0xF3E9, 0x731B, 0xD8ED, - 0x731C, 0xE3C4, 0x731D, 0xF0F1, 0x7325, 0xE8E5, 0x7329, 0xE0FA, - 0x732A, 0xEEC4, 0x732B, 0xD9DE, 0x7336, 0xEBA2, 0x7337, 0xEBA3, - 0x733E, 0xFCC2, 0x733F, 0xEABB, 0x7344, 0xE8AB, 0x7345, 0xDEE2, - 0x7350, 0xEDEF, 0x7352, 0xE8A3, 0x7357, 0xCFF1, 0x7368, 0xD4BC, - 0x736A, 0xFCEA, 0x7370, 0xE7BE, 0x7372, 0xFCF2, 0x7375, 0xD6B4, - 0x7378, 0xE2AE, 0x737A, 0xD3B7, 0x737B, 0xFACC, 0x7384, 0xFADC, - 0x7386, 0xEDB5, 0x7387, 0xE1E3, 0x7389, 0xE8AC, 0x738B, 0xE8DD, - 0x738E, 0xEFE9, 0x7394, 0xF4BD, 0x7396, 0xCFB8, 0x7397, 0xE9DB, - 0x7398, 0xD1AC, 0x739F, 0xDAC7, 0x73A7, 0xEBC9, 0x73A9, 0xE8CC, - 0x73AD, 0xDEB7, 0x73B2, 0xD6BC, 0x73B3, 0xD3E5, 0x73B9, 0xFADD, - 0x73C0, 0xDAD6, 0x73C2, 0xCAB1, 0x73C9, 0xDAC8, 0x73CA, 0xDFA6, - 0x73CC, 0xF9B3, 0x73CD, 0xF2D2, 0x73CF, 0xCAC4, 0x73D6, 0xCECB, - 0x73D9, 0xCDF5, 0x73DD, 0xFDB0, 0x73DE, 0xD5A8, 0x73E0, 0xF1C1, - 0x73E3, 0xE2E9, 0x73E4, 0xDCCA, 0x73E5, 0xECB4, 0x73E6, 0xFAC0, - 0x73E9, 0xFBA8, 0x73EA, 0xD0A8, 0x73ED, 0xDAEC, 0x73F7, 0xD9EE, - 0x73F9, 0xE0FB, 0x73FD, 0xEFEA, 0x73FE, 0xFADE, 0x7401, 0xE0C4, - 0x7403, 0xCFB9, 0x7405, 0xD5CA, 0x7406, 0xD7E2, 0x7407, 0xE2AF, - 0x7409, 0xD7B8, 0x7413, 0xE8CD, 0x741B, 0xF6DA, 0x7420, 0xEFA2, - 0x7421, 0xE2DA, 0x7422, 0xF6FC, 0x7425, 0xFBD0, 0x7426, 0xD1AD, - 0x7428, 0xCDE4, 0x742A, 0xD1AE, 0x742B, 0xDCED, 0x742C, 0xE8CE, - 0x742E, 0xF0F9, 0x742F, 0xCEB5, 0x7430, 0xE6FC, 0x7433, 0xD7FB, - 0x7434, 0xD0D6, 0x7435, 0xDDF5, 0x7436, 0xF7F1, 0x7438, 0xF6FD, - 0x743A, 0xDBF7, 0x743F, 0xFBEA, 0x7440, 0xE9DC, 0x7441, 0xD9C1, - 0x7443, 0xF5F2, 0x7444, 0xE0C5, 0x744B, 0xEAD4, 0x7455, 0xF9C2, - 0x7457, 0xEABC, 0x7459, 0xD2C5, 0x745A, 0xFBD1, 0x745B, 0xE7C0, - 0x745C, 0xEBA5, 0x745E, 0xDFFA, 0x745F, 0xE3A2, 0x7460, 0xD7B9, - 0x7462, 0xE9C3, 0x7464, 0xE8FD, 0x7465, 0xE8AF, 0x7468, 0xF2D3, - 0x7469, 0xFBA9, 0x746A, 0xD8A5, 0x746F, 0xD5CB, 0x747E, 0xD0C8, - 0x7482, 0xD1AF, 0x7483, 0xD7E3, 0x7487, 0xE0C6, 0x7489, 0xD6A2, - 0x748B, 0xEDF0, 0x7498, 0xD7F3, 0x749C, 0xFCD4, 0x749E, 0xDAD7, - 0x749F, 0xCCDF, 0x74A1, 0xF2D4, 0x74A3, 0xD1B0, 0x74A5, 0xCCE0, - 0x74A7, 0xDBFD, 0x74A8, 0xF3BF, 0x74AA, 0xF0D1, 0x74B0, 0xFCBB, - 0x74B2, 0xE2B0, 0x74B5, 0xE6A5, 0x74B9, 0xE2DB, 0x74BD, 0xDFDE, - 0x74BF, 0xE0C7, 0x74C6, 0xF2EF, 0x74CA, 0xCCE1, 0x74CF, 0xD6EA, - 0x74D4, 0xE7C2, 0x74D8, 0xCEB6, 0x74DA, 0xF3C0, 0x74DC, 0xCDFE, - 0x74E0, 0xFBD2, 0x74E2, 0xF8F8, 0x74E3, 0xF7FB, 0x74E6, 0xE8BF, - 0x74EE, 0xE8B7, 0x74F7, 0xEDB6, 0x7501, 0xDCBA, 0x7504, 0xCCB4, - 0x7511, 0xF1F7, 0x7515, 0xE8B8, 0x7518, 0xCAF6, 0x751A, 0xE4A4, - 0x751B, 0xF4D6, 0x751F, 0xDFE6, 0x7523, 0xDFA7, 0x7525, 0xDFE7, - 0x7526, 0xE1C1, 0x7528, 0xE9C4, 0x752B, 0xDCCB, 0x752C, 0xE9C5, - 0x7530, 0xEFA3, 0x7531, 0xEBA6, 0x7532, 0xCBA3, 0x7533, 0xE3E9, - 0x7537, 0xD1FB, 0x7538, 0xEFA4, 0x753A, 0xEFEB, 0x7547, 0xD0B4, - 0x754C, 0xCDA3, 0x754F, 0xE8E6, 0x7551, 0xEFA5, 0x7553, 0xD3CC, - 0x7554, 0xDAED, 0x7559, 0xD7BA, 0x755B, 0xF2D5, 0x755C, 0xF5E5, - 0x755D, 0xD9EF, 0x7562, 0xF9B4, 0x7565, 0xD5D4, 0x7566, 0xFDCF, - 0x756A, 0xDBE3, 0x756F, 0xF1E1, 0x7570, 0xECB6, 0x7575, 0xFBFE, - 0x7576, 0xD3D7, 0x7578, 0xD1B1, 0x757A, 0xCBB1, 0x757F, 0xD1B2, - 0x7586, 0xCBB2, 0x7587, 0xF1C2, 0x758A, 0xF4E1, 0x758B, 0xF9B5, - 0x758E, 0xE1C3, 0x758F, 0xE1C2, 0x7591, 0xEBF7, 0x759D, 0xDFA8, - 0x75A5, 0xCBCA, 0x75AB, 0xE6B9, 0x75B1, 0xF8DE, 0x75B2, 0xF9AA, - 0x75B3, 0xCAF7, 0x75B5, 0xEDB7, 0x75B8, 0xD3B8, 0x75B9, 0xF2D6, - 0x75BC, 0xD4D9, 0x75BD, 0xEEC5, 0x75BE, 0xF2F0, 0x75C2, 0xCAB2, - 0x75C5, 0xDCBB, 0x75C7, 0xF1F8, 0x75CD, 0xECB7, 0x75D2, 0xE5CA, - 0x75D4, 0xF6C0, 0x75D5, 0xFDDD, 0x75D8, 0xD4E3, 0x75D9, 0xCCE2, - 0x75DB, 0xF7D4, 0x75E2, 0xD7E5, 0x75F0, 0xD3C3, 0x75F2, 0xD8A6, - 0x75F4, 0xF6C1, 0x75FA, 0xDDF6, 0x75FC, 0xCDC0, 0x7600, 0xE5DC, - 0x760D, 0xE5CB, 0x7619, 0xE1C4, 0x761F, 0xE8B0, 0x7620, 0xF4B0, - 0x7621, 0xF3EA, 0x7622, 0xDAEE, 0x7624, 0xD7BB, 0x7626, 0xE2B1, - 0x763B, 0xD7AA, 0x7642, 0xD6FB, 0x764C, 0xE4DF, 0x764E, 0xCAD6, - 0x7652, 0xEBA8, 0x7656, 0xDBFE, 0x7661, 0xF6C2, 0x7664, 0xEFBB, - 0x7669, 0xD4FD, 0x766C, 0xE0C8, 0x7670, 0xE8B9, 0x7672, 0xEFA6, - 0x7678, 0xCDA4, 0x767B, 0xD4F4, 0x767C, 0xDBA1, 0x767D, 0xDBDC, - 0x767E, 0xDBDD, 0x7684, 0xEEDC, 0x7686, 0xCBCB, 0x7687, 0xFCD5, - 0x768E, 0xCEEB, 0x7690, 0xCDC1, 0x7693, 0xFBD3, 0x76AE, 0xF9AB, - 0x76BA, 0xF5D4, 0x76BF, 0xD9A9, 0x76C2, 0xE9DD, 0x76C3, 0xDBCD, - 0x76C6, 0xDDCE, 0x76C8, 0xE7C3, 0x76CA, 0xECCC, 0x76D2, 0xF9EC, - 0x76D6, 0xCBCC, 0x76DB, 0xE0FC, 0x76DC, 0xD4A8, 0x76DE, 0xEDD3, - 0x76DF, 0xD8EF, 0x76E1, 0xF2D7, 0x76E3, 0xCAF8, 0x76E4, 0xDAEF, - 0x76E7, 0xD6D4, 0x76EE, 0xD9CD, 0x76F2, 0xD8EE, 0x76F4, 0xF2C1, - 0x76F8, 0xDFD3, 0x76FC, 0xDAF0, 0x76FE, 0xE2EA, 0x7701, 0xE0FD, - 0x7704, 0xD8F8, 0x7708, 0xF7AF, 0x7709, 0xDAB6, 0x770B, 0xCAD7, - 0x771E, 0xF2D8, 0x7720, 0xD8F9, 0x7729, 0xFADF, 0x7737, 0xCFEF, - 0x7738, 0xD9C2, 0x773A, 0xF0D2, 0x773C, 0xE4D1, 0x7740, 0xF3B7, - 0x774D, 0xFAE0, 0x775B, 0xEFEC, 0x7761, 0xE2B2, 0x7763, 0xD4BD, - 0x7766, 0xD9CE, 0x776B, 0xF4E2, 0x7779, 0xD4A9, 0x777E, 0xCDC2, - 0x777F, 0xE7DA, 0x778B, 0xF2D9, 0x7791, 0xD9AA, 0x779E, 0xD8BE, - 0x77A5, 0xDCAD, 0x77AC, 0xE2EB, 0x77AD, 0xD6FC, 0x77B0, 0xCAF9, - 0x77B3, 0xD4DA, 0x77BB, 0xF4D7, 0x77BC, 0xCCA1, 0x77BF, 0xCFBA, - 0x77D7, 0xF5B8, 0x77DB, 0xD9C3, 0x77DC, 0xD0E8, 0x77E2, 0xE3C5, - 0x77E3, 0xEBF8, 0x77E5, 0xF2B1, 0x77E9, 0xCFBB, 0x77ED, 0xD3AD, - 0x77EE, 0xE8E1, 0x77EF, 0xCEEC, 0x77F3, 0xE0B4, 0x7802, 0xDEE3, - 0x7812, 0xDDF7, 0x7825, 0xF2B2, 0x7826, 0xF3F6, 0x7827, 0xF6DB, - 0x782C, 0xD7FE, 0x7832, 0xF8DF, 0x7834, 0xF7F2, 0x7845, 0xD0A9, - 0x784F, 0xE6DA, 0x785D, 0xF5A6, 0x786B, 0xD7BC, 0x786C, 0xCCE3, - 0x786F, 0xE6DB, 0x787C, 0xDDDD, 0x7881, 0xD1B3, 0x7887, 0xEFED, - 0x788C, 0xD6DE, 0x788D, 0xE4F4, 0x788E, 0xE1EF, 0x7891, 0xDDF8, - 0x7897, 0xE8CF, 0x78A3, 0xCAE5, 0x78A7, 0xDCA1, 0x78A9, 0xE0B5, - 0x78BA, 0xFCAC, 0x78BB, 0xFCAD, 0x78BC, 0xD8A7, 0x78C1, 0xEDB8, - 0x78C5, 0xDBB6, 0x78CA, 0xD6F0, 0x78CB, 0xF3AF, 0x78CE, 0xCDA5, - 0x78D0, 0xDAF1, 0x78E8, 0xD8A8, 0x78EC, 0xCCE4, 0x78EF, 0xD1B4, - 0x78F5, 0xCAD8, 0x78FB, 0xDAF2, 0x7901, 0xF5A7, 0x790E, 0xF5A8, - 0x7916, 0xE6A6, 0x792A, 0xD5EC, 0x792B, 0xD5F8, 0x792C, 0xDAF3, - 0x793A, 0xE3C6, 0x793E, 0xDEE4, 0x7940, 0xDEE5, 0x7941, 0xD1B5, - 0x7947, 0xD1B6, 0x7948, 0xD1B7, 0x7949, 0xF2B3, 0x7950, 0xE9DE, - 0x7956, 0xF0D3, 0x7957, 0xF2B4, 0x795A, 0xF0D4, 0x795B, 0xCBE4, - 0x795C, 0xFBD4, 0x795D, 0xF5E6, 0x795E, 0xE3EA, 0x7960, 0xDEE6, - 0x7965, 0xDFD4, 0x7968, 0xF8F9, 0x796D, 0xF0AE, 0x797A, 0xD1B8, - 0x797F, 0xD6DF, 0x7981, 0xD0D7, 0x798D, 0xFCA1, 0x798E, 0xEFEE, - 0x798F, 0xDCD8, 0x7991, 0xE9DF, 0x79A6, 0xE5DD, 0x79A7, 0xFDFB, - 0x79AA, 0xE0C9, 0x79AE, 0xD6C9, 0x79B1, 0xD4AA, 0x79B3, 0xE5CC, - 0x79B9, 0xE9E0, 0x79BD, 0xD0D8, 0x79BE, 0xFCA2, 0x79BF, 0xD4BE, - 0x79C0, 0xE2B3, 0x79C1, 0xDEE7, 0x79C9, 0xDCBC, 0x79CA, 0xD2B6, - 0x79CB, 0xF5D5, 0x79D1, 0xCEA1, 0x79D2, 0xF5A9, 0x79D5, 0xDDF9, - 0x79D8, 0xDDFA, 0x79DF, 0xF0D5, 0x79E4, 0xF6DF, 0x79E6, 0xF2DA, - 0x79E7, 0xE4EB, 0x79E9, 0xF2F1, 0x79FB, 0xECB9, 0x7A00, 0xFDFC, - 0x7A05, 0xE1AA, 0x7A08, 0xCAD9, 0x7A0B, 0xEFEF, 0x7A0D, 0xF5AA, - 0x7A14, 0xECF9, 0x7A17, 0xF8AD, 0x7A19, 0xF2C2, 0x7A1A, 0xF6C3, - 0x7A1C, 0xD7D2, 0x7A1F, 0xF9A2, 0x7A20, 0xF0D6, 0x7A2E, 0xF0FA, - 0x7A31, 0xF6E0, 0x7A36, 0xE9F3, 0x7A37, 0xF2C3, 0x7A3B, 0xD4AB, - 0x7A3C, 0xCAB3, 0x7A3D, 0xCDA6, 0x7A3F, 0xCDC3, 0x7A40, 0xCDDA, - 0x7A46, 0xD9CF, 0x7A49, 0xF6C4, 0x7A4D, 0xEEDD, 0x7A4E, 0xE7C4, - 0x7A57, 0xE2B4, 0x7A61, 0xDFE2, 0x7A62, 0xE7DB, 0x7A69, 0xE8B1, - 0x7A6B, 0xFCAE, 0x7A70, 0xE5CD, 0x7A74, 0xFAEB, 0x7A76, 0xCFBC, - 0x7A79, 0xCFE2, 0x7A7A, 0xCDF6, 0x7A7D, 0xEFF0, 0x7A7F, 0xF4BE, - 0x7A81, 0xD4CD, 0x7A84, 0xF3B8, 0x7A88, 0xE9A1, 0x7A92, 0xF2F2, - 0x7A93, 0xF3EB, 0x7A95, 0xF0D7, 0x7A98, 0xCFD7, 0x7A9F, 0xCFDF, - 0x7AA9, 0xE8C0, 0x7AAA, 0xE8C1, 0x7AAE, 0xCFE3, 0x7AAF, 0xE9A2, - 0x7ABA, 0xD0AA, 0x7AC4, 0xF3C1, 0x7AC5, 0xD0AB, 0x7AC7, 0xD4E4, - 0x7ACA, 0xEFBC, 0x7ACB, 0xD8A1, 0x7AD7, 0xD9DF, 0x7AD9, 0xF3D7, - 0x7ADD, 0xDCBD, 0x7ADF, 0xCCE5, 0x7AE0, 0xEDF1, 0x7AE3, 0xF1E2, - 0x7AE5, 0xD4DB, 0x7AEA, 0xE2B5, 0x7AED, 0xCAE6, 0x7AEF, 0xD3AE, - 0x7AF6, 0xCCE6, 0x7AF9, 0xF1D3, 0x7AFA, 0xF5E7, 0x7AFF, 0xCADA, - 0x7B0F, 0xFBEE, 0x7B11, 0xE1C5, 0x7B19, 0xDFE9, 0x7B1B, 0xEEDE, - 0x7B1E, 0xF7C2, 0x7B20, 0xD8A2, 0x7B26, 0xDDAC, 0x7B2C, 0xF0AF, - 0x7B2D, 0xD6BD, 0x7B39, 0xE1AB, 0x7B46, 0xF9B6, 0x7B49, 0xD4F5, - 0x7B4B, 0xD0C9, 0x7B4C, 0xEFA7, 0x7B4D, 0xE2EC, 0x7B4F, 0xDBEA, - 0x7B50, 0xCECC, 0x7B51, 0xF5E8, 0x7B52, 0xF7D5, 0x7B54, 0xD3CD, - 0x7B56, 0xF3FE, 0x7B60, 0xD0B5, 0x7B6C, 0xE0FE, 0x7B6E, 0xDFFB, - 0x7B75, 0xE6DD, 0x7B7D, 0xE8A4, 0x7B87, 0xCBCD, 0x7B8B, 0xEFA8, - 0x7B8F, 0xEEB4, 0x7B94, 0xDAD8, 0x7B95, 0xD1B9, 0x7B97, 0xDFA9, - 0x7B9A, 0xF3B0, 0x7B9D, 0xCCC4, 0x7BA1, 0xCEB7, 0x7BAD, 0xEFA9, - 0x7BB1, 0xDFD5, 0x7BB4, 0xEDD7, 0x7BB8, 0xEEC6, 0x7BC0, 0xEFBD, - 0x7BC1, 0xFCD6, 0x7BC4, 0xDBF4, 0x7BC6, 0xEFAA, 0x7BC7, 0xF8B9, - 0x7BC9, 0xF5E9, 0x7BD2, 0xE3D9, 0x7BE0, 0xE1C6, 0x7BE4, 0xD4BF, - 0x7BE9, 0xDEE8, 0x7C07, 0xF0EA, 0x7C12, 0xF3C2, 0x7C1E, 0xD3AF, - 0x7C21, 0xCADB, 0x7C27, 0xFCD7, 0x7C2A, 0xEDD8, 0x7C2B, 0xE1C7, - 0x7C3D, 0xF4D8, 0x7C3E, 0xD6B3, 0x7C3F, 0xDDAD, 0x7C43, 0xD5BE, - 0x7C4C, 0xF1C3, 0x7C4D, 0xEEDF, 0x7C60, 0xD6EB, 0x7C64, 0xF4D9, - 0x7C6C, 0xD7E6, 0x7C73, 0xDAB7, 0x7C83, 0xDDFB, 0x7C89, 0xDDCF, - 0x7C92, 0xD8A3, 0x7C95, 0xDAD9, 0x7C97, 0xF0D8, 0x7C98, 0xEFC4, - 0x7C9F, 0xE1D8, 0x7CA5, 0xF1D4, 0x7CA7, 0xEDF2, 0x7CAE, 0xD5DB, - 0x7CB1, 0xD5DC, 0x7CB2, 0xF3C4, 0x7CB3, 0xCBD7, 0x7CB9, 0xE2B6, - 0x7CBE, 0xEFF1, 0x7CCA, 0xFBD5, 0x7CD6, 0xD3D8, 0x7CDE, 0xDDD0, - 0x7CDF, 0xF0D9, 0x7CE0, 0xCBB3, 0x7CE7, 0xD5DD, 0x7CFB, 0xCDA7, - 0x7CFE, 0xD0AC, 0x7D00, 0xD1BA, 0x7D02, 0xF1C4, 0x7D04, 0xE5B3, - 0x7D05, 0xFBF5, 0x7D06, 0xE9E1, 0x7D07, 0xFDE0, 0x7D08, 0xFCBC, - 0x7D0A, 0xDAA2, 0x7D0B, 0xDAA3, 0x7D0D, 0xD2A1, 0x7D10, 0xD2EF, - 0x7D14, 0xE2ED, 0x7D17, 0xDEE9, 0x7D18, 0xCEDC, 0x7D19, 0xF2B5, - 0x7D1A, 0xD0E4, 0x7D1B, 0xDDD1, 0x7D20, 0xE1C8, 0x7D21, 0xDBB7, - 0x7D22, 0xDFE3, 0x7D2B, 0xEDB9, 0x7D2C, 0xF1C5, 0x7D2E, 0xF3CF, - 0x7D2F, 0xD7AB, 0x7D30, 0xE1AC, 0x7D33, 0xE3EB, 0x7D35, 0xEEC7, - 0x7D39, 0xE1C9, 0x7D3A, 0xCAFA, 0x7D42, 0xF0FB, 0x7D43, 0xFAE1, - 0x7D44, 0xF0DA, 0x7D45, 0xCCE7, 0x7D46, 0xDAF4, 0x7D50, 0xCCBF, - 0x7D5E, 0xCEED, 0x7D61, 0xD5A9, 0x7D62, 0xFAE2, 0x7D66, 0xD0E5, - 0x7D68, 0xEBD6, 0x7D6A, 0xECDF, 0x7D6E, 0xDFFC, 0x7D71, 0xF7D6, - 0x7D72, 0xDEEA, 0x7D73, 0xCBB4, 0x7D76, 0xEFBE, 0x7D79, 0xCCB5, - 0x7D7F, 0xCFBD, 0x7D8E, 0xEFF2, 0x7D8F, 0xE2B7, 0x7D93, 0xCCE8, - 0x7D9C, 0xF0FC, 0x7DA0, 0xD6E0, 0x7DA2, 0xF1C6, 0x7DAC, 0xE2B8, - 0x7DAD, 0xEBAB, 0x7DB1, 0xCBB5, 0x7DB2, 0xD8D1, 0x7DB4, 0xF4CE, - 0x7DB5, 0xF3F7, 0x7DB8, 0xD7C6, 0x7DBA, 0xD1BB, 0x7DBB, 0xF7AA, - 0x7DBD, 0xEDCA, 0x7DBE, 0xD7D3, 0x7DBF, 0xD8FA, 0x7DC7, 0xF6C5, - 0x7DCA, 0xD1CC, 0x7DCB, 0xDDFC, 0x7DD6, 0xDFFD, 0x7DD8, 0xF9E5, - 0x7DDA, 0xE0CA, 0x7DDD, 0xF2FD, 0x7DDE, 0xD3B0, 0x7DE0, 0xF4F3, - 0x7DE1, 0xDAC9, 0x7DE3, 0xE6DE, 0x7DE8, 0xF8BA, 0x7DE9, 0xE8D0, - 0x7DEC, 0xD8FB, 0x7DEF, 0xEAD5, 0x7DF4, 0xD6A3, 0x7DFB, 0xF6C6, - 0x7E09, 0xF2DB, 0x7E0A, 0xE4FC, 0x7E15, 0xE8B2, 0x7E1B, 0xDADA, - 0x7E1D, 0xF2DC, 0x7E1E, 0xFBD6, 0x7E1F, 0xE9B2, 0x7E21, 0xEEAD, - 0x7E23, 0xFAE3, 0x7E2B, 0xDCEE, 0x7E2E, 0xF5EA, 0x7E2F, 0xE6E0, - 0x7E31, 0xF0FD, 0x7E37, 0xD7AC, 0x7E3D, 0xF5C5, 0x7E3E, 0xEEE0, - 0x7E41, 0xDBE5, 0x7E43, 0xDDDE, 0x7E46, 0xD9F0, 0x7E47, 0xE9A3, - 0x7E52, 0xF1F9, 0x7E54, 0xF2C4, 0x7E55, 0xE0CB, 0x7E5E, 0xE9A4, - 0x7E61, 0xE2B9, 0x7E69, 0xE3B1, 0x7E6A, 0xFCEB, 0x7E6B, 0xCDA8, - 0x7E6D, 0xCCB6, 0x7E70, 0xF0DB, 0x7E79, 0xE6BA, 0x7E7C, 0xCDA9, - 0x7E82, 0xF3C3, 0x7E8C, 0xE1D9, 0x7E8F, 0xEFAB, 0x7E93, 0xE7C5, - 0x7E96, 0xE0E9, 0x7E98, 0xF3C5, 0x7E9B, 0xD4C0, 0x7E9C, 0xD5BF, - 0x7F36, 0xDDAE, 0x7F38, 0xF9FC, 0x7F3A, 0xCCC0, 0x7F4C, 0xE5A2, - 0x7F50, 0xCEB8, 0x7F54, 0xD8D2, 0x7F55, 0xF9D6, 0x7F6A, 0xF1AA, - 0x7F6B, 0xCED1, 0x7F6E, 0xF6C7, 0x7F70, 0xDBEB, 0x7F72, 0xDFFE, - 0x7F75, 0xD8E1, 0x7F77, 0xF7F3, 0x7F79, 0xD7E7, 0x7F85, 0xD4FE, - 0x7F88, 0xD1BC, 0x7F8A, 0xE5CF, 0x7F8C, 0xCBB6, 0x7F8E, 0xDAB8, - 0x7F94, 0xCDC4, 0x7F9A, 0xD6BE, 0x7F9E, 0xE2BA, 0x7FA4, 0xCFD8, - 0x7FA8, 0xE0CC, 0x7FA9, 0xEBF9, 0x7FB2, 0xFDFD, 0x7FB8, 0xD7E8, - 0x7FB9, 0xCBD8, 0x7FBD, 0xE9E2, 0x7FC1, 0xE8BA, 0x7FC5, 0xE3C7, - 0x7FCA, 0xECCD, 0x7FCC, 0xECCE, 0x7FCE, 0xD6BF, 0x7FD2, 0xE3A7, - 0x7FD4, 0xDFD6, 0x7FD5, 0xFDE8, 0x7FDF, 0xEEE1, 0x7FE0, 0xF6A8, - 0x7FE1, 0xDDFD, 0x7FE9, 0xF8BB, 0x7FEB, 0xE8D1, 0x7FF0, 0xF9D7, - 0x7FF9, 0xCEEE, 0x7FFC, 0xECCF, 0x8000, 0xE9A5, 0x8001, 0xD6D5, - 0x8003, 0xCDC5, 0x8005, 0xEDBA, 0x8006, 0xD1BD, 0x8009, 0xCFBE, - 0x800C, 0xECBB, 0x8010, 0xD2B1, 0x8015, 0xCCE9, 0x8017, 0xD9C4, - 0x8018, 0xE9FC, 0x802D, 0xD1BE, 0x8033, 0xECBC, 0x8036, 0xE5AD, - 0x803D, 0xF7B0, 0x803F, 0xCCEA, 0x8043, 0xD3C4, 0x8046, 0xD6C0, - 0x804A, 0xD6FD, 0x8056, 0xE1A1, 0x8058, 0xDEBD, 0x805A, 0xF6A9, - 0x805E, 0xDAA4, 0x806F, 0xD6A4, 0x8070, 0xF5C6, 0x8072, 0xE1A2, - 0x8073, 0xE9C6, 0x8077, 0xF2C5, 0x807D, 0xF4E9, 0x807E, 0xD6EC, - 0x807F, 0xEBD3, 0x8084, 0xECBD, 0x8085, 0xE2DC, 0x8086, 0xDEEB, - 0x8087, 0xF0DC, 0x8089, 0xEBBF, 0x808B, 0xD7CE, 0x808C, 0xD1BF, - 0x8096, 0xF5AB, 0x809B, 0xF9FD, 0x809D, 0xCADC, 0x80A1, 0xCDC6, - 0x80A2, 0xF2B6, 0x80A5, 0xDDFE, 0x80A9, 0xCCB7, 0x80AA, 0xDBB8, - 0x80AF, 0xD0E9, 0x80B1, 0xCEDD, 0x80B2, 0xEBC0, 0x80B4, 0xFDA2, - 0x80BA, 0xF8CB, 0x80C3, 0xEAD6, 0x80C4, 0xF1B0, 0x80CC, 0xDBCE, - 0x80CE, 0xF7C3, 0x80DA, 0xDBCF, 0x80DB, 0xCBA4, 0x80DE, 0xF8E0, - 0x80E1, 0xFBD7, 0x80E4, 0xEBCA, 0x80E5, 0xE0A1, 0x80F1, 0xCECD, - 0x80F4, 0xD4DC, 0x80F8, 0xFDD8, 0x80FD, 0xD2F6, 0x8102, 0xF2B7, - 0x8105, 0xFAF6, 0x8106, 0xF6AA, 0x8107, 0xFAF7, 0x8108, 0xD8E6, - 0x810A, 0xF4B1, 0x8118, 0xE8D2, 0x811A, 0xCAC5, 0x811B, 0xCCEB, - 0x8123, 0xE2EE, 0x8129, 0xE2BB, 0x812B, 0xF7AD, 0x812F, 0xF8E1, - 0x8139, 0xF3EC, 0x813E, 0xDEA1, 0x814B, 0xE4FD, 0x814E, 0xE3EC, - 0x8150, 0xDDAF, 0x8151, 0xDDB0, 0x8154, 0xCBB7, 0x8155, 0xE8D3, - 0x8165, 0xE1A3, 0x8166, 0xD2E0, 0x816B, 0xF0FE, 0x8170, 0xE9A6, - 0x8171, 0xCBF2, 0x8178, 0xEDF3, 0x8179, 0xDCD9, 0x817A, 0xE0CD, - 0x817F, 0xF7DA, 0x8180, 0xDBB9, 0x8188, 0xCCAE, 0x818A, 0xDADB, - 0x818F, 0xCDC7, 0x819A, 0xDDB1, 0x819C, 0xD8AF, 0x819D, 0xE3A3, - 0x81A0, 0xCEEF, 0x81A3, 0xF2F3, 0x81A8, 0xF8B3, 0x81B3, 0xE0CE, - 0x81B5, 0xF5FD, 0x81BA, 0xEBEC, 0x81BD, 0xD3C5, 0x81BE, 0xFCEC, - 0x81BF, 0xD2DB, 0x81C0, 0xD4EB, 0x81C2, 0xDEA2, 0x81C6, 0xE5E6, - 0x81CD, 0xF0B0, 0x81D8, 0xD5C4, 0x81DF, 0xEDF4, 0x81E3, 0xE3ED, - 0x81E5, 0xE8C2, 0x81E7, 0xEDF5, 0x81E8, 0xD7FC, 0x81EA, 0xEDBB, - 0x81ED, 0xF6AB, 0x81F3, 0xF2B8, 0x81F4, 0xF6C8, 0x81FA, 0xD3E6, - 0x81FB, 0xF2DD, 0x81FC, 0xCFBF, 0x81FE, 0xEBAC, 0x8205, 0xCFC0, - 0x8207, 0xE6A8, 0x8208, 0xFDE9, 0x820A, 0xCFC1, 0x820C, 0xE0DF, - 0x820D, 0xDEEC, 0x8212, 0xE0A2, 0x821B, 0xF4BF, 0x821C, 0xE2EF, - 0x821E, 0xD9F1, 0x821F, 0xF1C7, 0x8221, 0xCBB8, 0x822A, 0xF9FE, - 0x822B, 0xDBBA, 0x822C, 0xDAF5, 0x8235, 0xF6EC, 0x8236, 0xDADC, - 0x8237, 0xFAE4, 0x8239, 0xE0CF, 0x8240, 0xDDB2, 0x8245, 0xE6A9, - 0x8247, 0xEFF3, 0x8259, 0xF3ED, 0x8264, 0xEBFA, 0x8266, 0xF9E6, - 0x826E, 0xCADD, 0x826F, 0xD5DE, 0x8271, 0xCADE, 0x8272, 0xDFE4, - 0x8276, 0xE6FD, 0x8278, 0xF5AC, 0x827E, 0xE4F5, 0x828B, 0xE9E3, - 0x828D, 0xEDCB, 0x828E, 0xCFE4, 0x8292, 0xD8D3, 0x8299, 0xDDB3, - 0x829A, 0xD4EC, 0x829D, 0xF2B9, 0x829F, 0xDFB7, 0x82A5, 0xCBCE, - 0x82A6, 0xFBD8, 0x82A9, 0xD0D9, 0x82AC, 0xDDD2, 0x82AD, 0xF7F4, - 0x82AE, 0xE7DC, 0x82AF, 0xE4A5, 0x82B1, 0xFCA3, 0x82B3, 0xDBBB, - 0x82B7, 0xF2BA, 0x82B8, 0xE9FD, 0x82B9, 0xD0CA, 0x82BB, 0xF5D6, - 0x82BC, 0xD9C5, 0x82BD, 0xE4B4, 0x82BF, 0xEDA7, 0x82D1, 0xEABD, - 0x82D2, 0xE6FE, 0x82D4, 0xF7C4, 0x82D5, 0xF5AD, 0x82D7, 0xD9E0, - 0x82DB, 0xCAB4, 0x82DE, 0xF8E2, 0x82DF, 0xCFC2, 0x82E1, 0xECBE, - 0x82E5, 0xE5B4, 0x82E6, 0xCDC8, 0x82E7, 0xEEC8, 0x82F1, 0xE7C8, - 0x82FD, 0xCDC9, 0x82FE, 0xF9B7, 0x8301, 0xF1E8, 0x8302, 0xD9F2, - 0x8303, 0xDBF5, 0x8304, 0xCAB5, 0x8305, 0xD9C6, 0x8309, 0xD8C9, - 0x8317, 0xD9AB, 0x8328, 0xEDBC, 0x832B, 0xD8D4, 0x832F, 0xDCDA, - 0x8331, 0xE2BC, 0x8334, 0xFCED, 0x8335, 0xECE0, 0x8336, 0xD2FE, - 0x8338, 0xE9C7, 0x8339, 0xE6AA, 0x8340, 0xE2F0, 0x8347, 0xFABB, - 0x8349, 0xF5AE, 0x834A, 0xFBAA, 0x834F, 0xECFB, 0x8351, 0xECBF, - 0x8352, 0xFCD8, 0x8373, 0xD4E5, 0x8377, 0xF9C3, 0x837B, 0xEEE2, - 0x8389, 0xD7E9, 0x838A, 0xEDF6, 0x838E, 0xDEED, 0x8396, 0xCCEC, - 0x8398, 0xE3EE, 0x839E, 0xE8D4, 0x83A2, 0xFAF8, 0x83A9, 0xDDB4, - 0x83AA, 0xE4B5, 0x83AB, 0xD8B0, 0x83BD, 0xD8D5, 0x83C1, 0xF4EA, - 0x83C5, 0xCEB9, 0x83C9, 0xD6E1, 0x83CA, 0xCFD2, 0x83CC, 0xD0B6, - 0x83D3, 0xCEA2, 0x83D6, 0xF3EE, 0x83DC, 0xF3F8, 0x83E9, 0xDCCC, - 0x83EB, 0xD0CB, 0x83EF, 0xFCA4, 0x83F0, 0xCDCA, 0x83F1, 0xD7D4, - 0x83F2, 0xDEA3, 0x83F4, 0xE4E0, 0x83F9, 0xEEC9, 0x83FD, 0xE2DD, - 0x8403, 0xF5FE, 0x8404, 0xD4AC, 0x840A, 0xD5D1, 0x840C, 0xD8F0, - 0x840D, 0xF8C3, 0x840E, 0xEAD7, 0x8429, 0xF5D7, 0x842C, 0xD8BF, - 0x8431, 0xFDC0, 0x8438, 0xEBAD, 0x843D, 0xD5AA, 0x8449, 0xE7A8, - 0x8457, 0xEECA, 0x845B, 0xCAE7, 0x8461, 0xF8E3, 0x8463, 0xD4DD, - 0x8466, 0xEAD8, 0x846B, 0xFBD9, 0x846C, 0xEDF7, 0x846F, 0xE5B5, - 0x8475, 0xD0AD, 0x847A, 0xF1F1, 0x8490, 0xE2BD, 0x8494, 0xE3C8, - 0x8499, 0xD9D5, 0x849C, 0xDFAA, 0x84A1, 0xDBBC, 0x84B2, 0xF8E4, - 0x84B8, 0xF1FA, 0x84BB, 0xE5B6, 0x84BC, 0xF3EF, 0x84BF, 0xFBDA, - 0x84C0, 0xE1E0, 0x84C2, 0xD9AC, 0x84C4, 0xF5EB, 0x84C6, 0xE0B6, - 0x84C9, 0xE9C8, 0x84CB, 0xCBCF, 0x84CD, 0xE3C9, 0x84D1, 0xDEEE, - 0x84DA, 0xE2BE, 0x84EC, 0xDCEF, 0x84EE, 0xD6A5, 0x84F4, 0xE2F1, - 0x84FC, 0xD6FE, 0x8511, 0xD9A1, 0x8513, 0xD8C0, 0x8514, 0xDCDB, - 0x8517, 0xEDBD, 0x8518, 0xDFB8, 0x851A, 0xEAA5, 0x851E, 0xD7AD, - 0x8521, 0xF3F9, 0x8523, 0xEDF8, 0x8525, 0xF5C7, 0x852C, 0xE1CA, - 0x852D, 0xEBE3, 0x852F, 0xF2DE, 0x853D, 0xF8CC, 0x853F, 0xEAD9, - 0x8541, 0xD3C6, 0x8543, 0xDBE6, 0x8549, 0xF5AF, 0x854E, 0xCEF0, - 0x8553, 0xE9FE, 0x8559, 0xFBB6, 0x8563, 0xE2F2, 0x8568, 0xCFF2, - 0x8569, 0xF7B9, 0x856A, 0xD9F3, 0x856D, 0xE1CB, 0x8584, 0xDADD, - 0x8587, 0xDAB9, 0x858F, 0xEBFB, 0x8591, 0xCBB9, 0x8594, 0xEDF9, - 0x859B, 0xE0E0, 0x85A6, 0xF4C0, 0x85A8, 0xFDBC, 0x85A9, 0xDFB1, - 0x85AA, 0xE3EF, 0x85AF, 0xE0A3, 0x85B0, 0xFDB9, 0x85BA, 0xF0B1, - 0x85C1, 0xCDCB, 0x85C9, 0xEDBE, 0x85CD, 0xD5C0, 0x85CE, 0xE3F0, - 0x85CF, 0xEDFA, 0x85D5, 0xE9E4, 0x85DC, 0xD5ED, 0x85DD, 0xE7DD, - 0x85E4, 0xD4F6, 0x85E5, 0xE5B7, 0x85E9, 0xDBE7, 0x85EA, 0xE2BF, - 0x85F7, 0xEECB, 0x85FA, 0xD7F4, 0x85FB, 0xF0DD, 0x85FF, 0xCEAB, - 0x8602, 0xE7DE, 0x8606, 0xD6D6, 0x8607, 0xE1CC, 0x860A, 0xE8B3, - 0x8616, 0xE5EE, 0x8617, 0xDCA2, 0x861A, 0xE0D0, 0x862D, 0xD5B5, - 0x863F, 0xD5A1, 0x864E, 0xFBDB, 0x8650, 0xF9CB, 0x8654, 0xCBF3, - 0x8655, 0xF4A5, 0x865B, 0xFAC8, 0x865C, 0xD6D7, 0x865E, 0xE9E5, - 0x865F, 0xFBDC, 0x8667, 0xFDD0, 0x8679, 0xFBF6, 0x868A, 0xDAA5, - 0x868C, 0xDBBD, 0x8693, 0xECE2, 0x86A3, 0xCDF7, 0x86A4, 0xF0DE, - 0x86A9, 0xF6C9, 0x86C7, 0xDEEF, 0x86CB, 0xD3B1, 0x86D4, 0xFCEE, - 0x86D9, 0xE8C3, 0x86DB, 0xF1C8, 0x86DF, 0xCEF1, 0x86E4, 0xF9ED, - 0x86ED, 0xF2F4, 0x86FE, 0xE4B6, 0x8700, 0xF5B9, 0x8702, 0xDCF0, - 0x8703, 0xE3F1, 0x8708, 0xE8A5, 0x8718, 0xF2BB, 0x871A, 0xDEA4, - 0x871C, 0xDACC, 0x874E, 0xCAE9, 0x8755, 0xE3DA, 0x8757, 0xFCD9, - 0x875F, 0xEADA, 0x8766, 0xF9C4, 0x8768, 0xE3A4, 0x8774, 0xFBDD, - 0x8776, 0xEFCA, 0x8778, 0xE8C4, 0x8782, 0xD5CC, 0x878D, 0xEBD7, - 0x879F, 0xD9AD, 0x87A2, 0xFBAB, 0x87B3, 0xD3D9, 0x87BA, 0xD5A2, - 0x87C4, 0xF6DE, 0x87E0, 0xDAF6, 0x87EC, 0xE0D1, 0x87EF, 0xE9A8, - 0x87F2, 0xF5F9, 0x87F9, 0xFAAF, 0x87FB, 0xEBFC, 0x87FE, 0xE0EA, - 0x8805, 0xE3B2, 0x881F, 0xD5C5, 0x8822, 0xF1E3, 0x8823, 0xD5EE, - 0x8831, 0xCDCC, 0x8836, 0xEDD9, 0x883B, 0xD8C1, 0x8840, 0xFAEC, - 0x8846, 0xF1EB, 0x884C, 0xFABC, 0x884D, 0xE6E2, 0x8852, 0xFAE5, - 0x8853, 0xE2FA, 0x8857, 0xCAB6, 0x8859, 0xE4B7, 0x885B, 0xEADB, - 0x885D, 0xF5FA, 0x8861, 0xFBAC, 0x8862, 0xCFC3, 0x8863, 0xEBFD, - 0x8868, 0xF8FA, 0x886B, 0xDFB9, 0x8870, 0xE1F1, 0x8872, 0xD2A4, - 0x8877, 0xF5FB, 0x887E, 0xD0DA, 0x887F, 0xD0DB, 0x8881, 0xEABE, - 0x8882, 0xD9B1, 0x8888, 0xCAB7, 0x888B, 0xD3E7, 0x888D, 0xF8E5, - 0x8892, 0xD3B2, 0x8896, 0xE2C0, 0x8897, 0xF2DF, 0x889E, 0xCDE5, - 0x88AB, 0xF9AC, 0x88B4, 0xCDCD, 0x88C1, 0xEEAE, 0x88C2, 0xD6AE, - 0x88CF, 0xD7EA, 0x88D4, 0xE7E0, 0x88D5, 0xEBAE, 0x88D9, 0xCFD9, - 0x88DC, 0xDCCD, 0x88DD, 0xEDFB, 0x88DF, 0xDEF0, 0x88E1, 0xD7EB, - 0x88E8, 0xDEA5, 0x88F3, 0xDFD7, 0x88F4, 0xDBD0, 0x88F5, 0xDBD1, - 0x88F8, 0xD5A3, 0x88FD, 0xF0B2, 0x8907, 0xDCDC, 0x8910, 0xCAE8, - 0x8912, 0xF8E6, 0x8913, 0xDCCE, 0x8918, 0xEADC, 0x8919, 0xDBD2, - 0x8925, 0xE9B3, 0x892A, 0xF7DB, 0x8936, 0xE3A8, 0x8938, 0xD7AE, - 0x893B, 0xE0E1, 0x8941, 0xCBBA, 0x8944, 0xE5D1, 0x895F, 0xD0DC, - 0x8964, 0xD5C1, 0x896A, 0xD8CA, 0x8972, 0xE3A9, 0x897F, 0xE0A4, - 0x8981, 0xE9A9, 0x8983, 0xD3C7, 0x8986, 0xDCDD, 0x8987, 0xF8AE, - 0x898B, 0xCCB8, 0x898F, 0xD0AE, 0x8993, 0xD8F2, 0x8996, 0xE3CA, - 0x89A1, 0xCCAF, 0x89A9, 0xD4AD, 0x89AA, 0xF6D1, 0x89B2, 0xD0CC, - 0x89BA, 0xCAC6, 0x89BD, 0xD5C2, 0x89C0, 0xCEBA, 0x89D2, 0xCAC7, - 0x89E3, 0xFAB0, 0x89F4, 0xDFD8, 0x89F8, 0xF5BA, 0x8A00, 0xE5EB, - 0x8A02, 0xEFF4, 0x8A03, 0xDDB5, 0x8A08, 0xCDAA, 0x8A0A, 0xE3F2, - 0x8A0C, 0xFBF7, 0x8A0E, 0xF7D0, 0x8A13, 0xFDBA, 0x8A16, 0xFDE1, - 0x8A17, 0xF6FE, 0x8A18, 0xD1C0, 0x8A1B, 0xE8C5, 0x8A1D, 0xE4B8, - 0x8A1F, 0xE1E8, 0x8A23, 0xCCC1, 0x8A25, 0xD2ED, 0x8A2A, 0xDBBE, - 0x8A2D, 0xE0E2, 0x8A31, 0xFAC9, 0x8A34, 0xE1CD, 0x8A36, 0xCAB8, - 0x8A3A, 0xF2E0, 0x8A3B, 0xF1C9, 0x8A50, 0xDEF1, 0x8A54, 0xF0DF, - 0x8A55, 0xF8C4, 0x8A5B, 0xEECC, 0x8A5E, 0xDEF2, 0x8A60, 0xE7C9, - 0x8A62, 0xE2F3, 0x8A63, 0xE7E1, 0x8A66, 0xE3CB, 0x8A69, 0xE3CC, - 0x8A6D, 0xCFF8, 0x8A6E, 0xEFAC, 0x8A70, 0xFDFE, 0x8A71, 0xFCA5, - 0x8A72, 0xFAB1, 0x8A73, 0xDFD9, 0x8A75, 0xE0D2, 0x8A79, 0xF4DA, - 0x8A85, 0xF1CA, 0x8A87, 0xCEA3, 0x8A8C, 0xF2BC, 0x8A8D, 0xECE3, - 0x8A93, 0xE0A5, 0x8A95, 0xF7AB, 0x8A98, 0xEBAF, 0x8A9E, 0xE5DE, - 0x8AA0, 0xE1A4, 0x8AA1, 0xCDAB, 0x8AA3, 0xD9F4, 0x8AA4, 0xE8A6, - 0x8AA5, 0xCDCE, 0x8AA6, 0xE1E9, 0x8AA8, 0xFCEF, 0x8AAA, 0xE0E3, - 0x8AB0, 0xE2C1, 0x8AB2, 0xCEA4, 0x8AB9, 0xDEA6, 0x8ABC, 0xEBFE, - 0x8ABE, 0xEBDD, 0x8ABF, 0xF0E0, 0x8AC2, 0xF4DB, 0x8AC4, 0xE2F4, - 0x8AC7, 0xD3C8, 0x8ACB, 0xF4EB, 0x8ACD, 0xEEB5, 0x8ACF, 0xF5D8, - 0x8AD2, 0xD5DF, 0x8AD6, 0xD6E5, 0x8ADB, 0xEBB0, 0x8ADC, 0xF4E3, - 0x8AE1, 0xE3CD, 0x8AE6, 0xF4F4, 0x8AE7, 0xFAB2, 0x8AEA, 0xEFF5, - 0x8AEB, 0xCADF, 0x8AED, 0xEBB1, 0x8AEE, 0xEDBF, 0x8AF1, 0xFDC9, - 0x8AF6, 0xE4A6, 0x8AF7, 0xF9A4, 0x8AF8, 0xF0B3, 0x8AFA, 0xE5EC, - 0x8AFE, 0xD1E7, 0x8B00, 0xD9C7, 0x8B01, 0xE4D7, 0x8B02, 0xEADD, - 0x8B04, 0xD4F7, 0x8B0E, 0xDABA, 0x8B10, 0xDACD, 0x8B14, 0xF9CC, - 0x8B16, 0xE1DA, 0x8B17, 0xDBBF, 0x8B19, 0xCCC5, 0x8B1A, 0xECD0, - 0x8B1B, 0xCBBB, 0x8B1D, 0xDEF3, 0x8B20, 0xE9AA, 0x8B28, 0xD9C8, - 0x8B2B, 0xEEE3, 0x8B2C, 0xD7BD, 0x8B33, 0xCFC4, 0x8B39, 0xD0CD, - 0x8B41, 0xFCA6, 0x8B49, 0xF1FB, 0x8B4E, 0xFDD2, 0x8B4F, 0xD1C1, - 0x8B58, 0xE3DB, 0x8B5A, 0xD3C9, 0x8B5C, 0xDCCF, 0x8B66, 0xCCED, - 0x8B6C, 0xDEA7, 0x8B6F, 0xE6BB, 0x8B70, 0xECA1, 0x8B74, 0xCCB9, - 0x8B77, 0xFBDE, 0x8B7D, 0xE7E2, 0x8B80, 0xD4C1, 0x8B8A, 0xDCA8, - 0x8B90, 0xE2C2, 0x8B92, 0xF3D8, 0x8B93, 0xE5D3, 0x8B96, 0xF3D9, - 0x8B9A, 0xF3C6, 0x8C37, 0xCDDB, 0x8C3F, 0xCDAC, 0x8C41, 0xFCC3, - 0x8C46, 0xD4E7, 0x8C48, 0xD1C2, 0x8C4A, 0xF9A5, 0x8C4C, 0xE8D5, - 0x8C55, 0xE3CE, 0x8C5A, 0xD4CA, 0x8C61, 0xDFDA, 0x8C6A, 0xFBDF, - 0x8C6B, 0xE7E3, 0x8C79, 0xF8FB, 0x8C7A, 0xE3CF, 0x8C82, 0xF5B0, - 0x8C8A, 0xD8E7, 0x8C8C, 0xD9C9, 0x8C9D, 0xF8AF, 0x8C9E, 0xEFF6, - 0x8CA0, 0xDDB6, 0x8CA1, 0xEEAF, 0x8CA2, 0xCDF8, 0x8CA7, 0xDEB8, - 0x8CA8, 0xFCA7, 0x8CA9, 0xF7FC, 0x8CAA, 0xF7B1, 0x8CAB, 0xCEBB, - 0x8CAC, 0xF4A1, 0x8CAF, 0xEECD, 0x8CB0, 0xE1AE, 0x8CB3, 0xECC3, - 0x8CB4, 0xCFFE, 0x8CB6, 0xF8BF, 0x8CB7, 0xD8E2, 0x8CB8, 0xD3E8, - 0x8CBB, 0xDEA8, 0x8CBC, 0xF4E4, 0x8CBD, 0xECC2, 0x8CBF, 0xD9F5, - 0x8CC0, 0xF9C5, 0x8CC1, 0xDDD3, 0x8CC2, 0xD6F1, 0x8CC3, 0xECFC, - 0x8CC4, 0xFCF0, 0x8CC7, 0xEDC0, 0x8CC8, 0xCAB9, 0x8CCA, 0xEEE4, - 0x8CD1, 0xF2E1, 0x8CD3, 0xDEB9, 0x8CDA, 0xD6F2, 0x8CDC, 0xDEF4, - 0x8CDE, 0xDFDB, 0x8CE0, 0xDBD3, 0x8CE2, 0xFAE7, 0x8CE3, 0xD8E3, - 0x8CE4, 0xF4C1, 0x8CE6, 0xDDB7, 0x8CEA, 0xF2F5, 0x8CED, 0xD4AE, - 0x8CF4, 0xD6F3, 0x8CFB, 0xDDB8, 0x8CFC, 0xCFC5, 0x8CFD, 0xDFDF, - 0x8D04, 0xF2BE, 0x8D05, 0xF6A1, 0x8D07, 0xEBCB, 0x8D08, 0xF1FC, - 0x8D0A, 0xF3C7, 0x8D0D, 0xE0EB, 0x8D13, 0xEDFC, 0x8D16, 0xE1DB, - 0x8D64, 0xEEE5, 0x8D66, 0xDEF5, 0x8D6B, 0xFAD3, 0x8D70, 0xF1CB, - 0x8D73, 0xD0AF, 0x8D74, 0xDDB9, 0x8D77, 0xD1C3, 0x8D85, 0xF5B1, - 0x8D8A, 0xEAC6, 0x8D99, 0xF0E1, 0x8DA3, 0xF6AC, 0x8DA8, 0xF5D9, - 0x8DB3, 0xF0EB, 0x8DBA, 0xDDBA, 0x8DBE, 0xF2BF, 0x8DC6, 0xF7C5, - 0x8DCB, 0xDBA2, 0x8DCC, 0xF2F6, 0x8DCF, 0xCABA, 0x8DDB, 0xF7F5, - 0x8DDD, 0xCBE5, 0x8DE1, 0xEEE6, 0x8DE3, 0xE0D3, 0x8DE8, 0xCEA5, - 0x8DEF, 0xD6D8, 0x8DF3, 0xD4AF, 0x8E0A, 0xE9C9, 0x8E0F, 0xD3CE, - 0x8E10, 0xF4C2, 0x8E1E, 0xCBE6, 0x8E2A, 0xF1A1, 0x8E30, 0xEBB2, - 0x8E35, 0xF1A2, 0x8E42, 0xEBB3, 0x8E44, 0xF0B4, 0x8E47, 0xCBF4, - 0x8E48, 0xD4B0, 0x8E49, 0xF3B2, 0x8E4A, 0xFBB7, 0x8E59, 0xF5EC, - 0x8E5F, 0xEEE7, 0x8E60, 0xF4B2, 0x8E74, 0xF5ED, 0x8E76, 0xCFF3, - 0x8E81, 0xF0E2, 0x8E87, 0xEECE, 0x8E8A, 0xF1CC, 0x8E8D, 0xE5B8, - 0x8EAA, 0xD7F5, 0x8EAB, 0xE3F3, 0x8EAC, 0xCFE5, 0x8EC0, 0xCFC6, - 0x8ECA, 0xF3B3, 0x8ECB, 0xE4D8, 0x8ECC, 0xCFF9, 0x8ECD, 0xCFDA, - 0x8ED2, 0xFACD, 0x8EDF, 0xE6E3, 0x8EEB, 0xF2E2, 0x8EF8, 0xF5EE, - 0x8EFB, 0xCABB, 0x8EFE, 0xE3DC, 0x8F03, 0xCEF2, 0x8F05, 0xD6D9, - 0x8F09, 0xEEB0, 0x8F12, 0xF4E5, 0x8F13, 0xD8C2, 0x8F14, 0xDCD0, - 0x8F15, 0xCCEE, 0x8F1B, 0xD5E0, 0x8F1C, 0xF6CA, 0x8F1D, 0xFDCA, - 0x8F1E, 0xD8D6, 0x8F1F, 0xF4CF, 0x8F26, 0xD6A6, 0x8F27, 0xDCBE, - 0x8F29, 0xDBD4, 0x8F2A, 0xD7C7, 0x8F2F, 0xF2FE, 0x8F33, 0xF1CD, - 0x8F38, 0xE2C3, 0x8F39, 0xDCDE, 0x8F3B, 0xDCDF, 0x8F3E, 0xEFAD, - 0x8F3F, 0xE6AB, 0x8F44, 0xF9DD, 0x8F45, 0xEABF, 0x8F49, 0xEFAE, - 0x8F4D, 0xF4D0, 0x8F4E, 0xCEF3, 0x8F5D, 0xE6AC, 0x8F5F, 0xCEDE, - 0x8F62, 0xD5F9, 0x8F9B, 0xE3F4, 0x8F9C, 0xCDD0, 0x8FA3, 0xD5B8, - 0x8FA6, 0xF7FD, 0x8FA8, 0xDCA9, 0x8FAD, 0xDEF6, 0x8FAF, 0xDCAA, - 0x8FB0, 0xF2E3, 0x8FB1, 0xE9B4, 0x8FB2, 0xD2DC, 0x8FC2, 0xE9E6, - 0x8FC5, 0xE3F6, 0x8FCE, 0xE7CA, 0x8FD1, 0xD0CE, 0x8FD4, 0xDAF7, - 0x8FE6, 0xCABC, 0x8FEA, 0xEEE8, 0x8FEB, 0xDADE, 0x8FED, 0xF2F7, - 0x8FF0, 0xE2FB, 0x8FF2, 0xCCA6, 0x8FF7, 0xDABB, 0x8FF9, 0xEEE9, - 0x8FFD, 0xF5DA, 0x9000, 0xF7DC, 0x9001, 0xE1EA, 0x9002, 0xCEC1, - 0x9003, 0xD4B1, 0x9005, 0xFDB1, 0x9006, 0xE6BD, 0x9008, 0xFBAD, - 0x900B, 0xF8E7, 0x900D, 0xE1CE, 0x900F, 0xF7E2, 0x9010, 0xF5EF, - 0x9011, 0xCFC7, 0x9014, 0xD4B2, 0x9015, 0xCCEF, 0x9017, 0xD4E8, - 0x9019, 0xEECF, 0x901A, 0xF7D7, 0x901D, 0xE0A6, 0x901E, 0xD6C1, - 0x901F, 0xE1DC, 0x9020, 0xF0E3, 0x9021, 0xF1E4, 0x9022, 0xDCF1, - 0x9023, 0xD6A7, 0x902E, 0xF4F5, 0x9031, 0xF1CE, 0x9032, 0xF2E4, - 0x9035, 0xD0B0, 0x9038, 0xECEF, 0x903C, 0xF9BA, 0x903E, 0xEBB5, - 0x9041, 0xD4ED, 0x9042, 0xE2C4, 0x9047, 0xE9E7, 0x904A, 0xEBB4, - 0x904B, 0xEAA1, 0x904D, 0xF8BC, 0x904E, 0xCEA6, 0x9050, 0xF9C6, - 0x9051, 0xFCDA, 0x9053, 0xD4B3, 0x9054, 0xD3B9, 0x9055, 0xEADE, - 0x9059, 0xE9AB, 0x905C, 0xE1E1, 0x905D, 0xD3CF, 0x905E, 0xF4F6, - 0x9060, 0xEAC0, 0x9061, 0xE1CF, 0x9063, 0xCCBA, 0x9069, 0xEEEA, - 0x906D, 0xF0E4, 0x906E, 0xF3B4, 0x906F, 0xD4EE, 0x9072, 0xF2C0, - 0x9075, 0xF1E5, 0x9077, 0xF4C3, 0x9078, 0xE0D4, 0x907A, 0xEBB6, - 0x907C, 0xD7A1, 0x907D, 0xCBE8, 0x907F, 0xF9AD, 0x9080, 0xE9AD, - 0x9081, 0xD8E4, 0x9082, 0xFAB3, 0x9083, 0xE2C5, 0x9084, 0xFCBD, - 0x9087, 0xECC4, 0x9088, 0xD8B1, 0x908A, 0xDCAB, 0x908F, 0xD5A4, - 0x9091, 0xEBE9, 0x9095, 0xE8BB, 0x9099, 0xD8D7, 0x90A2, 0xFBAE, - 0x90A3, 0xD1E1, 0x90A6, 0xDBC0, 0x90A8, 0xF5BE, 0x90AA, 0xDEF7, - 0x90AF, 0xCAFB, 0x90B0, 0xF7C6, 0x90B1, 0xCFC8, 0x90B5, 0xE1D0, - 0x90B8, 0xEED0, 0x90C1, 0xE9F4, 0x90CA, 0xCEF4, 0x90DE, 0xD5CD, - 0x90E1, 0xCFDB, 0x90E8, 0xDDBB, 0x90ED, 0xCEAC, 0x90F5, 0xE9E8, - 0x90FD, 0xD4B4, 0x9102, 0xE4C7, 0x9112, 0xF5DB, 0x9115, 0xFAC1, - 0x9119, 0xDEA9, 0x9127, 0xD4F8, 0x912D, 0xEFF7, 0x9132, 0xD3B3, - 0x9149, 0xEBB7, 0x914A, 0xEFF8, 0x914B, 0xF5DC, 0x914C, 0xEDCC, - 0x914D, 0xDBD5, 0x914E, 0xF1CF, 0x9152, 0xF1D0, 0x9162, 0xF5B2, - 0x9169, 0xD9AE, 0x916A, 0xD5AC, 0x916C, 0xE2C6, 0x9175, 0xFDA3, - 0x9177, 0xFBE5, 0x9178, 0xDFAB, 0x9187, 0xE2F5, 0x9189, 0xF6AD, - 0x918B, 0xF5B3, 0x918D, 0xF0B5, 0x9192, 0xE1A5, 0x919C, 0xF5DD, - 0x91AB, 0xECA2, 0x91AC, 0xEDFD, 0x91AE, 0xF5B4, 0x91AF, 0xFBB8, - 0x91B1, 0xDBA3, 0x91B4, 0xD6CA, 0x91B5, 0xCBD9, 0x91C0, 0xE5D4, - 0x91C7, 0xF3FA, 0x91C9, 0xEBB8, 0x91CB, 0xE0B7, 0x91CC, 0xD7EC, - 0x91CD, 0xF1EC, 0x91CE, 0xE5AF, 0x91CF, 0xD5E1, 0x91D0, 0xD7ED, - 0x91D1, 0xD1D1, 0x91D7, 0xE1F2, 0x91D8, 0xEFF9, 0x91DC, 0xDDBC, - 0x91DD, 0xF6DC, 0x91E3, 0xF0E5, 0x91E7, 0xF4C4, 0x91EA, 0xE9E9, - 0x91F5, 0xF3FB, 0x920D, 0xD4EF, 0x9210, 0xCCA2, 0x9211, 0xF7FE, - 0x9212, 0xDFBC, 0x9217, 0xEBCD, 0x921E, 0xD0B7, 0x9234, 0xD6C2, - 0x923A, 0xE8AD, 0x923F, 0xEFAF, 0x9240, 0xCBA5, 0x9245, 0xCBE9, - 0x9249, 0xFAE8, 0x9257, 0xCCC6, 0x925B, 0xE6E7, 0x925E, 0xEAC7, - 0x9262, 0xDBA4, 0x9264, 0xCFC9, 0x9265, 0xE2FC, 0x9266, 0xEFFA, - 0x9280, 0xEBDE, 0x9283, 0xF5C8, 0x9285, 0xD4DE, 0x9291, 0xE0D5, - 0x9293, 0xEFB0, 0x9296, 0xE2C7, 0x9298, 0xD9AF, 0x929C, 0xF9E7, - 0x92B3, 0xE7E5, 0x92B6, 0xCFCA, 0x92B7, 0xE1D1, 0x92B9, 0xE2C8, - 0x92CC, 0xEFFB, 0x92CF, 0xFAF9, 0x92D2, 0xDCF2, 0x92E4, 0xE0A7, - 0x92EA, 0xF8E8, 0x92F8, 0xCBEA, 0x92FC, 0xCBBC, 0x9304, 0xD6E2, - 0x9310, 0xF5DE, 0x9318, 0xF5DF, 0x931A, 0xEEB6, 0x931E, 0xE2F6, - 0x931F, 0xD3CA, 0x9320, 0xEFFC, 0x9321, 0xD1C4, 0x9322, 0xEFB1, - 0x9324, 0xD1C5, 0x9326, 0xD0DE, 0x9328, 0xD9E1, 0x932B, 0xE0B8, - 0x932E, 0xCDD1, 0x932F, 0xF3B9, 0x9348, 0xE7CC, 0x934A, 0xD6A8, - 0x934B, 0xCEA7, 0x934D, 0xD4B5, 0x9354, 0xE4C8, 0x935B, 0xD3B4, - 0x936E, 0xEBB9, 0x9375, 0xCBF5, 0x937C, 0xF6DD, 0x937E, 0xF1A3, - 0x938C, 0xCCC7, 0x9394, 0xE9CA, 0x9396, 0xE1F0, 0x939A, 0xF5E0, - 0x93A3, 0xFBAF, 0x93A7, 0xCBD1, 0x93AC, 0xFBE0, 0x93AD, 0xF2E5, - 0x93B0, 0xECF0, 0x93C3, 0xF0EC, 0x93D1, 0xEEEB, 0x93DE, 0xE9CB, - 0x93E1, 0xCCF0, 0x93E4, 0xD7AF, 0x93F6, 0xF3A1, 0x9404, 0xFCF5, - 0x9418, 0xF1A4, 0x9425, 0xE0D6, 0x942B, 0xEFB2, 0x9435, 0xF4D1, - 0x9438, 0xF7A1, 0x9444, 0xF1D1, 0x9451, 0xCAFC, 0x9452, 0xCAFD, - 0x945B, 0xCECE, 0x947D, 0xF3C8, 0x947F, 0xF3BA, 0x9577, 0xEDFE, - 0x9580, 0xDAA6, 0x9583, 0xE0EC, 0x9589, 0xF8CD, 0x958B, 0xCBD2, - 0x958F, 0xEBCE, 0x9591, 0xF9D8, 0x9592, 0xF9D9, 0x9593, 0xCAE0, - 0x9594, 0xDACA, 0x9598, 0xCBA6, 0x95A3, 0xCAC8, 0x95A4, 0xF9EE, - 0x95A5, 0xDBEC, 0x95A8, 0xD0B1, 0x95AD, 0xD5EF, 0x95B1, 0xE6F3, - 0x95BB, 0xE7A2, 0x95BC, 0xE4D9, 0x95C7, 0xE4E1, 0x95CA, 0xFCC4, - 0x95D4, 0xF9EF, 0x95D5, 0xCFF4, 0x95D6, 0xF7E6, 0x95DC, 0xCEBC, - 0x95E1, 0xF4C5, 0x95E2, 0xDCA3, 0x961C, 0xDDBD, 0x9621, 0xF4C6, - 0x962A, 0xF8A1, 0x962E, 0xE8D6, 0x9632, 0xDBC1, 0x963B, 0xF0E6, - 0x963F, 0xE4B9, 0x9640, 0xF6ED, 0x9642, 0xF9AE, 0x9644, 0xDDBE, - 0x964B, 0xD7B0, 0x964C, 0xD8E8, 0x964D, 0xCBBD, 0x9650, 0xF9DA, - 0x965B, 0xF8CE, 0x965C, 0xF9F0, 0x965D, 0xE0ED, 0x965E, 0xE3B3, - 0x965F, 0xF4B3, 0x9662, 0xEAC2, 0x9663, 0xF2E6, 0x9664, 0xF0B6, - 0x966A, 0xDBD6, 0x9670, 0xEBE4, 0x9673, 0xF2E7, 0x9675, 0xD7D5, - 0x9676, 0xD4B6, 0x9677, 0xF9E8, 0x9678, 0xD7C1, 0x967D, 0xE5D5, - 0x9685, 0xE9EA, 0x9686, 0xD7CC, 0x968A, 0xD3E9, 0x968B, 0xE2C9, - 0x968D, 0xFCDB, 0x968E, 0xCDAD, 0x9694, 0xCCB0, 0x9695, 0xEAA2, - 0x9698, 0xE4F6, 0x9699, 0xD0C0, 0x969B, 0xF0B7, 0x969C, 0xEEA1, - 0x96A3, 0xD7F6, 0x96A7, 0xE2CA, 0x96A8, 0xE2CB, 0x96AA, 0xFACF, - 0x96B1, 0xEBDF, 0x96B7, 0xD6CB, 0x96BB, 0xF4B4, 0x96C0, 0xEDCD, - 0x96C1, 0xE4D2, 0x96C4, 0xEAA9, 0x96C5, 0xE4BA, 0x96C6, 0xF3A2, - 0x96C7, 0xCDD2, 0x96C9, 0xF6CB, 0x96CB, 0xF1E6, 0x96CC, 0xEDC1, - 0x96CD, 0xE8BC, 0x96CE, 0xEED1, 0x96D5, 0xF0E7, 0x96D6, 0xE2CC, - 0x96D9, 0xE4AA, 0x96DB, 0xF5E1, 0x96DC, 0xEDDA, 0x96E2, 0xD7EE, - 0x96E3, 0xD1F1, 0x96E8, 0xE9EB, 0x96E9, 0xE9EC, 0x96EA, 0xE0E4, - 0x96EF, 0xDAA7, 0x96F0, 0xDDD4, 0x96F2, 0xEAA3, 0x96F6, 0xD6C3, - 0x96F7, 0xD6F4, 0x96F9, 0xDADF, 0x96FB, 0xEFB3, 0x9700, 0xE2CD, - 0x9706, 0xEFFD, 0x9707, 0xF2E8, 0x9711, 0xEFC5, 0x9713, 0xE7E7, - 0x9716, 0xD7FD, 0x9719, 0xE7CE, 0x971C, 0xDFDC, 0x971E, 0xF9C7, - 0x9727, 0xD9F6, 0x9730, 0xDFAC, 0x9732, 0xD6DA, 0x9739, 0xDCA4, - 0x973D, 0xF0B8, 0x9742, 0xD5FA, 0x9744, 0xE4F7, 0x9748, 0xD6C4, - 0x9751, 0xF4EC, 0x9756, 0xEFFE, 0x975C, 0xF0A1, 0x975E, 0xDEAA, - 0x9761, 0xDABC, 0x9762, 0xD8FC, 0x9769, 0xFAD4, 0x976D, 0xECE5, - 0x9774, 0xFCA8, 0x9777, 0xECE6, 0x977A, 0xD8CB, 0x978B, 0xFBB9, - 0x978D, 0xE4D3, 0x978F, 0xCDF9, 0x97A0, 0xCFD3, 0x97A8, 0xCAEA, - 0x97AB, 0xCFD4, 0x97AD, 0xF8BD, 0x97C6, 0xF4C7, 0x97CB, 0xEADF, - 0x97D3, 0xF9DB, 0x97DC, 0xD4B7, 0x97F3, 0xEBE5, 0x97F6, 0xE1D2, - 0x97FB, 0xEAA4, 0x97FF, 0xFAC2, 0x9800, 0xFBE1, 0x9801, 0xFAED, - 0x9802, 0xF0A2, 0x9803, 0xCCF1, 0x9805, 0xFAA3, 0x9806, 0xE2F7, - 0x9808, 0xE2CE, 0x980A, 0xE9F5, 0x980C, 0xE1EB, 0x9810, 0xE7E8, - 0x9811, 0xE8D7, 0x9812, 0xDAF8, 0x9813, 0xD4CB, 0x9817, 0xF7F6, - 0x9818, 0xD6C5, 0x982D, 0xD4E9, 0x9830, 0xFAFA, 0x9838, 0xCCF2, - 0x9839, 0xF7DD, 0x983B, 0xDEBA, 0x9846, 0xCEA8, 0x984C, 0xF0B9, - 0x984D, 0xE4FE, 0x984E, 0xE4C9, 0x9854, 0xE4D4, 0x9858, 0xEAC3, - 0x985A, 0xEFB4, 0x985E, 0xD7BE, 0x9865, 0xFBE2, 0x9867, 0xCDD3, - 0x986B, 0xEFB5, 0x986F, 0xFAE9, 0x98A8, 0xF9A6, 0x98AF, 0xDFBD, - 0x98B1, 0xF7C7, 0x98C4, 0xF8FD, 0x98C7, 0xF8FC, 0x98DB, 0xDEAB, - 0x98DC, 0xDBE8, 0x98DF, 0xE3DD, 0x98E1, 0xE1E2, 0x98E2, 0xD1C6, - 0x98ED, 0xF6D0, 0x98EE, 0xEBE6, 0x98EF, 0xDAF9, 0x98F4, 0xECC7, - 0x98FC, 0xDEF8, 0x98FD, 0xF8E9, 0x98FE, 0xE3DE, 0x9903, 0xCEF5, - 0x9909, 0xFAC3, 0x990A, 0xE5D7, 0x990C, 0xECC8, 0x9910, 0xF3C9, - 0x9913, 0xE4BB, 0x9918, 0xE6AE, 0x991E, 0xEFB6, 0x9920, 0xDCBF, - 0x9928, 0xCEBD, 0x9945, 0xD8C3, 0x9949, 0xD0CF, 0x994B, 0xCFFA, - 0x994C, 0xF3CA, 0x994D, 0xE0D7, 0x9951, 0xD1C7, 0x9952, 0xE9AE, - 0x9954, 0xE8BD, 0x9957, 0xFAC4, 0x9996, 0xE2CF, 0x9999, 0xFAC5, - 0x999D, 0xF9B8, 0x99A5, 0xDCE0, 0x99A8, 0xFBB0, 0x99AC, 0xD8A9, - 0x99AD, 0xE5DF, 0x99AE, 0xF9A7, 0x99B1, 0xF6EE, 0x99B3, 0xF6CC, - 0x99B4, 0xE2F8, 0x99B9, 0xECF1, 0x99C1, 0xDAE0, 0x99D0, 0xF1D2, - 0x99D1, 0xD2CC, 0x99D2, 0xCFCB, 0x99D5, 0xCABD, 0x99D9, 0xDDBF, - 0x99DD, 0xF6EF, 0x99DF, 0xDEF9, 0x99ED, 0xFAB4, 0x99F1, 0xD5AD, - 0x99FF, 0xF1E7, 0x9A01, 0xDEBE, 0x9A08, 0xDCC0, 0x9A0E, 0xD1C8, - 0x9A0F, 0xD1C9, 0x9A19, 0xF8BE, 0x9A2B, 0xCBF6, 0x9A30, 0xD4F9, - 0x9A36, 0xF5E2, 0x9A37, 0xE1D3, 0x9A40, 0xD8E9, 0x9A43, 0xF8FE, - 0x9A45, 0xCFCC, 0x9A4D, 0xFDA4, 0x9A55, 0xCEF6, 0x9A57, 0xFAD0, - 0x9A5A, 0xCCF3, 0x9A5B, 0xE6BE, 0x9A5F, 0xF6AE, 0x9A62, 0xD5F0, - 0x9A65, 0xD1CA, 0x9A69, 0xFCBE, 0x9A6A, 0xD5F1, 0x9AA8, 0xCDE9, - 0x9AB8, 0xFAB5, 0x9AD3, 0xE2D0, 0x9AD4, 0xF4F7, 0x9AD8, 0xCDD4, - 0x9AE5, 0xE7A3, 0x9AEE, 0xDBA5, 0x9B1A, 0xE2D1, 0x9B27, 0xD7A2, - 0x9B2A, 0xF7E3, 0x9B31, 0xEAA6, 0x9B3C, 0xD0A1, 0x9B41, 0xCEDA, - 0x9B42, 0xFBEB, 0x9B43, 0xDBA6, 0x9B44, 0xDBDE, 0x9B45, 0xD8E5, - 0x9B4F, 0xEAE0, 0x9B54, 0xD8AA, 0x9B5A, 0xE5E0, 0x9B6F, 0xD6DB, - 0x9B8E, 0xEFC6, 0x9B91, 0xF8EA, 0x9B9F, 0xE4D5, 0x9BAB, 0xCEF7, - 0x9BAE, 0xE0D8, 0x9BC9, 0xD7EF, 0x9BD6, 0xF4ED, 0x9BE4, 0xCDE6, - 0x9BE8, 0xCCF4, 0x9C0D, 0xF5E3, 0x9C10, 0xE4CA, 0x9C12, 0xDCE1, - 0x9C15, 0xF9C8, 0x9C25, 0xFCBF, 0x9C32, 0xE8A7, 0x9C3B, 0xD8C4, - 0x9C47, 0xCBBE, 0x9C49, 0xDCAE, 0x9C57, 0xD7F7, 0x9CE5, 0xF0E8, - 0x9CE7, 0xDDC0, 0x9CE9, 0xCFCD, 0x9CF3, 0xDCF3, 0x9CF4, 0xD9B0, - 0x9CF6, 0xE6E9, 0x9D09, 0xE4BC, 0x9D1B, 0xEAC4, 0x9D26, 0xE4EC, - 0x9D28, 0xE4E5, 0x9D3B, 0xFBF8, 0x9D51, 0xCCBB, 0x9D5D, 0xE4BD, - 0x9D60, 0xCDDC, 0x9D61, 0xD9F7, 0x9D6C, 0xDDDF, 0x9D72, 0xEDCE, - 0x9DA9, 0xD9D0, 0x9DAF, 0xE5A3, 0x9DB4, 0xF9CD, 0x9DC4, 0xCDAE, - 0x9DD7, 0xCFCE, 0x9DF2, 0xF6AF, 0x9DF8, 0xFDD3, 0x9DF9, 0xEBED, - 0x9DFA, 0xD6DC, 0x9E1A, 0xE5A4, 0x9E1E, 0xD5B6, 0x9E75, 0xD6DD, - 0x9E79, 0xF9E9, 0x9E7D, 0xE7A4, 0x9E7F, 0xD6E3, 0x9E92, 0xD1CB, - 0x9E93, 0xD6E4, 0x9E97, 0xD5F2, 0x9E9D, 0xDEFA, 0x9E9F, 0xD7F8, - 0x9EA5, 0xD8EA, 0x9EB4, 0xCFD5, 0x9EB5, 0xD8FD, 0x9EBB, 0xD8AB, - 0x9EBE, 0xFDCB, 0x9EC3, 0xFCDC, 0x9ECD, 0xE0A8, 0x9ECE, 0xD5F3, - 0x9ED1, 0xFDD9, 0x9ED4, 0xCCA3, 0x9ED8, 0xD9F9, 0x9EDB, 0xD3EA, - 0x9EDC, 0xF5F5, 0x9EDE, 0xEFC7, 0x9EE8, 0xD3DA, 0x9EF4, 0xDABD, - 0x9F07, 0xE8A8, 0x9F08, 0xDCAF, 0x9F0E, 0xF0A3, 0x9F13, 0xCDD5, - 0x9F20, 0xE0A9, 0x9F3B, 0xDEAC, 0x9F4A, 0xF0BA, 0x9F4B, 0xEEB1, - 0x9F4E, 0xEEB2, 0x9F52, 0xF6CD, 0x9F5F, 0xEED2, 0x9F61, 0xD6C6, - 0x9F67, 0xE0E5, 0x9F6A, 0xF3BB, 0x9F6C, 0xE5E1, 0x9F77, 0xE4CB, - 0x9F8D, 0xD7A3, 0x9F90, 0xDBC2, 0x9F95, 0xCAFE, 0x9F9C, 0xCFCF, - 0xAC00, 0xB0A1, 0xAC01, 0xB0A2, 0xAC02, 0x8141, 0xAC03, 0x8142, - 0xAC04, 0xB0A3, 0xAC05, 0x8143, 0xAC06, 0x8144, 0xAC07, 0xB0A4, - 0xAC08, 0xB0A5, 0xAC09, 0xB0A6, 0xAC0A, 0xB0A7, 0xAC0B, 0x8145, - 0xAC0C, 0x8146, 0xAC0D, 0x8147, 0xAC0E, 0x8148, 0xAC0F, 0x8149, - 0xAC10, 0xB0A8, 0xAC11, 0xB0A9, 0xAC12, 0xB0AA, 0xAC13, 0xB0AB, - 0xAC14, 0xB0AC, 0xAC15, 0xB0AD, 0xAC16, 0xB0AE, 0xAC17, 0xB0AF, - 0xAC18, 0x814A, 0xAC19, 0xB0B0, 0xAC1A, 0xB0B1, 0xAC1B, 0xB0B2, - 0xAC1C, 0xB0B3, 0xAC1D, 0xB0B4, 0xAC1E, 0x814B, 0xAC1F, 0x814C, - 0xAC20, 0xB0B5, 0xAC21, 0x814D, 0xAC22, 0x814E, 0xAC23, 0x814F, - 0xAC24, 0xB0B6, 0xAC25, 0x8150, 0xAC26, 0x8151, 0xAC27, 0x8152, - 0xAC28, 0x8153, 0xAC29, 0x8154, 0xAC2A, 0x8155, 0xAC2B, 0x8156, - 0xAC2C, 0xB0B7, 0xAC2D, 0xB0B8, 0xAC2E, 0x8157, 0xAC2F, 0xB0B9, - 0xAC30, 0xB0BA, 0xAC31, 0xB0BB, 0xAC32, 0x8158, 0xAC33, 0x8159, - 0xAC34, 0x815A, 0xAC35, 0x8161, 0xAC36, 0x8162, 0xAC37, 0x8163, - 0xAC38, 0xB0BC, 0xAC39, 0xB0BD, 0xAC3A, 0x8164, 0xAC3B, 0x8165, - 0xAC3C, 0xB0BE, 0xAC3D, 0x8166, 0xAC3E, 0x8167, 0xAC3F, 0x8168, - 0xAC40, 0xB0BF, 0xAC41, 0x8169, 0xAC42, 0x816A, 0xAC43, 0x816B, - 0xAC44, 0x816C, 0xAC45, 0x816D, 0xAC46, 0x816E, 0xAC47, 0x816F, - 0xAC48, 0x8170, 0xAC49, 0x8171, 0xAC4A, 0x8172, 0xAC4B, 0xB0C0, - 0xAC4C, 0x8173, 0xAC4D, 0xB0C1, 0xAC4E, 0x8174, 0xAC4F, 0x8175, - 0xAC50, 0x8176, 0xAC51, 0x8177, 0xAC52, 0x8178, 0xAC53, 0x8179, - 0xAC54, 0xB0C2, 0xAC55, 0x817A, 0xAC56, 0x8181, 0xAC57, 0x8182, - 0xAC58, 0xB0C3, 0xAC59, 0x8183, 0xAC5A, 0x8184, 0xAC5B, 0x8185, - 0xAC5C, 0xB0C4, 0xAC5D, 0x8186, 0xAC5E, 0x8187, 0xAC5F, 0x8188, - 0xAC60, 0x8189, 0xAC61, 0x818A, 0xAC62, 0x818B, 0xAC63, 0x818C, - 0xAC64, 0x818D, 0xAC65, 0x818E, 0xAC66, 0x818F, 0xAC67, 0x8190, - 0xAC68, 0x8191, 0xAC69, 0x8192, 0xAC6A, 0x8193, 0xAC6B, 0x8194, - 0xAC6C, 0x8195, 0xAC6D, 0x8196, 0xAC6E, 0x8197, 0xAC6F, 0x8198, - 0xAC70, 0xB0C5, 0xAC71, 0xB0C6, 0xAC72, 0x8199, 0xAC73, 0x819A, - 0xAC74, 0xB0C7, 0xAC75, 0x819B, 0xAC76, 0x819C, 0xAC77, 0xB0C8, - 0xAC78, 0xB0C9, 0xAC79, 0x819D, 0xAC7A, 0xB0CA, 0xAC7B, 0x819E, - 0xAC7C, 0x819F, 0xAC7D, 0x81A0, 0xAC7E, 0x81A1, 0xAC7F, 0x81A2, - 0xAC80, 0xB0CB, 0xAC81, 0xB0CC, 0xAC82, 0x81A3, 0xAC83, 0xB0CD, - 0xAC84, 0xB0CE, 0xAC85, 0xB0CF, 0xAC86, 0xB0D0, 0xAC87, 0x81A4, - 0xAC88, 0x81A5, 0xAC89, 0xB0D1, 0xAC8A, 0xB0D2, 0xAC8B, 0xB0D3, - 0xAC8C, 0xB0D4, 0xAC8D, 0x81A6, 0xAC8E, 0x81A7, 0xAC8F, 0x81A8, - 0xAC90, 0xB0D5, 0xAC91, 0x81A9, 0xAC92, 0x81AA, 0xAC93, 0x81AB, - 0xAC94, 0xB0D6, 0xAC95, 0x81AC, 0xAC96, 0x81AD, 0xAC97, 0x81AE, - 0xAC98, 0x81AF, 0xAC99, 0x81B0, 0xAC9A, 0x81B1, 0xAC9B, 0x81B2, - 0xAC9C, 0xB0D7, 0xAC9D, 0xB0D8, 0xAC9E, 0x81B3, 0xAC9F, 0xB0D9, - 0xACA0, 0xB0DA, 0xACA1, 0xB0DB, 0xACA2, 0x81B4, 0xACA3, 0x81B5, - 0xACA4, 0x81B6, 0xACA5, 0x81B7, 0xACA6, 0x81B8, 0xACA7, 0x81B9, - 0xACA8, 0xB0DC, 0xACA9, 0xB0DD, 0xACAA, 0xB0DE, 0xACAB, 0x81BA, - 0xACAC, 0xB0DF, 0xACAD, 0x81BB, 0xACAE, 0x81BC, 0xACAF, 0xB0E0, - 0xACB0, 0xB0E1, 0xACB1, 0x81BD, 0xACB2, 0x81BE, 0xACB3, 0x81BF, - 0xACB4, 0x81C0, 0xACB5, 0x81C1, 0xACB6, 0x81C2, 0xACB7, 0x81C3, - 0xACB8, 0xB0E2, 0xACB9, 0xB0E3, 0xACBA, 0x81C4, 0xACBB, 0xB0E4, - 0xACBC, 0xB0E5, 0xACBD, 0xB0E6, 0xACBE, 0x81C5, 0xACBF, 0x81C6, - 0xACC0, 0x81C7, 0xACC1, 0xB0E7, 0xACC2, 0x81C8, 0xACC3, 0x81C9, - 0xACC4, 0xB0E8, 0xACC5, 0x81CA, 0xACC6, 0x81CB, 0xACC7, 0x81CC, - 0xACC8, 0xB0E9, 0xACC9, 0x81CD, 0xACCA, 0x81CE, 0xACCB, 0x81CF, - 0xACCC, 0xB0EA, 0xACCD, 0x81D0, 0xACCE, 0x81D1, 0xACCF, 0x81D2, - 0xACD0, 0x81D3, 0xACD1, 0x81D4, 0xACD2, 0x81D5, 0xACD3, 0x81D6, - 0xACD4, 0x81D7, 0xACD5, 0xB0EB, 0xACD6, 0x81D8, 0xACD7, 0xB0EC, - 0xACD8, 0x81D9, 0xACD9, 0x81DA, 0xACDA, 0x81DB, 0xACDB, 0x81DC, - 0xACDC, 0x81DD, 0xACDD, 0x81DE, 0xACDE, 0x81DF, 0xACDF, 0x81E0, - 0xACE0, 0xB0ED, 0xACE1, 0xB0EE, 0xACE2, 0x81E1, 0xACE3, 0x81E2, - 0xACE4, 0xB0EF, 0xACE5, 0x81E3, 0xACE6, 0x81E4, 0xACE7, 0xB0F0, - 0xACE8, 0xB0F1, 0xACE9, 0x81E5, 0xACEA, 0xB0F2, 0xACEB, 0x81E6, - 0xACEC, 0xB0F3, 0xACED, 0x81E7, 0xACEE, 0x81E8, 0xACEF, 0xB0F4, - 0xACF0, 0xB0F5, 0xACF1, 0xB0F6, 0xACF2, 0x81E9, 0xACF3, 0xB0F7, - 0xACF4, 0x81EA, 0xACF5, 0xB0F8, 0xACF6, 0xB0F9, 0xACF7, 0x81EB, - 0xACF8, 0x81EC, 0xACF9, 0x81ED, 0xACFA, 0x81EE, 0xACFB, 0x81EF, - 0xACFC, 0xB0FA, 0xACFD, 0xB0FB, 0xACFE, 0x81F0, 0xACFF, 0x81F1, - 0xAD00, 0xB0FC, 0xAD01, 0x81F2, 0xAD02, 0x81F3, 0xAD03, 0x81F4, - 0xAD04, 0xB0FD, 0xAD05, 0x81F5, 0xAD06, 0xB0FE, 0xAD07, 0x81F6, - 0xAD08, 0x81F7, 0xAD09, 0x81F8, 0xAD0A, 0x81F9, 0xAD0B, 0x81FA, - 0xAD0C, 0xB1A1, 0xAD0D, 0xB1A2, 0xAD0E, 0x81FB, 0xAD0F, 0xB1A3, - 0xAD10, 0x81FC, 0xAD11, 0xB1A4, 0xAD12, 0x81FD, 0xAD13, 0x81FE, - 0xAD14, 0x8241, 0xAD15, 0x8242, 0xAD16, 0x8243, 0xAD17, 0x8244, - 0xAD18, 0xB1A5, 0xAD19, 0x8245, 0xAD1A, 0x8246, 0xAD1B, 0x8247, - 0xAD1C, 0xB1A6, 0xAD1D, 0x8248, 0xAD1E, 0x8249, 0xAD1F, 0x824A, - 0xAD20, 0xB1A7, 0xAD21, 0x824B, 0xAD22, 0x824C, 0xAD23, 0x824D, - 0xAD24, 0x824E, 0xAD25, 0x824F, 0xAD26, 0x8250, 0xAD27, 0x8251, - 0xAD28, 0x8252, 0xAD29, 0xB1A8, 0xAD2A, 0x8253, 0xAD2B, 0x8254, - 0xAD2C, 0xB1A9, 0xAD2D, 0xB1AA, 0xAD2E, 0x8255, 0xAD2F, 0x8256, - 0xAD30, 0x8257, 0xAD31, 0x8258, 0xAD32, 0x8259, 0xAD33, 0x825A, - 0xAD34, 0xB1AB, 0xAD35, 0xB1AC, 0xAD36, 0x8261, 0xAD37, 0x8262, - 0xAD38, 0xB1AD, 0xAD39, 0x8263, 0xAD3A, 0x8264, 0xAD3B, 0x8265, - 0xAD3C, 0xB1AE, 0xAD3D, 0x8266, 0xAD3E, 0x8267, 0xAD3F, 0x8268, - 0xAD40, 0x8269, 0xAD41, 0x826A, 0xAD42, 0x826B, 0xAD43, 0x826C, - 0xAD44, 0xB1AF, 0xAD45, 0xB1B0, 0xAD46, 0x826D, 0xAD47, 0xB1B1, - 0xAD48, 0x826E, 0xAD49, 0xB1B2, 0xAD4A, 0x826F, 0xAD4B, 0x8270, - 0xAD4C, 0x8271, 0xAD4D, 0x8272, 0xAD4E, 0x8273, 0xAD4F, 0x8274, - 0xAD50, 0xB1B3, 0xAD51, 0x8275, 0xAD52, 0x8276, 0xAD53, 0x8277, - 0xAD54, 0xB1B4, 0xAD55, 0x8278, 0xAD56, 0x8279, 0xAD57, 0x827A, - 0xAD58, 0xB1B5, 0xAD59, 0x8281, 0xAD5A, 0x8282, 0xAD5B, 0x8283, - 0xAD5C, 0x8284, 0xAD5D, 0x8285, 0xAD5E, 0x8286, 0xAD5F, 0x8287, - 0xAD60, 0x8288, 0xAD61, 0xB1B6, 0xAD62, 0x8289, 0xAD63, 0xB1B7, - 0xAD64, 0x828A, 0xAD65, 0x828B, 0xAD66, 0x828C, 0xAD67, 0x828D, - 0xAD68, 0x828E, 0xAD69, 0x828F, 0xAD6A, 0x8290, 0xAD6B, 0x8291, - 0xAD6C, 0xB1B8, 0xAD6D, 0xB1B9, 0xAD6E, 0x8292, 0xAD6F, 0x8293, - 0xAD70, 0xB1BA, 0xAD71, 0x8294, 0xAD72, 0x8295, 0xAD73, 0xB1BB, - 0xAD74, 0xB1BC, 0xAD75, 0xB1BD, 0xAD76, 0xB1BE, 0xAD77, 0x8296, - 0xAD78, 0x8297, 0xAD79, 0x8298, 0xAD7A, 0x8299, 0xAD7B, 0xB1BF, - 0xAD7C, 0xB1C0, 0xAD7D, 0xB1C1, 0xAD7E, 0x829A, 0xAD7F, 0xB1C2, - 0xAD80, 0x829B, 0xAD81, 0xB1C3, 0xAD82, 0xB1C4, 0xAD83, 0x829C, - 0xAD84, 0x829D, 0xAD85, 0x829E, 0xAD86, 0x829F, 0xAD87, 0x82A0, - 0xAD88, 0xB1C5, 0xAD89, 0xB1C6, 0xAD8A, 0x82A1, 0xAD8B, 0x82A2, - 0xAD8C, 0xB1C7, 0xAD8D, 0x82A3, 0xAD8E, 0x82A4, 0xAD8F, 0x82A5, - 0xAD90, 0xB1C8, 0xAD91, 0x82A6, 0xAD92, 0x82A7, 0xAD93, 0x82A8, - 0xAD94, 0x82A9, 0xAD95, 0x82AA, 0xAD96, 0x82AB, 0xAD97, 0x82AC, - 0xAD98, 0x82AD, 0xAD99, 0x82AE, 0xAD9A, 0x82AF, 0xAD9B, 0x82B0, - 0xAD9C, 0xB1C9, 0xAD9D, 0xB1CA, 0xAD9E, 0x82B1, 0xAD9F, 0x82B2, - 0xADA0, 0x82B3, 0xADA1, 0x82B4, 0xADA2, 0x82B5, 0xADA3, 0x82B6, - 0xADA4, 0xB1CB, 0xADA5, 0x82B7, 0xADA6, 0x82B8, 0xADA7, 0x82B9, - 0xADA8, 0x82BA, 0xADA9, 0x82BB, 0xADAA, 0x82BC, 0xADAB, 0x82BD, - 0xADAC, 0x82BE, 0xADAD, 0x82BF, 0xADAE, 0x82C0, 0xADAF, 0x82C1, - 0xADB0, 0x82C2, 0xADB1, 0x82C3, 0xADB2, 0x82C4, 0xADB3, 0x82C5, - 0xADB4, 0x82C6, 0xADB5, 0x82C7, 0xADB6, 0x82C8, 0xADB7, 0xB1CC, - 0xADB8, 0x82C9, 0xADB9, 0x82CA, 0xADBA, 0x82CB, 0xADBB, 0x82CC, - 0xADBC, 0x82CD, 0xADBD, 0x82CE, 0xADBE, 0x82CF, 0xADBF, 0x82D0, - 0xADC0, 0xB1CD, 0xADC1, 0xB1CE, 0xADC2, 0x82D1, 0xADC3, 0x82D2, - 0xADC4, 0xB1CF, 0xADC5, 0x82D3, 0xADC6, 0x82D4, 0xADC7, 0x82D5, - 0xADC8, 0xB1D0, 0xADC9, 0x82D6, 0xADCA, 0x82D7, 0xADCB, 0x82D8, - 0xADCC, 0x82D9, 0xADCD, 0x82DA, 0xADCE, 0x82DB, 0xADCF, 0x82DC, - 0xADD0, 0xB1D1, 0xADD1, 0xB1D2, 0xADD2, 0x82DD, 0xADD3, 0xB1D3, - 0xADD4, 0x82DE, 0xADD5, 0x82DF, 0xADD6, 0x82E0, 0xADD7, 0x82E1, - 0xADD8, 0x82E2, 0xADD9, 0x82E3, 0xADDA, 0x82E4, 0xADDB, 0x82E5, - 0xADDC, 0xB1D4, 0xADDD, 0x82E6, 0xADDE, 0x82E7, 0xADDF, 0x82E8, - 0xADE0, 0xB1D5, 0xADE1, 0x82E9, 0xADE2, 0x82EA, 0xADE3, 0x82EB, - 0xADE4, 0xB1D6, 0xADE5, 0x82EC, 0xADE6, 0x82ED, 0xADE7, 0x82EE, - 0xADE8, 0x82EF, 0xADE9, 0x82F0, 0xADEA, 0x82F1, 0xADEB, 0x82F2, - 0xADEC, 0x82F3, 0xADED, 0x82F4, 0xADEE, 0x82F5, 0xADEF, 0x82F6, - 0xADF0, 0x82F7, 0xADF1, 0x82F8, 0xADF2, 0x82F9, 0xADF3, 0x82FA, - 0xADF4, 0x82FB, 0xADF5, 0x82FC, 0xADF6, 0x82FD, 0xADF7, 0x82FE, - 0xADF8, 0xB1D7, 0xADF9, 0xB1D8, 0xADFA, 0x8341, 0xADFB, 0x8342, - 0xADFC, 0xB1D9, 0xADFD, 0x8343, 0xADFE, 0x8344, 0xADFF, 0xB1DA, - 0xAE00, 0xB1DB, 0xAE01, 0xB1DC, 0xAE02, 0x8345, 0xAE03, 0x8346, - 0xAE04, 0x8347, 0xAE05, 0x8348, 0xAE06, 0x8349, 0xAE07, 0x834A, - 0xAE08, 0xB1DD, 0xAE09, 0xB1DE, 0xAE0A, 0x834B, 0xAE0B, 0xB1DF, - 0xAE0C, 0x834C, 0xAE0D, 0xB1E0, 0xAE0E, 0x834D, 0xAE0F, 0x834E, - 0xAE10, 0x834F, 0xAE11, 0x8350, 0xAE12, 0x8351, 0xAE13, 0x8352, - 0xAE14, 0xB1E1, 0xAE15, 0x8353, 0xAE16, 0x8354, 0xAE17, 0x8355, - 0xAE18, 0x8356, 0xAE19, 0x8357, 0xAE1A, 0x8358, 0xAE1B, 0x8359, - 0xAE1C, 0x835A, 0xAE1D, 0x8361, 0xAE1E, 0x8362, 0xAE1F, 0x8363, - 0xAE20, 0x8364, 0xAE21, 0x8365, 0xAE22, 0x8366, 0xAE23, 0x8367, - 0xAE24, 0x8368, 0xAE25, 0x8369, 0xAE26, 0x836A, 0xAE27, 0x836B, - 0xAE28, 0x836C, 0xAE29, 0x836D, 0xAE2A, 0x836E, 0xAE2B, 0x836F, - 0xAE2C, 0x8370, 0xAE2D, 0x8371, 0xAE2E, 0x8372, 0xAE2F, 0x8373, - 0xAE30, 0xB1E2, 0xAE31, 0xB1E3, 0xAE32, 0x8374, 0xAE33, 0x8375, - 0xAE34, 0xB1E4, 0xAE35, 0x8376, 0xAE36, 0x8377, 0xAE37, 0xB1E5, - 0xAE38, 0xB1E6, 0xAE39, 0x8378, 0xAE3A, 0xB1E7, 0xAE3B, 0x8379, - 0xAE3C, 0x837A, 0xAE3D, 0x8381, 0xAE3E, 0x8382, 0xAE3F, 0x8383, - 0xAE40, 0xB1E8, 0xAE41, 0xB1E9, 0xAE42, 0x8384, 0xAE43, 0xB1EA, - 0xAE44, 0x8385, 0xAE45, 0xB1EB, 0xAE46, 0xB1EC, 0xAE47, 0x8386, - 0xAE48, 0x8387, 0xAE49, 0x8388, 0xAE4A, 0xB1ED, 0xAE4B, 0x8389, - 0xAE4C, 0xB1EE, 0xAE4D, 0xB1EF, 0xAE4E, 0xB1F0, 0xAE4F, 0x838A, - 0xAE50, 0xB1F1, 0xAE51, 0x838B, 0xAE52, 0x838C, 0xAE53, 0x838D, - 0xAE54, 0xB1F2, 0xAE55, 0x838E, 0xAE56, 0xB1F3, 0xAE57, 0x838F, - 0xAE58, 0x8390, 0xAE59, 0x8391, 0xAE5A, 0x8392, 0xAE5B, 0x8393, - 0xAE5C, 0xB1F4, 0xAE5D, 0xB1F5, 0xAE5E, 0x8394, 0xAE5F, 0xB1F6, - 0xAE60, 0xB1F7, 0xAE61, 0xB1F8, 0xAE62, 0x8395, 0xAE63, 0x8396, - 0xAE64, 0x8397, 0xAE65, 0xB1F9, 0xAE66, 0x8398, 0xAE67, 0x8399, - 0xAE68, 0xB1FA, 0xAE69, 0xB1FB, 0xAE6A, 0x839A, 0xAE6B, 0x839B, - 0xAE6C, 0xB1FC, 0xAE6D, 0x839C, 0xAE6E, 0x839D, 0xAE6F, 0x839E, - 0xAE70, 0xB1FD, 0xAE71, 0x839F, 0xAE72, 0x83A0, 0xAE73, 0x83A1, - 0xAE74, 0x83A2, 0xAE75, 0x83A3, 0xAE76, 0x83A4, 0xAE77, 0x83A5, - 0xAE78, 0xB1FE, 0xAE79, 0xB2A1, 0xAE7A, 0x83A6, 0xAE7B, 0xB2A2, - 0xAE7C, 0xB2A3, 0xAE7D, 0xB2A4, 0xAE7E, 0x83A7, 0xAE7F, 0x83A8, - 0xAE80, 0x83A9, 0xAE81, 0x83AA, 0xAE82, 0x83AB, 0xAE83, 0x83AC, - 0xAE84, 0xB2A5, 0xAE85, 0xB2A6, 0xAE86, 0x83AD, 0xAE87, 0x83AE, - 0xAE88, 0x83AF, 0xAE89, 0x83B0, 0xAE8A, 0x83B1, 0xAE8B, 0x83B2, - 0xAE8C, 0xB2A7, 0xAE8D, 0x83B3, 0xAE8E, 0x83B4, 0xAE8F, 0x83B5, - 0xAE90, 0x83B6, 0xAE91, 0x83B7, 0xAE92, 0x83B8, 0xAE93, 0x83B9, - 0xAE94, 0x83BA, 0xAE95, 0x83BB, 0xAE96, 0x83BC, 0xAE97, 0x83BD, - 0xAE98, 0x83BE, 0xAE99, 0x83BF, 0xAE9A, 0x83C0, 0xAE9B, 0x83C1, - 0xAE9C, 0x83C2, 0xAE9D, 0x83C3, 0xAE9E, 0x83C4, 0xAE9F, 0x83C5, - 0xAEA0, 0x83C6, 0xAEA1, 0x83C7, 0xAEA2, 0x83C8, 0xAEA3, 0x83C9, - 0xAEA4, 0x83CA, 0xAEA5, 0x83CB, 0xAEA6, 0x83CC, 0xAEA7, 0x83CD, - 0xAEA8, 0x83CE, 0xAEA9, 0x83CF, 0xAEAA, 0x83D0, 0xAEAB, 0x83D1, - 0xAEAC, 0x83D2, 0xAEAD, 0x83D3, 0xAEAE, 0x83D4, 0xAEAF, 0x83D5, - 0xAEB0, 0x83D6, 0xAEB1, 0x83D7, 0xAEB2, 0x83D8, 0xAEB3, 0x83D9, - 0xAEB4, 0x83DA, 0xAEB5, 0x83DB, 0xAEB6, 0x83DC, 0xAEB7, 0x83DD, - 0xAEB8, 0x83DE, 0xAEB9, 0x83DF, 0xAEBA, 0x83E0, 0xAEBB, 0x83E1, - 0xAEBC, 0xB2A8, 0xAEBD, 0xB2A9, 0xAEBE, 0xB2AA, 0xAEBF, 0x83E2, - 0xAEC0, 0xB2AB, 0xAEC1, 0x83E3, 0xAEC2, 0x83E4, 0xAEC3, 0x83E5, - 0xAEC4, 0xB2AC, 0xAEC5, 0x83E6, 0xAEC6, 0x83E7, 0xAEC7, 0x83E8, - 0xAEC8, 0x83E9, 0xAEC9, 0x83EA, 0xAECA, 0x83EB, 0xAECB, 0x83EC, - 0xAECC, 0xB2AD, 0xAECD, 0xB2AE, 0xAECE, 0x83ED, 0xAECF, 0xB2AF, - 0xAED0, 0xB2B0, 0xAED1, 0xB2B1, 0xAED2, 0x83EE, 0xAED3, 0x83EF, - 0xAED4, 0x83F0, 0xAED5, 0x83F1, 0xAED6, 0x83F2, 0xAED7, 0x83F3, - 0xAED8, 0xB2B2, 0xAED9, 0xB2B3, 0xAEDA, 0x83F4, 0xAEDB, 0x83F5, - 0xAEDC, 0xB2B4, 0xAEDD, 0x83F6, 0xAEDE, 0x83F7, 0xAEDF, 0x83F8, - 0xAEE0, 0x83F9, 0xAEE1, 0x83FA, 0xAEE2, 0x83FB, 0xAEE3, 0x83FC, - 0xAEE4, 0x83FD, 0xAEE5, 0x83FE, 0xAEE6, 0x8441, 0xAEE7, 0x8442, - 0xAEE8, 0xB2B5, 0xAEE9, 0x8443, 0xAEEA, 0x8444, 0xAEEB, 0xB2B6, - 0xAEEC, 0x8445, 0xAEED, 0xB2B7, 0xAEEE, 0x8446, 0xAEEF, 0x8447, - 0xAEF0, 0x8448, 0xAEF1, 0x8449, 0xAEF2, 0x844A, 0xAEF3, 0x844B, - 0xAEF4, 0xB2B8, 0xAEF5, 0x844C, 0xAEF6, 0x844D, 0xAEF7, 0x844E, - 0xAEF8, 0xB2B9, 0xAEF9, 0x844F, 0xAEFA, 0x8450, 0xAEFB, 0x8451, - 0xAEFC, 0xB2BA, 0xAEFD, 0x8452, 0xAEFE, 0x8453, 0xAEFF, 0x8454, - 0xAF00, 0x8455, 0xAF01, 0x8456, 0xAF02, 0x8457, 0xAF03, 0x8458, - 0xAF04, 0x8459, 0xAF05, 0x845A, 0xAF06, 0x8461, 0xAF07, 0xB2BB, - 0xAF08, 0xB2BC, 0xAF09, 0x8462, 0xAF0A, 0x8463, 0xAF0B, 0x8464, - 0xAF0C, 0x8465, 0xAF0D, 0xB2BD, 0xAF0E, 0x8466, 0xAF0F, 0x8467, - 0xAF10, 0xB2BE, 0xAF11, 0x8468, 0xAF12, 0x8469, 0xAF13, 0x846A, - 0xAF14, 0x846B, 0xAF15, 0x846C, 0xAF16, 0x846D, 0xAF17, 0x846E, - 0xAF18, 0x846F, 0xAF19, 0x8470, 0xAF1A, 0x8471, 0xAF1B, 0x8472, - 0xAF1C, 0x8473, 0xAF1D, 0x8474, 0xAF1E, 0x8475, 0xAF1F, 0x8476, - 0xAF20, 0x8477, 0xAF21, 0x8478, 0xAF22, 0x8479, 0xAF23, 0x847A, - 0xAF24, 0x8481, 0xAF25, 0x8482, 0xAF26, 0x8483, 0xAF27, 0x8484, - 0xAF28, 0x8485, 0xAF29, 0x8486, 0xAF2A, 0x8487, 0xAF2B, 0x8488, - 0xAF2C, 0xB2BF, 0xAF2D, 0xB2C0, 0xAF2E, 0x8489, 0xAF2F, 0x848A, - 0xAF30, 0xB2C1, 0xAF31, 0x848B, 0xAF32, 0xB2C2, 0xAF33, 0x848C, - 0xAF34, 0xB2C3, 0xAF35, 0x848D, 0xAF36, 0x848E, 0xAF37, 0x848F, - 0xAF38, 0x8490, 0xAF39, 0x8491, 0xAF3A, 0x8492, 0xAF3B, 0x8493, - 0xAF3C, 0xB2C4, 0xAF3D, 0xB2C5, 0xAF3E, 0x8494, 0xAF3F, 0xB2C6, - 0xAF40, 0x8495, 0xAF41, 0xB2C7, 0xAF42, 0xB2C8, 0xAF43, 0xB2C9, - 0xAF44, 0x8496, 0xAF45, 0x8497, 0xAF46, 0x8498, 0xAF47, 0x8499, - 0xAF48, 0xB2CA, 0xAF49, 0xB2CB, 0xAF4A, 0x849A, 0xAF4B, 0x849B, - 0xAF4C, 0x849C, 0xAF4D, 0x849D, 0xAF4E, 0x849E, 0xAF4F, 0x849F, - 0xAF50, 0xB2CC, 0xAF51, 0x84A0, 0xAF52, 0x84A1, 0xAF53, 0x84A2, - 0xAF54, 0x84A3, 0xAF55, 0x84A4, 0xAF56, 0x84A5, 0xAF57, 0x84A6, - 0xAF58, 0x84A7, 0xAF59, 0x84A8, 0xAF5A, 0x84A9, 0xAF5B, 0x84AA, - 0xAF5C, 0xB2CD, 0xAF5D, 0xB2CE, 0xAF5E, 0x84AB, 0xAF5F, 0x84AC, - 0xAF60, 0x84AD, 0xAF61, 0x84AE, 0xAF62, 0x84AF, 0xAF63, 0x84B0, - 0xAF64, 0xB2CF, 0xAF65, 0xB2D0, 0xAF66, 0x84B1, 0xAF67, 0x84B2, - 0xAF68, 0x84B3, 0xAF69, 0x84B4, 0xAF6A, 0x84B5, 0xAF6B, 0x84B6, - 0xAF6C, 0x84B7, 0xAF6D, 0x84B8, 0xAF6E, 0x84B9, 0xAF6F, 0x84BA, - 0xAF70, 0x84BB, 0xAF71, 0x84BC, 0xAF72, 0x84BD, 0xAF73, 0x84BE, - 0xAF74, 0x84BF, 0xAF75, 0x84C0, 0xAF76, 0x84C1, 0xAF77, 0x84C2, - 0xAF78, 0x84C3, 0xAF79, 0xB2D1, 0xAF7A, 0x84C4, 0xAF7B, 0x84C5, - 0xAF7C, 0x84C6, 0xAF7D, 0x84C7, 0xAF7E, 0x84C8, 0xAF7F, 0x84C9, - 0xAF80, 0xB2D2, 0xAF81, 0x84CA, 0xAF82, 0x84CB, 0xAF83, 0x84CC, - 0xAF84, 0xB2D3, 0xAF85, 0x84CD, 0xAF86, 0x84CE, 0xAF87, 0x84CF, - 0xAF88, 0xB2D4, 0xAF89, 0x84D0, 0xAF8A, 0x84D1, 0xAF8B, 0x84D2, - 0xAF8C, 0x84D3, 0xAF8D, 0x84D4, 0xAF8E, 0x84D5, 0xAF8F, 0x84D6, - 0xAF90, 0xB2D5, 0xAF91, 0xB2D6, 0xAF92, 0x84D7, 0xAF93, 0x84D8, - 0xAF94, 0x84D9, 0xAF95, 0xB2D7, 0xAF96, 0x84DA, 0xAF97, 0x84DB, - 0xAF98, 0x84DC, 0xAF99, 0x84DD, 0xAF9A, 0x84DE, 0xAF9B, 0x84DF, - 0xAF9C, 0xB2D8, 0xAF9D, 0x84E0, 0xAF9E, 0x84E1, 0xAF9F, 0x84E2, - 0xAFA0, 0x84E3, 0xAFA1, 0x84E4, 0xAFA2, 0x84E5, 0xAFA3, 0x84E6, - 0xAFA4, 0x84E7, 0xAFA5, 0x84E8, 0xAFA6, 0x84E9, 0xAFA7, 0x84EA, - 0xAFA8, 0x84EB, 0xAFA9, 0x84EC, 0xAFAA, 0x84ED, 0xAFAB, 0x84EE, - 0xAFAC, 0x84EF, 0xAFAD, 0x84F0, 0xAFAE, 0x84F1, 0xAFAF, 0x84F2, - 0xAFB0, 0x84F3, 0xAFB1, 0x84F4, 0xAFB2, 0x84F5, 0xAFB3, 0x84F6, - 0xAFB4, 0x84F7, 0xAFB5, 0x84F8, 0xAFB6, 0x84F9, 0xAFB7, 0x84FA, - 0xAFB8, 0xB2D9, 0xAFB9, 0xB2DA, 0xAFBA, 0x84FB, 0xAFBB, 0x84FC, - 0xAFBC, 0xB2DB, 0xAFBD, 0x84FD, 0xAFBE, 0x84FE, 0xAFBF, 0x8541, - 0xAFC0, 0xB2DC, 0xAFC1, 0x8542, 0xAFC2, 0x8543, 0xAFC3, 0x8544, - 0xAFC4, 0x8545, 0xAFC5, 0x8546, 0xAFC6, 0x8547, 0xAFC7, 0xB2DD, - 0xAFC8, 0xB2DE, 0xAFC9, 0xB2DF, 0xAFCA, 0x8548, 0xAFCB, 0xB2E0, - 0xAFCC, 0x8549, 0xAFCD, 0xB2E1, 0xAFCE, 0xB2E2, 0xAFCF, 0x854A, - 0xAFD0, 0x854B, 0xAFD1, 0x854C, 0xAFD2, 0x854D, 0xAFD3, 0x854E, - 0xAFD4, 0xB2E3, 0xAFD5, 0x854F, 0xAFD6, 0x8550, 0xAFD7, 0x8551, - 0xAFD8, 0x8552, 0xAFD9, 0x8553, 0xAFDA, 0x8554, 0xAFDB, 0x8555, - 0xAFDC, 0xB2E4, 0xAFDD, 0x8556, 0xAFDE, 0x8557, 0xAFDF, 0x8558, - 0xAFE0, 0x8559, 0xAFE1, 0x855A, 0xAFE2, 0x8561, 0xAFE3, 0x8562, - 0xAFE4, 0x8563, 0xAFE5, 0x8564, 0xAFE6, 0x8565, 0xAFE7, 0x8566, - 0xAFE8, 0xB2E5, 0xAFE9, 0xB2E6, 0xAFEA, 0x8567, 0xAFEB, 0x8568, - 0xAFEC, 0x8569, 0xAFED, 0x856A, 0xAFEE, 0x856B, 0xAFEF, 0x856C, - 0xAFF0, 0xB2E7, 0xAFF1, 0xB2E8, 0xAFF2, 0x856D, 0xAFF3, 0x856E, - 0xAFF4, 0xB2E9, 0xAFF5, 0x856F, 0xAFF6, 0x8570, 0xAFF7, 0x8571, - 0xAFF8, 0xB2EA, 0xAFF9, 0x8572, 0xAFFA, 0x8573, 0xAFFB, 0x8574, - 0xAFFC, 0x8575, 0xAFFD, 0x8576, 0xAFFE, 0x8577, 0xAFFF, 0x8578, - 0xB000, 0xB2EB, 0xB001, 0xB2EC, 0xB002, 0x8579, 0xB003, 0x857A, - 0xB004, 0xB2ED, 0xB005, 0x8581, 0xB006, 0x8582, 0xB007, 0x8583, - 0xB008, 0x8584, 0xB009, 0x8585, 0xB00A, 0x8586, 0xB00B, 0x8587, - 0xB00C, 0xB2EE, 0xB00D, 0x8588, 0xB00E, 0x8589, 0xB00F, 0x858A, - 0xB010, 0xB2EF, 0xB011, 0x858B, 0xB012, 0x858C, 0xB013, 0x858D, - 0xB014, 0xB2F0, 0xB015, 0x858E, 0xB016, 0x858F, 0xB017, 0x8590, - 0xB018, 0x8591, 0xB019, 0x8592, 0xB01A, 0x8593, 0xB01B, 0x8594, - 0xB01C, 0xB2F1, 0xB01D, 0xB2F2, 0xB01E, 0x8595, 0xB01F, 0x8596, - 0xB020, 0x8597, 0xB021, 0x8598, 0xB022, 0x8599, 0xB023, 0x859A, - 0xB024, 0x859B, 0xB025, 0x859C, 0xB026, 0x859D, 0xB027, 0x859E, - 0xB028, 0xB2F3, 0xB029, 0x859F, 0xB02A, 0x85A0, 0xB02B, 0x85A1, - 0xB02C, 0x85A2, 0xB02D, 0x85A3, 0xB02E, 0x85A4, 0xB02F, 0x85A5, - 0xB030, 0x85A6, 0xB031, 0x85A7, 0xB032, 0x85A8, 0xB033, 0x85A9, - 0xB034, 0x85AA, 0xB035, 0x85AB, 0xB036, 0x85AC, 0xB037, 0x85AD, - 0xB038, 0x85AE, 0xB039, 0x85AF, 0xB03A, 0x85B0, 0xB03B, 0x85B1, - 0xB03C, 0x85B2, 0xB03D, 0x85B3, 0xB03E, 0x85B4, 0xB03F, 0x85B5, - 0xB040, 0x85B6, 0xB041, 0x85B7, 0xB042, 0x85B8, 0xB043, 0x85B9, - 0xB044, 0xB2F4, 0xB045, 0xB2F5, 0xB046, 0x85BA, 0xB047, 0x85BB, - 0xB048, 0xB2F6, 0xB049, 0x85BC, 0xB04A, 0xB2F7, 0xB04B, 0x85BD, - 0xB04C, 0xB2F8, 0xB04D, 0x85BE, 0xB04E, 0xB2F9, 0xB04F, 0x85BF, - 0xB050, 0x85C0, 0xB051, 0x85C1, 0xB052, 0x85C2, 0xB053, 0xB2FA, - 0xB054, 0xB2FB, 0xB055, 0xB2FC, 0xB056, 0x85C3, 0xB057, 0xB2FD, - 0xB058, 0x85C4, 0xB059, 0xB2FE, 0xB05A, 0x85C5, 0xB05B, 0x85C6, - 0xB05C, 0x85C7, 0xB05D, 0xB3A1, 0xB05E, 0x85C8, 0xB05F, 0x85C9, - 0xB060, 0x85CA, 0xB061, 0x85CB, 0xB062, 0x85CC, 0xB063, 0x85CD, - 0xB064, 0x85CE, 0xB065, 0x85CF, 0xB066, 0x85D0, 0xB067, 0x85D1, - 0xB068, 0x85D2, 0xB069, 0x85D3, 0xB06A, 0x85D4, 0xB06B, 0x85D5, - 0xB06C, 0x85D6, 0xB06D, 0x85D7, 0xB06E, 0x85D8, 0xB06F, 0x85D9, - 0xB070, 0x85DA, 0xB071, 0x85DB, 0xB072, 0x85DC, 0xB073, 0x85DD, - 0xB074, 0x85DE, 0xB075, 0x85DF, 0xB076, 0x85E0, 0xB077, 0x85E1, - 0xB078, 0x85E2, 0xB079, 0x85E3, 0xB07A, 0x85E4, 0xB07B, 0x85E5, - 0xB07C, 0xB3A2, 0xB07D, 0xB3A3, 0xB07E, 0x85E6, 0xB07F, 0x85E7, - 0xB080, 0xB3A4, 0xB081, 0x85E8, 0xB082, 0x85E9, 0xB083, 0x85EA, - 0xB084, 0xB3A5, 0xB085, 0x85EB, 0xB086, 0x85EC, 0xB087, 0x85ED, - 0xB088, 0x85EE, 0xB089, 0x85EF, 0xB08A, 0x85F0, 0xB08B, 0x85F1, - 0xB08C, 0xB3A6, 0xB08D, 0xB3A7, 0xB08E, 0x85F2, 0xB08F, 0xB3A8, - 0xB090, 0x85F3, 0xB091, 0xB3A9, 0xB092, 0x85F4, 0xB093, 0x85F5, - 0xB094, 0x85F6, 0xB095, 0x85F7, 0xB096, 0x85F8, 0xB097, 0x85F9, - 0xB098, 0xB3AA, 0xB099, 0xB3AB, 0xB09A, 0xB3AC, 0xB09B, 0x85FA, - 0xB09C, 0xB3AD, 0xB09D, 0x85FB, 0xB09E, 0x85FC, 0xB09F, 0xB3AE, - 0xB0A0, 0xB3AF, 0xB0A1, 0xB3B0, 0xB0A2, 0xB3B1, 0xB0A3, 0x85FD, - 0xB0A4, 0x85FE, 0xB0A5, 0x8641, 0xB0A6, 0x8642, 0xB0A7, 0x8643, - 0xB0A8, 0xB3B2, 0xB0A9, 0xB3B3, 0xB0AA, 0x8644, 0xB0AB, 0xB3B4, - 0xB0AC, 0xB3B5, 0xB0AD, 0xB3B6, 0xB0AE, 0xB3B7, 0xB0AF, 0xB3B8, - 0xB0B0, 0x8645, 0xB0B1, 0xB3B9, 0xB0B2, 0x8646, 0xB0B3, 0xB3BA, - 0xB0B4, 0xB3BB, 0xB0B5, 0xB3BC, 0xB0B6, 0x8647, 0xB0B7, 0x8648, - 0xB0B8, 0xB3BD, 0xB0B9, 0x8649, 0xB0BA, 0x864A, 0xB0BB, 0x864B, - 0xB0BC, 0xB3BE, 0xB0BD, 0x864C, 0xB0BE, 0x864D, 0xB0BF, 0x864E, - 0xB0C0, 0x864F, 0xB0C1, 0x8650, 0xB0C2, 0x8651, 0xB0C3, 0x8652, - 0xB0C4, 0xB3BF, 0xB0C5, 0xB3C0, 0xB0C6, 0x8653, 0xB0C7, 0xB3C1, - 0xB0C8, 0xB3C2, 0xB0C9, 0xB3C3, 0xB0CA, 0x8654, 0xB0CB, 0x8655, - 0xB0CC, 0x8656, 0xB0CD, 0x8657, 0xB0CE, 0x8658, 0xB0CF, 0x8659, - 0xB0D0, 0xB3C4, 0xB0D1, 0xB3C5, 0xB0D2, 0x865A, 0xB0D3, 0x8661, - 0xB0D4, 0xB3C6, 0xB0D5, 0x8662, 0xB0D6, 0x8663, 0xB0D7, 0x8664, - 0xB0D8, 0xB3C7, 0xB0D9, 0x8665, 0xB0DA, 0x8666, 0xB0DB, 0x8667, - 0xB0DC, 0x8668, 0xB0DD, 0x8669, 0xB0DE, 0x866A, 0xB0DF, 0x866B, - 0xB0E0, 0xB3C8, 0xB0E1, 0x866C, 0xB0E2, 0x866D, 0xB0E3, 0x866E, - 0xB0E4, 0x866F, 0xB0E5, 0xB3C9, 0xB0E6, 0x8670, 0xB0E7, 0x8671, - 0xB0E8, 0x8672, 0xB0E9, 0x8673, 0xB0EA, 0x8674, 0xB0EB, 0x8675, - 0xB0EC, 0x8676, 0xB0ED, 0x8677, 0xB0EE, 0x8678, 0xB0EF, 0x8679, - 0xB0F0, 0x867A, 0xB0F1, 0x8681, 0xB0F2, 0x8682, 0xB0F3, 0x8683, - 0xB0F4, 0x8684, 0xB0F5, 0x8685, 0xB0F6, 0x8686, 0xB0F7, 0x8687, - 0xB0F8, 0x8688, 0xB0F9, 0x8689, 0xB0FA, 0x868A, 0xB0FB, 0x868B, - 0xB0FC, 0x868C, 0xB0FD, 0x868D, 0xB0FE, 0x868E, 0xB0FF, 0x868F, - 0xB100, 0x8690, 0xB101, 0x8691, 0xB102, 0x8692, 0xB103, 0x8693, - 0xB104, 0x8694, 0xB105, 0x8695, 0xB106, 0x8696, 0xB107, 0x8697, - 0xB108, 0xB3CA, 0xB109, 0xB3CB, 0xB10A, 0x8698, 0xB10B, 0xB3CC, - 0xB10C, 0xB3CD, 0xB10D, 0x8699, 0xB10E, 0x869A, 0xB10F, 0x869B, - 0xB110, 0xB3CE, 0xB111, 0x869C, 0xB112, 0xB3CF, 0xB113, 0xB3D0, - 0xB114, 0x869D, 0xB115, 0x869E, 0xB116, 0x869F, 0xB117, 0x86A0, - 0xB118, 0xB3D1, 0xB119, 0xB3D2, 0xB11A, 0x86A1, 0xB11B, 0xB3D3, - 0xB11C, 0xB3D4, 0xB11D, 0xB3D5, 0xB11E, 0x86A2, 0xB11F, 0x86A3, - 0xB120, 0x86A4, 0xB121, 0x86A5, 0xB122, 0x86A6, 0xB123, 0xB3D6, - 0xB124, 0xB3D7, 0xB125, 0xB3D8, 0xB126, 0x86A7, 0xB127, 0x86A8, - 0xB128, 0xB3D9, 0xB129, 0x86A9, 0xB12A, 0x86AA, 0xB12B, 0x86AB, - 0xB12C, 0xB3DA, 0xB12D, 0x86AC, 0xB12E, 0x86AD, 0xB12F, 0x86AE, - 0xB130, 0x86AF, 0xB131, 0x86B0, 0xB132, 0x86B1, 0xB133, 0x86B2, - 0xB134, 0xB3DB, 0xB135, 0xB3DC, 0xB136, 0x86B3, 0xB137, 0xB3DD, - 0xB138, 0xB3DE, 0xB139, 0xB3DF, 0xB13A, 0x86B4, 0xB13B, 0x86B5, - 0xB13C, 0x86B6, 0xB13D, 0x86B7, 0xB13E, 0x86B8, 0xB13F, 0x86B9, - 0xB140, 0xB3E0, 0xB141, 0xB3E1, 0xB142, 0x86BA, 0xB143, 0x86BB, - 0xB144, 0xB3E2, 0xB145, 0x86BC, 0xB146, 0x86BD, 0xB147, 0x86BE, - 0xB148, 0xB3E3, 0xB149, 0x86BF, 0xB14A, 0x86C0, 0xB14B, 0x86C1, - 0xB14C, 0x86C2, 0xB14D, 0x86C3, 0xB14E, 0x86C4, 0xB14F, 0x86C5, - 0xB150, 0xB3E4, 0xB151, 0xB3E5, 0xB152, 0x86C6, 0xB153, 0x86C7, - 0xB154, 0xB3E6, 0xB155, 0xB3E7, 0xB156, 0x86C8, 0xB157, 0x86C9, - 0xB158, 0xB3E8, 0xB159, 0x86CA, 0xB15A, 0x86CB, 0xB15B, 0x86CC, - 0xB15C, 0xB3E9, 0xB15D, 0x86CD, 0xB15E, 0x86CE, 0xB15F, 0x86CF, - 0xB160, 0xB3EA, 0xB161, 0x86D0, 0xB162, 0x86D1, 0xB163, 0x86D2, - 0xB164, 0x86D3, 0xB165, 0x86D4, 0xB166, 0x86D5, 0xB167, 0x86D6, - 0xB168, 0x86D7, 0xB169, 0x86D8, 0xB16A, 0x86D9, 0xB16B, 0x86DA, - 0xB16C, 0x86DB, 0xB16D, 0x86DC, 0xB16E, 0x86DD, 0xB16F, 0x86DE, - 0xB170, 0x86DF, 0xB171, 0x86E0, 0xB172, 0x86E1, 0xB173, 0x86E2, - 0xB174, 0x86E3, 0xB175, 0x86E4, 0xB176, 0x86E5, 0xB177, 0x86E6, - 0xB178, 0xB3EB, 0xB179, 0xB3EC, 0xB17A, 0x86E7, 0xB17B, 0x86E8, - 0xB17C, 0xB3ED, 0xB17D, 0x86E9, 0xB17E, 0x86EA, 0xB17F, 0x86EB, - 0xB180, 0xB3EE, 0xB181, 0x86EC, 0xB182, 0xB3EF, 0xB183, 0x86ED, - 0xB184, 0x86EE, 0xB185, 0x86EF, 0xB186, 0x86F0, 0xB187, 0x86F1, - 0xB188, 0xB3F0, 0xB189, 0xB3F1, 0xB18A, 0x86F2, 0xB18B, 0xB3F2, - 0xB18C, 0x86F3, 0xB18D, 0xB3F3, 0xB18E, 0x86F4, 0xB18F, 0x86F5, - 0xB190, 0x86F6, 0xB191, 0x86F7, 0xB192, 0xB3F4, 0xB193, 0xB3F5, - 0xB194, 0xB3F6, 0xB195, 0x86F8, 0xB196, 0x86F9, 0xB197, 0x86FA, - 0xB198, 0xB3F7, 0xB199, 0x86FB, 0xB19A, 0x86FC, 0xB19B, 0x86FD, - 0xB19C, 0xB3F8, 0xB19D, 0x86FE, 0xB19E, 0x8741, 0xB19F, 0x8742, - 0xB1A0, 0x8743, 0xB1A1, 0x8744, 0xB1A2, 0x8745, 0xB1A3, 0x8746, - 0xB1A4, 0x8747, 0xB1A5, 0x8748, 0xB1A6, 0x8749, 0xB1A7, 0x874A, - 0xB1A8, 0xB3F9, 0xB1A9, 0x874B, 0xB1AA, 0x874C, 0xB1AB, 0x874D, - 0xB1AC, 0x874E, 0xB1AD, 0x874F, 0xB1AE, 0x8750, 0xB1AF, 0x8751, - 0xB1B0, 0x8752, 0xB1B1, 0x8753, 0xB1B2, 0x8754, 0xB1B3, 0x8755, - 0xB1B4, 0x8756, 0xB1B5, 0x8757, 0xB1B6, 0x8758, 0xB1B7, 0x8759, - 0xB1B8, 0x875A, 0xB1B9, 0x8761, 0xB1BA, 0x8762, 0xB1BB, 0x8763, - 0xB1BC, 0x8764, 0xB1BD, 0x8765, 0xB1BE, 0x8766, 0xB1BF, 0x8767, - 0xB1C0, 0x8768, 0xB1C1, 0x8769, 0xB1C2, 0x876A, 0xB1C3, 0x876B, - 0xB1C4, 0x876C, 0xB1C5, 0x876D, 0xB1C6, 0x876E, 0xB1C7, 0x876F, - 0xB1C8, 0x8770, 0xB1C9, 0x8771, 0xB1CA, 0x8772, 0xB1CB, 0x8773, - 0xB1CC, 0xB3FA, 0xB1CD, 0x8774, 0xB1CE, 0x8775, 0xB1CF, 0x8776, - 0xB1D0, 0xB3FB, 0xB1D1, 0x8777, 0xB1D2, 0x8778, 0xB1D3, 0x8779, - 0xB1D4, 0xB3FC, 0xB1D5, 0x877A, 0xB1D6, 0x8781, 0xB1D7, 0x8782, - 0xB1D8, 0x8783, 0xB1D9, 0x8784, 0xB1DA, 0x8785, 0xB1DB, 0x8786, - 0xB1DC, 0xB3FD, 0xB1DD, 0xB3FE, 0xB1DE, 0x8787, 0xB1DF, 0xB4A1, - 0xB1E0, 0x8788, 0xB1E1, 0x8789, 0xB1E2, 0x878A, 0xB1E3, 0x878B, - 0xB1E4, 0x878C, 0xB1E5, 0x878D, 0xB1E6, 0x878E, 0xB1E7, 0x878F, - 0xB1E8, 0xB4A2, 0xB1E9, 0xB4A3, 0xB1EA, 0x8790, 0xB1EB, 0x8791, - 0xB1EC, 0xB4A4, 0xB1ED, 0x8792, 0xB1EE, 0x8793, 0xB1EF, 0x8794, - 0xB1F0, 0xB4A5, 0xB1F1, 0x8795, 0xB1F2, 0x8796, 0xB1F3, 0x8797, - 0xB1F4, 0x8798, 0xB1F5, 0x8799, 0xB1F6, 0x879A, 0xB1F7, 0x879B, - 0xB1F8, 0x879C, 0xB1F9, 0xB4A6, 0xB1FA, 0x879D, 0xB1FB, 0xB4A7, - 0xB1FC, 0x879E, 0xB1FD, 0xB4A8, 0xB1FE, 0x879F, 0xB1FF, 0x87A0, - 0xB200, 0x87A1, 0xB201, 0x87A2, 0xB202, 0x87A3, 0xB203, 0x87A4, - 0xB204, 0xB4A9, 0xB205, 0xB4AA, 0xB206, 0x87A5, 0xB207, 0x87A6, - 0xB208, 0xB4AB, 0xB209, 0x87A7, 0xB20A, 0x87A8, 0xB20B, 0xB4AC, - 0xB20C, 0xB4AD, 0xB20D, 0x87A9, 0xB20E, 0x87AA, 0xB20F, 0x87AB, - 0xB210, 0x87AC, 0xB211, 0x87AD, 0xB212, 0x87AE, 0xB213, 0x87AF, - 0xB214, 0xB4AE, 0xB215, 0xB4AF, 0xB216, 0x87B0, 0xB217, 0xB4B0, - 0xB218, 0x87B1, 0xB219, 0xB4B1, 0xB21A, 0x87B2, 0xB21B, 0x87B3, - 0xB21C, 0x87B4, 0xB21D, 0x87B5, 0xB21E, 0x87B6, 0xB21F, 0x87B7, - 0xB220, 0xB4B2, 0xB221, 0x87B8, 0xB222, 0x87B9, 0xB223, 0x87BA, - 0xB224, 0x87BB, 0xB225, 0x87BC, 0xB226, 0x87BD, 0xB227, 0x87BE, - 0xB228, 0x87BF, 0xB229, 0x87C0, 0xB22A, 0x87C1, 0xB22B, 0x87C2, - 0xB22C, 0x87C3, 0xB22D, 0x87C4, 0xB22E, 0x87C5, 0xB22F, 0x87C6, - 0xB230, 0x87C7, 0xB231, 0x87C8, 0xB232, 0x87C9, 0xB233, 0x87CA, - 0xB234, 0xB4B3, 0xB235, 0x87CB, 0xB236, 0x87CC, 0xB237, 0x87CD, - 0xB238, 0x87CE, 0xB239, 0x87CF, 0xB23A, 0x87D0, 0xB23B, 0x87D1, - 0xB23C, 0xB4B4, 0xB23D, 0x87D2, 0xB23E, 0x87D3, 0xB23F, 0x87D4, - 0xB240, 0x87D5, 0xB241, 0x87D6, 0xB242, 0x87D7, 0xB243, 0x87D8, - 0xB244, 0x87D9, 0xB245, 0x87DA, 0xB246, 0x87DB, 0xB247, 0x87DC, - 0xB248, 0x87DD, 0xB249, 0x87DE, 0xB24A, 0x87DF, 0xB24B, 0x87E0, - 0xB24C, 0x87E1, 0xB24D, 0x87E2, 0xB24E, 0x87E3, 0xB24F, 0x87E4, - 0xB250, 0x87E5, 0xB251, 0x87E6, 0xB252, 0x87E7, 0xB253, 0x87E8, - 0xB254, 0x87E9, 0xB255, 0x87EA, 0xB256, 0x87EB, 0xB257, 0x87EC, - 0xB258, 0xB4B5, 0xB259, 0x87ED, 0xB25A, 0x87EE, 0xB25B, 0x87EF, - 0xB25C, 0xB4B6, 0xB25D, 0x87F0, 0xB25E, 0x87F1, 0xB25F, 0x87F2, - 0xB260, 0xB4B7, 0xB261, 0x87F3, 0xB262, 0x87F4, 0xB263, 0x87F5, - 0xB264, 0x87F6, 0xB265, 0x87F7, 0xB266, 0x87F8, 0xB267, 0x87F9, - 0xB268, 0xB4B8, 0xB269, 0xB4B9, 0xB26A, 0x87FA, 0xB26B, 0x87FB, - 0xB26C, 0x87FC, 0xB26D, 0x87FD, 0xB26E, 0x87FE, 0xB26F, 0x8841, - 0xB270, 0x8842, 0xB271, 0x8843, 0xB272, 0x8844, 0xB273, 0x8845, - 0xB274, 0xB4BA, 0xB275, 0xB4BB, 0xB276, 0x8846, 0xB277, 0x8847, - 0xB278, 0x8848, 0xB279, 0x8849, 0xB27A, 0x884A, 0xB27B, 0x884B, - 0xB27C, 0xB4BC, 0xB27D, 0x884C, 0xB27E, 0x884D, 0xB27F, 0x884E, - 0xB280, 0x884F, 0xB281, 0x8850, 0xB282, 0x8851, 0xB283, 0x8852, - 0xB284, 0xB4BD, 0xB285, 0xB4BE, 0xB286, 0x8853, 0xB287, 0x8854, - 0xB288, 0x8855, 0xB289, 0xB4BF, 0xB28A, 0x8856, 0xB28B, 0x8857, - 0xB28C, 0x8858, 0xB28D, 0x8859, 0xB28E, 0x885A, 0xB28F, 0x8861, - 0xB290, 0xB4C0, 0xB291, 0xB4C1, 0xB292, 0x8862, 0xB293, 0x8863, - 0xB294, 0xB4C2, 0xB295, 0x8864, 0xB296, 0x8865, 0xB297, 0x8866, - 0xB298, 0xB4C3, 0xB299, 0xB4C4, 0xB29A, 0xB4C5, 0xB29B, 0x8867, - 0xB29C, 0x8868, 0xB29D, 0x8869, 0xB29E, 0x886A, 0xB29F, 0x886B, - 0xB2A0, 0xB4C6, 0xB2A1, 0xB4C7, 0xB2A2, 0x886C, 0xB2A3, 0xB4C8, - 0xB2A4, 0x886D, 0xB2A5, 0xB4C9, 0xB2A6, 0xB4CA, 0xB2A7, 0x886E, - 0xB2A8, 0x886F, 0xB2A9, 0x8870, 0xB2AA, 0xB4CB, 0xB2AB, 0x8871, - 0xB2AC, 0xB4CC, 0xB2AD, 0x8872, 0xB2AE, 0x8873, 0xB2AF, 0x8874, - 0xB2B0, 0xB4CD, 0xB2B1, 0x8875, 0xB2B2, 0x8876, 0xB2B3, 0x8877, - 0xB2B4, 0xB4CE, 0xB2B5, 0x8878, 0xB2B6, 0x8879, 0xB2B7, 0x887A, - 0xB2B8, 0x8881, 0xB2B9, 0x8882, 0xB2BA, 0x8883, 0xB2BB, 0x8884, - 0xB2BC, 0x8885, 0xB2BD, 0x8886, 0xB2BE, 0x8887, 0xB2BF, 0x8888, - 0xB2C0, 0x8889, 0xB2C1, 0x888A, 0xB2C2, 0x888B, 0xB2C3, 0x888C, - 0xB2C4, 0x888D, 0xB2C5, 0x888E, 0xB2C6, 0x888F, 0xB2C7, 0x8890, - 0xB2C8, 0xB4CF, 0xB2C9, 0xB4D0, 0xB2CA, 0x8891, 0xB2CB, 0x8892, - 0xB2CC, 0xB4D1, 0xB2CD, 0x8893, 0xB2CE, 0x8894, 0xB2CF, 0x8895, - 0xB2D0, 0xB4D2, 0xB2D1, 0x8896, 0xB2D2, 0xB4D3, 0xB2D3, 0x8897, - 0xB2D4, 0x8898, 0xB2D5, 0x8899, 0xB2D6, 0x889A, 0xB2D7, 0x889B, - 0xB2D8, 0xB4D4, 0xB2D9, 0xB4D5, 0xB2DA, 0x889C, 0xB2DB, 0xB4D6, - 0xB2DC, 0x889D, 0xB2DD, 0xB4D7, 0xB2DE, 0x889E, 0xB2DF, 0x889F, - 0xB2E0, 0x88A0, 0xB2E1, 0x88A1, 0xB2E2, 0xB4D8, 0xB2E3, 0x88A2, - 0xB2E4, 0xB4D9, 0xB2E5, 0xB4DA, 0xB2E6, 0xB4DB, 0xB2E7, 0x88A3, - 0xB2E8, 0xB4DC, 0xB2E9, 0x88A4, 0xB2EA, 0x88A5, 0xB2EB, 0xB4DD, - 0xB2EC, 0xB4DE, 0xB2ED, 0xB4DF, 0xB2EE, 0xB4E0, 0xB2EF, 0xB4E1, - 0xB2F0, 0x88A6, 0xB2F1, 0x88A7, 0xB2F2, 0x88A8, 0xB2F3, 0xB4E2, - 0xB2F4, 0xB4E3, 0xB2F5, 0xB4E4, 0xB2F6, 0x88A9, 0xB2F7, 0xB4E5, - 0xB2F8, 0xB4E6, 0xB2F9, 0xB4E7, 0xB2FA, 0xB4E8, 0xB2FB, 0xB4E9, - 0xB2FC, 0x88AA, 0xB2FD, 0x88AB, 0xB2FE, 0x88AC, 0xB2FF, 0xB4EA, - 0xB300, 0xB4EB, 0xB301, 0xB4EC, 0xB302, 0x88AD, 0xB303, 0x88AE, - 0xB304, 0xB4ED, 0xB305, 0x88AF, 0xB306, 0x88B0, 0xB307, 0x88B1, - 0xB308, 0xB4EE, 0xB309, 0x88B2, 0xB30A, 0x88B3, 0xB30B, 0x88B4, - 0xB30C, 0x88B5, 0xB30D, 0x88B6, 0xB30E, 0x88B7, 0xB30F, 0x88B8, - 0xB310, 0xB4EF, 0xB311, 0xB4F0, 0xB312, 0x88B9, 0xB313, 0xB4F1, - 0xB314, 0xB4F2, 0xB315, 0xB4F3, 0xB316, 0x88BA, 0xB317, 0x88BB, - 0xB318, 0x88BC, 0xB319, 0x88BD, 0xB31A, 0x88BE, 0xB31B, 0x88BF, - 0xB31C, 0xB4F4, 0xB31D, 0x88C0, 0xB31E, 0x88C1, 0xB31F, 0x88C2, - 0xB320, 0x88C3, 0xB321, 0x88C4, 0xB322, 0x88C5, 0xB323, 0x88C6, - 0xB324, 0x88C7, 0xB325, 0x88C8, 0xB326, 0x88C9, 0xB327, 0x88CA, - 0xB328, 0x88CB, 0xB329, 0x88CC, 0xB32A, 0x88CD, 0xB32B, 0x88CE, - 0xB32C, 0x88CF, 0xB32D, 0x88D0, 0xB32E, 0x88D1, 0xB32F, 0x88D2, - 0xB330, 0x88D3, 0xB331, 0x88D4, 0xB332, 0x88D5, 0xB333, 0x88D6, - 0xB334, 0x88D7, 0xB335, 0x88D8, 0xB336, 0x88D9, 0xB337, 0x88DA, - 0xB338, 0x88DB, 0xB339, 0x88DC, 0xB33A, 0x88DD, 0xB33B, 0x88DE, - 0xB33C, 0x88DF, 0xB33D, 0x88E0, 0xB33E, 0x88E1, 0xB33F, 0x88E2, - 0xB340, 0x88E3, 0xB341, 0x88E4, 0xB342, 0x88E5, 0xB343, 0x88E6, - 0xB344, 0x88E7, 0xB345, 0x88E8, 0xB346, 0x88E9, 0xB347, 0x88EA, - 0xB348, 0x88EB, 0xB349, 0x88EC, 0xB34A, 0x88ED, 0xB34B, 0x88EE, - 0xB34C, 0x88EF, 0xB34D, 0x88F0, 0xB34E, 0x88F1, 0xB34F, 0x88F2, - 0xB350, 0x88F3, 0xB351, 0x88F4, 0xB352, 0x88F5, 0xB353, 0x88F6, - 0xB354, 0xB4F5, 0xB355, 0xB4F6, 0xB356, 0xB4F7, 0xB357, 0x88F7, - 0xB358, 0xB4F8, 0xB359, 0x88F8, 0xB35A, 0x88F9, 0xB35B, 0xB4F9, - 0xB35C, 0xB4FA, 0xB35D, 0x88FA, 0xB35E, 0xB4FB, 0xB35F, 0xB4FC, - 0xB360, 0x88FB, 0xB361, 0x88FC, 0xB362, 0x88FD, 0xB363, 0x88FE, - 0xB364, 0xB4FD, 0xB365, 0xB4FE, 0xB366, 0x8941, 0xB367, 0xB5A1, - 0xB368, 0x8942, 0xB369, 0xB5A2, 0xB36A, 0x8943, 0xB36B, 0xB5A3, - 0xB36C, 0x8944, 0xB36D, 0x8945, 0xB36E, 0xB5A4, 0xB36F, 0x8946, - 0xB370, 0xB5A5, 0xB371, 0xB5A6, 0xB372, 0x8947, 0xB373, 0x8948, - 0xB374, 0xB5A7, 0xB375, 0x8949, 0xB376, 0x894A, 0xB377, 0x894B, - 0xB378, 0xB5A8, 0xB379, 0x894C, 0xB37A, 0x894D, 0xB37B, 0x894E, - 0xB37C, 0x894F, 0xB37D, 0x8950, 0xB37E, 0x8951, 0xB37F, 0x8952, - 0xB380, 0xB5A9, 0xB381, 0xB5AA, 0xB382, 0x8953, 0xB383, 0xB5AB, - 0xB384, 0xB5AC, 0xB385, 0xB5AD, 0xB386, 0x8954, 0xB387, 0x8955, - 0xB388, 0x8956, 0xB389, 0x8957, 0xB38A, 0x8958, 0xB38B, 0x8959, - 0xB38C, 0xB5AE, 0xB38D, 0x895A, 0xB38E, 0x8961, 0xB38F, 0x8962, - 0xB390, 0xB5AF, 0xB391, 0x8963, 0xB392, 0x8964, 0xB393, 0x8965, - 0xB394, 0xB5B0, 0xB395, 0x8966, 0xB396, 0x8967, 0xB397, 0x8968, - 0xB398, 0x8969, 0xB399, 0x896A, 0xB39A, 0x896B, 0xB39B, 0x896C, - 0xB39C, 0x896D, 0xB39D, 0x896E, 0xB39E, 0x896F, 0xB39F, 0x8970, - 0xB3A0, 0xB5B1, 0xB3A1, 0xB5B2, 0xB3A2, 0x8971, 0xB3A3, 0x8972, - 0xB3A4, 0x8973, 0xB3A5, 0x8974, 0xB3A6, 0x8975, 0xB3A7, 0x8976, - 0xB3A8, 0xB5B3, 0xB3A9, 0x8977, 0xB3AA, 0x8978, 0xB3AB, 0x8979, - 0xB3AC, 0xB5B4, 0xB3AD, 0x897A, 0xB3AE, 0x8981, 0xB3AF, 0x8982, - 0xB3B0, 0x8983, 0xB3B1, 0x8984, 0xB3B2, 0x8985, 0xB3B3, 0x8986, - 0xB3B4, 0x8987, 0xB3B5, 0x8988, 0xB3B6, 0x8989, 0xB3B7, 0x898A, - 0xB3B8, 0x898B, 0xB3B9, 0x898C, 0xB3BA, 0x898D, 0xB3BB, 0x898E, - 0xB3BC, 0x898F, 0xB3BD, 0x8990, 0xB3BE, 0x8991, 0xB3BF, 0x8992, - 0xB3C0, 0x8993, 0xB3C1, 0x8994, 0xB3C2, 0x8995, 0xB3C3, 0x8996, - 0xB3C4, 0xB5B5, 0xB3C5, 0xB5B6, 0xB3C6, 0x8997, 0xB3C7, 0x8998, - 0xB3C8, 0xB5B7, 0xB3C9, 0x8999, 0xB3CA, 0x899A, 0xB3CB, 0xB5B8, - 0xB3CC, 0xB5B9, 0xB3CD, 0x899B, 0xB3CE, 0xB5BA, 0xB3CF, 0x899C, - 0xB3D0, 0xB5BB, 0xB3D1, 0x899D, 0xB3D2, 0x899E, 0xB3D3, 0x899F, - 0xB3D4, 0xB5BC, 0xB3D5, 0xB5BD, 0xB3D6, 0x89A0, 0xB3D7, 0xB5BE, - 0xB3D8, 0x89A1, 0xB3D9, 0xB5BF, 0xB3DA, 0x89A2, 0xB3DB, 0xB5C0, - 0xB3DC, 0x89A3, 0xB3DD, 0xB5C1, 0xB3DE, 0x89A4, 0xB3DF, 0x89A5, - 0xB3E0, 0xB5C2, 0xB3E1, 0x89A6, 0xB3E2, 0x89A7, 0xB3E3, 0x89A8, - 0xB3E4, 0xB5C3, 0xB3E5, 0x89A9, 0xB3E6, 0x89AA, 0xB3E7, 0x89AB, - 0xB3E8, 0xB5C4, 0xB3E9, 0x89AC, 0xB3EA, 0x89AD, 0xB3EB, 0x89AE, - 0xB3EC, 0x89AF, 0xB3ED, 0x89B0, 0xB3EE, 0x89B1, 0xB3EF, 0x89B2, - 0xB3F0, 0x89B3, 0xB3F1, 0x89B4, 0xB3F2, 0x89B5, 0xB3F3, 0x89B6, - 0xB3F4, 0x89B7, 0xB3F5, 0x89B8, 0xB3F6, 0x89B9, 0xB3F7, 0x89BA, - 0xB3F8, 0x89BB, 0xB3F9, 0x89BC, 0xB3FA, 0x89BD, 0xB3FB, 0x89BE, - 0xB3FC, 0xB5C5, 0xB3FD, 0x89BF, 0xB3FE, 0x89C0, 0xB3FF, 0x89C1, - 0xB400, 0x89C2, 0xB401, 0x89C3, 0xB402, 0x89C4, 0xB403, 0x89C5, - 0xB404, 0x89C6, 0xB405, 0x89C7, 0xB406, 0x89C8, 0xB407, 0x89C9, - 0xB408, 0x89CA, 0xB409, 0x89CB, 0xB40A, 0x89CC, 0xB40B, 0x89CD, - 0xB40C, 0x89CE, 0xB40D, 0x89CF, 0xB40E, 0x89D0, 0xB40F, 0x89D1, - 0xB410, 0xB5C6, 0xB411, 0x89D2, 0xB412, 0x89D3, 0xB413, 0x89D4, - 0xB414, 0x89D5, 0xB415, 0x89D6, 0xB416, 0x89D7, 0xB417, 0x89D8, - 0xB418, 0xB5C7, 0xB419, 0x89D9, 0xB41A, 0x89DA, 0xB41B, 0x89DB, - 0xB41C, 0xB5C8, 0xB41D, 0x89DC, 0xB41E, 0x89DD, 0xB41F, 0x89DE, - 0xB420, 0xB5C9, 0xB421, 0x89DF, 0xB422, 0x89E0, 0xB423, 0x89E1, - 0xB424, 0x89E2, 0xB425, 0x89E3, 0xB426, 0x89E4, 0xB427, 0x89E5, - 0xB428, 0xB5CA, 0xB429, 0xB5CB, 0xB42A, 0x89E6, 0xB42B, 0xB5CC, - 0xB42C, 0x89E7, 0xB42D, 0x89E8, 0xB42E, 0x89E9, 0xB42F, 0x89EA, - 0xB430, 0x89EB, 0xB431, 0x89EC, 0xB432, 0x89ED, 0xB433, 0x89EE, - 0xB434, 0xB5CD, 0xB435, 0x89EF, 0xB436, 0x89F0, 0xB437, 0x89F1, - 0xB438, 0x89F2, 0xB439, 0x89F3, 0xB43A, 0x89F4, 0xB43B, 0x89F5, - 0xB43C, 0x89F6, 0xB43D, 0x89F7, 0xB43E, 0x89F8, 0xB43F, 0x89F9, - 0xB440, 0x89FA, 0xB441, 0x89FB, 0xB442, 0x89FC, 0xB443, 0x89FD, - 0xB444, 0x89FE, 0xB445, 0x8A41, 0xB446, 0x8A42, 0xB447, 0x8A43, - 0xB448, 0x8A44, 0xB449, 0x8A45, 0xB44A, 0x8A46, 0xB44B, 0x8A47, - 0xB44C, 0x8A48, 0xB44D, 0x8A49, 0xB44E, 0x8A4A, 0xB44F, 0x8A4B, - 0xB450, 0xB5CE, 0xB451, 0xB5CF, 0xB452, 0x8A4C, 0xB453, 0x8A4D, - 0xB454, 0xB5D0, 0xB455, 0x8A4E, 0xB456, 0x8A4F, 0xB457, 0x8A50, - 0xB458, 0xB5D1, 0xB459, 0x8A51, 0xB45A, 0x8A52, 0xB45B, 0x8A53, - 0xB45C, 0x8A54, 0xB45D, 0x8A55, 0xB45E, 0x8A56, 0xB45F, 0x8A57, - 0xB460, 0xB5D2, 0xB461, 0xB5D3, 0xB462, 0x8A58, 0xB463, 0xB5D4, - 0xB464, 0x8A59, 0xB465, 0xB5D5, 0xB466, 0x8A5A, 0xB467, 0x8A61, - 0xB468, 0x8A62, 0xB469, 0x8A63, 0xB46A, 0x8A64, 0xB46B, 0x8A65, - 0xB46C, 0xB5D6, 0xB46D, 0x8A66, 0xB46E, 0x8A67, 0xB46F, 0x8A68, - 0xB470, 0x8A69, 0xB471, 0x8A6A, 0xB472, 0x8A6B, 0xB473, 0x8A6C, - 0xB474, 0x8A6D, 0xB475, 0x8A6E, 0xB476, 0x8A6F, 0xB477, 0x8A70, - 0xB478, 0x8A71, 0xB479, 0x8A72, 0xB47A, 0x8A73, 0xB47B, 0x8A74, - 0xB47C, 0x8A75, 0xB47D, 0x8A76, 0xB47E, 0x8A77, 0xB47F, 0x8A78, - 0xB480, 0xB5D7, 0xB481, 0x8A79, 0xB482, 0x8A7A, 0xB483, 0x8A81, - 0xB484, 0x8A82, 0xB485, 0x8A83, 0xB486, 0x8A84, 0xB487, 0x8A85, - 0xB488, 0xB5D8, 0xB489, 0x8A86, 0xB48A, 0x8A87, 0xB48B, 0x8A88, - 0xB48C, 0x8A89, 0xB48D, 0x8A8A, 0xB48E, 0x8A8B, 0xB48F, 0x8A8C, - 0xB490, 0x8A8D, 0xB491, 0x8A8E, 0xB492, 0x8A8F, 0xB493, 0x8A90, - 0xB494, 0x8A91, 0xB495, 0x8A92, 0xB496, 0x8A93, 0xB497, 0x8A94, - 0xB498, 0x8A95, 0xB499, 0x8A96, 0xB49A, 0x8A97, 0xB49B, 0x8A98, - 0xB49C, 0x8A99, 0xB49D, 0xB5D9, 0xB49E, 0x8A9A, 0xB49F, 0x8A9B, - 0xB4A0, 0x8A9C, 0xB4A1, 0x8A9D, 0xB4A2, 0x8A9E, 0xB4A3, 0x8A9F, - 0xB4A4, 0xB5DA, 0xB4A5, 0x8AA0, 0xB4A6, 0x8AA1, 0xB4A7, 0x8AA2, - 0xB4A8, 0xB5DB, 0xB4A9, 0x8AA3, 0xB4AA, 0x8AA4, 0xB4AB, 0x8AA5, - 0xB4AC, 0xB5DC, 0xB4AD, 0x8AA6, 0xB4AE, 0x8AA7, 0xB4AF, 0x8AA8, - 0xB4B0, 0x8AA9, 0xB4B1, 0x8AAA, 0xB4B2, 0x8AAB, 0xB4B3, 0x8AAC, - 0xB4B4, 0x8AAD, 0xB4B5, 0xB5DD, 0xB4B6, 0x8AAE, 0xB4B7, 0xB5DE, - 0xB4B8, 0x8AAF, 0xB4B9, 0xB5DF, 0xB4BA, 0x8AB0, 0xB4BB, 0x8AB1, - 0xB4BC, 0x8AB2, 0xB4BD, 0x8AB3, 0xB4BE, 0x8AB4, 0xB4BF, 0x8AB5, - 0xB4C0, 0xB5E0, 0xB4C1, 0x8AB6, 0xB4C2, 0x8AB7, 0xB4C3, 0x8AB8, - 0xB4C4, 0xB5E1, 0xB4C5, 0x8AB9, 0xB4C6, 0x8ABA, 0xB4C7, 0x8ABB, - 0xB4C8, 0xB5E2, 0xB4C9, 0x8ABC, 0xB4CA, 0x8ABD, 0xB4CB, 0x8ABE, - 0xB4CC, 0x8ABF, 0xB4CD, 0x8AC0, 0xB4CE, 0x8AC1, 0xB4CF, 0x8AC2, - 0xB4D0, 0xB5E3, 0xB4D1, 0x8AC3, 0xB4D2, 0x8AC4, 0xB4D3, 0x8AC5, - 0xB4D4, 0x8AC6, 0xB4D5, 0xB5E4, 0xB4D6, 0x8AC7, 0xB4D7, 0x8AC8, - 0xB4D8, 0x8AC9, 0xB4D9, 0x8ACA, 0xB4DA, 0x8ACB, 0xB4DB, 0x8ACC, - 0xB4DC, 0xB5E5, 0xB4DD, 0xB5E6, 0xB4DE, 0x8ACD, 0xB4DF, 0x8ACE, - 0xB4E0, 0xB5E7, 0xB4E1, 0x8ACF, 0xB4E2, 0x8AD0, 0xB4E3, 0xB5E8, - 0xB4E4, 0xB5E9, 0xB4E5, 0x8AD1, 0xB4E6, 0xB5EA, 0xB4E7, 0x8AD2, - 0xB4E8, 0x8AD3, 0xB4E9, 0x8AD4, 0xB4EA, 0x8AD5, 0xB4EB, 0x8AD6, - 0xB4EC, 0xB5EB, 0xB4ED, 0xB5EC, 0xB4EE, 0x8AD7, 0xB4EF, 0xB5ED, - 0xB4F0, 0x8AD8, 0xB4F1, 0xB5EE, 0xB4F2, 0x8AD9, 0xB4F3, 0x8ADA, - 0xB4F4, 0x8ADB, 0xB4F5, 0x8ADC, 0xB4F6, 0x8ADD, 0xB4F7, 0x8ADE, - 0xB4F8, 0xB5EF, 0xB4F9, 0x8ADF, 0xB4FA, 0x8AE0, 0xB4FB, 0x8AE1, - 0xB4FC, 0x8AE2, 0xB4FD, 0x8AE3, 0xB4FE, 0x8AE4, 0xB4FF, 0x8AE5, - 0xB500, 0x8AE6, 0xB501, 0x8AE7, 0xB502, 0x8AE8, 0xB503, 0x8AE9, - 0xB504, 0x8AEA, 0xB505, 0x8AEB, 0xB506, 0x8AEC, 0xB507, 0x8AED, - 0xB508, 0x8AEE, 0xB509, 0x8AEF, 0xB50A, 0x8AF0, 0xB50B, 0x8AF1, - 0xB50C, 0x8AF2, 0xB50D, 0x8AF3, 0xB50E, 0x8AF4, 0xB50F, 0x8AF5, - 0xB510, 0x8AF6, 0xB511, 0x8AF7, 0xB512, 0x8AF8, 0xB513, 0x8AF9, - 0xB514, 0xB5F0, 0xB515, 0xB5F1, 0xB516, 0x8AFA, 0xB517, 0x8AFB, - 0xB518, 0xB5F2, 0xB519, 0x8AFC, 0xB51A, 0x8AFD, 0xB51B, 0xB5F3, - 0xB51C, 0xB5F4, 0xB51D, 0x8AFE, 0xB51E, 0x8B41, 0xB51F, 0x8B42, - 0xB520, 0x8B43, 0xB521, 0x8B44, 0xB522, 0x8B45, 0xB523, 0x8B46, - 0xB524, 0xB5F5, 0xB525, 0xB5F6, 0xB526, 0x8B47, 0xB527, 0xB5F7, - 0xB528, 0xB5F8, 0xB529, 0xB5F9, 0xB52A, 0xB5FA, 0xB52B, 0x8B48, - 0xB52C, 0x8B49, 0xB52D, 0x8B4A, 0xB52E, 0x8B4B, 0xB52F, 0x8B4C, - 0xB530, 0xB5FB, 0xB531, 0xB5FC, 0xB532, 0x8B4D, 0xB533, 0x8B4E, - 0xB534, 0xB5FD, 0xB535, 0x8B4F, 0xB536, 0x8B50, 0xB537, 0x8B51, - 0xB538, 0xB5FE, 0xB539, 0x8B52, 0xB53A, 0x8B53, 0xB53B, 0x8B54, - 0xB53C, 0x8B55, 0xB53D, 0x8B56, 0xB53E, 0x8B57, 0xB53F, 0x8B58, - 0xB540, 0xB6A1, 0xB541, 0xB6A2, 0xB542, 0x8B59, 0xB543, 0xB6A3, - 0xB544, 0xB6A4, 0xB545, 0xB6A5, 0xB546, 0x8B5A, 0xB547, 0x8B61, - 0xB548, 0x8B62, 0xB549, 0x8B63, 0xB54A, 0x8B64, 0xB54B, 0xB6A6, - 0xB54C, 0xB6A7, 0xB54D, 0xB6A8, 0xB54E, 0x8B65, 0xB54F, 0x8B66, - 0xB550, 0xB6A9, 0xB551, 0x8B67, 0xB552, 0x8B68, 0xB553, 0x8B69, - 0xB554, 0xB6AA, 0xB555, 0x8B6A, 0xB556, 0x8B6B, 0xB557, 0x8B6C, - 0xB558, 0x8B6D, 0xB559, 0x8B6E, 0xB55A, 0x8B6F, 0xB55B, 0x8B70, - 0xB55C, 0xB6AB, 0xB55D, 0xB6AC, 0xB55E, 0x8B71, 0xB55F, 0xB6AD, - 0xB560, 0xB6AE, 0xB561, 0xB6AF, 0xB562, 0x8B72, 0xB563, 0x8B73, - 0xB564, 0x8B74, 0xB565, 0x8B75, 0xB566, 0x8B76, 0xB567, 0x8B77, - 0xB568, 0x8B78, 0xB569, 0x8B79, 0xB56A, 0x8B7A, 0xB56B, 0x8B81, - 0xB56C, 0x8B82, 0xB56D, 0x8B83, 0xB56E, 0x8B84, 0xB56F, 0x8B85, - 0xB570, 0x8B86, 0xB571, 0x8B87, 0xB572, 0x8B88, 0xB573, 0x8B89, - 0xB574, 0x8B8A, 0xB575, 0x8B8B, 0xB576, 0x8B8C, 0xB577, 0x8B8D, - 0xB578, 0x8B8E, 0xB579, 0x8B8F, 0xB57A, 0x8B90, 0xB57B, 0x8B91, - 0xB57C, 0x8B92, 0xB57D, 0x8B93, 0xB57E, 0x8B94, 0xB57F, 0x8B95, - 0xB580, 0x8B96, 0xB581, 0x8B97, 0xB582, 0x8B98, 0xB583, 0x8B99, - 0xB584, 0x8B9A, 0xB585, 0x8B9B, 0xB586, 0x8B9C, 0xB587, 0x8B9D, - 0xB588, 0x8B9E, 0xB589, 0x8B9F, 0xB58A, 0x8BA0, 0xB58B, 0x8BA1, - 0xB58C, 0x8BA2, 0xB58D, 0x8BA3, 0xB58E, 0x8BA4, 0xB58F, 0x8BA5, - 0xB590, 0x8BA6, 0xB591, 0x8BA7, 0xB592, 0x8BA8, 0xB593, 0x8BA9, - 0xB594, 0x8BAA, 0xB595, 0x8BAB, 0xB596, 0x8BAC, 0xB597, 0x8BAD, - 0xB598, 0x8BAE, 0xB599, 0x8BAF, 0xB59A, 0x8BB0, 0xB59B, 0x8BB1, - 0xB59C, 0x8BB2, 0xB59D, 0x8BB3, 0xB59E, 0x8BB4, 0xB59F, 0x8BB5, - 0xB5A0, 0xB6B0, 0xB5A1, 0xB6B1, 0xB5A2, 0x8BB6, 0xB5A3, 0x8BB7, - 0xB5A4, 0xB6B2, 0xB5A5, 0x8BB8, 0xB5A6, 0x8BB9, 0xB5A7, 0x8BBA, - 0xB5A8, 0xB6B3, 0xB5A9, 0x8BBB, 0xB5AA, 0xB6B4, 0xB5AB, 0xB6B5, - 0xB5AC, 0x8BBC, 0xB5AD, 0x8BBD, 0xB5AE, 0x8BBE, 0xB5AF, 0x8BBF, - 0xB5B0, 0xB6B6, 0xB5B1, 0xB6B7, 0xB5B2, 0x8BC0, 0xB5B3, 0xB6B8, - 0xB5B4, 0xB6B9, 0xB5B5, 0xB6BA, 0xB5B6, 0x8BC1, 0xB5B7, 0x8BC2, - 0xB5B8, 0x8BC3, 0xB5B9, 0x8BC4, 0xB5BA, 0x8BC5, 0xB5BB, 0xB6BB, - 0xB5BC, 0xB6BC, 0xB5BD, 0xB6BD, 0xB5BE, 0x8BC6, 0xB5BF, 0x8BC7, - 0xB5C0, 0xB6BE, 0xB5C1, 0x8BC8, 0xB5C2, 0x8BC9, 0xB5C3, 0x8BCA, - 0xB5C4, 0xB6BF, 0xB5C5, 0x8BCB, 0xB5C6, 0x8BCC, 0xB5C7, 0x8BCD, - 0xB5C8, 0x8BCE, 0xB5C9, 0x8BCF, 0xB5CA, 0x8BD0, 0xB5CB, 0x8BD1, - 0xB5CC, 0xB6C0, 0xB5CD, 0xB6C1, 0xB5CE, 0x8BD2, 0xB5CF, 0xB6C2, - 0xB5D0, 0xB6C3, 0xB5D1, 0xB6C4, 0xB5D2, 0x8BD3, 0xB5D3, 0x8BD4, - 0xB5D4, 0x8BD5, 0xB5D5, 0x8BD6, 0xB5D6, 0x8BD7, 0xB5D7, 0x8BD8, - 0xB5D8, 0xB6C5, 0xB5D9, 0x8BD9, 0xB5DA, 0x8BDA, 0xB5DB, 0x8BDB, - 0xB5DC, 0x8BDC, 0xB5DD, 0x8BDD, 0xB5DE, 0x8BDE, 0xB5DF, 0x8BDF, - 0xB5E0, 0x8BE0, 0xB5E1, 0x8BE1, 0xB5E2, 0x8BE2, 0xB5E3, 0x8BE3, - 0xB5E4, 0x8BE4, 0xB5E5, 0x8BE5, 0xB5E6, 0x8BE6, 0xB5E7, 0x8BE7, - 0xB5E8, 0x8BE8, 0xB5E9, 0x8BE9, 0xB5EA, 0x8BEA, 0xB5EB, 0x8BEB, - 0xB5EC, 0xB6C6, 0xB5ED, 0x8BEC, 0xB5EE, 0x8BED, 0xB5EF, 0x8BEE, - 0xB5F0, 0x8BEF, 0xB5F1, 0x8BF0, 0xB5F2, 0x8BF1, 0xB5F3, 0x8BF2, - 0xB5F4, 0x8BF3, 0xB5F5, 0x8BF4, 0xB5F6, 0x8BF5, 0xB5F7, 0x8BF6, - 0xB5F8, 0x8BF7, 0xB5F9, 0x8BF8, 0xB5FA, 0x8BF9, 0xB5FB, 0x8BFA, - 0xB5FC, 0x8BFB, 0xB5FD, 0x8BFC, 0xB5FE, 0x8BFD, 0xB5FF, 0x8BFE, - 0xB600, 0x8C41, 0xB601, 0x8C42, 0xB602, 0x8C43, 0xB603, 0x8C44, - 0xB604, 0x8C45, 0xB605, 0x8C46, 0xB606, 0x8C47, 0xB607, 0x8C48, - 0xB608, 0x8C49, 0xB609, 0x8C4A, 0xB60A, 0x8C4B, 0xB60B, 0x8C4C, - 0xB60C, 0x8C4D, 0xB60D, 0x8C4E, 0xB60E, 0x8C4F, 0xB60F, 0x8C50, - 0xB610, 0xB6C7, 0xB611, 0xB6C8, 0xB612, 0x8C51, 0xB613, 0x8C52, - 0xB614, 0xB6C9, 0xB615, 0x8C53, 0xB616, 0x8C54, 0xB617, 0x8C55, - 0xB618, 0xB6CA, 0xB619, 0x8C56, 0xB61A, 0x8C57, 0xB61B, 0x8C58, - 0xB61C, 0x8C59, 0xB61D, 0x8C5A, 0xB61E, 0x8C61, 0xB61F, 0x8C62, - 0xB620, 0x8C63, 0xB621, 0x8C64, 0xB622, 0x8C65, 0xB623, 0x8C66, - 0xB624, 0x8C67, 0xB625, 0xB6CB, 0xB626, 0x8C68, 0xB627, 0x8C69, - 0xB628, 0x8C6A, 0xB629, 0x8C6B, 0xB62A, 0x8C6C, 0xB62B, 0x8C6D, - 0xB62C, 0xB6CC, 0xB62D, 0x8C6E, 0xB62E, 0x8C6F, 0xB62F, 0x8C70, - 0xB630, 0x8C71, 0xB631, 0x8C72, 0xB632, 0x8C73, 0xB633, 0x8C74, - 0xB634, 0xB6CD, 0xB635, 0x8C75, 0xB636, 0x8C76, 0xB637, 0x8C77, - 0xB638, 0x8C78, 0xB639, 0x8C79, 0xB63A, 0x8C7A, 0xB63B, 0x8C81, - 0xB63C, 0x8C82, 0xB63D, 0x8C83, 0xB63E, 0x8C84, 0xB63F, 0x8C85, - 0xB640, 0x8C86, 0xB641, 0x8C87, 0xB642, 0x8C88, 0xB643, 0x8C89, - 0xB644, 0x8C8A, 0xB645, 0x8C8B, 0xB646, 0x8C8C, 0xB647, 0x8C8D, - 0xB648, 0xB6CE, 0xB649, 0x8C8E, 0xB64A, 0x8C8F, 0xB64B, 0x8C90, - 0xB64C, 0x8C91, 0xB64D, 0x8C92, 0xB64E, 0x8C93, 0xB64F, 0x8C94, - 0xB650, 0x8C95, 0xB651, 0x8C96, 0xB652, 0x8C97, 0xB653, 0x8C98, - 0xB654, 0x8C99, 0xB655, 0x8C9A, 0xB656, 0x8C9B, 0xB657, 0x8C9C, - 0xB658, 0x8C9D, 0xB659, 0x8C9E, 0xB65A, 0x8C9F, 0xB65B, 0x8CA0, - 0xB65C, 0x8CA1, 0xB65D, 0x8CA2, 0xB65E, 0x8CA3, 0xB65F, 0x8CA4, - 0xB660, 0x8CA5, 0xB661, 0x8CA6, 0xB662, 0x8CA7, 0xB663, 0x8CA8, - 0xB664, 0xB6CF, 0xB665, 0x8CA9, 0xB666, 0x8CAA, 0xB667, 0x8CAB, - 0xB668, 0xB6D0, 0xB669, 0x8CAC, 0xB66A, 0x8CAD, 0xB66B, 0x8CAE, - 0xB66C, 0x8CAF, 0xB66D, 0x8CB0, 0xB66E, 0x8CB1, 0xB66F, 0x8CB2, - 0xB670, 0x8CB3, 0xB671, 0x8CB4, 0xB672, 0x8CB5, 0xB673, 0x8CB6, - 0xB674, 0x8CB7, 0xB675, 0x8CB8, 0xB676, 0x8CB9, 0xB677, 0x8CBA, - 0xB678, 0x8CBB, 0xB679, 0x8CBC, 0xB67A, 0x8CBD, 0xB67B, 0x8CBE, - 0xB67C, 0x8CBF, 0xB67D, 0x8CC0, 0xB67E, 0x8CC1, 0xB67F, 0x8CC2, - 0xB680, 0x8CC3, 0xB681, 0x8CC4, 0xB682, 0x8CC5, 0xB683, 0x8CC6, - 0xB684, 0x8CC7, 0xB685, 0x8CC8, 0xB686, 0x8CC9, 0xB687, 0x8CCA, - 0xB688, 0x8CCB, 0xB689, 0x8CCC, 0xB68A, 0x8CCD, 0xB68B, 0x8CCE, - 0xB68C, 0x8CCF, 0xB68D, 0x8CD0, 0xB68E, 0x8CD1, 0xB68F, 0x8CD2, - 0xB690, 0x8CD3, 0xB691, 0x8CD4, 0xB692, 0x8CD5, 0xB693, 0x8CD6, - 0xB694, 0x8CD7, 0xB695, 0x8CD8, 0xB696, 0x8CD9, 0xB697, 0x8CDA, - 0xB698, 0x8CDB, 0xB699, 0x8CDC, 0xB69A, 0x8CDD, 0xB69B, 0x8CDE, - 0xB69C, 0xB6D1, 0xB69D, 0xB6D2, 0xB69E, 0x8CDF, 0xB69F, 0x8CE0, - 0xB6A0, 0xB6D3, 0xB6A1, 0x8CE1, 0xB6A2, 0x8CE2, 0xB6A3, 0x8CE3, - 0xB6A4, 0xB6D4, 0xB6A5, 0x8CE4, 0xB6A6, 0x8CE5, 0xB6A7, 0x8CE6, - 0xB6A8, 0x8CE7, 0xB6A9, 0x8CE8, 0xB6AA, 0x8CE9, 0xB6AB, 0xB6D5, - 0xB6AC, 0xB6D6, 0xB6AD, 0x8CEA, 0xB6AE, 0x8CEB, 0xB6AF, 0x8CEC, - 0xB6B0, 0x8CED, 0xB6B1, 0xB6D7, 0xB6B2, 0x8CEE, 0xB6B3, 0x8CEF, - 0xB6B4, 0x8CF0, 0xB6B5, 0x8CF1, 0xB6B6, 0x8CF2, 0xB6B7, 0x8CF3, - 0xB6B8, 0x8CF4, 0xB6B9, 0x8CF5, 0xB6BA, 0x8CF6, 0xB6BB, 0x8CF7, - 0xB6BC, 0x8CF8, 0xB6BD, 0x8CF9, 0xB6BE, 0x8CFA, 0xB6BF, 0x8CFB, - 0xB6C0, 0x8CFC, 0xB6C1, 0x8CFD, 0xB6C2, 0x8CFE, 0xB6C3, 0x8D41, - 0xB6C4, 0x8D42, 0xB6C5, 0x8D43, 0xB6C6, 0x8D44, 0xB6C7, 0x8D45, - 0xB6C8, 0x8D46, 0xB6C9, 0x8D47, 0xB6CA, 0x8D48, 0xB6CB, 0x8D49, - 0xB6CC, 0x8D4A, 0xB6CD, 0x8D4B, 0xB6CE, 0x8D4C, 0xB6CF, 0x8D4D, - 0xB6D0, 0x8D4E, 0xB6D1, 0x8D4F, 0xB6D2, 0x8D50, 0xB6D3, 0x8D51, - 0xB6D4, 0xB6D8, 0xB6D5, 0x8D52, 0xB6D6, 0x8D53, 0xB6D7, 0x8D54, - 0xB6D8, 0x8D55, 0xB6D9, 0x8D56, 0xB6DA, 0x8D57, 0xB6DB, 0x8D58, - 0xB6DC, 0x8D59, 0xB6DD, 0x8D5A, 0xB6DE, 0x8D61, 0xB6DF, 0x8D62, - 0xB6E0, 0x8D63, 0xB6E1, 0x8D64, 0xB6E2, 0x8D65, 0xB6E3, 0x8D66, - 0xB6E4, 0x8D67, 0xB6E5, 0x8D68, 0xB6E6, 0x8D69, 0xB6E7, 0x8D6A, - 0xB6E8, 0x8D6B, 0xB6E9, 0x8D6C, 0xB6EA, 0x8D6D, 0xB6EB, 0x8D6E, - 0xB6EC, 0x8D6F, 0xB6ED, 0x8D70, 0xB6EE, 0x8D71, 0xB6EF, 0x8D72, - 0xB6F0, 0xB6D9, 0xB6F1, 0x8D73, 0xB6F2, 0x8D74, 0xB6F3, 0x8D75, - 0xB6F4, 0xB6DA, 0xB6F5, 0x8D76, 0xB6F6, 0x8D77, 0xB6F7, 0x8D78, - 0xB6F8, 0xB6DB, 0xB6F9, 0x8D79, 0xB6FA, 0x8D7A, 0xB6FB, 0x8D81, - 0xB6FC, 0x8D82, 0xB6FD, 0x8D83, 0xB6FE, 0x8D84, 0xB6FF, 0x8D85, - 0xB700, 0xB6DC, 0xB701, 0xB6DD, 0xB702, 0x8D86, 0xB703, 0x8D87, - 0xB704, 0x8D88, 0xB705, 0xB6DE, 0xB706, 0x8D89, 0xB707, 0x8D8A, - 0xB708, 0x8D8B, 0xB709, 0x8D8C, 0xB70A, 0x8D8D, 0xB70B, 0x8D8E, - 0xB70C, 0x8D8F, 0xB70D, 0x8D90, 0xB70E, 0x8D91, 0xB70F, 0x8D92, - 0xB710, 0x8D93, 0xB711, 0x8D94, 0xB712, 0x8D95, 0xB713, 0x8D96, - 0xB714, 0x8D97, 0xB715, 0x8D98, 0xB716, 0x8D99, 0xB717, 0x8D9A, - 0xB718, 0x8D9B, 0xB719, 0x8D9C, 0xB71A, 0x8D9D, 0xB71B, 0x8D9E, - 0xB71C, 0x8D9F, 0xB71D, 0x8DA0, 0xB71E, 0x8DA1, 0xB71F, 0x8DA2, - 0xB720, 0x8DA3, 0xB721, 0x8DA4, 0xB722, 0x8DA5, 0xB723, 0x8DA6, - 0xB724, 0x8DA7, 0xB725, 0x8DA8, 0xB726, 0x8DA9, 0xB727, 0x8DAA, - 0xB728, 0xB6DF, 0xB729, 0xB6E0, 0xB72A, 0x8DAB, 0xB72B, 0x8DAC, - 0xB72C, 0xB6E1, 0xB72D, 0x8DAD, 0xB72E, 0x8DAE, 0xB72F, 0xB6E2, - 0xB730, 0xB6E3, 0xB731, 0x8DAF, 0xB732, 0x8DB0, 0xB733, 0x8DB1, - 0xB734, 0x8DB2, 0xB735, 0x8DB3, 0xB736, 0x8DB4, 0xB737, 0x8DB5, - 0xB738, 0xB6E4, 0xB739, 0xB6E5, 0xB73A, 0x8DB6, 0xB73B, 0xB6E6, - 0xB73C, 0x8DB7, 0xB73D, 0x8DB8, 0xB73E, 0x8DB9, 0xB73F, 0x8DBA, - 0xB740, 0x8DBB, 0xB741, 0x8DBC, 0xB742, 0x8DBD, 0xB743, 0x8DBE, - 0xB744, 0xB6E7, 0xB745, 0x8DBF, 0xB746, 0x8DC0, 0xB747, 0x8DC1, - 0xB748, 0xB6E8, 0xB749, 0x8DC2, 0xB74A, 0x8DC3, 0xB74B, 0x8DC4, - 0xB74C, 0xB6E9, 0xB74D, 0x8DC5, 0xB74E, 0x8DC6, 0xB74F, 0x8DC7, - 0xB750, 0x8DC8, 0xB751, 0x8DC9, 0xB752, 0x8DCA, 0xB753, 0x8DCB, - 0xB754, 0xB6EA, 0xB755, 0xB6EB, 0xB756, 0x8DCC, 0xB757, 0x8DCD, - 0xB758, 0x8DCE, 0xB759, 0x8DCF, 0xB75A, 0x8DD0, 0xB75B, 0x8DD1, - 0xB75C, 0x8DD2, 0xB75D, 0x8DD3, 0xB75E, 0x8DD4, 0xB75F, 0x8DD5, - 0xB760, 0xB6EC, 0xB761, 0x8DD6, 0xB762, 0x8DD7, 0xB763, 0x8DD8, - 0xB764, 0xB6ED, 0xB765, 0x8DD9, 0xB766, 0x8DDA, 0xB767, 0x8DDB, - 0xB768, 0xB6EE, 0xB769, 0x8DDC, 0xB76A, 0x8DDD, 0xB76B, 0x8DDE, - 0xB76C, 0x8DDF, 0xB76D, 0x8DE0, 0xB76E, 0x8DE1, 0xB76F, 0x8DE2, - 0xB770, 0xB6EF, 0xB771, 0xB6F0, 0xB772, 0x8DE3, 0xB773, 0xB6F1, - 0xB774, 0x8DE4, 0xB775, 0xB6F2, 0xB776, 0x8DE5, 0xB777, 0x8DE6, - 0xB778, 0x8DE7, 0xB779, 0x8DE8, 0xB77A, 0x8DE9, 0xB77B, 0x8DEA, - 0xB77C, 0xB6F3, 0xB77D, 0xB6F4, 0xB77E, 0x8DEB, 0xB77F, 0x8DEC, - 0xB780, 0xB6F5, 0xB781, 0x8DED, 0xB782, 0x8DEE, 0xB783, 0x8DEF, - 0xB784, 0xB6F6, 0xB785, 0x8DF0, 0xB786, 0x8DF1, 0xB787, 0x8DF2, - 0xB788, 0x8DF3, 0xB789, 0x8DF4, 0xB78A, 0x8DF5, 0xB78B, 0x8DF6, - 0xB78C, 0xB6F7, 0xB78D, 0xB6F8, 0xB78E, 0x8DF7, 0xB78F, 0xB6F9, - 0xB790, 0xB6FA, 0xB791, 0xB6FB, 0xB792, 0xB6FC, 0xB793, 0x8DF8, - 0xB794, 0x8DF9, 0xB795, 0x8DFA, 0xB796, 0xB6FD, 0xB797, 0xB6FE, - 0xB798, 0xB7A1, 0xB799, 0xB7A2, 0xB79A, 0x8DFB, 0xB79B, 0x8DFC, - 0xB79C, 0xB7A3, 0xB79D, 0x8DFD, 0xB79E, 0x8DFE, 0xB79F, 0x8E41, - 0xB7A0, 0xB7A4, 0xB7A1, 0x8E42, 0xB7A2, 0x8E43, 0xB7A3, 0x8E44, - 0xB7A4, 0x8E45, 0xB7A5, 0x8E46, 0xB7A6, 0x8E47, 0xB7A7, 0x8E48, - 0xB7A8, 0xB7A5, 0xB7A9, 0xB7A6, 0xB7AA, 0x8E49, 0xB7AB, 0xB7A7, - 0xB7AC, 0xB7A8, 0xB7AD, 0xB7A9, 0xB7AE, 0x8E4A, 0xB7AF, 0x8E4B, - 0xB7B0, 0x8E4C, 0xB7B1, 0x8E4D, 0xB7B2, 0x8E4E, 0xB7B3, 0x8E4F, - 0xB7B4, 0xB7AA, 0xB7B5, 0xB7AB, 0xB7B6, 0x8E50, 0xB7B7, 0x8E51, - 0xB7B8, 0xB7AC, 0xB7B9, 0x8E52, 0xB7BA, 0x8E53, 0xB7BB, 0x8E54, - 0xB7BC, 0x8E55, 0xB7BD, 0x8E56, 0xB7BE, 0x8E57, 0xB7BF, 0x8E58, - 0xB7C0, 0x8E59, 0xB7C1, 0x8E5A, 0xB7C2, 0x8E61, 0xB7C3, 0x8E62, - 0xB7C4, 0x8E63, 0xB7C5, 0x8E64, 0xB7C6, 0x8E65, 0xB7C7, 0xB7AD, - 0xB7C8, 0x8E66, 0xB7C9, 0xB7AE, 0xB7CA, 0x8E67, 0xB7CB, 0x8E68, - 0xB7CC, 0x8E69, 0xB7CD, 0x8E6A, 0xB7CE, 0x8E6B, 0xB7CF, 0x8E6C, - 0xB7D0, 0x8E6D, 0xB7D1, 0x8E6E, 0xB7D2, 0x8E6F, 0xB7D3, 0x8E70, - 0xB7D4, 0x8E71, 0xB7D5, 0x8E72, 0xB7D6, 0x8E73, 0xB7D7, 0x8E74, - 0xB7D8, 0x8E75, 0xB7D9, 0x8E76, 0xB7DA, 0x8E77, 0xB7DB, 0x8E78, - 0xB7DC, 0x8E79, 0xB7DD, 0x8E7A, 0xB7DE, 0x8E81, 0xB7DF, 0x8E82, - 0xB7E0, 0x8E83, 0xB7E1, 0x8E84, 0xB7E2, 0x8E85, 0xB7E3, 0x8E86, - 0xB7E4, 0x8E87, 0xB7E5, 0x8E88, 0xB7E6, 0x8E89, 0xB7E7, 0x8E8A, - 0xB7E8, 0x8E8B, 0xB7E9, 0x8E8C, 0xB7EA, 0x8E8D, 0xB7EB, 0x8E8E, - 0xB7EC, 0xB7AF, 0xB7ED, 0xB7B0, 0xB7EE, 0x8E8F, 0xB7EF, 0x8E90, - 0xB7F0, 0xB7B1, 0xB7F1, 0x8E91, 0xB7F2, 0x8E92, 0xB7F3, 0x8E93, - 0xB7F4, 0xB7B2, 0xB7F5, 0x8E94, 0xB7F6, 0x8E95, 0xB7F7, 0x8E96, - 0xB7F8, 0x8E97, 0xB7F9, 0x8E98, 0xB7FA, 0x8E99, 0xB7FB, 0x8E9A, - 0xB7FC, 0xB7B3, 0xB7FD, 0xB7B4, 0xB7FE, 0x8E9B, 0xB7FF, 0xB7B5, - 0xB800, 0xB7B6, 0xB801, 0xB7B7, 0xB802, 0x8E9C, 0xB803, 0x8E9D, - 0xB804, 0x8E9E, 0xB805, 0x8E9F, 0xB806, 0x8EA0, 0xB807, 0xB7B8, - 0xB808, 0xB7B9, 0xB809, 0xB7BA, 0xB80A, 0x8EA1, 0xB80B, 0x8EA2, - 0xB80C, 0xB7BB, 0xB80D, 0x8EA3, 0xB80E, 0x8EA4, 0xB80F, 0x8EA5, - 0xB810, 0xB7BC, 0xB811, 0x8EA6, 0xB812, 0x8EA7, 0xB813, 0x8EA8, - 0xB814, 0x8EA9, 0xB815, 0x8EAA, 0xB816, 0x8EAB, 0xB817, 0x8EAC, - 0xB818, 0xB7BD, 0xB819, 0xB7BE, 0xB81A, 0x8EAD, 0xB81B, 0xB7BF, - 0xB81C, 0x8EAE, 0xB81D, 0xB7C0, 0xB81E, 0x8EAF, 0xB81F, 0x8EB0, - 0xB820, 0x8EB1, 0xB821, 0x8EB2, 0xB822, 0x8EB3, 0xB823, 0x8EB4, - 0xB824, 0xB7C1, 0xB825, 0xB7C2, 0xB826, 0x8EB5, 0xB827, 0x8EB6, - 0xB828, 0xB7C3, 0xB829, 0x8EB7, 0xB82A, 0x8EB8, 0xB82B, 0x8EB9, - 0xB82C, 0xB7C4, 0xB82D, 0x8EBA, 0xB82E, 0x8EBB, 0xB82F, 0x8EBC, - 0xB830, 0x8EBD, 0xB831, 0x8EBE, 0xB832, 0x8EBF, 0xB833, 0x8EC0, - 0xB834, 0xB7C5, 0xB835, 0xB7C6, 0xB836, 0x8EC1, 0xB837, 0xB7C7, - 0xB838, 0xB7C8, 0xB839, 0xB7C9, 0xB83A, 0x8EC2, 0xB83B, 0x8EC3, - 0xB83C, 0x8EC4, 0xB83D, 0x8EC5, 0xB83E, 0x8EC6, 0xB83F, 0x8EC7, - 0xB840, 0xB7CA, 0xB841, 0x8EC8, 0xB842, 0x8EC9, 0xB843, 0x8ECA, - 0xB844, 0xB7CB, 0xB845, 0x8ECB, 0xB846, 0x8ECC, 0xB847, 0x8ECD, - 0xB848, 0x8ECE, 0xB849, 0x8ECF, 0xB84A, 0x8ED0, 0xB84B, 0x8ED1, - 0xB84C, 0x8ED2, 0xB84D, 0x8ED3, 0xB84E, 0x8ED4, 0xB84F, 0x8ED5, - 0xB850, 0x8ED6, 0xB851, 0xB7CC, 0xB852, 0x8ED7, 0xB853, 0xB7CD, - 0xB854, 0x8ED8, 0xB855, 0x8ED9, 0xB856, 0x8EDA, 0xB857, 0x8EDB, - 0xB858, 0x8EDC, 0xB859, 0x8EDD, 0xB85A, 0x8EDE, 0xB85B, 0x8EDF, - 0xB85C, 0xB7CE, 0xB85D, 0xB7CF, 0xB85E, 0x8EE0, 0xB85F, 0x8EE1, - 0xB860, 0xB7D0, 0xB861, 0x8EE2, 0xB862, 0x8EE3, 0xB863, 0x8EE4, - 0xB864, 0xB7D1, 0xB865, 0x8EE5, 0xB866, 0x8EE6, 0xB867, 0x8EE7, - 0xB868, 0x8EE8, 0xB869, 0x8EE9, 0xB86A, 0x8EEA, 0xB86B, 0x8EEB, - 0xB86C, 0xB7D2, 0xB86D, 0xB7D3, 0xB86E, 0x8EEC, 0xB86F, 0xB7D4, - 0xB870, 0x8EED, 0xB871, 0xB7D5, 0xB872, 0x8EEE, 0xB873, 0x8EEF, - 0xB874, 0x8EF0, 0xB875, 0x8EF1, 0xB876, 0x8EF2, 0xB877, 0x8EF3, - 0xB878, 0xB7D6, 0xB879, 0x8EF4, 0xB87A, 0x8EF5, 0xB87B, 0x8EF6, - 0xB87C, 0xB7D7, 0xB87D, 0x8EF7, 0xB87E, 0x8EF8, 0xB87F, 0x8EF9, - 0xB880, 0x8EFA, 0xB881, 0x8EFB, 0xB882, 0x8EFC, 0xB883, 0x8EFD, - 0xB884, 0x8EFE, 0xB885, 0x8F41, 0xB886, 0x8F42, 0xB887, 0x8F43, - 0xB888, 0x8F44, 0xB889, 0x8F45, 0xB88A, 0x8F46, 0xB88B, 0x8F47, - 0xB88C, 0x8F48, 0xB88D, 0xB7D8, 0xB88E, 0x8F49, 0xB88F, 0x8F4A, - 0xB890, 0x8F4B, 0xB891, 0x8F4C, 0xB892, 0x8F4D, 0xB893, 0x8F4E, - 0xB894, 0x8F4F, 0xB895, 0x8F50, 0xB896, 0x8F51, 0xB897, 0x8F52, - 0xB898, 0x8F53, 0xB899, 0x8F54, 0xB89A, 0x8F55, 0xB89B, 0x8F56, - 0xB89C, 0x8F57, 0xB89D, 0x8F58, 0xB89E, 0x8F59, 0xB89F, 0x8F5A, - 0xB8A0, 0x8F61, 0xB8A1, 0x8F62, 0xB8A2, 0x8F63, 0xB8A3, 0x8F64, - 0xB8A4, 0x8F65, 0xB8A5, 0x8F66, 0xB8A6, 0x8F67, 0xB8A7, 0x8F68, - 0xB8A8, 0xB7D9, 0xB8A9, 0x8F69, 0xB8AA, 0x8F6A, 0xB8AB, 0x8F6B, - 0xB8AC, 0x8F6C, 0xB8AD, 0x8F6D, 0xB8AE, 0x8F6E, 0xB8AF, 0x8F6F, - 0xB8B0, 0xB7DA, 0xB8B1, 0x8F70, 0xB8B2, 0x8F71, 0xB8B3, 0x8F72, - 0xB8B4, 0xB7DB, 0xB8B5, 0x8F73, 0xB8B6, 0x8F74, 0xB8B7, 0x8F75, - 0xB8B8, 0xB7DC, 0xB8B9, 0x8F76, 0xB8BA, 0x8F77, 0xB8BB, 0x8F78, - 0xB8BC, 0x8F79, 0xB8BD, 0x8F7A, 0xB8BE, 0x8F81, 0xB8BF, 0x8F82, - 0xB8C0, 0xB7DD, 0xB8C1, 0xB7DE, 0xB8C2, 0x8F83, 0xB8C3, 0xB7DF, - 0xB8C4, 0x8F84, 0xB8C5, 0xB7E0, 0xB8C6, 0x8F85, 0xB8C7, 0x8F86, - 0xB8C8, 0x8F87, 0xB8C9, 0x8F88, 0xB8CA, 0x8F89, 0xB8CB, 0x8F8A, - 0xB8CC, 0xB7E1, 0xB8CD, 0x8F8B, 0xB8CE, 0x8F8C, 0xB8CF, 0x8F8D, - 0xB8D0, 0xB7E2, 0xB8D1, 0x8F8E, 0xB8D2, 0x8F8F, 0xB8D3, 0x8F90, - 0xB8D4, 0xB7E3, 0xB8D5, 0x8F91, 0xB8D6, 0x8F92, 0xB8D7, 0x8F93, - 0xB8D8, 0x8F94, 0xB8D9, 0x8F95, 0xB8DA, 0x8F96, 0xB8DB, 0x8F97, - 0xB8DC, 0x8F98, 0xB8DD, 0xB7E4, 0xB8DE, 0x8F99, 0xB8DF, 0xB7E5, - 0xB8E0, 0x8F9A, 0xB8E1, 0xB7E6, 0xB8E2, 0x8F9B, 0xB8E3, 0x8F9C, - 0xB8E4, 0x8F9D, 0xB8E5, 0x8F9E, 0xB8E6, 0x8F9F, 0xB8E7, 0x8FA0, - 0xB8E8, 0xB7E7, 0xB8E9, 0xB7E8, 0xB8EA, 0x8FA1, 0xB8EB, 0x8FA2, - 0xB8EC, 0xB7E9, 0xB8ED, 0x8FA3, 0xB8EE, 0x8FA4, 0xB8EF, 0x8FA5, - 0xB8F0, 0xB7EA, 0xB8F1, 0x8FA6, 0xB8F2, 0x8FA7, 0xB8F3, 0x8FA8, - 0xB8F4, 0x8FA9, 0xB8F5, 0x8FAA, 0xB8F6, 0x8FAB, 0xB8F7, 0x8FAC, - 0xB8F8, 0xB7EB, 0xB8F9, 0xB7EC, 0xB8FA, 0x8FAD, 0xB8FB, 0xB7ED, - 0xB8FC, 0x8FAE, 0xB8FD, 0xB7EE, 0xB8FE, 0x8FAF, 0xB8FF, 0x8FB0, - 0xB900, 0x8FB1, 0xB901, 0x8FB2, 0xB902, 0x8FB3, 0xB903, 0x8FB4, - 0xB904, 0xB7EF, 0xB905, 0x8FB5, 0xB906, 0x8FB6, 0xB907, 0x8FB7, - 0xB908, 0x8FB8, 0xB909, 0x8FB9, 0xB90A, 0x8FBA, 0xB90B, 0x8FBB, - 0xB90C, 0x8FBC, 0xB90D, 0x8FBD, 0xB90E, 0x8FBE, 0xB90F, 0x8FBF, - 0xB910, 0x8FC0, 0xB911, 0x8FC1, 0xB912, 0x8FC2, 0xB913, 0x8FC3, - 0xB914, 0x8FC4, 0xB915, 0x8FC5, 0xB916, 0x8FC6, 0xB917, 0x8FC7, - 0xB918, 0xB7F0, 0xB919, 0x8FC8, 0xB91A, 0x8FC9, 0xB91B, 0x8FCA, - 0xB91C, 0x8FCB, 0xB91D, 0x8FCC, 0xB91E, 0x8FCD, 0xB91F, 0x8FCE, - 0xB920, 0xB7F1, 0xB921, 0x8FCF, 0xB922, 0x8FD0, 0xB923, 0x8FD1, - 0xB924, 0x8FD2, 0xB925, 0x8FD3, 0xB926, 0x8FD4, 0xB927, 0x8FD5, - 0xB928, 0x8FD6, 0xB929, 0x8FD7, 0xB92A, 0x8FD8, 0xB92B, 0x8FD9, - 0xB92C, 0x8FDA, 0xB92D, 0x8FDB, 0xB92E, 0x8FDC, 0xB92F, 0x8FDD, - 0xB930, 0x8FDE, 0xB931, 0x8FDF, 0xB932, 0x8FE0, 0xB933, 0x8FE1, - 0xB934, 0x8FE2, 0xB935, 0x8FE3, 0xB936, 0x8FE4, 0xB937, 0x8FE5, - 0xB938, 0x8FE6, 0xB939, 0x8FE7, 0xB93A, 0x8FE8, 0xB93B, 0x8FE9, - 0xB93C, 0xB7F2, 0xB93D, 0xB7F3, 0xB93E, 0x8FEA, 0xB93F, 0x8FEB, - 0xB940, 0xB7F4, 0xB941, 0x8FEC, 0xB942, 0x8FED, 0xB943, 0x8FEE, - 0xB944, 0xB7F5, 0xB945, 0x8FEF, 0xB946, 0x8FF0, 0xB947, 0x8FF1, - 0xB948, 0x8FF2, 0xB949, 0x8FF3, 0xB94A, 0x8FF4, 0xB94B, 0x8FF5, - 0xB94C, 0xB7F6, 0xB94D, 0x8FF6, 0xB94E, 0x8FF7, 0xB94F, 0xB7F7, - 0xB950, 0x8FF8, 0xB951, 0xB7F8, 0xB952, 0x8FF9, 0xB953, 0x8FFA, - 0xB954, 0x8FFB, 0xB955, 0x8FFC, 0xB956, 0x8FFD, 0xB957, 0x8FFE, - 0xB958, 0xB7F9, 0xB959, 0xB7FA, 0xB95A, 0x9041, 0xB95B, 0x9042, - 0xB95C, 0xB7FB, 0xB95D, 0x9043, 0xB95E, 0x9044, 0xB95F, 0x9045, - 0xB960, 0xB7FC, 0xB961, 0x9046, 0xB962, 0x9047, 0xB963, 0x9048, - 0xB964, 0x9049, 0xB965, 0x904A, 0xB966, 0x904B, 0xB967, 0x904C, - 0xB968, 0xB7FD, 0xB969, 0xB7FE, 0xB96A, 0x904D, 0xB96B, 0xB8A1, - 0xB96C, 0x904E, 0xB96D, 0xB8A2, 0xB96E, 0x904F, 0xB96F, 0x9050, - 0xB970, 0x9051, 0xB971, 0x9052, 0xB972, 0x9053, 0xB973, 0x9054, - 0xB974, 0xB8A3, 0xB975, 0xB8A4, 0xB976, 0x9055, 0xB977, 0x9056, - 0xB978, 0xB8A5, 0xB979, 0x9057, 0xB97A, 0x9058, 0xB97B, 0x9059, - 0xB97C, 0xB8A6, 0xB97D, 0x905A, 0xB97E, 0x9061, 0xB97F, 0x9062, - 0xB980, 0x9063, 0xB981, 0x9064, 0xB982, 0x9065, 0xB983, 0x9066, - 0xB984, 0xB8A7, 0xB985, 0xB8A8, 0xB986, 0x9067, 0xB987, 0xB8A9, - 0xB988, 0x9068, 0xB989, 0xB8AA, 0xB98A, 0xB8AB, 0xB98B, 0x9069, - 0xB98C, 0x906A, 0xB98D, 0xB8AC, 0xB98E, 0xB8AD, 0xB98F, 0x906B, - 0xB990, 0x906C, 0xB991, 0x906D, 0xB992, 0x906E, 0xB993, 0x906F, - 0xB994, 0x9070, 0xB995, 0x9071, 0xB996, 0x9072, 0xB997, 0x9073, - 0xB998, 0x9074, 0xB999, 0x9075, 0xB99A, 0x9076, 0xB99B, 0x9077, - 0xB99C, 0x9078, 0xB99D, 0x9079, 0xB99E, 0x907A, 0xB99F, 0x9081, - 0xB9A0, 0x9082, 0xB9A1, 0x9083, 0xB9A2, 0x9084, 0xB9A3, 0x9085, - 0xB9A4, 0x9086, 0xB9A5, 0x9087, 0xB9A6, 0x9088, 0xB9A7, 0x9089, - 0xB9A8, 0x908A, 0xB9A9, 0x908B, 0xB9AA, 0x908C, 0xB9AB, 0x908D, - 0xB9AC, 0xB8AE, 0xB9AD, 0xB8AF, 0xB9AE, 0x908E, 0xB9AF, 0x908F, - 0xB9B0, 0xB8B0, 0xB9B1, 0x9090, 0xB9B2, 0x9091, 0xB9B3, 0x9092, - 0xB9B4, 0xB8B1, 0xB9B5, 0x9093, 0xB9B6, 0x9094, 0xB9B7, 0x9095, - 0xB9B8, 0x9096, 0xB9B9, 0x9097, 0xB9BA, 0x9098, 0xB9BB, 0x9099, - 0xB9BC, 0xB8B2, 0xB9BD, 0xB8B3, 0xB9BE, 0x909A, 0xB9BF, 0xB8B4, - 0xB9C0, 0x909B, 0xB9C1, 0xB8B5, 0xB9C2, 0x909C, 0xB9C3, 0x909D, - 0xB9C4, 0x909E, 0xB9C5, 0x909F, 0xB9C6, 0x90A0, 0xB9C7, 0x90A1, - 0xB9C8, 0xB8B6, 0xB9C9, 0xB8B7, 0xB9CA, 0x90A2, 0xB9CB, 0x90A3, - 0xB9CC, 0xB8B8, 0xB9CD, 0x90A4, 0xB9CE, 0xB8B9, 0xB9CF, 0xB8BA, - 0xB9D0, 0xB8BB, 0xB9D1, 0xB8BC, 0xB9D2, 0xB8BD, 0xB9D3, 0x90A5, - 0xB9D4, 0x90A6, 0xB9D5, 0x90A7, 0xB9D6, 0x90A8, 0xB9D7, 0x90A9, - 0xB9D8, 0xB8BE, 0xB9D9, 0xB8BF, 0xB9DA, 0x90AA, 0xB9DB, 0xB8C0, - 0xB9DC, 0x90AB, 0xB9DD, 0xB8C1, 0xB9DE, 0xB8C2, 0xB9DF, 0x90AC, - 0xB9E0, 0x90AD, 0xB9E1, 0xB8C3, 0xB9E2, 0x90AE, 0xB9E3, 0xB8C4, - 0xB9E4, 0xB8C5, 0xB9E5, 0xB8C6, 0xB9E6, 0x90AF, 0xB9E7, 0x90B0, - 0xB9E8, 0xB8C7, 0xB9E9, 0x90B1, 0xB9EA, 0x90B2, 0xB9EB, 0x90B3, - 0xB9EC, 0xB8C8, 0xB9ED, 0x90B4, 0xB9EE, 0x90B5, 0xB9EF, 0x90B6, - 0xB9F0, 0x90B7, 0xB9F1, 0x90B8, 0xB9F2, 0x90B9, 0xB9F3, 0x90BA, - 0xB9F4, 0xB8C9, 0xB9F5, 0xB8CA, 0xB9F6, 0x90BB, 0xB9F7, 0xB8CB, - 0xB9F8, 0xB8CC, 0xB9F9, 0xB8CD, 0xB9FA, 0xB8CE, 0xB9FB, 0x90BC, - 0xB9FC, 0x90BD, 0xB9FD, 0x90BE, 0xB9FE, 0x90BF, 0xB9FF, 0x90C0, - 0xBA00, 0xB8CF, 0xBA01, 0xB8D0, 0xBA02, 0x90C1, 0xBA03, 0x90C2, - 0xBA04, 0x90C3, 0xBA05, 0x90C4, 0xBA06, 0x90C5, 0xBA07, 0x90C6, - 0xBA08, 0xB8D1, 0xBA09, 0x90C7, 0xBA0A, 0x90C8, 0xBA0B, 0x90C9, - 0xBA0C, 0x90CA, 0xBA0D, 0x90CB, 0xBA0E, 0x90CC, 0xBA0F, 0x90CD, - 0xBA10, 0x90CE, 0xBA11, 0x90CF, 0xBA12, 0x90D0, 0xBA13, 0x90D1, - 0xBA14, 0x90D2, 0xBA15, 0xB8D2, 0xBA16, 0x90D3, 0xBA17, 0x90D4, - 0xBA18, 0x90D5, 0xBA19, 0x90D6, 0xBA1A, 0x90D7, 0xBA1B, 0x90D8, - 0xBA1C, 0x90D9, 0xBA1D, 0x90DA, 0xBA1E, 0x90DB, 0xBA1F, 0x90DC, - 0xBA20, 0x90DD, 0xBA21, 0x90DE, 0xBA22, 0x90DF, 0xBA23, 0x90E0, - 0xBA24, 0x90E1, 0xBA25, 0x90E2, 0xBA26, 0x90E3, 0xBA27, 0x90E4, - 0xBA28, 0x90E5, 0xBA29, 0x90E6, 0xBA2A, 0x90E7, 0xBA2B, 0x90E8, - 0xBA2C, 0x90E9, 0xBA2D, 0x90EA, 0xBA2E, 0x90EB, 0xBA2F, 0x90EC, - 0xBA30, 0x90ED, 0xBA31, 0x90EE, 0xBA32, 0x90EF, 0xBA33, 0x90F0, - 0xBA34, 0x90F1, 0xBA35, 0x90F2, 0xBA36, 0x90F3, 0xBA37, 0x90F4, - 0xBA38, 0xB8D3, 0xBA39, 0xB8D4, 0xBA3A, 0x90F5, 0xBA3B, 0x90F6, - 0xBA3C, 0xB8D5, 0xBA3D, 0x90F7, 0xBA3E, 0x90F8, 0xBA3F, 0x90F9, - 0xBA40, 0xB8D6, 0xBA41, 0x90FA, 0xBA42, 0xB8D7, 0xBA43, 0x90FB, - 0xBA44, 0x90FC, 0xBA45, 0x90FD, 0xBA46, 0x90FE, 0xBA47, 0x9141, - 0xBA48, 0xB8D8, 0xBA49, 0xB8D9, 0xBA4A, 0x9142, 0xBA4B, 0xB8DA, - 0xBA4C, 0x9143, 0xBA4D, 0xB8DB, 0xBA4E, 0xB8DC, 0xBA4F, 0x9144, - 0xBA50, 0x9145, 0xBA51, 0x9146, 0xBA52, 0x9147, 0xBA53, 0xB8DD, - 0xBA54, 0xB8DE, 0xBA55, 0xB8DF, 0xBA56, 0x9148, 0xBA57, 0x9149, - 0xBA58, 0xB8E0, 0xBA59, 0x914A, 0xBA5A, 0x914B, 0xBA5B, 0x914C, - 0xBA5C, 0xB8E1, 0xBA5D, 0x914D, 0xBA5E, 0x914E, 0xBA5F, 0x914F, - 0xBA60, 0x9150, 0xBA61, 0x9151, 0xBA62, 0x9152, 0xBA63, 0x9153, - 0xBA64, 0xB8E2, 0xBA65, 0xB8E3, 0xBA66, 0x9154, 0xBA67, 0xB8E4, - 0xBA68, 0xB8E5, 0xBA69, 0xB8E6, 0xBA6A, 0x9155, 0xBA6B, 0x9156, - 0xBA6C, 0x9157, 0xBA6D, 0x9158, 0xBA6E, 0x9159, 0xBA6F, 0x915A, - 0xBA70, 0xB8E7, 0xBA71, 0xB8E8, 0xBA72, 0x9161, 0xBA73, 0x9162, - 0xBA74, 0xB8E9, 0xBA75, 0x9163, 0xBA76, 0x9164, 0xBA77, 0x9165, - 0xBA78, 0xB8EA, 0xBA79, 0x9166, 0xBA7A, 0x9167, 0xBA7B, 0x9168, - 0xBA7C, 0x9169, 0xBA7D, 0x916A, 0xBA7E, 0x916B, 0xBA7F, 0x916C, - 0xBA80, 0x916D, 0xBA81, 0x916E, 0xBA82, 0x916F, 0xBA83, 0xB8EB, - 0xBA84, 0xB8EC, 0xBA85, 0xB8ED, 0xBA86, 0x9170, 0xBA87, 0xB8EE, - 0xBA88, 0x9171, 0xBA89, 0x9172, 0xBA8A, 0x9173, 0xBA8B, 0x9174, - 0xBA8C, 0xB8EF, 0xBA8D, 0x9175, 0xBA8E, 0x9176, 0xBA8F, 0x9177, - 0xBA90, 0x9178, 0xBA91, 0x9179, 0xBA92, 0x917A, 0xBA93, 0x9181, - 0xBA94, 0x9182, 0xBA95, 0x9183, 0xBA96, 0x9184, 0xBA97, 0x9185, - 0xBA98, 0x9186, 0xBA99, 0x9187, 0xBA9A, 0x9188, 0xBA9B, 0x9189, - 0xBA9C, 0x918A, 0xBA9D, 0x918B, 0xBA9E, 0x918C, 0xBA9F, 0x918D, - 0xBAA0, 0x918E, 0xBAA1, 0x918F, 0xBAA2, 0x9190, 0xBAA3, 0x9191, - 0xBAA4, 0x9192, 0xBAA5, 0x9193, 0xBAA6, 0x9194, 0xBAA7, 0x9195, - 0xBAA8, 0xB8F0, 0xBAA9, 0xB8F1, 0xBAAA, 0x9196, 0xBAAB, 0xB8F2, - 0xBAAC, 0xB8F3, 0xBAAD, 0x9197, 0xBAAE, 0x9198, 0xBAAF, 0x9199, - 0xBAB0, 0xB8F4, 0xBAB1, 0x919A, 0xBAB2, 0xB8F5, 0xBAB3, 0x919B, - 0xBAB4, 0x919C, 0xBAB5, 0x919D, 0xBAB6, 0x919E, 0xBAB7, 0x919F, - 0xBAB8, 0xB8F6, 0xBAB9, 0xB8F7, 0xBABA, 0x91A0, 0xBABB, 0xB8F8, - 0xBABC, 0x91A1, 0xBABD, 0xB8F9, 0xBABE, 0x91A2, 0xBABF, 0x91A3, - 0xBAC0, 0x91A4, 0xBAC1, 0x91A5, 0xBAC2, 0x91A6, 0xBAC3, 0x91A7, - 0xBAC4, 0xB8FA, 0xBAC5, 0x91A8, 0xBAC6, 0x91A9, 0xBAC7, 0x91AA, - 0xBAC8, 0xB8FB, 0xBAC9, 0x91AB, 0xBACA, 0x91AC, 0xBACB, 0x91AD, - 0xBACC, 0x91AE, 0xBACD, 0x91AF, 0xBACE, 0x91B0, 0xBACF, 0x91B1, - 0xBAD0, 0x91B2, 0xBAD1, 0x91B3, 0xBAD2, 0x91B4, 0xBAD3, 0x91B5, - 0xBAD4, 0x91B6, 0xBAD5, 0x91B7, 0xBAD6, 0x91B8, 0xBAD7, 0x91B9, - 0xBAD8, 0xB8FC, 0xBAD9, 0xB8FD, 0xBADA, 0x91BA, 0xBADB, 0x91BB, - 0xBADC, 0x91BC, 0xBADD, 0x91BD, 0xBADE, 0x91BE, 0xBADF, 0x91BF, - 0xBAE0, 0x91C0, 0xBAE1, 0x91C1, 0xBAE2, 0x91C2, 0xBAE3, 0x91C3, - 0xBAE4, 0x91C4, 0xBAE5, 0x91C5, 0xBAE6, 0x91C6, 0xBAE7, 0x91C7, - 0xBAE8, 0x91C8, 0xBAE9, 0x91C9, 0xBAEA, 0x91CA, 0xBAEB, 0x91CB, - 0xBAEC, 0x91CC, 0xBAED, 0x91CD, 0xBAEE, 0x91CE, 0xBAEF, 0x91CF, - 0xBAF0, 0x91D0, 0xBAF1, 0x91D1, 0xBAF2, 0x91D2, 0xBAF3, 0x91D3, - 0xBAF4, 0x91D4, 0xBAF5, 0x91D5, 0xBAF6, 0x91D6, 0xBAF7, 0x91D7, - 0xBAF8, 0x91D8, 0xBAF9, 0x91D9, 0xBAFA, 0x91DA, 0xBAFB, 0x91DB, - 0xBAFC, 0xB8FE, 0xBAFD, 0x91DC, 0xBAFE, 0x91DD, 0xBAFF, 0x91DE, - 0xBB00, 0xB9A1, 0xBB01, 0x91DF, 0xBB02, 0x91E0, 0xBB03, 0x91E1, - 0xBB04, 0xB9A2, 0xBB05, 0x91E2, 0xBB06, 0x91E3, 0xBB07, 0x91E4, - 0xBB08, 0x91E5, 0xBB09, 0x91E6, 0xBB0A, 0x91E7, 0xBB0B, 0x91E8, - 0xBB0C, 0x91E9, 0xBB0D, 0xB9A3, 0xBB0E, 0x91EA, 0xBB0F, 0xB9A4, - 0xBB10, 0x91EB, 0xBB11, 0xB9A5, 0xBB12, 0x91EC, 0xBB13, 0x91ED, - 0xBB14, 0x91EE, 0xBB15, 0x91EF, 0xBB16, 0x91F0, 0xBB17, 0x91F1, - 0xBB18, 0xB9A6, 0xBB19, 0x91F2, 0xBB1A, 0x91F3, 0xBB1B, 0x91F4, - 0xBB1C, 0xB9A7, 0xBB1D, 0x91F5, 0xBB1E, 0x91F6, 0xBB1F, 0x91F7, - 0xBB20, 0xB9A8, 0xBB21, 0x91F8, 0xBB22, 0x91F9, 0xBB23, 0x91FA, - 0xBB24, 0x91FB, 0xBB25, 0x91FC, 0xBB26, 0x91FD, 0xBB27, 0x91FE, - 0xBB28, 0x9241, 0xBB29, 0xB9A9, 0xBB2A, 0x9242, 0xBB2B, 0xB9AA, - 0xBB2C, 0x9243, 0xBB2D, 0x9244, 0xBB2E, 0x9245, 0xBB2F, 0x9246, - 0xBB30, 0x9247, 0xBB31, 0x9248, 0xBB32, 0x9249, 0xBB33, 0x924A, - 0xBB34, 0xB9AB, 0xBB35, 0xB9AC, 0xBB36, 0xB9AD, 0xBB37, 0x924B, - 0xBB38, 0xB9AE, 0xBB39, 0x924C, 0xBB3A, 0x924D, 0xBB3B, 0xB9AF, - 0xBB3C, 0xB9B0, 0xBB3D, 0xB9B1, 0xBB3E, 0xB9B2, 0xBB3F, 0x924E, - 0xBB40, 0x924F, 0xBB41, 0x9250, 0xBB42, 0x9251, 0xBB43, 0x9252, - 0xBB44, 0xB9B3, 0xBB45, 0xB9B4, 0xBB46, 0x9253, 0xBB47, 0xB9B5, - 0xBB48, 0x9254, 0xBB49, 0xB9B6, 0xBB4A, 0x9255, 0xBB4B, 0x9256, - 0xBB4C, 0x9257, 0xBB4D, 0xB9B7, 0xBB4E, 0x9258, 0xBB4F, 0xB9B8, - 0xBB50, 0xB9B9, 0xBB51, 0x9259, 0xBB52, 0x925A, 0xBB53, 0x9261, - 0xBB54, 0xB9BA, 0xBB55, 0x9262, 0xBB56, 0x9263, 0xBB57, 0x9264, - 0xBB58, 0xB9BB, 0xBB59, 0x9265, 0xBB5A, 0x9266, 0xBB5B, 0x9267, - 0xBB5C, 0x9268, 0xBB5D, 0x9269, 0xBB5E, 0x926A, 0xBB5F, 0x926B, - 0xBB60, 0x926C, 0xBB61, 0xB9BC, 0xBB62, 0x926D, 0xBB63, 0xB9BD, - 0xBB64, 0x926E, 0xBB65, 0x926F, 0xBB66, 0x9270, 0xBB67, 0x9271, - 0xBB68, 0x9272, 0xBB69, 0x9273, 0xBB6A, 0x9274, 0xBB6B, 0x9275, - 0xBB6C, 0xB9BE, 0xBB6D, 0x9276, 0xBB6E, 0x9277, 0xBB6F, 0x9278, - 0xBB70, 0x9279, 0xBB71, 0x927A, 0xBB72, 0x9281, 0xBB73, 0x9282, - 0xBB74, 0x9283, 0xBB75, 0x9284, 0xBB76, 0x9285, 0xBB77, 0x9286, - 0xBB78, 0x9287, 0xBB79, 0x9288, 0xBB7A, 0x9289, 0xBB7B, 0x928A, - 0xBB7C, 0x928B, 0xBB7D, 0x928C, 0xBB7E, 0x928D, 0xBB7F, 0x928E, - 0xBB80, 0x928F, 0xBB81, 0x9290, 0xBB82, 0x9291, 0xBB83, 0x9292, - 0xBB84, 0x9293, 0xBB85, 0x9294, 0xBB86, 0x9295, 0xBB87, 0x9296, - 0xBB88, 0xB9BF, 0xBB89, 0x9297, 0xBB8A, 0x9298, 0xBB8B, 0x9299, - 0xBB8C, 0xB9C0, 0xBB8D, 0x929A, 0xBB8E, 0x929B, 0xBB8F, 0x929C, - 0xBB90, 0xB9C1, 0xBB91, 0x929D, 0xBB92, 0x929E, 0xBB93, 0x929F, - 0xBB94, 0x92A0, 0xBB95, 0x92A1, 0xBB96, 0x92A2, 0xBB97, 0x92A3, - 0xBB98, 0x92A4, 0xBB99, 0x92A5, 0xBB9A, 0x92A6, 0xBB9B, 0x92A7, - 0xBB9C, 0x92A8, 0xBB9D, 0x92A9, 0xBB9E, 0x92AA, 0xBB9F, 0x92AB, - 0xBBA0, 0x92AC, 0xBBA1, 0x92AD, 0xBBA2, 0x92AE, 0xBBA3, 0x92AF, - 0xBBA4, 0xB9C2, 0xBBA5, 0x92B0, 0xBBA6, 0x92B1, 0xBBA7, 0x92B2, - 0xBBA8, 0xB9C3, 0xBBA9, 0x92B3, 0xBBAA, 0x92B4, 0xBBAB, 0x92B5, - 0xBBAC, 0xB9C4, 0xBBAD, 0x92B6, 0xBBAE, 0x92B7, 0xBBAF, 0x92B8, - 0xBBB0, 0x92B9, 0xBBB1, 0x92BA, 0xBBB2, 0x92BB, 0xBBB3, 0x92BC, - 0xBBB4, 0xB9C5, 0xBBB5, 0x92BD, 0xBBB6, 0x92BE, 0xBBB7, 0xB9C6, - 0xBBB8, 0x92BF, 0xBBB9, 0x92C0, 0xBBBA, 0x92C1, 0xBBBB, 0x92C2, - 0xBBBC, 0x92C3, 0xBBBD, 0x92C4, 0xBBBE, 0x92C5, 0xBBBF, 0x92C6, - 0xBBC0, 0xB9C7, 0xBBC1, 0x92C7, 0xBBC2, 0x92C8, 0xBBC3, 0x92C9, - 0xBBC4, 0xB9C8, 0xBBC5, 0x92CA, 0xBBC6, 0x92CB, 0xBBC7, 0x92CC, - 0xBBC8, 0xB9C9, 0xBBC9, 0x92CD, 0xBBCA, 0x92CE, 0xBBCB, 0x92CF, - 0xBBCC, 0x92D0, 0xBBCD, 0x92D1, 0xBBCE, 0x92D2, 0xBBCF, 0x92D3, - 0xBBD0, 0xB9CA, 0xBBD1, 0x92D4, 0xBBD2, 0x92D5, 0xBBD3, 0xB9CB, - 0xBBD4, 0x92D6, 0xBBD5, 0x92D7, 0xBBD6, 0x92D8, 0xBBD7, 0x92D9, - 0xBBD8, 0x92DA, 0xBBD9, 0x92DB, 0xBBDA, 0x92DC, 0xBBDB, 0x92DD, - 0xBBDC, 0x92DE, 0xBBDD, 0x92DF, 0xBBDE, 0x92E0, 0xBBDF, 0x92E1, - 0xBBE0, 0x92E2, 0xBBE1, 0x92E3, 0xBBE2, 0x92E4, 0xBBE3, 0x92E5, - 0xBBE4, 0x92E6, 0xBBE5, 0x92E7, 0xBBE6, 0x92E8, 0xBBE7, 0x92E9, - 0xBBE8, 0x92EA, 0xBBE9, 0x92EB, 0xBBEA, 0x92EC, 0xBBEB, 0x92ED, - 0xBBEC, 0x92EE, 0xBBED, 0x92EF, 0xBBEE, 0x92F0, 0xBBEF, 0x92F1, - 0xBBF0, 0x92F2, 0xBBF1, 0x92F3, 0xBBF2, 0x92F4, 0xBBF3, 0x92F5, - 0xBBF4, 0x92F6, 0xBBF5, 0x92F7, 0xBBF6, 0x92F8, 0xBBF7, 0x92F9, - 0xBBF8, 0xB9CC, 0xBBF9, 0xB9CD, 0xBBFA, 0x92FA, 0xBBFB, 0x92FB, - 0xBBFC, 0xB9CE, 0xBBFD, 0x92FC, 0xBBFE, 0x92FD, 0xBBFF, 0xB9CF, - 0xBC00, 0xB9D0, 0xBC01, 0x92FE, 0xBC02, 0xB9D1, 0xBC03, 0x9341, - 0xBC04, 0x9342, 0xBC05, 0x9343, 0xBC06, 0x9344, 0xBC07, 0x9345, - 0xBC08, 0xB9D2, 0xBC09, 0xB9D3, 0xBC0A, 0x9346, 0xBC0B, 0xB9D4, - 0xBC0C, 0xB9D5, 0xBC0D, 0xB9D6, 0xBC0E, 0x9347, 0xBC0F, 0xB9D7, - 0xBC10, 0x9348, 0xBC11, 0xB9D8, 0xBC12, 0x9349, 0xBC13, 0x934A, - 0xBC14, 0xB9D9, 0xBC15, 0xB9DA, 0xBC16, 0xB9DB, 0xBC17, 0xB9DC, - 0xBC18, 0xB9DD, 0xBC19, 0x934B, 0xBC1A, 0x934C, 0xBC1B, 0xB9DE, - 0xBC1C, 0xB9DF, 0xBC1D, 0xB9E0, 0xBC1E, 0xB9E1, 0xBC1F, 0xB9E2, - 0xBC20, 0x934D, 0xBC21, 0x934E, 0xBC22, 0x934F, 0xBC23, 0x9350, - 0xBC24, 0xB9E3, 0xBC25, 0xB9E4, 0xBC26, 0x9351, 0xBC27, 0xB9E5, - 0xBC28, 0x9352, 0xBC29, 0xB9E6, 0xBC2A, 0x9353, 0xBC2B, 0x9354, - 0xBC2C, 0x9355, 0xBC2D, 0xB9E7, 0xBC2E, 0x9356, 0xBC2F, 0x9357, - 0xBC30, 0xB9E8, 0xBC31, 0xB9E9, 0xBC32, 0x9358, 0xBC33, 0x9359, - 0xBC34, 0xB9EA, 0xBC35, 0x935A, 0xBC36, 0x9361, 0xBC37, 0x9362, - 0xBC38, 0xB9EB, 0xBC39, 0x9363, 0xBC3A, 0x9364, 0xBC3B, 0x9365, - 0xBC3C, 0x9366, 0xBC3D, 0x9367, 0xBC3E, 0x9368, 0xBC3F, 0x9369, - 0xBC40, 0xB9EC, 0xBC41, 0xB9ED, 0xBC42, 0x936A, 0xBC43, 0xB9EE, - 0xBC44, 0xB9EF, 0xBC45, 0xB9F0, 0xBC46, 0x936B, 0xBC47, 0x936C, - 0xBC48, 0x936D, 0xBC49, 0xB9F1, 0xBC4A, 0x936E, 0xBC4B, 0x936F, - 0xBC4C, 0xB9F2, 0xBC4D, 0xB9F3, 0xBC4E, 0x9370, 0xBC4F, 0x9371, - 0xBC50, 0xB9F4, 0xBC51, 0x9372, 0xBC52, 0x9373, 0xBC53, 0x9374, - 0xBC54, 0x9375, 0xBC55, 0x9376, 0xBC56, 0x9377, 0xBC57, 0x9378, - 0xBC58, 0x9379, 0xBC59, 0x937A, 0xBC5A, 0x9381, 0xBC5B, 0x9382, - 0xBC5C, 0x9383, 0xBC5D, 0xB9F5, 0xBC5E, 0x9384, 0xBC5F, 0x9385, - 0xBC60, 0x9386, 0xBC61, 0x9387, 0xBC62, 0x9388, 0xBC63, 0x9389, - 0xBC64, 0x938A, 0xBC65, 0x938B, 0xBC66, 0x938C, 0xBC67, 0x938D, - 0xBC68, 0x938E, 0xBC69, 0x938F, 0xBC6A, 0x9390, 0xBC6B, 0x9391, - 0xBC6C, 0x9392, 0xBC6D, 0x9393, 0xBC6E, 0x9394, 0xBC6F, 0x9395, - 0xBC70, 0x9396, 0xBC71, 0x9397, 0xBC72, 0x9398, 0xBC73, 0x9399, - 0xBC74, 0x939A, 0xBC75, 0x939B, 0xBC76, 0x939C, 0xBC77, 0x939D, - 0xBC78, 0x939E, 0xBC79, 0x939F, 0xBC7A, 0x93A0, 0xBC7B, 0x93A1, - 0xBC7C, 0x93A2, 0xBC7D, 0x93A3, 0xBC7E, 0x93A4, 0xBC7F, 0x93A5, - 0xBC80, 0x93A6, 0xBC81, 0x93A7, 0xBC82, 0x93A8, 0xBC83, 0x93A9, - 0xBC84, 0xB9F6, 0xBC85, 0xB9F7, 0xBC86, 0x93AA, 0xBC87, 0x93AB, - 0xBC88, 0xB9F8, 0xBC89, 0x93AC, 0xBC8A, 0x93AD, 0xBC8B, 0xB9F9, - 0xBC8C, 0xB9FA, 0xBC8D, 0x93AE, 0xBC8E, 0xB9FB, 0xBC8F, 0x93AF, - 0xBC90, 0x93B0, 0xBC91, 0x93B1, 0xBC92, 0x93B2, 0xBC93, 0x93B3, - 0xBC94, 0xB9FC, 0xBC95, 0xB9FD, 0xBC96, 0x93B4, 0xBC97, 0xB9FE, - 0xBC98, 0x93B5, 0xBC99, 0xBAA1, 0xBC9A, 0xBAA2, 0xBC9B, 0x93B6, - 0xBC9C, 0x93B7, 0xBC9D, 0x93B8, 0xBC9E, 0x93B9, 0xBC9F, 0x93BA, - 0xBCA0, 0xBAA3, 0xBCA1, 0xBAA4, 0xBCA2, 0x93BB, 0xBCA3, 0x93BC, - 0xBCA4, 0xBAA5, 0xBCA5, 0x93BD, 0xBCA6, 0x93BE, 0xBCA7, 0xBAA6, - 0xBCA8, 0xBAA7, 0xBCA9, 0x93BF, 0xBCAA, 0x93C0, 0xBCAB, 0x93C1, - 0xBCAC, 0x93C2, 0xBCAD, 0x93C3, 0xBCAE, 0x93C4, 0xBCAF, 0x93C5, - 0xBCB0, 0xBAA8, 0xBCB1, 0xBAA9, 0xBCB2, 0x93C6, 0xBCB3, 0xBAAA, - 0xBCB4, 0xBAAB, 0xBCB5, 0xBAAC, 0xBCB6, 0x93C7, 0xBCB7, 0x93C8, - 0xBCB8, 0x93C9, 0xBCB9, 0x93CA, 0xBCBA, 0x93CB, 0xBCBB, 0x93CC, - 0xBCBC, 0xBAAD, 0xBCBD, 0xBAAE, 0xBCBE, 0x93CD, 0xBCBF, 0x93CE, - 0xBCC0, 0xBAAF, 0xBCC1, 0x93CF, 0xBCC2, 0x93D0, 0xBCC3, 0x93D1, - 0xBCC4, 0xBAB0, 0xBCC5, 0x93D2, 0xBCC6, 0x93D3, 0xBCC7, 0x93D4, - 0xBCC8, 0x93D5, 0xBCC9, 0x93D6, 0xBCCA, 0x93D7, 0xBCCB, 0x93D8, - 0xBCCC, 0x93D9, 0xBCCD, 0xBAB1, 0xBCCE, 0x93DA, 0xBCCF, 0xBAB2, - 0xBCD0, 0xBAB3, 0xBCD1, 0xBAB4, 0xBCD2, 0x93DB, 0xBCD3, 0x93DC, - 0xBCD4, 0x93DD, 0xBCD5, 0xBAB5, 0xBCD6, 0x93DE, 0xBCD7, 0x93DF, - 0xBCD8, 0xBAB6, 0xBCD9, 0x93E0, 0xBCDA, 0x93E1, 0xBCDB, 0x93E2, - 0xBCDC, 0xBAB7, 0xBCDD, 0x93E3, 0xBCDE, 0x93E4, 0xBCDF, 0x93E5, - 0xBCE0, 0x93E6, 0xBCE1, 0x93E7, 0xBCE2, 0x93E8, 0xBCE3, 0x93E9, - 0xBCE4, 0x93EA, 0xBCE5, 0x93EB, 0xBCE6, 0x93EC, 0xBCE7, 0x93ED, - 0xBCE8, 0x93EE, 0xBCE9, 0x93EF, 0xBCEA, 0x93F0, 0xBCEB, 0x93F1, - 0xBCEC, 0x93F2, 0xBCED, 0x93F3, 0xBCEE, 0x93F4, 0xBCEF, 0x93F5, - 0xBCF0, 0x93F6, 0xBCF1, 0x93F7, 0xBCF2, 0x93F8, 0xBCF3, 0x93F9, - 0xBCF4, 0xBAB8, 0xBCF5, 0xBAB9, 0xBCF6, 0xBABA, 0xBCF7, 0x93FA, - 0xBCF8, 0xBABB, 0xBCF9, 0x93FB, 0xBCFA, 0x93FC, 0xBCFB, 0x93FD, - 0xBCFC, 0xBABC, 0xBCFD, 0x93FE, 0xBCFE, 0x9441, 0xBCFF, 0x9442, - 0xBD00, 0x9443, 0xBD01, 0x9444, 0xBD02, 0x9445, 0xBD03, 0x9446, - 0xBD04, 0xBABD, 0xBD05, 0xBABE, 0xBD06, 0x9447, 0xBD07, 0xBABF, - 0xBD08, 0x9448, 0xBD09, 0xBAC0, 0xBD0A, 0x9449, 0xBD0B, 0x944A, - 0xBD0C, 0x944B, 0xBD0D, 0x944C, 0xBD0E, 0x944D, 0xBD0F, 0x944E, - 0xBD10, 0xBAC1, 0xBD11, 0x944F, 0xBD12, 0x9450, 0xBD13, 0x9451, - 0xBD14, 0xBAC2, 0xBD15, 0x9452, 0xBD16, 0x9453, 0xBD17, 0x9454, - 0xBD18, 0x9455, 0xBD19, 0x9456, 0xBD1A, 0x9457, 0xBD1B, 0x9458, - 0xBD1C, 0x9459, 0xBD1D, 0x945A, 0xBD1E, 0x9461, 0xBD1F, 0x9462, - 0xBD20, 0x9463, 0xBD21, 0x9464, 0xBD22, 0x9465, 0xBD23, 0x9466, - 0xBD24, 0xBAC3, 0xBD25, 0x9467, 0xBD26, 0x9468, 0xBD27, 0x9469, - 0xBD28, 0x946A, 0xBD29, 0x946B, 0xBD2A, 0x946C, 0xBD2B, 0x946D, - 0xBD2C, 0xBAC4, 0xBD2D, 0x946E, 0xBD2E, 0x946F, 0xBD2F, 0x9470, - 0xBD30, 0x9471, 0xBD31, 0x9472, 0xBD32, 0x9473, 0xBD33, 0x9474, - 0xBD34, 0x9475, 0xBD35, 0x9476, 0xBD36, 0x9477, 0xBD37, 0x9478, - 0xBD38, 0x9479, 0xBD39, 0x947A, 0xBD3A, 0x9481, 0xBD3B, 0x9482, - 0xBD3C, 0x9483, 0xBD3D, 0x9484, 0xBD3E, 0x9485, 0xBD3F, 0x9486, - 0xBD40, 0xBAC5, 0xBD41, 0x9487, 0xBD42, 0x9488, 0xBD43, 0x9489, - 0xBD44, 0x948A, 0xBD45, 0x948B, 0xBD46, 0x948C, 0xBD47, 0x948D, - 0xBD48, 0xBAC6, 0xBD49, 0xBAC7, 0xBD4A, 0x948E, 0xBD4B, 0x948F, - 0xBD4C, 0xBAC8, 0xBD4D, 0x9490, 0xBD4E, 0x9491, 0xBD4F, 0x9492, - 0xBD50, 0xBAC9, 0xBD51, 0x9493, 0xBD52, 0x9494, 0xBD53, 0x9495, - 0xBD54, 0x9496, 0xBD55, 0x9497, 0xBD56, 0x9498, 0xBD57, 0x9499, - 0xBD58, 0xBACA, 0xBD59, 0xBACB, 0xBD5A, 0x949A, 0xBD5B, 0x949B, - 0xBD5C, 0x949C, 0xBD5D, 0x949D, 0xBD5E, 0x949E, 0xBD5F, 0x949F, - 0xBD60, 0x94A0, 0xBD61, 0x94A1, 0xBD62, 0x94A2, 0xBD63, 0x94A3, - 0xBD64, 0xBACC, 0xBD65, 0x94A4, 0xBD66, 0x94A5, 0xBD67, 0x94A6, - 0xBD68, 0xBACD, 0xBD69, 0x94A7, 0xBD6A, 0x94A8, 0xBD6B, 0x94A9, - 0xBD6C, 0x94AA, 0xBD6D, 0x94AB, 0xBD6E, 0x94AC, 0xBD6F, 0x94AD, - 0xBD70, 0x94AE, 0xBD71, 0x94AF, 0xBD72, 0x94B0, 0xBD73, 0x94B1, - 0xBD74, 0x94B2, 0xBD75, 0x94B3, 0xBD76, 0x94B4, 0xBD77, 0x94B5, - 0xBD78, 0x94B6, 0xBD79, 0x94B7, 0xBD7A, 0x94B8, 0xBD7B, 0x94B9, - 0xBD7C, 0x94BA, 0xBD7D, 0x94BB, 0xBD7E, 0x94BC, 0xBD7F, 0x94BD, - 0xBD80, 0xBACE, 0xBD81, 0xBACF, 0xBD82, 0x94BE, 0xBD83, 0x94BF, - 0xBD84, 0xBAD0, 0xBD85, 0x94C0, 0xBD86, 0x94C1, 0xBD87, 0xBAD1, - 0xBD88, 0xBAD2, 0xBD89, 0xBAD3, 0xBD8A, 0xBAD4, 0xBD8B, 0x94C2, - 0xBD8C, 0x94C3, 0xBD8D, 0x94C4, 0xBD8E, 0x94C5, 0xBD8F, 0x94C6, - 0xBD90, 0xBAD5, 0xBD91, 0xBAD6, 0xBD92, 0x94C7, 0xBD93, 0xBAD7, - 0xBD94, 0x94C8, 0xBD95, 0xBAD8, 0xBD96, 0x94C9, 0xBD97, 0x94CA, - 0xBD98, 0x94CB, 0xBD99, 0xBAD9, 0xBD9A, 0xBADA, 0xBD9B, 0x94CC, - 0xBD9C, 0xBADB, 0xBD9D, 0x94CD, 0xBD9E, 0x94CE, 0xBD9F, 0x94CF, - 0xBDA0, 0x94D0, 0xBDA1, 0x94D1, 0xBDA2, 0x94D2, 0xBDA3, 0x94D3, - 0xBDA4, 0xBADC, 0xBDA5, 0x94D4, 0xBDA6, 0x94D5, 0xBDA7, 0x94D6, - 0xBDA8, 0x94D7, 0xBDA9, 0x94D8, 0xBDAA, 0x94D9, 0xBDAB, 0x94DA, - 0xBDAC, 0x94DB, 0xBDAD, 0x94DC, 0xBDAE, 0x94DD, 0xBDAF, 0x94DE, - 0xBDB0, 0xBADD, 0xBDB1, 0x94DF, 0xBDB2, 0x94E0, 0xBDB3, 0x94E1, - 0xBDB4, 0x94E2, 0xBDB5, 0x94E3, 0xBDB6, 0x94E4, 0xBDB7, 0x94E5, - 0xBDB8, 0xBADE, 0xBDB9, 0x94E6, 0xBDBA, 0x94E7, 0xBDBB, 0x94E8, - 0xBDBC, 0x94E9, 0xBDBD, 0x94EA, 0xBDBE, 0x94EB, 0xBDBF, 0x94EC, - 0xBDC0, 0x94ED, 0xBDC1, 0x94EE, 0xBDC2, 0x94EF, 0xBDC3, 0x94F0, - 0xBDC4, 0x94F1, 0xBDC5, 0x94F2, 0xBDC6, 0x94F3, 0xBDC7, 0x94F4, - 0xBDC8, 0x94F5, 0xBDC9, 0x94F6, 0xBDCA, 0x94F7, 0xBDCB, 0x94F8, - 0xBDCC, 0x94F9, 0xBDCD, 0x94FA, 0xBDCE, 0x94FB, 0xBDCF, 0x94FC, - 0xBDD0, 0x94FD, 0xBDD1, 0x94FE, 0xBDD2, 0x9541, 0xBDD3, 0x9542, - 0xBDD4, 0xBADF, 0xBDD5, 0xBAE0, 0xBDD6, 0x9543, 0xBDD7, 0x9544, - 0xBDD8, 0xBAE1, 0xBDD9, 0x9545, 0xBDDA, 0x9546, 0xBDDB, 0x9547, - 0xBDDC, 0xBAE2, 0xBDDD, 0x9548, 0xBDDE, 0x9549, 0xBDDF, 0x954A, - 0xBDE0, 0x954B, 0xBDE1, 0x954C, 0xBDE2, 0x954D, 0xBDE3, 0x954E, - 0xBDE4, 0x954F, 0xBDE5, 0x9550, 0xBDE6, 0x9551, 0xBDE7, 0x9552, - 0xBDE8, 0x9553, 0xBDE9, 0xBAE3, 0xBDEA, 0x9554, 0xBDEB, 0x9555, - 0xBDEC, 0x9556, 0xBDED, 0x9557, 0xBDEE, 0x9558, 0xBDEF, 0x9559, - 0xBDF0, 0xBAE4, 0xBDF1, 0x955A, 0xBDF2, 0x9561, 0xBDF3, 0x9562, - 0xBDF4, 0xBAE5, 0xBDF5, 0x9563, 0xBDF6, 0x9564, 0xBDF7, 0x9565, - 0xBDF8, 0xBAE6, 0xBDF9, 0x9566, 0xBDFA, 0x9567, 0xBDFB, 0x9568, - 0xBDFC, 0x9569, 0xBDFD, 0x956A, 0xBDFE, 0x956B, 0xBDFF, 0x956C, - 0xBE00, 0xBAE7, 0xBE01, 0x956D, 0xBE02, 0x956E, 0xBE03, 0xBAE8, - 0xBE04, 0x956F, 0xBE05, 0xBAE9, 0xBE06, 0x9570, 0xBE07, 0x9571, - 0xBE08, 0x9572, 0xBE09, 0x9573, 0xBE0A, 0x9574, 0xBE0B, 0x9575, - 0xBE0C, 0xBAEA, 0xBE0D, 0xBAEB, 0xBE0E, 0x9576, 0xBE0F, 0x9577, - 0xBE10, 0xBAEC, 0xBE11, 0x9578, 0xBE12, 0x9579, 0xBE13, 0x957A, - 0xBE14, 0xBAED, 0xBE15, 0x9581, 0xBE16, 0x9582, 0xBE17, 0x9583, - 0xBE18, 0x9584, 0xBE19, 0x9585, 0xBE1A, 0x9586, 0xBE1B, 0x9587, - 0xBE1C, 0xBAEE, 0xBE1D, 0xBAEF, 0xBE1E, 0x9588, 0xBE1F, 0xBAF0, - 0xBE20, 0x9589, 0xBE21, 0x958A, 0xBE22, 0x958B, 0xBE23, 0x958C, - 0xBE24, 0x958D, 0xBE25, 0x958E, 0xBE26, 0x958F, 0xBE27, 0x9590, - 0xBE28, 0x9591, 0xBE29, 0x9592, 0xBE2A, 0x9593, 0xBE2B, 0x9594, - 0xBE2C, 0x9595, 0xBE2D, 0x9596, 0xBE2E, 0x9597, 0xBE2F, 0x9598, - 0xBE30, 0x9599, 0xBE31, 0x959A, 0xBE32, 0x959B, 0xBE33, 0x959C, - 0xBE34, 0x959D, 0xBE35, 0x959E, 0xBE36, 0x959F, 0xBE37, 0x95A0, - 0xBE38, 0x95A1, 0xBE39, 0x95A2, 0xBE3A, 0x95A3, 0xBE3B, 0x95A4, - 0xBE3C, 0x95A5, 0xBE3D, 0x95A6, 0xBE3E, 0x95A7, 0xBE3F, 0x95A8, - 0xBE40, 0x95A9, 0xBE41, 0x95AA, 0xBE42, 0x95AB, 0xBE43, 0x95AC, - 0xBE44, 0xBAF1, 0xBE45, 0xBAF2, 0xBE46, 0x95AD, 0xBE47, 0x95AE, - 0xBE48, 0xBAF3, 0xBE49, 0x95AF, 0xBE4A, 0x95B0, 0xBE4B, 0x95B1, - 0xBE4C, 0xBAF4, 0xBE4D, 0x95B2, 0xBE4E, 0xBAF5, 0xBE4F, 0x95B3, - 0xBE50, 0x95B4, 0xBE51, 0x95B5, 0xBE52, 0x95B6, 0xBE53, 0x95B7, - 0xBE54, 0xBAF6, 0xBE55, 0xBAF7, 0xBE56, 0x95B8, 0xBE57, 0xBAF8, - 0xBE58, 0x95B9, 0xBE59, 0xBAF9, 0xBE5A, 0xBAFA, 0xBE5B, 0xBAFB, - 0xBE5C, 0x95BA, 0xBE5D, 0x95BB, 0xBE5E, 0x95BC, 0xBE5F, 0x95BD, - 0xBE60, 0xBAFC, 0xBE61, 0xBAFD, 0xBE62, 0x95BE, 0xBE63, 0x95BF, - 0xBE64, 0xBAFE, 0xBE65, 0x95C0, 0xBE66, 0x95C1, 0xBE67, 0x95C2, - 0xBE68, 0xBBA1, 0xBE69, 0x95C3, 0xBE6A, 0xBBA2, 0xBE6B, 0x95C4, - 0xBE6C, 0x95C5, 0xBE6D, 0x95C6, 0xBE6E, 0x95C7, 0xBE6F, 0x95C8, - 0xBE70, 0xBBA3, 0xBE71, 0xBBA4, 0xBE72, 0x95C9, 0xBE73, 0xBBA5, - 0xBE74, 0xBBA6, 0xBE75, 0xBBA7, 0xBE76, 0x95CA, 0xBE77, 0x95CB, - 0xBE78, 0x95CC, 0xBE79, 0x95CD, 0xBE7A, 0x95CE, 0xBE7B, 0xBBA8, - 0xBE7C, 0xBBA9, 0xBE7D, 0xBBAA, 0xBE7E, 0x95CF, 0xBE7F, 0x95D0, - 0xBE80, 0xBBAB, 0xBE81, 0x95D1, 0xBE82, 0x95D2, 0xBE83, 0x95D3, - 0xBE84, 0xBBAC, 0xBE85, 0x95D4, 0xBE86, 0x95D5, 0xBE87, 0x95D6, - 0xBE88, 0x95D7, 0xBE89, 0x95D8, 0xBE8A, 0x95D9, 0xBE8B, 0x95DA, - 0xBE8C, 0xBBAD, 0xBE8D, 0xBBAE, 0xBE8E, 0x95DB, 0xBE8F, 0xBBAF, - 0xBE90, 0xBBB0, 0xBE91, 0xBBB1, 0xBE92, 0x95DC, 0xBE93, 0x95DD, - 0xBE94, 0x95DE, 0xBE95, 0x95DF, 0xBE96, 0x95E0, 0xBE97, 0x95E1, - 0xBE98, 0xBBB2, 0xBE99, 0xBBB3, 0xBE9A, 0x95E2, 0xBE9B, 0x95E3, - 0xBE9C, 0x95E4, 0xBE9D, 0x95E5, 0xBE9E, 0x95E6, 0xBE9F, 0x95E7, - 0xBEA0, 0x95E8, 0xBEA1, 0x95E9, 0xBEA2, 0x95EA, 0xBEA3, 0x95EB, - 0xBEA4, 0x95EC, 0xBEA5, 0x95ED, 0xBEA6, 0x95EE, 0xBEA7, 0x95EF, - 0xBEA8, 0xBBB4, 0xBEA9, 0x95F0, 0xBEAA, 0x95F1, 0xBEAB, 0x95F2, - 0xBEAC, 0x95F3, 0xBEAD, 0x95F4, 0xBEAE, 0x95F5, 0xBEAF, 0x95F6, - 0xBEB0, 0x95F7, 0xBEB1, 0x95F8, 0xBEB2, 0x95F9, 0xBEB3, 0x95FA, - 0xBEB4, 0x95FB, 0xBEB5, 0x95FC, 0xBEB6, 0x95FD, 0xBEB7, 0x95FE, - 0xBEB8, 0x9641, 0xBEB9, 0x9642, 0xBEBA, 0x9643, 0xBEBB, 0x9644, - 0xBEBC, 0x9645, 0xBEBD, 0x9646, 0xBEBE, 0x9647, 0xBEBF, 0x9648, - 0xBEC0, 0x9649, 0xBEC1, 0x964A, 0xBEC2, 0x964B, 0xBEC3, 0x964C, - 0xBEC4, 0x964D, 0xBEC5, 0x964E, 0xBEC6, 0x964F, 0xBEC7, 0x9650, - 0xBEC8, 0x9651, 0xBEC9, 0x9652, 0xBECA, 0x9653, 0xBECB, 0x9654, - 0xBECC, 0x9655, 0xBECD, 0x9656, 0xBECE, 0x9657, 0xBECF, 0x9658, - 0xBED0, 0xBBB5, 0xBED1, 0xBBB6, 0xBED2, 0x9659, 0xBED3, 0x965A, - 0xBED4, 0xBBB7, 0xBED5, 0x9661, 0xBED6, 0x9662, 0xBED7, 0xBBB8, - 0xBED8, 0xBBB9, 0xBED9, 0x9663, 0xBEDA, 0x9664, 0xBEDB, 0x9665, - 0xBEDC, 0x9666, 0xBEDD, 0x9667, 0xBEDE, 0x9668, 0xBEDF, 0x9669, - 0xBEE0, 0xBBBA, 0xBEE1, 0x966A, 0xBEE2, 0x966B, 0xBEE3, 0xBBBB, - 0xBEE4, 0xBBBC, 0xBEE5, 0xBBBD, 0xBEE6, 0x966C, 0xBEE7, 0x966D, - 0xBEE8, 0x966E, 0xBEE9, 0x966F, 0xBEEA, 0x9670, 0xBEEB, 0x9671, - 0xBEEC, 0xBBBE, 0xBEED, 0x9672, 0xBEEE, 0x9673, 0xBEEF, 0x9674, - 0xBEF0, 0x9675, 0xBEF1, 0x9676, 0xBEF2, 0x9677, 0xBEF3, 0x9678, - 0xBEF4, 0x9679, 0xBEF5, 0x967A, 0xBEF6, 0x9681, 0xBEF7, 0x9682, - 0xBEF8, 0x9683, 0xBEF9, 0x9684, 0xBEFA, 0x9685, 0xBEFB, 0x9686, - 0xBEFC, 0x9687, 0xBEFD, 0x9688, 0xBEFE, 0x9689, 0xBEFF, 0x968A, - 0xBF00, 0x968B, 0xBF01, 0xBBBF, 0xBF02, 0x968C, 0xBF03, 0x968D, - 0xBF04, 0x968E, 0xBF05, 0x968F, 0xBF06, 0x9690, 0xBF07, 0x9691, - 0xBF08, 0xBBC0, 0xBF09, 0xBBC1, 0xBF0A, 0x9692, 0xBF0B, 0x9693, - 0xBF0C, 0x9694, 0xBF0D, 0x9695, 0xBF0E, 0x9696, 0xBF0F, 0x9697, - 0xBF10, 0x9698, 0xBF11, 0x9699, 0xBF12, 0x969A, 0xBF13, 0x969B, - 0xBF14, 0x969C, 0xBF15, 0x969D, 0xBF16, 0x969E, 0xBF17, 0x969F, - 0xBF18, 0xBBC2, 0xBF19, 0xBBC3, 0xBF1A, 0x96A0, 0xBF1B, 0xBBC4, - 0xBF1C, 0xBBC5, 0xBF1D, 0xBBC6, 0xBF1E, 0x96A1, 0xBF1F, 0x96A2, - 0xBF20, 0x96A3, 0xBF21, 0x96A4, 0xBF22, 0x96A5, 0xBF23, 0x96A6, - 0xBF24, 0x96A7, 0xBF25, 0x96A8, 0xBF26, 0x96A9, 0xBF27, 0x96AA, - 0xBF28, 0x96AB, 0xBF29, 0x96AC, 0xBF2A, 0x96AD, 0xBF2B, 0x96AE, - 0xBF2C, 0x96AF, 0xBF2D, 0x96B0, 0xBF2E, 0x96B1, 0xBF2F, 0x96B2, - 0xBF30, 0x96B3, 0xBF31, 0x96B4, 0xBF32, 0x96B5, 0xBF33, 0x96B6, - 0xBF34, 0x96B7, 0xBF35, 0x96B8, 0xBF36, 0x96B9, 0xBF37, 0x96BA, - 0xBF38, 0x96BB, 0xBF39, 0x96BC, 0xBF3A, 0x96BD, 0xBF3B, 0x96BE, - 0xBF3C, 0x96BF, 0xBF3D, 0x96C0, 0xBF3E, 0x96C1, 0xBF3F, 0x96C2, - 0xBF40, 0xBBC7, 0xBF41, 0xBBC8, 0xBF42, 0x96C3, 0xBF43, 0x96C4, - 0xBF44, 0xBBC9, 0xBF45, 0x96C5, 0xBF46, 0x96C6, 0xBF47, 0x96C7, - 0xBF48, 0xBBCA, 0xBF49, 0x96C8, 0xBF4A, 0x96C9, 0xBF4B, 0x96CA, - 0xBF4C, 0x96CB, 0xBF4D, 0x96CC, 0xBF4E, 0x96CD, 0xBF4F, 0x96CE, - 0xBF50, 0xBBCB, 0xBF51, 0xBBCC, 0xBF52, 0x96CF, 0xBF53, 0x96D0, - 0xBF54, 0x96D1, 0xBF55, 0xBBCD, 0xBF56, 0x96D2, 0xBF57, 0x96D3, - 0xBF58, 0x96D4, 0xBF59, 0x96D5, 0xBF5A, 0x96D6, 0xBF5B, 0x96D7, - 0xBF5C, 0x96D8, 0xBF5D, 0x96D9, 0xBF5E, 0x96DA, 0xBF5F, 0x96DB, - 0xBF60, 0x96DC, 0xBF61, 0x96DD, 0xBF62, 0x96DE, 0xBF63, 0x96DF, - 0xBF64, 0x96E0, 0xBF65, 0x96E1, 0xBF66, 0x96E2, 0xBF67, 0x96E3, - 0xBF68, 0x96E4, 0xBF69, 0x96E5, 0xBF6A, 0x96E6, 0xBF6B, 0x96E7, - 0xBF6C, 0x96E8, 0xBF6D, 0x96E9, 0xBF6E, 0x96EA, 0xBF6F, 0x96EB, - 0xBF70, 0x96EC, 0xBF71, 0x96ED, 0xBF72, 0x96EE, 0xBF73, 0x96EF, - 0xBF74, 0x96F0, 0xBF75, 0x96F1, 0xBF76, 0x96F2, 0xBF77, 0x96F3, - 0xBF78, 0x96F4, 0xBF79, 0x96F5, 0xBF7A, 0x96F6, 0xBF7B, 0x96F7, - 0xBF7C, 0x96F8, 0xBF7D, 0x96F9, 0xBF7E, 0x96FA, 0xBF7F, 0x96FB, - 0xBF80, 0x96FC, 0xBF81, 0x96FD, 0xBF82, 0x96FE, 0xBF83, 0x9741, - 0xBF84, 0x9742, 0xBF85, 0x9743, 0xBF86, 0x9744, 0xBF87, 0x9745, - 0xBF88, 0x9746, 0xBF89, 0x9747, 0xBF8A, 0x9748, 0xBF8B, 0x9749, - 0xBF8C, 0x974A, 0xBF8D, 0x974B, 0xBF8E, 0x974C, 0xBF8F, 0x974D, - 0xBF90, 0x974E, 0xBF91, 0x974F, 0xBF92, 0x9750, 0xBF93, 0x9751, - 0xBF94, 0xBBCE, 0xBF95, 0x9752, 0xBF96, 0x9753, 0xBF97, 0x9754, - 0xBF98, 0x9755, 0xBF99, 0x9756, 0xBF9A, 0x9757, 0xBF9B, 0x9758, - 0xBF9C, 0x9759, 0xBF9D, 0x975A, 0xBF9E, 0x9761, 0xBF9F, 0x9762, - 0xBFA0, 0x9763, 0xBFA1, 0x9764, 0xBFA2, 0x9765, 0xBFA3, 0x9766, - 0xBFA4, 0x9767, 0xBFA5, 0x9768, 0xBFA6, 0x9769, 0xBFA7, 0x976A, - 0xBFA8, 0x976B, 0xBFA9, 0x976C, 0xBFAA, 0x976D, 0xBFAB, 0x976E, - 0xBFAC, 0x976F, 0xBFAD, 0x9770, 0xBFAE, 0x9771, 0xBFAF, 0x9772, - 0xBFB0, 0xBBCF, 0xBFB1, 0x9773, 0xBFB2, 0x9774, 0xBFB3, 0x9775, - 0xBFB4, 0x9776, 0xBFB5, 0x9777, 0xBFB6, 0x9778, 0xBFB7, 0x9779, - 0xBFB8, 0x977A, 0xBFB9, 0x9781, 0xBFBA, 0x9782, 0xBFBB, 0x9783, - 0xBFBC, 0x9784, 0xBFBD, 0x9785, 0xBFBE, 0x9786, 0xBFBF, 0x9787, - 0xBFC0, 0x9788, 0xBFC1, 0x9789, 0xBFC2, 0x978A, 0xBFC3, 0x978B, - 0xBFC4, 0x978C, 0xBFC5, 0xBBD0, 0xBFC6, 0x978D, 0xBFC7, 0x978E, - 0xBFC8, 0x978F, 0xBFC9, 0x9790, 0xBFCA, 0x9791, 0xBFCB, 0x9792, - 0xBFCC, 0xBBD1, 0xBFCD, 0xBBD2, 0xBFCE, 0x9793, 0xBFCF, 0x9794, - 0xBFD0, 0xBBD3, 0xBFD1, 0x9795, 0xBFD2, 0x9796, 0xBFD3, 0x9797, - 0xBFD4, 0xBBD4, 0xBFD5, 0x9798, 0xBFD6, 0x9799, 0xBFD7, 0x979A, - 0xBFD8, 0x979B, 0xBFD9, 0x979C, 0xBFDA, 0x979D, 0xBFDB, 0x979E, - 0xBFDC, 0xBBD5, 0xBFDD, 0x979F, 0xBFDE, 0x97A0, 0xBFDF, 0xBBD6, - 0xBFE0, 0x97A1, 0xBFE1, 0xBBD7, 0xBFE2, 0x97A2, 0xBFE3, 0x97A3, - 0xBFE4, 0x97A4, 0xBFE5, 0x97A5, 0xBFE6, 0x97A6, 0xBFE7, 0x97A7, - 0xBFE8, 0x97A8, 0xBFE9, 0x97A9, 0xBFEA, 0x97AA, 0xBFEB, 0x97AB, - 0xBFEC, 0x97AC, 0xBFED, 0x97AD, 0xBFEE, 0x97AE, 0xBFEF, 0x97AF, - 0xBFF0, 0x97B0, 0xBFF1, 0x97B1, 0xBFF2, 0x97B2, 0xBFF3, 0x97B3, - 0xBFF4, 0x97B4, 0xBFF5, 0x97B5, 0xBFF6, 0x97B6, 0xBFF7, 0x97B7, - 0xBFF8, 0x97B8, 0xBFF9, 0x97B9, 0xBFFA, 0x97BA, 0xBFFB, 0x97BB, - 0xBFFC, 0x97BC, 0xBFFD, 0x97BD, 0xBFFE, 0x97BE, 0xBFFF, 0x97BF, - 0xC000, 0x97C0, 0xC001, 0x97C1, 0xC002, 0x97C2, 0xC003, 0x97C3, - 0xC004, 0x97C4, 0xC005, 0x97C5, 0xC006, 0x97C6, 0xC007, 0x97C7, - 0xC008, 0x97C8, 0xC009, 0x97C9, 0xC00A, 0x97CA, 0xC00B, 0x97CB, - 0xC00C, 0x97CC, 0xC00D, 0x97CD, 0xC00E, 0x97CE, 0xC00F, 0x97CF, - 0xC010, 0x97D0, 0xC011, 0x97D1, 0xC012, 0x97D2, 0xC013, 0x97D3, - 0xC014, 0x97D4, 0xC015, 0x97D5, 0xC016, 0x97D6, 0xC017, 0x97D7, - 0xC018, 0x97D8, 0xC019, 0x97D9, 0xC01A, 0x97DA, 0xC01B, 0x97DB, - 0xC01C, 0x97DC, 0xC01D, 0x97DD, 0xC01E, 0x97DE, 0xC01F, 0x97DF, - 0xC020, 0x97E0, 0xC021, 0x97E1, 0xC022, 0x97E2, 0xC023, 0x97E3, - 0xC024, 0x97E4, 0xC025, 0x97E5, 0xC026, 0x97E6, 0xC027, 0x97E7, - 0xC028, 0x97E8, 0xC029, 0x97E9, 0xC02A, 0x97EA, 0xC02B, 0x97EB, - 0xC02C, 0x97EC, 0xC02D, 0x97ED, 0xC02E, 0x97EE, 0xC02F, 0x97EF, - 0xC030, 0x97F0, 0xC031, 0x97F1, 0xC032, 0x97F2, 0xC033, 0x97F3, - 0xC034, 0x97F4, 0xC035, 0x97F5, 0xC036, 0x97F6, 0xC037, 0x97F7, - 0xC038, 0x97F8, 0xC039, 0x97F9, 0xC03A, 0x97FA, 0xC03B, 0x97FB, - 0xC03C, 0xBBD8, 0xC03D, 0x97FC, 0xC03E, 0x97FD, 0xC03F, 0x97FE, - 0xC040, 0x9841, 0xC041, 0x9842, 0xC042, 0x9843, 0xC043, 0x9844, - 0xC044, 0x9845, 0xC045, 0x9846, 0xC046, 0x9847, 0xC047, 0x9848, - 0xC048, 0x9849, 0xC049, 0x984A, 0xC04A, 0x984B, 0xC04B, 0x984C, - 0xC04C, 0x984D, 0xC04D, 0x984E, 0xC04E, 0x984F, 0xC04F, 0x9850, - 0xC050, 0x9851, 0xC051, 0xBBD9, 0xC052, 0x9852, 0xC053, 0x9853, - 0xC054, 0x9854, 0xC055, 0x9855, 0xC056, 0x9856, 0xC057, 0x9857, - 0xC058, 0xBBDA, 0xC059, 0x9858, 0xC05A, 0x9859, 0xC05B, 0x985A, - 0xC05C, 0xBBDB, 0xC05D, 0x9861, 0xC05E, 0x9862, 0xC05F, 0x9863, - 0xC060, 0xBBDC, 0xC061, 0x9864, 0xC062, 0x9865, 0xC063, 0x9866, - 0xC064, 0x9867, 0xC065, 0x9868, 0xC066, 0x9869, 0xC067, 0x986A, - 0xC068, 0xBBDD, 0xC069, 0xBBDE, 0xC06A, 0x986B, 0xC06B, 0x986C, - 0xC06C, 0x986D, 0xC06D, 0x986E, 0xC06E, 0x986F, 0xC06F, 0x9870, - 0xC070, 0x9871, 0xC071, 0x9872, 0xC072, 0x9873, 0xC073, 0x9874, - 0xC074, 0x9875, 0xC075, 0x9876, 0xC076, 0x9877, 0xC077, 0x9878, - 0xC078, 0x9879, 0xC079, 0x987A, 0xC07A, 0x9881, 0xC07B, 0x9882, - 0xC07C, 0x9883, 0xC07D, 0x9884, 0xC07E, 0x9885, 0xC07F, 0x9886, - 0xC080, 0x9887, 0xC081, 0x9888, 0xC082, 0x9889, 0xC083, 0x988A, - 0xC084, 0x988B, 0xC085, 0x988C, 0xC086, 0x988D, 0xC087, 0x988E, - 0xC088, 0x988F, 0xC089, 0x9890, 0xC08A, 0x9891, 0xC08B, 0x9892, - 0xC08C, 0x9893, 0xC08D, 0x9894, 0xC08E, 0x9895, 0xC08F, 0x9896, - 0xC090, 0xBBDF, 0xC091, 0xBBE0, 0xC092, 0x9897, 0xC093, 0x9898, - 0xC094, 0xBBE1, 0xC095, 0x9899, 0xC096, 0x989A, 0xC097, 0x989B, - 0xC098, 0xBBE2, 0xC099, 0x989C, 0xC09A, 0x989D, 0xC09B, 0x989E, - 0xC09C, 0x989F, 0xC09D, 0x98A0, 0xC09E, 0x98A1, 0xC09F, 0x98A2, - 0xC0A0, 0xBBE3, 0xC0A1, 0xBBE4, 0xC0A2, 0x98A3, 0xC0A3, 0xBBE5, - 0xC0A4, 0x98A4, 0xC0A5, 0xBBE6, 0xC0A6, 0x98A5, 0xC0A7, 0x98A6, - 0xC0A8, 0x98A7, 0xC0A9, 0x98A8, 0xC0AA, 0x98A9, 0xC0AB, 0x98AA, - 0xC0AC, 0xBBE7, 0xC0AD, 0xBBE8, 0xC0AE, 0x98AB, 0xC0AF, 0xBBE9, - 0xC0B0, 0xBBEA, 0xC0B1, 0x98AC, 0xC0B2, 0x98AD, 0xC0B3, 0xBBEB, - 0xC0B4, 0xBBEC, 0xC0B5, 0xBBED, 0xC0B6, 0xBBEE, 0xC0B7, 0x98AE, - 0xC0B8, 0x98AF, 0xC0B9, 0x98B0, 0xC0BA, 0x98B1, 0xC0BB, 0x98B2, - 0xC0BC, 0xBBEF, 0xC0BD, 0xBBF0, 0xC0BE, 0x98B3, 0xC0BF, 0xBBF1, - 0xC0C0, 0xBBF2, 0xC0C1, 0xBBF3, 0xC0C2, 0x98B4, 0xC0C3, 0x98B5, - 0xC0C4, 0x98B6, 0xC0C5, 0xBBF4, 0xC0C6, 0x98B7, 0xC0C7, 0x98B8, - 0xC0C8, 0xBBF5, 0xC0C9, 0xBBF6, 0xC0CA, 0x98B9, 0xC0CB, 0x98BA, - 0xC0CC, 0xBBF7, 0xC0CD, 0x98BB, 0xC0CE, 0x98BC, 0xC0CF, 0x98BD, - 0xC0D0, 0xBBF8, 0xC0D1, 0x98BE, 0xC0D2, 0x98BF, 0xC0D3, 0x98C0, - 0xC0D4, 0x98C1, 0xC0D5, 0x98C2, 0xC0D6, 0x98C3, 0xC0D7, 0x98C4, - 0xC0D8, 0xBBF9, 0xC0D9, 0xBBFA, 0xC0DA, 0x98C5, 0xC0DB, 0xBBFB, - 0xC0DC, 0xBBFC, 0xC0DD, 0xBBFD, 0xC0DE, 0x98C6, 0xC0DF, 0x98C7, - 0xC0E0, 0x98C8, 0xC0E1, 0x98C9, 0xC0E2, 0x98CA, 0xC0E3, 0x98CB, - 0xC0E4, 0xBBFE, 0xC0E5, 0xBCA1, 0xC0E6, 0x98CC, 0xC0E7, 0x98CD, - 0xC0E8, 0xBCA2, 0xC0E9, 0x98CE, 0xC0EA, 0x98CF, 0xC0EB, 0x98D0, - 0xC0EC, 0xBCA3, 0xC0ED, 0x98D1, 0xC0EE, 0x98D2, 0xC0EF, 0x98D3, - 0xC0F0, 0x98D4, 0xC0F1, 0x98D5, 0xC0F2, 0x98D6, 0xC0F3, 0x98D7, - 0xC0F4, 0xBCA4, 0xC0F5, 0xBCA5, 0xC0F6, 0x98D8, 0xC0F7, 0xBCA6, - 0xC0F8, 0x98D9, 0xC0F9, 0xBCA7, 0xC0FA, 0x98DA, 0xC0FB, 0x98DB, - 0xC0FC, 0x98DC, 0xC0FD, 0x98DD, 0xC0FE, 0x98DE, 0xC0FF, 0x98DF, - 0xC100, 0xBCA8, 0xC101, 0x98E0, 0xC102, 0x98E1, 0xC103, 0x98E2, - 0xC104, 0xBCA9, 0xC105, 0x98E3, 0xC106, 0x98E4, 0xC107, 0x98E5, - 0xC108, 0xBCAA, 0xC109, 0x98E6, 0xC10A, 0x98E7, 0xC10B, 0x98E8, - 0xC10C, 0x98E9, 0xC10D, 0x98EA, 0xC10E, 0x98EB, 0xC10F, 0x98EC, - 0xC110, 0xBCAB, 0xC111, 0x98ED, 0xC112, 0x98EE, 0xC113, 0x98EF, - 0xC114, 0x98F0, 0xC115, 0xBCAC, 0xC116, 0x98F1, 0xC117, 0x98F2, - 0xC118, 0x98F3, 0xC119, 0x98F4, 0xC11A, 0x98F5, 0xC11B, 0x98F6, - 0xC11C, 0xBCAD, 0xC11D, 0xBCAE, 0xC11E, 0xBCAF, 0xC11F, 0xBCB0, - 0xC120, 0xBCB1, 0xC121, 0x98F7, 0xC122, 0x98F8, 0xC123, 0xBCB2, - 0xC124, 0xBCB3, 0xC125, 0x98F9, 0xC126, 0xBCB4, 0xC127, 0xBCB5, - 0xC128, 0x98FA, 0xC129, 0x98FB, 0xC12A, 0x98FC, 0xC12B, 0x98FD, - 0xC12C, 0xBCB6, 0xC12D, 0xBCB7, 0xC12E, 0x98FE, 0xC12F, 0xBCB8, - 0xC130, 0xBCB9, 0xC131, 0xBCBA, 0xC132, 0x9941, 0xC133, 0x9942, - 0xC134, 0x9943, 0xC135, 0x9944, 0xC136, 0xBCBB, 0xC137, 0x9945, - 0xC138, 0xBCBC, 0xC139, 0xBCBD, 0xC13A, 0x9946, 0xC13B, 0x9947, - 0xC13C, 0xBCBE, 0xC13D, 0x9948, 0xC13E, 0x9949, 0xC13F, 0x994A, - 0xC140, 0xBCBF, 0xC141, 0x994B, 0xC142, 0x994C, 0xC143, 0x994D, - 0xC144, 0x994E, 0xC145, 0x994F, 0xC146, 0x9950, 0xC147, 0x9951, - 0xC148, 0xBCC0, 0xC149, 0xBCC1, 0xC14A, 0x9952, 0xC14B, 0xBCC2, - 0xC14C, 0xBCC3, 0xC14D, 0xBCC4, 0xC14E, 0x9953, 0xC14F, 0x9954, - 0xC150, 0x9955, 0xC151, 0x9956, 0xC152, 0x9957, 0xC153, 0x9958, - 0xC154, 0xBCC5, 0xC155, 0xBCC6, 0xC156, 0x9959, 0xC157, 0x995A, - 0xC158, 0xBCC7, 0xC159, 0x9961, 0xC15A, 0x9962, 0xC15B, 0x9963, - 0xC15C, 0xBCC8, 0xC15D, 0x9964, 0xC15E, 0x9965, 0xC15F, 0x9966, - 0xC160, 0x9967, 0xC161, 0x9968, 0xC162, 0x9969, 0xC163, 0x996A, - 0xC164, 0xBCC9, 0xC165, 0xBCCA, 0xC166, 0x996B, 0xC167, 0xBCCB, - 0xC168, 0xBCCC, 0xC169, 0xBCCD, 0xC16A, 0x996C, 0xC16B, 0x996D, - 0xC16C, 0x996E, 0xC16D, 0x996F, 0xC16E, 0x9970, 0xC16F, 0x9971, - 0xC170, 0xBCCE, 0xC171, 0x9972, 0xC172, 0x9973, 0xC173, 0x9974, - 0xC174, 0xBCCF, 0xC175, 0x9975, 0xC176, 0x9976, 0xC177, 0x9977, - 0xC178, 0xBCD0, 0xC179, 0x9978, 0xC17A, 0x9979, 0xC17B, 0x997A, - 0xC17C, 0x9981, 0xC17D, 0x9982, 0xC17E, 0x9983, 0xC17F, 0x9984, - 0xC180, 0x9985, 0xC181, 0x9986, 0xC182, 0x9987, 0xC183, 0x9988, - 0xC184, 0x9989, 0xC185, 0xBCD1, 0xC186, 0x998A, 0xC187, 0x998B, - 0xC188, 0x998C, 0xC189, 0x998D, 0xC18A, 0x998E, 0xC18B, 0x998F, - 0xC18C, 0xBCD2, 0xC18D, 0xBCD3, 0xC18E, 0xBCD4, 0xC18F, 0x9990, - 0xC190, 0xBCD5, 0xC191, 0x9991, 0xC192, 0x9992, 0xC193, 0x9993, - 0xC194, 0xBCD6, 0xC195, 0x9994, 0xC196, 0xBCD7, 0xC197, 0x9995, - 0xC198, 0x9996, 0xC199, 0x9997, 0xC19A, 0x9998, 0xC19B, 0x9999, - 0xC19C, 0xBCD8, 0xC19D, 0xBCD9, 0xC19E, 0x999A, 0xC19F, 0xBCDA, - 0xC1A0, 0x999B, 0xC1A1, 0xBCDB, 0xC1A2, 0x999C, 0xC1A3, 0x999D, - 0xC1A4, 0x999E, 0xC1A5, 0xBCDC, 0xC1A6, 0x999F, 0xC1A7, 0x99A0, - 0xC1A8, 0xBCDD, 0xC1A9, 0xBCDE, 0xC1AA, 0x99A1, 0xC1AB, 0x99A2, - 0xC1AC, 0xBCDF, 0xC1AD, 0x99A3, 0xC1AE, 0x99A4, 0xC1AF, 0x99A5, - 0xC1B0, 0xBCE0, 0xC1B1, 0x99A6, 0xC1B2, 0x99A7, 0xC1B3, 0x99A8, - 0xC1B4, 0x99A9, 0xC1B5, 0x99AA, 0xC1B6, 0x99AB, 0xC1B7, 0x99AC, - 0xC1B8, 0x99AD, 0xC1B9, 0x99AE, 0xC1BA, 0x99AF, 0xC1BB, 0x99B0, - 0xC1BC, 0x99B1, 0xC1BD, 0xBCE1, 0xC1BE, 0x99B2, 0xC1BF, 0x99B3, - 0xC1C0, 0x99B4, 0xC1C1, 0x99B5, 0xC1C2, 0x99B6, 0xC1C3, 0x99B7, - 0xC1C4, 0xBCE2, 0xC1C5, 0x99B8, 0xC1C6, 0x99B9, 0xC1C7, 0x99BA, - 0xC1C8, 0xBCE3, 0xC1C9, 0x99BB, 0xC1CA, 0x99BC, 0xC1CB, 0x99BD, - 0xC1CC, 0xBCE4, 0xC1CD, 0x99BE, 0xC1CE, 0x99BF, 0xC1CF, 0x99C0, - 0xC1D0, 0x99C1, 0xC1D1, 0x99C2, 0xC1D2, 0x99C3, 0xC1D3, 0x99C4, - 0xC1D4, 0xBCE5, 0xC1D5, 0x99C5, 0xC1D6, 0x99C6, 0xC1D7, 0xBCE6, - 0xC1D8, 0xBCE7, 0xC1D9, 0x99C7, 0xC1DA, 0x99C8, 0xC1DB, 0x99C9, - 0xC1DC, 0x99CA, 0xC1DD, 0x99CB, 0xC1DE, 0x99CC, 0xC1DF, 0x99CD, - 0xC1E0, 0xBCE8, 0xC1E1, 0x99CE, 0xC1E2, 0x99CF, 0xC1E3, 0x99D0, - 0xC1E4, 0xBCE9, 0xC1E5, 0x99D1, 0xC1E6, 0x99D2, 0xC1E7, 0x99D3, - 0xC1E8, 0xBCEA, 0xC1E9, 0x99D4, 0xC1EA, 0x99D5, 0xC1EB, 0x99D6, - 0xC1EC, 0x99D7, 0xC1ED, 0x99D8, 0xC1EE, 0x99D9, 0xC1EF, 0x99DA, - 0xC1F0, 0xBCEB, 0xC1F1, 0xBCEC, 0xC1F2, 0x99DB, 0xC1F3, 0xBCED, - 0xC1F4, 0x99DC, 0xC1F5, 0x99DD, 0xC1F6, 0x99DE, 0xC1F7, 0x99DF, - 0xC1F8, 0x99E0, 0xC1F9, 0x99E1, 0xC1FA, 0x99E2, 0xC1FB, 0x99E3, - 0xC1FC, 0xBCEE, 0xC1FD, 0xBCEF, 0xC1FE, 0x99E4, 0xC1FF, 0x99E5, - 0xC200, 0xBCF0, 0xC201, 0x99E6, 0xC202, 0x99E7, 0xC203, 0x99E8, - 0xC204, 0xBCF1, 0xC205, 0x99E9, 0xC206, 0x99EA, 0xC207, 0x99EB, - 0xC208, 0x99EC, 0xC209, 0x99ED, 0xC20A, 0x99EE, 0xC20B, 0x99EF, - 0xC20C, 0xBCF2, 0xC20D, 0xBCF3, 0xC20E, 0x99F0, 0xC20F, 0xBCF4, - 0xC210, 0x99F1, 0xC211, 0xBCF5, 0xC212, 0x99F2, 0xC213, 0x99F3, - 0xC214, 0x99F4, 0xC215, 0x99F5, 0xC216, 0x99F6, 0xC217, 0x99F7, - 0xC218, 0xBCF6, 0xC219, 0xBCF7, 0xC21A, 0x99F8, 0xC21B, 0x99F9, - 0xC21C, 0xBCF8, 0xC21D, 0x99FA, 0xC21E, 0x99FB, 0xC21F, 0xBCF9, - 0xC220, 0xBCFA, 0xC221, 0x99FC, 0xC222, 0x99FD, 0xC223, 0x99FE, - 0xC224, 0x9A41, 0xC225, 0x9A42, 0xC226, 0x9A43, 0xC227, 0x9A44, - 0xC228, 0xBCFB, 0xC229, 0xBCFC, 0xC22A, 0x9A45, 0xC22B, 0xBCFD, - 0xC22C, 0x9A46, 0xC22D, 0xBCFE, 0xC22E, 0x9A47, 0xC22F, 0xBDA1, - 0xC230, 0x9A48, 0xC231, 0xBDA2, 0xC232, 0xBDA3, 0xC233, 0x9A49, - 0xC234, 0xBDA4, 0xC235, 0x9A4A, 0xC236, 0x9A4B, 0xC237, 0x9A4C, - 0xC238, 0x9A4D, 0xC239, 0x9A4E, 0xC23A, 0x9A4F, 0xC23B, 0x9A50, - 0xC23C, 0x9A51, 0xC23D, 0x9A52, 0xC23E, 0x9A53, 0xC23F, 0x9A54, - 0xC240, 0x9A55, 0xC241, 0x9A56, 0xC242, 0x9A57, 0xC243, 0x9A58, - 0xC244, 0x9A59, 0xC245, 0x9A5A, 0xC246, 0x9A61, 0xC247, 0x9A62, - 0xC248, 0xBDA5, 0xC249, 0x9A63, 0xC24A, 0x9A64, 0xC24B, 0x9A65, - 0xC24C, 0x9A66, 0xC24D, 0x9A67, 0xC24E, 0x9A68, 0xC24F, 0x9A69, - 0xC250, 0xBDA6, 0xC251, 0xBDA7, 0xC252, 0x9A6A, 0xC253, 0x9A6B, - 0xC254, 0xBDA8, 0xC255, 0x9A6C, 0xC256, 0x9A6D, 0xC257, 0x9A6E, - 0xC258, 0xBDA9, 0xC259, 0x9A6F, 0xC25A, 0x9A70, 0xC25B, 0x9A71, - 0xC25C, 0x9A72, 0xC25D, 0x9A73, 0xC25E, 0x9A74, 0xC25F, 0x9A75, - 0xC260, 0xBDAA, 0xC261, 0x9A76, 0xC262, 0x9A77, 0xC263, 0x9A78, - 0xC264, 0x9A79, 0xC265, 0xBDAB, 0xC266, 0x9A7A, 0xC267, 0x9A81, - 0xC268, 0x9A82, 0xC269, 0x9A83, 0xC26A, 0x9A84, 0xC26B, 0x9A85, - 0xC26C, 0xBDAC, 0xC26D, 0xBDAD, 0xC26E, 0x9A86, 0xC26F, 0x9A87, - 0xC270, 0xBDAE, 0xC271, 0x9A88, 0xC272, 0x9A89, 0xC273, 0x9A8A, - 0xC274, 0xBDAF, 0xC275, 0x9A8B, 0xC276, 0x9A8C, 0xC277, 0x9A8D, - 0xC278, 0x9A8E, 0xC279, 0x9A8F, 0xC27A, 0x9A90, 0xC27B, 0x9A91, - 0xC27C, 0xBDB0, 0xC27D, 0xBDB1, 0xC27E, 0x9A92, 0xC27F, 0xBDB2, - 0xC280, 0x9A93, 0xC281, 0xBDB3, 0xC282, 0x9A94, 0xC283, 0x9A95, - 0xC284, 0x9A96, 0xC285, 0x9A97, 0xC286, 0x9A98, 0xC287, 0x9A99, - 0xC288, 0xBDB4, 0xC289, 0xBDB5, 0xC28A, 0x9A9A, 0xC28B, 0x9A9B, - 0xC28C, 0x9A9C, 0xC28D, 0x9A9D, 0xC28E, 0x9A9E, 0xC28F, 0x9A9F, - 0xC290, 0xBDB6, 0xC291, 0x9AA0, 0xC292, 0x9AA1, 0xC293, 0x9AA2, - 0xC294, 0x9AA3, 0xC295, 0x9AA4, 0xC296, 0x9AA5, 0xC297, 0x9AA6, - 0xC298, 0xBDB7, 0xC299, 0x9AA7, 0xC29A, 0x9AA8, 0xC29B, 0xBDB8, - 0xC29C, 0x9AA9, 0xC29D, 0xBDB9, 0xC29E, 0x9AAA, 0xC29F, 0x9AAB, - 0xC2A0, 0x9AAC, 0xC2A1, 0x9AAD, 0xC2A2, 0x9AAE, 0xC2A3, 0x9AAF, - 0xC2A4, 0xBDBA, 0xC2A5, 0xBDBB, 0xC2A6, 0x9AB0, 0xC2A7, 0x9AB1, - 0xC2A8, 0xBDBC, 0xC2A9, 0x9AB2, 0xC2AA, 0x9AB3, 0xC2AB, 0x9AB4, - 0xC2AC, 0xBDBD, 0xC2AD, 0xBDBE, 0xC2AE, 0x9AB5, 0xC2AF, 0x9AB6, - 0xC2B0, 0x9AB7, 0xC2B1, 0x9AB8, 0xC2B2, 0x9AB9, 0xC2B3, 0x9ABA, - 0xC2B4, 0xBDBF, 0xC2B5, 0xBDC0, 0xC2B6, 0x9ABB, 0xC2B7, 0xBDC1, - 0xC2B8, 0x9ABC, 0xC2B9, 0xBDC2, 0xC2BA, 0x9ABD, 0xC2BB, 0x9ABE, - 0xC2BC, 0x9ABF, 0xC2BD, 0x9AC0, 0xC2BE, 0x9AC1, 0xC2BF, 0x9AC2, - 0xC2C0, 0x9AC3, 0xC2C1, 0x9AC4, 0xC2C2, 0x9AC5, 0xC2C3, 0x9AC6, - 0xC2C4, 0x9AC7, 0xC2C5, 0x9AC8, 0xC2C6, 0x9AC9, 0xC2C7, 0x9ACA, - 0xC2C8, 0x9ACB, 0xC2C9, 0x9ACC, 0xC2CA, 0x9ACD, 0xC2CB, 0x9ACE, - 0xC2CC, 0x9ACF, 0xC2CD, 0x9AD0, 0xC2CE, 0x9AD1, 0xC2CF, 0x9AD2, - 0xC2D0, 0x9AD3, 0xC2D1, 0x9AD4, 0xC2D2, 0x9AD5, 0xC2D3, 0x9AD6, - 0xC2D4, 0x9AD7, 0xC2D5, 0x9AD8, 0xC2D6, 0x9AD9, 0xC2D7, 0x9ADA, - 0xC2D8, 0x9ADB, 0xC2D9, 0x9ADC, 0xC2DA, 0x9ADD, 0xC2DB, 0x9ADE, - 0xC2DC, 0xBDC3, 0xC2DD, 0xBDC4, 0xC2DE, 0x9ADF, 0xC2DF, 0x9AE0, - 0xC2E0, 0xBDC5, 0xC2E1, 0x9AE1, 0xC2E2, 0x9AE2, 0xC2E3, 0xBDC6, - 0xC2E4, 0xBDC7, 0xC2E5, 0x9AE3, 0xC2E6, 0x9AE4, 0xC2E7, 0x9AE5, - 0xC2E8, 0x9AE6, 0xC2E9, 0x9AE7, 0xC2EA, 0x9AE8, 0xC2EB, 0xBDC8, - 0xC2EC, 0xBDC9, 0xC2ED, 0xBDCA, 0xC2EE, 0x9AE9, 0xC2EF, 0xBDCB, - 0xC2F0, 0x9AEA, 0xC2F1, 0xBDCC, 0xC2F2, 0x9AEB, 0xC2F3, 0x9AEC, - 0xC2F4, 0x9AED, 0xC2F5, 0x9AEE, 0xC2F6, 0xBDCD, 0xC2F7, 0x9AEF, - 0xC2F8, 0xBDCE, 0xC2F9, 0xBDCF, 0xC2FA, 0x9AF0, 0xC2FB, 0xBDD0, - 0xC2FC, 0xBDD1, 0xC2FD, 0x9AF1, 0xC2FE, 0x9AF2, 0xC2FF, 0x9AF3, - 0xC300, 0xBDD2, 0xC301, 0x9AF4, 0xC302, 0x9AF5, 0xC303, 0x9AF6, - 0xC304, 0x9AF7, 0xC305, 0x9AF8, 0xC306, 0x9AF9, 0xC307, 0x9AFA, - 0xC308, 0xBDD3, 0xC309, 0xBDD4, 0xC30A, 0x9AFB, 0xC30B, 0x9AFC, - 0xC30C, 0xBDD5, 0xC30D, 0xBDD6, 0xC30E, 0x9AFD, 0xC30F, 0x9AFE, - 0xC310, 0x9B41, 0xC311, 0x9B42, 0xC312, 0x9B43, 0xC313, 0xBDD7, - 0xC314, 0xBDD8, 0xC315, 0xBDD9, 0xC316, 0x9B44, 0xC317, 0x9B45, - 0xC318, 0xBDDA, 0xC319, 0x9B46, 0xC31A, 0x9B47, 0xC31B, 0x9B48, - 0xC31C, 0xBDDB, 0xC31D, 0x9B49, 0xC31E, 0x9B4A, 0xC31F, 0x9B4B, - 0xC320, 0x9B4C, 0xC321, 0x9B4D, 0xC322, 0x9B4E, 0xC323, 0x9B4F, - 0xC324, 0xBDDC, 0xC325, 0xBDDD, 0xC326, 0x9B50, 0xC327, 0x9B51, - 0xC328, 0xBDDE, 0xC329, 0xBDDF, 0xC32A, 0x9B52, 0xC32B, 0x9B53, - 0xC32C, 0x9B54, 0xC32D, 0x9B55, 0xC32E, 0x9B56, 0xC32F, 0x9B57, - 0xC330, 0x9B58, 0xC331, 0x9B59, 0xC332, 0x9B5A, 0xC333, 0x9B61, - 0xC334, 0x9B62, 0xC335, 0x9B63, 0xC336, 0x9B64, 0xC337, 0x9B65, - 0xC338, 0x9B66, 0xC339, 0x9B67, 0xC33A, 0x9B68, 0xC33B, 0x9B69, - 0xC33C, 0x9B6A, 0xC33D, 0x9B6B, 0xC33E, 0x9B6C, 0xC33F, 0x9B6D, - 0xC340, 0x9B6E, 0xC341, 0x9B6F, 0xC342, 0x9B70, 0xC343, 0x9B71, - 0xC344, 0x9B72, 0xC345, 0xBDE0, 0xC346, 0x9B73, 0xC347, 0x9B74, - 0xC348, 0x9B75, 0xC349, 0x9B76, 0xC34A, 0x9B77, 0xC34B, 0x9B78, - 0xC34C, 0x9B79, 0xC34D, 0x9B7A, 0xC34E, 0x9B81, 0xC34F, 0x9B82, - 0xC350, 0x9B83, 0xC351, 0x9B84, 0xC352, 0x9B85, 0xC353, 0x9B86, - 0xC354, 0x9B87, 0xC355, 0x9B88, 0xC356, 0x9B89, 0xC357, 0x9B8A, - 0xC358, 0x9B8B, 0xC359, 0x9B8C, 0xC35A, 0x9B8D, 0xC35B, 0x9B8E, - 0xC35C, 0x9B8F, 0xC35D, 0x9B90, 0xC35E, 0x9B91, 0xC35F, 0x9B92, - 0xC360, 0x9B93, 0xC361, 0x9B94, 0xC362, 0x9B95, 0xC363, 0x9B96, - 0xC364, 0x9B97, 0xC365, 0x9B98, 0xC366, 0x9B99, 0xC367, 0x9B9A, - 0xC368, 0xBDE1, 0xC369, 0xBDE2, 0xC36A, 0x9B9B, 0xC36B, 0x9B9C, - 0xC36C, 0xBDE3, 0xC36D, 0x9B9D, 0xC36E, 0x9B9E, 0xC36F, 0x9B9F, - 0xC370, 0xBDE4, 0xC371, 0x9BA0, 0xC372, 0xBDE5, 0xC373, 0x9BA1, - 0xC374, 0x9BA2, 0xC375, 0x9BA3, 0xC376, 0x9BA4, 0xC377, 0x9BA5, - 0xC378, 0xBDE6, 0xC379, 0xBDE7, 0xC37A, 0x9BA6, 0xC37B, 0x9BA7, - 0xC37C, 0xBDE8, 0xC37D, 0xBDE9, 0xC37E, 0x9BA8, 0xC37F, 0x9BA9, - 0xC380, 0x9BAA, 0xC381, 0x9BAB, 0xC382, 0x9BAC, 0xC383, 0x9BAD, - 0xC384, 0xBDEA, 0xC385, 0x9BAE, 0xC386, 0x9BAF, 0xC387, 0x9BB0, - 0xC388, 0xBDEB, 0xC389, 0x9BB1, 0xC38A, 0x9BB2, 0xC38B, 0x9BB3, - 0xC38C, 0xBDEC, 0xC38D, 0x9BB4, 0xC38E, 0x9BB5, 0xC38F, 0x9BB6, - 0xC390, 0x9BB7, 0xC391, 0x9BB8, 0xC392, 0x9BB9, 0xC393, 0x9BBA, - 0xC394, 0x9BBB, 0xC395, 0x9BBC, 0xC396, 0x9BBD, 0xC397, 0x9BBE, - 0xC398, 0x9BBF, 0xC399, 0x9BC0, 0xC39A, 0x9BC1, 0xC39B, 0x9BC2, - 0xC39C, 0x9BC3, 0xC39D, 0x9BC4, 0xC39E, 0x9BC5, 0xC39F, 0x9BC6, - 0xC3A0, 0x9BC7, 0xC3A1, 0x9BC8, 0xC3A2, 0x9BC9, 0xC3A3, 0x9BCA, - 0xC3A4, 0x9BCB, 0xC3A5, 0x9BCC, 0xC3A6, 0x9BCD, 0xC3A7, 0x9BCE, - 0xC3A8, 0x9BCF, 0xC3A9, 0x9BD0, 0xC3AA, 0x9BD1, 0xC3AB, 0x9BD2, - 0xC3AC, 0x9BD3, 0xC3AD, 0x9BD4, 0xC3AE, 0x9BD5, 0xC3AF, 0x9BD6, - 0xC3B0, 0x9BD7, 0xC3B1, 0x9BD8, 0xC3B2, 0x9BD9, 0xC3B3, 0x9BDA, - 0xC3B4, 0x9BDB, 0xC3B5, 0x9BDC, 0xC3B6, 0x9BDD, 0xC3B7, 0x9BDE, - 0xC3B8, 0x9BDF, 0xC3B9, 0x9BE0, 0xC3BA, 0x9BE1, 0xC3BB, 0x9BE2, - 0xC3BC, 0x9BE3, 0xC3BD, 0x9BE4, 0xC3BE, 0x9BE5, 0xC3BF, 0x9BE6, - 0xC3C0, 0xBDED, 0xC3C1, 0x9BE7, 0xC3C2, 0x9BE8, 0xC3C3, 0x9BE9, - 0xC3C4, 0x9BEA, 0xC3C5, 0x9BEB, 0xC3C6, 0x9BEC, 0xC3C7, 0x9BED, - 0xC3C8, 0x9BEE, 0xC3C9, 0x9BEF, 0xC3CA, 0x9BF0, 0xC3CB, 0x9BF1, - 0xC3CC, 0x9BF2, 0xC3CD, 0x9BF3, 0xC3CE, 0x9BF4, 0xC3CF, 0x9BF5, - 0xC3D0, 0x9BF6, 0xC3D1, 0x9BF7, 0xC3D2, 0x9BF8, 0xC3D3, 0x9BF9, - 0xC3D4, 0x9BFA, 0xC3D5, 0x9BFB, 0xC3D6, 0x9BFC, 0xC3D7, 0x9BFD, - 0xC3D8, 0xBDEE, 0xC3D9, 0xBDEF, 0xC3DA, 0x9BFE, 0xC3DB, 0x9C41, - 0xC3DC, 0xBDF0, 0xC3DD, 0x9C42, 0xC3DE, 0x9C43, 0xC3DF, 0xBDF1, - 0xC3E0, 0xBDF2, 0xC3E1, 0x9C44, 0xC3E2, 0xBDF3, 0xC3E3, 0x9C45, - 0xC3E4, 0x9C46, 0xC3E5, 0x9C47, 0xC3E6, 0x9C48, 0xC3E7, 0x9C49, - 0xC3E8, 0xBDF4, 0xC3E9, 0xBDF5, 0xC3EA, 0x9C4A, 0xC3EB, 0x9C4B, - 0xC3EC, 0x9C4C, 0xC3ED, 0xBDF6, 0xC3EE, 0x9C4D, 0xC3EF, 0x9C4E, - 0xC3F0, 0x9C4F, 0xC3F1, 0x9C50, 0xC3F2, 0x9C51, 0xC3F3, 0x9C52, - 0xC3F4, 0xBDF7, 0xC3F5, 0xBDF8, 0xC3F6, 0x9C53, 0xC3F7, 0x9C54, - 0xC3F8, 0xBDF9, 0xC3F9, 0x9C55, 0xC3FA, 0x9C56, 0xC3FB, 0x9C57, - 0xC3FC, 0x9C58, 0xC3FD, 0x9C59, 0xC3FE, 0x9C5A, 0xC3FF, 0x9C61, - 0xC400, 0x9C62, 0xC401, 0x9C63, 0xC402, 0x9C64, 0xC403, 0x9C65, - 0xC404, 0x9C66, 0xC405, 0x9C67, 0xC406, 0x9C68, 0xC407, 0x9C69, - 0xC408, 0xBDFA, 0xC409, 0x9C6A, 0xC40A, 0x9C6B, 0xC40B, 0x9C6C, - 0xC40C, 0x9C6D, 0xC40D, 0x9C6E, 0xC40E, 0x9C6F, 0xC40F, 0x9C70, - 0xC410, 0xBDFB, 0xC411, 0x9C71, 0xC412, 0x9C72, 0xC413, 0x9C73, - 0xC414, 0x9C74, 0xC415, 0x9C75, 0xC416, 0x9C76, 0xC417, 0x9C77, - 0xC418, 0x9C78, 0xC419, 0x9C79, 0xC41A, 0x9C7A, 0xC41B, 0x9C81, - 0xC41C, 0x9C82, 0xC41D, 0x9C83, 0xC41E, 0x9C84, 0xC41F, 0x9C85, - 0xC420, 0x9C86, 0xC421, 0x9C87, 0xC422, 0x9C88, 0xC423, 0x9C89, - 0xC424, 0xBDFC, 0xC425, 0x9C8A, 0xC426, 0x9C8B, 0xC427, 0x9C8C, - 0xC428, 0x9C8D, 0xC429, 0x9C8E, 0xC42A, 0x9C8F, 0xC42B, 0x9C90, - 0xC42C, 0xBDFD, 0xC42D, 0x9C91, 0xC42E, 0x9C92, 0xC42F, 0x9C93, - 0xC430, 0xBDFE, 0xC431, 0x9C94, 0xC432, 0x9C95, 0xC433, 0x9C96, - 0xC434, 0xBEA1, 0xC435, 0x9C97, 0xC436, 0x9C98, 0xC437, 0x9C99, - 0xC438, 0x9C9A, 0xC439, 0x9C9B, 0xC43A, 0x9C9C, 0xC43B, 0x9C9D, - 0xC43C, 0xBEA2, 0xC43D, 0xBEA3, 0xC43E, 0x9C9E, 0xC43F, 0x9C9F, - 0xC440, 0x9CA0, 0xC441, 0x9CA1, 0xC442, 0x9CA2, 0xC443, 0x9CA3, - 0xC444, 0x9CA4, 0xC445, 0x9CA5, 0xC446, 0x9CA6, 0xC447, 0x9CA7, - 0xC448, 0xBEA4, 0xC449, 0x9CA8, 0xC44A, 0x9CA9, 0xC44B, 0x9CAA, - 0xC44C, 0x9CAB, 0xC44D, 0x9CAC, 0xC44E, 0x9CAD, 0xC44F, 0x9CAE, - 0xC450, 0x9CAF, 0xC451, 0x9CB0, 0xC452, 0x9CB1, 0xC453, 0x9CB2, - 0xC454, 0x9CB3, 0xC455, 0x9CB4, 0xC456, 0x9CB5, 0xC457, 0x9CB6, - 0xC458, 0x9CB7, 0xC459, 0x9CB8, 0xC45A, 0x9CB9, 0xC45B, 0x9CBA, - 0xC45C, 0x9CBB, 0xC45D, 0x9CBC, 0xC45E, 0x9CBD, 0xC45F, 0x9CBE, - 0xC460, 0x9CBF, 0xC461, 0x9CC0, 0xC462, 0x9CC1, 0xC463, 0x9CC2, - 0xC464, 0xBEA5, 0xC465, 0xBEA6, 0xC466, 0x9CC3, 0xC467, 0x9CC4, - 0xC468, 0xBEA7, 0xC469, 0x9CC5, 0xC46A, 0x9CC6, 0xC46B, 0x9CC7, - 0xC46C, 0xBEA8, 0xC46D, 0x9CC8, 0xC46E, 0x9CC9, 0xC46F, 0x9CCA, - 0xC470, 0x9CCB, 0xC471, 0x9CCC, 0xC472, 0x9CCD, 0xC473, 0x9CCE, - 0xC474, 0xBEA9, 0xC475, 0xBEAA, 0xC476, 0x9CCF, 0xC477, 0x9CD0, - 0xC478, 0x9CD1, 0xC479, 0xBEAB, 0xC47A, 0x9CD2, 0xC47B, 0x9CD3, - 0xC47C, 0x9CD4, 0xC47D, 0x9CD5, 0xC47E, 0x9CD6, 0xC47F, 0x9CD7, - 0xC480, 0xBEAC, 0xC481, 0x9CD8, 0xC482, 0x9CD9, 0xC483, 0x9CDA, - 0xC484, 0x9CDB, 0xC485, 0x9CDC, 0xC486, 0x9CDD, 0xC487, 0x9CDE, - 0xC488, 0x9CDF, 0xC489, 0x9CE0, 0xC48A, 0x9CE1, 0xC48B, 0x9CE2, - 0xC48C, 0x9CE3, 0xC48D, 0x9CE4, 0xC48E, 0x9CE5, 0xC48F, 0x9CE6, - 0xC490, 0x9CE7, 0xC491, 0x9CE8, 0xC492, 0x9CE9, 0xC493, 0x9CEA, - 0xC494, 0xBEAD, 0xC495, 0x9CEB, 0xC496, 0x9CEC, 0xC497, 0x9CED, - 0xC498, 0x9CEE, 0xC499, 0x9CEF, 0xC49A, 0x9CF0, 0xC49B, 0x9CF1, - 0xC49C, 0xBEAE, 0xC49D, 0x9CF2, 0xC49E, 0x9CF3, 0xC49F, 0x9CF4, - 0xC4A0, 0x9CF5, 0xC4A1, 0x9CF6, 0xC4A2, 0x9CF7, 0xC4A3, 0x9CF8, - 0xC4A4, 0x9CF9, 0xC4A5, 0x9CFA, 0xC4A6, 0x9CFB, 0xC4A7, 0x9CFC, - 0xC4A8, 0x9CFD, 0xC4A9, 0x9CFE, 0xC4AA, 0x9D41, 0xC4AB, 0x9D42, - 0xC4AC, 0x9D43, 0xC4AD, 0x9D44, 0xC4AE, 0x9D45, 0xC4AF, 0x9D46, - 0xC4B0, 0x9D47, 0xC4B1, 0x9D48, 0xC4B2, 0x9D49, 0xC4B3, 0x9D4A, - 0xC4B4, 0x9D4B, 0xC4B5, 0x9D4C, 0xC4B6, 0x9D4D, 0xC4B7, 0x9D4E, - 0xC4B8, 0xBEAF, 0xC4B9, 0x9D4F, 0xC4BA, 0x9D50, 0xC4BB, 0x9D51, - 0xC4BC, 0xBEB0, 0xC4BD, 0x9D52, 0xC4BE, 0x9D53, 0xC4BF, 0x9D54, - 0xC4C0, 0x9D55, 0xC4C1, 0x9D56, 0xC4C2, 0x9D57, 0xC4C3, 0x9D58, - 0xC4C4, 0x9D59, 0xC4C5, 0x9D5A, 0xC4C6, 0x9D61, 0xC4C7, 0x9D62, - 0xC4C8, 0x9D63, 0xC4C9, 0x9D64, 0xC4CA, 0x9D65, 0xC4CB, 0x9D66, - 0xC4CC, 0x9D67, 0xC4CD, 0x9D68, 0xC4CE, 0x9D69, 0xC4CF, 0x9D6A, - 0xC4D0, 0x9D6B, 0xC4D1, 0x9D6C, 0xC4D2, 0x9D6D, 0xC4D3, 0x9D6E, - 0xC4D4, 0x9D6F, 0xC4D5, 0x9D70, 0xC4D6, 0x9D71, 0xC4D7, 0x9D72, - 0xC4D8, 0x9D73, 0xC4D9, 0x9D74, 0xC4DA, 0x9D75, 0xC4DB, 0x9D76, - 0xC4DC, 0x9D77, 0xC4DD, 0x9D78, 0xC4DE, 0x9D79, 0xC4DF, 0x9D7A, - 0xC4E0, 0x9D81, 0xC4E1, 0x9D82, 0xC4E2, 0x9D83, 0xC4E3, 0x9D84, - 0xC4E4, 0x9D85, 0xC4E5, 0x9D86, 0xC4E6, 0x9D87, 0xC4E7, 0x9D88, - 0xC4E8, 0x9D89, 0xC4E9, 0xBEB1, 0xC4EA, 0x9D8A, 0xC4EB, 0x9D8B, - 0xC4EC, 0x9D8C, 0xC4ED, 0x9D8D, 0xC4EE, 0x9D8E, 0xC4EF, 0x9D8F, - 0xC4F0, 0xBEB2, 0xC4F1, 0xBEB3, 0xC4F2, 0x9D90, 0xC4F3, 0x9D91, - 0xC4F4, 0xBEB4, 0xC4F5, 0x9D92, 0xC4F6, 0x9D93, 0xC4F7, 0x9D94, - 0xC4F8, 0xBEB5, 0xC4F9, 0x9D95, 0xC4FA, 0xBEB6, 0xC4FB, 0x9D96, - 0xC4FC, 0x9D97, 0xC4FD, 0x9D98, 0xC4FE, 0x9D99, 0xC4FF, 0xBEB7, - 0xC500, 0xBEB8, 0xC501, 0xBEB9, 0xC502, 0x9D9A, 0xC503, 0x9D9B, - 0xC504, 0x9D9C, 0xC505, 0x9D9D, 0xC506, 0x9D9E, 0xC507, 0x9D9F, - 0xC508, 0x9DA0, 0xC509, 0x9DA1, 0xC50A, 0x9DA2, 0xC50B, 0x9DA3, - 0xC50C, 0xBEBA, 0xC50D, 0x9DA4, 0xC50E, 0x9DA5, 0xC50F, 0x9DA6, - 0xC510, 0xBEBB, 0xC511, 0x9DA7, 0xC512, 0x9DA8, 0xC513, 0x9DA9, - 0xC514, 0xBEBC, 0xC515, 0x9DAA, 0xC516, 0x9DAB, 0xC517, 0x9DAC, - 0xC518, 0x9DAD, 0xC519, 0x9DAE, 0xC51A, 0x9DAF, 0xC51B, 0x9DB0, - 0xC51C, 0xBEBD, 0xC51D, 0x9DB1, 0xC51E, 0x9DB2, 0xC51F, 0x9DB3, - 0xC520, 0x9DB4, 0xC521, 0x9DB5, 0xC522, 0x9DB6, 0xC523, 0x9DB7, - 0xC524, 0x9DB8, 0xC525, 0x9DB9, 0xC526, 0x9DBA, 0xC527, 0x9DBB, - 0xC528, 0xBEBE, 0xC529, 0xBEBF, 0xC52A, 0x9DBC, 0xC52B, 0x9DBD, - 0xC52C, 0xBEC0, 0xC52D, 0x9DBE, 0xC52E, 0x9DBF, 0xC52F, 0x9DC0, - 0xC530, 0xBEC1, 0xC531, 0x9DC1, 0xC532, 0x9DC2, 0xC533, 0x9DC3, - 0xC534, 0x9DC4, 0xC535, 0x9DC5, 0xC536, 0x9DC6, 0xC537, 0x9DC7, - 0xC538, 0xBEC2, 0xC539, 0xBEC3, 0xC53A, 0x9DC8, 0xC53B, 0xBEC4, - 0xC53C, 0x9DC9, 0xC53D, 0xBEC5, 0xC53E, 0x9DCA, 0xC53F, 0x9DCB, - 0xC540, 0x9DCC, 0xC541, 0x9DCD, 0xC542, 0x9DCE, 0xC543, 0x9DCF, - 0xC544, 0xBEC6, 0xC545, 0xBEC7, 0xC546, 0x9DD0, 0xC547, 0x9DD1, - 0xC548, 0xBEC8, 0xC549, 0xBEC9, 0xC54A, 0xBECA, 0xC54B, 0x9DD2, - 0xC54C, 0xBECB, 0xC54D, 0xBECC, 0xC54E, 0xBECD, 0xC54F, 0x9DD3, - 0xC550, 0x9DD4, 0xC551, 0x9DD5, 0xC552, 0x9DD6, 0xC553, 0xBECE, - 0xC554, 0xBECF, 0xC555, 0xBED0, 0xC556, 0x9DD7, 0xC557, 0xBED1, - 0xC558, 0xBED2, 0xC559, 0xBED3, 0xC55A, 0x9DD8, 0xC55B, 0x9DD9, - 0xC55C, 0x9DDA, 0xC55D, 0xBED4, 0xC55E, 0xBED5, 0xC55F, 0x9DDB, - 0xC560, 0xBED6, 0xC561, 0xBED7, 0xC562, 0x9DDC, 0xC563, 0x9DDD, - 0xC564, 0xBED8, 0xC565, 0x9DDE, 0xC566, 0x9DDF, 0xC567, 0x9DE0, - 0xC568, 0xBED9, 0xC569, 0x9DE1, 0xC56A, 0x9DE2, 0xC56B, 0x9DE3, - 0xC56C, 0x9DE4, 0xC56D, 0x9DE5, 0xC56E, 0x9DE6, 0xC56F, 0x9DE7, - 0xC570, 0xBEDA, 0xC571, 0xBEDB, 0xC572, 0x9DE8, 0xC573, 0xBEDC, - 0xC574, 0xBEDD, 0xC575, 0xBEDE, 0xC576, 0x9DE9, 0xC577, 0x9DEA, - 0xC578, 0x9DEB, 0xC579, 0x9DEC, 0xC57A, 0x9DED, 0xC57B, 0x9DEE, - 0xC57C, 0xBEDF, 0xC57D, 0xBEE0, 0xC57E, 0x9DEF, 0xC57F, 0x9DF0, - 0xC580, 0xBEE1, 0xC581, 0x9DF1, 0xC582, 0x9DF2, 0xC583, 0x9DF3, - 0xC584, 0xBEE2, 0xC585, 0x9DF4, 0xC586, 0x9DF5, 0xC587, 0xBEE3, - 0xC588, 0x9DF6, 0xC589, 0x9DF7, 0xC58A, 0x9DF8, 0xC58B, 0x9DF9, - 0xC58C, 0xBEE4, 0xC58D, 0xBEE5, 0xC58E, 0x9DFA, 0xC58F, 0xBEE6, - 0xC590, 0x9DFB, 0xC591, 0xBEE7, 0xC592, 0x9DFC, 0xC593, 0x9DFD, - 0xC594, 0x9DFE, 0xC595, 0xBEE8, 0xC596, 0x9E41, 0xC597, 0xBEE9, - 0xC598, 0xBEEA, 0xC599, 0x9E42, 0xC59A, 0x9E43, 0xC59B, 0x9E44, - 0xC59C, 0xBEEB, 0xC59D, 0x9E45, 0xC59E, 0x9E46, 0xC59F, 0x9E47, - 0xC5A0, 0xBEEC, 0xC5A1, 0x9E48, 0xC5A2, 0x9E49, 0xC5A3, 0x9E4A, - 0xC5A4, 0x9E4B, 0xC5A5, 0x9E4C, 0xC5A6, 0x9E4D, 0xC5A7, 0x9E4E, - 0xC5A8, 0x9E4F, 0xC5A9, 0xBEED, 0xC5AA, 0x9E50, 0xC5AB, 0x9E51, - 0xC5AC, 0x9E52, 0xC5AD, 0x9E53, 0xC5AE, 0x9E54, 0xC5AF, 0x9E55, - 0xC5B0, 0x9E56, 0xC5B1, 0x9E57, 0xC5B2, 0x9E58, 0xC5B3, 0x9E59, - 0xC5B4, 0xBEEE, 0xC5B5, 0xBEEF, 0xC5B6, 0x9E5A, 0xC5B7, 0x9E61, - 0xC5B8, 0xBEF0, 0xC5B9, 0xBEF1, 0xC5BA, 0x9E62, 0xC5BB, 0xBEF2, - 0xC5BC, 0xBEF3, 0xC5BD, 0xBEF4, 0xC5BE, 0xBEF5, 0xC5BF, 0x9E63, - 0xC5C0, 0x9E64, 0xC5C1, 0x9E65, 0xC5C2, 0x9E66, 0xC5C3, 0x9E67, - 0xC5C4, 0xBEF6, 0xC5C5, 0xBEF7, 0xC5C6, 0xBEF8, 0xC5C7, 0xBEF9, - 0xC5C8, 0xBEFA, 0xC5C9, 0xBEFB, 0xC5CA, 0xBEFC, 0xC5CB, 0x9E68, - 0xC5CC, 0xBEFD, 0xC5CD, 0x9E69, 0xC5CE, 0xBEFE, 0xC5CF, 0x9E6A, - 0xC5D0, 0xBFA1, 0xC5D1, 0xBFA2, 0xC5D2, 0x9E6B, 0xC5D3, 0x9E6C, - 0xC5D4, 0xBFA3, 0xC5D5, 0x9E6D, 0xC5D6, 0x9E6E, 0xC5D7, 0x9E6F, - 0xC5D8, 0xBFA4, 0xC5D9, 0x9E70, 0xC5DA, 0x9E71, 0xC5DB, 0x9E72, - 0xC5DC, 0x9E73, 0xC5DD, 0x9E74, 0xC5DE, 0x9E75, 0xC5DF, 0x9E76, - 0xC5E0, 0xBFA5, 0xC5E1, 0xBFA6, 0xC5E2, 0x9E77, 0xC5E3, 0xBFA7, - 0xC5E4, 0x9E78, 0xC5E5, 0xBFA8, 0xC5E6, 0x9E79, 0xC5E7, 0x9E7A, - 0xC5E8, 0x9E81, 0xC5E9, 0x9E82, 0xC5EA, 0x9E83, 0xC5EB, 0x9E84, - 0xC5EC, 0xBFA9, 0xC5ED, 0xBFAA, 0xC5EE, 0xBFAB, 0xC5EF, 0x9E85, - 0xC5F0, 0xBFAC, 0xC5F1, 0x9E86, 0xC5F2, 0x9E87, 0xC5F3, 0x9E88, - 0xC5F4, 0xBFAD, 0xC5F5, 0x9E89, 0xC5F6, 0xBFAE, 0xC5F7, 0xBFAF, - 0xC5F8, 0x9E8A, 0xC5F9, 0x9E8B, 0xC5FA, 0x9E8C, 0xC5FB, 0x9E8D, - 0xC5FC, 0xBFB0, 0xC5FD, 0xBFB1, 0xC5FE, 0xBFB2, 0xC5FF, 0xBFB3, - 0xC600, 0xBFB4, 0xC601, 0xBFB5, 0xC602, 0x9E8E, 0xC603, 0x9E8F, - 0xC604, 0x9E90, 0xC605, 0xBFB6, 0xC606, 0xBFB7, 0xC607, 0xBFB8, - 0xC608, 0xBFB9, 0xC609, 0x9E91, 0xC60A, 0x9E92, 0xC60B, 0x9E93, - 0xC60C, 0xBFBA, 0xC60D, 0x9E94, 0xC60E, 0x9E95, 0xC60F, 0x9E96, - 0xC610, 0xBFBB, 0xC611, 0x9E97, 0xC612, 0x9E98, 0xC613, 0x9E99, - 0xC614, 0x9E9A, 0xC615, 0x9E9B, 0xC616, 0x9E9C, 0xC617, 0x9E9D, - 0xC618, 0xBFBC, 0xC619, 0xBFBD, 0xC61A, 0x9E9E, 0xC61B, 0xBFBE, - 0xC61C, 0xBFBF, 0xC61D, 0x9E9F, 0xC61E, 0x9EA0, 0xC61F, 0x9EA1, - 0xC620, 0x9EA2, 0xC621, 0x9EA3, 0xC622, 0x9EA4, 0xC623, 0x9EA5, - 0xC624, 0xBFC0, 0xC625, 0xBFC1, 0xC626, 0x9EA6, 0xC627, 0x9EA7, - 0xC628, 0xBFC2, 0xC629, 0x9EA8, 0xC62A, 0x9EA9, 0xC62B, 0x9EAA, - 0xC62C, 0xBFC3, 0xC62D, 0xBFC4, 0xC62E, 0xBFC5, 0xC62F, 0x9EAB, - 0xC630, 0xBFC6, 0xC631, 0x9EAC, 0xC632, 0x9EAD, 0xC633, 0xBFC7, - 0xC634, 0xBFC8, 0xC635, 0xBFC9, 0xC636, 0x9EAE, 0xC637, 0xBFCA, - 0xC638, 0x9EAF, 0xC639, 0xBFCB, 0xC63A, 0x9EB0, 0xC63B, 0xBFCC, - 0xC63C, 0x9EB1, 0xC63D, 0x9EB2, 0xC63E, 0x9EB3, 0xC63F, 0x9EB4, - 0xC640, 0xBFCD, 0xC641, 0xBFCE, 0xC642, 0x9EB5, 0xC643, 0x9EB6, - 0xC644, 0xBFCF, 0xC645, 0x9EB7, 0xC646, 0x9EB8, 0xC647, 0x9EB9, - 0xC648, 0xBFD0, 0xC649, 0x9EBA, 0xC64A, 0x9EBB, 0xC64B, 0x9EBC, - 0xC64C, 0x9EBD, 0xC64D, 0x9EBE, 0xC64E, 0x9EBF, 0xC64F, 0x9EC0, - 0xC650, 0xBFD1, 0xC651, 0xBFD2, 0xC652, 0x9EC1, 0xC653, 0xBFD3, - 0xC654, 0xBFD4, 0xC655, 0xBFD5, 0xC656, 0x9EC2, 0xC657, 0x9EC3, - 0xC658, 0x9EC4, 0xC659, 0x9EC5, 0xC65A, 0x9EC6, 0xC65B, 0x9EC7, - 0xC65C, 0xBFD6, 0xC65D, 0xBFD7, 0xC65E, 0x9EC8, 0xC65F, 0x9EC9, - 0xC660, 0xBFD8, 0xC661, 0x9ECA, 0xC662, 0x9ECB, 0xC663, 0x9ECC, - 0xC664, 0x9ECD, 0xC665, 0x9ECE, 0xC666, 0x9ECF, 0xC667, 0x9ED0, - 0xC668, 0x9ED1, 0xC669, 0x9ED2, 0xC66A, 0x9ED3, 0xC66B, 0x9ED4, - 0xC66C, 0xBFD9, 0xC66D, 0x9ED5, 0xC66E, 0x9ED6, 0xC66F, 0xBFDA, - 0xC670, 0x9ED7, 0xC671, 0xBFDB, 0xC672, 0x9ED8, 0xC673, 0x9ED9, - 0xC674, 0x9EDA, 0xC675, 0x9EDB, 0xC676, 0x9EDC, 0xC677, 0x9EDD, - 0xC678, 0xBFDC, 0xC679, 0xBFDD, 0xC67A, 0x9EDE, 0xC67B, 0x9EDF, - 0xC67C, 0xBFDE, 0xC67D, 0x9EE0, 0xC67E, 0x9EE1, 0xC67F, 0x9EE2, - 0xC680, 0xBFDF, 0xC681, 0x9EE3, 0xC682, 0x9EE4, 0xC683, 0x9EE5, - 0xC684, 0x9EE6, 0xC685, 0x9EE7, 0xC686, 0x9EE8, 0xC687, 0x9EE9, - 0xC688, 0xBFE0, 0xC689, 0xBFE1, 0xC68A, 0x9EEA, 0xC68B, 0xBFE2, - 0xC68C, 0x9EEB, 0xC68D, 0xBFE3, 0xC68E, 0x9EEC, 0xC68F, 0x9EED, - 0xC690, 0x9EEE, 0xC691, 0x9EEF, 0xC692, 0x9EF0, 0xC693, 0x9EF1, - 0xC694, 0xBFE4, 0xC695, 0xBFE5, 0xC696, 0x9EF2, 0xC697, 0x9EF3, - 0xC698, 0xBFE6, 0xC699, 0x9EF4, 0xC69A, 0x9EF5, 0xC69B, 0x9EF6, - 0xC69C, 0xBFE7, 0xC69D, 0x9EF7, 0xC69E, 0x9EF8, 0xC69F, 0x9EF9, - 0xC6A0, 0x9EFA, 0xC6A1, 0x9EFB, 0xC6A2, 0x9EFC, 0xC6A3, 0x9EFD, - 0xC6A4, 0xBFE8, 0xC6A5, 0xBFE9, 0xC6A6, 0x9EFE, 0xC6A7, 0xBFEA, - 0xC6A8, 0x9F41, 0xC6A9, 0xBFEB, 0xC6AA, 0x9F42, 0xC6AB, 0x9F43, - 0xC6AC, 0x9F44, 0xC6AD, 0x9F45, 0xC6AE, 0x9F46, 0xC6AF, 0x9F47, - 0xC6B0, 0xBFEC, 0xC6B1, 0xBFED, 0xC6B2, 0x9F48, 0xC6B3, 0x9F49, - 0xC6B4, 0xBFEE, 0xC6B5, 0x9F4A, 0xC6B6, 0x9F4B, 0xC6B7, 0x9F4C, - 0xC6B8, 0xBFEF, 0xC6B9, 0xBFF0, 0xC6BA, 0xBFF1, 0xC6BB, 0x9F4D, - 0xC6BC, 0x9F4E, 0xC6BD, 0x9F4F, 0xC6BE, 0x9F50, 0xC6BF, 0x9F51, - 0xC6C0, 0xBFF2, 0xC6C1, 0xBFF3, 0xC6C2, 0x9F52, 0xC6C3, 0xBFF4, - 0xC6C4, 0x9F53, 0xC6C5, 0xBFF5, 0xC6C6, 0x9F54, 0xC6C7, 0x9F55, - 0xC6C8, 0x9F56, 0xC6C9, 0x9F57, 0xC6CA, 0x9F58, 0xC6CB, 0x9F59, - 0xC6CC, 0xBFF6, 0xC6CD, 0xBFF7, 0xC6CE, 0x9F5A, 0xC6CF, 0x9F61, - 0xC6D0, 0xBFF8, 0xC6D1, 0x9F62, 0xC6D2, 0x9F63, 0xC6D3, 0x9F64, - 0xC6D4, 0xBFF9, 0xC6D5, 0x9F65, 0xC6D6, 0x9F66, 0xC6D7, 0x9F67, - 0xC6D8, 0x9F68, 0xC6D9, 0x9F69, 0xC6DA, 0x9F6A, 0xC6DB, 0x9F6B, - 0xC6DC, 0xBFFA, 0xC6DD, 0xBFFB, 0xC6DE, 0x9F6C, 0xC6DF, 0x9F6D, - 0xC6E0, 0xBFFC, 0xC6E1, 0xBFFD, 0xC6E2, 0x9F6E, 0xC6E3, 0x9F6F, - 0xC6E4, 0x9F70, 0xC6E5, 0x9F71, 0xC6E6, 0x9F72, 0xC6E7, 0x9F73, - 0xC6E8, 0xBFFE, 0xC6E9, 0xC0A1, 0xC6EA, 0x9F74, 0xC6EB, 0x9F75, - 0xC6EC, 0xC0A2, 0xC6ED, 0x9F76, 0xC6EE, 0x9F77, 0xC6EF, 0x9F78, - 0xC6F0, 0xC0A3, 0xC6F1, 0x9F79, 0xC6F2, 0x9F7A, 0xC6F3, 0x9F81, - 0xC6F4, 0x9F82, 0xC6F5, 0x9F83, 0xC6F6, 0x9F84, 0xC6F7, 0x9F85, - 0xC6F8, 0xC0A4, 0xC6F9, 0xC0A5, 0xC6FA, 0x9F86, 0xC6FB, 0x9F87, - 0xC6FC, 0x9F88, 0xC6FD, 0xC0A6, 0xC6FE, 0x9F89, 0xC6FF, 0x9F8A, - 0xC700, 0x9F8B, 0xC701, 0x9F8C, 0xC702, 0x9F8D, 0xC703, 0x9F8E, - 0xC704, 0xC0A7, 0xC705, 0xC0A8, 0xC706, 0x9F8F, 0xC707, 0x9F90, - 0xC708, 0xC0A9, 0xC709, 0x9F91, 0xC70A, 0x9F92, 0xC70B, 0x9F93, - 0xC70C, 0xC0AA, 0xC70D, 0x9F94, 0xC70E, 0x9F95, 0xC70F, 0x9F96, - 0xC710, 0x9F97, 0xC711, 0x9F98, 0xC712, 0x9F99, 0xC713, 0x9F9A, - 0xC714, 0xC0AB, 0xC715, 0xC0AC, 0xC716, 0x9F9B, 0xC717, 0xC0AD, - 0xC718, 0x9F9C, 0xC719, 0xC0AE, 0xC71A, 0x9F9D, 0xC71B, 0x9F9E, - 0xC71C, 0x9F9F, 0xC71D, 0x9FA0, 0xC71E, 0x9FA1, 0xC71F, 0x9FA2, - 0xC720, 0xC0AF, 0xC721, 0xC0B0, 0xC722, 0x9FA3, 0xC723, 0x9FA4, - 0xC724, 0xC0B1, 0xC725, 0x9FA5, 0xC726, 0x9FA6, 0xC727, 0x9FA7, - 0xC728, 0xC0B2, 0xC729, 0x9FA8, 0xC72A, 0x9FA9, 0xC72B, 0x9FAA, - 0xC72C, 0x9FAB, 0xC72D, 0x9FAC, 0xC72E, 0x9FAD, 0xC72F, 0x9FAE, - 0xC730, 0xC0B3, 0xC731, 0xC0B4, 0xC732, 0x9FAF, 0xC733, 0xC0B5, - 0xC734, 0x9FB0, 0xC735, 0xC0B6, 0xC736, 0x9FB1, 0xC737, 0xC0B7, - 0xC738, 0x9FB2, 0xC739, 0x9FB3, 0xC73A, 0x9FB4, 0xC73B, 0x9FB5, - 0xC73C, 0xC0B8, 0xC73D, 0xC0B9, 0xC73E, 0x9FB6, 0xC73F, 0x9FB7, - 0xC740, 0xC0BA, 0xC741, 0x9FB8, 0xC742, 0x9FB9, 0xC743, 0x9FBA, - 0xC744, 0xC0BB, 0xC745, 0x9FBB, 0xC746, 0x9FBC, 0xC747, 0x9FBD, - 0xC748, 0x9FBE, 0xC749, 0x9FBF, 0xC74A, 0xC0BC, 0xC74B, 0x9FC0, - 0xC74C, 0xC0BD, 0xC74D, 0xC0BE, 0xC74E, 0x9FC1, 0xC74F, 0xC0BF, - 0xC750, 0x9FC2, 0xC751, 0xC0C0, 0xC752, 0xC0C1, 0xC753, 0xC0C2, - 0xC754, 0xC0C3, 0xC755, 0xC0C4, 0xC756, 0xC0C5, 0xC757, 0xC0C6, - 0xC758, 0xC0C7, 0xC759, 0x9FC3, 0xC75A, 0x9FC4, 0xC75B, 0x9FC5, - 0xC75C, 0xC0C8, 0xC75D, 0x9FC6, 0xC75E, 0x9FC7, 0xC75F, 0x9FC8, - 0xC760, 0xC0C9, 0xC761, 0x9FC9, 0xC762, 0x9FCA, 0xC763, 0x9FCB, - 0xC764, 0x9FCC, 0xC765, 0x9FCD, 0xC766, 0x9FCE, 0xC767, 0x9FCF, - 0xC768, 0xC0CA, 0xC769, 0x9FD0, 0xC76A, 0x9FD1, 0xC76B, 0xC0CB, - 0xC76C, 0x9FD2, 0xC76D, 0x9FD3, 0xC76E, 0x9FD4, 0xC76F, 0x9FD5, - 0xC770, 0x9FD6, 0xC771, 0x9FD7, 0xC772, 0x9FD8, 0xC773, 0x9FD9, - 0xC774, 0xC0CC, 0xC775, 0xC0CD, 0xC776, 0x9FDA, 0xC777, 0x9FDB, - 0xC778, 0xC0CE, 0xC779, 0x9FDC, 0xC77A, 0x9FDD, 0xC77B, 0x9FDE, - 0xC77C, 0xC0CF, 0xC77D, 0xC0D0, 0xC77E, 0xC0D1, 0xC77F, 0x9FDF, - 0xC780, 0x9FE0, 0xC781, 0x9FE1, 0xC782, 0x9FE2, 0xC783, 0xC0D2, - 0xC784, 0xC0D3, 0xC785, 0xC0D4, 0xC786, 0x9FE3, 0xC787, 0xC0D5, - 0xC788, 0xC0D6, 0xC789, 0xC0D7, 0xC78A, 0xC0D8, 0xC78B, 0x9FE4, - 0xC78C, 0x9FE5, 0xC78D, 0x9FE6, 0xC78E, 0xC0D9, 0xC78F, 0x9FE7, - 0xC790, 0xC0DA, 0xC791, 0xC0DB, 0xC792, 0x9FE8, 0xC793, 0x9FE9, - 0xC794, 0xC0DC, 0xC795, 0x9FEA, 0xC796, 0xC0DD, 0xC797, 0xC0DE, - 0xC798, 0xC0DF, 0xC799, 0x9FEB, 0xC79A, 0xC0E0, 0xC79B, 0x9FEC, - 0xC79C, 0x9FED, 0xC79D, 0x9FEE, 0xC79E, 0x9FEF, 0xC79F, 0x9FF0, - 0xC7A0, 0xC0E1, 0xC7A1, 0xC0E2, 0xC7A2, 0x9FF1, 0xC7A3, 0xC0E3, - 0xC7A4, 0xC0E4, 0xC7A5, 0xC0E5, 0xC7A6, 0xC0E6, 0xC7A7, 0x9FF2, - 0xC7A8, 0x9FF3, 0xC7A9, 0x9FF4, 0xC7AA, 0x9FF5, 0xC7AB, 0x9FF6, - 0xC7AC, 0xC0E7, 0xC7AD, 0xC0E8, 0xC7AE, 0x9FF7, 0xC7AF, 0x9FF8, - 0xC7B0, 0xC0E9, 0xC7B1, 0x9FF9, 0xC7B2, 0x9FFA, 0xC7B3, 0x9FFB, - 0xC7B4, 0xC0EA, 0xC7B5, 0x9FFC, 0xC7B6, 0x9FFD, 0xC7B7, 0x9FFE, - 0xC7B8, 0xA041, 0xC7B9, 0xA042, 0xC7BA, 0xA043, 0xC7BB, 0xA044, - 0xC7BC, 0xC0EB, 0xC7BD, 0xC0EC, 0xC7BE, 0xA045, 0xC7BF, 0xC0ED, - 0xC7C0, 0xC0EE, 0xC7C1, 0xC0EF, 0xC7C2, 0xA046, 0xC7C3, 0xA047, - 0xC7C4, 0xA048, 0xC7C5, 0xA049, 0xC7C6, 0xA04A, 0xC7C7, 0xA04B, - 0xC7C8, 0xC0F0, 0xC7C9, 0xC0F1, 0xC7CA, 0xA04C, 0xC7CB, 0xA04D, - 0xC7CC, 0xC0F2, 0xC7CD, 0xA04E, 0xC7CE, 0xC0F3, 0xC7CF, 0xA04F, - 0xC7D0, 0xC0F4, 0xC7D1, 0xA050, 0xC7D2, 0xA051, 0xC7D3, 0xA052, - 0xC7D4, 0xA053, 0xC7D5, 0xA054, 0xC7D6, 0xA055, 0xC7D7, 0xA056, - 0xC7D8, 0xC0F5, 0xC7D9, 0xA057, 0xC7DA, 0xA058, 0xC7DB, 0xA059, - 0xC7DC, 0xA05A, 0xC7DD, 0xC0F6, 0xC7DE, 0xA061, 0xC7DF, 0xA062, - 0xC7E0, 0xA063, 0xC7E1, 0xA064, 0xC7E2, 0xA065, 0xC7E3, 0xA066, - 0xC7E4, 0xC0F7, 0xC7E5, 0xA067, 0xC7E6, 0xA068, 0xC7E7, 0xA069, - 0xC7E8, 0xC0F8, 0xC7E9, 0xA06A, 0xC7EA, 0xA06B, 0xC7EB, 0xA06C, - 0xC7EC, 0xC0F9, 0xC7ED, 0xA06D, 0xC7EE, 0xA06E, 0xC7EF, 0xA06F, - 0xC7F0, 0xA070, 0xC7F1, 0xA071, 0xC7F2, 0xA072, 0xC7F3, 0xA073, - 0xC7F4, 0xA074, 0xC7F5, 0xA075, 0xC7F6, 0xA076, 0xC7F7, 0xA077, - 0xC7F8, 0xA078, 0xC7F9, 0xA079, 0xC7FA, 0xA07A, 0xC7FB, 0xA081, - 0xC7FC, 0xA082, 0xC7FD, 0xA083, 0xC7FE, 0xA084, 0xC7FF, 0xA085, - 0xC800, 0xC0FA, 0xC801, 0xC0FB, 0xC802, 0xA086, 0xC803, 0xA087, - 0xC804, 0xC0FC, 0xC805, 0xA088, 0xC806, 0xA089, 0xC807, 0xA08A, - 0xC808, 0xC0FD, 0xC809, 0xA08B, 0xC80A, 0xC0FE, 0xC80B, 0xA08C, - 0xC80C, 0xA08D, 0xC80D, 0xA08E, 0xC80E, 0xA08F, 0xC80F, 0xA090, - 0xC810, 0xC1A1, 0xC811, 0xC1A2, 0xC812, 0xA091, 0xC813, 0xC1A3, - 0xC814, 0xA092, 0xC815, 0xC1A4, 0xC816, 0xC1A5, 0xC817, 0xA093, - 0xC818, 0xA094, 0xC819, 0xA095, 0xC81A, 0xA096, 0xC81B, 0xA097, - 0xC81C, 0xC1A6, 0xC81D, 0xC1A7, 0xC81E, 0xA098, 0xC81F, 0xA099, - 0xC820, 0xC1A8, 0xC821, 0xA09A, 0xC822, 0xA09B, 0xC823, 0xA09C, - 0xC824, 0xC1A9, 0xC825, 0xA09D, 0xC826, 0xA09E, 0xC827, 0xA09F, - 0xC828, 0xA0A0, 0xC829, 0xA0A1, 0xC82A, 0xA0A2, 0xC82B, 0xA0A3, - 0xC82C, 0xC1AA, 0xC82D, 0xC1AB, 0xC82E, 0xA0A4, 0xC82F, 0xC1AC, - 0xC830, 0xA0A5, 0xC831, 0xC1AD, 0xC832, 0xA0A6, 0xC833, 0xA0A7, - 0xC834, 0xA0A8, 0xC835, 0xA0A9, 0xC836, 0xA0AA, 0xC837, 0xA0AB, - 0xC838, 0xC1AE, 0xC839, 0xA0AC, 0xC83A, 0xA0AD, 0xC83B, 0xA0AE, - 0xC83C, 0xC1AF, 0xC83D, 0xA0AF, 0xC83E, 0xA0B0, 0xC83F, 0xA0B1, - 0xC840, 0xC1B0, 0xC841, 0xA0B2, 0xC842, 0xA0B3, 0xC843, 0xA0B4, - 0xC844, 0xA0B5, 0xC845, 0xA0B6, 0xC846, 0xA0B7, 0xC847, 0xA0B8, - 0xC848, 0xC1B1, 0xC849, 0xC1B2, 0xC84A, 0xA0B9, 0xC84B, 0xA0BA, - 0xC84C, 0xC1B3, 0xC84D, 0xC1B4, 0xC84E, 0xA0BB, 0xC84F, 0xA0BC, - 0xC850, 0xA0BD, 0xC851, 0xA0BE, 0xC852, 0xA0BF, 0xC853, 0xA0C0, - 0xC854, 0xC1B5, 0xC855, 0xA0C1, 0xC856, 0xA0C2, 0xC857, 0xA0C3, - 0xC858, 0xA0C4, 0xC859, 0xA0C5, 0xC85A, 0xA0C6, 0xC85B, 0xA0C7, - 0xC85C, 0xA0C8, 0xC85D, 0xA0C9, 0xC85E, 0xA0CA, 0xC85F, 0xA0CB, - 0xC860, 0xA0CC, 0xC861, 0xA0CD, 0xC862, 0xA0CE, 0xC863, 0xA0CF, - 0xC864, 0xA0D0, 0xC865, 0xA0D1, 0xC866, 0xA0D2, 0xC867, 0xA0D3, - 0xC868, 0xA0D4, 0xC869, 0xA0D5, 0xC86A, 0xA0D6, 0xC86B, 0xA0D7, - 0xC86C, 0xA0D8, 0xC86D, 0xA0D9, 0xC86E, 0xA0DA, 0xC86F, 0xA0DB, - 0xC870, 0xC1B6, 0xC871, 0xC1B7, 0xC872, 0xA0DC, 0xC873, 0xA0DD, - 0xC874, 0xC1B8, 0xC875, 0xA0DE, 0xC876, 0xA0DF, 0xC877, 0xA0E0, - 0xC878, 0xC1B9, 0xC879, 0xA0E1, 0xC87A, 0xC1BA, 0xC87B, 0xA0E2, - 0xC87C, 0xA0E3, 0xC87D, 0xA0E4, 0xC87E, 0xA0E5, 0xC87F, 0xA0E6, - 0xC880, 0xC1BB, 0xC881, 0xC1BC, 0xC882, 0xA0E7, 0xC883, 0xC1BD, - 0xC884, 0xA0E8, 0xC885, 0xC1BE, 0xC886, 0xC1BF, 0xC887, 0xC1C0, - 0xC888, 0xA0E9, 0xC889, 0xA0EA, 0xC88A, 0xA0EB, 0xC88B, 0xC1C1, - 0xC88C, 0xC1C2, 0xC88D, 0xC1C3, 0xC88E, 0xA0EC, 0xC88F, 0xA0ED, - 0xC890, 0xA0EE, 0xC891, 0xA0EF, 0xC892, 0xA0F0, 0xC893, 0xA0F1, - 0xC894, 0xC1C4, 0xC895, 0xA0F2, 0xC896, 0xA0F3, 0xC897, 0xA0F4, - 0xC898, 0xA0F5, 0xC899, 0xA0F6, 0xC89A, 0xA0F7, 0xC89B, 0xA0F8, - 0xC89C, 0xA0F9, 0xC89D, 0xC1C5, 0xC89E, 0xA0FA, 0xC89F, 0xC1C6, - 0xC8A0, 0xA0FB, 0xC8A1, 0xC1C7, 0xC8A2, 0xA0FC, 0xC8A3, 0xA0FD, - 0xC8A4, 0xA0FE, 0xC8A5, 0xA141, 0xC8A6, 0xA142, 0xC8A7, 0xA143, - 0xC8A8, 0xC1C8, 0xC8A9, 0xA144, 0xC8AA, 0xA145, 0xC8AB, 0xA146, - 0xC8AC, 0xA147, 0xC8AD, 0xA148, 0xC8AE, 0xA149, 0xC8AF, 0xA14A, - 0xC8B0, 0xA14B, 0xC8B1, 0xA14C, 0xC8B2, 0xA14D, 0xC8B3, 0xA14E, - 0xC8B4, 0xA14F, 0xC8B5, 0xA150, 0xC8B6, 0xA151, 0xC8B7, 0xA152, - 0xC8B8, 0xA153, 0xC8B9, 0xA154, 0xC8BA, 0xA155, 0xC8BB, 0xA156, - 0xC8BC, 0xC1C9, 0xC8BD, 0xC1CA, 0xC8BE, 0xA157, 0xC8BF, 0xA158, - 0xC8C0, 0xA159, 0xC8C1, 0xA15A, 0xC8C2, 0xA161, 0xC8C3, 0xA162, - 0xC8C4, 0xC1CB, 0xC8C5, 0xA163, 0xC8C6, 0xA164, 0xC8C7, 0xA165, - 0xC8C8, 0xC1CC, 0xC8C9, 0xA166, 0xC8CA, 0xA167, 0xC8CB, 0xA168, - 0xC8CC, 0xC1CD, 0xC8CD, 0xA169, 0xC8CE, 0xA16A, 0xC8CF, 0xA16B, - 0xC8D0, 0xA16C, 0xC8D1, 0xA16D, 0xC8D2, 0xA16E, 0xC8D3, 0xA16F, - 0xC8D4, 0xC1CE, 0xC8D5, 0xC1CF, 0xC8D6, 0xA170, 0xC8D7, 0xC1D0, - 0xC8D8, 0xA171, 0xC8D9, 0xC1D1, 0xC8DA, 0xA172, 0xC8DB, 0xA173, - 0xC8DC, 0xA174, 0xC8DD, 0xA175, 0xC8DE, 0xA176, 0xC8DF, 0xA177, - 0xC8E0, 0xC1D2, 0xC8E1, 0xC1D3, 0xC8E2, 0xA178, 0xC8E3, 0xA179, - 0xC8E4, 0xC1D4, 0xC8E5, 0xA17A, 0xC8E6, 0xA181, 0xC8E7, 0xA182, - 0xC8E8, 0xA183, 0xC8E9, 0xA184, 0xC8EA, 0xA185, 0xC8EB, 0xA186, - 0xC8EC, 0xA187, 0xC8ED, 0xA188, 0xC8EE, 0xA189, 0xC8EF, 0xA18A, - 0xC8F0, 0xA18B, 0xC8F1, 0xA18C, 0xC8F2, 0xA18D, 0xC8F3, 0xA18E, - 0xC8F4, 0xA18F, 0xC8F5, 0xC1D5, 0xC8F6, 0xA190, 0xC8F7, 0xA191, - 0xC8F8, 0xA192, 0xC8F9, 0xA193, 0xC8FA, 0xA194, 0xC8FB, 0xA195, - 0xC8FC, 0xC1D6, 0xC8FD, 0xC1D7, 0xC8FE, 0xA196, 0xC8FF, 0xA197, - 0xC900, 0xC1D8, 0xC901, 0xA198, 0xC902, 0xA199, 0xC903, 0xA19A, - 0xC904, 0xC1D9, 0xC905, 0xC1DA, 0xC906, 0xC1DB, 0xC907, 0xA19B, - 0xC908, 0xA19C, 0xC909, 0xA19D, 0xC90A, 0xA19E, 0xC90B, 0xA19F, - 0xC90C, 0xC1DC, 0xC90D, 0xC1DD, 0xC90E, 0xA1A0, 0xC90F, 0xC1DE, - 0xC910, 0xA241, 0xC911, 0xC1DF, 0xC912, 0xA242, 0xC913, 0xA243, - 0xC914, 0xA244, 0xC915, 0xA245, 0xC916, 0xA246, 0xC917, 0xA247, - 0xC918, 0xC1E0, 0xC919, 0xA248, 0xC91A, 0xA249, 0xC91B, 0xA24A, - 0xC91C, 0xA24B, 0xC91D, 0xA24C, 0xC91E, 0xA24D, 0xC91F, 0xA24E, - 0xC920, 0xA24F, 0xC921, 0xA250, 0xC922, 0xA251, 0xC923, 0xA252, - 0xC924, 0xA253, 0xC925, 0xA254, 0xC926, 0xA255, 0xC927, 0xA256, - 0xC928, 0xA257, 0xC929, 0xA258, 0xC92A, 0xA259, 0xC92B, 0xA25A, - 0xC92C, 0xC1E1, 0xC92D, 0xA261, 0xC92E, 0xA262, 0xC92F, 0xA263, - 0xC930, 0xA264, 0xC931, 0xA265, 0xC932, 0xA266, 0xC933, 0xA267, - 0xC934, 0xC1E2, 0xC935, 0xA268, 0xC936, 0xA269, 0xC937, 0xA26A, - 0xC938, 0xA26B, 0xC939, 0xA26C, 0xC93A, 0xA26D, 0xC93B, 0xA26E, - 0xC93C, 0xA26F, 0xC93D, 0xA270, 0xC93E, 0xA271, 0xC93F, 0xA272, - 0xC940, 0xA273, 0xC941, 0xA274, 0xC942, 0xA275, 0xC943, 0xA276, - 0xC944, 0xA277, 0xC945, 0xA278, 0xC946, 0xA279, 0xC947, 0xA27A, - 0xC948, 0xA281, 0xC949, 0xA282, 0xC94A, 0xA283, 0xC94B, 0xA284, - 0xC94C, 0xA285, 0xC94D, 0xA286, 0xC94E, 0xA287, 0xC94F, 0xA288, - 0xC950, 0xC1E3, 0xC951, 0xC1E4, 0xC952, 0xA289, 0xC953, 0xA28A, - 0xC954, 0xC1E5, 0xC955, 0xA28B, 0xC956, 0xA28C, 0xC957, 0xA28D, - 0xC958, 0xC1E6, 0xC959, 0xA28E, 0xC95A, 0xA28F, 0xC95B, 0xA290, - 0xC95C, 0xA291, 0xC95D, 0xA292, 0xC95E, 0xA293, 0xC95F, 0xA294, - 0xC960, 0xC1E7, 0xC961, 0xC1E8, 0xC962, 0xA295, 0xC963, 0xC1E9, - 0xC964, 0xA296, 0xC965, 0xA297, 0xC966, 0xA298, 0xC967, 0xA299, - 0xC968, 0xA29A, 0xC969, 0xA29B, 0xC96A, 0xA29C, 0xC96B, 0xA29D, - 0xC96C, 0xC1EA, 0xC96D, 0xA29E, 0xC96E, 0xA29F, 0xC96F, 0xA2A0, - 0xC970, 0xC1EB, 0xC971, 0xA341, 0xC972, 0xA342, 0xC973, 0xA343, - 0xC974, 0xC1EC, 0xC975, 0xA344, 0xC976, 0xA345, 0xC977, 0xA346, - 0xC978, 0xA347, 0xC979, 0xA348, 0xC97A, 0xA349, 0xC97B, 0xA34A, - 0xC97C, 0xC1ED, 0xC97D, 0xA34B, 0xC97E, 0xA34C, 0xC97F, 0xA34D, - 0xC980, 0xA34E, 0xC981, 0xA34F, 0xC982, 0xA350, 0xC983, 0xA351, - 0xC984, 0xA352, 0xC985, 0xA353, 0xC986, 0xA354, 0xC987, 0xA355, - 0xC988, 0xC1EE, 0xC989, 0xC1EF, 0xC98A, 0xA356, 0xC98B, 0xA357, - 0xC98C, 0xC1F0, 0xC98D, 0xA358, 0xC98E, 0xA359, 0xC98F, 0xA35A, - 0xC990, 0xC1F1, 0xC991, 0xA361, 0xC992, 0xA362, 0xC993, 0xA363, - 0xC994, 0xA364, 0xC995, 0xA365, 0xC996, 0xA366, 0xC997, 0xA367, - 0xC998, 0xC1F2, 0xC999, 0xC1F3, 0xC99A, 0xA368, 0xC99B, 0xC1F4, - 0xC99C, 0xA369, 0xC99D, 0xC1F5, 0xC99E, 0xA36A, 0xC99F, 0xA36B, - 0xC9A0, 0xA36C, 0xC9A1, 0xA36D, 0xC9A2, 0xA36E, 0xC9A3, 0xA36F, - 0xC9A4, 0xA370, 0xC9A5, 0xA371, 0xC9A6, 0xA372, 0xC9A7, 0xA373, - 0xC9A8, 0xA374, 0xC9A9, 0xA375, 0xC9AA, 0xA376, 0xC9AB, 0xA377, - 0xC9AC, 0xA378, 0xC9AD, 0xA379, 0xC9AE, 0xA37A, 0xC9AF, 0xA381, - 0xC9B0, 0xA382, 0xC9B1, 0xA383, 0xC9B2, 0xA384, 0xC9B3, 0xA385, - 0xC9B4, 0xA386, 0xC9B5, 0xA387, 0xC9B6, 0xA388, 0xC9B7, 0xA389, - 0xC9B8, 0xA38A, 0xC9B9, 0xA38B, 0xC9BA, 0xA38C, 0xC9BB, 0xA38D, - 0xC9BC, 0xA38E, 0xC9BD, 0xA38F, 0xC9BE, 0xA390, 0xC9BF, 0xA391, - 0xC9C0, 0xC1F6, 0xC9C1, 0xC1F7, 0xC9C2, 0xA392, 0xC9C3, 0xA393, - 0xC9C4, 0xC1F8, 0xC9C5, 0xA394, 0xC9C6, 0xA395, 0xC9C7, 0xC1F9, - 0xC9C8, 0xC1FA, 0xC9C9, 0xA396, 0xC9CA, 0xC1FB, 0xC9CB, 0xA397, - 0xC9CC, 0xA398, 0xC9CD, 0xA399, 0xC9CE, 0xA39A, 0xC9CF, 0xA39B, - 0xC9D0, 0xC1FC, 0xC9D1, 0xC1FD, 0xC9D2, 0xA39C, 0xC9D3, 0xC1FE, - 0xC9D4, 0xA39D, 0xC9D5, 0xC2A1, 0xC9D6, 0xC2A2, 0xC9D7, 0xA39E, - 0xC9D8, 0xA39F, 0xC9D9, 0xC2A3, 0xC9DA, 0xC2A4, 0xC9DB, 0xA3A0, - 0xC9DC, 0xC2A5, 0xC9DD, 0xC2A6, 0xC9DE, 0xA441, 0xC9DF, 0xA442, - 0xC9E0, 0xC2A7, 0xC9E1, 0xA443, 0xC9E2, 0xC2A8, 0xC9E3, 0xA444, - 0xC9E4, 0xC2A9, 0xC9E5, 0xA445, 0xC9E6, 0xA446, 0xC9E7, 0xC2AA, - 0xC9E8, 0xA447, 0xC9E9, 0xA448, 0xC9EA, 0xA449, 0xC9EB, 0xA44A, - 0xC9EC, 0xC2AB, 0xC9ED, 0xC2AC, 0xC9EE, 0xA44B, 0xC9EF, 0xC2AD, - 0xC9F0, 0xC2AE, 0xC9F1, 0xC2AF, 0xC9F2, 0xA44C, 0xC9F3, 0xA44D, - 0xC9F4, 0xA44E, 0xC9F5, 0xA44F, 0xC9F6, 0xA450, 0xC9F7, 0xA451, - 0xC9F8, 0xC2B0, 0xC9F9, 0xC2B1, 0xC9FA, 0xA452, 0xC9FB, 0xA453, - 0xC9FC, 0xC2B2, 0xC9FD, 0xA454, 0xC9FE, 0xA455, 0xC9FF, 0xA456, - 0xCA00, 0xC2B3, 0xCA01, 0xA457, 0xCA02, 0xA458, 0xCA03, 0xA459, - 0xCA04, 0xA45A, 0xCA05, 0xA461, 0xCA06, 0xA462, 0xCA07, 0xA463, - 0xCA08, 0xC2B4, 0xCA09, 0xC2B5, 0xCA0A, 0xA464, 0xCA0B, 0xC2B6, - 0xCA0C, 0xC2B7, 0xCA0D, 0xC2B8, 0xCA0E, 0xA465, 0xCA0F, 0xA466, - 0xCA10, 0xA467, 0xCA11, 0xA468, 0xCA12, 0xA469, 0xCA13, 0xA46A, - 0xCA14, 0xC2B9, 0xCA15, 0xA46B, 0xCA16, 0xA46C, 0xCA17, 0xA46D, - 0xCA18, 0xC2BA, 0xCA19, 0xA46E, 0xCA1A, 0xA46F, 0xCA1B, 0xA470, - 0xCA1C, 0xA471, 0xCA1D, 0xA472, 0xCA1E, 0xA473, 0xCA1F, 0xA474, - 0xCA20, 0xA475, 0xCA21, 0xA476, 0xCA22, 0xA477, 0xCA23, 0xA478, - 0xCA24, 0xA479, 0xCA25, 0xA47A, 0xCA26, 0xA481, 0xCA27, 0xA482, - 0xCA28, 0xA483, 0xCA29, 0xC2BB, 0xCA2A, 0xA484, 0xCA2B, 0xA485, - 0xCA2C, 0xA486, 0xCA2D, 0xA487, 0xCA2E, 0xA488, 0xCA2F, 0xA489, - 0xCA30, 0xA48A, 0xCA31, 0xA48B, 0xCA32, 0xA48C, 0xCA33, 0xA48D, - 0xCA34, 0xA48E, 0xCA35, 0xA48F, 0xCA36, 0xA490, 0xCA37, 0xA491, - 0xCA38, 0xA492, 0xCA39, 0xA493, 0xCA3A, 0xA494, 0xCA3B, 0xA495, - 0xCA3C, 0xA496, 0xCA3D, 0xA497, 0xCA3E, 0xA498, 0xCA3F, 0xA499, - 0xCA40, 0xA49A, 0xCA41, 0xA49B, 0xCA42, 0xA49C, 0xCA43, 0xA49D, - 0xCA44, 0xA49E, 0xCA45, 0xA49F, 0xCA46, 0xA4A0, 0xCA47, 0xA541, - 0xCA48, 0xA542, 0xCA49, 0xA543, 0xCA4A, 0xA544, 0xCA4B, 0xA545, - 0xCA4C, 0xC2BC, 0xCA4D, 0xC2BD, 0xCA4E, 0xA546, 0xCA4F, 0xA547, - 0xCA50, 0xC2BE, 0xCA51, 0xA548, 0xCA52, 0xA549, 0xCA53, 0xA54A, - 0xCA54, 0xC2BF, 0xCA55, 0xA54B, 0xCA56, 0xA54C, 0xCA57, 0xA54D, - 0xCA58, 0xA54E, 0xCA59, 0xA54F, 0xCA5A, 0xA550, 0xCA5B, 0xA551, - 0xCA5C, 0xC2C0, 0xCA5D, 0xC2C1, 0xCA5E, 0xA552, 0xCA5F, 0xC2C2, - 0xCA60, 0xC2C3, 0xCA61, 0xC2C4, 0xCA62, 0xA553, 0xCA63, 0xA554, - 0xCA64, 0xA555, 0xCA65, 0xA556, 0xCA66, 0xA557, 0xCA67, 0xA558, - 0xCA68, 0xC2C5, 0xCA69, 0xA559, 0xCA6A, 0xA55A, 0xCA6B, 0xA561, - 0xCA6C, 0xA562, 0xCA6D, 0xA563, 0xCA6E, 0xA564, 0xCA6F, 0xA565, - 0xCA70, 0xA566, 0xCA71, 0xA567, 0xCA72, 0xA568, 0xCA73, 0xA569, - 0xCA74, 0xA56A, 0xCA75, 0xA56B, 0xCA76, 0xA56C, 0xCA77, 0xA56D, - 0xCA78, 0xA56E, 0xCA79, 0xA56F, 0xCA7A, 0xA570, 0xCA7B, 0xA571, - 0xCA7C, 0xA572, 0xCA7D, 0xC2C6, 0xCA7E, 0xA573, 0xCA7F, 0xA574, - 0xCA80, 0xA575, 0xCA81, 0xA576, 0xCA82, 0xA577, 0xCA83, 0xA578, - 0xCA84, 0xC2C7, 0xCA85, 0xA579, 0xCA86, 0xA57A, 0xCA87, 0xA581, - 0xCA88, 0xA582, 0xCA89, 0xA583, 0xCA8A, 0xA584, 0xCA8B, 0xA585, - 0xCA8C, 0xA586, 0xCA8D, 0xA587, 0xCA8E, 0xA588, 0xCA8F, 0xA589, - 0xCA90, 0xA58A, 0xCA91, 0xA58B, 0xCA92, 0xA58C, 0xCA93, 0xA58D, - 0xCA94, 0xA58E, 0xCA95, 0xA58F, 0xCA96, 0xA590, 0xCA97, 0xA591, - 0xCA98, 0xC2C8, 0xCA99, 0xA592, 0xCA9A, 0xA593, 0xCA9B, 0xA594, - 0xCA9C, 0xA595, 0xCA9D, 0xA596, 0xCA9E, 0xA597, 0xCA9F, 0xA598, - 0xCAA0, 0xA599, 0xCAA1, 0xA59A, 0xCAA2, 0xA59B, 0xCAA3, 0xA59C, - 0xCAA4, 0xA59D, 0xCAA5, 0xA59E, 0xCAA6, 0xA59F, 0xCAA7, 0xA5A0, - 0xCAA8, 0xA641, 0xCAA9, 0xA642, 0xCAAA, 0xA643, 0xCAAB, 0xA644, - 0xCAAC, 0xA645, 0xCAAD, 0xA646, 0xCAAE, 0xA647, 0xCAAF, 0xA648, - 0xCAB0, 0xA649, 0xCAB1, 0xA64A, 0xCAB2, 0xA64B, 0xCAB3, 0xA64C, - 0xCAB4, 0xA64D, 0xCAB5, 0xA64E, 0xCAB6, 0xA64F, 0xCAB7, 0xA650, - 0xCAB8, 0xA651, 0xCAB9, 0xA652, 0xCABA, 0xA653, 0xCABB, 0xA654, - 0xCABC, 0xC2C9, 0xCABD, 0xC2CA, 0xCABE, 0xA655, 0xCABF, 0xA656, - 0xCAC0, 0xC2CB, 0xCAC1, 0xA657, 0xCAC2, 0xA658, 0xCAC3, 0xA659, - 0xCAC4, 0xC2CC, 0xCAC5, 0xA65A, 0xCAC6, 0xA661, 0xCAC7, 0xA662, - 0xCAC8, 0xA663, 0xCAC9, 0xA664, 0xCACA, 0xA665, 0xCACB, 0xA666, - 0xCACC, 0xC2CD, 0xCACD, 0xC2CE, 0xCACE, 0xA667, 0xCACF, 0xC2CF, - 0xCAD0, 0xA668, 0xCAD1, 0xC2D0, 0xCAD2, 0xA669, 0xCAD3, 0xC2D1, - 0xCAD4, 0xA66A, 0xCAD5, 0xA66B, 0xCAD6, 0xA66C, 0xCAD7, 0xA66D, - 0xCAD8, 0xC2D2, 0xCAD9, 0xC2D3, 0xCADA, 0xA66E, 0xCADB, 0xA66F, - 0xCADC, 0xA670, 0xCADD, 0xA671, 0xCADE, 0xA672, 0xCADF, 0xA673, - 0xCAE0, 0xC2D4, 0xCAE1, 0xA674, 0xCAE2, 0xA675, 0xCAE3, 0xA676, - 0xCAE4, 0xA677, 0xCAE5, 0xA678, 0xCAE6, 0xA679, 0xCAE7, 0xA67A, - 0xCAE8, 0xA681, 0xCAE9, 0xA682, 0xCAEA, 0xA683, 0xCAEB, 0xA684, - 0xCAEC, 0xC2D5, 0xCAED, 0xA685, 0xCAEE, 0xA686, 0xCAEF, 0xA687, - 0xCAF0, 0xA688, 0xCAF1, 0xA689, 0xCAF2, 0xA68A, 0xCAF3, 0xA68B, - 0xCAF4, 0xC2D6, 0xCAF5, 0xA68C, 0xCAF6, 0xA68D, 0xCAF7, 0xA68E, - 0xCAF8, 0xA68F, 0xCAF9, 0xA690, 0xCAFA, 0xA691, 0xCAFB, 0xA692, - 0xCAFC, 0xA693, 0xCAFD, 0xA694, 0xCAFE, 0xA695, 0xCAFF, 0xA696, - 0xCB00, 0xA697, 0xCB01, 0xA698, 0xCB02, 0xA699, 0xCB03, 0xA69A, - 0xCB04, 0xA69B, 0xCB05, 0xA69C, 0xCB06, 0xA69D, 0xCB07, 0xA69E, - 0xCB08, 0xC2D7, 0xCB09, 0xA69F, 0xCB0A, 0xA6A0, 0xCB0B, 0xA741, - 0xCB0C, 0xA742, 0xCB0D, 0xA743, 0xCB0E, 0xA744, 0xCB0F, 0xA745, - 0xCB10, 0xC2D8, 0xCB11, 0xA746, 0xCB12, 0xA747, 0xCB13, 0xA748, - 0xCB14, 0xC2D9, 0xCB15, 0xA749, 0xCB16, 0xA74A, 0xCB17, 0xA74B, - 0xCB18, 0xC2DA, 0xCB19, 0xA74C, 0xCB1A, 0xA74D, 0xCB1B, 0xA74E, - 0xCB1C, 0xA74F, 0xCB1D, 0xA750, 0xCB1E, 0xA751, 0xCB1F, 0xA752, - 0xCB20, 0xC2DB, 0xCB21, 0xC2DC, 0xCB22, 0xA753, 0xCB23, 0xA754, - 0xCB24, 0xA755, 0xCB25, 0xA756, 0xCB26, 0xA757, 0xCB27, 0xA758, - 0xCB28, 0xA759, 0xCB29, 0xA75A, 0xCB2A, 0xA761, 0xCB2B, 0xA762, - 0xCB2C, 0xA763, 0xCB2D, 0xA764, 0xCB2E, 0xA765, 0xCB2F, 0xA766, - 0xCB30, 0xA767, 0xCB31, 0xA768, 0xCB32, 0xA769, 0xCB33, 0xA76A, - 0xCB34, 0xA76B, 0xCB35, 0xA76C, 0xCB36, 0xA76D, 0xCB37, 0xA76E, - 0xCB38, 0xA76F, 0xCB39, 0xA770, 0xCB3A, 0xA771, 0xCB3B, 0xA772, - 0xCB3C, 0xA773, 0xCB3D, 0xA774, 0xCB3E, 0xA775, 0xCB3F, 0xA776, - 0xCB40, 0xA777, 0xCB41, 0xC2DD, 0xCB42, 0xA778, 0xCB43, 0xA779, - 0xCB44, 0xA77A, 0xCB45, 0xA781, 0xCB46, 0xA782, 0xCB47, 0xA783, - 0xCB48, 0xC2DE, 0xCB49, 0xC2DF, 0xCB4A, 0xA784, 0xCB4B, 0xA785, - 0xCB4C, 0xC2E0, 0xCB4D, 0xA786, 0xCB4E, 0xA787, 0xCB4F, 0xA788, - 0xCB50, 0xC2E1, 0xCB51, 0xA789, 0xCB52, 0xA78A, 0xCB53, 0xA78B, - 0xCB54, 0xA78C, 0xCB55, 0xA78D, 0xCB56, 0xA78E, 0xCB57, 0xA78F, - 0xCB58, 0xC2E2, 0xCB59, 0xC2E3, 0xCB5A, 0xA790, 0xCB5B, 0xA791, - 0xCB5C, 0xA792, 0xCB5D, 0xC2E4, 0xCB5E, 0xA793, 0xCB5F, 0xA794, - 0xCB60, 0xA795, 0xCB61, 0xA796, 0xCB62, 0xA797, 0xCB63, 0xA798, - 0xCB64, 0xC2E5, 0xCB65, 0xA799, 0xCB66, 0xA79A, 0xCB67, 0xA79B, - 0xCB68, 0xA79C, 0xCB69, 0xA79D, 0xCB6A, 0xA79E, 0xCB6B, 0xA79F, - 0xCB6C, 0xA7A0, 0xCB6D, 0xA841, 0xCB6E, 0xA842, 0xCB6F, 0xA843, - 0xCB70, 0xA844, 0xCB71, 0xA845, 0xCB72, 0xA846, 0xCB73, 0xA847, - 0xCB74, 0xA848, 0xCB75, 0xA849, 0xCB76, 0xA84A, 0xCB77, 0xA84B, - 0xCB78, 0xC2E6, 0xCB79, 0xC2E7, 0xCB7A, 0xA84C, 0xCB7B, 0xA84D, - 0xCB7C, 0xA84E, 0xCB7D, 0xA84F, 0xCB7E, 0xA850, 0xCB7F, 0xA851, - 0xCB80, 0xA852, 0xCB81, 0xA853, 0xCB82, 0xA854, 0xCB83, 0xA855, - 0xCB84, 0xA856, 0xCB85, 0xA857, 0xCB86, 0xA858, 0xCB87, 0xA859, - 0xCB88, 0xA85A, 0xCB89, 0xA861, 0xCB8A, 0xA862, 0xCB8B, 0xA863, - 0xCB8C, 0xA864, 0xCB8D, 0xA865, 0xCB8E, 0xA866, 0xCB8F, 0xA867, - 0xCB90, 0xA868, 0xCB91, 0xA869, 0xCB92, 0xA86A, 0xCB93, 0xA86B, - 0xCB94, 0xA86C, 0xCB95, 0xA86D, 0xCB96, 0xA86E, 0xCB97, 0xA86F, - 0xCB98, 0xA870, 0xCB99, 0xA871, 0xCB9A, 0xA872, 0xCB9B, 0xA873, - 0xCB9C, 0xC2E8, 0xCB9D, 0xA874, 0xCB9E, 0xA875, 0xCB9F, 0xA876, - 0xCBA0, 0xA877, 0xCBA1, 0xA878, 0xCBA2, 0xA879, 0xCBA3, 0xA87A, - 0xCBA4, 0xA881, 0xCBA5, 0xA882, 0xCBA6, 0xA883, 0xCBA7, 0xA884, - 0xCBA8, 0xA885, 0xCBA9, 0xA886, 0xCBAA, 0xA887, 0xCBAB, 0xA888, - 0xCBAC, 0xA889, 0xCBAD, 0xA88A, 0xCBAE, 0xA88B, 0xCBAF, 0xA88C, - 0xCBB0, 0xA88D, 0xCBB1, 0xA88E, 0xCBB2, 0xA88F, 0xCBB3, 0xA890, - 0xCBB4, 0xA891, 0xCBB5, 0xA892, 0xCBB6, 0xA893, 0xCBB7, 0xA894, - 0xCBB8, 0xC2E9, 0xCBB9, 0xA895, 0xCBBA, 0xA896, 0xCBBB, 0xA897, - 0xCBBC, 0xA898, 0xCBBD, 0xA899, 0xCBBE, 0xA89A, 0xCBBF, 0xA89B, - 0xCBC0, 0xA89C, 0xCBC1, 0xA89D, 0xCBC2, 0xA89E, 0xCBC3, 0xA89F, - 0xCBC4, 0xA8A0, 0xCBC5, 0xA941, 0xCBC6, 0xA942, 0xCBC7, 0xA943, - 0xCBC8, 0xA944, 0xCBC9, 0xA945, 0xCBCA, 0xA946, 0xCBCB, 0xA947, - 0xCBCC, 0xA948, 0xCBCD, 0xA949, 0xCBCE, 0xA94A, 0xCBCF, 0xA94B, - 0xCBD0, 0xA94C, 0xCBD1, 0xA94D, 0xCBD2, 0xA94E, 0xCBD3, 0xA94F, - 0xCBD4, 0xC2EA, 0xCBD5, 0xA950, 0xCBD6, 0xA951, 0xCBD7, 0xA952, - 0xCBD8, 0xA953, 0xCBD9, 0xA954, 0xCBDA, 0xA955, 0xCBDB, 0xA956, - 0xCBDC, 0xA957, 0xCBDD, 0xA958, 0xCBDE, 0xA959, 0xCBDF, 0xA95A, - 0xCBE0, 0xA961, 0xCBE1, 0xA962, 0xCBE2, 0xA963, 0xCBE3, 0xA964, - 0xCBE4, 0xC2EB, 0xCBE5, 0xA965, 0xCBE6, 0xA966, 0xCBE7, 0xC2EC, - 0xCBE8, 0xA967, 0xCBE9, 0xC2ED, 0xCBEA, 0xA968, 0xCBEB, 0xA969, - 0xCBEC, 0xA96A, 0xCBED, 0xA96B, 0xCBEE, 0xA96C, 0xCBEF, 0xA96D, - 0xCBF0, 0xA96E, 0xCBF1, 0xA96F, 0xCBF2, 0xA970, 0xCBF3, 0xA971, - 0xCBF4, 0xA972, 0xCBF5, 0xA973, 0xCBF6, 0xA974, 0xCBF7, 0xA975, - 0xCBF8, 0xA976, 0xCBF9, 0xA977, 0xCBFA, 0xA978, 0xCBFB, 0xA979, - 0xCBFC, 0xA97A, 0xCBFD, 0xA981, 0xCBFE, 0xA982, 0xCBFF, 0xA983, - 0xCC00, 0xA984, 0xCC01, 0xA985, 0xCC02, 0xA986, 0xCC03, 0xA987, - 0xCC04, 0xA988, 0xCC05, 0xA989, 0xCC06, 0xA98A, 0xCC07, 0xA98B, - 0xCC08, 0xA98C, 0xCC09, 0xA98D, 0xCC0A, 0xA98E, 0xCC0B, 0xA98F, - 0xCC0C, 0xC2EE, 0xCC0D, 0xC2EF, 0xCC0E, 0xA990, 0xCC0F, 0xA991, - 0xCC10, 0xC2F0, 0xCC11, 0xA992, 0xCC12, 0xA993, 0xCC13, 0xA994, - 0xCC14, 0xC2F1, 0xCC15, 0xA995, 0xCC16, 0xA996, 0xCC17, 0xA997, - 0xCC18, 0xA998, 0xCC19, 0xA999, 0xCC1A, 0xA99A, 0xCC1B, 0xA99B, - 0xCC1C, 0xC2F2, 0xCC1D, 0xC2F3, 0xCC1E, 0xA99C, 0xCC1F, 0xA99D, - 0xCC20, 0xA99E, 0xCC21, 0xC2F4, 0xCC22, 0xC2F5, 0xCC23, 0xA99F, - 0xCC24, 0xA9A0, 0xCC25, 0xAA41, 0xCC26, 0xAA42, 0xCC27, 0xC2F6, - 0xCC28, 0xC2F7, 0xCC29, 0xC2F8, 0xCC2A, 0xAA43, 0xCC2B, 0xAA44, - 0xCC2C, 0xC2F9, 0xCC2D, 0xAA45, 0xCC2E, 0xC2FA, 0xCC2F, 0xAA46, - 0xCC30, 0xC2FB, 0xCC31, 0xAA47, 0xCC32, 0xAA48, 0xCC33, 0xAA49, - 0xCC34, 0xAA4A, 0xCC35, 0xAA4B, 0xCC36, 0xAA4C, 0xCC37, 0xAA4D, - 0xCC38, 0xC2FC, 0xCC39, 0xC2FD, 0xCC3A, 0xAA4E, 0xCC3B, 0xC2FE, - 0xCC3C, 0xC3A1, 0xCC3D, 0xC3A2, 0xCC3E, 0xC3A3, 0xCC3F, 0xAA4F, - 0xCC40, 0xAA50, 0xCC41, 0xAA51, 0xCC42, 0xAA52, 0xCC43, 0xAA53, - 0xCC44, 0xC3A4, 0xCC45, 0xC3A5, 0xCC46, 0xAA54, 0xCC47, 0xAA55, - 0xCC48, 0xC3A6, 0xCC49, 0xAA56, 0xCC4A, 0xAA57, 0xCC4B, 0xAA58, - 0xCC4C, 0xC3A7, 0xCC4D, 0xAA59, 0xCC4E, 0xAA5A, 0xCC4F, 0xAA61, - 0xCC50, 0xAA62, 0xCC51, 0xAA63, 0xCC52, 0xAA64, 0xCC53, 0xAA65, - 0xCC54, 0xC3A8, 0xCC55, 0xC3A9, 0xCC56, 0xAA66, 0xCC57, 0xC3AA, - 0xCC58, 0xC3AB, 0xCC59, 0xC3AC, 0xCC5A, 0xAA67, 0xCC5B, 0xAA68, - 0xCC5C, 0xAA69, 0xCC5D, 0xAA6A, 0xCC5E, 0xAA6B, 0xCC5F, 0xAA6C, - 0xCC60, 0xC3AD, 0xCC61, 0xAA6D, 0xCC62, 0xAA6E, 0xCC63, 0xAA6F, - 0xCC64, 0xC3AE, 0xCC65, 0xAA70, 0xCC66, 0xC3AF, 0xCC67, 0xAA71, - 0xCC68, 0xC3B0, 0xCC69, 0xAA72, 0xCC6A, 0xAA73, 0xCC6B, 0xAA74, - 0xCC6C, 0xAA75, 0xCC6D, 0xAA76, 0xCC6E, 0xAA77, 0xCC6F, 0xAA78, - 0xCC70, 0xC3B1, 0xCC71, 0xAA79, 0xCC72, 0xAA7A, 0xCC73, 0xAA81, - 0xCC74, 0xAA82, 0xCC75, 0xC3B2, 0xCC76, 0xAA83, 0xCC77, 0xAA84, - 0xCC78, 0xAA85, 0xCC79, 0xAA86, 0xCC7A, 0xAA87, 0xCC7B, 0xAA88, - 0xCC7C, 0xAA89, 0xCC7D, 0xAA8A, 0xCC7E, 0xAA8B, 0xCC7F, 0xAA8C, - 0xCC80, 0xAA8D, 0xCC81, 0xAA8E, 0xCC82, 0xAA8F, 0xCC83, 0xAA90, - 0xCC84, 0xAA91, 0xCC85, 0xAA92, 0xCC86, 0xAA93, 0xCC87, 0xAA94, - 0xCC88, 0xAA95, 0xCC89, 0xAA96, 0xCC8A, 0xAA97, 0xCC8B, 0xAA98, - 0xCC8C, 0xAA99, 0xCC8D, 0xAA9A, 0xCC8E, 0xAA9B, 0xCC8F, 0xAA9C, - 0xCC90, 0xAA9D, 0xCC91, 0xAA9E, 0xCC92, 0xAA9F, 0xCC93, 0xAAA0, - 0xCC94, 0xAB41, 0xCC95, 0xAB42, 0xCC96, 0xAB43, 0xCC97, 0xAB44, - 0xCC98, 0xC3B3, 0xCC99, 0xC3B4, 0xCC9A, 0xAB45, 0xCC9B, 0xAB46, - 0xCC9C, 0xC3B5, 0xCC9D, 0xAB47, 0xCC9E, 0xAB48, 0xCC9F, 0xAB49, - 0xCCA0, 0xC3B6, 0xCCA1, 0xAB4A, 0xCCA2, 0xAB4B, 0xCCA3, 0xAB4C, - 0xCCA4, 0xAB4D, 0xCCA5, 0xAB4E, 0xCCA6, 0xAB4F, 0xCCA7, 0xAB50, - 0xCCA8, 0xC3B7, 0xCCA9, 0xC3B8, 0xCCAA, 0xAB51, 0xCCAB, 0xC3B9, - 0xCCAC, 0xC3BA, 0xCCAD, 0xC3BB, 0xCCAE, 0xAB52, 0xCCAF, 0xAB53, - 0xCCB0, 0xAB54, 0xCCB1, 0xAB55, 0xCCB2, 0xAB56, 0xCCB3, 0xAB57, - 0xCCB4, 0xC3BC, 0xCCB5, 0xC3BD, 0xCCB6, 0xAB58, 0xCCB7, 0xAB59, - 0xCCB8, 0xC3BE, 0xCCB9, 0xAB5A, 0xCCBA, 0xAB61, 0xCCBB, 0xAB62, - 0xCCBC, 0xC3BF, 0xCCBD, 0xAB63, 0xCCBE, 0xAB64, 0xCCBF, 0xAB65, - 0xCCC0, 0xAB66, 0xCCC1, 0xAB67, 0xCCC2, 0xAB68, 0xCCC3, 0xAB69, - 0xCCC4, 0xC3C0, 0xCCC5, 0xC3C1, 0xCCC6, 0xAB6A, 0xCCC7, 0xC3C2, - 0xCCC8, 0xAB6B, 0xCCC9, 0xC3C3, 0xCCCA, 0xAB6C, 0xCCCB, 0xAB6D, - 0xCCCC, 0xAB6E, 0xCCCD, 0xAB6F, 0xCCCE, 0xAB70, 0xCCCF, 0xAB71, - 0xCCD0, 0xC3C4, 0xCCD1, 0xAB72, 0xCCD2, 0xAB73, 0xCCD3, 0xAB74, - 0xCCD4, 0xC3C5, 0xCCD5, 0xAB75, 0xCCD6, 0xAB76, 0xCCD7, 0xAB77, - 0xCCD8, 0xAB78, 0xCCD9, 0xAB79, 0xCCDA, 0xAB7A, 0xCCDB, 0xAB81, - 0xCCDC, 0xAB82, 0xCCDD, 0xAB83, 0xCCDE, 0xAB84, 0xCCDF, 0xAB85, - 0xCCE0, 0xAB86, 0xCCE1, 0xAB87, 0xCCE2, 0xAB88, 0xCCE3, 0xAB89, - 0xCCE4, 0xC3C6, 0xCCE5, 0xAB8A, 0xCCE6, 0xAB8B, 0xCCE7, 0xAB8C, - 0xCCE8, 0xAB8D, 0xCCE9, 0xAB8E, 0xCCEA, 0xAB8F, 0xCCEB, 0xAB90, - 0xCCEC, 0xC3C7, 0xCCED, 0xAB91, 0xCCEE, 0xAB92, 0xCCEF, 0xAB93, - 0xCCF0, 0xC3C8, 0xCCF1, 0xAB94, 0xCCF2, 0xAB95, 0xCCF3, 0xAB96, - 0xCCF4, 0xAB97, 0xCCF5, 0xAB98, 0xCCF6, 0xAB99, 0xCCF7, 0xAB9A, - 0xCCF8, 0xAB9B, 0xCCF9, 0xAB9C, 0xCCFA, 0xAB9D, 0xCCFB, 0xAB9E, - 0xCCFC, 0xAB9F, 0xCCFD, 0xABA0, 0xCCFE, 0xAC41, 0xCCFF, 0xAC42, - 0xCD00, 0xAC43, 0xCD01, 0xC3C9, 0xCD02, 0xAC44, 0xCD03, 0xAC45, - 0xCD04, 0xAC46, 0xCD05, 0xAC47, 0xCD06, 0xAC48, 0xCD07, 0xAC49, - 0xCD08, 0xC3CA, 0xCD09, 0xC3CB, 0xCD0A, 0xAC4A, 0xCD0B, 0xAC4B, - 0xCD0C, 0xC3CC, 0xCD0D, 0xAC4C, 0xCD0E, 0xAC4D, 0xCD0F, 0xAC4E, - 0xCD10, 0xC3CD, 0xCD11, 0xAC4F, 0xCD12, 0xAC50, 0xCD13, 0xAC51, - 0xCD14, 0xAC52, 0xCD15, 0xAC53, 0xCD16, 0xAC54, 0xCD17, 0xAC55, - 0xCD18, 0xC3CE, 0xCD19, 0xC3CF, 0xCD1A, 0xAC56, 0xCD1B, 0xC3D0, - 0xCD1C, 0xAC57, 0xCD1D, 0xC3D1, 0xCD1E, 0xAC58, 0xCD1F, 0xAC59, - 0xCD20, 0xAC5A, 0xCD21, 0xAC61, 0xCD22, 0xAC62, 0xCD23, 0xAC63, - 0xCD24, 0xC3D2, 0xCD25, 0xAC64, 0xCD26, 0xAC65, 0xCD27, 0xAC66, - 0xCD28, 0xC3D3, 0xCD29, 0xAC67, 0xCD2A, 0xAC68, 0xCD2B, 0xAC69, - 0xCD2C, 0xC3D4, 0xCD2D, 0xAC6A, 0xCD2E, 0xAC6B, 0xCD2F, 0xAC6C, - 0xCD30, 0xAC6D, 0xCD31, 0xAC6E, 0xCD32, 0xAC6F, 0xCD33, 0xAC70, - 0xCD34, 0xAC71, 0xCD35, 0xAC72, 0xCD36, 0xAC73, 0xCD37, 0xAC74, - 0xCD38, 0xAC75, 0xCD39, 0xC3D5, 0xCD3A, 0xAC76, 0xCD3B, 0xAC77, - 0xCD3C, 0xAC78, 0xCD3D, 0xAC79, 0xCD3E, 0xAC7A, 0xCD3F, 0xAC81, - 0xCD40, 0xAC82, 0xCD41, 0xAC83, 0xCD42, 0xAC84, 0xCD43, 0xAC85, - 0xCD44, 0xAC86, 0xCD45, 0xAC87, 0xCD46, 0xAC88, 0xCD47, 0xAC89, - 0xCD48, 0xAC8A, 0xCD49, 0xAC8B, 0xCD4A, 0xAC8C, 0xCD4B, 0xAC8D, - 0xCD4C, 0xAC8E, 0xCD4D, 0xAC8F, 0xCD4E, 0xAC90, 0xCD4F, 0xAC91, - 0xCD50, 0xAC92, 0xCD51, 0xAC93, 0xCD52, 0xAC94, 0xCD53, 0xAC95, - 0xCD54, 0xAC96, 0xCD55, 0xAC97, 0xCD56, 0xAC98, 0xCD57, 0xAC99, - 0xCD58, 0xAC9A, 0xCD59, 0xAC9B, 0xCD5A, 0xAC9C, 0xCD5B, 0xAC9D, - 0xCD5C, 0xC3D6, 0xCD5D, 0xAC9E, 0xCD5E, 0xAC9F, 0xCD5F, 0xACA0, - 0xCD60, 0xC3D7, 0xCD61, 0xAD41, 0xCD62, 0xAD42, 0xCD63, 0xAD43, - 0xCD64, 0xC3D8, 0xCD65, 0xAD44, 0xCD66, 0xAD45, 0xCD67, 0xAD46, - 0xCD68, 0xAD47, 0xCD69, 0xAD48, 0xCD6A, 0xAD49, 0xCD6B, 0xAD4A, - 0xCD6C, 0xC3D9, 0xCD6D, 0xC3DA, 0xCD6E, 0xAD4B, 0xCD6F, 0xC3DB, - 0xCD70, 0xAD4C, 0xCD71, 0xC3DC, 0xCD72, 0xAD4D, 0xCD73, 0xAD4E, - 0xCD74, 0xAD4F, 0xCD75, 0xAD50, 0xCD76, 0xAD51, 0xCD77, 0xAD52, - 0xCD78, 0xC3DD, 0xCD79, 0xAD53, 0xCD7A, 0xAD54, 0xCD7B, 0xAD55, - 0xCD7C, 0xAD56, 0xCD7D, 0xAD57, 0xCD7E, 0xAD58, 0xCD7F, 0xAD59, - 0xCD80, 0xAD5A, 0xCD81, 0xAD61, 0xCD82, 0xAD62, 0xCD83, 0xAD63, - 0xCD84, 0xAD64, 0xCD85, 0xAD65, 0xCD86, 0xAD66, 0xCD87, 0xAD67, - 0xCD88, 0xC3DE, 0xCD89, 0xAD68, 0xCD8A, 0xAD69, 0xCD8B, 0xAD6A, - 0xCD8C, 0xAD6B, 0xCD8D, 0xAD6C, 0xCD8E, 0xAD6D, 0xCD8F, 0xAD6E, - 0xCD90, 0xAD6F, 0xCD91, 0xAD70, 0xCD92, 0xAD71, 0xCD93, 0xAD72, - 0xCD94, 0xC3DF, 0xCD95, 0xC3E0, 0xCD96, 0xAD73, 0xCD97, 0xAD74, - 0xCD98, 0xC3E1, 0xCD99, 0xAD75, 0xCD9A, 0xAD76, 0xCD9B, 0xAD77, - 0xCD9C, 0xC3E2, 0xCD9D, 0xAD78, 0xCD9E, 0xAD79, 0xCD9F, 0xAD7A, - 0xCDA0, 0xAD81, 0xCDA1, 0xAD82, 0xCDA2, 0xAD83, 0xCDA3, 0xAD84, - 0xCDA4, 0xC3E3, 0xCDA5, 0xC3E4, 0xCDA6, 0xAD85, 0xCDA7, 0xC3E5, - 0xCDA8, 0xAD86, 0xCDA9, 0xC3E6, 0xCDAA, 0xAD87, 0xCDAB, 0xAD88, - 0xCDAC, 0xAD89, 0xCDAD, 0xAD8A, 0xCDAE, 0xAD8B, 0xCDAF, 0xAD8C, - 0xCDB0, 0xC3E7, 0xCDB1, 0xAD8D, 0xCDB2, 0xAD8E, 0xCDB3, 0xAD8F, - 0xCDB4, 0xAD90, 0xCDB5, 0xAD91, 0xCDB6, 0xAD92, 0xCDB7, 0xAD93, - 0xCDB8, 0xAD94, 0xCDB9, 0xAD95, 0xCDBA, 0xAD96, 0xCDBB, 0xAD97, - 0xCDBC, 0xAD98, 0xCDBD, 0xAD99, 0xCDBE, 0xAD9A, 0xCDBF, 0xAD9B, - 0xCDC0, 0xAD9C, 0xCDC1, 0xAD9D, 0xCDC2, 0xAD9E, 0xCDC3, 0xAD9F, - 0xCDC4, 0xC3E8, 0xCDC5, 0xADA0, 0xCDC6, 0xAE41, 0xCDC7, 0xAE42, - 0xCDC8, 0xAE43, 0xCDC9, 0xAE44, 0xCDCA, 0xAE45, 0xCDCB, 0xAE46, - 0xCDCC, 0xC3E9, 0xCDCD, 0xAE47, 0xCDCE, 0xAE48, 0xCDCF, 0xAE49, - 0xCDD0, 0xC3EA, 0xCDD1, 0xAE4A, 0xCDD2, 0xAE4B, 0xCDD3, 0xAE4C, - 0xCDD4, 0xAE4D, 0xCDD5, 0xAE4E, 0xCDD6, 0xAE4F, 0xCDD7, 0xAE50, - 0xCDD8, 0xAE51, 0xCDD9, 0xAE52, 0xCDDA, 0xAE53, 0xCDDB, 0xAE54, - 0xCDDC, 0xAE55, 0xCDDD, 0xAE56, 0xCDDE, 0xAE57, 0xCDDF, 0xAE58, - 0xCDE0, 0xAE59, 0xCDE1, 0xAE5A, 0xCDE2, 0xAE61, 0xCDE3, 0xAE62, - 0xCDE4, 0xAE63, 0xCDE5, 0xAE64, 0xCDE6, 0xAE65, 0xCDE7, 0xAE66, - 0xCDE8, 0xC3EB, 0xCDE9, 0xAE67, 0xCDEA, 0xAE68, 0xCDEB, 0xAE69, - 0xCDEC, 0xC3EC, 0xCDED, 0xAE6A, 0xCDEE, 0xAE6B, 0xCDEF, 0xAE6C, - 0xCDF0, 0xC3ED, 0xCDF1, 0xAE6D, 0xCDF2, 0xAE6E, 0xCDF3, 0xAE6F, - 0xCDF4, 0xAE70, 0xCDF5, 0xAE71, 0xCDF6, 0xAE72, 0xCDF7, 0xAE73, - 0xCDF8, 0xC3EE, 0xCDF9, 0xC3EF, 0xCDFA, 0xAE74, 0xCDFB, 0xC3F0, - 0xCDFC, 0xAE75, 0xCDFD, 0xC3F1, 0xCDFE, 0xAE76, 0xCDFF, 0xAE77, - 0xCE00, 0xAE78, 0xCE01, 0xAE79, 0xCE02, 0xAE7A, 0xCE03, 0xAE81, - 0xCE04, 0xC3F2, 0xCE05, 0xAE82, 0xCE06, 0xAE83, 0xCE07, 0xAE84, - 0xCE08, 0xC3F3, 0xCE09, 0xAE85, 0xCE0A, 0xAE86, 0xCE0B, 0xAE87, - 0xCE0C, 0xC3F4, 0xCE0D, 0xAE88, 0xCE0E, 0xAE89, 0xCE0F, 0xAE8A, - 0xCE10, 0xAE8B, 0xCE11, 0xAE8C, 0xCE12, 0xAE8D, 0xCE13, 0xAE8E, - 0xCE14, 0xC3F5, 0xCE15, 0xAE8F, 0xCE16, 0xAE90, 0xCE17, 0xAE91, - 0xCE18, 0xAE92, 0xCE19, 0xC3F6, 0xCE1A, 0xAE93, 0xCE1B, 0xAE94, - 0xCE1C, 0xAE95, 0xCE1D, 0xAE96, 0xCE1E, 0xAE97, 0xCE1F, 0xAE98, - 0xCE20, 0xC3F7, 0xCE21, 0xC3F8, 0xCE22, 0xAE99, 0xCE23, 0xAE9A, - 0xCE24, 0xC3F9, 0xCE25, 0xAE9B, 0xCE26, 0xAE9C, 0xCE27, 0xAE9D, - 0xCE28, 0xC3FA, 0xCE29, 0xAE9E, 0xCE2A, 0xAE9F, 0xCE2B, 0xAEA0, - 0xCE2C, 0xAF41, 0xCE2D, 0xAF42, 0xCE2E, 0xAF43, 0xCE2F, 0xAF44, - 0xCE30, 0xC3FB, 0xCE31, 0xC3FC, 0xCE32, 0xAF45, 0xCE33, 0xC3FD, - 0xCE34, 0xAF46, 0xCE35, 0xC3FE, 0xCE36, 0xAF47, 0xCE37, 0xAF48, - 0xCE38, 0xAF49, 0xCE39, 0xAF4A, 0xCE3A, 0xAF4B, 0xCE3B, 0xAF4C, - 0xCE3C, 0xAF4D, 0xCE3D, 0xAF4E, 0xCE3E, 0xAF4F, 0xCE3F, 0xAF50, - 0xCE40, 0xAF51, 0xCE41, 0xAF52, 0xCE42, 0xAF53, 0xCE43, 0xAF54, - 0xCE44, 0xAF55, 0xCE45, 0xAF56, 0xCE46, 0xAF57, 0xCE47, 0xAF58, - 0xCE48, 0xAF59, 0xCE49, 0xAF5A, 0xCE4A, 0xAF61, 0xCE4B, 0xAF62, - 0xCE4C, 0xAF63, 0xCE4D, 0xAF64, 0xCE4E, 0xAF65, 0xCE4F, 0xAF66, - 0xCE50, 0xAF67, 0xCE51, 0xAF68, 0xCE52, 0xAF69, 0xCE53, 0xAF6A, - 0xCE54, 0xAF6B, 0xCE55, 0xAF6C, 0xCE56, 0xAF6D, 0xCE57, 0xAF6E, - 0xCE58, 0xC4A1, 0xCE59, 0xC4A2, 0xCE5A, 0xAF6F, 0xCE5B, 0xAF70, - 0xCE5C, 0xC4A3, 0xCE5D, 0xAF71, 0xCE5E, 0xAF72, 0xCE5F, 0xC4A4, - 0xCE60, 0xC4A5, 0xCE61, 0xC4A6, 0xCE62, 0xAF73, 0xCE63, 0xAF74, - 0xCE64, 0xAF75, 0xCE65, 0xAF76, 0xCE66, 0xAF77, 0xCE67, 0xAF78, - 0xCE68, 0xC4A7, 0xCE69, 0xC4A8, 0xCE6A, 0xAF79, 0xCE6B, 0xC4A9, - 0xCE6C, 0xAF7A, 0xCE6D, 0xC4AA, 0xCE6E, 0xAF81, 0xCE6F, 0xAF82, - 0xCE70, 0xAF83, 0xCE71, 0xAF84, 0xCE72, 0xAF85, 0xCE73, 0xAF86, - 0xCE74, 0xC4AB, 0xCE75, 0xC4AC, 0xCE76, 0xAF87, 0xCE77, 0xAF88, - 0xCE78, 0xC4AD, 0xCE79, 0xAF89, 0xCE7A, 0xAF8A, 0xCE7B, 0xAF8B, - 0xCE7C, 0xC4AE, 0xCE7D, 0xAF8C, 0xCE7E, 0xAF8D, 0xCE7F, 0xAF8E, - 0xCE80, 0xAF8F, 0xCE81, 0xAF90, 0xCE82, 0xAF91, 0xCE83, 0xAF92, - 0xCE84, 0xC4AF, 0xCE85, 0xC4B0, 0xCE86, 0xAF93, 0xCE87, 0xC4B1, - 0xCE88, 0xAF94, 0xCE89, 0xC4B2, 0xCE8A, 0xAF95, 0xCE8B, 0xAF96, - 0xCE8C, 0xAF97, 0xCE8D, 0xAF98, 0xCE8E, 0xAF99, 0xCE8F, 0xAF9A, - 0xCE90, 0xC4B3, 0xCE91, 0xC4B4, 0xCE92, 0xAF9B, 0xCE93, 0xAF9C, - 0xCE94, 0xC4B5, 0xCE95, 0xAF9D, 0xCE96, 0xAF9E, 0xCE97, 0xAF9F, - 0xCE98, 0xC4B6, 0xCE99, 0xAFA0, 0xCE9A, 0xB041, 0xCE9B, 0xB042, - 0xCE9C, 0xB043, 0xCE9D, 0xB044, 0xCE9E, 0xB045, 0xCE9F, 0xB046, - 0xCEA0, 0xC4B7, 0xCEA1, 0xC4B8, 0xCEA2, 0xB047, 0xCEA3, 0xC4B9, - 0xCEA4, 0xC4BA, 0xCEA5, 0xC4BB, 0xCEA6, 0xB048, 0xCEA7, 0xB049, - 0xCEA8, 0xB04A, 0xCEA9, 0xB04B, 0xCEAA, 0xB04C, 0xCEAB, 0xB04D, - 0xCEAC, 0xC4BC, 0xCEAD, 0xC4BD, 0xCEAE, 0xB04E, 0xCEAF, 0xB04F, - 0xCEB0, 0xB050, 0xCEB1, 0xB051, 0xCEB2, 0xB052, 0xCEB3, 0xB053, - 0xCEB4, 0xB054, 0xCEB5, 0xB055, 0xCEB6, 0xB056, 0xCEB7, 0xB057, - 0xCEB8, 0xB058, 0xCEB9, 0xB059, 0xCEBA, 0xB05A, 0xCEBB, 0xB061, - 0xCEBC, 0xB062, 0xCEBD, 0xB063, 0xCEBE, 0xB064, 0xCEBF, 0xB065, - 0xCEC0, 0xB066, 0xCEC1, 0xC4BE, 0xCEC2, 0xB067, 0xCEC3, 0xB068, - 0xCEC4, 0xB069, 0xCEC5, 0xB06A, 0xCEC6, 0xB06B, 0xCEC7, 0xB06C, - 0xCEC8, 0xB06D, 0xCEC9, 0xB06E, 0xCECA, 0xB06F, 0xCECB, 0xB070, - 0xCECC, 0xB071, 0xCECD, 0xB072, 0xCECE, 0xB073, 0xCECF, 0xB074, - 0xCED0, 0xB075, 0xCED1, 0xB076, 0xCED2, 0xB077, 0xCED3, 0xB078, - 0xCED4, 0xB079, 0xCED5, 0xB07A, 0xCED6, 0xB081, 0xCED7, 0xB082, - 0xCED8, 0xB083, 0xCED9, 0xB084, 0xCEDA, 0xB085, 0xCEDB, 0xB086, - 0xCEDC, 0xB087, 0xCEDD, 0xB088, 0xCEDE, 0xB089, 0xCEDF, 0xB08A, - 0xCEE0, 0xB08B, 0xCEE1, 0xB08C, 0xCEE2, 0xB08D, 0xCEE3, 0xB08E, - 0xCEE4, 0xC4BF, 0xCEE5, 0xC4C0, 0xCEE6, 0xB08F, 0xCEE7, 0xB090, - 0xCEE8, 0xC4C1, 0xCEE9, 0xB091, 0xCEEA, 0xB092, 0xCEEB, 0xC4C2, - 0xCEEC, 0xC4C3, 0xCEED, 0xB093, 0xCEEE, 0xB094, 0xCEEF, 0xB095, - 0xCEF0, 0xB096, 0xCEF1, 0xB097, 0xCEF2, 0xB098, 0xCEF3, 0xB099, - 0xCEF4, 0xC4C4, 0xCEF5, 0xC4C5, 0xCEF6, 0xB09A, 0xCEF7, 0xC4C6, - 0xCEF8, 0xC4C7, 0xCEF9, 0xC4C8, 0xCEFA, 0xB09B, 0xCEFB, 0xB09C, - 0xCEFC, 0xB09D, 0xCEFD, 0xB09E, 0xCEFE, 0xB09F, 0xCEFF, 0xB0A0, - 0xCF00, 0xC4C9, 0xCF01, 0xC4CA, 0xCF02, 0xB141, 0xCF03, 0xB142, - 0xCF04, 0xC4CB, 0xCF05, 0xB143, 0xCF06, 0xB144, 0xCF07, 0xB145, - 0xCF08, 0xC4CC, 0xCF09, 0xB146, 0xCF0A, 0xB147, 0xCF0B, 0xB148, - 0xCF0C, 0xB149, 0xCF0D, 0xB14A, 0xCF0E, 0xB14B, 0xCF0F, 0xB14C, - 0xCF10, 0xC4CD, 0xCF11, 0xC4CE, 0xCF12, 0xB14D, 0xCF13, 0xC4CF, - 0xCF14, 0xB14E, 0xCF15, 0xC4D0, 0xCF16, 0xB14F, 0xCF17, 0xB150, - 0xCF18, 0xB151, 0xCF19, 0xB152, 0xCF1A, 0xB153, 0xCF1B, 0xB154, - 0xCF1C, 0xC4D1, 0xCF1D, 0xB155, 0xCF1E, 0xB156, 0xCF1F, 0xB157, - 0xCF20, 0xC4D2, 0xCF21, 0xB158, 0xCF22, 0xB159, 0xCF23, 0xB15A, - 0xCF24, 0xC4D3, 0xCF25, 0xB161, 0xCF26, 0xB162, 0xCF27, 0xB163, - 0xCF28, 0xB164, 0xCF29, 0xB165, 0xCF2A, 0xB166, 0xCF2B, 0xB167, - 0xCF2C, 0xC4D4, 0xCF2D, 0xC4D5, 0xCF2E, 0xB168, 0xCF2F, 0xC4D6, - 0xCF30, 0xC4D7, 0xCF31, 0xC4D8, 0xCF32, 0xB169, 0xCF33, 0xB16A, - 0xCF34, 0xB16B, 0xCF35, 0xB16C, 0xCF36, 0xB16D, 0xCF37, 0xB16E, - 0xCF38, 0xC4D9, 0xCF39, 0xB16F, 0xCF3A, 0xB170, 0xCF3B, 0xB171, - 0xCF3C, 0xB172, 0xCF3D, 0xB173, 0xCF3E, 0xB174, 0xCF3F, 0xB175, - 0xCF40, 0xB176, 0xCF41, 0xB177, 0xCF42, 0xB178, 0xCF43, 0xB179, - 0xCF44, 0xB17A, 0xCF45, 0xB181, 0xCF46, 0xB182, 0xCF47, 0xB183, - 0xCF48, 0xB184, 0xCF49, 0xB185, 0xCF4A, 0xB186, 0xCF4B, 0xB187, - 0xCF4C, 0xB188, 0xCF4D, 0xB189, 0xCF4E, 0xB18A, 0xCF4F, 0xB18B, - 0xCF50, 0xB18C, 0xCF51, 0xB18D, 0xCF52, 0xB18E, 0xCF53, 0xB18F, - 0xCF54, 0xC4DA, 0xCF55, 0xC4DB, 0xCF56, 0xB190, 0xCF57, 0xB191, - 0xCF58, 0xC4DC, 0xCF59, 0xB192, 0xCF5A, 0xB193, 0xCF5B, 0xB194, - 0xCF5C, 0xC4DD, 0xCF5D, 0xB195, 0xCF5E, 0xB196, 0xCF5F, 0xB197, - 0xCF60, 0xB198, 0xCF61, 0xB199, 0xCF62, 0xB19A, 0xCF63, 0xB19B, - 0xCF64, 0xC4DE, 0xCF65, 0xC4DF, 0xCF66, 0xB19C, 0xCF67, 0xC4E0, - 0xCF68, 0xB19D, 0xCF69, 0xC4E1, 0xCF6A, 0xB19E, 0xCF6B, 0xB19F, - 0xCF6C, 0xB1A0, 0xCF6D, 0xB241, 0xCF6E, 0xB242, 0xCF6F, 0xB243, - 0xCF70, 0xC4E2, 0xCF71, 0xC4E3, 0xCF72, 0xB244, 0xCF73, 0xB245, - 0xCF74, 0xC4E4, 0xCF75, 0xB246, 0xCF76, 0xB247, 0xCF77, 0xB248, - 0xCF78, 0xC4E5, 0xCF79, 0xB249, 0xCF7A, 0xB24A, 0xCF7B, 0xB24B, - 0xCF7C, 0xB24C, 0xCF7D, 0xB24D, 0xCF7E, 0xB24E, 0xCF7F, 0xB24F, - 0xCF80, 0xC4E6, 0xCF81, 0xB250, 0xCF82, 0xB251, 0xCF83, 0xB252, - 0xCF84, 0xB253, 0xCF85, 0xC4E7, 0xCF86, 0xB254, 0xCF87, 0xB255, - 0xCF88, 0xB256, 0xCF89, 0xB257, 0xCF8A, 0xB258, 0xCF8B, 0xB259, - 0xCF8C, 0xC4E8, 0xCF8D, 0xB25A, 0xCF8E, 0xB261, 0xCF8F, 0xB262, - 0xCF90, 0xB263, 0xCF91, 0xB264, 0xCF92, 0xB265, 0xCF93, 0xB266, - 0xCF94, 0xB267, 0xCF95, 0xB268, 0xCF96, 0xB269, 0xCF97, 0xB26A, - 0xCF98, 0xB26B, 0xCF99, 0xB26C, 0xCF9A, 0xB26D, 0xCF9B, 0xB26E, - 0xCF9C, 0xB26F, 0xCF9D, 0xB270, 0xCF9E, 0xB271, 0xCF9F, 0xB272, - 0xCFA0, 0xB273, 0xCFA1, 0xC4E9, 0xCFA2, 0xB274, 0xCFA3, 0xB275, - 0xCFA4, 0xB276, 0xCFA5, 0xB277, 0xCFA6, 0xB278, 0xCFA7, 0xB279, - 0xCFA8, 0xC4EA, 0xCFA9, 0xB27A, 0xCFAA, 0xB281, 0xCFAB, 0xB282, - 0xCFAC, 0xB283, 0xCFAD, 0xB284, 0xCFAE, 0xB285, 0xCFAF, 0xB286, - 0xCFB0, 0xC4EB, 0xCFB1, 0xB287, 0xCFB2, 0xB288, 0xCFB3, 0xB289, - 0xCFB4, 0xB28A, 0xCFB5, 0xB28B, 0xCFB6, 0xB28C, 0xCFB7, 0xB28D, - 0xCFB8, 0xB28E, 0xCFB9, 0xB28F, 0xCFBA, 0xB290, 0xCFBB, 0xB291, - 0xCFBC, 0xB292, 0xCFBD, 0xB293, 0xCFBE, 0xB294, 0xCFBF, 0xB295, - 0xCFC0, 0xB296, 0xCFC1, 0xB297, 0xCFC2, 0xB298, 0xCFC3, 0xB299, - 0xCFC4, 0xC4EC, 0xCFC5, 0xB29A, 0xCFC6, 0xB29B, 0xCFC7, 0xB29C, - 0xCFC8, 0xB29D, 0xCFC9, 0xB29E, 0xCFCA, 0xB29F, 0xCFCB, 0xB2A0, - 0xCFCC, 0xB341, 0xCFCD, 0xB342, 0xCFCE, 0xB343, 0xCFCF, 0xB344, - 0xCFD0, 0xB345, 0xCFD1, 0xB346, 0xCFD2, 0xB347, 0xCFD3, 0xB348, - 0xCFD4, 0xB349, 0xCFD5, 0xB34A, 0xCFD6, 0xB34B, 0xCFD7, 0xB34C, - 0xCFD8, 0xB34D, 0xCFD9, 0xB34E, 0xCFDA, 0xB34F, 0xCFDB, 0xB350, - 0xCFDC, 0xB351, 0xCFDD, 0xB352, 0xCFDE, 0xB353, 0xCFDF, 0xB354, - 0xCFE0, 0xC4ED, 0xCFE1, 0xC4EE, 0xCFE2, 0xB355, 0xCFE3, 0xB356, - 0xCFE4, 0xC4EF, 0xCFE5, 0xB357, 0xCFE6, 0xB358, 0xCFE7, 0xB359, - 0xCFE8, 0xC4F0, 0xCFE9, 0xB35A, 0xCFEA, 0xB361, 0xCFEB, 0xB362, - 0xCFEC, 0xB363, 0xCFED, 0xB364, 0xCFEE, 0xB365, 0xCFEF, 0xB366, - 0xCFF0, 0xC4F1, 0xCFF1, 0xC4F2, 0xCFF2, 0xB367, 0xCFF3, 0xC4F3, - 0xCFF4, 0xB368, 0xCFF5, 0xC4F4, 0xCFF6, 0xB369, 0xCFF7, 0xB36A, - 0xCFF8, 0xB36B, 0xCFF9, 0xB36C, 0xCFFA, 0xB36D, 0xCFFB, 0xB36E, - 0xCFFC, 0xC4F5, 0xCFFD, 0xB36F, 0xCFFE, 0xB370, 0xCFFF, 0xB371, - 0xD000, 0xC4F6, 0xD001, 0xB372, 0xD002, 0xB373, 0xD003, 0xB374, - 0xD004, 0xC4F7, 0xD005, 0xB375, 0xD006, 0xB376, 0xD007, 0xB377, - 0xD008, 0xB378, 0xD009, 0xB379, 0xD00A, 0xB37A, 0xD00B, 0xB381, - 0xD00C, 0xB382, 0xD00D, 0xB383, 0xD00E, 0xB384, 0xD00F, 0xB385, - 0xD010, 0xB386, 0xD011, 0xC4F8, 0xD012, 0xB387, 0xD013, 0xB388, - 0xD014, 0xB389, 0xD015, 0xB38A, 0xD016, 0xB38B, 0xD017, 0xB38C, - 0xD018, 0xC4F9, 0xD019, 0xB38D, 0xD01A, 0xB38E, 0xD01B, 0xB38F, - 0xD01C, 0xB390, 0xD01D, 0xB391, 0xD01E, 0xB392, 0xD01F, 0xB393, - 0xD020, 0xB394, 0xD021, 0xB395, 0xD022, 0xB396, 0xD023, 0xB397, - 0xD024, 0xB398, 0xD025, 0xB399, 0xD026, 0xB39A, 0xD027, 0xB39B, - 0xD028, 0xB39C, 0xD029, 0xB39D, 0xD02A, 0xB39E, 0xD02B, 0xB39F, - 0xD02C, 0xB3A0, 0xD02D, 0xC4FA, 0xD02E, 0xB441, 0xD02F, 0xB442, - 0xD030, 0xB443, 0xD031, 0xB444, 0xD032, 0xB445, 0xD033, 0xB446, - 0xD034, 0xC4FB, 0xD035, 0xC4FC, 0xD036, 0xB447, 0xD037, 0xB448, - 0xD038, 0xC4FD, 0xD039, 0xB449, 0xD03A, 0xB44A, 0xD03B, 0xB44B, - 0xD03C, 0xC4FE, 0xD03D, 0xB44C, 0xD03E, 0xB44D, 0xD03F, 0xB44E, - 0xD040, 0xB44F, 0xD041, 0xB450, 0xD042, 0xB451, 0xD043, 0xB452, - 0xD044, 0xC5A1, 0xD045, 0xC5A2, 0xD046, 0xB453, 0xD047, 0xC5A3, - 0xD048, 0xB454, 0xD049, 0xC5A4, 0xD04A, 0xB455, 0xD04B, 0xB456, - 0xD04C, 0xB457, 0xD04D, 0xB458, 0xD04E, 0xB459, 0xD04F, 0xB45A, - 0xD050, 0xC5A5, 0xD051, 0xB461, 0xD052, 0xB462, 0xD053, 0xB463, - 0xD054, 0xC5A6, 0xD055, 0xB464, 0xD056, 0xB465, 0xD057, 0xB466, - 0xD058, 0xC5A7, 0xD059, 0xB467, 0xD05A, 0xB468, 0xD05B, 0xB469, - 0xD05C, 0xB46A, 0xD05D, 0xB46B, 0xD05E, 0xB46C, 0xD05F, 0xB46D, - 0xD060, 0xC5A8, 0xD061, 0xB46E, 0xD062, 0xB46F, 0xD063, 0xB470, - 0xD064, 0xB471, 0xD065, 0xB472, 0xD066, 0xB473, 0xD067, 0xB474, - 0xD068, 0xB475, 0xD069, 0xB476, 0xD06A, 0xB477, 0xD06B, 0xB478, - 0xD06C, 0xC5A9, 0xD06D, 0xC5AA, 0xD06E, 0xB479, 0xD06F, 0xB47A, - 0xD070, 0xC5AB, 0xD071, 0xB481, 0xD072, 0xB482, 0xD073, 0xB483, - 0xD074, 0xC5AC, 0xD075, 0xB484, 0xD076, 0xB485, 0xD077, 0xB486, - 0xD078, 0xB487, 0xD079, 0xB488, 0xD07A, 0xB489, 0xD07B, 0xB48A, - 0xD07C, 0xC5AD, 0xD07D, 0xC5AE, 0xD07E, 0xB48B, 0xD07F, 0xB48C, - 0xD080, 0xB48D, 0xD081, 0xC5AF, 0xD082, 0xB48E, 0xD083, 0xB48F, - 0xD084, 0xB490, 0xD085, 0xB491, 0xD086, 0xB492, 0xD087, 0xB493, - 0xD088, 0xB494, 0xD089, 0xB495, 0xD08A, 0xB496, 0xD08B, 0xB497, - 0xD08C, 0xB498, 0xD08D, 0xB499, 0xD08E, 0xB49A, 0xD08F, 0xB49B, - 0xD090, 0xB49C, 0xD091, 0xB49D, 0xD092, 0xB49E, 0xD093, 0xB49F, - 0xD094, 0xB4A0, 0xD095, 0xB541, 0xD096, 0xB542, 0xD097, 0xB543, - 0xD098, 0xB544, 0xD099, 0xB545, 0xD09A, 0xB546, 0xD09B, 0xB547, - 0xD09C, 0xB548, 0xD09D, 0xB549, 0xD09E, 0xB54A, 0xD09F, 0xB54B, - 0xD0A0, 0xB54C, 0xD0A1, 0xB54D, 0xD0A2, 0xB54E, 0xD0A3, 0xB54F, - 0xD0A4, 0xC5B0, 0xD0A5, 0xC5B1, 0xD0A6, 0xB550, 0xD0A7, 0xB551, - 0xD0A8, 0xC5B2, 0xD0A9, 0xB552, 0xD0AA, 0xB553, 0xD0AB, 0xB554, - 0xD0AC, 0xC5B3, 0xD0AD, 0xB555, 0xD0AE, 0xB556, 0xD0AF, 0xB557, - 0xD0B0, 0xB558, 0xD0B1, 0xB559, 0xD0B2, 0xB55A, 0xD0B3, 0xB561, - 0xD0B4, 0xC5B4, 0xD0B5, 0xC5B5, 0xD0B6, 0xB562, 0xD0B7, 0xC5B6, - 0xD0B8, 0xB563, 0xD0B9, 0xC5B7, 0xD0BA, 0xB564, 0xD0BB, 0xB565, - 0xD0BC, 0xB566, 0xD0BD, 0xB567, 0xD0BE, 0xB568, 0xD0BF, 0xB569, - 0xD0C0, 0xC5B8, 0xD0C1, 0xC5B9, 0xD0C2, 0xB56A, 0xD0C3, 0xB56B, - 0xD0C4, 0xC5BA, 0xD0C5, 0xB56C, 0xD0C6, 0xB56D, 0xD0C7, 0xB56E, - 0xD0C8, 0xC5BB, 0xD0C9, 0xC5BC, 0xD0CA, 0xB56F, 0xD0CB, 0xB570, - 0xD0CC, 0xB571, 0xD0CD, 0xB572, 0xD0CE, 0xB573, 0xD0CF, 0xB574, - 0xD0D0, 0xC5BD, 0xD0D1, 0xC5BE, 0xD0D2, 0xB575, 0xD0D3, 0xC5BF, - 0xD0D4, 0xC5C0, 0xD0D5, 0xC5C1, 0xD0D6, 0xB576, 0xD0D7, 0xB577, - 0xD0D8, 0xB578, 0xD0D9, 0xB579, 0xD0DA, 0xB57A, 0xD0DB, 0xB581, - 0xD0DC, 0xC5C2, 0xD0DD, 0xC5C3, 0xD0DE, 0xB582, 0xD0DF, 0xB583, - 0xD0E0, 0xC5C4, 0xD0E1, 0xB584, 0xD0E2, 0xB585, 0xD0E3, 0xB586, - 0xD0E4, 0xC5C5, 0xD0E5, 0xB587, 0xD0E6, 0xB588, 0xD0E7, 0xB589, - 0xD0E8, 0xB58A, 0xD0E9, 0xB58B, 0xD0EA, 0xB58C, 0xD0EB, 0xB58D, - 0xD0EC, 0xC5C6, 0xD0ED, 0xC5C7, 0xD0EE, 0xB58E, 0xD0EF, 0xC5C8, - 0xD0F0, 0xC5C9, 0xD0F1, 0xC5CA, 0xD0F2, 0xB58F, 0xD0F3, 0xB590, - 0xD0F4, 0xB591, 0xD0F5, 0xB592, 0xD0F6, 0xB593, 0xD0F7, 0xB594, - 0xD0F8, 0xC5CB, 0xD0F9, 0xB595, 0xD0FA, 0xB596, 0xD0FB, 0xB597, - 0xD0FC, 0xB598, 0xD0FD, 0xB599, 0xD0FE, 0xB59A, 0xD0FF, 0xB59B, - 0xD100, 0xB59C, 0xD101, 0xB59D, 0xD102, 0xB59E, 0xD103, 0xB59F, - 0xD104, 0xB5A0, 0xD105, 0xB641, 0xD106, 0xB642, 0xD107, 0xB643, - 0xD108, 0xB644, 0xD109, 0xB645, 0xD10A, 0xB646, 0xD10B, 0xB647, - 0xD10C, 0xB648, 0xD10D, 0xC5CC, 0xD10E, 0xB649, 0xD10F, 0xB64A, - 0xD110, 0xB64B, 0xD111, 0xB64C, 0xD112, 0xB64D, 0xD113, 0xB64E, - 0xD114, 0xB64F, 0xD115, 0xB650, 0xD116, 0xB651, 0xD117, 0xB652, - 0xD118, 0xB653, 0xD119, 0xB654, 0xD11A, 0xB655, 0xD11B, 0xB656, - 0xD11C, 0xB657, 0xD11D, 0xB658, 0xD11E, 0xB659, 0xD11F, 0xB65A, - 0xD120, 0xB661, 0xD121, 0xB662, 0xD122, 0xB663, 0xD123, 0xB664, - 0xD124, 0xB665, 0xD125, 0xB666, 0xD126, 0xB667, 0xD127, 0xB668, - 0xD128, 0xB669, 0xD129, 0xB66A, 0xD12A, 0xB66B, 0xD12B, 0xB66C, - 0xD12C, 0xB66D, 0xD12D, 0xB66E, 0xD12E, 0xB66F, 0xD12F, 0xB670, - 0xD130, 0xC5CD, 0xD131, 0xC5CE, 0xD132, 0xB671, 0xD133, 0xB672, - 0xD134, 0xC5CF, 0xD135, 0xB673, 0xD136, 0xB674, 0xD137, 0xB675, - 0xD138, 0xC5D0, 0xD139, 0xB676, 0xD13A, 0xC5D1, 0xD13B, 0xB677, - 0xD13C, 0xB678, 0xD13D, 0xB679, 0xD13E, 0xB67A, 0xD13F, 0xB681, - 0xD140, 0xC5D2, 0xD141, 0xC5D3, 0xD142, 0xB682, 0xD143, 0xC5D4, - 0xD144, 0xC5D5, 0xD145, 0xC5D6, 0xD146, 0xB683, 0xD147, 0xB684, - 0xD148, 0xB685, 0xD149, 0xB686, 0xD14A, 0xB687, 0xD14B, 0xB688, - 0xD14C, 0xC5D7, 0xD14D, 0xC5D8, 0xD14E, 0xB689, 0xD14F, 0xB68A, - 0xD150, 0xC5D9, 0xD151, 0xB68B, 0xD152, 0xB68C, 0xD153, 0xB68D, - 0xD154, 0xC5DA, 0xD155, 0xB68E, 0xD156, 0xB68F, 0xD157, 0xB690, - 0xD158, 0xB691, 0xD159, 0xB692, 0xD15A, 0xB693, 0xD15B, 0xB694, - 0xD15C, 0xC5DB, 0xD15D, 0xC5DC, 0xD15E, 0xB695, 0xD15F, 0xC5DD, - 0xD160, 0xB696, 0xD161, 0xC5DE, 0xD162, 0xB697, 0xD163, 0xB698, - 0xD164, 0xB699, 0xD165, 0xB69A, 0xD166, 0xB69B, 0xD167, 0xB69C, - 0xD168, 0xC5DF, 0xD169, 0xB69D, 0xD16A, 0xB69E, 0xD16B, 0xB69F, - 0xD16C, 0xC5E0, 0xD16D, 0xB6A0, 0xD16E, 0xB741, 0xD16F, 0xB742, - 0xD170, 0xB743, 0xD171, 0xB744, 0xD172, 0xB745, 0xD173, 0xB746, - 0xD174, 0xB747, 0xD175, 0xB748, 0xD176, 0xB749, 0xD177, 0xB74A, - 0xD178, 0xB74B, 0xD179, 0xB74C, 0xD17A, 0xB74D, 0xD17B, 0xB74E, - 0xD17C, 0xC5E1, 0xD17D, 0xB74F, 0xD17E, 0xB750, 0xD17F, 0xB751, - 0xD180, 0xB752, 0xD181, 0xB753, 0xD182, 0xB754, 0xD183, 0xB755, - 0xD184, 0xC5E2, 0xD185, 0xB756, 0xD186, 0xB757, 0xD187, 0xB758, - 0xD188, 0xC5E3, 0xD189, 0xB759, 0xD18A, 0xB75A, 0xD18B, 0xB761, - 0xD18C, 0xB762, 0xD18D, 0xB763, 0xD18E, 0xB764, 0xD18F, 0xB765, - 0xD190, 0xB766, 0xD191, 0xB767, 0xD192, 0xB768, 0xD193, 0xB769, - 0xD194, 0xB76A, 0xD195, 0xB76B, 0xD196, 0xB76C, 0xD197, 0xB76D, - 0xD198, 0xB76E, 0xD199, 0xB76F, 0xD19A, 0xB770, 0xD19B, 0xB771, - 0xD19C, 0xB772, 0xD19D, 0xB773, 0xD19E, 0xB774, 0xD19F, 0xB775, - 0xD1A0, 0xC5E4, 0xD1A1, 0xC5E5, 0xD1A2, 0xB776, 0xD1A3, 0xB777, - 0xD1A4, 0xC5E6, 0xD1A5, 0xB778, 0xD1A6, 0xB779, 0xD1A7, 0xB77A, - 0xD1A8, 0xC5E7, 0xD1A9, 0xB781, 0xD1AA, 0xB782, 0xD1AB, 0xB783, - 0xD1AC, 0xB784, 0xD1AD, 0xB785, 0xD1AE, 0xB786, 0xD1AF, 0xB787, - 0xD1B0, 0xC5E8, 0xD1B1, 0xC5E9, 0xD1B2, 0xB788, 0xD1B3, 0xC5EA, - 0xD1B4, 0xB789, 0xD1B5, 0xC5EB, 0xD1B6, 0xB78A, 0xD1B7, 0xB78B, - 0xD1B8, 0xB78C, 0xD1B9, 0xB78D, 0xD1BA, 0xC5EC, 0xD1BB, 0xB78E, - 0xD1BC, 0xC5ED, 0xD1BD, 0xB78F, 0xD1BE, 0xB790, 0xD1BF, 0xB791, - 0xD1C0, 0xC5EE, 0xD1C1, 0xB792, 0xD1C2, 0xB793, 0xD1C3, 0xB794, - 0xD1C4, 0xB795, 0xD1C5, 0xB796, 0xD1C6, 0xB797, 0xD1C7, 0xB798, - 0xD1C8, 0xB799, 0xD1C9, 0xB79A, 0xD1CA, 0xB79B, 0xD1CB, 0xB79C, - 0xD1CC, 0xB79D, 0xD1CD, 0xB79E, 0xD1CE, 0xB79F, 0xD1CF, 0xB7A0, - 0xD1D0, 0xB841, 0xD1D1, 0xB842, 0xD1D2, 0xB843, 0xD1D3, 0xB844, - 0xD1D4, 0xB845, 0xD1D5, 0xB846, 0xD1D6, 0xB847, 0xD1D7, 0xB848, - 0xD1D8, 0xC5EF, 0xD1D9, 0xB849, 0xD1DA, 0xB84A, 0xD1DB, 0xB84B, - 0xD1DC, 0xB84C, 0xD1DD, 0xB84D, 0xD1DE, 0xB84E, 0xD1DF, 0xB84F, - 0xD1E0, 0xB850, 0xD1E1, 0xB851, 0xD1E2, 0xB852, 0xD1E3, 0xB853, - 0xD1E4, 0xB854, 0xD1E5, 0xB855, 0xD1E6, 0xB856, 0xD1E7, 0xB857, - 0xD1E8, 0xB858, 0xD1E9, 0xB859, 0xD1EA, 0xB85A, 0xD1EB, 0xB861, - 0xD1EC, 0xB862, 0xD1ED, 0xB863, 0xD1EE, 0xB864, 0xD1EF, 0xB865, - 0xD1F0, 0xB866, 0xD1F1, 0xB867, 0xD1F2, 0xB868, 0xD1F3, 0xB869, - 0xD1F4, 0xC5F0, 0xD1F5, 0xB86A, 0xD1F6, 0xB86B, 0xD1F7, 0xB86C, - 0xD1F8, 0xC5F1, 0xD1F9, 0xB86D, 0xD1FA, 0xB86E, 0xD1FB, 0xB86F, - 0xD1FC, 0xB870, 0xD1FD, 0xB871, 0xD1FE, 0xB872, 0xD1FF, 0xB873, - 0xD200, 0xB874, 0xD201, 0xB875, 0xD202, 0xB876, 0xD203, 0xB877, - 0xD204, 0xB878, 0xD205, 0xB879, 0xD206, 0xB87A, 0xD207, 0xC5F2, - 0xD208, 0xB881, 0xD209, 0xC5F3, 0xD20A, 0xB882, 0xD20B, 0xB883, - 0xD20C, 0xB884, 0xD20D, 0xB885, 0xD20E, 0xB886, 0xD20F, 0xB887, - 0xD210, 0xC5F4, 0xD211, 0xB888, 0xD212, 0xB889, 0xD213, 0xB88A, - 0xD214, 0xB88B, 0xD215, 0xB88C, 0xD216, 0xB88D, 0xD217, 0xB88E, - 0xD218, 0xB88F, 0xD219, 0xB890, 0xD21A, 0xB891, 0xD21B, 0xB892, - 0xD21C, 0xB893, 0xD21D, 0xB894, 0xD21E, 0xB895, 0xD21F, 0xB896, - 0xD220, 0xB897, 0xD221, 0xB898, 0xD222, 0xB899, 0xD223, 0xB89A, - 0xD224, 0xB89B, 0xD225, 0xB89C, 0xD226, 0xB89D, 0xD227, 0xB89E, - 0xD228, 0xB89F, 0xD229, 0xB8A0, 0xD22A, 0xB941, 0xD22B, 0xB942, - 0xD22C, 0xC5F5, 0xD22D, 0xC5F6, 0xD22E, 0xB943, 0xD22F, 0xB944, - 0xD230, 0xC5F7, 0xD231, 0xB945, 0xD232, 0xB946, 0xD233, 0xB947, - 0xD234, 0xC5F8, 0xD235, 0xB948, 0xD236, 0xB949, 0xD237, 0xB94A, - 0xD238, 0xB94B, 0xD239, 0xB94C, 0xD23A, 0xB94D, 0xD23B, 0xB94E, - 0xD23C, 0xC5F9, 0xD23D, 0xC5FA, 0xD23E, 0xB94F, 0xD23F, 0xC5FB, - 0xD240, 0xB950, 0xD241, 0xC5FC, 0xD242, 0xB951, 0xD243, 0xB952, - 0xD244, 0xB953, 0xD245, 0xB954, 0xD246, 0xB955, 0xD247, 0xB956, - 0xD248, 0xC5FD, 0xD249, 0xB957, 0xD24A, 0xB958, 0xD24B, 0xB959, - 0xD24C, 0xB95A, 0xD24D, 0xB961, 0xD24E, 0xB962, 0xD24F, 0xB963, - 0xD250, 0xB964, 0xD251, 0xB965, 0xD252, 0xB966, 0xD253, 0xB967, - 0xD254, 0xB968, 0xD255, 0xB969, 0xD256, 0xB96A, 0xD257, 0xB96B, - 0xD258, 0xB96C, 0xD259, 0xB96D, 0xD25A, 0xB96E, 0xD25B, 0xB96F, - 0xD25C, 0xC5FE, 0xD25D, 0xB970, 0xD25E, 0xB971, 0xD25F, 0xB972, - 0xD260, 0xB973, 0xD261, 0xB974, 0xD262, 0xB975, 0xD263, 0xB976, - 0xD264, 0xC6A1, 0xD265, 0xB977, 0xD266, 0xB978, 0xD267, 0xB979, - 0xD268, 0xB97A, 0xD269, 0xB981, 0xD26A, 0xB982, 0xD26B, 0xB983, - 0xD26C, 0xB984, 0xD26D, 0xB985, 0xD26E, 0xB986, 0xD26F, 0xB987, - 0xD270, 0xB988, 0xD271, 0xB989, 0xD272, 0xB98A, 0xD273, 0xB98B, - 0xD274, 0xB98C, 0xD275, 0xB98D, 0xD276, 0xB98E, 0xD277, 0xB98F, - 0xD278, 0xB990, 0xD279, 0xB991, 0xD27A, 0xB992, 0xD27B, 0xB993, - 0xD27C, 0xB994, 0xD27D, 0xB995, 0xD27E, 0xB996, 0xD27F, 0xB997, - 0xD280, 0xC6A2, 0xD281, 0xC6A3, 0xD282, 0xB998, 0xD283, 0xB999, - 0xD284, 0xC6A4, 0xD285, 0xB99A, 0xD286, 0xB99B, 0xD287, 0xB99C, - 0xD288, 0xC6A5, 0xD289, 0xB99D, 0xD28A, 0xB99E, 0xD28B, 0xB99F, - 0xD28C, 0xB9A0, 0xD28D, 0xBA41, 0xD28E, 0xBA42, 0xD28F, 0xBA43, - 0xD290, 0xC6A6, 0xD291, 0xC6A7, 0xD292, 0xBA44, 0xD293, 0xBA45, - 0xD294, 0xBA46, 0xD295, 0xC6A8, 0xD296, 0xBA47, 0xD297, 0xBA48, - 0xD298, 0xBA49, 0xD299, 0xBA4A, 0xD29A, 0xBA4B, 0xD29B, 0xBA4C, - 0xD29C, 0xC6A9, 0xD29D, 0xBA4D, 0xD29E, 0xBA4E, 0xD29F, 0xBA4F, - 0xD2A0, 0xC6AA, 0xD2A1, 0xBA50, 0xD2A2, 0xBA51, 0xD2A3, 0xBA52, - 0xD2A4, 0xC6AB, 0xD2A5, 0xBA53, 0xD2A6, 0xBA54, 0xD2A7, 0xBA55, - 0xD2A8, 0xBA56, 0xD2A9, 0xBA57, 0xD2AA, 0xBA58, 0xD2AB, 0xBA59, - 0xD2AC, 0xC6AC, 0xD2AD, 0xBA5A, 0xD2AE, 0xBA61, 0xD2AF, 0xBA62, - 0xD2B0, 0xBA63, 0xD2B1, 0xC6AD, 0xD2B2, 0xBA64, 0xD2B3, 0xBA65, - 0xD2B4, 0xBA66, 0xD2B5, 0xBA67, 0xD2B6, 0xBA68, 0xD2B7, 0xBA69, - 0xD2B8, 0xC6AE, 0xD2B9, 0xC6AF, 0xD2BA, 0xBA6A, 0xD2BB, 0xBA6B, - 0xD2BC, 0xC6B0, 0xD2BD, 0xBA6C, 0xD2BE, 0xBA6D, 0xD2BF, 0xC6B1, - 0xD2C0, 0xC6B2, 0xD2C1, 0xBA6E, 0xD2C2, 0xC6B3, 0xD2C3, 0xBA6F, - 0xD2C4, 0xBA70, 0xD2C5, 0xBA71, 0xD2C6, 0xBA72, 0xD2C7, 0xBA73, - 0xD2C8, 0xC6B4, 0xD2C9, 0xC6B5, 0xD2CA, 0xBA74, 0xD2CB, 0xC6B6, - 0xD2CC, 0xBA75, 0xD2CD, 0xBA76, 0xD2CE, 0xBA77, 0xD2CF, 0xBA78, - 0xD2D0, 0xBA79, 0xD2D1, 0xBA7A, 0xD2D2, 0xBA81, 0xD2D3, 0xBA82, - 0xD2D4, 0xC6B7, 0xD2D5, 0xBA83, 0xD2D6, 0xBA84, 0xD2D7, 0xBA85, - 0xD2D8, 0xC6B8, 0xD2D9, 0xBA86, 0xD2DA, 0xBA87, 0xD2DB, 0xBA88, - 0xD2DC, 0xC6B9, 0xD2DD, 0xBA89, 0xD2DE, 0xBA8A, 0xD2DF, 0xBA8B, - 0xD2E0, 0xBA8C, 0xD2E1, 0xBA8D, 0xD2E2, 0xBA8E, 0xD2E3, 0xBA8F, - 0xD2E4, 0xC6BA, 0xD2E5, 0xC6BB, 0xD2E6, 0xBA90, 0xD2E7, 0xBA91, - 0xD2E8, 0xBA92, 0xD2E9, 0xBA93, 0xD2EA, 0xBA94, 0xD2EB, 0xBA95, - 0xD2EC, 0xBA96, 0xD2ED, 0xBA97, 0xD2EE, 0xBA98, 0xD2EF, 0xBA99, - 0xD2F0, 0xC6BC, 0xD2F1, 0xC6BD, 0xD2F2, 0xBA9A, 0xD2F3, 0xBA9B, - 0xD2F4, 0xC6BE, 0xD2F5, 0xBA9C, 0xD2F6, 0xBA9D, 0xD2F7, 0xBA9E, - 0xD2F8, 0xC6BF, 0xD2F9, 0xBA9F, 0xD2FA, 0xBAA0, 0xD2FB, 0xBB41, - 0xD2FC, 0xBB42, 0xD2FD, 0xBB43, 0xD2FE, 0xBB44, 0xD2FF, 0xBB45, - 0xD300, 0xC6C0, 0xD301, 0xC6C1, 0xD302, 0xBB46, 0xD303, 0xC6C2, - 0xD304, 0xBB47, 0xD305, 0xC6C3, 0xD306, 0xBB48, 0xD307, 0xBB49, - 0xD308, 0xBB4A, 0xD309, 0xBB4B, 0xD30A, 0xBB4C, 0xD30B, 0xBB4D, - 0xD30C, 0xC6C4, 0xD30D, 0xC6C5, 0xD30E, 0xC6C6, 0xD30F, 0xBB4E, - 0xD310, 0xC6C7, 0xD311, 0xBB4F, 0xD312, 0xBB50, 0xD313, 0xBB51, - 0xD314, 0xC6C8, 0xD315, 0xBB52, 0xD316, 0xC6C9, 0xD317, 0xBB53, - 0xD318, 0xBB54, 0xD319, 0xBB55, 0xD31A, 0xBB56, 0xD31B, 0xBB57, - 0xD31C, 0xC6CA, 0xD31D, 0xC6CB, 0xD31E, 0xBB58, 0xD31F, 0xC6CC, - 0xD320, 0xC6CD, 0xD321, 0xC6CE, 0xD322, 0xBB59, 0xD323, 0xBB5A, - 0xD324, 0xBB61, 0xD325, 0xC6CF, 0xD326, 0xBB62, 0xD327, 0xBB63, - 0xD328, 0xC6D0, 0xD329, 0xC6D1, 0xD32A, 0xBB64, 0xD32B, 0xBB65, - 0xD32C, 0xC6D2, 0xD32D, 0xBB66, 0xD32E, 0xBB67, 0xD32F, 0xBB68, - 0xD330, 0xC6D3, 0xD331, 0xBB69, 0xD332, 0xBB6A, 0xD333, 0xBB6B, - 0xD334, 0xBB6C, 0xD335, 0xBB6D, 0xD336, 0xBB6E, 0xD337, 0xBB6F, - 0xD338, 0xC6D4, 0xD339, 0xC6D5, 0xD33A, 0xBB70, 0xD33B, 0xC6D6, - 0xD33C, 0xC6D7, 0xD33D, 0xC6D8, 0xD33E, 0xBB71, 0xD33F, 0xBB72, - 0xD340, 0xBB73, 0xD341, 0xBB74, 0xD342, 0xBB75, 0xD343, 0xBB76, - 0xD344, 0xC6D9, 0xD345, 0xC6DA, 0xD346, 0xBB77, 0xD347, 0xBB78, - 0xD348, 0xBB79, 0xD349, 0xBB7A, 0xD34A, 0xBB81, 0xD34B, 0xBB82, - 0xD34C, 0xBB83, 0xD34D, 0xBB84, 0xD34E, 0xBB85, 0xD34F, 0xBB86, - 0xD350, 0xBB87, 0xD351, 0xBB88, 0xD352, 0xBB89, 0xD353, 0xBB8A, - 0xD354, 0xBB8B, 0xD355, 0xBB8C, 0xD356, 0xBB8D, 0xD357, 0xBB8E, - 0xD358, 0xBB8F, 0xD359, 0xBB90, 0xD35A, 0xBB91, 0xD35B, 0xBB92, - 0xD35C, 0xBB93, 0xD35D, 0xBB94, 0xD35E, 0xBB95, 0xD35F, 0xBB96, - 0xD360, 0xBB97, 0xD361, 0xBB98, 0xD362, 0xBB99, 0xD363, 0xBB9A, - 0xD364, 0xBB9B, 0xD365, 0xBB9C, 0xD366, 0xBB9D, 0xD367, 0xBB9E, - 0xD368, 0xBB9F, 0xD369, 0xBBA0, 0xD36A, 0xBC41, 0xD36B, 0xBC42, - 0xD36C, 0xBC43, 0xD36D, 0xBC44, 0xD36E, 0xBC45, 0xD36F, 0xBC46, - 0xD370, 0xBC47, 0xD371, 0xBC48, 0xD372, 0xBC49, 0xD373, 0xBC4A, - 0xD374, 0xBC4B, 0xD375, 0xBC4C, 0xD376, 0xBC4D, 0xD377, 0xBC4E, - 0xD378, 0xBC4F, 0xD379, 0xBC50, 0xD37A, 0xBC51, 0xD37B, 0xBC52, - 0xD37C, 0xC6DB, 0xD37D, 0xC6DC, 0xD37E, 0xBC53, 0xD37F, 0xBC54, - 0xD380, 0xC6DD, 0xD381, 0xBC55, 0xD382, 0xBC56, 0xD383, 0xBC57, - 0xD384, 0xC6DE, 0xD385, 0xBC58, 0xD386, 0xBC59, 0xD387, 0xBC5A, - 0xD388, 0xBC61, 0xD389, 0xBC62, 0xD38A, 0xBC63, 0xD38B, 0xBC64, - 0xD38C, 0xC6DF, 0xD38D, 0xC6E0, 0xD38E, 0xBC65, 0xD38F, 0xC6E1, - 0xD390, 0xC6E2, 0xD391, 0xC6E3, 0xD392, 0xBC66, 0xD393, 0xBC67, - 0xD394, 0xBC68, 0xD395, 0xBC69, 0xD396, 0xBC6A, 0xD397, 0xBC6B, - 0xD398, 0xC6E4, 0xD399, 0xC6E5, 0xD39A, 0xBC6C, 0xD39B, 0xBC6D, - 0xD39C, 0xC6E6, 0xD39D, 0xBC6E, 0xD39E, 0xBC6F, 0xD39F, 0xBC70, - 0xD3A0, 0xC6E7, 0xD3A1, 0xBC71, 0xD3A2, 0xBC72, 0xD3A3, 0xBC73, - 0xD3A4, 0xBC74, 0xD3A5, 0xBC75, 0xD3A6, 0xBC76, 0xD3A7, 0xBC77, - 0xD3A8, 0xC6E8, 0xD3A9, 0xC6E9, 0xD3AA, 0xBC78, 0xD3AB, 0xC6EA, - 0xD3AC, 0xBC79, 0xD3AD, 0xC6EB, 0xD3AE, 0xBC7A, 0xD3AF, 0xBC81, - 0xD3B0, 0xBC82, 0xD3B1, 0xBC83, 0xD3B2, 0xBC84, 0xD3B3, 0xBC85, - 0xD3B4, 0xC6EC, 0xD3B5, 0xBC86, 0xD3B6, 0xBC87, 0xD3B7, 0xBC88, - 0xD3B8, 0xC6ED, 0xD3B9, 0xBC89, 0xD3BA, 0xBC8A, 0xD3BB, 0xBC8B, - 0xD3BC, 0xC6EE, 0xD3BD, 0xBC8C, 0xD3BE, 0xBC8D, 0xD3BF, 0xBC8E, - 0xD3C0, 0xBC8F, 0xD3C1, 0xBC90, 0xD3C2, 0xBC91, 0xD3C3, 0xBC92, - 0xD3C4, 0xC6EF, 0xD3C5, 0xC6F0, 0xD3C6, 0xBC93, 0xD3C7, 0xBC94, - 0xD3C8, 0xC6F1, 0xD3C9, 0xC6F2, 0xD3CA, 0xBC95, 0xD3CB, 0xBC96, - 0xD3CC, 0xBC97, 0xD3CD, 0xBC98, 0xD3CE, 0xBC99, 0xD3CF, 0xBC9A, - 0xD3D0, 0xC6F3, 0xD3D1, 0xBC9B, 0xD3D2, 0xBC9C, 0xD3D3, 0xBC9D, - 0xD3D4, 0xBC9E, 0xD3D5, 0xBC9F, 0xD3D6, 0xBCA0, 0xD3D7, 0xBD41, - 0xD3D8, 0xC6F4, 0xD3D9, 0xBD42, 0xD3DA, 0xBD43, 0xD3DB, 0xBD44, - 0xD3DC, 0xBD45, 0xD3DD, 0xBD46, 0xD3DE, 0xBD47, 0xD3DF, 0xBD48, - 0xD3E0, 0xBD49, 0xD3E1, 0xC6F5, 0xD3E2, 0xBD4A, 0xD3E3, 0xC6F6, - 0xD3E4, 0xBD4B, 0xD3E5, 0xBD4C, 0xD3E6, 0xBD4D, 0xD3E7, 0xBD4E, - 0xD3E8, 0xBD4F, 0xD3E9, 0xBD50, 0xD3EA, 0xBD51, 0xD3EB, 0xBD52, - 0xD3EC, 0xC6F7, 0xD3ED, 0xC6F8, 0xD3EE, 0xBD53, 0xD3EF, 0xBD54, - 0xD3F0, 0xC6F9, 0xD3F1, 0xBD55, 0xD3F2, 0xBD56, 0xD3F3, 0xBD57, - 0xD3F4, 0xC6FA, 0xD3F5, 0xBD58, 0xD3F6, 0xBD59, 0xD3F7, 0xBD5A, - 0xD3F8, 0xBD61, 0xD3F9, 0xBD62, 0xD3FA, 0xBD63, 0xD3FB, 0xBD64, - 0xD3FC, 0xC6FB, 0xD3FD, 0xC6FC, 0xD3FE, 0xBD65, 0xD3FF, 0xC6FD, - 0xD400, 0xBD66, 0xD401, 0xC6FE, 0xD402, 0xBD67, 0xD403, 0xBD68, - 0xD404, 0xBD69, 0xD405, 0xBD6A, 0xD406, 0xBD6B, 0xD407, 0xBD6C, - 0xD408, 0xC7A1, 0xD409, 0xBD6D, 0xD40A, 0xBD6E, 0xD40B, 0xBD6F, - 0xD40C, 0xBD70, 0xD40D, 0xBD71, 0xD40E, 0xBD72, 0xD40F, 0xBD73, - 0xD410, 0xBD74, 0xD411, 0xBD75, 0xD412, 0xBD76, 0xD413, 0xBD77, - 0xD414, 0xBD78, 0xD415, 0xBD79, 0xD416, 0xBD7A, 0xD417, 0xBD81, - 0xD418, 0xBD82, 0xD419, 0xBD83, 0xD41A, 0xBD84, 0xD41B, 0xBD85, - 0xD41C, 0xBD86, 0xD41D, 0xC7A2, 0xD41E, 0xBD87, 0xD41F, 0xBD88, - 0xD420, 0xBD89, 0xD421, 0xBD8A, 0xD422, 0xBD8B, 0xD423, 0xBD8C, - 0xD424, 0xBD8D, 0xD425, 0xBD8E, 0xD426, 0xBD8F, 0xD427, 0xBD90, - 0xD428, 0xBD91, 0xD429, 0xBD92, 0xD42A, 0xBD93, 0xD42B, 0xBD94, - 0xD42C, 0xBD95, 0xD42D, 0xBD96, 0xD42E, 0xBD97, 0xD42F, 0xBD98, - 0xD430, 0xBD99, 0xD431, 0xBD9A, 0xD432, 0xBD9B, 0xD433, 0xBD9C, - 0xD434, 0xBD9D, 0xD435, 0xBD9E, 0xD436, 0xBD9F, 0xD437, 0xBDA0, - 0xD438, 0xBE41, 0xD439, 0xBE42, 0xD43A, 0xBE43, 0xD43B, 0xBE44, - 0xD43C, 0xBE45, 0xD43D, 0xBE46, 0xD43E, 0xBE47, 0xD43F, 0xBE48, - 0xD440, 0xC7A3, 0xD441, 0xBE49, 0xD442, 0xBE4A, 0xD443, 0xBE4B, - 0xD444, 0xC7A4, 0xD445, 0xBE4C, 0xD446, 0xBE4D, 0xD447, 0xBE4E, - 0xD448, 0xBE4F, 0xD449, 0xBE50, 0xD44A, 0xBE51, 0xD44B, 0xBE52, - 0xD44C, 0xBE53, 0xD44D, 0xBE54, 0xD44E, 0xBE55, 0xD44F, 0xBE56, - 0xD450, 0xBE57, 0xD451, 0xBE58, 0xD452, 0xBE59, 0xD453, 0xBE5A, - 0xD454, 0xBE61, 0xD455, 0xBE62, 0xD456, 0xBE63, 0xD457, 0xBE64, - 0xD458, 0xBE65, 0xD459, 0xBE66, 0xD45A, 0xBE67, 0xD45B, 0xBE68, - 0xD45C, 0xC7A5, 0xD45D, 0xBE69, 0xD45E, 0xBE6A, 0xD45F, 0xBE6B, - 0xD460, 0xC7A6, 0xD461, 0xBE6C, 0xD462, 0xBE6D, 0xD463, 0xBE6E, - 0xD464, 0xC7A7, 0xD465, 0xBE6F, 0xD466, 0xBE70, 0xD467, 0xBE71, - 0xD468, 0xBE72, 0xD469, 0xBE73, 0xD46A, 0xBE74, 0xD46B, 0xBE75, - 0xD46C, 0xBE76, 0xD46D, 0xC7A8, 0xD46E, 0xBE77, 0xD46F, 0xC7A9, - 0xD470, 0xBE78, 0xD471, 0xBE79, 0xD472, 0xBE7A, 0xD473, 0xBE81, - 0xD474, 0xBE82, 0xD475, 0xBE83, 0xD476, 0xBE84, 0xD477, 0xBE85, - 0xD478, 0xC7AA, 0xD479, 0xC7AB, 0xD47A, 0xBE86, 0xD47B, 0xBE87, - 0xD47C, 0xC7AC, 0xD47D, 0xBE88, 0xD47E, 0xBE89, 0xD47F, 0xC7AD, - 0xD480, 0xC7AE, 0xD481, 0xBE8A, 0xD482, 0xC7AF, 0xD483, 0xBE8B, - 0xD484, 0xBE8C, 0xD485, 0xBE8D, 0xD486, 0xBE8E, 0xD487, 0xBE8F, - 0xD488, 0xC7B0, 0xD489, 0xC7B1, 0xD48A, 0xBE90, 0xD48B, 0xC7B2, - 0xD48C, 0xBE91, 0xD48D, 0xC7B3, 0xD48E, 0xBE92, 0xD48F, 0xBE93, - 0xD490, 0xBE94, 0xD491, 0xBE95, 0xD492, 0xBE96, 0xD493, 0xBE97, - 0xD494, 0xC7B4, 0xD495, 0xBE98, 0xD496, 0xBE99, 0xD497, 0xBE9A, - 0xD498, 0xBE9B, 0xD499, 0xBE9C, 0xD49A, 0xBE9D, 0xD49B, 0xBE9E, - 0xD49C, 0xBE9F, 0xD49D, 0xBEA0, 0xD49E, 0xBF41, 0xD49F, 0xBF42, - 0xD4A0, 0xBF43, 0xD4A1, 0xBF44, 0xD4A2, 0xBF45, 0xD4A3, 0xBF46, - 0xD4A4, 0xBF47, 0xD4A5, 0xBF48, 0xD4A6, 0xBF49, 0xD4A7, 0xBF4A, - 0xD4A8, 0xBF4B, 0xD4A9, 0xC7B5, 0xD4AA, 0xBF4C, 0xD4AB, 0xBF4D, - 0xD4AC, 0xBF4E, 0xD4AD, 0xBF4F, 0xD4AE, 0xBF50, 0xD4AF, 0xBF51, - 0xD4B0, 0xBF52, 0xD4B1, 0xBF53, 0xD4B2, 0xBF54, 0xD4B3, 0xBF55, - 0xD4B4, 0xBF56, 0xD4B5, 0xBF57, 0xD4B6, 0xBF58, 0xD4B7, 0xBF59, - 0xD4B8, 0xBF5A, 0xD4B9, 0xBF61, 0xD4BA, 0xBF62, 0xD4BB, 0xBF63, - 0xD4BC, 0xBF64, 0xD4BD, 0xBF65, 0xD4BE, 0xBF66, 0xD4BF, 0xBF67, - 0xD4C0, 0xBF68, 0xD4C1, 0xBF69, 0xD4C2, 0xBF6A, 0xD4C3, 0xBF6B, - 0xD4C4, 0xBF6C, 0xD4C5, 0xBF6D, 0xD4C6, 0xBF6E, 0xD4C7, 0xBF6F, - 0xD4C8, 0xBF70, 0xD4C9, 0xBF71, 0xD4CA, 0xBF72, 0xD4CB, 0xBF73, - 0xD4CC, 0xC7B6, 0xD4CD, 0xBF74, 0xD4CE, 0xBF75, 0xD4CF, 0xBF76, - 0xD4D0, 0xC7B7, 0xD4D1, 0xBF77, 0xD4D2, 0xBF78, 0xD4D3, 0xBF79, - 0xD4D4, 0xC7B8, 0xD4D5, 0xBF7A, 0xD4D6, 0xBF81, 0xD4D7, 0xBF82, - 0xD4D8, 0xBF83, 0xD4D9, 0xBF84, 0xD4DA, 0xBF85, 0xD4DB, 0xBF86, - 0xD4DC, 0xC7B9, 0xD4DD, 0xBF87, 0xD4DE, 0xBF88, 0xD4DF, 0xC7BA, - 0xD4E0, 0xBF89, 0xD4E1, 0xBF8A, 0xD4E2, 0xBF8B, 0xD4E3, 0xBF8C, - 0xD4E4, 0xBF8D, 0xD4E5, 0xBF8E, 0xD4E6, 0xBF8F, 0xD4E7, 0xBF90, - 0xD4E8, 0xC7BB, 0xD4E9, 0xBF91, 0xD4EA, 0xBF92, 0xD4EB, 0xBF93, - 0xD4EC, 0xC7BC, 0xD4ED, 0xBF94, 0xD4EE, 0xBF95, 0xD4EF, 0xBF96, - 0xD4F0, 0xC7BD, 0xD4F1, 0xBF97, 0xD4F2, 0xBF98, 0xD4F3, 0xBF99, - 0xD4F4, 0xBF9A, 0xD4F5, 0xBF9B, 0xD4F6, 0xBF9C, 0xD4F7, 0xBF9D, - 0xD4F8, 0xC7BE, 0xD4F9, 0xBF9E, 0xD4FA, 0xBF9F, 0xD4FB, 0xC7BF, - 0xD4FC, 0xBFA0, 0xD4FD, 0xC7C0, 0xD4FE, 0xC041, 0xD4FF, 0xC042, - 0xD500, 0xC043, 0xD501, 0xC044, 0xD502, 0xC045, 0xD503, 0xC046, - 0xD504, 0xC7C1, 0xD505, 0xC047, 0xD506, 0xC048, 0xD507, 0xC049, - 0xD508, 0xC7C2, 0xD509, 0xC04A, 0xD50A, 0xC04B, 0xD50B, 0xC04C, - 0xD50C, 0xC7C3, 0xD50D, 0xC04D, 0xD50E, 0xC04E, 0xD50F, 0xC04F, - 0xD510, 0xC050, 0xD511, 0xC051, 0xD512, 0xC052, 0xD513, 0xC053, - 0xD514, 0xC7C4, 0xD515, 0xC7C5, 0xD516, 0xC054, 0xD517, 0xC7C6, - 0xD518, 0xC055, 0xD519, 0xC056, 0xD51A, 0xC057, 0xD51B, 0xC058, - 0xD51C, 0xC059, 0xD51D, 0xC05A, 0xD51E, 0xC061, 0xD51F, 0xC062, - 0xD520, 0xC063, 0xD521, 0xC064, 0xD522, 0xC065, 0xD523, 0xC066, - 0xD524, 0xC067, 0xD525, 0xC068, 0xD526, 0xC069, 0xD527, 0xC06A, - 0xD528, 0xC06B, 0xD529, 0xC06C, 0xD52A, 0xC06D, 0xD52B, 0xC06E, - 0xD52C, 0xC06F, 0xD52D, 0xC070, 0xD52E, 0xC071, 0xD52F, 0xC072, - 0xD530, 0xC073, 0xD531, 0xC074, 0xD532, 0xC075, 0xD533, 0xC076, - 0xD534, 0xC077, 0xD535, 0xC078, 0xD536, 0xC079, 0xD537, 0xC07A, - 0xD538, 0xC081, 0xD539, 0xC082, 0xD53A, 0xC083, 0xD53B, 0xC084, - 0xD53C, 0xC7C7, 0xD53D, 0xC7C8, 0xD53E, 0xC085, 0xD53F, 0xC086, - 0xD540, 0xC7C9, 0xD541, 0xC087, 0xD542, 0xC088, 0xD543, 0xC089, - 0xD544, 0xC7CA, 0xD545, 0xC08A, 0xD546, 0xC08B, 0xD547, 0xC08C, - 0xD548, 0xC08D, 0xD549, 0xC08E, 0xD54A, 0xC08F, 0xD54B, 0xC090, - 0xD54C, 0xC7CB, 0xD54D, 0xC7CC, 0xD54E, 0xC091, 0xD54F, 0xC7CD, - 0xD550, 0xC092, 0xD551, 0xC7CE, 0xD552, 0xC093, 0xD553, 0xC094, - 0xD554, 0xC095, 0xD555, 0xC096, 0xD556, 0xC097, 0xD557, 0xC098, - 0xD558, 0xC7CF, 0xD559, 0xC7D0, 0xD55A, 0xC099, 0xD55B, 0xC09A, - 0xD55C, 0xC7D1, 0xD55D, 0xC09B, 0xD55E, 0xC09C, 0xD55F, 0xC09D, - 0xD560, 0xC7D2, 0xD561, 0xC09E, 0xD562, 0xC09F, 0xD563, 0xC0A0, - 0xD564, 0xC141, 0xD565, 0xC7D3, 0xD566, 0xC142, 0xD567, 0xC143, - 0xD568, 0xC7D4, 0xD569, 0xC7D5, 0xD56A, 0xC144, 0xD56B, 0xC7D6, - 0xD56C, 0xC145, 0xD56D, 0xC7D7, 0xD56E, 0xC146, 0xD56F, 0xC147, - 0xD570, 0xC148, 0xD571, 0xC149, 0xD572, 0xC14A, 0xD573, 0xC14B, - 0xD574, 0xC7D8, 0xD575, 0xC7D9, 0xD576, 0xC14C, 0xD577, 0xC14D, - 0xD578, 0xC7DA, 0xD579, 0xC14E, 0xD57A, 0xC14F, 0xD57B, 0xC150, - 0xD57C, 0xC7DB, 0xD57D, 0xC151, 0xD57E, 0xC152, 0xD57F, 0xC153, - 0xD580, 0xC154, 0xD581, 0xC155, 0xD582, 0xC156, 0xD583, 0xC157, - 0xD584, 0xC7DC, 0xD585, 0xC7DD, 0xD586, 0xC158, 0xD587, 0xC7DE, - 0xD588, 0xC7DF, 0xD589, 0xC7E0, 0xD58A, 0xC159, 0xD58B, 0xC15A, - 0xD58C, 0xC161, 0xD58D, 0xC162, 0xD58E, 0xC163, 0xD58F, 0xC164, - 0xD590, 0xC7E1, 0xD591, 0xC165, 0xD592, 0xC166, 0xD593, 0xC167, - 0xD594, 0xC168, 0xD595, 0xC169, 0xD596, 0xC16A, 0xD597, 0xC16B, - 0xD598, 0xC16C, 0xD599, 0xC16D, 0xD59A, 0xC16E, 0xD59B, 0xC16F, - 0xD59C, 0xC170, 0xD59D, 0xC171, 0xD59E, 0xC172, 0xD59F, 0xC173, - 0xD5A0, 0xC174, 0xD5A1, 0xC175, 0xD5A2, 0xC176, 0xD5A3, 0xC177, - 0xD5A4, 0xC178, 0xD5A5, 0xC7E2, 0xD5A6, 0xC179, 0xD5A7, 0xC17A, - 0xD5A8, 0xC181, 0xD5A9, 0xC182, 0xD5AA, 0xC183, 0xD5AB, 0xC184, - 0xD5AC, 0xC185, 0xD5AD, 0xC186, 0xD5AE, 0xC187, 0xD5AF, 0xC188, - 0xD5B0, 0xC189, 0xD5B1, 0xC18A, 0xD5B2, 0xC18B, 0xD5B3, 0xC18C, - 0xD5B4, 0xC18D, 0xD5B5, 0xC18E, 0xD5B6, 0xC18F, 0xD5B7, 0xC190, - 0xD5B8, 0xC191, 0xD5B9, 0xC192, 0xD5BA, 0xC193, 0xD5BB, 0xC194, - 0xD5BC, 0xC195, 0xD5BD, 0xC196, 0xD5BE, 0xC197, 0xD5BF, 0xC198, - 0xD5C0, 0xC199, 0xD5C1, 0xC19A, 0xD5C2, 0xC19B, 0xD5C3, 0xC19C, - 0xD5C4, 0xC19D, 0xD5C5, 0xC19E, 0xD5C6, 0xC19F, 0xD5C7, 0xC1A0, - 0xD5C8, 0xC7E3, 0xD5C9, 0xC7E4, 0xD5CA, 0xC241, 0xD5CB, 0xC242, - 0xD5CC, 0xC7E5, 0xD5CD, 0xC243, 0xD5CE, 0xC244, 0xD5CF, 0xC245, - 0xD5D0, 0xC7E6, 0xD5D1, 0xC246, 0xD5D2, 0xC7E7, 0xD5D3, 0xC247, - 0xD5D4, 0xC248, 0xD5D5, 0xC249, 0xD5D6, 0xC24A, 0xD5D7, 0xC24B, - 0xD5D8, 0xC7E8, 0xD5D9, 0xC7E9, 0xD5DA, 0xC24C, 0xD5DB, 0xC7EA, - 0xD5DC, 0xC24D, 0xD5DD, 0xC7EB, 0xD5DE, 0xC24E, 0xD5DF, 0xC24F, - 0xD5E0, 0xC250, 0xD5E1, 0xC251, 0xD5E2, 0xC252, 0xD5E3, 0xC253, - 0xD5E4, 0xC7EC, 0xD5E5, 0xC7ED, 0xD5E6, 0xC254, 0xD5E7, 0xC255, - 0xD5E8, 0xC7EE, 0xD5E9, 0xC256, 0xD5EA, 0xC257, 0xD5EB, 0xC258, - 0xD5EC, 0xC7EF, 0xD5ED, 0xC259, 0xD5EE, 0xC25A, 0xD5EF, 0xC261, - 0xD5F0, 0xC262, 0xD5F1, 0xC263, 0xD5F2, 0xC264, 0xD5F3, 0xC265, - 0xD5F4, 0xC7F0, 0xD5F5, 0xC7F1, 0xD5F6, 0xC266, 0xD5F7, 0xC7F2, - 0xD5F8, 0xC267, 0xD5F9, 0xC7F3, 0xD5FA, 0xC268, 0xD5FB, 0xC269, - 0xD5FC, 0xC26A, 0xD5FD, 0xC26B, 0xD5FE, 0xC26C, 0xD5FF, 0xC26D, - 0xD600, 0xC7F4, 0xD601, 0xC7F5, 0xD602, 0xC26E, 0xD603, 0xC26F, - 0xD604, 0xC7F6, 0xD605, 0xC270, 0xD606, 0xC271, 0xD607, 0xC272, - 0xD608, 0xC7F7, 0xD609, 0xC273, 0xD60A, 0xC274, 0xD60B, 0xC275, - 0xD60C, 0xC276, 0xD60D, 0xC277, 0xD60E, 0xC278, 0xD60F, 0xC279, - 0xD610, 0xC7F8, 0xD611, 0xC7F9, 0xD612, 0xC27A, 0xD613, 0xC7FA, - 0xD614, 0xC7FB, 0xD615, 0xC7FC, 0xD616, 0xC281, 0xD617, 0xC282, - 0xD618, 0xC283, 0xD619, 0xC284, 0xD61A, 0xC285, 0xD61B, 0xC286, - 0xD61C, 0xC7FD, 0xD61D, 0xC287, 0xD61E, 0xC288, 0xD61F, 0xC289, - 0xD620, 0xC7FE, 0xD621, 0xC28A, 0xD622, 0xC28B, 0xD623, 0xC28C, - 0xD624, 0xC8A1, 0xD625, 0xC28D, 0xD626, 0xC28E, 0xD627, 0xC28F, - 0xD628, 0xC290, 0xD629, 0xC291, 0xD62A, 0xC292, 0xD62B, 0xC293, - 0xD62C, 0xC294, 0xD62D, 0xC8A2, 0xD62E, 0xC295, 0xD62F, 0xC296, - 0xD630, 0xC297, 0xD631, 0xC298, 0xD632, 0xC299, 0xD633, 0xC29A, - 0xD634, 0xC29B, 0xD635, 0xC29C, 0xD636, 0xC29D, 0xD637, 0xC29E, - 0xD638, 0xC8A3, 0xD639, 0xC8A4, 0xD63A, 0xC29F, 0xD63B, 0xC2A0, - 0xD63C, 0xC8A5, 0xD63D, 0xC341, 0xD63E, 0xC342, 0xD63F, 0xC343, - 0xD640, 0xC8A6, 0xD641, 0xC344, 0xD642, 0xC345, 0xD643, 0xC346, - 0xD644, 0xC347, 0xD645, 0xC8A7, 0xD646, 0xC348, 0xD647, 0xC349, - 0xD648, 0xC8A8, 0xD649, 0xC8A9, 0xD64A, 0xC34A, 0xD64B, 0xC8AA, - 0xD64C, 0xC34B, 0xD64D, 0xC8AB, 0xD64E, 0xC34C, 0xD64F, 0xC34D, - 0xD650, 0xC34E, 0xD651, 0xC8AC, 0xD652, 0xC34F, 0xD653, 0xC350, - 0xD654, 0xC8AD, 0xD655, 0xC8AE, 0xD656, 0xC351, 0xD657, 0xC352, - 0xD658, 0xC8AF, 0xD659, 0xC353, 0xD65A, 0xC354, 0xD65B, 0xC355, - 0xD65C, 0xC8B0, 0xD65D, 0xC356, 0xD65E, 0xC357, 0xD65F, 0xC358, - 0xD660, 0xC359, 0xD661, 0xC35A, 0xD662, 0xC361, 0xD663, 0xC362, - 0xD664, 0xC363, 0xD665, 0xC364, 0xD666, 0xC365, 0xD667, 0xC8B1, - 0xD668, 0xC366, 0xD669, 0xC8B2, 0xD66A, 0xC367, 0xD66B, 0xC368, - 0xD66C, 0xC369, 0xD66D, 0xC36A, 0xD66E, 0xC36B, 0xD66F, 0xC36C, - 0xD670, 0xC8B3, 0xD671, 0xC8B4, 0xD672, 0xC36D, 0xD673, 0xC36E, - 0xD674, 0xC8B5, 0xD675, 0xC36F, 0xD676, 0xC370, 0xD677, 0xC371, - 0xD678, 0xC372, 0xD679, 0xC373, 0xD67A, 0xC374, 0xD67B, 0xC375, - 0xD67C, 0xC376, 0xD67D, 0xC377, 0xD67E, 0xC378, 0xD67F, 0xC379, - 0xD680, 0xC37A, 0xD681, 0xC381, 0xD682, 0xC382, 0xD683, 0xC8B6, - 0xD684, 0xC383, 0xD685, 0xC8B7, 0xD686, 0xC384, 0xD687, 0xC385, - 0xD688, 0xC386, 0xD689, 0xC387, 0xD68A, 0xC388, 0xD68B, 0xC389, - 0xD68C, 0xC8B8, 0xD68D, 0xC8B9, 0xD68E, 0xC38A, 0xD68F, 0xC38B, - 0xD690, 0xC8BA, 0xD691, 0xC38C, 0xD692, 0xC38D, 0xD693, 0xC38E, - 0xD694, 0xC8BB, 0xD695, 0xC38F, 0xD696, 0xC390, 0xD697, 0xC391, - 0xD698, 0xC392, 0xD699, 0xC393, 0xD69A, 0xC394, 0xD69B, 0xC395, - 0xD69C, 0xC396, 0xD69D, 0xC8BC, 0xD69E, 0xC397, 0xD69F, 0xC8BD, - 0xD6A0, 0xC398, 0xD6A1, 0xC8BE, 0xD6A2, 0xC399, 0xD6A3, 0xC39A, - 0xD6A4, 0xC39B, 0xD6A5, 0xC39C, 0xD6A6, 0xC39D, 0xD6A7, 0xC39E, - 0xD6A8, 0xC8BF, 0xD6A9, 0xC39F, 0xD6AA, 0xC3A0, 0xD6AB, 0xC441, - 0xD6AC, 0xC8C0, 0xD6AD, 0xC442, 0xD6AE, 0xC443, 0xD6AF, 0xC444, - 0xD6B0, 0xC8C1, 0xD6B1, 0xC445, 0xD6B2, 0xC446, 0xD6B3, 0xC447, - 0xD6B4, 0xC448, 0xD6B5, 0xC449, 0xD6B6, 0xC44A, 0xD6B7, 0xC44B, - 0xD6B8, 0xC44C, 0xD6B9, 0xC8C2, 0xD6BA, 0xC44D, 0xD6BB, 0xC8C3, - 0xD6BC, 0xC44E, 0xD6BD, 0xC44F, 0xD6BE, 0xC450, 0xD6BF, 0xC451, - 0xD6C0, 0xC452, 0xD6C1, 0xC453, 0xD6C2, 0xC454, 0xD6C3, 0xC455, - 0xD6C4, 0xC8C4, 0xD6C5, 0xC8C5, 0xD6C6, 0xC456, 0xD6C7, 0xC457, - 0xD6C8, 0xC8C6, 0xD6C9, 0xC458, 0xD6CA, 0xC459, 0xD6CB, 0xC45A, - 0xD6CC, 0xC8C7, 0xD6CD, 0xC461, 0xD6CE, 0xC462, 0xD6CF, 0xC463, - 0xD6D0, 0xC464, 0xD6D1, 0xC8C8, 0xD6D2, 0xC465, 0xD6D3, 0xC466, - 0xD6D4, 0xC8C9, 0xD6D5, 0xC467, 0xD6D6, 0xC468, 0xD6D7, 0xC8CA, - 0xD6D8, 0xC469, 0xD6D9, 0xC8CB, 0xD6DA, 0xC46A, 0xD6DB, 0xC46B, - 0xD6DC, 0xC46C, 0xD6DD, 0xC46D, 0xD6DE, 0xC46E, 0xD6DF, 0xC46F, - 0xD6E0, 0xC8CC, 0xD6E1, 0xC470, 0xD6E2, 0xC471, 0xD6E3, 0xC472, - 0xD6E4, 0xC8CD, 0xD6E5, 0xC473, 0xD6E6, 0xC474, 0xD6E7, 0xC475, - 0xD6E8, 0xC8CE, 0xD6E9, 0xC476, 0xD6EA, 0xC477, 0xD6EB, 0xC478, - 0xD6EC, 0xC479, 0xD6ED, 0xC47A, 0xD6EE, 0xC481, 0xD6EF, 0xC482, - 0xD6F0, 0xC8CF, 0xD6F1, 0xC483, 0xD6F2, 0xC484, 0xD6F3, 0xC485, - 0xD6F4, 0xC486, 0xD6F5, 0xC8D0, 0xD6F6, 0xC487, 0xD6F7, 0xC488, - 0xD6F8, 0xC489, 0xD6F9, 0xC48A, 0xD6FA, 0xC48B, 0xD6FB, 0xC48C, - 0xD6FC, 0xC8D1, 0xD6FD, 0xC8D2, 0xD6FE, 0xC48D, 0xD6FF, 0xC48E, - 0xD700, 0xC8D3, 0xD701, 0xC48F, 0xD702, 0xC490, 0xD703, 0xC491, - 0xD704, 0xC8D4, 0xD705, 0xC492, 0xD706, 0xC493, 0xD707, 0xC494, - 0xD708, 0xC495, 0xD709, 0xC496, 0xD70A, 0xC497, 0xD70B, 0xC498, - 0xD70C, 0xC499, 0xD70D, 0xC49A, 0xD70E, 0xC49B, 0xD70F, 0xC49C, - 0xD710, 0xC49D, 0xD711, 0xC8D5, 0xD712, 0xC49E, 0xD713, 0xC49F, - 0xD714, 0xC4A0, 0xD715, 0xC541, 0xD716, 0xC542, 0xD717, 0xC543, - 0xD718, 0xC8D6, 0xD719, 0xC8D7, 0xD71A, 0xC544, 0xD71B, 0xC545, - 0xD71C, 0xC8D8, 0xD71D, 0xC546, 0xD71E, 0xC547, 0xD71F, 0xC548, - 0xD720, 0xC8D9, 0xD721, 0xC549, 0xD722, 0xC54A, 0xD723, 0xC54B, - 0xD724, 0xC54C, 0xD725, 0xC54D, 0xD726, 0xC54E, 0xD727, 0xC54F, - 0xD728, 0xC8DA, 0xD729, 0xC8DB, 0xD72A, 0xC550, 0xD72B, 0xC8DC, - 0xD72C, 0xC551, 0xD72D, 0xC8DD, 0xD72E, 0xC552, 0xD72F, 0xC553, - 0xD730, 0xC554, 0xD731, 0xC555, 0xD732, 0xC556, 0xD733, 0xC557, - 0xD734, 0xC8DE, 0xD735, 0xC8DF, 0xD736, 0xC558, 0xD737, 0xC559, - 0xD738, 0xC8E0, 0xD739, 0xC55A, 0xD73A, 0xC561, 0xD73B, 0xC562, - 0xD73C, 0xC8E1, 0xD73D, 0xC563, 0xD73E, 0xC564, 0xD73F, 0xC565, - 0xD740, 0xC566, 0xD741, 0xC567, 0xD742, 0xC568, 0xD743, 0xC569, - 0xD744, 0xC8E2, 0xD745, 0xC56A, 0xD746, 0xC56B, 0xD747, 0xC8E3, - 0xD748, 0xC56C, 0xD749, 0xC8E4, 0xD74A, 0xC56D, 0xD74B, 0xC56E, - 0xD74C, 0xC56F, 0xD74D, 0xC570, 0xD74E, 0xC571, 0xD74F, 0xC572, - 0xD750, 0xC8E5, 0xD751, 0xC8E6, 0xD752, 0xC573, 0xD753, 0xC574, - 0xD754, 0xC8E7, 0xD755, 0xC575, 0xD756, 0xC8E8, 0xD757, 0xC8E9, - 0xD758, 0xC8EA, 0xD759, 0xC8EB, 0xD75A, 0xC576, 0xD75B, 0xC577, - 0xD75C, 0xC578, 0xD75D, 0xC579, 0xD75E, 0xC57A, 0xD75F, 0xC581, - 0xD760, 0xC8EC, 0xD761, 0xC8ED, 0xD762, 0xC582, 0xD763, 0xC8EE, - 0xD764, 0xC583, 0xD765, 0xC8EF, 0xD766, 0xC584, 0xD767, 0xC585, - 0xD768, 0xC586, 0xD769, 0xC8F0, 0xD76A, 0xC587, 0xD76B, 0xC588, - 0xD76C, 0xC8F1, 0xD76D, 0xC589, 0xD76E, 0xC58A, 0xD76F, 0xC58B, - 0xD770, 0xC8F2, 0xD771, 0xC58C, 0xD772, 0xC58D, 0xD773, 0xC58E, - 0xD774, 0xC8F3, 0xD775, 0xC58F, 0xD776, 0xC590, 0xD777, 0xC591, - 0xD778, 0xC592, 0xD779, 0xC593, 0xD77A, 0xC594, 0xD77B, 0xC595, - 0xD77C, 0xC8F4, 0xD77D, 0xC8F5, 0xD77E, 0xC596, 0xD77F, 0xC597, - 0xD780, 0xC598, 0xD781, 0xC8F6, 0xD782, 0xC599, 0xD783, 0xC59A, - 0xD784, 0xC59B, 0xD785, 0xC59C, 0xD786, 0xC59D, 0xD787, 0xC59E, - 0xD788, 0xC8F7, 0xD789, 0xC8F8, 0xD78A, 0xC59F, 0xD78B, 0xC5A0, - 0xD78C, 0xC8F9, 0xD78D, 0xC641, 0xD78E, 0xC642, 0xD78F, 0xC643, - 0xD790, 0xC8FA, 0xD791, 0xC644, 0xD792, 0xC645, 0xD793, 0xC646, - 0xD794, 0xC647, 0xD795, 0xC648, 0xD796, 0xC649, 0xD797, 0xC64A, - 0xD798, 0xC8FB, 0xD799, 0xC8FC, 0xD79A, 0xC64B, 0xD79B, 0xC8FD, - 0xD79C, 0xC64C, 0xD79D, 0xC8FE, 0xD79E, 0xC64D, 0xD79F, 0xC64E, - 0xD7A0, 0xC64F, 0xD7A1, 0xC650, 0xD7A2, 0xC651, 0xD7A3, 0xC652, - 0xF900, 0xCBD0, 0xF901, 0xCBD6, 0xF902, 0xCBE7, 0xF903, 0xCDCF, - 0xF904, 0xCDE8, 0xF905, 0xCEAD, 0xF906, 0xCFFB, 0xF907, 0xD0A2, - 0xF908, 0xD0B8, 0xF909, 0xD0D0, 0xF90A, 0xD0DD, 0xF90B, 0xD1D4, - 0xF90C, 0xD1D5, 0xF90D, 0xD1D8, 0xF90E, 0xD1DB, 0xF90F, 0xD1DC, - 0xF910, 0xD1DD, 0xF911, 0xD1DE, 0xF912, 0xD1DF, 0xF913, 0xD1E0, - 0xF914, 0xD1E2, 0xF915, 0xD1E3, 0xF916, 0xD1E4, 0xF917, 0xD1E5, - 0xF918, 0xD1E6, 0xF919, 0xD1E8, 0xF91A, 0xD1E9, 0xF91B, 0xD1EA, - 0xF91C, 0xD1EB, 0xF91D, 0xD1ED, 0xF91E, 0xD1EF, 0xF91F, 0xD1F0, - 0xF920, 0xD1F2, 0xF921, 0xD1F6, 0xF922, 0xD1FA, 0xF923, 0xD1FC, - 0xF924, 0xD1FD, 0xF925, 0xD1FE, 0xF926, 0xD2A2, 0xF927, 0xD2A3, - 0xF928, 0xD2A7, 0xF929, 0xD2A8, 0xF92A, 0xD2A9, 0xF92B, 0xD2AA, - 0xF92C, 0xD2AB, 0xF92D, 0xD2AD, 0xF92E, 0xD2B2, 0xF92F, 0xD2BE, - 0xF930, 0xD2C2, 0xF931, 0xD2C3, 0xF932, 0xD2C4, 0xF933, 0xD2C6, - 0xF934, 0xD2C7, 0xF935, 0xD2C8, 0xF936, 0xD2C9, 0xF937, 0xD2CA, - 0xF938, 0xD2CB, 0xF939, 0xD2CD, 0xF93A, 0xD2CE, 0xF93B, 0xD2CF, - 0xF93C, 0xD2D0, 0xF93D, 0xD2D1, 0xF93E, 0xD2D2, 0xF93F, 0xD2D3, - 0xF940, 0xD2D4, 0xF941, 0xD2D5, 0xF942, 0xD2D6, 0xF943, 0xD2D7, - 0xF944, 0xD2D9, 0xF945, 0xD2DA, 0xF946, 0xD2DE, 0xF947, 0xD2DF, - 0xF948, 0xD2E1, 0xF949, 0xD2E2, 0xF94A, 0xD2E4, 0xF94B, 0xD2E5, - 0xF94C, 0xD2E6, 0xF94D, 0xD2E7, 0xF94E, 0xD2E8, 0xF94F, 0xD2E9, - 0xF950, 0xD2EA, 0xF951, 0xD2EB, 0xF952, 0xD2F0, 0xF953, 0xD2F1, - 0xF954, 0xD2F2, 0xF955, 0xD2F3, 0xF956, 0xD2F4, 0xF957, 0xD2F5, - 0xF958, 0xD2F7, 0xF959, 0xD2F8, 0xF95A, 0xD4E6, 0xF95B, 0xD4FC, - 0xF95C, 0xD5A5, 0xF95D, 0xD5AB, 0xF95E, 0xD5AE, 0xF95F, 0xD6B8, - 0xF960, 0xD6CD, 0xF961, 0xD7CB, 0xF962, 0xD7E4, 0xF963, 0xDBC5, - 0xF964, 0xDBE4, 0xF965, 0xDCA5, 0xF966, 0xDDA5, 0xF967, 0xDDD5, - 0xF968, 0xDDF4, 0xF969, 0xDEFC, 0xF96A, 0xDEFE, 0xF96B, 0xDFB3, - 0xF96C, 0xDFE1, 0xF96D, 0xDFE8, 0xF96E, 0xE0F1, 0xF96F, 0xE1AD, - 0xF970, 0xE1ED, 0xF971, 0xE3F5, 0xF972, 0xE4A1, 0xF973, 0xE4A9, - 0xF974, 0xE5AE, 0xF975, 0xE5B1, 0xF976, 0xE5B2, 0xF977, 0xE5B9, - 0xF978, 0xE5BB, 0xF979, 0xE5BC, 0xF97A, 0xE5C4, 0xF97B, 0xE5CE, - 0xF97C, 0xE5D0, 0xF97D, 0xE5D2, 0xF97E, 0xE5D6, 0xF97F, 0xE5FA, - 0xF980, 0xE5FB, 0xF981, 0xE5FC, 0xF982, 0xE5FE, 0xF983, 0xE6A1, - 0xF984, 0xE6A4, 0xF985, 0xE6A7, 0xF986, 0xE6AD, 0xF987, 0xE6AF, - 0xF988, 0xE6B0, 0xF989, 0xE6B1, 0xF98A, 0xE6B3, 0xF98B, 0xE6B7, - 0xF98C, 0xE6B8, 0xF98D, 0xE6BC, 0xF98E, 0xE6C4, 0xF98F, 0xE6C6, - 0xF990, 0xE6C7, 0xF991, 0xE6CA, 0xF992, 0xE6D2, 0xF993, 0xE6D6, - 0xF994, 0xE6D9, 0xF995, 0xE6DC, 0xF996, 0xE6DF, 0xF997, 0xE6E1, - 0xF998, 0xE6E4, 0xF999, 0xE6E5, 0xF99A, 0xE6E6, 0xF99B, 0xE6E8, - 0xF99C, 0xE6EA, 0xF99D, 0xE6EB, 0xF99E, 0xE6EC, 0xF99F, 0xE6EF, - 0xF9A0, 0xE6F1, 0xF9A1, 0xE6F2, 0xF9A2, 0xE6F5, 0xF9A3, 0xE6F6, - 0xF9A4, 0xE6F7, 0xF9A5, 0xE6F9, 0xF9A6, 0xE7A1, 0xF9A7, 0xE7A6, - 0xF9A8, 0xE7A9, 0xF9A9, 0xE7AA, 0xF9AA, 0xE7AC, 0xF9AB, 0xE7AD, - 0xF9AC, 0xE7B0, 0xF9AD, 0xE7BF, 0xF9AE, 0xE7C1, 0xF9AF, 0xE7C6, - 0xF9B0, 0xE7C7, 0xF9B1, 0xE7CB, 0xF9B2, 0xE7CD, 0xF9B3, 0xE7CF, - 0xF9B4, 0xE7D0, 0xF9B5, 0xE7D3, 0xF9B6, 0xE7DF, 0xF9B7, 0xE7E4, - 0xF9B8, 0xE7E6, 0xF9B9, 0xE7F7, 0xF9BA, 0xE8E7, 0xF9BB, 0xE8E8, - 0xF9BC, 0xE8F0, 0xF9BD, 0xE8F1, 0xF9BE, 0xE8F7, 0xF9BF, 0xE8F9, - 0xF9C0, 0xE8FB, 0xF9C1, 0xE8FE, 0xF9C2, 0xE9A7, 0xF9C3, 0xE9AC, - 0xF9C4, 0xE9CC, 0xF9C5, 0xE9F7, 0xF9C6, 0xEAC1, 0xF9C7, 0xEAE5, - 0xF9C8, 0xEAF4, 0xF9C9, 0xEAF7, 0xF9CA, 0xEAFC, 0xF9CB, 0xEAFE, - 0xF9CC, 0xEBA4, 0xF9CD, 0xEBA7, 0xF9CE, 0xEBA9, 0xF9CF, 0xEBAA, - 0xF9D0, 0xEBBA, 0xF9D1, 0xEBBB, 0xF9D2, 0xEBBD, 0xF9D3, 0xEBC1, - 0xF9D4, 0xEBC2, 0xF9D5, 0xEBC6, 0xF9D6, 0xEBC7, 0xF9D7, 0xEBCC, - 0xF9D8, 0xEBCF, 0xF9D9, 0xEBD0, 0xF9DA, 0xEBD1, 0xF9DB, 0xEBD2, - 0xF9DC, 0xEBD8, 0xF9DD, 0xECA6, 0xF9DE, 0xECA7, 0xF9DF, 0xECAA, - 0xF9E0, 0xECAF, 0xF9E1, 0xECB0, 0xF9E2, 0xECB1, 0xF9E3, 0xECB2, - 0xF9E4, 0xECB5, 0xF9E5, 0xECB8, 0xF9E6, 0xECBA, 0xF9E7, 0xECC0, - 0xF9E8, 0xECC1, 0xF9E9, 0xECC5, 0xF9EA, 0xECC6, 0xF9EB, 0xECC9, - 0xF9EC, 0xECCA, 0xF9ED, 0xECD5, 0xF9EE, 0xECDD, 0xF9EF, 0xECDE, - 0xF9F0, 0xECE1, 0xF9F1, 0xECE4, 0xF9F2, 0xECE7, 0xF9F3, 0xECE8, - 0xF9F4, 0xECF7, 0xF9F5, 0xECF8, 0xF9F6, 0xECFA, 0xF9F7, 0xEDA1, - 0xF9F8, 0xEDA2, 0xF9F9, 0xEDA3, 0xF9FA, 0xEDEE, 0xF9FB, 0xEEDB, - 0xF9FC, 0xF2BD, 0xF9FD, 0xF2FA, 0xF9FE, 0xF3B1, 0xF9FF, 0xF4A7, - 0xFA00, 0xF4EE, 0xFA01, 0xF6F4, 0xFA02, 0xF6F6, 0xFA03, 0xF7B8, - 0xFA04, 0xF7C8, 0xFA05, 0xF7D3, 0xFA06, 0xF8DB, 0xFA07, 0xF8F0, - 0xFA08, 0xFAA1, 0xFA09, 0xFAA2, 0xFA0A, 0xFAE6, 0xFA0B, 0xFCA9, - 0xFF01, 0xA3A1, 0xFF02, 0xA3A2, 0xFF03, 0xA3A3, 0xFF04, 0xA3A4, - 0xFF05, 0xA3A5, 0xFF06, 0xA3A6, 0xFF07, 0xA3A7, 0xFF08, 0xA3A8, - 0xFF09, 0xA3A9, 0xFF0A, 0xA3AA, 0xFF0B, 0xA3AB, 0xFF0C, 0xA3AC, - 0xFF0D, 0xA3AD, 0xFF0E, 0xA3AE, 0xFF0F, 0xA3AF, 0xFF10, 0xA3B0, - 0xFF11, 0xA3B1, 0xFF12, 0xA3B2, 0xFF13, 0xA3B3, 0xFF14, 0xA3B4, - 0xFF15, 0xA3B5, 0xFF16, 0xA3B6, 0xFF17, 0xA3B7, 0xFF18, 0xA3B8, - 0xFF19, 0xA3B9, 0xFF1A, 0xA3BA, 0xFF1B, 0xA3BB, 0xFF1C, 0xA3BC, - 0xFF1D, 0xA3BD, 0xFF1E, 0xA3BE, 0xFF1F, 0xA3BF, 0xFF20, 0xA3C0, - 0xFF21, 0xA3C1, 0xFF22, 0xA3C2, 0xFF23, 0xA3C3, 0xFF24, 0xA3C4, - 0xFF25, 0xA3C5, 0xFF26, 0xA3C6, 0xFF27, 0xA3C7, 0xFF28, 0xA3C8, - 0xFF29, 0xA3C9, 0xFF2A, 0xA3CA, 0xFF2B, 0xA3CB, 0xFF2C, 0xA3CC, - 0xFF2D, 0xA3CD, 0xFF2E, 0xA3CE, 0xFF2F, 0xA3CF, 0xFF30, 0xA3D0, - 0xFF31, 0xA3D1, 0xFF32, 0xA3D2, 0xFF33, 0xA3D3, 0xFF34, 0xA3D4, - 0xFF35, 0xA3D5, 0xFF36, 0xA3D6, 0xFF37, 0xA3D7, 0xFF38, 0xA3D8, - 0xFF39, 0xA3D9, 0xFF3A, 0xA3DA, 0xFF3B, 0xA3DB, 0xFF3C, 0xA1AC, - 0xFF3D, 0xA3DD, 0xFF3E, 0xA3DE, 0xFF3F, 0xA3DF, 0xFF40, 0xA3E0, - 0xFF41, 0xA3E1, 0xFF42, 0xA3E2, 0xFF43, 0xA3E3, 0xFF44, 0xA3E4, - 0xFF45, 0xA3E5, 0xFF46, 0xA3E6, 0xFF47, 0xA3E7, 0xFF48, 0xA3E8, - 0xFF49, 0xA3E9, 0xFF4A, 0xA3EA, 0xFF4B, 0xA3EB, 0xFF4C, 0xA3EC, - 0xFF4D, 0xA3ED, 0xFF4E, 0xA3EE, 0xFF4F, 0xA3EF, 0xFF50, 0xA3F0, - 0xFF51, 0xA3F1, 0xFF52, 0xA3F2, 0xFF53, 0xA3F3, 0xFF54, 0xA3F4, - 0xFF55, 0xA3F5, 0xFF56, 0xA3F6, 0xFF57, 0xA3F7, 0xFF58, 0xA3F8, - 0xFF59, 0xA3F9, 0xFF5A, 0xA3FA, 0xFF5B, 0xA3FB, 0xFF5C, 0xA3FC, - 0xFF5D, 0xA3FD, 0xFF5E, 0xA2A6, 0xFFE0, 0xA1CB, 0xFFE1, 0xA1CC, - 0xFFE2, 0xA1FE, 0xFFE3, 0xA3FE, 0xFFE5, 0xA1CD, 0xFFE6, 0xA3DC, - 0, 0 -}; - -static -const WCHAR oem2uni[] = { -/* OEM - Unicode, OEM - Unicode, OEM - Unicode, OEM - Unicode */ - 0x8141, 0xAC02, 0x8142, 0xAC03, 0x8143, 0xAC05, 0x8144, 0xAC06, - 0x8145, 0xAC0B, 0x8146, 0xAC0C, 0x8147, 0xAC0D, 0x8148, 0xAC0E, - 0x8149, 0xAC0F, 0x814A, 0xAC18, 0x814B, 0xAC1E, 0x814C, 0xAC1F, - 0x814D, 0xAC21, 0x814E, 0xAC22, 0x814F, 0xAC23, 0x8150, 0xAC25, - 0x8151, 0xAC26, 0x8152, 0xAC27, 0x8153, 0xAC28, 0x8154, 0xAC29, - 0x8155, 0xAC2A, 0x8156, 0xAC2B, 0x8157, 0xAC2E, 0x8158, 0xAC32, - 0x8159, 0xAC33, 0x815A, 0xAC34, 0x8161, 0xAC35, 0x8162, 0xAC36, - 0x8163, 0xAC37, 0x8164, 0xAC3A, 0x8165, 0xAC3B, 0x8166, 0xAC3D, - 0x8167, 0xAC3E, 0x8168, 0xAC3F, 0x8169, 0xAC41, 0x816A, 0xAC42, - 0x816B, 0xAC43, 0x816C, 0xAC44, 0x816D, 0xAC45, 0x816E, 0xAC46, - 0x816F, 0xAC47, 0x8170, 0xAC48, 0x8171, 0xAC49, 0x8172, 0xAC4A, - 0x8173, 0xAC4C, 0x8174, 0xAC4E, 0x8175, 0xAC4F, 0x8176, 0xAC50, - 0x8177, 0xAC51, 0x8178, 0xAC52, 0x8179, 0xAC53, 0x817A, 0xAC55, - 0x8181, 0xAC56, 0x8182, 0xAC57, 0x8183, 0xAC59, 0x8184, 0xAC5A, - 0x8185, 0xAC5B, 0x8186, 0xAC5D, 0x8187, 0xAC5E, 0x8188, 0xAC5F, - 0x8189, 0xAC60, 0x818A, 0xAC61, 0x818B, 0xAC62, 0x818C, 0xAC63, - 0x818D, 0xAC64, 0x818E, 0xAC65, 0x818F, 0xAC66, 0x8190, 0xAC67, - 0x8191, 0xAC68, 0x8192, 0xAC69, 0x8193, 0xAC6A, 0x8194, 0xAC6B, - 0x8195, 0xAC6C, 0x8196, 0xAC6D, 0x8197, 0xAC6E, 0x8198, 0xAC6F, - 0x8199, 0xAC72, 0x819A, 0xAC73, 0x819B, 0xAC75, 0x819C, 0xAC76, - 0x819D, 0xAC79, 0x819E, 0xAC7B, 0x819F, 0xAC7C, 0x81A0, 0xAC7D, - 0x81A1, 0xAC7E, 0x81A2, 0xAC7F, 0x81A3, 0xAC82, 0x81A4, 0xAC87, - 0x81A5, 0xAC88, 0x81A6, 0xAC8D, 0x81A7, 0xAC8E, 0x81A8, 0xAC8F, - 0x81A9, 0xAC91, 0x81AA, 0xAC92, 0x81AB, 0xAC93, 0x81AC, 0xAC95, - 0x81AD, 0xAC96, 0x81AE, 0xAC97, 0x81AF, 0xAC98, 0x81B0, 0xAC99, - 0x81B1, 0xAC9A, 0x81B2, 0xAC9B, 0x81B3, 0xAC9E, 0x81B4, 0xACA2, - 0x81B5, 0xACA3, 0x81B6, 0xACA4, 0x81B7, 0xACA5, 0x81B8, 0xACA6, - 0x81B9, 0xACA7, 0x81BA, 0xACAB, 0x81BB, 0xACAD, 0x81BC, 0xACAE, - 0x81BD, 0xACB1, 0x81BE, 0xACB2, 0x81BF, 0xACB3, 0x81C0, 0xACB4, - 0x81C1, 0xACB5, 0x81C2, 0xACB6, 0x81C3, 0xACB7, 0x81C4, 0xACBA, - 0x81C5, 0xACBE, 0x81C6, 0xACBF, 0x81C7, 0xACC0, 0x81C8, 0xACC2, - 0x81C9, 0xACC3, 0x81CA, 0xACC5, 0x81CB, 0xACC6, 0x81CC, 0xACC7, - 0x81CD, 0xACC9, 0x81CE, 0xACCA, 0x81CF, 0xACCB, 0x81D0, 0xACCD, - 0x81D1, 0xACCE, 0x81D2, 0xACCF, 0x81D3, 0xACD0, 0x81D4, 0xACD1, - 0x81D5, 0xACD2, 0x81D6, 0xACD3, 0x81D7, 0xACD4, 0x81D8, 0xACD6, - 0x81D9, 0xACD8, 0x81DA, 0xACD9, 0x81DB, 0xACDA, 0x81DC, 0xACDB, - 0x81DD, 0xACDC, 0x81DE, 0xACDD, 0x81DF, 0xACDE, 0x81E0, 0xACDF, - 0x81E1, 0xACE2, 0x81E2, 0xACE3, 0x81E3, 0xACE5, 0x81E4, 0xACE6, - 0x81E5, 0xACE9, 0x81E6, 0xACEB, 0x81E7, 0xACED, 0x81E8, 0xACEE, - 0x81E9, 0xACF2, 0x81EA, 0xACF4, 0x81EB, 0xACF7, 0x81EC, 0xACF8, - 0x81ED, 0xACF9, 0x81EE, 0xACFA, 0x81EF, 0xACFB, 0x81F0, 0xACFE, - 0x81F1, 0xACFF, 0x81F2, 0xAD01, 0x81F3, 0xAD02, 0x81F4, 0xAD03, - 0x81F5, 0xAD05, 0x81F6, 0xAD07, 0x81F7, 0xAD08, 0x81F8, 0xAD09, - 0x81F9, 0xAD0A, 0x81FA, 0xAD0B, 0x81FB, 0xAD0E, 0x81FC, 0xAD10, - 0x81FD, 0xAD12, 0x81FE, 0xAD13, 0x8241, 0xAD14, 0x8242, 0xAD15, - 0x8243, 0xAD16, 0x8244, 0xAD17, 0x8245, 0xAD19, 0x8246, 0xAD1A, - 0x8247, 0xAD1B, 0x8248, 0xAD1D, 0x8249, 0xAD1E, 0x824A, 0xAD1F, - 0x824B, 0xAD21, 0x824C, 0xAD22, 0x824D, 0xAD23, 0x824E, 0xAD24, - 0x824F, 0xAD25, 0x8250, 0xAD26, 0x8251, 0xAD27, 0x8252, 0xAD28, - 0x8253, 0xAD2A, 0x8254, 0xAD2B, 0x8255, 0xAD2E, 0x8256, 0xAD2F, - 0x8257, 0xAD30, 0x8258, 0xAD31, 0x8259, 0xAD32, 0x825A, 0xAD33, - 0x8261, 0xAD36, 0x8262, 0xAD37, 0x8263, 0xAD39, 0x8264, 0xAD3A, - 0x8265, 0xAD3B, 0x8266, 0xAD3D, 0x8267, 0xAD3E, 0x8268, 0xAD3F, - 0x8269, 0xAD40, 0x826A, 0xAD41, 0x826B, 0xAD42, 0x826C, 0xAD43, - 0x826D, 0xAD46, 0x826E, 0xAD48, 0x826F, 0xAD4A, 0x8270, 0xAD4B, - 0x8271, 0xAD4C, 0x8272, 0xAD4D, 0x8273, 0xAD4E, 0x8274, 0xAD4F, - 0x8275, 0xAD51, 0x8276, 0xAD52, 0x8277, 0xAD53, 0x8278, 0xAD55, - 0x8279, 0xAD56, 0x827A, 0xAD57, 0x8281, 0xAD59, 0x8282, 0xAD5A, - 0x8283, 0xAD5B, 0x8284, 0xAD5C, 0x8285, 0xAD5D, 0x8286, 0xAD5E, - 0x8287, 0xAD5F, 0x8288, 0xAD60, 0x8289, 0xAD62, 0x828A, 0xAD64, - 0x828B, 0xAD65, 0x828C, 0xAD66, 0x828D, 0xAD67, 0x828E, 0xAD68, - 0x828F, 0xAD69, 0x8290, 0xAD6A, 0x8291, 0xAD6B, 0x8292, 0xAD6E, - 0x8293, 0xAD6F, 0x8294, 0xAD71, 0x8295, 0xAD72, 0x8296, 0xAD77, - 0x8297, 0xAD78, 0x8298, 0xAD79, 0x8299, 0xAD7A, 0x829A, 0xAD7E, - 0x829B, 0xAD80, 0x829C, 0xAD83, 0x829D, 0xAD84, 0x829E, 0xAD85, - 0x829F, 0xAD86, 0x82A0, 0xAD87, 0x82A1, 0xAD8A, 0x82A2, 0xAD8B, - 0x82A3, 0xAD8D, 0x82A4, 0xAD8E, 0x82A5, 0xAD8F, 0x82A6, 0xAD91, - 0x82A7, 0xAD92, 0x82A8, 0xAD93, 0x82A9, 0xAD94, 0x82AA, 0xAD95, - 0x82AB, 0xAD96, 0x82AC, 0xAD97, 0x82AD, 0xAD98, 0x82AE, 0xAD99, - 0x82AF, 0xAD9A, 0x82B0, 0xAD9B, 0x82B1, 0xAD9E, 0x82B2, 0xAD9F, - 0x82B3, 0xADA0, 0x82B4, 0xADA1, 0x82B5, 0xADA2, 0x82B6, 0xADA3, - 0x82B7, 0xADA5, 0x82B8, 0xADA6, 0x82B9, 0xADA7, 0x82BA, 0xADA8, - 0x82BB, 0xADA9, 0x82BC, 0xADAA, 0x82BD, 0xADAB, 0x82BE, 0xADAC, - 0x82BF, 0xADAD, 0x82C0, 0xADAE, 0x82C1, 0xADAF, 0x82C2, 0xADB0, - 0x82C3, 0xADB1, 0x82C4, 0xADB2, 0x82C5, 0xADB3, 0x82C6, 0xADB4, - 0x82C7, 0xADB5, 0x82C8, 0xADB6, 0x82C9, 0xADB8, 0x82CA, 0xADB9, - 0x82CB, 0xADBA, 0x82CC, 0xADBB, 0x82CD, 0xADBC, 0x82CE, 0xADBD, - 0x82CF, 0xADBE, 0x82D0, 0xADBF, 0x82D1, 0xADC2, 0x82D2, 0xADC3, - 0x82D3, 0xADC5, 0x82D4, 0xADC6, 0x82D5, 0xADC7, 0x82D6, 0xADC9, - 0x82D7, 0xADCA, 0x82D8, 0xADCB, 0x82D9, 0xADCC, 0x82DA, 0xADCD, - 0x82DB, 0xADCE, 0x82DC, 0xADCF, 0x82DD, 0xADD2, 0x82DE, 0xADD4, - 0x82DF, 0xADD5, 0x82E0, 0xADD6, 0x82E1, 0xADD7, 0x82E2, 0xADD8, - 0x82E3, 0xADD9, 0x82E4, 0xADDA, 0x82E5, 0xADDB, 0x82E6, 0xADDD, - 0x82E7, 0xADDE, 0x82E8, 0xADDF, 0x82E9, 0xADE1, 0x82EA, 0xADE2, - 0x82EB, 0xADE3, 0x82EC, 0xADE5, 0x82ED, 0xADE6, 0x82EE, 0xADE7, - 0x82EF, 0xADE8, 0x82F0, 0xADE9, 0x82F1, 0xADEA, 0x82F2, 0xADEB, - 0x82F3, 0xADEC, 0x82F4, 0xADED, 0x82F5, 0xADEE, 0x82F6, 0xADEF, - 0x82F7, 0xADF0, 0x82F8, 0xADF1, 0x82F9, 0xADF2, 0x82FA, 0xADF3, - 0x82FB, 0xADF4, 0x82FC, 0xADF5, 0x82FD, 0xADF6, 0x82FE, 0xADF7, - 0x8341, 0xADFA, 0x8342, 0xADFB, 0x8343, 0xADFD, 0x8344, 0xADFE, - 0x8345, 0xAE02, 0x8346, 0xAE03, 0x8347, 0xAE04, 0x8348, 0xAE05, - 0x8349, 0xAE06, 0x834A, 0xAE07, 0x834B, 0xAE0A, 0x834C, 0xAE0C, - 0x834D, 0xAE0E, 0x834E, 0xAE0F, 0x834F, 0xAE10, 0x8350, 0xAE11, - 0x8351, 0xAE12, 0x8352, 0xAE13, 0x8353, 0xAE15, 0x8354, 0xAE16, - 0x8355, 0xAE17, 0x8356, 0xAE18, 0x8357, 0xAE19, 0x8358, 0xAE1A, - 0x8359, 0xAE1B, 0x835A, 0xAE1C, 0x8361, 0xAE1D, 0x8362, 0xAE1E, - 0x8363, 0xAE1F, 0x8364, 0xAE20, 0x8365, 0xAE21, 0x8366, 0xAE22, - 0x8367, 0xAE23, 0x8368, 0xAE24, 0x8369, 0xAE25, 0x836A, 0xAE26, - 0x836B, 0xAE27, 0x836C, 0xAE28, 0x836D, 0xAE29, 0x836E, 0xAE2A, - 0x836F, 0xAE2B, 0x8370, 0xAE2C, 0x8371, 0xAE2D, 0x8372, 0xAE2E, - 0x8373, 0xAE2F, 0x8374, 0xAE32, 0x8375, 0xAE33, 0x8376, 0xAE35, - 0x8377, 0xAE36, 0x8378, 0xAE39, 0x8379, 0xAE3B, 0x837A, 0xAE3C, - 0x8381, 0xAE3D, 0x8382, 0xAE3E, 0x8383, 0xAE3F, 0x8384, 0xAE42, - 0x8385, 0xAE44, 0x8386, 0xAE47, 0x8387, 0xAE48, 0x8388, 0xAE49, - 0x8389, 0xAE4B, 0x838A, 0xAE4F, 0x838B, 0xAE51, 0x838C, 0xAE52, - 0x838D, 0xAE53, 0x838E, 0xAE55, 0x838F, 0xAE57, 0x8390, 0xAE58, - 0x8391, 0xAE59, 0x8392, 0xAE5A, 0x8393, 0xAE5B, 0x8394, 0xAE5E, - 0x8395, 0xAE62, 0x8396, 0xAE63, 0x8397, 0xAE64, 0x8398, 0xAE66, - 0x8399, 0xAE67, 0x839A, 0xAE6A, 0x839B, 0xAE6B, 0x839C, 0xAE6D, - 0x839D, 0xAE6E, 0x839E, 0xAE6F, 0x839F, 0xAE71, 0x83A0, 0xAE72, - 0x83A1, 0xAE73, 0x83A2, 0xAE74, 0x83A3, 0xAE75, 0x83A4, 0xAE76, - 0x83A5, 0xAE77, 0x83A6, 0xAE7A, 0x83A7, 0xAE7E, 0x83A8, 0xAE7F, - 0x83A9, 0xAE80, 0x83AA, 0xAE81, 0x83AB, 0xAE82, 0x83AC, 0xAE83, - 0x83AD, 0xAE86, 0x83AE, 0xAE87, 0x83AF, 0xAE88, 0x83B0, 0xAE89, - 0x83B1, 0xAE8A, 0x83B2, 0xAE8B, 0x83B3, 0xAE8D, 0x83B4, 0xAE8E, - 0x83B5, 0xAE8F, 0x83B6, 0xAE90, 0x83B7, 0xAE91, 0x83B8, 0xAE92, - 0x83B9, 0xAE93, 0x83BA, 0xAE94, 0x83BB, 0xAE95, 0x83BC, 0xAE96, - 0x83BD, 0xAE97, 0x83BE, 0xAE98, 0x83BF, 0xAE99, 0x83C0, 0xAE9A, - 0x83C1, 0xAE9B, 0x83C2, 0xAE9C, 0x83C3, 0xAE9D, 0x83C4, 0xAE9E, - 0x83C5, 0xAE9F, 0x83C6, 0xAEA0, 0x83C7, 0xAEA1, 0x83C8, 0xAEA2, - 0x83C9, 0xAEA3, 0x83CA, 0xAEA4, 0x83CB, 0xAEA5, 0x83CC, 0xAEA6, - 0x83CD, 0xAEA7, 0x83CE, 0xAEA8, 0x83CF, 0xAEA9, 0x83D0, 0xAEAA, - 0x83D1, 0xAEAB, 0x83D2, 0xAEAC, 0x83D3, 0xAEAD, 0x83D4, 0xAEAE, - 0x83D5, 0xAEAF, 0x83D6, 0xAEB0, 0x83D7, 0xAEB1, 0x83D8, 0xAEB2, - 0x83D9, 0xAEB3, 0x83DA, 0xAEB4, 0x83DB, 0xAEB5, 0x83DC, 0xAEB6, - 0x83DD, 0xAEB7, 0x83DE, 0xAEB8, 0x83DF, 0xAEB9, 0x83E0, 0xAEBA, - 0x83E1, 0xAEBB, 0x83E2, 0xAEBF, 0x83E3, 0xAEC1, 0x83E4, 0xAEC2, - 0x83E5, 0xAEC3, 0x83E6, 0xAEC5, 0x83E7, 0xAEC6, 0x83E8, 0xAEC7, - 0x83E9, 0xAEC8, 0x83EA, 0xAEC9, 0x83EB, 0xAECA, 0x83EC, 0xAECB, - 0x83ED, 0xAECE, 0x83EE, 0xAED2, 0x83EF, 0xAED3, 0x83F0, 0xAED4, - 0x83F1, 0xAED5, 0x83F2, 0xAED6, 0x83F3, 0xAED7, 0x83F4, 0xAEDA, - 0x83F5, 0xAEDB, 0x83F6, 0xAEDD, 0x83F7, 0xAEDE, 0x83F8, 0xAEDF, - 0x83F9, 0xAEE0, 0x83FA, 0xAEE1, 0x83FB, 0xAEE2, 0x83FC, 0xAEE3, - 0x83FD, 0xAEE4, 0x83FE, 0xAEE5, 0x8441, 0xAEE6, 0x8442, 0xAEE7, - 0x8443, 0xAEE9, 0x8444, 0xAEEA, 0x8445, 0xAEEC, 0x8446, 0xAEEE, - 0x8447, 0xAEEF, 0x8448, 0xAEF0, 0x8449, 0xAEF1, 0x844A, 0xAEF2, - 0x844B, 0xAEF3, 0x844C, 0xAEF5, 0x844D, 0xAEF6, 0x844E, 0xAEF7, - 0x844F, 0xAEF9, 0x8450, 0xAEFA, 0x8451, 0xAEFB, 0x8452, 0xAEFD, - 0x8453, 0xAEFE, 0x8454, 0xAEFF, 0x8455, 0xAF00, 0x8456, 0xAF01, - 0x8457, 0xAF02, 0x8458, 0xAF03, 0x8459, 0xAF04, 0x845A, 0xAF05, - 0x8461, 0xAF06, 0x8462, 0xAF09, 0x8463, 0xAF0A, 0x8464, 0xAF0B, - 0x8465, 0xAF0C, 0x8466, 0xAF0E, 0x8467, 0xAF0F, 0x8468, 0xAF11, - 0x8469, 0xAF12, 0x846A, 0xAF13, 0x846B, 0xAF14, 0x846C, 0xAF15, - 0x846D, 0xAF16, 0x846E, 0xAF17, 0x846F, 0xAF18, 0x8470, 0xAF19, - 0x8471, 0xAF1A, 0x8472, 0xAF1B, 0x8473, 0xAF1C, 0x8474, 0xAF1D, - 0x8475, 0xAF1E, 0x8476, 0xAF1F, 0x8477, 0xAF20, 0x8478, 0xAF21, - 0x8479, 0xAF22, 0x847A, 0xAF23, 0x8481, 0xAF24, 0x8482, 0xAF25, - 0x8483, 0xAF26, 0x8484, 0xAF27, 0x8485, 0xAF28, 0x8486, 0xAF29, - 0x8487, 0xAF2A, 0x8488, 0xAF2B, 0x8489, 0xAF2E, 0x848A, 0xAF2F, - 0x848B, 0xAF31, 0x848C, 0xAF33, 0x848D, 0xAF35, 0x848E, 0xAF36, - 0x848F, 0xAF37, 0x8490, 0xAF38, 0x8491, 0xAF39, 0x8492, 0xAF3A, - 0x8493, 0xAF3B, 0x8494, 0xAF3E, 0x8495, 0xAF40, 0x8496, 0xAF44, - 0x8497, 0xAF45, 0x8498, 0xAF46, 0x8499, 0xAF47, 0x849A, 0xAF4A, - 0x849B, 0xAF4B, 0x849C, 0xAF4C, 0x849D, 0xAF4D, 0x849E, 0xAF4E, - 0x849F, 0xAF4F, 0x84A0, 0xAF51, 0x84A1, 0xAF52, 0x84A2, 0xAF53, - 0x84A3, 0xAF54, 0x84A4, 0xAF55, 0x84A5, 0xAF56, 0x84A6, 0xAF57, - 0x84A7, 0xAF58, 0x84A8, 0xAF59, 0x84A9, 0xAF5A, 0x84AA, 0xAF5B, - 0x84AB, 0xAF5E, 0x84AC, 0xAF5F, 0x84AD, 0xAF60, 0x84AE, 0xAF61, - 0x84AF, 0xAF62, 0x84B0, 0xAF63, 0x84B1, 0xAF66, 0x84B2, 0xAF67, - 0x84B3, 0xAF68, 0x84B4, 0xAF69, 0x84B5, 0xAF6A, 0x84B6, 0xAF6B, - 0x84B7, 0xAF6C, 0x84B8, 0xAF6D, 0x84B9, 0xAF6E, 0x84BA, 0xAF6F, - 0x84BB, 0xAF70, 0x84BC, 0xAF71, 0x84BD, 0xAF72, 0x84BE, 0xAF73, - 0x84BF, 0xAF74, 0x84C0, 0xAF75, 0x84C1, 0xAF76, 0x84C2, 0xAF77, - 0x84C3, 0xAF78, 0x84C4, 0xAF7A, 0x84C5, 0xAF7B, 0x84C6, 0xAF7C, - 0x84C7, 0xAF7D, 0x84C8, 0xAF7E, 0x84C9, 0xAF7F, 0x84CA, 0xAF81, - 0x84CB, 0xAF82, 0x84CC, 0xAF83, 0x84CD, 0xAF85, 0x84CE, 0xAF86, - 0x84CF, 0xAF87, 0x84D0, 0xAF89, 0x84D1, 0xAF8A, 0x84D2, 0xAF8B, - 0x84D3, 0xAF8C, 0x84D4, 0xAF8D, 0x84D5, 0xAF8E, 0x84D6, 0xAF8F, - 0x84D7, 0xAF92, 0x84D8, 0xAF93, 0x84D9, 0xAF94, 0x84DA, 0xAF96, - 0x84DB, 0xAF97, 0x84DC, 0xAF98, 0x84DD, 0xAF99, 0x84DE, 0xAF9A, - 0x84DF, 0xAF9B, 0x84E0, 0xAF9D, 0x84E1, 0xAF9E, 0x84E2, 0xAF9F, - 0x84E3, 0xAFA0, 0x84E4, 0xAFA1, 0x84E5, 0xAFA2, 0x84E6, 0xAFA3, - 0x84E7, 0xAFA4, 0x84E8, 0xAFA5, 0x84E9, 0xAFA6, 0x84EA, 0xAFA7, - 0x84EB, 0xAFA8, 0x84EC, 0xAFA9, 0x84ED, 0xAFAA, 0x84EE, 0xAFAB, - 0x84EF, 0xAFAC, 0x84F0, 0xAFAD, 0x84F1, 0xAFAE, 0x84F2, 0xAFAF, - 0x84F3, 0xAFB0, 0x84F4, 0xAFB1, 0x84F5, 0xAFB2, 0x84F6, 0xAFB3, - 0x84F7, 0xAFB4, 0x84F8, 0xAFB5, 0x84F9, 0xAFB6, 0x84FA, 0xAFB7, - 0x84FB, 0xAFBA, 0x84FC, 0xAFBB, 0x84FD, 0xAFBD, 0x84FE, 0xAFBE, - 0x8541, 0xAFBF, 0x8542, 0xAFC1, 0x8543, 0xAFC2, 0x8544, 0xAFC3, - 0x8545, 0xAFC4, 0x8546, 0xAFC5, 0x8547, 0xAFC6, 0x8548, 0xAFCA, - 0x8549, 0xAFCC, 0x854A, 0xAFCF, 0x854B, 0xAFD0, 0x854C, 0xAFD1, - 0x854D, 0xAFD2, 0x854E, 0xAFD3, 0x854F, 0xAFD5, 0x8550, 0xAFD6, - 0x8551, 0xAFD7, 0x8552, 0xAFD8, 0x8553, 0xAFD9, 0x8554, 0xAFDA, - 0x8555, 0xAFDB, 0x8556, 0xAFDD, 0x8557, 0xAFDE, 0x8558, 0xAFDF, - 0x8559, 0xAFE0, 0x855A, 0xAFE1, 0x8561, 0xAFE2, 0x8562, 0xAFE3, - 0x8563, 0xAFE4, 0x8564, 0xAFE5, 0x8565, 0xAFE6, 0x8566, 0xAFE7, - 0x8567, 0xAFEA, 0x8568, 0xAFEB, 0x8569, 0xAFEC, 0x856A, 0xAFED, - 0x856B, 0xAFEE, 0x856C, 0xAFEF, 0x856D, 0xAFF2, 0x856E, 0xAFF3, - 0x856F, 0xAFF5, 0x8570, 0xAFF6, 0x8571, 0xAFF7, 0x8572, 0xAFF9, - 0x8573, 0xAFFA, 0x8574, 0xAFFB, 0x8575, 0xAFFC, 0x8576, 0xAFFD, - 0x8577, 0xAFFE, 0x8578, 0xAFFF, 0x8579, 0xB002, 0x857A, 0xB003, - 0x8581, 0xB005, 0x8582, 0xB006, 0x8583, 0xB007, 0x8584, 0xB008, - 0x8585, 0xB009, 0x8586, 0xB00A, 0x8587, 0xB00B, 0x8588, 0xB00D, - 0x8589, 0xB00E, 0x858A, 0xB00F, 0x858B, 0xB011, 0x858C, 0xB012, - 0x858D, 0xB013, 0x858E, 0xB015, 0x858F, 0xB016, 0x8590, 0xB017, - 0x8591, 0xB018, 0x8592, 0xB019, 0x8593, 0xB01A, 0x8594, 0xB01B, - 0x8595, 0xB01E, 0x8596, 0xB01F, 0x8597, 0xB020, 0x8598, 0xB021, - 0x8599, 0xB022, 0x859A, 0xB023, 0x859B, 0xB024, 0x859C, 0xB025, - 0x859D, 0xB026, 0x859E, 0xB027, 0x859F, 0xB029, 0x85A0, 0xB02A, - 0x85A1, 0xB02B, 0x85A2, 0xB02C, 0x85A3, 0xB02D, 0x85A4, 0xB02E, - 0x85A5, 0xB02F, 0x85A6, 0xB030, 0x85A7, 0xB031, 0x85A8, 0xB032, - 0x85A9, 0xB033, 0x85AA, 0xB034, 0x85AB, 0xB035, 0x85AC, 0xB036, - 0x85AD, 0xB037, 0x85AE, 0xB038, 0x85AF, 0xB039, 0x85B0, 0xB03A, - 0x85B1, 0xB03B, 0x85B2, 0xB03C, 0x85B3, 0xB03D, 0x85B4, 0xB03E, - 0x85B5, 0xB03F, 0x85B6, 0xB040, 0x85B7, 0xB041, 0x85B8, 0xB042, - 0x85B9, 0xB043, 0x85BA, 0xB046, 0x85BB, 0xB047, 0x85BC, 0xB049, - 0x85BD, 0xB04B, 0x85BE, 0xB04D, 0x85BF, 0xB04F, 0x85C0, 0xB050, - 0x85C1, 0xB051, 0x85C2, 0xB052, 0x85C3, 0xB056, 0x85C4, 0xB058, - 0x85C5, 0xB05A, 0x85C6, 0xB05B, 0x85C7, 0xB05C, 0x85C8, 0xB05E, - 0x85C9, 0xB05F, 0x85CA, 0xB060, 0x85CB, 0xB061, 0x85CC, 0xB062, - 0x85CD, 0xB063, 0x85CE, 0xB064, 0x85CF, 0xB065, 0x85D0, 0xB066, - 0x85D1, 0xB067, 0x85D2, 0xB068, 0x85D3, 0xB069, 0x85D4, 0xB06A, - 0x85D5, 0xB06B, 0x85D6, 0xB06C, 0x85D7, 0xB06D, 0x85D8, 0xB06E, - 0x85D9, 0xB06F, 0x85DA, 0xB070, 0x85DB, 0xB071, 0x85DC, 0xB072, - 0x85DD, 0xB073, 0x85DE, 0xB074, 0x85DF, 0xB075, 0x85E0, 0xB076, - 0x85E1, 0xB077, 0x85E2, 0xB078, 0x85E3, 0xB079, 0x85E4, 0xB07A, - 0x85E5, 0xB07B, 0x85E6, 0xB07E, 0x85E7, 0xB07F, 0x85E8, 0xB081, - 0x85E9, 0xB082, 0x85EA, 0xB083, 0x85EB, 0xB085, 0x85EC, 0xB086, - 0x85ED, 0xB087, 0x85EE, 0xB088, 0x85EF, 0xB089, 0x85F0, 0xB08A, - 0x85F1, 0xB08B, 0x85F2, 0xB08E, 0x85F3, 0xB090, 0x85F4, 0xB092, - 0x85F5, 0xB093, 0x85F6, 0xB094, 0x85F7, 0xB095, 0x85F8, 0xB096, - 0x85F9, 0xB097, 0x85FA, 0xB09B, 0x85FB, 0xB09D, 0x85FC, 0xB09E, - 0x85FD, 0xB0A3, 0x85FE, 0xB0A4, 0x8641, 0xB0A5, 0x8642, 0xB0A6, - 0x8643, 0xB0A7, 0x8644, 0xB0AA, 0x8645, 0xB0B0, 0x8646, 0xB0B2, - 0x8647, 0xB0B6, 0x8648, 0xB0B7, 0x8649, 0xB0B9, 0x864A, 0xB0BA, - 0x864B, 0xB0BB, 0x864C, 0xB0BD, 0x864D, 0xB0BE, 0x864E, 0xB0BF, - 0x864F, 0xB0C0, 0x8650, 0xB0C1, 0x8651, 0xB0C2, 0x8652, 0xB0C3, - 0x8653, 0xB0C6, 0x8654, 0xB0CA, 0x8655, 0xB0CB, 0x8656, 0xB0CC, - 0x8657, 0xB0CD, 0x8658, 0xB0CE, 0x8659, 0xB0CF, 0x865A, 0xB0D2, - 0x8661, 0xB0D3, 0x8662, 0xB0D5, 0x8663, 0xB0D6, 0x8664, 0xB0D7, - 0x8665, 0xB0D9, 0x8666, 0xB0DA, 0x8667, 0xB0DB, 0x8668, 0xB0DC, - 0x8669, 0xB0DD, 0x866A, 0xB0DE, 0x866B, 0xB0DF, 0x866C, 0xB0E1, - 0x866D, 0xB0E2, 0x866E, 0xB0E3, 0x866F, 0xB0E4, 0x8670, 0xB0E6, - 0x8671, 0xB0E7, 0x8672, 0xB0E8, 0x8673, 0xB0E9, 0x8674, 0xB0EA, - 0x8675, 0xB0EB, 0x8676, 0xB0EC, 0x8677, 0xB0ED, 0x8678, 0xB0EE, - 0x8679, 0xB0EF, 0x867A, 0xB0F0, 0x8681, 0xB0F1, 0x8682, 0xB0F2, - 0x8683, 0xB0F3, 0x8684, 0xB0F4, 0x8685, 0xB0F5, 0x8686, 0xB0F6, - 0x8687, 0xB0F7, 0x8688, 0xB0F8, 0x8689, 0xB0F9, 0x868A, 0xB0FA, - 0x868B, 0xB0FB, 0x868C, 0xB0FC, 0x868D, 0xB0FD, 0x868E, 0xB0FE, - 0x868F, 0xB0FF, 0x8690, 0xB100, 0x8691, 0xB101, 0x8692, 0xB102, - 0x8693, 0xB103, 0x8694, 0xB104, 0x8695, 0xB105, 0x8696, 0xB106, - 0x8697, 0xB107, 0x8698, 0xB10A, 0x8699, 0xB10D, 0x869A, 0xB10E, - 0x869B, 0xB10F, 0x869C, 0xB111, 0x869D, 0xB114, 0x869E, 0xB115, - 0x869F, 0xB116, 0x86A0, 0xB117, 0x86A1, 0xB11A, 0x86A2, 0xB11E, - 0x86A3, 0xB11F, 0x86A4, 0xB120, 0x86A5, 0xB121, 0x86A6, 0xB122, - 0x86A7, 0xB126, 0x86A8, 0xB127, 0x86A9, 0xB129, 0x86AA, 0xB12A, - 0x86AB, 0xB12B, 0x86AC, 0xB12D, 0x86AD, 0xB12E, 0x86AE, 0xB12F, - 0x86AF, 0xB130, 0x86B0, 0xB131, 0x86B1, 0xB132, 0x86B2, 0xB133, - 0x86B3, 0xB136, 0x86B4, 0xB13A, 0x86B5, 0xB13B, 0x86B6, 0xB13C, - 0x86B7, 0xB13D, 0x86B8, 0xB13E, 0x86B9, 0xB13F, 0x86BA, 0xB142, - 0x86BB, 0xB143, 0x86BC, 0xB145, 0x86BD, 0xB146, 0x86BE, 0xB147, - 0x86BF, 0xB149, 0x86C0, 0xB14A, 0x86C1, 0xB14B, 0x86C2, 0xB14C, - 0x86C3, 0xB14D, 0x86C4, 0xB14E, 0x86C5, 0xB14F, 0x86C6, 0xB152, - 0x86C7, 0xB153, 0x86C8, 0xB156, 0x86C9, 0xB157, 0x86CA, 0xB159, - 0x86CB, 0xB15A, 0x86CC, 0xB15B, 0x86CD, 0xB15D, 0x86CE, 0xB15E, - 0x86CF, 0xB15F, 0x86D0, 0xB161, 0x86D1, 0xB162, 0x86D2, 0xB163, - 0x86D3, 0xB164, 0x86D4, 0xB165, 0x86D5, 0xB166, 0x86D6, 0xB167, - 0x86D7, 0xB168, 0x86D8, 0xB169, 0x86D9, 0xB16A, 0x86DA, 0xB16B, - 0x86DB, 0xB16C, 0x86DC, 0xB16D, 0x86DD, 0xB16E, 0x86DE, 0xB16F, - 0x86DF, 0xB170, 0x86E0, 0xB171, 0x86E1, 0xB172, 0x86E2, 0xB173, - 0x86E3, 0xB174, 0x86E4, 0xB175, 0x86E5, 0xB176, 0x86E6, 0xB177, - 0x86E7, 0xB17A, 0x86E8, 0xB17B, 0x86E9, 0xB17D, 0x86EA, 0xB17E, - 0x86EB, 0xB17F, 0x86EC, 0xB181, 0x86ED, 0xB183, 0x86EE, 0xB184, - 0x86EF, 0xB185, 0x86F0, 0xB186, 0x86F1, 0xB187, 0x86F2, 0xB18A, - 0x86F3, 0xB18C, 0x86F4, 0xB18E, 0x86F5, 0xB18F, 0x86F6, 0xB190, - 0x86F7, 0xB191, 0x86F8, 0xB195, 0x86F9, 0xB196, 0x86FA, 0xB197, - 0x86FB, 0xB199, 0x86FC, 0xB19A, 0x86FD, 0xB19B, 0x86FE, 0xB19D, - 0x8741, 0xB19E, 0x8742, 0xB19F, 0x8743, 0xB1A0, 0x8744, 0xB1A1, - 0x8745, 0xB1A2, 0x8746, 0xB1A3, 0x8747, 0xB1A4, 0x8748, 0xB1A5, - 0x8749, 0xB1A6, 0x874A, 0xB1A7, 0x874B, 0xB1A9, 0x874C, 0xB1AA, - 0x874D, 0xB1AB, 0x874E, 0xB1AC, 0x874F, 0xB1AD, 0x8750, 0xB1AE, - 0x8751, 0xB1AF, 0x8752, 0xB1B0, 0x8753, 0xB1B1, 0x8754, 0xB1B2, - 0x8755, 0xB1B3, 0x8756, 0xB1B4, 0x8757, 0xB1B5, 0x8758, 0xB1B6, - 0x8759, 0xB1B7, 0x875A, 0xB1B8, 0x8761, 0xB1B9, 0x8762, 0xB1BA, - 0x8763, 0xB1BB, 0x8764, 0xB1BC, 0x8765, 0xB1BD, 0x8766, 0xB1BE, - 0x8767, 0xB1BF, 0x8768, 0xB1C0, 0x8769, 0xB1C1, 0x876A, 0xB1C2, - 0x876B, 0xB1C3, 0x876C, 0xB1C4, 0x876D, 0xB1C5, 0x876E, 0xB1C6, - 0x876F, 0xB1C7, 0x8770, 0xB1C8, 0x8771, 0xB1C9, 0x8772, 0xB1CA, - 0x8773, 0xB1CB, 0x8774, 0xB1CD, 0x8775, 0xB1CE, 0x8776, 0xB1CF, - 0x8777, 0xB1D1, 0x8778, 0xB1D2, 0x8779, 0xB1D3, 0x877A, 0xB1D5, - 0x8781, 0xB1D6, 0x8782, 0xB1D7, 0x8783, 0xB1D8, 0x8784, 0xB1D9, - 0x8785, 0xB1DA, 0x8786, 0xB1DB, 0x8787, 0xB1DE, 0x8788, 0xB1E0, - 0x8789, 0xB1E1, 0x878A, 0xB1E2, 0x878B, 0xB1E3, 0x878C, 0xB1E4, - 0x878D, 0xB1E5, 0x878E, 0xB1E6, 0x878F, 0xB1E7, 0x8790, 0xB1EA, - 0x8791, 0xB1EB, 0x8792, 0xB1ED, 0x8793, 0xB1EE, 0x8794, 0xB1EF, - 0x8795, 0xB1F1, 0x8796, 0xB1F2, 0x8797, 0xB1F3, 0x8798, 0xB1F4, - 0x8799, 0xB1F5, 0x879A, 0xB1F6, 0x879B, 0xB1F7, 0x879C, 0xB1F8, - 0x879D, 0xB1FA, 0x879E, 0xB1FC, 0x879F, 0xB1FE, 0x87A0, 0xB1FF, - 0x87A1, 0xB200, 0x87A2, 0xB201, 0x87A3, 0xB202, 0x87A4, 0xB203, - 0x87A5, 0xB206, 0x87A6, 0xB207, 0x87A7, 0xB209, 0x87A8, 0xB20A, - 0x87A9, 0xB20D, 0x87AA, 0xB20E, 0x87AB, 0xB20F, 0x87AC, 0xB210, - 0x87AD, 0xB211, 0x87AE, 0xB212, 0x87AF, 0xB213, 0x87B0, 0xB216, - 0x87B1, 0xB218, 0x87B2, 0xB21A, 0x87B3, 0xB21B, 0x87B4, 0xB21C, - 0x87B5, 0xB21D, 0x87B6, 0xB21E, 0x87B7, 0xB21F, 0x87B8, 0xB221, - 0x87B9, 0xB222, 0x87BA, 0xB223, 0x87BB, 0xB224, 0x87BC, 0xB225, - 0x87BD, 0xB226, 0x87BE, 0xB227, 0x87BF, 0xB228, 0x87C0, 0xB229, - 0x87C1, 0xB22A, 0x87C2, 0xB22B, 0x87C3, 0xB22C, 0x87C4, 0xB22D, - 0x87C5, 0xB22E, 0x87C6, 0xB22F, 0x87C7, 0xB230, 0x87C8, 0xB231, - 0x87C9, 0xB232, 0x87CA, 0xB233, 0x87CB, 0xB235, 0x87CC, 0xB236, - 0x87CD, 0xB237, 0x87CE, 0xB238, 0x87CF, 0xB239, 0x87D0, 0xB23A, - 0x87D1, 0xB23B, 0x87D2, 0xB23D, 0x87D3, 0xB23E, 0x87D4, 0xB23F, - 0x87D5, 0xB240, 0x87D6, 0xB241, 0x87D7, 0xB242, 0x87D8, 0xB243, - 0x87D9, 0xB244, 0x87DA, 0xB245, 0x87DB, 0xB246, 0x87DC, 0xB247, - 0x87DD, 0xB248, 0x87DE, 0xB249, 0x87DF, 0xB24A, 0x87E0, 0xB24B, - 0x87E1, 0xB24C, 0x87E2, 0xB24D, 0x87E3, 0xB24E, 0x87E4, 0xB24F, - 0x87E5, 0xB250, 0x87E6, 0xB251, 0x87E7, 0xB252, 0x87E8, 0xB253, - 0x87E9, 0xB254, 0x87EA, 0xB255, 0x87EB, 0xB256, 0x87EC, 0xB257, - 0x87ED, 0xB259, 0x87EE, 0xB25A, 0x87EF, 0xB25B, 0x87F0, 0xB25D, - 0x87F1, 0xB25E, 0x87F2, 0xB25F, 0x87F3, 0xB261, 0x87F4, 0xB262, - 0x87F5, 0xB263, 0x87F6, 0xB264, 0x87F7, 0xB265, 0x87F8, 0xB266, - 0x87F9, 0xB267, 0x87FA, 0xB26A, 0x87FB, 0xB26B, 0x87FC, 0xB26C, - 0x87FD, 0xB26D, 0x87FE, 0xB26E, 0x8841, 0xB26F, 0x8842, 0xB270, - 0x8843, 0xB271, 0x8844, 0xB272, 0x8845, 0xB273, 0x8846, 0xB276, - 0x8847, 0xB277, 0x8848, 0xB278, 0x8849, 0xB279, 0x884A, 0xB27A, - 0x884B, 0xB27B, 0x884C, 0xB27D, 0x884D, 0xB27E, 0x884E, 0xB27F, - 0x884F, 0xB280, 0x8850, 0xB281, 0x8851, 0xB282, 0x8852, 0xB283, - 0x8853, 0xB286, 0x8854, 0xB287, 0x8855, 0xB288, 0x8856, 0xB28A, - 0x8857, 0xB28B, 0x8858, 0xB28C, 0x8859, 0xB28D, 0x885A, 0xB28E, - 0x8861, 0xB28F, 0x8862, 0xB292, 0x8863, 0xB293, 0x8864, 0xB295, - 0x8865, 0xB296, 0x8866, 0xB297, 0x8867, 0xB29B, 0x8868, 0xB29C, - 0x8869, 0xB29D, 0x886A, 0xB29E, 0x886B, 0xB29F, 0x886C, 0xB2A2, - 0x886D, 0xB2A4, 0x886E, 0xB2A7, 0x886F, 0xB2A8, 0x8870, 0xB2A9, - 0x8871, 0xB2AB, 0x8872, 0xB2AD, 0x8873, 0xB2AE, 0x8874, 0xB2AF, - 0x8875, 0xB2B1, 0x8876, 0xB2B2, 0x8877, 0xB2B3, 0x8878, 0xB2B5, - 0x8879, 0xB2B6, 0x887A, 0xB2B7, 0x8881, 0xB2B8, 0x8882, 0xB2B9, - 0x8883, 0xB2BA, 0x8884, 0xB2BB, 0x8885, 0xB2BC, 0x8886, 0xB2BD, - 0x8887, 0xB2BE, 0x8888, 0xB2BF, 0x8889, 0xB2C0, 0x888A, 0xB2C1, - 0x888B, 0xB2C2, 0x888C, 0xB2C3, 0x888D, 0xB2C4, 0x888E, 0xB2C5, - 0x888F, 0xB2C6, 0x8890, 0xB2C7, 0x8891, 0xB2CA, 0x8892, 0xB2CB, - 0x8893, 0xB2CD, 0x8894, 0xB2CE, 0x8895, 0xB2CF, 0x8896, 0xB2D1, - 0x8897, 0xB2D3, 0x8898, 0xB2D4, 0x8899, 0xB2D5, 0x889A, 0xB2D6, - 0x889B, 0xB2D7, 0x889C, 0xB2DA, 0x889D, 0xB2DC, 0x889E, 0xB2DE, - 0x889F, 0xB2DF, 0x88A0, 0xB2E0, 0x88A1, 0xB2E1, 0x88A2, 0xB2E3, - 0x88A3, 0xB2E7, 0x88A4, 0xB2E9, 0x88A5, 0xB2EA, 0x88A6, 0xB2F0, - 0x88A7, 0xB2F1, 0x88A8, 0xB2F2, 0x88A9, 0xB2F6, 0x88AA, 0xB2FC, - 0x88AB, 0xB2FD, 0x88AC, 0xB2FE, 0x88AD, 0xB302, 0x88AE, 0xB303, - 0x88AF, 0xB305, 0x88B0, 0xB306, 0x88B1, 0xB307, 0x88B2, 0xB309, - 0x88B3, 0xB30A, 0x88B4, 0xB30B, 0x88B5, 0xB30C, 0x88B6, 0xB30D, - 0x88B7, 0xB30E, 0x88B8, 0xB30F, 0x88B9, 0xB312, 0x88BA, 0xB316, - 0x88BB, 0xB317, 0x88BC, 0xB318, 0x88BD, 0xB319, 0x88BE, 0xB31A, - 0x88BF, 0xB31B, 0x88C0, 0xB31D, 0x88C1, 0xB31E, 0x88C2, 0xB31F, - 0x88C3, 0xB320, 0x88C4, 0xB321, 0x88C5, 0xB322, 0x88C6, 0xB323, - 0x88C7, 0xB324, 0x88C8, 0xB325, 0x88C9, 0xB326, 0x88CA, 0xB327, - 0x88CB, 0xB328, 0x88CC, 0xB329, 0x88CD, 0xB32A, 0x88CE, 0xB32B, - 0x88CF, 0xB32C, 0x88D0, 0xB32D, 0x88D1, 0xB32E, 0x88D2, 0xB32F, - 0x88D3, 0xB330, 0x88D4, 0xB331, 0x88D5, 0xB332, 0x88D6, 0xB333, - 0x88D7, 0xB334, 0x88D8, 0xB335, 0x88D9, 0xB336, 0x88DA, 0xB337, - 0x88DB, 0xB338, 0x88DC, 0xB339, 0x88DD, 0xB33A, 0x88DE, 0xB33B, - 0x88DF, 0xB33C, 0x88E0, 0xB33D, 0x88E1, 0xB33E, 0x88E2, 0xB33F, - 0x88E3, 0xB340, 0x88E4, 0xB341, 0x88E5, 0xB342, 0x88E6, 0xB343, - 0x88E7, 0xB344, 0x88E8, 0xB345, 0x88E9, 0xB346, 0x88EA, 0xB347, - 0x88EB, 0xB348, 0x88EC, 0xB349, 0x88ED, 0xB34A, 0x88EE, 0xB34B, - 0x88EF, 0xB34C, 0x88F0, 0xB34D, 0x88F1, 0xB34E, 0x88F2, 0xB34F, - 0x88F3, 0xB350, 0x88F4, 0xB351, 0x88F5, 0xB352, 0x88F6, 0xB353, - 0x88F7, 0xB357, 0x88F8, 0xB359, 0x88F9, 0xB35A, 0x88FA, 0xB35D, - 0x88FB, 0xB360, 0x88FC, 0xB361, 0x88FD, 0xB362, 0x88FE, 0xB363, - 0x8941, 0xB366, 0x8942, 0xB368, 0x8943, 0xB36A, 0x8944, 0xB36C, - 0x8945, 0xB36D, 0x8946, 0xB36F, 0x8947, 0xB372, 0x8948, 0xB373, - 0x8949, 0xB375, 0x894A, 0xB376, 0x894B, 0xB377, 0x894C, 0xB379, - 0x894D, 0xB37A, 0x894E, 0xB37B, 0x894F, 0xB37C, 0x8950, 0xB37D, - 0x8951, 0xB37E, 0x8952, 0xB37F, 0x8953, 0xB382, 0x8954, 0xB386, - 0x8955, 0xB387, 0x8956, 0xB388, 0x8957, 0xB389, 0x8958, 0xB38A, - 0x8959, 0xB38B, 0x895A, 0xB38D, 0x8961, 0xB38E, 0x8962, 0xB38F, - 0x8963, 0xB391, 0x8964, 0xB392, 0x8965, 0xB393, 0x8966, 0xB395, - 0x8967, 0xB396, 0x8968, 0xB397, 0x8969, 0xB398, 0x896A, 0xB399, - 0x896B, 0xB39A, 0x896C, 0xB39B, 0x896D, 0xB39C, 0x896E, 0xB39D, - 0x896F, 0xB39E, 0x8970, 0xB39F, 0x8971, 0xB3A2, 0x8972, 0xB3A3, - 0x8973, 0xB3A4, 0x8974, 0xB3A5, 0x8975, 0xB3A6, 0x8976, 0xB3A7, - 0x8977, 0xB3A9, 0x8978, 0xB3AA, 0x8979, 0xB3AB, 0x897A, 0xB3AD, - 0x8981, 0xB3AE, 0x8982, 0xB3AF, 0x8983, 0xB3B0, 0x8984, 0xB3B1, - 0x8985, 0xB3B2, 0x8986, 0xB3B3, 0x8987, 0xB3B4, 0x8988, 0xB3B5, - 0x8989, 0xB3B6, 0x898A, 0xB3B7, 0x898B, 0xB3B8, 0x898C, 0xB3B9, - 0x898D, 0xB3BA, 0x898E, 0xB3BB, 0x898F, 0xB3BC, 0x8990, 0xB3BD, - 0x8991, 0xB3BE, 0x8992, 0xB3BF, 0x8993, 0xB3C0, 0x8994, 0xB3C1, - 0x8995, 0xB3C2, 0x8996, 0xB3C3, 0x8997, 0xB3C6, 0x8998, 0xB3C7, - 0x8999, 0xB3C9, 0x899A, 0xB3CA, 0x899B, 0xB3CD, 0x899C, 0xB3CF, - 0x899D, 0xB3D1, 0x899E, 0xB3D2, 0x899F, 0xB3D3, 0x89A0, 0xB3D6, - 0x89A1, 0xB3D8, 0x89A2, 0xB3DA, 0x89A3, 0xB3DC, 0x89A4, 0xB3DE, - 0x89A5, 0xB3DF, 0x89A6, 0xB3E1, 0x89A7, 0xB3E2, 0x89A8, 0xB3E3, - 0x89A9, 0xB3E5, 0x89AA, 0xB3E6, 0x89AB, 0xB3E7, 0x89AC, 0xB3E9, - 0x89AD, 0xB3EA, 0x89AE, 0xB3EB, 0x89AF, 0xB3EC, 0x89B0, 0xB3ED, - 0x89B1, 0xB3EE, 0x89B2, 0xB3EF, 0x89B3, 0xB3F0, 0x89B4, 0xB3F1, - 0x89B5, 0xB3F2, 0x89B6, 0xB3F3, 0x89B7, 0xB3F4, 0x89B8, 0xB3F5, - 0x89B9, 0xB3F6, 0x89BA, 0xB3F7, 0x89BB, 0xB3F8, 0x89BC, 0xB3F9, - 0x89BD, 0xB3FA, 0x89BE, 0xB3FB, 0x89BF, 0xB3FD, 0x89C0, 0xB3FE, - 0x89C1, 0xB3FF, 0x89C2, 0xB400, 0x89C3, 0xB401, 0x89C4, 0xB402, - 0x89C5, 0xB403, 0x89C6, 0xB404, 0x89C7, 0xB405, 0x89C8, 0xB406, - 0x89C9, 0xB407, 0x89CA, 0xB408, 0x89CB, 0xB409, 0x89CC, 0xB40A, - 0x89CD, 0xB40B, 0x89CE, 0xB40C, 0x89CF, 0xB40D, 0x89D0, 0xB40E, - 0x89D1, 0xB40F, 0x89D2, 0xB411, 0x89D3, 0xB412, 0x89D4, 0xB413, - 0x89D5, 0xB414, 0x89D6, 0xB415, 0x89D7, 0xB416, 0x89D8, 0xB417, - 0x89D9, 0xB419, 0x89DA, 0xB41A, 0x89DB, 0xB41B, 0x89DC, 0xB41D, - 0x89DD, 0xB41E, 0x89DE, 0xB41F, 0x89DF, 0xB421, 0x89E0, 0xB422, - 0x89E1, 0xB423, 0x89E2, 0xB424, 0x89E3, 0xB425, 0x89E4, 0xB426, - 0x89E5, 0xB427, 0x89E6, 0xB42A, 0x89E7, 0xB42C, 0x89E8, 0xB42D, - 0x89E9, 0xB42E, 0x89EA, 0xB42F, 0x89EB, 0xB430, 0x89EC, 0xB431, - 0x89ED, 0xB432, 0x89EE, 0xB433, 0x89EF, 0xB435, 0x89F0, 0xB436, - 0x89F1, 0xB437, 0x89F2, 0xB438, 0x89F3, 0xB439, 0x89F4, 0xB43A, - 0x89F5, 0xB43B, 0x89F6, 0xB43C, 0x89F7, 0xB43D, 0x89F8, 0xB43E, - 0x89F9, 0xB43F, 0x89FA, 0xB440, 0x89FB, 0xB441, 0x89FC, 0xB442, - 0x89FD, 0xB443, 0x89FE, 0xB444, 0x8A41, 0xB445, 0x8A42, 0xB446, - 0x8A43, 0xB447, 0x8A44, 0xB448, 0x8A45, 0xB449, 0x8A46, 0xB44A, - 0x8A47, 0xB44B, 0x8A48, 0xB44C, 0x8A49, 0xB44D, 0x8A4A, 0xB44E, - 0x8A4B, 0xB44F, 0x8A4C, 0xB452, 0x8A4D, 0xB453, 0x8A4E, 0xB455, - 0x8A4F, 0xB456, 0x8A50, 0xB457, 0x8A51, 0xB459, 0x8A52, 0xB45A, - 0x8A53, 0xB45B, 0x8A54, 0xB45C, 0x8A55, 0xB45D, 0x8A56, 0xB45E, - 0x8A57, 0xB45F, 0x8A58, 0xB462, 0x8A59, 0xB464, 0x8A5A, 0xB466, - 0x8A61, 0xB467, 0x8A62, 0xB468, 0x8A63, 0xB469, 0x8A64, 0xB46A, - 0x8A65, 0xB46B, 0x8A66, 0xB46D, 0x8A67, 0xB46E, 0x8A68, 0xB46F, - 0x8A69, 0xB470, 0x8A6A, 0xB471, 0x8A6B, 0xB472, 0x8A6C, 0xB473, - 0x8A6D, 0xB474, 0x8A6E, 0xB475, 0x8A6F, 0xB476, 0x8A70, 0xB477, - 0x8A71, 0xB478, 0x8A72, 0xB479, 0x8A73, 0xB47A, 0x8A74, 0xB47B, - 0x8A75, 0xB47C, 0x8A76, 0xB47D, 0x8A77, 0xB47E, 0x8A78, 0xB47F, - 0x8A79, 0xB481, 0x8A7A, 0xB482, 0x8A81, 0xB483, 0x8A82, 0xB484, - 0x8A83, 0xB485, 0x8A84, 0xB486, 0x8A85, 0xB487, 0x8A86, 0xB489, - 0x8A87, 0xB48A, 0x8A88, 0xB48B, 0x8A89, 0xB48C, 0x8A8A, 0xB48D, - 0x8A8B, 0xB48E, 0x8A8C, 0xB48F, 0x8A8D, 0xB490, 0x8A8E, 0xB491, - 0x8A8F, 0xB492, 0x8A90, 0xB493, 0x8A91, 0xB494, 0x8A92, 0xB495, - 0x8A93, 0xB496, 0x8A94, 0xB497, 0x8A95, 0xB498, 0x8A96, 0xB499, - 0x8A97, 0xB49A, 0x8A98, 0xB49B, 0x8A99, 0xB49C, 0x8A9A, 0xB49E, - 0x8A9B, 0xB49F, 0x8A9C, 0xB4A0, 0x8A9D, 0xB4A1, 0x8A9E, 0xB4A2, - 0x8A9F, 0xB4A3, 0x8AA0, 0xB4A5, 0x8AA1, 0xB4A6, 0x8AA2, 0xB4A7, - 0x8AA3, 0xB4A9, 0x8AA4, 0xB4AA, 0x8AA5, 0xB4AB, 0x8AA6, 0xB4AD, - 0x8AA7, 0xB4AE, 0x8AA8, 0xB4AF, 0x8AA9, 0xB4B0, 0x8AAA, 0xB4B1, - 0x8AAB, 0xB4B2, 0x8AAC, 0xB4B3, 0x8AAD, 0xB4B4, 0x8AAE, 0xB4B6, - 0x8AAF, 0xB4B8, 0x8AB0, 0xB4BA, 0x8AB1, 0xB4BB, 0x8AB2, 0xB4BC, - 0x8AB3, 0xB4BD, 0x8AB4, 0xB4BE, 0x8AB5, 0xB4BF, 0x8AB6, 0xB4C1, - 0x8AB7, 0xB4C2, 0x8AB8, 0xB4C3, 0x8AB9, 0xB4C5, 0x8ABA, 0xB4C6, - 0x8ABB, 0xB4C7, 0x8ABC, 0xB4C9, 0x8ABD, 0xB4CA, 0x8ABE, 0xB4CB, - 0x8ABF, 0xB4CC, 0x8AC0, 0xB4CD, 0x8AC1, 0xB4CE, 0x8AC2, 0xB4CF, - 0x8AC3, 0xB4D1, 0x8AC4, 0xB4D2, 0x8AC5, 0xB4D3, 0x8AC6, 0xB4D4, - 0x8AC7, 0xB4D6, 0x8AC8, 0xB4D7, 0x8AC9, 0xB4D8, 0x8ACA, 0xB4D9, - 0x8ACB, 0xB4DA, 0x8ACC, 0xB4DB, 0x8ACD, 0xB4DE, 0x8ACE, 0xB4DF, - 0x8ACF, 0xB4E1, 0x8AD0, 0xB4E2, 0x8AD1, 0xB4E5, 0x8AD2, 0xB4E7, - 0x8AD3, 0xB4E8, 0x8AD4, 0xB4E9, 0x8AD5, 0xB4EA, 0x8AD6, 0xB4EB, - 0x8AD7, 0xB4EE, 0x8AD8, 0xB4F0, 0x8AD9, 0xB4F2, 0x8ADA, 0xB4F3, - 0x8ADB, 0xB4F4, 0x8ADC, 0xB4F5, 0x8ADD, 0xB4F6, 0x8ADE, 0xB4F7, - 0x8ADF, 0xB4F9, 0x8AE0, 0xB4FA, 0x8AE1, 0xB4FB, 0x8AE2, 0xB4FC, - 0x8AE3, 0xB4FD, 0x8AE4, 0xB4FE, 0x8AE5, 0xB4FF, 0x8AE6, 0xB500, - 0x8AE7, 0xB501, 0x8AE8, 0xB502, 0x8AE9, 0xB503, 0x8AEA, 0xB504, - 0x8AEB, 0xB505, 0x8AEC, 0xB506, 0x8AED, 0xB507, 0x8AEE, 0xB508, - 0x8AEF, 0xB509, 0x8AF0, 0xB50A, 0x8AF1, 0xB50B, 0x8AF2, 0xB50C, - 0x8AF3, 0xB50D, 0x8AF4, 0xB50E, 0x8AF5, 0xB50F, 0x8AF6, 0xB510, - 0x8AF7, 0xB511, 0x8AF8, 0xB512, 0x8AF9, 0xB513, 0x8AFA, 0xB516, - 0x8AFB, 0xB517, 0x8AFC, 0xB519, 0x8AFD, 0xB51A, 0x8AFE, 0xB51D, - 0x8B41, 0xB51E, 0x8B42, 0xB51F, 0x8B43, 0xB520, 0x8B44, 0xB521, - 0x8B45, 0xB522, 0x8B46, 0xB523, 0x8B47, 0xB526, 0x8B48, 0xB52B, - 0x8B49, 0xB52C, 0x8B4A, 0xB52D, 0x8B4B, 0xB52E, 0x8B4C, 0xB52F, - 0x8B4D, 0xB532, 0x8B4E, 0xB533, 0x8B4F, 0xB535, 0x8B50, 0xB536, - 0x8B51, 0xB537, 0x8B52, 0xB539, 0x8B53, 0xB53A, 0x8B54, 0xB53B, - 0x8B55, 0xB53C, 0x8B56, 0xB53D, 0x8B57, 0xB53E, 0x8B58, 0xB53F, - 0x8B59, 0xB542, 0x8B5A, 0xB546, 0x8B61, 0xB547, 0x8B62, 0xB548, - 0x8B63, 0xB549, 0x8B64, 0xB54A, 0x8B65, 0xB54E, 0x8B66, 0xB54F, - 0x8B67, 0xB551, 0x8B68, 0xB552, 0x8B69, 0xB553, 0x8B6A, 0xB555, - 0x8B6B, 0xB556, 0x8B6C, 0xB557, 0x8B6D, 0xB558, 0x8B6E, 0xB559, - 0x8B6F, 0xB55A, 0x8B70, 0xB55B, 0x8B71, 0xB55E, 0x8B72, 0xB562, - 0x8B73, 0xB563, 0x8B74, 0xB564, 0x8B75, 0xB565, 0x8B76, 0xB566, - 0x8B77, 0xB567, 0x8B78, 0xB568, 0x8B79, 0xB569, 0x8B7A, 0xB56A, - 0x8B81, 0xB56B, 0x8B82, 0xB56C, 0x8B83, 0xB56D, 0x8B84, 0xB56E, - 0x8B85, 0xB56F, 0x8B86, 0xB570, 0x8B87, 0xB571, 0x8B88, 0xB572, - 0x8B89, 0xB573, 0x8B8A, 0xB574, 0x8B8B, 0xB575, 0x8B8C, 0xB576, - 0x8B8D, 0xB577, 0x8B8E, 0xB578, 0x8B8F, 0xB579, 0x8B90, 0xB57A, - 0x8B91, 0xB57B, 0x8B92, 0xB57C, 0x8B93, 0xB57D, 0x8B94, 0xB57E, - 0x8B95, 0xB57F, 0x8B96, 0xB580, 0x8B97, 0xB581, 0x8B98, 0xB582, - 0x8B99, 0xB583, 0x8B9A, 0xB584, 0x8B9B, 0xB585, 0x8B9C, 0xB586, - 0x8B9D, 0xB587, 0x8B9E, 0xB588, 0x8B9F, 0xB589, 0x8BA0, 0xB58A, - 0x8BA1, 0xB58B, 0x8BA2, 0xB58C, 0x8BA3, 0xB58D, 0x8BA4, 0xB58E, - 0x8BA5, 0xB58F, 0x8BA6, 0xB590, 0x8BA7, 0xB591, 0x8BA8, 0xB592, - 0x8BA9, 0xB593, 0x8BAA, 0xB594, 0x8BAB, 0xB595, 0x8BAC, 0xB596, - 0x8BAD, 0xB597, 0x8BAE, 0xB598, 0x8BAF, 0xB599, 0x8BB0, 0xB59A, - 0x8BB1, 0xB59B, 0x8BB2, 0xB59C, 0x8BB3, 0xB59D, 0x8BB4, 0xB59E, - 0x8BB5, 0xB59F, 0x8BB6, 0xB5A2, 0x8BB7, 0xB5A3, 0x8BB8, 0xB5A5, - 0x8BB9, 0xB5A6, 0x8BBA, 0xB5A7, 0x8BBB, 0xB5A9, 0x8BBC, 0xB5AC, - 0x8BBD, 0xB5AD, 0x8BBE, 0xB5AE, 0x8BBF, 0xB5AF, 0x8BC0, 0xB5B2, - 0x8BC1, 0xB5B6, 0x8BC2, 0xB5B7, 0x8BC3, 0xB5B8, 0x8BC4, 0xB5B9, - 0x8BC5, 0xB5BA, 0x8BC6, 0xB5BE, 0x8BC7, 0xB5BF, 0x8BC8, 0xB5C1, - 0x8BC9, 0xB5C2, 0x8BCA, 0xB5C3, 0x8BCB, 0xB5C5, 0x8BCC, 0xB5C6, - 0x8BCD, 0xB5C7, 0x8BCE, 0xB5C8, 0x8BCF, 0xB5C9, 0x8BD0, 0xB5CA, - 0x8BD1, 0xB5CB, 0x8BD2, 0xB5CE, 0x8BD3, 0xB5D2, 0x8BD4, 0xB5D3, - 0x8BD5, 0xB5D4, 0x8BD6, 0xB5D5, 0x8BD7, 0xB5D6, 0x8BD8, 0xB5D7, - 0x8BD9, 0xB5D9, 0x8BDA, 0xB5DA, 0x8BDB, 0xB5DB, 0x8BDC, 0xB5DC, - 0x8BDD, 0xB5DD, 0x8BDE, 0xB5DE, 0x8BDF, 0xB5DF, 0x8BE0, 0xB5E0, - 0x8BE1, 0xB5E1, 0x8BE2, 0xB5E2, 0x8BE3, 0xB5E3, 0x8BE4, 0xB5E4, - 0x8BE5, 0xB5E5, 0x8BE6, 0xB5E6, 0x8BE7, 0xB5E7, 0x8BE8, 0xB5E8, - 0x8BE9, 0xB5E9, 0x8BEA, 0xB5EA, 0x8BEB, 0xB5EB, 0x8BEC, 0xB5ED, - 0x8BED, 0xB5EE, 0x8BEE, 0xB5EF, 0x8BEF, 0xB5F0, 0x8BF0, 0xB5F1, - 0x8BF1, 0xB5F2, 0x8BF2, 0xB5F3, 0x8BF3, 0xB5F4, 0x8BF4, 0xB5F5, - 0x8BF5, 0xB5F6, 0x8BF6, 0xB5F7, 0x8BF7, 0xB5F8, 0x8BF8, 0xB5F9, - 0x8BF9, 0xB5FA, 0x8BFA, 0xB5FB, 0x8BFB, 0xB5FC, 0x8BFC, 0xB5FD, - 0x8BFD, 0xB5FE, 0x8BFE, 0xB5FF, 0x8C41, 0xB600, 0x8C42, 0xB601, - 0x8C43, 0xB602, 0x8C44, 0xB603, 0x8C45, 0xB604, 0x8C46, 0xB605, - 0x8C47, 0xB606, 0x8C48, 0xB607, 0x8C49, 0xB608, 0x8C4A, 0xB609, - 0x8C4B, 0xB60A, 0x8C4C, 0xB60B, 0x8C4D, 0xB60C, 0x8C4E, 0xB60D, - 0x8C4F, 0xB60E, 0x8C50, 0xB60F, 0x8C51, 0xB612, 0x8C52, 0xB613, - 0x8C53, 0xB615, 0x8C54, 0xB616, 0x8C55, 0xB617, 0x8C56, 0xB619, - 0x8C57, 0xB61A, 0x8C58, 0xB61B, 0x8C59, 0xB61C, 0x8C5A, 0xB61D, - 0x8C61, 0xB61E, 0x8C62, 0xB61F, 0x8C63, 0xB620, 0x8C64, 0xB621, - 0x8C65, 0xB622, 0x8C66, 0xB623, 0x8C67, 0xB624, 0x8C68, 0xB626, - 0x8C69, 0xB627, 0x8C6A, 0xB628, 0x8C6B, 0xB629, 0x8C6C, 0xB62A, - 0x8C6D, 0xB62B, 0x8C6E, 0xB62D, 0x8C6F, 0xB62E, 0x8C70, 0xB62F, - 0x8C71, 0xB630, 0x8C72, 0xB631, 0x8C73, 0xB632, 0x8C74, 0xB633, - 0x8C75, 0xB635, 0x8C76, 0xB636, 0x8C77, 0xB637, 0x8C78, 0xB638, - 0x8C79, 0xB639, 0x8C7A, 0xB63A, 0x8C81, 0xB63B, 0x8C82, 0xB63C, - 0x8C83, 0xB63D, 0x8C84, 0xB63E, 0x8C85, 0xB63F, 0x8C86, 0xB640, - 0x8C87, 0xB641, 0x8C88, 0xB642, 0x8C89, 0xB643, 0x8C8A, 0xB644, - 0x8C8B, 0xB645, 0x8C8C, 0xB646, 0x8C8D, 0xB647, 0x8C8E, 0xB649, - 0x8C8F, 0xB64A, 0x8C90, 0xB64B, 0x8C91, 0xB64C, 0x8C92, 0xB64D, - 0x8C93, 0xB64E, 0x8C94, 0xB64F, 0x8C95, 0xB650, 0x8C96, 0xB651, - 0x8C97, 0xB652, 0x8C98, 0xB653, 0x8C99, 0xB654, 0x8C9A, 0xB655, - 0x8C9B, 0xB656, 0x8C9C, 0xB657, 0x8C9D, 0xB658, 0x8C9E, 0xB659, - 0x8C9F, 0xB65A, 0x8CA0, 0xB65B, 0x8CA1, 0xB65C, 0x8CA2, 0xB65D, - 0x8CA3, 0xB65E, 0x8CA4, 0xB65F, 0x8CA5, 0xB660, 0x8CA6, 0xB661, - 0x8CA7, 0xB662, 0x8CA8, 0xB663, 0x8CA9, 0xB665, 0x8CAA, 0xB666, - 0x8CAB, 0xB667, 0x8CAC, 0xB669, 0x8CAD, 0xB66A, 0x8CAE, 0xB66B, - 0x8CAF, 0xB66C, 0x8CB0, 0xB66D, 0x8CB1, 0xB66E, 0x8CB2, 0xB66F, - 0x8CB3, 0xB670, 0x8CB4, 0xB671, 0x8CB5, 0xB672, 0x8CB6, 0xB673, - 0x8CB7, 0xB674, 0x8CB8, 0xB675, 0x8CB9, 0xB676, 0x8CBA, 0xB677, - 0x8CBB, 0xB678, 0x8CBC, 0xB679, 0x8CBD, 0xB67A, 0x8CBE, 0xB67B, - 0x8CBF, 0xB67C, 0x8CC0, 0xB67D, 0x8CC1, 0xB67E, 0x8CC2, 0xB67F, - 0x8CC3, 0xB680, 0x8CC4, 0xB681, 0x8CC5, 0xB682, 0x8CC6, 0xB683, - 0x8CC7, 0xB684, 0x8CC8, 0xB685, 0x8CC9, 0xB686, 0x8CCA, 0xB687, - 0x8CCB, 0xB688, 0x8CCC, 0xB689, 0x8CCD, 0xB68A, 0x8CCE, 0xB68B, - 0x8CCF, 0xB68C, 0x8CD0, 0xB68D, 0x8CD1, 0xB68E, 0x8CD2, 0xB68F, - 0x8CD3, 0xB690, 0x8CD4, 0xB691, 0x8CD5, 0xB692, 0x8CD6, 0xB693, - 0x8CD7, 0xB694, 0x8CD8, 0xB695, 0x8CD9, 0xB696, 0x8CDA, 0xB697, - 0x8CDB, 0xB698, 0x8CDC, 0xB699, 0x8CDD, 0xB69A, 0x8CDE, 0xB69B, - 0x8CDF, 0xB69E, 0x8CE0, 0xB69F, 0x8CE1, 0xB6A1, 0x8CE2, 0xB6A2, - 0x8CE3, 0xB6A3, 0x8CE4, 0xB6A5, 0x8CE5, 0xB6A6, 0x8CE6, 0xB6A7, - 0x8CE7, 0xB6A8, 0x8CE8, 0xB6A9, 0x8CE9, 0xB6AA, 0x8CEA, 0xB6AD, - 0x8CEB, 0xB6AE, 0x8CEC, 0xB6AF, 0x8CED, 0xB6B0, 0x8CEE, 0xB6B2, - 0x8CEF, 0xB6B3, 0x8CF0, 0xB6B4, 0x8CF1, 0xB6B5, 0x8CF2, 0xB6B6, - 0x8CF3, 0xB6B7, 0x8CF4, 0xB6B8, 0x8CF5, 0xB6B9, 0x8CF6, 0xB6BA, - 0x8CF7, 0xB6BB, 0x8CF8, 0xB6BC, 0x8CF9, 0xB6BD, 0x8CFA, 0xB6BE, - 0x8CFB, 0xB6BF, 0x8CFC, 0xB6C0, 0x8CFD, 0xB6C1, 0x8CFE, 0xB6C2, - 0x8D41, 0xB6C3, 0x8D42, 0xB6C4, 0x8D43, 0xB6C5, 0x8D44, 0xB6C6, - 0x8D45, 0xB6C7, 0x8D46, 0xB6C8, 0x8D47, 0xB6C9, 0x8D48, 0xB6CA, - 0x8D49, 0xB6CB, 0x8D4A, 0xB6CC, 0x8D4B, 0xB6CD, 0x8D4C, 0xB6CE, - 0x8D4D, 0xB6CF, 0x8D4E, 0xB6D0, 0x8D4F, 0xB6D1, 0x8D50, 0xB6D2, - 0x8D51, 0xB6D3, 0x8D52, 0xB6D5, 0x8D53, 0xB6D6, 0x8D54, 0xB6D7, - 0x8D55, 0xB6D8, 0x8D56, 0xB6D9, 0x8D57, 0xB6DA, 0x8D58, 0xB6DB, - 0x8D59, 0xB6DC, 0x8D5A, 0xB6DD, 0x8D61, 0xB6DE, 0x8D62, 0xB6DF, - 0x8D63, 0xB6E0, 0x8D64, 0xB6E1, 0x8D65, 0xB6E2, 0x8D66, 0xB6E3, - 0x8D67, 0xB6E4, 0x8D68, 0xB6E5, 0x8D69, 0xB6E6, 0x8D6A, 0xB6E7, - 0x8D6B, 0xB6E8, 0x8D6C, 0xB6E9, 0x8D6D, 0xB6EA, 0x8D6E, 0xB6EB, - 0x8D6F, 0xB6EC, 0x8D70, 0xB6ED, 0x8D71, 0xB6EE, 0x8D72, 0xB6EF, - 0x8D73, 0xB6F1, 0x8D74, 0xB6F2, 0x8D75, 0xB6F3, 0x8D76, 0xB6F5, - 0x8D77, 0xB6F6, 0x8D78, 0xB6F7, 0x8D79, 0xB6F9, 0x8D7A, 0xB6FA, - 0x8D81, 0xB6FB, 0x8D82, 0xB6FC, 0x8D83, 0xB6FD, 0x8D84, 0xB6FE, - 0x8D85, 0xB6FF, 0x8D86, 0xB702, 0x8D87, 0xB703, 0x8D88, 0xB704, - 0x8D89, 0xB706, 0x8D8A, 0xB707, 0x8D8B, 0xB708, 0x8D8C, 0xB709, - 0x8D8D, 0xB70A, 0x8D8E, 0xB70B, 0x8D8F, 0xB70C, 0x8D90, 0xB70D, - 0x8D91, 0xB70E, 0x8D92, 0xB70F, 0x8D93, 0xB710, 0x8D94, 0xB711, - 0x8D95, 0xB712, 0x8D96, 0xB713, 0x8D97, 0xB714, 0x8D98, 0xB715, - 0x8D99, 0xB716, 0x8D9A, 0xB717, 0x8D9B, 0xB718, 0x8D9C, 0xB719, - 0x8D9D, 0xB71A, 0x8D9E, 0xB71B, 0x8D9F, 0xB71C, 0x8DA0, 0xB71D, - 0x8DA1, 0xB71E, 0x8DA2, 0xB71F, 0x8DA3, 0xB720, 0x8DA4, 0xB721, - 0x8DA5, 0xB722, 0x8DA6, 0xB723, 0x8DA7, 0xB724, 0x8DA8, 0xB725, - 0x8DA9, 0xB726, 0x8DAA, 0xB727, 0x8DAB, 0xB72A, 0x8DAC, 0xB72B, - 0x8DAD, 0xB72D, 0x8DAE, 0xB72E, 0x8DAF, 0xB731, 0x8DB0, 0xB732, - 0x8DB1, 0xB733, 0x8DB2, 0xB734, 0x8DB3, 0xB735, 0x8DB4, 0xB736, - 0x8DB5, 0xB737, 0x8DB6, 0xB73A, 0x8DB7, 0xB73C, 0x8DB8, 0xB73D, - 0x8DB9, 0xB73E, 0x8DBA, 0xB73F, 0x8DBB, 0xB740, 0x8DBC, 0xB741, - 0x8DBD, 0xB742, 0x8DBE, 0xB743, 0x8DBF, 0xB745, 0x8DC0, 0xB746, - 0x8DC1, 0xB747, 0x8DC2, 0xB749, 0x8DC3, 0xB74A, 0x8DC4, 0xB74B, - 0x8DC5, 0xB74D, 0x8DC6, 0xB74E, 0x8DC7, 0xB74F, 0x8DC8, 0xB750, - 0x8DC9, 0xB751, 0x8DCA, 0xB752, 0x8DCB, 0xB753, 0x8DCC, 0xB756, - 0x8DCD, 0xB757, 0x8DCE, 0xB758, 0x8DCF, 0xB759, 0x8DD0, 0xB75A, - 0x8DD1, 0xB75B, 0x8DD2, 0xB75C, 0x8DD3, 0xB75D, 0x8DD4, 0xB75E, - 0x8DD5, 0xB75F, 0x8DD6, 0xB761, 0x8DD7, 0xB762, 0x8DD8, 0xB763, - 0x8DD9, 0xB765, 0x8DDA, 0xB766, 0x8DDB, 0xB767, 0x8DDC, 0xB769, - 0x8DDD, 0xB76A, 0x8DDE, 0xB76B, 0x8DDF, 0xB76C, 0x8DE0, 0xB76D, - 0x8DE1, 0xB76E, 0x8DE2, 0xB76F, 0x8DE3, 0xB772, 0x8DE4, 0xB774, - 0x8DE5, 0xB776, 0x8DE6, 0xB777, 0x8DE7, 0xB778, 0x8DE8, 0xB779, - 0x8DE9, 0xB77A, 0x8DEA, 0xB77B, 0x8DEB, 0xB77E, 0x8DEC, 0xB77F, - 0x8DED, 0xB781, 0x8DEE, 0xB782, 0x8DEF, 0xB783, 0x8DF0, 0xB785, - 0x8DF1, 0xB786, 0x8DF2, 0xB787, 0x8DF3, 0xB788, 0x8DF4, 0xB789, - 0x8DF5, 0xB78A, 0x8DF6, 0xB78B, 0x8DF7, 0xB78E, 0x8DF8, 0xB793, - 0x8DF9, 0xB794, 0x8DFA, 0xB795, 0x8DFB, 0xB79A, 0x8DFC, 0xB79B, - 0x8DFD, 0xB79D, 0x8DFE, 0xB79E, 0x8E41, 0xB79F, 0x8E42, 0xB7A1, - 0x8E43, 0xB7A2, 0x8E44, 0xB7A3, 0x8E45, 0xB7A4, 0x8E46, 0xB7A5, - 0x8E47, 0xB7A6, 0x8E48, 0xB7A7, 0x8E49, 0xB7AA, 0x8E4A, 0xB7AE, - 0x8E4B, 0xB7AF, 0x8E4C, 0xB7B0, 0x8E4D, 0xB7B1, 0x8E4E, 0xB7B2, - 0x8E4F, 0xB7B3, 0x8E50, 0xB7B6, 0x8E51, 0xB7B7, 0x8E52, 0xB7B9, - 0x8E53, 0xB7BA, 0x8E54, 0xB7BB, 0x8E55, 0xB7BC, 0x8E56, 0xB7BD, - 0x8E57, 0xB7BE, 0x8E58, 0xB7BF, 0x8E59, 0xB7C0, 0x8E5A, 0xB7C1, - 0x8E61, 0xB7C2, 0x8E62, 0xB7C3, 0x8E63, 0xB7C4, 0x8E64, 0xB7C5, - 0x8E65, 0xB7C6, 0x8E66, 0xB7C8, 0x8E67, 0xB7CA, 0x8E68, 0xB7CB, - 0x8E69, 0xB7CC, 0x8E6A, 0xB7CD, 0x8E6B, 0xB7CE, 0x8E6C, 0xB7CF, - 0x8E6D, 0xB7D0, 0x8E6E, 0xB7D1, 0x8E6F, 0xB7D2, 0x8E70, 0xB7D3, - 0x8E71, 0xB7D4, 0x8E72, 0xB7D5, 0x8E73, 0xB7D6, 0x8E74, 0xB7D7, - 0x8E75, 0xB7D8, 0x8E76, 0xB7D9, 0x8E77, 0xB7DA, 0x8E78, 0xB7DB, - 0x8E79, 0xB7DC, 0x8E7A, 0xB7DD, 0x8E81, 0xB7DE, 0x8E82, 0xB7DF, - 0x8E83, 0xB7E0, 0x8E84, 0xB7E1, 0x8E85, 0xB7E2, 0x8E86, 0xB7E3, - 0x8E87, 0xB7E4, 0x8E88, 0xB7E5, 0x8E89, 0xB7E6, 0x8E8A, 0xB7E7, - 0x8E8B, 0xB7E8, 0x8E8C, 0xB7E9, 0x8E8D, 0xB7EA, 0x8E8E, 0xB7EB, - 0x8E8F, 0xB7EE, 0x8E90, 0xB7EF, 0x8E91, 0xB7F1, 0x8E92, 0xB7F2, - 0x8E93, 0xB7F3, 0x8E94, 0xB7F5, 0x8E95, 0xB7F6, 0x8E96, 0xB7F7, - 0x8E97, 0xB7F8, 0x8E98, 0xB7F9, 0x8E99, 0xB7FA, 0x8E9A, 0xB7FB, - 0x8E9B, 0xB7FE, 0x8E9C, 0xB802, 0x8E9D, 0xB803, 0x8E9E, 0xB804, - 0x8E9F, 0xB805, 0x8EA0, 0xB806, 0x8EA1, 0xB80A, 0x8EA2, 0xB80B, - 0x8EA3, 0xB80D, 0x8EA4, 0xB80E, 0x8EA5, 0xB80F, 0x8EA6, 0xB811, - 0x8EA7, 0xB812, 0x8EA8, 0xB813, 0x8EA9, 0xB814, 0x8EAA, 0xB815, - 0x8EAB, 0xB816, 0x8EAC, 0xB817, 0x8EAD, 0xB81A, 0x8EAE, 0xB81C, - 0x8EAF, 0xB81E, 0x8EB0, 0xB81F, 0x8EB1, 0xB820, 0x8EB2, 0xB821, - 0x8EB3, 0xB822, 0x8EB4, 0xB823, 0x8EB5, 0xB826, 0x8EB6, 0xB827, - 0x8EB7, 0xB829, 0x8EB8, 0xB82A, 0x8EB9, 0xB82B, 0x8EBA, 0xB82D, - 0x8EBB, 0xB82E, 0x8EBC, 0xB82F, 0x8EBD, 0xB830, 0x8EBE, 0xB831, - 0x8EBF, 0xB832, 0x8EC0, 0xB833, 0x8EC1, 0xB836, 0x8EC2, 0xB83A, - 0x8EC3, 0xB83B, 0x8EC4, 0xB83C, 0x8EC5, 0xB83D, 0x8EC6, 0xB83E, - 0x8EC7, 0xB83F, 0x8EC8, 0xB841, 0x8EC9, 0xB842, 0x8ECA, 0xB843, - 0x8ECB, 0xB845, 0x8ECC, 0xB846, 0x8ECD, 0xB847, 0x8ECE, 0xB848, - 0x8ECF, 0xB849, 0x8ED0, 0xB84A, 0x8ED1, 0xB84B, 0x8ED2, 0xB84C, - 0x8ED3, 0xB84D, 0x8ED4, 0xB84E, 0x8ED5, 0xB84F, 0x8ED6, 0xB850, - 0x8ED7, 0xB852, 0x8ED8, 0xB854, 0x8ED9, 0xB855, 0x8EDA, 0xB856, - 0x8EDB, 0xB857, 0x8EDC, 0xB858, 0x8EDD, 0xB859, 0x8EDE, 0xB85A, - 0x8EDF, 0xB85B, 0x8EE0, 0xB85E, 0x8EE1, 0xB85F, 0x8EE2, 0xB861, - 0x8EE3, 0xB862, 0x8EE4, 0xB863, 0x8EE5, 0xB865, 0x8EE6, 0xB866, - 0x8EE7, 0xB867, 0x8EE8, 0xB868, 0x8EE9, 0xB869, 0x8EEA, 0xB86A, - 0x8EEB, 0xB86B, 0x8EEC, 0xB86E, 0x8EED, 0xB870, 0x8EEE, 0xB872, - 0x8EEF, 0xB873, 0x8EF0, 0xB874, 0x8EF1, 0xB875, 0x8EF2, 0xB876, - 0x8EF3, 0xB877, 0x8EF4, 0xB879, 0x8EF5, 0xB87A, 0x8EF6, 0xB87B, - 0x8EF7, 0xB87D, 0x8EF8, 0xB87E, 0x8EF9, 0xB87F, 0x8EFA, 0xB880, - 0x8EFB, 0xB881, 0x8EFC, 0xB882, 0x8EFD, 0xB883, 0x8EFE, 0xB884, - 0x8F41, 0xB885, 0x8F42, 0xB886, 0x8F43, 0xB887, 0x8F44, 0xB888, - 0x8F45, 0xB889, 0x8F46, 0xB88A, 0x8F47, 0xB88B, 0x8F48, 0xB88C, - 0x8F49, 0xB88E, 0x8F4A, 0xB88F, 0x8F4B, 0xB890, 0x8F4C, 0xB891, - 0x8F4D, 0xB892, 0x8F4E, 0xB893, 0x8F4F, 0xB894, 0x8F50, 0xB895, - 0x8F51, 0xB896, 0x8F52, 0xB897, 0x8F53, 0xB898, 0x8F54, 0xB899, - 0x8F55, 0xB89A, 0x8F56, 0xB89B, 0x8F57, 0xB89C, 0x8F58, 0xB89D, - 0x8F59, 0xB89E, 0x8F5A, 0xB89F, 0x8F61, 0xB8A0, 0x8F62, 0xB8A1, - 0x8F63, 0xB8A2, 0x8F64, 0xB8A3, 0x8F65, 0xB8A4, 0x8F66, 0xB8A5, - 0x8F67, 0xB8A6, 0x8F68, 0xB8A7, 0x8F69, 0xB8A9, 0x8F6A, 0xB8AA, - 0x8F6B, 0xB8AB, 0x8F6C, 0xB8AC, 0x8F6D, 0xB8AD, 0x8F6E, 0xB8AE, - 0x8F6F, 0xB8AF, 0x8F70, 0xB8B1, 0x8F71, 0xB8B2, 0x8F72, 0xB8B3, - 0x8F73, 0xB8B5, 0x8F74, 0xB8B6, 0x8F75, 0xB8B7, 0x8F76, 0xB8B9, - 0x8F77, 0xB8BA, 0x8F78, 0xB8BB, 0x8F79, 0xB8BC, 0x8F7A, 0xB8BD, - 0x8F81, 0xB8BE, 0x8F82, 0xB8BF, 0x8F83, 0xB8C2, 0x8F84, 0xB8C4, - 0x8F85, 0xB8C6, 0x8F86, 0xB8C7, 0x8F87, 0xB8C8, 0x8F88, 0xB8C9, - 0x8F89, 0xB8CA, 0x8F8A, 0xB8CB, 0x8F8B, 0xB8CD, 0x8F8C, 0xB8CE, - 0x8F8D, 0xB8CF, 0x8F8E, 0xB8D1, 0x8F8F, 0xB8D2, 0x8F90, 0xB8D3, - 0x8F91, 0xB8D5, 0x8F92, 0xB8D6, 0x8F93, 0xB8D7, 0x8F94, 0xB8D8, - 0x8F95, 0xB8D9, 0x8F96, 0xB8DA, 0x8F97, 0xB8DB, 0x8F98, 0xB8DC, - 0x8F99, 0xB8DE, 0x8F9A, 0xB8E0, 0x8F9B, 0xB8E2, 0x8F9C, 0xB8E3, - 0x8F9D, 0xB8E4, 0x8F9E, 0xB8E5, 0x8F9F, 0xB8E6, 0x8FA0, 0xB8E7, - 0x8FA1, 0xB8EA, 0x8FA2, 0xB8EB, 0x8FA3, 0xB8ED, 0x8FA4, 0xB8EE, - 0x8FA5, 0xB8EF, 0x8FA6, 0xB8F1, 0x8FA7, 0xB8F2, 0x8FA8, 0xB8F3, - 0x8FA9, 0xB8F4, 0x8FAA, 0xB8F5, 0x8FAB, 0xB8F6, 0x8FAC, 0xB8F7, - 0x8FAD, 0xB8FA, 0x8FAE, 0xB8FC, 0x8FAF, 0xB8FE, 0x8FB0, 0xB8FF, - 0x8FB1, 0xB900, 0x8FB2, 0xB901, 0x8FB3, 0xB902, 0x8FB4, 0xB903, - 0x8FB5, 0xB905, 0x8FB6, 0xB906, 0x8FB7, 0xB907, 0x8FB8, 0xB908, - 0x8FB9, 0xB909, 0x8FBA, 0xB90A, 0x8FBB, 0xB90B, 0x8FBC, 0xB90C, - 0x8FBD, 0xB90D, 0x8FBE, 0xB90E, 0x8FBF, 0xB90F, 0x8FC0, 0xB910, - 0x8FC1, 0xB911, 0x8FC2, 0xB912, 0x8FC3, 0xB913, 0x8FC4, 0xB914, - 0x8FC5, 0xB915, 0x8FC6, 0xB916, 0x8FC7, 0xB917, 0x8FC8, 0xB919, - 0x8FC9, 0xB91A, 0x8FCA, 0xB91B, 0x8FCB, 0xB91C, 0x8FCC, 0xB91D, - 0x8FCD, 0xB91E, 0x8FCE, 0xB91F, 0x8FCF, 0xB921, 0x8FD0, 0xB922, - 0x8FD1, 0xB923, 0x8FD2, 0xB924, 0x8FD3, 0xB925, 0x8FD4, 0xB926, - 0x8FD5, 0xB927, 0x8FD6, 0xB928, 0x8FD7, 0xB929, 0x8FD8, 0xB92A, - 0x8FD9, 0xB92B, 0x8FDA, 0xB92C, 0x8FDB, 0xB92D, 0x8FDC, 0xB92E, - 0x8FDD, 0xB92F, 0x8FDE, 0xB930, 0x8FDF, 0xB931, 0x8FE0, 0xB932, - 0x8FE1, 0xB933, 0x8FE2, 0xB934, 0x8FE3, 0xB935, 0x8FE4, 0xB936, - 0x8FE5, 0xB937, 0x8FE6, 0xB938, 0x8FE7, 0xB939, 0x8FE8, 0xB93A, - 0x8FE9, 0xB93B, 0x8FEA, 0xB93E, 0x8FEB, 0xB93F, 0x8FEC, 0xB941, - 0x8FED, 0xB942, 0x8FEE, 0xB943, 0x8FEF, 0xB945, 0x8FF0, 0xB946, - 0x8FF1, 0xB947, 0x8FF2, 0xB948, 0x8FF3, 0xB949, 0x8FF4, 0xB94A, - 0x8FF5, 0xB94B, 0x8FF6, 0xB94D, 0x8FF7, 0xB94E, 0x8FF8, 0xB950, - 0x8FF9, 0xB952, 0x8FFA, 0xB953, 0x8FFB, 0xB954, 0x8FFC, 0xB955, - 0x8FFD, 0xB956, 0x8FFE, 0xB957, 0x9041, 0xB95A, 0x9042, 0xB95B, - 0x9043, 0xB95D, 0x9044, 0xB95E, 0x9045, 0xB95F, 0x9046, 0xB961, - 0x9047, 0xB962, 0x9048, 0xB963, 0x9049, 0xB964, 0x904A, 0xB965, - 0x904B, 0xB966, 0x904C, 0xB967, 0x904D, 0xB96A, 0x904E, 0xB96C, - 0x904F, 0xB96E, 0x9050, 0xB96F, 0x9051, 0xB970, 0x9052, 0xB971, - 0x9053, 0xB972, 0x9054, 0xB973, 0x9055, 0xB976, 0x9056, 0xB977, - 0x9057, 0xB979, 0x9058, 0xB97A, 0x9059, 0xB97B, 0x905A, 0xB97D, - 0x9061, 0xB97E, 0x9062, 0xB97F, 0x9063, 0xB980, 0x9064, 0xB981, - 0x9065, 0xB982, 0x9066, 0xB983, 0x9067, 0xB986, 0x9068, 0xB988, - 0x9069, 0xB98B, 0x906A, 0xB98C, 0x906B, 0xB98F, 0x906C, 0xB990, - 0x906D, 0xB991, 0x906E, 0xB992, 0x906F, 0xB993, 0x9070, 0xB994, - 0x9071, 0xB995, 0x9072, 0xB996, 0x9073, 0xB997, 0x9074, 0xB998, - 0x9075, 0xB999, 0x9076, 0xB99A, 0x9077, 0xB99B, 0x9078, 0xB99C, - 0x9079, 0xB99D, 0x907A, 0xB99E, 0x9081, 0xB99F, 0x9082, 0xB9A0, - 0x9083, 0xB9A1, 0x9084, 0xB9A2, 0x9085, 0xB9A3, 0x9086, 0xB9A4, - 0x9087, 0xB9A5, 0x9088, 0xB9A6, 0x9089, 0xB9A7, 0x908A, 0xB9A8, - 0x908B, 0xB9A9, 0x908C, 0xB9AA, 0x908D, 0xB9AB, 0x908E, 0xB9AE, - 0x908F, 0xB9AF, 0x9090, 0xB9B1, 0x9091, 0xB9B2, 0x9092, 0xB9B3, - 0x9093, 0xB9B5, 0x9094, 0xB9B6, 0x9095, 0xB9B7, 0x9096, 0xB9B8, - 0x9097, 0xB9B9, 0x9098, 0xB9BA, 0x9099, 0xB9BB, 0x909A, 0xB9BE, - 0x909B, 0xB9C0, 0x909C, 0xB9C2, 0x909D, 0xB9C3, 0x909E, 0xB9C4, - 0x909F, 0xB9C5, 0x90A0, 0xB9C6, 0x90A1, 0xB9C7, 0x90A2, 0xB9CA, - 0x90A3, 0xB9CB, 0x90A4, 0xB9CD, 0x90A5, 0xB9D3, 0x90A6, 0xB9D4, - 0x90A7, 0xB9D5, 0x90A8, 0xB9D6, 0x90A9, 0xB9D7, 0x90AA, 0xB9DA, - 0x90AB, 0xB9DC, 0x90AC, 0xB9DF, 0x90AD, 0xB9E0, 0x90AE, 0xB9E2, - 0x90AF, 0xB9E6, 0x90B0, 0xB9E7, 0x90B1, 0xB9E9, 0x90B2, 0xB9EA, - 0x90B3, 0xB9EB, 0x90B4, 0xB9ED, 0x90B5, 0xB9EE, 0x90B6, 0xB9EF, - 0x90B7, 0xB9F0, 0x90B8, 0xB9F1, 0x90B9, 0xB9F2, 0x90BA, 0xB9F3, - 0x90BB, 0xB9F6, 0x90BC, 0xB9FB, 0x90BD, 0xB9FC, 0x90BE, 0xB9FD, - 0x90BF, 0xB9FE, 0x90C0, 0xB9FF, 0x90C1, 0xBA02, 0x90C2, 0xBA03, - 0x90C3, 0xBA04, 0x90C4, 0xBA05, 0x90C5, 0xBA06, 0x90C6, 0xBA07, - 0x90C7, 0xBA09, 0x90C8, 0xBA0A, 0x90C9, 0xBA0B, 0x90CA, 0xBA0C, - 0x90CB, 0xBA0D, 0x90CC, 0xBA0E, 0x90CD, 0xBA0F, 0x90CE, 0xBA10, - 0x90CF, 0xBA11, 0x90D0, 0xBA12, 0x90D1, 0xBA13, 0x90D2, 0xBA14, - 0x90D3, 0xBA16, 0x90D4, 0xBA17, 0x90D5, 0xBA18, 0x90D6, 0xBA19, - 0x90D7, 0xBA1A, 0x90D8, 0xBA1B, 0x90D9, 0xBA1C, 0x90DA, 0xBA1D, - 0x90DB, 0xBA1E, 0x90DC, 0xBA1F, 0x90DD, 0xBA20, 0x90DE, 0xBA21, - 0x90DF, 0xBA22, 0x90E0, 0xBA23, 0x90E1, 0xBA24, 0x90E2, 0xBA25, - 0x90E3, 0xBA26, 0x90E4, 0xBA27, 0x90E5, 0xBA28, 0x90E6, 0xBA29, - 0x90E7, 0xBA2A, 0x90E8, 0xBA2B, 0x90E9, 0xBA2C, 0x90EA, 0xBA2D, - 0x90EB, 0xBA2E, 0x90EC, 0xBA2F, 0x90ED, 0xBA30, 0x90EE, 0xBA31, - 0x90EF, 0xBA32, 0x90F0, 0xBA33, 0x90F1, 0xBA34, 0x90F2, 0xBA35, - 0x90F3, 0xBA36, 0x90F4, 0xBA37, 0x90F5, 0xBA3A, 0x90F6, 0xBA3B, - 0x90F7, 0xBA3D, 0x90F8, 0xBA3E, 0x90F9, 0xBA3F, 0x90FA, 0xBA41, - 0x90FB, 0xBA43, 0x90FC, 0xBA44, 0x90FD, 0xBA45, 0x90FE, 0xBA46, - 0x9141, 0xBA47, 0x9142, 0xBA4A, 0x9143, 0xBA4C, 0x9144, 0xBA4F, - 0x9145, 0xBA50, 0x9146, 0xBA51, 0x9147, 0xBA52, 0x9148, 0xBA56, - 0x9149, 0xBA57, 0x914A, 0xBA59, 0x914B, 0xBA5A, 0x914C, 0xBA5B, - 0x914D, 0xBA5D, 0x914E, 0xBA5E, 0x914F, 0xBA5F, 0x9150, 0xBA60, - 0x9151, 0xBA61, 0x9152, 0xBA62, 0x9153, 0xBA63, 0x9154, 0xBA66, - 0x9155, 0xBA6A, 0x9156, 0xBA6B, 0x9157, 0xBA6C, 0x9158, 0xBA6D, - 0x9159, 0xBA6E, 0x915A, 0xBA6F, 0x9161, 0xBA72, 0x9162, 0xBA73, - 0x9163, 0xBA75, 0x9164, 0xBA76, 0x9165, 0xBA77, 0x9166, 0xBA79, - 0x9167, 0xBA7A, 0x9168, 0xBA7B, 0x9169, 0xBA7C, 0x916A, 0xBA7D, - 0x916B, 0xBA7E, 0x916C, 0xBA7F, 0x916D, 0xBA80, 0x916E, 0xBA81, - 0x916F, 0xBA82, 0x9170, 0xBA86, 0x9171, 0xBA88, 0x9172, 0xBA89, - 0x9173, 0xBA8A, 0x9174, 0xBA8B, 0x9175, 0xBA8D, 0x9176, 0xBA8E, - 0x9177, 0xBA8F, 0x9178, 0xBA90, 0x9179, 0xBA91, 0x917A, 0xBA92, - 0x9181, 0xBA93, 0x9182, 0xBA94, 0x9183, 0xBA95, 0x9184, 0xBA96, - 0x9185, 0xBA97, 0x9186, 0xBA98, 0x9187, 0xBA99, 0x9188, 0xBA9A, - 0x9189, 0xBA9B, 0x918A, 0xBA9C, 0x918B, 0xBA9D, 0x918C, 0xBA9E, - 0x918D, 0xBA9F, 0x918E, 0xBAA0, 0x918F, 0xBAA1, 0x9190, 0xBAA2, - 0x9191, 0xBAA3, 0x9192, 0xBAA4, 0x9193, 0xBAA5, 0x9194, 0xBAA6, - 0x9195, 0xBAA7, 0x9196, 0xBAAA, 0x9197, 0xBAAD, 0x9198, 0xBAAE, - 0x9199, 0xBAAF, 0x919A, 0xBAB1, 0x919B, 0xBAB3, 0x919C, 0xBAB4, - 0x919D, 0xBAB5, 0x919E, 0xBAB6, 0x919F, 0xBAB7, 0x91A0, 0xBABA, - 0x91A1, 0xBABC, 0x91A2, 0xBABE, 0x91A3, 0xBABF, 0x91A4, 0xBAC0, - 0x91A5, 0xBAC1, 0x91A6, 0xBAC2, 0x91A7, 0xBAC3, 0x91A8, 0xBAC5, - 0x91A9, 0xBAC6, 0x91AA, 0xBAC7, 0x91AB, 0xBAC9, 0x91AC, 0xBACA, - 0x91AD, 0xBACB, 0x91AE, 0xBACC, 0x91AF, 0xBACD, 0x91B0, 0xBACE, - 0x91B1, 0xBACF, 0x91B2, 0xBAD0, 0x91B3, 0xBAD1, 0x91B4, 0xBAD2, - 0x91B5, 0xBAD3, 0x91B6, 0xBAD4, 0x91B7, 0xBAD5, 0x91B8, 0xBAD6, - 0x91B9, 0xBAD7, 0x91BA, 0xBADA, 0x91BB, 0xBADB, 0x91BC, 0xBADC, - 0x91BD, 0xBADD, 0x91BE, 0xBADE, 0x91BF, 0xBADF, 0x91C0, 0xBAE0, - 0x91C1, 0xBAE1, 0x91C2, 0xBAE2, 0x91C3, 0xBAE3, 0x91C4, 0xBAE4, - 0x91C5, 0xBAE5, 0x91C6, 0xBAE6, 0x91C7, 0xBAE7, 0x91C8, 0xBAE8, - 0x91C9, 0xBAE9, 0x91CA, 0xBAEA, 0x91CB, 0xBAEB, 0x91CC, 0xBAEC, - 0x91CD, 0xBAED, 0x91CE, 0xBAEE, 0x91CF, 0xBAEF, 0x91D0, 0xBAF0, - 0x91D1, 0xBAF1, 0x91D2, 0xBAF2, 0x91D3, 0xBAF3, 0x91D4, 0xBAF4, - 0x91D5, 0xBAF5, 0x91D6, 0xBAF6, 0x91D7, 0xBAF7, 0x91D8, 0xBAF8, - 0x91D9, 0xBAF9, 0x91DA, 0xBAFA, 0x91DB, 0xBAFB, 0x91DC, 0xBAFD, - 0x91DD, 0xBAFE, 0x91DE, 0xBAFF, 0x91DF, 0xBB01, 0x91E0, 0xBB02, - 0x91E1, 0xBB03, 0x91E2, 0xBB05, 0x91E3, 0xBB06, 0x91E4, 0xBB07, - 0x91E5, 0xBB08, 0x91E6, 0xBB09, 0x91E7, 0xBB0A, 0x91E8, 0xBB0B, - 0x91E9, 0xBB0C, 0x91EA, 0xBB0E, 0x91EB, 0xBB10, 0x91EC, 0xBB12, - 0x91ED, 0xBB13, 0x91EE, 0xBB14, 0x91EF, 0xBB15, 0x91F0, 0xBB16, - 0x91F1, 0xBB17, 0x91F2, 0xBB19, 0x91F3, 0xBB1A, 0x91F4, 0xBB1B, - 0x91F5, 0xBB1D, 0x91F6, 0xBB1E, 0x91F7, 0xBB1F, 0x91F8, 0xBB21, - 0x91F9, 0xBB22, 0x91FA, 0xBB23, 0x91FB, 0xBB24, 0x91FC, 0xBB25, - 0x91FD, 0xBB26, 0x91FE, 0xBB27, 0x9241, 0xBB28, 0x9242, 0xBB2A, - 0x9243, 0xBB2C, 0x9244, 0xBB2D, 0x9245, 0xBB2E, 0x9246, 0xBB2F, - 0x9247, 0xBB30, 0x9248, 0xBB31, 0x9249, 0xBB32, 0x924A, 0xBB33, - 0x924B, 0xBB37, 0x924C, 0xBB39, 0x924D, 0xBB3A, 0x924E, 0xBB3F, - 0x924F, 0xBB40, 0x9250, 0xBB41, 0x9251, 0xBB42, 0x9252, 0xBB43, - 0x9253, 0xBB46, 0x9254, 0xBB48, 0x9255, 0xBB4A, 0x9256, 0xBB4B, - 0x9257, 0xBB4C, 0x9258, 0xBB4E, 0x9259, 0xBB51, 0x925A, 0xBB52, - 0x9261, 0xBB53, 0x9262, 0xBB55, 0x9263, 0xBB56, 0x9264, 0xBB57, - 0x9265, 0xBB59, 0x9266, 0xBB5A, 0x9267, 0xBB5B, 0x9268, 0xBB5C, - 0x9269, 0xBB5D, 0x926A, 0xBB5E, 0x926B, 0xBB5F, 0x926C, 0xBB60, - 0x926D, 0xBB62, 0x926E, 0xBB64, 0x926F, 0xBB65, 0x9270, 0xBB66, - 0x9271, 0xBB67, 0x9272, 0xBB68, 0x9273, 0xBB69, 0x9274, 0xBB6A, - 0x9275, 0xBB6B, 0x9276, 0xBB6D, 0x9277, 0xBB6E, 0x9278, 0xBB6F, - 0x9279, 0xBB70, 0x927A, 0xBB71, 0x9281, 0xBB72, 0x9282, 0xBB73, - 0x9283, 0xBB74, 0x9284, 0xBB75, 0x9285, 0xBB76, 0x9286, 0xBB77, - 0x9287, 0xBB78, 0x9288, 0xBB79, 0x9289, 0xBB7A, 0x928A, 0xBB7B, - 0x928B, 0xBB7C, 0x928C, 0xBB7D, 0x928D, 0xBB7E, 0x928E, 0xBB7F, - 0x928F, 0xBB80, 0x9290, 0xBB81, 0x9291, 0xBB82, 0x9292, 0xBB83, - 0x9293, 0xBB84, 0x9294, 0xBB85, 0x9295, 0xBB86, 0x9296, 0xBB87, - 0x9297, 0xBB89, 0x9298, 0xBB8A, 0x9299, 0xBB8B, 0x929A, 0xBB8D, - 0x929B, 0xBB8E, 0x929C, 0xBB8F, 0x929D, 0xBB91, 0x929E, 0xBB92, - 0x929F, 0xBB93, 0x92A0, 0xBB94, 0x92A1, 0xBB95, 0x92A2, 0xBB96, - 0x92A3, 0xBB97, 0x92A4, 0xBB98, 0x92A5, 0xBB99, 0x92A6, 0xBB9A, - 0x92A7, 0xBB9B, 0x92A8, 0xBB9C, 0x92A9, 0xBB9D, 0x92AA, 0xBB9E, - 0x92AB, 0xBB9F, 0x92AC, 0xBBA0, 0x92AD, 0xBBA1, 0x92AE, 0xBBA2, - 0x92AF, 0xBBA3, 0x92B0, 0xBBA5, 0x92B1, 0xBBA6, 0x92B2, 0xBBA7, - 0x92B3, 0xBBA9, 0x92B4, 0xBBAA, 0x92B5, 0xBBAB, 0x92B6, 0xBBAD, - 0x92B7, 0xBBAE, 0x92B8, 0xBBAF, 0x92B9, 0xBBB0, 0x92BA, 0xBBB1, - 0x92BB, 0xBBB2, 0x92BC, 0xBBB3, 0x92BD, 0xBBB5, 0x92BE, 0xBBB6, - 0x92BF, 0xBBB8, 0x92C0, 0xBBB9, 0x92C1, 0xBBBA, 0x92C2, 0xBBBB, - 0x92C3, 0xBBBC, 0x92C4, 0xBBBD, 0x92C5, 0xBBBE, 0x92C6, 0xBBBF, - 0x92C7, 0xBBC1, 0x92C8, 0xBBC2, 0x92C9, 0xBBC3, 0x92CA, 0xBBC5, - 0x92CB, 0xBBC6, 0x92CC, 0xBBC7, 0x92CD, 0xBBC9, 0x92CE, 0xBBCA, - 0x92CF, 0xBBCB, 0x92D0, 0xBBCC, 0x92D1, 0xBBCD, 0x92D2, 0xBBCE, - 0x92D3, 0xBBCF, 0x92D4, 0xBBD1, 0x92D5, 0xBBD2, 0x92D6, 0xBBD4, - 0x92D7, 0xBBD5, 0x92D8, 0xBBD6, 0x92D9, 0xBBD7, 0x92DA, 0xBBD8, - 0x92DB, 0xBBD9, 0x92DC, 0xBBDA, 0x92DD, 0xBBDB, 0x92DE, 0xBBDC, - 0x92DF, 0xBBDD, 0x92E0, 0xBBDE, 0x92E1, 0xBBDF, 0x92E2, 0xBBE0, - 0x92E3, 0xBBE1, 0x92E4, 0xBBE2, 0x92E5, 0xBBE3, 0x92E6, 0xBBE4, - 0x92E7, 0xBBE5, 0x92E8, 0xBBE6, 0x92E9, 0xBBE7, 0x92EA, 0xBBE8, - 0x92EB, 0xBBE9, 0x92EC, 0xBBEA, 0x92ED, 0xBBEB, 0x92EE, 0xBBEC, - 0x92EF, 0xBBED, 0x92F0, 0xBBEE, 0x92F1, 0xBBEF, 0x92F2, 0xBBF0, - 0x92F3, 0xBBF1, 0x92F4, 0xBBF2, 0x92F5, 0xBBF3, 0x92F6, 0xBBF4, - 0x92F7, 0xBBF5, 0x92F8, 0xBBF6, 0x92F9, 0xBBF7, 0x92FA, 0xBBFA, - 0x92FB, 0xBBFB, 0x92FC, 0xBBFD, 0x92FD, 0xBBFE, 0x92FE, 0xBC01, - 0x9341, 0xBC03, 0x9342, 0xBC04, 0x9343, 0xBC05, 0x9344, 0xBC06, - 0x9345, 0xBC07, 0x9346, 0xBC0A, 0x9347, 0xBC0E, 0x9348, 0xBC10, - 0x9349, 0xBC12, 0x934A, 0xBC13, 0x934B, 0xBC19, 0x934C, 0xBC1A, - 0x934D, 0xBC20, 0x934E, 0xBC21, 0x934F, 0xBC22, 0x9350, 0xBC23, - 0x9351, 0xBC26, 0x9352, 0xBC28, 0x9353, 0xBC2A, 0x9354, 0xBC2B, - 0x9355, 0xBC2C, 0x9356, 0xBC2E, 0x9357, 0xBC2F, 0x9358, 0xBC32, - 0x9359, 0xBC33, 0x935A, 0xBC35, 0x9361, 0xBC36, 0x9362, 0xBC37, - 0x9363, 0xBC39, 0x9364, 0xBC3A, 0x9365, 0xBC3B, 0x9366, 0xBC3C, - 0x9367, 0xBC3D, 0x9368, 0xBC3E, 0x9369, 0xBC3F, 0x936A, 0xBC42, - 0x936B, 0xBC46, 0x936C, 0xBC47, 0x936D, 0xBC48, 0x936E, 0xBC4A, - 0x936F, 0xBC4B, 0x9370, 0xBC4E, 0x9371, 0xBC4F, 0x9372, 0xBC51, - 0x9373, 0xBC52, 0x9374, 0xBC53, 0x9375, 0xBC54, 0x9376, 0xBC55, - 0x9377, 0xBC56, 0x9378, 0xBC57, 0x9379, 0xBC58, 0x937A, 0xBC59, - 0x9381, 0xBC5A, 0x9382, 0xBC5B, 0x9383, 0xBC5C, 0x9384, 0xBC5E, - 0x9385, 0xBC5F, 0x9386, 0xBC60, 0x9387, 0xBC61, 0x9388, 0xBC62, - 0x9389, 0xBC63, 0x938A, 0xBC64, 0x938B, 0xBC65, 0x938C, 0xBC66, - 0x938D, 0xBC67, 0x938E, 0xBC68, 0x938F, 0xBC69, 0x9390, 0xBC6A, - 0x9391, 0xBC6B, 0x9392, 0xBC6C, 0x9393, 0xBC6D, 0x9394, 0xBC6E, - 0x9395, 0xBC6F, 0x9396, 0xBC70, 0x9397, 0xBC71, 0x9398, 0xBC72, - 0x9399, 0xBC73, 0x939A, 0xBC74, 0x939B, 0xBC75, 0x939C, 0xBC76, - 0x939D, 0xBC77, 0x939E, 0xBC78, 0x939F, 0xBC79, 0x93A0, 0xBC7A, - 0x93A1, 0xBC7B, 0x93A2, 0xBC7C, 0x93A3, 0xBC7D, 0x93A4, 0xBC7E, - 0x93A5, 0xBC7F, 0x93A6, 0xBC80, 0x93A7, 0xBC81, 0x93A8, 0xBC82, - 0x93A9, 0xBC83, 0x93AA, 0xBC86, 0x93AB, 0xBC87, 0x93AC, 0xBC89, - 0x93AD, 0xBC8A, 0x93AE, 0xBC8D, 0x93AF, 0xBC8F, 0x93B0, 0xBC90, - 0x93B1, 0xBC91, 0x93B2, 0xBC92, 0x93B3, 0xBC93, 0x93B4, 0xBC96, - 0x93B5, 0xBC98, 0x93B6, 0xBC9B, 0x93B7, 0xBC9C, 0x93B8, 0xBC9D, - 0x93B9, 0xBC9E, 0x93BA, 0xBC9F, 0x93BB, 0xBCA2, 0x93BC, 0xBCA3, - 0x93BD, 0xBCA5, 0x93BE, 0xBCA6, 0x93BF, 0xBCA9, 0x93C0, 0xBCAA, - 0x93C1, 0xBCAB, 0x93C2, 0xBCAC, 0x93C3, 0xBCAD, 0x93C4, 0xBCAE, - 0x93C5, 0xBCAF, 0x93C6, 0xBCB2, 0x93C7, 0xBCB6, 0x93C8, 0xBCB7, - 0x93C9, 0xBCB8, 0x93CA, 0xBCB9, 0x93CB, 0xBCBA, 0x93CC, 0xBCBB, - 0x93CD, 0xBCBE, 0x93CE, 0xBCBF, 0x93CF, 0xBCC1, 0x93D0, 0xBCC2, - 0x93D1, 0xBCC3, 0x93D2, 0xBCC5, 0x93D3, 0xBCC6, 0x93D4, 0xBCC7, - 0x93D5, 0xBCC8, 0x93D6, 0xBCC9, 0x93D7, 0xBCCA, 0x93D8, 0xBCCB, - 0x93D9, 0xBCCC, 0x93DA, 0xBCCE, 0x93DB, 0xBCD2, 0x93DC, 0xBCD3, - 0x93DD, 0xBCD4, 0x93DE, 0xBCD6, 0x93DF, 0xBCD7, 0x93E0, 0xBCD9, - 0x93E1, 0xBCDA, 0x93E2, 0xBCDB, 0x93E3, 0xBCDD, 0x93E4, 0xBCDE, - 0x93E5, 0xBCDF, 0x93E6, 0xBCE0, 0x93E7, 0xBCE1, 0x93E8, 0xBCE2, - 0x93E9, 0xBCE3, 0x93EA, 0xBCE4, 0x93EB, 0xBCE5, 0x93EC, 0xBCE6, - 0x93ED, 0xBCE7, 0x93EE, 0xBCE8, 0x93EF, 0xBCE9, 0x93F0, 0xBCEA, - 0x93F1, 0xBCEB, 0x93F2, 0xBCEC, 0x93F3, 0xBCED, 0x93F4, 0xBCEE, - 0x93F5, 0xBCEF, 0x93F6, 0xBCF0, 0x93F7, 0xBCF1, 0x93F8, 0xBCF2, - 0x93F9, 0xBCF3, 0x93FA, 0xBCF7, 0x93FB, 0xBCF9, 0x93FC, 0xBCFA, - 0x93FD, 0xBCFB, 0x93FE, 0xBCFD, 0x9441, 0xBCFE, 0x9442, 0xBCFF, - 0x9443, 0xBD00, 0x9444, 0xBD01, 0x9445, 0xBD02, 0x9446, 0xBD03, - 0x9447, 0xBD06, 0x9448, 0xBD08, 0x9449, 0xBD0A, 0x944A, 0xBD0B, - 0x944B, 0xBD0C, 0x944C, 0xBD0D, 0x944D, 0xBD0E, 0x944E, 0xBD0F, - 0x944F, 0xBD11, 0x9450, 0xBD12, 0x9451, 0xBD13, 0x9452, 0xBD15, - 0x9453, 0xBD16, 0x9454, 0xBD17, 0x9455, 0xBD18, 0x9456, 0xBD19, - 0x9457, 0xBD1A, 0x9458, 0xBD1B, 0x9459, 0xBD1C, 0x945A, 0xBD1D, - 0x9461, 0xBD1E, 0x9462, 0xBD1F, 0x9463, 0xBD20, 0x9464, 0xBD21, - 0x9465, 0xBD22, 0x9466, 0xBD23, 0x9467, 0xBD25, 0x9468, 0xBD26, - 0x9469, 0xBD27, 0x946A, 0xBD28, 0x946B, 0xBD29, 0x946C, 0xBD2A, - 0x946D, 0xBD2B, 0x946E, 0xBD2D, 0x946F, 0xBD2E, 0x9470, 0xBD2F, - 0x9471, 0xBD30, 0x9472, 0xBD31, 0x9473, 0xBD32, 0x9474, 0xBD33, - 0x9475, 0xBD34, 0x9476, 0xBD35, 0x9477, 0xBD36, 0x9478, 0xBD37, - 0x9479, 0xBD38, 0x947A, 0xBD39, 0x9481, 0xBD3A, 0x9482, 0xBD3B, - 0x9483, 0xBD3C, 0x9484, 0xBD3D, 0x9485, 0xBD3E, 0x9486, 0xBD3F, - 0x9487, 0xBD41, 0x9488, 0xBD42, 0x9489, 0xBD43, 0x948A, 0xBD44, - 0x948B, 0xBD45, 0x948C, 0xBD46, 0x948D, 0xBD47, 0x948E, 0xBD4A, - 0x948F, 0xBD4B, 0x9490, 0xBD4D, 0x9491, 0xBD4E, 0x9492, 0xBD4F, - 0x9493, 0xBD51, 0x9494, 0xBD52, 0x9495, 0xBD53, 0x9496, 0xBD54, - 0x9497, 0xBD55, 0x9498, 0xBD56, 0x9499, 0xBD57, 0x949A, 0xBD5A, - 0x949B, 0xBD5B, 0x949C, 0xBD5C, 0x949D, 0xBD5D, 0x949E, 0xBD5E, - 0x949F, 0xBD5F, 0x94A0, 0xBD60, 0x94A1, 0xBD61, 0x94A2, 0xBD62, - 0x94A3, 0xBD63, 0x94A4, 0xBD65, 0x94A5, 0xBD66, 0x94A6, 0xBD67, - 0x94A7, 0xBD69, 0x94A8, 0xBD6A, 0x94A9, 0xBD6B, 0x94AA, 0xBD6C, - 0x94AB, 0xBD6D, 0x94AC, 0xBD6E, 0x94AD, 0xBD6F, 0x94AE, 0xBD70, - 0x94AF, 0xBD71, 0x94B0, 0xBD72, 0x94B1, 0xBD73, 0x94B2, 0xBD74, - 0x94B3, 0xBD75, 0x94B4, 0xBD76, 0x94B5, 0xBD77, 0x94B6, 0xBD78, - 0x94B7, 0xBD79, 0x94B8, 0xBD7A, 0x94B9, 0xBD7B, 0x94BA, 0xBD7C, - 0x94BB, 0xBD7D, 0x94BC, 0xBD7E, 0x94BD, 0xBD7F, 0x94BE, 0xBD82, - 0x94BF, 0xBD83, 0x94C0, 0xBD85, 0x94C1, 0xBD86, 0x94C2, 0xBD8B, - 0x94C3, 0xBD8C, 0x94C4, 0xBD8D, 0x94C5, 0xBD8E, 0x94C6, 0xBD8F, - 0x94C7, 0xBD92, 0x94C8, 0xBD94, 0x94C9, 0xBD96, 0x94CA, 0xBD97, - 0x94CB, 0xBD98, 0x94CC, 0xBD9B, 0x94CD, 0xBD9D, 0x94CE, 0xBD9E, - 0x94CF, 0xBD9F, 0x94D0, 0xBDA0, 0x94D1, 0xBDA1, 0x94D2, 0xBDA2, - 0x94D3, 0xBDA3, 0x94D4, 0xBDA5, 0x94D5, 0xBDA6, 0x94D6, 0xBDA7, - 0x94D7, 0xBDA8, 0x94D8, 0xBDA9, 0x94D9, 0xBDAA, 0x94DA, 0xBDAB, - 0x94DB, 0xBDAC, 0x94DC, 0xBDAD, 0x94DD, 0xBDAE, 0x94DE, 0xBDAF, - 0x94DF, 0xBDB1, 0x94E0, 0xBDB2, 0x94E1, 0xBDB3, 0x94E2, 0xBDB4, - 0x94E3, 0xBDB5, 0x94E4, 0xBDB6, 0x94E5, 0xBDB7, 0x94E6, 0xBDB9, - 0x94E7, 0xBDBA, 0x94E8, 0xBDBB, 0x94E9, 0xBDBC, 0x94EA, 0xBDBD, - 0x94EB, 0xBDBE, 0x94EC, 0xBDBF, 0x94ED, 0xBDC0, 0x94EE, 0xBDC1, - 0x94EF, 0xBDC2, 0x94F0, 0xBDC3, 0x94F1, 0xBDC4, 0x94F2, 0xBDC5, - 0x94F3, 0xBDC6, 0x94F4, 0xBDC7, 0x94F5, 0xBDC8, 0x94F6, 0xBDC9, - 0x94F7, 0xBDCA, 0x94F8, 0xBDCB, 0x94F9, 0xBDCC, 0x94FA, 0xBDCD, - 0x94FB, 0xBDCE, 0x94FC, 0xBDCF, 0x94FD, 0xBDD0, 0x94FE, 0xBDD1, - 0x9541, 0xBDD2, 0x9542, 0xBDD3, 0x9543, 0xBDD6, 0x9544, 0xBDD7, - 0x9545, 0xBDD9, 0x9546, 0xBDDA, 0x9547, 0xBDDB, 0x9548, 0xBDDD, - 0x9549, 0xBDDE, 0x954A, 0xBDDF, 0x954B, 0xBDE0, 0x954C, 0xBDE1, - 0x954D, 0xBDE2, 0x954E, 0xBDE3, 0x954F, 0xBDE4, 0x9550, 0xBDE5, - 0x9551, 0xBDE6, 0x9552, 0xBDE7, 0x9553, 0xBDE8, 0x9554, 0xBDEA, - 0x9555, 0xBDEB, 0x9556, 0xBDEC, 0x9557, 0xBDED, 0x9558, 0xBDEE, - 0x9559, 0xBDEF, 0x955A, 0xBDF1, 0x9561, 0xBDF2, 0x9562, 0xBDF3, - 0x9563, 0xBDF5, 0x9564, 0xBDF6, 0x9565, 0xBDF7, 0x9566, 0xBDF9, - 0x9567, 0xBDFA, 0x9568, 0xBDFB, 0x9569, 0xBDFC, 0x956A, 0xBDFD, - 0x956B, 0xBDFE, 0x956C, 0xBDFF, 0x956D, 0xBE01, 0x956E, 0xBE02, - 0x956F, 0xBE04, 0x9570, 0xBE06, 0x9571, 0xBE07, 0x9572, 0xBE08, - 0x9573, 0xBE09, 0x9574, 0xBE0A, 0x9575, 0xBE0B, 0x9576, 0xBE0E, - 0x9577, 0xBE0F, 0x9578, 0xBE11, 0x9579, 0xBE12, 0x957A, 0xBE13, - 0x9581, 0xBE15, 0x9582, 0xBE16, 0x9583, 0xBE17, 0x9584, 0xBE18, - 0x9585, 0xBE19, 0x9586, 0xBE1A, 0x9587, 0xBE1B, 0x9588, 0xBE1E, - 0x9589, 0xBE20, 0x958A, 0xBE21, 0x958B, 0xBE22, 0x958C, 0xBE23, - 0x958D, 0xBE24, 0x958E, 0xBE25, 0x958F, 0xBE26, 0x9590, 0xBE27, - 0x9591, 0xBE28, 0x9592, 0xBE29, 0x9593, 0xBE2A, 0x9594, 0xBE2B, - 0x9595, 0xBE2C, 0x9596, 0xBE2D, 0x9597, 0xBE2E, 0x9598, 0xBE2F, - 0x9599, 0xBE30, 0x959A, 0xBE31, 0x959B, 0xBE32, 0x959C, 0xBE33, - 0x959D, 0xBE34, 0x959E, 0xBE35, 0x959F, 0xBE36, 0x95A0, 0xBE37, - 0x95A1, 0xBE38, 0x95A2, 0xBE39, 0x95A3, 0xBE3A, 0x95A4, 0xBE3B, - 0x95A5, 0xBE3C, 0x95A6, 0xBE3D, 0x95A7, 0xBE3E, 0x95A8, 0xBE3F, - 0x95A9, 0xBE40, 0x95AA, 0xBE41, 0x95AB, 0xBE42, 0x95AC, 0xBE43, - 0x95AD, 0xBE46, 0x95AE, 0xBE47, 0x95AF, 0xBE49, 0x95B0, 0xBE4A, - 0x95B1, 0xBE4B, 0x95B2, 0xBE4D, 0x95B3, 0xBE4F, 0x95B4, 0xBE50, - 0x95B5, 0xBE51, 0x95B6, 0xBE52, 0x95B7, 0xBE53, 0x95B8, 0xBE56, - 0x95B9, 0xBE58, 0x95BA, 0xBE5C, 0x95BB, 0xBE5D, 0x95BC, 0xBE5E, - 0x95BD, 0xBE5F, 0x95BE, 0xBE62, 0x95BF, 0xBE63, 0x95C0, 0xBE65, - 0x95C1, 0xBE66, 0x95C2, 0xBE67, 0x95C3, 0xBE69, 0x95C4, 0xBE6B, - 0x95C5, 0xBE6C, 0x95C6, 0xBE6D, 0x95C7, 0xBE6E, 0x95C8, 0xBE6F, - 0x95C9, 0xBE72, 0x95CA, 0xBE76, 0x95CB, 0xBE77, 0x95CC, 0xBE78, - 0x95CD, 0xBE79, 0x95CE, 0xBE7A, 0x95CF, 0xBE7E, 0x95D0, 0xBE7F, - 0x95D1, 0xBE81, 0x95D2, 0xBE82, 0x95D3, 0xBE83, 0x95D4, 0xBE85, - 0x95D5, 0xBE86, 0x95D6, 0xBE87, 0x95D7, 0xBE88, 0x95D8, 0xBE89, - 0x95D9, 0xBE8A, 0x95DA, 0xBE8B, 0x95DB, 0xBE8E, 0x95DC, 0xBE92, - 0x95DD, 0xBE93, 0x95DE, 0xBE94, 0x95DF, 0xBE95, 0x95E0, 0xBE96, - 0x95E1, 0xBE97, 0x95E2, 0xBE9A, 0x95E3, 0xBE9B, 0x95E4, 0xBE9C, - 0x95E5, 0xBE9D, 0x95E6, 0xBE9E, 0x95E7, 0xBE9F, 0x95E8, 0xBEA0, - 0x95E9, 0xBEA1, 0x95EA, 0xBEA2, 0x95EB, 0xBEA3, 0x95EC, 0xBEA4, - 0x95ED, 0xBEA5, 0x95EE, 0xBEA6, 0x95EF, 0xBEA7, 0x95F0, 0xBEA9, - 0x95F1, 0xBEAA, 0x95F2, 0xBEAB, 0x95F3, 0xBEAC, 0x95F4, 0xBEAD, - 0x95F5, 0xBEAE, 0x95F6, 0xBEAF, 0x95F7, 0xBEB0, 0x95F8, 0xBEB1, - 0x95F9, 0xBEB2, 0x95FA, 0xBEB3, 0x95FB, 0xBEB4, 0x95FC, 0xBEB5, - 0x95FD, 0xBEB6, 0x95FE, 0xBEB7, 0x9641, 0xBEB8, 0x9642, 0xBEB9, - 0x9643, 0xBEBA, 0x9644, 0xBEBB, 0x9645, 0xBEBC, 0x9646, 0xBEBD, - 0x9647, 0xBEBE, 0x9648, 0xBEBF, 0x9649, 0xBEC0, 0x964A, 0xBEC1, - 0x964B, 0xBEC2, 0x964C, 0xBEC3, 0x964D, 0xBEC4, 0x964E, 0xBEC5, - 0x964F, 0xBEC6, 0x9650, 0xBEC7, 0x9651, 0xBEC8, 0x9652, 0xBEC9, - 0x9653, 0xBECA, 0x9654, 0xBECB, 0x9655, 0xBECC, 0x9656, 0xBECD, - 0x9657, 0xBECE, 0x9658, 0xBECF, 0x9659, 0xBED2, 0x965A, 0xBED3, - 0x9661, 0xBED5, 0x9662, 0xBED6, 0x9663, 0xBED9, 0x9664, 0xBEDA, - 0x9665, 0xBEDB, 0x9666, 0xBEDC, 0x9667, 0xBEDD, 0x9668, 0xBEDE, - 0x9669, 0xBEDF, 0x966A, 0xBEE1, 0x966B, 0xBEE2, 0x966C, 0xBEE6, - 0x966D, 0xBEE7, 0x966E, 0xBEE8, 0x966F, 0xBEE9, 0x9670, 0xBEEA, - 0x9671, 0xBEEB, 0x9672, 0xBEED, 0x9673, 0xBEEE, 0x9674, 0xBEEF, - 0x9675, 0xBEF0, 0x9676, 0xBEF1, 0x9677, 0xBEF2, 0x9678, 0xBEF3, - 0x9679, 0xBEF4, 0x967A, 0xBEF5, 0x9681, 0xBEF6, 0x9682, 0xBEF7, - 0x9683, 0xBEF8, 0x9684, 0xBEF9, 0x9685, 0xBEFA, 0x9686, 0xBEFB, - 0x9687, 0xBEFC, 0x9688, 0xBEFD, 0x9689, 0xBEFE, 0x968A, 0xBEFF, - 0x968B, 0xBF00, 0x968C, 0xBF02, 0x968D, 0xBF03, 0x968E, 0xBF04, - 0x968F, 0xBF05, 0x9690, 0xBF06, 0x9691, 0xBF07, 0x9692, 0xBF0A, - 0x9693, 0xBF0B, 0x9694, 0xBF0C, 0x9695, 0xBF0D, 0x9696, 0xBF0E, - 0x9697, 0xBF0F, 0x9698, 0xBF10, 0x9699, 0xBF11, 0x969A, 0xBF12, - 0x969B, 0xBF13, 0x969C, 0xBF14, 0x969D, 0xBF15, 0x969E, 0xBF16, - 0x969F, 0xBF17, 0x96A0, 0xBF1A, 0x96A1, 0xBF1E, 0x96A2, 0xBF1F, - 0x96A3, 0xBF20, 0x96A4, 0xBF21, 0x96A5, 0xBF22, 0x96A6, 0xBF23, - 0x96A7, 0xBF24, 0x96A8, 0xBF25, 0x96A9, 0xBF26, 0x96AA, 0xBF27, - 0x96AB, 0xBF28, 0x96AC, 0xBF29, 0x96AD, 0xBF2A, 0x96AE, 0xBF2B, - 0x96AF, 0xBF2C, 0x96B0, 0xBF2D, 0x96B1, 0xBF2E, 0x96B2, 0xBF2F, - 0x96B3, 0xBF30, 0x96B4, 0xBF31, 0x96B5, 0xBF32, 0x96B6, 0xBF33, - 0x96B7, 0xBF34, 0x96B8, 0xBF35, 0x96B9, 0xBF36, 0x96BA, 0xBF37, - 0x96BB, 0xBF38, 0x96BC, 0xBF39, 0x96BD, 0xBF3A, 0x96BE, 0xBF3B, - 0x96BF, 0xBF3C, 0x96C0, 0xBF3D, 0x96C1, 0xBF3E, 0x96C2, 0xBF3F, - 0x96C3, 0xBF42, 0x96C4, 0xBF43, 0x96C5, 0xBF45, 0x96C6, 0xBF46, - 0x96C7, 0xBF47, 0x96C8, 0xBF49, 0x96C9, 0xBF4A, 0x96CA, 0xBF4B, - 0x96CB, 0xBF4C, 0x96CC, 0xBF4D, 0x96CD, 0xBF4E, 0x96CE, 0xBF4F, - 0x96CF, 0xBF52, 0x96D0, 0xBF53, 0x96D1, 0xBF54, 0x96D2, 0xBF56, - 0x96D3, 0xBF57, 0x96D4, 0xBF58, 0x96D5, 0xBF59, 0x96D6, 0xBF5A, - 0x96D7, 0xBF5B, 0x96D8, 0xBF5C, 0x96D9, 0xBF5D, 0x96DA, 0xBF5E, - 0x96DB, 0xBF5F, 0x96DC, 0xBF60, 0x96DD, 0xBF61, 0x96DE, 0xBF62, - 0x96DF, 0xBF63, 0x96E0, 0xBF64, 0x96E1, 0xBF65, 0x96E2, 0xBF66, - 0x96E3, 0xBF67, 0x96E4, 0xBF68, 0x96E5, 0xBF69, 0x96E6, 0xBF6A, - 0x96E7, 0xBF6B, 0x96E8, 0xBF6C, 0x96E9, 0xBF6D, 0x96EA, 0xBF6E, - 0x96EB, 0xBF6F, 0x96EC, 0xBF70, 0x96ED, 0xBF71, 0x96EE, 0xBF72, - 0x96EF, 0xBF73, 0x96F0, 0xBF74, 0x96F1, 0xBF75, 0x96F2, 0xBF76, - 0x96F3, 0xBF77, 0x96F4, 0xBF78, 0x96F5, 0xBF79, 0x96F6, 0xBF7A, - 0x96F7, 0xBF7B, 0x96F8, 0xBF7C, 0x96F9, 0xBF7D, 0x96FA, 0xBF7E, - 0x96FB, 0xBF7F, 0x96FC, 0xBF80, 0x96FD, 0xBF81, 0x96FE, 0xBF82, - 0x9741, 0xBF83, 0x9742, 0xBF84, 0x9743, 0xBF85, 0x9744, 0xBF86, - 0x9745, 0xBF87, 0x9746, 0xBF88, 0x9747, 0xBF89, 0x9748, 0xBF8A, - 0x9749, 0xBF8B, 0x974A, 0xBF8C, 0x974B, 0xBF8D, 0x974C, 0xBF8E, - 0x974D, 0xBF8F, 0x974E, 0xBF90, 0x974F, 0xBF91, 0x9750, 0xBF92, - 0x9751, 0xBF93, 0x9752, 0xBF95, 0x9753, 0xBF96, 0x9754, 0xBF97, - 0x9755, 0xBF98, 0x9756, 0xBF99, 0x9757, 0xBF9A, 0x9758, 0xBF9B, - 0x9759, 0xBF9C, 0x975A, 0xBF9D, 0x9761, 0xBF9E, 0x9762, 0xBF9F, - 0x9763, 0xBFA0, 0x9764, 0xBFA1, 0x9765, 0xBFA2, 0x9766, 0xBFA3, - 0x9767, 0xBFA4, 0x9768, 0xBFA5, 0x9769, 0xBFA6, 0x976A, 0xBFA7, - 0x976B, 0xBFA8, 0x976C, 0xBFA9, 0x976D, 0xBFAA, 0x976E, 0xBFAB, - 0x976F, 0xBFAC, 0x9770, 0xBFAD, 0x9771, 0xBFAE, 0x9772, 0xBFAF, - 0x9773, 0xBFB1, 0x9774, 0xBFB2, 0x9775, 0xBFB3, 0x9776, 0xBFB4, - 0x9777, 0xBFB5, 0x9778, 0xBFB6, 0x9779, 0xBFB7, 0x977A, 0xBFB8, - 0x9781, 0xBFB9, 0x9782, 0xBFBA, 0x9783, 0xBFBB, 0x9784, 0xBFBC, - 0x9785, 0xBFBD, 0x9786, 0xBFBE, 0x9787, 0xBFBF, 0x9788, 0xBFC0, - 0x9789, 0xBFC1, 0x978A, 0xBFC2, 0x978B, 0xBFC3, 0x978C, 0xBFC4, - 0x978D, 0xBFC6, 0x978E, 0xBFC7, 0x978F, 0xBFC8, 0x9790, 0xBFC9, - 0x9791, 0xBFCA, 0x9792, 0xBFCB, 0x9793, 0xBFCE, 0x9794, 0xBFCF, - 0x9795, 0xBFD1, 0x9796, 0xBFD2, 0x9797, 0xBFD3, 0x9798, 0xBFD5, - 0x9799, 0xBFD6, 0x979A, 0xBFD7, 0x979B, 0xBFD8, 0x979C, 0xBFD9, - 0x979D, 0xBFDA, 0x979E, 0xBFDB, 0x979F, 0xBFDD, 0x97A0, 0xBFDE, - 0x97A1, 0xBFE0, 0x97A2, 0xBFE2, 0x97A3, 0xBFE3, 0x97A4, 0xBFE4, - 0x97A5, 0xBFE5, 0x97A6, 0xBFE6, 0x97A7, 0xBFE7, 0x97A8, 0xBFE8, - 0x97A9, 0xBFE9, 0x97AA, 0xBFEA, 0x97AB, 0xBFEB, 0x97AC, 0xBFEC, - 0x97AD, 0xBFED, 0x97AE, 0xBFEE, 0x97AF, 0xBFEF, 0x97B0, 0xBFF0, - 0x97B1, 0xBFF1, 0x97B2, 0xBFF2, 0x97B3, 0xBFF3, 0x97B4, 0xBFF4, - 0x97B5, 0xBFF5, 0x97B6, 0xBFF6, 0x97B7, 0xBFF7, 0x97B8, 0xBFF8, - 0x97B9, 0xBFF9, 0x97BA, 0xBFFA, 0x97BB, 0xBFFB, 0x97BC, 0xBFFC, - 0x97BD, 0xBFFD, 0x97BE, 0xBFFE, 0x97BF, 0xBFFF, 0x97C0, 0xC000, - 0x97C1, 0xC001, 0x97C2, 0xC002, 0x97C3, 0xC003, 0x97C4, 0xC004, - 0x97C5, 0xC005, 0x97C6, 0xC006, 0x97C7, 0xC007, 0x97C8, 0xC008, - 0x97C9, 0xC009, 0x97CA, 0xC00A, 0x97CB, 0xC00B, 0x97CC, 0xC00C, - 0x97CD, 0xC00D, 0x97CE, 0xC00E, 0x97CF, 0xC00F, 0x97D0, 0xC010, - 0x97D1, 0xC011, 0x97D2, 0xC012, 0x97D3, 0xC013, 0x97D4, 0xC014, - 0x97D5, 0xC015, 0x97D6, 0xC016, 0x97D7, 0xC017, 0x97D8, 0xC018, - 0x97D9, 0xC019, 0x97DA, 0xC01A, 0x97DB, 0xC01B, 0x97DC, 0xC01C, - 0x97DD, 0xC01D, 0x97DE, 0xC01E, 0x97DF, 0xC01F, 0x97E0, 0xC020, - 0x97E1, 0xC021, 0x97E2, 0xC022, 0x97E3, 0xC023, 0x97E4, 0xC024, - 0x97E5, 0xC025, 0x97E6, 0xC026, 0x97E7, 0xC027, 0x97E8, 0xC028, - 0x97E9, 0xC029, 0x97EA, 0xC02A, 0x97EB, 0xC02B, 0x97EC, 0xC02C, - 0x97ED, 0xC02D, 0x97EE, 0xC02E, 0x97EF, 0xC02F, 0x97F0, 0xC030, - 0x97F1, 0xC031, 0x97F2, 0xC032, 0x97F3, 0xC033, 0x97F4, 0xC034, - 0x97F5, 0xC035, 0x97F6, 0xC036, 0x97F7, 0xC037, 0x97F8, 0xC038, - 0x97F9, 0xC039, 0x97FA, 0xC03A, 0x97FB, 0xC03B, 0x97FC, 0xC03D, - 0x97FD, 0xC03E, 0x97FE, 0xC03F, 0x9841, 0xC040, 0x9842, 0xC041, - 0x9843, 0xC042, 0x9844, 0xC043, 0x9845, 0xC044, 0x9846, 0xC045, - 0x9847, 0xC046, 0x9848, 0xC047, 0x9849, 0xC048, 0x984A, 0xC049, - 0x984B, 0xC04A, 0x984C, 0xC04B, 0x984D, 0xC04C, 0x984E, 0xC04D, - 0x984F, 0xC04E, 0x9850, 0xC04F, 0x9851, 0xC050, 0x9852, 0xC052, - 0x9853, 0xC053, 0x9854, 0xC054, 0x9855, 0xC055, 0x9856, 0xC056, - 0x9857, 0xC057, 0x9858, 0xC059, 0x9859, 0xC05A, 0x985A, 0xC05B, - 0x9861, 0xC05D, 0x9862, 0xC05E, 0x9863, 0xC05F, 0x9864, 0xC061, - 0x9865, 0xC062, 0x9866, 0xC063, 0x9867, 0xC064, 0x9868, 0xC065, - 0x9869, 0xC066, 0x986A, 0xC067, 0x986B, 0xC06A, 0x986C, 0xC06B, - 0x986D, 0xC06C, 0x986E, 0xC06D, 0x986F, 0xC06E, 0x9870, 0xC06F, - 0x9871, 0xC070, 0x9872, 0xC071, 0x9873, 0xC072, 0x9874, 0xC073, - 0x9875, 0xC074, 0x9876, 0xC075, 0x9877, 0xC076, 0x9878, 0xC077, - 0x9879, 0xC078, 0x987A, 0xC079, 0x9881, 0xC07A, 0x9882, 0xC07B, - 0x9883, 0xC07C, 0x9884, 0xC07D, 0x9885, 0xC07E, 0x9886, 0xC07F, - 0x9887, 0xC080, 0x9888, 0xC081, 0x9889, 0xC082, 0x988A, 0xC083, - 0x988B, 0xC084, 0x988C, 0xC085, 0x988D, 0xC086, 0x988E, 0xC087, - 0x988F, 0xC088, 0x9890, 0xC089, 0x9891, 0xC08A, 0x9892, 0xC08B, - 0x9893, 0xC08C, 0x9894, 0xC08D, 0x9895, 0xC08E, 0x9896, 0xC08F, - 0x9897, 0xC092, 0x9898, 0xC093, 0x9899, 0xC095, 0x989A, 0xC096, - 0x989B, 0xC097, 0x989C, 0xC099, 0x989D, 0xC09A, 0x989E, 0xC09B, - 0x989F, 0xC09C, 0x98A0, 0xC09D, 0x98A1, 0xC09E, 0x98A2, 0xC09F, - 0x98A3, 0xC0A2, 0x98A4, 0xC0A4, 0x98A5, 0xC0A6, 0x98A6, 0xC0A7, - 0x98A7, 0xC0A8, 0x98A8, 0xC0A9, 0x98A9, 0xC0AA, 0x98AA, 0xC0AB, - 0x98AB, 0xC0AE, 0x98AC, 0xC0B1, 0x98AD, 0xC0B2, 0x98AE, 0xC0B7, - 0x98AF, 0xC0B8, 0x98B0, 0xC0B9, 0x98B1, 0xC0BA, 0x98B2, 0xC0BB, - 0x98B3, 0xC0BE, 0x98B4, 0xC0C2, 0x98B5, 0xC0C3, 0x98B6, 0xC0C4, - 0x98B7, 0xC0C6, 0x98B8, 0xC0C7, 0x98B9, 0xC0CA, 0x98BA, 0xC0CB, - 0x98BB, 0xC0CD, 0x98BC, 0xC0CE, 0x98BD, 0xC0CF, 0x98BE, 0xC0D1, - 0x98BF, 0xC0D2, 0x98C0, 0xC0D3, 0x98C1, 0xC0D4, 0x98C2, 0xC0D5, - 0x98C3, 0xC0D6, 0x98C4, 0xC0D7, 0x98C5, 0xC0DA, 0x98C6, 0xC0DE, - 0x98C7, 0xC0DF, 0x98C8, 0xC0E0, 0x98C9, 0xC0E1, 0x98CA, 0xC0E2, - 0x98CB, 0xC0E3, 0x98CC, 0xC0E6, 0x98CD, 0xC0E7, 0x98CE, 0xC0E9, - 0x98CF, 0xC0EA, 0x98D0, 0xC0EB, 0x98D1, 0xC0ED, 0x98D2, 0xC0EE, - 0x98D3, 0xC0EF, 0x98D4, 0xC0F0, 0x98D5, 0xC0F1, 0x98D6, 0xC0F2, - 0x98D7, 0xC0F3, 0x98D8, 0xC0F6, 0x98D9, 0xC0F8, 0x98DA, 0xC0FA, - 0x98DB, 0xC0FB, 0x98DC, 0xC0FC, 0x98DD, 0xC0FD, 0x98DE, 0xC0FE, - 0x98DF, 0xC0FF, 0x98E0, 0xC101, 0x98E1, 0xC102, 0x98E2, 0xC103, - 0x98E3, 0xC105, 0x98E4, 0xC106, 0x98E5, 0xC107, 0x98E6, 0xC109, - 0x98E7, 0xC10A, 0x98E8, 0xC10B, 0x98E9, 0xC10C, 0x98EA, 0xC10D, - 0x98EB, 0xC10E, 0x98EC, 0xC10F, 0x98ED, 0xC111, 0x98EE, 0xC112, - 0x98EF, 0xC113, 0x98F0, 0xC114, 0x98F1, 0xC116, 0x98F2, 0xC117, - 0x98F3, 0xC118, 0x98F4, 0xC119, 0x98F5, 0xC11A, 0x98F6, 0xC11B, - 0x98F7, 0xC121, 0x98F8, 0xC122, 0x98F9, 0xC125, 0x98FA, 0xC128, - 0x98FB, 0xC129, 0x98FC, 0xC12A, 0x98FD, 0xC12B, 0x98FE, 0xC12E, - 0x9941, 0xC132, 0x9942, 0xC133, 0x9943, 0xC134, 0x9944, 0xC135, - 0x9945, 0xC137, 0x9946, 0xC13A, 0x9947, 0xC13B, 0x9948, 0xC13D, - 0x9949, 0xC13E, 0x994A, 0xC13F, 0x994B, 0xC141, 0x994C, 0xC142, - 0x994D, 0xC143, 0x994E, 0xC144, 0x994F, 0xC145, 0x9950, 0xC146, - 0x9951, 0xC147, 0x9952, 0xC14A, 0x9953, 0xC14E, 0x9954, 0xC14F, - 0x9955, 0xC150, 0x9956, 0xC151, 0x9957, 0xC152, 0x9958, 0xC153, - 0x9959, 0xC156, 0x995A, 0xC157, 0x9961, 0xC159, 0x9962, 0xC15A, - 0x9963, 0xC15B, 0x9964, 0xC15D, 0x9965, 0xC15E, 0x9966, 0xC15F, - 0x9967, 0xC160, 0x9968, 0xC161, 0x9969, 0xC162, 0x996A, 0xC163, - 0x996B, 0xC166, 0x996C, 0xC16A, 0x996D, 0xC16B, 0x996E, 0xC16C, - 0x996F, 0xC16D, 0x9970, 0xC16E, 0x9971, 0xC16F, 0x9972, 0xC171, - 0x9973, 0xC172, 0x9974, 0xC173, 0x9975, 0xC175, 0x9976, 0xC176, - 0x9977, 0xC177, 0x9978, 0xC179, 0x9979, 0xC17A, 0x997A, 0xC17B, - 0x9981, 0xC17C, 0x9982, 0xC17D, 0x9983, 0xC17E, 0x9984, 0xC17F, - 0x9985, 0xC180, 0x9986, 0xC181, 0x9987, 0xC182, 0x9988, 0xC183, - 0x9989, 0xC184, 0x998A, 0xC186, 0x998B, 0xC187, 0x998C, 0xC188, - 0x998D, 0xC189, 0x998E, 0xC18A, 0x998F, 0xC18B, 0x9990, 0xC18F, - 0x9991, 0xC191, 0x9992, 0xC192, 0x9993, 0xC193, 0x9994, 0xC195, - 0x9995, 0xC197, 0x9996, 0xC198, 0x9997, 0xC199, 0x9998, 0xC19A, - 0x9999, 0xC19B, 0x999A, 0xC19E, 0x999B, 0xC1A0, 0x999C, 0xC1A2, - 0x999D, 0xC1A3, 0x999E, 0xC1A4, 0x999F, 0xC1A6, 0x99A0, 0xC1A7, - 0x99A1, 0xC1AA, 0x99A2, 0xC1AB, 0x99A3, 0xC1AD, 0x99A4, 0xC1AE, - 0x99A5, 0xC1AF, 0x99A6, 0xC1B1, 0x99A7, 0xC1B2, 0x99A8, 0xC1B3, - 0x99A9, 0xC1B4, 0x99AA, 0xC1B5, 0x99AB, 0xC1B6, 0x99AC, 0xC1B7, - 0x99AD, 0xC1B8, 0x99AE, 0xC1B9, 0x99AF, 0xC1BA, 0x99B0, 0xC1BB, - 0x99B1, 0xC1BC, 0x99B2, 0xC1BE, 0x99B3, 0xC1BF, 0x99B4, 0xC1C0, - 0x99B5, 0xC1C1, 0x99B6, 0xC1C2, 0x99B7, 0xC1C3, 0x99B8, 0xC1C5, - 0x99B9, 0xC1C6, 0x99BA, 0xC1C7, 0x99BB, 0xC1C9, 0x99BC, 0xC1CA, - 0x99BD, 0xC1CB, 0x99BE, 0xC1CD, 0x99BF, 0xC1CE, 0x99C0, 0xC1CF, - 0x99C1, 0xC1D0, 0x99C2, 0xC1D1, 0x99C3, 0xC1D2, 0x99C4, 0xC1D3, - 0x99C5, 0xC1D5, 0x99C6, 0xC1D6, 0x99C7, 0xC1D9, 0x99C8, 0xC1DA, - 0x99C9, 0xC1DB, 0x99CA, 0xC1DC, 0x99CB, 0xC1DD, 0x99CC, 0xC1DE, - 0x99CD, 0xC1DF, 0x99CE, 0xC1E1, 0x99CF, 0xC1E2, 0x99D0, 0xC1E3, - 0x99D1, 0xC1E5, 0x99D2, 0xC1E6, 0x99D3, 0xC1E7, 0x99D4, 0xC1E9, - 0x99D5, 0xC1EA, 0x99D6, 0xC1EB, 0x99D7, 0xC1EC, 0x99D8, 0xC1ED, - 0x99D9, 0xC1EE, 0x99DA, 0xC1EF, 0x99DB, 0xC1F2, 0x99DC, 0xC1F4, - 0x99DD, 0xC1F5, 0x99DE, 0xC1F6, 0x99DF, 0xC1F7, 0x99E0, 0xC1F8, - 0x99E1, 0xC1F9, 0x99E2, 0xC1FA, 0x99E3, 0xC1FB, 0x99E4, 0xC1FE, - 0x99E5, 0xC1FF, 0x99E6, 0xC201, 0x99E7, 0xC202, 0x99E8, 0xC203, - 0x99E9, 0xC205, 0x99EA, 0xC206, 0x99EB, 0xC207, 0x99EC, 0xC208, - 0x99ED, 0xC209, 0x99EE, 0xC20A, 0x99EF, 0xC20B, 0x99F0, 0xC20E, - 0x99F1, 0xC210, 0x99F2, 0xC212, 0x99F3, 0xC213, 0x99F4, 0xC214, - 0x99F5, 0xC215, 0x99F6, 0xC216, 0x99F7, 0xC217, 0x99F8, 0xC21A, - 0x99F9, 0xC21B, 0x99FA, 0xC21D, 0x99FB, 0xC21E, 0x99FC, 0xC221, - 0x99FD, 0xC222, 0x99FE, 0xC223, 0x9A41, 0xC224, 0x9A42, 0xC225, - 0x9A43, 0xC226, 0x9A44, 0xC227, 0x9A45, 0xC22A, 0x9A46, 0xC22C, - 0x9A47, 0xC22E, 0x9A48, 0xC230, 0x9A49, 0xC233, 0x9A4A, 0xC235, - 0x9A4B, 0xC236, 0x9A4C, 0xC237, 0x9A4D, 0xC238, 0x9A4E, 0xC239, - 0x9A4F, 0xC23A, 0x9A50, 0xC23B, 0x9A51, 0xC23C, 0x9A52, 0xC23D, - 0x9A53, 0xC23E, 0x9A54, 0xC23F, 0x9A55, 0xC240, 0x9A56, 0xC241, - 0x9A57, 0xC242, 0x9A58, 0xC243, 0x9A59, 0xC244, 0x9A5A, 0xC245, - 0x9A61, 0xC246, 0x9A62, 0xC247, 0x9A63, 0xC249, 0x9A64, 0xC24A, - 0x9A65, 0xC24B, 0x9A66, 0xC24C, 0x9A67, 0xC24D, 0x9A68, 0xC24E, - 0x9A69, 0xC24F, 0x9A6A, 0xC252, 0x9A6B, 0xC253, 0x9A6C, 0xC255, - 0x9A6D, 0xC256, 0x9A6E, 0xC257, 0x9A6F, 0xC259, 0x9A70, 0xC25A, - 0x9A71, 0xC25B, 0x9A72, 0xC25C, 0x9A73, 0xC25D, 0x9A74, 0xC25E, - 0x9A75, 0xC25F, 0x9A76, 0xC261, 0x9A77, 0xC262, 0x9A78, 0xC263, - 0x9A79, 0xC264, 0x9A7A, 0xC266, 0x9A81, 0xC267, 0x9A82, 0xC268, - 0x9A83, 0xC269, 0x9A84, 0xC26A, 0x9A85, 0xC26B, 0x9A86, 0xC26E, - 0x9A87, 0xC26F, 0x9A88, 0xC271, 0x9A89, 0xC272, 0x9A8A, 0xC273, - 0x9A8B, 0xC275, 0x9A8C, 0xC276, 0x9A8D, 0xC277, 0x9A8E, 0xC278, - 0x9A8F, 0xC279, 0x9A90, 0xC27A, 0x9A91, 0xC27B, 0x9A92, 0xC27E, - 0x9A93, 0xC280, 0x9A94, 0xC282, 0x9A95, 0xC283, 0x9A96, 0xC284, - 0x9A97, 0xC285, 0x9A98, 0xC286, 0x9A99, 0xC287, 0x9A9A, 0xC28A, - 0x9A9B, 0xC28B, 0x9A9C, 0xC28C, 0x9A9D, 0xC28D, 0x9A9E, 0xC28E, - 0x9A9F, 0xC28F, 0x9AA0, 0xC291, 0x9AA1, 0xC292, 0x9AA2, 0xC293, - 0x9AA3, 0xC294, 0x9AA4, 0xC295, 0x9AA5, 0xC296, 0x9AA6, 0xC297, - 0x9AA7, 0xC299, 0x9AA8, 0xC29A, 0x9AA9, 0xC29C, 0x9AAA, 0xC29E, - 0x9AAB, 0xC29F, 0x9AAC, 0xC2A0, 0x9AAD, 0xC2A1, 0x9AAE, 0xC2A2, - 0x9AAF, 0xC2A3, 0x9AB0, 0xC2A6, 0x9AB1, 0xC2A7, 0x9AB2, 0xC2A9, - 0x9AB3, 0xC2AA, 0x9AB4, 0xC2AB, 0x9AB5, 0xC2AE, 0x9AB6, 0xC2AF, - 0x9AB7, 0xC2B0, 0x9AB8, 0xC2B1, 0x9AB9, 0xC2B2, 0x9ABA, 0xC2B3, - 0x9ABB, 0xC2B6, 0x9ABC, 0xC2B8, 0x9ABD, 0xC2BA, 0x9ABE, 0xC2BB, - 0x9ABF, 0xC2BC, 0x9AC0, 0xC2BD, 0x9AC1, 0xC2BE, 0x9AC2, 0xC2BF, - 0x9AC3, 0xC2C0, 0x9AC4, 0xC2C1, 0x9AC5, 0xC2C2, 0x9AC6, 0xC2C3, - 0x9AC7, 0xC2C4, 0x9AC8, 0xC2C5, 0x9AC9, 0xC2C6, 0x9ACA, 0xC2C7, - 0x9ACB, 0xC2C8, 0x9ACC, 0xC2C9, 0x9ACD, 0xC2CA, 0x9ACE, 0xC2CB, - 0x9ACF, 0xC2CC, 0x9AD0, 0xC2CD, 0x9AD1, 0xC2CE, 0x9AD2, 0xC2CF, - 0x9AD3, 0xC2D0, 0x9AD4, 0xC2D1, 0x9AD5, 0xC2D2, 0x9AD6, 0xC2D3, - 0x9AD7, 0xC2D4, 0x9AD8, 0xC2D5, 0x9AD9, 0xC2D6, 0x9ADA, 0xC2D7, - 0x9ADB, 0xC2D8, 0x9ADC, 0xC2D9, 0x9ADD, 0xC2DA, 0x9ADE, 0xC2DB, - 0x9ADF, 0xC2DE, 0x9AE0, 0xC2DF, 0x9AE1, 0xC2E1, 0x9AE2, 0xC2E2, - 0x9AE3, 0xC2E5, 0x9AE4, 0xC2E6, 0x9AE5, 0xC2E7, 0x9AE6, 0xC2E8, - 0x9AE7, 0xC2E9, 0x9AE8, 0xC2EA, 0x9AE9, 0xC2EE, 0x9AEA, 0xC2F0, - 0x9AEB, 0xC2F2, 0x9AEC, 0xC2F3, 0x9AED, 0xC2F4, 0x9AEE, 0xC2F5, - 0x9AEF, 0xC2F7, 0x9AF0, 0xC2FA, 0x9AF1, 0xC2FD, 0x9AF2, 0xC2FE, - 0x9AF3, 0xC2FF, 0x9AF4, 0xC301, 0x9AF5, 0xC302, 0x9AF6, 0xC303, - 0x9AF7, 0xC304, 0x9AF8, 0xC305, 0x9AF9, 0xC306, 0x9AFA, 0xC307, - 0x9AFB, 0xC30A, 0x9AFC, 0xC30B, 0x9AFD, 0xC30E, 0x9AFE, 0xC30F, - 0x9B41, 0xC310, 0x9B42, 0xC311, 0x9B43, 0xC312, 0x9B44, 0xC316, - 0x9B45, 0xC317, 0x9B46, 0xC319, 0x9B47, 0xC31A, 0x9B48, 0xC31B, - 0x9B49, 0xC31D, 0x9B4A, 0xC31E, 0x9B4B, 0xC31F, 0x9B4C, 0xC320, - 0x9B4D, 0xC321, 0x9B4E, 0xC322, 0x9B4F, 0xC323, 0x9B50, 0xC326, - 0x9B51, 0xC327, 0x9B52, 0xC32A, 0x9B53, 0xC32B, 0x9B54, 0xC32C, - 0x9B55, 0xC32D, 0x9B56, 0xC32E, 0x9B57, 0xC32F, 0x9B58, 0xC330, - 0x9B59, 0xC331, 0x9B5A, 0xC332, 0x9B61, 0xC333, 0x9B62, 0xC334, - 0x9B63, 0xC335, 0x9B64, 0xC336, 0x9B65, 0xC337, 0x9B66, 0xC338, - 0x9B67, 0xC339, 0x9B68, 0xC33A, 0x9B69, 0xC33B, 0x9B6A, 0xC33C, - 0x9B6B, 0xC33D, 0x9B6C, 0xC33E, 0x9B6D, 0xC33F, 0x9B6E, 0xC340, - 0x9B6F, 0xC341, 0x9B70, 0xC342, 0x9B71, 0xC343, 0x9B72, 0xC344, - 0x9B73, 0xC346, 0x9B74, 0xC347, 0x9B75, 0xC348, 0x9B76, 0xC349, - 0x9B77, 0xC34A, 0x9B78, 0xC34B, 0x9B79, 0xC34C, 0x9B7A, 0xC34D, - 0x9B81, 0xC34E, 0x9B82, 0xC34F, 0x9B83, 0xC350, 0x9B84, 0xC351, - 0x9B85, 0xC352, 0x9B86, 0xC353, 0x9B87, 0xC354, 0x9B88, 0xC355, - 0x9B89, 0xC356, 0x9B8A, 0xC357, 0x9B8B, 0xC358, 0x9B8C, 0xC359, - 0x9B8D, 0xC35A, 0x9B8E, 0xC35B, 0x9B8F, 0xC35C, 0x9B90, 0xC35D, - 0x9B91, 0xC35E, 0x9B92, 0xC35F, 0x9B93, 0xC360, 0x9B94, 0xC361, - 0x9B95, 0xC362, 0x9B96, 0xC363, 0x9B97, 0xC364, 0x9B98, 0xC365, - 0x9B99, 0xC366, 0x9B9A, 0xC367, 0x9B9B, 0xC36A, 0x9B9C, 0xC36B, - 0x9B9D, 0xC36D, 0x9B9E, 0xC36E, 0x9B9F, 0xC36F, 0x9BA0, 0xC371, - 0x9BA1, 0xC373, 0x9BA2, 0xC374, 0x9BA3, 0xC375, 0x9BA4, 0xC376, - 0x9BA5, 0xC377, 0x9BA6, 0xC37A, 0x9BA7, 0xC37B, 0x9BA8, 0xC37E, - 0x9BA9, 0xC37F, 0x9BAA, 0xC380, 0x9BAB, 0xC381, 0x9BAC, 0xC382, - 0x9BAD, 0xC383, 0x9BAE, 0xC385, 0x9BAF, 0xC386, 0x9BB0, 0xC387, - 0x9BB1, 0xC389, 0x9BB2, 0xC38A, 0x9BB3, 0xC38B, 0x9BB4, 0xC38D, - 0x9BB5, 0xC38E, 0x9BB6, 0xC38F, 0x9BB7, 0xC390, 0x9BB8, 0xC391, - 0x9BB9, 0xC392, 0x9BBA, 0xC393, 0x9BBB, 0xC394, 0x9BBC, 0xC395, - 0x9BBD, 0xC396, 0x9BBE, 0xC397, 0x9BBF, 0xC398, 0x9BC0, 0xC399, - 0x9BC1, 0xC39A, 0x9BC2, 0xC39B, 0x9BC3, 0xC39C, 0x9BC4, 0xC39D, - 0x9BC5, 0xC39E, 0x9BC6, 0xC39F, 0x9BC7, 0xC3A0, 0x9BC8, 0xC3A1, - 0x9BC9, 0xC3A2, 0x9BCA, 0xC3A3, 0x9BCB, 0xC3A4, 0x9BCC, 0xC3A5, - 0x9BCD, 0xC3A6, 0x9BCE, 0xC3A7, 0x9BCF, 0xC3A8, 0x9BD0, 0xC3A9, - 0x9BD1, 0xC3AA, 0x9BD2, 0xC3AB, 0x9BD3, 0xC3AC, 0x9BD4, 0xC3AD, - 0x9BD5, 0xC3AE, 0x9BD6, 0xC3AF, 0x9BD7, 0xC3B0, 0x9BD8, 0xC3B1, - 0x9BD9, 0xC3B2, 0x9BDA, 0xC3B3, 0x9BDB, 0xC3B4, 0x9BDC, 0xC3B5, - 0x9BDD, 0xC3B6, 0x9BDE, 0xC3B7, 0x9BDF, 0xC3B8, 0x9BE0, 0xC3B9, - 0x9BE1, 0xC3BA, 0x9BE2, 0xC3BB, 0x9BE3, 0xC3BC, 0x9BE4, 0xC3BD, - 0x9BE5, 0xC3BE, 0x9BE6, 0xC3BF, 0x9BE7, 0xC3C1, 0x9BE8, 0xC3C2, - 0x9BE9, 0xC3C3, 0x9BEA, 0xC3C4, 0x9BEB, 0xC3C5, 0x9BEC, 0xC3C6, - 0x9BED, 0xC3C7, 0x9BEE, 0xC3C8, 0x9BEF, 0xC3C9, 0x9BF0, 0xC3CA, - 0x9BF1, 0xC3CB, 0x9BF2, 0xC3CC, 0x9BF3, 0xC3CD, 0x9BF4, 0xC3CE, - 0x9BF5, 0xC3CF, 0x9BF6, 0xC3D0, 0x9BF7, 0xC3D1, 0x9BF8, 0xC3D2, - 0x9BF9, 0xC3D3, 0x9BFA, 0xC3D4, 0x9BFB, 0xC3D5, 0x9BFC, 0xC3D6, - 0x9BFD, 0xC3D7, 0x9BFE, 0xC3DA, 0x9C41, 0xC3DB, 0x9C42, 0xC3DD, - 0x9C43, 0xC3DE, 0x9C44, 0xC3E1, 0x9C45, 0xC3E3, 0x9C46, 0xC3E4, - 0x9C47, 0xC3E5, 0x9C48, 0xC3E6, 0x9C49, 0xC3E7, 0x9C4A, 0xC3EA, - 0x9C4B, 0xC3EB, 0x9C4C, 0xC3EC, 0x9C4D, 0xC3EE, 0x9C4E, 0xC3EF, - 0x9C4F, 0xC3F0, 0x9C50, 0xC3F1, 0x9C51, 0xC3F2, 0x9C52, 0xC3F3, - 0x9C53, 0xC3F6, 0x9C54, 0xC3F7, 0x9C55, 0xC3F9, 0x9C56, 0xC3FA, - 0x9C57, 0xC3FB, 0x9C58, 0xC3FC, 0x9C59, 0xC3FD, 0x9C5A, 0xC3FE, - 0x9C61, 0xC3FF, 0x9C62, 0xC400, 0x9C63, 0xC401, 0x9C64, 0xC402, - 0x9C65, 0xC403, 0x9C66, 0xC404, 0x9C67, 0xC405, 0x9C68, 0xC406, - 0x9C69, 0xC407, 0x9C6A, 0xC409, 0x9C6B, 0xC40A, 0x9C6C, 0xC40B, - 0x9C6D, 0xC40C, 0x9C6E, 0xC40D, 0x9C6F, 0xC40E, 0x9C70, 0xC40F, - 0x9C71, 0xC411, 0x9C72, 0xC412, 0x9C73, 0xC413, 0x9C74, 0xC414, - 0x9C75, 0xC415, 0x9C76, 0xC416, 0x9C77, 0xC417, 0x9C78, 0xC418, - 0x9C79, 0xC419, 0x9C7A, 0xC41A, 0x9C81, 0xC41B, 0x9C82, 0xC41C, - 0x9C83, 0xC41D, 0x9C84, 0xC41E, 0x9C85, 0xC41F, 0x9C86, 0xC420, - 0x9C87, 0xC421, 0x9C88, 0xC422, 0x9C89, 0xC423, 0x9C8A, 0xC425, - 0x9C8B, 0xC426, 0x9C8C, 0xC427, 0x9C8D, 0xC428, 0x9C8E, 0xC429, - 0x9C8F, 0xC42A, 0x9C90, 0xC42B, 0x9C91, 0xC42D, 0x9C92, 0xC42E, - 0x9C93, 0xC42F, 0x9C94, 0xC431, 0x9C95, 0xC432, 0x9C96, 0xC433, - 0x9C97, 0xC435, 0x9C98, 0xC436, 0x9C99, 0xC437, 0x9C9A, 0xC438, - 0x9C9B, 0xC439, 0x9C9C, 0xC43A, 0x9C9D, 0xC43B, 0x9C9E, 0xC43E, - 0x9C9F, 0xC43F, 0x9CA0, 0xC440, 0x9CA1, 0xC441, 0x9CA2, 0xC442, - 0x9CA3, 0xC443, 0x9CA4, 0xC444, 0x9CA5, 0xC445, 0x9CA6, 0xC446, - 0x9CA7, 0xC447, 0x9CA8, 0xC449, 0x9CA9, 0xC44A, 0x9CAA, 0xC44B, - 0x9CAB, 0xC44C, 0x9CAC, 0xC44D, 0x9CAD, 0xC44E, 0x9CAE, 0xC44F, - 0x9CAF, 0xC450, 0x9CB0, 0xC451, 0x9CB1, 0xC452, 0x9CB2, 0xC453, - 0x9CB3, 0xC454, 0x9CB4, 0xC455, 0x9CB5, 0xC456, 0x9CB6, 0xC457, - 0x9CB7, 0xC458, 0x9CB8, 0xC459, 0x9CB9, 0xC45A, 0x9CBA, 0xC45B, - 0x9CBB, 0xC45C, 0x9CBC, 0xC45D, 0x9CBD, 0xC45E, 0x9CBE, 0xC45F, - 0x9CBF, 0xC460, 0x9CC0, 0xC461, 0x9CC1, 0xC462, 0x9CC2, 0xC463, - 0x9CC3, 0xC466, 0x9CC4, 0xC467, 0x9CC5, 0xC469, 0x9CC6, 0xC46A, - 0x9CC7, 0xC46B, 0x9CC8, 0xC46D, 0x9CC9, 0xC46E, 0x9CCA, 0xC46F, - 0x9CCB, 0xC470, 0x9CCC, 0xC471, 0x9CCD, 0xC472, 0x9CCE, 0xC473, - 0x9CCF, 0xC476, 0x9CD0, 0xC477, 0x9CD1, 0xC478, 0x9CD2, 0xC47A, - 0x9CD3, 0xC47B, 0x9CD4, 0xC47C, 0x9CD5, 0xC47D, 0x9CD6, 0xC47E, - 0x9CD7, 0xC47F, 0x9CD8, 0xC481, 0x9CD9, 0xC482, 0x9CDA, 0xC483, - 0x9CDB, 0xC484, 0x9CDC, 0xC485, 0x9CDD, 0xC486, 0x9CDE, 0xC487, - 0x9CDF, 0xC488, 0x9CE0, 0xC489, 0x9CE1, 0xC48A, 0x9CE2, 0xC48B, - 0x9CE3, 0xC48C, 0x9CE4, 0xC48D, 0x9CE5, 0xC48E, 0x9CE6, 0xC48F, - 0x9CE7, 0xC490, 0x9CE8, 0xC491, 0x9CE9, 0xC492, 0x9CEA, 0xC493, - 0x9CEB, 0xC495, 0x9CEC, 0xC496, 0x9CED, 0xC497, 0x9CEE, 0xC498, - 0x9CEF, 0xC499, 0x9CF0, 0xC49A, 0x9CF1, 0xC49B, 0x9CF2, 0xC49D, - 0x9CF3, 0xC49E, 0x9CF4, 0xC49F, 0x9CF5, 0xC4A0, 0x9CF6, 0xC4A1, - 0x9CF7, 0xC4A2, 0x9CF8, 0xC4A3, 0x9CF9, 0xC4A4, 0x9CFA, 0xC4A5, - 0x9CFB, 0xC4A6, 0x9CFC, 0xC4A7, 0x9CFD, 0xC4A8, 0x9CFE, 0xC4A9, - 0x9D41, 0xC4AA, 0x9D42, 0xC4AB, 0x9D43, 0xC4AC, 0x9D44, 0xC4AD, - 0x9D45, 0xC4AE, 0x9D46, 0xC4AF, 0x9D47, 0xC4B0, 0x9D48, 0xC4B1, - 0x9D49, 0xC4B2, 0x9D4A, 0xC4B3, 0x9D4B, 0xC4B4, 0x9D4C, 0xC4B5, - 0x9D4D, 0xC4B6, 0x9D4E, 0xC4B7, 0x9D4F, 0xC4B9, 0x9D50, 0xC4BA, - 0x9D51, 0xC4BB, 0x9D52, 0xC4BD, 0x9D53, 0xC4BE, 0x9D54, 0xC4BF, - 0x9D55, 0xC4C0, 0x9D56, 0xC4C1, 0x9D57, 0xC4C2, 0x9D58, 0xC4C3, - 0x9D59, 0xC4C4, 0x9D5A, 0xC4C5, 0x9D61, 0xC4C6, 0x9D62, 0xC4C7, - 0x9D63, 0xC4C8, 0x9D64, 0xC4C9, 0x9D65, 0xC4CA, 0x9D66, 0xC4CB, - 0x9D67, 0xC4CC, 0x9D68, 0xC4CD, 0x9D69, 0xC4CE, 0x9D6A, 0xC4CF, - 0x9D6B, 0xC4D0, 0x9D6C, 0xC4D1, 0x9D6D, 0xC4D2, 0x9D6E, 0xC4D3, - 0x9D6F, 0xC4D4, 0x9D70, 0xC4D5, 0x9D71, 0xC4D6, 0x9D72, 0xC4D7, - 0x9D73, 0xC4D8, 0x9D74, 0xC4D9, 0x9D75, 0xC4DA, 0x9D76, 0xC4DB, - 0x9D77, 0xC4DC, 0x9D78, 0xC4DD, 0x9D79, 0xC4DE, 0x9D7A, 0xC4DF, - 0x9D81, 0xC4E0, 0x9D82, 0xC4E1, 0x9D83, 0xC4E2, 0x9D84, 0xC4E3, - 0x9D85, 0xC4E4, 0x9D86, 0xC4E5, 0x9D87, 0xC4E6, 0x9D88, 0xC4E7, - 0x9D89, 0xC4E8, 0x9D8A, 0xC4EA, 0x9D8B, 0xC4EB, 0x9D8C, 0xC4EC, - 0x9D8D, 0xC4ED, 0x9D8E, 0xC4EE, 0x9D8F, 0xC4EF, 0x9D90, 0xC4F2, - 0x9D91, 0xC4F3, 0x9D92, 0xC4F5, 0x9D93, 0xC4F6, 0x9D94, 0xC4F7, - 0x9D95, 0xC4F9, 0x9D96, 0xC4FB, 0x9D97, 0xC4FC, 0x9D98, 0xC4FD, - 0x9D99, 0xC4FE, 0x9D9A, 0xC502, 0x9D9B, 0xC503, 0x9D9C, 0xC504, - 0x9D9D, 0xC505, 0x9D9E, 0xC506, 0x9D9F, 0xC507, 0x9DA0, 0xC508, - 0x9DA1, 0xC509, 0x9DA2, 0xC50A, 0x9DA3, 0xC50B, 0x9DA4, 0xC50D, - 0x9DA5, 0xC50E, 0x9DA6, 0xC50F, 0x9DA7, 0xC511, 0x9DA8, 0xC512, - 0x9DA9, 0xC513, 0x9DAA, 0xC515, 0x9DAB, 0xC516, 0x9DAC, 0xC517, - 0x9DAD, 0xC518, 0x9DAE, 0xC519, 0x9DAF, 0xC51A, 0x9DB0, 0xC51B, - 0x9DB1, 0xC51D, 0x9DB2, 0xC51E, 0x9DB3, 0xC51F, 0x9DB4, 0xC520, - 0x9DB5, 0xC521, 0x9DB6, 0xC522, 0x9DB7, 0xC523, 0x9DB8, 0xC524, - 0x9DB9, 0xC525, 0x9DBA, 0xC526, 0x9DBB, 0xC527, 0x9DBC, 0xC52A, - 0x9DBD, 0xC52B, 0x9DBE, 0xC52D, 0x9DBF, 0xC52E, 0x9DC0, 0xC52F, - 0x9DC1, 0xC531, 0x9DC2, 0xC532, 0x9DC3, 0xC533, 0x9DC4, 0xC534, - 0x9DC5, 0xC535, 0x9DC6, 0xC536, 0x9DC7, 0xC537, 0x9DC8, 0xC53A, - 0x9DC9, 0xC53C, 0x9DCA, 0xC53E, 0x9DCB, 0xC53F, 0x9DCC, 0xC540, - 0x9DCD, 0xC541, 0x9DCE, 0xC542, 0x9DCF, 0xC543, 0x9DD0, 0xC546, - 0x9DD1, 0xC547, 0x9DD2, 0xC54B, 0x9DD3, 0xC54F, 0x9DD4, 0xC550, - 0x9DD5, 0xC551, 0x9DD6, 0xC552, 0x9DD7, 0xC556, 0x9DD8, 0xC55A, - 0x9DD9, 0xC55B, 0x9DDA, 0xC55C, 0x9DDB, 0xC55F, 0x9DDC, 0xC562, - 0x9DDD, 0xC563, 0x9DDE, 0xC565, 0x9DDF, 0xC566, 0x9DE0, 0xC567, - 0x9DE1, 0xC569, 0x9DE2, 0xC56A, 0x9DE3, 0xC56B, 0x9DE4, 0xC56C, - 0x9DE5, 0xC56D, 0x9DE6, 0xC56E, 0x9DE7, 0xC56F, 0x9DE8, 0xC572, - 0x9DE9, 0xC576, 0x9DEA, 0xC577, 0x9DEB, 0xC578, 0x9DEC, 0xC579, - 0x9DED, 0xC57A, 0x9DEE, 0xC57B, 0x9DEF, 0xC57E, 0x9DF0, 0xC57F, - 0x9DF1, 0xC581, 0x9DF2, 0xC582, 0x9DF3, 0xC583, 0x9DF4, 0xC585, - 0x9DF5, 0xC586, 0x9DF6, 0xC588, 0x9DF7, 0xC589, 0x9DF8, 0xC58A, - 0x9DF9, 0xC58B, 0x9DFA, 0xC58E, 0x9DFB, 0xC590, 0x9DFC, 0xC592, - 0x9DFD, 0xC593, 0x9DFE, 0xC594, 0x9E41, 0xC596, 0x9E42, 0xC599, - 0x9E43, 0xC59A, 0x9E44, 0xC59B, 0x9E45, 0xC59D, 0x9E46, 0xC59E, - 0x9E47, 0xC59F, 0x9E48, 0xC5A1, 0x9E49, 0xC5A2, 0x9E4A, 0xC5A3, - 0x9E4B, 0xC5A4, 0x9E4C, 0xC5A5, 0x9E4D, 0xC5A6, 0x9E4E, 0xC5A7, - 0x9E4F, 0xC5A8, 0x9E50, 0xC5AA, 0x9E51, 0xC5AB, 0x9E52, 0xC5AC, - 0x9E53, 0xC5AD, 0x9E54, 0xC5AE, 0x9E55, 0xC5AF, 0x9E56, 0xC5B0, - 0x9E57, 0xC5B1, 0x9E58, 0xC5B2, 0x9E59, 0xC5B3, 0x9E5A, 0xC5B6, - 0x9E61, 0xC5B7, 0x9E62, 0xC5BA, 0x9E63, 0xC5BF, 0x9E64, 0xC5C0, - 0x9E65, 0xC5C1, 0x9E66, 0xC5C2, 0x9E67, 0xC5C3, 0x9E68, 0xC5CB, - 0x9E69, 0xC5CD, 0x9E6A, 0xC5CF, 0x9E6B, 0xC5D2, 0x9E6C, 0xC5D3, - 0x9E6D, 0xC5D5, 0x9E6E, 0xC5D6, 0x9E6F, 0xC5D7, 0x9E70, 0xC5D9, - 0x9E71, 0xC5DA, 0x9E72, 0xC5DB, 0x9E73, 0xC5DC, 0x9E74, 0xC5DD, - 0x9E75, 0xC5DE, 0x9E76, 0xC5DF, 0x9E77, 0xC5E2, 0x9E78, 0xC5E4, - 0x9E79, 0xC5E6, 0x9E7A, 0xC5E7, 0x9E81, 0xC5E8, 0x9E82, 0xC5E9, - 0x9E83, 0xC5EA, 0x9E84, 0xC5EB, 0x9E85, 0xC5EF, 0x9E86, 0xC5F1, - 0x9E87, 0xC5F2, 0x9E88, 0xC5F3, 0x9E89, 0xC5F5, 0x9E8A, 0xC5F8, - 0x9E8B, 0xC5F9, 0x9E8C, 0xC5FA, 0x9E8D, 0xC5FB, 0x9E8E, 0xC602, - 0x9E8F, 0xC603, 0x9E90, 0xC604, 0x9E91, 0xC609, 0x9E92, 0xC60A, - 0x9E93, 0xC60B, 0x9E94, 0xC60D, 0x9E95, 0xC60E, 0x9E96, 0xC60F, - 0x9E97, 0xC611, 0x9E98, 0xC612, 0x9E99, 0xC613, 0x9E9A, 0xC614, - 0x9E9B, 0xC615, 0x9E9C, 0xC616, 0x9E9D, 0xC617, 0x9E9E, 0xC61A, - 0x9E9F, 0xC61D, 0x9EA0, 0xC61E, 0x9EA1, 0xC61F, 0x9EA2, 0xC620, - 0x9EA3, 0xC621, 0x9EA4, 0xC622, 0x9EA5, 0xC623, 0x9EA6, 0xC626, - 0x9EA7, 0xC627, 0x9EA8, 0xC629, 0x9EA9, 0xC62A, 0x9EAA, 0xC62B, - 0x9EAB, 0xC62F, 0x9EAC, 0xC631, 0x9EAD, 0xC632, 0x9EAE, 0xC636, - 0x9EAF, 0xC638, 0x9EB0, 0xC63A, 0x9EB1, 0xC63C, 0x9EB2, 0xC63D, - 0x9EB3, 0xC63E, 0x9EB4, 0xC63F, 0x9EB5, 0xC642, 0x9EB6, 0xC643, - 0x9EB7, 0xC645, 0x9EB8, 0xC646, 0x9EB9, 0xC647, 0x9EBA, 0xC649, - 0x9EBB, 0xC64A, 0x9EBC, 0xC64B, 0x9EBD, 0xC64C, 0x9EBE, 0xC64D, - 0x9EBF, 0xC64E, 0x9EC0, 0xC64F, 0x9EC1, 0xC652, 0x9EC2, 0xC656, - 0x9EC3, 0xC657, 0x9EC4, 0xC658, 0x9EC5, 0xC659, 0x9EC6, 0xC65A, - 0x9EC7, 0xC65B, 0x9EC8, 0xC65E, 0x9EC9, 0xC65F, 0x9ECA, 0xC661, - 0x9ECB, 0xC662, 0x9ECC, 0xC663, 0x9ECD, 0xC664, 0x9ECE, 0xC665, - 0x9ECF, 0xC666, 0x9ED0, 0xC667, 0x9ED1, 0xC668, 0x9ED2, 0xC669, - 0x9ED3, 0xC66A, 0x9ED4, 0xC66B, 0x9ED5, 0xC66D, 0x9ED6, 0xC66E, - 0x9ED7, 0xC670, 0x9ED8, 0xC672, 0x9ED9, 0xC673, 0x9EDA, 0xC674, - 0x9EDB, 0xC675, 0x9EDC, 0xC676, 0x9EDD, 0xC677, 0x9EDE, 0xC67A, - 0x9EDF, 0xC67B, 0x9EE0, 0xC67D, 0x9EE1, 0xC67E, 0x9EE2, 0xC67F, - 0x9EE3, 0xC681, 0x9EE4, 0xC682, 0x9EE5, 0xC683, 0x9EE6, 0xC684, - 0x9EE7, 0xC685, 0x9EE8, 0xC686, 0x9EE9, 0xC687, 0x9EEA, 0xC68A, - 0x9EEB, 0xC68C, 0x9EEC, 0xC68E, 0x9EED, 0xC68F, 0x9EEE, 0xC690, - 0x9EEF, 0xC691, 0x9EF0, 0xC692, 0x9EF1, 0xC693, 0x9EF2, 0xC696, - 0x9EF3, 0xC697, 0x9EF4, 0xC699, 0x9EF5, 0xC69A, 0x9EF6, 0xC69B, - 0x9EF7, 0xC69D, 0x9EF8, 0xC69E, 0x9EF9, 0xC69F, 0x9EFA, 0xC6A0, - 0x9EFB, 0xC6A1, 0x9EFC, 0xC6A2, 0x9EFD, 0xC6A3, 0x9EFE, 0xC6A6, - 0x9F41, 0xC6A8, 0x9F42, 0xC6AA, 0x9F43, 0xC6AB, 0x9F44, 0xC6AC, - 0x9F45, 0xC6AD, 0x9F46, 0xC6AE, 0x9F47, 0xC6AF, 0x9F48, 0xC6B2, - 0x9F49, 0xC6B3, 0x9F4A, 0xC6B5, 0x9F4B, 0xC6B6, 0x9F4C, 0xC6B7, - 0x9F4D, 0xC6BB, 0x9F4E, 0xC6BC, 0x9F4F, 0xC6BD, 0x9F50, 0xC6BE, - 0x9F51, 0xC6BF, 0x9F52, 0xC6C2, 0x9F53, 0xC6C4, 0x9F54, 0xC6C6, - 0x9F55, 0xC6C7, 0x9F56, 0xC6C8, 0x9F57, 0xC6C9, 0x9F58, 0xC6CA, - 0x9F59, 0xC6CB, 0x9F5A, 0xC6CE, 0x9F61, 0xC6CF, 0x9F62, 0xC6D1, - 0x9F63, 0xC6D2, 0x9F64, 0xC6D3, 0x9F65, 0xC6D5, 0x9F66, 0xC6D6, - 0x9F67, 0xC6D7, 0x9F68, 0xC6D8, 0x9F69, 0xC6D9, 0x9F6A, 0xC6DA, - 0x9F6B, 0xC6DB, 0x9F6C, 0xC6DE, 0x9F6D, 0xC6DF, 0x9F6E, 0xC6E2, - 0x9F6F, 0xC6E3, 0x9F70, 0xC6E4, 0x9F71, 0xC6E5, 0x9F72, 0xC6E6, - 0x9F73, 0xC6E7, 0x9F74, 0xC6EA, 0x9F75, 0xC6EB, 0x9F76, 0xC6ED, - 0x9F77, 0xC6EE, 0x9F78, 0xC6EF, 0x9F79, 0xC6F1, 0x9F7A, 0xC6F2, - 0x9F81, 0xC6F3, 0x9F82, 0xC6F4, 0x9F83, 0xC6F5, 0x9F84, 0xC6F6, - 0x9F85, 0xC6F7, 0x9F86, 0xC6FA, 0x9F87, 0xC6FB, 0x9F88, 0xC6FC, - 0x9F89, 0xC6FE, 0x9F8A, 0xC6FF, 0x9F8B, 0xC700, 0x9F8C, 0xC701, - 0x9F8D, 0xC702, 0x9F8E, 0xC703, 0x9F8F, 0xC706, 0x9F90, 0xC707, - 0x9F91, 0xC709, 0x9F92, 0xC70A, 0x9F93, 0xC70B, 0x9F94, 0xC70D, - 0x9F95, 0xC70E, 0x9F96, 0xC70F, 0x9F97, 0xC710, 0x9F98, 0xC711, - 0x9F99, 0xC712, 0x9F9A, 0xC713, 0x9F9B, 0xC716, 0x9F9C, 0xC718, - 0x9F9D, 0xC71A, 0x9F9E, 0xC71B, 0x9F9F, 0xC71C, 0x9FA0, 0xC71D, - 0x9FA1, 0xC71E, 0x9FA2, 0xC71F, 0x9FA3, 0xC722, 0x9FA4, 0xC723, - 0x9FA5, 0xC725, 0x9FA6, 0xC726, 0x9FA7, 0xC727, 0x9FA8, 0xC729, - 0x9FA9, 0xC72A, 0x9FAA, 0xC72B, 0x9FAB, 0xC72C, 0x9FAC, 0xC72D, - 0x9FAD, 0xC72E, 0x9FAE, 0xC72F, 0x9FAF, 0xC732, 0x9FB0, 0xC734, - 0x9FB1, 0xC736, 0x9FB2, 0xC738, 0x9FB3, 0xC739, 0x9FB4, 0xC73A, - 0x9FB5, 0xC73B, 0x9FB6, 0xC73E, 0x9FB7, 0xC73F, 0x9FB8, 0xC741, - 0x9FB9, 0xC742, 0x9FBA, 0xC743, 0x9FBB, 0xC745, 0x9FBC, 0xC746, - 0x9FBD, 0xC747, 0x9FBE, 0xC748, 0x9FBF, 0xC749, 0x9FC0, 0xC74B, - 0x9FC1, 0xC74E, 0x9FC2, 0xC750, 0x9FC3, 0xC759, 0x9FC4, 0xC75A, - 0x9FC5, 0xC75B, 0x9FC6, 0xC75D, 0x9FC7, 0xC75E, 0x9FC8, 0xC75F, - 0x9FC9, 0xC761, 0x9FCA, 0xC762, 0x9FCB, 0xC763, 0x9FCC, 0xC764, - 0x9FCD, 0xC765, 0x9FCE, 0xC766, 0x9FCF, 0xC767, 0x9FD0, 0xC769, - 0x9FD1, 0xC76A, 0x9FD2, 0xC76C, 0x9FD3, 0xC76D, 0x9FD4, 0xC76E, - 0x9FD5, 0xC76F, 0x9FD6, 0xC770, 0x9FD7, 0xC771, 0x9FD8, 0xC772, - 0x9FD9, 0xC773, 0x9FDA, 0xC776, 0x9FDB, 0xC777, 0x9FDC, 0xC779, - 0x9FDD, 0xC77A, 0x9FDE, 0xC77B, 0x9FDF, 0xC77F, 0x9FE0, 0xC780, - 0x9FE1, 0xC781, 0x9FE2, 0xC782, 0x9FE3, 0xC786, 0x9FE4, 0xC78B, - 0x9FE5, 0xC78C, 0x9FE6, 0xC78D, 0x9FE7, 0xC78F, 0x9FE8, 0xC792, - 0x9FE9, 0xC793, 0x9FEA, 0xC795, 0x9FEB, 0xC799, 0x9FEC, 0xC79B, - 0x9FED, 0xC79C, 0x9FEE, 0xC79D, 0x9FEF, 0xC79E, 0x9FF0, 0xC79F, - 0x9FF1, 0xC7A2, 0x9FF2, 0xC7A7, 0x9FF3, 0xC7A8, 0x9FF4, 0xC7A9, - 0x9FF5, 0xC7AA, 0x9FF6, 0xC7AB, 0x9FF7, 0xC7AE, 0x9FF8, 0xC7AF, - 0x9FF9, 0xC7B1, 0x9FFA, 0xC7B2, 0x9FFB, 0xC7B3, 0x9FFC, 0xC7B5, - 0x9FFD, 0xC7B6, 0x9FFE, 0xC7B7, 0xA041, 0xC7B8, 0xA042, 0xC7B9, - 0xA043, 0xC7BA, 0xA044, 0xC7BB, 0xA045, 0xC7BE, 0xA046, 0xC7C2, - 0xA047, 0xC7C3, 0xA048, 0xC7C4, 0xA049, 0xC7C5, 0xA04A, 0xC7C6, - 0xA04B, 0xC7C7, 0xA04C, 0xC7CA, 0xA04D, 0xC7CB, 0xA04E, 0xC7CD, - 0xA04F, 0xC7CF, 0xA050, 0xC7D1, 0xA051, 0xC7D2, 0xA052, 0xC7D3, - 0xA053, 0xC7D4, 0xA054, 0xC7D5, 0xA055, 0xC7D6, 0xA056, 0xC7D7, - 0xA057, 0xC7D9, 0xA058, 0xC7DA, 0xA059, 0xC7DB, 0xA05A, 0xC7DC, - 0xA061, 0xC7DE, 0xA062, 0xC7DF, 0xA063, 0xC7E0, 0xA064, 0xC7E1, - 0xA065, 0xC7E2, 0xA066, 0xC7E3, 0xA067, 0xC7E5, 0xA068, 0xC7E6, - 0xA069, 0xC7E7, 0xA06A, 0xC7E9, 0xA06B, 0xC7EA, 0xA06C, 0xC7EB, - 0xA06D, 0xC7ED, 0xA06E, 0xC7EE, 0xA06F, 0xC7EF, 0xA070, 0xC7F0, - 0xA071, 0xC7F1, 0xA072, 0xC7F2, 0xA073, 0xC7F3, 0xA074, 0xC7F4, - 0xA075, 0xC7F5, 0xA076, 0xC7F6, 0xA077, 0xC7F7, 0xA078, 0xC7F8, - 0xA079, 0xC7F9, 0xA07A, 0xC7FA, 0xA081, 0xC7FB, 0xA082, 0xC7FC, - 0xA083, 0xC7FD, 0xA084, 0xC7FE, 0xA085, 0xC7FF, 0xA086, 0xC802, - 0xA087, 0xC803, 0xA088, 0xC805, 0xA089, 0xC806, 0xA08A, 0xC807, - 0xA08B, 0xC809, 0xA08C, 0xC80B, 0xA08D, 0xC80C, 0xA08E, 0xC80D, - 0xA08F, 0xC80E, 0xA090, 0xC80F, 0xA091, 0xC812, 0xA092, 0xC814, - 0xA093, 0xC817, 0xA094, 0xC818, 0xA095, 0xC819, 0xA096, 0xC81A, - 0xA097, 0xC81B, 0xA098, 0xC81E, 0xA099, 0xC81F, 0xA09A, 0xC821, - 0xA09B, 0xC822, 0xA09C, 0xC823, 0xA09D, 0xC825, 0xA09E, 0xC826, - 0xA09F, 0xC827, 0xA0A0, 0xC828, 0xA0A1, 0xC829, 0xA0A2, 0xC82A, - 0xA0A3, 0xC82B, 0xA0A4, 0xC82E, 0xA0A5, 0xC830, 0xA0A6, 0xC832, - 0xA0A7, 0xC833, 0xA0A8, 0xC834, 0xA0A9, 0xC835, 0xA0AA, 0xC836, - 0xA0AB, 0xC837, 0xA0AC, 0xC839, 0xA0AD, 0xC83A, 0xA0AE, 0xC83B, - 0xA0AF, 0xC83D, 0xA0B0, 0xC83E, 0xA0B1, 0xC83F, 0xA0B2, 0xC841, - 0xA0B3, 0xC842, 0xA0B4, 0xC843, 0xA0B5, 0xC844, 0xA0B6, 0xC845, - 0xA0B7, 0xC846, 0xA0B8, 0xC847, 0xA0B9, 0xC84A, 0xA0BA, 0xC84B, - 0xA0BB, 0xC84E, 0xA0BC, 0xC84F, 0xA0BD, 0xC850, 0xA0BE, 0xC851, - 0xA0BF, 0xC852, 0xA0C0, 0xC853, 0xA0C1, 0xC855, 0xA0C2, 0xC856, - 0xA0C3, 0xC857, 0xA0C4, 0xC858, 0xA0C5, 0xC859, 0xA0C6, 0xC85A, - 0xA0C7, 0xC85B, 0xA0C8, 0xC85C, 0xA0C9, 0xC85D, 0xA0CA, 0xC85E, - 0xA0CB, 0xC85F, 0xA0CC, 0xC860, 0xA0CD, 0xC861, 0xA0CE, 0xC862, - 0xA0CF, 0xC863, 0xA0D0, 0xC864, 0xA0D1, 0xC865, 0xA0D2, 0xC866, - 0xA0D3, 0xC867, 0xA0D4, 0xC868, 0xA0D5, 0xC869, 0xA0D6, 0xC86A, - 0xA0D7, 0xC86B, 0xA0D8, 0xC86C, 0xA0D9, 0xC86D, 0xA0DA, 0xC86E, - 0xA0DB, 0xC86F, 0xA0DC, 0xC872, 0xA0DD, 0xC873, 0xA0DE, 0xC875, - 0xA0DF, 0xC876, 0xA0E0, 0xC877, 0xA0E1, 0xC879, 0xA0E2, 0xC87B, - 0xA0E3, 0xC87C, 0xA0E4, 0xC87D, 0xA0E5, 0xC87E, 0xA0E6, 0xC87F, - 0xA0E7, 0xC882, 0xA0E8, 0xC884, 0xA0E9, 0xC888, 0xA0EA, 0xC889, - 0xA0EB, 0xC88A, 0xA0EC, 0xC88E, 0xA0ED, 0xC88F, 0xA0EE, 0xC890, - 0xA0EF, 0xC891, 0xA0F0, 0xC892, 0xA0F1, 0xC893, 0xA0F2, 0xC895, - 0xA0F3, 0xC896, 0xA0F4, 0xC897, 0xA0F5, 0xC898, 0xA0F6, 0xC899, - 0xA0F7, 0xC89A, 0xA0F8, 0xC89B, 0xA0F9, 0xC89C, 0xA0FA, 0xC89E, - 0xA0FB, 0xC8A0, 0xA0FC, 0xC8A2, 0xA0FD, 0xC8A3, 0xA0FE, 0xC8A4, - 0xA141, 0xC8A5, 0xA142, 0xC8A6, 0xA143, 0xC8A7, 0xA144, 0xC8A9, - 0xA145, 0xC8AA, 0xA146, 0xC8AB, 0xA147, 0xC8AC, 0xA148, 0xC8AD, - 0xA149, 0xC8AE, 0xA14A, 0xC8AF, 0xA14B, 0xC8B0, 0xA14C, 0xC8B1, - 0xA14D, 0xC8B2, 0xA14E, 0xC8B3, 0xA14F, 0xC8B4, 0xA150, 0xC8B5, - 0xA151, 0xC8B6, 0xA152, 0xC8B7, 0xA153, 0xC8B8, 0xA154, 0xC8B9, - 0xA155, 0xC8BA, 0xA156, 0xC8BB, 0xA157, 0xC8BE, 0xA158, 0xC8BF, - 0xA159, 0xC8C0, 0xA15A, 0xC8C1, 0xA161, 0xC8C2, 0xA162, 0xC8C3, - 0xA163, 0xC8C5, 0xA164, 0xC8C6, 0xA165, 0xC8C7, 0xA166, 0xC8C9, - 0xA167, 0xC8CA, 0xA168, 0xC8CB, 0xA169, 0xC8CD, 0xA16A, 0xC8CE, - 0xA16B, 0xC8CF, 0xA16C, 0xC8D0, 0xA16D, 0xC8D1, 0xA16E, 0xC8D2, - 0xA16F, 0xC8D3, 0xA170, 0xC8D6, 0xA171, 0xC8D8, 0xA172, 0xC8DA, - 0xA173, 0xC8DB, 0xA174, 0xC8DC, 0xA175, 0xC8DD, 0xA176, 0xC8DE, - 0xA177, 0xC8DF, 0xA178, 0xC8E2, 0xA179, 0xC8E3, 0xA17A, 0xC8E5, - 0xA181, 0xC8E6, 0xA182, 0xC8E7, 0xA183, 0xC8E8, 0xA184, 0xC8E9, - 0xA185, 0xC8EA, 0xA186, 0xC8EB, 0xA187, 0xC8EC, 0xA188, 0xC8ED, - 0xA189, 0xC8EE, 0xA18A, 0xC8EF, 0xA18B, 0xC8F0, 0xA18C, 0xC8F1, - 0xA18D, 0xC8F2, 0xA18E, 0xC8F3, 0xA18F, 0xC8F4, 0xA190, 0xC8F6, - 0xA191, 0xC8F7, 0xA192, 0xC8F8, 0xA193, 0xC8F9, 0xA194, 0xC8FA, - 0xA195, 0xC8FB, 0xA196, 0xC8FE, 0xA197, 0xC8FF, 0xA198, 0xC901, - 0xA199, 0xC902, 0xA19A, 0xC903, 0xA19B, 0xC907, 0xA19C, 0xC908, - 0xA19D, 0xC909, 0xA19E, 0xC90A, 0xA19F, 0xC90B, 0xA1A0, 0xC90E, - 0xA1A1, 0x3000, 0xA1A2, 0x3001, 0xA1A3, 0x3002, 0xA1A4, 0x00B7, - 0xA1A5, 0x2025, 0xA1A6, 0x2026, 0xA1A7, 0x00A8, 0xA1A8, 0x3003, - 0xA1A9, 0x00AD, 0xA1AA, 0x2015, 0xA1AB, 0x2225, 0xA1AC, 0xFF3C, - 0xA1AD, 0x223C, 0xA1AE, 0x2018, 0xA1AF, 0x2019, 0xA1B0, 0x201C, - 0xA1B1, 0x201D, 0xA1B2, 0x3014, 0xA1B3, 0x3015, 0xA1B4, 0x3008, - 0xA1B5, 0x3009, 0xA1B6, 0x300A, 0xA1B7, 0x300B, 0xA1B8, 0x300C, - 0xA1B9, 0x300D, 0xA1BA, 0x300E, 0xA1BB, 0x300F, 0xA1BC, 0x3010, - 0xA1BD, 0x3011, 0xA1BE, 0x00B1, 0xA1BF, 0x00D7, 0xA1C0, 0x00F7, - 0xA1C1, 0x2260, 0xA1C2, 0x2264, 0xA1C3, 0x2265, 0xA1C4, 0x221E, - 0xA1C5, 0x2234, 0xA1C6, 0x00B0, 0xA1C7, 0x2032, 0xA1C8, 0x2033, - 0xA1C9, 0x2103, 0xA1CA, 0x212B, 0xA1CB, 0xFFE0, 0xA1CC, 0xFFE1, - 0xA1CD, 0xFFE5, 0xA1CE, 0x2642, 0xA1CF, 0x2640, 0xA1D0, 0x2220, - 0xA1D1, 0x22A5, 0xA1D2, 0x2312, 0xA1D3, 0x2202, 0xA1D4, 0x2207, - 0xA1D5, 0x2261, 0xA1D6, 0x2252, 0xA1D7, 0x00A7, 0xA1D8, 0x203B, - 0xA1D9, 0x2606, 0xA1DA, 0x2605, 0xA1DB, 0x25CB, 0xA1DC, 0x25CF, - 0xA1DD, 0x25CE, 0xA1DE, 0x25C7, 0xA1DF, 0x25C6, 0xA1E0, 0x25A1, - 0xA1E1, 0x25A0, 0xA1E2, 0x25B3, 0xA1E3, 0x25B2, 0xA1E4, 0x25BD, - 0xA1E5, 0x25BC, 0xA1E6, 0x2192, 0xA1E7, 0x2190, 0xA1E8, 0x2191, - 0xA1E9, 0x2193, 0xA1EA, 0x2194, 0xA1EB, 0x3013, 0xA1EC, 0x226A, - 0xA1ED, 0x226B, 0xA1EE, 0x221A, 0xA1EF, 0x223D, 0xA1F0, 0x221D, - 0xA1F1, 0x2235, 0xA1F2, 0x222B, 0xA1F3, 0x222C, 0xA1F4, 0x2208, - 0xA1F5, 0x220B, 0xA1F6, 0x2286, 0xA1F7, 0x2287, 0xA1F8, 0x2282, - 0xA1F9, 0x2283, 0xA1FA, 0x222A, 0xA1FB, 0x2229, 0xA1FC, 0x2227, - 0xA1FD, 0x2228, 0xA1FE, 0xFFE2, 0xA241, 0xC910, 0xA242, 0xC912, - 0xA243, 0xC913, 0xA244, 0xC914, 0xA245, 0xC915, 0xA246, 0xC916, - 0xA247, 0xC917, 0xA248, 0xC919, 0xA249, 0xC91A, 0xA24A, 0xC91B, - 0xA24B, 0xC91C, 0xA24C, 0xC91D, 0xA24D, 0xC91E, 0xA24E, 0xC91F, - 0xA24F, 0xC920, 0xA250, 0xC921, 0xA251, 0xC922, 0xA252, 0xC923, - 0xA253, 0xC924, 0xA254, 0xC925, 0xA255, 0xC926, 0xA256, 0xC927, - 0xA257, 0xC928, 0xA258, 0xC929, 0xA259, 0xC92A, 0xA25A, 0xC92B, - 0xA261, 0xC92D, 0xA262, 0xC92E, 0xA263, 0xC92F, 0xA264, 0xC930, - 0xA265, 0xC931, 0xA266, 0xC932, 0xA267, 0xC933, 0xA268, 0xC935, - 0xA269, 0xC936, 0xA26A, 0xC937, 0xA26B, 0xC938, 0xA26C, 0xC939, - 0xA26D, 0xC93A, 0xA26E, 0xC93B, 0xA26F, 0xC93C, 0xA270, 0xC93D, - 0xA271, 0xC93E, 0xA272, 0xC93F, 0xA273, 0xC940, 0xA274, 0xC941, - 0xA275, 0xC942, 0xA276, 0xC943, 0xA277, 0xC944, 0xA278, 0xC945, - 0xA279, 0xC946, 0xA27A, 0xC947, 0xA281, 0xC948, 0xA282, 0xC949, - 0xA283, 0xC94A, 0xA284, 0xC94B, 0xA285, 0xC94C, 0xA286, 0xC94D, - 0xA287, 0xC94E, 0xA288, 0xC94F, 0xA289, 0xC952, 0xA28A, 0xC953, - 0xA28B, 0xC955, 0xA28C, 0xC956, 0xA28D, 0xC957, 0xA28E, 0xC959, - 0xA28F, 0xC95A, 0xA290, 0xC95B, 0xA291, 0xC95C, 0xA292, 0xC95D, - 0xA293, 0xC95E, 0xA294, 0xC95F, 0xA295, 0xC962, 0xA296, 0xC964, - 0xA297, 0xC965, 0xA298, 0xC966, 0xA299, 0xC967, 0xA29A, 0xC968, - 0xA29B, 0xC969, 0xA29C, 0xC96A, 0xA29D, 0xC96B, 0xA29E, 0xC96D, - 0xA29F, 0xC96E, 0xA2A0, 0xC96F, 0xA2A1, 0x21D2, 0xA2A2, 0x21D4, - 0xA2A3, 0x2200, 0xA2A4, 0x2203, 0xA2A5, 0x00B4, 0xA2A6, 0xFF5E, - 0xA2A7, 0x02C7, 0xA2A8, 0x02D8, 0xA2A9, 0x02DD, 0xA2AA, 0x02DA, - 0xA2AB, 0x02D9, 0xA2AC, 0x00B8, 0xA2AD, 0x02DB, 0xA2AE, 0x00A1, - 0xA2AF, 0x00BF, 0xA2B0, 0x02D0, 0xA2B1, 0x222E, 0xA2B2, 0x2211, - 0xA2B3, 0x220F, 0xA2B4, 0x00A4, 0xA2B5, 0x2109, 0xA2B6, 0x2030, - 0xA2B7, 0x25C1, 0xA2B8, 0x25C0, 0xA2B9, 0x25B7, 0xA2BA, 0x25B6, - 0xA2BB, 0x2664, 0xA2BC, 0x2660, 0xA2BD, 0x2661, 0xA2BE, 0x2665, - 0xA2BF, 0x2667, 0xA2C0, 0x2663, 0xA2C1, 0x2299, 0xA2C2, 0x25C8, - 0xA2C3, 0x25A3, 0xA2C4, 0x25D0, 0xA2C5, 0x25D1, 0xA2C6, 0x2592, - 0xA2C7, 0x25A4, 0xA2C8, 0x25A5, 0xA2C9, 0x25A8, 0xA2CA, 0x25A7, - 0xA2CB, 0x25A6, 0xA2CC, 0x25A9, 0xA2CD, 0x2668, 0xA2CE, 0x260F, - 0xA2CF, 0x260E, 0xA2D0, 0x261C, 0xA2D1, 0x261E, 0xA2D2, 0x00B6, - 0xA2D3, 0x2020, 0xA2D4, 0x2021, 0xA2D5, 0x2195, 0xA2D6, 0x2197, - 0xA2D7, 0x2199, 0xA2D8, 0x2196, 0xA2D9, 0x2198, 0xA2DA, 0x266D, - 0xA2DB, 0x2669, 0xA2DC, 0x266A, 0xA2DD, 0x266C, 0xA2DE, 0x327F, - 0xA2DF, 0x321C, 0xA2E0, 0x2116, 0xA2E1, 0x33C7, 0xA2E2, 0x2122, - 0xA2E3, 0x33C2, 0xA2E4, 0x33D8, 0xA2E5, 0x2121, 0xA2E6, 0x20AC, - 0xA2E7, 0x00AE, 0xA341, 0xC971, 0xA342, 0xC972, 0xA343, 0xC973, - 0xA344, 0xC975, 0xA345, 0xC976, 0xA346, 0xC977, 0xA347, 0xC978, - 0xA348, 0xC979, 0xA349, 0xC97A, 0xA34A, 0xC97B, 0xA34B, 0xC97D, - 0xA34C, 0xC97E, 0xA34D, 0xC97F, 0xA34E, 0xC980, 0xA34F, 0xC981, - 0xA350, 0xC982, 0xA351, 0xC983, 0xA352, 0xC984, 0xA353, 0xC985, - 0xA354, 0xC986, 0xA355, 0xC987, 0xA356, 0xC98A, 0xA357, 0xC98B, - 0xA358, 0xC98D, 0xA359, 0xC98E, 0xA35A, 0xC98F, 0xA361, 0xC991, - 0xA362, 0xC992, 0xA363, 0xC993, 0xA364, 0xC994, 0xA365, 0xC995, - 0xA366, 0xC996, 0xA367, 0xC997, 0xA368, 0xC99A, 0xA369, 0xC99C, - 0xA36A, 0xC99E, 0xA36B, 0xC99F, 0xA36C, 0xC9A0, 0xA36D, 0xC9A1, - 0xA36E, 0xC9A2, 0xA36F, 0xC9A3, 0xA370, 0xC9A4, 0xA371, 0xC9A5, - 0xA372, 0xC9A6, 0xA373, 0xC9A7, 0xA374, 0xC9A8, 0xA375, 0xC9A9, - 0xA376, 0xC9AA, 0xA377, 0xC9AB, 0xA378, 0xC9AC, 0xA379, 0xC9AD, - 0xA37A, 0xC9AE, 0xA381, 0xC9AF, 0xA382, 0xC9B0, 0xA383, 0xC9B1, - 0xA384, 0xC9B2, 0xA385, 0xC9B3, 0xA386, 0xC9B4, 0xA387, 0xC9B5, - 0xA388, 0xC9B6, 0xA389, 0xC9B7, 0xA38A, 0xC9B8, 0xA38B, 0xC9B9, - 0xA38C, 0xC9BA, 0xA38D, 0xC9BB, 0xA38E, 0xC9BC, 0xA38F, 0xC9BD, - 0xA390, 0xC9BE, 0xA391, 0xC9BF, 0xA392, 0xC9C2, 0xA393, 0xC9C3, - 0xA394, 0xC9C5, 0xA395, 0xC9C6, 0xA396, 0xC9C9, 0xA397, 0xC9CB, - 0xA398, 0xC9CC, 0xA399, 0xC9CD, 0xA39A, 0xC9CE, 0xA39B, 0xC9CF, - 0xA39C, 0xC9D2, 0xA39D, 0xC9D4, 0xA39E, 0xC9D7, 0xA39F, 0xC9D8, - 0xA3A0, 0xC9DB, 0xA3A1, 0xFF01, 0xA3A2, 0xFF02, 0xA3A3, 0xFF03, - 0xA3A4, 0xFF04, 0xA3A5, 0xFF05, 0xA3A6, 0xFF06, 0xA3A7, 0xFF07, - 0xA3A8, 0xFF08, 0xA3A9, 0xFF09, 0xA3AA, 0xFF0A, 0xA3AB, 0xFF0B, - 0xA3AC, 0xFF0C, 0xA3AD, 0xFF0D, 0xA3AE, 0xFF0E, 0xA3AF, 0xFF0F, - 0xA3B0, 0xFF10, 0xA3B1, 0xFF11, 0xA3B2, 0xFF12, 0xA3B3, 0xFF13, - 0xA3B4, 0xFF14, 0xA3B5, 0xFF15, 0xA3B6, 0xFF16, 0xA3B7, 0xFF17, - 0xA3B8, 0xFF18, 0xA3B9, 0xFF19, 0xA3BA, 0xFF1A, 0xA3BB, 0xFF1B, - 0xA3BC, 0xFF1C, 0xA3BD, 0xFF1D, 0xA3BE, 0xFF1E, 0xA3BF, 0xFF1F, - 0xA3C0, 0xFF20, 0xA3C1, 0xFF21, 0xA3C2, 0xFF22, 0xA3C3, 0xFF23, - 0xA3C4, 0xFF24, 0xA3C5, 0xFF25, 0xA3C6, 0xFF26, 0xA3C7, 0xFF27, - 0xA3C8, 0xFF28, 0xA3C9, 0xFF29, 0xA3CA, 0xFF2A, 0xA3CB, 0xFF2B, - 0xA3CC, 0xFF2C, 0xA3CD, 0xFF2D, 0xA3CE, 0xFF2E, 0xA3CF, 0xFF2F, - 0xA3D0, 0xFF30, 0xA3D1, 0xFF31, 0xA3D2, 0xFF32, 0xA3D3, 0xFF33, - 0xA3D4, 0xFF34, 0xA3D5, 0xFF35, 0xA3D6, 0xFF36, 0xA3D7, 0xFF37, - 0xA3D8, 0xFF38, 0xA3D9, 0xFF39, 0xA3DA, 0xFF3A, 0xA3DB, 0xFF3B, - 0xA3DC, 0xFFE6, 0xA3DD, 0xFF3D, 0xA3DE, 0xFF3E, 0xA3DF, 0xFF3F, - 0xA3E0, 0xFF40, 0xA3E1, 0xFF41, 0xA3E2, 0xFF42, 0xA3E3, 0xFF43, - 0xA3E4, 0xFF44, 0xA3E5, 0xFF45, 0xA3E6, 0xFF46, 0xA3E7, 0xFF47, - 0xA3E8, 0xFF48, 0xA3E9, 0xFF49, 0xA3EA, 0xFF4A, 0xA3EB, 0xFF4B, - 0xA3EC, 0xFF4C, 0xA3ED, 0xFF4D, 0xA3EE, 0xFF4E, 0xA3EF, 0xFF4F, - 0xA3F0, 0xFF50, 0xA3F1, 0xFF51, 0xA3F2, 0xFF52, 0xA3F3, 0xFF53, - 0xA3F4, 0xFF54, 0xA3F5, 0xFF55, 0xA3F6, 0xFF56, 0xA3F7, 0xFF57, - 0xA3F8, 0xFF58, 0xA3F9, 0xFF59, 0xA3FA, 0xFF5A, 0xA3FB, 0xFF5B, - 0xA3FC, 0xFF5C, 0xA3FD, 0xFF5D, 0xA3FE, 0xFFE3, 0xA441, 0xC9DE, - 0xA442, 0xC9DF, 0xA443, 0xC9E1, 0xA444, 0xC9E3, 0xA445, 0xC9E5, - 0xA446, 0xC9E6, 0xA447, 0xC9E8, 0xA448, 0xC9E9, 0xA449, 0xC9EA, - 0xA44A, 0xC9EB, 0xA44B, 0xC9EE, 0xA44C, 0xC9F2, 0xA44D, 0xC9F3, - 0xA44E, 0xC9F4, 0xA44F, 0xC9F5, 0xA450, 0xC9F6, 0xA451, 0xC9F7, - 0xA452, 0xC9FA, 0xA453, 0xC9FB, 0xA454, 0xC9FD, 0xA455, 0xC9FE, - 0xA456, 0xC9FF, 0xA457, 0xCA01, 0xA458, 0xCA02, 0xA459, 0xCA03, - 0xA45A, 0xCA04, 0xA461, 0xCA05, 0xA462, 0xCA06, 0xA463, 0xCA07, - 0xA464, 0xCA0A, 0xA465, 0xCA0E, 0xA466, 0xCA0F, 0xA467, 0xCA10, - 0xA468, 0xCA11, 0xA469, 0xCA12, 0xA46A, 0xCA13, 0xA46B, 0xCA15, - 0xA46C, 0xCA16, 0xA46D, 0xCA17, 0xA46E, 0xCA19, 0xA46F, 0xCA1A, - 0xA470, 0xCA1B, 0xA471, 0xCA1C, 0xA472, 0xCA1D, 0xA473, 0xCA1E, - 0xA474, 0xCA1F, 0xA475, 0xCA20, 0xA476, 0xCA21, 0xA477, 0xCA22, - 0xA478, 0xCA23, 0xA479, 0xCA24, 0xA47A, 0xCA25, 0xA481, 0xCA26, - 0xA482, 0xCA27, 0xA483, 0xCA28, 0xA484, 0xCA2A, 0xA485, 0xCA2B, - 0xA486, 0xCA2C, 0xA487, 0xCA2D, 0xA488, 0xCA2E, 0xA489, 0xCA2F, - 0xA48A, 0xCA30, 0xA48B, 0xCA31, 0xA48C, 0xCA32, 0xA48D, 0xCA33, - 0xA48E, 0xCA34, 0xA48F, 0xCA35, 0xA490, 0xCA36, 0xA491, 0xCA37, - 0xA492, 0xCA38, 0xA493, 0xCA39, 0xA494, 0xCA3A, 0xA495, 0xCA3B, - 0xA496, 0xCA3C, 0xA497, 0xCA3D, 0xA498, 0xCA3E, 0xA499, 0xCA3F, - 0xA49A, 0xCA40, 0xA49B, 0xCA41, 0xA49C, 0xCA42, 0xA49D, 0xCA43, - 0xA49E, 0xCA44, 0xA49F, 0xCA45, 0xA4A0, 0xCA46, 0xA4A1, 0x3131, - 0xA4A2, 0x3132, 0xA4A3, 0x3133, 0xA4A4, 0x3134, 0xA4A5, 0x3135, - 0xA4A6, 0x3136, 0xA4A7, 0x3137, 0xA4A8, 0x3138, 0xA4A9, 0x3139, - 0xA4AA, 0x313A, 0xA4AB, 0x313B, 0xA4AC, 0x313C, 0xA4AD, 0x313D, - 0xA4AE, 0x313E, 0xA4AF, 0x313F, 0xA4B0, 0x3140, 0xA4B1, 0x3141, - 0xA4B2, 0x3142, 0xA4B3, 0x3143, 0xA4B4, 0x3144, 0xA4B5, 0x3145, - 0xA4B6, 0x3146, 0xA4B7, 0x3147, 0xA4B8, 0x3148, 0xA4B9, 0x3149, - 0xA4BA, 0x314A, 0xA4BB, 0x314B, 0xA4BC, 0x314C, 0xA4BD, 0x314D, - 0xA4BE, 0x314E, 0xA4BF, 0x314F, 0xA4C0, 0x3150, 0xA4C1, 0x3151, - 0xA4C2, 0x3152, 0xA4C3, 0x3153, 0xA4C4, 0x3154, 0xA4C5, 0x3155, - 0xA4C6, 0x3156, 0xA4C7, 0x3157, 0xA4C8, 0x3158, 0xA4C9, 0x3159, - 0xA4CA, 0x315A, 0xA4CB, 0x315B, 0xA4CC, 0x315C, 0xA4CD, 0x315D, - 0xA4CE, 0x315E, 0xA4CF, 0x315F, 0xA4D0, 0x3160, 0xA4D1, 0x3161, - 0xA4D2, 0x3162, 0xA4D3, 0x3163, 0xA4D4, 0x3164, 0xA4D5, 0x3165, - 0xA4D6, 0x3166, 0xA4D7, 0x3167, 0xA4D8, 0x3168, 0xA4D9, 0x3169, - 0xA4DA, 0x316A, 0xA4DB, 0x316B, 0xA4DC, 0x316C, 0xA4DD, 0x316D, - 0xA4DE, 0x316E, 0xA4DF, 0x316F, 0xA4E0, 0x3170, 0xA4E1, 0x3171, - 0xA4E2, 0x3172, 0xA4E3, 0x3173, 0xA4E4, 0x3174, 0xA4E5, 0x3175, - 0xA4E6, 0x3176, 0xA4E7, 0x3177, 0xA4E8, 0x3178, 0xA4E9, 0x3179, - 0xA4EA, 0x317A, 0xA4EB, 0x317B, 0xA4EC, 0x317C, 0xA4ED, 0x317D, - 0xA4EE, 0x317E, 0xA4EF, 0x317F, 0xA4F0, 0x3180, 0xA4F1, 0x3181, - 0xA4F2, 0x3182, 0xA4F3, 0x3183, 0xA4F4, 0x3184, 0xA4F5, 0x3185, - 0xA4F6, 0x3186, 0xA4F7, 0x3187, 0xA4F8, 0x3188, 0xA4F9, 0x3189, - 0xA4FA, 0x318A, 0xA4FB, 0x318B, 0xA4FC, 0x318C, 0xA4FD, 0x318D, - 0xA4FE, 0x318E, 0xA541, 0xCA47, 0xA542, 0xCA48, 0xA543, 0xCA49, - 0xA544, 0xCA4A, 0xA545, 0xCA4B, 0xA546, 0xCA4E, 0xA547, 0xCA4F, - 0xA548, 0xCA51, 0xA549, 0xCA52, 0xA54A, 0xCA53, 0xA54B, 0xCA55, - 0xA54C, 0xCA56, 0xA54D, 0xCA57, 0xA54E, 0xCA58, 0xA54F, 0xCA59, - 0xA550, 0xCA5A, 0xA551, 0xCA5B, 0xA552, 0xCA5E, 0xA553, 0xCA62, - 0xA554, 0xCA63, 0xA555, 0xCA64, 0xA556, 0xCA65, 0xA557, 0xCA66, - 0xA558, 0xCA67, 0xA559, 0xCA69, 0xA55A, 0xCA6A, 0xA561, 0xCA6B, - 0xA562, 0xCA6C, 0xA563, 0xCA6D, 0xA564, 0xCA6E, 0xA565, 0xCA6F, - 0xA566, 0xCA70, 0xA567, 0xCA71, 0xA568, 0xCA72, 0xA569, 0xCA73, - 0xA56A, 0xCA74, 0xA56B, 0xCA75, 0xA56C, 0xCA76, 0xA56D, 0xCA77, - 0xA56E, 0xCA78, 0xA56F, 0xCA79, 0xA570, 0xCA7A, 0xA571, 0xCA7B, - 0xA572, 0xCA7C, 0xA573, 0xCA7E, 0xA574, 0xCA7F, 0xA575, 0xCA80, - 0xA576, 0xCA81, 0xA577, 0xCA82, 0xA578, 0xCA83, 0xA579, 0xCA85, - 0xA57A, 0xCA86, 0xA581, 0xCA87, 0xA582, 0xCA88, 0xA583, 0xCA89, - 0xA584, 0xCA8A, 0xA585, 0xCA8B, 0xA586, 0xCA8C, 0xA587, 0xCA8D, - 0xA588, 0xCA8E, 0xA589, 0xCA8F, 0xA58A, 0xCA90, 0xA58B, 0xCA91, - 0xA58C, 0xCA92, 0xA58D, 0xCA93, 0xA58E, 0xCA94, 0xA58F, 0xCA95, - 0xA590, 0xCA96, 0xA591, 0xCA97, 0xA592, 0xCA99, 0xA593, 0xCA9A, - 0xA594, 0xCA9B, 0xA595, 0xCA9C, 0xA596, 0xCA9D, 0xA597, 0xCA9E, - 0xA598, 0xCA9F, 0xA599, 0xCAA0, 0xA59A, 0xCAA1, 0xA59B, 0xCAA2, - 0xA59C, 0xCAA3, 0xA59D, 0xCAA4, 0xA59E, 0xCAA5, 0xA59F, 0xCAA6, - 0xA5A0, 0xCAA7, 0xA5A1, 0x2170, 0xA5A2, 0x2171, 0xA5A3, 0x2172, - 0xA5A4, 0x2173, 0xA5A5, 0x2174, 0xA5A6, 0x2175, 0xA5A7, 0x2176, - 0xA5A8, 0x2177, 0xA5A9, 0x2178, 0xA5AA, 0x2179, 0xA5B0, 0x2160, - 0xA5B1, 0x2161, 0xA5B2, 0x2162, 0xA5B3, 0x2163, 0xA5B4, 0x2164, - 0xA5B5, 0x2165, 0xA5B6, 0x2166, 0xA5B7, 0x2167, 0xA5B8, 0x2168, - 0xA5B9, 0x2169, 0xA5C1, 0x0391, 0xA5C2, 0x0392, 0xA5C3, 0x0393, - 0xA5C4, 0x0394, 0xA5C5, 0x0395, 0xA5C6, 0x0396, 0xA5C7, 0x0397, - 0xA5C8, 0x0398, 0xA5C9, 0x0399, 0xA5CA, 0x039A, 0xA5CB, 0x039B, - 0xA5CC, 0x039C, 0xA5CD, 0x039D, 0xA5CE, 0x039E, 0xA5CF, 0x039F, - 0xA5D0, 0x03A0, 0xA5D1, 0x03A1, 0xA5D2, 0x03A3, 0xA5D3, 0x03A4, - 0xA5D4, 0x03A5, 0xA5D5, 0x03A6, 0xA5D6, 0x03A7, 0xA5D7, 0x03A8, - 0xA5D8, 0x03A9, 0xA5E1, 0x03B1, 0xA5E2, 0x03B2, 0xA5E3, 0x03B3, - 0xA5E4, 0x03B4, 0xA5E5, 0x03B5, 0xA5E6, 0x03B6, 0xA5E7, 0x03B7, - 0xA5E8, 0x03B8, 0xA5E9, 0x03B9, 0xA5EA, 0x03BA, 0xA5EB, 0x03BB, - 0xA5EC, 0x03BC, 0xA5ED, 0x03BD, 0xA5EE, 0x03BE, 0xA5EF, 0x03BF, - 0xA5F0, 0x03C0, 0xA5F1, 0x03C1, 0xA5F2, 0x03C3, 0xA5F3, 0x03C4, - 0xA5F4, 0x03C5, 0xA5F5, 0x03C6, 0xA5F6, 0x03C7, 0xA5F7, 0x03C8, - 0xA5F8, 0x03C9, 0xA641, 0xCAA8, 0xA642, 0xCAA9, 0xA643, 0xCAAA, - 0xA644, 0xCAAB, 0xA645, 0xCAAC, 0xA646, 0xCAAD, 0xA647, 0xCAAE, - 0xA648, 0xCAAF, 0xA649, 0xCAB0, 0xA64A, 0xCAB1, 0xA64B, 0xCAB2, - 0xA64C, 0xCAB3, 0xA64D, 0xCAB4, 0xA64E, 0xCAB5, 0xA64F, 0xCAB6, - 0xA650, 0xCAB7, 0xA651, 0xCAB8, 0xA652, 0xCAB9, 0xA653, 0xCABA, - 0xA654, 0xCABB, 0xA655, 0xCABE, 0xA656, 0xCABF, 0xA657, 0xCAC1, - 0xA658, 0xCAC2, 0xA659, 0xCAC3, 0xA65A, 0xCAC5, 0xA661, 0xCAC6, - 0xA662, 0xCAC7, 0xA663, 0xCAC8, 0xA664, 0xCAC9, 0xA665, 0xCACA, - 0xA666, 0xCACB, 0xA667, 0xCACE, 0xA668, 0xCAD0, 0xA669, 0xCAD2, - 0xA66A, 0xCAD4, 0xA66B, 0xCAD5, 0xA66C, 0xCAD6, 0xA66D, 0xCAD7, - 0xA66E, 0xCADA, 0xA66F, 0xCADB, 0xA670, 0xCADC, 0xA671, 0xCADD, - 0xA672, 0xCADE, 0xA673, 0xCADF, 0xA674, 0xCAE1, 0xA675, 0xCAE2, - 0xA676, 0xCAE3, 0xA677, 0xCAE4, 0xA678, 0xCAE5, 0xA679, 0xCAE6, - 0xA67A, 0xCAE7, 0xA681, 0xCAE8, 0xA682, 0xCAE9, 0xA683, 0xCAEA, - 0xA684, 0xCAEB, 0xA685, 0xCAED, 0xA686, 0xCAEE, 0xA687, 0xCAEF, - 0xA688, 0xCAF0, 0xA689, 0xCAF1, 0xA68A, 0xCAF2, 0xA68B, 0xCAF3, - 0xA68C, 0xCAF5, 0xA68D, 0xCAF6, 0xA68E, 0xCAF7, 0xA68F, 0xCAF8, - 0xA690, 0xCAF9, 0xA691, 0xCAFA, 0xA692, 0xCAFB, 0xA693, 0xCAFC, - 0xA694, 0xCAFD, 0xA695, 0xCAFE, 0xA696, 0xCAFF, 0xA697, 0xCB00, - 0xA698, 0xCB01, 0xA699, 0xCB02, 0xA69A, 0xCB03, 0xA69B, 0xCB04, - 0xA69C, 0xCB05, 0xA69D, 0xCB06, 0xA69E, 0xCB07, 0xA69F, 0xCB09, - 0xA6A0, 0xCB0A, 0xA6A1, 0x2500, 0xA6A2, 0x2502, 0xA6A3, 0x250C, - 0xA6A4, 0x2510, 0xA6A5, 0x2518, 0xA6A6, 0x2514, 0xA6A7, 0x251C, - 0xA6A8, 0x252C, 0xA6A9, 0x2524, 0xA6AA, 0x2534, 0xA6AB, 0x253C, - 0xA6AC, 0x2501, 0xA6AD, 0x2503, 0xA6AE, 0x250F, 0xA6AF, 0x2513, - 0xA6B0, 0x251B, 0xA6B1, 0x2517, 0xA6B2, 0x2523, 0xA6B3, 0x2533, - 0xA6B4, 0x252B, 0xA6B5, 0x253B, 0xA6B6, 0x254B, 0xA6B7, 0x2520, - 0xA6B8, 0x252F, 0xA6B9, 0x2528, 0xA6BA, 0x2537, 0xA6BB, 0x253F, - 0xA6BC, 0x251D, 0xA6BD, 0x2530, 0xA6BE, 0x2525, 0xA6BF, 0x2538, - 0xA6C0, 0x2542, 0xA6C1, 0x2512, 0xA6C2, 0x2511, 0xA6C3, 0x251A, - 0xA6C4, 0x2519, 0xA6C5, 0x2516, 0xA6C6, 0x2515, 0xA6C7, 0x250E, - 0xA6C8, 0x250D, 0xA6C9, 0x251E, 0xA6CA, 0x251F, 0xA6CB, 0x2521, - 0xA6CC, 0x2522, 0xA6CD, 0x2526, 0xA6CE, 0x2527, 0xA6CF, 0x2529, - 0xA6D0, 0x252A, 0xA6D1, 0x252D, 0xA6D2, 0x252E, 0xA6D3, 0x2531, - 0xA6D4, 0x2532, 0xA6D5, 0x2535, 0xA6D6, 0x2536, 0xA6D7, 0x2539, - 0xA6D8, 0x253A, 0xA6D9, 0x253D, 0xA6DA, 0x253E, 0xA6DB, 0x2540, - 0xA6DC, 0x2541, 0xA6DD, 0x2543, 0xA6DE, 0x2544, 0xA6DF, 0x2545, - 0xA6E0, 0x2546, 0xA6E1, 0x2547, 0xA6E2, 0x2548, 0xA6E3, 0x2549, - 0xA6E4, 0x254A, 0xA741, 0xCB0B, 0xA742, 0xCB0C, 0xA743, 0xCB0D, - 0xA744, 0xCB0E, 0xA745, 0xCB0F, 0xA746, 0xCB11, 0xA747, 0xCB12, - 0xA748, 0xCB13, 0xA749, 0xCB15, 0xA74A, 0xCB16, 0xA74B, 0xCB17, - 0xA74C, 0xCB19, 0xA74D, 0xCB1A, 0xA74E, 0xCB1B, 0xA74F, 0xCB1C, - 0xA750, 0xCB1D, 0xA751, 0xCB1E, 0xA752, 0xCB1F, 0xA753, 0xCB22, - 0xA754, 0xCB23, 0xA755, 0xCB24, 0xA756, 0xCB25, 0xA757, 0xCB26, - 0xA758, 0xCB27, 0xA759, 0xCB28, 0xA75A, 0xCB29, 0xA761, 0xCB2A, - 0xA762, 0xCB2B, 0xA763, 0xCB2C, 0xA764, 0xCB2D, 0xA765, 0xCB2E, - 0xA766, 0xCB2F, 0xA767, 0xCB30, 0xA768, 0xCB31, 0xA769, 0xCB32, - 0xA76A, 0xCB33, 0xA76B, 0xCB34, 0xA76C, 0xCB35, 0xA76D, 0xCB36, - 0xA76E, 0xCB37, 0xA76F, 0xCB38, 0xA770, 0xCB39, 0xA771, 0xCB3A, - 0xA772, 0xCB3B, 0xA773, 0xCB3C, 0xA774, 0xCB3D, 0xA775, 0xCB3E, - 0xA776, 0xCB3F, 0xA777, 0xCB40, 0xA778, 0xCB42, 0xA779, 0xCB43, - 0xA77A, 0xCB44, 0xA781, 0xCB45, 0xA782, 0xCB46, 0xA783, 0xCB47, - 0xA784, 0xCB4A, 0xA785, 0xCB4B, 0xA786, 0xCB4D, 0xA787, 0xCB4E, - 0xA788, 0xCB4F, 0xA789, 0xCB51, 0xA78A, 0xCB52, 0xA78B, 0xCB53, - 0xA78C, 0xCB54, 0xA78D, 0xCB55, 0xA78E, 0xCB56, 0xA78F, 0xCB57, - 0xA790, 0xCB5A, 0xA791, 0xCB5B, 0xA792, 0xCB5C, 0xA793, 0xCB5E, - 0xA794, 0xCB5F, 0xA795, 0xCB60, 0xA796, 0xCB61, 0xA797, 0xCB62, - 0xA798, 0xCB63, 0xA799, 0xCB65, 0xA79A, 0xCB66, 0xA79B, 0xCB67, - 0xA79C, 0xCB68, 0xA79D, 0xCB69, 0xA79E, 0xCB6A, 0xA79F, 0xCB6B, - 0xA7A0, 0xCB6C, 0xA7A1, 0x3395, 0xA7A2, 0x3396, 0xA7A3, 0x3397, - 0xA7A4, 0x2113, 0xA7A5, 0x3398, 0xA7A6, 0x33C4, 0xA7A7, 0x33A3, - 0xA7A8, 0x33A4, 0xA7A9, 0x33A5, 0xA7AA, 0x33A6, 0xA7AB, 0x3399, - 0xA7AC, 0x339A, 0xA7AD, 0x339B, 0xA7AE, 0x339C, 0xA7AF, 0x339D, - 0xA7B0, 0x339E, 0xA7B1, 0x339F, 0xA7B2, 0x33A0, 0xA7B3, 0x33A1, - 0xA7B4, 0x33A2, 0xA7B5, 0x33CA, 0xA7B6, 0x338D, 0xA7B7, 0x338E, - 0xA7B8, 0x338F, 0xA7B9, 0x33CF, 0xA7BA, 0x3388, 0xA7BB, 0x3389, - 0xA7BC, 0x33C8, 0xA7BD, 0x33A7, 0xA7BE, 0x33A8, 0xA7BF, 0x33B0, - 0xA7C0, 0x33B1, 0xA7C1, 0x33B2, 0xA7C2, 0x33B3, 0xA7C3, 0x33B4, - 0xA7C4, 0x33B5, 0xA7C5, 0x33B6, 0xA7C6, 0x33B7, 0xA7C7, 0x33B8, - 0xA7C8, 0x33B9, 0xA7C9, 0x3380, 0xA7CA, 0x3381, 0xA7CB, 0x3382, - 0xA7CC, 0x3383, 0xA7CD, 0x3384, 0xA7CE, 0x33BA, 0xA7CF, 0x33BB, - 0xA7D0, 0x33BC, 0xA7D1, 0x33BD, 0xA7D2, 0x33BE, 0xA7D3, 0x33BF, - 0xA7D4, 0x3390, 0xA7D5, 0x3391, 0xA7D6, 0x3392, 0xA7D7, 0x3393, - 0xA7D8, 0x3394, 0xA7D9, 0x2126, 0xA7DA, 0x33C0, 0xA7DB, 0x33C1, - 0xA7DC, 0x338A, 0xA7DD, 0x338B, 0xA7DE, 0x338C, 0xA7DF, 0x33D6, - 0xA7E0, 0x33C5, 0xA7E1, 0x33AD, 0xA7E2, 0x33AE, 0xA7E3, 0x33AF, - 0xA7E4, 0x33DB, 0xA7E5, 0x33A9, 0xA7E6, 0x33AA, 0xA7E7, 0x33AB, - 0xA7E8, 0x33AC, 0xA7E9, 0x33DD, 0xA7EA, 0x33D0, 0xA7EB, 0x33D3, - 0xA7EC, 0x33C3, 0xA7ED, 0x33C9, 0xA7EE, 0x33DC, 0xA7EF, 0x33C6, - 0xA841, 0xCB6D, 0xA842, 0xCB6E, 0xA843, 0xCB6F, 0xA844, 0xCB70, - 0xA845, 0xCB71, 0xA846, 0xCB72, 0xA847, 0xCB73, 0xA848, 0xCB74, - 0xA849, 0xCB75, 0xA84A, 0xCB76, 0xA84B, 0xCB77, 0xA84C, 0xCB7A, - 0xA84D, 0xCB7B, 0xA84E, 0xCB7C, 0xA84F, 0xCB7D, 0xA850, 0xCB7E, - 0xA851, 0xCB7F, 0xA852, 0xCB80, 0xA853, 0xCB81, 0xA854, 0xCB82, - 0xA855, 0xCB83, 0xA856, 0xCB84, 0xA857, 0xCB85, 0xA858, 0xCB86, - 0xA859, 0xCB87, 0xA85A, 0xCB88, 0xA861, 0xCB89, 0xA862, 0xCB8A, - 0xA863, 0xCB8B, 0xA864, 0xCB8C, 0xA865, 0xCB8D, 0xA866, 0xCB8E, - 0xA867, 0xCB8F, 0xA868, 0xCB90, 0xA869, 0xCB91, 0xA86A, 0xCB92, - 0xA86B, 0xCB93, 0xA86C, 0xCB94, 0xA86D, 0xCB95, 0xA86E, 0xCB96, - 0xA86F, 0xCB97, 0xA870, 0xCB98, 0xA871, 0xCB99, 0xA872, 0xCB9A, - 0xA873, 0xCB9B, 0xA874, 0xCB9D, 0xA875, 0xCB9E, 0xA876, 0xCB9F, - 0xA877, 0xCBA0, 0xA878, 0xCBA1, 0xA879, 0xCBA2, 0xA87A, 0xCBA3, - 0xA881, 0xCBA4, 0xA882, 0xCBA5, 0xA883, 0xCBA6, 0xA884, 0xCBA7, - 0xA885, 0xCBA8, 0xA886, 0xCBA9, 0xA887, 0xCBAA, 0xA888, 0xCBAB, - 0xA889, 0xCBAC, 0xA88A, 0xCBAD, 0xA88B, 0xCBAE, 0xA88C, 0xCBAF, - 0xA88D, 0xCBB0, 0xA88E, 0xCBB1, 0xA88F, 0xCBB2, 0xA890, 0xCBB3, - 0xA891, 0xCBB4, 0xA892, 0xCBB5, 0xA893, 0xCBB6, 0xA894, 0xCBB7, - 0xA895, 0xCBB9, 0xA896, 0xCBBA, 0xA897, 0xCBBB, 0xA898, 0xCBBC, - 0xA899, 0xCBBD, 0xA89A, 0xCBBE, 0xA89B, 0xCBBF, 0xA89C, 0xCBC0, - 0xA89D, 0xCBC1, 0xA89E, 0xCBC2, 0xA89F, 0xCBC3, 0xA8A0, 0xCBC4, - 0xA8A1, 0x00C6, 0xA8A2, 0x00D0, 0xA8A3, 0x00AA, 0xA8A4, 0x0126, - 0xA8A6, 0x0132, 0xA8A8, 0x013F, 0xA8A9, 0x0141, 0xA8AA, 0x00D8, - 0xA8AB, 0x0152, 0xA8AC, 0x00BA, 0xA8AD, 0x00DE, 0xA8AE, 0x0166, - 0xA8AF, 0x014A, 0xA8B1, 0x3260, 0xA8B2, 0x3261, 0xA8B3, 0x3262, - 0xA8B4, 0x3263, 0xA8B5, 0x3264, 0xA8B6, 0x3265, 0xA8B7, 0x3266, - 0xA8B8, 0x3267, 0xA8B9, 0x3268, 0xA8BA, 0x3269, 0xA8BB, 0x326A, - 0xA8BC, 0x326B, 0xA8BD, 0x326C, 0xA8BE, 0x326D, 0xA8BF, 0x326E, - 0xA8C0, 0x326F, 0xA8C1, 0x3270, 0xA8C2, 0x3271, 0xA8C3, 0x3272, - 0xA8C4, 0x3273, 0xA8C5, 0x3274, 0xA8C6, 0x3275, 0xA8C7, 0x3276, - 0xA8C8, 0x3277, 0xA8C9, 0x3278, 0xA8CA, 0x3279, 0xA8CB, 0x327A, - 0xA8CC, 0x327B, 0xA8CD, 0x24D0, 0xA8CE, 0x24D1, 0xA8CF, 0x24D2, - 0xA8D0, 0x24D3, 0xA8D1, 0x24D4, 0xA8D2, 0x24D5, 0xA8D3, 0x24D6, - 0xA8D4, 0x24D7, 0xA8D5, 0x24D8, 0xA8D6, 0x24D9, 0xA8D7, 0x24DA, - 0xA8D8, 0x24DB, 0xA8D9, 0x24DC, 0xA8DA, 0x24DD, 0xA8DB, 0x24DE, - 0xA8DC, 0x24DF, 0xA8DD, 0x24E0, 0xA8DE, 0x24E1, 0xA8DF, 0x24E2, - 0xA8E0, 0x24E3, 0xA8E1, 0x24E4, 0xA8E2, 0x24E5, 0xA8E3, 0x24E6, - 0xA8E4, 0x24E7, 0xA8E5, 0x24E8, 0xA8E6, 0x24E9, 0xA8E7, 0x2460, - 0xA8E8, 0x2461, 0xA8E9, 0x2462, 0xA8EA, 0x2463, 0xA8EB, 0x2464, - 0xA8EC, 0x2465, 0xA8ED, 0x2466, 0xA8EE, 0x2467, 0xA8EF, 0x2468, - 0xA8F0, 0x2469, 0xA8F1, 0x246A, 0xA8F2, 0x246B, 0xA8F3, 0x246C, - 0xA8F4, 0x246D, 0xA8F5, 0x246E, 0xA8F6, 0x00BD, 0xA8F7, 0x2153, - 0xA8F8, 0x2154, 0xA8F9, 0x00BC, 0xA8FA, 0x00BE, 0xA8FB, 0x215B, - 0xA8FC, 0x215C, 0xA8FD, 0x215D, 0xA8FE, 0x215E, 0xA941, 0xCBC5, - 0xA942, 0xCBC6, 0xA943, 0xCBC7, 0xA944, 0xCBC8, 0xA945, 0xCBC9, - 0xA946, 0xCBCA, 0xA947, 0xCBCB, 0xA948, 0xCBCC, 0xA949, 0xCBCD, - 0xA94A, 0xCBCE, 0xA94B, 0xCBCF, 0xA94C, 0xCBD0, 0xA94D, 0xCBD1, - 0xA94E, 0xCBD2, 0xA94F, 0xCBD3, 0xA950, 0xCBD5, 0xA951, 0xCBD6, - 0xA952, 0xCBD7, 0xA953, 0xCBD8, 0xA954, 0xCBD9, 0xA955, 0xCBDA, - 0xA956, 0xCBDB, 0xA957, 0xCBDC, 0xA958, 0xCBDD, 0xA959, 0xCBDE, - 0xA95A, 0xCBDF, 0xA961, 0xCBE0, 0xA962, 0xCBE1, 0xA963, 0xCBE2, - 0xA964, 0xCBE3, 0xA965, 0xCBE5, 0xA966, 0xCBE6, 0xA967, 0xCBE8, - 0xA968, 0xCBEA, 0xA969, 0xCBEB, 0xA96A, 0xCBEC, 0xA96B, 0xCBED, - 0xA96C, 0xCBEE, 0xA96D, 0xCBEF, 0xA96E, 0xCBF0, 0xA96F, 0xCBF1, - 0xA970, 0xCBF2, 0xA971, 0xCBF3, 0xA972, 0xCBF4, 0xA973, 0xCBF5, - 0xA974, 0xCBF6, 0xA975, 0xCBF7, 0xA976, 0xCBF8, 0xA977, 0xCBF9, - 0xA978, 0xCBFA, 0xA979, 0xCBFB, 0xA97A, 0xCBFC, 0xA981, 0xCBFD, - 0xA982, 0xCBFE, 0xA983, 0xCBFF, 0xA984, 0xCC00, 0xA985, 0xCC01, - 0xA986, 0xCC02, 0xA987, 0xCC03, 0xA988, 0xCC04, 0xA989, 0xCC05, - 0xA98A, 0xCC06, 0xA98B, 0xCC07, 0xA98C, 0xCC08, 0xA98D, 0xCC09, - 0xA98E, 0xCC0A, 0xA98F, 0xCC0B, 0xA990, 0xCC0E, 0xA991, 0xCC0F, - 0xA992, 0xCC11, 0xA993, 0xCC12, 0xA994, 0xCC13, 0xA995, 0xCC15, - 0xA996, 0xCC16, 0xA997, 0xCC17, 0xA998, 0xCC18, 0xA999, 0xCC19, - 0xA99A, 0xCC1A, 0xA99B, 0xCC1B, 0xA99C, 0xCC1E, 0xA99D, 0xCC1F, - 0xA99E, 0xCC20, 0xA99F, 0xCC23, 0xA9A0, 0xCC24, 0xA9A1, 0x00E6, - 0xA9A2, 0x0111, 0xA9A3, 0x00F0, 0xA9A4, 0x0127, 0xA9A5, 0x0131, - 0xA9A6, 0x0133, 0xA9A7, 0x0138, 0xA9A8, 0x0140, 0xA9A9, 0x0142, - 0xA9AA, 0x00F8, 0xA9AB, 0x0153, 0xA9AC, 0x00DF, 0xA9AD, 0x00FE, - 0xA9AE, 0x0167, 0xA9AF, 0x014B, 0xA9B0, 0x0149, 0xA9B1, 0x3200, - 0xA9B2, 0x3201, 0xA9B3, 0x3202, 0xA9B4, 0x3203, 0xA9B5, 0x3204, - 0xA9B6, 0x3205, 0xA9B7, 0x3206, 0xA9B8, 0x3207, 0xA9B9, 0x3208, - 0xA9BA, 0x3209, 0xA9BB, 0x320A, 0xA9BC, 0x320B, 0xA9BD, 0x320C, - 0xA9BE, 0x320D, 0xA9BF, 0x320E, 0xA9C0, 0x320F, 0xA9C1, 0x3210, - 0xA9C2, 0x3211, 0xA9C3, 0x3212, 0xA9C4, 0x3213, 0xA9C5, 0x3214, - 0xA9C6, 0x3215, 0xA9C7, 0x3216, 0xA9C8, 0x3217, 0xA9C9, 0x3218, - 0xA9CA, 0x3219, 0xA9CB, 0x321A, 0xA9CC, 0x321B, 0xA9CD, 0x249C, - 0xA9CE, 0x249D, 0xA9CF, 0x249E, 0xA9D0, 0x249F, 0xA9D1, 0x24A0, - 0xA9D2, 0x24A1, 0xA9D3, 0x24A2, 0xA9D4, 0x24A3, 0xA9D5, 0x24A4, - 0xA9D6, 0x24A5, 0xA9D7, 0x24A6, 0xA9D8, 0x24A7, 0xA9D9, 0x24A8, - 0xA9DA, 0x24A9, 0xA9DB, 0x24AA, 0xA9DC, 0x24AB, 0xA9DD, 0x24AC, - 0xA9DE, 0x24AD, 0xA9DF, 0x24AE, 0xA9E0, 0x24AF, 0xA9E1, 0x24B0, - 0xA9E2, 0x24B1, 0xA9E3, 0x24B2, 0xA9E4, 0x24B3, 0xA9E5, 0x24B4, - 0xA9E6, 0x24B5, 0xA9E7, 0x2474, 0xA9E8, 0x2475, 0xA9E9, 0x2476, - 0xA9EA, 0x2477, 0xA9EB, 0x2478, 0xA9EC, 0x2479, 0xA9ED, 0x247A, - 0xA9EE, 0x247B, 0xA9EF, 0x247C, 0xA9F0, 0x247D, 0xA9F1, 0x247E, - 0xA9F2, 0x247F, 0xA9F3, 0x2480, 0xA9F4, 0x2481, 0xA9F5, 0x2482, - 0xA9F6, 0x00B9, 0xA9F7, 0x00B2, 0xA9F8, 0x00B3, 0xA9F9, 0x2074, - 0xA9FA, 0x207F, 0xA9FB, 0x2081, 0xA9FC, 0x2082, 0xA9FD, 0x2083, - 0xA9FE, 0x2084, 0xAA41, 0xCC25, 0xAA42, 0xCC26, 0xAA43, 0xCC2A, - 0xAA44, 0xCC2B, 0xAA45, 0xCC2D, 0xAA46, 0xCC2F, 0xAA47, 0xCC31, - 0xAA48, 0xCC32, 0xAA49, 0xCC33, 0xAA4A, 0xCC34, 0xAA4B, 0xCC35, - 0xAA4C, 0xCC36, 0xAA4D, 0xCC37, 0xAA4E, 0xCC3A, 0xAA4F, 0xCC3F, - 0xAA50, 0xCC40, 0xAA51, 0xCC41, 0xAA52, 0xCC42, 0xAA53, 0xCC43, - 0xAA54, 0xCC46, 0xAA55, 0xCC47, 0xAA56, 0xCC49, 0xAA57, 0xCC4A, - 0xAA58, 0xCC4B, 0xAA59, 0xCC4D, 0xAA5A, 0xCC4E, 0xAA61, 0xCC4F, - 0xAA62, 0xCC50, 0xAA63, 0xCC51, 0xAA64, 0xCC52, 0xAA65, 0xCC53, - 0xAA66, 0xCC56, 0xAA67, 0xCC5A, 0xAA68, 0xCC5B, 0xAA69, 0xCC5C, - 0xAA6A, 0xCC5D, 0xAA6B, 0xCC5E, 0xAA6C, 0xCC5F, 0xAA6D, 0xCC61, - 0xAA6E, 0xCC62, 0xAA6F, 0xCC63, 0xAA70, 0xCC65, 0xAA71, 0xCC67, - 0xAA72, 0xCC69, 0xAA73, 0xCC6A, 0xAA74, 0xCC6B, 0xAA75, 0xCC6C, - 0xAA76, 0xCC6D, 0xAA77, 0xCC6E, 0xAA78, 0xCC6F, 0xAA79, 0xCC71, - 0xAA7A, 0xCC72, 0xAA81, 0xCC73, 0xAA82, 0xCC74, 0xAA83, 0xCC76, - 0xAA84, 0xCC77, 0xAA85, 0xCC78, 0xAA86, 0xCC79, 0xAA87, 0xCC7A, - 0xAA88, 0xCC7B, 0xAA89, 0xCC7C, 0xAA8A, 0xCC7D, 0xAA8B, 0xCC7E, - 0xAA8C, 0xCC7F, 0xAA8D, 0xCC80, 0xAA8E, 0xCC81, 0xAA8F, 0xCC82, - 0xAA90, 0xCC83, 0xAA91, 0xCC84, 0xAA92, 0xCC85, 0xAA93, 0xCC86, - 0xAA94, 0xCC87, 0xAA95, 0xCC88, 0xAA96, 0xCC89, 0xAA97, 0xCC8A, - 0xAA98, 0xCC8B, 0xAA99, 0xCC8C, 0xAA9A, 0xCC8D, 0xAA9B, 0xCC8E, - 0xAA9C, 0xCC8F, 0xAA9D, 0xCC90, 0xAA9E, 0xCC91, 0xAA9F, 0xCC92, - 0xAAA0, 0xCC93, 0xAAA1, 0x3041, 0xAAA2, 0x3042, 0xAAA3, 0x3043, - 0xAAA4, 0x3044, 0xAAA5, 0x3045, 0xAAA6, 0x3046, 0xAAA7, 0x3047, - 0xAAA8, 0x3048, 0xAAA9, 0x3049, 0xAAAA, 0x304A, 0xAAAB, 0x304B, - 0xAAAC, 0x304C, 0xAAAD, 0x304D, 0xAAAE, 0x304E, 0xAAAF, 0x304F, - 0xAAB0, 0x3050, 0xAAB1, 0x3051, 0xAAB2, 0x3052, 0xAAB3, 0x3053, - 0xAAB4, 0x3054, 0xAAB5, 0x3055, 0xAAB6, 0x3056, 0xAAB7, 0x3057, - 0xAAB8, 0x3058, 0xAAB9, 0x3059, 0xAABA, 0x305A, 0xAABB, 0x305B, - 0xAABC, 0x305C, 0xAABD, 0x305D, 0xAABE, 0x305E, 0xAABF, 0x305F, - 0xAAC0, 0x3060, 0xAAC1, 0x3061, 0xAAC2, 0x3062, 0xAAC3, 0x3063, - 0xAAC4, 0x3064, 0xAAC5, 0x3065, 0xAAC6, 0x3066, 0xAAC7, 0x3067, - 0xAAC8, 0x3068, 0xAAC9, 0x3069, 0xAACA, 0x306A, 0xAACB, 0x306B, - 0xAACC, 0x306C, 0xAACD, 0x306D, 0xAACE, 0x306E, 0xAACF, 0x306F, - 0xAAD0, 0x3070, 0xAAD1, 0x3071, 0xAAD2, 0x3072, 0xAAD3, 0x3073, - 0xAAD4, 0x3074, 0xAAD5, 0x3075, 0xAAD6, 0x3076, 0xAAD7, 0x3077, - 0xAAD8, 0x3078, 0xAAD9, 0x3079, 0xAADA, 0x307A, 0xAADB, 0x307B, - 0xAADC, 0x307C, 0xAADD, 0x307D, 0xAADE, 0x307E, 0xAADF, 0x307F, - 0xAAE0, 0x3080, 0xAAE1, 0x3081, 0xAAE2, 0x3082, 0xAAE3, 0x3083, - 0xAAE4, 0x3084, 0xAAE5, 0x3085, 0xAAE6, 0x3086, 0xAAE7, 0x3087, - 0xAAE8, 0x3088, 0xAAE9, 0x3089, 0xAAEA, 0x308A, 0xAAEB, 0x308B, - 0xAAEC, 0x308C, 0xAAED, 0x308D, 0xAAEE, 0x308E, 0xAAEF, 0x308F, - 0xAAF0, 0x3090, 0xAAF1, 0x3091, 0xAAF2, 0x3092, 0xAAF3, 0x3093, - 0xAB41, 0xCC94, 0xAB42, 0xCC95, 0xAB43, 0xCC96, 0xAB44, 0xCC97, - 0xAB45, 0xCC9A, 0xAB46, 0xCC9B, 0xAB47, 0xCC9D, 0xAB48, 0xCC9E, - 0xAB49, 0xCC9F, 0xAB4A, 0xCCA1, 0xAB4B, 0xCCA2, 0xAB4C, 0xCCA3, - 0xAB4D, 0xCCA4, 0xAB4E, 0xCCA5, 0xAB4F, 0xCCA6, 0xAB50, 0xCCA7, - 0xAB51, 0xCCAA, 0xAB52, 0xCCAE, 0xAB53, 0xCCAF, 0xAB54, 0xCCB0, - 0xAB55, 0xCCB1, 0xAB56, 0xCCB2, 0xAB57, 0xCCB3, 0xAB58, 0xCCB6, - 0xAB59, 0xCCB7, 0xAB5A, 0xCCB9, 0xAB61, 0xCCBA, 0xAB62, 0xCCBB, - 0xAB63, 0xCCBD, 0xAB64, 0xCCBE, 0xAB65, 0xCCBF, 0xAB66, 0xCCC0, - 0xAB67, 0xCCC1, 0xAB68, 0xCCC2, 0xAB69, 0xCCC3, 0xAB6A, 0xCCC6, - 0xAB6B, 0xCCC8, 0xAB6C, 0xCCCA, 0xAB6D, 0xCCCB, 0xAB6E, 0xCCCC, - 0xAB6F, 0xCCCD, 0xAB70, 0xCCCE, 0xAB71, 0xCCCF, 0xAB72, 0xCCD1, - 0xAB73, 0xCCD2, 0xAB74, 0xCCD3, 0xAB75, 0xCCD5, 0xAB76, 0xCCD6, - 0xAB77, 0xCCD7, 0xAB78, 0xCCD8, 0xAB79, 0xCCD9, 0xAB7A, 0xCCDA, - 0xAB81, 0xCCDB, 0xAB82, 0xCCDC, 0xAB83, 0xCCDD, 0xAB84, 0xCCDE, - 0xAB85, 0xCCDF, 0xAB86, 0xCCE0, 0xAB87, 0xCCE1, 0xAB88, 0xCCE2, - 0xAB89, 0xCCE3, 0xAB8A, 0xCCE5, 0xAB8B, 0xCCE6, 0xAB8C, 0xCCE7, - 0xAB8D, 0xCCE8, 0xAB8E, 0xCCE9, 0xAB8F, 0xCCEA, 0xAB90, 0xCCEB, - 0xAB91, 0xCCED, 0xAB92, 0xCCEE, 0xAB93, 0xCCEF, 0xAB94, 0xCCF1, - 0xAB95, 0xCCF2, 0xAB96, 0xCCF3, 0xAB97, 0xCCF4, 0xAB98, 0xCCF5, - 0xAB99, 0xCCF6, 0xAB9A, 0xCCF7, 0xAB9B, 0xCCF8, 0xAB9C, 0xCCF9, - 0xAB9D, 0xCCFA, 0xAB9E, 0xCCFB, 0xAB9F, 0xCCFC, 0xABA0, 0xCCFD, - 0xABA1, 0x30A1, 0xABA2, 0x30A2, 0xABA3, 0x30A3, 0xABA4, 0x30A4, - 0xABA5, 0x30A5, 0xABA6, 0x30A6, 0xABA7, 0x30A7, 0xABA8, 0x30A8, - 0xABA9, 0x30A9, 0xABAA, 0x30AA, 0xABAB, 0x30AB, 0xABAC, 0x30AC, - 0xABAD, 0x30AD, 0xABAE, 0x30AE, 0xABAF, 0x30AF, 0xABB0, 0x30B0, - 0xABB1, 0x30B1, 0xABB2, 0x30B2, 0xABB3, 0x30B3, 0xABB4, 0x30B4, - 0xABB5, 0x30B5, 0xABB6, 0x30B6, 0xABB7, 0x30B7, 0xABB8, 0x30B8, - 0xABB9, 0x30B9, 0xABBA, 0x30BA, 0xABBB, 0x30BB, 0xABBC, 0x30BC, - 0xABBD, 0x30BD, 0xABBE, 0x30BE, 0xABBF, 0x30BF, 0xABC0, 0x30C0, - 0xABC1, 0x30C1, 0xABC2, 0x30C2, 0xABC3, 0x30C3, 0xABC4, 0x30C4, - 0xABC5, 0x30C5, 0xABC6, 0x30C6, 0xABC7, 0x30C7, 0xABC8, 0x30C8, - 0xABC9, 0x30C9, 0xABCA, 0x30CA, 0xABCB, 0x30CB, 0xABCC, 0x30CC, - 0xABCD, 0x30CD, 0xABCE, 0x30CE, 0xABCF, 0x30CF, 0xABD0, 0x30D0, - 0xABD1, 0x30D1, 0xABD2, 0x30D2, 0xABD3, 0x30D3, 0xABD4, 0x30D4, - 0xABD5, 0x30D5, 0xABD6, 0x30D6, 0xABD7, 0x30D7, 0xABD8, 0x30D8, - 0xABD9, 0x30D9, 0xABDA, 0x30DA, 0xABDB, 0x30DB, 0xABDC, 0x30DC, - 0xABDD, 0x30DD, 0xABDE, 0x30DE, 0xABDF, 0x30DF, 0xABE0, 0x30E0, - 0xABE1, 0x30E1, 0xABE2, 0x30E2, 0xABE3, 0x30E3, 0xABE4, 0x30E4, - 0xABE5, 0x30E5, 0xABE6, 0x30E6, 0xABE7, 0x30E7, 0xABE8, 0x30E8, - 0xABE9, 0x30E9, 0xABEA, 0x30EA, 0xABEB, 0x30EB, 0xABEC, 0x30EC, - 0xABED, 0x30ED, 0xABEE, 0x30EE, 0xABEF, 0x30EF, 0xABF0, 0x30F0, - 0xABF1, 0x30F1, 0xABF2, 0x30F2, 0xABF3, 0x30F3, 0xABF4, 0x30F4, - 0xABF5, 0x30F5, 0xABF6, 0x30F6, 0xAC41, 0xCCFE, 0xAC42, 0xCCFF, - 0xAC43, 0xCD00, 0xAC44, 0xCD02, 0xAC45, 0xCD03, 0xAC46, 0xCD04, - 0xAC47, 0xCD05, 0xAC48, 0xCD06, 0xAC49, 0xCD07, 0xAC4A, 0xCD0A, - 0xAC4B, 0xCD0B, 0xAC4C, 0xCD0D, 0xAC4D, 0xCD0E, 0xAC4E, 0xCD0F, - 0xAC4F, 0xCD11, 0xAC50, 0xCD12, 0xAC51, 0xCD13, 0xAC52, 0xCD14, - 0xAC53, 0xCD15, 0xAC54, 0xCD16, 0xAC55, 0xCD17, 0xAC56, 0xCD1A, - 0xAC57, 0xCD1C, 0xAC58, 0xCD1E, 0xAC59, 0xCD1F, 0xAC5A, 0xCD20, - 0xAC61, 0xCD21, 0xAC62, 0xCD22, 0xAC63, 0xCD23, 0xAC64, 0xCD25, - 0xAC65, 0xCD26, 0xAC66, 0xCD27, 0xAC67, 0xCD29, 0xAC68, 0xCD2A, - 0xAC69, 0xCD2B, 0xAC6A, 0xCD2D, 0xAC6B, 0xCD2E, 0xAC6C, 0xCD2F, - 0xAC6D, 0xCD30, 0xAC6E, 0xCD31, 0xAC6F, 0xCD32, 0xAC70, 0xCD33, - 0xAC71, 0xCD34, 0xAC72, 0xCD35, 0xAC73, 0xCD36, 0xAC74, 0xCD37, - 0xAC75, 0xCD38, 0xAC76, 0xCD3A, 0xAC77, 0xCD3B, 0xAC78, 0xCD3C, - 0xAC79, 0xCD3D, 0xAC7A, 0xCD3E, 0xAC81, 0xCD3F, 0xAC82, 0xCD40, - 0xAC83, 0xCD41, 0xAC84, 0xCD42, 0xAC85, 0xCD43, 0xAC86, 0xCD44, - 0xAC87, 0xCD45, 0xAC88, 0xCD46, 0xAC89, 0xCD47, 0xAC8A, 0xCD48, - 0xAC8B, 0xCD49, 0xAC8C, 0xCD4A, 0xAC8D, 0xCD4B, 0xAC8E, 0xCD4C, - 0xAC8F, 0xCD4D, 0xAC90, 0xCD4E, 0xAC91, 0xCD4F, 0xAC92, 0xCD50, - 0xAC93, 0xCD51, 0xAC94, 0xCD52, 0xAC95, 0xCD53, 0xAC96, 0xCD54, - 0xAC97, 0xCD55, 0xAC98, 0xCD56, 0xAC99, 0xCD57, 0xAC9A, 0xCD58, - 0xAC9B, 0xCD59, 0xAC9C, 0xCD5A, 0xAC9D, 0xCD5B, 0xAC9E, 0xCD5D, - 0xAC9F, 0xCD5E, 0xACA0, 0xCD5F, 0xACA1, 0x0410, 0xACA2, 0x0411, - 0xACA3, 0x0412, 0xACA4, 0x0413, 0xACA5, 0x0414, 0xACA6, 0x0415, - 0xACA7, 0x0401, 0xACA8, 0x0416, 0xACA9, 0x0417, 0xACAA, 0x0418, - 0xACAB, 0x0419, 0xACAC, 0x041A, 0xACAD, 0x041B, 0xACAE, 0x041C, - 0xACAF, 0x041D, 0xACB0, 0x041E, 0xACB1, 0x041F, 0xACB2, 0x0420, - 0xACB3, 0x0421, 0xACB4, 0x0422, 0xACB5, 0x0423, 0xACB6, 0x0424, - 0xACB7, 0x0425, 0xACB8, 0x0426, 0xACB9, 0x0427, 0xACBA, 0x0428, - 0xACBB, 0x0429, 0xACBC, 0x042A, 0xACBD, 0x042B, 0xACBE, 0x042C, - 0xACBF, 0x042D, 0xACC0, 0x042E, 0xACC1, 0x042F, 0xACD1, 0x0430, - 0xACD2, 0x0431, 0xACD3, 0x0432, 0xACD4, 0x0433, 0xACD5, 0x0434, - 0xACD6, 0x0435, 0xACD7, 0x0451, 0xACD8, 0x0436, 0xACD9, 0x0437, - 0xACDA, 0x0438, 0xACDB, 0x0439, 0xACDC, 0x043A, 0xACDD, 0x043B, - 0xACDE, 0x043C, 0xACDF, 0x043D, 0xACE0, 0x043E, 0xACE1, 0x043F, - 0xACE2, 0x0440, 0xACE3, 0x0441, 0xACE4, 0x0442, 0xACE5, 0x0443, - 0xACE6, 0x0444, 0xACE7, 0x0445, 0xACE8, 0x0446, 0xACE9, 0x0447, - 0xACEA, 0x0448, 0xACEB, 0x0449, 0xACEC, 0x044A, 0xACED, 0x044B, - 0xACEE, 0x044C, 0xACEF, 0x044D, 0xACF0, 0x044E, 0xACF1, 0x044F, - 0xAD41, 0xCD61, 0xAD42, 0xCD62, 0xAD43, 0xCD63, 0xAD44, 0xCD65, - 0xAD45, 0xCD66, 0xAD46, 0xCD67, 0xAD47, 0xCD68, 0xAD48, 0xCD69, - 0xAD49, 0xCD6A, 0xAD4A, 0xCD6B, 0xAD4B, 0xCD6E, 0xAD4C, 0xCD70, - 0xAD4D, 0xCD72, 0xAD4E, 0xCD73, 0xAD4F, 0xCD74, 0xAD50, 0xCD75, - 0xAD51, 0xCD76, 0xAD52, 0xCD77, 0xAD53, 0xCD79, 0xAD54, 0xCD7A, - 0xAD55, 0xCD7B, 0xAD56, 0xCD7C, 0xAD57, 0xCD7D, 0xAD58, 0xCD7E, - 0xAD59, 0xCD7F, 0xAD5A, 0xCD80, 0xAD61, 0xCD81, 0xAD62, 0xCD82, - 0xAD63, 0xCD83, 0xAD64, 0xCD84, 0xAD65, 0xCD85, 0xAD66, 0xCD86, - 0xAD67, 0xCD87, 0xAD68, 0xCD89, 0xAD69, 0xCD8A, 0xAD6A, 0xCD8B, - 0xAD6B, 0xCD8C, 0xAD6C, 0xCD8D, 0xAD6D, 0xCD8E, 0xAD6E, 0xCD8F, - 0xAD6F, 0xCD90, 0xAD70, 0xCD91, 0xAD71, 0xCD92, 0xAD72, 0xCD93, - 0xAD73, 0xCD96, 0xAD74, 0xCD97, 0xAD75, 0xCD99, 0xAD76, 0xCD9A, - 0xAD77, 0xCD9B, 0xAD78, 0xCD9D, 0xAD79, 0xCD9E, 0xAD7A, 0xCD9F, - 0xAD81, 0xCDA0, 0xAD82, 0xCDA1, 0xAD83, 0xCDA2, 0xAD84, 0xCDA3, - 0xAD85, 0xCDA6, 0xAD86, 0xCDA8, 0xAD87, 0xCDAA, 0xAD88, 0xCDAB, - 0xAD89, 0xCDAC, 0xAD8A, 0xCDAD, 0xAD8B, 0xCDAE, 0xAD8C, 0xCDAF, - 0xAD8D, 0xCDB1, 0xAD8E, 0xCDB2, 0xAD8F, 0xCDB3, 0xAD90, 0xCDB4, - 0xAD91, 0xCDB5, 0xAD92, 0xCDB6, 0xAD93, 0xCDB7, 0xAD94, 0xCDB8, - 0xAD95, 0xCDB9, 0xAD96, 0xCDBA, 0xAD97, 0xCDBB, 0xAD98, 0xCDBC, - 0xAD99, 0xCDBD, 0xAD9A, 0xCDBE, 0xAD9B, 0xCDBF, 0xAD9C, 0xCDC0, - 0xAD9D, 0xCDC1, 0xAD9E, 0xCDC2, 0xAD9F, 0xCDC3, 0xADA0, 0xCDC5, - 0xAE41, 0xCDC6, 0xAE42, 0xCDC7, 0xAE43, 0xCDC8, 0xAE44, 0xCDC9, - 0xAE45, 0xCDCA, 0xAE46, 0xCDCB, 0xAE47, 0xCDCD, 0xAE48, 0xCDCE, - 0xAE49, 0xCDCF, 0xAE4A, 0xCDD1, 0xAE4B, 0xCDD2, 0xAE4C, 0xCDD3, - 0xAE4D, 0xCDD4, 0xAE4E, 0xCDD5, 0xAE4F, 0xCDD6, 0xAE50, 0xCDD7, - 0xAE51, 0xCDD8, 0xAE52, 0xCDD9, 0xAE53, 0xCDDA, 0xAE54, 0xCDDB, - 0xAE55, 0xCDDC, 0xAE56, 0xCDDD, 0xAE57, 0xCDDE, 0xAE58, 0xCDDF, - 0xAE59, 0xCDE0, 0xAE5A, 0xCDE1, 0xAE61, 0xCDE2, 0xAE62, 0xCDE3, - 0xAE63, 0xCDE4, 0xAE64, 0xCDE5, 0xAE65, 0xCDE6, 0xAE66, 0xCDE7, - 0xAE67, 0xCDE9, 0xAE68, 0xCDEA, 0xAE69, 0xCDEB, 0xAE6A, 0xCDED, - 0xAE6B, 0xCDEE, 0xAE6C, 0xCDEF, 0xAE6D, 0xCDF1, 0xAE6E, 0xCDF2, - 0xAE6F, 0xCDF3, 0xAE70, 0xCDF4, 0xAE71, 0xCDF5, 0xAE72, 0xCDF6, - 0xAE73, 0xCDF7, 0xAE74, 0xCDFA, 0xAE75, 0xCDFC, 0xAE76, 0xCDFE, - 0xAE77, 0xCDFF, 0xAE78, 0xCE00, 0xAE79, 0xCE01, 0xAE7A, 0xCE02, - 0xAE81, 0xCE03, 0xAE82, 0xCE05, 0xAE83, 0xCE06, 0xAE84, 0xCE07, - 0xAE85, 0xCE09, 0xAE86, 0xCE0A, 0xAE87, 0xCE0B, 0xAE88, 0xCE0D, - 0xAE89, 0xCE0E, 0xAE8A, 0xCE0F, 0xAE8B, 0xCE10, 0xAE8C, 0xCE11, - 0xAE8D, 0xCE12, 0xAE8E, 0xCE13, 0xAE8F, 0xCE15, 0xAE90, 0xCE16, - 0xAE91, 0xCE17, 0xAE92, 0xCE18, 0xAE93, 0xCE1A, 0xAE94, 0xCE1B, - 0xAE95, 0xCE1C, 0xAE96, 0xCE1D, 0xAE97, 0xCE1E, 0xAE98, 0xCE1F, - 0xAE99, 0xCE22, 0xAE9A, 0xCE23, 0xAE9B, 0xCE25, 0xAE9C, 0xCE26, - 0xAE9D, 0xCE27, 0xAE9E, 0xCE29, 0xAE9F, 0xCE2A, 0xAEA0, 0xCE2B, - 0xAF41, 0xCE2C, 0xAF42, 0xCE2D, 0xAF43, 0xCE2E, 0xAF44, 0xCE2F, - 0xAF45, 0xCE32, 0xAF46, 0xCE34, 0xAF47, 0xCE36, 0xAF48, 0xCE37, - 0xAF49, 0xCE38, 0xAF4A, 0xCE39, 0xAF4B, 0xCE3A, 0xAF4C, 0xCE3B, - 0xAF4D, 0xCE3C, 0xAF4E, 0xCE3D, 0xAF4F, 0xCE3E, 0xAF50, 0xCE3F, - 0xAF51, 0xCE40, 0xAF52, 0xCE41, 0xAF53, 0xCE42, 0xAF54, 0xCE43, - 0xAF55, 0xCE44, 0xAF56, 0xCE45, 0xAF57, 0xCE46, 0xAF58, 0xCE47, - 0xAF59, 0xCE48, 0xAF5A, 0xCE49, 0xAF61, 0xCE4A, 0xAF62, 0xCE4B, - 0xAF63, 0xCE4C, 0xAF64, 0xCE4D, 0xAF65, 0xCE4E, 0xAF66, 0xCE4F, - 0xAF67, 0xCE50, 0xAF68, 0xCE51, 0xAF69, 0xCE52, 0xAF6A, 0xCE53, - 0xAF6B, 0xCE54, 0xAF6C, 0xCE55, 0xAF6D, 0xCE56, 0xAF6E, 0xCE57, - 0xAF6F, 0xCE5A, 0xAF70, 0xCE5B, 0xAF71, 0xCE5D, 0xAF72, 0xCE5E, - 0xAF73, 0xCE62, 0xAF74, 0xCE63, 0xAF75, 0xCE64, 0xAF76, 0xCE65, - 0xAF77, 0xCE66, 0xAF78, 0xCE67, 0xAF79, 0xCE6A, 0xAF7A, 0xCE6C, - 0xAF81, 0xCE6E, 0xAF82, 0xCE6F, 0xAF83, 0xCE70, 0xAF84, 0xCE71, - 0xAF85, 0xCE72, 0xAF86, 0xCE73, 0xAF87, 0xCE76, 0xAF88, 0xCE77, - 0xAF89, 0xCE79, 0xAF8A, 0xCE7A, 0xAF8B, 0xCE7B, 0xAF8C, 0xCE7D, - 0xAF8D, 0xCE7E, 0xAF8E, 0xCE7F, 0xAF8F, 0xCE80, 0xAF90, 0xCE81, - 0xAF91, 0xCE82, 0xAF92, 0xCE83, 0xAF93, 0xCE86, 0xAF94, 0xCE88, - 0xAF95, 0xCE8A, 0xAF96, 0xCE8B, 0xAF97, 0xCE8C, 0xAF98, 0xCE8D, - 0xAF99, 0xCE8E, 0xAF9A, 0xCE8F, 0xAF9B, 0xCE92, 0xAF9C, 0xCE93, - 0xAF9D, 0xCE95, 0xAF9E, 0xCE96, 0xAF9F, 0xCE97, 0xAFA0, 0xCE99, - 0xB041, 0xCE9A, 0xB042, 0xCE9B, 0xB043, 0xCE9C, 0xB044, 0xCE9D, - 0xB045, 0xCE9E, 0xB046, 0xCE9F, 0xB047, 0xCEA2, 0xB048, 0xCEA6, - 0xB049, 0xCEA7, 0xB04A, 0xCEA8, 0xB04B, 0xCEA9, 0xB04C, 0xCEAA, - 0xB04D, 0xCEAB, 0xB04E, 0xCEAE, 0xB04F, 0xCEAF, 0xB050, 0xCEB0, - 0xB051, 0xCEB1, 0xB052, 0xCEB2, 0xB053, 0xCEB3, 0xB054, 0xCEB4, - 0xB055, 0xCEB5, 0xB056, 0xCEB6, 0xB057, 0xCEB7, 0xB058, 0xCEB8, - 0xB059, 0xCEB9, 0xB05A, 0xCEBA, 0xB061, 0xCEBB, 0xB062, 0xCEBC, - 0xB063, 0xCEBD, 0xB064, 0xCEBE, 0xB065, 0xCEBF, 0xB066, 0xCEC0, - 0xB067, 0xCEC2, 0xB068, 0xCEC3, 0xB069, 0xCEC4, 0xB06A, 0xCEC5, - 0xB06B, 0xCEC6, 0xB06C, 0xCEC7, 0xB06D, 0xCEC8, 0xB06E, 0xCEC9, - 0xB06F, 0xCECA, 0xB070, 0xCECB, 0xB071, 0xCECC, 0xB072, 0xCECD, - 0xB073, 0xCECE, 0xB074, 0xCECF, 0xB075, 0xCED0, 0xB076, 0xCED1, - 0xB077, 0xCED2, 0xB078, 0xCED3, 0xB079, 0xCED4, 0xB07A, 0xCED5, - 0xB081, 0xCED6, 0xB082, 0xCED7, 0xB083, 0xCED8, 0xB084, 0xCED9, - 0xB085, 0xCEDA, 0xB086, 0xCEDB, 0xB087, 0xCEDC, 0xB088, 0xCEDD, - 0xB089, 0xCEDE, 0xB08A, 0xCEDF, 0xB08B, 0xCEE0, 0xB08C, 0xCEE1, - 0xB08D, 0xCEE2, 0xB08E, 0xCEE3, 0xB08F, 0xCEE6, 0xB090, 0xCEE7, - 0xB091, 0xCEE9, 0xB092, 0xCEEA, 0xB093, 0xCEED, 0xB094, 0xCEEE, - 0xB095, 0xCEEF, 0xB096, 0xCEF0, 0xB097, 0xCEF1, 0xB098, 0xCEF2, - 0xB099, 0xCEF3, 0xB09A, 0xCEF6, 0xB09B, 0xCEFA, 0xB09C, 0xCEFB, - 0xB09D, 0xCEFC, 0xB09E, 0xCEFD, 0xB09F, 0xCEFE, 0xB0A0, 0xCEFF, - 0xB0A1, 0xAC00, 0xB0A2, 0xAC01, 0xB0A3, 0xAC04, 0xB0A4, 0xAC07, - 0xB0A5, 0xAC08, 0xB0A6, 0xAC09, 0xB0A7, 0xAC0A, 0xB0A8, 0xAC10, - 0xB0A9, 0xAC11, 0xB0AA, 0xAC12, 0xB0AB, 0xAC13, 0xB0AC, 0xAC14, - 0xB0AD, 0xAC15, 0xB0AE, 0xAC16, 0xB0AF, 0xAC17, 0xB0B0, 0xAC19, - 0xB0B1, 0xAC1A, 0xB0B2, 0xAC1B, 0xB0B3, 0xAC1C, 0xB0B4, 0xAC1D, - 0xB0B5, 0xAC20, 0xB0B6, 0xAC24, 0xB0B7, 0xAC2C, 0xB0B8, 0xAC2D, - 0xB0B9, 0xAC2F, 0xB0BA, 0xAC30, 0xB0BB, 0xAC31, 0xB0BC, 0xAC38, - 0xB0BD, 0xAC39, 0xB0BE, 0xAC3C, 0xB0BF, 0xAC40, 0xB0C0, 0xAC4B, - 0xB0C1, 0xAC4D, 0xB0C2, 0xAC54, 0xB0C3, 0xAC58, 0xB0C4, 0xAC5C, - 0xB0C5, 0xAC70, 0xB0C6, 0xAC71, 0xB0C7, 0xAC74, 0xB0C8, 0xAC77, - 0xB0C9, 0xAC78, 0xB0CA, 0xAC7A, 0xB0CB, 0xAC80, 0xB0CC, 0xAC81, - 0xB0CD, 0xAC83, 0xB0CE, 0xAC84, 0xB0CF, 0xAC85, 0xB0D0, 0xAC86, - 0xB0D1, 0xAC89, 0xB0D2, 0xAC8A, 0xB0D3, 0xAC8B, 0xB0D4, 0xAC8C, - 0xB0D5, 0xAC90, 0xB0D6, 0xAC94, 0xB0D7, 0xAC9C, 0xB0D8, 0xAC9D, - 0xB0D9, 0xAC9F, 0xB0DA, 0xACA0, 0xB0DB, 0xACA1, 0xB0DC, 0xACA8, - 0xB0DD, 0xACA9, 0xB0DE, 0xACAA, 0xB0DF, 0xACAC, 0xB0E0, 0xACAF, - 0xB0E1, 0xACB0, 0xB0E2, 0xACB8, 0xB0E3, 0xACB9, 0xB0E4, 0xACBB, - 0xB0E5, 0xACBC, 0xB0E6, 0xACBD, 0xB0E7, 0xACC1, 0xB0E8, 0xACC4, - 0xB0E9, 0xACC8, 0xB0EA, 0xACCC, 0xB0EB, 0xACD5, 0xB0EC, 0xACD7, - 0xB0ED, 0xACE0, 0xB0EE, 0xACE1, 0xB0EF, 0xACE4, 0xB0F0, 0xACE7, - 0xB0F1, 0xACE8, 0xB0F2, 0xACEA, 0xB0F3, 0xACEC, 0xB0F4, 0xACEF, - 0xB0F5, 0xACF0, 0xB0F6, 0xACF1, 0xB0F7, 0xACF3, 0xB0F8, 0xACF5, - 0xB0F9, 0xACF6, 0xB0FA, 0xACFC, 0xB0FB, 0xACFD, 0xB0FC, 0xAD00, - 0xB0FD, 0xAD04, 0xB0FE, 0xAD06, 0xB141, 0xCF02, 0xB142, 0xCF03, - 0xB143, 0xCF05, 0xB144, 0xCF06, 0xB145, 0xCF07, 0xB146, 0xCF09, - 0xB147, 0xCF0A, 0xB148, 0xCF0B, 0xB149, 0xCF0C, 0xB14A, 0xCF0D, - 0xB14B, 0xCF0E, 0xB14C, 0xCF0F, 0xB14D, 0xCF12, 0xB14E, 0xCF14, - 0xB14F, 0xCF16, 0xB150, 0xCF17, 0xB151, 0xCF18, 0xB152, 0xCF19, - 0xB153, 0xCF1A, 0xB154, 0xCF1B, 0xB155, 0xCF1D, 0xB156, 0xCF1E, - 0xB157, 0xCF1F, 0xB158, 0xCF21, 0xB159, 0xCF22, 0xB15A, 0xCF23, - 0xB161, 0xCF25, 0xB162, 0xCF26, 0xB163, 0xCF27, 0xB164, 0xCF28, - 0xB165, 0xCF29, 0xB166, 0xCF2A, 0xB167, 0xCF2B, 0xB168, 0xCF2E, - 0xB169, 0xCF32, 0xB16A, 0xCF33, 0xB16B, 0xCF34, 0xB16C, 0xCF35, - 0xB16D, 0xCF36, 0xB16E, 0xCF37, 0xB16F, 0xCF39, 0xB170, 0xCF3A, - 0xB171, 0xCF3B, 0xB172, 0xCF3C, 0xB173, 0xCF3D, 0xB174, 0xCF3E, - 0xB175, 0xCF3F, 0xB176, 0xCF40, 0xB177, 0xCF41, 0xB178, 0xCF42, - 0xB179, 0xCF43, 0xB17A, 0xCF44, 0xB181, 0xCF45, 0xB182, 0xCF46, - 0xB183, 0xCF47, 0xB184, 0xCF48, 0xB185, 0xCF49, 0xB186, 0xCF4A, - 0xB187, 0xCF4B, 0xB188, 0xCF4C, 0xB189, 0xCF4D, 0xB18A, 0xCF4E, - 0xB18B, 0xCF4F, 0xB18C, 0xCF50, 0xB18D, 0xCF51, 0xB18E, 0xCF52, - 0xB18F, 0xCF53, 0xB190, 0xCF56, 0xB191, 0xCF57, 0xB192, 0xCF59, - 0xB193, 0xCF5A, 0xB194, 0xCF5B, 0xB195, 0xCF5D, 0xB196, 0xCF5E, - 0xB197, 0xCF5F, 0xB198, 0xCF60, 0xB199, 0xCF61, 0xB19A, 0xCF62, - 0xB19B, 0xCF63, 0xB19C, 0xCF66, 0xB19D, 0xCF68, 0xB19E, 0xCF6A, - 0xB19F, 0xCF6B, 0xB1A0, 0xCF6C, 0xB1A1, 0xAD0C, 0xB1A2, 0xAD0D, - 0xB1A3, 0xAD0F, 0xB1A4, 0xAD11, 0xB1A5, 0xAD18, 0xB1A6, 0xAD1C, - 0xB1A7, 0xAD20, 0xB1A8, 0xAD29, 0xB1A9, 0xAD2C, 0xB1AA, 0xAD2D, - 0xB1AB, 0xAD34, 0xB1AC, 0xAD35, 0xB1AD, 0xAD38, 0xB1AE, 0xAD3C, - 0xB1AF, 0xAD44, 0xB1B0, 0xAD45, 0xB1B1, 0xAD47, 0xB1B2, 0xAD49, - 0xB1B3, 0xAD50, 0xB1B4, 0xAD54, 0xB1B5, 0xAD58, 0xB1B6, 0xAD61, - 0xB1B7, 0xAD63, 0xB1B8, 0xAD6C, 0xB1B9, 0xAD6D, 0xB1BA, 0xAD70, - 0xB1BB, 0xAD73, 0xB1BC, 0xAD74, 0xB1BD, 0xAD75, 0xB1BE, 0xAD76, - 0xB1BF, 0xAD7B, 0xB1C0, 0xAD7C, 0xB1C1, 0xAD7D, 0xB1C2, 0xAD7F, - 0xB1C3, 0xAD81, 0xB1C4, 0xAD82, 0xB1C5, 0xAD88, 0xB1C6, 0xAD89, - 0xB1C7, 0xAD8C, 0xB1C8, 0xAD90, 0xB1C9, 0xAD9C, 0xB1CA, 0xAD9D, - 0xB1CB, 0xADA4, 0xB1CC, 0xADB7, 0xB1CD, 0xADC0, 0xB1CE, 0xADC1, - 0xB1CF, 0xADC4, 0xB1D0, 0xADC8, 0xB1D1, 0xADD0, 0xB1D2, 0xADD1, - 0xB1D3, 0xADD3, 0xB1D4, 0xADDC, 0xB1D5, 0xADE0, 0xB1D6, 0xADE4, - 0xB1D7, 0xADF8, 0xB1D8, 0xADF9, 0xB1D9, 0xADFC, 0xB1DA, 0xADFF, - 0xB1DB, 0xAE00, 0xB1DC, 0xAE01, 0xB1DD, 0xAE08, 0xB1DE, 0xAE09, - 0xB1DF, 0xAE0B, 0xB1E0, 0xAE0D, 0xB1E1, 0xAE14, 0xB1E2, 0xAE30, - 0xB1E3, 0xAE31, 0xB1E4, 0xAE34, 0xB1E5, 0xAE37, 0xB1E6, 0xAE38, - 0xB1E7, 0xAE3A, 0xB1E8, 0xAE40, 0xB1E9, 0xAE41, 0xB1EA, 0xAE43, - 0xB1EB, 0xAE45, 0xB1EC, 0xAE46, 0xB1ED, 0xAE4A, 0xB1EE, 0xAE4C, - 0xB1EF, 0xAE4D, 0xB1F0, 0xAE4E, 0xB1F1, 0xAE50, 0xB1F2, 0xAE54, - 0xB1F3, 0xAE56, 0xB1F4, 0xAE5C, 0xB1F5, 0xAE5D, 0xB1F6, 0xAE5F, - 0xB1F7, 0xAE60, 0xB1F8, 0xAE61, 0xB1F9, 0xAE65, 0xB1FA, 0xAE68, - 0xB1FB, 0xAE69, 0xB1FC, 0xAE6C, 0xB1FD, 0xAE70, 0xB1FE, 0xAE78, - 0xB241, 0xCF6D, 0xB242, 0xCF6E, 0xB243, 0xCF6F, 0xB244, 0xCF72, - 0xB245, 0xCF73, 0xB246, 0xCF75, 0xB247, 0xCF76, 0xB248, 0xCF77, - 0xB249, 0xCF79, 0xB24A, 0xCF7A, 0xB24B, 0xCF7B, 0xB24C, 0xCF7C, - 0xB24D, 0xCF7D, 0xB24E, 0xCF7E, 0xB24F, 0xCF7F, 0xB250, 0xCF81, - 0xB251, 0xCF82, 0xB252, 0xCF83, 0xB253, 0xCF84, 0xB254, 0xCF86, - 0xB255, 0xCF87, 0xB256, 0xCF88, 0xB257, 0xCF89, 0xB258, 0xCF8A, - 0xB259, 0xCF8B, 0xB25A, 0xCF8D, 0xB261, 0xCF8E, 0xB262, 0xCF8F, - 0xB263, 0xCF90, 0xB264, 0xCF91, 0xB265, 0xCF92, 0xB266, 0xCF93, - 0xB267, 0xCF94, 0xB268, 0xCF95, 0xB269, 0xCF96, 0xB26A, 0xCF97, - 0xB26B, 0xCF98, 0xB26C, 0xCF99, 0xB26D, 0xCF9A, 0xB26E, 0xCF9B, - 0xB26F, 0xCF9C, 0xB270, 0xCF9D, 0xB271, 0xCF9E, 0xB272, 0xCF9F, - 0xB273, 0xCFA0, 0xB274, 0xCFA2, 0xB275, 0xCFA3, 0xB276, 0xCFA4, - 0xB277, 0xCFA5, 0xB278, 0xCFA6, 0xB279, 0xCFA7, 0xB27A, 0xCFA9, - 0xB281, 0xCFAA, 0xB282, 0xCFAB, 0xB283, 0xCFAC, 0xB284, 0xCFAD, - 0xB285, 0xCFAE, 0xB286, 0xCFAF, 0xB287, 0xCFB1, 0xB288, 0xCFB2, - 0xB289, 0xCFB3, 0xB28A, 0xCFB4, 0xB28B, 0xCFB5, 0xB28C, 0xCFB6, - 0xB28D, 0xCFB7, 0xB28E, 0xCFB8, 0xB28F, 0xCFB9, 0xB290, 0xCFBA, - 0xB291, 0xCFBB, 0xB292, 0xCFBC, 0xB293, 0xCFBD, 0xB294, 0xCFBE, - 0xB295, 0xCFBF, 0xB296, 0xCFC0, 0xB297, 0xCFC1, 0xB298, 0xCFC2, - 0xB299, 0xCFC3, 0xB29A, 0xCFC5, 0xB29B, 0xCFC6, 0xB29C, 0xCFC7, - 0xB29D, 0xCFC8, 0xB29E, 0xCFC9, 0xB29F, 0xCFCA, 0xB2A0, 0xCFCB, - 0xB2A1, 0xAE79, 0xB2A2, 0xAE7B, 0xB2A3, 0xAE7C, 0xB2A4, 0xAE7D, - 0xB2A5, 0xAE84, 0xB2A6, 0xAE85, 0xB2A7, 0xAE8C, 0xB2A8, 0xAEBC, - 0xB2A9, 0xAEBD, 0xB2AA, 0xAEBE, 0xB2AB, 0xAEC0, 0xB2AC, 0xAEC4, - 0xB2AD, 0xAECC, 0xB2AE, 0xAECD, 0xB2AF, 0xAECF, 0xB2B0, 0xAED0, - 0xB2B1, 0xAED1, 0xB2B2, 0xAED8, 0xB2B3, 0xAED9, 0xB2B4, 0xAEDC, - 0xB2B5, 0xAEE8, 0xB2B6, 0xAEEB, 0xB2B7, 0xAEED, 0xB2B8, 0xAEF4, - 0xB2B9, 0xAEF8, 0xB2BA, 0xAEFC, 0xB2BB, 0xAF07, 0xB2BC, 0xAF08, - 0xB2BD, 0xAF0D, 0xB2BE, 0xAF10, 0xB2BF, 0xAF2C, 0xB2C0, 0xAF2D, - 0xB2C1, 0xAF30, 0xB2C2, 0xAF32, 0xB2C3, 0xAF34, 0xB2C4, 0xAF3C, - 0xB2C5, 0xAF3D, 0xB2C6, 0xAF3F, 0xB2C7, 0xAF41, 0xB2C8, 0xAF42, - 0xB2C9, 0xAF43, 0xB2CA, 0xAF48, 0xB2CB, 0xAF49, 0xB2CC, 0xAF50, - 0xB2CD, 0xAF5C, 0xB2CE, 0xAF5D, 0xB2CF, 0xAF64, 0xB2D0, 0xAF65, - 0xB2D1, 0xAF79, 0xB2D2, 0xAF80, 0xB2D3, 0xAF84, 0xB2D4, 0xAF88, - 0xB2D5, 0xAF90, 0xB2D6, 0xAF91, 0xB2D7, 0xAF95, 0xB2D8, 0xAF9C, - 0xB2D9, 0xAFB8, 0xB2DA, 0xAFB9, 0xB2DB, 0xAFBC, 0xB2DC, 0xAFC0, - 0xB2DD, 0xAFC7, 0xB2DE, 0xAFC8, 0xB2DF, 0xAFC9, 0xB2E0, 0xAFCB, - 0xB2E1, 0xAFCD, 0xB2E2, 0xAFCE, 0xB2E3, 0xAFD4, 0xB2E4, 0xAFDC, - 0xB2E5, 0xAFE8, 0xB2E6, 0xAFE9, 0xB2E7, 0xAFF0, 0xB2E8, 0xAFF1, - 0xB2E9, 0xAFF4, 0xB2EA, 0xAFF8, 0xB2EB, 0xB000, 0xB2EC, 0xB001, - 0xB2ED, 0xB004, 0xB2EE, 0xB00C, 0xB2EF, 0xB010, 0xB2F0, 0xB014, - 0xB2F1, 0xB01C, 0xB2F2, 0xB01D, 0xB2F3, 0xB028, 0xB2F4, 0xB044, - 0xB2F5, 0xB045, 0xB2F6, 0xB048, 0xB2F7, 0xB04A, 0xB2F8, 0xB04C, - 0xB2F9, 0xB04E, 0xB2FA, 0xB053, 0xB2FB, 0xB054, 0xB2FC, 0xB055, - 0xB2FD, 0xB057, 0xB2FE, 0xB059, 0xB341, 0xCFCC, 0xB342, 0xCFCD, - 0xB343, 0xCFCE, 0xB344, 0xCFCF, 0xB345, 0xCFD0, 0xB346, 0xCFD1, - 0xB347, 0xCFD2, 0xB348, 0xCFD3, 0xB349, 0xCFD4, 0xB34A, 0xCFD5, - 0xB34B, 0xCFD6, 0xB34C, 0xCFD7, 0xB34D, 0xCFD8, 0xB34E, 0xCFD9, - 0xB34F, 0xCFDA, 0xB350, 0xCFDB, 0xB351, 0xCFDC, 0xB352, 0xCFDD, - 0xB353, 0xCFDE, 0xB354, 0xCFDF, 0xB355, 0xCFE2, 0xB356, 0xCFE3, - 0xB357, 0xCFE5, 0xB358, 0xCFE6, 0xB359, 0xCFE7, 0xB35A, 0xCFE9, - 0xB361, 0xCFEA, 0xB362, 0xCFEB, 0xB363, 0xCFEC, 0xB364, 0xCFED, - 0xB365, 0xCFEE, 0xB366, 0xCFEF, 0xB367, 0xCFF2, 0xB368, 0xCFF4, - 0xB369, 0xCFF6, 0xB36A, 0xCFF7, 0xB36B, 0xCFF8, 0xB36C, 0xCFF9, - 0xB36D, 0xCFFA, 0xB36E, 0xCFFB, 0xB36F, 0xCFFD, 0xB370, 0xCFFE, - 0xB371, 0xCFFF, 0xB372, 0xD001, 0xB373, 0xD002, 0xB374, 0xD003, - 0xB375, 0xD005, 0xB376, 0xD006, 0xB377, 0xD007, 0xB378, 0xD008, - 0xB379, 0xD009, 0xB37A, 0xD00A, 0xB381, 0xD00B, 0xB382, 0xD00C, - 0xB383, 0xD00D, 0xB384, 0xD00E, 0xB385, 0xD00F, 0xB386, 0xD010, - 0xB387, 0xD012, 0xB388, 0xD013, 0xB389, 0xD014, 0xB38A, 0xD015, - 0xB38B, 0xD016, 0xB38C, 0xD017, 0xB38D, 0xD019, 0xB38E, 0xD01A, - 0xB38F, 0xD01B, 0xB390, 0xD01C, 0xB391, 0xD01D, 0xB392, 0xD01E, - 0xB393, 0xD01F, 0xB394, 0xD020, 0xB395, 0xD021, 0xB396, 0xD022, - 0xB397, 0xD023, 0xB398, 0xD024, 0xB399, 0xD025, 0xB39A, 0xD026, - 0xB39B, 0xD027, 0xB39C, 0xD028, 0xB39D, 0xD029, 0xB39E, 0xD02A, - 0xB39F, 0xD02B, 0xB3A0, 0xD02C, 0xB3A1, 0xB05D, 0xB3A2, 0xB07C, - 0xB3A3, 0xB07D, 0xB3A4, 0xB080, 0xB3A5, 0xB084, 0xB3A6, 0xB08C, - 0xB3A7, 0xB08D, 0xB3A8, 0xB08F, 0xB3A9, 0xB091, 0xB3AA, 0xB098, - 0xB3AB, 0xB099, 0xB3AC, 0xB09A, 0xB3AD, 0xB09C, 0xB3AE, 0xB09F, - 0xB3AF, 0xB0A0, 0xB3B0, 0xB0A1, 0xB3B1, 0xB0A2, 0xB3B2, 0xB0A8, - 0xB3B3, 0xB0A9, 0xB3B4, 0xB0AB, 0xB3B5, 0xB0AC, 0xB3B6, 0xB0AD, - 0xB3B7, 0xB0AE, 0xB3B8, 0xB0AF, 0xB3B9, 0xB0B1, 0xB3BA, 0xB0B3, - 0xB3BB, 0xB0B4, 0xB3BC, 0xB0B5, 0xB3BD, 0xB0B8, 0xB3BE, 0xB0BC, - 0xB3BF, 0xB0C4, 0xB3C0, 0xB0C5, 0xB3C1, 0xB0C7, 0xB3C2, 0xB0C8, - 0xB3C3, 0xB0C9, 0xB3C4, 0xB0D0, 0xB3C5, 0xB0D1, 0xB3C6, 0xB0D4, - 0xB3C7, 0xB0D8, 0xB3C8, 0xB0E0, 0xB3C9, 0xB0E5, 0xB3CA, 0xB108, - 0xB3CB, 0xB109, 0xB3CC, 0xB10B, 0xB3CD, 0xB10C, 0xB3CE, 0xB110, - 0xB3CF, 0xB112, 0xB3D0, 0xB113, 0xB3D1, 0xB118, 0xB3D2, 0xB119, - 0xB3D3, 0xB11B, 0xB3D4, 0xB11C, 0xB3D5, 0xB11D, 0xB3D6, 0xB123, - 0xB3D7, 0xB124, 0xB3D8, 0xB125, 0xB3D9, 0xB128, 0xB3DA, 0xB12C, - 0xB3DB, 0xB134, 0xB3DC, 0xB135, 0xB3DD, 0xB137, 0xB3DE, 0xB138, - 0xB3DF, 0xB139, 0xB3E0, 0xB140, 0xB3E1, 0xB141, 0xB3E2, 0xB144, - 0xB3E3, 0xB148, 0xB3E4, 0xB150, 0xB3E5, 0xB151, 0xB3E6, 0xB154, - 0xB3E7, 0xB155, 0xB3E8, 0xB158, 0xB3E9, 0xB15C, 0xB3EA, 0xB160, - 0xB3EB, 0xB178, 0xB3EC, 0xB179, 0xB3ED, 0xB17C, 0xB3EE, 0xB180, - 0xB3EF, 0xB182, 0xB3F0, 0xB188, 0xB3F1, 0xB189, 0xB3F2, 0xB18B, - 0xB3F3, 0xB18D, 0xB3F4, 0xB192, 0xB3F5, 0xB193, 0xB3F6, 0xB194, - 0xB3F7, 0xB198, 0xB3F8, 0xB19C, 0xB3F9, 0xB1A8, 0xB3FA, 0xB1CC, - 0xB3FB, 0xB1D0, 0xB3FC, 0xB1D4, 0xB3FD, 0xB1DC, 0xB3FE, 0xB1DD, - 0xB441, 0xD02E, 0xB442, 0xD02F, 0xB443, 0xD030, 0xB444, 0xD031, - 0xB445, 0xD032, 0xB446, 0xD033, 0xB447, 0xD036, 0xB448, 0xD037, - 0xB449, 0xD039, 0xB44A, 0xD03A, 0xB44B, 0xD03B, 0xB44C, 0xD03D, - 0xB44D, 0xD03E, 0xB44E, 0xD03F, 0xB44F, 0xD040, 0xB450, 0xD041, - 0xB451, 0xD042, 0xB452, 0xD043, 0xB453, 0xD046, 0xB454, 0xD048, - 0xB455, 0xD04A, 0xB456, 0xD04B, 0xB457, 0xD04C, 0xB458, 0xD04D, - 0xB459, 0xD04E, 0xB45A, 0xD04F, 0xB461, 0xD051, 0xB462, 0xD052, - 0xB463, 0xD053, 0xB464, 0xD055, 0xB465, 0xD056, 0xB466, 0xD057, - 0xB467, 0xD059, 0xB468, 0xD05A, 0xB469, 0xD05B, 0xB46A, 0xD05C, - 0xB46B, 0xD05D, 0xB46C, 0xD05E, 0xB46D, 0xD05F, 0xB46E, 0xD061, - 0xB46F, 0xD062, 0xB470, 0xD063, 0xB471, 0xD064, 0xB472, 0xD065, - 0xB473, 0xD066, 0xB474, 0xD067, 0xB475, 0xD068, 0xB476, 0xD069, - 0xB477, 0xD06A, 0xB478, 0xD06B, 0xB479, 0xD06E, 0xB47A, 0xD06F, - 0xB481, 0xD071, 0xB482, 0xD072, 0xB483, 0xD073, 0xB484, 0xD075, - 0xB485, 0xD076, 0xB486, 0xD077, 0xB487, 0xD078, 0xB488, 0xD079, - 0xB489, 0xD07A, 0xB48A, 0xD07B, 0xB48B, 0xD07E, 0xB48C, 0xD07F, - 0xB48D, 0xD080, 0xB48E, 0xD082, 0xB48F, 0xD083, 0xB490, 0xD084, - 0xB491, 0xD085, 0xB492, 0xD086, 0xB493, 0xD087, 0xB494, 0xD088, - 0xB495, 0xD089, 0xB496, 0xD08A, 0xB497, 0xD08B, 0xB498, 0xD08C, - 0xB499, 0xD08D, 0xB49A, 0xD08E, 0xB49B, 0xD08F, 0xB49C, 0xD090, - 0xB49D, 0xD091, 0xB49E, 0xD092, 0xB49F, 0xD093, 0xB4A0, 0xD094, - 0xB4A1, 0xB1DF, 0xB4A2, 0xB1E8, 0xB4A3, 0xB1E9, 0xB4A4, 0xB1EC, - 0xB4A5, 0xB1F0, 0xB4A6, 0xB1F9, 0xB4A7, 0xB1FB, 0xB4A8, 0xB1FD, - 0xB4A9, 0xB204, 0xB4AA, 0xB205, 0xB4AB, 0xB208, 0xB4AC, 0xB20B, - 0xB4AD, 0xB20C, 0xB4AE, 0xB214, 0xB4AF, 0xB215, 0xB4B0, 0xB217, - 0xB4B1, 0xB219, 0xB4B2, 0xB220, 0xB4B3, 0xB234, 0xB4B4, 0xB23C, - 0xB4B5, 0xB258, 0xB4B6, 0xB25C, 0xB4B7, 0xB260, 0xB4B8, 0xB268, - 0xB4B9, 0xB269, 0xB4BA, 0xB274, 0xB4BB, 0xB275, 0xB4BC, 0xB27C, - 0xB4BD, 0xB284, 0xB4BE, 0xB285, 0xB4BF, 0xB289, 0xB4C0, 0xB290, - 0xB4C1, 0xB291, 0xB4C2, 0xB294, 0xB4C3, 0xB298, 0xB4C4, 0xB299, - 0xB4C5, 0xB29A, 0xB4C6, 0xB2A0, 0xB4C7, 0xB2A1, 0xB4C8, 0xB2A3, - 0xB4C9, 0xB2A5, 0xB4CA, 0xB2A6, 0xB4CB, 0xB2AA, 0xB4CC, 0xB2AC, - 0xB4CD, 0xB2B0, 0xB4CE, 0xB2B4, 0xB4CF, 0xB2C8, 0xB4D0, 0xB2C9, - 0xB4D1, 0xB2CC, 0xB4D2, 0xB2D0, 0xB4D3, 0xB2D2, 0xB4D4, 0xB2D8, - 0xB4D5, 0xB2D9, 0xB4D6, 0xB2DB, 0xB4D7, 0xB2DD, 0xB4D8, 0xB2E2, - 0xB4D9, 0xB2E4, 0xB4DA, 0xB2E5, 0xB4DB, 0xB2E6, 0xB4DC, 0xB2E8, - 0xB4DD, 0xB2EB, 0xB4DE, 0xB2EC, 0xB4DF, 0xB2ED, 0xB4E0, 0xB2EE, - 0xB4E1, 0xB2EF, 0xB4E2, 0xB2F3, 0xB4E3, 0xB2F4, 0xB4E4, 0xB2F5, - 0xB4E5, 0xB2F7, 0xB4E6, 0xB2F8, 0xB4E7, 0xB2F9, 0xB4E8, 0xB2FA, - 0xB4E9, 0xB2FB, 0xB4EA, 0xB2FF, 0xB4EB, 0xB300, 0xB4EC, 0xB301, - 0xB4ED, 0xB304, 0xB4EE, 0xB308, 0xB4EF, 0xB310, 0xB4F0, 0xB311, - 0xB4F1, 0xB313, 0xB4F2, 0xB314, 0xB4F3, 0xB315, 0xB4F4, 0xB31C, - 0xB4F5, 0xB354, 0xB4F6, 0xB355, 0xB4F7, 0xB356, 0xB4F8, 0xB358, - 0xB4F9, 0xB35B, 0xB4FA, 0xB35C, 0xB4FB, 0xB35E, 0xB4FC, 0xB35F, - 0xB4FD, 0xB364, 0xB4FE, 0xB365, 0xB541, 0xD095, 0xB542, 0xD096, - 0xB543, 0xD097, 0xB544, 0xD098, 0xB545, 0xD099, 0xB546, 0xD09A, - 0xB547, 0xD09B, 0xB548, 0xD09C, 0xB549, 0xD09D, 0xB54A, 0xD09E, - 0xB54B, 0xD09F, 0xB54C, 0xD0A0, 0xB54D, 0xD0A1, 0xB54E, 0xD0A2, - 0xB54F, 0xD0A3, 0xB550, 0xD0A6, 0xB551, 0xD0A7, 0xB552, 0xD0A9, - 0xB553, 0xD0AA, 0xB554, 0xD0AB, 0xB555, 0xD0AD, 0xB556, 0xD0AE, - 0xB557, 0xD0AF, 0xB558, 0xD0B0, 0xB559, 0xD0B1, 0xB55A, 0xD0B2, - 0xB561, 0xD0B3, 0xB562, 0xD0B6, 0xB563, 0xD0B8, 0xB564, 0xD0BA, - 0xB565, 0xD0BB, 0xB566, 0xD0BC, 0xB567, 0xD0BD, 0xB568, 0xD0BE, - 0xB569, 0xD0BF, 0xB56A, 0xD0C2, 0xB56B, 0xD0C3, 0xB56C, 0xD0C5, - 0xB56D, 0xD0C6, 0xB56E, 0xD0C7, 0xB56F, 0xD0CA, 0xB570, 0xD0CB, - 0xB571, 0xD0CC, 0xB572, 0xD0CD, 0xB573, 0xD0CE, 0xB574, 0xD0CF, - 0xB575, 0xD0D2, 0xB576, 0xD0D6, 0xB577, 0xD0D7, 0xB578, 0xD0D8, - 0xB579, 0xD0D9, 0xB57A, 0xD0DA, 0xB581, 0xD0DB, 0xB582, 0xD0DE, - 0xB583, 0xD0DF, 0xB584, 0xD0E1, 0xB585, 0xD0E2, 0xB586, 0xD0E3, - 0xB587, 0xD0E5, 0xB588, 0xD0E6, 0xB589, 0xD0E7, 0xB58A, 0xD0E8, - 0xB58B, 0xD0E9, 0xB58C, 0xD0EA, 0xB58D, 0xD0EB, 0xB58E, 0xD0EE, - 0xB58F, 0xD0F2, 0xB590, 0xD0F3, 0xB591, 0xD0F4, 0xB592, 0xD0F5, - 0xB593, 0xD0F6, 0xB594, 0xD0F7, 0xB595, 0xD0F9, 0xB596, 0xD0FA, - 0xB597, 0xD0FB, 0xB598, 0xD0FC, 0xB599, 0xD0FD, 0xB59A, 0xD0FE, - 0xB59B, 0xD0FF, 0xB59C, 0xD100, 0xB59D, 0xD101, 0xB59E, 0xD102, - 0xB59F, 0xD103, 0xB5A0, 0xD104, 0xB5A1, 0xB367, 0xB5A2, 0xB369, - 0xB5A3, 0xB36B, 0xB5A4, 0xB36E, 0xB5A5, 0xB370, 0xB5A6, 0xB371, - 0xB5A7, 0xB374, 0xB5A8, 0xB378, 0xB5A9, 0xB380, 0xB5AA, 0xB381, - 0xB5AB, 0xB383, 0xB5AC, 0xB384, 0xB5AD, 0xB385, 0xB5AE, 0xB38C, - 0xB5AF, 0xB390, 0xB5B0, 0xB394, 0xB5B1, 0xB3A0, 0xB5B2, 0xB3A1, - 0xB5B3, 0xB3A8, 0xB5B4, 0xB3AC, 0xB5B5, 0xB3C4, 0xB5B6, 0xB3C5, - 0xB5B7, 0xB3C8, 0xB5B8, 0xB3CB, 0xB5B9, 0xB3CC, 0xB5BA, 0xB3CE, - 0xB5BB, 0xB3D0, 0xB5BC, 0xB3D4, 0xB5BD, 0xB3D5, 0xB5BE, 0xB3D7, - 0xB5BF, 0xB3D9, 0xB5C0, 0xB3DB, 0xB5C1, 0xB3DD, 0xB5C2, 0xB3E0, - 0xB5C3, 0xB3E4, 0xB5C4, 0xB3E8, 0xB5C5, 0xB3FC, 0xB5C6, 0xB410, - 0xB5C7, 0xB418, 0xB5C8, 0xB41C, 0xB5C9, 0xB420, 0xB5CA, 0xB428, - 0xB5CB, 0xB429, 0xB5CC, 0xB42B, 0xB5CD, 0xB434, 0xB5CE, 0xB450, - 0xB5CF, 0xB451, 0xB5D0, 0xB454, 0xB5D1, 0xB458, 0xB5D2, 0xB460, - 0xB5D3, 0xB461, 0xB5D4, 0xB463, 0xB5D5, 0xB465, 0xB5D6, 0xB46C, - 0xB5D7, 0xB480, 0xB5D8, 0xB488, 0xB5D9, 0xB49D, 0xB5DA, 0xB4A4, - 0xB5DB, 0xB4A8, 0xB5DC, 0xB4AC, 0xB5DD, 0xB4B5, 0xB5DE, 0xB4B7, - 0xB5DF, 0xB4B9, 0xB5E0, 0xB4C0, 0xB5E1, 0xB4C4, 0xB5E2, 0xB4C8, - 0xB5E3, 0xB4D0, 0xB5E4, 0xB4D5, 0xB5E5, 0xB4DC, 0xB5E6, 0xB4DD, - 0xB5E7, 0xB4E0, 0xB5E8, 0xB4E3, 0xB5E9, 0xB4E4, 0xB5EA, 0xB4E6, - 0xB5EB, 0xB4EC, 0xB5EC, 0xB4ED, 0xB5ED, 0xB4EF, 0xB5EE, 0xB4F1, - 0xB5EF, 0xB4F8, 0xB5F0, 0xB514, 0xB5F1, 0xB515, 0xB5F2, 0xB518, - 0xB5F3, 0xB51B, 0xB5F4, 0xB51C, 0xB5F5, 0xB524, 0xB5F6, 0xB525, - 0xB5F7, 0xB527, 0xB5F8, 0xB528, 0xB5F9, 0xB529, 0xB5FA, 0xB52A, - 0xB5FB, 0xB530, 0xB5FC, 0xB531, 0xB5FD, 0xB534, 0xB5FE, 0xB538, - 0xB641, 0xD105, 0xB642, 0xD106, 0xB643, 0xD107, 0xB644, 0xD108, - 0xB645, 0xD109, 0xB646, 0xD10A, 0xB647, 0xD10B, 0xB648, 0xD10C, - 0xB649, 0xD10E, 0xB64A, 0xD10F, 0xB64B, 0xD110, 0xB64C, 0xD111, - 0xB64D, 0xD112, 0xB64E, 0xD113, 0xB64F, 0xD114, 0xB650, 0xD115, - 0xB651, 0xD116, 0xB652, 0xD117, 0xB653, 0xD118, 0xB654, 0xD119, - 0xB655, 0xD11A, 0xB656, 0xD11B, 0xB657, 0xD11C, 0xB658, 0xD11D, - 0xB659, 0xD11E, 0xB65A, 0xD11F, 0xB661, 0xD120, 0xB662, 0xD121, - 0xB663, 0xD122, 0xB664, 0xD123, 0xB665, 0xD124, 0xB666, 0xD125, - 0xB667, 0xD126, 0xB668, 0xD127, 0xB669, 0xD128, 0xB66A, 0xD129, - 0xB66B, 0xD12A, 0xB66C, 0xD12B, 0xB66D, 0xD12C, 0xB66E, 0xD12D, - 0xB66F, 0xD12E, 0xB670, 0xD12F, 0xB671, 0xD132, 0xB672, 0xD133, - 0xB673, 0xD135, 0xB674, 0xD136, 0xB675, 0xD137, 0xB676, 0xD139, - 0xB677, 0xD13B, 0xB678, 0xD13C, 0xB679, 0xD13D, 0xB67A, 0xD13E, - 0xB681, 0xD13F, 0xB682, 0xD142, 0xB683, 0xD146, 0xB684, 0xD147, - 0xB685, 0xD148, 0xB686, 0xD149, 0xB687, 0xD14A, 0xB688, 0xD14B, - 0xB689, 0xD14E, 0xB68A, 0xD14F, 0xB68B, 0xD151, 0xB68C, 0xD152, - 0xB68D, 0xD153, 0xB68E, 0xD155, 0xB68F, 0xD156, 0xB690, 0xD157, - 0xB691, 0xD158, 0xB692, 0xD159, 0xB693, 0xD15A, 0xB694, 0xD15B, - 0xB695, 0xD15E, 0xB696, 0xD160, 0xB697, 0xD162, 0xB698, 0xD163, - 0xB699, 0xD164, 0xB69A, 0xD165, 0xB69B, 0xD166, 0xB69C, 0xD167, - 0xB69D, 0xD169, 0xB69E, 0xD16A, 0xB69F, 0xD16B, 0xB6A0, 0xD16D, - 0xB6A1, 0xB540, 0xB6A2, 0xB541, 0xB6A3, 0xB543, 0xB6A4, 0xB544, - 0xB6A5, 0xB545, 0xB6A6, 0xB54B, 0xB6A7, 0xB54C, 0xB6A8, 0xB54D, - 0xB6A9, 0xB550, 0xB6AA, 0xB554, 0xB6AB, 0xB55C, 0xB6AC, 0xB55D, - 0xB6AD, 0xB55F, 0xB6AE, 0xB560, 0xB6AF, 0xB561, 0xB6B0, 0xB5A0, - 0xB6B1, 0xB5A1, 0xB6B2, 0xB5A4, 0xB6B3, 0xB5A8, 0xB6B4, 0xB5AA, - 0xB6B5, 0xB5AB, 0xB6B6, 0xB5B0, 0xB6B7, 0xB5B1, 0xB6B8, 0xB5B3, - 0xB6B9, 0xB5B4, 0xB6BA, 0xB5B5, 0xB6BB, 0xB5BB, 0xB6BC, 0xB5BC, - 0xB6BD, 0xB5BD, 0xB6BE, 0xB5C0, 0xB6BF, 0xB5C4, 0xB6C0, 0xB5CC, - 0xB6C1, 0xB5CD, 0xB6C2, 0xB5CF, 0xB6C3, 0xB5D0, 0xB6C4, 0xB5D1, - 0xB6C5, 0xB5D8, 0xB6C6, 0xB5EC, 0xB6C7, 0xB610, 0xB6C8, 0xB611, - 0xB6C9, 0xB614, 0xB6CA, 0xB618, 0xB6CB, 0xB625, 0xB6CC, 0xB62C, - 0xB6CD, 0xB634, 0xB6CE, 0xB648, 0xB6CF, 0xB664, 0xB6D0, 0xB668, - 0xB6D1, 0xB69C, 0xB6D2, 0xB69D, 0xB6D3, 0xB6A0, 0xB6D4, 0xB6A4, - 0xB6D5, 0xB6AB, 0xB6D6, 0xB6AC, 0xB6D7, 0xB6B1, 0xB6D8, 0xB6D4, - 0xB6D9, 0xB6F0, 0xB6DA, 0xB6F4, 0xB6DB, 0xB6F8, 0xB6DC, 0xB700, - 0xB6DD, 0xB701, 0xB6DE, 0xB705, 0xB6DF, 0xB728, 0xB6E0, 0xB729, - 0xB6E1, 0xB72C, 0xB6E2, 0xB72F, 0xB6E3, 0xB730, 0xB6E4, 0xB738, - 0xB6E5, 0xB739, 0xB6E6, 0xB73B, 0xB6E7, 0xB744, 0xB6E8, 0xB748, - 0xB6E9, 0xB74C, 0xB6EA, 0xB754, 0xB6EB, 0xB755, 0xB6EC, 0xB760, - 0xB6ED, 0xB764, 0xB6EE, 0xB768, 0xB6EF, 0xB770, 0xB6F0, 0xB771, - 0xB6F1, 0xB773, 0xB6F2, 0xB775, 0xB6F3, 0xB77C, 0xB6F4, 0xB77D, - 0xB6F5, 0xB780, 0xB6F6, 0xB784, 0xB6F7, 0xB78C, 0xB6F8, 0xB78D, - 0xB6F9, 0xB78F, 0xB6FA, 0xB790, 0xB6FB, 0xB791, 0xB6FC, 0xB792, - 0xB6FD, 0xB796, 0xB6FE, 0xB797, 0xB741, 0xD16E, 0xB742, 0xD16F, - 0xB743, 0xD170, 0xB744, 0xD171, 0xB745, 0xD172, 0xB746, 0xD173, - 0xB747, 0xD174, 0xB748, 0xD175, 0xB749, 0xD176, 0xB74A, 0xD177, - 0xB74B, 0xD178, 0xB74C, 0xD179, 0xB74D, 0xD17A, 0xB74E, 0xD17B, - 0xB74F, 0xD17D, 0xB750, 0xD17E, 0xB751, 0xD17F, 0xB752, 0xD180, - 0xB753, 0xD181, 0xB754, 0xD182, 0xB755, 0xD183, 0xB756, 0xD185, - 0xB757, 0xD186, 0xB758, 0xD187, 0xB759, 0xD189, 0xB75A, 0xD18A, - 0xB761, 0xD18B, 0xB762, 0xD18C, 0xB763, 0xD18D, 0xB764, 0xD18E, - 0xB765, 0xD18F, 0xB766, 0xD190, 0xB767, 0xD191, 0xB768, 0xD192, - 0xB769, 0xD193, 0xB76A, 0xD194, 0xB76B, 0xD195, 0xB76C, 0xD196, - 0xB76D, 0xD197, 0xB76E, 0xD198, 0xB76F, 0xD199, 0xB770, 0xD19A, - 0xB771, 0xD19B, 0xB772, 0xD19C, 0xB773, 0xD19D, 0xB774, 0xD19E, - 0xB775, 0xD19F, 0xB776, 0xD1A2, 0xB777, 0xD1A3, 0xB778, 0xD1A5, - 0xB779, 0xD1A6, 0xB77A, 0xD1A7, 0xB781, 0xD1A9, 0xB782, 0xD1AA, - 0xB783, 0xD1AB, 0xB784, 0xD1AC, 0xB785, 0xD1AD, 0xB786, 0xD1AE, - 0xB787, 0xD1AF, 0xB788, 0xD1B2, 0xB789, 0xD1B4, 0xB78A, 0xD1B6, - 0xB78B, 0xD1B7, 0xB78C, 0xD1B8, 0xB78D, 0xD1B9, 0xB78E, 0xD1BB, - 0xB78F, 0xD1BD, 0xB790, 0xD1BE, 0xB791, 0xD1BF, 0xB792, 0xD1C1, - 0xB793, 0xD1C2, 0xB794, 0xD1C3, 0xB795, 0xD1C4, 0xB796, 0xD1C5, - 0xB797, 0xD1C6, 0xB798, 0xD1C7, 0xB799, 0xD1C8, 0xB79A, 0xD1C9, - 0xB79B, 0xD1CA, 0xB79C, 0xD1CB, 0xB79D, 0xD1CC, 0xB79E, 0xD1CD, - 0xB79F, 0xD1CE, 0xB7A0, 0xD1CF, 0xB7A1, 0xB798, 0xB7A2, 0xB799, - 0xB7A3, 0xB79C, 0xB7A4, 0xB7A0, 0xB7A5, 0xB7A8, 0xB7A6, 0xB7A9, - 0xB7A7, 0xB7AB, 0xB7A8, 0xB7AC, 0xB7A9, 0xB7AD, 0xB7AA, 0xB7B4, - 0xB7AB, 0xB7B5, 0xB7AC, 0xB7B8, 0xB7AD, 0xB7C7, 0xB7AE, 0xB7C9, - 0xB7AF, 0xB7EC, 0xB7B0, 0xB7ED, 0xB7B1, 0xB7F0, 0xB7B2, 0xB7F4, - 0xB7B3, 0xB7FC, 0xB7B4, 0xB7FD, 0xB7B5, 0xB7FF, 0xB7B6, 0xB800, - 0xB7B7, 0xB801, 0xB7B8, 0xB807, 0xB7B9, 0xB808, 0xB7BA, 0xB809, - 0xB7BB, 0xB80C, 0xB7BC, 0xB810, 0xB7BD, 0xB818, 0xB7BE, 0xB819, - 0xB7BF, 0xB81B, 0xB7C0, 0xB81D, 0xB7C1, 0xB824, 0xB7C2, 0xB825, - 0xB7C3, 0xB828, 0xB7C4, 0xB82C, 0xB7C5, 0xB834, 0xB7C6, 0xB835, - 0xB7C7, 0xB837, 0xB7C8, 0xB838, 0xB7C9, 0xB839, 0xB7CA, 0xB840, - 0xB7CB, 0xB844, 0xB7CC, 0xB851, 0xB7CD, 0xB853, 0xB7CE, 0xB85C, - 0xB7CF, 0xB85D, 0xB7D0, 0xB860, 0xB7D1, 0xB864, 0xB7D2, 0xB86C, - 0xB7D3, 0xB86D, 0xB7D4, 0xB86F, 0xB7D5, 0xB871, 0xB7D6, 0xB878, - 0xB7D7, 0xB87C, 0xB7D8, 0xB88D, 0xB7D9, 0xB8A8, 0xB7DA, 0xB8B0, - 0xB7DB, 0xB8B4, 0xB7DC, 0xB8B8, 0xB7DD, 0xB8C0, 0xB7DE, 0xB8C1, - 0xB7DF, 0xB8C3, 0xB7E0, 0xB8C5, 0xB7E1, 0xB8CC, 0xB7E2, 0xB8D0, - 0xB7E3, 0xB8D4, 0xB7E4, 0xB8DD, 0xB7E5, 0xB8DF, 0xB7E6, 0xB8E1, - 0xB7E7, 0xB8E8, 0xB7E8, 0xB8E9, 0xB7E9, 0xB8EC, 0xB7EA, 0xB8F0, - 0xB7EB, 0xB8F8, 0xB7EC, 0xB8F9, 0xB7ED, 0xB8FB, 0xB7EE, 0xB8FD, - 0xB7EF, 0xB904, 0xB7F0, 0xB918, 0xB7F1, 0xB920, 0xB7F2, 0xB93C, - 0xB7F3, 0xB93D, 0xB7F4, 0xB940, 0xB7F5, 0xB944, 0xB7F6, 0xB94C, - 0xB7F7, 0xB94F, 0xB7F8, 0xB951, 0xB7F9, 0xB958, 0xB7FA, 0xB959, - 0xB7FB, 0xB95C, 0xB7FC, 0xB960, 0xB7FD, 0xB968, 0xB7FE, 0xB969, - 0xB841, 0xD1D0, 0xB842, 0xD1D1, 0xB843, 0xD1D2, 0xB844, 0xD1D3, - 0xB845, 0xD1D4, 0xB846, 0xD1D5, 0xB847, 0xD1D6, 0xB848, 0xD1D7, - 0xB849, 0xD1D9, 0xB84A, 0xD1DA, 0xB84B, 0xD1DB, 0xB84C, 0xD1DC, - 0xB84D, 0xD1DD, 0xB84E, 0xD1DE, 0xB84F, 0xD1DF, 0xB850, 0xD1E0, - 0xB851, 0xD1E1, 0xB852, 0xD1E2, 0xB853, 0xD1E3, 0xB854, 0xD1E4, - 0xB855, 0xD1E5, 0xB856, 0xD1E6, 0xB857, 0xD1E7, 0xB858, 0xD1E8, - 0xB859, 0xD1E9, 0xB85A, 0xD1EA, 0xB861, 0xD1EB, 0xB862, 0xD1EC, - 0xB863, 0xD1ED, 0xB864, 0xD1EE, 0xB865, 0xD1EF, 0xB866, 0xD1F0, - 0xB867, 0xD1F1, 0xB868, 0xD1F2, 0xB869, 0xD1F3, 0xB86A, 0xD1F5, - 0xB86B, 0xD1F6, 0xB86C, 0xD1F7, 0xB86D, 0xD1F9, 0xB86E, 0xD1FA, - 0xB86F, 0xD1FB, 0xB870, 0xD1FC, 0xB871, 0xD1FD, 0xB872, 0xD1FE, - 0xB873, 0xD1FF, 0xB874, 0xD200, 0xB875, 0xD201, 0xB876, 0xD202, - 0xB877, 0xD203, 0xB878, 0xD204, 0xB879, 0xD205, 0xB87A, 0xD206, - 0xB881, 0xD208, 0xB882, 0xD20A, 0xB883, 0xD20B, 0xB884, 0xD20C, - 0xB885, 0xD20D, 0xB886, 0xD20E, 0xB887, 0xD20F, 0xB888, 0xD211, - 0xB889, 0xD212, 0xB88A, 0xD213, 0xB88B, 0xD214, 0xB88C, 0xD215, - 0xB88D, 0xD216, 0xB88E, 0xD217, 0xB88F, 0xD218, 0xB890, 0xD219, - 0xB891, 0xD21A, 0xB892, 0xD21B, 0xB893, 0xD21C, 0xB894, 0xD21D, - 0xB895, 0xD21E, 0xB896, 0xD21F, 0xB897, 0xD220, 0xB898, 0xD221, - 0xB899, 0xD222, 0xB89A, 0xD223, 0xB89B, 0xD224, 0xB89C, 0xD225, - 0xB89D, 0xD226, 0xB89E, 0xD227, 0xB89F, 0xD228, 0xB8A0, 0xD229, - 0xB8A1, 0xB96B, 0xB8A2, 0xB96D, 0xB8A3, 0xB974, 0xB8A4, 0xB975, - 0xB8A5, 0xB978, 0xB8A6, 0xB97C, 0xB8A7, 0xB984, 0xB8A8, 0xB985, - 0xB8A9, 0xB987, 0xB8AA, 0xB989, 0xB8AB, 0xB98A, 0xB8AC, 0xB98D, - 0xB8AD, 0xB98E, 0xB8AE, 0xB9AC, 0xB8AF, 0xB9AD, 0xB8B0, 0xB9B0, - 0xB8B1, 0xB9B4, 0xB8B2, 0xB9BC, 0xB8B3, 0xB9BD, 0xB8B4, 0xB9BF, - 0xB8B5, 0xB9C1, 0xB8B6, 0xB9C8, 0xB8B7, 0xB9C9, 0xB8B8, 0xB9CC, - 0xB8B9, 0xB9CE, 0xB8BA, 0xB9CF, 0xB8BB, 0xB9D0, 0xB8BC, 0xB9D1, - 0xB8BD, 0xB9D2, 0xB8BE, 0xB9D8, 0xB8BF, 0xB9D9, 0xB8C0, 0xB9DB, - 0xB8C1, 0xB9DD, 0xB8C2, 0xB9DE, 0xB8C3, 0xB9E1, 0xB8C4, 0xB9E3, - 0xB8C5, 0xB9E4, 0xB8C6, 0xB9E5, 0xB8C7, 0xB9E8, 0xB8C8, 0xB9EC, - 0xB8C9, 0xB9F4, 0xB8CA, 0xB9F5, 0xB8CB, 0xB9F7, 0xB8CC, 0xB9F8, - 0xB8CD, 0xB9F9, 0xB8CE, 0xB9FA, 0xB8CF, 0xBA00, 0xB8D0, 0xBA01, - 0xB8D1, 0xBA08, 0xB8D2, 0xBA15, 0xB8D3, 0xBA38, 0xB8D4, 0xBA39, - 0xB8D5, 0xBA3C, 0xB8D6, 0xBA40, 0xB8D7, 0xBA42, 0xB8D8, 0xBA48, - 0xB8D9, 0xBA49, 0xB8DA, 0xBA4B, 0xB8DB, 0xBA4D, 0xB8DC, 0xBA4E, - 0xB8DD, 0xBA53, 0xB8DE, 0xBA54, 0xB8DF, 0xBA55, 0xB8E0, 0xBA58, - 0xB8E1, 0xBA5C, 0xB8E2, 0xBA64, 0xB8E3, 0xBA65, 0xB8E4, 0xBA67, - 0xB8E5, 0xBA68, 0xB8E6, 0xBA69, 0xB8E7, 0xBA70, 0xB8E8, 0xBA71, - 0xB8E9, 0xBA74, 0xB8EA, 0xBA78, 0xB8EB, 0xBA83, 0xB8EC, 0xBA84, - 0xB8ED, 0xBA85, 0xB8EE, 0xBA87, 0xB8EF, 0xBA8C, 0xB8F0, 0xBAA8, - 0xB8F1, 0xBAA9, 0xB8F2, 0xBAAB, 0xB8F3, 0xBAAC, 0xB8F4, 0xBAB0, - 0xB8F5, 0xBAB2, 0xB8F6, 0xBAB8, 0xB8F7, 0xBAB9, 0xB8F8, 0xBABB, - 0xB8F9, 0xBABD, 0xB8FA, 0xBAC4, 0xB8FB, 0xBAC8, 0xB8FC, 0xBAD8, - 0xB8FD, 0xBAD9, 0xB8FE, 0xBAFC, 0xB941, 0xD22A, 0xB942, 0xD22B, - 0xB943, 0xD22E, 0xB944, 0xD22F, 0xB945, 0xD231, 0xB946, 0xD232, - 0xB947, 0xD233, 0xB948, 0xD235, 0xB949, 0xD236, 0xB94A, 0xD237, - 0xB94B, 0xD238, 0xB94C, 0xD239, 0xB94D, 0xD23A, 0xB94E, 0xD23B, - 0xB94F, 0xD23E, 0xB950, 0xD240, 0xB951, 0xD242, 0xB952, 0xD243, - 0xB953, 0xD244, 0xB954, 0xD245, 0xB955, 0xD246, 0xB956, 0xD247, - 0xB957, 0xD249, 0xB958, 0xD24A, 0xB959, 0xD24B, 0xB95A, 0xD24C, - 0xB961, 0xD24D, 0xB962, 0xD24E, 0xB963, 0xD24F, 0xB964, 0xD250, - 0xB965, 0xD251, 0xB966, 0xD252, 0xB967, 0xD253, 0xB968, 0xD254, - 0xB969, 0xD255, 0xB96A, 0xD256, 0xB96B, 0xD257, 0xB96C, 0xD258, - 0xB96D, 0xD259, 0xB96E, 0xD25A, 0xB96F, 0xD25B, 0xB970, 0xD25D, - 0xB971, 0xD25E, 0xB972, 0xD25F, 0xB973, 0xD260, 0xB974, 0xD261, - 0xB975, 0xD262, 0xB976, 0xD263, 0xB977, 0xD265, 0xB978, 0xD266, - 0xB979, 0xD267, 0xB97A, 0xD268, 0xB981, 0xD269, 0xB982, 0xD26A, - 0xB983, 0xD26B, 0xB984, 0xD26C, 0xB985, 0xD26D, 0xB986, 0xD26E, - 0xB987, 0xD26F, 0xB988, 0xD270, 0xB989, 0xD271, 0xB98A, 0xD272, - 0xB98B, 0xD273, 0xB98C, 0xD274, 0xB98D, 0xD275, 0xB98E, 0xD276, - 0xB98F, 0xD277, 0xB990, 0xD278, 0xB991, 0xD279, 0xB992, 0xD27A, - 0xB993, 0xD27B, 0xB994, 0xD27C, 0xB995, 0xD27D, 0xB996, 0xD27E, - 0xB997, 0xD27F, 0xB998, 0xD282, 0xB999, 0xD283, 0xB99A, 0xD285, - 0xB99B, 0xD286, 0xB99C, 0xD287, 0xB99D, 0xD289, 0xB99E, 0xD28A, - 0xB99F, 0xD28B, 0xB9A0, 0xD28C, 0xB9A1, 0xBB00, 0xB9A2, 0xBB04, - 0xB9A3, 0xBB0D, 0xB9A4, 0xBB0F, 0xB9A5, 0xBB11, 0xB9A6, 0xBB18, - 0xB9A7, 0xBB1C, 0xB9A8, 0xBB20, 0xB9A9, 0xBB29, 0xB9AA, 0xBB2B, - 0xB9AB, 0xBB34, 0xB9AC, 0xBB35, 0xB9AD, 0xBB36, 0xB9AE, 0xBB38, - 0xB9AF, 0xBB3B, 0xB9B0, 0xBB3C, 0xB9B1, 0xBB3D, 0xB9B2, 0xBB3E, - 0xB9B3, 0xBB44, 0xB9B4, 0xBB45, 0xB9B5, 0xBB47, 0xB9B6, 0xBB49, - 0xB9B7, 0xBB4D, 0xB9B8, 0xBB4F, 0xB9B9, 0xBB50, 0xB9BA, 0xBB54, - 0xB9BB, 0xBB58, 0xB9BC, 0xBB61, 0xB9BD, 0xBB63, 0xB9BE, 0xBB6C, - 0xB9BF, 0xBB88, 0xB9C0, 0xBB8C, 0xB9C1, 0xBB90, 0xB9C2, 0xBBA4, - 0xB9C3, 0xBBA8, 0xB9C4, 0xBBAC, 0xB9C5, 0xBBB4, 0xB9C6, 0xBBB7, - 0xB9C7, 0xBBC0, 0xB9C8, 0xBBC4, 0xB9C9, 0xBBC8, 0xB9CA, 0xBBD0, - 0xB9CB, 0xBBD3, 0xB9CC, 0xBBF8, 0xB9CD, 0xBBF9, 0xB9CE, 0xBBFC, - 0xB9CF, 0xBBFF, 0xB9D0, 0xBC00, 0xB9D1, 0xBC02, 0xB9D2, 0xBC08, - 0xB9D3, 0xBC09, 0xB9D4, 0xBC0B, 0xB9D5, 0xBC0C, 0xB9D6, 0xBC0D, - 0xB9D7, 0xBC0F, 0xB9D8, 0xBC11, 0xB9D9, 0xBC14, 0xB9DA, 0xBC15, - 0xB9DB, 0xBC16, 0xB9DC, 0xBC17, 0xB9DD, 0xBC18, 0xB9DE, 0xBC1B, - 0xB9DF, 0xBC1C, 0xB9E0, 0xBC1D, 0xB9E1, 0xBC1E, 0xB9E2, 0xBC1F, - 0xB9E3, 0xBC24, 0xB9E4, 0xBC25, 0xB9E5, 0xBC27, 0xB9E6, 0xBC29, - 0xB9E7, 0xBC2D, 0xB9E8, 0xBC30, 0xB9E9, 0xBC31, 0xB9EA, 0xBC34, - 0xB9EB, 0xBC38, 0xB9EC, 0xBC40, 0xB9ED, 0xBC41, 0xB9EE, 0xBC43, - 0xB9EF, 0xBC44, 0xB9F0, 0xBC45, 0xB9F1, 0xBC49, 0xB9F2, 0xBC4C, - 0xB9F3, 0xBC4D, 0xB9F4, 0xBC50, 0xB9F5, 0xBC5D, 0xB9F6, 0xBC84, - 0xB9F7, 0xBC85, 0xB9F8, 0xBC88, 0xB9F9, 0xBC8B, 0xB9FA, 0xBC8C, - 0xB9FB, 0xBC8E, 0xB9FC, 0xBC94, 0xB9FD, 0xBC95, 0xB9FE, 0xBC97, - 0xBA41, 0xD28D, 0xBA42, 0xD28E, 0xBA43, 0xD28F, 0xBA44, 0xD292, - 0xBA45, 0xD293, 0xBA46, 0xD294, 0xBA47, 0xD296, 0xBA48, 0xD297, - 0xBA49, 0xD298, 0xBA4A, 0xD299, 0xBA4B, 0xD29A, 0xBA4C, 0xD29B, - 0xBA4D, 0xD29D, 0xBA4E, 0xD29E, 0xBA4F, 0xD29F, 0xBA50, 0xD2A1, - 0xBA51, 0xD2A2, 0xBA52, 0xD2A3, 0xBA53, 0xD2A5, 0xBA54, 0xD2A6, - 0xBA55, 0xD2A7, 0xBA56, 0xD2A8, 0xBA57, 0xD2A9, 0xBA58, 0xD2AA, - 0xBA59, 0xD2AB, 0xBA5A, 0xD2AD, 0xBA61, 0xD2AE, 0xBA62, 0xD2AF, - 0xBA63, 0xD2B0, 0xBA64, 0xD2B2, 0xBA65, 0xD2B3, 0xBA66, 0xD2B4, - 0xBA67, 0xD2B5, 0xBA68, 0xD2B6, 0xBA69, 0xD2B7, 0xBA6A, 0xD2BA, - 0xBA6B, 0xD2BB, 0xBA6C, 0xD2BD, 0xBA6D, 0xD2BE, 0xBA6E, 0xD2C1, - 0xBA6F, 0xD2C3, 0xBA70, 0xD2C4, 0xBA71, 0xD2C5, 0xBA72, 0xD2C6, - 0xBA73, 0xD2C7, 0xBA74, 0xD2CA, 0xBA75, 0xD2CC, 0xBA76, 0xD2CD, - 0xBA77, 0xD2CE, 0xBA78, 0xD2CF, 0xBA79, 0xD2D0, 0xBA7A, 0xD2D1, - 0xBA81, 0xD2D2, 0xBA82, 0xD2D3, 0xBA83, 0xD2D5, 0xBA84, 0xD2D6, - 0xBA85, 0xD2D7, 0xBA86, 0xD2D9, 0xBA87, 0xD2DA, 0xBA88, 0xD2DB, - 0xBA89, 0xD2DD, 0xBA8A, 0xD2DE, 0xBA8B, 0xD2DF, 0xBA8C, 0xD2E0, - 0xBA8D, 0xD2E1, 0xBA8E, 0xD2E2, 0xBA8F, 0xD2E3, 0xBA90, 0xD2E6, - 0xBA91, 0xD2E7, 0xBA92, 0xD2E8, 0xBA93, 0xD2E9, 0xBA94, 0xD2EA, - 0xBA95, 0xD2EB, 0xBA96, 0xD2EC, 0xBA97, 0xD2ED, 0xBA98, 0xD2EE, - 0xBA99, 0xD2EF, 0xBA9A, 0xD2F2, 0xBA9B, 0xD2F3, 0xBA9C, 0xD2F5, - 0xBA9D, 0xD2F6, 0xBA9E, 0xD2F7, 0xBA9F, 0xD2F9, 0xBAA0, 0xD2FA, - 0xBAA1, 0xBC99, 0xBAA2, 0xBC9A, 0xBAA3, 0xBCA0, 0xBAA4, 0xBCA1, - 0xBAA5, 0xBCA4, 0xBAA6, 0xBCA7, 0xBAA7, 0xBCA8, 0xBAA8, 0xBCB0, - 0xBAA9, 0xBCB1, 0xBAAA, 0xBCB3, 0xBAAB, 0xBCB4, 0xBAAC, 0xBCB5, - 0xBAAD, 0xBCBC, 0xBAAE, 0xBCBD, 0xBAAF, 0xBCC0, 0xBAB0, 0xBCC4, - 0xBAB1, 0xBCCD, 0xBAB2, 0xBCCF, 0xBAB3, 0xBCD0, 0xBAB4, 0xBCD1, - 0xBAB5, 0xBCD5, 0xBAB6, 0xBCD8, 0xBAB7, 0xBCDC, 0xBAB8, 0xBCF4, - 0xBAB9, 0xBCF5, 0xBABA, 0xBCF6, 0xBABB, 0xBCF8, 0xBABC, 0xBCFC, - 0xBABD, 0xBD04, 0xBABE, 0xBD05, 0xBABF, 0xBD07, 0xBAC0, 0xBD09, - 0xBAC1, 0xBD10, 0xBAC2, 0xBD14, 0xBAC3, 0xBD24, 0xBAC4, 0xBD2C, - 0xBAC5, 0xBD40, 0xBAC6, 0xBD48, 0xBAC7, 0xBD49, 0xBAC8, 0xBD4C, - 0xBAC9, 0xBD50, 0xBACA, 0xBD58, 0xBACB, 0xBD59, 0xBACC, 0xBD64, - 0xBACD, 0xBD68, 0xBACE, 0xBD80, 0xBACF, 0xBD81, 0xBAD0, 0xBD84, - 0xBAD1, 0xBD87, 0xBAD2, 0xBD88, 0xBAD3, 0xBD89, 0xBAD4, 0xBD8A, - 0xBAD5, 0xBD90, 0xBAD6, 0xBD91, 0xBAD7, 0xBD93, 0xBAD8, 0xBD95, - 0xBAD9, 0xBD99, 0xBADA, 0xBD9A, 0xBADB, 0xBD9C, 0xBADC, 0xBDA4, - 0xBADD, 0xBDB0, 0xBADE, 0xBDB8, 0xBADF, 0xBDD4, 0xBAE0, 0xBDD5, - 0xBAE1, 0xBDD8, 0xBAE2, 0xBDDC, 0xBAE3, 0xBDE9, 0xBAE4, 0xBDF0, - 0xBAE5, 0xBDF4, 0xBAE6, 0xBDF8, 0xBAE7, 0xBE00, 0xBAE8, 0xBE03, - 0xBAE9, 0xBE05, 0xBAEA, 0xBE0C, 0xBAEB, 0xBE0D, 0xBAEC, 0xBE10, - 0xBAED, 0xBE14, 0xBAEE, 0xBE1C, 0xBAEF, 0xBE1D, 0xBAF0, 0xBE1F, - 0xBAF1, 0xBE44, 0xBAF2, 0xBE45, 0xBAF3, 0xBE48, 0xBAF4, 0xBE4C, - 0xBAF5, 0xBE4E, 0xBAF6, 0xBE54, 0xBAF7, 0xBE55, 0xBAF8, 0xBE57, - 0xBAF9, 0xBE59, 0xBAFA, 0xBE5A, 0xBAFB, 0xBE5B, 0xBAFC, 0xBE60, - 0xBAFD, 0xBE61, 0xBAFE, 0xBE64, 0xBB41, 0xD2FB, 0xBB42, 0xD2FC, - 0xBB43, 0xD2FD, 0xBB44, 0xD2FE, 0xBB45, 0xD2FF, 0xBB46, 0xD302, - 0xBB47, 0xD304, 0xBB48, 0xD306, 0xBB49, 0xD307, 0xBB4A, 0xD308, - 0xBB4B, 0xD309, 0xBB4C, 0xD30A, 0xBB4D, 0xD30B, 0xBB4E, 0xD30F, - 0xBB4F, 0xD311, 0xBB50, 0xD312, 0xBB51, 0xD313, 0xBB52, 0xD315, - 0xBB53, 0xD317, 0xBB54, 0xD318, 0xBB55, 0xD319, 0xBB56, 0xD31A, - 0xBB57, 0xD31B, 0xBB58, 0xD31E, 0xBB59, 0xD322, 0xBB5A, 0xD323, - 0xBB61, 0xD324, 0xBB62, 0xD326, 0xBB63, 0xD327, 0xBB64, 0xD32A, - 0xBB65, 0xD32B, 0xBB66, 0xD32D, 0xBB67, 0xD32E, 0xBB68, 0xD32F, - 0xBB69, 0xD331, 0xBB6A, 0xD332, 0xBB6B, 0xD333, 0xBB6C, 0xD334, - 0xBB6D, 0xD335, 0xBB6E, 0xD336, 0xBB6F, 0xD337, 0xBB70, 0xD33A, - 0xBB71, 0xD33E, 0xBB72, 0xD33F, 0xBB73, 0xD340, 0xBB74, 0xD341, - 0xBB75, 0xD342, 0xBB76, 0xD343, 0xBB77, 0xD346, 0xBB78, 0xD347, - 0xBB79, 0xD348, 0xBB7A, 0xD349, 0xBB81, 0xD34A, 0xBB82, 0xD34B, - 0xBB83, 0xD34C, 0xBB84, 0xD34D, 0xBB85, 0xD34E, 0xBB86, 0xD34F, - 0xBB87, 0xD350, 0xBB88, 0xD351, 0xBB89, 0xD352, 0xBB8A, 0xD353, - 0xBB8B, 0xD354, 0xBB8C, 0xD355, 0xBB8D, 0xD356, 0xBB8E, 0xD357, - 0xBB8F, 0xD358, 0xBB90, 0xD359, 0xBB91, 0xD35A, 0xBB92, 0xD35B, - 0xBB93, 0xD35C, 0xBB94, 0xD35D, 0xBB95, 0xD35E, 0xBB96, 0xD35F, - 0xBB97, 0xD360, 0xBB98, 0xD361, 0xBB99, 0xD362, 0xBB9A, 0xD363, - 0xBB9B, 0xD364, 0xBB9C, 0xD365, 0xBB9D, 0xD366, 0xBB9E, 0xD367, - 0xBB9F, 0xD368, 0xBBA0, 0xD369, 0xBBA1, 0xBE68, 0xBBA2, 0xBE6A, - 0xBBA3, 0xBE70, 0xBBA4, 0xBE71, 0xBBA5, 0xBE73, 0xBBA6, 0xBE74, - 0xBBA7, 0xBE75, 0xBBA8, 0xBE7B, 0xBBA9, 0xBE7C, 0xBBAA, 0xBE7D, - 0xBBAB, 0xBE80, 0xBBAC, 0xBE84, 0xBBAD, 0xBE8C, 0xBBAE, 0xBE8D, - 0xBBAF, 0xBE8F, 0xBBB0, 0xBE90, 0xBBB1, 0xBE91, 0xBBB2, 0xBE98, - 0xBBB3, 0xBE99, 0xBBB4, 0xBEA8, 0xBBB5, 0xBED0, 0xBBB6, 0xBED1, - 0xBBB7, 0xBED4, 0xBBB8, 0xBED7, 0xBBB9, 0xBED8, 0xBBBA, 0xBEE0, - 0xBBBB, 0xBEE3, 0xBBBC, 0xBEE4, 0xBBBD, 0xBEE5, 0xBBBE, 0xBEEC, - 0xBBBF, 0xBF01, 0xBBC0, 0xBF08, 0xBBC1, 0xBF09, 0xBBC2, 0xBF18, - 0xBBC3, 0xBF19, 0xBBC4, 0xBF1B, 0xBBC5, 0xBF1C, 0xBBC6, 0xBF1D, - 0xBBC7, 0xBF40, 0xBBC8, 0xBF41, 0xBBC9, 0xBF44, 0xBBCA, 0xBF48, - 0xBBCB, 0xBF50, 0xBBCC, 0xBF51, 0xBBCD, 0xBF55, 0xBBCE, 0xBF94, - 0xBBCF, 0xBFB0, 0xBBD0, 0xBFC5, 0xBBD1, 0xBFCC, 0xBBD2, 0xBFCD, - 0xBBD3, 0xBFD0, 0xBBD4, 0xBFD4, 0xBBD5, 0xBFDC, 0xBBD6, 0xBFDF, - 0xBBD7, 0xBFE1, 0xBBD8, 0xC03C, 0xBBD9, 0xC051, 0xBBDA, 0xC058, - 0xBBDB, 0xC05C, 0xBBDC, 0xC060, 0xBBDD, 0xC068, 0xBBDE, 0xC069, - 0xBBDF, 0xC090, 0xBBE0, 0xC091, 0xBBE1, 0xC094, 0xBBE2, 0xC098, - 0xBBE3, 0xC0A0, 0xBBE4, 0xC0A1, 0xBBE5, 0xC0A3, 0xBBE6, 0xC0A5, - 0xBBE7, 0xC0AC, 0xBBE8, 0xC0AD, 0xBBE9, 0xC0AF, 0xBBEA, 0xC0B0, - 0xBBEB, 0xC0B3, 0xBBEC, 0xC0B4, 0xBBED, 0xC0B5, 0xBBEE, 0xC0B6, - 0xBBEF, 0xC0BC, 0xBBF0, 0xC0BD, 0xBBF1, 0xC0BF, 0xBBF2, 0xC0C0, - 0xBBF3, 0xC0C1, 0xBBF4, 0xC0C5, 0xBBF5, 0xC0C8, 0xBBF6, 0xC0C9, - 0xBBF7, 0xC0CC, 0xBBF8, 0xC0D0, 0xBBF9, 0xC0D8, 0xBBFA, 0xC0D9, - 0xBBFB, 0xC0DB, 0xBBFC, 0xC0DC, 0xBBFD, 0xC0DD, 0xBBFE, 0xC0E4, - 0xBC41, 0xD36A, 0xBC42, 0xD36B, 0xBC43, 0xD36C, 0xBC44, 0xD36D, - 0xBC45, 0xD36E, 0xBC46, 0xD36F, 0xBC47, 0xD370, 0xBC48, 0xD371, - 0xBC49, 0xD372, 0xBC4A, 0xD373, 0xBC4B, 0xD374, 0xBC4C, 0xD375, - 0xBC4D, 0xD376, 0xBC4E, 0xD377, 0xBC4F, 0xD378, 0xBC50, 0xD379, - 0xBC51, 0xD37A, 0xBC52, 0xD37B, 0xBC53, 0xD37E, 0xBC54, 0xD37F, - 0xBC55, 0xD381, 0xBC56, 0xD382, 0xBC57, 0xD383, 0xBC58, 0xD385, - 0xBC59, 0xD386, 0xBC5A, 0xD387, 0xBC61, 0xD388, 0xBC62, 0xD389, - 0xBC63, 0xD38A, 0xBC64, 0xD38B, 0xBC65, 0xD38E, 0xBC66, 0xD392, - 0xBC67, 0xD393, 0xBC68, 0xD394, 0xBC69, 0xD395, 0xBC6A, 0xD396, - 0xBC6B, 0xD397, 0xBC6C, 0xD39A, 0xBC6D, 0xD39B, 0xBC6E, 0xD39D, - 0xBC6F, 0xD39E, 0xBC70, 0xD39F, 0xBC71, 0xD3A1, 0xBC72, 0xD3A2, - 0xBC73, 0xD3A3, 0xBC74, 0xD3A4, 0xBC75, 0xD3A5, 0xBC76, 0xD3A6, - 0xBC77, 0xD3A7, 0xBC78, 0xD3AA, 0xBC79, 0xD3AC, 0xBC7A, 0xD3AE, - 0xBC81, 0xD3AF, 0xBC82, 0xD3B0, 0xBC83, 0xD3B1, 0xBC84, 0xD3B2, - 0xBC85, 0xD3B3, 0xBC86, 0xD3B5, 0xBC87, 0xD3B6, 0xBC88, 0xD3B7, - 0xBC89, 0xD3B9, 0xBC8A, 0xD3BA, 0xBC8B, 0xD3BB, 0xBC8C, 0xD3BD, - 0xBC8D, 0xD3BE, 0xBC8E, 0xD3BF, 0xBC8F, 0xD3C0, 0xBC90, 0xD3C1, - 0xBC91, 0xD3C2, 0xBC92, 0xD3C3, 0xBC93, 0xD3C6, 0xBC94, 0xD3C7, - 0xBC95, 0xD3CA, 0xBC96, 0xD3CB, 0xBC97, 0xD3CC, 0xBC98, 0xD3CD, - 0xBC99, 0xD3CE, 0xBC9A, 0xD3CF, 0xBC9B, 0xD3D1, 0xBC9C, 0xD3D2, - 0xBC9D, 0xD3D3, 0xBC9E, 0xD3D4, 0xBC9F, 0xD3D5, 0xBCA0, 0xD3D6, - 0xBCA1, 0xC0E5, 0xBCA2, 0xC0E8, 0xBCA3, 0xC0EC, 0xBCA4, 0xC0F4, - 0xBCA5, 0xC0F5, 0xBCA6, 0xC0F7, 0xBCA7, 0xC0F9, 0xBCA8, 0xC100, - 0xBCA9, 0xC104, 0xBCAA, 0xC108, 0xBCAB, 0xC110, 0xBCAC, 0xC115, - 0xBCAD, 0xC11C, 0xBCAE, 0xC11D, 0xBCAF, 0xC11E, 0xBCB0, 0xC11F, - 0xBCB1, 0xC120, 0xBCB2, 0xC123, 0xBCB3, 0xC124, 0xBCB4, 0xC126, - 0xBCB5, 0xC127, 0xBCB6, 0xC12C, 0xBCB7, 0xC12D, 0xBCB8, 0xC12F, - 0xBCB9, 0xC130, 0xBCBA, 0xC131, 0xBCBB, 0xC136, 0xBCBC, 0xC138, - 0xBCBD, 0xC139, 0xBCBE, 0xC13C, 0xBCBF, 0xC140, 0xBCC0, 0xC148, - 0xBCC1, 0xC149, 0xBCC2, 0xC14B, 0xBCC3, 0xC14C, 0xBCC4, 0xC14D, - 0xBCC5, 0xC154, 0xBCC6, 0xC155, 0xBCC7, 0xC158, 0xBCC8, 0xC15C, - 0xBCC9, 0xC164, 0xBCCA, 0xC165, 0xBCCB, 0xC167, 0xBCCC, 0xC168, - 0xBCCD, 0xC169, 0xBCCE, 0xC170, 0xBCCF, 0xC174, 0xBCD0, 0xC178, - 0xBCD1, 0xC185, 0xBCD2, 0xC18C, 0xBCD3, 0xC18D, 0xBCD4, 0xC18E, - 0xBCD5, 0xC190, 0xBCD6, 0xC194, 0xBCD7, 0xC196, 0xBCD8, 0xC19C, - 0xBCD9, 0xC19D, 0xBCDA, 0xC19F, 0xBCDB, 0xC1A1, 0xBCDC, 0xC1A5, - 0xBCDD, 0xC1A8, 0xBCDE, 0xC1A9, 0xBCDF, 0xC1AC, 0xBCE0, 0xC1B0, - 0xBCE1, 0xC1BD, 0xBCE2, 0xC1C4, 0xBCE3, 0xC1C8, 0xBCE4, 0xC1CC, - 0xBCE5, 0xC1D4, 0xBCE6, 0xC1D7, 0xBCE7, 0xC1D8, 0xBCE8, 0xC1E0, - 0xBCE9, 0xC1E4, 0xBCEA, 0xC1E8, 0xBCEB, 0xC1F0, 0xBCEC, 0xC1F1, - 0xBCED, 0xC1F3, 0xBCEE, 0xC1FC, 0xBCEF, 0xC1FD, 0xBCF0, 0xC200, - 0xBCF1, 0xC204, 0xBCF2, 0xC20C, 0xBCF3, 0xC20D, 0xBCF4, 0xC20F, - 0xBCF5, 0xC211, 0xBCF6, 0xC218, 0xBCF7, 0xC219, 0xBCF8, 0xC21C, - 0xBCF9, 0xC21F, 0xBCFA, 0xC220, 0xBCFB, 0xC228, 0xBCFC, 0xC229, - 0xBCFD, 0xC22B, 0xBCFE, 0xC22D, 0xBD41, 0xD3D7, 0xBD42, 0xD3D9, - 0xBD43, 0xD3DA, 0xBD44, 0xD3DB, 0xBD45, 0xD3DC, 0xBD46, 0xD3DD, - 0xBD47, 0xD3DE, 0xBD48, 0xD3DF, 0xBD49, 0xD3E0, 0xBD4A, 0xD3E2, - 0xBD4B, 0xD3E4, 0xBD4C, 0xD3E5, 0xBD4D, 0xD3E6, 0xBD4E, 0xD3E7, - 0xBD4F, 0xD3E8, 0xBD50, 0xD3E9, 0xBD51, 0xD3EA, 0xBD52, 0xD3EB, - 0xBD53, 0xD3EE, 0xBD54, 0xD3EF, 0xBD55, 0xD3F1, 0xBD56, 0xD3F2, - 0xBD57, 0xD3F3, 0xBD58, 0xD3F5, 0xBD59, 0xD3F6, 0xBD5A, 0xD3F7, - 0xBD61, 0xD3F8, 0xBD62, 0xD3F9, 0xBD63, 0xD3FA, 0xBD64, 0xD3FB, - 0xBD65, 0xD3FE, 0xBD66, 0xD400, 0xBD67, 0xD402, 0xBD68, 0xD403, - 0xBD69, 0xD404, 0xBD6A, 0xD405, 0xBD6B, 0xD406, 0xBD6C, 0xD407, - 0xBD6D, 0xD409, 0xBD6E, 0xD40A, 0xBD6F, 0xD40B, 0xBD70, 0xD40C, - 0xBD71, 0xD40D, 0xBD72, 0xD40E, 0xBD73, 0xD40F, 0xBD74, 0xD410, - 0xBD75, 0xD411, 0xBD76, 0xD412, 0xBD77, 0xD413, 0xBD78, 0xD414, - 0xBD79, 0xD415, 0xBD7A, 0xD416, 0xBD81, 0xD417, 0xBD82, 0xD418, - 0xBD83, 0xD419, 0xBD84, 0xD41A, 0xBD85, 0xD41B, 0xBD86, 0xD41C, - 0xBD87, 0xD41E, 0xBD88, 0xD41F, 0xBD89, 0xD420, 0xBD8A, 0xD421, - 0xBD8B, 0xD422, 0xBD8C, 0xD423, 0xBD8D, 0xD424, 0xBD8E, 0xD425, - 0xBD8F, 0xD426, 0xBD90, 0xD427, 0xBD91, 0xD428, 0xBD92, 0xD429, - 0xBD93, 0xD42A, 0xBD94, 0xD42B, 0xBD95, 0xD42C, 0xBD96, 0xD42D, - 0xBD97, 0xD42E, 0xBD98, 0xD42F, 0xBD99, 0xD430, 0xBD9A, 0xD431, - 0xBD9B, 0xD432, 0xBD9C, 0xD433, 0xBD9D, 0xD434, 0xBD9E, 0xD435, - 0xBD9F, 0xD436, 0xBDA0, 0xD437, 0xBDA1, 0xC22F, 0xBDA2, 0xC231, - 0xBDA3, 0xC232, 0xBDA4, 0xC234, 0xBDA5, 0xC248, 0xBDA6, 0xC250, - 0xBDA7, 0xC251, 0xBDA8, 0xC254, 0xBDA9, 0xC258, 0xBDAA, 0xC260, - 0xBDAB, 0xC265, 0xBDAC, 0xC26C, 0xBDAD, 0xC26D, 0xBDAE, 0xC270, - 0xBDAF, 0xC274, 0xBDB0, 0xC27C, 0xBDB1, 0xC27D, 0xBDB2, 0xC27F, - 0xBDB3, 0xC281, 0xBDB4, 0xC288, 0xBDB5, 0xC289, 0xBDB6, 0xC290, - 0xBDB7, 0xC298, 0xBDB8, 0xC29B, 0xBDB9, 0xC29D, 0xBDBA, 0xC2A4, - 0xBDBB, 0xC2A5, 0xBDBC, 0xC2A8, 0xBDBD, 0xC2AC, 0xBDBE, 0xC2AD, - 0xBDBF, 0xC2B4, 0xBDC0, 0xC2B5, 0xBDC1, 0xC2B7, 0xBDC2, 0xC2B9, - 0xBDC3, 0xC2DC, 0xBDC4, 0xC2DD, 0xBDC5, 0xC2E0, 0xBDC6, 0xC2E3, - 0xBDC7, 0xC2E4, 0xBDC8, 0xC2EB, 0xBDC9, 0xC2EC, 0xBDCA, 0xC2ED, - 0xBDCB, 0xC2EF, 0xBDCC, 0xC2F1, 0xBDCD, 0xC2F6, 0xBDCE, 0xC2F8, - 0xBDCF, 0xC2F9, 0xBDD0, 0xC2FB, 0xBDD1, 0xC2FC, 0xBDD2, 0xC300, - 0xBDD3, 0xC308, 0xBDD4, 0xC309, 0xBDD5, 0xC30C, 0xBDD6, 0xC30D, - 0xBDD7, 0xC313, 0xBDD8, 0xC314, 0xBDD9, 0xC315, 0xBDDA, 0xC318, - 0xBDDB, 0xC31C, 0xBDDC, 0xC324, 0xBDDD, 0xC325, 0xBDDE, 0xC328, - 0xBDDF, 0xC329, 0xBDE0, 0xC345, 0xBDE1, 0xC368, 0xBDE2, 0xC369, - 0xBDE3, 0xC36C, 0xBDE4, 0xC370, 0xBDE5, 0xC372, 0xBDE6, 0xC378, - 0xBDE7, 0xC379, 0xBDE8, 0xC37C, 0xBDE9, 0xC37D, 0xBDEA, 0xC384, - 0xBDEB, 0xC388, 0xBDEC, 0xC38C, 0xBDED, 0xC3C0, 0xBDEE, 0xC3D8, - 0xBDEF, 0xC3D9, 0xBDF0, 0xC3DC, 0xBDF1, 0xC3DF, 0xBDF2, 0xC3E0, - 0xBDF3, 0xC3E2, 0xBDF4, 0xC3E8, 0xBDF5, 0xC3E9, 0xBDF6, 0xC3ED, - 0xBDF7, 0xC3F4, 0xBDF8, 0xC3F5, 0xBDF9, 0xC3F8, 0xBDFA, 0xC408, - 0xBDFB, 0xC410, 0xBDFC, 0xC424, 0xBDFD, 0xC42C, 0xBDFE, 0xC430, - 0xBE41, 0xD438, 0xBE42, 0xD439, 0xBE43, 0xD43A, 0xBE44, 0xD43B, - 0xBE45, 0xD43C, 0xBE46, 0xD43D, 0xBE47, 0xD43E, 0xBE48, 0xD43F, - 0xBE49, 0xD441, 0xBE4A, 0xD442, 0xBE4B, 0xD443, 0xBE4C, 0xD445, - 0xBE4D, 0xD446, 0xBE4E, 0xD447, 0xBE4F, 0xD448, 0xBE50, 0xD449, - 0xBE51, 0xD44A, 0xBE52, 0xD44B, 0xBE53, 0xD44C, 0xBE54, 0xD44D, - 0xBE55, 0xD44E, 0xBE56, 0xD44F, 0xBE57, 0xD450, 0xBE58, 0xD451, - 0xBE59, 0xD452, 0xBE5A, 0xD453, 0xBE61, 0xD454, 0xBE62, 0xD455, - 0xBE63, 0xD456, 0xBE64, 0xD457, 0xBE65, 0xD458, 0xBE66, 0xD459, - 0xBE67, 0xD45A, 0xBE68, 0xD45B, 0xBE69, 0xD45D, 0xBE6A, 0xD45E, - 0xBE6B, 0xD45F, 0xBE6C, 0xD461, 0xBE6D, 0xD462, 0xBE6E, 0xD463, - 0xBE6F, 0xD465, 0xBE70, 0xD466, 0xBE71, 0xD467, 0xBE72, 0xD468, - 0xBE73, 0xD469, 0xBE74, 0xD46A, 0xBE75, 0xD46B, 0xBE76, 0xD46C, - 0xBE77, 0xD46E, 0xBE78, 0xD470, 0xBE79, 0xD471, 0xBE7A, 0xD472, - 0xBE81, 0xD473, 0xBE82, 0xD474, 0xBE83, 0xD475, 0xBE84, 0xD476, - 0xBE85, 0xD477, 0xBE86, 0xD47A, 0xBE87, 0xD47B, 0xBE88, 0xD47D, - 0xBE89, 0xD47E, 0xBE8A, 0xD481, 0xBE8B, 0xD483, 0xBE8C, 0xD484, - 0xBE8D, 0xD485, 0xBE8E, 0xD486, 0xBE8F, 0xD487, 0xBE90, 0xD48A, - 0xBE91, 0xD48C, 0xBE92, 0xD48E, 0xBE93, 0xD48F, 0xBE94, 0xD490, - 0xBE95, 0xD491, 0xBE96, 0xD492, 0xBE97, 0xD493, 0xBE98, 0xD495, - 0xBE99, 0xD496, 0xBE9A, 0xD497, 0xBE9B, 0xD498, 0xBE9C, 0xD499, - 0xBE9D, 0xD49A, 0xBE9E, 0xD49B, 0xBE9F, 0xD49C, 0xBEA0, 0xD49D, - 0xBEA1, 0xC434, 0xBEA2, 0xC43C, 0xBEA3, 0xC43D, 0xBEA4, 0xC448, - 0xBEA5, 0xC464, 0xBEA6, 0xC465, 0xBEA7, 0xC468, 0xBEA8, 0xC46C, - 0xBEA9, 0xC474, 0xBEAA, 0xC475, 0xBEAB, 0xC479, 0xBEAC, 0xC480, - 0xBEAD, 0xC494, 0xBEAE, 0xC49C, 0xBEAF, 0xC4B8, 0xBEB0, 0xC4BC, - 0xBEB1, 0xC4E9, 0xBEB2, 0xC4F0, 0xBEB3, 0xC4F1, 0xBEB4, 0xC4F4, - 0xBEB5, 0xC4F8, 0xBEB6, 0xC4FA, 0xBEB7, 0xC4FF, 0xBEB8, 0xC500, - 0xBEB9, 0xC501, 0xBEBA, 0xC50C, 0xBEBB, 0xC510, 0xBEBC, 0xC514, - 0xBEBD, 0xC51C, 0xBEBE, 0xC528, 0xBEBF, 0xC529, 0xBEC0, 0xC52C, - 0xBEC1, 0xC530, 0xBEC2, 0xC538, 0xBEC3, 0xC539, 0xBEC4, 0xC53B, - 0xBEC5, 0xC53D, 0xBEC6, 0xC544, 0xBEC7, 0xC545, 0xBEC8, 0xC548, - 0xBEC9, 0xC549, 0xBECA, 0xC54A, 0xBECB, 0xC54C, 0xBECC, 0xC54D, - 0xBECD, 0xC54E, 0xBECE, 0xC553, 0xBECF, 0xC554, 0xBED0, 0xC555, - 0xBED1, 0xC557, 0xBED2, 0xC558, 0xBED3, 0xC559, 0xBED4, 0xC55D, - 0xBED5, 0xC55E, 0xBED6, 0xC560, 0xBED7, 0xC561, 0xBED8, 0xC564, - 0xBED9, 0xC568, 0xBEDA, 0xC570, 0xBEDB, 0xC571, 0xBEDC, 0xC573, - 0xBEDD, 0xC574, 0xBEDE, 0xC575, 0xBEDF, 0xC57C, 0xBEE0, 0xC57D, - 0xBEE1, 0xC580, 0xBEE2, 0xC584, 0xBEE3, 0xC587, 0xBEE4, 0xC58C, - 0xBEE5, 0xC58D, 0xBEE6, 0xC58F, 0xBEE7, 0xC591, 0xBEE8, 0xC595, - 0xBEE9, 0xC597, 0xBEEA, 0xC598, 0xBEEB, 0xC59C, 0xBEEC, 0xC5A0, - 0xBEED, 0xC5A9, 0xBEEE, 0xC5B4, 0xBEEF, 0xC5B5, 0xBEF0, 0xC5B8, - 0xBEF1, 0xC5B9, 0xBEF2, 0xC5BB, 0xBEF3, 0xC5BC, 0xBEF4, 0xC5BD, - 0xBEF5, 0xC5BE, 0xBEF6, 0xC5C4, 0xBEF7, 0xC5C5, 0xBEF8, 0xC5C6, - 0xBEF9, 0xC5C7, 0xBEFA, 0xC5C8, 0xBEFB, 0xC5C9, 0xBEFC, 0xC5CA, - 0xBEFD, 0xC5CC, 0xBEFE, 0xC5CE, 0xBF41, 0xD49E, 0xBF42, 0xD49F, - 0xBF43, 0xD4A0, 0xBF44, 0xD4A1, 0xBF45, 0xD4A2, 0xBF46, 0xD4A3, - 0xBF47, 0xD4A4, 0xBF48, 0xD4A5, 0xBF49, 0xD4A6, 0xBF4A, 0xD4A7, - 0xBF4B, 0xD4A8, 0xBF4C, 0xD4AA, 0xBF4D, 0xD4AB, 0xBF4E, 0xD4AC, - 0xBF4F, 0xD4AD, 0xBF50, 0xD4AE, 0xBF51, 0xD4AF, 0xBF52, 0xD4B0, - 0xBF53, 0xD4B1, 0xBF54, 0xD4B2, 0xBF55, 0xD4B3, 0xBF56, 0xD4B4, - 0xBF57, 0xD4B5, 0xBF58, 0xD4B6, 0xBF59, 0xD4B7, 0xBF5A, 0xD4B8, - 0xBF61, 0xD4B9, 0xBF62, 0xD4BA, 0xBF63, 0xD4BB, 0xBF64, 0xD4BC, - 0xBF65, 0xD4BD, 0xBF66, 0xD4BE, 0xBF67, 0xD4BF, 0xBF68, 0xD4C0, - 0xBF69, 0xD4C1, 0xBF6A, 0xD4C2, 0xBF6B, 0xD4C3, 0xBF6C, 0xD4C4, - 0xBF6D, 0xD4C5, 0xBF6E, 0xD4C6, 0xBF6F, 0xD4C7, 0xBF70, 0xD4C8, - 0xBF71, 0xD4C9, 0xBF72, 0xD4CA, 0xBF73, 0xD4CB, 0xBF74, 0xD4CD, - 0xBF75, 0xD4CE, 0xBF76, 0xD4CF, 0xBF77, 0xD4D1, 0xBF78, 0xD4D2, - 0xBF79, 0xD4D3, 0xBF7A, 0xD4D5, 0xBF81, 0xD4D6, 0xBF82, 0xD4D7, - 0xBF83, 0xD4D8, 0xBF84, 0xD4D9, 0xBF85, 0xD4DA, 0xBF86, 0xD4DB, - 0xBF87, 0xD4DD, 0xBF88, 0xD4DE, 0xBF89, 0xD4E0, 0xBF8A, 0xD4E1, - 0xBF8B, 0xD4E2, 0xBF8C, 0xD4E3, 0xBF8D, 0xD4E4, 0xBF8E, 0xD4E5, - 0xBF8F, 0xD4E6, 0xBF90, 0xD4E7, 0xBF91, 0xD4E9, 0xBF92, 0xD4EA, - 0xBF93, 0xD4EB, 0xBF94, 0xD4ED, 0xBF95, 0xD4EE, 0xBF96, 0xD4EF, - 0xBF97, 0xD4F1, 0xBF98, 0xD4F2, 0xBF99, 0xD4F3, 0xBF9A, 0xD4F4, - 0xBF9B, 0xD4F5, 0xBF9C, 0xD4F6, 0xBF9D, 0xD4F7, 0xBF9E, 0xD4F9, - 0xBF9F, 0xD4FA, 0xBFA0, 0xD4FC, 0xBFA1, 0xC5D0, 0xBFA2, 0xC5D1, - 0xBFA3, 0xC5D4, 0xBFA4, 0xC5D8, 0xBFA5, 0xC5E0, 0xBFA6, 0xC5E1, - 0xBFA7, 0xC5E3, 0xBFA8, 0xC5E5, 0xBFA9, 0xC5EC, 0xBFAA, 0xC5ED, - 0xBFAB, 0xC5EE, 0xBFAC, 0xC5F0, 0xBFAD, 0xC5F4, 0xBFAE, 0xC5F6, - 0xBFAF, 0xC5F7, 0xBFB0, 0xC5FC, 0xBFB1, 0xC5FD, 0xBFB2, 0xC5FE, - 0xBFB3, 0xC5FF, 0xBFB4, 0xC600, 0xBFB5, 0xC601, 0xBFB6, 0xC605, - 0xBFB7, 0xC606, 0xBFB8, 0xC607, 0xBFB9, 0xC608, 0xBFBA, 0xC60C, - 0xBFBB, 0xC610, 0xBFBC, 0xC618, 0xBFBD, 0xC619, 0xBFBE, 0xC61B, - 0xBFBF, 0xC61C, 0xBFC0, 0xC624, 0xBFC1, 0xC625, 0xBFC2, 0xC628, - 0xBFC3, 0xC62C, 0xBFC4, 0xC62D, 0xBFC5, 0xC62E, 0xBFC6, 0xC630, - 0xBFC7, 0xC633, 0xBFC8, 0xC634, 0xBFC9, 0xC635, 0xBFCA, 0xC637, - 0xBFCB, 0xC639, 0xBFCC, 0xC63B, 0xBFCD, 0xC640, 0xBFCE, 0xC641, - 0xBFCF, 0xC644, 0xBFD0, 0xC648, 0xBFD1, 0xC650, 0xBFD2, 0xC651, - 0xBFD3, 0xC653, 0xBFD4, 0xC654, 0xBFD5, 0xC655, 0xBFD6, 0xC65C, - 0xBFD7, 0xC65D, 0xBFD8, 0xC660, 0xBFD9, 0xC66C, 0xBFDA, 0xC66F, - 0xBFDB, 0xC671, 0xBFDC, 0xC678, 0xBFDD, 0xC679, 0xBFDE, 0xC67C, - 0xBFDF, 0xC680, 0xBFE0, 0xC688, 0xBFE1, 0xC689, 0xBFE2, 0xC68B, - 0xBFE3, 0xC68D, 0xBFE4, 0xC694, 0xBFE5, 0xC695, 0xBFE6, 0xC698, - 0xBFE7, 0xC69C, 0xBFE8, 0xC6A4, 0xBFE9, 0xC6A5, 0xBFEA, 0xC6A7, - 0xBFEB, 0xC6A9, 0xBFEC, 0xC6B0, 0xBFED, 0xC6B1, 0xBFEE, 0xC6B4, - 0xBFEF, 0xC6B8, 0xBFF0, 0xC6B9, 0xBFF1, 0xC6BA, 0xBFF2, 0xC6C0, - 0xBFF3, 0xC6C1, 0xBFF4, 0xC6C3, 0xBFF5, 0xC6C5, 0xBFF6, 0xC6CC, - 0xBFF7, 0xC6CD, 0xBFF8, 0xC6D0, 0xBFF9, 0xC6D4, 0xBFFA, 0xC6DC, - 0xBFFB, 0xC6DD, 0xBFFC, 0xC6E0, 0xBFFD, 0xC6E1, 0xBFFE, 0xC6E8, - 0xC041, 0xD4FE, 0xC042, 0xD4FF, 0xC043, 0xD500, 0xC044, 0xD501, - 0xC045, 0xD502, 0xC046, 0xD503, 0xC047, 0xD505, 0xC048, 0xD506, - 0xC049, 0xD507, 0xC04A, 0xD509, 0xC04B, 0xD50A, 0xC04C, 0xD50B, - 0xC04D, 0xD50D, 0xC04E, 0xD50E, 0xC04F, 0xD50F, 0xC050, 0xD510, - 0xC051, 0xD511, 0xC052, 0xD512, 0xC053, 0xD513, 0xC054, 0xD516, - 0xC055, 0xD518, 0xC056, 0xD519, 0xC057, 0xD51A, 0xC058, 0xD51B, - 0xC059, 0xD51C, 0xC05A, 0xD51D, 0xC061, 0xD51E, 0xC062, 0xD51F, - 0xC063, 0xD520, 0xC064, 0xD521, 0xC065, 0xD522, 0xC066, 0xD523, - 0xC067, 0xD524, 0xC068, 0xD525, 0xC069, 0xD526, 0xC06A, 0xD527, - 0xC06B, 0xD528, 0xC06C, 0xD529, 0xC06D, 0xD52A, 0xC06E, 0xD52B, - 0xC06F, 0xD52C, 0xC070, 0xD52D, 0xC071, 0xD52E, 0xC072, 0xD52F, - 0xC073, 0xD530, 0xC074, 0xD531, 0xC075, 0xD532, 0xC076, 0xD533, - 0xC077, 0xD534, 0xC078, 0xD535, 0xC079, 0xD536, 0xC07A, 0xD537, - 0xC081, 0xD538, 0xC082, 0xD539, 0xC083, 0xD53A, 0xC084, 0xD53B, - 0xC085, 0xD53E, 0xC086, 0xD53F, 0xC087, 0xD541, 0xC088, 0xD542, - 0xC089, 0xD543, 0xC08A, 0xD545, 0xC08B, 0xD546, 0xC08C, 0xD547, - 0xC08D, 0xD548, 0xC08E, 0xD549, 0xC08F, 0xD54A, 0xC090, 0xD54B, - 0xC091, 0xD54E, 0xC092, 0xD550, 0xC093, 0xD552, 0xC094, 0xD553, - 0xC095, 0xD554, 0xC096, 0xD555, 0xC097, 0xD556, 0xC098, 0xD557, - 0xC099, 0xD55A, 0xC09A, 0xD55B, 0xC09B, 0xD55D, 0xC09C, 0xD55E, - 0xC09D, 0xD55F, 0xC09E, 0xD561, 0xC09F, 0xD562, 0xC0A0, 0xD563, - 0xC0A1, 0xC6E9, 0xC0A2, 0xC6EC, 0xC0A3, 0xC6F0, 0xC0A4, 0xC6F8, - 0xC0A5, 0xC6F9, 0xC0A6, 0xC6FD, 0xC0A7, 0xC704, 0xC0A8, 0xC705, - 0xC0A9, 0xC708, 0xC0AA, 0xC70C, 0xC0AB, 0xC714, 0xC0AC, 0xC715, - 0xC0AD, 0xC717, 0xC0AE, 0xC719, 0xC0AF, 0xC720, 0xC0B0, 0xC721, - 0xC0B1, 0xC724, 0xC0B2, 0xC728, 0xC0B3, 0xC730, 0xC0B4, 0xC731, - 0xC0B5, 0xC733, 0xC0B6, 0xC735, 0xC0B7, 0xC737, 0xC0B8, 0xC73C, - 0xC0B9, 0xC73D, 0xC0BA, 0xC740, 0xC0BB, 0xC744, 0xC0BC, 0xC74A, - 0xC0BD, 0xC74C, 0xC0BE, 0xC74D, 0xC0BF, 0xC74F, 0xC0C0, 0xC751, - 0xC0C1, 0xC752, 0xC0C2, 0xC753, 0xC0C3, 0xC754, 0xC0C4, 0xC755, - 0xC0C5, 0xC756, 0xC0C6, 0xC757, 0xC0C7, 0xC758, 0xC0C8, 0xC75C, - 0xC0C9, 0xC760, 0xC0CA, 0xC768, 0xC0CB, 0xC76B, 0xC0CC, 0xC774, - 0xC0CD, 0xC775, 0xC0CE, 0xC778, 0xC0CF, 0xC77C, 0xC0D0, 0xC77D, - 0xC0D1, 0xC77E, 0xC0D2, 0xC783, 0xC0D3, 0xC784, 0xC0D4, 0xC785, - 0xC0D5, 0xC787, 0xC0D6, 0xC788, 0xC0D7, 0xC789, 0xC0D8, 0xC78A, - 0xC0D9, 0xC78E, 0xC0DA, 0xC790, 0xC0DB, 0xC791, 0xC0DC, 0xC794, - 0xC0DD, 0xC796, 0xC0DE, 0xC797, 0xC0DF, 0xC798, 0xC0E0, 0xC79A, - 0xC0E1, 0xC7A0, 0xC0E2, 0xC7A1, 0xC0E3, 0xC7A3, 0xC0E4, 0xC7A4, - 0xC0E5, 0xC7A5, 0xC0E6, 0xC7A6, 0xC0E7, 0xC7AC, 0xC0E8, 0xC7AD, - 0xC0E9, 0xC7B0, 0xC0EA, 0xC7B4, 0xC0EB, 0xC7BC, 0xC0EC, 0xC7BD, - 0xC0ED, 0xC7BF, 0xC0EE, 0xC7C0, 0xC0EF, 0xC7C1, 0xC0F0, 0xC7C8, - 0xC0F1, 0xC7C9, 0xC0F2, 0xC7CC, 0xC0F3, 0xC7CE, 0xC0F4, 0xC7D0, - 0xC0F5, 0xC7D8, 0xC0F6, 0xC7DD, 0xC0F7, 0xC7E4, 0xC0F8, 0xC7E8, - 0xC0F9, 0xC7EC, 0xC0FA, 0xC800, 0xC0FB, 0xC801, 0xC0FC, 0xC804, - 0xC0FD, 0xC808, 0xC0FE, 0xC80A, 0xC141, 0xD564, 0xC142, 0xD566, - 0xC143, 0xD567, 0xC144, 0xD56A, 0xC145, 0xD56C, 0xC146, 0xD56E, - 0xC147, 0xD56F, 0xC148, 0xD570, 0xC149, 0xD571, 0xC14A, 0xD572, - 0xC14B, 0xD573, 0xC14C, 0xD576, 0xC14D, 0xD577, 0xC14E, 0xD579, - 0xC14F, 0xD57A, 0xC150, 0xD57B, 0xC151, 0xD57D, 0xC152, 0xD57E, - 0xC153, 0xD57F, 0xC154, 0xD580, 0xC155, 0xD581, 0xC156, 0xD582, - 0xC157, 0xD583, 0xC158, 0xD586, 0xC159, 0xD58A, 0xC15A, 0xD58B, - 0xC161, 0xD58C, 0xC162, 0xD58D, 0xC163, 0xD58E, 0xC164, 0xD58F, - 0xC165, 0xD591, 0xC166, 0xD592, 0xC167, 0xD593, 0xC168, 0xD594, - 0xC169, 0xD595, 0xC16A, 0xD596, 0xC16B, 0xD597, 0xC16C, 0xD598, - 0xC16D, 0xD599, 0xC16E, 0xD59A, 0xC16F, 0xD59B, 0xC170, 0xD59C, - 0xC171, 0xD59D, 0xC172, 0xD59E, 0xC173, 0xD59F, 0xC174, 0xD5A0, - 0xC175, 0xD5A1, 0xC176, 0xD5A2, 0xC177, 0xD5A3, 0xC178, 0xD5A4, - 0xC179, 0xD5A6, 0xC17A, 0xD5A7, 0xC181, 0xD5A8, 0xC182, 0xD5A9, - 0xC183, 0xD5AA, 0xC184, 0xD5AB, 0xC185, 0xD5AC, 0xC186, 0xD5AD, - 0xC187, 0xD5AE, 0xC188, 0xD5AF, 0xC189, 0xD5B0, 0xC18A, 0xD5B1, - 0xC18B, 0xD5B2, 0xC18C, 0xD5B3, 0xC18D, 0xD5B4, 0xC18E, 0xD5B5, - 0xC18F, 0xD5B6, 0xC190, 0xD5B7, 0xC191, 0xD5B8, 0xC192, 0xD5B9, - 0xC193, 0xD5BA, 0xC194, 0xD5BB, 0xC195, 0xD5BC, 0xC196, 0xD5BD, - 0xC197, 0xD5BE, 0xC198, 0xD5BF, 0xC199, 0xD5C0, 0xC19A, 0xD5C1, - 0xC19B, 0xD5C2, 0xC19C, 0xD5C3, 0xC19D, 0xD5C4, 0xC19E, 0xD5C5, - 0xC19F, 0xD5C6, 0xC1A0, 0xD5C7, 0xC1A1, 0xC810, 0xC1A2, 0xC811, - 0xC1A3, 0xC813, 0xC1A4, 0xC815, 0xC1A5, 0xC816, 0xC1A6, 0xC81C, - 0xC1A7, 0xC81D, 0xC1A8, 0xC820, 0xC1A9, 0xC824, 0xC1AA, 0xC82C, - 0xC1AB, 0xC82D, 0xC1AC, 0xC82F, 0xC1AD, 0xC831, 0xC1AE, 0xC838, - 0xC1AF, 0xC83C, 0xC1B0, 0xC840, 0xC1B1, 0xC848, 0xC1B2, 0xC849, - 0xC1B3, 0xC84C, 0xC1B4, 0xC84D, 0xC1B5, 0xC854, 0xC1B6, 0xC870, - 0xC1B7, 0xC871, 0xC1B8, 0xC874, 0xC1B9, 0xC878, 0xC1BA, 0xC87A, - 0xC1BB, 0xC880, 0xC1BC, 0xC881, 0xC1BD, 0xC883, 0xC1BE, 0xC885, - 0xC1BF, 0xC886, 0xC1C0, 0xC887, 0xC1C1, 0xC88B, 0xC1C2, 0xC88C, - 0xC1C3, 0xC88D, 0xC1C4, 0xC894, 0xC1C5, 0xC89D, 0xC1C6, 0xC89F, - 0xC1C7, 0xC8A1, 0xC1C8, 0xC8A8, 0xC1C9, 0xC8BC, 0xC1CA, 0xC8BD, - 0xC1CB, 0xC8C4, 0xC1CC, 0xC8C8, 0xC1CD, 0xC8CC, 0xC1CE, 0xC8D4, - 0xC1CF, 0xC8D5, 0xC1D0, 0xC8D7, 0xC1D1, 0xC8D9, 0xC1D2, 0xC8E0, - 0xC1D3, 0xC8E1, 0xC1D4, 0xC8E4, 0xC1D5, 0xC8F5, 0xC1D6, 0xC8FC, - 0xC1D7, 0xC8FD, 0xC1D8, 0xC900, 0xC1D9, 0xC904, 0xC1DA, 0xC905, - 0xC1DB, 0xC906, 0xC1DC, 0xC90C, 0xC1DD, 0xC90D, 0xC1DE, 0xC90F, - 0xC1DF, 0xC911, 0xC1E0, 0xC918, 0xC1E1, 0xC92C, 0xC1E2, 0xC934, - 0xC1E3, 0xC950, 0xC1E4, 0xC951, 0xC1E5, 0xC954, 0xC1E6, 0xC958, - 0xC1E7, 0xC960, 0xC1E8, 0xC961, 0xC1E9, 0xC963, 0xC1EA, 0xC96C, - 0xC1EB, 0xC970, 0xC1EC, 0xC974, 0xC1ED, 0xC97C, 0xC1EE, 0xC988, - 0xC1EF, 0xC989, 0xC1F0, 0xC98C, 0xC1F1, 0xC990, 0xC1F2, 0xC998, - 0xC1F3, 0xC999, 0xC1F4, 0xC99B, 0xC1F5, 0xC99D, 0xC1F6, 0xC9C0, - 0xC1F7, 0xC9C1, 0xC1F8, 0xC9C4, 0xC1F9, 0xC9C7, 0xC1FA, 0xC9C8, - 0xC1FB, 0xC9CA, 0xC1FC, 0xC9D0, 0xC1FD, 0xC9D1, 0xC1FE, 0xC9D3, - 0xC241, 0xD5CA, 0xC242, 0xD5CB, 0xC243, 0xD5CD, 0xC244, 0xD5CE, - 0xC245, 0xD5CF, 0xC246, 0xD5D1, 0xC247, 0xD5D3, 0xC248, 0xD5D4, - 0xC249, 0xD5D5, 0xC24A, 0xD5D6, 0xC24B, 0xD5D7, 0xC24C, 0xD5DA, - 0xC24D, 0xD5DC, 0xC24E, 0xD5DE, 0xC24F, 0xD5DF, 0xC250, 0xD5E0, - 0xC251, 0xD5E1, 0xC252, 0xD5E2, 0xC253, 0xD5E3, 0xC254, 0xD5E6, - 0xC255, 0xD5E7, 0xC256, 0xD5E9, 0xC257, 0xD5EA, 0xC258, 0xD5EB, - 0xC259, 0xD5ED, 0xC25A, 0xD5EE, 0xC261, 0xD5EF, 0xC262, 0xD5F0, - 0xC263, 0xD5F1, 0xC264, 0xD5F2, 0xC265, 0xD5F3, 0xC266, 0xD5F6, - 0xC267, 0xD5F8, 0xC268, 0xD5FA, 0xC269, 0xD5FB, 0xC26A, 0xD5FC, - 0xC26B, 0xD5FD, 0xC26C, 0xD5FE, 0xC26D, 0xD5FF, 0xC26E, 0xD602, - 0xC26F, 0xD603, 0xC270, 0xD605, 0xC271, 0xD606, 0xC272, 0xD607, - 0xC273, 0xD609, 0xC274, 0xD60A, 0xC275, 0xD60B, 0xC276, 0xD60C, - 0xC277, 0xD60D, 0xC278, 0xD60E, 0xC279, 0xD60F, 0xC27A, 0xD612, - 0xC281, 0xD616, 0xC282, 0xD617, 0xC283, 0xD618, 0xC284, 0xD619, - 0xC285, 0xD61A, 0xC286, 0xD61B, 0xC287, 0xD61D, 0xC288, 0xD61E, - 0xC289, 0xD61F, 0xC28A, 0xD621, 0xC28B, 0xD622, 0xC28C, 0xD623, - 0xC28D, 0xD625, 0xC28E, 0xD626, 0xC28F, 0xD627, 0xC290, 0xD628, - 0xC291, 0xD629, 0xC292, 0xD62A, 0xC293, 0xD62B, 0xC294, 0xD62C, - 0xC295, 0xD62E, 0xC296, 0xD62F, 0xC297, 0xD630, 0xC298, 0xD631, - 0xC299, 0xD632, 0xC29A, 0xD633, 0xC29B, 0xD634, 0xC29C, 0xD635, - 0xC29D, 0xD636, 0xC29E, 0xD637, 0xC29F, 0xD63A, 0xC2A0, 0xD63B, - 0xC2A1, 0xC9D5, 0xC2A2, 0xC9D6, 0xC2A3, 0xC9D9, 0xC2A4, 0xC9DA, - 0xC2A5, 0xC9DC, 0xC2A6, 0xC9DD, 0xC2A7, 0xC9E0, 0xC2A8, 0xC9E2, - 0xC2A9, 0xC9E4, 0xC2AA, 0xC9E7, 0xC2AB, 0xC9EC, 0xC2AC, 0xC9ED, - 0xC2AD, 0xC9EF, 0xC2AE, 0xC9F0, 0xC2AF, 0xC9F1, 0xC2B0, 0xC9F8, - 0xC2B1, 0xC9F9, 0xC2B2, 0xC9FC, 0xC2B3, 0xCA00, 0xC2B4, 0xCA08, - 0xC2B5, 0xCA09, 0xC2B6, 0xCA0B, 0xC2B7, 0xCA0C, 0xC2B8, 0xCA0D, - 0xC2B9, 0xCA14, 0xC2BA, 0xCA18, 0xC2BB, 0xCA29, 0xC2BC, 0xCA4C, - 0xC2BD, 0xCA4D, 0xC2BE, 0xCA50, 0xC2BF, 0xCA54, 0xC2C0, 0xCA5C, - 0xC2C1, 0xCA5D, 0xC2C2, 0xCA5F, 0xC2C3, 0xCA60, 0xC2C4, 0xCA61, - 0xC2C5, 0xCA68, 0xC2C6, 0xCA7D, 0xC2C7, 0xCA84, 0xC2C8, 0xCA98, - 0xC2C9, 0xCABC, 0xC2CA, 0xCABD, 0xC2CB, 0xCAC0, 0xC2CC, 0xCAC4, - 0xC2CD, 0xCACC, 0xC2CE, 0xCACD, 0xC2CF, 0xCACF, 0xC2D0, 0xCAD1, - 0xC2D1, 0xCAD3, 0xC2D2, 0xCAD8, 0xC2D3, 0xCAD9, 0xC2D4, 0xCAE0, - 0xC2D5, 0xCAEC, 0xC2D6, 0xCAF4, 0xC2D7, 0xCB08, 0xC2D8, 0xCB10, - 0xC2D9, 0xCB14, 0xC2DA, 0xCB18, 0xC2DB, 0xCB20, 0xC2DC, 0xCB21, - 0xC2DD, 0xCB41, 0xC2DE, 0xCB48, 0xC2DF, 0xCB49, 0xC2E0, 0xCB4C, - 0xC2E1, 0xCB50, 0xC2E2, 0xCB58, 0xC2E3, 0xCB59, 0xC2E4, 0xCB5D, - 0xC2E5, 0xCB64, 0xC2E6, 0xCB78, 0xC2E7, 0xCB79, 0xC2E8, 0xCB9C, - 0xC2E9, 0xCBB8, 0xC2EA, 0xCBD4, 0xC2EB, 0xCBE4, 0xC2EC, 0xCBE7, - 0xC2ED, 0xCBE9, 0xC2EE, 0xCC0C, 0xC2EF, 0xCC0D, 0xC2F0, 0xCC10, - 0xC2F1, 0xCC14, 0xC2F2, 0xCC1C, 0xC2F3, 0xCC1D, 0xC2F4, 0xCC21, - 0xC2F5, 0xCC22, 0xC2F6, 0xCC27, 0xC2F7, 0xCC28, 0xC2F8, 0xCC29, - 0xC2F9, 0xCC2C, 0xC2FA, 0xCC2E, 0xC2FB, 0xCC30, 0xC2FC, 0xCC38, - 0xC2FD, 0xCC39, 0xC2FE, 0xCC3B, 0xC341, 0xD63D, 0xC342, 0xD63E, - 0xC343, 0xD63F, 0xC344, 0xD641, 0xC345, 0xD642, 0xC346, 0xD643, - 0xC347, 0xD644, 0xC348, 0xD646, 0xC349, 0xD647, 0xC34A, 0xD64A, - 0xC34B, 0xD64C, 0xC34C, 0xD64E, 0xC34D, 0xD64F, 0xC34E, 0xD650, - 0xC34F, 0xD652, 0xC350, 0xD653, 0xC351, 0xD656, 0xC352, 0xD657, - 0xC353, 0xD659, 0xC354, 0xD65A, 0xC355, 0xD65B, 0xC356, 0xD65D, - 0xC357, 0xD65E, 0xC358, 0xD65F, 0xC359, 0xD660, 0xC35A, 0xD661, - 0xC361, 0xD662, 0xC362, 0xD663, 0xC363, 0xD664, 0xC364, 0xD665, - 0xC365, 0xD666, 0xC366, 0xD668, 0xC367, 0xD66A, 0xC368, 0xD66B, - 0xC369, 0xD66C, 0xC36A, 0xD66D, 0xC36B, 0xD66E, 0xC36C, 0xD66F, - 0xC36D, 0xD672, 0xC36E, 0xD673, 0xC36F, 0xD675, 0xC370, 0xD676, - 0xC371, 0xD677, 0xC372, 0xD678, 0xC373, 0xD679, 0xC374, 0xD67A, - 0xC375, 0xD67B, 0xC376, 0xD67C, 0xC377, 0xD67D, 0xC378, 0xD67E, - 0xC379, 0xD67F, 0xC37A, 0xD680, 0xC381, 0xD681, 0xC382, 0xD682, - 0xC383, 0xD684, 0xC384, 0xD686, 0xC385, 0xD687, 0xC386, 0xD688, - 0xC387, 0xD689, 0xC388, 0xD68A, 0xC389, 0xD68B, 0xC38A, 0xD68E, - 0xC38B, 0xD68F, 0xC38C, 0xD691, 0xC38D, 0xD692, 0xC38E, 0xD693, - 0xC38F, 0xD695, 0xC390, 0xD696, 0xC391, 0xD697, 0xC392, 0xD698, - 0xC393, 0xD699, 0xC394, 0xD69A, 0xC395, 0xD69B, 0xC396, 0xD69C, - 0xC397, 0xD69E, 0xC398, 0xD6A0, 0xC399, 0xD6A2, 0xC39A, 0xD6A3, - 0xC39B, 0xD6A4, 0xC39C, 0xD6A5, 0xC39D, 0xD6A6, 0xC39E, 0xD6A7, - 0xC39F, 0xD6A9, 0xC3A0, 0xD6AA, 0xC3A1, 0xCC3C, 0xC3A2, 0xCC3D, - 0xC3A3, 0xCC3E, 0xC3A4, 0xCC44, 0xC3A5, 0xCC45, 0xC3A6, 0xCC48, - 0xC3A7, 0xCC4C, 0xC3A8, 0xCC54, 0xC3A9, 0xCC55, 0xC3AA, 0xCC57, - 0xC3AB, 0xCC58, 0xC3AC, 0xCC59, 0xC3AD, 0xCC60, 0xC3AE, 0xCC64, - 0xC3AF, 0xCC66, 0xC3B0, 0xCC68, 0xC3B1, 0xCC70, 0xC3B2, 0xCC75, - 0xC3B3, 0xCC98, 0xC3B4, 0xCC99, 0xC3B5, 0xCC9C, 0xC3B6, 0xCCA0, - 0xC3B7, 0xCCA8, 0xC3B8, 0xCCA9, 0xC3B9, 0xCCAB, 0xC3BA, 0xCCAC, - 0xC3BB, 0xCCAD, 0xC3BC, 0xCCB4, 0xC3BD, 0xCCB5, 0xC3BE, 0xCCB8, - 0xC3BF, 0xCCBC, 0xC3C0, 0xCCC4, 0xC3C1, 0xCCC5, 0xC3C2, 0xCCC7, - 0xC3C3, 0xCCC9, 0xC3C4, 0xCCD0, 0xC3C5, 0xCCD4, 0xC3C6, 0xCCE4, - 0xC3C7, 0xCCEC, 0xC3C8, 0xCCF0, 0xC3C9, 0xCD01, 0xC3CA, 0xCD08, - 0xC3CB, 0xCD09, 0xC3CC, 0xCD0C, 0xC3CD, 0xCD10, 0xC3CE, 0xCD18, - 0xC3CF, 0xCD19, 0xC3D0, 0xCD1B, 0xC3D1, 0xCD1D, 0xC3D2, 0xCD24, - 0xC3D3, 0xCD28, 0xC3D4, 0xCD2C, 0xC3D5, 0xCD39, 0xC3D6, 0xCD5C, - 0xC3D7, 0xCD60, 0xC3D8, 0xCD64, 0xC3D9, 0xCD6C, 0xC3DA, 0xCD6D, - 0xC3DB, 0xCD6F, 0xC3DC, 0xCD71, 0xC3DD, 0xCD78, 0xC3DE, 0xCD88, - 0xC3DF, 0xCD94, 0xC3E0, 0xCD95, 0xC3E1, 0xCD98, 0xC3E2, 0xCD9C, - 0xC3E3, 0xCDA4, 0xC3E4, 0xCDA5, 0xC3E5, 0xCDA7, 0xC3E6, 0xCDA9, - 0xC3E7, 0xCDB0, 0xC3E8, 0xCDC4, 0xC3E9, 0xCDCC, 0xC3EA, 0xCDD0, - 0xC3EB, 0xCDE8, 0xC3EC, 0xCDEC, 0xC3ED, 0xCDF0, 0xC3EE, 0xCDF8, - 0xC3EF, 0xCDF9, 0xC3F0, 0xCDFB, 0xC3F1, 0xCDFD, 0xC3F2, 0xCE04, - 0xC3F3, 0xCE08, 0xC3F4, 0xCE0C, 0xC3F5, 0xCE14, 0xC3F6, 0xCE19, - 0xC3F7, 0xCE20, 0xC3F8, 0xCE21, 0xC3F9, 0xCE24, 0xC3FA, 0xCE28, - 0xC3FB, 0xCE30, 0xC3FC, 0xCE31, 0xC3FD, 0xCE33, 0xC3FE, 0xCE35, - 0xC441, 0xD6AB, 0xC442, 0xD6AD, 0xC443, 0xD6AE, 0xC444, 0xD6AF, - 0xC445, 0xD6B1, 0xC446, 0xD6B2, 0xC447, 0xD6B3, 0xC448, 0xD6B4, - 0xC449, 0xD6B5, 0xC44A, 0xD6B6, 0xC44B, 0xD6B7, 0xC44C, 0xD6B8, - 0xC44D, 0xD6BA, 0xC44E, 0xD6BC, 0xC44F, 0xD6BD, 0xC450, 0xD6BE, - 0xC451, 0xD6BF, 0xC452, 0xD6C0, 0xC453, 0xD6C1, 0xC454, 0xD6C2, - 0xC455, 0xD6C3, 0xC456, 0xD6C6, 0xC457, 0xD6C7, 0xC458, 0xD6C9, - 0xC459, 0xD6CA, 0xC45A, 0xD6CB, 0xC461, 0xD6CD, 0xC462, 0xD6CE, - 0xC463, 0xD6CF, 0xC464, 0xD6D0, 0xC465, 0xD6D2, 0xC466, 0xD6D3, - 0xC467, 0xD6D5, 0xC468, 0xD6D6, 0xC469, 0xD6D8, 0xC46A, 0xD6DA, - 0xC46B, 0xD6DB, 0xC46C, 0xD6DC, 0xC46D, 0xD6DD, 0xC46E, 0xD6DE, - 0xC46F, 0xD6DF, 0xC470, 0xD6E1, 0xC471, 0xD6E2, 0xC472, 0xD6E3, - 0xC473, 0xD6E5, 0xC474, 0xD6E6, 0xC475, 0xD6E7, 0xC476, 0xD6E9, - 0xC477, 0xD6EA, 0xC478, 0xD6EB, 0xC479, 0xD6EC, 0xC47A, 0xD6ED, - 0xC481, 0xD6EE, 0xC482, 0xD6EF, 0xC483, 0xD6F1, 0xC484, 0xD6F2, - 0xC485, 0xD6F3, 0xC486, 0xD6F4, 0xC487, 0xD6F6, 0xC488, 0xD6F7, - 0xC489, 0xD6F8, 0xC48A, 0xD6F9, 0xC48B, 0xD6FA, 0xC48C, 0xD6FB, - 0xC48D, 0xD6FE, 0xC48E, 0xD6FF, 0xC48F, 0xD701, 0xC490, 0xD702, - 0xC491, 0xD703, 0xC492, 0xD705, 0xC493, 0xD706, 0xC494, 0xD707, - 0xC495, 0xD708, 0xC496, 0xD709, 0xC497, 0xD70A, 0xC498, 0xD70B, - 0xC499, 0xD70C, 0xC49A, 0xD70D, 0xC49B, 0xD70E, 0xC49C, 0xD70F, - 0xC49D, 0xD710, 0xC49E, 0xD712, 0xC49F, 0xD713, 0xC4A0, 0xD714, - 0xC4A1, 0xCE58, 0xC4A2, 0xCE59, 0xC4A3, 0xCE5C, 0xC4A4, 0xCE5F, - 0xC4A5, 0xCE60, 0xC4A6, 0xCE61, 0xC4A7, 0xCE68, 0xC4A8, 0xCE69, - 0xC4A9, 0xCE6B, 0xC4AA, 0xCE6D, 0xC4AB, 0xCE74, 0xC4AC, 0xCE75, - 0xC4AD, 0xCE78, 0xC4AE, 0xCE7C, 0xC4AF, 0xCE84, 0xC4B0, 0xCE85, - 0xC4B1, 0xCE87, 0xC4B2, 0xCE89, 0xC4B3, 0xCE90, 0xC4B4, 0xCE91, - 0xC4B5, 0xCE94, 0xC4B6, 0xCE98, 0xC4B7, 0xCEA0, 0xC4B8, 0xCEA1, - 0xC4B9, 0xCEA3, 0xC4BA, 0xCEA4, 0xC4BB, 0xCEA5, 0xC4BC, 0xCEAC, - 0xC4BD, 0xCEAD, 0xC4BE, 0xCEC1, 0xC4BF, 0xCEE4, 0xC4C0, 0xCEE5, - 0xC4C1, 0xCEE8, 0xC4C2, 0xCEEB, 0xC4C3, 0xCEEC, 0xC4C4, 0xCEF4, - 0xC4C5, 0xCEF5, 0xC4C6, 0xCEF7, 0xC4C7, 0xCEF8, 0xC4C8, 0xCEF9, - 0xC4C9, 0xCF00, 0xC4CA, 0xCF01, 0xC4CB, 0xCF04, 0xC4CC, 0xCF08, - 0xC4CD, 0xCF10, 0xC4CE, 0xCF11, 0xC4CF, 0xCF13, 0xC4D0, 0xCF15, - 0xC4D1, 0xCF1C, 0xC4D2, 0xCF20, 0xC4D3, 0xCF24, 0xC4D4, 0xCF2C, - 0xC4D5, 0xCF2D, 0xC4D6, 0xCF2F, 0xC4D7, 0xCF30, 0xC4D8, 0xCF31, - 0xC4D9, 0xCF38, 0xC4DA, 0xCF54, 0xC4DB, 0xCF55, 0xC4DC, 0xCF58, - 0xC4DD, 0xCF5C, 0xC4DE, 0xCF64, 0xC4DF, 0xCF65, 0xC4E0, 0xCF67, - 0xC4E1, 0xCF69, 0xC4E2, 0xCF70, 0xC4E3, 0xCF71, 0xC4E4, 0xCF74, - 0xC4E5, 0xCF78, 0xC4E6, 0xCF80, 0xC4E7, 0xCF85, 0xC4E8, 0xCF8C, - 0xC4E9, 0xCFA1, 0xC4EA, 0xCFA8, 0xC4EB, 0xCFB0, 0xC4EC, 0xCFC4, - 0xC4ED, 0xCFE0, 0xC4EE, 0xCFE1, 0xC4EF, 0xCFE4, 0xC4F0, 0xCFE8, - 0xC4F1, 0xCFF0, 0xC4F2, 0xCFF1, 0xC4F3, 0xCFF3, 0xC4F4, 0xCFF5, - 0xC4F5, 0xCFFC, 0xC4F6, 0xD000, 0xC4F7, 0xD004, 0xC4F8, 0xD011, - 0xC4F9, 0xD018, 0xC4FA, 0xD02D, 0xC4FB, 0xD034, 0xC4FC, 0xD035, - 0xC4FD, 0xD038, 0xC4FE, 0xD03C, 0xC541, 0xD715, 0xC542, 0xD716, - 0xC543, 0xD717, 0xC544, 0xD71A, 0xC545, 0xD71B, 0xC546, 0xD71D, - 0xC547, 0xD71E, 0xC548, 0xD71F, 0xC549, 0xD721, 0xC54A, 0xD722, - 0xC54B, 0xD723, 0xC54C, 0xD724, 0xC54D, 0xD725, 0xC54E, 0xD726, - 0xC54F, 0xD727, 0xC550, 0xD72A, 0xC551, 0xD72C, 0xC552, 0xD72E, - 0xC553, 0xD72F, 0xC554, 0xD730, 0xC555, 0xD731, 0xC556, 0xD732, - 0xC557, 0xD733, 0xC558, 0xD736, 0xC559, 0xD737, 0xC55A, 0xD739, - 0xC561, 0xD73A, 0xC562, 0xD73B, 0xC563, 0xD73D, 0xC564, 0xD73E, - 0xC565, 0xD73F, 0xC566, 0xD740, 0xC567, 0xD741, 0xC568, 0xD742, - 0xC569, 0xD743, 0xC56A, 0xD745, 0xC56B, 0xD746, 0xC56C, 0xD748, - 0xC56D, 0xD74A, 0xC56E, 0xD74B, 0xC56F, 0xD74C, 0xC570, 0xD74D, - 0xC571, 0xD74E, 0xC572, 0xD74F, 0xC573, 0xD752, 0xC574, 0xD753, - 0xC575, 0xD755, 0xC576, 0xD75A, 0xC577, 0xD75B, 0xC578, 0xD75C, - 0xC579, 0xD75D, 0xC57A, 0xD75E, 0xC581, 0xD75F, 0xC582, 0xD762, - 0xC583, 0xD764, 0xC584, 0xD766, 0xC585, 0xD767, 0xC586, 0xD768, - 0xC587, 0xD76A, 0xC588, 0xD76B, 0xC589, 0xD76D, 0xC58A, 0xD76E, - 0xC58B, 0xD76F, 0xC58C, 0xD771, 0xC58D, 0xD772, 0xC58E, 0xD773, - 0xC58F, 0xD775, 0xC590, 0xD776, 0xC591, 0xD777, 0xC592, 0xD778, - 0xC593, 0xD779, 0xC594, 0xD77A, 0xC595, 0xD77B, 0xC596, 0xD77E, - 0xC597, 0xD77F, 0xC598, 0xD780, 0xC599, 0xD782, 0xC59A, 0xD783, - 0xC59B, 0xD784, 0xC59C, 0xD785, 0xC59D, 0xD786, 0xC59E, 0xD787, - 0xC59F, 0xD78A, 0xC5A0, 0xD78B, 0xC5A1, 0xD044, 0xC5A2, 0xD045, - 0xC5A3, 0xD047, 0xC5A4, 0xD049, 0xC5A5, 0xD050, 0xC5A6, 0xD054, - 0xC5A7, 0xD058, 0xC5A8, 0xD060, 0xC5A9, 0xD06C, 0xC5AA, 0xD06D, - 0xC5AB, 0xD070, 0xC5AC, 0xD074, 0xC5AD, 0xD07C, 0xC5AE, 0xD07D, - 0xC5AF, 0xD081, 0xC5B0, 0xD0A4, 0xC5B1, 0xD0A5, 0xC5B2, 0xD0A8, - 0xC5B3, 0xD0AC, 0xC5B4, 0xD0B4, 0xC5B5, 0xD0B5, 0xC5B6, 0xD0B7, - 0xC5B7, 0xD0B9, 0xC5B8, 0xD0C0, 0xC5B9, 0xD0C1, 0xC5BA, 0xD0C4, - 0xC5BB, 0xD0C8, 0xC5BC, 0xD0C9, 0xC5BD, 0xD0D0, 0xC5BE, 0xD0D1, - 0xC5BF, 0xD0D3, 0xC5C0, 0xD0D4, 0xC5C1, 0xD0D5, 0xC5C2, 0xD0DC, - 0xC5C3, 0xD0DD, 0xC5C4, 0xD0E0, 0xC5C5, 0xD0E4, 0xC5C6, 0xD0EC, - 0xC5C7, 0xD0ED, 0xC5C8, 0xD0EF, 0xC5C9, 0xD0F0, 0xC5CA, 0xD0F1, - 0xC5CB, 0xD0F8, 0xC5CC, 0xD10D, 0xC5CD, 0xD130, 0xC5CE, 0xD131, - 0xC5CF, 0xD134, 0xC5D0, 0xD138, 0xC5D1, 0xD13A, 0xC5D2, 0xD140, - 0xC5D3, 0xD141, 0xC5D4, 0xD143, 0xC5D5, 0xD144, 0xC5D6, 0xD145, - 0xC5D7, 0xD14C, 0xC5D8, 0xD14D, 0xC5D9, 0xD150, 0xC5DA, 0xD154, - 0xC5DB, 0xD15C, 0xC5DC, 0xD15D, 0xC5DD, 0xD15F, 0xC5DE, 0xD161, - 0xC5DF, 0xD168, 0xC5E0, 0xD16C, 0xC5E1, 0xD17C, 0xC5E2, 0xD184, - 0xC5E3, 0xD188, 0xC5E4, 0xD1A0, 0xC5E5, 0xD1A1, 0xC5E6, 0xD1A4, - 0xC5E7, 0xD1A8, 0xC5E8, 0xD1B0, 0xC5E9, 0xD1B1, 0xC5EA, 0xD1B3, - 0xC5EB, 0xD1B5, 0xC5EC, 0xD1BA, 0xC5ED, 0xD1BC, 0xC5EE, 0xD1C0, - 0xC5EF, 0xD1D8, 0xC5F0, 0xD1F4, 0xC5F1, 0xD1F8, 0xC5F2, 0xD207, - 0xC5F3, 0xD209, 0xC5F4, 0xD210, 0xC5F5, 0xD22C, 0xC5F6, 0xD22D, - 0xC5F7, 0xD230, 0xC5F8, 0xD234, 0xC5F9, 0xD23C, 0xC5FA, 0xD23D, - 0xC5FB, 0xD23F, 0xC5FC, 0xD241, 0xC5FD, 0xD248, 0xC5FE, 0xD25C, - 0xC641, 0xD78D, 0xC642, 0xD78E, 0xC643, 0xD78F, 0xC644, 0xD791, - 0xC645, 0xD792, 0xC646, 0xD793, 0xC647, 0xD794, 0xC648, 0xD795, - 0xC649, 0xD796, 0xC64A, 0xD797, 0xC64B, 0xD79A, 0xC64C, 0xD79C, - 0xC64D, 0xD79E, 0xC64E, 0xD79F, 0xC64F, 0xD7A0, 0xC650, 0xD7A1, - 0xC651, 0xD7A2, 0xC652, 0xD7A3, 0xC6A1, 0xD264, 0xC6A2, 0xD280, - 0xC6A3, 0xD281, 0xC6A4, 0xD284, 0xC6A5, 0xD288, 0xC6A6, 0xD290, - 0xC6A7, 0xD291, 0xC6A8, 0xD295, 0xC6A9, 0xD29C, 0xC6AA, 0xD2A0, - 0xC6AB, 0xD2A4, 0xC6AC, 0xD2AC, 0xC6AD, 0xD2B1, 0xC6AE, 0xD2B8, - 0xC6AF, 0xD2B9, 0xC6B0, 0xD2BC, 0xC6B1, 0xD2BF, 0xC6B2, 0xD2C0, - 0xC6B3, 0xD2C2, 0xC6B4, 0xD2C8, 0xC6B5, 0xD2C9, 0xC6B6, 0xD2CB, - 0xC6B7, 0xD2D4, 0xC6B8, 0xD2D8, 0xC6B9, 0xD2DC, 0xC6BA, 0xD2E4, - 0xC6BB, 0xD2E5, 0xC6BC, 0xD2F0, 0xC6BD, 0xD2F1, 0xC6BE, 0xD2F4, - 0xC6BF, 0xD2F8, 0xC6C0, 0xD300, 0xC6C1, 0xD301, 0xC6C2, 0xD303, - 0xC6C3, 0xD305, 0xC6C4, 0xD30C, 0xC6C5, 0xD30D, 0xC6C6, 0xD30E, - 0xC6C7, 0xD310, 0xC6C8, 0xD314, 0xC6C9, 0xD316, 0xC6CA, 0xD31C, - 0xC6CB, 0xD31D, 0xC6CC, 0xD31F, 0xC6CD, 0xD320, 0xC6CE, 0xD321, - 0xC6CF, 0xD325, 0xC6D0, 0xD328, 0xC6D1, 0xD329, 0xC6D2, 0xD32C, - 0xC6D3, 0xD330, 0xC6D4, 0xD338, 0xC6D5, 0xD339, 0xC6D6, 0xD33B, - 0xC6D7, 0xD33C, 0xC6D8, 0xD33D, 0xC6D9, 0xD344, 0xC6DA, 0xD345, - 0xC6DB, 0xD37C, 0xC6DC, 0xD37D, 0xC6DD, 0xD380, 0xC6DE, 0xD384, - 0xC6DF, 0xD38C, 0xC6E0, 0xD38D, 0xC6E1, 0xD38F, 0xC6E2, 0xD390, - 0xC6E3, 0xD391, 0xC6E4, 0xD398, 0xC6E5, 0xD399, 0xC6E6, 0xD39C, - 0xC6E7, 0xD3A0, 0xC6E8, 0xD3A8, 0xC6E9, 0xD3A9, 0xC6EA, 0xD3AB, - 0xC6EB, 0xD3AD, 0xC6EC, 0xD3B4, 0xC6ED, 0xD3B8, 0xC6EE, 0xD3BC, - 0xC6EF, 0xD3C4, 0xC6F0, 0xD3C5, 0xC6F1, 0xD3C8, 0xC6F2, 0xD3C9, - 0xC6F3, 0xD3D0, 0xC6F4, 0xD3D8, 0xC6F5, 0xD3E1, 0xC6F6, 0xD3E3, - 0xC6F7, 0xD3EC, 0xC6F8, 0xD3ED, 0xC6F9, 0xD3F0, 0xC6FA, 0xD3F4, - 0xC6FB, 0xD3FC, 0xC6FC, 0xD3FD, 0xC6FD, 0xD3FF, 0xC6FE, 0xD401, - 0xC7A1, 0xD408, 0xC7A2, 0xD41D, 0xC7A3, 0xD440, 0xC7A4, 0xD444, - 0xC7A5, 0xD45C, 0xC7A6, 0xD460, 0xC7A7, 0xD464, 0xC7A8, 0xD46D, - 0xC7A9, 0xD46F, 0xC7AA, 0xD478, 0xC7AB, 0xD479, 0xC7AC, 0xD47C, - 0xC7AD, 0xD47F, 0xC7AE, 0xD480, 0xC7AF, 0xD482, 0xC7B0, 0xD488, - 0xC7B1, 0xD489, 0xC7B2, 0xD48B, 0xC7B3, 0xD48D, 0xC7B4, 0xD494, - 0xC7B5, 0xD4A9, 0xC7B6, 0xD4CC, 0xC7B7, 0xD4D0, 0xC7B8, 0xD4D4, - 0xC7B9, 0xD4DC, 0xC7BA, 0xD4DF, 0xC7BB, 0xD4E8, 0xC7BC, 0xD4EC, - 0xC7BD, 0xD4F0, 0xC7BE, 0xD4F8, 0xC7BF, 0xD4FB, 0xC7C0, 0xD4FD, - 0xC7C1, 0xD504, 0xC7C2, 0xD508, 0xC7C3, 0xD50C, 0xC7C4, 0xD514, - 0xC7C5, 0xD515, 0xC7C6, 0xD517, 0xC7C7, 0xD53C, 0xC7C8, 0xD53D, - 0xC7C9, 0xD540, 0xC7CA, 0xD544, 0xC7CB, 0xD54C, 0xC7CC, 0xD54D, - 0xC7CD, 0xD54F, 0xC7CE, 0xD551, 0xC7CF, 0xD558, 0xC7D0, 0xD559, - 0xC7D1, 0xD55C, 0xC7D2, 0xD560, 0xC7D3, 0xD565, 0xC7D4, 0xD568, - 0xC7D5, 0xD569, 0xC7D6, 0xD56B, 0xC7D7, 0xD56D, 0xC7D8, 0xD574, - 0xC7D9, 0xD575, 0xC7DA, 0xD578, 0xC7DB, 0xD57C, 0xC7DC, 0xD584, - 0xC7DD, 0xD585, 0xC7DE, 0xD587, 0xC7DF, 0xD588, 0xC7E0, 0xD589, - 0xC7E1, 0xD590, 0xC7E2, 0xD5A5, 0xC7E3, 0xD5C8, 0xC7E4, 0xD5C9, - 0xC7E5, 0xD5CC, 0xC7E6, 0xD5D0, 0xC7E7, 0xD5D2, 0xC7E8, 0xD5D8, - 0xC7E9, 0xD5D9, 0xC7EA, 0xD5DB, 0xC7EB, 0xD5DD, 0xC7EC, 0xD5E4, - 0xC7ED, 0xD5E5, 0xC7EE, 0xD5E8, 0xC7EF, 0xD5EC, 0xC7F0, 0xD5F4, - 0xC7F1, 0xD5F5, 0xC7F2, 0xD5F7, 0xC7F3, 0xD5F9, 0xC7F4, 0xD600, - 0xC7F5, 0xD601, 0xC7F6, 0xD604, 0xC7F7, 0xD608, 0xC7F8, 0xD610, - 0xC7F9, 0xD611, 0xC7FA, 0xD613, 0xC7FB, 0xD614, 0xC7FC, 0xD615, - 0xC7FD, 0xD61C, 0xC7FE, 0xD620, 0xC8A1, 0xD624, 0xC8A2, 0xD62D, - 0xC8A3, 0xD638, 0xC8A4, 0xD639, 0xC8A5, 0xD63C, 0xC8A6, 0xD640, - 0xC8A7, 0xD645, 0xC8A8, 0xD648, 0xC8A9, 0xD649, 0xC8AA, 0xD64B, - 0xC8AB, 0xD64D, 0xC8AC, 0xD651, 0xC8AD, 0xD654, 0xC8AE, 0xD655, - 0xC8AF, 0xD658, 0xC8B0, 0xD65C, 0xC8B1, 0xD667, 0xC8B2, 0xD669, - 0xC8B3, 0xD670, 0xC8B4, 0xD671, 0xC8B5, 0xD674, 0xC8B6, 0xD683, - 0xC8B7, 0xD685, 0xC8B8, 0xD68C, 0xC8B9, 0xD68D, 0xC8BA, 0xD690, - 0xC8BB, 0xD694, 0xC8BC, 0xD69D, 0xC8BD, 0xD69F, 0xC8BE, 0xD6A1, - 0xC8BF, 0xD6A8, 0xC8C0, 0xD6AC, 0xC8C1, 0xD6B0, 0xC8C2, 0xD6B9, - 0xC8C3, 0xD6BB, 0xC8C4, 0xD6C4, 0xC8C5, 0xD6C5, 0xC8C6, 0xD6C8, - 0xC8C7, 0xD6CC, 0xC8C8, 0xD6D1, 0xC8C9, 0xD6D4, 0xC8CA, 0xD6D7, - 0xC8CB, 0xD6D9, 0xC8CC, 0xD6E0, 0xC8CD, 0xD6E4, 0xC8CE, 0xD6E8, - 0xC8CF, 0xD6F0, 0xC8D0, 0xD6F5, 0xC8D1, 0xD6FC, 0xC8D2, 0xD6FD, - 0xC8D3, 0xD700, 0xC8D4, 0xD704, 0xC8D5, 0xD711, 0xC8D6, 0xD718, - 0xC8D7, 0xD719, 0xC8D8, 0xD71C, 0xC8D9, 0xD720, 0xC8DA, 0xD728, - 0xC8DB, 0xD729, 0xC8DC, 0xD72B, 0xC8DD, 0xD72D, 0xC8DE, 0xD734, - 0xC8DF, 0xD735, 0xC8E0, 0xD738, 0xC8E1, 0xD73C, 0xC8E2, 0xD744, - 0xC8E3, 0xD747, 0xC8E4, 0xD749, 0xC8E5, 0xD750, 0xC8E6, 0xD751, - 0xC8E7, 0xD754, 0xC8E8, 0xD756, 0xC8E9, 0xD757, 0xC8EA, 0xD758, - 0xC8EB, 0xD759, 0xC8EC, 0xD760, 0xC8ED, 0xD761, 0xC8EE, 0xD763, - 0xC8EF, 0xD765, 0xC8F0, 0xD769, 0xC8F1, 0xD76C, 0xC8F2, 0xD770, - 0xC8F3, 0xD774, 0xC8F4, 0xD77C, 0xC8F5, 0xD77D, 0xC8F6, 0xD781, - 0xC8F7, 0xD788, 0xC8F8, 0xD789, 0xC8F9, 0xD78C, 0xC8FA, 0xD790, - 0xC8FB, 0xD798, 0xC8FC, 0xD799, 0xC8FD, 0xD79B, 0xC8FE, 0xD79D, - 0xCAA1, 0x4F3D, 0xCAA2, 0x4F73, 0xCAA3, 0x5047, 0xCAA4, 0x50F9, - 0xCAA5, 0x52A0, 0xCAA6, 0x53EF, 0xCAA7, 0x5475, 0xCAA8, 0x54E5, - 0xCAA9, 0x5609, 0xCAAA, 0x5AC1, 0xCAAB, 0x5BB6, 0xCAAC, 0x6687, - 0xCAAD, 0x67B6, 0xCAAE, 0x67B7, 0xCAAF, 0x67EF, 0xCAB0, 0x6B4C, - 0xCAB1, 0x73C2, 0xCAB2, 0x75C2, 0xCAB3, 0x7A3C, 0xCAB4, 0x82DB, - 0xCAB5, 0x8304, 0xCAB6, 0x8857, 0xCAB7, 0x8888, 0xCAB8, 0x8A36, - 0xCAB9, 0x8CC8, 0xCABA, 0x8DCF, 0xCABB, 0x8EFB, 0xCABC, 0x8FE6, - 0xCABD, 0x99D5, 0xCABE, 0x523B, 0xCABF, 0x5374, 0xCAC0, 0x5404, - 0xCAC1, 0x606A, 0xCAC2, 0x6164, 0xCAC3, 0x6BBC, 0xCAC4, 0x73CF, - 0xCAC5, 0x811A, 0xCAC6, 0x89BA, 0xCAC7, 0x89D2, 0xCAC8, 0x95A3, - 0xCAC9, 0x4F83, 0xCACA, 0x520A, 0xCACB, 0x58BE, 0xCACC, 0x5978, - 0xCACD, 0x59E6, 0xCACE, 0x5E72, 0xCACF, 0x5E79, 0xCAD0, 0x61C7, - 0xCAD1, 0x63C0, 0xCAD2, 0x6746, 0xCAD3, 0x67EC, 0xCAD4, 0x687F, - 0xCAD5, 0x6F97, 0xCAD6, 0x764E, 0xCAD7, 0x770B, 0xCAD8, 0x78F5, - 0xCAD9, 0x7A08, 0xCADA, 0x7AFF, 0xCADB, 0x7C21, 0xCADC, 0x809D, - 0xCADD, 0x826E, 0xCADE, 0x8271, 0xCADF, 0x8AEB, 0xCAE0, 0x9593, - 0xCAE1, 0x4E6B, 0xCAE2, 0x559D, 0xCAE3, 0x66F7, 0xCAE4, 0x6E34, - 0xCAE5, 0x78A3, 0xCAE6, 0x7AED, 0xCAE7, 0x845B, 0xCAE8, 0x8910, - 0xCAE9, 0x874E, 0xCAEA, 0x97A8, 0xCAEB, 0x52D8, 0xCAEC, 0x574E, - 0xCAED, 0x582A, 0xCAEE, 0x5D4C, 0xCAEF, 0x611F, 0xCAF0, 0x61BE, - 0xCAF1, 0x6221, 0xCAF2, 0x6562, 0xCAF3, 0x67D1, 0xCAF4, 0x6A44, - 0xCAF5, 0x6E1B, 0xCAF6, 0x7518, 0xCAF7, 0x75B3, 0xCAF8, 0x76E3, - 0xCAF9, 0x77B0, 0xCAFA, 0x7D3A, 0xCAFB, 0x90AF, 0xCAFC, 0x9451, - 0xCAFD, 0x9452, 0xCAFE, 0x9F95, 0xCBA1, 0x5323, 0xCBA2, 0x5CAC, - 0xCBA3, 0x7532, 0xCBA4, 0x80DB, 0xCBA5, 0x9240, 0xCBA6, 0x9598, - 0xCBA7, 0x525B, 0xCBA8, 0x5808, 0xCBA9, 0x59DC, 0xCBAA, 0x5CA1, - 0xCBAB, 0x5D17, 0xCBAC, 0x5EB7, 0xCBAD, 0x5F3A, 0xCBAE, 0x5F4A, - 0xCBAF, 0x6177, 0xCBB0, 0x6C5F, 0xCBB1, 0x757A, 0xCBB2, 0x7586, - 0xCBB3, 0x7CE0, 0xCBB4, 0x7D73, 0xCBB5, 0x7DB1, 0xCBB6, 0x7F8C, - 0xCBB7, 0x8154, 0xCBB8, 0x8221, 0xCBB9, 0x8591, 0xCBBA, 0x8941, - 0xCBBB, 0x8B1B, 0xCBBC, 0x92FC, 0xCBBD, 0x964D, 0xCBBE, 0x9C47, - 0xCBBF, 0x4ECB, 0xCBC0, 0x4EF7, 0xCBC1, 0x500B, 0xCBC2, 0x51F1, - 0xCBC3, 0x584F, 0xCBC4, 0x6137, 0xCBC5, 0x613E, 0xCBC6, 0x6168, - 0xCBC7, 0x6539, 0xCBC8, 0x69EA, 0xCBC9, 0x6F11, 0xCBCA, 0x75A5, - 0xCBCB, 0x7686, 0xCBCC, 0x76D6, 0xCBCD, 0x7B87, 0xCBCE, 0x82A5, - 0xCBCF, 0x84CB, 0xCBD0, 0xF900, 0xCBD1, 0x93A7, 0xCBD2, 0x958B, - 0xCBD3, 0x5580, 0xCBD4, 0x5BA2, 0xCBD5, 0x5751, 0xCBD6, 0xF901, - 0xCBD7, 0x7CB3, 0xCBD8, 0x7FB9, 0xCBD9, 0x91B5, 0xCBDA, 0x5028, - 0xCBDB, 0x53BB, 0xCBDC, 0x5C45, 0xCBDD, 0x5DE8, 0xCBDE, 0x62D2, - 0xCBDF, 0x636E, 0xCBE0, 0x64DA, 0xCBE1, 0x64E7, 0xCBE2, 0x6E20, - 0xCBE3, 0x70AC, 0xCBE4, 0x795B, 0xCBE5, 0x8DDD, 0xCBE6, 0x8E1E, - 0xCBE7, 0xF902, 0xCBE8, 0x907D, 0xCBE9, 0x9245, 0xCBEA, 0x92F8, - 0xCBEB, 0x4E7E, 0xCBEC, 0x4EF6, 0xCBED, 0x5065, 0xCBEE, 0x5DFE, - 0xCBEF, 0x5EFA, 0xCBF0, 0x6106, 0xCBF1, 0x6957, 0xCBF2, 0x8171, - 0xCBF3, 0x8654, 0xCBF4, 0x8E47, 0xCBF5, 0x9375, 0xCBF6, 0x9A2B, - 0xCBF7, 0x4E5E, 0xCBF8, 0x5091, 0xCBF9, 0x6770, 0xCBFA, 0x6840, - 0xCBFB, 0x5109, 0xCBFC, 0x528D, 0xCBFD, 0x5292, 0xCBFE, 0x6AA2, - 0xCCA1, 0x77BC, 0xCCA2, 0x9210, 0xCCA3, 0x9ED4, 0xCCA4, 0x52AB, - 0xCCA5, 0x602F, 0xCCA6, 0x8FF2, 0xCCA7, 0x5048, 0xCCA8, 0x61A9, - 0xCCA9, 0x63ED, 0xCCAA, 0x64CA, 0xCCAB, 0x683C, 0xCCAC, 0x6A84, - 0xCCAD, 0x6FC0, 0xCCAE, 0x8188, 0xCCAF, 0x89A1, 0xCCB0, 0x9694, - 0xCCB1, 0x5805, 0xCCB2, 0x727D, 0xCCB3, 0x72AC, 0xCCB4, 0x7504, - 0xCCB5, 0x7D79, 0xCCB6, 0x7E6D, 0xCCB7, 0x80A9, 0xCCB8, 0x898B, - 0xCCB9, 0x8B74, 0xCCBA, 0x9063, 0xCCBB, 0x9D51, 0xCCBC, 0x6289, - 0xCCBD, 0x6C7A, 0xCCBE, 0x6F54, 0xCCBF, 0x7D50, 0xCCC0, 0x7F3A, - 0xCCC1, 0x8A23, 0xCCC2, 0x517C, 0xCCC3, 0x614A, 0xCCC4, 0x7B9D, - 0xCCC5, 0x8B19, 0xCCC6, 0x9257, 0xCCC7, 0x938C, 0xCCC8, 0x4EAC, - 0xCCC9, 0x4FD3, 0xCCCA, 0x501E, 0xCCCB, 0x50BE, 0xCCCC, 0x5106, - 0xCCCD, 0x52C1, 0xCCCE, 0x52CD, 0xCCCF, 0x537F, 0xCCD0, 0x5770, - 0xCCD1, 0x5883, 0xCCD2, 0x5E9A, 0xCCD3, 0x5F91, 0xCCD4, 0x6176, - 0xCCD5, 0x61AC, 0xCCD6, 0x64CE, 0xCCD7, 0x656C, 0xCCD8, 0x666F, - 0xCCD9, 0x66BB, 0xCCDA, 0x66F4, 0xCCDB, 0x6897, 0xCCDC, 0x6D87, - 0xCCDD, 0x7085, 0xCCDE, 0x70F1, 0xCCDF, 0x749F, 0xCCE0, 0x74A5, - 0xCCE1, 0x74CA, 0xCCE2, 0x75D9, 0xCCE3, 0x786C, 0xCCE4, 0x78EC, - 0xCCE5, 0x7ADF, 0xCCE6, 0x7AF6, 0xCCE7, 0x7D45, 0xCCE8, 0x7D93, - 0xCCE9, 0x8015, 0xCCEA, 0x803F, 0xCCEB, 0x811B, 0xCCEC, 0x8396, - 0xCCED, 0x8B66, 0xCCEE, 0x8F15, 0xCCEF, 0x9015, 0xCCF0, 0x93E1, - 0xCCF1, 0x9803, 0xCCF2, 0x9838, 0xCCF3, 0x9A5A, 0xCCF4, 0x9BE8, - 0xCCF5, 0x4FC2, 0xCCF6, 0x5553, 0xCCF7, 0x583A, 0xCCF8, 0x5951, - 0xCCF9, 0x5B63, 0xCCFA, 0x5C46, 0xCCFB, 0x60B8, 0xCCFC, 0x6212, - 0xCCFD, 0x6842, 0xCCFE, 0x68B0, 0xCDA1, 0x68E8, 0xCDA2, 0x6EAA, - 0xCDA3, 0x754C, 0xCDA4, 0x7678, 0xCDA5, 0x78CE, 0xCDA6, 0x7A3D, - 0xCDA7, 0x7CFB, 0xCDA8, 0x7E6B, 0xCDA9, 0x7E7C, 0xCDAA, 0x8A08, - 0xCDAB, 0x8AA1, 0xCDAC, 0x8C3F, 0xCDAD, 0x968E, 0xCDAE, 0x9DC4, - 0xCDAF, 0x53E4, 0xCDB0, 0x53E9, 0xCDB1, 0x544A, 0xCDB2, 0x5471, - 0xCDB3, 0x56FA, 0xCDB4, 0x59D1, 0xCDB5, 0x5B64, 0xCDB6, 0x5C3B, - 0xCDB7, 0x5EAB, 0xCDB8, 0x62F7, 0xCDB9, 0x6537, 0xCDBA, 0x6545, - 0xCDBB, 0x6572, 0xCDBC, 0x66A0, 0xCDBD, 0x67AF, 0xCDBE, 0x69C1, - 0xCDBF, 0x6CBD, 0xCDC0, 0x75FC, 0xCDC1, 0x7690, 0xCDC2, 0x777E, - 0xCDC3, 0x7A3F, 0xCDC4, 0x7F94, 0xCDC5, 0x8003, 0xCDC6, 0x80A1, - 0xCDC7, 0x818F, 0xCDC8, 0x82E6, 0xCDC9, 0x82FD, 0xCDCA, 0x83F0, - 0xCDCB, 0x85C1, 0xCDCC, 0x8831, 0xCDCD, 0x88B4, 0xCDCE, 0x8AA5, - 0xCDCF, 0xF903, 0xCDD0, 0x8F9C, 0xCDD1, 0x932E, 0xCDD2, 0x96C7, - 0xCDD3, 0x9867, 0xCDD4, 0x9AD8, 0xCDD5, 0x9F13, 0xCDD6, 0x54ED, - 0xCDD7, 0x659B, 0xCDD8, 0x66F2, 0xCDD9, 0x688F, 0xCDDA, 0x7A40, - 0xCDDB, 0x8C37, 0xCDDC, 0x9D60, 0xCDDD, 0x56F0, 0xCDDE, 0x5764, - 0xCDDF, 0x5D11, 0xCDE0, 0x6606, 0xCDE1, 0x68B1, 0xCDE2, 0x68CD, - 0xCDE3, 0x6EFE, 0xCDE4, 0x7428, 0xCDE5, 0x889E, 0xCDE6, 0x9BE4, - 0xCDE7, 0x6C68, 0xCDE8, 0xF904, 0xCDE9, 0x9AA8, 0xCDEA, 0x4F9B, - 0xCDEB, 0x516C, 0xCDEC, 0x5171, 0xCDED, 0x529F, 0xCDEE, 0x5B54, - 0xCDEF, 0x5DE5, 0xCDF0, 0x6050, 0xCDF1, 0x606D, 0xCDF2, 0x62F1, - 0xCDF3, 0x63A7, 0xCDF4, 0x653B, 0xCDF5, 0x73D9, 0xCDF6, 0x7A7A, - 0xCDF7, 0x86A3, 0xCDF8, 0x8CA2, 0xCDF9, 0x978F, 0xCDFA, 0x4E32, - 0xCDFB, 0x5BE1, 0xCDFC, 0x6208, 0xCDFD, 0x679C, 0xCDFE, 0x74DC, - 0xCEA1, 0x79D1, 0xCEA2, 0x83D3, 0xCEA3, 0x8A87, 0xCEA4, 0x8AB2, - 0xCEA5, 0x8DE8, 0xCEA6, 0x904E, 0xCEA7, 0x934B, 0xCEA8, 0x9846, - 0xCEA9, 0x5ED3, 0xCEAA, 0x69E8, 0xCEAB, 0x85FF, 0xCEAC, 0x90ED, - 0xCEAD, 0xF905, 0xCEAE, 0x51A0, 0xCEAF, 0x5B98, 0xCEB0, 0x5BEC, - 0xCEB1, 0x6163, 0xCEB2, 0x68FA, 0xCEB3, 0x6B3E, 0xCEB4, 0x704C, - 0xCEB5, 0x742F, 0xCEB6, 0x74D8, 0xCEB7, 0x7BA1, 0xCEB8, 0x7F50, - 0xCEB9, 0x83C5, 0xCEBA, 0x89C0, 0xCEBB, 0x8CAB, 0xCEBC, 0x95DC, - 0xCEBD, 0x9928, 0xCEBE, 0x522E, 0xCEBF, 0x605D, 0xCEC0, 0x62EC, - 0xCEC1, 0x9002, 0xCEC2, 0x4F8A, 0xCEC3, 0x5149, 0xCEC4, 0x5321, - 0xCEC5, 0x58D9, 0xCEC6, 0x5EE3, 0xCEC7, 0x66E0, 0xCEC8, 0x6D38, - 0xCEC9, 0x709A, 0xCECA, 0x72C2, 0xCECB, 0x73D6, 0xCECC, 0x7B50, - 0xCECD, 0x80F1, 0xCECE, 0x945B, 0xCECF, 0x5366, 0xCED0, 0x639B, - 0xCED1, 0x7F6B, 0xCED2, 0x4E56, 0xCED3, 0x5080, 0xCED4, 0x584A, - 0xCED5, 0x58DE, 0xCED6, 0x602A, 0xCED7, 0x6127, 0xCED8, 0x62D0, - 0xCED9, 0x69D0, 0xCEDA, 0x9B41, 0xCEDB, 0x5B8F, 0xCEDC, 0x7D18, - 0xCEDD, 0x80B1, 0xCEDE, 0x8F5F, 0xCEDF, 0x4EA4, 0xCEE0, 0x50D1, - 0xCEE1, 0x54AC, 0xCEE2, 0x55AC, 0xCEE3, 0x5B0C, 0xCEE4, 0x5DA0, - 0xCEE5, 0x5DE7, 0xCEE6, 0x652A, 0xCEE7, 0x654E, 0xCEE8, 0x6821, - 0xCEE9, 0x6A4B, 0xCEEA, 0x72E1, 0xCEEB, 0x768E, 0xCEEC, 0x77EF, - 0xCEED, 0x7D5E, 0xCEEE, 0x7FF9, 0xCEEF, 0x81A0, 0xCEF0, 0x854E, - 0xCEF1, 0x86DF, 0xCEF2, 0x8F03, 0xCEF3, 0x8F4E, 0xCEF4, 0x90CA, - 0xCEF5, 0x9903, 0xCEF6, 0x9A55, 0xCEF7, 0x9BAB, 0xCEF8, 0x4E18, - 0xCEF9, 0x4E45, 0xCEFA, 0x4E5D, 0xCEFB, 0x4EC7, 0xCEFC, 0x4FF1, - 0xCEFD, 0x5177, 0xCEFE, 0x52FE, 0xCFA1, 0x5340, 0xCFA2, 0x53E3, - 0xCFA3, 0x53E5, 0xCFA4, 0x548E, 0xCFA5, 0x5614, 0xCFA6, 0x5775, - 0xCFA7, 0x57A2, 0xCFA8, 0x5BC7, 0xCFA9, 0x5D87, 0xCFAA, 0x5ED0, - 0xCFAB, 0x61FC, 0xCFAC, 0x62D8, 0xCFAD, 0x6551, 0xCFAE, 0x67B8, - 0xCFAF, 0x67E9, 0xCFB0, 0x69CB, 0xCFB1, 0x6B50, 0xCFB2, 0x6BC6, - 0xCFB3, 0x6BEC, 0xCFB4, 0x6C42, 0xCFB5, 0x6E9D, 0xCFB6, 0x7078, - 0xCFB7, 0x72D7, 0xCFB8, 0x7396, 0xCFB9, 0x7403, 0xCFBA, 0x77BF, - 0xCFBB, 0x77E9, 0xCFBC, 0x7A76, 0xCFBD, 0x7D7F, 0xCFBE, 0x8009, - 0xCFBF, 0x81FC, 0xCFC0, 0x8205, 0xCFC1, 0x820A, 0xCFC2, 0x82DF, - 0xCFC3, 0x8862, 0xCFC4, 0x8B33, 0xCFC5, 0x8CFC, 0xCFC6, 0x8EC0, - 0xCFC7, 0x9011, 0xCFC8, 0x90B1, 0xCFC9, 0x9264, 0xCFCA, 0x92B6, - 0xCFCB, 0x99D2, 0xCFCC, 0x9A45, 0xCFCD, 0x9CE9, 0xCFCE, 0x9DD7, - 0xCFCF, 0x9F9C, 0xCFD0, 0x570B, 0xCFD1, 0x5C40, 0xCFD2, 0x83CA, - 0xCFD3, 0x97A0, 0xCFD4, 0x97AB, 0xCFD5, 0x9EB4, 0xCFD6, 0x541B, - 0xCFD7, 0x7A98, 0xCFD8, 0x7FA4, 0xCFD9, 0x88D9, 0xCFDA, 0x8ECD, - 0xCFDB, 0x90E1, 0xCFDC, 0x5800, 0xCFDD, 0x5C48, 0xCFDE, 0x6398, - 0xCFDF, 0x7A9F, 0xCFE0, 0x5BAE, 0xCFE1, 0x5F13, 0xCFE2, 0x7A79, - 0xCFE3, 0x7AAE, 0xCFE4, 0x828E, 0xCFE5, 0x8EAC, 0xCFE6, 0x5026, - 0xCFE7, 0x5238, 0xCFE8, 0x52F8, 0xCFE9, 0x5377, 0xCFEA, 0x5708, - 0xCFEB, 0x62F3, 0xCFEC, 0x6372, 0xCFED, 0x6B0A, 0xCFEE, 0x6DC3, - 0xCFEF, 0x7737, 0xCFF0, 0x53A5, 0xCFF1, 0x7357, 0xCFF2, 0x8568, - 0xCFF3, 0x8E76, 0xCFF4, 0x95D5, 0xCFF5, 0x673A, 0xCFF6, 0x6AC3, - 0xCFF7, 0x6F70, 0xCFF8, 0x8A6D, 0xCFF9, 0x8ECC, 0xCFFA, 0x994B, - 0xCFFB, 0xF906, 0xCFFC, 0x6677, 0xCFFD, 0x6B78, 0xCFFE, 0x8CB4, - 0xD0A1, 0x9B3C, 0xD0A2, 0xF907, 0xD0A3, 0x53EB, 0xD0A4, 0x572D, - 0xD0A5, 0x594E, 0xD0A6, 0x63C6, 0xD0A7, 0x69FB, 0xD0A8, 0x73EA, - 0xD0A9, 0x7845, 0xD0AA, 0x7ABA, 0xD0AB, 0x7AC5, 0xD0AC, 0x7CFE, - 0xD0AD, 0x8475, 0xD0AE, 0x898F, 0xD0AF, 0x8D73, 0xD0B0, 0x9035, - 0xD0B1, 0x95A8, 0xD0B2, 0x52FB, 0xD0B3, 0x5747, 0xD0B4, 0x7547, - 0xD0B5, 0x7B60, 0xD0B6, 0x83CC, 0xD0B7, 0x921E, 0xD0B8, 0xF908, - 0xD0B9, 0x6A58, 0xD0BA, 0x514B, 0xD0BB, 0x524B, 0xD0BC, 0x5287, - 0xD0BD, 0x621F, 0xD0BE, 0x68D8, 0xD0BF, 0x6975, 0xD0C0, 0x9699, - 0xD0C1, 0x50C5, 0xD0C2, 0x52A4, 0xD0C3, 0x52E4, 0xD0C4, 0x61C3, - 0xD0C5, 0x65A4, 0xD0C6, 0x6839, 0xD0C7, 0x69FF, 0xD0C8, 0x747E, - 0xD0C9, 0x7B4B, 0xD0CA, 0x82B9, 0xD0CB, 0x83EB, 0xD0CC, 0x89B2, - 0xD0CD, 0x8B39, 0xD0CE, 0x8FD1, 0xD0CF, 0x9949, 0xD0D0, 0xF909, - 0xD0D1, 0x4ECA, 0xD0D2, 0x5997, 0xD0D3, 0x64D2, 0xD0D4, 0x6611, - 0xD0D5, 0x6A8E, 0xD0D6, 0x7434, 0xD0D7, 0x7981, 0xD0D8, 0x79BD, - 0xD0D9, 0x82A9, 0xD0DA, 0x887E, 0xD0DB, 0x887F, 0xD0DC, 0x895F, - 0xD0DD, 0xF90A, 0xD0DE, 0x9326, 0xD0DF, 0x4F0B, 0xD0E0, 0x53CA, - 0xD0E1, 0x6025, 0xD0E2, 0x6271, 0xD0E3, 0x6C72, 0xD0E4, 0x7D1A, - 0xD0E5, 0x7D66, 0xD0E6, 0x4E98, 0xD0E7, 0x5162, 0xD0E8, 0x77DC, - 0xD0E9, 0x80AF, 0xD0EA, 0x4F01, 0xD0EB, 0x4F0E, 0xD0EC, 0x5176, - 0xD0ED, 0x5180, 0xD0EE, 0x55DC, 0xD0EF, 0x5668, 0xD0F0, 0x573B, - 0xD0F1, 0x57FA, 0xD0F2, 0x57FC, 0xD0F3, 0x5914, 0xD0F4, 0x5947, - 0xD0F5, 0x5993, 0xD0F6, 0x5BC4, 0xD0F7, 0x5C90, 0xD0F8, 0x5D0E, - 0xD0F9, 0x5DF1, 0xD0FA, 0x5E7E, 0xD0FB, 0x5FCC, 0xD0FC, 0x6280, - 0xD0FD, 0x65D7, 0xD0FE, 0x65E3, 0xD1A1, 0x671E, 0xD1A2, 0x671F, - 0xD1A3, 0x675E, 0xD1A4, 0x68CB, 0xD1A5, 0x68C4, 0xD1A6, 0x6A5F, - 0xD1A7, 0x6B3A, 0xD1A8, 0x6C23, 0xD1A9, 0x6C7D, 0xD1AA, 0x6C82, - 0xD1AB, 0x6DC7, 0xD1AC, 0x7398, 0xD1AD, 0x7426, 0xD1AE, 0x742A, - 0xD1AF, 0x7482, 0xD1B0, 0x74A3, 0xD1B1, 0x7578, 0xD1B2, 0x757F, - 0xD1B3, 0x7881, 0xD1B4, 0x78EF, 0xD1B5, 0x7941, 0xD1B6, 0x7947, - 0xD1B7, 0x7948, 0xD1B8, 0x797A, 0xD1B9, 0x7B95, 0xD1BA, 0x7D00, - 0xD1BB, 0x7DBA, 0xD1BC, 0x7F88, 0xD1BD, 0x8006, 0xD1BE, 0x802D, - 0xD1BF, 0x808C, 0xD1C0, 0x8A18, 0xD1C1, 0x8B4F, 0xD1C2, 0x8C48, - 0xD1C3, 0x8D77, 0xD1C4, 0x9321, 0xD1C5, 0x9324, 0xD1C6, 0x98E2, - 0xD1C7, 0x9951, 0xD1C8, 0x9A0E, 0xD1C9, 0x9A0F, 0xD1CA, 0x9A65, - 0xD1CB, 0x9E92, 0xD1CC, 0x7DCA, 0xD1CD, 0x4F76, 0xD1CE, 0x5409, - 0xD1CF, 0x62EE, 0xD1D0, 0x6854, 0xD1D1, 0x91D1, 0xD1D2, 0x55AB, - 0xD1D3, 0x513A, 0xD1D4, 0xF90B, 0xD1D5, 0xF90C, 0xD1D6, 0x5A1C, - 0xD1D7, 0x61E6, 0xD1D8, 0xF90D, 0xD1D9, 0x62CF, 0xD1DA, 0x62FF, - 0xD1DB, 0xF90E, 0xD1DC, 0xF90F, 0xD1DD, 0xF910, 0xD1DE, 0xF911, - 0xD1DF, 0xF912, 0xD1E0, 0xF913, 0xD1E1, 0x90A3, 0xD1E2, 0xF914, - 0xD1E3, 0xF915, 0xD1E4, 0xF916, 0xD1E5, 0xF917, 0xD1E6, 0xF918, - 0xD1E7, 0x8AFE, 0xD1E8, 0xF919, 0xD1E9, 0xF91A, 0xD1EA, 0xF91B, - 0xD1EB, 0xF91C, 0xD1EC, 0x6696, 0xD1ED, 0xF91D, 0xD1EE, 0x7156, - 0xD1EF, 0xF91E, 0xD1F0, 0xF91F, 0xD1F1, 0x96E3, 0xD1F2, 0xF920, - 0xD1F3, 0x634F, 0xD1F4, 0x637A, 0xD1F5, 0x5357, 0xD1F6, 0xF921, - 0xD1F7, 0x678F, 0xD1F8, 0x6960, 0xD1F9, 0x6E73, 0xD1FA, 0xF922, - 0xD1FB, 0x7537, 0xD1FC, 0xF923, 0xD1FD, 0xF924, 0xD1FE, 0xF925, - 0xD2A1, 0x7D0D, 0xD2A2, 0xF926, 0xD2A3, 0xF927, 0xD2A4, 0x8872, - 0xD2A5, 0x56CA, 0xD2A6, 0x5A18, 0xD2A7, 0xF928, 0xD2A8, 0xF929, - 0xD2A9, 0xF92A, 0xD2AA, 0xF92B, 0xD2AB, 0xF92C, 0xD2AC, 0x4E43, - 0xD2AD, 0xF92D, 0xD2AE, 0x5167, 0xD2AF, 0x5948, 0xD2B0, 0x67F0, - 0xD2B1, 0x8010, 0xD2B2, 0xF92E, 0xD2B3, 0x5973, 0xD2B4, 0x5E74, - 0xD2B5, 0x649A, 0xD2B6, 0x79CA, 0xD2B7, 0x5FF5, 0xD2B8, 0x606C, - 0xD2B9, 0x62C8, 0xD2BA, 0x637B, 0xD2BB, 0x5BE7, 0xD2BC, 0x5BD7, - 0xD2BD, 0x52AA, 0xD2BE, 0xF92F, 0xD2BF, 0x5974, 0xD2C0, 0x5F29, - 0xD2C1, 0x6012, 0xD2C2, 0xF930, 0xD2C3, 0xF931, 0xD2C4, 0xF932, - 0xD2C5, 0x7459, 0xD2C6, 0xF933, 0xD2C7, 0xF934, 0xD2C8, 0xF935, - 0xD2C9, 0xF936, 0xD2CA, 0xF937, 0xD2CB, 0xF938, 0xD2CC, 0x99D1, - 0xD2CD, 0xF939, 0xD2CE, 0xF93A, 0xD2CF, 0xF93B, 0xD2D0, 0xF93C, - 0xD2D1, 0xF93D, 0xD2D2, 0xF93E, 0xD2D3, 0xF93F, 0xD2D4, 0xF940, - 0xD2D5, 0xF941, 0xD2D6, 0xF942, 0xD2D7, 0xF943, 0xD2D8, 0x6FC3, - 0xD2D9, 0xF944, 0xD2DA, 0xF945, 0xD2DB, 0x81BF, 0xD2DC, 0x8FB2, - 0xD2DD, 0x60F1, 0xD2DE, 0xF946, 0xD2DF, 0xF947, 0xD2E0, 0x8166, - 0xD2E1, 0xF948, 0xD2E2, 0xF949, 0xD2E3, 0x5C3F, 0xD2E4, 0xF94A, - 0xD2E5, 0xF94B, 0xD2E6, 0xF94C, 0xD2E7, 0xF94D, 0xD2E8, 0xF94E, - 0xD2E9, 0xF94F, 0xD2EA, 0xF950, 0xD2EB, 0xF951, 0xD2EC, 0x5AE9, - 0xD2ED, 0x8A25, 0xD2EE, 0x677B, 0xD2EF, 0x7D10, 0xD2F0, 0xF952, - 0xD2F1, 0xF953, 0xD2F2, 0xF954, 0xD2F3, 0xF955, 0xD2F4, 0xF956, - 0xD2F5, 0xF957, 0xD2F6, 0x80FD, 0xD2F7, 0xF958, 0xD2F8, 0xF959, - 0xD2F9, 0x5C3C, 0xD2FA, 0x6CE5, 0xD2FB, 0x533F, 0xD2FC, 0x6EBA, - 0xD2FD, 0x591A, 0xD2FE, 0x8336, 0xD3A1, 0x4E39, 0xD3A2, 0x4EB6, - 0xD3A3, 0x4F46, 0xD3A4, 0x55AE, 0xD3A5, 0x5718, 0xD3A6, 0x58C7, - 0xD3A7, 0x5F56, 0xD3A8, 0x65B7, 0xD3A9, 0x65E6, 0xD3AA, 0x6A80, - 0xD3AB, 0x6BB5, 0xD3AC, 0x6E4D, 0xD3AD, 0x77ED, 0xD3AE, 0x7AEF, - 0xD3AF, 0x7C1E, 0xD3B0, 0x7DDE, 0xD3B1, 0x86CB, 0xD3B2, 0x8892, - 0xD3B3, 0x9132, 0xD3B4, 0x935B, 0xD3B5, 0x64BB, 0xD3B6, 0x6FBE, - 0xD3B7, 0x737A, 0xD3B8, 0x75B8, 0xD3B9, 0x9054, 0xD3BA, 0x5556, - 0xD3BB, 0x574D, 0xD3BC, 0x61BA, 0xD3BD, 0x64D4, 0xD3BE, 0x66C7, - 0xD3BF, 0x6DE1, 0xD3C0, 0x6E5B, 0xD3C1, 0x6F6D, 0xD3C2, 0x6FB9, - 0xD3C3, 0x75F0, 0xD3C4, 0x8043, 0xD3C5, 0x81BD, 0xD3C6, 0x8541, - 0xD3C7, 0x8983, 0xD3C8, 0x8AC7, 0xD3C9, 0x8B5A, 0xD3CA, 0x931F, - 0xD3CB, 0x6C93, 0xD3CC, 0x7553, 0xD3CD, 0x7B54, 0xD3CE, 0x8E0F, - 0xD3CF, 0x905D, 0xD3D0, 0x5510, 0xD3D1, 0x5802, 0xD3D2, 0x5858, - 0xD3D3, 0x5E62, 0xD3D4, 0x6207, 0xD3D5, 0x649E, 0xD3D6, 0x68E0, - 0xD3D7, 0x7576, 0xD3D8, 0x7CD6, 0xD3D9, 0x87B3, 0xD3DA, 0x9EE8, - 0xD3DB, 0x4EE3, 0xD3DC, 0x5788, 0xD3DD, 0x576E, 0xD3DE, 0x5927, - 0xD3DF, 0x5C0D, 0xD3E0, 0x5CB1, 0xD3E1, 0x5E36, 0xD3E2, 0x5F85, - 0xD3E3, 0x6234, 0xD3E4, 0x64E1, 0xD3E5, 0x73B3, 0xD3E6, 0x81FA, - 0xD3E7, 0x888B, 0xD3E8, 0x8CB8, 0xD3E9, 0x968A, 0xD3EA, 0x9EDB, - 0xD3EB, 0x5B85, 0xD3EC, 0x5FB7, 0xD3ED, 0x60B3, 0xD3EE, 0x5012, - 0xD3EF, 0x5200, 0xD3F0, 0x5230, 0xD3F1, 0x5716, 0xD3F2, 0x5835, - 0xD3F3, 0x5857, 0xD3F4, 0x5C0E, 0xD3F5, 0x5C60, 0xD3F6, 0x5CF6, - 0xD3F7, 0x5D8B, 0xD3F8, 0x5EA6, 0xD3F9, 0x5F92, 0xD3FA, 0x60BC, - 0xD3FB, 0x6311, 0xD3FC, 0x6389, 0xD3FD, 0x6417, 0xD3FE, 0x6843, - 0xD4A1, 0x68F9, 0xD4A2, 0x6AC2, 0xD4A3, 0x6DD8, 0xD4A4, 0x6E21, - 0xD4A5, 0x6ED4, 0xD4A6, 0x6FE4, 0xD4A7, 0x71FE, 0xD4A8, 0x76DC, - 0xD4A9, 0x7779, 0xD4AA, 0x79B1, 0xD4AB, 0x7A3B, 0xD4AC, 0x8404, - 0xD4AD, 0x89A9, 0xD4AE, 0x8CED, 0xD4AF, 0x8DF3, 0xD4B0, 0x8E48, - 0xD4B1, 0x9003, 0xD4B2, 0x9014, 0xD4B3, 0x9053, 0xD4B4, 0x90FD, - 0xD4B5, 0x934D, 0xD4B6, 0x9676, 0xD4B7, 0x97DC, 0xD4B8, 0x6BD2, - 0xD4B9, 0x7006, 0xD4BA, 0x7258, 0xD4BB, 0x72A2, 0xD4BC, 0x7368, - 0xD4BD, 0x7763, 0xD4BE, 0x79BF, 0xD4BF, 0x7BE4, 0xD4C0, 0x7E9B, - 0xD4C1, 0x8B80, 0xD4C2, 0x58A9, 0xD4C3, 0x60C7, 0xD4C4, 0x6566, - 0xD4C5, 0x65FD, 0xD4C6, 0x66BE, 0xD4C7, 0x6C8C, 0xD4C8, 0x711E, - 0xD4C9, 0x71C9, 0xD4CA, 0x8C5A, 0xD4CB, 0x9813, 0xD4CC, 0x4E6D, - 0xD4CD, 0x7A81, 0xD4CE, 0x4EDD, 0xD4CF, 0x51AC, 0xD4D0, 0x51CD, - 0xD4D1, 0x52D5, 0xD4D2, 0x540C, 0xD4D3, 0x61A7, 0xD4D4, 0x6771, - 0xD4D5, 0x6850, 0xD4D6, 0x68DF, 0xD4D7, 0x6D1E, 0xD4D8, 0x6F7C, - 0xD4D9, 0x75BC, 0xD4DA, 0x77B3, 0xD4DB, 0x7AE5, 0xD4DC, 0x80F4, - 0xD4DD, 0x8463, 0xD4DE, 0x9285, 0xD4DF, 0x515C, 0xD4E0, 0x6597, - 0xD4E1, 0x675C, 0xD4E2, 0x6793, 0xD4E3, 0x75D8, 0xD4E4, 0x7AC7, - 0xD4E5, 0x8373, 0xD4E6, 0xF95A, 0xD4E7, 0x8C46, 0xD4E8, 0x9017, - 0xD4E9, 0x982D, 0xD4EA, 0x5C6F, 0xD4EB, 0x81C0, 0xD4EC, 0x829A, - 0xD4ED, 0x9041, 0xD4EE, 0x906F, 0xD4EF, 0x920D, 0xD4F0, 0x5F97, - 0xD4F1, 0x5D9D, 0xD4F2, 0x6A59, 0xD4F3, 0x71C8, 0xD4F4, 0x767B, - 0xD4F5, 0x7B49, 0xD4F6, 0x85E4, 0xD4F7, 0x8B04, 0xD4F8, 0x9127, - 0xD4F9, 0x9A30, 0xD4FA, 0x5587, 0xD4FB, 0x61F6, 0xD4FC, 0xF95B, - 0xD4FD, 0x7669, 0xD4FE, 0x7F85, 0xD5A1, 0x863F, 0xD5A2, 0x87BA, - 0xD5A3, 0x88F8, 0xD5A4, 0x908F, 0xD5A5, 0xF95C, 0xD5A6, 0x6D1B, - 0xD5A7, 0x70D9, 0xD5A8, 0x73DE, 0xD5A9, 0x7D61, 0xD5AA, 0x843D, - 0xD5AB, 0xF95D, 0xD5AC, 0x916A, 0xD5AD, 0x99F1, 0xD5AE, 0xF95E, - 0xD5AF, 0x4E82, 0xD5B0, 0x5375, 0xD5B1, 0x6B04, 0xD5B2, 0x6B12, - 0xD5B3, 0x703E, 0xD5B4, 0x721B, 0xD5B5, 0x862D, 0xD5B6, 0x9E1E, - 0xD5B7, 0x524C, 0xD5B8, 0x8FA3, 0xD5B9, 0x5D50, 0xD5BA, 0x64E5, - 0xD5BB, 0x652C, 0xD5BC, 0x6B16, 0xD5BD, 0x6FEB, 0xD5BE, 0x7C43, - 0xD5BF, 0x7E9C, 0xD5C0, 0x85CD, 0xD5C1, 0x8964, 0xD5C2, 0x89BD, - 0xD5C3, 0x62C9, 0xD5C4, 0x81D8, 0xD5C5, 0x881F, 0xD5C6, 0x5ECA, - 0xD5C7, 0x6717, 0xD5C8, 0x6D6A, 0xD5C9, 0x72FC, 0xD5CA, 0x7405, - 0xD5CB, 0x746F, 0xD5CC, 0x8782, 0xD5CD, 0x90DE, 0xD5CE, 0x4F86, - 0xD5CF, 0x5D0D, 0xD5D0, 0x5FA0, 0xD5D1, 0x840A, 0xD5D2, 0x51B7, - 0xD5D3, 0x63A0, 0xD5D4, 0x7565, 0xD5D5, 0x4EAE, 0xD5D6, 0x5006, - 0xD5D7, 0x5169, 0xD5D8, 0x51C9, 0xD5D9, 0x6881, 0xD5DA, 0x6A11, - 0xD5DB, 0x7CAE, 0xD5DC, 0x7CB1, 0xD5DD, 0x7CE7, 0xD5DE, 0x826F, - 0xD5DF, 0x8AD2, 0xD5E0, 0x8F1B, 0xD5E1, 0x91CF, 0xD5E2, 0x4FB6, - 0xD5E3, 0x5137, 0xD5E4, 0x52F5, 0xD5E5, 0x5442, 0xD5E6, 0x5EEC, - 0xD5E7, 0x616E, 0xD5E8, 0x623E, 0xD5E9, 0x65C5, 0xD5EA, 0x6ADA, - 0xD5EB, 0x6FFE, 0xD5EC, 0x792A, 0xD5ED, 0x85DC, 0xD5EE, 0x8823, - 0xD5EF, 0x95AD, 0xD5F0, 0x9A62, 0xD5F1, 0x9A6A, 0xD5F2, 0x9E97, - 0xD5F3, 0x9ECE, 0xD5F4, 0x529B, 0xD5F5, 0x66C6, 0xD5F6, 0x6B77, - 0xD5F7, 0x701D, 0xD5F8, 0x792B, 0xD5F9, 0x8F62, 0xD5FA, 0x9742, - 0xD5FB, 0x6190, 0xD5FC, 0x6200, 0xD5FD, 0x6523, 0xD5FE, 0x6F23, - 0xD6A1, 0x7149, 0xD6A2, 0x7489, 0xD6A3, 0x7DF4, 0xD6A4, 0x806F, - 0xD6A5, 0x84EE, 0xD6A6, 0x8F26, 0xD6A7, 0x9023, 0xD6A8, 0x934A, - 0xD6A9, 0x51BD, 0xD6AA, 0x5217, 0xD6AB, 0x52A3, 0xD6AC, 0x6D0C, - 0xD6AD, 0x70C8, 0xD6AE, 0x88C2, 0xD6AF, 0x5EC9, 0xD6B0, 0x6582, - 0xD6B1, 0x6BAE, 0xD6B2, 0x6FC2, 0xD6B3, 0x7C3E, 0xD6B4, 0x7375, - 0xD6B5, 0x4EE4, 0xD6B6, 0x4F36, 0xD6B7, 0x56F9, 0xD6B8, 0xF95F, - 0xD6B9, 0x5CBA, 0xD6BA, 0x5DBA, 0xD6BB, 0x601C, 0xD6BC, 0x73B2, - 0xD6BD, 0x7B2D, 0xD6BE, 0x7F9A, 0xD6BF, 0x7FCE, 0xD6C0, 0x8046, - 0xD6C1, 0x901E, 0xD6C2, 0x9234, 0xD6C3, 0x96F6, 0xD6C4, 0x9748, - 0xD6C5, 0x9818, 0xD6C6, 0x9F61, 0xD6C7, 0x4F8B, 0xD6C8, 0x6FA7, - 0xD6C9, 0x79AE, 0xD6CA, 0x91B4, 0xD6CB, 0x96B7, 0xD6CC, 0x52DE, - 0xD6CD, 0xF960, 0xD6CE, 0x6488, 0xD6CF, 0x64C4, 0xD6D0, 0x6AD3, - 0xD6D1, 0x6F5E, 0xD6D2, 0x7018, 0xD6D3, 0x7210, 0xD6D4, 0x76E7, - 0xD6D5, 0x8001, 0xD6D6, 0x8606, 0xD6D7, 0x865C, 0xD6D8, 0x8DEF, - 0xD6D9, 0x8F05, 0xD6DA, 0x9732, 0xD6DB, 0x9B6F, 0xD6DC, 0x9DFA, - 0xD6DD, 0x9E75, 0xD6DE, 0x788C, 0xD6DF, 0x797F, 0xD6E0, 0x7DA0, - 0xD6E1, 0x83C9, 0xD6E2, 0x9304, 0xD6E3, 0x9E7F, 0xD6E4, 0x9E93, - 0xD6E5, 0x8AD6, 0xD6E6, 0x58DF, 0xD6E7, 0x5F04, 0xD6E8, 0x6727, - 0xD6E9, 0x7027, 0xD6EA, 0x74CF, 0xD6EB, 0x7C60, 0xD6EC, 0x807E, - 0xD6ED, 0x5121, 0xD6EE, 0x7028, 0xD6EF, 0x7262, 0xD6F0, 0x78CA, - 0xD6F1, 0x8CC2, 0xD6F2, 0x8CDA, 0xD6F3, 0x8CF4, 0xD6F4, 0x96F7, - 0xD6F5, 0x4E86, 0xD6F6, 0x50DA, 0xD6F7, 0x5BEE, 0xD6F8, 0x5ED6, - 0xD6F9, 0x6599, 0xD6FA, 0x71CE, 0xD6FB, 0x7642, 0xD6FC, 0x77AD, - 0xD6FD, 0x804A, 0xD6FE, 0x84FC, 0xD7A1, 0x907C, 0xD7A2, 0x9B27, - 0xD7A3, 0x9F8D, 0xD7A4, 0x58D8, 0xD7A5, 0x5A41, 0xD7A6, 0x5C62, - 0xD7A7, 0x6A13, 0xD7A8, 0x6DDA, 0xD7A9, 0x6F0F, 0xD7AA, 0x763B, - 0xD7AB, 0x7D2F, 0xD7AC, 0x7E37, 0xD7AD, 0x851E, 0xD7AE, 0x8938, - 0xD7AF, 0x93E4, 0xD7B0, 0x964B, 0xD7B1, 0x5289, 0xD7B2, 0x65D2, - 0xD7B3, 0x67F3, 0xD7B4, 0x69B4, 0xD7B5, 0x6D41, 0xD7B6, 0x6E9C, - 0xD7B7, 0x700F, 0xD7B8, 0x7409, 0xD7B9, 0x7460, 0xD7BA, 0x7559, - 0xD7BB, 0x7624, 0xD7BC, 0x786B, 0xD7BD, 0x8B2C, 0xD7BE, 0x985E, - 0xD7BF, 0x516D, 0xD7C0, 0x622E, 0xD7C1, 0x9678, 0xD7C2, 0x4F96, - 0xD7C3, 0x502B, 0xD7C4, 0x5D19, 0xD7C5, 0x6DEA, 0xD7C6, 0x7DB8, - 0xD7C7, 0x8F2A, 0xD7C8, 0x5F8B, 0xD7C9, 0x6144, 0xD7CA, 0x6817, - 0xD7CB, 0xF961, 0xD7CC, 0x9686, 0xD7CD, 0x52D2, 0xD7CE, 0x808B, - 0xD7CF, 0x51DC, 0xD7D0, 0x51CC, 0xD7D1, 0x695E, 0xD7D2, 0x7A1C, - 0xD7D3, 0x7DBE, 0xD7D4, 0x83F1, 0xD7D5, 0x9675, 0xD7D6, 0x4FDA, - 0xD7D7, 0x5229, 0xD7D8, 0x5398, 0xD7D9, 0x540F, 0xD7DA, 0x550E, - 0xD7DB, 0x5C65, 0xD7DC, 0x60A7, 0xD7DD, 0x674E, 0xD7DE, 0x68A8, - 0xD7DF, 0x6D6C, 0xD7E0, 0x7281, 0xD7E1, 0x72F8, 0xD7E2, 0x7406, - 0xD7E3, 0x7483, 0xD7E4, 0xF962, 0xD7E5, 0x75E2, 0xD7E6, 0x7C6C, - 0xD7E7, 0x7F79, 0xD7E8, 0x7FB8, 0xD7E9, 0x8389, 0xD7EA, 0x88CF, - 0xD7EB, 0x88E1, 0xD7EC, 0x91CC, 0xD7ED, 0x91D0, 0xD7EE, 0x96E2, - 0xD7EF, 0x9BC9, 0xD7F0, 0x541D, 0xD7F1, 0x6F7E, 0xD7F2, 0x71D0, - 0xD7F3, 0x7498, 0xD7F4, 0x85FA, 0xD7F5, 0x8EAA, 0xD7F6, 0x96A3, - 0xD7F7, 0x9C57, 0xD7F8, 0x9E9F, 0xD7F9, 0x6797, 0xD7FA, 0x6DCB, - 0xD7FB, 0x7433, 0xD7FC, 0x81E8, 0xD7FD, 0x9716, 0xD7FE, 0x782C, - 0xD8A1, 0x7ACB, 0xD8A2, 0x7B20, 0xD8A3, 0x7C92, 0xD8A4, 0x6469, - 0xD8A5, 0x746A, 0xD8A6, 0x75F2, 0xD8A7, 0x78BC, 0xD8A8, 0x78E8, - 0xD8A9, 0x99AC, 0xD8AA, 0x9B54, 0xD8AB, 0x9EBB, 0xD8AC, 0x5BDE, - 0xD8AD, 0x5E55, 0xD8AE, 0x6F20, 0xD8AF, 0x819C, 0xD8B0, 0x83AB, - 0xD8B1, 0x9088, 0xD8B2, 0x4E07, 0xD8B3, 0x534D, 0xD8B4, 0x5A29, - 0xD8B5, 0x5DD2, 0xD8B6, 0x5F4E, 0xD8B7, 0x6162, 0xD8B8, 0x633D, - 0xD8B9, 0x6669, 0xD8BA, 0x66FC, 0xD8BB, 0x6EFF, 0xD8BC, 0x6F2B, - 0xD8BD, 0x7063, 0xD8BE, 0x779E, 0xD8BF, 0x842C, 0xD8C0, 0x8513, - 0xD8C1, 0x883B, 0xD8C2, 0x8F13, 0xD8C3, 0x9945, 0xD8C4, 0x9C3B, - 0xD8C5, 0x551C, 0xD8C6, 0x62B9, 0xD8C7, 0x672B, 0xD8C8, 0x6CAB, - 0xD8C9, 0x8309, 0xD8CA, 0x896A, 0xD8CB, 0x977A, 0xD8CC, 0x4EA1, - 0xD8CD, 0x5984, 0xD8CE, 0x5FD8, 0xD8CF, 0x5FD9, 0xD8D0, 0x671B, - 0xD8D1, 0x7DB2, 0xD8D2, 0x7F54, 0xD8D3, 0x8292, 0xD8D4, 0x832B, - 0xD8D5, 0x83BD, 0xD8D6, 0x8F1E, 0xD8D7, 0x9099, 0xD8D8, 0x57CB, - 0xD8D9, 0x59B9, 0xD8DA, 0x5A92, 0xD8DB, 0x5BD0, 0xD8DC, 0x6627, - 0xD8DD, 0x679A, 0xD8DE, 0x6885, 0xD8DF, 0x6BCF, 0xD8E0, 0x7164, - 0xD8E1, 0x7F75, 0xD8E2, 0x8CB7, 0xD8E3, 0x8CE3, 0xD8E4, 0x9081, - 0xD8E5, 0x9B45, 0xD8E6, 0x8108, 0xD8E7, 0x8C8A, 0xD8E8, 0x964C, - 0xD8E9, 0x9A40, 0xD8EA, 0x9EA5, 0xD8EB, 0x5B5F, 0xD8EC, 0x6C13, - 0xD8ED, 0x731B, 0xD8EE, 0x76F2, 0xD8EF, 0x76DF, 0xD8F0, 0x840C, - 0xD8F1, 0x51AA, 0xD8F2, 0x8993, 0xD8F3, 0x514D, 0xD8F4, 0x5195, - 0xD8F5, 0x52C9, 0xD8F6, 0x68C9, 0xD8F7, 0x6C94, 0xD8F8, 0x7704, - 0xD8F9, 0x7720, 0xD8FA, 0x7DBF, 0xD8FB, 0x7DEC, 0xD8FC, 0x9762, - 0xD8FD, 0x9EB5, 0xD8FE, 0x6EC5, 0xD9A1, 0x8511, 0xD9A2, 0x51A5, - 0xD9A3, 0x540D, 0xD9A4, 0x547D, 0xD9A5, 0x660E, 0xD9A6, 0x669D, - 0xD9A7, 0x6927, 0xD9A8, 0x6E9F, 0xD9A9, 0x76BF, 0xD9AA, 0x7791, - 0xD9AB, 0x8317, 0xD9AC, 0x84C2, 0xD9AD, 0x879F, 0xD9AE, 0x9169, - 0xD9AF, 0x9298, 0xD9B0, 0x9CF4, 0xD9B1, 0x8882, 0xD9B2, 0x4FAE, - 0xD9B3, 0x5192, 0xD9B4, 0x52DF, 0xD9B5, 0x59C6, 0xD9B6, 0x5E3D, - 0xD9B7, 0x6155, 0xD9B8, 0x6478, 0xD9B9, 0x6479, 0xD9BA, 0x66AE, - 0xD9BB, 0x67D0, 0xD9BC, 0x6A21, 0xD9BD, 0x6BCD, 0xD9BE, 0x6BDB, - 0xD9BF, 0x725F, 0xD9C0, 0x7261, 0xD9C1, 0x7441, 0xD9C2, 0x7738, - 0xD9C3, 0x77DB, 0xD9C4, 0x8017, 0xD9C5, 0x82BC, 0xD9C6, 0x8305, - 0xD9C7, 0x8B00, 0xD9C8, 0x8B28, 0xD9C9, 0x8C8C, 0xD9CA, 0x6728, - 0xD9CB, 0x6C90, 0xD9CC, 0x7267, 0xD9CD, 0x76EE, 0xD9CE, 0x7766, - 0xD9CF, 0x7A46, 0xD9D0, 0x9DA9, 0xD9D1, 0x6B7F, 0xD9D2, 0x6C92, - 0xD9D3, 0x5922, 0xD9D4, 0x6726, 0xD9D5, 0x8499, 0xD9D6, 0x536F, - 0xD9D7, 0x5893, 0xD9D8, 0x5999, 0xD9D9, 0x5EDF, 0xD9DA, 0x63CF, - 0xD9DB, 0x6634, 0xD9DC, 0x6773, 0xD9DD, 0x6E3A, 0xD9DE, 0x732B, - 0xD9DF, 0x7AD7, 0xD9E0, 0x82D7, 0xD9E1, 0x9328, 0xD9E2, 0x52D9, - 0xD9E3, 0x5DEB, 0xD9E4, 0x61AE, 0xD9E5, 0x61CB, 0xD9E6, 0x620A, - 0xD9E7, 0x62C7, 0xD9E8, 0x64AB, 0xD9E9, 0x65E0, 0xD9EA, 0x6959, - 0xD9EB, 0x6B66, 0xD9EC, 0x6BCB, 0xD9ED, 0x7121, 0xD9EE, 0x73F7, - 0xD9EF, 0x755D, 0xD9F0, 0x7E46, 0xD9F1, 0x821E, 0xD9F2, 0x8302, - 0xD9F3, 0x856A, 0xD9F4, 0x8AA3, 0xD9F5, 0x8CBF, 0xD9F6, 0x9727, - 0xD9F7, 0x9D61, 0xD9F8, 0x58A8, 0xD9F9, 0x9ED8, 0xD9FA, 0x5011, - 0xD9FB, 0x520E, 0xD9FC, 0x543B, 0xD9FD, 0x554F, 0xD9FE, 0x6587, - 0xDAA1, 0x6C76, 0xDAA2, 0x7D0A, 0xDAA3, 0x7D0B, 0xDAA4, 0x805E, - 0xDAA5, 0x868A, 0xDAA6, 0x9580, 0xDAA7, 0x96EF, 0xDAA8, 0x52FF, - 0xDAA9, 0x6C95, 0xDAAA, 0x7269, 0xDAAB, 0x5473, 0xDAAC, 0x5A9A, - 0xDAAD, 0x5C3E, 0xDAAE, 0x5D4B, 0xDAAF, 0x5F4C, 0xDAB0, 0x5FAE, - 0xDAB1, 0x672A, 0xDAB2, 0x68B6, 0xDAB3, 0x6963, 0xDAB4, 0x6E3C, - 0xDAB5, 0x6E44, 0xDAB6, 0x7709, 0xDAB7, 0x7C73, 0xDAB8, 0x7F8E, - 0xDAB9, 0x8587, 0xDABA, 0x8B0E, 0xDABB, 0x8FF7, 0xDABC, 0x9761, - 0xDABD, 0x9EF4, 0xDABE, 0x5CB7, 0xDABF, 0x60B6, 0xDAC0, 0x610D, - 0xDAC1, 0x61AB, 0xDAC2, 0x654F, 0xDAC3, 0x65FB, 0xDAC4, 0x65FC, - 0xDAC5, 0x6C11, 0xDAC6, 0x6CEF, 0xDAC7, 0x739F, 0xDAC8, 0x73C9, - 0xDAC9, 0x7DE1, 0xDACA, 0x9594, 0xDACB, 0x5BC6, 0xDACC, 0x871C, - 0xDACD, 0x8B10, 0xDACE, 0x525D, 0xDACF, 0x535A, 0xDAD0, 0x62CD, - 0xDAD1, 0x640F, 0xDAD2, 0x64B2, 0xDAD3, 0x6734, 0xDAD4, 0x6A38, - 0xDAD5, 0x6CCA, 0xDAD6, 0x73C0, 0xDAD7, 0x749E, 0xDAD8, 0x7B94, - 0xDAD9, 0x7C95, 0xDADA, 0x7E1B, 0xDADB, 0x818A, 0xDADC, 0x8236, - 0xDADD, 0x8584, 0xDADE, 0x8FEB, 0xDADF, 0x96F9, 0xDAE0, 0x99C1, - 0xDAE1, 0x4F34, 0xDAE2, 0x534A, 0xDAE3, 0x53CD, 0xDAE4, 0x53DB, - 0xDAE5, 0x62CC, 0xDAE6, 0x642C, 0xDAE7, 0x6500, 0xDAE8, 0x6591, - 0xDAE9, 0x69C3, 0xDAEA, 0x6CEE, 0xDAEB, 0x6F58, 0xDAEC, 0x73ED, - 0xDAED, 0x7554, 0xDAEE, 0x7622, 0xDAEF, 0x76E4, 0xDAF0, 0x76FC, - 0xDAF1, 0x78D0, 0xDAF2, 0x78FB, 0xDAF3, 0x792C, 0xDAF4, 0x7D46, - 0xDAF5, 0x822C, 0xDAF6, 0x87E0, 0xDAF7, 0x8FD4, 0xDAF8, 0x9812, - 0xDAF9, 0x98EF, 0xDAFA, 0x52C3, 0xDAFB, 0x62D4, 0xDAFC, 0x64A5, - 0xDAFD, 0x6E24, 0xDAFE, 0x6F51, 0xDBA1, 0x767C, 0xDBA2, 0x8DCB, - 0xDBA3, 0x91B1, 0xDBA4, 0x9262, 0xDBA5, 0x9AEE, 0xDBA6, 0x9B43, - 0xDBA7, 0x5023, 0xDBA8, 0x508D, 0xDBA9, 0x574A, 0xDBAA, 0x59A8, - 0xDBAB, 0x5C28, 0xDBAC, 0x5E47, 0xDBAD, 0x5F77, 0xDBAE, 0x623F, - 0xDBAF, 0x653E, 0xDBB0, 0x65B9, 0xDBB1, 0x65C1, 0xDBB2, 0x6609, - 0xDBB3, 0x678B, 0xDBB4, 0x699C, 0xDBB5, 0x6EC2, 0xDBB6, 0x78C5, - 0xDBB7, 0x7D21, 0xDBB8, 0x80AA, 0xDBB9, 0x8180, 0xDBBA, 0x822B, - 0xDBBB, 0x82B3, 0xDBBC, 0x84A1, 0xDBBD, 0x868C, 0xDBBE, 0x8A2A, - 0xDBBF, 0x8B17, 0xDBC0, 0x90A6, 0xDBC1, 0x9632, 0xDBC2, 0x9F90, - 0xDBC3, 0x500D, 0xDBC4, 0x4FF3, 0xDBC5, 0xF963, 0xDBC6, 0x57F9, - 0xDBC7, 0x5F98, 0xDBC8, 0x62DC, 0xDBC9, 0x6392, 0xDBCA, 0x676F, - 0xDBCB, 0x6E43, 0xDBCC, 0x7119, 0xDBCD, 0x76C3, 0xDBCE, 0x80CC, - 0xDBCF, 0x80DA, 0xDBD0, 0x88F4, 0xDBD1, 0x88F5, 0xDBD2, 0x8919, - 0xDBD3, 0x8CE0, 0xDBD4, 0x8F29, 0xDBD5, 0x914D, 0xDBD6, 0x966A, - 0xDBD7, 0x4F2F, 0xDBD8, 0x4F70, 0xDBD9, 0x5E1B, 0xDBDA, 0x67CF, - 0xDBDB, 0x6822, 0xDBDC, 0x767D, 0xDBDD, 0x767E, 0xDBDE, 0x9B44, - 0xDBDF, 0x5E61, 0xDBE0, 0x6A0A, 0xDBE1, 0x7169, 0xDBE2, 0x71D4, - 0xDBE3, 0x756A, 0xDBE4, 0xF964, 0xDBE5, 0x7E41, 0xDBE6, 0x8543, - 0xDBE7, 0x85E9, 0xDBE8, 0x98DC, 0xDBE9, 0x4F10, 0xDBEA, 0x7B4F, - 0xDBEB, 0x7F70, 0xDBEC, 0x95A5, 0xDBED, 0x51E1, 0xDBEE, 0x5E06, - 0xDBEF, 0x68B5, 0xDBF0, 0x6C3E, 0xDBF1, 0x6C4E, 0xDBF2, 0x6CDB, - 0xDBF3, 0x72AF, 0xDBF4, 0x7BC4, 0xDBF5, 0x8303, 0xDBF6, 0x6CD5, - 0xDBF7, 0x743A, 0xDBF8, 0x50FB, 0xDBF9, 0x5288, 0xDBFA, 0x58C1, - 0xDBFB, 0x64D8, 0xDBFC, 0x6A97, 0xDBFD, 0x74A7, 0xDBFE, 0x7656, - 0xDCA1, 0x78A7, 0xDCA2, 0x8617, 0xDCA3, 0x95E2, 0xDCA4, 0x9739, - 0xDCA5, 0xF965, 0xDCA6, 0x535E, 0xDCA7, 0x5F01, 0xDCA8, 0x8B8A, - 0xDCA9, 0x8FA8, 0xDCAA, 0x8FAF, 0xDCAB, 0x908A, 0xDCAC, 0x5225, - 0xDCAD, 0x77A5, 0xDCAE, 0x9C49, 0xDCAF, 0x9F08, 0xDCB0, 0x4E19, - 0xDCB1, 0x5002, 0xDCB2, 0x5175, 0xDCB3, 0x5C5B, 0xDCB4, 0x5E77, - 0xDCB5, 0x661E, 0xDCB6, 0x663A, 0xDCB7, 0x67C4, 0xDCB8, 0x68C5, - 0xDCB9, 0x70B3, 0xDCBA, 0x7501, 0xDCBB, 0x75C5, 0xDCBC, 0x79C9, - 0xDCBD, 0x7ADD, 0xDCBE, 0x8F27, 0xDCBF, 0x9920, 0xDCC0, 0x9A08, - 0xDCC1, 0x4FDD, 0xDCC2, 0x5821, 0xDCC3, 0x5831, 0xDCC4, 0x5BF6, - 0xDCC5, 0x666E, 0xDCC6, 0x6B65, 0xDCC7, 0x6D11, 0xDCC8, 0x6E7A, - 0xDCC9, 0x6F7D, 0xDCCA, 0x73E4, 0xDCCB, 0x752B, 0xDCCC, 0x83E9, - 0xDCCD, 0x88DC, 0xDCCE, 0x8913, 0xDCCF, 0x8B5C, 0xDCD0, 0x8F14, - 0xDCD1, 0x4F0F, 0xDCD2, 0x50D5, 0xDCD3, 0x5310, 0xDCD4, 0x535C, - 0xDCD5, 0x5B93, 0xDCD6, 0x5FA9, 0xDCD7, 0x670D, 0xDCD8, 0x798F, - 0xDCD9, 0x8179, 0xDCDA, 0x832F, 0xDCDB, 0x8514, 0xDCDC, 0x8907, - 0xDCDD, 0x8986, 0xDCDE, 0x8F39, 0xDCDF, 0x8F3B, 0xDCE0, 0x99A5, - 0xDCE1, 0x9C12, 0xDCE2, 0x672C, 0xDCE3, 0x4E76, 0xDCE4, 0x4FF8, - 0xDCE5, 0x5949, 0xDCE6, 0x5C01, 0xDCE7, 0x5CEF, 0xDCE8, 0x5CF0, - 0xDCE9, 0x6367, 0xDCEA, 0x68D2, 0xDCEB, 0x70FD, 0xDCEC, 0x71A2, - 0xDCED, 0x742B, 0xDCEE, 0x7E2B, 0xDCEF, 0x84EC, 0xDCF0, 0x8702, - 0xDCF1, 0x9022, 0xDCF2, 0x92D2, 0xDCF3, 0x9CF3, 0xDCF4, 0x4E0D, - 0xDCF5, 0x4ED8, 0xDCF6, 0x4FEF, 0xDCF7, 0x5085, 0xDCF8, 0x5256, - 0xDCF9, 0x526F, 0xDCFA, 0x5426, 0xDCFB, 0x5490, 0xDCFC, 0x57E0, - 0xDCFD, 0x592B, 0xDCFE, 0x5A66, 0xDDA1, 0x5B5A, 0xDDA2, 0x5B75, - 0xDDA3, 0x5BCC, 0xDDA4, 0x5E9C, 0xDDA5, 0xF966, 0xDDA6, 0x6276, - 0xDDA7, 0x6577, 0xDDA8, 0x65A7, 0xDDA9, 0x6D6E, 0xDDAA, 0x6EA5, - 0xDDAB, 0x7236, 0xDDAC, 0x7B26, 0xDDAD, 0x7C3F, 0xDDAE, 0x7F36, - 0xDDAF, 0x8150, 0xDDB0, 0x8151, 0xDDB1, 0x819A, 0xDDB2, 0x8240, - 0xDDB3, 0x8299, 0xDDB4, 0x83A9, 0xDDB5, 0x8A03, 0xDDB6, 0x8CA0, - 0xDDB7, 0x8CE6, 0xDDB8, 0x8CFB, 0xDDB9, 0x8D74, 0xDDBA, 0x8DBA, - 0xDDBB, 0x90E8, 0xDDBC, 0x91DC, 0xDDBD, 0x961C, 0xDDBE, 0x9644, - 0xDDBF, 0x99D9, 0xDDC0, 0x9CE7, 0xDDC1, 0x5317, 0xDDC2, 0x5206, - 0xDDC3, 0x5429, 0xDDC4, 0x5674, 0xDDC5, 0x58B3, 0xDDC6, 0x5954, - 0xDDC7, 0x596E, 0xDDC8, 0x5FFF, 0xDDC9, 0x61A4, 0xDDCA, 0x626E, - 0xDDCB, 0x6610, 0xDDCC, 0x6C7E, 0xDDCD, 0x711A, 0xDDCE, 0x76C6, - 0xDDCF, 0x7C89, 0xDDD0, 0x7CDE, 0xDDD1, 0x7D1B, 0xDDD2, 0x82AC, - 0xDDD3, 0x8CC1, 0xDDD4, 0x96F0, 0xDDD5, 0xF967, 0xDDD6, 0x4F5B, - 0xDDD7, 0x5F17, 0xDDD8, 0x5F7F, 0xDDD9, 0x62C2, 0xDDDA, 0x5D29, - 0xDDDB, 0x670B, 0xDDDC, 0x68DA, 0xDDDD, 0x787C, 0xDDDE, 0x7E43, - 0xDDDF, 0x9D6C, 0xDDE0, 0x4E15, 0xDDE1, 0x5099, 0xDDE2, 0x5315, - 0xDDE3, 0x532A, 0xDDE4, 0x5351, 0xDDE5, 0x5983, 0xDDE6, 0x5A62, - 0xDDE7, 0x5E87, 0xDDE8, 0x60B2, 0xDDE9, 0x618A, 0xDDEA, 0x6249, - 0xDDEB, 0x6279, 0xDDEC, 0x6590, 0xDDED, 0x6787, 0xDDEE, 0x69A7, - 0xDDEF, 0x6BD4, 0xDDF0, 0x6BD6, 0xDDF1, 0x6BD7, 0xDDF2, 0x6BD8, - 0xDDF3, 0x6CB8, 0xDDF4, 0xF968, 0xDDF5, 0x7435, 0xDDF6, 0x75FA, - 0xDDF7, 0x7812, 0xDDF8, 0x7891, 0xDDF9, 0x79D5, 0xDDFA, 0x79D8, - 0xDDFB, 0x7C83, 0xDDFC, 0x7DCB, 0xDDFD, 0x7FE1, 0xDDFE, 0x80A5, - 0xDEA1, 0x813E, 0xDEA2, 0x81C2, 0xDEA3, 0x83F2, 0xDEA4, 0x871A, - 0xDEA5, 0x88E8, 0xDEA6, 0x8AB9, 0xDEA7, 0x8B6C, 0xDEA8, 0x8CBB, - 0xDEA9, 0x9119, 0xDEAA, 0x975E, 0xDEAB, 0x98DB, 0xDEAC, 0x9F3B, - 0xDEAD, 0x56AC, 0xDEAE, 0x5B2A, 0xDEAF, 0x5F6C, 0xDEB0, 0x658C, - 0xDEB1, 0x6AB3, 0xDEB2, 0x6BAF, 0xDEB3, 0x6D5C, 0xDEB4, 0x6FF1, - 0xDEB5, 0x7015, 0xDEB6, 0x725D, 0xDEB7, 0x73AD, 0xDEB8, 0x8CA7, - 0xDEB9, 0x8CD3, 0xDEBA, 0x983B, 0xDEBB, 0x6191, 0xDEBC, 0x6C37, - 0xDEBD, 0x8058, 0xDEBE, 0x9A01, 0xDEBF, 0x4E4D, 0xDEC0, 0x4E8B, - 0xDEC1, 0x4E9B, 0xDEC2, 0x4ED5, 0xDEC3, 0x4F3A, 0xDEC4, 0x4F3C, - 0xDEC5, 0x4F7F, 0xDEC6, 0x4FDF, 0xDEC7, 0x50FF, 0xDEC8, 0x53F2, - 0xDEC9, 0x53F8, 0xDECA, 0x5506, 0xDECB, 0x55E3, 0xDECC, 0x56DB, - 0xDECD, 0x58EB, 0xDECE, 0x5962, 0xDECF, 0x5A11, 0xDED0, 0x5BEB, - 0xDED1, 0x5BFA, 0xDED2, 0x5C04, 0xDED3, 0x5DF3, 0xDED4, 0x5E2B, - 0xDED5, 0x5F99, 0xDED6, 0x601D, 0xDED7, 0x6368, 0xDED8, 0x659C, - 0xDED9, 0x65AF, 0xDEDA, 0x67F6, 0xDEDB, 0x67FB, 0xDEDC, 0x68AD, - 0xDEDD, 0x6B7B, 0xDEDE, 0x6C99, 0xDEDF, 0x6CD7, 0xDEE0, 0x6E23, - 0xDEE1, 0x7009, 0xDEE2, 0x7345, 0xDEE3, 0x7802, 0xDEE4, 0x793E, - 0xDEE5, 0x7940, 0xDEE6, 0x7960, 0xDEE7, 0x79C1, 0xDEE8, 0x7BE9, - 0xDEE9, 0x7D17, 0xDEEA, 0x7D72, 0xDEEB, 0x8086, 0xDEEC, 0x820D, - 0xDEED, 0x838E, 0xDEEE, 0x84D1, 0xDEEF, 0x86C7, 0xDEF0, 0x88DF, - 0xDEF1, 0x8A50, 0xDEF2, 0x8A5E, 0xDEF3, 0x8B1D, 0xDEF4, 0x8CDC, - 0xDEF5, 0x8D66, 0xDEF6, 0x8FAD, 0xDEF7, 0x90AA, 0xDEF8, 0x98FC, - 0xDEF9, 0x99DF, 0xDEFA, 0x9E9D, 0xDEFB, 0x524A, 0xDEFC, 0xF969, - 0xDEFD, 0x6714, 0xDEFE, 0xF96A, 0xDFA1, 0x5098, 0xDFA2, 0x522A, - 0xDFA3, 0x5C71, 0xDFA4, 0x6563, 0xDFA5, 0x6C55, 0xDFA6, 0x73CA, - 0xDFA7, 0x7523, 0xDFA8, 0x759D, 0xDFA9, 0x7B97, 0xDFAA, 0x849C, - 0xDFAB, 0x9178, 0xDFAC, 0x9730, 0xDFAD, 0x4E77, 0xDFAE, 0x6492, - 0xDFAF, 0x6BBA, 0xDFB0, 0x715E, 0xDFB1, 0x85A9, 0xDFB2, 0x4E09, - 0xDFB3, 0xF96B, 0xDFB4, 0x6749, 0xDFB5, 0x68EE, 0xDFB6, 0x6E17, - 0xDFB7, 0x829F, 0xDFB8, 0x8518, 0xDFB9, 0x886B, 0xDFBA, 0x63F7, - 0xDFBB, 0x6F81, 0xDFBC, 0x9212, 0xDFBD, 0x98AF, 0xDFBE, 0x4E0A, - 0xDFBF, 0x50B7, 0xDFC0, 0x50CF, 0xDFC1, 0x511F, 0xDFC2, 0x5546, - 0xDFC3, 0x55AA, 0xDFC4, 0x5617, 0xDFC5, 0x5B40, 0xDFC6, 0x5C19, - 0xDFC7, 0x5CE0, 0xDFC8, 0x5E38, 0xDFC9, 0x5E8A, 0xDFCA, 0x5EA0, - 0xDFCB, 0x5EC2, 0xDFCC, 0x60F3, 0xDFCD, 0x6851, 0xDFCE, 0x6A61, - 0xDFCF, 0x6E58, 0xDFD0, 0x723D, 0xDFD1, 0x7240, 0xDFD2, 0x72C0, - 0xDFD3, 0x76F8, 0xDFD4, 0x7965, 0xDFD5, 0x7BB1, 0xDFD6, 0x7FD4, - 0xDFD7, 0x88F3, 0xDFD8, 0x89F4, 0xDFD9, 0x8A73, 0xDFDA, 0x8C61, - 0xDFDB, 0x8CDE, 0xDFDC, 0x971C, 0xDFDD, 0x585E, 0xDFDE, 0x74BD, - 0xDFDF, 0x8CFD, 0xDFE0, 0x55C7, 0xDFE1, 0xF96C, 0xDFE2, 0x7A61, - 0xDFE3, 0x7D22, 0xDFE4, 0x8272, 0xDFE5, 0x7272, 0xDFE6, 0x751F, - 0xDFE7, 0x7525, 0xDFE8, 0xF96D, 0xDFE9, 0x7B19, 0xDFEA, 0x5885, - 0xDFEB, 0x58FB, 0xDFEC, 0x5DBC, 0xDFED, 0x5E8F, 0xDFEE, 0x5EB6, - 0xDFEF, 0x5F90, 0xDFF0, 0x6055, 0xDFF1, 0x6292, 0xDFF2, 0x637F, - 0xDFF3, 0x654D, 0xDFF4, 0x6691, 0xDFF5, 0x66D9, 0xDFF6, 0x66F8, - 0xDFF7, 0x6816, 0xDFF8, 0x68F2, 0xDFF9, 0x7280, 0xDFFA, 0x745E, - 0xDFFB, 0x7B6E, 0xDFFC, 0x7D6E, 0xDFFD, 0x7DD6, 0xDFFE, 0x7F72, - 0xE0A1, 0x80E5, 0xE0A2, 0x8212, 0xE0A3, 0x85AF, 0xE0A4, 0x897F, - 0xE0A5, 0x8A93, 0xE0A6, 0x901D, 0xE0A7, 0x92E4, 0xE0A8, 0x9ECD, - 0xE0A9, 0x9F20, 0xE0AA, 0x5915, 0xE0AB, 0x596D, 0xE0AC, 0x5E2D, - 0xE0AD, 0x60DC, 0xE0AE, 0x6614, 0xE0AF, 0x6673, 0xE0B0, 0x6790, - 0xE0B1, 0x6C50, 0xE0B2, 0x6DC5, 0xE0B3, 0x6F5F, 0xE0B4, 0x77F3, - 0xE0B5, 0x78A9, 0xE0B6, 0x84C6, 0xE0B7, 0x91CB, 0xE0B8, 0x932B, - 0xE0B9, 0x4ED9, 0xE0BA, 0x50CA, 0xE0BB, 0x5148, 0xE0BC, 0x5584, - 0xE0BD, 0x5B0B, 0xE0BE, 0x5BA3, 0xE0BF, 0x6247, 0xE0C0, 0x657E, - 0xE0C1, 0x65CB, 0xE0C2, 0x6E32, 0xE0C3, 0x717D, 0xE0C4, 0x7401, - 0xE0C5, 0x7444, 0xE0C6, 0x7487, 0xE0C7, 0x74BF, 0xE0C8, 0x766C, - 0xE0C9, 0x79AA, 0xE0CA, 0x7DDA, 0xE0CB, 0x7E55, 0xE0CC, 0x7FA8, - 0xE0CD, 0x817A, 0xE0CE, 0x81B3, 0xE0CF, 0x8239, 0xE0D0, 0x861A, - 0xE0D1, 0x87EC, 0xE0D2, 0x8A75, 0xE0D3, 0x8DE3, 0xE0D4, 0x9078, - 0xE0D5, 0x9291, 0xE0D6, 0x9425, 0xE0D7, 0x994D, 0xE0D8, 0x9BAE, - 0xE0D9, 0x5368, 0xE0DA, 0x5C51, 0xE0DB, 0x6954, 0xE0DC, 0x6CC4, - 0xE0DD, 0x6D29, 0xE0DE, 0x6E2B, 0xE0DF, 0x820C, 0xE0E0, 0x859B, - 0xE0E1, 0x893B, 0xE0E2, 0x8A2D, 0xE0E3, 0x8AAA, 0xE0E4, 0x96EA, - 0xE0E5, 0x9F67, 0xE0E6, 0x5261, 0xE0E7, 0x66B9, 0xE0E8, 0x6BB2, - 0xE0E9, 0x7E96, 0xE0EA, 0x87FE, 0xE0EB, 0x8D0D, 0xE0EC, 0x9583, - 0xE0ED, 0x965D, 0xE0EE, 0x651D, 0xE0EF, 0x6D89, 0xE0F0, 0x71EE, - 0xE0F1, 0xF96E, 0xE0F2, 0x57CE, 0xE0F3, 0x59D3, 0xE0F4, 0x5BAC, - 0xE0F5, 0x6027, 0xE0F6, 0x60FA, 0xE0F7, 0x6210, 0xE0F8, 0x661F, - 0xE0F9, 0x665F, 0xE0FA, 0x7329, 0xE0FB, 0x73F9, 0xE0FC, 0x76DB, - 0xE0FD, 0x7701, 0xE0FE, 0x7B6C, 0xE1A1, 0x8056, 0xE1A2, 0x8072, - 0xE1A3, 0x8165, 0xE1A4, 0x8AA0, 0xE1A5, 0x9192, 0xE1A6, 0x4E16, - 0xE1A7, 0x52E2, 0xE1A8, 0x6B72, 0xE1A9, 0x6D17, 0xE1AA, 0x7A05, - 0xE1AB, 0x7B39, 0xE1AC, 0x7D30, 0xE1AD, 0xF96F, 0xE1AE, 0x8CB0, - 0xE1AF, 0x53EC, 0xE1B0, 0x562F, 0xE1B1, 0x5851, 0xE1B2, 0x5BB5, - 0xE1B3, 0x5C0F, 0xE1B4, 0x5C11, 0xE1B5, 0x5DE2, 0xE1B6, 0x6240, - 0xE1B7, 0x6383, 0xE1B8, 0x6414, 0xE1B9, 0x662D, 0xE1BA, 0x68B3, - 0xE1BB, 0x6CBC, 0xE1BC, 0x6D88, 0xE1BD, 0x6EAF, 0xE1BE, 0x701F, - 0xE1BF, 0x70A4, 0xE1C0, 0x71D2, 0xE1C1, 0x7526, 0xE1C2, 0x758F, - 0xE1C3, 0x758E, 0xE1C4, 0x7619, 0xE1C5, 0x7B11, 0xE1C6, 0x7BE0, - 0xE1C7, 0x7C2B, 0xE1C8, 0x7D20, 0xE1C9, 0x7D39, 0xE1CA, 0x852C, - 0xE1CB, 0x856D, 0xE1CC, 0x8607, 0xE1CD, 0x8A34, 0xE1CE, 0x900D, - 0xE1CF, 0x9061, 0xE1D0, 0x90B5, 0xE1D1, 0x92B7, 0xE1D2, 0x97F6, - 0xE1D3, 0x9A37, 0xE1D4, 0x4FD7, 0xE1D5, 0x5C6C, 0xE1D6, 0x675F, - 0xE1D7, 0x6D91, 0xE1D8, 0x7C9F, 0xE1D9, 0x7E8C, 0xE1DA, 0x8B16, - 0xE1DB, 0x8D16, 0xE1DC, 0x901F, 0xE1DD, 0x5B6B, 0xE1DE, 0x5DFD, - 0xE1DF, 0x640D, 0xE1E0, 0x84C0, 0xE1E1, 0x905C, 0xE1E2, 0x98E1, - 0xE1E3, 0x7387, 0xE1E4, 0x5B8B, 0xE1E5, 0x609A, 0xE1E6, 0x677E, - 0xE1E7, 0x6DDE, 0xE1E8, 0x8A1F, 0xE1E9, 0x8AA6, 0xE1EA, 0x9001, - 0xE1EB, 0x980C, 0xE1EC, 0x5237, 0xE1ED, 0xF970, 0xE1EE, 0x7051, - 0xE1EF, 0x788E, 0xE1F0, 0x9396, 0xE1F1, 0x8870, 0xE1F2, 0x91D7, - 0xE1F3, 0x4FEE, 0xE1F4, 0x53D7, 0xE1F5, 0x55FD, 0xE1F6, 0x56DA, - 0xE1F7, 0x5782, 0xE1F8, 0x58FD, 0xE1F9, 0x5AC2, 0xE1FA, 0x5B88, - 0xE1FB, 0x5CAB, 0xE1FC, 0x5CC0, 0xE1FD, 0x5E25, 0xE1FE, 0x6101, - 0xE2A1, 0x620D, 0xE2A2, 0x624B, 0xE2A3, 0x6388, 0xE2A4, 0x641C, - 0xE2A5, 0x6536, 0xE2A6, 0x6578, 0xE2A7, 0x6A39, 0xE2A8, 0x6B8A, - 0xE2A9, 0x6C34, 0xE2AA, 0x6D19, 0xE2AB, 0x6F31, 0xE2AC, 0x71E7, - 0xE2AD, 0x72E9, 0xE2AE, 0x7378, 0xE2AF, 0x7407, 0xE2B0, 0x74B2, - 0xE2B1, 0x7626, 0xE2B2, 0x7761, 0xE2B3, 0x79C0, 0xE2B4, 0x7A57, - 0xE2B5, 0x7AEA, 0xE2B6, 0x7CB9, 0xE2B7, 0x7D8F, 0xE2B8, 0x7DAC, - 0xE2B9, 0x7E61, 0xE2BA, 0x7F9E, 0xE2BB, 0x8129, 0xE2BC, 0x8331, - 0xE2BD, 0x8490, 0xE2BE, 0x84DA, 0xE2BF, 0x85EA, 0xE2C0, 0x8896, - 0xE2C1, 0x8AB0, 0xE2C2, 0x8B90, 0xE2C3, 0x8F38, 0xE2C4, 0x9042, - 0xE2C5, 0x9083, 0xE2C6, 0x916C, 0xE2C7, 0x9296, 0xE2C8, 0x92B9, - 0xE2C9, 0x968B, 0xE2CA, 0x96A7, 0xE2CB, 0x96A8, 0xE2CC, 0x96D6, - 0xE2CD, 0x9700, 0xE2CE, 0x9808, 0xE2CF, 0x9996, 0xE2D0, 0x9AD3, - 0xE2D1, 0x9B1A, 0xE2D2, 0x53D4, 0xE2D3, 0x587E, 0xE2D4, 0x5919, - 0xE2D5, 0x5B70, 0xE2D6, 0x5BBF, 0xE2D7, 0x6DD1, 0xE2D8, 0x6F5A, - 0xE2D9, 0x719F, 0xE2DA, 0x7421, 0xE2DB, 0x74B9, 0xE2DC, 0x8085, - 0xE2DD, 0x83FD, 0xE2DE, 0x5DE1, 0xE2DF, 0x5F87, 0xE2E0, 0x5FAA, - 0xE2E1, 0x6042, 0xE2E2, 0x65EC, 0xE2E3, 0x6812, 0xE2E4, 0x696F, - 0xE2E5, 0x6A53, 0xE2E6, 0x6B89, 0xE2E7, 0x6D35, 0xE2E8, 0x6DF3, - 0xE2E9, 0x73E3, 0xE2EA, 0x76FE, 0xE2EB, 0x77AC, 0xE2EC, 0x7B4D, - 0xE2ED, 0x7D14, 0xE2EE, 0x8123, 0xE2EF, 0x821C, 0xE2F0, 0x8340, - 0xE2F1, 0x84F4, 0xE2F2, 0x8563, 0xE2F3, 0x8A62, 0xE2F4, 0x8AC4, - 0xE2F5, 0x9187, 0xE2F6, 0x931E, 0xE2F7, 0x9806, 0xE2F8, 0x99B4, - 0xE2F9, 0x620C, 0xE2FA, 0x8853, 0xE2FB, 0x8FF0, 0xE2FC, 0x9265, - 0xE2FD, 0x5D07, 0xE2FE, 0x5D27, 0xE3A1, 0x5D69, 0xE3A2, 0x745F, - 0xE3A3, 0x819D, 0xE3A4, 0x8768, 0xE3A5, 0x6FD5, 0xE3A6, 0x62FE, - 0xE3A7, 0x7FD2, 0xE3A8, 0x8936, 0xE3A9, 0x8972, 0xE3AA, 0x4E1E, - 0xE3AB, 0x4E58, 0xE3AC, 0x50E7, 0xE3AD, 0x52DD, 0xE3AE, 0x5347, - 0xE3AF, 0x627F, 0xE3B0, 0x6607, 0xE3B1, 0x7E69, 0xE3B2, 0x8805, - 0xE3B3, 0x965E, 0xE3B4, 0x4F8D, 0xE3B5, 0x5319, 0xE3B6, 0x5636, - 0xE3B7, 0x59CB, 0xE3B8, 0x5AA4, 0xE3B9, 0x5C38, 0xE3BA, 0x5C4E, - 0xE3BB, 0x5C4D, 0xE3BC, 0x5E02, 0xE3BD, 0x5F11, 0xE3BE, 0x6043, - 0xE3BF, 0x65BD, 0xE3C0, 0x662F, 0xE3C1, 0x6642, 0xE3C2, 0x67BE, - 0xE3C3, 0x67F4, 0xE3C4, 0x731C, 0xE3C5, 0x77E2, 0xE3C6, 0x793A, - 0xE3C7, 0x7FC5, 0xE3C8, 0x8494, 0xE3C9, 0x84CD, 0xE3CA, 0x8996, - 0xE3CB, 0x8A66, 0xE3CC, 0x8A69, 0xE3CD, 0x8AE1, 0xE3CE, 0x8C55, - 0xE3CF, 0x8C7A, 0xE3D0, 0x57F4, 0xE3D1, 0x5BD4, 0xE3D2, 0x5F0F, - 0xE3D3, 0x606F, 0xE3D4, 0x62ED, 0xE3D5, 0x690D, 0xE3D6, 0x6B96, - 0xE3D7, 0x6E5C, 0xE3D8, 0x7184, 0xE3D9, 0x7BD2, 0xE3DA, 0x8755, - 0xE3DB, 0x8B58, 0xE3DC, 0x8EFE, 0xE3DD, 0x98DF, 0xE3DE, 0x98FE, - 0xE3DF, 0x4F38, 0xE3E0, 0x4F81, 0xE3E1, 0x4FE1, 0xE3E2, 0x547B, - 0xE3E3, 0x5A20, 0xE3E4, 0x5BB8, 0xE3E5, 0x613C, 0xE3E6, 0x65B0, - 0xE3E7, 0x6668, 0xE3E8, 0x71FC, 0xE3E9, 0x7533, 0xE3EA, 0x795E, - 0xE3EB, 0x7D33, 0xE3EC, 0x814E, 0xE3ED, 0x81E3, 0xE3EE, 0x8398, - 0xE3EF, 0x85AA, 0xE3F0, 0x85CE, 0xE3F1, 0x8703, 0xE3F2, 0x8A0A, - 0xE3F3, 0x8EAB, 0xE3F4, 0x8F9B, 0xE3F5, 0xF971, 0xE3F6, 0x8FC5, - 0xE3F7, 0x5931, 0xE3F8, 0x5BA4, 0xE3F9, 0x5BE6, 0xE3FA, 0x6089, - 0xE3FB, 0x5BE9, 0xE3FC, 0x5C0B, 0xE3FD, 0x5FC3, 0xE3FE, 0x6C81, - 0xE4A1, 0xF972, 0xE4A2, 0x6DF1, 0xE4A3, 0x700B, 0xE4A4, 0x751A, - 0xE4A5, 0x82AF, 0xE4A6, 0x8AF6, 0xE4A7, 0x4EC0, 0xE4A8, 0x5341, - 0xE4A9, 0xF973, 0xE4AA, 0x96D9, 0xE4AB, 0x6C0F, 0xE4AC, 0x4E9E, - 0xE4AD, 0x4FC4, 0xE4AE, 0x5152, 0xE4AF, 0x555E, 0xE4B0, 0x5A25, - 0xE4B1, 0x5CE8, 0xE4B2, 0x6211, 0xE4B3, 0x7259, 0xE4B4, 0x82BD, - 0xE4B5, 0x83AA, 0xE4B6, 0x86FE, 0xE4B7, 0x8859, 0xE4B8, 0x8A1D, - 0xE4B9, 0x963F, 0xE4BA, 0x96C5, 0xE4BB, 0x9913, 0xE4BC, 0x9D09, - 0xE4BD, 0x9D5D, 0xE4BE, 0x580A, 0xE4BF, 0x5CB3, 0xE4C0, 0x5DBD, - 0xE4C1, 0x5E44, 0xE4C2, 0x60E1, 0xE4C3, 0x6115, 0xE4C4, 0x63E1, - 0xE4C5, 0x6A02, 0xE4C6, 0x6E25, 0xE4C7, 0x9102, 0xE4C8, 0x9354, - 0xE4C9, 0x984E, 0xE4CA, 0x9C10, 0xE4CB, 0x9F77, 0xE4CC, 0x5B89, - 0xE4CD, 0x5CB8, 0xE4CE, 0x6309, 0xE4CF, 0x664F, 0xE4D0, 0x6848, - 0xE4D1, 0x773C, 0xE4D2, 0x96C1, 0xE4D3, 0x978D, 0xE4D4, 0x9854, - 0xE4D5, 0x9B9F, 0xE4D6, 0x65A1, 0xE4D7, 0x8B01, 0xE4D8, 0x8ECB, - 0xE4D9, 0x95BC, 0xE4DA, 0x5535, 0xE4DB, 0x5CA9, 0xE4DC, 0x5DD6, - 0xE4DD, 0x5EB5, 0xE4DE, 0x6697, 0xE4DF, 0x764C, 0xE4E0, 0x83F4, - 0xE4E1, 0x95C7, 0xE4E2, 0x58D3, 0xE4E3, 0x62BC, 0xE4E4, 0x72CE, - 0xE4E5, 0x9D28, 0xE4E6, 0x4EF0, 0xE4E7, 0x592E, 0xE4E8, 0x600F, - 0xE4E9, 0x663B, 0xE4EA, 0x6B83, 0xE4EB, 0x79E7, 0xE4EC, 0x9D26, - 0xE4ED, 0x5393, 0xE4EE, 0x54C0, 0xE4EF, 0x57C3, 0xE4F0, 0x5D16, - 0xE4F1, 0x611B, 0xE4F2, 0x66D6, 0xE4F3, 0x6DAF, 0xE4F4, 0x788D, - 0xE4F5, 0x827E, 0xE4F6, 0x9698, 0xE4F7, 0x9744, 0xE4F8, 0x5384, - 0xE4F9, 0x627C, 0xE4FA, 0x6396, 0xE4FB, 0x6DB2, 0xE4FC, 0x7E0A, - 0xE4FD, 0x814B, 0xE4FE, 0x984D, 0xE5A1, 0x6AFB, 0xE5A2, 0x7F4C, - 0xE5A3, 0x9DAF, 0xE5A4, 0x9E1A, 0xE5A5, 0x4E5F, 0xE5A6, 0x503B, - 0xE5A7, 0x51B6, 0xE5A8, 0x591C, 0xE5A9, 0x60F9, 0xE5AA, 0x63F6, - 0xE5AB, 0x6930, 0xE5AC, 0x723A, 0xE5AD, 0x8036, 0xE5AE, 0xF974, - 0xE5AF, 0x91CE, 0xE5B0, 0x5F31, 0xE5B1, 0xF975, 0xE5B2, 0xF976, - 0xE5B3, 0x7D04, 0xE5B4, 0x82E5, 0xE5B5, 0x846F, 0xE5B6, 0x84BB, - 0xE5B7, 0x85E5, 0xE5B8, 0x8E8D, 0xE5B9, 0xF977, 0xE5BA, 0x4F6F, - 0xE5BB, 0xF978, 0xE5BC, 0xF979, 0xE5BD, 0x58E4, 0xE5BE, 0x5B43, - 0xE5BF, 0x6059, 0xE5C0, 0x63DA, 0xE5C1, 0x6518, 0xE5C2, 0x656D, - 0xE5C3, 0x6698, 0xE5C4, 0xF97A, 0xE5C5, 0x694A, 0xE5C6, 0x6A23, - 0xE5C7, 0x6D0B, 0xE5C8, 0x7001, 0xE5C9, 0x716C, 0xE5CA, 0x75D2, - 0xE5CB, 0x760D, 0xE5CC, 0x79B3, 0xE5CD, 0x7A70, 0xE5CE, 0xF97B, - 0xE5CF, 0x7F8A, 0xE5D0, 0xF97C, 0xE5D1, 0x8944, 0xE5D2, 0xF97D, - 0xE5D3, 0x8B93, 0xE5D4, 0x91C0, 0xE5D5, 0x967D, 0xE5D6, 0xF97E, - 0xE5D7, 0x990A, 0xE5D8, 0x5704, 0xE5D9, 0x5FA1, 0xE5DA, 0x65BC, - 0xE5DB, 0x6F01, 0xE5DC, 0x7600, 0xE5DD, 0x79A6, 0xE5DE, 0x8A9E, - 0xE5DF, 0x99AD, 0xE5E0, 0x9B5A, 0xE5E1, 0x9F6C, 0xE5E2, 0x5104, - 0xE5E3, 0x61B6, 0xE5E4, 0x6291, 0xE5E5, 0x6A8D, 0xE5E6, 0x81C6, - 0xE5E7, 0x5043, 0xE5E8, 0x5830, 0xE5E9, 0x5F66, 0xE5EA, 0x7109, - 0xE5EB, 0x8A00, 0xE5EC, 0x8AFA, 0xE5ED, 0x5B7C, 0xE5EE, 0x8616, - 0xE5EF, 0x4FFA, 0xE5F0, 0x513C, 0xE5F1, 0x56B4, 0xE5F2, 0x5944, - 0xE5F3, 0x63A9, 0xE5F4, 0x6DF9, 0xE5F5, 0x5DAA, 0xE5F6, 0x696D, - 0xE5F7, 0x5186, 0xE5F8, 0x4E88, 0xE5F9, 0x4F59, 0xE5FA, 0xF97F, - 0xE5FB, 0xF980, 0xE5FC, 0xF981, 0xE5FD, 0x5982, 0xE5FE, 0xF982, - 0xE6A1, 0xF983, 0xE6A2, 0x6B5F, 0xE6A3, 0x6C5D, 0xE6A4, 0xF984, - 0xE6A5, 0x74B5, 0xE6A6, 0x7916, 0xE6A7, 0xF985, 0xE6A8, 0x8207, - 0xE6A9, 0x8245, 0xE6AA, 0x8339, 0xE6AB, 0x8F3F, 0xE6AC, 0x8F5D, - 0xE6AD, 0xF986, 0xE6AE, 0x9918, 0xE6AF, 0xF987, 0xE6B0, 0xF988, - 0xE6B1, 0xF989, 0xE6B2, 0x4EA6, 0xE6B3, 0xF98A, 0xE6B4, 0x57DF, - 0xE6B5, 0x5F79, 0xE6B6, 0x6613, 0xE6B7, 0xF98B, 0xE6B8, 0xF98C, - 0xE6B9, 0x75AB, 0xE6BA, 0x7E79, 0xE6BB, 0x8B6F, 0xE6BC, 0xF98D, - 0xE6BD, 0x9006, 0xE6BE, 0x9A5B, 0xE6BF, 0x56A5, 0xE6C0, 0x5827, - 0xE6C1, 0x59F8, 0xE6C2, 0x5A1F, 0xE6C3, 0x5BB4, 0xE6C4, 0xF98E, - 0xE6C5, 0x5EF6, 0xE6C6, 0xF98F, 0xE6C7, 0xF990, 0xE6C8, 0x6350, - 0xE6C9, 0x633B, 0xE6CA, 0xF991, 0xE6CB, 0x693D, 0xE6CC, 0x6C87, - 0xE6CD, 0x6CBF, 0xE6CE, 0x6D8E, 0xE6CF, 0x6D93, 0xE6D0, 0x6DF5, - 0xE6D1, 0x6F14, 0xE6D2, 0xF992, 0xE6D3, 0x70DF, 0xE6D4, 0x7136, - 0xE6D5, 0x7159, 0xE6D6, 0xF993, 0xE6D7, 0x71C3, 0xE6D8, 0x71D5, - 0xE6D9, 0xF994, 0xE6DA, 0x784F, 0xE6DB, 0x786F, 0xE6DC, 0xF995, - 0xE6DD, 0x7B75, 0xE6DE, 0x7DE3, 0xE6DF, 0xF996, 0xE6E0, 0x7E2F, - 0xE6E1, 0xF997, 0xE6E2, 0x884D, 0xE6E3, 0x8EDF, 0xE6E4, 0xF998, - 0xE6E5, 0xF999, 0xE6E6, 0xF99A, 0xE6E7, 0x925B, 0xE6E8, 0xF99B, - 0xE6E9, 0x9CF6, 0xE6EA, 0xF99C, 0xE6EB, 0xF99D, 0xE6EC, 0xF99E, - 0xE6ED, 0x6085, 0xE6EE, 0x6D85, 0xE6EF, 0xF99F, 0xE6F0, 0x71B1, - 0xE6F1, 0xF9A0, 0xE6F2, 0xF9A1, 0xE6F3, 0x95B1, 0xE6F4, 0x53AD, - 0xE6F5, 0xF9A2, 0xE6F6, 0xF9A3, 0xE6F7, 0xF9A4, 0xE6F8, 0x67D3, - 0xE6F9, 0xF9A5, 0xE6FA, 0x708E, 0xE6FB, 0x7130, 0xE6FC, 0x7430, - 0xE6FD, 0x8276, 0xE6FE, 0x82D2, 0xE7A1, 0xF9A6, 0xE7A2, 0x95BB, - 0xE7A3, 0x9AE5, 0xE7A4, 0x9E7D, 0xE7A5, 0x66C4, 0xE7A6, 0xF9A7, - 0xE7A7, 0x71C1, 0xE7A8, 0x8449, 0xE7A9, 0xF9A8, 0xE7AA, 0xF9A9, - 0xE7AB, 0x584B, 0xE7AC, 0xF9AA, 0xE7AD, 0xF9AB, 0xE7AE, 0x5DB8, - 0xE7AF, 0x5F71, 0xE7B0, 0xF9AC, 0xE7B1, 0x6620, 0xE7B2, 0x668E, - 0xE7B3, 0x6979, 0xE7B4, 0x69AE, 0xE7B5, 0x6C38, 0xE7B6, 0x6CF3, - 0xE7B7, 0x6E36, 0xE7B8, 0x6F41, 0xE7B9, 0x6FDA, 0xE7BA, 0x701B, - 0xE7BB, 0x702F, 0xE7BC, 0x7150, 0xE7BD, 0x71DF, 0xE7BE, 0x7370, - 0xE7BF, 0xF9AD, 0xE7C0, 0x745B, 0xE7C1, 0xF9AE, 0xE7C2, 0x74D4, - 0xE7C3, 0x76C8, 0xE7C4, 0x7A4E, 0xE7C5, 0x7E93, 0xE7C6, 0xF9AF, - 0xE7C7, 0xF9B0, 0xE7C8, 0x82F1, 0xE7C9, 0x8A60, 0xE7CA, 0x8FCE, - 0xE7CB, 0xF9B1, 0xE7CC, 0x9348, 0xE7CD, 0xF9B2, 0xE7CE, 0x9719, - 0xE7CF, 0xF9B3, 0xE7D0, 0xF9B4, 0xE7D1, 0x4E42, 0xE7D2, 0x502A, - 0xE7D3, 0xF9B5, 0xE7D4, 0x5208, 0xE7D5, 0x53E1, 0xE7D6, 0x66F3, - 0xE7D7, 0x6C6D, 0xE7D8, 0x6FCA, 0xE7D9, 0x730A, 0xE7DA, 0x777F, - 0xE7DB, 0x7A62, 0xE7DC, 0x82AE, 0xE7DD, 0x85DD, 0xE7DE, 0x8602, - 0xE7DF, 0xF9B6, 0xE7E0, 0x88D4, 0xE7E1, 0x8A63, 0xE7E2, 0x8B7D, - 0xE7E3, 0x8C6B, 0xE7E4, 0xF9B7, 0xE7E5, 0x92B3, 0xE7E6, 0xF9B8, - 0xE7E7, 0x9713, 0xE7E8, 0x9810, 0xE7E9, 0x4E94, 0xE7EA, 0x4F0D, - 0xE7EB, 0x4FC9, 0xE7EC, 0x50B2, 0xE7ED, 0x5348, 0xE7EE, 0x543E, - 0xE7EF, 0x5433, 0xE7F0, 0x55DA, 0xE7F1, 0x5862, 0xE7F2, 0x58BA, - 0xE7F3, 0x5967, 0xE7F4, 0x5A1B, 0xE7F5, 0x5BE4, 0xE7F6, 0x609F, - 0xE7F7, 0xF9B9, 0xE7F8, 0x61CA, 0xE7F9, 0x6556, 0xE7FA, 0x65FF, - 0xE7FB, 0x6664, 0xE7FC, 0x68A7, 0xE7FD, 0x6C5A, 0xE7FE, 0x6FB3, - 0xE8A1, 0x70CF, 0xE8A2, 0x71AC, 0xE8A3, 0x7352, 0xE8A4, 0x7B7D, - 0xE8A5, 0x8708, 0xE8A6, 0x8AA4, 0xE8A7, 0x9C32, 0xE8A8, 0x9F07, - 0xE8A9, 0x5C4B, 0xE8AA, 0x6C83, 0xE8AB, 0x7344, 0xE8AC, 0x7389, - 0xE8AD, 0x923A, 0xE8AE, 0x6EAB, 0xE8AF, 0x7465, 0xE8B0, 0x761F, - 0xE8B1, 0x7A69, 0xE8B2, 0x7E15, 0xE8B3, 0x860A, 0xE8B4, 0x5140, - 0xE8B5, 0x58C5, 0xE8B6, 0x64C1, 0xE8B7, 0x74EE, 0xE8B8, 0x7515, - 0xE8B9, 0x7670, 0xE8BA, 0x7FC1, 0xE8BB, 0x9095, 0xE8BC, 0x96CD, - 0xE8BD, 0x9954, 0xE8BE, 0x6E26, 0xE8BF, 0x74E6, 0xE8C0, 0x7AA9, - 0xE8C1, 0x7AAA, 0xE8C2, 0x81E5, 0xE8C3, 0x86D9, 0xE8C4, 0x8778, - 0xE8C5, 0x8A1B, 0xE8C6, 0x5A49, 0xE8C7, 0x5B8C, 0xE8C8, 0x5B9B, - 0xE8C9, 0x68A1, 0xE8CA, 0x6900, 0xE8CB, 0x6D63, 0xE8CC, 0x73A9, - 0xE8CD, 0x7413, 0xE8CE, 0x742C, 0xE8CF, 0x7897, 0xE8D0, 0x7DE9, - 0xE8D1, 0x7FEB, 0xE8D2, 0x8118, 0xE8D3, 0x8155, 0xE8D4, 0x839E, - 0xE8D5, 0x8C4C, 0xE8D6, 0x962E, 0xE8D7, 0x9811, 0xE8D8, 0x66F0, - 0xE8D9, 0x5F80, 0xE8DA, 0x65FA, 0xE8DB, 0x6789, 0xE8DC, 0x6C6A, - 0xE8DD, 0x738B, 0xE8DE, 0x502D, 0xE8DF, 0x5A03, 0xE8E0, 0x6B6A, - 0xE8E1, 0x77EE, 0xE8E2, 0x5916, 0xE8E3, 0x5D6C, 0xE8E4, 0x5DCD, - 0xE8E5, 0x7325, 0xE8E6, 0x754F, 0xE8E7, 0xF9BA, 0xE8E8, 0xF9BB, - 0xE8E9, 0x50E5, 0xE8EA, 0x51F9, 0xE8EB, 0x582F, 0xE8EC, 0x592D, - 0xE8ED, 0x5996, 0xE8EE, 0x59DA, 0xE8EF, 0x5BE5, 0xE8F0, 0xF9BC, - 0xE8F1, 0xF9BD, 0xE8F2, 0x5DA2, 0xE8F3, 0x62D7, 0xE8F4, 0x6416, - 0xE8F5, 0x6493, 0xE8F6, 0x64FE, 0xE8F7, 0xF9BE, 0xE8F8, 0x66DC, - 0xE8F9, 0xF9BF, 0xE8FA, 0x6A48, 0xE8FB, 0xF9C0, 0xE8FC, 0x71FF, - 0xE8FD, 0x7464, 0xE8FE, 0xF9C1, 0xE9A1, 0x7A88, 0xE9A2, 0x7AAF, - 0xE9A3, 0x7E47, 0xE9A4, 0x7E5E, 0xE9A5, 0x8000, 0xE9A6, 0x8170, - 0xE9A7, 0xF9C2, 0xE9A8, 0x87EF, 0xE9A9, 0x8981, 0xE9AA, 0x8B20, - 0xE9AB, 0x9059, 0xE9AC, 0xF9C3, 0xE9AD, 0x9080, 0xE9AE, 0x9952, - 0xE9AF, 0x617E, 0xE9B0, 0x6B32, 0xE9B1, 0x6D74, 0xE9B2, 0x7E1F, - 0xE9B3, 0x8925, 0xE9B4, 0x8FB1, 0xE9B5, 0x4FD1, 0xE9B6, 0x50AD, - 0xE9B7, 0x5197, 0xE9B8, 0x52C7, 0xE9B9, 0x57C7, 0xE9BA, 0x5889, - 0xE9BB, 0x5BB9, 0xE9BC, 0x5EB8, 0xE9BD, 0x6142, 0xE9BE, 0x6995, - 0xE9BF, 0x6D8C, 0xE9C0, 0x6E67, 0xE9C1, 0x6EB6, 0xE9C2, 0x7194, - 0xE9C3, 0x7462, 0xE9C4, 0x7528, 0xE9C5, 0x752C, 0xE9C6, 0x8073, - 0xE9C7, 0x8338, 0xE9C8, 0x84C9, 0xE9C9, 0x8E0A, 0xE9CA, 0x9394, - 0xE9CB, 0x93DE, 0xE9CC, 0xF9C4, 0xE9CD, 0x4E8E, 0xE9CE, 0x4F51, - 0xE9CF, 0x5076, 0xE9D0, 0x512A, 0xE9D1, 0x53C8, 0xE9D2, 0x53CB, - 0xE9D3, 0x53F3, 0xE9D4, 0x5B87, 0xE9D5, 0x5BD3, 0xE9D6, 0x5C24, - 0xE9D7, 0x611A, 0xE9D8, 0x6182, 0xE9D9, 0x65F4, 0xE9DA, 0x725B, - 0xE9DB, 0x7397, 0xE9DC, 0x7440, 0xE9DD, 0x76C2, 0xE9DE, 0x7950, - 0xE9DF, 0x7991, 0xE9E0, 0x79B9, 0xE9E1, 0x7D06, 0xE9E2, 0x7FBD, - 0xE9E3, 0x828B, 0xE9E4, 0x85D5, 0xE9E5, 0x865E, 0xE9E6, 0x8FC2, - 0xE9E7, 0x9047, 0xE9E8, 0x90F5, 0xE9E9, 0x91EA, 0xE9EA, 0x9685, - 0xE9EB, 0x96E8, 0xE9EC, 0x96E9, 0xE9ED, 0x52D6, 0xE9EE, 0x5F67, - 0xE9EF, 0x65ED, 0xE9F0, 0x6631, 0xE9F1, 0x682F, 0xE9F2, 0x715C, - 0xE9F3, 0x7A36, 0xE9F4, 0x90C1, 0xE9F5, 0x980A, 0xE9F6, 0x4E91, - 0xE9F7, 0xF9C5, 0xE9F8, 0x6A52, 0xE9F9, 0x6B9E, 0xE9FA, 0x6F90, - 0xE9FB, 0x7189, 0xE9FC, 0x8018, 0xE9FD, 0x82B8, 0xE9FE, 0x8553, - 0xEAA1, 0x904B, 0xEAA2, 0x9695, 0xEAA3, 0x96F2, 0xEAA4, 0x97FB, - 0xEAA5, 0x851A, 0xEAA6, 0x9B31, 0xEAA7, 0x4E90, 0xEAA8, 0x718A, - 0xEAA9, 0x96C4, 0xEAAA, 0x5143, 0xEAAB, 0x539F, 0xEAAC, 0x54E1, - 0xEAAD, 0x5713, 0xEAAE, 0x5712, 0xEAAF, 0x57A3, 0xEAB0, 0x5A9B, - 0xEAB1, 0x5AC4, 0xEAB2, 0x5BC3, 0xEAB3, 0x6028, 0xEAB4, 0x613F, - 0xEAB5, 0x63F4, 0xEAB6, 0x6C85, 0xEAB7, 0x6D39, 0xEAB8, 0x6E72, - 0xEAB9, 0x6E90, 0xEABA, 0x7230, 0xEABB, 0x733F, 0xEABC, 0x7457, - 0xEABD, 0x82D1, 0xEABE, 0x8881, 0xEABF, 0x8F45, 0xEAC0, 0x9060, - 0xEAC1, 0xF9C6, 0xEAC2, 0x9662, 0xEAC3, 0x9858, 0xEAC4, 0x9D1B, - 0xEAC5, 0x6708, 0xEAC6, 0x8D8A, 0xEAC7, 0x925E, 0xEAC8, 0x4F4D, - 0xEAC9, 0x5049, 0xEACA, 0x50DE, 0xEACB, 0x5371, 0xEACC, 0x570D, - 0xEACD, 0x59D4, 0xEACE, 0x5A01, 0xEACF, 0x5C09, 0xEAD0, 0x6170, - 0xEAD1, 0x6690, 0xEAD2, 0x6E2D, 0xEAD3, 0x7232, 0xEAD4, 0x744B, - 0xEAD5, 0x7DEF, 0xEAD6, 0x80C3, 0xEAD7, 0x840E, 0xEAD8, 0x8466, - 0xEAD9, 0x853F, 0xEADA, 0x875F, 0xEADB, 0x885B, 0xEADC, 0x8918, - 0xEADD, 0x8B02, 0xEADE, 0x9055, 0xEADF, 0x97CB, 0xEAE0, 0x9B4F, - 0xEAE1, 0x4E73, 0xEAE2, 0x4F91, 0xEAE3, 0x5112, 0xEAE4, 0x516A, - 0xEAE5, 0xF9C7, 0xEAE6, 0x552F, 0xEAE7, 0x55A9, 0xEAE8, 0x5B7A, - 0xEAE9, 0x5BA5, 0xEAEA, 0x5E7C, 0xEAEB, 0x5E7D, 0xEAEC, 0x5EBE, - 0xEAED, 0x60A0, 0xEAEE, 0x60DF, 0xEAEF, 0x6108, 0xEAF0, 0x6109, - 0xEAF1, 0x63C4, 0xEAF2, 0x6538, 0xEAF3, 0x6709, 0xEAF4, 0xF9C8, - 0xEAF5, 0x67D4, 0xEAF6, 0x67DA, 0xEAF7, 0xF9C9, 0xEAF8, 0x6961, - 0xEAF9, 0x6962, 0xEAFA, 0x6CB9, 0xEAFB, 0x6D27, 0xEAFC, 0xF9CA, - 0xEAFD, 0x6E38, 0xEAFE, 0xF9CB, 0xEBA1, 0x6FE1, 0xEBA2, 0x7336, - 0xEBA3, 0x7337, 0xEBA4, 0xF9CC, 0xEBA5, 0x745C, 0xEBA6, 0x7531, - 0xEBA7, 0xF9CD, 0xEBA8, 0x7652, 0xEBA9, 0xF9CE, 0xEBAA, 0xF9CF, - 0xEBAB, 0x7DAD, 0xEBAC, 0x81FE, 0xEBAD, 0x8438, 0xEBAE, 0x88D5, - 0xEBAF, 0x8A98, 0xEBB0, 0x8ADB, 0xEBB1, 0x8AED, 0xEBB2, 0x8E30, - 0xEBB3, 0x8E42, 0xEBB4, 0x904A, 0xEBB5, 0x903E, 0xEBB6, 0x907A, - 0xEBB7, 0x9149, 0xEBB8, 0x91C9, 0xEBB9, 0x936E, 0xEBBA, 0xF9D0, - 0xEBBB, 0xF9D1, 0xEBBC, 0x5809, 0xEBBD, 0xF9D2, 0xEBBE, 0x6BD3, - 0xEBBF, 0x8089, 0xEBC0, 0x80B2, 0xEBC1, 0xF9D3, 0xEBC2, 0xF9D4, - 0xEBC3, 0x5141, 0xEBC4, 0x596B, 0xEBC5, 0x5C39, 0xEBC6, 0xF9D5, - 0xEBC7, 0xF9D6, 0xEBC8, 0x6F64, 0xEBC9, 0x73A7, 0xEBCA, 0x80E4, - 0xEBCB, 0x8D07, 0xEBCC, 0xF9D7, 0xEBCD, 0x9217, 0xEBCE, 0x958F, - 0xEBCF, 0xF9D8, 0xEBD0, 0xF9D9, 0xEBD1, 0xF9DA, 0xEBD2, 0xF9DB, - 0xEBD3, 0x807F, 0xEBD4, 0x620E, 0xEBD5, 0x701C, 0xEBD6, 0x7D68, - 0xEBD7, 0x878D, 0xEBD8, 0xF9DC, 0xEBD9, 0x57A0, 0xEBDA, 0x6069, - 0xEBDB, 0x6147, 0xEBDC, 0x6BB7, 0xEBDD, 0x8ABE, 0xEBDE, 0x9280, - 0xEBDF, 0x96B1, 0xEBE0, 0x4E59, 0xEBE1, 0x541F, 0xEBE2, 0x6DEB, - 0xEBE3, 0x852D, 0xEBE4, 0x9670, 0xEBE5, 0x97F3, 0xEBE6, 0x98EE, - 0xEBE7, 0x63D6, 0xEBE8, 0x6CE3, 0xEBE9, 0x9091, 0xEBEA, 0x51DD, - 0xEBEB, 0x61C9, 0xEBEC, 0x81BA, 0xEBED, 0x9DF9, 0xEBEE, 0x4F9D, - 0xEBEF, 0x501A, 0xEBF0, 0x5100, 0xEBF1, 0x5B9C, 0xEBF2, 0x610F, - 0xEBF3, 0x61FF, 0xEBF4, 0x64EC, 0xEBF5, 0x6905, 0xEBF6, 0x6BC5, - 0xEBF7, 0x7591, 0xEBF8, 0x77E3, 0xEBF9, 0x7FA9, 0xEBFA, 0x8264, - 0xEBFB, 0x858F, 0xEBFC, 0x87FB, 0xEBFD, 0x8863, 0xEBFE, 0x8ABC, - 0xECA1, 0x8B70, 0xECA2, 0x91AB, 0xECA3, 0x4E8C, 0xECA4, 0x4EE5, - 0xECA5, 0x4F0A, 0xECA6, 0xF9DD, 0xECA7, 0xF9DE, 0xECA8, 0x5937, - 0xECA9, 0x59E8, 0xECAA, 0xF9DF, 0xECAB, 0x5DF2, 0xECAC, 0x5F1B, - 0xECAD, 0x5F5B, 0xECAE, 0x6021, 0xECAF, 0xF9E0, 0xECB0, 0xF9E1, - 0xECB1, 0xF9E2, 0xECB2, 0xF9E3, 0xECB3, 0x723E, 0xECB4, 0x73E5, - 0xECB5, 0xF9E4, 0xECB6, 0x7570, 0xECB7, 0x75CD, 0xECB8, 0xF9E5, - 0xECB9, 0x79FB, 0xECBA, 0xF9E6, 0xECBB, 0x800C, 0xECBC, 0x8033, - 0xECBD, 0x8084, 0xECBE, 0x82E1, 0xECBF, 0x8351, 0xECC0, 0xF9E7, - 0xECC1, 0xF9E8, 0xECC2, 0x8CBD, 0xECC3, 0x8CB3, 0xECC4, 0x9087, - 0xECC5, 0xF9E9, 0xECC6, 0xF9EA, 0xECC7, 0x98F4, 0xECC8, 0x990C, - 0xECC9, 0xF9EB, 0xECCA, 0xF9EC, 0xECCB, 0x7037, 0xECCC, 0x76CA, - 0xECCD, 0x7FCA, 0xECCE, 0x7FCC, 0xECCF, 0x7FFC, 0xECD0, 0x8B1A, - 0xECD1, 0x4EBA, 0xECD2, 0x4EC1, 0xECD3, 0x5203, 0xECD4, 0x5370, - 0xECD5, 0xF9ED, 0xECD6, 0x54BD, 0xECD7, 0x56E0, 0xECD8, 0x59FB, - 0xECD9, 0x5BC5, 0xECDA, 0x5F15, 0xECDB, 0x5FCD, 0xECDC, 0x6E6E, - 0xECDD, 0xF9EE, 0xECDE, 0xF9EF, 0xECDF, 0x7D6A, 0xECE0, 0x8335, - 0xECE1, 0xF9F0, 0xECE2, 0x8693, 0xECE3, 0x8A8D, 0xECE4, 0xF9F1, - 0xECE5, 0x976D, 0xECE6, 0x9777, 0xECE7, 0xF9F2, 0xECE8, 0xF9F3, - 0xECE9, 0x4E00, 0xECEA, 0x4F5A, 0xECEB, 0x4F7E, 0xECEC, 0x58F9, - 0xECED, 0x65E5, 0xECEE, 0x6EA2, 0xECEF, 0x9038, 0xECF0, 0x93B0, - 0xECF1, 0x99B9, 0xECF2, 0x4EFB, 0xECF3, 0x58EC, 0xECF4, 0x598A, - 0xECF5, 0x59D9, 0xECF6, 0x6041, 0xECF7, 0xF9F4, 0xECF8, 0xF9F5, - 0xECF9, 0x7A14, 0xECFA, 0xF9F6, 0xECFB, 0x834F, 0xECFC, 0x8CC3, - 0xECFD, 0x5165, 0xECFE, 0x5344, 0xEDA1, 0xF9F7, 0xEDA2, 0xF9F8, - 0xEDA3, 0xF9F9, 0xEDA4, 0x4ECD, 0xEDA5, 0x5269, 0xEDA6, 0x5B55, - 0xEDA7, 0x82BF, 0xEDA8, 0x4ED4, 0xEDA9, 0x523A, 0xEDAA, 0x54A8, - 0xEDAB, 0x59C9, 0xEDAC, 0x59FF, 0xEDAD, 0x5B50, 0xEDAE, 0x5B57, - 0xEDAF, 0x5B5C, 0xEDB0, 0x6063, 0xEDB1, 0x6148, 0xEDB2, 0x6ECB, - 0xEDB3, 0x7099, 0xEDB4, 0x716E, 0xEDB5, 0x7386, 0xEDB6, 0x74F7, - 0xEDB7, 0x75B5, 0xEDB8, 0x78C1, 0xEDB9, 0x7D2B, 0xEDBA, 0x8005, - 0xEDBB, 0x81EA, 0xEDBC, 0x8328, 0xEDBD, 0x8517, 0xEDBE, 0x85C9, - 0xEDBF, 0x8AEE, 0xEDC0, 0x8CC7, 0xEDC1, 0x96CC, 0xEDC2, 0x4F5C, - 0xEDC3, 0x52FA, 0xEDC4, 0x56BC, 0xEDC5, 0x65AB, 0xEDC6, 0x6628, - 0xEDC7, 0x707C, 0xEDC8, 0x70B8, 0xEDC9, 0x7235, 0xEDCA, 0x7DBD, - 0xEDCB, 0x828D, 0xEDCC, 0x914C, 0xEDCD, 0x96C0, 0xEDCE, 0x9D72, - 0xEDCF, 0x5B71, 0xEDD0, 0x68E7, 0xEDD1, 0x6B98, 0xEDD2, 0x6F7A, - 0xEDD3, 0x76DE, 0xEDD4, 0x5C91, 0xEDD5, 0x66AB, 0xEDD6, 0x6F5B, - 0xEDD7, 0x7BB4, 0xEDD8, 0x7C2A, 0xEDD9, 0x8836, 0xEDDA, 0x96DC, - 0xEDDB, 0x4E08, 0xEDDC, 0x4ED7, 0xEDDD, 0x5320, 0xEDDE, 0x5834, - 0xEDDF, 0x58BB, 0xEDE0, 0x58EF, 0xEDE1, 0x596C, 0xEDE2, 0x5C07, - 0xEDE3, 0x5E33, 0xEDE4, 0x5E84, 0xEDE5, 0x5F35, 0xEDE6, 0x638C, - 0xEDE7, 0x66B2, 0xEDE8, 0x6756, 0xEDE9, 0x6A1F, 0xEDEA, 0x6AA3, - 0xEDEB, 0x6B0C, 0xEDEC, 0x6F3F, 0xEDED, 0x7246, 0xEDEE, 0xF9FA, - 0xEDEF, 0x7350, 0xEDF0, 0x748B, 0xEDF1, 0x7AE0, 0xEDF2, 0x7CA7, - 0xEDF3, 0x8178, 0xEDF4, 0x81DF, 0xEDF5, 0x81E7, 0xEDF6, 0x838A, - 0xEDF7, 0x846C, 0xEDF8, 0x8523, 0xEDF9, 0x8594, 0xEDFA, 0x85CF, - 0xEDFB, 0x88DD, 0xEDFC, 0x8D13, 0xEDFD, 0x91AC, 0xEDFE, 0x9577, - 0xEEA1, 0x969C, 0xEEA2, 0x518D, 0xEEA3, 0x54C9, 0xEEA4, 0x5728, - 0xEEA5, 0x5BB0, 0xEEA6, 0x624D, 0xEEA7, 0x6750, 0xEEA8, 0x683D, - 0xEEA9, 0x6893, 0xEEAA, 0x6E3D, 0xEEAB, 0x6ED3, 0xEEAC, 0x707D, - 0xEEAD, 0x7E21, 0xEEAE, 0x88C1, 0xEEAF, 0x8CA1, 0xEEB0, 0x8F09, - 0xEEB1, 0x9F4B, 0xEEB2, 0x9F4E, 0xEEB3, 0x722D, 0xEEB4, 0x7B8F, - 0xEEB5, 0x8ACD, 0xEEB6, 0x931A, 0xEEB7, 0x4F47, 0xEEB8, 0x4F4E, - 0xEEB9, 0x5132, 0xEEBA, 0x5480, 0xEEBB, 0x59D0, 0xEEBC, 0x5E95, - 0xEEBD, 0x62B5, 0xEEBE, 0x6775, 0xEEBF, 0x696E, 0xEEC0, 0x6A17, - 0xEEC1, 0x6CAE, 0xEEC2, 0x6E1A, 0xEEC3, 0x72D9, 0xEEC4, 0x732A, - 0xEEC5, 0x75BD, 0xEEC6, 0x7BB8, 0xEEC7, 0x7D35, 0xEEC8, 0x82E7, - 0xEEC9, 0x83F9, 0xEECA, 0x8457, 0xEECB, 0x85F7, 0xEECC, 0x8A5B, - 0xEECD, 0x8CAF, 0xEECE, 0x8E87, 0xEECF, 0x9019, 0xEED0, 0x90B8, - 0xEED1, 0x96CE, 0xEED2, 0x9F5F, 0xEED3, 0x52E3, 0xEED4, 0x540A, - 0xEED5, 0x5AE1, 0xEED6, 0x5BC2, 0xEED7, 0x6458, 0xEED8, 0x6575, - 0xEED9, 0x6EF4, 0xEEDA, 0x72C4, 0xEEDB, 0xF9FB, 0xEEDC, 0x7684, - 0xEEDD, 0x7A4D, 0xEEDE, 0x7B1B, 0xEEDF, 0x7C4D, 0xEEE0, 0x7E3E, - 0xEEE1, 0x7FDF, 0xEEE2, 0x837B, 0xEEE3, 0x8B2B, 0xEEE4, 0x8CCA, - 0xEEE5, 0x8D64, 0xEEE6, 0x8DE1, 0xEEE7, 0x8E5F, 0xEEE8, 0x8FEA, - 0xEEE9, 0x8FF9, 0xEEEA, 0x9069, 0xEEEB, 0x93D1, 0xEEEC, 0x4F43, - 0xEEED, 0x4F7A, 0xEEEE, 0x50B3, 0xEEEF, 0x5168, 0xEEF0, 0x5178, - 0xEEF1, 0x524D, 0xEEF2, 0x526A, 0xEEF3, 0x5861, 0xEEF4, 0x587C, - 0xEEF5, 0x5960, 0xEEF6, 0x5C08, 0xEEF7, 0x5C55, 0xEEF8, 0x5EDB, - 0xEEF9, 0x609B, 0xEEFA, 0x6230, 0xEEFB, 0x6813, 0xEEFC, 0x6BBF, - 0xEEFD, 0x6C08, 0xEEFE, 0x6FB1, 0xEFA1, 0x714E, 0xEFA2, 0x7420, - 0xEFA3, 0x7530, 0xEFA4, 0x7538, 0xEFA5, 0x7551, 0xEFA6, 0x7672, - 0xEFA7, 0x7B4C, 0xEFA8, 0x7B8B, 0xEFA9, 0x7BAD, 0xEFAA, 0x7BC6, - 0xEFAB, 0x7E8F, 0xEFAC, 0x8A6E, 0xEFAD, 0x8F3E, 0xEFAE, 0x8F49, - 0xEFAF, 0x923F, 0xEFB0, 0x9293, 0xEFB1, 0x9322, 0xEFB2, 0x942B, - 0xEFB3, 0x96FB, 0xEFB4, 0x985A, 0xEFB5, 0x986B, 0xEFB6, 0x991E, - 0xEFB7, 0x5207, 0xEFB8, 0x622A, 0xEFB9, 0x6298, 0xEFBA, 0x6D59, - 0xEFBB, 0x7664, 0xEFBC, 0x7ACA, 0xEFBD, 0x7BC0, 0xEFBE, 0x7D76, - 0xEFBF, 0x5360, 0xEFC0, 0x5CBE, 0xEFC1, 0x5E97, 0xEFC2, 0x6F38, - 0xEFC3, 0x70B9, 0xEFC4, 0x7C98, 0xEFC5, 0x9711, 0xEFC6, 0x9B8E, - 0xEFC7, 0x9EDE, 0xEFC8, 0x63A5, 0xEFC9, 0x647A, 0xEFCA, 0x8776, - 0xEFCB, 0x4E01, 0xEFCC, 0x4E95, 0xEFCD, 0x4EAD, 0xEFCE, 0x505C, - 0xEFCF, 0x5075, 0xEFD0, 0x5448, 0xEFD1, 0x59C3, 0xEFD2, 0x5B9A, - 0xEFD3, 0x5E40, 0xEFD4, 0x5EAD, 0xEFD5, 0x5EF7, 0xEFD6, 0x5F81, - 0xEFD7, 0x60C5, 0xEFD8, 0x633A, 0xEFD9, 0x653F, 0xEFDA, 0x6574, - 0xEFDB, 0x65CC, 0xEFDC, 0x6676, 0xEFDD, 0x6678, 0xEFDE, 0x67FE, - 0xEFDF, 0x6968, 0xEFE0, 0x6A89, 0xEFE1, 0x6B63, 0xEFE2, 0x6C40, - 0xEFE3, 0x6DC0, 0xEFE4, 0x6DE8, 0xEFE5, 0x6E1F, 0xEFE6, 0x6E5E, - 0xEFE7, 0x701E, 0xEFE8, 0x70A1, 0xEFE9, 0x738E, 0xEFEA, 0x73FD, - 0xEFEB, 0x753A, 0xEFEC, 0x775B, 0xEFED, 0x7887, 0xEFEE, 0x798E, - 0xEFEF, 0x7A0B, 0xEFF0, 0x7A7D, 0xEFF1, 0x7CBE, 0xEFF2, 0x7D8E, - 0xEFF3, 0x8247, 0xEFF4, 0x8A02, 0xEFF5, 0x8AEA, 0xEFF6, 0x8C9E, - 0xEFF7, 0x912D, 0xEFF8, 0x914A, 0xEFF9, 0x91D8, 0xEFFA, 0x9266, - 0xEFFB, 0x92CC, 0xEFFC, 0x9320, 0xEFFD, 0x9706, 0xEFFE, 0x9756, - 0xF0A1, 0x975C, 0xF0A2, 0x9802, 0xF0A3, 0x9F0E, 0xF0A4, 0x5236, - 0xF0A5, 0x5291, 0xF0A6, 0x557C, 0xF0A7, 0x5824, 0xF0A8, 0x5E1D, - 0xF0A9, 0x5F1F, 0xF0AA, 0x608C, 0xF0AB, 0x63D0, 0xF0AC, 0x68AF, - 0xF0AD, 0x6FDF, 0xF0AE, 0x796D, 0xF0AF, 0x7B2C, 0xF0B0, 0x81CD, - 0xF0B1, 0x85BA, 0xF0B2, 0x88FD, 0xF0B3, 0x8AF8, 0xF0B4, 0x8E44, - 0xF0B5, 0x918D, 0xF0B6, 0x9664, 0xF0B7, 0x969B, 0xF0B8, 0x973D, - 0xF0B9, 0x984C, 0xF0BA, 0x9F4A, 0xF0BB, 0x4FCE, 0xF0BC, 0x5146, - 0xF0BD, 0x51CB, 0xF0BE, 0x52A9, 0xF0BF, 0x5632, 0xF0C0, 0x5F14, - 0xF0C1, 0x5F6B, 0xF0C2, 0x63AA, 0xF0C3, 0x64CD, 0xF0C4, 0x65E9, - 0xF0C5, 0x6641, 0xF0C6, 0x66FA, 0xF0C7, 0x66F9, 0xF0C8, 0x671D, - 0xF0C9, 0x689D, 0xF0CA, 0x68D7, 0xF0CB, 0x69FD, 0xF0CC, 0x6F15, - 0xF0CD, 0x6F6E, 0xF0CE, 0x7167, 0xF0CF, 0x71E5, 0xF0D0, 0x722A, - 0xF0D1, 0x74AA, 0xF0D2, 0x773A, 0xF0D3, 0x7956, 0xF0D4, 0x795A, - 0xF0D5, 0x79DF, 0xF0D6, 0x7A20, 0xF0D7, 0x7A95, 0xF0D8, 0x7C97, - 0xF0D9, 0x7CDF, 0xF0DA, 0x7D44, 0xF0DB, 0x7E70, 0xF0DC, 0x8087, - 0xF0DD, 0x85FB, 0xF0DE, 0x86A4, 0xF0DF, 0x8A54, 0xF0E0, 0x8ABF, - 0xF0E1, 0x8D99, 0xF0E2, 0x8E81, 0xF0E3, 0x9020, 0xF0E4, 0x906D, - 0xF0E5, 0x91E3, 0xF0E6, 0x963B, 0xF0E7, 0x96D5, 0xF0E8, 0x9CE5, - 0xF0E9, 0x65CF, 0xF0EA, 0x7C07, 0xF0EB, 0x8DB3, 0xF0EC, 0x93C3, - 0xF0ED, 0x5B58, 0xF0EE, 0x5C0A, 0xF0EF, 0x5352, 0xF0F0, 0x62D9, - 0xF0F1, 0x731D, 0xF0F2, 0x5027, 0xF0F3, 0x5B97, 0xF0F4, 0x5F9E, - 0xF0F5, 0x60B0, 0xF0F6, 0x616B, 0xF0F7, 0x68D5, 0xF0F8, 0x6DD9, - 0xF0F9, 0x742E, 0xF0FA, 0x7A2E, 0xF0FB, 0x7D42, 0xF0FC, 0x7D9C, - 0xF0FD, 0x7E31, 0xF0FE, 0x816B, 0xF1A1, 0x8E2A, 0xF1A2, 0x8E35, - 0xF1A3, 0x937E, 0xF1A4, 0x9418, 0xF1A5, 0x4F50, 0xF1A6, 0x5750, - 0xF1A7, 0x5DE6, 0xF1A8, 0x5EA7, 0xF1A9, 0x632B, 0xF1AA, 0x7F6A, - 0xF1AB, 0x4E3B, 0xF1AC, 0x4F4F, 0xF1AD, 0x4F8F, 0xF1AE, 0x505A, - 0xF1AF, 0x59DD, 0xF1B0, 0x80C4, 0xF1B1, 0x546A, 0xF1B2, 0x5468, - 0xF1B3, 0x55FE, 0xF1B4, 0x594F, 0xF1B5, 0x5B99, 0xF1B6, 0x5DDE, - 0xF1B7, 0x5EDA, 0xF1B8, 0x665D, 0xF1B9, 0x6731, 0xF1BA, 0x67F1, - 0xF1BB, 0x682A, 0xF1BC, 0x6CE8, 0xF1BD, 0x6D32, 0xF1BE, 0x6E4A, - 0xF1BF, 0x6F8D, 0xF1C0, 0x70B7, 0xF1C1, 0x73E0, 0xF1C2, 0x7587, - 0xF1C3, 0x7C4C, 0xF1C4, 0x7D02, 0xF1C5, 0x7D2C, 0xF1C6, 0x7DA2, - 0xF1C7, 0x821F, 0xF1C8, 0x86DB, 0xF1C9, 0x8A3B, 0xF1CA, 0x8A85, - 0xF1CB, 0x8D70, 0xF1CC, 0x8E8A, 0xF1CD, 0x8F33, 0xF1CE, 0x9031, - 0xF1CF, 0x914E, 0xF1D0, 0x9152, 0xF1D1, 0x9444, 0xF1D2, 0x99D0, - 0xF1D3, 0x7AF9, 0xF1D4, 0x7CA5, 0xF1D5, 0x4FCA, 0xF1D6, 0x5101, - 0xF1D7, 0x51C6, 0xF1D8, 0x57C8, 0xF1D9, 0x5BEF, 0xF1DA, 0x5CFB, - 0xF1DB, 0x6659, 0xF1DC, 0x6A3D, 0xF1DD, 0x6D5A, 0xF1DE, 0x6E96, - 0xF1DF, 0x6FEC, 0xF1E0, 0x710C, 0xF1E1, 0x756F, 0xF1E2, 0x7AE3, - 0xF1E3, 0x8822, 0xF1E4, 0x9021, 0xF1E5, 0x9075, 0xF1E6, 0x96CB, - 0xF1E7, 0x99FF, 0xF1E8, 0x8301, 0xF1E9, 0x4E2D, 0xF1EA, 0x4EF2, - 0xF1EB, 0x8846, 0xF1EC, 0x91CD, 0xF1ED, 0x537D, 0xF1EE, 0x6ADB, - 0xF1EF, 0x696B, 0xF1F0, 0x6C41, 0xF1F1, 0x847A, 0xF1F2, 0x589E, - 0xF1F3, 0x618E, 0xF1F4, 0x66FE, 0xF1F5, 0x62EF, 0xF1F6, 0x70DD, - 0xF1F7, 0x7511, 0xF1F8, 0x75C7, 0xF1F9, 0x7E52, 0xF1FA, 0x84B8, - 0xF1FB, 0x8B49, 0xF1FC, 0x8D08, 0xF1FD, 0x4E4B, 0xF1FE, 0x53EA, - 0xF2A1, 0x54AB, 0xF2A2, 0x5730, 0xF2A3, 0x5740, 0xF2A4, 0x5FD7, - 0xF2A5, 0x6301, 0xF2A6, 0x6307, 0xF2A7, 0x646F, 0xF2A8, 0x652F, - 0xF2A9, 0x65E8, 0xF2AA, 0x667A, 0xF2AB, 0x679D, 0xF2AC, 0x67B3, - 0xF2AD, 0x6B62, 0xF2AE, 0x6C60, 0xF2AF, 0x6C9A, 0xF2B0, 0x6F2C, - 0xF2B1, 0x77E5, 0xF2B2, 0x7825, 0xF2B3, 0x7949, 0xF2B4, 0x7957, - 0xF2B5, 0x7D19, 0xF2B6, 0x80A2, 0xF2B7, 0x8102, 0xF2B8, 0x81F3, - 0xF2B9, 0x829D, 0xF2BA, 0x82B7, 0xF2BB, 0x8718, 0xF2BC, 0x8A8C, - 0xF2BD, 0xF9FC, 0xF2BE, 0x8D04, 0xF2BF, 0x8DBE, 0xF2C0, 0x9072, - 0xF2C1, 0x76F4, 0xF2C2, 0x7A19, 0xF2C3, 0x7A37, 0xF2C4, 0x7E54, - 0xF2C5, 0x8077, 0xF2C6, 0x5507, 0xF2C7, 0x55D4, 0xF2C8, 0x5875, - 0xF2C9, 0x632F, 0xF2CA, 0x6422, 0xF2CB, 0x6649, 0xF2CC, 0x664B, - 0xF2CD, 0x686D, 0xF2CE, 0x699B, 0xF2CF, 0x6B84, 0xF2D0, 0x6D25, - 0xF2D1, 0x6EB1, 0xF2D2, 0x73CD, 0xF2D3, 0x7468, 0xF2D4, 0x74A1, - 0xF2D5, 0x755B, 0xF2D6, 0x75B9, 0xF2D7, 0x76E1, 0xF2D8, 0x771E, - 0xF2D9, 0x778B, 0xF2DA, 0x79E6, 0xF2DB, 0x7E09, 0xF2DC, 0x7E1D, - 0xF2DD, 0x81FB, 0xF2DE, 0x852F, 0xF2DF, 0x8897, 0xF2E0, 0x8A3A, - 0xF2E1, 0x8CD1, 0xF2E2, 0x8EEB, 0xF2E3, 0x8FB0, 0xF2E4, 0x9032, - 0xF2E5, 0x93AD, 0xF2E6, 0x9663, 0xF2E7, 0x9673, 0xF2E8, 0x9707, - 0xF2E9, 0x4F84, 0xF2EA, 0x53F1, 0xF2EB, 0x59EA, 0xF2EC, 0x5AC9, - 0xF2ED, 0x5E19, 0xF2EE, 0x684E, 0xF2EF, 0x74C6, 0xF2F0, 0x75BE, - 0xF2F1, 0x79E9, 0xF2F2, 0x7A92, 0xF2F3, 0x81A3, 0xF2F4, 0x86ED, - 0xF2F5, 0x8CEA, 0xF2F6, 0x8DCC, 0xF2F7, 0x8FED, 0xF2F8, 0x659F, - 0xF2F9, 0x6715, 0xF2FA, 0xF9FD, 0xF2FB, 0x57F7, 0xF2FC, 0x6F57, - 0xF2FD, 0x7DDD, 0xF2FE, 0x8F2F, 0xF3A1, 0x93F6, 0xF3A2, 0x96C6, - 0xF3A3, 0x5FB5, 0xF3A4, 0x61F2, 0xF3A5, 0x6F84, 0xF3A6, 0x4E14, - 0xF3A7, 0x4F98, 0xF3A8, 0x501F, 0xF3A9, 0x53C9, 0xF3AA, 0x55DF, - 0xF3AB, 0x5D6F, 0xF3AC, 0x5DEE, 0xF3AD, 0x6B21, 0xF3AE, 0x6B64, - 0xF3AF, 0x78CB, 0xF3B0, 0x7B9A, 0xF3B1, 0xF9FE, 0xF3B2, 0x8E49, - 0xF3B3, 0x8ECA, 0xF3B4, 0x906E, 0xF3B5, 0x6349, 0xF3B6, 0x643E, - 0xF3B7, 0x7740, 0xF3B8, 0x7A84, 0xF3B9, 0x932F, 0xF3BA, 0x947F, - 0xF3BB, 0x9F6A, 0xF3BC, 0x64B0, 0xF3BD, 0x6FAF, 0xF3BE, 0x71E6, - 0xF3BF, 0x74A8, 0xF3C0, 0x74DA, 0xF3C1, 0x7AC4, 0xF3C2, 0x7C12, - 0xF3C3, 0x7E82, 0xF3C4, 0x7CB2, 0xF3C5, 0x7E98, 0xF3C6, 0x8B9A, - 0xF3C7, 0x8D0A, 0xF3C8, 0x947D, 0xF3C9, 0x9910, 0xF3CA, 0x994C, - 0xF3CB, 0x5239, 0xF3CC, 0x5BDF, 0xF3CD, 0x64E6, 0xF3CE, 0x672D, - 0xF3CF, 0x7D2E, 0xF3D0, 0x50ED, 0xF3D1, 0x53C3, 0xF3D2, 0x5879, - 0xF3D3, 0x6158, 0xF3D4, 0x6159, 0xF3D5, 0x61FA, 0xF3D6, 0x65AC, - 0xF3D7, 0x7AD9, 0xF3D8, 0x8B92, 0xF3D9, 0x8B96, 0xF3DA, 0x5009, - 0xF3DB, 0x5021, 0xF3DC, 0x5275, 0xF3DD, 0x5531, 0xF3DE, 0x5A3C, - 0xF3DF, 0x5EE0, 0xF3E0, 0x5F70, 0xF3E1, 0x6134, 0xF3E2, 0x655E, - 0xF3E3, 0x660C, 0xF3E4, 0x6636, 0xF3E5, 0x66A2, 0xF3E6, 0x69CD, - 0xF3E7, 0x6EC4, 0xF3E8, 0x6F32, 0xF3E9, 0x7316, 0xF3EA, 0x7621, - 0xF3EB, 0x7A93, 0xF3EC, 0x8139, 0xF3ED, 0x8259, 0xF3EE, 0x83D6, - 0xF3EF, 0x84BC, 0xF3F0, 0x50B5, 0xF3F1, 0x57F0, 0xF3F2, 0x5BC0, - 0xF3F3, 0x5BE8, 0xF3F4, 0x5F69, 0xF3F5, 0x63A1, 0xF3F6, 0x7826, - 0xF3F7, 0x7DB5, 0xF3F8, 0x83DC, 0xF3F9, 0x8521, 0xF3FA, 0x91C7, - 0xF3FB, 0x91F5, 0xF3FC, 0x518A, 0xF3FD, 0x67F5, 0xF3FE, 0x7B56, - 0xF4A1, 0x8CAC, 0xF4A2, 0x51C4, 0xF4A3, 0x59BB, 0xF4A4, 0x60BD, - 0xF4A5, 0x8655, 0xF4A6, 0x501C, 0xF4A7, 0xF9FF, 0xF4A8, 0x5254, - 0xF4A9, 0x5C3A, 0xF4AA, 0x617D, 0xF4AB, 0x621A, 0xF4AC, 0x62D3, - 0xF4AD, 0x64F2, 0xF4AE, 0x65A5, 0xF4AF, 0x6ECC, 0xF4B0, 0x7620, - 0xF4B1, 0x810A, 0xF4B2, 0x8E60, 0xF4B3, 0x965F, 0xF4B4, 0x96BB, - 0xF4B5, 0x4EDF, 0xF4B6, 0x5343, 0xF4B7, 0x5598, 0xF4B8, 0x5929, - 0xF4B9, 0x5DDD, 0xF4BA, 0x64C5, 0xF4BB, 0x6CC9, 0xF4BC, 0x6DFA, - 0xF4BD, 0x7394, 0xF4BE, 0x7A7F, 0xF4BF, 0x821B, 0xF4C0, 0x85A6, - 0xF4C1, 0x8CE4, 0xF4C2, 0x8E10, 0xF4C3, 0x9077, 0xF4C4, 0x91E7, - 0xF4C5, 0x95E1, 0xF4C6, 0x9621, 0xF4C7, 0x97C6, 0xF4C8, 0x51F8, - 0xF4C9, 0x54F2, 0xF4CA, 0x5586, 0xF4CB, 0x5FB9, 0xF4CC, 0x64A4, - 0xF4CD, 0x6F88, 0xF4CE, 0x7DB4, 0xF4CF, 0x8F1F, 0xF4D0, 0x8F4D, - 0xF4D1, 0x9435, 0xF4D2, 0x50C9, 0xF4D3, 0x5C16, 0xF4D4, 0x6CBE, - 0xF4D5, 0x6DFB, 0xF4D6, 0x751B, 0xF4D7, 0x77BB, 0xF4D8, 0x7C3D, - 0xF4D9, 0x7C64, 0xF4DA, 0x8A79, 0xF4DB, 0x8AC2, 0xF4DC, 0x581E, - 0xF4DD, 0x59BE, 0xF4DE, 0x5E16, 0xF4DF, 0x6377, 0xF4E0, 0x7252, - 0xF4E1, 0x758A, 0xF4E2, 0x776B, 0xF4E3, 0x8ADC, 0xF4E4, 0x8CBC, - 0xF4E5, 0x8F12, 0xF4E6, 0x5EF3, 0xF4E7, 0x6674, 0xF4E8, 0x6DF8, - 0xF4E9, 0x807D, 0xF4EA, 0x83C1, 0xF4EB, 0x8ACB, 0xF4EC, 0x9751, - 0xF4ED, 0x9BD6, 0xF4EE, 0xFA00, 0xF4EF, 0x5243, 0xF4F0, 0x66FF, - 0xF4F1, 0x6D95, 0xF4F2, 0x6EEF, 0xF4F3, 0x7DE0, 0xF4F4, 0x8AE6, - 0xF4F5, 0x902E, 0xF4F6, 0x905E, 0xF4F7, 0x9AD4, 0xF4F8, 0x521D, - 0xF4F9, 0x527F, 0xF4FA, 0x54E8, 0xF4FB, 0x6194, 0xF4FC, 0x6284, - 0xF4FD, 0x62DB, 0xF4FE, 0x68A2, 0xF5A1, 0x6912, 0xF5A2, 0x695A, - 0xF5A3, 0x6A35, 0xF5A4, 0x7092, 0xF5A5, 0x7126, 0xF5A6, 0x785D, - 0xF5A7, 0x7901, 0xF5A8, 0x790E, 0xF5A9, 0x79D2, 0xF5AA, 0x7A0D, - 0xF5AB, 0x8096, 0xF5AC, 0x8278, 0xF5AD, 0x82D5, 0xF5AE, 0x8349, - 0xF5AF, 0x8549, 0xF5B0, 0x8C82, 0xF5B1, 0x8D85, 0xF5B2, 0x9162, - 0xF5B3, 0x918B, 0xF5B4, 0x91AE, 0xF5B5, 0x4FC3, 0xF5B6, 0x56D1, - 0xF5B7, 0x71ED, 0xF5B8, 0x77D7, 0xF5B9, 0x8700, 0xF5BA, 0x89F8, - 0xF5BB, 0x5BF8, 0xF5BC, 0x5FD6, 0xF5BD, 0x6751, 0xF5BE, 0x90A8, - 0xF5BF, 0x53E2, 0xF5C0, 0x585A, 0xF5C1, 0x5BF5, 0xF5C2, 0x60A4, - 0xF5C3, 0x6181, 0xF5C4, 0x6460, 0xF5C5, 0x7E3D, 0xF5C6, 0x8070, - 0xF5C7, 0x8525, 0xF5C8, 0x9283, 0xF5C9, 0x64AE, 0xF5CA, 0x50AC, - 0xF5CB, 0x5D14, 0xF5CC, 0x6700, 0xF5CD, 0x589C, 0xF5CE, 0x62BD, - 0xF5CF, 0x63A8, 0xF5D0, 0x690E, 0xF5D1, 0x6978, 0xF5D2, 0x6A1E, - 0xF5D3, 0x6E6B, 0xF5D4, 0x76BA, 0xF5D5, 0x79CB, 0xF5D6, 0x82BB, - 0xF5D7, 0x8429, 0xF5D8, 0x8ACF, 0xF5D9, 0x8DA8, 0xF5DA, 0x8FFD, - 0xF5DB, 0x9112, 0xF5DC, 0x914B, 0xF5DD, 0x919C, 0xF5DE, 0x9310, - 0xF5DF, 0x9318, 0xF5E0, 0x939A, 0xF5E1, 0x96DB, 0xF5E2, 0x9A36, - 0xF5E3, 0x9C0D, 0xF5E4, 0x4E11, 0xF5E5, 0x755C, 0xF5E6, 0x795D, - 0xF5E7, 0x7AFA, 0xF5E8, 0x7B51, 0xF5E9, 0x7BC9, 0xF5EA, 0x7E2E, - 0xF5EB, 0x84C4, 0xF5EC, 0x8E59, 0xF5ED, 0x8E74, 0xF5EE, 0x8EF8, - 0xF5EF, 0x9010, 0xF5F0, 0x6625, 0xF5F1, 0x693F, 0xF5F2, 0x7443, - 0xF5F3, 0x51FA, 0xF5F4, 0x672E, 0xF5F5, 0x9EDC, 0xF5F6, 0x5145, - 0xF5F7, 0x5FE0, 0xF5F8, 0x6C96, 0xF5F9, 0x87F2, 0xF5FA, 0x885D, - 0xF5FB, 0x8877, 0xF5FC, 0x60B4, 0xF5FD, 0x81B5, 0xF5FE, 0x8403, - 0xF6A1, 0x8D05, 0xF6A2, 0x53D6, 0xF6A3, 0x5439, 0xF6A4, 0x5634, - 0xF6A5, 0x5A36, 0xF6A6, 0x5C31, 0xF6A7, 0x708A, 0xF6A8, 0x7FE0, - 0xF6A9, 0x805A, 0xF6AA, 0x8106, 0xF6AB, 0x81ED, 0xF6AC, 0x8DA3, - 0xF6AD, 0x9189, 0xF6AE, 0x9A5F, 0xF6AF, 0x9DF2, 0xF6B0, 0x5074, - 0xF6B1, 0x4EC4, 0xF6B2, 0x53A0, 0xF6B3, 0x60FB, 0xF6B4, 0x6E2C, - 0xF6B5, 0x5C64, 0xF6B6, 0x4F88, 0xF6B7, 0x5024, 0xF6B8, 0x55E4, - 0xF6B9, 0x5CD9, 0xF6BA, 0x5E5F, 0xF6BB, 0x6065, 0xF6BC, 0x6894, - 0xF6BD, 0x6CBB, 0xF6BE, 0x6DC4, 0xF6BF, 0x71BE, 0xF6C0, 0x75D4, - 0xF6C1, 0x75F4, 0xF6C2, 0x7661, 0xF6C3, 0x7A1A, 0xF6C4, 0x7A49, - 0xF6C5, 0x7DC7, 0xF6C6, 0x7DFB, 0xF6C7, 0x7F6E, 0xF6C8, 0x81F4, - 0xF6C9, 0x86A9, 0xF6CA, 0x8F1C, 0xF6CB, 0x96C9, 0xF6CC, 0x99B3, - 0xF6CD, 0x9F52, 0xF6CE, 0x5247, 0xF6CF, 0x52C5, 0xF6D0, 0x98ED, - 0xF6D1, 0x89AA, 0xF6D2, 0x4E03, 0xF6D3, 0x67D2, 0xF6D4, 0x6F06, - 0xF6D5, 0x4FB5, 0xF6D6, 0x5BE2, 0xF6D7, 0x6795, 0xF6D8, 0x6C88, - 0xF6D9, 0x6D78, 0xF6DA, 0x741B, 0xF6DB, 0x7827, 0xF6DC, 0x91DD, - 0xF6DD, 0x937C, 0xF6DE, 0x87C4, 0xF6DF, 0x79E4, 0xF6E0, 0x7A31, - 0xF6E1, 0x5FEB, 0xF6E2, 0x4ED6, 0xF6E3, 0x54A4, 0xF6E4, 0x553E, - 0xF6E5, 0x58AE, 0xF6E6, 0x59A5, 0xF6E7, 0x60F0, 0xF6E8, 0x6253, - 0xF6E9, 0x62D6, 0xF6EA, 0x6736, 0xF6EB, 0x6955, 0xF6EC, 0x8235, - 0xF6ED, 0x9640, 0xF6EE, 0x99B1, 0xF6EF, 0x99DD, 0xF6F0, 0x502C, - 0xF6F1, 0x5353, 0xF6F2, 0x5544, 0xF6F3, 0x577C, 0xF6F4, 0xFA01, - 0xF6F5, 0x6258, 0xF6F6, 0xFA02, 0xF6F7, 0x64E2, 0xF6F8, 0x666B, - 0xF6F9, 0x67DD, 0xF6FA, 0x6FC1, 0xF6FB, 0x6FEF, 0xF6FC, 0x7422, - 0xF6FD, 0x7438, 0xF6FE, 0x8A17, 0xF7A1, 0x9438, 0xF7A2, 0x5451, - 0xF7A3, 0x5606, 0xF7A4, 0x5766, 0xF7A5, 0x5F48, 0xF7A6, 0x619A, - 0xF7A7, 0x6B4E, 0xF7A8, 0x7058, 0xF7A9, 0x70AD, 0xF7AA, 0x7DBB, - 0xF7AB, 0x8A95, 0xF7AC, 0x596A, 0xF7AD, 0x812B, 0xF7AE, 0x63A2, - 0xF7AF, 0x7708, 0xF7B0, 0x803D, 0xF7B1, 0x8CAA, 0xF7B2, 0x5854, - 0xF7B3, 0x642D, 0xF7B4, 0x69BB, 0xF7B5, 0x5B95, 0xF7B6, 0x5E11, - 0xF7B7, 0x6E6F, 0xF7B8, 0xFA03, 0xF7B9, 0x8569, 0xF7BA, 0x514C, - 0xF7BB, 0x53F0, 0xF7BC, 0x592A, 0xF7BD, 0x6020, 0xF7BE, 0x614B, - 0xF7BF, 0x6B86, 0xF7C0, 0x6C70, 0xF7C1, 0x6CF0, 0xF7C2, 0x7B1E, - 0xF7C3, 0x80CE, 0xF7C4, 0x82D4, 0xF7C5, 0x8DC6, 0xF7C6, 0x90B0, - 0xF7C7, 0x98B1, 0xF7C8, 0xFA04, 0xF7C9, 0x64C7, 0xF7CA, 0x6FA4, - 0xF7CB, 0x6491, 0xF7CC, 0x6504, 0xF7CD, 0x514E, 0xF7CE, 0x5410, - 0xF7CF, 0x571F, 0xF7D0, 0x8A0E, 0xF7D1, 0x615F, 0xF7D2, 0x6876, - 0xF7D3, 0xFA05, 0xF7D4, 0x75DB, 0xF7D5, 0x7B52, 0xF7D6, 0x7D71, - 0xF7D7, 0x901A, 0xF7D8, 0x5806, 0xF7D9, 0x69CC, 0xF7DA, 0x817F, - 0xF7DB, 0x892A, 0xF7DC, 0x9000, 0xF7DD, 0x9839, 0xF7DE, 0x5078, - 0xF7DF, 0x5957, 0xF7E0, 0x59AC, 0xF7E1, 0x6295, 0xF7E2, 0x900F, - 0xF7E3, 0x9B2A, 0xF7E4, 0x615D, 0xF7E5, 0x7279, 0xF7E6, 0x95D6, - 0xF7E7, 0x5761, 0xF7E8, 0x5A46, 0xF7E9, 0x5DF4, 0xF7EA, 0x628A, - 0xF7EB, 0x64AD, 0xF7EC, 0x64FA, 0xF7ED, 0x6777, 0xF7EE, 0x6CE2, - 0xF7EF, 0x6D3E, 0xF7F0, 0x722C, 0xF7F1, 0x7436, 0xF7F2, 0x7834, - 0xF7F3, 0x7F77, 0xF7F4, 0x82AD, 0xF7F5, 0x8DDB, 0xF7F6, 0x9817, - 0xF7F7, 0x5224, 0xF7F8, 0x5742, 0xF7F9, 0x677F, 0xF7FA, 0x7248, - 0xF7FB, 0x74E3, 0xF7FC, 0x8CA9, 0xF7FD, 0x8FA6, 0xF7FE, 0x9211, - 0xF8A1, 0x962A, 0xF8A2, 0x516B, 0xF8A3, 0x53ED, 0xF8A4, 0x634C, - 0xF8A5, 0x4F69, 0xF8A6, 0x5504, 0xF8A7, 0x6096, 0xF8A8, 0x6557, - 0xF8A9, 0x6C9B, 0xF8AA, 0x6D7F, 0xF8AB, 0x724C, 0xF8AC, 0x72FD, - 0xF8AD, 0x7A17, 0xF8AE, 0x8987, 0xF8AF, 0x8C9D, 0xF8B0, 0x5F6D, - 0xF8B1, 0x6F8E, 0xF8B2, 0x70F9, 0xF8B3, 0x81A8, 0xF8B4, 0x610E, - 0xF8B5, 0x4FBF, 0xF8B6, 0x504F, 0xF8B7, 0x6241, 0xF8B8, 0x7247, - 0xF8B9, 0x7BC7, 0xF8BA, 0x7DE8, 0xF8BB, 0x7FE9, 0xF8BC, 0x904D, - 0xF8BD, 0x97AD, 0xF8BE, 0x9A19, 0xF8BF, 0x8CB6, 0xF8C0, 0x576A, - 0xF8C1, 0x5E73, 0xF8C2, 0x67B0, 0xF8C3, 0x840D, 0xF8C4, 0x8A55, - 0xF8C5, 0x5420, 0xF8C6, 0x5B16, 0xF8C7, 0x5E63, 0xF8C8, 0x5EE2, - 0xF8C9, 0x5F0A, 0xF8CA, 0x6583, 0xF8CB, 0x80BA, 0xF8CC, 0x853D, - 0xF8CD, 0x9589, 0xF8CE, 0x965B, 0xF8CF, 0x4F48, 0xF8D0, 0x5305, - 0xF8D1, 0x530D, 0xF8D2, 0x530F, 0xF8D3, 0x5486, 0xF8D4, 0x54FA, - 0xF8D5, 0x5703, 0xF8D6, 0x5E03, 0xF8D7, 0x6016, 0xF8D8, 0x629B, - 0xF8D9, 0x62B1, 0xF8DA, 0x6355, 0xF8DB, 0xFA06, 0xF8DC, 0x6CE1, - 0xF8DD, 0x6D66, 0xF8DE, 0x75B1, 0xF8DF, 0x7832, 0xF8E0, 0x80DE, - 0xF8E1, 0x812F, 0xF8E2, 0x82DE, 0xF8E3, 0x8461, 0xF8E4, 0x84B2, - 0xF8E5, 0x888D, 0xF8E6, 0x8912, 0xF8E7, 0x900B, 0xF8E8, 0x92EA, - 0xF8E9, 0x98FD, 0xF8EA, 0x9B91, 0xF8EB, 0x5E45, 0xF8EC, 0x66B4, - 0xF8ED, 0x66DD, 0xF8EE, 0x7011, 0xF8EF, 0x7206, 0xF8F0, 0xFA07, - 0xF8F1, 0x4FF5, 0xF8F2, 0x527D, 0xF8F3, 0x5F6A, 0xF8F4, 0x6153, - 0xF8F5, 0x6753, 0xF8F6, 0x6A19, 0xF8F7, 0x6F02, 0xF8F8, 0x74E2, - 0xF8F9, 0x7968, 0xF8FA, 0x8868, 0xF8FB, 0x8C79, 0xF8FC, 0x98C7, - 0xF8FD, 0x98C4, 0xF8FE, 0x9A43, 0xF9A1, 0x54C1, 0xF9A2, 0x7A1F, - 0xF9A3, 0x6953, 0xF9A4, 0x8AF7, 0xF9A5, 0x8C4A, 0xF9A6, 0x98A8, - 0xF9A7, 0x99AE, 0xF9A8, 0x5F7C, 0xF9A9, 0x62AB, 0xF9AA, 0x75B2, - 0xF9AB, 0x76AE, 0xF9AC, 0x88AB, 0xF9AD, 0x907F, 0xF9AE, 0x9642, - 0xF9AF, 0x5339, 0xF9B0, 0x5F3C, 0xF9B1, 0x5FC5, 0xF9B2, 0x6CCC, - 0xF9B3, 0x73CC, 0xF9B4, 0x7562, 0xF9B5, 0x758B, 0xF9B6, 0x7B46, - 0xF9B7, 0x82FE, 0xF9B8, 0x999D, 0xF9B9, 0x4E4F, 0xF9BA, 0x903C, - 0xF9BB, 0x4E0B, 0xF9BC, 0x4F55, 0xF9BD, 0x53A6, 0xF9BE, 0x590F, - 0xF9BF, 0x5EC8, 0xF9C0, 0x6630, 0xF9C1, 0x6CB3, 0xF9C2, 0x7455, - 0xF9C3, 0x8377, 0xF9C4, 0x8766, 0xF9C5, 0x8CC0, 0xF9C6, 0x9050, - 0xF9C7, 0x971E, 0xF9C8, 0x9C15, 0xF9C9, 0x58D1, 0xF9CA, 0x5B78, - 0xF9CB, 0x8650, 0xF9CC, 0x8B14, 0xF9CD, 0x9DB4, 0xF9CE, 0x5BD2, - 0xF9CF, 0x6068, 0xF9D0, 0x608D, 0xF9D1, 0x65F1, 0xF9D2, 0x6C57, - 0xF9D3, 0x6F22, 0xF9D4, 0x6FA3, 0xF9D5, 0x701A, 0xF9D6, 0x7F55, - 0xF9D7, 0x7FF0, 0xF9D8, 0x9591, 0xF9D9, 0x9592, 0xF9DA, 0x9650, - 0xF9DB, 0x97D3, 0xF9DC, 0x5272, 0xF9DD, 0x8F44, 0xF9DE, 0x51FD, - 0xF9DF, 0x542B, 0xF9E0, 0x54B8, 0xF9E1, 0x5563, 0xF9E2, 0x558A, - 0xF9E3, 0x6ABB, 0xF9E4, 0x6DB5, 0xF9E5, 0x7DD8, 0xF9E6, 0x8266, - 0xF9E7, 0x929C, 0xF9E8, 0x9677, 0xF9E9, 0x9E79, 0xF9EA, 0x5408, - 0xF9EB, 0x54C8, 0xF9EC, 0x76D2, 0xF9ED, 0x86E4, 0xF9EE, 0x95A4, - 0xF9EF, 0x95D4, 0xF9F0, 0x965C, 0xF9F1, 0x4EA2, 0xF9F2, 0x4F09, - 0xF9F3, 0x59EE, 0xF9F4, 0x5AE6, 0xF9F5, 0x5DF7, 0xF9F6, 0x6052, - 0xF9F7, 0x6297, 0xF9F8, 0x676D, 0xF9F9, 0x6841, 0xF9FA, 0x6C86, - 0xF9FB, 0x6E2F, 0xF9FC, 0x7F38, 0xF9FD, 0x809B, 0xF9FE, 0x822A, - 0xFAA1, 0xFA08, 0xFAA2, 0xFA09, 0xFAA3, 0x9805, 0xFAA4, 0x4EA5, - 0xFAA5, 0x5055, 0xFAA6, 0x54B3, 0xFAA7, 0x5793, 0xFAA8, 0x595A, - 0xFAA9, 0x5B69, 0xFAAA, 0x5BB3, 0xFAAB, 0x61C8, 0xFAAC, 0x6977, - 0xFAAD, 0x6D77, 0xFAAE, 0x7023, 0xFAAF, 0x87F9, 0xFAB0, 0x89E3, - 0xFAB1, 0x8A72, 0xFAB2, 0x8AE7, 0xFAB3, 0x9082, 0xFAB4, 0x99ED, - 0xFAB5, 0x9AB8, 0xFAB6, 0x52BE, 0xFAB7, 0x6838, 0xFAB8, 0x5016, - 0xFAB9, 0x5E78, 0xFABA, 0x674F, 0xFABB, 0x8347, 0xFABC, 0x884C, - 0xFABD, 0x4EAB, 0xFABE, 0x5411, 0xFABF, 0x56AE, 0xFAC0, 0x73E6, - 0xFAC1, 0x9115, 0xFAC2, 0x97FF, 0xFAC3, 0x9909, 0xFAC4, 0x9957, - 0xFAC5, 0x9999, 0xFAC6, 0x5653, 0xFAC7, 0x589F, 0xFAC8, 0x865B, - 0xFAC9, 0x8A31, 0xFACA, 0x61B2, 0xFACB, 0x6AF6, 0xFACC, 0x737B, - 0xFACD, 0x8ED2, 0xFACE, 0x6B47, 0xFACF, 0x96AA, 0xFAD0, 0x9A57, - 0xFAD1, 0x5955, 0xFAD2, 0x7200, 0xFAD3, 0x8D6B, 0xFAD4, 0x9769, - 0xFAD5, 0x4FD4, 0xFAD6, 0x5CF4, 0xFAD7, 0x5F26, 0xFAD8, 0x61F8, - 0xFAD9, 0x665B, 0xFADA, 0x6CEB, 0xFADB, 0x70AB, 0xFADC, 0x7384, - 0xFADD, 0x73B9, 0xFADE, 0x73FE, 0xFADF, 0x7729, 0xFAE0, 0x774D, - 0xFAE1, 0x7D43, 0xFAE2, 0x7D62, 0xFAE3, 0x7E23, 0xFAE4, 0x8237, - 0xFAE5, 0x8852, 0xFAE6, 0xFA0A, 0xFAE7, 0x8CE2, 0xFAE8, 0x9249, - 0xFAE9, 0x986F, 0xFAEA, 0x5B51, 0xFAEB, 0x7A74, 0xFAEC, 0x8840, - 0xFAED, 0x9801, 0xFAEE, 0x5ACC, 0xFAEF, 0x4FE0, 0xFAF0, 0x5354, - 0xFAF1, 0x593E, 0xFAF2, 0x5CFD, 0xFAF3, 0x633E, 0xFAF4, 0x6D79, - 0xFAF5, 0x72F9, 0xFAF6, 0x8105, 0xFAF7, 0x8107, 0xFAF8, 0x83A2, - 0xFAF9, 0x92CF, 0xFAFA, 0x9830, 0xFAFB, 0x4EA8, 0xFAFC, 0x5144, - 0xFAFD, 0x5211, 0xFAFE, 0x578B, 0xFBA1, 0x5F62, 0xFBA2, 0x6CC2, - 0xFBA3, 0x6ECE, 0xFBA4, 0x7005, 0xFBA5, 0x7050, 0xFBA6, 0x70AF, - 0xFBA7, 0x7192, 0xFBA8, 0x73E9, 0xFBA9, 0x7469, 0xFBAA, 0x834A, - 0xFBAB, 0x87A2, 0xFBAC, 0x8861, 0xFBAD, 0x9008, 0xFBAE, 0x90A2, - 0xFBAF, 0x93A3, 0xFBB0, 0x99A8, 0xFBB1, 0x516E, 0xFBB2, 0x5F57, - 0xFBB3, 0x60E0, 0xFBB4, 0x6167, 0xFBB5, 0x66B3, 0xFBB6, 0x8559, - 0xFBB7, 0x8E4A, 0xFBB8, 0x91AF, 0xFBB9, 0x978B, 0xFBBA, 0x4E4E, - 0xFBBB, 0x4E92, 0xFBBC, 0x547C, 0xFBBD, 0x58D5, 0xFBBE, 0x58FA, - 0xFBBF, 0x597D, 0xFBC0, 0x5CB5, 0xFBC1, 0x5F27, 0xFBC2, 0x6236, - 0xFBC3, 0x6248, 0xFBC4, 0x660A, 0xFBC5, 0x6667, 0xFBC6, 0x6BEB, - 0xFBC7, 0x6D69, 0xFBC8, 0x6DCF, 0xFBC9, 0x6E56, 0xFBCA, 0x6EF8, - 0xFBCB, 0x6F94, 0xFBCC, 0x6FE0, 0xFBCD, 0x6FE9, 0xFBCE, 0x705D, - 0xFBCF, 0x72D0, 0xFBD0, 0x7425, 0xFBD1, 0x745A, 0xFBD2, 0x74E0, - 0xFBD3, 0x7693, 0xFBD4, 0x795C, 0xFBD5, 0x7CCA, 0xFBD6, 0x7E1E, - 0xFBD7, 0x80E1, 0xFBD8, 0x82A6, 0xFBD9, 0x846B, 0xFBDA, 0x84BF, - 0xFBDB, 0x864E, 0xFBDC, 0x865F, 0xFBDD, 0x8774, 0xFBDE, 0x8B77, - 0xFBDF, 0x8C6A, 0xFBE0, 0x93AC, 0xFBE1, 0x9800, 0xFBE2, 0x9865, - 0xFBE3, 0x60D1, 0xFBE4, 0x6216, 0xFBE5, 0x9177, 0xFBE6, 0x5A5A, - 0xFBE7, 0x660F, 0xFBE8, 0x6DF7, 0xFBE9, 0x6E3E, 0xFBEA, 0x743F, - 0xFBEB, 0x9B42, 0xFBEC, 0x5FFD, 0xFBED, 0x60DA, 0xFBEE, 0x7B0F, - 0xFBEF, 0x54C4, 0xFBF0, 0x5F18, 0xFBF1, 0x6C5E, 0xFBF2, 0x6CD3, - 0xFBF3, 0x6D2A, 0xFBF4, 0x70D8, 0xFBF5, 0x7D05, 0xFBF6, 0x8679, - 0xFBF7, 0x8A0C, 0xFBF8, 0x9D3B, 0xFBF9, 0x5316, 0xFBFA, 0x548C, - 0xFBFB, 0x5B05, 0xFBFC, 0x6A3A, 0xFBFD, 0x706B, 0xFBFE, 0x7575, - 0xFCA1, 0x798D, 0xFCA2, 0x79BE, 0xFCA3, 0x82B1, 0xFCA4, 0x83EF, - 0xFCA5, 0x8A71, 0xFCA6, 0x8B41, 0xFCA7, 0x8CA8, 0xFCA8, 0x9774, - 0xFCA9, 0xFA0B, 0xFCAA, 0x64F4, 0xFCAB, 0x652B, 0xFCAC, 0x78BA, - 0xFCAD, 0x78BB, 0xFCAE, 0x7A6B, 0xFCAF, 0x4E38, 0xFCB0, 0x559A, - 0xFCB1, 0x5950, 0xFCB2, 0x5BA6, 0xFCB3, 0x5E7B, 0xFCB4, 0x60A3, - 0xFCB5, 0x63DB, 0xFCB6, 0x6B61, 0xFCB7, 0x6665, 0xFCB8, 0x6853, - 0xFCB9, 0x6E19, 0xFCBA, 0x7165, 0xFCBB, 0x74B0, 0xFCBC, 0x7D08, - 0xFCBD, 0x9084, 0xFCBE, 0x9A69, 0xFCBF, 0x9C25, 0xFCC0, 0x6D3B, - 0xFCC1, 0x6ED1, 0xFCC2, 0x733E, 0xFCC3, 0x8C41, 0xFCC4, 0x95CA, - 0xFCC5, 0x51F0, 0xFCC6, 0x5E4C, 0xFCC7, 0x5FA8, 0xFCC8, 0x604D, - 0xFCC9, 0x60F6, 0xFCCA, 0x6130, 0xFCCB, 0x614C, 0xFCCC, 0x6643, - 0xFCCD, 0x6644, 0xFCCE, 0x69A5, 0xFCCF, 0x6CC1, 0xFCD0, 0x6E5F, - 0xFCD1, 0x6EC9, 0xFCD2, 0x6F62, 0xFCD3, 0x714C, 0xFCD4, 0x749C, - 0xFCD5, 0x7687, 0xFCD6, 0x7BC1, 0xFCD7, 0x7C27, 0xFCD8, 0x8352, - 0xFCD9, 0x8757, 0xFCDA, 0x9051, 0xFCDB, 0x968D, 0xFCDC, 0x9EC3, - 0xFCDD, 0x532F, 0xFCDE, 0x56DE, 0xFCDF, 0x5EFB, 0xFCE0, 0x5F8A, - 0xFCE1, 0x6062, 0xFCE2, 0x6094, 0xFCE3, 0x61F7, 0xFCE4, 0x6666, - 0xFCE5, 0x6703, 0xFCE6, 0x6A9C, 0xFCE7, 0x6DEE, 0xFCE8, 0x6FAE, - 0xFCE9, 0x7070, 0xFCEA, 0x736A, 0xFCEB, 0x7E6A, 0xFCEC, 0x81BE, - 0xFCED, 0x8334, 0xFCEE, 0x86D4, 0xFCEF, 0x8AA8, 0xFCF0, 0x8CC4, - 0xFCF1, 0x5283, 0xFCF2, 0x7372, 0xFCF3, 0x5B96, 0xFCF4, 0x6A6B, - 0xFCF5, 0x9404, 0xFCF6, 0x54EE, 0xFCF7, 0x5686, 0xFCF8, 0x5B5D, - 0xFCF9, 0x6548, 0xFCFA, 0x6585, 0xFCFB, 0x66C9, 0xFCFC, 0x689F, - 0xFCFD, 0x6D8D, 0xFCFE, 0x6DC6, 0xFDA1, 0x723B, 0xFDA2, 0x80B4, - 0xFDA3, 0x9175, 0xFDA4, 0x9A4D, 0xFDA5, 0x4FAF, 0xFDA6, 0x5019, - 0xFDA7, 0x539A, 0xFDA8, 0x540E, 0xFDA9, 0x543C, 0xFDAA, 0x5589, - 0xFDAB, 0x55C5, 0xFDAC, 0x5E3F, 0xFDAD, 0x5F8C, 0xFDAE, 0x673D, - 0xFDAF, 0x7166, 0xFDB0, 0x73DD, 0xFDB1, 0x9005, 0xFDB2, 0x52DB, - 0xFDB3, 0x52F3, 0xFDB4, 0x5864, 0xFDB5, 0x58CE, 0xFDB6, 0x7104, - 0xFDB7, 0x718F, 0xFDB8, 0x71FB, 0xFDB9, 0x85B0, 0xFDBA, 0x8A13, - 0xFDBB, 0x6688, 0xFDBC, 0x85A8, 0xFDBD, 0x55A7, 0xFDBE, 0x6684, - 0xFDBF, 0x714A, 0xFDC0, 0x8431, 0xFDC1, 0x5349, 0xFDC2, 0x5599, - 0xFDC3, 0x6BC1, 0xFDC4, 0x5F59, 0xFDC5, 0x5FBD, 0xFDC6, 0x63EE, - 0xFDC7, 0x6689, 0xFDC8, 0x7147, 0xFDC9, 0x8AF1, 0xFDCA, 0x8F1D, - 0xFDCB, 0x9EBE, 0xFDCC, 0x4F11, 0xFDCD, 0x643A, 0xFDCE, 0x70CB, - 0xFDCF, 0x7566, 0xFDD0, 0x8667, 0xFDD1, 0x6064, 0xFDD2, 0x8B4E, - 0xFDD3, 0x9DF8, 0xFDD4, 0x5147, 0xFDD5, 0x51F6, 0xFDD6, 0x5308, - 0xFDD7, 0x6D36, 0xFDD8, 0x80F8, 0xFDD9, 0x9ED1, 0xFDDA, 0x6615, - 0xFDDB, 0x6B23, 0xFDDC, 0x7098, 0xFDDD, 0x75D5, 0xFDDE, 0x5403, - 0xFDDF, 0x5C79, 0xFDE0, 0x7D07, 0xFDE1, 0x8A16, 0xFDE2, 0x6B20, - 0xFDE3, 0x6B3D, 0xFDE4, 0x6B46, 0xFDE5, 0x5438, 0xFDE6, 0x6070, - 0xFDE7, 0x6D3D, 0xFDE8, 0x7FD5, 0xFDE9, 0x8208, 0xFDEA, 0x50D6, - 0xFDEB, 0x51DE, 0xFDEC, 0x559C, 0xFDED, 0x566B, 0xFDEE, 0x56CD, - 0xFDEF, 0x59EC, 0xFDF0, 0x5B09, 0xFDF1, 0x5E0C, 0xFDF2, 0x6199, - 0xFDF3, 0x6198, 0xFDF4, 0x6231, 0xFDF5, 0x665E, 0xFDF6, 0x66E6, - 0xFDF7, 0x7199, 0xFDF8, 0x71B9, 0xFDF9, 0x71BA, 0xFDFA, 0x72A7, - 0xFDFB, 0x79A7, 0xFDFC, 0x7A00, 0xFDFD, 0x7FB2, 0xFDFE, 0x8A70, - 0, 0 -}; - - - -WCHAR ff_convert ( /* Converted code, 0 means conversion error */ - WCHAR chr, /* Character code to be converted */ - UINT dir /* 0: Unicode to OEM code, 1: OEM code to Unicode */ -) -{ - const WCHAR *p; - WCHAR c; - int i, n, li, hi; - - - if (chr < 0x80) { /* ASCII */ - c = chr; - } else { - if (dir) { /* OEM code to unicode */ - p = oem2uni; - hi = sizeof oem2uni / 4 - 1; - } else { /* Unicode to OEM code */ - p = uni2oem; - hi = sizeof uni2oem / 4 - 1; - } - li = 0; - for (n = 16; n; n--) { - i = li + (hi - li) / 2; - if (chr == p[i * 2]) break; - if (chr > p[i * 2]) - li = i; - else - hi = i; - } - c = n ? p[i * 2 + 1] : 0; - } - - return c; -} - - - -WCHAR ff_wtoupper ( /* Returns upper converted character */ - WCHAR chr /* Unicode character to be upper converted (BMP only) */ -) -{ - /* Compressed upper conversion table */ - static const WCHAR cvt1[] = { /* U+0000 - U+0FFF */ - /* Basic Latin */ - 0x0061,0x031A, - /* Latin-1 Supplement */ - 0x00E0,0x0317, 0x00F8,0x0307, 0x00FF,0x0001,0x0178, - /* Latin Extended-A */ - 0x0100,0x0130, 0x0132,0x0106, 0x0139,0x0110, 0x014A,0x012E, 0x0179,0x0106, - /* Latin Extended-B */ - 0x0180,0x004D,0x0243,0x0181,0x0182,0x0182,0x0184,0x0184,0x0186,0x0187,0x0187,0x0189,0x018A,0x018B,0x018B,0x018D,0x018E,0x018F,0x0190,0x0191,0x0191,0x0193,0x0194,0x01F6,0x0196,0x0197,0x0198,0x0198,0x023D,0x019B,0x019C,0x019D,0x0220,0x019F,0x01A0,0x01A0,0x01A2,0x01A2,0x01A4,0x01A4,0x01A6,0x01A7,0x01A7,0x01A9,0x01AA,0x01AB,0x01AC,0x01AC,0x01AE,0x01AF,0x01AF,0x01B1,0x01B2,0x01B3,0x01B3,0x01B5,0x01B5,0x01B7,0x01B8,0x01B8,0x01BA,0x01BB,0x01BC,0x01BC,0x01BE,0x01F7,0x01C0,0x01C1,0x01C2,0x01C3,0x01C4,0x01C5,0x01C4,0x01C7,0x01C8,0x01C7,0x01CA,0x01CB,0x01CA, - 0x01CD,0x0110, 0x01DD,0x0001,0x018E, 0x01DE,0x0112, 0x01F3,0x0003,0x01F1,0x01F4,0x01F4, 0x01F8,0x0128, - 0x0222,0x0112, 0x023A,0x0009,0x2C65,0x023B,0x023B,0x023D,0x2C66,0x023F,0x0240,0x0241,0x0241, 0x0246,0x010A, - /* IPA Extensions */ - 0x0253,0x0040,0x0181,0x0186,0x0255,0x0189,0x018A,0x0258,0x018F,0x025A,0x0190,0x025C,0x025D,0x025E,0x025F,0x0193,0x0261,0x0262,0x0194,0x0264,0x0265,0x0266,0x0267,0x0197,0x0196,0x026A,0x2C62,0x026C,0x026D,0x026E,0x019C,0x0270,0x0271,0x019D,0x0273,0x0274,0x019F,0x0276,0x0277,0x0278,0x0279,0x027A,0x027B,0x027C,0x2C64,0x027E,0x027F,0x01A6,0x0281,0x0282,0x01A9,0x0284,0x0285,0x0286,0x0287,0x01AE,0x0244,0x01B1,0x01B2,0x0245,0x028D,0x028E,0x028F,0x0290,0x0291,0x01B7, - /* Greek, Coptic */ - 0x037B,0x0003,0x03FD,0x03FE,0x03FF, 0x03AC,0x0004,0x0386,0x0388,0x0389,0x038A, 0x03B1,0x0311, - 0x03C2,0x0002,0x03A3,0x03A3, 0x03C4,0x0308, 0x03CC,0x0003,0x038C,0x038E,0x038F, 0x03D8,0x0118, - 0x03F2,0x000A,0x03F9,0x03F3,0x03F4,0x03F5,0x03F6,0x03F7,0x03F7,0x03F9,0x03FA,0x03FA, - /* Cyrillic */ - 0x0430,0x0320, 0x0450,0x0710, 0x0460,0x0122, 0x048A,0x0136, 0x04C1,0x010E, 0x04CF,0x0001,0x04C0, 0x04D0,0x0144, - /* Armenian */ - 0x0561,0x0426, - - 0x0000 - }; - static const WCHAR cvt2[] = { /* U+1000 - U+FFFF */ - /* Phonetic Extensions */ - 0x1D7D,0x0001,0x2C63, - /* Latin Extended Additional */ - 0x1E00,0x0196, 0x1EA0,0x015A, - /* Greek Extended */ - 0x1F00,0x0608, 0x1F10,0x0606, 0x1F20,0x0608, 0x1F30,0x0608, 0x1F40,0x0606, - 0x1F51,0x0007,0x1F59,0x1F52,0x1F5B,0x1F54,0x1F5D,0x1F56,0x1F5F, 0x1F60,0x0608, - 0x1F70,0x000E,0x1FBA,0x1FBB,0x1FC8,0x1FC9,0x1FCA,0x1FCB,0x1FDA,0x1FDB,0x1FF8,0x1FF9,0x1FEA,0x1FEB,0x1FFA,0x1FFB, - 0x1F80,0x0608, 0x1F90,0x0608, 0x1FA0,0x0608, 0x1FB0,0x0004,0x1FB8,0x1FB9,0x1FB2,0x1FBC, - 0x1FCC,0x0001,0x1FC3, 0x1FD0,0x0602, 0x1FE0,0x0602, 0x1FE5,0x0001,0x1FEC, 0x1FF2,0x0001,0x1FFC, - /* Letterlike Symbols */ - 0x214E,0x0001,0x2132, - /* Number forms */ - 0x2170,0x0210, 0x2184,0x0001,0x2183, - /* Enclosed Alphanumerics */ - 0x24D0,0x051A, 0x2C30,0x042F, - /* Latin Extended-C */ - 0x2C60,0x0102, 0x2C67,0x0106, 0x2C75,0x0102, - /* Coptic */ - 0x2C80,0x0164, - /* Georgian Supplement */ - 0x2D00,0x0826, - /* Full-width */ - 0xFF41,0x031A, - - 0x0000 - }; - const WCHAR *p; - WCHAR bc, nc, cmd; - - - p = chr < 0x1000 ? cvt1 : cvt2; - for (;;) { - bc = *p++; /* Get block base */ - if (!bc || chr < bc) break; - nc = *p++; cmd = nc >> 8; nc &= 0xFF; /* Get processing command and block size */ - if (chr < bc + nc) { /* In the block? */ - switch (cmd) { - case 0: chr = p[chr - bc]; break; /* Table conversion */ - case 1: chr -= (chr - bc) & 1; break; /* Case pairs */ - case 2: chr -= 16; break; /* Shift -16 */ - case 3: chr -= 32; break; /* Shift -32 */ - case 4: chr -= 48; break; /* Shift -48 */ - case 5: chr -= 26; break; /* Shift -26 */ - case 6: chr += 8; break; /* Shift +8 */ - case 7: chr -= 80; break; /* Shift -80 */ - case 8: chr -= 0x1C60; break; /* Shift -0x1C60 */ - } - break; - } - if (!cmd) p += nc; - } - - return chr; -} - diff --git a/os/lib/fs/fat/option/unicode/cc950.c b/os/lib/fs/fat/option/unicode/cc950.c deleted file mode 100644 index 43ef76d9a..000000000 --- a/os/lib/fs/fat/option/unicode/cc950.c +++ /dev/null @@ -1,6900 +0,0 @@ -/*------------------------------------------------------------------------*/ -/* Unicode - OEM code bidirectional converter (C)ChaN, 2015 */ -/* CP950 (Traditional Chinese Big5) */ -/*------------------------------------------------------------------------*/ - -#include "../../ff.h" - - -#if !_USE_LFN || _CODE_PAGE != 950 -#error This file is not needed in current configuration. Remove from the project. -#endif - - -static -const WCHAR uni2oem[] = { -/* Unicode - OEM, Unicode - OEM, Unicode - OEM, Unicode - OEM */ - 0x00A7, 0xA1B1, 0x00AF, 0xA1C2, 0x00B0, 0xA258, 0x00B1, 0xA1D3, - 0x00B7, 0xA150, 0x00D7, 0xA1D1, 0x00F7, 0xA1D2, 0x02C7, 0xA3BE, - 0x02C9, 0xA3BC, 0x02CA, 0xA3BD, 0x02CB, 0xA3BF, 0x02CD, 0xA1C5, - 0x02D9, 0xA3BB, 0x0391, 0xA344, 0x0392, 0xA345, 0x0393, 0xA346, - 0x0394, 0xA347, 0x0395, 0xA348, 0x0396, 0xA349, 0x0397, 0xA34A, - 0x0398, 0xA34B, 0x0399, 0xA34C, 0x039A, 0xA34D, 0x039B, 0xA34E, - 0x039C, 0xA34F, 0x039D, 0xA350, 0x039E, 0xA351, 0x039F, 0xA352, - 0x03A0, 0xA353, 0x03A1, 0xA354, 0x03A3, 0xA355, 0x03A4, 0xA356, - 0x03A5, 0xA357, 0x03A6, 0xA358, 0x03A7, 0xA359, 0x03A8, 0xA35A, - 0x03A9, 0xA35B, 0x03B1, 0xA35C, 0x03B2, 0xA35D, 0x03B3, 0xA35E, - 0x03B4, 0xA35F, 0x03B5, 0xA360, 0x03B6, 0xA361, 0x03B7, 0xA362, - 0x03B8, 0xA363, 0x03B9, 0xA364, 0x03BA, 0xA365, 0x03BB, 0xA366, - 0x03BC, 0xA367, 0x03BD, 0xA368, 0x03BE, 0xA369, 0x03BF, 0xA36A, - 0x03C0, 0xA36B, 0x03C1, 0xA36C, 0x03C3, 0xA36D, 0x03C4, 0xA36E, - 0x03C5, 0xA36F, 0x03C6, 0xA370, 0x03C7, 0xA371, 0x03C8, 0xA372, - 0x03C9, 0xA373, 0x2013, 0xA156, 0x2014, 0xA158, 0x2018, 0xA1A5, - 0x2019, 0xA1A6, 0x201C, 0xA1A7, 0x201D, 0xA1A8, 0x2025, 0xA14C, - 0x2026, 0xA14B, 0x2027, 0xA145, 0x2032, 0xA1AC, 0x2035, 0xA1AB, - 0x203B, 0xA1B0, 0x20AC, 0xA3E1, 0x2103, 0xA24A, 0x2105, 0xA1C1, - 0x2109, 0xA24B, 0x2160, 0xA2B9, 0x2161, 0xA2BA, 0x2162, 0xA2BB, - 0x2163, 0xA2BC, 0x2164, 0xA2BD, 0x2165, 0xA2BE, 0x2166, 0xA2BF, - 0x2167, 0xA2C0, 0x2168, 0xA2C1, 0x2169, 0xA2C2, 0x2190, 0xA1F6, - 0x2191, 0xA1F4, 0x2192, 0xA1F7, 0x2193, 0xA1F5, 0x2196, 0xA1F8, - 0x2197, 0xA1F9, 0x2198, 0xA1FB, 0x2199, 0xA1FA, 0x2215, 0xA241, - 0x221A, 0xA1D4, 0x221E, 0xA1DB, 0x221F, 0xA1E8, 0x2220, 0xA1E7, - 0x2223, 0xA1FD, 0x2225, 0xA1FC, 0x2229, 0xA1E4, 0x222A, 0xA1E5, - 0x222B, 0xA1EC, 0x222E, 0xA1ED, 0x2234, 0xA1EF, 0x2235, 0xA1EE, - 0x2252, 0xA1DC, 0x2260, 0xA1DA, 0x2261, 0xA1DD, 0x2266, 0xA1D8, - 0x2267, 0xA1D9, 0x2295, 0xA1F2, 0x2299, 0xA1F3, 0x22A5, 0xA1E6, - 0x22BF, 0xA1E9, 0x2500, 0xA277, 0x2502, 0xA278, 0x250C, 0xA27A, - 0x2510, 0xA27B, 0x2514, 0xA27C, 0x2518, 0xA27D, 0x251C, 0xA275, - 0x2524, 0xA274, 0x252C, 0xA273, 0x2534, 0xA272, 0x253C, 0xA271, - 0x2550, 0xA2A4, 0x2550, 0xF9F9, 0x2551, 0xF9F8, 0x2552, 0xF9E6, - 0x2553, 0xF9EF, 0x2554, 0xF9DD, 0x2555, 0xF9E8, 0x2556, 0xF9F1, - 0x2557, 0xF9DF, 0x2558, 0xF9EC, 0x2559, 0xF9F5, 0x255A, 0xF9E3, - 0x255B, 0xF9EE, 0x255C, 0xF9F7, 0x255D, 0xF9E5, 0x255E, 0xA2A5, - 0x255E, 0xF9E9, 0x255F, 0xF9F2, 0x2560, 0xF9E0, 0x2561, 0xA2A7, - 0x2561, 0xF9EB, 0x2562, 0xF9F4, 0x2563, 0xF9E2, 0x2564, 0xF9E7, - 0x2565, 0xF9F0, 0x2566, 0xF9DE, 0x2567, 0xF9ED, 0x2568, 0xF9F6, - 0x2569, 0xF9E4, 0x256A, 0xA2A6, 0x256A, 0xF9EA, 0x256B, 0xF9F3, - 0x256C, 0xF9E1, 0x256D, 0xA27E, 0x256D, 0xF9FA, 0x256E, 0xA2A1, - 0x256E, 0xF9FB, 0x256F, 0xA2A3, 0x256F, 0xF9FD, 0x2570, 0xA2A2, - 0x2570, 0xF9FC, 0x2571, 0xA2AC, 0x2572, 0xA2AD, 0x2573, 0xA2AE, - 0x2574, 0xA15A, 0x2581, 0xA262, 0x2582, 0xA263, 0x2583, 0xA264, - 0x2584, 0xA265, 0x2585, 0xA266, 0x2586, 0xA267, 0x2587, 0xA268, - 0x2588, 0xA269, 0x2589, 0xA270, 0x258A, 0xA26F, 0x258B, 0xA26E, - 0x258C, 0xA26D, 0x258D, 0xA26C, 0x258E, 0xA26B, 0x258F, 0xA26A, - 0x2593, 0xF9FE, 0x2594, 0xA276, 0x2595, 0xA279, 0x25A0, 0xA1BD, - 0x25A1, 0xA1BC, 0x25B2, 0xA1B6, 0x25B3, 0xA1B5, 0x25BC, 0xA1BF, - 0x25BD, 0xA1BE, 0x25C6, 0xA1BB, 0x25C7, 0xA1BA, 0x25CB, 0xA1B3, - 0x25CE, 0xA1B7, 0x25CF, 0xA1B4, 0x25E2, 0xA2A8, 0x25E3, 0xA2A9, - 0x25E4, 0xA2AB, 0x25E5, 0xA2AA, 0x2605, 0xA1B9, 0x2606, 0xA1B8, - 0x2640, 0xA1F0, 0x2642, 0xA1F1, 0x3000, 0xA140, 0x3001, 0xA142, - 0x3002, 0xA143, 0x3003, 0xA1B2, 0x3008, 0xA171, 0x3009, 0xA172, - 0x300A, 0xA16D, 0x300B, 0xA16E, 0x300C, 0xA175, 0x300D, 0xA176, - 0x300E, 0xA179, 0x300F, 0xA17A, 0x3010, 0xA169, 0x3011, 0xA16A, - 0x3012, 0xA245, 0x3014, 0xA165, 0x3015, 0xA166, 0x301D, 0xA1A9, - 0x301E, 0xA1AA, 0x3021, 0xA2C3, 0x3022, 0xA2C4, 0x3023, 0xA2C5, - 0x3024, 0xA2C6, 0x3025, 0xA2C7, 0x3026, 0xA2C8, 0x3027, 0xA2C9, - 0x3028, 0xA2CA, 0x3029, 0xA2CB, 0x3105, 0xA374, 0x3106, 0xA375, - 0x3107, 0xA376, 0x3108, 0xA377, 0x3109, 0xA378, 0x310A, 0xA379, - 0x310B, 0xA37A, 0x310C, 0xA37B, 0x310D, 0xA37C, 0x310E, 0xA37D, - 0x310F, 0xA37E, 0x3110, 0xA3A1, 0x3111, 0xA3A2, 0x3112, 0xA3A3, - 0x3113, 0xA3A4, 0x3114, 0xA3A5, 0x3115, 0xA3A6, 0x3116, 0xA3A7, - 0x3117, 0xA3A8, 0x3118, 0xA3A9, 0x3119, 0xA3AA, 0x311A, 0xA3AB, - 0x311B, 0xA3AC, 0x311C, 0xA3AD, 0x311D, 0xA3AE, 0x311E, 0xA3AF, - 0x311F, 0xA3B0, 0x3120, 0xA3B1, 0x3121, 0xA3B2, 0x3122, 0xA3B3, - 0x3123, 0xA3B4, 0x3124, 0xA3B5, 0x3125, 0xA3B6, 0x3126, 0xA3B7, - 0x3127, 0xA3B8, 0x3128, 0xA3B9, 0x3129, 0xA3BA, 0x32A3, 0xA1C0, - 0x338E, 0xA255, 0x338F, 0xA256, 0x339C, 0xA250, 0x339D, 0xA251, - 0x339E, 0xA252, 0x33A1, 0xA254, 0x33C4, 0xA257, 0x33CE, 0xA253, - 0x33D1, 0xA1EB, 0x33D2, 0xA1EA, 0x33D5, 0xA24F, 0x4E00, 0xA440, - 0x4E01, 0xA442, 0x4E03, 0xA443, 0x4E07, 0xC945, 0x4E08, 0xA456, - 0x4E09, 0xA454, 0x4E0A, 0xA457, 0x4E0B, 0xA455, 0x4E0C, 0xC946, - 0x4E0D, 0xA4A3, 0x4E0E, 0xC94F, 0x4E0F, 0xC94D, 0x4E10, 0xA4A2, - 0x4E11, 0xA4A1, 0x4E14, 0xA542, 0x4E15, 0xA541, 0x4E16, 0xA540, - 0x4E18, 0xA543, 0x4E19, 0xA4FE, 0x4E1E, 0xA5E0, 0x4E1F, 0xA5E1, - 0x4E26, 0xA8C3, 0x4E2B, 0xA458, 0x4E2D, 0xA4A4, 0x4E2E, 0xC950, - 0x4E30, 0xA4A5, 0x4E31, 0xC963, 0x4E32, 0xA6EA, 0x4E33, 0xCBB1, - 0x4E38, 0xA459, 0x4E39, 0xA4A6, 0x4E3B, 0xA544, 0x4E3C, 0xC964, - 0x4E42, 0xC940, 0x4E43, 0xA444, 0x4E45, 0xA45B, 0x4E47, 0xC947, - 0x4E48, 0xA45C, 0x4E4B, 0xA4A7, 0x4E4D, 0xA545, 0x4E4E, 0xA547, - 0x4E4F, 0xA546, 0x4E52, 0xA5E2, 0x4E53, 0xA5E3, 0x4E56, 0xA8C4, - 0x4E58, 0xADBC, 0x4E59, 0xA441, 0x4E5C, 0xC941, 0x4E5D, 0xA445, - 0x4E5E, 0xA45E, 0x4E5F, 0xA45D, 0x4E69, 0xA5E4, 0x4E73, 0xA8C5, - 0x4E7E, 0xB0AE, 0x4E7F, 0xD44B, 0x4E82, 0xB6C3, 0x4E83, 0xDCB1, - 0x4E84, 0xDCB2, 0x4E86, 0xA446, 0x4E88, 0xA4A9, 0x4E8B, 0xA8C6, - 0x4E8C, 0xA447, 0x4E8D, 0xC948, 0x4E8E, 0xA45F, 0x4E91, 0xA4AA, - 0x4E92, 0xA4AC, 0x4E93, 0xC951, 0x4E94, 0xA4AD, 0x4E95, 0xA4AB, - 0x4E99, 0xA5E5, 0x4E9B, 0xA8C7, 0x4E9E, 0xA8C8, 0x4E9F, 0xAB45, - 0x4EA1, 0xA460, 0x4EA2, 0xA4AE, 0x4EA4, 0xA5E6, 0x4EA5, 0xA5E8, - 0x4EA6, 0xA5E7, 0x4EA8, 0xA6EB, 0x4EAB, 0xA8C9, 0x4EAC, 0xA8CA, - 0x4EAD, 0xAB46, 0x4EAE, 0xAB47, 0x4EB3, 0xADBD, 0x4EB6, 0xDCB3, - 0x4EB9, 0xF6D6, 0x4EBA, 0xA448, 0x4EC0, 0xA4B0, 0x4EC1, 0xA4AF, - 0x4EC2, 0xC952, 0x4EC3, 0xA4B1, 0x4EC4, 0xA4B7, 0x4EC6, 0xA4B2, - 0x4EC7, 0xA4B3, 0x4EC8, 0xC954, 0x4EC9, 0xC953, 0x4ECA, 0xA4B5, - 0x4ECB, 0xA4B6, 0x4ECD, 0xA4B4, 0x4ED4, 0xA54A, 0x4ED5, 0xA54B, - 0x4ED6, 0xA54C, 0x4ED7, 0xA54D, 0x4ED8, 0xA549, 0x4ED9, 0xA550, - 0x4EDA, 0xC96A, 0x4EDC, 0xC966, 0x4EDD, 0xC969, 0x4EDE, 0xA551, - 0x4EDF, 0xA561, 0x4EE1, 0xC968, 0x4EE3, 0xA54E, 0x4EE4, 0xA54F, - 0x4EE5, 0xA548, 0x4EE8, 0xC965, 0x4EE9, 0xC967, 0x4EF0, 0xA5F5, - 0x4EF1, 0xC9B0, 0x4EF2, 0xA5F2, 0x4EF3, 0xA5F6, 0x4EF4, 0xC9BA, - 0x4EF5, 0xC9AE, 0x4EF6, 0xA5F3, 0x4EF7, 0xC9B2, 0x4EFB, 0xA5F4, - 0x4EFD, 0xA5F7, 0x4EFF, 0xA5E9, 0x4F00, 0xC9B1, 0x4F01, 0xA5F8, - 0x4F02, 0xC9B5, 0x4F04, 0xC9B9, 0x4F05, 0xC9B6, 0x4F08, 0xC9B3, - 0x4F09, 0xA5EA, 0x4F0A, 0xA5EC, 0x4F0B, 0xA5F9, 0x4F0D, 0xA5EE, - 0x4F0E, 0xC9AB, 0x4F0F, 0xA5F1, 0x4F10, 0xA5EF, 0x4F11, 0xA5F0, - 0x4F12, 0xC9BB, 0x4F13, 0xC9B8, 0x4F14, 0xC9AF, 0x4F15, 0xA5ED, - 0x4F18, 0xC9AC, 0x4F19, 0xA5EB, 0x4F1D, 0xC9B4, 0x4F22, 0xC9B7, - 0x4F2C, 0xC9AD, 0x4F2D, 0xCA66, 0x4F2F, 0xA742, 0x4F30, 0xA6F4, - 0x4F33, 0xCA67, 0x4F34, 0xA6F1, 0x4F36, 0xA744, 0x4F38, 0xA6F9, - 0x4F3A, 0xA6F8, 0x4F3B, 0xCA5B, 0x4F3C, 0xA6FC, 0x4F3D, 0xA6F7, - 0x4F3E, 0xCA60, 0x4F3F, 0xCA68, 0x4F41, 0xCA64, 0x4F43, 0xA6FA, - 0x4F46, 0xA6FD, 0x4F47, 0xA6EE, 0x4F48, 0xA747, 0x4F49, 0xCA5D, - 0x4F4C, 0xCBBD, 0x4F4D, 0xA6EC, 0x4F4E, 0xA743, 0x4F4F, 0xA6ED, - 0x4F50, 0xA6F5, 0x4F51, 0xA6F6, 0x4F52, 0xCA62, 0x4F53, 0xCA5E, - 0x4F54, 0xA6FB, 0x4F55, 0xA6F3, 0x4F56, 0xCA5A, 0x4F57, 0xA6EF, - 0x4F58, 0xCA65, 0x4F59, 0xA745, 0x4F5A, 0xA748, 0x4F5B, 0xA6F2, - 0x4F5C, 0xA740, 0x4F5D, 0xA746, 0x4F5E, 0xA6F0, 0x4F5F, 0xCA63, - 0x4F60, 0xA741, 0x4F61, 0xCA69, 0x4F62, 0xCA5C, 0x4F63, 0xA6FE, - 0x4F64, 0xCA5F, 0x4F67, 0xCA61, 0x4F69, 0xA8D8, 0x4F6A, 0xCBBF, - 0x4F6B, 0xCBCB, 0x4F6C, 0xA8D0, 0x4F6E, 0xCBCC, 0x4F6F, 0xA8CB, - 0x4F70, 0xA8D5, 0x4F73, 0xA8CE, 0x4F74, 0xCBB9, 0x4F75, 0xA8D6, - 0x4F76, 0xCBB8, 0x4F77, 0xCBBC, 0x4F78, 0xCBC3, 0x4F79, 0xCBC1, - 0x4F7A, 0xA8DE, 0x4F7B, 0xA8D9, 0x4F7C, 0xCBB3, 0x4F7D, 0xCBB5, - 0x4F7E, 0xA8DB, 0x4F7F, 0xA8CF, 0x4F80, 0xCBB6, 0x4F81, 0xCBC2, - 0x4F82, 0xCBC9, 0x4F83, 0xA8D4, 0x4F84, 0xCBBB, 0x4F85, 0xCBB4, - 0x4F86, 0xA8D3, 0x4F87, 0xCBB7, 0x4F88, 0xA8D7, 0x4F89, 0xCBBA, - 0x4F8B, 0xA8D2, 0x4F8D, 0xA8CD, 0x4F8F, 0xA8DC, 0x4F90, 0xCBC4, - 0x4F91, 0xA8DD, 0x4F92, 0xCBC8, 0x4F94, 0xCBC6, 0x4F95, 0xCBCA, - 0x4F96, 0xA8DA, 0x4F97, 0xCBBE, 0x4F98, 0xCBB2, 0x4F9A, 0xCBC0, - 0x4F9B, 0xA8D1, 0x4F9C, 0xCBC5, 0x4F9D, 0xA8CC, 0x4F9E, 0xCBC7, - 0x4FAE, 0xAB56, 0x4FAF, 0xAB4A, 0x4FB2, 0xCDE0, 0x4FB3, 0xCDE8, - 0x4FB5, 0xAB49, 0x4FB6, 0xAB51, 0x4FB7, 0xAB5D, 0x4FB9, 0xCDEE, - 0x4FBA, 0xCDEC, 0x4FBB, 0xCDE7, 0x4FBF, 0xAB4B, 0x4FC0, 0xCDED, - 0x4FC1, 0xCDE3, 0x4FC2, 0xAB59, 0x4FC3, 0xAB50, 0x4FC4, 0xAB58, - 0x4FC5, 0xCDDE, 0x4FC7, 0xCDEA, 0x4FC9, 0xCDE1, 0x4FCA, 0xAB54, - 0x4FCB, 0xCDE2, 0x4FCD, 0xCDDD, 0x4FCE, 0xAB5B, 0x4FCF, 0xAB4E, - 0x4FD0, 0xAB57, 0x4FD1, 0xAB4D, 0x4FD3, 0xCDDF, 0x4FD4, 0xCDE4, - 0x4FD6, 0xCDEB, 0x4FD7, 0xAB55, 0x4FD8, 0xAB52, 0x4FD9, 0xCDE6, - 0x4FDA, 0xAB5A, 0x4FDB, 0xCDE9, 0x4FDC, 0xCDE5, 0x4FDD, 0xAB4F, - 0x4FDE, 0xAB5C, 0x4FDF, 0xAB53, 0x4FE0, 0xAB4C, 0x4FE1, 0xAB48, - 0x4FEC, 0xCDEF, 0x4FEE, 0xADD7, 0x4FEF, 0xADC1, 0x4FF1, 0xADD1, - 0x4FF3, 0xADD6, 0x4FF4, 0xD0D0, 0x4FF5, 0xD0CF, 0x4FF6, 0xD0D4, - 0x4FF7, 0xD0D5, 0x4FF8, 0xADC4, 0x4FFA, 0xADCD, 0x4FFE, 0xADDA, - 0x5000, 0xADCE, 0x5005, 0xD0C9, 0x5006, 0xADC7, 0x5007, 0xD0CA, - 0x5009, 0xADDC, 0x500B, 0xADD3, 0x500C, 0xADBE, 0x500D, 0xADBF, - 0x500E, 0xD0DD, 0x500F, 0xB0BF, 0x5011, 0xADCC, 0x5012, 0xADCB, - 0x5013, 0xD0CB, 0x5014, 0xADCF, 0x5015, 0xD45B, 0x5016, 0xADC6, - 0x5017, 0xD0D6, 0x5018, 0xADD5, 0x5019, 0xADD4, 0x501A, 0xADCA, - 0x501B, 0xD0CE, 0x501C, 0xD0D7, 0x501E, 0xD0C8, 0x501F, 0xADC9, - 0x5020, 0xD0D8, 0x5021, 0xADD2, 0x5022, 0xD0CC, 0x5023, 0xADC0, - 0x5025, 0xADC3, 0x5026, 0xADC2, 0x5027, 0xD0D9, 0x5028, 0xADD0, - 0x5029, 0xADC5, 0x502A, 0xADD9, 0x502B, 0xADDB, 0x502C, 0xD0D3, - 0x502D, 0xADD8, 0x502F, 0xD0DB, 0x5030, 0xD0CD, 0x5031, 0xD0DC, - 0x5033, 0xD0D1, 0x5035, 0xD0DA, 0x5037, 0xD0D2, 0x503C, 0xADC8, - 0x5040, 0xD463, 0x5041, 0xD457, 0x5043, 0xB0B3, 0x5045, 0xD45C, - 0x5046, 0xD462, 0x5047, 0xB0B2, 0x5048, 0xD455, 0x5049, 0xB0B6, - 0x504A, 0xD459, 0x504B, 0xD452, 0x504C, 0xB0B4, 0x504D, 0xD456, - 0x504E, 0xB0B9, 0x504F, 0xB0BE, 0x5051, 0xD467, 0x5053, 0xD451, - 0x5055, 0xB0BA, 0x5057, 0xD466, 0x505A, 0xB0B5, 0x505B, 0xD458, - 0x505C, 0xB0B1, 0x505D, 0xD453, 0x505E, 0xD44F, 0x505F, 0xD45D, - 0x5060, 0xD450, 0x5061, 0xD44E, 0x5062, 0xD45A, 0x5063, 0xD460, - 0x5064, 0xD461, 0x5065, 0xB0B7, 0x5068, 0xD85B, 0x5069, 0xD45E, - 0x506A, 0xD44D, 0x506B, 0xD45F, 0x506D, 0xB0C1, 0x506E, 0xD464, - 0x506F, 0xB0C0, 0x5070, 0xD44C, 0x5072, 0xD454, 0x5073, 0xD465, - 0x5074, 0xB0BC, 0x5075, 0xB0BB, 0x5076, 0xB0B8, 0x5077, 0xB0BD, - 0x507A, 0xB0AF, 0x507D, 0xB0B0, 0x5080, 0xB3C8, 0x5082, 0xD85E, - 0x5083, 0xD857, 0x5085, 0xB3C5, 0x5087, 0xD85F, 0x508B, 0xD855, - 0x508C, 0xD858, 0x508D, 0xB3C4, 0x508E, 0xD859, 0x5091, 0xB3C7, - 0x5092, 0xD85D, 0x5094, 0xD853, 0x5095, 0xD852, 0x5096, 0xB3C9, - 0x5098, 0xB3CA, 0x5099, 0xB3C6, 0x509A, 0xB3CB, 0x509B, 0xD851, - 0x509C, 0xD85C, 0x509D, 0xD85A, 0x509E, 0xD854, 0x50A2, 0xB3C3, - 0x50A3, 0xD856, 0x50AC, 0xB6CA, 0x50AD, 0xB6C4, 0x50AE, 0xDCB7, - 0x50AF, 0xB6CD, 0x50B0, 0xDCBD, 0x50B1, 0xDCC0, 0x50B2, 0xB6C6, - 0x50B3, 0xB6C7, 0x50B4, 0xDCBA, 0x50B5, 0xB6C5, 0x50B6, 0xDCC3, - 0x50B7, 0xB6CB, 0x50B8, 0xDCC4, 0x50BA, 0xDCBF, 0x50BB, 0xB6CC, - 0x50BD, 0xDCB4, 0x50BE, 0xB6C9, 0x50BF, 0xDCB5, 0x50C1, 0xDCBE, - 0x50C2, 0xDCBC, 0x50C4, 0xDCB8, 0x50C5, 0xB6C8, 0x50C6, 0xDCB6, - 0x50C7, 0xB6CE, 0x50C8, 0xDCBB, 0x50C9, 0xDCC2, 0x50CA, 0xDCB9, - 0x50CB, 0xDCC1, 0x50CE, 0xB9B6, 0x50CF, 0xB9B3, 0x50D1, 0xB9B4, - 0x50D3, 0xE0F9, 0x50D4, 0xE0F1, 0x50D5, 0xB9B2, 0x50D6, 0xB9AF, - 0x50D7, 0xE0F2, 0x50DA, 0xB9B1, 0x50DB, 0xE0F5, 0x50DD, 0xE0F7, - 0x50E0, 0xE0FE, 0x50E3, 0xE0FD, 0x50E4, 0xE0F8, 0x50E5, 0xB9AE, - 0x50E6, 0xE0F0, 0x50E7, 0xB9AC, 0x50E8, 0xE0F3, 0x50E9, 0xB9B7, - 0x50EA, 0xE0F6, 0x50EC, 0xE0FA, 0x50ED, 0xB9B0, 0x50EE, 0xB9AD, - 0x50EF, 0xE0FC, 0x50F0, 0xE0FB, 0x50F1, 0xB9B5, 0x50F3, 0xE0F4, - 0x50F5, 0xBBF8, 0x50F6, 0xE4EC, 0x50F8, 0xE4E9, 0x50F9, 0xBBF9, - 0x50FB, 0xBBF7, 0x50FD, 0xE4F0, 0x50FE, 0xE4ED, 0x50FF, 0xE4E6, - 0x5100, 0xBBF6, 0x5102, 0xBBFA, 0x5103, 0xE4E7, 0x5104, 0xBBF5, - 0x5105, 0xBBFD, 0x5106, 0xE4EA, 0x5107, 0xE4EB, 0x5108, 0xBBFB, - 0x5109, 0xBBFC, 0x510A, 0xE4F1, 0x510B, 0xE4EE, 0x510C, 0xE4EF, - 0x5110, 0xBEAA, 0x5111, 0xE8F8, 0x5112, 0xBEA7, 0x5113, 0xE8F5, - 0x5114, 0xBEA9, 0x5115, 0xBEAB, 0x5117, 0xE8F6, 0x5118, 0xBEA8, - 0x511A, 0xE8F7, 0x511C, 0xE8F4, 0x511F, 0xC076, 0x5120, 0xECBD, - 0x5121, 0xC077, 0x5122, 0xECBB, 0x5124, 0xECBC, 0x5125, 0xECBA, - 0x5126, 0xECB9, 0x5129, 0xECBE, 0x512A, 0xC075, 0x512D, 0xEFB8, - 0x512E, 0xEFB9, 0x5130, 0xE4E8, 0x5131, 0xEFB7, 0x5132, 0xC078, - 0x5133, 0xC35F, 0x5134, 0xF1EB, 0x5135, 0xF1EC, 0x5137, 0xC4D7, - 0x5138, 0xC4D8, 0x5139, 0xF5C1, 0x513A, 0xF5C0, 0x513B, 0xC56C, - 0x513C, 0xC56B, 0x513D, 0xF7D0, 0x513F, 0xA449, 0x5140, 0xA461, - 0x5141, 0xA4B9, 0x5143, 0xA4B8, 0x5144, 0xA553, 0x5145, 0xA552, - 0x5146, 0xA5FC, 0x5147, 0xA5FB, 0x5148, 0xA5FD, 0x5149, 0xA5FA, - 0x514B, 0xA74A, 0x514C, 0xA749, 0x514D, 0xA74B, 0x5152, 0xA8E0, - 0x5154, 0xA8DF, 0x5155, 0xA8E1, 0x5157, 0xAB5E, 0x5159, 0xA259, - 0x515A, 0xD0DE, 0x515B, 0xA25A, 0x515C, 0xB0C2, 0x515D, 0xA25C, - 0x515E, 0xA25B, 0x515F, 0xD860, 0x5161, 0xA25D, 0x5162, 0xB9B8, - 0x5163, 0xA25E, 0x5165, 0xA44A, 0x5167, 0xA4BA, 0x5168, 0xA5FE, - 0x5169, 0xA8E2, 0x516B, 0xA44B, 0x516C, 0xA4BD, 0x516D, 0xA4BB, - 0x516E, 0xA4BC, 0x5171, 0xA640, 0x5175, 0xA74C, 0x5176, 0xA8E4, - 0x5177, 0xA8E3, 0x5178, 0xA8E5, 0x517C, 0xADDD, 0x5180, 0xBEAC, - 0x5187, 0xC94E, 0x5189, 0xA554, 0x518A, 0xA555, 0x518D, 0xA641, - 0x518F, 0xCA6A, 0x5191, 0xAB60, 0x5192, 0xAB5F, 0x5193, 0xD0E0, - 0x5194, 0xD0DF, 0x5195, 0xB0C3, 0x5197, 0xA4BE, 0x5198, 0xC955, - 0x519E, 0xCBCD, 0x51A0, 0xAB61, 0x51A2, 0xADE0, 0x51A4, 0xADDE, - 0x51A5, 0xADDF, 0x51AA, 0xBEAD, 0x51AC, 0xA556, 0x51B0, 0xA642, - 0x51B1, 0xC9BC, 0x51B6, 0xA74D, 0x51B7, 0xA74E, 0x51B9, 0xCA6B, - 0x51BC, 0xCBCE, 0x51BD, 0xA8E6, 0x51BE, 0xCBCF, 0x51C4, 0xD0E2, - 0x51C5, 0xD0E3, 0x51C6, 0xADE3, 0x51C8, 0xD0E4, 0x51CA, 0xD0E1, - 0x51CB, 0xADE4, 0x51CC, 0xADE2, 0x51CD, 0xADE1, 0x51CE, 0xD0E5, - 0x51D0, 0xD468, 0x51D4, 0xD861, 0x51D7, 0xDCC5, 0x51D8, 0xE140, - 0x51DC, 0xBBFE, 0x51DD, 0xBEAE, 0x51DE, 0xE8F9, 0x51E0, 0xA44C, - 0x51E1, 0xA45A, 0x51F0, 0xB0C4, 0x51F1, 0xB3CD, 0x51F3, 0xB9B9, - 0x51F5, 0xC942, 0x51F6, 0xA4BF, 0x51F8, 0xA559, 0x51F9, 0xA557, - 0x51FA, 0xA558, 0x51FD, 0xA8E7, 0x5200, 0xA44D, 0x5201, 0xA44E, - 0x5203, 0xA462, 0x5206, 0xA4C0, 0x5207, 0xA4C1, 0x5208, 0xA4C2, - 0x5209, 0xC9BE, 0x520A, 0xA55A, 0x520C, 0xC96B, 0x520E, 0xA646, - 0x5210, 0xC9BF, 0x5211, 0xA644, 0x5212, 0xA645, 0x5213, 0xC9BD, - 0x5216, 0xA647, 0x5217, 0xA643, 0x521C, 0xCA6C, 0x521D, 0xAAEC, - 0x521E, 0xCA6D, 0x5221, 0xCA6E, 0x5224, 0xA750, 0x5225, 0xA74F, - 0x5228, 0xA753, 0x5229, 0xA751, 0x522A, 0xA752, 0x522E, 0xA8ED, - 0x5230, 0xA8EC, 0x5231, 0xCBD4, 0x5232, 0xCBD1, 0x5233, 0xCBD2, - 0x5235, 0xCBD0, 0x5236, 0xA8EE, 0x5237, 0xA8EA, 0x5238, 0xA8E9, - 0x523A, 0xA8EB, 0x523B, 0xA8E8, 0x5241, 0xA8EF, 0x5243, 0xAB63, - 0x5244, 0xCDF0, 0x5246, 0xCBD3, 0x5247, 0xAB68, 0x5249, 0xCDF1, - 0x524A, 0xAB64, 0x524B, 0xAB67, 0x524C, 0xAB66, 0x524D, 0xAB65, - 0x524E, 0xAB62, 0x5252, 0xD0E8, 0x5254, 0xADE7, 0x5255, 0xD0EB, - 0x5256, 0xADE5, 0x525A, 0xD0E7, 0x525B, 0xADE8, 0x525C, 0xADE6, - 0x525D, 0xADE9, 0x525E, 0xD0E9, 0x525F, 0xD0EA, 0x5261, 0xD0E6, - 0x5262, 0xD0EC, 0x5269, 0xB3D1, 0x526A, 0xB0C5, 0x526B, 0xD469, - 0x526C, 0xD46B, 0x526D, 0xD46A, 0x526E, 0xD46C, 0x526F, 0xB0C6, - 0x5272, 0xB3CE, 0x5274, 0xB3CF, 0x5275, 0xB3D0, 0x5277, 0xB6D0, - 0x5278, 0xDCC7, 0x527A, 0xDCC6, 0x527B, 0xDCC8, 0x527C, 0xDCC9, - 0x527D, 0xB6D1, 0x527F, 0xB6CF, 0x5280, 0xE141, 0x5281, 0xE142, - 0x5282, 0xB9BB, 0x5283, 0xB9BA, 0x5284, 0xE35A, 0x5287, 0xBC40, - 0x5288, 0xBC41, 0x5289, 0xBC42, 0x528A, 0xBC44, 0x528B, 0xE4F2, - 0x528C, 0xE4F3, 0x528D, 0xBC43, 0x5291, 0xBEAF, 0x5293, 0xBEB0, - 0x5296, 0xF1ED, 0x5297, 0xF5C3, 0x5298, 0xF5C2, 0x5299, 0xF7D1, - 0x529B, 0xA44F, 0x529F, 0xA55C, 0x52A0, 0xA55B, 0x52A3, 0xA648, - 0x52A6, 0xC9C0, 0x52A9, 0xA755, 0x52AA, 0xA756, 0x52AB, 0xA754, - 0x52AC, 0xA757, 0x52AD, 0xCA6F, 0x52AE, 0xCA70, 0x52BB, 0xA8F1, - 0x52BC, 0xCBD5, 0x52BE, 0xA8F0, 0x52C0, 0xCDF2, 0x52C1, 0xAB6C, - 0x52C2, 0xCDF3, 0x52C3, 0xAB6B, 0x52C7, 0xAB69, 0x52C9, 0xAB6A, - 0x52CD, 0xD0ED, 0x52D2, 0xB0C7, 0x52D3, 0xD46E, 0x52D5, 0xB0CA, - 0x52D6, 0xD46D, 0x52D7, 0xB1E5, 0x52D8, 0xB0C9, 0x52D9, 0xB0C8, - 0x52DB, 0xB3D4, 0x52DD, 0xB3D3, 0x52DE, 0xB3D2, 0x52DF, 0xB6D2, - 0x52E2, 0xB6D5, 0x52E3, 0xB6D6, 0x52E4, 0xB6D4, 0x52E6, 0xB6D3, - 0x52E9, 0xE143, 0x52EB, 0xE144, 0x52EF, 0xE4F5, 0x52F0, 0xBC45, - 0x52F1, 0xE4F4, 0x52F3, 0xBEB1, 0x52F4, 0xECBF, 0x52F5, 0xC079, - 0x52F7, 0xF1EE, 0x52F8, 0xC455, 0x52FA, 0xA463, 0x52FB, 0xA4C3, - 0x52FC, 0xC956, 0x52FE, 0xA4C4, 0x52FF, 0xA4C5, 0x5305, 0xA55D, - 0x5306, 0xA55E, 0x5308, 0xA649, 0x5309, 0xCA71, 0x530A, 0xCBD6, - 0x530B, 0xCBD7, 0x530D, 0xAB6D, 0x530E, 0xD0EE, 0x530F, 0xB0CC, - 0x5310, 0xB0CB, 0x5311, 0xD863, 0x5312, 0xD862, 0x5315, 0xA450, - 0x5316, 0xA4C6, 0x5317, 0xA55F, 0x5319, 0xB0CD, 0x531A, 0xC943, - 0x531C, 0xC96C, 0x531D, 0xA560, 0x531F, 0xC9C2, 0x5320, 0xA64B, - 0x5321, 0xA64A, 0x5322, 0xC9C1, 0x5323, 0xA758, 0x532A, 0xADEA, - 0x532D, 0xD46F, 0x532F, 0xB6D7, 0x5330, 0xE145, 0x5331, 0xB9BC, - 0x5334, 0xE8FA, 0x5337, 0xF3FD, 0x5339, 0xA4C7, 0x533C, 0xCBD8, - 0x533D, 0xCDF4, 0x533E, 0xB0D0, 0x533F, 0xB0CE, 0x5340, 0xB0CF, - 0x5341, 0xA2CC, 0x5341, 0xA451, 0x5343, 0xA464, 0x5344, 0xA2CD, - 0x5345, 0xA2CE, 0x5345, 0xA4CA, 0x5347, 0xA4C9, 0x5348, 0xA4C8, - 0x5349, 0xA563, 0x534A, 0xA562, 0x534C, 0xC96D, 0x534D, 0xC9C3, - 0x5351, 0xA8F5, 0x5352, 0xA8F2, 0x5353, 0xA8F4, 0x5354, 0xA8F3, - 0x5357, 0xAB6E, 0x535A, 0xB3D5, 0x535C, 0xA452, 0x535E, 0xA4CB, - 0x5360, 0xA565, 0x5361, 0xA564, 0x5363, 0xCA72, 0x5366, 0xA8F6, - 0x536C, 0xC957, 0x536E, 0xA567, 0x536F, 0xA566, 0x5370, 0xA64C, - 0x5371, 0xA64D, 0x5372, 0xCA73, 0x5373, 0xA759, 0x5375, 0xA75A, - 0x5377, 0xA8F7, 0x5378, 0xA8F8, 0x5379, 0xA8F9, 0x537B, 0xAB6F, - 0x537C, 0xCDF5, 0x537F, 0xADEB, 0x5382, 0xC944, 0x5384, 0xA4CC, - 0x538A, 0xC9C4, 0x538E, 0xCA74, 0x538F, 0xCA75, 0x5392, 0xCBD9, - 0x5394, 0xCBDA, 0x5396, 0xCDF7, 0x5397, 0xCDF6, 0x5398, 0xCDF9, - 0x5399, 0xCDF8, 0x539A, 0xAB70, 0x539C, 0xD470, 0x539D, 0xADED, - 0x539E, 0xD0EF, 0x539F, 0xADEC, 0x53A4, 0xD864, 0x53A5, 0xB3D6, - 0x53A7, 0xD865, 0x53AC, 0xE146, 0x53AD, 0xB9BD, 0x53B2, 0xBC46, - 0x53B4, 0xF1EF, 0x53B9, 0xC958, 0x53BB, 0xA568, 0x53C3, 0xB0D1, - 0x53C8, 0xA453, 0x53C9, 0xA465, 0x53CA, 0xA4CE, 0x53CB, 0xA4CD, - 0x53CD, 0xA4CF, 0x53D4, 0xA8FB, 0x53D6, 0xA8FA, 0x53D7, 0xA8FC, - 0x53DB, 0xAB71, 0x53DF, 0xADEE, 0x53E1, 0xE8FB, 0x53E2, 0xC24F, - 0x53E3, 0xA466, 0x53E4, 0xA56A, 0x53E5, 0xA579, 0x53E6, 0xA574, - 0x53E8, 0xA56F, 0x53E9, 0xA56E, 0x53EA, 0xA575, 0x53EB, 0xA573, - 0x53EC, 0xA56C, 0x53ED, 0xA57A, 0x53EE, 0xA56D, 0x53EF, 0xA569, - 0x53F0, 0xA578, 0x53F1, 0xA577, 0x53F2, 0xA576, 0x53F3, 0xA56B, - 0x53F5, 0xA572, 0x53F8, 0xA571, 0x53FB, 0xA57B, 0x53FC, 0xA570, - 0x5401, 0xA653, 0x5403, 0xA659, 0x5404, 0xA655, 0x5406, 0xA65B, - 0x5407, 0xC9C5, 0x5408, 0xA658, 0x5409, 0xA64E, 0x540A, 0xA651, - 0x540B, 0xA654, 0x540C, 0xA650, 0x540D, 0xA657, 0x540E, 0xA65A, - 0x540F, 0xA64F, 0x5410, 0xA652, 0x5411, 0xA656, 0x5412, 0xA65C, - 0x5418, 0xCA7E, 0x5419, 0xCA7B, 0x541B, 0xA767, 0x541C, 0xCA7C, - 0x541D, 0xA75B, 0x541E, 0xA75D, 0x541F, 0xA775, 0x5420, 0xA770, - 0x5424, 0xCAA5, 0x5425, 0xCA7D, 0x5426, 0xA75F, 0x5427, 0xA761, - 0x5428, 0xCAA4, 0x5429, 0xA768, 0x542A, 0xCA78, 0x542B, 0xA774, - 0x542C, 0xA776, 0x542D, 0xA75C, 0x542E, 0xA76D, 0x5430, 0xCA76, - 0x5431, 0xA773, 0x5433, 0xA764, 0x5435, 0xA76E, 0x5436, 0xA76F, - 0x5437, 0xCA77, 0x5438, 0xA76C, 0x5439, 0xA76A, 0x543B, 0xA76B, - 0x543C, 0xA771, 0x543D, 0xCAA1, 0x543E, 0xA75E, 0x5440, 0xA772, - 0x5441, 0xCAA3, 0x5442, 0xA766, 0x5443, 0xA763, 0x5445, 0xCA7A, - 0x5446, 0xA762, 0x5447, 0xCAA6, 0x5448, 0xA765, 0x544A, 0xA769, - 0x544E, 0xA760, 0x544F, 0xCAA2, 0x5454, 0xCA79, 0x5460, 0xCBEB, - 0x5461, 0xCBEA, 0x5462, 0xA94F, 0x5463, 0xCBED, 0x5464, 0xCBEF, - 0x5465, 0xCBE4, 0x5466, 0xCBE7, 0x5467, 0xCBEE, 0x5468, 0xA950, - 0x546B, 0xCBE1, 0x546C, 0xCBE5, 0x546F, 0xCBE9, 0x5470, 0xCE49, - 0x5471, 0xA94B, 0x5472, 0xCE4D, 0x5473, 0xA8FD, 0x5474, 0xCBE6, - 0x5475, 0xA8FE, 0x5476, 0xA94C, 0x5477, 0xA945, 0x5478, 0xA941, - 0x547A, 0xCBE2, 0x547B, 0xA944, 0x547C, 0xA949, 0x547D, 0xA952, - 0x547E, 0xCBE3, 0x547F, 0xCBDC, 0x5480, 0xA943, 0x5481, 0xCBDD, - 0x5482, 0xCBDF, 0x5484, 0xA946, 0x5486, 0xA948, 0x5487, 0xCBDB, - 0x5488, 0xCBE0, 0x548B, 0xA951, 0x548C, 0xA94D, 0x548D, 0xCBE8, - 0x548E, 0xA953, 0x5490, 0xA94A, 0x5491, 0xCBDE, 0x5492, 0xA947, - 0x5495, 0xA942, 0x5496, 0xA940, 0x5498, 0xCBEC, 0x549A, 0xA94E, - 0x54A0, 0xCE48, 0x54A1, 0xCDFB, 0x54A2, 0xCE4B, 0x54A5, 0xCDFD, - 0x54A6, 0xAB78, 0x54A7, 0xABA8, 0x54A8, 0xAB74, 0x54A9, 0xABA7, - 0x54AA, 0xAB7D, 0x54AB, 0xABA4, 0x54AC, 0xAB72, 0x54AD, 0xCDFC, - 0x54AE, 0xCE43, 0x54AF, 0xABA3, 0x54B0, 0xCE4F, 0x54B1, 0xABA5, - 0x54B3, 0xAB79, 0x54B6, 0xCE45, 0x54B7, 0xCE42, 0x54B8, 0xAB77, - 0x54BA, 0xCDFA, 0x54BB, 0xABA6, 0x54BC, 0xCE4A, 0x54BD, 0xAB7C, - 0x54BE, 0xCE4C, 0x54BF, 0xABA9, 0x54C0, 0xAB73, 0x54C1, 0xAB7E, - 0x54C2, 0xAB7B, 0x54C3, 0xCE40, 0x54C4, 0xABA1, 0x54C5, 0xCE46, - 0x54C6, 0xCE47, 0x54C7, 0xAB7A, 0x54C8, 0xABA2, 0x54C9, 0xAB76, - 0x54CE, 0xAB75, 0x54CF, 0xCDFE, 0x54D6, 0xCE44, 0x54DE, 0xCE4E, - 0x54E0, 0xD144, 0x54E1, 0xADFB, 0x54E2, 0xD0F1, 0x54E4, 0xD0F6, - 0x54E5, 0xADF4, 0x54E6, 0xAE40, 0x54E7, 0xD0F4, 0x54E8, 0xADEF, - 0x54E9, 0xADF9, 0x54EA, 0xADFE, 0x54EB, 0xD0FB, 0x54ED, 0xADFA, - 0x54EE, 0xADFD, 0x54F1, 0xD0FE, 0x54F2, 0xADF5, 0x54F3, 0xD0F5, - 0x54F7, 0xD142, 0x54F8, 0xD143, 0x54FA, 0xADF7, 0x54FB, 0xD141, - 0x54FC, 0xADF3, 0x54FD, 0xAE43, 0x54FF, 0xD0F8, 0x5501, 0xADF1, - 0x5503, 0xD146, 0x5504, 0xD0F9, 0x5505, 0xD0FD, 0x5506, 0xADF6, - 0x5507, 0xAE42, 0x5508, 0xD0FA, 0x5509, 0xADFC, 0x550A, 0xD140, - 0x550B, 0xD147, 0x550C, 0xD4A1, 0x550E, 0xD145, 0x550F, 0xAE44, - 0x5510, 0xADF0, 0x5511, 0xD0FC, 0x5512, 0xD0F3, 0x5514, 0xADF8, - 0x5517, 0xD0F2, 0x551A, 0xD0F7, 0x5526, 0xD0F0, 0x5527, 0xAE41, - 0x552A, 0xD477, 0x552C, 0xB0E4, 0x552D, 0xD4A7, 0x552E, 0xB0E2, - 0x552F, 0xB0DF, 0x5530, 0xD47C, 0x5531, 0xB0DB, 0x5532, 0xD4A2, - 0x5533, 0xB0E6, 0x5534, 0xD476, 0x5535, 0xD47B, 0x5536, 0xD47A, - 0x5537, 0xADF2, 0x5538, 0xB0E1, 0x5539, 0xD4A5, 0x553B, 0xD4A8, - 0x553C, 0xD473, 0x553E, 0xB3E8, 0x5540, 0xD4A9, 0x5541, 0xB0E7, - 0x5543, 0xB0D9, 0x5544, 0xB0D6, 0x5545, 0xD47E, 0x5546, 0xB0D3, - 0x5548, 0xD4A6, 0x554A, 0xB0DA, 0x554B, 0xD4AA, 0x554D, 0xD474, - 0x554E, 0xD4A4, 0x554F, 0xB0DD, 0x5550, 0xD475, 0x5551, 0xD478, - 0x5552, 0xD47D, 0x5555, 0xB0DE, 0x5556, 0xB0DC, 0x5557, 0xB0E8, - 0x555C, 0xB0E3, 0x555E, 0xB0D7, 0x555F, 0xB1D2, 0x5561, 0xB0D8, - 0x5562, 0xD479, 0x5563, 0xB0E5, 0x5564, 0xB0E0, 0x5565, 0xD4A3, - 0x5566, 0xB0D5, 0x556A, 0xB0D4, 0x5575, 0xD471, 0x5576, 0xD472, - 0x5577, 0xD86A, 0x557B, 0xB3D7, 0x557C, 0xB3DA, 0x557D, 0xD875, - 0x557E, 0xB3EE, 0x557F, 0xD878, 0x5580, 0xB3D8, 0x5581, 0xD871, - 0x5582, 0xB3DE, 0x5583, 0xB3E4, 0x5584, 0xB5BD, 0x5587, 0xB3E2, - 0x5588, 0xD86E, 0x5589, 0xB3EF, 0x558A, 0xB3DB, 0x558B, 0xB3E3, - 0x558C, 0xD876, 0x558D, 0xDCD7, 0x558E, 0xD87B, 0x558F, 0xD86F, - 0x5591, 0xD866, 0x5592, 0xD873, 0x5593, 0xD86D, 0x5594, 0xB3E1, - 0x5595, 0xD879, 0x5598, 0xB3DD, 0x5599, 0xB3F1, 0x559A, 0xB3EA, - 0x559C, 0xB3DF, 0x559D, 0xB3DC, 0x559F, 0xB3E7, 0x55A1, 0xD87A, - 0x55A2, 0xD86C, 0x55A3, 0xD872, 0x55A4, 0xD874, 0x55A5, 0xD868, - 0x55A6, 0xD877, 0x55A7, 0xB3D9, 0x55A8, 0xD867, 0x55AA, 0xB3E0, - 0x55AB, 0xB3F0, 0x55AC, 0xB3EC, 0x55AD, 0xD869, 0x55AE, 0xB3E6, - 0x55B1, 0xB3ED, 0x55B2, 0xB3E9, 0x55B3, 0xB3E5, 0x55B5, 0xD870, - 0x55BB, 0xB3EB, 0x55BF, 0xDCD5, 0x55C0, 0xDCD1, 0x55C2, 0xDCE0, - 0x55C3, 0xDCCA, 0x55C4, 0xDCD3, 0x55C5, 0xB6E5, 0x55C6, 0xB6E6, - 0x55C7, 0xB6DE, 0x55C8, 0xDCDC, 0x55C9, 0xB6E8, 0x55CA, 0xDCCF, - 0x55CB, 0xDCCE, 0x55CC, 0xDCCC, 0x55CD, 0xDCDE, 0x55CE, 0xB6DC, - 0x55CF, 0xDCD8, 0x55D0, 0xDCCD, 0x55D1, 0xB6DF, 0x55D2, 0xDCD6, - 0x55D3, 0xB6DA, 0x55D4, 0xDCD2, 0x55D5, 0xDCD9, 0x55D6, 0xDCDB, - 0x55D9, 0xDCDF, 0x55DA, 0xB6E3, 0x55DB, 0xDCCB, 0x55DC, 0xB6DD, - 0x55DD, 0xDCD0, 0x55DF, 0xB6D8, 0x55E1, 0xB6E4, 0x55E2, 0xDCDA, - 0x55E3, 0xB6E0, 0x55E4, 0xB6E1, 0x55E5, 0xB6E7, 0x55E6, 0xB6DB, - 0x55E7, 0xA25F, 0x55E8, 0xB6D9, 0x55E9, 0xDCD4, 0x55EF, 0xB6E2, - 0x55F2, 0xDCDD, 0x55F6, 0xB9CD, 0x55F7, 0xB9C8, 0x55F9, 0xE155, - 0x55FA, 0xE151, 0x55FC, 0xE14B, 0x55FD, 0xB9C2, 0x55FE, 0xB9BE, - 0x55FF, 0xE154, 0x5600, 0xB9BF, 0x5601, 0xE14E, 0x5602, 0xE150, - 0x5604, 0xE153, 0x5606, 0xB9C4, 0x5608, 0xB9CB, 0x5609, 0xB9C5, - 0x560C, 0xE149, 0x560D, 0xB9C6, 0x560E, 0xB9C7, 0x560F, 0xE14C, - 0x5610, 0xB9CC, 0x5612, 0xE14A, 0x5613, 0xE14F, 0x5614, 0xB9C3, - 0x5615, 0xE148, 0x5616, 0xB9C9, 0x5617, 0xB9C1, 0x561B, 0xB9C0, - 0x561C, 0xE14D, 0x561D, 0xE152, 0x561F, 0xB9CA, 0x5627, 0xE147, - 0x5629, 0xBC4D, 0x562A, 0xE547, 0x562C, 0xE544, 0x562E, 0xBC47, - 0x562F, 0xBC53, 0x5630, 0xBC54, 0x5632, 0xBC4A, 0x5633, 0xE542, - 0x5634, 0xBC4C, 0x5635, 0xE4F9, 0x5636, 0xBC52, 0x5638, 0xE546, - 0x5639, 0xBC49, 0x563A, 0xE548, 0x563B, 0xBC48, 0x563D, 0xE543, - 0x563E, 0xE545, 0x563F, 0xBC4B, 0x5640, 0xE541, 0x5641, 0xE4FA, - 0x5642, 0xE4F7, 0x5645, 0xD86B, 0x5646, 0xE4FD, 0x5648, 0xE4F6, - 0x5649, 0xE4FC, 0x564A, 0xE4FB, 0x564C, 0xE4F8, 0x564E, 0xBC4F, - 0x5653, 0xBC4E, 0x5657, 0xBC50, 0x5658, 0xE4FE, 0x5659, 0xBEB2, - 0x565A, 0xE540, 0x565E, 0xE945, 0x5660, 0xE8FD, 0x5662, 0xBEBE, - 0x5663, 0xE942, 0x5664, 0xBEB6, 0x5665, 0xBEBA, 0x5666, 0xE941, - 0x5668, 0xBEB9, 0x5669, 0xBEB5, 0x566A, 0xBEB8, 0x566B, 0xBEB3, - 0x566C, 0xBEBD, 0x566D, 0xE943, 0x566E, 0xE8FE, 0x566F, 0xBEBC, - 0x5670, 0xE8FC, 0x5671, 0xBEBB, 0x5672, 0xE944, 0x5673, 0xE940, - 0x5674, 0xBC51, 0x5676, 0xBEBF, 0x5677, 0xE946, 0x5678, 0xBEB7, - 0x5679, 0xBEB4, 0x567E, 0xECC6, 0x567F, 0xECC8, 0x5680, 0xC07B, - 0x5681, 0xECC9, 0x5682, 0xECC7, 0x5683, 0xECC5, 0x5684, 0xECC4, - 0x5685, 0xC07D, 0x5686, 0xECC3, 0x5687, 0xC07E, 0x568C, 0xECC1, - 0x568D, 0xECC2, 0x568E, 0xC07A, 0x568F, 0xC0A1, 0x5690, 0xC07C, - 0x5693, 0xECC0, 0x5695, 0xC250, 0x5697, 0xEFBC, 0x5698, 0xEFBA, - 0x5699, 0xEFBF, 0x569A, 0xEFBD, 0x569C, 0xEFBB, 0x569D, 0xEFBE, - 0x56A5, 0xC360, 0x56A6, 0xF1F2, 0x56A7, 0xF1F3, 0x56A8, 0xC456, - 0x56AA, 0xF1F4, 0x56AB, 0xF1F0, 0x56AC, 0xF1F5, 0x56AD, 0xF1F1, - 0x56AE, 0xC251, 0x56B2, 0xF3FE, 0x56B3, 0xF441, 0x56B4, 0xC459, - 0x56B5, 0xF440, 0x56B6, 0xC458, 0x56B7, 0xC457, 0x56BC, 0xC45A, - 0x56BD, 0xF5C5, 0x56BE, 0xF5C6, 0x56C0, 0xC4DA, 0x56C1, 0xC4D9, - 0x56C2, 0xC4DB, 0x56C3, 0xF5C4, 0x56C5, 0xF6D8, 0x56C6, 0xF6D7, - 0x56C8, 0xC56D, 0x56C9, 0xC56F, 0x56CA, 0xC56E, 0x56CB, 0xF6D9, - 0x56CC, 0xC5C8, 0x56CD, 0xF8A6, 0x56D1, 0xC5F1, 0x56D3, 0xF8A5, - 0x56D4, 0xF8EE, 0x56D7, 0xC949, 0x56DA, 0xA57D, 0x56DB, 0xA57C, - 0x56DD, 0xA65F, 0x56DE, 0xA65E, 0x56DF, 0xC9C7, 0x56E0, 0xA65D, - 0x56E1, 0xC9C6, 0x56E4, 0xA779, 0x56E5, 0xCAA9, 0x56E7, 0xCAA8, - 0x56EA, 0xA777, 0x56EB, 0xA77A, 0x56EE, 0xCAA7, 0x56F0, 0xA778, - 0x56F7, 0xCBF0, 0x56F9, 0xCBF1, 0x56FA, 0xA954, 0x56FF, 0xABAA, - 0x5701, 0xD148, 0x5702, 0xD149, 0x5703, 0xAE45, 0x5704, 0xAE46, - 0x5707, 0xD4AC, 0x5708, 0xB0E9, 0x5709, 0xB0EB, 0x570A, 0xD4AB, - 0x570B, 0xB0EA, 0x570C, 0xD87C, 0x570D, 0xB3F2, 0x5712, 0xB6E9, - 0x5713, 0xB6EA, 0x5714, 0xDCE1, 0x5716, 0xB9CF, 0x5718, 0xB9CE, - 0x571A, 0xE549, 0x571B, 0xE948, 0x571C, 0xE947, 0x571E, 0xF96B, - 0x571F, 0xA467, 0x5720, 0xC959, 0x5722, 0xC96E, 0x5723, 0xC96F, - 0x5728, 0xA662, 0x5729, 0xA666, 0x572A, 0xC9C9, 0x572C, 0xA664, - 0x572D, 0xA663, 0x572E, 0xC9C8, 0x572F, 0xA665, 0x5730, 0xA661, - 0x5733, 0xA660, 0x5734, 0xC9CA, 0x573B, 0xA7A6, 0x573E, 0xA7A3, - 0x5740, 0xA77D, 0x5741, 0xCAAA, 0x5745, 0xCAAB, 0x5747, 0xA7A1, - 0x5749, 0xCAAD, 0x574A, 0xA77B, 0x574B, 0xCAAE, 0x574C, 0xCAAC, - 0x574D, 0xA77E, 0x574E, 0xA7A2, 0x574F, 0xA7A5, 0x5750, 0xA7A4, - 0x5751, 0xA77C, 0x5752, 0xCAAF, 0x5761, 0xA959, 0x5762, 0xCBFE, - 0x5764, 0xA95B, 0x5766, 0xA95A, 0x5768, 0xCC40, 0x5769, 0xA958, - 0x576A, 0xA957, 0x576B, 0xCBF5, 0x576D, 0xCBF4, 0x576F, 0xCBF2, - 0x5770, 0xCBF7, 0x5771, 0xCBF6, 0x5772, 0xCBF3, 0x5773, 0xCBFC, - 0x5774, 0xCBFD, 0x5775, 0xCBFA, 0x5776, 0xCBF8, 0x5777, 0xA956, - 0x577B, 0xCBFB, 0x577C, 0xA95C, 0x577D, 0xCC41, 0x5780, 0xCBF9, - 0x5782, 0xABAB, 0x5783, 0xA955, 0x578B, 0xABAC, 0x578C, 0xCE54, - 0x578F, 0xCE5A, 0x5793, 0xABB2, 0x5794, 0xCE58, 0x5795, 0xCE5E, - 0x5797, 0xCE55, 0x5798, 0xCE59, 0x5799, 0xCE5B, 0x579A, 0xCE5D, - 0x579B, 0xCE57, 0x579D, 0xCE56, 0x579E, 0xCE51, 0x579F, 0xCE52, - 0x57A0, 0xABAD, 0x57A2, 0xABAF, 0x57A3, 0xABAE, 0x57A4, 0xCE53, - 0x57A5, 0xCE5C, 0x57AE, 0xABB1, 0x57B5, 0xCE50, 0x57B6, 0xD153, - 0x57B8, 0xD152, 0x57B9, 0xD157, 0x57BA, 0xD14E, 0x57BC, 0xD151, - 0x57BD, 0xD150, 0x57BF, 0xD154, 0x57C1, 0xD158, 0x57C2, 0xAE47, - 0x57C3, 0xAE4A, 0x57C6, 0xD14F, 0x57C7, 0xD155, 0x57CB, 0xAE49, - 0x57CC, 0xD14A, 0x57CE, 0xABB0, 0x57CF, 0xD4BA, 0x57D0, 0xD156, - 0x57D2, 0xD14D, 0x57D4, 0xAE48, 0x57D5, 0xD14C, 0x57DC, 0xD4B1, - 0x57DF, 0xB0EC, 0x57E0, 0xB0F0, 0x57E1, 0xD4C1, 0x57E2, 0xD4AF, - 0x57E3, 0xD4BD, 0x57E4, 0xB0F1, 0x57E5, 0xD4BF, 0x57E7, 0xD4C5, - 0x57E9, 0xD4C9, 0x57EC, 0xD4C0, 0x57ED, 0xD4B4, 0x57EE, 0xD4BC, - 0x57F0, 0xD4CA, 0x57F1, 0xD4C8, 0x57F2, 0xD4BE, 0x57F3, 0xD4B9, - 0x57F4, 0xD4B2, 0x57F5, 0xD8A6, 0x57F6, 0xD4B0, 0x57F7, 0xB0F5, - 0x57F8, 0xD4B7, 0x57F9, 0xB0F6, 0x57FA, 0xB0F2, 0x57FB, 0xD4AD, - 0x57FC, 0xD4C3, 0x57FD, 0xD4B5, 0x5800, 0xD4B3, 0x5801, 0xD4C6, - 0x5802, 0xB0F3, 0x5804, 0xD4CC, 0x5805, 0xB0ED, 0x5806, 0xB0EF, - 0x5807, 0xD4BB, 0x5808, 0xD4B6, 0x5809, 0xAE4B, 0x580A, 0xB0EE, - 0x580B, 0xD4B8, 0x580C, 0xD4C7, 0x580D, 0xD4CB, 0x580E, 0xD4C2, - 0x5810, 0xD4C4, 0x5814, 0xD4AE, 0x5819, 0xD8A1, 0x581B, 0xD8AA, - 0x581C, 0xD8A9, 0x581D, 0xB3FA, 0x581E, 0xD8A2, 0x5820, 0xB3FB, - 0x5821, 0xB3F9, 0x5823, 0xD8A4, 0x5824, 0xB3F6, 0x5825, 0xD8A8, - 0x5827, 0xD8A3, 0x5828, 0xD8A5, 0x5829, 0xD87D, 0x582A, 0xB3F4, - 0x582C, 0xD8B2, 0x582D, 0xD8B1, 0x582E, 0xD8AE, 0x582F, 0xB3F3, - 0x5830, 0xB3F7, 0x5831, 0xB3F8, 0x5832, 0xD14B, 0x5833, 0xD8AB, - 0x5834, 0xB3F5, 0x5835, 0xB0F4, 0x5836, 0xD8AD, 0x5837, 0xD87E, - 0x5838, 0xD8B0, 0x5839, 0xD8AF, 0x583B, 0xD8B3, 0x583D, 0xDCEF, - 0x583F, 0xD8AC, 0x5848, 0xD8A7, 0x5849, 0xDCE7, 0x584A, 0xB6F4, - 0x584B, 0xB6F7, 0x584C, 0xB6F2, 0x584D, 0xDCE6, 0x584E, 0xDCEA, - 0x584F, 0xDCE5, 0x5851, 0xB6EC, 0x5852, 0xB6F6, 0x5853, 0xDCE2, - 0x5854, 0xB6F0, 0x5855, 0xDCE9, 0x5857, 0xB6EE, 0x5858, 0xB6ED, - 0x5859, 0xDCEC, 0x585A, 0xB6EF, 0x585B, 0xDCEE, 0x585D, 0xDCEB, - 0x585E, 0xB6EB, 0x5862, 0xB6F5, 0x5863, 0xDCF0, 0x5864, 0xDCE4, - 0x5865, 0xDCED, 0x5868, 0xDCE3, 0x586B, 0xB6F1, 0x586D, 0xB6F3, - 0x586F, 0xDCE8, 0x5871, 0xDCF1, 0x5874, 0xE15D, 0x5875, 0xB9D0, - 0x5876, 0xE163, 0x5879, 0xB9D5, 0x587A, 0xE15F, 0x587B, 0xE166, - 0x587C, 0xE157, 0x587D, 0xB9D7, 0x587E, 0xB9D1, 0x587F, 0xE15C, - 0x5880, 0xBC55, 0x5881, 0xE15B, 0x5882, 0xE164, 0x5883, 0xB9D2, - 0x5885, 0xB9D6, 0x5886, 0xE15A, 0x5887, 0xE160, 0x5888, 0xE165, - 0x5889, 0xE156, 0x588A, 0xB9D4, 0x588B, 0xE15E, 0x588E, 0xE162, - 0x588F, 0xE168, 0x5890, 0xE158, 0x5891, 0xE161, 0x5893, 0xB9D3, - 0x5894, 0xE167, 0x5898, 0xE159, 0x589C, 0xBC59, 0x589D, 0xE54B, - 0x589E, 0xBC57, 0x589F, 0xBC56, 0x58A0, 0xE54D, 0x58A1, 0xE552, - 0x58A3, 0xE54E, 0x58A5, 0xE551, 0x58A6, 0xBC5C, 0x58A8, 0xBEA5, - 0x58A9, 0xBC5B, 0x58AB, 0xE54A, 0x58AC, 0xE550, 0x58AE, 0xBC5A, - 0x58AF, 0xE54F, 0x58B1, 0xE54C, 0x58B3, 0xBC58, 0x58BA, 0xE94D, - 0x58BB, 0xF9D9, 0x58BC, 0xE94F, 0x58BD, 0xE94A, 0x58BE, 0xBEC1, - 0x58BF, 0xE94C, 0x58C1, 0xBEC0, 0x58C2, 0xE94E, 0x58C5, 0xBEC3, - 0x58C6, 0xE950, 0x58C7, 0xBEC2, 0x58C8, 0xE949, 0x58C9, 0xE94B, - 0x58CE, 0xC0A5, 0x58CF, 0xECCC, 0x58D1, 0xC0A4, 0x58D2, 0xECCD, - 0x58D3, 0xC0A3, 0x58D4, 0xECCB, 0x58D5, 0xC0A2, 0x58D6, 0xECCA, - 0x58D8, 0xC253, 0x58D9, 0xC252, 0x58DA, 0xF1F6, 0x58DB, 0xF1F8, - 0x58DD, 0xF1F7, 0x58DE, 0xC361, 0x58DF, 0xC362, 0x58E2, 0xC363, - 0x58E3, 0xF442, 0x58E4, 0xC45B, 0x58E7, 0xF7D3, 0x58E8, 0xF7D2, - 0x58E9, 0xC5F2, 0x58EB, 0xA468, 0x58EC, 0xA4D0, 0x58EF, 0xA7A7, - 0x58F4, 0xCE5F, 0x58F9, 0xB3FC, 0x58FA, 0xB3FD, 0x58FC, 0xDCF2, - 0x58FD, 0xB9D8, 0x58FE, 0xE169, 0x58FF, 0xE553, 0x5903, 0xC95A, - 0x5906, 0xCAB0, 0x590C, 0xCC42, 0x590D, 0xCE60, 0x590E, 0xD159, - 0x590F, 0xAE4C, 0x5912, 0xF1F9, 0x5914, 0xC4DC, 0x5915, 0xA469, - 0x5916, 0xA57E, 0x5917, 0xC970, 0x5919, 0xA667, 0x591A, 0xA668, - 0x591C, 0xA95D, 0x5920, 0xB0F7, 0x5922, 0xB9DA, 0x5924, 0xB9DB, - 0x5925, 0xB9D9, 0x5927, 0xA46A, 0x5929, 0xA4D1, 0x592A, 0xA4D3, - 0x592B, 0xA4D2, 0x592C, 0xC95B, 0x592D, 0xA4D4, 0x592E, 0xA5A1, - 0x592F, 0xC971, 0x5931, 0xA5A2, 0x5937, 0xA669, 0x5938, 0xA66A, - 0x593C, 0xC9CB, 0x593E, 0xA7A8, 0x5940, 0xCAB1, 0x5944, 0xA961, - 0x5945, 0xCC43, 0x5947, 0xA95F, 0x5948, 0xA960, 0x5949, 0xA95E, - 0x594A, 0xD15A, 0x594E, 0xABB6, 0x594F, 0xABB5, 0x5950, 0xABB7, - 0x5951, 0xABB4, 0x5953, 0xCE61, 0x5954, 0xA962, 0x5955, 0xABB3, - 0x5957, 0xAE4D, 0x5958, 0xAE4E, 0x595A, 0xAE4F, 0x595C, 0xD4CD, - 0x5960, 0xB3FE, 0x5961, 0xD8B4, 0x5962, 0xB0F8, 0x5967, 0xB6F8, - 0x5969, 0xB9DD, 0x596A, 0xB9DC, 0x596B, 0xE16A, 0x596D, 0xBC5D, - 0x596E, 0xBEC4, 0x5970, 0xEFC0, 0x5971, 0xF6DA, 0x5972, 0xF7D4, - 0x5973, 0xA46B, 0x5974, 0xA5A3, 0x5976, 0xA5A4, 0x5977, 0xC9D1, - 0x5978, 0xA66C, 0x5979, 0xA66F, 0x597B, 0xC9CF, 0x597C, 0xC9CD, - 0x597D, 0xA66E, 0x597E, 0xC9D0, 0x597F, 0xC9D2, 0x5980, 0xC9CC, - 0x5981, 0xA671, 0x5982, 0xA670, 0x5983, 0xA66D, 0x5984, 0xA66B, - 0x5985, 0xC9CE, 0x598A, 0xA7B3, 0x598D, 0xA7B0, 0x598E, 0xCAB6, - 0x598F, 0xCAB9, 0x5990, 0xCAB8, 0x5992, 0xA7AA, 0x5993, 0xA7B2, - 0x5996, 0xA7AF, 0x5997, 0xCAB5, 0x5998, 0xCAB3, 0x5999, 0xA7AE, - 0x599D, 0xA7A9, 0x599E, 0xA7AC, 0x59A0, 0xCAB4, 0x59A1, 0xCABB, - 0x59A2, 0xCAB7, 0x59A3, 0xA7AD, 0x59A4, 0xA7B1, 0x59A5, 0xA7B4, - 0x59A6, 0xCAB2, 0x59A7, 0xCABA, 0x59A8, 0xA7AB, 0x59AE, 0xA967, - 0x59AF, 0xA96F, 0x59B1, 0xCC4F, 0x59B2, 0xCC48, 0x59B3, 0xA970, - 0x59B4, 0xCC53, 0x59B5, 0xCC44, 0x59B6, 0xCC4B, 0x59B9, 0xA966, - 0x59BA, 0xCC45, 0x59BB, 0xA964, 0x59BC, 0xCC4C, 0x59BD, 0xCC50, - 0x59BE, 0xA963, 0x59C0, 0xCC51, 0x59C1, 0xCC4A, 0x59C3, 0xCC4D, - 0x59C5, 0xA972, 0x59C6, 0xA969, 0x59C7, 0xCC54, 0x59C8, 0xCC52, - 0x59CA, 0xA96E, 0x59CB, 0xA96C, 0x59CC, 0xCC49, 0x59CD, 0xA96B, - 0x59CE, 0xCC47, 0x59CF, 0xCC46, 0x59D0, 0xA96A, 0x59D1, 0xA968, - 0x59D2, 0xA971, 0x59D3, 0xA96D, 0x59D4, 0xA965, 0x59D6, 0xCC4E, - 0x59D8, 0xABB9, 0x59DA, 0xABC0, 0x59DB, 0xCE6F, 0x59DC, 0xABB8, - 0x59DD, 0xCE67, 0x59DE, 0xCE63, 0x59E0, 0xCE73, 0x59E1, 0xCE62, - 0x59E3, 0xABBB, 0x59E4, 0xCE6C, 0x59E5, 0xABBE, 0x59E6, 0xABC1, - 0x59E8, 0xABBC, 0x59E9, 0xCE70, 0x59EA, 0xABBF, 0x59EC, 0xAE56, - 0x59ED, 0xCE76, 0x59EE, 0xCE64, 0x59F1, 0xCE66, 0x59F2, 0xCE6D, - 0x59F3, 0xCE71, 0x59F4, 0xCE75, 0x59F5, 0xCE72, 0x59F6, 0xCE6B, - 0x59F7, 0xCE6E, 0x59FA, 0xCE68, 0x59FB, 0xABC3, 0x59FC, 0xCE6A, - 0x59FD, 0xCE69, 0x59FE, 0xCE74, 0x59FF, 0xABBA, 0x5A00, 0xCE65, - 0x5A01, 0xABC2, 0x5A03, 0xABBD, 0x5A09, 0xAE5C, 0x5A0A, 0xD162, - 0x5A0C, 0xAE5B, 0x5A0F, 0xD160, 0x5A11, 0xAE50, 0x5A13, 0xAE55, - 0x5A15, 0xD15F, 0x5A16, 0xD15C, 0x5A17, 0xD161, 0x5A18, 0xAE51, - 0x5A19, 0xD15B, 0x5A1B, 0xAE54, 0x5A1C, 0xAE52, 0x5A1E, 0xD163, - 0x5A1F, 0xAE53, 0x5A20, 0xAE57, 0x5A23, 0xAE58, 0x5A25, 0xAE5A, - 0x5A29, 0xAE59, 0x5A2D, 0xD15D, 0x5A2E, 0xD15E, 0x5A33, 0xD164, - 0x5A35, 0xD4D4, 0x5A36, 0xB0F9, 0x5A37, 0xD8C2, 0x5A38, 0xD4D3, - 0x5A39, 0xD4E6, 0x5A3C, 0xB140, 0x5A3E, 0xD4E4, 0x5A40, 0xB0FE, - 0x5A41, 0xB0FA, 0x5A42, 0xD4ED, 0x5A43, 0xD4DD, 0x5A44, 0xD4E0, - 0x5A46, 0xB143, 0x5A47, 0xD4EA, 0x5A48, 0xD4E2, 0x5A49, 0xB0FB, - 0x5A4A, 0xB144, 0x5A4C, 0xD4E7, 0x5A4D, 0xD4E5, 0x5A50, 0xD4D6, - 0x5A51, 0xD4EB, 0x5A52, 0xD4DF, 0x5A53, 0xD4DA, 0x5A55, 0xD4D0, - 0x5A56, 0xD4EC, 0x5A57, 0xD4DC, 0x5A58, 0xD4CF, 0x5A5A, 0xB142, - 0x5A5B, 0xD4E1, 0x5A5C, 0xD4EE, 0x5A5D, 0xD4DE, 0x5A5E, 0xD4D2, - 0x5A5F, 0xD4D7, 0x5A60, 0xD4CE, 0x5A62, 0xB141, 0x5A64, 0xD4DB, - 0x5A65, 0xD4D8, 0x5A66, 0xB0FC, 0x5A67, 0xD4D1, 0x5A69, 0xD4E9, - 0x5A6A, 0xB0FD, 0x5A6C, 0xD4D9, 0x5A6D, 0xD4D5, 0x5A70, 0xD4E8, - 0x5A77, 0xB440, 0x5A78, 0xD8BB, 0x5A7A, 0xD8B8, 0x5A7B, 0xD8C9, - 0x5A7C, 0xD8BD, 0x5A7D, 0xD8CA, 0x5A7F, 0xB442, 0x5A83, 0xD8C6, - 0x5A84, 0xD8C3, 0x5A8A, 0xD8C4, 0x5A8B, 0xD8C7, 0x5A8C, 0xD8CB, - 0x5A8E, 0xD4E3, 0x5A8F, 0xD8CD, 0x5A90, 0xDD47, 0x5A92, 0xB443, - 0x5A93, 0xD8CE, 0x5A94, 0xD8B6, 0x5A95, 0xD8C0, 0x5A97, 0xD8C5, - 0x5A9A, 0xB441, 0x5A9B, 0xB444, 0x5A9C, 0xD8CC, 0x5A9D, 0xD8CF, - 0x5A9E, 0xD8BA, 0x5A9F, 0xD8B7, 0x5AA2, 0xD8B9, 0x5AA5, 0xD8BE, - 0x5AA6, 0xD8BC, 0x5AA7, 0xB445, 0x5AA9, 0xD8C8, 0x5AAC, 0xD8BF, - 0x5AAE, 0xD8C1, 0x5AAF, 0xD8B5, 0x5AB0, 0xDCFA, 0x5AB1, 0xDCF8, - 0x5AB2, 0xB742, 0x5AB3, 0xB740, 0x5AB4, 0xDD43, 0x5AB5, 0xDCF9, - 0x5AB6, 0xDD44, 0x5AB7, 0xDD40, 0x5AB8, 0xDCF7, 0x5AB9, 0xDD46, - 0x5ABA, 0xDCF6, 0x5ABB, 0xDCFD, 0x5ABC, 0xB6FE, 0x5ABD, 0xB6FD, - 0x5ABE, 0xB6FC, 0x5ABF, 0xDCFB, 0x5AC0, 0xDD41, 0x5AC1, 0xB6F9, - 0x5AC2, 0xB741, 0x5AC4, 0xDCF4, 0x5AC6, 0xDCFE, 0x5AC7, 0xDCF3, - 0x5AC8, 0xDCFC, 0x5AC9, 0xB6FA, 0x5ACA, 0xDD42, 0x5ACB, 0xDCF5, - 0x5ACC, 0xB6FB, 0x5ACD, 0xDD45, 0x5AD5, 0xE16E, 0x5AD6, 0xB9E2, - 0x5AD7, 0xB9E1, 0x5AD8, 0xB9E3, 0x5AD9, 0xE17A, 0x5ADA, 0xE170, - 0x5ADB, 0xE176, 0x5ADC, 0xE16B, 0x5ADD, 0xE179, 0x5ADE, 0xE178, - 0x5ADF, 0xE17C, 0x5AE0, 0xE175, 0x5AE1, 0xB9DE, 0x5AE2, 0xE174, - 0x5AE3, 0xB9E4, 0x5AE5, 0xE16D, 0x5AE6, 0xB9DF, 0x5AE8, 0xE17B, - 0x5AE9, 0xB9E0, 0x5AEA, 0xE16F, 0x5AEB, 0xE172, 0x5AEC, 0xE177, - 0x5AED, 0xE171, 0x5AEE, 0xE16C, 0x5AF3, 0xE173, 0x5AF4, 0xE555, - 0x5AF5, 0xBC61, 0x5AF6, 0xE558, 0x5AF7, 0xE557, 0x5AF8, 0xE55A, - 0x5AF9, 0xE55C, 0x5AFA, 0xF9DC, 0x5AFB, 0xBC5F, 0x5AFD, 0xE556, - 0x5AFF, 0xE554, 0x5B01, 0xE55D, 0x5B02, 0xE55B, 0x5B03, 0xE559, - 0x5B05, 0xE55F, 0x5B07, 0xE55E, 0x5B08, 0xBC63, 0x5B09, 0xBC5E, - 0x5B0B, 0xBC60, 0x5B0C, 0xBC62, 0x5B0F, 0xE560, 0x5B10, 0xE957, - 0x5B13, 0xE956, 0x5B14, 0xE955, 0x5B16, 0xE958, 0x5B17, 0xE951, - 0x5B19, 0xE952, 0x5B1A, 0xE95A, 0x5B1B, 0xE953, 0x5B1D, 0xBEC5, - 0x5B1E, 0xE95C, 0x5B20, 0xE95B, 0x5B21, 0xE954, 0x5B23, 0xECD1, - 0x5B24, 0xC0A8, 0x5B25, 0xECCF, 0x5B26, 0xECD4, 0x5B27, 0xECD3, - 0x5B28, 0xE959, 0x5B2A, 0xC0A7, 0x5B2C, 0xECD2, 0x5B2D, 0xECCE, - 0x5B2E, 0xECD6, 0x5B2F, 0xECD5, 0x5B30, 0xC0A6, 0x5B32, 0xECD0, - 0x5B34, 0xBEC6, 0x5B38, 0xC254, 0x5B3C, 0xEFC1, 0x5B3D, 0xF1FA, - 0x5B3E, 0xF1FB, 0x5B3F, 0xF1FC, 0x5B40, 0xC45C, 0x5B43, 0xC45D, - 0x5B45, 0xF443, 0x5B47, 0xF5C8, 0x5B48, 0xF5C7, 0x5B4B, 0xF6DB, - 0x5B4C, 0xF6DC, 0x5B4D, 0xF7D5, 0x5B4E, 0xF8A7, 0x5B50, 0xA46C, - 0x5B51, 0xA46D, 0x5B53, 0xA46E, 0x5B54, 0xA4D5, 0x5B55, 0xA5A5, - 0x5B56, 0xC9D3, 0x5B57, 0xA672, 0x5B58, 0xA673, 0x5B5A, 0xA7B7, - 0x5B5B, 0xA7B8, 0x5B5C, 0xA7B6, 0x5B5D, 0xA7B5, 0x5B5F, 0xA973, - 0x5B62, 0xCC55, 0x5B63, 0xA975, 0x5B64, 0xA974, 0x5B65, 0xCC56, - 0x5B69, 0xABC4, 0x5B6B, 0xAE5D, 0x5B6C, 0xD165, 0x5B6E, 0xD4F0, - 0x5B70, 0xB145, 0x5B71, 0xB447, 0x5B72, 0xD4EF, 0x5B73, 0xB446, - 0x5B75, 0xB9E5, 0x5B77, 0xE17D, 0x5B78, 0xBEC7, 0x5B7A, 0xC0A9, - 0x5B7B, 0xECD7, 0x5B7D, 0xC45E, 0x5B7F, 0xC570, 0x5B81, 0xC972, - 0x5B83, 0xA5A6, 0x5B84, 0xC973, 0x5B85, 0xA676, 0x5B87, 0xA674, - 0x5B88, 0xA675, 0x5B89, 0xA677, 0x5B8B, 0xA7BA, 0x5B8C, 0xA7B9, - 0x5B8E, 0xCABC, 0x5B8F, 0xA7BB, 0x5B92, 0xCABD, 0x5B93, 0xCC57, - 0x5B95, 0xCC58, 0x5B97, 0xA976, 0x5B98, 0xA978, 0x5B99, 0xA97A, - 0x5B9A, 0xA977, 0x5B9B, 0xA97B, 0x5B9C, 0xA979, 0x5BA2, 0xABC8, - 0x5BA3, 0xABC5, 0x5BA4, 0xABC7, 0x5BA5, 0xABC9, 0x5BA6, 0xABC6, - 0x5BA7, 0xD166, 0x5BA8, 0xCE77, 0x5BAC, 0xD168, 0x5BAD, 0xD167, - 0x5BAE, 0xAE63, 0x5BB0, 0xAE5F, 0x5BB3, 0xAE60, 0x5BB4, 0xAE62, - 0x5BB5, 0xAE64, 0x5BB6, 0xAE61, 0x5BB8, 0xAE66, 0x5BB9, 0xAE65, - 0x5BBF, 0xB14A, 0x5BC0, 0xD4F2, 0x5BC1, 0xD4F1, 0x5BC2, 0xB149, - 0x5BC4, 0xB148, 0x5BC5, 0xB147, 0x5BC6, 0xB14B, 0x5BC7, 0xB146, - 0x5BCA, 0xD8D5, 0x5BCB, 0xD8D2, 0x5BCC, 0xB449, 0x5BCD, 0xD8D1, - 0x5BCE, 0xD8D6, 0x5BD0, 0xB44B, 0x5BD1, 0xD8D4, 0x5BD2, 0xB448, - 0x5BD3, 0xB44A, 0x5BD4, 0xD8D3, 0x5BD6, 0xDD48, 0x5BD8, 0xDD49, - 0x5BD9, 0xDD4A, 0x5BDE, 0xB9E6, 0x5BDF, 0xB9EE, 0x5BE0, 0xE17E, - 0x5BE1, 0xB9E8, 0x5BE2, 0xB9EC, 0x5BE3, 0xE1A1, 0x5BE4, 0xB9ED, - 0x5BE5, 0xB9E9, 0x5BE6, 0xB9EA, 0x5BE7, 0xB9E7, 0x5BE8, 0xB9EB, - 0x5BE9, 0xBC66, 0x5BEA, 0xD8D0, 0x5BEB, 0xBC67, 0x5BEC, 0xBC65, - 0x5BEE, 0xBC64, 0x5BEF, 0xE95D, 0x5BF0, 0xBEC8, 0x5BF1, 0xECD8, - 0x5BF2, 0xECD9, 0x5BF5, 0xC364, 0x5BF6, 0xC45F, 0x5BF8, 0xA46F, - 0x5BFA, 0xA678, 0x5C01, 0xABCA, 0x5C03, 0xD169, 0x5C04, 0xAE67, - 0x5C07, 0xB14E, 0x5C08, 0xB14D, 0x5C09, 0xB14C, 0x5C0A, 0xB44C, - 0x5C0B, 0xB44D, 0x5C0C, 0xD8D7, 0x5C0D, 0xB9EF, 0x5C0E, 0xBEC9, - 0x5C0F, 0xA470, 0x5C10, 0xC95C, 0x5C11, 0xA4D6, 0x5C12, 0xC974, - 0x5C15, 0xC9D4, 0x5C16, 0xA679, 0x5C1A, 0xA97C, 0x5C1F, 0xDD4B, - 0x5C22, 0xA471, 0x5C24, 0xA4D7, 0x5C25, 0xC9D5, 0x5C28, 0xCABE, - 0x5C2A, 0xCABF, 0x5C2C, 0xA7BC, 0x5C30, 0xD8D8, 0x5C31, 0xB44E, - 0x5C33, 0xDD4C, 0x5C37, 0xC0AA, 0x5C38, 0xA472, 0x5C39, 0xA4A8, - 0x5C3A, 0xA4D8, 0x5C3B, 0xC975, 0x5C3C, 0xA5A7, 0x5C3E, 0xA7C0, - 0x5C3F, 0xA7BF, 0x5C40, 0xA7BD, 0x5C41, 0xA7BE, 0x5C44, 0xCC59, - 0x5C45, 0xA97E, 0x5C46, 0xA9A1, 0x5C47, 0xCC5A, 0x5C48, 0xA97D, - 0x5C4B, 0xABCE, 0x5C4C, 0xCE78, 0x5C4D, 0xABCD, 0x5C4E, 0xABCB, - 0x5C4F, 0xABCC, 0x5C50, 0xAE6A, 0x5C51, 0xAE68, 0x5C54, 0xD16B, - 0x5C55, 0xAE69, 0x5C56, 0xD16A, 0x5C58, 0xAE5E, 0x5C59, 0xD4F3, - 0x5C5C, 0xB150, 0x5C5D, 0xB151, 0x5C60, 0xB14F, 0x5C62, 0xB9F0, - 0x5C63, 0xE1A2, 0x5C64, 0xBC68, 0x5C65, 0xBC69, 0x5C67, 0xE561, - 0x5C68, 0xC0AB, 0x5C69, 0xEFC2, 0x5C6A, 0xEFC3, 0x5C6C, 0xC4DD, - 0x5C6D, 0xF8A8, 0x5C6E, 0xC94B, 0x5C6F, 0xA4D9, 0x5C71, 0xA473, - 0x5C73, 0xC977, 0x5C74, 0xC976, 0x5C79, 0xA67A, 0x5C7A, 0xC9D7, - 0x5C7B, 0xC9D8, 0x5C7C, 0xC9D6, 0x5C7E, 0xC9D9, 0x5C86, 0xCAC7, - 0x5C88, 0xCAC2, 0x5C89, 0xCAC4, 0x5C8A, 0xCAC6, 0x5C8B, 0xCAC3, - 0x5C8C, 0xA7C4, 0x5C8D, 0xCAC0, 0x5C8F, 0xCAC1, 0x5C90, 0xA7C1, - 0x5C91, 0xA7C2, 0x5C92, 0xCAC5, 0x5C93, 0xCAC8, 0x5C94, 0xA7C3, - 0x5C95, 0xCAC9, 0x5C9D, 0xCC68, 0x5C9F, 0xCC62, 0x5CA0, 0xCC5D, - 0x5CA1, 0xA9A3, 0x5CA2, 0xCC65, 0x5CA3, 0xCC63, 0x5CA4, 0xCC5C, - 0x5CA5, 0xCC69, 0x5CA6, 0xCC6C, 0x5CA7, 0xCC67, 0x5CA8, 0xCC60, - 0x5CA9, 0xA9A5, 0x5CAA, 0xCC66, 0x5CAB, 0xA9A6, 0x5CAC, 0xCC61, - 0x5CAD, 0xCC64, 0x5CAE, 0xCC5B, 0x5CAF, 0xCC5F, 0x5CB0, 0xCC6B, - 0x5CB1, 0xA9A7, 0x5CB3, 0xA9A8, 0x5CB5, 0xCC5E, 0x5CB6, 0xCC6A, - 0x5CB7, 0xA9A2, 0x5CB8, 0xA9A4, 0x5CC6, 0xCEAB, 0x5CC7, 0xCEA4, - 0x5CC8, 0xCEAA, 0x5CC9, 0xCEA3, 0x5CCA, 0xCEA5, 0x5CCB, 0xCE7D, - 0x5CCC, 0xCE7B, 0x5CCE, 0xCEAC, 0x5CCF, 0xCEA9, 0x5CD0, 0xCE79, - 0x5CD2, 0xABD0, 0x5CD3, 0xCEA7, 0x5CD4, 0xCEA8, 0x5CD6, 0xCEA6, - 0x5CD7, 0xCE7C, 0x5CD8, 0xCE7A, 0x5CD9, 0xABCF, 0x5CDA, 0xCEA2, - 0x5CDB, 0xCE7E, 0x5CDE, 0xCEA1, 0x5CDF, 0xCEAD, 0x5CE8, 0xAE6F, - 0x5CEA, 0xAE6E, 0x5CEC, 0xD16C, 0x5CED, 0xAE6B, 0x5CEE, 0xD16E, - 0x5CF0, 0xAE70, 0x5CF1, 0xD16F, 0x5CF4, 0xAE73, 0x5CF6, 0xAE71, - 0x5CF7, 0xD170, 0x5CF8, 0xCEAE, 0x5CF9, 0xD172, 0x5CFB, 0xAE6D, - 0x5CFD, 0xAE6C, 0x5CFF, 0xD16D, 0x5D00, 0xD171, 0x5D01, 0xAE72, - 0x5D06, 0xB153, 0x5D07, 0xB152, 0x5D0B, 0xD4F5, 0x5D0C, 0xD4F9, - 0x5D0D, 0xD4FB, 0x5D0E, 0xB154, 0x5D0F, 0xD4FE, 0x5D11, 0xB158, - 0x5D12, 0xD541, 0x5D14, 0xB15A, 0x5D16, 0xB156, 0x5D17, 0xB15E, - 0x5D19, 0xB15B, 0x5D1A, 0xD4F7, 0x5D1B, 0xB155, 0x5D1D, 0xD4F6, - 0x5D1E, 0xD4F4, 0x5D1F, 0xD543, 0x5D20, 0xD4F8, 0x5D22, 0xB157, - 0x5D23, 0xD542, 0x5D24, 0xB15C, 0x5D25, 0xD4FD, 0x5D26, 0xD4FC, - 0x5D27, 0xB15D, 0x5D28, 0xD4FA, 0x5D29, 0xB159, 0x5D2E, 0xD544, - 0x5D30, 0xD540, 0x5D31, 0xD8E7, 0x5D32, 0xD8EE, 0x5D33, 0xD8E3, - 0x5D34, 0xB451, 0x5D35, 0xD8DF, 0x5D36, 0xD8EF, 0x5D37, 0xD8D9, - 0x5D38, 0xD8EC, 0x5D39, 0xD8EA, 0x5D3A, 0xD8E4, 0x5D3C, 0xD8ED, - 0x5D3D, 0xD8E6, 0x5D3F, 0xD8DE, 0x5D40, 0xD8F0, 0x5D41, 0xD8DC, - 0x5D42, 0xD8E9, 0x5D43, 0xD8DA, 0x5D45, 0xD8F1, 0x5D47, 0xB452, - 0x5D49, 0xD8EB, 0x5D4A, 0xDD4F, 0x5D4B, 0xD8DD, 0x5D4C, 0xB44F, - 0x5D4E, 0xD8E1, 0x5D50, 0xB450, 0x5D51, 0xD8E0, 0x5D52, 0xD8E5, - 0x5D55, 0xD8E2, 0x5D59, 0xD8E8, 0x5D5E, 0xDD53, 0x5D62, 0xDD56, - 0x5D63, 0xDD4E, 0x5D65, 0xDD50, 0x5D67, 0xDD55, 0x5D68, 0xDD54, - 0x5D69, 0xB743, 0x5D6B, 0xD8DB, 0x5D6C, 0xDD52, 0x5D6F, 0xB744, - 0x5D71, 0xDD4D, 0x5D72, 0xDD51, 0x5D77, 0xE1A9, 0x5D79, 0xE1B0, - 0x5D7A, 0xE1A7, 0x5D7C, 0xE1AE, 0x5D7D, 0xE1A5, 0x5D7E, 0xE1AD, - 0x5D7F, 0xE1B1, 0x5D80, 0xE1A4, 0x5D81, 0xE1A8, 0x5D82, 0xE1A3, - 0x5D84, 0xB9F1, 0x5D86, 0xE1A6, 0x5D87, 0xB9F2, 0x5D88, 0xE1AC, - 0x5D89, 0xE1AB, 0x5D8A, 0xE1AA, 0x5D8D, 0xE1AF, 0x5D92, 0xE565, - 0x5D93, 0xE567, 0x5D94, 0xBC6B, 0x5D95, 0xE568, 0x5D97, 0xE563, - 0x5D99, 0xE562, 0x5D9A, 0xE56C, 0x5D9C, 0xE56A, 0x5D9D, 0xBC6A, - 0x5D9E, 0xE56D, 0x5D9F, 0xE564, 0x5DA0, 0xE569, 0x5DA1, 0xE56B, - 0x5DA2, 0xE566, 0x5DA7, 0xE961, 0x5DA8, 0xE966, 0x5DA9, 0xE960, - 0x5DAA, 0xE965, 0x5DAC, 0xE95E, 0x5DAD, 0xE968, 0x5DAE, 0xE964, - 0x5DAF, 0xE969, 0x5DB0, 0xE963, 0x5DB1, 0xE95F, 0x5DB2, 0xE967, - 0x5DB4, 0xE96A, 0x5DB5, 0xE962, 0x5DB7, 0xECDA, 0x5DB8, 0xC0AF, - 0x5DBA, 0xC0AD, 0x5DBC, 0xC0AC, 0x5DBD, 0xC0AE, 0x5DC0, 0xEFC4, - 0x5DC2, 0xF172, 0x5DC3, 0xF1FD, 0x5DC6, 0xF444, 0x5DC7, 0xF445, - 0x5DC9, 0xC460, 0x5DCB, 0xF5C9, 0x5DCD, 0xC4DE, 0x5DCF, 0xF5CA, - 0x5DD1, 0xF6DE, 0x5DD2, 0xC572, 0x5DD4, 0xC571, 0x5DD5, 0xF6DD, - 0x5DD6, 0xC5C9, 0x5DD8, 0xF7D6, 0x5DDD, 0xA474, 0x5DDE, 0xA67B, - 0x5DDF, 0xC9DA, 0x5DE0, 0xCACA, 0x5DE1, 0xA8B5, 0x5DE2, 0xB15F, - 0x5DE5, 0xA475, 0x5DE6, 0xA5AA, 0x5DE7, 0xA5A9, 0x5DE8, 0xA5A8, - 0x5DEB, 0xA7C5, 0x5DEE, 0xAE74, 0x5DF0, 0xDD57, 0x5DF1, 0xA476, - 0x5DF2, 0xA477, 0x5DF3, 0xA478, 0x5DF4, 0xA4DA, 0x5DF7, 0xABD1, - 0x5DF9, 0xCEAF, 0x5DFD, 0xB453, 0x5DFE, 0xA479, 0x5DFF, 0xC95D, - 0x5E02, 0xA5AB, 0x5E03, 0xA5AC, 0x5E04, 0xC978, 0x5E06, 0xA67C, - 0x5E0A, 0xCACB, 0x5E0C, 0xA7C6, 0x5E0E, 0xCACC, 0x5E11, 0xA9AE, - 0x5E14, 0xCC6E, 0x5E15, 0xA9AC, 0x5E16, 0xA9AB, 0x5E17, 0xCC6D, - 0x5E18, 0xA9A9, 0x5E19, 0xCC6F, 0x5E1A, 0xA9AA, 0x5E1B, 0xA9AD, - 0x5E1D, 0xABD2, 0x5E1F, 0xABD4, 0x5E20, 0xCEB3, 0x5E21, 0xCEB0, - 0x5E22, 0xCEB1, 0x5E23, 0xCEB2, 0x5E24, 0xCEB4, 0x5E25, 0xABD3, - 0x5E28, 0xD174, 0x5E29, 0xD173, 0x5E2B, 0xAE76, 0x5E2D, 0xAE75, - 0x5E33, 0xB162, 0x5E34, 0xD546, 0x5E36, 0xB161, 0x5E37, 0xB163, - 0x5E38, 0xB160, 0x5E3D, 0xB455, 0x5E3E, 0xD545, 0x5E40, 0xB456, - 0x5E41, 0xD8F3, 0x5E43, 0xB457, 0x5E44, 0xD8F2, 0x5E45, 0xB454, - 0x5E4A, 0xDD5A, 0x5E4B, 0xDD5C, 0x5E4C, 0xB745, 0x5E4D, 0xDD5B, - 0x5E4E, 0xDD59, 0x5E4F, 0xDD58, 0x5E53, 0xE1B4, 0x5E54, 0xB9F7, - 0x5E55, 0xB9F5, 0x5E57, 0xB9F6, 0x5E58, 0xE1B2, 0x5E59, 0xE1B3, - 0x5E5B, 0xB9F3, 0x5E5C, 0xE571, 0x5E5D, 0xE56F, 0x5E5F, 0xBC6D, - 0x5E60, 0xE570, 0x5E61, 0xBC6E, 0x5E62, 0xBC6C, 0x5E63, 0xB9F4, - 0x5E66, 0xE96D, 0x5E67, 0xE96B, 0x5E68, 0xE96C, 0x5E69, 0xE56E, - 0x5E6A, 0xECDC, 0x5E6B, 0xC0B0, 0x5E6C, 0xECDB, 0x5E6D, 0xEFC5, - 0x5E6E, 0xEFC6, 0x5E6F, 0xE96E, 0x5E70, 0xF1FE, 0x5E72, 0xA47A, - 0x5E73, 0xA5AD, 0x5E74, 0xA67E, 0x5E75, 0xC9DB, 0x5E76, 0xA67D, - 0x5E78, 0xA9AF, 0x5E79, 0xB746, 0x5E7B, 0xA4DB, 0x5E7C, 0xA5AE, - 0x5E7D, 0xABD5, 0x5E7E, 0xB458, 0x5E80, 0xC979, 0x5E82, 0xC97A, - 0x5E84, 0xC9DC, 0x5E87, 0xA7C8, 0x5E88, 0xCAD0, 0x5E89, 0xCACE, - 0x5E8A, 0xA7C9, 0x5E8B, 0xCACD, 0x5E8C, 0xCACF, 0x5E8D, 0xCAD1, - 0x5E8F, 0xA7C7, 0x5E95, 0xA9B3, 0x5E96, 0xA9B4, 0x5E97, 0xA9B1, - 0x5E9A, 0xA9B0, 0x5E9B, 0xCEB8, 0x5E9C, 0xA9B2, 0x5EA0, 0xABD6, - 0x5EA2, 0xCEB7, 0x5EA3, 0xCEB9, 0x5EA4, 0xCEB6, 0x5EA5, 0xCEBA, - 0x5EA6, 0xABD7, 0x5EA7, 0xAE79, 0x5EA8, 0xD175, 0x5EAA, 0xD177, - 0x5EAB, 0xAE77, 0x5EAC, 0xD178, 0x5EAD, 0xAE78, 0x5EAE, 0xD176, - 0x5EB0, 0xCEB5, 0x5EB1, 0xD547, 0x5EB2, 0xD54A, 0x5EB3, 0xD54B, - 0x5EB4, 0xD548, 0x5EB5, 0xB167, 0x5EB6, 0xB166, 0x5EB7, 0xB164, - 0x5EB8, 0xB165, 0x5EB9, 0xD549, 0x5EBE, 0xB168, 0x5EC1, 0xB45A, - 0x5EC2, 0xB45B, 0x5EC4, 0xB45C, 0x5EC5, 0xDD5D, 0x5EC6, 0xDD5F, - 0x5EC7, 0xDD61, 0x5EC8, 0xB748, 0x5EC9, 0xB747, 0x5ECA, 0xB459, - 0x5ECB, 0xDD60, 0x5ECC, 0xDD5E, 0x5ECE, 0xE1B8, 0x5ED1, 0xE1B6, - 0x5ED2, 0xE1BC, 0x5ED3, 0xB9F8, 0x5ED4, 0xE1BD, 0x5ED5, 0xE1BA, - 0x5ED6, 0xB9F9, 0x5ED7, 0xE1B7, 0x5ED8, 0xE1B5, 0x5ED9, 0xE1BB, - 0x5EDA, 0xBC70, 0x5EDB, 0xE573, 0x5EDC, 0xE1B9, 0x5EDD, 0xBC72, - 0x5EDE, 0xE574, 0x5EDF, 0xBC71, 0x5EE0, 0xBC74, 0x5EE1, 0xE575, - 0x5EE2, 0xBC6F, 0x5EE3, 0xBC73, 0x5EE5, 0xE973, 0x5EE6, 0xE971, - 0x5EE7, 0xE970, 0x5EE8, 0xE972, 0x5EE9, 0xE96F, 0x5EEC, 0xC366, - 0x5EEE, 0xF446, 0x5EEF, 0xF447, 0x5EF1, 0xF5CB, 0x5EF2, 0xF6DF, - 0x5EF3, 0xC655, 0x5EF6, 0xA9B5, 0x5EF7, 0xA7CA, 0x5EFA, 0xABD8, - 0x5EFE, 0xA47B, 0x5EFF, 0xA4DC, 0x5F01, 0xA5AF, 0x5F02, 0xC9DD, - 0x5F04, 0xA7CB, 0x5F05, 0xCAD2, 0x5F07, 0xCEBB, 0x5F08, 0xABD9, - 0x5F0A, 0xB9FA, 0x5F0B, 0xA47C, 0x5F0F, 0xA6A1, 0x5F12, 0xB749, - 0x5F13, 0xA47D, 0x5F14, 0xA4DD, 0x5F15, 0xA4DE, 0x5F17, 0xA5B1, - 0x5F18, 0xA5B0, 0x5F1A, 0xC9DE, 0x5F1B, 0xA6A2, 0x5F1D, 0xCAD3, - 0x5F1F, 0xA7CC, 0x5F22, 0xCC71, 0x5F23, 0xCC72, 0x5F24, 0xCC73, - 0x5F26, 0xA9B6, 0x5F27, 0xA9B7, 0x5F28, 0xCC70, 0x5F29, 0xA9B8, - 0x5F2D, 0xABDA, 0x5F2E, 0xCEBC, 0x5F30, 0xD17A, 0x5F31, 0xAE7A, - 0x5F33, 0xD179, 0x5F35, 0xB169, 0x5F36, 0xD54C, 0x5F37, 0xB16A, - 0x5F38, 0xD54D, 0x5F3C, 0xB45D, 0x5F40, 0xDD62, 0x5F43, 0xE1BF, - 0x5F44, 0xE1BE, 0x5F46, 0xB9FB, 0x5F48, 0xBC75, 0x5F49, 0xE576, - 0x5F4A, 0xBECA, 0x5F4B, 0xE974, 0x5F4C, 0xC0B1, 0x5F4E, 0xC573, - 0x5F4F, 0xF7D8, 0x5F54, 0xCC74, 0x5F56, 0xCEBD, 0x5F57, 0xB16B, - 0x5F58, 0xD8F4, 0x5F59, 0xB74A, 0x5F5D, 0xC255, 0x5F62, 0xA7CE, - 0x5F64, 0xA7CD, 0x5F65, 0xABDB, 0x5F67, 0xD17B, 0x5F69, 0xB16D, - 0x5F6A, 0xB343, 0x5F6B, 0xB16E, 0x5F6C, 0xB16C, 0x5F6D, 0xB45E, - 0x5F6F, 0xE1C0, 0x5F70, 0xB9FC, 0x5F71, 0xBC76, 0x5F73, 0xC94C, - 0x5F74, 0xC9DF, 0x5F76, 0xCAD5, 0x5F77, 0xA7CF, 0x5F78, 0xCAD4, - 0x5F79, 0xA7D0, 0x5F7C, 0xA9BC, 0x5F7D, 0xCC77, 0x5F7E, 0xCC76, - 0x5F7F, 0xA9BB, 0x5F80, 0xA9B9, 0x5F81, 0xA9BA, 0x5F82, 0xCC75, - 0x5F85, 0xABDD, 0x5F86, 0xCEBE, 0x5F87, 0xABE0, 0x5F88, 0xABDC, - 0x5F89, 0xABE2, 0x5F8A, 0xABDE, 0x5F8B, 0xABDF, 0x5F8C, 0xABE1, - 0x5F90, 0xAE7D, 0x5F91, 0xAE7C, 0x5F92, 0xAE7B, 0x5F96, 0xD54F, - 0x5F97, 0xB16F, 0x5F98, 0xB172, 0x5F99, 0xB170, 0x5F9B, 0xD54E, - 0x5F9C, 0xB175, 0x5F9E, 0xB171, 0x5F9F, 0xD550, 0x5FA0, 0xB174, - 0x5FA1, 0xB173, 0x5FA5, 0xD8F6, 0x5FA6, 0xD8F5, 0x5FA8, 0xB461, - 0x5FA9, 0xB45F, 0x5FAA, 0xB460, 0x5FAB, 0xD8F7, 0x5FAC, 0xB74B, - 0x5FAD, 0xDD64, 0x5FAE, 0xB74C, 0x5FAF, 0xDD63, 0x5FB2, 0xE577, - 0x5FB5, 0xBC78, 0x5FB6, 0xE1C1, 0x5FB7, 0xBC77, 0x5FB9, 0xB9FD, - 0x5FBB, 0xECDE, 0x5FBC, 0xE975, 0x5FBD, 0xC0B2, 0x5FBE, 0xECDD, - 0x5FBF, 0xF240, 0x5FC0, 0xF448, 0x5FC1, 0xF449, 0x5FC3, 0xA4DF, - 0x5FC5, 0xA5B2, 0x5FC9, 0xC97B, 0x5FCC, 0xA7D2, 0x5FCD, 0xA7D4, - 0x5FCF, 0xC9E2, 0x5FD0, 0xCAD8, 0x5FD1, 0xCAD7, 0x5FD2, 0xCAD6, - 0x5FD4, 0xC9E1, 0x5FD5, 0xC9E0, 0x5FD6, 0xA6A4, 0x5FD7, 0xA7D3, - 0x5FD8, 0xA7D1, 0x5FD9, 0xA6A3, 0x5FDD, 0xA9BD, 0x5FDE, 0xCC78, - 0x5FE0, 0xA9BE, 0x5FE1, 0xCADD, 0x5FE3, 0xCADF, 0x5FE4, 0xCADE, - 0x5FE5, 0xCC79, 0x5FE8, 0xCADA, 0x5FEA, 0xA7D8, 0x5FEB, 0xA7D6, - 0x5FED, 0xCAD9, 0x5FEE, 0xCADB, 0x5FEF, 0xCAE1, 0x5FF1, 0xA7D5, - 0x5FF3, 0xCADC, 0x5FF4, 0xCAE5, 0x5FF5, 0xA9C0, 0x5FF7, 0xCAE2, - 0x5FF8, 0xA7D7, 0x5FFA, 0xCAE0, 0x5FFB, 0xCAE3, 0x5FFD, 0xA9BF, - 0x5FFF, 0xA9C1, 0x6000, 0xCAE4, 0x6009, 0xCCAF, 0x600A, 0xCCA2, - 0x600B, 0xCC7E, 0x600C, 0xCCAE, 0x600D, 0xCCA9, 0x600E, 0xABE7, - 0x600F, 0xA9C2, 0x6010, 0xCCAA, 0x6011, 0xCCAD, 0x6012, 0xABE3, - 0x6013, 0xCCAC, 0x6014, 0xA9C3, 0x6015, 0xA9C8, 0x6016, 0xA9C6, - 0x6017, 0xCCA3, 0x6019, 0xCC7C, 0x601A, 0xCCA5, 0x601B, 0xA9CD, - 0x601C, 0xCCB0, 0x601D, 0xABE4, 0x601E, 0xCCA6, 0x6020, 0xABE5, - 0x6021, 0xA9C9, 0x6022, 0xCCA8, 0x6024, 0xCECD, 0x6025, 0xABE6, - 0x6026, 0xCC7B, 0x6027, 0xA9CA, 0x6028, 0xABE8, 0x6029, 0xA9CB, - 0x602A, 0xA9C7, 0x602B, 0xA9CC, 0x602C, 0xCCA7, 0x602D, 0xCC7A, - 0x602E, 0xCCAB, 0x602F, 0xA9C4, 0x6032, 0xCC7D, 0x6033, 0xCCA4, - 0x6034, 0xCCA1, 0x6035, 0xA9C5, 0x6037, 0xCEBF, 0x6039, 0xCEC0, - 0x6040, 0xCECA, 0x6041, 0xD1A1, 0x6042, 0xCECB, 0x6043, 0xABEE, - 0x6044, 0xCECE, 0x6045, 0xCEC4, 0x6046, 0xABED, 0x6047, 0xCEC6, - 0x6049, 0xCEC7, 0x604C, 0xCEC9, 0x604D, 0xABE9, 0x6050, 0xAEA3, - 0x6052, 0xF9DA, 0x6053, 0xCEC5, 0x6054, 0xCEC1, 0x6055, 0xAEA4, - 0x6058, 0xCECF, 0x6059, 0xAE7E, 0x605A, 0xD17D, 0x605B, 0xCEC8, - 0x605D, 0xD17C, 0x605E, 0xCEC3, 0x605F, 0xCECC, 0x6062, 0xABEC, - 0x6063, 0xAEA1, 0x6064, 0xABF2, 0x6065, 0xAEA2, 0x6066, 0xCED0, - 0x6067, 0xD17E, 0x6068, 0xABEB, 0x6069, 0xAEA6, 0x606A, 0xABF1, - 0x606B, 0xABF0, 0x606C, 0xABEF, 0x606D, 0xAEA5, 0x606E, 0xCED1, - 0x606F, 0xAEA7, 0x6070, 0xABEA, 0x6072, 0xCEC2, 0x607F, 0xB176, - 0x6080, 0xD1A4, 0x6081, 0xD1A6, 0x6083, 0xD1A8, 0x6084, 0xAEA8, - 0x6085, 0xAEAE, 0x6086, 0xD553, 0x6087, 0xD1AC, 0x6088, 0xD1A3, - 0x6089, 0xB178, 0x608A, 0xD551, 0x608C, 0xAEAD, 0x608D, 0xAEAB, - 0x608E, 0xD1AE, 0x6090, 0xD552, 0x6092, 0xD1A5, 0x6094, 0xAEAC, - 0x6095, 0xD1A9, 0x6096, 0xAEAF, 0x6097, 0xD1AB, 0x609A, 0xAEAA, - 0x609B, 0xD1AA, 0x609C, 0xD1AD, 0x609D, 0xD1A7, 0x609F, 0xAEA9, - 0x60A0, 0xB179, 0x60A2, 0xD1A2, 0x60A3, 0xB177, 0x60A8, 0xB17A, - 0x60B0, 0xD555, 0x60B1, 0xD55E, 0x60B2, 0xB464, 0x60B4, 0xB17C, - 0x60B5, 0xB1A3, 0x60B6, 0xB465, 0x60B7, 0xD560, 0x60B8, 0xB1AA, - 0x60B9, 0xD8F9, 0x60BA, 0xD556, 0x60BB, 0xB1A2, 0x60BC, 0xB1A5, - 0x60BD, 0xB17E, 0x60BE, 0xD554, 0x60BF, 0xD562, 0x60C0, 0xD565, - 0x60C1, 0xD949, 0x60C3, 0xD563, 0x60C4, 0xD8FD, 0x60C5, 0xB1A1, - 0x60C6, 0xB1A8, 0x60C7, 0xB1AC, 0x60C8, 0xD55D, 0x60C9, 0xD8F8, - 0x60CA, 0xD561, 0x60CB, 0xB17B, 0x60CC, 0xD8FA, 0x60CD, 0xD564, - 0x60CE, 0xD8FC, 0x60CF, 0xD559, 0x60D1, 0xB462, 0x60D3, 0xD557, - 0x60D4, 0xD558, 0x60D5, 0xB1A7, 0x60D8, 0xB1A6, 0x60D9, 0xD55B, - 0x60DA, 0xB1AB, 0x60DB, 0xD55F, 0x60DC, 0xB1A4, 0x60DD, 0xD55C, - 0x60DF, 0xB1A9, 0x60E0, 0xB466, 0x60E1, 0xB463, 0x60E2, 0xD8FB, - 0x60E4, 0xD55A, 0x60E6, 0xB17D, 0x60F0, 0xB46B, 0x60F1, 0xB46F, - 0x60F2, 0xD940, 0x60F3, 0xB751, 0x60F4, 0xB46D, 0x60F5, 0xD944, - 0x60F6, 0xB471, 0x60F7, 0xDD65, 0x60F8, 0xD946, 0x60F9, 0xB753, - 0x60FA, 0xB469, 0x60FB, 0xB46C, 0x60FC, 0xD947, 0x60FE, 0xD948, - 0x60FF, 0xD94E, 0x6100, 0xB473, 0x6101, 0xB754, 0x6103, 0xD94A, - 0x6104, 0xD94F, 0x6105, 0xD943, 0x6106, 0xB75E, 0x6108, 0xB755, - 0x6109, 0xB472, 0x610A, 0xD941, 0x610B, 0xD950, 0x610D, 0xB75D, - 0x610E, 0xB470, 0x610F, 0xB74E, 0x6110, 0xD94D, 0x6112, 0xB474, - 0x6113, 0xD945, 0x6114, 0xD8FE, 0x6115, 0xB46A, 0x6116, 0xD942, - 0x6118, 0xD94B, 0x611A, 0xB74D, 0x611B, 0xB752, 0x611C, 0xB467, - 0x611D, 0xD94C, 0x611F, 0xB750, 0x6123, 0xB468, 0x6127, 0xB75C, - 0x6128, 0xE1C3, 0x6129, 0xDD70, 0x612B, 0xDD68, 0x612C, 0xE1C2, - 0x612E, 0xDD6C, 0x612F, 0xDD6E, 0x6132, 0xDD6B, 0x6134, 0xB75B, - 0x6136, 0xDD6A, 0x6137, 0xB75F, 0x613B, 0xE1D2, 0x613E, 0xB75A, - 0x613F, 0xBA40, 0x6140, 0xDD71, 0x6141, 0xE1C4, 0x6144, 0xB758, - 0x6145, 0xDD69, 0x6146, 0xDD6D, 0x6147, 0xB9FE, 0x6148, 0xB74F, - 0x6149, 0xDD66, 0x614A, 0xDD67, 0x614B, 0xBA41, 0x614C, 0xB757, - 0x614D, 0xB759, 0x614E, 0xB756, 0x614F, 0xDD6F, 0x6152, 0xE1C8, - 0x6153, 0xE1C9, 0x6154, 0xE1CE, 0x6155, 0xBC7D, 0x6156, 0xE1D5, - 0x6158, 0xBA47, 0x615A, 0xBA46, 0x615B, 0xE1D0, 0x615D, 0xBC7C, - 0x615E, 0xE1C5, 0x615F, 0xBA45, 0x6161, 0xE1D4, 0x6162, 0xBA43, - 0x6163, 0xBA44, 0x6165, 0xE1D1, 0x6166, 0xE5AA, 0x6167, 0xBC7A, - 0x6168, 0xB46E, 0x616A, 0xE1D3, 0x616B, 0xBCA3, 0x616C, 0xE1CB, - 0x616E, 0xBC7B, 0x6170, 0xBCA2, 0x6171, 0xE1C6, 0x6172, 0xE1CA, - 0x6173, 0xE1C7, 0x6174, 0xE1CD, 0x6175, 0xBA48, 0x6176, 0xBC79, - 0x6177, 0xBA42, 0x6179, 0xE57A, 0x617A, 0xE1CF, 0x617C, 0xBCA1, - 0x617E, 0xBCA4, 0x6180, 0xE1CC, 0x6182, 0xBC7E, 0x6183, 0xE579, - 0x6189, 0xE57E, 0x618A, 0xBECE, 0x618B, 0xE578, 0x618C, 0xE9A3, - 0x618D, 0xE5A9, 0x618E, 0xBCA8, 0x6190, 0xBCA6, 0x6191, 0xBECC, - 0x6192, 0xE5A6, 0x6193, 0xE5A2, 0x6194, 0xBCAC, 0x6196, 0xE978, - 0x619A, 0xBCAA, 0x619B, 0xE5A1, 0x619D, 0xE976, 0x619F, 0xE5A5, - 0x61A1, 0xE5A8, 0x61A2, 0xE57D, 0x61A4, 0xBCAB, 0x61A7, 0xBCA5, - 0x61A8, 0xE977, 0x61A9, 0xBECD, 0x61AA, 0xE5A7, 0x61AB, 0xBCA7, - 0x61AC, 0xBCA9, 0x61AD, 0xE5A4, 0x61AE, 0xBCAD, 0x61AF, 0xE5A3, - 0x61B0, 0xE57C, 0x61B1, 0xE57B, 0x61B2, 0xBECB, 0x61B3, 0xE5AB, - 0x61B4, 0xE97A, 0x61B5, 0xECE0, 0x61B6, 0xBED0, 0x61B8, 0xE9A2, - 0x61BA, 0xE97E, 0x61BC, 0xECE1, 0x61BE, 0xBED1, 0x61BF, 0xE9A1, - 0x61C1, 0xE97C, 0x61C2, 0xC0B4, 0x61C3, 0xECDF, 0x61C5, 0xE979, - 0x61C6, 0xE97B, 0x61C7, 0xC0B5, 0x61C8, 0xBED3, 0x61C9, 0xC0B3, - 0x61CA, 0xBED2, 0x61CB, 0xC0B7, 0x61CC, 0xE97D, 0x61CD, 0xBECF, - 0x61D6, 0xEFCF, 0x61D8, 0xEFC7, 0x61DE, 0xECE7, 0x61DF, 0xEFC8, - 0x61E0, 0xECE3, 0x61E3, 0xC256, 0x61E4, 0xECE5, 0x61E5, 0xECE4, - 0x61E6, 0xC0B6, 0x61E7, 0xECE2, 0x61E8, 0xECE6, 0x61E9, 0xEFD0, - 0x61EA, 0xEFCC, 0x61EB, 0xEFCE, 0x61ED, 0xEFC9, 0x61EE, 0xEFCA, - 0x61F0, 0xEFCD, 0x61F1, 0xEFCB, 0x61F2, 0xC367, 0x61F5, 0xC36A, - 0x61F6, 0xC369, 0x61F7, 0xC368, 0x61F8, 0xC461, 0x61F9, 0xF44A, - 0x61FA, 0xC462, 0x61FB, 0xF241, 0x61FC, 0xC4DF, 0x61FD, 0xF5CC, - 0x61FE, 0xC4E0, 0x61FF, 0xC574, 0x6200, 0xC5CA, 0x6201, 0xF7D9, - 0x6203, 0xF7DA, 0x6204, 0xF7DB, 0x6207, 0xF9BA, 0x6208, 0xA4E0, - 0x6209, 0xC97C, 0x620A, 0xA5B3, 0x620C, 0xA6A6, 0x620D, 0xA6A7, - 0x620E, 0xA6A5, 0x6210, 0xA6A8, 0x6211, 0xA7DA, 0x6212, 0xA7D9, - 0x6214, 0xCCB1, 0x6215, 0xA9CF, 0x6216, 0xA9CE, 0x6219, 0xD1AF, - 0x621A, 0xB1AD, 0x621B, 0xB1AE, 0x621F, 0xB475, 0x6220, 0xDD72, - 0x6221, 0xB760, 0x6222, 0xB761, 0x6223, 0xDD74, 0x6224, 0xDD76, - 0x6225, 0xDD75, 0x6227, 0xE1D7, 0x6229, 0xE1D6, 0x622A, 0xBA49, - 0x622B, 0xE1D8, 0x622D, 0xE5AC, 0x622E, 0xBCAE, 0x6230, 0xBED4, - 0x6232, 0xC0B8, 0x6233, 0xC257, 0x6234, 0xC0B9, 0x6236, 0xA4E1, - 0x623A, 0xCAE6, 0x623D, 0xCCB2, 0x623E, 0xA9D1, 0x623F, 0xA9D0, - 0x6240, 0xA9D2, 0x6241, 0xABF3, 0x6242, 0xCED2, 0x6243, 0xCED3, - 0x6246, 0xD1B0, 0x6247, 0xAEB0, 0x6248, 0xB1AF, 0x6249, 0xB476, - 0x624A, 0xD951, 0x624B, 0xA4E2, 0x624D, 0xA47E, 0x624E, 0xA4E3, - 0x6250, 0xC97D, 0x6251, 0xA5B7, 0x6252, 0xA5B6, 0x6253, 0xA5B4, - 0x6254, 0xA5B5, 0x6258, 0xA6AB, 0x6259, 0xC9E9, 0x625A, 0xC9EB, - 0x625B, 0xA6AA, 0x625C, 0xC9E3, 0x625E, 0xC9E4, 0x6260, 0xC9EA, - 0x6261, 0xC9E6, 0x6262, 0xC9E8, 0x6263, 0xA6A9, 0x6264, 0xC9E5, - 0x6265, 0xC9EC, 0x6266, 0xC9E7, 0x626D, 0xA7E1, 0x626E, 0xA7EA, - 0x626F, 0xA7E8, 0x6270, 0xCAF0, 0x6271, 0xCAED, 0x6272, 0xCAF5, - 0x6273, 0xA7E6, 0x6274, 0xCAF6, 0x6276, 0xA7DF, 0x6277, 0xCAF3, - 0x6279, 0xA7E5, 0x627A, 0xCAEF, 0x627B, 0xCAEE, 0x627C, 0xA7E3, - 0x627D, 0xCAF4, 0x627E, 0xA7E4, 0x627F, 0xA9D3, 0x6280, 0xA7DE, - 0x6281, 0xCAF1, 0x6283, 0xCAE7, 0x6284, 0xA7DB, 0x6286, 0xA7EE, - 0x6287, 0xCAEC, 0x6288, 0xCAF2, 0x6289, 0xA7E0, 0x628A, 0xA7E2, - 0x628C, 0xCAE8, 0x628E, 0xCAE9, 0x628F, 0xCAEA, 0x6291, 0xA7ED, - 0x6292, 0xA7E7, 0x6293, 0xA7EC, 0x6294, 0xCAEB, 0x6295, 0xA7EB, - 0x6296, 0xA7DD, 0x6297, 0xA7DC, 0x6298, 0xA7E9, 0x62A8, 0xA9E1, - 0x62A9, 0xCCBE, 0x62AA, 0xCCB7, 0x62AB, 0xA9DC, 0x62AC, 0xA9EF, - 0x62AD, 0xCCB3, 0x62AE, 0xCCBA, 0x62AF, 0xCCBC, 0x62B0, 0xCCBF, - 0x62B1, 0xA9EA, 0x62B3, 0xCCBB, 0x62B4, 0xCCB4, 0x62B5, 0xA9E8, - 0x62B6, 0xCCB8, 0x62B8, 0xCCC0, 0x62B9, 0xA9D9, 0x62BB, 0xCCBD, - 0x62BC, 0xA9E3, 0x62BD, 0xA9E2, 0x62BE, 0xCCB6, 0x62BF, 0xA9D7, - 0x62C2, 0xA9D8, 0x62C4, 0xA9D6, 0x62C6, 0xA9EE, 0x62C7, 0xA9E6, - 0x62C8, 0xA9E0, 0x62C9, 0xA9D4, 0x62CA, 0xCCB9, 0x62CB, 0xA9DF, - 0x62CC, 0xA9D5, 0x62CD, 0xA9E7, 0x62CE, 0xA9F0, 0x62CF, 0xCED4, - 0x62D0, 0xA9E4, 0x62D1, 0xCCB5, 0x62D2, 0xA9DA, 0x62D3, 0xA9DD, - 0x62D4, 0xA9DE, 0x62D6, 0xA9EC, 0x62D7, 0xA9ED, 0x62D8, 0xA9EB, - 0x62D9, 0xA9E5, 0x62DA, 0xA9E9, 0x62DB, 0xA9DB, 0x62DC, 0xABF4, - 0x62EB, 0xCEDA, 0x62EC, 0xAC41, 0x62ED, 0xABF8, 0x62EE, 0xABFA, - 0x62EF, 0xAC40, 0x62F0, 0xCEE6, 0x62F1, 0xABFD, 0x62F2, 0xD1B1, - 0x62F3, 0xAEB1, 0x62F4, 0xAC43, 0x62F5, 0xCED7, 0x62F6, 0xCEDF, - 0x62F7, 0xABFE, 0x62F8, 0xCEDE, 0x62F9, 0xCEDB, 0x62FA, 0xCEE3, - 0x62FB, 0xCEE5, 0x62FC, 0xABF7, 0x62FD, 0xABFB, 0x62FE, 0xAC42, - 0x62FF, 0xAEB3, 0x6300, 0xCEE0, 0x6301, 0xABF9, 0x6302, 0xAC45, - 0x6303, 0xCED9, 0x6307, 0xABFC, 0x6308, 0xAEB2, 0x6309, 0xABF6, - 0x630B, 0xCED6, 0x630C, 0xCEDD, 0x630D, 0xCED5, 0x630E, 0xCED8, - 0x630F, 0xCEDC, 0x6310, 0xD1B2, 0x6311, 0xAC44, 0x6313, 0xCEE1, - 0x6314, 0xCEE2, 0x6315, 0xCEE4, 0x6316, 0xABF5, 0x6328, 0xAEC1, - 0x6329, 0xD1BE, 0x632A, 0xAEBF, 0x632B, 0xAEC0, 0x632C, 0xD1B4, - 0x632D, 0xD1C4, 0x632F, 0xAEB6, 0x6332, 0xD566, 0x6333, 0xD1C6, - 0x6334, 0xD1C0, 0x6336, 0xD1B7, 0x6338, 0xD1C9, 0x6339, 0xD1BA, - 0x633A, 0xAEBC, 0x633B, 0xD57D, 0x633C, 0xD1BD, 0x633D, 0xAEBE, - 0x633E, 0xAEB5, 0x6340, 0xD1CB, 0x6341, 0xD1BF, 0x6342, 0xAEB8, - 0x6343, 0xD1B8, 0x6344, 0xD1B5, 0x6345, 0xD1B6, 0x6346, 0xAEB9, - 0x6347, 0xD1C5, 0x6348, 0xD1CC, 0x6349, 0xAEBB, 0x634A, 0xD1BC, - 0x634B, 0xD1BB, 0x634C, 0xAEC3, 0x634D, 0xAEC2, 0x634E, 0xAEB4, - 0x634F, 0xAEBA, 0x6350, 0xAEBD, 0x6351, 0xD1C8, 0x6354, 0xD1C2, - 0x6355, 0xAEB7, 0x6356, 0xD1B3, 0x6357, 0xD1CA, 0x6358, 0xD1C1, - 0x6359, 0xD1C3, 0x635A, 0xD1C7, 0x6365, 0xD567, 0x6367, 0xB1B7, - 0x6368, 0xB1CB, 0x6369, 0xB1CA, 0x636B, 0xB1BF, 0x636D, 0xD579, - 0x636E, 0xD575, 0x636F, 0xD572, 0x6370, 0xD5A6, 0x6371, 0xB1BA, - 0x6372, 0xB1B2, 0x6375, 0xD577, 0x6376, 0xB4A8, 0x6377, 0xB1B6, - 0x6378, 0xD5A1, 0x637A, 0xB1CC, 0x637B, 0xB1C9, 0x637C, 0xD57B, - 0x637D, 0xD56A, 0x6380, 0xB1C8, 0x6381, 0xD5A3, 0x6382, 0xD569, - 0x6383, 0xB1BD, 0x6384, 0xB1C1, 0x6385, 0xD5A2, 0x6387, 0xD573, - 0x6388, 0xB1C2, 0x6389, 0xB1BC, 0x638A, 0xD568, 0x638C, 0xB478, - 0x638D, 0xD5A5, 0x638E, 0xD571, 0x638F, 0xB1C7, 0x6390, 0xD574, - 0x6391, 0xD5A4, 0x6392, 0xB1C6, 0x6394, 0xD952, 0x6396, 0xB1B3, - 0x6397, 0xD56F, 0x6398, 0xB1B8, 0x6399, 0xB1C3, 0x639B, 0xB1BE, - 0x639C, 0xD578, 0x639D, 0xD56E, 0x639E, 0xD56C, 0x639F, 0xD57E, - 0x63A0, 0xB1B0, 0x63A1, 0xB1C4, 0x63A2, 0xB1B4, 0x63A3, 0xB477, - 0x63A4, 0xD57C, 0x63A5, 0xB1B5, 0x63A7, 0xB1B1, 0x63A8, 0xB1C0, - 0x63A9, 0xB1BB, 0x63AA, 0xB1B9, 0x63AB, 0xD570, 0x63AC, 0xB1C5, - 0x63AD, 0xD56D, 0x63AE, 0xD57A, 0x63AF, 0xD576, 0x63B0, 0xD954, - 0x63B1, 0xD953, 0x63BD, 0xD56B, 0x63BE, 0xD964, 0x63C0, 0xB47A, - 0x63C2, 0xD96A, 0x63C3, 0xD959, 0x63C4, 0xD967, 0x63C5, 0xDD77, - 0x63C6, 0xB47D, 0x63C7, 0xD96B, 0x63C8, 0xD96E, 0x63C9, 0xB47C, - 0x63CA, 0xD95C, 0x63CB, 0xD96D, 0x63CC, 0xD96C, 0x63CD, 0xB47E, - 0x63CE, 0xD955, 0x63CF, 0xB479, 0x63D0, 0xB4A3, 0x63D2, 0xB4A1, - 0x63D3, 0xD969, 0x63D5, 0xD95F, 0x63D6, 0xB4A5, 0x63D7, 0xD970, - 0x63D8, 0xD968, 0x63D9, 0xD971, 0x63DA, 0xB4AD, 0x63DB, 0xB4AB, - 0x63DC, 0xD966, 0x63DD, 0xD965, 0x63DF, 0xD963, 0x63E0, 0xD95D, - 0x63E1, 0xB4A4, 0x63E3, 0xB4A2, 0x63E4, 0xD1B9, 0x63E5, 0xD956, - 0x63E7, 0xDDB7, 0x63E8, 0xD957, 0x63E9, 0xB47B, 0x63EA, 0xB4AA, - 0x63EB, 0xDD79, 0x63ED, 0xB4A6, 0x63EE, 0xB4A7, 0x63EF, 0xD958, - 0x63F0, 0xD96F, 0x63F1, 0xDD78, 0x63F2, 0xD960, 0x63F3, 0xD95B, - 0x63F4, 0xB4A9, 0x63F5, 0xD961, 0x63F6, 0xD95E, 0x63F9, 0xB4AE, - 0x6406, 0xB770, 0x6409, 0xDD7C, 0x640A, 0xDDB1, 0x640B, 0xDDB6, - 0x640C, 0xDDAA, 0x640D, 0xB76C, 0x640E, 0xDDBB, 0x640F, 0xB769, - 0x6410, 0xDD7A, 0x6412, 0xDD7B, 0x6413, 0xB762, 0x6414, 0xB76B, - 0x6415, 0xDDA4, 0x6416, 0xB76E, 0x6417, 0xB76F, 0x6418, 0xDDA5, - 0x641A, 0xDDB2, 0x641B, 0xDDB8, 0x641C, 0xB76A, 0x641E, 0xB764, - 0x641F, 0xDDA3, 0x6420, 0xDD7D, 0x6421, 0xDDBA, 0x6422, 0xDDA8, - 0x6423, 0xDDA9, 0x6424, 0xDD7E, 0x6425, 0xDDB4, 0x6426, 0xDDAB, - 0x6427, 0xDDB5, 0x6428, 0xDDAD, 0x642A, 0xB765, 0x642B, 0xE1D9, - 0x642C, 0xB768, 0x642D, 0xB766, 0x642E, 0xDDB9, 0x642F, 0xDDB0, - 0x6430, 0xDDAC, 0x6433, 0xDDA1, 0x6434, 0xBA53, 0x6435, 0xDDAF, - 0x6436, 0xB76D, 0x6437, 0xDDA7, 0x6439, 0xDDA6, 0x643D, 0xB767, - 0x643E, 0xB763, 0x643F, 0xE1EE, 0x6440, 0xDDB3, 0x6441, 0xDDAE, - 0x6443, 0xDDA2, 0x644B, 0xE1E9, 0x644D, 0xE1DA, 0x644E, 0xE1E5, - 0x6450, 0xE1EC, 0x6451, 0xBA51, 0x6452, 0xB4AC, 0x6453, 0xE1EA, - 0x6454, 0xBA4C, 0x6458, 0xBA4B, 0x6459, 0xE1F1, 0x645B, 0xE1DB, - 0x645C, 0xE1E8, 0x645D, 0xE1DC, 0x645E, 0xE1E7, 0x645F, 0xBA4F, - 0x6460, 0xE1EB, 0x6461, 0xD962, 0x6465, 0xE1F2, 0x6466, 0xE1E3, - 0x6467, 0xBA52, 0x6468, 0xE5BA, 0x6469, 0xBCAF, 0x646B, 0xE1F0, - 0x646C, 0xE1EF, 0x646D, 0xBA54, 0x646E, 0xE5AD, 0x646F, 0xBCB0, - 0x6470, 0xE5AE, 0x6472, 0xE1DF, 0x6473, 0xE1E0, 0x6474, 0xE1DD, - 0x6475, 0xE1E2, 0x6476, 0xE1DE, 0x6477, 0xE1F3, 0x6478, 0xBA4E, - 0x6479, 0xBCB1, 0x647A, 0xBA50, 0x647B, 0xBA55, 0x647D, 0xE1E1, - 0x647F, 0xE1ED, 0x6482, 0xE1E6, 0x6485, 0xE5B1, 0x6487, 0xBA4A, - 0x6488, 0xBCB4, 0x6489, 0xE9AA, 0x648A, 0xE5B6, 0x648B, 0xE5B5, - 0x648C, 0xE5B7, 0x648F, 0xE5B4, 0x6490, 0xBCB5, 0x6492, 0xBCBB, - 0x6493, 0xBCB8, 0x6495, 0xBCB9, 0x6496, 0xE5AF, 0x6497, 0xE5B2, - 0x6498, 0xE5BC, 0x6499, 0xBCC1, 0x649A, 0xBCBF, 0x649C, 0xE5B3, - 0x649D, 0xD95A, 0x649E, 0xBCB2, 0x649F, 0xE5B9, 0x64A0, 0xE5B0, - 0x64A2, 0xBCC2, 0x64A3, 0xE5B8, 0x64A4, 0xBA4D, 0x64A5, 0xBCB7, - 0x64A6, 0xE1E4, 0x64A9, 0xBCBA, 0x64AB, 0xBCBE, 0x64AC, 0xBCC0, - 0x64AD, 0xBCBD, 0x64AE, 0xBCBC, 0x64B0, 0xBCB6, 0x64B1, 0xE5BB, - 0x64B2, 0xBCB3, 0x64B3, 0xBCC3, 0x64BB, 0xBED8, 0x64BC, 0xBED9, - 0x64BD, 0xE9A9, 0x64BE, 0xBEE2, 0x64BF, 0xBEDF, 0x64C1, 0xBED6, - 0x64C2, 0xBEDD, 0x64C3, 0xE9AB, 0x64C4, 0xBEDB, 0x64C5, 0xBED5, - 0x64C7, 0xBEDC, 0x64C9, 0xE9A8, 0x64CA, 0xC0BB, 0x64CB, 0xBED7, - 0x64CD, 0xBEDE, 0x64CE, 0xC0BA, 0x64CF, 0xE9A7, 0x64D0, 0xE9A6, - 0x64D2, 0xBEE0, 0x64D4, 0xBEE1, 0x64D6, 0xE9A5, 0x64D7, 0xE9A4, - 0x64D8, 0xC0BC, 0x64D9, 0xE9AE, 0x64DA, 0xBEDA, 0x64DB, 0xE9AC, - 0x64E0, 0xC0BD, 0x64E2, 0xC0C2, 0x64E3, 0xECEA, 0x64E4, 0xECEC, - 0x64E6, 0xC0BF, 0x64E8, 0xECED, 0x64E9, 0xECE9, 0x64EB, 0xECEB, - 0x64EC, 0xC0C0, 0x64ED, 0xC0C3, 0x64EF, 0xECE8, 0x64F0, 0xC0BE, - 0x64F1, 0xC0C1, 0x64F2, 0xC259, 0x64F3, 0xE9AD, 0x64F4, 0xC258, - 0x64F7, 0xC25E, 0x64F8, 0xEFD4, 0x64FA, 0xC25C, 0x64FB, 0xC25D, - 0x64FC, 0xEFD7, 0x64FD, 0xEFD3, 0x64FE, 0xC25A, 0x64FF, 0xEFD1, - 0x6500, 0xC36B, 0x6501, 0xEFD5, 0x6503, 0xEFD6, 0x6504, 0xEFD2, - 0x6506, 0xC25B, 0x6507, 0xF242, 0x6509, 0xF245, 0x650C, 0xF246, - 0x650D, 0xF244, 0x650E, 0xF247, 0x650F, 0xC36C, 0x6510, 0xF243, - 0x6513, 0xF44E, 0x6514, 0xC464, 0x6515, 0xF44D, 0x6516, 0xF44C, - 0x6517, 0xF44B, 0x6518, 0xC463, 0x6519, 0xC465, 0x651B, 0xF5CD, - 0x651C, 0xC4E2, 0x651D, 0xC4E1, 0x6520, 0xF6E1, 0x6521, 0xF6E0, - 0x6522, 0xF6E3, 0x6523, 0xC5CB, 0x6524, 0xC575, 0x6525, 0xF7DD, - 0x6526, 0xF6E2, 0x6529, 0xF7DC, 0x652A, 0xC5CD, 0x652B, 0xC5CC, - 0x652C, 0xC5F3, 0x652D, 0xF8A9, 0x652E, 0xF8EF, 0x652F, 0xA4E4, - 0x6532, 0xD972, 0x6533, 0xE9AF, 0x6536, 0xA6AC, 0x6537, 0xCAF7, - 0x6538, 0xA7F1, 0x6539, 0xA7EF, 0x653B, 0xA7F0, 0x653D, 0xCCC1, - 0x653E, 0xA9F1, 0x653F, 0xAC46, 0x6541, 0xCEE7, 0x6543, 0xCEE8, - 0x6545, 0xAC47, 0x6546, 0xD1CE, 0x6548, 0xAEC4, 0x6549, 0xAEC5, - 0x654A, 0xD1CD, 0x654F, 0xB1D3, 0x6551, 0xB1CF, 0x6553, 0xD5A7, - 0x6554, 0xB1D6, 0x6555, 0xB1D5, 0x6556, 0xB1CE, 0x6557, 0xB1D1, - 0x6558, 0xB1D4, 0x6559, 0xB1D0, 0x655C, 0xD976, 0x655D, 0xB1CD, - 0x655E, 0xB4AF, 0x6562, 0xB4B1, 0x6563, 0xB4B2, 0x6564, 0xD975, - 0x6565, 0xD978, 0x6566, 0xB4B0, 0x6567, 0xD973, 0x6568, 0xD977, - 0x656A, 0xD974, 0x656C, 0xB771, 0x656F, 0xDDBC, 0x6572, 0xBA56, - 0x6573, 0xE1F4, 0x6574, 0xBEE3, 0x6575, 0xBCC4, 0x6576, 0xE5BD, - 0x6577, 0xBCC5, 0x6578, 0xBCC6, 0x6579, 0xE5BF, 0x657A, 0xE5BE, - 0x657B, 0xE5C0, 0x657C, 0xE9B1, 0x657F, 0xE9B0, 0x6580, 0xECEF, - 0x6581, 0xECEE, 0x6582, 0xC0C4, 0x6583, 0xC0C5, 0x6584, 0xF248, - 0x6587, 0xA4E5, 0x658C, 0xD979, 0x6590, 0xB4B4, 0x6591, 0xB4B3, - 0x6592, 0xDDBD, 0x6594, 0xEFD8, 0x6595, 0xC4E3, 0x6596, 0xF7DE, - 0x6597, 0xA4E6, 0x6599, 0xAEC6, 0x659B, 0xB1D8, 0x659C, 0xB1D7, - 0x659D, 0xD97A, 0x659E, 0xD97B, 0x659F, 0xB772, 0x65A0, 0xE1F5, - 0x65A1, 0xBA57, 0x65A2, 0xE9B2, 0x65A4, 0xA4E7, 0x65A5, 0xA5B8, - 0x65A7, 0xA9F2, 0x65A8, 0xCCC2, 0x65AA, 0xCEE9, 0x65AB, 0xAC48, - 0x65AC, 0xB1D9, 0x65AE, 0xD97C, 0x65AF, 0xB4B5, 0x65B0, 0xB773, - 0x65B2, 0xE5C1, 0x65B3, 0xE5C2, 0x65B6, 0xECF0, 0x65B7, 0xC25F, - 0x65B8, 0xF8F0, 0x65B9, 0xA4E8, 0x65BB, 0xCCC3, 0x65BC, 0xA9F3, - 0x65BD, 0xAC49, 0x65BF, 0xCEEA, 0x65C1, 0xAEC7, 0x65C2, 0xD1D2, - 0x65C3, 0xD1D0, 0x65C4, 0xD1D1, 0x65C5, 0xAEC8, 0x65C6, 0xD1CF, - 0x65CB, 0xB1DB, 0x65CC, 0xB1DC, 0x65CD, 0xD5A8, 0x65CE, 0xB1DD, - 0x65CF, 0xB1DA, 0x65D0, 0xD97D, 0x65D2, 0xD97E, 0x65D3, 0xDDBE, - 0x65D6, 0xBA59, 0x65D7, 0xBA58, 0x65DA, 0xECF1, 0x65DB, 0xEFD9, - 0x65DD, 0xF24A, 0x65DE, 0xF249, 0x65DF, 0xF44F, 0x65E1, 0xC95E, - 0x65E2, 0xAC4A, 0x65E5, 0xA4E9, 0x65E6, 0xA5B9, 0x65E8, 0xA6AE, - 0x65E9, 0xA6AD, 0x65EC, 0xA6AF, 0x65ED, 0xA6B0, 0x65EE, 0xC9EE, - 0x65EF, 0xC9ED, 0x65F0, 0xCAF8, 0x65F1, 0xA7F2, 0x65F2, 0xCAFB, - 0x65F3, 0xCAFA, 0x65F4, 0xCAF9, 0x65F5, 0xCAFC, 0x65FA, 0xA9F4, - 0x65FB, 0xCCC9, 0x65FC, 0xCCC5, 0x65FD, 0xCCCE, 0x6600, 0xA9FB, - 0x6602, 0xA9F9, 0x6603, 0xCCCA, 0x6604, 0xCCC6, 0x6605, 0xCCCD, - 0x6606, 0xA9F8, 0x6607, 0xAA40, 0x6608, 0xCCC8, 0x6609, 0xCCC4, - 0x660A, 0xA9FE, 0x660B, 0xCCCB, 0x660C, 0xA9F7, 0x660D, 0xCCCC, - 0x660E, 0xA9FA, 0x660F, 0xA9FC, 0x6610, 0xCCD0, 0x6611, 0xCCCF, - 0x6612, 0xCCC7, 0x6613, 0xA9F6, 0x6614, 0xA9F5, 0x6615, 0xA9FD, - 0x661C, 0xCEEF, 0x661D, 0xCEF5, 0x661F, 0xAC50, 0x6620, 0xAC4D, - 0x6621, 0xCEEC, 0x6622, 0xCEF1, 0x6624, 0xAC53, 0x6625, 0xAC4B, - 0x6626, 0xCEF0, 0x6627, 0xAC4E, 0x6628, 0xAC51, 0x662B, 0xCEF3, - 0x662D, 0xAC4C, 0x662E, 0xCEF8, 0x662F, 0xAC4F, 0x6631, 0xAC52, - 0x6632, 0xCEED, 0x6633, 0xCEF2, 0x6634, 0xCEF6, 0x6635, 0xCEEE, - 0x6636, 0xCEEB, 0x6639, 0xCEF7, 0x663A, 0xCEF4, 0x6641, 0xAED0, - 0x6642, 0xAEC9, 0x6643, 0xAECC, 0x6645, 0xAECF, 0x6647, 0xD1D5, - 0x6649, 0xAECA, 0x664A, 0xD1D3, 0x664C, 0xAECE, 0x664F, 0xAECB, - 0x6651, 0xD1D6, 0x6652, 0xAECD, 0x6659, 0xD5AC, 0x665A, 0xB1DF, - 0x665B, 0xD5AB, 0x665C, 0xD5AD, 0x665D, 0xB1DE, 0x665E, 0xB1E3, - 0x665F, 0xD1D4, 0x6661, 0xD5AA, 0x6662, 0xD5AE, 0x6664, 0xB1E0, - 0x6665, 0xD5A9, 0x6666, 0xB1E2, 0x6668, 0xB1E1, 0x666A, 0xD9A7, - 0x666C, 0xD9A2, 0x666E, 0xB4B6, 0x666F, 0xB4BA, 0x6670, 0xB4B7, - 0x6671, 0xD9A5, 0x6672, 0xD9A8, 0x6674, 0xB4B8, 0x6676, 0xB4B9, - 0x6677, 0xB4BE, 0x6678, 0xDDC7, 0x6679, 0xD9A6, 0x667A, 0xB4BC, - 0x667B, 0xD9A3, 0x667C, 0xD9A1, 0x667E, 0xB4BD, 0x6680, 0xD9A4, - 0x6684, 0xB779, 0x6686, 0xDDBF, 0x6687, 0xB776, 0x6688, 0xB777, - 0x6689, 0xB775, 0x668A, 0xDDC4, 0x668B, 0xDDC3, 0x668C, 0xDDC0, - 0x668D, 0xB77B, 0x6690, 0xDDC2, 0x6691, 0xB4BB, 0x6694, 0xDDC6, - 0x6695, 0xDDC1, 0x6696, 0xB778, 0x6697, 0xB774, 0x6698, 0xB77A, - 0x6699, 0xDDC5, 0x669D, 0xBA5C, 0x669F, 0xE1F8, 0x66A0, 0xE1F7, - 0x66A1, 0xE1F6, 0x66A2, 0xBA5A, 0x66A8, 0xBA5B, 0x66A9, 0xE5C5, - 0x66AA, 0xE5C8, 0x66AB, 0xBCC8, 0x66AE, 0xBCC7, 0x66AF, 0xE5C9, - 0x66B0, 0xE5C4, 0x66B1, 0xBCCA, 0x66B2, 0xE5C6, 0x66B4, 0xBCC9, - 0x66B5, 0xE5C3, 0x66B7, 0xE5C7, 0x66B8, 0xBEE9, 0x66B9, 0xBEE6, - 0x66BA, 0xE9BB, 0x66BB, 0xE9BA, 0x66BD, 0xE9B9, 0x66BE, 0xE9B4, - 0x66C0, 0xE9B5, 0x66C4, 0xBEE7, 0x66C6, 0xBEE4, 0x66C7, 0xBEE8, - 0x66C8, 0xE9B3, 0x66C9, 0xBEE5, 0x66CA, 0xE9B6, 0x66CB, 0xE9B7, - 0x66CC, 0xE9BC, 0x66CF, 0xE9B8, 0x66D2, 0xECF2, 0x66D6, 0xC0C7, - 0x66D8, 0xEFDC, 0x66D9, 0xC0C6, 0x66DA, 0xEFDA, 0x66DB, 0xEFDB, - 0x66DC, 0xC260, 0x66DD, 0xC36E, 0x66DE, 0xF24B, 0x66E0, 0xC36D, - 0x66E3, 0xF451, 0x66E4, 0xF452, 0x66E6, 0xC466, 0x66E8, 0xF450, - 0x66E9, 0xC4E4, 0x66EB, 0xF7DF, 0x66EC, 0xC5CE, 0x66ED, 0xF8AA, - 0x66EE, 0xF8AB, 0x66F0, 0xA4EA, 0x66F2, 0xA6B1, 0x66F3, 0xA6B2, - 0x66F4, 0xA7F3, 0x66F6, 0xCCD1, 0x66F7, 0xAC54, 0x66F8, 0xAED1, - 0x66F9, 0xB1E4, 0x66FC, 0xB0D2, 0x66FE, 0xB4BF, 0x66FF, 0xB4C0, - 0x6700, 0xB3CC, 0x6701, 0xD9A9, 0x6703, 0xB77C, 0x6704, 0xE1FA, - 0x6705, 0xE1F9, 0x6708, 0xA4EB, 0x6709, 0xA6B3, 0x670A, 0xCCD2, - 0x670B, 0xAA42, 0x670D, 0xAA41, 0x670F, 0xCEF9, 0x6710, 0xCEFA, - 0x6712, 0xD1D7, 0x6713, 0xD1D8, 0x6714, 0xAED2, 0x6715, 0xAED3, - 0x6717, 0xAED4, 0x6718, 0xD5AF, 0x671B, 0xB1E6, 0x671D, 0xB4C2, - 0x671F, 0xB4C1, 0x6720, 0xDDC8, 0x6721, 0xDF7A, 0x6722, 0xE1FB, - 0x6723, 0xE9BD, 0x6726, 0xC261, 0x6727, 0xC467, 0x6728, 0xA4EC, - 0x672A, 0xA5BC, 0x672B, 0xA5BD, 0x672C, 0xA5BB, 0x672D, 0xA5BE, - 0x672E, 0xA5BA, 0x6731, 0xA6B6, 0x6733, 0xC9F6, 0x6734, 0xA6B5, - 0x6735, 0xA6B7, 0x6738, 0xC9F1, 0x6739, 0xC9F0, 0x673A, 0xC9F3, - 0x673B, 0xC9F2, 0x673C, 0xC9F5, 0x673D, 0xA6B4, 0x673E, 0xC9EF, - 0x673F, 0xC9F4, 0x6745, 0xCAFD, 0x6746, 0xA7FD, 0x6747, 0xCAFE, - 0x6748, 0xCB43, 0x6749, 0xA7FC, 0x674B, 0xCB47, 0x674C, 0xCB42, - 0x674D, 0xCB45, 0x674E, 0xA7F5, 0x674F, 0xA7F6, 0x6750, 0xA7F7, - 0x6751, 0xA7F8, 0x6753, 0xA840, 0x6755, 0xCB41, 0x6756, 0xA7FA, - 0x6757, 0xA841, 0x6759, 0xCB40, 0x675A, 0xCB46, 0x675C, 0xA7F9, - 0x675D, 0xCB44, 0x675E, 0xA7FB, 0x675F, 0xA7F4, 0x6760, 0xA7FE, - 0x676A, 0xAA57, 0x676C, 0xCCD4, 0x676D, 0xAA43, 0x676F, 0xAA4D, - 0x6770, 0xAA4E, 0x6771, 0xAA46, 0x6772, 0xAA58, 0x6773, 0xAA48, - 0x6774, 0xCCDC, 0x6775, 0xAA53, 0x6776, 0xCCD7, 0x6777, 0xAA49, - 0x6778, 0xCCE6, 0x6779, 0xCCE7, 0x677A, 0xCCDF, 0x677B, 0xCCD8, - 0x677C, 0xAA56, 0x677D, 0xCCE4, 0x677E, 0xAA51, 0x677F, 0xAA4F, - 0x6781, 0xCCE5, 0x6783, 0xCCE3, 0x6784, 0xCCDB, 0x6785, 0xCCD3, - 0x6786, 0xCCDA, 0x6787, 0xAA4A, 0x6789, 0xAA50, 0x678B, 0xAA44, - 0x678C, 0xCCDE, 0x678D, 0xCCDD, 0x678E, 0xCCD5, 0x6790, 0xAA52, - 0x6791, 0xCCE1, 0x6792, 0xCCD6, 0x6793, 0xAA55, 0x6794, 0xCCE8, - 0x6795, 0xAA45, 0x6797, 0xAA4C, 0x6798, 0xCCD9, 0x6799, 0xCCE2, - 0x679A, 0xAA54, 0x679C, 0xAA47, 0x679D, 0xAA4B, 0x679F, 0xCCE0, - 0x67AE, 0xCF5B, 0x67AF, 0xAC5C, 0x67B0, 0xAC69, 0x67B2, 0xCF56, - 0x67B3, 0xCF4C, 0x67B4, 0xAC62, 0x67B5, 0xCF4A, 0x67B6, 0xAC5B, - 0x67B7, 0xCF45, 0x67B8, 0xAC65, 0x67B9, 0xCF52, 0x67BA, 0xCEFE, - 0x67BB, 0xCF41, 0x67C0, 0xCF44, 0x67C1, 0xCEFB, 0x67C2, 0xCF51, - 0x67C3, 0xCF61, 0x67C4, 0xAC60, 0x67C5, 0xCF46, 0x67C6, 0xCF58, - 0x67C8, 0xCEFD, 0x67C9, 0xCF5F, 0x67CA, 0xCF60, 0x67CB, 0xCF63, - 0x67CC, 0xCF5A, 0x67CD, 0xCF4B, 0x67CE, 0xCF53, 0x67CF, 0xAC66, - 0x67D0, 0xAC59, 0x67D1, 0xAC61, 0x67D2, 0xAC6D, 0x67D3, 0xAC56, - 0x67D4, 0xAC58, 0x67D8, 0xCF43, 0x67D9, 0xAC6A, 0x67DA, 0xAC63, - 0x67DB, 0xCF5D, 0x67DC, 0xCF40, 0x67DD, 0xAC6C, 0x67DE, 0xAC67, - 0x67DF, 0xCF49, 0x67E2, 0xAC6B, 0x67E3, 0xCF50, 0x67E4, 0xCF48, - 0x67E5, 0xAC64, 0x67E6, 0xCF5C, 0x67E7, 0xCF54, 0x67E9, 0xAC5E, - 0x67EA, 0xCF62, 0x67EB, 0xCF47, 0x67EC, 0xAC5A, 0x67ED, 0xCF59, - 0x67EE, 0xCF4F, 0x67EF, 0xAC5F, 0x67F0, 0xCF55, 0x67F1, 0xAC57, - 0x67F2, 0xCEFC, 0x67F3, 0xAC68, 0x67F4, 0xAEE3, 0x67F5, 0xAC5D, - 0x67F6, 0xCF4E, 0x67F7, 0xCF4D, 0x67F8, 0xCF42, 0x67FA, 0xCF5E, - 0x67FC, 0xCF57, 0x67FF, 0xAC55, 0x6812, 0xD1EC, 0x6813, 0xAEEA, - 0x6814, 0xD1ED, 0x6816, 0xD1E1, 0x6817, 0xAEDF, 0x6818, 0xAEEB, - 0x681A, 0xD1DA, 0x681C, 0xD1E3, 0x681D, 0xD1EB, 0x681F, 0xD1D9, - 0x6820, 0xD1F4, 0x6821, 0xAED5, 0x6825, 0xD1F3, 0x6826, 0xD1EE, - 0x6828, 0xD1EF, 0x6829, 0xAEDD, 0x682A, 0xAEE8, 0x682B, 0xD1E5, - 0x682D, 0xD1E6, 0x682E, 0xD1F0, 0x682F, 0xD1E7, 0x6831, 0xD1E2, - 0x6832, 0xD1DC, 0x6833, 0xD1DD, 0x6834, 0xD1EA, 0x6835, 0xD1E4, - 0x6838, 0xAED6, 0x6839, 0xAEDA, 0x683A, 0xD1F2, 0x683B, 0xD1DE, - 0x683C, 0xAEE6, 0x683D, 0xAEE2, 0x6840, 0xAEE5, 0x6841, 0xAEEC, - 0x6842, 0xAEDB, 0x6843, 0xAEE7, 0x6844, 0xD1E9, 0x6845, 0xAEE9, - 0x6846, 0xAED8, 0x6848, 0xAED7, 0x6849, 0xD1DB, 0x684B, 0xD1DF, - 0x684C, 0xAEE0, 0x684D, 0xD1F1, 0x684E, 0xD1E8, 0x684F, 0xD1E0, - 0x6850, 0xAEE4, 0x6851, 0xAEE1, 0x6853, 0xAED9, 0x6854, 0xAEDC, - 0x686B, 0xD5C4, 0x686D, 0xD5B4, 0x686E, 0xD5B5, 0x686F, 0xD5B9, - 0x6871, 0xD5C8, 0x6872, 0xD5C5, 0x6874, 0xD5BE, 0x6875, 0xD5BD, - 0x6876, 0xB1ED, 0x6877, 0xD5C1, 0x6878, 0xD5D0, 0x6879, 0xD5B0, - 0x687B, 0xD5D1, 0x687C, 0xD5C3, 0x687D, 0xD5D5, 0x687E, 0xD5C9, - 0x687F, 0xB1EC, 0x6880, 0xD5C7, 0x6881, 0xB1E7, 0x6882, 0xB1FC, - 0x6883, 0xB1F2, 0x6885, 0xB1F6, 0x6886, 0xB1F5, 0x6887, 0xD5B1, - 0x6889, 0xD5CE, 0x688A, 0xD5D4, 0x688B, 0xD5CC, 0x688C, 0xD5D3, - 0x688F, 0xD5C0, 0x6890, 0xD5B2, 0x6891, 0xD5D2, 0x6892, 0xD5C2, - 0x6893, 0xB1EA, 0x6894, 0xB1F7, 0x6896, 0xD5CB, 0x6897, 0xB1F0, - 0x689B, 0xD5CA, 0x689C, 0xD5B3, 0x689D, 0xB1F8, 0x689F, 0xB1FA, - 0x68A0, 0xD5CD, 0x68A1, 0xB1FB, 0x68A2, 0xB1E9, 0x68A3, 0xD5BA, - 0x68A4, 0xD5CF, 0x68A7, 0xB1EF, 0x68A8, 0xB1F9, 0x68A9, 0xD5BC, - 0x68AA, 0xD5C6, 0x68AB, 0xD5B7, 0x68AC, 0xD5BB, 0x68AD, 0xB1F4, - 0x68AE, 0xD5B6, 0x68AF, 0xB1E8, 0x68B0, 0xB1F1, 0x68B1, 0xB1EE, - 0x68B2, 0xD5BF, 0x68B3, 0xAEDE, 0x68B4, 0xD9C0, 0x68B5, 0xB1EB, - 0x68C4, 0xB1F3, 0x68C6, 0xD9C3, 0x68C7, 0xD9D9, 0x68C8, 0xD9CE, - 0x68C9, 0xB4D6, 0x68CB, 0xB4D1, 0x68CC, 0xD9BD, 0x68CD, 0xB4D2, - 0x68CE, 0xD9CD, 0x68D0, 0xD9C6, 0x68D1, 0xD9D3, 0x68D2, 0xB4CE, - 0x68D3, 0xD9AB, 0x68D4, 0xD9D5, 0x68D5, 0xB4C4, 0x68D6, 0xD9B3, - 0x68D7, 0xB4C7, 0x68D8, 0xB4C6, 0x68DA, 0xB4D7, 0x68DC, 0xD9AD, - 0x68DD, 0xD9CF, 0x68DE, 0xD9D0, 0x68DF, 0xB4C9, 0x68E0, 0xB4C5, - 0x68E1, 0xD9BB, 0x68E3, 0xB4D0, 0x68E4, 0xD9B6, 0x68E6, 0xD9D1, - 0x68E7, 0xB4CC, 0x68E8, 0xD9C9, 0x68E9, 0xD9D6, 0x68EA, 0xD9B0, - 0x68EB, 0xD9B5, 0x68EC, 0xD9AF, 0x68EE, 0xB4CB, 0x68EF, 0xD9C2, - 0x68F0, 0xDDDE, 0x68F1, 0xD9B1, 0x68F2, 0xB4CF, 0x68F3, 0xD9BA, - 0x68F4, 0xD9D2, 0x68F5, 0xB4CA, 0x68F6, 0xD9B7, 0x68F7, 0xD9B4, - 0x68F8, 0xD9C5, 0x68F9, 0xB4CD, 0x68FA, 0xB4C3, 0x68FB, 0xB4D9, - 0x68FC, 0xD9C8, 0x68FD, 0xD9C7, 0x6904, 0xD9AC, 0x6905, 0xB4C8, - 0x6906, 0xD9D4, 0x6907, 0xD9BC, 0x6908, 0xD9BE, 0x690A, 0xD9CB, - 0x690B, 0xD9CA, 0x690C, 0xD9AA, 0x690D, 0xB4D3, 0x690E, 0xB4D5, - 0x690F, 0xD9B2, 0x6910, 0xD9B9, 0x6911, 0xD9C1, 0x6912, 0xB4D4, - 0x6913, 0xD9B8, 0x6914, 0xD9C4, 0x6915, 0xD9D7, 0x6917, 0xD9CC, - 0x6925, 0xD9D8, 0x692A, 0xD9AE, 0x692F, 0xDDF2, 0x6930, 0xB7A6, - 0x6932, 0xDDF0, 0x6933, 0xDDDB, 0x6934, 0xDDE0, 0x6935, 0xDDD9, - 0x6937, 0xDDEC, 0x6938, 0xDDCB, 0x6939, 0xDDD2, 0x693B, 0xDDEA, - 0x693C, 0xDDF4, 0x693D, 0xDDDC, 0x693F, 0xDDCF, 0x6940, 0xDDE2, - 0x6941, 0xDDE7, 0x6942, 0xDDD3, 0x6944, 0xDDE4, 0x6945, 0xDDD0, - 0x6948, 0xDDD7, 0x6949, 0xDDD8, 0x694A, 0xB7A8, 0x694B, 0xDDEB, - 0x694C, 0xDDE9, 0x694E, 0xDDCC, 0x694F, 0xDDEE, 0x6951, 0xDDEF, - 0x6952, 0xDDF1, 0x6953, 0xB7AC, 0x6954, 0xB7A4, 0x6956, 0xD5B8, - 0x6957, 0xDDD4, 0x6958, 0xDDE6, 0x6959, 0xDDD5, 0x695A, 0xB7A1, - 0x695B, 0xB7B1, 0x695C, 0xDDED, 0x695D, 0xB7AF, 0x695E, 0xB7AB, - 0x695F, 0xDDCA, 0x6960, 0xB7A3, 0x6962, 0xDDCD, 0x6963, 0xB7B0, - 0x6965, 0xDDDD, 0x6966, 0xDDC9, 0x6968, 0xB7A9, 0x6969, 0xDDE1, - 0x696A, 0xDDD1, 0x696B, 0xB7AA, 0x696C, 0xDDDA, 0x696D, 0xB77E, - 0x696E, 0xB4D8, 0x696F, 0xDDE3, 0x6970, 0xD9BF, 0x6971, 0xDDCE, - 0x6974, 0xDDE8, 0x6975, 0xB7A5, 0x6976, 0xDDE5, 0x6977, 0xB7A2, - 0x6978, 0xDDDF, 0x6979, 0xB7AD, 0x697A, 0xDDD6, 0x697B, 0xDDF3, - 0x6982, 0xB7A7, 0x6983, 0xDEC6, 0x6986, 0xB7AE, 0x698D, 0xE24A, - 0x698E, 0xE248, 0x6990, 0xE25E, 0x6991, 0xE246, 0x6993, 0xE258, - 0x6994, 0xB77D, 0x6995, 0xBA5F, 0x6996, 0xE242, 0x6997, 0xE25D, - 0x6999, 0xE247, 0x699A, 0xE255, 0x699B, 0xBA64, 0x699C, 0xBA5D, - 0x699E, 0xE25B, 0x69A0, 0xE240, 0x69A1, 0xE25A, 0x69A3, 0xBA6F, - 0x69A4, 0xE251, 0x69A5, 0xE261, 0x69A6, 0xBA6D, 0x69A7, 0xE249, - 0x69A8, 0xBA5E, 0x69A9, 0xE24B, 0x69AA, 0xE259, 0x69AB, 0xBA67, - 0x69AC, 0xE244, 0x69AD, 0xBA6B, 0x69AE, 0xBA61, 0x69AF, 0xE24D, - 0x69B0, 0xE243, 0x69B1, 0xE1FC, 0x69B3, 0xE257, 0x69B4, 0xBA68, - 0x69B5, 0xE260, 0x69B6, 0xE1FD, 0x69B7, 0xBA65, 0x69B9, 0xE253, - 0x69BB, 0xBA66, 0x69BC, 0xE245, 0x69BD, 0xE250, 0x69BE, 0xE24C, - 0x69BF, 0xE24E, 0x69C1, 0xBA60, 0x69C2, 0xE25F, 0x69C3, 0xBA6E, - 0x69C4, 0xE24F, 0x69C6, 0xE262, 0x69C9, 0xE1FE, 0x69CA, 0xE254, - 0x69CB, 0xBA63, 0x69CC, 0xBA6C, 0x69CD, 0xBA6A, 0x69CE, 0xE241, - 0x69CF, 0xE256, 0x69D0, 0xBA69, 0x69D3, 0xBA62, 0x69D4, 0xE252, - 0x69D9, 0xE25C, 0x69E2, 0xE5D5, 0x69E4, 0xE5D1, 0x69E5, 0xE5CD, - 0x69E6, 0xE5E1, 0x69E7, 0xE5DE, 0x69E8, 0xBCCD, 0x69EB, 0xE5E5, - 0x69EC, 0xE5D4, 0x69ED, 0xBCD8, 0x69EE, 0xE5DB, 0x69F1, 0xE5D0, - 0x69F2, 0xE5DA, 0x69F3, 0xBCD5, 0x69F4, 0xE5EE, 0x69F6, 0xE5EB, - 0x69F7, 0xE5DD, 0x69F8, 0xE5CE, 0x69FB, 0xE5E2, 0x69FC, 0xE5E4, - 0x69FD, 0xBCD1, 0x69FE, 0xE5D8, 0x69FF, 0xE5D3, 0x6A00, 0xE5CA, - 0x6A01, 0xBCCE, 0x6A02, 0xBCD6, 0x6A04, 0xE5E7, 0x6A05, 0xBCD7, - 0x6A06, 0xE5CB, 0x6A07, 0xE5ED, 0x6A08, 0xE5E0, 0x6A09, 0xE5E6, - 0x6A0A, 0xBCD4, 0x6A0D, 0xE5E3, 0x6A0F, 0xE5EA, 0x6A11, 0xBCD9, - 0x6A13, 0xBCD3, 0x6A14, 0xE5DC, 0x6A15, 0xE5CF, 0x6A16, 0xE5EF, - 0x6A17, 0xE5CC, 0x6A18, 0xE5E8, 0x6A19, 0xBCD0, 0x6A1B, 0xE5D6, - 0x6A1D, 0xE5D7, 0x6A1E, 0xBCCF, 0x6A1F, 0xBCCC, 0x6A20, 0xE5D2, - 0x6A21, 0xBCD2, 0x6A23, 0xBCCB, 0x6A25, 0xE5E9, 0x6A26, 0xE5EC, - 0x6A27, 0xE5D9, 0x6A28, 0xE9CA, 0x6A32, 0xE9C2, 0x6A34, 0xE9BE, - 0x6A35, 0xBEF6, 0x6A38, 0xBEEB, 0x6A39, 0xBEF0, 0x6A3A, 0xBEEC, - 0x6A3B, 0xE9CC, 0x6A3C, 0xE9D7, 0x6A3D, 0xBEEA, 0x6A3E, 0xE9C4, - 0x6A3F, 0xE9CD, 0x6A40, 0xE5DF, 0x6A41, 0xE9CE, 0x6A44, 0xBEF1, - 0x6A46, 0xE9DD, 0x6A47, 0xBEF5, 0x6A48, 0xBEF8, 0x6A49, 0xE9C0, - 0x6A4B, 0xBEF4, 0x6A4D, 0xE9DB, 0x6A4E, 0xE9DC, 0x6A4F, 0xE9D2, - 0x6A50, 0xE9D1, 0x6A51, 0xE9C9, 0x6A54, 0xE9D3, 0x6A55, 0xE9DA, - 0x6A56, 0xE9D9, 0x6A58, 0xBEEF, 0x6A59, 0xBEED, 0x6A5A, 0xE9CB, - 0x6A5B, 0xE9C8, 0x6A5D, 0xE9C5, 0x6A5E, 0xE9D8, 0x6A5F, 0xBEF7, - 0x6A60, 0xE9D6, 0x6A61, 0xBEF3, 0x6A62, 0xBEF2, 0x6A64, 0xE9D0, - 0x6A66, 0xE9BF, 0x6A67, 0xE9C1, 0x6A68, 0xE9C3, 0x6A69, 0xE9D5, - 0x6A6A, 0xE9CF, 0x6A6B, 0xBEEE, 0x6A6D, 0xE9C6, 0x6A6F, 0xE9D4, - 0x6A76, 0xE9C7, 0x6A7E, 0xC0CF, 0x6A7F, 0xED45, 0x6A80, 0xC0C8, - 0x6A81, 0xECF5, 0x6A83, 0xED41, 0x6A84, 0xC0CA, 0x6A85, 0xED48, - 0x6A87, 0xECFC, 0x6A89, 0xECF7, 0x6A8C, 0xED49, 0x6A8D, 0xECF3, - 0x6A8E, 0xECFE, 0x6A90, 0xC0D1, 0x6A91, 0xED44, 0x6A92, 0xED4A, - 0x6A93, 0xECFD, 0x6A94, 0xC0C9, 0x6A95, 0xED40, 0x6A96, 0xECF4, - 0x6A97, 0xC0D0, 0x6A9A, 0xED47, 0x6A9B, 0xECF9, 0x6A9C, 0xC0CC, - 0x6A9E, 0xECFB, 0x6A9F, 0xECF8, 0x6AA0, 0xC0D2, 0x6AA1, 0xECFA, - 0x6AA2, 0xC0CB, 0x6AA3, 0xC0CE, 0x6AA4, 0xED43, 0x6AA5, 0xECF6, - 0x6AA6, 0xED46, 0x6AA8, 0xED42, 0x6AAC, 0xC263, 0x6AAD, 0xEFE7, - 0x6AAE, 0xC268, 0x6AAF, 0xC269, 0x6AB3, 0xC262, 0x6AB4, 0xEFE6, - 0x6AB6, 0xEFE3, 0x6AB7, 0xEFE4, 0x6AB8, 0xC266, 0x6AB9, 0xEFDE, - 0x6ABA, 0xEFE2, 0x6ABB, 0xC265, 0x6ABD, 0xEFDF, 0x6AC2, 0xC267, - 0x6AC3, 0xC264, 0x6AC5, 0xEFDD, 0x6AC6, 0xEFE1, 0x6AC7, 0xEFE5, - 0x6ACB, 0xF251, 0x6ACC, 0xF24E, 0x6ACD, 0xF257, 0x6ACF, 0xF256, - 0x6AD0, 0xF254, 0x6AD1, 0xF24F, 0x6AD3, 0xC372, 0x6AD9, 0xF250, - 0x6ADA, 0xC371, 0x6ADB, 0xC0CD, 0x6ADC, 0xF253, 0x6ADD, 0xC370, - 0x6ADE, 0xF258, 0x6ADF, 0xF252, 0x6AE0, 0xF24D, 0x6AE1, 0xEFE0, - 0x6AE5, 0xC36F, 0x6AE7, 0xF24C, 0x6AE8, 0xF456, 0x6AEA, 0xF455, - 0x6AEB, 0xF255, 0x6AEC, 0xC468, 0x6AEE, 0xF459, 0x6AEF, 0xF45A, - 0x6AF0, 0xF454, 0x6AF1, 0xF458, 0x6AF3, 0xF453, 0x6AF8, 0xF5D1, - 0x6AF9, 0xF457, 0x6AFA, 0xC4E7, 0x6AFB, 0xC4E5, 0x6AFC, 0xF5CF, - 0x6B00, 0xF5D2, 0x6B02, 0xF5CE, 0x6B03, 0xF5D0, 0x6B04, 0xC4E6, - 0x6B08, 0xF6E5, 0x6B09, 0xF6E6, 0x6B0A, 0xC576, 0x6B0B, 0xF6E4, - 0x6B0F, 0xF7E2, 0x6B10, 0xC5CF, 0x6B11, 0xF7E0, 0x6B12, 0xF7E1, - 0x6B13, 0xF8AC, 0x6B16, 0xC656, 0x6B17, 0xF8F3, 0x6B18, 0xF8F1, - 0x6B19, 0xF8F2, 0x6B1A, 0xF8F4, 0x6B1E, 0xF9BB, 0x6B20, 0xA4ED, - 0x6B21, 0xA6B8, 0x6B23, 0xAA59, 0x6B25, 0xCCE9, 0x6B28, 0xCF64, - 0x6B2C, 0xD1F5, 0x6B2D, 0xD1F7, 0x6B2F, 0xD1F6, 0x6B31, 0xD1F8, - 0x6B32, 0xB1FD, 0x6B33, 0xD5D7, 0x6B34, 0xD1F9, 0x6B36, 0xD5D6, - 0x6B37, 0xD5D8, 0x6B38, 0xD5D9, 0x6B39, 0xD9DA, 0x6B3A, 0xB4DB, - 0x6B3B, 0xD9DB, 0x6B3C, 0xD9DD, 0x6B3D, 0xB4DC, 0x6B3E, 0xB4DA, - 0x6B3F, 0xD9DC, 0x6B41, 0xDDFA, 0x6B42, 0xDDF8, 0x6B43, 0xDDF7, - 0x6B45, 0xDDF6, 0x6B46, 0xDDF5, 0x6B47, 0xB7B2, 0x6B48, 0xDDF9, - 0x6B49, 0xBA70, 0x6B4A, 0xE263, 0x6B4B, 0xE265, 0x6B4C, 0xBA71, - 0x6B4D, 0xE264, 0x6B4E, 0xBCDB, 0x6B50, 0xBCDA, 0x6B51, 0xE5F0, - 0x6B54, 0xE9DF, 0x6B55, 0xE9DE, 0x6B56, 0xE9E0, 0x6B59, 0xBEF9, - 0x6B5B, 0xED4B, 0x6B5C, 0xC0D3, 0x6B5E, 0xEFE8, 0x6B5F, 0xC26A, - 0x6B60, 0xF259, 0x6B61, 0xC577, 0x6B62, 0xA4EE, 0x6B63, 0xA5BF, - 0x6B64, 0xA6B9, 0x6B65, 0xA842, 0x6B66, 0xAA5A, 0x6B67, 0xAA5B, - 0x6B6A, 0xAC6E, 0x6B6D, 0xD1FA, 0x6B72, 0xB7B3, 0x6B76, 0xE6D1, - 0x6B77, 0xBEFA, 0x6B78, 0xC26B, 0x6B79, 0xA4EF, 0x6B7B, 0xA6BA, - 0x6B7E, 0xCCEB, 0x6B7F, 0xAA5C, 0x6B80, 0xCCEA, 0x6B82, 0xCF65, - 0x6B83, 0xAC6F, 0x6B84, 0xCF66, 0x6B86, 0xAC70, 0x6B88, 0xD1FC, - 0x6B89, 0xAEEE, 0x6B8A, 0xAEED, 0x6B8C, 0xD5DE, 0x6B8D, 0xD5DC, - 0x6B8E, 0xD5DD, 0x6B8F, 0xD5DB, 0x6B91, 0xD5DA, 0x6B94, 0xD9DE, - 0x6B95, 0xD9E1, 0x6B96, 0xB4DE, 0x6B97, 0xD9DF, 0x6B98, 0xB4DD, - 0x6B99, 0xD9E0, 0x6B9B, 0xDDFB, 0x6B9E, 0xE266, 0x6B9F, 0xE267, - 0x6BA0, 0xE268, 0x6BA2, 0xE5F3, 0x6BA3, 0xE5F2, 0x6BA4, 0xBCDC, - 0x6BA5, 0xE5F1, 0x6BA6, 0xE5F4, 0x6BA7, 0xE9E1, 0x6BAA, 0xE9E2, - 0x6BAB, 0xE9E3, 0x6BAD, 0xED4C, 0x6BAE, 0xC0D4, 0x6BAF, 0xC26C, - 0x6BB0, 0xF25A, 0x6BB2, 0xC4E8, 0x6BB3, 0xC95F, 0x6BB5, 0xAC71, - 0x6BB6, 0xCF67, 0x6BB7, 0xAEEF, 0x6BBA, 0xB1FE, 0x6BBC, 0xB4DF, - 0x6BBD, 0xD9E2, 0x6BBF, 0xB7B5, 0x6BC0, 0xB7B4, 0x6BC3, 0xE269, - 0x6BC4, 0xE26A, 0x6BC5, 0xBCDD, 0x6BC6, 0xBCDE, 0x6BC7, 0xE9E5, - 0x6BC8, 0xE9E4, 0x6BC9, 0xEFE9, 0x6BCA, 0xF7E3, 0x6BCB, 0xA4F0, - 0x6BCC, 0xC960, 0x6BCD, 0xA5C0, 0x6BCF, 0xA843, 0x6BD0, 0xCB48, - 0x6BD2, 0xAC72, 0x6BD3, 0xB7B6, 0x6BD4, 0xA4F1, 0x6BD6, 0xCF68, - 0x6BD7, 0xAC73, 0x6BD8, 0xCF69, 0x6BDA, 0xC0D5, 0x6BDB, 0xA4F2, - 0x6BDE, 0xCCEC, 0x6BE0, 0xCF6A, 0x6BE2, 0xD242, 0x6BE3, 0xD241, - 0x6BE4, 0xD1FE, 0x6BE6, 0xD1FD, 0x6BE7, 0xD243, 0x6BE8, 0xD240, - 0x6BEB, 0xB240, 0x6BEC, 0xB241, 0x6BEF, 0xB4E0, 0x6BF0, 0xD9E3, - 0x6BF2, 0xD9E4, 0x6BF3, 0xD9E5, 0x6BF7, 0xDE41, 0x6BF8, 0xDE42, - 0x6BF9, 0xDE40, 0x6BFB, 0xDDFD, 0x6BFC, 0xDDFE, 0x6BFD, 0xB7B7, - 0x6BFE, 0xE26B, 0x6BFF, 0xE5F7, 0x6C00, 0xE5F6, 0x6C01, 0xE5F5, - 0x6C02, 0xE5F8, 0x6C03, 0xE9E7, 0x6C04, 0xE9E6, 0x6C05, 0xBEFB, - 0x6C06, 0xE9E8, 0x6C08, 0xC0D6, 0x6C09, 0xED4D, 0x6C0B, 0xEFEA, - 0x6C0C, 0xF25B, 0x6C0D, 0xF6E7, 0x6C0F, 0xA4F3, 0x6C10, 0xA5C2, - 0x6C11, 0xA5C1, 0x6C13, 0xAA5D, 0x6C14, 0xC961, 0x6C15, 0xC97E, - 0x6C16, 0xA6BB, 0x6C18, 0xC9F7, 0x6C19, 0xCB49, 0x6C1A, 0xCB4A, - 0x6C1B, 0xAA5E, 0x6C1D, 0xCCED, 0x6C1F, 0xAC74, 0x6C20, 0xCF6B, - 0x6C21, 0xCF6C, 0x6C23, 0xAEF0, 0x6C24, 0xAEF4, 0x6C25, 0xD244, - 0x6C26, 0xAEF3, 0x6C27, 0xAEF1, 0x6C28, 0xAEF2, 0x6C2A, 0xD5DF, - 0x6C2B, 0xB242, 0x6C2C, 0xB4E3, 0x6C2E, 0xB4E1, 0x6C2F, 0xB4E2, - 0x6C30, 0xD9E6, 0x6C33, 0xBA72, 0x6C34, 0xA4F4, 0x6C36, 0xC9A1, - 0x6C38, 0xA5C3, 0x6C3B, 0xC9A4, 0x6C3E, 0xA5C6, 0x6C3F, 0xC9A3, - 0x6C40, 0xA5C5, 0x6C41, 0xA5C4, 0x6C42, 0xA844, 0x6C43, 0xC9A2, - 0x6C46, 0xC9F8, 0x6C4A, 0xC9FC, 0x6C4B, 0xC9FE, 0x6C4C, 0xCA40, - 0x6C4D, 0xA6C5, 0x6C4E, 0xA6C6, 0x6C4F, 0xC9FB, 0x6C50, 0xA6C1, - 0x6C52, 0xC9F9, 0x6C54, 0xC9FD, 0x6C55, 0xA6C2, 0x6C57, 0xA6BD, - 0x6C59, 0xA6BE, 0x6C5B, 0xA6C4, 0x6C5C, 0xC9FA, 0x6C5D, 0xA6BC, - 0x6C5E, 0xA845, 0x6C5F, 0xA6BF, 0x6C60, 0xA6C0, 0x6C61, 0xA6C3, - 0x6C65, 0xCB5B, 0x6C66, 0xCB59, 0x6C67, 0xCB4C, 0x6C68, 0xA851, - 0x6C69, 0xCB53, 0x6C6A, 0xA84C, 0x6C6B, 0xCB4D, 0x6C6D, 0xCB55, - 0x6C6F, 0xCB52, 0x6C70, 0xA84F, 0x6C71, 0xCB51, 0x6C72, 0xA856, - 0x6C73, 0xCB5A, 0x6C74, 0xA858, 0x6C76, 0xA85A, 0x6C78, 0xCB4B, - 0x6C7A, 0xA84D, 0x6C7B, 0xCB5C, 0x6C7D, 0xA854, 0x6C7E, 0xA857, - 0x6C80, 0xCD45, 0x6C81, 0xA847, 0x6C82, 0xA85E, 0x6C83, 0xA855, - 0x6C84, 0xCB4E, 0x6C85, 0xA84A, 0x6C86, 0xA859, 0x6C87, 0xCB56, - 0x6C88, 0xA848, 0x6C89, 0xA849, 0x6C8A, 0xCD43, 0x6C8B, 0xCB4F, - 0x6C8C, 0xA850, 0x6C8D, 0xA85B, 0x6C8E, 0xCB5D, 0x6C8F, 0xCB50, - 0x6C90, 0xA84E, 0x6C92, 0xA853, 0x6C93, 0xCCEE, 0x6C94, 0xA85C, - 0x6C95, 0xCB57, 0x6C96, 0xA852, 0x6C98, 0xA85D, 0x6C99, 0xA846, - 0x6C9A, 0xCB54, 0x6C9B, 0xA84B, 0x6C9C, 0xCB58, 0x6C9D, 0xCD44, - 0x6CAB, 0xAA6A, 0x6CAC, 0xAA7A, 0x6CAD, 0xCCF5, 0x6CAE, 0xAA71, - 0x6CB0, 0xCD4B, 0x6CB1, 0xAA62, 0x6CB3, 0xAA65, 0x6CB4, 0xCD42, - 0x6CB6, 0xCCF3, 0x6CB7, 0xCCF7, 0x6CB8, 0xAA6D, 0x6CB9, 0xAA6F, - 0x6CBA, 0xCCFA, 0x6CBB, 0xAA76, 0x6CBC, 0xAA68, 0x6CBD, 0xAA66, - 0x6CBE, 0xAA67, 0x6CBF, 0xAA75, 0x6CC0, 0xCD47, 0x6CC1, 0xAA70, - 0x6CC2, 0xCCF9, 0x6CC3, 0xCCFB, 0x6CC4, 0xAA6E, 0x6CC5, 0xAA73, - 0x6CC6, 0xCCFC, 0x6CC7, 0xCD4A, 0x6CC9, 0xAC75, 0x6CCA, 0xAA79, - 0x6CCC, 0xAA63, 0x6CCD, 0xCD49, 0x6CCF, 0xCD4D, 0x6CD0, 0xCCF8, - 0x6CD1, 0xCD4F, 0x6CD2, 0xCD40, 0x6CD3, 0xAA6C, 0x6CD4, 0xCCF4, - 0x6CD5, 0xAA6B, 0x6CD6, 0xAA7D, 0x6CD7, 0xAA72, 0x6CD9, 0xCCF2, - 0x6CDA, 0xCF75, 0x6CDB, 0xAA78, 0x6CDC, 0xAA7C, 0x6CDD, 0xCD41, - 0x6CDE, 0xCD46, 0x6CE0, 0xAA7E, 0x6CE1, 0xAA77, 0x6CE2, 0xAA69, - 0x6CE3, 0xAA5F, 0x6CE5, 0xAA64, 0x6CE7, 0xCCF6, 0x6CE8, 0xAA60, - 0x6CE9, 0xCD4E, 0x6CEB, 0xCCF0, 0x6CEC, 0xCCEF, 0x6CED, 0xCCFD, - 0x6CEE, 0xCCF1, 0x6CEF, 0xAA7B, 0x6CF0, 0xAEF5, 0x6CF1, 0xAA74, - 0x6CF2, 0xCCFE, 0x6CF3, 0xAA61, 0x6CF5, 0xACA6, 0x6CF9, 0xCD4C, - 0x6D00, 0xCF7C, 0x6D01, 0xCFA1, 0x6D03, 0xCFA4, 0x6D04, 0xCF77, - 0x6D07, 0xCFA7, 0x6D08, 0xCFAA, 0x6D09, 0xCFAC, 0x6D0A, 0xCF74, - 0x6D0B, 0xAC76, 0x6D0C, 0xAC7B, 0x6D0D, 0xD249, 0x6D0E, 0xACAD, - 0x6D0F, 0xCFA5, 0x6D10, 0xCFAD, 0x6D11, 0xCF7B, 0x6D12, 0xCF73, - 0x6D16, 0xD264, 0x6D17, 0xAC7E, 0x6D18, 0xCFA2, 0x6D19, 0xCF78, - 0x6D1A, 0xCF7A, 0x6D1B, 0xACA5, 0x6D1D, 0xCF7D, 0x6D1E, 0xAC7D, - 0x6D1F, 0xCF70, 0x6D20, 0xCFA8, 0x6D22, 0xCFAB, 0x6D25, 0xAC7A, - 0x6D27, 0xACA8, 0x6D28, 0xCF6D, 0x6D29, 0xACAA, 0x6D2A, 0xAC78, - 0x6D2B, 0xACAE, 0x6D2C, 0xCFA9, 0x6D2D, 0xCF6F, 0x6D2E, 0xACAB, - 0x6D2F, 0xD25E, 0x6D30, 0xCD48, 0x6D31, 0xAC7C, 0x6D32, 0xAC77, - 0x6D33, 0xCF76, 0x6D34, 0xCF6E, 0x6D35, 0xACAC, 0x6D36, 0xACA4, - 0x6D37, 0xCFA3, 0x6D38, 0xACA9, 0x6D39, 0xACA7, 0x6D3A, 0xCF79, - 0x6D3B, 0xACA1, 0x6D3C, 0xCF71, 0x6D3D, 0xACA2, 0x6D3E, 0xACA3, - 0x6D3F, 0xCF72, 0x6D40, 0xCFA6, 0x6D41, 0xAC79, 0x6D42, 0xCF7E, - 0x6D58, 0xD24C, 0x6D59, 0xAEFD, 0x6D5A, 0xAF43, 0x6D5E, 0xD255, - 0x6D5F, 0xD25B, 0x6D60, 0xD257, 0x6D61, 0xD24A, 0x6D62, 0xD24D, - 0x6D63, 0xD246, 0x6D64, 0xD247, 0x6D65, 0xAF4A, 0x6D66, 0xAEFA, - 0x6D67, 0xD256, 0x6D68, 0xD25F, 0x6D69, 0xAF45, 0x6D6A, 0xAEF6, - 0x6D6C, 0xAF40, 0x6D6D, 0xD24E, 0x6D6E, 0xAF42, 0x6D6F, 0xD24F, - 0x6D70, 0xD259, 0x6D74, 0xAF44, 0x6D75, 0xD268, 0x6D76, 0xD248, - 0x6D77, 0xAEFC, 0x6D78, 0xAEFB, 0x6D79, 0xAF48, 0x6D7A, 0xD245, - 0x6D7B, 0xD266, 0x6D7C, 0xD25A, 0x6D7D, 0xD267, 0x6D7E, 0xD261, - 0x6D7F, 0xD253, 0x6D80, 0xD262, 0x6D82, 0xD25C, 0x6D83, 0xD265, - 0x6D84, 0xD263, 0x6D85, 0xAF49, 0x6D86, 0xD254, 0x6D87, 0xAEF9, - 0x6D88, 0xAEF8, 0x6D89, 0xAF41, 0x6D8A, 0xAF47, 0x6D8B, 0xD260, - 0x6D8C, 0xAF46, 0x6D8D, 0xD251, 0x6D8E, 0xB243, 0x6D90, 0xD269, - 0x6D91, 0xD250, 0x6D92, 0xD24B, 0x6D93, 0xAEFE, 0x6D94, 0xAF4B, - 0x6D95, 0xAEF7, 0x6D97, 0xD258, 0x6D98, 0xD25D, 0x6DAA, 0xB265, - 0x6DAB, 0xD5E1, 0x6DAC, 0xD5E5, 0x6DAE, 0xB252, 0x6DAF, 0xB250, - 0x6DB2, 0xB247, 0x6DB3, 0xD5E3, 0x6DB4, 0xD5E2, 0x6DB5, 0xB25B, - 0x6DB7, 0xD5E8, 0x6DB8, 0xB255, 0x6DBA, 0xD5FA, 0x6DBB, 0xD647, - 0x6DBC, 0xB244, 0x6DBD, 0xD5F7, 0x6DBE, 0xD5F0, 0x6DBF, 0xB267, - 0x6DC0, 0xD5E0, 0x6DC2, 0xD5FC, 0x6DC4, 0xB264, 0x6DC5, 0xB258, - 0x6DC6, 0xB263, 0x6DC7, 0xB24E, 0x6DC8, 0xD5EC, 0x6DC9, 0xD5FE, - 0x6DCA, 0xD5F6, 0x6DCB, 0xB24F, 0x6DCC, 0xB249, 0x6DCD, 0xD645, - 0x6DCF, 0xD5FD, 0x6DD0, 0xD640, 0x6DD1, 0xB251, 0x6DD2, 0xB259, - 0x6DD3, 0xD642, 0x6DD4, 0xD5EA, 0x6DD5, 0xD5FB, 0x6DD6, 0xD5EF, - 0x6DD7, 0xD644, 0x6DD8, 0xB25E, 0x6DD9, 0xB246, 0x6DDA, 0xB25C, - 0x6DDB, 0xD5F4, 0x6DDC, 0xD5F2, 0x6DDD, 0xD5F3, 0x6DDE, 0xB253, - 0x6DDF, 0xD5EE, 0x6DE0, 0xD5ED, 0x6DE1, 0xB248, 0x6DE2, 0xD5E7, - 0x6DE3, 0xD646, 0x6DE4, 0xB24A, 0x6DE5, 0xD5F1, 0x6DE6, 0xB268, - 0x6DE8, 0xB262, 0x6DE9, 0xD5E6, 0x6DEA, 0xB25F, 0x6DEB, 0xB25D, - 0x6DEC, 0xB266, 0x6DED, 0xD5F8, 0x6DEE, 0xB261, 0x6DEF, 0xD252, - 0x6DF0, 0xD5F9, 0x6DF1, 0xB260, 0x6DF2, 0xD641, 0x6DF3, 0xB245, - 0x6DF4, 0xD5F5, 0x6DF5, 0xB257, 0x6DF6, 0xD5E9, 0x6DF7, 0xB256, - 0x6DF9, 0xB254, 0x6DFA, 0xB24C, 0x6DFB, 0xB24B, 0x6DFC, 0xD9E7, - 0x6DFD, 0xD643, 0x6E00, 0xD5EB, 0x6E03, 0xD9FC, 0x6E05, 0xB24D, - 0x6E19, 0xB541, 0x6E1A, 0xB25A, 0x6E1B, 0xB4EE, 0x6E1C, 0xD9F6, - 0x6E1D, 0xB4FC, 0x6E1F, 0xD9EA, 0x6E20, 0xB4EB, 0x6E21, 0xB4E7, - 0x6E22, 0xDA49, 0x6E23, 0xB4ED, 0x6E24, 0xB4F1, 0x6E25, 0xB4EC, - 0x6E26, 0xB4F5, 0x6E27, 0xDA4D, 0x6E28, 0xDA44, 0x6E2B, 0xD9F1, - 0x6E2C, 0xB4FA, 0x6E2D, 0xB4F4, 0x6E2E, 0xD9FD, 0x6E2F, 0xB4E4, - 0x6E30, 0xDA4A, 0x6E31, 0xDA43, 0x6E32, 0xB4E8, 0x6E33, 0xD9F7, - 0x6E34, 0xB4F7, 0x6E35, 0xDA55, 0x6E36, 0xDA56, 0x6E38, 0xB4E5, - 0x6E39, 0xDA48, 0x6E3A, 0xB4F9, 0x6E3B, 0xD9FB, 0x6E3C, 0xD9ED, - 0x6E3D, 0xD9EE, 0x6E3E, 0xB4FD, 0x6E3F, 0xD9F2, 0x6E40, 0xD9F9, - 0x6E41, 0xD9F3, 0x6E43, 0xB4FB, 0x6E44, 0xB544, 0x6E45, 0xD9EF, - 0x6E46, 0xD9E8, 0x6E47, 0xD9E9, 0x6E49, 0xD9EB, 0x6E4A, 0xB4EA, - 0x6E4B, 0xD9F8, 0x6E4D, 0xB4F8, 0x6E4E, 0xB542, 0x6E51, 0xD9FA, - 0x6E52, 0xDA53, 0x6E53, 0xDA4B, 0x6E54, 0xB4E6, 0x6E55, 0xDA51, - 0x6E56, 0xB4F2, 0x6E58, 0xB4F0, 0x6E5A, 0xDA57, 0x6E5B, 0xB4EF, - 0x6E5C, 0xDA41, 0x6E5D, 0xD9F4, 0x6E5E, 0xD9FE, 0x6E5F, 0xB547, - 0x6E60, 0xDA45, 0x6E61, 0xDA42, 0x6E62, 0xD9F0, 0x6E63, 0xB543, - 0x6E64, 0xDA4F, 0x6E65, 0xDA4C, 0x6E66, 0xDA54, 0x6E67, 0xB4E9, - 0x6E68, 0xDA40, 0x6E69, 0xB546, 0x6E6B, 0xDA47, 0x6E6E, 0xB4F3, - 0x6E6F, 0xB4F6, 0x6E71, 0xDA46, 0x6E72, 0xB545, 0x6E73, 0xD9F5, - 0x6E74, 0xD5E4, 0x6E77, 0xDA50, 0x6E78, 0xDA4E, 0x6E79, 0xDA52, - 0x6E88, 0xD9EC, 0x6E89, 0xB540, 0x6E8D, 0xDE61, 0x6E8E, 0xDE60, - 0x6E8F, 0xDE46, 0x6E90, 0xB7BD, 0x6E92, 0xDE5F, 0x6E93, 0xDE49, - 0x6E94, 0xDE4A, 0x6E96, 0xB7C7, 0x6E97, 0xDE68, 0x6E98, 0xB7C2, - 0x6E99, 0xDE5E, 0x6E9B, 0xDE43, 0x6E9C, 0xB7C8, 0x6E9D, 0xB7BE, - 0x6E9E, 0xDE52, 0x6E9F, 0xDE48, 0x6EA0, 0xDE4B, 0x6EA1, 0xDE63, - 0x6EA2, 0xB7B8, 0x6EA3, 0xDE6A, 0x6EA4, 0xDE62, 0x6EA5, 0xB7C1, - 0x6EA6, 0xDE57, 0x6EA7, 0xB7CC, 0x6EAA, 0xB7CB, 0x6EAB, 0xB7C5, - 0x6EAE, 0xDE69, 0x6EAF, 0xB7B9, 0x6EB0, 0xDE55, 0x6EB1, 0xDE4C, - 0x6EB2, 0xDE59, 0x6EB3, 0xDE65, 0x6EB4, 0xB7CD, 0x6EB6, 0xB7BB, - 0x6EB7, 0xDE54, 0x6EB9, 0xDE4D, 0x6EBA, 0xB7C4, 0x6EBC, 0xB7C3, - 0x6EBD, 0xDE50, 0x6EBE, 0xDE5A, 0x6EBF, 0xDE64, 0x6EC0, 0xDE47, - 0x6EC1, 0xDE51, 0x6EC2, 0xB7BC, 0x6EC3, 0xDE5B, 0x6EC4, 0xB7C9, - 0x6EC5, 0xB7C0, 0x6EC6, 0xDE4E, 0x6EC7, 0xB7BF, 0x6EC8, 0xDE45, - 0x6EC9, 0xDE53, 0x6ECA, 0xDE67, 0x6ECB, 0xB4FE, 0x6ECC, 0xBAB0, - 0x6ECD, 0xDE56, 0x6ECE, 0xE26C, 0x6ECF, 0xDE58, 0x6ED0, 0xDE66, - 0x6ED1, 0xB7C6, 0x6ED2, 0xDE4F, 0x6ED3, 0xB7BA, 0x6ED4, 0xB7CA, - 0x6ED5, 0xBCF0, 0x6ED6, 0xDE44, 0x6ED8, 0xDE5D, 0x6EDC, 0xDE5C, - 0x6EEB, 0xE2AA, 0x6EEC, 0xBAAD, 0x6EED, 0xE27D, 0x6EEE, 0xE2A4, - 0x6EEF, 0xBAA2, 0x6EF1, 0xE26E, 0x6EF2, 0xBAAF, 0x6EF4, 0xBA77, - 0x6EF5, 0xE26D, 0x6EF6, 0xE2B0, 0x6EF7, 0xBAB1, 0x6EF8, 0xE271, - 0x6EF9, 0xE2A3, 0x6EFB, 0xE273, 0x6EFC, 0xE2B3, 0x6EFD, 0xE2AF, - 0x6EFE, 0xBA75, 0x6EFF, 0xBAA1, 0x6F00, 0xE653, 0x6F01, 0xBAAE, - 0x6F02, 0xBA7D, 0x6F03, 0xE26F, 0x6F05, 0xE2AE, 0x6F06, 0xBAA3, - 0x6F07, 0xE2AB, 0x6F08, 0xE2B8, 0x6F09, 0xE275, 0x6F0A, 0xE27E, - 0x6F0D, 0xE2B6, 0x6F0E, 0xE2AC, 0x6F0F, 0xBA7C, 0x6F12, 0xE27C, - 0x6F13, 0xBA76, 0x6F14, 0xBA74, 0x6F15, 0xBAA8, 0x6F18, 0xE27A, - 0x6F19, 0xE277, 0x6F1A, 0xE278, 0x6F1C, 0xE2B2, 0x6F1E, 0xE2B7, - 0x6F1F, 0xE2B5, 0x6F20, 0xBA7A, 0x6F21, 0xE2B9, 0x6F22, 0xBA7E, - 0x6F23, 0xBAA7, 0x6F25, 0xE270, 0x6F26, 0xE5FA, 0x6F27, 0xE279, - 0x6F29, 0xBA78, 0x6F2A, 0xBAAC, 0x6F2B, 0xBAA9, 0x6F2C, 0xBA7B, - 0x6F2D, 0xE2A5, 0x6F2E, 0xE274, 0x6F2F, 0xBAAA, 0x6F30, 0xE2A7, - 0x6F31, 0xBAA4, 0x6F32, 0xBAA6, 0x6F33, 0xBA73, 0x6F35, 0xE2A9, - 0x6F36, 0xE2A1, 0x6F37, 0xE272, 0x6F38, 0xBAA5, 0x6F39, 0xE2B1, - 0x6F3A, 0xE2B4, 0x6F3B, 0xE27B, 0x6F3C, 0xE2A8, 0x6F3E, 0xBA79, - 0x6F3F, 0xBCDF, 0x6F40, 0xE2A6, 0x6F41, 0xE5F9, 0x6F43, 0xE2AD, - 0x6F4E, 0xE276, 0x6F4F, 0xE644, 0x6F50, 0xE64E, 0x6F51, 0xBCE2, - 0x6F52, 0xE64D, 0x6F53, 0xE659, 0x6F54, 0xBCE4, 0x6F55, 0xE64B, - 0x6F57, 0xE64F, 0x6F58, 0xBCEF, 0x6F5A, 0xE646, 0x6F5B, 0xBCE7, - 0x6F5D, 0xE652, 0x6F5E, 0xE9F0, 0x6F5F, 0xBCF3, 0x6F60, 0xBCF2, - 0x6F61, 0xE654, 0x6F62, 0xE643, 0x6F63, 0xE65E, 0x6F64, 0xBCED, - 0x6F66, 0xBCE3, 0x6F67, 0xE657, 0x6F69, 0xE65B, 0x6F6A, 0xE660, - 0x6F6B, 0xE655, 0x6F6C, 0xE649, 0x6F6D, 0xBCE6, 0x6F6E, 0xBCE9, - 0x6F6F, 0xBCF1, 0x6F70, 0xBCEC, 0x6F72, 0xE64C, 0x6F73, 0xE2A2, - 0x6F76, 0xE648, 0x6F77, 0xE65F, 0x6F78, 0xBCE8, 0x6F7A, 0xBCEB, - 0x6F7B, 0xE661, 0x6F7C, 0xBCE0, 0x6F7D, 0xE656, 0x6F7E, 0xE5FB, - 0x6F7F, 0xE65C, 0x6F80, 0xC0DF, 0x6F82, 0xE64A, 0x6F84, 0xBCE1, - 0x6F85, 0xE645, 0x6F86, 0xBCE5, 0x6F87, 0xE5FC, 0x6F88, 0xBAAB, - 0x6F89, 0xE641, 0x6F8B, 0xE65A, 0x6F8C, 0xE642, 0x6F8D, 0xE640, - 0x6F8E, 0xBCEA, 0x6F90, 0xE658, 0x6F92, 0xE5FE, 0x6F93, 0xE651, - 0x6F94, 0xE650, 0x6F95, 0xE65D, 0x6F96, 0xE647, 0x6F97, 0xBCEE, - 0x6F9E, 0xE9F3, 0x6FA0, 0xBF49, 0x6FA1, 0xBEFE, 0x6FA2, 0xEA40, - 0x6FA3, 0xE9EB, 0x6FA4, 0xBF41, 0x6FA5, 0xE9F7, 0x6FA6, 0xBF48, - 0x6FA7, 0xBF43, 0x6FA8, 0xE9F5, 0x6FA9, 0xED4F, 0x6FAA, 0xE9FB, - 0x6FAB, 0xEA42, 0x6FAC, 0xE9FA, 0x6FAD, 0xE9E9, 0x6FAE, 0xE9F8, - 0x6FAF, 0xEA44, 0x6FB0, 0xEA46, 0x6FB1, 0xBEFD, 0x6FB2, 0xEA45, - 0x6FB3, 0xBF44, 0x6FB4, 0xBF4A, 0x6FB6, 0xBF47, 0x6FB8, 0xE9FE, - 0x6FB9, 0xBF46, 0x6FBA, 0xE9F9, 0x6FBC, 0xE9ED, 0x6FBD, 0xE9F2, - 0x6FBF, 0xE9FD, 0x6FC0, 0xBF45, 0x6FC1, 0xBF42, 0x6FC2, 0xBEFC, - 0x6FC3, 0xBF40, 0x6FC4, 0xE9F1, 0x6FC6, 0xE5FD, 0x6FC7, 0xE9EC, - 0x6FC8, 0xE9EF, 0x6FC9, 0xEA41, 0x6FCA, 0xE9F4, 0x6FCB, 0xE9EA, - 0x6FCC, 0xED4E, 0x6FCD, 0xEA43, 0x6FCE, 0xE9EE, 0x6FCF, 0xE9FC, - 0x6FD4, 0xED51, 0x6FD5, 0xC0E3, 0x6FD8, 0xC0D7, 0x6FDB, 0xC0DB, - 0x6FDC, 0xED53, 0x6FDD, 0xED59, 0x6FDE, 0xED57, 0x6FDF, 0xC0D9, - 0x6FE0, 0xC0DA, 0x6FE1, 0xC0E1, 0x6FE2, 0xED5A, 0x6FE3, 0xED52, - 0x6FE4, 0xC0DC, 0x6FE6, 0xED56, 0x6FE7, 0xED55, 0x6FE8, 0xED5B, - 0x6FE9, 0xC0E2, 0x6FEB, 0xC0DD, 0x6FEC, 0xC0E0, 0x6FED, 0xED54, - 0x6FEE, 0xC0E4, 0x6FEF, 0xC0DE, 0x6FF0, 0xC0E5, 0x6FF1, 0xC0D8, - 0x6FF2, 0xED58, 0x6FF4, 0xED50, 0x6FF7, 0xEFF7, 0x6FFA, 0xC271, - 0x6FFB, 0xEFF4, 0x6FFC, 0xEFF6, 0x6FFE, 0xC26F, 0x6FFF, 0xEFF2, - 0x7000, 0xEFF3, 0x7001, 0xEFEE, 0x7004, 0xE9F6, 0x7005, 0xEFEF, - 0x7006, 0xC270, 0x7007, 0xEFEB, 0x7009, 0xC26D, 0x700A, 0xEFF8, - 0x700B, 0xC26E, 0x700C, 0xEFEC, 0x700D, 0xEFED, 0x700E, 0xEFF1, - 0x700F, 0xC273, 0x7011, 0xC272, 0x7014, 0xEFF0, 0x7015, 0xC378, - 0x7016, 0xF25F, 0x7017, 0xF265, 0x7018, 0xC379, 0x7019, 0xF25C, - 0x701A, 0xC376, 0x701B, 0xC373, 0x701C, 0xF267, 0x701D, 0xC377, - 0x701F, 0xC374, 0x7020, 0xF25E, 0x7021, 0xF261, 0x7022, 0xF262, - 0x7023, 0xF263, 0x7024, 0xF266, 0x7026, 0xEFF5, 0x7027, 0xF25D, - 0x7028, 0xC375, 0x7029, 0xF264, 0x702A, 0xF268, 0x702B, 0xF260, - 0x702F, 0xF45D, 0x7030, 0xC46A, 0x7031, 0xF460, 0x7032, 0xC46B, - 0x7033, 0xF468, 0x7034, 0xF45F, 0x7035, 0xF45C, 0x7037, 0xF45E, - 0x7038, 0xF462, 0x7039, 0xF465, 0x703A, 0xF464, 0x703B, 0xF467, - 0x703C, 0xF45B, 0x703E, 0xC469, 0x703F, 0xF463, 0x7040, 0xF466, - 0x7041, 0xF469, 0x7042, 0xF461, 0x7043, 0xF5D3, 0x7044, 0xF5D4, - 0x7045, 0xF5D8, 0x7046, 0xF5D9, 0x7048, 0xF5D6, 0x7049, 0xF5D7, - 0x704A, 0xF5D5, 0x704C, 0xC4E9, 0x7051, 0xC578, 0x7052, 0xF6EB, - 0x7055, 0xF6E8, 0x7056, 0xF6E9, 0x7057, 0xF6EA, 0x7058, 0xC579, - 0x705A, 0xF7E5, 0x705B, 0xF7E4, 0x705D, 0xF8AF, 0x705E, 0xC5F4, - 0x705F, 0xF8AD, 0x7060, 0xF8B0, 0x7061, 0xF8AE, 0x7062, 0xF8F5, - 0x7063, 0xC657, 0x7064, 0xC665, 0x7065, 0xF9A3, 0x7066, 0xF96C, - 0x7068, 0xF9A2, 0x7069, 0xF9D0, 0x706A, 0xF9D1, 0x706B, 0xA4F5, - 0x7070, 0xA6C7, 0x7071, 0xCA41, 0x7074, 0xCB5E, 0x7076, 0xA85F, - 0x7078, 0xA862, 0x707A, 0xCB5F, 0x707C, 0xA860, 0x707D, 0xA861, - 0x7082, 0xCD58, 0x7083, 0xCD5A, 0x7084, 0xCD55, 0x7085, 0xCD52, - 0x7086, 0xCD54, 0x708A, 0xAAA4, 0x708E, 0xAAA2, 0x7091, 0xCD56, - 0x7092, 0xAAA3, 0x7093, 0xCD53, 0x7094, 0xCD50, 0x7095, 0xAAA1, - 0x7096, 0xCD57, 0x7098, 0xCD51, 0x7099, 0xAAA5, 0x709A, 0xCD59, - 0x709F, 0xCFAF, 0x70A1, 0xCFB3, 0x70A4, 0xACB7, 0x70A9, 0xCFB6, - 0x70AB, 0xACAF, 0x70AC, 0xACB2, 0x70AD, 0xACB4, 0x70AE, 0xACB6, - 0x70AF, 0xACB3, 0x70B0, 0xCFB2, 0x70B1, 0xCFB1, 0x70B3, 0xACB1, - 0x70B4, 0xCFB4, 0x70B5, 0xCFB5, 0x70B7, 0xCFAE, 0x70B8, 0xACB5, - 0x70BA, 0xACB0, 0x70BE, 0xCFB0, 0x70C5, 0xD277, 0x70C6, 0xD278, - 0x70C7, 0xD279, 0x70C8, 0xAF50, 0x70CA, 0xAF4C, 0x70CB, 0xD26E, - 0x70CD, 0xD276, 0x70CE, 0xD27B, 0x70CF, 0xAF51, 0x70D1, 0xD26C, - 0x70D2, 0xD272, 0x70D3, 0xD26B, 0x70D4, 0xD275, 0x70D7, 0xD271, - 0x70D8, 0xAF4D, 0x70D9, 0xAF4F, 0x70DA, 0xD27A, 0x70DC, 0xD26A, - 0x70DD, 0xD26D, 0x70DE, 0xD273, 0x70E0, 0xD274, 0x70E1, 0xD27C, - 0x70E2, 0xD270, 0x70E4, 0xAF4E, 0x70EF, 0xB26D, 0x70F0, 0xD64E, - 0x70F3, 0xD650, 0x70F4, 0xD64C, 0x70F6, 0xD658, 0x70F7, 0xD64A, - 0x70F8, 0xD657, 0x70F9, 0xB269, 0x70FA, 0xD648, 0x70FB, 0xDA5B, - 0x70FC, 0xD652, 0x70FD, 0xB26C, 0x70FF, 0xD653, 0x7100, 0xD656, - 0x7102, 0xD65A, 0x7104, 0xD64F, 0x7106, 0xD654, 0x7109, 0xB26A, - 0x710A, 0xB26B, 0x710B, 0xD659, 0x710C, 0xD64D, 0x710D, 0xD649, - 0x710E, 0xD65B, 0x7110, 0xD651, 0x7113, 0xD655, 0x7117, 0xD64B, - 0x7119, 0xB548, 0x711A, 0xB549, 0x711B, 0xDA65, 0x711C, 0xB54F, - 0x711E, 0xDA59, 0x711F, 0xDA62, 0x7120, 0xDA58, 0x7121, 0xB54C, - 0x7122, 0xDA60, 0x7123, 0xDA5E, 0x7125, 0xDA5F, 0x7126, 0xB54A, - 0x7128, 0xDA63, 0x712E, 0xDA5C, 0x712F, 0xDA5A, 0x7130, 0xB54B, - 0x7131, 0xDA5D, 0x7132, 0xDA61, 0x7136, 0xB54D, 0x713A, 0xDA64, - 0x7141, 0xDE70, 0x7142, 0xDE77, 0x7143, 0xDE79, 0x7144, 0xDEA1, - 0x7146, 0xB7DA, 0x7147, 0xDE6B, 0x7149, 0xB7D2, 0x714B, 0xDE7A, - 0x714C, 0xB7D7, 0x714D, 0xDEA2, 0x714E, 0xB7CE, 0x7150, 0xDE7D, - 0x7152, 0xDE6D, 0x7153, 0xDE7E, 0x7154, 0xDE6C, 0x7156, 0xB7DC, - 0x7158, 0xDE78, 0x7159, 0xB7CF, 0x715A, 0xDEA3, 0x715C, 0xB7D4, - 0x715D, 0xDE71, 0x715E, 0xB7D9, 0x715F, 0xDE7C, 0x7160, 0xDE6F, - 0x7161, 0xDE76, 0x7162, 0xDE72, 0x7163, 0xDE6E, 0x7164, 0xB7D1, - 0x7165, 0xB7D8, 0x7166, 0xB7D6, 0x7167, 0xB7D3, 0x7168, 0xB7DB, - 0x7169, 0xB7D0, 0x716A, 0xDE75, 0x716C, 0xB7D5, 0x716E, 0xB54E, - 0x7170, 0xDE7B, 0x7172, 0xDE73, 0x7178, 0xDE74, 0x717B, 0xE2C1, - 0x717D, 0xBAB4, 0x7180, 0xE2BD, 0x7181, 0xE2C3, 0x7182, 0xE2BF, - 0x7184, 0xBAB6, 0x7185, 0xE2BE, 0x7186, 0xE2C2, 0x7187, 0xE2BA, - 0x7189, 0xE2BC, 0x718A, 0xBAB5, 0x718F, 0xE2C0, 0x7190, 0xE2BB, - 0x7192, 0xBAB7, 0x7194, 0xBAB2, 0x7197, 0xE2C4, 0x7199, 0xBAB3, - 0x719A, 0xE667, 0x719B, 0xE664, 0x719C, 0xE670, 0x719D, 0xE66A, - 0x719E, 0xE66C, 0x719F, 0xBCF4, 0x71A0, 0xE666, 0x71A1, 0xE66E, - 0x71A4, 0xE66D, 0x71A5, 0xE66B, 0x71A7, 0xE671, 0x71A8, 0xBCF7, - 0x71A9, 0xE668, 0x71AA, 0xE66F, 0x71AC, 0xBCF5, 0x71AF, 0xE663, - 0x71B0, 0xE665, 0x71B1, 0xBCF6, 0x71B2, 0xE662, 0x71B3, 0xE672, - 0x71B5, 0xE669, 0x71B8, 0xEA4A, 0x71B9, 0xBF51, 0x71BC, 0xEA55, - 0x71BD, 0xEA53, 0x71BE, 0xBF4B, 0x71BF, 0xEA49, 0x71C0, 0xEA4C, - 0x71C1, 0xEA4D, 0x71C2, 0xEA48, 0x71C3, 0xBF55, 0x71C4, 0xBF56, - 0x71C5, 0xEA47, 0x71C6, 0xEA56, 0x71C7, 0xEA51, 0x71C8, 0xBF4F, - 0x71C9, 0xBF4C, 0x71CA, 0xEA50, 0x71CB, 0xEA4E, 0x71CE, 0xBF52, - 0x71CF, 0xEA52, 0x71D0, 0xBF4D, 0x71D2, 0xBF4E, 0x71D4, 0xEA4F, - 0x71D5, 0xBF50, 0x71D6, 0xEA4B, 0x71D8, 0xEA54, 0x71D9, 0xBF53, - 0x71DA, 0xEA57, 0x71DB, 0xEA58, 0x71DC, 0xBF54, 0x71DF, 0xC0E7, - 0x71E0, 0xC0EE, 0x71E1, 0xED5C, 0x71E2, 0xED62, 0x71E4, 0xED60, - 0x71E5, 0xC0EA, 0x71E6, 0xC0E9, 0x71E7, 0xC0E6, 0x71E8, 0xED5E, - 0x71EC, 0xC0EC, 0x71ED, 0xC0EB, 0x71EE, 0xC0E8, 0x71F0, 0xED61, - 0x71F1, 0xED5D, 0x71F2, 0xED5F, 0x71F4, 0xC0ED, 0x71F8, 0xC277, - 0x71F9, 0xEFFB, 0x71FB, 0xC274, 0x71FC, 0xC275, 0x71FD, 0xEFFD, - 0x71FE, 0xC276, 0x71FF, 0xEFFA, 0x7201, 0xEFF9, 0x7202, 0xF26C, - 0x7203, 0xEFFC, 0x7205, 0xF26D, 0x7206, 0xC37A, 0x7207, 0xF26B, - 0x720A, 0xF26A, 0x720C, 0xF269, 0x720D, 0xC37B, 0x7210, 0xC46C, - 0x7213, 0xF46A, 0x7214, 0xF46B, 0x7219, 0xF5DC, 0x721A, 0xF5DB, - 0x721B, 0xC4EA, 0x721D, 0xF5DA, 0x721E, 0xF6EC, 0x721F, 0xF6ED, - 0x7222, 0xF7E6, 0x7223, 0xF8B1, 0x7226, 0xF8F6, 0x7227, 0xF9BC, - 0x7228, 0xC679, 0x7229, 0xF9C6, 0x722A, 0xA4F6, 0x722C, 0xAAA6, - 0x722D, 0xAAA7, 0x7230, 0xACB8, 0x7235, 0xC0EF, 0x7236, 0xA4F7, - 0x7238, 0xAAA8, 0x7239, 0xAF52, 0x723A, 0xB7DD, 0x723B, 0xA4F8, - 0x723D, 0xB26E, 0x723E, 0xBAB8, 0x723F, 0xC962, 0x7241, 0xCFB7, - 0x7242, 0xD27D, 0x7244, 0xE2C5, 0x7246, 0xC0F0, 0x7247, 0xA4F9, - 0x7248, 0xAAA9, 0x7249, 0xCFB8, 0x724A, 0xCFB9, 0x724B, 0xDA66, - 0x724C, 0xB550, 0x724F, 0xDEA4, 0x7252, 0xB7DE, 0x7253, 0xE2C6, - 0x7256, 0xBCF8, 0x7258, 0xC37C, 0x7259, 0xA4FA, 0x725A, 0xDA67, - 0x725B, 0xA4FB, 0x725D, 0xA6C9, 0x725E, 0xCA42, 0x725F, 0xA6C8, - 0x7260, 0xA865, 0x7261, 0xA864, 0x7262, 0xA863, 0x7263, 0xCB60, - 0x7267, 0xAAAA, 0x7269, 0xAAAB, 0x726A, 0xCD5B, 0x726C, 0xCFBA, - 0x726E, 0xCFBD, 0x726F, 0xACBA, 0x7270, 0xCFBB, 0x7272, 0xACB9, - 0x7273, 0xCFBC, 0x7274, 0xACBB, 0x7276, 0xD2A2, 0x7277, 0xD2A1, - 0x7278, 0xD27E, 0x7279, 0xAF53, 0x727B, 0xD65D, 0x727C, 0xD65E, - 0x727D, 0xB26F, 0x727E, 0xD65C, 0x727F, 0xD65F, 0x7280, 0xB552, - 0x7281, 0xB270, 0x7284, 0xB551, 0x7285, 0xDA6B, 0x7286, 0xDA6A, - 0x7288, 0xDA68, 0x7289, 0xDA69, 0x728B, 0xDA6C, 0x728C, 0xDEA6, - 0x728D, 0xDEA5, 0x728E, 0xDEA9, 0x7290, 0xDEA8, 0x7291, 0xDEA7, - 0x7292, 0xBAB9, 0x7293, 0xE2C9, 0x7295, 0xE2C8, 0x7296, 0xBABA, - 0x7297, 0xE2C7, 0x7298, 0xE673, 0x729A, 0xE674, 0x729B, 0xBCF9, - 0x729D, 0xEA59, 0x729E, 0xEA5A, 0x72A1, 0xF272, 0x72A2, 0xC37D, - 0x72A3, 0xF271, 0x72A4, 0xF270, 0x72A5, 0xF26E, 0x72A6, 0xF26F, - 0x72A7, 0xC4EB, 0x72A8, 0xF46C, 0x72A9, 0xF6EE, 0x72AA, 0xF8F7, - 0x72AC, 0xA4FC, 0x72AE, 0xC9A5, 0x72AF, 0xA5C7, 0x72B0, 0xC9A6, - 0x72B4, 0xCA43, 0x72B5, 0xCA44, 0x72BA, 0xCB66, 0x72BD, 0xCB62, - 0x72BF, 0xCB61, 0x72C0, 0xAAAC, 0x72C1, 0xCB65, 0x72C2, 0xA867, - 0x72C3, 0xCB63, 0x72C4, 0xA866, 0x72C5, 0xCB67, 0x72C6, 0xCB64, - 0x72C9, 0xCD5F, 0x72CA, 0xCFBE, 0x72CB, 0xCD5D, 0x72CC, 0xCD64, - 0x72CE, 0xAAAD, 0x72D0, 0xAAB0, 0x72D1, 0xCD65, 0x72D2, 0xCD61, - 0x72D4, 0xCD62, 0x72D6, 0xCD5C, 0x72D7, 0xAAAF, 0x72D8, 0xCD5E, - 0x72D9, 0xAAAE, 0x72DA, 0xCD63, 0x72DC, 0xCD60, 0x72DF, 0xCFC2, - 0x72E0, 0xACBD, 0x72E1, 0xACBE, 0x72E3, 0xCFC5, 0x72E4, 0xCFBF, - 0x72E6, 0xCFC4, 0x72E8, 0xCFC0, 0x72E9, 0xACBC, 0x72EA, 0xCFC3, - 0x72EB, 0xCFC1, 0x72F3, 0xD2A8, 0x72F4, 0xD2A5, 0x72F6, 0xD2A7, - 0x72F7, 0xAF58, 0x72F8, 0xAF57, 0x72F9, 0xAF55, 0x72FA, 0xD2A4, - 0x72FB, 0xD2A9, 0x72FC, 0xAF54, 0x72FD, 0xAF56, 0x72FE, 0xD2A6, - 0x72FF, 0xD667, 0x7300, 0xD2A3, 0x7301, 0xD2AA, 0x7307, 0xD662, - 0x7308, 0xD666, 0x730A, 0xD665, 0x730B, 0xDA6E, 0x730C, 0xDA79, - 0x730F, 0xD668, 0x7311, 0xD663, 0x7312, 0xDA6D, 0x7313, 0xB274, - 0x7316, 0xB273, 0x7317, 0xD661, 0x7318, 0xD664, 0x7319, 0xB275, - 0x731B, 0xB272, 0x731C, 0xB271, 0x731D, 0xD660, 0x731E, 0xD669, - 0x7322, 0xDA70, 0x7323, 0xDA77, 0x7325, 0xB554, 0x7326, 0xDA76, - 0x7327, 0xDA73, 0x7329, 0xB556, 0x732D, 0xDA75, 0x7330, 0xDA6F, - 0x7331, 0xDA71, 0x7332, 0xDA74, 0x7333, 0xDA72, 0x7334, 0xB555, - 0x7335, 0xDA78, 0x7336, 0xB553, 0x7337, 0xB7DF, 0x733A, 0xDEAD, - 0x733B, 0xDEAC, 0x733C, 0xDEAA, 0x733E, 0xB7E2, 0x733F, 0xB7E1, - 0x7340, 0xDEAE, 0x7342, 0xDEAB, 0x7343, 0xE2CA, 0x7344, 0xBABB, - 0x7345, 0xB7E0, 0x7349, 0xDEB0, 0x734A, 0xDEAF, 0x734C, 0xE2CD, - 0x734D, 0xE2CB, 0x734E, 0xBCFA, 0x7350, 0xBABC, 0x7351, 0xE2CC, - 0x7352, 0xE676, 0x7357, 0xBCFB, 0x7358, 0xE675, 0x7359, 0xE67E, - 0x735A, 0xE67D, 0x735B, 0xE67B, 0x735D, 0xE67A, 0x735E, 0xE677, - 0x735F, 0xE678, 0x7360, 0xE679, 0x7361, 0xE67C, 0x7362, 0xE6A1, - 0x7365, 0xEA5F, 0x7366, 0xEA5C, 0x7367, 0xEA5D, 0x7368, 0xBF57, - 0x7369, 0xEA5B, 0x736A, 0xEA61, 0x736B, 0xEA60, 0x736C, 0xEA5E, - 0x736E, 0xED64, 0x736F, 0xED65, 0x7370, 0xC0F1, 0x7372, 0xC0F2, - 0x7373, 0xED63, 0x7375, 0xC279, 0x7376, 0xEFFE, 0x7377, 0xC278, - 0x7378, 0xC37E, 0x737A, 0xC3A1, 0x737B, 0xC46D, 0x737C, 0xF46E, - 0x737D, 0xF46D, 0x737E, 0xF5DD, 0x737F, 0xF6EF, 0x7380, 0xC57A, - 0x7381, 0xF7E8, 0x7382, 0xF7E7, 0x7383, 0xF7E9, 0x7384, 0xA5C8, - 0x7385, 0xCFC6, 0x7386, 0xAF59, 0x7387, 0xB276, 0x7388, 0xD66A, - 0x7389, 0xA5C9, 0x738A, 0xC9A7, 0x738B, 0xA4FD, 0x738E, 0xCA45, - 0x7392, 0xCB6C, 0x7393, 0xCB6A, 0x7394, 0xCB6B, 0x7395, 0xCB68, - 0x7396, 0xA868, 0x7397, 0xCB69, 0x739D, 0xCD6D, 0x739F, 0xAAB3, - 0x73A0, 0xCD6B, 0x73A1, 0xCD67, 0x73A2, 0xCD6A, 0x73A4, 0xCD66, - 0x73A5, 0xAAB5, 0x73A6, 0xCD69, 0x73A8, 0xAAB2, 0x73A9, 0xAAB1, - 0x73AB, 0xAAB4, 0x73AC, 0xCD6C, 0x73AD, 0xCD68, 0x73B2, 0xACC2, - 0x73B3, 0xACC5, 0x73B4, 0xCFCE, 0x73B5, 0xCFCD, 0x73B6, 0xCFCC, - 0x73B7, 0xACBF, 0x73B8, 0xCFD5, 0x73B9, 0xCFCB, 0x73BB, 0xACC1, - 0x73BC, 0xD2AF, 0x73BE, 0xCFD2, 0x73BF, 0xCFD0, 0x73C0, 0xACC4, - 0x73C2, 0xCFC8, 0x73C3, 0xCFD3, 0x73C5, 0xCFCA, 0x73C6, 0xCFD4, - 0x73C7, 0xCFD1, 0x73C8, 0xCFC9, 0x73CA, 0xACC0, 0x73CB, 0xCFD6, - 0x73CC, 0xCFC7, 0x73CD, 0xACC3, 0x73D2, 0xD2B4, 0x73D3, 0xD2AB, - 0x73D4, 0xD2B6, 0x73D6, 0xD2AE, 0x73D7, 0xD2B9, 0x73D8, 0xD2BA, - 0x73D9, 0xD2AC, 0x73DA, 0xD2B8, 0x73DB, 0xD2B5, 0x73DC, 0xD2B3, - 0x73DD, 0xD2B7, 0x73DE, 0xAF5F, 0x73E0, 0xAF5D, 0x73E3, 0xD2B1, - 0x73E5, 0xD2AD, 0x73E7, 0xD2B0, 0x73E8, 0xD2BB, 0x73E9, 0xD2B2, - 0x73EA, 0xAF5E, 0x73EB, 0xCFCF, 0x73ED, 0xAF5A, 0x73EE, 0xAF5C, - 0x73F4, 0xD678, 0x73F5, 0xD66D, 0x73F6, 0xD66B, 0x73F8, 0xD66C, - 0x73FA, 0xD673, 0x73FC, 0xD674, 0x73FD, 0xD670, 0x73FE, 0xB27B, - 0x73FF, 0xD675, 0x7400, 0xD672, 0x7401, 0xD66F, 0x7403, 0xB279, - 0x7404, 0xD66E, 0x7405, 0xB277, 0x7406, 0xB27A, 0x7407, 0xD671, - 0x7408, 0xD679, 0x7409, 0xAF5B, 0x740A, 0xB278, 0x740B, 0xD677, - 0x740C, 0xD676, 0x740D, 0xB27C, 0x7416, 0xDA7E, 0x741A, 0xDAA1, - 0x741B, 0xB560, 0x741D, 0xDAA7, 0x7420, 0xDAA9, 0x7421, 0xDAA2, - 0x7422, 0xB55A, 0x7423, 0xDAA6, 0x7424, 0xDAA5, 0x7425, 0xB55B, - 0x7426, 0xB561, 0x7428, 0xB562, 0x7429, 0xDAA8, 0x742A, 0xB558, - 0x742B, 0xDA7D, 0x742C, 0xDA7B, 0x742D, 0xDAA3, 0x742E, 0xDA7A, - 0x742F, 0xB55F, 0x7430, 0xDA7C, 0x7431, 0xDAA4, 0x7432, 0xDAAA, - 0x7433, 0xB559, 0x7434, 0xB55E, 0x7435, 0xB55C, 0x7436, 0xB55D, - 0x743A, 0xB557, 0x743F, 0xB7E9, 0x7440, 0xDEB7, 0x7441, 0xB7E8, - 0x7442, 0xDEBB, 0x7444, 0xDEB1, 0x7446, 0xDEBC, 0x744A, 0xDEB2, - 0x744B, 0xDEB3, 0x744D, 0xDEBD, 0x744E, 0xDEBA, 0x744F, 0xDEB8, - 0x7450, 0xDEB9, 0x7451, 0xDEB5, 0x7452, 0xDEB4, 0x7454, 0xDEBE, - 0x7455, 0xB7E5, 0x7457, 0xDEB6, 0x7459, 0xB7EA, 0x745A, 0xB7E4, - 0x745B, 0xB7EB, 0x745C, 0xB7EC, 0x745E, 0xB7E7, 0x745F, 0xB7E6, - 0x7462, 0xE2CE, 0x7463, 0xBABE, 0x7464, 0xBABD, 0x7467, 0xE2D3, - 0x7469, 0xBCFC, 0x746A, 0xBABF, 0x746D, 0xBAC1, 0x746E, 0xE2D4, - 0x746F, 0xB7E3, 0x7470, 0xBAC0, 0x7471, 0xE2D0, 0x7472, 0xE2D2, - 0x7473, 0xE2CF, 0x7475, 0xE2D1, 0x7479, 0xE6AB, 0x747C, 0xE6AA, - 0x747D, 0xE6A7, 0x747E, 0xBD40, 0x747F, 0xEA62, 0x7480, 0xBD41, - 0x7481, 0xE6A6, 0x7483, 0xBCFE, 0x7485, 0xE6A8, 0x7486, 0xE6A5, - 0x7487, 0xE6A2, 0x7488, 0xE6A9, 0x7489, 0xE6A3, 0x748A, 0xE6A4, - 0x748B, 0xBCFD, 0x7490, 0xED69, 0x7492, 0xEA66, 0x7494, 0xEA65, - 0x7495, 0xEA67, 0x7497, 0xED66, 0x7498, 0xBF5A, 0x749A, 0xEA63, - 0x749C, 0xBF58, 0x749E, 0xBF5C, 0x749F, 0xBF5B, 0x74A0, 0xEA64, - 0x74A1, 0xEA68, 0x74A3, 0xBF59, 0x74A5, 0xED6D, 0x74A6, 0xC0F5, - 0x74A7, 0xC27A, 0x74A8, 0xC0F6, 0x74A9, 0xC0F3, 0x74AA, 0xED6A, - 0x74AB, 0xED68, 0x74AD, 0xED6B, 0x74AF, 0xED6E, 0x74B0, 0xC0F4, - 0x74B1, 0xED6C, 0x74B2, 0xED67, 0x74B5, 0xF042, 0x74B6, 0xF045, - 0x74B7, 0xF275, 0x74B8, 0xF040, 0x74BA, 0xF46F, 0x74BB, 0xF046, - 0x74BD, 0xC3A2, 0x74BE, 0xF044, 0x74BF, 0xC27B, 0x74C0, 0xF041, - 0x74C1, 0xF043, 0x74C2, 0xF047, 0x74C3, 0xF276, 0x74C5, 0xF274, - 0x74CA, 0xC3A3, 0x74CB, 0xF273, 0x74CF, 0xC46E, 0x74D4, 0xC4ED, - 0x74D5, 0xF6F1, 0x74D6, 0xC4EC, 0x74D7, 0xF6F3, 0x74D8, 0xF6F0, - 0x74D9, 0xF6F2, 0x74DA, 0xC5D0, 0x74DB, 0xF8B2, 0x74DC, 0xA5CA, - 0x74DD, 0xCD6E, 0x74DE, 0xD2BC, 0x74DF, 0xD2BD, 0x74E0, 0xB27D, - 0x74E1, 0xDEBF, 0x74E2, 0xBF5D, 0x74E3, 0xC3A4, 0x74E4, 0xC57B, - 0x74E5, 0xF8B3, 0x74E6, 0xA5CB, 0x74E8, 0xCD6F, 0x74E9, 0xA260, - 0x74EC, 0xCFD7, 0x74EE, 0xCFD8, 0x74F4, 0xD2BE, 0x74F5, 0xD2BF, - 0x74F6, 0xB27E, 0x74F7, 0xB2A1, 0x74FB, 0xDAAB, 0x74FD, 0xDEC2, - 0x74FE, 0xDEC1, 0x74FF, 0xDEC0, 0x7500, 0xE2D5, 0x7502, 0xE2D6, - 0x7503, 0xE2D7, 0x7504, 0xBAC2, 0x7507, 0xE6AD, 0x7508, 0xE6AC, - 0x750B, 0xEA69, 0x750C, 0xBF5E, 0x750D, 0xBF5F, 0x750F, 0xED72, - 0x7510, 0xED6F, 0x7511, 0xED70, 0x7512, 0xED71, 0x7513, 0xF049, - 0x7514, 0xF048, 0x7515, 0xC27C, 0x7516, 0xF277, 0x7517, 0xF5DE, - 0x7518, 0xA5CC, 0x751A, 0xACC6, 0x751C, 0xB2A2, 0x751D, 0xDEC3, - 0x751F, 0xA5CD, 0x7521, 0xD2C0, 0x7522, 0xB2A3, 0x7525, 0xB563, - 0x7526, 0xB564, 0x7528, 0xA5CE, 0x7529, 0xA5CF, 0x752A, 0xCA46, - 0x752B, 0xA86A, 0x752C, 0xA869, 0x752D, 0xACC7, 0x752E, 0xCFD9, - 0x752F, 0xDAAC, 0x7530, 0xA5D0, 0x7531, 0xA5D1, 0x7532, 0xA5D2, - 0x7533, 0xA5D3, 0x7537, 0xA86B, 0x7538, 0xA86C, 0x7539, 0xCB6E, - 0x753A, 0xCB6D, 0x753D, 0xAAB6, 0x753E, 0xCD72, 0x753F, 0xCD70, - 0x7540, 0xCD71, 0x7547, 0xCFDA, 0x7548, 0xCFDB, 0x754B, 0xACCB, - 0x754C, 0xACC9, 0x754E, 0xACCA, 0x754F, 0xACC8, 0x7554, 0xAF60, - 0x7559, 0xAF64, 0x755A, 0xAF63, 0x755B, 0xD2C1, 0x755C, 0xAF62, - 0x755D, 0xAF61, 0x755F, 0xD2C2, 0x7562, 0xB2A6, 0x7563, 0xD67B, - 0x7564, 0xD67A, 0x7565, 0xB2A4, 0x7566, 0xB2A5, 0x756A, 0xB566, - 0x756B, 0xB565, 0x756C, 0xDAAE, 0x756F, 0xDAAD, 0x7570, 0xB2A7, - 0x7576, 0xB7ED, 0x7577, 0xDEC5, 0x7578, 0xB7EE, 0x7579, 0xDEC4, - 0x757D, 0xE2D8, 0x757E, 0xE6AE, 0x757F, 0xBD42, 0x7580, 0xEA6A, - 0x7584, 0xED73, 0x7586, 0xC3A6, 0x7587, 0xC3A5, 0x758A, 0xC57C, - 0x758B, 0xA5D4, 0x758C, 0xCD73, 0x758F, 0xB2A8, 0x7590, 0xE2D9, - 0x7591, 0xBAC3, 0x7594, 0xCB6F, 0x7595, 0xCB70, 0x7598, 0xCD74, - 0x7599, 0xAAB8, 0x759A, 0xAAB9, 0x759D, 0xAAB7, 0x75A2, 0xACCF, - 0x75A3, 0xACD0, 0x75A4, 0xACCD, 0x75A5, 0xACCE, 0x75A7, 0xCFDC, - 0x75AA, 0xCFDD, 0x75AB, 0xACCC, 0x75B0, 0xD2C3, 0x75B2, 0xAF68, - 0x75B3, 0xAF69, 0x75B5, 0xB2AB, 0x75B6, 0xD2C9, 0x75B8, 0xAF6E, - 0x75B9, 0xAF6C, 0x75BA, 0xD2CA, 0x75BB, 0xD2C5, 0x75BC, 0xAF6B, - 0x75BD, 0xAF6A, 0x75BE, 0xAF65, 0x75BF, 0xD2C8, 0x75C0, 0xD2C7, - 0x75C1, 0xD2C4, 0x75C2, 0xAF6D, 0x75C4, 0xD2C6, 0x75C5, 0xAF66, - 0x75C7, 0xAF67, 0x75CA, 0xB2AC, 0x75CB, 0xD6A1, 0x75CC, 0xD6A2, - 0x75CD, 0xB2AD, 0x75CE, 0xD67C, 0x75CF, 0xD67E, 0x75D0, 0xD6A4, - 0x75D1, 0xD6A3, 0x75D2, 0xD67D, 0x75D4, 0xB2A9, 0x75D5, 0xB2AA, - 0x75D7, 0xDAB6, 0x75D8, 0xB56B, 0x75D9, 0xB56A, 0x75DA, 0xDAB0, - 0x75DB, 0xB568, 0x75DD, 0xDAB3, 0x75DE, 0xB56C, 0x75DF, 0xDAB4, - 0x75E0, 0xB56D, 0x75E1, 0xDAB1, 0x75E2, 0xB567, 0x75E3, 0xB569, - 0x75E4, 0xDAB5, 0x75E6, 0xDAB2, 0x75E7, 0xDAAF, 0x75ED, 0xDED2, - 0x75EF, 0xDEC7, 0x75F0, 0xB7F0, 0x75F1, 0xB7F3, 0x75F2, 0xB7F2, - 0x75F3, 0xB7F7, 0x75F4, 0xB7F6, 0x75F5, 0xDED3, 0x75F6, 0xDED1, - 0x75F7, 0xDECA, 0x75F8, 0xDECE, 0x75F9, 0xDECD, 0x75FA, 0xB7F4, - 0x75FB, 0xDED0, 0x75FC, 0xDECC, 0x75FD, 0xDED4, 0x75FE, 0xDECB, - 0x75FF, 0xB7F5, 0x7600, 0xB7EF, 0x7601, 0xB7F1, 0x7603, 0xDEC9, - 0x7608, 0xE2DB, 0x7609, 0xBAC7, 0x760A, 0xE2DF, 0x760B, 0xBAC6, - 0x760C, 0xE2DC, 0x760D, 0xBAC5, 0x760F, 0xDEC8, 0x7610, 0xDECF, - 0x7611, 0xE2DE, 0x7613, 0xBAC8, 0x7614, 0xE2E0, 0x7615, 0xE2DD, - 0x7616, 0xE2DA, 0x7619, 0xE6B1, 0x761A, 0xE6B5, 0x761B, 0xE6B7, - 0x761C, 0xE6B3, 0x761D, 0xE6B2, 0x761E, 0xE6B0, 0x761F, 0xBD45, - 0x7620, 0xBD43, 0x7621, 0xBD48, 0x7622, 0xBD49, 0x7623, 0xE6B4, - 0x7624, 0xBD46, 0x7625, 0xE6AF, 0x7626, 0xBD47, 0x7627, 0xBAC4, - 0x7628, 0xE6B6, 0x7629, 0xBD44, 0x762D, 0xEA6C, 0x762F, 0xEA6B, - 0x7630, 0xEA73, 0x7631, 0xEA6D, 0x7632, 0xEA72, 0x7633, 0xEA6F, - 0x7634, 0xBF60, 0x7635, 0xEA71, 0x7638, 0xBF61, 0x763A, 0xBF62, - 0x763C, 0xEA70, 0x763D, 0xEA6E, 0x7642, 0xC0F8, 0x7643, 0xED74, - 0x7646, 0xC0F7, 0x7647, 0xED77, 0x7648, 0xED75, 0x7649, 0xED76, - 0x764C, 0xC0F9, 0x7650, 0xF04D, 0x7652, 0xC2A1, 0x7653, 0xF04E, - 0x7656, 0xC27D, 0x7657, 0xF04F, 0x7658, 0xC27E, 0x7659, 0xF04C, - 0x765A, 0xF050, 0x765C, 0xF04A, 0x765F, 0xC3A7, 0x7660, 0xF278, - 0x7661, 0xC3A8, 0x7662, 0xC46F, 0x7664, 0xF04B, 0x7665, 0xC470, - 0x7669, 0xC4EE, 0x766A, 0xF5DF, 0x766C, 0xC57E, 0x766D, 0xF6F4, - 0x766E, 0xC57D, 0x7670, 0xF7EA, 0x7671, 0xC5F5, 0x7672, 0xC5F6, - 0x7675, 0xF9CC, 0x7678, 0xACD1, 0x7679, 0xCFDE, 0x767B, 0xB56E, - 0x767C, 0xB56F, 0x767D, 0xA5D5, 0x767E, 0xA6CA, 0x767F, 0xCA47, - 0x7681, 0xCB71, 0x7682, 0xA86D, 0x7684, 0xAABA, 0x7686, 0xACD2, - 0x7687, 0xACD3, 0x7688, 0xACD4, 0x7689, 0xD6A6, 0x768A, 0xD2CB, - 0x768B, 0xAF6F, 0x768E, 0xB2AE, 0x768F, 0xD6A5, 0x7692, 0xDAB8, - 0x7693, 0xB571, 0x7695, 0xDAB7, 0x7696, 0xB570, 0x7699, 0xDED5, - 0x769A, 0xBD4A, 0x769B, 0xE6BB, 0x769C, 0xE6B8, 0x769D, 0xE6B9, - 0x769E, 0xE6BA, 0x76A4, 0xED78, 0x76A6, 0xF051, 0x76AA, 0xF471, - 0x76AB, 0xF470, 0x76AD, 0xF6F5, 0x76AE, 0xA5D6, 0x76AF, 0xCD75, - 0x76B0, 0xAF70, 0x76B4, 0xB572, 0x76B5, 0xDED6, 0x76B8, 0xE2E1, - 0x76BA, 0xBD4B, 0x76BB, 0xEA74, 0x76BD, 0xF052, 0x76BE, 0xF472, - 0x76BF, 0xA5D7, 0x76C2, 0xAABB, 0x76C3, 0xACD7, 0x76C4, 0xCFDF, - 0x76C5, 0xACD8, 0x76C6, 0xACD6, 0x76C8, 0xACD5, 0x76C9, 0xD2CC, - 0x76CA, 0xAF71, 0x76CD, 0xAF72, 0x76CE, 0xAF73, 0x76D2, 0xB2B0, - 0x76D3, 0xD6A7, 0x76D4, 0xB2AF, 0x76DA, 0xDAB9, 0x76DB, 0xB2B1, - 0x76DC, 0xB573, 0x76DD, 0xDED7, 0x76DE, 0xB7F8, 0x76DF, 0xB7F9, - 0x76E1, 0xBAC9, 0x76E3, 0xBACA, 0x76E4, 0xBD4C, 0x76E5, 0xBF64, - 0x76E6, 0xEA75, 0x76E7, 0xBF63, 0x76E9, 0xED79, 0x76EA, 0xC0FA, - 0x76EC, 0xF053, 0x76ED, 0xF473, 0x76EE, 0xA5D8, 0x76EF, 0xA86E, - 0x76F0, 0xCD78, 0x76F1, 0xCD77, 0x76F2, 0xAABC, 0x76F3, 0xCD76, - 0x76F4, 0xAABD, 0x76F5, 0xCD79, 0x76F7, 0xCFE5, 0x76F8, 0xACDB, - 0x76F9, 0xACDA, 0x76FA, 0xCFE7, 0x76FB, 0xCFE6, 0x76FC, 0xACDF, - 0x76FE, 0xACDE, 0x7701, 0xACD9, 0x7703, 0xCFE1, 0x7704, 0xCFE2, - 0x7705, 0xCFE3, 0x7707, 0xACE0, 0x7708, 0xCFE0, 0x7709, 0xACDC, - 0x770A, 0xCFE4, 0x770B, 0xACDD, 0x7710, 0xD2CF, 0x7711, 0xD2D3, - 0x7712, 0xD2D1, 0x7713, 0xD2D0, 0x7715, 0xD2D4, 0x7719, 0xD2D5, - 0x771A, 0xD2D6, 0x771B, 0xD2CE, 0x771D, 0xD2CD, 0x771F, 0xAF75, - 0x7720, 0xAF76, 0x7722, 0xD2D7, 0x7723, 0xD2D2, 0x7725, 0xD6B0, - 0x7727, 0xD2D8, 0x7728, 0xAF77, 0x7729, 0xAF74, 0x772D, 0xD6AA, - 0x772F, 0xD6A9, 0x7731, 0xD6AB, 0x7732, 0xD6AC, 0x7733, 0xD6AE, - 0x7734, 0xD6AD, 0x7735, 0xD6B2, 0x7736, 0xB2B5, 0x7737, 0xB2B2, - 0x7738, 0xB2B6, 0x7739, 0xD6A8, 0x773A, 0xB2B7, 0x773B, 0xD6B1, - 0x773C, 0xB2B4, 0x773D, 0xD6AF, 0x773E, 0xB2B3, 0x7744, 0xDABC, - 0x7745, 0xDABE, 0x7746, 0xDABA, 0x7747, 0xDABB, 0x774A, 0xDABF, - 0x774B, 0xDAC1, 0x774C, 0xDAC2, 0x774D, 0xDABD, 0x774E, 0xDAC0, - 0x774F, 0xB574, 0x7752, 0xDEDB, 0x7754, 0xDEE0, 0x7755, 0xDED8, - 0x7756, 0xDEDC, 0x7759, 0xDEE1, 0x775A, 0xDEDD, 0x775B, 0xB7FA, - 0x775C, 0xB843, 0x775E, 0xB7FD, 0x775F, 0xDED9, 0x7760, 0xDEDA, - 0x7761, 0xBACE, 0x7762, 0xB846, 0x7763, 0xB7FE, 0x7765, 0xB844, - 0x7766, 0xB7FC, 0x7767, 0xDEDF, 0x7768, 0xB845, 0x7769, 0xDEDE, - 0x776A, 0xB841, 0x776B, 0xB7FB, 0x776C, 0xB842, 0x776D, 0xDEE2, - 0x776E, 0xE2E6, 0x776F, 0xE2E8, 0x7779, 0xB840, 0x777C, 0xE2E3, - 0x777D, 0xBACC, 0x777E, 0xE2E9, 0x777F, 0xBACD, 0x7780, 0xE2E7, - 0x7781, 0xE2E2, 0x7782, 0xE2E5, 0x7783, 0xE2EA, 0x7784, 0xBACB, - 0x7785, 0xE2E4, 0x7787, 0xBD4E, 0x7788, 0xE6BF, 0x7789, 0xE6BE, - 0x778B, 0xBD51, 0x778C, 0xBD4F, 0x778D, 0xE6BC, 0x778E, 0xBD4D, - 0x778F, 0xE6BD, 0x7791, 0xBD50, 0x7795, 0xEA7D, 0x7797, 0xEAA1, - 0x7799, 0xEA7E, 0x779A, 0xEA76, 0x779B, 0xEA7A, 0x779C, 0xEA79, - 0x779D, 0xEA77, 0x779E, 0xBF66, 0x779F, 0xBF67, 0x77A0, 0xBF65, - 0x77A1, 0xEA78, 0x77A2, 0xEA7B, 0x77A3, 0xEA7C, 0x77A5, 0xBF68, - 0x77A7, 0xC140, 0x77A8, 0xEDA3, 0x77AA, 0xC0FC, 0x77AB, 0xED7B, - 0x77AC, 0xC0FE, 0x77AD, 0xC141, 0x77B0, 0xC0FD, 0x77B1, 0xEDA2, - 0x77B2, 0xED7C, 0x77B3, 0xC0FB, 0x77B4, 0xEDA1, 0x77B5, 0xED7A, - 0x77B6, 0xED7E, 0x77B7, 0xED7D, 0x77BA, 0xF055, 0x77BB, 0xC2A4, - 0x77BC, 0xC2A5, 0x77BD, 0xC2A2, 0x77BF, 0xC2A3, 0x77C2, 0xF054, - 0x77C4, 0xF27B, 0x77C7, 0xC3A9, 0x77C9, 0xF279, 0x77CA, 0xF27A, - 0x77CC, 0xF474, 0x77CD, 0xF477, 0x77CE, 0xF475, 0x77CF, 0xF476, - 0x77D0, 0xF5E0, 0x77D3, 0xC4EF, 0x77D4, 0xF7EB, 0x77D5, 0xF8B4, - 0x77D7, 0xC5F7, 0x77D8, 0xF8F8, 0x77D9, 0xF8F9, 0x77DA, 0xC666, - 0x77DB, 0xA5D9, 0x77DC, 0xACE1, 0x77DE, 0xDAC3, 0x77E0, 0xDEE3, - 0x77E2, 0xA5DA, 0x77E3, 0xA86F, 0x77E5, 0xAABE, 0x77E7, 0xCFE8, - 0x77E8, 0xCFE9, 0x77E9, 0xAF78, 0x77EC, 0xDAC4, 0x77ED, 0xB575, - 0x77EE, 0xB847, 0x77EF, 0xC142, 0x77F0, 0xEDA4, 0x77F1, 0xF27C, - 0x77F2, 0xF478, 0x77F3, 0xA5DB, 0x77F7, 0xCDA1, 0x77F8, 0xCD7A, - 0x77F9, 0xCD7C, 0x77FA, 0xCD7E, 0x77FB, 0xCD7D, 0x77FC, 0xCD7B, - 0x77FD, 0xAABF, 0x7802, 0xACE2, 0x7803, 0xCFF2, 0x7805, 0xCFED, - 0x7806, 0xCFEA, 0x7809, 0xCFF1, 0x780C, 0xACE4, 0x780D, 0xACE5, - 0x780E, 0xCFF0, 0x780F, 0xCFEF, 0x7810, 0xCFEE, 0x7811, 0xCFEB, - 0x7812, 0xCFEC, 0x7813, 0xCFF3, 0x7814, 0xACE3, 0x781D, 0xAF7C, - 0x781F, 0xAFA4, 0x7820, 0xAFA3, 0x7821, 0xD2E1, 0x7822, 0xD2DB, - 0x7823, 0xD2D9, 0x7825, 0xAFA1, 0x7826, 0xD6B9, 0x7827, 0xAF7A, - 0x7828, 0xD2DE, 0x7829, 0xD2E2, 0x782A, 0xD2E4, 0x782B, 0xD2E0, - 0x782C, 0xD2DA, 0x782D, 0xAFA2, 0x782E, 0xD2DF, 0x782F, 0xD2DD, - 0x7830, 0xAF79, 0x7831, 0xD2E5, 0x7832, 0xAFA5, 0x7833, 0xD2E3, - 0x7834, 0xAF7D, 0x7835, 0xD2DC, 0x7837, 0xAF7E, 0x7838, 0xAF7B, - 0x7843, 0xB2B9, 0x7845, 0xD6BA, 0x7848, 0xD6B3, 0x7849, 0xD6B5, - 0x784A, 0xD6B7, 0x784C, 0xD6B8, 0x784D, 0xD6B6, 0x784E, 0xB2BA, - 0x7850, 0xD6BB, 0x7852, 0xD6B4, 0x785C, 0xDAC8, 0x785D, 0xB576, - 0x785E, 0xDAD0, 0x7860, 0xDAC5, 0x7862, 0xDAD1, 0x7864, 0xDAC6, - 0x7865, 0xDAC7, 0x7868, 0xDACF, 0x7869, 0xDACE, 0x786A, 0xDACB, - 0x786B, 0xB2B8, 0x786C, 0xB577, 0x786D, 0xDAC9, 0x786E, 0xDACC, - 0x786F, 0xB578, 0x7870, 0xDACD, 0x7871, 0xDACA, 0x7879, 0xDEEE, - 0x787B, 0xDEF2, 0x787C, 0xB84E, 0x787E, 0xE2F0, 0x787F, 0xB851, - 0x7880, 0xDEF0, 0x7881, 0xF9D6, 0x7883, 0xDEED, 0x7884, 0xDEE8, - 0x7885, 0xDEEA, 0x7886, 0xDEEB, 0x7887, 0xDEE4, 0x7889, 0xB84D, - 0x788C, 0xB84C, 0x788E, 0xB848, 0x788F, 0xDEE7, 0x7891, 0xB84F, - 0x7893, 0xB850, 0x7894, 0xDEE6, 0x7895, 0xDEE9, 0x7896, 0xDEF1, - 0x7897, 0xB84A, 0x7898, 0xB84B, 0x7899, 0xDEEF, 0x789A, 0xDEE5, - 0x789E, 0xE2F2, 0x789F, 0xBAD0, 0x78A0, 0xE2F4, 0x78A1, 0xDEEC, - 0x78A2, 0xE2F6, 0x78A3, 0xBAD4, 0x78A4, 0xE2F7, 0x78A5, 0xE2F3, - 0x78A7, 0xBAD1, 0x78A8, 0xE2EF, 0x78A9, 0xBAD3, 0x78AA, 0xE2EC, - 0x78AB, 0xE2F1, 0x78AC, 0xE2F5, 0x78AD, 0xE2EE, 0x78B0, 0xB849, - 0x78B2, 0xE2EB, 0x78B3, 0xBAD2, 0x78B4, 0xE2ED, 0x78BA, 0xBD54, - 0x78BB, 0xE6C1, 0x78BC, 0xBD58, 0x78BE, 0xBD56, 0x78C1, 0xBACF, - 0x78C3, 0xE6C8, 0x78C4, 0xE6C9, 0x78C5, 0xBD53, 0x78C8, 0xE6C7, - 0x78C9, 0xE6CA, 0x78CA, 0xBD55, 0x78CB, 0xBD52, 0x78CC, 0xE6C3, - 0x78CD, 0xE6C0, 0x78CE, 0xE6C5, 0x78CF, 0xE6C2, 0x78D0, 0xBD59, - 0x78D1, 0xE6C4, 0x78D4, 0xE6C6, 0x78D5, 0xBD57, 0x78DA, 0xBF6A, - 0x78DB, 0xEAA8, 0x78DD, 0xEAA2, 0x78DE, 0xEAA6, 0x78DF, 0xEAAC, - 0x78E0, 0xEAAD, 0x78E1, 0xEAA9, 0x78E2, 0xEAAA, 0x78E3, 0xEAA7, - 0x78E5, 0xEAA4, 0x78E7, 0xBF6C, 0x78E8, 0xBF69, 0x78E9, 0xEAA3, - 0x78EA, 0xEAA5, 0x78EC, 0xBF6B, 0x78ED, 0xEAAB, 0x78EF, 0xC146, - 0x78F2, 0xEDAA, 0x78F3, 0xEDA5, 0x78F4, 0xC145, 0x78F7, 0xC143, - 0x78F9, 0xEDAC, 0x78FA, 0xC144, 0x78FB, 0xEDA8, 0x78FC, 0xEDA9, - 0x78FD, 0xEDA6, 0x78FE, 0xEDAD, 0x78FF, 0xF056, 0x7901, 0xC147, - 0x7902, 0xEDA7, 0x7904, 0xEDAE, 0x7905, 0xEDAB, 0x7909, 0xF05A, - 0x790C, 0xF057, 0x790E, 0xC2A6, 0x7910, 0xF05B, 0x7911, 0xF05D, - 0x7912, 0xF05C, 0x7913, 0xF058, 0x7914, 0xF059, 0x7917, 0xF2A3, - 0x7919, 0xC3AA, 0x791B, 0xF27E, 0x791C, 0xF2A2, 0x791D, 0xF27D, - 0x791E, 0xF2A4, 0x7921, 0xF2A1, 0x7923, 0xF47A, 0x7924, 0xF47D, - 0x7925, 0xF479, 0x7926, 0xC471, 0x7927, 0xF47B, 0x7928, 0xF47C, - 0x7929, 0xF47E, 0x792A, 0xC472, 0x792B, 0xC474, 0x792C, 0xC473, - 0x792D, 0xF5E1, 0x792F, 0xF5E3, 0x7931, 0xF5E2, 0x7935, 0xF6F6, - 0x7938, 0xF8B5, 0x7939, 0xF8FA, 0x793A, 0xA5DC, 0x793D, 0xCB72, - 0x793E, 0xAAC0, 0x793F, 0xCDA3, 0x7940, 0xAAC1, 0x7941, 0xAAC2, - 0x7942, 0xCDA2, 0x7944, 0xCFF8, 0x7945, 0xCFF7, 0x7946, 0xACE6, - 0x7947, 0xACE9, 0x7948, 0xACE8, 0x7949, 0xACE7, 0x794A, 0xCFF4, - 0x794B, 0xCFF6, 0x794C, 0xCFF5, 0x794F, 0xD2E8, 0x7950, 0xAFA7, - 0x7951, 0xD2EC, 0x7952, 0xD2EB, 0x7953, 0xD2EA, 0x7954, 0xD2E6, - 0x7955, 0xAFA6, 0x7956, 0xAFAA, 0x7957, 0xAFAD, 0x795A, 0xAFAE, - 0x795B, 0xD2E7, 0x795C, 0xD2E9, 0x795D, 0xAFAC, 0x795E, 0xAFAB, - 0x795F, 0xAFA9, 0x7960, 0xAFA8, 0x7961, 0xD6C2, 0x7963, 0xD6C0, - 0x7964, 0xD6BC, 0x7965, 0xB2BB, 0x7967, 0xD6BD, 0x7968, 0xB2BC, - 0x7969, 0xD6BE, 0x796A, 0xD6BF, 0x796B, 0xD6C1, 0x796D, 0xB2BD, - 0x7970, 0xDAD5, 0x7972, 0xDAD4, 0x7973, 0xDAD3, 0x7974, 0xDAD2, - 0x7979, 0xDEF6, 0x797A, 0xB852, 0x797C, 0xDEF3, 0x797D, 0xDEF5, - 0x797F, 0xB853, 0x7981, 0xB854, 0x7982, 0xDEF4, 0x7988, 0xE341, - 0x798A, 0xE2F9, 0x798B, 0xE2FA, 0x798D, 0xBAD7, 0x798E, 0xBAD5, - 0x798F, 0xBAD6, 0x7990, 0xE343, 0x7992, 0xE342, 0x7993, 0xE2FE, - 0x7994, 0xE2FD, 0x7995, 0xE2FC, 0x7996, 0xE2FB, 0x7997, 0xE340, - 0x7998, 0xE2F8, 0x799A, 0xE6CB, 0x799B, 0xE6D0, 0x799C, 0xE6CE, - 0x79A0, 0xE6CD, 0x79A1, 0xE6CC, 0x79A2, 0xE6CF, 0x79A4, 0xEAAE, - 0x79A6, 0xBF6D, 0x79A7, 0xC148, 0x79A8, 0xEDB0, 0x79AA, 0xC149, - 0x79AB, 0xEDAF, 0x79AC, 0xF05F, 0x79AD, 0xF05E, 0x79AE, 0xC2A7, - 0x79B0, 0xF2A5, 0x79B1, 0xC3AB, 0x79B2, 0xF4A1, 0x79B3, 0xC5A1, - 0x79B4, 0xF6F7, 0x79B6, 0xF8B7, 0x79B7, 0xF8B6, 0x79B8, 0xC9A8, - 0x79B9, 0xACEA, 0x79BA, 0xACEB, 0x79BB, 0xD6C3, 0x79BD, 0xB856, - 0x79BE, 0xA5DD, 0x79BF, 0xA872, 0x79C0, 0xA871, 0x79C1, 0xA870, - 0x79C5, 0xCDA4, 0x79C8, 0xAAC4, 0x79C9, 0xAAC3, 0x79CB, 0xACEE, - 0x79CD, 0xCFFA, 0x79CE, 0xCFFD, 0x79CF, 0xCFFB, 0x79D1, 0xACEC, - 0x79D2, 0xACED, 0x79D5, 0xCFF9, 0x79D6, 0xCFFC, 0x79D8, 0xAFB5, - 0x79DC, 0xD2F3, 0x79DD, 0xD2F5, 0x79DE, 0xD2F4, 0x79DF, 0xAFB2, - 0x79E0, 0xD2EF, 0x79E3, 0xAFB0, 0x79E4, 0xAFAF, 0x79E6, 0xAFB3, - 0x79E7, 0xAFB1, 0x79E9, 0xAFB4, 0x79EA, 0xD2F2, 0x79EB, 0xD2ED, - 0x79EC, 0xD2EE, 0x79ED, 0xD2F1, 0x79EE, 0xD2F0, 0x79F6, 0xD6C6, - 0x79F7, 0xD6C7, 0x79F8, 0xD6C5, 0x79FA, 0xD6C4, 0x79FB, 0xB2BE, - 0x7A00, 0xB57D, 0x7A02, 0xDAD6, 0x7A03, 0xDAD8, 0x7A04, 0xDADA, - 0x7A05, 0xB57C, 0x7A08, 0xB57A, 0x7A0A, 0xDAD7, 0x7A0B, 0xB57B, - 0x7A0C, 0xDAD9, 0x7A0D, 0xB579, 0x7A10, 0xDF41, 0x7A11, 0xDEF7, - 0x7A12, 0xDEFA, 0x7A13, 0xDEFE, 0x7A14, 0xB85A, 0x7A15, 0xDEFC, - 0x7A17, 0xDEFB, 0x7A18, 0xDEF8, 0x7A19, 0xDEF9, 0x7A1A, 0xB858, - 0x7A1B, 0xDF40, 0x7A1C, 0xB857, 0x7A1E, 0xB85C, 0x7A1F, 0xB85B, - 0x7A20, 0xB859, 0x7A22, 0xDEFD, 0x7A26, 0xE349, 0x7A28, 0xE348, - 0x7A2B, 0xE344, 0x7A2E, 0xBAD8, 0x7A2F, 0xE347, 0x7A30, 0xE346, - 0x7A31, 0xBAD9, 0x7A37, 0xBD5E, 0x7A39, 0xE6D2, 0x7A3B, 0xBD5F, - 0x7A3C, 0xBD5B, 0x7A3D, 0xBD5D, 0x7A3F, 0xBD5A, 0x7A40, 0xBD5C, - 0x7A44, 0xEAAF, 0x7A46, 0xBF70, 0x7A47, 0xEAB1, 0x7A48, 0xEAB0, - 0x7A4A, 0xE345, 0x7A4B, 0xBF72, 0x7A4C, 0xBF71, 0x7A4D, 0xBF6E, - 0x7A4E, 0xBF6F, 0x7A54, 0xEDB5, 0x7A56, 0xEDB3, 0x7A57, 0xC14A, - 0x7A58, 0xEDB4, 0x7A5A, 0xEDB6, 0x7A5B, 0xEDB2, 0x7A5C, 0xEDB1, - 0x7A5F, 0xF060, 0x7A60, 0xC2AA, 0x7A61, 0xC2A8, 0x7A62, 0xC2A9, - 0x7A67, 0xF2A6, 0x7A68, 0xF2A7, 0x7A69, 0xC3AD, 0x7A6B, 0xC3AC, - 0x7A6C, 0xF4A3, 0x7A6D, 0xF4A4, 0x7A6E, 0xF4A2, 0x7A70, 0xF6F8, - 0x7A71, 0xF6F9, 0x7A74, 0xA5DE, 0x7A75, 0xCA48, 0x7A76, 0xA873, - 0x7A78, 0xCDA5, 0x7A79, 0xAAC6, 0x7A7A, 0xAAC5, 0x7A7B, 0xCDA6, - 0x7A7E, 0xD040, 0x7A7F, 0xACEF, 0x7A80, 0xCFFE, 0x7A81, 0xACF0, - 0x7A84, 0xAFB6, 0x7A85, 0xD2F8, 0x7A86, 0xD2F6, 0x7A87, 0xD2FC, - 0x7A88, 0xAFB7, 0x7A89, 0xD2F7, 0x7A8A, 0xD2FB, 0x7A8B, 0xD2F9, - 0x7A8C, 0xD2FA, 0x7A8F, 0xD6C8, 0x7A90, 0xD6CA, 0x7A92, 0xB2BF, - 0x7A94, 0xD6C9, 0x7A95, 0xB2C0, 0x7A96, 0xB5A2, 0x7A97, 0xB5A1, - 0x7A98, 0xB57E, 0x7A99, 0xDADB, 0x7A9E, 0xDF44, 0x7A9F, 0xB85D, - 0x7AA0, 0xB85E, 0x7AA2, 0xDF43, 0x7AA3, 0xDF42, 0x7AA8, 0xE34A, - 0x7AA9, 0xBADB, 0x7AAA, 0xBADA, 0x7AAB, 0xE34B, 0x7AAC, 0xE34C, - 0x7AAE, 0xBD61, 0x7AAF, 0xBD60, 0x7AB1, 0xEAB5, 0x7AB2, 0xE6D3, - 0x7AB3, 0xE6D5, 0x7AB4, 0xE6D4, 0x7AB5, 0xEAB4, 0x7AB6, 0xEAB2, - 0x7AB7, 0xEAB6, 0x7AB8, 0xEAB3, 0x7ABA, 0xBF73, 0x7ABE, 0xEDB7, - 0x7ABF, 0xC14B, 0x7AC0, 0xEDB8, 0x7AC1, 0xEDB9, 0x7AC4, 0xC2AB, - 0x7AC5, 0xC2AC, 0x7AC7, 0xC475, 0x7ACA, 0xC5D1, 0x7ACB, 0xA5DF, - 0x7AD1, 0xD041, 0x7AD8, 0xD2FD, 0x7AD9, 0xAFB8, 0x7ADF, 0xB3BA, - 0x7AE0, 0xB3B9, 0x7AE3, 0xB5A4, 0x7AE4, 0xDADD, 0x7AE5, 0xB5A3, - 0x7AE6, 0xDADC, 0x7AEB, 0xDF45, 0x7AED, 0xBADC, 0x7AEE, 0xE34D, - 0x7AEF, 0xBADD, 0x7AF6, 0xC476, 0x7AF7, 0xF4A5, 0x7AF9, 0xA6CB, - 0x7AFA, 0xAAC7, 0x7AFB, 0xCDA7, 0x7AFD, 0xACF2, 0x7AFF, 0xACF1, - 0x7B00, 0xD042, 0x7B01, 0xD043, 0x7B04, 0xD340, 0x7B05, 0xD342, - 0x7B06, 0xAFB9, 0x7B08, 0xD344, 0x7B09, 0xD347, 0x7B0A, 0xD345, - 0x7B0E, 0xD346, 0x7B0F, 0xD343, 0x7B10, 0xD2FE, 0x7B11, 0xAFBA, - 0x7B12, 0xD348, 0x7B13, 0xD341, 0x7B18, 0xD6D3, 0x7B19, 0xB2C6, - 0x7B1A, 0xD6DC, 0x7B1B, 0xB2C3, 0x7B1D, 0xD6D5, 0x7B1E, 0xB2C7, - 0x7B20, 0xB2C1, 0x7B22, 0xD6D0, 0x7B23, 0xD6DD, 0x7B24, 0xD6D1, - 0x7B25, 0xD6CE, 0x7B26, 0xB2C5, 0x7B28, 0xB2C2, 0x7B2A, 0xD6D4, - 0x7B2B, 0xD6D7, 0x7B2C, 0xB2C4, 0x7B2D, 0xD6D8, 0x7B2E, 0xB2C8, - 0x7B2F, 0xD6D9, 0x7B30, 0xD6CF, 0x7B31, 0xD6D6, 0x7B32, 0xD6DA, - 0x7B33, 0xD6D2, 0x7B34, 0xD6CD, 0x7B35, 0xD6CB, 0x7B38, 0xD6DB, - 0x7B3B, 0xDADF, 0x7B40, 0xDAE4, 0x7B44, 0xDAE0, 0x7B45, 0xDAE6, - 0x7B46, 0xB5A7, 0x7B47, 0xD6CC, 0x7B48, 0xDAE1, 0x7B49, 0xB5A5, - 0x7B4A, 0xDADE, 0x7B4B, 0xB5AC, 0x7B4C, 0xDAE2, 0x7B4D, 0xB5AB, - 0x7B4E, 0xDAE3, 0x7B4F, 0xB5AD, 0x7B50, 0xB5A8, 0x7B51, 0xB5AE, - 0x7B52, 0xB5A9, 0x7B54, 0xB5AA, 0x7B56, 0xB5A6, 0x7B58, 0xDAE5, - 0x7B60, 0xB861, 0x7B61, 0xDF50, 0x7B63, 0xDF53, 0x7B64, 0xDF47, - 0x7B65, 0xDF4C, 0x7B66, 0xDF46, 0x7B67, 0xB863, 0x7B69, 0xDF4A, - 0x7B6D, 0xDF48, 0x7B6E, 0xB862, 0x7B70, 0xDF4F, 0x7B71, 0xDF4E, - 0x7B72, 0xDF4B, 0x7B73, 0xDF4D, 0x7B74, 0xDF49, 0x7B75, 0xBAE1, - 0x7B76, 0xDF52, 0x7B77, 0xB85F, 0x7B78, 0xDF51, 0x7B82, 0xE35D, - 0x7B84, 0xBAE8, 0x7B85, 0xE358, 0x7B87, 0xBAE7, 0x7B88, 0xE34E, - 0x7B8A, 0xE350, 0x7B8B, 0xBAE0, 0x7B8C, 0xE355, 0x7B8D, 0xE354, - 0x7B8E, 0xE357, 0x7B8F, 0xBAE5, 0x7B90, 0xE352, 0x7B91, 0xE351, - 0x7B94, 0xBAE4, 0x7B95, 0xBADF, 0x7B96, 0xE353, 0x7B97, 0xBAE2, - 0x7B98, 0xE359, 0x7B99, 0xE35B, 0x7B9B, 0xE356, 0x7B9C, 0xE34F, - 0x7B9D, 0xBAE3, 0x7BA0, 0xBD69, 0x7BA1, 0xBADE, 0x7BA4, 0xE35C, - 0x7BAC, 0xE6D9, 0x7BAD, 0xBD62, 0x7BAF, 0xE6DB, 0x7BB1, 0xBD63, - 0x7BB4, 0xBD65, 0x7BB5, 0xE6DE, 0x7BB7, 0xE6D6, 0x7BB8, 0xBAE6, - 0x7BB9, 0xE6DC, 0x7BBE, 0xE6D8, 0x7BC0, 0xB860, 0x7BC1, 0xBD68, - 0x7BC4, 0xBD64, 0x7BC6, 0xBD66, 0x7BC7, 0xBD67, 0x7BC9, 0xBF76, - 0x7BCA, 0xE6DD, 0x7BCB, 0xE6D7, 0x7BCC, 0xBD6A, 0x7BCE, 0xE6DA, - 0x7BD4, 0xEAC0, 0x7BD5, 0xEABB, 0x7BD8, 0xEAC5, 0x7BD9, 0xBF74, - 0x7BDA, 0xEABD, 0x7BDB, 0xBF78, 0x7BDC, 0xEAC3, 0x7BDD, 0xEABA, - 0x7BDE, 0xEAB7, 0x7BDF, 0xEAC6, 0x7BE0, 0xC151, 0x7BE1, 0xBF79, - 0x7BE2, 0xEAC2, 0x7BE3, 0xEAB8, 0x7BE4, 0xBF77, 0x7BE5, 0xEABC, - 0x7BE6, 0xBF7B, 0x7BE7, 0xEAB9, 0x7BE8, 0xEABE, 0x7BE9, 0xBF7A, - 0x7BEA, 0xEAC1, 0x7BEB, 0xEAC4, 0x7BF0, 0xEDCB, 0x7BF1, 0xEDCC, - 0x7BF2, 0xEDBC, 0x7BF3, 0xEDC3, 0x7BF4, 0xEDC1, 0x7BF7, 0xC14F, - 0x7BF8, 0xEDC8, 0x7BF9, 0xEABF, 0x7BFB, 0xEDBF, 0x7BFD, 0xEDC9, - 0x7BFE, 0xC14E, 0x7BFF, 0xEDBE, 0x7C00, 0xEDBD, 0x7C01, 0xEDC7, - 0x7C02, 0xEDC4, 0x7C03, 0xEDC6, 0x7C05, 0xEDBA, 0x7C06, 0xEDCA, - 0x7C07, 0xC14C, 0x7C09, 0xEDC5, 0x7C0A, 0xEDCE, 0x7C0B, 0xEDC2, - 0x7C0C, 0xC150, 0x7C0D, 0xC14D, 0x7C0E, 0xEDC0, 0x7C0F, 0xEDBB, - 0x7C10, 0xEDCD, 0x7C11, 0xBF75, 0x7C19, 0xF063, 0x7C1C, 0xF061, - 0x7C1D, 0xF067, 0x7C1E, 0xC2B0, 0x7C1F, 0xF065, 0x7C20, 0xF064, - 0x7C21, 0xC2B2, 0x7C22, 0xF06A, 0x7C23, 0xC2B1, 0x7C25, 0xF06B, - 0x7C26, 0xF068, 0x7C27, 0xC2AE, 0x7C28, 0xF069, 0x7C29, 0xF062, - 0x7C2A, 0xC2AF, 0x7C2B, 0xC2AD, 0x7C2C, 0xF2AB, 0x7C2D, 0xF066, - 0x7C30, 0xF06C, 0x7C33, 0xF2A8, 0x7C37, 0xC3B2, 0x7C38, 0xC3B0, - 0x7C39, 0xF2AA, 0x7C3B, 0xF2AC, 0x7C3C, 0xF2A9, 0x7C3D, 0xC3B1, - 0x7C3E, 0xC3AE, 0x7C3F, 0xC3AF, 0x7C40, 0xC3B3, 0x7C43, 0xC478, - 0x7C45, 0xF4AA, 0x7C47, 0xF4A9, 0x7C48, 0xF4A7, 0x7C49, 0xF4A6, - 0x7C4A, 0xF4A8, 0x7C4C, 0xC477, 0x7C4D, 0xC479, 0x7C50, 0xC4F0, - 0x7C53, 0xF5E5, 0x7C54, 0xF5E4, 0x7C57, 0xF6FA, 0x7C59, 0xF6FC, - 0x7C5A, 0xF6FE, 0x7C5B, 0xF6FD, 0x7C5C, 0xF6FB, 0x7C5F, 0xC5A3, - 0x7C60, 0xC5A2, 0x7C63, 0xC5D3, 0x7C64, 0xC5D2, 0x7C65, 0xC5D4, - 0x7C66, 0xF7ED, 0x7C67, 0xF7EC, 0x7C69, 0xF8FB, 0x7C6A, 0xF8B8, - 0x7C6B, 0xF8FC, 0x7C6C, 0xC658, 0x7C6E, 0xC659, 0x7C6F, 0xF96D, - 0x7C72, 0xC67E, 0x7C73, 0xA6CC, 0x7C75, 0xCDA8, 0x7C78, 0xD045, - 0x7C79, 0xD046, 0x7C7A, 0xD044, 0x7C7D, 0xACF3, 0x7C7F, 0xD047, - 0x7C80, 0xD048, 0x7C81, 0xD049, 0x7C84, 0xD349, 0x7C85, 0xD34F, - 0x7C88, 0xD34D, 0x7C89, 0xAFBB, 0x7C8A, 0xD34B, 0x7C8C, 0xD34C, - 0x7C8D, 0xD34E, 0x7C91, 0xD34A, 0x7C92, 0xB2C9, 0x7C94, 0xD6DE, - 0x7C95, 0xB2CB, 0x7C96, 0xD6E0, 0x7C97, 0xB2CA, 0x7C98, 0xD6DF, - 0x7C9E, 0xDAE8, 0x7C9F, 0xB5AF, 0x7CA1, 0xDAEA, 0x7CA2, 0xDAE7, - 0x7CA3, 0xD6E1, 0x7CA5, 0xB5B0, 0x7CA7, 0xF9DB, 0x7CA8, 0xDAE9, - 0x7CAF, 0xDF56, 0x7CB1, 0xB864, 0x7CB2, 0xDF54, 0x7CB3, 0xB865, - 0x7CB4, 0xDF55, 0x7CB5, 0xB866, 0x7CB9, 0xBAE9, 0x7CBA, 0xE361, - 0x7CBB, 0xE35E, 0x7CBC, 0xE360, 0x7CBD, 0xBAEA, 0x7CBE, 0xBAEB, - 0x7CBF, 0xE35F, 0x7CC5, 0xE6DF, 0x7CC8, 0xE6E0, 0x7CCA, 0xBD6B, - 0x7CCB, 0xE6E2, 0x7CCC, 0xE6E1, 0x7CCE, 0xA261, 0x7CD0, 0xEACA, - 0x7CD1, 0xEACB, 0x7CD2, 0xEAC7, 0x7CD4, 0xEAC8, 0x7CD5, 0xBF7C, - 0x7CD6, 0xBF7D, 0x7CD7, 0xEAC9, 0x7CD9, 0xC157, 0x7CDC, 0xC153, - 0x7CDD, 0xC158, 0x7CDE, 0xC154, 0x7CDF, 0xC156, 0x7CE0, 0xC152, - 0x7CE2, 0xC155, 0x7CE7, 0xC2B3, 0x7CE8, 0xEDCF, 0x7CEA, 0xF2AE, - 0x7CEC, 0xF2AD, 0x7CEE, 0xF4AB, 0x7CEF, 0xC47A, 0x7CF0, 0xC47B, - 0x7CF1, 0xF741, 0x7CF2, 0xF5E6, 0x7CF4, 0xF740, 0x7CF6, 0xF8FD, - 0x7CF7, 0xF9A4, 0x7CF8, 0xA6CD, 0x7CFB, 0xA874, 0x7CFD, 0xCDA9, - 0x7CFE, 0xAAC8, 0x7D00, 0xACF6, 0x7D01, 0xD04C, 0x7D02, 0xACF4, - 0x7D03, 0xD04A, 0x7D04, 0xACF9, 0x7D05, 0xACF5, 0x7D06, 0xACFA, - 0x7D07, 0xACF8, 0x7D08, 0xD04B, 0x7D09, 0xACF7, 0x7D0A, 0xAFBF, - 0x7D0B, 0xAFBE, 0x7D0C, 0xD35A, 0x7D0D, 0xAFC7, 0x7D0E, 0xD353, - 0x7D0F, 0xD359, 0x7D10, 0xAFC3, 0x7D11, 0xD352, 0x7D12, 0xD358, - 0x7D13, 0xD356, 0x7D14, 0xAFC2, 0x7D15, 0xAFC4, 0x7D16, 0xD355, - 0x7D17, 0xAFBD, 0x7D18, 0xD354, 0x7D19, 0xAFC8, 0x7D1A, 0xAFC5, - 0x7D1B, 0xAFC9, 0x7D1C, 0xAFC6, 0x7D1D, 0xD351, 0x7D1E, 0xD350, - 0x7D1F, 0xD357, 0x7D20, 0xAFC0, 0x7D21, 0xAFBC, 0x7D22, 0xAFC1, - 0x7D28, 0xD6F0, 0x7D29, 0xD6E9, 0x7D2B, 0xB5B5, 0x7D2C, 0xD6E8, - 0x7D2E, 0xB2CF, 0x7D2F, 0xB2D6, 0x7D30, 0xB2D3, 0x7D31, 0xB2D9, - 0x7D32, 0xB2D8, 0x7D33, 0xB2D4, 0x7D35, 0xD6E2, 0x7D36, 0xD6E5, - 0x7D38, 0xD6E4, 0x7D39, 0xB2D0, 0x7D3A, 0xD6E6, 0x7D3B, 0xD6EF, - 0x7D3C, 0xB2D1, 0x7D3D, 0xD6E3, 0x7D3E, 0xD6EC, 0x7D3F, 0xD6ED, - 0x7D40, 0xB2D2, 0x7D41, 0xD6EA, 0x7D42, 0xB2D7, 0x7D43, 0xB2CD, - 0x7D44, 0xB2D5, 0x7D45, 0xD6E7, 0x7D46, 0xB2CC, 0x7D47, 0xD6EB, - 0x7D4A, 0xD6EE, 0x7D4E, 0xDAFB, 0x7D4F, 0xDAF2, 0x7D50, 0xB5B2, - 0x7D51, 0xDAF9, 0x7D52, 0xDAF6, 0x7D53, 0xDAEE, 0x7D54, 0xDAF7, - 0x7D55, 0xB5B4, 0x7D56, 0xDAEF, 0x7D58, 0xDAEB, 0x7D5B, 0xB86C, - 0x7D5C, 0xDAF4, 0x7D5E, 0xB5B1, 0x7D5F, 0xDAFA, 0x7D61, 0xB5B8, - 0x7D62, 0xB5BA, 0x7D63, 0xDAED, 0x7D66, 0xB5B9, 0x7D67, 0xDAF0, - 0x7D68, 0xB5B3, 0x7D69, 0xDAF8, 0x7D6A, 0xDAF1, 0x7D6B, 0xDAF5, - 0x7D6D, 0xDAF3, 0x7D6E, 0xB5B6, 0x7D6F, 0xDAEC, 0x7D70, 0xB5BB, - 0x7D71, 0xB2CE, 0x7D72, 0xB5B7, 0x7D73, 0xB5BC, 0x7D79, 0xB868, - 0x7D7A, 0xDF5D, 0x7D7B, 0xDF5F, 0x7D7C, 0xDF61, 0x7D7D, 0xDF65, - 0x7D7F, 0xDF5B, 0x7D80, 0xDF59, 0x7D81, 0xB86A, 0x7D83, 0xDF60, - 0x7D84, 0xDF64, 0x7D85, 0xDF5C, 0x7D86, 0xDF58, 0x7D88, 0xDF57, - 0x7D8C, 0xDF62, 0x7D8D, 0xDF5A, 0x7D8E, 0xDF5E, 0x7D8F, 0xB86B, - 0x7D91, 0xB869, 0x7D92, 0xDF66, 0x7D93, 0xB867, 0x7D94, 0xDF63, - 0x7D96, 0xE372, 0x7D9C, 0xBAEE, 0x7D9D, 0xE36A, 0x7D9E, 0xBD78, - 0x7D9F, 0xE374, 0x7DA0, 0xBAF1, 0x7DA1, 0xE378, 0x7DA2, 0xBAF7, - 0x7DA3, 0xE365, 0x7DA6, 0xE375, 0x7DA7, 0xE362, 0x7DA9, 0xE377, - 0x7DAA, 0xE366, 0x7DAC, 0xBAFE, 0x7DAD, 0xBAFB, 0x7DAE, 0xE376, - 0x7DAF, 0xE370, 0x7DB0, 0xBAED, 0x7DB1, 0xBAF5, 0x7DB2, 0xBAF4, - 0x7DB4, 0xBAF3, 0x7DB5, 0xBAF9, 0x7DB7, 0xE363, 0x7DB8, 0xBAFA, - 0x7DB9, 0xE371, 0x7DBA, 0xBAF6, 0x7DBB, 0xBAEC, 0x7DBC, 0xE373, - 0x7DBD, 0xBAEF, 0x7DBE, 0xBAF0, 0x7DBF, 0xBAF8, 0x7DC0, 0xE368, - 0x7DC1, 0xE367, 0x7DC2, 0xE364, 0x7DC4, 0xE36C, 0x7DC5, 0xE369, - 0x7DC6, 0xE36D, 0x7DC7, 0xBAFD, 0x7DC9, 0xE379, 0x7DCA, 0xBAF2, - 0x7DCB, 0xE36E, 0x7DCC, 0xE36F, 0x7DCE, 0xE36B, 0x7DD2, 0xBAFC, - 0x7DD7, 0xE6E7, 0x7DD8, 0xBD70, 0x7DD9, 0xBD79, 0x7DDA, 0xBD75, - 0x7DDB, 0xE6E4, 0x7DDD, 0xBD72, 0x7DDE, 0xBD76, 0x7DDF, 0xE6F0, - 0x7DE0, 0xBD6C, 0x7DE1, 0xE6E8, 0x7DE3, 0xBD74, 0x7DE6, 0xE6EB, - 0x7DE7, 0xE6E6, 0x7DE8, 0xBD73, 0x7DE9, 0xBD77, 0x7DEA, 0xE6E5, - 0x7DEC, 0xBD71, 0x7DEE, 0xE6EF, 0x7DEF, 0xBD6E, 0x7DF0, 0xE6EE, - 0x7DF1, 0xE6ED, 0x7DF2, 0xBD7A, 0x7DF3, 0xE572, 0x7DF4, 0xBD6D, - 0x7DF6, 0xE6EC, 0x7DF7, 0xE6E3, 0x7DF9, 0xBD7B, 0x7DFA, 0xE6EA, - 0x7DFB, 0xBD6F, 0x7E03, 0xE6E9, 0x7E08, 0xBFA2, 0x7E09, 0xBFA7, - 0x7E0A, 0xBF7E, 0x7E0B, 0xEAD8, 0x7E0C, 0xEACF, 0x7E0D, 0xEADB, - 0x7E0E, 0xEAD3, 0x7E0F, 0xEAD9, 0x7E10, 0xBFA8, 0x7E11, 0xBFA1, - 0x7E12, 0xEACC, 0x7E13, 0xEAD2, 0x7E14, 0xEADC, 0x7E15, 0xEAD5, - 0x7E16, 0xEADA, 0x7E17, 0xEACE, 0x7E1A, 0xEAD6, 0x7E1B, 0xBFA3, - 0x7E1C, 0xEAD4, 0x7E1D, 0xBFA6, 0x7E1E, 0xBFA5, 0x7E1F, 0xEAD0, - 0x7E20, 0xEAD1, 0x7E21, 0xEACD, 0x7E22, 0xEAD7, 0x7E23, 0xBFA4, - 0x7E24, 0xEADE, 0x7E25, 0xEADD, 0x7E29, 0xEDDA, 0x7E2A, 0xEDD6, - 0x7E2B, 0xC15F, 0x7E2D, 0xEDD0, 0x7E2E, 0xC159, 0x7E2F, 0xC169, - 0x7E30, 0xEDDC, 0x7E31, 0xC161, 0x7E32, 0xC15D, 0x7E33, 0xEDD3, - 0x7E34, 0xC164, 0x7E35, 0xC167, 0x7E36, 0xEDDE, 0x7E37, 0xC15C, - 0x7E38, 0xEDD5, 0x7E39, 0xC165, 0x7E3A, 0xEDE0, 0x7E3B, 0xEDDD, - 0x7E3C, 0xEDD1, 0x7E3D, 0xC160, 0x7E3E, 0xC15A, 0x7E3F, 0xC168, - 0x7E40, 0xEDD8, 0x7E41, 0xC163, 0x7E42, 0xEDD2, 0x7E43, 0xC15E, - 0x7E44, 0xEDDF, 0x7E45, 0xC162, 0x7E46, 0xC15B, 0x7E47, 0xEDD9, - 0x7E48, 0xC166, 0x7E49, 0xEDD7, 0x7E4C, 0xEDDB, 0x7E50, 0xF06E, - 0x7E51, 0xF074, 0x7E52, 0xC2B9, 0x7E53, 0xF077, 0x7E54, 0xC2B4, - 0x7E55, 0xC2B5, 0x7E56, 0xF06F, 0x7E57, 0xF076, 0x7E58, 0xF071, - 0x7E59, 0xC2BA, 0x7E5A, 0xC2B7, 0x7E5C, 0xF06D, 0x7E5E, 0xC2B6, - 0x7E5F, 0xF073, 0x7E60, 0xF075, 0x7E61, 0xC2B8, 0x7E62, 0xF072, - 0x7E63, 0xF070, 0x7E68, 0xF2B8, 0x7E69, 0xC3B7, 0x7E6A, 0xC3B8, - 0x7E6B, 0xC3B4, 0x7E6D, 0xC3B5, 0x7E6F, 0xF2B4, 0x7E70, 0xF2B2, - 0x7E72, 0xF2B6, 0x7E73, 0xC3BA, 0x7E74, 0xF2B7, 0x7E75, 0xF2B0, - 0x7E76, 0xF2AF, 0x7E77, 0xF2B3, 0x7E78, 0xF2B1, 0x7E79, 0xC3B6, - 0x7E7A, 0xF2B5, 0x7E7B, 0xF4AC, 0x7E7C, 0xC47E, 0x7E7D, 0xC47D, - 0x7E7E, 0xF4AD, 0x7E80, 0xF4AF, 0x7E81, 0xF4AE, 0x7E82, 0xC4A1, - 0x7E86, 0xF5EB, 0x7E87, 0xF5E8, 0x7E88, 0xF5E9, 0x7E8A, 0xF5E7, - 0x7E8B, 0xF5EA, 0x7E8C, 0xC4F2, 0x7E8D, 0xF5EC, 0x7E8F, 0xC4F1, - 0x7E91, 0xF742, 0x7E93, 0xC5D5, 0x7E94, 0xC5D7, 0x7E95, 0xF7EE, - 0x7E96, 0xC5D6, 0x7E97, 0xF8B9, 0x7E98, 0xF940, 0x7E99, 0xF942, - 0x7E9A, 0xF8FE, 0x7E9B, 0xF941, 0x7E9C, 0xC66C, 0x7F36, 0xA6CE, - 0x7F38, 0xACFB, 0x7F39, 0xD26F, 0x7F3A, 0xAFCA, 0x7F3D, 0xB2DA, - 0x7F3E, 0xDAFC, 0x7F3F, 0xDAFD, 0x7F43, 0xEADF, 0x7F44, 0xC16A, - 0x7F45, 0xEDE1, 0x7F48, 0xC2BB, 0x7F4A, 0xF2BA, 0x7F4B, 0xF2B9, - 0x7F4C, 0xC4A2, 0x7F4D, 0xF5ED, 0x7F4F, 0xF743, 0x7F50, 0xC5F8, - 0x7F51, 0xCA49, 0x7F54, 0xAAC9, 0x7F55, 0xA875, 0x7F58, 0xD04D, - 0x7F5B, 0xD360, 0x7F5C, 0xD35B, 0x7F5D, 0xD35F, 0x7F5E, 0xD35D, - 0x7F5F, 0xAFCB, 0x7F60, 0xD35E, 0x7F61, 0xD35C, 0x7F63, 0xD6F1, - 0x7F65, 0xDAFE, 0x7F66, 0xDB40, 0x7F67, 0xDF69, 0x7F68, 0xDF6A, - 0x7F69, 0xB86E, 0x7F6A, 0xB86F, 0x7F6B, 0xDF68, 0x7F6C, 0xDF6B, - 0x7F6D, 0xDF67, 0x7F6E, 0xB86D, 0x7F70, 0xBB40, 0x7F72, 0xB870, - 0x7F73, 0xE37A, 0x7F75, 0xBD7C, 0x7F76, 0xE6F1, 0x7F77, 0xBD7D, - 0x7F79, 0xBFA9, 0x7F7A, 0xEAE2, 0x7F7B, 0xEAE0, 0x7F7C, 0xEAE1, - 0x7F7D, 0xEDE4, 0x7F7E, 0xEDE3, 0x7F7F, 0xEDE2, 0x7F83, 0xF2BB, - 0x7F85, 0xC3B9, 0x7F86, 0xF2BC, 0x7F87, 0xF744, 0x7F88, 0xC5F9, - 0x7F89, 0xF8BA, 0x7F8A, 0xA6CF, 0x7F8B, 0xAACB, 0x7F8C, 0xAACA, - 0x7F8D, 0xD04F, 0x7F8E, 0xACFC, 0x7F91, 0xD04E, 0x7F92, 0xD362, - 0x7F94, 0xAFCC, 0x7F95, 0xD6F2, 0x7F96, 0xD361, 0x7F9A, 0xB2DC, - 0x7F9B, 0xD6F5, 0x7F9C, 0xD6F3, 0x7F9D, 0xD6F4, 0x7F9E, 0xB2DB, - 0x7FA0, 0xDB42, 0x7FA1, 0xDB43, 0x7FA2, 0xDB41, 0x7FA4, 0xB873, - 0x7FA5, 0xDF6D, 0x7FA6, 0xDF6C, 0x7FA7, 0xDF6E, 0x7FA8, 0xB872, - 0x7FA9, 0xB871, 0x7FAC, 0xE6F2, 0x7FAD, 0xE6F4, 0x7FAF, 0xBD7E, - 0x7FB0, 0xE6F3, 0x7FB1, 0xEAE3, 0x7FB2, 0xBFAA, 0x7FB3, 0xF079, - 0x7FB5, 0xF078, 0x7FB6, 0xC3BB, 0x7FB7, 0xF2BD, 0x7FB8, 0xC3BD, - 0x7FB9, 0xC3BC, 0x7FBA, 0xF4B0, 0x7FBB, 0xF5EE, 0x7FBC, 0xC4F3, - 0x7FBD, 0xA6D0, 0x7FBE, 0xD050, 0x7FBF, 0xACFD, 0x7FC0, 0xD365, - 0x7FC1, 0xAFCE, 0x7FC2, 0xD364, 0x7FC3, 0xD363, 0x7FC5, 0xAFCD, - 0x7FC7, 0xD6FB, 0x7FC9, 0xD6FD, 0x7FCA, 0xD6F6, 0x7FCB, 0xD6F7, - 0x7FCC, 0xB2DD, 0x7FCD, 0xD6F8, 0x7FCE, 0xB2DE, 0x7FCF, 0xD6FC, - 0x7FD0, 0xD6F9, 0x7FD1, 0xD6FA, 0x7FD2, 0xB2DF, 0x7FD4, 0xB5BE, - 0x7FD5, 0xB5BF, 0x7FD7, 0xDB44, 0x7FDB, 0xDF6F, 0x7FDC, 0xDF70, - 0x7FDE, 0xE37E, 0x7FDF, 0xBB43, 0x7FE0, 0xBB41, 0x7FE1, 0xBB42, - 0x7FE2, 0xE37B, 0x7FE3, 0xE37C, 0x7FE5, 0xE37D, 0x7FE6, 0xE6F9, - 0x7FE8, 0xE6FA, 0x7FE9, 0xBDA1, 0x7FEA, 0xE6F7, 0x7FEB, 0xE6F6, - 0x7FEC, 0xE6F8, 0x7FED, 0xE6F5, 0x7FEE, 0xBFAD, 0x7FEF, 0xEAE4, - 0x7FF0, 0xBFAB, 0x7FF1, 0xBFAC, 0x7FF2, 0xEDE6, 0x7FF3, 0xC16B, - 0x7FF4, 0xEDE5, 0x7FF5, 0xEFA8, 0x7FF7, 0xF07A, 0x7FF8, 0xF07B, - 0x7FF9, 0xC2BC, 0x7FFB, 0xC2BD, 0x7FFC, 0xC16C, 0x7FFD, 0xF2BE, - 0x7FFE, 0xF2BF, 0x7FFF, 0xF4B1, 0x8000, 0xC4A3, 0x8001, 0xA6D1, - 0x8003, 0xA6D2, 0x8004, 0xACFE, 0x8005, 0xAACC, 0x8006, 0xAFCF, - 0x8007, 0xD051, 0x800B, 0xB5C0, 0x800C, 0xA6D3, 0x800D, 0xAD41, - 0x800E, 0xD052, 0x800F, 0xD053, 0x8010, 0xAD40, 0x8011, 0xAD42, - 0x8012, 0xA6D4, 0x8014, 0xD054, 0x8015, 0xAFD1, 0x8016, 0xD366, - 0x8017, 0xAFD3, 0x8018, 0xAFD0, 0x8019, 0xAFD2, 0x801B, 0xD741, - 0x801C, 0xB2E0, 0x801E, 0xD740, 0x801F, 0xD6FE, 0x8021, 0xDF71, - 0x8024, 0xE3A1, 0x8026, 0xBDA2, 0x8028, 0xBFAE, 0x8029, 0xEAE6, - 0x802A, 0xEAE5, 0x802C, 0xEDE7, 0x8030, 0xF5EF, 0x8033, 0xA6D5, - 0x8034, 0xCB73, 0x8035, 0xCDAA, 0x8036, 0xAD43, 0x8037, 0xD055, - 0x8039, 0xD368, 0x803D, 0xAFD4, 0x803E, 0xD367, 0x803F, 0xAFD5, - 0x8043, 0xD743, 0x8046, 0xB2E2, 0x8047, 0xD742, 0x8048, 0xD744, - 0x804A, 0xB2E1, 0x804F, 0xDB46, 0x8050, 0xDB47, 0x8051, 0xDB45, - 0x8052, 0xB5C1, 0x8056, 0xB874, 0x8058, 0xB875, 0x805A, 0xBB45, - 0x805C, 0xE3A3, 0x805D, 0xE3A2, 0x805E, 0xBB44, 0x8064, 0xE6FB, - 0x8067, 0xE6FC, 0x806C, 0xEAE7, 0x806F, 0xC170, 0x8070, 0xC16F, - 0x8071, 0xC16D, 0x8072, 0xC16E, 0x8073, 0xC171, 0x8075, 0xF07C, - 0x8076, 0xC2BF, 0x8077, 0xC2BE, 0x8078, 0xF2C0, 0x8079, 0xF4B2, - 0x807D, 0xC5A5, 0x807E, 0xC5A4, 0x807F, 0xA6D6, 0x8082, 0xD1FB, - 0x8084, 0xB877, 0x8085, 0xB5C2, 0x8086, 0xB876, 0x8087, 0xBB46, - 0x8089, 0xA6D7, 0x808A, 0xC9A9, 0x808B, 0xA6D8, 0x808C, 0xA6D9, - 0x808F, 0xCDAB, 0x8090, 0xCB76, 0x8092, 0xCB77, 0x8093, 0xA877, - 0x8095, 0xCB74, 0x8096, 0xA876, 0x8098, 0xA879, 0x8099, 0xCB75, - 0x809A, 0xA87B, 0x809B, 0xA87A, 0x809C, 0xCB78, 0x809D, 0xA878, - 0x80A1, 0xAAD1, 0x80A2, 0xAACF, 0x80A3, 0xCDAD, 0x80A5, 0xAACE, - 0x80A9, 0xAAD3, 0x80AA, 0xAAD5, 0x80AB, 0xAAD2, 0x80AD, 0xCDB0, - 0x80AE, 0xCDAC, 0x80AF, 0xAAD6, 0x80B1, 0xAAD0, 0x80B2, 0xA87C, - 0x80B4, 0xAAD4, 0x80B5, 0xCDAF, 0x80B8, 0xCDAE, 0x80BA, 0xAACD, - 0x80C2, 0xD05B, 0x80C3, 0xAD47, 0x80C4, 0xAD48, 0x80C5, 0xD05D, - 0x80C7, 0xD057, 0x80C8, 0xD05A, 0x80C9, 0xD063, 0x80CA, 0xD061, - 0x80CC, 0xAD49, 0x80CD, 0xD067, 0x80CE, 0xAD4C, 0x80CF, 0xD064, - 0x80D0, 0xD05C, 0x80D1, 0xD059, 0x80D4, 0xDB49, 0x80D5, 0xD062, - 0x80D6, 0xAD44, 0x80D7, 0xD065, 0x80D8, 0xD056, 0x80D9, 0xD05F, - 0x80DA, 0xAD46, 0x80DB, 0xAD4B, 0x80DC, 0xD060, 0x80DD, 0xAD4F, - 0x80DE, 0xAD4D, 0x80E0, 0xD058, 0x80E1, 0xAD4A, 0x80E3, 0xD05E, - 0x80E4, 0xAD4E, 0x80E5, 0xAD45, 0x80E6, 0xD066, 0x80ED, 0xAFDA, - 0x80EF, 0xAFE3, 0x80F0, 0xAFD8, 0x80F1, 0xAFD6, 0x80F2, 0xD36A, - 0x80F3, 0xAFDE, 0x80F4, 0xAFDB, 0x80F5, 0xD36C, 0x80F8, 0xAFDD, - 0x80F9, 0xD36B, 0x80FA, 0xD369, 0x80FB, 0xD36E, 0x80FC, 0xAFE2, - 0x80FD, 0xAFE0, 0x80FE, 0xDB48, 0x8100, 0xD36F, 0x8101, 0xD36D, - 0x8102, 0xAFD7, 0x8105, 0xAFD9, 0x8106, 0xAFDC, 0x8108, 0xAFDF, - 0x810A, 0xAFE1, 0x8115, 0xD74E, 0x8116, 0xB2E4, 0x8118, 0xD745, - 0x8119, 0xD747, 0x811B, 0xD748, 0x811D, 0xD750, 0x811E, 0xD74C, - 0x811F, 0xD74A, 0x8121, 0xD74D, 0x8122, 0xD751, 0x8123, 0xB2E5, - 0x8124, 0xB2E9, 0x8125, 0xD746, 0x8127, 0xD74F, 0x8129, 0xB2E7, - 0x812B, 0xB2E6, 0x812C, 0xD74B, 0x812D, 0xD749, 0x812F, 0xB2E3, - 0x8130, 0xB2E8, 0x8139, 0xB5C8, 0x813A, 0xDB51, 0x813D, 0xDB4F, - 0x813E, 0xB5CA, 0x8143, 0xDB4A, 0x8144, 0xDFA1, 0x8146, 0xB5C9, - 0x8147, 0xDB4E, 0x814A, 0xDB4B, 0x814B, 0xB5C5, 0x814C, 0xB5CB, - 0x814D, 0xDB50, 0x814E, 0xB5C7, 0x814F, 0xDB4D, 0x8150, 0xBB47, - 0x8151, 0xB5C6, 0x8152, 0xDB4C, 0x8153, 0xB5CC, 0x8154, 0xB5C4, - 0x8155, 0xB5C3, 0x815B, 0xDF77, 0x815C, 0xDF75, 0x815E, 0xDF7B, - 0x8160, 0xDF73, 0x8161, 0xDFA2, 0x8162, 0xDF78, 0x8164, 0xDF72, - 0x8165, 0xB87B, 0x8166, 0xB8A3, 0x8167, 0xDF7D, 0x8169, 0xDF76, - 0x816B, 0xB87E, 0x816E, 0xB87C, 0x816F, 0xDF7E, 0x8170, 0xB879, - 0x8171, 0xB878, 0x8172, 0xDF79, 0x8173, 0xB87D, 0x8174, 0xB5CD, - 0x8176, 0xDF7C, 0x8177, 0xDF74, 0x8178, 0xB87A, 0x8179, 0xB8A1, - 0x817A, 0xB8A2, 0x817F, 0xBB4C, 0x8180, 0xBB48, 0x8182, 0xBB4D, - 0x8183, 0xE3A6, 0x8186, 0xE3A5, 0x8187, 0xE3A7, 0x8188, 0xBB4A, - 0x8189, 0xE3A4, 0x818A, 0xBB4B, 0x818B, 0xE3AA, 0x818C, 0xE3A9, - 0x818D, 0xE3A8, 0x818F, 0xBB49, 0x8195, 0xE741, 0x8197, 0xE744, - 0x8198, 0xBDA8, 0x8199, 0xE743, 0x819A, 0xBDA7, 0x819B, 0xBDA3, - 0x819C, 0xBDA4, 0x819D, 0xBDA5, 0x819E, 0xE740, 0x819F, 0xE6FE, - 0x81A0, 0xBDA6, 0x81A2, 0xE742, 0x81A3, 0xE6FD, 0x81A6, 0xEAE9, - 0x81A7, 0xEAF3, 0x81A8, 0xBFB1, 0x81A9, 0xBFB0, 0x81AB, 0xEAED, - 0x81AC, 0xEAEF, 0x81AE, 0xEAEA, 0x81B0, 0xEAEE, 0x81B1, 0xEAE8, - 0x81B2, 0xEAF1, 0x81B3, 0xBFAF, 0x81B4, 0xEAF0, 0x81B5, 0xEAEC, - 0x81B7, 0xEAF2, 0x81B9, 0xEAEB, 0x81BA, 0xC174, 0x81BB, 0xEDE8, - 0x81BC, 0xEDEE, 0x81BD, 0xC178, 0x81BE, 0xC17A, 0x81BF, 0xC177, - 0x81C0, 0xC176, 0x81C2, 0xC175, 0x81C3, 0xC173, 0x81C4, 0xEDE9, - 0x81C5, 0xEDEC, 0x81C6, 0xC172, 0x81C7, 0xEDED, 0x81C9, 0xC179, - 0x81CA, 0xEDEB, 0x81CC, 0xEDEA, 0x81CD, 0xC2C0, 0x81CF, 0xC2C1, - 0x81D0, 0xF0A1, 0x81D1, 0xF07D, 0x81D2, 0xF07E, 0x81D5, 0xF2C2, - 0x81D7, 0xF2C1, 0x81D8, 0xC3BE, 0x81D9, 0xF4B4, 0x81DA, 0xC4A4, - 0x81DB, 0xF4B3, 0x81DD, 0xF5F0, 0x81DE, 0xF745, 0x81DF, 0xC5A6, - 0x81E0, 0xF943, 0x81E1, 0xF944, 0x81E2, 0xC5D8, 0x81E3, 0xA6DA, - 0x81E5, 0xAAD7, 0x81E6, 0xDB52, 0x81E7, 0xBB4E, 0x81E8, 0xC17B, - 0x81E9, 0xEDEF, 0x81EA, 0xA6DB, 0x81EC, 0xAFE5, 0x81ED, 0xAFE4, - 0x81EE, 0xDB53, 0x81F2, 0xEAF4, 0x81F3, 0xA6DC, 0x81F4, 0xAD50, - 0x81F7, 0xDB54, 0x81F8, 0xDB55, 0x81F9, 0xDB56, 0x81FA, 0xBB4F, - 0x81FB, 0xBFB2, 0x81FC, 0xA6DD, 0x81FE, 0xAAD8, 0x81FF, 0xD068, - 0x8200, 0xAFE6, 0x8201, 0xD370, 0x8202, 0xB2EA, 0x8204, 0xDB57, - 0x8205, 0xB8A4, 0x8207, 0xBB50, 0x8208, 0xBFB3, 0x8209, 0xC17C, - 0x820A, 0xC2C2, 0x820B, 0xF4B5, 0x820C, 0xA6DE, 0x820D, 0xAAD9, - 0x8210, 0xAFE7, 0x8211, 0xD752, 0x8212, 0xB5CE, 0x8214, 0xBB51, - 0x8215, 0xE3AB, 0x8216, 0xE745, 0x821B, 0xA6DF, 0x821C, 0xB5CF, - 0x821D, 0xDFA3, 0x821E, 0xBB52, 0x821F, 0xA6E0, 0x8220, 0xCDB1, - 0x8221, 0xD069, 0x8222, 0xAD51, 0x8225, 0xD372, 0x8228, 0xAFEA, - 0x822A, 0xAFE8, 0x822B, 0xAFE9, 0x822C, 0xAFEB, 0x822F, 0xD371, - 0x8232, 0xD757, 0x8233, 0xD754, 0x8234, 0xD756, 0x8235, 0xB2EB, - 0x8236, 0xB2ED, 0x8237, 0xB2EC, 0x8238, 0xD753, 0x8239, 0xB2EE, - 0x823A, 0xD755, 0x823C, 0xDB58, 0x823D, 0xDB59, 0x823F, 0xDB5A, - 0x8240, 0xDFA6, 0x8242, 0xDFA7, 0x8244, 0xDFA5, 0x8245, 0xDFA8, - 0x8247, 0xB8A5, 0x8249, 0xDFA4, 0x824B, 0xBB53, 0x824E, 0xE74A, - 0x824F, 0xE746, 0x8250, 0xE749, 0x8251, 0xE74B, 0x8252, 0xE748, - 0x8253, 0xE747, 0x8255, 0xEAF5, 0x8256, 0xEAF6, 0x8257, 0xEAF7, - 0x8258, 0xBFB4, 0x8259, 0xBFB5, 0x825A, 0xEDF1, 0x825B, 0xEDF0, - 0x825C, 0xEDF2, 0x825E, 0xF0A3, 0x825F, 0xF0A2, 0x8261, 0xF2C4, - 0x8263, 0xF2C5, 0x8264, 0xF2C3, 0x8266, 0xC4A5, 0x8268, 0xF4B6, - 0x8269, 0xF4B7, 0x826B, 0xF746, 0x826C, 0xF7EF, 0x826D, 0xF8BB, - 0x826E, 0xA6E1, 0x826F, 0xA87D, 0x8271, 0xC17D, 0x8272, 0xA6E2, - 0x8274, 0xD758, 0x8275, 0xDB5B, 0x8277, 0xC641, 0x8278, 0xCA4A, - 0x827C, 0xCA4B, 0x827D, 0xCA4D, 0x827E, 0xA6E3, 0x827F, 0xCA4E, - 0x8280, 0xCA4C, 0x8283, 0xCBA2, 0x8284, 0xCBA3, 0x8285, 0xCB7B, - 0x828A, 0xCBA1, 0x828B, 0xA8A1, 0x828D, 0xA8A2, 0x828E, 0xCB7C, - 0x828F, 0xCB7A, 0x8290, 0xCB79, 0x8291, 0xCB7D, 0x8292, 0xA87E, - 0x8293, 0xCB7E, 0x8294, 0xD06A, 0x8298, 0xCDB6, 0x8299, 0xAADC, - 0x829A, 0xCDB5, 0x829B, 0xCDB7, 0x829D, 0xAADB, 0x829E, 0xCDBC, - 0x829F, 0xAADF, 0x82A0, 0xCDB2, 0x82A1, 0xCDC0, 0x82A2, 0xCDC6, - 0x82A3, 0xAAE6, 0x82A4, 0xCDC3, 0x82A5, 0xAAE3, 0x82A7, 0xCDB9, - 0x82A8, 0xCDBF, 0x82A9, 0xCDC1, 0x82AB, 0xCDB4, 0x82AC, 0xAAE2, - 0x82AD, 0xAADD, 0x82AE, 0xCDBA, 0x82AF, 0xAAE4, 0x82B0, 0xAAE7, - 0x82B1, 0xAAE1, 0x82B3, 0xAADA, 0x82B4, 0xCDBE, 0x82B5, 0xCDB8, - 0x82B6, 0xCDC5, 0x82B7, 0xAAE9, 0x82B8, 0xAAE5, 0x82B9, 0xAAE0, - 0x82BA, 0xCDBD, 0x82BB, 0xAFEC, 0x82BC, 0xCDBB, 0x82BD, 0xAADE, - 0x82BE, 0xAAE8, 0x82C0, 0xCDB3, 0x82C2, 0xCDC2, 0x82C3, 0xCDC4, - 0x82D1, 0xAD62, 0x82D2, 0xAD5C, 0x82D3, 0xAD64, 0x82D4, 0xAD61, - 0x82D5, 0xD071, 0x82D6, 0xD074, 0x82D7, 0xAD5D, 0x82D9, 0xD06B, - 0x82DB, 0xAD56, 0x82DC, 0xAD60, 0x82DE, 0xAD63, 0x82DF, 0xAD65, - 0x82E0, 0xD0A2, 0x82E1, 0xD077, 0x82E3, 0xAD55, 0x82E4, 0xD0A1, - 0x82E5, 0xAD59, 0x82E6, 0xAD57, 0x82E7, 0xAD52, 0x82E8, 0xD06F, - 0x82EA, 0xD07E, 0x82EB, 0xD073, 0x82EC, 0xD076, 0x82ED, 0xD0A5, - 0x82EF, 0xAD66, 0x82F0, 0xD07D, 0x82F1, 0xAD5E, 0x82F2, 0xD078, - 0x82F3, 0xD0A4, 0x82F4, 0xD075, 0x82F5, 0xD079, 0x82F6, 0xD07C, - 0x82F9, 0xD06D, 0x82FA, 0xD0A3, 0x82FB, 0xD07B, 0x82FE, 0xD06C, - 0x8300, 0xD070, 0x8301, 0xAD5F, 0x8302, 0xAD5A, 0x8303, 0xAD53, - 0x8304, 0xAD58, 0x8305, 0xAD54, 0x8306, 0xAD67, 0x8307, 0xD06E, - 0x8308, 0xD3A5, 0x8309, 0xAD5B, 0x830C, 0xD07A, 0x830D, 0xCE41, - 0x8316, 0xD3A8, 0x8317, 0xAFFA, 0x8319, 0xD376, 0x831B, 0xD3A3, - 0x831C, 0xD37D, 0x831E, 0xD3B2, 0x8320, 0xD3AA, 0x8322, 0xD37E, - 0x8324, 0xD3A9, 0x8325, 0xD378, 0x8326, 0xD37C, 0x8327, 0xD3B5, - 0x8328, 0xAFFD, 0x8329, 0xD3AD, 0x832A, 0xD3A4, 0x832B, 0xAFED, - 0x832C, 0xD3B3, 0x832D, 0xD374, 0x832F, 0xD3AC, 0x8331, 0xAFFC, - 0x8332, 0xAFF7, 0x8333, 0xD373, 0x8334, 0xAFF5, 0x8335, 0xAFF4, - 0x8336, 0xAFF9, 0x8337, 0xD3AB, 0x8338, 0xAFF1, 0x8339, 0xAFF8, - 0x833A, 0xD072, 0x833B, 0xDB5C, 0x833C, 0xD3A6, 0x833F, 0xD37A, - 0x8340, 0xAFFB, 0x8341, 0xD37B, 0x8342, 0xD3A1, 0x8343, 0xAFFE, - 0x8344, 0xD375, 0x8345, 0xD3AF, 0x8347, 0xD3AE, 0x8348, 0xD3B6, - 0x8349, 0xAFF3, 0x834A, 0xAFF0, 0x834B, 0xD3B4, 0x834C, 0xD3B0, - 0x834D, 0xD3A7, 0x834E, 0xD3A2, 0x834F, 0xAFF6, 0x8350, 0xAFF2, - 0x8351, 0xD377, 0x8352, 0xAFEE, 0x8353, 0xD3B1, 0x8354, 0xAFEF, - 0x8356, 0xD379, 0x8373, 0xD75E, 0x8374, 0xD760, 0x8375, 0xD765, - 0x8376, 0xD779, 0x8377, 0xB2FC, 0x8378, 0xB2F2, 0x837A, 0xD75D, - 0x837B, 0xB2FD, 0x837C, 0xB2FE, 0x837D, 0xD768, 0x837E, 0xD76F, - 0x837F, 0xD775, 0x8381, 0xD762, 0x8383, 0xD769, 0x8386, 0xB340, - 0x8387, 0xD777, 0x8388, 0xD772, 0x8389, 0xB2FA, 0x838A, 0xB2F8, - 0x838B, 0xD76E, 0x838C, 0xD76A, 0x838D, 0xD75C, 0x838E, 0xB2EF, - 0x838F, 0xD761, 0x8390, 0xD759, 0x8392, 0xB2F7, 0x8393, 0xB2F9, - 0x8394, 0xD766, 0x8395, 0xD763, 0x8396, 0xB2F4, 0x8397, 0xD773, - 0x8398, 0xB2F1, 0x8399, 0xD764, 0x839A, 0xD77A, 0x839B, 0xD76C, - 0x839D, 0xD76B, 0x839E, 0xB2F0, 0x83A0, 0xB2FB, 0x83A2, 0xB2F3, - 0x83A3, 0xD75A, 0x83A4, 0xD75F, 0x83A5, 0xD770, 0x83A6, 0xD776, - 0x83A7, 0xB341, 0x83A8, 0xD75B, 0x83A9, 0xD767, 0x83AA, 0xD76D, - 0x83AB, 0xB2F6, 0x83AE, 0xD778, 0x83AF, 0xD771, 0x83B0, 0xD774, - 0x83BD, 0xB2F5, 0x83BF, 0xDB6C, 0x83C0, 0xDB60, 0x83C1, 0xB5D7, - 0x83C2, 0xDB7D, 0x83C3, 0xDBA7, 0x83C4, 0xDBAA, 0x83C5, 0xB5D5, - 0x83C6, 0xDB68, 0x83C7, 0xDBA3, 0x83C8, 0xDB69, 0x83C9, 0xDB77, - 0x83CA, 0xB5E2, 0x83CB, 0xDB73, 0x83CC, 0xB5DF, 0x83CE, 0xDB74, - 0x83CF, 0xDB5D, 0x83D1, 0xDBA4, 0x83D4, 0xB5E8, 0x83D5, 0xDBA1, - 0x83D6, 0xDB75, 0x83D7, 0xDBAC, 0x83D8, 0xDB70, 0x83D9, 0xDFC8, - 0x83DB, 0xDBAF, 0x83DC, 0xB5E6, 0x83DD, 0xDB6E, 0x83DE, 0xDB7A, - 0x83DF, 0xB5E9, 0x83E0, 0xB5D4, 0x83E1, 0xDB72, 0x83E2, 0xDBAD, - 0x83E3, 0xDB6B, 0x83E4, 0xDB64, 0x83E5, 0xDB6F, 0x83E7, 0xDB63, - 0x83E8, 0xDB61, 0x83E9, 0xB5D0, 0x83EA, 0xDBA5, 0x83EB, 0xDB6A, - 0x83EC, 0xDBA8, 0x83EE, 0xDBA9, 0x83EF, 0xB5D8, 0x83F0, 0xB5DD, - 0x83F1, 0xB5D9, 0x83F2, 0xB5E1, 0x83F3, 0xDB7E, 0x83F4, 0xB5DA, - 0x83F5, 0xDB76, 0x83F6, 0xDB66, 0x83F8, 0xB5D2, 0x83F9, 0xDB5E, - 0x83FA, 0xDBA2, 0x83FB, 0xDBAB, 0x83FC, 0xDB65, 0x83FD, 0xB5E0, - 0x83FE, 0xDBB0, 0x83FF, 0xDB71, 0x8401, 0xDB6D, 0x8403, 0xB5D1, - 0x8404, 0xB5E5, 0x8406, 0xDB7C, 0x8407, 0xB5E7, 0x8409, 0xDB78, - 0x840A, 0xB5DC, 0x840B, 0xB5D6, 0x840C, 0xB5DE, 0x840D, 0xB5D3, - 0x840E, 0xB5E4, 0x840F, 0xDB79, 0x8410, 0xDB67, 0x8411, 0xDB7B, - 0x8412, 0xDB62, 0x8413, 0xDBA6, 0x841B, 0xDBAE, 0x8423, 0xDB5F, - 0x8429, 0xDFC7, 0x842B, 0xDFDD, 0x842C, 0xB855, 0x842D, 0xDFCC, - 0x842F, 0xDFCA, 0x8430, 0xDFB5, 0x8431, 0xB8A9, 0x8432, 0xDFC5, - 0x8433, 0xDFD9, 0x8434, 0xDFC1, 0x8435, 0xB8B1, 0x8436, 0xDFD8, - 0x8437, 0xDFBF, 0x8438, 0xB5E3, 0x8439, 0xDFCF, 0x843A, 0xDFC0, - 0x843B, 0xDFD6, 0x843C, 0xB8B0, 0x843D, 0xB8A8, 0x843F, 0xDFAA, - 0x8440, 0xDFB2, 0x8442, 0xDFCB, 0x8443, 0xDFC3, 0x8444, 0xDFDC, - 0x8445, 0xDFC6, 0x8446, 0xB8B6, 0x8447, 0xDFD7, 0x8449, 0xB8AD, - 0x844B, 0xDFC9, 0x844C, 0xDFD1, 0x844D, 0xDFB6, 0x844E, 0xDFD0, - 0x8450, 0xDFE1, 0x8451, 0xDFB1, 0x8452, 0xDFD2, 0x8454, 0xDFDF, - 0x8456, 0xDFAB, 0x8457, 0xB5DB, 0x8459, 0xDFB9, 0x845A, 0xDFB8, - 0x845B, 0xB8AF, 0x845D, 0xDFBC, 0x845E, 0xDFBE, 0x845F, 0xDFCD, - 0x8460, 0xDFDE, 0x8461, 0xB8B2, 0x8463, 0xB8B3, 0x8465, 0xDFB0, - 0x8466, 0xB8AB, 0x8467, 0xDFB4, 0x8468, 0xDFDA, 0x8469, 0xB8B4, - 0x846B, 0xB8AC, 0x846C, 0xB8AE, 0x846D, 0xB8B5, 0x846E, 0xDFE0, - 0x846F, 0xDFD3, 0x8470, 0xDFCE, 0x8473, 0xDFBB, 0x8474, 0xDFBA, - 0x8475, 0xB8AA, 0x8476, 0xDFAC, 0x8477, 0xB8A7, 0x8478, 0xDFC4, - 0x8479, 0xDFAD, 0x847A, 0xDFC2, 0x847D, 0xDFB7, 0x847E, 0xDFDB, - 0x8482, 0xB8A6, 0x8486, 0xDFB3, 0x848D, 0xDFAF, 0x848E, 0xDFD5, - 0x848F, 0xDFAE, 0x8490, 0xBB60, 0x8491, 0xE3D3, 0x8494, 0xE3C2, - 0x8497, 0xE3AC, 0x8498, 0xE3CA, 0x8499, 0xBB58, 0x849A, 0xE3BB, - 0x849B, 0xE3C5, 0x849C, 0xBB5B, 0x849D, 0xE3BE, 0x849E, 0xBB59, - 0x849F, 0xE3AF, 0x84A0, 0xE3CD, 0x84A1, 0xE3AE, 0x84A2, 0xE3C1, - 0x84A4, 0xE3AD, 0x84A7, 0xE3BF, 0x84A8, 0xE3C8, 0x84A9, 0xE3C6, - 0x84AA, 0xE3BA, 0x84AB, 0xE3B5, 0x84AC, 0xE3B3, 0x84AE, 0xE3B4, - 0x84AF, 0xE3C7, 0x84B0, 0xE3D2, 0x84B1, 0xE3BC, 0x84B2, 0xBB5A, - 0x84B4, 0xE3B7, 0x84B6, 0xE3CB, 0x84B8, 0xBB5D, 0x84B9, 0xE3B6, - 0x84BA, 0xE3B0, 0x84BB, 0xE3C0, 0x84BC, 0xBB61, 0x84BF, 0xBB55, - 0x84C0, 0xBB5E, 0x84C1, 0xE3B8, 0x84C2, 0xE3B2, 0x84C4, 0xBB57, - 0x84C5, 0xDFD4, 0x84C6, 0xBB56, 0x84C7, 0xE3C3, 0x84C9, 0xBB54, - 0x84CA, 0xBB63, 0x84CB, 0xBB5C, 0x84CC, 0xE3C4, 0x84CD, 0xE3B9, - 0x84CE, 0xE3B1, 0x84CF, 0xE3CC, 0x84D0, 0xE3BD, 0x84D1, 0xBB62, - 0x84D2, 0xE3D0, 0x84D3, 0xBB5F, 0x84D4, 0xE3CF, 0x84D6, 0xE3C9, - 0x84D7, 0xE3CE, 0x84DB, 0xE3D1, 0x84E7, 0xE773, 0x84E8, 0xE774, - 0x84E9, 0xE767, 0x84EA, 0xE766, 0x84EB, 0xE762, 0x84EC, 0xBDB4, - 0x84EE, 0xBDAC, 0x84EF, 0xE776, 0x84F0, 0xE775, 0x84F1, 0xDFA9, - 0x84F2, 0xE75F, 0x84F3, 0xE763, 0x84F4, 0xE75D, 0x84F6, 0xE770, - 0x84F7, 0xE761, 0x84F9, 0xE777, 0x84FA, 0xE75A, 0x84FB, 0xE758, - 0x84FC, 0xE764, 0x84FD, 0xE76E, 0x84FE, 0xE769, 0x84FF, 0xBDB6, - 0x8500, 0xE74F, 0x8502, 0xE76D, 0x8506, 0xBDB7, 0x8507, 0xDFBD, - 0x8508, 0xE75B, 0x8509, 0xE752, 0x850A, 0xE755, 0x850B, 0xE77B, - 0x850C, 0xE75C, 0x850D, 0xE753, 0x850E, 0xE751, 0x850F, 0xE74E, - 0x8511, 0xBDB0, 0x8512, 0xE765, 0x8513, 0xBDAF, 0x8514, 0xBDB3, - 0x8515, 0xE760, 0x8516, 0xE768, 0x8517, 0xBDA9, 0x8518, 0xE778, - 0x8519, 0xE77C, 0x851A, 0xBDAB, 0x851C, 0xE757, 0x851D, 0xE76B, - 0x851E, 0xE76F, 0x851F, 0xE754, 0x8520, 0xE779, 0x8521, 0xBDB2, - 0x8523, 0xBDB1, 0x8524, 0xE74C, 0x8525, 0xBDB5, 0x8526, 0xE772, - 0x8527, 0xE756, 0x8528, 0xE76A, 0x8529, 0xE750, 0x852A, 0xE75E, - 0x852B, 0xE759, 0x852C, 0xBDAD, 0x852D, 0xBDAE, 0x852E, 0xE76C, - 0x852F, 0xE77D, 0x8530, 0xE77A, 0x8531, 0xE771, 0x853B, 0xE74D, - 0x853D, 0xBDAA, 0x853E, 0xEB49, 0x8540, 0xEB40, 0x8541, 0xEB43, - 0x8543, 0xBFBB, 0x8544, 0xEB45, 0x8545, 0xEAF9, 0x8546, 0xEB41, - 0x8547, 0xEB47, 0x8548, 0xBFB8, 0x8549, 0xBFBC, 0x854A, 0xBFB6, - 0x854D, 0xEAFB, 0x854E, 0xEB4C, 0x8551, 0xEB46, 0x8553, 0xEAFC, - 0x8554, 0xEB55, 0x8555, 0xEB4F, 0x8556, 0xEAF8, 0x8557, 0xEE46, - 0x8558, 0xEAFE, 0x8559, 0xBFB7, 0x855B, 0xEB4A, 0x855D, 0xEB54, - 0x855E, 0xBFBF, 0x8560, 0xEB51, 0x8561, 0xEAFD, 0x8562, 0xEB44, - 0x8563, 0xEB48, 0x8564, 0xEB42, 0x8565, 0xEB56, 0x8566, 0xEB53, - 0x8567, 0xEB50, 0x8568, 0xBFB9, 0x8569, 0xBFBA, 0x856A, 0xBFBE, - 0x856B, 0xEAFA, 0x856C, 0xEB57, 0x856D, 0xBFBD, 0x856E, 0xEB4D, - 0x8571, 0xEB4B, 0x8575, 0xEB4E, 0x8576, 0xEE53, 0x8577, 0xEE40, - 0x8578, 0xEE45, 0x8579, 0xEE52, 0x857A, 0xEE44, 0x857B, 0xEDFB, - 0x857C, 0xEE41, 0x857E, 0xC1A2, 0x8580, 0xEDF4, 0x8581, 0xEE4D, - 0x8582, 0xEE4F, 0x8583, 0xEDF3, 0x8584, 0xC1A1, 0x8585, 0xEE51, - 0x8586, 0xEE49, 0x8587, 0xC1A8, 0x8588, 0xEE50, 0x8589, 0xEE42, - 0x858A, 0xC1AA, 0x858B, 0xEDF9, 0x858C, 0xEB52, 0x858D, 0xEE4A, - 0x858E, 0xEE47, 0x858F, 0xEDF5, 0x8590, 0xEE55, 0x8591, 0xC1A4, - 0x8594, 0xC1A5, 0x8595, 0xEDF7, 0x8596, 0xEE48, 0x8598, 0xEE54, - 0x8599, 0xEE4B, 0x859A, 0xEDFD, 0x859B, 0xC1A7, 0x859C, 0xC1A3, - 0x859D, 0xEE4C, 0x859E, 0xEDFE, 0x859F, 0xEE56, 0x85A0, 0xEDF8, - 0x85A1, 0xEE43, 0x85A2, 0xEE4E, 0x85A3, 0xEDFA, 0x85A4, 0xEDFC, - 0x85A6, 0xC2CB, 0x85A7, 0xEDF6, 0x85A8, 0xC1A9, 0x85A9, 0xC2C4, - 0x85AA, 0xC17E, 0x85AF, 0xC1A6, 0x85B0, 0xC2C8, 0x85B1, 0xF0B3, - 0x85B3, 0xF0A9, 0x85B4, 0xF0A4, 0x85B5, 0xF0AA, 0x85B6, 0xF0B4, - 0x85B7, 0xF0B8, 0x85B8, 0xF0B7, 0x85B9, 0xC2CA, 0x85BA, 0xC2C9, - 0x85BD, 0xF0AB, 0x85BE, 0xF0B9, 0x85BF, 0xF0AE, 0x85C0, 0xF0A6, - 0x85C2, 0xF0A8, 0x85C3, 0xF0A7, 0x85C4, 0xF0AD, 0x85C5, 0xF0B2, - 0x85C6, 0xF0A5, 0x85C7, 0xF0AC, 0x85C8, 0xF0B1, 0x85C9, 0xC2C7, - 0x85CB, 0xF0AF, 0x85CD, 0xC2C5, 0x85CE, 0xF0B0, 0x85CF, 0xC2C3, - 0x85D0, 0xC2C6, 0x85D1, 0xF2D5, 0x85D2, 0xF0B5, 0x85D5, 0xC3C2, - 0x85D7, 0xF2CD, 0x85D8, 0xF2D1, 0x85D9, 0xF2C9, 0x85DA, 0xF2CC, - 0x85DC, 0xF2D4, 0x85DD, 0xC3C0, 0x85DE, 0xF2D9, 0x85DF, 0xF2D2, - 0x85E1, 0xF2CA, 0x85E2, 0xF2DA, 0x85E3, 0xF2D3, 0x85E4, 0xC3C3, - 0x85E5, 0xC3C4, 0x85E6, 0xF2D7, 0x85E8, 0xF2CB, 0x85E9, 0xC3BF, - 0x85EA, 0xC3C1, 0x85EB, 0xF2C6, 0x85EC, 0xF2CE, 0x85ED, 0xF2C8, - 0x85EF, 0xF2D8, 0x85F0, 0xF2D6, 0x85F1, 0xF2C7, 0x85F2, 0xF2CF, - 0x85F6, 0xF4BE, 0x85F7, 0xC3C5, 0x85F8, 0xF2D0, 0x85F9, 0xC4A7, - 0x85FA, 0xC4A9, 0x85FB, 0xC4A6, 0x85FD, 0xF4C3, 0x85FE, 0xF4BB, - 0x85FF, 0xF4B9, 0x8600, 0xF4BD, 0x8601, 0xF4BA, 0x8604, 0xF4BF, - 0x8605, 0xF4C1, 0x8606, 0xC4AA, 0x8607, 0xC4AC, 0x8609, 0xF4C0, - 0x860A, 0xC4AD, 0x860B, 0xC4AB, 0x860C, 0xF4C2, 0x8611, 0xC4A8, - 0x8617, 0xC4F4, 0x8618, 0xF5F1, 0x8619, 0xF5F7, 0x861A, 0xC4F6, - 0x861B, 0xF4BC, 0x861C, 0xF5F6, 0x861E, 0xF5FD, 0x861F, 0xF5F4, - 0x8620, 0xF5FB, 0x8621, 0xF5FA, 0x8622, 0xF4B8, 0x8623, 0xF5F5, - 0x8624, 0xF0B6, 0x8625, 0xF5FE, 0x8626, 0xF5F3, 0x8627, 0xF5F8, - 0x8629, 0xF5FC, 0x862A, 0xF5F2, 0x862C, 0xF74A, 0x862D, 0xC4F5, - 0x862E, 0xF5F9, 0x8631, 0xF7F4, 0x8632, 0xF74B, 0x8633, 0xF749, - 0x8634, 0xF747, 0x8635, 0xF748, 0x8636, 0xF74C, 0x8638, 0xC5D9, - 0x8639, 0xF7F2, 0x863A, 0xF7F0, 0x863B, 0xF7F5, 0x863C, 0xF7F3, - 0x863E, 0xF7F6, 0x863F, 0xC5DA, 0x8640, 0xF7F1, 0x8643, 0xF8BC, - 0x8646, 0xF945, 0x8647, 0xF946, 0x8648, 0xF947, 0x864B, 0xF9C7, - 0x864C, 0xF9BD, 0x864D, 0xCA4F, 0x864E, 0xAAEA, 0x8650, 0xAD68, - 0x8652, 0xD3B8, 0x8653, 0xD3B7, 0x8654, 0xB040, 0x8655, 0xB342, - 0x8656, 0xD77C, 0x8659, 0xD77B, 0x865B, 0xB5EA, 0x865C, 0xB8B8, - 0x865E, 0xB8B7, 0x865F, 0xB8B9, 0x8661, 0xE3D4, 0x8662, 0xE77E, - 0x8663, 0xEB58, 0x8664, 0xEB5A, 0x8665, 0xEB59, 0x8667, 0xC1AB, - 0x8668, 0xEE57, 0x8669, 0xF0BA, 0x866A, 0xF9A5, 0x866B, 0xA6E4, - 0x866D, 0xCDC9, 0x866E, 0xCDCA, 0x866F, 0xCDC8, 0x8670, 0xCDC7, - 0x8671, 0xAAEB, 0x8673, 0xD0A9, 0x8674, 0xD0A7, 0x8677, 0xD0A6, - 0x8679, 0xAD69, 0x867A, 0xAD6B, 0x867B, 0xAD6A, 0x867C, 0xD0A8, - 0x8685, 0xD3C4, 0x8686, 0xD3C1, 0x8687, 0xD3BF, 0x868A, 0xB041, - 0x868B, 0xD3C2, 0x868C, 0xB046, 0x868D, 0xD3BC, 0x868E, 0xD3CB, - 0x8690, 0xD3CD, 0x8691, 0xD3BD, 0x8693, 0xB043, 0x8694, 0xD3CE, - 0x8695, 0xD3C9, 0x8696, 0xD3BB, 0x8697, 0xD3C0, 0x8698, 0xD3CA, - 0x8699, 0xD3C6, 0x869A, 0xD3C3, 0x869C, 0xB048, 0x869D, 0xD3CC, - 0x869E, 0xD3BE, 0x86A1, 0xD3C7, 0x86A2, 0xD3B9, 0x86A3, 0xB047, - 0x86A4, 0xB044, 0x86A5, 0xD3C5, 0x86A7, 0xD3C8, 0x86A8, 0xD3BA, - 0x86A9, 0xB045, 0x86AA, 0xB042, 0x86AF, 0xB34C, 0x86B0, 0xD7A5, - 0x86B1, 0xB34B, 0x86B3, 0xD7A8, 0x86B4, 0xD7AB, 0x86B5, 0xB348, - 0x86B6, 0xB346, 0x86B7, 0xD77E, 0x86B8, 0xD7A9, 0x86B9, 0xD7A7, - 0x86BA, 0xD7A4, 0x86BB, 0xD7AC, 0x86BC, 0xD7AD, 0x86BD, 0xD7AF, - 0x86BE, 0xD7B0, 0x86BF, 0xD77D, 0x86C0, 0xB345, 0x86C1, 0xD7A2, - 0x86C2, 0xD7A1, 0x86C3, 0xD7AE, 0x86C4, 0xB347, 0x86C5, 0xD7A3, - 0x86C6, 0xB349, 0x86C7, 0xB344, 0x86C8, 0xD7A6, 0x86C9, 0xB34D, - 0x86CB, 0xB34A, 0x86CC, 0xD7AA, 0x86D0, 0xB5F1, 0x86D1, 0xDBBF, - 0x86D3, 0xDBB4, 0x86D4, 0xB5EE, 0x86D6, 0xDFE7, 0x86D7, 0xDBBD, - 0x86D8, 0xDBB1, 0x86D9, 0xB5EC, 0x86DA, 0xDBB6, 0x86DB, 0xB5EF, - 0x86DC, 0xDBBA, 0x86DD, 0xDBB8, 0x86DE, 0xB5F2, 0x86DF, 0xB5EB, - 0x86E2, 0xDBB2, 0x86E3, 0xDBB5, 0x86E4, 0xB5F0, 0x86E6, 0xDBB3, - 0x86E8, 0xDBBE, 0x86E9, 0xDBBC, 0x86EA, 0xDBB7, 0x86EB, 0xDBB9, - 0x86EC, 0xDBBB, 0x86ED, 0xB5ED, 0x86F5, 0xDFE8, 0x86F6, 0xDFEE, - 0x86F7, 0xDFE4, 0x86F8, 0xDFEA, 0x86F9, 0xB8BA, 0x86FA, 0xDFE6, - 0x86FB, 0xB8C0, 0x86FE, 0xB8BF, 0x8700, 0xB8BE, 0x8701, 0xDFED, - 0x8702, 0xB8C1, 0x8703, 0xB8C2, 0x8704, 0xDFE3, 0x8705, 0xDFF0, - 0x8706, 0xB8C3, 0x8707, 0xB8BD, 0x8708, 0xB8BC, 0x8709, 0xDFEC, - 0x870A, 0xB8C4, 0x870B, 0xDFE2, 0x870C, 0xDFE5, 0x870D, 0xDFEF, - 0x870E, 0xDFEB, 0x8711, 0xE3F4, 0x8712, 0xE3E9, 0x8713, 0xB8BB, - 0x8718, 0xBB6A, 0x8719, 0xE3DD, 0x871A, 0xE3F2, 0x871B, 0xE3DE, - 0x871C, 0xBB65, 0x871E, 0xE3DB, 0x8720, 0xE3E4, 0x8721, 0xE3DC, - 0x8722, 0xBB67, 0x8723, 0xE3D6, 0x8724, 0xE3F1, 0x8725, 0xBB68, - 0x8726, 0xE3EE, 0x8727, 0xE3EF, 0x8728, 0xE3D7, 0x8729, 0xBB6D, - 0x872A, 0xE3E6, 0x872C, 0xE3E0, 0x872D, 0xE3E7, 0x872E, 0xE3DA, - 0x8730, 0xE3F3, 0x8731, 0xE3EB, 0x8732, 0xE3E5, 0x8733, 0xE3D5, - 0x8734, 0xBB69, 0x8735, 0xE3EC, 0x8737, 0xBB6C, 0x8738, 0xE3F0, - 0x873A, 0xE3EA, 0x873B, 0xBB66, 0x873C, 0xE3E8, 0x873E, 0xE3E2, - 0x873F, 0xBB64, 0x8740, 0xE3D9, 0x8741, 0xE3E1, 0x8742, 0xE3ED, - 0x8743, 0xE3DF, 0x8746, 0xE3E3, 0x874C, 0xBDC1, 0x874D, 0xDFE9, - 0x874E, 0xE7B2, 0x874F, 0xE7BB, 0x8750, 0xE7B1, 0x8751, 0xE7AD, - 0x8752, 0xE7AA, 0x8753, 0xBDC2, 0x8754, 0xE7A8, 0x8755, 0xBB6B, - 0x8756, 0xE7A1, 0x8757, 0xBDC0, 0x8758, 0xE7A7, 0x8759, 0xBDBF, - 0x875A, 0xE7AC, 0x875B, 0xE7A9, 0x875C, 0xE7B9, 0x875D, 0xE7B4, - 0x875E, 0xE7AE, 0x875F, 0xE7B3, 0x8760, 0xBDBB, 0x8761, 0xE7AB, - 0x8762, 0xE7BE, 0x8763, 0xE7A2, 0x8764, 0xE7A3, 0x8765, 0xE7BA, - 0x8766, 0xBDBC, 0x8767, 0xE7BF, 0x8768, 0xBDBE, 0x8769, 0xE7C0, - 0x876A, 0xE7B0, 0x876B, 0xE3D8, 0x876C, 0xE7B6, 0x876D, 0xE7AF, - 0x876E, 0xE7B8, 0x876F, 0xE7B5, 0x8773, 0xE7A6, 0x8774, 0xBDB9, - 0x8775, 0xE7BD, 0x8776, 0xBDBA, 0x8777, 0xE7A4, 0x8778, 0xBDBD, - 0x8779, 0xEB64, 0x877A, 0xE7B7, 0x877B, 0xE7BC, 0x8781, 0xEB61, - 0x8782, 0xBDB8, 0x8783, 0xBFC0, 0x8784, 0xEB6B, 0x8785, 0xEB67, - 0x8787, 0xEB65, 0x8788, 0xEB60, 0x8789, 0xEB6F, 0x878D, 0xBFC4, - 0x878F, 0xEB5C, 0x8790, 0xEB68, 0x8791, 0xEB69, 0x8792, 0xEB5F, - 0x8793, 0xEB5E, 0x8794, 0xEB6C, 0x8796, 0xEB62, 0x8797, 0xEB5D, - 0x8798, 0xEB63, 0x879A, 0xEB6E, 0x879B, 0xEB5B, 0x879C, 0xEB6D, - 0x879D, 0xEB6A, 0x879E, 0xBFC2, 0x879F, 0xBFC1, 0x87A2, 0xBFC3, - 0x87A3, 0xEB66, 0x87A4, 0xF0CB, 0x87AA, 0xEE59, 0x87AB, 0xC1B1, - 0x87AC, 0xEE5D, 0x87AD, 0xEE5A, 0x87AE, 0xEE61, 0x87AF, 0xEE67, - 0x87B0, 0xEE5C, 0x87B2, 0xEE70, 0x87B3, 0xC1AE, 0x87B4, 0xEE6A, - 0x87B5, 0xEE5F, 0x87B6, 0xEE6B, 0x87B7, 0xEE66, 0x87B8, 0xEE6D, - 0x87B9, 0xEE5E, 0x87BA, 0xC1B3, 0x87BB, 0xC1B2, 0x87BC, 0xEE60, - 0x87BD, 0xEE6E, 0x87BE, 0xEE58, 0x87BF, 0xEE6C, 0x87C0, 0xC1AC, - 0x87C2, 0xEE64, 0x87C3, 0xEE63, 0x87C4, 0xEE68, 0x87C5, 0xEE5B, - 0x87C6, 0xC1B0, 0x87C8, 0xC1B4, 0x87C9, 0xEE62, 0x87CA, 0xEE69, - 0x87CB, 0xC1B5, 0x87CC, 0xEE65, 0x87D1, 0xC1AD, 0x87D2, 0xC1AF, - 0x87D3, 0xF0C7, 0x87D4, 0xF0C5, 0x87D7, 0xF0CC, 0x87D8, 0xF0C9, - 0x87D9, 0xF0CD, 0x87DB, 0xF0BE, 0x87DC, 0xF0C6, 0x87DD, 0xF0D1, - 0x87DE, 0xEE6F, 0x87DF, 0xF0C2, 0x87E0, 0xC2CF, 0x87E1, 0xE7A5, - 0x87E2, 0xF0BD, 0x87E3, 0xF0CA, 0x87E4, 0xF0C4, 0x87E5, 0xF0C1, - 0x87E6, 0xF0BC, 0x87E7, 0xF0BB, 0x87E8, 0xF0D0, 0x87EA, 0xF0C0, - 0x87EB, 0xF0BF, 0x87EC, 0xC2CD, 0x87ED, 0xF0C8, 0x87EF, 0xC2CC, - 0x87F2, 0xC2CE, 0x87F3, 0xF0C3, 0x87F4, 0xF0CF, 0x87F6, 0xF2DE, - 0x87F7, 0xF2DF, 0x87F9, 0xC3C9, 0x87FA, 0xF2DC, 0x87FB, 0xC3C6, - 0x87FC, 0xF2E4, 0x87FE, 0xC3CA, 0x87FF, 0xF2E6, 0x8800, 0xF2DB, - 0x8801, 0xF0CE, 0x8802, 0xF2E8, 0x8803, 0xF2DD, 0x8805, 0xC3C7, - 0x8806, 0xF2E3, 0x8808, 0xF2E5, 0x8809, 0xF2E0, 0x880A, 0xF2E7, - 0x880B, 0xF2E2, 0x880C, 0xF2E1, 0x880D, 0xC3C8, 0x8810, 0xF4C5, - 0x8811, 0xF4C6, 0x8813, 0xF4C8, 0x8814, 0xC4AE, 0x8815, 0xC4AF, - 0x8816, 0xF4C9, 0x8817, 0xF4C7, 0x8819, 0xF4C4, 0x881B, 0xF642, - 0x881C, 0xF645, 0x881D, 0xF641, 0x881F, 0xC4FA, 0x8820, 0xF643, - 0x8821, 0xC4F9, 0x8822, 0xC4F8, 0x8823, 0xC4F7, 0x8824, 0xF644, - 0x8825, 0xF751, 0x8826, 0xF74F, 0x8828, 0xF74E, 0x8829, 0xF640, - 0x882A, 0xF750, 0x882B, 0xF646, 0x882C, 0xF74D, 0x882E, 0xF7F9, - 0x882F, 0xF7D7, 0x8830, 0xF7F7, 0x8831, 0xC5DB, 0x8832, 0xF7F8, - 0x8833, 0xF7FA, 0x8835, 0xF8BF, 0x8836, 0xC5FA, 0x8837, 0xF8BE, - 0x8838, 0xF8BD, 0x8839, 0xC5FB, 0x883B, 0xC65A, 0x883C, 0xF96E, - 0x883D, 0xF9A7, 0x883E, 0xF9A6, 0x883F, 0xF9A8, 0x8840, 0xA6E5, - 0x8841, 0xD0AA, 0x8843, 0xD3CF, 0x8844, 0xD3D0, 0x8848, 0xDBC0, - 0x884A, 0xF647, 0x884B, 0xF8C0, 0x884C, 0xA6E6, 0x884D, 0xAD6C, - 0x884E, 0xD0AB, 0x8852, 0xD7B1, 0x8853, 0xB34E, 0x8855, 0xDBC2, - 0x8856, 0xDBC1, 0x8857, 0xB5F3, 0x8859, 0xB8C5, 0x885A, 0xE7C1, - 0x885B, 0xBDC3, 0x885D, 0xBDC4, 0x8861, 0xBFC5, 0x8862, 0xC5FC, - 0x8863, 0xA6E7, 0x8867, 0xD0AC, 0x8868, 0xAAED, 0x8869, 0xD0AE, - 0x886A, 0xD0AD, 0x886B, 0xAD6D, 0x886D, 0xD3D1, 0x886F, 0xD3D8, - 0x8870, 0xB049, 0x8871, 0xD3D6, 0x8872, 0xD3D4, 0x8874, 0xD3DB, - 0x8875, 0xD3D2, 0x8876, 0xD3D3, 0x8877, 0xB04A, 0x8879, 0xB04E, - 0x887C, 0xD3DC, 0x887D, 0xB04D, 0x887E, 0xD3DA, 0x887F, 0xD3D7, - 0x8880, 0xD3D5, 0x8881, 0xB04B, 0x8882, 0xB04C, 0x8883, 0xD3D9, - 0x8888, 0xB350, 0x8889, 0xD7B2, 0x888B, 0xB355, 0x888C, 0xD7C2, - 0x888D, 0xB354, 0x888E, 0xD7C4, 0x8891, 0xD7B8, 0x8892, 0xB352, - 0x8893, 0xD7C3, 0x8895, 0xD7B3, 0x8896, 0xB353, 0x8897, 0xD7BF, - 0x8898, 0xD7BB, 0x8899, 0xD7BD, 0x889A, 0xD7B7, 0x889B, 0xD7BE, - 0x889E, 0xB34F, 0x889F, 0xD7BA, 0x88A1, 0xD7B9, 0x88A2, 0xD7B5, - 0x88A4, 0xD7C0, 0x88A7, 0xD7BC, 0x88A8, 0xD7B4, 0x88AA, 0xD7B6, - 0x88AB, 0xB351, 0x88AC, 0xD7C1, 0x88B1, 0xB5F6, 0x88B2, 0xDBCD, - 0x88B6, 0xDBC9, 0x88B7, 0xDBCB, 0x88B8, 0xDBC6, 0x88B9, 0xDBC5, - 0x88BA, 0xDBC3, 0x88BC, 0xDBCA, 0x88BD, 0xDBCC, 0x88BE, 0xDBC8, - 0x88C0, 0xDBC7, 0x88C1, 0xB5F4, 0x88C2, 0xB5F5, 0x88C9, 0xDBCF, - 0x88CA, 0xB8CD, 0x88CB, 0xDFF2, 0x88CC, 0xDFF8, 0x88CD, 0xDFF3, - 0x88CE, 0xDFF4, 0x88CF, 0xF9D8, 0x88D0, 0xDFF9, 0x88D2, 0xB8CF, - 0x88D4, 0xB8C7, 0x88D5, 0xB8CE, 0x88D6, 0xDFF1, 0x88D7, 0xDBC4, - 0x88D8, 0xB8CA, 0x88D9, 0xB8C8, 0x88DA, 0xDFF7, 0x88DB, 0xDFF6, - 0x88DC, 0xB8C9, 0x88DD, 0xB8CB, 0x88DE, 0xDFF5, 0x88DF, 0xB8C6, - 0x88E1, 0xB8CC, 0x88E7, 0xE3F6, 0x88E8, 0xBB74, 0x88EB, 0xE442, - 0x88EC, 0xE441, 0x88EE, 0xE3FB, 0x88EF, 0xBB76, 0x88F0, 0xE440, - 0x88F1, 0xE3F7, 0x88F2, 0xE3F8, 0x88F3, 0xBB6E, 0x88F4, 0xBB70, - 0x88F6, 0xE3FD, 0x88F7, 0xE3F5, 0x88F8, 0xBB72, 0x88F9, 0xBB71, - 0x88FA, 0xE3F9, 0x88FB, 0xE3FE, 0x88FC, 0xE3FC, 0x88FD, 0xBB73, - 0x88FE, 0xE3FA, 0x8901, 0xDBCE, 0x8902, 0xBB6F, 0x8905, 0xE7C2, - 0x8906, 0xE7C9, 0x8907, 0xBDC6, 0x8909, 0xE7CD, 0x890A, 0xBDCA, - 0x890B, 0xE7C5, 0x890C, 0xE7C3, 0x890E, 0xE7CC, 0x8910, 0xBDC5, - 0x8911, 0xE7CB, 0x8912, 0xBDC7, 0x8913, 0xBDC8, 0x8914, 0xE7C4, - 0x8915, 0xBDC9, 0x8916, 0xE7CA, 0x8917, 0xE7C6, 0x8918, 0xE7C7, - 0x8919, 0xE7C8, 0x891A, 0xBB75, 0x891E, 0xEB70, 0x891F, 0xEB7C, - 0x8921, 0xBFCA, 0x8922, 0xEB77, 0x8923, 0xEB79, 0x8925, 0xBFC8, - 0x8926, 0xEB71, 0x8927, 0xEB75, 0x8929, 0xEB78, 0x892A, 0xBFC6, - 0x892B, 0xBFC9, 0x892C, 0xEB7B, 0x892D, 0xEB73, 0x892E, 0xEB74, - 0x892F, 0xEB7A, 0x8930, 0xEB72, 0x8931, 0xEB76, 0x8932, 0xBFC7, - 0x8933, 0xEE72, 0x8935, 0xEE71, 0x8936, 0xC1B7, 0x8937, 0xEE77, - 0x8938, 0xC1B9, 0x893B, 0xC1B6, 0x893C, 0xEE73, 0x893D, 0xC1BA, - 0x893E, 0xEE74, 0x8941, 0xEE75, 0x8942, 0xEE78, 0x8944, 0xC1B8, - 0x8946, 0xF0D6, 0x8949, 0xF0D9, 0x894B, 0xF0D3, 0x894C, 0xF0D5, - 0x894F, 0xF0D4, 0x8950, 0xF0D7, 0x8951, 0xF0D8, 0x8952, 0xEE76, - 0x8953, 0xF0D2, 0x8956, 0xC3CD, 0x8957, 0xF2EC, 0x8958, 0xF2EF, - 0x8959, 0xF2F1, 0x895A, 0xF2EA, 0x895B, 0xF2EB, 0x895C, 0xF2EE, - 0x895D, 0xF2F0, 0x895E, 0xC3CE, 0x895F, 0xC3CC, 0x8960, 0xC3CB, - 0x8961, 0xF2ED, 0x8962, 0xF2E9, 0x8963, 0xF4CA, 0x8964, 0xC4B0, - 0x8966, 0xF4CB, 0x8969, 0xF649, 0x896A, 0xC4FB, 0x896B, 0xF64B, - 0x896C, 0xC4FC, 0x896D, 0xF648, 0x896E, 0xF64A, 0x896F, 0xC5A8, - 0x8971, 0xF752, 0x8972, 0xC5A7, 0x8973, 0xF7FD, 0x8974, 0xF7FC, - 0x8976, 0xF7FB, 0x8979, 0xF948, 0x897A, 0xF949, 0x897B, 0xF94B, - 0x897C, 0xF94A, 0x897E, 0xCA50, 0x897F, 0xA6E8, 0x8981, 0xAD6E, - 0x8982, 0xD7C5, 0x8983, 0xB5F7, 0x8985, 0xDFFA, 0x8986, 0xC2D0, - 0x8988, 0xF2F2, 0x898B, 0xA8A3, 0x898F, 0xB357, 0x8993, 0xB356, - 0x8995, 0xDBD0, 0x8996, 0xB5F8, 0x8997, 0xDBD2, 0x8998, 0xDBD1, - 0x899B, 0xDFFB, 0x899C, 0xB8D0, 0x899D, 0xE443, 0x899E, 0xE446, - 0x899F, 0xE445, 0x89A1, 0xE444, 0x89A2, 0xE7CE, 0x89A3, 0xE7D0, - 0x89A4, 0xE7CF, 0x89A6, 0xBFCC, 0x89AA, 0xBFCB, 0x89AC, 0xC1BB, - 0x89AD, 0xEE79, 0x89AE, 0xEE7B, 0x89AF, 0xEE7A, 0x89B2, 0xC2D1, - 0x89B6, 0xF2F4, 0x89B7, 0xF2F3, 0x89B9, 0xF4CC, 0x89BA, 0xC4B1, - 0x89BD, 0xC4FD, 0x89BE, 0xF754, 0x89BF, 0xF753, 0x89C0, 0xC65B, - 0x89D2, 0xA8A4, 0x89D3, 0xD0AF, 0x89D4, 0xAD6F, 0x89D5, 0xD7C8, - 0x89D6, 0xD7C6, 0x89D9, 0xD7C7, 0x89DA, 0xDBD4, 0x89DB, 0xDBD5, - 0x89DC, 0xE043, 0x89DD, 0xDBD3, 0x89DF, 0xDFFC, 0x89E0, 0xE041, - 0x89E1, 0xE040, 0x89E2, 0xE042, 0x89E3, 0xB8D1, 0x89E4, 0xDFFE, - 0x89E5, 0xDFFD, 0x89E6, 0xE044, 0x89E8, 0xE449, 0x89E9, 0xE447, - 0x89EB, 0xE448, 0x89EC, 0xE7D3, 0x89ED, 0xE7D1, 0x89F0, 0xE7D2, - 0x89F1, 0xEB7D, 0x89F2, 0xEE7C, 0x89F3, 0xEE7D, 0x89F4, 0xC2D2, - 0x89F6, 0xF2F5, 0x89F7, 0xF4CD, 0x89F8, 0xC4B2, 0x89FA, 0xF64C, - 0x89FB, 0xF755, 0x89FC, 0xC5A9, 0x89FE, 0xF7FE, 0x89FF, 0xF94C, - 0x8A00, 0xA8A5, 0x8A02, 0xAD71, 0x8A03, 0xAD72, 0x8A04, 0xD0B0, - 0x8A07, 0xD0B1, 0x8A08, 0xAD70, 0x8A0A, 0xB054, 0x8A0C, 0xB052, - 0x8A0E, 0xB051, 0x8A0F, 0xB058, 0x8A10, 0xB050, 0x8A11, 0xB059, - 0x8A12, 0xD3DD, 0x8A13, 0xB056, 0x8A15, 0xB053, 0x8A16, 0xB057, - 0x8A17, 0xB055, 0x8A18, 0xB04F, 0x8A1B, 0xB35F, 0x8A1D, 0xB359, - 0x8A1E, 0xD7CC, 0x8A1F, 0xB35E, 0x8A22, 0xB360, 0x8A23, 0xB35A, - 0x8A25, 0xB35B, 0x8A27, 0xD7CA, 0x8A2A, 0xB358, 0x8A2C, 0xD7CB, - 0x8A2D, 0xB35D, 0x8A30, 0xD7C9, 0x8A31, 0xB35C, 0x8A34, 0xB644, - 0x8A36, 0xB646, 0x8A39, 0xDBD8, 0x8A3A, 0xB645, 0x8A3B, 0xB5F9, - 0x8A3C, 0xB5FD, 0x8A3E, 0xB8E4, 0x8A3F, 0xE049, 0x8A40, 0xDBDA, - 0x8A41, 0xB5FE, 0x8A44, 0xDBDD, 0x8A45, 0xDBDE, 0x8A46, 0xB643, - 0x8A48, 0xDBE0, 0x8A4A, 0xDBE2, 0x8A4C, 0xDBE3, 0x8A4D, 0xDBD7, - 0x8A4E, 0xDBD6, 0x8A4F, 0xDBE4, 0x8A50, 0xB642, 0x8A51, 0xDBE1, - 0x8A52, 0xDBDF, 0x8A54, 0xB640, 0x8A55, 0xB5FB, 0x8A56, 0xB647, - 0x8A57, 0xDBDB, 0x8A58, 0xDBDC, 0x8A59, 0xDBD9, 0x8A5B, 0xB641, - 0x8A5E, 0xB5FC, 0x8A60, 0xB5FA, 0x8A61, 0xE048, 0x8A62, 0xB8DF, - 0x8A63, 0xB8DA, 0x8A66, 0xB8D5, 0x8A68, 0xB8E5, 0x8A69, 0xB8D6, - 0x8A6B, 0xB8D2, 0x8A6C, 0xB8E1, 0x8A6D, 0xB8DE, 0x8A6E, 0xB8E0, - 0x8A70, 0xB8D7, 0x8A71, 0xB8DC, 0x8A72, 0xB8D3, 0x8A73, 0xB8D4, - 0x8A74, 0xE050, 0x8A75, 0xE04D, 0x8A76, 0xE045, 0x8A77, 0xE04A, - 0x8A79, 0xB8E2, 0x8A7A, 0xE051, 0x8A7B, 0xB8E3, 0x8A7C, 0xB8D9, - 0x8A7F, 0xE047, 0x8A81, 0xE04F, 0x8A82, 0xE04B, 0x8A83, 0xE04E, - 0x8A84, 0xE04C, 0x8A85, 0xB8DD, 0x8A86, 0xE046, 0x8A87, 0xB8D8, - 0x8A8B, 0xE44C, 0x8A8C, 0xBB78, 0x8A8D, 0xBB7B, 0x8A8F, 0xE44E, - 0x8A91, 0xBBA5, 0x8A92, 0xE44D, 0x8A93, 0xBB7D, 0x8A95, 0xBDCF, - 0x8A96, 0xE44F, 0x8A98, 0xBBA4, 0x8A99, 0xE44B, 0x8A9A, 0xBBA6, - 0x8A9E, 0xBB79, 0x8AA0, 0xB8DB, 0x8AA1, 0xBB7C, 0x8AA3, 0xBB7A, - 0x8AA4, 0xBB7E, 0x8AA5, 0xBBA2, 0x8AA6, 0xBB77, 0x8AA7, 0xBBA7, - 0x8AA8, 0xBBA3, 0x8AAA, 0xBBA1, 0x8AAB, 0xE44A, 0x8AB0, 0xBDD6, - 0x8AB2, 0xBDD2, 0x8AB6, 0xBDD9, 0x8AB8, 0xE7D6, 0x8AB9, 0xBDDA, - 0x8ABA, 0xE7E2, 0x8ABB, 0xE7DB, 0x8ABC, 0xBDCB, 0x8ABD, 0xE7E3, - 0x8ABE, 0xE7DD, 0x8ABF, 0xBDD5, 0x8AC0, 0xE7DE, 0x8AC2, 0xBDD4, - 0x8AC3, 0xE7E1, 0x8AC4, 0xBDCE, 0x8AC5, 0xE7DF, 0x8AC6, 0xE7D5, - 0x8AC7, 0xBDCD, 0x8AC8, 0xEBAA, 0x8AC9, 0xBDD3, 0x8ACB, 0xBDD0, - 0x8ACD, 0xBDD8, 0x8ACF, 0xE7D4, 0x8AD1, 0xE7D8, 0x8AD2, 0xBDCC, - 0x8AD3, 0xE7D7, 0x8AD4, 0xE7D9, 0x8AD5, 0xE7DA, 0x8AD6, 0xBDD7, - 0x8AD7, 0xE7DC, 0x8AD8, 0xE7E0, 0x8AD9, 0xE7E4, 0x8ADB, 0xBDDB, - 0x8ADC, 0xBFD2, 0x8ADD, 0xEBA5, 0x8ADE, 0xEBAB, 0x8ADF, 0xEBA8, - 0x8AE0, 0xEB7E, 0x8AE1, 0xEBAC, 0x8AE2, 0xEBA1, 0x8AE4, 0xEBA7, - 0x8AE6, 0xBFCD, 0x8AE7, 0xBFD3, 0x8AE8, 0xEBAD, 0x8AEB, 0xBFCF, - 0x8AED, 0xBFD9, 0x8AEE, 0xBFD4, 0x8AEF, 0xEBAF, 0x8AF0, 0xEBA9, - 0x8AF1, 0xBFD0, 0x8AF2, 0xEBA2, 0x8AF3, 0xBFDA, 0x8AF4, 0xEBA3, - 0x8AF5, 0xEBA4, 0x8AF6, 0xBFDB, 0x8AF7, 0xBFD8, 0x8AF8, 0xBDD1, - 0x8AFA, 0xBFCE, 0x8AFB, 0xEBB0, 0x8AFC, 0xBFDC, 0x8AFE, 0xBFD5, - 0x8AFF, 0xEBAE, 0x8B00, 0xBFD1, 0x8B01, 0xBFD6, 0x8B02, 0xBFD7, - 0x8B04, 0xC1C3, 0x8B05, 0xEEA4, 0x8B06, 0xEEAD, 0x8B07, 0xEEAA, - 0x8B08, 0xEEAC, 0x8B0A, 0xC1C0, 0x8B0B, 0xEEA5, 0x8B0D, 0xEEAB, - 0x8B0E, 0xC1BC, 0x8B0F, 0xEEA7, 0x8B10, 0xC1C4, 0x8B11, 0xEEA3, - 0x8B12, 0xEEA8, 0x8B13, 0xEEAF, 0x8B14, 0xEBA6, 0x8B15, 0xEEA9, - 0x8B16, 0xEEA2, 0x8B17, 0xC1BD, 0x8B18, 0xEEA1, 0x8B19, 0xC1BE, - 0x8B1A, 0xEEB0, 0x8B1B, 0xC1BF, 0x8B1C, 0xEEAE, 0x8B1D, 0xC1C2, - 0x8B1E, 0xEE7E, 0x8B20, 0xC1C1, 0x8B22, 0xEEA6, 0x8B23, 0xF0DC, - 0x8B24, 0xF0EA, 0x8B25, 0xF0E5, 0x8B26, 0xF0E7, 0x8B27, 0xF0DB, - 0x8B28, 0xC2D3, 0x8B2A, 0xF0DA, 0x8B2B, 0xC2D6, 0x8B2C, 0xC2D5, - 0x8B2E, 0xF0E9, 0x8B2F, 0xF0E1, 0x8B30, 0xF0DE, 0x8B31, 0xF0E4, - 0x8B33, 0xF0DD, 0x8B35, 0xF0DF, 0x8B36, 0xF0E8, 0x8B37, 0xF0E6, - 0x8B39, 0xC2D4, 0x8B3A, 0xF0ED, 0x8B3B, 0xF0EB, 0x8B3C, 0xF0E2, - 0x8B3D, 0xF0EC, 0x8B3E, 0xF0E3, 0x8B40, 0xF2F9, 0x8B41, 0xC3CF, - 0x8B42, 0xF341, 0x8B45, 0xF64F, 0x8B46, 0xC3D6, 0x8B47, 0xF0E0, - 0x8B48, 0xF2F7, 0x8B49, 0xC3D2, 0x8B4A, 0xF2F8, 0x8B4B, 0xF2FD, - 0x8B4E, 0xC3D4, 0x8B4F, 0xC3D5, 0x8B50, 0xF2F6, 0x8B51, 0xF340, - 0x8B52, 0xF342, 0x8B53, 0xF2FA, 0x8B54, 0xF2FC, 0x8B55, 0xF2FE, - 0x8B56, 0xF2FB, 0x8B57, 0xF343, 0x8B58, 0xC3D1, 0x8B59, 0xC3D7, - 0x8B5A, 0xC3D3, 0x8B5C, 0xC3D0, 0x8B5D, 0xF4D0, 0x8B5F, 0xC4B7, - 0x8B60, 0xF4CE, 0x8B63, 0xF4D2, 0x8B65, 0xF4D3, 0x8B66, 0xC4B5, - 0x8B67, 0xF4D4, 0x8B68, 0xF4D1, 0x8B6A, 0xF4CF, 0x8B6B, 0xC4B8, - 0x8B6C, 0xC4B4, 0x8B6D, 0xF4D5, 0x8B6F, 0xC4B6, 0x8B70, 0xC4B3, - 0x8B74, 0xC4FE, 0x8B77, 0xC540, 0x8B78, 0xF64E, 0x8B79, 0xF64D, - 0x8B7A, 0xF650, 0x8B7B, 0xF651, 0x8B7D, 0xC541, 0x8B7E, 0xF756, - 0x8B7F, 0xF75B, 0x8B80, 0xC5AA, 0x8B82, 0xF758, 0x8B84, 0xF757, - 0x8B85, 0xF75A, 0x8B86, 0xF759, 0x8B88, 0xF843, 0x8B8A, 0xC5DC, - 0x8B8B, 0xF842, 0x8B8C, 0xF840, 0x8B8E, 0xF841, 0x8B92, 0xC5FE, - 0x8B93, 0xC5FD, 0x8B94, 0xF8C1, 0x8B95, 0xF8C2, 0x8B96, 0xC640, - 0x8B98, 0xF94D, 0x8B99, 0xF94E, 0x8B9A, 0xC667, 0x8B9C, 0xC66D, - 0x8B9E, 0xF9A9, 0x8B9F, 0xF9C8, 0x8C37, 0xA8A6, 0x8C39, 0xD7CD, - 0x8C3B, 0xD7CE, 0x8C3C, 0xE052, 0x8C3D, 0xE450, 0x8C3E, 0xE7E5, - 0x8C3F, 0xC1C6, 0x8C41, 0xC1C5, 0x8C42, 0xF0EE, 0x8C43, 0xF344, - 0x8C45, 0xF844, 0x8C46, 0xA8A7, 0x8C47, 0xD3DE, 0x8C48, 0xB05A, - 0x8C49, 0xB361, 0x8C4A, 0xE054, 0x8C4B, 0xE053, 0x8C4C, 0xBDDC, - 0x8C4D, 0xE7E6, 0x8C4E, 0xBDDD, 0x8C4F, 0xEEB1, 0x8C50, 0xC2D7, - 0x8C54, 0xC676, 0x8C55, 0xA8A8, 0x8C56, 0xCDCB, 0x8C57, 0xD3DF, - 0x8C5A, 0xB362, 0x8C5C, 0xD7CF, 0x8C5D, 0xD7D0, 0x8C5F, 0xDBE5, - 0x8C61, 0xB648, 0x8C62, 0xB8E6, 0x8C64, 0xE056, 0x8C65, 0xE055, - 0x8C66, 0xE057, 0x8C68, 0xE451, 0x8C69, 0xE452, 0x8C6A, 0xBBA8, - 0x8C6B, 0xBFDD, 0x8C6C, 0xBDDE, 0x8C6D, 0xBFDE, 0x8C6F, 0xEEB5, - 0x8C70, 0xEEB2, 0x8C71, 0xEEB4, 0x8C72, 0xEEB3, 0x8C73, 0xC1C7, - 0x8C75, 0xF0EF, 0x8C76, 0xF346, 0x8C77, 0xF345, 0x8C78, 0xCBA4, - 0x8C79, 0xB05C, 0x8C7A, 0xB05B, 0x8C7B, 0xD3E0, 0x8C7D, 0xD7D1, - 0x8C80, 0xDBE7, 0x8C81, 0xDBE6, 0x8C82, 0xB649, 0x8C84, 0xE059, - 0x8C85, 0xE05A, 0x8C86, 0xE058, 0x8C89, 0xB8E8, 0x8C8A, 0xB8E7, - 0x8C8C, 0xBBAA, 0x8C8D, 0xBBA9, 0x8C8F, 0xE7E7, 0x8C90, 0xEBB3, - 0x8C91, 0xEBB1, 0x8C92, 0xEBB2, 0x8C93, 0xBFDF, 0x8C94, 0xEEB7, - 0x8C95, 0xEEB6, 0x8C97, 0xF0F2, 0x8C98, 0xF0F1, 0x8C99, 0xF0F0, - 0x8C9A, 0xF347, 0x8C9C, 0xF9AA, 0x8C9D, 0xA8A9, 0x8C9E, 0xAD73, - 0x8CA0, 0xAD74, 0x8CA1, 0xB05D, 0x8CA2, 0xB05E, 0x8CA3, 0xD3E2, - 0x8CA4, 0xD3E1, 0x8CA5, 0xD7D2, 0x8CA7, 0xB368, 0x8CA8, 0xB366, - 0x8CA9, 0xB363, 0x8CAA, 0xB367, 0x8CAB, 0xB365, 0x8CAC, 0xB364, - 0x8CAF, 0xB64A, 0x8CB0, 0xDBEA, 0x8CB2, 0xB8ED, 0x8CB3, 0xB64C, - 0x8CB4, 0xB651, 0x8CB5, 0xDBEC, 0x8CB6, 0xB653, 0x8CB7, 0xB652, - 0x8CB8, 0xB655, 0x8CB9, 0xDBEB, 0x8CBA, 0xDBE8, 0x8CBB, 0xB64F, - 0x8CBC, 0xB64B, 0x8CBD, 0xB64D, 0x8CBE, 0xDBE9, 0x8CBF, 0xB654, - 0x8CC0, 0xB650, 0x8CC1, 0xB64E, 0x8CC2, 0xB8EF, 0x8CC3, 0xB8EE, - 0x8CC4, 0xB8EC, 0x8CC5, 0xB8F0, 0x8CC7, 0xB8EA, 0x8CC8, 0xB8EB, - 0x8CCA, 0xB8E9, 0x8CCC, 0xE05B, 0x8CCF, 0xE454, 0x8CD1, 0xBBAC, - 0x8CD2, 0xBBAD, 0x8CD3, 0xBBAB, 0x8CD5, 0xE453, 0x8CD7, 0xE455, - 0x8CD9, 0xE7EA, 0x8CDA, 0xE7EC, 0x8CDC, 0xBDE7, 0x8CDD, 0xE7ED, - 0x8CDE, 0xBDE0, 0x8CDF, 0xE7E9, 0x8CE0, 0xBDDF, 0x8CE1, 0xBDE9, - 0x8CE2, 0xBDE5, 0x8CE3, 0xBDE6, 0x8CE4, 0xBDE2, 0x8CE5, 0xE7E8, - 0x8CE6, 0xBDE1, 0x8CE7, 0xE7EE, 0x8CE8, 0xE7EB, 0x8CEA, 0xBDE8, - 0x8CEC, 0xBDE3, 0x8CED, 0xBDE4, 0x8CEE, 0xEBB5, 0x8CF0, 0xEBB7, - 0x8CF1, 0xEBB6, 0x8CF3, 0xEBB8, 0x8CF4, 0xBFE0, 0x8CF5, 0xEBB4, - 0x8CF8, 0xC1CB, 0x8CF9, 0xEEB8, 0x8CFA, 0xC1C8, 0x8CFB, 0xC1CC, - 0x8CFC, 0xC1CA, 0x8CFD, 0xC1C9, 0x8CFE, 0xF0F3, 0x8D00, 0xF0F6, - 0x8D02, 0xF0F5, 0x8D04, 0xF0F4, 0x8D05, 0xC2D8, 0x8D06, 0xF348, - 0x8D07, 0xF349, 0x8D08, 0xC3D8, 0x8D09, 0xF34A, 0x8D0A, 0xC3D9, - 0x8D0D, 0xC4BA, 0x8D0F, 0xC4B9, 0x8D10, 0xF652, 0x8D13, 0xC542, - 0x8D14, 0xF653, 0x8D15, 0xF75C, 0x8D16, 0xC5AB, 0x8D17, 0xC5AC, - 0x8D19, 0xF845, 0x8D1B, 0xC642, 0x8D64, 0xA8AA, 0x8D66, 0xB36A, - 0x8D67, 0xB369, 0x8D68, 0xE05C, 0x8D69, 0xE05D, 0x8D6B, 0xBBAE, - 0x8D6C, 0xEBB9, 0x8D6D, 0xBDEA, 0x8D6E, 0xEBBA, 0x8D6F, 0xEEB9, - 0x8D70, 0xA8AB, 0x8D72, 0xD0B2, 0x8D73, 0xAD76, 0x8D74, 0xAD75, - 0x8D76, 0xD3E3, 0x8D77, 0xB05F, 0x8D78, 0xD3E4, 0x8D79, 0xD7D5, - 0x8D7B, 0xD7D4, 0x8D7D, 0xD7D3, 0x8D80, 0xDBEE, 0x8D81, 0xB658, - 0x8D84, 0xDBED, 0x8D85, 0xB657, 0x8D89, 0xDBEF, 0x8D8A, 0xB656, - 0x8D8C, 0xE05F, 0x8D8D, 0xE062, 0x8D8E, 0xE060, 0x8D8F, 0xE061, - 0x8D90, 0xE065, 0x8D91, 0xE05E, 0x8D92, 0xE066, 0x8D93, 0xE063, - 0x8D94, 0xE064, 0x8D95, 0xBBB0, 0x8D96, 0xE456, 0x8D99, 0xBBAF, - 0x8D9B, 0xE7F2, 0x8D9C, 0xE7F0, 0x8D9F, 0xBDEB, 0x8DA0, 0xE7EF, - 0x8DA1, 0xE7F1, 0x8DA3, 0xBDEC, 0x8DA5, 0xEBBB, 0x8DA7, 0xEBBC, - 0x8DA8, 0xC1CD, 0x8DAA, 0xF34C, 0x8DAB, 0xF34E, 0x8DAC, 0xF34B, - 0x8DAD, 0xF34D, 0x8DAE, 0xF4D6, 0x8DAF, 0xF654, 0x8DB2, 0xF96F, - 0x8DB3, 0xA8AC, 0x8DB4, 0xAD77, 0x8DB5, 0xD3E5, 0x8DB6, 0xD3E7, - 0x8DB7, 0xD3E6, 0x8DB9, 0xD7D8, 0x8DBA, 0xB36C, 0x8DBC, 0xD7D6, - 0x8DBE, 0xB36B, 0x8DBF, 0xD7D9, 0x8DC1, 0xD7DA, 0x8DC2, 0xD7D7, - 0x8DC5, 0xDBFB, 0x8DC6, 0xB660, 0x8DC7, 0xDBF3, 0x8DC8, 0xDBF9, - 0x8DCB, 0xB65B, 0x8DCC, 0xB65E, 0x8DCD, 0xDBF2, 0x8DCE, 0xB659, - 0x8DCF, 0xDBF6, 0x8DD0, 0xE06C, 0x8DD1, 0xB65D, 0x8DD3, 0xDBF1, - 0x8DD5, 0xDBF7, 0x8DD6, 0xDBF4, 0x8DD7, 0xDBFA, 0x8DD8, 0xDBF0, - 0x8DD9, 0xDBF8, 0x8DDA, 0xB65C, 0x8DDB, 0xB65F, 0x8DDC, 0xDBF5, - 0x8DDD, 0xB65A, 0x8DDF, 0xB8F2, 0x8DE0, 0xE068, 0x8DE1, 0xB8F1, - 0x8DE2, 0xE06F, 0x8DE3, 0xE06E, 0x8DE4, 0xB8F8, 0x8DE6, 0xB8F9, - 0x8DE7, 0xE070, 0x8DE8, 0xB8F3, 0x8DE9, 0xE06D, 0x8DEA, 0xB8F7, - 0x8DEB, 0xE072, 0x8DEC, 0xE069, 0x8DEE, 0xE06B, 0x8DEF, 0xB8F4, - 0x8DF0, 0xE067, 0x8DF1, 0xE06A, 0x8DF2, 0xE071, 0x8DF3, 0xB8F5, - 0x8DF4, 0xE073, 0x8DFA, 0xB8F6, 0x8DFC, 0xBBB1, 0x8DFD, 0xE45B, - 0x8DFE, 0xE461, 0x8DFF, 0xE459, 0x8E00, 0xE462, 0x8E02, 0xE458, - 0x8E03, 0xE45D, 0x8E04, 0xE463, 0x8E05, 0xE460, 0x8E06, 0xE45F, - 0x8E07, 0xE45E, 0x8E09, 0xE457, 0x8E0A, 0xE45C, 0x8E0D, 0xE45A, - 0x8E0F, 0xBDF1, 0x8E10, 0xBDEE, 0x8E11, 0xE7FB, 0x8E12, 0xE841, - 0x8E13, 0xE843, 0x8E14, 0xE840, 0x8E15, 0xE7F8, 0x8E16, 0xE7FA, - 0x8E17, 0xE845, 0x8E18, 0xE842, 0x8E19, 0xE7FC, 0x8E1A, 0xE846, - 0x8E1B, 0xE7F9, 0x8E1C, 0xE844, 0x8E1D, 0xBDEF, 0x8E1E, 0xBDF5, - 0x8E1F, 0xBDF3, 0x8E20, 0xE7F3, 0x8E21, 0xBDF4, 0x8E22, 0xBDF0, - 0x8E23, 0xE7F4, 0x8E24, 0xE7F6, 0x8E25, 0xE7F5, 0x8E26, 0xE7FD, - 0x8E27, 0xE7FE, 0x8E29, 0xBDF2, 0x8E2B, 0xBDED, 0x8E2E, 0xE7F7, - 0x8E30, 0xEBC6, 0x8E31, 0xBFE2, 0x8E33, 0xEBBD, 0x8E34, 0xBFE3, - 0x8E35, 0xBFE6, 0x8E36, 0xEBC2, 0x8E38, 0xEBBF, 0x8E39, 0xBFE5, - 0x8E3C, 0xEBC3, 0x8E3D, 0xEBC4, 0x8E3E, 0xEBBE, 0x8E3F, 0xEBC7, - 0x8E40, 0xEBC0, 0x8E41, 0xEBC5, 0x8E42, 0xBFE4, 0x8E44, 0xBFE1, - 0x8E45, 0xEBC1, 0x8E47, 0xEEBF, 0x8E48, 0xC1D0, 0x8E49, 0xC1CE, - 0x8E4A, 0xC1D1, 0x8E4B, 0xC1CF, 0x8E4C, 0xEEBE, 0x8E4D, 0xEEBB, - 0x8E4E, 0xEEBA, 0x8E50, 0xEEBD, 0x8E53, 0xEEBC, 0x8E54, 0xF145, - 0x8E55, 0xC2DE, 0x8E56, 0xF0FB, 0x8E57, 0xF0FA, 0x8E59, 0xC2D9, - 0x8E5A, 0xF141, 0x8E5B, 0xF140, 0x8E5C, 0xF0F7, 0x8E5D, 0xF143, - 0x8E5E, 0xF0FC, 0x8E5F, 0xC2DD, 0x8E60, 0xF0F9, 0x8E61, 0xF142, - 0x8E62, 0xF0F8, 0x8E63, 0xC2DA, 0x8E64, 0xC2DC, 0x8E65, 0xF0FD, - 0x8E66, 0xC2DB, 0x8E67, 0xF0FE, 0x8E69, 0xF144, 0x8E6A, 0xF352, - 0x8E6C, 0xC3DE, 0x8E6D, 0xF34F, 0x8E6F, 0xF353, 0x8E72, 0xC3DB, - 0x8E73, 0xF351, 0x8E74, 0xC3E0, 0x8E76, 0xC3DD, 0x8E78, 0xF350, - 0x8E7A, 0xC3DF, 0x8E7B, 0xF354, 0x8E7C, 0xC3DA, 0x8E81, 0xC4BC, - 0x8E82, 0xC4BE, 0x8E84, 0xF4D9, 0x8E85, 0xC4BD, 0x8E86, 0xF4D7, - 0x8E87, 0xC3DC, 0x8E88, 0xF4D8, 0x8E89, 0xC4BB, 0x8E8A, 0xC543, - 0x8E8B, 0xC545, 0x8E8C, 0xF656, 0x8E8D, 0xC544, 0x8E8E, 0xF655, - 0x8E90, 0xF761, 0x8E91, 0xC5AD, 0x8E92, 0xF760, 0x8E93, 0xC5AE, - 0x8E94, 0xF75E, 0x8E95, 0xF75D, 0x8E96, 0xF762, 0x8E97, 0xF763, - 0x8E98, 0xF846, 0x8E9A, 0xF75F, 0x8E9D, 0xF8C6, 0x8E9E, 0xF8C3, - 0x8E9F, 0xF8C4, 0x8EA0, 0xF8C5, 0x8EA1, 0xC65C, 0x8EA3, 0xF951, - 0x8EA4, 0xF950, 0x8EA5, 0xF94F, 0x8EA6, 0xF970, 0x8EA8, 0xF9BE, - 0x8EA9, 0xF9AB, 0x8EAA, 0xC66E, 0x8EAB, 0xA8AD, 0x8EAC, 0xB060, - 0x8EB2, 0xB8FA, 0x8EBA, 0xBDF6, 0x8EBD, 0xEBC8, 0x8EC0, 0xC2DF, - 0x8EC2, 0xF355, 0x8EC9, 0xF9AC, 0x8ECA, 0xA8AE, 0x8ECB, 0xAAEE, - 0x8ECC, 0xAD79, 0x8ECD, 0xAD78, 0x8ECF, 0xB063, 0x8ED1, 0xD3E8, - 0x8ED2, 0xB061, 0x8ED3, 0xD3E9, 0x8ED4, 0xB062, 0x8ED7, 0xD7DF, - 0x8ED8, 0xD7DB, 0x8EDB, 0xB36D, 0x8EDC, 0xD7DE, 0x8EDD, 0xD7DD, - 0x8EDE, 0xD7DC, 0x8EDF, 0xB36E, 0x8EE0, 0xD7E0, 0x8EE1, 0xD7E1, - 0x8EE5, 0xDC43, 0x8EE6, 0xDC41, 0x8EE7, 0xDC45, 0x8EE8, 0xDC46, - 0x8EE9, 0xDC4C, 0x8EEB, 0xDC48, 0x8EEC, 0xDC4A, 0x8EEE, 0xDC42, - 0x8EEF, 0xDBFC, 0x8EF1, 0xDC49, 0x8EF4, 0xDC4B, 0x8EF5, 0xDC44, - 0x8EF6, 0xDC47, 0x8EF7, 0xDBFD, 0x8EF8, 0xB662, 0x8EF9, 0xDC40, - 0x8EFA, 0xDBFE, 0x8EFB, 0xB661, 0x8EFC, 0xB663, 0x8EFE, 0xB8FD, - 0x8EFF, 0xE075, 0x8F00, 0xE077, 0x8F01, 0xE076, 0x8F02, 0xE07B, - 0x8F03, 0xB8FB, 0x8F05, 0xE078, 0x8F06, 0xE074, 0x8F07, 0xE079, - 0x8F08, 0xE07A, 0x8F09, 0xB8FC, 0x8F0A, 0xB8FE, 0x8F0B, 0xE07C, - 0x8F0D, 0xE467, 0x8F0E, 0xE466, 0x8F10, 0xE464, 0x8F11, 0xE465, - 0x8F12, 0xBBB3, 0x8F13, 0xBBB5, 0x8F14, 0xBBB2, 0x8F15, 0xBBB4, - 0x8F16, 0xE84D, 0x8F17, 0xE84E, 0x8F18, 0xE849, 0x8F1A, 0xE84A, - 0x8F1B, 0xBDF8, 0x8F1C, 0xBDFD, 0x8F1D, 0xBDF7, 0x8F1E, 0xBDFE, - 0x8F1F, 0xBDF9, 0x8F20, 0xE84B, 0x8F23, 0xE84C, 0x8F24, 0xE848, - 0x8F25, 0xBE40, 0x8F26, 0xBDFB, 0x8F29, 0xBDFA, 0x8F2A, 0xBDFC, - 0x8F2C, 0xE847, 0x8F2E, 0xEBCA, 0x8F2F, 0xBFE8, 0x8F32, 0xEBCC, - 0x8F33, 0xBFEA, 0x8F34, 0xEBCF, 0x8F35, 0xEBCB, 0x8F36, 0xEBC9, - 0x8F37, 0xEBCE, 0x8F38, 0xBFE9, 0x8F39, 0xEBCD, 0x8F3B, 0xBFE7, - 0x8F3E, 0xC1D3, 0x8F3F, 0xC1D6, 0x8F40, 0xEEC1, 0x8F42, 0xC1D4, - 0x8F43, 0xEEC0, 0x8F44, 0xC1D2, 0x8F45, 0xC1D5, 0x8F46, 0xF146, - 0x8F47, 0xF147, 0x8F48, 0xF148, 0x8F49, 0xC2E0, 0x8F4B, 0xF149, - 0x8F4D, 0xC2E1, 0x8F4E, 0xC3E2, 0x8F4F, 0xF358, 0x8F50, 0xF359, - 0x8F51, 0xF357, 0x8F52, 0xF356, 0x8F53, 0xF35A, 0x8F54, 0xC3E1, - 0x8F55, 0xF4DD, 0x8F56, 0xF4DB, 0x8F57, 0xF4DC, 0x8F58, 0xF4DE, - 0x8F59, 0xF4DA, 0x8F5A, 0xF4DF, 0x8F5B, 0xF658, 0x8F5D, 0xF659, - 0x8F5E, 0xF657, 0x8F5F, 0xC546, 0x8F60, 0xF764, 0x8F61, 0xC5AF, - 0x8F62, 0xF765, 0x8F63, 0xF848, 0x8F64, 0xF847, 0x8F9B, 0xA8AF, - 0x8F9C, 0xB664, 0x8F9F, 0xB940, 0x8FA3, 0xBBB6, 0x8FA6, 0xBFEC, - 0x8FA8, 0xBFEB, 0x8FAD, 0xC3E3, 0x8FAE, 0xC47C, 0x8FAF, 0xC547, - 0x8FB0, 0xA8B0, 0x8FB1, 0xB064, 0x8FB2, 0xB941, 0x8FB4, 0xF35B, - 0x8FBF, 0xCBA6, 0x8FC2, 0xA8B1, 0x8FC4, 0xA8B4, 0x8FC5, 0xA8B3, - 0x8FC6, 0xA8B2, 0x8FC9, 0xCBA5, 0x8FCB, 0xCDCD, 0x8FCD, 0xCDCF, - 0x8FCE, 0xAAEF, 0x8FD1, 0xAAF1, 0x8FD2, 0xCDCC, 0x8FD3, 0xCDCE, - 0x8FD4, 0xAAF0, 0x8FD5, 0xCDD1, 0x8FD6, 0xCDD0, 0x8FD7, 0xCDD2, - 0x8FE0, 0xD0B6, 0x8FE1, 0xD0B4, 0x8FE2, 0xAD7C, 0x8FE3, 0xD0B3, - 0x8FE4, 0xADA3, 0x8FE5, 0xAD7E, 0x8FE6, 0xAD7B, 0x8FE8, 0xADA4, - 0x8FEA, 0xAD7D, 0x8FEB, 0xADA2, 0x8FED, 0xADA1, 0x8FEE, 0xD0B5, - 0x8FF0, 0xAD7A, 0x8FF4, 0xB06A, 0x8FF5, 0xD3EB, 0x8FF6, 0xD3F1, - 0x8FF7, 0xB067, 0x8FF8, 0xB06E, 0x8FFA, 0xB069, 0x8FFB, 0xD3EE, - 0x8FFC, 0xD3F0, 0x8FFD, 0xB06C, 0x8FFE, 0xD3EA, 0x8FFF, 0xD3ED, - 0x9000, 0xB068, 0x9001, 0xB065, 0x9002, 0xD3EC, 0x9003, 0xB06B, - 0x9004, 0xD3EF, 0x9005, 0xB06D, 0x9006, 0xB066, 0x900B, 0xD7E3, - 0x900C, 0xD7E6, 0x900D, 0xB370, 0x900F, 0xB37A, 0x9010, 0xB376, - 0x9011, 0xD7E4, 0x9014, 0xB37E, 0x9015, 0xB377, 0x9016, 0xB37C, - 0x9017, 0xB372, 0x9019, 0xB36F, 0x901A, 0xB371, 0x901B, 0xB37D, - 0x901C, 0xD7E5, 0x901D, 0xB375, 0x901E, 0xB378, 0x901F, 0xB374, - 0x9020, 0xB379, 0x9021, 0xD7E7, 0x9022, 0xB37B, 0x9023, 0xB373, - 0x9024, 0xD7E2, 0x902D, 0xDC4D, 0x902E, 0xB665, 0x902F, 0xDC4F, - 0x9031, 0xB667, 0x9032, 0xB669, 0x9034, 0xDC4E, 0x9035, 0xB666, - 0x9036, 0xB66A, 0x9038, 0xB668, 0x903C, 0xB947, 0x903D, 0xE0A3, - 0x903E, 0xB94F, 0x903F, 0xE07E, 0x9041, 0xB950, 0x9042, 0xB945, - 0x9044, 0xE0A1, 0x9047, 0xB94A, 0x9049, 0xE0A2, 0x904A, 0xB943, - 0x904B, 0xB942, 0x904D, 0xB94D, 0x904E, 0xB94C, 0x904F, 0xB94B, - 0x9050, 0xB949, 0x9051, 0xB94E, 0x9052, 0xE07D, 0x9053, 0xB944, - 0x9054, 0xB946, 0x9055, 0xB948, 0x9058, 0xBBB8, 0x9059, 0xBBBB, - 0x905B, 0xBBBF, 0x905C, 0xBBB9, 0x905D, 0xBBBE, 0x905E, 0xBBBC, - 0x9060, 0xBBB7, 0x9062, 0xBBBD, 0x9063, 0xBBBA, 0x9067, 0xE852, - 0x9068, 0xBE43, 0x9069, 0xBE41, 0x906B, 0xE853, 0x906D, 0xBE44, - 0x906E, 0xBE42, 0x906F, 0xE851, 0x9070, 0xE850, 0x9072, 0xBFF0, - 0x9073, 0xE84F, 0x9074, 0xBFEE, 0x9075, 0xBFED, 0x9076, 0xEBD0, - 0x9077, 0xBE45, 0x9078, 0xBFEF, 0x9079, 0xEBD1, 0x907A, 0xBFF2, - 0x907B, 0xEBD2, 0x907C, 0xBFF1, 0x907D, 0xC1D8, 0x907E, 0xEEC3, - 0x907F, 0xC1D7, 0x9080, 0xC1DC, 0x9081, 0xC1DA, 0x9082, 0xC1DB, - 0x9083, 0xC2E3, 0x9084, 0xC1D9, 0x9085, 0xEEC2, 0x9086, 0xEBD3, - 0x9087, 0xC2E2, 0x9088, 0xC2E4, 0x908A, 0xC3E4, 0x908B, 0xC3E5, - 0x908D, 0xF4E0, 0x908F, 0xC5DE, 0x9090, 0xC5DD, 0x9091, 0xA8B6, - 0x9094, 0xCA55, 0x9095, 0xB06F, 0x9097, 0xCA52, 0x9098, 0xCA53, - 0x9099, 0xCA51, 0x909B, 0xCA54, 0x909E, 0xCBAA, 0x909F, 0xCBA7, - 0x90A0, 0xCBAC, 0x90A1, 0xCBA8, 0x90A2, 0xA8B7, 0x90A3, 0xA8BA, - 0x90A5, 0xCBA9, 0x90A6, 0xA8B9, 0x90A7, 0xCBAB, 0x90AA, 0xA8B8, - 0x90AF, 0xCDD5, 0x90B0, 0xCDD7, 0x90B1, 0xAAF4, 0x90B2, 0xCDD3, - 0x90B3, 0xCDD6, 0x90B4, 0xCDD4, 0x90B5, 0xAAF2, 0x90B6, 0xAAF5, - 0x90B8, 0xAAF3, 0x90BD, 0xD0B8, 0x90BE, 0xD0BC, 0x90BF, 0xD0B9, - 0x90C1, 0xADA7, 0x90C3, 0xADA8, 0x90C5, 0xD0BB, 0x90C7, 0xD0BD, - 0x90C8, 0xD0BF, 0x90CA, 0xADA5, 0x90CB, 0xD0BE, 0x90CE, 0xADA6, - 0x90D4, 0xD7EE, 0x90D5, 0xD0BA, 0x90D6, 0xD3F2, 0x90D7, 0xD3FB, - 0x90D8, 0xD3F9, 0x90D9, 0xD3F4, 0x90DA, 0xD3F5, 0x90DB, 0xD3FA, - 0x90DC, 0xD3FC, 0x90DD, 0xB071, 0x90DF, 0xD3F7, 0x90E0, 0xD3F3, - 0x90E1, 0xB070, 0x90E2, 0xB072, 0x90E3, 0xD3F6, 0x90E4, 0xD3FD, - 0x90E5, 0xD3F8, 0x90E8, 0xB3A1, 0x90E9, 0xD7F1, 0x90EA, 0xD7E9, - 0x90EB, 0xD7EF, 0x90EC, 0xD7F0, 0x90ED, 0xB3A2, 0x90EF, 0xD7E8, - 0x90F0, 0xD7EA, 0x90F1, 0xD0B7, 0x90F2, 0xD7EC, 0x90F3, 0xD7ED, - 0x90F4, 0xD7EB, 0x90F5, 0xB66C, 0x90F9, 0xDC56, 0x90FA, 0xEBD4, - 0x90FB, 0xDC57, 0x90FC, 0xDC54, 0x90FD, 0xB3A3, 0x90FE, 0xB66E, - 0x90FF, 0xDC53, 0x9100, 0xDC59, 0x9101, 0xDC58, 0x9102, 0xB66B, - 0x9103, 0xDC5C, 0x9104, 0xDC52, 0x9105, 0xDC5B, 0x9106, 0xDC50, - 0x9107, 0xDC5A, 0x9108, 0xDC55, 0x9109, 0xB66D, 0x910B, 0xE0AA, - 0x910D, 0xE0A5, 0x910E, 0xE0AB, 0x910F, 0xE0A6, 0x9110, 0xE0A4, - 0x9111, 0xE0A7, 0x9112, 0xB951, 0x9114, 0xE0A9, 0x9116, 0xE0A8, - 0x9117, 0xB952, 0x9118, 0xBBC1, 0x9119, 0xBBC0, 0x911A, 0xE46E, - 0x911B, 0xE471, 0x911C, 0xE469, 0x911D, 0xE46D, 0x911E, 0xBBC2, - 0x911F, 0xE46C, 0x9120, 0xE46A, 0x9121, 0xE470, 0x9122, 0xE46B, - 0x9123, 0xE468, 0x9124, 0xE46F, 0x9126, 0xE859, 0x9127, 0xBE48, - 0x9128, 0xF14A, 0x9129, 0xE856, 0x912A, 0xE857, 0x912B, 0xE855, - 0x912C, 0xDC51, 0x912D, 0xBE47, 0x912E, 0xE85A, 0x912F, 0xE854, - 0x9130, 0xBE46, 0x9131, 0xBE49, 0x9132, 0xE858, 0x9133, 0xEBD5, - 0x9134, 0xBFF3, 0x9135, 0xEBD6, 0x9136, 0xEBD7, 0x9138, 0xEEC4, - 0x9139, 0xC1DD, 0x913A, 0xF14B, 0x913B, 0xF14C, 0x913E, 0xF14D, - 0x913F, 0xF35D, 0x9140, 0xF35C, 0x9141, 0xF4E2, 0x9143, 0xF4E1, - 0x9144, 0xF65B, 0x9145, 0xF65C, 0x9146, 0xF65A, 0x9147, 0xF766, - 0x9148, 0xC5B0, 0x9149, 0xA8BB, 0x914A, 0xADAA, 0x914B, 0xADA9, - 0x914C, 0xB075, 0x914D, 0xB074, 0x914E, 0xD440, 0x914F, 0xD441, - 0x9150, 0xD3FE, 0x9152, 0xB073, 0x9153, 0xD7F5, 0x9155, 0xD7F6, - 0x9156, 0xD7F2, 0x9157, 0xB3A4, 0x9158, 0xD7F3, 0x915A, 0xD7F4, - 0x915F, 0xDC5F, 0x9160, 0xDC61, 0x9161, 0xDC5D, 0x9162, 0xDC60, - 0x9163, 0xB66F, 0x9164, 0xDC5E, 0x9165, 0xB670, 0x9168, 0xDD73, - 0x9169, 0xB955, 0x916A, 0xB954, 0x916C, 0xB953, 0x916E, 0xE0AC, - 0x916F, 0xE0AD, 0x9172, 0xE473, 0x9173, 0xE475, 0x9174, 0xBBC6, - 0x9175, 0xBBC3, 0x9177, 0xBBC5, 0x9178, 0xBBC4, 0x9179, 0xE474, - 0x917A, 0xE472, 0x9180, 0xE861, 0x9181, 0xE85E, 0x9182, 0xE85F, - 0x9183, 0xBE4D, 0x9184, 0xE860, 0x9185, 0xE85B, 0x9186, 0xE85C, - 0x9187, 0xBE4A, 0x9189, 0xBE4B, 0x918A, 0xE85D, 0x918B, 0xBE4C, - 0x918D, 0xEBDB, 0x918F, 0xEBDC, 0x9190, 0xEBD9, 0x9191, 0xEBDA, - 0x9192, 0xBFF4, 0x9193, 0xEBD8, 0x9199, 0xEEC8, 0x919A, 0xEEC5, - 0x919B, 0xEEC7, 0x919C, 0xC1E0, 0x919D, 0xEECB, 0x919E, 0xC1DF, - 0x919F, 0xEEC9, 0x91A0, 0xEECC, 0x91A1, 0xEECA, 0x91A2, 0xEEC6, - 0x91A3, 0xC1DE, 0x91A5, 0xF14F, 0x91A7, 0xF150, 0x91A8, 0xF14E, - 0x91AA, 0xF152, 0x91AB, 0xC2E5, 0x91AC, 0xC2E6, 0x91AD, 0xF35F, - 0x91AE, 0xC3E7, 0x91AF, 0xF151, 0x91B0, 0xF35E, 0x91B1, 0xC3E6, - 0x91B2, 0xF4E5, 0x91B3, 0xF4E6, 0x91B4, 0xC4BF, 0x91B5, 0xF4E4, - 0x91B7, 0xF4E3, 0x91B9, 0xF65D, 0x91BA, 0xC548, 0x91BC, 0xF849, - 0x91BD, 0xF8C8, 0x91BE, 0xF8C7, 0x91C0, 0xC643, 0x91C1, 0xC65D, - 0x91C2, 0xF8C9, 0x91C3, 0xF971, 0x91C5, 0xC66F, 0x91C6, 0xA8BC, - 0x91C7, 0xAAF6, 0x91C9, 0xB956, 0x91CB, 0xC4C0, 0x91CC, 0xA8BD, - 0x91CD, 0xADAB, 0x91CE, 0xB3A5, 0x91CF, 0xB671, 0x91D0, 0xC2E7, - 0x91D1, 0xAAF7, 0x91D3, 0xD0C1, 0x91D4, 0xD0C0, 0x91D5, 0xD442, - 0x91D7, 0xB078, 0x91D8, 0xB076, 0x91D9, 0xB07A, 0x91DA, 0xD444, - 0x91DC, 0xB079, 0x91DD, 0xB077, 0x91E2, 0xD443, 0x91E3, 0xB3A8, - 0x91E4, 0xD7FC, 0x91E6, 0xB3A7, 0x91E7, 0xB3A9, 0x91E8, 0xD842, - 0x91E9, 0xB3AB, 0x91EA, 0xD7FE, 0x91EB, 0xD840, 0x91EC, 0xD7F7, - 0x91ED, 0xB3AA, 0x91EE, 0xD843, 0x91F1, 0xD7F9, 0x91F3, 0xD7FA, - 0x91F4, 0xD7F8, 0x91F5, 0xB3A6, 0x91F7, 0xD841, 0x91F8, 0xD7FB, - 0x91F9, 0xD7FD, 0x91FD, 0xDC6D, 0x91FF, 0xDC6C, 0x9200, 0xDC6A, - 0x9201, 0xDC62, 0x9202, 0xDC71, 0x9203, 0xDC65, 0x9204, 0xDC6F, - 0x9205, 0xDC76, 0x9206, 0xDC6E, 0x9207, 0xB679, 0x9209, 0xB675, - 0x920A, 0xDC63, 0x920C, 0xDC69, 0x920D, 0xB677, 0x920F, 0xDC68, - 0x9210, 0xB678, 0x9211, 0xB67A, 0x9212, 0xDC6B, 0x9214, 0xB672, - 0x9215, 0xB673, 0x9216, 0xDC77, 0x9217, 0xDC75, 0x9219, 0xDC74, - 0x921A, 0xDC66, 0x921C, 0xDC72, 0x921E, 0xB676, 0x9223, 0xB674, - 0x9224, 0xDC73, 0x9225, 0xDC64, 0x9226, 0xDC67, 0x9227, 0xDC70, - 0x922D, 0xE4BA, 0x922E, 0xE0B7, 0x9230, 0xE0B0, 0x9231, 0xE0C3, - 0x9232, 0xE0CC, 0x9233, 0xE0B3, 0x9234, 0xB961, 0x9236, 0xE0C0, - 0x9237, 0xB957, 0x9238, 0xB959, 0x9239, 0xB965, 0x923A, 0xE0B1, - 0x923D, 0xB95A, 0x923E, 0xB95C, 0x923F, 0xB966, 0x9240, 0xB95B, - 0x9245, 0xB964, 0x9246, 0xE0B9, 0x9248, 0xE0AE, 0x9249, 0xB962, - 0x924A, 0xE0B8, 0x924B, 0xB95E, 0x924C, 0xE0CA, 0x924D, 0xB963, - 0x924E, 0xE0C8, 0x924F, 0xE0BC, 0x9250, 0xE0C6, 0x9251, 0xB960, - 0x9252, 0xE0AF, 0x9253, 0xE0C9, 0x9254, 0xE0C4, 0x9256, 0xE0CB, - 0x9257, 0xB958, 0x925A, 0xB967, 0x925B, 0xB95D, 0x925E, 0xE0B5, - 0x9260, 0xE0BD, 0x9261, 0xE0C1, 0x9263, 0xE0C5, 0x9264, 0xB95F, - 0x9265, 0xE0B4, 0x9266, 0xE0B2, 0x9267, 0xE0BE, 0x926C, 0xE0BB, - 0x926D, 0xE0BA, 0x926F, 0xE0BF, 0x9270, 0xE0C2, 0x9272, 0xE0C7, - 0x9276, 0xE478, 0x9278, 0xBBC7, 0x9279, 0xE4A4, 0x927A, 0xE47A, - 0x927B, 0xBBCC, 0x927C, 0xBBD0, 0x927D, 0xE4AD, 0x927E, 0xE4B5, - 0x927F, 0xE4A6, 0x9280, 0xBBC8, 0x9282, 0xE4AA, 0x9283, 0xE0B6, - 0x9285, 0xBBC9, 0x9286, 0xE4B1, 0x9287, 0xE4B6, 0x9288, 0xE4AE, - 0x928A, 0xE4B0, 0x928B, 0xE4B9, 0x928C, 0xE4B2, 0x928D, 0xE47E, - 0x928E, 0xE4A9, 0x9291, 0xBBD1, 0x9293, 0xBBCD, 0x9294, 0xE47C, - 0x9295, 0xE4AB, 0x9296, 0xBBCB, 0x9297, 0xE4A5, 0x9298, 0xBBCA, - 0x9299, 0xE4B3, 0x929A, 0xE4A2, 0x929B, 0xE479, 0x929C, 0xBBCE, - 0x929D, 0xE4B8, 0x92A0, 0xE47B, 0x92A1, 0xE4AF, 0x92A2, 0xE4AC, - 0x92A3, 0xE4A7, 0x92A4, 0xE477, 0x92A5, 0xE476, 0x92A6, 0xE4A1, - 0x92A7, 0xE4B4, 0x92A8, 0xBBCF, 0x92A9, 0xE4B7, 0x92AA, 0xE47D, - 0x92AB, 0xE4A3, 0x92AC, 0xBE52, 0x92B2, 0xBE5A, 0x92B3, 0xBE55, - 0x92B4, 0xE8A4, 0x92B5, 0xE8A1, 0x92B6, 0xE867, 0x92B7, 0xBE50, - 0x92B9, 0xF9D7, 0x92BB, 0xBE4F, 0x92BC, 0xBE56, 0x92C0, 0xE865, - 0x92C1, 0xBE54, 0x92C2, 0xE871, 0x92C3, 0xE863, 0x92C4, 0xE864, - 0x92C5, 0xBE4E, 0x92C6, 0xE8A3, 0x92C7, 0xBE58, 0x92C8, 0xE874, - 0x92C9, 0xE879, 0x92CA, 0xE873, 0x92CB, 0xEBEE, 0x92CC, 0xE86F, - 0x92CD, 0xE877, 0x92CE, 0xE875, 0x92CF, 0xE868, 0x92D0, 0xE862, - 0x92D1, 0xE87D, 0x92D2, 0xBE57, 0x92D3, 0xE87E, 0x92D5, 0xE878, - 0x92D7, 0xE86D, 0x92D8, 0xE86B, 0x92D9, 0xE866, 0x92DD, 0xE86E, - 0x92DE, 0xE87B, 0x92DF, 0xE86A, 0x92E0, 0xE87A, 0x92E1, 0xE8A2, - 0x92E4, 0xBE53, 0x92E6, 0xE876, 0x92E7, 0xE87C, 0x92E8, 0xE872, - 0x92E9, 0xE86C, 0x92EA, 0xBE51, 0x92EE, 0xE4A8, 0x92EF, 0xE870, - 0x92F0, 0xBE59, 0x92F1, 0xE869, 0x92F7, 0xEBF4, 0x92F8, 0xBFF7, - 0x92F9, 0xEBF3, 0x92FA, 0xEBF0, 0x92FB, 0xEC44, 0x92FC, 0xBFFB, - 0x92FE, 0xEC41, 0x92FF, 0xEBF8, 0x9300, 0xEC43, 0x9301, 0xEBE9, - 0x9302, 0xEBF6, 0x9304, 0xBFFD, 0x9306, 0xEBE1, 0x9308, 0xEBDF, - 0x9309, 0xEC42, 0x930B, 0xEC40, 0x930C, 0xEBFE, 0x930D, 0xEBED, - 0x930E, 0xEBEC, 0x930F, 0xEBE2, 0x9310, 0xC040, 0x9312, 0xEBE8, - 0x9313, 0xEBF2, 0x9314, 0xEBFD, 0x9315, 0xC043, 0x9316, 0xEC45, - 0x9318, 0xC1E8, 0x9319, 0xC045, 0x931A, 0xBFFE, 0x931B, 0xEBE6, - 0x931D, 0xEBEF, 0x931E, 0xEBDE, 0x931F, 0xEBE0, 0x9320, 0xBFF5, - 0x9321, 0xC042, 0x9322, 0xBFFA, 0x9323, 0xEBE7, 0x9324, 0xEBF7, - 0x9325, 0xEBF1, 0x9326, 0xC041, 0x9327, 0xEBDD, 0x9328, 0xC1E3, - 0x9329, 0xEBF9, 0x932A, 0xEBFC, 0x932B, 0xBFFC, 0x932D, 0xEBEB, - 0x932E, 0xC044, 0x932F, 0xBFF9, 0x9333, 0xBFF8, 0x9334, 0xEBF5, - 0x9335, 0xEBFB, 0x9336, 0xBFF6, 0x9338, 0xEBE4, 0x9339, 0xEBFA, - 0x933C, 0xEBE5, 0x9346, 0xEBEA, 0x9347, 0xEED2, 0x9349, 0xEED7, - 0x934A, 0xC1E5, 0x934B, 0xC1E7, 0x934C, 0xEEDD, 0x934D, 0xC1E1, - 0x934E, 0xEEEC, 0x934F, 0xEEE3, 0x9350, 0xEED8, 0x9351, 0xEED9, - 0x9352, 0xEEE2, 0x9354, 0xC1EE, 0x9355, 0xEEE1, 0x9356, 0xEED1, - 0x9357, 0xEEE0, 0x9358, 0xEED4, 0x9359, 0xEEED, 0x935A, 0xC1ED, - 0x935B, 0xC1EB, 0x935C, 0xEED5, 0x935E, 0xEEE8, 0x9360, 0xEEDA, - 0x9361, 0xEEE7, 0x9363, 0xEEE9, 0x9364, 0xEED0, 0x9365, 0xC1E6, - 0x9367, 0xEEEA, 0x936A, 0xEEDE, 0x936C, 0xC1EA, 0x936D, 0xEEDB, - 0x9370, 0xC1EC, 0x9371, 0xEEE4, 0x9375, 0xC1E4, 0x9376, 0xEED6, - 0x9377, 0xEEE5, 0x9379, 0xEEDF, 0x937A, 0xEBE3, 0x937B, 0xEEE6, - 0x937C, 0xEED3, 0x937E, 0xC1E9, 0x9380, 0xEEEB, 0x9382, 0xC1E2, - 0x9383, 0xEECE, 0x9388, 0xF160, 0x9389, 0xF159, 0x938A, 0xC2E9, - 0x938C, 0xF154, 0x938D, 0xF163, 0x938E, 0xF15B, 0x938F, 0xEEDC, - 0x9391, 0xF165, 0x9392, 0xF155, 0x9394, 0xC2E8, 0x9395, 0xF15F, - 0x9396, 0xC2EA, 0x9397, 0xC2F2, 0x9398, 0xC2F0, 0x9399, 0xF161, - 0x939A, 0xC2F1, 0x939B, 0xF157, 0x939D, 0xF158, 0x939E, 0xF15D, - 0x939F, 0xF162, 0x93A1, 0xEECD, 0x93A2, 0xC2EB, 0x93A3, 0xF16A, - 0x93A4, 0xF167, 0x93A5, 0xF16B, 0x93A6, 0xF15E, 0x93A7, 0xF15A, - 0x93A8, 0xF168, 0x93A9, 0xF36A, 0x93AA, 0xF15C, 0x93AC, 0xC2EE, - 0x93AE, 0xC2ED, 0x93AF, 0xEECF, 0x93B0, 0xC2EF, 0x93B1, 0xF164, - 0x93B2, 0xF166, 0x93B3, 0xC2EC, 0x93B4, 0xF169, 0x93B5, 0xF153, - 0x93B7, 0xF156, 0x93C0, 0xF373, 0x93C2, 0xF363, 0x93C3, 0xC3EB, - 0x93C4, 0xF371, 0x93C7, 0xF361, 0x93C8, 0xC3EC, 0x93CA, 0xF36C, - 0x93CC, 0xF368, 0x93CD, 0xC3F1, 0x93CE, 0xF372, 0x93CF, 0xF362, - 0x93D0, 0xF365, 0x93D1, 0xC3E9, 0x93D2, 0xF374, 0x93D4, 0xF36D, - 0x93D5, 0xF370, 0x93D6, 0xC3EF, 0x93D7, 0xC3F4, 0x93D8, 0xC3F2, - 0x93D9, 0xF369, 0x93DA, 0xF364, 0x93DC, 0xC3ED, 0x93DD, 0xC3EE, - 0x93DE, 0xF360, 0x93DF, 0xC3EA, 0x93E1, 0xC3E8, 0x93E2, 0xC3F0, - 0x93E3, 0xF36F, 0x93E4, 0xC3F3, 0x93E6, 0xF36B, 0x93E7, 0xF375, - 0x93E8, 0xC3F5, 0x93EC, 0xF367, 0x93EE, 0xF36E, 0x93F5, 0xF4F3, - 0x93F6, 0xF542, 0x93F7, 0xF4F5, 0x93F8, 0xF4FC, 0x93F9, 0xF366, - 0x93FA, 0xF4FA, 0x93FB, 0xF4E9, 0x93FC, 0xF540, 0x93FD, 0xC4C3, - 0x93FE, 0xF4ED, 0x93FF, 0xF4FE, 0x9400, 0xF4F4, 0x9403, 0xC4C2, - 0x9406, 0xF544, 0x9407, 0xF4F6, 0x9409, 0xF4FB, 0x940A, 0xF4FD, - 0x940B, 0xF4E7, 0x940C, 0xF541, 0x940D, 0xF4F2, 0x940E, 0xF4F7, - 0x940F, 0xF4EB, 0x9410, 0xF4EF, 0x9411, 0xF543, 0x9412, 0xF4F9, - 0x9413, 0xF4E8, 0x9414, 0xF4EC, 0x9415, 0xF4EE, 0x9416, 0xF4F8, - 0x9418, 0xC4C1, 0x9419, 0xF4F1, 0x9420, 0xF4EA, 0x9428, 0xF4F0, - 0x9429, 0xF661, 0x942A, 0xF666, 0x942B, 0xC54F, 0x942C, 0xF668, - 0x942E, 0xC549, 0x9430, 0xF664, 0x9431, 0xF66A, 0x9432, 0xC54E, - 0x9433, 0xC54A, 0x9435, 0xC54B, 0x9436, 0xF660, 0x9437, 0xF667, - 0x9438, 0xC54D, 0x9439, 0xF665, 0x943A, 0xC54C, 0x943B, 0xF65F, - 0x943C, 0xF663, 0x943D, 0xF662, 0x943F, 0xF65E, 0x9440, 0xF669, - 0x9444, 0xC5B1, 0x9445, 0xF76D, 0x9446, 0xF770, 0x9447, 0xF76C, - 0x9448, 0xF76E, 0x9449, 0xF76F, 0x944A, 0xF769, 0x944B, 0xF76A, - 0x944C, 0xF767, 0x944F, 0xF76B, 0x9450, 0xF768, 0x9451, 0xC5B2, - 0x9452, 0xC5B3, 0x9455, 0xF84B, 0x9457, 0xF84D, 0x945D, 0xF84C, - 0x945E, 0xF84E, 0x9460, 0xC5E0, 0x9462, 0xF84A, 0x9463, 0xC5DF, - 0x9464, 0xC5E1, 0x9468, 0xF8CB, 0x9469, 0xF8CC, 0x946A, 0xC644, - 0x946B, 0xF8CA, 0x946D, 0xF953, 0x946E, 0xF952, 0x946F, 0xF954, - 0x9470, 0xC65F, 0x9471, 0xF955, 0x9472, 0xC65E, 0x9473, 0xF956, - 0x9474, 0xF972, 0x9475, 0xF975, 0x9476, 0xF974, 0x9477, 0xC668, - 0x9478, 0xF973, 0x947C, 0xC672, 0x947D, 0xC670, 0x947E, 0xC671, - 0x947F, 0xC677, 0x9480, 0xF9C0, 0x9481, 0xF9C1, 0x9482, 0xF9BF, - 0x9483, 0xF9C9, 0x9577, 0xAAF8, 0x957A, 0xD844, 0x957B, 0xDC78, - 0x957C, 0xE8A5, 0x957D, 0xF376, 0x9580, 0xAAF9, 0x9582, 0xADAC, - 0x9583, 0xB07B, 0x9586, 0xD845, 0x9588, 0xD846, 0x9589, 0xB3AC, - 0x958B, 0xB67D, 0x958C, 0xDC7A, 0x958D, 0xDC79, 0x958E, 0xB6A3, - 0x958F, 0xB67C, 0x9590, 0xDC7B, 0x9591, 0xB67E, 0x9592, 0xB6A2, - 0x9593, 0xB6A1, 0x9594, 0xB67B, 0x9598, 0xB968, 0x959B, 0xE0D0, - 0x959C, 0xE0CE, 0x959E, 0xE0CF, 0x959F, 0xE0CD, 0x95A1, 0xBBD2, - 0x95A3, 0xBBD5, 0x95A4, 0xBBD7, 0x95A5, 0xBBD6, 0x95A8, 0xBBD3, - 0x95A9, 0xBBD4, 0x95AB, 0xE8A7, 0x95AC, 0xE8A6, 0x95AD, 0xBE5B, - 0x95AE, 0xE8A8, 0x95B0, 0xE8A9, 0x95B1, 0xBE5C, 0x95B5, 0xEC4D, - 0x95B6, 0xEC4B, 0x95B7, 0xEEF3, 0x95B9, 0xEC49, 0x95BA, 0xEC4A, - 0x95BB, 0xC046, 0x95BC, 0xEC46, 0x95BD, 0xEC4E, 0x95BE, 0xEC48, - 0x95BF, 0xEC4C, 0x95C0, 0xEEEF, 0x95C3, 0xEEF1, 0x95C5, 0xEEF2, - 0x95C6, 0xC1F3, 0x95C7, 0xEEEE, 0x95C8, 0xC1F2, 0x95C9, 0xEEF0, - 0x95CA, 0xC1EF, 0x95CB, 0xC1F0, 0x95CC, 0xC1F1, 0x95CD, 0xEC47, - 0x95D0, 0xC2F5, 0x95D1, 0xF16E, 0x95D2, 0xF16C, 0x95D3, 0xF16D, - 0x95D4, 0xC2F3, 0x95D5, 0xC2F6, 0x95D6, 0xC2F4, 0x95DA, 0xF377, - 0x95DB, 0xF378, 0x95DC, 0xC3F6, 0x95DE, 0xF545, 0x95DF, 0xF547, - 0x95E0, 0xF546, 0x95E1, 0xC4C4, 0x95E2, 0xC550, 0x95E3, 0xF66D, - 0x95E4, 0xF66C, 0x95E5, 0xF66B, 0x961C, 0xAAFA, 0x961E, 0xC9AA, - 0x9620, 0xCA58, 0x9621, 0xA6E9, 0x9622, 0xCA56, 0x9623, 0xCA59, - 0x9624, 0xCA57, 0x9628, 0xCBAE, 0x962A, 0xA8C1, 0x962C, 0xA8C2, - 0x962D, 0xCBB0, 0x962E, 0xA8BF, 0x962F, 0xCBAF, 0x9630, 0xCBAD, - 0x9631, 0xA8C0, 0x9632, 0xA8BE, 0x9639, 0xCDD8, 0x963A, 0xCDDB, - 0x963B, 0xAAFD, 0x963C, 0xCDDA, 0x963D, 0xCDD9, 0x963F, 0xAAFC, - 0x9640, 0xAAFB, 0x9642, 0xAB40, 0x9643, 0xCDDC, 0x9644, 0xAAFE, - 0x964A, 0xD0C6, 0x964B, 0xADAE, 0x964C, 0xADAF, 0x964D, 0xADB0, - 0x964E, 0xD0C7, 0x964F, 0xD0C3, 0x9650, 0xADAD, 0x9651, 0xD0C4, - 0x9653, 0xD0C5, 0x9654, 0xD0C2, 0x9658, 0xB0A4, 0x965B, 0xB0A1, - 0x965C, 0xD445, 0x965D, 0xB0A2, 0x965E, 0xB0A5, 0x965F, 0xD446, - 0x9661, 0xB07E, 0x9662, 0xB07C, 0x9663, 0xB07D, 0x9664, 0xB0A3, - 0x966A, 0xB3AD, 0x966B, 0xD849, 0x966C, 0xB3B5, 0x966D, 0xD848, - 0x966F, 0xD84B, 0x9670, 0xB3B1, 0x9671, 0xD84A, 0x9672, 0xB6AB, - 0x9673, 0xB3AF, 0x9674, 0xB3B2, 0x9675, 0xB3AE, 0x9676, 0xB3B3, - 0x9677, 0xB3B4, 0x9678, 0xB3B0, 0x967C, 0xD847, 0x967D, 0xB6A7, - 0x967E, 0xDC7D, 0x9680, 0xDCA3, 0x9683, 0xDCA2, 0x9684, 0xB6AC, - 0x9685, 0xB6A8, 0x9686, 0xB6A9, 0x9687, 0xDC7C, 0x9688, 0xDC7E, - 0x9689, 0xDCA1, 0x968A, 0xB6A4, 0x968B, 0xB6A6, 0x968D, 0xB6AA, - 0x968E, 0xB6A5, 0x9691, 0xE0D3, 0x9692, 0xE0D1, 0x9693, 0xE0D2, - 0x9694, 0xB96A, 0x9695, 0xB96B, 0x9697, 0xE0D4, 0x9698, 0xB969, - 0x9699, 0xBBD8, 0x969B, 0xBBDA, 0x969C, 0xBBD9, 0x969E, 0xE4BB, - 0x96A1, 0xE4BC, 0x96A2, 0xE8AB, 0x96A4, 0xE8AA, 0x96A7, 0xC047, - 0x96A8, 0xC048, 0x96A9, 0xEC4F, 0x96AA, 0xC049, 0x96AC, 0xEEF6, - 0x96AE, 0xEEF4, 0x96B0, 0xEEF5, 0x96B1, 0xC1F4, 0x96B3, 0xF16F, - 0x96B4, 0xC3F7, 0x96B8, 0xC1F5, 0x96B9, 0xAB41, 0x96BB, 0xB0A6, - 0x96BC, 0xD447, 0x96BF, 0xD84C, 0x96C0, 0xB3B6, 0x96C1, 0xB6AD, - 0x96C2, 0xDCA4, 0x96C3, 0xDCA6, 0x96C4, 0xB6AF, 0x96C5, 0xB6AE, - 0x96C6, 0xB6B0, 0x96C7, 0xB6B1, 0x96C8, 0xDCA5, 0x96C9, 0xB96E, - 0x96CA, 0xB96F, 0x96CB, 0xB96D, 0x96CC, 0xBBDB, 0x96CD, 0xB96C, - 0x96CE, 0xE0D5, 0x96D2, 0xBBDC, 0x96D3, 0xE8AC, 0x96D4, 0xEC50, - 0x96D5, 0xC04A, 0x96D6, 0xC1F6, 0x96D7, 0xF170, 0x96D8, 0xF174, - 0x96D9, 0xC2F9, 0x96DA, 0xF171, 0x96DB, 0xC2FA, 0x96DC, 0xC2F8, - 0x96DD, 0xF175, 0x96DE, 0xC2FB, 0x96DF, 0xF173, 0x96E1, 0xF379, - 0x96E2, 0xC2F7, 0x96E3, 0xC3F8, 0x96E5, 0xF8CD, 0x96E8, 0xAB42, - 0x96E9, 0xB3B8, 0x96EA, 0xB3B7, 0x96EF, 0xB6B2, 0x96F0, 0xDCA8, - 0x96F1, 0xDCA7, 0x96F2, 0xB6B3, 0x96F5, 0xE0D9, 0x96F6, 0xB973, - 0x96F7, 0xB970, 0x96F8, 0xE0D8, 0x96F9, 0xB972, 0x96FA, 0xE0D6, - 0x96FB, 0xB971, 0x96FD, 0xE0D7, 0x96FF, 0xE4BD, 0x9700, 0xBBDD, - 0x9702, 0xE8AF, 0x9704, 0xBE5D, 0x9705, 0xE8AD, 0x9706, 0xBE5E, - 0x9707, 0xBE5F, 0x9708, 0xE8AE, 0x9709, 0xBE60, 0x970B, 0xEC51, - 0x970D, 0xC04E, 0x970E, 0xC04B, 0x970F, 0xC050, 0x9710, 0xEC53, - 0x9711, 0xC04C, 0x9712, 0xEC52, 0x9713, 0xC04F, 0x9716, 0xC04D, - 0x9718, 0xEEF9, 0x9719, 0xEEFB, 0x971C, 0xC1F7, 0x971D, 0xEEFA, - 0x971E, 0xC1F8, 0x971F, 0xEEF8, 0x9720, 0xEEF7, 0x9722, 0xF177, - 0x9723, 0xF176, 0x9724, 0xC2FC, 0x9725, 0xF178, 0x9726, 0xF37E, - 0x9727, 0xC3FA, 0x9728, 0xF37D, 0x9729, 0xF37A, 0x972A, 0xC3F9, - 0x972B, 0xF37B, 0x972C, 0xF37C, 0x972E, 0xF548, 0x972F, 0xF549, - 0x9730, 0xC4C5, 0x9732, 0xC553, 0x9735, 0xF66E, 0x9738, 0xC551, - 0x9739, 0xC552, 0x973A, 0xF66F, 0x973D, 0xC5B4, 0x973E, 0xC5B5, - 0x973F, 0xF771, 0x9742, 0xC645, 0x9743, 0xF8CF, 0x9744, 0xC647, - 0x9746, 0xF8CE, 0x9747, 0xF8D0, 0x9748, 0xC646, 0x9749, 0xF957, - 0x974B, 0xF9AD, 0x9752, 0xAB43, 0x9756, 0xB974, 0x9758, 0xE4BE, - 0x975A, 0xE8B0, 0x975B, 0xC051, 0x975C, 0xC052, 0x975E, 0xAB44, - 0x9760, 0xBE61, 0x9761, 0xC3FB, 0x9762, 0xADB1, 0x9766, 0xC053, - 0x9768, 0xC5E2, 0x9769, 0xADB2, 0x976A, 0xD84D, 0x976C, 0xDCA9, - 0x976E, 0xDCAB, 0x9770, 0xDCAA, 0x9772, 0xE0DD, 0x9773, 0xE0DA, - 0x9774, 0xB975, 0x9776, 0xB976, 0x9777, 0xE0DB, 0x9778, 0xE0DC, - 0x977A, 0xE4C0, 0x977B, 0xE4C5, 0x977C, 0xBBDE, 0x977D, 0xE4BF, - 0x977E, 0xE4C1, 0x977F, 0xE4C8, 0x9780, 0xE4C3, 0x9781, 0xE4C7, - 0x9782, 0xE4C4, 0x9783, 0xE4C2, 0x9784, 0xE4C6, 0x9785, 0xBBDF, - 0x9788, 0xE8B3, 0x978A, 0xE8B1, 0x978B, 0xBE63, 0x978D, 0xBE62, - 0x978E, 0xE8B2, 0x978F, 0xBE64, 0x9794, 0xEC56, 0x9797, 0xEC55, - 0x9798, 0xC054, 0x9799, 0xEC54, 0x979A, 0xEEFC, 0x979C, 0xEEFE, - 0x979D, 0xEF41, 0x979E, 0xEF40, 0x97A0, 0xC1F9, 0x97A1, 0xEEFD, - 0x97A2, 0xF1A1, 0x97A3, 0xC2FD, 0x97A4, 0xF17D, 0x97A5, 0xF1A2, - 0x97A6, 0xC2FE, 0x97A8, 0xF17B, 0x97AA, 0xF17E, 0x97AB, 0xF17C, - 0x97AC, 0xF179, 0x97AD, 0xC340, 0x97AE, 0xF17A, 0x97B3, 0xF3A1, - 0x97B6, 0xF3A3, 0x97B7, 0xF3A2, 0x97B9, 0xF54A, 0x97BB, 0xF54B, - 0x97BF, 0xF670, 0x97C1, 0xC5B7, 0x97C3, 0xC5B6, 0x97C4, 0xF84F, - 0x97C5, 0xF850, 0x97C6, 0xC648, 0x97C7, 0xF8D1, 0x97C9, 0xC669, - 0x97CB, 0xADB3, 0x97CC, 0xB6B4, 0x97CD, 0xE4CA, 0x97CE, 0xE4C9, - 0x97CF, 0xE8B5, 0x97D0, 0xE8B4, 0x97D3, 0xC1FA, 0x97D4, 0xEF43, - 0x97D5, 0xEF42, 0x97D6, 0xF1A5, 0x97D7, 0xF1A3, 0x97D8, 0xF1A6, - 0x97D9, 0xF1A4, 0x97DC, 0xC3FC, 0x97DD, 0xF3A4, 0x97DE, 0xF3A5, - 0x97DF, 0xF3A6, 0x97E1, 0xF671, 0x97E3, 0xF772, 0x97E5, 0xF8D2, - 0x97ED, 0xADB4, 0x97F0, 0xEC57, 0x97F1, 0xEF44, 0x97F3, 0xADB5, - 0x97F6, 0xBBE0, 0x97F8, 0xEC58, 0x97F9, 0xC341, 0x97FA, 0xF1A7, - 0x97FB, 0xC3FD, 0x97FD, 0xF54C, 0x97FE, 0xF54D, 0x97FF, 0xC554, - 0x9800, 0xF851, 0x9801, 0xADB6, 0x9802, 0xB3BB, 0x9803, 0xB3BC, - 0x9804, 0xD84E, 0x9805, 0xB6B5, 0x9806, 0xB6B6, 0x9807, 0xDCAC, - 0x9808, 0xB6B7, 0x980A, 0xB97A, 0x980C, 0xB97C, 0x980D, 0xE0DF, - 0x980E, 0xE0E0, 0x980F, 0xE0DE, 0x9810, 0xB977, 0x9811, 0xB978, - 0x9812, 0xB97B, 0x9813, 0xB979, 0x9816, 0xE4CB, 0x9817, 0xBBE1, - 0x9818, 0xBBE2, 0x981B, 0xE8BC, 0x981C, 0xBE67, 0x981D, 0xE8B7, - 0x981E, 0xE8B6, 0x9820, 0xE8BB, 0x9821, 0xBE65, 0x9824, 0xC05B, - 0x9826, 0xE8B8, 0x9827, 0xE8BD, 0x9828, 0xE8BA, 0x9829, 0xE8B9, - 0x982B, 0xBE66, 0x982D, 0xC059, 0x982F, 0xEC5A, 0x9830, 0xC055, - 0x9832, 0xEC5B, 0x9835, 0xEC59, 0x9837, 0xC058, 0x9838, 0xC056, - 0x9839, 0xC05A, 0x983B, 0xC057, 0x9841, 0xEF45, 0x9843, 0xEF4A, - 0x9844, 0xEF46, 0x9845, 0xEF49, 0x9846, 0xC1FB, 0x9848, 0xEDD4, - 0x9849, 0xEF48, 0x984A, 0xEF47, 0x984C, 0xC344, 0x984D, 0xC342, - 0x984E, 0xC345, 0x984F, 0xC343, 0x9850, 0xF1A8, 0x9851, 0xF1A9, - 0x9852, 0xF1AA, 0x9853, 0xC346, 0x9857, 0xF3AA, 0x9858, 0xC440, - 0x9859, 0xF3A8, 0x985B, 0xC441, 0x985C, 0xF3A7, 0x985D, 0xF3A9, - 0x985E, 0xC3FE, 0x985F, 0xF551, 0x9860, 0xF54E, 0x9862, 0xF54F, - 0x9863, 0xF550, 0x9864, 0xF672, 0x9865, 0xC556, 0x9867, 0xC555, - 0x9869, 0xF774, 0x986A, 0xF773, 0x986B, 0xC5B8, 0x986F, 0xC5E3, - 0x9870, 0xC649, 0x9871, 0xC660, 0x9872, 0xF958, 0x9873, 0xF9AE, - 0x9874, 0xF9AF, 0x98A8, 0xADB7, 0x98A9, 0xDCAD, 0x98AC, 0xE0E1, - 0x98AD, 0xE4CC, 0x98AE, 0xE4CD, 0x98AF, 0xBBE3, 0x98B1, 0xBBE4, - 0x98B2, 0xE8BE, 0x98B3, 0xBE68, 0x98B6, 0xC1FC, 0x98B8, 0xF1AB, - 0x98BA, 0xC347, 0x98BB, 0xF3AD, 0x98BC, 0xC442, 0x98BD, 0xF3AC, - 0x98BE, 0xF3AE, 0x98BF, 0xF3AB, 0x98C0, 0xF675, 0x98C1, 0xF552, - 0x98C2, 0xF553, 0x98C4, 0xC4C6, 0x98C6, 0xF674, 0x98C9, 0xF673, - 0x98CB, 0xF775, 0x98CC, 0xF9B0, 0x98DB, 0xADB8, 0x98DF, 0xADB9, - 0x98E2, 0xB0A7, 0x98E3, 0xD448, 0x98E5, 0xD84F, 0x98E7, 0xB6B8, - 0x98E9, 0xB6BB, 0x98EA, 0xB6B9, 0x98EB, 0xDCAE, 0x98ED, 0xB6BD, - 0x98EF, 0xB6BA, 0x98F2, 0xB6BC, 0x98F4, 0xB97E, 0x98F6, 0xE0E2, - 0x98F9, 0xE0E3, 0x98FA, 0xE8C0, 0x98FC, 0xB97D, 0x98FD, 0xB9A1, - 0x98FE, 0xB9A2, 0x9900, 0xE4CF, 0x9902, 0xE4CE, 0x9903, 0xBBE5, - 0x9905, 0xBBE6, 0x9907, 0xE4D0, 0x9908, 0xE8BF, 0x9909, 0xBBE8, - 0x990A, 0xBE69, 0x990C, 0xBBE7, 0x9910, 0xC05C, 0x9911, 0xE8C1, - 0x9912, 0xBE6B, 0x9913, 0xBE6A, 0x9914, 0xE8C2, 0x9915, 0xE8C5, - 0x9916, 0xE8C3, 0x9917, 0xE8C4, 0x9918, 0xBE6C, 0x991A, 0xC061, - 0x991B, 0xC05F, 0x991E, 0xC05E, 0x991F, 0xEC5D, 0x9921, 0xC060, - 0x9924, 0xEC5C, 0x9925, 0xEF4B, 0x9927, 0xEC5E, 0x9928, 0xC05D, - 0x9929, 0xEC5F, 0x992A, 0xEF4E, 0x992B, 0xEF4C, 0x992C, 0xEF4D, - 0x992D, 0xEF52, 0x992E, 0xC34B, 0x992F, 0xEF51, 0x9930, 0xEF54, - 0x9931, 0xEF53, 0x9932, 0xEF50, 0x9933, 0xEF4F, 0x9935, 0xC1FD, - 0x993A, 0xF1AE, 0x993C, 0xF1AD, 0x993D, 0xC34A, 0x993E, 0xC348, - 0x993F, 0xC349, 0x9941, 0xF1AC, 0x9943, 0xF3B1, 0x9945, 0xC443, - 0x9947, 0xF3B0, 0x9948, 0xF3AF, 0x9949, 0xC444, 0x994B, 0xF558, - 0x994C, 0xF557, 0x994E, 0xF555, 0x9950, 0xF554, 0x9951, 0xC4C8, - 0x9952, 0xC4C7, 0x9953, 0xF559, 0x9954, 0xF776, 0x9955, 0xC5B9, - 0x9956, 0xF677, 0x9957, 0xC557, 0x9958, 0xF676, 0x9959, 0xF556, - 0x995B, 0xF777, 0x995C, 0xC5E4, 0x995E, 0xC661, 0x995F, 0xF959, - 0x9961, 0xF9B1, 0x9996, 0xADBA, 0x9997, 0xD850, 0x9998, 0xEF55, - 0x9999, 0xADBB, 0x999C, 0xE4D2, 0x999D, 0xE4D1, 0x999E, 0xEC60, - 0x99A1, 0xEF57, 0x99A3, 0xEF56, 0x99A5, 0xC34C, 0x99A6, 0xF3B2, - 0x99A7, 0xF3B3, 0x99A8, 0xC4C9, 0x99AB, 0xF9B2, 0x99AC, 0xB0A8, - 0x99AD, 0xB6BF, 0x99AE, 0xB6BE, 0x99AF, 0xE0E4, 0x99B0, 0xE0E6, - 0x99B1, 0xB9A4, 0x99B2, 0xE0E5, 0x99B3, 0xB9A3, 0x99B4, 0xB9A5, - 0x99B5, 0xE0E7, 0x99B9, 0xE4D4, 0x99BA, 0xE4D6, 0x99BB, 0xE4D5, - 0x99BD, 0xE4D8, 0x99C1, 0xBBE9, 0x99C2, 0xE4D7, 0x99C3, 0xE4D3, - 0x99C7, 0xE4D9, 0x99C9, 0xE8CC, 0x99CB, 0xE8CF, 0x99CC, 0xE8D1, - 0x99CD, 0xE8C7, 0x99CE, 0xE8CB, 0x99CF, 0xE8C8, 0x99D0, 0xBE6E, - 0x99D1, 0xBE71, 0x99D2, 0xBE73, 0x99D3, 0xE8C9, 0x99D4, 0xE8CA, - 0x99D5, 0xBE72, 0x99D6, 0xE8CD, 0x99D7, 0xE8D0, 0x99D8, 0xE8CE, - 0x99D9, 0xBE74, 0x99DB, 0xBE70, 0x99DC, 0xE8C6, 0x99DD, 0xBE6D, - 0x99DF, 0xBE6F, 0x99E2, 0xC063, 0x99E3, 0xEC66, 0x99E4, 0xEC64, - 0x99E5, 0xEC63, 0x99E7, 0xEC69, 0x99E9, 0xEC68, 0x99EA, 0xEC67, - 0x99EC, 0xEC62, 0x99ED, 0xC062, 0x99EE, 0xEC61, 0x99F0, 0xEC65, - 0x99F1, 0xC064, 0x99F4, 0xEF5A, 0x99F6, 0xEF5E, 0x99F7, 0xEF5B, - 0x99F8, 0xEF5D, 0x99F9, 0xEF5C, 0x99FA, 0xEF59, 0x99FB, 0xEF5F, - 0x99FC, 0xEF62, 0x99FD, 0xEF60, 0x99FE, 0xEF61, 0x99FF, 0xC240, - 0x9A01, 0xC1FE, 0x9A02, 0xEF58, 0x9A03, 0xEF63, 0x9A04, 0xF1B3, - 0x9A05, 0xF1B6, 0x9A06, 0xF1B8, 0x9A07, 0xF1B7, 0x9A09, 0xF1B1, - 0x9A0A, 0xF1B5, 0x9A0B, 0xF1B0, 0x9A0D, 0xF1B2, 0x9A0E, 0xC34D, - 0x9A0F, 0xF1AF, 0x9A11, 0xF1B4, 0x9A14, 0xF3C0, 0x9A15, 0xF3B5, - 0x9A16, 0xC445, 0x9A19, 0xC446, 0x9A1A, 0xF3B4, 0x9A1B, 0xF3B9, - 0x9A1C, 0xF3BF, 0x9A1D, 0xF3B7, 0x9A1E, 0xF3BE, 0x9A20, 0xF3BB, - 0x9A22, 0xF3BA, 0x9A23, 0xF3BD, 0x9A24, 0xF3B8, 0x9A25, 0xF3B6, - 0x9A27, 0xF3BC, 0x9A29, 0xF560, 0x9A2A, 0xF55E, 0x9A2B, 0xC4CA, - 0x9A2C, 0xF55D, 0x9A2D, 0xF563, 0x9A2E, 0xF561, 0x9A30, 0xC4CB, - 0x9A31, 0xF55C, 0x9A32, 0xF55A, 0x9A34, 0xF55B, 0x9A35, 0xC4CD, - 0x9A36, 0xF55F, 0x9A37, 0xC4CC, 0x9A38, 0xF562, 0x9A39, 0xF678, - 0x9A3A, 0xF67E, 0x9A3D, 0xF679, 0x9A3E, 0xC55B, 0x9A3F, 0xF6A1, - 0x9A40, 0xC55A, 0x9A41, 0xF67D, 0x9A42, 0xF67C, 0x9A43, 0xC559, - 0x9A44, 0xF67B, 0x9A45, 0xC558, 0x9A46, 0xF67A, 0x9A48, 0xF77D, - 0x9A49, 0xF7A1, 0x9A4A, 0xF77E, 0x9A4C, 0xF77B, 0x9A4D, 0xC5BB, - 0x9A4E, 0xF778, 0x9A4F, 0xF77C, 0x9A50, 0xF7A3, 0x9A52, 0xF7A2, - 0x9A53, 0xF779, 0x9A54, 0xF77A, 0x9A55, 0xC5BA, 0x9A56, 0xF852, - 0x9A57, 0xC5E7, 0x9A59, 0xF853, 0x9A5A, 0xC5E5, 0x9A5B, 0xC5E6, - 0x9A5E, 0xF8D3, 0x9A5F, 0xC64A, 0x9A60, 0xF976, 0x9A62, 0xC66A, - 0x9A64, 0xF9B3, 0x9A65, 0xC66B, 0x9A66, 0xF9B4, 0x9A67, 0xF9B5, - 0x9A68, 0xF9C3, 0x9A69, 0xF9C2, 0x9A6A, 0xC67A, 0x9A6B, 0xF9CD, - 0x9AA8, 0xB0A9, 0x9AAB, 0xE0E9, 0x9AAD, 0xE0E8, 0x9AAF, 0xBBEA, - 0x9AB0, 0xBBEB, 0x9AB1, 0xE4DA, 0x9AB3, 0xE8D2, 0x9AB4, 0xEC6C, - 0x9AB7, 0xBE75, 0x9AB8, 0xC065, 0x9AB9, 0xEC6A, 0x9ABB, 0xEC6D, - 0x9ABC, 0xC066, 0x9ABE, 0xEF64, 0x9ABF, 0xEC6B, 0x9AC0, 0xF1B9, - 0x9AC1, 0xC34E, 0x9AC2, 0xF3C1, 0x9AC6, 0xF566, 0x9AC7, 0xF564, - 0x9ACA, 0xF565, 0x9ACD, 0xF6A2, 0x9ACF, 0xC55C, 0x9AD0, 0xF7A4, - 0x9AD1, 0xC5EA, 0x9AD2, 0xC5BC, 0x9AD3, 0xC5E8, 0x9AD4, 0xC5E9, - 0x9AD5, 0xF8D4, 0x9AD6, 0xC662, 0x9AD8, 0xB0AA, 0x9ADC, 0xF1BA, - 0x9ADF, 0xD449, 0x9AE1, 0xB9A6, 0x9AE3, 0xE4DB, 0x9AE6, 0xBBEC, - 0x9AE7, 0xE4DC, 0x9AEB, 0xE8D4, 0x9AEC, 0xE8D3, 0x9AED, 0xC068, - 0x9AEE, 0xBE76, 0x9AEF, 0xBE77, 0x9AF1, 0xE8D7, 0x9AF2, 0xE8D6, - 0x9AF3, 0xE8D5, 0x9AF6, 0xEC6E, 0x9AF7, 0xEC71, 0x9AF9, 0xEC70, - 0x9AFA, 0xEC6F, 0x9AFB, 0xC067, 0x9AFC, 0xEF68, 0x9AFD, 0xEF66, - 0x9AFE, 0xEF65, 0x9B01, 0xEF67, 0x9B03, 0xC34F, 0x9B04, 0xF1BC, - 0x9B05, 0xF1BD, 0x9B06, 0xC350, 0x9B08, 0xF1BB, 0x9B0A, 0xF3C3, - 0x9B0B, 0xF3C2, 0x9B0C, 0xF3C5, 0x9B0D, 0xC447, 0x9B0E, 0xF3C4, - 0x9B10, 0xF567, 0x9B11, 0xF569, 0x9B12, 0xF568, 0x9B15, 0xF6A3, - 0x9B16, 0xF6A6, 0x9B17, 0xF6A4, 0x9B18, 0xF6A5, 0x9B19, 0xF7A5, - 0x9B1A, 0xC5BD, 0x9B1E, 0xF854, 0x9B1F, 0xF855, 0x9B20, 0xF856, - 0x9B22, 0xC64B, 0x9B23, 0xC663, 0x9B24, 0xF9B6, 0x9B25, 0xB0AB, - 0x9B27, 0xBE78, 0x9B28, 0xC069, 0x9B29, 0xF1BE, 0x9B2B, 0xF7A6, - 0x9B2E, 0xF9C4, 0x9B2F, 0xD44A, 0x9B31, 0xC67B, 0x9B32, 0xB0AC, - 0x9B33, 0xEC72, 0x9B35, 0xF1BF, 0x9B37, 0xF3C6, 0x9B3A, 0xF6A7, - 0x9B3B, 0xF7A7, 0x9B3C, 0xB0AD, 0x9B3E, 0xE4DD, 0x9B3F, 0xE4DE, - 0x9B41, 0xBBED, 0x9B42, 0xBBEE, 0x9B43, 0xE8D9, 0x9B44, 0xBE7A, - 0x9B45, 0xBE79, 0x9B46, 0xE8D8, 0x9B48, 0xEF69, 0x9B4A, 0xF1C0, - 0x9B4B, 0xF1C2, 0x9B4C, 0xF1C1, 0x9B4D, 0xC353, 0x9B4E, 0xC352, - 0x9B4F, 0xC351, 0x9B51, 0xC55E, 0x9B52, 0xF6A8, 0x9B54, 0xC55D, - 0x9B55, 0xF7A9, 0x9B56, 0xF7A8, 0x9B58, 0xC64C, 0x9B59, 0xF8D5, - 0x9B5A, 0xB3BD, 0x9B5B, 0xE0EA, 0x9B5F, 0xE4E1, 0x9B60, 0xE4DF, - 0x9B61, 0xE4E0, 0x9B64, 0xE8E2, 0x9B66, 0xE8DD, 0x9B67, 0xE8DA, - 0x9B68, 0xE8E1, 0x9B6C, 0xE8E3, 0x9B6F, 0xBE7C, 0x9B70, 0xE8E0, - 0x9B71, 0xE8DC, 0x9B74, 0xE8DB, 0x9B75, 0xE8DF, 0x9B76, 0xE8DE, - 0x9B77, 0xBE7B, 0x9B7A, 0xEC7D, 0x9B7B, 0xEC78, 0x9B7C, 0xEC76, - 0x9B7D, 0xECA1, 0x9B7E, 0xEC77, 0x9B80, 0xEC73, 0x9B82, 0xEC79, - 0x9B85, 0xEC74, 0x9B86, 0xEF72, 0x9B87, 0xEC75, 0x9B88, 0xECA2, - 0x9B90, 0xEC7C, 0x9B91, 0xC06A, 0x9B92, 0xEC7B, 0x9B93, 0xEC7A, - 0x9B95, 0xEC7E, 0x9B9A, 0xEF6A, 0x9B9B, 0xEF6D, 0x9B9E, 0xEF6C, - 0x9BA0, 0xEF74, 0x9BA1, 0xEF6F, 0x9BA2, 0xEF73, 0x9BA4, 0xEF71, - 0x9BA5, 0xEF70, 0x9BA6, 0xEF6E, 0x9BA8, 0xEF6B, 0x9BAA, 0xC243, - 0x9BAB, 0xC242, 0x9BAD, 0xC244, 0x9BAE, 0xC241, 0x9BAF, 0xEF75, - 0x9BB5, 0xF1C8, 0x9BB6, 0xF1CB, 0x9BB8, 0xF1C9, 0x9BB9, 0xF1CD, - 0x9BBD, 0xF1CE, 0x9BBF, 0xF1C6, 0x9BC0, 0xC358, 0x9BC1, 0xF1C7, - 0x9BC3, 0xF1C5, 0x9BC4, 0xF1CC, 0x9BC6, 0xF1C4, 0x9BC7, 0xF1C3, - 0x9BC8, 0xC357, 0x9BC9, 0xC355, 0x9BCA, 0xC354, 0x9BD3, 0xF1CA, - 0x9BD4, 0xF3CF, 0x9BD5, 0xF3D5, 0x9BD6, 0xC44A, 0x9BD7, 0xF3D0, - 0x9BD9, 0xF3D3, 0x9BDA, 0xF3D7, 0x9BDB, 0xC44B, 0x9BDC, 0xF3D2, - 0x9BDE, 0xF3CA, 0x9BE0, 0xF3C9, 0x9BE1, 0xF3D6, 0x9BE2, 0xF3CD, - 0x9BE4, 0xF3CB, 0x9BE5, 0xF3D4, 0x9BE6, 0xF3CC, 0x9BE7, 0xC449, - 0x9BE8, 0xC448, 0x9BEA, 0xF3C7, 0x9BEB, 0xF3C8, 0x9BEC, 0xF3D1, - 0x9BF0, 0xF3CE, 0x9BF7, 0xF56C, 0x9BF8, 0xF56F, 0x9BFD, 0xC356, - 0x9C05, 0xF56D, 0x9C06, 0xF573, 0x9C07, 0xF571, 0x9C08, 0xF56B, - 0x9C09, 0xF576, 0x9C0B, 0xF56A, 0x9C0D, 0xC4CF, 0x9C0E, 0xF572, - 0x9C12, 0xF56E, 0x9C13, 0xC4CE, 0x9C14, 0xF575, 0x9C17, 0xF574, - 0x9C1C, 0xF6AB, 0x9C1D, 0xF6AA, 0x9C21, 0xF6B1, 0x9C23, 0xF6AD, - 0x9C24, 0xF6B0, 0x9C25, 0xC560, 0x9C28, 0xF6AE, 0x9C29, 0xF6AF, - 0x9C2B, 0xF6A9, 0x9C2C, 0xF6AC, 0x9C2D, 0xC55F, 0x9C31, 0xC5BF, - 0x9C32, 0xF7B4, 0x9C33, 0xF7AF, 0x9C34, 0xF7B3, 0x9C36, 0xF7B6, - 0x9C37, 0xF7B2, 0x9C39, 0xF7AE, 0x9C3B, 0xC5C1, 0x9C3C, 0xF7B1, - 0x9C3D, 0xF7B5, 0x9C3E, 0xC5C0, 0x9C3F, 0xF7AC, 0x9C40, 0xF570, - 0x9C41, 0xF7B0, 0x9C44, 0xF7AD, 0x9C46, 0xF7AA, 0x9C48, 0xF7AB, - 0x9C49, 0xC5BE, 0x9C4A, 0xF85A, 0x9C4B, 0xF85C, 0x9C4C, 0xF85F, - 0x9C4D, 0xF85B, 0x9C4E, 0xF860, 0x9C50, 0xF859, 0x9C52, 0xF857, - 0x9C54, 0xC5EB, 0x9C55, 0xF85D, 0x9C56, 0xC5ED, 0x9C57, 0xC5EC, - 0x9C58, 0xF858, 0x9C59, 0xF85E, 0x9C5E, 0xF8DA, 0x9C5F, 0xC64D, - 0x9C60, 0xF8DB, 0x9C62, 0xF8D9, 0x9C63, 0xF8D6, 0x9C66, 0xF8D8, - 0x9C67, 0xF8D7, 0x9C68, 0xF95A, 0x9C6D, 0xF95C, 0x9C6E, 0xF95B, - 0x9C71, 0xF979, 0x9C73, 0xF978, 0x9C74, 0xF977, 0x9C75, 0xF97A, - 0x9C77, 0xC673, 0x9C78, 0xC674, 0x9C79, 0xF9CA, 0x9C7A, 0xF9CE, - 0x9CE5, 0xB3BE, 0x9CE6, 0xDCAF, 0x9CE7, 0xE0ED, 0x9CE9, 0xB9A7, - 0x9CEA, 0xE0EB, 0x9CED, 0xE0EC, 0x9CF1, 0xE4E2, 0x9CF2, 0xE4E3, - 0x9CF3, 0xBBF1, 0x9CF4, 0xBBEF, 0x9CF5, 0xE4E4, 0x9CF6, 0xBBF0, - 0x9CF7, 0xE8E8, 0x9CF9, 0xE8EB, 0x9CFA, 0xE8E5, 0x9CFB, 0xE8EC, - 0x9CFC, 0xE8E4, 0x9CFD, 0xE8E6, 0x9CFF, 0xE8E7, 0x9D00, 0xE8EA, - 0x9D03, 0xBEA1, 0x9D04, 0xE8EF, 0x9D05, 0xE8EE, 0x9D06, 0xBE7D, - 0x9D07, 0xE8E9, 0x9D08, 0xE8ED, 0x9D09, 0xBE7E, 0x9D10, 0xECAC, - 0x9D12, 0xC06F, 0x9D14, 0xECA7, 0x9D15, 0xC06B, 0x9D17, 0xECA4, - 0x9D18, 0xECAA, 0x9D19, 0xECAD, 0x9D1B, 0xC070, 0x9D1D, 0xECA9, - 0x9D1E, 0xECA6, 0x9D1F, 0xECAE, 0x9D20, 0xECA5, 0x9D22, 0xECAB, - 0x9D23, 0xC06C, 0x9D25, 0xECA3, 0x9D26, 0xC06D, 0x9D28, 0xC06E, - 0x9D29, 0xECA8, 0x9D2D, 0xEFA9, 0x9D2E, 0xEF7A, 0x9D2F, 0xEF7B, - 0x9D30, 0xEF7E, 0x9D31, 0xEF7C, 0x9D33, 0xEF76, 0x9D36, 0xEF79, - 0x9D37, 0xEFA5, 0x9D38, 0xEF7D, 0x9D3B, 0xC245, 0x9D3D, 0xEFA7, - 0x9D3E, 0xEFA4, 0x9D3F, 0xC246, 0x9D40, 0xEFA6, 0x9D41, 0xEF77, - 0x9D42, 0xEFA2, 0x9D43, 0xEFA3, 0x9D45, 0xEFA1, 0x9D4A, 0xF1D2, - 0x9D4B, 0xF1D4, 0x9D4C, 0xF1D7, 0x9D4F, 0xF1D1, 0x9D51, 0xC359, - 0x9D52, 0xF1D9, 0x9D53, 0xF1D0, 0x9D54, 0xF1DA, 0x9D56, 0xF1D6, - 0x9D57, 0xF1D8, 0x9D58, 0xF1DC, 0x9D59, 0xF1D5, 0x9D5A, 0xF1DD, - 0x9D5B, 0xF1D3, 0x9D5C, 0xF1CF, 0x9D5D, 0xC35A, 0x9D5F, 0xF1DB, - 0x9D60, 0xC35B, 0x9D61, 0xC44D, 0x9D67, 0xEF78, 0x9D68, 0xF3F1, - 0x9D69, 0xF3E8, 0x9D6A, 0xC44F, 0x9D6B, 0xF3E4, 0x9D6C, 0xC450, - 0x9D6F, 0xF3ED, 0x9D70, 0xF3E7, 0x9D71, 0xF3DD, 0x9D72, 0xC44E, - 0x9D73, 0xF3EA, 0x9D74, 0xF3E5, 0x9D75, 0xF3E6, 0x9D77, 0xF3D8, - 0x9D78, 0xF3DF, 0x9D79, 0xF3EE, 0x9D7B, 0xF3EB, 0x9D7D, 0xF3E3, - 0x9D7F, 0xF3EF, 0x9D80, 0xF3DE, 0x9D81, 0xF3D9, 0x9D82, 0xF3EC, - 0x9D84, 0xF3DB, 0x9D85, 0xF3E9, 0x9D86, 0xF3E0, 0x9D87, 0xF3F0, - 0x9D88, 0xF3DC, 0x9D89, 0xC44C, 0x9D8A, 0xF3DA, 0x9D8B, 0xF3E1, - 0x9D8C, 0xF3E2, 0x9D90, 0xF57D, 0x9D92, 0xF57B, 0x9D94, 0xF5A2, - 0x9D96, 0xF5AE, 0x9D97, 0xF5A5, 0x9D98, 0xF57C, 0x9D99, 0xF578, - 0x9D9A, 0xF5A7, 0x9D9B, 0xF57E, 0x9D9C, 0xF5A3, 0x9D9D, 0xF57A, - 0x9D9E, 0xF5AA, 0x9D9F, 0xF577, 0x9DA0, 0xF5A1, 0x9DA1, 0xF5A6, - 0x9DA2, 0xF5A8, 0x9DA3, 0xF5AB, 0x9DA4, 0xF579, 0x9DA6, 0xF5AF, - 0x9DA7, 0xF5B0, 0x9DA8, 0xF5A9, 0x9DA9, 0xF5AD, 0x9DAA, 0xF5A4, - 0x9DAC, 0xF6C1, 0x9DAD, 0xF6C4, 0x9DAF, 0xC561, 0x9DB1, 0xF6C3, - 0x9DB2, 0xF6C8, 0x9DB3, 0xF6C6, 0x9DB4, 0xC562, 0x9DB5, 0xF6BD, - 0x9DB6, 0xF6B3, 0x9DB7, 0xF6B2, 0x9DB8, 0xC564, 0x9DB9, 0xF6BF, - 0x9DBA, 0xF6C0, 0x9DBB, 0xF6BC, 0x9DBC, 0xF6B4, 0x9DBE, 0xF6B9, - 0x9DBF, 0xF5AC, 0x9DC1, 0xF6B5, 0x9DC2, 0xC563, 0x9DC3, 0xF6BB, - 0x9DC5, 0xF6BA, 0x9DC7, 0xF6B6, 0x9DC8, 0xF6C2, 0x9DCA, 0xF6B7, - 0x9DCB, 0xF7BB, 0x9DCC, 0xF6C5, 0x9DCD, 0xF6C7, 0x9DCE, 0xF6BE, - 0x9DCF, 0xF6B8, 0x9DD0, 0xF7BC, 0x9DD1, 0xF7BE, 0x9DD2, 0xF7B8, - 0x9DD3, 0xC5C2, 0x9DD5, 0xF7C5, 0x9DD6, 0xF7C3, 0x9DD7, 0xC5C3, - 0x9DD8, 0xF7C2, 0x9DD9, 0xF7C1, 0x9DDA, 0xF7BA, 0x9DDB, 0xF7B7, - 0x9DDC, 0xF7BD, 0x9DDD, 0xF7C6, 0x9DDE, 0xF7B9, 0x9DDF, 0xF7BF, - 0x9DE1, 0xF869, 0x9DE2, 0xF86E, 0x9DE3, 0xF864, 0x9DE4, 0xF867, - 0x9DE5, 0xC5EE, 0x9DE6, 0xF86B, 0x9DE8, 0xF872, 0x9DE9, 0xF7C0, - 0x9DEB, 0xF865, 0x9DEC, 0xF86F, 0x9DED, 0xF873, 0x9DEE, 0xF86A, - 0x9DEF, 0xF863, 0x9DF0, 0xF86D, 0x9DF2, 0xF86C, 0x9DF3, 0xF871, - 0x9DF4, 0xF870, 0x9DF5, 0xF7C4, 0x9DF6, 0xF868, 0x9DF7, 0xF862, - 0x9DF8, 0xF866, 0x9DF9, 0xC64E, 0x9DFA, 0xC64F, 0x9DFB, 0xF861, - 0x9DFD, 0xF8E6, 0x9DFE, 0xF8DD, 0x9DFF, 0xF8E5, 0x9E00, 0xF8E2, - 0x9E01, 0xF8E3, 0x9E02, 0xF8DC, 0x9E03, 0xF8DF, 0x9E04, 0xF8E7, - 0x9E05, 0xF8E1, 0x9E06, 0xF8E0, 0x9E07, 0xF8DE, 0x9E09, 0xF8E4, - 0x9E0B, 0xF95D, 0x9E0D, 0xF95E, 0x9E0F, 0xF960, 0x9E10, 0xF95F, - 0x9E11, 0xF962, 0x9E12, 0xF961, 0x9E13, 0xF97C, 0x9E14, 0xF97B, - 0x9E15, 0xF9B7, 0x9E17, 0xF9B8, 0x9E19, 0xF9C5, 0x9E1A, 0xC678, - 0x9E1B, 0xC67C, 0x9E1D, 0xF9CF, 0x9E1E, 0xC67D, 0x9E75, 0xB3BF, - 0x9E79, 0xC4D0, 0x9E7A, 0xF6C9, 0x9E7C, 0xC650, 0x9E7D, 0xC651, - 0x9E7F, 0xB3C0, 0x9E80, 0xE0EE, 0x9E82, 0xB9A8, 0x9E83, 0xE8F0, - 0x9E86, 0xECB0, 0x9E87, 0xECB1, 0x9E88, 0xECAF, 0x9E89, 0xEFAB, - 0x9E8A, 0xEFAA, 0x9E8B, 0xC247, 0x9E8C, 0xF1DF, 0x9E8D, 0xEFAC, - 0x9E8E, 0xF1DE, 0x9E91, 0xF3F3, 0x9E92, 0xC451, 0x9E93, 0xC453, - 0x9E94, 0xF3F2, 0x9E97, 0xC452, 0x9E99, 0xF5B1, 0x9E9A, 0xF5B3, - 0x9E9B, 0xF5B2, 0x9E9C, 0xF6CA, 0x9E9D, 0xC565, 0x9E9F, 0xC5EF, - 0x9EA0, 0xF8E8, 0x9EA1, 0xF963, 0x9EA4, 0xF9D2, 0x9EA5, 0xB3C1, - 0x9EA7, 0xE4E5, 0x9EA9, 0xBEA2, 0x9EAD, 0xECB3, 0x9EAE, 0xECB2, - 0x9EB0, 0xEFAD, 0x9EB4, 0xC454, 0x9EB5, 0xC4D1, 0x9EB6, 0xF7C7, - 0x9EB7, 0xF9CB, 0x9EBB, 0xB3C2, 0x9EBC, 0xBBF2, 0x9EBE, 0xBEA3, - 0x9EC0, 0xF3F4, 0x9EC2, 0xF874, 0x9EC3, 0xB6C0, 0x9EC8, 0xEFAE, - 0x9ECC, 0xC664, 0x9ECD, 0xB6C1, 0x9ECE, 0xBEA4, 0x9ECF, 0xC248, - 0x9ED0, 0xF875, 0x9ED1, 0xB6C2, 0x9ED3, 0xE8F1, 0x9ED4, 0xC072, - 0x9ED5, 0xECB4, 0x9ED6, 0xECB5, 0x9ED8, 0xC071, 0x9EDA, 0xEFAF, - 0x9EDB, 0xC24C, 0x9EDC, 0xC24A, 0x9EDD, 0xC24B, 0x9EDE, 0xC249, - 0x9EDF, 0xF1E0, 0x9EE0, 0xC35C, 0x9EE4, 0xF5B5, 0x9EE5, 0xF5B4, - 0x9EE6, 0xF5B7, 0x9EE7, 0xF5B6, 0x9EE8, 0xC4D2, 0x9EEB, 0xF6CB, - 0x9EED, 0xF6CD, 0x9EEE, 0xF6CC, 0x9EEF, 0xC566, 0x9EF0, 0xF7C8, - 0x9EF2, 0xF876, 0x9EF3, 0xF877, 0x9EF4, 0xC5F0, 0x9EF5, 0xF964, - 0x9EF6, 0xF97D, 0x9EF7, 0xC675, 0x9EF9, 0xDCB0, 0x9EFA, 0xECB6, - 0x9EFB, 0xEFB0, 0x9EFC, 0xF3F5, 0x9EFD, 0xE0EF, 0x9EFF, 0xEFB1, - 0x9F00, 0xF1E2, 0x9F01, 0xF1E1, 0x9F06, 0xF878, 0x9F07, 0xC652, - 0x9F09, 0xF965, 0x9F0A, 0xF97E, 0x9F0E, 0xB9A9, 0x9F0F, 0xE8F2, - 0x9F10, 0xE8F3, 0x9F12, 0xECB7, 0x9F13, 0xB9AA, 0x9F15, 0xC35D, - 0x9F16, 0xF1E3, 0x9F18, 0xF6CF, 0x9F19, 0xC567, 0x9F1A, 0xF6D0, - 0x9F1B, 0xF6CE, 0x9F1C, 0xF879, 0x9F1E, 0xF8E9, 0x9F20, 0xB9AB, - 0x9F22, 0xEFB4, 0x9F23, 0xEFB3, 0x9F24, 0xEFB2, 0x9F25, 0xF1E4, - 0x9F28, 0xF1E8, 0x9F29, 0xF1E7, 0x9F2A, 0xF1E6, 0x9F2B, 0xF1E5, - 0x9F2C, 0xC35E, 0x9F2D, 0xF3F6, 0x9F2E, 0xF5B9, 0x9F2F, 0xC4D3, - 0x9F30, 0xF5B8, 0x9F31, 0xF6D1, 0x9F32, 0xF7CB, 0x9F33, 0xF7CA, - 0x9F34, 0xC5C4, 0x9F35, 0xF7C9, 0x9F36, 0xF87C, 0x9F37, 0xF87B, - 0x9F38, 0xF87A, 0x9F3B, 0xBBF3, 0x9F3D, 0xECB8, 0x9F3E, 0xC24D, - 0x9F40, 0xF3F7, 0x9F41, 0xF3F8, 0x9F42, 0xF7CC, 0x9F43, 0xF87D, - 0x9F46, 0xF8EA, 0x9F47, 0xF966, 0x9F48, 0xF9B9, 0x9F49, 0xF9D4, - 0x9F4A, 0xBBF4, 0x9F4B, 0xC24E, 0x9F4C, 0xF1E9, 0x9F4D, 0xF3F9, - 0x9F4E, 0xF6D2, 0x9F4F, 0xF87E, 0x9F52, 0xBEA6, 0x9F54, 0xEFB5, - 0x9F55, 0xF1EA, 0x9F56, 0xF3FA, 0x9F57, 0xF3FB, 0x9F58, 0xF3FC, - 0x9F59, 0xF5BE, 0x9F5B, 0xF5BA, 0x9F5C, 0xC568, 0x9F5D, 0xF5BD, - 0x9F5E, 0xF5BC, 0x9F5F, 0xC4D4, 0x9F60, 0xF5BB, 0x9F61, 0xC4D6, - 0x9F63, 0xC4D5, 0x9F64, 0xF6D4, 0x9F65, 0xF6D3, 0x9F66, 0xC569, - 0x9F67, 0xC56A, 0x9F6A, 0xC5C6, 0x9F6B, 0xF7CD, 0x9F6C, 0xC5C5, - 0x9F6E, 0xF8A3, 0x9F6F, 0xF8A4, 0x9F70, 0xF8A2, 0x9F71, 0xF8A1, - 0x9F72, 0xC654, 0x9F74, 0xF8EB, 0x9F75, 0xF8EC, 0x9F76, 0xF8ED, - 0x9F77, 0xC653, 0x9F78, 0xF967, 0x9F79, 0xF96A, 0x9F7A, 0xF969, - 0x9F7B, 0xF968, 0x9F7E, 0xF9D3, 0x9F8D, 0xC073, 0x9F90, 0xC365, - 0x9F91, 0xF5BF, 0x9F92, 0xF6D5, 0x9F94, 0xC5C7, 0x9F95, 0xF7CE, - 0x9F98, 0xF9D5, 0x9F9C, 0xC074, 0x9FA0, 0xEFB6, 0x9FA2, 0xF7CF, - 0x9FA4, 0xF9A1, 0xFA0C, 0xC94A, 0xFA0D, 0xDDFC, 0xFE30, 0xA14A, - 0xFE31, 0xA157, 0xFE33, 0xA159, 0xFE34, 0xA15B, 0xFE35, 0xA15F, - 0xFE36, 0xA160, 0xFE37, 0xA163, 0xFE38, 0xA164, 0xFE39, 0xA167, - 0xFE3A, 0xA168, 0xFE3B, 0xA16B, 0xFE3C, 0xA16C, 0xFE3D, 0xA16F, - 0xFE3E, 0xA170, 0xFE3F, 0xA173, 0xFE40, 0xA174, 0xFE41, 0xA177, - 0xFE42, 0xA178, 0xFE43, 0xA17B, 0xFE44, 0xA17C, 0xFE49, 0xA1C6, - 0xFE4A, 0xA1C7, 0xFE4B, 0xA1CA, 0xFE4C, 0xA1CB, 0xFE4D, 0xA1C8, - 0xFE4E, 0xA1C9, 0xFE4F, 0xA15C, 0xFE50, 0xA14D, 0xFE51, 0xA14E, - 0xFE52, 0xA14F, 0xFE54, 0xA151, 0xFE55, 0xA152, 0xFE56, 0xA153, - 0xFE57, 0xA154, 0xFE59, 0xA17D, 0xFE5A, 0xA17E, 0xFE5B, 0xA1A1, - 0xFE5C, 0xA1A2, 0xFE5D, 0xA1A3, 0xFE5E, 0xA1A4, 0xFE5F, 0xA1CC, - 0xFE60, 0xA1CD, 0xFE61, 0xA1CE, 0xFE62, 0xA1DE, 0xFE63, 0xA1DF, - 0xFE64, 0xA1E0, 0xFE65, 0xA1E1, 0xFE66, 0xA1E2, 0xFE68, 0xA242, - 0xFE69, 0xA24C, 0xFE6A, 0xA24D, 0xFE6B, 0xA24E, 0xFF01, 0xA149, - 0xFF03, 0xA1AD, 0xFF04, 0xA243, 0xFF05, 0xA248, 0xFF06, 0xA1AE, - 0xFF08, 0xA15D, 0xFF09, 0xA15E, 0xFF0A, 0xA1AF, 0xFF0B, 0xA1CF, - 0xFF0C, 0xA141, 0xFF0D, 0xA1D0, 0xFF0E, 0xA144, 0xFF0F, 0xA1FE, - 0xFF10, 0xA2AF, 0xFF11, 0xA2B0, 0xFF12, 0xA2B1, 0xFF13, 0xA2B2, - 0xFF14, 0xA2B3, 0xFF15, 0xA2B4, 0xFF16, 0xA2B5, 0xFF17, 0xA2B6, - 0xFF18, 0xA2B7, 0xFF19, 0xA2B8, 0xFF1A, 0xA147, 0xFF1B, 0xA146, - 0xFF1C, 0xA1D5, 0xFF1D, 0xA1D7, 0xFF1E, 0xA1D6, 0xFF1F, 0xA148, - 0xFF20, 0xA249, 0xFF21, 0xA2CF, 0xFF22, 0xA2D0, 0xFF23, 0xA2D1, - 0xFF24, 0xA2D2, 0xFF25, 0xA2D3, 0xFF26, 0xA2D4, 0xFF27, 0xA2D5, - 0xFF28, 0xA2D6, 0xFF29, 0xA2D7, 0xFF2A, 0xA2D8, 0xFF2B, 0xA2D9, - 0xFF2C, 0xA2DA, 0xFF2D, 0xA2DB, 0xFF2E, 0xA2DC, 0xFF2F, 0xA2DD, - 0xFF30, 0xA2DE, 0xFF31, 0xA2DF, 0xFF32, 0xA2E0, 0xFF33, 0xA2E1, - 0xFF34, 0xA2E2, 0xFF35, 0xA2E3, 0xFF36, 0xA2E4, 0xFF37, 0xA2E5, - 0xFF38, 0xA2E6, 0xFF39, 0xA2E7, 0xFF3A, 0xA2E8, 0xFF3C, 0xA240, - 0xFF3F, 0xA1C4, 0xFF41, 0xA2E9, 0xFF42, 0xA2EA, 0xFF43, 0xA2EB, - 0xFF44, 0xA2EC, 0xFF45, 0xA2ED, 0xFF46, 0xA2EE, 0xFF47, 0xA2EF, - 0xFF48, 0xA2F0, 0xFF49, 0xA2F1, 0xFF4A, 0xA2F2, 0xFF4B, 0xA2F3, - 0xFF4C, 0xA2F4, 0xFF4D, 0xA2F5, 0xFF4E, 0xA2F6, 0xFF4F, 0xA2F7, - 0xFF50, 0xA2F8, 0xFF51, 0xA2F9, 0xFF52, 0xA2FA, 0xFF53, 0xA2FB, - 0xFF54, 0xA2FC, 0xFF55, 0xA2FD, 0xFF56, 0xA2FE, 0xFF57, 0xA340, - 0xFF58, 0xA341, 0xFF59, 0xA342, 0xFF5A, 0xA343, 0xFF5B, 0xA161, - 0xFF5C, 0xA155, 0xFF5D, 0xA162, 0xFF5E, 0xA1E3, 0xFFE0, 0xA246, - 0xFFE1, 0xA247, 0xFFE3, 0xA1C3, 0xFFE5, 0xA244, 0, 0 -}; - -static -const WCHAR oem2uni[] = { -/* OEM - Unicode, OEM - Unicode, OEM - Unicode, OEM - Unicode */ - 0xA140, 0x3000, 0xA141, 0xFF0C, 0xA142, 0x3001, 0xA143, 0x3002, - 0xA144, 0xFF0E, 0xA145, 0x2027, 0xA146, 0xFF1B, 0xA147, 0xFF1A, - 0xA148, 0xFF1F, 0xA149, 0xFF01, 0xA14A, 0xFE30, 0xA14B, 0x2026, - 0xA14C, 0x2025, 0xA14D, 0xFE50, 0xA14E, 0xFE51, 0xA14F, 0xFE52, - 0xA150, 0x00B7, 0xA151, 0xFE54, 0xA152, 0xFE55, 0xA153, 0xFE56, - 0xA154, 0xFE57, 0xA155, 0xFF5C, 0xA156, 0x2013, 0xA157, 0xFE31, - 0xA158, 0x2014, 0xA159, 0xFE33, 0xA15A, 0x2574, 0xA15B, 0xFE34, - 0xA15C, 0xFE4F, 0xA15D, 0xFF08, 0xA15E, 0xFF09, 0xA15F, 0xFE35, - 0xA160, 0xFE36, 0xA161, 0xFF5B, 0xA162, 0xFF5D, 0xA163, 0xFE37, - 0xA164, 0xFE38, 0xA165, 0x3014, 0xA166, 0x3015, 0xA167, 0xFE39, - 0xA168, 0xFE3A, 0xA169, 0x3010, 0xA16A, 0x3011, 0xA16B, 0xFE3B, - 0xA16C, 0xFE3C, 0xA16D, 0x300A, 0xA16E, 0x300B, 0xA16F, 0xFE3D, - 0xA170, 0xFE3E, 0xA171, 0x3008, 0xA172, 0x3009, 0xA173, 0xFE3F, - 0xA174, 0xFE40, 0xA175, 0x300C, 0xA176, 0x300D, 0xA177, 0xFE41, - 0xA178, 0xFE42, 0xA179, 0x300E, 0xA17A, 0x300F, 0xA17B, 0xFE43, - 0xA17C, 0xFE44, 0xA17D, 0xFE59, 0xA17E, 0xFE5A, 0xA1A1, 0xFE5B, - 0xA1A2, 0xFE5C, 0xA1A3, 0xFE5D, 0xA1A4, 0xFE5E, 0xA1A5, 0x2018, - 0xA1A6, 0x2019, 0xA1A7, 0x201C, 0xA1A8, 0x201D, 0xA1A9, 0x301D, - 0xA1AA, 0x301E, 0xA1AB, 0x2035, 0xA1AC, 0x2032, 0xA1AD, 0xFF03, - 0xA1AE, 0xFF06, 0xA1AF, 0xFF0A, 0xA1B0, 0x203B, 0xA1B1, 0x00A7, - 0xA1B2, 0x3003, 0xA1B3, 0x25CB, 0xA1B4, 0x25CF, 0xA1B5, 0x25B3, - 0xA1B6, 0x25B2, 0xA1B7, 0x25CE, 0xA1B8, 0x2606, 0xA1B9, 0x2605, - 0xA1BA, 0x25C7, 0xA1BB, 0x25C6, 0xA1BC, 0x25A1, 0xA1BD, 0x25A0, - 0xA1BE, 0x25BD, 0xA1BF, 0x25BC, 0xA1C0, 0x32A3, 0xA1C1, 0x2105, - 0xA1C2, 0x00AF, 0xA1C3, 0xFFE3, 0xA1C4, 0xFF3F, 0xA1C5, 0x02CD, - 0xA1C6, 0xFE49, 0xA1C7, 0xFE4A, 0xA1C8, 0xFE4D, 0xA1C9, 0xFE4E, - 0xA1CA, 0xFE4B, 0xA1CB, 0xFE4C, 0xA1CC, 0xFE5F, 0xA1CD, 0xFE60, - 0xA1CE, 0xFE61, 0xA1CF, 0xFF0B, 0xA1D0, 0xFF0D, 0xA1D1, 0x00D7, - 0xA1D2, 0x00F7, 0xA1D3, 0x00B1, 0xA1D4, 0x221A, 0xA1D5, 0xFF1C, - 0xA1D6, 0xFF1E, 0xA1D7, 0xFF1D, 0xA1D8, 0x2266, 0xA1D9, 0x2267, - 0xA1DA, 0x2260, 0xA1DB, 0x221E, 0xA1DC, 0x2252, 0xA1DD, 0x2261, - 0xA1DE, 0xFE62, 0xA1DF, 0xFE63, 0xA1E0, 0xFE64, 0xA1E1, 0xFE65, - 0xA1E2, 0xFE66, 0xA1E3, 0xFF5E, 0xA1E4, 0x2229, 0xA1E5, 0x222A, - 0xA1E6, 0x22A5, 0xA1E7, 0x2220, 0xA1E8, 0x221F, 0xA1E9, 0x22BF, - 0xA1EA, 0x33D2, 0xA1EB, 0x33D1, 0xA1EC, 0x222B, 0xA1ED, 0x222E, - 0xA1EE, 0x2235, 0xA1EF, 0x2234, 0xA1F0, 0x2640, 0xA1F1, 0x2642, - 0xA1F2, 0x2295, 0xA1F3, 0x2299, 0xA1F4, 0x2191, 0xA1F5, 0x2193, - 0xA1F6, 0x2190, 0xA1F7, 0x2192, 0xA1F8, 0x2196, 0xA1F9, 0x2197, - 0xA1FA, 0x2199, 0xA1FB, 0x2198, 0xA1FC, 0x2225, 0xA1FD, 0x2223, - 0xA1FE, 0xFF0F, 0xA240, 0xFF3C, 0xA241, 0x2215, 0xA242, 0xFE68, - 0xA243, 0xFF04, 0xA244, 0xFFE5, 0xA245, 0x3012, 0xA246, 0xFFE0, - 0xA247, 0xFFE1, 0xA248, 0xFF05, 0xA249, 0xFF20, 0xA24A, 0x2103, - 0xA24B, 0x2109, 0xA24C, 0xFE69, 0xA24D, 0xFE6A, 0xA24E, 0xFE6B, - 0xA24F, 0x33D5, 0xA250, 0x339C, 0xA251, 0x339D, 0xA252, 0x339E, - 0xA253, 0x33CE, 0xA254, 0x33A1, 0xA255, 0x338E, 0xA256, 0x338F, - 0xA257, 0x33C4, 0xA258, 0x00B0, 0xA259, 0x5159, 0xA25A, 0x515B, - 0xA25B, 0x515E, 0xA25C, 0x515D, 0xA25D, 0x5161, 0xA25E, 0x5163, - 0xA25F, 0x55E7, 0xA260, 0x74E9, 0xA261, 0x7CCE, 0xA262, 0x2581, - 0xA263, 0x2582, 0xA264, 0x2583, 0xA265, 0x2584, 0xA266, 0x2585, - 0xA267, 0x2586, 0xA268, 0x2587, 0xA269, 0x2588, 0xA26A, 0x258F, - 0xA26B, 0x258E, 0xA26C, 0x258D, 0xA26D, 0x258C, 0xA26E, 0x258B, - 0xA26F, 0x258A, 0xA270, 0x2589, 0xA271, 0x253C, 0xA272, 0x2534, - 0xA273, 0x252C, 0xA274, 0x2524, 0xA275, 0x251C, 0xA276, 0x2594, - 0xA277, 0x2500, 0xA278, 0x2502, 0xA279, 0x2595, 0xA27A, 0x250C, - 0xA27B, 0x2510, 0xA27C, 0x2514, 0xA27D, 0x2518, 0xA27E, 0x256D, - 0xA2A1, 0x256E, 0xA2A2, 0x2570, 0xA2A3, 0x256F, 0xA2A4, 0x2550, - 0xA2A5, 0x255E, 0xA2A6, 0x256A, 0xA2A7, 0x2561, 0xA2A8, 0x25E2, - 0xA2A9, 0x25E3, 0xA2AA, 0x25E5, 0xA2AB, 0x25E4, 0xA2AC, 0x2571, - 0xA2AD, 0x2572, 0xA2AE, 0x2573, 0xA2AF, 0xFF10, 0xA2B0, 0xFF11, - 0xA2B1, 0xFF12, 0xA2B2, 0xFF13, 0xA2B3, 0xFF14, 0xA2B4, 0xFF15, - 0xA2B5, 0xFF16, 0xA2B6, 0xFF17, 0xA2B7, 0xFF18, 0xA2B8, 0xFF19, - 0xA2B9, 0x2160, 0xA2BA, 0x2161, 0xA2BB, 0x2162, 0xA2BC, 0x2163, - 0xA2BD, 0x2164, 0xA2BE, 0x2165, 0xA2BF, 0x2166, 0xA2C0, 0x2167, - 0xA2C1, 0x2168, 0xA2C2, 0x2169, 0xA2C3, 0x3021, 0xA2C4, 0x3022, - 0xA2C5, 0x3023, 0xA2C6, 0x3024, 0xA2C7, 0x3025, 0xA2C8, 0x3026, - 0xA2C9, 0x3027, 0xA2CA, 0x3028, 0xA2CB, 0x3029, 0xA2CC, 0x5341, - 0xA2CD, 0x5344, 0xA2CE, 0x5345, 0xA2CF, 0xFF21, 0xA2D0, 0xFF22, - 0xA2D1, 0xFF23, 0xA2D2, 0xFF24, 0xA2D3, 0xFF25, 0xA2D4, 0xFF26, - 0xA2D5, 0xFF27, 0xA2D6, 0xFF28, 0xA2D7, 0xFF29, 0xA2D8, 0xFF2A, - 0xA2D9, 0xFF2B, 0xA2DA, 0xFF2C, 0xA2DB, 0xFF2D, 0xA2DC, 0xFF2E, - 0xA2DD, 0xFF2F, 0xA2DE, 0xFF30, 0xA2DF, 0xFF31, 0xA2E0, 0xFF32, - 0xA2E1, 0xFF33, 0xA2E2, 0xFF34, 0xA2E3, 0xFF35, 0xA2E4, 0xFF36, - 0xA2E5, 0xFF37, 0xA2E6, 0xFF38, 0xA2E7, 0xFF39, 0xA2E8, 0xFF3A, - 0xA2E9, 0xFF41, 0xA2EA, 0xFF42, 0xA2EB, 0xFF43, 0xA2EC, 0xFF44, - 0xA2ED, 0xFF45, 0xA2EE, 0xFF46, 0xA2EF, 0xFF47, 0xA2F0, 0xFF48, - 0xA2F1, 0xFF49, 0xA2F2, 0xFF4A, 0xA2F3, 0xFF4B, 0xA2F4, 0xFF4C, - 0xA2F5, 0xFF4D, 0xA2F6, 0xFF4E, 0xA2F7, 0xFF4F, 0xA2F8, 0xFF50, - 0xA2F9, 0xFF51, 0xA2FA, 0xFF52, 0xA2FB, 0xFF53, 0xA2FC, 0xFF54, - 0xA2FD, 0xFF55, 0xA2FE, 0xFF56, 0xA340, 0xFF57, 0xA341, 0xFF58, - 0xA342, 0xFF59, 0xA343, 0xFF5A, 0xA344, 0x0391, 0xA345, 0x0392, - 0xA346, 0x0393, 0xA347, 0x0394, 0xA348, 0x0395, 0xA349, 0x0396, - 0xA34A, 0x0397, 0xA34B, 0x0398, 0xA34C, 0x0399, 0xA34D, 0x039A, - 0xA34E, 0x039B, 0xA34F, 0x039C, 0xA350, 0x039D, 0xA351, 0x039E, - 0xA352, 0x039F, 0xA353, 0x03A0, 0xA354, 0x03A1, 0xA355, 0x03A3, - 0xA356, 0x03A4, 0xA357, 0x03A5, 0xA358, 0x03A6, 0xA359, 0x03A7, - 0xA35A, 0x03A8, 0xA35B, 0x03A9, 0xA35C, 0x03B1, 0xA35D, 0x03B2, - 0xA35E, 0x03B3, 0xA35F, 0x03B4, 0xA360, 0x03B5, 0xA361, 0x03B6, - 0xA362, 0x03B7, 0xA363, 0x03B8, 0xA364, 0x03B9, 0xA365, 0x03BA, - 0xA366, 0x03BB, 0xA367, 0x03BC, 0xA368, 0x03BD, 0xA369, 0x03BE, - 0xA36A, 0x03BF, 0xA36B, 0x03C0, 0xA36C, 0x03C1, 0xA36D, 0x03C3, - 0xA36E, 0x03C4, 0xA36F, 0x03C5, 0xA370, 0x03C6, 0xA371, 0x03C7, - 0xA372, 0x03C8, 0xA373, 0x03C9, 0xA374, 0x3105, 0xA375, 0x3106, - 0xA376, 0x3107, 0xA377, 0x3108, 0xA378, 0x3109, 0xA379, 0x310A, - 0xA37A, 0x310B, 0xA37B, 0x310C, 0xA37C, 0x310D, 0xA37D, 0x310E, - 0xA37E, 0x310F, 0xA3A1, 0x3110, 0xA3A2, 0x3111, 0xA3A3, 0x3112, - 0xA3A4, 0x3113, 0xA3A5, 0x3114, 0xA3A6, 0x3115, 0xA3A7, 0x3116, - 0xA3A8, 0x3117, 0xA3A9, 0x3118, 0xA3AA, 0x3119, 0xA3AB, 0x311A, - 0xA3AC, 0x311B, 0xA3AD, 0x311C, 0xA3AE, 0x311D, 0xA3AF, 0x311E, - 0xA3B0, 0x311F, 0xA3B1, 0x3120, 0xA3B2, 0x3121, 0xA3B3, 0x3122, - 0xA3B4, 0x3123, 0xA3B5, 0x3124, 0xA3B6, 0x3125, 0xA3B7, 0x3126, - 0xA3B8, 0x3127, 0xA3B9, 0x3128, 0xA3BA, 0x3129, 0xA3BB, 0x02D9, - 0xA3BC, 0x02C9, 0xA3BD, 0x02CA, 0xA3BE, 0x02C7, 0xA3BF, 0x02CB, - 0xA3E1, 0x20AC, 0xA440, 0x4E00, 0xA441, 0x4E59, 0xA442, 0x4E01, - 0xA443, 0x4E03, 0xA444, 0x4E43, 0xA445, 0x4E5D, 0xA446, 0x4E86, - 0xA447, 0x4E8C, 0xA448, 0x4EBA, 0xA449, 0x513F, 0xA44A, 0x5165, - 0xA44B, 0x516B, 0xA44C, 0x51E0, 0xA44D, 0x5200, 0xA44E, 0x5201, - 0xA44F, 0x529B, 0xA450, 0x5315, 0xA451, 0x5341, 0xA452, 0x535C, - 0xA453, 0x53C8, 0xA454, 0x4E09, 0xA455, 0x4E0B, 0xA456, 0x4E08, - 0xA457, 0x4E0A, 0xA458, 0x4E2B, 0xA459, 0x4E38, 0xA45A, 0x51E1, - 0xA45B, 0x4E45, 0xA45C, 0x4E48, 0xA45D, 0x4E5F, 0xA45E, 0x4E5E, - 0xA45F, 0x4E8E, 0xA460, 0x4EA1, 0xA461, 0x5140, 0xA462, 0x5203, - 0xA463, 0x52FA, 0xA464, 0x5343, 0xA465, 0x53C9, 0xA466, 0x53E3, - 0xA467, 0x571F, 0xA468, 0x58EB, 0xA469, 0x5915, 0xA46A, 0x5927, - 0xA46B, 0x5973, 0xA46C, 0x5B50, 0xA46D, 0x5B51, 0xA46E, 0x5B53, - 0xA46F, 0x5BF8, 0xA470, 0x5C0F, 0xA471, 0x5C22, 0xA472, 0x5C38, - 0xA473, 0x5C71, 0xA474, 0x5DDD, 0xA475, 0x5DE5, 0xA476, 0x5DF1, - 0xA477, 0x5DF2, 0xA478, 0x5DF3, 0xA479, 0x5DFE, 0xA47A, 0x5E72, - 0xA47B, 0x5EFE, 0xA47C, 0x5F0B, 0xA47D, 0x5F13, 0xA47E, 0x624D, - 0xA4A1, 0x4E11, 0xA4A2, 0x4E10, 0xA4A3, 0x4E0D, 0xA4A4, 0x4E2D, - 0xA4A5, 0x4E30, 0xA4A6, 0x4E39, 0xA4A7, 0x4E4B, 0xA4A8, 0x5C39, - 0xA4A9, 0x4E88, 0xA4AA, 0x4E91, 0xA4AB, 0x4E95, 0xA4AC, 0x4E92, - 0xA4AD, 0x4E94, 0xA4AE, 0x4EA2, 0xA4AF, 0x4EC1, 0xA4B0, 0x4EC0, - 0xA4B1, 0x4EC3, 0xA4B2, 0x4EC6, 0xA4B3, 0x4EC7, 0xA4B4, 0x4ECD, - 0xA4B5, 0x4ECA, 0xA4B6, 0x4ECB, 0xA4B7, 0x4EC4, 0xA4B8, 0x5143, - 0xA4B9, 0x5141, 0xA4BA, 0x5167, 0xA4BB, 0x516D, 0xA4BC, 0x516E, - 0xA4BD, 0x516C, 0xA4BE, 0x5197, 0xA4BF, 0x51F6, 0xA4C0, 0x5206, - 0xA4C1, 0x5207, 0xA4C2, 0x5208, 0xA4C3, 0x52FB, 0xA4C4, 0x52FE, - 0xA4C5, 0x52FF, 0xA4C6, 0x5316, 0xA4C7, 0x5339, 0xA4C8, 0x5348, - 0xA4C9, 0x5347, 0xA4CA, 0x5345, 0xA4CB, 0x535E, 0xA4CC, 0x5384, - 0xA4CD, 0x53CB, 0xA4CE, 0x53CA, 0xA4CF, 0x53CD, 0xA4D0, 0x58EC, - 0xA4D1, 0x5929, 0xA4D2, 0x592B, 0xA4D3, 0x592A, 0xA4D4, 0x592D, - 0xA4D5, 0x5B54, 0xA4D6, 0x5C11, 0xA4D7, 0x5C24, 0xA4D8, 0x5C3A, - 0xA4D9, 0x5C6F, 0xA4DA, 0x5DF4, 0xA4DB, 0x5E7B, 0xA4DC, 0x5EFF, - 0xA4DD, 0x5F14, 0xA4DE, 0x5F15, 0xA4DF, 0x5FC3, 0xA4E0, 0x6208, - 0xA4E1, 0x6236, 0xA4E2, 0x624B, 0xA4E3, 0x624E, 0xA4E4, 0x652F, - 0xA4E5, 0x6587, 0xA4E6, 0x6597, 0xA4E7, 0x65A4, 0xA4E8, 0x65B9, - 0xA4E9, 0x65E5, 0xA4EA, 0x66F0, 0xA4EB, 0x6708, 0xA4EC, 0x6728, - 0xA4ED, 0x6B20, 0xA4EE, 0x6B62, 0xA4EF, 0x6B79, 0xA4F0, 0x6BCB, - 0xA4F1, 0x6BD4, 0xA4F2, 0x6BDB, 0xA4F3, 0x6C0F, 0xA4F4, 0x6C34, - 0xA4F5, 0x706B, 0xA4F6, 0x722A, 0xA4F7, 0x7236, 0xA4F8, 0x723B, - 0xA4F9, 0x7247, 0xA4FA, 0x7259, 0xA4FB, 0x725B, 0xA4FC, 0x72AC, - 0xA4FD, 0x738B, 0xA4FE, 0x4E19, 0xA540, 0x4E16, 0xA541, 0x4E15, - 0xA542, 0x4E14, 0xA543, 0x4E18, 0xA544, 0x4E3B, 0xA545, 0x4E4D, - 0xA546, 0x4E4F, 0xA547, 0x4E4E, 0xA548, 0x4EE5, 0xA549, 0x4ED8, - 0xA54A, 0x4ED4, 0xA54B, 0x4ED5, 0xA54C, 0x4ED6, 0xA54D, 0x4ED7, - 0xA54E, 0x4EE3, 0xA54F, 0x4EE4, 0xA550, 0x4ED9, 0xA551, 0x4EDE, - 0xA552, 0x5145, 0xA553, 0x5144, 0xA554, 0x5189, 0xA555, 0x518A, - 0xA556, 0x51AC, 0xA557, 0x51F9, 0xA558, 0x51FA, 0xA559, 0x51F8, - 0xA55A, 0x520A, 0xA55B, 0x52A0, 0xA55C, 0x529F, 0xA55D, 0x5305, - 0xA55E, 0x5306, 0xA55F, 0x5317, 0xA560, 0x531D, 0xA561, 0x4EDF, - 0xA562, 0x534A, 0xA563, 0x5349, 0xA564, 0x5361, 0xA565, 0x5360, - 0xA566, 0x536F, 0xA567, 0x536E, 0xA568, 0x53BB, 0xA569, 0x53EF, - 0xA56A, 0x53E4, 0xA56B, 0x53F3, 0xA56C, 0x53EC, 0xA56D, 0x53EE, - 0xA56E, 0x53E9, 0xA56F, 0x53E8, 0xA570, 0x53FC, 0xA571, 0x53F8, - 0xA572, 0x53F5, 0xA573, 0x53EB, 0xA574, 0x53E6, 0xA575, 0x53EA, - 0xA576, 0x53F2, 0xA577, 0x53F1, 0xA578, 0x53F0, 0xA579, 0x53E5, - 0xA57A, 0x53ED, 0xA57B, 0x53FB, 0xA57C, 0x56DB, 0xA57D, 0x56DA, - 0xA57E, 0x5916, 0xA5A1, 0x592E, 0xA5A2, 0x5931, 0xA5A3, 0x5974, - 0xA5A4, 0x5976, 0xA5A5, 0x5B55, 0xA5A6, 0x5B83, 0xA5A7, 0x5C3C, - 0xA5A8, 0x5DE8, 0xA5A9, 0x5DE7, 0xA5AA, 0x5DE6, 0xA5AB, 0x5E02, - 0xA5AC, 0x5E03, 0xA5AD, 0x5E73, 0xA5AE, 0x5E7C, 0xA5AF, 0x5F01, - 0xA5B0, 0x5F18, 0xA5B1, 0x5F17, 0xA5B2, 0x5FC5, 0xA5B3, 0x620A, - 0xA5B4, 0x6253, 0xA5B5, 0x6254, 0xA5B6, 0x6252, 0xA5B7, 0x6251, - 0xA5B8, 0x65A5, 0xA5B9, 0x65E6, 0xA5BA, 0x672E, 0xA5BB, 0x672C, - 0xA5BC, 0x672A, 0xA5BD, 0x672B, 0xA5BE, 0x672D, 0xA5BF, 0x6B63, - 0xA5C0, 0x6BCD, 0xA5C1, 0x6C11, 0xA5C2, 0x6C10, 0xA5C3, 0x6C38, - 0xA5C4, 0x6C41, 0xA5C5, 0x6C40, 0xA5C6, 0x6C3E, 0xA5C7, 0x72AF, - 0xA5C8, 0x7384, 0xA5C9, 0x7389, 0xA5CA, 0x74DC, 0xA5CB, 0x74E6, - 0xA5CC, 0x7518, 0xA5CD, 0x751F, 0xA5CE, 0x7528, 0xA5CF, 0x7529, - 0xA5D0, 0x7530, 0xA5D1, 0x7531, 0xA5D2, 0x7532, 0xA5D3, 0x7533, - 0xA5D4, 0x758B, 0xA5D5, 0x767D, 0xA5D6, 0x76AE, 0xA5D7, 0x76BF, - 0xA5D8, 0x76EE, 0xA5D9, 0x77DB, 0xA5DA, 0x77E2, 0xA5DB, 0x77F3, - 0xA5DC, 0x793A, 0xA5DD, 0x79BE, 0xA5DE, 0x7A74, 0xA5DF, 0x7ACB, - 0xA5E0, 0x4E1E, 0xA5E1, 0x4E1F, 0xA5E2, 0x4E52, 0xA5E3, 0x4E53, - 0xA5E4, 0x4E69, 0xA5E5, 0x4E99, 0xA5E6, 0x4EA4, 0xA5E7, 0x4EA6, - 0xA5E8, 0x4EA5, 0xA5E9, 0x4EFF, 0xA5EA, 0x4F09, 0xA5EB, 0x4F19, - 0xA5EC, 0x4F0A, 0xA5ED, 0x4F15, 0xA5EE, 0x4F0D, 0xA5EF, 0x4F10, - 0xA5F0, 0x4F11, 0xA5F1, 0x4F0F, 0xA5F2, 0x4EF2, 0xA5F3, 0x4EF6, - 0xA5F4, 0x4EFB, 0xA5F5, 0x4EF0, 0xA5F6, 0x4EF3, 0xA5F7, 0x4EFD, - 0xA5F8, 0x4F01, 0xA5F9, 0x4F0B, 0xA5FA, 0x5149, 0xA5FB, 0x5147, - 0xA5FC, 0x5146, 0xA5FD, 0x5148, 0xA5FE, 0x5168, 0xA640, 0x5171, - 0xA641, 0x518D, 0xA642, 0x51B0, 0xA643, 0x5217, 0xA644, 0x5211, - 0xA645, 0x5212, 0xA646, 0x520E, 0xA647, 0x5216, 0xA648, 0x52A3, - 0xA649, 0x5308, 0xA64A, 0x5321, 0xA64B, 0x5320, 0xA64C, 0x5370, - 0xA64D, 0x5371, 0xA64E, 0x5409, 0xA64F, 0x540F, 0xA650, 0x540C, - 0xA651, 0x540A, 0xA652, 0x5410, 0xA653, 0x5401, 0xA654, 0x540B, - 0xA655, 0x5404, 0xA656, 0x5411, 0xA657, 0x540D, 0xA658, 0x5408, - 0xA659, 0x5403, 0xA65A, 0x540E, 0xA65B, 0x5406, 0xA65C, 0x5412, - 0xA65D, 0x56E0, 0xA65E, 0x56DE, 0xA65F, 0x56DD, 0xA660, 0x5733, - 0xA661, 0x5730, 0xA662, 0x5728, 0xA663, 0x572D, 0xA664, 0x572C, - 0xA665, 0x572F, 0xA666, 0x5729, 0xA667, 0x5919, 0xA668, 0x591A, - 0xA669, 0x5937, 0xA66A, 0x5938, 0xA66B, 0x5984, 0xA66C, 0x5978, - 0xA66D, 0x5983, 0xA66E, 0x597D, 0xA66F, 0x5979, 0xA670, 0x5982, - 0xA671, 0x5981, 0xA672, 0x5B57, 0xA673, 0x5B58, 0xA674, 0x5B87, - 0xA675, 0x5B88, 0xA676, 0x5B85, 0xA677, 0x5B89, 0xA678, 0x5BFA, - 0xA679, 0x5C16, 0xA67A, 0x5C79, 0xA67B, 0x5DDE, 0xA67C, 0x5E06, - 0xA67D, 0x5E76, 0xA67E, 0x5E74, 0xA6A1, 0x5F0F, 0xA6A2, 0x5F1B, - 0xA6A3, 0x5FD9, 0xA6A4, 0x5FD6, 0xA6A5, 0x620E, 0xA6A6, 0x620C, - 0xA6A7, 0x620D, 0xA6A8, 0x6210, 0xA6A9, 0x6263, 0xA6AA, 0x625B, - 0xA6AB, 0x6258, 0xA6AC, 0x6536, 0xA6AD, 0x65E9, 0xA6AE, 0x65E8, - 0xA6AF, 0x65EC, 0xA6B0, 0x65ED, 0xA6B1, 0x66F2, 0xA6B2, 0x66F3, - 0xA6B3, 0x6709, 0xA6B4, 0x673D, 0xA6B5, 0x6734, 0xA6B6, 0x6731, - 0xA6B7, 0x6735, 0xA6B8, 0x6B21, 0xA6B9, 0x6B64, 0xA6BA, 0x6B7B, - 0xA6BB, 0x6C16, 0xA6BC, 0x6C5D, 0xA6BD, 0x6C57, 0xA6BE, 0x6C59, - 0xA6BF, 0x6C5F, 0xA6C0, 0x6C60, 0xA6C1, 0x6C50, 0xA6C2, 0x6C55, - 0xA6C3, 0x6C61, 0xA6C4, 0x6C5B, 0xA6C5, 0x6C4D, 0xA6C6, 0x6C4E, - 0xA6C7, 0x7070, 0xA6C8, 0x725F, 0xA6C9, 0x725D, 0xA6CA, 0x767E, - 0xA6CB, 0x7AF9, 0xA6CC, 0x7C73, 0xA6CD, 0x7CF8, 0xA6CE, 0x7F36, - 0xA6CF, 0x7F8A, 0xA6D0, 0x7FBD, 0xA6D1, 0x8001, 0xA6D2, 0x8003, - 0xA6D3, 0x800C, 0xA6D4, 0x8012, 0xA6D5, 0x8033, 0xA6D6, 0x807F, - 0xA6D7, 0x8089, 0xA6D8, 0x808B, 0xA6D9, 0x808C, 0xA6DA, 0x81E3, - 0xA6DB, 0x81EA, 0xA6DC, 0x81F3, 0xA6DD, 0x81FC, 0xA6DE, 0x820C, - 0xA6DF, 0x821B, 0xA6E0, 0x821F, 0xA6E1, 0x826E, 0xA6E2, 0x8272, - 0xA6E3, 0x827E, 0xA6E4, 0x866B, 0xA6E5, 0x8840, 0xA6E6, 0x884C, - 0xA6E7, 0x8863, 0xA6E8, 0x897F, 0xA6E9, 0x9621, 0xA6EA, 0x4E32, - 0xA6EB, 0x4EA8, 0xA6EC, 0x4F4D, 0xA6ED, 0x4F4F, 0xA6EE, 0x4F47, - 0xA6EF, 0x4F57, 0xA6F0, 0x4F5E, 0xA6F1, 0x4F34, 0xA6F2, 0x4F5B, - 0xA6F3, 0x4F55, 0xA6F4, 0x4F30, 0xA6F5, 0x4F50, 0xA6F6, 0x4F51, - 0xA6F7, 0x4F3D, 0xA6F8, 0x4F3A, 0xA6F9, 0x4F38, 0xA6FA, 0x4F43, - 0xA6FB, 0x4F54, 0xA6FC, 0x4F3C, 0xA6FD, 0x4F46, 0xA6FE, 0x4F63, - 0xA740, 0x4F5C, 0xA741, 0x4F60, 0xA742, 0x4F2F, 0xA743, 0x4F4E, - 0xA744, 0x4F36, 0xA745, 0x4F59, 0xA746, 0x4F5D, 0xA747, 0x4F48, - 0xA748, 0x4F5A, 0xA749, 0x514C, 0xA74A, 0x514B, 0xA74B, 0x514D, - 0xA74C, 0x5175, 0xA74D, 0x51B6, 0xA74E, 0x51B7, 0xA74F, 0x5225, - 0xA750, 0x5224, 0xA751, 0x5229, 0xA752, 0x522A, 0xA753, 0x5228, - 0xA754, 0x52AB, 0xA755, 0x52A9, 0xA756, 0x52AA, 0xA757, 0x52AC, - 0xA758, 0x5323, 0xA759, 0x5373, 0xA75A, 0x5375, 0xA75B, 0x541D, - 0xA75C, 0x542D, 0xA75D, 0x541E, 0xA75E, 0x543E, 0xA75F, 0x5426, - 0xA760, 0x544E, 0xA761, 0x5427, 0xA762, 0x5446, 0xA763, 0x5443, - 0xA764, 0x5433, 0xA765, 0x5448, 0xA766, 0x5442, 0xA767, 0x541B, - 0xA768, 0x5429, 0xA769, 0x544A, 0xA76A, 0x5439, 0xA76B, 0x543B, - 0xA76C, 0x5438, 0xA76D, 0x542E, 0xA76E, 0x5435, 0xA76F, 0x5436, - 0xA770, 0x5420, 0xA771, 0x543C, 0xA772, 0x5440, 0xA773, 0x5431, - 0xA774, 0x542B, 0xA775, 0x541F, 0xA776, 0x542C, 0xA777, 0x56EA, - 0xA778, 0x56F0, 0xA779, 0x56E4, 0xA77A, 0x56EB, 0xA77B, 0x574A, - 0xA77C, 0x5751, 0xA77D, 0x5740, 0xA77E, 0x574D, 0xA7A1, 0x5747, - 0xA7A2, 0x574E, 0xA7A3, 0x573E, 0xA7A4, 0x5750, 0xA7A5, 0x574F, - 0xA7A6, 0x573B, 0xA7A7, 0x58EF, 0xA7A8, 0x593E, 0xA7A9, 0x599D, - 0xA7AA, 0x5992, 0xA7AB, 0x59A8, 0xA7AC, 0x599E, 0xA7AD, 0x59A3, - 0xA7AE, 0x5999, 0xA7AF, 0x5996, 0xA7B0, 0x598D, 0xA7B1, 0x59A4, - 0xA7B2, 0x5993, 0xA7B3, 0x598A, 0xA7B4, 0x59A5, 0xA7B5, 0x5B5D, - 0xA7B6, 0x5B5C, 0xA7B7, 0x5B5A, 0xA7B8, 0x5B5B, 0xA7B9, 0x5B8C, - 0xA7BA, 0x5B8B, 0xA7BB, 0x5B8F, 0xA7BC, 0x5C2C, 0xA7BD, 0x5C40, - 0xA7BE, 0x5C41, 0xA7BF, 0x5C3F, 0xA7C0, 0x5C3E, 0xA7C1, 0x5C90, - 0xA7C2, 0x5C91, 0xA7C3, 0x5C94, 0xA7C4, 0x5C8C, 0xA7C5, 0x5DEB, - 0xA7C6, 0x5E0C, 0xA7C7, 0x5E8F, 0xA7C8, 0x5E87, 0xA7C9, 0x5E8A, - 0xA7CA, 0x5EF7, 0xA7CB, 0x5F04, 0xA7CC, 0x5F1F, 0xA7CD, 0x5F64, - 0xA7CE, 0x5F62, 0xA7CF, 0x5F77, 0xA7D0, 0x5F79, 0xA7D1, 0x5FD8, - 0xA7D2, 0x5FCC, 0xA7D3, 0x5FD7, 0xA7D4, 0x5FCD, 0xA7D5, 0x5FF1, - 0xA7D6, 0x5FEB, 0xA7D7, 0x5FF8, 0xA7D8, 0x5FEA, 0xA7D9, 0x6212, - 0xA7DA, 0x6211, 0xA7DB, 0x6284, 0xA7DC, 0x6297, 0xA7DD, 0x6296, - 0xA7DE, 0x6280, 0xA7DF, 0x6276, 0xA7E0, 0x6289, 0xA7E1, 0x626D, - 0xA7E2, 0x628A, 0xA7E3, 0x627C, 0xA7E4, 0x627E, 0xA7E5, 0x6279, - 0xA7E6, 0x6273, 0xA7E7, 0x6292, 0xA7E8, 0x626F, 0xA7E9, 0x6298, - 0xA7EA, 0x626E, 0xA7EB, 0x6295, 0xA7EC, 0x6293, 0xA7ED, 0x6291, - 0xA7EE, 0x6286, 0xA7EF, 0x6539, 0xA7F0, 0x653B, 0xA7F1, 0x6538, - 0xA7F2, 0x65F1, 0xA7F3, 0x66F4, 0xA7F4, 0x675F, 0xA7F5, 0x674E, - 0xA7F6, 0x674F, 0xA7F7, 0x6750, 0xA7F8, 0x6751, 0xA7F9, 0x675C, - 0xA7FA, 0x6756, 0xA7FB, 0x675E, 0xA7FC, 0x6749, 0xA7FD, 0x6746, - 0xA7FE, 0x6760, 0xA840, 0x6753, 0xA841, 0x6757, 0xA842, 0x6B65, - 0xA843, 0x6BCF, 0xA844, 0x6C42, 0xA845, 0x6C5E, 0xA846, 0x6C99, - 0xA847, 0x6C81, 0xA848, 0x6C88, 0xA849, 0x6C89, 0xA84A, 0x6C85, - 0xA84B, 0x6C9B, 0xA84C, 0x6C6A, 0xA84D, 0x6C7A, 0xA84E, 0x6C90, - 0xA84F, 0x6C70, 0xA850, 0x6C8C, 0xA851, 0x6C68, 0xA852, 0x6C96, - 0xA853, 0x6C92, 0xA854, 0x6C7D, 0xA855, 0x6C83, 0xA856, 0x6C72, - 0xA857, 0x6C7E, 0xA858, 0x6C74, 0xA859, 0x6C86, 0xA85A, 0x6C76, - 0xA85B, 0x6C8D, 0xA85C, 0x6C94, 0xA85D, 0x6C98, 0xA85E, 0x6C82, - 0xA85F, 0x7076, 0xA860, 0x707C, 0xA861, 0x707D, 0xA862, 0x7078, - 0xA863, 0x7262, 0xA864, 0x7261, 0xA865, 0x7260, 0xA866, 0x72C4, - 0xA867, 0x72C2, 0xA868, 0x7396, 0xA869, 0x752C, 0xA86A, 0x752B, - 0xA86B, 0x7537, 0xA86C, 0x7538, 0xA86D, 0x7682, 0xA86E, 0x76EF, - 0xA86F, 0x77E3, 0xA870, 0x79C1, 0xA871, 0x79C0, 0xA872, 0x79BF, - 0xA873, 0x7A76, 0xA874, 0x7CFB, 0xA875, 0x7F55, 0xA876, 0x8096, - 0xA877, 0x8093, 0xA878, 0x809D, 0xA879, 0x8098, 0xA87A, 0x809B, - 0xA87B, 0x809A, 0xA87C, 0x80B2, 0xA87D, 0x826F, 0xA87E, 0x8292, - 0xA8A1, 0x828B, 0xA8A2, 0x828D, 0xA8A3, 0x898B, 0xA8A4, 0x89D2, - 0xA8A5, 0x8A00, 0xA8A6, 0x8C37, 0xA8A7, 0x8C46, 0xA8A8, 0x8C55, - 0xA8A9, 0x8C9D, 0xA8AA, 0x8D64, 0xA8AB, 0x8D70, 0xA8AC, 0x8DB3, - 0xA8AD, 0x8EAB, 0xA8AE, 0x8ECA, 0xA8AF, 0x8F9B, 0xA8B0, 0x8FB0, - 0xA8B1, 0x8FC2, 0xA8B2, 0x8FC6, 0xA8B3, 0x8FC5, 0xA8B4, 0x8FC4, - 0xA8B5, 0x5DE1, 0xA8B6, 0x9091, 0xA8B7, 0x90A2, 0xA8B8, 0x90AA, - 0xA8B9, 0x90A6, 0xA8BA, 0x90A3, 0xA8BB, 0x9149, 0xA8BC, 0x91C6, - 0xA8BD, 0x91CC, 0xA8BE, 0x9632, 0xA8BF, 0x962E, 0xA8C0, 0x9631, - 0xA8C1, 0x962A, 0xA8C2, 0x962C, 0xA8C3, 0x4E26, 0xA8C4, 0x4E56, - 0xA8C5, 0x4E73, 0xA8C6, 0x4E8B, 0xA8C7, 0x4E9B, 0xA8C8, 0x4E9E, - 0xA8C9, 0x4EAB, 0xA8CA, 0x4EAC, 0xA8CB, 0x4F6F, 0xA8CC, 0x4F9D, - 0xA8CD, 0x4F8D, 0xA8CE, 0x4F73, 0xA8CF, 0x4F7F, 0xA8D0, 0x4F6C, - 0xA8D1, 0x4F9B, 0xA8D2, 0x4F8B, 0xA8D3, 0x4F86, 0xA8D4, 0x4F83, - 0xA8D5, 0x4F70, 0xA8D6, 0x4F75, 0xA8D7, 0x4F88, 0xA8D8, 0x4F69, - 0xA8D9, 0x4F7B, 0xA8DA, 0x4F96, 0xA8DB, 0x4F7E, 0xA8DC, 0x4F8F, - 0xA8DD, 0x4F91, 0xA8DE, 0x4F7A, 0xA8DF, 0x5154, 0xA8E0, 0x5152, - 0xA8E1, 0x5155, 0xA8E2, 0x5169, 0xA8E3, 0x5177, 0xA8E4, 0x5176, - 0xA8E5, 0x5178, 0xA8E6, 0x51BD, 0xA8E7, 0x51FD, 0xA8E8, 0x523B, - 0xA8E9, 0x5238, 0xA8EA, 0x5237, 0xA8EB, 0x523A, 0xA8EC, 0x5230, - 0xA8ED, 0x522E, 0xA8EE, 0x5236, 0xA8EF, 0x5241, 0xA8F0, 0x52BE, - 0xA8F1, 0x52BB, 0xA8F2, 0x5352, 0xA8F3, 0x5354, 0xA8F4, 0x5353, - 0xA8F5, 0x5351, 0xA8F6, 0x5366, 0xA8F7, 0x5377, 0xA8F8, 0x5378, - 0xA8F9, 0x5379, 0xA8FA, 0x53D6, 0xA8FB, 0x53D4, 0xA8FC, 0x53D7, - 0xA8FD, 0x5473, 0xA8FE, 0x5475, 0xA940, 0x5496, 0xA941, 0x5478, - 0xA942, 0x5495, 0xA943, 0x5480, 0xA944, 0x547B, 0xA945, 0x5477, - 0xA946, 0x5484, 0xA947, 0x5492, 0xA948, 0x5486, 0xA949, 0x547C, - 0xA94A, 0x5490, 0xA94B, 0x5471, 0xA94C, 0x5476, 0xA94D, 0x548C, - 0xA94E, 0x549A, 0xA94F, 0x5462, 0xA950, 0x5468, 0xA951, 0x548B, - 0xA952, 0x547D, 0xA953, 0x548E, 0xA954, 0x56FA, 0xA955, 0x5783, - 0xA956, 0x5777, 0xA957, 0x576A, 0xA958, 0x5769, 0xA959, 0x5761, - 0xA95A, 0x5766, 0xA95B, 0x5764, 0xA95C, 0x577C, 0xA95D, 0x591C, - 0xA95E, 0x5949, 0xA95F, 0x5947, 0xA960, 0x5948, 0xA961, 0x5944, - 0xA962, 0x5954, 0xA963, 0x59BE, 0xA964, 0x59BB, 0xA965, 0x59D4, - 0xA966, 0x59B9, 0xA967, 0x59AE, 0xA968, 0x59D1, 0xA969, 0x59C6, - 0xA96A, 0x59D0, 0xA96B, 0x59CD, 0xA96C, 0x59CB, 0xA96D, 0x59D3, - 0xA96E, 0x59CA, 0xA96F, 0x59AF, 0xA970, 0x59B3, 0xA971, 0x59D2, - 0xA972, 0x59C5, 0xA973, 0x5B5F, 0xA974, 0x5B64, 0xA975, 0x5B63, - 0xA976, 0x5B97, 0xA977, 0x5B9A, 0xA978, 0x5B98, 0xA979, 0x5B9C, - 0xA97A, 0x5B99, 0xA97B, 0x5B9B, 0xA97C, 0x5C1A, 0xA97D, 0x5C48, - 0xA97E, 0x5C45, 0xA9A1, 0x5C46, 0xA9A2, 0x5CB7, 0xA9A3, 0x5CA1, - 0xA9A4, 0x5CB8, 0xA9A5, 0x5CA9, 0xA9A6, 0x5CAB, 0xA9A7, 0x5CB1, - 0xA9A8, 0x5CB3, 0xA9A9, 0x5E18, 0xA9AA, 0x5E1A, 0xA9AB, 0x5E16, - 0xA9AC, 0x5E15, 0xA9AD, 0x5E1B, 0xA9AE, 0x5E11, 0xA9AF, 0x5E78, - 0xA9B0, 0x5E9A, 0xA9B1, 0x5E97, 0xA9B2, 0x5E9C, 0xA9B3, 0x5E95, - 0xA9B4, 0x5E96, 0xA9B5, 0x5EF6, 0xA9B6, 0x5F26, 0xA9B7, 0x5F27, - 0xA9B8, 0x5F29, 0xA9B9, 0x5F80, 0xA9BA, 0x5F81, 0xA9BB, 0x5F7F, - 0xA9BC, 0x5F7C, 0xA9BD, 0x5FDD, 0xA9BE, 0x5FE0, 0xA9BF, 0x5FFD, - 0xA9C0, 0x5FF5, 0xA9C1, 0x5FFF, 0xA9C2, 0x600F, 0xA9C3, 0x6014, - 0xA9C4, 0x602F, 0xA9C5, 0x6035, 0xA9C6, 0x6016, 0xA9C7, 0x602A, - 0xA9C8, 0x6015, 0xA9C9, 0x6021, 0xA9CA, 0x6027, 0xA9CB, 0x6029, - 0xA9CC, 0x602B, 0xA9CD, 0x601B, 0xA9CE, 0x6216, 0xA9CF, 0x6215, - 0xA9D0, 0x623F, 0xA9D1, 0x623E, 0xA9D2, 0x6240, 0xA9D3, 0x627F, - 0xA9D4, 0x62C9, 0xA9D5, 0x62CC, 0xA9D6, 0x62C4, 0xA9D7, 0x62BF, - 0xA9D8, 0x62C2, 0xA9D9, 0x62B9, 0xA9DA, 0x62D2, 0xA9DB, 0x62DB, - 0xA9DC, 0x62AB, 0xA9DD, 0x62D3, 0xA9DE, 0x62D4, 0xA9DF, 0x62CB, - 0xA9E0, 0x62C8, 0xA9E1, 0x62A8, 0xA9E2, 0x62BD, 0xA9E3, 0x62BC, - 0xA9E4, 0x62D0, 0xA9E5, 0x62D9, 0xA9E6, 0x62C7, 0xA9E7, 0x62CD, - 0xA9E8, 0x62B5, 0xA9E9, 0x62DA, 0xA9EA, 0x62B1, 0xA9EB, 0x62D8, - 0xA9EC, 0x62D6, 0xA9ED, 0x62D7, 0xA9EE, 0x62C6, 0xA9EF, 0x62AC, - 0xA9F0, 0x62CE, 0xA9F1, 0x653E, 0xA9F2, 0x65A7, 0xA9F3, 0x65BC, - 0xA9F4, 0x65FA, 0xA9F5, 0x6614, 0xA9F6, 0x6613, 0xA9F7, 0x660C, - 0xA9F8, 0x6606, 0xA9F9, 0x6602, 0xA9FA, 0x660E, 0xA9FB, 0x6600, - 0xA9FC, 0x660F, 0xA9FD, 0x6615, 0xA9FE, 0x660A, 0xAA40, 0x6607, - 0xAA41, 0x670D, 0xAA42, 0x670B, 0xAA43, 0x676D, 0xAA44, 0x678B, - 0xAA45, 0x6795, 0xAA46, 0x6771, 0xAA47, 0x679C, 0xAA48, 0x6773, - 0xAA49, 0x6777, 0xAA4A, 0x6787, 0xAA4B, 0x679D, 0xAA4C, 0x6797, - 0xAA4D, 0x676F, 0xAA4E, 0x6770, 0xAA4F, 0x677F, 0xAA50, 0x6789, - 0xAA51, 0x677E, 0xAA52, 0x6790, 0xAA53, 0x6775, 0xAA54, 0x679A, - 0xAA55, 0x6793, 0xAA56, 0x677C, 0xAA57, 0x676A, 0xAA58, 0x6772, - 0xAA59, 0x6B23, 0xAA5A, 0x6B66, 0xAA5B, 0x6B67, 0xAA5C, 0x6B7F, - 0xAA5D, 0x6C13, 0xAA5E, 0x6C1B, 0xAA5F, 0x6CE3, 0xAA60, 0x6CE8, - 0xAA61, 0x6CF3, 0xAA62, 0x6CB1, 0xAA63, 0x6CCC, 0xAA64, 0x6CE5, - 0xAA65, 0x6CB3, 0xAA66, 0x6CBD, 0xAA67, 0x6CBE, 0xAA68, 0x6CBC, - 0xAA69, 0x6CE2, 0xAA6A, 0x6CAB, 0xAA6B, 0x6CD5, 0xAA6C, 0x6CD3, - 0xAA6D, 0x6CB8, 0xAA6E, 0x6CC4, 0xAA6F, 0x6CB9, 0xAA70, 0x6CC1, - 0xAA71, 0x6CAE, 0xAA72, 0x6CD7, 0xAA73, 0x6CC5, 0xAA74, 0x6CF1, - 0xAA75, 0x6CBF, 0xAA76, 0x6CBB, 0xAA77, 0x6CE1, 0xAA78, 0x6CDB, - 0xAA79, 0x6CCA, 0xAA7A, 0x6CAC, 0xAA7B, 0x6CEF, 0xAA7C, 0x6CDC, - 0xAA7D, 0x6CD6, 0xAA7E, 0x6CE0, 0xAAA1, 0x7095, 0xAAA2, 0x708E, - 0xAAA3, 0x7092, 0xAAA4, 0x708A, 0xAAA5, 0x7099, 0xAAA6, 0x722C, - 0xAAA7, 0x722D, 0xAAA8, 0x7238, 0xAAA9, 0x7248, 0xAAAA, 0x7267, - 0xAAAB, 0x7269, 0xAAAC, 0x72C0, 0xAAAD, 0x72CE, 0xAAAE, 0x72D9, - 0xAAAF, 0x72D7, 0xAAB0, 0x72D0, 0xAAB1, 0x73A9, 0xAAB2, 0x73A8, - 0xAAB3, 0x739F, 0xAAB4, 0x73AB, 0xAAB5, 0x73A5, 0xAAB6, 0x753D, - 0xAAB7, 0x759D, 0xAAB8, 0x7599, 0xAAB9, 0x759A, 0xAABA, 0x7684, - 0xAABB, 0x76C2, 0xAABC, 0x76F2, 0xAABD, 0x76F4, 0xAABE, 0x77E5, - 0xAABF, 0x77FD, 0xAAC0, 0x793E, 0xAAC1, 0x7940, 0xAAC2, 0x7941, - 0xAAC3, 0x79C9, 0xAAC4, 0x79C8, 0xAAC5, 0x7A7A, 0xAAC6, 0x7A79, - 0xAAC7, 0x7AFA, 0xAAC8, 0x7CFE, 0xAAC9, 0x7F54, 0xAACA, 0x7F8C, - 0xAACB, 0x7F8B, 0xAACC, 0x8005, 0xAACD, 0x80BA, 0xAACE, 0x80A5, - 0xAACF, 0x80A2, 0xAAD0, 0x80B1, 0xAAD1, 0x80A1, 0xAAD2, 0x80AB, - 0xAAD3, 0x80A9, 0xAAD4, 0x80B4, 0xAAD5, 0x80AA, 0xAAD6, 0x80AF, - 0xAAD7, 0x81E5, 0xAAD8, 0x81FE, 0xAAD9, 0x820D, 0xAADA, 0x82B3, - 0xAADB, 0x829D, 0xAADC, 0x8299, 0xAADD, 0x82AD, 0xAADE, 0x82BD, - 0xAADF, 0x829F, 0xAAE0, 0x82B9, 0xAAE1, 0x82B1, 0xAAE2, 0x82AC, - 0xAAE3, 0x82A5, 0xAAE4, 0x82AF, 0xAAE5, 0x82B8, 0xAAE6, 0x82A3, - 0xAAE7, 0x82B0, 0xAAE8, 0x82BE, 0xAAE9, 0x82B7, 0xAAEA, 0x864E, - 0xAAEB, 0x8671, 0xAAEC, 0x521D, 0xAAED, 0x8868, 0xAAEE, 0x8ECB, - 0xAAEF, 0x8FCE, 0xAAF0, 0x8FD4, 0xAAF1, 0x8FD1, 0xAAF2, 0x90B5, - 0xAAF3, 0x90B8, 0xAAF4, 0x90B1, 0xAAF5, 0x90B6, 0xAAF6, 0x91C7, - 0xAAF7, 0x91D1, 0xAAF8, 0x9577, 0xAAF9, 0x9580, 0xAAFA, 0x961C, - 0xAAFB, 0x9640, 0xAAFC, 0x963F, 0xAAFD, 0x963B, 0xAAFE, 0x9644, - 0xAB40, 0x9642, 0xAB41, 0x96B9, 0xAB42, 0x96E8, 0xAB43, 0x9752, - 0xAB44, 0x975E, 0xAB45, 0x4E9F, 0xAB46, 0x4EAD, 0xAB47, 0x4EAE, - 0xAB48, 0x4FE1, 0xAB49, 0x4FB5, 0xAB4A, 0x4FAF, 0xAB4B, 0x4FBF, - 0xAB4C, 0x4FE0, 0xAB4D, 0x4FD1, 0xAB4E, 0x4FCF, 0xAB4F, 0x4FDD, - 0xAB50, 0x4FC3, 0xAB51, 0x4FB6, 0xAB52, 0x4FD8, 0xAB53, 0x4FDF, - 0xAB54, 0x4FCA, 0xAB55, 0x4FD7, 0xAB56, 0x4FAE, 0xAB57, 0x4FD0, - 0xAB58, 0x4FC4, 0xAB59, 0x4FC2, 0xAB5A, 0x4FDA, 0xAB5B, 0x4FCE, - 0xAB5C, 0x4FDE, 0xAB5D, 0x4FB7, 0xAB5E, 0x5157, 0xAB5F, 0x5192, - 0xAB60, 0x5191, 0xAB61, 0x51A0, 0xAB62, 0x524E, 0xAB63, 0x5243, - 0xAB64, 0x524A, 0xAB65, 0x524D, 0xAB66, 0x524C, 0xAB67, 0x524B, - 0xAB68, 0x5247, 0xAB69, 0x52C7, 0xAB6A, 0x52C9, 0xAB6B, 0x52C3, - 0xAB6C, 0x52C1, 0xAB6D, 0x530D, 0xAB6E, 0x5357, 0xAB6F, 0x537B, - 0xAB70, 0x539A, 0xAB71, 0x53DB, 0xAB72, 0x54AC, 0xAB73, 0x54C0, - 0xAB74, 0x54A8, 0xAB75, 0x54CE, 0xAB76, 0x54C9, 0xAB77, 0x54B8, - 0xAB78, 0x54A6, 0xAB79, 0x54B3, 0xAB7A, 0x54C7, 0xAB7B, 0x54C2, - 0xAB7C, 0x54BD, 0xAB7D, 0x54AA, 0xAB7E, 0x54C1, 0xABA1, 0x54C4, - 0xABA2, 0x54C8, 0xABA3, 0x54AF, 0xABA4, 0x54AB, 0xABA5, 0x54B1, - 0xABA6, 0x54BB, 0xABA7, 0x54A9, 0xABA8, 0x54A7, 0xABA9, 0x54BF, - 0xABAA, 0x56FF, 0xABAB, 0x5782, 0xABAC, 0x578B, 0xABAD, 0x57A0, - 0xABAE, 0x57A3, 0xABAF, 0x57A2, 0xABB0, 0x57CE, 0xABB1, 0x57AE, - 0xABB2, 0x5793, 0xABB3, 0x5955, 0xABB4, 0x5951, 0xABB5, 0x594F, - 0xABB6, 0x594E, 0xABB7, 0x5950, 0xABB8, 0x59DC, 0xABB9, 0x59D8, - 0xABBA, 0x59FF, 0xABBB, 0x59E3, 0xABBC, 0x59E8, 0xABBD, 0x5A03, - 0xABBE, 0x59E5, 0xABBF, 0x59EA, 0xABC0, 0x59DA, 0xABC1, 0x59E6, - 0xABC2, 0x5A01, 0xABC3, 0x59FB, 0xABC4, 0x5B69, 0xABC5, 0x5BA3, - 0xABC6, 0x5BA6, 0xABC7, 0x5BA4, 0xABC8, 0x5BA2, 0xABC9, 0x5BA5, - 0xABCA, 0x5C01, 0xABCB, 0x5C4E, 0xABCC, 0x5C4F, 0xABCD, 0x5C4D, - 0xABCE, 0x5C4B, 0xABCF, 0x5CD9, 0xABD0, 0x5CD2, 0xABD1, 0x5DF7, - 0xABD2, 0x5E1D, 0xABD3, 0x5E25, 0xABD4, 0x5E1F, 0xABD5, 0x5E7D, - 0xABD6, 0x5EA0, 0xABD7, 0x5EA6, 0xABD8, 0x5EFA, 0xABD9, 0x5F08, - 0xABDA, 0x5F2D, 0xABDB, 0x5F65, 0xABDC, 0x5F88, 0xABDD, 0x5F85, - 0xABDE, 0x5F8A, 0xABDF, 0x5F8B, 0xABE0, 0x5F87, 0xABE1, 0x5F8C, - 0xABE2, 0x5F89, 0xABE3, 0x6012, 0xABE4, 0x601D, 0xABE5, 0x6020, - 0xABE6, 0x6025, 0xABE7, 0x600E, 0xABE8, 0x6028, 0xABE9, 0x604D, - 0xABEA, 0x6070, 0xABEB, 0x6068, 0xABEC, 0x6062, 0xABED, 0x6046, - 0xABEE, 0x6043, 0xABEF, 0x606C, 0xABF0, 0x606B, 0xABF1, 0x606A, - 0xABF2, 0x6064, 0xABF3, 0x6241, 0xABF4, 0x62DC, 0xABF5, 0x6316, - 0xABF6, 0x6309, 0xABF7, 0x62FC, 0xABF8, 0x62ED, 0xABF9, 0x6301, - 0xABFA, 0x62EE, 0xABFB, 0x62FD, 0xABFC, 0x6307, 0xABFD, 0x62F1, - 0xABFE, 0x62F7, 0xAC40, 0x62EF, 0xAC41, 0x62EC, 0xAC42, 0x62FE, - 0xAC43, 0x62F4, 0xAC44, 0x6311, 0xAC45, 0x6302, 0xAC46, 0x653F, - 0xAC47, 0x6545, 0xAC48, 0x65AB, 0xAC49, 0x65BD, 0xAC4A, 0x65E2, - 0xAC4B, 0x6625, 0xAC4C, 0x662D, 0xAC4D, 0x6620, 0xAC4E, 0x6627, - 0xAC4F, 0x662F, 0xAC50, 0x661F, 0xAC51, 0x6628, 0xAC52, 0x6631, - 0xAC53, 0x6624, 0xAC54, 0x66F7, 0xAC55, 0x67FF, 0xAC56, 0x67D3, - 0xAC57, 0x67F1, 0xAC58, 0x67D4, 0xAC59, 0x67D0, 0xAC5A, 0x67EC, - 0xAC5B, 0x67B6, 0xAC5C, 0x67AF, 0xAC5D, 0x67F5, 0xAC5E, 0x67E9, - 0xAC5F, 0x67EF, 0xAC60, 0x67C4, 0xAC61, 0x67D1, 0xAC62, 0x67B4, - 0xAC63, 0x67DA, 0xAC64, 0x67E5, 0xAC65, 0x67B8, 0xAC66, 0x67CF, - 0xAC67, 0x67DE, 0xAC68, 0x67F3, 0xAC69, 0x67B0, 0xAC6A, 0x67D9, - 0xAC6B, 0x67E2, 0xAC6C, 0x67DD, 0xAC6D, 0x67D2, 0xAC6E, 0x6B6A, - 0xAC6F, 0x6B83, 0xAC70, 0x6B86, 0xAC71, 0x6BB5, 0xAC72, 0x6BD2, - 0xAC73, 0x6BD7, 0xAC74, 0x6C1F, 0xAC75, 0x6CC9, 0xAC76, 0x6D0B, - 0xAC77, 0x6D32, 0xAC78, 0x6D2A, 0xAC79, 0x6D41, 0xAC7A, 0x6D25, - 0xAC7B, 0x6D0C, 0xAC7C, 0x6D31, 0xAC7D, 0x6D1E, 0xAC7E, 0x6D17, - 0xACA1, 0x6D3B, 0xACA2, 0x6D3D, 0xACA3, 0x6D3E, 0xACA4, 0x6D36, - 0xACA5, 0x6D1B, 0xACA6, 0x6CF5, 0xACA7, 0x6D39, 0xACA8, 0x6D27, - 0xACA9, 0x6D38, 0xACAA, 0x6D29, 0xACAB, 0x6D2E, 0xACAC, 0x6D35, - 0xACAD, 0x6D0E, 0xACAE, 0x6D2B, 0xACAF, 0x70AB, 0xACB0, 0x70BA, - 0xACB1, 0x70B3, 0xACB2, 0x70AC, 0xACB3, 0x70AF, 0xACB4, 0x70AD, - 0xACB5, 0x70B8, 0xACB6, 0x70AE, 0xACB7, 0x70A4, 0xACB8, 0x7230, - 0xACB9, 0x7272, 0xACBA, 0x726F, 0xACBB, 0x7274, 0xACBC, 0x72E9, - 0xACBD, 0x72E0, 0xACBE, 0x72E1, 0xACBF, 0x73B7, 0xACC0, 0x73CA, - 0xACC1, 0x73BB, 0xACC2, 0x73B2, 0xACC3, 0x73CD, 0xACC4, 0x73C0, - 0xACC5, 0x73B3, 0xACC6, 0x751A, 0xACC7, 0x752D, 0xACC8, 0x754F, - 0xACC9, 0x754C, 0xACCA, 0x754E, 0xACCB, 0x754B, 0xACCC, 0x75AB, - 0xACCD, 0x75A4, 0xACCE, 0x75A5, 0xACCF, 0x75A2, 0xACD0, 0x75A3, - 0xACD1, 0x7678, 0xACD2, 0x7686, 0xACD3, 0x7687, 0xACD4, 0x7688, - 0xACD5, 0x76C8, 0xACD6, 0x76C6, 0xACD7, 0x76C3, 0xACD8, 0x76C5, - 0xACD9, 0x7701, 0xACDA, 0x76F9, 0xACDB, 0x76F8, 0xACDC, 0x7709, - 0xACDD, 0x770B, 0xACDE, 0x76FE, 0xACDF, 0x76FC, 0xACE0, 0x7707, - 0xACE1, 0x77DC, 0xACE2, 0x7802, 0xACE3, 0x7814, 0xACE4, 0x780C, - 0xACE5, 0x780D, 0xACE6, 0x7946, 0xACE7, 0x7949, 0xACE8, 0x7948, - 0xACE9, 0x7947, 0xACEA, 0x79B9, 0xACEB, 0x79BA, 0xACEC, 0x79D1, - 0xACED, 0x79D2, 0xACEE, 0x79CB, 0xACEF, 0x7A7F, 0xACF0, 0x7A81, - 0xACF1, 0x7AFF, 0xACF2, 0x7AFD, 0xACF3, 0x7C7D, 0xACF4, 0x7D02, - 0xACF5, 0x7D05, 0xACF6, 0x7D00, 0xACF7, 0x7D09, 0xACF8, 0x7D07, - 0xACF9, 0x7D04, 0xACFA, 0x7D06, 0xACFB, 0x7F38, 0xACFC, 0x7F8E, - 0xACFD, 0x7FBF, 0xACFE, 0x8004, 0xAD40, 0x8010, 0xAD41, 0x800D, - 0xAD42, 0x8011, 0xAD43, 0x8036, 0xAD44, 0x80D6, 0xAD45, 0x80E5, - 0xAD46, 0x80DA, 0xAD47, 0x80C3, 0xAD48, 0x80C4, 0xAD49, 0x80CC, - 0xAD4A, 0x80E1, 0xAD4B, 0x80DB, 0xAD4C, 0x80CE, 0xAD4D, 0x80DE, - 0xAD4E, 0x80E4, 0xAD4F, 0x80DD, 0xAD50, 0x81F4, 0xAD51, 0x8222, - 0xAD52, 0x82E7, 0xAD53, 0x8303, 0xAD54, 0x8305, 0xAD55, 0x82E3, - 0xAD56, 0x82DB, 0xAD57, 0x82E6, 0xAD58, 0x8304, 0xAD59, 0x82E5, - 0xAD5A, 0x8302, 0xAD5B, 0x8309, 0xAD5C, 0x82D2, 0xAD5D, 0x82D7, - 0xAD5E, 0x82F1, 0xAD5F, 0x8301, 0xAD60, 0x82DC, 0xAD61, 0x82D4, - 0xAD62, 0x82D1, 0xAD63, 0x82DE, 0xAD64, 0x82D3, 0xAD65, 0x82DF, - 0xAD66, 0x82EF, 0xAD67, 0x8306, 0xAD68, 0x8650, 0xAD69, 0x8679, - 0xAD6A, 0x867B, 0xAD6B, 0x867A, 0xAD6C, 0x884D, 0xAD6D, 0x886B, - 0xAD6E, 0x8981, 0xAD6F, 0x89D4, 0xAD70, 0x8A08, 0xAD71, 0x8A02, - 0xAD72, 0x8A03, 0xAD73, 0x8C9E, 0xAD74, 0x8CA0, 0xAD75, 0x8D74, - 0xAD76, 0x8D73, 0xAD77, 0x8DB4, 0xAD78, 0x8ECD, 0xAD79, 0x8ECC, - 0xAD7A, 0x8FF0, 0xAD7B, 0x8FE6, 0xAD7C, 0x8FE2, 0xAD7D, 0x8FEA, - 0xAD7E, 0x8FE5, 0xADA1, 0x8FED, 0xADA2, 0x8FEB, 0xADA3, 0x8FE4, - 0xADA4, 0x8FE8, 0xADA5, 0x90CA, 0xADA6, 0x90CE, 0xADA7, 0x90C1, - 0xADA8, 0x90C3, 0xADA9, 0x914B, 0xADAA, 0x914A, 0xADAB, 0x91CD, - 0xADAC, 0x9582, 0xADAD, 0x9650, 0xADAE, 0x964B, 0xADAF, 0x964C, - 0xADB0, 0x964D, 0xADB1, 0x9762, 0xADB2, 0x9769, 0xADB3, 0x97CB, - 0xADB4, 0x97ED, 0xADB5, 0x97F3, 0xADB6, 0x9801, 0xADB7, 0x98A8, - 0xADB8, 0x98DB, 0xADB9, 0x98DF, 0xADBA, 0x9996, 0xADBB, 0x9999, - 0xADBC, 0x4E58, 0xADBD, 0x4EB3, 0xADBE, 0x500C, 0xADBF, 0x500D, - 0xADC0, 0x5023, 0xADC1, 0x4FEF, 0xADC2, 0x5026, 0xADC3, 0x5025, - 0xADC4, 0x4FF8, 0xADC5, 0x5029, 0xADC6, 0x5016, 0xADC7, 0x5006, - 0xADC8, 0x503C, 0xADC9, 0x501F, 0xADCA, 0x501A, 0xADCB, 0x5012, - 0xADCC, 0x5011, 0xADCD, 0x4FFA, 0xADCE, 0x5000, 0xADCF, 0x5014, - 0xADD0, 0x5028, 0xADD1, 0x4FF1, 0xADD2, 0x5021, 0xADD3, 0x500B, - 0xADD4, 0x5019, 0xADD5, 0x5018, 0xADD6, 0x4FF3, 0xADD7, 0x4FEE, - 0xADD8, 0x502D, 0xADD9, 0x502A, 0xADDA, 0x4FFE, 0xADDB, 0x502B, - 0xADDC, 0x5009, 0xADDD, 0x517C, 0xADDE, 0x51A4, 0xADDF, 0x51A5, - 0xADE0, 0x51A2, 0xADE1, 0x51CD, 0xADE2, 0x51CC, 0xADE3, 0x51C6, - 0xADE4, 0x51CB, 0xADE5, 0x5256, 0xADE6, 0x525C, 0xADE7, 0x5254, - 0xADE8, 0x525B, 0xADE9, 0x525D, 0xADEA, 0x532A, 0xADEB, 0x537F, - 0xADEC, 0x539F, 0xADED, 0x539D, 0xADEE, 0x53DF, 0xADEF, 0x54E8, - 0xADF0, 0x5510, 0xADF1, 0x5501, 0xADF2, 0x5537, 0xADF3, 0x54FC, - 0xADF4, 0x54E5, 0xADF5, 0x54F2, 0xADF6, 0x5506, 0xADF7, 0x54FA, - 0xADF8, 0x5514, 0xADF9, 0x54E9, 0xADFA, 0x54ED, 0xADFB, 0x54E1, - 0xADFC, 0x5509, 0xADFD, 0x54EE, 0xADFE, 0x54EA, 0xAE40, 0x54E6, - 0xAE41, 0x5527, 0xAE42, 0x5507, 0xAE43, 0x54FD, 0xAE44, 0x550F, - 0xAE45, 0x5703, 0xAE46, 0x5704, 0xAE47, 0x57C2, 0xAE48, 0x57D4, - 0xAE49, 0x57CB, 0xAE4A, 0x57C3, 0xAE4B, 0x5809, 0xAE4C, 0x590F, - 0xAE4D, 0x5957, 0xAE4E, 0x5958, 0xAE4F, 0x595A, 0xAE50, 0x5A11, - 0xAE51, 0x5A18, 0xAE52, 0x5A1C, 0xAE53, 0x5A1F, 0xAE54, 0x5A1B, - 0xAE55, 0x5A13, 0xAE56, 0x59EC, 0xAE57, 0x5A20, 0xAE58, 0x5A23, - 0xAE59, 0x5A29, 0xAE5A, 0x5A25, 0xAE5B, 0x5A0C, 0xAE5C, 0x5A09, - 0xAE5D, 0x5B6B, 0xAE5E, 0x5C58, 0xAE5F, 0x5BB0, 0xAE60, 0x5BB3, - 0xAE61, 0x5BB6, 0xAE62, 0x5BB4, 0xAE63, 0x5BAE, 0xAE64, 0x5BB5, - 0xAE65, 0x5BB9, 0xAE66, 0x5BB8, 0xAE67, 0x5C04, 0xAE68, 0x5C51, - 0xAE69, 0x5C55, 0xAE6A, 0x5C50, 0xAE6B, 0x5CED, 0xAE6C, 0x5CFD, - 0xAE6D, 0x5CFB, 0xAE6E, 0x5CEA, 0xAE6F, 0x5CE8, 0xAE70, 0x5CF0, - 0xAE71, 0x5CF6, 0xAE72, 0x5D01, 0xAE73, 0x5CF4, 0xAE74, 0x5DEE, - 0xAE75, 0x5E2D, 0xAE76, 0x5E2B, 0xAE77, 0x5EAB, 0xAE78, 0x5EAD, - 0xAE79, 0x5EA7, 0xAE7A, 0x5F31, 0xAE7B, 0x5F92, 0xAE7C, 0x5F91, - 0xAE7D, 0x5F90, 0xAE7E, 0x6059, 0xAEA1, 0x6063, 0xAEA2, 0x6065, - 0xAEA3, 0x6050, 0xAEA4, 0x6055, 0xAEA5, 0x606D, 0xAEA6, 0x6069, - 0xAEA7, 0x606F, 0xAEA8, 0x6084, 0xAEA9, 0x609F, 0xAEAA, 0x609A, - 0xAEAB, 0x608D, 0xAEAC, 0x6094, 0xAEAD, 0x608C, 0xAEAE, 0x6085, - 0xAEAF, 0x6096, 0xAEB0, 0x6247, 0xAEB1, 0x62F3, 0xAEB2, 0x6308, - 0xAEB3, 0x62FF, 0xAEB4, 0x634E, 0xAEB5, 0x633E, 0xAEB6, 0x632F, - 0xAEB7, 0x6355, 0xAEB8, 0x6342, 0xAEB9, 0x6346, 0xAEBA, 0x634F, - 0xAEBB, 0x6349, 0xAEBC, 0x633A, 0xAEBD, 0x6350, 0xAEBE, 0x633D, - 0xAEBF, 0x632A, 0xAEC0, 0x632B, 0xAEC1, 0x6328, 0xAEC2, 0x634D, - 0xAEC3, 0x634C, 0xAEC4, 0x6548, 0xAEC5, 0x6549, 0xAEC6, 0x6599, - 0xAEC7, 0x65C1, 0xAEC8, 0x65C5, 0xAEC9, 0x6642, 0xAECA, 0x6649, - 0xAECB, 0x664F, 0xAECC, 0x6643, 0xAECD, 0x6652, 0xAECE, 0x664C, - 0xAECF, 0x6645, 0xAED0, 0x6641, 0xAED1, 0x66F8, 0xAED2, 0x6714, - 0xAED3, 0x6715, 0xAED4, 0x6717, 0xAED5, 0x6821, 0xAED6, 0x6838, - 0xAED7, 0x6848, 0xAED8, 0x6846, 0xAED9, 0x6853, 0xAEDA, 0x6839, - 0xAEDB, 0x6842, 0xAEDC, 0x6854, 0xAEDD, 0x6829, 0xAEDE, 0x68B3, - 0xAEDF, 0x6817, 0xAEE0, 0x684C, 0xAEE1, 0x6851, 0xAEE2, 0x683D, - 0xAEE3, 0x67F4, 0xAEE4, 0x6850, 0xAEE5, 0x6840, 0xAEE6, 0x683C, - 0xAEE7, 0x6843, 0xAEE8, 0x682A, 0xAEE9, 0x6845, 0xAEEA, 0x6813, - 0xAEEB, 0x6818, 0xAEEC, 0x6841, 0xAEED, 0x6B8A, 0xAEEE, 0x6B89, - 0xAEEF, 0x6BB7, 0xAEF0, 0x6C23, 0xAEF1, 0x6C27, 0xAEF2, 0x6C28, - 0xAEF3, 0x6C26, 0xAEF4, 0x6C24, 0xAEF5, 0x6CF0, 0xAEF6, 0x6D6A, - 0xAEF7, 0x6D95, 0xAEF8, 0x6D88, 0xAEF9, 0x6D87, 0xAEFA, 0x6D66, - 0xAEFB, 0x6D78, 0xAEFC, 0x6D77, 0xAEFD, 0x6D59, 0xAEFE, 0x6D93, - 0xAF40, 0x6D6C, 0xAF41, 0x6D89, 0xAF42, 0x6D6E, 0xAF43, 0x6D5A, - 0xAF44, 0x6D74, 0xAF45, 0x6D69, 0xAF46, 0x6D8C, 0xAF47, 0x6D8A, - 0xAF48, 0x6D79, 0xAF49, 0x6D85, 0xAF4A, 0x6D65, 0xAF4B, 0x6D94, - 0xAF4C, 0x70CA, 0xAF4D, 0x70D8, 0xAF4E, 0x70E4, 0xAF4F, 0x70D9, - 0xAF50, 0x70C8, 0xAF51, 0x70CF, 0xAF52, 0x7239, 0xAF53, 0x7279, - 0xAF54, 0x72FC, 0xAF55, 0x72F9, 0xAF56, 0x72FD, 0xAF57, 0x72F8, - 0xAF58, 0x72F7, 0xAF59, 0x7386, 0xAF5A, 0x73ED, 0xAF5B, 0x7409, - 0xAF5C, 0x73EE, 0xAF5D, 0x73E0, 0xAF5E, 0x73EA, 0xAF5F, 0x73DE, - 0xAF60, 0x7554, 0xAF61, 0x755D, 0xAF62, 0x755C, 0xAF63, 0x755A, - 0xAF64, 0x7559, 0xAF65, 0x75BE, 0xAF66, 0x75C5, 0xAF67, 0x75C7, - 0xAF68, 0x75B2, 0xAF69, 0x75B3, 0xAF6A, 0x75BD, 0xAF6B, 0x75BC, - 0xAF6C, 0x75B9, 0xAF6D, 0x75C2, 0xAF6E, 0x75B8, 0xAF6F, 0x768B, - 0xAF70, 0x76B0, 0xAF71, 0x76CA, 0xAF72, 0x76CD, 0xAF73, 0x76CE, - 0xAF74, 0x7729, 0xAF75, 0x771F, 0xAF76, 0x7720, 0xAF77, 0x7728, - 0xAF78, 0x77E9, 0xAF79, 0x7830, 0xAF7A, 0x7827, 0xAF7B, 0x7838, - 0xAF7C, 0x781D, 0xAF7D, 0x7834, 0xAF7E, 0x7837, 0xAFA1, 0x7825, - 0xAFA2, 0x782D, 0xAFA3, 0x7820, 0xAFA4, 0x781F, 0xAFA5, 0x7832, - 0xAFA6, 0x7955, 0xAFA7, 0x7950, 0xAFA8, 0x7960, 0xAFA9, 0x795F, - 0xAFAA, 0x7956, 0xAFAB, 0x795E, 0xAFAC, 0x795D, 0xAFAD, 0x7957, - 0xAFAE, 0x795A, 0xAFAF, 0x79E4, 0xAFB0, 0x79E3, 0xAFB1, 0x79E7, - 0xAFB2, 0x79DF, 0xAFB3, 0x79E6, 0xAFB4, 0x79E9, 0xAFB5, 0x79D8, - 0xAFB6, 0x7A84, 0xAFB7, 0x7A88, 0xAFB8, 0x7AD9, 0xAFB9, 0x7B06, - 0xAFBA, 0x7B11, 0xAFBB, 0x7C89, 0xAFBC, 0x7D21, 0xAFBD, 0x7D17, - 0xAFBE, 0x7D0B, 0xAFBF, 0x7D0A, 0xAFC0, 0x7D20, 0xAFC1, 0x7D22, - 0xAFC2, 0x7D14, 0xAFC3, 0x7D10, 0xAFC4, 0x7D15, 0xAFC5, 0x7D1A, - 0xAFC6, 0x7D1C, 0xAFC7, 0x7D0D, 0xAFC8, 0x7D19, 0xAFC9, 0x7D1B, - 0xAFCA, 0x7F3A, 0xAFCB, 0x7F5F, 0xAFCC, 0x7F94, 0xAFCD, 0x7FC5, - 0xAFCE, 0x7FC1, 0xAFCF, 0x8006, 0xAFD0, 0x8018, 0xAFD1, 0x8015, - 0xAFD2, 0x8019, 0xAFD3, 0x8017, 0xAFD4, 0x803D, 0xAFD5, 0x803F, - 0xAFD6, 0x80F1, 0xAFD7, 0x8102, 0xAFD8, 0x80F0, 0xAFD9, 0x8105, - 0xAFDA, 0x80ED, 0xAFDB, 0x80F4, 0xAFDC, 0x8106, 0xAFDD, 0x80F8, - 0xAFDE, 0x80F3, 0xAFDF, 0x8108, 0xAFE0, 0x80FD, 0xAFE1, 0x810A, - 0xAFE2, 0x80FC, 0xAFE3, 0x80EF, 0xAFE4, 0x81ED, 0xAFE5, 0x81EC, - 0xAFE6, 0x8200, 0xAFE7, 0x8210, 0xAFE8, 0x822A, 0xAFE9, 0x822B, - 0xAFEA, 0x8228, 0xAFEB, 0x822C, 0xAFEC, 0x82BB, 0xAFED, 0x832B, - 0xAFEE, 0x8352, 0xAFEF, 0x8354, 0xAFF0, 0x834A, 0xAFF1, 0x8338, - 0xAFF2, 0x8350, 0xAFF3, 0x8349, 0xAFF4, 0x8335, 0xAFF5, 0x8334, - 0xAFF6, 0x834F, 0xAFF7, 0x8332, 0xAFF8, 0x8339, 0xAFF9, 0x8336, - 0xAFFA, 0x8317, 0xAFFB, 0x8340, 0xAFFC, 0x8331, 0xAFFD, 0x8328, - 0xAFFE, 0x8343, 0xB040, 0x8654, 0xB041, 0x868A, 0xB042, 0x86AA, - 0xB043, 0x8693, 0xB044, 0x86A4, 0xB045, 0x86A9, 0xB046, 0x868C, - 0xB047, 0x86A3, 0xB048, 0x869C, 0xB049, 0x8870, 0xB04A, 0x8877, - 0xB04B, 0x8881, 0xB04C, 0x8882, 0xB04D, 0x887D, 0xB04E, 0x8879, - 0xB04F, 0x8A18, 0xB050, 0x8A10, 0xB051, 0x8A0E, 0xB052, 0x8A0C, - 0xB053, 0x8A15, 0xB054, 0x8A0A, 0xB055, 0x8A17, 0xB056, 0x8A13, - 0xB057, 0x8A16, 0xB058, 0x8A0F, 0xB059, 0x8A11, 0xB05A, 0x8C48, - 0xB05B, 0x8C7A, 0xB05C, 0x8C79, 0xB05D, 0x8CA1, 0xB05E, 0x8CA2, - 0xB05F, 0x8D77, 0xB060, 0x8EAC, 0xB061, 0x8ED2, 0xB062, 0x8ED4, - 0xB063, 0x8ECF, 0xB064, 0x8FB1, 0xB065, 0x9001, 0xB066, 0x9006, - 0xB067, 0x8FF7, 0xB068, 0x9000, 0xB069, 0x8FFA, 0xB06A, 0x8FF4, - 0xB06B, 0x9003, 0xB06C, 0x8FFD, 0xB06D, 0x9005, 0xB06E, 0x8FF8, - 0xB06F, 0x9095, 0xB070, 0x90E1, 0xB071, 0x90DD, 0xB072, 0x90E2, - 0xB073, 0x9152, 0xB074, 0x914D, 0xB075, 0x914C, 0xB076, 0x91D8, - 0xB077, 0x91DD, 0xB078, 0x91D7, 0xB079, 0x91DC, 0xB07A, 0x91D9, - 0xB07B, 0x9583, 0xB07C, 0x9662, 0xB07D, 0x9663, 0xB07E, 0x9661, - 0xB0A1, 0x965B, 0xB0A2, 0x965D, 0xB0A3, 0x9664, 0xB0A4, 0x9658, - 0xB0A5, 0x965E, 0xB0A6, 0x96BB, 0xB0A7, 0x98E2, 0xB0A8, 0x99AC, - 0xB0A9, 0x9AA8, 0xB0AA, 0x9AD8, 0xB0AB, 0x9B25, 0xB0AC, 0x9B32, - 0xB0AD, 0x9B3C, 0xB0AE, 0x4E7E, 0xB0AF, 0x507A, 0xB0B0, 0x507D, - 0xB0B1, 0x505C, 0xB0B2, 0x5047, 0xB0B3, 0x5043, 0xB0B4, 0x504C, - 0xB0B5, 0x505A, 0xB0B6, 0x5049, 0xB0B7, 0x5065, 0xB0B8, 0x5076, - 0xB0B9, 0x504E, 0xB0BA, 0x5055, 0xB0BB, 0x5075, 0xB0BC, 0x5074, - 0xB0BD, 0x5077, 0xB0BE, 0x504F, 0xB0BF, 0x500F, 0xB0C0, 0x506F, - 0xB0C1, 0x506D, 0xB0C2, 0x515C, 0xB0C3, 0x5195, 0xB0C4, 0x51F0, - 0xB0C5, 0x526A, 0xB0C6, 0x526F, 0xB0C7, 0x52D2, 0xB0C8, 0x52D9, - 0xB0C9, 0x52D8, 0xB0CA, 0x52D5, 0xB0CB, 0x5310, 0xB0CC, 0x530F, - 0xB0CD, 0x5319, 0xB0CE, 0x533F, 0xB0CF, 0x5340, 0xB0D0, 0x533E, - 0xB0D1, 0x53C3, 0xB0D2, 0x66FC, 0xB0D3, 0x5546, 0xB0D4, 0x556A, - 0xB0D5, 0x5566, 0xB0D6, 0x5544, 0xB0D7, 0x555E, 0xB0D8, 0x5561, - 0xB0D9, 0x5543, 0xB0DA, 0x554A, 0xB0DB, 0x5531, 0xB0DC, 0x5556, - 0xB0DD, 0x554F, 0xB0DE, 0x5555, 0xB0DF, 0x552F, 0xB0E0, 0x5564, - 0xB0E1, 0x5538, 0xB0E2, 0x552E, 0xB0E3, 0x555C, 0xB0E4, 0x552C, - 0xB0E5, 0x5563, 0xB0E6, 0x5533, 0xB0E7, 0x5541, 0xB0E8, 0x5557, - 0xB0E9, 0x5708, 0xB0EA, 0x570B, 0xB0EB, 0x5709, 0xB0EC, 0x57DF, - 0xB0ED, 0x5805, 0xB0EE, 0x580A, 0xB0EF, 0x5806, 0xB0F0, 0x57E0, - 0xB0F1, 0x57E4, 0xB0F2, 0x57FA, 0xB0F3, 0x5802, 0xB0F4, 0x5835, - 0xB0F5, 0x57F7, 0xB0F6, 0x57F9, 0xB0F7, 0x5920, 0xB0F8, 0x5962, - 0xB0F9, 0x5A36, 0xB0FA, 0x5A41, 0xB0FB, 0x5A49, 0xB0FC, 0x5A66, - 0xB0FD, 0x5A6A, 0xB0FE, 0x5A40, 0xB140, 0x5A3C, 0xB141, 0x5A62, - 0xB142, 0x5A5A, 0xB143, 0x5A46, 0xB144, 0x5A4A, 0xB145, 0x5B70, - 0xB146, 0x5BC7, 0xB147, 0x5BC5, 0xB148, 0x5BC4, 0xB149, 0x5BC2, - 0xB14A, 0x5BBF, 0xB14B, 0x5BC6, 0xB14C, 0x5C09, 0xB14D, 0x5C08, - 0xB14E, 0x5C07, 0xB14F, 0x5C60, 0xB150, 0x5C5C, 0xB151, 0x5C5D, - 0xB152, 0x5D07, 0xB153, 0x5D06, 0xB154, 0x5D0E, 0xB155, 0x5D1B, - 0xB156, 0x5D16, 0xB157, 0x5D22, 0xB158, 0x5D11, 0xB159, 0x5D29, - 0xB15A, 0x5D14, 0xB15B, 0x5D19, 0xB15C, 0x5D24, 0xB15D, 0x5D27, - 0xB15E, 0x5D17, 0xB15F, 0x5DE2, 0xB160, 0x5E38, 0xB161, 0x5E36, - 0xB162, 0x5E33, 0xB163, 0x5E37, 0xB164, 0x5EB7, 0xB165, 0x5EB8, - 0xB166, 0x5EB6, 0xB167, 0x5EB5, 0xB168, 0x5EBE, 0xB169, 0x5F35, - 0xB16A, 0x5F37, 0xB16B, 0x5F57, 0xB16C, 0x5F6C, 0xB16D, 0x5F69, - 0xB16E, 0x5F6B, 0xB16F, 0x5F97, 0xB170, 0x5F99, 0xB171, 0x5F9E, - 0xB172, 0x5F98, 0xB173, 0x5FA1, 0xB174, 0x5FA0, 0xB175, 0x5F9C, - 0xB176, 0x607F, 0xB177, 0x60A3, 0xB178, 0x6089, 0xB179, 0x60A0, - 0xB17A, 0x60A8, 0xB17B, 0x60CB, 0xB17C, 0x60B4, 0xB17D, 0x60E6, - 0xB17E, 0x60BD, 0xB1A1, 0x60C5, 0xB1A2, 0x60BB, 0xB1A3, 0x60B5, - 0xB1A4, 0x60DC, 0xB1A5, 0x60BC, 0xB1A6, 0x60D8, 0xB1A7, 0x60D5, - 0xB1A8, 0x60C6, 0xB1A9, 0x60DF, 0xB1AA, 0x60B8, 0xB1AB, 0x60DA, - 0xB1AC, 0x60C7, 0xB1AD, 0x621A, 0xB1AE, 0x621B, 0xB1AF, 0x6248, - 0xB1B0, 0x63A0, 0xB1B1, 0x63A7, 0xB1B2, 0x6372, 0xB1B3, 0x6396, - 0xB1B4, 0x63A2, 0xB1B5, 0x63A5, 0xB1B6, 0x6377, 0xB1B7, 0x6367, - 0xB1B8, 0x6398, 0xB1B9, 0x63AA, 0xB1BA, 0x6371, 0xB1BB, 0x63A9, - 0xB1BC, 0x6389, 0xB1BD, 0x6383, 0xB1BE, 0x639B, 0xB1BF, 0x636B, - 0xB1C0, 0x63A8, 0xB1C1, 0x6384, 0xB1C2, 0x6388, 0xB1C3, 0x6399, - 0xB1C4, 0x63A1, 0xB1C5, 0x63AC, 0xB1C6, 0x6392, 0xB1C7, 0x638F, - 0xB1C8, 0x6380, 0xB1C9, 0x637B, 0xB1CA, 0x6369, 0xB1CB, 0x6368, - 0xB1CC, 0x637A, 0xB1CD, 0x655D, 0xB1CE, 0x6556, 0xB1CF, 0x6551, - 0xB1D0, 0x6559, 0xB1D1, 0x6557, 0xB1D2, 0x555F, 0xB1D3, 0x654F, - 0xB1D4, 0x6558, 0xB1D5, 0x6555, 0xB1D6, 0x6554, 0xB1D7, 0x659C, - 0xB1D8, 0x659B, 0xB1D9, 0x65AC, 0xB1DA, 0x65CF, 0xB1DB, 0x65CB, - 0xB1DC, 0x65CC, 0xB1DD, 0x65CE, 0xB1DE, 0x665D, 0xB1DF, 0x665A, - 0xB1E0, 0x6664, 0xB1E1, 0x6668, 0xB1E2, 0x6666, 0xB1E3, 0x665E, - 0xB1E4, 0x66F9, 0xB1E5, 0x52D7, 0xB1E6, 0x671B, 0xB1E7, 0x6881, - 0xB1E8, 0x68AF, 0xB1E9, 0x68A2, 0xB1EA, 0x6893, 0xB1EB, 0x68B5, - 0xB1EC, 0x687F, 0xB1ED, 0x6876, 0xB1EE, 0x68B1, 0xB1EF, 0x68A7, - 0xB1F0, 0x6897, 0xB1F1, 0x68B0, 0xB1F2, 0x6883, 0xB1F3, 0x68C4, - 0xB1F4, 0x68AD, 0xB1F5, 0x6886, 0xB1F6, 0x6885, 0xB1F7, 0x6894, - 0xB1F8, 0x689D, 0xB1F9, 0x68A8, 0xB1FA, 0x689F, 0xB1FB, 0x68A1, - 0xB1FC, 0x6882, 0xB1FD, 0x6B32, 0xB1FE, 0x6BBA, 0xB240, 0x6BEB, - 0xB241, 0x6BEC, 0xB242, 0x6C2B, 0xB243, 0x6D8E, 0xB244, 0x6DBC, - 0xB245, 0x6DF3, 0xB246, 0x6DD9, 0xB247, 0x6DB2, 0xB248, 0x6DE1, - 0xB249, 0x6DCC, 0xB24A, 0x6DE4, 0xB24B, 0x6DFB, 0xB24C, 0x6DFA, - 0xB24D, 0x6E05, 0xB24E, 0x6DC7, 0xB24F, 0x6DCB, 0xB250, 0x6DAF, - 0xB251, 0x6DD1, 0xB252, 0x6DAE, 0xB253, 0x6DDE, 0xB254, 0x6DF9, - 0xB255, 0x6DB8, 0xB256, 0x6DF7, 0xB257, 0x6DF5, 0xB258, 0x6DC5, - 0xB259, 0x6DD2, 0xB25A, 0x6E1A, 0xB25B, 0x6DB5, 0xB25C, 0x6DDA, - 0xB25D, 0x6DEB, 0xB25E, 0x6DD8, 0xB25F, 0x6DEA, 0xB260, 0x6DF1, - 0xB261, 0x6DEE, 0xB262, 0x6DE8, 0xB263, 0x6DC6, 0xB264, 0x6DC4, - 0xB265, 0x6DAA, 0xB266, 0x6DEC, 0xB267, 0x6DBF, 0xB268, 0x6DE6, - 0xB269, 0x70F9, 0xB26A, 0x7109, 0xB26B, 0x710A, 0xB26C, 0x70FD, - 0xB26D, 0x70EF, 0xB26E, 0x723D, 0xB26F, 0x727D, 0xB270, 0x7281, - 0xB271, 0x731C, 0xB272, 0x731B, 0xB273, 0x7316, 0xB274, 0x7313, - 0xB275, 0x7319, 0xB276, 0x7387, 0xB277, 0x7405, 0xB278, 0x740A, - 0xB279, 0x7403, 0xB27A, 0x7406, 0xB27B, 0x73FE, 0xB27C, 0x740D, - 0xB27D, 0x74E0, 0xB27E, 0x74F6, 0xB2A1, 0x74F7, 0xB2A2, 0x751C, - 0xB2A3, 0x7522, 0xB2A4, 0x7565, 0xB2A5, 0x7566, 0xB2A6, 0x7562, - 0xB2A7, 0x7570, 0xB2A8, 0x758F, 0xB2A9, 0x75D4, 0xB2AA, 0x75D5, - 0xB2AB, 0x75B5, 0xB2AC, 0x75CA, 0xB2AD, 0x75CD, 0xB2AE, 0x768E, - 0xB2AF, 0x76D4, 0xB2B0, 0x76D2, 0xB2B1, 0x76DB, 0xB2B2, 0x7737, - 0xB2B3, 0x773E, 0xB2B4, 0x773C, 0xB2B5, 0x7736, 0xB2B6, 0x7738, - 0xB2B7, 0x773A, 0xB2B8, 0x786B, 0xB2B9, 0x7843, 0xB2BA, 0x784E, - 0xB2BB, 0x7965, 0xB2BC, 0x7968, 0xB2BD, 0x796D, 0xB2BE, 0x79FB, - 0xB2BF, 0x7A92, 0xB2C0, 0x7A95, 0xB2C1, 0x7B20, 0xB2C2, 0x7B28, - 0xB2C3, 0x7B1B, 0xB2C4, 0x7B2C, 0xB2C5, 0x7B26, 0xB2C6, 0x7B19, - 0xB2C7, 0x7B1E, 0xB2C8, 0x7B2E, 0xB2C9, 0x7C92, 0xB2CA, 0x7C97, - 0xB2CB, 0x7C95, 0xB2CC, 0x7D46, 0xB2CD, 0x7D43, 0xB2CE, 0x7D71, - 0xB2CF, 0x7D2E, 0xB2D0, 0x7D39, 0xB2D1, 0x7D3C, 0xB2D2, 0x7D40, - 0xB2D3, 0x7D30, 0xB2D4, 0x7D33, 0xB2D5, 0x7D44, 0xB2D6, 0x7D2F, - 0xB2D7, 0x7D42, 0xB2D8, 0x7D32, 0xB2D9, 0x7D31, 0xB2DA, 0x7F3D, - 0xB2DB, 0x7F9E, 0xB2DC, 0x7F9A, 0xB2DD, 0x7FCC, 0xB2DE, 0x7FCE, - 0xB2DF, 0x7FD2, 0xB2E0, 0x801C, 0xB2E1, 0x804A, 0xB2E2, 0x8046, - 0xB2E3, 0x812F, 0xB2E4, 0x8116, 0xB2E5, 0x8123, 0xB2E6, 0x812B, - 0xB2E7, 0x8129, 0xB2E8, 0x8130, 0xB2E9, 0x8124, 0xB2EA, 0x8202, - 0xB2EB, 0x8235, 0xB2EC, 0x8237, 0xB2ED, 0x8236, 0xB2EE, 0x8239, - 0xB2EF, 0x838E, 0xB2F0, 0x839E, 0xB2F1, 0x8398, 0xB2F2, 0x8378, - 0xB2F3, 0x83A2, 0xB2F4, 0x8396, 0xB2F5, 0x83BD, 0xB2F6, 0x83AB, - 0xB2F7, 0x8392, 0xB2F8, 0x838A, 0xB2F9, 0x8393, 0xB2FA, 0x8389, - 0xB2FB, 0x83A0, 0xB2FC, 0x8377, 0xB2FD, 0x837B, 0xB2FE, 0x837C, - 0xB340, 0x8386, 0xB341, 0x83A7, 0xB342, 0x8655, 0xB343, 0x5F6A, - 0xB344, 0x86C7, 0xB345, 0x86C0, 0xB346, 0x86B6, 0xB347, 0x86C4, - 0xB348, 0x86B5, 0xB349, 0x86C6, 0xB34A, 0x86CB, 0xB34B, 0x86B1, - 0xB34C, 0x86AF, 0xB34D, 0x86C9, 0xB34E, 0x8853, 0xB34F, 0x889E, - 0xB350, 0x8888, 0xB351, 0x88AB, 0xB352, 0x8892, 0xB353, 0x8896, - 0xB354, 0x888D, 0xB355, 0x888B, 0xB356, 0x8993, 0xB357, 0x898F, - 0xB358, 0x8A2A, 0xB359, 0x8A1D, 0xB35A, 0x8A23, 0xB35B, 0x8A25, - 0xB35C, 0x8A31, 0xB35D, 0x8A2D, 0xB35E, 0x8A1F, 0xB35F, 0x8A1B, - 0xB360, 0x8A22, 0xB361, 0x8C49, 0xB362, 0x8C5A, 0xB363, 0x8CA9, - 0xB364, 0x8CAC, 0xB365, 0x8CAB, 0xB366, 0x8CA8, 0xB367, 0x8CAA, - 0xB368, 0x8CA7, 0xB369, 0x8D67, 0xB36A, 0x8D66, 0xB36B, 0x8DBE, - 0xB36C, 0x8DBA, 0xB36D, 0x8EDB, 0xB36E, 0x8EDF, 0xB36F, 0x9019, - 0xB370, 0x900D, 0xB371, 0x901A, 0xB372, 0x9017, 0xB373, 0x9023, - 0xB374, 0x901F, 0xB375, 0x901D, 0xB376, 0x9010, 0xB377, 0x9015, - 0xB378, 0x901E, 0xB379, 0x9020, 0xB37A, 0x900F, 0xB37B, 0x9022, - 0xB37C, 0x9016, 0xB37D, 0x901B, 0xB37E, 0x9014, 0xB3A1, 0x90E8, - 0xB3A2, 0x90ED, 0xB3A3, 0x90FD, 0xB3A4, 0x9157, 0xB3A5, 0x91CE, - 0xB3A6, 0x91F5, 0xB3A7, 0x91E6, 0xB3A8, 0x91E3, 0xB3A9, 0x91E7, - 0xB3AA, 0x91ED, 0xB3AB, 0x91E9, 0xB3AC, 0x9589, 0xB3AD, 0x966A, - 0xB3AE, 0x9675, 0xB3AF, 0x9673, 0xB3B0, 0x9678, 0xB3B1, 0x9670, - 0xB3B2, 0x9674, 0xB3B3, 0x9676, 0xB3B4, 0x9677, 0xB3B5, 0x966C, - 0xB3B6, 0x96C0, 0xB3B7, 0x96EA, 0xB3B8, 0x96E9, 0xB3B9, 0x7AE0, - 0xB3BA, 0x7ADF, 0xB3BB, 0x9802, 0xB3BC, 0x9803, 0xB3BD, 0x9B5A, - 0xB3BE, 0x9CE5, 0xB3BF, 0x9E75, 0xB3C0, 0x9E7F, 0xB3C1, 0x9EA5, - 0xB3C2, 0x9EBB, 0xB3C3, 0x50A2, 0xB3C4, 0x508D, 0xB3C5, 0x5085, - 0xB3C6, 0x5099, 0xB3C7, 0x5091, 0xB3C8, 0x5080, 0xB3C9, 0x5096, - 0xB3CA, 0x5098, 0xB3CB, 0x509A, 0xB3CC, 0x6700, 0xB3CD, 0x51F1, - 0xB3CE, 0x5272, 0xB3CF, 0x5274, 0xB3D0, 0x5275, 0xB3D1, 0x5269, - 0xB3D2, 0x52DE, 0xB3D3, 0x52DD, 0xB3D4, 0x52DB, 0xB3D5, 0x535A, - 0xB3D6, 0x53A5, 0xB3D7, 0x557B, 0xB3D8, 0x5580, 0xB3D9, 0x55A7, - 0xB3DA, 0x557C, 0xB3DB, 0x558A, 0xB3DC, 0x559D, 0xB3DD, 0x5598, - 0xB3DE, 0x5582, 0xB3DF, 0x559C, 0xB3E0, 0x55AA, 0xB3E1, 0x5594, - 0xB3E2, 0x5587, 0xB3E3, 0x558B, 0xB3E4, 0x5583, 0xB3E5, 0x55B3, - 0xB3E6, 0x55AE, 0xB3E7, 0x559F, 0xB3E8, 0x553E, 0xB3E9, 0x55B2, - 0xB3EA, 0x559A, 0xB3EB, 0x55BB, 0xB3EC, 0x55AC, 0xB3ED, 0x55B1, - 0xB3EE, 0x557E, 0xB3EF, 0x5589, 0xB3F0, 0x55AB, 0xB3F1, 0x5599, - 0xB3F2, 0x570D, 0xB3F3, 0x582F, 0xB3F4, 0x582A, 0xB3F5, 0x5834, - 0xB3F6, 0x5824, 0xB3F7, 0x5830, 0xB3F8, 0x5831, 0xB3F9, 0x5821, - 0xB3FA, 0x581D, 0xB3FB, 0x5820, 0xB3FC, 0x58F9, 0xB3FD, 0x58FA, - 0xB3FE, 0x5960, 0xB440, 0x5A77, 0xB441, 0x5A9A, 0xB442, 0x5A7F, - 0xB443, 0x5A92, 0xB444, 0x5A9B, 0xB445, 0x5AA7, 0xB446, 0x5B73, - 0xB447, 0x5B71, 0xB448, 0x5BD2, 0xB449, 0x5BCC, 0xB44A, 0x5BD3, - 0xB44B, 0x5BD0, 0xB44C, 0x5C0A, 0xB44D, 0x5C0B, 0xB44E, 0x5C31, - 0xB44F, 0x5D4C, 0xB450, 0x5D50, 0xB451, 0x5D34, 0xB452, 0x5D47, - 0xB453, 0x5DFD, 0xB454, 0x5E45, 0xB455, 0x5E3D, 0xB456, 0x5E40, - 0xB457, 0x5E43, 0xB458, 0x5E7E, 0xB459, 0x5ECA, 0xB45A, 0x5EC1, - 0xB45B, 0x5EC2, 0xB45C, 0x5EC4, 0xB45D, 0x5F3C, 0xB45E, 0x5F6D, - 0xB45F, 0x5FA9, 0xB460, 0x5FAA, 0xB461, 0x5FA8, 0xB462, 0x60D1, - 0xB463, 0x60E1, 0xB464, 0x60B2, 0xB465, 0x60B6, 0xB466, 0x60E0, - 0xB467, 0x611C, 0xB468, 0x6123, 0xB469, 0x60FA, 0xB46A, 0x6115, - 0xB46B, 0x60F0, 0xB46C, 0x60FB, 0xB46D, 0x60F4, 0xB46E, 0x6168, - 0xB46F, 0x60F1, 0xB470, 0x610E, 0xB471, 0x60F6, 0xB472, 0x6109, - 0xB473, 0x6100, 0xB474, 0x6112, 0xB475, 0x621F, 0xB476, 0x6249, - 0xB477, 0x63A3, 0xB478, 0x638C, 0xB479, 0x63CF, 0xB47A, 0x63C0, - 0xB47B, 0x63E9, 0xB47C, 0x63C9, 0xB47D, 0x63C6, 0xB47E, 0x63CD, - 0xB4A1, 0x63D2, 0xB4A2, 0x63E3, 0xB4A3, 0x63D0, 0xB4A4, 0x63E1, - 0xB4A5, 0x63D6, 0xB4A6, 0x63ED, 0xB4A7, 0x63EE, 0xB4A8, 0x6376, - 0xB4A9, 0x63F4, 0xB4AA, 0x63EA, 0xB4AB, 0x63DB, 0xB4AC, 0x6452, - 0xB4AD, 0x63DA, 0xB4AE, 0x63F9, 0xB4AF, 0x655E, 0xB4B0, 0x6566, - 0xB4B1, 0x6562, 0xB4B2, 0x6563, 0xB4B3, 0x6591, 0xB4B4, 0x6590, - 0xB4B5, 0x65AF, 0xB4B6, 0x666E, 0xB4B7, 0x6670, 0xB4B8, 0x6674, - 0xB4B9, 0x6676, 0xB4BA, 0x666F, 0xB4BB, 0x6691, 0xB4BC, 0x667A, - 0xB4BD, 0x667E, 0xB4BE, 0x6677, 0xB4BF, 0x66FE, 0xB4C0, 0x66FF, - 0xB4C1, 0x671F, 0xB4C2, 0x671D, 0xB4C3, 0x68FA, 0xB4C4, 0x68D5, - 0xB4C5, 0x68E0, 0xB4C6, 0x68D8, 0xB4C7, 0x68D7, 0xB4C8, 0x6905, - 0xB4C9, 0x68DF, 0xB4CA, 0x68F5, 0xB4CB, 0x68EE, 0xB4CC, 0x68E7, - 0xB4CD, 0x68F9, 0xB4CE, 0x68D2, 0xB4CF, 0x68F2, 0xB4D0, 0x68E3, - 0xB4D1, 0x68CB, 0xB4D2, 0x68CD, 0xB4D3, 0x690D, 0xB4D4, 0x6912, - 0xB4D5, 0x690E, 0xB4D6, 0x68C9, 0xB4D7, 0x68DA, 0xB4D8, 0x696E, - 0xB4D9, 0x68FB, 0xB4DA, 0x6B3E, 0xB4DB, 0x6B3A, 0xB4DC, 0x6B3D, - 0xB4DD, 0x6B98, 0xB4DE, 0x6B96, 0xB4DF, 0x6BBC, 0xB4E0, 0x6BEF, - 0xB4E1, 0x6C2E, 0xB4E2, 0x6C2F, 0xB4E3, 0x6C2C, 0xB4E4, 0x6E2F, - 0xB4E5, 0x6E38, 0xB4E6, 0x6E54, 0xB4E7, 0x6E21, 0xB4E8, 0x6E32, - 0xB4E9, 0x6E67, 0xB4EA, 0x6E4A, 0xB4EB, 0x6E20, 0xB4EC, 0x6E25, - 0xB4ED, 0x6E23, 0xB4EE, 0x6E1B, 0xB4EF, 0x6E5B, 0xB4F0, 0x6E58, - 0xB4F1, 0x6E24, 0xB4F2, 0x6E56, 0xB4F3, 0x6E6E, 0xB4F4, 0x6E2D, - 0xB4F5, 0x6E26, 0xB4F6, 0x6E6F, 0xB4F7, 0x6E34, 0xB4F8, 0x6E4D, - 0xB4F9, 0x6E3A, 0xB4FA, 0x6E2C, 0xB4FB, 0x6E43, 0xB4FC, 0x6E1D, - 0xB4FD, 0x6E3E, 0xB4FE, 0x6ECB, 0xB540, 0x6E89, 0xB541, 0x6E19, - 0xB542, 0x6E4E, 0xB543, 0x6E63, 0xB544, 0x6E44, 0xB545, 0x6E72, - 0xB546, 0x6E69, 0xB547, 0x6E5F, 0xB548, 0x7119, 0xB549, 0x711A, - 0xB54A, 0x7126, 0xB54B, 0x7130, 0xB54C, 0x7121, 0xB54D, 0x7136, - 0xB54E, 0x716E, 0xB54F, 0x711C, 0xB550, 0x724C, 0xB551, 0x7284, - 0xB552, 0x7280, 0xB553, 0x7336, 0xB554, 0x7325, 0xB555, 0x7334, - 0xB556, 0x7329, 0xB557, 0x743A, 0xB558, 0x742A, 0xB559, 0x7433, - 0xB55A, 0x7422, 0xB55B, 0x7425, 0xB55C, 0x7435, 0xB55D, 0x7436, - 0xB55E, 0x7434, 0xB55F, 0x742F, 0xB560, 0x741B, 0xB561, 0x7426, - 0xB562, 0x7428, 0xB563, 0x7525, 0xB564, 0x7526, 0xB565, 0x756B, - 0xB566, 0x756A, 0xB567, 0x75E2, 0xB568, 0x75DB, 0xB569, 0x75E3, - 0xB56A, 0x75D9, 0xB56B, 0x75D8, 0xB56C, 0x75DE, 0xB56D, 0x75E0, - 0xB56E, 0x767B, 0xB56F, 0x767C, 0xB570, 0x7696, 0xB571, 0x7693, - 0xB572, 0x76B4, 0xB573, 0x76DC, 0xB574, 0x774F, 0xB575, 0x77ED, - 0xB576, 0x785D, 0xB577, 0x786C, 0xB578, 0x786F, 0xB579, 0x7A0D, - 0xB57A, 0x7A08, 0xB57B, 0x7A0B, 0xB57C, 0x7A05, 0xB57D, 0x7A00, - 0xB57E, 0x7A98, 0xB5A1, 0x7A97, 0xB5A2, 0x7A96, 0xB5A3, 0x7AE5, - 0xB5A4, 0x7AE3, 0xB5A5, 0x7B49, 0xB5A6, 0x7B56, 0xB5A7, 0x7B46, - 0xB5A8, 0x7B50, 0xB5A9, 0x7B52, 0xB5AA, 0x7B54, 0xB5AB, 0x7B4D, - 0xB5AC, 0x7B4B, 0xB5AD, 0x7B4F, 0xB5AE, 0x7B51, 0xB5AF, 0x7C9F, - 0xB5B0, 0x7CA5, 0xB5B1, 0x7D5E, 0xB5B2, 0x7D50, 0xB5B3, 0x7D68, - 0xB5B4, 0x7D55, 0xB5B5, 0x7D2B, 0xB5B6, 0x7D6E, 0xB5B7, 0x7D72, - 0xB5B8, 0x7D61, 0xB5B9, 0x7D66, 0xB5BA, 0x7D62, 0xB5BB, 0x7D70, - 0xB5BC, 0x7D73, 0xB5BD, 0x5584, 0xB5BE, 0x7FD4, 0xB5BF, 0x7FD5, - 0xB5C0, 0x800B, 0xB5C1, 0x8052, 0xB5C2, 0x8085, 0xB5C3, 0x8155, - 0xB5C4, 0x8154, 0xB5C5, 0x814B, 0xB5C6, 0x8151, 0xB5C7, 0x814E, - 0xB5C8, 0x8139, 0xB5C9, 0x8146, 0xB5CA, 0x813E, 0xB5CB, 0x814C, - 0xB5CC, 0x8153, 0xB5CD, 0x8174, 0xB5CE, 0x8212, 0xB5CF, 0x821C, - 0xB5D0, 0x83E9, 0xB5D1, 0x8403, 0xB5D2, 0x83F8, 0xB5D3, 0x840D, - 0xB5D4, 0x83E0, 0xB5D5, 0x83C5, 0xB5D6, 0x840B, 0xB5D7, 0x83C1, - 0xB5D8, 0x83EF, 0xB5D9, 0x83F1, 0xB5DA, 0x83F4, 0xB5DB, 0x8457, - 0xB5DC, 0x840A, 0xB5DD, 0x83F0, 0xB5DE, 0x840C, 0xB5DF, 0x83CC, - 0xB5E0, 0x83FD, 0xB5E1, 0x83F2, 0xB5E2, 0x83CA, 0xB5E3, 0x8438, - 0xB5E4, 0x840E, 0xB5E5, 0x8404, 0xB5E6, 0x83DC, 0xB5E7, 0x8407, - 0xB5E8, 0x83D4, 0xB5E9, 0x83DF, 0xB5EA, 0x865B, 0xB5EB, 0x86DF, - 0xB5EC, 0x86D9, 0xB5ED, 0x86ED, 0xB5EE, 0x86D4, 0xB5EF, 0x86DB, - 0xB5F0, 0x86E4, 0xB5F1, 0x86D0, 0xB5F2, 0x86DE, 0xB5F3, 0x8857, - 0xB5F4, 0x88C1, 0xB5F5, 0x88C2, 0xB5F6, 0x88B1, 0xB5F7, 0x8983, - 0xB5F8, 0x8996, 0xB5F9, 0x8A3B, 0xB5FA, 0x8A60, 0xB5FB, 0x8A55, - 0xB5FC, 0x8A5E, 0xB5FD, 0x8A3C, 0xB5FE, 0x8A41, 0xB640, 0x8A54, - 0xB641, 0x8A5B, 0xB642, 0x8A50, 0xB643, 0x8A46, 0xB644, 0x8A34, - 0xB645, 0x8A3A, 0xB646, 0x8A36, 0xB647, 0x8A56, 0xB648, 0x8C61, - 0xB649, 0x8C82, 0xB64A, 0x8CAF, 0xB64B, 0x8CBC, 0xB64C, 0x8CB3, - 0xB64D, 0x8CBD, 0xB64E, 0x8CC1, 0xB64F, 0x8CBB, 0xB650, 0x8CC0, - 0xB651, 0x8CB4, 0xB652, 0x8CB7, 0xB653, 0x8CB6, 0xB654, 0x8CBF, - 0xB655, 0x8CB8, 0xB656, 0x8D8A, 0xB657, 0x8D85, 0xB658, 0x8D81, - 0xB659, 0x8DCE, 0xB65A, 0x8DDD, 0xB65B, 0x8DCB, 0xB65C, 0x8DDA, - 0xB65D, 0x8DD1, 0xB65E, 0x8DCC, 0xB65F, 0x8DDB, 0xB660, 0x8DC6, - 0xB661, 0x8EFB, 0xB662, 0x8EF8, 0xB663, 0x8EFC, 0xB664, 0x8F9C, - 0xB665, 0x902E, 0xB666, 0x9035, 0xB667, 0x9031, 0xB668, 0x9038, - 0xB669, 0x9032, 0xB66A, 0x9036, 0xB66B, 0x9102, 0xB66C, 0x90F5, - 0xB66D, 0x9109, 0xB66E, 0x90FE, 0xB66F, 0x9163, 0xB670, 0x9165, - 0xB671, 0x91CF, 0xB672, 0x9214, 0xB673, 0x9215, 0xB674, 0x9223, - 0xB675, 0x9209, 0xB676, 0x921E, 0xB677, 0x920D, 0xB678, 0x9210, - 0xB679, 0x9207, 0xB67A, 0x9211, 0xB67B, 0x9594, 0xB67C, 0x958F, - 0xB67D, 0x958B, 0xB67E, 0x9591, 0xB6A1, 0x9593, 0xB6A2, 0x9592, - 0xB6A3, 0x958E, 0xB6A4, 0x968A, 0xB6A5, 0x968E, 0xB6A6, 0x968B, - 0xB6A7, 0x967D, 0xB6A8, 0x9685, 0xB6A9, 0x9686, 0xB6AA, 0x968D, - 0xB6AB, 0x9672, 0xB6AC, 0x9684, 0xB6AD, 0x96C1, 0xB6AE, 0x96C5, - 0xB6AF, 0x96C4, 0xB6B0, 0x96C6, 0xB6B1, 0x96C7, 0xB6B2, 0x96EF, - 0xB6B3, 0x96F2, 0xB6B4, 0x97CC, 0xB6B5, 0x9805, 0xB6B6, 0x9806, - 0xB6B7, 0x9808, 0xB6B8, 0x98E7, 0xB6B9, 0x98EA, 0xB6BA, 0x98EF, - 0xB6BB, 0x98E9, 0xB6BC, 0x98F2, 0xB6BD, 0x98ED, 0xB6BE, 0x99AE, - 0xB6BF, 0x99AD, 0xB6C0, 0x9EC3, 0xB6C1, 0x9ECD, 0xB6C2, 0x9ED1, - 0xB6C3, 0x4E82, 0xB6C4, 0x50AD, 0xB6C5, 0x50B5, 0xB6C6, 0x50B2, - 0xB6C7, 0x50B3, 0xB6C8, 0x50C5, 0xB6C9, 0x50BE, 0xB6CA, 0x50AC, - 0xB6CB, 0x50B7, 0xB6CC, 0x50BB, 0xB6CD, 0x50AF, 0xB6CE, 0x50C7, - 0xB6CF, 0x527F, 0xB6D0, 0x5277, 0xB6D1, 0x527D, 0xB6D2, 0x52DF, - 0xB6D3, 0x52E6, 0xB6D4, 0x52E4, 0xB6D5, 0x52E2, 0xB6D6, 0x52E3, - 0xB6D7, 0x532F, 0xB6D8, 0x55DF, 0xB6D9, 0x55E8, 0xB6DA, 0x55D3, - 0xB6DB, 0x55E6, 0xB6DC, 0x55CE, 0xB6DD, 0x55DC, 0xB6DE, 0x55C7, - 0xB6DF, 0x55D1, 0xB6E0, 0x55E3, 0xB6E1, 0x55E4, 0xB6E2, 0x55EF, - 0xB6E3, 0x55DA, 0xB6E4, 0x55E1, 0xB6E5, 0x55C5, 0xB6E6, 0x55C6, - 0xB6E7, 0x55E5, 0xB6E8, 0x55C9, 0xB6E9, 0x5712, 0xB6EA, 0x5713, - 0xB6EB, 0x585E, 0xB6EC, 0x5851, 0xB6ED, 0x5858, 0xB6EE, 0x5857, - 0xB6EF, 0x585A, 0xB6F0, 0x5854, 0xB6F1, 0x586B, 0xB6F2, 0x584C, - 0xB6F3, 0x586D, 0xB6F4, 0x584A, 0xB6F5, 0x5862, 0xB6F6, 0x5852, - 0xB6F7, 0x584B, 0xB6F8, 0x5967, 0xB6F9, 0x5AC1, 0xB6FA, 0x5AC9, - 0xB6FB, 0x5ACC, 0xB6FC, 0x5ABE, 0xB6FD, 0x5ABD, 0xB6FE, 0x5ABC, - 0xB740, 0x5AB3, 0xB741, 0x5AC2, 0xB742, 0x5AB2, 0xB743, 0x5D69, - 0xB744, 0x5D6F, 0xB745, 0x5E4C, 0xB746, 0x5E79, 0xB747, 0x5EC9, - 0xB748, 0x5EC8, 0xB749, 0x5F12, 0xB74A, 0x5F59, 0xB74B, 0x5FAC, - 0xB74C, 0x5FAE, 0xB74D, 0x611A, 0xB74E, 0x610F, 0xB74F, 0x6148, - 0xB750, 0x611F, 0xB751, 0x60F3, 0xB752, 0x611B, 0xB753, 0x60F9, - 0xB754, 0x6101, 0xB755, 0x6108, 0xB756, 0x614E, 0xB757, 0x614C, - 0xB758, 0x6144, 0xB759, 0x614D, 0xB75A, 0x613E, 0xB75B, 0x6134, - 0xB75C, 0x6127, 0xB75D, 0x610D, 0xB75E, 0x6106, 0xB75F, 0x6137, - 0xB760, 0x6221, 0xB761, 0x6222, 0xB762, 0x6413, 0xB763, 0x643E, - 0xB764, 0x641E, 0xB765, 0x642A, 0xB766, 0x642D, 0xB767, 0x643D, - 0xB768, 0x642C, 0xB769, 0x640F, 0xB76A, 0x641C, 0xB76B, 0x6414, - 0xB76C, 0x640D, 0xB76D, 0x6436, 0xB76E, 0x6416, 0xB76F, 0x6417, - 0xB770, 0x6406, 0xB771, 0x656C, 0xB772, 0x659F, 0xB773, 0x65B0, - 0xB774, 0x6697, 0xB775, 0x6689, 0xB776, 0x6687, 0xB777, 0x6688, - 0xB778, 0x6696, 0xB779, 0x6684, 0xB77A, 0x6698, 0xB77B, 0x668D, - 0xB77C, 0x6703, 0xB77D, 0x6994, 0xB77E, 0x696D, 0xB7A1, 0x695A, - 0xB7A2, 0x6977, 0xB7A3, 0x6960, 0xB7A4, 0x6954, 0xB7A5, 0x6975, - 0xB7A6, 0x6930, 0xB7A7, 0x6982, 0xB7A8, 0x694A, 0xB7A9, 0x6968, - 0xB7AA, 0x696B, 0xB7AB, 0x695E, 0xB7AC, 0x6953, 0xB7AD, 0x6979, - 0xB7AE, 0x6986, 0xB7AF, 0x695D, 0xB7B0, 0x6963, 0xB7B1, 0x695B, - 0xB7B2, 0x6B47, 0xB7B3, 0x6B72, 0xB7B4, 0x6BC0, 0xB7B5, 0x6BBF, - 0xB7B6, 0x6BD3, 0xB7B7, 0x6BFD, 0xB7B8, 0x6EA2, 0xB7B9, 0x6EAF, - 0xB7BA, 0x6ED3, 0xB7BB, 0x6EB6, 0xB7BC, 0x6EC2, 0xB7BD, 0x6E90, - 0xB7BE, 0x6E9D, 0xB7BF, 0x6EC7, 0xB7C0, 0x6EC5, 0xB7C1, 0x6EA5, - 0xB7C2, 0x6E98, 0xB7C3, 0x6EBC, 0xB7C4, 0x6EBA, 0xB7C5, 0x6EAB, - 0xB7C6, 0x6ED1, 0xB7C7, 0x6E96, 0xB7C8, 0x6E9C, 0xB7C9, 0x6EC4, - 0xB7CA, 0x6ED4, 0xB7CB, 0x6EAA, 0xB7CC, 0x6EA7, 0xB7CD, 0x6EB4, - 0xB7CE, 0x714E, 0xB7CF, 0x7159, 0xB7D0, 0x7169, 0xB7D1, 0x7164, - 0xB7D2, 0x7149, 0xB7D3, 0x7167, 0xB7D4, 0x715C, 0xB7D5, 0x716C, - 0xB7D6, 0x7166, 0xB7D7, 0x714C, 0xB7D8, 0x7165, 0xB7D9, 0x715E, - 0xB7DA, 0x7146, 0xB7DB, 0x7168, 0xB7DC, 0x7156, 0xB7DD, 0x723A, - 0xB7DE, 0x7252, 0xB7DF, 0x7337, 0xB7E0, 0x7345, 0xB7E1, 0x733F, - 0xB7E2, 0x733E, 0xB7E3, 0x746F, 0xB7E4, 0x745A, 0xB7E5, 0x7455, - 0xB7E6, 0x745F, 0xB7E7, 0x745E, 0xB7E8, 0x7441, 0xB7E9, 0x743F, - 0xB7EA, 0x7459, 0xB7EB, 0x745B, 0xB7EC, 0x745C, 0xB7ED, 0x7576, - 0xB7EE, 0x7578, 0xB7EF, 0x7600, 0xB7F0, 0x75F0, 0xB7F1, 0x7601, - 0xB7F2, 0x75F2, 0xB7F3, 0x75F1, 0xB7F4, 0x75FA, 0xB7F5, 0x75FF, - 0xB7F6, 0x75F4, 0xB7F7, 0x75F3, 0xB7F8, 0x76DE, 0xB7F9, 0x76DF, - 0xB7FA, 0x775B, 0xB7FB, 0x776B, 0xB7FC, 0x7766, 0xB7FD, 0x775E, - 0xB7FE, 0x7763, 0xB840, 0x7779, 0xB841, 0x776A, 0xB842, 0x776C, - 0xB843, 0x775C, 0xB844, 0x7765, 0xB845, 0x7768, 0xB846, 0x7762, - 0xB847, 0x77EE, 0xB848, 0x788E, 0xB849, 0x78B0, 0xB84A, 0x7897, - 0xB84B, 0x7898, 0xB84C, 0x788C, 0xB84D, 0x7889, 0xB84E, 0x787C, - 0xB84F, 0x7891, 0xB850, 0x7893, 0xB851, 0x787F, 0xB852, 0x797A, - 0xB853, 0x797F, 0xB854, 0x7981, 0xB855, 0x842C, 0xB856, 0x79BD, - 0xB857, 0x7A1C, 0xB858, 0x7A1A, 0xB859, 0x7A20, 0xB85A, 0x7A14, - 0xB85B, 0x7A1F, 0xB85C, 0x7A1E, 0xB85D, 0x7A9F, 0xB85E, 0x7AA0, - 0xB85F, 0x7B77, 0xB860, 0x7BC0, 0xB861, 0x7B60, 0xB862, 0x7B6E, - 0xB863, 0x7B67, 0xB864, 0x7CB1, 0xB865, 0x7CB3, 0xB866, 0x7CB5, - 0xB867, 0x7D93, 0xB868, 0x7D79, 0xB869, 0x7D91, 0xB86A, 0x7D81, - 0xB86B, 0x7D8F, 0xB86C, 0x7D5B, 0xB86D, 0x7F6E, 0xB86E, 0x7F69, - 0xB86F, 0x7F6A, 0xB870, 0x7F72, 0xB871, 0x7FA9, 0xB872, 0x7FA8, - 0xB873, 0x7FA4, 0xB874, 0x8056, 0xB875, 0x8058, 0xB876, 0x8086, - 0xB877, 0x8084, 0xB878, 0x8171, 0xB879, 0x8170, 0xB87A, 0x8178, - 0xB87B, 0x8165, 0xB87C, 0x816E, 0xB87D, 0x8173, 0xB87E, 0x816B, - 0xB8A1, 0x8179, 0xB8A2, 0x817A, 0xB8A3, 0x8166, 0xB8A4, 0x8205, - 0xB8A5, 0x8247, 0xB8A6, 0x8482, 0xB8A7, 0x8477, 0xB8A8, 0x843D, - 0xB8A9, 0x8431, 0xB8AA, 0x8475, 0xB8AB, 0x8466, 0xB8AC, 0x846B, - 0xB8AD, 0x8449, 0xB8AE, 0x846C, 0xB8AF, 0x845B, 0xB8B0, 0x843C, - 0xB8B1, 0x8435, 0xB8B2, 0x8461, 0xB8B3, 0x8463, 0xB8B4, 0x8469, - 0xB8B5, 0x846D, 0xB8B6, 0x8446, 0xB8B7, 0x865E, 0xB8B8, 0x865C, - 0xB8B9, 0x865F, 0xB8BA, 0x86F9, 0xB8BB, 0x8713, 0xB8BC, 0x8708, - 0xB8BD, 0x8707, 0xB8BE, 0x8700, 0xB8BF, 0x86FE, 0xB8C0, 0x86FB, - 0xB8C1, 0x8702, 0xB8C2, 0x8703, 0xB8C3, 0x8706, 0xB8C4, 0x870A, - 0xB8C5, 0x8859, 0xB8C6, 0x88DF, 0xB8C7, 0x88D4, 0xB8C8, 0x88D9, - 0xB8C9, 0x88DC, 0xB8CA, 0x88D8, 0xB8CB, 0x88DD, 0xB8CC, 0x88E1, - 0xB8CD, 0x88CA, 0xB8CE, 0x88D5, 0xB8CF, 0x88D2, 0xB8D0, 0x899C, - 0xB8D1, 0x89E3, 0xB8D2, 0x8A6B, 0xB8D3, 0x8A72, 0xB8D4, 0x8A73, - 0xB8D5, 0x8A66, 0xB8D6, 0x8A69, 0xB8D7, 0x8A70, 0xB8D8, 0x8A87, - 0xB8D9, 0x8A7C, 0xB8DA, 0x8A63, 0xB8DB, 0x8AA0, 0xB8DC, 0x8A71, - 0xB8DD, 0x8A85, 0xB8DE, 0x8A6D, 0xB8DF, 0x8A62, 0xB8E0, 0x8A6E, - 0xB8E1, 0x8A6C, 0xB8E2, 0x8A79, 0xB8E3, 0x8A7B, 0xB8E4, 0x8A3E, - 0xB8E5, 0x8A68, 0xB8E6, 0x8C62, 0xB8E7, 0x8C8A, 0xB8E8, 0x8C89, - 0xB8E9, 0x8CCA, 0xB8EA, 0x8CC7, 0xB8EB, 0x8CC8, 0xB8EC, 0x8CC4, - 0xB8ED, 0x8CB2, 0xB8EE, 0x8CC3, 0xB8EF, 0x8CC2, 0xB8F0, 0x8CC5, - 0xB8F1, 0x8DE1, 0xB8F2, 0x8DDF, 0xB8F3, 0x8DE8, 0xB8F4, 0x8DEF, - 0xB8F5, 0x8DF3, 0xB8F6, 0x8DFA, 0xB8F7, 0x8DEA, 0xB8F8, 0x8DE4, - 0xB8F9, 0x8DE6, 0xB8FA, 0x8EB2, 0xB8FB, 0x8F03, 0xB8FC, 0x8F09, - 0xB8FD, 0x8EFE, 0xB8FE, 0x8F0A, 0xB940, 0x8F9F, 0xB941, 0x8FB2, - 0xB942, 0x904B, 0xB943, 0x904A, 0xB944, 0x9053, 0xB945, 0x9042, - 0xB946, 0x9054, 0xB947, 0x903C, 0xB948, 0x9055, 0xB949, 0x9050, - 0xB94A, 0x9047, 0xB94B, 0x904F, 0xB94C, 0x904E, 0xB94D, 0x904D, - 0xB94E, 0x9051, 0xB94F, 0x903E, 0xB950, 0x9041, 0xB951, 0x9112, - 0xB952, 0x9117, 0xB953, 0x916C, 0xB954, 0x916A, 0xB955, 0x9169, - 0xB956, 0x91C9, 0xB957, 0x9237, 0xB958, 0x9257, 0xB959, 0x9238, - 0xB95A, 0x923D, 0xB95B, 0x9240, 0xB95C, 0x923E, 0xB95D, 0x925B, - 0xB95E, 0x924B, 0xB95F, 0x9264, 0xB960, 0x9251, 0xB961, 0x9234, - 0xB962, 0x9249, 0xB963, 0x924D, 0xB964, 0x9245, 0xB965, 0x9239, - 0xB966, 0x923F, 0xB967, 0x925A, 0xB968, 0x9598, 0xB969, 0x9698, - 0xB96A, 0x9694, 0xB96B, 0x9695, 0xB96C, 0x96CD, 0xB96D, 0x96CB, - 0xB96E, 0x96C9, 0xB96F, 0x96CA, 0xB970, 0x96F7, 0xB971, 0x96FB, - 0xB972, 0x96F9, 0xB973, 0x96F6, 0xB974, 0x9756, 0xB975, 0x9774, - 0xB976, 0x9776, 0xB977, 0x9810, 0xB978, 0x9811, 0xB979, 0x9813, - 0xB97A, 0x980A, 0xB97B, 0x9812, 0xB97C, 0x980C, 0xB97D, 0x98FC, - 0xB97E, 0x98F4, 0xB9A1, 0x98FD, 0xB9A2, 0x98FE, 0xB9A3, 0x99B3, - 0xB9A4, 0x99B1, 0xB9A5, 0x99B4, 0xB9A6, 0x9AE1, 0xB9A7, 0x9CE9, - 0xB9A8, 0x9E82, 0xB9A9, 0x9F0E, 0xB9AA, 0x9F13, 0xB9AB, 0x9F20, - 0xB9AC, 0x50E7, 0xB9AD, 0x50EE, 0xB9AE, 0x50E5, 0xB9AF, 0x50D6, - 0xB9B0, 0x50ED, 0xB9B1, 0x50DA, 0xB9B2, 0x50D5, 0xB9B3, 0x50CF, - 0xB9B4, 0x50D1, 0xB9B5, 0x50F1, 0xB9B6, 0x50CE, 0xB9B7, 0x50E9, - 0xB9B8, 0x5162, 0xB9B9, 0x51F3, 0xB9BA, 0x5283, 0xB9BB, 0x5282, - 0xB9BC, 0x5331, 0xB9BD, 0x53AD, 0xB9BE, 0x55FE, 0xB9BF, 0x5600, - 0xB9C0, 0x561B, 0xB9C1, 0x5617, 0xB9C2, 0x55FD, 0xB9C3, 0x5614, - 0xB9C4, 0x5606, 0xB9C5, 0x5609, 0xB9C6, 0x560D, 0xB9C7, 0x560E, - 0xB9C8, 0x55F7, 0xB9C9, 0x5616, 0xB9CA, 0x561F, 0xB9CB, 0x5608, - 0xB9CC, 0x5610, 0xB9CD, 0x55F6, 0xB9CE, 0x5718, 0xB9CF, 0x5716, - 0xB9D0, 0x5875, 0xB9D1, 0x587E, 0xB9D2, 0x5883, 0xB9D3, 0x5893, - 0xB9D4, 0x588A, 0xB9D5, 0x5879, 0xB9D6, 0x5885, 0xB9D7, 0x587D, - 0xB9D8, 0x58FD, 0xB9D9, 0x5925, 0xB9DA, 0x5922, 0xB9DB, 0x5924, - 0xB9DC, 0x596A, 0xB9DD, 0x5969, 0xB9DE, 0x5AE1, 0xB9DF, 0x5AE6, - 0xB9E0, 0x5AE9, 0xB9E1, 0x5AD7, 0xB9E2, 0x5AD6, 0xB9E3, 0x5AD8, - 0xB9E4, 0x5AE3, 0xB9E5, 0x5B75, 0xB9E6, 0x5BDE, 0xB9E7, 0x5BE7, - 0xB9E8, 0x5BE1, 0xB9E9, 0x5BE5, 0xB9EA, 0x5BE6, 0xB9EB, 0x5BE8, - 0xB9EC, 0x5BE2, 0xB9ED, 0x5BE4, 0xB9EE, 0x5BDF, 0xB9EF, 0x5C0D, - 0xB9F0, 0x5C62, 0xB9F1, 0x5D84, 0xB9F2, 0x5D87, 0xB9F3, 0x5E5B, - 0xB9F4, 0x5E63, 0xB9F5, 0x5E55, 0xB9F6, 0x5E57, 0xB9F7, 0x5E54, - 0xB9F8, 0x5ED3, 0xB9F9, 0x5ED6, 0xB9FA, 0x5F0A, 0xB9FB, 0x5F46, - 0xB9FC, 0x5F70, 0xB9FD, 0x5FB9, 0xB9FE, 0x6147, 0xBA40, 0x613F, - 0xBA41, 0x614B, 0xBA42, 0x6177, 0xBA43, 0x6162, 0xBA44, 0x6163, - 0xBA45, 0x615F, 0xBA46, 0x615A, 0xBA47, 0x6158, 0xBA48, 0x6175, - 0xBA49, 0x622A, 0xBA4A, 0x6487, 0xBA4B, 0x6458, 0xBA4C, 0x6454, - 0xBA4D, 0x64A4, 0xBA4E, 0x6478, 0xBA4F, 0x645F, 0xBA50, 0x647A, - 0xBA51, 0x6451, 0xBA52, 0x6467, 0xBA53, 0x6434, 0xBA54, 0x646D, - 0xBA55, 0x647B, 0xBA56, 0x6572, 0xBA57, 0x65A1, 0xBA58, 0x65D7, - 0xBA59, 0x65D6, 0xBA5A, 0x66A2, 0xBA5B, 0x66A8, 0xBA5C, 0x669D, - 0xBA5D, 0x699C, 0xBA5E, 0x69A8, 0xBA5F, 0x6995, 0xBA60, 0x69C1, - 0xBA61, 0x69AE, 0xBA62, 0x69D3, 0xBA63, 0x69CB, 0xBA64, 0x699B, - 0xBA65, 0x69B7, 0xBA66, 0x69BB, 0xBA67, 0x69AB, 0xBA68, 0x69B4, - 0xBA69, 0x69D0, 0xBA6A, 0x69CD, 0xBA6B, 0x69AD, 0xBA6C, 0x69CC, - 0xBA6D, 0x69A6, 0xBA6E, 0x69C3, 0xBA6F, 0x69A3, 0xBA70, 0x6B49, - 0xBA71, 0x6B4C, 0xBA72, 0x6C33, 0xBA73, 0x6F33, 0xBA74, 0x6F14, - 0xBA75, 0x6EFE, 0xBA76, 0x6F13, 0xBA77, 0x6EF4, 0xBA78, 0x6F29, - 0xBA79, 0x6F3E, 0xBA7A, 0x6F20, 0xBA7B, 0x6F2C, 0xBA7C, 0x6F0F, - 0xBA7D, 0x6F02, 0xBA7E, 0x6F22, 0xBAA1, 0x6EFF, 0xBAA2, 0x6EEF, - 0xBAA3, 0x6F06, 0xBAA4, 0x6F31, 0xBAA5, 0x6F38, 0xBAA6, 0x6F32, - 0xBAA7, 0x6F23, 0xBAA8, 0x6F15, 0xBAA9, 0x6F2B, 0xBAAA, 0x6F2F, - 0xBAAB, 0x6F88, 0xBAAC, 0x6F2A, 0xBAAD, 0x6EEC, 0xBAAE, 0x6F01, - 0xBAAF, 0x6EF2, 0xBAB0, 0x6ECC, 0xBAB1, 0x6EF7, 0xBAB2, 0x7194, - 0xBAB3, 0x7199, 0xBAB4, 0x717D, 0xBAB5, 0x718A, 0xBAB6, 0x7184, - 0xBAB7, 0x7192, 0xBAB8, 0x723E, 0xBAB9, 0x7292, 0xBABA, 0x7296, - 0xBABB, 0x7344, 0xBABC, 0x7350, 0xBABD, 0x7464, 0xBABE, 0x7463, - 0xBABF, 0x746A, 0xBAC0, 0x7470, 0xBAC1, 0x746D, 0xBAC2, 0x7504, - 0xBAC3, 0x7591, 0xBAC4, 0x7627, 0xBAC5, 0x760D, 0xBAC6, 0x760B, - 0xBAC7, 0x7609, 0xBAC8, 0x7613, 0xBAC9, 0x76E1, 0xBACA, 0x76E3, - 0xBACB, 0x7784, 0xBACC, 0x777D, 0xBACD, 0x777F, 0xBACE, 0x7761, - 0xBACF, 0x78C1, 0xBAD0, 0x789F, 0xBAD1, 0x78A7, 0xBAD2, 0x78B3, - 0xBAD3, 0x78A9, 0xBAD4, 0x78A3, 0xBAD5, 0x798E, 0xBAD6, 0x798F, - 0xBAD7, 0x798D, 0xBAD8, 0x7A2E, 0xBAD9, 0x7A31, 0xBADA, 0x7AAA, - 0xBADB, 0x7AA9, 0xBADC, 0x7AED, 0xBADD, 0x7AEF, 0xBADE, 0x7BA1, - 0xBADF, 0x7B95, 0xBAE0, 0x7B8B, 0xBAE1, 0x7B75, 0xBAE2, 0x7B97, - 0xBAE3, 0x7B9D, 0xBAE4, 0x7B94, 0xBAE5, 0x7B8F, 0xBAE6, 0x7BB8, - 0xBAE7, 0x7B87, 0xBAE8, 0x7B84, 0xBAE9, 0x7CB9, 0xBAEA, 0x7CBD, - 0xBAEB, 0x7CBE, 0xBAEC, 0x7DBB, 0xBAED, 0x7DB0, 0xBAEE, 0x7D9C, - 0xBAEF, 0x7DBD, 0xBAF0, 0x7DBE, 0xBAF1, 0x7DA0, 0xBAF2, 0x7DCA, - 0xBAF3, 0x7DB4, 0xBAF4, 0x7DB2, 0xBAF5, 0x7DB1, 0xBAF6, 0x7DBA, - 0xBAF7, 0x7DA2, 0xBAF8, 0x7DBF, 0xBAF9, 0x7DB5, 0xBAFA, 0x7DB8, - 0xBAFB, 0x7DAD, 0xBAFC, 0x7DD2, 0xBAFD, 0x7DC7, 0xBAFE, 0x7DAC, - 0xBB40, 0x7F70, 0xBB41, 0x7FE0, 0xBB42, 0x7FE1, 0xBB43, 0x7FDF, - 0xBB44, 0x805E, 0xBB45, 0x805A, 0xBB46, 0x8087, 0xBB47, 0x8150, - 0xBB48, 0x8180, 0xBB49, 0x818F, 0xBB4A, 0x8188, 0xBB4B, 0x818A, - 0xBB4C, 0x817F, 0xBB4D, 0x8182, 0xBB4E, 0x81E7, 0xBB4F, 0x81FA, - 0xBB50, 0x8207, 0xBB51, 0x8214, 0xBB52, 0x821E, 0xBB53, 0x824B, - 0xBB54, 0x84C9, 0xBB55, 0x84BF, 0xBB56, 0x84C6, 0xBB57, 0x84C4, - 0xBB58, 0x8499, 0xBB59, 0x849E, 0xBB5A, 0x84B2, 0xBB5B, 0x849C, - 0xBB5C, 0x84CB, 0xBB5D, 0x84B8, 0xBB5E, 0x84C0, 0xBB5F, 0x84D3, - 0xBB60, 0x8490, 0xBB61, 0x84BC, 0xBB62, 0x84D1, 0xBB63, 0x84CA, - 0xBB64, 0x873F, 0xBB65, 0x871C, 0xBB66, 0x873B, 0xBB67, 0x8722, - 0xBB68, 0x8725, 0xBB69, 0x8734, 0xBB6A, 0x8718, 0xBB6B, 0x8755, - 0xBB6C, 0x8737, 0xBB6D, 0x8729, 0xBB6E, 0x88F3, 0xBB6F, 0x8902, - 0xBB70, 0x88F4, 0xBB71, 0x88F9, 0xBB72, 0x88F8, 0xBB73, 0x88FD, - 0xBB74, 0x88E8, 0xBB75, 0x891A, 0xBB76, 0x88EF, 0xBB77, 0x8AA6, - 0xBB78, 0x8A8C, 0xBB79, 0x8A9E, 0xBB7A, 0x8AA3, 0xBB7B, 0x8A8D, - 0xBB7C, 0x8AA1, 0xBB7D, 0x8A93, 0xBB7E, 0x8AA4, 0xBBA1, 0x8AAA, - 0xBBA2, 0x8AA5, 0xBBA3, 0x8AA8, 0xBBA4, 0x8A98, 0xBBA5, 0x8A91, - 0xBBA6, 0x8A9A, 0xBBA7, 0x8AA7, 0xBBA8, 0x8C6A, 0xBBA9, 0x8C8D, - 0xBBAA, 0x8C8C, 0xBBAB, 0x8CD3, 0xBBAC, 0x8CD1, 0xBBAD, 0x8CD2, - 0xBBAE, 0x8D6B, 0xBBAF, 0x8D99, 0xBBB0, 0x8D95, 0xBBB1, 0x8DFC, - 0xBBB2, 0x8F14, 0xBBB3, 0x8F12, 0xBBB4, 0x8F15, 0xBBB5, 0x8F13, - 0xBBB6, 0x8FA3, 0xBBB7, 0x9060, 0xBBB8, 0x9058, 0xBBB9, 0x905C, - 0xBBBA, 0x9063, 0xBBBB, 0x9059, 0xBBBC, 0x905E, 0xBBBD, 0x9062, - 0xBBBE, 0x905D, 0xBBBF, 0x905B, 0xBBC0, 0x9119, 0xBBC1, 0x9118, - 0xBBC2, 0x911E, 0xBBC3, 0x9175, 0xBBC4, 0x9178, 0xBBC5, 0x9177, - 0xBBC6, 0x9174, 0xBBC7, 0x9278, 0xBBC8, 0x9280, 0xBBC9, 0x9285, - 0xBBCA, 0x9298, 0xBBCB, 0x9296, 0xBBCC, 0x927B, 0xBBCD, 0x9293, - 0xBBCE, 0x929C, 0xBBCF, 0x92A8, 0xBBD0, 0x927C, 0xBBD1, 0x9291, - 0xBBD2, 0x95A1, 0xBBD3, 0x95A8, 0xBBD4, 0x95A9, 0xBBD5, 0x95A3, - 0xBBD6, 0x95A5, 0xBBD7, 0x95A4, 0xBBD8, 0x9699, 0xBBD9, 0x969C, - 0xBBDA, 0x969B, 0xBBDB, 0x96CC, 0xBBDC, 0x96D2, 0xBBDD, 0x9700, - 0xBBDE, 0x977C, 0xBBDF, 0x9785, 0xBBE0, 0x97F6, 0xBBE1, 0x9817, - 0xBBE2, 0x9818, 0xBBE3, 0x98AF, 0xBBE4, 0x98B1, 0xBBE5, 0x9903, - 0xBBE6, 0x9905, 0xBBE7, 0x990C, 0xBBE8, 0x9909, 0xBBE9, 0x99C1, - 0xBBEA, 0x9AAF, 0xBBEB, 0x9AB0, 0xBBEC, 0x9AE6, 0xBBED, 0x9B41, - 0xBBEE, 0x9B42, 0xBBEF, 0x9CF4, 0xBBF0, 0x9CF6, 0xBBF1, 0x9CF3, - 0xBBF2, 0x9EBC, 0xBBF3, 0x9F3B, 0xBBF4, 0x9F4A, 0xBBF5, 0x5104, - 0xBBF6, 0x5100, 0xBBF7, 0x50FB, 0xBBF8, 0x50F5, 0xBBF9, 0x50F9, - 0xBBFA, 0x5102, 0xBBFB, 0x5108, 0xBBFC, 0x5109, 0xBBFD, 0x5105, - 0xBBFE, 0x51DC, 0xBC40, 0x5287, 0xBC41, 0x5288, 0xBC42, 0x5289, - 0xBC43, 0x528D, 0xBC44, 0x528A, 0xBC45, 0x52F0, 0xBC46, 0x53B2, - 0xBC47, 0x562E, 0xBC48, 0x563B, 0xBC49, 0x5639, 0xBC4A, 0x5632, - 0xBC4B, 0x563F, 0xBC4C, 0x5634, 0xBC4D, 0x5629, 0xBC4E, 0x5653, - 0xBC4F, 0x564E, 0xBC50, 0x5657, 0xBC51, 0x5674, 0xBC52, 0x5636, - 0xBC53, 0x562F, 0xBC54, 0x5630, 0xBC55, 0x5880, 0xBC56, 0x589F, - 0xBC57, 0x589E, 0xBC58, 0x58B3, 0xBC59, 0x589C, 0xBC5A, 0x58AE, - 0xBC5B, 0x58A9, 0xBC5C, 0x58A6, 0xBC5D, 0x596D, 0xBC5E, 0x5B09, - 0xBC5F, 0x5AFB, 0xBC60, 0x5B0B, 0xBC61, 0x5AF5, 0xBC62, 0x5B0C, - 0xBC63, 0x5B08, 0xBC64, 0x5BEE, 0xBC65, 0x5BEC, 0xBC66, 0x5BE9, - 0xBC67, 0x5BEB, 0xBC68, 0x5C64, 0xBC69, 0x5C65, 0xBC6A, 0x5D9D, - 0xBC6B, 0x5D94, 0xBC6C, 0x5E62, 0xBC6D, 0x5E5F, 0xBC6E, 0x5E61, - 0xBC6F, 0x5EE2, 0xBC70, 0x5EDA, 0xBC71, 0x5EDF, 0xBC72, 0x5EDD, - 0xBC73, 0x5EE3, 0xBC74, 0x5EE0, 0xBC75, 0x5F48, 0xBC76, 0x5F71, - 0xBC77, 0x5FB7, 0xBC78, 0x5FB5, 0xBC79, 0x6176, 0xBC7A, 0x6167, - 0xBC7B, 0x616E, 0xBC7C, 0x615D, 0xBC7D, 0x6155, 0xBC7E, 0x6182, - 0xBCA1, 0x617C, 0xBCA2, 0x6170, 0xBCA3, 0x616B, 0xBCA4, 0x617E, - 0xBCA5, 0x61A7, 0xBCA6, 0x6190, 0xBCA7, 0x61AB, 0xBCA8, 0x618E, - 0xBCA9, 0x61AC, 0xBCAA, 0x619A, 0xBCAB, 0x61A4, 0xBCAC, 0x6194, - 0xBCAD, 0x61AE, 0xBCAE, 0x622E, 0xBCAF, 0x6469, 0xBCB0, 0x646F, - 0xBCB1, 0x6479, 0xBCB2, 0x649E, 0xBCB3, 0x64B2, 0xBCB4, 0x6488, - 0xBCB5, 0x6490, 0xBCB6, 0x64B0, 0xBCB7, 0x64A5, 0xBCB8, 0x6493, - 0xBCB9, 0x6495, 0xBCBA, 0x64A9, 0xBCBB, 0x6492, 0xBCBC, 0x64AE, - 0xBCBD, 0x64AD, 0xBCBE, 0x64AB, 0xBCBF, 0x649A, 0xBCC0, 0x64AC, - 0xBCC1, 0x6499, 0xBCC2, 0x64A2, 0xBCC3, 0x64B3, 0xBCC4, 0x6575, - 0xBCC5, 0x6577, 0xBCC6, 0x6578, 0xBCC7, 0x66AE, 0xBCC8, 0x66AB, - 0xBCC9, 0x66B4, 0xBCCA, 0x66B1, 0xBCCB, 0x6A23, 0xBCCC, 0x6A1F, - 0xBCCD, 0x69E8, 0xBCCE, 0x6A01, 0xBCCF, 0x6A1E, 0xBCD0, 0x6A19, - 0xBCD1, 0x69FD, 0xBCD2, 0x6A21, 0xBCD3, 0x6A13, 0xBCD4, 0x6A0A, - 0xBCD5, 0x69F3, 0xBCD6, 0x6A02, 0xBCD7, 0x6A05, 0xBCD8, 0x69ED, - 0xBCD9, 0x6A11, 0xBCDA, 0x6B50, 0xBCDB, 0x6B4E, 0xBCDC, 0x6BA4, - 0xBCDD, 0x6BC5, 0xBCDE, 0x6BC6, 0xBCDF, 0x6F3F, 0xBCE0, 0x6F7C, - 0xBCE1, 0x6F84, 0xBCE2, 0x6F51, 0xBCE3, 0x6F66, 0xBCE4, 0x6F54, - 0xBCE5, 0x6F86, 0xBCE6, 0x6F6D, 0xBCE7, 0x6F5B, 0xBCE8, 0x6F78, - 0xBCE9, 0x6F6E, 0xBCEA, 0x6F8E, 0xBCEB, 0x6F7A, 0xBCEC, 0x6F70, - 0xBCED, 0x6F64, 0xBCEE, 0x6F97, 0xBCEF, 0x6F58, 0xBCF0, 0x6ED5, - 0xBCF1, 0x6F6F, 0xBCF2, 0x6F60, 0xBCF3, 0x6F5F, 0xBCF4, 0x719F, - 0xBCF5, 0x71AC, 0xBCF6, 0x71B1, 0xBCF7, 0x71A8, 0xBCF8, 0x7256, - 0xBCF9, 0x729B, 0xBCFA, 0x734E, 0xBCFB, 0x7357, 0xBCFC, 0x7469, - 0xBCFD, 0x748B, 0xBCFE, 0x7483, 0xBD40, 0x747E, 0xBD41, 0x7480, - 0xBD42, 0x757F, 0xBD43, 0x7620, 0xBD44, 0x7629, 0xBD45, 0x761F, - 0xBD46, 0x7624, 0xBD47, 0x7626, 0xBD48, 0x7621, 0xBD49, 0x7622, - 0xBD4A, 0x769A, 0xBD4B, 0x76BA, 0xBD4C, 0x76E4, 0xBD4D, 0x778E, - 0xBD4E, 0x7787, 0xBD4F, 0x778C, 0xBD50, 0x7791, 0xBD51, 0x778B, - 0xBD52, 0x78CB, 0xBD53, 0x78C5, 0xBD54, 0x78BA, 0xBD55, 0x78CA, - 0xBD56, 0x78BE, 0xBD57, 0x78D5, 0xBD58, 0x78BC, 0xBD59, 0x78D0, - 0xBD5A, 0x7A3F, 0xBD5B, 0x7A3C, 0xBD5C, 0x7A40, 0xBD5D, 0x7A3D, - 0xBD5E, 0x7A37, 0xBD5F, 0x7A3B, 0xBD60, 0x7AAF, 0xBD61, 0x7AAE, - 0xBD62, 0x7BAD, 0xBD63, 0x7BB1, 0xBD64, 0x7BC4, 0xBD65, 0x7BB4, - 0xBD66, 0x7BC6, 0xBD67, 0x7BC7, 0xBD68, 0x7BC1, 0xBD69, 0x7BA0, - 0xBD6A, 0x7BCC, 0xBD6B, 0x7CCA, 0xBD6C, 0x7DE0, 0xBD6D, 0x7DF4, - 0xBD6E, 0x7DEF, 0xBD6F, 0x7DFB, 0xBD70, 0x7DD8, 0xBD71, 0x7DEC, - 0xBD72, 0x7DDD, 0xBD73, 0x7DE8, 0xBD74, 0x7DE3, 0xBD75, 0x7DDA, - 0xBD76, 0x7DDE, 0xBD77, 0x7DE9, 0xBD78, 0x7D9E, 0xBD79, 0x7DD9, - 0xBD7A, 0x7DF2, 0xBD7B, 0x7DF9, 0xBD7C, 0x7F75, 0xBD7D, 0x7F77, - 0xBD7E, 0x7FAF, 0xBDA1, 0x7FE9, 0xBDA2, 0x8026, 0xBDA3, 0x819B, - 0xBDA4, 0x819C, 0xBDA5, 0x819D, 0xBDA6, 0x81A0, 0xBDA7, 0x819A, - 0xBDA8, 0x8198, 0xBDA9, 0x8517, 0xBDAA, 0x853D, 0xBDAB, 0x851A, - 0xBDAC, 0x84EE, 0xBDAD, 0x852C, 0xBDAE, 0x852D, 0xBDAF, 0x8513, - 0xBDB0, 0x8511, 0xBDB1, 0x8523, 0xBDB2, 0x8521, 0xBDB3, 0x8514, - 0xBDB4, 0x84EC, 0xBDB5, 0x8525, 0xBDB6, 0x84FF, 0xBDB7, 0x8506, - 0xBDB8, 0x8782, 0xBDB9, 0x8774, 0xBDBA, 0x8776, 0xBDBB, 0x8760, - 0xBDBC, 0x8766, 0xBDBD, 0x8778, 0xBDBE, 0x8768, 0xBDBF, 0x8759, - 0xBDC0, 0x8757, 0xBDC1, 0x874C, 0xBDC2, 0x8753, 0xBDC3, 0x885B, - 0xBDC4, 0x885D, 0xBDC5, 0x8910, 0xBDC6, 0x8907, 0xBDC7, 0x8912, - 0xBDC8, 0x8913, 0xBDC9, 0x8915, 0xBDCA, 0x890A, 0xBDCB, 0x8ABC, - 0xBDCC, 0x8AD2, 0xBDCD, 0x8AC7, 0xBDCE, 0x8AC4, 0xBDCF, 0x8A95, - 0xBDD0, 0x8ACB, 0xBDD1, 0x8AF8, 0xBDD2, 0x8AB2, 0xBDD3, 0x8AC9, - 0xBDD4, 0x8AC2, 0xBDD5, 0x8ABF, 0xBDD6, 0x8AB0, 0xBDD7, 0x8AD6, - 0xBDD8, 0x8ACD, 0xBDD9, 0x8AB6, 0xBDDA, 0x8AB9, 0xBDDB, 0x8ADB, - 0xBDDC, 0x8C4C, 0xBDDD, 0x8C4E, 0xBDDE, 0x8C6C, 0xBDDF, 0x8CE0, - 0xBDE0, 0x8CDE, 0xBDE1, 0x8CE6, 0xBDE2, 0x8CE4, 0xBDE3, 0x8CEC, - 0xBDE4, 0x8CED, 0xBDE5, 0x8CE2, 0xBDE6, 0x8CE3, 0xBDE7, 0x8CDC, - 0xBDE8, 0x8CEA, 0xBDE9, 0x8CE1, 0xBDEA, 0x8D6D, 0xBDEB, 0x8D9F, - 0xBDEC, 0x8DA3, 0xBDED, 0x8E2B, 0xBDEE, 0x8E10, 0xBDEF, 0x8E1D, - 0xBDF0, 0x8E22, 0xBDF1, 0x8E0F, 0xBDF2, 0x8E29, 0xBDF3, 0x8E1F, - 0xBDF4, 0x8E21, 0xBDF5, 0x8E1E, 0xBDF6, 0x8EBA, 0xBDF7, 0x8F1D, - 0xBDF8, 0x8F1B, 0xBDF9, 0x8F1F, 0xBDFA, 0x8F29, 0xBDFB, 0x8F26, - 0xBDFC, 0x8F2A, 0xBDFD, 0x8F1C, 0xBDFE, 0x8F1E, 0xBE40, 0x8F25, - 0xBE41, 0x9069, 0xBE42, 0x906E, 0xBE43, 0x9068, 0xBE44, 0x906D, - 0xBE45, 0x9077, 0xBE46, 0x9130, 0xBE47, 0x912D, 0xBE48, 0x9127, - 0xBE49, 0x9131, 0xBE4A, 0x9187, 0xBE4B, 0x9189, 0xBE4C, 0x918B, - 0xBE4D, 0x9183, 0xBE4E, 0x92C5, 0xBE4F, 0x92BB, 0xBE50, 0x92B7, - 0xBE51, 0x92EA, 0xBE52, 0x92AC, 0xBE53, 0x92E4, 0xBE54, 0x92C1, - 0xBE55, 0x92B3, 0xBE56, 0x92BC, 0xBE57, 0x92D2, 0xBE58, 0x92C7, - 0xBE59, 0x92F0, 0xBE5A, 0x92B2, 0xBE5B, 0x95AD, 0xBE5C, 0x95B1, - 0xBE5D, 0x9704, 0xBE5E, 0x9706, 0xBE5F, 0x9707, 0xBE60, 0x9709, - 0xBE61, 0x9760, 0xBE62, 0x978D, 0xBE63, 0x978B, 0xBE64, 0x978F, - 0xBE65, 0x9821, 0xBE66, 0x982B, 0xBE67, 0x981C, 0xBE68, 0x98B3, - 0xBE69, 0x990A, 0xBE6A, 0x9913, 0xBE6B, 0x9912, 0xBE6C, 0x9918, - 0xBE6D, 0x99DD, 0xBE6E, 0x99D0, 0xBE6F, 0x99DF, 0xBE70, 0x99DB, - 0xBE71, 0x99D1, 0xBE72, 0x99D5, 0xBE73, 0x99D2, 0xBE74, 0x99D9, - 0xBE75, 0x9AB7, 0xBE76, 0x9AEE, 0xBE77, 0x9AEF, 0xBE78, 0x9B27, - 0xBE79, 0x9B45, 0xBE7A, 0x9B44, 0xBE7B, 0x9B77, 0xBE7C, 0x9B6F, - 0xBE7D, 0x9D06, 0xBE7E, 0x9D09, 0xBEA1, 0x9D03, 0xBEA2, 0x9EA9, - 0xBEA3, 0x9EBE, 0xBEA4, 0x9ECE, 0xBEA5, 0x58A8, 0xBEA6, 0x9F52, - 0xBEA7, 0x5112, 0xBEA8, 0x5118, 0xBEA9, 0x5114, 0xBEAA, 0x5110, - 0xBEAB, 0x5115, 0xBEAC, 0x5180, 0xBEAD, 0x51AA, 0xBEAE, 0x51DD, - 0xBEAF, 0x5291, 0xBEB0, 0x5293, 0xBEB1, 0x52F3, 0xBEB2, 0x5659, - 0xBEB3, 0x566B, 0xBEB4, 0x5679, 0xBEB5, 0x5669, 0xBEB6, 0x5664, - 0xBEB7, 0x5678, 0xBEB8, 0x566A, 0xBEB9, 0x5668, 0xBEBA, 0x5665, - 0xBEBB, 0x5671, 0xBEBC, 0x566F, 0xBEBD, 0x566C, 0xBEBE, 0x5662, - 0xBEBF, 0x5676, 0xBEC0, 0x58C1, 0xBEC1, 0x58BE, 0xBEC2, 0x58C7, - 0xBEC3, 0x58C5, 0xBEC4, 0x596E, 0xBEC5, 0x5B1D, 0xBEC6, 0x5B34, - 0xBEC7, 0x5B78, 0xBEC8, 0x5BF0, 0xBEC9, 0x5C0E, 0xBECA, 0x5F4A, - 0xBECB, 0x61B2, 0xBECC, 0x6191, 0xBECD, 0x61A9, 0xBECE, 0x618A, - 0xBECF, 0x61CD, 0xBED0, 0x61B6, 0xBED1, 0x61BE, 0xBED2, 0x61CA, - 0xBED3, 0x61C8, 0xBED4, 0x6230, 0xBED5, 0x64C5, 0xBED6, 0x64C1, - 0xBED7, 0x64CB, 0xBED8, 0x64BB, 0xBED9, 0x64BC, 0xBEDA, 0x64DA, - 0xBEDB, 0x64C4, 0xBEDC, 0x64C7, 0xBEDD, 0x64C2, 0xBEDE, 0x64CD, - 0xBEDF, 0x64BF, 0xBEE0, 0x64D2, 0xBEE1, 0x64D4, 0xBEE2, 0x64BE, - 0xBEE3, 0x6574, 0xBEE4, 0x66C6, 0xBEE5, 0x66C9, 0xBEE6, 0x66B9, - 0xBEE7, 0x66C4, 0xBEE8, 0x66C7, 0xBEE9, 0x66B8, 0xBEEA, 0x6A3D, - 0xBEEB, 0x6A38, 0xBEEC, 0x6A3A, 0xBEED, 0x6A59, 0xBEEE, 0x6A6B, - 0xBEEF, 0x6A58, 0xBEF0, 0x6A39, 0xBEF1, 0x6A44, 0xBEF2, 0x6A62, - 0xBEF3, 0x6A61, 0xBEF4, 0x6A4B, 0xBEF5, 0x6A47, 0xBEF6, 0x6A35, - 0xBEF7, 0x6A5F, 0xBEF8, 0x6A48, 0xBEF9, 0x6B59, 0xBEFA, 0x6B77, - 0xBEFB, 0x6C05, 0xBEFC, 0x6FC2, 0xBEFD, 0x6FB1, 0xBEFE, 0x6FA1, - 0xBF40, 0x6FC3, 0xBF41, 0x6FA4, 0xBF42, 0x6FC1, 0xBF43, 0x6FA7, - 0xBF44, 0x6FB3, 0xBF45, 0x6FC0, 0xBF46, 0x6FB9, 0xBF47, 0x6FB6, - 0xBF48, 0x6FA6, 0xBF49, 0x6FA0, 0xBF4A, 0x6FB4, 0xBF4B, 0x71BE, - 0xBF4C, 0x71C9, 0xBF4D, 0x71D0, 0xBF4E, 0x71D2, 0xBF4F, 0x71C8, - 0xBF50, 0x71D5, 0xBF51, 0x71B9, 0xBF52, 0x71CE, 0xBF53, 0x71D9, - 0xBF54, 0x71DC, 0xBF55, 0x71C3, 0xBF56, 0x71C4, 0xBF57, 0x7368, - 0xBF58, 0x749C, 0xBF59, 0x74A3, 0xBF5A, 0x7498, 0xBF5B, 0x749F, - 0xBF5C, 0x749E, 0xBF5D, 0x74E2, 0xBF5E, 0x750C, 0xBF5F, 0x750D, - 0xBF60, 0x7634, 0xBF61, 0x7638, 0xBF62, 0x763A, 0xBF63, 0x76E7, - 0xBF64, 0x76E5, 0xBF65, 0x77A0, 0xBF66, 0x779E, 0xBF67, 0x779F, - 0xBF68, 0x77A5, 0xBF69, 0x78E8, 0xBF6A, 0x78DA, 0xBF6B, 0x78EC, - 0xBF6C, 0x78E7, 0xBF6D, 0x79A6, 0xBF6E, 0x7A4D, 0xBF6F, 0x7A4E, - 0xBF70, 0x7A46, 0xBF71, 0x7A4C, 0xBF72, 0x7A4B, 0xBF73, 0x7ABA, - 0xBF74, 0x7BD9, 0xBF75, 0x7C11, 0xBF76, 0x7BC9, 0xBF77, 0x7BE4, - 0xBF78, 0x7BDB, 0xBF79, 0x7BE1, 0xBF7A, 0x7BE9, 0xBF7B, 0x7BE6, - 0xBF7C, 0x7CD5, 0xBF7D, 0x7CD6, 0xBF7E, 0x7E0A, 0xBFA1, 0x7E11, - 0xBFA2, 0x7E08, 0xBFA3, 0x7E1B, 0xBFA4, 0x7E23, 0xBFA5, 0x7E1E, - 0xBFA6, 0x7E1D, 0xBFA7, 0x7E09, 0xBFA8, 0x7E10, 0xBFA9, 0x7F79, - 0xBFAA, 0x7FB2, 0xBFAB, 0x7FF0, 0xBFAC, 0x7FF1, 0xBFAD, 0x7FEE, - 0xBFAE, 0x8028, 0xBFAF, 0x81B3, 0xBFB0, 0x81A9, 0xBFB1, 0x81A8, - 0xBFB2, 0x81FB, 0xBFB3, 0x8208, 0xBFB4, 0x8258, 0xBFB5, 0x8259, - 0xBFB6, 0x854A, 0xBFB7, 0x8559, 0xBFB8, 0x8548, 0xBFB9, 0x8568, - 0xBFBA, 0x8569, 0xBFBB, 0x8543, 0xBFBC, 0x8549, 0xBFBD, 0x856D, - 0xBFBE, 0x856A, 0xBFBF, 0x855E, 0xBFC0, 0x8783, 0xBFC1, 0x879F, - 0xBFC2, 0x879E, 0xBFC3, 0x87A2, 0xBFC4, 0x878D, 0xBFC5, 0x8861, - 0xBFC6, 0x892A, 0xBFC7, 0x8932, 0xBFC8, 0x8925, 0xBFC9, 0x892B, - 0xBFCA, 0x8921, 0xBFCB, 0x89AA, 0xBFCC, 0x89A6, 0xBFCD, 0x8AE6, - 0xBFCE, 0x8AFA, 0xBFCF, 0x8AEB, 0xBFD0, 0x8AF1, 0xBFD1, 0x8B00, - 0xBFD2, 0x8ADC, 0xBFD3, 0x8AE7, 0xBFD4, 0x8AEE, 0xBFD5, 0x8AFE, - 0xBFD6, 0x8B01, 0xBFD7, 0x8B02, 0xBFD8, 0x8AF7, 0xBFD9, 0x8AED, - 0xBFDA, 0x8AF3, 0xBFDB, 0x8AF6, 0xBFDC, 0x8AFC, 0xBFDD, 0x8C6B, - 0xBFDE, 0x8C6D, 0xBFDF, 0x8C93, 0xBFE0, 0x8CF4, 0xBFE1, 0x8E44, - 0xBFE2, 0x8E31, 0xBFE3, 0x8E34, 0xBFE4, 0x8E42, 0xBFE5, 0x8E39, - 0xBFE6, 0x8E35, 0xBFE7, 0x8F3B, 0xBFE8, 0x8F2F, 0xBFE9, 0x8F38, - 0xBFEA, 0x8F33, 0xBFEB, 0x8FA8, 0xBFEC, 0x8FA6, 0xBFED, 0x9075, - 0xBFEE, 0x9074, 0xBFEF, 0x9078, 0xBFF0, 0x9072, 0xBFF1, 0x907C, - 0xBFF2, 0x907A, 0xBFF3, 0x9134, 0xBFF4, 0x9192, 0xBFF5, 0x9320, - 0xBFF6, 0x9336, 0xBFF7, 0x92F8, 0xBFF8, 0x9333, 0xBFF9, 0x932F, - 0xBFFA, 0x9322, 0xBFFB, 0x92FC, 0xBFFC, 0x932B, 0xBFFD, 0x9304, - 0xBFFE, 0x931A, 0xC040, 0x9310, 0xC041, 0x9326, 0xC042, 0x9321, - 0xC043, 0x9315, 0xC044, 0x932E, 0xC045, 0x9319, 0xC046, 0x95BB, - 0xC047, 0x96A7, 0xC048, 0x96A8, 0xC049, 0x96AA, 0xC04A, 0x96D5, - 0xC04B, 0x970E, 0xC04C, 0x9711, 0xC04D, 0x9716, 0xC04E, 0x970D, - 0xC04F, 0x9713, 0xC050, 0x970F, 0xC051, 0x975B, 0xC052, 0x975C, - 0xC053, 0x9766, 0xC054, 0x9798, 0xC055, 0x9830, 0xC056, 0x9838, - 0xC057, 0x983B, 0xC058, 0x9837, 0xC059, 0x982D, 0xC05A, 0x9839, - 0xC05B, 0x9824, 0xC05C, 0x9910, 0xC05D, 0x9928, 0xC05E, 0x991E, - 0xC05F, 0x991B, 0xC060, 0x9921, 0xC061, 0x991A, 0xC062, 0x99ED, - 0xC063, 0x99E2, 0xC064, 0x99F1, 0xC065, 0x9AB8, 0xC066, 0x9ABC, - 0xC067, 0x9AFB, 0xC068, 0x9AED, 0xC069, 0x9B28, 0xC06A, 0x9B91, - 0xC06B, 0x9D15, 0xC06C, 0x9D23, 0xC06D, 0x9D26, 0xC06E, 0x9D28, - 0xC06F, 0x9D12, 0xC070, 0x9D1B, 0xC071, 0x9ED8, 0xC072, 0x9ED4, - 0xC073, 0x9F8D, 0xC074, 0x9F9C, 0xC075, 0x512A, 0xC076, 0x511F, - 0xC077, 0x5121, 0xC078, 0x5132, 0xC079, 0x52F5, 0xC07A, 0x568E, - 0xC07B, 0x5680, 0xC07C, 0x5690, 0xC07D, 0x5685, 0xC07E, 0x5687, - 0xC0A1, 0x568F, 0xC0A2, 0x58D5, 0xC0A3, 0x58D3, 0xC0A4, 0x58D1, - 0xC0A5, 0x58CE, 0xC0A6, 0x5B30, 0xC0A7, 0x5B2A, 0xC0A8, 0x5B24, - 0xC0A9, 0x5B7A, 0xC0AA, 0x5C37, 0xC0AB, 0x5C68, 0xC0AC, 0x5DBC, - 0xC0AD, 0x5DBA, 0xC0AE, 0x5DBD, 0xC0AF, 0x5DB8, 0xC0B0, 0x5E6B, - 0xC0B1, 0x5F4C, 0xC0B2, 0x5FBD, 0xC0B3, 0x61C9, 0xC0B4, 0x61C2, - 0xC0B5, 0x61C7, 0xC0B6, 0x61E6, 0xC0B7, 0x61CB, 0xC0B8, 0x6232, - 0xC0B9, 0x6234, 0xC0BA, 0x64CE, 0xC0BB, 0x64CA, 0xC0BC, 0x64D8, - 0xC0BD, 0x64E0, 0xC0BE, 0x64F0, 0xC0BF, 0x64E6, 0xC0C0, 0x64EC, - 0xC0C1, 0x64F1, 0xC0C2, 0x64E2, 0xC0C3, 0x64ED, 0xC0C4, 0x6582, - 0xC0C5, 0x6583, 0xC0C6, 0x66D9, 0xC0C7, 0x66D6, 0xC0C8, 0x6A80, - 0xC0C9, 0x6A94, 0xC0CA, 0x6A84, 0xC0CB, 0x6AA2, 0xC0CC, 0x6A9C, - 0xC0CD, 0x6ADB, 0xC0CE, 0x6AA3, 0xC0CF, 0x6A7E, 0xC0D0, 0x6A97, - 0xC0D1, 0x6A90, 0xC0D2, 0x6AA0, 0xC0D3, 0x6B5C, 0xC0D4, 0x6BAE, - 0xC0D5, 0x6BDA, 0xC0D6, 0x6C08, 0xC0D7, 0x6FD8, 0xC0D8, 0x6FF1, - 0xC0D9, 0x6FDF, 0xC0DA, 0x6FE0, 0xC0DB, 0x6FDB, 0xC0DC, 0x6FE4, - 0xC0DD, 0x6FEB, 0xC0DE, 0x6FEF, 0xC0DF, 0x6F80, 0xC0E0, 0x6FEC, - 0xC0E1, 0x6FE1, 0xC0E2, 0x6FE9, 0xC0E3, 0x6FD5, 0xC0E4, 0x6FEE, - 0xC0E5, 0x6FF0, 0xC0E6, 0x71E7, 0xC0E7, 0x71DF, 0xC0E8, 0x71EE, - 0xC0E9, 0x71E6, 0xC0EA, 0x71E5, 0xC0EB, 0x71ED, 0xC0EC, 0x71EC, - 0xC0ED, 0x71F4, 0xC0EE, 0x71E0, 0xC0EF, 0x7235, 0xC0F0, 0x7246, - 0xC0F1, 0x7370, 0xC0F2, 0x7372, 0xC0F3, 0x74A9, 0xC0F4, 0x74B0, - 0xC0F5, 0x74A6, 0xC0F6, 0x74A8, 0xC0F7, 0x7646, 0xC0F8, 0x7642, - 0xC0F9, 0x764C, 0xC0FA, 0x76EA, 0xC0FB, 0x77B3, 0xC0FC, 0x77AA, - 0xC0FD, 0x77B0, 0xC0FE, 0x77AC, 0xC140, 0x77A7, 0xC141, 0x77AD, - 0xC142, 0x77EF, 0xC143, 0x78F7, 0xC144, 0x78FA, 0xC145, 0x78F4, - 0xC146, 0x78EF, 0xC147, 0x7901, 0xC148, 0x79A7, 0xC149, 0x79AA, - 0xC14A, 0x7A57, 0xC14B, 0x7ABF, 0xC14C, 0x7C07, 0xC14D, 0x7C0D, - 0xC14E, 0x7BFE, 0xC14F, 0x7BF7, 0xC150, 0x7C0C, 0xC151, 0x7BE0, - 0xC152, 0x7CE0, 0xC153, 0x7CDC, 0xC154, 0x7CDE, 0xC155, 0x7CE2, - 0xC156, 0x7CDF, 0xC157, 0x7CD9, 0xC158, 0x7CDD, 0xC159, 0x7E2E, - 0xC15A, 0x7E3E, 0xC15B, 0x7E46, 0xC15C, 0x7E37, 0xC15D, 0x7E32, - 0xC15E, 0x7E43, 0xC15F, 0x7E2B, 0xC160, 0x7E3D, 0xC161, 0x7E31, - 0xC162, 0x7E45, 0xC163, 0x7E41, 0xC164, 0x7E34, 0xC165, 0x7E39, - 0xC166, 0x7E48, 0xC167, 0x7E35, 0xC168, 0x7E3F, 0xC169, 0x7E2F, - 0xC16A, 0x7F44, 0xC16B, 0x7FF3, 0xC16C, 0x7FFC, 0xC16D, 0x8071, - 0xC16E, 0x8072, 0xC16F, 0x8070, 0xC170, 0x806F, 0xC171, 0x8073, - 0xC172, 0x81C6, 0xC173, 0x81C3, 0xC174, 0x81BA, 0xC175, 0x81C2, - 0xC176, 0x81C0, 0xC177, 0x81BF, 0xC178, 0x81BD, 0xC179, 0x81C9, - 0xC17A, 0x81BE, 0xC17B, 0x81E8, 0xC17C, 0x8209, 0xC17D, 0x8271, - 0xC17E, 0x85AA, 0xC1A1, 0x8584, 0xC1A2, 0x857E, 0xC1A3, 0x859C, - 0xC1A4, 0x8591, 0xC1A5, 0x8594, 0xC1A6, 0x85AF, 0xC1A7, 0x859B, - 0xC1A8, 0x8587, 0xC1A9, 0x85A8, 0xC1AA, 0x858A, 0xC1AB, 0x8667, - 0xC1AC, 0x87C0, 0xC1AD, 0x87D1, 0xC1AE, 0x87B3, 0xC1AF, 0x87D2, - 0xC1B0, 0x87C6, 0xC1B1, 0x87AB, 0xC1B2, 0x87BB, 0xC1B3, 0x87BA, - 0xC1B4, 0x87C8, 0xC1B5, 0x87CB, 0xC1B6, 0x893B, 0xC1B7, 0x8936, - 0xC1B8, 0x8944, 0xC1B9, 0x8938, 0xC1BA, 0x893D, 0xC1BB, 0x89AC, - 0xC1BC, 0x8B0E, 0xC1BD, 0x8B17, 0xC1BE, 0x8B19, 0xC1BF, 0x8B1B, - 0xC1C0, 0x8B0A, 0xC1C1, 0x8B20, 0xC1C2, 0x8B1D, 0xC1C3, 0x8B04, - 0xC1C4, 0x8B10, 0xC1C5, 0x8C41, 0xC1C6, 0x8C3F, 0xC1C7, 0x8C73, - 0xC1C8, 0x8CFA, 0xC1C9, 0x8CFD, 0xC1CA, 0x8CFC, 0xC1CB, 0x8CF8, - 0xC1CC, 0x8CFB, 0xC1CD, 0x8DA8, 0xC1CE, 0x8E49, 0xC1CF, 0x8E4B, - 0xC1D0, 0x8E48, 0xC1D1, 0x8E4A, 0xC1D2, 0x8F44, 0xC1D3, 0x8F3E, - 0xC1D4, 0x8F42, 0xC1D5, 0x8F45, 0xC1D6, 0x8F3F, 0xC1D7, 0x907F, - 0xC1D8, 0x907D, 0xC1D9, 0x9084, 0xC1DA, 0x9081, 0xC1DB, 0x9082, - 0xC1DC, 0x9080, 0xC1DD, 0x9139, 0xC1DE, 0x91A3, 0xC1DF, 0x919E, - 0xC1E0, 0x919C, 0xC1E1, 0x934D, 0xC1E2, 0x9382, 0xC1E3, 0x9328, - 0xC1E4, 0x9375, 0xC1E5, 0x934A, 0xC1E6, 0x9365, 0xC1E7, 0x934B, - 0xC1E8, 0x9318, 0xC1E9, 0x937E, 0xC1EA, 0x936C, 0xC1EB, 0x935B, - 0xC1EC, 0x9370, 0xC1ED, 0x935A, 0xC1EE, 0x9354, 0xC1EF, 0x95CA, - 0xC1F0, 0x95CB, 0xC1F1, 0x95CC, 0xC1F2, 0x95C8, 0xC1F3, 0x95C6, - 0xC1F4, 0x96B1, 0xC1F5, 0x96B8, 0xC1F6, 0x96D6, 0xC1F7, 0x971C, - 0xC1F8, 0x971E, 0xC1F9, 0x97A0, 0xC1FA, 0x97D3, 0xC1FB, 0x9846, - 0xC1FC, 0x98B6, 0xC1FD, 0x9935, 0xC1FE, 0x9A01, 0xC240, 0x99FF, - 0xC241, 0x9BAE, 0xC242, 0x9BAB, 0xC243, 0x9BAA, 0xC244, 0x9BAD, - 0xC245, 0x9D3B, 0xC246, 0x9D3F, 0xC247, 0x9E8B, 0xC248, 0x9ECF, - 0xC249, 0x9EDE, 0xC24A, 0x9EDC, 0xC24B, 0x9EDD, 0xC24C, 0x9EDB, - 0xC24D, 0x9F3E, 0xC24E, 0x9F4B, 0xC24F, 0x53E2, 0xC250, 0x5695, - 0xC251, 0x56AE, 0xC252, 0x58D9, 0xC253, 0x58D8, 0xC254, 0x5B38, - 0xC255, 0x5F5D, 0xC256, 0x61E3, 0xC257, 0x6233, 0xC258, 0x64F4, - 0xC259, 0x64F2, 0xC25A, 0x64FE, 0xC25B, 0x6506, 0xC25C, 0x64FA, - 0xC25D, 0x64FB, 0xC25E, 0x64F7, 0xC25F, 0x65B7, 0xC260, 0x66DC, - 0xC261, 0x6726, 0xC262, 0x6AB3, 0xC263, 0x6AAC, 0xC264, 0x6AC3, - 0xC265, 0x6ABB, 0xC266, 0x6AB8, 0xC267, 0x6AC2, 0xC268, 0x6AAE, - 0xC269, 0x6AAF, 0xC26A, 0x6B5F, 0xC26B, 0x6B78, 0xC26C, 0x6BAF, - 0xC26D, 0x7009, 0xC26E, 0x700B, 0xC26F, 0x6FFE, 0xC270, 0x7006, - 0xC271, 0x6FFA, 0xC272, 0x7011, 0xC273, 0x700F, 0xC274, 0x71FB, - 0xC275, 0x71FC, 0xC276, 0x71FE, 0xC277, 0x71F8, 0xC278, 0x7377, - 0xC279, 0x7375, 0xC27A, 0x74A7, 0xC27B, 0x74BF, 0xC27C, 0x7515, - 0xC27D, 0x7656, 0xC27E, 0x7658, 0xC2A1, 0x7652, 0xC2A2, 0x77BD, - 0xC2A3, 0x77BF, 0xC2A4, 0x77BB, 0xC2A5, 0x77BC, 0xC2A6, 0x790E, - 0xC2A7, 0x79AE, 0xC2A8, 0x7A61, 0xC2A9, 0x7A62, 0xC2AA, 0x7A60, - 0xC2AB, 0x7AC4, 0xC2AC, 0x7AC5, 0xC2AD, 0x7C2B, 0xC2AE, 0x7C27, - 0xC2AF, 0x7C2A, 0xC2B0, 0x7C1E, 0xC2B1, 0x7C23, 0xC2B2, 0x7C21, - 0xC2B3, 0x7CE7, 0xC2B4, 0x7E54, 0xC2B5, 0x7E55, 0xC2B6, 0x7E5E, - 0xC2B7, 0x7E5A, 0xC2B8, 0x7E61, 0xC2B9, 0x7E52, 0xC2BA, 0x7E59, - 0xC2BB, 0x7F48, 0xC2BC, 0x7FF9, 0xC2BD, 0x7FFB, 0xC2BE, 0x8077, - 0xC2BF, 0x8076, 0xC2C0, 0x81CD, 0xC2C1, 0x81CF, 0xC2C2, 0x820A, - 0xC2C3, 0x85CF, 0xC2C4, 0x85A9, 0xC2C5, 0x85CD, 0xC2C6, 0x85D0, - 0xC2C7, 0x85C9, 0xC2C8, 0x85B0, 0xC2C9, 0x85BA, 0xC2CA, 0x85B9, - 0xC2CB, 0x85A6, 0xC2CC, 0x87EF, 0xC2CD, 0x87EC, 0xC2CE, 0x87F2, - 0xC2CF, 0x87E0, 0xC2D0, 0x8986, 0xC2D1, 0x89B2, 0xC2D2, 0x89F4, - 0xC2D3, 0x8B28, 0xC2D4, 0x8B39, 0xC2D5, 0x8B2C, 0xC2D6, 0x8B2B, - 0xC2D7, 0x8C50, 0xC2D8, 0x8D05, 0xC2D9, 0x8E59, 0xC2DA, 0x8E63, - 0xC2DB, 0x8E66, 0xC2DC, 0x8E64, 0xC2DD, 0x8E5F, 0xC2DE, 0x8E55, - 0xC2DF, 0x8EC0, 0xC2E0, 0x8F49, 0xC2E1, 0x8F4D, 0xC2E2, 0x9087, - 0xC2E3, 0x9083, 0xC2E4, 0x9088, 0xC2E5, 0x91AB, 0xC2E6, 0x91AC, - 0xC2E7, 0x91D0, 0xC2E8, 0x9394, 0xC2E9, 0x938A, 0xC2EA, 0x9396, - 0xC2EB, 0x93A2, 0xC2EC, 0x93B3, 0xC2ED, 0x93AE, 0xC2EE, 0x93AC, - 0xC2EF, 0x93B0, 0xC2F0, 0x9398, 0xC2F1, 0x939A, 0xC2F2, 0x9397, - 0xC2F3, 0x95D4, 0xC2F4, 0x95D6, 0xC2F5, 0x95D0, 0xC2F6, 0x95D5, - 0xC2F7, 0x96E2, 0xC2F8, 0x96DC, 0xC2F9, 0x96D9, 0xC2FA, 0x96DB, - 0xC2FB, 0x96DE, 0xC2FC, 0x9724, 0xC2FD, 0x97A3, 0xC2FE, 0x97A6, - 0xC340, 0x97AD, 0xC341, 0x97F9, 0xC342, 0x984D, 0xC343, 0x984F, - 0xC344, 0x984C, 0xC345, 0x984E, 0xC346, 0x9853, 0xC347, 0x98BA, - 0xC348, 0x993E, 0xC349, 0x993F, 0xC34A, 0x993D, 0xC34B, 0x992E, - 0xC34C, 0x99A5, 0xC34D, 0x9A0E, 0xC34E, 0x9AC1, 0xC34F, 0x9B03, - 0xC350, 0x9B06, 0xC351, 0x9B4F, 0xC352, 0x9B4E, 0xC353, 0x9B4D, - 0xC354, 0x9BCA, 0xC355, 0x9BC9, 0xC356, 0x9BFD, 0xC357, 0x9BC8, - 0xC358, 0x9BC0, 0xC359, 0x9D51, 0xC35A, 0x9D5D, 0xC35B, 0x9D60, - 0xC35C, 0x9EE0, 0xC35D, 0x9F15, 0xC35E, 0x9F2C, 0xC35F, 0x5133, - 0xC360, 0x56A5, 0xC361, 0x58DE, 0xC362, 0x58DF, 0xC363, 0x58E2, - 0xC364, 0x5BF5, 0xC365, 0x9F90, 0xC366, 0x5EEC, 0xC367, 0x61F2, - 0xC368, 0x61F7, 0xC369, 0x61F6, 0xC36A, 0x61F5, 0xC36B, 0x6500, - 0xC36C, 0x650F, 0xC36D, 0x66E0, 0xC36E, 0x66DD, 0xC36F, 0x6AE5, - 0xC370, 0x6ADD, 0xC371, 0x6ADA, 0xC372, 0x6AD3, 0xC373, 0x701B, - 0xC374, 0x701F, 0xC375, 0x7028, 0xC376, 0x701A, 0xC377, 0x701D, - 0xC378, 0x7015, 0xC379, 0x7018, 0xC37A, 0x7206, 0xC37B, 0x720D, - 0xC37C, 0x7258, 0xC37D, 0x72A2, 0xC37E, 0x7378, 0xC3A1, 0x737A, - 0xC3A2, 0x74BD, 0xC3A3, 0x74CA, 0xC3A4, 0x74E3, 0xC3A5, 0x7587, - 0xC3A6, 0x7586, 0xC3A7, 0x765F, 0xC3A8, 0x7661, 0xC3A9, 0x77C7, - 0xC3AA, 0x7919, 0xC3AB, 0x79B1, 0xC3AC, 0x7A6B, 0xC3AD, 0x7A69, - 0xC3AE, 0x7C3E, 0xC3AF, 0x7C3F, 0xC3B0, 0x7C38, 0xC3B1, 0x7C3D, - 0xC3B2, 0x7C37, 0xC3B3, 0x7C40, 0xC3B4, 0x7E6B, 0xC3B5, 0x7E6D, - 0xC3B6, 0x7E79, 0xC3B7, 0x7E69, 0xC3B8, 0x7E6A, 0xC3B9, 0x7F85, - 0xC3BA, 0x7E73, 0xC3BB, 0x7FB6, 0xC3BC, 0x7FB9, 0xC3BD, 0x7FB8, - 0xC3BE, 0x81D8, 0xC3BF, 0x85E9, 0xC3C0, 0x85DD, 0xC3C1, 0x85EA, - 0xC3C2, 0x85D5, 0xC3C3, 0x85E4, 0xC3C4, 0x85E5, 0xC3C5, 0x85F7, - 0xC3C6, 0x87FB, 0xC3C7, 0x8805, 0xC3C8, 0x880D, 0xC3C9, 0x87F9, - 0xC3CA, 0x87FE, 0xC3CB, 0x8960, 0xC3CC, 0x895F, 0xC3CD, 0x8956, - 0xC3CE, 0x895E, 0xC3CF, 0x8B41, 0xC3D0, 0x8B5C, 0xC3D1, 0x8B58, - 0xC3D2, 0x8B49, 0xC3D3, 0x8B5A, 0xC3D4, 0x8B4E, 0xC3D5, 0x8B4F, - 0xC3D6, 0x8B46, 0xC3D7, 0x8B59, 0xC3D8, 0x8D08, 0xC3D9, 0x8D0A, - 0xC3DA, 0x8E7C, 0xC3DB, 0x8E72, 0xC3DC, 0x8E87, 0xC3DD, 0x8E76, - 0xC3DE, 0x8E6C, 0xC3DF, 0x8E7A, 0xC3E0, 0x8E74, 0xC3E1, 0x8F54, - 0xC3E2, 0x8F4E, 0xC3E3, 0x8FAD, 0xC3E4, 0x908A, 0xC3E5, 0x908B, - 0xC3E6, 0x91B1, 0xC3E7, 0x91AE, 0xC3E8, 0x93E1, 0xC3E9, 0x93D1, - 0xC3EA, 0x93DF, 0xC3EB, 0x93C3, 0xC3EC, 0x93C8, 0xC3ED, 0x93DC, - 0xC3EE, 0x93DD, 0xC3EF, 0x93D6, 0xC3F0, 0x93E2, 0xC3F1, 0x93CD, - 0xC3F2, 0x93D8, 0xC3F3, 0x93E4, 0xC3F4, 0x93D7, 0xC3F5, 0x93E8, - 0xC3F6, 0x95DC, 0xC3F7, 0x96B4, 0xC3F8, 0x96E3, 0xC3F9, 0x972A, - 0xC3FA, 0x9727, 0xC3FB, 0x9761, 0xC3FC, 0x97DC, 0xC3FD, 0x97FB, - 0xC3FE, 0x985E, 0xC440, 0x9858, 0xC441, 0x985B, 0xC442, 0x98BC, - 0xC443, 0x9945, 0xC444, 0x9949, 0xC445, 0x9A16, 0xC446, 0x9A19, - 0xC447, 0x9B0D, 0xC448, 0x9BE8, 0xC449, 0x9BE7, 0xC44A, 0x9BD6, - 0xC44B, 0x9BDB, 0xC44C, 0x9D89, 0xC44D, 0x9D61, 0xC44E, 0x9D72, - 0xC44F, 0x9D6A, 0xC450, 0x9D6C, 0xC451, 0x9E92, 0xC452, 0x9E97, - 0xC453, 0x9E93, 0xC454, 0x9EB4, 0xC455, 0x52F8, 0xC456, 0x56A8, - 0xC457, 0x56B7, 0xC458, 0x56B6, 0xC459, 0x56B4, 0xC45A, 0x56BC, - 0xC45B, 0x58E4, 0xC45C, 0x5B40, 0xC45D, 0x5B43, 0xC45E, 0x5B7D, - 0xC45F, 0x5BF6, 0xC460, 0x5DC9, 0xC461, 0x61F8, 0xC462, 0x61FA, - 0xC463, 0x6518, 0xC464, 0x6514, 0xC465, 0x6519, 0xC466, 0x66E6, - 0xC467, 0x6727, 0xC468, 0x6AEC, 0xC469, 0x703E, 0xC46A, 0x7030, - 0xC46B, 0x7032, 0xC46C, 0x7210, 0xC46D, 0x737B, 0xC46E, 0x74CF, - 0xC46F, 0x7662, 0xC470, 0x7665, 0xC471, 0x7926, 0xC472, 0x792A, - 0xC473, 0x792C, 0xC474, 0x792B, 0xC475, 0x7AC7, 0xC476, 0x7AF6, - 0xC477, 0x7C4C, 0xC478, 0x7C43, 0xC479, 0x7C4D, 0xC47A, 0x7CEF, - 0xC47B, 0x7CF0, 0xC47C, 0x8FAE, 0xC47D, 0x7E7D, 0xC47E, 0x7E7C, - 0xC4A1, 0x7E82, 0xC4A2, 0x7F4C, 0xC4A3, 0x8000, 0xC4A4, 0x81DA, - 0xC4A5, 0x8266, 0xC4A6, 0x85FB, 0xC4A7, 0x85F9, 0xC4A8, 0x8611, - 0xC4A9, 0x85FA, 0xC4AA, 0x8606, 0xC4AB, 0x860B, 0xC4AC, 0x8607, - 0xC4AD, 0x860A, 0xC4AE, 0x8814, 0xC4AF, 0x8815, 0xC4B0, 0x8964, - 0xC4B1, 0x89BA, 0xC4B2, 0x89F8, 0xC4B3, 0x8B70, 0xC4B4, 0x8B6C, - 0xC4B5, 0x8B66, 0xC4B6, 0x8B6F, 0xC4B7, 0x8B5F, 0xC4B8, 0x8B6B, - 0xC4B9, 0x8D0F, 0xC4BA, 0x8D0D, 0xC4BB, 0x8E89, 0xC4BC, 0x8E81, - 0xC4BD, 0x8E85, 0xC4BE, 0x8E82, 0xC4BF, 0x91B4, 0xC4C0, 0x91CB, - 0xC4C1, 0x9418, 0xC4C2, 0x9403, 0xC4C3, 0x93FD, 0xC4C4, 0x95E1, - 0xC4C5, 0x9730, 0xC4C6, 0x98C4, 0xC4C7, 0x9952, 0xC4C8, 0x9951, - 0xC4C9, 0x99A8, 0xC4CA, 0x9A2B, 0xC4CB, 0x9A30, 0xC4CC, 0x9A37, - 0xC4CD, 0x9A35, 0xC4CE, 0x9C13, 0xC4CF, 0x9C0D, 0xC4D0, 0x9E79, - 0xC4D1, 0x9EB5, 0xC4D2, 0x9EE8, 0xC4D3, 0x9F2F, 0xC4D4, 0x9F5F, - 0xC4D5, 0x9F63, 0xC4D6, 0x9F61, 0xC4D7, 0x5137, 0xC4D8, 0x5138, - 0xC4D9, 0x56C1, 0xC4DA, 0x56C0, 0xC4DB, 0x56C2, 0xC4DC, 0x5914, - 0xC4DD, 0x5C6C, 0xC4DE, 0x5DCD, 0xC4DF, 0x61FC, 0xC4E0, 0x61FE, - 0xC4E1, 0x651D, 0xC4E2, 0x651C, 0xC4E3, 0x6595, 0xC4E4, 0x66E9, - 0xC4E5, 0x6AFB, 0xC4E6, 0x6B04, 0xC4E7, 0x6AFA, 0xC4E8, 0x6BB2, - 0xC4E9, 0x704C, 0xC4EA, 0x721B, 0xC4EB, 0x72A7, 0xC4EC, 0x74D6, - 0xC4ED, 0x74D4, 0xC4EE, 0x7669, 0xC4EF, 0x77D3, 0xC4F0, 0x7C50, - 0xC4F1, 0x7E8F, 0xC4F2, 0x7E8C, 0xC4F3, 0x7FBC, 0xC4F4, 0x8617, - 0xC4F5, 0x862D, 0xC4F6, 0x861A, 0xC4F7, 0x8823, 0xC4F8, 0x8822, - 0xC4F9, 0x8821, 0xC4FA, 0x881F, 0xC4FB, 0x896A, 0xC4FC, 0x896C, - 0xC4FD, 0x89BD, 0xC4FE, 0x8B74, 0xC540, 0x8B77, 0xC541, 0x8B7D, - 0xC542, 0x8D13, 0xC543, 0x8E8A, 0xC544, 0x8E8D, 0xC545, 0x8E8B, - 0xC546, 0x8F5F, 0xC547, 0x8FAF, 0xC548, 0x91BA, 0xC549, 0x942E, - 0xC54A, 0x9433, 0xC54B, 0x9435, 0xC54C, 0x943A, 0xC54D, 0x9438, - 0xC54E, 0x9432, 0xC54F, 0x942B, 0xC550, 0x95E2, 0xC551, 0x9738, - 0xC552, 0x9739, 0xC553, 0x9732, 0xC554, 0x97FF, 0xC555, 0x9867, - 0xC556, 0x9865, 0xC557, 0x9957, 0xC558, 0x9A45, 0xC559, 0x9A43, - 0xC55A, 0x9A40, 0xC55B, 0x9A3E, 0xC55C, 0x9ACF, 0xC55D, 0x9B54, - 0xC55E, 0x9B51, 0xC55F, 0x9C2D, 0xC560, 0x9C25, 0xC561, 0x9DAF, - 0xC562, 0x9DB4, 0xC563, 0x9DC2, 0xC564, 0x9DB8, 0xC565, 0x9E9D, - 0xC566, 0x9EEF, 0xC567, 0x9F19, 0xC568, 0x9F5C, 0xC569, 0x9F66, - 0xC56A, 0x9F67, 0xC56B, 0x513C, 0xC56C, 0x513B, 0xC56D, 0x56C8, - 0xC56E, 0x56CA, 0xC56F, 0x56C9, 0xC570, 0x5B7F, 0xC571, 0x5DD4, - 0xC572, 0x5DD2, 0xC573, 0x5F4E, 0xC574, 0x61FF, 0xC575, 0x6524, - 0xC576, 0x6B0A, 0xC577, 0x6B61, 0xC578, 0x7051, 0xC579, 0x7058, - 0xC57A, 0x7380, 0xC57B, 0x74E4, 0xC57C, 0x758A, 0xC57D, 0x766E, - 0xC57E, 0x766C, 0xC5A1, 0x79B3, 0xC5A2, 0x7C60, 0xC5A3, 0x7C5F, - 0xC5A4, 0x807E, 0xC5A5, 0x807D, 0xC5A6, 0x81DF, 0xC5A7, 0x8972, - 0xC5A8, 0x896F, 0xC5A9, 0x89FC, 0xC5AA, 0x8B80, 0xC5AB, 0x8D16, - 0xC5AC, 0x8D17, 0xC5AD, 0x8E91, 0xC5AE, 0x8E93, 0xC5AF, 0x8F61, - 0xC5B0, 0x9148, 0xC5B1, 0x9444, 0xC5B2, 0x9451, 0xC5B3, 0x9452, - 0xC5B4, 0x973D, 0xC5B5, 0x973E, 0xC5B6, 0x97C3, 0xC5B7, 0x97C1, - 0xC5B8, 0x986B, 0xC5B9, 0x9955, 0xC5BA, 0x9A55, 0xC5BB, 0x9A4D, - 0xC5BC, 0x9AD2, 0xC5BD, 0x9B1A, 0xC5BE, 0x9C49, 0xC5BF, 0x9C31, - 0xC5C0, 0x9C3E, 0xC5C1, 0x9C3B, 0xC5C2, 0x9DD3, 0xC5C3, 0x9DD7, - 0xC5C4, 0x9F34, 0xC5C5, 0x9F6C, 0xC5C6, 0x9F6A, 0xC5C7, 0x9F94, - 0xC5C8, 0x56CC, 0xC5C9, 0x5DD6, 0xC5CA, 0x6200, 0xC5CB, 0x6523, - 0xC5CC, 0x652B, 0xC5CD, 0x652A, 0xC5CE, 0x66EC, 0xC5CF, 0x6B10, - 0xC5D0, 0x74DA, 0xC5D1, 0x7ACA, 0xC5D2, 0x7C64, 0xC5D3, 0x7C63, - 0xC5D4, 0x7C65, 0xC5D5, 0x7E93, 0xC5D6, 0x7E96, 0xC5D7, 0x7E94, - 0xC5D8, 0x81E2, 0xC5D9, 0x8638, 0xC5DA, 0x863F, 0xC5DB, 0x8831, - 0xC5DC, 0x8B8A, 0xC5DD, 0x9090, 0xC5DE, 0x908F, 0xC5DF, 0x9463, - 0xC5E0, 0x9460, 0xC5E1, 0x9464, 0xC5E2, 0x9768, 0xC5E3, 0x986F, - 0xC5E4, 0x995C, 0xC5E5, 0x9A5A, 0xC5E6, 0x9A5B, 0xC5E7, 0x9A57, - 0xC5E8, 0x9AD3, 0xC5E9, 0x9AD4, 0xC5EA, 0x9AD1, 0xC5EB, 0x9C54, - 0xC5EC, 0x9C57, 0xC5ED, 0x9C56, 0xC5EE, 0x9DE5, 0xC5EF, 0x9E9F, - 0xC5F0, 0x9EF4, 0xC5F1, 0x56D1, 0xC5F2, 0x58E9, 0xC5F3, 0x652C, - 0xC5F4, 0x705E, 0xC5F5, 0x7671, 0xC5F6, 0x7672, 0xC5F7, 0x77D7, - 0xC5F8, 0x7F50, 0xC5F9, 0x7F88, 0xC5FA, 0x8836, 0xC5FB, 0x8839, - 0xC5FC, 0x8862, 0xC5FD, 0x8B93, 0xC5FE, 0x8B92, 0xC640, 0x8B96, - 0xC641, 0x8277, 0xC642, 0x8D1B, 0xC643, 0x91C0, 0xC644, 0x946A, - 0xC645, 0x9742, 0xC646, 0x9748, 0xC647, 0x9744, 0xC648, 0x97C6, - 0xC649, 0x9870, 0xC64A, 0x9A5F, 0xC64B, 0x9B22, 0xC64C, 0x9B58, - 0xC64D, 0x9C5F, 0xC64E, 0x9DF9, 0xC64F, 0x9DFA, 0xC650, 0x9E7C, - 0xC651, 0x9E7D, 0xC652, 0x9F07, 0xC653, 0x9F77, 0xC654, 0x9F72, - 0xC655, 0x5EF3, 0xC656, 0x6B16, 0xC657, 0x7063, 0xC658, 0x7C6C, - 0xC659, 0x7C6E, 0xC65A, 0x883B, 0xC65B, 0x89C0, 0xC65C, 0x8EA1, - 0xC65D, 0x91C1, 0xC65E, 0x9472, 0xC65F, 0x9470, 0xC660, 0x9871, - 0xC661, 0x995E, 0xC662, 0x9AD6, 0xC663, 0x9B23, 0xC664, 0x9ECC, - 0xC665, 0x7064, 0xC666, 0x77DA, 0xC667, 0x8B9A, 0xC668, 0x9477, - 0xC669, 0x97C9, 0xC66A, 0x9A62, 0xC66B, 0x9A65, 0xC66C, 0x7E9C, - 0xC66D, 0x8B9C, 0xC66E, 0x8EAA, 0xC66F, 0x91C5, 0xC670, 0x947D, - 0xC671, 0x947E, 0xC672, 0x947C, 0xC673, 0x9C77, 0xC674, 0x9C78, - 0xC675, 0x9EF7, 0xC676, 0x8C54, 0xC677, 0x947F, 0xC678, 0x9E1A, - 0xC679, 0x7228, 0xC67A, 0x9A6A, 0xC67B, 0x9B31, 0xC67C, 0x9E1B, - 0xC67D, 0x9E1E, 0xC67E, 0x7C72, 0xC940, 0x4E42, 0xC941, 0x4E5C, - 0xC942, 0x51F5, 0xC943, 0x531A, 0xC944, 0x5382, 0xC945, 0x4E07, - 0xC946, 0x4E0C, 0xC947, 0x4E47, 0xC948, 0x4E8D, 0xC949, 0x56D7, - 0xC94A, 0xFA0C, 0xC94B, 0x5C6E, 0xC94C, 0x5F73, 0xC94D, 0x4E0F, - 0xC94E, 0x5187, 0xC94F, 0x4E0E, 0xC950, 0x4E2E, 0xC951, 0x4E93, - 0xC952, 0x4EC2, 0xC953, 0x4EC9, 0xC954, 0x4EC8, 0xC955, 0x5198, - 0xC956, 0x52FC, 0xC957, 0x536C, 0xC958, 0x53B9, 0xC959, 0x5720, - 0xC95A, 0x5903, 0xC95B, 0x592C, 0xC95C, 0x5C10, 0xC95D, 0x5DFF, - 0xC95E, 0x65E1, 0xC95F, 0x6BB3, 0xC960, 0x6BCC, 0xC961, 0x6C14, - 0xC962, 0x723F, 0xC963, 0x4E31, 0xC964, 0x4E3C, 0xC965, 0x4EE8, - 0xC966, 0x4EDC, 0xC967, 0x4EE9, 0xC968, 0x4EE1, 0xC969, 0x4EDD, - 0xC96A, 0x4EDA, 0xC96B, 0x520C, 0xC96C, 0x531C, 0xC96D, 0x534C, - 0xC96E, 0x5722, 0xC96F, 0x5723, 0xC970, 0x5917, 0xC971, 0x592F, - 0xC972, 0x5B81, 0xC973, 0x5B84, 0xC974, 0x5C12, 0xC975, 0x5C3B, - 0xC976, 0x5C74, 0xC977, 0x5C73, 0xC978, 0x5E04, 0xC979, 0x5E80, - 0xC97A, 0x5E82, 0xC97B, 0x5FC9, 0xC97C, 0x6209, 0xC97D, 0x6250, - 0xC97E, 0x6C15, 0xC9A1, 0x6C36, 0xC9A2, 0x6C43, 0xC9A3, 0x6C3F, - 0xC9A4, 0x6C3B, 0xC9A5, 0x72AE, 0xC9A6, 0x72B0, 0xC9A7, 0x738A, - 0xC9A8, 0x79B8, 0xC9A9, 0x808A, 0xC9AA, 0x961E, 0xC9AB, 0x4F0E, - 0xC9AC, 0x4F18, 0xC9AD, 0x4F2C, 0xC9AE, 0x4EF5, 0xC9AF, 0x4F14, - 0xC9B0, 0x4EF1, 0xC9B1, 0x4F00, 0xC9B2, 0x4EF7, 0xC9B3, 0x4F08, - 0xC9B4, 0x4F1D, 0xC9B5, 0x4F02, 0xC9B6, 0x4F05, 0xC9B7, 0x4F22, - 0xC9B8, 0x4F13, 0xC9B9, 0x4F04, 0xC9BA, 0x4EF4, 0xC9BB, 0x4F12, - 0xC9BC, 0x51B1, 0xC9BD, 0x5213, 0xC9BE, 0x5209, 0xC9BF, 0x5210, - 0xC9C0, 0x52A6, 0xC9C1, 0x5322, 0xC9C2, 0x531F, 0xC9C3, 0x534D, - 0xC9C4, 0x538A, 0xC9C5, 0x5407, 0xC9C6, 0x56E1, 0xC9C7, 0x56DF, - 0xC9C8, 0x572E, 0xC9C9, 0x572A, 0xC9CA, 0x5734, 0xC9CB, 0x593C, - 0xC9CC, 0x5980, 0xC9CD, 0x597C, 0xC9CE, 0x5985, 0xC9CF, 0x597B, - 0xC9D0, 0x597E, 0xC9D1, 0x5977, 0xC9D2, 0x597F, 0xC9D3, 0x5B56, - 0xC9D4, 0x5C15, 0xC9D5, 0x5C25, 0xC9D6, 0x5C7C, 0xC9D7, 0x5C7A, - 0xC9D8, 0x5C7B, 0xC9D9, 0x5C7E, 0xC9DA, 0x5DDF, 0xC9DB, 0x5E75, - 0xC9DC, 0x5E84, 0xC9DD, 0x5F02, 0xC9DE, 0x5F1A, 0xC9DF, 0x5F74, - 0xC9E0, 0x5FD5, 0xC9E1, 0x5FD4, 0xC9E2, 0x5FCF, 0xC9E3, 0x625C, - 0xC9E4, 0x625E, 0xC9E5, 0x6264, 0xC9E6, 0x6261, 0xC9E7, 0x6266, - 0xC9E8, 0x6262, 0xC9E9, 0x6259, 0xC9EA, 0x6260, 0xC9EB, 0x625A, - 0xC9EC, 0x6265, 0xC9ED, 0x65EF, 0xC9EE, 0x65EE, 0xC9EF, 0x673E, - 0xC9F0, 0x6739, 0xC9F1, 0x6738, 0xC9F2, 0x673B, 0xC9F3, 0x673A, - 0xC9F4, 0x673F, 0xC9F5, 0x673C, 0xC9F6, 0x6733, 0xC9F7, 0x6C18, - 0xC9F8, 0x6C46, 0xC9F9, 0x6C52, 0xC9FA, 0x6C5C, 0xC9FB, 0x6C4F, - 0xC9FC, 0x6C4A, 0xC9FD, 0x6C54, 0xC9FE, 0x6C4B, 0xCA40, 0x6C4C, - 0xCA41, 0x7071, 0xCA42, 0x725E, 0xCA43, 0x72B4, 0xCA44, 0x72B5, - 0xCA45, 0x738E, 0xCA46, 0x752A, 0xCA47, 0x767F, 0xCA48, 0x7A75, - 0xCA49, 0x7F51, 0xCA4A, 0x8278, 0xCA4B, 0x827C, 0xCA4C, 0x8280, - 0xCA4D, 0x827D, 0xCA4E, 0x827F, 0xCA4F, 0x864D, 0xCA50, 0x897E, - 0xCA51, 0x9099, 0xCA52, 0x9097, 0xCA53, 0x9098, 0xCA54, 0x909B, - 0xCA55, 0x9094, 0xCA56, 0x9622, 0xCA57, 0x9624, 0xCA58, 0x9620, - 0xCA59, 0x9623, 0xCA5A, 0x4F56, 0xCA5B, 0x4F3B, 0xCA5C, 0x4F62, - 0xCA5D, 0x4F49, 0xCA5E, 0x4F53, 0xCA5F, 0x4F64, 0xCA60, 0x4F3E, - 0xCA61, 0x4F67, 0xCA62, 0x4F52, 0xCA63, 0x4F5F, 0xCA64, 0x4F41, - 0xCA65, 0x4F58, 0xCA66, 0x4F2D, 0xCA67, 0x4F33, 0xCA68, 0x4F3F, - 0xCA69, 0x4F61, 0xCA6A, 0x518F, 0xCA6B, 0x51B9, 0xCA6C, 0x521C, - 0xCA6D, 0x521E, 0xCA6E, 0x5221, 0xCA6F, 0x52AD, 0xCA70, 0x52AE, - 0xCA71, 0x5309, 0xCA72, 0x5363, 0xCA73, 0x5372, 0xCA74, 0x538E, - 0xCA75, 0x538F, 0xCA76, 0x5430, 0xCA77, 0x5437, 0xCA78, 0x542A, - 0xCA79, 0x5454, 0xCA7A, 0x5445, 0xCA7B, 0x5419, 0xCA7C, 0x541C, - 0xCA7D, 0x5425, 0xCA7E, 0x5418, 0xCAA1, 0x543D, 0xCAA2, 0x544F, - 0xCAA3, 0x5441, 0xCAA4, 0x5428, 0xCAA5, 0x5424, 0xCAA6, 0x5447, - 0xCAA7, 0x56EE, 0xCAA8, 0x56E7, 0xCAA9, 0x56E5, 0xCAAA, 0x5741, - 0xCAAB, 0x5745, 0xCAAC, 0x574C, 0xCAAD, 0x5749, 0xCAAE, 0x574B, - 0xCAAF, 0x5752, 0xCAB0, 0x5906, 0xCAB1, 0x5940, 0xCAB2, 0x59A6, - 0xCAB3, 0x5998, 0xCAB4, 0x59A0, 0xCAB5, 0x5997, 0xCAB6, 0x598E, - 0xCAB7, 0x59A2, 0xCAB8, 0x5990, 0xCAB9, 0x598F, 0xCABA, 0x59A7, - 0xCABB, 0x59A1, 0xCABC, 0x5B8E, 0xCABD, 0x5B92, 0xCABE, 0x5C28, - 0xCABF, 0x5C2A, 0xCAC0, 0x5C8D, 0xCAC1, 0x5C8F, 0xCAC2, 0x5C88, - 0xCAC3, 0x5C8B, 0xCAC4, 0x5C89, 0xCAC5, 0x5C92, 0xCAC6, 0x5C8A, - 0xCAC7, 0x5C86, 0xCAC8, 0x5C93, 0xCAC9, 0x5C95, 0xCACA, 0x5DE0, - 0xCACB, 0x5E0A, 0xCACC, 0x5E0E, 0xCACD, 0x5E8B, 0xCACE, 0x5E89, - 0xCACF, 0x5E8C, 0xCAD0, 0x5E88, 0xCAD1, 0x5E8D, 0xCAD2, 0x5F05, - 0xCAD3, 0x5F1D, 0xCAD4, 0x5F78, 0xCAD5, 0x5F76, 0xCAD6, 0x5FD2, - 0xCAD7, 0x5FD1, 0xCAD8, 0x5FD0, 0xCAD9, 0x5FED, 0xCADA, 0x5FE8, - 0xCADB, 0x5FEE, 0xCADC, 0x5FF3, 0xCADD, 0x5FE1, 0xCADE, 0x5FE4, - 0xCADF, 0x5FE3, 0xCAE0, 0x5FFA, 0xCAE1, 0x5FEF, 0xCAE2, 0x5FF7, - 0xCAE3, 0x5FFB, 0xCAE4, 0x6000, 0xCAE5, 0x5FF4, 0xCAE6, 0x623A, - 0xCAE7, 0x6283, 0xCAE8, 0x628C, 0xCAE9, 0x628E, 0xCAEA, 0x628F, - 0xCAEB, 0x6294, 0xCAEC, 0x6287, 0xCAED, 0x6271, 0xCAEE, 0x627B, - 0xCAEF, 0x627A, 0xCAF0, 0x6270, 0xCAF1, 0x6281, 0xCAF2, 0x6288, - 0xCAF3, 0x6277, 0xCAF4, 0x627D, 0xCAF5, 0x6272, 0xCAF6, 0x6274, - 0xCAF7, 0x6537, 0xCAF8, 0x65F0, 0xCAF9, 0x65F4, 0xCAFA, 0x65F3, - 0xCAFB, 0x65F2, 0xCAFC, 0x65F5, 0xCAFD, 0x6745, 0xCAFE, 0x6747, - 0xCB40, 0x6759, 0xCB41, 0x6755, 0xCB42, 0x674C, 0xCB43, 0x6748, - 0xCB44, 0x675D, 0xCB45, 0x674D, 0xCB46, 0x675A, 0xCB47, 0x674B, - 0xCB48, 0x6BD0, 0xCB49, 0x6C19, 0xCB4A, 0x6C1A, 0xCB4B, 0x6C78, - 0xCB4C, 0x6C67, 0xCB4D, 0x6C6B, 0xCB4E, 0x6C84, 0xCB4F, 0x6C8B, - 0xCB50, 0x6C8F, 0xCB51, 0x6C71, 0xCB52, 0x6C6F, 0xCB53, 0x6C69, - 0xCB54, 0x6C9A, 0xCB55, 0x6C6D, 0xCB56, 0x6C87, 0xCB57, 0x6C95, - 0xCB58, 0x6C9C, 0xCB59, 0x6C66, 0xCB5A, 0x6C73, 0xCB5B, 0x6C65, - 0xCB5C, 0x6C7B, 0xCB5D, 0x6C8E, 0xCB5E, 0x7074, 0xCB5F, 0x707A, - 0xCB60, 0x7263, 0xCB61, 0x72BF, 0xCB62, 0x72BD, 0xCB63, 0x72C3, - 0xCB64, 0x72C6, 0xCB65, 0x72C1, 0xCB66, 0x72BA, 0xCB67, 0x72C5, - 0xCB68, 0x7395, 0xCB69, 0x7397, 0xCB6A, 0x7393, 0xCB6B, 0x7394, - 0xCB6C, 0x7392, 0xCB6D, 0x753A, 0xCB6E, 0x7539, 0xCB6F, 0x7594, - 0xCB70, 0x7595, 0xCB71, 0x7681, 0xCB72, 0x793D, 0xCB73, 0x8034, - 0xCB74, 0x8095, 0xCB75, 0x8099, 0xCB76, 0x8090, 0xCB77, 0x8092, - 0xCB78, 0x809C, 0xCB79, 0x8290, 0xCB7A, 0x828F, 0xCB7B, 0x8285, - 0xCB7C, 0x828E, 0xCB7D, 0x8291, 0xCB7E, 0x8293, 0xCBA1, 0x828A, - 0xCBA2, 0x8283, 0xCBA3, 0x8284, 0xCBA4, 0x8C78, 0xCBA5, 0x8FC9, - 0xCBA6, 0x8FBF, 0xCBA7, 0x909F, 0xCBA8, 0x90A1, 0xCBA9, 0x90A5, - 0xCBAA, 0x909E, 0xCBAB, 0x90A7, 0xCBAC, 0x90A0, 0xCBAD, 0x9630, - 0xCBAE, 0x9628, 0xCBAF, 0x962F, 0xCBB0, 0x962D, 0xCBB1, 0x4E33, - 0xCBB2, 0x4F98, 0xCBB3, 0x4F7C, 0xCBB4, 0x4F85, 0xCBB5, 0x4F7D, - 0xCBB6, 0x4F80, 0xCBB7, 0x4F87, 0xCBB8, 0x4F76, 0xCBB9, 0x4F74, - 0xCBBA, 0x4F89, 0xCBBB, 0x4F84, 0xCBBC, 0x4F77, 0xCBBD, 0x4F4C, - 0xCBBE, 0x4F97, 0xCBBF, 0x4F6A, 0xCBC0, 0x4F9A, 0xCBC1, 0x4F79, - 0xCBC2, 0x4F81, 0xCBC3, 0x4F78, 0xCBC4, 0x4F90, 0xCBC5, 0x4F9C, - 0xCBC6, 0x4F94, 0xCBC7, 0x4F9E, 0xCBC8, 0x4F92, 0xCBC9, 0x4F82, - 0xCBCA, 0x4F95, 0xCBCB, 0x4F6B, 0xCBCC, 0x4F6E, 0xCBCD, 0x519E, - 0xCBCE, 0x51BC, 0xCBCF, 0x51BE, 0xCBD0, 0x5235, 0xCBD1, 0x5232, - 0xCBD2, 0x5233, 0xCBD3, 0x5246, 0xCBD4, 0x5231, 0xCBD5, 0x52BC, - 0xCBD6, 0x530A, 0xCBD7, 0x530B, 0xCBD8, 0x533C, 0xCBD9, 0x5392, - 0xCBDA, 0x5394, 0xCBDB, 0x5487, 0xCBDC, 0x547F, 0xCBDD, 0x5481, - 0xCBDE, 0x5491, 0xCBDF, 0x5482, 0xCBE0, 0x5488, 0xCBE1, 0x546B, - 0xCBE2, 0x547A, 0xCBE3, 0x547E, 0xCBE4, 0x5465, 0xCBE5, 0x546C, - 0xCBE6, 0x5474, 0xCBE7, 0x5466, 0xCBE8, 0x548D, 0xCBE9, 0x546F, - 0xCBEA, 0x5461, 0xCBEB, 0x5460, 0xCBEC, 0x5498, 0xCBED, 0x5463, - 0xCBEE, 0x5467, 0xCBEF, 0x5464, 0xCBF0, 0x56F7, 0xCBF1, 0x56F9, - 0xCBF2, 0x576F, 0xCBF3, 0x5772, 0xCBF4, 0x576D, 0xCBF5, 0x576B, - 0xCBF6, 0x5771, 0xCBF7, 0x5770, 0xCBF8, 0x5776, 0xCBF9, 0x5780, - 0xCBFA, 0x5775, 0xCBFB, 0x577B, 0xCBFC, 0x5773, 0xCBFD, 0x5774, - 0xCBFE, 0x5762, 0xCC40, 0x5768, 0xCC41, 0x577D, 0xCC42, 0x590C, - 0xCC43, 0x5945, 0xCC44, 0x59B5, 0xCC45, 0x59BA, 0xCC46, 0x59CF, - 0xCC47, 0x59CE, 0xCC48, 0x59B2, 0xCC49, 0x59CC, 0xCC4A, 0x59C1, - 0xCC4B, 0x59B6, 0xCC4C, 0x59BC, 0xCC4D, 0x59C3, 0xCC4E, 0x59D6, - 0xCC4F, 0x59B1, 0xCC50, 0x59BD, 0xCC51, 0x59C0, 0xCC52, 0x59C8, - 0xCC53, 0x59B4, 0xCC54, 0x59C7, 0xCC55, 0x5B62, 0xCC56, 0x5B65, - 0xCC57, 0x5B93, 0xCC58, 0x5B95, 0xCC59, 0x5C44, 0xCC5A, 0x5C47, - 0xCC5B, 0x5CAE, 0xCC5C, 0x5CA4, 0xCC5D, 0x5CA0, 0xCC5E, 0x5CB5, - 0xCC5F, 0x5CAF, 0xCC60, 0x5CA8, 0xCC61, 0x5CAC, 0xCC62, 0x5C9F, - 0xCC63, 0x5CA3, 0xCC64, 0x5CAD, 0xCC65, 0x5CA2, 0xCC66, 0x5CAA, - 0xCC67, 0x5CA7, 0xCC68, 0x5C9D, 0xCC69, 0x5CA5, 0xCC6A, 0x5CB6, - 0xCC6B, 0x5CB0, 0xCC6C, 0x5CA6, 0xCC6D, 0x5E17, 0xCC6E, 0x5E14, - 0xCC6F, 0x5E19, 0xCC70, 0x5F28, 0xCC71, 0x5F22, 0xCC72, 0x5F23, - 0xCC73, 0x5F24, 0xCC74, 0x5F54, 0xCC75, 0x5F82, 0xCC76, 0x5F7E, - 0xCC77, 0x5F7D, 0xCC78, 0x5FDE, 0xCC79, 0x5FE5, 0xCC7A, 0x602D, - 0xCC7B, 0x6026, 0xCC7C, 0x6019, 0xCC7D, 0x6032, 0xCC7E, 0x600B, - 0xCCA1, 0x6034, 0xCCA2, 0x600A, 0xCCA3, 0x6017, 0xCCA4, 0x6033, - 0xCCA5, 0x601A, 0xCCA6, 0x601E, 0xCCA7, 0x602C, 0xCCA8, 0x6022, - 0xCCA9, 0x600D, 0xCCAA, 0x6010, 0xCCAB, 0x602E, 0xCCAC, 0x6013, - 0xCCAD, 0x6011, 0xCCAE, 0x600C, 0xCCAF, 0x6009, 0xCCB0, 0x601C, - 0xCCB1, 0x6214, 0xCCB2, 0x623D, 0xCCB3, 0x62AD, 0xCCB4, 0x62B4, - 0xCCB5, 0x62D1, 0xCCB6, 0x62BE, 0xCCB7, 0x62AA, 0xCCB8, 0x62B6, - 0xCCB9, 0x62CA, 0xCCBA, 0x62AE, 0xCCBB, 0x62B3, 0xCCBC, 0x62AF, - 0xCCBD, 0x62BB, 0xCCBE, 0x62A9, 0xCCBF, 0x62B0, 0xCCC0, 0x62B8, - 0xCCC1, 0x653D, 0xCCC2, 0x65A8, 0xCCC3, 0x65BB, 0xCCC4, 0x6609, - 0xCCC5, 0x65FC, 0xCCC6, 0x6604, 0xCCC7, 0x6612, 0xCCC8, 0x6608, - 0xCCC9, 0x65FB, 0xCCCA, 0x6603, 0xCCCB, 0x660B, 0xCCCC, 0x660D, - 0xCCCD, 0x6605, 0xCCCE, 0x65FD, 0xCCCF, 0x6611, 0xCCD0, 0x6610, - 0xCCD1, 0x66F6, 0xCCD2, 0x670A, 0xCCD3, 0x6785, 0xCCD4, 0x676C, - 0xCCD5, 0x678E, 0xCCD6, 0x6792, 0xCCD7, 0x6776, 0xCCD8, 0x677B, - 0xCCD9, 0x6798, 0xCCDA, 0x6786, 0xCCDB, 0x6784, 0xCCDC, 0x6774, - 0xCCDD, 0x678D, 0xCCDE, 0x678C, 0xCCDF, 0x677A, 0xCCE0, 0x679F, - 0xCCE1, 0x6791, 0xCCE2, 0x6799, 0xCCE3, 0x6783, 0xCCE4, 0x677D, - 0xCCE5, 0x6781, 0xCCE6, 0x6778, 0xCCE7, 0x6779, 0xCCE8, 0x6794, - 0xCCE9, 0x6B25, 0xCCEA, 0x6B80, 0xCCEB, 0x6B7E, 0xCCEC, 0x6BDE, - 0xCCED, 0x6C1D, 0xCCEE, 0x6C93, 0xCCEF, 0x6CEC, 0xCCF0, 0x6CEB, - 0xCCF1, 0x6CEE, 0xCCF2, 0x6CD9, 0xCCF3, 0x6CB6, 0xCCF4, 0x6CD4, - 0xCCF5, 0x6CAD, 0xCCF6, 0x6CE7, 0xCCF7, 0x6CB7, 0xCCF8, 0x6CD0, - 0xCCF9, 0x6CC2, 0xCCFA, 0x6CBA, 0xCCFB, 0x6CC3, 0xCCFC, 0x6CC6, - 0xCCFD, 0x6CED, 0xCCFE, 0x6CF2, 0xCD40, 0x6CD2, 0xCD41, 0x6CDD, - 0xCD42, 0x6CB4, 0xCD43, 0x6C8A, 0xCD44, 0x6C9D, 0xCD45, 0x6C80, - 0xCD46, 0x6CDE, 0xCD47, 0x6CC0, 0xCD48, 0x6D30, 0xCD49, 0x6CCD, - 0xCD4A, 0x6CC7, 0xCD4B, 0x6CB0, 0xCD4C, 0x6CF9, 0xCD4D, 0x6CCF, - 0xCD4E, 0x6CE9, 0xCD4F, 0x6CD1, 0xCD50, 0x7094, 0xCD51, 0x7098, - 0xCD52, 0x7085, 0xCD53, 0x7093, 0xCD54, 0x7086, 0xCD55, 0x7084, - 0xCD56, 0x7091, 0xCD57, 0x7096, 0xCD58, 0x7082, 0xCD59, 0x709A, - 0xCD5A, 0x7083, 0xCD5B, 0x726A, 0xCD5C, 0x72D6, 0xCD5D, 0x72CB, - 0xCD5E, 0x72D8, 0xCD5F, 0x72C9, 0xCD60, 0x72DC, 0xCD61, 0x72D2, - 0xCD62, 0x72D4, 0xCD63, 0x72DA, 0xCD64, 0x72CC, 0xCD65, 0x72D1, - 0xCD66, 0x73A4, 0xCD67, 0x73A1, 0xCD68, 0x73AD, 0xCD69, 0x73A6, - 0xCD6A, 0x73A2, 0xCD6B, 0x73A0, 0xCD6C, 0x73AC, 0xCD6D, 0x739D, - 0xCD6E, 0x74DD, 0xCD6F, 0x74E8, 0xCD70, 0x753F, 0xCD71, 0x7540, - 0xCD72, 0x753E, 0xCD73, 0x758C, 0xCD74, 0x7598, 0xCD75, 0x76AF, - 0xCD76, 0x76F3, 0xCD77, 0x76F1, 0xCD78, 0x76F0, 0xCD79, 0x76F5, - 0xCD7A, 0x77F8, 0xCD7B, 0x77FC, 0xCD7C, 0x77F9, 0xCD7D, 0x77FB, - 0xCD7E, 0x77FA, 0xCDA1, 0x77F7, 0xCDA2, 0x7942, 0xCDA3, 0x793F, - 0xCDA4, 0x79C5, 0xCDA5, 0x7A78, 0xCDA6, 0x7A7B, 0xCDA7, 0x7AFB, - 0xCDA8, 0x7C75, 0xCDA9, 0x7CFD, 0xCDAA, 0x8035, 0xCDAB, 0x808F, - 0xCDAC, 0x80AE, 0xCDAD, 0x80A3, 0xCDAE, 0x80B8, 0xCDAF, 0x80B5, - 0xCDB0, 0x80AD, 0xCDB1, 0x8220, 0xCDB2, 0x82A0, 0xCDB3, 0x82C0, - 0xCDB4, 0x82AB, 0xCDB5, 0x829A, 0xCDB6, 0x8298, 0xCDB7, 0x829B, - 0xCDB8, 0x82B5, 0xCDB9, 0x82A7, 0xCDBA, 0x82AE, 0xCDBB, 0x82BC, - 0xCDBC, 0x829E, 0xCDBD, 0x82BA, 0xCDBE, 0x82B4, 0xCDBF, 0x82A8, - 0xCDC0, 0x82A1, 0xCDC1, 0x82A9, 0xCDC2, 0x82C2, 0xCDC3, 0x82A4, - 0xCDC4, 0x82C3, 0xCDC5, 0x82B6, 0xCDC6, 0x82A2, 0xCDC7, 0x8670, - 0xCDC8, 0x866F, 0xCDC9, 0x866D, 0xCDCA, 0x866E, 0xCDCB, 0x8C56, - 0xCDCC, 0x8FD2, 0xCDCD, 0x8FCB, 0xCDCE, 0x8FD3, 0xCDCF, 0x8FCD, - 0xCDD0, 0x8FD6, 0xCDD1, 0x8FD5, 0xCDD2, 0x8FD7, 0xCDD3, 0x90B2, - 0xCDD4, 0x90B4, 0xCDD5, 0x90AF, 0xCDD6, 0x90B3, 0xCDD7, 0x90B0, - 0xCDD8, 0x9639, 0xCDD9, 0x963D, 0xCDDA, 0x963C, 0xCDDB, 0x963A, - 0xCDDC, 0x9643, 0xCDDD, 0x4FCD, 0xCDDE, 0x4FC5, 0xCDDF, 0x4FD3, - 0xCDE0, 0x4FB2, 0xCDE1, 0x4FC9, 0xCDE2, 0x4FCB, 0xCDE3, 0x4FC1, - 0xCDE4, 0x4FD4, 0xCDE5, 0x4FDC, 0xCDE6, 0x4FD9, 0xCDE7, 0x4FBB, - 0xCDE8, 0x4FB3, 0xCDE9, 0x4FDB, 0xCDEA, 0x4FC7, 0xCDEB, 0x4FD6, - 0xCDEC, 0x4FBA, 0xCDED, 0x4FC0, 0xCDEE, 0x4FB9, 0xCDEF, 0x4FEC, - 0xCDF0, 0x5244, 0xCDF1, 0x5249, 0xCDF2, 0x52C0, 0xCDF3, 0x52C2, - 0xCDF4, 0x533D, 0xCDF5, 0x537C, 0xCDF6, 0x5397, 0xCDF7, 0x5396, - 0xCDF8, 0x5399, 0xCDF9, 0x5398, 0xCDFA, 0x54BA, 0xCDFB, 0x54A1, - 0xCDFC, 0x54AD, 0xCDFD, 0x54A5, 0xCDFE, 0x54CF, 0xCE40, 0x54C3, - 0xCE41, 0x830D, 0xCE42, 0x54B7, 0xCE43, 0x54AE, 0xCE44, 0x54D6, - 0xCE45, 0x54B6, 0xCE46, 0x54C5, 0xCE47, 0x54C6, 0xCE48, 0x54A0, - 0xCE49, 0x5470, 0xCE4A, 0x54BC, 0xCE4B, 0x54A2, 0xCE4C, 0x54BE, - 0xCE4D, 0x5472, 0xCE4E, 0x54DE, 0xCE4F, 0x54B0, 0xCE50, 0x57B5, - 0xCE51, 0x579E, 0xCE52, 0x579F, 0xCE53, 0x57A4, 0xCE54, 0x578C, - 0xCE55, 0x5797, 0xCE56, 0x579D, 0xCE57, 0x579B, 0xCE58, 0x5794, - 0xCE59, 0x5798, 0xCE5A, 0x578F, 0xCE5B, 0x5799, 0xCE5C, 0x57A5, - 0xCE5D, 0x579A, 0xCE5E, 0x5795, 0xCE5F, 0x58F4, 0xCE60, 0x590D, - 0xCE61, 0x5953, 0xCE62, 0x59E1, 0xCE63, 0x59DE, 0xCE64, 0x59EE, - 0xCE65, 0x5A00, 0xCE66, 0x59F1, 0xCE67, 0x59DD, 0xCE68, 0x59FA, - 0xCE69, 0x59FD, 0xCE6A, 0x59FC, 0xCE6B, 0x59F6, 0xCE6C, 0x59E4, - 0xCE6D, 0x59F2, 0xCE6E, 0x59F7, 0xCE6F, 0x59DB, 0xCE70, 0x59E9, - 0xCE71, 0x59F3, 0xCE72, 0x59F5, 0xCE73, 0x59E0, 0xCE74, 0x59FE, - 0xCE75, 0x59F4, 0xCE76, 0x59ED, 0xCE77, 0x5BA8, 0xCE78, 0x5C4C, - 0xCE79, 0x5CD0, 0xCE7A, 0x5CD8, 0xCE7B, 0x5CCC, 0xCE7C, 0x5CD7, - 0xCE7D, 0x5CCB, 0xCE7E, 0x5CDB, 0xCEA1, 0x5CDE, 0xCEA2, 0x5CDA, - 0xCEA3, 0x5CC9, 0xCEA4, 0x5CC7, 0xCEA5, 0x5CCA, 0xCEA6, 0x5CD6, - 0xCEA7, 0x5CD3, 0xCEA8, 0x5CD4, 0xCEA9, 0x5CCF, 0xCEAA, 0x5CC8, - 0xCEAB, 0x5CC6, 0xCEAC, 0x5CCE, 0xCEAD, 0x5CDF, 0xCEAE, 0x5CF8, - 0xCEAF, 0x5DF9, 0xCEB0, 0x5E21, 0xCEB1, 0x5E22, 0xCEB2, 0x5E23, - 0xCEB3, 0x5E20, 0xCEB4, 0x5E24, 0xCEB5, 0x5EB0, 0xCEB6, 0x5EA4, - 0xCEB7, 0x5EA2, 0xCEB8, 0x5E9B, 0xCEB9, 0x5EA3, 0xCEBA, 0x5EA5, - 0xCEBB, 0x5F07, 0xCEBC, 0x5F2E, 0xCEBD, 0x5F56, 0xCEBE, 0x5F86, - 0xCEBF, 0x6037, 0xCEC0, 0x6039, 0xCEC1, 0x6054, 0xCEC2, 0x6072, - 0xCEC3, 0x605E, 0xCEC4, 0x6045, 0xCEC5, 0x6053, 0xCEC6, 0x6047, - 0xCEC7, 0x6049, 0xCEC8, 0x605B, 0xCEC9, 0x604C, 0xCECA, 0x6040, - 0xCECB, 0x6042, 0xCECC, 0x605F, 0xCECD, 0x6024, 0xCECE, 0x6044, - 0xCECF, 0x6058, 0xCED0, 0x6066, 0xCED1, 0x606E, 0xCED2, 0x6242, - 0xCED3, 0x6243, 0xCED4, 0x62CF, 0xCED5, 0x630D, 0xCED6, 0x630B, - 0xCED7, 0x62F5, 0xCED8, 0x630E, 0xCED9, 0x6303, 0xCEDA, 0x62EB, - 0xCEDB, 0x62F9, 0xCEDC, 0x630F, 0xCEDD, 0x630C, 0xCEDE, 0x62F8, - 0xCEDF, 0x62F6, 0xCEE0, 0x6300, 0xCEE1, 0x6313, 0xCEE2, 0x6314, - 0xCEE3, 0x62FA, 0xCEE4, 0x6315, 0xCEE5, 0x62FB, 0xCEE6, 0x62F0, - 0xCEE7, 0x6541, 0xCEE8, 0x6543, 0xCEE9, 0x65AA, 0xCEEA, 0x65BF, - 0xCEEB, 0x6636, 0xCEEC, 0x6621, 0xCEED, 0x6632, 0xCEEE, 0x6635, - 0xCEEF, 0x661C, 0xCEF0, 0x6626, 0xCEF1, 0x6622, 0xCEF2, 0x6633, - 0xCEF3, 0x662B, 0xCEF4, 0x663A, 0xCEF5, 0x661D, 0xCEF6, 0x6634, - 0xCEF7, 0x6639, 0xCEF8, 0x662E, 0xCEF9, 0x670F, 0xCEFA, 0x6710, - 0xCEFB, 0x67C1, 0xCEFC, 0x67F2, 0xCEFD, 0x67C8, 0xCEFE, 0x67BA, - 0xCF40, 0x67DC, 0xCF41, 0x67BB, 0xCF42, 0x67F8, 0xCF43, 0x67D8, - 0xCF44, 0x67C0, 0xCF45, 0x67B7, 0xCF46, 0x67C5, 0xCF47, 0x67EB, - 0xCF48, 0x67E4, 0xCF49, 0x67DF, 0xCF4A, 0x67B5, 0xCF4B, 0x67CD, - 0xCF4C, 0x67B3, 0xCF4D, 0x67F7, 0xCF4E, 0x67F6, 0xCF4F, 0x67EE, - 0xCF50, 0x67E3, 0xCF51, 0x67C2, 0xCF52, 0x67B9, 0xCF53, 0x67CE, - 0xCF54, 0x67E7, 0xCF55, 0x67F0, 0xCF56, 0x67B2, 0xCF57, 0x67FC, - 0xCF58, 0x67C6, 0xCF59, 0x67ED, 0xCF5A, 0x67CC, 0xCF5B, 0x67AE, - 0xCF5C, 0x67E6, 0xCF5D, 0x67DB, 0xCF5E, 0x67FA, 0xCF5F, 0x67C9, - 0xCF60, 0x67CA, 0xCF61, 0x67C3, 0xCF62, 0x67EA, 0xCF63, 0x67CB, - 0xCF64, 0x6B28, 0xCF65, 0x6B82, 0xCF66, 0x6B84, 0xCF67, 0x6BB6, - 0xCF68, 0x6BD6, 0xCF69, 0x6BD8, 0xCF6A, 0x6BE0, 0xCF6B, 0x6C20, - 0xCF6C, 0x6C21, 0xCF6D, 0x6D28, 0xCF6E, 0x6D34, 0xCF6F, 0x6D2D, - 0xCF70, 0x6D1F, 0xCF71, 0x6D3C, 0xCF72, 0x6D3F, 0xCF73, 0x6D12, - 0xCF74, 0x6D0A, 0xCF75, 0x6CDA, 0xCF76, 0x6D33, 0xCF77, 0x6D04, - 0xCF78, 0x6D19, 0xCF79, 0x6D3A, 0xCF7A, 0x6D1A, 0xCF7B, 0x6D11, - 0xCF7C, 0x6D00, 0xCF7D, 0x6D1D, 0xCF7E, 0x6D42, 0xCFA1, 0x6D01, - 0xCFA2, 0x6D18, 0xCFA3, 0x6D37, 0xCFA4, 0x6D03, 0xCFA5, 0x6D0F, - 0xCFA6, 0x6D40, 0xCFA7, 0x6D07, 0xCFA8, 0x6D20, 0xCFA9, 0x6D2C, - 0xCFAA, 0x6D08, 0xCFAB, 0x6D22, 0xCFAC, 0x6D09, 0xCFAD, 0x6D10, - 0xCFAE, 0x70B7, 0xCFAF, 0x709F, 0xCFB0, 0x70BE, 0xCFB1, 0x70B1, - 0xCFB2, 0x70B0, 0xCFB3, 0x70A1, 0xCFB4, 0x70B4, 0xCFB5, 0x70B5, - 0xCFB6, 0x70A9, 0xCFB7, 0x7241, 0xCFB8, 0x7249, 0xCFB9, 0x724A, - 0xCFBA, 0x726C, 0xCFBB, 0x7270, 0xCFBC, 0x7273, 0xCFBD, 0x726E, - 0xCFBE, 0x72CA, 0xCFBF, 0x72E4, 0xCFC0, 0x72E8, 0xCFC1, 0x72EB, - 0xCFC2, 0x72DF, 0xCFC3, 0x72EA, 0xCFC4, 0x72E6, 0xCFC5, 0x72E3, - 0xCFC6, 0x7385, 0xCFC7, 0x73CC, 0xCFC8, 0x73C2, 0xCFC9, 0x73C8, - 0xCFCA, 0x73C5, 0xCFCB, 0x73B9, 0xCFCC, 0x73B6, 0xCFCD, 0x73B5, - 0xCFCE, 0x73B4, 0xCFCF, 0x73EB, 0xCFD0, 0x73BF, 0xCFD1, 0x73C7, - 0xCFD2, 0x73BE, 0xCFD3, 0x73C3, 0xCFD4, 0x73C6, 0xCFD5, 0x73B8, - 0xCFD6, 0x73CB, 0xCFD7, 0x74EC, 0xCFD8, 0x74EE, 0xCFD9, 0x752E, - 0xCFDA, 0x7547, 0xCFDB, 0x7548, 0xCFDC, 0x75A7, 0xCFDD, 0x75AA, - 0xCFDE, 0x7679, 0xCFDF, 0x76C4, 0xCFE0, 0x7708, 0xCFE1, 0x7703, - 0xCFE2, 0x7704, 0xCFE3, 0x7705, 0xCFE4, 0x770A, 0xCFE5, 0x76F7, - 0xCFE6, 0x76FB, 0xCFE7, 0x76FA, 0xCFE8, 0x77E7, 0xCFE9, 0x77E8, - 0xCFEA, 0x7806, 0xCFEB, 0x7811, 0xCFEC, 0x7812, 0xCFED, 0x7805, - 0xCFEE, 0x7810, 0xCFEF, 0x780F, 0xCFF0, 0x780E, 0xCFF1, 0x7809, - 0xCFF2, 0x7803, 0xCFF3, 0x7813, 0xCFF4, 0x794A, 0xCFF5, 0x794C, - 0xCFF6, 0x794B, 0xCFF7, 0x7945, 0xCFF8, 0x7944, 0xCFF9, 0x79D5, - 0xCFFA, 0x79CD, 0xCFFB, 0x79CF, 0xCFFC, 0x79D6, 0xCFFD, 0x79CE, - 0xCFFE, 0x7A80, 0xD040, 0x7A7E, 0xD041, 0x7AD1, 0xD042, 0x7B00, - 0xD043, 0x7B01, 0xD044, 0x7C7A, 0xD045, 0x7C78, 0xD046, 0x7C79, - 0xD047, 0x7C7F, 0xD048, 0x7C80, 0xD049, 0x7C81, 0xD04A, 0x7D03, - 0xD04B, 0x7D08, 0xD04C, 0x7D01, 0xD04D, 0x7F58, 0xD04E, 0x7F91, - 0xD04F, 0x7F8D, 0xD050, 0x7FBE, 0xD051, 0x8007, 0xD052, 0x800E, - 0xD053, 0x800F, 0xD054, 0x8014, 0xD055, 0x8037, 0xD056, 0x80D8, - 0xD057, 0x80C7, 0xD058, 0x80E0, 0xD059, 0x80D1, 0xD05A, 0x80C8, - 0xD05B, 0x80C2, 0xD05C, 0x80D0, 0xD05D, 0x80C5, 0xD05E, 0x80E3, - 0xD05F, 0x80D9, 0xD060, 0x80DC, 0xD061, 0x80CA, 0xD062, 0x80D5, - 0xD063, 0x80C9, 0xD064, 0x80CF, 0xD065, 0x80D7, 0xD066, 0x80E6, - 0xD067, 0x80CD, 0xD068, 0x81FF, 0xD069, 0x8221, 0xD06A, 0x8294, - 0xD06B, 0x82D9, 0xD06C, 0x82FE, 0xD06D, 0x82F9, 0xD06E, 0x8307, - 0xD06F, 0x82E8, 0xD070, 0x8300, 0xD071, 0x82D5, 0xD072, 0x833A, - 0xD073, 0x82EB, 0xD074, 0x82D6, 0xD075, 0x82F4, 0xD076, 0x82EC, - 0xD077, 0x82E1, 0xD078, 0x82F2, 0xD079, 0x82F5, 0xD07A, 0x830C, - 0xD07B, 0x82FB, 0xD07C, 0x82F6, 0xD07D, 0x82F0, 0xD07E, 0x82EA, - 0xD0A1, 0x82E4, 0xD0A2, 0x82E0, 0xD0A3, 0x82FA, 0xD0A4, 0x82F3, - 0xD0A5, 0x82ED, 0xD0A6, 0x8677, 0xD0A7, 0x8674, 0xD0A8, 0x867C, - 0xD0A9, 0x8673, 0xD0AA, 0x8841, 0xD0AB, 0x884E, 0xD0AC, 0x8867, - 0xD0AD, 0x886A, 0xD0AE, 0x8869, 0xD0AF, 0x89D3, 0xD0B0, 0x8A04, - 0xD0B1, 0x8A07, 0xD0B2, 0x8D72, 0xD0B3, 0x8FE3, 0xD0B4, 0x8FE1, - 0xD0B5, 0x8FEE, 0xD0B6, 0x8FE0, 0xD0B7, 0x90F1, 0xD0B8, 0x90BD, - 0xD0B9, 0x90BF, 0xD0BA, 0x90D5, 0xD0BB, 0x90C5, 0xD0BC, 0x90BE, - 0xD0BD, 0x90C7, 0xD0BE, 0x90CB, 0xD0BF, 0x90C8, 0xD0C0, 0x91D4, - 0xD0C1, 0x91D3, 0xD0C2, 0x9654, 0xD0C3, 0x964F, 0xD0C4, 0x9651, - 0xD0C5, 0x9653, 0xD0C6, 0x964A, 0xD0C7, 0x964E, 0xD0C8, 0x501E, - 0xD0C9, 0x5005, 0xD0CA, 0x5007, 0xD0CB, 0x5013, 0xD0CC, 0x5022, - 0xD0CD, 0x5030, 0xD0CE, 0x501B, 0xD0CF, 0x4FF5, 0xD0D0, 0x4FF4, - 0xD0D1, 0x5033, 0xD0D2, 0x5037, 0xD0D3, 0x502C, 0xD0D4, 0x4FF6, - 0xD0D5, 0x4FF7, 0xD0D6, 0x5017, 0xD0D7, 0x501C, 0xD0D8, 0x5020, - 0xD0D9, 0x5027, 0xD0DA, 0x5035, 0xD0DB, 0x502F, 0xD0DC, 0x5031, - 0xD0DD, 0x500E, 0xD0DE, 0x515A, 0xD0DF, 0x5194, 0xD0E0, 0x5193, - 0xD0E1, 0x51CA, 0xD0E2, 0x51C4, 0xD0E3, 0x51C5, 0xD0E4, 0x51C8, - 0xD0E5, 0x51CE, 0xD0E6, 0x5261, 0xD0E7, 0x525A, 0xD0E8, 0x5252, - 0xD0E9, 0x525E, 0xD0EA, 0x525F, 0xD0EB, 0x5255, 0xD0EC, 0x5262, - 0xD0ED, 0x52CD, 0xD0EE, 0x530E, 0xD0EF, 0x539E, 0xD0F0, 0x5526, - 0xD0F1, 0x54E2, 0xD0F2, 0x5517, 0xD0F3, 0x5512, 0xD0F4, 0x54E7, - 0xD0F5, 0x54F3, 0xD0F6, 0x54E4, 0xD0F7, 0x551A, 0xD0F8, 0x54FF, - 0xD0F9, 0x5504, 0xD0FA, 0x5508, 0xD0FB, 0x54EB, 0xD0FC, 0x5511, - 0xD0FD, 0x5505, 0xD0FE, 0x54F1, 0xD140, 0x550A, 0xD141, 0x54FB, - 0xD142, 0x54F7, 0xD143, 0x54F8, 0xD144, 0x54E0, 0xD145, 0x550E, - 0xD146, 0x5503, 0xD147, 0x550B, 0xD148, 0x5701, 0xD149, 0x5702, - 0xD14A, 0x57CC, 0xD14B, 0x5832, 0xD14C, 0x57D5, 0xD14D, 0x57D2, - 0xD14E, 0x57BA, 0xD14F, 0x57C6, 0xD150, 0x57BD, 0xD151, 0x57BC, - 0xD152, 0x57B8, 0xD153, 0x57B6, 0xD154, 0x57BF, 0xD155, 0x57C7, - 0xD156, 0x57D0, 0xD157, 0x57B9, 0xD158, 0x57C1, 0xD159, 0x590E, - 0xD15A, 0x594A, 0xD15B, 0x5A19, 0xD15C, 0x5A16, 0xD15D, 0x5A2D, - 0xD15E, 0x5A2E, 0xD15F, 0x5A15, 0xD160, 0x5A0F, 0xD161, 0x5A17, - 0xD162, 0x5A0A, 0xD163, 0x5A1E, 0xD164, 0x5A33, 0xD165, 0x5B6C, - 0xD166, 0x5BA7, 0xD167, 0x5BAD, 0xD168, 0x5BAC, 0xD169, 0x5C03, - 0xD16A, 0x5C56, 0xD16B, 0x5C54, 0xD16C, 0x5CEC, 0xD16D, 0x5CFF, - 0xD16E, 0x5CEE, 0xD16F, 0x5CF1, 0xD170, 0x5CF7, 0xD171, 0x5D00, - 0xD172, 0x5CF9, 0xD173, 0x5E29, 0xD174, 0x5E28, 0xD175, 0x5EA8, - 0xD176, 0x5EAE, 0xD177, 0x5EAA, 0xD178, 0x5EAC, 0xD179, 0x5F33, - 0xD17A, 0x5F30, 0xD17B, 0x5F67, 0xD17C, 0x605D, 0xD17D, 0x605A, - 0xD17E, 0x6067, 0xD1A1, 0x6041, 0xD1A2, 0x60A2, 0xD1A3, 0x6088, - 0xD1A4, 0x6080, 0xD1A5, 0x6092, 0xD1A6, 0x6081, 0xD1A7, 0x609D, - 0xD1A8, 0x6083, 0xD1A9, 0x6095, 0xD1AA, 0x609B, 0xD1AB, 0x6097, - 0xD1AC, 0x6087, 0xD1AD, 0x609C, 0xD1AE, 0x608E, 0xD1AF, 0x6219, - 0xD1B0, 0x6246, 0xD1B1, 0x62F2, 0xD1B2, 0x6310, 0xD1B3, 0x6356, - 0xD1B4, 0x632C, 0xD1B5, 0x6344, 0xD1B6, 0x6345, 0xD1B7, 0x6336, - 0xD1B8, 0x6343, 0xD1B9, 0x63E4, 0xD1BA, 0x6339, 0xD1BB, 0x634B, - 0xD1BC, 0x634A, 0xD1BD, 0x633C, 0xD1BE, 0x6329, 0xD1BF, 0x6341, - 0xD1C0, 0x6334, 0xD1C1, 0x6358, 0xD1C2, 0x6354, 0xD1C3, 0x6359, - 0xD1C4, 0x632D, 0xD1C5, 0x6347, 0xD1C6, 0x6333, 0xD1C7, 0x635A, - 0xD1C8, 0x6351, 0xD1C9, 0x6338, 0xD1CA, 0x6357, 0xD1CB, 0x6340, - 0xD1CC, 0x6348, 0xD1CD, 0x654A, 0xD1CE, 0x6546, 0xD1CF, 0x65C6, - 0xD1D0, 0x65C3, 0xD1D1, 0x65C4, 0xD1D2, 0x65C2, 0xD1D3, 0x664A, - 0xD1D4, 0x665F, 0xD1D5, 0x6647, 0xD1D6, 0x6651, 0xD1D7, 0x6712, - 0xD1D8, 0x6713, 0xD1D9, 0x681F, 0xD1DA, 0x681A, 0xD1DB, 0x6849, - 0xD1DC, 0x6832, 0xD1DD, 0x6833, 0xD1DE, 0x683B, 0xD1DF, 0x684B, - 0xD1E0, 0x684F, 0xD1E1, 0x6816, 0xD1E2, 0x6831, 0xD1E3, 0x681C, - 0xD1E4, 0x6835, 0xD1E5, 0x682B, 0xD1E6, 0x682D, 0xD1E7, 0x682F, - 0xD1E8, 0x684E, 0xD1E9, 0x6844, 0xD1EA, 0x6834, 0xD1EB, 0x681D, - 0xD1EC, 0x6812, 0xD1ED, 0x6814, 0xD1EE, 0x6826, 0xD1EF, 0x6828, - 0xD1F0, 0x682E, 0xD1F1, 0x684D, 0xD1F2, 0x683A, 0xD1F3, 0x6825, - 0xD1F4, 0x6820, 0xD1F5, 0x6B2C, 0xD1F6, 0x6B2F, 0xD1F7, 0x6B2D, - 0xD1F8, 0x6B31, 0xD1F9, 0x6B34, 0xD1FA, 0x6B6D, 0xD1FB, 0x8082, - 0xD1FC, 0x6B88, 0xD1FD, 0x6BE6, 0xD1FE, 0x6BE4, 0xD240, 0x6BE8, - 0xD241, 0x6BE3, 0xD242, 0x6BE2, 0xD243, 0x6BE7, 0xD244, 0x6C25, - 0xD245, 0x6D7A, 0xD246, 0x6D63, 0xD247, 0x6D64, 0xD248, 0x6D76, - 0xD249, 0x6D0D, 0xD24A, 0x6D61, 0xD24B, 0x6D92, 0xD24C, 0x6D58, - 0xD24D, 0x6D62, 0xD24E, 0x6D6D, 0xD24F, 0x6D6F, 0xD250, 0x6D91, - 0xD251, 0x6D8D, 0xD252, 0x6DEF, 0xD253, 0x6D7F, 0xD254, 0x6D86, - 0xD255, 0x6D5E, 0xD256, 0x6D67, 0xD257, 0x6D60, 0xD258, 0x6D97, - 0xD259, 0x6D70, 0xD25A, 0x6D7C, 0xD25B, 0x6D5F, 0xD25C, 0x6D82, - 0xD25D, 0x6D98, 0xD25E, 0x6D2F, 0xD25F, 0x6D68, 0xD260, 0x6D8B, - 0xD261, 0x6D7E, 0xD262, 0x6D80, 0xD263, 0x6D84, 0xD264, 0x6D16, - 0xD265, 0x6D83, 0xD266, 0x6D7B, 0xD267, 0x6D7D, 0xD268, 0x6D75, - 0xD269, 0x6D90, 0xD26A, 0x70DC, 0xD26B, 0x70D3, 0xD26C, 0x70D1, - 0xD26D, 0x70DD, 0xD26E, 0x70CB, 0xD26F, 0x7F39, 0xD270, 0x70E2, - 0xD271, 0x70D7, 0xD272, 0x70D2, 0xD273, 0x70DE, 0xD274, 0x70E0, - 0xD275, 0x70D4, 0xD276, 0x70CD, 0xD277, 0x70C5, 0xD278, 0x70C6, - 0xD279, 0x70C7, 0xD27A, 0x70DA, 0xD27B, 0x70CE, 0xD27C, 0x70E1, - 0xD27D, 0x7242, 0xD27E, 0x7278, 0xD2A1, 0x7277, 0xD2A2, 0x7276, - 0xD2A3, 0x7300, 0xD2A4, 0x72FA, 0xD2A5, 0x72F4, 0xD2A6, 0x72FE, - 0xD2A7, 0x72F6, 0xD2A8, 0x72F3, 0xD2A9, 0x72FB, 0xD2AA, 0x7301, - 0xD2AB, 0x73D3, 0xD2AC, 0x73D9, 0xD2AD, 0x73E5, 0xD2AE, 0x73D6, - 0xD2AF, 0x73BC, 0xD2B0, 0x73E7, 0xD2B1, 0x73E3, 0xD2B2, 0x73E9, - 0xD2B3, 0x73DC, 0xD2B4, 0x73D2, 0xD2B5, 0x73DB, 0xD2B6, 0x73D4, - 0xD2B7, 0x73DD, 0xD2B8, 0x73DA, 0xD2B9, 0x73D7, 0xD2BA, 0x73D8, - 0xD2BB, 0x73E8, 0xD2BC, 0x74DE, 0xD2BD, 0x74DF, 0xD2BE, 0x74F4, - 0xD2BF, 0x74F5, 0xD2C0, 0x7521, 0xD2C1, 0x755B, 0xD2C2, 0x755F, - 0xD2C3, 0x75B0, 0xD2C4, 0x75C1, 0xD2C5, 0x75BB, 0xD2C6, 0x75C4, - 0xD2C7, 0x75C0, 0xD2C8, 0x75BF, 0xD2C9, 0x75B6, 0xD2CA, 0x75BA, - 0xD2CB, 0x768A, 0xD2CC, 0x76C9, 0xD2CD, 0x771D, 0xD2CE, 0x771B, - 0xD2CF, 0x7710, 0xD2D0, 0x7713, 0xD2D1, 0x7712, 0xD2D2, 0x7723, - 0xD2D3, 0x7711, 0xD2D4, 0x7715, 0xD2D5, 0x7719, 0xD2D6, 0x771A, - 0xD2D7, 0x7722, 0xD2D8, 0x7727, 0xD2D9, 0x7823, 0xD2DA, 0x782C, - 0xD2DB, 0x7822, 0xD2DC, 0x7835, 0xD2DD, 0x782F, 0xD2DE, 0x7828, - 0xD2DF, 0x782E, 0xD2E0, 0x782B, 0xD2E1, 0x7821, 0xD2E2, 0x7829, - 0xD2E3, 0x7833, 0xD2E4, 0x782A, 0xD2E5, 0x7831, 0xD2E6, 0x7954, - 0xD2E7, 0x795B, 0xD2E8, 0x794F, 0xD2E9, 0x795C, 0xD2EA, 0x7953, - 0xD2EB, 0x7952, 0xD2EC, 0x7951, 0xD2ED, 0x79EB, 0xD2EE, 0x79EC, - 0xD2EF, 0x79E0, 0xD2F0, 0x79EE, 0xD2F1, 0x79ED, 0xD2F2, 0x79EA, - 0xD2F3, 0x79DC, 0xD2F4, 0x79DE, 0xD2F5, 0x79DD, 0xD2F6, 0x7A86, - 0xD2F7, 0x7A89, 0xD2F8, 0x7A85, 0xD2F9, 0x7A8B, 0xD2FA, 0x7A8C, - 0xD2FB, 0x7A8A, 0xD2FC, 0x7A87, 0xD2FD, 0x7AD8, 0xD2FE, 0x7B10, - 0xD340, 0x7B04, 0xD341, 0x7B13, 0xD342, 0x7B05, 0xD343, 0x7B0F, - 0xD344, 0x7B08, 0xD345, 0x7B0A, 0xD346, 0x7B0E, 0xD347, 0x7B09, - 0xD348, 0x7B12, 0xD349, 0x7C84, 0xD34A, 0x7C91, 0xD34B, 0x7C8A, - 0xD34C, 0x7C8C, 0xD34D, 0x7C88, 0xD34E, 0x7C8D, 0xD34F, 0x7C85, - 0xD350, 0x7D1E, 0xD351, 0x7D1D, 0xD352, 0x7D11, 0xD353, 0x7D0E, - 0xD354, 0x7D18, 0xD355, 0x7D16, 0xD356, 0x7D13, 0xD357, 0x7D1F, - 0xD358, 0x7D12, 0xD359, 0x7D0F, 0xD35A, 0x7D0C, 0xD35B, 0x7F5C, - 0xD35C, 0x7F61, 0xD35D, 0x7F5E, 0xD35E, 0x7F60, 0xD35F, 0x7F5D, - 0xD360, 0x7F5B, 0xD361, 0x7F96, 0xD362, 0x7F92, 0xD363, 0x7FC3, - 0xD364, 0x7FC2, 0xD365, 0x7FC0, 0xD366, 0x8016, 0xD367, 0x803E, - 0xD368, 0x8039, 0xD369, 0x80FA, 0xD36A, 0x80F2, 0xD36B, 0x80F9, - 0xD36C, 0x80F5, 0xD36D, 0x8101, 0xD36E, 0x80FB, 0xD36F, 0x8100, - 0xD370, 0x8201, 0xD371, 0x822F, 0xD372, 0x8225, 0xD373, 0x8333, - 0xD374, 0x832D, 0xD375, 0x8344, 0xD376, 0x8319, 0xD377, 0x8351, - 0xD378, 0x8325, 0xD379, 0x8356, 0xD37A, 0x833F, 0xD37B, 0x8341, - 0xD37C, 0x8326, 0xD37D, 0x831C, 0xD37E, 0x8322, 0xD3A1, 0x8342, - 0xD3A2, 0x834E, 0xD3A3, 0x831B, 0xD3A4, 0x832A, 0xD3A5, 0x8308, - 0xD3A6, 0x833C, 0xD3A7, 0x834D, 0xD3A8, 0x8316, 0xD3A9, 0x8324, - 0xD3AA, 0x8320, 0xD3AB, 0x8337, 0xD3AC, 0x832F, 0xD3AD, 0x8329, - 0xD3AE, 0x8347, 0xD3AF, 0x8345, 0xD3B0, 0x834C, 0xD3B1, 0x8353, - 0xD3B2, 0x831E, 0xD3B3, 0x832C, 0xD3B4, 0x834B, 0xD3B5, 0x8327, - 0xD3B6, 0x8348, 0xD3B7, 0x8653, 0xD3B8, 0x8652, 0xD3B9, 0x86A2, - 0xD3BA, 0x86A8, 0xD3BB, 0x8696, 0xD3BC, 0x868D, 0xD3BD, 0x8691, - 0xD3BE, 0x869E, 0xD3BF, 0x8687, 0xD3C0, 0x8697, 0xD3C1, 0x8686, - 0xD3C2, 0x868B, 0xD3C3, 0x869A, 0xD3C4, 0x8685, 0xD3C5, 0x86A5, - 0xD3C6, 0x8699, 0xD3C7, 0x86A1, 0xD3C8, 0x86A7, 0xD3C9, 0x8695, - 0xD3CA, 0x8698, 0xD3CB, 0x868E, 0xD3CC, 0x869D, 0xD3CD, 0x8690, - 0xD3CE, 0x8694, 0xD3CF, 0x8843, 0xD3D0, 0x8844, 0xD3D1, 0x886D, - 0xD3D2, 0x8875, 0xD3D3, 0x8876, 0xD3D4, 0x8872, 0xD3D5, 0x8880, - 0xD3D6, 0x8871, 0xD3D7, 0x887F, 0xD3D8, 0x886F, 0xD3D9, 0x8883, - 0xD3DA, 0x887E, 0xD3DB, 0x8874, 0xD3DC, 0x887C, 0xD3DD, 0x8A12, - 0xD3DE, 0x8C47, 0xD3DF, 0x8C57, 0xD3E0, 0x8C7B, 0xD3E1, 0x8CA4, - 0xD3E2, 0x8CA3, 0xD3E3, 0x8D76, 0xD3E4, 0x8D78, 0xD3E5, 0x8DB5, - 0xD3E6, 0x8DB7, 0xD3E7, 0x8DB6, 0xD3E8, 0x8ED1, 0xD3E9, 0x8ED3, - 0xD3EA, 0x8FFE, 0xD3EB, 0x8FF5, 0xD3EC, 0x9002, 0xD3ED, 0x8FFF, - 0xD3EE, 0x8FFB, 0xD3EF, 0x9004, 0xD3F0, 0x8FFC, 0xD3F1, 0x8FF6, - 0xD3F2, 0x90D6, 0xD3F3, 0x90E0, 0xD3F4, 0x90D9, 0xD3F5, 0x90DA, - 0xD3F6, 0x90E3, 0xD3F7, 0x90DF, 0xD3F8, 0x90E5, 0xD3F9, 0x90D8, - 0xD3FA, 0x90DB, 0xD3FB, 0x90D7, 0xD3FC, 0x90DC, 0xD3FD, 0x90E4, - 0xD3FE, 0x9150, 0xD440, 0x914E, 0xD441, 0x914F, 0xD442, 0x91D5, - 0xD443, 0x91E2, 0xD444, 0x91DA, 0xD445, 0x965C, 0xD446, 0x965F, - 0xD447, 0x96BC, 0xD448, 0x98E3, 0xD449, 0x9ADF, 0xD44A, 0x9B2F, - 0xD44B, 0x4E7F, 0xD44C, 0x5070, 0xD44D, 0x506A, 0xD44E, 0x5061, - 0xD44F, 0x505E, 0xD450, 0x5060, 0xD451, 0x5053, 0xD452, 0x504B, - 0xD453, 0x505D, 0xD454, 0x5072, 0xD455, 0x5048, 0xD456, 0x504D, - 0xD457, 0x5041, 0xD458, 0x505B, 0xD459, 0x504A, 0xD45A, 0x5062, - 0xD45B, 0x5015, 0xD45C, 0x5045, 0xD45D, 0x505F, 0xD45E, 0x5069, - 0xD45F, 0x506B, 0xD460, 0x5063, 0xD461, 0x5064, 0xD462, 0x5046, - 0xD463, 0x5040, 0xD464, 0x506E, 0xD465, 0x5073, 0xD466, 0x5057, - 0xD467, 0x5051, 0xD468, 0x51D0, 0xD469, 0x526B, 0xD46A, 0x526D, - 0xD46B, 0x526C, 0xD46C, 0x526E, 0xD46D, 0x52D6, 0xD46E, 0x52D3, - 0xD46F, 0x532D, 0xD470, 0x539C, 0xD471, 0x5575, 0xD472, 0x5576, - 0xD473, 0x553C, 0xD474, 0x554D, 0xD475, 0x5550, 0xD476, 0x5534, - 0xD477, 0x552A, 0xD478, 0x5551, 0xD479, 0x5562, 0xD47A, 0x5536, - 0xD47B, 0x5535, 0xD47C, 0x5530, 0xD47D, 0x5552, 0xD47E, 0x5545, - 0xD4A1, 0x550C, 0xD4A2, 0x5532, 0xD4A3, 0x5565, 0xD4A4, 0x554E, - 0xD4A5, 0x5539, 0xD4A6, 0x5548, 0xD4A7, 0x552D, 0xD4A8, 0x553B, - 0xD4A9, 0x5540, 0xD4AA, 0x554B, 0xD4AB, 0x570A, 0xD4AC, 0x5707, - 0xD4AD, 0x57FB, 0xD4AE, 0x5814, 0xD4AF, 0x57E2, 0xD4B0, 0x57F6, - 0xD4B1, 0x57DC, 0xD4B2, 0x57F4, 0xD4B3, 0x5800, 0xD4B4, 0x57ED, - 0xD4B5, 0x57FD, 0xD4B6, 0x5808, 0xD4B7, 0x57F8, 0xD4B8, 0x580B, - 0xD4B9, 0x57F3, 0xD4BA, 0x57CF, 0xD4BB, 0x5807, 0xD4BC, 0x57EE, - 0xD4BD, 0x57E3, 0xD4BE, 0x57F2, 0xD4BF, 0x57E5, 0xD4C0, 0x57EC, - 0xD4C1, 0x57E1, 0xD4C2, 0x580E, 0xD4C3, 0x57FC, 0xD4C4, 0x5810, - 0xD4C5, 0x57E7, 0xD4C6, 0x5801, 0xD4C7, 0x580C, 0xD4C8, 0x57F1, - 0xD4C9, 0x57E9, 0xD4CA, 0x57F0, 0xD4CB, 0x580D, 0xD4CC, 0x5804, - 0xD4CD, 0x595C, 0xD4CE, 0x5A60, 0xD4CF, 0x5A58, 0xD4D0, 0x5A55, - 0xD4D1, 0x5A67, 0xD4D2, 0x5A5E, 0xD4D3, 0x5A38, 0xD4D4, 0x5A35, - 0xD4D5, 0x5A6D, 0xD4D6, 0x5A50, 0xD4D7, 0x5A5F, 0xD4D8, 0x5A65, - 0xD4D9, 0x5A6C, 0xD4DA, 0x5A53, 0xD4DB, 0x5A64, 0xD4DC, 0x5A57, - 0xD4DD, 0x5A43, 0xD4DE, 0x5A5D, 0xD4DF, 0x5A52, 0xD4E0, 0x5A44, - 0xD4E1, 0x5A5B, 0xD4E2, 0x5A48, 0xD4E3, 0x5A8E, 0xD4E4, 0x5A3E, - 0xD4E5, 0x5A4D, 0xD4E6, 0x5A39, 0xD4E7, 0x5A4C, 0xD4E8, 0x5A70, - 0xD4E9, 0x5A69, 0xD4EA, 0x5A47, 0xD4EB, 0x5A51, 0xD4EC, 0x5A56, - 0xD4ED, 0x5A42, 0xD4EE, 0x5A5C, 0xD4EF, 0x5B72, 0xD4F0, 0x5B6E, - 0xD4F1, 0x5BC1, 0xD4F2, 0x5BC0, 0xD4F3, 0x5C59, 0xD4F4, 0x5D1E, - 0xD4F5, 0x5D0B, 0xD4F6, 0x5D1D, 0xD4F7, 0x5D1A, 0xD4F8, 0x5D20, - 0xD4F9, 0x5D0C, 0xD4FA, 0x5D28, 0xD4FB, 0x5D0D, 0xD4FC, 0x5D26, - 0xD4FD, 0x5D25, 0xD4FE, 0x5D0F, 0xD540, 0x5D30, 0xD541, 0x5D12, - 0xD542, 0x5D23, 0xD543, 0x5D1F, 0xD544, 0x5D2E, 0xD545, 0x5E3E, - 0xD546, 0x5E34, 0xD547, 0x5EB1, 0xD548, 0x5EB4, 0xD549, 0x5EB9, - 0xD54A, 0x5EB2, 0xD54B, 0x5EB3, 0xD54C, 0x5F36, 0xD54D, 0x5F38, - 0xD54E, 0x5F9B, 0xD54F, 0x5F96, 0xD550, 0x5F9F, 0xD551, 0x608A, - 0xD552, 0x6090, 0xD553, 0x6086, 0xD554, 0x60BE, 0xD555, 0x60B0, - 0xD556, 0x60BA, 0xD557, 0x60D3, 0xD558, 0x60D4, 0xD559, 0x60CF, - 0xD55A, 0x60E4, 0xD55B, 0x60D9, 0xD55C, 0x60DD, 0xD55D, 0x60C8, - 0xD55E, 0x60B1, 0xD55F, 0x60DB, 0xD560, 0x60B7, 0xD561, 0x60CA, - 0xD562, 0x60BF, 0xD563, 0x60C3, 0xD564, 0x60CD, 0xD565, 0x60C0, - 0xD566, 0x6332, 0xD567, 0x6365, 0xD568, 0x638A, 0xD569, 0x6382, - 0xD56A, 0x637D, 0xD56B, 0x63BD, 0xD56C, 0x639E, 0xD56D, 0x63AD, - 0xD56E, 0x639D, 0xD56F, 0x6397, 0xD570, 0x63AB, 0xD571, 0x638E, - 0xD572, 0x636F, 0xD573, 0x6387, 0xD574, 0x6390, 0xD575, 0x636E, - 0xD576, 0x63AF, 0xD577, 0x6375, 0xD578, 0x639C, 0xD579, 0x636D, - 0xD57A, 0x63AE, 0xD57B, 0x637C, 0xD57C, 0x63A4, 0xD57D, 0x633B, - 0xD57E, 0x639F, 0xD5A1, 0x6378, 0xD5A2, 0x6385, 0xD5A3, 0x6381, - 0xD5A4, 0x6391, 0xD5A5, 0x638D, 0xD5A6, 0x6370, 0xD5A7, 0x6553, - 0xD5A8, 0x65CD, 0xD5A9, 0x6665, 0xD5AA, 0x6661, 0xD5AB, 0x665B, - 0xD5AC, 0x6659, 0xD5AD, 0x665C, 0xD5AE, 0x6662, 0xD5AF, 0x6718, - 0xD5B0, 0x6879, 0xD5B1, 0x6887, 0xD5B2, 0x6890, 0xD5B3, 0x689C, - 0xD5B4, 0x686D, 0xD5B5, 0x686E, 0xD5B6, 0x68AE, 0xD5B7, 0x68AB, - 0xD5B8, 0x6956, 0xD5B9, 0x686F, 0xD5BA, 0x68A3, 0xD5BB, 0x68AC, - 0xD5BC, 0x68A9, 0xD5BD, 0x6875, 0xD5BE, 0x6874, 0xD5BF, 0x68B2, - 0xD5C0, 0x688F, 0xD5C1, 0x6877, 0xD5C2, 0x6892, 0xD5C3, 0x687C, - 0xD5C4, 0x686B, 0xD5C5, 0x6872, 0xD5C6, 0x68AA, 0xD5C7, 0x6880, - 0xD5C8, 0x6871, 0xD5C9, 0x687E, 0xD5CA, 0x689B, 0xD5CB, 0x6896, - 0xD5CC, 0x688B, 0xD5CD, 0x68A0, 0xD5CE, 0x6889, 0xD5CF, 0x68A4, - 0xD5D0, 0x6878, 0xD5D1, 0x687B, 0xD5D2, 0x6891, 0xD5D3, 0x688C, - 0xD5D4, 0x688A, 0xD5D5, 0x687D, 0xD5D6, 0x6B36, 0xD5D7, 0x6B33, - 0xD5D8, 0x6B37, 0xD5D9, 0x6B38, 0xD5DA, 0x6B91, 0xD5DB, 0x6B8F, - 0xD5DC, 0x6B8D, 0xD5DD, 0x6B8E, 0xD5DE, 0x6B8C, 0xD5DF, 0x6C2A, - 0xD5E0, 0x6DC0, 0xD5E1, 0x6DAB, 0xD5E2, 0x6DB4, 0xD5E3, 0x6DB3, - 0xD5E4, 0x6E74, 0xD5E5, 0x6DAC, 0xD5E6, 0x6DE9, 0xD5E7, 0x6DE2, - 0xD5E8, 0x6DB7, 0xD5E9, 0x6DF6, 0xD5EA, 0x6DD4, 0xD5EB, 0x6E00, - 0xD5EC, 0x6DC8, 0xD5ED, 0x6DE0, 0xD5EE, 0x6DDF, 0xD5EF, 0x6DD6, - 0xD5F0, 0x6DBE, 0xD5F1, 0x6DE5, 0xD5F2, 0x6DDC, 0xD5F3, 0x6DDD, - 0xD5F4, 0x6DDB, 0xD5F5, 0x6DF4, 0xD5F6, 0x6DCA, 0xD5F7, 0x6DBD, - 0xD5F8, 0x6DED, 0xD5F9, 0x6DF0, 0xD5FA, 0x6DBA, 0xD5FB, 0x6DD5, - 0xD5FC, 0x6DC2, 0xD5FD, 0x6DCF, 0xD5FE, 0x6DC9, 0xD640, 0x6DD0, - 0xD641, 0x6DF2, 0xD642, 0x6DD3, 0xD643, 0x6DFD, 0xD644, 0x6DD7, - 0xD645, 0x6DCD, 0xD646, 0x6DE3, 0xD647, 0x6DBB, 0xD648, 0x70FA, - 0xD649, 0x710D, 0xD64A, 0x70F7, 0xD64B, 0x7117, 0xD64C, 0x70F4, - 0xD64D, 0x710C, 0xD64E, 0x70F0, 0xD64F, 0x7104, 0xD650, 0x70F3, - 0xD651, 0x7110, 0xD652, 0x70FC, 0xD653, 0x70FF, 0xD654, 0x7106, - 0xD655, 0x7113, 0xD656, 0x7100, 0xD657, 0x70F8, 0xD658, 0x70F6, - 0xD659, 0x710B, 0xD65A, 0x7102, 0xD65B, 0x710E, 0xD65C, 0x727E, - 0xD65D, 0x727B, 0xD65E, 0x727C, 0xD65F, 0x727F, 0xD660, 0x731D, - 0xD661, 0x7317, 0xD662, 0x7307, 0xD663, 0x7311, 0xD664, 0x7318, - 0xD665, 0x730A, 0xD666, 0x7308, 0xD667, 0x72FF, 0xD668, 0x730F, - 0xD669, 0x731E, 0xD66A, 0x7388, 0xD66B, 0x73F6, 0xD66C, 0x73F8, - 0xD66D, 0x73F5, 0xD66E, 0x7404, 0xD66F, 0x7401, 0xD670, 0x73FD, - 0xD671, 0x7407, 0xD672, 0x7400, 0xD673, 0x73FA, 0xD674, 0x73FC, - 0xD675, 0x73FF, 0xD676, 0x740C, 0xD677, 0x740B, 0xD678, 0x73F4, - 0xD679, 0x7408, 0xD67A, 0x7564, 0xD67B, 0x7563, 0xD67C, 0x75CE, - 0xD67D, 0x75D2, 0xD67E, 0x75CF, 0xD6A1, 0x75CB, 0xD6A2, 0x75CC, - 0xD6A3, 0x75D1, 0xD6A4, 0x75D0, 0xD6A5, 0x768F, 0xD6A6, 0x7689, - 0xD6A7, 0x76D3, 0xD6A8, 0x7739, 0xD6A9, 0x772F, 0xD6AA, 0x772D, - 0xD6AB, 0x7731, 0xD6AC, 0x7732, 0xD6AD, 0x7734, 0xD6AE, 0x7733, - 0xD6AF, 0x773D, 0xD6B0, 0x7725, 0xD6B1, 0x773B, 0xD6B2, 0x7735, - 0xD6B3, 0x7848, 0xD6B4, 0x7852, 0xD6B5, 0x7849, 0xD6B6, 0x784D, - 0xD6B7, 0x784A, 0xD6B8, 0x784C, 0xD6B9, 0x7826, 0xD6BA, 0x7845, - 0xD6BB, 0x7850, 0xD6BC, 0x7964, 0xD6BD, 0x7967, 0xD6BE, 0x7969, - 0xD6BF, 0x796A, 0xD6C0, 0x7963, 0xD6C1, 0x796B, 0xD6C2, 0x7961, - 0xD6C3, 0x79BB, 0xD6C4, 0x79FA, 0xD6C5, 0x79F8, 0xD6C6, 0x79F6, - 0xD6C7, 0x79F7, 0xD6C8, 0x7A8F, 0xD6C9, 0x7A94, 0xD6CA, 0x7A90, - 0xD6CB, 0x7B35, 0xD6CC, 0x7B47, 0xD6CD, 0x7B34, 0xD6CE, 0x7B25, - 0xD6CF, 0x7B30, 0xD6D0, 0x7B22, 0xD6D1, 0x7B24, 0xD6D2, 0x7B33, - 0xD6D3, 0x7B18, 0xD6D4, 0x7B2A, 0xD6D5, 0x7B1D, 0xD6D6, 0x7B31, - 0xD6D7, 0x7B2B, 0xD6D8, 0x7B2D, 0xD6D9, 0x7B2F, 0xD6DA, 0x7B32, - 0xD6DB, 0x7B38, 0xD6DC, 0x7B1A, 0xD6DD, 0x7B23, 0xD6DE, 0x7C94, - 0xD6DF, 0x7C98, 0xD6E0, 0x7C96, 0xD6E1, 0x7CA3, 0xD6E2, 0x7D35, - 0xD6E3, 0x7D3D, 0xD6E4, 0x7D38, 0xD6E5, 0x7D36, 0xD6E6, 0x7D3A, - 0xD6E7, 0x7D45, 0xD6E8, 0x7D2C, 0xD6E9, 0x7D29, 0xD6EA, 0x7D41, - 0xD6EB, 0x7D47, 0xD6EC, 0x7D3E, 0xD6ED, 0x7D3F, 0xD6EE, 0x7D4A, - 0xD6EF, 0x7D3B, 0xD6F0, 0x7D28, 0xD6F1, 0x7F63, 0xD6F2, 0x7F95, - 0xD6F3, 0x7F9C, 0xD6F4, 0x7F9D, 0xD6F5, 0x7F9B, 0xD6F6, 0x7FCA, - 0xD6F7, 0x7FCB, 0xD6F8, 0x7FCD, 0xD6F9, 0x7FD0, 0xD6FA, 0x7FD1, - 0xD6FB, 0x7FC7, 0xD6FC, 0x7FCF, 0xD6FD, 0x7FC9, 0xD6FE, 0x801F, - 0xD740, 0x801E, 0xD741, 0x801B, 0xD742, 0x8047, 0xD743, 0x8043, - 0xD744, 0x8048, 0xD745, 0x8118, 0xD746, 0x8125, 0xD747, 0x8119, - 0xD748, 0x811B, 0xD749, 0x812D, 0xD74A, 0x811F, 0xD74B, 0x812C, - 0xD74C, 0x811E, 0xD74D, 0x8121, 0xD74E, 0x8115, 0xD74F, 0x8127, - 0xD750, 0x811D, 0xD751, 0x8122, 0xD752, 0x8211, 0xD753, 0x8238, - 0xD754, 0x8233, 0xD755, 0x823A, 0xD756, 0x8234, 0xD757, 0x8232, - 0xD758, 0x8274, 0xD759, 0x8390, 0xD75A, 0x83A3, 0xD75B, 0x83A8, - 0xD75C, 0x838D, 0xD75D, 0x837A, 0xD75E, 0x8373, 0xD75F, 0x83A4, - 0xD760, 0x8374, 0xD761, 0x838F, 0xD762, 0x8381, 0xD763, 0x8395, - 0xD764, 0x8399, 0xD765, 0x8375, 0xD766, 0x8394, 0xD767, 0x83A9, - 0xD768, 0x837D, 0xD769, 0x8383, 0xD76A, 0x838C, 0xD76B, 0x839D, - 0xD76C, 0x839B, 0xD76D, 0x83AA, 0xD76E, 0x838B, 0xD76F, 0x837E, - 0xD770, 0x83A5, 0xD771, 0x83AF, 0xD772, 0x8388, 0xD773, 0x8397, - 0xD774, 0x83B0, 0xD775, 0x837F, 0xD776, 0x83A6, 0xD777, 0x8387, - 0xD778, 0x83AE, 0xD779, 0x8376, 0xD77A, 0x839A, 0xD77B, 0x8659, - 0xD77C, 0x8656, 0xD77D, 0x86BF, 0xD77E, 0x86B7, 0xD7A1, 0x86C2, - 0xD7A2, 0x86C1, 0xD7A3, 0x86C5, 0xD7A4, 0x86BA, 0xD7A5, 0x86B0, - 0xD7A6, 0x86C8, 0xD7A7, 0x86B9, 0xD7A8, 0x86B3, 0xD7A9, 0x86B8, - 0xD7AA, 0x86CC, 0xD7AB, 0x86B4, 0xD7AC, 0x86BB, 0xD7AD, 0x86BC, - 0xD7AE, 0x86C3, 0xD7AF, 0x86BD, 0xD7B0, 0x86BE, 0xD7B1, 0x8852, - 0xD7B2, 0x8889, 0xD7B3, 0x8895, 0xD7B4, 0x88A8, 0xD7B5, 0x88A2, - 0xD7B6, 0x88AA, 0xD7B7, 0x889A, 0xD7B8, 0x8891, 0xD7B9, 0x88A1, - 0xD7BA, 0x889F, 0xD7BB, 0x8898, 0xD7BC, 0x88A7, 0xD7BD, 0x8899, - 0xD7BE, 0x889B, 0xD7BF, 0x8897, 0xD7C0, 0x88A4, 0xD7C1, 0x88AC, - 0xD7C2, 0x888C, 0xD7C3, 0x8893, 0xD7C4, 0x888E, 0xD7C5, 0x8982, - 0xD7C6, 0x89D6, 0xD7C7, 0x89D9, 0xD7C8, 0x89D5, 0xD7C9, 0x8A30, - 0xD7CA, 0x8A27, 0xD7CB, 0x8A2C, 0xD7CC, 0x8A1E, 0xD7CD, 0x8C39, - 0xD7CE, 0x8C3B, 0xD7CF, 0x8C5C, 0xD7D0, 0x8C5D, 0xD7D1, 0x8C7D, - 0xD7D2, 0x8CA5, 0xD7D3, 0x8D7D, 0xD7D4, 0x8D7B, 0xD7D5, 0x8D79, - 0xD7D6, 0x8DBC, 0xD7D7, 0x8DC2, 0xD7D8, 0x8DB9, 0xD7D9, 0x8DBF, - 0xD7DA, 0x8DC1, 0xD7DB, 0x8ED8, 0xD7DC, 0x8EDE, 0xD7DD, 0x8EDD, - 0xD7DE, 0x8EDC, 0xD7DF, 0x8ED7, 0xD7E0, 0x8EE0, 0xD7E1, 0x8EE1, - 0xD7E2, 0x9024, 0xD7E3, 0x900B, 0xD7E4, 0x9011, 0xD7E5, 0x901C, - 0xD7E6, 0x900C, 0xD7E7, 0x9021, 0xD7E8, 0x90EF, 0xD7E9, 0x90EA, - 0xD7EA, 0x90F0, 0xD7EB, 0x90F4, 0xD7EC, 0x90F2, 0xD7ED, 0x90F3, - 0xD7EE, 0x90D4, 0xD7EF, 0x90EB, 0xD7F0, 0x90EC, 0xD7F1, 0x90E9, - 0xD7F2, 0x9156, 0xD7F3, 0x9158, 0xD7F4, 0x915A, 0xD7F5, 0x9153, - 0xD7F6, 0x9155, 0xD7F7, 0x91EC, 0xD7F8, 0x91F4, 0xD7F9, 0x91F1, - 0xD7FA, 0x91F3, 0xD7FB, 0x91F8, 0xD7FC, 0x91E4, 0xD7FD, 0x91F9, - 0xD7FE, 0x91EA, 0xD840, 0x91EB, 0xD841, 0x91F7, 0xD842, 0x91E8, - 0xD843, 0x91EE, 0xD844, 0x957A, 0xD845, 0x9586, 0xD846, 0x9588, - 0xD847, 0x967C, 0xD848, 0x966D, 0xD849, 0x966B, 0xD84A, 0x9671, - 0xD84B, 0x966F, 0xD84C, 0x96BF, 0xD84D, 0x976A, 0xD84E, 0x9804, - 0xD84F, 0x98E5, 0xD850, 0x9997, 0xD851, 0x509B, 0xD852, 0x5095, - 0xD853, 0x5094, 0xD854, 0x509E, 0xD855, 0x508B, 0xD856, 0x50A3, - 0xD857, 0x5083, 0xD858, 0x508C, 0xD859, 0x508E, 0xD85A, 0x509D, - 0xD85B, 0x5068, 0xD85C, 0x509C, 0xD85D, 0x5092, 0xD85E, 0x5082, - 0xD85F, 0x5087, 0xD860, 0x515F, 0xD861, 0x51D4, 0xD862, 0x5312, - 0xD863, 0x5311, 0xD864, 0x53A4, 0xD865, 0x53A7, 0xD866, 0x5591, - 0xD867, 0x55A8, 0xD868, 0x55A5, 0xD869, 0x55AD, 0xD86A, 0x5577, - 0xD86B, 0x5645, 0xD86C, 0x55A2, 0xD86D, 0x5593, 0xD86E, 0x5588, - 0xD86F, 0x558F, 0xD870, 0x55B5, 0xD871, 0x5581, 0xD872, 0x55A3, - 0xD873, 0x5592, 0xD874, 0x55A4, 0xD875, 0x557D, 0xD876, 0x558C, - 0xD877, 0x55A6, 0xD878, 0x557F, 0xD879, 0x5595, 0xD87A, 0x55A1, - 0xD87B, 0x558E, 0xD87C, 0x570C, 0xD87D, 0x5829, 0xD87E, 0x5837, - 0xD8A1, 0x5819, 0xD8A2, 0x581E, 0xD8A3, 0x5827, 0xD8A4, 0x5823, - 0xD8A5, 0x5828, 0xD8A6, 0x57F5, 0xD8A7, 0x5848, 0xD8A8, 0x5825, - 0xD8A9, 0x581C, 0xD8AA, 0x581B, 0xD8AB, 0x5833, 0xD8AC, 0x583F, - 0xD8AD, 0x5836, 0xD8AE, 0x582E, 0xD8AF, 0x5839, 0xD8B0, 0x5838, - 0xD8B1, 0x582D, 0xD8B2, 0x582C, 0xD8B3, 0x583B, 0xD8B4, 0x5961, - 0xD8B5, 0x5AAF, 0xD8B6, 0x5A94, 0xD8B7, 0x5A9F, 0xD8B8, 0x5A7A, - 0xD8B9, 0x5AA2, 0xD8BA, 0x5A9E, 0xD8BB, 0x5A78, 0xD8BC, 0x5AA6, - 0xD8BD, 0x5A7C, 0xD8BE, 0x5AA5, 0xD8BF, 0x5AAC, 0xD8C0, 0x5A95, - 0xD8C1, 0x5AAE, 0xD8C2, 0x5A37, 0xD8C3, 0x5A84, 0xD8C4, 0x5A8A, - 0xD8C5, 0x5A97, 0xD8C6, 0x5A83, 0xD8C7, 0x5A8B, 0xD8C8, 0x5AA9, - 0xD8C9, 0x5A7B, 0xD8CA, 0x5A7D, 0xD8CB, 0x5A8C, 0xD8CC, 0x5A9C, - 0xD8CD, 0x5A8F, 0xD8CE, 0x5A93, 0xD8CF, 0x5A9D, 0xD8D0, 0x5BEA, - 0xD8D1, 0x5BCD, 0xD8D2, 0x5BCB, 0xD8D3, 0x5BD4, 0xD8D4, 0x5BD1, - 0xD8D5, 0x5BCA, 0xD8D6, 0x5BCE, 0xD8D7, 0x5C0C, 0xD8D8, 0x5C30, - 0xD8D9, 0x5D37, 0xD8DA, 0x5D43, 0xD8DB, 0x5D6B, 0xD8DC, 0x5D41, - 0xD8DD, 0x5D4B, 0xD8DE, 0x5D3F, 0xD8DF, 0x5D35, 0xD8E0, 0x5D51, - 0xD8E1, 0x5D4E, 0xD8E2, 0x5D55, 0xD8E3, 0x5D33, 0xD8E4, 0x5D3A, - 0xD8E5, 0x5D52, 0xD8E6, 0x5D3D, 0xD8E7, 0x5D31, 0xD8E8, 0x5D59, - 0xD8E9, 0x5D42, 0xD8EA, 0x5D39, 0xD8EB, 0x5D49, 0xD8EC, 0x5D38, - 0xD8ED, 0x5D3C, 0xD8EE, 0x5D32, 0xD8EF, 0x5D36, 0xD8F0, 0x5D40, - 0xD8F1, 0x5D45, 0xD8F2, 0x5E44, 0xD8F3, 0x5E41, 0xD8F4, 0x5F58, - 0xD8F5, 0x5FA6, 0xD8F6, 0x5FA5, 0xD8F7, 0x5FAB, 0xD8F8, 0x60C9, - 0xD8F9, 0x60B9, 0xD8FA, 0x60CC, 0xD8FB, 0x60E2, 0xD8FC, 0x60CE, - 0xD8FD, 0x60C4, 0xD8FE, 0x6114, 0xD940, 0x60F2, 0xD941, 0x610A, - 0xD942, 0x6116, 0xD943, 0x6105, 0xD944, 0x60F5, 0xD945, 0x6113, - 0xD946, 0x60F8, 0xD947, 0x60FC, 0xD948, 0x60FE, 0xD949, 0x60C1, - 0xD94A, 0x6103, 0xD94B, 0x6118, 0xD94C, 0x611D, 0xD94D, 0x6110, - 0xD94E, 0x60FF, 0xD94F, 0x6104, 0xD950, 0x610B, 0xD951, 0x624A, - 0xD952, 0x6394, 0xD953, 0x63B1, 0xD954, 0x63B0, 0xD955, 0x63CE, - 0xD956, 0x63E5, 0xD957, 0x63E8, 0xD958, 0x63EF, 0xD959, 0x63C3, - 0xD95A, 0x649D, 0xD95B, 0x63F3, 0xD95C, 0x63CA, 0xD95D, 0x63E0, - 0xD95E, 0x63F6, 0xD95F, 0x63D5, 0xD960, 0x63F2, 0xD961, 0x63F5, - 0xD962, 0x6461, 0xD963, 0x63DF, 0xD964, 0x63BE, 0xD965, 0x63DD, - 0xD966, 0x63DC, 0xD967, 0x63C4, 0xD968, 0x63D8, 0xD969, 0x63D3, - 0xD96A, 0x63C2, 0xD96B, 0x63C7, 0xD96C, 0x63CC, 0xD96D, 0x63CB, - 0xD96E, 0x63C8, 0xD96F, 0x63F0, 0xD970, 0x63D7, 0xD971, 0x63D9, - 0xD972, 0x6532, 0xD973, 0x6567, 0xD974, 0x656A, 0xD975, 0x6564, - 0xD976, 0x655C, 0xD977, 0x6568, 0xD978, 0x6565, 0xD979, 0x658C, - 0xD97A, 0x659D, 0xD97B, 0x659E, 0xD97C, 0x65AE, 0xD97D, 0x65D0, - 0xD97E, 0x65D2, 0xD9A1, 0x667C, 0xD9A2, 0x666C, 0xD9A3, 0x667B, - 0xD9A4, 0x6680, 0xD9A5, 0x6671, 0xD9A6, 0x6679, 0xD9A7, 0x666A, - 0xD9A8, 0x6672, 0xD9A9, 0x6701, 0xD9AA, 0x690C, 0xD9AB, 0x68D3, - 0xD9AC, 0x6904, 0xD9AD, 0x68DC, 0xD9AE, 0x692A, 0xD9AF, 0x68EC, - 0xD9B0, 0x68EA, 0xD9B1, 0x68F1, 0xD9B2, 0x690F, 0xD9B3, 0x68D6, - 0xD9B4, 0x68F7, 0xD9B5, 0x68EB, 0xD9B6, 0x68E4, 0xD9B7, 0x68F6, - 0xD9B8, 0x6913, 0xD9B9, 0x6910, 0xD9BA, 0x68F3, 0xD9BB, 0x68E1, - 0xD9BC, 0x6907, 0xD9BD, 0x68CC, 0xD9BE, 0x6908, 0xD9BF, 0x6970, - 0xD9C0, 0x68B4, 0xD9C1, 0x6911, 0xD9C2, 0x68EF, 0xD9C3, 0x68C6, - 0xD9C4, 0x6914, 0xD9C5, 0x68F8, 0xD9C6, 0x68D0, 0xD9C7, 0x68FD, - 0xD9C8, 0x68FC, 0xD9C9, 0x68E8, 0xD9CA, 0x690B, 0xD9CB, 0x690A, - 0xD9CC, 0x6917, 0xD9CD, 0x68CE, 0xD9CE, 0x68C8, 0xD9CF, 0x68DD, - 0xD9D0, 0x68DE, 0xD9D1, 0x68E6, 0xD9D2, 0x68F4, 0xD9D3, 0x68D1, - 0xD9D4, 0x6906, 0xD9D5, 0x68D4, 0xD9D6, 0x68E9, 0xD9D7, 0x6915, - 0xD9D8, 0x6925, 0xD9D9, 0x68C7, 0xD9DA, 0x6B39, 0xD9DB, 0x6B3B, - 0xD9DC, 0x6B3F, 0xD9DD, 0x6B3C, 0xD9DE, 0x6B94, 0xD9DF, 0x6B97, - 0xD9E0, 0x6B99, 0xD9E1, 0x6B95, 0xD9E2, 0x6BBD, 0xD9E3, 0x6BF0, - 0xD9E4, 0x6BF2, 0xD9E5, 0x6BF3, 0xD9E6, 0x6C30, 0xD9E7, 0x6DFC, - 0xD9E8, 0x6E46, 0xD9E9, 0x6E47, 0xD9EA, 0x6E1F, 0xD9EB, 0x6E49, - 0xD9EC, 0x6E88, 0xD9ED, 0x6E3C, 0xD9EE, 0x6E3D, 0xD9EF, 0x6E45, - 0xD9F0, 0x6E62, 0xD9F1, 0x6E2B, 0xD9F2, 0x6E3F, 0xD9F3, 0x6E41, - 0xD9F4, 0x6E5D, 0xD9F5, 0x6E73, 0xD9F6, 0x6E1C, 0xD9F7, 0x6E33, - 0xD9F8, 0x6E4B, 0xD9F9, 0x6E40, 0xD9FA, 0x6E51, 0xD9FB, 0x6E3B, - 0xD9FC, 0x6E03, 0xD9FD, 0x6E2E, 0xD9FE, 0x6E5E, 0xDA40, 0x6E68, - 0xDA41, 0x6E5C, 0xDA42, 0x6E61, 0xDA43, 0x6E31, 0xDA44, 0x6E28, - 0xDA45, 0x6E60, 0xDA46, 0x6E71, 0xDA47, 0x6E6B, 0xDA48, 0x6E39, - 0xDA49, 0x6E22, 0xDA4A, 0x6E30, 0xDA4B, 0x6E53, 0xDA4C, 0x6E65, - 0xDA4D, 0x6E27, 0xDA4E, 0x6E78, 0xDA4F, 0x6E64, 0xDA50, 0x6E77, - 0xDA51, 0x6E55, 0xDA52, 0x6E79, 0xDA53, 0x6E52, 0xDA54, 0x6E66, - 0xDA55, 0x6E35, 0xDA56, 0x6E36, 0xDA57, 0x6E5A, 0xDA58, 0x7120, - 0xDA59, 0x711E, 0xDA5A, 0x712F, 0xDA5B, 0x70FB, 0xDA5C, 0x712E, - 0xDA5D, 0x7131, 0xDA5E, 0x7123, 0xDA5F, 0x7125, 0xDA60, 0x7122, - 0xDA61, 0x7132, 0xDA62, 0x711F, 0xDA63, 0x7128, 0xDA64, 0x713A, - 0xDA65, 0x711B, 0xDA66, 0x724B, 0xDA67, 0x725A, 0xDA68, 0x7288, - 0xDA69, 0x7289, 0xDA6A, 0x7286, 0xDA6B, 0x7285, 0xDA6C, 0x728B, - 0xDA6D, 0x7312, 0xDA6E, 0x730B, 0xDA6F, 0x7330, 0xDA70, 0x7322, - 0xDA71, 0x7331, 0xDA72, 0x7333, 0xDA73, 0x7327, 0xDA74, 0x7332, - 0xDA75, 0x732D, 0xDA76, 0x7326, 0xDA77, 0x7323, 0xDA78, 0x7335, - 0xDA79, 0x730C, 0xDA7A, 0x742E, 0xDA7B, 0x742C, 0xDA7C, 0x7430, - 0xDA7D, 0x742B, 0xDA7E, 0x7416, 0xDAA1, 0x741A, 0xDAA2, 0x7421, - 0xDAA3, 0x742D, 0xDAA4, 0x7431, 0xDAA5, 0x7424, 0xDAA6, 0x7423, - 0xDAA7, 0x741D, 0xDAA8, 0x7429, 0xDAA9, 0x7420, 0xDAAA, 0x7432, - 0xDAAB, 0x74FB, 0xDAAC, 0x752F, 0xDAAD, 0x756F, 0xDAAE, 0x756C, - 0xDAAF, 0x75E7, 0xDAB0, 0x75DA, 0xDAB1, 0x75E1, 0xDAB2, 0x75E6, - 0xDAB3, 0x75DD, 0xDAB4, 0x75DF, 0xDAB5, 0x75E4, 0xDAB6, 0x75D7, - 0xDAB7, 0x7695, 0xDAB8, 0x7692, 0xDAB9, 0x76DA, 0xDABA, 0x7746, - 0xDABB, 0x7747, 0xDABC, 0x7744, 0xDABD, 0x774D, 0xDABE, 0x7745, - 0xDABF, 0x774A, 0xDAC0, 0x774E, 0xDAC1, 0x774B, 0xDAC2, 0x774C, - 0xDAC3, 0x77DE, 0xDAC4, 0x77EC, 0xDAC5, 0x7860, 0xDAC6, 0x7864, - 0xDAC7, 0x7865, 0xDAC8, 0x785C, 0xDAC9, 0x786D, 0xDACA, 0x7871, - 0xDACB, 0x786A, 0xDACC, 0x786E, 0xDACD, 0x7870, 0xDACE, 0x7869, - 0xDACF, 0x7868, 0xDAD0, 0x785E, 0xDAD1, 0x7862, 0xDAD2, 0x7974, - 0xDAD3, 0x7973, 0xDAD4, 0x7972, 0xDAD5, 0x7970, 0xDAD6, 0x7A02, - 0xDAD7, 0x7A0A, 0xDAD8, 0x7A03, 0xDAD9, 0x7A0C, 0xDADA, 0x7A04, - 0xDADB, 0x7A99, 0xDADC, 0x7AE6, 0xDADD, 0x7AE4, 0xDADE, 0x7B4A, - 0xDADF, 0x7B3B, 0xDAE0, 0x7B44, 0xDAE1, 0x7B48, 0xDAE2, 0x7B4C, - 0xDAE3, 0x7B4E, 0xDAE4, 0x7B40, 0xDAE5, 0x7B58, 0xDAE6, 0x7B45, - 0xDAE7, 0x7CA2, 0xDAE8, 0x7C9E, 0xDAE9, 0x7CA8, 0xDAEA, 0x7CA1, - 0xDAEB, 0x7D58, 0xDAEC, 0x7D6F, 0xDAED, 0x7D63, 0xDAEE, 0x7D53, - 0xDAEF, 0x7D56, 0xDAF0, 0x7D67, 0xDAF1, 0x7D6A, 0xDAF2, 0x7D4F, - 0xDAF3, 0x7D6D, 0xDAF4, 0x7D5C, 0xDAF5, 0x7D6B, 0xDAF6, 0x7D52, - 0xDAF7, 0x7D54, 0xDAF8, 0x7D69, 0xDAF9, 0x7D51, 0xDAFA, 0x7D5F, - 0xDAFB, 0x7D4E, 0xDAFC, 0x7F3E, 0xDAFD, 0x7F3F, 0xDAFE, 0x7F65, - 0xDB40, 0x7F66, 0xDB41, 0x7FA2, 0xDB42, 0x7FA0, 0xDB43, 0x7FA1, - 0xDB44, 0x7FD7, 0xDB45, 0x8051, 0xDB46, 0x804F, 0xDB47, 0x8050, - 0xDB48, 0x80FE, 0xDB49, 0x80D4, 0xDB4A, 0x8143, 0xDB4B, 0x814A, - 0xDB4C, 0x8152, 0xDB4D, 0x814F, 0xDB4E, 0x8147, 0xDB4F, 0x813D, - 0xDB50, 0x814D, 0xDB51, 0x813A, 0xDB52, 0x81E6, 0xDB53, 0x81EE, - 0xDB54, 0x81F7, 0xDB55, 0x81F8, 0xDB56, 0x81F9, 0xDB57, 0x8204, - 0xDB58, 0x823C, 0xDB59, 0x823D, 0xDB5A, 0x823F, 0xDB5B, 0x8275, - 0xDB5C, 0x833B, 0xDB5D, 0x83CF, 0xDB5E, 0x83F9, 0xDB5F, 0x8423, - 0xDB60, 0x83C0, 0xDB61, 0x83E8, 0xDB62, 0x8412, 0xDB63, 0x83E7, - 0xDB64, 0x83E4, 0xDB65, 0x83FC, 0xDB66, 0x83F6, 0xDB67, 0x8410, - 0xDB68, 0x83C6, 0xDB69, 0x83C8, 0xDB6A, 0x83EB, 0xDB6B, 0x83E3, - 0xDB6C, 0x83BF, 0xDB6D, 0x8401, 0xDB6E, 0x83DD, 0xDB6F, 0x83E5, - 0xDB70, 0x83D8, 0xDB71, 0x83FF, 0xDB72, 0x83E1, 0xDB73, 0x83CB, - 0xDB74, 0x83CE, 0xDB75, 0x83D6, 0xDB76, 0x83F5, 0xDB77, 0x83C9, - 0xDB78, 0x8409, 0xDB79, 0x840F, 0xDB7A, 0x83DE, 0xDB7B, 0x8411, - 0xDB7C, 0x8406, 0xDB7D, 0x83C2, 0xDB7E, 0x83F3, 0xDBA1, 0x83D5, - 0xDBA2, 0x83FA, 0xDBA3, 0x83C7, 0xDBA4, 0x83D1, 0xDBA5, 0x83EA, - 0xDBA6, 0x8413, 0xDBA7, 0x83C3, 0xDBA8, 0x83EC, 0xDBA9, 0x83EE, - 0xDBAA, 0x83C4, 0xDBAB, 0x83FB, 0xDBAC, 0x83D7, 0xDBAD, 0x83E2, - 0xDBAE, 0x841B, 0xDBAF, 0x83DB, 0xDBB0, 0x83FE, 0xDBB1, 0x86D8, - 0xDBB2, 0x86E2, 0xDBB3, 0x86E6, 0xDBB4, 0x86D3, 0xDBB5, 0x86E3, - 0xDBB6, 0x86DA, 0xDBB7, 0x86EA, 0xDBB8, 0x86DD, 0xDBB9, 0x86EB, - 0xDBBA, 0x86DC, 0xDBBB, 0x86EC, 0xDBBC, 0x86E9, 0xDBBD, 0x86D7, - 0xDBBE, 0x86E8, 0xDBBF, 0x86D1, 0xDBC0, 0x8848, 0xDBC1, 0x8856, - 0xDBC2, 0x8855, 0xDBC3, 0x88BA, 0xDBC4, 0x88D7, 0xDBC5, 0x88B9, - 0xDBC6, 0x88B8, 0xDBC7, 0x88C0, 0xDBC8, 0x88BE, 0xDBC9, 0x88B6, - 0xDBCA, 0x88BC, 0xDBCB, 0x88B7, 0xDBCC, 0x88BD, 0xDBCD, 0x88B2, - 0xDBCE, 0x8901, 0xDBCF, 0x88C9, 0xDBD0, 0x8995, 0xDBD1, 0x8998, - 0xDBD2, 0x8997, 0xDBD3, 0x89DD, 0xDBD4, 0x89DA, 0xDBD5, 0x89DB, - 0xDBD6, 0x8A4E, 0xDBD7, 0x8A4D, 0xDBD8, 0x8A39, 0xDBD9, 0x8A59, - 0xDBDA, 0x8A40, 0xDBDB, 0x8A57, 0xDBDC, 0x8A58, 0xDBDD, 0x8A44, - 0xDBDE, 0x8A45, 0xDBDF, 0x8A52, 0xDBE0, 0x8A48, 0xDBE1, 0x8A51, - 0xDBE2, 0x8A4A, 0xDBE3, 0x8A4C, 0xDBE4, 0x8A4F, 0xDBE5, 0x8C5F, - 0xDBE6, 0x8C81, 0xDBE7, 0x8C80, 0xDBE8, 0x8CBA, 0xDBE9, 0x8CBE, - 0xDBEA, 0x8CB0, 0xDBEB, 0x8CB9, 0xDBEC, 0x8CB5, 0xDBED, 0x8D84, - 0xDBEE, 0x8D80, 0xDBEF, 0x8D89, 0xDBF0, 0x8DD8, 0xDBF1, 0x8DD3, - 0xDBF2, 0x8DCD, 0xDBF3, 0x8DC7, 0xDBF4, 0x8DD6, 0xDBF5, 0x8DDC, - 0xDBF6, 0x8DCF, 0xDBF7, 0x8DD5, 0xDBF8, 0x8DD9, 0xDBF9, 0x8DC8, - 0xDBFA, 0x8DD7, 0xDBFB, 0x8DC5, 0xDBFC, 0x8EEF, 0xDBFD, 0x8EF7, - 0xDBFE, 0x8EFA, 0xDC40, 0x8EF9, 0xDC41, 0x8EE6, 0xDC42, 0x8EEE, - 0xDC43, 0x8EE5, 0xDC44, 0x8EF5, 0xDC45, 0x8EE7, 0xDC46, 0x8EE8, - 0xDC47, 0x8EF6, 0xDC48, 0x8EEB, 0xDC49, 0x8EF1, 0xDC4A, 0x8EEC, - 0xDC4B, 0x8EF4, 0xDC4C, 0x8EE9, 0xDC4D, 0x902D, 0xDC4E, 0x9034, - 0xDC4F, 0x902F, 0xDC50, 0x9106, 0xDC51, 0x912C, 0xDC52, 0x9104, - 0xDC53, 0x90FF, 0xDC54, 0x90FC, 0xDC55, 0x9108, 0xDC56, 0x90F9, - 0xDC57, 0x90FB, 0xDC58, 0x9101, 0xDC59, 0x9100, 0xDC5A, 0x9107, - 0xDC5B, 0x9105, 0xDC5C, 0x9103, 0xDC5D, 0x9161, 0xDC5E, 0x9164, - 0xDC5F, 0x915F, 0xDC60, 0x9162, 0xDC61, 0x9160, 0xDC62, 0x9201, - 0xDC63, 0x920A, 0xDC64, 0x9225, 0xDC65, 0x9203, 0xDC66, 0x921A, - 0xDC67, 0x9226, 0xDC68, 0x920F, 0xDC69, 0x920C, 0xDC6A, 0x9200, - 0xDC6B, 0x9212, 0xDC6C, 0x91FF, 0xDC6D, 0x91FD, 0xDC6E, 0x9206, - 0xDC6F, 0x9204, 0xDC70, 0x9227, 0xDC71, 0x9202, 0xDC72, 0x921C, - 0xDC73, 0x9224, 0xDC74, 0x9219, 0xDC75, 0x9217, 0xDC76, 0x9205, - 0xDC77, 0x9216, 0xDC78, 0x957B, 0xDC79, 0x958D, 0xDC7A, 0x958C, - 0xDC7B, 0x9590, 0xDC7C, 0x9687, 0xDC7D, 0x967E, 0xDC7E, 0x9688, - 0xDCA1, 0x9689, 0xDCA2, 0x9683, 0xDCA3, 0x9680, 0xDCA4, 0x96C2, - 0xDCA5, 0x96C8, 0xDCA6, 0x96C3, 0xDCA7, 0x96F1, 0xDCA8, 0x96F0, - 0xDCA9, 0x976C, 0xDCAA, 0x9770, 0xDCAB, 0x976E, 0xDCAC, 0x9807, - 0xDCAD, 0x98A9, 0xDCAE, 0x98EB, 0xDCAF, 0x9CE6, 0xDCB0, 0x9EF9, - 0xDCB1, 0x4E83, 0xDCB2, 0x4E84, 0xDCB3, 0x4EB6, 0xDCB4, 0x50BD, - 0xDCB5, 0x50BF, 0xDCB6, 0x50C6, 0xDCB7, 0x50AE, 0xDCB8, 0x50C4, - 0xDCB9, 0x50CA, 0xDCBA, 0x50B4, 0xDCBB, 0x50C8, 0xDCBC, 0x50C2, - 0xDCBD, 0x50B0, 0xDCBE, 0x50C1, 0xDCBF, 0x50BA, 0xDCC0, 0x50B1, - 0xDCC1, 0x50CB, 0xDCC2, 0x50C9, 0xDCC3, 0x50B6, 0xDCC4, 0x50B8, - 0xDCC5, 0x51D7, 0xDCC6, 0x527A, 0xDCC7, 0x5278, 0xDCC8, 0x527B, - 0xDCC9, 0x527C, 0xDCCA, 0x55C3, 0xDCCB, 0x55DB, 0xDCCC, 0x55CC, - 0xDCCD, 0x55D0, 0xDCCE, 0x55CB, 0xDCCF, 0x55CA, 0xDCD0, 0x55DD, - 0xDCD1, 0x55C0, 0xDCD2, 0x55D4, 0xDCD3, 0x55C4, 0xDCD4, 0x55E9, - 0xDCD5, 0x55BF, 0xDCD6, 0x55D2, 0xDCD7, 0x558D, 0xDCD8, 0x55CF, - 0xDCD9, 0x55D5, 0xDCDA, 0x55E2, 0xDCDB, 0x55D6, 0xDCDC, 0x55C8, - 0xDCDD, 0x55F2, 0xDCDE, 0x55CD, 0xDCDF, 0x55D9, 0xDCE0, 0x55C2, - 0xDCE1, 0x5714, 0xDCE2, 0x5853, 0xDCE3, 0x5868, 0xDCE4, 0x5864, - 0xDCE5, 0x584F, 0xDCE6, 0x584D, 0xDCE7, 0x5849, 0xDCE8, 0x586F, - 0xDCE9, 0x5855, 0xDCEA, 0x584E, 0xDCEB, 0x585D, 0xDCEC, 0x5859, - 0xDCED, 0x5865, 0xDCEE, 0x585B, 0xDCEF, 0x583D, 0xDCF0, 0x5863, - 0xDCF1, 0x5871, 0xDCF2, 0x58FC, 0xDCF3, 0x5AC7, 0xDCF4, 0x5AC4, - 0xDCF5, 0x5ACB, 0xDCF6, 0x5ABA, 0xDCF7, 0x5AB8, 0xDCF8, 0x5AB1, - 0xDCF9, 0x5AB5, 0xDCFA, 0x5AB0, 0xDCFB, 0x5ABF, 0xDCFC, 0x5AC8, - 0xDCFD, 0x5ABB, 0xDCFE, 0x5AC6, 0xDD40, 0x5AB7, 0xDD41, 0x5AC0, - 0xDD42, 0x5ACA, 0xDD43, 0x5AB4, 0xDD44, 0x5AB6, 0xDD45, 0x5ACD, - 0xDD46, 0x5AB9, 0xDD47, 0x5A90, 0xDD48, 0x5BD6, 0xDD49, 0x5BD8, - 0xDD4A, 0x5BD9, 0xDD4B, 0x5C1F, 0xDD4C, 0x5C33, 0xDD4D, 0x5D71, - 0xDD4E, 0x5D63, 0xDD4F, 0x5D4A, 0xDD50, 0x5D65, 0xDD51, 0x5D72, - 0xDD52, 0x5D6C, 0xDD53, 0x5D5E, 0xDD54, 0x5D68, 0xDD55, 0x5D67, - 0xDD56, 0x5D62, 0xDD57, 0x5DF0, 0xDD58, 0x5E4F, 0xDD59, 0x5E4E, - 0xDD5A, 0x5E4A, 0xDD5B, 0x5E4D, 0xDD5C, 0x5E4B, 0xDD5D, 0x5EC5, - 0xDD5E, 0x5ECC, 0xDD5F, 0x5EC6, 0xDD60, 0x5ECB, 0xDD61, 0x5EC7, - 0xDD62, 0x5F40, 0xDD63, 0x5FAF, 0xDD64, 0x5FAD, 0xDD65, 0x60F7, - 0xDD66, 0x6149, 0xDD67, 0x614A, 0xDD68, 0x612B, 0xDD69, 0x6145, - 0xDD6A, 0x6136, 0xDD6B, 0x6132, 0xDD6C, 0x612E, 0xDD6D, 0x6146, - 0xDD6E, 0x612F, 0xDD6F, 0x614F, 0xDD70, 0x6129, 0xDD71, 0x6140, - 0xDD72, 0x6220, 0xDD73, 0x9168, 0xDD74, 0x6223, 0xDD75, 0x6225, - 0xDD76, 0x6224, 0xDD77, 0x63C5, 0xDD78, 0x63F1, 0xDD79, 0x63EB, - 0xDD7A, 0x6410, 0xDD7B, 0x6412, 0xDD7C, 0x6409, 0xDD7D, 0x6420, - 0xDD7E, 0x6424, 0xDDA1, 0x6433, 0xDDA2, 0x6443, 0xDDA3, 0x641F, - 0xDDA4, 0x6415, 0xDDA5, 0x6418, 0xDDA6, 0x6439, 0xDDA7, 0x6437, - 0xDDA8, 0x6422, 0xDDA9, 0x6423, 0xDDAA, 0x640C, 0xDDAB, 0x6426, - 0xDDAC, 0x6430, 0xDDAD, 0x6428, 0xDDAE, 0x6441, 0xDDAF, 0x6435, - 0xDDB0, 0x642F, 0xDDB1, 0x640A, 0xDDB2, 0x641A, 0xDDB3, 0x6440, - 0xDDB4, 0x6425, 0xDDB5, 0x6427, 0xDDB6, 0x640B, 0xDDB7, 0x63E7, - 0xDDB8, 0x641B, 0xDDB9, 0x642E, 0xDDBA, 0x6421, 0xDDBB, 0x640E, - 0xDDBC, 0x656F, 0xDDBD, 0x6592, 0xDDBE, 0x65D3, 0xDDBF, 0x6686, - 0xDDC0, 0x668C, 0xDDC1, 0x6695, 0xDDC2, 0x6690, 0xDDC3, 0x668B, - 0xDDC4, 0x668A, 0xDDC5, 0x6699, 0xDDC6, 0x6694, 0xDDC7, 0x6678, - 0xDDC8, 0x6720, 0xDDC9, 0x6966, 0xDDCA, 0x695F, 0xDDCB, 0x6938, - 0xDDCC, 0x694E, 0xDDCD, 0x6962, 0xDDCE, 0x6971, 0xDDCF, 0x693F, - 0xDDD0, 0x6945, 0xDDD1, 0x696A, 0xDDD2, 0x6939, 0xDDD3, 0x6942, - 0xDDD4, 0x6957, 0xDDD5, 0x6959, 0xDDD6, 0x697A, 0xDDD7, 0x6948, - 0xDDD8, 0x6949, 0xDDD9, 0x6935, 0xDDDA, 0x696C, 0xDDDB, 0x6933, - 0xDDDC, 0x693D, 0xDDDD, 0x6965, 0xDDDE, 0x68F0, 0xDDDF, 0x6978, - 0xDDE0, 0x6934, 0xDDE1, 0x6969, 0xDDE2, 0x6940, 0xDDE3, 0x696F, - 0xDDE4, 0x6944, 0xDDE5, 0x6976, 0xDDE6, 0x6958, 0xDDE7, 0x6941, - 0xDDE8, 0x6974, 0xDDE9, 0x694C, 0xDDEA, 0x693B, 0xDDEB, 0x694B, - 0xDDEC, 0x6937, 0xDDED, 0x695C, 0xDDEE, 0x694F, 0xDDEF, 0x6951, - 0xDDF0, 0x6932, 0xDDF1, 0x6952, 0xDDF2, 0x692F, 0xDDF3, 0x697B, - 0xDDF4, 0x693C, 0xDDF5, 0x6B46, 0xDDF6, 0x6B45, 0xDDF7, 0x6B43, - 0xDDF8, 0x6B42, 0xDDF9, 0x6B48, 0xDDFA, 0x6B41, 0xDDFB, 0x6B9B, - 0xDDFC, 0xFA0D, 0xDDFD, 0x6BFB, 0xDDFE, 0x6BFC, 0xDE40, 0x6BF9, - 0xDE41, 0x6BF7, 0xDE42, 0x6BF8, 0xDE43, 0x6E9B, 0xDE44, 0x6ED6, - 0xDE45, 0x6EC8, 0xDE46, 0x6E8F, 0xDE47, 0x6EC0, 0xDE48, 0x6E9F, - 0xDE49, 0x6E93, 0xDE4A, 0x6E94, 0xDE4B, 0x6EA0, 0xDE4C, 0x6EB1, - 0xDE4D, 0x6EB9, 0xDE4E, 0x6EC6, 0xDE4F, 0x6ED2, 0xDE50, 0x6EBD, - 0xDE51, 0x6EC1, 0xDE52, 0x6E9E, 0xDE53, 0x6EC9, 0xDE54, 0x6EB7, - 0xDE55, 0x6EB0, 0xDE56, 0x6ECD, 0xDE57, 0x6EA6, 0xDE58, 0x6ECF, - 0xDE59, 0x6EB2, 0xDE5A, 0x6EBE, 0xDE5B, 0x6EC3, 0xDE5C, 0x6EDC, - 0xDE5D, 0x6ED8, 0xDE5E, 0x6E99, 0xDE5F, 0x6E92, 0xDE60, 0x6E8E, - 0xDE61, 0x6E8D, 0xDE62, 0x6EA4, 0xDE63, 0x6EA1, 0xDE64, 0x6EBF, - 0xDE65, 0x6EB3, 0xDE66, 0x6ED0, 0xDE67, 0x6ECA, 0xDE68, 0x6E97, - 0xDE69, 0x6EAE, 0xDE6A, 0x6EA3, 0xDE6B, 0x7147, 0xDE6C, 0x7154, - 0xDE6D, 0x7152, 0xDE6E, 0x7163, 0xDE6F, 0x7160, 0xDE70, 0x7141, - 0xDE71, 0x715D, 0xDE72, 0x7162, 0xDE73, 0x7172, 0xDE74, 0x7178, - 0xDE75, 0x716A, 0xDE76, 0x7161, 0xDE77, 0x7142, 0xDE78, 0x7158, - 0xDE79, 0x7143, 0xDE7A, 0x714B, 0xDE7B, 0x7170, 0xDE7C, 0x715F, - 0xDE7D, 0x7150, 0xDE7E, 0x7153, 0xDEA1, 0x7144, 0xDEA2, 0x714D, - 0xDEA3, 0x715A, 0xDEA4, 0x724F, 0xDEA5, 0x728D, 0xDEA6, 0x728C, - 0xDEA7, 0x7291, 0xDEA8, 0x7290, 0xDEA9, 0x728E, 0xDEAA, 0x733C, - 0xDEAB, 0x7342, 0xDEAC, 0x733B, 0xDEAD, 0x733A, 0xDEAE, 0x7340, - 0xDEAF, 0x734A, 0xDEB0, 0x7349, 0xDEB1, 0x7444, 0xDEB2, 0x744A, - 0xDEB3, 0x744B, 0xDEB4, 0x7452, 0xDEB5, 0x7451, 0xDEB6, 0x7457, - 0xDEB7, 0x7440, 0xDEB8, 0x744F, 0xDEB9, 0x7450, 0xDEBA, 0x744E, - 0xDEBB, 0x7442, 0xDEBC, 0x7446, 0xDEBD, 0x744D, 0xDEBE, 0x7454, - 0xDEBF, 0x74E1, 0xDEC0, 0x74FF, 0xDEC1, 0x74FE, 0xDEC2, 0x74FD, - 0xDEC3, 0x751D, 0xDEC4, 0x7579, 0xDEC5, 0x7577, 0xDEC6, 0x6983, - 0xDEC7, 0x75EF, 0xDEC8, 0x760F, 0xDEC9, 0x7603, 0xDECA, 0x75F7, - 0xDECB, 0x75FE, 0xDECC, 0x75FC, 0xDECD, 0x75F9, 0xDECE, 0x75F8, - 0xDECF, 0x7610, 0xDED0, 0x75FB, 0xDED1, 0x75F6, 0xDED2, 0x75ED, - 0xDED3, 0x75F5, 0xDED4, 0x75FD, 0xDED5, 0x7699, 0xDED6, 0x76B5, - 0xDED7, 0x76DD, 0xDED8, 0x7755, 0xDED9, 0x775F, 0xDEDA, 0x7760, - 0xDEDB, 0x7752, 0xDEDC, 0x7756, 0xDEDD, 0x775A, 0xDEDE, 0x7769, - 0xDEDF, 0x7767, 0xDEE0, 0x7754, 0xDEE1, 0x7759, 0xDEE2, 0x776D, - 0xDEE3, 0x77E0, 0xDEE4, 0x7887, 0xDEE5, 0x789A, 0xDEE6, 0x7894, - 0xDEE7, 0x788F, 0xDEE8, 0x7884, 0xDEE9, 0x7895, 0xDEEA, 0x7885, - 0xDEEB, 0x7886, 0xDEEC, 0x78A1, 0xDEED, 0x7883, 0xDEEE, 0x7879, - 0xDEEF, 0x7899, 0xDEF0, 0x7880, 0xDEF1, 0x7896, 0xDEF2, 0x787B, - 0xDEF3, 0x797C, 0xDEF4, 0x7982, 0xDEF5, 0x797D, 0xDEF6, 0x7979, - 0xDEF7, 0x7A11, 0xDEF8, 0x7A18, 0xDEF9, 0x7A19, 0xDEFA, 0x7A12, - 0xDEFB, 0x7A17, 0xDEFC, 0x7A15, 0xDEFD, 0x7A22, 0xDEFE, 0x7A13, - 0xDF40, 0x7A1B, 0xDF41, 0x7A10, 0xDF42, 0x7AA3, 0xDF43, 0x7AA2, - 0xDF44, 0x7A9E, 0xDF45, 0x7AEB, 0xDF46, 0x7B66, 0xDF47, 0x7B64, - 0xDF48, 0x7B6D, 0xDF49, 0x7B74, 0xDF4A, 0x7B69, 0xDF4B, 0x7B72, - 0xDF4C, 0x7B65, 0xDF4D, 0x7B73, 0xDF4E, 0x7B71, 0xDF4F, 0x7B70, - 0xDF50, 0x7B61, 0xDF51, 0x7B78, 0xDF52, 0x7B76, 0xDF53, 0x7B63, - 0xDF54, 0x7CB2, 0xDF55, 0x7CB4, 0xDF56, 0x7CAF, 0xDF57, 0x7D88, - 0xDF58, 0x7D86, 0xDF59, 0x7D80, 0xDF5A, 0x7D8D, 0xDF5B, 0x7D7F, - 0xDF5C, 0x7D85, 0xDF5D, 0x7D7A, 0xDF5E, 0x7D8E, 0xDF5F, 0x7D7B, - 0xDF60, 0x7D83, 0xDF61, 0x7D7C, 0xDF62, 0x7D8C, 0xDF63, 0x7D94, - 0xDF64, 0x7D84, 0xDF65, 0x7D7D, 0xDF66, 0x7D92, 0xDF67, 0x7F6D, - 0xDF68, 0x7F6B, 0xDF69, 0x7F67, 0xDF6A, 0x7F68, 0xDF6B, 0x7F6C, - 0xDF6C, 0x7FA6, 0xDF6D, 0x7FA5, 0xDF6E, 0x7FA7, 0xDF6F, 0x7FDB, - 0xDF70, 0x7FDC, 0xDF71, 0x8021, 0xDF72, 0x8164, 0xDF73, 0x8160, - 0xDF74, 0x8177, 0xDF75, 0x815C, 0xDF76, 0x8169, 0xDF77, 0x815B, - 0xDF78, 0x8162, 0xDF79, 0x8172, 0xDF7A, 0x6721, 0xDF7B, 0x815E, - 0xDF7C, 0x8176, 0xDF7D, 0x8167, 0xDF7E, 0x816F, 0xDFA1, 0x8144, - 0xDFA2, 0x8161, 0xDFA3, 0x821D, 0xDFA4, 0x8249, 0xDFA5, 0x8244, - 0xDFA6, 0x8240, 0xDFA7, 0x8242, 0xDFA8, 0x8245, 0xDFA9, 0x84F1, - 0xDFAA, 0x843F, 0xDFAB, 0x8456, 0xDFAC, 0x8476, 0xDFAD, 0x8479, - 0xDFAE, 0x848F, 0xDFAF, 0x848D, 0xDFB0, 0x8465, 0xDFB1, 0x8451, - 0xDFB2, 0x8440, 0xDFB3, 0x8486, 0xDFB4, 0x8467, 0xDFB5, 0x8430, - 0xDFB6, 0x844D, 0xDFB7, 0x847D, 0xDFB8, 0x845A, 0xDFB9, 0x8459, - 0xDFBA, 0x8474, 0xDFBB, 0x8473, 0xDFBC, 0x845D, 0xDFBD, 0x8507, - 0xDFBE, 0x845E, 0xDFBF, 0x8437, 0xDFC0, 0x843A, 0xDFC1, 0x8434, - 0xDFC2, 0x847A, 0xDFC3, 0x8443, 0xDFC4, 0x8478, 0xDFC5, 0x8432, - 0xDFC6, 0x8445, 0xDFC7, 0x8429, 0xDFC8, 0x83D9, 0xDFC9, 0x844B, - 0xDFCA, 0x842F, 0xDFCB, 0x8442, 0xDFCC, 0x842D, 0xDFCD, 0x845F, - 0xDFCE, 0x8470, 0xDFCF, 0x8439, 0xDFD0, 0x844E, 0xDFD1, 0x844C, - 0xDFD2, 0x8452, 0xDFD3, 0x846F, 0xDFD4, 0x84C5, 0xDFD5, 0x848E, - 0xDFD6, 0x843B, 0xDFD7, 0x8447, 0xDFD8, 0x8436, 0xDFD9, 0x8433, - 0xDFDA, 0x8468, 0xDFDB, 0x847E, 0xDFDC, 0x8444, 0xDFDD, 0x842B, - 0xDFDE, 0x8460, 0xDFDF, 0x8454, 0xDFE0, 0x846E, 0xDFE1, 0x8450, - 0xDFE2, 0x870B, 0xDFE3, 0x8704, 0xDFE4, 0x86F7, 0xDFE5, 0x870C, - 0xDFE6, 0x86FA, 0xDFE7, 0x86D6, 0xDFE8, 0x86F5, 0xDFE9, 0x874D, - 0xDFEA, 0x86F8, 0xDFEB, 0x870E, 0xDFEC, 0x8709, 0xDFED, 0x8701, - 0xDFEE, 0x86F6, 0xDFEF, 0x870D, 0xDFF0, 0x8705, 0xDFF1, 0x88D6, - 0xDFF2, 0x88CB, 0xDFF3, 0x88CD, 0xDFF4, 0x88CE, 0xDFF5, 0x88DE, - 0xDFF6, 0x88DB, 0xDFF7, 0x88DA, 0xDFF8, 0x88CC, 0xDFF9, 0x88D0, - 0xDFFA, 0x8985, 0xDFFB, 0x899B, 0xDFFC, 0x89DF, 0xDFFD, 0x89E5, - 0xDFFE, 0x89E4, 0xE040, 0x89E1, 0xE041, 0x89E0, 0xE042, 0x89E2, - 0xE043, 0x89DC, 0xE044, 0x89E6, 0xE045, 0x8A76, 0xE046, 0x8A86, - 0xE047, 0x8A7F, 0xE048, 0x8A61, 0xE049, 0x8A3F, 0xE04A, 0x8A77, - 0xE04B, 0x8A82, 0xE04C, 0x8A84, 0xE04D, 0x8A75, 0xE04E, 0x8A83, - 0xE04F, 0x8A81, 0xE050, 0x8A74, 0xE051, 0x8A7A, 0xE052, 0x8C3C, - 0xE053, 0x8C4B, 0xE054, 0x8C4A, 0xE055, 0x8C65, 0xE056, 0x8C64, - 0xE057, 0x8C66, 0xE058, 0x8C86, 0xE059, 0x8C84, 0xE05A, 0x8C85, - 0xE05B, 0x8CCC, 0xE05C, 0x8D68, 0xE05D, 0x8D69, 0xE05E, 0x8D91, - 0xE05F, 0x8D8C, 0xE060, 0x8D8E, 0xE061, 0x8D8F, 0xE062, 0x8D8D, - 0xE063, 0x8D93, 0xE064, 0x8D94, 0xE065, 0x8D90, 0xE066, 0x8D92, - 0xE067, 0x8DF0, 0xE068, 0x8DE0, 0xE069, 0x8DEC, 0xE06A, 0x8DF1, - 0xE06B, 0x8DEE, 0xE06C, 0x8DD0, 0xE06D, 0x8DE9, 0xE06E, 0x8DE3, - 0xE06F, 0x8DE2, 0xE070, 0x8DE7, 0xE071, 0x8DF2, 0xE072, 0x8DEB, - 0xE073, 0x8DF4, 0xE074, 0x8F06, 0xE075, 0x8EFF, 0xE076, 0x8F01, - 0xE077, 0x8F00, 0xE078, 0x8F05, 0xE079, 0x8F07, 0xE07A, 0x8F08, - 0xE07B, 0x8F02, 0xE07C, 0x8F0B, 0xE07D, 0x9052, 0xE07E, 0x903F, - 0xE0A1, 0x9044, 0xE0A2, 0x9049, 0xE0A3, 0x903D, 0xE0A4, 0x9110, - 0xE0A5, 0x910D, 0xE0A6, 0x910F, 0xE0A7, 0x9111, 0xE0A8, 0x9116, - 0xE0A9, 0x9114, 0xE0AA, 0x910B, 0xE0AB, 0x910E, 0xE0AC, 0x916E, - 0xE0AD, 0x916F, 0xE0AE, 0x9248, 0xE0AF, 0x9252, 0xE0B0, 0x9230, - 0xE0B1, 0x923A, 0xE0B2, 0x9266, 0xE0B3, 0x9233, 0xE0B4, 0x9265, - 0xE0B5, 0x925E, 0xE0B6, 0x9283, 0xE0B7, 0x922E, 0xE0B8, 0x924A, - 0xE0B9, 0x9246, 0xE0BA, 0x926D, 0xE0BB, 0x926C, 0xE0BC, 0x924F, - 0xE0BD, 0x9260, 0xE0BE, 0x9267, 0xE0BF, 0x926F, 0xE0C0, 0x9236, - 0xE0C1, 0x9261, 0xE0C2, 0x9270, 0xE0C3, 0x9231, 0xE0C4, 0x9254, - 0xE0C5, 0x9263, 0xE0C6, 0x9250, 0xE0C7, 0x9272, 0xE0C8, 0x924E, - 0xE0C9, 0x9253, 0xE0CA, 0x924C, 0xE0CB, 0x9256, 0xE0CC, 0x9232, - 0xE0CD, 0x959F, 0xE0CE, 0x959C, 0xE0CF, 0x959E, 0xE0D0, 0x959B, - 0xE0D1, 0x9692, 0xE0D2, 0x9693, 0xE0D3, 0x9691, 0xE0D4, 0x9697, - 0xE0D5, 0x96CE, 0xE0D6, 0x96FA, 0xE0D7, 0x96FD, 0xE0D8, 0x96F8, - 0xE0D9, 0x96F5, 0xE0DA, 0x9773, 0xE0DB, 0x9777, 0xE0DC, 0x9778, - 0xE0DD, 0x9772, 0xE0DE, 0x980F, 0xE0DF, 0x980D, 0xE0E0, 0x980E, - 0xE0E1, 0x98AC, 0xE0E2, 0x98F6, 0xE0E3, 0x98F9, 0xE0E4, 0x99AF, - 0xE0E5, 0x99B2, 0xE0E6, 0x99B0, 0xE0E7, 0x99B5, 0xE0E8, 0x9AAD, - 0xE0E9, 0x9AAB, 0xE0EA, 0x9B5B, 0xE0EB, 0x9CEA, 0xE0EC, 0x9CED, - 0xE0ED, 0x9CE7, 0xE0EE, 0x9E80, 0xE0EF, 0x9EFD, 0xE0F0, 0x50E6, - 0xE0F1, 0x50D4, 0xE0F2, 0x50D7, 0xE0F3, 0x50E8, 0xE0F4, 0x50F3, - 0xE0F5, 0x50DB, 0xE0F6, 0x50EA, 0xE0F7, 0x50DD, 0xE0F8, 0x50E4, - 0xE0F9, 0x50D3, 0xE0FA, 0x50EC, 0xE0FB, 0x50F0, 0xE0FC, 0x50EF, - 0xE0FD, 0x50E3, 0xE0FE, 0x50E0, 0xE140, 0x51D8, 0xE141, 0x5280, - 0xE142, 0x5281, 0xE143, 0x52E9, 0xE144, 0x52EB, 0xE145, 0x5330, - 0xE146, 0x53AC, 0xE147, 0x5627, 0xE148, 0x5615, 0xE149, 0x560C, - 0xE14A, 0x5612, 0xE14B, 0x55FC, 0xE14C, 0x560F, 0xE14D, 0x561C, - 0xE14E, 0x5601, 0xE14F, 0x5613, 0xE150, 0x5602, 0xE151, 0x55FA, - 0xE152, 0x561D, 0xE153, 0x5604, 0xE154, 0x55FF, 0xE155, 0x55F9, - 0xE156, 0x5889, 0xE157, 0x587C, 0xE158, 0x5890, 0xE159, 0x5898, - 0xE15A, 0x5886, 0xE15B, 0x5881, 0xE15C, 0x587F, 0xE15D, 0x5874, - 0xE15E, 0x588B, 0xE15F, 0x587A, 0xE160, 0x5887, 0xE161, 0x5891, - 0xE162, 0x588E, 0xE163, 0x5876, 0xE164, 0x5882, 0xE165, 0x5888, - 0xE166, 0x587B, 0xE167, 0x5894, 0xE168, 0x588F, 0xE169, 0x58FE, - 0xE16A, 0x596B, 0xE16B, 0x5ADC, 0xE16C, 0x5AEE, 0xE16D, 0x5AE5, - 0xE16E, 0x5AD5, 0xE16F, 0x5AEA, 0xE170, 0x5ADA, 0xE171, 0x5AED, - 0xE172, 0x5AEB, 0xE173, 0x5AF3, 0xE174, 0x5AE2, 0xE175, 0x5AE0, - 0xE176, 0x5ADB, 0xE177, 0x5AEC, 0xE178, 0x5ADE, 0xE179, 0x5ADD, - 0xE17A, 0x5AD9, 0xE17B, 0x5AE8, 0xE17C, 0x5ADF, 0xE17D, 0x5B77, - 0xE17E, 0x5BE0, 0xE1A1, 0x5BE3, 0xE1A2, 0x5C63, 0xE1A3, 0x5D82, - 0xE1A4, 0x5D80, 0xE1A5, 0x5D7D, 0xE1A6, 0x5D86, 0xE1A7, 0x5D7A, - 0xE1A8, 0x5D81, 0xE1A9, 0x5D77, 0xE1AA, 0x5D8A, 0xE1AB, 0x5D89, - 0xE1AC, 0x5D88, 0xE1AD, 0x5D7E, 0xE1AE, 0x5D7C, 0xE1AF, 0x5D8D, - 0xE1B0, 0x5D79, 0xE1B1, 0x5D7F, 0xE1B2, 0x5E58, 0xE1B3, 0x5E59, - 0xE1B4, 0x5E53, 0xE1B5, 0x5ED8, 0xE1B6, 0x5ED1, 0xE1B7, 0x5ED7, - 0xE1B8, 0x5ECE, 0xE1B9, 0x5EDC, 0xE1BA, 0x5ED5, 0xE1BB, 0x5ED9, - 0xE1BC, 0x5ED2, 0xE1BD, 0x5ED4, 0xE1BE, 0x5F44, 0xE1BF, 0x5F43, - 0xE1C0, 0x5F6F, 0xE1C1, 0x5FB6, 0xE1C2, 0x612C, 0xE1C3, 0x6128, - 0xE1C4, 0x6141, 0xE1C5, 0x615E, 0xE1C6, 0x6171, 0xE1C7, 0x6173, - 0xE1C8, 0x6152, 0xE1C9, 0x6153, 0xE1CA, 0x6172, 0xE1CB, 0x616C, - 0xE1CC, 0x6180, 0xE1CD, 0x6174, 0xE1CE, 0x6154, 0xE1CF, 0x617A, - 0xE1D0, 0x615B, 0xE1D1, 0x6165, 0xE1D2, 0x613B, 0xE1D3, 0x616A, - 0xE1D4, 0x6161, 0xE1D5, 0x6156, 0xE1D6, 0x6229, 0xE1D7, 0x6227, - 0xE1D8, 0x622B, 0xE1D9, 0x642B, 0xE1DA, 0x644D, 0xE1DB, 0x645B, - 0xE1DC, 0x645D, 0xE1DD, 0x6474, 0xE1DE, 0x6476, 0xE1DF, 0x6472, - 0xE1E0, 0x6473, 0xE1E1, 0x647D, 0xE1E2, 0x6475, 0xE1E3, 0x6466, - 0xE1E4, 0x64A6, 0xE1E5, 0x644E, 0xE1E6, 0x6482, 0xE1E7, 0x645E, - 0xE1E8, 0x645C, 0xE1E9, 0x644B, 0xE1EA, 0x6453, 0xE1EB, 0x6460, - 0xE1EC, 0x6450, 0xE1ED, 0x647F, 0xE1EE, 0x643F, 0xE1EF, 0x646C, - 0xE1F0, 0x646B, 0xE1F1, 0x6459, 0xE1F2, 0x6465, 0xE1F3, 0x6477, - 0xE1F4, 0x6573, 0xE1F5, 0x65A0, 0xE1F6, 0x66A1, 0xE1F7, 0x66A0, - 0xE1F8, 0x669F, 0xE1F9, 0x6705, 0xE1FA, 0x6704, 0xE1FB, 0x6722, - 0xE1FC, 0x69B1, 0xE1FD, 0x69B6, 0xE1FE, 0x69C9, 0xE240, 0x69A0, - 0xE241, 0x69CE, 0xE242, 0x6996, 0xE243, 0x69B0, 0xE244, 0x69AC, - 0xE245, 0x69BC, 0xE246, 0x6991, 0xE247, 0x6999, 0xE248, 0x698E, - 0xE249, 0x69A7, 0xE24A, 0x698D, 0xE24B, 0x69A9, 0xE24C, 0x69BE, - 0xE24D, 0x69AF, 0xE24E, 0x69BF, 0xE24F, 0x69C4, 0xE250, 0x69BD, - 0xE251, 0x69A4, 0xE252, 0x69D4, 0xE253, 0x69B9, 0xE254, 0x69CA, - 0xE255, 0x699A, 0xE256, 0x69CF, 0xE257, 0x69B3, 0xE258, 0x6993, - 0xE259, 0x69AA, 0xE25A, 0x69A1, 0xE25B, 0x699E, 0xE25C, 0x69D9, - 0xE25D, 0x6997, 0xE25E, 0x6990, 0xE25F, 0x69C2, 0xE260, 0x69B5, - 0xE261, 0x69A5, 0xE262, 0x69C6, 0xE263, 0x6B4A, 0xE264, 0x6B4D, - 0xE265, 0x6B4B, 0xE266, 0x6B9E, 0xE267, 0x6B9F, 0xE268, 0x6BA0, - 0xE269, 0x6BC3, 0xE26A, 0x6BC4, 0xE26B, 0x6BFE, 0xE26C, 0x6ECE, - 0xE26D, 0x6EF5, 0xE26E, 0x6EF1, 0xE26F, 0x6F03, 0xE270, 0x6F25, - 0xE271, 0x6EF8, 0xE272, 0x6F37, 0xE273, 0x6EFB, 0xE274, 0x6F2E, - 0xE275, 0x6F09, 0xE276, 0x6F4E, 0xE277, 0x6F19, 0xE278, 0x6F1A, - 0xE279, 0x6F27, 0xE27A, 0x6F18, 0xE27B, 0x6F3B, 0xE27C, 0x6F12, - 0xE27D, 0x6EED, 0xE27E, 0x6F0A, 0xE2A1, 0x6F36, 0xE2A2, 0x6F73, - 0xE2A3, 0x6EF9, 0xE2A4, 0x6EEE, 0xE2A5, 0x6F2D, 0xE2A6, 0x6F40, - 0xE2A7, 0x6F30, 0xE2A8, 0x6F3C, 0xE2A9, 0x6F35, 0xE2AA, 0x6EEB, - 0xE2AB, 0x6F07, 0xE2AC, 0x6F0E, 0xE2AD, 0x6F43, 0xE2AE, 0x6F05, - 0xE2AF, 0x6EFD, 0xE2B0, 0x6EF6, 0xE2B1, 0x6F39, 0xE2B2, 0x6F1C, - 0xE2B3, 0x6EFC, 0xE2B4, 0x6F3A, 0xE2B5, 0x6F1F, 0xE2B6, 0x6F0D, - 0xE2B7, 0x6F1E, 0xE2B8, 0x6F08, 0xE2B9, 0x6F21, 0xE2BA, 0x7187, - 0xE2BB, 0x7190, 0xE2BC, 0x7189, 0xE2BD, 0x7180, 0xE2BE, 0x7185, - 0xE2BF, 0x7182, 0xE2C0, 0x718F, 0xE2C1, 0x717B, 0xE2C2, 0x7186, - 0xE2C3, 0x7181, 0xE2C4, 0x7197, 0xE2C5, 0x7244, 0xE2C6, 0x7253, - 0xE2C7, 0x7297, 0xE2C8, 0x7295, 0xE2C9, 0x7293, 0xE2CA, 0x7343, - 0xE2CB, 0x734D, 0xE2CC, 0x7351, 0xE2CD, 0x734C, 0xE2CE, 0x7462, - 0xE2CF, 0x7473, 0xE2D0, 0x7471, 0xE2D1, 0x7475, 0xE2D2, 0x7472, - 0xE2D3, 0x7467, 0xE2D4, 0x746E, 0xE2D5, 0x7500, 0xE2D6, 0x7502, - 0xE2D7, 0x7503, 0xE2D8, 0x757D, 0xE2D9, 0x7590, 0xE2DA, 0x7616, - 0xE2DB, 0x7608, 0xE2DC, 0x760C, 0xE2DD, 0x7615, 0xE2DE, 0x7611, - 0xE2DF, 0x760A, 0xE2E0, 0x7614, 0xE2E1, 0x76B8, 0xE2E2, 0x7781, - 0xE2E3, 0x777C, 0xE2E4, 0x7785, 0xE2E5, 0x7782, 0xE2E6, 0x776E, - 0xE2E7, 0x7780, 0xE2E8, 0x776F, 0xE2E9, 0x777E, 0xE2EA, 0x7783, - 0xE2EB, 0x78B2, 0xE2EC, 0x78AA, 0xE2ED, 0x78B4, 0xE2EE, 0x78AD, - 0xE2EF, 0x78A8, 0xE2F0, 0x787E, 0xE2F1, 0x78AB, 0xE2F2, 0x789E, - 0xE2F3, 0x78A5, 0xE2F4, 0x78A0, 0xE2F5, 0x78AC, 0xE2F6, 0x78A2, - 0xE2F7, 0x78A4, 0xE2F8, 0x7998, 0xE2F9, 0x798A, 0xE2FA, 0x798B, - 0xE2FB, 0x7996, 0xE2FC, 0x7995, 0xE2FD, 0x7994, 0xE2FE, 0x7993, - 0xE340, 0x7997, 0xE341, 0x7988, 0xE342, 0x7992, 0xE343, 0x7990, - 0xE344, 0x7A2B, 0xE345, 0x7A4A, 0xE346, 0x7A30, 0xE347, 0x7A2F, - 0xE348, 0x7A28, 0xE349, 0x7A26, 0xE34A, 0x7AA8, 0xE34B, 0x7AAB, - 0xE34C, 0x7AAC, 0xE34D, 0x7AEE, 0xE34E, 0x7B88, 0xE34F, 0x7B9C, - 0xE350, 0x7B8A, 0xE351, 0x7B91, 0xE352, 0x7B90, 0xE353, 0x7B96, - 0xE354, 0x7B8D, 0xE355, 0x7B8C, 0xE356, 0x7B9B, 0xE357, 0x7B8E, - 0xE358, 0x7B85, 0xE359, 0x7B98, 0xE35A, 0x5284, 0xE35B, 0x7B99, - 0xE35C, 0x7BA4, 0xE35D, 0x7B82, 0xE35E, 0x7CBB, 0xE35F, 0x7CBF, - 0xE360, 0x7CBC, 0xE361, 0x7CBA, 0xE362, 0x7DA7, 0xE363, 0x7DB7, - 0xE364, 0x7DC2, 0xE365, 0x7DA3, 0xE366, 0x7DAA, 0xE367, 0x7DC1, - 0xE368, 0x7DC0, 0xE369, 0x7DC5, 0xE36A, 0x7D9D, 0xE36B, 0x7DCE, - 0xE36C, 0x7DC4, 0xE36D, 0x7DC6, 0xE36E, 0x7DCB, 0xE36F, 0x7DCC, - 0xE370, 0x7DAF, 0xE371, 0x7DB9, 0xE372, 0x7D96, 0xE373, 0x7DBC, - 0xE374, 0x7D9F, 0xE375, 0x7DA6, 0xE376, 0x7DAE, 0xE377, 0x7DA9, - 0xE378, 0x7DA1, 0xE379, 0x7DC9, 0xE37A, 0x7F73, 0xE37B, 0x7FE2, - 0xE37C, 0x7FE3, 0xE37D, 0x7FE5, 0xE37E, 0x7FDE, 0xE3A1, 0x8024, - 0xE3A2, 0x805D, 0xE3A3, 0x805C, 0xE3A4, 0x8189, 0xE3A5, 0x8186, - 0xE3A6, 0x8183, 0xE3A7, 0x8187, 0xE3A8, 0x818D, 0xE3A9, 0x818C, - 0xE3AA, 0x818B, 0xE3AB, 0x8215, 0xE3AC, 0x8497, 0xE3AD, 0x84A4, - 0xE3AE, 0x84A1, 0xE3AF, 0x849F, 0xE3B0, 0x84BA, 0xE3B1, 0x84CE, - 0xE3B2, 0x84C2, 0xE3B3, 0x84AC, 0xE3B4, 0x84AE, 0xE3B5, 0x84AB, - 0xE3B6, 0x84B9, 0xE3B7, 0x84B4, 0xE3B8, 0x84C1, 0xE3B9, 0x84CD, - 0xE3BA, 0x84AA, 0xE3BB, 0x849A, 0xE3BC, 0x84B1, 0xE3BD, 0x84D0, - 0xE3BE, 0x849D, 0xE3BF, 0x84A7, 0xE3C0, 0x84BB, 0xE3C1, 0x84A2, - 0xE3C2, 0x8494, 0xE3C3, 0x84C7, 0xE3C4, 0x84CC, 0xE3C5, 0x849B, - 0xE3C6, 0x84A9, 0xE3C7, 0x84AF, 0xE3C8, 0x84A8, 0xE3C9, 0x84D6, - 0xE3CA, 0x8498, 0xE3CB, 0x84B6, 0xE3CC, 0x84CF, 0xE3CD, 0x84A0, - 0xE3CE, 0x84D7, 0xE3CF, 0x84D4, 0xE3D0, 0x84D2, 0xE3D1, 0x84DB, - 0xE3D2, 0x84B0, 0xE3D3, 0x8491, 0xE3D4, 0x8661, 0xE3D5, 0x8733, - 0xE3D6, 0x8723, 0xE3D7, 0x8728, 0xE3D8, 0x876B, 0xE3D9, 0x8740, - 0xE3DA, 0x872E, 0xE3DB, 0x871E, 0xE3DC, 0x8721, 0xE3DD, 0x8719, - 0xE3DE, 0x871B, 0xE3DF, 0x8743, 0xE3E0, 0x872C, 0xE3E1, 0x8741, - 0xE3E2, 0x873E, 0xE3E3, 0x8746, 0xE3E4, 0x8720, 0xE3E5, 0x8732, - 0xE3E6, 0x872A, 0xE3E7, 0x872D, 0xE3E8, 0x873C, 0xE3E9, 0x8712, - 0xE3EA, 0x873A, 0xE3EB, 0x8731, 0xE3EC, 0x8735, 0xE3ED, 0x8742, - 0xE3EE, 0x8726, 0xE3EF, 0x8727, 0xE3F0, 0x8738, 0xE3F1, 0x8724, - 0xE3F2, 0x871A, 0xE3F3, 0x8730, 0xE3F4, 0x8711, 0xE3F5, 0x88F7, - 0xE3F6, 0x88E7, 0xE3F7, 0x88F1, 0xE3F8, 0x88F2, 0xE3F9, 0x88FA, - 0xE3FA, 0x88FE, 0xE3FB, 0x88EE, 0xE3FC, 0x88FC, 0xE3FD, 0x88F6, - 0xE3FE, 0x88FB, 0xE440, 0x88F0, 0xE441, 0x88EC, 0xE442, 0x88EB, - 0xE443, 0x899D, 0xE444, 0x89A1, 0xE445, 0x899F, 0xE446, 0x899E, - 0xE447, 0x89E9, 0xE448, 0x89EB, 0xE449, 0x89E8, 0xE44A, 0x8AAB, - 0xE44B, 0x8A99, 0xE44C, 0x8A8B, 0xE44D, 0x8A92, 0xE44E, 0x8A8F, - 0xE44F, 0x8A96, 0xE450, 0x8C3D, 0xE451, 0x8C68, 0xE452, 0x8C69, - 0xE453, 0x8CD5, 0xE454, 0x8CCF, 0xE455, 0x8CD7, 0xE456, 0x8D96, - 0xE457, 0x8E09, 0xE458, 0x8E02, 0xE459, 0x8DFF, 0xE45A, 0x8E0D, - 0xE45B, 0x8DFD, 0xE45C, 0x8E0A, 0xE45D, 0x8E03, 0xE45E, 0x8E07, - 0xE45F, 0x8E06, 0xE460, 0x8E05, 0xE461, 0x8DFE, 0xE462, 0x8E00, - 0xE463, 0x8E04, 0xE464, 0x8F10, 0xE465, 0x8F11, 0xE466, 0x8F0E, - 0xE467, 0x8F0D, 0xE468, 0x9123, 0xE469, 0x911C, 0xE46A, 0x9120, - 0xE46B, 0x9122, 0xE46C, 0x911F, 0xE46D, 0x911D, 0xE46E, 0x911A, - 0xE46F, 0x9124, 0xE470, 0x9121, 0xE471, 0x911B, 0xE472, 0x917A, - 0xE473, 0x9172, 0xE474, 0x9179, 0xE475, 0x9173, 0xE476, 0x92A5, - 0xE477, 0x92A4, 0xE478, 0x9276, 0xE479, 0x929B, 0xE47A, 0x927A, - 0xE47B, 0x92A0, 0xE47C, 0x9294, 0xE47D, 0x92AA, 0xE47E, 0x928D, - 0xE4A1, 0x92A6, 0xE4A2, 0x929A, 0xE4A3, 0x92AB, 0xE4A4, 0x9279, - 0xE4A5, 0x9297, 0xE4A6, 0x927F, 0xE4A7, 0x92A3, 0xE4A8, 0x92EE, - 0xE4A9, 0x928E, 0xE4AA, 0x9282, 0xE4AB, 0x9295, 0xE4AC, 0x92A2, - 0xE4AD, 0x927D, 0xE4AE, 0x9288, 0xE4AF, 0x92A1, 0xE4B0, 0x928A, - 0xE4B1, 0x9286, 0xE4B2, 0x928C, 0xE4B3, 0x9299, 0xE4B4, 0x92A7, - 0xE4B5, 0x927E, 0xE4B6, 0x9287, 0xE4B7, 0x92A9, 0xE4B8, 0x929D, - 0xE4B9, 0x928B, 0xE4BA, 0x922D, 0xE4BB, 0x969E, 0xE4BC, 0x96A1, - 0xE4BD, 0x96FF, 0xE4BE, 0x9758, 0xE4BF, 0x977D, 0xE4C0, 0x977A, - 0xE4C1, 0x977E, 0xE4C2, 0x9783, 0xE4C3, 0x9780, 0xE4C4, 0x9782, - 0xE4C5, 0x977B, 0xE4C6, 0x9784, 0xE4C7, 0x9781, 0xE4C8, 0x977F, - 0xE4C9, 0x97CE, 0xE4CA, 0x97CD, 0xE4CB, 0x9816, 0xE4CC, 0x98AD, - 0xE4CD, 0x98AE, 0xE4CE, 0x9902, 0xE4CF, 0x9900, 0xE4D0, 0x9907, - 0xE4D1, 0x999D, 0xE4D2, 0x999C, 0xE4D3, 0x99C3, 0xE4D4, 0x99B9, - 0xE4D5, 0x99BB, 0xE4D6, 0x99BA, 0xE4D7, 0x99C2, 0xE4D8, 0x99BD, - 0xE4D9, 0x99C7, 0xE4DA, 0x9AB1, 0xE4DB, 0x9AE3, 0xE4DC, 0x9AE7, - 0xE4DD, 0x9B3E, 0xE4DE, 0x9B3F, 0xE4DF, 0x9B60, 0xE4E0, 0x9B61, - 0xE4E1, 0x9B5F, 0xE4E2, 0x9CF1, 0xE4E3, 0x9CF2, 0xE4E4, 0x9CF5, - 0xE4E5, 0x9EA7, 0xE4E6, 0x50FF, 0xE4E7, 0x5103, 0xE4E8, 0x5130, - 0xE4E9, 0x50F8, 0xE4EA, 0x5106, 0xE4EB, 0x5107, 0xE4EC, 0x50F6, - 0xE4ED, 0x50FE, 0xE4EE, 0x510B, 0xE4EF, 0x510C, 0xE4F0, 0x50FD, - 0xE4F1, 0x510A, 0xE4F2, 0x528B, 0xE4F3, 0x528C, 0xE4F4, 0x52F1, - 0xE4F5, 0x52EF, 0xE4F6, 0x5648, 0xE4F7, 0x5642, 0xE4F8, 0x564C, - 0xE4F9, 0x5635, 0xE4FA, 0x5641, 0xE4FB, 0x564A, 0xE4FC, 0x5649, - 0xE4FD, 0x5646, 0xE4FE, 0x5658, 0xE540, 0x565A, 0xE541, 0x5640, - 0xE542, 0x5633, 0xE543, 0x563D, 0xE544, 0x562C, 0xE545, 0x563E, - 0xE546, 0x5638, 0xE547, 0x562A, 0xE548, 0x563A, 0xE549, 0x571A, - 0xE54A, 0x58AB, 0xE54B, 0x589D, 0xE54C, 0x58B1, 0xE54D, 0x58A0, - 0xE54E, 0x58A3, 0xE54F, 0x58AF, 0xE550, 0x58AC, 0xE551, 0x58A5, - 0xE552, 0x58A1, 0xE553, 0x58FF, 0xE554, 0x5AFF, 0xE555, 0x5AF4, - 0xE556, 0x5AFD, 0xE557, 0x5AF7, 0xE558, 0x5AF6, 0xE559, 0x5B03, - 0xE55A, 0x5AF8, 0xE55B, 0x5B02, 0xE55C, 0x5AF9, 0xE55D, 0x5B01, - 0xE55E, 0x5B07, 0xE55F, 0x5B05, 0xE560, 0x5B0F, 0xE561, 0x5C67, - 0xE562, 0x5D99, 0xE563, 0x5D97, 0xE564, 0x5D9F, 0xE565, 0x5D92, - 0xE566, 0x5DA2, 0xE567, 0x5D93, 0xE568, 0x5D95, 0xE569, 0x5DA0, - 0xE56A, 0x5D9C, 0xE56B, 0x5DA1, 0xE56C, 0x5D9A, 0xE56D, 0x5D9E, - 0xE56E, 0x5E69, 0xE56F, 0x5E5D, 0xE570, 0x5E60, 0xE571, 0x5E5C, - 0xE572, 0x7DF3, 0xE573, 0x5EDB, 0xE574, 0x5EDE, 0xE575, 0x5EE1, - 0xE576, 0x5F49, 0xE577, 0x5FB2, 0xE578, 0x618B, 0xE579, 0x6183, - 0xE57A, 0x6179, 0xE57B, 0x61B1, 0xE57C, 0x61B0, 0xE57D, 0x61A2, - 0xE57E, 0x6189, 0xE5A1, 0x619B, 0xE5A2, 0x6193, 0xE5A3, 0x61AF, - 0xE5A4, 0x61AD, 0xE5A5, 0x619F, 0xE5A6, 0x6192, 0xE5A7, 0x61AA, - 0xE5A8, 0x61A1, 0xE5A9, 0x618D, 0xE5AA, 0x6166, 0xE5AB, 0x61B3, - 0xE5AC, 0x622D, 0xE5AD, 0x646E, 0xE5AE, 0x6470, 0xE5AF, 0x6496, - 0xE5B0, 0x64A0, 0xE5B1, 0x6485, 0xE5B2, 0x6497, 0xE5B3, 0x649C, - 0xE5B4, 0x648F, 0xE5B5, 0x648B, 0xE5B6, 0x648A, 0xE5B7, 0x648C, - 0xE5B8, 0x64A3, 0xE5B9, 0x649F, 0xE5BA, 0x6468, 0xE5BB, 0x64B1, - 0xE5BC, 0x6498, 0xE5BD, 0x6576, 0xE5BE, 0x657A, 0xE5BF, 0x6579, - 0xE5C0, 0x657B, 0xE5C1, 0x65B2, 0xE5C2, 0x65B3, 0xE5C3, 0x66B5, - 0xE5C4, 0x66B0, 0xE5C5, 0x66A9, 0xE5C6, 0x66B2, 0xE5C7, 0x66B7, - 0xE5C8, 0x66AA, 0xE5C9, 0x66AF, 0xE5CA, 0x6A00, 0xE5CB, 0x6A06, - 0xE5CC, 0x6A17, 0xE5CD, 0x69E5, 0xE5CE, 0x69F8, 0xE5CF, 0x6A15, - 0xE5D0, 0x69F1, 0xE5D1, 0x69E4, 0xE5D2, 0x6A20, 0xE5D3, 0x69FF, - 0xE5D4, 0x69EC, 0xE5D5, 0x69E2, 0xE5D6, 0x6A1B, 0xE5D7, 0x6A1D, - 0xE5D8, 0x69FE, 0xE5D9, 0x6A27, 0xE5DA, 0x69F2, 0xE5DB, 0x69EE, - 0xE5DC, 0x6A14, 0xE5DD, 0x69F7, 0xE5DE, 0x69E7, 0xE5DF, 0x6A40, - 0xE5E0, 0x6A08, 0xE5E1, 0x69E6, 0xE5E2, 0x69FB, 0xE5E3, 0x6A0D, - 0xE5E4, 0x69FC, 0xE5E5, 0x69EB, 0xE5E6, 0x6A09, 0xE5E7, 0x6A04, - 0xE5E8, 0x6A18, 0xE5E9, 0x6A25, 0xE5EA, 0x6A0F, 0xE5EB, 0x69F6, - 0xE5EC, 0x6A26, 0xE5ED, 0x6A07, 0xE5EE, 0x69F4, 0xE5EF, 0x6A16, - 0xE5F0, 0x6B51, 0xE5F1, 0x6BA5, 0xE5F2, 0x6BA3, 0xE5F3, 0x6BA2, - 0xE5F4, 0x6BA6, 0xE5F5, 0x6C01, 0xE5F6, 0x6C00, 0xE5F7, 0x6BFF, - 0xE5F8, 0x6C02, 0xE5F9, 0x6F41, 0xE5FA, 0x6F26, 0xE5FB, 0x6F7E, - 0xE5FC, 0x6F87, 0xE5FD, 0x6FC6, 0xE5FE, 0x6F92, 0xE640, 0x6F8D, - 0xE641, 0x6F89, 0xE642, 0x6F8C, 0xE643, 0x6F62, 0xE644, 0x6F4F, - 0xE645, 0x6F85, 0xE646, 0x6F5A, 0xE647, 0x6F96, 0xE648, 0x6F76, - 0xE649, 0x6F6C, 0xE64A, 0x6F82, 0xE64B, 0x6F55, 0xE64C, 0x6F72, - 0xE64D, 0x6F52, 0xE64E, 0x6F50, 0xE64F, 0x6F57, 0xE650, 0x6F94, - 0xE651, 0x6F93, 0xE652, 0x6F5D, 0xE653, 0x6F00, 0xE654, 0x6F61, - 0xE655, 0x6F6B, 0xE656, 0x6F7D, 0xE657, 0x6F67, 0xE658, 0x6F90, - 0xE659, 0x6F53, 0xE65A, 0x6F8B, 0xE65B, 0x6F69, 0xE65C, 0x6F7F, - 0xE65D, 0x6F95, 0xE65E, 0x6F63, 0xE65F, 0x6F77, 0xE660, 0x6F6A, - 0xE661, 0x6F7B, 0xE662, 0x71B2, 0xE663, 0x71AF, 0xE664, 0x719B, - 0xE665, 0x71B0, 0xE666, 0x71A0, 0xE667, 0x719A, 0xE668, 0x71A9, - 0xE669, 0x71B5, 0xE66A, 0x719D, 0xE66B, 0x71A5, 0xE66C, 0x719E, - 0xE66D, 0x71A4, 0xE66E, 0x71A1, 0xE66F, 0x71AA, 0xE670, 0x719C, - 0xE671, 0x71A7, 0xE672, 0x71B3, 0xE673, 0x7298, 0xE674, 0x729A, - 0xE675, 0x7358, 0xE676, 0x7352, 0xE677, 0x735E, 0xE678, 0x735F, - 0xE679, 0x7360, 0xE67A, 0x735D, 0xE67B, 0x735B, 0xE67C, 0x7361, - 0xE67D, 0x735A, 0xE67E, 0x7359, 0xE6A1, 0x7362, 0xE6A2, 0x7487, - 0xE6A3, 0x7489, 0xE6A4, 0x748A, 0xE6A5, 0x7486, 0xE6A6, 0x7481, - 0xE6A7, 0x747D, 0xE6A8, 0x7485, 0xE6A9, 0x7488, 0xE6AA, 0x747C, - 0xE6AB, 0x7479, 0xE6AC, 0x7508, 0xE6AD, 0x7507, 0xE6AE, 0x757E, - 0xE6AF, 0x7625, 0xE6B0, 0x761E, 0xE6B1, 0x7619, 0xE6B2, 0x761D, - 0xE6B3, 0x761C, 0xE6B4, 0x7623, 0xE6B5, 0x761A, 0xE6B6, 0x7628, - 0xE6B7, 0x761B, 0xE6B8, 0x769C, 0xE6B9, 0x769D, 0xE6BA, 0x769E, - 0xE6BB, 0x769B, 0xE6BC, 0x778D, 0xE6BD, 0x778F, 0xE6BE, 0x7789, - 0xE6BF, 0x7788, 0xE6C0, 0x78CD, 0xE6C1, 0x78BB, 0xE6C2, 0x78CF, - 0xE6C3, 0x78CC, 0xE6C4, 0x78D1, 0xE6C5, 0x78CE, 0xE6C6, 0x78D4, - 0xE6C7, 0x78C8, 0xE6C8, 0x78C3, 0xE6C9, 0x78C4, 0xE6CA, 0x78C9, - 0xE6CB, 0x799A, 0xE6CC, 0x79A1, 0xE6CD, 0x79A0, 0xE6CE, 0x799C, - 0xE6CF, 0x79A2, 0xE6D0, 0x799B, 0xE6D1, 0x6B76, 0xE6D2, 0x7A39, - 0xE6D3, 0x7AB2, 0xE6D4, 0x7AB4, 0xE6D5, 0x7AB3, 0xE6D6, 0x7BB7, - 0xE6D7, 0x7BCB, 0xE6D8, 0x7BBE, 0xE6D9, 0x7BAC, 0xE6DA, 0x7BCE, - 0xE6DB, 0x7BAF, 0xE6DC, 0x7BB9, 0xE6DD, 0x7BCA, 0xE6DE, 0x7BB5, - 0xE6DF, 0x7CC5, 0xE6E0, 0x7CC8, 0xE6E1, 0x7CCC, 0xE6E2, 0x7CCB, - 0xE6E3, 0x7DF7, 0xE6E4, 0x7DDB, 0xE6E5, 0x7DEA, 0xE6E6, 0x7DE7, - 0xE6E7, 0x7DD7, 0xE6E8, 0x7DE1, 0xE6E9, 0x7E03, 0xE6EA, 0x7DFA, - 0xE6EB, 0x7DE6, 0xE6EC, 0x7DF6, 0xE6ED, 0x7DF1, 0xE6EE, 0x7DF0, - 0xE6EF, 0x7DEE, 0xE6F0, 0x7DDF, 0xE6F1, 0x7F76, 0xE6F2, 0x7FAC, - 0xE6F3, 0x7FB0, 0xE6F4, 0x7FAD, 0xE6F5, 0x7FED, 0xE6F6, 0x7FEB, - 0xE6F7, 0x7FEA, 0xE6F8, 0x7FEC, 0xE6F9, 0x7FE6, 0xE6FA, 0x7FE8, - 0xE6FB, 0x8064, 0xE6FC, 0x8067, 0xE6FD, 0x81A3, 0xE6FE, 0x819F, - 0xE740, 0x819E, 0xE741, 0x8195, 0xE742, 0x81A2, 0xE743, 0x8199, - 0xE744, 0x8197, 0xE745, 0x8216, 0xE746, 0x824F, 0xE747, 0x8253, - 0xE748, 0x8252, 0xE749, 0x8250, 0xE74A, 0x824E, 0xE74B, 0x8251, - 0xE74C, 0x8524, 0xE74D, 0x853B, 0xE74E, 0x850F, 0xE74F, 0x8500, - 0xE750, 0x8529, 0xE751, 0x850E, 0xE752, 0x8509, 0xE753, 0x850D, - 0xE754, 0x851F, 0xE755, 0x850A, 0xE756, 0x8527, 0xE757, 0x851C, - 0xE758, 0x84FB, 0xE759, 0x852B, 0xE75A, 0x84FA, 0xE75B, 0x8508, - 0xE75C, 0x850C, 0xE75D, 0x84F4, 0xE75E, 0x852A, 0xE75F, 0x84F2, - 0xE760, 0x8515, 0xE761, 0x84F7, 0xE762, 0x84EB, 0xE763, 0x84F3, - 0xE764, 0x84FC, 0xE765, 0x8512, 0xE766, 0x84EA, 0xE767, 0x84E9, - 0xE768, 0x8516, 0xE769, 0x84FE, 0xE76A, 0x8528, 0xE76B, 0x851D, - 0xE76C, 0x852E, 0xE76D, 0x8502, 0xE76E, 0x84FD, 0xE76F, 0x851E, - 0xE770, 0x84F6, 0xE771, 0x8531, 0xE772, 0x8526, 0xE773, 0x84E7, - 0xE774, 0x84E8, 0xE775, 0x84F0, 0xE776, 0x84EF, 0xE777, 0x84F9, - 0xE778, 0x8518, 0xE779, 0x8520, 0xE77A, 0x8530, 0xE77B, 0x850B, - 0xE77C, 0x8519, 0xE77D, 0x852F, 0xE77E, 0x8662, 0xE7A1, 0x8756, - 0xE7A2, 0x8763, 0xE7A3, 0x8764, 0xE7A4, 0x8777, 0xE7A5, 0x87E1, - 0xE7A6, 0x8773, 0xE7A7, 0x8758, 0xE7A8, 0x8754, 0xE7A9, 0x875B, - 0xE7AA, 0x8752, 0xE7AB, 0x8761, 0xE7AC, 0x875A, 0xE7AD, 0x8751, - 0xE7AE, 0x875E, 0xE7AF, 0x876D, 0xE7B0, 0x876A, 0xE7B1, 0x8750, - 0xE7B2, 0x874E, 0xE7B3, 0x875F, 0xE7B4, 0x875D, 0xE7B5, 0x876F, - 0xE7B6, 0x876C, 0xE7B7, 0x877A, 0xE7B8, 0x876E, 0xE7B9, 0x875C, - 0xE7BA, 0x8765, 0xE7BB, 0x874F, 0xE7BC, 0x877B, 0xE7BD, 0x8775, - 0xE7BE, 0x8762, 0xE7BF, 0x8767, 0xE7C0, 0x8769, 0xE7C1, 0x885A, - 0xE7C2, 0x8905, 0xE7C3, 0x890C, 0xE7C4, 0x8914, 0xE7C5, 0x890B, - 0xE7C6, 0x8917, 0xE7C7, 0x8918, 0xE7C8, 0x8919, 0xE7C9, 0x8906, - 0xE7CA, 0x8916, 0xE7CB, 0x8911, 0xE7CC, 0x890E, 0xE7CD, 0x8909, - 0xE7CE, 0x89A2, 0xE7CF, 0x89A4, 0xE7D0, 0x89A3, 0xE7D1, 0x89ED, - 0xE7D2, 0x89F0, 0xE7D3, 0x89EC, 0xE7D4, 0x8ACF, 0xE7D5, 0x8AC6, - 0xE7D6, 0x8AB8, 0xE7D7, 0x8AD3, 0xE7D8, 0x8AD1, 0xE7D9, 0x8AD4, - 0xE7DA, 0x8AD5, 0xE7DB, 0x8ABB, 0xE7DC, 0x8AD7, 0xE7DD, 0x8ABE, - 0xE7DE, 0x8AC0, 0xE7DF, 0x8AC5, 0xE7E0, 0x8AD8, 0xE7E1, 0x8AC3, - 0xE7E2, 0x8ABA, 0xE7E3, 0x8ABD, 0xE7E4, 0x8AD9, 0xE7E5, 0x8C3E, - 0xE7E6, 0x8C4D, 0xE7E7, 0x8C8F, 0xE7E8, 0x8CE5, 0xE7E9, 0x8CDF, - 0xE7EA, 0x8CD9, 0xE7EB, 0x8CE8, 0xE7EC, 0x8CDA, 0xE7ED, 0x8CDD, - 0xE7EE, 0x8CE7, 0xE7EF, 0x8DA0, 0xE7F0, 0x8D9C, 0xE7F1, 0x8DA1, - 0xE7F2, 0x8D9B, 0xE7F3, 0x8E20, 0xE7F4, 0x8E23, 0xE7F5, 0x8E25, - 0xE7F6, 0x8E24, 0xE7F7, 0x8E2E, 0xE7F8, 0x8E15, 0xE7F9, 0x8E1B, - 0xE7FA, 0x8E16, 0xE7FB, 0x8E11, 0xE7FC, 0x8E19, 0xE7FD, 0x8E26, - 0xE7FE, 0x8E27, 0xE840, 0x8E14, 0xE841, 0x8E12, 0xE842, 0x8E18, - 0xE843, 0x8E13, 0xE844, 0x8E1C, 0xE845, 0x8E17, 0xE846, 0x8E1A, - 0xE847, 0x8F2C, 0xE848, 0x8F24, 0xE849, 0x8F18, 0xE84A, 0x8F1A, - 0xE84B, 0x8F20, 0xE84C, 0x8F23, 0xE84D, 0x8F16, 0xE84E, 0x8F17, - 0xE84F, 0x9073, 0xE850, 0x9070, 0xE851, 0x906F, 0xE852, 0x9067, - 0xE853, 0x906B, 0xE854, 0x912F, 0xE855, 0x912B, 0xE856, 0x9129, - 0xE857, 0x912A, 0xE858, 0x9132, 0xE859, 0x9126, 0xE85A, 0x912E, - 0xE85B, 0x9185, 0xE85C, 0x9186, 0xE85D, 0x918A, 0xE85E, 0x9181, - 0xE85F, 0x9182, 0xE860, 0x9184, 0xE861, 0x9180, 0xE862, 0x92D0, - 0xE863, 0x92C3, 0xE864, 0x92C4, 0xE865, 0x92C0, 0xE866, 0x92D9, - 0xE867, 0x92B6, 0xE868, 0x92CF, 0xE869, 0x92F1, 0xE86A, 0x92DF, - 0xE86B, 0x92D8, 0xE86C, 0x92E9, 0xE86D, 0x92D7, 0xE86E, 0x92DD, - 0xE86F, 0x92CC, 0xE870, 0x92EF, 0xE871, 0x92C2, 0xE872, 0x92E8, - 0xE873, 0x92CA, 0xE874, 0x92C8, 0xE875, 0x92CE, 0xE876, 0x92E6, - 0xE877, 0x92CD, 0xE878, 0x92D5, 0xE879, 0x92C9, 0xE87A, 0x92E0, - 0xE87B, 0x92DE, 0xE87C, 0x92E7, 0xE87D, 0x92D1, 0xE87E, 0x92D3, - 0xE8A1, 0x92B5, 0xE8A2, 0x92E1, 0xE8A3, 0x92C6, 0xE8A4, 0x92B4, - 0xE8A5, 0x957C, 0xE8A6, 0x95AC, 0xE8A7, 0x95AB, 0xE8A8, 0x95AE, - 0xE8A9, 0x95B0, 0xE8AA, 0x96A4, 0xE8AB, 0x96A2, 0xE8AC, 0x96D3, - 0xE8AD, 0x9705, 0xE8AE, 0x9708, 0xE8AF, 0x9702, 0xE8B0, 0x975A, - 0xE8B1, 0x978A, 0xE8B2, 0x978E, 0xE8B3, 0x9788, 0xE8B4, 0x97D0, - 0xE8B5, 0x97CF, 0xE8B6, 0x981E, 0xE8B7, 0x981D, 0xE8B8, 0x9826, - 0xE8B9, 0x9829, 0xE8BA, 0x9828, 0xE8BB, 0x9820, 0xE8BC, 0x981B, - 0xE8BD, 0x9827, 0xE8BE, 0x98B2, 0xE8BF, 0x9908, 0xE8C0, 0x98FA, - 0xE8C1, 0x9911, 0xE8C2, 0x9914, 0xE8C3, 0x9916, 0xE8C4, 0x9917, - 0xE8C5, 0x9915, 0xE8C6, 0x99DC, 0xE8C7, 0x99CD, 0xE8C8, 0x99CF, - 0xE8C9, 0x99D3, 0xE8CA, 0x99D4, 0xE8CB, 0x99CE, 0xE8CC, 0x99C9, - 0xE8CD, 0x99D6, 0xE8CE, 0x99D8, 0xE8CF, 0x99CB, 0xE8D0, 0x99D7, - 0xE8D1, 0x99CC, 0xE8D2, 0x9AB3, 0xE8D3, 0x9AEC, 0xE8D4, 0x9AEB, - 0xE8D5, 0x9AF3, 0xE8D6, 0x9AF2, 0xE8D7, 0x9AF1, 0xE8D8, 0x9B46, - 0xE8D9, 0x9B43, 0xE8DA, 0x9B67, 0xE8DB, 0x9B74, 0xE8DC, 0x9B71, - 0xE8DD, 0x9B66, 0xE8DE, 0x9B76, 0xE8DF, 0x9B75, 0xE8E0, 0x9B70, - 0xE8E1, 0x9B68, 0xE8E2, 0x9B64, 0xE8E3, 0x9B6C, 0xE8E4, 0x9CFC, - 0xE8E5, 0x9CFA, 0xE8E6, 0x9CFD, 0xE8E7, 0x9CFF, 0xE8E8, 0x9CF7, - 0xE8E9, 0x9D07, 0xE8EA, 0x9D00, 0xE8EB, 0x9CF9, 0xE8EC, 0x9CFB, - 0xE8ED, 0x9D08, 0xE8EE, 0x9D05, 0xE8EF, 0x9D04, 0xE8F0, 0x9E83, - 0xE8F1, 0x9ED3, 0xE8F2, 0x9F0F, 0xE8F3, 0x9F10, 0xE8F4, 0x511C, - 0xE8F5, 0x5113, 0xE8F6, 0x5117, 0xE8F7, 0x511A, 0xE8F8, 0x5111, - 0xE8F9, 0x51DE, 0xE8FA, 0x5334, 0xE8FB, 0x53E1, 0xE8FC, 0x5670, - 0xE8FD, 0x5660, 0xE8FE, 0x566E, 0xE940, 0x5673, 0xE941, 0x5666, - 0xE942, 0x5663, 0xE943, 0x566D, 0xE944, 0x5672, 0xE945, 0x565E, - 0xE946, 0x5677, 0xE947, 0x571C, 0xE948, 0x571B, 0xE949, 0x58C8, - 0xE94A, 0x58BD, 0xE94B, 0x58C9, 0xE94C, 0x58BF, 0xE94D, 0x58BA, - 0xE94E, 0x58C2, 0xE94F, 0x58BC, 0xE950, 0x58C6, 0xE951, 0x5B17, - 0xE952, 0x5B19, 0xE953, 0x5B1B, 0xE954, 0x5B21, 0xE955, 0x5B14, - 0xE956, 0x5B13, 0xE957, 0x5B10, 0xE958, 0x5B16, 0xE959, 0x5B28, - 0xE95A, 0x5B1A, 0xE95B, 0x5B20, 0xE95C, 0x5B1E, 0xE95D, 0x5BEF, - 0xE95E, 0x5DAC, 0xE95F, 0x5DB1, 0xE960, 0x5DA9, 0xE961, 0x5DA7, - 0xE962, 0x5DB5, 0xE963, 0x5DB0, 0xE964, 0x5DAE, 0xE965, 0x5DAA, - 0xE966, 0x5DA8, 0xE967, 0x5DB2, 0xE968, 0x5DAD, 0xE969, 0x5DAF, - 0xE96A, 0x5DB4, 0xE96B, 0x5E67, 0xE96C, 0x5E68, 0xE96D, 0x5E66, - 0xE96E, 0x5E6F, 0xE96F, 0x5EE9, 0xE970, 0x5EE7, 0xE971, 0x5EE6, - 0xE972, 0x5EE8, 0xE973, 0x5EE5, 0xE974, 0x5F4B, 0xE975, 0x5FBC, - 0xE976, 0x619D, 0xE977, 0x61A8, 0xE978, 0x6196, 0xE979, 0x61C5, - 0xE97A, 0x61B4, 0xE97B, 0x61C6, 0xE97C, 0x61C1, 0xE97D, 0x61CC, - 0xE97E, 0x61BA, 0xE9A1, 0x61BF, 0xE9A2, 0x61B8, 0xE9A3, 0x618C, - 0xE9A4, 0x64D7, 0xE9A5, 0x64D6, 0xE9A6, 0x64D0, 0xE9A7, 0x64CF, - 0xE9A8, 0x64C9, 0xE9A9, 0x64BD, 0xE9AA, 0x6489, 0xE9AB, 0x64C3, - 0xE9AC, 0x64DB, 0xE9AD, 0x64F3, 0xE9AE, 0x64D9, 0xE9AF, 0x6533, - 0xE9B0, 0x657F, 0xE9B1, 0x657C, 0xE9B2, 0x65A2, 0xE9B3, 0x66C8, - 0xE9B4, 0x66BE, 0xE9B5, 0x66C0, 0xE9B6, 0x66CA, 0xE9B7, 0x66CB, - 0xE9B8, 0x66CF, 0xE9B9, 0x66BD, 0xE9BA, 0x66BB, 0xE9BB, 0x66BA, - 0xE9BC, 0x66CC, 0xE9BD, 0x6723, 0xE9BE, 0x6A34, 0xE9BF, 0x6A66, - 0xE9C0, 0x6A49, 0xE9C1, 0x6A67, 0xE9C2, 0x6A32, 0xE9C3, 0x6A68, - 0xE9C4, 0x6A3E, 0xE9C5, 0x6A5D, 0xE9C6, 0x6A6D, 0xE9C7, 0x6A76, - 0xE9C8, 0x6A5B, 0xE9C9, 0x6A51, 0xE9CA, 0x6A28, 0xE9CB, 0x6A5A, - 0xE9CC, 0x6A3B, 0xE9CD, 0x6A3F, 0xE9CE, 0x6A41, 0xE9CF, 0x6A6A, - 0xE9D0, 0x6A64, 0xE9D1, 0x6A50, 0xE9D2, 0x6A4F, 0xE9D3, 0x6A54, - 0xE9D4, 0x6A6F, 0xE9D5, 0x6A69, 0xE9D6, 0x6A60, 0xE9D7, 0x6A3C, - 0xE9D8, 0x6A5E, 0xE9D9, 0x6A56, 0xE9DA, 0x6A55, 0xE9DB, 0x6A4D, - 0xE9DC, 0x6A4E, 0xE9DD, 0x6A46, 0xE9DE, 0x6B55, 0xE9DF, 0x6B54, - 0xE9E0, 0x6B56, 0xE9E1, 0x6BA7, 0xE9E2, 0x6BAA, 0xE9E3, 0x6BAB, - 0xE9E4, 0x6BC8, 0xE9E5, 0x6BC7, 0xE9E6, 0x6C04, 0xE9E7, 0x6C03, - 0xE9E8, 0x6C06, 0xE9E9, 0x6FAD, 0xE9EA, 0x6FCB, 0xE9EB, 0x6FA3, - 0xE9EC, 0x6FC7, 0xE9ED, 0x6FBC, 0xE9EE, 0x6FCE, 0xE9EF, 0x6FC8, - 0xE9F0, 0x6F5E, 0xE9F1, 0x6FC4, 0xE9F2, 0x6FBD, 0xE9F3, 0x6F9E, - 0xE9F4, 0x6FCA, 0xE9F5, 0x6FA8, 0xE9F6, 0x7004, 0xE9F7, 0x6FA5, - 0xE9F8, 0x6FAE, 0xE9F9, 0x6FBA, 0xE9FA, 0x6FAC, 0xE9FB, 0x6FAA, - 0xE9FC, 0x6FCF, 0xE9FD, 0x6FBF, 0xE9FE, 0x6FB8, 0xEA40, 0x6FA2, - 0xEA41, 0x6FC9, 0xEA42, 0x6FAB, 0xEA43, 0x6FCD, 0xEA44, 0x6FAF, - 0xEA45, 0x6FB2, 0xEA46, 0x6FB0, 0xEA47, 0x71C5, 0xEA48, 0x71C2, - 0xEA49, 0x71BF, 0xEA4A, 0x71B8, 0xEA4B, 0x71D6, 0xEA4C, 0x71C0, - 0xEA4D, 0x71C1, 0xEA4E, 0x71CB, 0xEA4F, 0x71D4, 0xEA50, 0x71CA, - 0xEA51, 0x71C7, 0xEA52, 0x71CF, 0xEA53, 0x71BD, 0xEA54, 0x71D8, - 0xEA55, 0x71BC, 0xEA56, 0x71C6, 0xEA57, 0x71DA, 0xEA58, 0x71DB, - 0xEA59, 0x729D, 0xEA5A, 0x729E, 0xEA5B, 0x7369, 0xEA5C, 0x7366, - 0xEA5D, 0x7367, 0xEA5E, 0x736C, 0xEA5F, 0x7365, 0xEA60, 0x736B, - 0xEA61, 0x736A, 0xEA62, 0x747F, 0xEA63, 0x749A, 0xEA64, 0x74A0, - 0xEA65, 0x7494, 0xEA66, 0x7492, 0xEA67, 0x7495, 0xEA68, 0x74A1, - 0xEA69, 0x750B, 0xEA6A, 0x7580, 0xEA6B, 0x762F, 0xEA6C, 0x762D, - 0xEA6D, 0x7631, 0xEA6E, 0x763D, 0xEA6F, 0x7633, 0xEA70, 0x763C, - 0xEA71, 0x7635, 0xEA72, 0x7632, 0xEA73, 0x7630, 0xEA74, 0x76BB, - 0xEA75, 0x76E6, 0xEA76, 0x779A, 0xEA77, 0x779D, 0xEA78, 0x77A1, - 0xEA79, 0x779C, 0xEA7A, 0x779B, 0xEA7B, 0x77A2, 0xEA7C, 0x77A3, - 0xEA7D, 0x7795, 0xEA7E, 0x7799, 0xEAA1, 0x7797, 0xEAA2, 0x78DD, - 0xEAA3, 0x78E9, 0xEAA4, 0x78E5, 0xEAA5, 0x78EA, 0xEAA6, 0x78DE, - 0xEAA7, 0x78E3, 0xEAA8, 0x78DB, 0xEAA9, 0x78E1, 0xEAAA, 0x78E2, - 0xEAAB, 0x78ED, 0xEAAC, 0x78DF, 0xEAAD, 0x78E0, 0xEAAE, 0x79A4, - 0xEAAF, 0x7A44, 0xEAB0, 0x7A48, 0xEAB1, 0x7A47, 0xEAB2, 0x7AB6, - 0xEAB3, 0x7AB8, 0xEAB4, 0x7AB5, 0xEAB5, 0x7AB1, 0xEAB6, 0x7AB7, - 0xEAB7, 0x7BDE, 0xEAB8, 0x7BE3, 0xEAB9, 0x7BE7, 0xEABA, 0x7BDD, - 0xEABB, 0x7BD5, 0xEABC, 0x7BE5, 0xEABD, 0x7BDA, 0xEABE, 0x7BE8, - 0xEABF, 0x7BF9, 0xEAC0, 0x7BD4, 0xEAC1, 0x7BEA, 0xEAC2, 0x7BE2, - 0xEAC3, 0x7BDC, 0xEAC4, 0x7BEB, 0xEAC5, 0x7BD8, 0xEAC6, 0x7BDF, - 0xEAC7, 0x7CD2, 0xEAC8, 0x7CD4, 0xEAC9, 0x7CD7, 0xEACA, 0x7CD0, - 0xEACB, 0x7CD1, 0xEACC, 0x7E12, 0xEACD, 0x7E21, 0xEACE, 0x7E17, - 0xEACF, 0x7E0C, 0xEAD0, 0x7E1F, 0xEAD1, 0x7E20, 0xEAD2, 0x7E13, - 0xEAD3, 0x7E0E, 0xEAD4, 0x7E1C, 0xEAD5, 0x7E15, 0xEAD6, 0x7E1A, - 0xEAD7, 0x7E22, 0xEAD8, 0x7E0B, 0xEAD9, 0x7E0F, 0xEADA, 0x7E16, - 0xEADB, 0x7E0D, 0xEADC, 0x7E14, 0xEADD, 0x7E25, 0xEADE, 0x7E24, - 0xEADF, 0x7F43, 0xEAE0, 0x7F7B, 0xEAE1, 0x7F7C, 0xEAE2, 0x7F7A, - 0xEAE3, 0x7FB1, 0xEAE4, 0x7FEF, 0xEAE5, 0x802A, 0xEAE6, 0x8029, - 0xEAE7, 0x806C, 0xEAE8, 0x81B1, 0xEAE9, 0x81A6, 0xEAEA, 0x81AE, - 0xEAEB, 0x81B9, 0xEAEC, 0x81B5, 0xEAED, 0x81AB, 0xEAEE, 0x81B0, - 0xEAEF, 0x81AC, 0xEAF0, 0x81B4, 0xEAF1, 0x81B2, 0xEAF2, 0x81B7, - 0xEAF3, 0x81A7, 0xEAF4, 0x81F2, 0xEAF5, 0x8255, 0xEAF6, 0x8256, - 0xEAF7, 0x8257, 0xEAF8, 0x8556, 0xEAF9, 0x8545, 0xEAFA, 0x856B, - 0xEAFB, 0x854D, 0xEAFC, 0x8553, 0xEAFD, 0x8561, 0xEAFE, 0x8558, - 0xEB40, 0x8540, 0xEB41, 0x8546, 0xEB42, 0x8564, 0xEB43, 0x8541, - 0xEB44, 0x8562, 0xEB45, 0x8544, 0xEB46, 0x8551, 0xEB47, 0x8547, - 0xEB48, 0x8563, 0xEB49, 0x853E, 0xEB4A, 0x855B, 0xEB4B, 0x8571, - 0xEB4C, 0x854E, 0xEB4D, 0x856E, 0xEB4E, 0x8575, 0xEB4F, 0x8555, - 0xEB50, 0x8567, 0xEB51, 0x8560, 0xEB52, 0x858C, 0xEB53, 0x8566, - 0xEB54, 0x855D, 0xEB55, 0x8554, 0xEB56, 0x8565, 0xEB57, 0x856C, - 0xEB58, 0x8663, 0xEB59, 0x8665, 0xEB5A, 0x8664, 0xEB5B, 0x879B, - 0xEB5C, 0x878F, 0xEB5D, 0x8797, 0xEB5E, 0x8793, 0xEB5F, 0x8792, - 0xEB60, 0x8788, 0xEB61, 0x8781, 0xEB62, 0x8796, 0xEB63, 0x8798, - 0xEB64, 0x8779, 0xEB65, 0x8787, 0xEB66, 0x87A3, 0xEB67, 0x8785, - 0xEB68, 0x8790, 0xEB69, 0x8791, 0xEB6A, 0x879D, 0xEB6B, 0x8784, - 0xEB6C, 0x8794, 0xEB6D, 0x879C, 0xEB6E, 0x879A, 0xEB6F, 0x8789, - 0xEB70, 0x891E, 0xEB71, 0x8926, 0xEB72, 0x8930, 0xEB73, 0x892D, - 0xEB74, 0x892E, 0xEB75, 0x8927, 0xEB76, 0x8931, 0xEB77, 0x8922, - 0xEB78, 0x8929, 0xEB79, 0x8923, 0xEB7A, 0x892F, 0xEB7B, 0x892C, - 0xEB7C, 0x891F, 0xEB7D, 0x89F1, 0xEB7E, 0x8AE0, 0xEBA1, 0x8AE2, - 0xEBA2, 0x8AF2, 0xEBA3, 0x8AF4, 0xEBA4, 0x8AF5, 0xEBA5, 0x8ADD, - 0xEBA6, 0x8B14, 0xEBA7, 0x8AE4, 0xEBA8, 0x8ADF, 0xEBA9, 0x8AF0, - 0xEBAA, 0x8AC8, 0xEBAB, 0x8ADE, 0xEBAC, 0x8AE1, 0xEBAD, 0x8AE8, - 0xEBAE, 0x8AFF, 0xEBAF, 0x8AEF, 0xEBB0, 0x8AFB, 0xEBB1, 0x8C91, - 0xEBB2, 0x8C92, 0xEBB3, 0x8C90, 0xEBB4, 0x8CF5, 0xEBB5, 0x8CEE, - 0xEBB6, 0x8CF1, 0xEBB7, 0x8CF0, 0xEBB8, 0x8CF3, 0xEBB9, 0x8D6C, - 0xEBBA, 0x8D6E, 0xEBBB, 0x8DA5, 0xEBBC, 0x8DA7, 0xEBBD, 0x8E33, - 0xEBBE, 0x8E3E, 0xEBBF, 0x8E38, 0xEBC0, 0x8E40, 0xEBC1, 0x8E45, - 0xEBC2, 0x8E36, 0xEBC3, 0x8E3C, 0xEBC4, 0x8E3D, 0xEBC5, 0x8E41, - 0xEBC6, 0x8E30, 0xEBC7, 0x8E3F, 0xEBC8, 0x8EBD, 0xEBC9, 0x8F36, - 0xEBCA, 0x8F2E, 0xEBCB, 0x8F35, 0xEBCC, 0x8F32, 0xEBCD, 0x8F39, - 0xEBCE, 0x8F37, 0xEBCF, 0x8F34, 0xEBD0, 0x9076, 0xEBD1, 0x9079, - 0xEBD2, 0x907B, 0xEBD3, 0x9086, 0xEBD4, 0x90FA, 0xEBD5, 0x9133, - 0xEBD6, 0x9135, 0xEBD7, 0x9136, 0xEBD8, 0x9193, 0xEBD9, 0x9190, - 0xEBDA, 0x9191, 0xEBDB, 0x918D, 0xEBDC, 0x918F, 0xEBDD, 0x9327, - 0xEBDE, 0x931E, 0xEBDF, 0x9308, 0xEBE0, 0x931F, 0xEBE1, 0x9306, - 0xEBE2, 0x930F, 0xEBE3, 0x937A, 0xEBE4, 0x9338, 0xEBE5, 0x933C, - 0xEBE6, 0x931B, 0xEBE7, 0x9323, 0xEBE8, 0x9312, 0xEBE9, 0x9301, - 0xEBEA, 0x9346, 0xEBEB, 0x932D, 0xEBEC, 0x930E, 0xEBED, 0x930D, - 0xEBEE, 0x92CB, 0xEBEF, 0x931D, 0xEBF0, 0x92FA, 0xEBF1, 0x9325, - 0xEBF2, 0x9313, 0xEBF3, 0x92F9, 0xEBF4, 0x92F7, 0xEBF5, 0x9334, - 0xEBF6, 0x9302, 0xEBF7, 0x9324, 0xEBF8, 0x92FF, 0xEBF9, 0x9329, - 0xEBFA, 0x9339, 0xEBFB, 0x9335, 0xEBFC, 0x932A, 0xEBFD, 0x9314, - 0xEBFE, 0x930C, 0xEC40, 0x930B, 0xEC41, 0x92FE, 0xEC42, 0x9309, - 0xEC43, 0x9300, 0xEC44, 0x92FB, 0xEC45, 0x9316, 0xEC46, 0x95BC, - 0xEC47, 0x95CD, 0xEC48, 0x95BE, 0xEC49, 0x95B9, 0xEC4A, 0x95BA, - 0xEC4B, 0x95B6, 0xEC4C, 0x95BF, 0xEC4D, 0x95B5, 0xEC4E, 0x95BD, - 0xEC4F, 0x96A9, 0xEC50, 0x96D4, 0xEC51, 0x970B, 0xEC52, 0x9712, - 0xEC53, 0x9710, 0xEC54, 0x9799, 0xEC55, 0x9797, 0xEC56, 0x9794, - 0xEC57, 0x97F0, 0xEC58, 0x97F8, 0xEC59, 0x9835, 0xEC5A, 0x982F, - 0xEC5B, 0x9832, 0xEC5C, 0x9924, 0xEC5D, 0x991F, 0xEC5E, 0x9927, - 0xEC5F, 0x9929, 0xEC60, 0x999E, 0xEC61, 0x99EE, 0xEC62, 0x99EC, - 0xEC63, 0x99E5, 0xEC64, 0x99E4, 0xEC65, 0x99F0, 0xEC66, 0x99E3, - 0xEC67, 0x99EA, 0xEC68, 0x99E9, 0xEC69, 0x99E7, 0xEC6A, 0x9AB9, - 0xEC6B, 0x9ABF, 0xEC6C, 0x9AB4, 0xEC6D, 0x9ABB, 0xEC6E, 0x9AF6, - 0xEC6F, 0x9AFA, 0xEC70, 0x9AF9, 0xEC71, 0x9AF7, 0xEC72, 0x9B33, - 0xEC73, 0x9B80, 0xEC74, 0x9B85, 0xEC75, 0x9B87, 0xEC76, 0x9B7C, - 0xEC77, 0x9B7E, 0xEC78, 0x9B7B, 0xEC79, 0x9B82, 0xEC7A, 0x9B93, - 0xEC7B, 0x9B92, 0xEC7C, 0x9B90, 0xEC7D, 0x9B7A, 0xEC7E, 0x9B95, - 0xECA1, 0x9B7D, 0xECA2, 0x9B88, 0xECA3, 0x9D25, 0xECA4, 0x9D17, - 0xECA5, 0x9D20, 0xECA6, 0x9D1E, 0xECA7, 0x9D14, 0xECA8, 0x9D29, - 0xECA9, 0x9D1D, 0xECAA, 0x9D18, 0xECAB, 0x9D22, 0xECAC, 0x9D10, - 0xECAD, 0x9D19, 0xECAE, 0x9D1F, 0xECAF, 0x9E88, 0xECB0, 0x9E86, - 0xECB1, 0x9E87, 0xECB2, 0x9EAE, 0xECB3, 0x9EAD, 0xECB4, 0x9ED5, - 0xECB5, 0x9ED6, 0xECB6, 0x9EFA, 0xECB7, 0x9F12, 0xECB8, 0x9F3D, - 0xECB9, 0x5126, 0xECBA, 0x5125, 0xECBB, 0x5122, 0xECBC, 0x5124, - 0xECBD, 0x5120, 0xECBE, 0x5129, 0xECBF, 0x52F4, 0xECC0, 0x5693, - 0xECC1, 0x568C, 0xECC2, 0x568D, 0xECC3, 0x5686, 0xECC4, 0x5684, - 0xECC5, 0x5683, 0xECC6, 0x567E, 0xECC7, 0x5682, 0xECC8, 0x567F, - 0xECC9, 0x5681, 0xECCA, 0x58D6, 0xECCB, 0x58D4, 0xECCC, 0x58CF, - 0xECCD, 0x58D2, 0xECCE, 0x5B2D, 0xECCF, 0x5B25, 0xECD0, 0x5B32, - 0xECD1, 0x5B23, 0xECD2, 0x5B2C, 0xECD3, 0x5B27, 0xECD4, 0x5B26, - 0xECD5, 0x5B2F, 0xECD6, 0x5B2E, 0xECD7, 0x5B7B, 0xECD8, 0x5BF1, - 0xECD9, 0x5BF2, 0xECDA, 0x5DB7, 0xECDB, 0x5E6C, 0xECDC, 0x5E6A, - 0xECDD, 0x5FBE, 0xECDE, 0x5FBB, 0xECDF, 0x61C3, 0xECE0, 0x61B5, - 0xECE1, 0x61BC, 0xECE2, 0x61E7, 0xECE3, 0x61E0, 0xECE4, 0x61E5, - 0xECE5, 0x61E4, 0xECE6, 0x61E8, 0xECE7, 0x61DE, 0xECE8, 0x64EF, - 0xECE9, 0x64E9, 0xECEA, 0x64E3, 0xECEB, 0x64EB, 0xECEC, 0x64E4, - 0xECED, 0x64E8, 0xECEE, 0x6581, 0xECEF, 0x6580, 0xECF0, 0x65B6, - 0xECF1, 0x65DA, 0xECF2, 0x66D2, 0xECF3, 0x6A8D, 0xECF4, 0x6A96, - 0xECF5, 0x6A81, 0xECF6, 0x6AA5, 0xECF7, 0x6A89, 0xECF8, 0x6A9F, - 0xECF9, 0x6A9B, 0xECFA, 0x6AA1, 0xECFB, 0x6A9E, 0xECFC, 0x6A87, - 0xECFD, 0x6A93, 0xECFE, 0x6A8E, 0xED40, 0x6A95, 0xED41, 0x6A83, - 0xED42, 0x6AA8, 0xED43, 0x6AA4, 0xED44, 0x6A91, 0xED45, 0x6A7F, - 0xED46, 0x6AA6, 0xED47, 0x6A9A, 0xED48, 0x6A85, 0xED49, 0x6A8C, - 0xED4A, 0x6A92, 0xED4B, 0x6B5B, 0xED4C, 0x6BAD, 0xED4D, 0x6C09, - 0xED4E, 0x6FCC, 0xED4F, 0x6FA9, 0xED50, 0x6FF4, 0xED51, 0x6FD4, - 0xED52, 0x6FE3, 0xED53, 0x6FDC, 0xED54, 0x6FED, 0xED55, 0x6FE7, - 0xED56, 0x6FE6, 0xED57, 0x6FDE, 0xED58, 0x6FF2, 0xED59, 0x6FDD, - 0xED5A, 0x6FE2, 0xED5B, 0x6FE8, 0xED5C, 0x71E1, 0xED5D, 0x71F1, - 0xED5E, 0x71E8, 0xED5F, 0x71F2, 0xED60, 0x71E4, 0xED61, 0x71F0, - 0xED62, 0x71E2, 0xED63, 0x7373, 0xED64, 0x736E, 0xED65, 0x736F, - 0xED66, 0x7497, 0xED67, 0x74B2, 0xED68, 0x74AB, 0xED69, 0x7490, - 0xED6A, 0x74AA, 0xED6B, 0x74AD, 0xED6C, 0x74B1, 0xED6D, 0x74A5, - 0xED6E, 0x74AF, 0xED6F, 0x7510, 0xED70, 0x7511, 0xED71, 0x7512, - 0xED72, 0x750F, 0xED73, 0x7584, 0xED74, 0x7643, 0xED75, 0x7648, - 0xED76, 0x7649, 0xED77, 0x7647, 0xED78, 0x76A4, 0xED79, 0x76E9, - 0xED7A, 0x77B5, 0xED7B, 0x77AB, 0xED7C, 0x77B2, 0xED7D, 0x77B7, - 0xED7E, 0x77B6, 0xEDA1, 0x77B4, 0xEDA2, 0x77B1, 0xEDA3, 0x77A8, - 0xEDA4, 0x77F0, 0xEDA5, 0x78F3, 0xEDA6, 0x78FD, 0xEDA7, 0x7902, - 0xEDA8, 0x78FB, 0xEDA9, 0x78FC, 0xEDAA, 0x78F2, 0xEDAB, 0x7905, - 0xEDAC, 0x78F9, 0xEDAD, 0x78FE, 0xEDAE, 0x7904, 0xEDAF, 0x79AB, - 0xEDB0, 0x79A8, 0xEDB1, 0x7A5C, 0xEDB2, 0x7A5B, 0xEDB3, 0x7A56, - 0xEDB4, 0x7A58, 0xEDB5, 0x7A54, 0xEDB6, 0x7A5A, 0xEDB7, 0x7ABE, - 0xEDB8, 0x7AC0, 0xEDB9, 0x7AC1, 0xEDBA, 0x7C05, 0xEDBB, 0x7C0F, - 0xEDBC, 0x7BF2, 0xEDBD, 0x7C00, 0xEDBE, 0x7BFF, 0xEDBF, 0x7BFB, - 0xEDC0, 0x7C0E, 0xEDC1, 0x7BF4, 0xEDC2, 0x7C0B, 0xEDC3, 0x7BF3, - 0xEDC4, 0x7C02, 0xEDC5, 0x7C09, 0xEDC6, 0x7C03, 0xEDC7, 0x7C01, - 0xEDC8, 0x7BF8, 0xEDC9, 0x7BFD, 0xEDCA, 0x7C06, 0xEDCB, 0x7BF0, - 0xEDCC, 0x7BF1, 0xEDCD, 0x7C10, 0xEDCE, 0x7C0A, 0xEDCF, 0x7CE8, - 0xEDD0, 0x7E2D, 0xEDD1, 0x7E3C, 0xEDD2, 0x7E42, 0xEDD3, 0x7E33, - 0xEDD4, 0x9848, 0xEDD5, 0x7E38, 0xEDD6, 0x7E2A, 0xEDD7, 0x7E49, - 0xEDD8, 0x7E40, 0xEDD9, 0x7E47, 0xEDDA, 0x7E29, 0xEDDB, 0x7E4C, - 0xEDDC, 0x7E30, 0xEDDD, 0x7E3B, 0xEDDE, 0x7E36, 0xEDDF, 0x7E44, - 0xEDE0, 0x7E3A, 0xEDE1, 0x7F45, 0xEDE2, 0x7F7F, 0xEDE3, 0x7F7E, - 0xEDE4, 0x7F7D, 0xEDE5, 0x7FF4, 0xEDE6, 0x7FF2, 0xEDE7, 0x802C, - 0xEDE8, 0x81BB, 0xEDE9, 0x81C4, 0xEDEA, 0x81CC, 0xEDEB, 0x81CA, - 0xEDEC, 0x81C5, 0xEDED, 0x81C7, 0xEDEE, 0x81BC, 0xEDEF, 0x81E9, - 0xEDF0, 0x825B, 0xEDF1, 0x825A, 0xEDF2, 0x825C, 0xEDF3, 0x8583, - 0xEDF4, 0x8580, 0xEDF5, 0x858F, 0xEDF6, 0x85A7, 0xEDF7, 0x8595, - 0xEDF8, 0x85A0, 0xEDF9, 0x858B, 0xEDFA, 0x85A3, 0xEDFB, 0x857B, - 0xEDFC, 0x85A4, 0xEDFD, 0x859A, 0xEDFE, 0x859E, 0xEE40, 0x8577, - 0xEE41, 0x857C, 0xEE42, 0x8589, 0xEE43, 0x85A1, 0xEE44, 0x857A, - 0xEE45, 0x8578, 0xEE46, 0x8557, 0xEE47, 0x858E, 0xEE48, 0x8596, - 0xEE49, 0x8586, 0xEE4A, 0x858D, 0xEE4B, 0x8599, 0xEE4C, 0x859D, - 0xEE4D, 0x8581, 0xEE4E, 0x85A2, 0xEE4F, 0x8582, 0xEE50, 0x8588, - 0xEE51, 0x8585, 0xEE52, 0x8579, 0xEE53, 0x8576, 0xEE54, 0x8598, - 0xEE55, 0x8590, 0xEE56, 0x859F, 0xEE57, 0x8668, 0xEE58, 0x87BE, - 0xEE59, 0x87AA, 0xEE5A, 0x87AD, 0xEE5B, 0x87C5, 0xEE5C, 0x87B0, - 0xEE5D, 0x87AC, 0xEE5E, 0x87B9, 0xEE5F, 0x87B5, 0xEE60, 0x87BC, - 0xEE61, 0x87AE, 0xEE62, 0x87C9, 0xEE63, 0x87C3, 0xEE64, 0x87C2, - 0xEE65, 0x87CC, 0xEE66, 0x87B7, 0xEE67, 0x87AF, 0xEE68, 0x87C4, - 0xEE69, 0x87CA, 0xEE6A, 0x87B4, 0xEE6B, 0x87B6, 0xEE6C, 0x87BF, - 0xEE6D, 0x87B8, 0xEE6E, 0x87BD, 0xEE6F, 0x87DE, 0xEE70, 0x87B2, - 0xEE71, 0x8935, 0xEE72, 0x8933, 0xEE73, 0x893C, 0xEE74, 0x893E, - 0xEE75, 0x8941, 0xEE76, 0x8952, 0xEE77, 0x8937, 0xEE78, 0x8942, - 0xEE79, 0x89AD, 0xEE7A, 0x89AF, 0xEE7B, 0x89AE, 0xEE7C, 0x89F2, - 0xEE7D, 0x89F3, 0xEE7E, 0x8B1E, 0xEEA1, 0x8B18, 0xEEA2, 0x8B16, - 0xEEA3, 0x8B11, 0xEEA4, 0x8B05, 0xEEA5, 0x8B0B, 0xEEA6, 0x8B22, - 0xEEA7, 0x8B0F, 0xEEA8, 0x8B12, 0xEEA9, 0x8B15, 0xEEAA, 0x8B07, - 0xEEAB, 0x8B0D, 0xEEAC, 0x8B08, 0xEEAD, 0x8B06, 0xEEAE, 0x8B1C, - 0xEEAF, 0x8B13, 0xEEB0, 0x8B1A, 0xEEB1, 0x8C4F, 0xEEB2, 0x8C70, - 0xEEB3, 0x8C72, 0xEEB4, 0x8C71, 0xEEB5, 0x8C6F, 0xEEB6, 0x8C95, - 0xEEB7, 0x8C94, 0xEEB8, 0x8CF9, 0xEEB9, 0x8D6F, 0xEEBA, 0x8E4E, - 0xEEBB, 0x8E4D, 0xEEBC, 0x8E53, 0xEEBD, 0x8E50, 0xEEBE, 0x8E4C, - 0xEEBF, 0x8E47, 0xEEC0, 0x8F43, 0xEEC1, 0x8F40, 0xEEC2, 0x9085, - 0xEEC3, 0x907E, 0xEEC4, 0x9138, 0xEEC5, 0x919A, 0xEEC6, 0x91A2, - 0xEEC7, 0x919B, 0xEEC8, 0x9199, 0xEEC9, 0x919F, 0xEECA, 0x91A1, - 0xEECB, 0x919D, 0xEECC, 0x91A0, 0xEECD, 0x93A1, 0xEECE, 0x9383, - 0xEECF, 0x93AF, 0xEED0, 0x9364, 0xEED1, 0x9356, 0xEED2, 0x9347, - 0xEED3, 0x937C, 0xEED4, 0x9358, 0xEED5, 0x935C, 0xEED6, 0x9376, - 0xEED7, 0x9349, 0xEED8, 0x9350, 0xEED9, 0x9351, 0xEEDA, 0x9360, - 0xEEDB, 0x936D, 0xEEDC, 0x938F, 0xEEDD, 0x934C, 0xEEDE, 0x936A, - 0xEEDF, 0x9379, 0xEEE0, 0x9357, 0xEEE1, 0x9355, 0xEEE2, 0x9352, - 0xEEE3, 0x934F, 0xEEE4, 0x9371, 0xEEE5, 0x9377, 0xEEE6, 0x937B, - 0xEEE7, 0x9361, 0xEEE8, 0x935E, 0xEEE9, 0x9363, 0xEEEA, 0x9367, - 0xEEEB, 0x9380, 0xEEEC, 0x934E, 0xEEED, 0x9359, 0xEEEE, 0x95C7, - 0xEEEF, 0x95C0, 0xEEF0, 0x95C9, 0xEEF1, 0x95C3, 0xEEF2, 0x95C5, - 0xEEF3, 0x95B7, 0xEEF4, 0x96AE, 0xEEF5, 0x96B0, 0xEEF6, 0x96AC, - 0xEEF7, 0x9720, 0xEEF8, 0x971F, 0xEEF9, 0x9718, 0xEEFA, 0x971D, - 0xEEFB, 0x9719, 0xEEFC, 0x979A, 0xEEFD, 0x97A1, 0xEEFE, 0x979C, - 0xEF40, 0x979E, 0xEF41, 0x979D, 0xEF42, 0x97D5, 0xEF43, 0x97D4, - 0xEF44, 0x97F1, 0xEF45, 0x9841, 0xEF46, 0x9844, 0xEF47, 0x984A, - 0xEF48, 0x9849, 0xEF49, 0x9845, 0xEF4A, 0x9843, 0xEF4B, 0x9925, - 0xEF4C, 0x992B, 0xEF4D, 0x992C, 0xEF4E, 0x992A, 0xEF4F, 0x9933, - 0xEF50, 0x9932, 0xEF51, 0x992F, 0xEF52, 0x992D, 0xEF53, 0x9931, - 0xEF54, 0x9930, 0xEF55, 0x9998, 0xEF56, 0x99A3, 0xEF57, 0x99A1, - 0xEF58, 0x9A02, 0xEF59, 0x99FA, 0xEF5A, 0x99F4, 0xEF5B, 0x99F7, - 0xEF5C, 0x99F9, 0xEF5D, 0x99F8, 0xEF5E, 0x99F6, 0xEF5F, 0x99FB, - 0xEF60, 0x99FD, 0xEF61, 0x99FE, 0xEF62, 0x99FC, 0xEF63, 0x9A03, - 0xEF64, 0x9ABE, 0xEF65, 0x9AFE, 0xEF66, 0x9AFD, 0xEF67, 0x9B01, - 0xEF68, 0x9AFC, 0xEF69, 0x9B48, 0xEF6A, 0x9B9A, 0xEF6B, 0x9BA8, - 0xEF6C, 0x9B9E, 0xEF6D, 0x9B9B, 0xEF6E, 0x9BA6, 0xEF6F, 0x9BA1, - 0xEF70, 0x9BA5, 0xEF71, 0x9BA4, 0xEF72, 0x9B86, 0xEF73, 0x9BA2, - 0xEF74, 0x9BA0, 0xEF75, 0x9BAF, 0xEF76, 0x9D33, 0xEF77, 0x9D41, - 0xEF78, 0x9D67, 0xEF79, 0x9D36, 0xEF7A, 0x9D2E, 0xEF7B, 0x9D2F, - 0xEF7C, 0x9D31, 0xEF7D, 0x9D38, 0xEF7E, 0x9D30, 0xEFA1, 0x9D45, - 0xEFA2, 0x9D42, 0xEFA3, 0x9D43, 0xEFA4, 0x9D3E, 0xEFA5, 0x9D37, - 0xEFA6, 0x9D40, 0xEFA7, 0x9D3D, 0xEFA8, 0x7FF5, 0xEFA9, 0x9D2D, - 0xEFAA, 0x9E8A, 0xEFAB, 0x9E89, 0xEFAC, 0x9E8D, 0xEFAD, 0x9EB0, - 0xEFAE, 0x9EC8, 0xEFAF, 0x9EDA, 0xEFB0, 0x9EFB, 0xEFB1, 0x9EFF, - 0xEFB2, 0x9F24, 0xEFB3, 0x9F23, 0xEFB4, 0x9F22, 0xEFB5, 0x9F54, - 0xEFB6, 0x9FA0, 0xEFB7, 0x5131, 0xEFB8, 0x512D, 0xEFB9, 0x512E, - 0xEFBA, 0x5698, 0xEFBB, 0x569C, 0xEFBC, 0x5697, 0xEFBD, 0x569A, - 0xEFBE, 0x569D, 0xEFBF, 0x5699, 0xEFC0, 0x5970, 0xEFC1, 0x5B3C, - 0xEFC2, 0x5C69, 0xEFC3, 0x5C6A, 0xEFC4, 0x5DC0, 0xEFC5, 0x5E6D, - 0xEFC6, 0x5E6E, 0xEFC7, 0x61D8, 0xEFC8, 0x61DF, 0xEFC9, 0x61ED, - 0xEFCA, 0x61EE, 0xEFCB, 0x61F1, 0xEFCC, 0x61EA, 0xEFCD, 0x61F0, - 0xEFCE, 0x61EB, 0xEFCF, 0x61D6, 0xEFD0, 0x61E9, 0xEFD1, 0x64FF, - 0xEFD2, 0x6504, 0xEFD3, 0x64FD, 0xEFD4, 0x64F8, 0xEFD5, 0x6501, - 0xEFD6, 0x6503, 0xEFD7, 0x64FC, 0xEFD8, 0x6594, 0xEFD9, 0x65DB, - 0xEFDA, 0x66DA, 0xEFDB, 0x66DB, 0xEFDC, 0x66D8, 0xEFDD, 0x6AC5, - 0xEFDE, 0x6AB9, 0xEFDF, 0x6ABD, 0xEFE0, 0x6AE1, 0xEFE1, 0x6AC6, - 0xEFE2, 0x6ABA, 0xEFE3, 0x6AB6, 0xEFE4, 0x6AB7, 0xEFE5, 0x6AC7, - 0xEFE6, 0x6AB4, 0xEFE7, 0x6AAD, 0xEFE8, 0x6B5E, 0xEFE9, 0x6BC9, - 0xEFEA, 0x6C0B, 0xEFEB, 0x7007, 0xEFEC, 0x700C, 0xEFED, 0x700D, - 0xEFEE, 0x7001, 0xEFEF, 0x7005, 0xEFF0, 0x7014, 0xEFF1, 0x700E, - 0xEFF2, 0x6FFF, 0xEFF3, 0x7000, 0xEFF4, 0x6FFB, 0xEFF5, 0x7026, - 0xEFF6, 0x6FFC, 0xEFF7, 0x6FF7, 0xEFF8, 0x700A, 0xEFF9, 0x7201, - 0xEFFA, 0x71FF, 0xEFFB, 0x71F9, 0xEFFC, 0x7203, 0xEFFD, 0x71FD, - 0xEFFE, 0x7376, 0xF040, 0x74B8, 0xF041, 0x74C0, 0xF042, 0x74B5, - 0xF043, 0x74C1, 0xF044, 0x74BE, 0xF045, 0x74B6, 0xF046, 0x74BB, - 0xF047, 0x74C2, 0xF048, 0x7514, 0xF049, 0x7513, 0xF04A, 0x765C, - 0xF04B, 0x7664, 0xF04C, 0x7659, 0xF04D, 0x7650, 0xF04E, 0x7653, - 0xF04F, 0x7657, 0xF050, 0x765A, 0xF051, 0x76A6, 0xF052, 0x76BD, - 0xF053, 0x76EC, 0xF054, 0x77C2, 0xF055, 0x77BA, 0xF056, 0x78FF, - 0xF057, 0x790C, 0xF058, 0x7913, 0xF059, 0x7914, 0xF05A, 0x7909, - 0xF05B, 0x7910, 0xF05C, 0x7912, 0xF05D, 0x7911, 0xF05E, 0x79AD, - 0xF05F, 0x79AC, 0xF060, 0x7A5F, 0xF061, 0x7C1C, 0xF062, 0x7C29, - 0xF063, 0x7C19, 0xF064, 0x7C20, 0xF065, 0x7C1F, 0xF066, 0x7C2D, - 0xF067, 0x7C1D, 0xF068, 0x7C26, 0xF069, 0x7C28, 0xF06A, 0x7C22, - 0xF06B, 0x7C25, 0xF06C, 0x7C30, 0xF06D, 0x7E5C, 0xF06E, 0x7E50, - 0xF06F, 0x7E56, 0xF070, 0x7E63, 0xF071, 0x7E58, 0xF072, 0x7E62, - 0xF073, 0x7E5F, 0xF074, 0x7E51, 0xF075, 0x7E60, 0xF076, 0x7E57, - 0xF077, 0x7E53, 0xF078, 0x7FB5, 0xF079, 0x7FB3, 0xF07A, 0x7FF7, - 0xF07B, 0x7FF8, 0xF07C, 0x8075, 0xF07D, 0x81D1, 0xF07E, 0x81D2, - 0xF0A1, 0x81D0, 0xF0A2, 0x825F, 0xF0A3, 0x825E, 0xF0A4, 0x85B4, - 0xF0A5, 0x85C6, 0xF0A6, 0x85C0, 0xF0A7, 0x85C3, 0xF0A8, 0x85C2, - 0xF0A9, 0x85B3, 0xF0AA, 0x85B5, 0xF0AB, 0x85BD, 0xF0AC, 0x85C7, - 0xF0AD, 0x85C4, 0xF0AE, 0x85BF, 0xF0AF, 0x85CB, 0xF0B0, 0x85CE, - 0xF0B1, 0x85C8, 0xF0B2, 0x85C5, 0xF0B3, 0x85B1, 0xF0B4, 0x85B6, - 0xF0B5, 0x85D2, 0xF0B6, 0x8624, 0xF0B7, 0x85B8, 0xF0B8, 0x85B7, - 0xF0B9, 0x85BE, 0xF0BA, 0x8669, 0xF0BB, 0x87E7, 0xF0BC, 0x87E6, - 0xF0BD, 0x87E2, 0xF0BE, 0x87DB, 0xF0BF, 0x87EB, 0xF0C0, 0x87EA, - 0xF0C1, 0x87E5, 0xF0C2, 0x87DF, 0xF0C3, 0x87F3, 0xF0C4, 0x87E4, - 0xF0C5, 0x87D4, 0xF0C6, 0x87DC, 0xF0C7, 0x87D3, 0xF0C8, 0x87ED, - 0xF0C9, 0x87D8, 0xF0CA, 0x87E3, 0xF0CB, 0x87A4, 0xF0CC, 0x87D7, - 0xF0CD, 0x87D9, 0xF0CE, 0x8801, 0xF0CF, 0x87F4, 0xF0D0, 0x87E8, - 0xF0D1, 0x87DD, 0xF0D2, 0x8953, 0xF0D3, 0x894B, 0xF0D4, 0x894F, - 0xF0D5, 0x894C, 0xF0D6, 0x8946, 0xF0D7, 0x8950, 0xF0D8, 0x8951, - 0xF0D9, 0x8949, 0xF0DA, 0x8B2A, 0xF0DB, 0x8B27, 0xF0DC, 0x8B23, - 0xF0DD, 0x8B33, 0xF0DE, 0x8B30, 0xF0DF, 0x8B35, 0xF0E0, 0x8B47, - 0xF0E1, 0x8B2F, 0xF0E2, 0x8B3C, 0xF0E3, 0x8B3E, 0xF0E4, 0x8B31, - 0xF0E5, 0x8B25, 0xF0E6, 0x8B37, 0xF0E7, 0x8B26, 0xF0E8, 0x8B36, - 0xF0E9, 0x8B2E, 0xF0EA, 0x8B24, 0xF0EB, 0x8B3B, 0xF0EC, 0x8B3D, - 0xF0ED, 0x8B3A, 0xF0EE, 0x8C42, 0xF0EF, 0x8C75, 0xF0F0, 0x8C99, - 0xF0F1, 0x8C98, 0xF0F2, 0x8C97, 0xF0F3, 0x8CFE, 0xF0F4, 0x8D04, - 0xF0F5, 0x8D02, 0xF0F6, 0x8D00, 0xF0F7, 0x8E5C, 0xF0F8, 0x8E62, - 0xF0F9, 0x8E60, 0xF0FA, 0x8E57, 0xF0FB, 0x8E56, 0xF0FC, 0x8E5E, - 0xF0FD, 0x8E65, 0xF0FE, 0x8E67, 0xF140, 0x8E5B, 0xF141, 0x8E5A, - 0xF142, 0x8E61, 0xF143, 0x8E5D, 0xF144, 0x8E69, 0xF145, 0x8E54, - 0xF146, 0x8F46, 0xF147, 0x8F47, 0xF148, 0x8F48, 0xF149, 0x8F4B, - 0xF14A, 0x9128, 0xF14B, 0x913A, 0xF14C, 0x913B, 0xF14D, 0x913E, - 0xF14E, 0x91A8, 0xF14F, 0x91A5, 0xF150, 0x91A7, 0xF151, 0x91AF, - 0xF152, 0x91AA, 0xF153, 0x93B5, 0xF154, 0x938C, 0xF155, 0x9392, - 0xF156, 0x93B7, 0xF157, 0x939B, 0xF158, 0x939D, 0xF159, 0x9389, - 0xF15A, 0x93A7, 0xF15B, 0x938E, 0xF15C, 0x93AA, 0xF15D, 0x939E, - 0xF15E, 0x93A6, 0xF15F, 0x9395, 0xF160, 0x9388, 0xF161, 0x9399, - 0xF162, 0x939F, 0xF163, 0x938D, 0xF164, 0x93B1, 0xF165, 0x9391, - 0xF166, 0x93B2, 0xF167, 0x93A4, 0xF168, 0x93A8, 0xF169, 0x93B4, - 0xF16A, 0x93A3, 0xF16B, 0x93A5, 0xF16C, 0x95D2, 0xF16D, 0x95D3, - 0xF16E, 0x95D1, 0xF16F, 0x96B3, 0xF170, 0x96D7, 0xF171, 0x96DA, - 0xF172, 0x5DC2, 0xF173, 0x96DF, 0xF174, 0x96D8, 0xF175, 0x96DD, - 0xF176, 0x9723, 0xF177, 0x9722, 0xF178, 0x9725, 0xF179, 0x97AC, - 0xF17A, 0x97AE, 0xF17B, 0x97A8, 0xF17C, 0x97AB, 0xF17D, 0x97A4, - 0xF17E, 0x97AA, 0xF1A1, 0x97A2, 0xF1A2, 0x97A5, 0xF1A3, 0x97D7, - 0xF1A4, 0x97D9, 0xF1A5, 0x97D6, 0xF1A6, 0x97D8, 0xF1A7, 0x97FA, - 0xF1A8, 0x9850, 0xF1A9, 0x9851, 0xF1AA, 0x9852, 0xF1AB, 0x98B8, - 0xF1AC, 0x9941, 0xF1AD, 0x993C, 0xF1AE, 0x993A, 0xF1AF, 0x9A0F, - 0xF1B0, 0x9A0B, 0xF1B1, 0x9A09, 0xF1B2, 0x9A0D, 0xF1B3, 0x9A04, - 0xF1B4, 0x9A11, 0xF1B5, 0x9A0A, 0xF1B6, 0x9A05, 0xF1B7, 0x9A07, - 0xF1B8, 0x9A06, 0xF1B9, 0x9AC0, 0xF1BA, 0x9ADC, 0xF1BB, 0x9B08, - 0xF1BC, 0x9B04, 0xF1BD, 0x9B05, 0xF1BE, 0x9B29, 0xF1BF, 0x9B35, - 0xF1C0, 0x9B4A, 0xF1C1, 0x9B4C, 0xF1C2, 0x9B4B, 0xF1C3, 0x9BC7, - 0xF1C4, 0x9BC6, 0xF1C5, 0x9BC3, 0xF1C6, 0x9BBF, 0xF1C7, 0x9BC1, - 0xF1C8, 0x9BB5, 0xF1C9, 0x9BB8, 0xF1CA, 0x9BD3, 0xF1CB, 0x9BB6, - 0xF1CC, 0x9BC4, 0xF1CD, 0x9BB9, 0xF1CE, 0x9BBD, 0xF1CF, 0x9D5C, - 0xF1D0, 0x9D53, 0xF1D1, 0x9D4F, 0xF1D2, 0x9D4A, 0xF1D3, 0x9D5B, - 0xF1D4, 0x9D4B, 0xF1D5, 0x9D59, 0xF1D6, 0x9D56, 0xF1D7, 0x9D4C, - 0xF1D8, 0x9D57, 0xF1D9, 0x9D52, 0xF1DA, 0x9D54, 0xF1DB, 0x9D5F, - 0xF1DC, 0x9D58, 0xF1DD, 0x9D5A, 0xF1DE, 0x9E8E, 0xF1DF, 0x9E8C, - 0xF1E0, 0x9EDF, 0xF1E1, 0x9F01, 0xF1E2, 0x9F00, 0xF1E3, 0x9F16, - 0xF1E4, 0x9F25, 0xF1E5, 0x9F2B, 0xF1E6, 0x9F2A, 0xF1E7, 0x9F29, - 0xF1E8, 0x9F28, 0xF1E9, 0x9F4C, 0xF1EA, 0x9F55, 0xF1EB, 0x5134, - 0xF1EC, 0x5135, 0xF1ED, 0x5296, 0xF1EE, 0x52F7, 0xF1EF, 0x53B4, - 0xF1F0, 0x56AB, 0xF1F1, 0x56AD, 0xF1F2, 0x56A6, 0xF1F3, 0x56A7, - 0xF1F4, 0x56AA, 0xF1F5, 0x56AC, 0xF1F6, 0x58DA, 0xF1F7, 0x58DD, - 0xF1F8, 0x58DB, 0xF1F9, 0x5912, 0xF1FA, 0x5B3D, 0xF1FB, 0x5B3E, - 0xF1FC, 0x5B3F, 0xF1FD, 0x5DC3, 0xF1FE, 0x5E70, 0xF240, 0x5FBF, - 0xF241, 0x61FB, 0xF242, 0x6507, 0xF243, 0x6510, 0xF244, 0x650D, - 0xF245, 0x6509, 0xF246, 0x650C, 0xF247, 0x650E, 0xF248, 0x6584, - 0xF249, 0x65DE, 0xF24A, 0x65DD, 0xF24B, 0x66DE, 0xF24C, 0x6AE7, - 0xF24D, 0x6AE0, 0xF24E, 0x6ACC, 0xF24F, 0x6AD1, 0xF250, 0x6AD9, - 0xF251, 0x6ACB, 0xF252, 0x6ADF, 0xF253, 0x6ADC, 0xF254, 0x6AD0, - 0xF255, 0x6AEB, 0xF256, 0x6ACF, 0xF257, 0x6ACD, 0xF258, 0x6ADE, - 0xF259, 0x6B60, 0xF25A, 0x6BB0, 0xF25B, 0x6C0C, 0xF25C, 0x7019, - 0xF25D, 0x7027, 0xF25E, 0x7020, 0xF25F, 0x7016, 0xF260, 0x702B, - 0xF261, 0x7021, 0xF262, 0x7022, 0xF263, 0x7023, 0xF264, 0x7029, - 0xF265, 0x7017, 0xF266, 0x7024, 0xF267, 0x701C, 0xF268, 0x702A, - 0xF269, 0x720C, 0xF26A, 0x720A, 0xF26B, 0x7207, 0xF26C, 0x7202, - 0xF26D, 0x7205, 0xF26E, 0x72A5, 0xF26F, 0x72A6, 0xF270, 0x72A4, - 0xF271, 0x72A3, 0xF272, 0x72A1, 0xF273, 0x74CB, 0xF274, 0x74C5, - 0xF275, 0x74B7, 0xF276, 0x74C3, 0xF277, 0x7516, 0xF278, 0x7660, - 0xF279, 0x77C9, 0xF27A, 0x77CA, 0xF27B, 0x77C4, 0xF27C, 0x77F1, - 0xF27D, 0x791D, 0xF27E, 0x791B, 0xF2A1, 0x7921, 0xF2A2, 0x791C, - 0xF2A3, 0x7917, 0xF2A4, 0x791E, 0xF2A5, 0x79B0, 0xF2A6, 0x7A67, - 0xF2A7, 0x7A68, 0xF2A8, 0x7C33, 0xF2A9, 0x7C3C, 0xF2AA, 0x7C39, - 0xF2AB, 0x7C2C, 0xF2AC, 0x7C3B, 0xF2AD, 0x7CEC, 0xF2AE, 0x7CEA, - 0xF2AF, 0x7E76, 0xF2B0, 0x7E75, 0xF2B1, 0x7E78, 0xF2B2, 0x7E70, - 0xF2B3, 0x7E77, 0xF2B4, 0x7E6F, 0xF2B5, 0x7E7A, 0xF2B6, 0x7E72, - 0xF2B7, 0x7E74, 0xF2B8, 0x7E68, 0xF2B9, 0x7F4B, 0xF2BA, 0x7F4A, - 0xF2BB, 0x7F83, 0xF2BC, 0x7F86, 0xF2BD, 0x7FB7, 0xF2BE, 0x7FFD, - 0xF2BF, 0x7FFE, 0xF2C0, 0x8078, 0xF2C1, 0x81D7, 0xF2C2, 0x81D5, - 0xF2C3, 0x8264, 0xF2C4, 0x8261, 0xF2C5, 0x8263, 0xF2C6, 0x85EB, - 0xF2C7, 0x85F1, 0xF2C8, 0x85ED, 0xF2C9, 0x85D9, 0xF2CA, 0x85E1, - 0xF2CB, 0x85E8, 0xF2CC, 0x85DA, 0xF2CD, 0x85D7, 0xF2CE, 0x85EC, - 0xF2CF, 0x85F2, 0xF2D0, 0x85F8, 0xF2D1, 0x85D8, 0xF2D2, 0x85DF, - 0xF2D3, 0x85E3, 0xF2D4, 0x85DC, 0xF2D5, 0x85D1, 0xF2D6, 0x85F0, - 0xF2D7, 0x85E6, 0xF2D8, 0x85EF, 0xF2D9, 0x85DE, 0xF2DA, 0x85E2, - 0xF2DB, 0x8800, 0xF2DC, 0x87FA, 0xF2DD, 0x8803, 0xF2DE, 0x87F6, - 0xF2DF, 0x87F7, 0xF2E0, 0x8809, 0xF2E1, 0x880C, 0xF2E2, 0x880B, - 0xF2E3, 0x8806, 0xF2E4, 0x87FC, 0xF2E5, 0x8808, 0xF2E6, 0x87FF, - 0xF2E7, 0x880A, 0xF2E8, 0x8802, 0xF2E9, 0x8962, 0xF2EA, 0x895A, - 0xF2EB, 0x895B, 0xF2EC, 0x8957, 0xF2ED, 0x8961, 0xF2EE, 0x895C, - 0xF2EF, 0x8958, 0xF2F0, 0x895D, 0xF2F1, 0x8959, 0xF2F2, 0x8988, - 0xF2F3, 0x89B7, 0xF2F4, 0x89B6, 0xF2F5, 0x89F6, 0xF2F6, 0x8B50, - 0xF2F7, 0x8B48, 0xF2F8, 0x8B4A, 0xF2F9, 0x8B40, 0xF2FA, 0x8B53, - 0xF2FB, 0x8B56, 0xF2FC, 0x8B54, 0xF2FD, 0x8B4B, 0xF2FE, 0x8B55, - 0xF340, 0x8B51, 0xF341, 0x8B42, 0xF342, 0x8B52, 0xF343, 0x8B57, - 0xF344, 0x8C43, 0xF345, 0x8C77, 0xF346, 0x8C76, 0xF347, 0x8C9A, - 0xF348, 0x8D06, 0xF349, 0x8D07, 0xF34A, 0x8D09, 0xF34B, 0x8DAC, - 0xF34C, 0x8DAA, 0xF34D, 0x8DAD, 0xF34E, 0x8DAB, 0xF34F, 0x8E6D, - 0xF350, 0x8E78, 0xF351, 0x8E73, 0xF352, 0x8E6A, 0xF353, 0x8E6F, - 0xF354, 0x8E7B, 0xF355, 0x8EC2, 0xF356, 0x8F52, 0xF357, 0x8F51, - 0xF358, 0x8F4F, 0xF359, 0x8F50, 0xF35A, 0x8F53, 0xF35B, 0x8FB4, - 0xF35C, 0x9140, 0xF35D, 0x913F, 0xF35E, 0x91B0, 0xF35F, 0x91AD, - 0xF360, 0x93DE, 0xF361, 0x93C7, 0xF362, 0x93CF, 0xF363, 0x93C2, - 0xF364, 0x93DA, 0xF365, 0x93D0, 0xF366, 0x93F9, 0xF367, 0x93EC, - 0xF368, 0x93CC, 0xF369, 0x93D9, 0xF36A, 0x93A9, 0xF36B, 0x93E6, - 0xF36C, 0x93CA, 0xF36D, 0x93D4, 0xF36E, 0x93EE, 0xF36F, 0x93E3, - 0xF370, 0x93D5, 0xF371, 0x93C4, 0xF372, 0x93CE, 0xF373, 0x93C0, - 0xF374, 0x93D2, 0xF375, 0x93E7, 0xF376, 0x957D, 0xF377, 0x95DA, - 0xF378, 0x95DB, 0xF379, 0x96E1, 0xF37A, 0x9729, 0xF37B, 0x972B, - 0xF37C, 0x972C, 0xF37D, 0x9728, 0xF37E, 0x9726, 0xF3A1, 0x97B3, - 0xF3A2, 0x97B7, 0xF3A3, 0x97B6, 0xF3A4, 0x97DD, 0xF3A5, 0x97DE, - 0xF3A6, 0x97DF, 0xF3A7, 0x985C, 0xF3A8, 0x9859, 0xF3A9, 0x985D, - 0xF3AA, 0x9857, 0xF3AB, 0x98BF, 0xF3AC, 0x98BD, 0xF3AD, 0x98BB, - 0xF3AE, 0x98BE, 0xF3AF, 0x9948, 0xF3B0, 0x9947, 0xF3B1, 0x9943, - 0xF3B2, 0x99A6, 0xF3B3, 0x99A7, 0xF3B4, 0x9A1A, 0xF3B5, 0x9A15, - 0xF3B6, 0x9A25, 0xF3B7, 0x9A1D, 0xF3B8, 0x9A24, 0xF3B9, 0x9A1B, - 0xF3BA, 0x9A22, 0xF3BB, 0x9A20, 0xF3BC, 0x9A27, 0xF3BD, 0x9A23, - 0xF3BE, 0x9A1E, 0xF3BF, 0x9A1C, 0xF3C0, 0x9A14, 0xF3C1, 0x9AC2, - 0xF3C2, 0x9B0B, 0xF3C3, 0x9B0A, 0xF3C4, 0x9B0E, 0xF3C5, 0x9B0C, - 0xF3C6, 0x9B37, 0xF3C7, 0x9BEA, 0xF3C8, 0x9BEB, 0xF3C9, 0x9BE0, - 0xF3CA, 0x9BDE, 0xF3CB, 0x9BE4, 0xF3CC, 0x9BE6, 0xF3CD, 0x9BE2, - 0xF3CE, 0x9BF0, 0xF3CF, 0x9BD4, 0xF3D0, 0x9BD7, 0xF3D1, 0x9BEC, - 0xF3D2, 0x9BDC, 0xF3D3, 0x9BD9, 0xF3D4, 0x9BE5, 0xF3D5, 0x9BD5, - 0xF3D6, 0x9BE1, 0xF3D7, 0x9BDA, 0xF3D8, 0x9D77, 0xF3D9, 0x9D81, - 0xF3DA, 0x9D8A, 0xF3DB, 0x9D84, 0xF3DC, 0x9D88, 0xF3DD, 0x9D71, - 0xF3DE, 0x9D80, 0xF3DF, 0x9D78, 0xF3E0, 0x9D86, 0xF3E1, 0x9D8B, - 0xF3E2, 0x9D8C, 0xF3E3, 0x9D7D, 0xF3E4, 0x9D6B, 0xF3E5, 0x9D74, - 0xF3E6, 0x9D75, 0xF3E7, 0x9D70, 0xF3E8, 0x9D69, 0xF3E9, 0x9D85, - 0xF3EA, 0x9D73, 0xF3EB, 0x9D7B, 0xF3EC, 0x9D82, 0xF3ED, 0x9D6F, - 0xF3EE, 0x9D79, 0xF3EF, 0x9D7F, 0xF3F0, 0x9D87, 0xF3F1, 0x9D68, - 0xF3F2, 0x9E94, 0xF3F3, 0x9E91, 0xF3F4, 0x9EC0, 0xF3F5, 0x9EFC, - 0xF3F6, 0x9F2D, 0xF3F7, 0x9F40, 0xF3F8, 0x9F41, 0xF3F9, 0x9F4D, - 0xF3FA, 0x9F56, 0xF3FB, 0x9F57, 0xF3FC, 0x9F58, 0xF3FD, 0x5337, - 0xF3FE, 0x56B2, 0xF440, 0x56B5, 0xF441, 0x56B3, 0xF442, 0x58E3, - 0xF443, 0x5B45, 0xF444, 0x5DC6, 0xF445, 0x5DC7, 0xF446, 0x5EEE, - 0xF447, 0x5EEF, 0xF448, 0x5FC0, 0xF449, 0x5FC1, 0xF44A, 0x61F9, - 0xF44B, 0x6517, 0xF44C, 0x6516, 0xF44D, 0x6515, 0xF44E, 0x6513, - 0xF44F, 0x65DF, 0xF450, 0x66E8, 0xF451, 0x66E3, 0xF452, 0x66E4, - 0xF453, 0x6AF3, 0xF454, 0x6AF0, 0xF455, 0x6AEA, 0xF456, 0x6AE8, - 0xF457, 0x6AF9, 0xF458, 0x6AF1, 0xF459, 0x6AEE, 0xF45A, 0x6AEF, - 0xF45B, 0x703C, 0xF45C, 0x7035, 0xF45D, 0x702F, 0xF45E, 0x7037, - 0xF45F, 0x7034, 0xF460, 0x7031, 0xF461, 0x7042, 0xF462, 0x7038, - 0xF463, 0x703F, 0xF464, 0x703A, 0xF465, 0x7039, 0xF466, 0x7040, - 0xF467, 0x703B, 0xF468, 0x7033, 0xF469, 0x7041, 0xF46A, 0x7213, - 0xF46B, 0x7214, 0xF46C, 0x72A8, 0xF46D, 0x737D, 0xF46E, 0x737C, - 0xF46F, 0x74BA, 0xF470, 0x76AB, 0xF471, 0x76AA, 0xF472, 0x76BE, - 0xF473, 0x76ED, 0xF474, 0x77CC, 0xF475, 0x77CE, 0xF476, 0x77CF, - 0xF477, 0x77CD, 0xF478, 0x77F2, 0xF479, 0x7925, 0xF47A, 0x7923, - 0xF47B, 0x7927, 0xF47C, 0x7928, 0xF47D, 0x7924, 0xF47E, 0x7929, - 0xF4A1, 0x79B2, 0xF4A2, 0x7A6E, 0xF4A3, 0x7A6C, 0xF4A4, 0x7A6D, - 0xF4A5, 0x7AF7, 0xF4A6, 0x7C49, 0xF4A7, 0x7C48, 0xF4A8, 0x7C4A, - 0xF4A9, 0x7C47, 0xF4AA, 0x7C45, 0xF4AB, 0x7CEE, 0xF4AC, 0x7E7B, - 0xF4AD, 0x7E7E, 0xF4AE, 0x7E81, 0xF4AF, 0x7E80, 0xF4B0, 0x7FBA, - 0xF4B1, 0x7FFF, 0xF4B2, 0x8079, 0xF4B3, 0x81DB, 0xF4B4, 0x81D9, - 0xF4B5, 0x820B, 0xF4B6, 0x8268, 0xF4B7, 0x8269, 0xF4B8, 0x8622, - 0xF4B9, 0x85FF, 0xF4BA, 0x8601, 0xF4BB, 0x85FE, 0xF4BC, 0x861B, - 0xF4BD, 0x8600, 0xF4BE, 0x85F6, 0xF4BF, 0x8604, 0xF4C0, 0x8609, - 0xF4C1, 0x8605, 0xF4C2, 0x860C, 0xF4C3, 0x85FD, 0xF4C4, 0x8819, - 0xF4C5, 0x8810, 0xF4C6, 0x8811, 0xF4C7, 0x8817, 0xF4C8, 0x8813, - 0xF4C9, 0x8816, 0xF4CA, 0x8963, 0xF4CB, 0x8966, 0xF4CC, 0x89B9, - 0xF4CD, 0x89F7, 0xF4CE, 0x8B60, 0xF4CF, 0x8B6A, 0xF4D0, 0x8B5D, - 0xF4D1, 0x8B68, 0xF4D2, 0x8B63, 0xF4D3, 0x8B65, 0xF4D4, 0x8B67, - 0xF4D5, 0x8B6D, 0xF4D6, 0x8DAE, 0xF4D7, 0x8E86, 0xF4D8, 0x8E88, - 0xF4D9, 0x8E84, 0xF4DA, 0x8F59, 0xF4DB, 0x8F56, 0xF4DC, 0x8F57, - 0xF4DD, 0x8F55, 0xF4DE, 0x8F58, 0xF4DF, 0x8F5A, 0xF4E0, 0x908D, - 0xF4E1, 0x9143, 0xF4E2, 0x9141, 0xF4E3, 0x91B7, 0xF4E4, 0x91B5, - 0xF4E5, 0x91B2, 0xF4E6, 0x91B3, 0xF4E7, 0x940B, 0xF4E8, 0x9413, - 0xF4E9, 0x93FB, 0xF4EA, 0x9420, 0xF4EB, 0x940F, 0xF4EC, 0x9414, - 0xF4ED, 0x93FE, 0xF4EE, 0x9415, 0xF4EF, 0x9410, 0xF4F0, 0x9428, - 0xF4F1, 0x9419, 0xF4F2, 0x940D, 0xF4F3, 0x93F5, 0xF4F4, 0x9400, - 0xF4F5, 0x93F7, 0xF4F6, 0x9407, 0xF4F7, 0x940E, 0xF4F8, 0x9416, - 0xF4F9, 0x9412, 0xF4FA, 0x93FA, 0xF4FB, 0x9409, 0xF4FC, 0x93F8, - 0xF4FD, 0x940A, 0xF4FE, 0x93FF, 0xF540, 0x93FC, 0xF541, 0x940C, - 0xF542, 0x93F6, 0xF543, 0x9411, 0xF544, 0x9406, 0xF545, 0x95DE, - 0xF546, 0x95E0, 0xF547, 0x95DF, 0xF548, 0x972E, 0xF549, 0x972F, - 0xF54A, 0x97B9, 0xF54B, 0x97BB, 0xF54C, 0x97FD, 0xF54D, 0x97FE, - 0xF54E, 0x9860, 0xF54F, 0x9862, 0xF550, 0x9863, 0xF551, 0x985F, - 0xF552, 0x98C1, 0xF553, 0x98C2, 0xF554, 0x9950, 0xF555, 0x994E, - 0xF556, 0x9959, 0xF557, 0x994C, 0xF558, 0x994B, 0xF559, 0x9953, - 0xF55A, 0x9A32, 0xF55B, 0x9A34, 0xF55C, 0x9A31, 0xF55D, 0x9A2C, - 0xF55E, 0x9A2A, 0xF55F, 0x9A36, 0xF560, 0x9A29, 0xF561, 0x9A2E, - 0xF562, 0x9A38, 0xF563, 0x9A2D, 0xF564, 0x9AC7, 0xF565, 0x9ACA, - 0xF566, 0x9AC6, 0xF567, 0x9B10, 0xF568, 0x9B12, 0xF569, 0x9B11, - 0xF56A, 0x9C0B, 0xF56B, 0x9C08, 0xF56C, 0x9BF7, 0xF56D, 0x9C05, - 0xF56E, 0x9C12, 0xF56F, 0x9BF8, 0xF570, 0x9C40, 0xF571, 0x9C07, - 0xF572, 0x9C0E, 0xF573, 0x9C06, 0xF574, 0x9C17, 0xF575, 0x9C14, - 0xF576, 0x9C09, 0xF577, 0x9D9F, 0xF578, 0x9D99, 0xF579, 0x9DA4, - 0xF57A, 0x9D9D, 0xF57B, 0x9D92, 0xF57C, 0x9D98, 0xF57D, 0x9D90, - 0xF57E, 0x9D9B, 0xF5A1, 0x9DA0, 0xF5A2, 0x9D94, 0xF5A3, 0x9D9C, - 0xF5A4, 0x9DAA, 0xF5A5, 0x9D97, 0xF5A6, 0x9DA1, 0xF5A7, 0x9D9A, - 0xF5A8, 0x9DA2, 0xF5A9, 0x9DA8, 0xF5AA, 0x9D9E, 0xF5AB, 0x9DA3, - 0xF5AC, 0x9DBF, 0xF5AD, 0x9DA9, 0xF5AE, 0x9D96, 0xF5AF, 0x9DA6, - 0xF5B0, 0x9DA7, 0xF5B1, 0x9E99, 0xF5B2, 0x9E9B, 0xF5B3, 0x9E9A, - 0xF5B4, 0x9EE5, 0xF5B5, 0x9EE4, 0xF5B6, 0x9EE7, 0xF5B7, 0x9EE6, - 0xF5B8, 0x9F30, 0xF5B9, 0x9F2E, 0xF5BA, 0x9F5B, 0xF5BB, 0x9F60, - 0xF5BC, 0x9F5E, 0xF5BD, 0x9F5D, 0xF5BE, 0x9F59, 0xF5BF, 0x9F91, - 0xF5C0, 0x513A, 0xF5C1, 0x5139, 0xF5C2, 0x5298, 0xF5C3, 0x5297, - 0xF5C4, 0x56C3, 0xF5C5, 0x56BD, 0xF5C6, 0x56BE, 0xF5C7, 0x5B48, - 0xF5C8, 0x5B47, 0xF5C9, 0x5DCB, 0xF5CA, 0x5DCF, 0xF5CB, 0x5EF1, - 0xF5CC, 0x61FD, 0xF5CD, 0x651B, 0xF5CE, 0x6B02, 0xF5CF, 0x6AFC, - 0xF5D0, 0x6B03, 0xF5D1, 0x6AF8, 0xF5D2, 0x6B00, 0xF5D3, 0x7043, - 0xF5D4, 0x7044, 0xF5D5, 0x704A, 0xF5D6, 0x7048, 0xF5D7, 0x7049, - 0xF5D8, 0x7045, 0xF5D9, 0x7046, 0xF5DA, 0x721D, 0xF5DB, 0x721A, - 0xF5DC, 0x7219, 0xF5DD, 0x737E, 0xF5DE, 0x7517, 0xF5DF, 0x766A, - 0xF5E0, 0x77D0, 0xF5E1, 0x792D, 0xF5E2, 0x7931, 0xF5E3, 0x792F, - 0xF5E4, 0x7C54, 0xF5E5, 0x7C53, 0xF5E6, 0x7CF2, 0xF5E7, 0x7E8A, - 0xF5E8, 0x7E87, 0xF5E9, 0x7E88, 0xF5EA, 0x7E8B, 0xF5EB, 0x7E86, - 0xF5EC, 0x7E8D, 0xF5ED, 0x7F4D, 0xF5EE, 0x7FBB, 0xF5EF, 0x8030, - 0xF5F0, 0x81DD, 0xF5F1, 0x8618, 0xF5F2, 0x862A, 0xF5F3, 0x8626, - 0xF5F4, 0x861F, 0xF5F5, 0x8623, 0xF5F6, 0x861C, 0xF5F7, 0x8619, - 0xF5F8, 0x8627, 0xF5F9, 0x862E, 0xF5FA, 0x8621, 0xF5FB, 0x8620, - 0xF5FC, 0x8629, 0xF5FD, 0x861E, 0xF5FE, 0x8625, 0xF640, 0x8829, - 0xF641, 0x881D, 0xF642, 0x881B, 0xF643, 0x8820, 0xF644, 0x8824, - 0xF645, 0x881C, 0xF646, 0x882B, 0xF647, 0x884A, 0xF648, 0x896D, - 0xF649, 0x8969, 0xF64A, 0x896E, 0xF64B, 0x896B, 0xF64C, 0x89FA, - 0xF64D, 0x8B79, 0xF64E, 0x8B78, 0xF64F, 0x8B45, 0xF650, 0x8B7A, - 0xF651, 0x8B7B, 0xF652, 0x8D10, 0xF653, 0x8D14, 0xF654, 0x8DAF, - 0xF655, 0x8E8E, 0xF656, 0x8E8C, 0xF657, 0x8F5E, 0xF658, 0x8F5B, - 0xF659, 0x8F5D, 0xF65A, 0x9146, 0xF65B, 0x9144, 0xF65C, 0x9145, - 0xF65D, 0x91B9, 0xF65E, 0x943F, 0xF65F, 0x943B, 0xF660, 0x9436, - 0xF661, 0x9429, 0xF662, 0x943D, 0xF663, 0x943C, 0xF664, 0x9430, - 0xF665, 0x9439, 0xF666, 0x942A, 0xF667, 0x9437, 0xF668, 0x942C, - 0xF669, 0x9440, 0xF66A, 0x9431, 0xF66B, 0x95E5, 0xF66C, 0x95E4, - 0xF66D, 0x95E3, 0xF66E, 0x9735, 0xF66F, 0x973A, 0xF670, 0x97BF, - 0xF671, 0x97E1, 0xF672, 0x9864, 0xF673, 0x98C9, 0xF674, 0x98C6, - 0xF675, 0x98C0, 0xF676, 0x9958, 0xF677, 0x9956, 0xF678, 0x9A39, - 0xF679, 0x9A3D, 0xF67A, 0x9A46, 0xF67B, 0x9A44, 0xF67C, 0x9A42, - 0xF67D, 0x9A41, 0xF67E, 0x9A3A, 0xF6A1, 0x9A3F, 0xF6A2, 0x9ACD, - 0xF6A3, 0x9B15, 0xF6A4, 0x9B17, 0xF6A5, 0x9B18, 0xF6A6, 0x9B16, - 0xF6A7, 0x9B3A, 0xF6A8, 0x9B52, 0xF6A9, 0x9C2B, 0xF6AA, 0x9C1D, - 0xF6AB, 0x9C1C, 0xF6AC, 0x9C2C, 0xF6AD, 0x9C23, 0xF6AE, 0x9C28, - 0xF6AF, 0x9C29, 0xF6B0, 0x9C24, 0xF6B1, 0x9C21, 0xF6B2, 0x9DB7, - 0xF6B3, 0x9DB6, 0xF6B4, 0x9DBC, 0xF6B5, 0x9DC1, 0xF6B6, 0x9DC7, - 0xF6B7, 0x9DCA, 0xF6B8, 0x9DCF, 0xF6B9, 0x9DBE, 0xF6BA, 0x9DC5, - 0xF6BB, 0x9DC3, 0xF6BC, 0x9DBB, 0xF6BD, 0x9DB5, 0xF6BE, 0x9DCE, - 0xF6BF, 0x9DB9, 0xF6C0, 0x9DBA, 0xF6C1, 0x9DAC, 0xF6C2, 0x9DC8, - 0xF6C3, 0x9DB1, 0xF6C4, 0x9DAD, 0xF6C5, 0x9DCC, 0xF6C6, 0x9DB3, - 0xF6C7, 0x9DCD, 0xF6C8, 0x9DB2, 0xF6C9, 0x9E7A, 0xF6CA, 0x9E9C, - 0xF6CB, 0x9EEB, 0xF6CC, 0x9EEE, 0xF6CD, 0x9EED, 0xF6CE, 0x9F1B, - 0xF6CF, 0x9F18, 0xF6D0, 0x9F1A, 0xF6D1, 0x9F31, 0xF6D2, 0x9F4E, - 0xF6D3, 0x9F65, 0xF6D4, 0x9F64, 0xF6D5, 0x9F92, 0xF6D6, 0x4EB9, - 0xF6D7, 0x56C6, 0xF6D8, 0x56C5, 0xF6D9, 0x56CB, 0xF6DA, 0x5971, - 0xF6DB, 0x5B4B, 0xF6DC, 0x5B4C, 0xF6DD, 0x5DD5, 0xF6DE, 0x5DD1, - 0xF6DF, 0x5EF2, 0xF6E0, 0x6521, 0xF6E1, 0x6520, 0xF6E2, 0x6526, - 0xF6E3, 0x6522, 0xF6E4, 0x6B0B, 0xF6E5, 0x6B08, 0xF6E6, 0x6B09, - 0xF6E7, 0x6C0D, 0xF6E8, 0x7055, 0xF6E9, 0x7056, 0xF6EA, 0x7057, - 0xF6EB, 0x7052, 0xF6EC, 0x721E, 0xF6ED, 0x721F, 0xF6EE, 0x72A9, - 0xF6EF, 0x737F, 0xF6F0, 0x74D8, 0xF6F1, 0x74D5, 0xF6F2, 0x74D9, - 0xF6F3, 0x74D7, 0xF6F4, 0x766D, 0xF6F5, 0x76AD, 0xF6F6, 0x7935, - 0xF6F7, 0x79B4, 0xF6F8, 0x7A70, 0xF6F9, 0x7A71, 0xF6FA, 0x7C57, - 0xF6FB, 0x7C5C, 0xF6FC, 0x7C59, 0xF6FD, 0x7C5B, 0xF6FE, 0x7C5A, - 0xF740, 0x7CF4, 0xF741, 0x7CF1, 0xF742, 0x7E91, 0xF743, 0x7F4F, - 0xF744, 0x7F87, 0xF745, 0x81DE, 0xF746, 0x826B, 0xF747, 0x8634, - 0xF748, 0x8635, 0xF749, 0x8633, 0xF74A, 0x862C, 0xF74B, 0x8632, - 0xF74C, 0x8636, 0xF74D, 0x882C, 0xF74E, 0x8828, 0xF74F, 0x8826, - 0xF750, 0x882A, 0xF751, 0x8825, 0xF752, 0x8971, 0xF753, 0x89BF, - 0xF754, 0x89BE, 0xF755, 0x89FB, 0xF756, 0x8B7E, 0xF757, 0x8B84, - 0xF758, 0x8B82, 0xF759, 0x8B86, 0xF75A, 0x8B85, 0xF75B, 0x8B7F, - 0xF75C, 0x8D15, 0xF75D, 0x8E95, 0xF75E, 0x8E94, 0xF75F, 0x8E9A, - 0xF760, 0x8E92, 0xF761, 0x8E90, 0xF762, 0x8E96, 0xF763, 0x8E97, - 0xF764, 0x8F60, 0xF765, 0x8F62, 0xF766, 0x9147, 0xF767, 0x944C, - 0xF768, 0x9450, 0xF769, 0x944A, 0xF76A, 0x944B, 0xF76B, 0x944F, - 0xF76C, 0x9447, 0xF76D, 0x9445, 0xF76E, 0x9448, 0xF76F, 0x9449, - 0xF770, 0x9446, 0xF771, 0x973F, 0xF772, 0x97E3, 0xF773, 0x986A, - 0xF774, 0x9869, 0xF775, 0x98CB, 0xF776, 0x9954, 0xF777, 0x995B, - 0xF778, 0x9A4E, 0xF779, 0x9A53, 0xF77A, 0x9A54, 0xF77B, 0x9A4C, - 0xF77C, 0x9A4F, 0xF77D, 0x9A48, 0xF77E, 0x9A4A, 0xF7A1, 0x9A49, - 0xF7A2, 0x9A52, 0xF7A3, 0x9A50, 0xF7A4, 0x9AD0, 0xF7A5, 0x9B19, - 0xF7A6, 0x9B2B, 0xF7A7, 0x9B3B, 0xF7A8, 0x9B56, 0xF7A9, 0x9B55, - 0xF7AA, 0x9C46, 0xF7AB, 0x9C48, 0xF7AC, 0x9C3F, 0xF7AD, 0x9C44, - 0xF7AE, 0x9C39, 0xF7AF, 0x9C33, 0xF7B0, 0x9C41, 0xF7B1, 0x9C3C, - 0xF7B2, 0x9C37, 0xF7B3, 0x9C34, 0xF7B4, 0x9C32, 0xF7B5, 0x9C3D, - 0xF7B6, 0x9C36, 0xF7B7, 0x9DDB, 0xF7B8, 0x9DD2, 0xF7B9, 0x9DDE, - 0xF7BA, 0x9DDA, 0xF7BB, 0x9DCB, 0xF7BC, 0x9DD0, 0xF7BD, 0x9DDC, - 0xF7BE, 0x9DD1, 0xF7BF, 0x9DDF, 0xF7C0, 0x9DE9, 0xF7C1, 0x9DD9, - 0xF7C2, 0x9DD8, 0xF7C3, 0x9DD6, 0xF7C4, 0x9DF5, 0xF7C5, 0x9DD5, - 0xF7C6, 0x9DDD, 0xF7C7, 0x9EB6, 0xF7C8, 0x9EF0, 0xF7C9, 0x9F35, - 0xF7CA, 0x9F33, 0xF7CB, 0x9F32, 0xF7CC, 0x9F42, 0xF7CD, 0x9F6B, - 0xF7CE, 0x9F95, 0xF7CF, 0x9FA2, 0xF7D0, 0x513D, 0xF7D1, 0x5299, - 0xF7D2, 0x58E8, 0xF7D3, 0x58E7, 0xF7D4, 0x5972, 0xF7D5, 0x5B4D, - 0xF7D6, 0x5DD8, 0xF7D7, 0x882F, 0xF7D8, 0x5F4F, 0xF7D9, 0x6201, - 0xF7DA, 0x6203, 0xF7DB, 0x6204, 0xF7DC, 0x6529, 0xF7DD, 0x6525, - 0xF7DE, 0x6596, 0xF7DF, 0x66EB, 0xF7E0, 0x6B11, 0xF7E1, 0x6B12, - 0xF7E2, 0x6B0F, 0xF7E3, 0x6BCA, 0xF7E4, 0x705B, 0xF7E5, 0x705A, - 0xF7E6, 0x7222, 0xF7E7, 0x7382, 0xF7E8, 0x7381, 0xF7E9, 0x7383, - 0xF7EA, 0x7670, 0xF7EB, 0x77D4, 0xF7EC, 0x7C67, 0xF7ED, 0x7C66, - 0xF7EE, 0x7E95, 0xF7EF, 0x826C, 0xF7F0, 0x863A, 0xF7F1, 0x8640, - 0xF7F2, 0x8639, 0xF7F3, 0x863C, 0xF7F4, 0x8631, 0xF7F5, 0x863B, - 0xF7F6, 0x863E, 0xF7F7, 0x8830, 0xF7F8, 0x8832, 0xF7F9, 0x882E, - 0xF7FA, 0x8833, 0xF7FB, 0x8976, 0xF7FC, 0x8974, 0xF7FD, 0x8973, - 0xF7FE, 0x89FE, 0xF840, 0x8B8C, 0xF841, 0x8B8E, 0xF842, 0x8B8B, - 0xF843, 0x8B88, 0xF844, 0x8C45, 0xF845, 0x8D19, 0xF846, 0x8E98, - 0xF847, 0x8F64, 0xF848, 0x8F63, 0xF849, 0x91BC, 0xF84A, 0x9462, - 0xF84B, 0x9455, 0xF84C, 0x945D, 0xF84D, 0x9457, 0xF84E, 0x945E, - 0xF84F, 0x97C4, 0xF850, 0x97C5, 0xF851, 0x9800, 0xF852, 0x9A56, - 0xF853, 0x9A59, 0xF854, 0x9B1E, 0xF855, 0x9B1F, 0xF856, 0x9B20, - 0xF857, 0x9C52, 0xF858, 0x9C58, 0xF859, 0x9C50, 0xF85A, 0x9C4A, - 0xF85B, 0x9C4D, 0xF85C, 0x9C4B, 0xF85D, 0x9C55, 0xF85E, 0x9C59, - 0xF85F, 0x9C4C, 0xF860, 0x9C4E, 0xF861, 0x9DFB, 0xF862, 0x9DF7, - 0xF863, 0x9DEF, 0xF864, 0x9DE3, 0xF865, 0x9DEB, 0xF866, 0x9DF8, - 0xF867, 0x9DE4, 0xF868, 0x9DF6, 0xF869, 0x9DE1, 0xF86A, 0x9DEE, - 0xF86B, 0x9DE6, 0xF86C, 0x9DF2, 0xF86D, 0x9DF0, 0xF86E, 0x9DE2, - 0xF86F, 0x9DEC, 0xF870, 0x9DF4, 0xF871, 0x9DF3, 0xF872, 0x9DE8, - 0xF873, 0x9DED, 0xF874, 0x9EC2, 0xF875, 0x9ED0, 0xF876, 0x9EF2, - 0xF877, 0x9EF3, 0xF878, 0x9F06, 0xF879, 0x9F1C, 0xF87A, 0x9F38, - 0xF87B, 0x9F37, 0xF87C, 0x9F36, 0xF87D, 0x9F43, 0xF87E, 0x9F4F, - 0xF8A1, 0x9F71, 0xF8A2, 0x9F70, 0xF8A3, 0x9F6E, 0xF8A4, 0x9F6F, - 0xF8A5, 0x56D3, 0xF8A6, 0x56CD, 0xF8A7, 0x5B4E, 0xF8A8, 0x5C6D, - 0xF8A9, 0x652D, 0xF8AA, 0x66ED, 0xF8AB, 0x66EE, 0xF8AC, 0x6B13, - 0xF8AD, 0x705F, 0xF8AE, 0x7061, 0xF8AF, 0x705D, 0xF8B0, 0x7060, - 0xF8B1, 0x7223, 0xF8B2, 0x74DB, 0xF8B3, 0x74E5, 0xF8B4, 0x77D5, - 0xF8B5, 0x7938, 0xF8B6, 0x79B7, 0xF8B7, 0x79B6, 0xF8B8, 0x7C6A, - 0xF8B9, 0x7E97, 0xF8BA, 0x7F89, 0xF8BB, 0x826D, 0xF8BC, 0x8643, - 0xF8BD, 0x8838, 0xF8BE, 0x8837, 0xF8BF, 0x8835, 0xF8C0, 0x884B, - 0xF8C1, 0x8B94, 0xF8C2, 0x8B95, 0xF8C3, 0x8E9E, 0xF8C4, 0x8E9F, - 0xF8C5, 0x8EA0, 0xF8C6, 0x8E9D, 0xF8C7, 0x91BE, 0xF8C8, 0x91BD, - 0xF8C9, 0x91C2, 0xF8CA, 0x946B, 0xF8CB, 0x9468, 0xF8CC, 0x9469, - 0xF8CD, 0x96E5, 0xF8CE, 0x9746, 0xF8CF, 0x9743, 0xF8D0, 0x9747, - 0xF8D1, 0x97C7, 0xF8D2, 0x97E5, 0xF8D3, 0x9A5E, 0xF8D4, 0x9AD5, - 0xF8D5, 0x9B59, 0xF8D6, 0x9C63, 0xF8D7, 0x9C67, 0xF8D8, 0x9C66, - 0xF8D9, 0x9C62, 0xF8DA, 0x9C5E, 0xF8DB, 0x9C60, 0xF8DC, 0x9E02, - 0xF8DD, 0x9DFE, 0xF8DE, 0x9E07, 0xF8DF, 0x9E03, 0xF8E0, 0x9E06, - 0xF8E1, 0x9E05, 0xF8E2, 0x9E00, 0xF8E3, 0x9E01, 0xF8E4, 0x9E09, - 0xF8E5, 0x9DFF, 0xF8E6, 0x9DFD, 0xF8E7, 0x9E04, 0xF8E8, 0x9EA0, - 0xF8E9, 0x9F1E, 0xF8EA, 0x9F46, 0xF8EB, 0x9F74, 0xF8EC, 0x9F75, - 0xF8ED, 0x9F76, 0xF8EE, 0x56D4, 0xF8EF, 0x652E, 0xF8F0, 0x65B8, - 0xF8F1, 0x6B18, 0xF8F2, 0x6B19, 0xF8F3, 0x6B17, 0xF8F4, 0x6B1A, - 0xF8F5, 0x7062, 0xF8F6, 0x7226, 0xF8F7, 0x72AA, 0xF8F8, 0x77D8, - 0xF8F9, 0x77D9, 0xF8FA, 0x7939, 0xF8FB, 0x7C69, 0xF8FC, 0x7C6B, - 0xF8FD, 0x7CF6, 0xF8FE, 0x7E9A, 0xF940, 0x7E98, 0xF941, 0x7E9B, - 0xF942, 0x7E99, 0xF943, 0x81E0, 0xF944, 0x81E1, 0xF945, 0x8646, - 0xF946, 0x8647, 0xF947, 0x8648, 0xF948, 0x8979, 0xF949, 0x897A, - 0xF94A, 0x897C, 0xF94B, 0x897B, 0xF94C, 0x89FF, 0xF94D, 0x8B98, - 0xF94E, 0x8B99, 0xF94F, 0x8EA5, 0xF950, 0x8EA4, 0xF951, 0x8EA3, - 0xF952, 0x946E, 0xF953, 0x946D, 0xF954, 0x946F, 0xF955, 0x9471, - 0xF956, 0x9473, 0xF957, 0x9749, 0xF958, 0x9872, 0xF959, 0x995F, - 0xF95A, 0x9C68, 0xF95B, 0x9C6E, 0xF95C, 0x9C6D, 0xF95D, 0x9E0B, - 0xF95E, 0x9E0D, 0xF95F, 0x9E10, 0xF960, 0x9E0F, 0xF961, 0x9E12, - 0xF962, 0x9E11, 0xF963, 0x9EA1, 0xF964, 0x9EF5, 0xF965, 0x9F09, - 0xF966, 0x9F47, 0xF967, 0x9F78, 0xF968, 0x9F7B, 0xF969, 0x9F7A, - 0xF96A, 0x9F79, 0xF96B, 0x571E, 0xF96C, 0x7066, 0xF96D, 0x7C6F, - 0xF96E, 0x883C, 0xF96F, 0x8DB2, 0xF970, 0x8EA6, 0xF971, 0x91C3, - 0xF972, 0x9474, 0xF973, 0x9478, 0xF974, 0x9476, 0xF975, 0x9475, - 0xF976, 0x9A60, 0xF977, 0x9C74, 0xF978, 0x9C73, 0xF979, 0x9C71, - 0xF97A, 0x9C75, 0xF97B, 0x9E14, 0xF97C, 0x9E13, 0xF97D, 0x9EF6, - 0xF97E, 0x9F0A, 0xF9A1, 0x9FA4, 0xF9A2, 0x7068, 0xF9A3, 0x7065, - 0xF9A4, 0x7CF7, 0xF9A5, 0x866A, 0xF9A6, 0x883E, 0xF9A7, 0x883D, - 0xF9A8, 0x883F, 0xF9A9, 0x8B9E, 0xF9AA, 0x8C9C, 0xF9AB, 0x8EA9, - 0xF9AC, 0x8EC9, 0xF9AD, 0x974B, 0xF9AE, 0x9873, 0xF9AF, 0x9874, - 0xF9B0, 0x98CC, 0xF9B1, 0x9961, 0xF9B2, 0x99AB, 0xF9B3, 0x9A64, - 0xF9B4, 0x9A66, 0xF9B5, 0x9A67, 0xF9B6, 0x9B24, 0xF9B7, 0x9E15, - 0xF9B8, 0x9E17, 0xF9B9, 0x9F48, 0xF9BA, 0x6207, 0xF9BB, 0x6B1E, - 0xF9BC, 0x7227, 0xF9BD, 0x864C, 0xF9BE, 0x8EA8, 0xF9BF, 0x9482, - 0xF9C0, 0x9480, 0xF9C1, 0x9481, 0xF9C2, 0x9A69, 0xF9C3, 0x9A68, - 0xF9C4, 0x9B2E, 0xF9C5, 0x9E19, 0xF9C6, 0x7229, 0xF9C7, 0x864B, - 0xF9C8, 0x8B9F, 0xF9C9, 0x9483, 0xF9CA, 0x9C79, 0xF9CB, 0x9EB7, - 0xF9CC, 0x7675, 0xF9CD, 0x9A6B, 0xF9CE, 0x9C7A, 0xF9CF, 0x9E1D, - 0xF9D0, 0x7069, 0xF9D1, 0x706A, 0xF9D2, 0x9EA4, 0xF9D3, 0x9F7E, - 0xF9D4, 0x9F49, 0xF9D5, 0x9F98, 0xF9D6, 0x7881, 0xF9D7, 0x92B9, - 0xF9D8, 0x88CF, 0xF9D9, 0x58BB, 0xF9DA, 0x6052, 0xF9DB, 0x7CA7, - 0xF9DC, 0x5AFA, 0xF9DD, 0x2554, 0xF9DE, 0x2566, 0xF9DF, 0x2557, - 0xF9E0, 0x2560, 0xF9E1, 0x256C, 0xF9E2, 0x2563, 0xF9E3, 0x255A, - 0xF9E4, 0x2569, 0xF9E5, 0x255D, 0xF9E6, 0x2552, 0xF9E7, 0x2564, - 0xF9E8, 0x2555, 0xF9E9, 0x255E, 0xF9EA, 0x256A, 0xF9EB, 0x2561, - 0xF9EC, 0x2558, 0xF9ED, 0x2567, 0xF9EE, 0x255B, 0xF9EF, 0x2553, - 0xF9F0, 0x2565, 0xF9F1, 0x2556, 0xF9F2, 0x255F, 0xF9F3, 0x256B, - 0xF9F4, 0x2562, 0xF9F5, 0x2559, 0xF9F6, 0x2568, 0xF9F7, 0x255C, - 0xF9F8, 0x2551, 0xF9F9, 0x2550, 0xF9FA, 0x256D, 0xF9FB, 0x256E, - 0xF9FC, 0x2570, 0xF9FD, 0x256F, 0xF9FE, 0x2593, 0, 0 -}; - - - -WCHAR ff_convert ( /* Converted code, 0 means conversion error */ - WCHAR chr, /* Character code to be converted */ - UINT dir /* 0: Unicode to OEM code, 1: OEM code to Unicode */ -) -{ - const WCHAR *p; - WCHAR c; - int i, n, li, hi; - - - if (chr < 0x80) { /* ASCII */ - c = chr; - } else { - if (dir) { /* OEM code to unicode */ - p = oem2uni; - hi = sizeof oem2uni / 4 - 1; - } else { /* Unicode to OEM code */ - p = uni2oem; - hi = sizeof uni2oem / 4 - 1; - } - li = 0; - for (n = 16; n; n--) { - i = li + (hi - li) / 2; - if (chr == p[i * 2]) break; - if (chr > p[i * 2]) - li = i; - else - hi = i; - } - c = n ? p[i * 2 + 1] : 0; - } - - return c; -} - - - -WCHAR ff_wtoupper ( /* Returns upper converted character */ - WCHAR chr /* Unicode character to be upper converted (BMP only) */ -) -{ - /* Compressed upper conversion table */ - static const WCHAR cvt1[] = { /* U+0000 - U+0FFF */ - /* Basic Latin */ - 0x0061,0x031A, - /* Latin-1 Supplement */ - 0x00E0,0x0317, 0x00F8,0x0307, 0x00FF,0x0001,0x0178, - /* Latin Extended-A */ - 0x0100,0x0130, 0x0132,0x0106, 0x0139,0x0110, 0x014A,0x012E, 0x0179,0x0106, - /* Latin Extended-B */ - 0x0180,0x004D,0x0243,0x0181,0x0182,0x0182,0x0184,0x0184,0x0186,0x0187,0x0187,0x0189,0x018A,0x018B,0x018B,0x018D,0x018E,0x018F,0x0190,0x0191,0x0191,0x0193,0x0194,0x01F6,0x0196,0x0197,0x0198,0x0198,0x023D,0x019B,0x019C,0x019D,0x0220,0x019F,0x01A0,0x01A0,0x01A2,0x01A2,0x01A4,0x01A4,0x01A6,0x01A7,0x01A7,0x01A9,0x01AA,0x01AB,0x01AC,0x01AC,0x01AE,0x01AF,0x01AF,0x01B1,0x01B2,0x01B3,0x01B3,0x01B5,0x01B5,0x01B7,0x01B8,0x01B8,0x01BA,0x01BB,0x01BC,0x01BC,0x01BE,0x01F7,0x01C0,0x01C1,0x01C2,0x01C3,0x01C4,0x01C5,0x01C4,0x01C7,0x01C8,0x01C7,0x01CA,0x01CB,0x01CA, - 0x01CD,0x0110, 0x01DD,0x0001,0x018E, 0x01DE,0x0112, 0x01F3,0x0003,0x01F1,0x01F4,0x01F4, 0x01F8,0x0128, - 0x0222,0x0112, 0x023A,0x0009,0x2C65,0x023B,0x023B,0x023D,0x2C66,0x023F,0x0240,0x0241,0x0241, 0x0246,0x010A, - /* IPA Extensions */ - 0x0253,0x0040,0x0181,0x0186,0x0255,0x0189,0x018A,0x0258,0x018F,0x025A,0x0190,0x025C,0x025D,0x025E,0x025F,0x0193,0x0261,0x0262,0x0194,0x0264,0x0265,0x0266,0x0267,0x0197,0x0196,0x026A,0x2C62,0x026C,0x026D,0x026E,0x019C,0x0270,0x0271,0x019D,0x0273,0x0274,0x019F,0x0276,0x0277,0x0278,0x0279,0x027A,0x027B,0x027C,0x2C64,0x027E,0x027F,0x01A6,0x0281,0x0282,0x01A9,0x0284,0x0285,0x0286,0x0287,0x01AE,0x0244,0x01B1,0x01B2,0x0245,0x028D,0x028E,0x028F,0x0290,0x0291,0x01B7, - /* Greek, Coptic */ - 0x037B,0x0003,0x03FD,0x03FE,0x03FF, 0x03AC,0x0004,0x0386,0x0388,0x0389,0x038A, 0x03B1,0x0311, - 0x03C2,0x0002,0x03A3,0x03A3, 0x03C4,0x0308, 0x03CC,0x0003,0x038C,0x038E,0x038F, 0x03D8,0x0118, - 0x03F2,0x000A,0x03F9,0x03F3,0x03F4,0x03F5,0x03F6,0x03F7,0x03F7,0x03F9,0x03FA,0x03FA, - /* Cyrillic */ - 0x0430,0x0320, 0x0450,0x0710, 0x0460,0x0122, 0x048A,0x0136, 0x04C1,0x010E, 0x04CF,0x0001,0x04C0, 0x04D0,0x0144, - /* Armenian */ - 0x0561,0x0426, - - 0x0000 - }; - static const WCHAR cvt2[] = { /* U+1000 - U+FFFF */ - /* Phonetic Extensions */ - 0x1D7D,0x0001,0x2C63, - /* Latin Extended Additional */ - 0x1E00,0x0196, 0x1EA0,0x015A, - /* Greek Extended */ - 0x1F00,0x0608, 0x1F10,0x0606, 0x1F20,0x0608, 0x1F30,0x0608, 0x1F40,0x0606, - 0x1F51,0x0007,0x1F59,0x1F52,0x1F5B,0x1F54,0x1F5D,0x1F56,0x1F5F, 0x1F60,0x0608, - 0x1F70,0x000E,0x1FBA,0x1FBB,0x1FC8,0x1FC9,0x1FCA,0x1FCB,0x1FDA,0x1FDB,0x1FF8,0x1FF9,0x1FEA,0x1FEB,0x1FFA,0x1FFB, - 0x1F80,0x0608, 0x1F90,0x0608, 0x1FA0,0x0608, 0x1FB0,0x0004,0x1FB8,0x1FB9,0x1FB2,0x1FBC, - 0x1FCC,0x0001,0x1FC3, 0x1FD0,0x0602, 0x1FE0,0x0602, 0x1FE5,0x0001,0x1FEC, 0x1FF2,0x0001,0x1FFC, - /* Letterlike Symbols */ - 0x214E,0x0001,0x2132, - /* Number forms */ - 0x2170,0x0210, 0x2184,0x0001,0x2183, - /* Enclosed Alphanumerics */ - 0x24D0,0x051A, 0x2C30,0x042F, - /* Latin Extended-C */ - 0x2C60,0x0102, 0x2C67,0x0106, 0x2C75,0x0102, - /* Coptic */ - 0x2C80,0x0164, - /* Georgian Supplement */ - 0x2D00,0x0826, - /* Full-width */ - 0xFF41,0x031A, - - 0x0000 - }; - const WCHAR *p; - WCHAR bc, nc, cmd; - - - p = chr < 0x1000 ? cvt1 : cvt2; - for (;;) { - bc = *p++; /* Get block base */ - if (!bc || chr < bc) break; - nc = *p++; cmd = nc >> 8; nc &= 0xFF; /* Get processing command and block size */ - if (chr < bc + nc) { /* In the block? */ - switch (cmd) { - case 0: chr = p[chr - bc]; break; /* Table conversion */ - case 1: chr -= (chr - bc) & 1; break; /* Case pairs */ - case 2: chr -= 16; break; /* Shift -16 */ - case 3: chr -= 32; break; /* Shift -32 */ - case 4: chr -= 48; break; /* Shift -48 */ - case 5: chr -= 26; break; /* Shift -26 */ - case 6: chr += 8; break; /* Shift +8 */ - case 7: chr -= 80; break; /* Shift -80 */ - case 8: chr -= 0x1C60; break; /* Shift -0x1C60 */ - } - break; - } - if (!cmd) p += nc; - } - - return chr; -} - diff --git a/os/lib/fs/fat/option/unicode/ccsbcs.c b/os/lib/fs/fat/option/unicode/ccsbcs.c deleted file mode 100644 index c76376639..000000000 --- a/os/lib/fs/fat/option/unicode/ccsbcs.c +++ /dev/null @@ -1,388 +0,0 @@ -/*------------------------------------------------------------------------*/ -/* Unicode - Local code bidirectional converter (C)ChaN, 2015 */ -/* (SBCS code pages) */ -/*------------------------------------------------------------------------*/ -/* 437 U.S. -/ 720 Arabic -/ 737 Greek -/ 771 KBL -/ 775 Baltic -/ 850 Latin 1 -/ 852 Latin 2 -/ 855 Cyrillic -/ 857 Turkish -/ 860 Portuguese -/ 861 Icelandic -/ 862 Hebrew -/ 863 Canadian French -/ 864 Arabic -/ 865 Nordic -/ 866 Russian -/ 869 Greek 2 -*/ - -#include "../../ff.h" - - -#if _CODE_PAGE == 437 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP437(0x80-0xFF) to Unicode conversion table */ - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 720 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP720(0x80-0xFF) to Unicode conversion table */ - 0x0000, 0x0000, 0x00E9, 0x00E2, 0x0000, 0x00E0, 0x0000, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0651, 0x0652, 0x00F4, 0x00A4, 0x0640, 0x00FB, 0x00F9, 0x0621, 0x0622, 0x0623, 0x0624, 0x00A3, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x0641, 0x00B5, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A, - 0x2261, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0x0650, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 737 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP737(0x80-0xFF) to Unicode conversion table */ - 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, - 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, - 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03C9, 0x03AC, 0x03AD, 0x03AE, 0x03CA, 0x03AF, 0x03CC, 0x03CD, 0x03CB, 0x03CE, 0x0386, 0x0388, 0x0389, 0x038A, 0x038C, 0x038E, - 0x038F, 0x00B1, 0x2265, 0x2264, 0x03AA, 0x03AB, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 771 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP771(0x80-0xFF) to Unicode conversion table */ - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x2558, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x0104, 0x0105, 0x010C, 0x010D, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, - 0x0118, 0x0119, 0x0116, 0x0117, 0x012E, 0x012F, 0x0160, 0x0161, 0x0172, 0x0173, 0x016A, 0x016B, 0x017D, 0x017E, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 775 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP775(0x80-0xFF) to Unicode conversion table */ - 0x0106, 0x00FC, 0x00E9, 0x0101, 0x00E4, 0x0123, 0x00E5, 0x0107, 0x0142, 0x0113, 0x0156, 0x0157, 0x012B, 0x0179, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x014D, 0x00F6, 0x0122, 0x00A2, 0x015A, 0x015B, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x00A4, - 0x0100, 0x012A, 0x00F3, 0x017B, 0x017C, 0x017A, 0x201D, 0x00A6, 0x00A9, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x0141, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0104, 0x010C, 0x0118, 0x0116, 0x2563, 0x2551, 0x2557, 0x255D, 0x012E, 0x0160, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0172, 0x016A, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x017D, - 0x0105, 0x010D, 0x0119, 0x0117, 0x012F, 0x0161, 0x0173, 0x016B, 0x017E, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x00D3, 0x00DF, 0x014C, 0x0143, 0x00F5, 0x00D5, 0x00B5, 0x0144, 0x0136, 0x0137, 0x013B, 0x013C, 0x0146, 0x0112, 0x0145, 0x2019, - 0x00AD, 0x00B1, 0x201C, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x201E, 0x00B0, 0x2219, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 850 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP850(0x80-0xFF) to Unicode conversion table */ - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, - 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, - 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, - 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 852 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP852(0x80-0xFF) to Unicode conversion table */ - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x016F, 0x0107, 0x00E7, 0x0142, 0x00EB, 0x0150, 0x0151, 0x00EE, 0x0179, 0x00C4, 0x0106, - 0x00C9, 0x0139, 0x013A, 0x00F4, 0x00F6, 0x013D, 0x013E, 0x015A, 0x015B, 0x00D6, 0x00DC, 0x0164, 0x0165, 0x0141, 0x00D7, 0x010D, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x0104, 0x0105, 0x017D, 0x017E, 0x0118, 0x0119, 0x00AC, 0x017A, 0x010C, 0x015F, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x011A, 0x015E, 0x2563, 0x2551, 0x2557, 0x255D, 0x017B, 0x017C, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0102, 0x0103, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, - 0x0111, 0x0110, 0x010E, 0x00CB, 0x010F, 0x0147, 0x00CD, 0x00CE, 0x011B, 0x2518, 0x250C, 0x2588, 0x2584, 0x0162, 0x016E, 0x2580, - 0x00D3, 0x00DF, 0x00D4, 0x0143, 0x0144, 0x0148, 0x0160, 0x0161, 0x0154, 0x00DA, 0x0155, 0x0170, 0x00FD, 0x00DD, 0x0163, 0x00B4, - 0x00AD, 0x02DD, 0x02DB, 0x02C7, 0x02D8, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x02D9, 0x0171, 0x0158, 0x0159, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 855 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP855(0x80-0xFF) to Unicode conversion table */ - 0x0452, 0x0402, 0x0453, 0x0403, 0x0451, 0x0401, 0x0454, 0x0404, 0x0455, 0x0405, 0x0456, 0x0406, 0x0457, 0x0407, 0x0458, 0x0408, - 0x0459, 0x0409, 0x045A, 0x040A, 0x045B, 0x040B, 0x045C, 0x040C, 0x045E, 0x040E, 0x045F, 0x040F, 0x044E, 0x042E, 0x044A, 0x042A, - 0x0430, 0x0410, 0x0431, 0x0411, 0x0446, 0x0426, 0x0434, 0x0414, 0x0435, 0x0415, 0x0444, 0x0424, 0x0433, 0x0413, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0445, 0x0425, 0x0438, 0x0418, 0x2563, 0x2551, 0x2557, 0x255D, 0x0439, 0x0419, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x043A, 0x041A, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, - 0x043B, 0x041B, 0x043C, 0x041C, 0x043D, 0x041D, 0x043E, 0x041E, 0x043F, 0x2518, 0x250C, 0x2588, 0x2584, 0x041F, 0x044F, 0x2580, - 0x042F, 0x0440, 0x0420, 0x0441, 0x0421, 0x0442, 0x0422, 0x0443, 0x0423, 0x0436, 0x0416, 0x0432, 0x0412, 0x044C, 0x042C, 0x2116, - 0x00AD, 0x044B, 0x042B, 0x0437, 0x0417, 0x0448, 0x0428, 0x044D, 0x042D, 0x0449, 0x0429, 0x0447, 0x0427, 0x00A7, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 857 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP857(0x80-0xFF) to Unicode conversion table */ - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0131, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x0130, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x015E, 0x015F, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x011E, 0x011F, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, - 0x00BA, 0x00AA, 0x00CA, 0x00CB, 0x00C8, 0x0000, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, - 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x0000, 0x00D7, 0x00DA, 0x00DB, 0x00D9, 0x00EC, 0x00FF, 0x00AF, 0x00B4, - 0x00AD, 0x00B1, 0x0000, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 860 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP860(0x80-0xFF) to Unicode conversion table */ - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E3, 0x00E0, 0x00C1, 0x00E7, 0x00EA, 0x00CA, 0x00E8, 0x00CD, 0x00D4, 0x00EC, 0x00C3, 0x00C2, - 0x00C9, 0x00C0, 0x00C8, 0x00F4, 0x00F5, 0x00F2, 0x00DA, 0x00F9, 0x00CC, 0x00D5, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x20A7, 0x00D3, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00D2, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x2558, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 861 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP861(0x80-0xFF) to Unicode conversion table */ - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00D0, 0x00F0, 0x00DE, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00FE, 0x00FB, 0x00DD, 0x00FD, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00C1, 0x00CD, 0x00D3, 0x00DA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 862 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP862(0x80-0xFF) to Unicode conversion table */ - 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 863 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP863(0x80-0xFF) to Unicode conversion table */ - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00C2, 0x00E0, 0x00B6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x2017, 0x00C0, - 0x00C9, 0x00C8, 0x00CA, 0x00F4, 0x00CB, 0x00CF, 0x00FB, 0x00F9, 0x00A4, 0x00D4, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x00DB, 0x0192, - 0x00A6, 0x00B4, 0x00F3, 0x00FA, 0x00A8, 0x00BB, 0x00B3, 0x00AF, 0x00CE, 0x3210, 0x00AC, 0x00BD, 0x00BC, 0x00BE, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2219, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 864 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP864(0x80-0xFF) to Unicode conversion table */ - 0x00B0, 0x00B7, 0x2219, 0x221A, 0x2592, 0x2500, 0x2502, 0x253C, 0x2524, 0x252C, 0x251C, 0x2534, 0x2510, 0x250C, 0x2514, 0x2518, - 0x03B2, 0x221E, 0x03C6, 0x00B1, 0x00BD, 0x00BC, 0x2248, 0x00AB, 0x00BB, 0xFEF7, 0xFEF8, 0x0000, 0x0000, 0xFEFB, 0xFEFC, 0x0000, - 0x00A0, 0x00AD, 0xFE82, 0x00A3, 0x00A4, 0xFE84, 0x0000, 0x20AC, 0xFE8E, 0xFE8F, 0xFE95, 0xFE99, 0x060C, 0xFE9D, 0xFEA1, 0xFEA5, - 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669, 0xFED1, 0x061B, 0xFEB1, 0xFEB5, 0xFEB9, 0x061F, - 0x00A2, 0xFE80, 0xFE81, 0xFE83, 0xFE85, 0xFECA, 0xFE8B, 0xFE8D, 0xFE91, 0xFE93, 0xFE97, 0xFE9B, 0xFE9F, 0xFEA3, 0xFEA7, 0xFEA9, - 0xFEAB, 0xFEAD, 0xFEAF, 0xFEB3, 0xFEB7, 0xFEBB, 0xFEBF, 0xFEC1, 0xFEC5, 0xFECB, 0xFECF, 0x00A6, 0x00AC, 0x00F7, 0x00D7, 0xFEC9, - 0x0640, 0xFED3, 0xFED7, 0xFEDB, 0xFEDF, 0xFEE3, 0xFEE7, 0xFEEB, 0xFEED, 0xFEEF, 0xFEF3, 0xFEBD, 0xFECC, 0xFECE, 0xFECD, 0xFEE1, - 0xFE7D, 0x0651, 0xFEE5, 0xFEE9, 0xFEEC, 0xFEF0, 0xFEF2, 0xFED0, 0xFED5, 0xFEF5, 0xFEF6, 0xFEDD, 0xFED9, 0xFEF1, 0x25A0, 0x0000 -}; - -#elif _CODE_PAGE == 865 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP865(0x80-0xFF) to Unicode conversion table */ - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, - 0x00C5, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00A4, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x2558, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 866 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP866(0x80-0xFF) to Unicode conversion table */ - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, - 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0 -}; - -#elif _CODE_PAGE == 869 -#define _TBLDEF 1 -static -const WCHAR Tbl[] = { /* CP869(0x80-0xFF) to Unicode conversion table */ - 0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x0386, 0x00B7, 0x00B7, 0x00AC, 0x00A6, 0x2018, 0x2019, 0x0388, 0x2015, 0x0389, - 0x038A, 0x03AA, 0x038C, 0x00B7, 0x00B7, 0x038E, 0x03AB, 0x00A9, 0x038F, 0x00B2, 0x00B3, 0x03AC, 0x00A3, 0x03AD, 0x03AE, 0x03AF, - 0x03CA, 0x0390, 0x03CC, 0x03CD, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x00BD, 0x0398, 0x0399, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x039A, 0x039B, 0x039C, 0x039D, 0x2563, 0x2551, 0x2557, 0x255D, 0x039E, 0x039F, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0A30, 0x03A1, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x03A3, - 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03B1, 0x03B2, 0x03B3, 0x2518, 0x250C, 0x2588, 0x2584, 0x03B4, 0x03B5, 0x2580, - 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x0384, - 0x00AD, 0x00B1, 0x03C5, 0x03C6, 0x03C7, 0x00A7, 0x03C8, 0x0385, 0x00B0, 0x00A8, 0x03C9, 0x03CB, 0x03B0, 0x03CE, 0x25A0, 0x00A0 -}; - -#endif - - -#if !_TBLDEF || !_USE_LFN -#error This file is not needed at current configuration. Remove from the project. -#endif - - - - -WCHAR ff_convert ( /* Converted character, Returns zero on error */ - WCHAR chr, /* Character code to be converted */ - UINT dir /* 0: Unicode to OEM code, 1: OEM code to Unicode */ -) -{ - WCHAR c; - - - if (chr < 0x80) { /* ASCII */ - c = chr; - - } else { - if (dir) { /* OEM code to Unicode */ - c = (chr >= 0x100) ? 0 : Tbl[chr - 0x80]; - - } else { /* Unicode to OEM code */ - for (c = 0; c < 0x80; c++) { - if (chr == Tbl[c]) break; - } - c = (c + 0x80) & 0xFF; - } - } - - return c; -} - - - -WCHAR ff_wtoupper ( /* Returns upper converted character */ - WCHAR chr /* Unicode character to be upper converted (BMP only) */ -) -{ - /* Compressed upper conversion table */ - static const WCHAR cvt1[] = { /* U+0000 - U+0FFF */ - /* Basic Latin */ - 0x0061,0x031A, - /* Latin-1 Supplement */ - 0x00E0,0x0317, 0x00F8,0x0307, 0x00FF,0x0001,0x0178, - /* Latin Extended-A */ - 0x0100,0x0130, 0x0132,0x0106, 0x0139,0x0110, 0x014A,0x012E, 0x0179,0x0106, - /* Latin Extended-B */ - 0x0180,0x004D,0x0243,0x0181,0x0182,0x0182,0x0184,0x0184,0x0186,0x0187,0x0187,0x0189,0x018A,0x018B,0x018B,0x018D,0x018E,0x018F,0x0190,0x0191,0x0191,0x0193,0x0194,0x01F6,0x0196,0x0197,0x0198,0x0198,0x023D,0x019B,0x019C,0x019D,0x0220,0x019F,0x01A0,0x01A0,0x01A2,0x01A2,0x01A4,0x01A4,0x01A6,0x01A7,0x01A7,0x01A9,0x01AA,0x01AB,0x01AC,0x01AC,0x01AE,0x01AF,0x01AF,0x01B1,0x01B2,0x01B3,0x01B3,0x01B5,0x01B5,0x01B7,0x01B8,0x01B8,0x01BA,0x01BB,0x01BC,0x01BC,0x01BE,0x01F7,0x01C0,0x01C1,0x01C2,0x01C3,0x01C4,0x01C5,0x01C4,0x01C7,0x01C8,0x01C7,0x01CA,0x01CB,0x01CA, - 0x01CD,0x0110, 0x01DD,0x0001,0x018E, 0x01DE,0x0112, 0x01F3,0x0003,0x01F1,0x01F4,0x01F4, 0x01F8,0x0128, - 0x0222,0x0112, 0x023A,0x0009,0x2C65,0x023B,0x023B,0x023D,0x2C66,0x023F,0x0240,0x0241,0x0241, 0x0246,0x010A, - /* IPA Extensions */ - 0x0253,0x0040,0x0181,0x0186,0x0255,0x0189,0x018A,0x0258,0x018F,0x025A,0x0190,0x025C,0x025D,0x025E,0x025F,0x0193,0x0261,0x0262,0x0194,0x0264,0x0265,0x0266,0x0267,0x0197,0x0196,0x026A,0x2C62,0x026C,0x026D,0x026E,0x019C,0x0270,0x0271,0x019D,0x0273,0x0274,0x019F,0x0276,0x0277,0x0278,0x0279,0x027A,0x027B,0x027C,0x2C64,0x027E,0x027F,0x01A6,0x0281,0x0282,0x01A9,0x0284,0x0285,0x0286,0x0287,0x01AE,0x0244,0x01B1,0x01B2,0x0245,0x028D,0x028E,0x028F,0x0290,0x0291,0x01B7, - /* Greek, Coptic */ - 0x037B,0x0003,0x03FD,0x03FE,0x03FF, 0x03AC,0x0004,0x0386,0x0388,0x0389,0x038A, 0x03B1,0x0311, - 0x03C2,0x0002,0x03A3,0x03A3, 0x03C4,0x0308, 0x03CC,0x0003,0x038C,0x038E,0x038F, 0x03D8,0x0118, - 0x03F2,0x000A,0x03F9,0x03F3,0x03F4,0x03F5,0x03F6,0x03F7,0x03F7,0x03F9,0x03FA,0x03FA, - /* Cyrillic */ - 0x0430,0x0320, 0x0450,0x0710, 0x0460,0x0122, 0x048A,0x0136, 0x04C1,0x010E, 0x04CF,0x0001,0x04C0, 0x04D0,0x0144, - /* Armenian */ - 0x0561,0x0426, - - 0x0000 - }; - static const WCHAR cvt2[] = { /* U+1000 - U+FFFF */ - /* Phonetic Extensions */ - 0x1D7D,0x0001,0x2C63, - /* Latin Extended Additional */ - 0x1E00,0x0196, 0x1EA0,0x015A, - /* Greek Extended */ - 0x1F00,0x0608, 0x1F10,0x0606, 0x1F20,0x0608, 0x1F30,0x0608, 0x1F40,0x0606, - 0x1F51,0x0007,0x1F59,0x1F52,0x1F5B,0x1F54,0x1F5D,0x1F56,0x1F5F, 0x1F60,0x0608, - 0x1F70,0x000E,0x1FBA,0x1FBB,0x1FC8,0x1FC9,0x1FCA,0x1FCB,0x1FDA,0x1FDB,0x1FF8,0x1FF9,0x1FEA,0x1FEB,0x1FFA,0x1FFB, - 0x1F80,0x0608, 0x1F90,0x0608, 0x1FA0,0x0608, 0x1FB0,0x0004,0x1FB8,0x1FB9,0x1FB2,0x1FBC, - 0x1FCC,0x0001,0x1FC3, 0x1FD0,0x0602, 0x1FE0,0x0602, 0x1FE5,0x0001,0x1FEC, 0x1FF2,0x0001,0x1FFC, - /* Letterlike Symbols */ - 0x214E,0x0001,0x2132, - /* Number forms */ - 0x2170,0x0210, 0x2184,0x0001,0x2183, - /* Enclosed Alphanumerics */ - 0x24D0,0x051A, 0x2C30,0x042F, - /* Latin Extended-C */ - 0x2C60,0x0102, 0x2C67,0x0106, 0x2C75,0x0102, - /* Coptic */ - 0x2C80,0x0164, - /* Georgian Supplement */ - 0x2D00,0x0826, - /* Full-width */ - 0xFF41,0x031A, - - 0x0000 - }; - const WCHAR *p; - WCHAR bc, nc, cmd; - - - p = chr < 0x1000 ? cvt1 : cvt2; - for (;;) { - bc = *p++; /* Get block base */ - if (!bc || chr < bc) break; - nc = *p++; cmd = nc >> 8; nc &= 0xFF; /* Get processing command and block size */ - if (chr < bc + nc) { /* In the block? */ - switch (cmd) { - case 0: chr = p[chr - bc]; break; /* Table conversion */ - case 1: chr -= (chr - bc) & 1; break; /* Case pairs */ - case 2: chr -= 16; break; /* Shift -16 */ - case 3: chr -= 32; break; /* Shift -32 */ - case 4: chr -= 48; break; /* Shift -48 */ - case 5: chr -= 26; break; /* Shift -26 */ - case 6: chr += 8; break; /* Shift +8 */ - case 7: chr -= 80; break; /* Shift -80 */ - case 8: chr -= 0x1C60; break; /* Shift -0x1C60 */ - } - break; - } - if (!cmd) p += nc; - } - - return chr; -} - diff --git a/os/lib/heapmem.c b/os/lib/heapmem.c deleted file mode 100644 index 7a90f1357..000000000 --- a/os/lib/heapmem.c +++ /dev/null @@ -1,508 +0,0 @@ -/* - * Copyright (c) 2005, Nicolas Tsiftes - * 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 author nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 - * Dynamic memory allocation module. - * \author - * Nicolas Tsiftes - */ - -#ifndef DEBUG -#define DEBUG 0 -#endif - -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#undef HEAPMEM_DEBUG -#define HEAPMEM_DEBUG 1 -#else -#define PRINTF(...) -#endif - -#ifdef PROJECT_CONF_PATH -/* Load the heapmem configuration from a project configuration file. */ -#include PROJECT_CONF_PATH -#endif - -#include -#include - -#include "heapmem.h" - -/* The HEAPMEM_CONF_ARENA_SIZE parameter determines the size of the - space that will be statically allocated in this module. */ -#ifdef HEAPMEM_CONF_ARENA_SIZE -#define HEAPMEM_ARENA_SIZE HEAPMEM_CONF_ARENA_SIZE -#else -/* If the heap size is not set, we use a minimal size that will ensure - that all allocation attempts fail. */ -#define HEAPMEM_ARENA_SIZE 1 -#endif -/* HEAPMEM_CONF_ARENA_SIZE */ - -/* - * The HEAPMEM_CONF_SEARCH_MAX parameter limits the time spent on - * chunk allocation and defragmentation. The lower this number is, the - * faster the operations become. The cost of this speedup, however, is - * that the space overhead might increase. - */ -#ifdef HEAPMEM_CONF_SEARCH_MAX -#define CHUNK_SEARCH_MAX HEAPMEM_CONF_SEARCH_MAX -#else -#define CHUNK_SEARCH_MAX 16 -#endif /* HEAPMEM_CONF_SEARCH_MAX */ - -/* - * The HEAPMEM_CONF_REALLOC parameter determines whether heapmem_realloc() is - * enabled (non-zero value) or not (zero value). - */ -#ifdef HEAPMEM_CONF_REALLOC -#define HEAPMEM_REALLOC HEAPMEM_CONF_REALLOC -#else -#define HEAPMEM_REALLOC 1 -#endif /* HEAPMEM_CONF_REALLOC */ - -/* - * The HEAPMEM_CONF_ALIGNMENT parameter decides what the minimum alignment - * for allocated data should be. - */ -#ifdef HEAPMEM_CONF_ALIGNMENT -#define HEAPMEM_ALIGNMENT HEAPMEM_CONF_ALIGNMENT -#else -#define HEAPMEM_ALIGNMENT sizeof(int) -#endif /* HEAPMEM_CONF_ALIGNMENT */ - -#define ALIGN(size) \ - (((size) + (HEAPMEM_ALIGNMENT - 1)) & ~(HEAPMEM_ALIGNMENT - 1)) - -/* Macros for chunk iteration. */ -#define NEXT_CHUNK(chunk) \ - ((chunk_t *)((char *)(chunk) + sizeof(chunk_t) + (chunk)->size)) -#define IS_LAST_CHUNK(chunk) \ - ((char *)NEXT_CHUNK(chunk) == &heap_base[heap_usage]) - -/* Macros for retrieving the data pointer from a chunk, - and the other way around. */ -#define GET_CHUNK(ptr) \ - ((chunk_t *)((char *)(ptr) - sizeof(chunk_t))) -#define GET_PTR(chunk) \ - (char *)((chunk) + 1) - -/* Macros for determining the status of a chunk. */ -#define CHUNK_FLAG_ALLOCATED 0x1 - -#define CHUNK_ALLOCATED(chunk) \ - ((chunk)->flags & CHUNK_FLAG_ALLOCATED) -#define CHUNK_FREE(chunk) \ - (~(chunk)->flags & CHUNK_FLAG_ALLOCATED) - -/* - * We use a double-linked list of chunks, with a slight space overhead compared - * to a single-linked list, but with the advantage of having much faster - * list removals. - */ -typedef struct chunk { - struct chunk *prev; - struct chunk *next; - size_t size; - uint8_t flags; -#if HEAPMEM_DEBUG - const char *file; - unsigned line; -#endif -} chunk_t; - -/* All allocated space is located within an "heap", which is statically - allocated with a pre-configured size. */ -static char heap_base[HEAPMEM_ARENA_SIZE]; -static size_t heap_usage; - -static chunk_t *first_chunk = (chunk_t *)heap_base; -static chunk_t *free_list; - -/* extend_space: Increases the current footprint used in the heap, and - returns a pointer to the old end. */ -static void * -extend_space(size_t size) -{ - char *old_usage; - - if(heap_usage + size > HEAPMEM_ARENA_SIZE) { - return NULL; - } - - old_usage = &heap_base[heap_usage]; - heap_usage += size; - - return old_usage; -} - -/* free_chunk: Mark a chunk as being free, and put it on the free list. */ -static void -free_chunk(chunk_t * const chunk) -{ - chunk->flags &= ~CHUNK_FLAG_ALLOCATED; - - if(IS_LAST_CHUNK(chunk)) { - /* Release the chunk back into the wilderness. */ - heap_usage -= sizeof(chunk_t) + chunk->size; - } else { - /* Put the chunk on the free list. */ - chunk->prev = NULL; - chunk->next = free_list; - if(free_list != NULL) { - free_list->prev = chunk; - } - free_list = chunk; - } -} - -/* allocate_chunk: Mark a chunk as being allocated, and remove it - from the free list. */ -static void -allocate_chunk(chunk_t * const chunk) -{ - chunk->flags |= CHUNK_FLAG_ALLOCATED; - - if(chunk == free_list) { - free_list = chunk->next; - if(free_list != NULL) { - free_list->prev = NULL; - } - } else { - chunk->prev->next = chunk->next; - } - - if(chunk->next != NULL) { - chunk->next->prev = chunk->prev; - } -} - -/* - * split_chunk: When allocating a chunk, we may have found one that is - * larger than needed, so this function is called to keep the rest of - * the original chunk free. - */ -static void -split_chunk(chunk_t * const chunk, size_t offset) -{ - chunk_t *new_chunk; - - offset = ALIGN(offset); - - if(offset + sizeof(chunk_t) < chunk->size) { - new_chunk = (chunk_t *)(GET_PTR(chunk) + offset); - new_chunk->size = chunk->size - sizeof(chunk_t) - offset; - new_chunk->flags = 0; - free_chunk(new_chunk); - - chunk->size = offset; - chunk->next = chunk->prev = NULL; - } -} - -/* coalesce_chunks: Coalesce a specific free chunk with as many adjacent - free chunks as possible. */ -static void -coalesce_chunks(chunk_t *chunk) -{ - chunk_t *next; - - for(next = NEXT_CHUNK(chunk); - (char *)next < &heap_base[heap_usage] && CHUNK_FREE(next); - next = NEXT_CHUNK(next)) { - chunk->size += sizeof(chunk_t) + next->size; - allocate_chunk(next); - } -} - -/* defrag_chunks: Scan the free list for chunks that can be coalesced, - and stop within a bounded time. */ -static void -defrag_chunks(void) -{ - int i; - chunk_t *chunk; - - /* Limit the time we spend on searching the free list. */ - i = CHUNK_SEARCH_MAX; - for(chunk = free_list; chunk != NULL; chunk = chunk->next) { - if(i-- == 0) { - break; - } - coalesce_chunks(chunk); - } -} - -/* get_free_chunk: Search the free list for the most suitable chunk, as - determined by its size, to satisfy an allocation request. */ -static chunk_t * -get_free_chunk(const size_t size) -{ - int i; - chunk_t *chunk, *best; - - /* Defragment chunks only right before they are needed for allocation. */ - defrag_chunks(); - - best = NULL; - /* Limit the time we spend on searching the free list. */ - i = CHUNK_SEARCH_MAX; - for(chunk = free_list; chunk != NULL; chunk = chunk->next) { - if(i-- == 0) { - break; - } - - /* - * To avoid fragmenting large chunks, we select the chunk with the - * smallest size that is larger than or equal to the requested size. - */ - if(size <= chunk->size) { - if(best == NULL || chunk->size < best->size) { - best = chunk; - } - if(best->size == size) { - /* We found a perfect chunk -- stop the search. */ - break; - } - } - } - - if(best != NULL) { - /* We found a chunk for the allocation. Split it if necessary. */ - allocate_chunk(best); - split_chunk(best, size); - } - - return best; -} - -/* - * heapmem_alloc: Allocate an object of the specified size, returning - * a pointer to it in case of success, and NULL in case of failure. - * - * When allocating memory, heapmem_alloc() will first try to find a - * free chunk of the same size and the requested one. If none can be - * find, we pick a larger chunk that is as close in size as possible, - * and possibly split it so that the remaining part becomes a chunk - * available for allocation. At most CHUNK_SEARCH_MAX chunks on the - * free list will be examined. - * - * As a last resort, heapmem_alloc() will try to extend the heap - * space, and thereby create a new chunk available for use. - */ -void * -#if HEAPMEM_DEBUG -heapmem_alloc_debug(size_t size, const char *file, const unsigned line) -#else -heapmem_alloc(size_t size) -#endif -{ - chunk_t *chunk; - - size = ALIGN(size); - - chunk = get_free_chunk(size); - if(chunk == NULL) { - chunk = extend_space(sizeof(chunk_t) + size); - if(chunk == NULL) { - return NULL; - } - chunk->size = size; - } - - chunk->flags = CHUNK_FLAG_ALLOCATED; - -#if HEAPMEM_DEBUG - chunk->file = file; - chunk->line = line; -#endif - - PRINTF("%s ptr %p size %lu\n", __func__, GET_PTR(chunk), (unsigned long)size); - - return GET_PTR(chunk); -} - -/* - * heapmem_free: Deallocate a previously allocated object. - * - * The pointer must exactly match one returned from an earlier call - * from heapmem_alloc or heapmem_realloc, without any call to - * heapmem_free in between. - * - * When performing a deallocation of a chunk, the chunk will be put on - * a list of free chunks internally. All free chunks that are adjacent - * in memory will be merged into a single chunk in order to mitigate - * fragmentation. - */ -void -#if HEAPMEM_DEBUG -heapmem_free_debug(void *ptr, const char *file, const unsigned line) -#else -heapmem_free(void *ptr) -#endif -{ - chunk_t *chunk; - - if(ptr) { - chunk = GET_CHUNK(ptr); - - PRINTF("%s ptr %p, allocated at %s:%u\n", __func__, ptr, - chunk->file, chunk->line); - - free_chunk(chunk); - } -} - -#if HEAPMEM_REALLOC -/* - * heapmem_realloc: Reallocate an object with a different size, - * possibly moving it in memory. In case of success, the function - * returns a pointer to the objects new location. In case of failure, - * it returns NULL. - * - * If the size of the new chunk is larger than that of the allocated - * chunk, heapmem_realloc() will first attempt to extend the currently - * allocated chunk. If that memory is not free, heapmem_ralloc() will - * attempt to allocate a completely new chunk, copy the old data to - * the new chunk, and deallocate the old chunk. - * - * If the size of the new chunk is smaller than the allocated one, we - * split the allocated chunk if the remaining chunk would be large - * enough to justify the overhead of creating a new chunk. - */ -void * -#if HEAPMEM_DEBUG -heapmem_realloc_debug(void *ptr, size_t size, - const char *file, const unsigned line) -#else -heapmem_realloc(void *ptr, size_t size) -#endif -{ - void *newptr; - chunk_t *chunk; - int size_adj; - - PRINTF("%s ptr %p size %u at %s:%u\n", - __func__, ptr, (unsigned)size, file, line); - - /* Special cases in which we can hand off the execution to other functions. */ - if(ptr == NULL) { - return heapmem_alloc(size); - } else if(size == 0) { - heapmem_free(ptr); - return NULL; - } - - chunk = GET_CHUNK(ptr); -#if HEAPMEM_DEBUG - chunk->file = file; - chunk->line = line; -#endif - - size = ALIGN(size); - size_adj = size - chunk->size; - - if(size_adj <= 0) { - /* Request to make the object smaller or to keep its size. - In the former case, the chunk will be split if possible. */ - split_chunk(chunk, size); - return ptr; - } - - /* Request to make the object larger. (size_adj > 0) */ - if(IS_LAST_CHUNK(chunk)) { - /* - * If the object is within the last allocated chunk (i.e., the - * one before the end of the heap footprint, we just attempt to - * extend the heap. - */ - if(extend_space(size_adj) != NULL) { - chunk->size = size; - return ptr; - } - } else { - /* - * Here we attempt to enlarge an allocated object, whose - * adjacent space may already be allocated. We attempt to - * coalesce chunks in order to make as much room as possible. - */ - coalesce_chunks(chunk); - if(chunk->size >= size) { - /* There was enough free adjacent space to extend the chunk in - its current place. */ - split_chunk(chunk, size); - return ptr; - } - } - - /* - * Failed to enlarge the object in its current place, since the - * adjacent chunk is allocated. Hence, we try to place the new - * object elsewhere in the heap, and remove the old chunk that was - * holding it. - */ - newptr = heapmem_alloc(size); - if(newptr == NULL) { - return NULL; - } - - memcpy(newptr, ptr, chunk->size); - free_chunk(chunk); - - return newptr; -} -#endif /* HEAPMEM_REALLOC */ - -/* heapmem_stats: Calculate statistics regarding memory usage. */ -void -heapmem_stats(heapmem_stats_t *stats) -{ - chunk_t *chunk; - - memset(stats, 0, sizeof(*stats)); - - for(chunk = first_chunk; - (char *)chunk < &heap_base[heap_usage]; - chunk = NEXT_CHUNK(chunk)) { - if(CHUNK_ALLOCATED(chunk)) { - stats->allocated += chunk->size; - } else { - coalesce_chunks(chunk); - stats->available += chunk->size; - } - stats->overhead += sizeof(chunk_t); - } - stats->available += HEAPMEM_ARENA_SIZE - heap_usage; - stats->footprint = heap_usage; - stats->chunks = stats->overhead / sizeof(chunk_t); -} diff --git a/os/lib/heapmem.h b/os/lib/heapmem.h deleted file mode 100644 index 1f7b7a713..000000000 --- a/os/lib/heapmem.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2005, Nicolas Tsiftes - * 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 author nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - */ - -/** - * \addtogroup mem - * @{ - */ - -/** - * \defgroup heapmem heapmem: Dynamic heap memory allocator - * - * The heapmem module is a dynamic heap memory allocator similar to - * malloc() in standard C. The heap memory is managed in a block of - * static memory, whose size is determined at compile-time by setting - * HEAPMEM_CONF_ARENA_SIZE parameter. By default, the heap memory is - * only 1 bytes, which entails that this parameter must be set - * explicitly in order to be possible to use this module. - * - * Each allocated memory object is referred to as a "chunk". The - * allocator manages free chunks in a double-linked list. While this - * adds some memory overhead compared to a single-linked list, it - * improves the performance of list management. - * - * Internally, allocated chunks can be retrieved using the pointer to - * the allocated memory returned by heapmem_alloc() and - * heapmem_realloc(), because the chunk structure immediately precedes - * the memory of the chunk. - * - * \note This module does not contain a corresponding function to the - * standard C function calloc(). - * - * \note Dynamic memory should be used carefully on - * memory-constrained, embedded systems, because fragmentation - * may be induced through various allocation/deallocation - * patterns, and no guarantees are given regarding the - * availability of memory. - * - * @{ - */ - -/** - * \file - * Header file for the dynamic heap memory allocator. - * \author - * Nicolas Tsiftes - */ - -#ifndef HEAPMEM_H -#define HEAPMEM_H - -#include - -typedef struct heapmem_stats { - size_t allocated; - size_t overhead; - size_t available; - size_t footprint; - size_t chunks; -} heapmem_stats_t; - -#if HEAPMEM_DEBUG - -#define heapmem_alloc(size) heapmem_alloc_debug((size), __FILE__, __LINE__) -#define heapmem_realloc(ptr, size) heapmem_realloc_debug((ptr), (size), __FILE__, __LINE__) -#define heapmem_free(ptr) heapmem_free_debug((ptr), __FILE__, __LINE__) - -void *heapmem_alloc_debug(size_t size, - const char *file, const unsigned line); -void *heapmem_realloc_debug(void *ptr, size_t size, - const char *file, const unsigned line); -void heapmem_free_debug(void *ptr, - const char *file, const unsigned line); - -#else - -/** - * \brief Allocate a chunk of memory in the heap. - * \param size The number of bytes to allocate. - * \return A pointer to the allocated memory chunk, - * or NULL if the allocation failed. - * - * \sa heapmem_realloc - * \sa heapmem_free - */ - -void *heapmem_alloc(size_t size); - -/** - * \brief Reallocate a chunk of memory in the heap. - * \param ptr A pointer to a chunk that has been allocated using - * heapmem_alloc() or heapmem_realloc(). - * \param size The number of bytes to allocate. - * \return A pointer to the allocated memory chunk, - * or NULL if the allocation failed. - * - * \note If ptr is NULL, this function behaves the same as heapmem_alloc. - * \note If ptr is not NULL and size is zero, the function deallocates - * the chunk and returns NULL. - * - * \sa heapmem_alloc - * \sa heapmem_free - */ - -void *heapmem_realloc(void *ptr, size_t size); - -/** - * \brief Deallocate a chunk of memory. - * \param ptr A pointer to a chunk that has been allocated using - * heapmem_alloc() or heapmem_realloc(). - * - * \note If ptr is NULL, this function will return immediately without - * without performing any action. - * - * \sa heapmem_alloc - * \sa heapmem_realloc - */ - -void heapmem_free(void *ptr); - -#endif /* HEAMMEM_DEBUG */ - -/** - * \brief Obtain internal heapmem statistics regarding the - * allocated chunks. - * \param stats A pointer to an object of type heapmem_stats_t, which - * will be filled when calling this function. - * - * This function makes it possible to gain visibility into the internal - * structure of the heap. One can thus obtain information regarding - * the amount of memory allocated, overhead used for memory management, - * and the number of chunks allocated. By using this information, developers - * can tune their software to use the heapmem allocator more efficiently. - * - */ - -void heapmem_stats(heapmem_stats_t *stats); - -#endif /* !HEAPMEM_H */ - -/** @} */ -/** @} */ diff --git a/os/lib/ifft.c b/os/lib/ifft.c deleted file mode 100644 index 3c0faee37..000000000 --- a/os/lib/ifft.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * ----------------------------------------------------------------- - * ifft - Integer FFT (fast fourier transform) library - * - * - * Author : Joakim Eriksson - * Created : 2008-03-27 - * Updated : $Date: 2008/07/03 23:40:12 $ - * $Revision: 1.3 $ - */ - -#include "contiki.h" -#include "lib/ifft.h" - -/*---------------------------------------------------------------------------*/ -/* constant table of sin values in 8/7 bits resolution */ -/* NOTE: symmetry can be used to reduce this to 1/2 or 1/4 the size */ -#define SIN_TAB_LEN 120 -#define RESOLUTION 7 - -static const int8_t SIN_TAB[] = { - 0,6,13,20,26,33,39,45,52,58,63,69,75,80, - 85,90,95,99,103,107,110,114,116,119,121, - 123,125,126,127,127,127,127,127,126,125, - 123,121,119,116,114,110,107,103,99,95,90, - 85,80,75,69,63,58,52,45,39,33,26,20,13,6, - 0,-6,-13,-20,-26,-33,-39,-45,-52,-58,-63, - -69,-75,-80,-85,-90,-95,-99,-103,-107,-110, - -114,-116,-119,-121,-123,-125,-126,-127,-127, - -127,-127,-127,-126,-125,-123,-121,-119,-116, - -114,-110,-107,-103,-99,-95,-90,-85,-80,-75, - -69,-63,-58,-52,-45,-39,-33,-26,-20,-13,-6 -}; - - -static uint16_t bitrev(uint16_t j, uint16_t nu) -{ - uint16_t k; - k = 0; - for (; nu > 0; nu--) { - k = (k << 1) + (j & 1); - j = j >> 1; - } - return k; -} - - -/* Non interpolating sine... which takes an angle of 0 - 999 */ -static int16_t sinI(uint16_t angleMilli) -{ - uint16_t pos; - pos = (uint16_t) ((SIN_TAB_LEN * (uint32_t) angleMilli) / 1000); - return SIN_TAB[pos % SIN_TAB_LEN]; -} - -static int16_t cosI(uint16_t angleMilli) -{ - return sinI(angleMilli + 250); -} - -static uint16_t ilog2(uint16_t val) -{ - uint16_t log; - log = 0; - val = val >> 1; /* The 20 = 1 => log = 0 => val = 0 */ - while (val > 0) { - val = val >> 1; - log++; - } - return log; -} - - -/* ifft(xre[], n) - integer (fixpoint) version of Fast Fourier Transform - An integer version of FFT that takes in-samples in an int16_t array - and does an fft on n samples in the array. - The result of the FFT is stored in the same array as the samples - was stored. Them imaginary part of the result is stored in xim which - needs to be of the same size as xre (e.g. n ints). - - Note: This fft is designed to be used with 8 bit values (e.g. not - 16 bit values). The reason for the int16_t array is for keeping some - 'room' for the calculations. It is also designed for doing fairly small - FFT:s since to large sample arrays might cause it to overflow during - calculations. -*/ -void -ifft(int16_t xre[], int16_t xim[], uint16_t n) -{ - uint16_t nu; - uint16_t n2; - uint16_t nu1; - int p, k, l, i; - int32_t c, s, tr, ti; - - nu = ilog2(n); - nu1 = nu - 1; - n2 = n / 2; - - for (i = 0; i < n; i++) - xim[i] = 0; - - for (l = 1; l <= nu; l++) { - for (k = 0; k < n; k += n2) { - for (i = 1; i <= n2; i++) { - p = bitrev(k >> nu1, nu); - c = cosI((1000 * p) / n); - s = sinI((1000 * p) / n); - - tr = ((xre[k + n2] * c + xim[k + n2] * s) >> RESOLUTION); - ti = ((xim[k + n2] * c - xre[k + n2] * s) >> RESOLUTION); - - xre[k + n2] = xre[k] - tr; - xim[k + n2] = xim[k] - ti; - xre[k] += tr; - xim[k] += ti; - k++; - } - } - nu1--; - n2 = n2 / 2; - } - - for (k = 0; k < n; k++) { - p = bitrev(k, nu); - if (p > k) { - n2 = xre[k]; - xre[k] = xre[p]; - xre[p] = n2; - - n2 = xim[k]; - xim[k] = xim[p]; - xim[p] = n2; - } - } - - /* This is a fast but not 100% correct magnitude calculation */ - /* Should be sqrt(xre[i]^2 + xim[i]^2) and normalized with div. by n */ - for (i = 0, n2 = n / 2; i < n2; i++) { - xre[i] = (ABS(xre[i]) + ABS(xim[i])); - } -} diff --git a/os/lib/ifft.h b/os/lib/ifft.h deleted file mode 100644 index f59878e01..000000000 --- a/os/lib/ifft.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * ----------------------------------------------------------------- - * ifft - Integer FFT (fast fourier transform) library - * - * - * - * Author : Joakim Eriksson - * Created : 2008-03-27 - * Updated : $Date: 2008/04/25 22:12:25 $ - * $Revision: 1.2 $ - */ - -#ifndef IFFT_H -#define IFFT_H -#include "contiki.h" - -/* ifft(xre[], n) - integer (fixpoint) version of Fast Fourier Transform - An integer version of FFT that takes in-samples in an int16_t array - and does an fft on n samples in the array. - The result of the FFT is stored in the same array as the samples - was stored. - - Note: This fft is designed to be used with 8 bit values (e.g. not - 16 bit values). The reason for the int16_t array is for keeping some - 'room' for the calculations. It is also designed for doing fairly small - FFT:s since to large sample arrays might cause it to overflow during - calculations. -*/ -void ifft(int16_t xre[], int16_t xim[], uint16_t n); - -#endif /* IFFT_H */ diff --git a/os/lib/json/json.h b/os/lib/json/json.h deleted file mode 100644 index e4d7094c6..000000000 --- a/os/lib/json/json.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2011-2012, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * A few JSON defines used for parsing and generating JSON. - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef JSON_H_ -#define JSON_H_ - -#define JSON_TYPE_ARRAY '[' -#define JSON_TYPE_OBJECT '{' -#define JSON_TYPE_PAIR ':' -#define JSON_TYPE_PAIR_NAME 'N' /* for N:V pairs */ -#define JSON_TYPE_STRING '"' -#define JSON_TYPE_UINT 'U' -#define JSON_TYPE_INT 'I' -#define JSON_TYPE_NUMBER '0' -#define JSON_TYPE_ERROR 0 - -/* how should we handle null vs false - both can be 0? */ -#define JSON_TYPE_NULL 'n' -#define JSON_TYPE_TRUE 't' -#define JSON_TYPE_FALSE 'f' - -#define JSON_TYPE_CALLBACK 'C' - -/* integer pointer types */ -#define JSON_TYPE_S8PTR 'b' -#define JSON_TYPE_U8PTR 'B' -#define JSON_TYPE_S16PTR 'w' -#define JSON_TYPE_U16PTR 'W' -#define JSON_TYPE_S32PTR 'd' -#define JSON_TYPE_U32PTR 'D' - -enum { - JSON_ERROR_OK, - JSON_ERROR_SYNTAX, - JSON_ERROR_UNEXPECTED_ARRAY, - JSON_ERROR_UNEXPECTED_END_OF_ARRAY, - JSON_ERROR_UNEXPECTED_OBJECT, - JSON_ERROR_UNEXPECTED_END_OF_OBJECT, - JSON_ERROR_UNEXPECTED_STRING -}; - -#define JSON_CONTENT_TYPE "application/json" - -#endif /* JSON_H_ */ diff --git a/os/lib/json/jsonparse.c b/os/lib/json/jsonparse.c deleted file mode 100644 index 941420521..000000000 --- a/os/lib/json/jsonparse.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (c) 2011-2012, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -#include "jsonparse.h" -#include -#include -#include - -/*--------------------------------------------------------------------*/ -static bool -push(struct jsonparse_state *state, char c) -{ - if(state->depth < JSONPARSE_MAX_DEPTH) { - state->stack[state->depth] = c; - state->depth++; - state->vtype = 0; - return true; - } else { - return false; - } -} -/*--------------------------------------------------------------------*/ -static bool -modify(struct jsonparse_state *state, char c) -{ - if(state->depth > 0) { - state->stack[state->depth - 1] = c; - return true; - } else { - return false; - } -} -/*--------------------------------------------------------------------*/ -static bool -pop(struct jsonparse_state *state) -{ - if(state->depth == 0) { - return false; - } - state->depth--; - state->vtype = state->stack[state->depth]; - return true; -} -/*--------------------------------------------------------------------*/ -/* will pass by the value and store the start and length of the value for - atomic types */ -/*--------------------------------------------------------------------*/ -static char -atomic(struct jsonparse_state *state, char type) -{ - char c; - const char *str; - int len; - - state->vstart = state->pos; - if(type == JSON_TYPE_STRING || type == JSON_TYPE_PAIR_NAME) { - while((c = state->json[state->pos++]) && c != '"') { - if(c == '\\') { - state->pos++; /* skip current char */ - } - } - if (c != '"') { - state->error = JSON_ERROR_SYNTAX; - return JSON_TYPE_ERROR; - } - state->vlen = state->pos - state->vstart - 1; - } else if(type == JSON_TYPE_NUMBER) { - do { - c = state->json[state->pos]; - if((c < '0' || c > '9') && c != '.') { - c = 0; - } else { - state->pos++; - } - } while(c); - /* need to back one step since first char is already gone */ - state->vstart--; - state->vlen = state->pos - state->vstart; - } else if(type == JSON_TYPE_NULL || type == JSON_TYPE_TRUE || type == JSON_TYPE_FALSE) { - state->vstart--; - switch (type) { - case JSON_TYPE_NULL: str = "null"; break; - case JSON_TYPE_TRUE: str = "true"; break; - case JSON_TYPE_FALSE: str = "false"; break; - default: str = ""; break; - } - - while ((c = state->json[state->pos]) && c != ' ' && c != ',' && c != ']' && c != '}') { - state->pos++; - } - - state->vlen = state->pos - state->vstart; - len = strlen(str); - len = state->vlen > len ? state->vlen : len; - - if (strncmp(str, &state->json[state->vstart], len) != 0) { - state->error = JSON_ERROR_SYNTAX; - return JSON_TYPE_ERROR; - } - } - - state->vtype = type; - return state->vtype; -} -/*--------------------------------------------------------------------*/ -static void -skip_ws(struct jsonparse_state *state) -{ - char c; - - while(state->pos < state->len && - ((c = state->json[state->pos]) == ' ' || c == '\n')) { - state->pos++; - } -} -/*--------------------------------------------------------------------*/ -static bool -is_atomic(struct jsonparse_state *state) -{ - char v = state->vtype; - return v == 'N' || v == '"' || v == '0' || v == 'n' || v == 't' || v == 'f'; -} -/*--------------------------------------------------------------------*/ -void -jsonparse_setup(struct jsonparse_state *state, const char *json, int len) -{ - state->json = json; - state->len = len; - state->pos = 0; - state->depth = 0; - state->error = 0; - state->vtype = 0; - state->stack[0] = 0; -} -/*--------------------------------------------------------------------*/ -int -jsonparse_next(struct jsonparse_state *state) -{ - char c; - char s; - char v; - bool ret; - - skip_ws(state); - c = state->json[state->pos]; - s = jsonparse_get_type(state); - v = state->vtype; - state->pos++; - - switch(c) { - case '{': - if((s == 0 && v == 0) || s == '[' || s == ':') { - if(push(state, c)) { - return c; - } - } - state->error = JSON_ERROR_UNEXPECTED_OBJECT; - return JSON_TYPE_ERROR; - case '}': - if((s == ':' && v != ',' && v != 0 ) || (s == '{' && v == 0)) { - if(pop(state)) { - return c; - } - } - state->error = JSON_ERROR_UNEXPECTED_END_OF_OBJECT; - return JSON_TYPE_ERROR; - case ']': - if(s == '[' && v != ',') { - if(pop(state)) { - return c; - } - } - state->error = JSON_ERROR_UNEXPECTED_END_OF_ARRAY; - return JSON_TYPE_ERROR; - case ':': - if(s == '{' && v == 'N') { - ret = modify(state, ':'); - state->vtype = 0; - if(ret) { - return jsonparse_next(state); - } - } - state->error = JSON_ERROR_SYNTAX; - return JSON_TYPE_ERROR; - case ',': - if(s == ':' && v != 0) { - ret = modify(state, '{'); - state->vtype = c; - if(ret) { - return c; - } - } else if(s == '[') { - state->vtype = c; - return c; - } - state->error = JSON_ERROR_SYNTAX; - return JSON_TYPE_ERROR; - case '"': - if((s == 0 && v == 0) || s == '{' || s == '[' || s == ':') { - return atomic(state, c = (s == '{' ? JSON_TYPE_PAIR_NAME : c)); - } else { - state->error = JSON_ERROR_UNEXPECTED_STRING; - return JSON_TYPE_ERROR; - } - return c; - case '[': - if((s == 0 && v == 0) || s == '[' || s == ':') { - if(push(state, c)) { - return c; - } - } - state->error = JSON_ERROR_UNEXPECTED_ARRAY; - return JSON_TYPE_ERROR; - case 0: - if(v == 0 || state->depth > 0) { - state->error = JSON_ERROR_SYNTAX; - } - return JSON_TYPE_ERROR; - default: - if(s == 0 || s == ':' || s == '[') { - if (v != 0 && v != ',') { - state->error = JSON_ERROR_SYNTAX; - return JSON_TYPE_ERROR; - } - if(c == '-' || (c <= '9' && c >= '0')) { - return atomic(state, JSON_TYPE_NUMBER); - } else if(c == 'n') { - return atomic(state, JSON_TYPE_NULL); - } else if(c == 't') { - return atomic(state, JSON_TYPE_TRUE); - } else if(c == 'f') { - return atomic(state, JSON_TYPE_FALSE); - } else { - state->error = JSON_ERROR_SYNTAX; - return JSON_TYPE_ERROR; - } - } else if(s == '{') { - state->error = JSON_ERROR_SYNTAX; - return JSON_TYPE_ERROR; - } - } - return 0; -} -/*--------------------------------------------------------------------*/ -/* get the json value of the current position - * works only on "atomic" values such as string, number, null, false, true - */ -/*--------------------------------------------------------------------*/ -int -jsonparse_copy_value(struct jsonparse_state *state, char *str, int size) -{ - int i, o; - char c; - - if(!is_atomic(state)) { - return 0; - } - for(i = 0, o = 0; i < state->vlen && o < size - 1; i++) { - c = state->json[state->vstart + i]; - if(c == '\\') { - i++; - switch(state->json[state->vstart + i]) { - case '"': str[o++] = '"'; break; - case '\\': str[o++] = '\\'; break; - case '/': str[o++] = '/'; break; - case 'b': str[o++] = '\b'; break; - case 'f': str[o++] = '\f'; break; - case 'n': str[o++] = '\n'; break; - case 'r': str[o++] = '\r'; break; - case 't': str[o++] = '\t'; break; - } - continue; - } - str[o++] = c; - } - str[o] = 0; - return state->vtype; -} -/*--------------------------------------------------------------------*/ -int -jsonparse_get_value_as_int(struct jsonparse_state *state) -{ - if(state->vtype != JSON_TYPE_NUMBER) { - return 0; - } - return atoi(&state->json[state->vstart]); -} -/*--------------------------------------------------------------------*/ -long -jsonparse_get_value_as_long(struct jsonparse_state *state) -{ - if(state->vtype != JSON_TYPE_NUMBER) { - return 0; - } - return atol(&state->json[state->vstart]); -} -/*--------------------------------------------------------------------*/ -/* strcmp - assume no strange chars that needs to be stuffed in string... */ -/*--------------------------------------------------------------------*/ -int -jsonparse_strcmp_value(struct jsonparse_state *state, const char *str) -{ - if(!is_atomic(state)) { - return -1; - } - return strncmp(str, &state->json[state->vstart], state->vlen); -} -/*--------------------------------------------------------------------*/ -int -jsonparse_get_len(struct jsonparse_state *state) -{ - return state->vlen; -} -/*--------------------------------------------------------------------*/ -int -jsonparse_get_type(struct jsonparse_state *state) -{ - if(state->depth == 0) { - return 0; - } - return state->stack[state->depth - 1]; -} -/*--------------------------------------------------------------------*/ -int -jsonparse_has_next(struct jsonparse_state *state) -{ - return state->pos < state->len; -} -/*--------------------------------------------------------------------*/ diff --git a/os/lib/json/jsonparse.h b/os/lib/json/jsonparse.h deleted file mode 100644 index abf75ee23..000000000 --- a/os/lib/json/jsonparse.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2011-2012, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -#ifndef JSONPARSE_H_ -#define JSONPARSE_H_ - -#include "contiki.h" -#include "json.h" - -#ifdef JSONPARSE_CONF_MAX_DEPTH -#define JSONPARSE_MAX_DEPTH JSONPARSE_CONF_MAX_DEPTH -#else -#define JSONPARSE_MAX_DEPTH 10 -#endif - -struct jsonparse_state { - const char *json; - int pos; - int len; - int depth; - /* for handling atomic values */ - int vstart; - int vlen; - char vtype; - char error; - char stack[JSONPARSE_MAX_DEPTH]; -}; - -/** - * \brief Initialize a JSON parser state. - * \param state A pointer to a JSON parser state - * \param json The string to parse as JSON - * \param len The length of the string to parse - * - * This function initializes a JSON parser state for - * parsing a string as JSON. - */ -void jsonparse_setup(struct jsonparse_state *state, const char *json, - int len); - -/* move to next JSON element */ -int jsonparse_next(struct jsonparse_state *state); - -/* copy the current JSON value into the specified buffer */ -int jsonparse_copy_value(struct jsonparse_state *state, char *buf, - int buf_size); - -/* get the current JSON value parsed as an int */ -int jsonparse_get_value_as_int(struct jsonparse_state *state); - -/* get the current JSON value parsed as a long */ -long jsonparse_get_value_as_long(struct jsonparse_state *state); - -/* get the length of the current JSON value */ -int jsonparse_get_len(struct jsonparse_state *state); - -/* get the type of the current JSON value */ -int jsonparse_get_type(struct jsonparse_state *state); - -/* compare the JSON value with the specified string */ -int jsonparse_strcmp_value(struct jsonparse_state *state, const char *str); - -#endif /* JSONPARSE_H_ */ diff --git a/os/lib/json/jsontree.c b/os/lib/json/jsontree.c deleted file mode 100644 index 259525376..000000000 --- a/os/lib/json/jsontree.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2011-2012, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * JSON output generation - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "contiki.h" -#include "jsontree.h" -#include "jsonparse.h" -#include - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/*---------------------------------------------------------------------------*/ -void -jsontree_write_atom(const struct jsontree_context *js_ctx, const char *text) -{ - if(text == NULL) { - js_ctx->putchar('0'); - } else { - while(*text != '\0') { - js_ctx->putchar(*text++); - } - } -} -/*---------------------------------------------------------------------------*/ -void -jsontree_write_string(const struct jsontree_context *js_ctx, const char *text) -{ - js_ctx->putchar('"'); - if(text != NULL) { - while(*text != '\0') { - if(*text == '"') { - js_ctx->putchar('\\'); - } - js_ctx->putchar(*text++); - } - } - js_ctx->putchar('"'); -} -/*---------------------------------------------------------------------------*/ -void -jsontree_write_uint(const struct jsontree_context *js_ctx, unsigned int value) -{ - char buf[10]; - int l; - - l = sizeof(buf) - 1; - do { - buf[l--] = '0' + (value % 10); - value /= 10; - } while(value > 0 && l >= 0); - - while(++l < sizeof(buf)) { - js_ctx->putchar(buf[l]); - } -} -/*---------------------------------------------------------------------------*/ -void -jsontree_write_int(const struct jsontree_context *js_ctx, int value) -{ - if(value < 0) { - js_ctx->putchar('-'); - value = -value; - } - - jsontree_write_uint(js_ctx, value); -} -/*---------------------------------------------------------------------------*/ -void -jsontree_setup(struct jsontree_context *js_ctx, struct jsontree_value *root, - int (* putchar)(int)) -{ - js_ctx->values[0] = root; - js_ctx->putchar = putchar; - js_ctx->path = 0; - jsontree_reset(js_ctx); -} -/*---------------------------------------------------------------------------*/ -void -jsontree_reset(struct jsontree_context *js_ctx) -{ - js_ctx->depth = 0; - js_ctx->index[0] = 0; -} -/*---------------------------------------------------------------------------*/ -const char * -jsontree_path_name(const struct jsontree_context *js_ctx, int depth) -{ - if(depth < js_ctx->depth && js_ctx->values[depth]->type == JSON_TYPE_OBJECT) { - return ((struct jsontree_object *)js_ctx->values[depth])-> - pairs[js_ctx->index[depth]].name; - } - return ""; -} -/*---------------------------------------------------------------------------*/ -int -jsontree_print_next(struct jsontree_context *js_ctx) -{ - struct jsontree_value *v; - int index; -#if JSONTREE_PRETTY - int indent; -#endif - - v = js_ctx->values[js_ctx->depth]; - - /* Default operation after switch is to back up one level */ - switch(v->type) { - case JSON_TYPE_OBJECT: - case JSON_TYPE_ARRAY: { - struct jsontree_array *o = (struct jsontree_array *)v; - struct jsontree_value *ov; - - index = js_ctx->index[js_ctx->depth]; - if(index == 0) { - js_ctx->putchar(v->type); -#if JSONTREE_PRETTY - js_ctx->putchar('\n'); -#endif - } - if(index >= o->count) { -#if JSONTREE_PRETTY - js_ctx->putchar('\n'); - indent = js_ctx->depth; - while (indent--) { - js_ctx->putchar(' '); - js_ctx->putchar(' '); - } -#endif - js_ctx->putchar(v->type + 2); - /* Default operation: back up one level! */ - break; - } - - if(index > 0) { - js_ctx->putchar(','); -#if JSONTREE_PRETTY - js_ctx->putchar('\n'); -#endif - } - -#if JSONTREE_PRETTY - indent = js_ctx->depth + 1; - while (indent--) { - js_ctx->putchar(' '); - js_ctx->putchar(' '); - } -#endif - - if(v->type == JSON_TYPE_OBJECT) { - jsontree_write_string(js_ctx, - ((struct jsontree_object *)o)->pairs[index].name); - js_ctx->putchar(':'); -#if JSONTREE_PRETTY - js_ctx->putchar(' '); -#endif - ov = ((struct jsontree_object *)o)->pairs[index].value; - } else { - ov = o->values[index]; - } - if(js_ctx->depth >= JSONTREE_MAX_DEPTH - 1) { - /* Too deep: return 0 */ - return 0; - } - js_ctx->depth++; /* step down to value... */ - js_ctx->index[js_ctx->depth] = 0; /* and init index */ - js_ctx->values[js_ctx->depth] = ov; - /* Continue on this new level */ - return 1; - } - case JSON_TYPE_STRING: - jsontree_write_string(js_ctx, ((struct jsontree_string *)v)->value); - /* Default operation: back up one level! */ - break; - case JSON_TYPE_UINT: - jsontree_write_uint(js_ctx, ((struct jsontree_uint *)v)->value); - /* Default operation: back up one level! */ - break; - case JSON_TYPE_INT: - jsontree_write_int(js_ctx, ((struct jsontree_int *)v)->value); - /* Default operation: back up one level! */ - break; - case JSON_TYPE_CALLBACK: { /* pre-formatted json string currently */ - struct jsontree_callback *callback; - - callback = (struct jsontree_callback *)v; - if(js_ctx->index[js_ctx->depth] == 0) { - /* First call: reset the callback status */ - js_ctx->callback_state = 0; - } - if(callback->output == NULL) { - jsontree_write_string(js_ctx, ""); - } else if(callback->output(js_ctx)) { - /* The callback wants to output more */ - js_ctx->index[js_ctx->depth]++; - return 1; - } - /* Default operation: back up one level! */ - break; - case JSON_TYPE_S8PTR: - jsontree_write_int(js_ctx, *((int8_t *)((struct jsontree_ptr *)v)->value)); - /* Default operation: back up one level! */ - break; - case JSON_TYPE_U8PTR: - jsontree_write_uint(js_ctx, *((uint8_t *)((struct jsontree_ptr *)v)->value)); - /* Default operation: back up one level! */ - break; - case JSON_TYPE_S16PTR: - jsontree_write_int(js_ctx, *((int16_t *)((struct jsontree_ptr *)v)->value)); - /* Default operation: back up one level! */ - break; - case JSON_TYPE_U16PTR: - jsontree_write_uint(js_ctx, *((uint16_t *)((struct jsontree_ptr *)v)->value)); - /* Default operation: back up one level! */ - break; - case JSON_TYPE_S32PTR: - jsontree_write_int(js_ctx, *((int32_t *)((struct jsontree_ptr *)v)->value)); - /* Default operation: back up one level! */ - break; - case JSON_TYPE_U32PTR: - jsontree_write_uint(js_ctx, *((uint32_t *)((struct jsontree_ptr *)v)->value)); - /* Default operation: back up one level! */ - break; - } - default: - PRINTF("\nError: Illegal json type:'%c'\n", v->type); - return 0; - } - /* Done => back up one level! */ - if(js_ctx->depth > 0) { - js_ctx->depth--; - js_ctx->index[js_ctx->depth]++; - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static struct jsontree_value * -find_next(struct jsontree_context *js_ctx) -{ - struct jsontree_value *v; - int index; - - do { - v = js_ctx->values[js_ctx->depth]; - - /* Default operation after switch is to back up one level */ - switch(v->type) { - case JSON_TYPE_OBJECT: - case JSON_TYPE_ARRAY: { - struct jsontree_array *o = (struct jsontree_array *)v; - struct jsontree_value *ov; - - index = js_ctx->index[js_ctx->depth]; - if(index >= o->count) { - /* Default operation: back up one level! */ - break; - } - - if(v->type == JSON_TYPE_OBJECT) { - ov = ((struct jsontree_object *)o)->pairs[index].value; - } else { - ov = o->values[index]; - } - if(js_ctx->depth >= JSONTREE_MAX_DEPTH - 1) { - /* Too deep: return NULL */ - return NULL; - } - js_ctx->depth++; /* step down to value... */ - js_ctx->index[js_ctx->depth] = 0; /* and init index */ - js_ctx->values[js_ctx->depth] = ov; - /* Continue on this new level */ - return ov; - } - default: - /* Default operation: back up one level! */ - break; - } - /* Done => back up one level! */ - if(js_ctx->depth > 0) { - js_ctx->depth--; - js_ctx->index[js_ctx->depth]++; - } else { - return NULL; - } - } while(1); -} -/*---------------------------------------------------------------------------*/ -struct jsontree_value * -jsontree_find_next(struct jsontree_context *js_ctx, int type) -{ - struct jsontree_value *v; - - while((v = find_next(js_ctx)) != NULL && v->type != type && - js_ctx->path < js_ctx->depth) { - /* search */ - } - js_ctx->callback_state = 0; - return js_ctx->path < js_ctx->depth ? v : NULL; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/json/jsontree.h b/os/lib/json/jsontree.h deleted file mode 100644 index 09aefc11c..000000000 --- a/os/lib/json/jsontree.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2011-2012, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * JSON output generation - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef JSONTREE_H_ -#define JSONTREE_H_ - -#include "contiki.h" -#include "json.h" - -#ifdef JSONTREE_CONF_MAX_DEPTH -#define JSONTREE_MAX_DEPTH JSONTREE_CONF_MAX_DEPTH -#else -#define JSONTREE_MAX_DEPTH 10 -#endif /* JSONTREE_CONF_MAX_DEPTH */ - -#ifdef JSONTREE_CONF_PRETTY -#define JSONTREE_PRETTY JSONTREE_CONF_PRETTY -#else -#define JSONTREE_PRETTY 0 -#endif /* JSONTREE_CONF_PRETTY */ - -struct jsontree_context { - struct jsontree_value *values[JSONTREE_MAX_DEPTH]; - uint16_t index[JSONTREE_MAX_DEPTH]; - int (* putchar)(int); - uint8_t depth; - uint8_t path; - int callback_state; -}; - -struct jsontree_value { - uint8_t type; - /* followed by a value */ -}; - -struct jsontree_string { - uint8_t type; - const char *value; -}; - -struct jsontree_uint { - uint8_t type; - unsigned int value; -}; - -struct jsontree_int { - uint8_t type; - int value; -}; - -/* NOTE: the jsontree_callback set will receive a jsonparse state */ -struct jsonparse_state; -struct jsontree_callback { - uint8_t type; - int (* output)(struct jsontree_context *js_ctx); - int (* set)(struct jsontree_context *js_ctx, struct jsonparse_state *parser); -}; - -struct jsontree_pair { - const char *name; - struct jsontree_value *value; -}; - -struct jsontree_object { - uint8_t type; - uint8_t count; - struct jsontree_pair *pairs; -}; - -struct jsontree_array { - uint8_t type; - uint8_t count; - struct jsontree_value **values; -}; - -struct jsontree_ptr { - uint8_t type; - const void *value; -}; - -#define JSONTREE_STRING(text) {JSON_TYPE_STRING, (text)} -#define JSONTREE_PAIR(name, value) {(name), (struct jsontree_value *)(value)} -#define JSONTREE_CALLBACK(output, set) {JSON_TYPE_CALLBACK, (output), (set)} - -#define JSONTREE_OBJECT(name, ...) \ - static struct jsontree_pair jsontree_pair_##name[] = {__VA_ARGS__}; \ - static struct jsontree_object name = { \ - JSON_TYPE_OBJECT, \ - sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \ - jsontree_pair_##name } - -#define JSONTREE_OBJECT_EXT(name, ...) \ - static struct jsontree_pair jsontree_pair_##name[] = {__VA_ARGS__}; \ - struct jsontree_object name = { \ - JSON_TYPE_OBJECT, \ - sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \ - jsontree_pair_##name } - -#define JSONTREE_ARRAY(name, count) \ - static struct jsontree_value *jsontree_value##name[count]; \ - static struct jsontree_array name = { \ - JSON_TYPE_ARRAY, \ - count, \ - jsontree_value##name } - -void jsontree_setup(struct jsontree_context *js_ctx, - struct jsontree_value *root, int (* putchar)(int)); -void jsontree_reset(struct jsontree_context *js_ctx); - -const char *jsontree_path_name(const struct jsontree_context *js_ctx, - int depth); - -void jsontree_write_uint(const struct jsontree_context *js_ctx, - unsigned int value); -void jsontree_write_int(const struct jsontree_context *js_ctx, int value); -void jsontree_write_atom(const struct jsontree_context *js_ctx, - const char *text); -void jsontree_write_string(const struct jsontree_context *js_ctx, - const char *text); -int jsontree_print_next(struct jsontree_context *js_ctx); -struct jsontree_value *jsontree_find_next(struct jsontree_context *js_ctx, - int type); - -#endif /* JSONTREE_H_ */ diff --git a/os/lib/list.c b/os/lib/list.c deleted file mode 100644 index 9eaf1945e..000000000 --- a/os/lib/list.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \file - * Linked list library implementation. - * - * \author Adam Dunkels - * - */ - -/** - * \addtogroup list - * @{ - */ -#include "contiki.h" -#include "lib/list.h" - -#include -/*---------------------------------------------------------------------------*/ -struct list { - struct list *next; -}; -/*---------------------------------------------------------------------------*/ -/** - * Initialize a list. - * - * This function initalizes a list. The list will be empty after this - * function has been called. - * - * \param list The list to be initialized. - */ -void -list_init(list_t list) -{ - *list = NULL; -} -/*---------------------------------------------------------------------------*/ -/** - * Get a pointer to the first element of a list. - * - * This function returns a pointer to the first element of the - * list. The element will \b not be removed from the list. - * - * \param list The list. - * \return A pointer to the first element on the list. - * - * \sa list_tail() - */ -void * -list_head(list_t list) -{ - return *list; -} -/*---------------------------------------------------------------------------*/ -/** - * Duplicate a list. - * - * This function duplicates a list by copying the list reference, but - * not the elements. - * - * \note This function does \b not copy the elements of the list, but - * merely duplicates the pointer to the first element of the list. - * - * \param dest The destination list. - * \param src The source list. - */ -void -list_copy(list_t dest, list_t src) -{ - *dest = *src; -} -/*---------------------------------------------------------------------------*/ -/** - * Get the tail of a list. - * - * This function returns a pointer to the elements following the first - * element of a list. No elements are removed by this function. - * - * \param list The list - * \return A pointer to the element after the first element on the list. - * - * \sa list_head() - */ -void * -list_tail(list_t list) -{ - struct list *l; - - if(*list == NULL) { - return NULL; - } - - for(l = *list; l->next != NULL; l = l->next); - - return l; -} -/*---------------------------------------------------------------------------*/ -/** - * Add an item at the end of a list. - * - * This function adds an item to the end of the list. - * - * \param list The list. - * \param item A pointer to the item to be added. - * - * \sa list_push() - * - */ -void -list_add(list_t list, void *item) -{ - struct list *l; - - /* Make sure not to add the same element twice */ - list_remove(list, item); - - ((struct list *)item)->next = NULL; - - l = list_tail(list); - - if(l == NULL) { - *list = item; - } else { - l->next = item; - } -} -/*---------------------------------------------------------------------------*/ -/** - * Add an item to the start of the list. - */ -void -list_push(list_t list, void *item) -{ - /* Make sure not to add the same element twice */ - list_remove(list, item); - - ((struct list *)item)->next = *list; - *list = item; -} -/*---------------------------------------------------------------------------*/ -/** - * Remove the last object on the list. - * - * This function removes the last object on the list and returns it. - * - * \param list The list - * \return The removed object - * - */ -void * -list_chop(list_t list) -{ - struct list *l, *r; - - if(*list == NULL) { - return NULL; - } - if(((struct list *)*list)->next == NULL) { - l = *list; - *list = NULL; - return l; - } - - for(l = *list; l->next->next != NULL; l = l->next); - - r = l->next; - l->next = NULL; - - return r; -} -/*---------------------------------------------------------------------------*/ -/** - * Remove the first object on a list. - * - * This function removes the first object on the list and returns a - * pointer to it. - * - * \param list The list. - * \return Pointer to the removed element of list. - */ -/*---------------------------------------------------------------------------*/ -void * -list_pop(list_t list) -{ - struct list *l; - l = *list; - if(*list != NULL) { - *list = ((struct list *)*list)->next; - } - - return l; -} -/*---------------------------------------------------------------------------*/ -/** - * Remove a specific element from a list. - * - * This function removes a specified element from the list. - * - * \param list The list. - * \param item The item that is to be removed from the list. - * - */ -/*---------------------------------------------------------------------------*/ -void -list_remove(list_t list, void *item) -{ - struct list *l, *r; - - if(*list == NULL) { - return; - } - - r = NULL; - for(l = *list; l != NULL; l = l->next) { - if(l == item) { - if(r == NULL) { - /* First on list */ - *list = l->next; - } else { - /* Not first on list */ - r->next = l->next; - } - l->next = NULL; - return; - } - r = l; - } -} -/*---------------------------------------------------------------------------*/ -/** - * Get the length of a list. - * - * This function counts the number of elements on a specified list. - * - * \param list The list. - * \return The length of the list. - */ -/*---------------------------------------------------------------------------*/ -int -list_length(list_t list) -{ - struct list *l; - int n = 0; - - for(l = *list; l != NULL; l = l->next) { - ++n; - } - - return n; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Insert an item after a specified item on the list - * \param list The list - * \param previtem The item after which the new item should be inserted - * \param newitem The new item that is to be inserted - * \author Adam Dunkels - * - * This function inserts an item right after a specified - * item on the list. This function is useful when using - * the list module to ordered lists. - * - * If previtem is NULL, the new item is placed at the - * start of the list. - * - */ -void -list_insert(list_t list, void *previtem, void *newitem) -{ - if(previtem == NULL) { - list_push(list, newitem); - } else { - list_remove(list, newitem); - ((struct list *)newitem)->next = ((struct list *)previtem)->next; - ((struct list *)previtem)->next = newitem; - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Get the next item following this item - * \param item A list item - * \returns A next item on the list - * - * This function takes a list item and returns the next - * item on the list, or NULL if there are no more items on - * the list. This function is used when iterating through - * lists. - */ -void * -list_item_next(void *item) -{ - return item == NULL ? NULL : ((struct list *)item)->next; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Check if the list contains an item - * \param list The list that is checked - * \param item An item to look for in the list - * \returns 0 if the list does not contains the item, and 1 otherwise - * - * This function searches for an item in the list and returns - * 0 if the list does not contain the item, and 1 if the item - * is present in the list. - */ -bool -list_contains(list_t list, void *item) -{ - struct list *l; - for(l = *list; l != NULL; l = l->next) { - if(item == l) { - return true; - } - } - return false; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/lib/list.h b/os/lib/list.h deleted file mode 100644 index af0136435..000000000 --- a/os/lib/list.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \file - * Linked list manipulation routines. - * \author Adam Dunkels - * - */ - -/** \addtogroup data - @{ */ -/** - * \defgroup list Linked list library - * - * The linked list library provides a set of functions for - * manipulating linked lists. - * - * A linked list is made up of elements where the first element \b - * must be a pointer. This pointer is used by the linked list library - * to form lists of the elements. - * - * Lists are declared with the LIST() macro. The declaration specifies - * the name of the list that later is used with all list functions. - * - * Lists can be manipulated by inserting or removing elements from - * either sides of the list (list_push(), list_add(), list_pop(), - * list_chop()). A specified element can also be removed from inside a - * list with list_remove(). The head and tail of a list can be - * extracted using list_head() and list_tail(), respectively. - * - * @{ - */ - -#ifndef LIST_H_ -#define LIST_H_ - -#include - -#define LIST_CONCAT2(s1, s2) s1##s2 -#define LIST_CONCAT(s1, s2) LIST_CONCAT2(s1, s2) - -/** - * Declare a linked list. - * - * This macro declares a linked list with the specified \c type. The - * type \b must be a structure (\c struct) with its first element - * being a pointer. This pointer is used by the linked list library to - * form the linked lists. - * - * The list variable is declared as static to make it easy to use in a - * single C module without unnecessarily exporting the name to other - * modules. - * - * \param name The name of the list. - */ -#define LIST(name) \ - static void *LIST_CONCAT(name,_list) = NULL; \ - static list_t name = (list_t)&LIST_CONCAT(name,_list) - -/** - * Declare a linked list inside a structure declaraction. - * - * This macro declares a linked list with the specified \c type. The - * type \b must be a structure (\c struct) with its first element - * being a pointer. This pointer is used by the linked list library to - * form the linked lists. - * - * Internally, the list is defined as two items: the list itself and a - * pointer to the list. The pointer has the name of the parameter to - * the macro and the name of the list is a concatenation of the name - * and the suffix "_list". The pointer must point to the list for the - * list to work. Thus the list must be initialized before using. - * - * The list is initialized with the LIST_STRUCT_INIT() macro. - * - * \param name The name of the list. - */ -#define LIST_STRUCT(name) \ - void *LIST_CONCAT(name,_list); \ - list_t name - -/** - * Initialize a linked list that is part of a structure. - * - * This macro sets up the internal pointers in a list that has been - * defined as part of a struct. This macro must be called before using - * the list. - * - * \param struct_ptr A pointer to the struct - * \param name The name of the list. - */ -#define LIST_STRUCT_INIT(struct_ptr, name) \ - do { \ - (struct_ptr)->name = &((struct_ptr)->LIST_CONCAT(name,_list)); \ - (struct_ptr)->LIST_CONCAT(name,_list) = NULL; \ - list_init((struct_ptr)->name); \ - } while(0) - -/** - * The linked list type. - * - */ -typedef void ** list_t; - -void list_init(list_t list); -void * list_head(list_t list); -void * list_tail(list_t list); -void * list_pop (list_t list); -void list_push(list_t list, void *item); - -void * list_chop(list_t list); - -void list_add(list_t list, void *item); -void list_remove(list_t list, void *item); - -int list_length(list_t list); - -void list_copy(list_t dest, list_t src); - -void list_insert(list_t list, void *previtem, void *newitem); - -void * list_item_next(void *item); - -bool list_contains(list_t list, void *item); - -#endif /* LIST_H_ */ - -/** @} */ -/** @} */ diff --git a/os/lib/memb.c b/os/lib/memb.c deleted file mode 100644 index b4056dd9f..000000000 --- a/os/lib/memb.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \addtogroup memb - * @{ - */ - - /** - * \file - * Memory block allocation routines. - * \author Adam Dunkels - */ -#include - -#include "contiki.h" -#include "lib/memb.h" - -/*---------------------------------------------------------------------------*/ -void -memb_init(struct memb *m) -{ - memset(m->count, 0, m->num); - memset(m->mem, 0, m->size * m->num); -} -/*---------------------------------------------------------------------------*/ -void * -memb_alloc(struct memb *m) -{ - int i; - - for(i = 0; i < m->num; ++i) { - if(m->count[i] == 0) { - /* If this block was unused, we increase the reference count to - indicate that it now is used and return a pointer to the - memory block. */ - ++(m->count[i]); - return (void *)((char *)m->mem + (i * m->size)); - } - } - - /* No free block was found, so we return NULL to indicate failure to - allocate block. */ - return NULL; -} -/*---------------------------------------------------------------------------*/ -char -memb_free(struct memb *m, void *ptr) -{ - int i; - char *ptr2; - - /* Walk through the list of blocks and try to find the block to - which the pointer "ptr" points to. */ - ptr2 = (char *)m->mem; - for(i = 0; i < m->num; ++i) { - - if(ptr2 == (char *)ptr) { - /* We've found to block to which "ptr" points so we decrease the - reference count and return the new value of it. */ - if(m->count[i] > 0) { - /* Make sure that we don't deallocate free memory. */ - --(m->count[i]); - } - return m->count[i]; - } - ptr2 += m->size; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -int -memb_inmemb(struct memb *m, void *ptr) -{ - return (char *)ptr >= (char *)m->mem && - (char *)ptr < (char *)m->mem + (m->num * m->size); -} -/*---------------------------------------------------------------------------*/ -int -memb_numfree(struct memb *m) -{ - int i; - int num_free = 0; - - for(i = 0; i < m->num; ++i) { - if(m->count[i] == 0) { - ++num_free; - } - } - - return num_free; -} -/** @} */ diff --git a/os/lib/memb.h b/os/lib/memb.h deleted file mode 100644 index ffc555085..000000000 --- a/os/lib/memb.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \addtogroup mem - * @{ - */ - - -/** - * \defgroup memb memb: Memory block management functions - * - * The memory block allocation routines provide a simple yet powerful - * set of functions for managing a set of memory blocks of fixed - * size. A set of memory blocks is statically declared with the - * MEMB() macro. Memory blocks are allocated from the declared - * memory by the memb_alloc() function, and are deallocated with the - * memb_free() function. - * - * @{ - */ - - -/** - * \file - * Memory block allocation routines. - * \author - * Adam Dunkels - * - */ - -#ifndef MEMB_H_ -#define MEMB_H_ - -#include "sys/cc.h" - -/** - * Declare a memory block. - * - * This macro is used to statically declare a block of memory that can - * be used by the block allocation functions. The macro statically - * declares a C array with a size that matches the specified number of - * blocks and their individual sizes. - * - * Example: - \code -MEMB(connections, struct connection, 16); - \endcode - * - * \param name The name of the memory block (later used with - * memb_init(), memb_alloc() and memb_free()). - * - * \param structure The name of the struct that the memory block holds - * - * \param num The total number of memory chunks in the block. - * - */ -#define MEMB(name, structure, num) \ - static char CC_CONCAT(name,_memb_count)[num]; \ - static structure CC_CONCAT(name,_memb_mem)[num]; \ - static struct memb name = {sizeof(structure), num, \ - CC_CONCAT(name,_memb_count), \ - (void *)CC_CONCAT(name,_memb_mem)} - -struct memb { - unsigned short size; - unsigned short num; - char *count; - void *mem; -}; - -/** - * Initialize a memory block that was declared with MEMB(). - * - * \param m A memory block previously declared with MEMB(). - */ -void memb_init(struct memb *m); - -/** - * Allocate a memory block from a block of memory declared with MEMB(). - * - * \param m A memory block previously declared with MEMB(). - */ -void *memb_alloc(struct memb *m); - -/** - * Deallocate a memory block from a memory block previously declared - * with MEMB(). - * - * \param m m A memory block previously declared with MEMB(). - * - * \param ptr A pointer to the memory block that is to be deallocated. - * - * \return The new reference count for the memory block (should be 0 - * if successfully deallocated) or -1 if the pointer "ptr" did not - * point to a legal memory block. - */ -char memb_free(struct memb *m, void *ptr); - -int memb_inmemb(struct memb *m, void *ptr); - -int memb_numfree(struct memb *m); - -/** @} */ -/** @} */ - -#endif /* MEMB_H_ */ diff --git a/os/lib/newlib/syscalls.c b/os/lib/newlib/syscalls.c deleted file mode 100644 index 72b7161de..000000000 --- a/os/lib/newlib/syscalls.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2014, Institute for Pervasive Computing, ETH Zurich. - * All rights reserved. - * - * Author: Andreas Dröscher - * - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ -/** - * \addtogroup lib - * @{ - * - * \defgroup newlib Generic Newlib customizations - * - * Library providing generic implementations of Newlib features for Contiki - * @{ - * - * \file - * System calls - */ -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief Enlarges the allocated heap space - * \param incr Number of bytes by which to increase the heap space - * \return The previous end of heap on success (which is also a pointer to the - * start of the newly allocated memory if \p incr is positive), or - * (caddr_t)-1 with \c errno set to \c ENOMEM on error - */ -caddr_t -_sbrk(int incr) -{ - /* - * Newlib's _sbrk_r() assumes that this global errno variable is used here, - * which is different from the errno definition provided by . - */ -#undef errno - extern int errno; - - /* Heap boundaries from linker script. */ - extern uint8_t _heap; - extern uint8_t _eheap; - - static uint8_t *heap_end = &_heap; - uint8_t *prev_heap_end = heap_end; - - if(heap_end + incr > &_eheap) { - PRINTF("Out of heap space!\n"); - errno = ENOMEM; - return (caddr_t)-1; - } - - heap_end += incr; - return (caddr_t)prev_heap_end; -} - -/** - * @} - * @} - */ diff --git a/os/lib/queue.h b/os/lib/queue.h deleted file mode 100644 index 9d65fec9e..000000000 --- a/os/lib/queue.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * Copyright (c) 2017, James Pope - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup data - * @{ - * - * \defgroup queue Queue library - * - * This library provides functions for the creation and manipulation of - * queues. The library is implemented as a wrapper around the list library. - * - * A queue is declared using the QUEUE macro. Queue elements must be - * allocated by the calling code and must be of a C struct datatype. In this - * struct, the first field must be a pointer called \e next. This field will - * be used by the library to maintain the queue. Application code must not - * modify this field directly. - * @{ - */ -/*---------------------------------------------------------------------------*/ -#ifndef QUEUE_H_ -#define QUEUE_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/list.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief The queue data type - */ -typedef list_t queue_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Define a queue. - * - * This macro defines a queue. - * - * The datatype for elements must be a C struct. The struct's first member must - * be a pointer called \e next. This is used internally by the library to - * maintain data structure integrity and must not be modified directly by - * application code. - * - * \param name The name of the queue. - */ -#define QUEUE(name) LIST(name) -/*---------------------------------------------------------------------------*/ -struct queue { - struct queue *next; -}; -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise a queue - * \param queue The queue - */ -static inline void -queue_init(queue_t queue) -{ - list_init(queue); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Adds an element to the tail of the queue - * \param queue The queue - * \param element A pointer to the element to be added - */ -static inline void -queue_enqueue(queue_t queue, void *element) -{ - list_add(queue, element); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Removes the element at the front of the queue - * \param queue The queue - * \return A pointer to the element removed - * - * If this function returns NULL if the queue was empty (queue underflow) - */ -static inline void * -queue_dequeue(queue_t queue) -{ - return list_pop(queue); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the front element of the queue, without removing it - * \param queue The queue - * \return A pointer to the element at the front of the queue - */ -static inline void * -queue_peek(queue_t queue) -{ - return list_head(queue); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Check if a queue is empty - * \param queue The queue - * \retval true The queue is empty - * \retval false The queue has at least one element - */ -static inline bool -queue_is_empty(queue_t queue) -{ - return *queue == NULL ? true : false; -} -/*---------------------------------------------------------------------------*/ -#endif /* QUEUE_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/lib/random.c b/os/lib/random.c deleted file mode 100644 index c291ae117..000000000 --- a/os/lib/random.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - - -#include "lib/random.h" -#include "sys/clock.h" - -#include - -/*---------------------------------------------------------------------------*/ -void -random_init(unsigned short seed) -{ - srand(seed); -} -/*---------------------------------------------------------------------------*/ -unsigned short -random_rand(void) -{ -/* In gcc int rand() uses RAND_MAX and long random() uses RANDOM_MAX=0x7FFFFFFF */ -/* RAND_MAX varies depending on the architecture */ - - return (unsigned short)rand(); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/random.h b/os/lib/random.h deleted file mode 100644 index cb206e23b..000000000 --- a/os/lib/random.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#ifndef RANDOM_H_ -#define RANDOM_H_ - -/* - * Initialize the pseudo-random generator. - * - */ -void random_init(unsigned short seed); - -/* - * Calculate a pseudo random number between 0 and 65535. - * - * \return A pseudo-random number between 0 and 65535. - */ -unsigned short random_rand(void); - -/* In gcc int rand() uses RAND_MAX and long random() uses RANDOM_MAX */ -/* Since random_rand casts to unsigned short, we'll use this maxmimum */ -#define RANDOM_RAND_MAX 65535U - -#endif /* RANDOM_H_ */ diff --git a/os/lib/ringbuf.c b/os/lib/ringbuf.c deleted file mode 100644 index 89bcad514..000000000 --- a/os/lib/ringbuf.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Ring buffer library implementation - * \author - * Adam Dunkels - */ - -#include "lib/ringbuf.h" -#include -/*---------------------------------------------------------------------------*/ -void -ringbuf_init(struct ringbuf *r, uint8_t *dataptr, uint8_t size) -{ - r->data = dataptr; - r->mask = size - 1; - r->put_ptr = 0; - r->get_ptr = 0; -} -/*---------------------------------------------------------------------------*/ -int -ringbuf_put(struct ringbuf *r, uint8_t c) -{ - /* Check if buffer is full. If it is full, return 0 to indicate that - the element was not inserted into the buffer. - - XXX: there is a potential risk for a race condition here, because - the ->get_ptr field may be written concurrently by the - ringbuf_get() function. To avoid this, access to ->get_ptr must - be atomic. We use an uint8_t type, which makes access atomic on - most platforms, but C does not guarantee this. - */ - if(((r->put_ptr - r->get_ptr) & r->mask) == r->mask) { - return 0; - } - /* - * CC_ACCESS_NOW is used because the compiler is allowed to reorder - * the access to non-volatile variables. - * In this case a reader might read from the moved index/ptr before - * its value (c) is written. Reordering makes little sense, but - * better safe than sorry. - */ - CC_ACCESS_NOW(uint8_t, r->data[r->put_ptr]) = c; - CC_ACCESS_NOW(uint8_t, r->put_ptr) = (r->put_ptr + 1) & r->mask; - return 1; -} -/*---------------------------------------------------------------------------*/ -int -ringbuf_get(struct ringbuf *r) -{ - uint8_t c; - - /* Check if there are bytes in the buffer. If so, we return the - first one and increase the pointer. If there are no bytes left, we - return -1. - - XXX: there is a potential risk for a race condition here, because - the ->put_ptr field may be written concurrently by the - ringbuf_put() function. To avoid this, access to ->get_ptr must - be atomic. We use an uint8_t type, which makes access atomic on - most platforms, but C does not guarantee this. - */ - if(((r->put_ptr - r->get_ptr) & r->mask) > 0) { - /* - * CC_ACCESS_NOW is used because the compiler is allowed to reorder - * the access to non-volatile variables. - * In this case the memory might be freed and overwritten by - * increasing get_ptr before the value was copied to c. - * Opposed to the put-operation this would even make sense, - * because the register used for mask can be reused to save c - * (on some architectures). - */ - c = CC_ACCESS_NOW(uint8_t, r->data[r->get_ptr]); - CC_ACCESS_NOW(uint8_t, r->get_ptr) = (r->get_ptr + 1) & r->mask; - return c; - } else { - return -1; - } -} -/*---------------------------------------------------------------------------*/ -int -ringbuf_size(struct ringbuf *r) -{ - return r->mask + 1; -} -/*---------------------------------------------------------------------------*/ -int -ringbuf_elements(struct ringbuf *r) -{ - return (r->put_ptr - r->get_ptr) & r->mask; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/ringbuf.h b/os/lib/ringbuf.h deleted file mode 100644 index d049ab2e9..000000000 --- a/os/lib/ringbuf.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the ring buffer library - * \author - * Adam Dunkels - */ - -/** \addtogroup data - * @{ */ - -/** - * \defgroup ringbuf Ring buffer library - * @{ - * - * The ring buffer library implements ring (circular) buffer where - * bytes can be read and written independently. A ring buffer is - * particularly useful in device drivers where data can come in - * through interrupts. - * - */ - -#ifndef RINGBUF_H_ -#define RINGBUF_H_ - -#include "contiki.h" - -/** - * \brief Structure that holds the state of a ring buffer. - * - * This structure holds the state of a ring buffer. The - * actual buffer needs to be defined separately. This - * struct is an opaque structure with no user-visible - * elements. - * - */ -struct ringbuf { - uint8_t *data; - uint8_t mask; - - /* XXX these must be 8-bit quantities to avoid race conditions. */ - uint8_t put_ptr, get_ptr; -}; - -/** - * \brief Initialize a ring buffer - * \param r A pointer to a struct ringbuf to hold the state of the ring buffer - * \param a A pointer to an array to hold the data in the buffer - * \param size_power_of_two The size of the ring buffer, which must be a power of two - * - * This function initiates a ring buffer. The data in the - * buffer is stored in an external array, to which a - * pointer must be supplied. The size of the ring buffer - * must be a power of two and cannot be larger than 128 - * bytes. - * - */ -void ringbuf_init(struct ringbuf *r, uint8_t *a, - uint8_t size_power_of_two); - -/** - * \brief Insert a byte into the ring buffer - * \param r A pointer to a struct ringbuf to hold the state of the ring buffer - * \param c The byte to be written to the buffer - * \return Non-zero if there data could be written, or zero if the buffer was full. - * - * This function inserts a byte into the ring buffer. It - * is safe to call this function from an interrupt - * handler. - * - */ -int ringbuf_put(struct ringbuf *r, uint8_t c); - - -/** - * \brief Get a byte from the ring buffer - * \param r A pointer to a struct ringbuf to hold the state of the ring buffer - * \return The data from the buffer, or -1 if the buffer was empty - * - * This function removes a byte from the ring buffer. It - * is safe to call this function from an interrupt - * handler. - * - */ -int ringbuf_get(struct ringbuf *r); - -/** - * \brief Get the size of a ring buffer - * \param r A pointer to a struct ringbuf to hold the state of the ring buffer - * \return The size of the buffer. - */ -int ringbuf_size(struct ringbuf *r); - -/** - * \brief Get the number of elements currently in the ring buffer - * \param r A pointer to a struct ringbuf to hold the state of the ring buffer - * \return The number of elements in the buffer. - */ -int ringbuf_elements(struct ringbuf *r); - -#endif /* RINGBUF_H_ */ - -/** @}*/ -/** @}*/ diff --git a/os/lib/ringbufindex.c b/os/lib/ringbufindex.c deleted file mode 100644 index cde992838..000000000 --- a/os/lib/ringbufindex.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * ringbufindex library. Implements basic support for ring buffers - * of any type, as opposed to the os/lib/ringbuf module which - * is only for byte arrays. Simply returns index in the ringbuf - * rather than actual elements. The ringbuf size must be power of two. - * Like the original ringbuf, this module implements atomic put and get. - * \author - * Simon Duquennoy - * based on Contiki's os/lib/ringbuf library by Adam Dunkels - */ - -#include -#include "lib/ringbufindex.h" - -/* Initialize a ring buffer. The size must be a power of two */ -void -ringbufindex_init(struct ringbufindex *r, uint8_t size) -{ - r->mask = size - 1; - r->put_ptr = 0; - r->get_ptr = 0; -} -/* Put one element to the ring buffer */ -int -ringbufindex_put(struct ringbufindex *r) -{ - /* Check if buffer is full. If it is full, return 0 to indicate that - the element was not inserted. - - XXX: there is a potential risk for a race condition here, because - the ->get_ptr field may be written concurrently by the - ringbufindex_get() function. To avoid this, access to ->get_ptr must - be atomic. We use an uint8_t type, which makes access atomic on - most platforms, but C does not guarantee this. - */ - if(((r->put_ptr - r->get_ptr) & r->mask) == r->mask) { - return 0; - } - r->put_ptr = (r->put_ptr + 1) & r->mask; - return 1; -} -/* Check if there is space to put an element. - * Return the index where the next element is to be added */ -int -ringbufindex_peek_put(const struct ringbufindex *r) -{ - /* Check if there are bytes in the buffer. If so, we return the - first one. If there are no bytes left, we return -1. - */ - if(((r->put_ptr - r->get_ptr) & r->mask) == r->mask) { - return -1; - } - return r->put_ptr; -} -/* Remove the first element and return its index */ -int -ringbufindex_get(struct ringbufindex *r) -{ - int get_ptr; - - /* Check if there are bytes in the buffer. If so, we return the - first one and increase the pointer. If there are no bytes left, we - return -1. - - XXX: there is a potential risk for a race condition here, because - the ->put_ptr field may be written concurrently by the - ringbufindex_put() function. To avoid this, access to ->get_ptr must - be atomic. We use an uint8_t type, which makes access atomic on - most platforms, but C does not guarantee this. - */ - if(((r->put_ptr - r->get_ptr) & r->mask) > 0) { - get_ptr = r->get_ptr; - r->get_ptr = (r->get_ptr + 1) & r->mask; - return get_ptr; - } else { - return -1; - } -} -/* Return the index of the first element - * (which will be removed if calling ringbufindex_peek) */ -int -ringbufindex_peek_get(const struct ringbufindex *r) -{ - /* Check if there are bytes in the buffer. If so, we return the - first one. If there are no bytes left, we return -1. - */ - if(((r->put_ptr - r->get_ptr) & r->mask) > 0) { - return r->get_ptr; - } else { - return -1; - } -} -/* Return the ring buffer size */ -int -ringbufindex_size(const struct ringbufindex *r) -{ - return r->mask + 1; -} -/* Return the number of elements currently in the ring buffer */ -int -ringbufindex_elements(const struct ringbufindex *r) -{ - return (r->put_ptr - r->get_ptr) & r->mask; -} -/* Is the ring buffer full? */ -int -ringbufindex_full(const struct ringbufindex *r) -{ - return ((r->put_ptr - r->get_ptr) & r->mask) == r->mask; -} -/* Is the ring buffer empty? */ -int -ringbufindex_empty(const struct ringbufindex *r) -{ - return ringbufindex_elements(r) == 0; -} diff --git a/os/lib/ringbufindex.h b/os/lib/ringbufindex.h deleted file mode 100644 index 44bf5f82e..000000000 --- a/os/lib/ringbufindex.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the ringbufindex library - * \author - * Simon Duquennoy - */ - -#ifndef __RINGBUFINDEX_H__ -#define __RINGBUFINDEX_H__ - -#include "contiki.h" - -struct ringbufindex { - uint8_t mask; - /* These must be 8-bit quantities to avoid race conditions. */ - uint8_t put_ptr, get_ptr; -}; - -/** - * \brief Initialize a ring buffer. The size must be a power of two - * \param r Pointer to ringbufindex - * \param size Size of ring buffer - */ -void ringbufindex_init(struct ringbufindex *r, uint8_t size); - -/** - * \brief Put one element to the ring buffer - * \param r Pointer to ringbufindex - * \retval 0 Failure; the ring buffer is full - * \retval 1 Success; an element is added - */ -int ringbufindex_put(struct ringbufindex *r); - -/** - * \brief Check if there is space to put an element. - * \param r Pinter to ringbufindex - * \retval >= 0 The index where the next element is to be added. - * \retval -1 Failure; the ring buffer is full - */ -int ringbufindex_peek_put(const struct ringbufindex *r); - -/** - * \brief Remove the first element and return its index - * \param r Pinter to ringbufindex - * \retval >= 0 The index of the first element - * \retval -1 No element in the ring buffer - */ -int ringbufindex_get(struct ringbufindex *r); - -/** - * \brief Return the index of the first element which will be removed if calling - * ringbufindex_get. - * \param r Pinter to ringbufindex - * \retval >= 0 The index of the first element - * \retval -1 No element in the ring buffer - */ -int ringbufindex_peek_get(const struct ringbufindex *r); - -/** - * \brief Return the ring buffer size - * \param r Pinter to ringbufindex - * \return The size of the ring buffer - */ -int ringbufindex_size(const struct ringbufindex *r); - -/** - * \brief Return the number of elements currently in the ring buffer. - * \param r Pinter to ringbufindex - * \return The number of elements in the ring buffer - */ -int ringbufindex_elements(const struct ringbufindex *r); - -/** - * \brief Is the ring buffer full? - * \retval 0 Not full - * \retval 1 Full - */ -int ringbufindex_full(const struct ringbufindex *r); - -/** - * \brief Is the ring buffer empty? - * \retval 0 Not empty - * \retval 1 Empty - */ -int ringbufindex_empty(const struct ringbufindex *r); - -#endif /* __RINGBUFINDEX_H__ */ diff --git a/os/lib/sensors.c b/os/lib/sensors.c deleted file mode 100644 index ccfbdad5e..000000000 --- a/os/lib/sensors.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/* exeperimental code, will be renamed to sensors.c when done */ - - -#include - -#include "contiki.h" - -#include "lib/sensors.h" - -const extern struct sensors_sensor *sensors[]; -extern unsigned char sensors_flags[]; - -#define FLAG_CHANGED 0x80 - -process_event_t sensors_event; - -static unsigned char num_sensors; - -PROCESS(sensors_process, "Sensors"); - -/*---------------------------------------------------------------------------*/ -static int -get_sensor_index(const struct sensors_sensor *s) -{ - int i; - for(i = 0; i < num_sensors; ++i) { - if(sensors[i] == s) { - return i; - } - } - return i; -} -/*---------------------------------------------------------------------------*/ -const struct sensors_sensor * -sensors_first(void) -{ - return sensors[0]; -} -/*---------------------------------------------------------------------------*/ -const struct sensors_sensor * -sensors_next(const struct sensors_sensor *s) -{ - return sensors[get_sensor_index(s) + 1]; -} -/*---------------------------------------------------------------------------*/ -void -sensors_changed(const struct sensors_sensor *s) -{ - sensors_flags[get_sensor_index(s)] |= FLAG_CHANGED; - process_poll(&sensors_process); -} -/*---------------------------------------------------------------------------*/ -const struct sensors_sensor * -sensors_find(const char *prefix) -{ - int i; - unsigned short len; - - /* Search through all processes and search for the specified process - name. */ - len = strlen(prefix); - - for(i = 0; i < num_sensors; ++i) { - if(strncmp(prefix, sensors[i]->type, len) == 0) { - return sensors[i]; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sensors_process, ev, data) -{ - static int i; - static int events; - - PROCESS_BEGIN(); - - sensors_event = process_alloc_event(); - - for(i = 0; sensors[i] != NULL; ++i) { - sensors_flags[i] = 0; - sensors[i]->configure(SENSORS_HW_INIT, 0); - } - num_sensors = i; - - while(1) { - - PROCESS_WAIT_EVENT(); - - do { - events = 0; - for(i = 0; i < num_sensors; ++i) { - if(sensors_flags[i] & FLAG_CHANGED) { - if(process_post(PROCESS_BROADCAST, sensors_event, (void *)sensors[i]) == PROCESS_ERR_OK) { - PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event); - } - sensors_flags[i] &= ~FLAG_CHANGED; - events++; - } - } - } while(events); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/lib/sensors.h b/os/lib/sensors.h deleted file mode 100644 index 11b9fba17..000000000 --- a/os/lib/sensors.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef SENSORS_H_ -#define SENSORS_H_ - -#include "contiki.h" - -/* some constants for the configure API */ -#define SENSORS_HW_INIT 128 /* internal - used only for initialization */ -#define SENSORS_ACTIVE 129 /* ACTIVE => 0 -> turn off, 1 -> turn on */ -#define SENSORS_READY 130 /* read only */ - -#define SENSORS_ACTIVATE(sensor) (sensor).configure(SENSORS_ACTIVE, 1) -#define SENSORS_DEACTIVATE(sensor) (sensor).configure(SENSORS_ACTIVE, 0) - -#define SENSORS_SENSOR(name, type, value, configure, status) \ -const struct sensors_sensor name = { type, value, configure, status } - -#define SENSORS_NUM (sizeof(sensors) / sizeof(struct sensors_sensor *)) - -#define SENSORS(...) \ -const struct sensors_sensor *sensors[] = {__VA_ARGS__, NULL}; \ -unsigned char sensors_flags[SENSORS_NUM] - -struct sensors_sensor { - char * type; - int (* value) (int type); - int (* configure) (int type, int value); - int (* status) (int type); -}; - -const struct sensors_sensor *sensors_find(const char *type); -const struct sensors_sensor *sensors_next(const struct sensors_sensor *s); -const struct sensors_sensor *sensors_first(void); - -void sensors_changed(const struct sensors_sensor *s); - -extern process_event_t sensors_event; - -PROCESS_NAME(sensors_process); - -#endif /* SENSORS_H_ */ diff --git a/os/lib/stack.h b/os/lib/stack.h deleted file mode 100644 index 8d56e46ef..000000000 --- a/os/lib/stack.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * Copyright (c) 2017, James Pope - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup data - * @{ - * - * \defgroup stack-data-structure Stack library - * - * This library provides functions for the creation and manipulation of - * stacks. The library is implemented as a wrapper around the list library. - * - * A stack is declared using the STACK macro. Stack elements must be - * allocated by the calling code and must be of a C struct datatype. In this - * struct, the first field must be a pointer called \e next. This field will - * be used by the library to maintain the stack. Application code must not - * modify this field directly. - * @{ - */ -/*---------------------------------------------------------------------------*/ -#ifndef STACK_H_ -#define STACK_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "lib/list.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief The stack data type - */ -typedef list_t stack_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Define a stack. - * - * This macro defines a stack. - * - * The datatype for elements must be a C struct. The struct's first member must - * be a pointer called \e next. This is used internally by the library to - * maintain data structure integrity and must not be modified directly by - * application code. - * - * \param name The name of the stack. - */ -#define STACK(name) LIST(name) -/*---------------------------------------------------------------------------*/ -struct stack { - struct stack *next; -}; -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise a stack - * \param stack The stack - */ -static inline void -stack_init(stack_t stack) -{ - list_init(stack); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Adds an element to the top of the stack - * \param stack The stack - * \param element A pointer to the element to be added - */ -static inline void -stack_push(stack_t stack, void *element) -{ - list_push(stack, element); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Removes the top element from the stack - * \param stack The stack - * \return A pointer to the element popped - * - * If this function returns NULL if the stack was empty (stack underflow) - */ -static inline void * -stack_pop(stack_t stack) -{ - return list_pop(stack); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the top element of the stack, without popping it - * \param stack The stack - * \return A pointer to the element at the top of the stack - */ -static inline void * -stack_peek(stack_t stack) -{ - return list_head(stack); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Check if a stack is empty - * \param stack The stack - * \retval true The stack is empty - * \retval false The stack has at least one element - */ -static inline bool -stack_is_empty(stack_t stack) -{ - return *stack == NULL ? true : false; -} -/*---------------------------------------------------------------------------*/ -#endif /* STACK_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/lib/strncasecmp/strncasecmp.c b/os/lib/strncasecmp/strncasecmp.c deleted file mode 100644 index 2f1c1d4ba..000000000 --- a/os/lib/strncasecmp/strncasecmp.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment for the C64. - * - * - */ - -/* This file contains a naive and non-standards compliant - implementation of strncasecmp() for systems that don't implement - the function. It works with Contiki, but should most probably not - be used anywhere else. - - It copies the n first bytes two strings into two buffers and - compares them with strcasecmp. -*/ - -#define MAX_STRLEN 40 - - -int strncmp(const char *s1, const char *s2, int len); - -/*static char buf1[MAX_STRLEN], - buf2[MAX_STRLEN];*/ -/*-----------------------------------------------------------------------------------*/ -unsigned char -strncasecmp(const char *s1, const char *s2, unsigned char n) -{ - unsigned char len; - - return strncmp(s1, s2, n); - - /* len = MAX_STRLEN; - if(n < MAX_STRLEN) { - len = n; - } - strncpy(buf1, s1, len); - buf1[MAX_STRLEN - 1] = 0; - strncpy(buf2, s2, len); - buf2[MAX_STRLEN - 1] = 0; - return strcasecmp(buf1, buf2);*/ -} -/*-----------------------------------------------------------------------------------*/ diff --git a/os/lib/trickle-timer.c b/os/lib/trickle-timer.c deleted file mode 100644 index 9180e1bf3..000000000 --- a/os/lib/trickle-timer.c +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Copyright (c) 2012, George Oikonomou - - * 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 - * Trickle timer library implementation. - * \author - * George Oikonomou - - */ - -/** - * \addtogroup trickle-timer - * @{ - */ - -#include "contiki.h" -#include "lib/trickle-timer.h" -#include "sys/ctimer.h" -#include "sys/cc.h" -#include "lib/random.h" -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 - -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief Wide randoms for platforms using a 4-byte wide clock - * (see ::TRICKLE_TIMER_WIDE_RAND) - */ -#if TRICKLE_TIMER_WIDE_RAND -#define tt_rand() wide_rand() -#else -#define tt_rand() random_rand() -#endif -/*---------------------------------------------------------------------------*/ -/* Declarations of variables of local interest */ -/*---------------------------------------------------------------------------*/ -static struct trickle_timer *loctt; /* Pointer to a struct for local use */ -static clock_time_t loc_clock; /* A local, general-purpose placeholder */ - -static void fire(void *ptr); -static void double_interval(void *ptr); -/*---------------------------------------------------------------------------*/ -/* Local utilities and functions to be used as ctimer callbacks */ -/*---------------------------------------------------------------------------*/ -#if TRICKLE_TIMER_WIDE_RAND -/* Returns a 4-byte wide, unsigned random number */ -static uint32_t -wide_rand(void) -{ - return ((uint32_t)random_rand() << 16 | random_rand()); -} -#endif -/*---------------------------------------------------------------------------*/ -/* - * Returns the maximum sane Imax value for a given Imin - * - * This function is a variant of a fairly standard 'Count Leading Zeros'. It - * has three flavours. The most suitable one for a specific platform can be - * configured by changing the value of TRICKLE_TIMER_CONF_MAX_IMAX_WIDTH - * in the platform's contiki-conf.h - */ -#if TRICKLE_TIMER_ERROR_CHECKING -static uint8_t -max_imax(clock_time_t value) -{ - uint8_t zeros = 0; -#if (TRICKLE_TIMER_MAX_IMAX_WIDTH==TRICKLE_TIMER_MAX_IMAX_GENERIC) - uint8_t i; - clock_time_t mask = 0xFFFF; - - value--; - - for(i = sizeof(clock_time_t) << 2; i > 0; i >>= 1) { - if((value & (mask <<= i)) == 0) { - zeros += i; - value <<= i; - } - } - -#elif (TRICKLE_TIMER_MAX_IMAX_WIDTH==TRICKLE_TIMER_MAX_IMAX_16_BIT) - if((value & 0xFF00) == 0) { - zeros += 8; - value <<= 8; - } - if((value & 0xF000) == 0) { - zeros += 4; - value <<= 4; - } - if((value & 0xC000) == 0) { - zeros += 2; - value <<= 2; - } - if((value & 0x8000) == 0) { - zeros++; - } -#elif (TRICKLE_TIMER_MAX_IMAX_WIDTH==TRICKLE_TIMER_MAX_IMAX_32_BIT) - if((value & 0xFFFF0000) == 0) { - zeros += 16; - value <<= 16; - } - if((value & 0xFF000000) == 0) { - zeros += 8; - value <<= 8; - } - if((value & 0xF0000000) == 0) { - zeros += 4; - value <<= 4; - } - if((value & 0xC0000000) == 0) { - zeros += 2; - value <<= 2; - } - if((value & 0x80000000) == 0) { - zeros += 1; - } -#endif - - return zeros - 1; /* Always non-negative due to the range of 'value' */ -} -#endif /* TRICKLE_TIMER_ERROR_CHECKING */ -/*---------------------------------------------------------------------------*/ -/* Returns a random time point t in [I/2 , I) */ -static clock_time_t -get_t(clock_time_t i_cur) -{ - i_cur >>= 1; - - PRINTF("trickle_timer get t: [%lu, %lu)\n", (unsigned long)i_cur, - (unsigned long)(i_cur << 1)); - - return i_cur + (tt_rand() % i_cur); -} -/*---------------------------------------------------------------------------*/ -static void -schedule_for_end(struct trickle_timer *tt) -{ - /* Reset our ctimer, schedule interval_end to run at time I */ - clock_time_t now = clock_time(); - - loc_clock = TRICKLE_TIMER_INTERVAL_END(tt) - now; - - PRINTF("trickle_timer sched for end: at %lu, end in %ld\n", - (unsigned long)clock_time(), (signed long)loc_clock); - - /* Interval's end will happen in loc_clock ticks. Make sure this isn't in - * the past... */ - if(loc_clock > (TRICKLE_TIMER_CLOCK_MAX >> 1)) { - loc_clock = 0; /* Interval ended in the past, schedule for in 0 */ - PRINTF("trickle_timer doubling: Was in the past. Compensating\n"); - } - - ctimer_set(&tt->ct, loc_clock, double_interval, tt); -} -/*---------------------------------------------------------------------------*/ -/* This is used as a ctimer callback, thus its argument must be void *. ptr is - * a pointer to the struct trickle_timer that fired */ -static void -double_interval(void *ptr) -{ - clock_time_t last_end; - - /* 'cast' ptr to a struct trickle_timer */ - loctt = (struct trickle_timer *)ptr; - - loctt->c = 0; - - PRINTF("trickle_timer doubling: at %lu, (was for %lu), ", - (unsigned long)clock_time(), - (unsigned long)TRICKLE_TIMER_INTERVAL_END(loctt)); - - /* Remember the previous interval's end (absolute time), before we double */ - last_end = TRICKLE_TIMER_INTERVAL_END(loctt); - - /* Double the interval if we have to */ - if(loctt->i_cur <= TRICKLE_TIMER_INTERVAL_MAX(loctt) >> 1) { - /* If I <= Imax/2, we double */ - loctt->i_cur <<= 1; - PRINTF("I << 1 = %lu\n", (unsigned long)loctt->i_cur); - } else { - /* We may have I > Imax/2 but I <> Imax, in which case we set to Imax - * This will happen when I didn't start as Imin (before the first reset) */ - loctt->i_cur = TRICKLE_TIMER_INTERVAL_MAX(loctt); - PRINTF("I = Imax = %lu\n", (unsigned long)loctt->i_cur); - } - - /* Random t in [I/2, I) */ - loc_clock = get_t(loctt->i_cur); - - PRINTF("trickle_timer doubling: t=%lu\n", (unsigned long)loc_clock); - -#if TRICKLE_TIMER_COMPENSATE_DRIFT - /* Schedule for t ticks after the previous interval's end, not after now. If - * that is in the past, schedule in 0 */ - loc_clock = (last_end + loc_clock) - clock_time(); - PRINTF("trickle_timer doubling: at %lu, in %ld ticks\n", - (unsigned long)clock_time(), (signed long)loc_clock); - if(loc_clock > (TRICKLE_TIMER_CLOCK_MAX >> 1)) { - /* Oops, that's in the past */ - loc_clock = 0; - PRINTF("trickle_timer doubling: Was in the past. Compensating\n"); - } - ctimer_set(&loctt->ct, loc_clock, fire, loctt); - - /* Store the actual interval start (absolute time), we need it later. - * We pretend that it started at the same time when the last one ended */ - loctt->i_start = last_end; -#else - /* Assumed that the previous interval's end is 'now' and schedule in t ticks - * after 'now', ignoring potential offsets */ - ctimer_set(&loctt->ct, loc_clock, fire, loctt); - /* Store the actual interval start (absolute time), we need it later */ - loctt->i_start = loctt->ct.etimer.timer.start; -#endif - - PRINTF("trickle_timer doubling: Last end %lu, new end %lu, for %lu, I=%lu\n", - (unsigned long)last_end, - (unsigned long)TRICKLE_TIMER_INTERVAL_END(loctt), - (unsigned long)(loctt->ct.etimer.timer.start + - loctt->ct.etimer.timer.interval), - (unsigned long)(loctt->i_cur)); -} -/*---------------------------------------------------------------------------*/ -/* Called by the ctimer module at time t within the current interval. ptr is - * a pointer to the struct trickle_timer of interest */ -static void -fire(void *ptr) -{ - /* 'cast' c to a struct trickle_timer */ - loctt = (struct trickle_timer *)ptr; - - PRINTF("trickle_timer fire: at %lu (was for %lu)\n", - (unsigned long)clock_time(), - (unsigned long)(loctt->ct.etimer.timer.start + - loctt->ct.etimer.timer.interval)); - - if(loctt->cb) { - /* - * Call the protocol's TX callback, with the suppression status as an - * argument. - */ - PRINTF("trickle_timer fire: Suppression Status %u (%u < %u)\n", - TRICKLE_TIMER_PROTO_TX_ALLOW(loctt), loctt->c, loctt->k); - loctt->cb(loctt->cb_arg, TRICKLE_TIMER_PROTO_TX_ALLOW(loctt)); - } - - if(trickle_timer_is_running(loctt)) { - schedule_for_end(loctt); - } -} -/*---------------------------------------------------------------------------*/ -/* New trickle interval, either due to a newly set trickle timer or due to an - * inconsistency. Schedule 'fire' to be called in t ticks. */ -static void -new_interval(struct trickle_timer *tt) -{ - tt->c = 0; - - /* Random t in [I/2, I) */ - loc_clock = get_t(tt->i_cur); - - ctimer_set(&tt->ct, loc_clock, fire, tt); - - /* Store the actual interval start (absolute time), we need it later */ - tt->i_start = tt->ct.etimer.timer.start; - PRINTF("trickle_timer new interval: at %lu, ends %lu, ", - (unsigned long)clock_time(), - (unsigned long)TRICKLE_TIMER_INTERVAL_END(tt)); - PRINTF("t=%lu, I=%lu\n", (unsigned long)loc_clock, (unsigned long)tt->i_cur); -} -/*---------------------------------------------------------------------------*/ -/* Functions to be called by the protocol implementation */ -/*---------------------------------------------------------------------------*/ -void -trickle_timer_consistency(struct trickle_timer *tt) -{ - if(tt->c < 0xFF) { - tt->c++; - } - PRINTF("trickle_timer consistency: c=%u\n", tt->c); -} -/*---------------------------------------------------------------------------*/ -void -trickle_timer_inconsistency(struct trickle_timer *tt) -{ - /* "If I is equal to Imin when Trickle hears an "inconsistent" transmission, - * Trickle does nothing." */ - if(tt->i_cur != tt->i_min) { - PRINTF("trickle_timer inconsistency\n"); - tt->i_cur = tt->i_min; - - new_interval(tt); - } -} -/*---------------------------------------------------------------------------*/ -uint8_t -trickle_timer_config(struct trickle_timer *tt, clock_time_t i_min, - uint8_t i_max, uint8_t k) -{ -#if TRICKLE_TIMER_ERROR_CHECKING - /* - * Although in theory Imin=1 is a valid value, it would break get_t() and - * doesn't make sense anyway. Thus Valid Imin values are in the range: - * 1 < Imin <= (TRICKLE_TIMER_CLOCK_MAX >> 1) + 1 - */ - if(TRICKLE_TIMER_IMIN_IS_BAD(i_min)) { - PRINTF("trickle_timer config: Bad Imin value\n"); - return TRICKLE_TIMER_ERROR; - } - - if(tt == NULL || i_max == 0 || k == 0) { - PRINTF("trickle_timer config: Bad arguments\n"); - return TRICKLE_TIMER_ERROR; - } - - /* - * If clock_time_t is not wide enough to store Imin << Imax, we adjust Imax - * - * This means that 'we' are likely to have a different Imax than 'them' - * See RFC 6206, sec 6.3 for the consequences of this situation - */ - if(TRICKLE_TIMER_IPAIR_IS_BAD(i_min, i_max)) { - PRINTF("trickle_timer config: %lu << %u would exceed clock boundaries. ", - (unsigned long)i_min, i_max); - - /* For this Imin, get the maximum sane Imax */ - i_max = max_imax(i_min); - PRINTF("trickle_timer config: Using Imax=%u\n", i_max); - } -#endif - - tt->i_min = i_min; - tt->i_max = i_max; - tt->i_max_abs = i_min << i_max; - tt->k = k; - - PRINTF("trickle_timer config: Imin=%lu, Imax=%u, k=%u\n", - (unsigned long)tt->i_min, tt->i_max, tt->k); - - return TRICKLE_TIMER_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -uint8_t -trickle_timer_set(struct trickle_timer *tt, trickle_timer_cb_t proto_cb, - void *ptr) -{ -#if TRICKLE_TIMER_ERROR_CHECKING - /* Sanity checks */ - if(tt == NULL || proto_cb == NULL) { - PRINTF("trickle_timer set: Bad arguments\n"); - return TRICKLE_TIMER_ERROR; - } -#endif - - tt->cb = proto_cb; - tt->cb_arg = ptr; - - /* Random I in [Imin , Imax] */ - tt->i_cur = tt->i_min + - (tt_rand() % (TRICKLE_TIMER_INTERVAL_MAX(tt) - tt->i_min + 1)); - - PRINTF("trickle_timer set: I=%lu in [%lu , %lu]\n", (unsigned long)tt->i_cur, - (unsigned long)tt->i_min, - (unsigned long)TRICKLE_TIMER_INTERVAL_MAX(tt)); - - new_interval(tt); - - PRINTF("trickle_timer set: at %lu, ends %lu, t=%lu in [%lu , %lu)\n", - (unsigned long)tt->i_start, - (unsigned long)TRICKLE_TIMER_INTERVAL_END(tt), - (unsigned long)tt->ct.etimer.timer.interval, - (unsigned long)tt->i_cur >> 1, (unsigned long)tt->i_cur); - - return TRICKLE_TIMER_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/lib/trickle-timer.h b/os/lib/trickle-timer.h deleted file mode 100644 index 20b694e1e..000000000 --- a/os/lib/trickle-timer.h +++ /dev/null @@ -1,514 +0,0 @@ -/* - * Copyright (c) 2012, George Oikonomou - - * 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 - * Trickle timer library header file. - * - * \author - * George Oikonomou - - */ - -/** \addtogroup lib - * @{ */ - -/** - * \defgroup trickle-timer Trickle timers - * - * This library implements timers which behave in accordance with RFC 6206 - * "The Trickle Algorithm" (http://tools.ietf.org/html/rfc6206) - * - * Protocols wishing to use trickle timers, may use this library instead of - * implementing the trickle algorithm internally. - * - * The protocol implementation will declare one (or more) variable(s) of type - * struct ::trickle_timer and will then populate its fields by calling - * trickle_timer_config(). trickle_timer_set() will start the timer. - * - * When the timer reaches time t within the current trickle interval, the - * library will call a protocol-provided callback, which will signal to the - * protocol that it is time to TX (see algorithm step 4 in the RFC). - * - * The proto does not need to check the suppression conditions. This is done by - * the library and if TX must be suppressed, the callback won't be called at - * all. - * - * The library also provides functions to be called when the protocol hears a - * 'consistent' or 'inconsistent' message and when an 'external event' occurs - * (in this context, those terms have the exact same meaning as in the RFC). - * - * @{ - */ - -#ifndef TRICKLE_TIMER_H_ -#define TRICKLE_TIMER_H_ - -#include "contiki.h" -#include "sys/ctimer.h" -/*---------------------------------------------------------------------------*/ -/* Trickle Timer Library Constants */ -/*---------------------------------------------------------------------------*/ -/** - * \name Trickle Timer Library: Constants - * @{ - */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Set as value of k to disable suppression - */ -#define TRICKLE_TIMER_INFINITE_REDUNDANCY 0x00 - -#define TRICKLE_TIMER_ERROR 0 -#define TRICKLE_TIMER_SUCCESS 1 - -/** - * \brief Use as the value of TRICKLE_TIMER_MAX_IMAX_WIDTH to enable the - * generic 'Find max Imax' routine - */ -#define TRICKLE_TIMER_MAX_IMAX_GENERIC 0 -/** - * \brief Use as the value of TRICKLE_TIMER_MAX_IMAX_WIDTH to enable the 16-bit - * 'Find max Imax' routine - */ -#define TRICKLE_TIMER_MAX_IMAX_16_BIT 1 -/** - * \brief Use as the value of TRICKLE_TIMER_MAX_IMAX_WIDTH to enable the 32-bit - * 'Find max Imax' routine - */ -#define TRICKLE_TIMER_MAX_IMAX_32_BIT 2 - -/** - * \brief Constants used as values for the \e suppress param of - * trickle_timer_cb_t - */ -#define TRICKLE_TIMER_TX_SUPPRESS 0 -#define TRICKLE_TIMER_TX_OK 1 - -/** - * \brief A trickle timer is considered 'stopped' when - * i_cur == TRICKLE_TIMER_IS_STOPPED. - * - * trickle_timer_stop() must be used to correctly disable a trickle timer. - * Do NOT set the value of i_cur to 0 directly, as this will fail to stop the - * timer. - */ -#define TRICKLE_TIMER_IS_STOPPED 0 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Controls whether the library will try to compensate for time drifts - * caused by getting called later than scheduled. - * - * 1: Enabled (default). 0: Disabled - * - * To override the default, define TRICKLE_TIMER_CONF_COMPENSATE_DRIFT in - * contiki-conf.h - * - * Bear in mind that this controls the behaviour of the entire library (i.e. - * all trickle timers) and not of an individual timer - */ -#ifdef TRICKLE_TIMER_CONF_COMPENSATE_DRIFT -#define TRICKLE_TIMER_COMPENSATE_DRIFT TRICKLE_TIMER_CONF_COMPENSATE_DRIFT -#else -#define TRICKLE_TIMER_COMPENSATE_DRIFT 1 -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief Turns on support for 4-byte wide, unsigned random numbers - * - * We need this for platforms which have a 4-byte wide clock_time_t. For those - * platforms and if Imin << Imax is GT 0xFFFF, random_rand alone is not always - * enough to generate a correct t in [I/2, I). Specifically, we need wide - * randoms when I > 0x1FFFF. - * - * For platforms with a 2-byte wide clock_time_t, this can be defined as 0 - * to reduce code footprint and increase speed. - */ -#ifdef TRICKLE_TIMER_CONF_WIDE_RAND -#define TRICKLE_TIMER_WIDE_RAND TRICKLE_TIMER_CONF_WIDE_RAND -#else -#define TRICKLE_TIMER_WIDE_RAND 1 -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief Selects a flavor for the 'Find maximum Imax' (max_imax) function. - * - * When configuring a new trickle timer, the library verifies that the (Imin , - * Imax) pair will fit in the platform's clock_time_t boundaries. If this is - * not the case, Imax will be adjusted down. In order to achieve this, we use - * an internal function which is a slight variant of a standard 'Count Leading - * Zeros'. - * - * This functionality is disabled when ::TRICKLE_TIMER_ERROR_CHECKING is 0 - * - * This define helps us generate, at the pre-processing stage, the desired - * version of this function. We start with a generic version by default. The - * platform's contiki-conf.h can change this to use the 16- or 32-bit specific - * flavor by defining TRICKLE_TIMER_CONF_MAX_IMAX_WIDTH. - * - * Depending on the toolchain, the generic variant may actually result in a - * smaller code size. Do your own experiments. - * - * TRICKLE_TIMER_MAX_IMAX_GENERIC (0): Generic function which will work - * regardless whether the platform uses a 16 or 32 bit wide clock type - * - * TRICKLE_TIMER_MAX_IMAX_16_BIT (1): You can select this in your - * contiki-conf.h if your platform's clock_time_t is 16 bits wide - * - * TRICKLE_TIMER_MAX_IMAX_32_BIT (2): You can select this in your - * contiki-conf.h if your platform's clock_time_t is 32 bits wide - */ -#ifdef TRICKLE_TIMER_CONF_MAX_IMAX_WIDTH -#define TRICKLE_TIMER_MAX_IMAX_WIDTH TRICKLE_TIMER_CONF_MAX_IMAX_WIDTH -#else -#define TRICKLE_TIMER_MAX_IMAX_WIDTH TRICKLE_TIMER_MAX_IMAX_GENERIC -#endif - -/** - * \brief Enables/Disables error checking - * - * 1: Enabled (default). The library checks the validity of Imin and Imax - * 0: Disabled. All error checking is turned off. This reduces code size. - */ -#ifdef TRICKLE_TIMER_CONF_ERROR_CHECKING -#define TRICKLE_TIMER_ERROR_CHECKING TRICKLE_TIMER_CONF_ERROR_CHECKING -#else -#define TRICKLE_TIMER_ERROR_CHECKING 1 -#endif -/*---------------------------------------------------------------------------*/ -/* Trickle Timer Library Macros */ -/*---------------------------------------------------------------------------*/ -/** - * \name Trickle Timer Library: Macros - * @{ - */ -/** - * \brief cross-platform method to get the maximum clock_time_t value - */ -#define TRICKLE_TIMER_CLOCK_MAX ((clock_time_t)~0) - - -/** - * \brief Checks if the trickle timer's suppression feature is enabled - * - * \param tt A pointer to a ::trickle_timer structure - * - * \retval non-zero Suppression is enabled - * \retval 0 Suppression is disabled - */ -#define TRICKLE_TIMER_SUPPRESSION_ENABLED(tt) \ - ((tt)->k != TRICKLE_TIMER_INFINITE_REDUNDANCY) - -/** - * \brief Checks if the trickle timer's suppression feature is disabled - * - * \param tt A pointer to a ::trickle_timer structure - * - * \retval non-zero Suppression is disabled - * \retval 0 Suppression is enabled - */ -#define TRICKLE_TIMER_SUPPRESSION_DISABLED(tt) \ - ((tt)->k == TRICKLE_TIMER_INFINITE_REDUNDANCY) - -/** - * \brief Determines whether the protocol must go ahead with a transmission - * - * \param tt A pointer to a ::trickle_timer structure - * - * \retval non-zero Go ahead with TX - * \retval 0 Suppress - */ -#define TRICKLE_TIMER_PROTO_TX_ALLOW(tt) \ - (TRICKLE_TIMER_SUPPRESSION_DISABLED(tt) || ((tt)->c < (tt)->k)) - -/** - * \brief Determines whether the protocol must suppress a transmission - * - * \param tt A pointer to a ::trickle_timer structure - * - * \retval non-zero Suppress - * \retval 0 Go ahead with TX - */ -#define TRICKLE_TIMER_PROTO_TX_SUPPRESS(tt) \ - (TRICKLE_TIMER_SUPPRESSION_ENABLED(tt) && ((tt)->c >= (tt)->k)) - -/** - * \brief Returns a timer's maximum interval size (Imin << Imax) as a number of - * clock ticks - * - * \param tt A pointer to a ::trickle_timer structure - * - * \return Maximum trickle interval length in clock ticks - */ -#define TRICKLE_TIMER_INTERVAL_MAX(tt) ((tt)->i_max_abs) - -/** - * \brief Returns the current trickle interval's end (absolute time in ticks) - * - * \param tt A pointer to a ::trickle_timer structure - * - * \return The absolute number of clock ticks when the current trickle interval - * will expire - */ -#define TRICKLE_TIMER_INTERVAL_END(tt) ((tt)->i_start + (tt)->i_cur) - -/** - * \brief Checks whether an Imin value is suitable considering the various - * restrictions imposed by our platform's clock as well as by the library itself - * - * \param imin An Imin value in clock ticks - * - * \retval 1 The Imin value is valid - * \retval 0 The Imin value is invalid - */ -#define TRICKLE_TIMER_IMIN_IS_OK(imin) \ - ((imin > 1) && (i_min <= (TRICKLE_TIMER_CLOCK_MAX >> 1))) - -/** - * \brief Checks whether an Imin value is invalid considering the various - * restrictions imposed by our platform's clock as well as by the library itself - * - * \param imin An Imin value in clock ticks - * - * \retval 1 The Imin value is invalid - * \retval 0 The Imin value is valid - */ -#define TRICKLE_TIMER_IMIN_IS_BAD(imin) \ - ((imin < 2) || (i_min > (TRICKLE_TIMER_CLOCK_MAX >> 1))) - -/** - * \brief Checks whether Imin << Imax is unsuitable considering the boundaries - * of our platform's clock_time_t - * - * \param i_min Imin value - * \param i_max Maximum number of doublings - * - * \retval non-zero The pair would exceed clock boundaries - * \retval 0 The pair is suitable for the platform - * - * Timers scheduled far in the future can be perceived as being scheduled in - * the past. - * Thus, we limit Imin << Imax to be LEQ(TRICKLE_TIMER_CLOCK_MAX >> 1) + 1 - */ -#define TRICKLE_TIMER_IPAIR_IS_BAD(i_min, i_max) \ - ((TRICKLE_TIMER_CLOCK_MAX >> (i_max + 1)) < i_min - 1) -/** @} */ -/*---------------------------------------------------------------------------*/ -/* Trickle Timer Library Data Representation */ -/*---------------------------------------------------------------------------*/ -/** - * \name Trickle Timer Library: Data Representation - * @{ - */ - -/** - * \brief typedef for a callback function to be defined in the protocol's - * implementation. - * - * Those callbaks are stored as a function pointer inside a ::trickle_timer - * structure and are called by the library at time t within the current trickle - * interval. - * - * Some protocols may rely on multiple trickle timers. For this reason, this - * function's argument will be an opaque pointer, aiming to help the protocol - * determine which timer triggered the call. - * - * The \e suppress argument is used so that the library can signal the protocol - * whether it should TX or suppress - */ -typedef void (* trickle_timer_cb_t)(void *ptr, uint8_t suppress); - -/** - * \struct trickle_timer - * - * A trickle timer. - * - * This structure is used for declaring a trickle timer. In order for the timer - * to start running, the protocol must first populate the structure's fields - * by calling trickle_timer_set(). Protocol implementations must NOT modify the - * contents of this structure directly. - * - * Protocol developers must also be careful to specify the values of Imin and - * Imax in such a way that the maximum interval size does not exceed the - * boundaries of clock_time_t - */ -struct trickle_timer { - clock_time_t i_min; /**< Imin: Clock ticks */ - clock_time_t i_cur; /**< I: Current interval in clock_ticks */ - clock_time_t i_start; /**< Start of this interval (absolute clock_time) */ - clock_time_t i_max_abs; /**< Maximum interval size in clock ticks (and not in - number of doublings). This is a cached value of - Imin << Imax used internally, so that we can - have direct access to the maximum interval size - without having to calculate it all the time */ - struct ctimer ct; /**< A \ref ctimer used internally */ - trickle_timer_cb_t cb; /**< Protocol's own callback, invoked at time t - within the current interval */ - void *cb_arg; /**< Opaque pointer to be used as the argument of the - protocol's callback */ - uint8_t i_max; /**< Imax: Max number of doublings */ - uint8_t k; /**< k: Redundancy Constant */ - uint8_t c; /**< c: Consistency Counter */ -}; -/** @} */ -/*---------------------------------------------------------------------------*/ -/* Trickle Timer Library Functions */ -/*---------------------------------------------------------------------------*/ -/** - * \name Trickle Timer Library: Functions called by protocol implementations - * @{ - */ - -/** - * \brief Configure a trickle timer - * \param tt A pointer to a ::trickle_timer structure - * \param i_min The timer's Imin configuration parameter, in units of - * clock_time_t - * \param i_max The timer's Imax configuration parameter (maximum number of - * doublings), specified as number of doublings - * \param k The timer's K (redundancy constant). If the value of K - * equals #TRICKLE_TIMER_INFINITE_REDUNDANCY, message - * suppression will be disabled - * \retval 0 Error (Bad argument) - * \retval non-zero Success. - * - * This function is used to set the initial configuration for a trickle timer. - * A trickle timer MUST be configured before the protocol calls - * trickle_timer_set(). - * - * If Imin<ct)); \ - (tt)->i_cur = TRICKLE_TIMER_IS_STOPPED; \ -} while(0) - -/** - * \brief To be called by the protocol when it hears a consistent - * transmission - * \param tt A pointer to a ::trickle_timer structure - * - * When the trickle-based protocol hears a consistent transmission it must call - * this function to increment trickle's consistency counter, which is later - * used to determine whether the protocol must suppress or go ahead with its - * own transmissions. - * - * As the trickle timer library implementation may change in the future to - * perform further tasks upon reception of a consistent transmission, the - * protocol's implementation MUST use this call to increment the consistency - * counter instead of directly writing to the structure's field. - */ -void trickle_timer_consistency(struct trickle_timer *tt); - -/** - * \brief To be called by the protocol when it hears an inconsistent - * transmission - * \param tt A pointer to a ::trickle_timer structure - * - * When the protocol hears an inconsistent transmission, it must call this - * function to notify the library that the timer must be reset. - * - * Before resetting the timer, the library will perform a set of checks. - * Therefore, it is important that the protocol calls this function instead of - * trying to reset the timer by itself. - */ -void trickle_timer_inconsistency(struct trickle_timer *tt); - -/** - * \brief To be called by the protocol when an external event occurs that - * should trigger a timer reset - * \param tt A pointer to a ::trickle_timer structure - * - * When an external event occurs that should result in a timer reset, the - * protocol implementation must call this function to notify the library. - * - * Before resetting the timer, the library will perform a set of checks. - * Therefore, it is important that the protocol calls this function instead of - * trying to reset the timer by itself. - */ -#define trickle_timer_reset_event(tt) trickle_timer_inconsistency(tt) - -/** - * \brief To be called in order to determine whether a trickle timer is - * running - * \param tt A pointer to a ::trickle_timer structure - * \retval 0 The timer is stopped - * \retval non-zero The timer is running - * - */ -#define trickle_timer_is_running(tt) ((tt)->i_cur != TRICKLE_TIMER_IS_STOPPED) - -/** @} */ - -#endif /* TRICKLE_TIMER_H_ */ -/** @} */ -/** @} */ diff --git a/os/net/app-layer/coap/Makefile.coap b/os/net/app-layer/coap/Makefile.coap deleted file mode 100644 index 4afecf78a..000000000 --- a/os/net/app-layer/coap/Makefile.coap +++ /dev/null @@ -1,31 +0,0 @@ -MAKE_WITH_DTLS ?= 0 - -ifeq ($(MAKE_WITH_DTLS),1) - - TINYDTLS_PATH := os/net/security/tinydtls - - ifeq (${wildcard $(CONTIKI)/$(TINYDTLS_PATH)/Makefile},) - ${error Could not find the tinyDTLS submodule. Please run "git submodule update --init" and try again} - endif - - CFLAGS += -DWITH_DTLS=1 - - MODULES += os/net/app-layer/coap/tinydtls-support - MODULES += $(TINYDTLS_PATH) ${addprefix $(TINYDTLS_PATH)/,aes sha2 ecc} - - MAKE_COAP_DTLS_KEYSTORE_NONE := 0 - MAKE_COAP_DTLS_KEYSTORE_SIMPLE := 1 - MAKE_COAP_DTLS_KEYSTORE_LWM2M := 2 - - MAKE_COAP_DTLS_KEYSTORE ?= MAKE_COAP_DTLS_KEYSTORE_LWM2M - - ifeq ($(MAKE_COAP_DTLS_KEYSTORE),MAKE_COAP_DTLS_KEYSTORE_SIMPLE) - CFLAGS += -DCOAP_DTLS_KEYSTORE_CONF_WITH_SIMPLE=1 - else ifeq ($(MAKE_COAP_DTLS_KEYSTORE),MAKE_COAP_DTLS_KEYSTORE_LWM2M) - CFLAGS += -DCOAP_DTLS_KEYSTORE_CONF_WITH_LWM2M=1 - else ifeq ($(MAKE_COAP_DTLS_KEYSTORE),MAKE_COAP_DTLS_KEYSTORE_NONE) - # No C flag needed for no keystore - else - ${error Unsupported CoAP DTLS keystore: $(MAKE_COAP_DTLS_KEYSTORE)} - endif -endif diff --git a/os/net/app-layer/coap/coap-block1.c b/os/net/app-layer/coap/coap-block1.c deleted file mode 100644 index 600c09b27..000000000 --- a/os/net/app-layer/coap/coap-block1.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2014, Lars Schmertmann . - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP module for block 1 handling - * \author - * Lars Schmertmann - */ - -/** - * \addtogroup coap - * @{ - */ - -#include -#include - -#include "coap.h" -#include "coap-block1.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap" -#define LOG_LEVEL LOG_LEVEL_COAP - -/*---------------------------------------------------------------------------*/ - -/** - * \brief Block 1 support within a coap-ressource - * - * This function will help you to use block 1. If target is null - * error handling and response configuration is active. On return - * value 0, the last block was recived, while on return value 1 - * more blocks will follow. With target, len and maxlen this - * function will assemble the blocks. - * - * You can find an example in: - * examples/er-rest-example/resources/res-b1-sep-b2.c - * - * \param request Request pointer from the handler - * \param response Response pointer from the handler - * \param target Pointer to the buffer where the request payload can be assembled - * \param len Pointer to the variable, where the function stores the actual length - * \param max_len Length of the "target"-Buffer - * - * \return 0 if initialisation was successful - * -1 if initialisation failed - */ -int -coap_block1_handler(coap_message_t *request, coap_message_t *response, - uint8_t *target, size_t *len, size_t max_len) -{ - const uint8_t *payload = 0; - int pay_len = coap_get_payload(request, &payload); - - if(!pay_len || !payload) { - coap_status_code = BAD_REQUEST_4_00; - coap_error_message = "NoPayload"; - return -1; - } - - if(request->block1_offset + pay_len > max_len) { - coap_status_code = REQUEST_ENTITY_TOO_LARGE_4_13; - coap_error_message = "Message to big"; - return -1; - } - - if(target && len) { - memcpy(target + request->block1_offset, payload, pay_len); - *len = request->block1_offset + pay_len; - } - - if(coap_is_option(request, COAP_OPTION_BLOCK1)) { - LOG_DBG("Blockwise: block 1 request: Num: %"PRIu32 - ", More: %u, Size: %u, Offset: %"PRIu32"\n", - request->block1_num, - request->block1_more, - request->block1_size, - request->block1_offset); - - coap_set_header_block1(response, request->block1_num, request->block1_more, request->block1_size); - if(request->block1_more) { - coap_set_status_code(response, CONTINUE_2_31); - return 1; - } - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-block1.h b/os/net/app-layer/coap/coap-block1.h deleted file mode 100644 index 50638ef66..000000000 --- a/os/net/app-layer/coap/coap-block1.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2014, Lars Schmertmann . - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP module for block 1 handling - * \author - * Lars Schmertmann - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_BLOCK1_H_ -#define COAP_BLOCK1_H_ - -#include "coap.h" -#include -#include - -int coap_block1_handler(coap_message_t *request, coap_message_t *response, - uint8_t *target, size_t *len, size_t max_len); - -#endif /* COAP_BLOCK1_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-blocking-api.c b/os/net/app-layer/coap/coap-blocking-api.c deleted file mode 100644 index 9fd691d74..000000000 --- a/os/net/app-layer/coap/coap-blocking-api.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP implementation for the REST Engine. - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#include "coap-engine.h" -#include "coap-blocking-api.h" -#include "sys/cc.h" -#include -#include -#include -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap" -#define LOG_LEVEL LOG_LEVEL_COAP - -/*---------------------------------------------------------------------------*/ -/*- Client Part -------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -void -coap_blocking_request_callback(void *callback_data, coap_message_t *response) -{ - coap_blocking_request_state_t *blocking_state = (coap_blocking_request_state_t *)callback_data; - - blocking_state->state.response = response; - process_poll(blocking_state->process); -} -/*---------------------------------------------------------------------------*/ -PT_THREAD(coap_blocking_request - (coap_blocking_request_state_t *blocking_state, process_event_t ev, - coap_endpoint_t *remote_ep, - coap_message_t *request, - coap_blocking_response_handler_t request_callback)) -{ - /* Before PT_BEGIN in order to not be a local variable in the PT_Thread and maintain it */ - coap_request_state_t *state = &blocking_state->state; - - PT_BEGIN(&blocking_state->pt); - - state->block_num = 0; - state->response = NULL; - blocking_state->process = PROCESS_CURRENT(); - - state->more = 0; - state->res_block = 0; - state->block_error = 0; - - do { - request->mid = coap_get_mid(); - if((state->transaction = coap_new_transaction(request->mid, remote_ep))) { - state->transaction->callback = coap_blocking_request_callback; - state->transaction->callback_data = blocking_state; - - if(state->block_num > 0) { - coap_set_header_block2(request, state->block_num, 0, - COAP_MAX_CHUNK_SIZE); - } - state->transaction->message_len = coap_serialize_message(request, - state-> - transaction-> - message); - - coap_send_transaction(state->transaction); - LOG_DBG("Requested #%"PRIu32" (MID %u)\n", state->block_num, request->mid); - - PT_YIELD_UNTIL(&blocking_state->pt, ev == PROCESS_EVENT_POLL); - - if(!state->response) { - LOG_WARN("Server not responding\n"); - state->status = COAP_REQUEST_STATUS_TIMEOUT; - PT_EXIT(&blocking_state->pt); - } - - coap_get_header_block2(state->response, &state->res_block, &state->more, NULL, NULL); - - LOG_DBG("Received #%"PRIu32"%s (%u bytes)\n", state->res_block, state->more ? "+" : "", - state->response->payload_len); - if(state->more) { - state->status = COAP_REQUEST_STATUS_MORE; - } else { - state->status = COAP_REQUEST_STATUS_RESPONSE; - } - - if(state->res_block == state->block_num) { - request_callback(state->response); - ++(state->block_num); - } else { - LOG_WARN("WRONG BLOCK %"PRIu32"/%"PRIu32"\n", - state->res_block, state->block_num); - ++(state->block_error); - } - } else { - LOG_WARN("Could not allocate transaction buffer"); - PT_EXIT(&blocking_state->pt); - } - } while(state->more && (state->block_error) < COAP_MAX_ATTEMPTS); - - if((state->block_error) >= COAP_MAX_ATTEMPTS) { - /* failure - now we give up */ - state->status = COAP_REQUEST_STATUS_BLOCK_ERROR; - } else { - /* No more blocks, request finished */ - state->status = COAP_REQUEST_STATUS_FINISHED; - } - PT_END(&blocking_state->pt); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-blocking-api.h b/os/net/app-layer/coap/coap-blocking-api.h deleted file mode 100644 index 716a261b5..000000000 --- a/os/net/app-layer/coap/coap-blocking-api.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_BLOCKING_API_H_ -#define COAP_BLOCKING_API_H_ - -#include "sys/pt.h" -#include "coap-transactions.h" -#include "coap-request-state.h" - -/*---------------------------------------------------------------------------*/ -/*- Client Part -------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -typedef struct coap_blocking_request_state { - coap_request_state_t state; - struct pt pt; - struct process *process; -} coap_blocking_request_state_t; - -typedef void (* coap_blocking_response_handler_t)(coap_message_t *response); - -PT_THREAD(coap_blocking_request - (coap_blocking_request_state_t *blocking_state, process_event_t ev, - coap_endpoint_t *remote, - coap_message_t *request, - coap_blocking_response_handler_t request_callback)); - -#define COAP_BLOCKING_REQUEST(server_endpoint, request, chunk_handler) \ - { \ - static coap_blocking_request_state_t blocking_state; \ - PT_SPAWN(process_pt, &blocking_state.pt, \ - coap_blocking_request(&blocking_state, ev, \ - server_endpoint, \ - request, chunk_handler) \ - ); \ - } - -#endif /* COAP_BLOCKING_API_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-callback-api.c b/os/net/app-layer/coap/coap-callback-api.c deleted file mode 100644 index 74585ccb3..000000000 --- a/os/net/app-layer/coap/coap-callback-api.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2016, SICS Swedish ICT - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Callback API for doing CoAP requests - * Adapted from the blocking API - * \author - * Joakim Eriksson, joakime@sics.se - */ - -/** - * \addtogroup coap - * @{ - */ - -#include "coap-engine.h" -#include "coap-callback-api.h" -#include "coap-transactions.h" -#include "sys/cc.h" -#include -#include -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap" -#define LOG_LEVEL LOG_LEVEL_COAP - -static void coap_request_callback(void *callback_data, coap_message_t *response); - -/*---------------------------------------------------------------------------*/ - -static int -progress_request(coap_callback_request_state_t *callback_state) { - coap_request_state_t *state = &callback_state->state; - coap_message_t *request = state->request; - request->mid = coap_get_mid(); - if((state->transaction = - coap_new_transaction(request->mid, state->remote_endpoint))) { - state->transaction->callback = coap_request_callback; - state->transaction->callback_data = state; - - if(state->block_num > 0) { - coap_set_header_block2(request, state->block_num, 0, - COAP_MAX_CHUNK_SIZE); - } - state->transaction->message_len = - coap_serialize_message(request, state->transaction->message); - - coap_send_transaction(state->transaction); - LOG_DBG("Requested #%"PRIu32" (MID %u)\n", state->block_num, request->mid); - return 1; - } - return 0; -} - -/*---------------------------------------------------------------------------*/ - -static void -coap_request_callback(void *callback_data, coap_message_t *response) -{ - coap_callback_request_state_t *callback_state = (coap_callback_request_state_t*)callback_data; - coap_request_state_t *state = &callback_state->state; - - uint32_t res_block1; - - state->response = response; - - LOG_DBG("request callback\n"); - - if(!state->response) { - LOG_WARN("Server not responding giving up...\n"); - state->status = COAP_REQUEST_STATUS_TIMEOUT; - callback_state->callback(callback_state); - return; - } - - /* Got a response */ - coap_get_header_block2(state->response, &state->res_block, &state->more, NULL, NULL); - coap_get_header_block1(state->response, &res_block1, NULL, NULL, NULL); - - LOG_DBG("Received #%lu%s B1:%lu (%u bytes)\n", - (unsigned long)state->res_block, (unsigned)state->more ? "+" : "", - (unsigned long)res_block1, - state->response->payload_len); - - if(state->res_block == state->block_num) { - /* Call the callback function as we have more data */ - if(state->more) { - state->status = COAP_REQUEST_STATUS_MORE; - } else { - state->status = COAP_REQUEST_STATUS_RESPONSE; - } - callback_state->callback(callback_state); - /* this is only for counting BLOCK2 blocks.*/ - ++(state->block_num); - } else { - LOG_WARN("WRONG BLOCK %"PRIu32"/%"PRIu32"\n", state->res_block, state->block_num); - ++(state->block_error); - } - - if(state->more) { - if((state->block_error) < COAP_MAX_ATTEMPTS) { - progress_request(callback_state); - } else { - /* failure - now we give up and notify the callback */ - state->status = COAP_REQUEST_STATUS_BLOCK_ERROR; - callback_state->callback(callback_state); - } - } else { - /* No more blocks, finish and notify the callback */ - state->status = COAP_REQUEST_STATUS_FINISHED; - state->response = NULL; - callback_state->callback(callback_state); - } -} - -/*---------------------------------------------------------------------------*/ - -int -coap_send_request(coap_callback_request_state_t *callback_state, coap_endpoint_t *endpoint, - coap_message_t *request, - void (*callback)(coap_callback_request_state_t *callback_state)) -{ - coap_request_state_t *state = &callback_state->state; - - state->more = 0; - state->res_block = 0; - state->block_error = 0; - state->block_num = 0; - state->response = NULL; - state->request = request; - state->remote_endpoint = endpoint; - callback_state->callback = callback; - - return progress_request(callback_state); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-callback-api.h b/os/net/app-layer/coap/coap-callback-api.h deleted file mode 100644 index a9019aeb8..000000000 --- a/os/net/app-layer/coap/coap-callback-api.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2016, SICS Swedish ICT - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Callback API for doing CoAP requests - * Adapted from the blocking API - * \author - * Joakim Eriksson, joakime@sics.se - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_CALLBACK_API_H_ -#define COAP_CALLBACK_API_H_ - -#include "coap-engine.h" -#include "coap-transactions.h" -#include "coap-request-state.h" -#include "sys/cc.h" - -/*---------------------------------------------------------------------------*/ -/*- Client Part -------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -typedef struct coap_callback_request_state coap_callback_request_state_t; - -struct coap_callback_request_state { - coap_request_state_t state; - void (*callback)(coap_callback_request_state_t *state); -}; - -/** - * \brief Send a CoAP request to a remote endpoint - * \param callback_state The callback state to handle the CoAP request - * \param endpoint The destination endpoint - * \param request The request to be sent - * \param callback callback to execute when the response arrives or the timeout expires - * \return 1 if there is a transaction available to send, 0 otherwise - */ -int coap_send_request(coap_callback_request_state_t *callback_state, coap_endpoint_t *endpoint, - coap_message_t *request, - void (*callback)(coap_callback_request_state_t *callback_state)); - -#endif /* COAP_CALLBACK_API_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-conf.h b/os/net/app-layer/coap/coap-conf.h deleted file mode 100644 index 5b610dca3..000000000 --- a/os/net/app-layer/coap/coap-conf.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Collection of default configuration values. - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_CONF_H_ -#define COAP_CONF_H_ - -#include "contiki.h" - -/* - * The maximum buffer size that is provided for resource responses and must be - * respected due to the limited IP buffer. Larger data must be handled by the - * resource and will be sent chunk-wise through a TCP stream or CoAP blocks. - */ -#ifndef COAP_MAX_CHUNK_SIZE -#ifdef REST_MAX_CHUNK_SIZE -#define COAP_MAX_CHUNK_SIZE REST_MAX_CHUNK_SIZE -#else /* REST_MAX_CHUNK_SIZE */ -#define COAP_MAX_CHUNK_SIZE 64 -#endif /* REST_MAX_CHUNK_SIZE */ -#endif /* COAP_MAX_CHUNK_SIZE */ - -/* Define REST_MAX_CHUNK_SIZE for backward compatibility */ -#ifndef REST_MAX_CHUNK_SIZE -#define REST_MAX_CHUNK_SIZE COAP_MAX_CHUNK_SIZE -#endif /* REST_MAX_CHUNK_SIZE */ - -/* Features that can be disabled to achieve smaller memory footprint */ -#ifndef COAP_LINK_FORMAT_FILTERING -#define COAP_LINK_FORMAT_FILTERING 0 -#endif /* COAP_LINK_FORMAT_FILTERING */ - -#ifndef COAP_PROXY_OPTION_PROCESSING -#define COAP_PROXY_OPTION_PROCESSING 0 -#endif /* COAP_PROXY_OPTION_PROCESSING */ - -/* Listening port for the CoAP REST Engine */ -#ifndef COAP_SERVER_PORT -#define COAP_SERVER_PORT COAP_DEFAULT_PORT -#endif /* COAP_SERVER_PORT */ - -/* The number of concurrent messages that can be stored for retransmission in the transaction layer. */ -#ifndef COAP_MAX_OPEN_TRANSACTIONS -#define COAP_MAX_OPEN_TRANSACTIONS 4 -#endif /* COAP_MAX_OPEN_TRANSACTIONS */ - -/* Maximum number of failed request attempts before action */ -#ifndef COAP_MAX_ATTEMPTS -#define COAP_MAX_ATTEMPTS 4 -#endif /* COAP_MAX_ATTEMPTS */ - -/* Conservative size limit, as not all options have to be set at the same time. Check when Proxy-Uri option is used */ -#ifndef COAP_MAX_HEADER_SIZE /* Hdr CoF If-Match Obs Blo strings */ -#define COAP_MAX_HEADER_SIZE (4 + COAP_TOKEN_LEN + 3 + 1 + COAP_ETAG_LEN + 4 + 4 + 30) /* 65 */ -#endif /* COAP_MAX_HEADER_SIZE */ - -/* Number of observer slots (each takes abot xxx bytes) */ -#ifndef COAP_MAX_OBSERVERS -#define COAP_MAX_OBSERVERS COAP_MAX_OPEN_TRANSACTIONS - 1 -#endif /* COAP_MAX_OBSERVERS */ - -/* Interval in notifies in which NON notifies are changed to CON notifies to check client. */ -#ifdef COAP_CONF_OBSERVE_REFRESH_INTERVAL -#define COAP_OBSERVE_REFRESH_INTERVAL COAP_CONF_OBSERVE_REFRESH_INTERVAL -#else -#define COAP_OBSERVE_REFRESH_INTERVAL 20 -#endif /* COAP_OBSERVE_REFRESH_INTERVAL */ - -#endif /* COAP_CONF_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-constants.h b/os/net/app-layer/coap/coap-constants.h deleted file mode 100644 index f73a5b950..000000000 --- a/os/net/app-layer/coap/coap-constants.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Collection of constants specified in the CoAP standard. - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_CONSTANTS_H_ -#define COAP_CONSTANTS_H_ - -#define COAP_DEFAULT_PORT 5683 -#define COAP_DEFAULT_SECURE_PORT 5684 - -#define COAP_DEFAULT_MAX_AGE 60 -#define COAP_RESPONSE_TIMEOUT 3 -#define COAP_RESPONSE_RANDOM_FACTOR 1.5 -#define COAP_MAX_RETRANSMIT 4 - -#define COAP_HEADER_LEN 4 /* | version:0x03 type:0x0C tkl:0xF0 | code | mid:0x00FF | mid:0xFF00 | */ -#define COAP_TOKEN_LEN 8 /* The maximum number of bytes for the Token */ -#define COAP_ETAG_LEN 8 /* The maximum number of bytes for the ETag */ - -#define COAP_HEADER_VERSION_MASK 0xC0 -#define COAP_HEADER_VERSION_POSITION 6 -#define COAP_HEADER_TYPE_MASK 0x30 -#define COAP_HEADER_TYPE_POSITION 4 -#define COAP_HEADER_TOKEN_LEN_MASK 0x0F -#define COAP_HEADER_TOKEN_LEN_POSITION 0 - -#define COAP_HEADER_OPTION_DELTA_MASK 0xF0 -#define COAP_HEADER_OPTION_SHORT_LENGTH_MASK 0x0F - -/* CoAP message types */ -typedef enum { - COAP_TYPE_CON, /* confirmables */ - COAP_TYPE_NON, /* non-confirmables */ - COAP_TYPE_ACK, /* acknowledgements */ - COAP_TYPE_RST /* reset */ -} coap_message_type_t; - -/* CoAP request method codes */ -typedef enum { - COAP_GET = 1, - COAP_POST, - COAP_PUT, - COAP_DELETE -} coap_method_t; - -/* CoAP response codes */ -typedef enum { - NO_ERROR = 0, - - CREATED_2_01 = 65, /* CREATED */ - DELETED_2_02 = 66, /* DELETED */ - VALID_2_03 = 67, /* NOT_MODIFIED */ - CHANGED_2_04 = 68, /* CHANGED */ - CONTENT_2_05 = 69, /* OK */ - CONTINUE_2_31 = 95, /* CONTINUE */ - - BAD_REQUEST_4_00 = 128, /* BAD_REQUEST */ - UNAUTHORIZED_4_01 = 129, /* UNAUTHORIZED */ - BAD_OPTION_4_02 = 130, /* BAD_OPTION */ - FORBIDDEN_4_03 = 131, /* FORBIDDEN */ - NOT_FOUND_4_04 = 132, /* NOT_FOUND */ - METHOD_NOT_ALLOWED_4_05 = 133, /* METHOD_NOT_ALLOWED */ - NOT_ACCEPTABLE_4_06 = 134, /* NOT_ACCEPTABLE */ - PRECONDITION_FAILED_4_12 = 140, /* BAD_REQUEST */ - REQUEST_ENTITY_TOO_LARGE_4_13 = 141, /* REQUEST_ENTITY_TOO_LARGE */ - UNSUPPORTED_MEDIA_TYPE_4_15 = 143, /* UNSUPPORTED_MEDIA_TYPE */ - - INTERNAL_SERVER_ERROR_5_00 = 160, /* INTERNAL_SERVER_ERROR */ - NOT_IMPLEMENTED_5_01 = 161, /* NOT_IMPLEMENTED */ - BAD_GATEWAY_5_02 = 162, /* BAD_GATEWAY */ - SERVICE_UNAVAILABLE_5_03 = 163, /* SERVICE_UNAVAILABLE */ - GATEWAY_TIMEOUT_5_04 = 164, /* GATEWAY_TIMEOUT */ - PROXYING_NOT_SUPPORTED_5_05 = 165, /* PROXYING_NOT_SUPPORTED */ - - /* Erbium errors */ - MEMORY_ALLOCATION_ERROR = 192, - PACKET_SERIALIZATION_ERROR, - - /* Erbium hooks */ - MANUAL_RESPONSE, - PING_RESPONSE -} coap_status_t; - -/* CoAP header option numbers */ -typedef enum { - COAP_OPTION_IF_MATCH = 1, /* 0-8 B */ - COAP_OPTION_URI_HOST = 3, /* 1-255 B */ - COAP_OPTION_ETAG = 4, /* 1-8 B */ - COAP_OPTION_IF_NONE_MATCH = 5, /* 0 B */ - COAP_OPTION_OBSERVE = 6, /* 0-3 B */ - COAP_OPTION_URI_PORT = 7, /* 0-2 B */ - COAP_OPTION_LOCATION_PATH = 8, /* 0-255 B */ - COAP_OPTION_URI_PATH = 11, /* 0-255 B */ - COAP_OPTION_CONTENT_FORMAT = 12, /* 0-2 B */ - COAP_OPTION_MAX_AGE = 14, /* 0-4 B */ - COAP_OPTION_URI_QUERY = 15, /* 0-255 B */ - COAP_OPTION_ACCEPT = 17, /* 0-2 B */ - COAP_OPTION_LOCATION_QUERY = 20, /* 0-255 B */ - COAP_OPTION_BLOCK2 = 23, /* 1-3 B */ - COAP_OPTION_BLOCK1 = 27, /* 1-3 B */ - COAP_OPTION_SIZE2 = 28, /* 0-4 B */ - COAP_OPTION_PROXY_URI = 35, /* 1-1034 B */ - COAP_OPTION_PROXY_SCHEME = 39, /* 1-255 B */ - COAP_OPTION_SIZE1 = 60, /* 0-4 B */ -} coap_option_t; - -/* CoAP Content-Formats */ -typedef enum { - TEXT_PLAIN = 0, - TEXT_XML = 1, - TEXT_CSV = 2, - TEXT_HTML = 3, - IMAGE_GIF = 21, - IMAGE_JPEG = 22, - IMAGE_PNG = 23, - IMAGE_TIFF = 24, - AUDIO_RAW = 25, - VIDEO_RAW = 26, - APPLICATION_LINK_FORMAT = 40, - APPLICATION_XML = 41, - APPLICATION_OCTET_STREAM = 42, - APPLICATION_RDF_XML = 43, - APPLICATION_SOAP_XML = 44, - APPLICATION_ATOM_XML = 45, - APPLICATION_XMPP_XML = 46, - APPLICATION_EXI = 47, - APPLICATION_FASTINFOSET = 48, - APPLICATION_SOAP_FASTINFOSET = 49, - APPLICATION_JSON = 50, - APPLICATION_X_OBIX_BINARY = 51 -} coap_content_format_t; - -/** - * Resource flags for allowed methods and special functionalities. - */ -typedef enum { - NO_FLAGS = 0, - - /* methods to handle */ - METHOD_GET = (1 << 0), - METHOD_POST = (1 << 1), - METHOD_PUT = (1 << 2), - METHOD_DELETE = (1 << 3), - - /* special flags */ - HAS_SUB_RESOURCES = (1 << 4), - IS_SEPARATE = (1 << 5), - IS_OBSERVABLE = (1 << 6), - IS_PERIODIC = (1 << 7) -} coap_resource_flags_t; - -#endif /* COAP_CONSTANTS_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-endpoint.h b/os/net/app-layer/coap/coap-endpoint.h deleted file mode 100644 index 969791241..000000000 --- a/os/net/app-layer/coap/coap-endpoint.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2016-2018, SICS, Swedish ICT AB. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * API to address CoAP endpoints - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap-transport - * @{ - */ - -#ifndef COAP_ENDPOINT_H_ -#define COAP_ENDPOINT_H_ - -#include "contiki.h" -#include - -#ifndef COAP_ENDPOINT_CUSTOM -#include "net/ipv6/uip.h" - -typedef struct { - uip_ipaddr_t ipaddr; - uint16_t port; - uint8_t secure; -} coap_endpoint_t; -#endif /* COAP_ENDPOINT_CUSTOM */ - -/** - * \brief Copy a CoAP endpoint from one memory area to another. - * - * \param dest A pointer to a CoAP endpoint to copy to. - * \param src A pointer to a CoAP endpoint to copy from. - */ -void coap_endpoint_copy(coap_endpoint_t *dest, const coap_endpoint_t *src); - -/** - * \brief Compare two CoAP endpoints. - * - * \param e1 A pointer to the first CoAP endpoint. - * \param e2 A pointer to the second CoAP endpoint. - * \return Non-zero if the endpoints are identical and zero otherwise. - */ -int coap_endpoint_cmp(const coap_endpoint_t *e1, const coap_endpoint_t *e2); - -/** - * \brief Print a CoAP endpoint via the logging module. - * - * \param ep A pointer to the CoAP endpoint to log. - */ -void coap_endpoint_log(const coap_endpoint_t *ep); - -/** - * \brief Print a CoAP endpoint. - * - * \param ep A pointer to the CoAP endpoint to print. - */ -void coap_endpoint_print(const coap_endpoint_t *ep); - -/** - * \brief Print a CoAP endpoint to a string. The output is always - * null-terminated unless size is zero. - * - * \param str The string to write to. - * \param size The max number of characters to write. - * \param ep A pointer to the CoAP endpoint to print. - * \return Returns the number of characters needed for the output - * excluding the ending null-terminator or negative if an - * error occurred. - */ -int coap_endpoint_snprint(char *str, size_t size, - const coap_endpoint_t *ep); - -/** - * \brief Parse a CoAP endpoint. - * - * \param text The string to parse. - * \param size The max number of characters in the string. - * \param ep A pointer to the CoAP endpoint to write to. - * \return Returns non-zero if the endpoint was successfully parsed and - * zero otherwise. - */ -int coap_endpoint_parse(const char *text, size_t size, coap_endpoint_t *ep); - -/** - * \brief Check if a CoAP endpoint is secure (encrypted). - * - * \param ep A pointer to a CoAP endpoint. - * \return Returns non-zero if the endpoint is secure and zero otherwise. - */ -int coap_endpoint_is_secure(const coap_endpoint_t *ep); - -/** - * \brief Check if a CoAP endpoint is connected. - * - * \param ep A pointer to a CoAP endpoint. - * \return Returns non-zero if the endpoint is connected and zero otherwise. - */ -int coap_endpoint_is_connected(const coap_endpoint_t *ep); - -/** - * \brief Request a connection to a CoAP endpoint. - * - * \param ep A pointer to a CoAP endpoint. - * \return Returns zero if an error occured and non-zero otherwise. - */ -int coap_endpoint_connect(coap_endpoint_t *ep); - -/** - * \brief Request that any connection to a CoAP endpoint is discontinued. - * - * \param ep A pointer to a CoAP endpoint. - */ -void coap_endpoint_disconnect(coap_endpoint_t *ep); - -#endif /* COAP_ENDPOINT_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-engine.c b/os/net/app-layer/coap/coap-engine.c deleted file mode 100644 index 474826c1c..000000000 --- a/os/net/app-layer/coap/coap-engine.c +++ /dev/null @@ -1,518 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP implementation Engine. - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#include "coap-engine.h" -#include "sys/cc.h" -#include "lib/list.h" -#include -#include -#include -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap-eng" -#define LOG_LEVEL LOG_LEVEL_COAP - -static void process_callback(coap_timer_t *t); - -/* - * To be called by HTTP/COAP server as a callback function when a new service - * request appears. This function dispatches the corresponding CoAP service. - */ -static int invoke_coap_resource_service(coap_message_t *request, - coap_message_t *response, - uint8_t *buffer, uint16_t buffer_size, - int32_t *offset); - -/*---------------------------------------------------------------------------*/ -/*- Variables ---------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -LIST(coap_handlers); -LIST(coap_resource_services); -static uint8_t is_initialized = 0; - -/*---------------------------------------------------------------------------*/ -/*- CoAP service handlers---------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -void -coap_add_handler(coap_handler_t *handler) -{ - list_add(coap_handlers, handler); -} -/*---------------------------------------------------------------------------*/ -void -coap_remove_handler(coap_handler_t *handler) -{ - list_remove(coap_handlers, handler); -} -/*---------------------------------------------------------------------------*/ -coap_handler_status_t -coap_call_handlers(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, uint16_t buffer_size, int32_t *offset) -{ - coap_handler_status_t status; - coap_handler_t *r; - for(r = list_head(coap_handlers); r != NULL; r = r->next) { - if(r->handler) { - status = r->handler(request, response, buffer, buffer_size, offset); - if(status != COAP_HANDLER_STATUS_CONTINUE) { - /* Request handled. */ - - /* Check response code before doing observe! */ - if(request->code == COAP_GET) { - coap_observe_handler(NULL, request, response); - } - - return status; - } - } - } - return COAP_HANDLER_STATUS_CONTINUE; -} -/*---------------------------------------------------------------------------*/ -static CC_INLINE coap_handler_status_t -call_service(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, uint16_t buffer_size, int32_t *offset) -{ - coap_handler_status_t status; - status = coap_call_handlers(request, response, buffer, buffer_size, offset); - if(status != COAP_HANDLER_STATUS_CONTINUE) { - return status; - } - status = invoke_coap_resource_service(request, response, buffer, buffer_size, offset); - if(status != COAP_HANDLER_STATUS_CONTINUE) { - return status; - } - - coap_set_status_code(response, NOT_FOUND_4_04); - - return COAP_HANDLER_STATUS_CONTINUE; -} - -/*---------------------------------------------------------------------------*/ -/*- Server Part -------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ - -/* the discover resource is automatically included for CoAP */ -extern coap_resource_t res_well_known_core; - -/*---------------------------------------------------------------------------*/ -/*- Internal API ------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -int -coap_receive(const coap_endpoint_t *src, - uint8_t *payload, uint16_t payload_length) -{ - /* static declaration reduces stack peaks and program code size */ - static coap_message_t message[1]; /* this way the message can be treated as pointer as usual */ - static coap_message_t response[1]; - coap_transaction_t *transaction = NULL; - coap_handler_status_t status; - - coap_status_code = coap_parse_message(message, payload, payload_length); - coap_set_src_endpoint(message, src); - - if(coap_status_code == NO_ERROR) { - - /*TODO duplicates suppression, if required by application */ - - LOG_DBG(" Parsed: v %u, t %u, tkl %u, c %u, mid %u\n", message->version, - message->type, message->token_len, message->code, message->mid); - LOG_DBG(" URL:"); - LOG_DBG_COAP_STRING(message->uri_path, message->uri_path_len); - LOG_DBG_("\n"); - LOG_DBG(" Payload: "); - LOG_DBG_COAP_STRING((const char *)message->payload, message->payload_len); - LOG_DBG_("\n"); - - /* handle requests */ - if(message->code >= COAP_GET && message->code <= COAP_DELETE) { - - /* use transaction buffer for response to confirmable request */ - if((transaction = coap_new_transaction(message->mid, src))) { - uint32_t block_num = 0; - uint16_t block_size = COAP_MAX_BLOCK_SIZE; - uint32_t block_offset = 0; - int32_t new_offset = 0; - - /* prepare response */ - if(message->type == COAP_TYPE_CON) { - /* reliable CON requests are answered with an ACK */ - coap_init_message(response, COAP_TYPE_ACK, CONTENT_2_05, - message->mid); - } else { - /* unreliable NON requests are answered with a NON as well */ - coap_init_message(response, COAP_TYPE_NON, CONTENT_2_05, - coap_get_mid()); - /* mirror token */ - } - if(message->token_len) { - coap_set_token(response, message->token, message->token_len); - /* get offset for blockwise transfers */ - } - if(coap_get_header_block2 - (message, &block_num, NULL, &block_size, &block_offset)) { - LOG_DBG("Blockwise: block request %"PRIu32" (%u/%u) @ %"PRIu32" bytes\n", - block_num, block_size, COAP_MAX_BLOCK_SIZE, block_offset); - block_size = MIN(block_size, COAP_MAX_BLOCK_SIZE); - new_offset = block_offset; - } - - if(new_offset < 0) { - LOG_DBG("Blockwise: block request offset overflow\n"); - coap_status_code = BAD_OPTION_4_02; - coap_error_message = "BlockOutOfScope"; - status = COAP_HANDLER_STATUS_CONTINUE; - } else { - /* call CoAP framework and check if found and allowed */ - status = call_service(message, response, - transaction->message + COAP_MAX_HEADER_SIZE, - block_size, &new_offset); - } - - if(status != COAP_HANDLER_STATUS_CONTINUE) { - - if(coap_status_code == NO_ERROR) { - - /* TODO coap_handle_blockwise(request, response, start_offset, end_offset); */ - - /* resource is unaware of Block1 */ - if(coap_is_option(message, COAP_OPTION_BLOCK1) - && response->code < BAD_REQUEST_4_00 - && !coap_is_option(response, COAP_OPTION_BLOCK1)) { - LOG_DBG("Block1 NOT IMPLEMENTED\n"); - - coap_status_code = NOT_IMPLEMENTED_5_01; - coap_error_message = "NoBlock1Support"; - - /* client requested Block2 transfer */ - } else if(coap_is_option(message, COAP_OPTION_BLOCK2)) { - - /* unchanged new_offset indicates that resource is unaware of blockwise transfer */ - if(new_offset == block_offset) { - LOG_DBG("Blockwise: unaware resource with payload length %u/%u\n", - response->payload_len, block_size); - if(block_offset >= response->payload_len) { - LOG_DBG("handle_incoming_data(): block_offset >= response->payload_len\n"); - - response->code = BAD_OPTION_4_02; - coap_set_payload(response, "BlockOutOfScope", 15); /* a const char str[] and sizeof(str) produces larger code size */ - } else { - coap_set_header_block2(response, block_num, - response->payload_len - - block_offset > block_size, - block_size); - coap_set_payload(response, - response->payload + block_offset, - MIN(response->payload_len - - block_offset, block_size)); - } /* if(valid offset) */ - - /* resource provides chunk-wise data */ - } else { - LOG_DBG("Blockwise: blockwise resource, new offset %"PRId32"\n", - new_offset); - coap_set_header_block2(response, block_num, - new_offset != -1 - || response->payload_len > - block_size, block_size); - - if(response->payload_len > block_size) { - coap_set_payload(response, response->payload, - block_size); - } - } /* if(resource aware of blockwise) */ - - /* Resource requested Block2 transfer */ - } else if(new_offset != 0) { - LOG_DBG("Blockwise: no block option for blockwise resource, using block size %u\n", - COAP_MAX_BLOCK_SIZE); - - coap_set_header_block2(response, 0, new_offset != -1, - COAP_MAX_BLOCK_SIZE); - coap_set_payload(response, response->payload, - MIN(response->payload_len, - COAP_MAX_BLOCK_SIZE)); - } /* blockwise transfer handling */ - } /* no errors/hooks */ - /* successful service callback */ - /* serialize response */ - } - if(coap_status_code == NO_ERROR) { - if((transaction->message_len = coap_serialize_message(response, - transaction-> - message)) == - 0) { - coap_status_code = PACKET_SERIALIZATION_ERROR; - } - } - } else { - coap_status_code = SERVICE_UNAVAILABLE_5_03; - coap_error_message = "NoFreeTraBuffer"; - } /* if(transaction buffer) */ - - /* handle responses */ - } else { - - if(message->type == COAP_TYPE_CON && message->code == 0) { - LOG_INFO("Received Ping\n"); - coap_status_code = PING_RESPONSE; - } else if(message->type == COAP_TYPE_ACK) { - /* transactions are closed through lookup below */ - LOG_DBG("Received ACK\n"); - } else if(message->type == COAP_TYPE_RST) { - LOG_INFO("Received RST\n"); - /* cancel possible subscriptions */ - coap_remove_observer_by_mid(src, message->mid); - } - - if((transaction = coap_get_transaction_by_mid(message->mid))) { - /* free transaction memory before callback, as it may create a new transaction */ - coap_resource_response_handler_t callback = transaction->callback; - void *callback_data = transaction->callback_data; - - coap_clear_transaction(transaction); - - /* check if someone registered for the response */ - if(callback) { - callback(callback_data, message); - } - } - /* if(ACKed transaction) */ - transaction = NULL; - -#if COAP_OBSERVE_CLIENT - /* if observe notification */ - if((message->type == COAP_TYPE_CON || message->type == COAP_TYPE_NON) - && coap_is_option(message, COAP_OPTION_OBSERVE)) { - LOG_DBG("Observe [%"PRId32"]\n", message->observe); - coap_handle_notification(src, message); - } -#endif /* COAP_OBSERVE_CLIENT */ - } /* request or response */ - } /* parsed correctly */ - - /* if(parsed correctly) */ - if(coap_status_code == NO_ERROR) { - if(transaction) { - coap_send_transaction(transaction); - } - } else if(coap_status_code == MANUAL_RESPONSE) { - LOG_DBG("Clearing transaction for manual response"); - coap_clear_transaction(transaction); - } else { - coap_message_type_t reply_type = COAP_TYPE_ACK; - - LOG_WARN("ERROR %u: %s\n", coap_status_code, coap_error_message); - coap_clear_transaction(transaction); - - if(coap_status_code == PING_RESPONSE) { - coap_status_code = 0; - reply_type = COAP_TYPE_RST; - } else if(coap_status_code >= 192) { - /* set to sendable error code */ - coap_status_code = INTERNAL_SERVER_ERROR_5_00; - /* reuse input buffer for error message */ - } - coap_init_message(message, reply_type, coap_status_code, - message->mid); - coap_set_payload(message, coap_error_message, - strlen(coap_error_message)); - coap_sendto(src, payload, coap_serialize_message(message, payload)); - } - - /* if(new data) */ - return coap_status_code; -} -/*---------------------------------------------------------------------------*/ -void -coap_engine_init(void) -{ - /* avoid initializing twice */ - if(is_initialized) { - return; - } - is_initialized = 1; - - LOG_INFO("Starting CoAP engine...\n"); - - list_init(coap_handlers); - list_init(coap_resource_services); - - coap_activate_resource(&res_well_known_core, ".well-known/core"); - - coap_transport_init(); - coap_init_connection(); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Makes a resource available under the given URI path - * \param resource A pointer to a resource implementation - * \param path The URI path string for this resource - * - * The resource implementation must be imported first using the - * extern keyword. The build system takes care of compiling every - * *.c file in the ./resources/ sub-directory (see example Makefile). - */ -void -coap_activate_resource(coap_resource_t *resource, const char *path) -{ - coap_periodic_resource_t *periodic; - resource->url = path; - list_add(coap_resource_services, resource); - - LOG_INFO("Activating: %s\n", resource->url); - - /* Only add periodic resources with a periodic_handler and a period > 0. */ - if(resource->flags & IS_PERIODIC && resource->periodic - && resource->periodic->periodic_handler - && resource->periodic->period) { - LOG_DBG("Periodic resource: %p (%s)\n", resource->periodic, path); - periodic = resource->periodic; - coap_timer_set_callback(&periodic->periodic_timer, process_callback); - coap_timer_set_user_data(&periodic->periodic_timer, resource); - coap_timer_set(&periodic->periodic_timer, periodic->period); - } -} -/*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------*/ -/*- Internal API ------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -coap_resource_t * -coap_get_first_resource(void) -{ - return list_head(coap_resource_services); -} -/*---------------------------------------------------------------------------*/ -coap_resource_t * -coap_get_next_resource(coap_resource_t *resource) -{ - return list_item_next(resource); -} -/*---------------------------------------------------------------------------*/ -static int -invoke_coap_resource_service(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, uint16_t buffer_size, - int32_t *offset) -{ - uint8_t found = 0; - uint8_t allowed = 1; - - coap_resource_t *resource = NULL; - const char *url = NULL; - int url_len, res_url_len; - - url_len = coap_get_header_uri_path(request, &url); - for(resource = list_head(coap_resource_services); - resource; resource = resource->next) { - - /* if the web service handles that kind of requests and urls matches */ - res_url_len = strlen(resource->url); - if((url_len == res_url_len - || (url_len > res_url_len - && (resource->flags & HAS_SUB_RESOURCES) - && url[res_url_len] == '/')) - && strncmp(resource->url, url, res_url_len) == 0) { - coap_resource_flags_t method = coap_get_method_type(request); - found = 1; - - LOG_INFO("/%s, method %u, resource->flags %u\n", resource->url, - (uint16_t)method, resource->flags); - - if((method & METHOD_GET) && resource->get_handler != NULL) { - /* call handler function */ - resource->get_handler(request, response, buffer, buffer_size, offset); - } else if((method & METHOD_POST) && resource->post_handler != NULL) { - /* call handler function */ - resource->post_handler(request, response, buffer, buffer_size, - offset); - } else if((method & METHOD_PUT) && resource->put_handler != NULL) { - /* call handler function */ - resource->put_handler(request, response, buffer, buffer_size, offset); - } else if((method & METHOD_DELETE) && resource->delete_handler != NULL) { - /* call handler function */ - resource->delete_handler(request, response, buffer, buffer_size, - offset); - } else { - allowed = 0; - coap_set_status_code(response, METHOD_NOT_ALLOWED_4_05); - } - break; - } - } - if(!found) { - coap_set_status_code(response, NOT_FOUND_4_04); - } else if(allowed) { - /* final handler for special flags */ - if(resource->flags & IS_OBSERVABLE) { - coap_observe_handler(resource, request, response); - } - } - return found & allowed; -} -/*---------------------------------------------------------------------------*/ -/* This callback occurs when t is expired */ -static void -process_callback(coap_timer_t *t) -{ - coap_resource_t *resource; - resource = coap_timer_get_user_data(t); - if(resource != NULL && (resource->flags & IS_PERIODIC) - && resource->periodic != NULL && resource->periodic->period) { - LOG_DBG("Periodic: timer expired for /%s (period: %"PRIu32")\n", - resource->url, resource->periodic->period); - - if(!is_initialized) { - /* CoAP has not yet been initialized. */ - } else if(resource->periodic->periodic_handler) { - /* Call the periodic_handler function. */ - resource->periodic->periodic_handler(); - } - - coap_timer_set(t, resource->periodic->period); - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-engine.h b/os/net/app-layer/coap/coap-engine.h deleted file mode 100644 index 140ed0211..000000000 --- a/os/net/app-layer/coap/coap-engine.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP engine implementation. - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_ENGINE_H_ -#define COAP_ENGINE_H_ - -typedef struct coap_resource_s coap_resource_t; -typedef struct coap_periodic_resource_s coap_periodic_resource_t; - -#include "coap.h" -#include "coap-timer.h" - -typedef enum { - COAP_HANDLER_STATUS_CONTINUE, - COAP_HANDLER_STATUS_PROCESSED -} coap_handler_status_t; - -typedef coap_handler_status_t -(* coap_handler_callback_t)(coap_message_t *request, - coap_message_t *response, - uint8_t *buffer, uint16_t buffer_size, - int32_t *offset); - -typedef struct coap_handler coap_handler_t; - -struct coap_handler { - coap_handler_t *next; - coap_handler_callback_t handler; -}; - -#define COAP_HANDLER(name, handler) \ - coap_handler_t name = { NULL, handler } - -void coap_add_handler(coap_handler_t *handler); -void coap_remove_handler(coap_handler_t *handler); - -void coap_engine_init(void); - -int coap_receive(const coap_endpoint_t *src, - uint8_t *payload, uint16_t payload_length); - -coap_handler_status_t coap_call_handlers(coap_message_t *request, - coap_message_t *response, - uint8_t *buffer, - uint16_t buffer_size, - int32_t *offset); -/*---------------------------------------------------------------------------*/ -/* signatures of handler functions */ -typedef void (* coap_resource_handler_t)(coap_message_t *request, - coap_message_t *response, - uint8_t *buffer, - uint16_t preferred_size, - int32_t *offset); -typedef void (* coap_resource_periodic_handler_t)(void); -typedef void (* coap_resource_response_handler_t)(void *data, - coap_message_t *response); -typedef void (* coap_resource_trigger_handler_t)(void); - -/* data structure representing a resource in CoAP */ -struct coap_resource_s { - coap_resource_t *next; /* for LIST, points to next resource defined */ - const char *url; /*handled URL */ - coap_resource_flags_t flags; /* handled CoAP methods */ - const char *attributes; /* link-format attributes */ - coap_resource_handler_t get_handler; /* handler function */ - coap_resource_handler_t post_handler; /* handler function */ - coap_resource_handler_t put_handler; /* handler function */ - coap_resource_handler_t delete_handler; /* handler function */ - union { - coap_periodic_resource_t *periodic; /* special data depending on flags */ - coap_resource_trigger_handler_t trigger; - coap_resource_trigger_handler_t resume; - }; -}; - -struct coap_periodic_resource_s { - uint32_t period; - coap_timer_t periodic_timer; - const coap_resource_periodic_handler_t periodic_handler; -}; - -/* - * Macro to define a CoAP resource. - * Resources are statically defined for the sake of efficiency and better memory management. - */ -#define RESOURCE(name, attributes, get_handler, post_handler, put_handler, delete_handler) \ - coap_resource_t name = { NULL, NULL, NO_FLAGS, attributes, get_handler, post_handler, put_handler, delete_handler, { NULL } } - -#define PARENT_RESOURCE(name, attributes, get_handler, post_handler, put_handler, delete_handler) \ - coap_resource_t name = { NULL, NULL, HAS_SUB_RESOURCES, attributes, get_handler, post_handler, put_handler, delete_handler, { NULL } } - -#define SEPARATE_RESOURCE(name, attributes, get_handler, post_handler, put_handler, delete_handler, resume_handler) \ - coap_resource_t name = { NULL, NULL, IS_SEPARATE, attributes, get_handler, post_handler, put_handler, delete_handler, { .resume = resume_handler } } - -#define EVENT_RESOURCE(name, attributes, get_handler, post_handler, put_handler, delete_handler, event_handler) \ - coap_resource_t name = { NULL, NULL, IS_OBSERVABLE, attributes, get_handler, post_handler, put_handler, delete_handler, { .trigger = event_handler } } - -/* - * Macro to define a periodic resource. - * The corresponding [name]_periodic_handler() function will be called every period. - * For instance polling a sensor and publishing a changed value to subscribed clients would be done there. - */ -#define PERIODIC_RESOURCE(name, attributes, get_handler, post_handler, put_handler, delete_handler, period, periodic_handler) \ - static coap_periodic_resource_t periodic_##name = { period, { 0 }, periodic_handler }; \ - coap_resource_t name = { NULL, NULL, IS_OBSERVABLE | IS_PERIODIC, attributes, get_handler, post_handler, put_handler, delete_handler, { .periodic = &periodic_##name } } - -/*---------------------------------------------------------------------------*/ -/** - * - * \brief Resources wanted to be accessible should be activated with the following code. - * \param resource - * A CoAP resource defined through the RESOURCE macros. - * \param path - * The local URI path where to provide the resource. - */ -void coap_activate_resource(coap_resource_t *resource, const char *path); -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the first of registered CoAP resources. - * \return The first registered CoAP resource or NULL if none exists. - */ -coap_resource_t *coap_get_first_resource(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the next registered CoAP resource. - * \return The next resource or NULL if no more exists. - */ -coap_resource_t *coap_get_next_resource(coap_resource_t *resource); -/*---------------------------------------------------------------------------*/ - -#include "coap-transactions.h" -#include "coap-observe.h" -#include "coap-separate.h" -#include "coap-observe-client.h" -#include "coap-transport.h" - -#endif /* COAP_ENGINE_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-keystore-simple.c b/os/net/app-layer/coap/coap-keystore-simple.c deleted file mode 100644 index 1eb8737e9..000000000 --- a/os/net/app-layer/coap/coap-keystore-simple.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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 - * A simple keystore with fixed credentials. - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap-keystore - * @{ - */ - -#include "coap-endpoint.h" -#include "coap-keystore.h" -#include - -#ifdef WITH_DTLS -#ifdef COAP_DTLS_PSK_DEFAULT_IDENTITY -#ifdef COAP_DTLS_PSK_DEFAULT_KEY -/*---------------------------------------------------------------------------*/ -static int -get_default_psk_info(const coap_endpoint_t *address_info, - coap_keystore_psk_entry_t *info) -{ - if(info != NULL) { - if(info->identity == NULL || info->identity_len == 0) { - /* Identity requested */ - info->identity = (uint8_t *)COAP_DTLS_PSK_DEFAULT_IDENTITY; - info->identity_len = strlen(COAP_DTLS_PSK_DEFAULT_IDENTITY); - return 1; - } - if(info->identity_len != strlen(COAP_DTLS_PSK_DEFAULT_IDENTITY) || - memcmp(info->identity, COAP_DTLS_PSK_DEFAULT_IDENTITY, - info->identity_len) != 0) { - /* Identity not matching */ - return 0; - } - info->key = (uint8_t *)COAP_DTLS_PSK_DEFAULT_KEY; - info->key_len = strlen(COAP_DTLS_PSK_DEFAULT_KEY); - return 1; - } - return 0; -} -static const coap_keystore_t simple_key_store = { - .coap_get_psk_info = get_default_psk_info -}; -/*---------------------------------------------------------------------------*/ -#endif /* COAP_DTLS_PSK_DEFAULT_KEY */ -#endif /* COAP_DTLS_PSK_DEFAULT_IDENTITY */ -#endif /* WITH_DTLS */ -/*---------------------------------------------------------------------------*/ -void -coap_keystore_simple_init(void) -{ -#ifdef WITH_DTLS -#ifdef COAP_DTLS_PSK_DEFAULT_IDENTITY -#ifdef COAP_DTLS_PSK_DEFAULT_KEY - - coap_set_keystore(&simple_key_store); - -#endif /* COAP_DTLS_PSK_DEFAULT_KEY */ -#endif /* COAP_DTLS_PSK_DEFAULT_IDENTITY */ -#endif /* WITH_DTLS */ -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-keystore-simple.h b/os/net/app-layer/coap/coap-keystore-simple.h deleted file mode 100644 index 2252002d4..000000000 --- a/os/net/app-layer/coap/coap-keystore-simple.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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 - * A simple keystore with fixed credentials. - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap-keystore - * @{ - */ - -#ifndef COAP_KEYSTORE_SIMPLE_H_ -#define COAP_KEYSTORE_SIMPLE_H_ - -/** - * \brief Registers a simple CoAP DTLS keystore with fixed pre-shared key - * credentials. - * - * The credentials can be configured in project-conf.h as shown in the - * following example: - * - * ~~~~~~~~~~~~~~~{.c} - * #define COAP_DTLS_PSK_DEFAULT_IDENTITY "user" - * #define COAP_DTLS_PSK_DEFAULT_KEY "password" - * ~~~~~~~~~~~~~~~ - */ -void coap_keystore_simple_init(void); - -#endif /* COAP_KEYSTORE_SIMPLE_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-keystore.h b/os/net/app-layer/coap/coap-keystore.h deleted file mode 100644 index 6a3763d5a..000000000 --- a/os/net/app-layer/coap/coap-keystore.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 - * API for CoAP keystore - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap - * @{ - * - * \defgroup coap-keystore CoAP keystore API - * @{ - * - * The CoAP keystore API defines a common interface for retrieving - * authorization information for CoAP/DTLS. - */ - -#ifndef COAP_KEYSTORE_H_ -#define COAP_KEYSTORE_H_ - -#include "coap-endpoint.h" - -/** - * The structure of a CoAP pre-shared key info. - */ -typedef struct { - const uint8_t *identity_hint; - uint16_t identity_hint_len; - const uint8_t *identity; - uint16_t identity_len; - const uint8_t *key; - uint16_t key_len; -} coap_keystore_psk_entry_t; - -/** - * The structure of a CoAP keystore. - * - * The keystore implementation provides a function callback for each type of - * authorization supported. The API currently only specifies a function - * callback for pre-shared keys. - */ -typedef struct { - int (* coap_get_psk_info)(const coap_endpoint_t *address_info, - coap_keystore_psk_entry_t *info); -} coap_keystore_t; - -/** - * \brief Set the CoAP keystore to use by CoAP. - * \param keystore A pointer to a CoAP keystore. - */ -void coap_set_keystore(const coap_keystore_t *keystore); - -#endif /* COAP_KEYSTORE_H_ */ -/** @} */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-log.c b/os/net/app-layer/coap/coap-log.c deleted file mode 100644 index 36f3bc016..000000000 --- a/os/net/app-layer/coap/coap-log.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 HOLDER 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 - * Log support for CoAP - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap - * @{ - */ - -#include "coap-log.h" -/*---------------------------------------------------------------------------*/ -void -coap_log_string(const char *text, size_t len) -{ - int i; - if(text == NULL) { - LOG_OUTPUT("(NULL STR)"); - return; - } - - for(i = 0; i < len && *text != '\0'; i++, text++) { - LOG_OUTPUT("%c", *text); - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-log.h b/os/net/app-layer/coap/coap-log.h deleted file mode 100644 index 2e6a0a359..000000000 --- a/os/net/app-layer/coap/coap-log.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 HOLDER 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 - * Log support for CoAP - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_LOG_H_ -#define COAP_LOG_H_ - -#include "contiki.h" - -#ifdef COAP_LOG_CONF_PATH -#include COAP_LOG_CONF_PATH -#else /* COAP_LOG_CONF_PATH */ -#include "sys/log.h" -#endif /* COAP_LOG_CONF_PATH */ - -#include "coap-endpoint.h" - -/* CoAP endpoint */ -#define LOG_COAP_EP(level, endpoint) do { \ - if(level <= (LOG_LEVEL)) { \ - coap_endpoint_log(endpoint); \ - } \ - } while (0) - -#define LOG_ERR_COAP_EP(endpoint) LOG_COAP_EP(LOG_LEVEL_ERR, endpoint) -#define LOG_WARN_COAP_EP(endpoint) LOG_COAP_EP(LOG_LEVEL_WARN, endpoint) -#define LOG_INFO_COAP_EP(endpoint) LOG_COAP_EP(LOG_LEVEL_INFO, endpoint) -#define LOG_DBG_COAP_EP(endpoint) LOG_COAP_EP(LOG_LEVEL_DBG, endpoint) - -/* CoAP strings */ -#define LOG_COAP_STRING(level, text, len) do { \ - if(level <= (LOG_LEVEL)) { \ - coap_log_string(text, len); \ - } \ - } while (0) - -#define LOG_ERR_COAP_STRING(text, len) LOG_COAP_STRING(LOG_LEVEL_ERR, text, len) -#define LOG_WARN_COAP_STRING(text, len) LOG_COAP_STRING(LOG_LEVEL_WARN, text, len) -#define LOG_INFO_COAP_STRING(text, len) LOG_COAP_STRING(LOG_LEVEL_INFO, text, len) -#define LOG_DBG_COAP_STRING(text, len) LOG_COAP_STRING(LOG_LEVEL_DBG, text, len) - -/** - * \brief Logs a CoAP string that has a length but might not be 0-terminated. - * \param text The CoAP string - * \param len The number of characters in the CoAP string - */ -void coap_log_string(const char *text, size_t len); - -#endif /* COAP_LOG_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-observe-client.c b/os/net/app-layer/coap/coap-observe-client.c deleted file mode 100644 index a27308494..000000000 --- a/os/net/app-layer/coap/coap-observe-client.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 2014, Daniele Alessandrelli. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/* - * \file - * Extension to Erbium for enabling CoAP observe clients - * \author - * Daniele Alessandrelli - */ - -/** - * \addtogroup coap - * @{ - */ - -#include "coap.h" -#include "coap-observe-client.h" -#include "sys/cc.h" -#include "lib/memb.h" -#include "lib/list.h" -#include -#include - -/* Compile this code only if client-side support for CoAP Observe is required */ -#if COAP_OBSERVE_CLIENT - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap" -#define LOG_LEVEL LOG_LEVEL_COAP - -MEMB(obs_subjects_memb, coap_observee_t, COAP_MAX_OBSERVEES); -LIST(obs_subjects_list); - -/*----------------------------------------------------------------------------*/ -static size_t -get_token(coap_message_t *coap_pkt, const uint8_t **token) -{ - *token = coap_pkt->token; - - return coap_pkt->token_len; -} -/*----------------------------------------------------------------------------*/ -static int -set_token(coap_message_t *coap_pkt, const uint8_t *token, size_t token_len) -{ - coap_pkt->token_len = MIN(COAP_TOKEN_LEN, token_len); - memcpy(coap_pkt->token, token, coap_pkt->token_len); - - return coap_pkt->token_len; -} -/*----------------------------------------------------------------------------*/ -coap_observee_t * -coap_obs_add_observee(const coap_endpoint_t *endpoint, - const uint8_t *token, size_t token_len, const char *url, - notification_callback_t notification_callback, - void *data) -{ - coap_observee_t *o; - - /* Remove existing observe relationship, if any. */ - coap_obs_remove_observee_by_url(endpoint, url); - o = memb_alloc(&obs_subjects_memb); - if(o) { - o->url = url; - coap_endpoint_copy(&o->endpoint, endpoint); - o->token_len = token_len; - memcpy(o->token, token, token_len); - /* o->last_mid = 0; */ - o->notification_callback = notification_callback; - o->data = data; - LOG_DBG("Adding obs_subject for /%s [0x%02X%02X]\n", o->url, o->token[0], - o->token[1]); - list_add(obs_subjects_list, o); - } - - return o; -} -/*----------------------------------------------------------------------------*/ -void -coap_obs_remove_observee(coap_observee_t *o) -{ - LOG_DBG("Removing obs_subject for /%s [0x%02X%02X]\n", o->url, o->token[0], - o->token[1]); - memb_free(&obs_subjects_memb, o); - list_remove(obs_subjects_list, o); -} -/*----------------------------------------------------------------------------*/ -coap_observee_t * -coap_get_obs_subject_by_token(const uint8_t *token, size_t token_len) -{ - coap_observee_t *obs = NULL; - - for(obs = (coap_observee_t *)list_head(obs_subjects_list); obs; - obs = obs->next) { - LOG_DBG("Looking for token 0x%02X%02X\n", token[0], token[1]); - if(obs->token_len == token_len - && memcmp(obs->token, token, token_len) == 0) { - return obs; - } - } - - return NULL; -} -/*----------------------------------------------------------------------------*/ -int -coap_obs_remove_observee_by_token(const coap_endpoint_t *endpoint, - uint8_t *token, size_t token_len) -{ - int removed = 0; - coap_observee_t *obs = NULL; - - for(obs = (coap_observee_t *)list_head(obs_subjects_list); obs; - obs = obs->next) { - LOG_DBG("Remove check Token 0x%02X%02X\n", token[0], token[1]); - if(coap_endpoint_cmp(&obs->endpoint, endpoint) - && obs->token_len == token_len - && memcmp(obs->token, token, token_len) == 0) { - coap_obs_remove_observee(obs); - removed++; - } - } - return removed; -} -/*----------------------------------------------------------------------------*/ -int -coap_obs_remove_observee_by_url(const coap_endpoint_t *endpoint, - const char *url) -{ - int removed = 0; - coap_observee_t *obs = NULL; - - for(obs = (coap_observee_t *)list_head(obs_subjects_list); obs; - obs = obs->next) { - LOG_DBG("Remove check URL %s\n", url); - if(coap_endpoint_cmp(&obs->endpoint, endpoint) - && (obs->url == url || memcmp(obs->url, url, strlen(obs->url)) == 0)) { - coap_obs_remove_observee(obs); - removed++; - } - } - return removed; -} -/*----------------------------------------------------------------------------*/ -static void -simple_reply(coap_message_type_t type, const coap_endpoint_t *endpoint, - coap_message_t *notification) -{ - static coap_message_t response[1]; - size_t len; - - coap_init_message(response, type, NO_ERROR, notification->mid); - len = coap_serialize_message(response, coap_databuf()); - coap_sendto(endpoint, coap_databuf(), len); -} -/*----------------------------------------------------------------------------*/ -static coap_notification_flag_t -classify_notification(coap_message_t *response, int first) -{ - if(!response) { - LOG_DBG("no response\n"); - return NO_REPLY_FROM_SERVER; - } - LOG_DBG("server replied\n"); - if(!IS_RESPONSE_CODE_2_XX(response)) { - LOG_DBG("error response code\n"); - return ERROR_RESPONSE_CODE; - } - if(!coap_is_option(response, COAP_OPTION_OBSERVE)) { - LOG_DBG("server does not support observe\n"); - return OBSERVE_NOT_SUPPORTED; - } - if(first) { - return OBSERVE_OK; - } - return NOTIFICATION_OK; -} -/*----------------------------------------------------------------------------*/ -void -coap_handle_notification(const coap_endpoint_t *endpoint, - coap_message_t *notification) -{ - const uint8_t *token; - int token_len; - coap_observee_t *obs; - coap_notification_flag_t flag; - uint32_t observe; - - LOG_DBG("coap_handle_notification()\n"); - token_len = get_token(notification, &token); - LOG_DBG("Getting token\n"); - if(0 == token_len) { - LOG_DBG("Error while handling coap observe notification: " - "no token in message\n"); - return; - } - LOG_DBG("Getting observee info\n"); - obs = coap_get_obs_subject_by_token(token, token_len); - if(NULL == obs) { - LOG_DBG("Error while handling coap observe notification: " - "no matching token found\n"); - simple_reply(COAP_TYPE_RST, endpoint, notification); - return; - } - if(notification->type == COAP_TYPE_CON) { - simple_reply(COAP_TYPE_ACK, endpoint, notification); - } - if(obs->notification_callback != NULL) { - flag = classify_notification(notification, 0); - /* TODO: the following mechanism for discarding duplicates is too trivial */ - /* refer to Observe RFC for a better solution */ - if(flag == NOTIFICATION_OK) { - coap_get_header_observe(notification, &observe); - if(observe == obs->last_observe) { - LOG_DBG("Discarding duplicate\n"); - return; - } - obs->last_observe = observe; - } - obs->notification_callback(obs, notification, flag); - } -} -/*----------------------------------------------------------------------------*/ -static void -handle_obs_registration_response(void *data, coap_message_t *response) -{ - coap_observee_t *obs; - notification_callback_t notification_callback; - coap_notification_flag_t flag; - - LOG_DBG("handle_obs_registration_response()\n"); - obs = (coap_observee_t *)data; - notification_callback = obs->notification_callback; - flag = classify_notification(response, 1); - if(notification_callback) { - notification_callback(obs, response, flag); - } - if(flag != OBSERVE_OK) { - coap_obs_remove_observee(obs); - } -} -/*----------------------------------------------------------------------------*/ -uint8_t -coap_generate_token(uint8_t **token_ptr) -{ - static uint8_t token = 0; - - token++; - /* FIXME: we should check that this token is not already used */ - *token_ptr = (uint8_t *)&token; - return sizeof(token); -} -/*----------------------------------------------------------------------------*/ -coap_observee_t * -coap_obs_request_registration(const coap_endpoint_t *endpoint, char *uri, - notification_callback_t notification_callback, - void *data) -{ - coap_message_t request[1]; - coap_transaction_t *t; - uint8_t *token; - uint8_t token_len; - coap_observee_t *obs; - - obs = NULL; - coap_init_message(request, COAP_TYPE_CON, COAP_GET, coap_get_mid()); - coap_set_header_uri_path(request, uri); - coap_set_header_observe(request, 0); - token_len = coap_generate_token(&token); - set_token(request, token, token_len); - t = coap_new_transaction(request->mid, endpoint); - if(t) { - obs = coap_obs_add_observee(endpoint, (uint8_t *)token, token_len, uri, - notification_callback, data); - if(obs) { - t->callback = handle_obs_registration_response; - t->callback_data = obs; - t->message_len = coap_serialize_message(request, t->message); - coap_send_transaction(t); - } else { - LOG_DBG("Could not allocate obs_subject resource buffer\n"); - coap_clear_transaction(t); - } - } else { - LOG_DBG("Could not allocate transaction buffer\n"); - } - return obs; -} -#endif /* COAP_OBSERVE_CLIENT */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-observe-client.h b/os/net/app-layer/coap/coap-observe-client.h deleted file mode 100644 index 79625caff..000000000 --- a/os/net/app-layer/coap/coap-observe-client.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2014, Daniele Alessandrelli. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/* - * \file - * Extension to Erbium for enabling CoAP observe clients - * \author - * Daniele Alessandrelli - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_OBSERVING_CLIENT_H_ -#define COAP_OBSERVING_CLIENT_H_ - -#include "coap.h" -#include "coap-transactions.h" - -#ifndef COAP_OBSERVE_CLIENT -#define COAP_OBSERVE_CLIENT 0 -#endif - -#ifdef COAP_CONF_MAX_OBSERVEES -#define COAP_MAX_OBSERVEES COAP_CONF_MAX_OBSERVEES -#else -#define COAP_MAX_OBSERVEES 4 -#endif /* COAP_CONF_MAX_OBSERVEES */ - -#if COAP_MAX_OPEN_TRANSACTIONS < COAP_MAX_OBSERVEES -#warning "COAP_MAX_OPEN_TRANSACTIONS smaller than COAP_MAX_OBSERVEES: " \ - "this may be a problem" -#endif - -#define IS_RESPONSE_CODE_2_XX(message) (64 < message->code \ - && message->code < 128) - -/*----------------------------------------------------------------------------*/ -typedef enum { - OBSERVE_OK, - NOTIFICATION_OK, - OBSERVE_NOT_SUPPORTED, - ERROR_RESPONSE_CODE, - NO_REPLY_FROM_SERVER, -} coap_notification_flag_t; - -/*----------------------------------------------------------------------------*/ -typedef struct coap_observee_s coap_observee_t; - -typedef void (*notification_callback_t)(coap_observee_t *subject, - void *notification, - coap_notification_flag_t); - -struct coap_observee_s { - coap_observee_t *next; /* for LIST */ - coap_endpoint_t endpoint; - const char *url; - uint8_t token_len; - uint8_t token[COAP_TOKEN_LEN]; - void *data; /* generic pointer for storing user data */ - notification_callback_t notification_callback; - uint32_t last_observe; -}; - -/*----------------------------------------------------------------------------*/ -coap_observee_t *coap_obs_add_observee(const coap_endpoint_t *endpoint, - const uint8_t *token, size_t token_len, - const char *url, - notification_callback_t - notification_callback, void *data); - -void coap_obs_remove_observee(coap_observee_t *o); - -coap_observee_t *coap_obs_get_observee_by_token(const uint8_t *token, - size_t token_len); - -int coap_obs_remove_observee_by_token(const coap_endpoint_t *endpoint, - uint8_t *token, size_t token_len); - -int coap_obs_remove_observee_by_url(const coap_endpoint_t *endpoint, - const char *url); - -void coap_handle_notification(const coap_endpoint_t *endpoint, - coap_message_t *notification); - -coap_observee_t *coap_obs_request_registration(const coap_endpoint_t *endpoint, - char *uri, - notification_callback_t - notification_callback, - void *data); -/* TODO: this function may be moved to coap.c */ -uint8_t coap_generate_token(uint8_t **token_ptr); - -#endif /* COAP_OBSERVING_CLIENT_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-observe.c b/os/net/app-layer/coap/coap-observe.c deleted file mode 100644 index 3574acac4..000000000 --- a/os/net/app-layer/coap/coap-observe.c +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP module for observing resources (draft-ietf-core-observe-11). - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#include -#include -#include "coap-observe.h" -#include "coap-engine.h" -#include "lib/memb.h" -#include "lib/list.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap" -#define LOG_LEVEL LOG_LEVEL_COAP - -/*---------------------------------------------------------------------------*/ -MEMB(observers_memb, coap_observer_t, COAP_MAX_OBSERVERS); -LIST(observers_list); -/*---------------------------------------------------------------------------*/ -/*- Internal API ------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -static coap_observer_t * -add_observer(const coap_endpoint_t *endpoint, const uint8_t *token, - size_t token_len, const char *uri, int uri_len) -{ - /* Remove existing observe relationship, if any. */ - coap_remove_observer_by_uri(endpoint, uri); - - coap_observer_t *o = memb_alloc(&observers_memb); - - if(o) { - int max = sizeof(o->url) - 1; - if(max > uri_len) { - max = uri_len; - } - memcpy(o->url, uri, max); - o->url[max] = 0; - coap_endpoint_copy(&o->endpoint, endpoint); - o->token_len = token_len; - memcpy(o->token, token, token_len); - o->last_mid = 0; - - LOG_INFO("Adding observer (%u/%u) for /%s [0x%02X%02X]\n", - list_length(observers_list) + 1, COAP_MAX_OBSERVERS, - o->url, o->token[0], o->token[1]); - list_add(observers_list, o); - } - - return o; -} -/*---------------------------------------------------------------------------*/ -/*- Removal -----------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -void -coap_remove_observer(coap_observer_t *o) -{ - LOG_INFO("Removing observer for /%s [0x%02X%02X]\n", o->url, o->token[0], - o->token[1]); - - memb_free(&observers_memb, o); - list_remove(observers_list, o); -} -/*---------------------------------------------------------------------------*/ -int -coap_remove_observer_by_client(const coap_endpoint_t *endpoint) -{ - int removed = 0; - coap_observer_t *obs = NULL; - - LOG_DBG("Remove check client "); - LOG_DBG_COAP_EP(endpoint); - LOG_DBG_("\n"); - for(obs = (coap_observer_t *)list_head(observers_list); obs; - obs = obs->next) { - if(coap_endpoint_cmp(&obs->endpoint, endpoint)) { - coap_remove_observer(obs); - removed++; - } - } - return removed; -} -/*---------------------------------------------------------------------------*/ -int -coap_remove_observer_by_token(const coap_endpoint_t *endpoint, - uint8_t *token, size_t token_len) -{ - int removed = 0; - coap_observer_t *obs = NULL; - - for(obs = (coap_observer_t *)list_head(observers_list); obs; - obs = obs->next) { - LOG_DBG("Remove check Token 0x%02X%02X\n", token[0], token[1]); - if(coap_endpoint_cmp(&obs->endpoint, endpoint) - && obs->token_len == token_len - && memcmp(obs->token, token, token_len) == 0) { - coap_remove_observer(obs); - removed++; - } - } - return removed; -} -/*---------------------------------------------------------------------------*/ -int -coap_remove_observer_by_uri(const coap_endpoint_t *endpoint, - const char *uri) -{ - int removed = 0; - coap_observer_t *obs = NULL; - - for(obs = (coap_observer_t *)list_head(observers_list); obs; - obs = obs->next) { - LOG_DBG("Remove check URL %p\n", uri); - if((endpoint == NULL - || (coap_endpoint_cmp(&obs->endpoint, endpoint))) - && (obs->url == uri || memcmp(obs->url, uri, strlen(obs->url)) == 0)) { - coap_remove_observer(obs); - removed++; - } - } - return removed; -} -/*---------------------------------------------------------------------------*/ -int -coap_remove_observer_by_mid(const coap_endpoint_t *endpoint, uint16_t mid) -{ - int removed = 0; - coap_observer_t *obs = NULL; - - for(obs = (coap_observer_t *)list_head(observers_list); obs; - obs = obs->next) { - LOG_DBG("Remove check MID %u\n", mid); - if(coap_endpoint_cmp(&obs->endpoint, endpoint) - && obs->last_mid == mid) { - coap_remove_observer(obs); - removed++; - } - } - return removed; -} -/*---------------------------------------------------------------------------*/ -/*- Notification ------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -void -coap_notify_observers(coap_resource_t *resource) -{ - coap_notify_observers_sub(resource, NULL); -} -/* Can be used either for sub - or when there is not resource - just - a handler */ -void -coap_notify_observers_sub(coap_resource_t *resource, const char *subpath) -{ - /* build notification */ - coap_message_t notification[1]; /* this way the message can be treated as pointer as usual */ - coap_message_t request[1]; /* this way the message can be treated as pointer as usual */ - coap_observer_t *obs = NULL; - int url_len, obs_url_len; - char url[COAP_OBSERVER_URL_LEN]; - uint8_t sub_ok = 0; - - if(resource != NULL) { - url_len = strlen(resource->url); - strncpy(url, resource->url, COAP_OBSERVER_URL_LEN - 1); - if(url_len < COAP_OBSERVER_URL_LEN - 1 && subpath != NULL) { - strncpy(&url[url_len], subpath, COAP_OBSERVER_URL_LEN - url_len - 1); - } - } else if(subpath != NULL) { - strncpy(url, subpath, COAP_OBSERVER_URL_LEN - 1); - } else { - /* No resource, no subpath */ - return; - } - - /* Ensure url is null terminated because strncpy does not guarantee this */ - url[COAP_OBSERVER_URL_LEN - 1] = '\0'; - /* url now contains the notify URL that needs to match the observer */ - LOG_INFO("Notification from %s\n", url); - - coap_init_message(notification, COAP_TYPE_NON, CONTENT_2_05, 0); - /* create a "fake" request for the URI */ - coap_init_message(request, COAP_TYPE_CON, COAP_GET, 0); - coap_set_header_uri_path(request, url); - - /* iterate over observers */ - url_len = strlen(url); - /* Assumes lazy evaluation... */ - sub_ok = (resource == NULL) || (resource->flags & HAS_SUB_RESOURCES); - for(obs = (coap_observer_t *)list_head(observers_list); obs; - obs = obs->next) { - obs_url_len = strlen(obs->url); - - /* Do a match based on the parent/sub-resource match so that it is - possible to do parent-node observe */ - - /***** TODO fix here so that we handle the notofication correctly ******/ - /* All the new-style ... is assuming that the URL might be within */ - if((obs_url_len == url_len - || (obs_url_len > url_len - && sub_ok - && obs->url[url_len] == '/')) - && strncmp(url, obs->url, url_len) == 0) { - coap_transaction_t *transaction = NULL; - - /*TODO implement special transaction for CON, sharing the same buffer to allow for more observers */ - - if((transaction = coap_new_transaction(coap_get_mid(), &obs->endpoint))) { - /* if COAP_OBSERVE_REFRESH_INTERVAL is zero, never send observations as confirmable messages */ - if(COAP_OBSERVE_REFRESH_INTERVAL != 0 - && (obs->obs_counter % COAP_OBSERVE_REFRESH_INTERVAL == 0)) { - LOG_DBG(" Force Confirmable for\n"); - notification->type = COAP_TYPE_CON; - } - - LOG_DBG(" Observer "); - LOG_DBG_COAP_EP(&obs->endpoint); - LOG_DBG_("\n"); - - /* update last MID for RST matching */ - obs->last_mid = transaction->mid; - - /* prepare response */ - notification->mid = transaction->mid; - - int32_t new_offset = 0; - - /* Either old style get_handler or the full handler */ - if(coap_call_handlers(request, notification, transaction->message + - COAP_MAX_HEADER_SIZE, COAP_MAX_CHUNK_SIZE, - &new_offset) > 0) { - LOG_DBG("Notification on new handlers\n"); - } else { - if(resource != NULL) { - resource->get_handler(request, notification, - transaction->message + COAP_MAX_HEADER_SIZE, - COAP_MAX_CHUNK_SIZE, &new_offset); - } else { - /* What to do here? */ - notification->code = BAD_REQUEST_4_00; - } - } - - if(notification->code < BAD_REQUEST_4_00) { - coap_set_header_observe(notification, (obs->obs_counter)++); - /* mask out to keep the CoAP observe option length <= 3 bytes */ - obs->obs_counter &= 0xffffff; - } - coap_set_token(notification, obs->token, obs->token_len); - - if(new_offset != 0) { - coap_set_header_block2(notification, - 0, - new_offset != -1, - COAP_MAX_BLOCK_SIZE); - coap_set_payload(notification, - notification->payload, - MIN(notification->payload_len, - COAP_MAX_BLOCK_SIZE)); - } - - transaction->message_len = - coap_serialize_message(notification, transaction->message); - - coap_send_transaction(transaction); - } - } - } -} -/*---------------------------------------------------------------------------*/ -void -coap_observe_handler(coap_resource_t *resource, coap_message_t *coap_req, - coap_message_t *coap_res) -{ - const coap_endpoint_t *src_ep; - coap_observer_t *obs; - - LOG_DBG("CoAP observer handler rsc: %d\n", resource != NULL); - - if(coap_req->code == COAP_GET && coap_res->code < 128) { /* GET request and response without error code */ - if(coap_is_option(coap_req, COAP_OPTION_OBSERVE)) { - src_ep = coap_get_src_endpoint(coap_req); - if(src_ep == NULL) { - /* No source endpoint, can not add */ - } else if(coap_req->observe == 0) { - obs = add_observer(src_ep, - coap_req->token, coap_req->token_len, - coap_req->uri_path, coap_req->uri_path_len); - if(obs) { - coap_set_header_observe(coap_res, (obs->obs_counter)++); - /* mask out to keep the CoAP observe option length <= 3 bytes */ - obs->obs_counter &= 0xffffff; - /* - * Following payload is for demonstration purposes only. - * A subscription should return the same representation as a normal GET. - * Uncomment if you want an information about the avaiable observers. - */ -#if 0 - static char content[16]; - coap_set_payload(coap_res, - content, - snprintf(content, sizeof(content), "Added %u/%u", - list_length(observers_list), - COAP_MAX_OBSERVERS)); -#endif - } else { - coap_res->code = SERVICE_UNAVAILABLE_5_03; - coap_set_payload(coap_res, "TooManyObservers", 16); - } - } else if(coap_req->observe == 1) { - - /* remove client if it is currently observe */ - coap_remove_observer_by_token(src_ep, - coap_req->token, coap_req->token_len); - } - } - } -} -/*---------------------------------------------------------------------------*/ -uint8_t -coap_has_observers(char *path) -{ - coap_observer_t *obs = NULL; - - for(obs = (coap_observer_t *)list_head(observers_list); obs; - obs = obs->next) { - if((strncmp(obs->url, path, strlen(path))) == 0) { - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-observe.h b/os/net/app-layer/coap/coap-observe.h deleted file mode 100644 index 93898f954..000000000 --- a/os/net/app-layer/coap/coap-observe.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP module for observing resources (draft-ietf-core-observe-11). - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_OBSERVE_H_ -#define COAP_OBSERVE_H_ - -#include "coap.h" -#include "coap-transactions.h" -#include "coap-engine.h" - -#define COAP_OBSERVER_URL_LEN 20 - -typedef struct coap_observer { - struct coap_observer *next; /* for LIST */ - - char url[COAP_OBSERVER_URL_LEN]; - coap_endpoint_t endpoint; - uint8_t token_len; - uint8_t token[COAP_TOKEN_LEN]; - uint16_t last_mid; - - int32_t obs_counter; - - coap_timer_t retrans_timer; - uint8_t retrans_counter; -} coap_observer_t; - -void coap_remove_observer(coap_observer_t *o); -int coap_remove_observer_by_client(const coap_endpoint_t *ep); -int coap_remove_observer_by_token(const coap_endpoint_t *ep, - uint8_t *token, size_t token_len); -int coap_remove_observer_by_uri(const coap_endpoint_t *ep, - const char *uri); -int coap_remove_observer_by_mid(const coap_endpoint_t *ep, - uint16_t mid); - -void coap_notify_observers(coap_resource_t *resource); -void coap_notify_observers_sub(coap_resource_t *resource, const char *subpath); - -void coap_observe_handler(coap_resource_t *resource, coap_message_t *request, - coap_message_t *response); - -uint8_t coap_has_observers(char *path); - -#endif /* COAP_OBSERVE_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-request-state.h b/os/net/app-layer/coap/coap-request-state.h deleted file mode 100644 index 4c5881bb6..000000000 --- a/os/net/app-layer/coap/coap-request-state.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup coap - * @{ - */ - -/** - * \file - * Common request state for all the APIs - * \author - * Carlos Gonzalo Peces - */ -#ifndef COAP_REQUEST_STATE_H_ -#define COAP_REQUEST_STATE_H_ - -typedef enum { - COAP_REQUEST_STATUS_RESPONSE, /* Response received and no more blocks */ - COAP_REQUEST_STATUS_MORE, /* Response received and there are more blocks */ - COAP_REQUEST_STATUS_FINISHED, /* Request finished */ - COAP_REQUEST_STATUS_TIMEOUT, /* Request Timeout after all retransmissions */ - COAP_REQUEST_STATUS_BLOCK_ERROR /* Blocks in wrong order */ -} coap_request_status_t; - - -typedef struct coap_request_state { - coap_transaction_t *transaction; - coap_message_t *response; - coap_message_t *request; - coap_endpoint_t *remote_endpoint; - uint32_t block_num; - uint32_t res_block; - uint8_t more; - uint8_t block_error; - void *user_data; - coap_request_status_t status; -} coap_request_state_t; - - -#endif /* COAP_REQUEST_STATE_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-res-well-known-core.c b/os/net/app-layer/coap/coap-res-well-known-core.c deleted file mode 100644 index ebaae8fd4..000000000 --- a/os/net/app-layer/coap/coap-res-well-known-core.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * /.well-known/core resource implementation. - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#include "coap-engine.h" -#include -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap" -#define LOG_LEVEL LOG_LEVEL_COAP - -#define ADD_CHAR_IF_POSSIBLE(char) \ - if(strpos >= *offset && bufpos < preferred_size) { \ - buffer[bufpos++] = char; \ - } \ - ++strpos - -#define ADD_STRING_IF_POSSIBLE(string, op) \ - tmplen = strlen(string); \ - if(strpos + tmplen > *offset) { \ - bufpos += snprintf((char *)buffer + bufpos, \ - preferred_size - bufpos + 1, \ - "%s", \ - string \ - + (*offset - (int32_t)strpos > 0 ? \ - *offset - (int32_t)strpos : 0)); \ - if(bufpos op preferred_size) { \ - LOG_DBG("BREAK at %s (%p)\n", string, resource); \ - break; \ - } \ - } \ - strpos += tmplen - -/*---------------------------------------------------------------------------*/ -/*- Resource Handlers -------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -static void -well_known_core_get_handler(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, uint16_t preferred_size, - int32_t *offset) -{ - size_t strpos = 0; /* position in overall string (which is larger than the buffer) */ - size_t bufpos = 0; /* position within buffer (bytes written) */ - size_t tmplen = 0; - coap_resource_t *resource = NULL; - -#if COAP_LINK_FORMAT_FILTERING - /* For filtering. */ - const char *filter = NULL; - const char *attrib = NULL; - const char *found = NULL; - const char *end = NULL; - char *value = NULL; - char lastchar = '\0'; - int len = coap_get_header_uri_query(request, &filter); - - if(len) { - value = strchr(filter, '='); - value[0] = '\0'; - ++value; - len -= strlen(filter) + 1; - - LOG_DBG("Filter %s = ", filter); - LOG_DBG_COAP_STRING(value, len); - LOG_DBG_("\n"); - - if(strcmp(filter, "href") == 0 && value[0] == '/') { - ++value; - --len; - } - - lastchar = value[len - 1]; - value[len - 1] = '\0'; - } -#endif /* COAP_LINK_FORMAT_FILTERING */ - - for(resource = coap_get_first_resource(); resource; - resource = coap_get_next_resource(resource)) { -#if COAP_LINK_FORMAT_FILTERING - /* Filtering */ - if(len) { - if(strcmp(filter, "href") == 0) { - attrib = strstr(resource->url, value); - if(attrib == NULL || (value[-1] == '/' && attrib != resource->url)) { - continue; - } - end = attrib + strlen(attrib); - } else if(resource->attributes != NULL) { - attrib = strstr(resource->attributes, filter); - if(attrib == NULL - || (attrib[strlen(filter)] != '=' - && attrib[strlen(filter)] != '"')) { - continue; - } - attrib += strlen(filter) + 2; - end = strchr(attrib, '"'); - } - - LOG_DBG("Filter: res has attrib %s (%s)\n", attrib, value); - found = attrib; - while((found = strstr(found, value)) != NULL) { - if(found > end) { - found = NULL; - break; - } - if(lastchar == found[len - 1] || lastchar == '*') { - break; - } - ++found; - } - if(found == NULL) { - continue; - } - LOG_DBG("Filter: res has prefix %s\n", found); - if(lastchar != '*' - && (found[len] != '"' && found[len] != ' ' && found[len] != '\0')) { - continue; - } - LOG_DBG("Filter: res has match\n"); - } -#endif - - LOG_DBG("/%s (%p)\npos: s%zu, o%ld, b%zu\n", resource->url, resource, - strpos, (long)*offset, bufpos); - - if(strpos > 0) { - ADD_CHAR_IF_POSSIBLE(','); - } - ADD_CHAR_IF_POSSIBLE('<'); - ADD_CHAR_IF_POSSIBLE('/'); - ADD_STRING_IF_POSSIBLE(resource->url, >=); - ADD_CHAR_IF_POSSIBLE('>'); - - if(resource->attributes != NULL && resource->attributes[0]) { - ADD_CHAR_IF_POSSIBLE(';'); - ADD_STRING_IF_POSSIBLE(resource->attributes, >); - } - - /* buffer full, but resource not completed yet; or: do not break if resource exactly fills buffer. */ - if(bufpos > preferred_size && strpos - bufpos > *offset) { - LOG_DBG("BREAK at %s (%p)\n", resource->url, resource); - break; - } - } - - if(bufpos > 0) { - LOG_DBG("BUF %zu: ", bufpos); - LOG_DBG_COAP_STRING((char *)buffer, bufpos); - LOG_DBG_("\n"); - - coap_set_payload(response, buffer, bufpos); - coap_set_header_content_format(response, APPLICATION_LINK_FORMAT); - } else if(strpos > 0) { - LOG_DBG("well_known_core_handler(): bufpos<=0\n"); - - coap_set_status_code(response, BAD_OPTION_4_02); - coap_set_payload(response, "BlockOutOfScope", 15); - } - - if(resource == NULL) { - LOG_DBG("DONE\n"); - *offset = -1; - } else { - LOG_DBG("MORE at %s (%p)\n", resource->url, resource); - *offset += preferred_size; - } -} -/*---------------------------------------------------------------------------*/ -RESOURCE(res_well_known_core, "ct=40", well_known_core_get_handler, NULL, - NULL, NULL); -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-separate.c b/os/net/app-layer/coap/coap-separate.c deleted file mode 100644 index 7eb5e5675..000000000 --- a/os/net/app-layer/coap/coap-separate.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP module for separate responses. - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#include "coap.h" -#include "coap-separate.h" -#include "coap-transactions.h" -#include "sys/cc.h" -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap" -#define LOG_LEVEL LOG_LEVEL_COAP - -/*---------------------------------------------------------------------------*/ -/*- Separate Response API ---------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -/** - * \brief Reject a request that would require a separate response with an error message - * - * When the server does not have enough resources left to store the information - * for a separate response or otherwise cannot execute the resource handler, - * this function will respond with 5.03 Service Unavailable. The client can - * then retry later. - */ -void -coap_separate_reject() -{ - /* TODO: Accept string pointer for custom error message */ - coap_status_code = SERVICE_UNAVAILABLE_5_03; - coap_error_message = "AlreadyInUse"; -} -/*----------------------------------------------------------------------------*/ -/** - * \brief Initiate a separate response with an empty ACK - * \param coap_req The request to accept - * \param separate_store A pointer to the data structure that will store the - * relevant information for the response - * - * When the server does not have enough resources left to store the information - * for a separate response or otherwise cannot execute the resource handler, - * this function will respond with 5.03 Service Unavailable. The client can - * then retry later. - */ -void -coap_separate_accept(coap_message_t *coap_req, coap_separate_t *separate_store) -{ - coap_transaction_t *const t = coap_get_transaction_by_mid(coap_req->mid); - - LOG_DBG("Separate ACCEPT: /"); - LOG_DBG_COAP_STRING(coap_req->uri_path, coap_req->uri_path_len); - LOG_DBG_(" MID %u\n", coap_req->mid); - if(t) { - /* send separate ACK for CON */ - if(coap_req->type == COAP_TYPE_CON) { - coap_message_t ack[1]; - const coap_endpoint_t *ep; - - ep = coap_get_src_endpoint(coap_req); - if(ep == NULL) { - LOG_ERR("ERROR: no endpoint in request\n"); - } else { - /* ACK with empty code (0) */ - coap_init_message(ack, COAP_TYPE_ACK, 0, coap_req->mid); - /* serializing into IPBUF: Only overwrites header parts that are already parsed into the request struct */ - coap_sendto(ep, coap_databuf(), - coap_serialize_message(ack, coap_databuf())); - } - } - - /* store remote endpoint address */ - coap_endpoint_copy(&separate_store->endpoint, &t->endpoint); - - /* store correct response type */ - separate_store->type = - coap_req->type == COAP_TYPE_CON ? COAP_TYPE_CON : COAP_TYPE_NON; - separate_store->mid = coap_get_mid(); /* if it was a NON, we burned one MID in the engine... */ - - memcpy(separate_store->token, coap_req->token, coap_req->token_len); - separate_store->token_len = coap_req->token_len; - - separate_store->block1_num = coap_req->block1_num; - separate_store->block1_size = coap_req->block1_size; - - separate_store->block2_num = coap_req->block2_num; - separate_store->block2_size = coap_req->block2_size > 0 ? MIN(COAP_MAX_BLOCK_SIZE, coap_req->block2_size) : COAP_MAX_BLOCK_SIZE; - - /* signal the engine to skip automatic response and clear transaction by engine */ - coap_status_code = MANUAL_RESPONSE; - } else { - LOG_ERR("ERROR: Response transaction for separate request not found!\n"); - coap_status_code = INTERNAL_SERVER_ERROR_5_00; - } -} -/*----------------------------------------------------------------------------*/ -void -coap_separate_resume(coap_message_t *response, coap_separate_t *separate_store, - uint8_t code) -{ - coap_init_message(response, separate_store->type, code, - separate_store->mid); - if(separate_store->token_len) { - coap_set_token(response, separate_store->token, - separate_store->token_len); - } - if(separate_store->block1_size) { - coap_set_header_block1(response, separate_store->block1_num, - 0, separate_store->block1_size); - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-separate.h b/os/net/app-layer/coap/coap-separate.h deleted file mode 100644 index 97cbdbf92..000000000 --- a/os/net/app-layer/coap/coap-separate.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP module for separate responses. - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_SEPARATE_H_ -#define COAP_SEPARATE_H_ - -#include "coap.h" -#include "coap-engine.h" - -typedef struct coap_separate { - - coap_endpoint_t endpoint; - - coap_message_type_t type; - uint16_t mid; - - uint8_t token_len; - uint8_t token[COAP_TOKEN_LEN]; - - uint32_t block1_num; - uint16_t block1_size; - - uint32_t block2_num; - uint16_t block2_size; -} coap_separate_t; - -int coap_separate_handler(coap_resource_t *resource, coap_message_t *request, - coap_message_t *response); -void coap_separate_reject(void); -void coap_separate_accept(coap_message_t *request, - coap_separate_t *separate_store); -void coap_separate_resume(coap_message_t *response, - coap_separate_t *separate_store, - uint8_t code); - -#endif /* COAP_SEPARATE_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-timer-default.c b/os/net/app-layer/coap/coap-timer-default.c deleted file mode 100644 index 7da3dfb05..000000000 --- a/os/net/app-layer/coap/coap-timer-default.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2016, SICS, Swedish ICT AB. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * CoAP timer driver implementation based on Contiki etimers - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap-timer - * @{ - * - * \defgroup coap-timer-default CoAP timer for Contiki-NG - * @{ - * - * This is an implementation of CoAP timer for Contiki-NG. - */ - -#include "coap-timer.h" -#include "sys/clock.h" -#include "sys/etimer.h" -#include "sys/process.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap-timer" -#define LOG_LEVEL LOG_LEVEL_NONE - -PROCESS(coap_timer_process, "coap timer process"); - -static uint64_t current_time; -static struct etimer timer; -/*---------------------------------------------------------------------------*/ -static void -update_timer(void) -{ - uint64_t remaining; - remaining = coap_timer_time_to_next_expiration(); - LOG_DBG("remaining %lu msec\n", (unsigned long)remaining); - if(remaining == 0) { - /* Run as soon as possible */ - process_poll(&coap_timer_process); - } else { - remaining *= CLOCK_SECOND; - remaining /= 1000; - if(remaining > CLOCK_SECOND * 60) { - /* Make sure the CoAP timer clock is updated at least once per minute */ - remaining = CLOCK_SECOND * 60; - } else if(remaining < 1) { - /* Wait minimum one system clock tick */ - remaining = 1; - } - etimer_set(&timer, (clock_time_t)remaining); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(coap_timer_process, ev, data) -{ - PROCESS_BEGIN(); - - etimer_set(&timer, CLOCK_SECOND); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER || - ev == PROCESS_EVENT_POLL); - - if(coap_timer_run()) { - /* Needs to run again */ - process_poll(&coap_timer_process); - } else { - update_timer(); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static uint64_t -uptime(void) -{ - static clock_time_t last; - clock_time_t now; - uint64_t diff; - - now = clock_time(); - diff = (clock_time_t)(now - last); - if(diff > 0) { - current_time += (diff * 1000) / CLOCK_SECOND; - last = now; - } - return current_time; -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - process_start(&coap_timer_process, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -update(void) -{ - process_poll(&coap_timer_process); -} -/*---------------------------------------------------------------------------*/ -const coap_timer_driver_t coap_timer_default_driver = { - .init = init, - .uptime = uptime, - .update = update, -}; -/*---------------------------------------------------------------------------*/ -/** @} */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-timer.c b/os/net/app-layer/coap/coap-timer.c deleted file mode 100644 index 06a65c7f6..000000000 --- a/os/net/app-layer/coap/coap-timer.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2016, SICS, Swedish ICT AB. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * CoAP timer implementation. - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap-timer - * @{ - */ - -#include "coap-timer.h" -#include "lib/list.h" -#include "sys/cc.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap-timer" -#define LOG_LEVEL LOG_LEVEL_NONE - -LIST(timer_list); -static uint8_t is_initialized; -/*---------------------------------------------------------------------------*/ -static void -add_timer(coap_timer_t *timer) -{ - coap_timer_t *n, *l, *p; - - if(!is_initialized) { - /* The coap_timer system has not yet been initialized */ - coap_timer_init(); - } - - LOG_DBG("adding timer %p at %lu\n", timer, - (unsigned long)timer->expiration_time); - - p = list_head(timer_list); - - /* Make sure the timer is not already added to the timer list */ - list_remove(timer_list, timer); - - for(l = NULL, n = list_head(timer_list); n != NULL; l = n, n = n->next) { - if(timer->expiration_time < n->expiration_time) { - list_insert(timer_list, l, timer); - timer = NULL; - break; - } - } - - if(timer != NULL) { - list_insert(timer_list, l, timer); - } - - if(p != list_head(timer_list)) { - /* The next timer to expire has changed so we need to notify the driver */ - COAP_TIMER_DRIVER.update(); - } -} -/*---------------------------------------------------------------------------*/ -void -coap_timer_stop(coap_timer_t *timer) -{ - LOG_DBG("stopping timer %p\n", timer); - - /* Mark timer as expired right now */ - timer->expiration_time = coap_timer_uptime(); - - list_remove(timer_list, timer); -} -/*---------------------------------------------------------------------------*/ -void -coap_timer_set(coap_timer_t *timer, uint64_t time) -{ - timer->expiration_time = coap_timer_uptime() + time; - add_timer(timer); -} -/*---------------------------------------------------------------------------*/ -void -coap_timer_reset(coap_timer_t *timer, uint64_t time) -{ - timer->expiration_time += time; - add_timer(timer); -} -/*---------------------------------------------------------------------------*/ -uint64_t -coap_timer_time_to_next_expiration(void) -{ - uint64_t now; - coap_timer_t *next; - - next = list_head(timer_list); - if(next == NULL) { - /* No pending timers - return a time in the future */ - return 60000; - } - - now = coap_timer_uptime(); - if(now < next->expiration_time) { - return next->expiration_time - now; - } - /* The next timer should already have expired */ - return 0; -} -/*---------------------------------------------------------------------------*/ -int -coap_timer_run(void) -{ - uint64_t now; - coap_timer_t *next; - - /* Always get the current time because it might trigger clock updates */ - now = coap_timer_uptime(); - - next = list_head(timer_list); - if(next == NULL) { - /* No pending timers */ - return 0; - } - - if(next->expiration_time <= now) { - LOG_DBG("timer %p expired at %lu\n", next, (unsigned long)now); - - /* This timer should expire now */ - list_remove(timer_list, next); - - if(next->callback) { - next->callback(next); - } - - /* The next timer has changed */ - COAP_TIMER_DRIVER.update(); - - /* Check if there is another pending timer */ - next = list_head(timer_list); - if(next != NULL && next->expiration_time <= coap_timer_uptime()) { - /* Need to run again */ - return 1; - } - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -void -coap_timer_init(void) -{ - if(is_initialized) { - return; - } - is_initialized = 1; - list_init(timer_list); - if(COAP_TIMER_DRIVER.init) { - COAP_TIMER_DRIVER.init(); - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-timer.h b/os/net/app-layer/coap/coap-timer.h deleted file mode 100644 index 0461232ba..000000000 --- a/os/net/app-layer/coap/coap-timer.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2016, SICS, Swedish ICT AB. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * CoAP timer API. - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap - * @{ - * - * \defgroup coap-timer CoAP timer API - * @{ - * - * The CoAP timer API defines a common interface for CoAP timer and time functionality. - */ - -#ifndef COAP_TIMER_H_ -#define COAP_TIMER_H_ - -#include "contiki.h" -#include - -typedef struct coap_timer coap_timer_t; -struct coap_timer { - coap_timer_t *next; - void (* callback)(coap_timer_t *); - void *user_data; - uint64_t expiration_time; -}; - -typedef struct { - void (* init)(void); - uint64_t (* uptime)(void); - void (* update)(void); -} coap_timer_driver_t; - -#ifndef COAP_TIMER_DRIVER -#ifdef COAP_TIMER_CONF_DRIVER -#define COAP_TIMER_DRIVER COAP_TIMER_CONF_DRIVER -#else /* COAP_TIMER_CONF_DRIVER */ -#define COAP_TIMER_DRIVER coap_timer_default_driver -#endif /* COAP_TIMER_CONF_DRIVER */ -#endif /* COAP_TIMER_DRIVER */ - -extern const coap_timer_driver_t COAP_TIMER_DRIVER; - -/** - * \brief Get the time since boot in milliseconds. - * \return The number of milliseconds since boot. - */ -static inline uint64_t -coap_timer_uptime(void) -{ - return COAP_TIMER_DRIVER.uptime(); -} - -/** - * \brief Get the time since boot in seconds. - * \return The number of seconds since boot. - */ -static inline uint32_t -coap_timer_seconds(void) -{ - return (uint32_t)(COAP_TIMER_DRIVER.uptime() / 1000); -} - -/** - * \brief Set a callback function to be called when a CoAP timer expires. - * - * \param timer A pointer to a CoAP timer. - * \param callback A callback function. - */ -static inline void -coap_timer_set_callback(coap_timer_t *timer, void (* callback)(coap_timer_t *)) -{ - timer->callback = callback; -} - -/** - * \brief Get user data that has been attached to a CoAP timer. - * - * \param timer A pointer to a CoAP timer. - * \return An opaque pointer to user data or NULL if no user data is - * attached to the timer. - */ -static inline void * -coap_timer_get_user_data(coap_timer_t *timer) -{ - return timer->user_data; -} - -/** - * \brief Attach user data to a CoAP timer. - * - * \param timer A pointer to a CoAP timer. - * \param data An opaque pointer to user data. - */ -static inline void -coap_timer_set_user_data(coap_timer_t *timer, void *data) -{ - timer->user_data = data; -} - -/** - * \brief Check if a CoAP timer has expired. - * - * \param timer A pointer to a CoAP timer. - * \return Non-zero if the timer has expired, zero otherwise. - */ -static inline int -coap_timer_expired(const coap_timer_t *timer) -{ - return timer->expiration_time <= coap_timer_uptime(); -} - -/** - * \brief Stop a pending CoAP timer. - * - * After this function has been called, the timer will be expired - * and will not call the callback function. - * - * \param timer A pointer to a CoAP timer. - */ -void coap_timer_stop(coap_timer_t *timer); - -/** - * \brief Set a CoAP timer to expire after the specified time. - * - * \param timer A pointer to a CoAP timer. - * \param time The time until the timer expires. - */ -void coap_timer_set(coap_timer_t *timer, uint64_t time); - -/** - * \brief Reset a CoAP timer to expire a specified time after the - * last expiration time. - * - * This function sets the CoAP timer to expire the specified time - * after the previous expiration time. If the new expiration time - * has already passed, the timer will expire as soon as possible. - * - * If the timer has not yet expired when this function is called, - * the time until the timer expires will be extended by the - * specified time. - * - * \param timer A pointer to a CoAP timer. - * \param time The time after previous expiration the timer expires. - */ -void coap_timer_reset(coap_timer_t *timer, uint64_t time); - -/** - * Get the time until next CoAP timer expires or 0 if there already exists - * expired timers that have not yet been processed. This function is normally - * never called by application code. - * - * Returns the time to next CoAP timer expires or 0 if unprocessed expired - * timers exists. Returns a time in the future if there are no timers pending. - */ -uint64_t coap_timer_time_to_next_expiration(void); - -/** - * This function must be called periodically by the CoAP timer driver to - * process any expired CoAP timers. This function is normally never called by - * application code. - * - * Returns non-zero if it needs to run again to process more timers. - */ -int coap_timer_run(void); - -/** - * This function initializes the CoAP timer library. It is automatically - * called at first use of a CoAP timer. This function is normally never called - * by application code. - */ -void coap_timer_init(void); - -#endif /* COAP_TIMER_H_ */ -/** @} */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-transactions.c b/os/net/app-layer/coap/coap-transactions.c deleted file mode 100644 index a62e8d21f..000000000 --- a/os/net/app-layer/coap/coap-transactions.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP module for reliable transport - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#include "coap-transactions.h" -#include "coap-observe.h" -#include "coap-timer.h" -#include "lib/memb.h" -#include "lib/list.h" -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap" -#define LOG_LEVEL LOG_LEVEL_COAP - -/*---------------------------------------------------------------------------*/ -MEMB(transactions_memb, coap_transaction_t, COAP_MAX_OPEN_TRANSACTIONS); -LIST(transactions_list); - -/*---------------------------------------------------------------------------*/ -static void -coap_retransmit_transaction(coap_timer_t *nt) -{ - coap_transaction_t *t = coap_timer_get_user_data(nt); - if(t == NULL) { - LOG_DBG("No retransmission data in coap_timer!\n"); - return; - } - ++(t->retrans_counter); - LOG_DBG("Retransmitting %u (%u)\n", t->mid, t->retrans_counter); - coap_send_transaction(t); -} -/*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------*/ -/*- Internal API ------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -coap_transaction_t * -coap_new_transaction(uint16_t mid, const coap_endpoint_t *endpoint) -{ - coap_transaction_t *t = memb_alloc(&transactions_memb); - - if(t) { - t->mid = mid; - t->retrans_counter = 0; - - /* save client address */ - coap_endpoint_copy(&t->endpoint, endpoint); - - list_add(transactions_list, t); /* list itself makes sure same element is not added twice */ - } - - return t; -} -/*---------------------------------------------------------------------------*/ -void -coap_send_transaction(coap_transaction_t *t) -{ - LOG_DBG("Sending transaction %u\n", t->mid); - - if(COAP_TYPE_CON == - ((COAP_HEADER_TYPE_MASK & t->message[0]) >> COAP_HEADER_TYPE_POSITION)) { - if(t->retrans_counter <= COAP_MAX_RETRANSMIT) { - /* not timed out yet */ - coap_sendto(&t->endpoint, t->message, t->message_len); - LOG_DBG("Keeping transaction %u\n", t->mid); - - if(t->retrans_counter == 0) { - coap_timer_set_callback(&t->retrans_timer, coap_retransmit_transaction); - coap_timer_set_user_data(&t->retrans_timer, t); - t->retrans_interval = - COAP_RESPONSE_TIMEOUT_TICKS + (rand() % - COAP_RESPONSE_TIMEOUT_BACKOFF_MASK); - LOG_DBG("Initial interval %lu msec\n", - (unsigned long)t->retrans_interval); - } else { - t->retrans_interval <<= 1; /* double */ - LOG_DBG("Doubled (%u) interval %lu s\n", t->retrans_counter, - (unsigned long)(t->retrans_interval / 1000)); - } - - /* interval updated above */ - coap_timer_set(&t->retrans_timer, t->retrans_interval); - } else { - /* timed out */ - LOG_DBG("Timeout\n"); - coap_resource_response_handler_t callback = t->callback; - void *callback_data = t->callback_data; - - /* handle observers */ - coap_remove_observer_by_client(&t->endpoint); - - coap_clear_transaction(t); - - if(callback) { - callback(callback_data, NULL); - } - } - } else { - coap_sendto(&t->endpoint, t->message, t->message_len); - coap_clear_transaction(t); - } -} -/*---------------------------------------------------------------------------*/ -void -coap_clear_transaction(coap_transaction_t *t) -{ - if(t) { - LOG_DBG("Freeing transaction %u: %p\n", t->mid, t); - - coap_timer_stop(&t->retrans_timer); - list_remove(transactions_list, t); - memb_free(&transactions_memb, t); - } -} -/*---------------------------------------------------------------------------*/ -coap_transaction_t * -coap_get_transaction_by_mid(uint16_t mid) -{ - coap_transaction_t *t = NULL; - - for(t = (coap_transaction_t *)list_head(transactions_list); t; t = t->next) { - if(t->mid == mid) { - LOG_DBG("Found transaction for MID %u: %p\n", t->mid, t); - return t; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap-transactions.h b/os/net/app-layer/coap/coap-transactions.h deleted file mode 100644 index 65334b4eb..000000000 --- a/os/net/app-layer/coap/coap-transactions.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * CoAP module for reliable transport - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup coap - * @{ - */ - -#ifndef COAP_TRANSACTIONS_H_ -#define COAP_TRANSACTIONS_H_ - -#include "coap.h" -#include "coap-engine.h" -#include "coap-timer.h" - -/* - * Modulo mask (thus +1) for a random number to get the tick number for the random - * retransmission time between COAP_RESPONSE_TIMEOUT and COAP_RESPONSE_TIMEOUT*COAP_RESPONSE_RANDOM_FACTOR. - */ -#define COAP_RESPONSE_TIMEOUT_TICKS (1000 * COAP_RESPONSE_TIMEOUT) -#define COAP_RESPONSE_TIMEOUT_BACKOFF_MASK (uint32_t)(((1000 * COAP_RESPONSE_TIMEOUT * ((float)COAP_RESPONSE_RANDOM_FACTOR - 1.0)) + 0.5) + 1) - -/* container for transactions with message buffer and retransmission info */ -typedef struct coap_transaction { - struct coap_transaction *next; /* for LIST */ - - uint16_t mid; - coap_timer_t retrans_timer; - uint32_t retrans_interval; - uint8_t retrans_counter; - - coap_endpoint_t endpoint; - - coap_resource_response_handler_t callback; - void *callback_data; - - uint16_t message_len; - uint8_t message[COAP_MAX_PACKET_SIZE + 1]; /* +1 for the terminating '\0' which will not be sent - * Use snprintf(buf, len+1, "", ...) to completely fill payload */ -} coap_transaction_t; - -coap_transaction_t *coap_new_transaction(uint16_t mid, const coap_endpoint_t *ep); -void coap_send_transaction(coap_transaction_t *t); -void coap_clear_transaction(coap_transaction_t *t); -coap_transaction_t *coap_get_transaction_by_mid(uint16_t mid); - -#endif /* COAP_TRANSACTIONS_H_ */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-transport.h b/os/net/app-layer/coap/coap-transport.h deleted file mode 100644 index 3de6f71dc..000000000 --- a/os/net/app-layer/coap/coap-transport.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2016-2018, SICS, Swedish ICT AB. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * API for CoAP transport - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap - * @{ - * - * \defgroup coap-transport CoAP transport API - * @{ - * - * The CoAP transport API defines a common interface for sending/receiving - * CoAP messages. - */ - -#ifndef COAP_TRANSPORT_H_ -#define COAP_TRANSPORT_H_ - -#include "coap-endpoint.h" - -/** - * \brief Returns a common data buffer that can be used when - * generating CoAP messages for transmission. The buffer - * size is at least COAP_MAX_PACKET_SIZE bytes. - * - * In Contiki-NG, this corresponds to the uIP buffer. - * - * \return A pointer to a data buffer where a CoAP message can be stored. - */ -uint8_t *coap_databuf(void); - -/** - * \brief Send a message to the specified CoAP endpoint - * \param ep A pointer to a CoAP endpoint - * \param data A pointer to data to send - * \param len The size of the data to send - * \return The number of bytes sent or negative if an error occurred. - */ -int coap_sendto(const coap_endpoint_t *ep, const uint8_t *data, uint16_t len); - -/** - * \brief Initialize the CoAP transport. - * - * This function initializes the CoAP transport implementation and - * should only be called by the CoAP engine. - */ -void coap_transport_init(void); - -#endif /* COAP_TRANSPORT_H_ */ -/** @} */ -/** @} */ diff --git a/os/net/app-layer/coap/coap-uip.c b/os/net/app-layer/coap/coap-uip.c deleted file mode 100644 index 8109db20e..000000000 --- a/os/net/app-layer/coap/coap-uip.c +++ /dev/null @@ -1,598 +0,0 @@ -/* - * Copyright (c) 2016, SICS, Swedish ICT AB. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * CoAP transport implementation for uIPv6 - * \author - * Niclas Finne - * Joakim Eriksson - */ - -/** - * \addtogroup coap-transport - * @{ - * - * \defgroup coap-uip CoAP transport implementation for uIP - * @{ - * - * This is an implementation of CoAP transport and CoAP endpoint over uIP - * with DTLS support. - */ - -#include "contiki.h" -#include "net/ipv6/uip-udp-packet.h" -#include "net/ipv6/uiplib.h" -#include "net/routing/routing.h" -#include "coap.h" -#include "coap-engine.h" -#include "coap-endpoint.h" -#include "coap-transport.h" -#include "coap-transactions.h" -#include "coap-constants.h" -#include "coap-keystore.h" -#include "coap-keystore-simple.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap-uip" -#define LOG_LEVEL LOG_LEVEL_COAP - -#ifdef WITH_DTLS -#include "tinydtls.h" -#include "dtls.h" -#endif /* WITH_DTLS */ - -/* sanity check for configured values */ -#if COAP_MAX_PACKET_SIZE > (UIP_BUFSIZE - UIP_IPH_LEN - UIP_UDPH_LEN) -#error "UIP_CONF_BUFFER_SIZE too small for COAP_MAX_CHUNK_SIZE" -#endif - -#define SERVER_LISTEN_PORT UIP_HTONS(COAP_DEFAULT_PORT) -#define SERVER_LISTEN_SECURE_PORT UIP_HTONS(COAP_DEFAULT_SECURE_PORT) - -#ifdef WITH_DTLS -static dtls_handler_t cb; -static dtls_context_t *dtls_context = NULL; - -static const coap_keystore_t *dtls_keystore = NULL; -static struct uip_udp_conn *dtls_conn = NULL; -#endif /* WITH_DTLS */ - -PROCESS(coap_engine, "CoAP Engine"); - -static struct uip_udp_conn *udp_conn = NULL; - -/*---------------------------------------------------------------------------*/ -void -coap_endpoint_log(const coap_endpoint_t *ep) -{ - if(ep == NULL) { - LOG_OUTPUT("(NULL EP)"); - return; - } - if(ep->secure) { - LOG_OUTPUT("coaps://["); - } else { - LOG_OUTPUT("coap://["); - } - log_6addr(&ep->ipaddr); - LOG_OUTPUT("]:%u", uip_ntohs(ep->port)); -} -/*---------------------------------------------------------------------------*/ -void -coap_endpoint_print(const coap_endpoint_t *ep) -{ - if(ep == NULL) { - printf("(NULL EP)"); - return; - } - if(ep->secure) { - printf("coaps://["); - } else { - printf("coap://["); - } - uiplib_ipaddr_print(&ep->ipaddr); - printf("]:%u", uip_ntohs(ep->port)); -} -/*---------------------------------------------------------------------------*/ -int -coap_endpoint_snprint(char *buf, size_t size, const coap_endpoint_t *ep) -{ - int n; - if(buf == NULL || size == 0) { - return 0; - } - if(ep == NULL) { - n = snprintf(buf, size - 1, "(NULL EP)"); - } else { - if(ep->secure) { - n = snprintf(buf, size - 1, "coaps://["); - } else { - n = snprintf(buf, size - 1, "coap://["); - } - if(n < size - 1) { - n += uiplib_ipaddr_snprint(&buf[n], size - n - 1, &ep->ipaddr); - } - if(n < size - 1) { - n += snprintf(&buf[n], size -n - 1, "]:%u", uip_ntohs(ep->port)); - } - } - if(n >= size - 1) { - buf[size - 1] = '\0'; - } - return n; -} -/*---------------------------------------------------------------------------*/ -void -coap_endpoint_copy(coap_endpoint_t *destination, - const coap_endpoint_t *from) -{ - uip_ipaddr_copy(&destination->ipaddr, &from->ipaddr); - destination->port = from->port; - destination->secure = from->secure; -} -/*---------------------------------------------------------------------------*/ -int -coap_endpoint_cmp(const coap_endpoint_t *e1, const coap_endpoint_t *e2) -{ - if(!uip_ipaddr_cmp(&e1->ipaddr, &e2->ipaddr)) { - return 0; - } - return e1->port == e2->port && e1->secure == e2->secure; -} -/*---------------------------------------------------------------------------*/ -static int -index_of(const char *data, int offset, int len, uint8_t c) -{ - if(offset < 0) { - return offset; - } - for(; offset < len; offset++) { - if(data[offset] == c) { - return offset; - } - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static int -get_port(const char *inbuf, size_t len, uint32_t *value) -{ - int i; - *value = 0; - for(i = 0; i < len; i++) { - if(inbuf[i] >= '0' && inbuf[i] <= '9') { - *value = *value * 10 + (inbuf[i] - '0'); - } else { - break; - } - } - return i; -} -/*---------------------------------------------------------------------------*/ -int -coap_endpoint_parse(const char *text, size_t size, coap_endpoint_t *ep) -{ - /* Only IPv6 supported */ - int start = index_of(text, 0, size, '['); - int end = index_of(text, start, size, ']'); - uint32_t port; - - ep->secure = strncmp(text, "coaps:", 6) == 0; - if(start >= 0 && end > start && - uiplib_ipaddrconv(&text[start], &ep->ipaddr)) { - if(text[end + 1] == ':' && - get_port(text + end + 2, size - end - 2, &port)) { - ep->port = UIP_HTONS(port); - } else if(ep->secure) { - /* Use secure CoAP port by default for secure endpoints. */ - ep->port = SERVER_LISTEN_SECURE_PORT; - } else { - ep->port = SERVER_LISTEN_PORT; - } - return 1; - } else if(size < UIPLIB_IPV6_MAX_STR_LEN) { - char buf[UIPLIB_IPV6_MAX_STR_LEN]; - memcpy(buf, text, size); - buf[size] = '\0'; - if(uiplib_ipaddrconv(buf, &ep->ipaddr)) { - ep->port = SERVER_LISTEN_PORT; - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static const coap_endpoint_t * -get_src_endpoint(uint8_t secure) -{ - static coap_endpoint_t src; - uip_ipaddr_copy(&src.ipaddr, &UIP_IP_BUF->srcipaddr); - src.port = UIP_UDP_BUF->srcport; - src.secure = secure; - return &src; -} -/*---------------------------------------------------------------------------*/ -int -coap_endpoint_is_secure(const coap_endpoint_t *ep) -{ - return ep->secure; -} -/*---------------------------------------------------------------------------*/ -int -coap_endpoint_is_connected(const coap_endpoint_t *ep) -{ -#ifndef CONTIKI_TARGET_NATIVE - if(!uip_is_addr_linklocal(&ep->ipaddr) - && NETSTACK_ROUTING.node_is_reachable() == 0) { - return 0; - } -#endif - -#ifdef WITH_DTLS - if(ep != NULL && ep->secure != 0) { - dtls_peer_t *peer; - if(dtls_context == NULL) { - return 0; - } - peer = dtls_get_peer(dtls_context, ep); - if(peer != NULL) { - /* only if handshake is done! */ - LOG_DBG("DTLS peer state for "); - LOG_DBG_COAP_EP(ep); - LOG_DBG_(" is %d (%sconnected)\n", peer->state, - dtls_peer_is_connected(peer) ? "" : "not "); - return dtls_peer_is_connected(peer); - } else { - LOG_DBG("DTLS did not find peer "); - LOG_DBG_COAP_EP(ep); - LOG_DBG_("\n"); - return 0; - } - } -#endif /* WITH_DTLS */ - - /* Assume connected */ - return 1; -} -/*---------------------------------------------------------------------------*/ -int -coap_endpoint_connect(coap_endpoint_t *ep) -{ - if(ep->secure == 0) { - LOG_DBG("connect to "); - LOG_DBG_COAP_EP(ep); - LOG_DBG_("\n"); - return 1; - } - -#ifdef WITH_DTLS - LOG_DBG("DTLS connect to "); - LOG_DBG_COAP_EP(ep); - LOG_DBG_("\n"); - - /* setup all address info here... should be done to connect */ - if(dtls_context) { - dtls_connect(dtls_context, ep); - return 1; - } -#endif /* WITH_DTLS */ - - return 0; -} -/*---------------------------------------------------------------------------*/ -void -coap_endpoint_disconnect(coap_endpoint_t *ep) -{ -#ifdef WITH_DTLS - if(ep && ep->secure && dtls_context) { - dtls_close(dtls_context, ep); - } -#endif /* WITH_DTLS */ -} -/*---------------------------------------------------------------------------*/ -uint8_t * -coap_databuf(void) -{ - return uip_appdata; -} -/*---------------------------------------------------------------------------*/ -void -coap_transport_init(void) -{ - process_start(&coap_engine, NULL); -#ifdef WITH_DTLS - dtls_init(); - -#if COAP_DTLS_KEYSTORE_CONF_WITH_SIMPLE - coap_keystore_simple_init(); -#endif /* COAP_DTLS_KEYSTORE_CONF_WITH_SIMPLE */ - -#endif /* WITH_DTLS */ -} -/*---------------------------------------------------------------------------*/ -#ifdef WITH_DTLS -static void -process_secure_data(void) -{ - LOG_INFO("receiving secure UDP datagram from ["); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("]:%u\n", uip_ntohs(UIP_UDP_BUF->srcport)); - LOG_INFO(" Length: %u\n", uip_datalen()); - - if(dtls_context) { - dtls_handle_message(dtls_context, (coap_endpoint_t *)get_src_endpoint(1), - uip_appdata, uip_datalen()); - } -} -#endif /* WITH_DTLS */ -/*---------------------------------------------------------------------------*/ -static void -process_data(void) -{ - LOG_INFO("receiving UDP datagram from ["); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("]:%u\n", uip_ntohs(UIP_UDP_BUF->srcport)); - LOG_INFO(" Length: %u\n", uip_datalen()); - - coap_receive(get_src_endpoint(0), uip_appdata, uip_datalen()); -} -/*---------------------------------------------------------------------------*/ -int -coap_sendto(const coap_endpoint_t *ep, const uint8_t *data, uint16_t length) -{ - if(ep == NULL) { - LOG_WARN("failed to send - no endpoint\n"); - return -1; - } - - if(!coap_endpoint_is_connected(ep)) { - LOG_WARN("endpoint "); - LOG_WARN_COAP_EP(ep); - LOG_WARN_(" not connected - dropping packet\n"); - return -1; - } - -#ifdef WITH_DTLS - if(coap_endpoint_is_secure(ep)) { - if(dtls_context) { - int ret; - - ret = dtls_write(dtls_context, (session_t *)ep, (uint8_t *)data, length); - LOG_INFO("sent DTLS to "); - LOG_INFO_COAP_EP(ep); - if(ret < 0) { - LOG_INFO_(" - error %d\n", ret); - } else { - LOG_INFO_(" %d/%u bytes\n", ret, length); - } - return ret; - } else { - LOG_WARN("no DTLS context\n"); - return -1; - } - } -#endif /* WITH_DTLS */ - - uip_udp_packet_sendto(udp_conn, data, length, &ep->ipaddr, ep->port); - LOG_INFO("sent to "); - LOG_INFO_COAP_EP(ep); - LOG_INFO_(" %u bytes\n", length); - return length; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(coap_engine, ev, data) -{ - PROCESS_BEGIN(); - - /* new connection with remote host */ - udp_conn = udp_new(NULL, 0, NULL); - udp_bind(udp_conn, SERVER_LISTEN_PORT); - LOG_INFO("Listening on port %u\n", uip_ntohs(udp_conn->lport)); - -#ifdef WITH_DTLS - /* create new context with app-data */ - dtls_conn = udp_new(NULL, 0, NULL); - if(dtls_conn != NULL) { - udp_bind(dtls_conn, SERVER_LISTEN_SECURE_PORT); - LOG_INFO("DTLS listening on port %u\n", uip_ntohs(dtls_conn->lport)); - dtls_context = dtls_new_context(dtls_conn); - } - if(!dtls_context) { - LOG_WARN("DTLS: cannot create context\n"); - } else { - dtls_set_handler(dtls_context, &cb); - } -#endif /* WITH_DTLS */ - - while(1) { - PROCESS_YIELD(); - - if(ev == tcpip_event) { - if(uip_newdata()) { -#ifdef WITH_DTLS - if(uip_udp_conn == dtls_conn) { - process_secure_data(); - continue; - } -#endif /* WITH_DTLS */ - process_data(); - } - } - } /* while (1) */ - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ - -/* DTLS */ -#ifdef WITH_DTLS - -/* This is input coming from the DTLS code - e.g. de-crypted input from - the other side - peer */ -static int -input_from_peer(struct dtls_context_t *ctx, - session_t *session, uint8_t *data, size_t len) -{ - size_t i; - - if(LOG_DBG_ENABLED) { - LOG_DBG("received DTLS data:"); - for(i = 0; i < len; i++) { - LOG_DBG_("%c", data[i]); - } - LOG_DBG_("\n"); - LOG_DBG("Hex:"); - for(i = 0; i < len; i++) { - LOG_DBG_("%02x", data[i]); - } - LOG_DBG_("\n"); - } - - /* Ensure that the endpoint is tagged as secure */ - session->secure = 1; - - coap_receive(session, data, len); - - return 0; -} - -/* This is output from the DTLS code to be sent to peer (encrypted) */ -static int -output_to_peer(struct dtls_context_t *ctx, - session_t *session, uint8_t *data, size_t len) -{ - struct uip_udp_conn *udp_connection = dtls_get_app_data(ctx); - LOG_DBG("output_to DTLS peer ["); - LOG_DBG_6ADDR(&session->ipaddr); - LOG_DBG_("]:%u %ld bytes\n", uip_ntohs(session->port), (long)len); - uip_udp_packet_sendto(udp_connection, data, len, - &session->ipaddr, session->port); - return len; -} - -/* This defines the key-store set API since we hookup DTLS here */ -void -coap_set_keystore(const coap_keystore_t *keystore) -{ - dtls_keystore = keystore; -} - -/* This function is the "key store" for tinyDTLS. It is called to - * retrieve a key for the given identity within this particular - * session. */ -static int -get_psk_info(struct dtls_context_t *ctx, - const session_t *session, - dtls_credentials_type_t type, - const unsigned char *id, size_t id_len, - unsigned char *result, size_t result_length) -{ - coap_keystore_psk_entry_t ks; - - if(dtls_keystore == NULL) { - LOG_DBG("--- No key store available ---\n"); - return 0; - } - - memset(&ks, 0, sizeof(ks)); - LOG_DBG("---===>>> Getting the Key or ID <<<===---\n"); - switch(type) { - case DTLS_PSK_IDENTITY: - if(id && id_len) { - ks.identity_hint = id; - ks.identity_hint_len = id_len; - LOG_DBG("got psk_identity_hint: '"); - LOG_DBG_COAP_STRING((const char *)id, id_len); - LOG_DBG_("'\n"); - } - - if(dtls_keystore->coap_get_psk_info) { - /* we know that session is a coap endpoint */ - dtls_keystore->coap_get_psk_info((coap_endpoint_t *)session, &ks); - } - if(ks.identity == NULL || ks.identity_len == 0) { - LOG_DBG("no psk_identity found\n"); - return 0; - } - - if(result_length < ks.identity_len) { - LOG_DBG("cannot return psk_identity -- buffer too small\n"); - return dtls_alert_fatal_create(DTLS_ALERT_INTERNAL_ERROR); - } - memcpy(result, ks.identity, ks.identity_len); - LOG_DBG("psk_identity with %u bytes found\n", ks.identity_len); - return ks.identity_len; - - case DTLS_PSK_KEY: - if(dtls_keystore->coap_get_psk_info) { - ks.identity = id; - ks.identity_len = id_len; - /* we know that session is a coap endpoint */ - dtls_keystore->coap_get_psk_info((coap_endpoint_t *)session, &ks); - } - if(ks.key == NULL || ks.key_len == 0) { - LOG_DBG("PSK for unknown id requested, exiting\n"); - return dtls_alert_fatal_create(DTLS_ALERT_ILLEGAL_PARAMETER); - } - - if(result_length < ks.key_len) { - LOG_DBG("cannot return psk -- buffer too small\n"); - return dtls_alert_fatal_create(DTLS_ALERT_INTERNAL_ERROR); - } - memcpy(result, ks.key, ks.key_len); - LOG_DBG("psk with %u bytes found\n", ks.key_len); - return ks.key_len; - - default: - LOG_WARN("unsupported key store request type: %d\n", type); - } - - return dtls_alert_fatal_create(DTLS_ALERT_INTERNAL_ERROR); -} - - -static dtls_handler_t cb = { - .write = output_to_peer, - .read = input_from_peer, - .event = NULL, -#ifdef DTLS_PSK - .get_psk_info = get_psk_info, -#endif /* DTLS_PSK */ -#ifdef DTLS_ECC - /* .get_ecdsa_key = get_ecdsa_key, */ - /* .verify_ecdsa_key = verify_ecdsa_key */ -#endif /* DTLS_ECC */ -}; - -#endif /* WITH_DTLS */ -/*---------------------------------------------------------------------------*/ -/** @} */ -/** @} */ diff --git a/os/net/app-layer/coap/coap.c b/os/net/app-layer/coap/coap.c deleted file mode 100644 index 8bc2f90f9..000000000 --- a/os/net/app-layer/coap/coap.c +++ /dev/null @@ -1,1133 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * An implementation of the Constrained Application Protocol (RFC). - * \author - * Matthias Kovatsch - * - * Joakim Eriksson, joakim.eriksson@ri.se - * Niclas Finne, niclas.finne@ri.se - */ - -/** - * \addtogroup coap - * @{ - */ - - -#include -#include -#include -#include "sys/cc.h" - -#include "coap.h" -#include "coap-transactions.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "coap" -#define LOG_LEVEL LOG_LEVEL_COAP - -/*---------------------------------------------------------------------------*/ -/*- Variables ---------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -static uint16_t current_mid = 0; - -coap_status_t coap_status_code = NO_ERROR; -const char *coap_error_message = ""; -/*---------------------------------------------------------------------------*/ -/*- Local helper functions --------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -static uint16_t -coap_log_2(uint16_t value) -{ - uint16_t result = 0; - - do { - value = value >> 1; - result++; - } while(value); - - return result ? result - 1 : result; -} -/*---------------------------------------------------------------------------*/ -static uint32_t -coap_parse_int_option(uint8_t *bytes, size_t length) -{ - uint32_t var = 0; - int i = 0; - - while(i < length) { - var <<= 8; - var |= bytes[i++]; - } - return var; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -coap_option_nibble(unsigned int value) -{ - if(value < 13) { - return value; - } else if(value <= 0xFF + 13) { - return 13; - } else { - return 14; - } -} -/*---------------------------------------------------------------------------*/ -static size_t -coap_set_option_header(unsigned int delta, size_t length, uint8_t *buffer) -{ - size_t written = 0; - - buffer[0] = coap_option_nibble(delta) << 4 | coap_option_nibble(length); - - if(delta > 268) { - buffer[++written] = ((delta - 269) >> 8) & 0xff; - buffer[++written] = (delta - 269) & 0xff; - } else if(delta > 12) { - buffer[++written] = (delta - 13); - } - - if(length > 268) { - buffer[++written] = ((length - 269) >> 8) & 0xff; - buffer[++written] = (length - 269) & 0xff; - } else if(length > 12) { - buffer[++written] = (length - 13); - } - - LOG_DBG("WRITTEN %zu B opt header\n", 1 + written); - - return ++written; -} -/*---------------------------------------------------------------------------*/ -static size_t -coap_serialize_int_option(unsigned int number, unsigned int current_number, - uint8_t *buffer, uint32_t value) -{ - size_t i = 0; - - if(0xFF000000 & value) { - ++i; - } - if(0xFFFF0000 & value) { - ++i; - } - if(0xFFFFFF00 & value) { - ++i; - } - if(0xFFFFFFFF & value) { - ++i; - } - LOG_DBG("OPTION %u (delta %u, len %zu)\n", number, number - current_number, - i); - - i = coap_set_option_header(number - current_number, i, buffer); - - if(0xFF000000 & value) { - buffer[i++] = (uint8_t)(value >> 24); - } - if(0xFFFF0000 & value) { - buffer[i++] = (uint8_t)(value >> 16); - } - if(0xFFFFFF00 & value) { - buffer[i++] = (uint8_t)(value >> 8); - } - if(0xFFFFFFFF & value) { - buffer[i++] = (uint8_t)(value); - } - return i; -} -/*---------------------------------------------------------------------------*/ -static size_t -coap_serialize_array_option(unsigned int number, unsigned int current_number, - uint8_t *buffer, uint8_t *array, size_t length, - char split_char) -{ - size_t i = 0; - - LOG_DBG("ARRAY type %u, len %zu, full [", number, length); - LOG_DBG_COAP_STRING((const char *)array, length); - LOG_DBG_("]\n"); - - if(split_char != '\0') { - int j; - uint8_t *part_start = array; - uint8_t *part_end = NULL; - size_t temp_length; - - for(j = 0; j <= length + 1; ++j) { - LOG_DBG("STEP %u/%zu (%c)\n", j, length, array[j]); - if(array[j] == split_char || j == length) { - part_end = array + j; - temp_length = part_end - part_start; - - i += coap_set_option_header(number - current_number, temp_length, - &buffer[i]); - memcpy(&buffer[i], part_start, temp_length); - i += temp_length; - - LOG_DBG("OPTION type %u, delta %u, len %zu, part [", number, - number - current_number, i); - LOG_DBG_COAP_STRING((const char *)part_start, temp_length); - LOG_DBG_("]\n"); - ++j; /* skip the splitter */ - current_number = number; - part_start = array + j; - } - } /* for */ - } else { - i += coap_set_option_header(number - current_number, length, &buffer[i]); - memcpy(&buffer[i], array, length); - i += length; - - LOG_DBG("OPTION type %u, delta %u, len %zu\n", number, - number - current_number, length); - } - - return i; -} -/*---------------------------------------------------------------------------*/ -static void -coap_merge_multi_option(char **dst, size_t *dst_len, uint8_t *option, - size_t option_len, char separator) -{ - /* merge multiple options */ - if(*dst_len > 0) { - /* dst already contains an option: concatenate */ - (*dst)[*dst_len] = separator; - *dst_len += 1; - - /* memmove handles 2-byte option headers */ - memmove((*dst) + (*dst_len), option, option_len); - - *dst_len += option_len; - } else { - /* dst is empty: set to option */ - *dst = (char *)option; - *dst_len = option_len; - } -} -/*---------------------------------------------------------------------------*/ -static int -coap_get_variable(const char *buffer, size_t length, const char *name, - const char **output) -{ - const char *start = NULL; - const char *end = NULL; - const char *value_end = NULL; - size_t name_len = 0; - - /*initialize the output buffer first */ - *output = 0; - - name_len = strlen(name); - end = buffer + length; - - for(start = buffer; start + name_len < end; ++start) { - if((start == buffer || start[-1] == '&') && start[name_len] == '=' - && strncmp(name, start, name_len) == 0) { - - /* Point start to variable value */ - start += name_len + 1; - - /* Point end to the end of the value */ - value_end = (const char *)memchr(start, '&', end - start); - if(value_end == NULL) { - value_end = end; - } - *output = start; - - return value_end - start; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/*- Internal API ------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -void -coap_init_connection(void) -{ - /* initialize transaction ID */ - current_mid = rand(); -} -/*---------------------------------------------------------------------------*/ -uint16_t -coap_get_mid() -{ - return ++current_mid; -} -/*---------------------------------------------------------------------------*/ -void -coap_init_message(coap_message_t *coap_pkt, coap_message_type_t type, - uint8_t code, uint16_t mid) -{ - /* Important thing */ - memset(coap_pkt, 0, sizeof(coap_message_t)); - - coap_pkt->type = type; - coap_pkt->code = code; - coap_pkt->mid = mid; -} -/*---------------------------------------------------------------------------*/ -size_t -coap_serialize_message(coap_message_t *coap_pkt, uint8_t *buffer) -{ - uint8_t *option; - unsigned int current_number = 0; - - /* Initialize */ - coap_pkt->buffer = buffer; - coap_pkt->version = 1; - - LOG_DBG("-Serializing MID %u to %p, ", coap_pkt->mid, coap_pkt->buffer); - - /* set header fields */ - coap_pkt->buffer[0] = 0x00; - coap_pkt->buffer[0] |= COAP_HEADER_VERSION_MASK - & (coap_pkt->version) << COAP_HEADER_VERSION_POSITION; - coap_pkt->buffer[0] |= COAP_HEADER_TYPE_MASK - & (coap_pkt->type) << COAP_HEADER_TYPE_POSITION; - coap_pkt->buffer[0] |= COAP_HEADER_TOKEN_LEN_MASK - & (coap_pkt->token_len) << COAP_HEADER_TOKEN_LEN_POSITION; - coap_pkt->buffer[1] = coap_pkt->code; - coap_pkt->buffer[2] = (uint8_t)((coap_pkt->mid) >> 8); - coap_pkt->buffer[3] = (uint8_t)(coap_pkt->mid); - - /* empty message, dont need to do more stuff */ - if(!coap_pkt->code) { - LOG_DBG_("-Done serializing empty message at %p-\n", coap_pkt->buffer); - return 4; - } - - /* set Token */ - LOG_DBG_("Token (len %u)", coap_pkt->token_len); - option = coap_pkt->buffer + COAP_HEADER_LEN; - for(current_number = 0; current_number < coap_pkt->token_len; - ++current_number) { - LOG_DBG_(" %02X", coap_pkt->token[current_number]); - *option = coap_pkt->token[current_number]; - ++option; - } - LOG_DBG_("-\n"); - - /* Serialize options */ - current_number = 0; - - LOG_DBG("-Serializing options at %p-\n", option); - - /* The options must be serialized in the order of their number */ - COAP_SERIALIZE_BYTE_OPTION(COAP_OPTION_IF_MATCH, if_match, "If-Match"); - COAP_SERIALIZE_STRING_OPTION(COAP_OPTION_URI_HOST, uri_host, '\0', - "Uri-Host"); - COAP_SERIALIZE_BYTE_OPTION(COAP_OPTION_ETAG, etag, "ETag"); - COAP_SERIALIZE_INT_OPTION(COAP_OPTION_IF_NONE_MATCH, - content_format - - coap_pkt-> - content_format /* hack to get a zero field */, - "If-None-Match"); - COAP_SERIALIZE_INT_OPTION(COAP_OPTION_OBSERVE, observe, "Observe"); - COAP_SERIALIZE_INT_OPTION(COAP_OPTION_URI_PORT, uri_port, "Uri-Port"); - COAP_SERIALIZE_STRING_OPTION(COAP_OPTION_LOCATION_PATH, location_path, '/', - "Location-Path"); - COAP_SERIALIZE_STRING_OPTION(COAP_OPTION_URI_PATH, uri_path, '/', - "Uri-Path"); - LOG_DBG("Serialize content format: %d\n", coap_pkt->content_format); - COAP_SERIALIZE_INT_OPTION(COAP_OPTION_CONTENT_FORMAT, content_format, - "Content-Format"); - COAP_SERIALIZE_INT_OPTION(COAP_OPTION_MAX_AGE, max_age, "Max-Age"); - COAP_SERIALIZE_STRING_OPTION(COAP_OPTION_URI_QUERY, uri_query, '&', - "Uri-Query"); - COAP_SERIALIZE_INT_OPTION(COAP_OPTION_ACCEPT, accept, "Accept"); - COAP_SERIALIZE_STRING_OPTION(COAP_OPTION_LOCATION_QUERY, location_query, - '&', "Location-Query"); - COAP_SERIALIZE_BLOCK_OPTION(COAP_OPTION_BLOCK2, block2, "Block2"); - COAP_SERIALIZE_BLOCK_OPTION(COAP_OPTION_BLOCK1, block1, "Block1"); - COAP_SERIALIZE_INT_OPTION(COAP_OPTION_SIZE2, size2, "Size2"); - COAP_SERIALIZE_STRING_OPTION(COAP_OPTION_PROXY_URI, proxy_uri, '\0', - "Proxy-Uri"); - COAP_SERIALIZE_STRING_OPTION(COAP_OPTION_PROXY_SCHEME, proxy_scheme, '\0', - "Proxy-Scheme"); - COAP_SERIALIZE_INT_OPTION(COAP_OPTION_SIZE1, size1, "Size1"); - - LOG_DBG("-Done serializing at %p----\n", option); - - /* Pack payload */ - if((option - coap_pkt->buffer) <= COAP_MAX_HEADER_SIZE) { - /* Payload marker */ - if(coap_pkt->payload_len) { - *option = 0xFF; - ++option; - } - memmove(option, coap_pkt->payload, coap_pkt->payload_len); - } else { - /* an error occurred: caller must check for !=0 */ - coap_pkt->buffer = NULL; - coap_error_message = "Serialized header exceeds COAP_MAX_HEADER_SIZE"; - return 0; - } - - LOG_DBG("-Done %u B (header len %u, payload len %u)-\n", - (unsigned int)(coap_pkt->payload_len + option - buffer), - (unsigned int)(option - buffer), - (unsigned int)coap_pkt->payload_len); - - LOG_DBG("Dump [0x%02X %02X %02X %02X %02X %02X %02X %02X]\n", - coap_pkt->buffer[0], coap_pkt->buffer[1], coap_pkt->buffer[2], - coap_pkt->buffer[3], coap_pkt->buffer[4], coap_pkt->buffer[5], - coap_pkt->buffer[6], coap_pkt->buffer[7]); - - return (option - buffer) + coap_pkt->payload_len; /* message length */ -} -/*---------------------------------------------------------------------------*/ -coap_status_t -coap_parse_message(coap_message_t *coap_pkt, uint8_t *data, uint16_t data_len) -{ - /* initialize message */ - memset(coap_pkt, 0, sizeof(coap_message_t)); - - /* pointer to message bytes */ - coap_pkt->buffer = data; - - /* parse header fields */ - coap_pkt->version = (COAP_HEADER_VERSION_MASK & coap_pkt->buffer[0]) - >> COAP_HEADER_VERSION_POSITION; - coap_pkt->type = (COAP_HEADER_TYPE_MASK & coap_pkt->buffer[0]) - >> COAP_HEADER_TYPE_POSITION; - coap_pkt->token_len = (COAP_HEADER_TOKEN_LEN_MASK & coap_pkt->buffer[0]) - >> COAP_HEADER_TOKEN_LEN_POSITION; - coap_pkt->code = coap_pkt->buffer[1]; - coap_pkt->mid = coap_pkt->buffer[2] << 8 | coap_pkt->buffer[3]; - - if(coap_pkt->version != 1) { - coap_error_message = "CoAP version must be 1"; - return BAD_REQUEST_4_00; - } - - if(coap_pkt->token_len > COAP_TOKEN_LEN) { - coap_error_message = "Token Length must not be more than 8"; - return BAD_REQUEST_4_00; - } - - uint8_t *current_option = data + COAP_HEADER_LEN; - - memcpy(coap_pkt->token, current_option, coap_pkt->token_len); - LOG_DBG("Token (len %u) [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n", - coap_pkt->token_len, coap_pkt->token[0], coap_pkt->token[1], - coap_pkt->token[2], coap_pkt->token[3], coap_pkt->token[4], - coap_pkt->token[5], coap_pkt->token[6], coap_pkt->token[7] - ); /* FIXME always prints 8 bytes */ - - /* parse options */ - memset(coap_pkt->options, 0, sizeof(coap_pkt->options)); - current_option += coap_pkt->token_len; - - unsigned int option_number = 0; - unsigned int option_delta = 0; - size_t option_length = 0; - - while(current_option < data + data_len) { - /* payload marker 0xFF, currently only checking for 0xF* because rest is reserved */ - if((current_option[0] & 0xF0) == 0xF0) { - coap_pkt->payload = ++current_option; - coap_pkt->payload_len = data_len - (coap_pkt->payload - data); - - /* also for receiving, the Erbium upper bound is COAP_MAX_CHUNK_SIZE */ - if(coap_pkt->payload_len > COAP_MAX_CHUNK_SIZE) { - coap_pkt->payload_len = COAP_MAX_CHUNK_SIZE; - /* null-terminate payload */ - } - coap_pkt->payload[coap_pkt->payload_len] = '\0'; - - break; - } - - option_delta = current_option[0] >> 4; - option_length = current_option[0] & 0x0F; - ++current_option; - - if(option_delta == 13) { - option_delta += current_option[0]; - ++current_option; - } else if(option_delta == 14) { - option_delta += 255; - option_delta += current_option[0] << 8; - ++current_option; - option_delta += current_option[0]; - ++current_option; - } - - if(option_length == 13) { - option_length += current_option[0]; - ++current_option; - } else if(option_length == 14) { - option_length += 255; - option_length += current_option[0] << 8; - ++current_option; - option_length += current_option[0]; - ++current_option; - } - - if(current_option + option_length > data + data_len) { - /* Malformed CoAP - out of bounds */ - LOG_WARN("BAD REQUEST: options outside data message: %u > %u\n", - (unsigned)(current_option + option_length - data), data_len); - return BAD_REQUEST_4_00; - } - - option_number += option_delta; - - if(option_number > COAP_OPTION_SIZE1) { - /* Malformed CoAP - out of bounds */ - LOG_WARN("BAD REQUEST: option number too large: %u\n", option_number); - return BAD_REQUEST_4_00; - } - - LOG_DBG("OPTION %u (delta %u, len %zu): ", option_number, option_delta, - option_length); - - coap_set_option(coap_pkt, option_number); - - switch(option_number) { - case COAP_OPTION_CONTENT_FORMAT: - coap_pkt->content_format = coap_parse_int_option(current_option, - option_length); - LOG_DBG_("Content-Format [%u]\n", coap_pkt->content_format); - break; - case COAP_OPTION_MAX_AGE: - coap_pkt->max_age = coap_parse_int_option(current_option, - option_length); - LOG_DBG_("Max-Age [%"PRIu32"]\n", coap_pkt->max_age); - break; - case COAP_OPTION_ETAG: - coap_pkt->etag_len = MIN(COAP_ETAG_LEN, option_length); - memcpy(coap_pkt->etag, current_option, coap_pkt->etag_len); - LOG_DBG_("ETag %u [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n", - coap_pkt->etag_len, coap_pkt->etag[0], coap_pkt->etag[1], - coap_pkt->etag[2], coap_pkt->etag[3], coap_pkt->etag[4], - coap_pkt->etag[5], coap_pkt->etag[6], coap_pkt->etag[7] - ); /*FIXME always prints 8 bytes */ - break; - case COAP_OPTION_ACCEPT: - coap_pkt->accept = coap_parse_int_option(current_option, option_length); - LOG_DBG_("Accept [%u]\n", coap_pkt->accept); - break; - case COAP_OPTION_IF_MATCH: - /* TODO support multiple ETags */ - coap_pkt->if_match_len = MIN(COAP_ETAG_LEN, option_length); - memcpy(coap_pkt->if_match, current_option, coap_pkt->if_match_len); - LOG_DBG_("If-Match %u [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n", - coap_pkt->if_match_len, coap_pkt->if_match[0], - coap_pkt->if_match[1], coap_pkt->if_match[2], - coap_pkt->if_match[3], coap_pkt->if_match[4], - coap_pkt->if_match[5], coap_pkt->if_match[6], - coap_pkt->if_match[7] - ); /* FIXME always prints 8 bytes */ - break; - case COAP_OPTION_IF_NONE_MATCH: - coap_pkt->if_none_match = 1; - LOG_DBG_("If-None-Match\n"); - break; - - case COAP_OPTION_PROXY_URI: -#if COAP_PROXY_OPTION_PROCESSING - coap_pkt->proxy_uri = (char *)current_option; - coap_pkt->proxy_uri_len = option_length; -#endif /* COAP_PROXY_OPTION_PROCESSING */ - LOG_DBG_("Proxy-Uri NOT IMPLEMENTED ["); - LOG_DBG_COAP_STRING(coap_pkt->proxy_uri, coap_pkt->proxy_uri_len); - LOG_DBG_("]\n"); - - coap_error_message = "This is a constrained server (Contiki)"; - return PROXYING_NOT_SUPPORTED_5_05; - break; - case COAP_OPTION_PROXY_SCHEME: -#if COAP_PROXY_OPTION_PROCESSING - coap_pkt->proxy_scheme = (char *)current_option; - coap_pkt->proxy_scheme_len = option_length; -#endif - LOG_DBG_("Proxy-Scheme NOT IMPLEMENTED ["); - LOG_DBG_COAP_STRING(coap_pkt->proxy_scheme, coap_pkt->proxy_scheme_len); - LOG_DBG_("]\n"); - coap_error_message = "This is a constrained server (Contiki)"; - return PROXYING_NOT_SUPPORTED_5_05; - break; - - case COAP_OPTION_URI_HOST: - coap_pkt->uri_host = (char *)current_option; - coap_pkt->uri_host_len = option_length; - LOG_DBG_("Uri-Host ["); - LOG_DBG_COAP_STRING(coap_pkt->uri_host, coap_pkt->uri_host_len); - LOG_DBG_("]\n"); - break; - case COAP_OPTION_URI_PORT: - coap_pkt->uri_port = coap_parse_int_option(current_option, - option_length); - LOG_DBG_("Uri-Port [%u]\n", coap_pkt->uri_port); - break; - case COAP_OPTION_URI_PATH: - /* coap_merge_multi_option() operates in-place on the IPBUF, but final message field should be const string -> cast to string */ - coap_merge_multi_option((char **)&(coap_pkt->uri_path), - &(coap_pkt->uri_path_len), current_option, - option_length, '/'); - LOG_DBG_("Uri-Path ["); - LOG_DBG_COAP_STRING(coap_pkt->uri_path, coap_pkt->uri_path_len); - LOG_DBG_("]\n"); - break; - case COAP_OPTION_URI_QUERY: - /* coap_merge_multi_option() operates in-place on the IPBUF, but final message field should be const string -> cast to string */ - coap_merge_multi_option((char **)&(coap_pkt->uri_query), - &(coap_pkt->uri_query_len), current_option, - option_length, '&'); - LOG_DBG_("Uri-Query["); - LOG_DBG_COAP_STRING(coap_pkt->uri_query, coap_pkt->uri_query_len); - LOG_DBG_("]\n"); - break; - - case COAP_OPTION_LOCATION_PATH: - /* coap_merge_multi_option() operates in-place on the IPBUF, but final message field should be const string -> cast to string */ - coap_merge_multi_option((char **)&(coap_pkt->location_path), - &(coap_pkt->location_path_len), current_option, - option_length, '/'); - - LOG_DBG_("Location-Path ["); - LOG_DBG_COAP_STRING(coap_pkt->location_path, coap_pkt->location_path_len); - LOG_DBG_("]\n"); - break; - case COAP_OPTION_LOCATION_QUERY: - /* coap_merge_multi_option() operates in-place on the IPBUF, but final message field should be const string -> cast to string */ - coap_merge_multi_option((char **)&(coap_pkt->location_query), - &(coap_pkt->location_query_len), current_option, - option_length, '&'); - LOG_DBG_("Location-Query ["); - LOG_DBG_COAP_STRING(coap_pkt->location_query, coap_pkt->location_query_len); - LOG_DBG_("]\n"); - break; - - case COAP_OPTION_OBSERVE: - coap_pkt->observe = coap_parse_int_option(current_option, - option_length); - LOG_DBG_("Observe [%"PRId32"]\n", coap_pkt->observe); - break; - case COAP_OPTION_BLOCK2: - coap_pkt->block2_num = coap_parse_int_option(current_option, - option_length); - coap_pkt->block2_more = (coap_pkt->block2_num & 0x08) >> 3; - coap_pkt->block2_size = 16 << (coap_pkt->block2_num & 0x07); - coap_pkt->block2_offset = (coap_pkt->block2_num & ~0x0000000F) - << (coap_pkt->block2_num & 0x07); - coap_pkt->block2_num >>= 4; - LOG_DBG_("Block2 [%lu%s (%u B/blk)]\n", - (unsigned long)coap_pkt->block2_num, - coap_pkt->block2_more ? "+" : "", coap_pkt->block2_size); - break; - case COAP_OPTION_BLOCK1: - coap_pkt->block1_num = coap_parse_int_option(current_option, - option_length); - coap_pkt->block1_more = (coap_pkt->block1_num & 0x08) >> 3; - coap_pkt->block1_size = 16 << (coap_pkt->block1_num & 0x07); - coap_pkt->block1_offset = (coap_pkt->block1_num & ~0x0000000F) - << (coap_pkt->block1_num & 0x07); - coap_pkt->block1_num >>= 4; - LOG_DBG_("Block1 [%lu%s (%u B/blk)]\n", - (unsigned long)coap_pkt->block1_num, - coap_pkt->block1_more ? "+" : "", coap_pkt->block1_size); - break; - case COAP_OPTION_SIZE2: - coap_pkt->size2 = coap_parse_int_option(current_option, option_length); - LOG_DBG_("Size2 [%"PRIu32"]\n", coap_pkt->size2); - break; - case COAP_OPTION_SIZE1: - coap_pkt->size1 = coap_parse_int_option(current_option, option_length); - LOG_DBG_("Size1 [%"PRIu32"]\n", coap_pkt->size1); - break; - default: - LOG_DBG_("unknown (%u)\n", option_number); - /* check if critical (odd) */ - if(option_number & 1) { - coap_error_message = "Unsupported critical option"; - return BAD_OPTION_4_02; - } - } - - current_option += option_length; - } /* for */ - LOG_DBG("-Done parsing-------\n"); - - return NO_ERROR; -} -/*---------------------------------------------------------------------------*/ -/*- CoAP Engine API ---------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -int -coap_get_query_variable(coap_message_t *coap_pkt, - const char *name, const char **output) -{ - if(coap_is_option(coap_pkt, COAP_OPTION_URI_QUERY)) { - return coap_get_variable(coap_pkt->uri_query, coap_pkt->uri_query_len, - name, output); - } - return 0; -} -int -coap_get_post_variable(coap_message_t *coap_pkt, - const char *name, const char **output) -{ - if(coap_pkt->payload_len) { - return coap_get_variable((const char *)coap_pkt->payload, - coap_pkt->payload_len, name, output); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -coap_set_status_code(coap_message_t *message, unsigned int code) -{ - if(code <= 0xFF) { - message->code = (uint8_t)code; - return 1; - } else { - return 0; - } -} -/*---------------------------------------------------------------------------*/ -int -coap_set_token(coap_message_t *coap_pkt, const uint8_t *token, size_t token_len) -{ - coap_pkt->token_len = MIN(COAP_TOKEN_LEN, token_len); - memcpy(coap_pkt->token, token, coap_pkt->token_len); - - return coap_pkt->token_len; -} -/*---------------------------------------------------------------------------*/ -/*- CoAP Implementation API -------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -int -coap_get_header_content_format(coap_message_t *coap_pkt, unsigned int *format) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_CONTENT_FORMAT)) { - return 0; - } - *format = coap_pkt->content_format; - return 1; -} -int -coap_set_header_content_format(coap_message_t *coap_pkt, unsigned int format) -{ - coap_pkt->content_format = format; - coap_set_option(coap_pkt, COAP_OPTION_CONTENT_FORMAT); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_accept(coap_message_t *coap_pkt, unsigned int *accept) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_ACCEPT)) { - return 0; - } - *accept = coap_pkt->accept; - return 1; -} -int -coap_set_header_accept(coap_message_t *coap_pkt, unsigned int accept) -{ - coap_pkt->accept = accept; - coap_set_option(coap_pkt, COAP_OPTION_ACCEPT); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_max_age(coap_message_t *coap_pkt, uint32_t *age) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_MAX_AGE)) { - *age = COAP_DEFAULT_MAX_AGE; - } else { - *age = coap_pkt->max_age; - } return 1; -} -int -coap_set_header_max_age(coap_message_t *coap_pkt, uint32_t age) -{ - coap_pkt->max_age = age; - coap_set_option(coap_pkt, COAP_OPTION_MAX_AGE); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_etag(coap_message_t *coap_pkt, const uint8_t **etag) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_ETAG)) { - return 0; - } - *etag = coap_pkt->etag; - return coap_pkt->etag_len; -} -int -coap_set_header_etag(coap_message_t *coap_pkt, const uint8_t *etag, size_t etag_len) -{ - coap_pkt->etag_len = MIN(COAP_ETAG_LEN, etag_len); - memcpy(coap_pkt->etag, etag, coap_pkt->etag_len); - - coap_set_option(coap_pkt, COAP_OPTION_ETAG); - return coap_pkt->etag_len; -} -/*---------------------------------------------------------------------------*/ -/*FIXME support multiple ETags */ -int -coap_get_header_if_match(coap_message_t *coap_pkt, const uint8_t **etag) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_IF_MATCH)) { - return 0; - } - *etag = coap_pkt->if_match; - return coap_pkt->if_match_len; -} -int -coap_set_header_if_match(coap_message_t *coap_pkt, const uint8_t *etag, size_t etag_len) -{ - coap_pkt->if_match_len = MIN(COAP_ETAG_LEN, etag_len); - memcpy(coap_pkt->if_match, etag, coap_pkt->if_match_len); - - coap_set_option(coap_pkt, COAP_OPTION_IF_MATCH); - return coap_pkt->if_match_len; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_if_none_match(coap_message_t *message) -{ - return coap_is_option(message, COAP_OPTION_IF_NONE_MATCH) ? 1 : 0; -} -int -coap_set_header_if_none_match(coap_message_t *message) -{ - coap_set_option(message, COAP_OPTION_IF_NONE_MATCH); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_proxy_uri(coap_message_t *coap_pkt, const char **uri) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_PROXY_URI)) { - return 0; - } - *uri = coap_pkt->proxy_uri; - return coap_pkt->proxy_uri_len; -} -int -coap_set_header_proxy_uri(coap_message_t *coap_pkt, const char *uri) -{ - /* TODO Provide alternative that sets Proxy-Scheme and Uri-* options and provide coap-conf define */ - - coap_pkt->proxy_uri = uri; - coap_pkt->proxy_uri_len = strlen(uri); - - coap_set_option(coap_pkt, COAP_OPTION_PROXY_URI); - return coap_pkt->proxy_uri_len; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_uri_host(coap_message_t *coap_pkt, const char **host) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_URI_HOST)) { - return 0; - } - *host = coap_pkt->uri_host; - return coap_pkt->uri_host_len; -} -int -coap_set_header_uri_host(coap_message_t *coap_pkt, const char *host) -{ - coap_pkt->uri_host = host; - coap_pkt->uri_host_len = strlen(host); - - coap_set_option(coap_pkt, COAP_OPTION_URI_HOST); - return coap_pkt->uri_host_len; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_uri_path(coap_message_t *coap_pkt, const char **path) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_URI_PATH)) { - return 0; - } - *path = coap_pkt->uri_path; - return coap_pkt->uri_path_len; -} -int -coap_set_header_uri_path(coap_message_t *coap_pkt, const char *path) -{ - while(path[0] == '/') { - ++path; - } - - coap_pkt->uri_path = path; - coap_pkt->uri_path_len = strlen(path); - - coap_set_option(coap_pkt, COAP_OPTION_URI_PATH); - return coap_pkt->uri_path_len; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_uri_query(coap_message_t *coap_pkt, const char **query) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_URI_QUERY)) { - return 0; - } - *query = coap_pkt->uri_query; - return coap_pkt->uri_query_len; -} -int -coap_set_header_uri_query(coap_message_t *coap_pkt, const char *query) -{ - while(query[0] == '?') { - ++query; - } - - coap_pkt->uri_query = query; - coap_pkt->uri_query_len = strlen(query); - - coap_set_option(coap_pkt, COAP_OPTION_URI_QUERY); - return coap_pkt->uri_query_len; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_location_path(coap_message_t *coap_pkt, const char **path) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_LOCATION_PATH)) { - return 0; - } - *path = coap_pkt->location_path; - return coap_pkt->location_path_len; -} -int -coap_set_header_location_path(coap_message_t *coap_pkt, const char *path) -{ - char *query; - - while(path[0] == '/') { - ++path; - } - - if((query = strchr(path, '?'))) { - coap_set_header_location_query(coap_pkt, query + 1); - coap_pkt->location_path_len = query - path; - } else { - coap_pkt->location_path_len = strlen(path); - } coap_pkt->location_path = path; - - if(coap_pkt->location_path_len > 0) { - coap_set_option(coap_pkt, COAP_OPTION_LOCATION_PATH); - } - return coap_pkt->location_path_len; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_location_query(coap_message_t *coap_pkt, const char **query) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_LOCATION_QUERY)) { - return 0; - } - *query = coap_pkt->location_query; - return coap_pkt->location_query_len; -} -int -coap_set_header_location_query(coap_message_t *coap_pkt, const char *query) -{ - while(query[0] == '?') { - ++query; - } - - coap_pkt->location_query = query; - coap_pkt->location_query_len = strlen(query); - - coap_set_option(coap_pkt, COAP_OPTION_LOCATION_QUERY); - return coap_pkt->location_query_len; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_observe(coap_message_t *coap_pkt, uint32_t *observe) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_OBSERVE)) { - return 0; - } - *observe = coap_pkt->observe; - return 1; -} -int -coap_set_header_observe(coap_message_t *coap_pkt, uint32_t observe) -{ - coap_pkt->observe = observe; - coap_set_option(coap_pkt, COAP_OPTION_OBSERVE); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_block2(coap_message_t *coap_pkt, uint32_t *num, uint8_t *more, - uint16_t *size, uint32_t *offset) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_BLOCK2)) { - return 0; - } - /* pointers may be NULL to get only specific block parameters */ - if(num != NULL) { - *num = coap_pkt->block2_num; - } - if(more != NULL) { - *more = coap_pkt->block2_more; - } - if(size != NULL) { - *size = coap_pkt->block2_size; - } - if(offset != NULL) { - *offset = coap_pkt->block2_offset; - } - return 1; -} -int -coap_set_header_block2(coap_message_t *coap_pkt, uint32_t num, uint8_t more, - uint16_t size) -{ - if(size < 16) { - return 0; - } - if(size > 2048) { - return 0; - } - if(num > 0x0FFFFF) { - return 0; - } - coap_pkt->block2_num = num; - coap_pkt->block2_more = more ? 1 : 0; - coap_pkt->block2_size = size; - - coap_set_option(coap_pkt, COAP_OPTION_BLOCK2); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_block1(coap_message_t *coap_pkt, uint32_t *num, uint8_t *more, - uint16_t *size, uint32_t *offset) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_BLOCK1)) { - return 0; - } - /* pointers may be NULL to get only specific block parameters */ - if(num != NULL) { - *num = coap_pkt->block1_num; - } - if(more != NULL) { - *more = coap_pkt->block1_more; - } - if(size != NULL) { - *size = coap_pkt->block1_size; - } - if(offset != NULL) { - *offset = coap_pkt->block1_offset; - } - return 1; -} -int -coap_set_header_block1(coap_message_t *coap_pkt, uint32_t num, uint8_t more, - uint16_t size) -{ - if(size < 16) { - return 0; - } - if(size > 2048) { - return 0; - } - if(num > 0x0FFFFF) { - return 0; - } - coap_pkt->block1_num = num; - coap_pkt->block1_more = more; - coap_pkt->block1_size = size; - - coap_set_option(coap_pkt, COAP_OPTION_BLOCK1); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_size2(coap_message_t *coap_pkt, uint32_t *size) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_SIZE2)) { - return 0; - } - *size = coap_pkt->size2; - return 1; -} -int -coap_set_header_size2(coap_message_t *coap_pkt, uint32_t size) -{ - coap_pkt->size2 = size; - coap_set_option(coap_pkt, COAP_OPTION_SIZE2); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_header_size1(coap_message_t *coap_pkt, uint32_t *size) -{ - if(!coap_is_option(coap_pkt, COAP_OPTION_SIZE1)) { - return 0; - } - *size = coap_pkt->size1; - return 1; -} -int -coap_set_header_size1(coap_message_t *coap_pkt, uint32_t size) -{ - coap_pkt->size1 = size; - coap_set_option(coap_pkt, COAP_OPTION_SIZE1); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -coap_get_payload(coap_message_t *coap_pkt, const uint8_t **payload) -{ - if(payload != NULL) { - *payload = coap_pkt->payload; - } - return coap_pkt->payload != NULL ? coap_pkt->payload_len : 0; -} -int -coap_set_payload(coap_message_t *coap_pkt, const void *payload, size_t length) -{ - coap_pkt->payload = (uint8_t *)payload; - coap_pkt->payload_len = MIN(COAP_MAX_CHUNK_SIZE, length); - - return coap_pkt->payload_len; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/coap/coap.h b/os/net/app-layer/coap/coap.h deleted file mode 100644 index 8d9aed61c..000000000 --- a/os/net/app-layer/coap/coap.h +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * An implementation of the Constrained Application Protocol (RFC 7252). - * \author - * Matthias Kovatsch - */ - -/** - * \addtogroup apps - * @{ - * - * \defgroup coap An implementation of CoAP - * @{ - * - * This is an implementation of the Constrained Application Protocol - */ - -#ifndef COAP_H_ -#define COAP_H_ - -#include /* for size_t */ -#include "coap-constants.h" -#include "coap-conf.h" -#include "coap-transport.h" - -/** - * \brief The max size of the CoAP messages - */ -#define COAP_MAX_PACKET_SIZE (COAP_MAX_HEADER_SIZE + COAP_MAX_CHUNK_SIZE) - -/* COAP_MAX_CHUNK_SIZE can be different from 2^x so we need to get next lower 2^x for COAP_MAX_BLOCK_SIZE */ -#ifndef COAP_MAX_BLOCK_SIZE -#define COAP_MAX_BLOCK_SIZE (COAP_MAX_CHUNK_SIZE < 32 ? 16 : \ - (COAP_MAX_CHUNK_SIZE < 64 ? 32 : \ - (COAP_MAX_CHUNK_SIZE < 128 ? 64 : \ - (COAP_MAX_CHUNK_SIZE < 256 ? 128 : \ - (COAP_MAX_CHUNK_SIZE < 512 ? 256 : \ - (COAP_MAX_CHUNK_SIZE < 1024 ? 512 : \ - (COAP_MAX_CHUNK_SIZE < 2048 ? 1024 : 2048))))))) -#endif /* COAP_MAX_BLOCK_SIZE */ - -/* bitmap for set options */ -#define COAP_OPTION_MAP_SIZE (sizeof(uint8_t) * 8) - -/* parsed message struct */ -typedef struct { - uint8_t *buffer; /* pointer to CoAP header / incoming message buffer / memory to serialize message */ - - uint8_t version; - coap_message_type_t type; - uint8_t code; - uint16_t mid; - - uint8_t token_len; - uint8_t token[COAP_TOKEN_LEN]; - - uint8_t options[COAP_OPTION_SIZE1 / COAP_OPTION_MAP_SIZE + 1]; /* bitmap to check if option is set */ - - uint16_t content_format; /* parse options once and store; allows setting options in random order */ - uint32_t max_age; - uint8_t etag_len; - uint8_t etag[COAP_ETAG_LEN]; - size_t proxy_uri_len; - const char *proxy_uri; - size_t proxy_scheme_len; - const char *proxy_scheme; - size_t uri_host_len; - const char *uri_host; - size_t location_path_len; - const char *location_path; - uint16_t uri_port; - size_t location_query_len; - const char *location_query; - size_t uri_path_len; - const char *uri_path; - int32_t observe; - uint16_t accept; - uint8_t if_match_len; - uint8_t if_match[COAP_ETAG_LEN]; - uint32_t block2_num; - uint8_t block2_more; - uint16_t block2_size; - uint32_t block2_offset; - uint32_t block1_num; - uint8_t block1_more; - uint16_t block1_size; - uint32_t block1_offset; - uint32_t size2; - uint32_t size1; - size_t uri_query_len; - const char *uri_query; - uint8_t if_none_match; - - const coap_endpoint_t *src_ep; - - uint16_t payload_len; - uint8_t *payload; -} coap_message_t; - -static inline int -coap_set_option(coap_message_t *message, unsigned int opt) -{ - if(opt > COAP_OPTION_SIZE1) { - return 0; - } - message->options[opt / COAP_OPTION_MAP_SIZE] |= 1 << (opt % COAP_OPTION_MAP_SIZE); - return 1; -} - -static inline int -coap_is_option(const coap_message_t *message, unsigned int opt) -{ - return (opt <= COAP_OPTION_SIZE1) && - (message->options[opt / COAP_OPTION_MAP_SIZE] & (1 << (opt % COAP_OPTION_MAP_SIZE))) != 0; -} - -/* option format serialization */ -#define COAP_SERIALIZE_INT_OPTION(number, field, text) \ - if(coap_is_option(coap_pkt, number)) { \ - LOG_DBG(text " [%u]\n", (unsigned int)coap_pkt->field); \ - option += coap_serialize_int_option(number, current_number, option, coap_pkt->field); \ - current_number = number; \ - } -#define COAP_SERIALIZE_BYTE_OPTION(number, field, text) \ - if(coap_is_option(coap_pkt, number)) { \ - LOG_DBG(text " %u [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n", (unsigned int)coap_pkt->field##_len, \ - coap_pkt->field[0], \ - coap_pkt->field[1], \ - coap_pkt->field[2], \ - coap_pkt->field[3], \ - coap_pkt->field[4], \ - coap_pkt->field[5], \ - coap_pkt->field[6], \ - coap_pkt->field[7] \ - ); /* FIXME always prints 8 bytes */ \ - option += coap_serialize_array_option(number, current_number, option, coap_pkt->field, coap_pkt->field##_len, '\0'); \ - current_number = number; \ - } -#define COAP_SERIALIZE_STRING_OPTION(number, field, splitter, text) \ - if(coap_is_option(coap_pkt, number)) { \ - LOG_DBG(text " ["); \ - LOG_DBG_COAP_STRING(coap_pkt->field, coap_pkt->field##_len); \ - LOG_DBG_("]\n"); \ - option += coap_serialize_array_option(number, current_number, option, (uint8_t *)coap_pkt->field, coap_pkt->field##_len, splitter); \ - current_number = number; \ - } -#define COAP_SERIALIZE_BLOCK_OPTION(number, field, text) \ - if(coap_is_option(coap_pkt, number)) { \ - LOG_DBG(text " [%lu%s (%u B/blk)]\n", (unsigned long)coap_pkt->field##_num, coap_pkt->field##_more ? "+" : "", coap_pkt->field##_size); \ - uint32_t block = coap_pkt->field##_num << 4; \ - if(coap_pkt->field##_more) { block |= 0x8; } \ - block |= 0xF & coap_log_2(coap_pkt->field##_size / 16); \ - LOG_DBG(text " encoded: 0x%lX\n", (unsigned long)block); \ - option += coap_serialize_int_option(number, current_number, option, block); \ - current_number = number; \ - } - -/* to store error code and human-readable payload */ -extern coap_status_t coap_status_code; -extern const char *coap_error_message; - -void coap_init_connection(void); -uint16_t coap_get_mid(void); - -void coap_init_message(coap_message_t *message, coap_message_type_t type, - uint8_t code, uint16_t mid); -size_t coap_serialize_message(coap_message_t *message, uint8_t *buffer); -coap_status_t coap_parse_message(coap_message_t *request, uint8_t *data, - uint16_t data_len); - -int coap_get_query_variable(coap_message_t *message, const char *name, - const char **output); -int coap_get_post_variable(coap_message_t *message, const char *name, - const char **output); - -static inline coap_resource_flags_t -coap_get_method_type(coap_message_t *message) -{ - return (coap_resource_flags_t)(1 << (message->code - 1)); -} - -static inline const coap_endpoint_t * -coap_get_src_endpoint(coap_message_t *request) -{ - return request->src_ep; -} - -static inline void -coap_set_src_endpoint(coap_message_t *request, const coap_endpoint_t *ep) -{ - request->src_ep = ep; -} -/*---------------------------------------------------------------------------*/ - -int coap_set_status_code(coap_message_t *message, unsigned int code); - -int coap_set_token(coap_message_t *message, const uint8_t *token, - size_t token_len); - -int coap_get_header_content_format(coap_message_t *message, unsigned int *format); -int coap_set_header_content_format(coap_message_t *message, unsigned int format); - -int coap_get_header_accept(coap_message_t *message, unsigned int *accept); -int coap_set_header_accept(coap_message_t *message, unsigned int accept); - -int coap_get_header_max_age(coap_message_t *message, uint32_t *age); -int coap_set_header_max_age(coap_message_t *message, uint32_t age); - -int coap_get_header_etag(coap_message_t *message, const uint8_t **etag); -int coap_set_header_etag(coap_message_t *message, const uint8_t *etag, - size_t etag_len); - -int coap_get_header_if_match(coap_message_t *message, const uint8_t **etag); -int coap_set_header_if_match(coap_message_t *message, const uint8_t *etag, - size_t etag_len); - -int coap_get_header_if_none_match(coap_message_t *message); -int coap_set_header_if_none_match(coap_message_t *message); - -/* in-place string might not be 0-terminated. */ -int coap_get_header_proxy_uri(coap_message_t *message, const char **uri); -int coap_set_header_proxy_uri(coap_message_t *message, const char *uri); - -/* in-place string might not be 0-terminated. */ -int coap_get_header_proxy_scheme(coap_message_t *message, const char **scheme); -int coap_set_header_proxy_scheme(coap_message_t *message, const char *scheme); - -/* in-place string might not be 0-terminated. */ -int coap_get_header_uri_host(coap_message_t *message, const char **host); -int coap_set_header_uri_host(coap_message_t *message, const char *host); - -/* in-place string might not be 0-terminated. */ -int coap_get_header_uri_path(coap_message_t *message, const char **path); -int coap_set_header_uri_path(coap_message_t *message, const char *path); - -/* in-place string might not be 0-terminated. */ -int coap_get_header_uri_query(coap_message_t *message, const char **query); -int coap_set_header_uri_query(coap_message_t *message, const char *query); - -/* in-place string might not be 0-terminated. */ -int coap_get_header_location_path(coap_message_t *message, const char **path); -/* also splits optional query into Location-Query option. */ -int coap_set_header_location_path(coap_message_t *message, const char *path); - -/* in-place string might not be 0-terminated. */ -int coap_get_header_location_query(coap_message_t *message, const char **query); -int coap_set_header_location_query(coap_message_t *message, const char *query); - -int coap_get_header_observe(coap_message_t *message, uint32_t *observe); -int coap_set_header_observe(coap_message_t *message, uint32_t observe); - -int coap_get_header_block2(coap_message_t *message, uint32_t *num, uint8_t *more, - uint16_t *size, uint32_t *offset); -int coap_set_header_block2(coap_message_t *message, uint32_t num, uint8_t more, - uint16_t size); - -int coap_get_header_block1(coap_message_t *message, uint32_t *num, uint8_t *more, - uint16_t *size, uint32_t *offset); -int coap_set_header_block1(coap_message_t *message, uint32_t num, uint8_t more, - uint16_t size); - -int coap_get_header_size2(coap_message_t *message, uint32_t *size); -int coap_set_header_size2(coap_message_t *message, uint32_t size); - -int coap_get_header_size1(coap_message_t *message, uint32_t *size); -int coap_set_header_size1(coap_message_t *message, uint32_t size); - -int coap_get_payload(coap_message_t *message, const uint8_t **payload); -int coap_set_payload(coap_message_t *message, const void *payload, size_t length); - -#endif /* COAP_H_ */ -/** @} */ -/** @} */ diff --git a/os/net/app-layer/coap/module-macros.h b/os/net/app-layer/coap/module-macros.h deleted file mode 100644 index 053040e50..000000000 --- a/os/net/app-layer/coap/module-macros.h +++ /dev/null @@ -1 +0,0 @@ -#define BUILD_WITH_COAP 1 diff --git a/os/net/app-layer/coap/tinydtls-support/Makefile.tinydtls-support b/os/net/app-layer/coap/tinydtls-support/Makefile.tinydtls-support deleted file mode 100644 index ac8a5aff4..000000000 --- a/os/net/app-layer/coap/tinydtls-support/Makefile.tinydtls-support +++ /dev/null @@ -1 +0,0 @@ -${info Building with tinyDTLS - see $(CONTIKI)/$(TINYDTLS_PATH)/LICENSE} diff --git a/os/net/app-layer/coap/tinydtls-support/dtls-support-conf.h b/os/net/app-layer/coap/tinydtls-support/dtls-support-conf.h deleted file mode 100644 index 9265583e5..000000000 --- a/os/net/app-layer/coap/tinydtls-support/dtls-support-conf.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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 - * DTLS support for CoAP - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef DTLS_SUPPORT_CONF_H_ -#define DTLS_SUPPORT_CONF_H_ - -/* Use same log level as CoAP as default */ -#define LOG_LEVEL_DTLS LOG_LEVEL_COAP - -#define DTLS_LOG_CONF_PATH "coap-log.h" - -#include "coap-endpoint.h" - -typedef coap_endpoint_t session_t; - -#include "sys/ctimer.h" -#include - -typedef struct { - struct ctimer retransmit_timer; -} dtls_support_context_state_t; - -#define DTLS_SUPPORT_CONF_CONTEXT_STATE dtls_support_context_state_t - -#define DTLS_TICKS_PER_SECOND CLOCK_SECOND - -typedef clock_time_t dtls_tick_t; - -#define HAVE_ASSERT_H 1 - -#endif /* DTLS_SUPPORT_CONF_H_ */ diff --git a/os/net/app-layer/coap/tinydtls-support/dtls-support.c b/os/net/app-layer/coap/tinydtls-support/dtls-support.c deleted file mode 100644 index 4675c76d0..000000000 --- a/os/net/app-layer/coap/tinydtls-support/dtls-support.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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 - * DTLS support for CoAP - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "dtls-support.h" -#include "lib/random.h" -#include -#include - -/* Log configuration */ -#define LOG_MODULE "dtls" -#define LOG_LEVEL LOG_LEVEL_DTLS -#include "dtls-log.h" -#include "coap-log.h" - -static dtls_context_t the_dtls_context; -static dtls_cipher_context_t cipher_context; -static uint8_t lock_context = 0; -/*---------------------------------------------------------------------------*/ -dtls_context_t * -dtls_context_acquire(void) -{ - if(lock_context) { - return NULL; - } - lock_context = 1; - LOG_DBG("Allocated context\n"); - return &the_dtls_context; -} -/*---------------------------------------------------------------------------*/ -void -dtls_context_release(dtls_context_t *context) -{ - if(context == &the_dtls_context) { - lock_context = 0; - } -} -/*---------------------------------------------------------------------------*/ -dtls_cipher_context_t * -dtls_cipher_context_acquire(void) -{ - return &cipher_context; -} -/*---------------------------------------------------------------------------*/ -void -dtls_cipher_context_release(dtls_cipher_context_t *c) -{ -} -/*---------------------------------------------------------------------------*/ -void -dtls_ticks(dtls_tick_t *t) -{ - *t = clock_time(); -} -/*---------------------------------------------------------------------------*/ -int -dtls_fill_random(uint8_t *buf, size_t len) -{ - int i; - if(buf) { - for(i = 0; i < len; i++) { - buf[i] = random_rand() & 0xff; - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------*/ -/* message retransmission */ -/*---------------------------------------------------------------------------*/ -static void -dtls_retransmit_callback(void *ptr) -{ - dtls_context_t *ctx; - clock_time_t now; - clock_time_t next; - - ctx = ptr; - now = clock_time(); - /* Just one retransmission per timer scheduling */ - dtls_check_retransmit(ctx, &next, 0); - - /* need to set timer to some value even if no nextpdu is available */ - if(next != 0) { - ctimer_set(&ctx->support.retransmit_timer, - next <= now ? 1 : next - now, - dtls_retransmit_callback, ctx); - } -} -/*---------------------------------------------------------------------------*/ -void -dtls_set_retransmit_timer(dtls_context_t *ctx, unsigned int timeout) -{ - ctimer_set(&ctx->support.retransmit_timer, timeout, - dtls_retransmit_callback, ctx); -} -/*---------------------------------------------------------------------------*/ -void -dtls_session_init(session_t *sess) -{ - memset(sess, 0, sizeof(session_t)); -} -/*---------------------------------------------------------------------------*/ -int -dtls_session_equals(const session_t *a, const session_t *b) -{ - coap_endpoint_t *e1 = (coap_endpoint_t *)a; - coap_endpoint_t *e2 = (coap_endpoint_t *)b; - - if(LOG_DBG_ENABLED) { - LOG_DBG(" **** EP:"); - LOG_DBG_COAP_EP(e1); - LOG_DBG_(" =?= "); - LOG_DBG_COAP_EP(e2); - LOG_DBG_(" => %d\n", coap_endpoint_cmp(e1, e2)); - } - - return coap_endpoint_cmp(e1, e2); -} -/*---------------------------------------------------------------------------*/ -void * -dtls_session_get_address(const session_t *a) -{ - /* improve this to only contain the addressing info */ - return (void *)a; -} -/*---------------------------------------------------------------------------*/ -int dtls_session_get_address_size(const session_t *a) -{ - /* improve this to only contain the addressing info */ - return sizeof(session_t); -} -/*---------------------------------------------------------------------------*/ -void -dtls_session_print(const session_t *a) -{ - coap_endpoint_print((const coap_endpoint_t *)a); -} -/*---------------------------------------------------------------------------*/ -void -dtls_session_log(const session_t *a) -{ - coap_endpoint_log((const coap_endpoint_t *)a); -} -/*---------------------------------------------------------------------------*/ -void -dtls_support_init(void) -{ - LOG_INFO("init\n"); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/app-layer/http-socket/http-socket.c b/os/net/app-layer/http-socket/http-socket.c deleted file mode 100644 index dfcf9e2a4..000000000 --- a/os/net/app-layer/http-socket/http-socket.c +++ /dev/null @@ -1,697 +0,0 @@ -/* - * Copyright (c) 2013, Thingsquare, http://www.thingsquare.com/. - * 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 "contiki-net.h" -#include "ipv6/ip64-addr.h" -#include "http-socket.h" - -#include -#include - -#define MAX_PATHLEN 80 -#define MAX_HOSTLEN 40 -PROCESS(http_socket_process, "HTTP socket process"); -LIST(socketlist); - -static void removesocket(struct http_socket *s); -/*---------------------------------------------------------------------------*/ -static void -call_callback(struct http_socket *s, http_socket_event_t e, - const uint8_t *data, uint16_t datalen) -{ - if(s->callback != NULL) { - s->callback(s, s->callbackptr, e, - data, datalen); - } -} -/*---------------------------------------------------------------------------*/ -static void -parse_header_init(struct http_socket *s) -{ - PT_INIT(&s->headerpt); -} -/*---------------------------------------------------------------------------*/ -static int -parse_header_byte(struct http_socket *s, char c) -{ - PT_BEGIN(&s->headerpt); - - memset(&s->header, -1, sizeof(s->header)); - - /* Skip the HTTP response */ - while(c != ' ') { - PT_YIELD(&s->headerpt); - } - - /* Skip the space */ - PT_YIELD(&s->headerpt); - /* Read three characters of HTTP status and convert to BCD */ - s->header.status_code = 0; - for(s->header_chars = 0; s->header_chars < 3; s->header_chars++) { - s->header.status_code = s->header.status_code << 4 | (c - '0'); - PT_YIELD(&s->headerpt); - } - - if(s->header.status_code == 0x200 || s->header.status_code == 0x206) { - /* Read headers until data */ - - while(1) { - /* Skip characters until end of line */ - do { - while(c != '\r') { - s->header_chars++; - PT_YIELD(&s->headerpt); - } - s->header_chars++; - PT_YIELD(&s->headerpt); - } while(c != '\n'); - s->header_chars--; - PT_YIELD(&s->headerpt); - - if(s->header_chars == 0) { - /* This was an empty line, i.e. the end of headers */ - break; - } - - /* Start of line */ - s->header_chars = 0; - - /* Read header field */ - while(c != ' ' && c != '\t' && c != ':' && c != '\r' && - s->header_chars < sizeof(s->header_field) - 1) { - s->header_field[s->header_chars++] = c; - PT_YIELD(&s->headerpt); - } - s->header_field[s->header_chars] = '\0'; - /* Skip linear white spaces */ - while(c == ' ' || c == '\t') { - s->header_chars++; - PT_YIELD(&s->headerpt); - } - if(c == ':') { - /* Skip the colon */ - s->header_chars++; - PT_YIELD(&s->headerpt); - /* Skip linear white spaces */ - while(c == ' ' || c == '\t') { - s->header_chars++; - PT_YIELD(&s->headerpt); - } - if(!strcmp(s->header_field, "Content-Length")) { - s->header.content_length = 0; - while(isdigit((int)c)) { - s->header.content_length = s->header.content_length * 10 + c - '0'; - s->header_chars++; - PT_YIELD(&s->headerpt); - } - } else if(!strcmp(s->header_field, "Content-Range")) { - /* Skip the bytes-unit token */ - while(c != ' ' && c != '\t') { - s->header_chars++; - PT_YIELD(&s->headerpt); - } - /* Skip linear white spaces */ - while(c == ' ' || c == '\t') { - s->header_chars++; - PT_YIELD(&s->headerpt); - } - s->header.content_range.first_byte_pos = 0; - while(isdigit((int)c)) { - s->header.content_range.first_byte_pos = - s->header.content_range.first_byte_pos * 10 + c - '0'; - s->header_chars++; - PT_YIELD(&s->headerpt); - } - /* Skip linear white spaces */ - while(c == ' ' || c == '\t') { - s->header_chars++; - PT_YIELD(&s->headerpt); - } - if(c == '-') { - /* Skip the dash */ - s->header_chars++; - PT_YIELD(&s->headerpt); - /* Skip linear white spaces */ - while(c == ' ' || c == '\t') { - s->header_chars++; - PT_YIELD(&s->headerpt); - } - s->header.content_range.last_byte_pos = 0; - while(isdigit((int)c)) { - s->header.content_range.last_byte_pos = - s->header.content_range.last_byte_pos * 10 + c - '0'; - s->header_chars++; - PT_YIELD(&s->headerpt); - } - /* Skip linear white spaces */ - while(c == ' ' || c == '\t') { - s->header_chars++; - PT_YIELD(&s->headerpt); - } - if(c == '/') { - /* Skip the slash */ - s->header_chars++; - PT_YIELD(&s->headerpt); - /* Skip linear white spaces */ - while(c == ' ' || c == '\t') { - s->header_chars++; - PT_YIELD(&s->headerpt); - } - if(c != '*') { - s->header.content_range.instance_length = 0; - while(isdigit((int)c)) { - s->header.content_range.instance_length = - s->header.content_range.instance_length * 10 + c - '0'; - s->header_chars++; - PT_YIELD(&s->headerpt); - } - } - } - } - } - } - } - - /* All headers read, now read data */ - call_callback(s, HTTP_SOCKET_HEADER, (void *)&s->header, sizeof(s->header)); - - /* Should exit the pt here to indicate that all headers have been - read */ - PT_EXIT(&s->headerpt); - } else { - if(s->header.status_code == 0x404) { - printf("File not found\n"); - } else if(s->header.status_code == 0x301 || s->header.status_code == 0x302) { - printf("File moved (not handled)\n"); - } - - call_callback(s, HTTP_SOCKET_ERR, (void *)&s->header, sizeof(s->header)); - tcp_socket_close(&s->s); - removesocket(s); - PT_EXIT(&s->headerpt); - } - - - PT_END(&s->headerpt); -} -/*---------------------------------------------------------------------------*/ -static int -input_pt(struct http_socket *s, - const uint8_t *inputptr, int inputdatalen) -{ - int i; - PT_BEGIN(&s->pt); - - /* Parse the header */ - s->header_received = 0; - do { - for(i = 0; i < inputdatalen; i++) { - if(!PT_SCHEDULE(parse_header_byte(s, inputptr[i]))) { - s->header_received = 1; - break; - } - } - inputdatalen -= i; - inputptr += i; - - if(s->header_received == 0) { - /* If we have not yet received the full header, we wait for the - next packet to arrive. */ - PT_YIELD(&s->pt); - } - } while(s->header_received == 0); - - s->bodylen = 0; - do { - /* Receive the data */ - call_callback(s, HTTP_SOCKET_DATA, inputptr, inputdatalen); - - /* Close the connection if the expected content length has been received */ - if(s->header.content_length >= 0 && s->bodylen < s->header.content_length) { - s->bodylen += inputdatalen; - if(s->bodylen >= s->header.content_length) { - tcp_socket_close(&s->s); - } - } - - PT_YIELD(&s->pt); - } while(inputdatalen > 0); - - PT_END(&s->pt); -} -/*---------------------------------------------------------------------------*/ -static void -start_timeout_timer(struct http_socket *s) -{ - PROCESS_CONTEXT_BEGIN(&http_socket_process); - etimer_set(&s->timeout_timer, HTTP_SOCKET_TIMEOUT); - PROCESS_CONTEXT_END(&http_socket_process); - s->timeout_timer_started = 1; -} -/*---------------------------------------------------------------------------*/ -static int -input(struct tcp_socket *tcps, void *ptr, - const uint8_t *inputptr, int inputdatalen) -{ - struct http_socket *s = ptr; - - input_pt(s, inputptr, inputdatalen); - start_timeout_timer(s); - - return 0; /* all data consumed */ -} -/*---------------------------------------------------------------------------*/ -static int -parse_url(const char *url, char *host, uint16_t *portptr, char *path) -{ - const char *urlptr; - int i; - const char *file; - uint16_t port; - - if(url == NULL) { - printf("null url\n"); - return 0; - } - - /* Don't even try to go further if the URL is empty. */ - if(strlen(url) == 0) { - printf("empty url\n"); - return 0; - } - - /* See if the URL starts with http:// and remove it. Otherwise, we - assume it is an implicit http://. */ - if(strncmp(url, "http://", strlen("http://")) == 0) { - urlptr = url + strlen("http://"); - } else { - urlptr = url; - } - - /* Find host part of the URL. */ - if(*urlptr == '[') { - /* Handle IPv6 addresses - scan for matching ']' */ - urlptr++; - for(i = 0; i < MAX_HOSTLEN; ++i) { - if(*urlptr == ']') { - if(host != NULL) { - host[i] = 0; - } - urlptr++; - break; - } - if(host != NULL) { - host[i] = *urlptr; - } - ++urlptr; - } - } else { - for(i = 0; i < MAX_HOSTLEN; ++i) { - if(*urlptr == 0 || - *urlptr == '/' || - *urlptr == ' ' || - *urlptr == ':') { - if(host != NULL) { - host[i] = 0; - } - break; - } - if(host != NULL) { - host[i] = *urlptr; - } - ++urlptr; - } - } - - /* check if host is null terminated */ - if(!memchr(host, 0, MAX_HOSTLEN)) { - return 0; - } - - /* Find the port. Default is 80. */ - port = 80; - if(*urlptr == ':') { - port = 0; - do { - ++urlptr; - if(*urlptr >= '0' && *urlptr <= '9') { - port = (10 * port) + (*urlptr - '0'); - } - } while(*urlptr >= '0' && - *urlptr <= '9'); - } - if(portptr != NULL) { - *portptr = port; - } - /* Find file part of the URL. */ - while(*urlptr != '/' && *urlptr != 0) { - ++urlptr; - } - if(*urlptr == '/') { - file = urlptr; - } else { - file = "/"; - } - if(path != NULL) { - strncpy(path, file, MAX_PATHLEN); - } - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -removesocket(struct http_socket *s) -{ - etimer_stop(&s->timeout_timer); - s->timeout_timer_started = 0; - list_remove(socketlist, s); -} -/*---------------------------------------------------------------------------*/ -static void -event(struct tcp_socket *tcps, void *ptr, - tcp_socket_event_t e) -{ - struct http_socket *s = ptr; - char host[MAX_HOSTLEN]; - char path[MAX_PATHLEN]; - uint16_t port; - char str[42]; - int len; - - if(e == TCP_SOCKET_CONNECTED) { - printf("Connected\n"); - if(parse_url(s->url, host, &port, path)) { - tcp_socket_send_str(tcps, s->postdata != NULL ? "POST " : "GET "); - if(s->proxy_port != 0) { - /* If we are configured to route through a proxy, we should - provide the full URL as the path. */ - tcp_socket_send_str(tcps, s->url); - } else { - tcp_socket_send_str(tcps, path); - } - tcp_socket_send_str(tcps, " HTTP/1.1\r\n"); - tcp_socket_send_str(tcps, "Connection: close\r\n"); - tcp_socket_send_str(tcps, "Host: "); - /* If we have IPv6 host, add the '[' and the ']' characters - to the host. As in rfc2732. */ - if(memchr(host, ':', MAX_HOSTLEN)) { - tcp_socket_send_str(tcps, "["); - } - tcp_socket_send_str(tcps, host); - if(memchr(host, ':', MAX_HOSTLEN)) { - tcp_socket_send_str(tcps, "]"); - } - tcp_socket_send_str(tcps, "\r\n"); - if(s->postdata != NULL) { - if(s->content_type) { - tcp_socket_send_str(tcps, "Content-Type: "); - tcp_socket_send_str(tcps, s->content_type); - tcp_socket_send_str(tcps, "\r\n"); - } - tcp_socket_send_str(tcps, "Content-Length: "); - sprintf(str, "%u", s->postdatalen); - tcp_socket_send_str(tcps, str); - tcp_socket_send_str(tcps, "\r\n"); - } else if(s->length || s->pos > 0) { - tcp_socket_send_str(tcps, "Range: bytes="); - if(s->length) { - if(s->pos >= 0) { - sprintf(str, "%llu-%llu", - (long long unsigned int)s->pos, (long long unsigned int)s->pos + s->length - 1); - } else { - sprintf(str, "-%llu", (long long unsigned int)s->length); - } - } else { - sprintf(str, "%llu-", (long long unsigned int)s->pos); - } - tcp_socket_send_str(tcps, str); - tcp_socket_send_str(tcps, "\r\n"); - } - tcp_socket_send_str(tcps, "\r\n"); - if(s->postdata != NULL && s->postdatalen) { - len = tcp_socket_send(tcps, s->postdata, s->postdatalen); - s->postdata += len; - s->postdatalen -= len; - } - } - parse_header_init(s); - } else if(e == TCP_SOCKET_CLOSED) { - call_callback(s, HTTP_SOCKET_CLOSED, NULL, 0); - removesocket(s); - printf("Closed\n"); - } else if(e == TCP_SOCKET_TIMEDOUT) { - call_callback(s, HTTP_SOCKET_TIMEDOUT, NULL, 0); - removesocket(s); - printf("Timedout\n"); - } else if(e == TCP_SOCKET_ABORTED) { - call_callback(s, HTTP_SOCKET_ABORTED, NULL, 0); - removesocket(s); - printf("Aborted\n"); - } else if(e == TCP_SOCKET_DATA_SENT) { - if(s->postdata != NULL && s->postdatalen) { - len = tcp_socket_send(tcps, s->postdata, s->postdatalen); - s->postdata += len; - s->postdatalen -= len; - } else { - start_timeout_timer(s); - } - } -} -/*---------------------------------------------------------------------------*/ -static int -start_request(struct http_socket *s) -{ - uip_ip4addr_t ip4addr; - uip_ip6addr_t ip6addr; - uip_ip6addr_t *addr; - char host[MAX_HOSTLEN]; - char path[MAX_PATHLEN]; - uint16_t port; - int ret; - - if(parse_url(s->url, host, &port, path)) { - - printf("url %s host %s port %d path %s\n", - s->url, host, port, path); - - /* Check if we are to route the request through a proxy. */ - if(s->proxy_port != 0) { - /* The proxy address should be an IPv6 address. */ - uip_ip6addr_copy(&ip6addr, &s->proxy_addr); - port = s->proxy_port; - } else if(uiplib_ip6addrconv(host, &ip6addr) == 0) { - /* First check if the host is an IP address. */ - if(uiplib_ip4addrconv(host, &ip4addr) != 0) { - ip64_addr_4to6(&ip4addr, &ip6addr); - } else { - /* Try to lookup the hostname. If it fails, we initiate a hostname - lookup. */ - ret = resolv_lookup(host, &addr); - if(ret == RESOLV_STATUS_UNCACHED || - ret == RESOLV_STATUS_EXPIRED) { - resolv_query(host); - puts("Resolving host..."); - return HTTP_SOCKET_OK; - } - if(addr != NULL) { - s->did_tcp_connect = 1; - tcp_socket_connect(&s->s, addr, port); - return HTTP_SOCKET_OK; - } else { - return HTTP_SOCKET_ERR; - } - } - } - tcp_socket_connect(&s->s, &ip6addr, port); - return HTTP_SOCKET_OK; - } else { - return HTTP_SOCKET_ERR; - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(http_socket_process, ev, data) -{ - PROCESS_BEGIN(); - - while(1) { - - PROCESS_WAIT_EVENT(); - - if(ev == resolv_event_found && data != NULL) { - struct http_socket *s; - const char *name = data; - /* Either found a hostname, or not. We need to go through the - list of http sockets and figure out to which connection this - reply corresponds, then either restart the HTTP get, or kill - it (if no hostname was found). */ - for(s = list_head(socketlist); - s != NULL; - s = list_item_next(s)) { - char host[MAX_HOSTLEN]; - if(s->did_tcp_connect) { - /* We already connected, ignored */ - } else if(parse_url(s->url, host, NULL, NULL) && - strcmp(name, host) == 0) { - if(resolv_lookup(name, NULL) == RESOLV_STATUS_CACHED) { - /* Hostname found, restart get. */ - start_request(s); - } else { - /* Hostname not found, kill connection. */ - call_callback(s, HTTP_SOCKET_HOSTNAME_NOT_FOUND, NULL, 0); - removesocket(s); - } - } - } - } else if(ev == PROCESS_EVENT_TIMER) { - struct http_socket *s; - struct etimer *timeout_timer = data; - /* - * A socket time-out has occurred. We need to go through the list of HTTP - * sockets and figure out to which socket this timer event corresponds, - * then close this socket. - */ - for(s = list_head(socketlist); - s != NULL; - s = list_item_next(s)) { - if(timeout_timer == &s->timeout_timer && s->timeout_timer_started) { - tcp_socket_close(&s->s); - break; - } - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - static uint8_t inited = 0; - if(inited == 0) { - process_start(&http_socket_process, NULL); - list_init(socketlist); - inited = 1; - } -} -/*---------------------------------------------------------------------------*/ -void -http_socket_init(struct http_socket *s) -{ - init(); - uip_create_unspecified(&s->proxy_addr); - s->proxy_port = 0; -} -/*---------------------------------------------------------------------------*/ -static void -initialize_socket(struct http_socket *s) -{ - s->pos = 0; - s->length = 0; - s->postdata = NULL; - s->postdatalen = 0; - s->timeout_timer_started = 0; - PT_INIT(&s->pt); - tcp_socket_register(&s->s, s, - s->inputbuf, sizeof(s->inputbuf), - s->outputbuf, sizeof(s->outputbuf), - input, event); -} -/*---------------------------------------------------------------------------*/ -int -http_socket_get(struct http_socket *s, - const char *url, - int64_t pos, - uint64_t length, - http_socket_callback_t callback, - void *callbackptr) -{ - initialize_socket(s); - strncpy(s->url, url, sizeof(s->url)); - s->pos = pos; - s->length = length; - s->callback = callback; - s->callbackptr = callbackptr; - - s->did_tcp_connect = 0; - - list_add(socketlist, s); - - return start_request(s); -} -/*---------------------------------------------------------------------------*/ -int -http_socket_post(struct http_socket *s, - const char *url, - const void *postdata, - uint16_t postdatalen, - const char *content_type, - http_socket_callback_t callback, - void *callbackptr) -{ - initialize_socket(s); - strncpy(s->url, url, sizeof(s->url)); - s->postdata = postdata; - s->postdatalen = postdatalen; - s->content_type = content_type; - - s->callback = callback; - s->callbackptr = callbackptr; - - s->did_tcp_connect = 0; - - list_add(socketlist, s); - - return start_request(s); -} -/*---------------------------------------------------------------------------*/ -int -http_socket_close(struct http_socket *socket) -{ - struct http_socket *s; - for(s = list_head(socketlist); - s != NULL; - s = list_item_next(s)) { - if(s == socket) { - tcp_socket_close(&s->s); - removesocket(s); - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -http_socket_set_proxy(struct http_socket *s, - const uip_ipaddr_t *addr, uint16_t port) -{ - uip_ipaddr_copy(&s->proxy_addr, addr); - s->proxy_port = port; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/app-layer/http-socket/http-socket.h b/os/net/app-layer/http-socket/http-socket.h deleted file mode 100644 index adac80c3e..000000000 --- a/os/net/app-layer/http-socket/http-socket.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2013, Thingsquare, http://www.thingsquare.com/. - * 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 HTTP_SOCKET_H -#define HTTP_SOCKET_H - -#include "tcp-socket.h" -#include "sys/cc.h" - -struct http_socket; - -typedef enum { - HTTP_SOCKET_ERR, - HTTP_SOCKET_OK, - HTTP_SOCKET_HEADER, - HTTP_SOCKET_DATA, - HTTP_SOCKET_CLOSED, - HTTP_SOCKET_TIMEDOUT, - HTTP_SOCKET_ABORTED, - HTTP_SOCKET_HOSTNAME_NOT_FOUND, -} http_socket_event_t; - -struct http_socket_header { - uint16_t status_code; - int64_t content_length; - struct { - int64_t first_byte_pos; - int64_t last_byte_pos; - int64_t instance_length; - } content_range; -}; - -typedef void (* http_socket_callback_t)(struct http_socket *s, - void *ptr, - http_socket_event_t ev, - const uint8_t *data, - uint16_t datalen); - -#define HTTP_SOCKET_INPUTBUFSIZE UIP_TCP_MSS -#define HTTP_SOCKET_OUTPUTBUFSIZE MAX(UIP_TCP_MSS, 128) - -#define HTTP_SOCKET_URLLEN 128 - -#define HTTP_SOCKET_TIMEOUT ((2 * 60 + 30) * CLOCK_SECOND) - -struct http_socket { - struct http_socket *next; - struct tcp_socket s; - uip_ipaddr_t proxy_addr; - uint16_t proxy_port; - int64_t pos; - uint64_t length; - const uint8_t *postdata; - uint16_t postdatalen; - http_socket_callback_t callback; - void *callbackptr; - int did_tcp_connect; - char url[HTTP_SOCKET_URLLEN]; - uint8_t inputbuf[HTTP_SOCKET_INPUTBUFSIZE]; - uint8_t outputbuf[HTTP_SOCKET_OUTPUTBUFSIZE]; - - struct etimer timeout_timer; - uint8_t timeout_timer_started; - struct pt pt, headerpt; - int header_chars; - char header_field[15]; - struct http_socket_header header; - uint8_t header_received; - uint64_t bodylen; - const char *content_type; -}; - -void http_socket_init(struct http_socket *s); - -int http_socket_get(struct http_socket *s, const char *url, - int64_t pos, uint64_t length, - http_socket_callback_t callback, - void *callbackptr); - -int http_socket_post(struct http_socket *s, const char *url, - const void *postdata, - uint16_t postdatalen, - const char *content_type, - http_socket_callback_t callback, - void *callbackptr); - -int http_socket_close(struct http_socket *socket); - -void http_socket_set_proxy(struct http_socket *s, - const uip_ipaddr_t *addr, uint16_t port); - - -#endif /* HTTP_SOCKET_H */ diff --git a/os/net/app-layer/http-socket/websocket-http-client.c b/os/net/app-layer/http-socket/websocket-http-client.c deleted file mode 100644 index a6cb4a8bd..000000000 --- a/os/net/app-layer/http-socket/websocket-http-client.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (c) 2014, Thingsquare, http://www.thingsquare.com/. - * 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 "websocket-http-client.h" -#include "net/ipv6/uiplib.h" -#include "net/ipv6/resolv.h" - -#include "ipv6/ip64-addr.h" - -#include -#include - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Websocket" -#define LOG_LEVEL LOG_LEVEL_IPV6 - -enum { - STATE_WAITING_FOR_HEADER, - STATE_WAITING_FOR_CONNECTED, - STATE_STEADY_STATE, -}; -/*---------------------------------------------------------------------------*/ -static void -send_get(struct websocket_http_client_state *s) -{ - struct tcp_socket *tcps; - - tcps = &s->s; - tcp_socket_send_str(tcps, "GET "); - tcp_socket_send_str(tcps, s->file); - tcp_socket_send_str(tcps, " HTTP/1.1\r\n"); - tcp_socket_send_str(tcps, "Host: "); - tcp_socket_send_str(tcps, s->host); - tcp_socket_send_str(tcps, "\r\n"); - if(strlen(s->header) > 0) { - tcp_socket_send_str(tcps, s->header); - } - /* The Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw== header is - supposed to be a random value, encoded as base64, that is SHA1 - hashed by the server and returned in a HTTP header. This is used - to make sure that we are not seeing some cached version of this - conversation. But we have no SHA1 code by default in Contiki, so - we can't check the return value. Therefore we just use a - hardcoded value here. */ - tcp_socket_send_str(tcps, - "Connection: Upgrade\r\n" - "Upgrade: websocket\r\n" - "Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==\r\n" - "Sec-WebSocket-Version: 13\r\n" - "Sec-WebSocket-Protocol:"); - tcp_socket_send_str(tcps, s->subprotocol); - tcp_socket_send_str(tcps, "\r\n"); - tcp_socket_send_str(tcps, "\r\n"); - LOG_INFO("send_get(): output buffer left %d\n", tcp_socket_max_sendlen(tcps)); -} -/*---------------------------------------------------------------------------*/ -static void -send_connect(struct websocket_http_client_state *s) -{ - struct tcp_socket *tcps; - char buf[20]; - - tcps = &s->s; - tcp_socket_send_str(tcps, "CONNECT "); - tcp_socket_send_str(tcps, s->host); - tcp_socket_send_str(tcps, ":"); - sprintf(buf, "%d", s->port); - tcp_socket_send_str(tcps, buf); - tcp_socket_send_str(tcps, " HTTP/1.1\r\n"); - tcp_socket_send_str(tcps, "Host: "); - tcp_socket_send_str(tcps, s->host); - tcp_socket_send_str(tcps, "\r\n"); - tcp_socket_send_str(tcps, "Proxy-Connection: Keep-Alive\r\n\r\n"); -} -/*---------------------------------------------------------------------------*/ -static void -event(struct tcp_socket *tcps, void *ptr, - tcp_socket_event_t e) -{ - struct websocket_http_client_state *s = ptr; - - if(e == TCP_SOCKET_CONNECTED) { - if(s->proxy_port != 0) { - send_connect(s); - } else { - send_get(s); - } - } else if(e == TCP_SOCKET_CLOSED) { - websocket_http_client_closed(s); - } else if(e == TCP_SOCKET_TIMEDOUT) { - websocket_http_client_timedout(s); - } else if(e == TCP_SOCKET_ABORTED) { - websocket_http_client_aborted(s); - } else if(e == TCP_SOCKET_DATA_SENT) { - /* We could feed this information up to the websocket.c layer, but - we currently do not do that. */ - } -} -/*---------------------------------------------------------------------------*/ -static int -parse_header_byte(struct websocket_http_client_state *s, - uint8_t b) -{ - static const char *endmarker = "\r\n\r\n"; - - PT_BEGIN(&s->parse_header_pt); - - /* Skip the first part of the HTTP response */ - while(b != ' ') { - PT_YIELD(&s->parse_header_pt); - } - - /* Skip the space that follow the first part */ - PT_YIELD(&s->parse_header_pt); - - /* Read the first three bytes that constistute the HTTP status - code. We store the HTTP status code as an integer in the - s->http_status field. */ - s->http_status = (b - '0'); - PT_YIELD(&s->parse_header_pt); - s->http_status = s->http_status * 10 + (b - '0'); - PT_YIELD(&s->parse_header_pt); - s->http_status = s->http_status * 10 + (b - '0'); - - if((s->proxy_port != 0 && !(s->http_status == 200 || s->http_status == 101)) || - (s->proxy_port == 0 && s->http_status != 101)) { - /* This is a websocket request, so the server should have answered - with a 101 Switching protocols response. */ - LOG_WARN("didn't get the 101 status code (got %d), closing connection\n", - s->http_status); - websocket_http_client_close(s); - while(1) { - PT_YIELD(&s->parse_header_pt); - } - } - - /* Keep eating header bytes until we reach the end of it. The end is - indicated by the string "\r\n\r\n". We don't actually look at any - of the headers. - - The s->i variable contains the number of consecutive bytes - matched. If we match the total length of the string, we stop. - */ - - s->i = 0; - do { - PT_YIELD(&s->parse_header_pt); - if(b == (uint8_t)endmarker[s->i]) { - s->i++; - } else { - s->i = 0; - } - } while(s->i < strlen(endmarker)); - - if(s->proxy_port != 0 && s->state == STATE_WAITING_FOR_HEADER) { - send_get(s); - s->state = STATE_WAITING_FOR_CONNECTED; - } else { - s->state = STATE_STEADY_STATE; - websocket_http_client_connected(s); - } - PT_END(&s->parse_header_pt); -} -/*---------------------------------------------------------------------------*/ -static int -input(struct tcp_socket *tcps, void *ptr, - const uint8_t *inputptr, int inputdatalen) -{ - struct websocket_http_client_state *s = ptr; - - if(s->state == STATE_WAITING_FOR_HEADER || - s->state == STATE_WAITING_FOR_CONNECTED) { - int i; - for(i = 0; i < inputdatalen; i++) { - parse_header_byte(s, inputptr[i]); - if(s->state == STATE_STEADY_STATE) { - i++; - break; - } - } - - if(i < inputdatalen && s->state == STATE_STEADY_STATE) { - websocket_http_client_datahandler(s, &inputptr[i], inputdatalen - i); - } - } else { - websocket_http_client_datahandler(s, inputptr, inputdatalen); - } - - return 0; /* all data consumed */ -} -/*---------------------------------------------------------------------------*/ -int -websocket_http_client_register(struct websocket_http_client_state *s, - const char *host, - uint16_t port, - const char *file, - const char *subprotocol, - const char *header) -{ - if(host == NULL) { - return -1; - } - strncpy(s->host, host, sizeof(s->host)); - - if(file == NULL) { - return -1; - } - strncpy(s->file, file, sizeof(s->file)); - - if(subprotocol == NULL) { - return -1; - } - strncpy(s->subprotocol, subprotocol, sizeof(s->subprotocol)); - - if(header == NULL) { - strncpy(s->header, "", sizeof(s->header)); - } else { - strncpy(s->header, header, sizeof(s->header)); - } - - if(port == 0) { - s->port = 80; - } else { - s->port = port; - } - return 1; -} -/*---------------------------------------------------------------------------*/ -int -websocket_http_client_get(struct websocket_http_client_state *s) -{ - uip_ip4addr_t ip4addr; - uip_ip6addr_t ip6addr; - uip_ip6addr_t *addr; - uint16_t port; - - LOG_INFO("Get: connecting to %s with file %s subprotocol %s header %s\n", - s->host, s->file, s->subprotocol, s->header); - - - s->state = STATE_WAITING_FOR_HEADER; - - if(tcp_socket_register(&s->s, s, - s->inputbuf, sizeof(s->inputbuf), - s->outputbuf, sizeof(s->outputbuf), - input, event) < 0) { - return -1; - } - - port = s->port; - if(s->proxy_port != 0) { - /* The proxy address should be an IPv6 address. */ - uip_ipaddr_copy(&ip6addr, &s->proxy_addr); - port = s->proxy_port; - } else if(uiplib_ip6addrconv(s->host, &ip6addr) == 0) { - /* First check if the host is an IP address. */ - if(uiplib_ip4addrconv(s->host, &ip4addr) != 0) { - ip64_addr_4to6(&ip4addr, &ip6addr); - } else { - /* Try to lookup the hostname. If it fails, we initiate a hostname - lookup. */ - if(resolv_lookup(s->host, &addr) != RESOLV_STATUS_CACHED) { - return -1; - } - return tcp_socket_connect(&s->s, addr, s->port); - } - } - return tcp_socket_connect(&s->s, &ip6addr, port); -} -/*---------------------------------------------------------------------------*/ -int -websocket_http_client_send(struct websocket_http_client_state *s, - const uint8_t *data, - uint16_t datalen) -{ - if(s->state == STATE_STEADY_STATE) { - return tcp_socket_send(&s->s, data, datalen); - } - return -1; -} -/*---------------------------------------------------------------------------*/ -int -websocket_http_client_sendbuflen(struct websocket_http_client_state *s) -{ - return tcp_socket_max_sendlen(&s->s); -} -/*---------------------------------------------------------------------------*/ -void -websocket_http_client_close(struct websocket_http_client_state *s) -{ - tcp_socket_close(&s->s); -} -/*---------------------------------------------------------------------------*/ -const char * -websocket_http_client_hostname(struct websocket_http_client_state *s) -{ - return s->host; -} -/*---------------------------------------------------------------------------*/ -void -websocket_http_client_init(struct websocket_http_client_state *s) -{ - uip_create_unspecified(&s->proxy_addr); - s->proxy_port = 0; -} -/*---------------------------------------------------------------------------*/ -void -websocket_http_client_set_proxy(struct websocket_http_client_state *s, - const uip_ipaddr_t *addr, uint16_t port) -{ - uip_ipaddr_copy(&s->proxy_addr, addr); - s->proxy_port = port; -} -/*---------------------------------------------------------------------------*/ -int -websocket_http_client_queuelen(struct websocket_http_client_state *s) -{ - return tcp_socket_queuelen(&s->s); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/app-layer/http-socket/websocket-http-client.h b/os/net/app-layer/http-socket/websocket-http-client.h deleted file mode 100644 index 56fc34d0a..000000000 --- a/os/net/app-layer/http-socket/websocket-http-client.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2014, Thingsquare, http://www.thingsquare.com/. - * 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 WEBSOCKET_HTTP_CLIENT_H_ -#define WEBSOCKET_HTTP_CLIENT_H_ - -#include "contiki.h" -#include "tcp-socket.h" - -#ifdef WEBSOCKET_HTTP_CLIENT_CONF_INPUTBUFSIZE -#define WEBSOCKET_HTTP_CLIENT_INPUTBUFSIZE WEBSOCKET_HTTP_CLIENT_CONF_INPUTBUFSIZE -#else /* WEBSOCKET_HTTP_CLIENT_CONF_INPUTBUFSIZE */ -#define WEBSOCKET_HTTP_CLIENT_INPUTBUFSIZE 100 -#endif /* WEBSOCKET_HTTP_CLIENT_CONF_INPUTBUFSIZE */ - -#ifdef WEBSOCKET_HTTP_CLIENT_CONF_OUTPUTBUFSIZE -#define WEBSOCKET_HTTP_CLIENT_OUTPUTBUFSIZE WEBSOCKET_HTTP_CLIENT_CONF_OUTPUTBUFSIZE -#else /* WEBSOCKET_HTTP_CLIENT_CONF_OUTPUTBUFSIZE */ -#define WEBSOCKET_HTTP_CLIENT_OUTPUTBUFSIZE 300 -#endif /* WEBSOCKET_HTTP_CLIENT_CONF_OUTPUTBUFSIZE */ - -#ifdef WEBSOCKET_HTTP_CLIENT_CONF_MAX_HOSTLEN -#define WEBSOCKET_HTTP_CLIENT_MAX_HOSTLEN WEBSOCKET_HTTP_CLIENT_CONF_MAX_HOSTLEN -#else /* WEBSOCKET_HTTP_CLIENT_CONF_MAX_HOSTLEN */ -#define WEBSOCKET_HTTP_CLIENT_MAX_HOSTLEN 32 -#endif /* WEBSOCKET_HTTP_CLIENT_CONF_MAX_HOSTLEN */ - -#ifdef WEBSOCKET_HTTP_CLIENT_CONF_MAX_FILELEN -#define WEBSOCKET_HTTP_CLIENT_MAX_FILELEN WEBSOCKET_HTTP_CLIENT_CONF_MAX_FILELEN -#else /* WEBSOCKET_HTTP_CLIENT_CONF_MAX_FILELEN */ -#define WEBSOCKET_HTTP_CLIENT_MAX_FILELEN 32 -#endif /* WEBSOCKET_HTTP_CLIENT_CONF_MAX_FILELEN */ - -#ifdef WEBSOCKET_HTTP_CLIENT_CONF_MAX_SUBPROTOCOLLEN -#define WEBSOCKET_HTTP_CLIENT_MAX_SUBPROTOCOLLEN WEBSOCKET_HTTP_CLIENT_CONF_MAX_SUBPROTOCOLLEN -#else /* WEBSOCKET_HTTP_CLIENT_CONF_MAX_SUBPROTOCOLLEN */ -#define WEBSOCKET_HTTP_CLIENT_MAX_SUBPROTOCOLLEN 24 -#endif /* WEBSOCKET_HTTP_CLIENT_CONF_MAX_SUBPROTOCOLLEN */ - -#ifdef WEBSOCKET_HTTP_CLIENT_CONF_MAX_HEADERLEN -#define WEBSOCKET_HTTP_CLIENT_MAX_HEADERLEN WEBSOCKET_HTTP_CLIENT_CONF_MAX_HEADERLEN -#else /* WEBSOCKET_HTTP_CLIENT_CONF_MAX_HEADERLEN */ -#define WEBSOCKET_HTTP_CLIENT_MAX_HEADERLEN 128 -#endif /* WEBSOCKET_HTTP_CLIENT_CONF_MAX_HEADERLEN */ - -struct websocket_http_client_state { - struct tcp_socket s; - uint8_t inputbuf[WEBSOCKET_HTTP_CLIENT_INPUTBUFSIZE]; - uint8_t outputbuf[WEBSOCKET_HTTP_CLIENT_OUTPUTBUFSIZE]; - char host[WEBSOCKET_HTTP_CLIENT_MAX_HOSTLEN]; - char file[WEBSOCKET_HTTP_CLIENT_MAX_FILELEN]; - char subprotocol[WEBSOCKET_HTTP_CLIENT_MAX_SUBPROTOCOLLEN]; - char header[WEBSOCKET_HTTP_CLIENT_MAX_HEADERLEN]; - uint16_t port; - - int state; - struct pt parse_header_pt; - int http_status; - int i; - - uip_ipaddr_t proxy_addr; - uint16_t proxy_port; -}; - -void websocket_http_client_init(struct websocket_http_client_state *s); -void websocket_http_client_set_proxy(struct websocket_http_client_state *s, - const uip_ipaddr_t *addr, uint16_t port); - -int websocket_http_client_register(struct websocket_http_client_state *s, - const char *host, - uint16_t port, - const char *file, - const char *subprotocol, - const char *hdr); -int websocket_http_client_get(struct websocket_http_client_state *s); -int websocket_http_client_send(struct websocket_http_client_state *s, - const uint8_t *data, - uint16_t datalen); -int websocket_http_client_sendbuflen(struct websocket_http_client_state *s); - -void websocket_http_client_close(struct websocket_http_client_state *s); - -const char *websocket_http_client_hostname(struct websocket_http_client_state *s); - -int websocket_http_client_queuelen(struct websocket_http_client_state *s); - -/* Callback functions that have to be implemented by the application - program. */ -void websocket_http_client_datahandler(struct websocket_http_client_state *s, - const uint8_t *data, uint16_t len); -void websocket_http_client_connected(struct websocket_http_client_state *s); -void websocket_http_client_timedout(struct websocket_http_client_state *s); -void websocket_http_client_aborted(struct websocket_http_client_state *s); -void websocket_http_client_closed(struct websocket_http_client_state *s); - -#endif /* WEBSOCKET_HTTP_CLIENT_H_ */ diff --git a/os/net/app-layer/http-socket/websocket.c b/os/net/app-layer/http-socket/websocket.c deleted file mode 100644 index 04c6ba506..000000000 --- a/os/net/app-layer/http-socket/websocket.c +++ /dev/null @@ -1,721 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 -#include -#include - -#include "contiki-net.h" - -#include "websocket.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Websocket" -#define LOG_LEVEL LOG_LEVEL_IPV6 - -PROCESS(websocket_process, "Websockets process"); - -#define MAX_HOSTLEN 64 -#define MAX_PATHLEN 100 - -LIST(websocketlist); - -#define WEBSOCKET_FIN_BIT 0x80 - -#define WEBSOCKET_OPCODE_MASK 0x0f -#define WEBSOCKET_OPCODE_CONT 0x00 -#define WEBSOCKET_OPCODE_TEXT 0x01 -#define WEBSOCKET_OPCODE_BIN 0x02 -#define WEBSOCKET_OPCODE_CLOSE 0x08 -#define WEBSOCKET_OPCODE_PING 0x09 -#define WEBSOCKET_OPCODE_PONG 0x0a - -#define WEBSOCKET_MASK_BIT 0x80 -#define WEBSOCKET_LEN_MASK 0x7f -struct websocket_frame_hdr { - uint8_t opcode; - uint8_t len; - uint8_t extlen[4]; -}; - -struct websocket_frame_mask { - uint8_t mask[4]; -}; - -/*---------------------------------------------------------------------------*/ -static int -parse_url(const char *url, char *host, uint16_t *portptr, char *path) -{ - const char *urlptr; - int i; - const char *file; - uint16_t port; - - if(url == NULL) { - return 0; - } - - /* Don't even try to go further if the URL is empty. */ - if(strlen(url) == 0) { - return 0; - } - - /* See if the URL starts with http:// or ws:// and remove it. */ - if(strncmp(url, "http://", strlen("http://")) == 0) { - urlptr = url + strlen("http://"); - } else if(strncmp(url, "ws://", strlen("ws://")) == 0) { - urlptr = url + strlen("ws://"); - } else { - urlptr = url; - } - - /* Find host part of the URL. */ - for(i = 0; i < MAX_HOSTLEN; ++i) { - if(*urlptr == 0 || - *urlptr == '/' || - *urlptr == ' ' || - *urlptr == ':') { - if(host != NULL) { - host[i] = 0; - } - break; - } - if(host != NULL) { - host[i] = *urlptr; - } - ++urlptr; - } - - /* Find the port. Default is 0, which lets the underlying transport - select its default port. */ - port = 0; - if(*urlptr == ':') { - port = 0; - do { - ++urlptr; - if(*urlptr >= '0' && *urlptr <= '9') { - port = (10 * port) + (*urlptr - '0'); - } - } while(*urlptr >= '0' && - *urlptr <= '9'); - } - if(portptr != NULL) { - *portptr = port; - } - /* Find file part of the URL. */ - while(*urlptr != '/' && *urlptr != 0) { - ++urlptr; - } - if(*urlptr == '/') { - file = urlptr; - } else { - file = "/"; - } - if(path != NULL) { - strncpy(path, file, MAX_PATHLEN); - } - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -start_get(struct websocket *s) -{ - if(websocket_http_client_get(&(s->s)) == 0) { - LOG_ERR("Out of memory error\n"); - s->state = WEBSOCKET_STATE_CLOSED; - return WEBSOCKET_ERR; - } else { - LOG_INFO("Connecting...\n"); - s->state = WEBSOCKET_STATE_HTTP_REQUEST_SENT; - return WEBSOCKET_OK; - } - return WEBSOCKET_ERR; -} -/*---------------------------------------------------------------------------*/ -void -call(struct websocket *s, websocket_result_t r, - const uint8_t *data, uint16_t datalen) -{ - if(s != NULL && s->callback != NULL) { - s->callback(s, r, data, datalen); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(websocket_process, ev, data) -{ - PROCESS_BEGIN(); - - while(1) { - - PROCESS_WAIT_EVENT(); - - if(ev == resolv_event_found && data != NULL) { - int ret; - struct websocket *s; - const char *name = data; - /* Either found a hostname, or not. We need to go through the - list of websocketsand figure out to which connection this - reply corresponds, then either restart the HTTP get, or kill - it (if no hostname was found). */ - for(s = list_head(websocketlist); - s != NULL; - s = list_item_next(s)) { - if(strcmp(name, websocket_http_client_hostname(&s->s)) == 0) { - ret = resolv_lookup(name, NULL); - if(ret == RESOLV_STATUS_CACHED) { - /* Hostname found, restart get. */ - if(s->state == WEBSOCKET_STATE_DNS_REQUEST_SENT) { - LOG_INFO("Restarting get\n"); - start_get(s); - } - } else { - if(s->state == WEBSOCKET_STATE_DNS_REQUEST_SENT) { - /* Hostname not found, kill connection. */ - LOG_ERR("killing connection\n"); - call(s, WEBSOCKET_HOSTNAME_NOT_FOUND, NULL, 0); - } - } - } - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/* Callback function. Called from the webclient when the HTTP - * connection was abruptly aborted. - */ -void -websocket_http_client_aborted(struct websocket_http_client_state *client_state) -{ - if(client_state != NULL) { - struct websocket *s = (struct websocket *) - ((char *)client_state - offsetof(struct websocket, s)); - LOG_WARN("Websocket reset\n"); - s->state = WEBSOCKET_STATE_CLOSED; - call(s, WEBSOCKET_RESET, NULL, 0); - } -} -/*---------------------------------------------------------------------------*/ -/* Callback function. Called from the webclient when the HTTP - * connection timed out. - */ -void -websocket_http_client_timedout(struct websocket_http_client_state *client_state) -{ - if(client_state != NULL) { - struct websocket *s = (struct websocket *) - ((char *)client_state - offsetof(struct websocket, s)); - LOG_WARN("Websocket timed out\n"); - s->state = WEBSOCKET_STATE_CLOSED; - call(s, WEBSOCKET_TIMEDOUT, NULL, 0); - } -} -/*---------------------------------------------------------------------------*/ -/* Callback function. Called from the webclient when the HTTP - * connection was closed after a request from the "websocket_http_client_close()" - * function. . - */ -void -websocket_http_client_closed(struct websocket_http_client_state *client_state) -{ - if(client_state != NULL) { - struct websocket *s = (struct websocket *) - ((char *)client_state - offsetof(struct websocket, s)); - LOG_INFO("Websocket closed.\n"); - s->state = WEBSOCKET_STATE_CLOSED; - call(s, WEBSOCKET_CLOSED, NULL, 0); - } -} -/*---------------------------------------------------------------------------*/ -/* Callback function. Called from the webclient when the HTTP - * connection is connected. - */ -void -websocket_http_client_connected(struct websocket_http_client_state *client_state) -{ - struct websocket *s = (struct websocket *) - ((char *)client_state - offsetof(struct websocket, s)); - - LOG_INFO("Websocket connected\n"); - s->state = WEBSOCKET_STATE_WAITING_FOR_HEADER; - call(s, WEBSOCKET_CONNECTED, NULL, 0); -} -/*---------------------------------------------------------------------------*/ -/* The websocket header may potentially be split into multiple TCP - segments. This function eats one byte each, puts it into - s->headercache, and checks whether or not the full header has been - received. */ -static int -receive_header_byte(struct websocket *s, uint8_t byte) -{ - int len; - int expected_len; - struct websocket_frame_hdr *hdr; - - /* Take the next byte of data and place it in the header cache. */ - if(s->state == WEBSOCKET_STATE_RECEIVING_HEADER) { - s->headercache[s->headercacheptr] = byte; - s->headercacheptr++; - if(s->headercacheptr >= sizeof(s->headercache)) { - /* Something bad happened: we ad read 10 bytes and had not yet - found a reasonable header, so we close the socket. */ - websocket_close(s); - } - } - - len = s->headercacheptr; - hdr = (struct websocket_frame_hdr *)s->headercache; - - /* Check the header that we have received to see if it is long - enough. */ - - /* We start with expecting a length of at least two bytes (opcode + - 1 length byte). */ - expected_len = 2; - - if(len >= expected_len) { - - /* We check how many more bytes we should expect to see. The - length byte determines how many length bytes are included in - the header. */ - if((hdr->len & WEBSOCKET_LEN_MASK) == 126) { - expected_len += 2; - } else if((hdr->len & WEBSOCKET_LEN_MASK) == 127) { - expected_len += 4; - } - - /* If the option has the mask bit set, we should expect to see 4 - mask bytes at the end of the header. */ - if((hdr->len & WEBSOCKET_MASK_BIT ) != 0) { - expected_len += 4; - } - - /* Now we know how long our header if expected to be. If it is - this long, we are done and we set the state to reflect this. */ - if(len == expected_len) { - s->state = WEBSOCKET_STATE_HEADER_RECEIVED; - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/* Callback function. Called from the webclient module when HTTP data - * has arrived. - */ -void -websocket_http_client_datahandler(struct websocket_http_client_state *client_state, - const uint8_t *data, uint16_t datalen) -{ - struct websocket *s = (struct websocket *) - ((char *)client_state - offsetof(struct websocket, s)); - struct websocket_frame_hdr *hdr; - struct websocket_frame_mask *maskptr; - - if(data == NULL) { - call(s, WEBSOCKET_CLOSED, NULL, 0); - } else { - /* This function is a state machine that does different things - depending on the state. If we are waiting for header (the - default state), we change to the RECEIVING_HEADER state when we - get the first byte. If we are receiving header, we put all - bytes we have into a header buffer until the full header has - been received. If we have received the header, we parse it. If - we have received and parsed the header, we are ready to receive - data. Finally, if there is data left in the incoming packet, we - repeat the process. */ - - if(s->state == WEBSOCKET_STATE_WAITING_FOR_HEADER) { - s->state = WEBSOCKET_STATE_RECEIVING_HEADER; - s->headercacheptr = 0; - } - - if(s->state == WEBSOCKET_STATE_RECEIVING_HEADER) { - while(datalen > 0 && s->state == WEBSOCKET_STATE_RECEIVING_HEADER) { - receive_header_byte(s, data[0]); - data++; - datalen--; - } - } - - if(s->state == WEBSOCKET_STATE_HEADER_RECEIVED) { - /* If this is the start of an incoming websocket data frame, we - decode the header and check if we should act on in. If not, we - pipe the data to the application through a callback handler. If - data arrives in multiple packets, it is up to the application to - put it back together again. */ - - /* The websocket header is at the start of the incoming data. */ - hdr = (struct websocket_frame_hdr *)s->headercache; - - /* The s->left field holds the length of the application data - * chunk that we are about to receive. */ - s->len = s->left = 0; - - /* The s->mask field holds the bitmask of the data chunk, if - * any. */ - memset(s->mask, 0, sizeof(s->mask)); - - /* We first read out the length of the application data - chunk. The length may be encoded over multiple bytes. If the - length is >= 126 bytes, it is encoded as two or more - bytes. The first length field determines if it is in 2 or 4 - bytes. We also keep track of where the bitmask is held - its - place also differs depending on how the length is encoded. */ - maskptr = (struct websocket_frame_mask *)hdr->extlen; - if((hdr->len & WEBSOCKET_LEN_MASK) < 126) { - s->len = s->left = hdr->len & WEBSOCKET_LEN_MASK; - } else if(hdr->len == 126) { - s->len = s->left = (hdr->extlen[0] << 8) + hdr->extlen[1]; - maskptr = (struct websocket_frame_mask *)&hdr->extlen[2]; - } else if(hdr->len == 127) { - s->len = s->left = ((uint32_t)hdr->extlen[0] << 24) + - ((uint32_t)hdr->extlen[1] << 16) + - ((uint32_t)hdr->extlen[2] << 8) + - hdr->extlen[3]; - maskptr = (struct websocket_frame_mask *)&hdr->extlen[4]; - } - - /* Set user_data to point to the first byte of application data. - See if the application data chunk is masked or not. If it is, - we copy the bitmask into the s->mask field. */ - if((hdr->len & WEBSOCKET_MASK_BIT) == 0) { - /* LOG_INFO("No mask\n");*/ - } else { - memcpy(s->mask, &maskptr->mask, sizeof(s->mask)); - /* LOG_INFO("There was a mask, %02x %02x %02x %02x\n", - s->mask[0], s->mask[1], s->mask[2], s->mask[3]);*/ - } - - /* Remember the opcode of the application chunk, put it in the - * s->opcode field. */ - s->opcode = hdr->opcode & WEBSOCKET_OPCODE_MASK; - - if(s->opcode == WEBSOCKET_OPCODE_PING) { - /* If the opcode is ping, we change the opcode to a pong, and - * send the data back. */ - hdr->opcode = (hdr->opcode & (~WEBSOCKET_OPCODE_MASK)) | - WEBSOCKET_OPCODE_PONG; - websocket_http_client_send(&s->s, (const uint8_t*)hdr, 2); - if(s->left > 0) { - websocket_http_client_send(&s->s, (const uint8_t*)data, s->left); - } - LOG_INFO("Got ping\n"); - call(s, WEBSOCKET_PINGED, NULL, 0); - s->state = WEBSOCKET_STATE_WAITING_FOR_HEADER; - } else if(s->opcode == WEBSOCKET_OPCODE_PONG) { - /* If the opcode is pong, we call the application to let it - know we got a pong. */ - LOG_INFO("Got pong\n"); - call(s, WEBSOCKET_PONG_RECEIVED, NULL, 0); - s->state = WEBSOCKET_STATE_WAITING_FOR_HEADER; - } else if(s->opcode == WEBSOCKET_OPCODE_CLOSE) { - /* If the opcode is a close, we send a close frame back. */ - hdr->opcode = (hdr->opcode & (~WEBSOCKET_OPCODE_MASK)) | - WEBSOCKET_OPCODE_CLOSE; - websocket_http_client_send(&s->s, (const uint8_t*)hdr, 2); - if(s->left > 0) { - websocket_http_client_send(&s->s, (const uint8_t*)data, s->left); - } - LOG_INFO("Got close, sending close\n"); - s->state = WEBSOCKET_STATE_WAITING_FOR_HEADER; - websocket_http_client_close(&s->s); - } else if(s->opcode == WEBSOCKET_OPCODE_BIN || - s->opcode == WEBSOCKET_OPCODE_TEXT) { - - /* If the opcode is bin or text, and there is application - * layer data in the packet, we call the application to - * process it. */ - if(s->left > 0) { - s->state = WEBSOCKET_STATE_RECEIVING_DATA; - if(datalen > 0) { - int len; - - len = MIN(s->left, datalen); - /* XXX todo: mask if needed. */ - call(s, WEBSOCKET_DATA, data, len); - data += len; - s->left -= len; - datalen -= len; - } - } - } - - if(s->left == 0) { - call(s, WEBSOCKET_DATA_RECEIVED, NULL, s->len); - s->state = WEBSOCKET_STATE_WAITING_FOR_HEADER; - - /* Need to keep parsing the incoming data to check for more - frames, if the incoming datalen is > than s->left. */ - if(datalen > 0) { - websocket_http_client_datahandler(client_state, - data, datalen); - } - } - } else if(s->state == WEBSOCKET_STATE_RECEIVING_DATA) { - /* XXX todo: mask if needed. */ - if(datalen > 0) { - if(datalen < s->left) { - call(s, WEBSOCKET_DATA, data, datalen); - s->left -= datalen; - data += datalen; - datalen = 0; - } else { - call(s, WEBSOCKET_DATA, data, s->left); - data += s->left; - datalen -= s->left; - s->left = 0; - } - } - if(s->left == 0) { - call(s, WEBSOCKET_DATA_RECEIVED, NULL, s->len); - s->state = WEBSOCKET_STATE_WAITING_FOR_HEADER; - /* Need to keep parsing the incoming data to check for more - frames, if the incoming datalen is > than len. */ - if(datalen > 0) { - websocket_http_client_datahandler(client_state, - data, datalen); - - } - } - } - } -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - static uint8_t inited = 0; - if(!inited) { - process_start(&websocket_process, NULL); - list_init(websocketlist); - inited = 1; - } -} -/*---------------------------------------------------------------------------*/ -void -websocket_init(struct websocket *s) -{ - init(); - websocket_http_client_init(&s->s); -} -/*---------------------------------------------------------------------------*/ -void -websocket_set_proxy(struct websocket *s, - const uip_ipaddr_t *addr, uint16_t port) -{ - websocket_http_client_set_proxy(&s->s, addr, port); -} -/*---------------------------------------------------------------------------*/ -websocket_result_t -websocket_open(struct websocket *s, const char *url, - const char *subprotocol, const char *hdr, - websocket_callback c) -{ - int ret; - char host[MAX_HOSTLEN + 1] = {0}; - char path[MAX_PATHLEN + 1] = {0}; - uint16_t port; - uip_ipaddr_t addr; - - init(); - - if(s == NULL) { - return WEBSOCKET_ERR; - } - - if(s->state != WEBSOCKET_STATE_CLOSED) { - LOG_INFO("Open: closing websocket before opening it again.\n"); - websocket_close(s); - } - s->callback = c; - - if(parse_url(url, host, &port, path)) { - list_add(websocketlist, s); - websocket_http_client_register(&s->s, host, port, path, subprotocol, hdr); - - /* First check if the host is an IP address. */ - if(uiplib_ip4addrconv(host, (uip_ip4addr_t *)&addr) == 0 && - uiplib_ip6addrconv(host, (uip_ip6addr_t *)&addr) == 0) { - /* Try to lookup the hostname. If it fails, we initiate a hostname - lookup and print out an informative message on the - statusbar. */ - ret = resolv_lookup(host, NULL); - if(ret != RESOLV_STATUS_CACHED) { - resolv_query(host); - s->state = WEBSOCKET_STATE_DNS_REQUEST_SENT; - LOG_INFO("Resolving host...\n"); - return WEBSOCKET_OK; - } - } - - PROCESS_CONTEXT_BEGIN(&websocket_process); - ret = start_get(s); - PROCESS_CONTEXT_END(); - return ret; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -void -websocket_close(struct websocket *s) -{ - websocket_http_client_close(&s->s); - s->state = WEBSOCKET_STATE_CLOSED; -} -/*---------------------------------------------------------------------------*/ -static int -send_data(struct websocket *s, const void *data, - uint16_t datalen, uint8_t data_type_opcode) -{ - uint8_t buf[WEBSOCKET_MAX_MSGLEN + 4 + 4]; /* The extra + 4 + 4 here - comes from the size of - the websocket framing - header. */ - struct websocket_frame_hdr *hdr; - struct websocket_frame_mask *mask; - - LOG_INFO("send data len %d %.*s\n", datalen, datalen, (char *)data); - if(s->state == WEBSOCKET_STATE_CLOSED || - s->state == WEBSOCKET_STATE_DNS_REQUEST_SENT || - s->state == WEBSOCKET_STATE_HTTP_REQUEST_SENT) { - /* Trying to send data on a non-connected websocket. */ - LOG_ERR("send fail: not connected\n"); - return -1; - } - - /* We need to have 4 + 4 additional bytes for the websocket framing - header. */ - if(4 + 4 + datalen > websocket_http_client_sendbuflen(&s->s)) { - LOG_ERR("too few bytes left (%d left, %d needed)\n", - websocket_http_client_sendbuflen(&s->s), - 4 + 4 + datalen); - return -1; - } - - if(datalen > sizeof(buf) - 4 - 4) { - LOG_ERR("trying to send too large data chunk %d > %d\n", - datalen, (int)sizeof(buf) - 4 - 4); - return -1; - } - - hdr = (struct websocket_frame_hdr *)&buf[0]; - hdr->opcode = WEBSOCKET_FIN_BIT | data_type_opcode; - - /* If the datalen is larger than 125 bytes, we need to send the data - length as two bytes. If the data length would be larger than 64k, - we should send the length as 4 bytes, but since we specify the - datalen as an unsigned 16-bit int, we do not handle the 64k case - here. */ - if(datalen > 125) { - /* Data from client must always have the mask bit set, and a data - mask sent right after the header. */ - hdr->len = 126 | WEBSOCKET_MASK_BIT; - hdr->extlen[0] = datalen >> 8; - hdr->extlen[1] = datalen & 0xff; - - mask = (struct websocket_frame_mask *)&buf[4]; - mask->mask[0] = - mask->mask[1] = - mask->mask[2] = - mask->mask[3] = 0; - memcpy(&buf[8], data, datalen); - return websocket_http_client_send(&s->s, buf, 8 + datalen); - } else { - /* Data from client must always have the mask bit set, and a data - mask sent right after the header. */ - hdr->len = datalen | WEBSOCKET_MASK_BIT; - - mask = (struct websocket_frame_mask *)&buf[2]; - mask->mask[0] = - mask->mask[1] = - mask->mask[2] = - mask->mask[3] = 0; - memcpy(&buf[6], data, datalen); - return websocket_http_client_send(&s->s, buf, 6 + datalen); - } - return -1; -} -/*---------------------------------------------------------------------------*/ -int -websocket_send_str(struct websocket *s, const char *str) -{ - return send_data(s, str, strlen(str), WEBSOCKET_OPCODE_TEXT); -} -/*---------------------------------------------------------------------------*/ -int -websocket_send(struct websocket *s, const uint8_t *data, - uint16_t datalen) -{ - return send_data(s, data, datalen, WEBSOCKET_OPCODE_BIN); -} -/*---------------------------------------------------------------------------*/ -int -websocket_ping(struct websocket *s) -{ - uint8_t buf[sizeof(struct websocket_frame_hdr) + - sizeof(struct websocket_frame_mask)]; - struct websocket_frame_hdr *hdr; - struct websocket_frame_mask *mask; - - /* We need 2 + 4 additional bytes for the websocket framing - header. */ - if(2 + 4 > websocket_http_client_sendbuflen(&s->s)) { - return -1; - } - - hdr = (struct websocket_frame_hdr *)&buf[0]; - mask = (struct websocket_frame_mask *)&buf[2]; - hdr->opcode = WEBSOCKET_FIN_BIT | WEBSOCKET_OPCODE_PING; - - /* Data from client must always have the mask bit set, and a data - mask sent right after the header. */ - hdr->len = 0 | WEBSOCKET_MASK_BIT; - - /* XXX: We just set a dummy mask of 0 for now and hope that this - works. */ - mask->mask[0] = - mask->mask[1] = - mask->mask[2] = - mask->mask[3] = 0; - websocket_http_client_send(&s->s, buf, 2 + 4); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -websocket_queuelen(struct websocket *s) -{ - return websocket_http_client_queuelen(&s->s); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/app-layer/http-socket/websocket.h b/os/net/app-layer/http-socket/websocket.h deleted file mode 100644 index f312d7dbd..000000000 --- a/os/net/app-layer/http-socket/websocket.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 WEBSOCKET_H -#define WEBSOCKET_H - -#include "websocket-http-client.h" - -typedef enum { - WEBSOCKET_ERR = 0, - WEBSOCKET_OK = 1, - WEBSOCKET_IN_PROGRESS = 2, - WEBSOCKET_HOSTNAME_NOT_FOUND = 3, - WEBSOCKET_CONNECTED = 4, - WEBSOCKET_DATA = 5, - WEBSOCKET_RESET = 6, - WEBSOCKET_TIMEDOUT = 7, - WEBSOCKET_CLOSED = 8, - WEBSOCKET_PINGED = 9, - WEBSOCKET_DATA_RECEIVED = 10, - WEBSOCKET_PONG_RECEIVED = 11, -} websocket_result_t; - -struct websocket; - -typedef void (* websocket_callback)(struct websocket *s, - websocket_result_t result, - const uint8_t *data, - uint16_t datalen); -#ifdef WEBSOCKET_CONF_MAX_MSGLEN -#define WEBSOCKET_MAX_MSGLEN WEBSOCKET_CONF_MAX_MSGLEN -#else /* WEBSOCKET_CONF_MAX_MSGLEN */ -#define WEBSOCKET_MAX_MSGLEN 200 -#endif /* WEBSOCKET_CONF_MAX_MSGLEN */ - -struct websocket { - struct websocket *next; /* Must be first. */ - struct websocket_http_client_state s; - websocket_callback callback; - - uint8_t mask[4]; - uint32_t left, len; - uint8_t opcode; - - uint8_t state; - - uint8_t headercacheptr; - uint8_t headercache[10]; /* The maximum websocket header + mask is 6 - + 4 bytes long */ -}; - -enum { - WEBSOCKET_STATE_CLOSED = 0, - WEBSOCKET_STATE_DNS_REQUEST_SENT = 1, - WEBSOCKET_STATE_HTTP_REQUEST_SENT = 2, - WEBSOCKET_STATE_WAITING_FOR_HEADER = 3, - WEBSOCKET_STATE_RECEIVING_HEADER = 4, - WEBSOCKET_STATE_HEADER_RECEIVED = 5, - WEBSOCKET_STATE_RECEIVING_DATA = 6, -}; - - -void websocket_init(struct websocket *s); - -void websocket_set_proxy(struct websocket *s, - const uip_ipaddr_t *addr, uint16_t port); - -websocket_result_t websocket_open(struct websocket *s, - const char *url, - const char *subprotocol, - const char *hdr, - websocket_callback c); - -int websocket_send(struct websocket *s, - const uint8_t *data, uint16_t datalen); - -int websocket_send_str(struct websocket *s, - const char *strptr); - -void websocket_close(struct websocket *s); - -int websocket_ping(struct websocket *s); - -int websocket_queuelen(struct websocket *s); - -#endif /* WEBSOCKET_H */ diff --git a/os/net/app-layer/httpd-ws/httpd-ws.c b/os/net/app-layer/httpd-ws/httpd-ws.c deleted file mode 100644 index 06b0e8b08..000000000 --- a/os/net/app-layer/httpd-ws/httpd-ws.c +++ /dev/null @@ -1,476 +0,0 @@ -/* - * Copyright (c) 2010-2012, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * A simple webserver for web services - * \author - * Adam Dunkels - * Niclas Finne - * Joakim Eriksson - */ - -#include -#include -#include - -#include "contiki-net.h" -#include "httpd-ws.h" - -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#ifndef WEBSERVER_CONF_CFS_CONNS -#define CONNS UIP_TCP_CONNS -#else /* WEBSERVER_CONF_CFS_CONNS */ -#define CONNS WEBSERVER_CONF_CFS_CONNS -#endif /* WEBSERVER_CONF_CFS_CONNS */ - -#ifndef WEBSERVER_CONF_CFS_URLCONV -#define URLCONV 0 -#else /* WEBSERVER_CONF_CFS_URLCONV */ -#define URLCONV WEBSERVER_CONF_CFS_URLCONV -#endif /* WEBSERVER_CONF_CFS_URLCONV */ - -#if URLCONV -#include "urlconv.h" -#endif /* URLCONV */ - -static struct httpd_ws_state conns[CONNS]; - -PROCESS(httpd_ws_process, "Web server (WS)"); - -#define ISO_nl 0x0a -#define ISO_space 0x20 -#define ISO_period 0x2e -#define ISO_slash 0x2f - -uint16_t http_connections = 0; - -static const char http_10[] = " HTTP/1.0\r\n"; -static const char http_content_type[] = "Content-Type:"; -static const char http_content_type_html[] = "text/html"; -static const char http_content_len[] = "Content-Length:"; -static const char http_header_404[] = - "HTTP/1.0 404 Not found\r\nServer: Contiki\r\nConnection: close\r\n"; -static const char http_header_200[] = - "HTTP/1.0 200 OK\r\nServer: Contiki\r\nConnection: close\r\n"; -static const char html_not_found[] = - "

Page not found

"; -/*---------------------------------------------------------------------------*/ -/* just set all states to unused */ -static void -httpd_state_init(void) -{ - int i; - - for(i = 0; i < CONNS; i++) { - conns[i].state = HTTPD_WS_STATE_UNUSED; - } -} -/*---------------------------------------------------------------------------*/ -static struct httpd_ws_state * -httpd_state_alloc(void) -{ - int i; - - for(i = 0; i < CONNS; i++) { - if(conns[i].state == HTTPD_WS_STATE_UNUSED) { - conns[i].state = HTTPD_WS_STATE_INPUT; - return &conns[i]; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -#define httpd_state_free(s) (s->state = HTTPD_WS_STATE_UNUSED) -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_string(struct httpd_ws_state *s, const char *str, uint16_t len)) -{ - PSOCK_BEGIN(&s->sout); - - SEND_STRING(&s->sout, str, len); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_headers(struct httpd_ws_state *s, const char *statushdr)) -{ - PSOCK_BEGIN(&s->sout); - - SEND_STRING(&s->sout, statushdr, strlen(statushdr)); - s->outbuf_pos = snprintf(s->outbuf, sizeof(s->outbuf), - "%s %s\r\n\r\n", http_content_type, - s->content_type == NULL - ? http_content_type_html : s->content_type); - SEND_STRING(&s->sout, s->outbuf, s->outbuf_pos); - s->outbuf_pos = 0; - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_output(struct httpd_ws_state *s)) -{ - PT_BEGIN(&s->outputpt); - - s->content_type = http_content_type_html; - s->script = httpd_ws_get_script(s); - if(s->script == NULL) { - PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_404)); - PT_WAIT_THREAD(&s->outputpt, - send_string(s, html_not_found, strlen(html_not_found))); - uip_close(); -/* webserver_log_file(&uip_conn->ripaddr, "404 - not found"); */ - PT_EXIT(&s->outputpt); - } else { - if(s->request_type == HTTPD_WS_POST) { - /* A post has a body that needs to be read */ - s->state = HTTPD_WS_STATE_INPUT; - PT_WAIT_UNTIL(&s->outputpt, s->state == HTTPD_WS_STATE_OUTPUT); - } - PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_200)); - PT_WAIT_THREAD(&s->outputpt, s->script(s)); - } - s->script = NULL; - PSOCK_CLOSE(&s->sout); - PT_END(&s->outputpt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_request(struct httpd_ws_state *s)) -{ - PT_BEGIN(&s->outputpt); - - /* send the request line */ - PT_WAIT_THREAD(&s->outputpt, - send_string(s, s->filename, strlen(s->filename))); - /* send host */ - if(s->outbuf_pos > 0) { - PT_WAIT_THREAD(&s->outputpt, send_string(s, s->outbuf, s->outbuf_pos)); - } - - if(s->content_type != NULL) { - s->outbuf_pos = snprintf(s->outbuf, sizeof(s->outbuf), "%s %s\r\n", - http_content_type, s->content_type); - PT_WAIT_THREAD(&s->outputpt, send_string(s, s->outbuf, s->outbuf_pos)); - } - /* send the extra header(s) */ - if(s->output_extra_headers != NULL) { - s->response_index = 0; - while((s->outbuf_pos = - s->output_extra_headers(s, - s->outbuf, sizeof(s->outbuf), - s->response_index)) > 0) { - PT_WAIT_THREAD(&s->outputpt, send_string(s, s->outbuf, s->outbuf_pos)); - s->response_index++; - } - } - - /* send content length */ - if(s->content_len > 0) { - s->outbuf_pos = snprintf(s->outbuf, sizeof(s->outbuf), "%s %u\r\n", - http_content_len, s->content_len); - } - /* send header separator */ - if(s->outbuf_pos + 2 < sizeof(s->outbuf)) { - s->outbuf[s->outbuf_pos++] = '\r'; - s->outbuf[s->outbuf_pos++] = '\n'; - } - PT_WAIT_THREAD(&s->outputpt, send_string(s, s->outbuf, s->outbuf_pos)); - s->outbuf_pos = 0; - - if(s->script != NULL) { - PT_WAIT_THREAD(&s->outputpt, s->script(s)); - } - s->state = HTTPD_WS_STATE_REQUEST_INPUT; - - PSOCK_CLOSE(&s->sout); - PT_END(&s->outputpt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_input(struct httpd_ws_state *s)) -{ - PSOCK_BEGIN(&s->sin); - PSOCK_READTO(&s->sin, ISO_space); - - if(strncmp(s->inputbuf, "GET ", 4) == 0) { - s->request_type = HTTPD_WS_GET; - } else if(strncmp(s->inputbuf, "POST ", 5) == 0) { - s->request_type = HTTPD_WS_POST; - s->content_len = 0; - } else if(strncmp(s->inputbuf, "HTTP ", 5) == 0) { - s->request_type = HTTPD_WS_RESPONSE; - } else { - PSOCK_CLOSE_EXIT(&s->sin); - } - PSOCK_READTO(&s->sin, ISO_space); - - /* TODO handle HTTP response */ - - if(s->inputbuf[0] != ISO_slash) { - PSOCK_CLOSE_EXIT(&s->sin); - } - -#if URLCONV - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - urlconv_tofilename(s->filename, s->inputbuf, sizeof(s->filename)); -#else /* URLCONV */ - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - snprintf(s->filename, sizeof(s->filename), "%s", s->inputbuf); -#endif /* URLCONV */ - -/* webserver_log_file(&uip_conn->ripaddr, s->filename); */ - s->state = HTTPD_WS_STATE_OUTPUT; - - while(1) { - PSOCK_READTO(&s->sin, ISO_nl); - - if(s->request_type == HTTPD_WS_POST && - strncmp(s->inputbuf, http_content_len, 15) == 0) { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0; - s->content_len = atoi(&s->inputbuf[16]); - } - - /* should have a header callback here check_header(s) */ - - if(PSOCK_DATALEN(&s->sin) > 2) { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0; - } else if(s->request_type == HTTPD_WS_POST) { - PSOCK_READBUF_LEN(&s->sin, s->content_len); - s->inputbuf[PSOCK_DATALEN(&s->sin)] = 0; - /* printf("Content: '%s'\nSize:%d\n", s->inputbuf, PSOCK_DATALEN(&s->sin)); */ - s->state = HTTPD_WS_STATE_OUTPUT; - } - } - PSOCK_END(&s->sin); -} -/*---------------------------------------------------------------------------*/ -static void -handle_connection(struct httpd_ws_state *s) -{ - if(s->state == HTTPD_WS_STATE_REQUEST_OUTPUT) { - handle_request(s); - } - handle_input(s); - if(s->state == HTTPD_WS_STATE_OUTPUT) { - handle_output(s); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_ws_appcall(void *state) -{ - struct httpd_ws_state *s = (struct httpd_ws_state *)state; - - if(uip_closed() || uip_aborted() || uip_timedout()) { - if(s != NULL) { - PRINTF("HTTPD-WS: closed/aborted (%d)\n", http_connections); - http_connections--; - httpd_state_free(s); - } else { - PRINTF("HTTPD-WS: closed/aborted ** NO HTTPD_WS_STATE!!! ** (%d)\n", - http_connections); - } - } else if(uip_connected()) { - if(s == NULL) { - s = httpd_state_alloc(); - if(s == NULL) { - uip_abort(); - PRINTF("HTTPD-WS: aborting - no resource (%d)\n", http_connections); - /* webserver_log_file(&uip_conn->ripaddr, "reset (no memory block)"); */ - return; - } - http_connections++; - - tcp_markconn(uip_conn, s); - s->state = HTTPD_WS_STATE_INPUT; - } else { - /* this is a request that is to be sent! */ - s->state = HTTPD_WS_STATE_REQUEST_OUTPUT; - } - PSOCK_INIT(&s->sin, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); - PSOCK_INIT(&s->sout, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); - PT_INIT(&s->outputpt); - timer_set(&s->timer, CLOCK_SECOND * 30); - handle_connection(s); - } else if(s != NULL) { - if(uip_poll()) { - if(timer_expired(&s->timer)) { - uip_abort(); - PRINTF("HTTPD-WS: aborting - http timeout (%d)\n", http_connections); - http_connections--; - httpd_state_free(s); -/* webserver_log_file(&uip_conn->ripaddr, "reset (timeout)"); */ - } else { - PRINTF("HTTPD-WS: uip-poll (%d)\n", http_connections); - } - } else { -/* PRINTF("HTTPD-WS: restart timer %s (%d)\n", s->filename, */ -/* http_connections); */ - timer_restart(&s->timer); - } - handle_connection(s); - } else { - PRINTF("HTTPD-WS: aborting - no state (%d)\n", http_connections); - uip_abort(); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_ws_init(void) -{ - tcp_listen(UIP_HTONS(80)); - httpd_state_init(); -#if URLCONV - urlconv_init(); -#endif /* URLCONV */ -} -/*---------------------------------------------------------------------------*/ -struct httpd_ws_state * -httpd_ws_request(char request_type, const char *host_ip, const char *host_hdr, - uint16_t port, const char *file, - const char *content_type, uint16_t content_len, - httpd_ws_script_t generator) -{ - struct httpd_ws_state *s; - struct uip_conn *conn; - uip_ipaddr_t *ipaddr; - uip_ipaddr_t addr; - char *request_str; - - /* First check if the host is an IP address. */ - ipaddr = &addr; - if(uiplib_ipaddrconv(host_ip, &addr) == 0) { -#if 0 && UIP_UDP - if(resolv_lookup(host, &ipaddr) != RESOLV_STATUS_CACHED) { - return NULL; - } -#else /* UIP_UDP */ - return NULL; -#endif /* UIP_UDP */ - } - - s = httpd_state_alloc(); - if(s == NULL) { - /* no memory left... do no request... */ - return NULL; - } - http_connections++; - - switch(request_type) { - case HTTPD_WS_POST: - request_str = "POST "; - break; - case HTTPD_WS_PUT: - request_str = "PUT "; - break; - default: - request_str = "GET "; - break; - } - - s->request_type = request_type; - s->content_len = content_len; - s->content_type = content_type; - s->script = generator; - s->state = HTTPD_WS_STATE_REQUEST_OUTPUT; - - /* create a request line for a POST - should check size of it!!! */ - /* Assume post for now */ - snprintf(s->filename, sizeof(s->filename), "%s%s%s", - request_str, file, http_10); - s->outbuf_pos = snprintf(s->outbuf, sizeof(s->outbuf), "Host:%s\r\n", - host_hdr != NULL ? host_hdr : host_ip); - - PROCESS_CONTEXT_BEGIN(&httpd_ws_process); - conn = tcp_connect(ipaddr, uip_htons(port), s); - PROCESS_CONTEXT_END(&httpd_ws_process); - if(conn == NULL) { - PRINTF("HTTPD-WS: aborting... could not allocate tcp connection (%d)\n", - http_connections); - httpd_state_free(s); - http_connections--; - return NULL; - } - PRINTF("HTTPD-WS: created http connection (%d)\n", http_connections); - - return s; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(httpd_ws_process, ev, data) -{ - static struct etimer et; - int i; - - PROCESS_BEGIN(); - - httpd_ws_init(); - - PRINTF("Buffer size, input %d, output\n", - HTTPD_INBUF_SIZE, HTTPD_OUTBUF_SIZE); - - /* Delay 2-4 seconds */ - etimer_set(&et, CLOCK_SECOND * 10); - - /* GC any http session that is too long lived - either because other - end never closed or if any other state cause too long lived http - sessions */ - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event || etimer_expired(&et)); - if(ev == tcpip_event) { - httpd_ws_appcall(data); - } else if(etimer_expired(&et)) { - PRINTF("HTTPD States: "); - for(i = 0; i < CONNS; i++) { - PRINTF("%d ", conns[i].state); - if(conns[i].state != HTTPD_WS_STATE_UNUSED && - timer_expired(&conns[i].timer)) { - conns[i].state = HTTPD_WS_STATE_UNUSED; - PRINTF("\n*** RELEASED HTTPD Session\n"); - http_connections--; - } - } - PRINTF("\n"); - etimer_reset(&et); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/app-layer/httpd-ws/httpd-ws.h b/os/net/app-layer/httpd-ws/httpd-ws.h deleted file mode 100644 index a1164d94f..000000000 --- a/os/net/app-layer/httpd-ws/httpd-ws.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2010-2012, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * A simple webserver for web services - * \author - * Adam Dunkels - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef HTTPD_WS_H_ -#define HTTPD_WS_H_ - -#include "contiki-net.h" - -#ifndef WEBSERVER_CONF_CFS_PATHLEN -#define HTTPD_PATHLEN 80 -#else /* WEBSERVER_CONF_CFS_PATHLEN */ -#define HTTPD_PATHLEN WEBSERVER_CONF_CFS_PATHLEN -#endif /* WEBSERVER_CONF_CFS_PATHLEN */ - -#ifndef WEBSERVER_CONF_INBUF_SIZE -#define HTTPD_INBUF_SIZE (HTTPD_PATHLEN + 90) -#else /* WEBSERVER_CONF_INBUF_SIZE */ -#define HTTPD_INBUF_SIZE WEBSERVER_CONF_INBUF_SIZE -#endif /* WEBSERVER_CONF_INBUF_SIZE */ - -#if HTTPD_INBUF_SIZE < UIP_TCP_MSS || HTTPD_INBUF_SIZE < UIP_RECEIVE_WINDOW -#error HTTPD_INBUF_SIZE is too small. Must be at least a TCP window in size. -#endif - -#ifndef WEBSERVER_CONF_OUTBUF_SIZE -#define HTTPD_OUTBUF_SIZE (UIP_TCP_MSS + 20) -#else /* WEBSERVER_CONF_OUTBUF_SIZE */ -#define HTTPD_OUTBUF_SIZE WEBSERVER_CONF_OUTBUF_SIZE -#endif /* WEBSERVER_CONF_OUTBUF_SIZE */ - -struct httpd_ws_state; -typedef char (* httpd_ws_script_t)(struct httpd_ws_state *s); -typedef int (* httpd_ws_output_headers_t)(struct httpd_ws_state *s, - char *buffer, int buf_size, - int index); - -#define HTTPD_WS_GET 1 -#define HTTPD_WS_POST 2 -#define HTTPD_WS_PUT 3 -#define HTTPD_WS_RESPONSE 4 - -#define HTTPD_WS_STATE_UNUSED 0 -#define HTTPD_WS_STATE_INPUT 1 -#define HTTPD_WS_STATE_OUTPUT 2 -#define HTTPD_WS_STATE_REQUEST_OUTPUT 3 -#define HTTPD_WS_STATE_REQUEST_INPUT 4 - -struct httpd_ws_state { - struct timer timer; - struct psock sin, sout; - struct pt outputpt; - char inputbuf[HTTPD_INBUF_SIZE]; - char filename[HTTPD_PATHLEN]; - const char *content_type; - uint16_t content_len; - char outbuf[HTTPD_OUTBUF_SIZE]; - uint16_t outbuf_pos; - char state; - char request_type; - int response_index; - - httpd_ws_output_headers_t output_extra_headers; - httpd_ws_script_t script; - -#ifdef HTTPD_WS_CONF_USER_STATE - HTTPD_WS_CONF_USER_STATE; -#endif -}; - -void httpd_ws_init(void); -void httpd_ws_appcall(void *state); - -struct httpd_ws_state *httpd_ws_request(char request_type, - const char *host_ip, - const char *host_hdr, - uint16_t port, - const char *file, - const char *content_type, - uint16_t content_len, - httpd_ws_script_t generator); - -#define SEND_STRING(s, str, len) PSOCK_SEND((s), (uint8_t *)(str), (len)) - -httpd_ws_script_t httpd_ws_get_script(struct httpd_ws_state *s); - -PROCESS_NAME(httpd_ws_process); - -#endif /* HTTPD_WS_H_ */ diff --git a/os/net/app-layer/mqtt/mqtt.c b/os/net/app-layer/mqtt/mqtt.c deleted file mode 100644 index 47ffc6a7a..000000000 --- a/os/net/app-layer/mqtt/mqtt.c +++ /dev/null @@ -1,1496 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup mqtt-engine - * @{ - */ -/** - * \file - * Implementation of the Contiki MQTT engine - * - * \author - * Texas Instruments - */ -/*---------------------------------------------------------------------------*/ -#include "mqtt.h" -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "sys/pt.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "dev/leds.h" - -#include "tcp-socket.h" - -#include "lib/assert.h" -#include "lib/list.h" -#include "sys/cc.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -typedef enum { - MQTT_FHDR_MSG_TYPE_CONNECT = 0x10, - MQTT_FHDR_MSG_TYPE_CONNACK = 0x20, - MQTT_FHDR_MSG_TYPE_PUBLISH = 0x30, - MQTT_FHDR_MSG_TYPE_PUBACK = 0x40, - MQTT_FHDR_MSG_TYPE_PUBREC = 0x50, - MQTT_FHDR_MSG_TYPE_PUBREL = 0x60, - MQTT_FHDR_MSG_TYPE_PUBCOMP = 0x70, - MQTT_FHDR_MSG_TYPE_SUBSCRIBE = 0x80, - MQTT_FHDR_MSG_TYPE_SUBACK = 0x90, - MQTT_FHDR_MSG_TYPE_UNSUBSCRIBE = 0xA0, - MQTT_FHDR_MSG_TYPE_UNSUBACK = 0xB0, - MQTT_FHDR_MSG_TYPE_PINGREQ = 0xC0, - MQTT_FHDR_MSG_TYPE_PINGRESP = 0xD0, - MQTT_FHDR_MSG_TYPE_DISCONNECT = 0xE0, - - MQTT_FHDR_DUP_FLAG = 0x08, - - MQTT_FHDR_QOS_LEVEL_0 = 0x00, - MQTT_FHDR_QOS_LEVEL_1 = 0x02, - MQTT_FHDR_QOS_LEVEL_2 = 0x04, - - MQTT_FHDR_RETAIN_FLAG = 0x01, -} mqtt_fhdr_fields_t; -/*---------------------------------------------------------------------------*/ -typedef enum { - MQTT_VHDR_USERNAME_FLAG = 0x80, - MQTT_VHDR_PASSWORD_FLAG = 0x40, - - MQTT_VHDR_WILL_RETAIN_FLAG = 0x20, - MQTT_VHDR_WILL_QOS_LEVEL_0 = 0x00, - MQTT_VHDR_WILL_QOS_LEVEL_1 = 0x08, - MQTT_VHDR_WILL_QOS_LEVEL_2 = 0x10, - - MQTT_VHDR_WILL_FLAG = 0x04, - MQTT_VHDR_CLEAN_SESSION_FLAG = 0x02, -} mqtt_vhdr_conn_fields_t; -/*---------------------------------------------------------------------------*/ -typedef enum { - MQTT_VHDR_CONN_ACCEPTED, - MQTT_VHDR_CONN_REJECTED_PROTOCOL, - MQTT_VHDR_CONN_REJECTED_IDENTIFIER, - MQTT_VHDR_CONN_REJECTED_UNAVAILABLE, - MQTT_VHDR_CONN_REJECTED_BAD_USER_PASS, - MQTT_VHDR_CONN_REJECTED_UNAUTHORIZED, -} mqtt_vhdr_connack_fields_t; -/*---------------------------------------------------------------------------*/ -#define MQTT_CONNECT_VHDR_FLAGS_SIZE 12 - -#define MQTT_STRING_LEN_SIZE 2 -#define MQTT_MID_SIZE 2 -#define MQTT_QOS_SIZE 1 -/*---------------------------------------------------------------------------*/ -#define RESPONSE_WAIT_TIMEOUT (CLOCK_SECOND * 10) -/*---------------------------------------------------------------------------*/ -#define INCREMENT_MID(conn) (conn)->mid_counter += 2 -#define MQTT_STRING_LENGTH(s) (((s)->length) == 0 ? 0 : (MQTT_STRING_LEN_SIZE + (s)->length)) -/*---------------------------------------------------------------------------*/ -/* Protothread send macros */ -#define PT_MQTT_WRITE_BYTES(conn, data, len) \ - conn->out_write_pos = 0; \ - while(write_bytes(conn, data, len)) { \ - PT_WAIT_UNTIL(pt, (conn)->out_buffer_sent); \ - } - -#define PT_MQTT_WRITE_BYTE(conn, data) \ - while(write_byte(conn, data)) { \ - PT_WAIT_UNTIL(pt, (conn)->out_buffer_sent); \ - } -/*---------------------------------------------------------------------------*/ -/* - * Sends the continue send event and wait for that event. - * - * The reason we cannot use PROCESS_PAUSE() is since we would risk loosing any - * events posted during the sending process. - */ -#define PT_MQTT_WAIT_SEND() \ - do { \ - if (PROCESS_ERR_OK == \ - process_post(PROCESS_CURRENT(), mqtt_continue_send_event, NULL)) { \ - do { \ - PROCESS_WAIT_EVENT(); \ - if(ev == mqtt_abort_now_event) { \ - conn->state = MQTT_CONN_STATE_ABORT_IMMEDIATE; \ - PT_INIT(&conn->out_proto_thread); \ - process_post(PROCESS_CURRENT(), ev, data); \ - } else if(ev >= mqtt_event_min && ev <= mqtt_event_max) { \ - process_post(PROCESS_CURRENT(), ev, data); \ - } \ - } while (ev != mqtt_continue_send_event); \ - } \ - } while(0) -/*---------------------------------------------------------------------------*/ -static process_event_t mqtt_do_connect_tcp_event; -static process_event_t mqtt_do_connect_mqtt_event; -static process_event_t mqtt_do_disconnect_mqtt_event; -static process_event_t mqtt_do_subscribe_event; -static process_event_t mqtt_do_unsubscribe_event; -static process_event_t mqtt_do_publish_event; -static process_event_t mqtt_do_pingreq_event; -static process_event_t mqtt_continue_send_event; -static process_event_t mqtt_abort_now_event; -process_event_t mqtt_update_event; - -/* - * Min and Max event numbers we want to acknowledge while we're in the process - * of doing something else. continue_send does not count, therefore must be - * allocated last - */ -static process_event_t mqtt_event_min; -static process_event_t mqtt_event_max; -/*---------------------------------------------------------------------------*/ -/* Prototypes */ -static int -tcp_input(struct tcp_socket *s, void *ptr, const uint8_t *input_data_ptr, - int input_data_len); - -static void tcp_event(struct tcp_socket *s, void *ptr, - tcp_socket_event_t event); - -static void reset_packet(struct mqtt_in_packet *packet); -/*---------------------------------------------------------------------------*/ -LIST(mqtt_conn_list); -/*---------------------------------------------------------------------------*/ -PROCESS(mqtt_process, "MQTT process"); -/*---------------------------------------------------------------------------*/ -static void -call_event(struct mqtt_connection *conn, - mqtt_event_t event, - void *data) -{ - conn->event_callback(conn, event, data); - process_post(conn->app_process, mqtt_update_event, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -reset_defaults(struct mqtt_connection *conn) -{ - conn->mid_counter = 1; - PT_INIT(&conn->out_proto_thread); - conn->waiting_for_pingresp = 0; - - reset_packet(&conn->in_packet); - conn->out_buffer_sent = 0; -} -/*---------------------------------------------------------------------------*/ -static void -abort_connection(struct mqtt_connection *conn) -{ - conn->out_buffer_ptr = conn->out_buffer; - conn->out_queue_full = 0; - - /* Reset outgoing packet */ - memset(&conn->out_packet, 0, sizeof(conn->out_packet)); - - tcp_socket_close(&conn->socket); - tcp_socket_unregister(&conn->socket); - - memset(&conn->socket, 0, sizeof(conn->socket)); - - conn->state = MQTT_CONN_STATE_NOT_CONNECTED; -} -/*---------------------------------------------------------------------------*/ -static void -connect_tcp(struct mqtt_connection *conn) -{ - conn->state = MQTT_CONN_STATE_TCP_CONNECTING; - - reset_defaults(conn); - tcp_socket_register(&(conn->socket), - conn, - conn->in_buffer, - MQTT_TCP_INPUT_BUFF_SIZE, - conn->out_buffer, - MQTT_TCP_OUTPUT_BUFF_SIZE, - tcp_input, - tcp_event); - tcp_socket_connect(&(conn->socket), &(conn->server_ip), conn->server_port); -} -/*---------------------------------------------------------------------------*/ -static void -disconnect_tcp(struct mqtt_connection *conn) -{ - conn->state = MQTT_CONN_STATE_DISCONNECTING; - tcp_socket_close(&(conn->socket)); - tcp_socket_unregister(&conn->socket); - - memset(&conn->socket, 0, sizeof(conn->socket)); -} -/*---------------------------------------------------------------------------*/ -static void -send_out_buffer(struct mqtt_connection *conn) -{ - if(conn->out_buffer_ptr - conn->out_buffer == 0) { - conn->out_buffer_sent = 1; - return; - } - conn->out_buffer_sent = 0; - - DBG("MQTT - (send_out_buffer) Space used in buffer: %i\n", - conn->out_buffer_ptr - conn->out_buffer); - - tcp_socket_send(&conn->socket, conn->out_buffer, - conn->out_buffer_ptr - conn->out_buffer); -} -/*---------------------------------------------------------------------------*/ -static void -string_to_mqtt_string(struct mqtt_string *mqtt_string, char *string) -{ - if(mqtt_string == NULL) { - return; - } - mqtt_string->string = string; - - if(string != NULL) { - mqtt_string->length = strlen(string); - } else { - mqtt_string->length = 0; - } -} -/*---------------------------------------------------------------------------*/ -static int -write_byte(struct mqtt_connection *conn, uint8_t data) -{ - DBG("MQTT - (write_byte) buff_size: %i write: '%02X'\n", - &conn->out_buffer[MQTT_TCP_OUTPUT_BUFF_SIZE] - conn->out_buffer_ptr, - data); - - if(&conn->out_buffer[MQTT_TCP_OUTPUT_BUFF_SIZE] - conn->out_buffer_ptr == 0) { - send_out_buffer(conn); - return 1; - } - - *conn->out_buffer_ptr = data; - conn->out_buffer_ptr++; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -write_bytes(struct mqtt_connection *conn, uint8_t *data, uint16_t len) -{ - uint16_t write_bytes; - write_bytes = - MIN(&conn->out_buffer[MQTT_TCP_OUTPUT_BUFF_SIZE] - conn->out_buffer_ptr, - len - conn->out_write_pos); - - memcpy(conn->out_buffer_ptr, &data[conn->out_write_pos], write_bytes); - conn->out_write_pos += write_bytes; - conn->out_buffer_ptr += write_bytes; - - DBG("MQTT - (write_bytes) len: %u write_pos: %lu\n", len, - conn->out_write_pos); - - if(len - conn->out_write_pos == 0) { - conn->out_write_pos = 0; - return 0; - } else { - send_out_buffer(conn); - return len - conn->out_write_pos; - } -} -/*---------------------------------------------------------------------------*/ -static void -encode_remaining_length(uint8_t *remaining_length, - uint8_t *remaining_length_bytes, - uint32_t length) -{ - uint8_t digit; - - DBG("MQTT - Encoding length %lu\n", length); - - *remaining_length_bytes = 0; - do { - digit = length % 128; - length = length / 128; - if(length > 0) { - digit = digit | 0x80; - } - - remaining_length[*remaining_length_bytes] = digit; - (*remaining_length_bytes)++; - DBG("MQTT - Encode len digit '%u' length '%lu'\n", digit, length); - } while(length > 0 && *remaining_length_bytes < 5); - DBG("MQTT - remaining_length_bytes %u\n", *remaining_length_bytes); -} -/*---------------------------------------------------------------------------*/ -static void -keep_alive_callback(void *ptr) -{ - struct mqtt_connection *conn = ptr; - - DBG("MQTT - (keep_alive_callback) Called!\n"); - - /* The flag is set when the PINGREQ has been sent */ - if(conn->waiting_for_pingresp) { - PRINTF("MQTT - Disconnect due to no PINGRESP from broker.\n"); - disconnect_tcp(conn); - return; - } - - process_post(&mqtt_process, mqtt_do_pingreq_event, conn); -} -/*---------------------------------------------------------------------------*/ -static void -reset_packet(struct mqtt_in_packet *packet) -{ - memset(packet, 0, sizeof(struct mqtt_in_packet)); - packet->remaining_multiplier = 1; -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(connect_pt(struct pt *pt, struct mqtt_connection *conn)) -{ - PT_BEGIN(pt); - - DBG("MQTT - Sending CONNECT message...\n"); - - /* Set up FHDR */ - conn->out_packet.fhdr = MQTT_FHDR_MSG_TYPE_CONNECT; - conn->out_packet.remaining_length = 0; - conn->out_packet.remaining_length += MQTT_CONNECT_VHDR_FLAGS_SIZE; - conn->out_packet.remaining_length += MQTT_STRING_LENGTH(&conn->client_id); - conn->out_packet.remaining_length += MQTT_STRING_LENGTH(&conn->credentials.username); - conn->out_packet.remaining_length += MQTT_STRING_LENGTH(&conn->credentials.password); - conn->out_packet.remaining_length += MQTT_STRING_LENGTH(&conn->will.topic); - conn->out_packet.remaining_length += MQTT_STRING_LENGTH(&conn->will.message); - encode_remaining_length(conn->out_packet.remaining_length_enc, - &conn->out_packet.remaining_length_enc_bytes, - conn->out_packet.remaining_length); - if(conn->out_packet.remaining_length_enc_bytes > 4) { - call_event(conn, MQTT_EVENT_PROTOCOL_ERROR, NULL); - PRINTF("MQTT - Error, remaining length > 4 bytes\n"); - PT_EXIT(pt); - } - - /* Write Fixed Header */ - PT_MQTT_WRITE_BYTE(conn, conn->out_packet.fhdr); - PT_MQTT_WRITE_BYTES(conn, - conn->out_packet.remaining_length_enc, - conn->out_packet.remaining_length_enc_bytes); - PT_MQTT_WRITE_BYTE(conn, 0); - PT_MQTT_WRITE_BYTE(conn, 6); - PT_MQTT_WRITE_BYTES(conn, (uint8_t *)MQTT_PROTOCOL_NAME, 6); - PT_MQTT_WRITE_BYTE(conn, MQTT_PROTOCOL_VERSION); - PT_MQTT_WRITE_BYTE(conn, conn->connect_vhdr_flags); - PT_MQTT_WRITE_BYTE(conn, (conn->keep_alive >> 8)); - PT_MQTT_WRITE_BYTE(conn, (conn->keep_alive & 0x00FF)); - PT_MQTT_WRITE_BYTE(conn, conn->client_id.length >> 8); - PT_MQTT_WRITE_BYTE(conn, conn->client_id.length & 0x00FF); - PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->client_id.string, - conn->client_id.length); - if(conn->connect_vhdr_flags & MQTT_VHDR_WILL_FLAG) { - PT_MQTT_WRITE_BYTE(conn, conn->will.topic.length >> 8); - PT_MQTT_WRITE_BYTE(conn, conn->will.topic.length & 0x00FF); - PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->will.topic.string, - conn->will.topic.length); - PT_MQTT_WRITE_BYTE(conn, conn->will.message.length >> 8); - PT_MQTT_WRITE_BYTE(conn, conn->will.message.length & 0x00FF); - PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->will.message.string, - conn->will.message.length); - DBG("MQTT - Setting will topic to '%s' %u bytes and message to '%s' %u bytes\n", - conn->will.topic.string, - conn->will.topic.length, - conn->will.message.string, - conn->will.message.length); - } - if(conn->connect_vhdr_flags & MQTT_VHDR_USERNAME_FLAG) { - PT_MQTT_WRITE_BYTE(conn, conn->credentials.username.length >> 8); - PT_MQTT_WRITE_BYTE(conn, conn->credentials.username.length & 0x00FF); - PT_MQTT_WRITE_BYTES(conn, - (uint8_t *)conn->credentials.username.string, - conn->credentials.username.length); - } - if(conn->connect_vhdr_flags & MQTT_VHDR_PASSWORD_FLAG) { - PT_MQTT_WRITE_BYTE(conn, conn->credentials.password.length >> 8); - PT_MQTT_WRITE_BYTE(conn, conn->credentials.password.length & 0x00FF); - PT_MQTT_WRITE_BYTES(conn, - (uint8_t *)conn->credentials.password.string, - conn->credentials.password.length); - } - - /* Send out buffer */ - send_out_buffer(conn); - conn->state = MQTT_CONN_STATE_CONNECTING_TO_BROKER; - - timer_set(&conn->t, RESPONSE_WAIT_TIMEOUT); - - /* Wait for CONNACK */ - reset_packet(&conn->in_packet); - PT_WAIT_UNTIL(pt, conn->out_packet.qos_state == MQTT_QOS_STATE_GOT_ACK || - timer_expired(&conn->t)); - if(timer_expired(&conn->t)) { - DBG("Timeout waiting for CONNACK\n"); - /* We stick to the letter of the spec here: Tear the connection down */ - mqtt_disconnect(conn); - } - reset_packet(&conn->in_packet); - - DBG("MQTT - Done sending CONNECT\n"); - -#if DEBUG_MQTT == 1 - DBG("MQTT - CONNECT message sent: \n"); - uint16_t i; - for(i = 0; i < (conn->out_buffer_ptr - conn->out_buffer); i++) { - DBG("%02X ", conn->out_buffer[i]); - } - DBG("\n"); -#endif - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(disconnect_pt(struct pt *pt, struct mqtt_connection *conn)) -{ - PT_BEGIN(pt); - - PT_MQTT_WRITE_BYTE(conn, MQTT_FHDR_MSG_TYPE_DISCONNECT); - PT_MQTT_WRITE_BYTE(conn, 0); - - send_out_buffer(conn); - - /* - * Wait a couple of seconds for a TCP ACK. We don't really need the ACK, - * we do want the TCP/IP stack to actually send this disconnect before we - * tear down the session. - */ - timer_set(&conn->t, (CLOCK_SECOND * 2)); - PT_WAIT_UNTIL(pt, conn->out_buffer_sent || timer_expired(&conn->t)); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(subscribe_pt(struct pt *pt, struct mqtt_connection *conn)) -{ - PT_BEGIN(pt); - - DBG("MQTT - Sending subscribe message! topic %s topic_length %i\n", - conn->out_packet.topic, - conn->out_packet.topic_length); - DBG("MQTT - Buffer space is %i \n", - &conn->out_buffer[MQTT_TCP_OUTPUT_BUFF_SIZE] - conn->out_buffer_ptr); - - /* Set up FHDR */ - conn->out_packet.fhdr = MQTT_FHDR_MSG_TYPE_SUBSCRIBE | MQTT_FHDR_QOS_LEVEL_1; - conn->out_packet.remaining_length = MQTT_MID_SIZE + - MQTT_STRING_LEN_SIZE + - conn->out_packet.topic_length + - MQTT_QOS_SIZE; - encode_remaining_length(conn->out_packet.remaining_length_enc, - &conn->out_packet.remaining_length_enc_bytes, - conn->out_packet.remaining_length); - if(conn->out_packet.remaining_length_enc_bytes > 4) { - call_event(conn, MQTT_EVENT_PROTOCOL_ERROR, NULL); - PRINTF("MQTT - Error, remaining length > 4 bytes\n"); - PT_EXIT(pt); - } - - /* Write Fixed Header */ - PT_MQTT_WRITE_BYTE(conn, conn->out_packet.fhdr); - PT_MQTT_WRITE_BYTES(conn, - conn->out_packet.remaining_length_enc, - conn->out_packet.remaining_length_enc_bytes); - /* Write Variable Header */ - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid >> 8)); - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid & 0x00FF)); - /* Write Payload */ - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.topic_length >> 8)); - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.topic_length & 0x00FF)); - PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->out_packet.topic, - conn->out_packet.topic_length); - PT_MQTT_WRITE_BYTE(conn, conn->out_packet.qos); - - /* Send out buffer */ - send_out_buffer(conn); - timer_set(&conn->t, RESPONSE_WAIT_TIMEOUT); - - /* Wait for SUBACK. */ - reset_packet(&conn->in_packet); - PT_WAIT_UNTIL(pt, conn->out_packet.qos_state == MQTT_QOS_STATE_GOT_ACK || - timer_expired(&conn->t)); - - if(timer_expired(&conn->t)) { - DBG("Timeout waiting for SUBACK\n"); - } - reset_packet(&conn->in_packet); - - /* This is clear after the entire transaction is complete */ - conn->out_queue_full = 0; - - DBG("MQTT - Done in send_subscribe!\n"); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(unsubscribe_pt(struct pt *pt, struct mqtt_connection *conn)) -{ - PT_BEGIN(pt); - - DBG("MQTT - Sending unsubscribe message on topic %s topic_length %i\n", - conn->out_packet.topic, - conn->out_packet.topic_length); - DBG("MQTT - Buffer space is %i \n", - &conn->out_buffer[MQTT_TCP_OUTPUT_BUFF_SIZE] - conn->out_buffer_ptr); - - /* Set up FHDR */ - conn->out_packet.fhdr = MQTT_FHDR_MSG_TYPE_UNSUBSCRIBE | - MQTT_FHDR_QOS_LEVEL_1; - conn->out_packet.remaining_length = MQTT_MID_SIZE + - MQTT_STRING_LEN_SIZE + - conn->out_packet.topic_length; - encode_remaining_length(conn->out_packet.remaining_length_enc, - &conn->out_packet.remaining_length_enc_bytes, - conn->out_packet.remaining_length); - if(conn->out_packet.remaining_length_enc_bytes > 4) { - call_event(conn, MQTT_EVENT_PROTOCOL_ERROR, NULL); - PRINTF("MQTT - Error, remaining length > 4 bytes\n"); - PT_EXIT(pt); - } - - /* Write Fixed Header */ - PT_MQTT_WRITE_BYTE(conn, conn->out_packet.fhdr); - PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->out_packet.remaining_length_enc, - conn->out_packet.remaining_length_enc_bytes); - /* Write Variable Header */ - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid >> 8)); - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid & 0x00FF)); - /* Write Payload */ - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.topic_length >> 8)); - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.topic_length & 0x00FF)); - PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->out_packet.topic, - conn->out_packet.topic_length); - - /* Send out buffer */ - send_out_buffer(conn); - timer_set(&conn->t, RESPONSE_WAIT_TIMEOUT); - - /* Wait for UNSUBACK */ - reset_packet(&conn->in_packet); - PT_WAIT_UNTIL(pt, conn->out_packet.qos_state == MQTT_QOS_STATE_GOT_ACK || - timer_expired(&conn->t)); - - if(timer_expired(&conn->t)) { - DBG("Timeout waiting for UNSUBACK\n"); - } - - reset_packet(&conn->in_packet); - - /* This is clear after the entire transaction is complete */ - conn->out_queue_full = 0; - - DBG("MQTT - Done writing subscribe message to out buffer!\n"); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(publish_pt(struct pt *pt, struct mqtt_connection *conn)) -{ - PT_BEGIN(pt); - - DBG("MQTT - Sending publish message! topic %s topic_length %i\n", - conn->out_packet.topic, - conn->out_packet.topic_length); - DBG("MQTT - Buffer space is %i \n", - &conn->out_buffer[MQTT_TCP_OUTPUT_BUFF_SIZE] - conn->out_buffer_ptr); - - /* Set up FHDR */ - conn->out_packet.fhdr = MQTT_FHDR_MSG_TYPE_PUBLISH | - conn->out_packet.qos << 1; - if(conn->out_packet.retain == MQTT_RETAIN_ON) { - conn->out_packet.fhdr |= MQTT_FHDR_RETAIN_FLAG; - } - conn->out_packet.remaining_length = MQTT_STRING_LEN_SIZE + - conn->out_packet.topic_length + - conn->out_packet.payload_size; - if(conn->out_packet.qos > MQTT_QOS_LEVEL_0) { - conn->out_packet.remaining_length += MQTT_MID_SIZE; - } - encode_remaining_length(conn->out_packet.remaining_length_enc, - &conn->out_packet.remaining_length_enc_bytes, - conn->out_packet.remaining_length); - if(conn->out_packet.remaining_length_enc_bytes > 4) { - call_event(conn, MQTT_EVENT_PROTOCOL_ERROR, NULL); - PRINTF("MQTT - Error, remaining length > 4 bytes\n"); - PT_EXIT(pt); - } - - /* Write Fixed Header */ - PT_MQTT_WRITE_BYTE(conn, conn->out_packet.fhdr); - PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->out_packet.remaining_length_enc, - conn->out_packet.remaining_length_enc_bytes); - /* Write Variable Header */ - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.topic_length >> 8)); - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.topic_length & 0x00FF)); - PT_MQTT_WRITE_BYTES(conn, (uint8_t *)conn->out_packet.topic, - conn->out_packet.topic_length); - if(conn->out_packet.qos > MQTT_QOS_LEVEL_0) { - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid >> 8)); - PT_MQTT_WRITE_BYTE(conn, (conn->out_packet.mid & 0x00FF)); - } - /* Write Payload */ - PT_MQTT_WRITE_BYTES(conn, - conn->out_packet.payload, - conn->out_packet.payload_size); - - send_out_buffer(conn); - timer_set(&conn->t, RESPONSE_WAIT_TIMEOUT); - - /* - * If QoS is zero then wait until the message has been sent, since there is - * no ACK to wait for. - * - * Also notify the app will not be notified via PUBACK or PUBCOMP - */ - if(conn->out_packet.qos == 0) { - process_post(conn->app_process, mqtt_update_event, NULL); - } else if(conn->out_packet.qos == 1) { - /* Wait for PUBACK */ - reset_packet(&conn->in_packet); - PT_WAIT_UNTIL(pt, conn->out_packet.qos_state == MQTT_QOS_STATE_GOT_ACK || - timer_expired(&conn->t)); - if(timer_expired(&conn->t)) { - DBG("Timeout waiting for PUBACK\n"); - } - if(conn->in_packet.mid != conn->out_packet.mid) { - DBG("MQTT - Warning, got PUBACK with none matching MID. Currently there " - "is no support for several concurrent PUBLISH messages.\n"); - } - } else if(conn->out_packet.qos == 2) { - DBG("MQTT - QoS not implemented yet.\n"); - /* Should wait for PUBREC, send PUBREL and then wait for PUBCOMP */ - } - - reset_packet(&conn->in_packet); - - /* This is clear after the entire transaction is complete */ - conn->out_queue_full = 0; - - DBG("MQTT - Publish Enqueued\n"); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(pingreq_pt(struct pt *pt, struct mqtt_connection *conn)) -{ - PT_BEGIN(pt); - - DBG("MQTT - Sending PINGREQ\n"); - - /* Write Fixed Header */ - PT_MQTT_WRITE_BYTE(conn, MQTT_FHDR_MSG_TYPE_PINGREQ); - PT_MQTT_WRITE_BYTE(conn, 0); - - send_out_buffer(conn); - - /* Start timeout for reply. */ - conn->waiting_for_pingresp = 1; - - /* Wait for PINGRESP or timeout */ - reset_packet(&conn->in_packet); - timer_set(&conn->t, RESPONSE_WAIT_TIMEOUT); - - PT_WAIT_UNTIL(pt, conn->in_packet.packet_received || timer_expired(&conn->t)); - - reset_packet(&conn->in_packet); - - conn->waiting_for_pingresp = 0; - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static void -handle_connack(struct mqtt_connection *conn) -{ - DBG("MQTT - Got CONNACK\n"); - - if(conn->in_packet.payload[1] != 0) { - PRINTF("MQTT - Connection refused with Return Code %i\n", - conn->in_packet.payload[1]); - call_event(conn, - MQTT_EVENT_CONNECTION_REFUSED_ERROR, - &conn->in_packet.payload[1]); - abort_connection(conn); - return; - } - - conn->out_packet.qos_state = MQTT_QOS_STATE_GOT_ACK; - - ctimer_set(&conn->keep_alive_timer, conn->keep_alive * CLOCK_SECOND, - keep_alive_callback, conn); - - /* Always reset packet before callback since it might be used directly */ - conn->state = MQTT_CONN_STATE_CONNECTED_TO_BROKER; - call_event(conn, MQTT_EVENT_CONNECTED, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -handle_pingresp(struct mqtt_connection *conn) -{ - DBG("MQTT - Got PINGRESP\n"); -} -/*---------------------------------------------------------------------------*/ -static void -handle_suback(struct mqtt_connection *conn) -{ - struct mqtt_suback_event suback_event; - - DBG("MQTT - Got SUBACK\n"); - - /* Only accept SUBACKS with X topic QoS response, assume 1 */ - if(conn->in_packet.remaining_length > MQTT_MID_SIZE + - MQTT_MAX_TOPICS_PER_SUBSCRIBE * MQTT_QOS_SIZE) { - DBG("MQTT - Error, SUBACK with > 1 topic, not supported.\n"); - } - - conn->out_packet.qos_state = MQTT_QOS_STATE_GOT_ACK; - - suback_event.mid = (conn->in_packet.payload[0] << 8) | - (conn->in_packet.payload[1]); - suback_event.qos_level = conn->in_packet.payload[2]; - conn->in_packet.mid = suback_event.mid; - - if(conn->in_packet.mid != conn->out_packet.mid) { - DBG("MQTT - Warning, got SUBACK with none matching MID. Currently there is" - "no support for several concurrent SUBSCRIBE messages.\n"); - } - - /* Always reset packet before callback since it might be used directly */ - call_event(conn, MQTT_EVENT_SUBACK, &suback_event); -} -/*---------------------------------------------------------------------------*/ -static void -handle_unsuback(struct mqtt_connection *conn) -{ - DBG("MQTT - Got UNSUBACK\n"); - - conn->out_packet.qos_state = MQTT_QOS_STATE_GOT_ACK; - conn->in_packet.mid = (conn->in_packet.payload[0] << 8) | - (conn->in_packet.payload[1]); - - if(conn->in_packet.mid != conn->out_packet.mid) { - DBG("MQTT - Warning, got UNSUBACK with none matching MID. Currently there is" - "no support for several concurrent UNSUBSCRIBE messages.\n"); - } - - call_event(conn, MQTT_EVENT_UNSUBACK, &conn->in_packet.mid); -} -/*---------------------------------------------------------------------------*/ -static void -handle_puback(struct mqtt_connection *conn) -{ - DBG("MQTT - Got PUBACK\n"); - - conn->out_packet.qos_state = MQTT_QOS_STATE_GOT_ACK; - conn->in_packet.mid = (conn->in_packet.payload[0] << 8) | - (conn->in_packet.payload[1]); - - call_event(conn, MQTT_EVENT_PUBACK, &conn->in_packet.mid); -} -/*---------------------------------------------------------------------------*/ -static void -handle_publish(struct mqtt_connection *conn) -{ - DBG("MQTT - Got PUBLISH, called once per manageable chunk of message.\n"); - DBG("MQTT - Handling publish on topic '%s'\n", conn->in_publish_msg.topic); - - DBG("MQTT - This chunk is %i bytes\n", conn->in_packet.payload_pos); - - if(((conn->in_packet.fhdr & 0x09) >> 1) > 0) { - PRINTF("MQTT - Error, got incoming PUBLISH with QoS > 0, not supported atm!\n"); - } - - call_event(conn, MQTT_EVENT_PUBLISH, &conn->in_publish_msg); - - if(conn->in_publish_msg.first_chunk == 1) { - conn->in_publish_msg.first_chunk = 0; - } - - /* If this is the last time handle_publish will be called, reset packet. */ - if(conn->in_publish_msg.payload_left == 0) { - - /* Check for QoS and initiate the reply, do not rely on the data in the - * in_packet being untouched. */ - - DBG("MQTT - (handle_publish) resetting packet.\n"); - reset_packet(&conn->in_packet); - } -} -/*---------------------------------------------------------------------------*/ -static void -parse_publish_vhdr(struct mqtt_connection *conn, - uint32_t *pos, - const uint8_t *input_data_ptr, - int input_data_len) -{ - uint16_t copy_bytes; - - /* Read out topic length */ - if(conn->in_packet.topic_len_received == 0) { - conn->in_packet.topic_pos = 0; - conn->in_packet.topic_len = (input_data_ptr[(*pos)++] << 8); - conn->in_packet.byte_counter++; - if(*pos >= input_data_len) { - return; - } - conn->in_packet.topic_len |= input_data_ptr[(*pos)++]; - conn->in_packet.byte_counter++; - conn->in_packet.topic_len_received = 1; - /* Abort if topic is longer than our topic buffer */ - if(conn->in_packet.topic_len > MQTT_MAX_TOPIC_LENGTH) { - DBG("MQTT - topic too long %u/%u\n", conn->in_packet.topic_len, MQTT_MAX_TOPIC_LENGTH); - return; - } - DBG("MQTT - Read PUBLISH topic len %i\n", conn->in_packet.topic_len); - /* WARNING: Check here if TOPIC fits in payload area, otherwise error */ - } - - /* Read out topic */ - if(conn->in_packet.topic_len_received == 1 && - conn->in_packet.topic_received == 0) { - copy_bytes = MIN(conn->in_packet.topic_len - conn->in_packet.topic_pos, - input_data_len - *pos); - DBG("MQTT - topic_pos: %i copy_bytes: %i", conn->in_packet.topic_pos, - copy_bytes); - memcpy(&conn->in_publish_msg.topic[conn->in_packet.topic_pos], - &input_data_ptr[*pos], - copy_bytes); - (*pos) += copy_bytes; - conn->in_packet.byte_counter += copy_bytes; - conn->in_packet.topic_pos += copy_bytes; - - if(conn->in_packet.topic_len - conn->in_packet.topic_pos == 0) { - DBG("MQTT - Got topic '%s'", conn->in_publish_msg.topic); - conn->in_packet.topic_received = 1; - conn->in_publish_msg.topic[conn->in_packet.topic_pos] = '\0'; - conn->in_publish_msg.payload_length = - conn->in_packet.remaining_length - conn->in_packet.topic_len - 2; - conn->in_publish_msg.payload_left = conn->in_publish_msg.payload_length; - } - - /* Set this once per incomming publish message */ - conn->in_publish_msg.first_chunk = 1; - } -} -/*---------------------------------------------------------------------------*/ -static int -tcp_input(struct tcp_socket *s, - void *ptr, - const uint8_t *input_data_ptr, - int input_data_len) -{ - struct mqtt_connection *conn = ptr; - uint32_t pos = 0; - uint32_t copy_bytes = 0; - uint8_t byte; - - if(input_data_len == 0) { - return 0; - } - - if(conn->in_packet.packet_received) { - reset_packet(&conn->in_packet); - } - - DBG("tcp_input with %i bytes of data:\n", input_data_len); - - /* Read the fixed header field, if we do not have it */ - if(!conn->in_packet.fhdr) { - conn->in_packet.fhdr = input_data_ptr[pos++]; - conn->in_packet.byte_counter++; - - DBG("MQTT - Read VHDR '%02X'\n", conn->in_packet.fhdr); - - if(pos >= input_data_len) { - return 0; - } - } - - /* Read the Remaining Length field, if we do not have it */ - if(!conn->in_packet.has_remaining_length) { - do { - if(pos >= input_data_len) { - return 0; - } - - byte = input_data_ptr[pos++]; - conn->in_packet.byte_counter++; - conn->in_packet.remaining_length_bytes++; - DBG("MQTT - Read Remaining Length byte\n"); - - if(conn->in_packet.byte_counter > 5) { - call_event(conn, MQTT_EVENT_ERROR, NULL); - DBG("Received more then 4 byte 'remaining lenght'."); - return 0; - } - - conn->in_packet.remaining_length += - (byte & 127) * conn->in_packet.remaining_multiplier; - conn->in_packet.remaining_multiplier *= 128; - } while((byte & 128) != 0); - - DBG("MQTT - Finished reading remaining length byte\n"); - conn->in_packet.has_remaining_length = 1; - } - - /* - * Check for unsupported payload length. Will read all incoming data from the - * server in any case and then reset the packet. - * - * TODO: Decide if we, for example, want to disconnect instead. - */ - if((conn->in_packet.remaining_length > MQTT_INPUT_BUFF_SIZE) && - (conn->in_packet.fhdr & 0xF0) != MQTT_FHDR_MSG_TYPE_PUBLISH) { - - PRINTF("MQTT - Error, unsupported payload size for non-PUBLISH message\n"); - - conn->in_packet.byte_counter += input_data_len; - if(conn->in_packet.byte_counter >= - (MQTT_FHDR_SIZE + conn->in_packet.remaining_length)) { - conn->in_packet.packet_received = 1; - } - return 0; - } - - /* - * Supported payload, reads out both VHDR and Payload of all packets. - * - * Note: There will always be at least one byte left to read when we enter - * this loop. - */ - while(conn->in_packet.byte_counter < - (MQTT_FHDR_SIZE + conn->in_packet.remaining_length)) { - - if((conn->in_packet.fhdr & 0xF0) == MQTT_FHDR_MSG_TYPE_PUBLISH && - conn->in_packet.topic_received == 0) { - parse_publish_vhdr(conn, &pos, input_data_ptr, input_data_len); - } - - /* Read in as much as we can into the packet payload */ - copy_bytes = MIN(input_data_len - pos, - MQTT_INPUT_BUFF_SIZE - conn->in_packet.payload_pos); - DBG("- Copied %lu payload bytes\n", copy_bytes); - memcpy(&conn->in_packet.payload[conn->in_packet.payload_pos], - &input_data_ptr[pos], - copy_bytes); - conn->in_packet.byte_counter += copy_bytes; - conn->in_packet.payload_pos += copy_bytes; - pos += copy_bytes; - - uint8_t i; - DBG("MQTT - Copied bytes: \n"); - for(i = 0; i < copy_bytes; i++) { - DBG("%02X ", conn->in_packet.payload[i]); - } - DBG("\n"); - - /* Full buffer, shall only happen to PUBLISH messages. */ - if(MQTT_INPUT_BUFF_SIZE - conn->in_packet.payload_pos == 0) { - conn->in_publish_msg.payload_chunk = conn->in_packet.payload; - conn->in_publish_msg.payload_chunk_length = MQTT_INPUT_BUFF_SIZE; - conn->in_publish_msg.payload_left -= MQTT_INPUT_BUFF_SIZE; - - handle_publish(conn); - - conn->in_publish_msg.payload_chunk = conn->in_packet.payload; - conn->in_packet.payload_pos = 0; - } - - if(pos >= input_data_len && - (conn->in_packet.byte_counter < (MQTT_FHDR_SIZE + conn->in_packet.remaining_length))) { - return 0; - } - } - - /* Debug information */ - DBG("\n"); - /* Take care of input */ - DBG("MQTT - Finished reading packet!\n"); - /* What to return? */ - DBG("MQTT - total data was %i bytes of data. \n", - (MQTT_FHDR_SIZE + conn->in_packet.remaining_length)); - - /* Handle packet here. */ - switch(conn->in_packet.fhdr & 0xF0) { - case MQTT_FHDR_MSG_TYPE_CONNACK: - handle_connack(conn); - break; - case MQTT_FHDR_MSG_TYPE_PUBLISH: - /* This is the only or the last chunk of publish payload */ - conn->in_publish_msg.payload_chunk = conn->in_packet.payload; - conn->in_publish_msg.payload_chunk_length = conn->in_packet.payload_pos; - conn->in_publish_msg.payload_left = 0; - handle_publish(conn); - break; - case MQTT_FHDR_MSG_TYPE_PUBACK: - handle_puback(conn); - break; - case MQTT_FHDR_MSG_TYPE_SUBACK: - handle_suback(conn); - break; - case MQTT_FHDR_MSG_TYPE_UNSUBACK: - handle_unsuback(conn); - break; - case MQTT_FHDR_MSG_TYPE_PINGRESP: - handle_pingresp(conn); - break; - - /* QoS 2 not implemented yet */ - case MQTT_FHDR_MSG_TYPE_PUBREC: - case MQTT_FHDR_MSG_TYPE_PUBREL: - case MQTT_FHDR_MSG_TYPE_PUBCOMP: - call_event(conn, MQTT_EVENT_NOT_IMPLEMENTED_ERROR, NULL); - PRINTF("MQTT - Got unhandled MQTT Message Type '%i'", - (conn->in_packet.fhdr & 0xF0)); - break; - - default: - /* All server-only message */ - PRINTF("MQTT - Got MQTT Message Type '%i'", (conn->in_packet.fhdr & 0xF0)); - break; - } - - conn->in_packet.packet_received = 1; - - return 0; -} -/*---------------------------------------------------------------------------*/ -/* - * Handles TCP events from Simple TCP - */ -static void -tcp_event(struct tcp_socket *s, void *ptr, tcp_socket_event_t event) -{ - struct mqtt_connection *conn = ptr; - - /* Take care of event */ - switch(event) { - - /* Fall through to manage different disconnect event the same way. */ - case TCP_SOCKET_CLOSED: - case TCP_SOCKET_TIMEDOUT: - case TCP_SOCKET_ABORTED: { - - DBG("MQTT - Disconnected by tcp event %d\n", event); - process_post(&mqtt_process, mqtt_abort_now_event, conn); - conn->state = MQTT_CONN_STATE_NOT_CONNECTED; - ctimer_stop(&conn->keep_alive_timer); - call_event(conn, MQTT_EVENT_DISCONNECTED, &event); - abort_connection(conn); - - /* If connecting retry */ - if(conn->auto_reconnect == 1) { - connect_tcp(conn); - } - break; - } - case TCP_SOCKET_CONNECTED: { - conn->state = MQTT_CONN_STATE_TCP_CONNECTED; - conn->out_buffer_sent = 1; - - process_post(&mqtt_process, mqtt_do_connect_mqtt_event, conn); - break; - } - case TCP_SOCKET_DATA_SENT: { - DBG("MQTT - Got TCP_DATA_SENT\n"); - - if(conn->socket.output_data_len == 0) { - conn->out_buffer_sent = 1; - conn->out_buffer_ptr = conn->out_buffer; - } - - ctimer_restart(&conn->keep_alive_timer); - break; - } - - default: { - DBG("MQTT - TCP Event %d is currently not managed by the tcp event callback\n", - event); - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(mqtt_process, ev, data) -{ - static struct mqtt_connection *conn; - - PROCESS_BEGIN(); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == mqtt_abort_now_event) { - DBG("MQTT - Abort\n"); - conn = data; - conn->state = MQTT_CONN_STATE_ABORT_IMMEDIATE; - - abort_connection(conn); - } - if(ev == mqtt_do_connect_tcp_event) { - conn = data; - DBG("MQTT - Got mqtt_do_connect_tcp_event!\n"); - connect_tcp(conn); - } - if(ev == mqtt_do_connect_mqtt_event) { - conn = data; - conn->socket.output_data_max_seg = conn->max_segment_size; - DBG("MQTT - Got mqtt_do_connect_mqtt_event!\n"); - - if(conn->out_buffer_sent == 1) { - PT_INIT(&conn->out_proto_thread); - while(connect_pt(&conn->out_proto_thread, conn) < PT_EXITED && - conn->state != MQTT_CONN_STATE_ABORT_IMMEDIATE) { - PT_MQTT_WAIT_SEND(); - } - } - } - if(ev == mqtt_do_disconnect_mqtt_event) { - conn = data; - DBG("MQTT - Got mqtt_do_disconnect_mqtt_event!\n"); - - /* Send MQTT Disconnect if we are connected */ - if(conn->state == MQTT_CONN_STATE_SENDING_MQTT_DISCONNECT) { - if(conn->out_buffer_sent == 1) { - PT_INIT(&conn->out_proto_thread); - while(conn->state != MQTT_CONN_STATE_ABORT_IMMEDIATE && - disconnect_pt(&conn->out_proto_thread, conn) < PT_EXITED) { - PT_MQTT_WAIT_SEND(); - } - abort_connection(conn); - call_event(conn, MQTT_EVENT_DISCONNECTED, &ev); - } else { - process_post(&mqtt_process, mqtt_do_disconnect_mqtt_event, conn); - } - } - } - if(ev == mqtt_do_pingreq_event) { - conn = data; - DBG("MQTT - Got mqtt_do_pingreq_event!\n"); - - if(conn->out_buffer_sent == 1 && - conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) { - PT_INIT(&conn->out_proto_thread); - while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER && - pingreq_pt(&conn->out_proto_thread, conn) < PT_EXITED) { - PT_MQTT_WAIT_SEND(); - } - } - } - if(ev == mqtt_do_subscribe_event) { - conn = data; - DBG("MQTT - Got mqtt_do_subscribe_mqtt_event!\n"); - - if(conn->out_buffer_sent == 1 && - conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) { - PT_INIT(&conn->out_proto_thread); - while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER && - subscribe_pt(&conn->out_proto_thread, conn) < PT_EXITED) { - PT_MQTT_WAIT_SEND(); - } - } - } - if(ev == mqtt_do_unsubscribe_event) { - conn = data; - DBG("MQTT - Got mqtt_do_unsubscribe_mqtt_event!\n"); - - if(conn->out_buffer_sent == 1 && - conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) { - PT_INIT(&conn->out_proto_thread); - while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER && - unsubscribe_pt(&conn->out_proto_thread, conn) < PT_EXITED) { - PT_MQTT_WAIT_SEND(); - } - } - } - if(ev == mqtt_do_publish_event) { - conn = data; - DBG("MQTT - Got mqtt_do_publish_mqtt_event!\n"); - - if(conn->out_buffer_sent == 1 && - conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) { - PT_INIT(&conn->out_proto_thread); - while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER && - publish_pt(&conn->out_proto_thread, conn) < PT_EXITED) { - PT_MQTT_WAIT_SEND(); - } - } - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -mqtt_init(void) -{ - static uint8_t inited = 0; - if(!inited) { - mqtt_do_connect_tcp_event = process_alloc_event(); - mqtt_event_min = mqtt_do_connect_tcp_event; - - mqtt_do_connect_mqtt_event = process_alloc_event(); - mqtt_do_disconnect_mqtt_event = process_alloc_event(); - mqtt_do_subscribe_event = process_alloc_event(); - mqtt_do_unsubscribe_event = process_alloc_event(); - mqtt_do_publish_event = process_alloc_event(); - mqtt_do_pingreq_event = process_alloc_event(); - mqtt_update_event = process_alloc_event(); - mqtt_abort_now_event = process_alloc_event(); - mqtt_event_max = mqtt_abort_now_event; - - mqtt_continue_send_event = process_alloc_event(); - - list_init(mqtt_conn_list); - process_start(&mqtt_process, NULL); - inited = 1; - } -} -/*---------------------------------------------------------------------------*/ -mqtt_status_t -mqtt_register(struct mqtt_connection *conn, struct process *app_process, - char *client_id, mqtt_event_callback_t event_callback, - uint16_t max_segment_size) -{ - if(strlen(client_id) < 1) { - return MQTT_STATUS_INVALID_ARGS_ERROR; - } - - /* Set defaults - Set all to zero to begin with */ - memset(conn, 0, sizeof(struct mqtt_connection)); - string_to_mqtt_string(&conn->client_id, client_id); - conn->event_callback = event_callback; - conn->app_process = app_process; - conn->auto_reconnect = 1; - conn->max_segment_size = max_segment_size; - reset_defaults(conn); - - mqtt_init(); - list_add(mqtt_conn_list, conn); - - DBG("MQTT - Registered successfully\n"); - - return MQTT_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -/* - * Connect to MQTT broker. - * - * N.B. Non-blocking call. - */ -mqtt_status_t -mqtt_connect(struct mqtt_connection *conn, char *host, uint16_t port, - uint16_t keep_alive) -{ - uip_ip6addr_t ip6addr; - uip_ipaddr_t *ipaddr; - ipaddr = &ip6addr; - - /* Check if we are already trying to connect */ - if(conn->state > MQTT_CONN_STATE_NOT_CONNECTED) { - return MQTT_STATUS_OK; - } - - conn->server_host = host; - conn->keep_alive = keep_alive; - conn->server_port = port; - conn->out_buffer_ptr = conn->out_buffer; - conn->out_packet.qos_state = MQTT_QOS_STATE_NO_ACK; - conn->connect_vhdr_flags |= MQTT_VHDR_CLEAN_SESSION_FLAG; - - /* convert the string IPv6 address to a numeric IPv6 address */ - if(uiplib_ip6addrconv(host, &ip6addr) == 0) { - return MQTT_STATUS_ERROR; - } - - uip_ipaddr_copy(&(conn->server_ip), ipaddr); - - /* - * Initiate the connection if the IP could be resolved. Otherwise the - * connection will be initiated when the DNS lookup is finished, in the main - * event loop. - */ - process_post(&mqtt_process, mqtt_do_connect_tcp_event, conn); - - return MQTT_STATUS_OK; -} -/*----------------------------------------------------------------------------*/ -void -mqtt_disconnect(struct mqtt_connection *conn) -{ - if(conn->state != MQTT_CONN_STATE_CONNECTED_TO_BROKER) { - return; - } - - conn->state = MQTT_CONN_STATE_SENDING_MQTT_DISCONNECT; - - process_post(&mqtt_process, mqtt_do_disconnect_mqtt_event, conn); -} -/*----------------------------------------------------------------------------*/ -mqtt_status_t -mqtt_subscribe(struct mqtt_connection *conn, uint16_t *mid, char *topic, - mqtt_qos_level_t qos_level) -{ - if(conn->state != MQTT_CONN_STATE_CONNECTED_TO_BROKER) { - return MQTT_STATUS_NOT_CONNECTED_ERROR; - } - - DBG("MQTT - Call to mqtt_subscribe...\n"); - - /* Currently don't have a queue, so only one item at a time */ - if(conn->out_queue_full) { - DBG("MQTT - Not accepted!\n"); - return MQTT_STATUS_OUT_QUEUE_FULL; - } - conn->out_queue_full = 1; - DBG("MQTT - Accepted!\n"); - - conn->out_packet.mid = INCREMENT_MID(conn); - conn->out_packet.topic = topic; - conn->out_packet.topic_length = strlen(topic); - conn->out_packet.qos = qos_level; - conn->out_packet.qos_state = MQTT_QOS_STATE_NO_ACK; - - process_post(&mqtt_process, mqtt_do_subscribe_event, conn); - return MQTT_STATUS_OK; -} -/*----------------------------------------------------------------------------*/ -mqtt_status_t -mqtt_unsubscribe(struct mqtt_connection *conn, uint16_t *mid, char *topic) -{ - if(conn->state != MQTT_CONN_STATE_CONNECTED_TO_BROKER) { - return MQTT_STATUS_NOT_CONNECTED_ERROR; - } - - DBG("MQTT - Call to mqtt_unsubscribe...\n"); - /* Currently don't have a queue, so only one item at a time */ - if(conn->out_queue_full) { - DBG("MQTT - Not accepted!\n"); - return MQTT_STATUS_OUT_QUEUE_FULL; - } - conn->out_queue_full = 1; - DBG("MQTT - Accepted!\n"); - - conn->out_packet.mid = INCREMENT_MID(conn); - conn->out_packet.topic = topic; - conn->out_packet.topic_length = strlen(topic); - conn->out_packet.qos_state = MQTT_QOS_STATE_NO_ACK; - - process_post(&mqtt_process, mqtt_do_unsubscribe_event, conn); - return MQTT_STATUS_OK; -} -/*----------------------------------------------------------------------------*/ -mqtt_status_t -mqtt_publish(struct mqtt_connection *conn, uint16_t *mid, char *topic, - uint8_t *payload, uint32_t payload_size, - mqtt_qos_level_t qos_level, mqtt_retain_t retain) -{ - if(conn->state != MQTT_CONN_STATE_CONNECTED_TO_BROKER) { - return MQTT_STATUS_NOT_CONNECTED_ERROR; - } - - DBG("MQTT - Call to mqtt_publish...\n"); - - /* Currently don't have a queue, so only one item at a time */ - if(conn->out_queue_full) { - DBG("MQTT - Not accepted!\n"); - return MQTT_STATUS_OUT_QUEUE_FULL; - } - conn->out_queue_full = 1; - DBG("MQTT - Accepted!\n"); - - conn->out_packet.mid = INCREMENT_MID(conn); - conn->out_packet.retain = retain; - conn->out_packet.topic = topic; - conn->out_packet.topic_length = strlen(topic); - conn->out_packet.payload = payload; - conn->out_packet.payload_size = payload_size; - conn->out_packet.qos = qos_level; - conn->out_packet.qos_state = MQTT_QOS_STATE_NO_ACK; - - process_post(&mqtt_process, mqtt_do_publish_event, conn); - return MQTT_STATUS_OK; -} -/*----------------------------------------------------------------------------*/ -void -mqtt_set_username_password(struct mqtt_connection *conn, char *username, - char *password) -{ - /* Set strings, NULL string will simply set length to zero */ - string_to_mqtt_string(&conn->credentials.username, username); - string_to_mqtt_string(&conn->credentials.password, password); - - /* Set CONNECT VHDR flags */ - if(username != NULL) { - conn->connect_vhdr_flags |= MQTT_VHDR_USERNAME_FLAG; - } else { - conn->connect_vhdr_flags &= ~MQTT_VHDR_USERNAME_FLAG; - } - if(password != NULL) { - conn->connect_vhdr_flags |= MQTT_VHDR_PASSWORD_FLAG; - } else { - conn->connect_vhdr_flags &= ~MQTT_VHDR_PASSWORD_FLAG; - } -} -/*----------------------------------------------------------------------------*/ -void -mqtt_set_last_will(struct mqtt_connection *conn, char *topic, char *message, - mqtt_qos_level_t qos) -{ - /* Set strings, NULL string will simply set length to zero */ - string_to_mqtt_string(&conn->will.topic, topic); - string_to_mqtt_string(&conn->will.message, message); - - /* Currently not used! */ - conn->will.qos = qos; - - if(topic != NULL) { - conn->connect_vhdr_flags |= MQTT_VHDR_WILL_FLAG | - MQTT_VHDR_WILL_RETAIN_FLAG; - } -} -/*----------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/app-layer/mqtt/mqtt.h b/os/net/app-layer/mqtt/mqtt.h deleted file mode 100644 index 6b7e8a3ed..000000000 --- a/os/net/app-layer/mqtt/mqtt.h +++ /dev/null @@ -1,507 +0,0 @@ -/* - * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup apps - * @{ - * - * \defgroup mqtt-engine An implementation of MQTT v3.1 - * @{ - * - * This application is an engine for MQTT v3.1. It supports QoS Levels 0 and 1. - * - * MQTT is a Client Server publish/subscribe messaging transport protocol. - * It is light weight, open, simple, and designed so as to be easy to implement. - * These characteristics make it ideal for use in many situations, including - * constrained environments such as for communication in Machine to Machine - * (M2M) and Internet of Things (IoT) contexts where a small code footprint is - * required and/or network bandwidth is at a premium. - * - * The protocol runs over TCP/IP, more specifically tcp_socket. - * Its features include: - * - * - Use of the publish/subscribe message pattern which provides - * one-to-many message distribution and decoupling of applications. - * - A messaging transport that is agnostic to the content of the payload. - * Three qualities of service for message delivery: - * -- "At most once" (0), where messages are delivered according to the best - * efforts of the operating environment. Message loss can occur. - * This level could be used, for example, with ambient sensor data where it - * does not matter if an individual reading is lost as the next one will be - * published soon after. - * --"At least once" (1), where messages are assured to arrive but duplicates - * can occur. - * -- "Exactly once" (2), where message are assured to arrive exactly once. - * This level could be used, for example, with billing systems where duplicate - * or lost messages could lead to incorrect charges being applied. This QoS - * level is currently not supported in this implementation. - * - * - A small transport overhead and protocol exchanges minimized to reduce - * network traffic. - * - A mechanism, Last Will, to notify interested parties when an abnormal - * disconnection occurs. - * - * The protocol specification and other useful information can be found - * here: http://mqtt.org - * - */ -/** - * \file - * Header file for the Contiki MQTT engine - * - * \author - * Texas Instruments - */ -/*---------------------------------------------------------------------------*/ -#ifndef MQTT_H_ -#define MQTT_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "dev/leds.h" - -#include "tcp-socket.h" -#include "udp-socket.h" - -#include -#include -#include -/*---------------------------------------------------------------------------*/ -/* Protocol constants */ -#define MQTT_CLIENT_ID_MAX_LEN 23 - -/* Size of the underlying TCP buffers */ -#define MQTT_TCP_INPUT_BUFF_SIZE 512 -#define MQTT_TCP_OUTPUT_BUFF_SIZE 512 - -#define MQTT_INPUT_BUFF_SIZE 512 -#define MQTT_MAX_TOPIC_LENGTH 64 -#define MQTT_MAX_TOPICS_PER_SUBSCRIBE 1 - -#define MQTT_FHDR_SIZE 1 -#define MQTT_MAX_REMAINING_LENGTH_BYTES 4 -#define MQTT_PROTOCOL_VERSION 3 -#define MQTT_PROTOCOL_NAME "MQIsdp" -#define MQTT_TOPIC_MAX_LENGTH 128 -/*---------------------------------------------------------------------------*/ -/* - * Debug configuration, this is similar but not exactly like the Debugging - * System discussion at https://github.com/contiki-os/contiki/wiki. - */ -#define DEBUG_MQTT 0 - -#if DEBUG_MQTT == 1 -#define DBG(...) printf(__VA_ARGS__) -#else -#define DBG(...) -#endif /* DEBUG */ -/*---------------------------------------------------------------------------*/ -extern process_event_t mqtt_update_event; - -/* Forward declaration */ -struct mqtt_connection; - -typedef enum { - MQTT_RETAIN_OFF, - MQTT_RETAIN_ON, -} mqtt_retain_t; - -/** - * \brief MQTT engine events - */ -typedef enum { - MQTT_EVENT_CONNECTED, - MQTT_EVENT_DISCONNECTED, - - MQTT_EVENT_SUBACK, - MQTT_EVENT_UNSUBACK, - MQTT_EVENT_PUBLISH, - MQTT_EVENT_PUBACK, - - /* Errors */ - MQTT_EVENT_ERROR = 0x80, - MQTT_EVENT_PROTOCOL_ERROR, - MQTT_EVENT_CONNECTION_REFUSED_ERROR, - MQTT_EVENT_DNS_ERROR, - MQTT_EVENT_NOT_IMPLEMENTED_ERROR, - /* Add more */ -} mqtt_event_t; - -typedef enum { - MQTT_STATUS_OK, - - MQTT_STATUS_OUT_QUEUE_FULL, - - /* Errors */ - MQTT_STATUS_ERROR = 0x80, - MQTT_STATUS_NOT_CONNECTED_ERROR, - MQTT_STATUS_INVALID_ARGS_ERROR, - MQTT_STATUS_DNS_ERROR, -} mqtt_status_t; - -typedef enum { - MQTT_QOS_LEVEL_0, - MQTT_QOS_LEVEL_1, - MQTT_QOS_LEVEL_2, -} mqtt_qos_level_t; - -typedef enum { - MQTT_QOS_STATE_NO_ACK, - MQTT_QOS_STATE_GOT_ACK, - - /* Expand for QoS 2 */ -} mqtt_qos_state_t; -/*---------------------------------------------------------------------------*/ -/* - * This is the state of the connection itself. - * - * N.B. The order is important because of runtime checks on how far the - * connection has proceeded. - */ -typedef enum { - MQTT_CONN_STATE_ERROR, - MQTT_CONN_STATE_DNS_ERROR, - MQTT_CONN_STATE_DISCONNECTING, - MQTT_CONN_STATE_ABORT_IMMEDIATE, - MQTT_CONN_STATE_NOT_CONNECTED, - MQTT_CONN_STATE_DNS_LOOKUP, - MQTT_CONN_STATE_TCP_CONNECTING, - MQTT_CONN_STATE_TCP_CONNECTED, - MQTT_CONN_STATE_CONNECTING_TO_BROKER, - MQTT_CONN_STATE_CONNECTED_TO_BROKER, - MQTT_CONN_STATE_SENDING_MQTT_DISCONNECT, -} mqtt_conn_state_t; -/*---------------------------------------------------------------------------*/ -struct mqtt_string { - char *string; - uint16_t length; -}; - -/* - * Note that the pairing mid <-> QoS level only applies one-to-one if we only - * allow the subscription of one topic at a time. Otherwise we will have an - * ordered list of QoS levels corresponding to the order of topics. - * - * This could be part of a union of event data structures. - */ -struct mqtt_suback_event { - uint16_t mid; - mqtt_qos_level_t qos_level; -}; - -/* This is the MQTT message that is exposed to the end user. */ -struct mqtt_message { - uint32_t mid; - char topic[MQTT_MAX_TOPIC_LENGTH + 1]; /* +1 for string termination */ - - uint8_t *payload_chunk; - uint16_t payload_chunk_length; - - uint8_t first_chunk; - uint16_t payload_length; - uint16_t payload_left; -}; - -/* This struct represents a packet received from the MQTT server. */ -struct mqtt_in_packet { - /* Used by the list interface, must be first in the struct. */ - struct mqtt_connection *next; - - /* Total bytes read so far. Compared to the remaining length to to decide when - * we've read the payload. */ - uint32_t byte_counter; - uint8_t packet_received; - - uint8_t fhdr; - uint16_t remaining_length; - uint16_t mid; - - /* Helper variables needed to decode the remaining_length */ - uint8_t remaining_multiplier; - uint8_t has_remaining_length; - uint8_t remaining_length_bytes; - - /* Not the same as payload in the MQTT sense, it also contains the variable - * header. - */ - uint8_t payload_pos; - uint8_t payload[MQTT_INPUT_BUFF_SIZE]; - - /* Message specific data */ - uint16_t topic_len; - uint16_t topic_pos; - uint8_t topic_len_received; - uint8_t topic_received; -}; - -/* This struct represents a packet sent to the MQTT server. */ -struct mqtt_out_packet { - uint8_t fhdr; - uint32_t remaining_length; - uint8_t remaining_length_enc[MQTT_MAX_REMAINING_LENGTH_BYTES]; - uint8_t remaining_length_enc_bytes; - uint16_t mid; - char *topic; - uint16_t topic_length; - uint8_t *payload; - uint32_t payload_size; - mqtt_qos_level_t qos; - mqtt_qos_state_t qos_state; - mqtt_retain_t retain; -}; -/*---------------------------------------------------------------------------*/ -/** - * \brief MQTT event callback function - * \param m A pointer to a MQTT connection - * \param event The event number - * \param data A user-defined pointer - * - * The MQTT socket event callback function gets called whenever there is an - * event on a MQTT connection, such as the connection getting connected - * or closed. - */ -typedef void (*mqtt_event_callback_t)(struct mqtt_connection *m, - mqtt_event_t event, - void *data); - -typedef void (*mqtt_topic_callback_t)(struct mqtt_connection *m, - struct mqtt_message *msg); -/*---------------------------------------------------------------------------*/ -struct mqtt_will { - struct mqtt_string topic; - struct mqtt_string message; - mqtt_qos_level_t qos; -}; - -struct mqtt_credentials { - struct mqtt_string username; - struct mqtt_string password; -}; - -struct mqtt_connection { - /* Used by the list interface, must be first in the struct */ - struct mqtt_connection *next; - struct timer t; - - struct mqtt_string client_id; - - uint8_t connect_vhdr_flags; - uint8_t auto_reconnect; - - uint16_t keep_alive; - struct ctimer keep_alive_timer; - uint8_t waiting_for_pingresp; - - struct mqtt_will will; - struct mqtt_credentials credentials; - - mqtt_conn_state_t state; - mqtt_event_callback_t event_callback; - - /* Internal data */ - uint16_t mid_counter; - - /* Used for communication between MQTT API and APP */ - uint8_t out_queue_full; - struct process *app_process; - - /* Outgoing data related */ - uint8_t *out_buffer_ptr; - uint8_t out_buffer[MQTT_TCP_OUTPUT_BUFF_SIZE]; - uint8_t out_buffer_sent; - struct mqtt_out_packet out_packet; - struct pt out_proto_thread; - uint32_t out_write_pos; - uint16_t max_segment_size; - - /* Incoming data related */ - uint8_t in_buffer[MQTT_TCP_INPUT_BUFF_SIZE]; - struct mqtt_in_packet in_packet; - struct mqtt_message in_publish_msg; - - /* TCP related information */ - char *server_host; - uip_ipaddr_t server_ip; - uint16_t server_port; - struct tcp_socket socket; -}; -/* This is the API exposed to the user. */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Initializes the MQTT engine. - * \param conn A pointer to the MQTT connection. - * \param app_process A pointer to the application process handling the MQTT - * connection. - * \param client_id A pointer to the MQTT client ID. - * \param event_callback Callback function responsible for handling the - * callback from MQTT engine. - * \param max_segment_size The TCP segment size to use for this MQTT/TCP - * connection. - * \return MQTT_STATUS_OK or MQTT_STATUS_INVALID_ARGS_ERROR - * - * This function initializes the MQTT engine and shall be called before any - * other MQTT function. - */ -mqtt_status_t mqtt_register(struct mqtt_connection *conn, - struct process *app_process, - char *client_id, - mqtt_event_callback_t event_callback, - uint16_t max_segment_size); -/*---------------------------------------------------------------------------*/ -/** - * \brief Connects to a MQTT broker. - * \param conn A pointer to the MQTT connection. - * \param host IP address of the broker to connect to. - * \param port Port of the broker to connect to, default is MQTT port is 1883. - * \param keep_alive Keep alive timer in seconds. Used by broker to handle - * client disc. Defines the maximum time interval between two messages - * from the client. Shall be min 1.5 x report interval. - * \return MQTT_STATUS_OK or an error status - * - * This function connects to a MQTT broker. - */ -mqtt_status_t mqtt_connect(struct mqtt_connection *conn, - char *host, - uint16_t port, - uint16_t keep_alive); -/*---------------------------------------------------------------------------*/ -/** - * \brief Disconnects from a MQTT broker. - * \param conn A pointer to the MQTT connection. - * - * This function disconnects from a MQTT broker. - */ -void mqtt_disconnect(struct mqtt_connection *conn); -/*---------------------------------------------------------------------------*/ -/** - * \brief Subscribes to a MQTT topic. - * \param conn A pointer to the MQTT connection. - * \param mid A pointer to message ID. - * \param topic A pointer to the topic to subscribe to. - * \param qos_level Quality Of Service level to use. Currently supports 0, 1. - * \return MQTT_STATUS_OK or some error status - * - * This function subscribes to a topic on a MQTT broker. - */ -mqtt_status_t mqtt_subscribe(struct mqtt_connection *conn, - uint16_t *mid, - char *topic, - mqtt_qos_level_t qos_level); -/*---------------------------------------------------------------------------*/ -/** - * \brief Unsubscribes from a MQTT topic. - * \param conn A pointer to the MQTT connection. - * \param mid A pointer to message ID. - * \param topic A pointer to the topic to unsubscribe from. - * \return MQTT_STATUS_OK or some error status - * - * This function unsubscribes from a topic on a MQTT broker. - */ -mqtt_status_t mqtt_unsubscribe(struct mqtt_connection *conn, - uint16_t *mid, - char *topic); -/*---------------------------------------------------------------------------*/ -/** - * \brief Publish to a MQTT topic. - * \param conn A pointer to the MQTT connection. - * \param mid A pointer to message ID. - * \param topic A pointer to the topic to subscribe to. - * \param payload A pointer to the topic payload. - * \param payload_size Payload size. - * \param qos_level Quality Of Service level to use. Currently supports 0, 1. - * \param retain If the RETAIN flag is set to 1, in a PUBLISH Packet sent by a - * Client to a Server, the Server MUST store the Application Message - * and its QoS, so that it can be delivered to future subscribers whose - * subscriptions match its topic name - * \return MQTT_STATUS_OK or some error status - * - * This function publishes to a topic on a MQTT broker. - */ -mqtt_status_t mqtt_publish(struct mqtt_connection *conn, - uint16_t *mid, - char *topic, - uint8_t *payload, - uint32_t payload_size, - mqtt_qos_level_t qos_level, - mqtt_retain_t retain); -/*---------------------------------------------------------------------------*/ -/** - * \brief Set the user name and password for a MQTT client. - * \param conn A pointer to the MQTT connection. - * \param username A pointer to the user name. - * \param password A pointer to the password. - * - * This function sets clients user name and password to use when connecting to - * a MQTT broker. - */ -void mqtt_set_username_password(struct mqtt_connection *conn, - char *username, - char *password); -/*---------------------------------------------------------------------------*/ -/** - * \brief Set the last will topic and message for a MQTT client. - * \param conn A pointer to the MQTT connection. - * \param topic A pointer to the Last Will topic. - * \param message A pointer to the Last Will message (payload). - * \param qos The desired QoS level. - * - * This function sets clients Last Will topic and message (payload). - * If the Will Flag is set to 1 (using the function) this indicates that, - * if the Connect request is accepted, a Will Message MUST be stored on the - * Server and associated with the Network Connection. The Will Message MUST - * be published when the Network Connection is subsequently closed. - * - * This functionality can be used to get notified that a device has - * disconnected from the broker. - * - */ -void mqtt_set_last_will(struct mqtt_connection *conn, - char *topic, - char *message, - mqtt_qos_level_t qos); - -#define mqtt_connected(conn) \ - ((conn)->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER ? 1 : 0) - -#define mqtt_ready(conn) \ - (!(conn)->out_queue_full && mqtt_connected((conn))) -/*---------------------------------------------------------------------------*/ -#endif /* MQTT_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/net/ipv6/ip64-addr.c b/os/net/ipv6/ip64-addr.c deleted file mode 100644 index b472ee81b..000000000 --- a/os/net/ipv6/ip64-addr.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 "ipv6/ip64-addr.h" - -#include -#include - -#define printf(...) - -static uip_ip6addr_t ip64_prefix = {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0}}; -static uint8_t ip64_prefix_len = 96; - -/*---------------------------------------------------------------------------*/ -void -ip64_addr_copy4(uip_ip4addr_t *dest, const uip_ip4addr_t *src) -{ - memcpy(dest, src, sizeof(uip_ip4addr_t)); -} -/*---------------------------------------------------------------------------*/ -void -ip64_addr_copy6(uip_ip6addr_t *dest, const uip_ip6addr_t *src) -{ - memcpy(dest, src, sizeof(uip_ip6addr_t)); -} -/*---------------------------------------------------------------------------*/ -int -ip64_addr_4to6(const uip_ip4addr_t *ipv4addr, - uip_ip6addr_t *ipv6addr) -{ - /* This function converts an IPv4 addresses into an IPv6 - addresses. It returns 0 if it failed to convert the address and - non-zero if it could successfully convert the address. */ - - uip_ipaddr_copy(ipv6addr, &ip64_prefix); - ipv6addr->u8[12] = ipv4addr->u8[0]; - ipv6addr->u8[13] = ipv4addr->u8[1]; - ipv6addr->u8[14] = ipv4addr->u8[2]; - ipv6addr->u8[15] = ipv4addr->u8[3]; - printf("ip64_addr_4to6: IPv6-encoded IPv4 address %d.%d.%d.%d\n", - ipv4addr->u8[0], ipv4addr->u8[1], - ipv4addr->u8[2], ipv4addr->u8[3]); - - /* Conversion succeeded, we return non-zero. */ - return 1; -} -/*---------------------------------------------------------------------------*/ -int -ip64_addr_6to4(const uip_ip6addr_t *ipv6addr, - uip_ip4addr_t *ipv4addr) -{ - /* This function converts IPv6 addresses to IPv4 addresses. It - returns 0 if it failed to convert the address and non-zero if it - could successfully convert the address. */ - - if(ip64_addr_is_ip64(ipv6addr)) { - ipv4addr->u8[0] = ipv6addr->u8[12]; - ipv4addr->u8[1] = ipv6addr->u8[13]; - ipv4addr->u8[2] = ipv6addr->u8[14]; - ipv4addr->u8[3] = ipv6addr->u8[15]; - - printf("ip64_addr_6to4: IPv6-encoded IPv4 address %d.%d.%d.%d\n", - ipv4addr->u8[0], ipv4addr->u8[1], - ipv4addr->u8[2], ipv4addr->u8[3]); - - /* Conversion succeeded, we return non-zero. */ - return 1; - } - /* We could not convert the IPv6 address, so we return 0. */ - return 0; -} -/*---------------------------------------------------------------------------*/ -int -ip64_addr_is_ip64(const uip_ip6addr_t *ipv6addr) -{ - return uip_ipaddr_prefixcmp(ipv6addr, &ip64_prefix, ip64_prefix_len); -} -/*---------------------------------------------------------------------------*/ -void -ip64_addr_set_prefix(const uip_ip6addr_t *prefix, uint8_t prefix_len) -{ - uip_ipaddr_copy(&ip64_prefix, prefix); - ip64_prefix_len = prefix_len; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/ipv6/ip64-addr.h b/os/net/ipv6/ip64-addr.h deleted file mode 100644 index 9e3b9d852..000000000 --- a/os/net/ipv6/ip64-addr.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_ADDR_H -#define IP64_ADDR_H - -#include "net/ipv6/uip.h" - - -/** - * \brief Is IPv4-mapped Address - * - * See https://tools.ietf.org/html/rfc6890#page-14 - */ -#define ip64_addr_is_ipv4_mapped_addr(a) \ - ((((a)->u16[0]) == 0) && \ - (((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u16[5]) == 0xFFFF)) - -void ip64_addr_copy4(uip_ip4addr_t *dest, const uip_ip4addr_t *src); - -void ip64_addr_copy6(uip_ip6addr_t *dest, const uip_ip6addr_t *src); - -int ip64_addr_6to4(const uip_ip6addr_t *ipv6addr, - uip_ip4addr_t *ipv4addr); - -int ip64_addr_4to6(const uip_ip4addr_t *ipv4addr, - uip_ip6addr_t *ipv6addr); - -int ip64_addr_is_ip64(const uip_ip6addr_t *ipv6addr); - -void ip64_addr_set_prefix(const uip_ip6addr_t *prefix, uint8_t prefix_len); - -#endif /* IP64_ADDR_H */ - diff --git a/os/net/ipv6/multicast/esmrf.c b/os/net/ipv6/multicast/esmrf.c deleted file mode 100644 index 169064b25..000000000 --- a/os/net/ipv6/multicast/esmrf.c +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2010, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * This file shows the implementations of the Enhanced Stateless - * Multicast RPL Forwarding (ESMRF) - * - * It will only work in RPL networks in MOP 3 "Storing with Multicast" - * - * \author - * Khaled Qorany kqorany2@gmail.com - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "net/ipv6/multicast/uip-mcast6.h" -#include "net/ipv6/multicast/uip-mcast6-route.h" -#include "net/ipv6/multicast/uip-mcast6-stats.h" -#include "net/ipv6/multicast/esmrf.h" -#include "net/routing/routing.h" -#include "net/ipv6/uip.h" -#include "net/netstack.h" -#include "net/packetbuf.h" -#if ROUTING_CONF_RPL_LITE -#include "net/routing/rpl-lite/rpl.h" -#endif /* ROUTING_CONF_RPL_LITE */ -#if ROUTING_CONF_RPL_CLASSIC -#include "net/routing/rpl-classic/rpl.h" -#endif /* ROUTING_CONF_RPL_CLASSIC */ -#include - -extern uint16_t uip_slen; - -#define DEBUG NONE -#include "net/ipv6/uip-debug.h" - -#define ESMRF_VERBOSE NONE - -#if DEBUG && ESMRF_VERBOSE -#define VERBOSE_PRINTF(...) PRINTF(__VA_ARGS__) -#define VERBOSE_PRINT_SEED(s) PRINT_SEED(s) -#else -#define VERBOSE_PRINTF(...) -#define VERBOSE_PRINT_SEED(...) -#endif - -/*---------------------------------------------------------------------------*/ -/* Maintain Stats */ -#if UIP_MCAST6_STATS -static struct esmrf_stats stats; - -#define ESMRF_STATS_ADD(x) stats.x++ -#define ESMRF_STATS_INIT() do { memset(&stats, 0, sizeof(stats)); } while(0) -#else /* UIP_MCAST6_STATS */ -#define ESMRF_STATS_ADD(x) -#define ESMRF_STATS_INIT() -#endif -/*---------------------------------------------------------------------------*/ -/* Macros */ -/*---------------------------------------------------------------------------*/ -/* CCI */ -#define ESMRF_FWD_DELAY() (CLOCK_SECOND / 8) -/* Number of slots in the next 500ms */ -#define ESMRF_INTERVAL_COUNT ((CLOCK_SECOND >> 2) / fwd_delay) -/*---------------------------------------------------------------------------*/ -/* Internal Data */ -/*---------------------------------------------------------------------------*/ -static struct ctimer mcast_periodic; -static uint8_t mcast_len; -static uip_buf_t mcast_buf; -static uint8_t fwd_delay; -static uint8_t fwd_spread; -static struct uip_udp_conn *c; -static uip_ipaddr_t src_ip; -static uip_ipaddr_t des_ip; -/*---------------------------------------------------------------------------*/ -/* Local function prototypes */ -/*---------------------------------------------------------------------------*/ -static void icmp_input(void); -static void icmp_output(void); -static void mcast_fwd(void *p); -/*---------------------------------------------------------------------------*/ -/* Internal Data Structures */ -/*---------------------------------------------------------------------------*/ -struct multicast_on_behalf{ /* ICMP message of multicast_on_behalf */ - uint16_t mcast_port; - uip_ipaddr_t mcast_ip; - uint8_t mcast_payload[UIP_BUFSIZE - UIP_IPUDPH_LEN]; -}; -#define UIP_ICMP_MOB 18 /* Size of multicast_on_behalf ICMP header */ -/*---------------------------------------------------------------------------*/ -/* Temporary Stores */ -/*---------------------------------------------------------------------------*/ -static struct multicast_on_behalf *locmobptr; -static int loclen; -/*---------------------------------------------------------------------------*/ -/* ESMRF ICMPv6 handler declaration */ -UIP_ICMP6_HANDLER(esmrf_icmp_handler, ICMP6_ESMRF, - UIP_ICMP6_HANDLER_CODE_ANY, icmp_input); -/*---------------------------------------------------------------------------*/ -static void -icmp_output() -{ - uint16_t payload_len=0; - rpl_dag_t *dag_t; - - struct multicast_on_behalf *mob; - mob = (struct multicast_on_behalf *)UIP_ICMP_PAYLOAD; - memcpy(&mob->mcast_payload, &uip_buf[UIP_IPUDPH_LEN], uip_slen); - - UIP_IP_BUF->vtc = 0x60; - UIP_IP_BUF->tcflow = 0; - UIP_IP_BUF->flow = 0; - UIP_IP_BUF->proto = UIP_PROTO_ICMP6; - UIP_IP_BUF->ttl = ESMRF_IP_HOP_LIMIT; - - mob->mcast_port = (uint16_t) uip_udp_conn->rport; - uip_ipaddr_copy(&mob->mcast_ip, &UIP_IP_BUF->destipaddr); - - payload_len = UIP_ICMP_MOB + uip_slen; - - dag_t = rpl_get_any_dag(); - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &dag_t->dag_id); - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - - VERBOSE_PRINTF("ESMRF: ICMPv6 Out - Hdr @ %p, payload @ %p to: ", UIP_ICMP_BUF, mob); - PRINT6ADDR(&UIP_IP_BUF->destipaddr); - PRINTF("\n"); - - uipbuf_set_len_field(UIP_IP_BUF, UIP_ICMPH_LEN + payload_len); - - UIP_ICMP_BUF->type = ICMP6_ESMRF; - UIP_ICMP_BUF->icode = ESMRF_ICMP_CODE; - - UIP_ICMP_BUF->icmpchksum = 0; - UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); - - uip_len = UIP_IPH_LEN + UIP_ICMPH_LEN + payload_len; - - VERBOSE_PRINTF("ESMRF: ICMPv6 Out - %u bytes, uip_len %u bytes, uip_ext_len %u bytes\n", - payload_len, uip_len, uip_ext_len); - - tcpip_ipv6_output(); - ESMRF_STATS_ADD(icmp_out); - return; -} -/*---------------------------------------------------------------------------*/ -static void -icmp_input() -{ -#if UIP_CONF_IPV6_CHECKS - if(UIP_ICMP_BUF->icode != ESMRF_ICMP_CODE) { - PRINTF("ESMRF: ICMPv6 In, bad ICMP code\n"); - ESMRF_STATS_ADD(icmp_bad); - return; - } - if(UIP_IP_BUF->ttl <= 1) { - PRINTF("ESMRF: ICMPv6 In, bad TTL\n"); - ESMRF_STATS_ADD(icmp_bad); - return; - } -#endif - - uip_remove_ext_hdr(); - - PRINTF("ESMRF: ICMPv6 In from "); - PRINT6ADDR(&UIP_IP_BUF->srcipaddr); - PRINTF(" len %u, ext %u\n", uip_len, uip_ext_len); - - ESMRF_STATS_ADD(icmp_in); - - VERBOSE_PRINTF("ESMRF: ICMPv6 In, parse from %p to %p\n", - UIP_ICMP_PAYLOAD, - (uint8_t *)UIP_ICMP_PAYLOAD + uip_len - - uip_l3_icmp_hdr_len); - - - locmobptr = (struct multicast_on_behalf *) UIP_ICMP_PAYLOAD; - loclen = uip_len - (uip_l3_icmp_hdr_len + UIP_ICMP_MOB); - - uip_ipaddr_copy(&src_ip, &UIP_IP_BUF->srcipaddr); - uip_ipaddr_copy(&des_ip, &UIP_IP_BUF->destipaddr); - - /* Extract the original multicast message */ - uip_ipaddr_copy(&c->ripaddr, &locmobptr->mcast_ip); - c->rport = locmobptr->mcast_port; - uip_slen = loclen; - uip_udp_conn=c; - memcpy(&uip_buf[UIP_IPUDPH_LEN], locmobptr->mcast_payload, - loclen > UIP_BUFSIZE - UIP_IPUDPH_LEN? - UIP_BUFSIZE - UIP_IPUDPH_LEN: loclen); - - uip_process(UIP_UDP_SEND_CONN); - - memcpy(&mcast_buf, uip_buf, uip_len); - mcast_len = uip_len; - /* pass the packet to our uip_process to check if it is allowed to - * accept this packet or not */ - uip_ipaddr_copy(&UIP_IP_BUF->srcipaddr, &src_ip); - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &des_ip); - UIP_UDP_BUF->udpchksum = 0; - - uip_process(UIP_DATA); - - memcpy(uip_buf, &mcast_buf, mcast_len); - uip_len = mcast_len; - /* Return the IP of the original Multicast sender */ - uip_ipaddr_copy(&UIP_IP_BUF->srcipaddr, &src_ip); - UIP_UDP_BUF->udpchksum = 0; - /* If we have an entry in the multicast routing table, something with - * a higher RPL rank (somewhere down the tree) is a group member */ - if(uip_mcast6_route_lookup(&UIP_IP_BUF->destipaddr)) { - PRINTF("ESMRF: Forward this packet\n"); - /* If we enter here, we will definitely forward */ - tcpip_ipv6_output(); - } - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -static void -mcast_fwd(void *p) -{ - memcpy(uip_buf, &mcast_buf, mcast_len); - uip_len = mcast_len; - UIP_IP_BUF->ttl--; - tcpip_output(NULL); - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -in() -{ - rpl_dag_t *d; /* Our DODAG */ - uip_ipaddr_t *parent_ipaddr; /* Our pref. parent's IPv6 address */ - const uip_lladdr_t *parent_lladdr; /* Our pref. parent's LL address */ - - /* - * Fetch a pointer to the LL address of our preferred parent - * - * ToDo: This rpl_get_any_dag() call is a dirty replacement of the previous - * rpl_get_dag(RPL_DEFAULT_INSTANCE); - * so that things can compile with the new RPL code. This needs updated to - * read instance ID from the RPL HBHO and use the correct parent accordingly - */ - d = rpl_get_any_dag(); - if(!d) { - PRINTF("ESMRF: No DODAG\n"); - UIP_MCAST6_STATS_ADD(mcast_dropped); - return UIP_MCAST6_DROP; - } - - /* Retrieve our preferred parent's LL address */ - parent_ipaddr = rpl_parent_get_ipaddr(d->preferred_parent); - parent_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(parent_ipaddr); - - if(parent_lladdr == NULL) { - PRINTF("ESMRF: No Parent found\n"); - UIP_MCAST6_STATS_ADD(mcast_dropped); - return UIP_MCAST6_DROP; - } - - /* - * We accept a datagram if it arrived from our preferred parent, discard - * otherwise. - */ - if(memcmp(parent_lladdr, packetbuf_addr(PACKETBUF_ADDR_SENDER), - UIP_LLADDR_LEN)) { - PRINTF("ESMRF: Routable in but ESMRF ignored it\n"); - UIP_MCAST6_STATS_ADD(mcast_dropped); - return UIP_MCAST6_DROP; - } - - if(UIP_IP_BUF->ttl <= 1) { - UIP_MCAST6_STATS_ADD(mcast_dropped); - PRINTF("ESMRF: TTL too low\n"); - return UIP_MCAST6_DROP; - } - - UIP_MCAST6_STATS_ADD(mcast_in_all); - UIP_MCAST6_STATS_ADD(mcast_in_unique); - - /* If we have an entry in the mcast routing table, something with - * a higher RPL rank (somewhere down the tree) is a group member */ - if(uip_mcast6_route_lookup(&UIP_IP_BUF->destipaddr)) { - /* If we enter here, we will definitely forward */ - UIP_MCAST6_STATS_ADD(mcast_fwd); - - /* - * Add a delay (D) of at least ESMRF_FWD_DELAY() to compensate for how - * contikimac handles broadcasts. We can't start our TX before the sender - * has finished its own. - */ - fwd_delay = ESMRF_FWD_DELAY(); - - /* Finalise D: D = min(ESMRF_FWD_DELAY(), ESMRF_MIN_FWD_DELAY) */ -#if ESMRF_MIN_FWD_DELAY - if(fwd_delay < ESMRF_MIN_FWD_DELAY) { - fwd_delay = ESMRF_MIN_FWD_DELAY; - } -#endif - - if(fwd_delay == 0) { - /* No delay required, send it, do it now, why wait? */ - UIP_IP_BUF->ttl--; - tcpip_output(NULL); - UIP_IP_BUF->ttl++; /* Restore before potential upstack delivery */ - } else { - /* Randomise final delay in [D , D*Spread], step D */ - fwd_spread = ESMRF_INTERVAL_COUNT; - if(fwd_spread > ESMRF_MAX_SPREAD) { - fwd_spread = ESMRF_MAX_SPREAD; - } - if(fwd_spread) { - fwd_delay = fwd_delay * (1 + ((random_rand() >> 11) % fwd_spread)); - } - - memcpy(&mcast_buf, uip_buf, uip_len); - mcast_len = uip_len; - ctimer_set(&mcast_periodic, fwd_delay, mcast_fwd, NULL); - } - PRINTF("ESMRF: %u bytes: fwd in %u [%u]\n", - uip_len, fwd_delay, fwd_spread); - } else { - PRINTF("ESMRF: Group unknown, dropping\n"); - } - - /* Done with this packet unless we are a member of the mcast group */ - if(!uip_ds6_is_my_maddr(&UIP_IP_BUF->destipaddr)) { - PRINTF("ESMRF: Not a group member. No further processing\n"); - return UIP_MCAST6_DROP; - } else { - PRINTF("ESMRF: Ours. Deliver to upper layers\n"); - UIP_MCAST6_STATS_ADD(mcast_in_ours); - return UIP_MCAST6_ACCEPT; - } -} -/*---------------------------------------------------------------------------*/ -static void -init() -{ - ESMRF_STATS_INIT(); - UIP_MCAST6_STATS_INIT(&stats); - - uip_mcast6_route_init(); - /* Register the ICMPv6 input handler */ - uip_icmp6_register_input_handler(&esmrf_icmp_handler); - c = udp_new(NULL, 0, NULL); -} -/*---------------------------------------------------------------------------*/ -static void -out(void) -{ - rpl_dag_t *dag_t; - dag_t = rpl_get_any_dag(); - if (!dag_t){ - PRINTF("ESMRF: There is no DODAG\n"); - return; - } - if(dag_t->rank == 256){ - PRINTF("ESMRF: I am the Root, thus send the multicast packet normally. \n"); - return; - } - else{ - PRINTF("ESMRF: I am not the Root\n"); - PRINTF("Send multicast-on-befalf message (ICMPv6) instead to "); - PRINT6ADDR(&dag_t->dag_id); - PRINTF("\n"); - icmp_output(); - uip_slen=0; - return; - } -} -/*---------------------------------------------------------------------------*/ -const struct uip_mcast6_driver esmrf_driver = { - "ESMRF", - init, - out, - in, -}; -/*---------------------------------------------------------------------------*/ diff --git a/os/net/ipv6/multicast/esmrf.h b/os/net/ipv6/multicast/esmrf.h deleted file mode 100644 index 15857a1d4..000000000 --- a/os/net/ipv6/multicast/esmrf.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2011, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Header file for the Enhanced Stateless Multicast RPL Forwarding (ESMRF) - * - * \author - * Khaled Qorany kqorany2@gmail.com - */ - -#ifndef ESMRF_H_ -#define ESMRF_H_ - -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -/* Protocol Constants */ -/*---------------------------------------------------------------------------*/ -#define ESMRF_ICMP_CODE 0 /* ICMPv6 code field */ -#define ESMRF_IP_HOP_LIMIT 0xFF /* Hop limit for ICMP messages */ -/*---------------------------------------------------------------------------*/ -/* Configuration */ -/*---------------------------------------------------------------------------*/ -/* Fmin */ -#ifdef ESMRF_CONF_MIN_FWD_DELAY -#define ESMRF_MIN_FWD_DELAY ESMRF_CONF_MIN_FWD_DELAY -#else -#define ESMRF_MIN_FWD_DELAY 4 -#endif - -/* Max Spread */ -#ifdef ESMRF_CONF_MAX_SPREAD -#define ESMRF_MAX_SPREAD ESMRF_CONF_MAX_SPREAD -#else -#define ESMRF_MAX_SPREAD 4 -#endif -/*---------------------------------------------------------------------------*/ -/* Stats datatype */ -/*---------------------------------------------------------------------------*/ -struct esmrf_stats { - uint16_t icmp_out; - uint16_t icmp_in; - uint16_t icmp_bad; -}; -/*---------------------------------------------------------------------------*/ -#endif /* ESMRF_H_ */ diff --git a/os/net/ipv6/multicast/roll-tm.c b/os/net/ipv6/multicast/roll-tm.c deleted file mode 100644 index 909ebbfb6..000000000 --- a/os/net/ipv6/multicast/roll-tm.c +++ /dev/null @@ -1,1442 +0,0 @@ -/* - * Copyright (c) 2010, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup roll-tm - * @{ - */ -/** - * \file - * Implementation of the ROLL TM multicast engine - * \author - * George Oikonomou - - */ - -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" -#include "net/ipv6/uip-icmp6.h" -#include "net/ipv6/multicast/uip-mcast6.h" -#include "net/ipv6/multicast/roll-tm.h" -#include "dev/watchdog.h" -#include - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -#define TRICKLE_VERBOSE 0 - -#if DEBUG && TRICKLE_VERBOSE -#define VERBOSE_PRINTF(...) PRINTF(__VA_ARGS__) -#define VERBOSE_PRINT_SEED(s) PRINT_SEED(s) -#else -#define VERBOSE_PRINTF(...) -#define VERBOSE_PRINT_SEED(...) -#endif - -/*---------------------------------------------------------------------------*/ -/* Data Representation */ -/*---------------------------------------------------------------------------*/ -#if ROLL_TM_SHORT_SEEDS -typedef union seed_id_u { - uint8_t u8[2]; - uint16_t id; /* Big Endian */ -} seed_id_t; - -#define seed_is_null(s) ((s)->id == 0) -#define PRINT_SEED(s) PRINTF("0x%02x%02x", (s)->u8[0], (s)->u8[1]) -#else /* ROLL_TM_SHORT_SEEDS */ -typedef uip_ip6addr_t seed_id_t; - -#define seed_is_null(s) uip_is_addr_unspecified(s) -#define PRINT_SEED(s) PRINT6ADDR(s) -#endif /* ROLL_TM_SHORT_SEEDS */ -#define seed_id_cmp(a, b) (memcmp((a), (b), sizeof(seed_id_t)) == 0) -#define seed_id_cpy(a, b) (memcpy((a), (b), sizeof(seed_id_t))) - -/* Trickle Timers */ -struct trickle_param { - clock_time_t i_min; /* Clock ticks */ - clock_time_t t_start; /* Start of the interval (absolute clock_time) */ - clock_time_t t_end; /* End of the interval (absolute clock_time) */ - clock_time_t t_next; /* Clock ticks, randomised in [I/2, I) */ - clock_time_t t_last_trigger; - struct ctimer ct; - uint8_t i_current; /* Current doublings from i_min */ - uint8_t i_max; /* Max number of doublings */ - uint8_t k; /* Redundancy Constant */ - uint8_t t_active; /* Units of Imax */ - uint8_t t_dwell; /* Units of Imax */ - uint8_t c; /* Consistency Counter */ - uint8_t inconsistency; -}; - -/** - * \brief Convert a timer to a sane clock_time_t value after d doublings - * m is a value of Imin, d is a number of doublings - * Careful of overflows - */ -#define TRICKLE_TIME(m, d) ((clock_time_t)((m) << (d))) - -/** - * \brief Convert Imax from number of doublings to clock_time_t units for - * trickle_param t. Again, watch out for overflows */ -#define TRICKLE_IMAX(t) ((uint32_t)((t)->i_min << (t)->i_max)) - -/** - * \brief Convert Tactive for a trickle timer to a sane clock_time_t value - * t is a pointer to the timer - * Careful of overflows - */ -#define TRICKLE_ACTIVE(t) ((uint32_t)(TRICKLE_IMAX(t) * t->t_active)) - -/** - * \brief Convert Tdwell for a trickle timer to a sane clock_time_t value - * t is a pointer to the timer - * Careful of overflows - */ -#define TRICKLE_DWELL(t) ((uint32_t)(TRICKLE_IMAX(t) * t->t_dwell)) - -/** - * \brief Check if suppression is enabled for trickle_param t - * t is a pointer to the timer - */ -#define SUPPRESSION_ENABLED(t) ((t)->k != ROLL_TM_INFINITE_REDUNDANCY) - -/** - * \brief Check if suppression is disabled for trickle_param t - * t is a pointer to the timer - */ -#define SUPPRESSION_DISABLED(t) ((t)->k == ROLL_TM_INFINITE_REDUNDANCY) - -/** - * \brief Init trickle_timer[m] - */ -#define TIMER_CONFIGURE(m) do { \ - t[m].i_min = ROLL_TM_IMIN_##m; \ - t[m].i_max = ROLL_TM_IMAX_##m; \ - t[m].k = ROLL_TM_K_##m; \ - t[m].t_active = ROLL_TM_T_ACTIVE_##m; \ - t[m].t_dwell = ROLL_TM_T_DWELL_##m; \ - t[m].t_last_trigger = clock_time(); \ -} while(0) -/*---------------------------------------------------------------------------*/ -/* Sequence Values and Serial Number Arithmetic - * - * Sequence Number Comparisons as per RFC1982 "Serial Number Arithmetic" - * Our 'SERIAL_BITS' value is 15 here - * - * NOTE: There can be pairs of sequence numbers s1 and s2 with an undefined - * ordering. All three macros would evaluate as 0, as in: - * SEQ_VAL_IS_EQUAL(s1, s2) == 0 and - * SEQ_VAL_IS_GT(s1, s2) == 0 and - * SEQ_VAL_IS_LT(s1, s2) == 0 - * - * This is not a bug of this implementation, it's an RFC design choice - */ - -/** - * \brief s1 is said to be equal s2 iif SEQ_VAL_IS_EQ(s1, s2) == 1 - */ -#define SEQ_VAL_IS_EQ(i1, i2) ((i1) == (i2)) - -/** - * \brief s1 is said to be less than s2 iif SEQ_VAL_IS_LT(s1, s2) == 1 - */ -#define SEQ_VAL_IS_LT(i1, i2) \ - ( \ - ((i1) != (i2)) && \ - ((((i1) < (i2)) && ((int16_t)((i2) - (i1)) < 0x4000)) || \ - (((i1) > (i2)) && ((int16_t)((i1) - (i2)) > 0x4000))) \ - ) - -/** - * \brief s1 is said to be greater than s2 iif SEQ_VAL_IS_LT(s1, s2) == 1 - */ -#define SEQ_VAL_IS_GT(i1, i2) \ -( \ - ((i1) != (i2)) && \ - ((((i1) < (i2)) && ((int16_t)((i2) - (i1)) > 0x4000)) || \ - (((i1) > (i2)) && ((int16_t)((i1) - (i2)) < 0x4000))) \ -) - -/** - * \brief Add n to s: (s + n) modulo (2 ^ SERIAL_BITS) => ((s + n) % 0x8000) - */ -#define SEQ_VAL_ADD(s, n) (((s) + (n)) % 0x8000) -/*---------------------------------------------------------------------------*/ -/* Sliding Windows */ -struct sliding_window { - seed_id_t seed_id; - int16_t lower_bound; /* lolipop */ - int16_t upper_bound; /* lolipop */ - int16_t min_listed; /* lolipop */ - uint8_t flags; /* Is used, Trickle param, Is listed */ - uint8_t count; -}; - -#define SLIDING_WINDOW_U_BIT 0x80 /* Is used */ -#define SLIDING_WINDOW_M_BIT 0x40 /* Window trickle parametrization */ -#define SLIDING_WINDOW_L_BIT 0x20 /* Current ICMP message lists us */ -#define SLIDING_WINDOW_B_BIT 0x10 /* Used when updating bounds */ - -/** - * \brief Is Occupied sliding window location w - * w: pointer to a sliding window - */ -#define SLIDING_WINDOW_IS_USED(w) ((w)->flags & SLIDING_WINDOW_U_BIT) - -/** - * \brief Set 'Is Used' bit for window w - * w: pointer to a sliding window - */ -#define SLIDING_WINDOW_IS_USED_SET(w) ((w)->flags |= SLIDING_WINDOW_U_BIT) - -/** - * \brief Clear 'Is Used' bit for window w - * w: pointer to a sliding window - */ -#define SLIDING_WINDOW_IS_USED_CLR(w) ((w)->flags &= ~SLIDING_WINDOW_U_BIT) -#define window_free(w) SLIDING_WINDOW_IS_USED_CLR(w) - -/** - * \brief Set 'Is Seen' bit for window w - * w: pointer to a sliding window - */ -#define SLIDING_WINDOW_LISTED_SET(w) ((w)->flags |= SLIDING_WINDOW_L_BIT) - -/** - * \brief Clear 'Is Seen' bit for window w - * w: pointer to a sliding window - */ -#define SLIDING_WINDOW_LISTED_CLR(w) ((w)->flags &= ~SLIDING_WINDOW_L_BIT) - -/** - * \brief Is the sliding window at location w listed in current ICMP message? - * w: pointer to a sliding window - */ -#define SLIDING_WINDOW_IS_LISTED(w) ((w)->flags & SLIDING_WINDOW_L_BIT) - -/** - * \brief Set M bit for window w - * w: pointer to a sliding window - */ -#define SLIDING_WINDOW_M_SET(w) ((w)->flags |= SLIDING_WINDOW_M_BIT) - -/** - * \brief Clear M bit for window w - * w: pointer to a sliding window - */ -#define SLIDING_WINDOW_M_CLR(w) ((w)->flags &= ~SLIDING_WINDOW_M_BIT) - -/** - * \brief Retrieve trickle parametrization for sliding window at location w - * w: pointer to a sliding window - */ -#define SLIDING_WINDOW_GET_M(w) \ - ((uint8_t)(((w)->flags & SLIDING_WINDOW_M_BIT) == SLIDING_WINDOW_M_BIT)) -/*---------------------------------------------------------------------------*/ -/* Multicast Packet Buffers */ -struct mcast_packet { -#if ROLL_TM_SHORT_SEEDS - /* Short seeds are stored inside the message */ - seed_id_t seed_id; -#endif - uint32_t active; /* Starts at 0 and increments */ - uint32_t dwell; /* Starts at 0 and increments */ - uint16_t buff_len; - uint16_t seq_val; /* host-byte order */ - struct sliding_window *sw; /* Pointer to the SW this packet belongs to */ - uint8_t flags; /* Is-Used, Must Send, Is Listed */ - uint8_t buff[UIP_BUFSIZE]; -}; - -/* Flag bits */ -#define MCAST_PACKET_U_BIT 0x80 /* Is Used */ -#define MCAST_PACKET_S_BIT 0x20 /* Must Send Next Pass */ -#define MCAST_PACKET_L_BIT 0x10 /* Is listed in ICMP message */ - -/* Fetch a pointer to the Seed ID of a buffered message p */ -#if ROLL_TM_SHORT_SEEDS -#define MCAST_PACKET_GET_SEED(p) ((seed_id_t *)&((p)->seed_id)) -#else -#define MCAST_PACKET_GET_SEED(p) \ - ((seed_id_t *)&((struct uip_ip_hdr *)&(p)->buff[0])->srcipaddr) -#endif - -/** - * \brief Get the TTL of a buffered packet - * p: pointer to a packet buffer - */ -#define MCAST_PACKET_TTL(p) \ - (((struct uip_ip_hdr *)(p)->buff)->ttl) - -/** - * \brief Set 'Is Used' bit for packet p - * p: pointer to a packet buffer - */ -#define MCAST_PACKET_USED_SET(p) ((p)->flags |= MCAST_PACKET_U_BIT) - -/** - * \brief Clear 'Is Used' bit for packet p - * p: pointer to a packet buffer - */ -#define MCAST_PACKET_USED_CLR(p) ((p)->flags &= ~MCAST_PACKET_U_BIT) - -/** - * \brief Is Occupied buffer location p - */ -#define MCAST_PACKET_IS_USED(p) ((p)->flags & MCAST_PACKET_U_BIT) - -/** - * \brief Must we send this message this pass? - */ -#define MCAST_PACKET_MUST_SEND(p) ((p)->flags & MCAST_PACKET_S_BIT) - -/** - * \brief Set 'Must Send' bit for message p - * p: pointer to a struct mcast_packet - */ -#define MCAST_PACKET_SEND_SET(p) ((p)->flags |= MCAST_PACKET_S_BIT) - -/** - * \brief Clear 'Must Send' bit for message p - * p: pointer to a struct mcast_packet - */ -#define MCAST_PACKET_SEND_CLR(p) ((p)->flags &= ~MCAST_PACKET_S_BIT) - -/** - * \brief Is the message p listed in current ICMP message? - * p: pointer to a struct mcast_packet - */ -#define MCAST_PACKET_IS_LISTED(p) ((p)->flags & MCAST_PACKET_L_BIT) - -/** - * \brief Set 'Is Listed' bit for message p - * p: pointer to a struct mcast_packet - */ -#define MCAST_PACKET_LISTED_SET(p) ((p)->flags |= MCAST_PACKET_L_BIT) - -/** - * \brief Clear 'Is Listed' bit for message p - * p: pointer to a struct mcast_packet - */ -#define MCAST_PACKET_LISTED_CLR(p) ((p)->flags &= ~MCAST_PACKET_L_BIT) - -/** - * \brief Free a multicast packet buffer - * p: pointer to a struct mcast_packet - */ -#define MCAST_PACKET_FREE(p) ((p)->flags = 0) -/*---------------------------------------------------------------------------*/ -/* Sequence Lists in Multicast Trickle ICMP messages */ -struct sequence_list_header { - uint8_t flags; /* S: Seed ID length, M: Trickle parametrization */ - uint8_t seq_len; - seed_id_t seed_id; -}; - -#define SEQUENCE_LIST_S_BIT 0x80 -#define SEQUENCE_LIST_M_BIT 0x40 -#define SEQUENCE_LIST_RES 0x3F - -/** - * \brief Get the Trickle Parametrization for an ICMPv6 sequence list - * l: pointer to a sequence list structure - */ -#define SEQUENCE_LIST_GET_M(l) \ - ((uint8_t)(((l)->flags & SEQUENCE_LIST_M_BIT) == SEQUENCE_LIST_M_BIT)) - -/** - * \brief Get the Seed ID Length for an ICMPv6 sequence list - * l: pointer to a sequence list structure - */ -#define SEQUENCE_LIST_GET_S(l) \ - ((uint8_t)(((l)->flags & SEQUENCE_LIST_S_BIT) == SEQUENCE_LIST_S_BIT)) -/*---------------------------------------------------------------------------*/ -/* Trickle Multicast HBH Option */ -struct hbho_mcast { - uint8_t type; - uint8_t len; -#if ROLL_TM_SHORT_SEEDS - seed_id_t seed_id; -#endif - uint8_t flags; /* M, Seq ID MSB */ - uint8_t seq_id_lsb; -#if !ROLL_TM_SHORT_SEEDS - /* Need to Pad to 8 bytes with PadN */ - uint8_t padn_type; /* 1: PadN */ - uint8_t padn_len; /* 0->2 bytes */ -#endif -}; - -#define HBHO_OPT_TYPE_TRICKLE 0x0C -#define HBHO_LEN_LONG_SEED 2 -#define HBHO_LEN_SHORT_SEED 4 -#define HBHO_TOTAL_LEN 8 -/** - * \brief Get the Trickle Parametrization for a multicast HBHO header - * m: pointer to the HBHO header - */ -#define HBH_GET_M(h) (((h)->flags & 0x80) == 0x80) - -/** - * \brief Set the Trickle Parametrization bit for a multicast HBHO header - * m: pointer to the HBHO header - */ -#define HBH_SET_M(h) ((h)->flags |= 0x80) - -/** - * \brief Retrieve the Sequence Value MSB from a multicast HBHO header - * m: pointer to the HBHO header - */ -#define HBH_GET_SV_MSB(h) ((h)->flags & 0x7F) -/*---------------------------------------------------------------------------*/ -/* Destination for our ICMPv6 datagrams */ -#if ROLL_TM_CONF_DEST_ALL_NODES -#define roll_tm_create_dest(a) uip_create_linklocal_allnodes_mcast(a) -#else -#define roll_tm_create_dest(a) uip_create_linklocal_allrouters_mcast(a) -#endif -/*---------------------------------------------------------------------------*/ -/* Maintain Stats */ -#if UIP_MCAST6_STATS -static struct roll_tm_stats stats; - -#define ROLL_TM_STATS_ADD(x) stats.x++ -#define ROLL_TM_STATS_INIT() do { memset(&stats, 0, sizeof(stats)); } while(0) -#else /* UIP_MCAST6_STATS */ -#define ROLL_TM_STATS_ADD(x) -#define ROLL_TM_STATS_INIT() -#endif -/*---------------------------------------------------------------------------*/ -/* Internal Data Structures */ -/*---------------------------------------------------------------------------*/ -static struct trickle_param t[2]; -static struct sliding_window windows[ROLL_TM_WINS]; -static struct mcast_packet buffered_msgs[ROLL_TM_BUFF_NUM]; -/*---------------------------------------------------------------------------*/ -/* Temporary Stores */ -/*---------------------------------------------------------------------------*/ -static struct trickle_param *loctpptr; -static struct sequence_list_header *locslhptr; -static struct sliding_window *locswptr; -static struct sliding_window *iterswptr; -static struct mcast_packet *locmpptr; -static struct hbho_mcast *lochbhmptr; -static uint16_t last_seq; -/*---------------------------------------------------------------------------*/ -/* uIPv6 Pointers */ -/*---------------------------------------------------------------------------*/ -#define UIP_EXT_BUF ((struct uip_ext_hdr *)UIP_IP_PAYLOAD(0)) -#define UIP_EXT_BUF_NEXT ((uint8_t *)(UIP_IP_PAYLOAD(HBHO_TOTAL_LEN))) -#define UIP_EXT_OPT_FIRST ((struct hbho_mcast *)(UIP_IP_PAYLOAD(0) + 2)) -extern uint16_t uip_slen; -/*---------------------------------------------------------------------------*/ -/* Local function prototypes */ -/*---------------------------------------------------------------------------*/ -static void icmp_input(void); -static void icmp_output(void); -static void window_update_bounds(void); -static void reset_trickle_timer(uint8_t); -static void handle_timer(void *); -/*---------------------------------------------------------------------------*/ -/* ROLL TM ICMPv6 handler declaration */ -UIP_ICMP6_HANDLER(roll_tm_icmp_handler, ICMP6_ROLL_TM, - UIP_ICMP6_HANDLER_CODE_ANY, icmp_input); -/*---------------------------------------------------------------------------*/ -/* Return a random number in [I/2, I), for a timer with Imin when the timer's - * current number of doublings is d */ -static clock_time_t -random_interval(clock_time_t i_min, uint8_t d) -{ - clock_time_t min = TRICKLE_TIME(i_min >> 1, d); - - VERBOSE_PRINTF("ROLL TM: Random [%lu, %lu)\n", (unsigned long)min, - (unsigned long)(TRICKLE_TIME(i_min, d))); - - return min + (random_rand() % (TRICKLE_TIME(i_min, d) - 1 - min)); -} -/*---------------------------------------------------------------------------*/ -/* Called at the end of the current interval for timer ptr */ -static void -double_interval(void *ptr) -{ - struct trickle_param *param = (struct trickle_param *)ptr; - int16_t offset; - clock_time_t next; - - /* - * If we got called long past our expiration, store the offset and try to - * compensate this period - */ - offset = (int16_t)(clock_time() - param->t_end); - - /* Calculate next interval */ - if(param->i_current < param->i_max) { - param->i_current++; - } - - param->t_start = param->t_end; - param->t_end = param->t_start + (param->i_min << param->i_current); - - next = random_interval(param->i_min, param->i_current); - if(next > offset) { - next -= offset; - } else { - next = 0; - } - param->t_next = next; - ctimer_set(¶m->ct, param->t_next, handle_timer, (void *)param); - - VERBOSE_PRINTF("ROLL TM: Doubling at %lu (offset %d), Start %lu, End %lu," - " Periodic in %lu\n", clock_time(), offset, - (unsigned long)param->t_start, - (unsigned long)param->t_end, (unsigned long)param->t_next); -} -/*---------------------------------------------------------------------------*/ -/* - * Called at a random point in [I/2,I) of the current interval for ptr - * PARAM is a pointer to the timer that triggered the callback (&t[index]) - */ -static void -handle_timer(void *ptr) -{ - struct trickle_param *param; - clock_time_t diff_last; /* Time diff from last pass */ - clock_time_t diff_start; /* Time diff from interval start */ - uint8_t m; - - param = (struct trickle_param *)ptr; - if(param == &t[0]) { - m = 0; - } else if(param == &t[1]) { - m = 1; - } else { - /* This is an ooops and a serious one too */ - return; - } - - /* Bail out pronto if our uIPv6 stack is not ready to send messages */ - if(uip_ds6_get_link_local(ADDR_PREFERRED) == NULL) { - VERBOSE_PRINTF - ("ROLL TM: Suppressing timer processing. Stack not ready\n"); - reset_trickle_timer(m); - return; - } - - VERBOSE_PRINTF("ROLL TM: M=%u Periodic at %lu, last=%lu\n", - m, (unsigned long)clock_time(), - (unsigned long)param->t_last_trigger); - - /* Temporarily store 'now' in t_next and calculate diffs */ - param->t_next = clock_time(); - diff_last = param->t_next - param->t_last_trigger; - diff_start = param->t_next - param->t_start; - param->t_last_trigger = param->t_next; - - VERBOSE_PRINTF - ("ROLL TM: M=%u Periodic diff from last %lu, from start %lu\n", m, - (unsigned long)diff_last, (unsigned long)diff_start); - - /* Handle all buffered messages */ - for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1]; - locmpptr >= buffered_msgs; locmpptr--) { - if(MCAST_PACKET_IS_USED(locmpptr) - && (SLIDING_WINDOW_GET_M(locmpptr->sw) == m)) { - - /* - * if() - * If the packet was received during the last interval, its reception - * caused an inconsistency (and thus a timer reset). This means that - * the packet was received at about t_start, we increment by diff_start - * - * else() - * If the packet was not received during the last window, it is safe to - * increase its lifetime counters by the time diff from last pass - * - * if active == dwell == 0 but i_current != 0, this is an oops - * (new packet that didn't reset us). We don't handle it - */ - if(locmpptr->active == 0) { - locmpptr->active += diff_start; - locmpptr->dwell += diff_start; - } else { - locmpptr->active += diff_last; - locmpptr->dwell += diff_last; - } - - VERBOSE_PRINTF("ROLL TM: M=%u Packet %u active %lu of %lu\n", - m, locmpptr->seq_val, locmpptr->active, - TRICKLE_ACTIVE(param)); - - if(locmpptr->dwell > TRICKLE_DWELL(param)) { - locmpptr->sw->count--; - PRINTF("ROLL TM: M=%u Free Packet %u (%lu > %lu), Window now at %u\n", - m, locmpptr->seq_val, locmpptr->dwell, - TRICKLE_DWELL(param), locmpptr->sw->count); - if(locmpptr->sw->count == 0) { - PRINTF("ROLL TM: M=%u Free Window ", m); - PRINT_SEED(&locmpptr->sw->seed_id); - PRINTF("\n"); - window_free(locmpptr->sw); - } - MCAST_PACKET_FREE(locmpptr); - } else if(MCAST_PACKET_TTL(locmpptr) > 0) { - /* Handle multicast transmissions */ - if(locmpptr->active < TRICKLE_ACTIVE(param) && - ((SUPPRESSION_ENABLED(param) && MCAST_PACKET_MUST_SEND(locmpptr)) || - SUPPRESSION_DISABLED(param))) { - PRINTF("ROLL TM: M=%u Periodic - Sending packet from Seed ", m); - PRINT_SEED(&locmpptr->sw->seed_id); - PRINTF(" seq %u\n", locmpptr->seq_val); - uip_len = locmpptr->buff_len; - memcpy(UIP_IP_BUF, &locmpptr->buff, uip_len); - - UIP_MCAST6_STATS_ADD(mcast_fwd); - tcpip_output(NULL); - MCAST_PACKET_SEND_CLR(locmpptr); - watchdog_periodic(); - } - } - } - } - - /* Suppression Enabled - Send an ICMP */ - if(SUPPRESSION_ENABLED(param)) { - if(param->c < param->k) { - icmp_output(); - } - } - - /* Done handling inconsistencies for this timer */ - param->inconsistency = 0; - param->c = 0; - - window_update_bounds(); - - /* Temporarily store 'now' in t_next */ - param->t_next = clock_time(); - if(param->t_next >= param->t_end) { - /* took us too long to process things, double interval asap */ - param->t_next = 0; - } else { - param->t_next = param->t_end - param->t_next; - } - VERBOSE_PRINTF - ("ROLL TM: M=%u Periodic at %lu, Interval End at %lu in %lu\n", m, - (unsigned long)clock_time(), (unsigned long)param->t_end, - (unsigned long)param->t_next); - ctimer_set(¶m->ct, param->t_next, double_interval, (void *)param); - - return; -} -/*---------------------------------------------------------------------------*/ -static void -reset_trickle_timer(uint8_t index) -{ - t[index].t_start = clock_time(); - t[index].t_end = t[index].t_start + (t[index].i_min); - t[index].i_current = 0; - t[index].c = 0; - t[index].t_next = random_interval(t[index].i_min, t[index].i_current); - - VERBOSE_PRINTF - ("ROLL TM: M=%u Reset at %lu, Start %lu, End %lu, New Interval %lu\n", - index, (unsigned long)t[index].t_start, (unsigned long)t[index].t_start, - (unsigned long)t[index].t_end, (unsigned long)t[index].t_next); - - ctimer_set(&t[index].ct, t[index].t_next, handle_timer, (void *)&t[index]); -} -/*---------------------------------------------------------------------------*/ -static struct sliding_window * -window_allocate() -{ - for(iterswptr = &windows[ROLL_TM_WINS - 1]; iterswptr >= windows; - iterswptr--) { - if(!SLIDING_WINDOW_IS_USED(iterswptr)) { - iterswptr->count = 0; - iterswptr->lower_bound = -1; - iterswptr->upper_bound = -1; - iterswptr->min_listed = -1; - return iterswptr; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static struct sliding_window * -window_lookup(seed_id_t *s, uint8_t m) -{ - for(iterswptr = &windows[ROLL_TM_WINS - 1]; iterswptr >= windows; - iterswptr--) { - VERBOSE_PRINTF("ROLL TM: M=%u (%u) ", SLIDING_WINDOW_GET_M(iterswptr), m); - VERBOSE_PRINT_SEED(&iterswptr->seed_id); - VERBOSE_PRINTF("\n"); - if(seed_id_cmp(s, &iterswptr->seed_id) && - SLIDING_WINDOW_GET_M(iterswptr) == m) { - return iterswptr; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static void -window_update_bounds() -{ - for(iterswptr = &windows[ROLL_TM_WINS - 1]; iterswptr >= windows; - iterswptr--) { - iterswptr->lower_bound = -1; - } - - for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1]; - locmpptr >= buffered_msgs; locmpptr--) { - if(MCAST_PACKET_IS_USED(locmpptr)) { - iterswptr = locmpptr->sw; - VERBOSE_PRINTF("ROLL TM: Update Bounds: [%d - %d] vs %u\n", - iterswptr->lower_bound, iterswptr->upper_bound, - locmpptr->seq_val); - if(iterswptr->lower_bound < 0 - || SEQ_VAL_IS_LT(locmpptr->seq_val, iterswptr->lower_bound)) { - iterswptr->lower_bound = locmpptr->seq_val; - } - if(iterswptr->upper_bound < 0 || - SEQ_VAL_IS_GT(locmpptr->seq_val, iterswptr->upper_bound)) { - iterswptr->upper_bound = locmpptr->seq_val; - } - } - } -} -/*---------------------------------------------------------------------------*/ -static struct mcast_packet * -buffer_reclaim() -{ - struct sliding_window *largest = windows; - struct mcast_packet *rv; - - for(iterswptr = &windows[ROLL_TM_WINS - 1]; iterswptr >= windows; - iterswptr--) { - if(iterswptr->count > largest->count) { - largest = iterswptr; - } - } - - if(largest->count == 1) { - /* Can't reclaim last entry for a window and this is the largest window */ - return NULL; - } - - PRINTF("ROLL TM: Reclaim from Seed "); - PRINT_SEED(&largest->seed_id); - PRINTF(" M=%u, count was %u\n", - SLIDING_WINDOW_GET_M(largest), largest->count); - /* Find the packet at the lowest bound for the largest window */ - for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1]; - locmpptr >= buffered_msgs; locmpptr--) { - if(MCAST_PACKET_IS_USED(locmpptr) && (locmpptr->sw == largest) && - SEQ_VAL_IS_EQ(locmpptr->seq_val, largest->lower_bound)) { - rv = locmpptr; - PRINTF("ROLL TM: Reclaim seq. val %u\n", locmpptr->seq_val); - MCAST_PACKET_FREE(rv); - largest->count--; - window_update_bounds(); - VERBOSE_PRINTF("ROLL TM: Reclaim - new bounds [%u , %u]\n", - largest->lower_bound, largest->upper_bound); - return rv; - } - } - - /* oops */ - return NULL; -} -/*---------------------------------------------------------------------------*/ -static struct mcast_packet * -buffer_allocate() -{ - for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1]; - locmpptr >= buffered_msgs; locmpptr--) { - if(!MCAST_PACKET_IS_USED(locmpptr)) { - return locmpptr; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static void -icmp_output() -{ - struct sequence_list_header *sl; - uint8_t *buffer; - uint16_t payload_len; - - PRINTF("ROLL TM: ICMPv6 Out\n"); - - UIP_IP_BUF->vtc = 0x60; - UIP_IP_BUF->tcflow = 0; - UIP_IP_BUF->flow = 0; - UIP_IP_BUF->proto = UIP_PROTO_ICMP6; - UIP_IP_BUF->ttl = ROLL_TM_IP_HOP_LIMIT; - - sl = (struct sequence_list_header *)UIP_ICMP_PAYLOAD; - payload_len = 0; - - VERBOSE_PRINTF("ROLL TM: ICMPv6 Out - Hdr @ %p, payload @ %p\n", UIP_ICMP_BUF, sl); - - for(iterswptr = &windows[ROLL_TM_WINS - 1]; iterswptr >= windows; - iterswptr--) { - if(SLIDING_WINDOW_IS_USED(iterswptr) && iterswptr->count > 0) { - memset(sl, 0, sizeof(struct sequence_list_header)); -#if ROLL_TM_SHORT_SEEDS - sl->flags = SEQUENCE_LIST_S_BIT; -#endif - if(SLIDING_WINDOW_GET_M(iterswptr)) { - sl->flags |= SEQUENCE_LIST_M_BIT; - } - seed_id_cpy(&sl->seed_id, &iterswptr->seed_id); - - PRINTF("ROLL TM: ICMPv6 Out - Seq. F=0x%02x, Seed ID=", sl->flags); - PRINT_SEED(&sl->seed_id); - - buffer = (uint8_t *)sl + sizeof(struct sequence_list_header); - - for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1]; - locmpptr >= buffered_msgs; locmpptr--) { - if(MCAST_PACKET_IS_USED(locmpptr) && - locmpptr->active < TRICKLE_ACTIVE((&t[SLIDING_WINDOW_GET_M(iterswptr)]))) { - if(locmpptr->sw == iterswptr) { - sl->seq_len++; - PRINTF(", %u", locmpptr->seq_val); - *buffer = (uint8_t)(locmpptr->seq_val >> 8); - buffer++; - *buffer = (uint8_t)(locmpptr->seq_val & 0xFF); - buffer++; - } - } - } - PRINTF(", Len=%u\n", sl->seq_len); - - /* Scrap the entire window if it has no content */ - if(sl->seq_len > 0) { - payload_len += sizeof(struct sequence_list_header) + sl->seq_len * 2; - sl = (struct sequence_list_header *)buffer; - } - } - } - - if(payload_len == 0) { - VERBOSE_PRINTF("ROLL TM: ICMPv6 Out - nothing to send\n"); - return; - } - - roll_tm_create_dest(&UIP_IP_BUF->destipaddr); - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - - uipbuf_set_len_field(UIP_IP_BUF, UIP_ICMPH_LEN + payload_len); - - UIP_ICMP_BUF->type = ICMP6_ROLL_TM; - UIP_ICMP_BUF->icode = ROLL_TM_ICMP_CODE; - - UIP_ICMP_BUF->icmpchksum = 0; - UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); - - uip_len = UIP_IPH_LEN + UIP_ICMPH_LEN + payload_len; - - VERBOSE_PRINTF("ROLL TM: ICMPv6 Out - %u bytes\n", payload_len); - - tcpip_ipv6_output(); - ROLL_TM_STATS_ADD(icmp_out); - return; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Processes an incoming or outgoing multicast message and determines - * whether it should be dropped or accepted - * - * \param in 1: Incoming packet, 0: Outgoing (we are the seed) - * - * \return 0: Drop, 1: Accept - */ -static uint8_t -accept(uint8_t in) -{ - seed_id_t *seed_ptr; - uint8_t m; - uint16_t seq_val; - - PRINTF("ROLL TM: Multicast I/O\n"); - -#if UIP_CONF_IPV6_CHECKS - if(uip_is_addr_mcast_non_routable(&UIP_IP_BUF->destipaddr)) { - PRINTF("ROLL TM: Mcast I/O, bad destination\n"); - UIP_MCAST6_STATS_ADD(mcast_bad); - return UIP_MCAST6_DROP; - } - /* - * Abort transmission if the v6 src is unspecified. This may happen if the - * seed tries to TX while it's still performing DAD or waiting for a prefix - */ - if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) { - PRINTF("ROLL TM: Mcast I/O, bad source\n"); - UIP_MCAST6_STATS_ADD(mcast_bad); - return UIP_MCAST6_DROP; - } -#endif - - /* Check the Next Header field: Must be HBHO */ - if(UIP_IP_BUF->proto != UIP_PROTO_HBHO) { - PRINTF("ROLL TM: Mcast I/O, bad proto\n"); - UIP_MCAST6_STATS_ADD(mcast_bad); - return UIP_MCAST6_DROP; - } else { - /* Check the Option Type */ - if(UIP_EXT_OPT_FIRST->type != HBHO_OPT_TYPE_TRICKLE) { - PRINTF("ROLL TM: Mcast I/O, bad HBHO type\n"); - UIP_MCAST6_STATS_ADD(mcast_bad); - return UIP_MCAST6_DROP; - } - } - lochbhmptr = UIP_EXT_OPT_FIRST; - - PRINTF("ROLL TM: HBHO T=%u, L=%u, M=%u, S=0x%02x%02x\n", - lochbhmptr->type, lochbhmptr->len, HBH_GET_M(lochbhmptr), - HBH_GET_SV_MSB(lochbhmptr), lochbhmptr->seq_id_lsb); - - /* Drop unsupported Seed ID Lengths. S bit: 0->short, 1->long */ -#if ROLL_TM_SHORT_SEEDS - /* Short Seed ID: Len MUST be 4 */ - if(lochbhmptr->len != HBHO_LEN_SHORT_SEED) { - PRINTF("ROLL TM: Mcast I/O, bad length\n"); - UIP_MCAST6_STATS_ADD(mcast_bad); - return UIP_MCAST6_DROP; - } -#else - /* Long Seed ID: Len MUST be 2 (Seed ID is elided) */ - if(lochbhmptr->len != HBHO_LEN_LONG_SEED) { - PRINTF("ROLL TM: Mcast I/O, bad length\n"); - UIP_MCAST6_STATS_ADD(mcast_bad); - return UIP_MCAST6_DROP; - } -#endif - -#if UIP_MCAST6_STATS - if(in == ROLL_TM_DGRAM_IN) { - UIP_MCAST6_STATS_ADD(mcast_in_all); - } -#endif - - /* Is this for a known window? */ -#if ROLL_TM_SHORT_SEEDS - seed_ptr = &lochbhmptr->seed_id; -#else - seed_ptr = &UIP_IP_BUF->srcipaddr; -#endif - m = HBH_GET_M(lochbhmptr); - - locswptr = window_lookup(seed_ptr, m); - - seq_val = lochbhmptr->seq_id_lsb; - seq_val |= HBH_GET_SV_MSB(lochbhmptr) << 8; - - if(locswptr) { - if(SEQ_VAL_IS_LT(seq_val, locswptr->lower_bound)) { - /* Too old, drop */ - PRINTF("ROLL TM: Too old\n"); - UIP_MCAST6_STATS_ADD(mcast_dropped); - return UIP_MCAST6_DROP; - } - for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1]; - locmpptr >= buffered_msgs; locmpptr--) { - if(MCAST_PACKET_IS_USED(locmpptr) && - locmpptr->sw == locswptr && - SLIDING_WINDOW_GET_M(locmpptr->sw) == m && - SEQ_VAL_IS_EQ(seq_val, locmpptr->seq_val)) { - /* Seen before , drop */ - PRINTF("ROLL TM: Seen before\n"); - UIP_MCAST6_STATS_ADD(mcast_dropped); - return UIP_MCAST6_DROP; - } - } - } - - PRINTF("ROLL TM: New message\n"); - - /* We have not seen this message before */ - /* Allocate a window if we have to */ - if(!locswptr) { - locswptr = window_allocate(); - PRINTF("ROLL TM: New seed\n"); - } - if(!locswptr) { - /* Couldn't allocate window, drop */ - PRINTF("ROLL TM: Failed to allocate window\n"); - UIP_MCAST6_STATS_ADD(mcast_dropped); - return UIP_MCAST6_DROP; - } - - /* Allocate a buffer */ - locmpptr = buffer_allocate(); - if(!locmpptr) { - PRINTF("ROLL TM: Buffer allocation failed, reclaiming\n"); - locmpptr = buffer_reclaim(); - } - - if(!locmpptr) { - /* Failed to allocate / reclaim a buffer. If the window has only just been - * allocated, free it before dropping */ - PRINTF("ROLL TM: Buffer reclaim failed\n"); - if(locswptr->count == 0) { - window_free(locswptr); - UIP_MCAST6_STATS_ADD(mcast_dropped); - return UIP_MCAST6_DROP; - } - } -#if UIP_MCAST6_STATS - if(in == ROLL_TM_DGRAM_IN) { - UIP_MCAST6_STATS_ADD(mcast_in_unique); - } -#endif - - /* We have a window and we have a buffer. Accept this message */ - /* Set the seed ID and correct M for this window */ - SLIDING_WINDOW_M_CLR(locswptr); - if(m) { - SLIDING_WINDOW_M_SET(locswptr); - } - SLIDING_WINDOW_IS_USED_SET(locswptr); - seed_id_cpy(&locswptr->seed_id, seed_ptr); - PRINTF("ROLL TM: Window for seed "); - PRINT_SEED(&locswptr->seed_id); - PRINTF(" M=%u, count=%u\n", - SLIDING_WINDOW_GET_M(locswptr), locswptr->count); - - /* If this window was previously empty, set its lower bound to this packet */ - if(locswptr->count == 0) { - locswptr->lower_bound = seq_val; - VERBOSE_PRINTF("ROLL TM: New Lower Bound %u\n", locswptr->lower_bound); - } - - /* If this is a new Seq Num, update the window upper bound */ - if(locswptr->count == 0 || SEQ_VAL_IS_GT(seq_val, locswptr->upper_bound)) { - locswptr->upper_bound = seq_val; - VERBOSE_PRINTF("ROLL TM: New Upper Bound %u\n", locswptr->upper_bound); - } - - locswptr->count++; - - memset(locmpptr, 0, sizeof(struct mcast_packet)); - memcpy(&locmpptr->buff, UIP_IP_BUF, uip_len); - locmpptr->sw = locswptr; - locmpptr->buff_len = uip_len; - locmpptr->seq_val = seq_val; - MCAST_PACKET_USED_SET(locmpptr); - - PRINTF("ROLL TM: Window for seed "); - PRINT_SEED(&locswptr->seed_id); - PRINTF(" M=%u, %u values within [%u , %u]\n", - SLIDING_WINDOW_GET_M(locswptr), locswptr->count, - locswptr->lower_bound, locswptr->upper_bound); - - /* - * If this is an incoming packet, it is inconsistent and we need to decrement - * its TTL before we start forwarding it. - * If on the other hand we are the seed, the caller will trigger a - * transmission so we don't flag inconsistency and we leave the TTL alone - */ - if(in == ROLL_TM_DGRAM_IN) { - MCAST_PACKET_SEND_SET(locmpptr); - MCAST_PACKET_TTL(locmpptr)--; - - t[m].inconsistency = 1; - - PRINTF("ROLL TM: Inconsistency. Reset T%u\n", m); - reset_trickle_timer(m); - } - - /* Deliver if necessary */ - return UIP_MCAST6_ACCEPT; -} -/*---------------------------------------------------------------------------*/ -/* ROLL TM ICMPv6 Input Handler */ -static void -icmp_input() -{ - uint8_t inconsistency; - uint16_t *seq_ptr; - uint16_t *end_ptr; - uint16_t val; - -#if UIP_CONF_IPV6_CHECKS - if(!uip_is_addr_linklocal(&UIP_IP_BUF->srcipaddr)) { - PRINTF("ROLL TM: ICMPv6 In, bad source "); - PRINT6ADDR(&UIP_IP_BUF->srcipaddr); - PRINTF(" to "); - PRINT6ADDR(&UIP_IP_BUF->destipaddr); - PRINTF("\n"); - ROLL_TM_STATS_ADD(icmp_bad); - goto discard; - } - - if(!uip_is_addr_linklocal_allnodes_mcast(&UIP_IP_BUF->destipaddr) - && !uip_is_addr_linklocal_allrouters_mcast(&UIP_IP_BUF->destipaddr)) { - PRINTF("ROLL TM: ICMPv6 In, bad destination\n"); - ROLL_TM_STATS_ADD(icmp_bad); - goto discard; - } - - if(UIP_ICMP_BUF->icode != ROLL_TM_ICMP_CODE) { - PRINTF("ROLL TM: ICMPv6 In, bad ICMP code\n"); - ROLL_TM_STATS_ADD(icmp_bad); - goto discard; - } - - if(UIP_IP_BUF->ttl != ROLL_TM_IP_HOP_LIMIT) { - PRINTF("ROLL TM: ICMPv6 In, bad TTL\n"); - ROLL_TM_STATS_ADD(icmp_bad); - goto discard; - } -#endif - - PRINTF("ROLL TM: ICMPv6 In from "); - PRINT6ADDR(&UIP_IP_BUF->srcipaddr); - PRINTF(" len %u, ext %u\n", uip_len, uip_ext_len); - - ROLL_TM_STATS_ADD(icmp_in); - - /* Reset Is-Listed bit for all windows */ - for(iterswptr = &windows[ROLL_TM_WINS - 1]; iterswptr >= windows; - iterswptr--) { - SLIDING_WINDOW_LISTED_CLR(iterswptr); - } - - /* Reset Is-Listed bit for all cached packets */ - for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1]; - locmpptr >= buffered_msgs; locmpptr--) { - MCAST_PACKET_LISTED_CLR(locmpptr); - } - - locslhptr = (struct sequence_list_header *)UIP_ICMP_PAYLOAD; - - VERBOSE_PRINTF("ROLL TM: ICMPv6 In, parse from %p to %p\n", - UIP_ICMP_PAYLOAD, - (uint8_t *)UIP_ICMP_PAYLOAD + uip_len - - uip_l3_icmp_hdr_len); - while(locslhptr < - (struct sequence_list_header *)((uint8_t *)UIP_ICMP_PAYLOAD + - uip_len - uip_l3_icmp_hdr_len)) { - VERBOSE_PRINTF("ROLL TM: ICMPv6 In, seq hdr @ %p\n", locslhptr); - - if((locslhptr->flags & SEQUENCE_LIST_RES) != 0) { - PRINTF("ROLL TM: ICMPv6 In, non-zero reserved bits\n"); - goto drop; - } - - /* Drop unsupported Seed ID Lengths. S bit: 0->short, 1->long */ -#if ROLL_TM_SHORT_SEEDS - if(!SEQUENCE_LIST_GET_S(locslhptr)) { - ROLL_TM_STATS_ADD(icmp_bad); - goto drop; - } -#else - if(SEQUENCE_LIST_GET_S(locslhptr)) { - ROLL_TM_STATS_ADD(icmp_bad); - goto drop; - } -#endif - - PRINTF("ROLL TM: ICMPv6 In, Sequence List for Seed ID "); - PRINT_SEED(&locslhptr->seed_id); - PRINTF(" M=%u, S=%u, Len=%u\n", SEQUENCE_LIST_GET_M(locslhptr), - SEQUENCE_LIST_GET_S(locslhptr), locslhptr->seq_len); - - seq_ptr = (uint16_t *)((uint8_t *)locslhptr - + sizeof(struct sequence_list_header)); - end_ptr = (uint16_t *)((uint8_t *)locslhptr - + sizeof(struct sequence_list_header) + - locslhptr->seq_len * 2); - - /* Fetch a pointer to the corresponding trickle timer */ - loctpptr = &t[SEQUENCE_LIST_GET_M(locslhptr)]; - - locswptr = NULL; - - /* Find the sliding window for this Seed ID */ - locswptr = window_lookup(&locslhptr->seed_id, - SEQUENCE_LIST_GET_M(locslhptr)); - - /* If we have a window, iterate sequence values and check consistency */ - if(locswptr) { - SLIDING_WINDOW_LISTED_SET(locswptr); - locswptr->min_listed = -1; - PRINTF("ROLL TM: ICMPv6 In, Window bounds [%u , %u]\n", - locswptr->lower_bound, locswptr->upper_bound); - for(; seq_ptr < end_ptr; seq_ptr++) { - /* Check for "They have new" */ - /* If an advertised seq. val is GT our upper bound */ - val = uip_htons(*seq_ptr); - PRINTF("ROLL TM: ICMPv6 In, Check seq %u @ %p\n", val, seq_ptr); - if(SEQ_VAL_IS_GT(val, locswptr->upper_bound)) { - PRINTF("ROLL TM: Inconsistency - Advertised Seq. ID %u GT upper" - " bound %u\n", val, locswptr->upper_bound); - loctpptr->inconsistency = 1; - } - - /* If an advertised seq. val is within our bounds */ - if((SEQ_VAL_IS_LT(val, locswptr->upper_bound) || - SEQ_VAL_IS_EQ(val, locswptr->upper_bound)) && - (SEQ_VAL_IS_GT(val, locswptr->lower_bound) || - SEQ_VAL_IS_EQ(val, locswptr->lower_bound))) { - - inconsistency = 1; - /* Check if the advertised sequence is in our buffer */ - for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1]; - locmpptr >= buffered_msgs; locmpptr--) { - if(MCAST_PACKET_IS_USED(locmpptr) && locmpptr->sw == locswptr) { - if(SEQ_VAL_IS_EQ(locmpptr->seq_val, val)) { - - inconsistency = 0; - MCAST_PACKET_LISTED_SET(locmpptr); - PRINTF("ROLL TM: ICMPv6 In, %u listed\n", locmpptr->seq_val); - - /* Update lowest seq. num listed for this window - * We need this to check for "we have new" */ - if(locswptr->min_listed == -1 || - SEQ_VAL_IS_LT(val, locswptr->min_listed)) { - locswptr->min_listed = val; - } - break; - } - } - } - if(inconsistency) { - PRINTF("ROLL TM: Inconsistency - "); - PRINTF("Advertised Seq. ID %u within bounds", val); - PRINTF(" [%u, %u] but no matching entry\n", - locswptr->lower_bound, locswptr->upper_bound); - loctpptr->inconsistency = 1; - } - } - } - } else { - /* A new sliding window in an ICMP message is not explicitly stated - * in the draft as inconsistency. Until this is clarified, we consider - * this to be a point where we diverge from the draft for performance - * improvement reasons (or as some would say, 'this is an extension') */ - PRINTF("ROLL TM: Inconsistency - Advertised window unknown to us\n"); - loctpptr->inconsistency = 1; - } - locslhptr = (struct sequence_list_header *)(((uint8_t *)locslhptr) + - sizeof(struct sequence_list_header) + (2 * locslhptr->seq_len)); - } - /* Done parsing the message */ - - /* Check for "We have new */ - PRINTF("ROLL TM: ICMPv6 In, Check our buffer\n"); - for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1]; - locmpptr >= buffered_msgs; locmpptr--) { - if(MCAST_PACKET_IS_USED(locmpptr)) { - locswptr = locmpptr->sw; - PRINTF("ROLL TM: ICMPv6 In, "); - PRINTF("Check %u, Seed L: %u, This L: %u Min L: %d\n", - locmpptr->seq_val, SLIDING_WINDOW_IS_LISTED(locswptr), - MCAST_PACKET_IS_LISTED(locmpptr), locswptr->min_listed); - - /* Point to the sliding window's trickle param */ - loctpptr = &t[SLIDING_WINDOW_GET_M(locswptr)]; - if(!SLIDING_WINDOW_IS_LISTED(locswptr)) { - /* If a buffered packet's Seed ID was not listed */ - PRINTF("ROLL TM: Inconsistency - Seed ID "); - PRINT_SEED(&locswptr->seed_id); - PRINTF(" was not listed\n"); - loctpptr->inconsistency = 1; - MCAST_PACKET_SEND_SET(locmpptr); - } else { - /* This packet was not listed but a prior one was */ - if(!MCAST_PACKET_IS_LISTED(locmpptr) && - (locswptr->min_listed >= 0) && - SEQ_VAL_IS_GT(locmpptr->seq_val, locswptr->min_listed)) { - PRINTF("ROLL TM: Inconsistency - "); - PRINTF("Seq. %u was not listed but %u was\n", - locmpptr->seq_val, locswptr->min_listed); - loctpptr->inconsistency = 1; - MCAST_PACKET_SEND_SET(locmpptr); - } - } - } - } - -drop: - - if(t[0].inconsistency) { - reset_trickle_timer(0); - } else { - t[0].c++; - } - if(t[1].inconsistency) { - reset_trickle_timer(1); - } else { - t[1].c++; - } - -discard: - - uip_len = 0; - return; -} -/*---------------------------------------------------------------------------*/ -static void -out() -{ - - if(uip_len + HBHO_TOTAL_LEN > UIP_BUFSIZE) { - PRINTF("ROLL TM: Multicast Out can not add HBHO. Packet too long\n"); - goto drop; - } - - /* Slide 'right' by HBHO_TOTAL_LEN bytes */ - memmove(UIP_EXT_BUF_NEXT, UIP_EXT_BUF, uip_len - UIP_IPH_LEN); - memset(UIP_EXT_BUF, 0, HBHO_TOTAL_LEN); - - UIP_EXT_BUF->next = UIP_IP_BUF->proto; - UIP_EXT_BUF->len = 0; - - lochbhmptr = UIP_EXT_OPT_FIRST; - lochbhmptr->type = HBHO_OPT_TYPE_TRICKLE; - - /* Set the sequence ID */ - last_seq = SEQ_VAL_ADD(last_seq, 1); - lochbhmptr->flags = last_seq >> 8; - lochbhmptr->seq_id_lsb = last_seq & 0xFF; -#if ROLL_TM_SHORT_SEEDS - seed_id_cpy(&lochbhmptr->seed_id, &uip_lladdr.addr[UIP_LLADDR_LEN - 2]); - lochbhmptr->len = HBHO_LEN_SHORT_SEED; -#else - lochbhmptr->len = HBHO_LEN_LONG_SEED; - /* PadN */ - lochbhmptr->padn_type = UIP_EXT_HDR_OPT_PADN; - lochbhmptr->padn_len = 0; -#endif - - /* Set the M bit for our outgoing messages, if necessary */ -#if ROLL_TM_SET_M_BIT - HBH_SET_M(lochbhmptr); -#endif - - uipbuf_add_ext_hdr(HBHO_TOTAL_LEN); - - /* Update the proto and length field in the v6 header */ - UIP_IP_BUF->proto = UIP_PROTO_HBHO; - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - - PRINTF("ROLL TM: Multicast Out, HBHO: T=%u, L=%u, M=%u, S=0x%02x%02x\n", - lochbhmptr->type, lochbhmptr->len, HBH_GET_M(lochbhmptr), - HBH_GET_SV_MSB(lochbhmptr), lochbhmptr->seq_id_lsb); - - /* - * We need to remember this message and advertise it in subsequent ICMP - * messages. Otherwise, our neighs will think we are inconsistent and will - * bounce it back to us. - * - * Queue this message but don't set its MUST_SEND flag. We reset the trickle - * timer and we send it immediately. We then set uip_len = 0 to stop the core - * from re-sending it. - */ - if(accept(ROLL_TM_DGRAM_OUT)) { - tcpip_output(NULL); - UIP_MCAST6_STATS_ADD(mcast_out); - } - -drop: - uip_slen = 0; - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -in() -{ - /* - * We call accept() which will sort out caching and forwarding. Depending - * on accept()'s return value, we then need to signal the core - * whether to deliver this to higher layers - */ - if(accept(ROLL_TM_DGRAM_IN) == UIP_MCAST6_DROP) { - return UIP_MCAST6_DROP; - } - - if(!uip_ds6_is_my_maddr(&UIP_IP_BUF->destipaddr)) { - PRINTF("ROLL TM: Not a group member. No further processing\n"); - return UIP_MCAST6_DROP; - } else { - PRINTF("ROLL TM: Ours. Deliver to upper layers\n"); - UIP_MCAST6_STATS_ADD(mcast_in_ours); - return UIP_MCAST6_ACCEPT; - } -} -/*---------------------------------------------------------------------------*/ -static void -init() -{ - PRINTF("ROLL TM: ROLL Multicast - Draft #%u\n", ROLL_TM_VER); - - memset(windows, 0, sizeof(windows)); - memset(buffered_msgs, 0, sizeof(buffered_msgs)); - memset(t, 0, sizeof(t)); - - ROLL_TM_STATS_INIT(); - UIP_MCAST6_STATS_INIT(&stats); - - /* Register the ICMPv6 input handler */ - uip_icmp6_register_input_handler(&roll_tm_icmp_handler); - - for(iterswptr = &windows[ROLL_TM_WINS - 1]; iterswptr >= windows; - iterswptr--) { - iterswptr->lower_bound = -1; - iterswptr->upper_bound = -1; - iterswptr->min_listed = -1; - } - - TIMER_CONFIGURE(0); - reset_trickle_timer(0); - TIMER_CONFIGURE(1); - reset_trickle_timer(1); - return; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief The ROLL TM engine driver - */ -const struct uip_mcast6_driver roll_tm_driver = { - "ROLL TM", - init, - out, - in, -}; -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/multicast/roll-tm.h b/os/net/ipv6/multicast/roll-tm.h deleted file mode 100644 index 8f69d6d01..000000000 --- a/os/net/ipv6/multicast/roll-tm.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2011, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup uip-multicast - * @{ - */ -/** - * \defgroup roll-tm ROLL Trickle Multicast - * - * IPv6 multicast according to the algorithm in the - * "MCAST Forwarding Using Trickle" internet draft. - * - * The current version of the draft can always be found in - * http://tools.ietf.org/html/draft-ietf-roll-trickle-mcast - * - * This implementation is based on the draft version stored in - * ROLL_TM_VER. - * - * In draft v2, the document was renamed to - * "Multicast Protocol for Low power and Lossy Networks (MPL)" - * Due to very significant changes between draft versions 1 and 2, - * MPL will be implemented as a separate engine and this file here - * will provide legacy support for Draft v1. - * @{ - */ -/** - * \file - * Header file for the implementation of the ROLL-TM multicast engine - * \author - * George Oikonomou - - */ - -#ifndef ROLL_TM_H_ -#define ROLL_TM_H_ - -#include "contiki.h" -#include "net/ipv6/multicast/uip-mcast6-stats.h" - -#include -/*---------------------------------------------------------------------------*/ -/* Protocol Constants */ -/*---------------------------------------------------------------------------*/ -#define ROLL_TM_VER 1 /**< Supported Draft Version */ -#define ROLL_TM_ICMP_CODE 0 /**< ROLL TM ICMPv6 code field */ -#define ROLL_TM_IP_HOP_LIMIT 0xFF /**< Hop limit for ICMP messages */ -#define ROLL_TM_INFINITE_REDUNDANCY 0xFF -#define ROLL_TM_DGRAM_OUT 0 -#define ROLL_TM_DGRAM_IN 1 - -/* - * The draft does not currently specify a default number for the trickle - * interval nor a way to derive it. Examples however hint at 100 msec. - * - * In draft terminology, we use an 'aggressive' policy (M=0) and a conservative - * one (M=1). - * - * When experimenting with the two policies on the sky platform, - * an interval of 125ms proves to be way too low: When we have traffic, - * doublings happen after the interval end and periodics fire after point T - * within the interval (and sometimes even after interval end). When traffic - * settles down, the code compensates the offsets. - * - * We consider 125, 250ms etc because they are nice divisors of 1 sec - * (quotient is power of two). For some machines (e.g sky/msp430), - * this is also a nice number of clock ticks - * - * After experimentation, the values of Imin leading to best performance are: - * ContikiMAC: Imin=64 (500ms) - * Null RDC: imin=16 (125ms) - */ - -/* Configuration for Timer with M=0 (aggressive) */ -#ifdef ROLL_TM_CONF_IMIN_0 -#define ROLL_TM_IMIN_0 ROLL_TM_CONF_IMIN_0 -#else -#define ROLL_TM_IMIN_0 32 /* 250 msec */ -#endif - -#ifdef ROLL_TM_CONF_IMAX_0 -#define ROLL_TM_IMAX_0 ROLL_TM_CONF_IMAX_0 -#else -#define ROLL_TM_IMAX_0 1 /* Imax = 500ms */ -#endif - -#ifdef ROLL_TM_CONF_K_0 -#define ROLL_TM_K_0 ROLL_TM_CONF_K_0 -#else -#define ROLL_TM_K_0 ROLL_TM_INFINITE_REDUNDANCY -#endif - -#ifdef ROLL_TM_CONF_T_ACTIVE_0 -#define ROLL_TM_T_ACTIVE_0 ROLL_TM_CONF_T_ACTIVE_0 -#else -#define ROLL_TM_T_ACTIVE_0 3 -#endif - -#ifdef ROLL_TM_CONF_T_DWELL_0 -#define ROLL_TM_T_DWELL_0 ROLL_TM_CONF_T_DWELL_0 -#else -#define ROLL_TM_T_DWELL_0 11 -#endif - -/* Configuration for Timer with M=1 (conservative) */ -#ifdef ROLL_TM_CONF_IMIN_1 -#define ROLL_TM_IMIN_1 ROLL_TM_CONF_IMIN_1 -#else -#define ROLL_TM_IMIN_1 64 /* 500 msec */ -#endif - -#ifdef ROLL_TM_CONF_IMAX_1 -#define ROLL_TM_IMAX_1 ROLL_TM_CONF_IMAX_1 -#else -#define ROLL_TM_IMAX_1 9 /* Imax = 256 secs */ -#endif - -#ifdef ROLL_TM_CONF_K_1 -#define ROLL_TM_K_1 ROLL_TM_CONF_K_1 -#else -#define ROLL_TM_K_1 1 -#endif - -#ifdef ROLL_TM_CONF_T_ACTIVE_1 -#define ROLL_TM_T_ACTIVE_1 ROLL_TM_CONF_T_ACTIVE_1 -#else -#define ROLL_TM_T_ACTIVE_1 3 -#endif - -#ifdef ROLL_TM_CONF_T_DWELL_1 -#define ROLL_TM_T_DWELL_1 ROLL_TM_CONF_T_DWELL_1 -#else -#define ROLL_TM_T_DWELL_1 12 -#endif -/*---------------------------------------------------------------------------*/ -/* Configuration */ -/*---------------------------------------------------------------------------*/ -/** - * Number of Sliding Windows - * In essence: How many unique sources of simultaneous multicast traffic do we - * want to support for our lowpan - * If a node is seeding two multicast streams, parametrized on different M - * values, then this seed will occupy two different sliding windows - */ -#ifdef ROLL_TM_CONF_WINS -#define ROLL_TM_WINS ROLL_TM_CONF_WINS -#else -#define ROLL_TM_WINS 2 -#endif -/*---------------------------------------------------------------------------*/ -/** - * Maximum Number of Buffered Multicast Messages - * This buffer is shared across all Seed IDs, therefore a new very active Seed - * may eventually occupy all slots. It would make little sense (if any) to - * define support for fewer buffered messages than seeds*2 - */ -#ifdef ROLL_TM_CONF_BUFF_NUM -#define ROLL_TM_BUFF_NUM ROLL_TM_CONF_BUFF_NUM -#else -#define ROLL_TM_BUFF_NUM 6 -#endif -/*---------------------------------------------------------------------------*/ -/** - * Use Short Seed IDs [short: 2, long: 16 (default)] - * It can be argued that we should (and it would be easy to) support both at - * the same time but the draft doesn't list this as a MUST so we opt for - * code/ram savings - */ -#ifdef ROLL_TM_CONF_SHORT_SEEDS -#define ROLL_TM_SHORT_SEEDS ROLL_TM_CONF_SHORT_SEEDS -#else -#define ROLL_TM_SHORT_SEEDS 0 -#endif -/*---------------------------------------------------------------------------*/ -/** - * Destination address for our ICMPv6 advertisements. The draft gives us a - * choice between LL all-nodes or LL all-routers - * - * We use allrouters unless a conf directive chooses otherwise - */ -#ifdef ROLL_TM_CONF_DEST_ALL_NODES -#define ROLL_TM_DEST_ALL_NODES ROLL_TM_CONF_DEST_ALL_NODES -#else -#define ROLL_TM_DEST_ALL_NODES 0 -#endif -/*---------------------------------------------------------------------------*/ -/** - * M param for our outgoing messages - * By default, we set the M bit (conservative). Define this as 0 to clear the - * M bit in our outgoing messages (aggressive) - */ -#ifdef ROLL_TM_CONF_SET_M_BIT -#define ROLL_TM_SET_M_BIT ROLL_TM_CONF_SET_M_BIT -#else -#define ROLL_TM_SET_M_BIT 1 -#endif -/*---------------------------------------------------------------------------*/ -/* Stats datatype */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Multicast stats extension for the ROLL TM engine - */ -struct roll_tm_stats { - /** Number of received ICMP datagrams */ - UIP_MCAST6_STATS_DATATYPE icmp_in; - - /** Number of ICMP datagrams sent */ - UIP_MCAST6_STATS_DATATYPE icmp_out; - - /** Number of malformed ICMP datagrams seen by us */ - UIP_MCAST6_STATS_DATATYPE icmp_bad; -}; -/*---------------------------------------------------------------------------*/ -#endif /* ROLL_TM_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ -/** @} */ diff --git a/os/net/ipv6/multicast/smrf.c b/os/net/ipv6/multicast/smrf.c deleted file mode 100644 index dd24968ba..000000000 --- a/os/net/ipv6/multicast/smrf.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2010, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup smrf-multicast - * @{ - */ -/** - * \file - * This file implements 'Stateless Multicast RPL Forwarding' (SMRF) - * - * \author - * George Oikonomou - - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "net/ipv6/multicast/uip-mcast6.h" -#include "net/ipv6/multicast/uip-mcast6-route.h" -#include "net/ipv6/multicast/uip-mcast6-stats.h" -#include "net/ipv6/multicast/smrf.h" -#include "net/routing/routing.h" -#include "net/netstack.h" -#include "net/packetbuf.h" -#if ROUTING_CONF_RPL_LITE -#include "net/routing/rpl-lite/rpl.h" -#endif /* ROUTING_CONF_RPL_LITE */ -#if ROUTING_CONF_RPL_CLASSIC -#include "net/routing/rpl-classic/rpl.h" -#endif /* ROUTING_CONF_RPL_CLASSIC */ -#include - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -/*---------------------------------------------------------------------------*/ -/* Macros */ -/*---------------------------------------------------------------------------*/ -/* CCI */ -#define SMRF_FWD_DELAY() (CLOCK_SECOND / 8) -/* Number of slots in the next 500ms */ -#define SMRF_INTERVAL_COUNT ((CLOCK_SECOND >> 2) / fwd_delay) -/*---------------------------------------------------------------------------*/ -/* Internal Data */ -/*---------------------------------------------------------------------------*/ -static struct ctimer mcast_periodic; -static uint8_t mcast_len; -static uip_buf_t mcast_buf; -static uint8_t fwd_delay; -static uint8_t fwd_spread; -/*---------------------------------------------------------------------------*/ -static void -mcast_fwd(void *p) -{ - memcpy(uip_buf, &mcast_buf, mcast_len); - uip_len = mcast_len; - UIP_IP_BUF->ttl--; - tcpip_output(NULL); - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -in() -{ - rpl_dag_t *d; /* Our DODAG */ - uip_ipaddr_t *parent_ipaddr; /* Our pref. parent's IPv6 address */ - const uip_lladdr_t *parent_lladdr; /* Our pref. parent's LL address */ - - /* - * Fetch a pointer to the LL address of our preferred parent - * - * ToDo: This rpl_get_any_dag() call is a dirty replacement of the previous - * rpl_get_dag(RPL_DEFAULT_INSTANCE); - * so that things can compile with the new RPL code. This needs updated to - * read instance ID from the RPL HBHO and use the correct parent accordingly - */ - d = rpl_get_any_dag(); - if(!d) { - PRINTF("SMRF: No DODAG\n"); - UIP_MCAST6_STATS_ADD(mcast_dropped); - return UIP_MCAST6_DROP; - } - - /* Retrieve our preferred parent's LL address */ - parent_ipaddr = rpl_parent_get_ipaddr(d->preferred_parent); - parent_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(parent_ipaddr); - - if(parent_lladdr == NULL) { - PRINTF("SMRF: No Parent found\n"); - UIP_MCAST6_STATS_ADD(mcast_dropped); - return UIP_MCAST6_DROP; - } - - /* - * We accept a datagram if it arrived from our preferred parent, discard - * otherwise. - */ - if(memcmp(parent_lladdr, packetbuf_addr(PACKETBUF_ADDR_SENDER), - UIP_LLADDR_LEN)) { - PRINTF("SMRF: Routable in but SMRF ignored it\n"); - UIP_MCAST6_STATS_ADD(mcast_dropped); - return UIP_MCAST6_DROP; - } - - if(UIP_IP_BUF->ttl <= 1) { - UIP_MCAST6_STATS_ADD(mcast_dropped); - PRINTF("SMRF: TTL too low\n"); - return UIP_MCAST6_DROP; - } - - UIP_MCAST6_STATS_ADD(mcast_in_all); - UIP_MCAST6_STATS_ADD(mcast_in_unique); - - /* If we have an entry in the mcast routing table, something with - * a higher RPL rank (somewhere down the tree) is a group member */ - if(uip_mcast6_route_lookup(&UIP_IP_BUF->destipaddr)) { - /* If we enter here, we will definitely forward */ - UIP_MCAST6_STATS_ADD(mcast_fwd); - - /* - * Add a delay (D) of at least SMRF_FWD_DELAY() to compensate for how - * contikimac handles broadcasts. We can't start our TX before the sender - * has finished its own. - */ - fwd_delay = SMRF_FWD_DELAY(); - - /* Finalise D: D = min(SMRF_FWD_DELAY(), SMRF_MIN_FWD_DELAY) */ -#if SMRF_MIN_FWD_DELAY - if(fwd_delay < SMRF_MIN_FWD_DELAY) { - fwd_delay = SMRF_MIN_FWD_DELAY; - } -#endif - - if(fwd_delay == 0) { - /* No delay required, send it, do it now, why wait? */ - UIP_IP_BUF->ttl--; - tcpip_output(NULL); - UIP_IP_BUF->ttl++; /* Restore before potential upstack delivery */ - } else { - /* Randomise final delay in [D , D*Spread], step D */ - fwd_spread = SMRF_INTERVAL_COUNT; - if(fwd_spread > SMRF_MAX_SPREAD) { - fwd_spread = SMRF_MAX_SPREAD; - } - if(fwd_spread) { - fwd_delay = fwd_delay * (1 + ((random_rand() >> 11) % fwd_spread)); - } - - memcpy(&mcast_buf, uip_buf, uip_len); - mcast_len = uip_len; - ctimer_set(&mcast_periodic, fwd_delay, mcast_fwd, NULL); - } - PRINTF("SMRF: %u bytes: fwd in %u [%u]\n", - uip_len, fwd_delay, fwd_spread); - } else { - PRINTF("SMRF: Group unknown, dropping\n"); - } - - /* Done with this packet unless we are a member of the mcast group */ - if(!uip_ds6_is_my_maddr(&UIP_IP_BUF->destipaddr)) { - PRINTF("SMRF: Not a group member. No further processing\n"); - return UIP_MCAST6_DROP; - } else { - PRINTF("SMRF: Ours. Deliver to upper layers\n"); - UIP_MCAST6_STATS_ADD(mcast_in_ours); - return UIP_MCAST6_ACCEPT; - } -} -/*---------------------------------------------------------------------------*/ -static void -init() -{ - UIP_MCAST6_STATS_INIT(NULL); - - uip_mcast6_route_init(); -} -/*---------------------------------------------------------------------------*/ -static void -out() -{ - return; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief The SMRF engine driver - */ -const struct uip_mcast6_driver smrf_driver = { - "SMRF", - init, - out, - in, -}; -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/multicast/smrf.h b/os/net/ipv6/multicast/smrf.h deleted file mode 100644 index d69aa73a5..000000000 --- a/os/net/ipv6/multicast/smrf.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2011, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup uip-multicast - * @{ - */ -/** - * \defgroup smrf-multicast 'Stateless Multicast RPL Forwarding' (SMRF) - * - * SMRF will only work in RPL networks in MOP 3 "Storing with Multicast" - * @{ - */ -/** - * \file - * Header file for the SMRF forwarding engine - * - * \author - * George Oikonomou - - */ - -#ifndef SMRF_H_ -#define SMRF_H_ - -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -/* Configuration */ -/*---------------------------------------------------------------------------*/ -/* Fmin */ -#ifdef SMRF_CONF_MIN_FWD_DELAY -#define SMRF_MIN_FWD_DELAY SMRF_CONF_MIN_FWD_DELAY -#else -#define SMRF_MIN_FWD_DELAY 4 -#endif - -/* Max Spread */ -#ifdef SMRF_CONF_MAX_SPREAD -#define SMRF_MAX_SPREAD SMRF_CONF_MAX_SPREAD -#else -#define SMRF_MAX_SPREAD 4 -#endif -/*---------------------------------------------------------------------------*/ -#endif /* SMRF_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ -/** @} */ diff --git a/os/net/ipv6/multicast/uip-mcast6-engines.h b/os/net/ipv6/multicast/uip-mcast6-engines.h deleted file mode 100644 index 93e8da40f..000000000 --- a/os/net/ipv6/multicast/uip-mcast6-engines.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2011, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup uip-multicast - * @{ - */ -/** - * \file - * Header file with definition of multicast engine constants - * - * When writing a new engine, add it here with a unique number and - * then modify uip-mcast6.h accordingly - * - * \author - * George Oikonomou - - */ - -#ifndef UIP_MCAST6_ENGINES_H_ -#define UIP_MCAST6_ENGINES_H_ - -#define UIP_MCAST6_ENGINE_NONE 0 /**< Selecting this disables mcast */ -#define UIP_MCAST6_ENGINE_SMRF 1 /**< The SMRF engine */ -#define UIP_MCAST6_ENGINE_ROLL_TM 2 /**< The ROLL TM engine */ -#define UIP_MCAST6_ENGINE_ESMRF 3 /**< The ESMRF engine */ - -#endif /* UIP_MCAST6_ENGINES_H_ */ -/** @} */ diff --git a/os/net/ipv6/multicast/uip-mcast6-route.c b/os/net/ipv6/multicast/uip-mcast6-route.c deleted file mode 100644 index 3c2d6bd3d..000000000 --- a/os/net/ipv6/multicast/uip-mcast6-route.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2011, Loughborough University - Computer Science - * 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. - */ -/** - * \addtogroup uip-multicast - * @{ - */ -/** - * \file - * Multicast routing table manipulation - * - * \author - * George Oikonomou - - */ - -#include "contiki.h" -#include "lib/list.h" -#include "lib/memb.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/multicast/uip-mcast6-route.h" - -#include -#include - -/*---------------------------------------------------------------------------*/ -/* Size of the multicast routing table */ -#ifdef UIP_MCAST6_ROUTE_CONF_ROUTES -#define UIP_MCAST6_ROUTE_ROUTES UIP_MCAST6_ROUTE_CONF_ROUTES -#else -#define UIP_MCAST6_ROUTE_ROUTES 1 -#endif /* UIP_CONF_DS6_MCAST_ROUTES */ -/*---------------------------------------------------------------------------*/ -LIST(mcast_route_list); -MEMB(mcast_route_memb, uip_mcast6_route_t, UIP_MCAST6_ROUTE_ROUTES); - -static uip_mcast6_route_t *locmcastrt; -/*---------------------------------------------------------------------------*/ -uip_mcast6_route_t * -uip_mcast6_route_lookup(uip_ipaddr_t *group) -{ - locmcastrt = NULL; - for(locmcastrt = list_head(mcast_route_list); - locmcastrt != NULL; - locmcastrt = list_item_next(locmcastrt)) { - if(uip_ipaddr_cmp(&locmcastrt->group, group)) { - return locmcastrt; - } - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -uip_mcast6_route_t * -uip_mcast6_route_add(uip_ipaddr_t *group) -{ - /* _lookup must return NULL, i.e. the prefix does not exist in our table */ - locmcastrt = uip_mcast6_route_lookup(group); - if(locmcastrt == NULL) { - /* Allocate an entry and add the group to the list */ - locmcastrt = memb_alloc(&mcast_route_memb); - if(locmcastrt == NULL) { - return NULL; - } - list_add(mcast_route_list, locmcastrt); - } - - /* Reaching here means we either found the prefix or allocated a new one */ - - uip_ipaddr_copy(&(locmcastrt->group), group); - - return locmcastrt; -} -/*---------------------------------------------------------------------------*/ -void -uip_mcast6_route_rm(uip_mcast6_route_t *route) -{ - /* Make sure it's actually in the list */ - for(locmcastrt = list_head(mcast_route_list); - locmcastrt != NULL; - locmcastrt = list_item_next(locmcastrt)) { - if(locmcastrt == route) { - list_remove(mcast_route_list, route); - memb_free(&mcast_route_memb, route); - return; - } - } -} -/*---------------------------------------------------------------------------*/ -uip_mcast6_route_t * -uip_mcast6_route_list_head(void) -{ - return list_head(mcast_route_list); -} -/*---------------------------------------------------------------------------*/ -int -uip_mcast6_route_count(void) -{ - return list_length(mcast_route_list); -} -/*---------------------------------------------------------------------------*/ -void -uip_mcast6_route_init() -{ - memb_init(&mcast_route_memb); - list_init(mcast_route_list); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/multicast/uip-mcast6-route.h b/os/net/ipv6/multicast/uip-mcast6-route.h deleted file mode 100644 index 25bb435c7..000000000 --- a/os/net/ipv6/multicast/uip-mcast6-route.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2011, Loughborough University - Computer Science - * 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. - */ -/** - * \addtogroup uip-multicast - * @{ - */ -/** - * \file - * Header file for multicast routing table manipulation - * - * \author - * George Oikonomou - - */ -#ifndef UIP_MCAST6_ROUTE_H_ -#define UIP_MCAST6_ROUTE_H_ - -#include "contiki.h" -#include "net/ipv6/uip.h" - -#include -/*---------------------------------------------------------------------------*/ -/** \brief An entry in the multicast routing table */ -typedef struct uip_mcast6_route { - struct uip_mcast6_route *next; /**< Routes are arranged in a linked list */ - uip_ipaddr_t group; /**< The multicast group */ - uint32_t lifetime; /**< Entry lifetime seconds */ - void *dag; /**< Pointer to an rpl_dag_t struct */ -} uip_mcast6_route_t; -/*---------------------------------------------------------------------------*/ -/** \name Multicast Routing Table Manipulation */ -/** @{ */ - -/** - * \brief Lookup a multicast route - * \param group A pointer to the multicast group to be searched for - * \return A pointer to the new routing entry, or NULL if the route could not - * be found - */ -uip_mcast6_route_t *uip_mcast6_route_lookup(uip_ipaddr_t *group); - -/** - * \brief Add a multicast route - * \param group A pointer to the multicast group to be added - * \return A pointer to the new route, or NULL if the route could not be added - */ -uip_mcast6_route_t *uip_mcast6_route_add(uip_ipaddr_t *group); - -/** - * \brief Remove a multicast route - * \param route A pointer to the route to be removed - */ -void uip_mcast6_route_rm(uip_mcast6_route_t *route); - -/** - * \brief Retrieve the count of multicast routes - * \return The number of multicast routes - */ -int uip_mcast6_route_count(void); - -/** - * \brief Retrieve a pointer to the start of the multicast routes list - * \return A pointer to the start of the multicast routes - * - * If the multicast routes list is empty, this function will return NULL - */ -uip_mcast6_route_t *uip_mcast6_route_list_head(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Multicast routing table init routine - * - * Multicast routing tables are not necessarily required by all - * multicast engines. For instance, trickle multicast does not rely on - * the existence of a routing table. Therefore, this function here - * should be invoked by each engine's init routine only if the relevant - * functionality is required. This is also why this function should not - * get hooked into the uip-ds6 core. - */ -void uip_mcast6_route_init(void); -/** @} */ - -#endif /* UIP_MCAST6_ROUTE_H_ */ -/** @} */ diff --git a/os/net/ipv6/multicast/uip-mcast6-stats.c b/os/net/ipv6/multicast/uip-mcast6-stats.c deleted file mode 100644 index 7d7bed6e8..000000000 --- a/os/net/ipv6/multicast/uip-mcast6-stats.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2014, University of Bristol - http://www.bris.ac.uk - * 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. - */ -/** - * \addtogroup uip-multicast - * @{ - */ -/** - * \file - * IPv6 multicast forwarding stats maintenance - * - * \author - * George Oikonomou - - */ -#include "net/ipv6/multicast/uip-mcast6-stats.h" - -#include -/*---------------------------------------------------------------------------*/ -uip_mcast6_stats_t uip_mcast6_stats; -/*---------------------------------------------------------------------------*/ -void -uip_mcast6_stats_init(void *stats) -{ - memset(&uip_mcast6_stats, 0, sizeof(uip_mcast6_stats)); - uip_mcast6_stats.engine_stats = stats; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/multicast/uip-mcast6-stats.h b/os/net/ipv6/multicast/uip-mcast6-stats.h deleted file mode 100644 index 474a432db..000000000 --- a/os/net/ipv6/multicast/uip-mcast6-stats.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2014, University of Bristol - http://www.bris.ac.uk - * 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. - */ -/** - * \addtogroup uip-multicast - * @{ - */ -/** - * \file - * Header file for IPv6 multicast forwarding stats maintenance - * - * \author - * George Oikonomou - - */ -#ifndef UIP_MCAST6_STATS_H_ -#define UIP_MCAST6_STATS_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -/*---------------------------------------------------------------------------*/ -/* The platform can override the stats datatype */ -#ifdef UIP_MCAST6_CONF_STATS_DATATYPE -#define UIP_MCAST6_STATS_DATATYPE UIP_MCAST6_CONF_STATS_DATATYPE -#else -#define UIP_MCAST6_STATS_DATATYPE uint16_t -#endif -/*---------------------------------------------------------------------------*/ -#ifdef UIP_MCAST6_CONF_STATS -#define UIP_MCAST6_STATS UIP_MCAST6_CONF_STATS -#else -#define UIP_MCAST6_STATS 0 -#endif -/*---------------------------------------------------------------------------*/ -/* Stats datatype */ -/*---------------------------------------------------------------------------*/ -/** - * \brief A data structure used to maintain multicast stats - * - * Each engine can extend this structure via the engine_stats field - */ -typedef struct uip_mcast6_stats { - /** Count of unique datagrams received */ - UIP_MCAST6_STATS_DATATYPE mcast_in_unique; - - /** Count of all datagrams received */ - UIP_MCAST6_STATS_DATATYPE mcast_in_all; - - /** Count of datagrams received for a group that we have joined */ - UIP_MCAST6_STATS_DATATYPE mcast_in_ours; - - /** Count of datagrams forwarded by us but we are not the seed */ - UIP_MCAST6_STATS_DATATYPE mcast_fwd; - - /** Count of multicast datagrams originated by us */ - UIP_MCAST6_STATS_DATATYPE mcast_out; - - /** Count of malformed multicast datagrams seen by us */ - UIP_MCAST6_STATS_DATATYPE mcast_bad; - - /** Count of multicast datagrams correclty formed but dropped by us */ - UIP_MCAST6_STATS_DATATYPE mcast_dropped; - - /** Opaque pointer to an engine's additional stats */ - void *engine_stats; -} uip_mcast6_stats_t; -/*---------------------------------------------------------------------------*/ -/* Access macros */ -/*---------------------------------------------------------------------------*/ -#if UIP_MCAST6_STATS -/* Don't access this variable directly, use the macros below */ -extern uip_mcast6_stats_t uip_mcast6_stats; - -#define UIP_MCAST6_STATS_ADD(x) uip_mcast6_stats.x++ -#define UIP_MCAST6_STATS_GET(x) uip_mcast6_stats.x -#define UIP_MCAST6_STATS_INIT(s) uip_mcast6_stats_init(s) -#else /* UIP_MCAST6_STATS */ -#define UIP_MCAST6_STATS_ADD(x) -#define UIP_MCAST6_STATS_GET(x) 0 -#define UIP_MCAST6_STATS_INIT(s) -#endif /* UIP_MCAST6_STATS */ -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialise multicast stats - * \param stats A pointer to a struct holding an engine's additional statistics - */ -void uip_mcast6_stats_init(void *stats); -/*---------------------------------------------------------------------------*/ -#endif /* UIP_MCAST6_STATS_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/multicast/uip-mcast6.h b/os/net/ipv6/multicast/uip-mcast6.h deleted file mode 100644 index 67277828b..000000000 --- a/os/net/ipv6/multicast/uip-mcast6.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2011, Loughborough University - Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup uip - * @{ - */ -/** - * \defgroup uip-multicast IPv6 Multicast Forwarding - * - * We currently support 2 engines: - * - 'Stateless Multicast RPL Forwarding' (SMRF) - * RPL does group management as per the RPL docs, SMRF handles datagram - * forwarding - * - 'Multicast Forwarding with Trickle' according to the algorithm described - * in the internet draft: - * http://tools.ietf.org/html/draft-ietf-roll-trickle-mcast - * - * @{ - */ - -/** - * \file - * This header file contains configuration directives for uIPv6 - * multicast support. - * - * \author - * George Oikonomou - - */ - -#ifndef UIP_MCAST6_H_ -#define UIP_MCAST6_H_ - -#include "contiki.h" -#include "net/ipv6/multicast/uip-mcast6-engines.h" -#include "net/ipv6/multicast/uip-mcast6-route.h" -#include "net/ipv6/multicast/smrf.h" -#include "net/ipv6/multicast/esmrf.h" -#include "net/ipv6/multicast/roll-tm.h" - -#include -/*---------------------------------------------------------------------------*/ -/* Constants */ -/*---------------------------------------------------------------------------*/ -#define UIP_MCAST6_DROP 0 -#define UIP_MCAST6_ACCEPT 1 -/*---------------------------------------------------------------------------*/ -/* Multicast Address Scopes (RFC 4291 & draft-ietf-6man-multicast-scopes) */ -#define UIP_MCAST6_SCOPE_INTERFACE 0x01 -#define UIP_MCAST6_SCOPE_LINK_LOCAL 0x02 -#define UIP_MCAST6_SCOPE_REALM_LOCAL 0x03 /* draft-ietf-6man-multicast-scopes */ -#define UIP_MCAST6_SCOPE_ADMIN_LOCAL 0x04 -#define UIP_MCAST6_SCOPE_SITE_LOCAL 0x05 -#define UIP_MCAST6_SCOPE_ORG_LOCAL 0x08 -#define UIP_MCAST6_SCOPE_GLOBAL 0x0E -/*---------------------------------------------------------------------------*/ -/* Choose an engine or turn off based on user configuration */ -/*---------------------------------------------------------------------------*/ -#ifdef UIP_MCAST6_CONF_ENGINE -#define UIP_MCAST6_ENGINE UIP_MCAST6_CONF_ENGINE -#else -#define UIP_MCAST6_ENGINE UIP_MCAST6_ENGINE_NONE -#endif -/*---------------------------------------------------------------------------*/ -/* - * Multicast API. Similar to NETSTACK, each engine must define a driver and - * populate the fields with suitable function pointers - */ -/** - * \brief The data structure used to represent a multicast engine - */ -struct uip_mcast6_driver { - /** The driver's name */ - char *name; - - /** Initialize the multicast engine */ - void (* init)(void); - - /** - * \brief Process an outgoing datagram with a multicast IPv6 destination - * address - * - * This may be needed if the multicast engine needs to, for example, - * add IPv6 extension headers to the datagram, cache it, decide it - * needs dropped etc. - * - * It is sometimes desirable to let the engine handle datagram - * dispatch instead of letting the networking core do it. If the - * engine decides to send the datagram itself, it must afterwards - * set uip_len = 0 to prevent the networking core from sending too - */ - void (* out)(void); - - /** - * \brief Process an incoming multicast datagram and determine whether it - * should be delivered up the stack or not. - * - * \return 0: Drop, 1: Deliver - * - * - * When a datagram with a multicast destination address is received, - * the forwarding logic in core is bypassed. Instead, we let the - * multicast engine handle forwarding internally if and as necessary. - * This function is where forwarding logic must be hooked in. - * - * Once the engine is done with forwarding, it must signal via the - * return value whether the datagram needs delivered up the network - * stack. - */ - uint8_t (* in)(void); -}; -/*---------------------------------------------------------------------------*/ -/** - * \brief Get a multicast address' scope. - * a is of type uip_ip6addr_t* - */ -#define uip_mcast6_get_address_scope(a) ((a)->u8[1] & 0x0F) -/*---------------------------------------------------------------------------*/ -/* Configure multicast and os/net to play nicely with the selected engine */ -#if UIP_MCAST6_ENGINE - -/* Enable Multicast hooks in the uip6 core */ -#define UIP_IPV6_MULTICAST 1 - -#if UIP_MCAST6_ENGINE == UIP_MCAST6_ENGINE_ROLL_TM -#define RPL_WITH_MULTICAST 0 /* Not used by trickle */ -#define UIP_CONF_IPV6_ROLL_TM 1 /* ROLL Trickle ICMP type support */ - -#define UIP_MCAST6 roll_tm_driver - -#elif UIP_MCAST6_ENGINE == UIP_MCAST6_ENGINE_SMRF -#define RPL_WITH_MULTICAST 1 - -#define UIP_MCAST6 smrf_driver - -#elif UIP_MCAST6_ENGINE == UIP_MCAST6_ENGINE_ESMRF -#define RPL_WITH_MULTICAST 1 -#define UIP_MCAST6 esmrf_driver - -#else -#error "Multicast Enabled with an Unknown Engine." -#error "Check the value of UIP_MCAST6_CONF_ENGINE in conf files." -#endif -#endif /* UIP_MCAST6_ENGINE */ - -extern const struct uip_mcast6_driver UIP_MCAST6; -/*---------------------------------------------------------------------------*/ -/* Configuration Checks */ -/*---------------------------------------------------------------------------*/ -#if RPL_WITH_MULTICAST && (!UIP_CONF_IPV6_RPL) -#error "The selected Multicast mode requires UIP_CONF_IPV6_RPL != 0" -#error "Check the value of UIP_CONF_IPV6_RPL in conf files." -#endif -/*---------------------------------------------------------------------------*/ -#endif /* UIP_MCAST6_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ -/** @} */ diff --git a/os/net/ipv6/psock.c b/os/net/ipv6/psock.c deleted file mode 100644 index 6fa2ef461..000000000 --- a/os/net/ipv6/psock.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -#include - -#include "net/ipv6/psock.h" - -#define STATE_NONE 0 -#define STATE_ACKED 1 -#define STATE_READ 2 -#define STATE_BLOCKED_NEWDATA 3 -#define STATE_BLOCKED_CLOSE 4 -#define STATE_BLOCKED_SEND 5 -#define STATE_DATA_SENT 6 - -/* - * Return value of the buffering functions that indicates that a - * buffer was not filled by incoming data. - * - */ -#define BUF_NOT_FULL 0 -#define BUF_NOT_FOUND 0 - -/* - * Return value of the buffering functions that indicates that a - * buffer was completely filled by incoming data. - * - */ -#define BUF_FULL 1 - -/* - * Return value of the buffering functions that indicates that an - * end-marker byte was found. - * - */ -#define BUF_FOUND 2 - -/*---------------------------------------------------------------------------*/ -static void -buf_setup(struct psock_buf *buf, - uint8_t *bufptr, uint16_t bufsize) -{ - buf->ptr = bufptr; - buf->left = bufsize; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -buf_bufdata(struct psock_buf *buf, uint16_t len, - uint8_t **dataptr, uint16_t *datalen) -{ - if(*datalen < buf->left) { - memcpy(buf->ptr, *dataptr, *datalen); - buf->ptr += *datalen; - buf->left -= *datalen; - *dataptr += *datalen; - *datalen = 0; - return BUF_NOT_FULL; - } else if(*datalen == buf->left) { - memcpy(buf->ptr, *dataptr, *datalen); - buf->ptr += *datalen; - buf->left = 0; - *dataptr += *datalen; - *datalen = 0; - return BUF_FULL; - } else { - memcpy(buf->ptr, *dataptr, buf->left); - buf->ptr += buf->left; - *datalen -= buf->left; - *dataptr += buf->left; - buf->left = 0; - return BUF_FULL; - } -} -/*---------------------------------------------------------------------------*/ -static uint8_t -buf_bufto(CC_REGISTER_ARG struct psock_buf *buf, uint8_t endmarker, - CC_REGISTER_ARG uint8_t **dataptr, CC_REGISTER_ARG uint16_t *datalen) -{ - uint8_t c; - while(buf->left > 0 && *datalen > 0) { - c = *buf->ptr = **dataptr; - ++*dataptr; - ++buf->ptr; - --*datalen; - --buf->left; - - if(c == endmarker) { - return BUF_FOUND; - } - } - - if(*datalen == 0) { - return BUF_NOT_FOUND; - } - - return BUF_FULL; -} -/*---------------------------------------------------------------------------*/ -static char -data_is_sent_and_acked(CC_REGISTER_ARG struct psock *s) -{ - /* If data has previously been sent, and the data has been acked, we - increase the send pointer and call send_data() to send more - data. */ - if(s->state != STATE_DATA_SENT || uip_rexmit()) { - if(s->sendlen > uip_mss()) { - uip_send(s->sendptr, uip_mss()); - } else { - uip_send(s->sendptr, s->sendlen); - } - s->state = STATE_DATA_SENT; - return 0; - } else if(s->state == STATE_DATA_SENT && uip_acked()) { - if(s->sendlen > uip_mss()) { - s->sendlen -= uip_mss(); - s->sendptr += uip_mss(); - } else { - s->sendptr += s->sendlen; - s->sendlen = 0; - } - s->state = STATE_ACKED; - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -PT_THREAD(psock_send(CC_REGISTER_ARG struct psock *s, const uint8_t *buf, - unsigned int len)) -{ - PT_BEGIN(&s->psockpt); - - /* If there is no data to send, we exit immediately. */ - if(len == 0) { - PT_EXIT(&s->psockpt); - } - - /* Save the length of and a pointer to the data that is to be - sent. */ - s->sendptr = buf; - s->sendlen = len; - - s->state = STATE_NONE; - - /* We loop here until all data is sent. The s->sendlen variable is - updated by the data_sent() function. */ - while(s->sendlen > 0) { - - /* - * The protothread will wait here until all data has been - * acknowledged and sent (data_is_acked_and_send() returns 1). - */ - PT_WAIT_UNTIL(&s->psockpt, data_is_sent_and_acked(s)); - } - - s->state = STATE_NONE; - - PT_END(&s->psockpt); -} -/*---------------------------------------------------------------------------*/ -PT_THREAD(psock_generator_send(CC_REGISTER_ARG struct psock *s, - unsigned short (*generate)(void *), void *arg)) -{ - PT_BEGIN(&s->psockpt); - - /* Ensure that there is a generator function to call. */ - if(generate == NULL) { - PT_EXIT(&s->psockpt); - } - - s->state = STATE_NONE; - do { - /* Call the generator function to generate the data in the - uip_appdata buffer. */ - s->sendlen = generate(arg); - s->sendptr = uip_appdata; - - if(s->sendlen > uip_mss()) { - uip_send(s->sendptr, uip_mss()); - } else { - uip_send(s->sendptr, s->sendlen); - } - s->state = STATE_DATA_SENT; - - /* Wait until all data is sent and acknowledged. */ - // if (!s->sendlen) break; //useful debugging aid - PT_YIELD_UNTIL(&s->psockpt, uip_acked() || uip_rexmit()); - } while(!uip_acked()); - - s->state = STATE_NONE; - - PT_END(&s->psockpt); -} -/*---------------------------------------------------------------------------*/ -uint16_t -psock_datalen(struct psock *psock) -{ - return psock->bufsize - psock->buf.left; -} -/*---------------------------------------------------------------------------*/ -char -psock_newdata(struct psock *s) -{ - if(s->readlen > 0) { - /* There is data in the uip_appdata buffer that has not yet been - read with the PSOCK_READ functions. */ - return 1; - } else if(s->state == STATE_READ) { - /* All data in uip_appdata buffer already consumed. */ - s->state = STATE_BLOCKED_NEWDATA; - return 0; - } else if(uip_newdata()) { - /* There is new data that has not been consumed. */ - return 1; - } else { - /* There is no new data. */ - return 0; - } -} -/*---------------------------------------------------------------------------*/ -PT_THREAD(psock_readto(CC_REGISTER_ARG struct psock *psock, unsigned char c)) -{ - PT_BEGIN(&psock->psockpt); - - buf_setup(&psock->buf, psock->bufptr, psock->bufsize); - - /* XXX: Should add buf_checkmarker() before do{} loop, if - incoming data has been handled while waiting for a write. */ - - do { - if(psock->readlen == 0) { - PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock)); - psock->state = STATE_READ; - psock->readptr = (uint8_t *)uip_appdata; - psock->readlen = uip_datalen(); - } - } while(buf_bufto(&psock->buf, c, - &psock->readptr, - &psock->readlen) == BUF_NOT_FOUND); - - if(psock_datalen(psock) == 0) { - psock->state = STATE_NONE; - PT_RESTART(&psock->psockpt); - } - PT_END(&psock->psockpt); -} -/*---------------------------------------------------------------------------*/ -PT_THREAD(psock_readbuf_len(CC_REGISTER_ARG struct psock *psock, uint16_t len)) -{ - PT_BEGIN(&psock->psockpt); - - buf_setup(&psock->buf, psock->bufptr, psock->bufsize); - - /* XXX: Should add buf_checkmarker() before do{} loop, if - incoming data has been handled while waiting for a write. */ - - /* read len bytes or to end of data */ - do { - if(psock->readlen == 0) { - PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock)); - psock->state = STATE_READ; - psock->readptr = (uint8_t *)uip_appdata; - psock->readlen = uip_datalen(); - } - } while(buf_bufdata(&psock->buf, psock->bufsize, - &psock->readptr, &psock->readlen) == BUF_NOT_FULL && - psock_datalen(psock) < len); - - if(psock_datalen(psock) == 0) { - psock->state = STATE_NONE; - PT_RESTART(&psock->psockpt); - } - PT_END(&psock->psockpt); -} - -/*---------------------------------------------------------------------------*/ -void -psock_init(CC_REGISTER_ARG struct psock *psock, - uint8_t *buffer, unsigned int buffersize) -{ - psock->state = STATE_NONE; - psock->readlen = 0; - psock->bufptr = buffer; - psock->bufsize = buffersize; - buf_setup(&psock->buf, buffer, buffersize); - PT_INIT(&psock->pt); - PT_INIT(&psock->psockpt); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/ipv6/psock.h b/os/net/ipv6/psock.h deleted file mode 100644 index 07759b03d..000000000 --- a/os/net/ipv6/psock.h +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \defgroup psock Protosockets library - * @{ - * - * The protosocket library provides an interface to the uIP stack that is - * similar to the traditional BSD socket interface. Unlike programs - * written for the ordinary uIP event-driven interface, programs - * written with the protosocket library are executed in a sequential - * fashion and does not have to be implemented as explicit state - * machines. - * - * Protosockets only work with TCP connections. - * - * The protosocket library uses \ref pt protothreads to provide - * sequential control flow. This makes the protosockets lightweight in - * terms of memory, but also means that protosockets inherits the - * functional limitations of protothreads. Each protosocket lives only - * within a single function block. Automatic variables (stack - * variables) are not necessarily retained across a protosocket - * library function call. - * - * \note Because the protosocket library uses protothreads, local variables - * will not always be saved across a call to a protosocket library - * function. It is therefore advised that local variables are used - * with extreme care. - * - * The protosocket library provides functions for sending data without - * having to deal with retransmissions and acknowledgements, as well - * as functions for reading data without having to deal with data - * being split across more than one TCP segment. - * - * Because each protosocket runs as a protothread, the protosocket has to be - * started with a call to PSOCK_BEGIN() at the start of the function - * in which the protosocket is used. Similarly, the protosocket protothread can - * be terminated by a call to PSOCK_EXIT(). - * - */ - -/** - * \file - * Protosocket library header file - * \author - * Adam Dunkels - * - */ - -#ifndef PSOCK_H_ -#define PSOCK_H_ - -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" - - /* - * The structure that holds the state of a buffer. - * - * This structure holds the state of a uIP buffer. The structure has - * no user-visible elements, but is used through the functions - * provided by the library. - * - */ -struct psock_buf { - uint8_t *ptr; - unsigned short left; -}; - -/** - * The representation of a protosocket. - * - * The protosocket structrure is an opaque structure with no user-visible - * elements. - */ -struct psock { - struct pt pt, psockpt; /* Protothreads - one that's using the psock - functions, and one that runs inside the - psock functions. */ - const uint8_t *sendptr; /* Pointer to the next data to be sent. */ - uint8_t *readptr; /* Pointer to the next data to be read. */ - - uint8_t *bufptr; /* Pointer to the buffer used for buffering - incoming data. */ - - uint16_t sendlen; /* The number of bytes left to be sent. */ - uint16_t readlen; /* The number of bytes left to be read. */ - - struct psock_buf buf; /* The structure holding the state of the - input buffer. */ - unsigned int bufsize; /* The size of the input buffer. */ - - unsigned char state; /* The state of the protosocket. */ -}; - -void psock_init(struct psock *psock, uint8_t *buffer, unsigned int buffersize); -/** - * Initialize a protosocket. - * - * This macro initializes a protosocket and must be called before the - * protosocket is used. The initialization also specifies the input buffer - * for the protosocket. - * - * \param psock (struct psock *) A pointer to the protosocket to be - * initialized - * - * \param buffer (uint8_t *) A pointer to the input buffer for the - * protosocket. - * - * \param buffersize (unsigned int) The size of the input buffer. - * - * \hideinitializer - */ -#define PSOCK_INIT(psock, buffer, buffersize) \ - psock_init(psock, buffer, buffersize) - -/** - * Start the protosocket protothread in a function. - * - * This macro starts the protothread associated with the protosocket and - * must come before other protosocket calls in the function it is used. - * - * \param psock (struct psock *) A pointer to the protosocket to be - * started. - * - * \hideinitializer - */ -#define PSOCK_BEGIN(psock) PT_BEGIN(&((psock)->pt)) - -PT_THREAD(psock_send(struct psock *psock, const uint8_t *buf, unsigned int len)); -/** - * Send data. - * - * This macro sends data over a protosocket. The protosocket protothread blocks - * until all data has been sent and is known to have been received by - * the remote end of the TCP connection. - * - * \param psock (struct psock *) A pointer to the protosocket over which - * data is to be sent. - * - * \param data (uint8_t *) A pointer to the data that is to be sent. - * - * \param datalen (unsigned int) The length of the data that is to be - * sent. - * - * \hideinitializer - */ -#define PSOCK_SEND(psock, data, datalen) \ - PT_WAIT_THREAD(&((psock)->pt), psock_send(psock, data, datalen)) - -/** - * \brief Send a null-terminated string. - * \param psock Pointer to the protosocket. - * \param str The string to be sent. - * - * This function sends a null-terminated string over the - * protosocket. - * - * \hideinitializer - */ -#define PSOCK_SEND_STR(psock, str) \ - PT_WAIT_THREAD(&((psock)->pt), psock_send(psock, (uint8_t *)str, strlen(str))) - -PT_THREAD(psock_generator_send(struct psock *psock, - unsigned short (*f)(void *), void *arg)); - -/** - * \brief Generate data with a function and send it - * \param psock Pointer to the protosocket. - * \param generator Pointer to the generator function - * \param arg Argument to the generator function - * - * This function generates data and sends it over the - * protosocket. This can be used to dynamically generate - * data for a transmission, instead of generating the data - * in a buffer beforehand. This function reduces the need for - * buffer memory. The generator function is implemented by - * the application, and a pointer to the function is given - * as an argument with the call to PSOCK_GENERATOR_SEND(). - * - * The generator function should place the generated data - * directly in the uip_appdata buffer, and return the - * length of the generated data. The generator function is - * called by the protosocket layer when the data first is - * sent, and once for every retransmission that is needed. - * - * \hideinitializer - */ -#define PSOCK_GENERATOR_SEND(psock, generator, arg) \ - PT_WAIT_THREAD(&((psock)->pt), \ - psock_generator_send(psock, generator, arg)) - - -/** - * Close a protosocket. - * - * This macro closes a protosocket and can only be called from within the - * protothread in which the protosocket lives. - * - * \param psock (struct psock *) A pointer to the protosocket that is to - * be closed. - * - * \hideinitializer - */ -#define PSOCK_CLOSE(psock) uip_close() - -PT_THREAD(psock_readbuf_len(struct psock *psock, uint16_t len)); -/** - * Read data until the buffer is full. - * - * This macro will block waiting for data and read the data into the - * input buffer specified with the call to PSOCK_INIT(). Data is read - * until the buffer is full.. - * - * \param psock (struct psock *) A pointer to the protosocket from which - * data should be read. - * - * \hideinitializer - */ -#define PSOCK_READBUF(psock) \ - PT_WAIT_THREAD(&((psock)->pt), psock_readbuf_len(psock, 1)) - - -/** - * Read data until at least len bytes have been read. - * - * This macro will block waiting for data and read the data into the - * input buffer specified with the call to PSOCK_INIT(). Data is read - * until the buffer is full or len bytes have been read. - * - * \param psock (struct psock *) A pointer to the protosocket from which - * data should be read. - * \param len (uint16_t) The minimum number of bytes to read. - * - * \hideinitializer - */ -#define PSOCK_READBUF_LEN(psock, len) \ - PT_WAIT_THREAD(&((psock)->pt), psock_readbuf_len(psock, len)) - -PT_THREAD(psock_readto(struct psock *psock, unsigned char c)); -/** - * Read data up to a specified character. - * - * This macro will block waiting for data and read the data into the - * input buffer specified with the call to PSOCK_INIT(). Data is only - * read until the specified character appears in the data stream. - * - * \param psock (struct psock *) A pointer to the protosocket from which - * data should be read. - * - * \param c (char) The character at which to stop reading. - * - * \hideinitializer - */ -#define PSOCK_READTO(psock, c) \ - PT_WAIT_THREAD(&((psock)->pt), psock_readto(psock, c)) - -/** - * The length of the data that was previously read. - * - * This macro returns the length of the data that was previously read - * using PSOCK_READTO() or PSOCK_READ(). - * - * \param psock (struct psock *) A pointer to the protosocket holding the data. - * - * \hideinitializer - */ -#define PSOCK_DATALEN(psock) psock_datalen(psock) - -uint16_t psock_datalen(struct psock *psock); - -/** - * Exit the protosocket's protothread. - * - * This macro terminates the protothread of the protosocket and should - * almost always be used in conjunction with PSOCK_CLOSE(). - * - * \sa PSOCK_CLOSE_EXIT() - * - * \param psock (struct psock *) A pointer to the protosocket. - * - * \hideinitializer - */ -#define PSOCK_EXIT(psock) PT_EXIT(&((psock)->pt)) - -/** - * Close a protosocket and exit the protosocket's protothread. - * - * This macro closes a protosocket and exits the protosocket's protothread. - * - * \param psock (struct psock *) A pointer to the protosocket. - * - * \hideinitializer - */ -#define PSOCK_CLOSE_EXIT(psock) \ - do { \ - PSOCK_CLOSE(psock); \ - PSOCK_EXIT(psock); \ - } while(0) - -/** - * Declare the end of a protosocket's protothread. - * - * This macro is used for declaring that the protosocket's protothread - * ends. It must always be used together with a matching PSOCK_BEGIN() - * macro. - * - * \param psock (struct psock *) A pointer to the protosocket. - * - * \hideinitializer - */ -#define PSOCK_END(psock) PT_END(&((psock)->pt)) - -char psock_newdata(struct psock *s); - -/** - * Check if new data has arrived on a protosocket. - * - * This macro is used in conjunction with the PSOCK_WAIT_UNTIL() - * macro to check if data has arrived on a protosocket. - * - * \param psock (struct psock *) A pointer to the protosocket. - * - * \hideinitializer - */ -#define PSOCK_NEWDATA(psock) psock_newdata(psock) - -/** - * Wait until a condition is true. - * - * This macro blocks the protothread until the specified condition is - * true. The macro PSOCK_NEWDATA() can be used to check if new data - * arrives when the protosocket is waiting. - * - * Typically, this macro is used as follows: - * - \code - PT_THREAD(thread(struct psock *s, struct timer *t)) - { - PSOCK_BEGIN(s); - - PSOCK_WAIT_UNTIL(s, PSOCK_NEWDATA(s) || timer_expired(t)); - - if(PSOCK_NEWDATA(s)) { - PSOCK_READTO(s, '\n'); - } else { - handle_timed_out(s); - } - - PSOCK_END(s); - } - \endcode - * - * \param psock (struct psock *) A pointer to the protosocket. - * \param condition The condition to wait for. - * - * \hideinitializer - */ -#define PSOCK_WAIT_UNTIL(psock, condition) \ - PT_WAIT_UNTIL(&((psock)->pt), (condition)); - -#define PSOCK_WAIT_THREAD(psock, condition) \ - PT_WAIT_THREAD(&((psock)->pt), (condition)) - -#endif /* PSOCK_H_ */ - -/** @} */ -/** @} */ diff --git a/os/net/ipv6/resolv.c b/os/net/ipv6/resolv.c deleted file mode 100644 index 29af2b4cf..000000000 --- a/os/net/ipv6/resolv.c +++ /dev/null @@ -1,1475 +0,0 @@ -/* - * Copyright (c) 2002-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * - */ - -/** - * \file - * DNS host name to IP address resolver. - * \author Adam Dunkels - * \author Robert Quattlebaum - * - * This file implements a DNS host name to IP address resolver, - * as well as an MDNS responder and resolver. - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \defgroup uipdns uIP hostname resolver functions - * @{ - * - * The uIP DNS resolver functions are used to lookup a hostname and - * map it to a numerical IP address. It maintains a list of resolved - * hostnames that can be queried with the resolv_lookup() - * function. New hostnames can be resolved using the resolv_query() - * function. - * - * The event resolv_event_found is posted when a hostname has been - * resolved. It is up to the receiving process to determine if the - * correct hostname has been found by calling the resolv_lookup() - * function with the hostname. - */ - -#include "net/ipv6/tcpip.h" -#include "net/ipv6/resolv.h" -#include "net/ipv6/uip-udp-packet.h" -#include "net/ipv6/uip-nameserver.h" -#include "lib/random.h" - -#ifndef DEBUG -#define DEBUG CONTIKI_TARGET_COOJA -#endif - -#if UIP_UDP - -#include -#include -#include - -#ifndef NULL -#define NULL (void *)0 -#endif /* NULL */ - -#if !defined(__SDCC) && defined(SDCC_REVISION) -#define __SDCC 1 -#endif - -#if VERBOSE_DEBUG -#define DEBUG_PRINTF(...) printf(__VA_ARGS__) -#else -#define DEBUG_PRINTF(...) do { } while(0) -#endif - -#if DEBUG || VERBOSE_DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) do { } while(0) -#endif - -#ifdef __SDCC -static int -strncasecmp(const char *s1, const char *s2, size_t n) -{ - /* TODO: Add case support! */ - return strncmp(s1, s2, n); -} -static int -strcasecmp(const char *s1, const char *s2) -{ - /* TODO: Add case support! */ - return strcmp(s1, s2); -} -#else -int strcasecmp(const char *s1, const char *s2); -int strncasecmp(const char *s1, const char *s2, size_t n); -#endif /* __SDCC */ - -/* If RESOLV_CONF_SUPPORTS_MDNS is set, then queries - * for domain names in the local TLD will use mDNS as - * described by draft-cheshire-dnsext-multicastdns. - */ -#ifndef RESOLV_CONF_SUPPORTS_MDNS -#define RESOLV_CONF_SUPPORTS_MDNS 1 -#endif - -#ifndef RESOLV_CONF_MDNS_INCLUDE_GLOBAL_V6_ADDRS -#define RESOLV_CONF_MDNS_INCLUDE_GLOBAL_V6_ADDRS 0 -#endif - -/** The maximum number of retries when asking for a name. */ -#ifndef RESOLV_CONF_MAX_RETRIES -#define RESOLV_CONF_MAX_RETRIES 4 -#endif - -#ifndef RESOLV_CONF_MAX_MDNS_RETRIES -#define RESOLV_CONF_MAX_MDNS_RETRIES 3 -#endif - -#ifndef RESOLV_CONF_MAX_DOMAIN_NAME_SIZE -#define RESOLV_CONF_MAX_DOMAIN_NAME_SIZE 32 -#endif - -#ifdef RESOLV_CONF_AUTO_REMOVE_TRAILING_DOTS -#define RESOLV_AUTO_REMOVE_TRAILING_DOTS RESOLV_CONF_AUTO_REMOVE_TRAILING_DOTS -#else -#define RESOLV_AUTO_REMOVE_TRAILING_DOTS RESOLV_CONF_SUPPORTS_MDNS -#endif - -#ifdef RESOLV_CONF_VERIFY_ANSWER_NAMES -#define RESOLV_VERIFY_ANSWER_NAMES RESOLV_CONF_VERIFY_ANSWER_NAMES -#else -#define RESOLV_VERIFY_ANSWER_NAMES RESOLV_CONF_SUPPORTS_MDNS -#endif - -#ifdef RESOLV_CONF_SUPPORTS_RECORD_EXPIRATION -#define RESOLV_SUPPORTS_RECORD_EXPIRATION RESOLV_CONF_SUPPORTS_RECORD_EXPIRATION -#else -#define RESOLV_SUPPORTS_RECORD_EXPIRATION 1 -#endif - -#if RESOLV_CONF_SUPPORTS_MDNS && !RESOLV_VERIFY_ANSWER_NAMES -#error RESOLV_CONF_SUPPORTS_MDNS cannot be set without RESOLV_CONF_VERIFY_ANSWER_NAMES -#endif - -#if !defined(CONTIKI_TARGET_NAME) && defined(BOARD) -#define stringy2(x) #x -#define stringy(x) stringy2(x) -#define CONTIKI_TARGET_NAME stringy(BOARD) -#endif - -#ifndef CONTIKI_CONF_DEFAULT_HOSTNAME -#ifdef CONTIKI_TARGET_NAME -#define CONTIKI_CONF_DEFAULT_HOSTNAME "contiki-"CONTIKI_TARGET_NAME -#else -#define CONTIKI_CONF_DEFAULT_HOSTNAME "contiki" -#endif -#endif - -#define DNS_TYPE_A 1 -#define DNS_TYPE_CNAME 5 -#define DNS_TYPE_PTR 12 -#define DNS_TYPE_MX 15 -#define DNS_TYPE_TXT 16 -#define DNS_TYPE_AAAA 28 -#define DNS_TYPE_SRV 33 -#define DNS_TYPE_ANY 255 -#define DNS_TYPE_NSEC 47 - -#define NATIVE_DNS_TYPE DNS_TYPE_AAAA /* IPv6 */ - -#define DNS_CLASS_IN 1 -#define DNS_CLASS_ANY 255 - -#ifndef DNS_PORT -#define DNS_PORT 53 -#endif - -#ifndef MDNS_PORT -#define MDNS_PORT 5353 -#endif - -#ifndef MDNS_RESPONDER_PORT -#define MDNS_RESPONDER_PORT 5354 -#endif - -/** \internal The DNS message header. */ -struct dns_hdr { - uint16_t id; - uint8_t flags1, flags2; -#define DNS_FLAG1_RESPONSE 0x80 -#define DNS_FLAG1_OPCODE_STATUS 0x10 -#define DNS_FLAG1_OPCODE_INVERSE 0x08 -#define DNS_FLAG1_OPCODE_STANDARD 0x00 -#define DNS_FLAG1_AUTHORATIVE 0x04 -#define DNS_FLAG1_TRUNC 0x02 -#define DNS_FLAG1_RD 0x01 -#define DNS_FLAG2_RA 0x80 -#define DNS_FLAG2_ERR_MASK 0x0f -#define DNS_FLAG2_ERR_NONE 0x00 -#define DNS_FLAG2_ERR_NAME 0x03 - uint16_t numquestions; - uint16_t numanswers; - uint16_t numauthrr; - uint16_t numextrarr; -}; - -/** \internal The DNS answer message structure. */ -struct dns_answer { - /* DNS answer record starts with either a domain name or a pointer - * to a name already present somewhere in the packet. */ - uint16_t type; - uint16_t class; - uint16_t ttl[2]; - uint16_t len; - uint8_t ipaddr[16]; -}; - -struct namemap { -#define STATE_UNUSED 0 -#define STATE_ERROR 1 -#define STATE_NEW 2 -#define STATE_ASKING 3 -#define STATE_DONE 4 - uint8_t state; - uint8_t tmr; - uint16_t id; - uint8_t retries; - uint8_t seqno; -#if RESOLV_SUPPORTS_RECORD_EXPIRATION - unsigned long expiration; -#endif /* RESOLV_SUPPORTS_RECORD_EXPIRATION */ - uip_ipaddr_t ipaddr; - uint8_t err; - uint8_t server; -#if RESOLV_CONF_SUPPORTS_MDNS - int is_mdns:1, is_probe:1; -#endif - char name[RESOLV_CONF_MAX_DOMAIN_NAME_SIZE + 1]; -}; - -#ifndef UIP_CONF_RESOLV_ENTRIES -#define RESOLV_ENTRIES 4 -#else /* UIP_CONF_RESOLV_ENTRIES */ -#define RESOLV_ENTRIES UIP_CONF_RESOLV_ENTRIES -#endif /* UIP_CONF_RESOLV_ENTRIES */ - -static struct namemap names[RESOLV_ENTRIES]; - -static uint8_t seqno; - -static struct uip_udp_conn *resolv_conn = NULL; - -static struct etimer retry; - -process_event_t resolv_event_found; - -PROCESS(resolv_process, "DNS resolver"); - -static void resolv_found(char *name, uip_ipaddr_t * ipaddr); - -/** \internal The DNS question message structure. */ -struct dns_question { - uint16_t type; - uint16_t class; -}; - -#if RESOLV_CONF_SUPPORTS_MDNS -static char resolv_hostname[RESOLV_CONF_MAX_DOMAIN_NAME_SIZE + 1]; - -enum { - MDNS_STATE_WAIT_BEFORE_PROBE, - MDNS_STATE_PROBING, - MDNS_STATE_READY, -}; - -static uint8_t mdns_state; - -static const uip_ipaddr_t resolv_mdns_addr = - { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb } }; -#include "net/ipv6/uip-ds6.h" - -static int mdns_needs_host_announce; - -PROCESS(mdns_probe_process, "mDNS probe"); -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - -/*---------------------------------------------------------------------------*/ -#if RESOLV_VERIFY_ANSWER_NAMES || VERBOSE_DEBUG -/** \internal - * \brief Decodes a DNS name from the DNS format into the given string. - * \return 1 upon success, 0 if the size of the name would be too large. - * - * \note `dest` must point to a buffer with at least - * `RESOLV_CONF_MAX_DOMAIN_NAME_SIZE+1` bytes large. - */ -static uint8_t -decode_name(const unsigned char *query, char *dest, - const unsigned char *packet) -{ - int len = RESOLV_CONF_MAX_DOMAIN_NAME_SIZE; - - unsigned char n = *query++; - - //DEBUG_PRINTF("resolver: decoding name: \""); - - while(len && n) { - if(n & 0xc0) { - const uint16_t offset = query[0] + ((n & ~0xC0) << 8); - - //DEBUG_PRINTF("",offset); - query = packet + offset; - n = *query++; - } - - if(!n) - break; - - for(; n; --n) { - //DEBUG_PRINTF("%c",*query); - - *dest++ = *query++; - - if(!--len) { - *dest = 0; - return 0; - } - } - - n = *query++; - - if(n) { - //DEBUG_PRINTF("."); - *dest++ = '.'; - --len; - } - } - - //DEBUG_PRINTF("\"\n"); - *dest = 0; - return len != 0; -} -/*---------------------------------------------------------------------------*/ -/** \internal - */ -static uint8_t -dns_name_isequal(const unsigned char *queryptr, const char *name, - const unsigned char *packet) -{ - unsigned char n = *queryptr++; - - if(*name == 0) - return 0; - - while(n) { - if(n & 0xc0) { - queryptr = packet + queryptr[0] + ((n & ~0xC0) << 8); - n = *queryptr++; - } - - for(; n; --n) { - if(!*name) { - return 0; - } - - if(tolower((unsigned int)*name++) != tolower((unsigned int)*queryptr++)) { - return 0; - } - } - - n = *queryptr++; - - if((n != 0) && (*name++ != '.')) { - return 0; - } - } - - if(*name == '.') - ++name; - - return name[0] == 0; -} -#endif /* RESOLV_VERIFY_ANSWER_NAMES */ -/*---------------------------------------------------------------------------*/ -/** \internal - */ -static unsigned char * -skip_name(unsigned char *query) -{ - unsigned char n; - - DEBUG_PRINTF("resolver: skip name: "); - - do { - n = *query; - if(n & 0xc0) { - DEBUG_PRINTF("", query[0] + ((n & ~0xC0) << 8)); - ++query; - break; - } - - ++query; - - while(n > 0) { - DEBUG_PRINTF("%c", *query); - ++query; - --n; - }; - DEBUG_PRINTF("."); - } while(*query != 0); - DEBUG_PRINTF("\n"); - return query + 1; -} -/*---------------------------------------------------------------------------*/ -/** \internal - */ -static unsigned char * -encode_name(unsigned char *query, const char *nameptr) -{ - char *nptr; - - --nameptr; - /* Convert hostname into suitable query format. */ - do { - uint8_t n = 0; - - ++nameptr; - nptr = (char *)query; - ++query; - for(n = 0; *nameptr != '.' && *nameptr != 0; ++nameptr) { - *query = *nameptr; - ++query; - ++n; - } - *nptr = n; - } while(*nameptr != 0); - - /* End the the name. */ - *query++ = 0; - - return query; -} -/*---------------------------------------------------------------------------*/ -#if RESOLV_CONF_SUPPORTS_MDNS -/** \internal - */ -static void -mdns_announce_requested(void) -{ - mdns_needs_host_announce = 1; -} -/*---------------------------------------------------------------------------*/ -/** \internal - */ -static void -start_name_collision_check(clock_time_t after) -{ - process_exit(&mdns_probe_process); - process_start(&mdns_probe_process, (void *)&after); -} -/*---------------------------------------------------------------------------*/ -/** \internal - */ -static unsigned char * -mdns_write_announce_records(unsigned char *queryptr, uint8_t *count) -{ - uint8_t i; - - for(i = 0; i < UIP_DS6_ADDR_NB; ++i) { - if(uip_ds6_if.addr_list[i].isused -#if !RESOLV_CONF_MDNS_INCLUDE_GLOBAL_V6_ADDRS - && uip_is_addr_linklocal(&uip_ds6_if.addr_list[i].ipaddr) -#endif - ) { - if(!*count) { - queryptr = encode_name(queryptr, resolv_hostname); - } else { - /* Use name compression to refer back to the first name */ - *queryptr++ = 0xc0; - *queryptr++ = sizeof(struct dns_hdr); - } - - *queryptr++ = (uint8_t) ((NATIVE_DNS_TYPE) >> 8); - *queryptr++ = (uint8_t) ((NATIVE_DNS_TYPE)); - - *queryptr++ = (uint8_t) ((DNS_CLASS_IN | 0x8000) >> 8); - *queryptr++ = (uint8_t) ((DNS_CLASS_IN | 0x8000)); - - *queryptr++ = 0; - *queryptr++ = 0; - *queryptr++ = 0; - *queryptr++ = 120; - - *queryptr++ = 0; - *queryptr++ = sizeof(uip_ipaddr_t); - - uip_ipaddr_copy((uip_ipaddr_t*)queryptr, &uip_ds6_if.addr_list[i].ipaddr); - queryptr += sizeof(uip_ipaddr_t); - ++(*count); - } - } - return queryptr; -} -/*---------------------------------------------------------------------------*/ -/** \internal - * Called when we need to announce ourselves - */ -static size_t -mdns_prep_host_announce_packet(void) -{ - static const struct { - uint16_t type; - uint16_t class; - uint16_t ttl[2]; - uint16_t len; - uint8_t data[8]; - - } nsec_record = { - UIP_HTONS(DNS_TYPE_NSEC), - UIP_HTONS(DNS_CLASS_IN | 0x8000), - { 0, UIP_HTONS(120) }, - UIP_HTONS(8), - - { - 0xc0, - sizeof(struct dns_hdr), /* Name compression. Re-using the name of first record. */ - 0x00, - 0x04, - - 0x00, - 0x00, - 0x00, - 0x08, - } - }; - - unsigned char *queryptr; - - uint8_t total_answers = 0; - - /* Be aware that, unless `ARCH_DOESNT_NEED_ALIGNED_STRUCTS` is set, - * writing directly to the uint16_t members of this struct is an error. */ - struct dns_hdr *hdr = (struct dns_hdr *)uip_appdata; - - /* Zero out the header */ - memset((void *)hdr, 0, sizeof(*hdr)); - - hdr->flags1 |= DNS_FLAG1_RESPONSE | DNS_FLAG1_AUTHORATIVE; - - queryptr = (unsigned char *)uip_appdata + sizeof(*hdr); - - queryptr = mdns_write_announce_records(queryptr, &total_answers); - - /* We now need to add an NSEC record to indicate - * that this is all there is. - */ - if(!total_answers) { - queryptr = encode_name(queryptr, resolv_hostname); - } else { - /* Name compression. Re-using the name of first record. */ - *queryptr++ = 0xc0; - *queryptr++ = sizeof(*hdr); - } - - memcpy((void *)queryptr, (void *)&nsec_record, sizeof(nsec_record)); - - queryptr += sizeof(nsec_record); - - /* This platform might be picky about alignment. To avoid the possibility - * of doing an unaligned write, we are going to do this manually. */ - ((uint8_t*)&hdr->numanswers)[1] = total_answers; - ((uint8_t*)&hdr->numextrarr)[1] = 1; - - return (queryptr - (unsigned char *)uip_appdata); -} -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ -/*---------------------------------------------------------------------------*/ -static char -try_next_server(struct namemap *namemapptr) -{ -#if VERBOSE_DEBUG - printf("server %d\n", namemapptr->server); -#endif - namemapptr->server++; - if(uip_nameserver_get(namemapptr->server) != NULL) { - namemapptr->retries = 0; - return 1; - } - namemapptr->server = 0; - return 0; -} -/*---------------------------------------------------------------------------*/ -/** \internal - * Runs through the list of names to see if there are any that have - * not yet been queried and, if so, sends out a query. - */ -static void -check_entries(void) -{ - volatile uint8_t i; - - uint8_t *query; - - register struct dns_hdr *hdr; - - register struct namemap *namemapptr; - - for(i = 0; i < RESOLV_ENTRIES; ++i) { - namemapptr = &names[i]; - if(namemapptr->state == STATE_NEW || namemapptr->state == STATE_ASKING) { - etimer_set(&retry, CLOCK_SECOND / 4); - if(namemapptr->state == STATE_ASKING) { - if(--namemapptr->tmr == 0) { -#if RESOLV_CONF_SUPPORTS_MDNS - if(++namemapptr->retries == - (namemapptr->is_mdns ? RESOLV_CONF_MAX_MDNS_RETRIES : - RESOLV_CONF_MAX_RETRIES)) -#else /* RESOLV_CONF_SUPPORTS_MDNS */ - if(++namemapptr->retries == RESOLV_CONF_MAX_RETRIES) -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - { - /* Try the next server (if possible) before failing. Otherwise - simply mark the entry as failed. */ - if(try_next_server(namemapptr) == 0) { - /* STATE_ERROR basically means "not found". */ - namemapptr->state = STATE_ERROR; - -#if RESOLV_SUPPORTS_RECORD_EXPIRATION - /* Keep the "not found" error valid for 30 seconds */ - namemapptr->expiration = clock_seconds() + 30; -#endif /* RESOLV_SUPPORTS_RECORD_EXPIRATION */ - - resolv_found(namemapptr->name, NULL); - continue; - } - } - namemapptr->tmr = namemapptr->retries * namemapptr->retries * 3; - -#if RESOLV_CONF_SUPPORTS_MDNS - if(namemapptr->is_probe) { - /* Probing retries are much more aggressive, 250ms */ - namemapptr->tmr = 2; - } -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - } else { - /* Its timer has not run out, so we move on to next - * entry. - */ - continue; - } - } else { - namemapptr->state = STATE_ASKING; - namemapptr->tmr = 1; - namemapptr->retries = 0; - } - hdr = (struct dns_hdr *)uip_appdata; - memset(hdr, 0, sizeof(struct dns_hdr)); - hdr->id = random_rand(); - namemapptr->id = hdr->id; -#if RESOLV_CONF_SUPPORTS_MDNS - if(!namemapptr->is_mdns || namemapptr->is_probe) { - hdr->flags1 = DNS_FLAG1_RD; - } - if(namemapptr->is_mdns) { - hdr->id = 0; - } -#else /* RESOLV_CONF_SUPPORTS_MDNS */ - hdr->flags1 = DNS_FLAG1_RD; -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - hdr->numquestions = UIP_HTONS(1); - query = (unsigned char *)uip_appdata + sizeof(*hdr); - query = encode_name(query, namemapptr->name); -#if RESOLV_CONF_SUPPORTS_MDNS - if(namemapptr->is_probe) { - *query++ = (uint8_t) ((DNS_TYPE_ANY) >> 8); - *query++ = (uint8_t) ((DNS_TYPE_ANY)); - } else -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - { - *query++ = (uint8_t) ((NATIVE_DNS_TYPE) >> 8); - *query++ = (uint8_t) ((NATIVE_DNS_TYPE)); - } - *query++ = (uint8_t) ((DNS_CLASS_IN) >> 8); - *query++ = (uint8_t) ((DNS_CLASS_IN)); -#if RESOLV_CONF_SUPPORTS_MDNS - if(namemapptr->is_mdns) { - if(namemapptr->is_probe) { - /* This is our conflict detection request. - * In order to be in compliance with the MDNS - * spec, we need to add the records we are proposing - * to the rrauth section. - */ - uint8_t count = 0; - - query = mdns_write_announce_records(query, &count); - hdr->numauthrr = UIP_HTONS(count); - } - uip_udp_packet_sendto(resolv_conn, uip_appdata, - (query - (uint8_t *) uip_appdata), - &resolv_mdns_addr, UIP_HTONS(MDNS_PORT)); - - PRINTF("resolver: (i=%d) Sent MDNS %s for \"%s\".\n", i, - namemapptr->is_probe?"probe":"request",namemapptr->name); - } else { - uip_udp_packet_sendto(resolv_conn, uip_appdata, - (query - (uint8_t *) uip_appdata), - (const uip_ipaddr_t *) - uip_nameserver_get(namemapptr->server), - UIP_HTONS(DNS_PORT)); - - PRINTF("resolver: (i=%d) Sent DNS request for \"%s\".\n", i, - namemapptr->name); - } -#else /* RESOLV_CONF_SUPPORTS_MDNS */ - uip_udp_packet_sendto(resolv_conn, uip_appdata, - (query - (uint8_t *) uip_appdata), - uip_nameserver_get(namemapptr->server), - UIP_HTONS(DNS_PORT)); - PRINTF("resolver: (i=%d) Sent DNS request for \"%s\".\n", i, - namemapptr->name); -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - break; - } - } -} -/*---------------------------------------------------------------------------*/ -/** \internal - * Called when new UDP data arrives. - */ -static void -newdata(void) -{ - uint8_t nquestions, nanswers; - - int8_t i; - - register struct namemap *namemapptr = NULL; - - struct dns_answer *ans; - - register struct dns_hdr const *hdr = (struct dns_hdr *)uip_appdata; - - unsigned char *queryptr = (unsigned char *)hdr + sizeof(*hdr); - - const uint8_t is_request = ((hdr->flags1 & ~1) == 0) && (hdr->flags2 == 0); - - /* We only care about the question(s) and the answers. The authrr - * and the extrarr are simply discarded. - */ - nquestions = (uint8_t) uip_ntohs(hdr->numquestions); - nanswers = (uint8_t) uip_ntohs(hdr->numanswers); - - queryptr = (unsigned char *)hdr + sizeof(*hdr); - i = 0; - - DEBUG_PRINTF - ("resolver: flags1=0x%02X flags2=0x%02X nquestions=%d, nanswers=%d, nauthrr=%d, nextrarr=%d\n", - hdr->flags1, hdr->flags2, (uint8_t) nquestions, (uint8_t) nanswers, - (uint8_t) uip_ntohs(hdr->numauthrr), - (uint8_t) uip_ntohs(hdr->numextrarr)); - - if(is_request && (nquestions == 0)) { - /* Skip requests with no questions. */ - DEBUG_PRINTF("resolver: Skipping request with no questions.\n"); - return; - } - -/** QUESTION HANDLING SECTION ************************************************/ - - for(; nquestions > 0; - queryptr = skip_name(queryptr) + sizeof(struct dns_question), - --nquestions - ) { -#if RESOLV_CONF_SUPPORTS_MDNS - if(!is_request) { - /* If this isn't a request, we don't need to bother - * looking at the individual questions. For the most - * part, this loop to just used to skip past them. - */ - continue; - } - - { - struct dns_question *question = (struct dns_question *)skip_name(queryptr); - -#if !ARCH_DOESNT_NEED_ALIGNED_STRUCTS - static struct dns_question aligned; - memcpy(&aligned, question, sizeof(aligned)); - question = &aligned; -#endif /* !ARCH_DOESNT_NEED_ALIGNED_STRUCTS */ - - DEBUG_PRINTF("resolver: Question %d: type=%d class=%d\n", ++i, - uip_htons(question->type), uip_htons(question->class)); - - if(((uip_ntohs(question->class) & 0x7FFF) != DNS_CLASS_IN) || - ((question->type != UIP_HTONS(DNS_TYPE_ANY)) && - (question->type != UIP_HTONS(NATIVE_DNS_TYPE)))) { - /* Skip unrecognised records. */ - continue; - } - - if(!dns_name_isequal(queryptr, resolv_hostname, uip_appdata)) { - continue; - } - - PRINTF("resolver: THIS IS A REQUEST FOR US!!!\n"); - - if(mdns_state == MDNS_STATE_READY) { - /* We only send immediately if this isn't an MDNS request. - * Otherwise, we schedule ourselves to send later. - */ - if(UIP_UDP_BUF->srcport == UIP_HTONS(MDNS_PORT)) { - mdns_announce_requested(); - } else { - uip_udp_packet_sendto(resolv_conn, uip_appdata, - mdns_prep_host_announce_packet(), - &UIP_IP_BUF->srcipaddr, - UIP_UDP_BUF->srcport); - } - return; - } else { - uint8_t nauthrr; - PRINTF("resolver: But we are still probing. Waiting...\n"); - /* We are still probing. We need to do the mDNS - * probe race condition check here and make sure - * we don't need to delay probing for a second. - */ - nauthrr = (uint8_t)uip_ntohs(hdr->numauthrr); - - /* For now, we will always restart the collision check if - * there are *any* authority records present. - * In the future we should follow the spec more closely, - * but this should eventually converge to something reasonable. - */ - if(nauthrr) { - start_name_collision_check(CLOCK_SECOND); - } - } - } -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - } - -/** ANSWER HANDLING SECTION **************************************************/ - - if(nanswers == 0) { - /* Skip responses with no answers. */ - return; - } - -#if RESOLV_CONF_SUPPORTS_MDNS - if(UIP_UDP_BUF->srcport == UIP_HTONS(MDNS_PORT) && - hdr->id == 0) { - /* OK, this was from MDNS. Things get a little weird here, - * because we can't use the `id` field. We will look up the - * appropriate request in a later step. */ - - i = -1; - namemapptr = NULL; - } else -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - { - for(i = 0; i < RESOLV_ENTRIES; ++i) { - namemapptr = &names[i]; - if(namemapptr->state == STATE_ASKING && - namemapptr->id == hdr->id) { - break; - } - } - - if(i >= RESOLV_ENTRIES || i < 0 || namemapptr->state != STATE_ASKING) { - PRINTF("resolver: DNS response has bad ID (%04X) \n", uip_ntohs(hdr->id)); - return; - } - - PRINTF("resolver: Incoming response for \"%s\".\n", namemapptr->name); - - /* We'll change this to DONE when we find the record. */ - namemapptr->state = STATE_ERROR; - - namemapptr->err = hdr->flags2 & DNS_FLAG2_ERR_MASK; - -#if RESOLV_SUPPORTS_RECORD_EXPIRATION - /* If we remain in the error state, keep it cached for 30 seconds. */ - namemapptr->expiration = clock_seconds() + 30; -#endif /* RESOLV_SUPPORTS_RECORD_EXPIRATION */ - - /* Check for error. If so, call callback to inform. */ - if(namemapptr->err != 0) { - namemapptr->state = STATE_ERROR; - resolv_found(namemapptr->name, NULL); - return; - } - } - - i = 0; - - /* Answer parsing loop */ - while(nanswers > 0) { - ans = (struct dns_answer *)skip_name(queryptr); - -#if !ARCH_DOESNT_NEED_ALIGNED_STRUCTS - { - static struct dns_answer aligned; - memcpy(&aligned, ans, sizeof(aligned)); - ans = &aligned; - } -#endif /* !ARCH_DOESNT_NEED_ALIGNED_STRUCTS */ - -#if VERBOSE_DEBUG - char debug_name[40]; - decode_name(queryptr, debug_name, uip_appdata); - DEBUG_PRINTF("resolver: Answer %d: \"%s\", type %d, class %d, ttl %d, length %d\n", - ++i, debug_name, uip_ntohs(ans->type), - uip_ntohs(ans->class) & 0x7FFF, - (int)((uint32_t) uip_ntohs(ans->ttl[0]) << 16) | (uint32_t) - uip_ntohs(ans->ttl[1]), uip_ntohs(ans->len)); -#endif /* VERBOSE_DEBUG */ - - /* Check the class and length of the answer to make sure - * it matches what we are expecting - */ - if(((uip_ntohs(ans->class) & 0x7FFF) != DNS_CLASS_IN) || - (ans->len != UIP_HTONS(sizeof(uip_ipaddr_t)))) { - goto skip_to_next_answer; - } - - if(ans->type != UIP_HTONS(NATIVE_DNS_TYPE)) { - goto skip_to_next_answer; - } - -#if RESOLV_CONF_SUPPORTS_MDNS - if(UIP_UDP_BUF->srcport == UIP_HTONS(MDNS_PORT) && - hdr->id == 0) { - int8_t available_i = RESOLV_ENTRIES; - - DEBUG_PRINTF("resolver: MDNS query.\n"); - - /* For MDNS, we need to actually look up the name we - * are looking for. - */ - for(i = 0; i < RESOLV_ENTRIES; ++i) { - namemapptr = &names[i]; - if(dns_name_isequal(queryptr, namemapptr->name, uip_appdata)) { - break; - } - if((namemapptr->state == STATE_UNUSED) -#if RESOLV_SUPPORTS_RECORD_EXPIRATION - || (namemapptr->state == STATE_DONE && clock_seconds() > namemapptr->expiration) -#endif /* RESOLV_SUPPORTS_RECORD_EXPIRATION */ - ) { - available_i = i; - } - } - if(i == RESOLV_ENTRIES) { - DEBUG_PRINTF("resolver: Unsolicited MDNS response.\n"); - i = available_i; - namemapptr = &names[i]; - if(!decode_name(queryptr, namemapptr->name, uip_appdata)) { - DEBUG_PRINTF("resolver: MDNS name too big to cache.\n"); - namemapptr = NULL; - goto skip_to_next_answer; - } - } - if(i == RESOLV_ENTRIES) { - DEBUG_PRINTF - ("resolver: Not enough room to keep track of unsolicited MDNS answer.\n"); - - if(dns_name_isequal(queryptr, resolv_hostname, uip_appdata)) { - /* Oh snap, they say they are us! We had better report them... */ - resolv_found(resolv_hostname, (uip_ipaddr_t *) ans->ipaddr); - } - namemapptr = NULL; - goto skip_to_next_answer; - } - namemapptr = &names[i]; - - } else -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - { - /* This will force us to stop even if there are more answers. */ - nanswers = 1; - } - -/* This is disabled for now, so that we don't fail on CNAME records. -#if RESOLV_VERIFY_ANSWER_NAMES - if(namemapptr && !dns_name_isequal(queryptr, namemapptr->name, uip_appdata)) { - DEBUG_PRINTF("resolver: Answer name doesn't match question...!\n"); - goto skip_to_next_answer; - } -#endif -*/ - - DEBUG_PRINTF("resolver: Answer for \"%s\" is usable.\n", namemapptr->name); - - namemapptr->state = STATE_DONE; -#if RESOLV_SUPPORTS_RECORD_EXPIRATION - namemapptr->expiration = (uint32_t) uip_ntohs(ans->ttl[0]) << 16 | - (uint32_t) uip_ntohs(ans->ttl[1]); - namemapptr->expiration += clock_seconds(); -#endif /* RESOLV_SUPPORTS_RECORD_EXPIRATION */ - - uip_ipaddr_copy(&namemapptr->ipaddr, (uip_ipaddr_t *) ans->ipaddr); - - resolv_found(namemapptr->name, &namemapptr->ipaddr); - break; - - skip_to_next_answer: - queryptr = (unsigned char *)skip_name(queryptr) + 10 + uip_htons(ans->len); - --nanswers; - } - - /* Got to this point there's no answer, try next nameserver if available - since this one doesn't know the answer */ -#if RESOLV_CONF_SUPPORTS_MDNS - if(nanswers == 0 && UIP_UDP_BUF->srcport != UIP_HTONS(MDNS_PORT) - && hdr->id != 0) -#else - if(nanswers == 0) -#endif - { - if(try_next_server(namemapptr)) { - namemapptr->state = STATE_ASKING; - process_post(&resolv_process, PROCESS_EVENT_TIMER, NULL); - } - } - -} -/*---------------------------------------------------------------------------*/ -#if RESOLV_CONF_SUPPORTS_MDNS -/** - * \brief Changes the local hostname advertised by MDNS. - * \param hostname The new hostname to advertise. - */ -void -resolv_set_hostname(const char *hostname) -{ - strncpy(resolv_hostname, hostname, RESOLV_CONF_MAX_DOMAIN_NAME_SIZE); - - /* Add the .local suffix if it isn't already there */ - if(strlen(resolv_hostname) < 7 || - strcasecmp(resolv_hostname + strlen(resolv_hostname) - 6, ".local") != 0) { - strncat(resolv_hostname, ".local", RESOLV_CONF_MAX_DOMAIN_NAME_SIZE - strlen(resolv_hostname)); - } - - PRINTF("resolver: hostname changed to \"%s\"\n", resolv_hostname); - - start_name_collision_check(0); -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Returns the local hostname being advertised via MDNS. - * \return C-string containing the local hostname. - */ -const char * -resolv_get_hostname(void) -{ - return resolv_hostname; -} -/*---------------------------------------------------------------------------*/ -/** \internal - * Process for probing for name conflicts. - */ -PROCESS_THREAD(mdns_probe_process, ev, data) -{ - static struct etimer delay; - - PROCESS_BEGIN(); - mdns_state = MDNS_STATE_WAIT_BEFORE_PROBE; - - PRINTF("mdns-probe: Process (re)started.\n"); - - /* Wait extra time if specified in data */ - if(NULL != data) { - PRINTF("mdns-probe: Probing will begin in %ld clocks.\n", - (long)*(clock_time_t *) data); - etimer_set(&delay, *(clock_time_t *) data); - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER); - } - - /* We need to wait a random (0-250ms) period of time before - * probing to be in compliance with the MDNS spec. */ - etimer_set(&delay, CLOCK_SECOND * (random_rand() & 0xFF) / 1024); - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER); - - /* Begin searching for our name. */ - mdns_state = MDNS_STATE_PROBING; - resolv_query(resolv_hostname); - - do { - PROCESS_WAIT_EVENT_UNTIL(ev == resolv_event_found); - } while(strcasecmp(resolv_hostname, data) != 0); - - mdns_state = MDNS_STATE_READY; - mdns_announce_requested(); - - PRINTF("mdns-probe: Finished probing.\n"); - - PROCESS_END(); -} -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ -/*---------------------------------------------------------------------------*/ -/** \internal - * The main UDP function. - */ -PROCESS_THREAD(resolv_process, ev, data) -{ - PROCESS_BEGIN(); - - memset(names, 0, sizeof(names)); - - resolv_event_found = process_alloc_event(); - - PRINTF("resolver: Process started.\n"); - - resolv_conn = udp_new(NULL, 0, NULL); - -#if RESOLV_CONF_SUPPORTS_MDNS - PRINTF("resolver: Supports MDNS.\n"); - uip_udp_bind(resolv_conn, UIP_HTONS(MDNS_PORT)); - - uip_ds6_maddr_add(&resolv_mdns_addr); - - resolv_set_hostname(CONTIKI_CONF_DEFAULT_HOSTNAME); -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == PROCESS_EVENT_TIMER) { - tcpip_poll_udp(resolv_conn); - } else if(ev == tcpip_event) { - if(uip_udp_conn == resolv_conn) { - if(uip_newdata()) { - newdata(); - } - if(uip_poll()) { -#if RESOLV_CONF_SUPPORTS_MDNS - if(mdns_needs_host_announce) { - size_t len; - - PRINTF("resolver: Announcing that we are \"%s\".\n", - resolv_hostname); - - memset(uip_appdata, 0, sizeof(struct dns_hdr)); - - len = mdns_prep_host_announce_packet(); - - uip_udp_packet_sendto(resolv_conn, uip_appdata, - len, &resolv_mdns_addr, UIP_HTONS(MDNS_PORT)); - - mdns_needs_host_announce = 0; - - /* Poll again in case this fired - * at the same time the event timer did. - */ - tcpip_poll_udp(resolv_conn); - } else -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - { - check_entries(); - } - } - } - } - -#if RESOLV_CONF_SUPPORTS_MDNS - if(mdns_needs_host_announce) { - tcpip_poll_udp(resolv_conn); - } -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - static uint8_t initialized = 0; - if(!initialized) { - process_start(&resolv_process, NULL); - initialized = 1; - } -} -/*---------------------------------------------------------------------------*/ -#if RESOLV_AUTO_REMOVE_TRAILING_DOTS -static const char * -remove_trailing_dots(const char *name) { - static char dns_name_without_dots[RESOLV_CONF_MAX_DOMAIN_NAME_SIZE + 1]; - size_t len = strlen(name); - - if(len && name[len - 1] == '.') { - strncpy(dns_name_without_dots, name, RESOLV_CONF_MAX_DOMAIN_NAME_SIZE); - while(len && (dns_name_without_dots[len - 1] == '.')) { - dns_name_without_dots[--len] = 0; - } - name = dns_name_without_dots; - } - return name; -} -#else /* RESOLV_AUTO_REMOVE_TRAILING_DOTS */ -#define remove_trailing_dots(x) (x) -#endif /* RESOLV_AUTO_REMOVE_TRAILING_DOTS */ -/*---------------------------------------------------------------------------*/ -/** - * Queues a name so that a question for the name will be sent out. - * - * \param name The hostname that is to be queried. - */ -void -resolv_query(const char *name) -{ - uint8_t i; - - uint8_t lseq, lseqi; - - register struct namemap *nameptr = 0; - - init(); - - lseq = lseqi = 0; - - /* Remove trailing dots, if present. */ - name = remove_trailing_dots(name); - - for(i = 0; i < RESOLV_ENTRIES; ++i) { - nameptr = &names[i]; - if(0 == strcasecmp(nameptr->name, name)) { - break; - } - if((nameptr->state == STATE_UNUSED) -#if RESOLV_SUPPORTS_RECORD_EXPIRATION - || (nameptr->state == STATE_DONE && clock_seconds() > nameptr->expiration) -#endif /* RESOLV_SUPPORTS_RECORD_EXPIRATION */ - ) { - lseqi = i; - lseq = 255; - } else if(seqno - nameptr->seqno > lseq) { - lseq = seqno - nameptr->seqno; - lseqi = i; - } - } - - if(i == RESOLV_ENTRIES) { - i = lseqi; - nameptr = &names[i]; - } - - PRINTF("resolver: Starting query for \"%s\".\n", name); - - memset(nameptr, 0, sizeof(*nameptr)); - - strncpy(nameptr->name, name, sizeof(nameptr->name) - 1); - nameptr->state = STATE_NEW; - nameptr->seqno = seqno; - ++seqno; - -#if RESOLV_CONF_SUPPORTS_MDNS - { - size_t name_len = strlen(name); - - const char local_suffix[] = "local"; - - if((name_len > (sizeof(local_suffix) - 1)) && - (0 == strcasecmp(name + name_len - (sizeof(local_suffix) - 1), local_suffix))) { - PRINTF("resolver: Using MDNS to look up \"%s\".\n", name); - nameptr->is_mdns = 1; - } else { - nameptr->is_mdns = 0; - } - } - nameptr->is_probe = (mdns_state == MDNS_STATE_PROBING) && - (0 == strcmp(nameptr->name, resolv_hostname)); -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - - /* Force check_entires() to run on our process. */ - process_post(&resolv_process, PROCESS_EVENT_TIMER, 0); -} -/*---------------------------------------------------------------------------*/ -/** - * Look up a hostname in the array of known hostnames. - * - * \note This function only looks in the internal array of known - * hostnames, it does not send out a query for the hostname if none - * was found. The function resolv_query() can be used to send a query - * for a hostname. - * - */ -resolv_status_t -resolv_lookup(const char *name, uip_ipaddr_t ** ipaddr) -{ - resolv_status_t ret = RESOLV_STATUS_UNCACHED; - - uint8_t i; - - struct namemap *nameptr; - - /* Remove trailing dots, if present. */ - name = remove_trailing_dots(name); - -#if UIP_CONF_LOOPBACK_INTERFACE - if(strcmp(name, "localhost")) { - static uip_ipaddr_t loopback = - { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } }; - if(ipaddr) { - *ipaddr = &loopback; - } - ret = RESOLV_STATUS_CACHED; - } -#endif /* UIP_CONF_LOOPBACK_INTERFACE */ - - /* Walk through the list to see if the name is in there. */ - for(i = 0; i < RESOLV_ENTRIES; ++i) { - nameptr = &names[i]; - - if(strcasecmp(name, nameptr->name) == 0) { - switch (nameptr->state) { - case STATE_DONE: - ret = RESOLV_STATUS_CACHED; -#if RESOLV_SUPPORTS_RECORD_EXPIRATION - if(clock_seconds() > nameptr->expiration) { - ret = RESOLV_STATUS_EXPIRED; - } -#endif /* RESOLV_SUPPORTS_RECORD_EXPIRATION */ - break; - case STATE_NEW: - case STATE_ASKING: - ret = RESOLV_STATUS_RESOLVING; - break; - /* Almost certainly a not-found error from server */ - case STATE_ERROR: - ret = RESOLV_STATUS_NOT_FOUND; -#if RESOLV_SUPPORTS_RECORD_EXPIRATION - if(clock_seconds() > nameptr->expiration) { - ret = RESOLV_STATUS_UNCACHED; - } -#endif /* RESOLV_SUPPORTS_RECORD_EXPIRATION */ - break; - } - - if(ipaddr) { - *ipaddr = &nameptr->ipaddr; - } - - /* Break out of for loop. */ - break; - } - } - -#if VERBOSE_DEBUG - switch (ret) { - case RESOLV_STATUS_CACHED: - if(ipaddr) { - PRINTF("resolver: Found \"%s\" in cache.\n", name); - const uip_ipaddr_t *addr = *ipaddr; - - DEBUG_PRINTF - ("resolver: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x \n", - ((uint8_t *) addr)[0], ((uint8_t *) addr)[1], ((uint8_t *) addr)[2], - ((uint8_t *) addr)[3], ((uint8_t *) addr)[4], ((uint8_t *) addr)[5], - ((uint8_t *) addr)[6], ((uint8_t *) addr)[7], ((uint8_t *) addr)[8], - ((uint8_t *) addr)[9], ((uint8_t *) addr)[10], - ((uint8_t *) addr)[11], ((uint8_t *) addr)[12], - ((uint8_t *) addr)[13], ((uint8_t *) addr)[14], - ((uint8_t *) addr)[15]); - break; - } - default: - DEBUG_PRINTF("resolver: \"%s\" is NOT cached.\n", name); - break; - } -#endif /* VERBOSE_DEBUG */ - - return ret; -} -/*---------------------------------------------------------------------------*/ -/** \internal - * Callback function which is called when a hostname is found. - * - */ -static void -resolv_found(char *name, uip_ipaddr_t * ipaddr) -{ -#if RESOLV_CONF_SUPPORTS_MDNS - if(strncasecmp(resolv_hostname, name, strlen(resolv_hostname)) == 0 && - ipaddr - && !uip_ds6_is_my_addr(ipaddr) - ) { - uint8_t i; - - if(mdns_state == MDNS_STATE_PROBING) { - /* We found this new name while probing. - * We must now rename ourselves. - */ - PRINTF("resolver: Name collision detected for \"%s\".\n", name); - - /* Remove the ".local" suffix. */ - resolv_hostname[strlen(resolv_hostname) - 6] = 0; - - /* Append the last three hex parts of the link-level address. */ - for(i = 0; i < 3; ++i) { - uint8_t val = uip_lladdr.addr[(UIP_LLADDR_LEN - 3) + i]; - - char append_str[4] = "-XX"; - - append_str[2] = (((val & 0xF) > 9) ? 'a' : '0') + (val & 0xF); - val >>= 4; - append_str[1] = (((val & 0xF) > 9) ? 'a' : '0') + (val & 0xF); - strncat(resolv_hostname, append_str, - sizeof(resolv_hostname) - strlen(resolv_hostname) - 1); /* -1 in order to fit the terminating null byte. */ - } - - /* Re-add the .local suffix */ - strncat(resolv_hostname, ".local", RESOLV_CONF_MAX_DOMAIN_NAME_SIZE - strlen(resolv_hostname)); - - start_name_collision_check(CLOCK_SECOND * 5); - } else if(mdns_state == MDNS_STATE_READY) { - /* We found a collision after we had already asserted - * that we owned this name. We need to immediately - * and explicitly begin probing. - */ - PRINTF("resolver: Possible name collision, probing...\n"); - start_name_collision_check(0); - } - - } else -#endif /* RESOLV_CONF_SUPPORTS_MDNS */ - -#if VERBOSE_DEBUG - if(ipaddr) { - PRINTF("resolver: Found address for \"%s\".\n", name); - PRINTF - ("resolver: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x \n", - ((uint8_t *) ipaddr)[0], ((uint8_t *) ipaddr)[1], - ((uint8_t *) ipaddr)[2], ((uint8_t *) ipaddr)[3], - ((uint8_t *) ipaddr)[4], ((uint8_t *) ipaddr)[5], - ((uint8_t *) ipaddr)[6], ((uint8_t *) ipaddr)[7], - ((uint8_t *) ipaddr)[8], ((uint8_t *) ipaddr)[9], - ((uint8_t *) ipaddr)[10], ((uint8_t *) ipaddr)[11], - ((uint8_t *) ipaddr)[12], ((uint8_t *) ipaddr)[13], - ((uint8_t *) ipaddr)[14], ((uint8_t *) ipaddr)[15]); - } else { - PRINTF("resolver: Unable to retrieve address for \"%s\".\n", name); - } -#endif /* VERBOSE_DEBUG */ - - process_post(PROCESS_BROADCAST, resolv_event_found, name); -} -/*---------------------------------------------------------------------------*/ -#endif /* UIP_UDP */ - -/** @} */ -/** @} */ diff --git a/os/net/ipv6/resolv.h b/os/net/ipv6/resolv.h deleted file mode 100644 index ac414425f..000000000 --- a/os/net/ipv6/resolv.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2002-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * - */ - -/** - * \file - * uIP DNS resolver code header file. - * \author Adam Dunkels - */ - -#ifndef RESOLV_H_ -#define RESOLV_H_ - -#include "contiki.h" -#include "uip.h" - -/** If RESOLV_CONF_SUPPORTS_MDNS is set, then queries - * for domain names in the `local` TLD will use MDNS and - * will respond to MDNS queries for this device's hostname, - * as described by draft-cheshire-dnsext-multicastdns. - */ -#ifndef RESOLV_CONF_SUPPORTS_MDNS -#define RESOLV_CONF_SUPPORTS_MDNS (1) -#endif - -/** - * Event that is broadcasted when a DNS name has been resolved. - */ -extern process_event_t resolv_event_found; - -enum { - /** Hostname is fresh and usable. This response is cached and will eventually - * expire to RESOLV_STATUS_EXPIRED.*/ - RESOLV_STATUS_CACHED = 0, - - /** Hostname was not found in the cache. Use resolv_query() to look it up. */ - RESOLV_STATUS_UNCACHED, - - /** Hostname was found, but it's status has expired. The address returned - * should not be used. Use resolv_query() to freshen it up. - */ - RESOLV_STATUS_EXPIRED, - - /** The server has returned a not-found response for this domain name. - * This response is cached for the period described in the server. - * You may issue a new query at any time using resolv_query(), but - * you will generally want to wait until this domain's status becomes - * RESOLV_STATUS_EXPIRED. - */ - RESOLV_STATUS_NOT_FOUND, - - /** This hostname is in the process of being resolved. Try again soon. */ - RESOLV_STATUS_RESOLVING, - - /** Some sort of server error was encountered while trying to look up this - * record. This response is cached and will eventually expire to - * RESOLV_STATUS_EXPIRED. - */ - RESOLV_STATUS_ERROR, -}; - -typedef uint8_t resolv_status_t; - -/* Functions. */ -resolv_status_t resolv_lookup(const char *name, uip_ipaddr_t ** ipaddr); - -void resolv_query(const char *name); - -#if RESOLV_CONF_SUPPORTS_MDNS -void resolv_set_hostname(const char *hostname); - -const char *resolv_get_hostname(void); -#endif - -PROCESS_NAME(resolv_process); - -#endif /* RESOLV_H_ */ diff --git a/os/net/ipv6/sicslowpan.c b/os/net/ipv6/sicslowpan.c deleted file mode 100644 index d61d44baf..000000000 --- a/os/net/ipv6/sicslowpan.c +++ /dev/null @@ -1,2075 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * 6lowpan implementation (RFC4944 and draft-ietf-6lowpan-hc-06) - * - * \author Adam Dunkels - * \author Nicolas Tsiftes - * \author Niclas Finne - * \author Mathilde Durvy - * \author Julien Abeille - * \author Joakim Eriksson - * \author Joel Hoglund - */ - -/** - * \addtogroup sicslowpan - * \ingroup uip - * @{ - */ - -/** - * FOR HC-06 COMPLIANCE TODO: - * -Add compression options to UDP, currently only supports - * both ports compressed or both ports elided - * - * -Verify TC/FL compression works - * - * -Add stateless multicast option - */ - -#include - -#include "contiki.h" -#include "dev/watchdog.h" -#include "net/link-stats.h" -#include "net/ipv6/uipopt.h" -#include "net/ipv6/tcpip.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uipbuf.h" -#include "net/ipv6/sicslowpan.h" -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "net/queuebuf.h" - -#include "net/routing/routing.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "6LoWPAN" -#define LOG_LEVEL LOG_LEVEL_6LOWPAN - -#define GET16(ptr,index) (((uint16_t)((ptr)[index] << 8)) | ((ptr)[(index) + 1])) -#define SET16(ptr,index,value) do { \ - (ptr)[index] = ((value) >> 8) & 0xff; \ - (ptr)[index + 1] = (value) & 0xff; \ -} while(0) - -/** \name Pointers in the packetbuf buffer - * @{ - */ -#define PACKETBUF_FRAG_PTR (packetbuf_ptr) -#define PACKETBUF_FRAG_DISPATCH_SIZE 0 /* 16 bit */ -#define PACKETBUF_FRAG_TAG 2 /* 16 bit */ -#define PACKETBUF_FRAG_OFFSET 4 /* 8 bit */ - -/* define the buffer as a byte array */ -#define PACKETBUF_IPHC_BUF ((uint8_t *)(packetbuf_ptr + packetbuf_hdr_len)) -#define PACKETBUF_PAYLOAD_END ((uint8_t *)(packetbuf_ptr + mac_max_payload)) - -#define PACKETBUF_6LO_PTR (packetbuf_ptr + packetbuf_hdr_len) -#define PACKETBUF_6LO_DISPATCH 0 /* 8 bit */ -#define PACKETBUF_6LO_ENCODING 1 /* 8 bit */ -#define PACKETBUF_6LO_TTL 2 /* 8 bit */ - -#define PACKETBUF_6LO_HC_UDP_PTR (packetbuf_ptr + packetbuf_hdr_len) -#define PACKETBUF_6LO_HC_UDP_DISPATCH 0 /* 8 bit */ -#define PACKETBUF_6LO_HC_UDP_HC1_ENCODING 1 /* 8 bit */ -#define PACKETBUF_6LO_HC_UDP_UDP_ENCODING 2 /* 8 bit */ -#define PACKETBUF_6LO_HC_UDP_TTL 3 /* 8 bit */ -#define PACKETBUF_6LO_HC_UDP_PORTS 4 /* 8 bit */ -#define PACKETBUF_6LO_HC_UDP_CHKSUM 5 /* 16 bit */ - -/** \name Pointers in the sicslowpan and uip buffer - * @{ - */ - -/* NOTE: In the multiple-reassembly context there is only room for the header / first fragment */ -#define SICSLOWPAN_IP_BUF(buf) ((struct uip_ip_hdr *)buf) -#define SICSLOWPAN_UDP_BUF(buf) ((struct uip_udp_hdr *)&buf[UIP_IPH_LEN]) -#define SICSLOWPAN_IPPAYLOAD_BUF(buf) (&buf[UIP_IPH_LEN]) - -#define UIP_IPPAYLOAD_BUF_POS(pos) (&uip_buf[UIP_IPH_LEN + (pos)]) -#define UIP_UDP_BUF_POS(pos) ((struct uip_udp_hdr *)UIP_IPPAYLOAD_BUF_POS(pos)) - -/** @} */ - -/* set this to zero if not compressing EXT_HDR - for backwards compatibility */ -#ifdef SICSLOWPAN_CONF_COMPRESS_EXT_HDR -#define COMPRESS_EXT_HDR SICSLOWPAN_CONF_COMPRESS_EXT_HDR -#else -/* Compressing on by default - turn off to be compatible with older versions */ -#define COMPRESS_EXT_HDR 1 -#endif - -#if COMPRESS_EXT_HDR -#define IS_COMPRESSABLE_PROTO(x) (x == UIP_PROTO_UDP \ - || x == UIP_PROTO_HBHO \ - || x == UIP_PROTO_DESTO \ - || x == UIP_PROTO_ROUTING \ - || x == UIP_PROTO_FRAG) -#else -#define IS_COMPRESSABLE_PROTO(x) (x == UIP_PROTO_UDP) -#endif /* COMPRESS_EXT_HDR */ - -/** \name General variables - * @{ - */ - -/** - * A pointer to the packetbuf buffer. - * We initialize it to the beginning of the packetbuf buffer, then - * access different fields by updating the offset packetbuf_hdr_len. - */ -static uint8_t *packetbuf_ptr; - -/** - * packetbuf_hdr_len is the total length of (the processed) 6lowpan headers - * (fragment headers, IPV6 or HC1, HC2, and HC1 and HC2 non compressed - * fields). - */ -static uint8_t packetbuf_hdr_len; - -/** - * The length of the payload in the Packetbuf buffer. - * The payload is what comes after the compressed or uncompressed - * headers (can be the IP payload if the IP header only is compressed - * or the UDP payload if the UDP header is also compressed) - */ -static int packetbuf_payload_len; - -/** - * uncomp_hdr_len is the length of the headers before compression (if HC2 - * is used this includes the UDP header in addition to the IP header). - */ -static uint8_t uncomp_hdr_len; - -/** - * mac_max_payload is the maimum payload space on the MAC frame. - */ -static int mac_max_payload; - -/** - * The current page (RFC 4944) - */ -static uint8_t curr_page; - -/** - * the result of the last transmitted fragment - */ -static int last_tx_status; -/** @} */ - - -static int last_rssi; - -/* ----------------------------------------------------------------- */ -/* Support for reassembling multiple packets */ -/* ----------------------------------------------------------------- */ - -#if SICSLOWPAN_CONF_FRAG -static uint16_t my_tag; - -/** The total length of the IPv6 packet in the sicslowpan_buf. */ - -/* This needs to be defined in NBR / Nodes depending on available RAM */ -/* and expected reassembly requirements */ -#ifdef SICSLOWPAN_CONF_FRAGMENT_BUFFERS -#define SICSLOWPAN_FRAGMENT_BUFFERS SICSLOWPAN_CONF_FRAGMENT_BUFFERS -#else -#define SICSLOWPAN_FRAGMENT_BUFFERS 12 -#endif - -/* REASS_CONTEXTS corresponds to the number of simultaneous - * reassemblies that can be made. NOTE: the first buffer for each - * reassembly is stored in the context since it can be larger than the - * rest of the fragments due to header compression. - **/ -#ifdef SICSLOWPAN_CONF_REASS_CONTEXTS -#define SICSLOWPAN_REASS_CONTEXTS SICSLOWPAN_CONF_REASS_CONTEXTS -#else -#define SICSLOWPAN_REASS_CONTEXTS 2 -#endif - -/* The size of each fragment (IP payload) for the 6lowpan fragmentation */ -#ifdef SICSLOWPAN_CONF_FRAGMENT_SIZE -#define SICSLOWPAN_FRAGMENT_SIZE SICSLOWPAN_CONF_FRAGMENT_SIZE -#else -/* The default fragment size (110 bytes for 127-2 bytes frames) */ -#define SICSLOWPAN_FRAGMENT_SIZE (127 - 2 - 15) -#endif - -/* Assuming that the worst growth for uncompression is 38 bytes */ -#define SICSLOWPAN_FIRST_FRAGMENT_SIZE (SICSLOWPAN_FRAGMENT_SIZE + 38) - -/* all information needed for reassembly */ -struct sicslowpan_frag_info { - /** When reassembling, the source address of the fragments being merged */ - linkaddr_t sender; - /** The destination address of the fragments being merged */ - linkaddr_t receiver; - /** When reassembling, the tag in the fragments being merged. */ - uint16_t tag; - /** Total length of the fragmented packet */ - uint16_t len; - /** Current length of reassembled fragments */ - uint16_t reassembled_len; - /** Reassembly %process %timer. */ - struct timer reass_timer; - - /** Fragment size of first fragment */ - uint16_t first_frag_len; - /** First fragment - needs a larger buffer since the size is uncompressed size - and we need to know total size to know when we have received last fragment. */ - uint8_t first_frag[SICSLOWPAN_FIRST_FRAGMENT_SIZE]; -}; - -static struct sicslowpan_frag_info frag_info[SICSLOWPAN_REASS_CONTEXTS]; - -struct sicslowpan_frag_buf { - /* the index of the frag_info */ - uint8_t index; - /* Fragment offset */ - uint8_t offset; - /* Length of this fragment (if zero this buffer is not allocated) */ - uint8_t len; - uint8_t data[SICSLOWPAN_FRAGMENT_SIZE]; -}; - -static struct sicslowpan_frag_buf frag_buf[SICSLOWPAN_FRAGMENT_BUFFERS]; - -/*---------------------------------------------------------------------------*/ -static int -clear_fragments(uint8_t frag_info_index) -{ - int i, clear_count; - clear_count = 0; - frag_info[frag_info_index].len = 0; - for(i = 0; i < SICSLOWPAN_FRAGMENT_BUFFERS; i++) { - if(frag_buf[i].len > 0 && frag_buf[i].index == frag_info_index) { - /* deallocate the buffer */ - frag_buf[i].len = 0; - clear_count++; - } - } - return clear_count; -} -/*---------------------------------------------------------------------------*/ -static int -timeout_fragments(int not_context) -{ - int i; - int count = 0; - for(i = 0; i < SICSLOWPAN_REASS_CONTEXTS; i++) { - if(frag_info[i].len > 0 && i != not_context && - timer_expired(&frag_info[i].reass_timer)) { - /* This context can be freed */ - count += clear_fragments(i); - } - } - return count; -} -/*---------------------------------------------------------------------------*/ -static int -store_fragment(uint8_t index, uint8_t offset) -{ - int i; - for(i = 0; i < SICSLOWPAN_FRAGMENT_BUFFERS; i++) { - if(frag_buf[i].len == 0) { - /* copy over the data from packetbuf into the fragment buffer and store offset and len */ - frag_buf[i].offset = offset; /* frag offset */ - frag_buf[i].len = packetbuf_datalen() - packetbuf_hdr_len; - frag_buf[i].index = index; - memcpy(frag_buf[i].data, packetbuf_ptr + packetbuf_hdr_len, - packetbuf_datalen() - packetbuf_hdr_len); - /* return the length of the stored fragment */ - return frag_buf[i].len; - } - } - /* failed */ - return -1; -} -/*---------------------------------------------------------------------------*/ -/* add a new fragment to the buffer */ -static int8_t -add_fragment(uint16_t tag, uint16_t frag_size, uint8_t offset) -{ - int i; - int len; - int8_t found = -1; - - if(offset == 0) { - /* This is a first fragment - check if we can add this */ - for(i = 0; i < SICSLOWPAN_REASS_CONTEXTS; i++) { - /* clear all fragment info with expired timer to free all fragment buffers */ - if(frag_info[i].len > 0 && timer_expired(&frag_info[i].reass_timer)) { - clear_fragments(i); - } - - /* We use len as indication on used or not used */ - if(found < 0 && frag_info[i].len == 0) { - /* We remember the first free fragment info but must continue - the loop to free any other expired fragment buffers. */ - found = i; - } - } - - if(found < 0) { - LOG_WARN("reassembly: failed to store new fragment session - tag: %d\n", tag); - return -1; - } - - /* Found a free fragment info to store data in */ - frag_info[found].len = frag_size; - frag_info[found].tag = tag; - linkaddr_copy(&frag_info[found].sender, - packetbuf_addr(PACKETBUF_ADDR_SENDER)); - timer_set(&frag_info[found].reass_timer, SICSLOWPAN_REASS_MAXAGE * CLOCK_SECOND / 16); - /* first fragment can not be stored immediately but is moved into - the buffer while uncompressing */ - return found; - } - - /* This is a N-fragment - should find the info */ - for(i = 0; i < SICSLOWPAN_REASS_CONTEXTS; i++) { - if(frag_info[i].tag == tag && frag_info[i].len > 0 && - linkaddr_cmp(&frag_info[i].sender, packetbuf_addr(PACKETBUF_ADDR_SENDER))) { - /* Tag and Sender match - this must be the correct info to store in */ - found = i; - break; - } - } - - if(found < 0) { - /* no entry found for storing the new fragment */ - LOG_WARN("reassembly: failed to store N-fragment - could not find session - tag: %d offset: %d\n", tag, offset); - return -1; - } - - /* i is the index of the reassembly context */ - len = store_fragment(i, offset); - if(len < 0 && timeout_fragments(i) > 0) { - len = store_fragment(i, offset); - } - if(len > 0) { - frag_info[i].reassembled_len += len; - return i; - } else { - /* should we also clear all fragments since we failed to store - this fragment? */ - LOG_WARN("reassembly: failed to store fragment - packet reassembly will fail tag:%d l\n", frag_info[i].tag); - return -1; - } -} -/*---------------------------------------------------------------------------*/ -/* Copy all the fragments that are associated with a specific context - into uip */ -static void -copy_frags2uip(int context) -{ - int i; - - /* Copy from the fragment context info buffer first */ - memcpy((uint8_t *)UIP_IP_BUF, (uint8_t *)frag_info[context].first_frag, - frag_info[context].first_frag_len); - for(i = 0; i < SICSLOWPAN_FRAGMENT_BUFFERS; i++) { - /* And also copy all matching fragments */ - if(frag_buf[i].len > 0 && frag_buf[i].index == context) { - memcpy((uint8_t *)UIP_IP_BUF + (uint16_t)(frag_buf[i].offset << 3), - (uint8_t *)frag_buf[i].data, frag_buf[i].len); - } - } - /* deallocate all the fragments for this context */ - clear_fragments(context); -} -#endif /* SICSLOWPAN_CONF_FRAG */ - -/* -------------------------------------------------------------------------- */ - -/*-------------------------------------------------------------------------*/ -/* Basic netstack sniffer */ -/*-------------------------------------------------------------------------*/ -static struct netstack_sniffer *callback = NULL; - -void -netstack_sniffer_add(struct netstack_sniffer *s) -{ - callback = s; -} - -void -netstack_sniffer_remove(struct netstack_sniffer *s) -{ - callback = NULL; -} - -static void -set_packet_attrs(void) -{ - int c = 0; - /* set protocol in NETWORK_ID */ - packetbuf_set_attr(PACKETBUF_ATTR_NETWORK_ID, UIP_IP_BUF->proto); - - /* assign values to the channel attribute (port or type + code) */ - if(UIP_IP_BUF->proto == UIP_PROTO_UDP) { - c = UIP_UDP_BUF_POS(0)->srcport; - if(UIP_UDP_BUF_POS(0)->destport < c) { - c = UIP_UDP_BUF_POS(0)->destport; - } - } else if(UIP_IP_BUF->proto == UIP_PROTO_TCP) { - c = UIP_TCP_BUF->srcport; - if(UIP_TCP_BUF->destport < c) { - c = UIP_TCP_BUF->destport; - } - } else if(UIP_IP_BUF->proto == UIP_PROTO_ICMP6) { - c = UIP_ICMP_BUF->type << 8 | UIP_ICMP_BUF->icode; - } - - packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, c); - -/* if(uip_ds6_is_my_addr(&UIP_IP_BUF->srcipaddr)) { */ -/* own = 1; */ -/* } */ - -} - - - -#if SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_IPHC -/** \name variables specific to HC06 and more recent versions - * @{ - */ - -/** Addresses contexts for IPHC. */ -#if SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0 -static struct sicslowpan_addr_context -addr_contexts[SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS]; -#endif - -/** pointer to an address context. */ -static struct sicslowpan_addr_context *context; - -/** pointer to the byte where to write next inline field. */ -static uint8_t *hc06_ptr; - -/* Uncompression of linklocal */ -/* 0 -> 16 bytes from packet */ -/* 1 -> 2 bytes from prefix - bunch of zeroes and 8 from packet */ -/* 2 -> 2 bytes from prefix - 0000::00ff:fe00:XXXX from packet */ -/* 3 -> 2 bytes from prefix - infer 8 bytes from lladdr */ -/* NOTE: => the uncompress function does change 0xf to 0x10 */ -/* NOTE: 0x00 => no-autoconfig => unspecified */ -const uint8_t unc_llconf[] = {0x0f,0x28,0x22,0x20}; - -/* Uncompression of ctx-based */ -/* 0 -> 0 bits from packet [unspecified / reserved] */ -/* 1 -> 8 bytes from prefix - bunch of zeroes and 8 from packet */ -/* 2 -> 8 bytes from prefix - 0000::00ff:fe00:XXXX + 2 from packet */ -/* 3 -> 8 bytes from prefix - infer 8 bytes from lladdr */ -const uint8_t unc_ctxconf[] = {0x00,0x88,0x82,0x80}; - -/* Uncompression of ctx-based */ -/* 0 -> 0 bits from packet */ -/* 1 -> 2 bytes from prefix - bunch of zeroes 5 from packet */ -/* 2 -> 2 bytes from prefix - zeroes + 3 from packet */ -/* 3 -> 2 bytes from prefix - infer 1 bytes from lladdr */ -const uint8_t unc_mxconf[] = {0x0f, 0x25, 0x23, 0x21}; - -/* Link local prefix */ -const uint8_t llprefix[] = {0xfe, 0x80}; - -/* TTL uncompression values */ -static const uint8_t ttl_values[] = {0, 1, 64, 255}; - -/*--------------------------------------------------------------------*/ -/** \name IPHC related functions - * @{ */ -/*--------------------------------------------------------------------*/ -/** \brief find the context corresponding to prefix ipaddr */ -static struct sicslowpan_addr_context* -addr_context_lookup_by_prefix(uip_ipaddr_t *ipaddr) -{ -/* Remove code to avoid warnings and save flash if no context is used */ -#if SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0 - int i; - for(i = 0; i < SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS; i++) { - if((addr_contexts[i].used == 1) && - uip_ipaddr_prefixcmp(&addr_contexts[i].prefix, ipaddr, 64)) { - return &addr_contexts[i]; - } - } -#endif /* SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0 */ - return NULL; -} -/*--------------------------------------------------------------------*/ -/** \brief find the context with the given number */ -static struct sicslowpan_addr_context* -addr_context_lookup_by_number(uint8_t number) -{ -/* Remove code to avoid warnings and save flash if no context is used */ -#if SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0 - int i; - for(i = 0; i < SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS; i++) { - if((addr_contexts[i].used == 1) && - addr_contexts[i].number == number) { - return &addr_contexts[i]; - } - } -#endif /* SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0 */ - return NULL; -} -/*--------------------------------------------------------------------*/ -static uint8_t -compress_addr_64(uint8_t bitpos, uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr) -{ - if(uip_is_addr_mac_addr_based(ipaddr, lladdr)) { - return 3 << bitpos; /* 0-bits */ - } else if(sicslowpan_is_iid_16_bit_compressable(ipaddr)) { - /* compress IID to 16 bits xxxx::0000:00ff:fe00:XXXX */ - memcpy(hc06_ptr, &ipaddr->u16[7], 2); - hc06_ptr += 2; - return 2 << bitpos; /* 16-bits */ - } else { - /* do not compress IID => xxxx::IID */ - memcpy(hc06_ptr, &ipaddr->u16[4], 8); - hc06_ptr += 8; - return 1 << bitpos; /* 64-bits */ - } -} - -/*-------------------------------------------------------------------- */ -/* Uncompress addresses based on a prefix and a postfix with zeroes in - * between. If the postfix is zero in length it will use the link address - * to configure the IP address (autoconf style). - * pref_post_count takes a byte where the first nibble specify prefix count - * and the second postfix count (NOTE: 15/0xf => 16 bytes copy). - */ -static void -uncompress_addr(uip_ipaddr_t *ipaddr, uint8_t const prefix[], - uint8_t pref_post_count, uip_lladdr_t *lladdr) -{ - uint8_t prefcount = pref_post_count >> 4; - uint8_t postcount = pref_post_count & 0x0f; - /* full nibble 15 => 16 */ - prefcount = prefcount == 15 ? 16 : prefcount; - postcount = postcount == 15 ? 16 : postcount; - - LOG_DBG("uncompression: address %d %d", prefcount, postcount); - - if(prefcount > 0) { - memcpy(ipaddr, prefix, prefcount); - } - if(prefcount + postcount < 16) { - memset(&ipaddr->u8[prefcount], 0, 16 - (prefcount + postcount)); - } - if(postcount > 0) { - memcpy(&ipaddr->u8[16 - postcount], hc06_ptr, postcount); - if(postcount == 2 && prefcount < 11) { - /* 16 bits uncompression => 0000:00ff:fe00:XXXX */ - ipaddr->u8[11] = 0xff; - ipaddr->u8[12] = 0xfe; - } - hc06_ptr += postcount; - } else if (prefcount > 0) { - /* no IID based configuration if no prefix and no data => unspec */ - uip_ds6_set_addr_iid(ipaddr, lladdr); - } - - LOG_DBG_6ADDR(ipaddr); - LOG_DBG_("\n"); -} - -/*--------------------------------------------------------------------*/ -/** - * \brief Compress IP/UDP header - * - * This function is called by the 6lowpan code to create a compressed - * 6lowpan packet in the packetbuf buffer from a full IPv6 packet in the - * uip_buf buffer. - * - * - * IPHC (RFC 6282)\n - * http://tools.ietf.org/html/ - * - * \note We do not support ISA100_UDP header compression - * - * For LOWPAN_UDP compression, we either compress both ports or none. - * General format with LOWPAN_UDP compression is - * \verbatim - * 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * |0|1|1|TF |N|HLI|C|S|SAM|M|D|DAM| SCI | DCI | comp. IPv6 hdr| - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | compressed IPv6 fields ..... | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | LOWPAN_UDP | non compressed UDP fields ... | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | L4 data ... | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * \endverbatim - * \note The context number 00 is reserved for the link local prefix. - * For unicast addresses, if we cannot compress the prefix, we neither - * compress the IID. - * \param link_destaddr L2 destination address, needed to compress IP - * dest - * \return 1 if success, else 0 - */ -static int -compress_hdr_iphc(linkaddr_t *link_destaddr) -{ - uint8_t tmp, iphc0, iphc1, *next_hdr, *next_nhc; - int ext_hdr_len; - struct uip_udp_hdr *udp_buf; - - if(LOG_DBG_ENABLED) { - uint16_t ndx; - LOG_DBG("compression: before (%d): ", UIP_IP_BUF->len[1]); - for(ndx = 0; ndx < UIP_IP_BUF->len[1] + 40; ndx++) { - uint8_t data = ((uint8_t *) (UIP_IP_BUF))[ndx]; - LOG_DBG_("%02x", data); - } - LOG_DBG_("\n"); - } - -/* Macro used only internally, during header compression. Checks if there - * is sufficient space in packetbuf before writing any further. */ -#define CHECK_BUFFER_SPACE(writelen) do { \ - if(hc06_ptr + (writelen) >= PACKETBUF_PAYLOAD_END) { \ - LOG_WARN("Not enough packetbuf space to compress header (%u bytes, %u left). Aborting.\n", \ - (unsigned)(writelen), (unsigned)(PACKETBUF_PAYLOAD_END - hc06_ptr)); \ - return 0; \ - } \ -} while(0); - - hc06_ptr = PACKETBUF_IPHC_BUF + 2; - - /* Check if there is enough space for the compressed IPv6 header, in the - * worst case (least compressed case). Extension headers and transport - * layer will be checked when they are compressed. */ - CHECK_BUFFER_SPACE(38); - - /* - * As we copy some bit-length fields, in the IPHC encoding bytes, - * we sometimes use |= - * If the field is 0, and the current bit value in memory is 1, - * this does not work. We therefore reset the IPHC encoding here - */ - - iphc0 = SICSLOWPAN_DISPATCH_IPHC; - iphc1 = 0; - PACKETBUF_IPHC_BUF[2] = 0; /* might not be used - but needs to be cleared */ - - /* - * Address handling needs to be made first since it might - * cause an extra byte with [ SCI | DCI ] - * - */ - - - /* check if dest context exists (for allocating third byte) */ - /* TODO: fix this so that it remembers the looked up values for - avoiding two lookups - or set the lookup values immediately */ - if(addr_context_lookup_by_prefix(&UIP_IP_BUF->destipaddr) != NULL || - addr_context_lookup_by_prefix(&UIP_IP_BUF->srcipaddr) != NULL) { - /* set context flag and increase hc06_ptr */ - LOG_DBG("compression: dest or src ipaddr - setting CID\n"); - iphc1 |= SICSLOWPAN_IPHC_CID; - hc06_ptr++; - } - - /* - * Traffic class, flow label - * If flow label is 0, compress it. If traffic class is 0, compress it - * We have to process both in the same time as the offset of traffic class - * depends on the presence of version and flow label - */ - - /* IPHC format of tc is ECN | DSCP , original is DSCP | ECN */ - - tmp = (UIP_IP_BUF->vtc << 4) | (UIP_IP_BUF->tcflow >> 4); - tmp = ((tmp & 0x03) << 6) | (tmp >> 2); - - if(((UIP_IP_BUF->tcflow & 0x0F) == 0) && - (UIP_IP_BUF->flow == 0)) { - /* flow label can be compressed */ - iphc0 |= SICSLOWPAN_IPHC_FL_C; - if(((UIP_IP_BUF->vtc & 0x0F) == 0) && - ((UIP_IP_BUF->tcflow & 0xF0) == 0)) { - /* compress (elide) all */ - iphc0 |= SICSLOWPAN_IPHC_TC_C; - } else { - /* compress only the flow label */ - *hc06_ptr = tmp; - hc06_ptr += 1; - } - } else { - /* Flow label cannot be compressed */ - if(((UIP_IP_BUF->vtc & 0x0F) == 0) && - ((UIP_IP_BUF->tcflow & 0xF0) == 0)) { - /* compress only traffic class */ - iphc0 |= SICSLOWPAN_IPHC_TC_C; - *hc06_ptr = (tmp & 0xc0) | - (UIP_IP_BUF->tcflow & 0x0F); - memcpy(hc06_ptr + 1, &UIP_IP_BUF->flow, 2); - hc06_ptr += 3; - } else { - /* compress nothing */ - memcpy(hc06_ptr, &UIP_IP_BUF->vtc, 4); - /* but replace the top byte with the new ECN | DSCP format*/ - *hc06_ptr = tmp; - hc06_ptr += 4; - } - } - - /* Note that the payload length is always compressed */ - - /* Next header. We compress it is compressable. */ - if(IS_COMPRESSABLE_PROTO(UIP_IP_BUF->proto)) { - iphc0 |= SICSLOWPAN_IPHC_NH_C; - } - - /* Add proto header unless it is compressed */ - if((iphc0 & SICSLOWPAN_IPHC_NH_C) == 0) { - *hc06_ptr = UIP_IP_BUF->proto; - hc06_ptr += 1; - } - - /* - * Hop limit - * if 1: compress, encoding is 01 - * if 64: compress, encoding is 10 - * if 255: compress, encoding is 11 - * else do not compress - */ - switch(UIP_IP_BUF->ttl) { - case 1: - iphc0 |= SICSLOWPAN_IPHC_TTL_1; - break; - case 64: - iphc0 |= SICSLOWPAN_IPHC_TTL_64; - break; - case 255: - iphc0 |= SICSLOWPAN_IPHC_TTL_255; - break; - default: - *hc06_ptr = UIP_IP_BUF->ttl; - hc06_ptr += 1; - break; - } - - /* source address - cannot be multicast */ - if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) { - LOG_DBG("compression: addr unspecified - setting SAC\n"); - iphc1 |= SICSLOWPAN_IPHC_SAC; - iphc1 |= SICSLOWPAN_IPHC_SAM_00; - } else if((context = addr_context_lookup_by_prefix(&UIP_IP_BUF->srcipaddr)) - != NULL) { - /* elide the prefix - indicate by CID and set context + SAC */ - LOG_DBG("compression: src with context - setting CID & SAC ctx: %d\n", - context->number); - iphc1 |= SICSLOWPAN_IPHC_CID | SICSLOWPAN_IPHC_SAC; - PACKETBUF_IPHC_BUF[2] |= context->number << 4; - /* compession compare with this nodes address (source) */ - - iphc1 |= compress_addr_64(SICSLOWPAN_IPHC_SAM_BIT, - &UIP_IP_BUF->srcipaddr, &uip_lladdr); - /* No context found for this address */ - } else if(uip_is_addr_linklocal(&UIP_IP_BUF->srcipaddr) && - UIP_IP_BUF->destipaddr.u16[1] == 0 && - UIP_IP_BUF->destipaddr.u16[2] == 0 && - UIP_IP_BUF->destipaddr.u16[3] == 0) { - iphc1 |= compress_addr_64(SICSLOWPAN_IPHC_SAM_BIT, - &UIP_IP_BUF->srcipaddr, &uip_lladdr); - } else { - /* send the full address => SAC = 0, SAM = 00 */ - iphc1 |= SICSLOWPAN_IPHC_SAM_00; /* 128-bits */ - memcpy(hc06_ptr, &UIP_IP_BUF->srcipaddr.u16[0], 16); - hc06_ptr += 16; - } - - /* dest address*/ - if(uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) { - /* Address is multicast, try to compress */ - iphc1 |= SICSLOWPAN_IPHC_M; - if(sicslowpan_is_mcast_addr_compressable8(&UIP_IP_BUF->destipaddr)) { - iphc1 |= SICSLOWPAN_IPHC_DAM_11; - /* use last byte */ - *hc06_ptr = UIP_IP_BUF->destipaddr.u8[15]; - hc06_ptr += 1; - } else if(sicslowpan_is_mcast_addr_compressable32(&UIP_IP_BUF->destipaddr)) { - iphc1 |= SICSLOWPAN_IPHC_DAM_10; - /* second byte + the last three */ - *hc06_ptr = UIP_IP_BUF->destipaddr.u8[1]; - memcpy(hc06_ptr + 1, &UIP_IP_BUF->destipaddr.u8[13], 3); - hc06_ptr += 4; - } else if(sicslowpan_is_mcast_addr_compressable48(&UIP_IP_BUF->destipaddr)) { - iphc1 |= SICSLOWPAN_IPHC_DAM_01; - /* second byte + the last five */ - *hc06_ptr = UIP_IP_BUF->destipaddr.u8[1]; - memcpy(hc06_ptr + 1, &UIP_IP_BUF->destipaddr.u8[11], 5); - hc06_ptr += 6; - } else { - iphc1 |= SICSLOWPAN_IPHC_DAM_00; - /* full address */ - memcpy(hc06_ptr, &UIP_IP_BUF->destipaddr.u8[0], 16); - hc06_ptr += 16; - } - } else { - /* Address is unicast, try to compress */ - if((context = addr_context_lookup_by_prefix(&UIP_IP_BUF->destipaddr)) != NULL) { - /* elide the prefix */ - iphc1 |= SICSLOWPAN_IPHC_DAC; - PACKETBUF_IPHC_BUF[2] |= context->number; - /* compession compare with link adress (destination) */ - - iphc1 |= compress_addr_64(SICSLOWPAN_IPHC_DAM_BIT, - &UIP_IP_BUF->destipaddr, - (uip_lladdr_t *)link_destaddr); - /* No context found for this address */ - } else if(uip_is_addr_linklocal(&UIP_IP_BUF->destipaddr) && - UIP_IP_BUF->destipaddr.u16[1] == 0 && - UIP_IP_BUF->destipaddr.u16[2] == 0 && - UIP_IP_BUF->destipaddr.u16[3] == 0) { - iphc1 |= compress_addr_64(SICSLOWPAN_IPHC_DAM_BIT, - &UIP_IP_BUF->destipaddr, (uip_lladdr_t *)link_destaddr); - } else { - /* send the full address */ - iphc1 |= SICSLOWPAN_IPHC_DAM_00; /* 128-bits */ - memcpy(hc06_ptr, &UIP_IP_BUF->destipaddr.u16[0], 16); - hc06_ptr += 16; - } - } - - uncomp_hdr_len = UIP_IPH_LEN; - - /* Start of ext hdr compression or UDP compression */ - /* pick out the next-header position */ - next_hdr = &UIP_IP_BUF->proto; - next_nhc = hc06_ptr; /* here we set the next header is compressed. */ - ext_hdr_len = 0; - /* reserve the write place of this next header position */ - LOG_DBG("compression: first header: %d\n", *next_hdr); - while(next_hdr != NULL && IS_COMPRESSABLE_PROTO(*next_hdr)) { - LOG_DBG("compression: next header: %d\n", *next_hdr); - int proto = -1; /* used for the specific ext hdr */ - /* UDP and EXT header compression */ - switch(*next_hdr) { - case UIP_PROTO_HBHO: - proto = SICSLOWPAN_NHC_ETX_HDR_HBHO; - case UIP_PROTO_ROUTING: - proto = proto == -1 ? SICSLOWPAN_NHC_ETX_HDR_ROUTING : proto; - case UIP_PROTO_FRAG: - proto = proto == -1 ? SICSLOWPAN_NHC_ETX_HDR_FRAG : proto; - case UIP_PROTO_DESTO: - /* Handle the header here! */ - { - struct uip_ext_hdr *ext_hdr = - (struct uip_ext_hdr *) UIP_IPPAYLOAD_BUF_POS(ext_hdr_len); - int len; - proto = proto == -1 ? SICSLOWPAN_NHC_ETX_HDR_DESTO : proto; - /* Len is defined to be in octets from the length byte */ - len = (ext_hdr->len << 3) + 8; - LOG_DBG("compression: next header %d (len:%d)\n", *next_hdr, len); - /* pick up the next header */ - next_hdr = &ext_hdr->next; - /* If the next header is not compressable we need to reserve the - NHC byte extra - before the next header here. This is due to - next not being elided in that case. */ - if(!IS_COMPRESSABLE_PROTO(*next_hdr)) { - CHECK_BUFFER_SPACE(1); - hc06_ptr++; - LOG_DBG("compression: keeping the next header in this ext hdr: %d\n", - ext_hdr->next); - } - /* copy the ext-hdr into the hc06 buffer */ - CHECK_BUFFER_SPACE(len); - memcpy(hc06_ptr, ext_hdr, len); - /* modify the len to octets */ - ext_hdr = (struct uip_ext_hdr *) hc06_ptr; - ext_hdr->len = len - 2; /* Len should be in bytes from len byte*/ - ext_hdr_len += len; - hc06_ptr += len; - uncomp_hdr_len += len; - - /* Write this next header - with its NHC header - including flag - to tell if next header is elided in this one also- */ - *next_nhc = SICSLOWPAN_NHC_EXT_HDR | - (IS_COMPRESSABLE_PROTO(*next_hdr) ? SICSLOWPAN_NHC_BIT : 0) | - (proto << 1); - /* update the position of the next header */ - next_nhc = hc06_ptr; - } - break; - case UIP_PROTO_UDP: - /* allocate a byte for the next header posision as UDP has no next */ - hc06_ptr++; - udp_buf = UIP_UDP_BUF_POS(ext_hdr_len); - LOG_DBG("compression: inlined UDP ports on send side: %x, %x\n", - UIP_HTONS(udp_buf->srcport), UIP_HTONS(udp_buf->destport)); - /* Mask out the last 4 bits can be used as a mask */ - if(((UIP_HTONS(udp_buf->srcport) & 0xfff0) == SICSLOWPAN_UDP_4_BIT_PORT_MIN) && - ((UIP_HTONS(udp_buf->destport) & 0xfff0) == SICSLOWPAN_UDP_4_BIT_PORT_MIN)) { - /* we can compress 12 bits of both source and dest */ - *next_nhc = SICSLOWPAN_NHC_UDP_CS_P_11; - LOG_DBG("IPHC: remove 12 b of both source & dest with prefix 0xFOB\n"); - CHECK_BUFFER_SPACE(1); - *hc06_ptr = - (uint8_t)((UIP_HTONS(udp_buf->srcport) - - SICSLOWPAN_UDP_4_BIT_PORT_MIN) << 4) + - (uint8_t)((UIP_HTONS(udp_buf->destport) - - SICSLOWPAN_UDP_4_BIT_PORT_MIN)); - hc06_ptr += 1; - } else if((UIP_HTONS(udp_buf->destport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) { - /* we can compress 8 bits of dest, leave source. */ - *next_nhc = SICSLOWPAN_NHC_UDP_CS_P_01; - LOG_DBG("IPHC: leave source, remove 8 bits of dest with prefix 0xF0\n"); - CHECK_BUFFER_SPACE(3); - memcpy(hc06_ptr, &udp_buf->srcport, 2); - *(hc06_ptr + 2) = - (uint8_t)((UIP_HTONS(udp_buf->destport) - - SICSLOWPAN_UDP_8_BIT_PORT_MIN)); - hc06_ptr += 3; - } else if((UIP_HTONS(udp_buf->srcport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) { - /* we can compress 8 bits of src, leave dest. Copy compressed port */ - *next_nhc = SICSLOWPAN_NHC_UDP_CS_P_10; - LOG_DBG("IPHC: remove 8 bits of source with prefix 0xF0, leave dest. hch: %i\n", *next_nhc); - CHECK_BUFFER_SPACE(3); - *hc06_ptr = - (uint8_t)((UIP_HTONS(udp_buf->srcport) - - SICSLOWPAN_UDP_8_BIT_PORT_MIN)); - memcpy(hc06_ptr + 1, &udp_buf->destport, 2); - hc06_ptr += 3; - } else { - /* we cannot compress. Copy uncompressed ports, full checksum */ - *next_nhc = SICSLOWPAN_NHC_UDP_CS_P_00; - LOG_DBG("IPHC: cannot compress UDP headers\n"); - CHECK_BUFFER_SPACE(4); - memcpy(hc06_ptr, &udp_buf->srcport, 4); - hc06_ptr += 4; - } - /* always inline the checksum */ - CHECK_BUFFER_SPACE(2); - memcpy(hc06_ptr, &udp_buf->udpchksum, 2); - hc06_ptr += 2; - uncomp_hdr_len += UIP_UDPH_LEN; - /* this is the final header. */ - next_hdr = NULL; - break; - default: - LOG_ERR("compression: could not handle compression of header"); - } - } - if(next_hdr != NULL) { - /* Last header could not be compressed - we assume that this is then OK!*/ - /* as the last EXT_HDR should be "uncompressed" and have the next there */ - LOG_DBG("compression: last header could is not compressed: %d\n", *next_hdr); - } - /* before the packetbuf_hdr_len operation */ - PACKETBUF_IPHC_BUF[0] = iphc0; - PACKETBUF_IPHC_BUF[1] = iphc1; - - if(LOG_DBG_ENABLED) { - uint16_t ndx; - LOG_DBG("compression: after (%d): ", (int)(hc06_ptr - packetbuf_ptr)); - for(ndx = 0; ndx < hc06_ptr - packetbuf_ptr; ndx++) { - uint8_t data = ((uint8_t *) packetbuf_ptr)[ndx]; - LOG_DBG_("%02x", data); - } - LOG_DBG_("\n"); - } - - packetbuf_hdr_len = hc06_ptr - packetbuf_ptr; - - return 1; -} - -/*--------------------------------------------------------------------*/ -/** - * \brief Uncompress IPHC (i.e., IPHC and LOWPAN_UDP) headers and put - * them in sicslowpan_buf - * - * This function is called by the input function when the dispatch is - * IPHC. - * We %process the packet in the packetbuf buffer, uncompress the header - * fields, and copy the result in the sicslowpan buffer. - * At the end of the decompression, packetbuf_hdr_len and uncompressed_hdr_len - * are set to the appropriate values - * - * \param buf Pointer to the buffer to uncompress the packet into. - * \param ip_len Equal to 0 if the packet is not a fragment (IP length - * is then inferred from the L2 length), non 0 if the packet is a 1st - * fragment. - */ -static void -uncompress_hdr_iphc(uint8_t *buf, uint16_t ip_len) -{ - uint8_t tmp, iphc0, iphc1, nhc; - struct uip_ext_hdr *exthdr; - uint8_t* last_nextheader; - uint8_t* ip_payload; - uint8_t ext_hdr_len = 0; - - /* at least two byte will be used for the encoding */ - hc06_ptr = packetbuf_ptr + packetbuf_hdr_len + 2; - - iphc0 = PACKETBUF_IPHC_BUF[0]; - iphc1 = PACKETBUF_IPHC_BUF[1]; - - /* another if the CID flag is set */ - if(iphc1 & SICSLOWPAN_IPHC_CID) { - LOG_DBG("uncompression: CID flag set - increase header with one\n"); - hc06_ptr++; - } - - /* Traffic class and flow label */ - if((iphc0 & SICSLOWPAN_IPHC_FL_C) == 0) { - /* Flow label are carried inline */ - if((iphc0 & SICSLOWPAN_IPHC_TC_C) == 0) { - /* Traffic class is carried inline */ - memcpy(&SICSLOWPAN_IP_BUF(buf)->tcflow, hc06_ptr + 1, 3); - tmp = *hc06_ptr; - hc06_ptr += 4; - /* IPHC format of tc is ECN | DSCP , original is DSCP | ECN */ - /* set version, pick highest DSCP bits and set in vtc */ - SICSLOWPAN_IP_BUF(buf)->vtc = 0x60 | ((tmp >> 2) & 0x0f); - /* ECN rolled down two steps + lowest DSCP bits at top two bits */ - SICSLOWPAN_IP_BUF(buf)->tcflow = ((tmp >> 2) & 0x30) | (tmp << 6) | - (SICSLOWPAN_IP_BUF(buf)->tcflow & 0x0f); - } else { - /* Traffic class is compressed (set version and no TC)*/ - SICSLOWPAN_IP_BUF(buf)->vtc = 0x60; - /* highest flow label bits + ECN bits */ - SICSLOWPAN_IP_BUF(buf)->tcflow = (*hc06_ptr & 0x0F) | - ((*hc06_ptr >> 2) & 0x30); - memcpy(&SICSLOWPAN_IP_BUF(buf)->flow, hc06_ptr + 1, 2); - hc06_ptr += 3; - } - } else { - /* Version is always 6! */ - /* Version and flow label are compressed */ - if((iphc0 & SICSLOWPAN_IPHC_TC_C) == 0) { - /* Traffic class is inline */ - SICSLOWPAN_IP_BUF(buf)->vtc = 0x60 | ((*hc06_ptr >> 2) & 0x0f); - SICSLOWPAN_IP_BUF(buf)->tcflow = ((*hc06_ptr << 6) & 0xC0) | ((*hc06_ptr >> 2) & 0x30); - SICSLOWPAN_IP_BUF(buf)->flow = 0; - hc06_ptr += 1; - } else { - /* Traffic class is compressed */ - SICSLOWPAN_IP_BUF(buf)->vtc = 0x60; - SICSLOWPAN_IP_BUF(buf)->tcflow = 0; - SICSLOWPAN_IP_BUF(buf)->flow = 0; - } - } - - /* Next Header */ - if((iphc0 & SICSLOWPAN_IPHC_NH_C) == 0) { - /* Next header is carried inline */ - SICSLOWPAN_IP_BUF(buf)->proto = *hc06_ptr; - LOG_DBG("uncompression: next header inline: %d\n", SICSLOWPAN_IP_BUF(buf)->proto); - hc06_ptr += 1; - } - - /* Hop limit */ - if((iphc0 & 0x03) != SICSLOWPAN_IPHC_TTL_I) { - SICSLOWPAN_IP_BUF(buf)->ttl = ttl_values[iphc0 & 0x03]; - } else { - SICSLOWPAN_IP_BUF(buf)->ttl = *hc06_ptr; - hc06_ptr += 1; - } - - /* put the source address compression mode SAM in the tmp var */ - tmp = ((iphc1 & SICSLOWPAN_IPHC_SAM_11) >> SICSLOWPAN_IPHC_SAM_BIT) & 0x03; - - /* context based compression */ - if(iphc1 & SICSLOWPAN_IPHC_SAC) { - uint8_t sci = (iphc1 & SICSLOWPAN_IPHC_CID) ? - PACKETBUF_IPHC_BUF[2] >> 4 : 0; - - /* Source address - check context != NULL only if SAM bits are != 0*/ - if (tmp != 0) { - context = addr_context_lookup_by_number(sci); - if(context == NULL) { - LOG_ERR("uncompression: error context not found\n"); - return; - } - } - /* if tmp == 0 we do not have a context and therefore no prefix */ - uncompress_addr(&SICSLOWPAN_IP_BUF(buf)->srcipaddr, - tmp != 0 ? context->prefix : NULL, unc_ctxconf[tmp], - (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); - } else { - /* no compression and link local */ - uncompress_addr(&SICSLOWPAN_IP_BUF(buf)->srcipaddr, llprefix, unc_llconf[tmp], - (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); - } - - /* Destination address */ - /* put the destination address compression mode into tmp */ - tmp = ((iphc1 & SICSLOWPAN_IPHC_DAM_11) >> SICSLOWPAN_IPHC_DAM_BIT) & 0x03; - - /* multicast compression */ - if(iphc1 & SICSLOWPAN_IPHC_M) { - /* context based multicast compression */ - if(iphc1 & SICSLOWPAN_IPHC_DAC) { - /* TODO: implement this */ - } else { - /* non-context based multicast compression - */ - /* DAM_00: 128 bits */ - /* DAM_01: 48 bits FFXX::00XX:XXXX:XXXX */ - /* DAM_10: 32 bits FFXX::00XX:XXXX */ - /* DAM_11: 8 bits FF02::00XX */ - uint8_t prefix[] = {0xff, 0x02}; - if(tmp > 0 && tmp < 3) { - prefix[1] = *hc06_ptr; - hc06_ptr++; - } - - uncompress_addr(&SICSLOWPAN_IP_BUF(buf)->destipaddr, prefix, - unc_mxconf[tmp], NULL); - } - } else { - /* no multicast */ - /* Context based */ - if(iphc1 & SICSLOWPAN_IPHC_DAC) { - uint8_t dci = (iphc1 & SICSLOWPAN_IPHC_CID) ? PACKETBUF_IPHC_BUF[2] & 0x0f : 0; - context = addr_context_lookup_by_number(dci); - - /* all valid cases below need the context! */ - if(context == NULL) { - LOG_ERR("uncompression: error context not found\n"); - return; - } - uncompress_addr(&SICSLOWPAN_IP_BUF(buf)->destipaddr, context->prefix, - unc_ctxconf[tmp], - (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - } else { - /* not context based => link local M = 0, DAC = 0 - same as SAC */ - uncompress_addr(&SICSLOWPAN_IP_BUF(buf)->destipaddr, llprefix, - unc_llconf[tmp], - (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - } - } - uncomp_hdr_len += UIP_IPH_LEN; - - /* Next header processing - continued */ - nhc = iphc0 & SICSLOWPAN_IPHC_NH_C; - /* The next header is compressed, NHC is following */ - last_nextheader = &SICSLOWPAN_IP_BUF(buf)->proto; - ip_payload = SICSLOWPAN_IPPAYLOAD_BUF(buf); - - while(nhc && (*hc06_ptr & SICSLOWPAN_NHC_MASK) == SICSLOWPAN_NHC_EXT_HDR) { - uint8_t eid = (*hc06_ptr & 0x0e) >> 1; - /* next header compression flag */ - uint8_t nh = (*hc06_ptr & 0x01); - uint8_t next = 0; - uint8_t len; - uint8_t proto; - - nhc = nh; - - hc06_ptr++; - if(!nh) { - next = *hc06_ptr; - hc06_ptr++; - LOG_DBG("uncompression: next header is inlined. Next: %d\n", next); - } - len = *hc06_ptr; - hc06_ptr++; - - LOG_DBG("uncompression: found ext header id: %d next: %d len: %d\n", eid, next, len); - switch(eid) { - case SICSLOWPAN_NHC_ETX_HDR_HBHO: - proto = UIP_PROTO_HBHO; - break; - case SICSLOWPAN_NHC_ETX_HDR_ROUTING: - proto = UIP_PROTO_ROUTING; - break; - case SICSLOWPAN_NHC_ETX_HDR_FRAG: - proto = UIP_PROTO_FRAG; - break; - case SICSLOWPAN_NHC_ETX_HDR_DESTO: - proto = UIP_PROTO_DESTO; - break; - default: - LOG_DBG("uncompression: error unsupported ext header\n"); - return; - } - *last_nextheader = proto; - /* uncompress the extension header */ - exthdr = (struct uip_ext_hdr *)ip_payload; - exthdr->len = (2 + len) / 8 - 1; - exthdr->next = next; - last_nextheader = &exthdr->next; - memcpy((uint8_t*)exthdr + 2, hc06_ptr, len); - hc06_ptr += len; - uncomp_hdr_len += (exthdr->len + 1) * 8; - ip_payload += (exthdr->len + 1) * 8; - ext_hdr_len += (exthdr->len + 1) * 8; - - LOG_DBG("uncompression: %d len: %d exhdrlen: %d (calc: %d)\n", - proto, len, exthdr->len, (exthdr->len + 1) * 8); - } - - /* The next header is compressed, NHC is following */ - if(nhc && (*hc06_ptr & SICSLOWPAN_NHC_UDP_MASK) == SICSLOWPAN_NHC_UDP_ID) { - struct uip_udp_hdr *udp_buf = (struct uip_udp_hdr *)ip_payload; - uint16_t udp_len; - uint8_t checksum_compressed; - *last_nextheader = UIP_PROTO_UDP; - checksum_compressed = *hc06_ptr & SICSLOWPAN_NHC_UDP_CHECKSUMC; - LOG_DBG("uncompression: incoming header value: %i\n", *hc06_ptr); - switch(*hc06_ptr & SICSLOWPAN_NHC_UDP_CS_P_11) { - case SICSLOWPAN_NHC_UDP_CS_P_00: - /* 1 byte for NHC, 4 byte for ports, 2 bytes chksum */ - memcpy(&udp_buf->srcport, hc06_ptr + 1, 2); - memcpy(&udp_buf->destport, hc06_ptr + 3, 2); - LOG_DBG("uncompression: UDP ports (ptr+5): %x, %x\n", - UIP_HTONS(udp_buf->srcport), - UIP_HTONS(udp_buf->destport)); - hc06_ptr += 5; - break; - - case SICSLOWPAN_NHC_UDP_CS_P_01: - /* 1 byte for NHC + source 16bit inline, dest = 0xF0 + 8 bit inline */ - LOG_DBG("uncompression: destination address\n"); - memcpy(&udp_buf->srcport, hc06_ptr + 1, 2); - udp_buf->destport = UIP_HTONS(SICSLOWPAN_UDP_8_BIT_PORT_MIN + (*(hc06_ptr + 3))); - LOG_DBG("uncompression: UDP ports (ptr+4): %x, %x\n", - UIP_HTONS(udp_buf->srcport), UIP_HTONS(udp_buf->destport)); - hc06_ptr += 4; - break; - - case SICSLOWPAN_NHC_UDP_CS_P_10: - /* 1 byte for NHC + source = 0xF0 + 8bit inline, dest = 16 bit inline*/ - LOG_DBG("uncompression: source address\n"); - udp_buf->srcport = UIP_HTONS(SICSLOWPAN_UDP_8_BIT_PORT_MIN + - (*(hc06_ptr + 1))); - memcpy(&udp_buf->destport, hc06_ptr + 2, 2); - LOG_DBG("uncompression: UDP ports (ptr+4): %x, %x\n", - UIP_HTONS(udp_buf->srcport), UIP_HTONS(udp_buf->destport)); - hc06_ptr += 4; - break; - - case SICSLOWPAN_NHC_UDP_CS_P_11: - /* 1 byte for NHC, 1 byte for ports */ - udp_buf->srcport = UIP_HTONS(SICSLOWPAN_UDP_4_BIT_PORT_MIN + - (*(hc06_ptr + 1) >> 4)); - udp_buf->destport = UIP_HTONS(SICSLOWPAN_UDP_4_BIT_PORT_MIN + - ((*(hc06_ptr + 1)) & 0x0F)); - LOG_DBG("uncompression: UDP ports (ptr+2): %x, %x\n", - UIP_HTONS(udp_buf->srcport), UIP_HTONS(udp_buf->destport)); - hc06_ptr += 2; - break; - default: - LOG_DBG("uncompression: error unsupported UDP compression\n"); - return; - } - if(!checksum_compressed) { /* has_checksum, default */ - memcpy(&udp_buf->udpchksum, hc06_ptr, 2); - hc06_ptr += 2; - LOG_DBG("uncompression: checksum included\n"); - } else { - LOG_DBG("uncompression: checksum *NOT* included\n"); - } - - /* length field in UDP header (8 byte header + payload) */ - udp_len = 8 + packetbuf_datalen() - (hc06_ptr - packetbuf_ptr); - udp_buf->udplen = UIP_HTONS(ip_len == 0 ? udp_len : - ip_len - UIP_IPH_LEN - ext_hdr_len); - LOG_DBG("uncompression: UDP length: %u (ext: %u) ip_len: %d udp_len: %d\n", - UIP_HTONS(udp_buf->udplen), ext_hdr_len, ip_len, udp_len); - - uncomp_hdr_len += UIP_UDPH_LEN; - } - - packetbuf_hdr_len = hc06_ptr - packetbuf_ptr; - - /* IP length field. */ - if(ip_len == 0) { - int len = packetbuf_datalen() - packetbuf_hdr_len + uncomp_hdr_len - UIP_IPH_LEN; - LOG_DBG("uncompression: IP payload length: %d. %u - %u + %u - %u\n", len, - packetbuf_datalen(), packetbuf_hdr_len, uncomp_hdr_len, UIP_IPH_LEN); - - /* This is not a fragmented packet */ - SICSLOWPAN_IP_BUF(buf)->len[0] = len >> 8; - SICSLOWPAN_IP_BUF(buf)->len[1] = len & 0x00FF; - } else { - /* This is a 1st fragment */ - SICSLOWPAN_IP_BUF(buf)->len[0] = (ip_len - UIP_IPH_LEN) >> 8; - SICSLOWPAN_IP_BUF(buf)->len[1] = (ip_len - UIP_IPH_LEN) & 0x00FF; - } -} -/** @} */ -#endif /* SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_IPHC */ - -#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_6LORH -/*--------------------------------------------------------------------*/ -/** - * \brief Adds Paging dispatch byte - */ -static void -add_paging_dispatch(uint8_t page) -{ - /* Add paging dispatch to Page 1 */ - PACKETBUF_6LO_PTR[PACKETBUF_6LO_DISPATCH] = SICSLOWPAN_DISPATCH_PAGING | (page & 0x0f); - packetbuf_hdr_len++; -} -/*--------------------------------------------------------------------*/ -/** - * \brief Adds 6lorh headers before IPHC - */ -static void -add_6lorh_hdr(void) -{ - /* 6LoRH is not implemented yet */ -} -#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_6LORH */ - -/*--------------------------------------------------------------------*/ -/** - * \brief Digest 6lorh headers before IPHC - */ -static void -digest_paging_dispatch(void) -{ - /* Is this a paging dispatch? */ - if((PACKETBUF_6LO_PTR[PACKETBUF_6LO_DISPATCH] & SICSLOWPAN_DISPATCH_PAGING_MASK) == SICSLOWPAN_DISPATCH_PAGING) { - /* Parse page number */ - curr_page = PACKETBUF_6LO_PTR[PACKETBUF_6LO_DISPATCH] & 0x0f; - packetbuf_hdr_len++; - } -} -/*--------------------------------------------------------------------*/ -/** - * \brief Digest 6lorh headers before IPHC - */ -static void -digest_6lorh_hdr(void) -{ - /* 6LoRH is not implemented yet */ -} -/*--------------------------------------------------------------------*/ -/** \name IPv6 dispatch "compression" function - * @{ */ -/*--------------------------------------------------------------------*/ -/* \brief Packets "Compression" when only IPv6 dispatch is used - * - * There is no compression in this case, all fields are sent - * inline. We just add the IPv6 dispatch byte before the packet. - * \verbatim - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | IPv6 Dsp | IPv6 header and payload ... - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * \endverbatim - */ - #if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_IPV6 -static void -compress_hdr_ipv6(linkaddr_t *link_destaddr) -{ - *packetbuf_ptr = SICSLOWPAN_DISPATCH_IPV6; - packetbuf_hdr_len += SICSLOWPAN_IPV6_HDR_LEN; - memcpy(packetbuf_ptr + packetbuf_hdr_len, UIP_IP_BUF, UIP_IPH_LEN); - packetbuf_hdr_len += UIP_IPH_LEN; - uncomp_hdr_len += UIP_IPH_LEN; - return; -} -#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_IPV6 */ -/** @} */ - -/*--------------------------------------------------------------------*/ -/** \name Input/output functions common to all compression schemes - * @{ */ -/*--------------------------------------------------------------------*/ -/** - * Callback function for the MAC packet sent callback - */ -static void -packet_sent(void *ptr, int status, int transmissions) -{ - const linkaddr_t *dest; - - if(callback != NULL) { - callback->output_callback(status); - } - last_tx_status = status; - - /* What follows only applies to unicast */ - dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); - if(linkaddr_cmp(dest, &linkaddr_null)) { - return; - } - - /* Update neighbor link statistics */ - link_stats_packet_sent(dest, status, transmissions); - - /* Call routing protocol link callback */ - NETSTACK_ROUTING.link_callback(dest, status, transmissions); - - /* DS6 callback, used for UIP_DS6_LL_NUD */ - uip_ds6_link_callback(status, transmissions); -} -/*--------------------------------------------------------------------*/ -/** - * \brief This function is called by the 6lowpan code to send out a - * packet. - * \param dest the link layer destination address of the packet - */ -static void -send_packet(linkaddr_t *dest) -{ - /* Set the link layer destination address for the packet as a - * packetbuf attribute. The MAC layer can access the destination - * address with the function packetbuf_addr(PACKETBUF_ADDR_RECEIVER). - */ - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, dest); - -#if NETSTACK_CONF_BRIDGE_MODE - /* This needs to be explicitly set here for bridge mode to work */ - packetbuf_set_addr(PACKETBUF_ADDR_SENDER,(void*)&uip_lladdr); -#endif - - /* Provide a callback function to receive the result of - a packet transmission. */ - NETSTACK_MAC.send(&packet_sent, NULL); - - /* If we are sending multiple packets in a row, we need to let the - watchdog know that we are still alive. */ - watchdog_periodic(); -} -#if SICSLOWPAN_CONF_FRAG -/*--------------------------------------------------------------------*/ -/** - * \brief This function is called by the 6lowpan code to copy a fragment's - * payload from uIP and send it down the stack. - * \param uip_offset the offset in the uIP buffer where to copy the payload from - * \param dest the link layer destination address of the packet - * \return 1 if success, 0 otherwise - */ -static int -fragment_copy_payload_and_send(uint16_t uip_offset, linkaddr_t *dest) { - struct queuebuf *q; - - /* Now copy fragment payload from uip_buf */ - memcpy(packetbuf_ptr + packetbuf_hdr_len, - (uint8_t *)UIP_IP_BUF + uip_offset, packetbuf_payload_len); - packetbuf_set_datalen(packetbuf_payload_len + packetbuf_hdr_len); - - /* Backup packetbuf to queuebuf. Enables preserving attributes for all framgnets */ - q = queuebuf_new_from_packetbuf(); - if(q == NULL) { - LOG_WARN("output: could not allocate queuebuf, dropping fragment\n"); - return 0; - } - - /* Send fragment */ - send_packet(dest); - - /* Restore packetbuf from queuebuf */ - queuebuf_to_packetbuf(q); - queuebuf_free(q); - - /* Check tx result. */ - if((last_tx_status == MAC_TX_COLLISION) || - (last_tx_status == MAC_TX_ERR) || - (last_tx_status == MAC_TX_ERR_FATAL)) { - LOG_ERR("output: error in fragment tx, dropping subsequent fragments.\n"); - return 0; - } - return 1; -} -#endif /* SICSLOWPAN_CONF_FRAG */ -/*--------------------------------------------------------------------*/ -/** \brief Take an IP packet and format it to be sent on an 802.15.4 - * network using 6lowpan. - * \param localdest The MAC address of the destination - * - * The IP packet is initially in uip_buf. Its header is compressed - * and if necessary it is fragmented. The resulting - * packet/fragments are put in packetbuf and delivered to the 802.15.4 - * MAC. - */ -static uint8_t -output(const linkaddr_t *localdest) -{ - int frag_needed; - - /* The MAC address of the destination of the packet */ - linkaddr_t dest; - - /* init */ - uncomp_hdr_len = 0; - packetbuf_hdr_len = 0; - - /* reset packetbuf buffer */ - packetbuf_clear(); - packetbuf_ptr = packetbuf_dataptr(); - - if(callback) { - /* call the attribution when the callback comes, but set attributes - here ! */ - set_packet_attrs(); - } - - /* - * The destination address will be tagged to each outbound - * packet. If the argument localdest is NULL, we are sending a - * broadcast packet. - */ - if(localdest == NULL) { - linkaddr_copy(&dest, &linkaddr_null); - } else { - linkaddr_copy(&dest, localdest); - } - - LOG_INFO("output: sending IPv6 packet with len %d\n", uip_len); - - /* copy over the retransmission count from uipbuf attributes */ - packetbuf_set_attr(PACKETBUF_ATTR_MAX_MAC_TRANSMISSIONS, - uipbuf_get_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS)); - -/* Calculate NETSTACK_FRAMER's header length, that will be added in the NETSTACK_MAC */ - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &dest); -#if LLSEC802154_USES_AUX_HEADER - /* copy LLSEC level */ - packetbuf_set_attr(PACKETBUF_ATTR_SECURITY_LEVEL, - uipbuf_get_attr(UIPBUF_ATTR_LLSEC_LEVEL)); -#if LLSEC802154_USES_EXPLICIT_KEYS - packetbuf_set_attr(PACKETBUF_ATTR_KEY_INDEX, - uipbuf_get_attr(UIPBUF_ATTR_LLSEC_KEY_ID)); -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ -#endif /* LLSEC802154_USES_AUX_HEADER */ - - mac_max_payload = NETSTACK_MAC.max_payload(); - - if(mac_max_payload <= 0) { - /* Framing failed, drop packet */ - LOG_WARN("output: failed to calculate payload size - dropping packet\n"); - return 0; - } - - /* Try to compress the headers */ -#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_IPV6 - compress_hdr_ipv6(&dest); -#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_IPV6 */ -#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_6LORH - /* Add 6LoRH headers before IPHC. Only needed on routed traffic - (non link-local). */ - if(!uip_is_addr_linklocal(&UIP_IP_BUF->destipaddr)) { - add_paging_dispatch(1); - add_6lorh_hdr(); - } -#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_6LORH */ -#if SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_IPHC - if(compress_hdr_iphc(&dest) == 0) { - /* Warning should already be issued by function above */ - return 0; - } -#endif /* SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_IPHC */ - - /* Use the mac_max_payload to understand what is the max payload in a MAC - * packet. We calculate it here only to make a better decision of whether - * the outgoing packet needs to be fragmented or not. */ - - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &dest); - - frag_needed = (int)uip_len - (int)uncomp_hdr_len + (int)packetbuf_hdr_len > mac_max_payload; - LOG_INFO("output: header len %d -> %d, total len %d -> %d, MAC max payload %d, frag_needed %d\n", - uncomp_hdr_len, packetbuf_hdr_len, - uip_len, uip_len - uncomp_hdr_len + packetbuf_hdr_len, - mac_max_payload, frag_needed); - - if(frag_needed) { -#if SICSLOWPAN_CONF_FRAG - /* Number of bytes processed. */ - uint16_t processed_ip_out_len; - uint16_t frag_tag; - int curr_frag = 0; - - /* - * The outbound IPv6 packet is too large to fit into a single 15.4 - * packet, so we fragment it into multiple packets and send them. - * The first fragment contains frag1 dispatch, then IPv6/IPHC/HC_UDP - * dispatchs/headers and IPv6 payload (with len multiple of 8 bytes). - * The subsequent fragments contain the FRAGN dispatch and more of the - * IPv6 payload (still multiple of 8 bytes, except for the last fragment) - */ - /* Total IPv6 payload */ - int total_payload = (uip_len - uncomp_hdr_len); - /* IPv6 payload that goes to first fragment */ - int frag1_payload = (mac_max_payload - packetbuf_hdr_len - SICSLOWPAN_FRAG1_HDR_LEN) & 0xfffffff8; - /* max IPv6 payload in each FRAGN. Must be multiple of 8 bytes */ - int fragn_max_payload = (mac_max_payload - SICSLOWPAN_FRAGN_HDR_LEN) & 0xfffffff8; - /* max IPv6 payload in the last fragment. Needs not be multiple of 8 bytes */ - int last_fragn_max_payload = mac_max_payload - SICSLOWPAN_FRAGN_HDR_LEN; - /* sum of all IPv6 payload that goes to non-first and non-last fragments */ - int middle_fragn_total_payload = MAX(total_payload - frag1_payload - last_fragn_max_payload, 0); - /* Ceiling of: 2 + middle_fragn_total_payload / fragn_max_payload */ - int fragment_count = 2; - if(middle_fragn_total_payload > 0) { - fragment_count += 1 + (middle_fragn_total_payload - 1) / fragn_max_payload; - } - - int freebuf = queuebuf_numfree() - 1; - LOG_INFO("output: fragmentation needed, fragments: %u, free queuebufs: %u\n", - fragment_count, freebuf); - - if(freebuf < fragment_count) { - LOG_WARN("output: dropping packet, not enough free bufs (needed: %u, free: %u)\n", - fragment_count, freebuf); - return 0; - } - - if(frag1_payload < 0) { - /* The current implementation requires that all headers fit in the first - * fragment. Here is a corner case where the header did fit packetbuf - * but do no longer fit after truncating for a length multiple of 8. */ - LOG_WARN("output: compressed header does not fit first fragment\n"); - return 0; - } - - /* Reset last tx status -- MAC layers most often call packet_sent asynchrously */ - last_tx_status = MAC_TX_OK; - /* Update fragment tag */ - frag_tag = my_tag++; - - /* Move IPHC/IPv6 header to make room for FRAG1 header */ - memmove(packetbuf_ptr + SICSLOWPAN_FRAG1_HDR_LEN, packetbuf_ptr, packetbuf_hdr_len); - packetbuf_hdr_len += SICSLOWPAN_FRAG1_HDR_LEN; - - /* Set FRAG1 header */ - SET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_DISPATCH_SIZE, - ((SICSLOWPAN_DISPATCH_FRAG1 << 8) | uip_len)); - SET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_TAG, frag_tag); - - /* Set frag1 payload len. Was already caulcated earlier as frag1_payload */ - packetbuf_payload_len = frag1_payload; - - /* Copy payload from uIP and send fragment */ - /* Send fragment */ - LOG_INFO("output: fragment %d/%d (tag %d, payload %d)\n", - curr_frag + 1, fragment_count, - frag_tag, packetbuf_payload_len); - if(fragment_copy_payload_and_send(uncomp_hdr_len, &dest) == 0) { - return 0; - } - - /* Now prepare for subsequent fragments. */ - - /* FRAGN header: tag was already set at FRAG1. Now set dispatch for all FRAGN */ - packetbuf_hdr_len = SICSLOWPAN_FRAGN_HDR_LEN; - SET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_DISPATCH_SIZE, - ((SICSLOWPAN_DISPATCH_FRAGN << 8) | uip_len)); - - /* Keep track of the total length of data sent */ - processed_ip_out_len = uncomp_hdr_len + packetbuf_payload_len; - - /* Create and send subsequent fragments. */ - while(processed_ip_out_len < uip_len) { - curr_frag++; - /* FRAGN header: set offset for this fragment */ - PACKETBUF_FRAG_PTR[PACKETBUF_FRAG_OFFSET] = processed_ip_out_len >> 3; - - /* Calculate fragment len */ - if(uip_len - processed_ip_out_len > last_fragn_max_payload) { - /* Not last fragment, send max FRAGN payload */ - packetbuf_payload_len = fragn_max_payload; - } else { - /* last fragment */ - packetbuf_payload_len = uip_len - processed_ip_out_len; - } - - /* Copy payload from uIP and send fragment */ - /* Send fragment */ - LOG_INFO("output: fragment %d/%d (tag %d, payload %d, offset %d)\n", - curr_frag + 1, fragment_count, - frag_tag, packetbuf_payload_len, processed_ip_out_len); - if(fragment_copy_payload_and_send(processed_ip_out_len, &dest) == 0) { - return 0; - } - - processed_ip_out_len += packetbuf_payload_len; - } -#else /* SICSLOWPAN_CONF_FRAG */ - LOG_ERR("output: Packet too large to be sent without fragmentation support; dropping packet\n"); - return 0; -#endif /* SICSLOWPAN_CONF_FRAG */ - } else { - - /* - * The packet does not need to be fragmented - * copy "payload" and send - */ - memcpy(packetbuf_ptr + packetbuf_hdr_len, (uint8_t *)UIP_IP_BUF + uncomp_hdr_len, - uip_len - uncomp_hdr_len); - packetbuf_set_datalen(uip_len - uncomp_hdr_len + packetbuf_hdr_len); - send_packet(&dest); - } - return 1; -} - -/*--------------------------------------------------------------------*/ -/** \brief Process a received 6lowpan packet. - * - * The 6lowpan packet is put in packetbuf by the MAC. If its a frag1 or - * a non-fragmented packet we first uncompress the IP header. The - * 6lowpan payload and possibly the uncompressed IP header are then - * copied in siclowpan_buf. If the IP packet is complete it is copied - * to uip_buf and the IP layer is called. - * - * \note We do not check for overlapping sicslowpan fragments - * (it is a SHALL in the RFC 4944 and should never happen) - */ -static void -input(void) -{ - /* size of the IP packet (read from fragment) */ - uint16_t frag_size = 0; - /* offset of the fragment in the IP packet */ - uint8_t frag_offset = 0; - uint8_t *buffer; - -#if SICSLOWPAN_CONF_FRAG - uint8_t is_fragment = 0; - int8_t frag_context = 0; - - /* tag of the fragment */ - uint16_t frag_tag = 0; - uint8_t first_fragment = 0, last_fragment = 0; -#endif /*SICSLOWPAN_CONF_FRAG*/ - - /* Update link statistics */ - link_stats_input_callback(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - - /* init */ - uncomp_hdr_len = 0; - packetbuf_hdr_len = 0; - - /* The MAC puts the 15.4 payload inside the packetbuf data buffer */ - packetbuf_ptr = packetbuf_dataptr(); - - if(packetbuf_datalen() == 0) { - LOG_WARN("input: empty packet\n"); - return; - } - - /* Clear uipbuf and set default attributes */ - uipbuf_clear(); - - /* This is default uip_buf since we assume that this is not fragmented */ - buffer = (uint8_t *)UIP_IP_BUF; - - /* Save the RSSI of the incoming packet in case the upper layer will - want to query us for it later. */ - last_rssi = (signed short)packetbuf_attr(PACKETBUF_ATTR_RSSI); - -#if SICSLOWPAN_CONF_FRAG - - /* - * Since we don't support the mesh and broadcast header, the first header - * we look for is the fragmentation header - */ - switch((GET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_DISPATCH_SIZE) >> 8) & SICSLOWPAN_DISPATCH_FRAG_MASK) { - case SICSLOWPAN_DISPATCH_FRAG1: - frag_offset = 0; - frag_size = GET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_DISPATCH_SIZE) & 0x07ff; - frag_tag = GET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_TAG); - packetbuf_hdr_len += SICSLOWPAN_FRAG1_HDR_LEN; - first_fragment = 1; - is_fragment = 1; - - LOG_INFO("input: received first element of a fragmented packet (tag %d, len %d)\n", - frag_tag, frag_size); - - /* Add the fragment to the fragmentation context */ - frag_context = add_fragment(frag_tag, frag_size, frag_offset); - - if(frag_context == -1) { - LOG_ERR("input: failed to allocate new reassembly context\n"); - return; - } - - buffer = frag_info[frag_context].first_frag; - break; - case SICSLOWPAN_DISPATCH_FRAGN: - /* - * set offset, tag, size - * Offset is in units of 8 bytes - */ - frag_offset = PACKETBUF_FRAG_PTR[PACKETBUF_FRAG_OFFSET]; - frag_tag = GET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_TAG); - frag_size = GET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_DISPATCH_SIZE) & 0x07ff; - packetbuf_hdr_len += SICSLOWPAN_FRAGN_HDR_LEN; - - /* Add the fragment to the fragmentation context (this will also - copy the payload) */ - frag_context = add_fragment(frag_tag, frag_size, frag_offset); - - if(frag_context == -1) { - LOG_ERR("input: reassembly context not found (tag %d)\n", frag_tag); - return; - } - - /* Ok - add_fragment will store the fragment automatically - so - we should not store more */ - buffer = NULL; - - if(frag_info[frag_context].reassembled_len >= frag_size) { - last_fragment = 1; - } - is_fragment = 1; - break; - default: - break; - } - - if(is_fragment && !first_fragment) { - /* this is a FRAGN, skip the header compression dispatch section */ - goto copypayload; - } -#endif /* SICSLOWPAN_CONF_FRAG */ - - /* First, process 6LoRH headers */ - curr_page = 0; - digest_paging_dispatch(); - if(curr_page == 1) { - LOG_INFO("input: page 1, 6LoRH\n"); - digest_6lorh_hdr(); - } else if (curr_page > 1) { - LOG_ERR("input: page %u not supported\n", curr_page); - return; - } - - /* Process next dispatch and headers */ - if((PACKETBUF_6LO_PTR[PACKETBUF_6LO_DISPATCH] & SICSLOWPAN_DISPATCH_IPHC_MASK) == SICSLOWPAN_DISPATCH_IPHC) { - LOG_DBG("uncompression: IPHC dispatch\n"); - uncompress_hdr_iphc(buffer, frag_size); - } else if(PACKETBUF_6LO_PTR[PACKETBUF_6LO_DISPATCH] == SICSLOWPAN_DISPATCH_IPV6) { - LOG_DBG("uncompression: IPV6 dispatch\n"); - packetbuf_hdr_len += SICSLOWPAN_IPV6_HDR_LEN; - - /* Put uncompressed IP header in sicslowpan_buf. */ - memcpy(buffer, packetbuf_ptr + packetbuf_hdr_len, UIP_IPH_LEN); - - /* Update uncomp_hdr_len and packetbuf_hdr_len. */ - packetbuf_hdr_len += UIP_IPH_LEN; - uncomp_hdr_len += UIP_IPH_LEN; - } else { - LOG_ERR("uncompression: unknown dispatch: 0x%02x\n", - PACKETBUF_6LO_PTR[PACKETBUF_6LO_DISPATCH] & SICSLOWPAN_DISPATCH_IPHC_MASK); - return; - } - -#if SICSLOWPAN_CONF_FRAG - copypayload: -#endif /*SICSLOWPAN_CONF_FRAG*/ - /* - * copy "payload" from the packetbuf buffer to the sicslowpan_buf - * if this is a first fragment or not fragmented packet, - * we have already copied the compressed headers, uncomp_hdr_len - * and packetbuf_hdr_len are non 0, frag_offset is. - * If this is a subsequent fragment, this is the contrary. - */ - if(packetbuf_datalen() < packetbuf_hdr_len) { - LOG_ERR("input: packet dropped due to header > total packet\n"); - return; - } - packetbuf_payload_len = packetbuf_datalen() - packetbuf_hdr_len; - -#if SICSLOWPAN_CONF_FRAG - if(is_fragment) { - LOG_INFO("input: fragment (tag %d, payload %d, offset %d) -- %u %u\n", - frag_tag, packetbuf_payload_len, frag_offset << 3, packetbuf_datalen(), packetbuf_hdr_len); - } -#endif /*SICSLOWPAN_CONF_FRAG*/ - - /* Sanity-check size of incoming packet to avoid buffer overflow */ - { - int req_size = uncomp_hdr_len + (uint16_t)(frag_offset << 3) - + packetbuf_payload_len; - if(req_size > sizeof(uip_buf)) { - LOG_ERR( - "input: packet dropped, minimum required IP_BUF size: %d+%d+%d=%d (current size: %u)\n", - uncomp_hdr_len, (uint16_t)(frag_offset << 3), - packetbuf_payload_len, req_size, (unsigned)sizeof(uip_buf)); - return; - } - } - - /* copy the payload if buffer is non-null - which is only the case with first fragment - or packets that are non fragmented */ - if(buffer != NULL) { - memcpy((uint8_t *)buffer + uncomp_hdr_len, packetbuf_ptr + packetbuf_hdr_len, packetbuf_payload_len); - } - - /* update processed_ip_in_len if fragment, sicslowpan_len otherwise */ - -#if SICSLOWPAN_CONF_FRAG - if(frag_size > 0) { - /* Add the size of the header only for the first fragment. */ - if(first_fragment != 0) { - frag_info[frag_context].reassembled_len = uncomp_hdr_len + packetbuf_payload_len; - frag_info[frag_context].first_frag_len = uncomp_hdr_len + packetbuf_payload_len; - } - /* For the last fragment, we are OK if there is extrenous bytes at - the end of the packet. */ - if(last_fragment != 0) { - frag_info[frag_context].reassembled_len = frag_size; - /* copy to uip */ - copy_frags2uip(frag_context); - } - } - - /* - * If we have a full IP packet in sicslowpan_buf, deliver it to - * the IP stack - */ - if(!is_fragment || last_fragment) { - /* packet is in uip already - just set length */ - if(is_fragment != 0 && last_fragment != 0) { - uip_len = frag_size; - } else { - uip_len = packetbuf_payload_len + uncomp_hdr_len; - } -#else - uip_len = packetbuf_payload_len + uncomp_hdr_len; -#endif /* SICSLOWPAN_CONF_FRAG */ - LOG_INFO("input: received IPv6 packet with len %d\n", - uip_len); - - if(LOG_DBG_ENABLED) { - uint16_t ndx; - LOG_DBG("uncompression: after (%u):", UIP_IP_BUF->len[1]); - for (ndx = 0; ndx < UIP_IP_BUF->len[1] + 40; ndx++) { - uint8_t data = ((uint8_t *) (UIP_IP_BUF))[ndx]; - LOG_DBG_("%02x", data); - } - LOG_DBG_("\n"); - } - - /* if callback is set then set attributes and call */ - if(callback) { - set_packet_attrs(); - callback->input_callback(); - } - -#if LLSEC802154_USES_AUX_HEADER - /* - * Assuming that the last packet in packetbuf is containing - * the LLSEC state so that it can be copied to uipbuf. - */ - uipbuf_set_attr(UIPBUF_ATTR_LLSEC_LEVEL, - packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL)); -#if LLSEC802154_USES_EXPLICIT_KEYS - uipbuf_set_attr(UIPBUF_ATTR_LLSEC_KEY_ID, - packetbuf_attr(PACKETBUF_ATTR_KEY_INDEX)); -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ -#endif /* LLSEC802154_USES_AUX_HEADER */ - - tcpip_input(); -#if SICSLOWPAN_CONF_FRAG - } -#endif /* SICSLOWPAN_CONF_FRAG */ -} -/** @} */ - -/*--------------------------------------------------------------------*/ -/* \brief 6lowpan init function (called by the MAC layer) */ -/*--------------------------------------------------------------------*/ -void -sicslowpan_init(void) -{ - -#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_IPHC -/* Preinitialize any address contexts for better header compression - * (Saves up to 13 bytes per 6lowpan packet) - * The platform contiki-conf.h file can override this using e.g. - * #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 {addr_contexts[0].prefix[0]=0xbb;addr_contexts[0].prefix[1]=0xbb;} - */ -#if SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0 - addr_contexts[0].used = 1; - addr_contexts[0].number = 0; -#ifdef SICSLOWPAN_CONF_ADDR_CONTEXT_0 - SICSLOWPAN_CONF_ADDR_CONTEXT_0; -#else - addr_contexts[0].prefix[0] = UIP_DS6_DEFAULT_PREFIX_0; - addr_contexts[0].prefix[1] = UIP_DS6_DEFAULT_PREFIX_1; -#endif -#endif /* SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0 */ - -#if SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 1 - { - int i; - for(i = 1; i < SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS; i++) { -#ifdef SICSLOWPAN_CONF_ADDR_CONTEXT_1 - if (i==1) { - addr_contexts[1].used = 1; - addr_contexts[1].number = 1; - SICSLOWPAN_CONF_ADDR_CONTEXT_1; -#ifdef SICSLOWPAN_CONF_ADDR_CONTEXT_2 - } else if (i==2) { - addr_contexts[2].used = 1; - addr_contexts[2].number = 2; - SICSLOWPAN_CONF_ADDR_CONTEXT_2; -#endif - } else { - addr_contexts[i].used = 0; - } -#else - addr_contexts[i].used = 0; -#endif /* SICSLOWPAN_CONF_ADDR_CONTEXT_1 */ - } - } -#endif /* SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 1 */ - -#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_IPHC */ -} -/*--------------------------------------------------------------------*/ -int -sicslowpan_get_last_rssi(void) -{ - return last_rssi; -} -/*--------------------------------------------------------------------*/ -const struct network_driver sicslowpan_driver = { - "sicslowpan", - sicslowpan_init, - input, - output -}; -/*--------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/sicslowpan.h b/os/net/ipv6/sicslowpan.h deleted file mode 100644 index 46cf6cc05..000000000 --- a/os/net/ipv6/sicslowpan.h +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the 6lowpan implementation - * (RFC4944 and draft-hui-6lowpan-hc-01) - * \author Adam Dunkels - * \author Nicolas Tsiftes - * \author Niclas Finne - * \author Mathilde Durvy - * \author Julien Abeille - */ - -/** - * \addtogroup sicslowpan - * @{ - */ - -#ifndef SICSLOWPAN_H_ -#define SICSLOWPAN_H_ - -#include "net/ipv6/uip.h" -#include "net/mac/mac.h" - -/** - * \name General sicslowpan defines - * @{ - */ -/* Min and Max compressible UDP ports - HC06 */ -#define SICSLOWPAN_UDP_4_BIT_PORT_MIN 0xF0B0 -#define SICSLOWPAN_UDP_4_BIT_PORT_MAX 0xF0BF /* F0B0 + 15 */ -#define SICSLOWPAN_UDP_8_BIT_PORT_MIN 0xF000 -#define SICSLOWPAN_UDP_8_BIT_PORT_MAX 0xF0FF /* F000 + 255 */ - -/** @} */ - -/** - * \name 6lowpan compressions - * @{ - */ -#define SICSLOWPAN_COMPRESSION_IPV6 0 /* No compression */ -#define SICSLOWPAN_COMPRESSION_IPHC 1 /* RFC 6282 */ -#define SICSLOWPAN_COMPRESSION_6LORH 2 /* RFC 8025 for paging dispatch, - * draft-ietf-6lo-routin-dispatch-05 for 6LoRH. 6LoRH is not - * implemented yet -- only support for paging dispatch. */ -/** @} */ - -/** - * \name 6lowpan dispatches - * @{ - */ -#define SICSLOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */ -#define SICSLOWPAN_DISPATCH_HC1 0x42 /* 01000010 = 66 */ -#define SICSLOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */ -#define SICSLOWPAN_DISPATCH_IPHC_MASK 0xe0 -#define SICSLOWPAN_DISPATCH_FRAG1 0xc0 /* 11000xxx */ -#define SICSLOWPAN_DISPATCH_FRAGN 0xe0 /* 11100xxx */ -#define SICSLOWPAN_DISPATCH_FRAG_MASK 0xf8 -#define SICSLOWPAN_DISPATCH_PAGING 0xf0 /* 1111xxxx */ -#define SICSLOWPAN_DISPATCH_PAGING_MASK 0xf0 -/** @} */ - -/** \name HC1 encoding - * @{ - */ -#define SICSLOWPAN_HC1_NH_UDP 0x02 -#define SICSLOWPAN_HC1_NH_TCP 0x06 -#define SICSLOWPAN_HC1_NH_ICMP6 0x04 -/** @} */ - -/** \name HC_UDP encoding (works together with HC1) - * @{ - */ -#define SICSLOWPAN_HC_UDP_ALL_C 0xE0 -/** @} */ - -/** - * \name IPHC encoding - * @{ - */ -/* - * Values of fields within the IPHC encoding first byte - * (C stands for compressed and I for inline) - */ -#define SICSLOWPAN_IPHC_FL_C 0x10 -#define SICSLOWPAN_IPHC_TC_C 0x08 -#define SICSLOWPAN_IPHC_NH_C 0x04 -#define SICSLOWPAN_IPHC_TTL_1 0x01 -#define SICSLOWPAN_IPHC_TTL_64 0x02 -#define SICSLOWPAN_IPHC_TTL_255 0x03 -#define SICSLOWPAN_IPHC_TTL_I 0x00 - - -/* Values of fields within the IPHC encoding second byte */ -#define SICSLOWPAN_IPHC_CID 0x80 - -#define SICSLOWPAN_IPHC_SAC 0x40 -#define SICSLOWPAN_IPHC_SAM_00 0x00 -#define SICSLOWPAN_IPHC_SAM_01 0x10 -#define SICSLOWPAN_IPHC_SAM_10 0x20 -#define SICSLOWPAN_IPHC_SAM_11 0x30 - -#define SICSLOWPAN_IPHC_SAM_BIT 4 - -#define SICSLOWPAN_IPHC_M 0x08 -#define SICSLOWPAN_IPHC_DAC 0x04 -#define SICSLOWPAN_IPHC_DAM_00 0x00 -#define SICSLOWPAN_IPHC_DAM_01 0x01 -#define SICSLOWPAN_IPHC_DAM_10 0x02 -#define SICSLOWPAN_IPHC_DAM_11 0x03 - -#define SICSLOWPAN_IPHC_DAM_BIT 0 - -/* Link local context number */ -#define SICSLOWPAN_IPHC_ADDR_CONTEXT_LL 0 -/* 16-bit multicast addresses compression */ -#define SICSLOWPAN_IPHC_MCAST_RANGE 0xA0 -/** @} */ - -/* NHC_EXT_HDR */ -#define SICSLOWPAN_NHC_MASK 0xF0 -#define SICSLOWPAN_NHC_EXT_HDR 0xE0 -#define SICSLOWPAN_NHC_BIT 0x01 - -/* The header values */ -#define SICSLOWPAN_NHC_ETX_HDR_HBHO 0x00 -#define SICSLOWPAN_NHC_ETX_HDR_ROUTING 0x01 -#define SICSLOWPAN_NHC_ETX_HDR_FRAG 0x02 -#define SICSLOWPAN_NHC_ETX_HDR_DESTO 0x03 -#define SICSLOWPAN_NHC_ETX_HDR_MOH 0x04 -#define SICSLOWPAN_NHC_ETX_HDR_IPV6 0x07 - -/** - * \name LOWPAN_UDP encoding (works together with IPHC) - * @{ - */ -/** - * \name LOWPAN_UDP encoding (works together with IPHC) - * @{ - */ -#define SICSLOWPAN_NHC_UDP_MASK 0xF8 -#define SICSLOWPAN_NHC_UDP_ID 0xF0 -#define SICSLOWPAN_NHC_UDP_CHECKSUMC 0x04 -#define SICSLOWPAN_NHC_UDP_CHECKSUMI 0x00 -/* values for port compression, _with checksum_ ie bit 5 set to 0 */ -#define SICSLOWPAN_NHC_UDP_CS_P_00 0xF0 /* all inline */ -#define SICSLOWPAN_NHC_UDP_CS_P_01 0xF1 /* source 16bit inline, dest = 0xF0 + 8 bit inline */ -#define SICSLOWPAN_NHC_UDP_CS_P_10 0xF2 /* source = 0xF0 + 8bit inline, dest = 16 bit inline */ -#define SICSLOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit inline */ -/** @} */ - - -/** - * \name The 6lowpan "headers" length - * @{ - */ - -#define SICSLOWPAN_IPV6_HDR_LEN 1 /*one byte*/ -#define SICSLOWPAN_HC1_HDR_LEN 3 -#define SICSLOWPAN_HC1_HC_UDP_HDR_LEN 7 -#define SICSLOWPAN_FRAG1_HDR_LEN 4 -#define SICSLOWPAN_FRAGN_HDR_LEN 5 -/** @} */ - -/** - * \brief The header for fragments - * \note We do not define different structures for FRAG1 - * and FRAGN headers, which are different. For FRAG1, the - * offset field is just not used - */ -/* struct sicslowpan_frag_hdr { */ -/* uint16_t dispatch_size; */ -/* uint16_t tag; */ -/* uint8_t offset; */ -/* }; */ - -/** - * \brief The HC1 header when HC_UDP is not used - * - * When all fields are compressed and HC_UDP is not used, - * we use this structure. If HC_UDP is used, the ttl is - * in another spot, and we use the sicslowpan_hc1_hc_udp - * structure - */ -/* struct sicslowpan_hc1_hdr { */ -/* uint8_t dispatch; */ -/* uint8_t encoding; */ -/* uint8_t ttl; */ -/* }; */ - -/** - * \brief HC1 followed by HC_UDP - */ -/* struct sicslowpan_hc1_hc_udp_hdr { */ -/* uint8_t dispatch; */ -/* uint8_t hc1_encoding; */ -/* uint8_t hc_udp_encoding; */ -/* uint8_t ttl; */ -/* uint8_t ports; */ -/* uint16_t udpchksum; */ -/* }; */ - -/** - * \brief An address context for IPHC address compression - * each context can have upto 8 bytes - */ -struct sicslowpan_addr_context { - uint8_t used; /* possibly use as prefix-length */ - uint8_t number; - uint8_t prefix[8]; -}; - -/** - * \name Address compressibility test functions - * @{ - */ - -/** - * \brief check whether we can compress the IID in - * address 'a' to 16 bits. - * This is used for unicast addresses only, and is true - * if the address is on the format \::0000:00ff:fe00:XXXX - * NOTE: we currently assume 64-bits prefixes - */ -#define sicslowpan_is_iid_16_bit_compressable(a) \ - ((((a)->u16[4]) == 0) && \ - (((a)->u8[10]) == 0)&& \ - (((a)->u8[11]) == 0xff)&& \ - (((a)->u8[12]) == 0xfe)&& \ - (((a)->u8[13]) == 0)) - -/** - * \brief check whether the 9-bit group-id of the - * compressed multicast address is known. It is true - * if the 9-bit group is the all nodes or all routers - * group. - * \param a is typed uint8_t * - */ -#define sicslowpan_is_mcast_addr_decompressable(a) \ - (((*a & 0x01) == 0) && \ - ((*(a + 1) == 0x01) || (*(a + 1) == 0x02))) - -/** - * \brief check whether the 112-bit group-id of the - * multicast address is mappable to a 9-bit group-id - * It is true if the group is the all nodes or all - * routers group. -*/ -#define sicslowpan_is_mcast_addr_compressable(a) \ - ((((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u16[5]) == 0) && \ - (((a)->u16[6]) == 0) && \ - (((a)->u8[14]) == 0) && \ - ((((a)->u8[15]) == 1) || (((a)->u8[15]) == 2))) - -/* FFXX::00XX:XXXX:XXXX */ -#define sicslowpan_is_mcast_addr_compressable48(a) \ - ((((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u8[10]) == 0)) - -/* FFXX::00XX:XXXX */ -#define sicslowpan_is_mcast_addr_compressable32(a) \ - ((((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u16[5]) == 0) && \ - (((a)->u8[12]) == 0)) - -/* FF02::00XX */ -#define sicslowpan_is_mcast_addr_compressable8(a) \ - ((((a)->u8[1]) == 2) && \ - (((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u16[5]) == 0) && \ - (((a)->u16[6]) == 0) && \ - (((a)->u8[14]) == 0)) - -/** @} */ - -/** - * The structure of a next header compressor. - * - * TODO: needs more parameters when compressing extension headers, etc. - */ -struct sicslowpan_nh_compressor { - int (* is_compressable)(uint8_t next_header); - - /** compress next header (TCP/UDP, etc) - ptr points to next header to - compress */ - int (* compress)(uint8_t *compressed, uint8_t *uncompressed_len); - - /** uncompress next header (TCP/UDP, etc) - ptr points to next header to - uncompress */ - int (* uncompress)(uint8_t *compressed, uint8_t *lowpanbuf, uint8_t *uncompressed_len); - -}; - -int sicslowpan_get_last_rssi(void); - -extern const struct network_driver sicslowpan_driver; - -#endif /* SICSLOWPAN_H_ */ -/** @} */ diff --git a/os/net/ipv6/simple-udp.c b/os/net/ipv6/simple-udp.c deleted file mode 100644 index 08986d827..000000000 --- a/os/net/ipv6/simple-udp.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Code for the simple-udp module. - * \author - * Adam Dunkels - * - */ - -/** - * \addtogroup simple-udp - * @{ - */ - -#include "contiki-net.h" -#include "net/ipv6/simple-udp.h" - -#include - - -PROCESS(simple_udp_process, "Simple UDP process"); -static uint8_t started = 0; -static uint8_t databuffer[UIP_BUFSIZE]; - -/*---------------------------------------------------------------------------*/ -static void -init_simple_udp(void) -{ - if(started == 0) { - process_start(&simple_udp_process, NULL); - started = 1; - } -} -/*---------------------------------------------------------------------------*/ -int -simple_udp_send(struct simple_udp_connection *c, - const void *data, uint16_t datalen) -{ - if(c->udp_conn != NULL) { - uip_udp_packet_sendto(c->udp_conn, data, datalen, - &c->remote_addr, UIP_HTONS(c->remote_port)); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -simple_udp_sendto(struct simple_udp_connection *c, - const void *data, uint16_t datalen, - const uip_ipaddr_t *to) -{ - if(c->udp_conn != NULL) { - uip_udp_packet_sendto(c->udp_conn, data, datalen, - to, UIP_HTONS(c->remote_port)); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -simple_udp_sendto_port(struct simple_udp_connection *c, - const void *data, uint16_t datalen, - const uip_ipaddr_t *to, - uint16_t port) -{ - if(c->udp_conn != NULL) { - uip_udp_packet_sendto(c->udp_conn, data, datalen, - to, UIP_HTONS(port)); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -simple_udp_register(struct simple_udp_connection *c, - uint16_t local_port, - uip_ipaddr_t *remote_addr, - uint16_t remote_port, - simple_udp_callback receive_callback) -{ - - init_simple_udp(); - - c->local_port = local_port; - c->remote_port = remote_port; - if(remote_addr != NULL) { - uip_ipaddr_copy(&c->remote_addr, remote_addr); - } - c->receive_callback = receive_callback; - - PROCESS_CONTEXT_BEGIN(&simple_udp_process); - c->udp_conn = udp_new(remote_addr, UIP_HTONS(remote_port), c); - if(c->udp_conn != NULL && local_port) { - udp_bind(c->udp_conn, UIP_HTONS(local_port)); - } - PROCESS_CONTEXT_END(); - - if(c->udp_conn == NULL) { - return 0; - } - return 1; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(simple_udp_process, ev, data) -{ - struct simple_udp_connection *c; - PROCESS_BEGIN(); - - while(1) { - PROCESS_WAIT_EVENT(); - if(ev == tcpip_event) { - - /* An appstate pointer is passed to use from the IP stack - through the 'data' pointer. We registered this appstate when - we did the udp_new() call in simple_udp_register() as the - struct simple_udp_connection pointer. So we extract this - pointer and use it when calling the reception callback. */ - c = (struct simple_udp_connection *)data; - - /* Defensive coding: although the appstate *should* be non-null - here, we make sure to avoid the program crashing on us. */ - if(c != NULL) { - - /* If we were called because of incoming data, we should call - the reception callback. */ - if(uip_newdata()) { - /* Copy the data from the uIP data buffer into our own - buffer to avoid the uIP buffer being messed with by the - callee. */ - memcpy(databuffer, uip_appdata, uip_datalen()); - - /* Call the client process. We use the PROCESS_CONTEXT - mechanism to temporarily switch process context to the - client process. */ - if(c->receive_callback != NULL) { - PROCESS_CONTEXT_BEGIN(c->client_process); - c->receive_callback(c, - &(UIP_IP_BUF->srcipaddr), - UIP_HTONS(UIP_UDP_BUF->srcport), - &(UIP_IP_BUF->destipaddr), - UIP_HTONS(UIP_UDP_BUF->destport), - databuffer, uip_datalen()); - PROCESS_CONTEXT_END(); - } - } - } - } - - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/simple-udp.h b/os/net/ipv6/simple-udp.h deleted file mode 100644 index 212eb7885..000000000 --- a/os/net/ipv6/simple-udp.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Header file for the simple-udp module. - * \author - * Adam Dunkels - * - */ - -/** - * \addtogroup uip - * @{ - */ - - -/** - * \defgroup simple-udp A simple UDP API - * - * The default Contiki UDP API is difficult to use. The simple-udp - * module provides a significantly simpler API. - * - * @{ - */ - -#ifndef SIMPLE_UDP_H -#define SIMPLE_UDP_H - -#include "net/ipv6/uip.h" - -struct simple_udp_connection; - -/** Simple UDP Callback function type. */ -typedef void (* simple_udp_callback)(struct simple_udp_connection *c, - const uip_ipaddr_t *source_addr, - uint16_t source_port, - const uip_ipaddr_t *dest_addr, - uint16_t dest_port, - const uint8_t *data, uint16_t datalen); - -/** Simple UDP connection */ -struct simple_udp_connection { - struct simple_udp_connection *next; - uip_ipaddr_t remote_addr; - uint16_t remote_port, local_port; - simple_udp_callback receive_callback; - struct uip_udp_conn *udp_conn; - struct process *client_process; -}; - -/** - * \brief Register a UDP connection - * \param c A pointer to a struct simple_udp_connection - * \param local_port The local UDP port in host byte order - * \param remote_addr The remote IP address - * \param remote_port The remote UDP port in host byte order - * \param receive_callback A pointer to a function of to be called for incoming packets - * \retval 0 If no UDP connection could be allocated - * \retval 1 If the connection was successfully allocated - * - * This function registers a UDP connection and attaches a - * callback function to it. The callback function will be - * called for incoming packets. The local UDP port can be - * set to 0 to indicate that an ephemeral UDP port should - * be allocated. The remote IP address can be NULL, to - * indicate that packets from any IP address should be - * accepted. - * - */ -int simple_udp_register(struct simple_udp_connection *c, - uint16_t local_port, - uip_ipaddr_t *remote_addr, - uint16_t remote_port, - simple_udp_callback receive_callback); - -/** - * \brief Send a UDP packet - * \param c A pointer to a struct simple_udp_connection - * \param data A pointer to the data to be sent - * \param datalen The length of the data - * - * This function sends a UDP packet. The packet will be - * sent to the IP address and with the UDP ports that were - * specified when the connection was registered with - * simple_udp_register(). - * - * \sa simple_udp_sendto() - */ -int simple_udp_send(struct simple_udp_connection *c, - const void *data, uint16_t datalen); - -/** - * \brief Send a UDP packet to a specified IP address - * \param c A pointer to a struct simple_udp_connection - * \param data A pointer to the data to be sent - * \param datalen The length of the data - * \param to The IP address of the receiver - * - * This function sends a UDP packet to a specified IP - * address. The packet will be sent with the UDP ports - * that were specified when the connection was registered - * with simple_udp_register(). - * - * \sa simple_udp_send() - */ -int simple_udp_sendto(struct simple_udp_connection *c, - const void *data, uint16_t datalen, - const uip_ipaddr_t *to); - -/** - * \brief Send a UDP packet to a specified IP address and UDP port - * \param c A pointer to a struct simple_udp_connection - * \param data A pointer to the data to be sent - * \param datalen The length of the data - * \param to The IP address of the receiver - * \param to_port The UDP port of the receiver, in host byte order - * - * This function sends a UDP packet to a specified IP - * address and UDP port. The packet will be sent with the - * UDP ports that were specified when the connection was - * registered with simple_udp_register(). - * - * \sa simple_udp_sendto() - */ -int simple_udp_sendto_port(struct simple_udp_connection *c, - const void *data, uint16_t datalen, - const uip_ipaddr_t *to, uint16_t to_port); - -void simple_udp_init(void); - -#endif /* SIMPLE_UDP_H */ - -/** @} */ -/** @} */ diff --git a/os/net/ipv6/tcp-socket.c b/os/net/ipv6/tcp-socket.c deleted file mode 100644 index b2ec304a5..000000000 --- a/os/net/ipv6/tcp-socket.c +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2012-2014, Thingsquare, http://www.thingsquare.com/. - * 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 DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -#include "contiki.h" -#include "sys/cc.h" -#include "contiki-net.h" - -#include "lib/list.h" - -#include "tcp-socket.h" - -#include - -static void relisten(struct tcp_socket *s); - -LIST(socketlist); -/*---------------------------------------------------------------------------*/ -PROCESS(tcp_socket_process, "TCP socket process"); -/*---------------------------------------------------------------------------*/ -static void -call_event(struct tcp_socket *s, tcp_socket_event_t event) -{ - if(s != NULL && s->event_callback != NULL) { - s->event_callback(s, s->ptr, event); - } -} -/*---------------------------------------------------------------------------*/ -static void -senddata(struct tcp_socket *s) -{ - int len = MIN(s->output_data_max_seg, uip_mss()); - - if(s->output_senddata_len > 0) { - len = MIN(s->output_senddata_len, len); - s->output_data_send_nxt = len; - uip_send(s->output_data_ptr, len); - } -} -/*---------------------------------------------------------------------------*/ -static void -acked(struct tcp_socket *s) -{ - if(s->output_senddata_len > 0) { - /* Copy the data in the outputbuf down and update outputbufptr and - outputbuf_lastsent */ - - if(s->output_data_send_nxt > 0) { - memcpy(&s->output_data_ptr[0], - &s->output_data_ptr[s->output_data_send_nxt], - s->output_data_maxlen - s->output_data_send_nxt); - } - if(s->output_data_len < s->output_data_send_nxt) { - PRINTF("tcp: acked assertion failed s->output_data_len (%d) < s->output_data_send_nxt (%d)\n", - s->output_data_len, - s->output_data_send_nxt); - tcp_markconn(uip_conn, NULL); - uip_abort(); - call_event(s, TCP_SOCKET_ABORTED); - relisten(s); - return; - } - s->output_data_len -= s->output_data_send_nxt; - s->output_senddata_len = s->output_data_len; - s->output_data_send_nxt = 0; - - call_event(s, TCP_SOCKET_DATA_SENT); - } -} -/*---------------------------------------------------------------------------*/ -static void -newdata(struct tcp_socket *s) -{ - uint16_t len, copylen, bytesleft; - uint8_t *dataptr; - len = uip_datalen(); - dataptr = uip_appdata; - - /* We have a segment with data coming in. We copy as much data as - possible into the input buffer and call the input callback - function. The input callback returns the number of bytes that - should be retained in the buffer, or zero if all data should be - consumed. If there is data to be retained, the highest bytes of - data are copied down into the input buffer. */ - do { - copylen = MIN(len, s->input_data_maxlen); - memcpy(s->input_data_ptr, dataptr, copylen); - if(s->input_callback) { - bytesleft = s->input_callback(s, s->ptr, - s->input_data_ptr, copylen); - } else { - bytesleft = 0; - } - if(bytesleft > 0) { - PRINTF("tcp: newdata, bytesleft > 0 (%d) not implemented\n", bytesleft); - } - dataptr += copylen; - len -= copylen; - - } while(len > 0); -} -/*---------------------------------------------------------------------------*/ -static void -relisten(struct tcp_socket *s) -{ - if(s != NULL && s->listen_port != 0) { - s->flags |= TCP_SOCKET_FLAGS_LISTENING; - } -} -/*---------------------------------------------------------------------------*/ -static void -appcall(void *state) -{ - struct tcp_socket *s = state; - - if(s != NULL && s->c != NULL && s->c != uip_conn) { - /* Safe-guard: this should not happen, as the incoming event relates to - * a previous connection */ - return; - } - if(uip_connected()) { - /* Check if this connection originated in a local listen - socket. We do this by checking the state pointer - if NULL, - this is an incoming listen connection. If so, we need to - connect the socket to the uip_conn and call the event - function. */ - if(s == NULL) { - for(s = list_head(socketlist); - s != NULL; - s = list_item_next(s)) { - if((s->flags & TCP_SOCKET_FLAGS_LISTENING) != 0 && - s->listen_port != 0 && - s->listen_port == uip_htons(uip_conn->lport)) { - s->flags &= ~TCP_SOCKET_FLAGS_LISTENING; - s->output_data_max_seg = uip_mss(); - tcp_markconn(uip_conn, s); - call_event(s, TCP_SOCKET_CONNECTED); - break; - } - } - } else { - s->output_data_max_seg = uip_mss(); - call_event(s, TCP_SOCKET_CONNECTED); - } - - if(s == NULL) { - uip_abort(); - } else { - if(uip_newdata()) { - newdata(s); - } - senddata(s); - } - return; - } - - if(uip_timedout()) { - call_event(s, TCP_SOCKET_TIMEDOUT); - relisten(s); - } - - if(uip_aborted()) { - tcp_markconn(uip_conn, NULL); - call_event(s, TCP_SOCKET_ABORTED); - relisten(s); - - } - - if(s == NULL) { - uip_abort(); - return; - } - - if(uip_acked()) { - acked(s); - } - if(uip_newdata()) { - newdata(s); - } - - if(uip_rexmit() || - uip_newdata() || - uip_acked()) { - senddata(s); - } else if(uip_poll()) { - senddata(s); - } - - if(s->output_data_len == 0 && s->flags & TCP_SOCKET_FLAGS_CLOSING) { - s->flags &= ~TCP_SOCKET_FLAGS_CLOSING; - uip_close(); - s->c = NULL; - tcp_markconn(uip_conn, NULL); - s->c = NULL; - /*call_event(s, TCP_SOCKET_CLOSED);*/ - relisten(s); - } - - if(uip_closed()) { - tcp_markconn(uip_conn, NULL); - s->c = NULL; - call_event(s, TCP_SOCKET_CLOSED); - relisten(s); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tcp_socket_process, ev, data) -{ - PROCESS_BEGIN(); - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == tcpip_event) { - appcall(data); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - static uint8_t inited = 0; - if(!inited) { - list_init(socketlist); - process_start(&tcp_socket_process, NULL); - inited = 1; - } -} -/*---------------------------------------------------------------------------*/ -int -tcp_socket_register(struct tcp_socket *s, void *ptr, - uint8_t *input_databuf, int input_databuf_len, - uint8_t *output_databuf, int output_databuf_len, - tcp_socket_data_callback_t input_callback, - tcp_socket_event_callback_t event_callback) -{ - - init(); - - if(s == NULL) { - return -1; - } - s->ptr = ptr; - s->input_data_ptr = input_databuf; - s->input_data_maxlen = input_databuf_len; - s->output_data_len = 0; - s->output_data_ptr = output_databuf; - s->output_data_maxlen = output_databuf_len; - s->input_callback = input_callback; - s->event_callback = event_callback; - list_add(socketlist, s); - - s->listen_port = 0; - s->flags = TCP_SOCKET_FLAGS_NONE; - return 1; -} -/*---------------------------------------------------------------------------*/ -int -tcp_socket_connect(struct tcp_socket *s, - const uip_ipaddr_t *ipaddr, - uint16_t port) -{ - if(s == NULL) { - return -1; - } - if(s->c != NULL) { - tcp_markconn(s->c, NULL); - } - PROCESS_CONTEXT_BEGIN(&tcp_socket_process); - s->c = tcp_connect(ipaddr, uip_htons(port), s); - PROCESS_CONTEXT_END(); - if(s->c == NULL) { - return -1; - } else { - return 1; - } -} -/*---------------------------------------------------------------------------*/ -int -tcp_socket_listen(struct tcp_socket *s, - uint16_t port) -{ - if(s == NULL) { - return -1; - } - - s->listen_port = port; - PROCESS_CONTEXT_BEGIN(&tcp_socket_process); - tcp_listen(uip_htons(port)); - PROCESS_CONTEXT_END(); - s->flags |= TCP_SOCKET_FLAGS_LISTENING; - return 1; -} -/*---------------------------------------------------------------------------*/ -int -tcp_socket_unlisten(struct tcp_socket *s) -{ - if(s == NULL) { - return -1; - } - - PROCESS_CONTEXT_BEGIN(&tcp_socket_process); - tcp_unlisten(uip_htons(s->listen_port)); - PROCESS_CONTEXT_END(); - s->listen_port = 0; - s->flags &= ~TCP_SOCKET_FLAGS_LISTENING; - return 1; -} -/*---------------------------------------------------------------------------*/ -int -tcp_socket_send(struct tcp_socket *s, - const uint8_t *data, int datalen) -{ - int len; - - if(s == NULL) { - return -1; - } - - len = MIN(datalen, s->output_data_maxlen - s->output_data_len); - - memcpy(&s->output_data_ptr[s->output_data_len], data, len); - s->output_data_len += len; - - if(s->output_senddata_len == 0) { - s->output_senddata_len = s->output_data_len; - } - - tcpip_poll_tcp(s->c); - - return len; -} -/*---------------------------------------------------------------------------*/ -int -tcp_socket_send_str(struct tcp_socket *s, - const char *str) -{ - return tcp_socket_send(s, (const uint8_t *)str, strlen(str)); -} -/*---------------------------------------------------------------------------*/ -int -tcp_socket_close(struct tcp_socket *s) -{ - if(s == NULL) { - return -1; - } - - s->flags |= TCP_SOCKET_FLAGS_CLOSING; - return 1; -} -/*---------------------------------------------------------------------------*/ -int -tcp_socket_unregister(struct tcp_socket *s) -{ - if(s == NULL) { - return -1; - } - - tcp_socket_unlisten(s); - if(s->c != NULL) { - tcp_attach(s->c, NULL); - } - list_remove(socketlist, s); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -tcp_socket_max_sendlen(struct tcp_socket *s) -{ - return s->output_data_maxlen - s->output_data_len; -} -/*---------------------------------------------------------------------------*/ -int -tcp_socket_queuelen(struct tcp_socket *s) -{ - return s->output_data_len; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/ipv6/tcp-socket.h b/os/net/ipv6/tcp-socket.h deleted file mode 100644 index dd7b5c793..000000000 --- a/os/net/ipv6/tcp-socket.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) 2012-2014, Thingsquare, http://www.thingsquare.com/. - * 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 TCP_SOCKET_H -#define TCP_SOCKET_H - -#include "uip.h" - -struct tcp_socket; - -typedef enum { - TCP_SOCKET_CONNECTED, - TCP_SOCKET_CLOSED, - TCP_SOCKET_TIMEDOUT, - TCP_SOCKET_ABORTED, - TCP_SOCKET_DATA_SENT -} tcp_socket_event_t; - -/** - * \brief TCP data callback function - * \param s A pointer to a TCP socket - * \param ptr A user-defined pointer - * \param input_data_ptr A pointer to the incoming data - * \param input_data_len The length of the incoming data - * \return The function should return the number of bytes to leave in the input buffer - * - * The TCP socket input callback function gets - * called whenever there is new data on the socket. The - * function can choose to either consume the data - * directly, or leave it in the buffer for later. The - * function must return the amount of data to leave in the - * buffer. I.e., if the callback function consumes all - * incoming data, it should return 0. - */ -typedef int (* tcp_socket_data_callback_t)(struct tcp_socket *s, - void *ptr, - const uint8_t *input_data_ptr, - int input_data_len); - - -/** - * \brief TCP event callback function - * \param s A pointer to a TCP socket - * \param ptr A user-defined pointer - * \param event The event number - * - * The TCP socket event callback function gets - * called whenever there is an event on a socket, such as - * the socket getting connected or closed. - */ -typedef void (* tcp_socket_event_callback_t)(struct tcp_socket *s, - void *ptr, - tcp_socket_event_t event); - -struct tcp_socket { - struct tcp_socket *next; - - tcp_socket_data_callback_t input_callback; - tcp_socket_event_callback_t event_callback; - void *ptr; - - struct process *p; - - uint8_t *input_data_ptr; - uint8_t *output_data_ptr; - - uint16_t input_data_maxlen; - uint16_t input_data_len; - uint16_t output_data_maxlen; - uint16_t output_data_len; - uint16_t output_data_send_nxt; - uint16_t output_senddata_len; - uint16_t output_data_max_seg; - - uint8_t flags; - uint16_t listen_port; - struct uip_conn *c; -}; - -enum { - TCP_SOCKET_FLAGS_NONE = 0x00, - TCP_SOCKET_FLAGS_LISTENING = 0x01, - TCP_SOCKET_FLAGS_CLOSING = 0x02, -}; - -/** - * \brief Register a TCP socket - * \param s A pointer to a TCP socket - * \param ptr A user-defined pointer that will be sent to callbacks for this socket - * \param input_databuf A pointer to a memory area this socket will use for input data - * \param input_databuf_len The size of the input data buffer - * \param output_databuf A pointer to a memory area this socket will use for outgoing data - * \param output_databuf_len The size of the output data buffer - * \param data_callback A pointer to the data callback function for this socket - * \param event_callback A pointer to the event callback function for this socket - * \retval -1 If an error occurs - * \retval 1 If the operation succeeds. - * - * This function registers a TCP socket. The function sets - * up the output and input buffers for the socket and - * callback pointers. - * - * TCP sockets use input and output buffers for incoming - * and outgoing data. The memory for these buffers must be - * allocated by the caller. The size of the buffers - * determine the amount of data that can be received and - * sent, and the principle is that the application that - * sets up the TCP socket will know roughly how large - * these buffers should be. The rule of thumb is that the - * input buffer should be large enough to hold the largest - * application layer message that the application will - * receive and the output buffer should be large enough to - * hold the largest application layer message the - * application will send. - * - * TCP throttles incoming data so that if the input buffer - * is filled, the connection will halt until the - * application has read out the data from the input - * buffer. - * - */ -int tcp_socket_register(struct tcp_socket *s, void *ptr, - uint8_t *input_databuf, int input_databuf_len, - uint8_t *output_databuf, int output_databuf_len, - tcp_socket_data_callback_t data_callback, - tcp_socket_event_callback_t event_callback); - -/** - * \brief Connect a TCP socket to a remote host - * \param s A pointer to a TCP socket that must have been previously registered with tcp_socket_register() - * \param ipaddr The IP address of the remote host - * \param port The TCP port number, in host byte order, of the remote host - * \retval -1 If an error occurs - * \retval 1 If the operation succeeds. - * - * This function connects a TCP socket to a remote host. - * - * When the socket has connected, the event callback will - * get called with the TCP_SOCKET_CONNECTED event. If the - * remote host does not accept the connection, the - * TCP_SOCKET_ABORTED will be sent to the callback. If the - * connection times out before conecting to the remote - * host, the TCP_SOCKET_TIMEDOUT event is sent to the - * callback. - * - */ -int tcp_socket_connect(struct tcp_socket *s, - const uip_ipaddr_t *ipaddr, - uint16_t port); - -/** - * \brief Start listening on a specific port - * \param s A pointer to a TCP socket that must have been previously registered with tcp_socket_register() - * \param port The TCP port number, in host byte order, of the remote host - * \retval -1 If an error occurs - * \retval 1 If the operation succeeds. - * - * This function causes the TCP socket to start listening - * on the given TCP port. - * - * Several sockets can listen on the same port. If a - * remote host connects to the port, one of the listening - * sockets will get connected and the event callback will - * be called with the TCP_SOCKET_CONNECTED event. When the - * connection closes, the socket will go back to listening - * for new connections. - * - */ -int tcp_socket_listen(struct tcp_socket *s, - uint16_t port); - -/** - * \brief Stop listening for new connections - * \param s A pointer to a TCP socket that must have been previously registered with tcp_socket_register() - * \retval -1 If an error occurs - * \retval 1 If the operation succeeds. - * - * This function causes a listening TCP socket to stop - * listen. The socket must previously been put into listen - * mode with tcp_socket_listen(). - * - */ -int tcp_socket_unlisten(struct tcp_socket *s); - -/** - * \brief Send data on a connected TCP socket - * \param s A pointer to a TCP socket that must have been previously registered with tcp_socket_register() - * \param dataptr A pointer to the data to be sent - * \param datalen The length of the data to be sent - * \retval -1 If an error occurs - * \return The number of bytes that were successfully sent - * - * This function sends data over a connected TCP - * socket. The data is placed in the output buffer and - * sent to the remote host as soon as possiblce. When the - * data has been acknowledged by the remote host, the - * event callback is sent with the TCP_SOCKET_DATA_SENT - * event. - */ -int tcp_socket_send(struct tcp_socket *s, - const uint8_t *dataptr, - int datalen); - -/** - * \brief Send a string on a connected TCP socket - * \param s A pointer to a TCP socket that must have been previously registered with tcp_socket_register() - * \param strptr A pointer to the string to be sent - * \retval -1 If an error occurs - * \return The number of bytes that were successfully sent - * - * This is a convenience function for sending strings on a - * TCP socket. The function calls tcp_socket_send() to - * send the string. - */ -int tcp_socket_send_str(struct tcp_socket *s, - const char *strptr); - -/** - * \brief Close a connected TCP socket - * \param s A pointer to a TCP socket that must have been previously registered with tcp_socket_register() - * \retval -1 If an error occurs - * \retval 1 If the operation succeeds. - * - * This function closes a connected TCP socket. When the - * socket has been successfully closed, the event callback - * is called with the TCP_SOCKET_CLOSED event. - * - */ -int tcp_socket_close(struct tcp_socket *s); - -/** - * \brief Unregister a registered socket - * \param s A pointer to a TCP socket that must have been previously registered with tcp_socket_register() - * \retval -1 If an error occurs - * \retval 1 If the operation succeeds. - * - * This function unregisters a previously registered - * socket. This must be done if the process will be - * unloaded from memory. If the TCP socket is connected, - * the connection will be reset. - * - */ -int tcp_socket_unregister(struct tcp_socket *s); - -/** - * \brief The maximum amount of data that could currently be sent - * \param s A pointer to a TCP socket - * \return The number of bytes available in the output buffer - * - * This function queries the TCP socket and returns the - * number of bytes available in the output buffer. This - * function is used before calling tcp_socket_send() to - * ensure that one application level message can be held - * in the output buffer. - * - */ -int tcp_socket_max_sendlen(struct tcp_socket *s); - -/** - * \brief The number of bytes waiting to be sent - * \param s A pointer to a TCP socket - * \return The number of bytes that have not yet been acknowledged by the receiver. - * - * This function queries the TCP socket and returns the - * number of bytes that are currently not yet known to - * have been successfully received by the receiver. - * - */ -int tcp_socket_queuelen(struct tcp_socket *s); - -#endif /* TCP_SOCKET_H */ diff --git a/os/net/ipv6/tcpip.c b/os/net/ipv6/tcpip.c deleted file mode 100644 index 16176e6e2..000000000 --- a/os/net/ipv6/tcpip.c +++ /dev/null @@ -1,837 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Core of the TCP/IP stack, handles input/output/routing - * - * \author Adam Dunkels \author - * \author Mathilde Durvy (IPv6 related code) - * \author Julien Abeille (IPv6 related code) - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "net/ipv6/uip-packetqueue.h" - -#include "net/ipv6/uip-nd6.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/linkaddr.h" -#include "net/routing/routing.h" - -#include - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "TCP/IP" -#define LOG_LEVEL LOG_LEVEL_TCPIP - -#ifdef UIP_FALLBACK_INTERFACE -extern struct uip_fallback_interface UIP_FALLBACK_INTERFACE; -#endif - -process_event_t tcpip_event; -#if UIP_CONF_ICMP6 -process_event_t tcpip_icmp6_event; -#endif /* UIP_CONF_ICMP6 */ - -/* Periodic check of active connections. */ -static struct etimer periodic; - -#if UIP_CONF_IPV6_REASSEMBLY -/* Timer for reassembly. */ -extern struct etimer uip_reass_timer; -#endif - -#if UIP_TCP -/** - * \internal Structure for holding a TCP port and a process ID. - */ -struct listenport { - uint16_t port; - struct process *p; -}; - -static struct internal_state { - struct listenport listenports[UIP_LISTENPORTS]; - struct process *p; -} s; -#endif - -enum { - TCP_POLL, - UDP_POLL, - PACKET_INPUT -}; - -/*---------------------------------------------------------------------------*/ -static void -init_appstate(uip_tcp_appstate_t *as, void *state) -{ - as->p = PROCESS_CURRENT(); - as->state = state; -} -/*---------------------------------------------------------------------------*/ - -uint8_t -tcpip_output(const uip_lladdr_t *a) -{ - int ret; - - /* Tag Traffic Class if we are using TC for variable retrans */ -#if UIP_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS - if(uipbuf_get_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS) != - UIP_MAX_MAC_TRANSMISSIONS_UNDEFINED) { - LOG_INFO("Tagging TC with retrans: %d\n", uipbuf_get_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS)); - /* Encapsulate the MAC transmission limit in the Traffic Class field */ - UIP_IP_BUF->vtc = 0x60 | (UIP_TC_MAC_TRANSMISSION_COUNTER_BIT >> 4); - UIP_IP_BUF->tcflow = - uipbuf_get_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS) << 4; - } -#endif - - if(netstack_process_ip_callback(NETSTACK_IP_OUTPUT, (const linkaddr_t *)a) == - NETSTACK_IP_PROCESS) { - ret = NETSTACK_NETWORK.output((const linkaddr_t *) a); - return ret; - } else { - /* Ok, ignore and drop... */ - uipbuf_clear(); - return 0; - } -} - -PROCESS(tcpip_process, "TCP/IP stack"); - -/*---------------------------------------------------------------------------*/ -#if UIP_TCP -static void -start_periodic_tcp_timer(void) -{ - if(etimer_expired(&periodic)) { - etimer_restart(&periodic); - } -} -#endif /* UIP_TCP */ -/*---------------------------------------------------------------------------*/ -static void -check_for_tcp_syn(void) -{ -#if UIP_TCP - /* This is a hack that is needed to start the periodic TCP timer if - an incoming packet contains a SYN: since uIP does not inform the - application if a SYN arrives, we have no other way of starting - this timer. This function is called for every incoming IP packet - to check for such SYNs. */ -#define TCP_SYN 0x02 - if(UIP_IP_BUF->proto == UIP_PROTO_TCP && - (UIP_TCP_BUF->flags & TCP_SYN) == TCP_SYN) { - start_periodic_tcp_timer(); - } -#endif /* UIP_TCP */ -} -/*---------------------------------------------------------------------------*/ -static void -packet_input(void) -{ - if(uip_len > 0) { - LOG_INFO("input: received %u bytes\n", uip_len); - - check_for_tcp_syn(); - -#if UIP_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS - { - uint8_t traffic_class = (UIP_IP_BUF->vtc << 4) | (UIP_IP_BUF->tcflow >> 4); - if(traffic_class & UIP_TC_MAC_TRANSMISSION_COUNTER_BIT) { - uint8_t max_mac_transmissions = traffic_class & UIP_TC_MAC_TRANSMISSION_COUNTER_MASK; - uipbuf_set_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS, max_mac_transmissions); - LOG_INFO("Received packet tagged with TC retrans: %d (%x)", - max_mac_transmissions, traffic_class); - } - } -#endif /* UIP_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS */ - - uip_input(); - if(uip_len > 0) { - tcpip_ipv6_output(); - } - } -} -/*---------------------------------------------------------------------------*/ -#if UIP_TCP -#if UIP_ACTIVE_OPEN -struct uip_conn * -tcp_connect(const uip_ipaddr_t *ripaddr, uint16_t port, void *appstate) -{ - struct uip_conn *c; - - c = uip_connect(ripaddr, port); - if(c == NULL) { - return NULL; - } - - init_appstate(&c->appstate, appstate); - - tcpip_poll_tcp(c); - - return c; -} -#endif /* UIP_ACTIVE_OPEN */ -/*---------------------------------------------------------------------------*/ -void -tcp_unlisten(uint16_t port) -{ - unsigned char i; - struct listenport *l; - - l = s.listenports; - for(i = 0; i < UIP_LISTENPORTS; ++i) { - if(l->port == port && - l->p == PROCESS_CURRENT()) { - l->port = 0; - uip_unlisten(port); - break; - } - ++l; - } -} -/*---------------------------------------------------------------------------*/ -void -tcp_listen(uint16_t port) -{ - unsigned char i; - struct listenport *l; - - l = s.listenports; - for(i = 0; i < UIP_LISTENPORTS; ++i) { - if(l->port == 0) { - l->port = port; - l->p = PROCESS_CURRENT(); - uip_listen(port); - break; - } - ++l; - } -} -/*---------------------------------------------------------------------------*/ -void -tcp_attach(struct uip_conn *conn, void *appstate) -{ - init_appstate(&conn->appstate, appstate); -} -#endif /* UIP_TCP */ -/*---------------------------------------------------------------------------*/ -#if UIP_UDP -void -udp_attach(struct uip_udp_conn *conn, void *appstate) -{ - init_appstate(&conn->appstate, appstate); -} -/*---------------------------------------------------------------------------*/ -struct uip_udp_conn * -udp_new(const uip_ipaddr_t *ripaddr, uint16_t port, void *appstate) -{ - struct uip_udp_conn *c = uip_udp_new(ripaddr, port); - - if(c == NULL) { - return NULL; - } - - init_appstate(&c->appstate, appstate); - - return c; -} -/*---------------------------------------------------------------------------*/ -struct uip_udp_conn * -udp_broadcast_new(uint16_t port, void *appstate) -{ - uip_ipaddr_t addr; - struct uip_udp_conn *conn; - - uip_create_linklocal_allnodes_mcast(&addr); - - conn = udp_new(&addr, port, appstate); - if(conn != NULL) { - udp_bind(conn, port); - } - return conn; -} -#endif /* UIP_UDP */ -/*---------------------------------------------------------------------------*/ -#if UIP_CONF_ICMP6 -uint8_t -icmp6_new(void *appstate) { - if(uip_icmp6_conns.appstate.p == PROCESS_NONE) { - init_appstate(&uip_icmp6_conns.appstate, appstate); - return 0; - } - return 1; -} - -void -tcpip_icmp6_call(uint8_t type) -{ - if(uip_icmp6_conns.appstate.p != PROCESS_NONE) { - /* XXX: This is a hack that needs to be updated. Passing a pointer (&type) - like this only works with process_post_synch. */ - process_post_synch(uip_icmp6_conns.appstate.p, tcpip_icmp6_event, &type); - } - return; -} -#endif /* UIP_CONF_ICMP6 */ -/*---------------------------------------------------------------------------*/ -static void -eventhandler(process_event_t ev, process_data_t data) -{ -#if UIP_TCP - unsigned char i; - register struct listenport *l; -#endif /*UIP_TCP*/ - struct process *p; - - switch(ev) { - case PROCESS_EVENT_EXITED: - /* This is the event we get if a process has exited. We go through - the TCP/IP tables to see if this process had any open - connections or listening TCP ports. If so, we'll close those - connections. */ - - p = (struct process *)data; -#if UIP_TCP - l = s.listenports; - for(i = 0; i < UIP_LISTENPORTS; ++i) { - if(l->p == p) { - uip_unlisten(l->port); - l->port = 0; - l->p = PROCESS_NONE; - } - ++l; - } - - { - struct uip_conn *cptr; - - for(cptr = &uip_conns[0]; cptr < &uip_conns[UIP_TCP_CONNS]; ++cptr) { - if(cptr->appstate.p == p) { - cptr->appstate.p = PROCESS_NONE; - cptr->tcpstateflags = UIP_CLOSED; - } - } - } -#endif /* UIP_TCP */ -#if UIP_UDP - { - struct uip_udp_conn *cptr; - - for(cptr = &uip_udp_conns[0]; - cptr < &uip_udp_conns[UIP_UDP_CONNS]; ++cptr) { - if(cptr->appstate.p == p) { - cptr->lport = 0; - } - } - } -#endif /* UIP_UDP */ - break; - - case PROCESS_EVENT_TIMER: - /* We get this event if one of our timers have expired. */ - { - /* Check the clock so see if we should call the periodic uIP - processing. */ - if(data == &periodic && - etimer_expired(&periodic)) { -#if UIP_TCP - for(i = 0; i < UIP_TCP_CONNS; ++i) { - if(uip_conn_active(i)) { - /* Only restart the timer if there are active - connections. */ - etimer_restart(&periodic); - uip_periodic(i); - tcpip_ipv6_output(); - } - } -#endif /* UIP_TCP */ - } - -#if UIP_CONF_IPV6_REASSEMBLY - /* - * check the timer for reassembly - */ - if(data == &uip_reass_timer && - etimer_expired(&uip_reass_timer)) { - uip_reass_over(); - tcpip_ipv6_output(); - } -#endif /* UIP_CONF_IPV6_REASSEMBLY */ - /* - * check the different timers for neighbor discovery and - * stateless autoconfiguration - */ - /*if(data == &uip_ds6_timer_periodic && - etimer_expired(&uip_ds6_timer_periodic)) { - uip_ds6_periodic(); - tcpip_ipv6_output(); - }*/ -#if !UIP_CONF_ROUTER - if(data == &uip_ds6_timer_rs && - etimer_expired(&uip_ds6_timer_rs)) { - uip_ds6_send_rs(); - tcpip_ipv6_output(); - } -#endif /* !UIP_CONF_ROUTER */ - if(data == &uip_ds6_timer_periodic && - etimer_expired(&uip_ds6_timer_periodic)) { - uip_ds6_periodic(); - tcpip_ipv6_output(); - } - } - break; - -#if UIP_TCP - case TCP_POLL: - if(data != NULL) { - uip_poll_conn(data); - tcpip_ipv6_output(); - /* Start the periodic polling, if it isn't already active. */ - start_periodic_tcp_timer(); - } - break; -#endif /* UIP_TCP */ -#if UIP_UDP - case UDP_POLL: - if(data != NULL) { - uip_udp_periodic_conn(data); - tcpip_ipv6_output(); - } - break; -#endif /* UIP_UDP */ - - case PACKET_INPUT: - packet_input(); - break; - }; -} -/*---------------------------------------------------------------------------*/ -void -tcpip_input(void) -{ - if(netstack_process_ip_callback(NETSTACK_IP_INPUT, NULL) == - NETSTACK_IP_PROCESS) { - process_post_synch(&tcpip_process, PACKET_INPUT, NULL); - } /* else - do nothing and drop */ - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -static void -output_fallback(void) -{ -#ifdef UIP_FALLBACK_INTERFACE - LOG_INFO("fallback: removing ext hdrs & setting proto %d %d\n", - uip_ext_len, *((uint8_t *)UIP_IP_BUF + 40)); - uip_remove_ext_hdr(); - /* Inform the other end that the destination is not reachable. If it's - * not informed routes might get lost unexpectedly until there's a need - * to send a new packet to the peer */ - if(UIP_FALLBACK_INTERFACE.output() < 0) { - LOG_ERR("fallback: output error. Reporting DST UNREACH\n"); - uip_icmp6_error_output(ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR, 0); - uip_flags = 0; - tcpip_ipv6_output(); - return; - } -#else - LOG_ERR("output: destination off-link and no default route\n"); -#endif /* !UIP_FALLBACK_INTERFACE */ -} -/*---------------------------------------------------------------------------*/ -static void -annotate_transmission(const uip_ipaddr_t *nexthop) -{ -#if TCPIP_CONF_ANNOTATE_TRANSMISSIONS - static uint8_t annotate_last; - static uint8_t annotate_has_last = 0; - - if(annotate_has_last) { - printf("#L %u 0; red\n", annotate_last); - } - printf("#L %u 1; red\n", nexthop->u8[sizeof(uip_ipaddr_t) - 1]); - annotate_last = nexthop->u8[sizeof(uip_ipaddr_t) - 1]; - annotate_has_last = 1; -#endif /* TCPIP_CONF_ANNOTATE_TRANSMISSIONS */ -} -/*---------------------------------------------------------------------------*/ -static const uip_ipaddr_t* -get_nexthop(uip_ipaddr_t *addr) -{ - const uip_ipaddr_t *nexthop; - uip_ds6_route_t *route; - - LOG_INFO("output: processing %u bytes packet from ", uip_len); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - - if(NETSTACK_ROUTING.ext_header_srh_get_next_hop(addr)) { - LOG_INFO("output: selected next hop from SRH: "); - LOG_INFO_6ADDR(addr); - LOG_INFO_("\n"); - return addr; - } - - /* We first check if the destination address is on our immediate - link. If so, we simply use the destination address as our - nexthop address. */ - if(uip_ds6_is_addr_onlink(&UIP_IP_BUF->destipaddr)) { - LOG_INFO("output: destination is on link\n"); - return &UIP_IP_BUF->destipaddr; - } - - /* Check if we have a route to the destination address. */ - route = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr); - - /* No route was found - we send to the default route instead. */ - if(route == NULL) { - nexthop = uip_ds6_defrt_choose(); - if(nexthop == NULL) { - output_fallback(); - } else { - LOG_INFO("output: no route found, using default route: "); - LOG_INFO_6ADDR(nexthop); - LOG_INFO_("\n"); - } - - } else { - /* A route was found, so we look up the nexthop neighbor for - the route. */ - nexthop = uip_ds6_route_nexthop(route); - - /* If the nexthop is dead, for example because the neighbor - never responded to link-layer acks, we drop its route. */ - if(nexthop == NULL) { - LOG_ERR("output: found dead route\n"); - /* Notifiy the routing protocol that we are about to remove the route */ - NETSTACK_ROUTING.drop_route(route); - /* Remove the route */ - uip_ds6_route_rm(route); - /* We don't have a nexthop to send the packet to, so we drop it. */ - } else { - LOG_INFO("output: found next hop from routing table: "); - LOG_INFO_6ADDR(nexthop); - LOG_INFO_("\n"); - } - } - - return nexthop; -} -/*---------------------------------------------------------------------------*/ -#if UIP_ND6_SEND_NS -static int -queue_packet(uip_ds6_nbr_t *nbr) -{ - /* Copy outgoing pkt in the queuing buffer for later transmit. */ -#if UIP_CONF_IPV6_QUEUE_PKT - if(uip_packetqueue_alloc(&nbr->packethandle, UIP_DS6_NBR_PACKET_LIFETIME) != NULL) { - memcpy(uip_packetqueue_buf(&nbr->packethandle), UIP_IP_BUF, uip_len); - uip_packetqueue_set_buflen(&nbr->packethandle, uip_len); - return 0; - } -#endif - - return 1; -} -#endif -/*---------------------------------------------------------------------------*/ -static void -send_queued(uip_ds6_nbr_t *nbr) -{ -#if UIP_CONF_IPV6_QUEUE_PKT - /* - * Send the queued packets from here, may not be 100% perfect though. - * This happens in a few cases, for example when instead of receiving a - * NA after sendiong a NS, you receive a NS with SLLAO: the entry moves - * to STALE, and you must both send a NA and the queued packet. - */ - if(uip_packetqueue_buflen(&nbr->packethandle) != 0) { - uip_len = uip_packetqueue_buflen(&nbr->packethandle); - memcpy(UIP_IP_BUF, uip_packetqueue_buf(&nbr->packethandle), uip_len); - uip_packetqueue_free(&nbr->packethandle); - tcpip_output(uip_ds6_nbr_get_ll(nbr)); - } -#endif /*UIP_CONF_IPV6_QUEUE_PKT*/ -} -/*---------------------------------------------------------------------------*/ -static int -send_nd6_ns(const uip_ipaddr_t *nexthop) -{ - int err = 1; - -#if UIP_ND6_SEND_NS - uip_ds6_nbr_t *nbr = NULL; - if((nbr = uip_ds6_nbr_add(nexthop, NULL, 0, NBR_INCOMPLETE, NBR_TABLE_REASON_IPV6_ND, NULL)) != NULL) { - err = 0; - - queue_packet(nbr); - /* RFC4861, 7.2.2: - * "If the source address of the packet prompting the solicitation is the - * same as one of the addresses assigned to the outgoing interface, that - * address SHOULD be placed in the IP Source Address of the outgoing - * solicitation. Otherwise, any one of the addresses assigned to the - * interface should be used."*/ - if(uip_ds6_is_my_addr(&UIP_IP_BUF->srcipaddr)){ - uip_nd6_ns_output(&UIP_IP_BUF->srcipaddr, NULL, &nbr->ipaddr); - } else { - uip_nd6_ns_output(NULL, NULL, &nbr->ipaddr); - } - - stimer_set(&nbr->sendns, uip_ds6_if.retrans_timer / 1000); - nbr->nscount = 1; - /* Send the first NS try from here (multicast destination IP address). */ - } -#else - LOG_ERR("output: neighbor not in cache: "); - LOG_ERR_6ADDR(nexthop); - LOG_ERR_("\n"); -#endif - - return err; -} -/*---------------------------------------------------------------------------*/ -void -tcpip_ipv6_output(void) -{ - uip_ipaddr_t ipaddr; - uip_ds6_nbr_t *nbr = NULL; - const uip_lladdr_t *linkaddr; - const uip_ipaddr_t *nexthop; - - if(uip_len == 0) { - return; - } - - if(uip_len > UIP_LINK_MTU) { - LOG_ERR("output: Packet too big"); - goto exit; - } - - if(uip_is_addr_unspecified(&UIP_IP_BUF->destipaddr)){ - LOG_ERR("output: Destination address unspecified"); - goto exit; - } - - - if(!NETSTACK_ROUTING.ext_header_update()) { - /* Packet can not be forwarded */ - LOG_ERR("output: routing protocol extension header update error\n"); - uipbuf_clear(); - return; - } - - if(uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) { - linkaddr = NULL; - goto send_packet; - } - - /* We first check if the destination address is one of ours. There is no - * loopback interface -- instead, process this directly as incoming. */ - if(uip_ds6_is_my_addr(&UIP_IP_BUF->destipaddr)) { - LOG_INFO("output: sending to ourself\n"); - packet_input(); - return; - } - - /* Look for a next hop */ - if((nexthop = get_nexthop(&ipaddr)) == NULL) { - goto exit; - } - annotate_transmission(nexthop); - - nbr = uip_ds6_nbr_lookup(nexthop); - -#if UIP_ND6_AUTOFILL_NBR_CACHE - if(nbr == NULL) { - /* Neighbor not found in cache? Derive its link-layer address from it's - link-local IPv6, assuming it used autoconfiguration. This is not - standard-compliant but this is a convenient way to keep the - neighbor cache out of the way in cases ND is not used */ - uip_lladdr_t lladdr; - uip_ds6_set_lladdr_from_iid(&lladdr, nexthop); - if((nbr = uip_ds6_nbr_add(nexthop, &lladdr, - 0, NBR_REACHABLE, NBR_TABLE_REASON_IPV6_ND_AUTOFILL, NULL)) == NULL) { - LOG_ERR("output: failed to autofill neighbor cache for host "); - LOG_ERR_6ADDR(nexthop); - LOG_ERR_(", link-layer addr "); - LOG_ERR_LLADDR((linkaddr_t*)&lladdr); - LOG_ERR_("\n"); - goto exit; - } - } -#endif /* UIP_ND6_AUTOFILL_NBR_CACHE */ - - if(nbr == NULL) { - if(send_nd6_ns(nexthop)) { - LOG_ERR("output: failed to add neighbor to cache\n"); - goto exit; - } else { - /* We're sending NS here instead of original packet */ - goto send_packet; - } - } - -#if UIP_ND6_SEND_NS - if(nbr->state == NBR_INCOMPLETE) { - LOG_ERR("output: nbr cache entry incomplete\n"); - queue_packet(nbr); - goto exit; - } - /* Send in parallel if we are running NUD (nbc state is either STALE, - DELAY, or PROBE). See RFC 4861, section 7.3.3 on node behavior. */ - if(nbr->state == NBR_STALE) { - nbr->state = NBR_DELAY; - stimer_set(&nbr->reachable, UIP_ND6_DELAY_FIRST_PROBE_TIME); - nbr->nscount = 0; - LOG_INFO("output: nbr cache entry stale moving to delay\n"); - } -#endif /* UIP_ND6_SEND_NS */ - -send_packet: - if(nbr) { - linkaddr = uip_ds6_nbr_get_ll(nbr); - } else { - linkaddr = NULL; - } - - LOG_INFO("output: sending to "); - LOG_INFO_LLADDR((linkaddr_t *)linkaddr); - LOG_INFO_("\n"); - tcpip_output(linkaddr); - - if(nbr) { - send_queued(nbr); - } - -exit: - uipbuf_clear(); - return; -} -/*---------------------------------------------------------------------------*/ -#if UIP_UDP -void -tcpip_poll_udp(struct uip_udp_conn *conn) -{ - process_post(&tcpip_process, UDP_POLL, conn); -} -#endif /* UIP_UDP */ -/*---------------------------------------------------------------------------*/ -#if UIP_TCP -void -tcpip_poll_tcp(struct uip_conn *conn) -{ - process_post(&tcpip_process, TCP_POLL, conn); -} -#endif /* UIP_TCP */ -/*---------------------------------------------------------------------------*/ -void -tcpip_uipcall(void) -{ - uip_udp_appstate_t *ts; - -#if UIP_UDP - if(uip_conn != NULL) { - ts = &uip_conn->appstate; - } else { - ts = &uip_udp_conn->appstate; - } -#else /* UIP_UDP */ - ts = &uip_conn->appstate; -#endif /* UIP_UDP */ - -#if UIP_TCP - { - unsigned char i; - struct listenport *l; - - /* If this is a connection request for a listening port, we must - mark the connection with the right process ID. */ - if(uip_connected()) { - l = &s.listenports[0]; - for(i = 0; i < UIP_LISTENPORTS; ++i) { - if(l->port == uip_conn->lport && - l->p != PROCESS_NONE) { - ts->p = l->p; - ts->state = NULL; - break; - } - ++l; - } - - /* Start the periodic polling, if it isn't already active. */ - start_periodic_tcp_timer(); - } - } -#endif /* UIP_TCP */ - - if(ts->p != NULL) { - process_post_synch(ts->p, tcpip_event, ts->state); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tcpip_process, ev, data) -{ - PROCESS_BEGIN(); - -#if UIP_TCP - memset(s.listenports, 0, UIP_LISTENPORTS*sizeof(*(s.listenports))); - s.p = PROCESS_CURRENT(); -#endif - - tcpip_event = process_alloc_event(); -#if UIP_CONF_ICMP6 - tcpip_icmp6_event = process_alloc_event(); -#endif /* UIP_CONF_ICMP6 */ - etimer_set(&periodic, CLOCK_SECOND / 2); - - uip_init(); -#ifdef UIP_FALLBACK_INTERFACE - UIP_FALLBACK_INTERFACE.init(); -#endif - /* Initialize routing protocol */ - NETSTACK_ROUTING.init(); - - while(1) { - PROCESS_YIELD(); - eventhandler(ev, data); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/ipv6/tcpip.h b/os/net/ipv6/tcpip.h deleted file mode 100644 index 8f84cedb3..000000000 --- a/os/net/ipv6/tcpip.h +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \file - * Header for the Contiki/uIP interface. - * \author Adam Dunkels - * \author Mathilde Durvy (IPv6 related code) - * \author Julien Abeille (IPv6 related code) - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \defgroup tcpip The Contiki/uIP interface - * @{ - * - * TCP/IP support in Contiki is implemented using the uIP TCP/IP - * stack. For sending and receiving data, Contiki uses the functions - * provided by the uIP module, but Contiki adds a set of functions for - * connection management. The connection management functions make - * sure that the uIP TCP/IP connections are connected to the correct - * process. - * - * Contiki also includes an optional protosocket library that provides - * an API similar to the BSD socket API. - * - * \sa \ref uip "The uIP TCP/IP stack" - * \sa \ref psock "Protosockets library" - * - */ - -#ifndef TCPIP_H_ -#define TCPIP_H_ - -#include "contiki.h" - -struct uip_conn; - -struct tcpip_uipstate { - struct process *p; - void *state; -}; - -#define UIP_APPCALL tcpip_uipcall -#define UIP_UDP_APPCALL tcpip_uipcall -#define UIP_ICMP6_APPCALL tcpip_icmp6_call - -/*#define UIP_APPSTATE_SIZE sizeof(struct tcpip_uipstate)*/ - -typedef struct tcpip_uipstate uip_udp_appstate_t; -typedef struct tcpip_uipstate uip_tcp_appstate_t; -typedef struct tcpip_uipstate uip_icmp6_appstate_t; -#include "net/ipv6/uip.h" -void tcpip_uipcall(void); - -/** - * \name TCP functions - * @{ - */ - -/** - * Attach a TCP connection to the current process - * - * This function attaches the current process to a TCP - * connection. Each TCP connection must be attached to a process in - * order for the process to be able to receive and send - * data. Additionally, this function can add a pointer with connection - * state to the connection. - * - * \param conn A pointer to the TCP connection. - * - * \param appstate An opaque pointer that will be passed to the - * process whenever an event occurs on the connection. - * - */ -void tcp_attach(struct uip_conn *conn, void *appstate); -#define tcp_markconn(conn, appstate) tcp_attach(conn, appstate) - -/** - * Open a TCP port. - * - * This function opens a TCP port for listening. When a TCP connection - * request occurs for the port, the process will be sent a tcpip_event - * with the new connection request. - * - * \note Port numbers must always be given in network byte order. The - * functions UIP_HTONS() and uip_htons() can be used to convert port numbers - * from host byte order to network byte order. - * - * \param port The port number in network byte order. - * - */ -void tcp_listen(uint16_t port); - -/** - * Close a listening TCP port. - * - * This function closes a listening TCP port. - * - * \note Port numbers must always be given in network byte order. The - * functions UIP_HTONS() and uip_htons() can be used to convert port numbers - * from host byte order to network byte order. - * - * \param port The port number in network byte order. - * - */ -void tcp_unlisten(uint16_t port); - -/** - * Open a TCP connection to the specified IP address and port. - * - * This function opens a TCP connection to the specified port at the - * host specified with an IP address. Additionally, an opaque pointer - * can be attached to the connection. This pointer will be sent - * together with uIP events to the process. - * - * \note The port number must be provided in network byte order so a - * conversion with UIP_HTONS() usually is necessary. - * - * \note This function will only create the connection. The connection - * is not opened directly. uIP will try to open the connection the - * next time the uIP stack is scheduled by Contiki. - * - * \param ripaddr Pointer to the IP address of the remote host. - * \param port Port number in network byte order. - * \param appstate Pointer to application defined data. - * - * \return A pointer to the newly created connection, or NULL if - * memory could not be allocated for the connection. - * - */ -struct uip_conn *tcp_connect(const uip_ipaddr_t *ripaddr, uint16_t port, - void *appstate); - -/** - * Cause a specified TCP connection to be polled. - * - * This function causes uIP to poll the specified TCP connection. The - * function is used when the application has data that is to be sent - * immediately and do not wish to wait for the periodic uIP polling - * mechanism. - * - * \param conn A pointer to the TCP connection that should be polled. - * - */ -void tcpip_poll_tcp(struct uip_conn *conn); - -/** @} */ - -/** - * \name UDP functions - * @{ - */ - -struct uip_udp_conn; -/** - * Attach the current process to a UDP connection - * - * This function attaches the current process to a UDP - * connection. Each UDP connection must have a process attached to it - * in order for the process to be able to receive and send data over - * the connection. Additionally, this function can add a pointer with - * connection state to the connection. - * - * \param conn A pointer to the UDP connection. - * - * \param appstate An opaque pointer that will be passed to the - * process whenever an event occurs on the connection. - * - */ -void udp_attach(struct uip_udp_conn *conn, - void *appstate); -#define udp_markconn(conn, appstate) udp_attach(conn, appstate) - -/** - * Create a new UDP connection. - * - * This function creates a new UDP connection with the specified - * remote endpoint. - * - * \note The port number must be provided in network byte order so a - * conversion with UIP_HTONS() usually is necessary. - * - * \sa udp_bind() - * - * \param ripaddr Pointer to the IP address of the remote host. - * \param port Port number in network byte order. - * \param appstate Pointer to application defined data. - * - * \return A pointer to the newly created connection, or NULL if - * memory could not be allocated for the connection. - */ -struct uip_udp_conn *udp_new(const uip_ipaddr_t *ripaddr, uint16_t port, - void *appstate); - -/** - * Create a new UDP broadcast connection. - * - * This function creates a new (link-local) broadcast UDP connection - * to a specified port. - * - * \param port Port number in network byte order. - * \param appstate Pointer to application defined data. - * - * \return A pointer to the newly created connection, or NULL if - * memory could not be allocated for the connection. - */ -struct uip_udp_conn *udp_broadcast_new(uint16_t port, void *appstate); - -/** - * Bind a UDP connection to a local port. - * - * This function binds a UDP connection to a specified local port. - * - * When a connection is created with udp_new(), it gets a local port - * number assigned automatically. If the application needs to bind the - * connection to a specified local port, this function should be used. - * - * \note The port number must be provided in network byte order so a - * conversion with UIP_HTONS() usually is necessary. - * - * \param conn A pointer to the UDP connection that is to be bound. - * \param port The port number in network byte order to which to bind - * the connection. - */ -#define udp_bind(conn, port) uip_udp_bind(conn, port) - -/** - * Cause a specified UDP connection to be polled. - * - * This function causes uIP to poll the specified UDP connection. The - * function is used when the application has data that is to be sent - * immediately and do not wish to wait for the periodic uIP polling - * mechanism. - * - * \param conn A pointer to the UDP connection that should be polled. - * - */ -void tcpip_poll_udp(struct uip_udp_conn *conn); - -/** @} */ - -/** - * \name ICMPv6 functions - * @{ - */ - -#if UIP_CONF_ICMP6 - -/** - * The ICMP6 event. - * - * This event is posted to a process whenever a uIP ICMP event has occurred. - */ -extern process_event_t tcpip_icmp6_event; - -/** - * \brief register an ICMPv6 callback - * \return 0 if success, 1 if failure (one application already registered) - * - * This function just registers a process to be polled when - * an ICMPv6 message is received. - * If no application registers, some ICMPv6 packets will be - * processed by the "kernel" as usual (NS, NA, RS, RA, Echo request), - * others will be dropped. - * If an application registers here, it will be polled with a - * process_post_synch every time an ICMPv6 packet is received. - */ -uint8_t icmp6_new(void *appstate); - -/** - * This function is called at reception of an ICMPv6 packet - * If an application registered as an ICMPv6 listener (with - * icmp6_new), it will be called through a process_post_synch() - */ -void tcpip_icmp6_call(uint8_t type); -#endif /*UIP_CONF_ICMP6*/ - -/** @} */ -/** - * The uIP event. - * - * This event is posted to a process whenever a uIP event has occurred. - */ -extern process_event_t tcpip_event; - - -/** - * \name TCP/IP packet processing - * @{ - */ - -/** - * \brief Deliver an incoming packet to the TCP/IP stack - * - * This function is called by network device drivers to - * deliver an incoming packet to the TCP/IP stack. The - * incoming packet must be present in the uip_buf buffer, - * and the length of the packet must be in the global - * uip_len variable. - */ -void tcpip_input(void); - -/** - * \brief Output packet to layer 2 - * The eventual parameter is the MAC address of the destination. - */ -uint8_t tcpip_output(const uip_lladdr_t *); - -/** - * \brief This function does address resolution and then calls tcpip_output - */ -void tcpip_ipv6_output(void); - -/** - * \brief Is forwarding generally enabled? - */ -extern unsigned char tcpip_do_forwarding; - -/* - * Are we at the moment forwarding the contents of uip_buf[]? - */ -extern unsigned char tcpip_is_forwarding; - - -#define tcpip_set_forwarding(forwarding) tcpip_do_forwarding = (forwarding) - -/** @} */ - -PROCESS_NAME(tcpip_process); - -#endif /* TCPIP_H_ */ - -/** @} */ -/** @} */ diff --git a/os/net/ipv6/udp-socket.c b/os/net/ipv6/udp-socket.c deleted file mode 100644 index f104a6b6c..000000000 --- a/os/net/ipv6/udp-socket.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2012-2014, Thingsquare, http://www.thingsquare.com/. - * 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 "contiki-net.h" -#include "udp-socket.h" - -#include - -PROCESS(udp_socket_process, "UDP socket process"); - -static uint8_t buf[UIP_BUFSIZE]; - -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - static uint8_t inited = 0; - if(!inited) { - inited = 1; - process_start(&udp_socket_process, NULL); - } -} -/*---------------------------------------------------------------------------*/ -int -udp_socket_register(struct udp_socket *c, - void *ptr, - udp_socket_input_callback_t input_callback) -{ - init(); - - if(c == NULL) { - return -1; - } - c->ptr = ptr; - c->input_callback = input_callback; - - c->p = PROCESS_CURRENT(); - PROCESS_CONTEXT_BEGIN(&udp_socket_process); - c->udp_conn = udp_new(NULL, 0, c); - PROCESS_CONTEXT_END(); - - if(c->udp_conn == NULL) { - return -1; - } - return 1; -} -/*---------------------------------------------------------------------------*/ -int -udp_socket_close(struct udp_socket *c) -{ - if(c == NULL) { - return -1; - } - if(c->udp_conn != NULL) { - uip_udp_remove(c->udp_conn); - return 1; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -int -udp_socket_bind(struct udp_socket *c, - uint16_t local_port) -{ - if(c == NULL || c->udp_conn == NULL) { - return -1; - } - udp_bind(c->udp_conn, UIP_HTONS(local_port)); - - return 1; -} -/*---------------------------------------------------------------------------*/ -int -udp_socket_connect(struct udp_socket *c, - uip_ipaddr_t *remote_addr, - uint16_t remote_port) -{ - if(c == NULL || c->udp_conn == NULL) { - return -1; - } - - if(remote_addr != NULL) { - uip_ipaddr_copy(&c->udp_conn->ripaddr, remote_addr); - } - c->udp_conn->rport = UIP_HTONS(remote_port); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -udp_socket_send(struct udp_socket *c, - const void *data, uint16_t datalen) -{ - if(c == NULL || c->udp_conn == NULL) { - return -1; - } - - uip_udp_packet_send(c->udp_conn, data, datalen); - return datalen; -} -/*---------------------------------------------------------------------------*/ -int -udp_socket_sendto(struct udp_socket *c, - const void *data, uint16_t datalen, - const uip_ipaddr_t *to, - uint16_t port) -{ - if(c == NULL || c->udp_conn == NULL) { - return -1; - } - - if(c->udp_conn != NULL) { - uip_udp_packet_sendto(c->udp_conn, data, datalen, - to, UIP_HTONS(port)); - return datalen; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(udp_socket_process, ev, data) -{ - struct udp_socket *c; - PROCESS_BEGIN(); - - while(1) { - PROCESS_WAIT_EVENT(); - if(ev == tcpip_event) { - - /* An appstate pointer is passed to use from the IP stack - through the 'data' pointer. We registered this appstate when - we did the udp_new() call in udp_socket_register() as the - struct udp_socket pointer. So we extract this - pointer and use it when calling the reception callback. */ - c = (struct udp_socket *)data; - - /* Defensive coding: although the appstate *should* be non-null - here, we make sure to avoid the program crashing on us. */ - if(c != NULL) { - - /* If we were called because of incoming data, we should call - the reception callback. */ - if(uip_newdata()) { - /* Copy the data from the uIP data buffer into our own - buffer to avoid the uIP buffer being messed with by the - callee. */ - memcpy(buf, uip_appdata, uip_datalen()); - - /* Call the client process. We use the PROCESS_CONTEXT - mechanism to temporarily switch process context to the - client process. */ - if(c->input_callback != NULL) { - PROCESS_CONTEXT_BEGIN(c->p); - c->input_callback(c, c->ptr, - &(UIP_IP_BUF->srcipaddr), - UIP_HTONS(UIP_UDP_BUF->srcport), - &(UIP_IP_BUF->destipaddr), - UIP_HTONS(UIP_UDP_BUF->destport), - buf, uip_datalen()); - PROCESS_CONTEXT_END(); - } - } - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/udp-socket.h b/os/net/ipv6/udp-socket.h deleted file mode 100644 index d447a4508..000000000 --- a/os/net/ipv6/udp-socket.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2012-2014, Thingsquare, http://www.thingsquare.com/. - * 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 UDP_SOCKET_H -#define UDP_SOCKET_H - -#include "net/ipv6/uip.h" - -struct udp_socket; - -/** - * \brief A UDP socket callback function - * \param c A pointer to the struct udp_socket that received the data - * \param ptr An opaque pointer that was specified when the UDP socket was registered with udp_socket_register() - * \param source_addr The IP address from which the datagram was sent - * \param source_port The UDP port number, in host byte order, from which the datagram was sent - * \param dest_addr The IP address that this datagram was sent to - * \param dest_port The UDP port number, in host byte order, that the datagram was sent to - * \param data A pointer to the data contents of the UDP datagram - * \param datalen The length of the data being pointed to by the data pointer - * - * Each UDP socket has a callback function that is - * registered as part of the call to - * udp_socket_register(). The callback function gets - * called every time a UDP packet is received. - */ -typedef void (* udp_socket_input_callback_t)(struct udp_socket *c, - void *ptr, - const uip_ipaddr_t *source_addr, - uint16_t source_port, - const uip_ipaddr_t *dest_addr, - uint16_t dest_port, - const uint8_t *data, - uint16_t datalen); - -struct udp_socket { - udp_socket_input_callback_t input_callback; - void *ptr; - - struct process *p; - - struct uip_udp_conn *udp_conn; - -}; - -/** - * \brief Register a UDP socket - * \param c A pointer to the struct udp_socket that should be registered - * \param ptr An opaque pointer that will be passed to callbacks - * \param receive_callback A function pointer to the callback function that will be called when data arrives - * \retval -1 The registration failed - * \retval 1 The registration succeeded - * - * This function registers the UDP socket with the - * system. A UDP socket must be registered before any data - * can be sent or received over the socket. - * - * The caller must allocate memory for the struct - * udp_socket that is to be registered. - * - * A UDP socket can begin to receive data by calling - * udp_socket_bind(). - * - */ -int udp_socket_register(struct udp_socket *c, - void *ptr, - udp_socket_input_callback_t receive_callback); - -/** - * \brief Bind a UDP socket to a local port - * \param c A pointer to the struct udp_socket that should be bound to a local port - * \param local_port The UDP port number, in host byte order, to bind the UDP socket to - * \retval -1 Binding the UDP socket to the local port failed - * \retval 1 Binding the UDP socket to the local port succeeded - * - * This function binds the UDP socket to a local port so - * that it will begin to receive data that arrives on the - * specified port. A UDP socket will receive data - * addressed to the specified port number on any IP - * address of the host. - * - * A UDP socket that is bound to a local port will use - * this port number as a source port in outgoing UDP - * messages. - * - */ -int udp_socket_bind(struct udp_socket *c, - uint16_t local_port); - -/** - * \brief Bind a UDP socket to a remote address and port - * \param c A pointer to the struct udp_socket that should be connected - * \param remote_addr The IP address of the remote host, or NULL if the UDP socket should only be connected to a specific port - * \param remote_port The UDP port number, in host byte order, to which the UDP socket should be connected - * \retval -1 Connecting the UDP socket failed - * \retval 1 Connecting the UDP socket succeeded - * - * This function connects the UDP socket to a specific - * remote port and optional remote IP address. When a UDP - * socket is connected to a remote port and address, it - * will only receive packets that are sent from the remote - * port and address. When sending data over a connected - * UDP socket, the data will be sent to the connected - * remote address. - * - * A UDP socket can be connected to a remote port, but not - * a remote IP address, by providing a NULL parameter as - * the remote_addr parameter. This lets the UDP socket - * receive data from any IP address on the specified port. - * - */ -int udp_socket_connect(struct udp_socket *c, - uip_ipaddr_t *remote_addr, - uint16_t remote_port); -/** - * \brief Send data on a UDP socket - * \param c A pointer to the struct udp_socket on which the data should be sent - * \param data A pointer to the data that should be sent - * \param datalen The length of the data to be sent - * \return The number of bytes sent, or -1 if an error occurred - * - * This function sends data over a UDP socket. The UDP - * socket must have been connected to a remote address and - * port with udp_socket_connect(). - * - */ -int udp_socket_send(struct udp_socket *c, - const void *data, uint16_t datalen); - -/** - * \brief Send data on a UDP socket to a specific address and port - * \param c A pointer to the struct udp_socket on which the data should be sent - * \param data A pointer to the data that should be sent - * \param datalen The length of the data to be sent - * \param addr The IP address to which the data should be sent - * \param port The UDP port number, in host byte order, to which the data should be sent - * \return The number of bytes sent, or -1 if an error occurred - * - * This function sends data over a UDP socket to a - * specific address and port. - * - * The UDP socket does not have to be connected to use - * this function. - * - */ -int udp_socket_sendto(struct udp_socket *c, - const void *data, uint16_t datalen, - const uip_ipaddr_t *addr, uint16_t port); - -/** - * \brief Close a UDP socket - * \param c A pointer to the struct udp_socket to be closed - * \retval -1 If closing the UDP socket failed - * \retval 1 If closing the UDP socket succeeded - * - * This function closes a UDP socket that has previously - * been registered with udp_socket_register(). All - * registered UDP sockets must be closed before exiting - * the process that registered them, or undefined behavior - * may occur. - * - */ -int udp_socket_close(struct udp_socket *c); - -#endif /* UDP_SOCKET_H */ diff --git a/os/net/ipv6/uip-arch.h b/os/net/ipv6/uip-arch.h deleted file mode 100644 index 11fcf4e6c..000000000 --- a/os/net/ipv6/uip-arch.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * - */ - -/** - * \file - * Declarations of architecture specific functions. - * \author Adam Dunkels - */ - -/** - * \addtogroup uip - * {@ - */ - -/** - * \defgroup uiparch Architecture specific uIP functions - * @{ - * - * The functions in the architecture specific module implement the IP - * check sum and 32-bit additions. - * - * The IP checksum calculation is the most computationally expensive - * operation in the TCP/IP stack and it therefore pays off to - * implement this in efficient assembler. The purpose of the uip-arch - * module is to let the checksum functions to be implemented in - * architecture specific assembler. - * - */ - -#ifndef UIP_ARCH_H_ -#define UIP_ARCH_H_ - -#include "net/ipv6/uip.h" - -/** - * Carry out a 32-bit addition. - * - * Because not all architectures for which uIP is intended has native - * 32-bit arithmetic, uIP uses an external C function for doing the - * required 32-bit additions in the TCP protocol processing. This - * function should add the two arguments and place the result in the - * global variable uip_acc32. - * - * \note The 32-bit integer pointed to by the op32 parameter and the - * result in the uip_acc32 variable are in network byte order (big - * endian). - * - * \param op32 A pointer to a 4-byte array representing a 32-bit - * integer in network byte order (big endian). - * - * \param op16 A 16-bit integer in host byte order. - */ -void uip_add32(uint8_t *op32, uint16_t op16); - -/** - * Calculate the Internet checksum over a buffer. - * - * The Internet checksum is the one's complement of the one's - * complement sum of all 16-bit words in the buffer. - * - * See RFC1071. - * - * \note This function is not called in the current version of uIP, - * but future versions might make use of it. - * - * \param data A pointer to the buffer over which the checksum is to be - * computed. - * - * \param len The length of the buffer over which the checksum is to - * be computed. - * - * \return The Internet checksum of the buffer. - */ -uint16_t uip_chksum(uint16_t *data, uint16_t len); - -/** - * Calculate the IP header checksum of the packet header in uip_buf. - * - * The IP header checksum is the Internet checksum of the 20 bytes of - * the IP header. - * - * \return The IP header checksum of the IP header in the uip_buf - * buffer. - */ -uint16_t uip_ipchksum(void); - -/** - * Calculate the TCP checksum of the packet in uip_buf and uip_appdata. - * - * The TCP checksum is the Internet checksum of data contents of the - * TCP segment, and a pseudo-header as defined in RFC793. - * - * \return The TCP checksum of the TCP segment in uip_buf and pointed - * to by uip_appdata. - */ -uint16_t uip_tcpchksum(void); - -uint16_t uip_udpchksum(void); - -/** @} */ -/** @} */ - -#endif /* UIP_ARCH_H_ */ diff --git a/os/net/ipv6/uip-debug.h b/os/net/ipv6/uip-debug.h deleted file mode 100644 index 6ebbf0aaa..000000000 --- a/os/net/ipv6/uip-debug.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * A set of debugging macros for the IP stack - * - * \author Nicolas Tsiftes - * Niclas Finne - * Joakim Eriksson - * Simon Duquennoy - */ - -#ifndef UIP_DEBUG_H -#define UIP_DEBUG_H - -#include "net/net-debug.h" -#include "net/ipv6/uiplib.h" - -static inline void -uip_debug_ipaddr_print(const uip_ipaddr_t *addr) -{ - uiplib_ipaddr_print(addr); -} - -#if (DEBUG) & DEBUG_PRINT -#define PRINT6ADDR(addr) uiplib_ipaddr_print(addr) -#else -#define PRINT6ADDR(addr) -#endif /* (DEBUG) & DEBUG_PRINT */ - -#endif /* UIP_DEBUG_H */ diff --git a/os/net/ipv6/uip-ds6-nbr.c b/os/net/ipv6/uip-ds6-nbr.c deleted file mode 100644 index b8f8b63d7..000000000 --- a/os/net/ipv6/uip-ds6-nbr.c +++ /dev/null @@ -1,691 +0,0 @@ -/* - * Copyright (c) 2013, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * IPv6 Neighbor cache (link-layer/IPv6 address mapping) - * \author Mathilde Durvy - * \author Julien Abeille - * \author Simon Duquennoy - * - */ - -#include -#include -#include -#include "lib/list.h" -#include "net/link-stats.h" -#include "net/linkaddr.h" -#include "net/packetbuf.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/ipv6/uip-nd6.h" -#include "net/routing/routing.h" - -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS -#include "lib/memb.h" -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "IPv6 Nbr" -#define LOG_LEVEL LOG_LEVEL_IPV6 - -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS -/** - * Add nbr to the list in nbr_entry. In other words, this function associates an - * IPv6 address in nbr with a link-layer address in nbr_entry. - * \param nbr the neighbor cache entry for an IPv6 address - * \param nbr_entry the nbr_table entry for an link-layer address - */ -static void add_uip_ds6_nbr_to_nbr_entry(uip_ds6_nbr_t *nbr, - uip_ds6_nbr_entry_t *nbr_entry); - -/** - * Remove nbr from the list of the corresponding nbr_entry - * \param nbr a neighbor cache entry (nbr) to be removed - */ -static void remove_uip_ds6_nbr_from_nbr_entry(uip_ds6_nbr_t *nbr); - -/** - * Remove nbr_etnry from nbr_table - * \param nbr_entry a nbr_table entry (nbr_entry) to be removed - */ -static void remove_nbr_entry(uip_ds6_nbr_entry_t *nbr_entry); - -/** - * Free memory for a specified neighbor cache entry - * \param nbr a neighbor cache entry to be freed - */ -static void free_uip_ds6_nbr(uip_ds6_nbr_t *nbr); - -/** - * Callback function called when a nbr_table entry is removed - * \param nbr_entry a nbr_entry to be removed - */ -static void callback_nbr_entry_removal(uip_ds6_nbr_entry_t *nbr_entry); - -NBR_TABLE(uip_ds6_nbr_entry_t, uip_ds6_nbr_entries); -MEMB(uip_ds6_nbr_memb, uip_ds6_nbr_t, UIP_DS6_NBR_MAX_NEIGHBOR_CACHES); -#else -NBR_TABLE(uip_ds6_nbr_t, ds6_neighbors); -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_neighbors_init(void) -{ - link_stats_init(); -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - memb_init(&uip_ds6_nbr_memb); - nbr_table_register(uip_ds6_nbr_entries, - (nbr_table_callback *)callback_nbr_entry_removal); -#else - nbr_table_register(ds6_neighbors, (nbr_table_callback *)uip_ds6_nbr_rm); -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ -} -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr, const uip_lladdr_t *lladdr, - uint8_t isrouter, uint8_t state, nbr_table_reason_t reason, - void *data) -{ - uip_ds6_nbr_t *nbr; - -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - uip_ds6_nbr_entry_t *nbr_entry; - - assert(uip_ds6_nbr_lookup(ipaddr) == NULL); - if(uip_ds6_nbr_lookup(ipaddr)) { - LOG_ERR("%s: uip_ds6_nbr for ", __func__); - LOG_ERR_6ADDR(ipaddr); - LOG_ERR_("has already existed\n"); - return NULL; - } - - /* firstly, allocate memory for a new nbr cache entry */ - if((nbr = (uip_ds6_nbr_t *)memb_alloc(&uip_ds6_nbr_memb)) == NULL) { - LOG_ERR("%s: cannot allocate a new uip_ds6_nbr\n", __func__); - return NULL; - } - - /* secondly, get or allocate nbr_entry for the link-layer address */ - nbr_entry = nbr_table_get_from_lladdr(uip_ds6_nbr_entries, - (const linkaddr_t *)lladdr); - if(nbr_entry == NULL) { - if((nbr_entry = - nbr_table_add_lladdr(uip_ds6_nbr_entries, - (linkaddr_t*)lladdr, reason, data)) == NULL) { - LOG_ERR("%s: cannot allocate a new uip_ds6_nbr_entry\n", __func__); - /* return from this function later */ - } else { - LIST_STRUCT_INIT(nbr_entry, uip_ds6_nbrs); - } - } - - /* free nbr and return if nbr_entry is not available */ - if((nbr_entry == NULL) || - (list_length(nbr_entry->uip_ds6_nbrs) == UIP_DS6_NBR_MAX_6ADDRS_PER_NBR)) { - if(list_length(nbr_entry->uip_ds6_nbrs) == UIP_DS6_NBR_MAX_6ADDRS_PER_NBR) { - /* - * it's already had the maximum number of IPv6 addresses; cannot - * add another. - */ - LOG_ERR("%s: no room in nbr_entry for ", __func__); - LOG_ERR_LLADDR((const linkaddr_t *)lladdr); - LOG_ERR_("\n"); - } - /* free the newly allocated memory in this function call */ - memb_free(&uip_ds6_nbr_memb, nbr); - return NULL; - } else { - /* everything is fine; nbr is ready to be used */ - /* it has room to add another IPv6 address */ - add_uip_ds6_nbr_to_nbr_entry(nbr, nbr_entry); - } -#else - nbr = nbr_table_add_lladdr(ds6_neighbors, (linkaddr_t*)lladdr, reason, data); -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - - if(nbr) { - uip_ipaddr_copy(&nbr->ipaddr, ipaddr); -#if UIP_ND6_SEND_RA || !UIP_CONF_ROUTER - nbr->isrouter = isrouter; -#endif /* UIP_ND6_SEND_RA || !UIP_CONF_ROUTER */ - nbr->state = state; -#if UIP_CONF_IPV6_QUEUE_PKT - uip_packetqueue_new(&nbr->packethandle); -#endif /* UIP_CONF_IPV6_QUEUE_PKT */ -#if UIP_ND6_SEND_NS - if(nbr->state == NBR_REACHABLE) { - stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000); - } else { - /* We set the timer in expired state */ - stimer_set(&nbr->reachable, 0); - } - stimer_set(&nbr->sendns, 0); - nbr->nscount = 0; -#endif /* UIP_ND6_SEND_NS */ - LOG_INFO("Adding neighbor with ip addr "); - LOG_INFO_6ADDR(ipaddr); - LOG_INFO_(" link addr "); - LOG_INFO_LLADDR((linkaddr_t*)lladdr); - LOG_INFO_(" state %u\n", state); - NETSTACK_ROUTING.neighbor_state_changed(nbr); - return nbr; - } else { - LOG_INFO("Add drop ip addr "); - LOG_INFO_6ADDR(ipaddr); - LOG_INFO_(" link addr (%p) ", lladdr); - LOG_INFO_LLADDR((linkaddr_t*)lladdr); - LOG_INFO_(" state %u\n", state); - return NULL; - } -} - -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS -/*---------------------------------------------------------------------------*/ -static void -add_uip_ds6_nbr_to_nbr_entry(uip_ds6_nbr_t *nbr, - uip_ds6_nbr_entry_t *nbr_entry) -{ - LOG_DBG("%s: add nbr(%p) to nbr_entry (%p)\n", - __func__, nbr, nbr_entry); - nbr->nbr_entry = nbr_entry; - list_add(nbr_entry->uip_ds6_nbrs, nbr); -} -/*---------------------------------------------------------------------------*/ -static void -remove_uip_ds6_nbr_from_nbr_entry(uip_ds6_nbr_t *nbr) -{ - if(nbr == NULL) { - return; - } - LOG_DBG("%s: remove nbr(%p) from nbr_entry (%p)\n", - __func__, nbr, nbr->nbr_entry); - list_remove(nbr->nbr_entry->uip_ds6_nbrs, nbr); -} -/*---------------------------------------------------------------------------*/ -static void -remove_nbr_entry(uip_ds6_nbr_entry_t *nbr_entry) -{ - if(nbr_entry == NULL) { - return; - } - LOG_DBG("%s: remove nbr_entry (%p) from nbr_table\n", - __func__, nbr_entry); - (void)nbr_table_remove(uip_ds6_nbr_entries, nbr_entry); -} -/*---------------------------------------------------------------------------*/ -static void -free_uip_ds6_nbr(uip_ds6_nbr_t *nbr) -{ - if(nbr == NULL) { - return; - } -#if UIP_CONF_IPV6_QUEUE_PKT - uip_packetqueue_free(&nbr->packethandle); -#endif /* UIP_CONF_IPV6_QUEUE_PKT */ - NETSTACK_ROUTING.neighbor_state_changed(nbr); - assert(nbr->nbr_entry != NULL); - if(nbr->nbr_entry == NULL) { - LOG_ERR("%s: unexpected error nbr->nbr_entry is NULL\n", __func__); - } else { - remove_uip_ds6_nbr_from_nbr_entry(nbr); - if(list_length(nbr->nbr_entry->uip_ds6_nbrs) == 0) { - remove_nbr_entry(nbr->nbr_entry); - } - } - LOG_DBG("%s: free memory for nbr(%p)\n", __func__, nbr); - memb_free(&uip_ds6_nbr_memb, nbr); -} -/*---------------------------------------------------------------------------*/ -static void -callback_nbr_entry_removal(uip_ds6_nbr_entry_t *nbr_entry) -{ - uip_ds6_nbr_t *nbr; - uip_ds6_nbr_t *next_nbr; - if(nbr_entry == NULL) { - return; - } - for(nbr = (uip_ds6_nbr_t *)list_head(nbr_entry->uip_ds6_nbrs); - nbr != NULL; - nbr = next_nbr) { - next_nbr = (uip_ds6_nbr_t *)list_item_next(nbr); - free_uip_ds6_nbr(nbr); - } -} -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ -/*---------------------------------------------------------------------------*/ -int -uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr) -{ -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - if(nbr == NULL) { - return 0; - } else { - free_uip_ds6_nbr(nbr); - return 1; - } -#else /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - if(nbr != NULL) { -#if UIP_CONF_IPV6_QUEUE_PKT - uip_packetqueue_free(&nbr->packethandle); -#endif /* UIP_CONF_IPV6_QUEUE_PKT */ - NETSTACK_ROUTING.neighbor_state_changed(nbr); - return nbr_table_remove(ds6_neighbors, nbr); - } - return 0; -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ -} - -/*---------------------------------------------------------------------------*/ -int -uip_ds6_nbr_update_ll(uip_ds6_nbr_t **nbr_pp, const uip_lladdr_t *new_ll_addr) -{ -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - uip_ds6_nbr_entry_t *nbr_entry; - uip_ds6_nbr_t *nbr; -#else - uip_ds6_nbr_t nbr_backup; -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - - if(nbr_pp == NULL || new_ll_addr == NULL) { - LOG_ERR("%s: invalid argument\n", __func__); - return -1; - } - -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - - if((nbr_entry = - nbr_table_get_from_lladdr(uip_ds6_nbr_entries, - (const linkaddr_t *)new_ll_addr)) == NULL) { - if((nbr_entry = - nbr_table_add_lladdr(uip_ds6_nbr_entries, - (const linkaddr_t*)new_ll_addr, - NBR_TABLE_REASON_IPV6_ND, NULL)) == NULL) { - LOG_ERR("%s: cannot allocate a nbr_entry for", __func__); - LOG_ERR_LLADDR((const linkaddr_t *)new_ll_addr); - return -1; - } else { - LIST_STRUCT_INIT(nbr_entry, uip_ds6_nbrs); - } - } - - nbr = *nbr_pp; - - remove_uip_ds6_nbr_from_nbr_entry(nbr); - if(list_length(nbr->nbr_entry->uip_ds6_nbrs) == 0) { - remove_nbr_entry(nbr->nbr_entry); - } - add_uip_ds6_nbr_to_nbr_entry(nbr, nbr_entry); - -#else /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - - /* make sure new_ll_addr is not used in some other nbr */ - if(uip_ds6_nbr_ll_lookup(new_ll_addr) != NULL) { - LOG_ERR("%s: new_ll_addr, ", __func__); - LOG_ERR_LLADDR((const linkaddr_t *)new_ll_addr); - LOG_ERR_(", is already used in another nbr\n"); - return -1; - } - - memcpy(&nbr_backup, *nbr_pp, sizeof(uip_ds6_nbr_t)); - if(uip_ds6_nbr_rm(*nbr_pp) == 0) { - LOG_ERR("%s: input nbr cannot be removed\n", __func__); - return -1; - } - - if((*nbr_pp = uip_ds6_nbr_add(&nbr_backup.ipaddr, new_ll_addr, - nbr_backup.isrouter, nbr_backup.state, - NBR_TABLE_REASON_IPV6_ND, NULL)) == NULL) { - LOG_ERR("%s: cannot allocate a new nbr for new_ll_addr\n", __func__); - return -1; - } - memcpy(*nbr_pp, &nbr_backup, sizeof(uip_ds6_nbr_t)); -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - - return 0; -} -/*---------------------------------------------------------------------------*/ -const uip_ipaddr_t * -uip_ds6_nbr_get_ipaddr(const uip_ds6_nbr_t *nbr) -{ - return (nbr != NULL) ? &nbr->ipaddr : NULL; -} - -/*---------------------------------------------------------------------------*/ -const uip_lladdr_t * -uip_ds6_nbr_get_ll(const uip_ds6_nbr_t *nbr) -{ -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - if(nbr == NULL) { - return NULL; - } - return (const uip_lladdr_t *)nbr_table_get_lladdr(uip_ds6_nbr_entries, - nbr->nbr_entry); -#else - return (const uip_lladdr_t *)nbr_table_get_lladdr(ds6_neighbors, nbr); -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ -} -/*---------------------------------------------------------------------------*/ -int -uip_ds6_nbr_num(void) -{ - int num = 0; - -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - uip_ds6_nbr_entry_t *nbr_entry; - for(nbr_entry = nbr_table_head(uip_ds6_nbr_entries); - nbr_entry != NULL; - nbr_entry = nbr_table_next(uip_ds6_nbr_entries, nbr_entry)) { - num += list_length(nbr_entry->uip_ds6_nbrs); - } -#else - uip_ds6_nbr_t *nbr; - for(nbr = nbr_table_head(ds6_neighbors); - nbr != NULL; - nbr = nbr_table_next(ds6_neighbors, nbr)) { - num++; - } -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - return num; -} -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -uip_ds6_nbr_head(void) -{ -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - uip_ds6_nbr_entry_t *nbr_entry; - if((nbr_entry = nbr_table_head(uip_ds6_nbr_entries)) == NULL) { - return NULL; - } - assert(list_head(nbr_entry->uip_ds6_nbrs) != NULL); - return (uip_ds6_nbr_t *)list_head(nbr_entry->uip_ds6_nbrs); -#else - return nbr_table_head(ds6_neighbors); -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ -} -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -uip_ds6_nbr_next(uip_ds6_nbr_t *nbr) -{ -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - uip_ds6_nbr_entry_t *nbr_entry; - if(nbr == NULL) { - return NULL; - } - if(list_item_next(nbr) != NULL) { - return list_item_next(nbr); - } - nbr_entry = nbr_table_next(uip_ds6_nbr_entries, nbr->nbr_entry); - if(nbr_entry == NULL) { - return NULL; - } else { - assert(list_head(nbr_entry->uip_ds6_nbrs) != NULL); - return (uip_ds6_nbr_t *)list_head(nbr_entry->uip_ds6_nbrs); - } -#else - return nbr_table_next(ds6_neighbors, nbr); -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ -} -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -uip_ds6_nbr_lookup(const uip_ipaddr_t *ipaddr) -{ - uip_ds6_nbr_t *nbr; - if(ipaddr == NULL) { - return NULL; - } - for(nbr = uip_ds6_nbr_head(); nbr != NULL; nbr = uip_ds6_nbr_next(nbr)) { - if(uip_ipaddr_cmp(&nbr->ipaddr, ipaddr)) { - return nbr; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -uip_ds6_nbr_ll_lookup(const uip_lladdr_t *lladdr) -{ -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - uip_ds6_nbr_entry_t *nbr_entry; - /* - * we cannot determine which entry should return by lladdr alone; - * return the first entry associated with lladdr. - */ - nbr_entry = - (uip_ds6_nbr_entry_t *)nbr_table_get_from_lladdr(uip_ds6_nbr_entries, - (linkaddr_t*)lladdr); - if(nbr_entry == NULL) { - return NULL; - } - assert(list_head(nbr_entry->uip_ds6_nbrs) != NULL); - return (uip_ds6_nbr_t *)list_head(nbr_entry->uip_ds6_nbrs); -#else - return nbr_table_get_from_lladdr(ds6_neighbors, (linkaddr_t*)lladdr); -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ -} - -/*---------------------------------------------------------------------------*/ -uip_ipaddr_t * -uip_ds6_nbr_ipaddr_from_lladdr(const uip_lladdr_t *lladdr) -{ - uip_ds6_nbr_t *nbr = uip_ds6_nbr_ll_lookup(lladdr); - return nbr ? &nbr->ipaddr : NULL; -} - -/*---------------------------------------------------------------------------*/ -const uip_lladdr_t * -uip_ds6_nbr_lladdr_from_ipaddr(const uip_ipaddr_t *ipaddr) -{ - uip_ds6_nbr_t *nbr = uip_ds6_nbr_lookup(ipaddr); - return nbr ? uip_ds6_nbr_get_ll(nbr) : NULL; -} -#if UIP_DS6_LL_NUD -/*---------------------------------------------------------------------------*/ -static void -update_nbr_reachable_state_by_ack(uip_ds6_nbr_t *nbr, const linkaddr_t *lladdr) -{ - if(nbr != NULL && nbr->state != NBR_INCOMPLETE) { - nbr->state = NBR_REACHABLE; - stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000); - LOG_INFO("received a link layer ACK : "); - LOG_INFO_LLADDR(lladdr); - LOG_INFO_(" is reachable.\n"); - } -} -#endif /* UIP_DS6_LL_NUD */ -/*---------------------------------------------------------------------------*/ -void -uip_ds6_link_callback(int status, int numtx) -{ -#if UIP_DS6_LL_NUD - const linkaddr_t *dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); - if(linkaddr_cmp(dest, &linkaddr_null)) { - return; - } - - /* From RFC4861, page 72, last paragraph of section 7.3.3: - * - * "In some cases, link-specific information may indicate that a path to - * a neighbor has failed (e.g., the resetting of a virtual circuit). In - * such cases, link-specific information may be used to purge Neighbor - * Cache entries before the Neighbor Unreachability Detection would do - * so. However, link-specific information MUST NOT be used to confirm - * the reachability of a neighbor; such information does not provide - * end-to-end confirmation between neighboring IP layers." - * - * However, we assume that receiving a link layer ack ensures the delivery - * of the transmitted packed to the IP stack of the neighbour. This is a - * fair assumption and allows battery powered nodes save some battery by - * not re-testing the state of a neighbour periodically if it - * acknowledges link packets. */ - if(status == MAC_TX_OK) { - uip_ds6_nbr_t *nbr; -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - uip_ds6_nbr_entry_t *nbr_entry; - if((nbr_entry = - (uip_ds6_nbr_entry_t *)nbr_table_get_from_lladdr(uip_ds6_nbr_entries, - dest)) == NULL) { - return; - } - for(nbr = (uip_ds6_nbr_t *)list_head(nbr_entry->uip_ds6_nbrs); - nbr != NULL; - nbr = (uip_ds6_nbr_t *)list_item_next(nbr)) { - update_nbr_reachable_state_by_ack(nbr, dest); - } -#else /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - nbr = uip_ds6_nbr_ll_lookup((uip_lladdr_t *)dest); - update_nbr_reachable_state_by_ack(nbr, dest); -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - } -#endif /* UIP_DS6_LL_NUD */ -} -#if UIP_ND6_SEND_NS -/*---------------------------------------------------------------------------*/ -/** Periodic processing on neighbors */ -void -uip_ds6_neighbor_periodic(void) -{ - uip_ds6_nbr_t *nbr = uip_ds6_nbr_head(); - while(nbr != NULL) { - switch(nbr->state) { - case NBR_REACHABLE: - if(stimer_expired(&nbr->reachable)) { -#if UIP_CONF_ROUTER - /* when a neighbor leave its REACHABLE state and is a default router, - instead of going to STALE state it enters DELAY state in order to - force a NUD on it. Otherwise, if there is no upward traffic, the - node never knows if the default router is still reachable. This - mimics the 6LoWPAN-ND behavior. - */ - if(uip_ds6_defrt_lookup(&nbr->ipaddr) != NULL) { - LOG_INFO("REACHABLE: defrt moving to DELAY ("); - LOG_INFO_6ADDR(&nbr->ipaddr); - LOG_INFO_(")\n"); - nbr->state = NBR_DELAY; - stimer_set(&nbr->reachable, UIP_ND6_DELAY_FIRST_PROBE_TIME); - nbr->nscount = 0; - } else { - LOG_INFO("REACHABLE: moving to STALE ("); - LOG_INFO_6ADDR(&nbr->ipaddr); - LOG_INFO_(")\n"); - nbr->state = NBR_STALE; - } -#else /* UIP_CONF_ROUTER */ - LOG_INFO("REACHABLE: moving to STALE ("); - LOG_INFO_6ADDR(&nbr->ipaddr); - LOG_INFO_(")\n"); - nbr->state = NBR_STALE; -#endif /* UIP_CONF_ROUTER */ - } - break; - case NBR_INCOMPLETE: - if(nbr->nscount >= UIP_ND6_MAX_MULTICAST_SOLICIT) { - uip_ds6_nbr_rm(nbr); - } else if(stimer_expired(&nbr->sendns) && (uip_len == 0)) { - nbr->nscount++; - LOG_INFO("NBR_INCOMPLETE: NS %u\n", nbr->nscount); - uip_nd6_ns_output(NULL, NULL, &nbr->ipaddr); - stimer_set(&nbr->sendns, uip_ds6_if.retrans_timer / 1000); - } - break; - case NBR_DELAY: - if(stimer_expired(&nbr->reachable)) { - nbr->state = NBR_PROBE; - nbr->nscount = 0; - LOG_INFO("DELAY: moving to PROBE\n"); - stimer_set(&nbr->sendns, 0); - } - break; - case NBR_PROBE: - if(nbr->nscount >= UIP_ND6_MAX_UNICAST_SOLICIT) { - uip_ds6_defrt_t *locdefrt; - LOG_INFO("PROBE END\n"); - if((locdefrt = uip_ds6_defrt_lookup(&nbr->ipaddr)) != NULL) { - if (!locdefrt->isinfinite) { - uip_ds6_defrt_rm(locdefrt); - } - } - uip_ds6_nbr_rm(nbr); - } else if(stimer_expired(&nbr->sendns) && (uip_len == 0)) { - nbr->nscount++; - LOG_INFO("PROBE: NS %u\n", nbr->nscount); - uip_nd6_ns_output(NULL, &nbr->ipaddr, &nbr->ipaddr); - stimer_set(&nbr->sendns, uip_ds6_if.retrans_timer / 1000); - } - break; - default: - break; - } - nbr = uip_ds6_nbr_next(nbr); - } -} -/*---------------------------------------------------------------------------*/ -void -uip_ds6_nbr_refresh_reachable_state(const uip_ipaddr_t *ipaddr) -{ - uip_ds6_nbr_t *nbr; - nbr = uip_ds6_nbr_lookup(ipaddr); - if(nbr != NULL) { - nbr->state = NBR_REACHABLE; - nbr->nscount = 0; - stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000); - } -} -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -uip_ds6_get_least_lifetime_neighbor(void) -{ - uip_ds6_nbr_t *nbr = uip_ds6_nbr_head(); - uip_ds6_nbr_t *nbr_expiring = NULL; - while(nbr != NULL) { - if(nbr_expiring != NULL) { - clock_time_t curr = stimer_remaining(&nbr->reachable); - if(curr < stimer_remaining(&nbr->reachable)) { - nbr_expiring = nbr; - } - } else { - nbr_expiring = nbr; - } - nbr = uip_ds6_nbr_next(nbr); - } - return nbr_expiring; -} -#endif /* UIP_ND6_SEND_NS */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/uip-ds6-nbr.h b/os/net/ipv6/uip-ds6-nbr.h deleted file mode 100644 index 6479c972e..000000000 --- a/os/net/ipv6/uip-ds6-nbr.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 2013, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * IPv6 Neighbor cache (link-layer/IPv6 address mapping) - * \author Mathilde Durvy - * \author Julien Abeille - * \author Simon Duquennoy - * - */ - -#ifndef UIP_DS6_NEIGHBOR_H_ -#define UIP_DS6_NEIGHBOR_H_ - -#include "contiki.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-nd6.h" -#include "net/nbr-table.h" -#include "sys/stimer.h" -#if UIP_CONF_IPV6_QUEUE_PKT -#include "net/ipv6/uip-packetqueue.h" -#endif /*UIP_CONF_QUEUE_PKT */ -#if UIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS -#include "lib/assert.h" -#include "lib/list.h" -#endif - -/*--------------------------------------------------*/ -/** \brief Possible states for the nbr cache entries */ -#define NBR_INCOMPLETE 0 -#define NBR_REACHABLE 1 -#define NBR_STALE 2 -#define NBR_DELAY 3 -#define NBR_PROBE 4 - -/** \brief Set non-zero (1) to enable multiple IPv6 addresses to be - * associated with a link-layer address */ -#ifdef UIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS -#define UIP_DS6_NBR_MULTI_IPV6_ADDRS UIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS -#else -#define UIP_DS6_NBR_MULTI_IPV6_ADDRS 0 -#endif /* UIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS */ - -/** \brief Set the maximum number of IPv6 addresses per link-layer - * address */ -#ifdef UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR -#define UIP_DS6_NBR_MAX_6ADDRS_PER_NBR UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR -#else -#define UIP_DS6_NBR_MAX_6ADDRS_PER_NBR 2 -#endif /* UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR */ - -/** \brief Set the maximum number of neighbor cache entries */ -#ifdef UIP_DS6_NBR_CONF_MAX_NEIGHBOR_CACHES -#define UIP_DS6_NBR_MAX_NEIGHBOR_CACHES UIP_DS6_NBR_CONF_MAX_NEIGHBOR_CACHES -#else -#define UIP_DS6_NBR_MAX_NEIGHBOR_CACHES \ - (NBR_TABLE_MAX_NEIGHBORS * UIP_DS6_NBR_MAX_6ADDRS_PER_NBR) -#endif /* UIP_DS6_NBR_CONF_MAX_NEIGHBOR_CACHES */ - -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS -/** \brief nbr_table entry when UIP_DS6_NBR_MULTI_IPV6_ADDRS is - * enabled. uip_ds6_nbrs is a list of uip_ds6_nbr_t objects */ -typedef struct { - LIST_STRUCT(uip_ds6_nbrs); -} uip_ds6_nbr_entry_t; -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - -/** \brief The default nbr_table entry (when - * UIP_DS6_NBR_MULTI_IPV6_ADDRS is disabled), that implements nbr - * cache */ -typedef struct uip_ds6_nbr { -#if UIP_DS6_NBR_MULTI_IPV6_ADDRS - struct uip_ds6_nbr *next; - uip_ds6_nbr_entry_t *nbr_entry; -#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */ - uip_ipaddr_t ipaddr; - uint8_t isrouter; - uint8_t state; -#if UIP_ND6_SEND_NS || UIP_ND6_SEND_RA - struct stimer reachable; - struct stimer sendns; - uint8_t nscount; -#endif /* UIP_ND6_SEND_NS || UIP_ND6_SEND_RA */ -#if UIP_CONF_IPV6_QUEUE_PKT - struct uip_packetqueue_handle packethandle; -#define UIP_DS6_NBR_PACKET_LIFETIME CLOCK_SECOND * 4 -#endif /*UIP_CONF_QUEUE_PKT */ -} uip_ds6_nbr_t; - -void uip_ds6_neighbors_init(void); - -/** - * Add a neighbor cache for a specified IPv6 address, which is - * associated with a specified link-layer address - * \param ipaddr IPv6 address of a neighbor to add - * \param lladdr Link-layer address to associate with ipaddr - * \param isrouter Set 1 if the neighbor is a router - * \param state Set the initial neighbor cache state (e.g., - * NBR_INCOMPLETE) - * \param reason Set a reason of the addition (e.g., - * NBR_TABLE_REASON_RPL_DIO) - * \param data Set data associated with the nbr cache - * \return the address of a newly added nbr cache on success, NULL on - * failure -*/ -uip_ds6_nbr_t *uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr, - const uip_lladdr_t *lladdr, - uint8_t isrouter, uint8_t state, - nbr_table_reason_t reason, void *data); - -/** - * Remove a neighbor cache - * \param nbr the address of a neighbor cache to remove - * \return 1 on success, 0 on failure (nothing was removed) - */ -int uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr); - -/** - * Get the link-layer address associated with a specified nbr cache - * \param nbr the address of a neighbor cache - * \return pointer to the link-layer address on success, NULL on failure - */ -const uip_lladdr_t *uip_ds6_nbr_get_ll(const uip_ds6_nbr_t *nbr); - -/** - * Get the link-layer address associated with a specified IPv6 address - * \param ipaddr an IPv6 address used as a search key - * \return the pointer to the link-layer address on success, NULL on failure - */ -const uip_lladdr_t *uip_ds6_nbr_lladdr_from_ipaddr(const uip_ipaddr_t *ipaddr); - -/** - * Update the link-layer address associated with an IPv6 address - * \param nbr the double pointer to a neighbor cache which has the - * target IPv6 address - * \param new_ll_addr the new link-layer address of the IPv6 address - * return 0 on success, -1 on failure - */ -int uip_ds6_nbr_update_ll(uip_ds6_nbr_t **nbr, const uip_lladdr_t *new_ll_addr); - -/** - * Get an IPv6 address of a neighbor cache - * \param nbr the pointer to a neighbor cache - * \return the pointer to an IPv6 address associated with the neighbor cache - * \note This returns the first IPv6 address found in the neighbor - * cache when UIP_DS6_NBR_MULTI_IPV6_ADDRS is enabled - */ -const uip_ipaddr_t *uip_ds6_nbr_get_ipaddr(const uip_ds6_nbr_t *nbr); - -/** - * Get an IPv6 address associated with a specified link-layer address - * \param lladdr a link-layer address used as a search key - * \return the pointer to an IPv6 address associated with the neighbor cache - * \note This returns the first IPv6 address found in the neighbor - * cache when UIP_DS6_NBR_MULTI_IPV6_ADDRS is enabled - */ -uip_ipaddr_t *uip_ds6_nbr_ipaddr_from_lladdr(const uip_lladdr_t *lladdr); - -/** - * Get the neighbor cache associated with a specified IPv6 address - * \param ipaddr an IPv6 address used as a search key - * \return the pointer to a neighbor cache on success, NULL on failure - */ -uip_ds6_nbr_t *uip_ds6_nbr_lookup(const uip_ipaddr_t *ipaddr); - -/** - * Get the neighbor cache associated with a specified link-layer address - * \param lladdr a link-layer address used as a search key - * \return the pointer to a neighbor cache on success, NULL on failure - */ -uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(const uip_lladdr_t *lladdr); - -/** - * Return the number of neighbor caches - * \return the number of neighbor caches in use - */ -int uip_ds6_nbr_num(void); - -/** - * Get the first neighbor cache in nbr_table - * \return the pointer to the first neighbor cache entry - */ -uip_ds6_nbr_t *uip_ds6_nbr_head(void); - -/** - * Get the next neighbor cache of a specified one - * \param nbr the pointer to a neighbor cache - * \return the pointer to the next one on success, NULL on failure - */ -uip_ds6_nbr_t *uip_ds6_nbr_next(uip_ds6_nbr_t *nbr); - -/** - * The callback function to update link-layer stats in a neighbor - * cache - * \param status MAC return value defined in mac.h - * \param numtx the number of transmissions happened for a packet - */ -void uip_ds6_link_callback(int status, int numtx); - -/** - * The housekeeping function called periodically - */ -void uip_ds6_neighbor_periodic(void); - -#if UIP_ND6_SEND_NS -/** - * \brief Refresh the reachable state of a neighbor. This function - * may be called when a node receives an IPv6 message that confirms the - * reachability of a neighbor. - * \param ipaddr pointer to the IPv6 address whose neighbor reachability state - * should be refreshed. - */ -void uip_ds6_nbr_refresh_reachable_state(const uip_ipaddr_t *ipaddr); -#endif /* UIP_ND6_SEND_NS */ - -/** - * \brief - * This searches inside the neighbor table for the neighbor that is about to - * expire the next. - * - * \return - * A reference to the neighbor about to expire the next or NULL if - * table is empty. - */ -uip_ds6_nbr_t *uip_ds6_get_least_lifetime_neighbor(void); - -#endif /* UIP_DS6_NEIGHBOR_H_ */ -/** @} */ diff --git a/os/net/ipv6/uip-ds6-route.c b/os/net/ipv6/uip-ds6-route.c deleted file mode 100644 index ed263edc4..000000000 --- a/os/net/ipv6/uip-ds6-route.c +++ /dev/null @@ -1,750 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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. - * - */ -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * Routing table manipulation - */ -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/ipv6/uip.h" - -#include "lib/list.h" -#include "lib/memb.h" -#include "net/nbr-table.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "IPv6 Route" -#define LOG_LEVEL LOG_LEVEL_IPV6 - -#if BUILD_WITH_ORCHESTRA - -#ifndef NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK -#define NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK orchestra_callback_child_added -#endif /* NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK */ - -#ifndef NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK -#define NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK orchestra_callback_child_removed -#endif /* NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK */ - -#endif /* BUILD_WITH_ORCHESTRA */ - -/* A configurable function called after adding a new neighbor as next hop */ -#ifdef NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK -void NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK(const linkaddr_t *addr); -#endif /* NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK */ - -/* A configurable function called after removing a next hop neighbor */ -#ifdef NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK -void NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK(const linkaddr_t *addr); -#endif /* NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK */ - -#if (UIP_MAX_ROUTES != 0) -/* The nbr_routes holds a neighbor table to be able to maintain - information about what routes go through what neighbor. This - neighbor table is registered with the central nbr-table repository - so that it will be maintained along with the rest of the neighbor - tables in the system. */ -NBR_TABLE_GLOBAL(struct uip_ds6_route_neighbor_routes, nbr_routes); -MEMB(neighborroutememb, struct uip_ds6_route_neighbor_route, UIP_DS6_ROUTE_NB); - -/* Each route is repressented by a uip_ds6_route_t structure and - memory for each route is allocated from the routememb memory - block. These routes are maintained on the routelist. */ -LIST(routelist); -MEMB(routememb, uip_ds6_route_t, UIP_DS6_ROUTE_NB); - -static int num_routes = 0; -static void rm_routelist_callback(nbr_table_item_t *ptr); - -#endif /* (UIP_MAX_ROUTES != 0) */ - -/* Default routes are held on the defaultrouterlist and their - structures are allocated from the defaultroutermemb memory block.*/ -LIST(defaultrouterlist); -MEMB(defaultroutermemb, uip_ds6_defrt_t, UIP_DS6_DEFRT_NB); - -#if UIP_DS6_NOTIFICATIONS -LIST(notificationlist); -#endif - -/*---------------------------------------------------------------------------*/ -static void -assert_nbr_routes_list_sane(void) -{ - uip_ds6_route_t *r; - int count; - - /* Check if the route list has an infinite loop. */ - for(r = uip_ds6_route_head(), - count = 0; - r != NULL && - count < UIP_DS6_ROUTE_NB * 2; - r = uip_ds6_route_next(r), - count++); - - if(count > UIP_DS6_ROUTE_NB) { - printf("uip-ds6-route.c: assert_nbr_routes_list_sane route list is in infinite loop\n"); - } - -#if (UIP_MAX_ROUTES != 0) - /* Make sure that the route list has as many entries as the - num_routes vairable. */ - if(count < num_routes) { - printf("uip-ds6-route.c: assert_nbr_routes_list_sane too few entries on route list: should be %d, is %d, max %d\n", - num_routes, count, UIP_MAX_ROUTES); - } -#endif /* (UIP_MAX_ROUTES != 0) */ -} -/*---------------------------------------------------------------------------*/ -#if UIP_DS6_NOTIFICATIONS -static void -call_route_callback(int event, const uip_ipaddr_t *route, - const uip_ipaddr_t *nexthop) -{ - int num; - struct uip_ds6_notification *n; - for(n = list_head(notificationlist); - n != NULL; - n = list_item_next(n)) { - if(event == UIP_DS6_NOTIFICATION_DEFRT_ADD || - event == UIP_DS6_NOTIFICATION_DEFRT_RM) { - num = list_length(defaultrouterlist); - } else { - num = num_routes; - } - n->callback(event, route, nexthop, num); - } -} -/*---------------------------------------------------------------------------*/ -void -uip_ds6_notification_add(struct uip_ds6_notification *n, - uip_ds6_notification_callback c) -{ - if(n != NULL && c != NULL) { - n->callback = c; - list_add(notificationlist, n); - } -} -/*---------------------------------------------------------------------------*/ -void -uip_ds6_notification_rm(struct uip_ds6_notification *n) -{ - list_remove(notificationlist, n); -} -#endif -/*---------------------------------------------------------------------------*/ -void -uip_ds6_route_init(void) -{ -#if (UIP_MAX_ROUTES != 0) - memb_init(&routememb); - list_init(routelist); - nbr_table_register(nbr_routes, - (nbr_table_callback *)rm_routelist_callback); -#endif /* (UIP_MAX_ROUTES != 0) */ - - memb_init(&defaultroutermemb); - list_init(defaultrouterlist); - -#if UIP_DS6_NOTIFICATIONS - list_init(notificationlist); -#endif -} -#if (UIP_MAX_ROUTES != 0) -/*---------------------------------------------------------------------------*/ -static uip_lladdr_t * -uip_ds6_route_nexthop_lladdr(uip_ds6_route_t *route) -{ - if(route != NULL) { - return (uip_lladdr_t *)nbr_table_get_lladdr(nbr_routes, - route->neighbor_routes); - } else { - return NULL; - } -} -#endif /* (UIP_MAX_ROUTES != 0) */ -/*---------------------------------------------------------------------------*/ -const uip_ipaddr_t * -uip_ds6_route_nexthop(uip_ds6_route_t *route) -{ -#if (UIP_MAX_ROUTES != 0) - if(route != NULL) { - return uip_ds6_nbr_ipaddr_from_lladdr(uip_ds6_route_nexthop_lladdr(route)); - } else { - return NULL; - } -#else /* (UIP_MAX_ROUTES != 0) */ - return NULL; -#endif /* (UIP_MAX_ROUTES != 0) */ -} -/*---------------------------------------------------------------------------*/ -uip_ds6_route_t * -uip_ds6_route_head(void) -{ -#if (UIP_MAX_ROUTES != 0) - return list_head(routelist); -#else /* (UIP_MAX_ROUTES != 0) */ - return NULL; -#endif /* (UIP_MAX_ROUTES != 0) */ -} -/*---------------------------------------------------------------------------*/ -uip_ds6_route_t * -uip_ds6_route_next(uip_ds6_route_t *r) -{ -#if (UIP_MAX_ROUTES != 0) - if(r != NULL) { - uip_ds6_route_t *n = list_item_next(r); - return n; - } -#endif /* (UIP_MAX_ROUTES != 0) */ - return NULL; -} -/*---------------------------------------------------------------------------*/ -int -uip_ds6_route_is_nexthop(const uip_ipaddr_t *ipaddr) -{ -#if (UIP_MAX_ROUTES != 0) - const uip_lladdr_t *lladdr; - lladdr = uip_ds6_nbr_lladdr_from_ipaddr(ipaddr); - - if(lladdr == NULL) { - return 0; - } - - return nbr_table_get_from_lladdr(nbr_routes, (linkaddr_t *)lladdr) != NULL; -#else /* (UIP_MAX_ROUTES != 0) */ - return 0; -#endif /* (UIP_MAX_ROUTES != 0) */ -} -/*---------------------------------------------------------------------------*/ -int -uip_ds6_route_num_routes(void) -{ -#if (UIP_MAX_ROUTES != 0) - return num_routes; -#else /* (UIP_MAX_ROUTES != 0) */ - return 0; -#endif /* (UIP_MAX_ROUTES != 0) */ -} -/*---------------------------------------------------------------------------*/ -uip_ds6_route_t * -uip_ds6_route_lookup(const uip_ipaddr_t *addr) -{ -#if (UIP_MAX_ROUTES != 0) - uip_ds6_route_t *r; - uip_ds6_route_t *found_route; - uint8_t longestmatch; - - LOG_INFO("Looking up route for "); - LOG_INFO_6ADDR(addr); - LOG_INFO_("\n"); - - if(addr == NULL) { - return NULL; - } - - found_route = NULL; - longestmatch = 0; - for(r = uip_ds6_route_head(); - r != NULL; - r = uip_ds6_route_next(r)) { - if(r->length >= longestmatch && - uip_ipaddr_prefixcmp(addr, &r->ipaddr, r->length)) { - longestmatch = r->length; - found_route = r; - /* check if total match - e.g. all 128 bits do match */ - if(longestmatch == 128) { - break; - } - } - } - - if(found_route != NULL) { - LOG_INFO("Found route: "); - LOG_INFO_6ADDR(addr); - LOG_INFO_(" via "); - LOG_INFO_6ADDR(uip_ds6_route_nexthop(found_route)); - LOG_INFO_("\n"); - } else { - LOG_WARN("No route found\n"); - } - - if(found_route != NULL && found_route != list_head(routelist)) { - /* If we found a route, we put it at the start of the routeslist - list. The list is ordered by how recently we looked them up: - the least recently used route will be at the end of the - list - for fast lookups (assuming multiple packets to the same node). */ - - list_remove(routelist, found_route); - list_push(routelist, found_route); - } - - return found_route; -#else /* (UIP_MAX_ROUTES != 0) */ - return NULL; -#endif /* (UIP_MAX_ROUTES != 0) */ -} -/*---------------------------------------------------------------------------*/ -uip_ds6_route_t * -uip_ds6_route_add(const uip_ipaddr_t *ipaddr, uint8_t length, - const uip_ipaddr_t *nexthop) -{ -#if (UIP_MAX_ROUTES != 0) - uip_ds6_route_t *r; - struct uip_ds6_route_neighbor_route *nbrr; - - if(LOG_DBG_ENABLED) { - assert_nbr_routes_list_sane(); - } - - if(ipaddr == NULL || nexthop == NULL) { - return NULL; - } - - /* Get link-layer address of next hop, make sure it is in neighbor table */ - const uip_lladdr_t *nexthop_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(nexthop); - if(nexthop_lladdr == NULL) { - LOG_WARN("Add: neighbor link-local address unknown for "); - LOG_WARN_6ADDR(nexthop); - LOG_WARN_("\n"); - return NULL; - } - - /* First make sure that we don't add a route twice. If we find an - existing route for our destination, we'll delete the old - one first. */ - r = uip_ds6_route_lookup(ipaddr); - if(r != NULL) { - const uip_ipaddr_t *current_nexthop; - current_nexthop = uip_ds6_route_nexthop(r); - if(current_nexthop != NULL && uip_ipaddr_cmp(nexthop, current_nexthop)) { - /* no need to update route - already correct! */ - return r; - } - LOG_INFO("Add: old route for "); - LOG_INFO_6ADDR(ipaddr); - LOG_INFO_(" found, deleting it\n"); - - uip_ds6_route_rm(r); - } - { - struct uip_ds6_route_neighbor_routes *routes; - /* If there is no routing entry, create one. We first need to - check if we have room for this route. If not, we remove the - least recently used one we have. */ - - if(uip_ds6_route_num_routes() == UIP_DS6_ROUTE_NB) { - uip_ds6_route_t *oldest; - oldest = NULL; -#if UIP_DS6_ROUTE_REMOVE_LEAST_RECENTLY_USED - /* Removing the oldest route entry from the route table. The - least recently used route is the first route on the list. */ - oldest = list_tail(routelist); -#endif - if(oldest == NULL) { - return NULL; - } - LOG_INFO("Add: dropping route to "); - LOG_INFO_6ADDR(&oldest->ipaddr); - LOG_INFO_("\n"); - uip_ds6_route_rm(oldest); - } - - - /* Every neighbor on our neighbor table holds a struct - uip_ds6_route_neighbor_routes which holds a list of routes that - go through the neighbor. We add our route entry to this list. - - We first check to see if we already have this neighbor in our - nbr_route table. If so, the neighbor already has a route entry - list. - */ - routes = nbr_table_get_from_lladdr(nbr_routes, - (linkaddr_t *)nexthop_lladdr); - - if(routes == NULL) { - /* If the neighbor did not have an entry in our neighbor table, - we create one. The nbr_table_add_lladdr() function returns a - pointer to a pointer that we may use for our own purposes. We - initialize this pointer with the list of routing entries that - are attached to this neighbor. */ - routes = nbr_table_add_lladdr(nbr_routes, - (linkaddr_t *)nexthop_lladdr, - NBR_TABLE_REASON_ROUTE, NULL); - if(routes == NULL) { - /* This should not happen, as we explicitly deallocated one - route table entry above. */ - LOG_ERR("Add: could not allocate neighbor table entry\n"); - return NULL; - } - LIST_STRUCT_INIT(routes, route_list); -#ifdef NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK - NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK((const linkaddr_t *)nexthop_lladdr); -#endif - } - - /* Allocate a routing entry and populate it. */ - r = memb_alloc(&routememb); - - if(r == NULL) { - /* This should not happen, as we explicitly deallocated one - route table entry above. */ - LOG_ERR("Add: could not allocate route\n"); - return NULL; - } - - /* add new routes first - assuming that there is a reason to add this - and that there is a packet coming soon. */ - list_push(routelist, r); - - nbrr = memb_alloc(&neighborroutememb); - if(nbrr == NULL) { - /* This should not happen, as we explicitly deallocated one - route table entry above. */ - LOG_ERR("Add: could not allocate neighbor route list entry\n"); - memb_free(&routememb, r); - return NULL; - } - - nbrr->route = r; - /* Add the route to this neighbor */ - list_add(routes->route_list, nbrr); - r->neighbor_routes = routes; - num_routes++; - - LOG_INFO("Add: num %d\n", num_routes); - - /* lock this entry so that nexthop is not removed */ - nbr_table_lock(nbr_routes, routes); - } - - uip_ipaddr_copy(&(r->ipaddr), ipaddr); - r->length = length; - -#ifdef UIP_DS6_ROUTE_STATE_TYPE - memset(&r->state, 0, sizeof(UIP_DS6_ROUTE_STATE_TYPE)); -#endif - - LOG_INFO("Add: adding route: "); - LOG_INFO_6ADDR(ipaddr); - LOG_INFO_(" via "); - LOG_INFO_6ADDR(nexthop); - LOG_INFO_("\n"); - LOG_ANNOTATE("#L %u 1;blue\n", nexthop->u8[sizeof(uip_ipaddr_t) - 1]); - -#if UIP_DS6_NOTIFICATIONS - call_route_callback(UIP_DS6_NOTIFICATION_ROUTE_ADD, ipaddr, nexthop); -#endif - - if(LOG_DBG_ENABLED) { - assert_nbr_routes_list_sane(); - } - return r; - -#else /* (UIP_MAX_ROUTES != 0) */ - return NULL; -#endif /* (UIP_MAX_ROUTES != 0) */ -} - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_route_rm(uip_ds6_route_t *route) -{ -#if (UIP_MAX_ROUTES != 0) - struct uip_ds6_route_neighbor_route *neighbor_route; - - if(LOG_DBG_ENABLED) { - assert_nbr_routes_list_sane(); - } - - if(route != NULL && route->neighbor_routes != NULL) { - - LOG_INFO("Rm: removing route: "); - LOG_INFO_6ADDR(&route->ipaddr); - LOG_INFO_("\n"); - - /* Remove the route from the route list */ - list_remove(routelist, route); - - /* Find the corresponding neighbor_route and remove it. */ - for(neighbor_route = list_head(route->neighbor_routes->route_list); - neighbor_route != NULL && neighbor_route->route != route; - neighbor_route = list_item_next(neighbor_route)); - - if(neighbor_route == NULL) { - LOG_INFO("Rm: neighbor_route was NULL for "); - LOG_INFO_6ADDR(&route->ipaddr); - LOG_INFO_("\n"); - } - list_remove(route->neighbor_routes->route_list, neighbor_route); - if(list_head(route->neighbor_routes->route_list) == NULL) { - /* If this was the only route using this neighbor, remove the - neighbor from the table - this implicitly unlocks nexthop */ -#if LOG_WITH_ANNOTATE - uip_ipaddr_t *nexthop = uip_ds6_route_nexthop(route); - if(nexthop != NULL) { - LOG_ANNOTATE("#L %u 0\n", nexthop->u8[sizeof(uip_ipaddr_t) - 1]); - } -#endif /* LOG_WITH_ANNOTATE */ - LOG_INFO("Rm: removing neighbor too\n"); - nbr_table_remove(nbr_routes, route->neighbor_routes->route_list); -#ifdef NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK - NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK( - (const linkaddr_t *)nbr_table_get_lladdr(nbr_routes, route->neighbor_routes->route_list)); -#endif - } - memb_free(&routememb, route); - memb_free(&neighborroutememb, neighbor_route); - - num_routes--; - - LOG_INFO("Rm: num %d\n", num_routes); - -#if UIP_DS6_NOTIFICATIONS - call_route_callback(UIP_DS6_NOTIFICATION_ROUTE_RM, - &route->ipaddr, uip_ds6_route_nexthop(route)); -#endif - } - - if(LOG_DBG_ENABLED) { - assert_nbr_routes_list_sane(); - } - -#endif /* (UIP_MAX_ROUTES != 0) */ - return; -} -#if (UIP_MAX_ROUTES != 0) -/*---------------------------------------------------------------------------*/ -static void -rm_routelist(struct uip_ds6_route_neighbor_routes *routes) -{ - if(LOG_DBG_ENABLED) { - assert_nbr_routes_list_sane(); - } - - if(routes != NULL && routes->route_list != NULL) { - struct uip_ds6_route_neighbor_route *r; - r = list_head(routes->route_list); - while(r != NULL) { - uip_ds6_route_rm(r->route); - r = list_head(routes->route_list); - } - nbr_table_remove(nbr_routes, routes); - } - - if(LOG_DBG_ENABLED) { - assert_nbr_routes_list_sane(); - } -} -/*---------------------------------------------------------------------------*/ -static void -rm_routelist_callback(nbr_table_item_t *ptr) -{ - rm_routelist((struct uip_ds6_route_neighbor_routes *)ptr); -} -#endif /* (UIP_MAX_ROUTES != 0) */ -/*---------------------------------------------------------------------------*/ -void -uip_ds6_route_rm_by_nexthop(const uip_ipaddr_t *nexthop) -{ -#if (UIP_MAX_ROUTES != 0) - /* Get routing entry list of this neighbor */ - const uip_lladdr_t *nexthop_lladdr; - struct uip_ds6_route_neighbor_routes *routes; - - nexthop_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(nexthop); - routes = nbr_table_get_from_lladdr(nbr_routes, - (linkaddr_t *)nexthop_lladdr); - rm_routelist(routes); -#endif /* (UIP_MAX_ROUTES != 0) */ -} -/*---------------------------------------------------------------------------*/ -uip_ds6_defrt_t * -uip_ds6_defrt_head(void) -{ - return list_head(defaultrouterlist); -} -/*---------------------------------------------------------------------------*/ -uip_ds6_defrt_t * -uip_ds6_defrt_add(const uip_ipaddr_t *ipaddr, unsigned long interval) -{ - uip_ds6_defrt_t *d; - - if(LOG_DBG_ENABLED) { - assert_nbr_routes_list_sane(); - } - - if(ipaddr == NULL) { - return NULL; - } - - LOG_INFO("Add default\n"); - d = uip_ds6_defrt_lookup(ipaddr); - if(d == NULL) { - d = memb_alloc(&defaultroutermemb); - if(d == NULL) { - LOG_ERR("Add default: could not add default route to "); - LOG_ERR_6ADDR(ipaddr); - LOG_ERR_(", out of memory\n"); - return NULL; - } else { - LOG_INFO("Add default: adding default route to "); - LOG_INFO_6ADDR(ipaddr); - LOG_INFO_("\n"); - } - - list_push(defaultrouterlist, d); - } - - uip_ipaddr_copy(&d->ipaddr, ipaddr); - if(interval != 0) { - stimer_set(&d->lifetime, interval); - d->isinfinite = 0; - } else { - d->isinfinite = 1; - } - - LOG_ANNOTATE("#L %u 1\n", ipaddr->u8[sizeof(uip_ipaddr_t) - 1]); - -#if UIP_DS6_NOTIFICATIONS - call_route_callback(UIP_DS6_NOTIFICATION_DEFRT_ADD, ipaddr, ipaddr); -#endif - -if(LOG_DBG_ENABLED) { - assert_nbr_routes_list_sane(); -} - - return d; -} -/*---------------------------------------------------------------------------*/ -void -uip_ds6_defrt_rm(uip_ds6_defrt_t *defrt) -{ - uip_ds6_defrt_t *d; - - if(LOG_DBG_ENABLED) { - assert_nbr_routes_list_sane(); - } - - /* Make sure that the defrt is in the list before we remove it. */ - for(d = list_head(defaultrouterlist); - d != NULL; - d = list_item_next(d)) { - if(d == defrt) { - LOG_INFO("Removing default\n"); - list_remove(defaultrouterlist, defrt); - memb_free(&defaultroutermemb, defrt); - LOG_ANNOTATE("#L %u 0\n", defrt->ipaddr.u8[sizeof(uip_ipaddr_t) - 1]); -#if UIP_DS6_NOTIFICATIONS - call_route_callback(UIP_DS6_NOTIFICATION_DEFRT_RM, - &defrt->ipaddr, &defrt->ipaddr); -#endif - return; - } - } - - if(LOG_DBG_ENABLED) { - assert_nbr_routes_list_sane(); - } -} -/*---------------------------------------------------------------------------*/ -uip_ds6_defrt_t * -uip_ds6_defrt_lookup(const uip_ipaddr_t *ipaddr) -{ - uip_ds6_defrt_t *d; - if(ipaddr == NULL) { - return NULL; - } - for(d = list_head(defaultrouterlist); - d != NULL; - d = list_item_next(d)) { - if(uip_ipaddr_cmp(&d->ipaddr, ipaddr)) { - return d; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -const uip_ipaddr_t * -uip_ds6_defrt_choose(void) -{ - uip_ds6_defrt_t *d; - uip_ds6_nbr_t *bestnbr; - uip_ipaddr_t *addr; - - addr = NULL; - for(d = list_head(defaultrouterlist); - d != NULL; - d = list_item_next(d)) { - LOG_INFO("Default route, IP address "); - LOG_INFO_6ADDR(&d->ipaddr); - LOG_INFO_("\n"); - bestnbr = uip_ds6_nbr_lookup(&d->ipaddr); - if(bestnbr != NULL && bestnbr->state != NBR_INCOMPLETE) { - LOG_INFO("Default route found, IP address "); - LOG_INFO_6ADDR(&d->ipaddr); - LOG_INFO_("\n"); - return &d->ipaddr; - } else { - addr = &d->ipaddr; - LOG_INFO("Default route Incomplete found, IP address "); - LOG_INFO_6ADDR(&d->ipaddr); - LOG_INFO_("\n"); - } - } - return addr; -} -/*---------------------------------------------------------------------------*/ -void -uip_ds6_defrt_periodic(void) -{ - uip_ds6_defrt_t *d; - d = list_head(defaultrouterlist); - while(d != NULL) { - if(!d->isinfinite && - stimer_expired(&d->lifetime)) { - LOG_INFO("Default route periodic: defrt lifetime expired\n"); - uip_ds6_defrt_rm(d); - d = list_head(defaultrouterlist); - } else { - d = list_item_next(d); - } - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/uip-ds6-route.h b/os/net/ipv6/uip-ds6-route.h deleted file mode 100644 index 69ab18f5b..000000000 --- a/os/net/ipv6/uip-ds6-route.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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. - * - */ -/** - * \addtogroup uip - * @{ - */ -/** - * \file - * Header file for routing table manipulation - */ -#ifndef UIP_DS6_ROUTE_H -#define UIP_DS6_ROUTE_H - -#include "net/ipv6/uip.h" -#include "net/nbr-table.h" -#include "sys/stimer.h" -#include "lib/list.h" - -#ifdef UIP_CONF_MAX_ROUTES - -#define UIP_MAX_ROUTES UIP_CONF_MAX_ROUTES - -#else /* UIP_CONF_MAX_ROUTES */ - -#if ROUTING_CONF_RPL_LITE -#define UIP_MAX_ROUTES 0 /* RPL Lite only supports non-storing, no routes */ -#elif ROUTING_CONF_RPL_CLASSIC - -#include "net/routing/rpl-classic/rpl-conf.h" -#if RPL_WITH_STORING -#define UIP_MAX_ROUTES NETSTACK_MAX_ROUTE_ENTRIES -#else /* RPL_WITH_STORING */ -#define UIP_MAX_ROUTES 0 /* No storing mode, no need for routes */ -#endif /* RPL_WITH_STORING */ - -#else /* Not RPL Lite nor RPL Classic */ -#define UIP_MAX_ROUTES NETSTACK_MAX_ROUTE_ENTRIES -#endif - -#endif /* UIP_CONF_MAX_ROUTES */ - -NBR_TABLE_DECLARE(nbr_routes); - -void uip_ds6_route_init(void); - -#ifndef UIP_CONF_UIP_DS6_NOTIFICATIONS -#define UIP_DS6_NOTIFICATIONS (UIP_MAX_ROUTES != 0) -#else -#define UIP_DS6_NOTIFICATIONS UIP_CONF_UIP_DS6_NOTIFICATIONS -#endif - -#if UIP_DS6_NOTIFICATIONS -/* Event constants for the uip-ds6 route notification interface. The - notification interface allows for a user program to be notified via - a callback when a route has been added or removed and when the - system has added or removed a default route. */ -#define UIP_DS6_NOTIFICATION_DEFRT_ADD 0 -#define UIP_DS6_NOTIFICATION_DEFRT_RM 1 -#define UIP_DS6_NOTIFICATION_ROUTE_ADD 2 -#define UIP_DS6_NOTIFICATION_ROUTE_RM 3 - -typedef void (* uip_ds6_notification_callback)(int event, - const uip_ipaddr_t *route, - const uip_ipaddr_t *nexthop, - int num_routes); -struct uip_ds6_notification { - struct uip_ds6_notification *next; - uip_ds6_notification_callback callback; -}; - -void uip_ds6_notification_add(struct uip_ds6_notification *n, - uip_ds6_notification_callback c); - -void uip_ds6_notification_rm(struct uip_ds6_notification *n); -/*--------------------------------------------------*/ -#endif - -/* Routing table */ -#ifdef UIP_MAX_ROUTES -#define UIP_DS6_ROUTE_NB UIP_MAX_ROUTES -#else /* UIP_MAX_ROUTES */ -#define UIP_DS6_ROUTE_NB 4 -#endif /* UIP_MAX_ROUTES */ - -/** \brief define some additional RPL related route state and - * neighbor callback for RPL - if not a DS6_ROUTE_STATE is already set */ -#ifndef UIP_DS6_ROUTE_STATE_TYPE -#define UIP_DS6_ROUTE_STATE_TYPE rpl_route_entry_t -/* Needed for the extended route entry state when using ContikiRPL */ -#define RPL_ROUTE_ENTRY_NOPATH_RECEIVED 0x01 -#define RPL_ROUTE_ENTRY_DAO_PENDING 0x02 -#define RPL_ROUTE_ENTRY_DAO_NACK 0x04 - -#define RPL_ROUTE_IS_NOPATH_RECEIVED(route) \ - (((route)->state.state_flags & RPL_ROUTE_ENTRY_NOPATH_RECEIVED) != 0) -#define RPL_ROUTE_SET_NOPATH_RECEIVED(route) do { \ - (route)->state.state_flags |= RPL_ROUTE_ENTRY_NOPATH_RECEIVED; \ - } while(0) -#define RPL_ROUTE_CLEAR_NOPATH_RECEIVED(route) do { \ - (route)->state.state_flags &= ~RPL_ROUTE_ENTRY_NOPATH_RECEIVED; \ - } while(0) - -#define RPL_ROUTE_IS_DAO_PENDING(route) \ - ((route->state.state_flags & RPL_ROUTE_ENTRY_DAO_PENDING) != 0) -#define RPL_ROUTE_SET_DAO_PENDING(route) do { \ - (route)->state.state_flags |= RPL_ROUTE_ENTRY_DAO_PENDING; \ - } while(0) -#define RPL_ROUTE_CLEAR_DAO_PENDING(route) do { \ - (route)->state.state_flags &= ~RPL_ROUTE_ENTRY_DAO_PENDING; \ - } while(0) - -#define RPL_ROUTE_IS_DAO_NACKED(route) \ - ((route->state.state_flags & RPL_ROUTE_ENTRY_DAO_NACK) != 0) -#define RPL_ROUTE_SET_DAO_NACKED(route) do { \ - (route)->state.state_flags |= RPL_ROUTE_ENTRY_DAO_NACK; \ - } while(0) -#define RPL_ROUTE_CLEAR_DAO_NACKED(route) do { \ - (route)->state.state_flags &= ~RPL_ROUTE_ENTRY_DAO_NACK; \ - } while(0) - -#define RPL_ROUTE_CLEAR_DAO(route) do { \ - (route)->state.state_flags &= ~(RPL_ROUTE_ENTRY_DAO_NACK|RPL_ROUTE_ENTRY_DAO_PENDING); \ - } while(0) - -struct rpl_dag; -typedef struct rpl_route_entry { - uint32_t lifetime; - struct rpl_dag *dag; - uint8_t dao_seqno_out; - uint8_t dao_seqno_in; - uint8_t state_flags; -} rpl_route_entry_t; -#endif /* UIP_DS6_ROUTE_STATE_TYPE */ - -/** \brief The neighbor routes hold a list of routing table entries - that are attached to a specific neihbor. */ -struct uip_ds6_route_neighbor_routes { - LIST_STRUCT(route_list); -}; - -/** \brief An entry in the routing table */ -typedef struct uip_ds6_route { - struct uip_ds6_route *next; - /* Each route entry belongs to a specific neighbor. That neighbor - holds a list of all routing entries that go through it. The - routes field point to the uip_ds6_route_neighbor_routes that - belong to the neighbor table entry that this routing table entry - uses. */ - struct uip_ds6_route_neighbor_routes *neighbor_routes; - uip_ipaddr_t ipaddr; -#ifdef UIP_DS6_ROUTE_STATE_TYPE - UIP_DS6_ROUTE_STATE_TYPE state; -#endif - uint8_t length; -} uip_ds6_route_t; - -/** \brief A neighbor route list entry, used on the - uip_ds6_route->neighbor_routes->route_list list. */ -struct uip_ds6_route_neighbor_route { - struct uip_ds6_route_neighbor_route *next; - struct uip_ds6_route *route; -}; - -/** \brief An entry in the default router list */ -typedef struct uip_ds6_defrt { - struct uip_ds6_defrt *next; - uip_ipaddr_t ipaddr; - struct stimer lifetime; - uint8_t isinfinite; -} uip_ds6_defrt_t; - -/** \name Default router list basic routines */ -/** @{ */ -uip_ds6_defrt_t *uip_ds6_defrt_head(void); -uip_ds6_defrt_t *uip_ds6_defrt_add(const uip_ipaddr_t *ipaddr, - unsigned long interval); -void uip_ds6_defrt_rm(uip_ds6_defrt_t *defrt); -uip_ds6_defrt_t *uip_ds6_defrt_lookup(const uip_ipaddr_t *ipaddr); -const uip_ipaddr_t *uip_ds6_defrt_choose(void); - -void uip_ds6_defrt_periodic(void); -/** @} */ - - -/** \name Routing Table basic routines */ -/** @{ */ -uip_ds6_route_t *uip_ds6_route_lookup(const uip_ipaddr_t *destipaddr); -uip_ds6_route_t *uip_ds6_route_add(const uip_ipaddr_t *ipaddr, uint8_t length, - const uip_ipaddr_t *next_hop); -void uip_ds6_route_rm(uip_ds6_route_t *route); -void uip_ds6_route_rm_by_nexthop(const uip_ipaddr_t *nexthop); - -const uip_ipaddr_t *uip_ds6_route_nexthop(uip_ds6_route_t *); -int uip_ds6_route_num_routes(void); -uip_ds6_route_t *uip_ds6_route_head(void); -uip_ds6_route_t *uip_ds6_route_next(uip_ds6_route_t *); -int uip_ds6_route_is_nexthop(const uip_ipaddr_t *ipaddr); -/** @} */ - -#endif /* UIP_DS6_ROUTE_H */ -/** @} */ diff --git a/os/net/ipv6/uip-ds6.c b/os/net/ipv6/uip-ds6.c deleted file mode 100644 index bcfb9b0c8..000000000 --- a/os/net/ipv6/uip-ds6.c +++ /dev/null @@ -1,764 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * IPv6 data structure manipulation. - * Comprises part of the Neighbor discovery (RFC 4861) - * and auto configuration (RFC 4862) state machines. - * \author Mathilde Durvy - * \author Julien Abeille - */ - -#include -#include -#include -#include "lib/random.h" -#include "net/ipv6/uip-nd6.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/multicast/uip-mcast6.h" -#include "net/ipv6/uip-packetqueue.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "IPv6 DS" -#define LOG_LEVEL LOG_LEVEL_IPV6 - -struct etimer uip_ds6_timer_periodic; /**< Timer for maintenance of data structures */ - -#if UIP_CONF_ROUTER -struct stimer uip_ds6_timer_ra; /**< RA timer, to schedule RA sending */ -#if UIP_ND6_SEND_RA -static uint8_t racount; /**< number of RA already sent */ -static uint16_t rand_time; /**< random time value for timers */ -#endif -#else /* UIP_CONF_ROUTER */ -struct etimer uip_ds6_timer_rs; /**< RS timer, to schedule RS sending */ -static uint8_t rscount; /**< number of rs already sent */ -#endif /* UIP_CONF_ROUTER */ - -/** \name "DS6" Data structures */ -/** @{ */ -uip_ds6_netif_t uip_ds6_if; /**< The single interface */ -uip_ds6_prefix_t uip_ds6_prefix_list[UIP_DS6_PREFIX_NB]; /**< Prefix list */ - -/* Used by Cooja to enable extraction of addresses from memory.*/ -uint8_t uip_ds6_addr_size; -uint8_t uip_ds6_netif_addr_list_offset; - -/** @} */ - -/* "full" (as opposed to pointer) ip address used in this file, */ -static uip_ipaddr_t loc_fipaddr; - -/* Pointers used in this file */ -static uip_ds6_addr_t *locaddr; -static uip_ds6_maddr_t *locmaddr; -#if UIP_DS6_AADDR_NB -static uip_ds6_aaddr_t *locaaddr; -#endif /* UIP_DS6_AADDR_NB */ -static uip_ds6_prefix_t *locprefix; -#if (UIP_LLADDR_LEN == 2) -static const uint8_t iid_prefix[] = { 0x00, 0x00 , 0x00 , 0xff , 0xfe , 0x00 }; -#endif /* (UIP_LLADDR_LEN == 2) */ - -/* The default prefix */ -static uip_ip6addr_t default_prefix = { - .u16 = { 0, 0, 0, 0, 0, 0, 0, 0 } -}; -/*---------------------------------------------------------------------------*/ -const uip_ip6addr_t * -uip_ds6_default_prefix() -{ - return &default_prefix; -} -/*---------------------------------------------------------------------------*/ -void -uip_ds6_set_default_prefix(const uip_ip6addr_t *prefix) -{ - uip_ip6addr_copy(&default_prefix, prefix); -} -/*---------------------------------------------------------------------------*/ -void -uip_ds6_init(void) -{ - if(uip_is_addr_unspecified(&default_prefix)) { - uip_ip6addr(&default_prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0); - } - - uip_ds6_neighbors_init(); - uip_ds6_route_init(); - - LOG_INFO("Init: %u neighbors\n", NBR_TABLE_MAX_NEIGHBORS); - LOG_INFO("%u default routers\n", UIP_DS6_DEFRT_NB); - LOG_INFO("%u prefixes\n", UIP_DS6_PREFIX_NB); - LOG_INFO("%u routes\n", UIP_DS6_ROUTE_NB); - LOG_INFO("%u unicast addresses\n", UIP_DS6_ADDR_NB); - LOG_INFO("%u multicast addresses\n", UIP_DS6_MADDR_NB); - LOG_INFO("%u anycast addresses\n", UIP_DS6_AADDR_NB); - - memset(uip_ds6_prefix_list, 0, sizeof(uip_ds6_prefix_list)); - memset(&uip_ds6_if, 0, sizeof(uip_ds6_if)); - uip_ds6_addr_size = sizeof(struct uip_ds6_addr); - uip_ds6_netif_addr_list_offset = offsetof(struct uip_ds6_netif, addr_list); - - /* Set interface parameters */ - uip_ds6_if.link_mtu = UIP_LINK_MTU; - uip_ds6_if.cur_hop_limit = UIP_TTL; - uip_ds6_if.base_reachable_time = UIP_ND6_REACHABLE_TIME; - uip_ds6_if.reachable_time = uip_ds6_compute_reachable_time(); - uip_ds6_if.retrans_timer = UIP_ND6_RETRANS_TIMER; - uip_ds6_if.maxdadns = UIP_ND6_DEF_MAXDADNS; - - /* Create link local address, prefix, multicast addresses, anycast addresses */ - uip_create_linklocal_prefix(&loc_fipaddr); -#if UIP_CONF_ROUTER - uip_ds6_prefix_add(&loc_fipaddr, UIP_DEFAULT_PREFIX_LEN, 0, 0, 0, 0); -#else /* UIP_CONF_ROUTER */ - uip_ds6_prefix_add(&loc_fipaddr, UIP_DEFAULT_PREFIX_LEN, 0); -#endif /* UIP_CONF_ROUTER */ - uip_ds6_set_addr_iid(&loc_fipaddr, &uip_lladdr); - uip_ds6_addr_add(&loc_fipaddr, 0, ADDR_AUTOCONF); - - uip_create_linklocal_allnodes_mcast(&loc_fipaddr); - uip_ds6_maddr_add(&loc_fipaddr); -#if UIP_CONF_ROUTER - uip_create_linklocal_allrouters_mcast(&loc_fipaddr); - uip_ds6_maddr_add(&loc_fipaddr); -#if UIP_ND6_SEND_RA - stimer_set(&uip_ds6_timer_ra, 2); /* wait to have a link local IP address */ -#endif /* UIP_ND6_SEND_RA */ -#else /* UIP_CONF_ROUTER */ - etimer_set(&uip_ds6_timer_rs, - random_rand() % (UIP_ND6_MAX_RTR_SOLICITATION_DELAY * - CLOCK_SECOND)); -#endif /* UIP_CONF_ROUTER */ - etimer_set(&uip_ds6_timer_periodic, UIP_DS6_PERIOD); - - return; -} - - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_periodic(void) -{ - - /* Periodic processing on unicast addresses */ - for(locaddr = uip_ds6_if.addr_list; - locaddr < uip_ds6_if.addr_list + UIP_DS6_ADDR_NB; locaddr++) { - if(locaddr->isused) { - if((!locaddr->isinfinite) && (stimer_expired(&locaddr->vlifetime))) { - uip_ds6_addr_rm(locaddr); -#if UIP_ND6_DEF_MAXDADNS > 0 - } else if((locaddr->state == ADDR_TENTATIVE) - && (locaddr->dadnscount <= uip_ds6_if.maxdadns) - && (timer_expired(&locaddr->dadtimer)) - && (uip_len == 0)) { - uip_ds6_dad(locaddr); -#endif /* UIP_ND6_DEF_MAXDADNS > 0 */ - } - } - } - - /* Periodic processing on default routers */ - uip_ds6_defrt_periodic(); - /* for(locdefrt = uip_ds6_defrt_list; - locdefrt < uip_ds6_defrt_list + UIP_DS6_DEFRT_NB; locdefrt++) { - if((locdefrt->isused) && (!locdefrt->isinfinite) && - (stimer_expired(&(locdefrt->lifetime)))) { - uip_ds6_defrt_rm(locdefrt); - } - }*/ - -#if !UIP_CONF_ROUTER - /* Periodic processing on prefixes */ - for(locprefix = uip_ds6_prefix_list; - locprefix < uip_ds6_prefix_list + UIP_DS6_PREFIX_NB; - locprefix++) { - if(locprefix->isused && !locprefix->isinfinite - && stimer_expired(&(locprefix->vlifetime))) { - uip_ds6_prefix_rm(locprefix); - } - } -#endif /* !UIP_CONF_ROUTER */ - -#if UIP_ND6_SEND_NS - uip_ds6_neighbor_periodic(); -#endif /* UIP_ND6_SEND_NS */ - -#if UIP_CONF_ROUTER && UIP_ND6_SEND_RA - /* Periodic RA sending */ - if(stimer_expired(&uip_ds6_timer_ra) && (uip_len == 0)) { - uip_ds6_send_ra_periodic(); - } -#endif /* UIP_CONF_ROUTER && UIP_ND6_SEND_RA */ - etimer_reset(&uip_ds6_timer_periodic); - return; -} - -/*---------------------------------------------------------------------------*/ -uint8_t -uip_ds6_list_loop(uip_ds6_element_t *list, uint8_t size, - uint16_t elementsize, uip_ipaddr_t *ipaddr, - uint8_t ipaddrlen, uip_ds6_element_t **out_element) -{ - uip_ds6_element_t *element; - - if(list == NULL || ipaddr == NULL || out_element == NULL) { - return NOSPACE; - } - - *out_element = NULL; - - for(element = list; - element < - (uip_ds6_element_t *)((uint8_t *)list + (size * elementsize)); - element = (uip_ds6_element_t *)((uint8_t *)element + elementsize)) { - if(element->isused) { - if(uip_ipaddr_prefixcmp(&element->ipaddr, ipaddr, ipaddrlen)) { - *out_element = element; - return FOUND; - } - } else { - *out_element = element; - } - } - - return *out_element != NULL ? FREESPACE : NOSPACE; -} - -/*---------------------------------------------------------------------------*/ -#if UIP_CONF_ROUTER -/*---------------------------------------------------------------------------*/ -uip_ds6_prefix_t * -uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen, - uint8_t advertise, uint8_t flags, unsigned long vtime, - unsigned long ptime) -{ - if(uip_ds6_list_loop - ((uip_ds6_element_t *)uip_ds6_prefix_list, UIP_DS6_PREFIX_NB, - sizeof(uip_ds6_prefix_t), ipaddr, ipaddrlen, - (uip_ds6_element_t **)&locprefix) == FREESPACE) { - locprefix->isused = 1; - uip_ipaddr_copy(&locprefix->ipaddr, ipaddr); - locprefix->length = ipaddrlen; - locprefix->advertise = advertise; - locprefix->l_a_reserved = flags; - locprefix->vlifetime = vtime; - locprefix->plifetime = ptime; - LOG_INFO("Adding prefix "); - LOG_INFO_6ADDR(&locprefix->ipaddr); - LOG_INFO_("length %u, flags %x, Valid lifetime %lx, Preffered lifetime %lx\n", - ipaddrlen, flags, vtime, ptime); - return locprefix; - } else { - LOG_INFO("No more space in Prefix list\n"); - } - return NULL; -} - - -#else /* UIP_CONF_ROUTER */ -uip_ds6_prefix_t * -uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen, - unsigned long interval) -{ - if(uip_ds6_list_loop - ((uip_ds6_element_t *)uip_ds6_prefix_list, UIP_DS6_PREFIX_NB, - sizeof(uip_ds6_prefix_t), ipaddr, ipaddrlen, - (uip_ds6_element_t **)&locprefix) == FREESPACE) { - locprefix->isused = 1; - uip_ipaddr_copy(&locprefix->ipaddr, ipaddr); - locprefix->length = ipaddrlen; - if(interval != 0) { - stimer_set(&(locprefix->vlifetime), interval); - locprefix->isinfinite = 0; - } else { - locprefix->isinfinite = 1; - } - LOG_INFO("Adding prefix "); - LOG_INFO_6ADDR(&locprefix->ipaddr); - LOG_INFO_("length %u, vlifetime %lu\n", ipaddrlen, interval); - return locprefix; - } - return NULL; -} -#endif /* UIP_CONF_ROUTER */ - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_prefix_rm(uip_ds6_prefix_t *prefix) -{ - if(prefix != NULL) { - prefix->isused = 0; - } - return; -} -/*---------------------------------------------------------------------------*/ -uip_ds6_prefix_t * -uip_ds6_prefix_lookup(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen) -{ - if(uip_ds6_list_loop((uip_ds6_element_t *)uip_ds6_prefix_list, - UIP_DS6_PREFIX_NB, sizeof(uip_ds6_prefix_t), - ipaddr, ipaddrlen, - (uip_ds6_element_t **)&locprefix) == FOUND) { - return locprefix; - } - return NULL; -} - -/*---------------------------------------------------------------------------*/ -uint8_t -uip_ds6_is_addr_onlink(uip_ipaddr_t *ipaddr) -{ - for(locprefix = uip_ds6_prefix_list; - locprefix < uip_ds6_prefix_list + UIP_DS6_PREFIX_NB; locprefix++) { - if(locprefix->isused && - uip_ipaddr_prefixcmp(&locprefix->ipaddr, ipaddr, locprefix->length)) { - return 1; - } - } - return 0; -} - -/*---------------------------------------------------------------------------*/ -uip_ds6_addr_t * -uip_ds6_addr_add(uip_ipaddr_t *ipaddr, unsigned long vlifetime, uint8_t type) -{ - if(uip_ds6_list_loop - ((uip_ds6_element_t *)uip_ds6_if.addr_list, UIP_DS6_ADDR_NB, - sizeof(uip_ds6_addr_t), ipaddr, 128, - (uip_ds6_element_t **)&locaddr) == FREESPACE) { - locaddr->isused = 1; - uip_ipaddr_copy(&locaddr->ipaddr, ipaddr); - locaddr->type = type; - if(vlifetime == 0) { - locaddr->isinfinite = 1; - } else { - locaddr->isinfinite = 0; - stimer_set(&(locaddr->vlifetime), vlifetime); - } -#if UIP_ND6_DEF_MAXDADNS > 0 - locaddr->state = ADDR_TENTATIVE; - timer_set(&locaddr->dadtimer, - random_rand() % (UIP_ND6_MAX_RTR_SOLICITATION_DELAY * - CLOCK_SECOND)); - locaddr->dadnscount = 0; -#else /* UIP_ND6_DEF_MAXDADNS > 0 */ - locaddr->state = ADDR_PREFERRED; -#endif /* UIP_ND6_DEF_MAXDADNS > 0 */ - uip_create_solicited_node(ipaddr, &loc_fipaddr); - uip_ds6_maddr_add(&loc_fipaddr); - return locaddr; - } - return NULL; -} - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_addr_rm(uip_ds6_addr_t *addr) -{ - if(addr != NULL) { - uip_create_solicited_node(&addr->ipaddr, &loc_fipaddr); - if((locmaddr = uip_ds6_maddr_lookup(&loc_fipaddr)) != NULL) { - uip_ds6_maddr_rm(locmaddr); - } - addr->isused = 0; - } - return; -} - -/*---------------------------------------------------------------------------*/ -uip_ds6_addr_t * -uip_ds6_addr_lookup(uip_ipaddr_t *ipaddr) -{ - if(uip_ds6_list_loop - ((uip_ds6_element_t *)uip_ds6_if.addr_list, UIP_DS6_ADDR_NB, - sizeof(uip_ds6_addr_t), ipaddr, 128, - (uip_ds6_element_t **)&locaddr) == FOUND) { - return locaddr; - } - return NULL; -} - -/*---------------------------------------------------------------------------*/ -/* - * get a link local address - - * state = -1 => any address is ok. Otherwise state = desired state of addr. - * (TENTATIVE, PREFERRED, DEPRECATED) - */ -uip_ds6_addr_t * -uip_ds6_get_link_local(int8_t state) -{ - for(locaddr = uip_ds6_if.addr_list; - locaddr < uip_ds6_if.addr_list + UIP_DS6_ADDR_NB; locaddr++) { - if(locaddr->isused && (state == -1 || locaddr->state == state) - && (uip_is_addr_linklocal(&locaddr->ipaddr))) { - return locaddr; - } - } - return NULL; -} - -/*---------------------------------------------------------------------------*/ -/* - * get a global address - - * state = -1 => any address is ok. Otherwise state = desired state of addr. - * (TENTATIVE, PREFERRED, DEPRECATED) - */ -uip_ds6_addr_t * -uip_ds6_get_global(int8_t state) -{ - for(locaddr = uip_ds6_if.addr_list; - locaddr < uip_ds6_if.addr_list + UIP_DS6_ADDR_NB; locaddr++) { - if(locaddr->isused && (state == -1 || locaddr->state == state) - && !(uip_is_addr_linklocal(&locaddr->ipaddr))) { - return locaddr; - } - } - return NULL; -} - -/*---------------------------------------------------------------------------*/ -uip_ds6_maddr_t * -uip_ds6_maddr_add(const uip_ipaddr_t *ipaddr) -{ - if(uip_ds6_list_loop - ((uip_ds6_element_t *)uip_ds6_if.maddr_list, UIP_DS6_MADDR_NB, - sizeof(uip_ds6_maddr_t), (void*)ipaddr, 128, - (uip_ds6_element_t **)&locmaddr) == FREESPACE) { - locmaddr->isused = 1; - uip_ipaddr_copy(&locmaddr->ipaddr, ipaddr); - return locmaddr; - } - return NULL; -} - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_maddr_rm(uip_ds6_maddr_t *maddr) -{ - if(maddr != NULL) { - maddr->isused = 0; - } - return; -} - -/*---------------------------------------------------------------------------*/ -uip_ds6_maddr_t * -uip_ds6_maddr_lookup(const uip_ipaddr_t *ipaddr) -{ - if(uip_ds6_list_loop - ((uip_ds6_element_t *)uip_ds6_if.maddr_list, UIP_DS6_MADDR_NB, - sizeof(uip_ds6_maddr_t), (void*)ipaddr, 128, - (uip_ds6_element_t **)&locmaddr) == FOUND) { - return locmaddr; - } - return NULL; -} - - -/*---------------------------------------------------------------------------*/ -uip_ds6_aaddr_t * -uip_ds6_aaddr_add(uip_ipaddr_t *ipaddr) -{ -#if UIP_DS6_AADDR_NB - if(uip_ds6_list_loop - ((uip_ds6_element_t *)uip_ds6_if.aaddr_list, UIP_DS6_AADDR_NB, - sizeof(uip_ds6_aaddr_t), ipaddr, 128, - (uip_ds6_element_t **)&locaaddr) == FREESPACE) { - locaaddr->isused = 1; - uip_ipaddr_copy(&locaaddr->ipaddr, ipaddr); - return locaaddr; - } -#endif /* UIP_DS6_AADDR_NB */ - return NULL; -} - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_aaddr_rm(uip_ds6_aaddr_t *aaddr) -{ - if(aaddr != NULL) { - aaddr->isused = 0; - } - return; -} - -/*---------------------------------------------------------------------------*/ -uip_ds6_aaddr_t * -uip_ds6_aaddr_lookup(uip_ipaddr_t *ipaddr) -{ -#if UIP_DS6_AADDR_NB - if(uip_ds6_list_loop((uip_ds6_element_t *)uip_ds6_if.aaddr_list, - UIP_DS6_AADDR_NB, sizeof(uip_ds6_aaddr_t), ipaddr, 128, - (uip_ds6_element_t **)&locaaddr) == FOUND) { - return locaaddr; - } -#endif /* UIP_DS6_AADDR_NB */ - return NULL; -} - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_select_src(uip_ipaddr_t *src, uip_ipaddr_t *dst) -{ - uint8_t best = 0; /* number of bit in common with best match */ - uint8_t n = 0; - uip_ds6_addr_t *matchaddr = NULL; - - if(!uip_is_addr_linklocal(dst) && !uip_is_addr_mcast(dst)) { - /* find longest match */ - for(locaddr = uip_ds6_if.addr_list; - locaddr < uip_ds6_if.addr_list + UIP_DS6_ADDR_NB; locaddr++) { - /* Only preferred global (not link-local) addresses */ - if(locaddr->isused && locaddr->state == ADDR_PREFERRED && - !uip_is_addr_linklocal(&locaddr->ipaddr)) { - n = get_match_length(dst, &locaddr->ipaddr); - if(n >= best) { - best = n; - matchaddr = locaddr; - } - } - } -#if UIP_IPV6_MULTICAST - } else if(uip_is_addr_mcast_routable(dst)) { - matchaddr = uip_ds6_get_global(ADDR_PREFERRED); -#endif - } else { - matchaddr = uip_ds6_get_link_local(ADDR_PREFERRED); - } - - /* use the :: (unspecified address) as source if no match found */ - if(matchaddr == NULL) { - uip_create_unspecified(src); - } else { - uip_ipaddr_copy(src, &matchaddr->ipaddr); - } -} - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_set_addr_iid(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr) -{ -#if (UIP_LLADDR_LEN == 8) - memcpy(ipaddr->u8 + 8, lladdr, UIP_LLADDR_LEN); - ipaddr->u8[8] ^= 0x02; -#elif (UIP_LLADDR_LEN == 6) - memcpy(ipaddr->u8 + 8, lladdr, 3); - ipaddr->u8[11] = 0xff; - ipaddr->u8[12] = 0xfe; - memcpy(ipaddr->u8 + 13, (uint8_t *)lladdr + 3, 3); - ipaddr->u8[8] ^= 0x02; -#elif (UIP_LLADDR_LEN == 2) - /* derive IID as per RFC 6282 */ - memcpy(ipaddr->u8 + 8, iid_prefix, 6); - memcpy(ipaddr->u8 + 8 + 6, lladdr, UIP_LLADDR_LEN); -#else -#error uip-ds6.c cannot build interface address when UIP_LLADDR_LEN is not 6, 8, or 2 -#endif -} -/*---------------------------------------------------------------------------*/ -void -uip_ds6_set_lladdr_from_iid(uip_lladdr_t *lladdr, const uip_ipaddr_t *ipaddr) -{ -#if (UIP_LLADDR_LEN == 8) - memcpy(lladdr, ipaddr->u8 + 8, UIP_LLADDR_LEN); - lladdr->addr[0] ^= 0x02; -#elif (UIP_LLADDR_LEN == 2) - memcpy(lladdr, ipaddr->u8 + 6, UIP_LLADDR_LEN); -#else -#error uip-ds6.c cannot build lladdr address when UIP_LLADDR_LEN is not 8 or 2 -#endif -} - -/*---------------------------------------------------------------------------*/ -uint8_t -get_match_length(uip_ipaddr_t *src, uip_ipaddr_t *dst) -{ - uint8_t j, k, x_or; - uint8_t len = 0; - - for(j = 0; j < 16; j++) { - if(src->u8[j] == dst->u8[j]) { - len += 8; - } else { - x_or = src->u8[j] ^ dst->u8[j]; - for(k = 0; k < 8; k++) { - if((x_or & 0x80) == 0) { - len++; - x_or <<= 1; - } else { - break; - } - } - break; - } - } - return len; -} - -/*---------------------------------------------------------------------------*/ -#if UIP_ND6_DEF_MAXDADNS > 0 -void -uip_ds6_dad(uip_ds6_addr_t *addr) -{ - /* send maxdadns NS for DAD */ - if(addr->dadnscount < uip_ds6_if.maxdadns) { - uip_nd6_ns_output(NULL, NULL, &addr->ipaddr); - addr->dadnscount++; - timer_set(&addr->dadtimer, - uip_ds6_if.retrans_timer / 1000 * CLOCK_SECOND); - return; - } - /* - * If we arrive here it means DAD succeeded, otherwise the dad process - * would have been interrupted in ds6_dad_ns/na_input - */ - LOG_INFO("DAD succeeded, ipaddr: "); - LOG_INFO_6ADDR(&addr->ipaddr); - LOG_INFO_("\n"); - - addr->state = ADDR_PREFERRED; - return; -} - -/*---------------------------------------------------------------------------*/ -/* - * Calling code must handle when this returns 0 (e.g. link local - * address can not be used). - */ -int -uip_ds6_dad_failed(uip_ds6_addr_t *addr) -{ - if(uip_is_addr_linklocal(&addr->ipaddr)) { - LOG_ERR("Contiki shutdown, DAD for link local address failed\n"); - return 0; - } - uip_ds6_addr_rm(addr); - return 1; -} -#endif /*UIP_ND6_DEF_MAXDADNS > 0 */ - -/*---------------------------------------------------------------------------*/ -#if UIP_CONF_ROUTER -#if UIP_ND6_SEND_RA -void -uip_ds6_send_ra_sollicited(void) -{ - /* We have a pb here: RA timer max possible value is 1800s, - * hence we have to use stimers. However, when receiving a RS, we - * should delay the reply by a random value between 0 and 500ms timers. - * stimers are in seconds, hence we cannot do this. Therefore we just send - * the RA (setting the timer to 0 below). We keep the code logic for - * the days contiki will support appropriate timers */ - rand_time = 0; - LOG_INFO("Solicited RA, random time %u\n", rand_time); - - if(stimer_remaining(&uip_ds6_timer_ra) > rand_time) { - if(stimer_elapsed(&uip_ds6_timer_ra) < UIP_ND6_MIN_DELAY_BETWEEN_RAS) { - /* Ensure that the RAs are rate limited */ -/* stimer_set(&uip_ds6_timer_ra, rand_time + - UIP_ND6_MIN_DELAY_BETWEEN_RAS - - stimer_elapsed(&uip_ds6_timer_ra)); - */ } else { - stimer_set(&uip_ds6_timer_ra, rand_time); - } - } -} - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_send_ra_periodic(void) -{ - if(racount > 0) { - /* send previously scheduled RA */ - uip_nd6_ra_output(NULL); - LOG_INFO("Sending periodic RA\n"); - } - - rand_time = UIP_ND6_MIN_RA_INTERVAL + random_rand() % - (uint16_t) (UIP_ND6_MAX_RA_INTERVAL - UIP_ND6_MIN_RA_INTERVAL); - LOG_DBG("Random time 1 = %u\n", rand_time); - - if(racount < UIP_ND6_MAX_INITIAL_RAS) { - if(rand_time > UIP_ND6_MAX_INITIAL_RA_INTERVAL) { - rand_time = UIP_ND6_MAX_INITIAL_RA_INTERVAL; - LOG_DBG("Random time 2 = %u\n", rand_time); - } - racount++; - } - LOG_DBG("Random time 3 = %u\n", rand_time); - stimer_set(&uip_ds6_timer_ra, rand_time); -} - -#endif /* UIP_ND6_SEND_RA */ -#else /* UIP_CONF_ROUTER */ -/*---------------------------------------------------------------------------*/ -void -uip_ds6_send_rs(void) -{ - if((uip_ds6_defrt_choose() == NULL) - && (rscount < UIP_ND6_MAX_RTR_SOLICITATIONS)) { - LOG_INFO("Sending RS %u\n", rscount); - uip_nd6_rs_output(); - rscount++; - etimer_set(&uip_ds6_timer_rs, - UIP_ND6_RTR_SOLICITATION_INTERVAL * CLOCK_SECOND); - } else { - LOG_INFO("Router found ? (boolean): %u\n", - (uip_ds6_defrt_choose() != NULL)); - etimer_stop(&uip_ds6_timer_rs); - } - return; -} - -#endif /* UIP_CONF_ROUTER */ -/*---------------------------------------------------------------------------*/ -uint32_t -uip_ds6_compute_reachable_time(void) -{ - return (uint32_t) (UIP_ND6_MIN_RANDOM_FACTOR - (uip_ds6_if.base_reachable_time)) + - ((uint16_t) (random_rand() << 8) + - (uint16_t) random_rand()) % - (uint32_t) (UIP_ND6_MAX_RANDOM_FACTOR(uip_ds6_if.base_reachable_time) - - UIP_ND6_MIN_RANDOM_FACTOR(uip_ds6_if.base_reachable_time)); -} -/*---------------------------------------------------------------------------*/ - -/** @}*/ diff --git a/os/net/ipv6/uip-ds6.h b/os/net/ipv6/uip-ds6.h deleted file mode 100644 index 0edc1fd6d..000000000 --- a/os/net/ipv6/uip-ds6.h +++ /dev/null @@ -1,390 +0,0 @@ -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * Header file for IPv6-related data structures - * \author Mathilde Durvy - * \author Julien Abeille - * - */ -/* - * - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 UIP_DS6_H_ -#define UIP_DS6_H_ - -#include "net/ipv6/uip.h" -#include "sys/stimer.h" -/* The size of uip_ds6_addr_t depends on UIP_ND6_DEF_MAXDADNS. Include uip-nd6.h to define it. */ -#include "net/ipv6/uip-nd6.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/ipv6/uip-ds6-route.h" - -/*--------------------------------------------------*/ -/** Configuration. For all tables (Neighbor cache, Prefix List, Routing Table, - * Default Router List, Unicast address list, multicast address list, anycast address list), - * we define: - * - the number of elements requested by the user in contiki configuration (name suffixed by _NBU) - * - the number of elements assigned by the system (name suffixed by _NBS) - * - the total number of elements is the sum (name suffixed by _NB) - * The routing table definitions can be found in uip-ds6-route.h - * The Neighbor cache definitions can be found in nbr-table.h -*/ - -/* Default router list */ -#define UIP_DS6_DEFRT_NBS 0 -#ifndef UIP_CONF_DS6_DEFRT_NBU -#define UIP_DS6_DEFRT_NBU 2 -#else -#define UIP_DS6_DEFRT_NBU UIP_CONF_DS6_DEFRT_NBU -#endif -#define UIP_DS6_DEFRT_NB UIP_DS6_DEFRT_NBS + UIP_DS6_DEFRT_NBU - -/* Default prefix */ -#ifdef UIP_CONF_DS6_DEFAULT_PREFIX -#define UIP_DS6_DEFAULT_PREFIX UIP_CONF_DS6_DEFAULT_PREFIX -#else -/* From RFC4193, section 3.1: - * | 7 bits |1| 40 bits | 16 bits | 64 bits | - * +--------+-+------------+-----------+----------------------------+ - * | Prefix |L| Global ID | Subnet ID | Interface ID | - * +--------+-+------------+-----------+----------------------------+ - * Prefix FC00::/7 prefix to identify Local IPv6 unicast - * addresses. - * L Set to 1 if the prefix is locally assigned. - * Set to 0 may be defined in the future. See - * Section 3.2 for additional information. - * Global ID 40-bit global identifier used to create a - * globally unique prefix. See Section 3.2 for - * additional information. - * - * We set prefix to 0xfc00 and set the local bit, resulting in 0xfd00. - * For high probability of network uniqueness, Global ID must be generated - * pseudo-randomly. As this is a hard-coded default prefix, we simply use - * a Global ID of 0. For real deployments, make sure to install a pseudo-random - * Global ID, e.g. in a RPL network, by configuring it at the root. - */ -#define UIP_DS6_DEFAULT_PREFIX 0xfd00 -#endif /* UIP_CONF_DS6_DEFAULT_PREFIX */ - -#define UIP_DS6_DEFAULT_PREFIX_0 ((UIP_DS6_DEFAULT_PREFIX >> 8) & 0xff) -#define UIP_DS6_DEFAULT_PREFIX_1 (UIP_DS6_DEFAULT_PREFIX & 0xff) - -/* Prefix list */ -#define UIP_DS6_PREFIX_NBS 1 -#ifndef UIP_CONF_DS6_PREFIX_NBU -#define UIP_DS6_PREFIX_NBU 2 -#else -#define UIP_DS6_PREFIX_NBU UIP_CONF_DS6_PREFIX_NBU -#endif -#define UIP_DS6_PREFIX_NB UIP_DS6_PREFIX_NBS + UIP_DS6_PREFIX_NBU - -/* Unicast address list*/ -#define UIP_DS6_ADDR_NBS 1 -#ifndef UIP_CONF_DS6_ADDR_NBU -#define UIP_DS6_ADDR_NBU 2 -#else -#define UIP_DS6_ADDR_NBU UIP_CONF_DS6_ADDR_NBU -#endif -#define UIP_DS6_ADDR_NB UIP_DS6_ADDR_NBS + UIP_DS6_ADDR_NBU - -/* Multicast address list */ -#if UIP_CONF_ROUTER -#define UIP_DS6_MADDR_NBS 2 + UIP_DS6_ADDR_NB /* all routers + all nodes + one solicited per unicast */ -#else -#define UIP_DS6_MADDR_NBS 1 + UIP_DS6_ADDR_NB /* all nodes + one solicited per unicast */ -#endif -#ifndef UIP_CONF_DS6_MADDR_NBU -#define UIP_DS6_MADDR_NBU 0 -#else -#define UIP_DS6_MADDR_NBU UIP_CONF_DS6_MADDR_NBU -#endif -#define UIP_DS6_MADDR_NB UIP_DS6_MADDR_NBS + UIP_DS6_MADDR_NBU - -/* Anycast address list */ -#if UIP_CONF_ROUTER -#define UIP_DS6_AADDR_NBS UIP_DS6_PREFIX_NB - 1 /* One per non link local prefix (subnet prefix anycast address) */ -#else -#define UIP_DS6_AADDR_NBS 0 -#endif -#ifndef UIP_CONF_DS6_AADDR_NBU -#define UIP_DS6_AADDR_NBU 0 -#else -#define UIP_DS6_AADDR_NBU UIP_CONF_DS6_AADDR_NBU -#endif -#define UIP_DS6_AADDR_NB UIP_DS6_AADDR_NBS + UIP_DS6_AADDR_NBU - -/*--------------------------------------------------*/ -/* Should we use LinkLayer acks in NUD ?*/ -#ifndef UIP_CONF_DS6_LL_NUD -#define UIP_DS6_LL_NUD 0 -#else -#define UIP_DS6_LL_NUD UIP_CONF_DS6_LL_NUD -#endif - -/** \brief Possible states for the an address (RFC 4862) */ -#define ADDR_TENTATIVE 0 -#define ADDR_PREFERRED 1 -#define ADDR_DEPRECATED 2 - -/** \brief How the address was acquired: Autoconf, DHCP or manually */ -#define ADDR_ANYTYPE 0 -#define ADDR_AUTOCONF 1 -#define ADDR_DHCP 2 -#define ADDR_MANUAL 3 - -/** \brief General DS6 definitions */ -/** Period for uip-ds6 periodic task*/ -#ifndef UIP_DS6_CONF_PERIOD -#define UIP_DS6_PERIOD (CLOCK_SECOND/10) -#else -#define UIP_DS6_PERIOD UIP_DS6_CONF_PERIOD -#endif - -#define FOUND 0 -#define FREESPACE 1 -#define NOSPACE 2 -/*--------------------------------------------------*/ - -#if UIP_CONF_IPV6_QUEUE_PKT -#include "net/ipv6/uip-packetqueue.h" -#endif /*UIP_CONF_QUEUE_PKT */ - -/** \brief A prefix list entry */ -#if UIP_CONF_ROUTER -typedef struct uip_ds6_prefix { - uint8_t isused; - uip_ipaddr_t ipaddr; - uint8_t length; - uint8_t advertise; - uint32_t vlifetime; - uint32_t plifetime; - uint8_t l_a_reserved; /**< on-link and autonomous flags + 6 reserved bits */ -} uip_ds6_prefix_t; -#else /* UIP_CONF_ROUTER */ -typedef struct uip_ds6_prefix { - uint8_t isused; - uip_ipaddr_t ipaddr; - uint8_t length; - struct stimer vlifetime; - uint8_t isinfinite; -} uip_ds6_prefix_t; -#endif /*UIP_CONF_ROUTER */ - -/** * \brief Unicast address structure */ -typedef struct uip_ds6_addr { - uint8_t isused; - uip_ipaddr_t ipaddr; - uint8_t state; - uint8_t type; - uint8_t isinfinite; - struct stimer vlifetime; -#if UIP_ND6_DEF_MAXDADNS > 0 - struct timer dadtimer; - uint8_t dadnscount; -#endif /* UIP_ND6_DEF_MAXDADNS > 0 */ -} uip_ds6_addr_t; - -/** \brief Anycast address */ -typedef struct uip_ds6_aaddr { - uint8_t isused; - uip_ipaddr_t ipaddr; -} uip_ds6_aaddr_t; - -/** \brief A multicast address */ -typedef struct uip_ds6_maddr { - uint8_t isused; - uip_ipaddr_t ipaddr; -} uip_ds6_maddr_t; - -/** \brief Interface structure (contains all the interface variables) */ -typedef struct uip_ds6_netif { - uint32_t link_mtu; - uint8_t cur_hop_limit; - uint32_t base_reachable_time; /* in msec */ - uint32_t reachable_time; /* in msec */ - uint32_t retrans_timer; /* in msec */ - uint8_t maxdadns; -#if UIP_DS6_ADDR_NB - uip_ds6_addr_t addr_list[UIP_DS6_ADDR_NB]; -#endif /* UIP_DS6_ADDR_NB */ -#if UIP_DS6_AADDR_NB - uip_ds6_aaddr_t aaddr_list[UIP_DS6_AADDR_NB]; -#endif /* UIP_DS6_AADDR_NB */ -#if UIP_DS6_MADDR_NB - uip_ds6_maddr_t maddr_list[UIP_DS6_MADDR_NB]; -#endif /* UIP_DS6_MADDR_NB */ -} uip_ds6_netif_t; - -/** \brief Generic type for a DS6, to use a common loop though all DS */ -typedef struct uip_ds6_element { - uint8_t isused; - uip_ipaddr_t ipaddr; -} uip_ds6_element_t; - - -/*---------------------------------------------------------------------------*/ -extern uip_ds6_netif_t uip_ds6_if; -extern struct etimer uip_ds6_timer_periodic; - -#if UIP_CONF_ROUTER -extern uip_ds6_prefix_t uip_ds6_prefix_list[UIP_DS6_PREFIX_NB]; -#else /* UIP_CONF_ROUTER */ -extern struct etimer uip_ds6_timer_rs; -#endif /* UIP_CONF_ROUTER */ - - -/*---------------------------------------------------------------------------*/ -/** \brief Initialize data structures */ -void uip_ds6_init(void); - -/** \brief Periodic processing of data structures */ -void uip_ds6_periodic(void); - -/** \brief Generic loop routine on an abstract data structure, which generalizes - * all data structures used in DS6 */ -uint8_t uip_ds6_list_loop(uip_ds6_element_t *list, uint8_t size, - uint16_t elementsize, uip_ipaddr_t *ipaddr, - uint8_t ipaddrlen, - uip_ds6_element_t **out_element); - -/** @} */ - - -/** \name Prefix list basic routines */ -/** @{ */ -#if UIP_CONF_ROUTER -uip_ds6_prefix_t *uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t length, - uint8_t advertise, uint8_t flags, - unsigned long vtime, - unsigned long ptime); -#else /* UIP_CONF_ROUTER */ -uip_ds6_prefix_t *uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t length, - unsigned long interval); -#endif /* UIP_CONF_ROUTER */ -void uip_ds6_prefix_rm(uip_ds6_prefix_t *prefix); -uip_ds6_prefix_t *uip_ds6_prefix_lookup(uip_ipaddr_t *ipaddr, - uint8_t ipaddrlen); -uint8_t uip_ds6_is_addr_onlink(uip_ipaddr_t *ipaddr); - -/** - * \brief Retrieve the Default IPv6 prefix - * \retval A pointer to the default prefix - */ -const uip_ip6addr_t *uip_ds6_default_prefix(void); - -/** - * \brief Set the Default IPv6 prefix - * \param prefix A pointer to the new default prefix - * - * uip_ds6_init() will set the default prefix to UIP_DS6_DEFAULT_PREFIX - * unless this function here has been called beforehand to set a new default - * prefix. - */ -void uip_ds6_set_default_prefix(const uip_ip6addr_t *prefix); - -/** @} */ - -/** \name Unicast address list basic routines */ -/** @{ */ -/** \brief Add a unicast address to the interface */ -uip_ds6_addr_t *uip_ds6_addr_add(uip_ipaddr_t *ipaddr, - unsigned long vlifetime, uint8_t type); -void uip_ds6_addr_rm(uip_ds6_addr_t *addr); -uip_ds6_addr_t *uip_ds6_addr_lookup(uip_ipaddr_t *ipaddr); -uip_ds6_addr_t *uip_ds6_get_link_local(int8_t state); -uip_ds6_addr_t *uip_ds6_get_global(int8_t state); - -/** @} */ - -/** \name Multicast address list basic routines */ -/** @{ */ -uip_ds6_maddr_t *uip_ds6_maddr_add(const uip_ipaddr_t *ipaddr); -void uip_ds6_maddr_rm(uip_ds6_maddr_t *maddr); -uip_ds6_maddr_t *uip_ds6_maddr_lookup(const uip_ipaddr_t *ipaddr); - -/** @} */ - -/** \name Anycast address list basic routines */ -/** @{ */ -uip_ds6_aaddr_t *uip_ds6_aaddr_add(uip_ipaddr_t *ipaddr); -void uip_ds6_aaddr_rm(uip_ds6_aaddr_t *aaddr); -uip_ds6_aaddr_t *uip_ds6_aaddr_lookup(uip_ipaddr_t *ipaddr); - -/** @} */ - - -/** \brief set the last 64 bits of an IP address based on the MAC address */ -void uip_ds6_set_addr_iid(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr); - -/** \brief Build a link-layer address from an IPv6 address based on its UUID64 */ -void uip_ds6_set_lladdr_from_iid(uip_lladdr_t *lladdr, const uip_ipaddr_t *ipaddr); - -/** \brief Get the number of matching bits of two addresses */ -uint8_t get_match_length(uip_ipaddr_t *src, uip_ipaddr_t *dst); - -#if UIP_ND6_DEF_MAXDADNS >0 -/** \brief Perform Duplicate Address Selection on one address */ -void uip_ds6_dad(uip_ds6_addr_t *ifaddr); - -/** \brief Callback when DAD failed */ -int uip_ds6_dad_failed(uip_ds6_addr_t *ifaddr); -#endif /* UIP_ND6_DEF_MAXDADNS */ - -/** \brief Source address selection, see RFC 3484 */ -void uip_ds6_select_src(uip_ipaddr_t *src, uip_ipaddr_t *dst); - -#if UIP_CONF_ROUTER -#if UIP_ND6_SEND_RA -/** \brief Send a RA as an asnwer to a RS */ -void uip_ds6_send_ra_sollicited(void); - -/** \brief Send a periodic RA */ -void uip_ds6_send_ra_periodic(void); -#endif /* UIP_ND6_SEND_RA */ -#else /* UIP_CONF_ROUTER */ -/** \brief Send periodic RS to find router */ -void uip_ds6_send_rs(void); -#endif /* UIP_CONF_ROUTER */ - -/** \brief Compute the reachable time based on base reachable time, see RFC 4861*/ -uint32_t uip_ds6_compute_reachable_time(void); /** \brief compute random reachable timer */ - -/** \name Macros to check if an IP address (unicast, multicast or anycast) is mine */ -/** @{ */ -#define uip_ds6_is_my_addr(addr) (uip_ds6_addr_lookup(addr) != NULL) -#define uip_ds6_is_my_maddr(addr) (uip_ds6_maddr_lookup(addr) != NULL) -#define uip_ds6_is_my_aaddr(addr) (uip_ds6_aaddr_lookup(addr) != NULL) -/** @} */ -/** @} */ - -#endif /* UIP_DS6_H_ */ diff --git a/os/net/ipv6/uip-icmp6.c b/os/net/ipv6/uip-icmp6.c deleted file mode 100644 index 18dcef89c..000000000 --- a/os/net/ipv6/uip-icmp6.c +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * ICMPv6 (RFC 4443) implementation, with message and error handling - * \author Julien Abeille - * \author Mathilde Durvy - */ - -#include -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-icmp6.h" -#include "contiki-default-conf.h" -#include "net/routing/routing.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "ICMPv6" -#define LOG_LEVEL LOG_LEVEL_IPV6 - -#define UIP_ICMP6_ERROR_BUF ((struct uip_icmp6_error *)UIP_ICMP_PAYLOAD) - -/** \brief temporary IP address */ -static uip_ipaddr_t tmp_ipaddr; - -LIST(echo_reply_callback_list); -/*---------------------------------------------------------------------------*/ -/* List of input handlers */ -LIST(input_handler_list); -/*---------------------------------------------------------------------------*/ -static uip_icmp6_input_handler_t * -input_handler_lookup(uint8_t type, uint8_t icode) -{ - uip_icmp6_input_handler_t *handler = NULL; - - for(handler = list_head(input_handler_list); - handler != NULL; - handler = list_item_next(handler)) { - if(handler->type == type && - (handler->icode == icode || - handler->icode == UIP_ICMP6_HANDLER_CODE_ANY)) { - return handler; - } - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -uint8_t -uip_icmp6_input(uint8_t type, uint8_t icode) -{ - uip_icmp6_input_handler_t *handler = input_handler_lookup(type, icode); - - if(handler == NULL) { - return UIP_ICMP6_INPUT_ERROR; - } - - if(handler->handler == NULL) { - return UIP_ICMP6_INPUT_ERROR; - } - - handler->handler(); - return UIP_ICMP6_INPUT_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -void -uip_icmp6_register_input_handler(uip_icmp6_input_handler_t *handler) -{ - list_add(input_handler_list, handler); -} -/*---------------------------------------------------------------------------*/ -static void -echo_request_input(void) -{ - /* - * we send an echo reply. It is trivial if there was no extension - * headers in the request otherwise we need to remove the extension - * headers and change a few fields - */ - LOG_INFO("Received Echo Request from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - - /* IP header */ - UIP_IP_BUF->ttl = uip_ds6_if.cur_hop_limit; - - if(uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)){ - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &UIP_IP_BUF->srcipaddr); - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - } else { - uip_ipaddr_copy(&tmp_ipaddr, &UIP_IP_BUF->srcipaddr); - uip_ipaddr_copy(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &tmp_ipaddr); - } - - uip_remove_ext_hdr(); - - /* Below is important for the correctness of UIP_ICMP_BUF and the - * checksum - */ - - /* Note: now UIP_ICMP_BUF points to the beginning of the echo reply */ - UIP_ICMP_BUF->type = ICMP6_ECHO_REPLY; - UIP_ICMP_BUF->icode = 0; - UIP_ICMP_BUF->icmpchksum = 0; - UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); - - LOG_INFO("Sending Echo Reply to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(" from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - UIP_STAT(++uip_stat.icmp.sent); - return; -} -/*---------------------------------------------------------------------------*/ -void -uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) { - /* check if originating packet is not an ICMP error */ - uint16_t shift; - if(uip_last_proto == UIP_PROTO_ICMP6 && UIP_ICMP_BUF->type < 128) { - uipbuf_clear(); - return; - } - - /* Remove all extension headers related to the routing protocol in place. - * Keep all other extension headers, so as to match original packet. */ - NETSTACK_ROUTING.ext_header_remove(); - - /* remember data of original packet before shifting */ - uip_ipaddr_copy(&tmp_ipaddr, &UIP_IP_BUF->destipaddr); - - /* The ICMPv6 error message contains as much of possible of the invoking packet - * (see RFC 4443 section 3). Make space for the additional IPv6 and - * ICMPv6 headers here and move payload to the "right". What we move includes - * extension headers */ - shift = UIP_IPH_LEN + UIP_ICMPH_LEN + UIP_ICMP6_ERROR_LEN; - uip_len += shift; - uip_len = MIN(uip_len, UIP_LINK_MTU); - memmove(uip_buf + shift, (void *)UIP_IP_BUF, uip_len - shift); - - UIP_IP_BUF->vtc = 0x60; - UIP_IP_BUF->tcflow = 0; - UIP_IP_BUF->flow = 0; - UIP_IP_BUF->proto = UIP_PROTO_ICMP6; - UIP_IP_BUF->ttl = uip_ds6_if.cur_hop_limit; - - /* the source should not be unspecified nor multicast, the check for - multicast is done in uip_process */ - if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)){ - uipbuf_clear(); - return; - } - - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &UIP_IP_BUF->srcipaddr); - - if(uip_is_addr_mcast(&tmp_ipaddr)){ - if(type == ICMP6_PARAM_PROB && code == ICMP6_PARAMPROB_OPTION){ - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &tmp_ipaddr); - } else { - uipbuf_clear(); - return; - } - } else { - /* need to pick a source that corresponds to this node */ - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &tmp_ipaddr); - } - - UIP_ICMP_BUF->type = type; - UIP_ICMP_BUF->icode = code; - UIP_ICMP6_ERROR_BUF->param = uip_htonl(param); - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - UIP_ICMP_BUF->icmpchksum = 0; - UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); - - UIP_STAT(++uip_stat.icmp.sent); - - LOG_WARN("Sending ICMPv6 ERROR message type %d code %d to ", type, code); - LOG_WARN_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_WARN_(" from "); - LOG_WARN_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_WARN_("\n"); - return; -} - -/*---------------------------------------------------------------------------*/ -void -uip_icmp6_send(const uip_ipaddr_t *dest, int type, int code, int payload_len) -{ - UIP_IP_BUF->vtc = 0x60; - UIP_IP_BUF->tcflow = 0; - UIP_IP_BUF->flow = 0; - UIP_IP_BUF->proto = UIP_PROTO_ICMP6; - UIP_IP_BUF->ttl = uip_ds6_if.cur_hop_limit; - uipbuf_set_len_field(UIP_IP_BUF, UIP_ICMPH_LEN + payload_len); - - memcpy(&UIP_IP_BUF->destipaddr, dest, sizeof(*dest)); - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - - UIP_ICMP_BUF->type = type; - UIP_ICMP_BUF->icode = code; - - UIP_ICMP_BUF->icmpchksum = 0; - UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); - - uip_len = UIP_IPH_LEN + UIP_ICMPH_LEN + payload_len; - - UIP_STAT(++uip_stat.icmp.sent); - UIP_STAT(++uip_stat.ip.sent); - - LOG_INFO("Sending ICMPv6 packet to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(", type %u, code %u, len %u\n", type, code, payload_len); - - tcpip_ipv6_output(); -} -/*---------------------------------------------------------------------------*/ -static void -echo_reply_input(void) -{ - int ttl; - uip_ipaddr_t sender; - - LOG_INFO("Received Echo Reply from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - - uip_ipaddr_copy(&sender, &UIP_IP_BUF->srcipaddr); - ttl = UIP_IP_BUF->ttl; - - uip_remove_ext_hdr(); - - /* Call all registered applications to let them know an echo reply - has been received. */ - { - struct uip_icmp6_echo_reply_notification *n; - for(n = list_head(echo_reply_callback_list); - n != NULL; - n = list_item_next(n)) { - if(n->callback != NULL) { - n->callback(&sender, ttl, - (uint8_t *)&UIP_ICMP_BUF[sizeof(struct uip_icmp_hdr)], - uip_len - sizeof(struct uip_icmp_hdr) - UIP_IPH_LEN); - } - } - } - - uipbuf_clear(); - return; -} -/*---------------------------------------------------------------------------*/ -void -uip_icmp6_echo_reply_callback_add(struct uip_icmp6_echo_reply_notification *n, - uip_icmp6_echo_reply_callback_t c) -{ - if(n != NULL && c != NULL) { - n->callback = c; - list_add(echo_reply_callback_list, n); - } -} -/*---------------------------------------------------------------------------*/ -void -uip_icmp6_echo_reply_callback_rm(struct uip_icmp6_echo_reply_notification *n) -{ - list_remove(echo_reply_callback_list, n); -} -/*---------------------------------------------------------------------------*/ -UIP_ICMP6_HANDLER(echo_request_handler, ICMP6_ECHO_REQUEST, - UIP_ICMP6_HANDLER_CODE_ANY, echo_request_input); -UIP_ICMP6_HANDLER(echo_reply_handler, ICMP6_ECHO_REPLY, - UIP_ICMP6_HANDLER_CODE_ANY, echo_reply_input); -/*---------------------------------------------------------------------------*/ -void -uip_icmp6_init() -{ - /* Register Echo Request and Reply handlers */ - uip_icmp6_register_input_handler(&echo_request_handler); - uip_icmp6_register_input_handler(&echo_reply_handler); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/uip-icmp6.h b/os/net/ipv6/uip-icmp6.h deleted file mode 100644 index 5f8caf080..000000000 --- a/os/net/ipv6/uip-icmp6.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * Header file for ICMPv6 message and error handing (RFC 4443) - * \author Julien Abeille - * \author Mathilde Durvy - */ - -#ifndef ICMP6_H_ -#define ICMP6_H_ - -#include "net/ipv6/uip.h" - - -/** \name ICMPv6 message types */ -/** @{ */ -#define ICMP6_DST_UNREACH 1 /**< dest unreachable */ -#define ICMP6_PACKET_TOO_BIG 2 /**< packet too big */ -#define ICMP6_TIME_EXCEEDED 3 /**< time exceeded */ -#define ICMP6_PARAM_PROB 4 /**< ip6 header bad */ -#define ICMP6_ECHO_REQUEST 128 /**< Echo request */ -#define ICMP6_ECHO_REPLY 129 /**< Echo reply */ - -#define ICMP6_RS 133 /**< Router Solicitation */ -#define ICMP6_RA 134 /**< Router Advertisement */ -#define ICMP6_NS 135 /**< Neighbor Solicitation */ -#define ICMP6_NA 136 /**< Neighbor advertisement */ -#define ICMP6_REDIRECT 137 /**< Redirect */ - -#define ICMP6_RPL 155 /**< RPL */ -#define ICMP6_PRIV_EXP_100 100 /**< Private Experimentation */ -#define ICMP6_PRIV_EXP_101 101 /**< Private Experimentation */ -#define ICMP6_PRIV_EXP_200 200 /**< Private Experimentation */ -#define ICMP6_PRIV_EXP_201 201 /**< Private Experimentation */ -#define ICMP6_ROLL_TM ICMP6_PRIV_EXP_200 /**< ROLL Trickle Multicast */ -#define ICMP6_ESMRF ICMP6_PRIV_EXP_201 /**< ESMRF Multicast */ -/** @} */ - - -/** \name ICMPv6 Destination Unreachable message codes*/ -/** @{ */ -#define ICMP6_DST_UNREACH_NOROUTE 0 /**< no route to destination */ -#define ICMP6_DST_UNREACH_ADMIN 1 /**< administratively prohibited */ -#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /**< not a neighbor(obsolete) */ -#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /**< beyond scope of source address */ -#define ICMP6_DST_UNREACH_ADDR 3 /**< address unreachable */ -#define ICMP6_DST_UNREACH_NOPORT 4 /**< port unreachable */ -/** @} */ - -/** \name ICMPv6 Time Exceeded message codes*/ -/** @{ */ -#define ICMP6_TIME_EXCEED_TRANSIT 0 /**< ttl==0 in transit */ -#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /**< ttl==0 in reass */ -/** @} */ - -/** \name ICMPv6 Parameter Problem message codes*/ -/** @{ */ -#define ICMP6_PARAMPROB_HEADER 0 /**< erroneous header field */ -#define ICMP6_PARAMPROB_NEXTHEADER 1 /**< unrecognized next header */ -#define ICMP6_PARAMPROB_OPTION 2 /**< unrecognized option */ -/** @} */ - -/** \brief Echo Request constant part length */ -#define UIP_ICMP6_ECHO_REQUEST_LEN 4 - -/** \brief ICMPv6 Error message constant part length */ -#define UIP_ICMP6_ERROR_LEN 4 - -/** \brief ICMPv6 Error message constant part */ -typedef struct uip_icmp6_error{ - uint32_t param; -} uip_icmp6_error; - -/** \name ICMPv6 RFC4443 Message processing and sending */ -/** @{ */ -/** - * \brief Send an icmpv6 error message - * \param type type of the error message - * \param code of the error message - * \param param 32 bit parameter of the error message, semantic depends on error - */ -void -uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param); - -/** - * \brief Send an icmpv6 message - * \param dest destination address of the message - * \param type type of the message - * \param code of the message - * \param payload_len length of the payload - */ -void -uip_icmp6_send(const uip_ipaddr_t *dest, int type, int code, int payload_len); - - - -typedef void (* uip_icmp6_echo_reply_callback_t)(uip_ipaddr_t *source, - uint8_t ttl, - uint8_t *data, - uint16_t datalen); -struct uip_icmp6_echo_reply_notification { - struct uip_icmp6_echo_reply_notification *next; - uip_icmp6_echo_reply_callback_t callback; -}; - -/** - * \brief Add a callback function for ping replies - * \param n A struct uip_icmp6_echo_reply_notification that must have been allocated by the caller - * \param c A pointer to the callback function to be called - * - * This function adds a callback function to the list of - * callback functions that are called when an ICMP echo - * reply (ping reply) is received. This is used when - * implementing a ping protocol: attach a callback - * function to the ping reply, then send out a ping packet - * with uip_icmp6_send(). - * - * The caller must have statically allocated a struct - * uip_icmp6_echo_reply_notification to hold the internal - * state of the callback function. - * - * When a ping reply packet is received, all registered - * callback functions are called. The callback functions - * must not modify the contents of the uIP buffer. - */ -void -uip_icmp6_echo_reply_callback_add(struct uip_icmp6_echo_reply_notification *n, - uip_icmp6_echo_reply_callback_t c); - -/** - * \brief Remove a callback function for ping replies - * \param n A struct uip_icmp6_echo_reply_notification that must have been previously added with uip_icmp6_echo_reply_callback_add() - * - * This function removes a callback function from the list of - * callback functions that are called when an ICMP echo - * reply (ping reply) is received. - */ -void -uip_icmp6_echo_reply_callback_rm(struct uip_icmp6_echo_reply_notification *n); - -/* Generic ICMPv6 input handers */ -typedef struct uip_icmp6_input_handler { - struct uip_icmp6_input_handler *next; - uint8_t type; - uint8_t icode; - void (*handler)(void); -} uip_icmp6_input_handler_t; - -#define UIP_ICMP6_INPUT_SUCCESS 0 -#define UIP_ICMP6_INPUT_ERROR 1 - -#define UIP_ICMP6_HANDLER_CODE_ANY 0xFF /* Handle all codes for this type */ - -/* - * Initialise a variable of type uip_icmp6_input_handler, to be used later as - * the argument to uip_icmp6_register_input_handler - * - * The function pointer stored in this variable will get called and will be - * expected to handle incoming ICMPv6 datagrams of the specified type/code - * - * If code has a value of UIP_ICMP6_HANDLER_CODE_ANY, the same function - * will handle all codes for this type. In other words, the ICMPv6 - * message's code is "don't care" - */ -#define UIP_ICMP6_HANDLER(name, type, code, func) \ - static uip_icmp6_input_handler_t name = { NULL, type, code, func } - -/** - * \brief Handle an incoming ICMPv6 message - * \param type The ICMPv6 message type - * \param icode The ICMPv6 message code - * \return Success: UIP_ICMP6_INPUT_SUCCESS, Error: UIP_ICMP6_INPUT_ERROR - * - * Generic handler for unknown ICMPv6 types. It will lookup for a registered - * function capable of handing this message type. The function must have first - * been registered with uip_icmp6_register_input_handler. The function is in - * charge of setting uip_len to 0, otherwise the uIPv6 core will attempt to - * send whatever remains in the UIP_IP_BUF. - * - * A return value of UIP_ICMP6_INPUT_ERROR means that a handler could not be - * invoked. This is most likely because the ICMPv6 type does not have a valid - * handler associated with it. - - * UIP_ICMP6_INPUT_SUCCESS signifies that a handler was found for this ICMPv6 - * type and that it was invoked. It does NOT provide any indication whatsoever - * regarding whether the handler itself succeeded. - */ -uint8_t uip_icmp6_input(uint8_t type, uint8_t icode); - -/** - * \brief Register a handler which can handle a specific ICMPv6 message type - * \param handler A pointer to the handler - */ -void uip_icmp6_register_input_handler(uip_icmp6_input_handler_t *handler); - - -/** - * \brief Initialise the uIP ICMPv6 core - */ -void uip_icmp6_init(void); - -/** @} */ - -#endif /*ICMP6_H_*/ -/** @} */ - diff --git a/os/net/ipv6/uip-nameserver.c b/os/net/ipv6/uip-nameserver.c deleted file mode 100644 index 755b33992..000000000 --- a/os/net/ipv6/uip-nameserver.c +++ /dev/null @@ -1,232 +0,0 @@ -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * uIP Name Server interface - * \author Víctor Ariño - */ - -/* - * Copyright (c) 2014, tado° GmbH. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "contiki-net.h" - -#include "lib/list.h" -#include "lib/memb.h" - -#include -/** \brief Nameserver record */ -typedef struct uip_nameserver_record { - struct uip_nameserver_record *next; - uip_ipaddr_t ip; - uint32_t added; - uint32_t lifetime; -} uip_nameserver_record; - -#if UIP_NAMESERVER_POOL_SIZE > 1 -/** \brief Initialization flag */ -static uint8_t initialized = 0; -#endif /* UIP_NAMESERVER_POOL_SIZE > 1 */ - -/** \name List and memory block - * @{ - */ -#if UIP_NAMESERVER_POOL_SIZE > 1 -LIST(dns); -MEMB(dnsmemb, uip_nameserver_record, UIP_NAMESERVER_POOL_SIZE); -#else /* UIP_NAMESERVER_POOL_SIZE > 1 */ -static uip_ipaddr_t serveraddr; -static uint32_t serverlifetime; -#endif /* UIP_NAMESERVER_POOL_SIZE > 1 */ -/** @} */ - -/** \brief Expiration time in seconds */ -#define DNS_EXPIRATION(r) \ - (((UIP_NAMESERVER_INFINITE_LIFETIME - r->added) <= r->lifetime) ? \ - UIP_NAMESERVER_INFINITE_LIFETIME : r->added + r->lifetime) -/*----------------------------------------------------------------------------*/ -/** - * Initialize the module variables - */ -#if UIP_NAMESERVER_POOL_SIZE > 1 -static CC_INLINE void -init(void) -{ - list_init(dns); - memb_init(&dnsmemb); - initialized = 1; -} -#endif /* UIP_NAMESERVER_POOL_SIZE > 1 */ -/*----------------------------------------------------------------------------*/ -void -uip_nameserver_update(const uip_ipaddr_t *nameserver, uint32_t lifetime) -{ -#if UIP_NAMESERVER_POOL_SIZE > 1 - register uip_nameserver_record *e; - - if(initialized == 0) { - init(); - } - - for(e = list_head(dns); e != NULL; e = list_item_next(e)) { - if(uip_ipaddr_cmp(&e->ip, nameserver)) { - break; - /* RFC6106: In case there's no more space, the new servers should replace - * the the eldest ones */ - } - } - - if(e == NULL) { - if((e = memb_alloc(&dnsmemb)) != NULL) { - list_add(dns, e); - } else { - uip_nameserver_record *p; - for(e = list_head(dns), p = list_head(dns); p != NULL; - p = list_item_next(p)) { - if(DNS_EXPIRATION(p) < DNS_EXPIRATION(e)) { - e = p; - } - } - } - } - - /* RFC6106: In case the entry is existing the expiration time must be - * updated. Otherwise, new entries are added. */ - if(e != NULL) { - if(lifetime == 0) { - memb_free(&dnsmemb, e); - list_remove(dns, e); - } else { - e->added = clock_seconds(); - e->lifetime = lifetime; - uip_ipaddr_copy(&e->ip, nameserver); - } - } -#else /* UIP_NAMESERVER_POOL_SIZE > 1 */ - uip_ipaddr_copy(&serveraddr, nameserver); - serverlifetime = lifetime; -#endif /* UIP_NAMESERVER_POOL_SIZE > 1 */ -} -/*----------------------------------------------------------------------------*/ -#if UIP_NAMESERVER_POOL_SIZE > 1 -/** - * Purge expired records - */ -static void -purge(void) -{ - register uip_nameserver_record *e = NULL; - uint32_t time = clock_seconds(); - for(e = list_head(dns); e != NULL; e = list_item_next(e)) { - if(DNS_EXPIRATION(e) < time) { - list_remove(dns, e); - memb_free(&dnsmemb, e); - e = list_head(dns); - } - } -} -#endif /* UIP_NAMESERVER_POOL_SIZE > 1 */ -/*----------------------------------------------------------------------------*/ -uip_ipaddr_t * -uip_nameserver_get(uint8_t num) -{ -#if UIP_NAMESERVER_POOL_SIZE > 1 - uint8_t i; - uip_nameserver_record *e = NULL; - - if(initialized == 0) { - return NULL; - } - purge(); - for(i = 1, e = list_head(dns); e != NULL && i <= num; - i++, e = list_item_next(e)) { - } - - if(e != NULL) { - return &e->ip; - } - return NULL; -#else /* UIP_NAMESERVER_POOL_SIZE > 1 */ - if(num > 0) { - return NULL; - } - return &serveraddr; -#endif /* UIP_NAMESERVER_POOL_SIZE > 1 */ -} -/*----------------------------------------------------------------------------*/ -uint32_t -uip_nameserver_next_expiration(void) -{ -#if UIP_NAMESERVER_POOL_SIZE > 1 - register uip_nameserver_record *e = NULL; - uint32_t exp = UIP_NAMESERVER_INFINITE_LIFETIME; - uint32_t t; - - if(initialized == 0 || list_length(dns) == 0) { - return 0; - } - purge(); - for(e = list_head(dns); e != NULL; e = list_item_next(e)) { - t = DNS_EXPIRATION(e); - if(t < exp) { - exp = t; - } - } - - return exp; -#else /* UIP_NAMESERVER_POOL_SIZE > 1 */ - return serverlifetime; -#endif /* UIP_NAMESERVER_POOL_SIZE > 1 */ -} -/*----------------------------------------------------------------------------*/ -uint16_t -uip_nameserver_count(void) -{ -#if UIP_NAMESERVER_POOL_SIZE > 1 - if(initialized == 0) { - return 0; - } - return list_length(dns); -#else /* UIP_NAMESERVER_POOL_SIZE > 1 */ - if(uip_is_addr_unspecified(&serveraddr)) { - return 0; - } else { - return 1; - } -#endif /* UIP_NAMESERVER_POOL_SIZE > 1 */ -} -/*----------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/uip-nameserver.h b/os/net/ipv6/uip-nameserver.h deleted file mode 100644 index ed48f2246..000000000 --- a/os/net/ipv6/uip-nameserver.h +++ /dev/null @@ -1,103 +0,0 @@ -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * uIP Name Server interface - * \author Víctor Ariño - */ - -/* - * Copyright (c) 2014, tado° GmbH. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef UIP_NAMESERVER_H_ -#define UIP_NAMESERVER_H_ - -#include "net/ipv6/uip.h" - -/** - * \name General - * @{ - */ -/** \brief Number of Nameservers to keep */ -#ifndef UIP_CONF_NAMESERVER_POOL_SIZE -#define UIP_NAMESERVER_POOL_SIZE 1 -#else /* UIP_CONF_NAMESERVER_POOL_SIZE */ -#define UIP_NAMESERVER_POOL_SIZE UIP_CONF_NAMESERVER_POOL_SIZE -#endif /* UIP_CONF_NAMESERVER_POOL_SIZE */ -/** \brief Infinite Lifetime indicator */ -#define UIP_NAMESERVER_INFINITE_LIFETIME 0xFFFFFFFF -/** @} */ - -/** - * \name Nameserver maintenance - * @{ - */ -/** - * \brief Insert or update a nameserver into/from the pool - * - * The list is kept according to the RFC6106, which indicates that new entries - * will replace old ones (with lower lifetime) and existing entries will update - * their lifetimes. - * - * \param nameserver Pointer to the nameserver ip address - * \param lifetime Life time of the given address. Minimum is 0, which is - * considered to remove an entry. Maximum is 0xFFFFFFFF which - * is considered infinite. - */ -void uip_nameserver_update(const uip_ipaddr_t *nameserver, uint32_t lifetime); - -/** - * \brief Get a Nameserver ip address given in RA - * - * \param num The number of the nameserver to obtain, starting at 0 and going - * up to the pool size. - */ -uip_ipaddr_t *uip_nameserver_get(uint8_t num); - -/** - * \brief Get next expiration time - * - * The least expiration time is returned - */ -uint32_t uip_nameserver_next_expiration(void); - -/** - * \brief Get the number of recorded name servers - */ -uint16_t uip_nameserver_count(void); -/** @} */ - -#endif /* UIP_NAMESERVER_H_ */ -/** @} */ diff --git a/os/net/ipv6/uip-nd6.c b/os/net/ipv6/uip-nd6.c deleted file mode 100644 index f6efc83de..000000000 --- a/os/net/ipv6/uip-nd6.c +++ /dev/null @@ -1,1129 +0,0 @@ -/* - * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. - * 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 project 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 PROJECT 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 PROJECT 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. - */ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * Neighbor discovery (RFC 4861) - * \author Mathilde Durvy - * \author Julien Abeille - */ - -#include -#include -#include "net/ipv6/uip-icmp6.h" -#include "net/ipv6/uip-nd6.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-nameserver.h" -#include "lib/random.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "IPv6 NDP" -#define LOG_LEVEL LOG_LEVEL_IPV6 - -/*------------------------------------------------------------------*/ -/** @{ */ -/** \name Pointers to the header structures. - */ - -/**@{ Pointers to messages just after icmp header */ -#define UIP_ND6_RS_BUF ((uip_nd6_rs *)UIP_ICMP_PAYLOAD) -#define UIP_ND6_RA_BUF ((uip_nd6_ra *)UIP_ICMP_PAYLOAD) -#define UIP_ND6_NS_BUF ((uip_nd6_ns *)UIP_ICMP_PAYLOAD) -#define UIP_ND6_NA_BUF ((uip_nd6_na *)UIP_ICMP_PAYLOAD) -/** @} */ -/** Pointer to ND option */ -#define ND6_OPT(opt) ((unsigned char *)(UIP_ICMP_PAYLOAD + (opt))) -#define ND6_OPT_HDR_BUF(opt) ((uip_nd6_opt_hdr *)ND6_OPT(opt)) -#define ND6_OPT_PREFIX_BUF(opt) ((uip_nd6_opt_prefix_info *)ND6_OPT(opt)) -#define ND6_OPT_MTU_BUF(opt) ((uip_nd6_opt_mtu *)ND6_OPT(opt)) -#define ND6_OPT_RDNSS_BUF(opt) ((uip_nd6_opt_dns *)ND6_OPT(opt)) -/** @} */ - -#if UIP_ND6_SEND_NS || UIP_ND6_SEND_NA || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER -static uint8_t nd6_opt_offset; /** Offset from the end of the icmpv6 header to the option in uip_buf*/ -static uint8_t *nd6_opt_llao; /** Pointer to llao option in uip_buf */ -static uip_ds6_nbr_t *nbr; /** Pointer to a nbr cache entry*/ -static uip_ds6_addr_t *addr; /** Pointer to an interface address */ -#endif /* UIP_ND6_SEND_NS || UIP_ND6_SEND_NA || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER */ - -#if UIP_ND6_SEND_NS || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER -static uip_ds6_defrt_t *defrt; /** Pointer to a router list entry */ -#endif /* UIP_ND6_SEND_NS || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER */ - -#if !UIP_CONF_ROUTER // TBD see if we move it to ra_input -static uip_nd6_opt_prefix_info *nd6_opt_prefix_info; /** Pointer to prefix information option in uip_buf */ -static uip_ipaddr_t ipaddr; -#endif -#if (!UIP_CONF_ROUTER || UIP_ND6_SEND_RA) -static uip_ds6_prefix_t *prefix; /** Pointer to a prefix list entry */ -#endif - -#if UIP_ND6_SEND_NA || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER -/*------------------------------------------------------------------*/ -/* Copy link-layer address from LLAO option to a word-aligned uip_lladdr_t */ -static int -extract_lladdr_from_llao_aligned(uip_lladdr_t *dest) { - if(dest != NULL && nd6_opt_llao != NULL) { - memcpy(dest, &nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], UIP_LLADDR_LEN); - return 1; - } - return 0; -} -#endif /* UIP_ND6_SEND_NA || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER */ -/*------------------------------------------------------------------*/ -#if UIP_ND6_SEND_NA /* UIP_ND6_SEND_NA */ -/* create a llao */ -static void -create_llao(uint8_t *llao, uint8_t type) { - llao[UIP_ND6_OPT_TYPE_OFFSET] = type; - llao[UIP_ND6_OPT_LEN_OFFSET] = UIP_ND6_OPT_LLAO_LEN >> 3; - memcpy(&llao[UIP_ND6_OPT_DATA_OFFSET], &uip_lladdr, UIP_LLADDR_LEN); - /* padding on some */ - memset(&llao[UIP_ND6_OPT_DATA_OFFSET + UIP_LLADDR_LEN], 0, - UIP_ND6_OPT_LLAO_LEN - 2 - UIP_LLADDR_LEN); -} -#endif /* UIP_ND6_SEND_NA */ -/*------------------------------------------------------------------*/ - /** - * Neighbor Solicitation Processing - * - * The NS can be received in 3 cases (procedures): - * - sender is performing DAD (ip src = unspecified, no SLLAO option) - * - sender is performing NUD (ip dst = unicast) - * - sender is performing address resolution (ip dest = solicited node mcast - * address) - * - * We do: - * - if the tgt belongs to me, reply, otherwise ignore - * - if i was performing DAD for the same address, two cases: - * -- I already sent a NS, hence I win - * -- I did not send a NS yet, hence I lose - * - * If we need to send a NA in response (i.e. the NS was done for NUD, or - * address resolution, or DAD and there is a conflict), we do it in this - * function: set src, dst, tgt address in the three cases, then for all cases - * set the rest, including SLLAO - * - */ -#if UIP_ND6_SEND_NA -static void -ns_input(void) -{ - uint8_t flags; - LOG_INFO("Received NS from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(" with target address "); - LOG_INFO_6ADDR((uip_ipaddr_t *) (&UIP_ND6_NS_BUF->tgtipaddr)); - LOG_INFO_("\n"); - UIP_STAT(++uip_stat.nd6.recv); - -#if UIP_CONF_IPV6_CHECKS - if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) || - (uip_is_addr_mcast(&UIP_ND6_NS_BUF->tgtipaddr)) || - (UIP_ICMP_BUF->icode != 0)) { - LOG_ERR("NS received is bad\n"); - goto discard; - } -#endif /* UIP_CONF_IPV6_CHECKS */ - - /* Options processing */ - nd6_opt_llao = NULL; - nd6_opt_offset = UIP_ND6_NS_LEN; - while(uip_l3_icmp_hdr_len + nd6_opt_offset < uip_len) { -#if UIP_CONF_IPV6_CHECKS - if(ND6_OPT_HDR_BUF(nd6_opt_offset)->len == 0) { - LOG_ERR("NS received is bad\n"); - goto discard; - } -#endif /* UIP_CONF_IPV6_CHECKS */ - switch (ND6_OPT_HDR_BUF(nd6_opt_offset)->type) { - case UIP_ND6_OPT_SLLAO: - nd6_opt_llao = &uip_buf[uip_l3_icmp_hdr_len + nd6_opt_offset]; -#if UIP_CONF_IPV6_CHECKS - /* There must be NO option in a DAD NS */ - if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) { - LOG_ERR("NS received is bad\n"); - goto discard; - } else { -#endif /*UIP_CONF_IPV6_CHECKS */ - uip_lladdr_t lladdr_aligned; - extract_lladdr_from_llao_aligned(&lladdr_aligned); - nbr = uip_ds6_nbr_lookup(&UIP_IP_BUF->srcipaddr); - if(nbr == NULL) { - uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned, - 0, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL); - } else { - const uip_lladdr_t *lladdr = uip_ds6_nbr_get_ll(nbr); - if(lladdr == NULL) { - goto discard; - } - if(memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], - lladdr, UIP_LLADDR_LEN) != 0) { - if(uip_ds6_nbr_update_ll(&nbr, - (const uip_lladdr_t *)&lladdr_aligned) - < 0) { - /* failed to update the lladdr */ - goto discard; - } - nbr->state = NBR_STALE; - } else { - if(nbr->state == NBR_INCOMPLETE) { - nbr->state = NBR_STALE; - } - } - } -#if UIP_CONF_IPV6_CHECKS - } -#endif /*UIP_CONF_IPV6_CHECKS */ - break; - default: - LOG_WARN("ND option not supported in NS"); - break; - } - nd6_opt_offset += (ND6_OPT_HDR_BUF(nd6_opt_offset)->len << 3); - } - - addr = uip_ds6_addr_lookup(&UIP_ND6_NS_BUF->tgtipaddr); - if(addr != NULL) { - if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) { - /* DAD CASE */ -#if UIP_ND6_DEF_MAXDADNS > 0 -#if UIP_CONF_IPV6_CHECKS - if(!uip_is_addr_solicited_node(&UIP_IP_BUF->destipaddr)) { - LOG_ERR("NS received is bad\n"); - goto discard; - } -#endif /* UIP_CONF_IPV6_CHECKS */ - if(addr->state != ADDR_TENTATIVE) { - uip_create_linklocal_allnodes_mcast(&UIP_IP_BUF->destipaddr); - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - flags = UIP_ND6_NA_FLAG_OVERRIDE; - goto create_na; - } else { - /** \todo if I sent a NS before him, I win */ - uip_ds6_dad_failed(addr); - goto discard; - } -#else /* UIP_ND6_DEF_MAXDADNS > 0 */ - goto discard; /* DAD CASE */ -#endif /* UIP_ND6_DEF_MAXDADNS > 0 */ - } -#if UIP_CONF_IPV6_CHECKS - if(uip_ds6_is_my_addr(&UIP_IP_BUF->srcipaddr)) { - /** - * \NOTE do we do something here? we both are using the same address. - * If we are doing dad, we could cancel it, though we should receive a - * NA in response of DAD NS we sent, hence DAD will fail anyway. If we - * were not doing DAD, it means there is a duplicate in the network! - */ - LOG_ERR("NS received is bad\n"); - goto discard; - } -#endif /*UIP_CONF_IPV6_CHECKS */ - - /* Address resolution case */ - if(uip_is_addr_solicited_node(&UIP_IP_BUF->destipaddr)) { - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &UIP_IP_BUF->srcipaddr); - uip_ipaddr_copy(&UIP_IP_BUF->srcipaddr, &UIP_ND6_NS_BUF->tgtipaddr); - flags = UIP_ND6_NA_FLAG_SOLICITED | UIP_ND6_NA_FLAG_OVERRIDE; - goto create_na; - } - - /* NUD CASE */ - if(uip_ds6_addr_lookup(&UIP_IP_BUF->destipaddr) == addr) { - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &UIP_IP_BUF->srcipaddr); - uip_ipaddr_copy(&UIP_IP_BUF->srcipaddr, &UIP_ND6_NS_BUF->tgtipaddr); - flags = UIP_ND6_NA_FLAG_SOLICITED | UIP_ND6_NA_FLAG_OVERRIDE; - goto create_na; - } else { -#if UIP_CONF_IPV6_CHECKS - LOG_ERR("NS received is bad\n"); - goto discard; -#endif /* UIP_CONF_IPV6_CHECKS */ - } - } else { - goto discard; - } - - -create_na: - /* If the node is a router it should set R flag in NAs */ -#if UIP_CONF_ROUTER - flags = flags | UIP_ND6_NA_FLAG_ROUTER; -#endif - uipbuf_clear(); - UIP_IP_BUF->vtc = 0x60; - UIP_IP_BUF->tcflow = 0; - UIP_IP_BUF->flow = 0; - uipbuf_set_len_field(UIP_IP_BUF, UIP_ICMPH_LEN + UIP_ND6_NA_LEN + UIP_ND6_OPT_LLAO_LEN); - UIP_IP_BUF->proto = UIP_PROTO_ICMP6; - UIP_IP_BUF->ttl = UIP_ND6_HOP_LIMIT; - - UIP_ICMP_BUF->type = ICMP6_NA; - UIP_ICMP_BUF->icode = 0; - - UIP_ND6_NA_BUF->flagsreserved = flags; - memcpy(&UIP_ND6_NA_BUF->tgtipaddr, &addr->ipaddr, sizeof(uip_ipaddr_t)); - - create_llao(&uip_buf[uip_l3_icmp_hdr_len + UIP_ND6_NA_LEN], - UIP_ND6_OPT_TLLAO); - - UIP_ICMP_BUF->icmpchksum = 0; - UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); - - uipbuf_set_len(UIP_IPH_LEN + UIP_ICMPH_LEN + UIP_ND6_NA_LEN + UIP_ND6_OPT_LLAO_LEN); - - UIP_STAT(++uip_stat.nd6.sent); - LOG_INFO("Sending NA to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(" from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" with target address "); - LOG_INFO_6ADDR(&UIP_ND6_NA_BUF->tgtipaddr); - LOG_INFO_("\n"); - return; - -discard: - uipbuf_clear(); - return; -} -#endif /* UIP_ND6_SEND_NA */ - - -/*------------------------------------------------------------------*/ -#if UIP_ND6_SEND_NS -void -uip_nd6_ns_output(uip_ipaddr_t * src, uip_ipaddr_t * dest, uip_ipaddr_t * tgt) -{ - uipbuf_clear(); - UIP_IP_BUF->vtc = 0x60; - UIP_IP_BUF->tcflow = 0; - UIP_IP_BUF->flow = 0; - UIP_IP_BUF->proto = UIP_PROTO_ICMP6; - UIP_IP_BUF->ttl = UIP_ND6_HOP_LIMIT; - - if(dest == NULL) { - uip_create_solicited_node(tgt, &UIP_IP_BUF->destipaddr); - } else { - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, dest); - } - UIP_ICMP_BUF->type = ICMP6_NS; - UIP_ICMP_BUF->icode = 0; - UIP_ND6_NS_BUF->reserved = 0; - uip_ipaddr_copy((uip_ipaddr_t *) &UIP_ND6_NS_BUF->tgtipaddr, tgt); - /* - * check if we add a SLLAO option: for DAD, MUST NOT, for NUD, MAY - * (here yes), for Address resolution , MUST - */ - if(!(uip_ds6_is_my_addr(tgt))) { - if(src != NULL) { - uip_ipaddr_copy(&UIP_IP_BUF->srcipaddr, src); - } else { - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - } - if (uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) { - LOG_ERR("Dropping NS due to no suitable source address\n"); - uipbuf_clear(); - return; - } - uipbuf_set_len_field(UIP_IP_BUF, UIP_ICMPH_LEN + UIP_ND6_NS_LEN + UIP_ND6_OPT_LLAO_LEN); - - create_llao(&uip_buf[uip_l3_icmp_hdr_len + UIP_ND6_NS_LEN], - UIP_ND6_OPT_SLLAO); - - uip_len = - UIP_IPH_LEN + UIP_ICMPH_LEN + UIP_ND6_NS_LEN + UIP_ND6_OPT_LLAO_LEN; - } else { - uip_create_unspecified(&UIP_IP_BUF->srcipaddr); - UIP_IP_BUF->len[1] = UIP_ICMPH_LEN + UIP_ND6_NS_LEN; - uip_len = UIP_IPH_LEN + UIP_ICMPH_LEN + UIP_ND6_NS_LEN; - } - - UIP_ICMP_BUF->icmpchksum = 0; - UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); - - UIP_STAT(++uip_stat.nd6.sent); - LOG_INFO("Sending NS to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(" from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" with target address "); - LOG_INFO_6ADDR(tgt); - LOG_INFO_("\n"); - return; -} -#endif /* UIP_ND6_SEND_NS */ - -#if UIP_ND6_SEND_NS -/*------------------------------------------------------------------*/ -/** - * Neighbor Advertisement Processing - * - * we might have to send a pkt that had been buffered while address - * resolution was performed (if we support buffering, see UIP_CONF_QUEUE_PKT) - * - * As per RFC 4861, on link layer that have addresses, TLLAO options MUST be - * included when responding to multicast solicitations, SHOULD be included in - * response to unicast (here we assume it is for now) - * - * NA can be received after sending NS for DAD, Address resolution or NUD. Can - * be unsolicited as well. - * It can trigger update of the state of the neighbor in the neighbor cache, - * router in the router list. - * If the NS was for DAD, it means DAD failed - * - */ -static void -na_input(void) -{ - uint8_t is_llchange; - uint8_t is_router; - uint8_t is_solicited; - uint8_t is_override; - uip_lladdr_t lladdr_aligned; - - LOG_INFO("Received NA from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(" with target address "); - LOG_INFO_6ADDR((uip_ipaddr_t *) (&UIP_ND6_NA_BUF->tgtipaddr)); - LOG_INFO_("\n"); - UIP_STAT(++uip_stat.nd6.recv); - - /* - * booleans. the three last one are not 0 or 1 but 0 or 0x80, 0x40, 0x20 - * but it works. Be careful though, do not use tests such as is_router == 1 - */ - is_llchange = 0; - is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER)); - is_solicited = - ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_SOLICITED)); - is_override = - ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_OVERRIDE)); - -#if UIP_CONF_IPV6_CHECKS - if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) || - (UIP_ICMP_BUF->icode != 0) || - (uip_is_addr_mcast(&UIP_ND6_NA_BUF->tgtipaddr)) || - (is_solicited && uip_is_addr_mcast(&UIP_IP_BUF->destipaddr))) { - LOG_ERR("NA received is bad\n"); - goto discard; - } -#endif /*UIP_CONF_IPV6_CHECKS */ - - /* Options processing: we handle TLLAO, and must ignore others */ - nd6_opt_offset = UIP_ND6_NA_LEN; - nd6_opt_llao = NULL; - while(uip_l3_icmp_hdr_len + nd6_opt_offset < uip_len) { -#if UIP_CONF_IPV6_CHECKS - if(ND6_OPT_HDR_BUF(nd6_opt_offset)->len == 0) { - LOG_ERR("NA received is bad\n"); - goto discard; - } -#endif /*UIP_CONF_IPV6_CHECKS */ - switch (ND6_OPT_HDR_BUF(nd6_opt_offset)->type) { - case UIP_ND6_OPT_TLLAO: - nd6_opt_llao = (uint8_t *)ND6_OPT_HDR_BUF(nd6_opt_offset); - break; - default: - LOG_WARN("ND option not supported in NA\n"); - break; - } - nd6_opt_offset += (ND6_OPT_HDR_BUF(nd6_opt_offset)->len << 3); - } - addr = uip_ds6_addr_lookup(&UIP_ND6_NA_BUF->tgtipaddr); - /* Message processing, including TLLAO if any */ - if(addr != NULL) { -#if UIP_ND6_DEF_MAXDADNS > 0 - if(addr->state == ADDR_TENTATIVE) { - uip_ds6_dad_failed(addr); - } -#endif /*UIP_ND6_DEF_MAXDADNS > 0 */ - LOG_ERR("NA received is bad\n"); - goto discard; - } else { - const uip_lladdr_t *lladdr; - nbr = uip_ds6_nbr_lookup(&UIP_ND6_NA_BUF->tgtipaddr); - if(nbr == NULL) { - goto discard; - } - lladdr = uip_ds6_nbr_get_ll(nbr); - if(lladdr == NULL) { - goto discard; - } - if(nd6_opt_llao != NULL) { - is_llchange = - memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], lladdr, - UIP_LLADDR_LEN) == 0 ? 0 : 1; - } - if(nbr->state == NBR_INCOMPLETE) { - if(nd6_opt_llao == NULL || !extract_lladdr_from_llao_aligned(&lladdr_aligned)) { - goto discard; - } - if(uip_ds6_nbr_update_ll(&nbr, - (const uip_lladdr_t *)&lladdr_aligned) < 0) { - /* failed to update the lladdr */ - goto discard; - } - - /* Note: No need to refresh the state of the nbr here. - * It has already been refreshed upon receiving the unicast IPv6 ND packet. - * See: uip_ds6_nbr_refresh_reachable_state() - */ - if(!is_solicited) { - nbr->state = NBR_STALE; - } - nbr->isrouter = is_router; - } else { /* NBR is not INCOMPLETE */ - if(!is_override && is_llchange) { - if(nbr->state == NBR_REACHABLE) { - nbr->state = NBR_STALE; - } - goto discard; - } else { - /** - * If this is an cache override, or same lladdr, or no llao - - * do updates of nbr states. - */ - if(is_override || !is_llchange || nd6_opt_llao == NULL) { - if(nd6_opt_llao != NULL && is_llchange) { - if(!extract_lladdr_from_llao_aligned(&lladdr_aligned) || - uip_ds6_nbr_update_ll(&nbr, - (const uip_lladdr_t *)&lladdr_aligned) - < 0) { - /* failed to update the lladdr */ - goto discard; - } - } - /* Note: No need to refresh the state of the nbr here. - * It has already been refreshed upon receiving the unicast IPv6 ND packet. - * See: uip_ds6_nbr_refresh_reachable_state() - */ - } - } - if(nbr->isrouter && !is_router) { - defrt = uip_ds6_defrt_lookup(&UIP_IP_BUF->srcipaddr); - if(defrt != NULL) { - uip_ds6_defrt_rm(defrt); - } - } - nbr->isrouter = is_router; - } - } -#if UIP_CONF_IPV6_QUEUE_PKT - /* The nbr is now reachable, check if we had buffered a pkt for it */ - /*if(nbr->queue_buf_len != 0) { - uip_len = nbr->queue_buf_len; - memcpy(UIP_IP_BUF, nbr->queue_buf, uip_len); - nbr->queue_buf_len = 0; - return; - }*/ - if(uip_packetqueue_buflen(&nbr->packethandle) != 0) { - uip_len = uip_packetqueue_buflen(&nbr->packethandle); - memcpy(UIP_IP_BUF, uip_packetqueue_buf(&nbr->packethandle), uip_len); - uip_packetqueue_free(&nbr->packethandle); - return; - } - -#endif /*UIP_CONF_IPV6_QUEUE_PKT */ - -discard: - uipbuf_clear(); - return; -} -#endif /* UIP_ND6_SEND_NS */ - -#if UIP_CONF_ROUTER -#if UIP_ND6_SEND_RA -/*---------------------------------------------------------------------------*/ -static void -rs_input(void) -{ - - LOG_INFO("Received RS from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - UIP_STAT(++uip_stat.nd6.recv); - - -#if UIP_CONF_IPV6_CHECKS - /* - * Check hop limit / icmp code - * target address must not be multicast - * if the NA is solicited, dest must not be multicast - */ - if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) || (UIP_ICMP_BUF->icode != 0)) { - LOG_ERR("RS received is bad\n"); - goto discard; - } -#endif /*UIP_CONF_IPV6_CHECKS */ - - /* Only valid option is Source Link-Layer Address option any thing - else is discarded */ - nd6_opt_offset = UIP_ND6_RS_LEN; - nd6_opt_llao = NULL; - - while(uip_l3_icmp_hdr_len + nd6_opt_offset < uip_len) { -#if UIP_CONF_IPV6_CHECKS - if(ND6_OPT_HDR_BUF(nd6_opt_offset)->len == 0) { - LOG_ERR("RS received is bad\n"); - goto discard; - } -#endif /*UIP_CONF_IPV6_CHECKS */ - switch (ND6_OPT_HDR_BUF(nd6_opt_offset)->type) { - case UIP_ND6_OPT_SLLAO: - nd6_opt_llao = (uint8_t *)ND6_OPT_HDR_BUF(nd6_opt_offset); - break; - default: - LOG_WARN("ND option not supported in RS\n"); - break; - } - nd6_opt_offset += (ND6_OPT_HDR_BUF(nd6_opt_offset)->len << 3); - } - /* Options processing: only SLLAO */ - if(nd6_opt_llao != NULL) { -#if UIP_CONF_IPV6_CHECKS - if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) { - LOG_ERR("RS received is bad\n"); - goto discard; - } else { -#endif /*UIP_CONF_IPV6_CHECKS */ - uip_lladdr_t lladdr_aligned; - extract_lladdr_from_llao_aligned(&lladdr_aligned); - if((nbr = uip_ds6_nbr_lookup(&UIP_IP_BUF->srcipaddr)) == NULL) { - /* we need to add the neighbor */ - uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned, - 0, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL); - } else { - /* If LL address changed, set neighbor state to stale */ - const uip_lladdr_t *lladdr = uip_ds6_nbr_get_ll(nbr); - if(lladdr == NULL) { - goto discard; - } - if(memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], - lladdr, UIP_LLADDR_LEN) != 0) { - uip_ds6_nbr_t nbr_data; - nbr_data = *nbr; - uip_ds6_nbr_rm(nbr); - nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned, - 0, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL); - nbr->reachable = nbr_data.reachable; - nbr->sendns = nbr_data.sendns; - nbr->nscount = nbr_data.nscount; - } - nbr->isrouter = 0; - } -#if UIP_CONF_IPV6_CHECKS - } -#endif /*UIP_CONF_IPV6_CHECKS */ - } - - /* Schedule a sollicited RA */ - uip_ds6_send_ra_sollicited(); - -discard: - uipbuf_clear(); - return; -} - -/*---------------------------------------------------------------------------*/ -void -uip_nd6_ra_output(uip_ipaddr_t * dest) -{ - - UIP_IP_BUF->vtc = 0x60; - UIP_IP_BUF->tcflow = 0; - UIP_IP_BUF->flow = 0; - UIP_IP_BUF->proto = UIP_PROTO_ICMP6; - UIP_IP_BUF->ttl = UIP_ND6_HOP_LIMIT; - - if(dest == NULL) { - uip_create_linklocal_allnodes_mcast(&UIP_IP_BUF->destipaddr); - } else { - /* For sollicited RA */ - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, dest); - } - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - - UIP_ICMP_BUF->type = ICMP6_RA; - UIP_ICMP_BUF->icode = 0; - - UIP_ND6_RA_BUF->cur_ttl = uip_ds6_if.cur_hop_limit; - - UIP_ND6_RA_BUF->flags_reserved = - (UIP_ND6_M_FLAG << 7) | (UIP_ND6_O_FLAG << 6); - - UIP_ND6_RA_BUF->router_lifetime = uip_htons(UIP_ND6_ROUTER_LIFETIME); - //UIP_ND6_RA_BUF->reachable_time = uip_htonl(uip_ds6_if.reachable_time); - //UIP_ND6_RA_BUF->retrans_timer = uip_htonl(uip_ds6_if.retrans_timer); - UIP_ND6_RA_BUF->reachable_time = 0; - UIP_ND6_RA_BUF->retrans_timer = 0; - - uip_len = UIP_IPH_LEN + UIP_ICMPH_LEN + UIP_ND6_RA_LEN; - nd6_opt_offset = UIP_ND6_RA_LEN; - - - /* Prefix list */ - for(prefix = uip_ds6_prefix_list; - prefix < uip_ds6_prefix_list + UIP_DS6_PREFIX_NB; prefix++) { - if((prefix->isused) && (prefix->advertise)) { - ND6_OPT_PREFIX_BUF(nd6_opt_offset)->type = UIP_ND6_OPT_PREFIX_INFO; - ND6_OPT_PREFIX_BUF(nd6_opt_offset)->len = UIP_ND6_OPT_PREFIX_INFO_LEN / 8; - ND6_OPT_PREFIX_BUF(nd6_opt_offset)->preflen = prefix->length; - ND6_OPT_PREFIX_BUF(nd6_opt_offset)->flagsreserved1 = prefix->l_a_reserved; - ND6_OPT_PREFIX_BUF(nd6_opt_offset)->validlt = uip_htonl(prefix->vlifetime); - ND6_OPT_PREFIX_BUF(nd6_opt_offset)->preferredlt = uip_htonl(prefix->plifetime); - ND6_OPT_PREFIX_BUF(nd6_opt_offset)->reserved2 = 0; - uip_ipaddr_copy(&(ND6_OPT_PREFIX_BUF(nd6_opt_offset)->prefix), &(prefix->ipaddr)); - nd6_opt_offset += UIP_ND6_OPT_PREFIX_INFO_LEN; - uip_len += UIP_ND6_OPT_PREFIX_INFO_LEN; - } - } - - /* Source link-layer option */ - create_llao((uint8_t *)ND6_OPT_HDR_BUF(nd6_opt_offset), UIP_ND6_OPT_SLLAO); - - uip_len += UIP_ND6_OPT_LLAO_LEN; - nd6_opt_offset += UIP_ND6_OPT_LLAO_LEN; - - /* MTU */ - ND6_OPT_MTU_BUF(nd6_opt_offset)->type = UIP_ND6_OPT_MTU; - ND6_OPT_MTU_BUF(nd6_opt_offset)->len = UIP_ND6_OPT_MTU_LEN >> 3; - ND6_OPT_MTU_BUF(nd6_opt_offset)->reserved = 0; - //ND6_OPT_MTU_BUF(nd6_opt_offset)->mtu = uip_htonl(uip_ds6_if.link_mtu); - ND6_OPT_MTU_BUF(nd6_opt_offset)->mtu = uip_htonl(1500); - - uip_len += UIP_ND6_OPT_MTU_LEN; - nd6_opt_offset += UIP_ND6_OPT_MTU_LEN; - -#if UIP_ND6_RA_RDNSS - if(uip_nameserver_count() > 0) { - uint8_t i = 0; - uip_ipaddr_t *ip = &ND6_OPT_RDNSS_BUF(nd6_opt_offset)->ip; - uip_ipaddr_t *dns = NULL; - ND6_OPT_RDNSS_BUF(nd6_opt_offset)->type = UIP_ND6_OPT_RDNSS; - ND6_OPT_RDNSS_BUF(nd6_opt_offset)->reserved = 0; - ND6_OPT_RDNSS_BUF(nd6_opt_offset)->lifetime = uip_nameserver_next_expiration(); - if(ND6_OPT_RDNSS_BUF(nd6_opt_offset)->lifetime != UIP_NAMESERVER_INFINITE_LIFETIME) { - ND6_OPT_RDNSS_BUF(nd6_opt_offset)->lifetime -= clock_seconds(); - } - while((dns = uip_nameserver_get(i)) != NULL) { - uip_ipaddr_copy(ip++, dns); - i++; - } - ND6_OPT_RDNSS_BUF(nd6_opt_offset)->len = UIP_ND6_OPT_RDNSS_LEN + (i << 1); - LOG_INFO("%d nameservers reported\n", i); - uip_len += ND6_OPT_RDNSS_BUF(nd6_opt_offset)->len << 3; - nd6_opt_offset += ND6_OPT_RDNSS_BUF(nd6_opt_offset)->len << 3; - } -#endif /* UIP_ND6_RA_RDNSS */ - - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - - /*ICMP checksum */ - UIP_ICMP_BUF->icmpchksum = 0; - UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); - - UIP_STAT(++uip_stat.nd6.sent); - LOG_INFO("Sending RA to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(" from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - return; -} -#endif /* UIP_ND6_SEND_RA */ -#endif /* UIP_CONF_ROUTER */ - -#if !UIP_CONF_ROUTER -/*---------------------------------------------------------------------------*/ -void -uip_nd6_rs_output(void) -{ - UIP_IP_BUF->vtc = 0x60; - UIP_IP_BUF->tcflow = 0; - UIP_IP_BUF->flow = 0; - UIP_IP_BUF->proto = UIP_PROTO_ICMP6; - UIP_IP_BUF->ttl = UIP_ND6_HOP_LIMIT; - uip_create_linklocal_allrouters_mcast(&UIP_IP_BUF->destipaddr); - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - UIP_ICMP_BUF->type = ICMP6_RS; - UIP_ICMP_BUF->icode = 0; - - if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) { - UIP_IP_BUF->len[1] = UIP_ICMPH_LEN + UIP_ND6_RS_LEN; - uip_len = uip_l3_icmp_hdr_len + UIP_ND6_RS_LEN; - } else { - uip_len = uip_l3_icmp_hdr_len + UIP_ND6_RS_LEN + UIP_ND6_OPT_LLAO_LEN; - uipbuf_set_len_field(UIP_IP_BUF, UIP_ICMPH_LEN + UIP_ND6_RS_LEN + UIP_ND6_OPT_LLAO_LEN); - - create_llao(&uip_buf[uip_l3_icmp_hdr_len + UIP_ND6_RS_LEN], - UIP_ND6_OPT_SLLAO); - } - - UIP_ICMP_BUF->icmpchksum = 0; - UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); - - UIP_STAT(++uip_stat.nd6.sent); - LOG_INFO("Sending RS to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(" from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - return; -} -/*---------------------------------------------------------------------------*/ -/** - * Process a Router Advertisement - * - * - Possible actions when receiving a RA: add router to router list, - * recalculate reachable time, update link hop limit, update retrans timer. - * - If MTU option: update MTU. - * - If SLLAO option: update entry in neighbor cache - * - If prefix option: start autoconf, add prefix to prefix list - */ -void -ra_input(void) -{ - uip_lladdr_t lladdr_aligned; - - LOG_INFO("Received RA from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - UIP_STAT(++uip_stat.nd6.recv); - -#if UIP_CONF_IPV6_CHECKS - if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) || - (!uip_is_addr_linklocal(&UIP_IP_BUF->srcipaddr)) || - (UIP_ICMP_BUF->icode != 0)) { - LOG_ERR("RA received is bad"); - goto discard; - } -#endif /*UIP_CONF_IPV6_CHECKS */ - - if(UIP_ND6_RA_BUF->cur_ttl != 0) { - uip_ds6_if.cur_hop_limit = UIP_ND6_RA_BUF->cur_ttl; - LOG_INFO("uip_ds6_if.cur_hop_limit %u\n", uip_ds6_if.cur_hop_limit); - } - - if(UIP_ND6_RA_BUF->reachable_time != 0) { - if(uip_ds6_if.base_reachable_time != - uip_ntohl(UIP_ND6_RA_BUF->reachable_time)) { - uip_ds6_if.base_reachable_time = uip_ntohl(UIP_ND6_RA_BUF->reachable_time); - uip_ds6_if.reachable_time = uip_ds6_compute_reachable_time(); - } - } - if(UIP_ND6_RA_BUF->retrans_timer != 0) { - uip_ds6_if.retrans_timer = uip_ntohl(UIP_ND6_RA_BUF->retrans_timer); - } - - /* Options processing */ - nd6_opt_offset = UIP_ND6_RA_LEN; - while(uip_l3_icmp_hdr_len + nd6_opt_offset < uip_len) { - if(ND6_OPT_HDR_BUF(nd6_opt_offset)->len == 0) { - LOG_ERR("RA received is bad"); - goto discard; - } - switch (ND6_OPT_HDR_BUF(nd6_opt_offset)->type) { - case UIP_ND6_OPT_SLLAO: - LOG_DBG("Processing SLLAO option in RA\n"); - nd6_opt_llao = (uint8_t *) ND6_OPT_HDR_BUF(nd6_opt_offset); - nbr = uip_ds6_nbr_lookup(&UIP_IP_BUF->srcipaddr); - if(!extract_lladdr_from_llao_aligned(&lladdr_aligned)) { - /* failed to extract llao - discard packet */ - goto discard; - } - if(nbr == NULL) { - nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned, - 1, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL); - } else { - const uip_lladdr_t *lladdr = uip_ds6_nbr_get_ll(nbr); - if(lladdr == NULL) { - goto discard; - } - if(nbr->state == NBR_INCOMPLETE) { - nbr->state = NBR_STALE; - } - if(memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], - lladdr, UIP_LLADDR_LEN) != 0) { - /* change of link layer address */ - if(uip_ds6_nbr_update_ll(&nbr, - (const uip_lladdr_t *)&lladdr_aligned) < 0) { - /* failed to update the lladdr */ - goto discard; - } - nbr->state = NBR_STALE; - } - nbr->isrouter = 1; - } - break; - case UIP_ND6_OPT_MTU: - LOG_DBG("Processing MTU option in RA\n"); - uip_ds6_if.link_mtu = - uip_ntohl(((uip_nd6_opt_mtu *) ND6_OPT_HDR_BUF(nd6_opt_offset))->mtu); - break; - case UIP_ND6_OPT_PREFIX_INFO: - LOG_DBG("Processing PREFIX option in RA\n"); - nd6_opt_prefix_info = (uip_nd6_opt_prefix_info *) ND6_OPT_HDR_BUF(nd6_opt_offset); - if((uip_ntohl(nd6_opt_prefix_info->validlt) >= - uip_ntohl(nd6_opt_prefix_info->preferredlt)) - && (!uip_is_addr_linklocal(&nd6_opt_prefix_info->prefix))) { - /* on-link flag related processing */ - if(nd6_opt_prefix_info->flagsreserved1 & UIP_ND6_RA_FLAG_ONLINK) { - prefix = - uip_ds6_prefix_lookup(&nd6_opt_prefix_info->prefix, - nd6_opt_prefix_info->preflen); - if(prefix == NULL) { - if(nd6_opt_prefix_info->validlt != 0) { - if(nd6_opt_prefix_info->validlt != UIP_ND6_INFINITE_LIFETIME) { - prefix = uip_ds6_prefix_add(&nd6_opt_prefix_info->prefix, - nd6_opt_prefix_info->preflen, - uip_ntohl(nd6_opt_prefix_info-> - validlt)); - } else { - prefix = uip_ds6_prefix_add(&nd6_opt_prefix_info->prefix, - nd6_opt_prefix_info->preflen, 0); - } - } - } else { - switch (nd6_opt_prefix_info->validlt) { - case 0: - uip_ds6_prefix_rm(prefix); - break; - case UIP_ND6_INFINITE_LIFETIME: - prefix->isinfinite = 1; - break; - default: - LOG_DBG("Updating timer of prefix "); - LOG_DBG_6ADDR(&prefix->ipaddr); - LOG_DBG_(" new value %"PRIu32"\n", uip_ntohl(nd6_opt_prefix_info->validlt)); - stimer_set(&prefix->vlifetime, - uip_ntohl(nd6_opt_prefix_info->validlt)); - prefix->isinfinite = 0; - break; - } - } - } - /* End of on-link flag related processing */ - /* autonomous flag related processing */ - if((nd6_opt_prefix_info->flagsreserved1 & UIP_ND6_RA_FLAG_AUTONOMOUS) - && (nd6_opt_prefix_info->validlt != 0) - && (nd6_opt_prefix_info->preflen == UIP_DEFAULT_PREFIX_LEN)) { - - uip_ipaddr_copy(&ipaddr, &nd6_opt_prefix_info->prefix); - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - addr = uip_ds6_addr_lookup(&ipaddr); - if((addr != NULL) && (addr->type == ADDR_AUTOCONF)) { - if(nd6_opt_prefix_info->validlt != UIP_ND6_INFINITE_LIFETIME) { - /* The processing below is defined in RFC4862 section 5.5.3 e */ - if((uip_ntohl(nd6_opt_prefix_info->validlt) > 2 * 60 * 60) || - (uip_ntohl(nd6_opt_prefix_info->validlt) > - stimer_remaining(&addr->vlifetime))) { - LOG_DBG("Updating timer of address "); - LOG_DBG_6ADDR(&addr->ipaddr); - LOG_DBG_(" new value %lu\n", - (unsigned long)uip_ntohl(nd6_opt_prefix_info->validlt)); - stimer_set(&addr->vlifetime, - uip_ntohl(nd6_opt_prefix_info->validlt)); - } else { - stimer_set(&addr->vlifetime, 2 * 60 * 60); - LOG_DBG("Updating timer of address "); - LOG_DBG_6ADDR(&addr->ipaddr); - LOG_DBG_(" new value %lu\n", (unsigned long)(2 * 60 * 60)); - } - addr->isinfinite = 0; - } else { - addr->isinfinite = 1; - } - } else { - if(uip_ntohl(nd6_opt_prefix_info->validlt) == - UIP_ND6_INFINITE_LIFETIME) { - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - } else { - uip_ds6_addr_add(&ipaddr, uip_ntohl(nd6_opt_prefix_info->validlt), - ADDR_AUTOCONF); - } - } - } - /* End of autonomous flag related processing */ - } - break; -#if UIP_ND6_RA_RDNSS - case UIP_ND6_OPT_RDNSS: - LOG_DBG("Processing RDNSS option\n"); - uint8_t naddr = (ND6_OPT_RDNSS_BUF(nd6_opt_offset)->len - 1) / 2; - uip_ipaddr_t *ip = (uip_ipaddr_t *)(&ND6_OPT_RDNSS_BUF(nd6_opt_offset)->ip); - LOG_DBG("got %d nameservers\n", naddr); - while(naddr-- > 0) { - LOG_DBG("nameserver: "); - LOG_DBG_6ADDR(ip); - LOG_DBG_(" lifetime: %"PRIx32"\n", uip_ntohl(ND6_OPT_RDNSS_BUF(nd6_opt_offset)->lifetime)); - uip_nameserver_update(ip, uip_ntohl(ND6_OPT_RDNSS_BUF(nd6_opt_offset)->lifetime)); - ip++; - } - break; -#endif /* UIP_ND6_RA_RDNSS */ - default: - LOG_ERR("ND option not supported in RA\n"); - break; - } - nd6_opt_offset += (ND6_OPT_HDR_BUF(nd6_opt_offset)->len << 3); - } - - defrt = uip_ds6_defrt_lookup(&UIP_IP_BUF->srcipaddr); - if(UIP_ND6_RA_BUF->router_lifetime != 0) { - if(nbr != NULL) { - nbr->isrouter = 1; - } - if(defrt == NULL) { - uip_ds6_defrt_add(&UIP_IP_BUF->srcipaddr, - (unsigned - long)(uip_ntohs(UIP_ND6_RA_BUF->router_lifetime))); - } else { - stimer_set(&(defrt->lifetime), - (unsigned long)(uip_ntohs(UIP_ND6_RA_BUF->router_lifetime))); - } - } else { - if(defrt != NULL) { - uip_ds6_defrt_rm(defrt); - } - } - -#if UIP_CONF_IPV6_QUEUE_PKT - /* If the nbr just became reachable (e.g. it was in NBR_INCOMPLETE state - * and we got a SLLAO), check if we had buffered a pkt for it */ - /* if((nbr != NULL) && (nbr->queue_buf_len != 0)) { - uip_len = nbr->queue_buf_len; - memcpy(UIP_IP_BUF, nbr->queue_buf, uip_len); - nbr->queue_buf_len = 0; - return; - }*/ - if(nbr != NULL && uip_packetqueue_buflen(&nbr->packethandle) != 0) { - uip_len = uip_packetqueue_buflen(&nbr->packethandle); - memcpy(UIP_IP_BUF, uip_packetqueue_buf(&nbr->packethandle), uip_len); - uip_packetqueue_free(&nbr->packethandle); - return; - } - -#endif /*UIP_CONF_IPV6_QUEUE_PKT */ - -discard: - uipbuf_clear(); - return; -} -#endif /* !UIP_CONF_ROUTER */ -/*------------------------------------------------------------------*/ -/* ICMPv6 input handlers */ -#if UIP_ND6_SEND_NA -UIP_ICMP6_HANDLER(ns_input_handler, ICMP6_NS, UIP_ICMP6_HANDLER_CODE_ANY, - ns_input); -#endif -#if UIP_ND6_SEND_NS -UIP_ICMP6_HANDLER(na_input_handler, ICMP6_NA, UIP_ICMP6_HANDLER_CODE_ANY, - na_input); -#endif - -#if UIP_CONF_ROUTER && UIP_ND6_SEND_RA -UIP_ICMP6_HANDLER(rs_input_handler, ICMP6_RS, UIP_ICMP6_HANDLER_CODE_ANY, - rs_input); -#endif - -#if !UIP_CONF_ROUTER -UIP_ICMP6_HANDLER(ra_input_handler, ICMP6_RA, UIP_ICMP6_HANDLER_CODE_ANY, - ra_input); -#endif -/*---------------------------------------------------------------------------*/ -void -uip_nd6_init() -{ -#if UIP_ND6_SEND_NA - /* Only handle NSs if we are prepared to send out NAs */ - uip_icmp6_register_input_handler(&ns_input_handler); -#endif - -#if UIP_ND6_SEND_NS - /* - * Only handle NAs if we are prepared to send out NSs. */ - uip_icmp6_register_input_handler(&na_input_handler); -#endif - -#if UIP_CONF_ROUTER && UIP_ND6_SEND_RA - /* Only accept RS if we are a router and happy to send out RAs */ - uip_icmp6_register_input_handler(&rs_input_handler); -#endif - -#if !UIP_CONF_ROUTER - /* Only process RAs if we are not a router */ - uip_icmp6_register_input_handler(&ra_input_handler); -#endif -} -/*---------------------------------------------------------------------------*/ - /** @} */ diff --git a/os/net/ipv6/uip-nd6.h b/os/net/ipv6/uip-nd6.h deleted file mode 100644 index 2c1e3226b..000000000 --- a/os/net/ipv6/uip-nd6.h +++ /dev/null @@ -1,586 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * Header file for IPv6 Neighbor discovery (RFC 4861) - * \author Julien Abeille - * \author Mathilde Durvy - */ - -#ifndef UIP_ND6_H_ -#define UIP_ND6_H_ - -#include "net/ipv6/uip.h" -#include "sys/stimer.h" -/** - * \name General - * @{ - */ -/** \brief HOP LIMIT to be used when sending ND messages (255) */ -#define UIP_ND6_HOP_LIMIT 255 -/** \brief INFINITE lifetime */ -#define UIP_ND6_INFINITE_LIFETIME 0xFFFFFFFF -/** @} */ - -/** \name RFC 4861 Host constant */ -/** @{ */ -/** \brief Maximum router solicitation delay */ -#ifndef UIP_CONF_ND6_MAX_RTR_SOLICITATION_DELAY -#define UIP_ND6_MAX_RTR_SOLICITATION_DELAY 1 -#else -#define UIP_ND6_MAX_RTR_SOLICITATION_DELAY UIP_CONF_ND6_MAX_RTR_SOLICITATION_DELAY -#endif -/** \brief Router solicitation interval */ -#ifndef UIP_CONF_ND6_RTR_SOLICITATION_INTERVAL -#define UIP_ND6_RTR_SOLICITATION_INTERVAL 4 -#else -#define UIP_ND6_RTR_SOLICITATION_INTERVAL UIP_CONF_ND6_RTR_SOLICITATION_INTERVAL -#endif -/** \brief Maximum router solicitations */ -#ifndef UIP_CONF_ND6_MAX_RTR_SOLICITATIONS -#define UIP_ND6_MAX_RTR_SOLICITATIONS 3 -#else -#define UIP_ND6_MAX_RTR_SOLICITATIONS UIP_CONF_ND6_MAX_RTR_SOLICITATIONS -#endif -/** @} */ - -/** \name RFC 4861 Router constants */ -/** @{ */ -#ifndef UIP_CONF_ND6_SEND_RA -#define UIP_ND6_SEND_RA 1 /* enable/disable RA sending */ -#else -#define UIP_ND6_SEND_RA UIP_CONF_ND6_SEND_RA -#endif -#ifndef UIP_CONF_ND6_SEND_NS -#define UIP_ND6_SEND_NS 1 /* enable/disable NS sending */ -#else -#define UIP_ND6_SEND_NS UIP_CONF_ND6_SEND_NS -#endif -#ifndef UIP_CONF_ND6_SEND_NA -#define UIP_ND6_SEND_NA 1 /* enable/disable NA sending */ -#else -#define UIP_ND6_SEND_NA UIP_CONF_ND6_SEND_NA -#endif -#ifndef UIP_CONF_ND6_AUTOFILL_NBR_CACHE -/* Neighbor not found in cache? Derive its link-layer address from it's -link-local IPv6, assuming it used autoconfiguration. This is not -standard-compliant but this is a convenient way to keep the -neighbor cache out of the way in cases ND is not used. -Note that this is not standard-compliant (RFC 4861), as neighbors will -be added regardless of their reachability and liveness. */ -#define UIP_ND6_AUTOFILL_NBR_CACHE 0 -#else -#define UIP_ND6_AUTOFILL_NBR_CACHE UIP_CONF_ND6_AUTOFILL_NBR_CACHE -#endif -#ifndef UIP_CONF_ND6_MAX_RA_INTERVAL -#define UIP_ND6_MAX_RA_INTERVAL 600 -#else -#define UIP_ND6_MAX_RA_INTERVAL UIP_CONF_ND6_MAX_RA_INTERVAL -#endif -#ifndef UIP_CONF_ND6_MIN_RA_INTERVAL -#define UIP_ND6_MIN_RA_INTERVAL (UIP_ND6_MAX_RA_INTERVAL / 3) -#else -#define UIP_ND6_MIN_RA_INTERVAL UIP_CONF_ND6_MIN_RA_INTERVAL -#endif -#define UIP_ND6_M_FLAG 0 -#define UIP_ND6_O_FLAG 0 -#ifndef UIP_CONF_ROUTER_LIFETIME -#define UIP_ND6_ROUTER_LIFETIME 3 * UIP_ND6_MAX_RA_INTERVAL -#else -#define UIP_ND6_ROUTER_LIFETIME UIP_CONF_ROUTER_LIFETIME -#endif - -#define UIP_ND6_MAX_INITIAL_RA_INTERVAL 16 /*seconds*/ -#define UIP_ND6_MAX_INITIAL_RAS 3 /*transmissions*/ -#ifndef UIP_CONF_ND6_MIN_DELAY_BETWEEN_RAS -#define UIP_ND6_MIN_DELAY_BETWEEN_RAS 3 /*seconds*/ -#else -#define UIP_ND6_MIN_DELAY_BETWEEN_RAS UIP_CONF_ND6_MIN_DELAY_BETWEEN_RAS -#endif -//#define UIP_ND6_MAX_RA_DELAY_TIME 0.5 /*seconds*/ -#define UIP_ND6_MAX_RA_DELAY_TIME_MS 500 /*milli seconds*/ -/** @} */ - -#ifndef UIP_CONF_ND6_DEF_MAXDADNS -/** \brief Do not try DAD when using EUI-64 as allowed by draft-ietf-6lowpan-nd-15 section 8.2 */ -#if UIP_CONF_LL_802154 -#define UIP_ND6_DEF_MAXDADNS 0 -#else /* UIP_CONF_LL_802154 */ -#define UIP_ND6_DEF_MAXDADNS UIP_ND6_SEND_NS -#endif /* UIP_CONF_LL_802154 */ -#else /* UIP_CONF_ND6_DEF_MAXDADNS */ -#define UIP_ND6_DEF_MAXDADNS UIP_CONF_ND6_DEF_MAXDADNS -#endif /* UIP_CONF_ND6_DEF_MAXDADNS */ - -/** \name RFC 4861 Node constant */ -#define UIP_ND6_MAX_MULTICAST_SOLICIT 3 - -#ifdef UIP_CONF_ND6_MAX_UNICAST_SOLICIT -#define UIP_ND6_MAX_UNICAST_SOLICIT UIP_CONF_ND6_MAX_UNICAST_SOLICIT -#else /* UIP_CONF_ND6_MAX_UNICAST_SOLICIT */ -#define UIP_ND6_MAX_UNICAST_SOLICIT 3 -#endif /* UIP_CONF_ND6_MAX_UNICAST_SOLICIT */ - -#ifdef UIP_CONF_ND6_REACHABLE_TIME -#define UIP_ND6_REACHABLE_TIME UIP_CONF_ND6_REACHABLE_TIME -#else -#define UIP_ND6_REACHABLE_TIME 60000 -#endif - -#ifdef UIP_CONF_ND6_RETRANS_TIMER -#define UIP_ND6_RETRANS_TIMER UIP_CONF_ND6_RETRANS_TIMER -#else -#define UIP_ND6_RETRANS_TIMER 1000 -#endif - -#define UIP_ND6_DELAY_FIRST_PROBE_TIME 5 -#define UIP_ND6_MIN_RANDOM_FACTOR(x) (x / 2) -#define UIP_ND6_MAX_RANDOM_FACTOR(x) ((x) + (x) / 2) -/** @} */ - - -/** \name RFC 6106 RA DNS Options Constants */ -/** @{ */ -#ifndef UIP_CONF_ND6_RA_RDNSS -#define UIP_ND6_RA_RDNSS 0 -#else -#define UIP_ND6_RA_RDNSS UIP_CONF_ND6_RA_RDNSS -#endif - -#ifndef UIP_CONF_ND6_RA_DNSSL -#define UIP_ND6_RA_DNSSL 0 -#else -#error Not implemented -#define UIP_ND6_RA_DNSSL UIP_CONF_ND6_RA_DNSSL -#endif -/** @} */ - - -/** \name ND6 option types */ -/** @{ */ -#define UIP_ND6_OPT_SLLAO 1 -#define UIP_ND6_OPT_TLLAO 2 -#define UIP_ND6_OPT_PREFIX_INFO 3 -#define UIP_ND6_OPT_REDIRECTED_HDR 4 -#define UIP_ND6_OPT_MTU 5 -#define UIP_ND6_OPT_RDNSS 25 -#define UIP_ND6_OPT_DNSSL 31 -/** @} */ - -/** \name ND6 option types */ -/** @{ */ -#define UIP_ND6_OPT_TYPE_OFFSET 0 -#define UIP_ND6_OPT_LEN_OFFSET 1 -#define UIP_ND6_OPT_DATA_OFFSET 2 - -/** \name ND6 message length (excluding options) */ -/** @{ */ -#define UIP_ND6_NA_LEN 20 -#define UIP_ND6_NS_LEN 20 -#define UIP_ND6_RA_LEN 12 -#define UIP_ND6_RS_LEN 4 -/** @} */ - - -/** \name ND6 option length in bytes */ -/** @{ */ -#define UIP_ND6_OPT_HDR_LEN 2 -#define UIP_ND6_OPT_PREFIX_INFO_LEN 32 -#define UIP_ND6_OPT_MTU_LEN 8 -#define UIP_ND6_OPT_RDNSS_LEN 1 -#define UIP_ND6_OPT_DNSSL_LEN 1 - - -/* Length of TLLAO and SLLAO options, it is L2 dependant */ -#if UIP_CONF_LL_802154 -/* If the interface is 802.15.4. For now we use only long addresses */ -#define UIP_ND6_OPT_SHORT_LLAO_LEN 8 -#define UIP_ND6_OPT_LONG_LLAO_LEN 16 -/** \brief length of a ND6 LLAO option for 802.15.4 */ -#define UIP_ND6_OPT_LLAO_LEN UIP_ND6_OPT_LONG_LLAO_LEN -#else /*UIP_CONF_LL_802154*/ -#if UIP_CONF_LL_80211 -/* If the interface is 802.11 */ -/** \brief length of a ND6 LLAO option for 802.11 */ -#define UIP_ND6_OPT_LLAO_LEN 8 -#else /*UIP_CONF_LL_80211*/ -/** \brief length of a ND6 LLAO option for default L2 type (e.g. Ethernet) */ -#define UIP_ND6_OPT_LLAO_LEN 8 -#endif /*UIP_CONF_LL_80211*/ -#endif /*UIP_CONF_LL_802154*/ -/** @} */ - - -/** \name Neighbor Advertisement flags masks */ -/** @{ */ -#define UIP_ND6_NA_FLAG_ROUTER 0x80 -#define UIP_ND6_NA_FLAG_SOLICITED 0x40 -#define UIP_ND6_NA_FLAG_OVERRIDE 0x20 -#define UIP_ND6_RA_FLAG_ONLINK 0x80 -#define UIP_ND6_RA_FLAG_AUTONOMOUS 0x40 -/** @} */ - -/** - * \name ND message structures - * @{ - */ - -/** - * \brief A neighbor solicitation constant part - * - * Possible option is: SLLAO - */ -typedef struct uip_nd6_ns { - uint32_t reserved; - uip_ipaddr_t tgtipaddr; -} uip_nd6_ns; - -/** - * \brief A neighbor advertisement constant part. - * - * Possible option is: TLLAO - */ -typedef struct uip_nd6_na { - uint8_t flagsreserved; - uint8_t reserved[3]; - uip_ipaddr_t tgtipaddr; -} uip_nd6_na; - -/** - * \brief A router solicitation constant part - * - * Possible option is: SLLAO - */ -typedef struct uip_nd6_rs { - uint32_t reserved; -} uip_nd6_rs; - -/** - * \brief A router advertisement constant part - * - * Possible options are: SLLAO, MTU, Prefix Information - */ -typedef struct uip_nd6_ra { - uint8_t cur_ttl; - uint8_t flags_reserved; - uint16_t router_lifetime; - uint32_t reachable_time; - uint32_t retrans_timer; -} uip_nd6_ra; - -/** - * \brief A redirect message constant part - * - * Possible options are: TLLAO, redirected header - */ -typedef struct uip_nd6_redirect { - uint32_t reserved; - uip_ipaddr_t tgtipaddress; - uip_ipaddr_t destipaddress; -} uip_nd6_redirect; -/** @} */ - -/** - * \name ND Option structures - * @{ - */ - -/** \brief ND option header */ -typedef struct uip_nd6_opt_hdr { - uint8_t type; - uint8_t len; -} uip_nd6_opt_hdr; - -/** \brief ND option prefix information */ -typedef struct uip_nd6_opt_prefix_info { - uint8_t type; - uint8_t len; - uint8_t preflen; - uint8_t flagsreserved1; - uint32_t validlt; - uint32_t preferredlt; - uint32_t reserved2; - uip_ipaddr_t prefix; -} uip_nd6_opt_prefix_info ; - -/** \brief ND option MTU */ -typedef struct uip_nd6_opt_mtu { - uint8_t type; - uint8_t len; - uint16_t reserved; - uint32_t mtu; -} uip_nd6_opt_mtu; - -/** \brief ND option RDNSS */ -typedef struct uip_nd6_opt_dns { - uint8_t type; - uint8_t len; - uint16_t reserved; - uint32_t lifetime; - uip_ipaddr_t ip; -} uip_nd6_opt_dns; - -/** \struct Redirected header option */ -typedef struct uip_nd6_opt_redirected_hdr { - uint8_t type; - uint8_t len; - uint8_t reserved[6]; -} uip_nd6_opt_redirected_hdr; -/** @} */ - -/** - * \name ND Messages Processing and Generation - * @{ - */ - /** - * \brief Send a neighbor solicitation, send a Neighbor Advertisement - * \param src pointer to the src of the NS if known - * \param dest pointer to ip address to send the NS, for DAD or ADDR Resol, - * MUST be NULL, for NUD, must be correct unicast dest - * \param tgt pointer to ip address to fill the target address field, must - * not be NULL - * - * - RFC 4861, 7.2.2 : - * "If the source address of the packet prompting the solicitation is the - * same as one of the addresses assigned to the outgoing interface, that - * address SHOULD be placed in the IP Source Address of the outgoing - * solicitation. Otherwise, any one of the addresses assigned to the - * interface should be used." - * This is why we have a src ip address as argument. If NULL, we will do - * src address selection, otherwise we use the argument. - * - * - we check if it is a NS for Address resolution or NUD, if yes we include - * a SLLAO option, otherwise no. - */ -void -uip_nd6_ns_output(uip_ipaddr_t *src, uip_ipaddr_t *dest, uip_ipaddr_t *tgt); - -#if UIP_CONF_ROUTER -#if UIP_ND6_SEND_RA -/** - * \brief send a Router Advertisement - * - * Only for router, for periodic as well as sollicited RA - */ -void uip_nd6_ra_output(uip_ipaddr_t *dest); -#endif /* UIP_ND6_SEND_RA */ -#endif /*UIP_CONF_ROUTER*/ - -/** - * \brief Send a Router Solicitation - * - * src is chosen through the uip_netif_select_src function. If src is - * unspecified (i.e. we do not have a preferred address yet), then we do not - * put a SLLAO option (MUST NOT in RFC 4861). Otherwise we do. - * - * RS message format, - * possible option is SLLAO, MUST NOT be included if source = unspecified - * SHOULD be included otherwise - */ -void uip_nd6_rs_output(void); - -/** - * \brief Initialise the uIP ND core - */ -void uip_nd6_init(void); -/** @} */ - - -void -uip_appserver_addr_get(uip_ipaddr_t *ipaddr); -/*--------------------------------------*/ -/******* ANNEX - message formats ********/ -/*--------------------------------------*/ - -/* - * RS format. possible option is SLLAO - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Type | Code | Checksum | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Reserved | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Options ... - * +-+-+-+-+-+-+-+-+-+-+-+- - * - * - * RA format. possible options: prefix information, MTU, SLLAO - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Type | Code | Checksum | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Cur Hop Limit |M|O| Reserved | Router Lifetime | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Reachable Time | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Retrans Timer | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Options ... - * +-+-+-+-+-+-+-+-+-+-+-+- - * - * - * NS format: options should be SLLAO - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Type | Code | Checksum | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Reserved | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * + + - * | | - * + Target Address + - * | | - * + + - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Options ... - * +-+-+-+-+-+-+-+-+-+-+-+- - * - * - * NA message format. possible options is TLLAO - * - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Type | Code | Checksum | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * |R|S|O| Reserved | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * + + - * | | - * + Target Address + - * | | - * + + - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Options ... - * +-+-+-+-+-+-+-+-+-+-+-+- - * - * - * Redirect message format. Possible options are TLLAO and Redirected header - * - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Type | Code | Checksum | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Reserved | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * + + - * | | - * + Target Address + - * | | - * + + - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * + + - * | | - * + Destination Address + - * | | - * + + - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Options ... - * +-+-+-+-+-+-+-+-+-+-+-+- - * - * - * SLLAO/TLLAO option: - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Type | Length | Link-Layer Address ... - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * - * Prefix information option - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Type | Length | Prefix Length |L|A| Reserved1 | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Valid Lifetime | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Preferred Lifetime | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Reserved2 | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * + + - * | | - * + Prefix + - * | | - * + + - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * - * MTU option - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Type | Length | Reserved | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | MTU | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * - * Redirected header option - * - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Type | Length | Reserved | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Reserved | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * ~ IP header + data ~ - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - */ -#endif /* UIP_ND6_H_ */ - -/** @} */ diff --git a/os/net/ipv6/uip-packetqueue.c b/os/net/ipv6/uip-packetqueue.c deleted file mode 100644 index 847234c39..000000000 --- a/os/net/ipv6/uip-packetqueue.c +++ /dev/null @@ -1,86 +0,0 @@ -#include - -#include "net/ipv6/uip.h" - -#include "lib/memb.h" - -#include "net/ipv6/uip-packetqueue.h" - -#define MAX_NUM_QUEUED_PACKETS 2 -MEMB(packets_memb, struct uip_packetqueue_packet, MAX_NUM_QUEUED_PACKETS); - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/*---------------------------------------------------------------------------*/ -static void -packet_timedout(void *ptr) -{ - struct uip_packetqueue_handle *h = ptr; - - PRINTF("uip_packetqueue_free timed out %p\n", h); - memb_free(&packets_memb, h->packet); - h->packet = NULL; -} -/*---------------------------------------------------------------------------*/ -void -uip_packetqueue_new(struct uip_packetqueue_handle *handle) -{ - PRINTF("uip_packetqueue_new %p\n", handle); - handle->packet = NULL; -} -/*---------------------------------------------------------------------------*/ -struct uip_packetqueue_packet * -uip_packetqueue_alloc(struct uip_packetqueue_handle *handle, clock_time_t lifetime) -{ - PRINTF("uip_packetqueue_alloc %p\n", handle); - if(handle->packet != NULL) { - PRINTF("alloced\n"); - return NULL; - } - handle->packet = memb_alloc(&packets_memb); - if(handle->packet != NULL) { - ctimer_set(&handle->packet->lifetimer, lifetime, - packet_timedout, handle); - } else { - PRINTF("uip_packetqueue_alloc failed\n"); - } - return handle->packet; -} -/*---------------------------------------------------------------------------*/ -void -uip_packetqueue_free(struct uip_packetqueue_handle *handle) -{ - PRINTF("uip_packetqueue_free %p\n", handle); - if(handle->packet != NULL) { - ctimer_stop(&handle->packet->lifetimer); - memb_free(&packets_memb, handle->packet); - handle->packet = NULL; - } -} -/*---------------------------------------------------------------------------*/ -uint8_t * -uip_packetqueue_buf(struct uip_packetqueue_handle *h) -{ - return h->packet != NULL? h->packet->queue_buf: NULL; -} -/*---------------------------------------------------------------------------*/ -uint16_t -uip_packetqueue_buflen(struct uip_packetqueue_handle *h) -{ - return h->packet != NULL? h->packet->queue_buf_len: 0; -} -/*---------------------------------------------------------------------------*/ -void -uip_packetqueue_set_buflen(struct uip_packetqueue_handle *h, uint16_t len) -{ - if(h->packet != NULL) { - h->packet->queue_buf_len = len; - } -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/ipv6/uip-packetqueue.h b/os/net/ipv6/uip-packetqueue.h deleted file mode 100644 index 1deacb9ba..000000000 --- a/os/net/ipv6/uip-packetqueue.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef UIP_PACKETQUEUE_H -#define UIP_PACKETQUEUE_H - -#include "sys/ctimer.h" - -struct uip_packetqueue_handle; - -struct uip_packetqueue_packet { - struct uip_ds6_queued_packet *next; - uint8_t queue_buf[UIP_BUFSIZE]; - uint16_t queue_buf_len; - struct ctimer lifetimer; - struct uip_packetqueue_handle *handle; -}; - -struct uip_packetqueue_handle { - struct uip_packetqueue_packet *packet; -}; - -void uip_packetqueue_new(struct uip_packetqueue_handle *handle); - - -struct uip_packetqueue_packet * -uip_packetqueue_alloc(struct uip_packetqueue_handle *handle, clock_time_t lifetime); - - -void -uip_packetqueue_free(struct uip_packetqueue_handle *handle); - -uint8_t *uip_packetqueue_buf(struct uip_packetqueue_handle *h); -uint16_t uip_packetqueue_buflen(struct uip_packetqueue_handle *h); -void uip_packetqueue_set_buflen(struct uip_packetqueue_handle *h, uint16_t len); - - -#endif /* UIP_PACKETQUEUE_H */ diff --git a/os/net/ipv6/uip-sr.c b/os/net/ipv6/uip-sr.c deleted file mode 100644 index 133fd6f28..000000000 --- a/os/net/ipv6/uip-sr.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) 2016, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup uip - * @{ - * - * \file - * Source routing support - * - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "net/ipv6/uip-sr.h" -#include "net/ipv6/uiplib.h" -#include "net/routing/routing.h" -#include "lib/list.h" -#include "lib/memb.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "IPv6 SR" -#define LOG_LEVEL LOG_LEVEL_IPV6 - -/* Total number of nodes */ -static int num_nodes; - -/* Every known node in the network */ -LIST(nodelist); -MEMB(nodememb, uip_sr_node_t, UIP_SR_LINK_NUM); - -/*---------------------------------------------------------------------------*/ -int -uip_sr_num_nodes(void) -{ - return num_nodes; -} -/*---------------------------------------------------------------------------*/ -static int -node_matches_address(void *graph, const uip_sr_node_t *node, const uip_ipaddr_t *addr) -{ - if(node == NULL || addr == NULL || graph != node->graph) { - return 0; - } else { - uip_ipaddr_t node_ipaddr; - NETSTACK_ROUTING.get_sr_node_ipaddr(&node_ipaddr, node); - return uip_ipaddr_cmp(&node_ipaddr, addr); - } -} -/*---------------------------------------------------------------------------*/ -uip_sr_node_t * -uip_sr_get_node(void *graph, const uip_ipaddr_t *addr) -{ - uip_sr_node_t *l; - for(l = list_head(nodelist); l != NULL; l = list_item_next(l)) { - /* Compare prefix and node identifier */ - if(node_matches_address(graph, l, addr)) { - return l; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -int -uip_sr_is_addr_reachable(void *graph, const uip_ipaddr_t *addr) -{ - int max_depth = UIP_SR_LINK_NUM; - uip_ipaddr_t root_ipaddr; - uip_sr_node_t *node; - uip_sr_node_t *root_node; - - NETSTACK_ROUTING.get_root_ipaddr(&root_ipaddr); - node = uip_sr_get_node(graph, addr); - root_node = uip_sr_get_node(graph, &root_ipaddr); - - while(node != NULL && node != root_node && max_depth > 0) { - node = node->parent; - max_depth--; - } - return node != NULL && node == root_node; -} -/*---------------------------------------------------------------------------*/ -void -uip_sr_expire_parent(void *graph, const uip_ipaddr_t *child, const uip_ipaddr_t *parent) -{ - uip_sr_node_t *l = uip_sr_get_node(graph, child); - /* Check if parent matches */ - if(l != NULL && node_matches_address(graph, l->parent, parent)) { - l->lifetime = UIP_SR_REMOVAL_DELAY; - } -} -/*---------------------------------------------------------------------------*/ -uip_sr_node_t * -uip_sr_update_node(void *graph, const uip_ipaddr_t *child, const uip_ipaddr_t *parent, uint32_t lifetime) -{ - uip_sr_node_t *child_node = uip_sr_get_node(graph, child); - uip_sr_node_t *parent_node = uip_sr_get_node(graph, parent); - uip_sr_node_t *old_parent_node; - - if(parent != NULL) { - /* No node for the parent, add one with infinite lifetime */ - if(parent_node == NULL) { - parent_node = uip_sr_update_node(graph, parent, NULL, UIP_SR_INFINITE_LIFETIME); - if(parent_node == NULL) { - LOG_ERR("NS: no space left for root node!\n"); - return NULL; - } - } - } - - /* No node for this child, add one */ - if(child_node == NULL) { - child_node = memb_alloc(&nodememb); - /* No space left, abort */ - if(child_node == NULL) { - LOG_ERR("NS: no space left for child "); - LOG_ERR_6ADDR(child); - LOG_ERR_("\n"); - return NULL; - } - child_node->parent = NULL; - list_add(nodelist, child_node); - num_nodes++; - } - - /* Initialize node */ - child_node->graph = graph; - child_node->lifetime = lifetime; - memcpy(child_node->link_identifier, ((const unsigned char *)child) + 8, 8); - - /* Is the node reachable before the update? */ - if(uip_sr_is_addr_reachable(graph, child)) { - old_parent_node = child_node->parent; - /* Update node */ - child_node->parent = parent_node; - /* Has the node become unreachable? May happen if we create a loop. */ - if(!uip_sr_is_addr_reachable(graph, child)) { - /* The new parent makes the node unreachable, restore old parent. - * We will take the update next time, with chances we know more of - * the topology and the loop is gone. */ - child_node->parent = old_parent_node; - } - } else { - child_node->parent = parent_node; - } - - LOG_INFO("NS: updating link, child "); - LOG_INFO_6ADDR(child); - LOG_INFO_(", parent "); - LOG_INFO_6ADDR(parent); - LOG_INFO_(", lifetime %u, num_nodes %u\n", (unsigned)lifetime, num_nodes); - - return child_node; -} -/*---------------------------------------------------------------------------*/ -void -uip_sr_init(void) -{ - num_nodes = 0; - memb_init(&nodememb); - list_init(nodelist); -} -/*---------------------------------------------------------------------------*/ -uip_sr_node_t * -uip_sr_node_head(void) -{ - return list_head(nodelist); -} -/*---------------------------------------------------------------------------*/ -uip_sr_node_t * -uip_sr_node_next(uip_sr_node_t *item) -{ - return list_item_next(item); -} -/*---------------------------------------------------------------------------*/ -void -uip_sr_periodic(unsigned seconds) -{ - uip_sr_node_t *l; - uip_sr_node_t *next; - - /* First pass, for all expired nodes, deallocate them iff no child points to them */ - for(l = list_head(nodelist); l != NULL; l = next) { - next = list_item_next(l); - if(l->lifetime == 0) { - uip_sr_node_t *l2; - for(l2 = list_head(nodelist); l2 != NULL; l2 = list_item_next(l2)) { - if(l2->parent == l) { - break; - } - } - if(LOG_INFO_ENABLED) { - uip_ipaddr_t node_addr; - NETSTACK_ROUTING.get_sr_node_ipaddr(&node_addr, l); - LOG_INFO("NS: removing expired node "); - LOG_INFO_6ADDR(&node_addr); - LOG_INFO_("\n"); - } - /* No child found, deallocate node */ - list_remove(nodelist, l); - memb_free(&nodememb, l); - num_nodes--; - } else if(l->lifetime != UIP_SR_INFINITE_LIFETIME) { - l->lifetime = l->lifetime > seconds ? l->lifetime - seconds : 0; - } - } -} -/*---------------------------------------------------------------------------*/ -void -uip_sr_free_all(void) -{ - uip_sr_node_t *l; - uip_sr_node_t *next; - for(l = list_head(nodelist); l != NULL; l = next) { - next = list_item_next(l); - list_remove(nodelist, l); - memb_free(&nodememb, l); - num_nodes--; - } -} -/*---------------------------------------------------------------------------*/ -int -uip_sr_link_snprint(char *buf, int buflen, uip_sr_node_t *link) -{ - int index = 0; - uip_ipaddr_t child_ipaddr; - uip_ipaddr_t parent_ipaddr; - - NETSTACK_ROUTING.get_sr_node_ipaddr(&child_ipaddr, link); - NETSTACK_ROUTING.get_sr_node_ipaddr(&parent_ipaddr, link->parent); - - if(LOG_WITH_COMPACT_ADDR) { - index += log_6addr_compact_snprint(buf+index, buflen-index, &child_ipaddr); - } else { - index += uiplib_ipaddr_snprint(buf+index, buflen-index, &child_ipaddr); - } - if(index >= buflen) { - return index; - } - - if(link->parent == NULL) { - index += snprintf(buf+index, buflen-index, " (DODAG root)"); - if(index >= buflen) { - return index; - } - } else { - index += snprintf(buf+index, buflen-index, " to "); - if(index >= buflen) { - return index; - } - if(LOG_WITH_COMPACT_ADDR) { - index += log_6addr_compact_snprint(buf+index, buflen-index, &parent_ipaddr); - } else { - index += uiplib_ipaddr_snprint(buf+index, buflen-index, &parent_ipaddr); - } - if(index >= buflen) { - return index; - } - } - if(link->lifetime != UIP_SR_INFINITE_LIFETIME) { - index += snprintf(buf+index, buflen-index, - " (lifetime: %lu seconds)", (unsigned long)link->lifetime); - if(index >= buflen) { - return index; - } - } else { - index += snprintf(buf+index, buflen-index, " (lifetime: infinite)"); - if(index >= buflen) { - return index; - } - } - return index; -} -/** @} */ diff --git a/os/net/ipv6/uip-sr.h b/os/net/ipv6/uip-sr.h deleted file mode 100644 index 01ed57c1c..000000000 --- a/os/net/ipv6/uip-sr.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2016, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup uip - * @{ - * - * \file - * Source routing support - * - * \author Simon Duquennoy - */ - - -#ifndef UIP_SR_H -#define UIP_SR_H - -/********** Includes **********/ - -#include "contiki.h" -#include "net/ipv6/uip.h" - -/********** Configuration **********/ - -/* The number of source routing nodes, i.e. the maximum netwrok size at the root */ -#ifdef UIP_SR_CONF_LINK_NUM - -#define UIP_SR_LINK_NUM UIP_SR_CONF_LINK_NUM - -#else /* UIP_SR_CONF_LINK_NUM */ - -#if ROUTING_CONF_RPL_LITE -#define UIP_SR_LINK_NUM NETSTACK_MAX_ROUTE_ENTRIES -#elif ROUTING_CONF_RPL_CLASSIC - -#include "net/routing/rpl-classic/rpl-conf.h" -#if RPL_WITH_NON_STORING -#define UIP_SR_LINK_NUM NETSTACK_MAX_ROUTE_ENTRIES -#else /* RPL_WITH_NON_STORING */ -#define UIP_SR_LINK_NUM 0 -#endif /* RPL_WITH_NON_STORING */ - -#else - -#define UIP_SR_LINK_NUM 0 - -#endif - -#endif /* UIP_SR_CONF_LINK_NUM */ - -/* Delay between between expiration order and actual node removal */ -#ifdef UIP_SR_CONF_REMOVAL_DELAY -#define UIP_SR_REMOVAL_DELAY UIP_SR_CONF_REMOVAL_DELAY -#else /* UIP_SR_CONF_REMOVAL_DELAY */ -#define UIP_SR_REMOVAL_DELAY 60 -#endif /* UIP_SR_CONF_REMOVAL_DELAY */ - -#define UIP_SR_INFINITE_LIFETIME 0xFFFFFFFF - -/********** Data Structures **********/ - -/** \brief A node in a source routing graph, stored at the root and representing - * all child-parent relationship. Used to build source routes */ -typedef struct uip_sr_node { - struct uip_sr_node *next; - uint32_t lifetime; - /* Protocol-specific graph structure */ - void *graph; - /* Store only IPv6 link identifiers, the routing protocol will provide - us with the prefix */ - unsigned char link_identifier[8]; - struct uip_sr_node *parent; -} uip_sr_node_t; - -/********** Public functions **********/ - -/** - * Tells how many nodes are currently stored in the graph - * - * \return The number of nodes -*/ -int uip_sr_num_nodes(void); - -/** - * Expires a given child-parent link - * - * \param graph The graph the link belongs to - * \param child The IPv6 address of the child - * \param parent The IPv6 address of the parent -*/ -void uip_sr_expire_parent(void *graph, const uip_ipaddr_t *child, const uip_ipaddr_t *parent); - -/** - * Updates a child-parent link - * - * \param graph The graph the link belongs to - * \param child The IPv6 address of the child - * \param parent The IPv6 address of the parent - * \param lifetime The link lifetime in seconds -*/ -uip_sr_node_t *uip_sr_update_node(void *graph, const uip_ipaddr_t *child, const uip_ipaddr_t *parent, uint32_t lifetime); - -/** - * Returns the head of the non-storing node list - * - * \return The head of the list -*/ -uip_sr_node_t *uip_sr_node_head(void); - -/** - * Returns the next element of the non-storing node list - * - * \param item The current element in the list - * \return The next element of the list -*/ -uip_sr_node_t *uip_sr_node_next(uip_sr_node_t *item); - -/** - * Looks up for a source routing node from its IPv6 global address - * - * \param graph The graph where to look up for the node - * \param addr The target address - * \return A pointer to the node -*/ -uip_sr_node_t *uip_sr_get_node(void *graph, const uip_ipaddr_t *addr); - -/** - * Telle whether an address is reachable, i.e. if there exists a path from - * the root to the node in the current source routing graph - * - * \param graph The graph where to look up for the node - * \param addr The target IPv6 global address - * \return 1 if the node is reachable, 0 otherwise -*/ -int uip_sr_is_addr_reachable(void *graph, const uip_ipaddr_t *addr); - -/** - * A function called periodically. Used to age the links (decrease lifetime - * and expire links accordingly) - * - * \param seconds The number of seconds elapsted since last call -*/ -void uip_sr_periodic(unsigned seconds); - -/** - * Initialize this module -*/ -void uip_sr_init(void); - -/** - * Deallocate all neighbors -*/ -void uip_sr_free_all(void); - -/** -* Print a textual description of a source routing link -* -* \param buf The buffer where to write content -* \param buflen The buffer len -* \param link A pointer to the source routing link -* \return Identical to snprintf: number of bytes written excluding ending null -* byte. A value >= buflen if the buffer was too small. -*/ -int uip_sr_link_snprint(char *buf, int buflen, uip_sr_node_t *link); - - /** @} */ - -#endif /* UIP_SR_H */ diff --git a/os/net/ipv6/uip-udp-packet.c b/os/net/ipv6/uip-udp-packet.c deleted file mode 100644 index c5526b162..000000000 --- a/os/net/ipv6/uip-udp-packet.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Module for sending UDP packets through uIP. - * \author - * Adam Dunkels - */ - -#include "contiki.h" - -extern uint16_t uip_slen; - -#include "net/ipv6/uip-udp-packet.h" -#include "net/ipv6/multicast/uip-mcast6.h" - -#include - -/*---------------------------------------------------------------------------*/ -void -uip_udp_packet_send(struct uip_udp_conn *c, const void *data, int len) -{ -#if UIP_UDP - if(data != NULL && len <= (UIP_BUFSIZE - UIP_IPUDPH_LEN)) { - uip_udp_conn = c; - uip_slen = len; - memmove(&uip_buf[UIP_IPUDPH_LEN], data, len); - uip_process(UIP_UDP_SEND_CONN); - -#if UIP_IPV6_MULTICAST - /* Let the multicast engine process the datagram before we send it */ - if(uip_is_addr_mcast_routable(&uip_udp_conn->ripaddr)) { - UIP_MCAST6.out(); - } -#endif /* UIP_IPV6_MULTICAST */ - -#if NETSTACK_CONF_WITH_IPV6 - tcpip_ipv6_output(); -#else - if(uip_len > 0) { - tcpip_output(); - } -#endif - } - uip_slen = 0; -#endif /* UIP_UDP */ -} -/*---------------------------------------------------------------------------*/ -void -uip_udp_packet_sendto(struct uip_udp_conn *c, const void *data, int len, - const uip_ipaddr_t *toaddr, uint16_t toport) -{ - uip_ipaddr_t curaddr; - uint16_t curport; - - if(toaddr != NULL) { - /* Save current IP addr/port. */ - uip_ipaddr_copy(&curaddr, &c->ripaddr); - curport = c->rport; - - /* Load new IP addr/port */ - uip_ipaddr_copy(&c->ripaddr, toaddr); - c->rport = toport; - - uip_udp_packet_send(c, data, len); - - /* Restore old IP addr/port */ - uip_ipaddr_copy(&c->ripaddr, &curaddr); - c->rport = curport; - } -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/ipv6/uip-udp-packet.h b/os/net/ipv6/uip-udp-packet.h deleted file mode 100644 index ff16f9e1c..000000000 --- a/os/net/ipv6/uip-udp-packet.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for module for sending UDP packets through uIP. - * \author - * Adam Dunkels - */ - -#ifndef UIP_UDP_PACKET_H_ -#define UIP_UDP_PACKET_H_ - -#include "net/ipv6/uip.h" - -void uip_udp_packet_send(struct uip_udp_conn *c, const void *data, int len); -void uip_udp_packet_sendto(struct uip_udp_conn *c, const void *data, int len, - const uip_ipaddr_t *toaddr, uint16_t toport); - -#endif /* UIP_UDP_PACKET_H_ */ diff --git a/os/net/ipv6/uip.h b/os/net/ipv6/uip.h deleted file mode 100755 index 32ffc6ed4..000000000 --- a/os/net/ipv6/uip.h +++ /dev/null @@ -1,2151 +0,0 @@ -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * Header file for the uIP TCP/IP stack. - * \author Adam Dunkels - * \author Julien Abeille (IPv6 related code) - * \author Mathilde Durvy (IPv6 related code) - * - * The uIP TCP/IP stack header file contains definitions for a number - * of C macros that are used by uIP programs as well as internal uIP - * structures, TCP/IP header structures and function declarations. - * - */ - -#ifndef UIP_H_ -#define UIP_H_ - -/* Header sizes. */ -#define UIP_IPH_LEN 40 -#define UIP_FRAGH_LEN 8 - -#define UIP_UDPH_LEN 8 /* Size of UDP header */ -#define UIP_TCPH_LEN 20 /* Size of TCP header */ -#define UIP_ICMPH_LEN 4 /* Size of ICMP header */ - -#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN) /* Size of IP + UDP header */ -#define UIP_IPTCPH_LEN (UIP_TCPH_LEN + UIP_IPH_LEN) /* Size of IP + TCP header */ - -#define uip_l3_icmp_hdr_len (UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN) - -/** - * Direct access to IPv6 header - */ -#define UIP_IP_BUF ((struct uip_ip_hdr *)uip_buf) -#define UIP_IP_PAYLOAD(ext) ((unsigned char *)uip_buf + UIP_IPH_LEN + (ext)) - -/** - * Direct access to ICMP, UDP, and TCP headers and payload, with implicit ext header offset (global uip_ext_len) - */ -#define UIP_ICMP_BUF ((struct uip_icmp_hdr *)UIP_IP_PAYLOAD(uip_ext_len)) -#define UIP_ICMP_PAYLOAD ((unsigned char *)UIP_IP_PAYLOAD(uip_ext_len) + UIP_ICMPH_LEN) -#define UIP_UDP_BUF ((struct uip_udp_hdr *)UIP_IP_PAYLOAD(uip_ext_len)) -#define UIP_UDP_PAYLOAD ((unsigned char *)UIP_IP_PAYLOAD(uip_ext_len) + UIP_UDPH_LEN) -#define UIP_TCP_BUF ((struct uip_tcp_hdr *)UIP_IP_PAYLOAD(uip_ext_len)) -#define UIP_TCP_PAYLOAD ((unsigned char *)UIP_IP_PAYLOAD(uip_ext_len) + UIP_TCPH_LEN) - -#include "net/ipv6/uipopt.h" -#include "net/ipv6/uipbuf.h" -#include "net/linkaddr.h" - -/* For memcmp */ -#include - -/** - * Representation of an IP address. - * - */ -typedef union uip_ip4addr_t { - uint8_t u8[4]; /* Initializer, must come first. */ - uint16_t u16[2]; -} uip_ip4addr_t; - -typedef union uip_ip6addr_t { - uint8_t u8[16]; /* Initializer, must come first. */ - uint16_t u16[8]; -} uip_ip6addr_t; - -typedef uip_ip6addr_t uip_ipaddr_t; - -/*---------------------------------------------------------------------------*/ -#define UIP_802154_SHORTADDR_LEN 2 -#define UIP_802154_LONGADDR_LEN 8 - -/** \brief 16 bit 802.15.4 address */ -typedef struct uip_802154_shortaddr { - uint8_t addr[UIP_802154_SHORTADDR_LEN]; -} uip_802154_shortaddr; -/** \brief 64 bit 802.15.4 address */ -typedef struct uip_802154_longaddr { - uint8_t addr[UIP_802154_LONGADDR_LEN]; -} uip_802154_longaddr; - -/** \brief 802.11 address */ -typedef struct uip_80211_addr { - uint8_t addr[6]; -} uip_80211_addr; - -/** \brief 802.3 address */ -typedef struct uip_eth_addr { - uint8_t addr[6]; -} uip_eth_addr; - - -#ifndef UIP_CONF_LL_802154 -#define UIP_CONF_LL_802154 1 -#endif /* UIP_CONF_LL_802154 */ - -#if UIP_CONF_LL_802154 -/** \brief 802.15.4 address */ -#if LINKADDR_SIZE == UIP_802154_LONGADDR_LEN -typedef uip_802154_longaddr uip_lladdr_t; -#elif LINKADDR_SIZE == UIP_802154_SHORTADDR_LEN -typedef uip_802154_shortaddr uip_lladdr_t; -#else /* LINKADDR_SIZE == 8 */ -#error unsupported configuration of LINKADDR_SIZE -#endif /* LINKADDR_SIZE == 8 */ -/** \brief Link layer address length */ -#define UIP_LLADDR_LEN LINKADDR_SIZE -#else /*UIP_CONF_LL_802154*/ -#if UIP_CONF_LL_80211 -/** \brief 802.11 address */ -typedef uip_80211_addr uip_lladdr_t; -/** \brief Link layer address length */ -#define UIP_LLADDR_LEN 6 -#else /*UIP_CONF_LL_80211*/ -/** \brief Ethernet address */ -typedef uip_eth_addr uip_lladdr_t; -/** \brief Link layer address length */ -#define UIP_LLADDR_LEN 6 -#endif /*UIP_CONF_LL_80211*/ -#endif /*UIP_CONF_LL_802154*/ - -#include "net/ipv6/tcpip.h" - -/*---------------------------------------------------------------------------*/ -/* First, the functions that should be called from the - * system. Initialization, the periodic timer, and incoming packets are - * handled by the following three functions. - */ -/** - * \defgroup uipconffunc uIP configuration functions - * @{ - * - * The uIP configuration functions are used for setting run-time - * parameters in uIP such as IP addresses. - */ - -/** - * Set the IP address of this host. - * - * The IP address is represented as a 4-byte array where the first - * octet of the IP address is put in the first member of the 4-byte - * array. - * - * Example: - \code - - uip_ipaddr_t addr; - - uip_ipaddr(&addr, 192,168,1,2); - uip_sethostaddr(&addr); - - \endcode - * \param addr A pointer to an IP address of type uip_ipaddr_t; - * - * \sa uip_ipaddr() - * - * \hideinitializer - */ -#define uip_sethostaddr(addr) uip_ipaddr_copy(&uip_hostaddr, (addr)) - -/** - * Get the IP address of this host. - * - * The IP address is represented as a 4-byte array where the first - * octet of the IP address is put in the first member of the 4-byte - * array. - * - * Example: - \code - uip_ipaddr_t hostaddr; - - uip_gethostaddr(&hostaddr); - \endcode - * \param addr A pointer to a uip_ipaddr_t variable that will be - * filled in with the currently configured IP address. - * - * \hideinitializer - */ -#define uip_gethostaddr(addr) uip_ipaddr_copy((addr), &uip_hostaddr) - -/** - * Set the default router's IP address. - * - * \param addr A pointer to a uip_ipaddr_t variable containing the IP - * address of the default router. - * - * \sa uip_ipaddr() - * - * \hideinitializer - */ -#define uip_setdraddr(addr) uip_ipaddr_copy(&uip_draddr, (addr)) - -/** - * Set the netmask. - * - * \param addr A pointer to a uip_ipaddr_t variable containing the IP - * address of the netmask. - * - * \sa uip_ipaddr() - * - * \hideinitializer - */ -#define uip_setnetmask(addr) uip_ipaddr_copy(&uip_netmask, (addr)) - - -/** - * Get the default router's IP address. - * - * \param addr A pointer to a uip_ipaddr_t variable that will be - * filled in with the IP address of the default router. - * - * \hideinitializer - */ -#define uip_getdraddr(addr) uip_ipaddr_copy((addr), &uip_draddr) - -/** - * Get the netmask. - * - * \param addr A pointer to a uip_ipaddr_t variable that will be - * filled in with the value of the netmask. - * - * \hideinitializer - */ -#define uip_getnetmask(addr) uip_ipaddr_copy((addr), &uip_netmask) - -/** @} */ - -/** - * \defgroup uipinit uIP initialization functions - * @{ - * - * The uIP initialization functions are used for booting uIP. - */ - -/** - * uIP initialization function. - * - * This function should be called at boot up to initilize the uIP - * TCP/IP stack. - */ -void uip_init(void); - -/** - * uIP initialization function. - * - * This function may be used at boot time to set the initial ip_id. - */ -void uip_setipid(uint16_t id); - -/** @} */ - -/** - * \defgroup uipdevfunc uIP device driver functions - * @{ - * - * These functions are used by a network device driver for interacting - * with uIP. - */ - -/** - * Process an incoming packet. - * - * This function should be called when the device driver has received - * a packet from the network. The packet from the device driver must - * be present in the uip_buf buffer, and the length of the packet - * should be placed in the uip_len variable. - * - * When the function returns, there may be an outbound packet placed - * in the uip_buf packet buffer. If so, the uip_len variable is set to - * the length of the packet. If no packet is to be sent out, the - * uip_len variable is set to 0. - * - * The usual way of calling the function is presented by the source - * code below. - \code - uip_len = devicedriver_poll(); - if(uip_len > 0) { - uip_input(); - if(uip_len > 0) { - devicedriver_send(); - } - } - \endcode - * - * \note If you are writing a uIP device driver that needs ARP - * (Address Resolution Protocol), e.g., when running uIP over - * Ethernet, you will need to call the uIP ARP code before calling - * this function: - \code - #define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - uip_len = ethernet_devicedrver_poll(); - if(uip_len > 0) { - if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) { - uip_arp_ipin(); - uip_input(); - if(uip_len > 0) { - uip_arp_out(); - ethernet_devicedriver_send(); - } - } else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - if(uip_len > 0) { - ethernet_devicedriver_send(); - } - } - \endcode - * - * \hideinitializer - */ -#define uip_input() uip_process(UIP_DATA) - - -/** - * Periodic processing for a connection identified by its number. - * - * This function does the necessary periodic processing (timers, - * polling) for a uIP TCP connection, and should be called when the - * periodic uIP timer goes off. It should be called for every - * connection, regardless of whether they are open of closed. - * - * When the function returns, it may have an outbound packet waiting - * for service in the uIP packet buffer, and if so the uip_len - * variable is set to a value larger than zero. The device driver - * should be called to send out the packet. - * - * The usual way of calling the function is through a for() loop like - * this: - \code - for(i = 0; i < UIP_TCP_CONNS; ++i) { - uip_periodic(i); - if(uip_len > 0) { - devicedriver_send(); - } - } - \endcode - * - * \note If you are writing a uIP device driver that needs ARP - * (Address Resolution Protocol), e.g., when running uIP over - * Ethernet, you will need to call the uip_arp_out() function before - * calling the device driver: - \code - for(i = 0; i < UIP_TCP_CONNS; ++i) { - uip_periodic(i); - if(uip_len > 0) { - uip_arp_out(); - ethernet_devicedriver_send(); - } - } - \endcode - * - * \param conn The number of the connection which is to be periodically polled. - * - * \hideinitializer - */ -#if UIP_TCP -#define uip_periodic(conn) do { uip_conn = &uip_conns[conn]; \ - uip_process(UIP_TIMER); } while (0) - -/** - * Macro to determine whether a specific uIP connection is active - * - * \param conn The connection's number - * \retval 0 Connection closed - */ -#define uip_conn_active(conn) (uip_conns[conn].tcpstateflags != UIP_CLOSED) - -/** - * Perform periodic processing for a connection identified by a pointer - * to its structure. - * - * Same as uip_periodic() but takes a pointer to the actual uip_conn - * struct instead of an integer as its argument. This function can be - * used to force periodic processing of a specific connection. - * - * \param conn A pointer to the uip_conn struct for the connection to - * be processed. - * - * \hideinitializer - */ -#define uip_periodic_conn(conn) do { uip_conn = conn; \ - uip_process(UIP_TIMER); } while (0) - -/** - * Request that a particular connection should be polled. - * - * Similar to uip_periodic_conn() but does not perform any timer - * processing. The application is polled for new data. - * - * \param conn A pointer to the uip_conn struct for the connection to - * be processed. - * - * \hideinitializer - */ -#define uip_poll_conn(conn) do { uip_conn = conn; \ - uip_process(UIP_POLL_REQUEST); } while (0) - -#endif /* UIP_TCP */ - -#if UIP_UDP -/** - * Periodic processing for a UDP connection identified by its number. - * - * This function is essentially the same as uip_periodic(), but for - * UDP connections. It is called in a similar fashion as the - * uip_periodic() function: - \code - for(i = 0; i < UIP_UDP_CONNS; i++) { - uip_udp_periodic(i); - if(uip_len > 0) { - devicedriver_send(); - } - } - \endcode - * - * \note As for the uip_periodic() function, special care has to be - * taken when using uIP together with ARP and Ethernet: - \code - for(i = 0; i < UIP_UDP_CONNS; i++) { - uip_udp_periodic(i); - if(uip_len > 0) { - uip_arp_out(); - ethernet_devicedriver_send(); - } - } - \endcode - * - * \param conn The number of the UDP connection to be processed. - * - * \hideinitializer - */ -#define uip_udp_periodic(conn) do { uip_udp_conn = &uip_udp_conns[conn]; \ - uip_process(UIP_UDP_TIMER); } while(0) - -/** - * Periodic processing for a UDP connection identified by a pointer to - * its structure. - * - * Same as uip_udp_periodic() but takes a pointer to the actual - * uip_conn struct instead of an integer as its argument. This - * function can be used to force periodic processing of a specific - * connection. - * - * \param conn A pointer to the uip_udp_conn struct for the connection - * to be processed. - * - * \hideinitializer - */ -#define uip_udp_periodic_conn(conn) do { uip_udp_conn = conn; \ - uip_process(UIP_UDP_TIMER); } while(0) -#endif /* UIP_UDP */ - -/** \brief Abandon the reassembly of the current packet */ -void uip_reass_over(void); - -/** - * The uIP packet buffer. - * - * The uip_aligned_buf array is used to hold incoming and outgoing - * packets. The device driver should place incoming data into this - * buffer. When sending data, the device driver should read the - * outgoing data from this buffer. -*/ - -typedef union { - uint32_t u32[(UIP_BUFSIZE + 3) / 4]; - uint8_t u8[UIP_BUFSIZE]; -} uip_buf_t; - -extern uip_buf_t uip_aligned_buf; - -/** Macro to access uip_aligned_buf as an array of bytes */ -#define uip_buf (uip_aligned_buf.u8) - - -/** @} */ - -/*---------------------------------------------------------------------------*/ -/* Functions that are used by the uIP application program. Opening and - * closing connections, sending and receiving data, etc. is all - * handled by the functions below. - */ -/** - * \defgroup uipappfunc uIP application functions - * @{ - * - * Functions used by an application running on top of uIP. - */ - -/** - * Start listening to the specified port. - * - * \note Since this function expects the port number in network byte - * order, a conversion using UIP_HTONS() or uip_htons() is necessary. - * - \code - uip_listen(UIP_HTONS(80)); - \endcode - * - * \param port A 16-bit port number in network byte order. - */ -void uip_listen(uint16_t port); - -/** - * Stop listening to the specified port. - * - * \note Since this function expects the port number in network byte - * order, a conversion using UIP_HTONS() or uip_htons() is necessary. - * - \code - uip_unlisten(UIP_HTONS(80)); - \endcode - * - * \param port A 16-bit port number in network byte order. - */ -void uip_unlisten(uint16_t port); - -/** - * Connect to a remote host using TCP. - * - * This function is used to start a new connection to the specified - * port on the specified host. It allocates a new connection identifier, - * sets the connection to the SYN_SENT state and sets the - * retransmission timer to 0. This will cause a TCP SYN segment to be - * sent out the next time this connection is periodically processed, - * which usually is done within 0.5 seconds after the call to - * uip_connect(). - * - * \note This function is available only if support for active open - * has been configured by defining UIP_ACTIVE_OPEN to 1 in uipopt.h. - * - * \note Since this function requires the port number to be in network - * byte order, a conversion using UIP_HTONS() or uip_htons() is necessary. - * - \code - uip_ipaddr_t ipaddr; - - uip_ipaddr(&ipaddr, 192,168,1,2); - uip_connect(&ipaddr, UIP_HTONS(80)); - \endcode - * - * \param ripaddr The IP address of the remote host. - * - * \param port A 16-bit port number in network byte order. - * - * \return A pointer to the uIP connection identifier for the new connection, - * or NULL if no connection could be allocated. - * - */ -struct uip_conn *uip_connect(const uip_ipaddr_t *ripaddr, uint16_t port); - - - -/** - * \internal - * - * Check if a connection has outstanding (i.e., unacknowledged) data. - * - * \param conn A pointer to the uip_conn structure for the connection. - * - * \hideinitializer - */ -#define uip_outstanding(conn) ((conn)->len) - -/** - * Send data on the current connection. - * - * This function is used to send out a single segment of TCP - * data. Only applications that have been invoked by uIP for event - * processing can send data. - * - * The amount of data that actually is sent out after a call to this - * function is determined by the maximum amount of data TCP allows. uIP - * will automatically crop the data so that only the appropriate - * amount of data is sent. The function uip_mss() can be used to query - * uIP for the amount of data that actually will be sent. - * - * \note This function does not guarantee that the sent data will - * arrive at the destination. If the data is lost in the network, the - * application will be invoked with the uip_rexmit() event being - * set. The application will then have to resend the data using this - * function. - * - * \param data A pointer to the data which is to be sent. - * - * \param len The maximum amount of data bytes to be sent. - * - * \hideinitializer - */ -void uip_send(const void *data, int len); - -/** - * The length of any incoming data that is currently available (if available) - * in the uip_appdata buffer. - * - * The test function uip_data() must first be used to check if there - * is any data available at all. - * - * \hideinitializer - */ -/*void uip_datalen(void);*/ -#define uip_datalen() uip_len - -/** - * The length of any out-of-band data (urgent data) that has arrived - * on the connection. - * - * \note The configuration parameter UIP_URGDATA must be set for this - * function to be enabled. - * - * \hideinitializer - */ -#define uip_urgdatalen() uip_urglen - -/** - * Close the current connection. - * - * This function will close the current connection in a nice way. - * - * \hideinitializer - */ -#define uip_close() (uip_flags = UIP_CLOSE) - -/** - * Abort the current connection. - * - * This function will abort (reset) the current connection, and is - * usually used when an error has occurred that prevents using the - * uip_close() function. - * - * \hideinitializer - */ -#define uip_abort() (uip_flags = UIP_ABORT) - -/** - * Tell the sending host to stop sending data. - * - * This function will close our receiver's window so that we stop - * receiving data for the current connection. - * - * \hideinitializer - */ -#define uip_stop() (uip_conn->tcpstateflags |= UIP_STOPPED) - -/** - * Find out if the current connection has been previously stopped with - * uip_stop(). - * - * \hideinitializer - */ -#define uip_stopped(conn) ((conn)->tcpstateflags & UIP_STOPPED) - -/** - * Restart the current connection, if is has previously been stopped - * with uip_stop(). - * - * This function will open the receiver's window again so that we - * start receiving data for the current connection. - * - * \hideinitializer - */ -#define uip_restart() do { uip_flags |= UIP_NEWDATA; \ - uip_conn->tcpstateflags &= ~UIP_STOPPED; \ - } while(0) - - -/* uIP tests that can be made to determine in what state the current - connection is, and what the application function should do. */ - -/** - * Is the current connection a UDP connection? - * - * This function checks whether the current connection is a UDP connection. - * - * \hideinitializer - * - */ -#define uip_udpconnection() (uip_conn == NULL) - -/** - * Is new incoming data available? - * - * Will reduce to non-zero if there is new data for the application - * present at the uip_appdata pointer. The size of the data is - * available through the uip_len variable. - * - * \hideinitializer - */ -#define uip_newdata() (uip_flags & UIP_NEWDATA) - -/** - * Has previously sent data been acknowledged? - * - * Will reduce to non-zero if the previously sent data has been - * acknowledged by the remote host. This means that the application - * can send new data. - * - * \hideinitializer - */ -#define uip_acked() (uip_flags & UIP_ACKDATA) - -/** - * Has the connection just been connected? - * - * Reduces to non-zero if the current connection has been connected to - * a remote host. This will happen both if the connection has been - * actively opened (with uip_connect()) or passively opened (with - * uip_listen()). - * - * \hideinitializer - */ -#define uip_connected() (uip_flags & UIP_CONNECTED) - -/** - * Has the connection been closed by the other end? - * - * Is non-zero if the connection has been closed by the remote - * host. The application may then do the necessary clean-ups. - * - * \hideinitializer - */ -#define uip_closed() (uip_flags & UIP_CLOSE) - -/** - * Has the connection been aborted by the other end? - * - * Non-zero if the current connection has been aborted (reset) by the - * remote host. - * - * \hideinitializer - */ -#define uip_aborted() (uip_flags & UIP_ABORT) - -/** - * Has the connection timed out? - * - * Non-zero if the current connection has been aborted due to too many - * retransmissions. - * - * \hideinitializer - */ -#define uip_timedout() (uip_flags & UIP_TIMEDOUT) - -/** - * Do we need to retransmit previously data? - * - * Reduces to non-zero if the previously sent data has been lost in - * the network, and the application should retransmit it. The - * application should send the exact same data as it did the last - * time, using the uip_send() function. - * - * \hideinitializer - */ -#define uip_rexmit() (uip_flags & UIP_REXMIT) - -/** - * Is the connection being polled by uIP? - * - * Is non-zero if the reason the application is invoked is that the - * current connection has been idle for a while and should be - * polled. - * - * The polling event can be used for sending data without having to - * wait for the remote host to send data. - * - * \hideinitializer - */ -#define uip_poll() (uip_flags & UIP_POLL) - -/** - * Get the initial maximum segment size (MSS) of the current - * connection. - * - * \hideinitializer - */ -#define uip_initialmss() (uip_conn->initialmss) - -/** - * Get the current maximum segment size that can be sent on the current - * connection. - * - * The current maximum segment size that can be sent on the - * connection is computed from the receiver's window and the MSS of - * the connection (which also is available by calling - * uip_initialmss()). - * - * \hideinitializer - */ -#define uip_mss() (uip_conn->mss) - -/** - * Set up a new UDP connection. - * - * This function sets up a new UDP connection. The function will - * automatically allocate an unused local port for the new - * connection. However, another port can be chosen by using the - * uip_udp_bind() call, after the uip_udp_new() function has been - * called. - * - * Example: - \code - uip_ipaddr_t addr; - struct uip_udp_conn *c; - - uip_ipaddr(&addr, 192,168,2,1); - c = uip_udp_new(&addr, UIP_HTONS(12345)); - if(c != NULL) { - uip_udp_bind(c, UIP_HTONS(12344)); - } - \endcode - * \param ripaddr The IP address of the remote host. - * - * \param rport The remote port number in network byte order. - * - * \return The uip_udp_conn structure for the new connection, or NULL - * if no connection could be allocated. - */ -struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport); - -/** - * Remove a UDP connection. - * - * \param conn A pointer to the uip_udp_conn structure for the connection. - * - * \hideinitializer - */ -#define uip_udp_remove(conn) (conn)->lport = 0 - -/** - * Bind a UDP connection to a local port. - * - * \param conn A pointer to the uip_udp_conn structure for the - * connection. - * - * \param port The local port number, in network byte order. - * - * \hideinitializer - */ -#define uip_udp_bind(conn, port) (conn)->lport = port - -/** - * Send a UDP datagram of length len on the current connection. - * - * This function can only be called in response to a UDP event (poll - * or newdata). The data must be present in the uip_buf buffer, at the - * place pointed to by the uip_appdata pointer. - * - * \param len The length of the data in the uip_buf buffer. - * - * \hideinitializer - */ -#define uip_udp_send(len) uip_send((char *)uip_appdata, len) - - -/** @} */ - -/* uIP convenience and converting functions. */ - -/** - * \defgroup uipconvfunc uIP conversion functions - * @{ - * - * These functions can be used for converting between different data - * formats used by uIP. - */ - -/** - * Convert an IP address to four bytes separated by commas. - * - * Example: - \code - uip_ipaddr_t ipaddr; - printf("ipaddr=%d.%d.%d.%d\n", uip_ipaddr_to_quad(&ipaddr)); - \endcode - * - * \param a A pointer to a uip_ipaddr_t. - * \hideinitializer - */ -#define uip_ipaddr_to_quad(a) (a)->u8[0],(a)->u8[1],(a)->u8[2],(a)->u8[3] - -/** - * Construct an IP address from four bytes. - * - * This function constructs an IP address of the type that uIP handles - * internally from four bytes. The function is handy for specifying IP - * addresses to use with e.g. the uip_connect() function. - * - * Example: - \code - uip_ipaddr_t ipaddr; - struct uip_conn *c; - - uip_ipaddr(&ipaddr, 192,168,1,2); - c = uip_connect(&ipaddr, UIP_HTONS(80)); - \endcode - * - * \param addr A pointer to a uip_ipaddr_t variable that will be - * filled in with the IP address. - * - * \param addr0 The first octet of the IP address. - * \param addr1 The second octet of the IP address. - * \param addr2 The third octet of the IP address. - * \param addr3 The forth octet of the IP address. - * - * \hideinitializer - */ -#define uip_ipaddr(addr, addr0,addr1,addr2,addr3) do { \ - (addr)->u8[0] = addr0; \ - (addr)->u8[1] = addr1; \ - (addr)->u8[2] = addr2; \ - (addr)->u8[3] = addr3; \ - } while(0) - -/** - * Construct an IPv6 address from eight 16-bit words. - * - * This function constructs an IPv6 address. - * - * \hideinitializer - */ -#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \ - (addr)->u16[0] = UIP_HTONS(addr0); \ - (addr)->u16[1] = UIP_HTONS(addr1); \ - (addr)->u16[2] = UIP_HTONS(addr2); \ - (addr)->u16[3] = UIP_HTONS(addr3); \ - (addr)->u16[4] = UIP_HTONS(addr4); \ - (addr)->u16[5] = UIP_HTONS(addr5); \ - (addr)->u16[6] = UIP_HTONS(addr6); \ - (addr)->u16[7] = UIP_HTONS(addr7); \ - } while(0) - -/** - * Construct an IPv6 address from sixteen 8-bit words. - * - * This function constructs an IPv6 address. - * - * \hideinitializer - */ -#define uip_ip6addr_u8(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7,addr8,addr9,addr10,addr11,addr12,addr13,addr14,addr15) do { \ - (addr)->u8[0] = addr0; \ - (addr)->u8[1] = addr1; \ - (addr)->u8[2] = addr2; \ - (addr)->u8[3] = addr3; \ - (addr)->u8[4] = addr4; \ - (addr)->u8[5] = addr5; \ - (addr)->u8[6] = addr6; \ - (addr)->u8[7] = addr7; \ - (addr)->u8[8] = addr8; \ - (addr)->u8[9] = addr9; \ - (addr)->u8[10] = addr10; \ - (addr)->u8[11] = addr11; \ - (addr)->u8[12] = addr12; \ - (addr)->u8[13] = addr13; \ - (addr)->u8[14] = addr14; \ - (addr)->u8[15] = addr15; \ - } while(0) - - -/** - * Copy an IP address from one place to another. - * - * Copies an IP address from one place to another. - * - * Example: - \code - uip_ipaddr_t ipaddr1, ipaddr2; - - uip_ipaddr(&ipaddr1, 192,16,1,2); - uip_ipaddr_copy(&ipaddr2, &ipaddr1); - \endcode - * - * \param dest The destination for the copy. - * \param src The source from where to copy. - * - * \hideinitializer - */ -#ifndef uip_ipaddr_copy -#define uip_ipaddr_copy(dest, src) (*(dest) = *(src)) -#endif -#ifndef uip_ip4addr_copy -#define uip_ip4addr_copy(dest, src) (*((uip_ip4addr_t *)dest) = *((uip_ip4addr_t *)src)) -#endif -#ifndef uip_ip6addr_copy -#define uip_ip6addr_copy(dest, src) (*((uip_ip6addr_t *)dest) = *((uip_ip6addr_t *)src)) -#endif - -/** - * Compare two IP addresses - * - * Compares two IP addresses. - * - * Example: - \code - uip_ipaddr_t ipaddr1, ipaddr2; - - uip_ipaddr(&ipaddr1, 192,16,1,2); - if(uip_ipaddr_cmp(&ipaddr2, &ipaddr1)) { - printf("They are the same"); - } - \endcode - * - * \param addr1 The first IP address. - * \param addr2 The second IP address. - * - * \hideinitializer - */ -#define uip_ip4addr_cmp(addr1, addr2) ((addr1)->u16[0] == (addr2)->u16[0] && \ - (addr1)->u16[1] == (addr2)->u16[1]) -#define uip_ip6addr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0) - -#define uip_ipaddr_cmp(addr1, addr2) uip_ip6addr_cmp(addr1, addr2) - -/** - * Compare two IP addresses with netmasks - * - * Compares two IP addresses with netmasks. The masks are used to mask - * out the bits that are to be compared. - * - * Example: - \code - uip_ipaddr_t ipaddr1, ipaddr2, mask; - - uip_ipaddr(&mask, 255,255,255,0); - uip_ipaddr(&ipaddr1, 192,16,1,2); - uip_ipaddr(&ipaddr2, 192,16,1,3); - if(uip_ipaddr_maskcmp(&ipaddr1, &ipaddr2, &mask)) { - printf("They are the same"); - } - \endcode - * - * \param addr1 The first IP address. - * \param addr2 The second IP address. - * \param mask The netmask. - * - * \hideinitializer - */ - -#define uip_ipaddr_maskcmp(addr1, addr2, mask) \ - (((((uint16_t *)addr1)[0] & ((uint16_t *)mask)[0]) == \ - (((uint16_t *)addr2)[0] & ((uint16_t *)mask)[0])) && \ - ((((uint16_t *)addr1)[1] & ((uint16_t *)mask)[1]) == \ - (((uint16_t *)addr2)[1] & ((uint16_t *)mask)[1]))) - -#define uip_ipaddr_prefixcmp(addr1, addr2, length) (memcmp(addr1, addr2, length>>3) == 0) - - - -/* - * Check if an address is a broadcast address for a network. - * - * Checks if an address is the broadcast address for a network. The - * network is defined by an IP address that is on the network and the - * network's netmask. - * - * \param addr The IP address. - * \param netaddr The network's IP address. - * \param netmask The network's netmask. - * - * \hideinitializer - */ -/*#define uip_ipaddr_isbroadcast(addr, netaddr, netmask) - ((uip_ipaddr_t *)(addr)).u16 & ((uip_ipaddr_t *)(addr)).u16*/ - - - -/** - * Mask out the network part of an IP address. - * - * Masks out the network part of an IP address, given the address and - * the netmask. - * - * Example: - \code - uip_ipaddr_t ipaddr1, ipaddr2, netmask; - - uip_ipaddr(&ipaddr1, 192,16,1,2); - uip_ipaddr(&netmask, 255,255,255,0); - uip_ipaddr_mask(&ipaddr2, &ipaddr1, &netmask); - \endcode - * - * In the example above, the variable "ipaddr2" will contain the IP - * address 192.168.1.0. - * - * \param dest Where the result is to be placed. - * \param src The IP address. - * \param mask The netmask. - * - * \hideinitializer - */ -#define uip_ipaddr_mask(dest, src, mask) do { \ - ((uint16_t *)dest)[0] = ((uint16_t *)src)[0] & ((uint16_t *)mask)[0]; \ - ((uint16_t *)dest)[1] = ((uint16_t *)src)[1] & ((uint16_t *)mask)[1]; \ - } while(0) - -/** - * Pick the first octet of an IP address. - * - * Picks out the first octet of an IP address. - * - * Example: - \code - uip_ipaddr_t ipaddr; - uint8_t octet; - - uip_ipaddr(&ipaddr, 1,2,3,4); - octet = uip_ipaddr1(&ipaddr); - \endcode - * - * In the example above, the variable "octet" will contain the value 1. - * - * \hideinitializer - */ -#define uip_ipaddr1(addr) ((addr)->u8[0]) - -/** - * Pick the second octet of an IP address. - * - * Picks out the second octet of an IP address. - * - * Example: - \code - uip_ipaddr_t ipaddr; - uint8_t octet; - - uip_ipaddr(&ipaddr, 1,2,3,4); - octet = uip_ipaddr2(&ipaddr); - \endcode - * - * In the example above, the variable "octet" will contain the value 2. - * - * \hideinitializer - */ -#define uip_ipaddr2(addr) ((addr)->u8[1]) - -/** - * Pick the third octet of an IP address. - * - * Picks out the third octet of an IP address. - * - * Example: - \code - uip_ipaddr_t ipaddr; - uint8_t octet; - - uip_ipaddr(&ipaddr, 1,2,3,4); - octet = uip_ipaddr3(&ipaddr); - \endcode - * - * In the example above, the variable "octet" will contain the value 3. - * - * \hideinitializer - */ -#define uip_ipaddr3(addr) ((addr)->u8[2]) - -/** - * Pick the fourth octet of an IP address. - * - * Picks out the fourth octet of an IP address. - * - * Example: - \code - uip_ipaddr_t ipaddr; - uint8_t octet; - - uip_ipaddr(&ipaddr, 1,2,3,4); - octet = uip_ipaddr4(&ipaddr); - \endcode - * - * In the example above, the variable "octet" will contain the value 4. - * - * \hideinitializer - */ -#define uip_ipaddr4(addr) ((addr)->u8[3]) - -/** - * Convert 16-bit quantity from host byte order to network byte order. - * - * This macro is primarily used for converting constants from host - * byte order to network byte order. For converting variables to - * network byte order, use the uip_htons() function instead. - * - * \hideinitializer - */ -#ifndef UIP_HTONS -# if UIP_BYTE_ORDER == UIP_BIG_ENDIAN -# define UIP_HTONS(n) (n) -# define UIP_HTONL(n) (n) -# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ -# define UIP_HTONS(n) (uint16_t)((((uint16_t) (n)) << 8) | (((uint16_t) (n)) >> 8)) -# define UIP_HTONL(n) (((uint32_t)UIP_HTONS(n) << 16) | UIP_HTONS((uint32_t)(n) >> 16)) -# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ -#else -#error "UIP_HTONS already defined!" -#endif /* UIP_HTONS */ - -/** - * Convert a 16-bit quantity from host byte order to network byte order. - * - * This function is primarily used for converting variables from host - * byte order to network byte order. For converting constants to - * network byte order, use the UIP_HTONS() macro instead. - */ -#ifndef uip_htons -uint16_t uip_htons(uint16_t val); -#endif /* uip_htons */ -#ifndef uip_ntohs -#define uip_ntohs uip_htons -#endif - -#ifndef uip_htonl -uint32_t uip_htonl(uint32_t val); -#endif /* uip_htonl */ -#ifndef uip_ntohl -#define uip_ntohl uip_htonl -#endif - -/** @} */ - -/** - * Pointer to the application data in the packet buffer. - * - * This pointer points to the application data when the application is - * called. If the application wishes to send data, the application may - * use this space to write the data into before calling uip_send(). - */ -extern void *uip_appdata; - -#if UIP_URGDATA > 0 -/* uint8_t *uip_urgdata: - * - * This pointer points to any urgent data that has been received. Only - * present if compiled with support for urgent data (UIP_URGDATA). - */ -extern void *uip_urgdata; -#endif /* UIP_URGDATA > 0 */ - - -/** - * \defgroup uipdrivervars Variables used in uIP device drivers - * @{ - * - * uIP has a few global variables that are used in device drivers for - * uIP. - */ - -/** - * The length of the packet in the uip_buf buffer. - * - * The global variable uip_len holds the length of the packet in the - * uip_buf buffer. - * - * When the network device driver calls the uIP input function, - * uip_len should be set to the length of the packet in the uip_buf - * buffer. - * - * When sending packets, the device driver should use the contents of - * the uip_len variable to determine the length of the outgoing - * packet. - * - */ -extern uint16_t uip_len; - -/** - * The length of the extension headers - */ -extern uint8_t uip_ext_len; - -/** The final protocol after IPv6 extension headers: - * UIP_PROTO_TCP, UIP_PROTO_UDP or UIP_PROTO_ICMP6 */ -extern uint8_t uip_last_proto; -/** @} */ - -#if UIP_URGDATA > 0 -extern uint16_t uip_urglen, uip_surglen; -#endif /* UIP_URGDATA > 0 */ - -/** - * Representation of a uIP TCP connection. - * - * The uip_conn structure is used for identifying a connection. All - * but one field in the structure are to be considered read-only by an - * application. The only exception is the appstate field whose purpose - * is to let the application store application-specific state (e.g., - * file pointers) for the connection. The type of this field is - * configured in the "uipopt.h" header file. - */ -struct uip_conn { - uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */ - - uint16_t lport; /**< The local TCP port, in network byte order. */ - uint16_t rport; /**< The local remote TCP port, in network byte - order. */ - - uint8_t rcv_nxt[4]; /**< The sequence number that we expect to - receive next. */ - uint8_t snd_nxt[4]; /**< The sequence number that was last sent by us. */ - uint16_t len; /**< Length of the data that was previously sent. */ - uint16_t mss; /**< Current maximum segment size for the connection. */ - uint16_t initialmss; /**< Initial maximum segment size for the connection. */ - uint8_t sa; /**< Retransmission time-out calculation state variable. */ - uint8_t sv; /**< Retransmission time-out calculation state variable. */ - uint8_t rto; /**< Retransmission time-out. */ - uint8_t tcpstateflags; /**< TCP state and flags. */ - uint8_t timer; /**< The retransmission timer. */ - uint8_t nrtx; /**< The number of retransmissions for the last - segment sent. */ - uip_tcp_appstate_t appstate; /** The application state. */ -}; - - -/** - * Pointer to the current TCP connection. - * - * The uip_conn pointer can be used to access the current TCP - * connection. - */ - -extern struct uip_conn *uip_conn; -#if UIP_TCP -/* The array containing all uIP connections. */ -extern struct uip_conn uip_conns[UIP_TCP_CONNS]; -#endif - -/** - * \addtogroup uiparch - * @{ - */ - -/** - * 4-byte array used for the 32-bit sequence number calculations. - */ -extern uint8_t uip_acc32[4]; -/** @} */ - -/** - * Representation of a uIP UDP connection. - */ -struct uip_udp_conn { - uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */ - uint16_t lport; /**< The local port number in network byte order. */ - uint16_t rport; /**< The remote port number in network byte order. */ - uint8_t ttl; /**< Default time-to-live. */ - /** The application state. */ - uip_udp_appstate_t appstate; -}; - -/** - * The current UDP connection. - */ -extern struct uip_udp_conn *uip_udp_conn; -extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; - -struct uip_fallback_interface { - void (*init)(void); - /** - * \retval >=0 - * in case of success - * \retval <0 - * in case of failure - */ - int (*output)(void); -}; - -#if UIP_CONF_ICMP6 -struct uip_icmp6_conn { - uip_icmp6_appstate_t appstate; -}; -extern struct uip_icmp6_conn uip_icmp6_conns; -#endif /*UIP_CONF_ICMP6*/ - -/** - * The uIP TCP/IP statistics. - * - * This is the variable in which the uIP TCP/IP statistics are gathered. - */ -#if UIP_STATISTICS == 1 -extern struct uip_stats uip_stat; -#define UIP_STAT(s) s -#else -#define UIP_STAT(s) -#endif /* UIP_STATISTICS == 1 */ - -/** - * The structure holding the TCP/IP statistics that are gathered if - * UIP_STATISTICS is set to 1. - * - */ -struct uip_stats { - struct { - uip_stats_t recv; /**< Number of received packets at the IP layer. */ - uip_stats_t sent; /**< Number of sent packets at the IP layer. */ - uip_stats_t forwarded;/**< Number of forwarded packets at the IP layer. */ - uip_stats_t drop; /**< Number of dropped packets at the IP layer. */ - uip_stats_t vhlerr; /**< Number of packets dropped due to wrong - IP version or header length. */ - uip_stats_t hblenerr; /**< Number of packets dropped due to wrong - IP length, high byte. */ - uip_stats_t lblenerr; /**< Number of packets dropped due to wrong - IP length, low byte. */ - uip_stats_t fragerr; /**< Number of packets dropped because they - were IP fragments. */ - uip_stats_t chkerr; /**< Number of packets dropped due to IP - checksum errors. */ - uip_stats_t protoerr; /**< Number of packets dropped because they - were neither ICMP, UDP nor TCP. */ - } ip; /**< IP statistics. */ - struct { - uip_stats_t recv; /**< Number of received ICMP packets. */ - uip_stats_t sent; /**< Number of sent ICMP packets. */ - uip_stats_t drop; /**< Number of dropped ICMP packets. */ - uip_stats_t typeerr; /**< Number of ICMP packets with a wrong type. */ - uip_stats_t chkerr; /**< Number of ICMP packets with a bad checksum. */ - } icmp; /**< ICMP statistics. */ -#if UIP_TCP - struct { - uip_stats_t recv; /**< Number of recived TCP segments. */ - uip_stats_t sent; /**< Number of sent TCP segments. */ - uip_stats_t drop; /**< Number of dropped TCP segments. */ - uip_stats_t chkerr; /**< Number of TCP segments with a bad checksum. */ - uip_stats_t ackerr; /**< Number of TCP segments with a bad ACK number. */ - uip_stats_t rst; /**< Number of received TCP RST (reset) segments. */ - uip_stats_t rexmit; /**< Number of retransmitted TCP segments. */ - uip_stats_t syndrop; /**< Number of dropped SYNs because too few - connections were available. */ - uip_stats_t synrst; /**< Number of SYNs for closed ports, - triggering a RST. */ - } tcp; /**< TCP statistics. */ -#endif -#if UIP_UDP - struct { - uip_stats_t drop; /**< Number of dropped UDP segments. */ - uip_stats_t recv; /**< Number of recived UDP segments. */ - uip_stats_t sent; /**< Number of sent UDP segments. */ - uip_stats_t chkerr; /**< Number of UDP segments with a bad - checksum. */ - } udp; /**< UDP statistics. */ -#endif /* UIP_UDP */ - struct { - uip_stats_t drop; /**< Number of dropped ND6 packets. */ - uip_stats_t recv; /**< Number of recived ND6 packets */ - uip_stats_t sent; /**< Number of sent ND6 packets */ - } nd6; -}; - - -/*---------------------------------------------------------------------------*/ -/* All the stuff below this point is internal to uIP and should not be - * used directly by an application or by a device driver. - */ -/*---------------------------------------------------------------------------*/ - -/** - * The Ethernet header. - */ -struct uip_eth_hdr { - struct uip_eth_addr dest; - struct uip_eth_addr src; - uint16_t type; -}; - -#define UIP_ETHTYPE_ARP 0x0806 -#define UIP_ETHTYPE_IP 0x0800 -#define UIP_ETHTYPE_IPV6 0x86dd - -/* uint8_t uip_flags: - * - * When the application is called, uip_flags will contain the flags - * that are defined in this file. Please read below for more - * information. - */ -extern uint8_t uip_flags; - -/* The following flags may be set in the global variable uip_flags - before calling the application callback. The UIP_ACKDATA, - UIP_NEWDATA, and UIP_CLOSE flags may both be set at the same time, - whereas the others are mutually exclusive. Note that these flags - should *NOT* be accessed directly, but only through the uIP - functions/macros. */ - -#define UIP_ACKDATA 1 /* Signifies that the outstanding data was - acked and the application should send - out new data instead of retransmitting - the last data. */ -#define UIP_NEWDATA 2 /* Flags the fact that the peer has sent - us new data. */ -#define UIP_REXMIT 4 /* Tells the application to retransmit the - data that was last sent. */ -#define UIP_POLL 8 /* Used for polling the application, to - check if the application has data that - it wants to send. */ -#define UIP_CLOSE 16 /* The remote host has closed the - connection, thus the connection has - gone away. Or the application signals - that it wants to close the - connection. */ -#define UIP_ABORT 32 /* The remote host has aborted the - connection, thus the connection has - gone away. Or the application signals - that it wants to abort the - connection. */ -#define UIP_CONNECTED 64 /* We have got a connection from a remote - host and have set up a new connection - for it, or an active connection has - been successfully established. */ - -#define UIP_TIMEDOUT 128 /* The connection has been aborted due to - too many retransmissions. */ - - -/** - * \brief process the options within a hop by hop or destination option header - * \retval 0: nothing to send, - * \retval 1: drop pkt - * \retval 2: ICMP error message to send -*/ -/*static uint8_t -uip_ext_hdr_options_process(); */ - -/* uip_process(flag): - * - * The actual uIP function which does all the work. - */ -void uip_process(uint8_t flag); - - /* The following flags are passed as an argument to the uip_process() - function. They are used to distinguish between the two cases where - uip_process() is called. It can be called either because we have - incoming data that should be processed, or because the periodic - timer has fired. These values are never used directly, but only in - the macros defined in this file. */ - -#define UIP_DATA 1 /* Tells uIP that there is incoming - data in the uip_buf buffer. The - length of the data is stored in the - global variable uip_len. */ -#define UIP_TIMER 2 /* Tells uIP that the periodic timer - has fired. */ -#define UIP_POLL_REQUEST 3 /* Tells uIP that a connection should - be polled. */ -#define UIP_UDP_SEND_CONN 4 /* Tells uIP that a UDP datagram - should be constructed in the - uip_buf buffer. */ -#if UIP_UDP -#define UIP_UDP_TIMER 5 -#endif /* UIP_UDP */ - -/* The TCP states used in the uip_conn->tcpstateflags. */ -#define UIP_CLOSED 0 -#define UIP_SYN_RCVD 1 -#define UIP_SYN_SENT 2 -#define UIP_ESTABLISHED 3 -#define UIP_FIN_WAIT_1 4 -#define UIP_FIN_WAIT_2 5 -#define UIP_CLOSING 6 -#define UIP_TIME_WAIT 7 -#define UIP_LAST_ACK 8 -#define UIP_TS_MASK 15 - -#define UIP_STOPPED 16 - -/* - * In IPv6 the length of the L3 headers before the transport header is - * not fixed, due to the possibility to include extension option headers - * after the IP header. hence we split here L3 and L4 headers - */ -/* The IP header */ - -struct uip_ip_hdr { - /* IPV6 header */ - uint8_t vtc; - uint8_t tcflow; - uint16_t flow; - uint8_t len[2]; - uint8_t proto, ttl; - uip_ip6addr_t srcipaddr, destipaddr; -}; - - -/* - * IPv6 extension option headers: we are able to process - * the 4 extension headers defined in RFC2460 (IPv6): - * - Hop by hop option header, destination option header: - * These two are not used by any core IPv6 protocol, hence - * we just read them and go to the next. They convey options, - * the options defined in RFC2460 are Pad1 and PadN, which do - * some padding, and that we do not need to read (the length - * field in the header is enough) - * - Routing header: this one is most notably used by MIPv6, - * which we do not implement, hence we just read it and go - * to the next - * - Fragmentation header: we read this header and are able to - * reassemble packets - * - * We do not offer any means to send packets with extension headers - * - * We do not implement Authentication and ESP headers, which are - * used in IPSec and defined in RFC4302,4303,4305,4385 - */ -/* common header part */ -typedef struct uip_ext_hdr { - uint8_t next; - uint8_t len; -} uip_ext_hdr; - -/* Hop by Hop option header */ -typedef struct uip_hbho_hdr { - uint8_t next; - uint8_t len; -} uip_hbho_hdr; - -/* destination option header */ -typedef struct uip_desto_hdr { - uint8_t next; - uint8_t len; -} uip_desto_hdr; - -/* We do not define structures for PAD1 and PADN options */ - -/* - * routing header - * the routing header as 4 common bytes, then routing header type - * specific data there are several types of routing header. Type 0 was - * deprecated as per RFC5095 most notable other type is 2, used in - * RFC3775 (MIPv6) here we do not implement MIPv6, so we just need to - * parse the 4 first bytes - */ -typedef struct uip_routing_hdr { - uint8_t next; - uint8_t len; - uint8_t routing_type; - uint8_t seg_left; -} uip_routing_hdr; - -/* RPL Source Routing Header */ -typedef struct uip_rpl_srh_hdr { - uint8_t cmpr; /* CmprI and CmprE */ - uint8_t pad; - uint8_t reserved[2]; -} uip_rpl_srh_hdr; - -/* fragmentation header */ -typedef struct uip_frag_hdr { - uint8_t next; - uint8_t res; - uint16_t offsetresmore; - uint32_t id; -} uip_frag_hdr; - -/* - * an option within the destination or hop by hop option headers - * it contains type an length, which is true for all options but PAD1 - */ -typedef struct uip_ext_hdr_opt { - uint8_t type; - uint8_t len; -} uip_ext_hdr_opt; - -/* PADN option */ -typedef struct uip_ext_hdr_opt_padn { - uint8_t opt_type; - uint8_t opt_len; -} uip_ext_hdr_opt_padn; - -/* RPL option */ -typedef struct uip_ext_hdr_opt_rpl { - uint8_t opt_type; - uint8_t opt_len; - uint8_t flags; - uint8_t instance; - uint16_t senderrank; -} uip_ext_hdr_opt_rpl; - -/* TCP header */ -struct uip_tcp_hdr { - uint16_t srcport; - uint16_t destport; - uint8_t seqno[4]; - uint8_t ackno[4]; - uint8_t tcpoffset; - uint8_t flags; - uint8_t wnd[2]; - uint16_t tcpchksum; - uint8_t urgp[2]; - uint8_t optdata[4]; -}; - -/* The ICMP headers. */ -struct uip_icmp_hdr { - uint8_t type, icode; - uint16_t icmpchksum; -}; - - -/* The UDP headers. */ -struct uip_udp_hdr { - uint16_t srcport; - uint16_t destport; - uint16_t udplen; - uint16_t udpchksum; -}; - - -/** - * The buffer size available for user data in the \ref uip_buf buffer. - * - * This macro holds the available size for user data in the \ref - * uip_buf buffer. The macro is intended to be used for checking - * bounds of available user data. - * - * Example: - \code - snprintf(uip_appdata, UIP_APPDATA_SIZE, "%u\n", i); - \endcode - * - * \hideinitializer - */ -#define UIP_APPDATA_SIZE (UIP_BUFSIZE - UIP_IPTCPH_LEN) - -#define UIP_PROTO_ICMP 1 -#define UIP_PROTO_TCP 6 -#define UIP_PROTO_UDP 17 -#define UIP_PROTO_ICMP6 58 - - -/** @{ */ -/** \brief extension headers types */ -#define UIP_PROTO_HBHO 0 -#define UIP_PROTO_DESTO 60 -#define UIP_PROTO_ROUTING 43 -#define UIP_PROTO_FRAG 44 -#define UIP_PROTO_NONE 59 -/** @} */ - -#define uip_is_proto_ext_hdr(proto) ((proto) != UIP_PROTO_TCP && (proto) != UIP_PROTO_UDP && (proto) != UIP_PROTO_ICMP6) - -/** @{ */ -/** \brief Destination and Hop By Hop extension headers option types */ -#define UIP_EXT_HDR_OPT_PAD1 0 -#define UIP_EXT_HDR_OPT_PADN 1 -#define UIP_EXT_HDR_OPT_RPL 0x63 - -/** @} */ - -/** @{ */ -/** - * \brief Bitmaps for extension header processing - * - * When processing extension headers, we should record somehow which one we - * see, because you cannot have twice the same header, except for destination - * We store all this in one uint8_t bitmap one bit for each header expected. The - * order in the bitmap is the order recommended in RFC2460 - */ -#define UIP_EXT_HDR_BITMAP_HBHO 0x01 -#define UIP_EXT_HDR_BITMAP_DESTO1 0x02 -#define UIP_EXT_HDR_BITMAP_ROUTING 0x04 -#define UIP_EXT_HDR_BITMAP_FRAG 0x08 -#define UIP_EXT_HDR_BITMAP_AH 0x10 -#define UIP_EXT_HDR_BITMAP_ESP 0x20 -#define UIP_EXT_HDR_BITMAP_DESTO2 0x40 -/** @} */ - - -#if UIP_FIXEDADDR -extern const uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr; -#else /* UIP_FIXEDADDR */ -extern uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr; -#endif /* UIP_FIXEDADDR */ -extern const uip_ipaddr_t uip_broadcast_addr; -extern const uip_ipaddr_t uip_all_zeroes_addr; - -#if UIP_FIXEDETHADDR -extern const uip_lladdr_t uip_lladdr; -#else -extern uip_lladdr_t uip_lladdr; -#endif - -/** Length of the link local prefix */ -#define UIP_LLPREF_LEN 10 - -/** - * \brief Is IPv6 address a the unspecified address - * a is of type uip_ipaddr_t - */ -#define uip_is_addr_loopback(a) \ - ((((a)->u16[0]) == 0) && \ - (((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u16[5]) == 0) && \ - (((a)->u16[6]) == 0) && \ - (((a)->u8[14]) == 0) && \ - (((a)->u8[15]) == 0x01)) -/** - * \brief Is IPv6 address a the unspecified address - * a is of type uip_ipaddr_t - */ -#define uip_is_addr_unspecified(a) \ - ((((a)->u16[0]) == 0) && \ - (((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u16[5]) == 0) && \ - (((a)->u16[6]) == 0) && \ - (((a)->u16[7]) == 0)) - -/** \brief Is IPv6 address a the link local all-nodes multicast address */ -#define uip_is_addr_linklocal_allnodes_mcast(a) \ - ((((a)->u8[0]) == 0xff) && \ - (((a)->u8[1]) == 0x02) && \ - (((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u16[5]) == 0) && \ - (((a)->u16[6]) == 0) && \ - (((a)->u8[14]) == 0) && \ - (((a)->u8[15]) == 0x01)) - -/** \brief Is IPv6 address a the link local all-routers multicast address */ -#define uip_is_addr_linklocal_allrouters_mcast(a) \ - ((((a)->u8[0]) == 0xff) && \ - (((a)->u8[1]) == 0x02) && \ - (((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u16[5]) == 0) && \ - (((a)->u16[6]) == 0) && \ - (((a)->u8[14]) == 0) && \ - (((a)->u8[15]) == 0x02)) - -/** - * \brief is addr (a) a link local unicast address, see RFC 4291 - * i.e. is (a) on prefix FE80::/10 - * a is of type uip_ipaddr_t* - */ -#define uip_is_addr_linklocal(a) \ - ((a)->u8[0] == 0xfe && \ - (a)->u8[1] == 0x80) - -/** \brief set IP address a to unspecified */ -#define uip_create_unspecified(a) uip_ip6addr(a, 0, 0, 0, 0, 0, 0, 0, 0) - -/** \brief set IP address a to the link local all-nodes multicast address */ -#define uip_create_linklocal_allnodes_mcast(a) uip_ip6addr(a, 0xff02, 0, 0, 0, 0, 0, 0, 0x0001) - -/** \brief set IP address a to the link local all-routers multicast address */ -#define uip_create_linklocal_allrouters_mcast(a) uip_ip6addr(a, 0xff02, 0, 0, 0, 0, 0, 0, 0x0002) -#define uip_create_linklocal_prefix(addr) do { \ - (addr)->u16[0] = UIP_HTONS(0xfe80); \ - (addr)->u16[1] = 0; \ - (addr)->u16[2] = 0; \ - (addr)->u16[3] = 0; \ - } while(0) - -/** - * \brief is addr (a) a solicited node multicast address, see RFC 4291 - * a is of type uip_ipaddr_t* - */ -#define uip_is_addr_solicited_node(a) \ - ((((a)->u8[0]) == 0xFF) && \ - (((a)->u8[1]) == 0x02) && \ - (((a)->u16[1]) == 0x00) && \ - (((a)->u16[2]) == 0x00) && \ - (((a)->u16[3]) == 0x00) && \ - (((a)->u16[4]) == 0x00) && \ - (((a)->u8[10]) == 0x00) && \ - (((a)->u8[11]) == 0x01) && \ - (((a)->u8[12]) == 0xFF)) - -/** - * \brief put in b the solicited node address corresponding to address a - * both a and b are of type uip_ipaddr_t* - * */ -#define uip_create_solicited_node(a, b) \ - (((b)->u8[0]) = 0xFF); \ - (((b)->u8[1]) = 0x02); \ - (((b)->u16[1]) = 0); \ - (((b)->u16[2]) = 0); \ - (((b)->u16[3]) = 0); \ - (((b)->u16[4]) = 0); \ - (((b)->u8[10]) = 0); \ - (((b)->u8[11]) = 0x01); \ - (((b)->u8[12]) = 0xFF); \ - (((b)->u8[13]) = ((a)->u8[13])); \ - (((b)->u16[7]) = ((a)->u16[7])) - -/** - * \brief was addr (a) forged based on the mac address m - * a type is uip_ipaddr_t - * m type is uiplladdr_t - */ -#if UIP_CONF_LL_802154 -#define uip_is_addr_mac_addr_based(a, m) \ - ((((a)->u8[8]) == (((m)->addr[0]) ^ 0x02)) && \ - (((a)->u8[9]) == (m)->addr[1]) && \ - (((a)->u8[10]) == (m)->addr[2]) && \ - (((a)->u8[11]) == (m)->addr[3]) && \ - (((a)->u8[12]) == (m)->addr[4]) && \ - (((a)->u8[13]) == (m)->addr[5]) && \ - (((a)->u8[14]) == (m)->addr[6]) && \ - (((a)->u8[15]) == (m)->addr[7])) -#else - -#define uip_is_addr_mac_addr_based(a, m) \ - ((((a)->u8[8]) == (((m)->addr[0]) | 0x02)) && \ - (((a)->u8[9]) == (m)->addr[1]) && \ - (((a)->u8[10]) == (m)->addr[2]) && \ - (((a)->u8[11]) == 0xff) && \ - (((a)->u8[12]) == 0xfe) && \ - (((a)->u8[13]) == (m)->addr[3]) && \ - (((a)->u8[14]) == (m)->addr[4]) && \ - (((a)->u8[15]) == (m)->addr[5])) - -#endif /*UIP_CONF_LL_802154*/ - -/** - * \brief is address a multicast address, see RFC 4291 - * a is of type uip_ipaddr_t* - * */ -#define uip_is_addr_mcast(a) \ - (((a)->u8[0]) == 0xFF) - -/** - * \brief is address a global multicast address (FFxE::/16), - * a is of type uip_ip6addr_t* - * */ -#define uip_is_addr_mcast_global(a) \ - ((((a)->u8[0]) == 0xFF) && \ - (((a)->u8[1] & 0x0F) == 0x0E)) - -/** - * \brief is address a non-routable multicast address. - * Scopes 1 (interface-local) and 2 (link-local) are non-routable - * See RFC4291 and draft-ietf-6man-multicast-scopes - * a is of type uip_ip6addr_t* - * */ -#define uip_is_addr_mcast_non_routable(a) \ - ((((a)->u8[0]) == 0xFF) && \ - (((a)->u8[1] & 0x0F) <= 0x02)) - -/** - * \brief is address a routable multicast address. - * Scope 3 (Realm-Local) or higher are routable - * Realm-Local scope is defined in draft-ietf-6man-multicast-scopes - * See RFC4291 and draft-ietf-6man-multicast-scopes - * a is of type uip_ip6addr_t* - * */ -#define uip_is_addr_mcast_routable(a) \ - ((((a)->u8[0]) == 0xFF) && \ - (((a)->u8[1] & 0x0F) > 0x02)) - -/** - * \brief is group-id of multicast address a - * the all nodes group-id - */ -#define uip_is_mcast_group_id_all_nodes(a) \ - ((((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u16[5]) == 0) && \ - (((a)->u16[6]) == 0) && \ - (((a)->u8[14]) == 0) && \ - (((a)->u8[15]) == 1)) - -/** - * \brief is group-id of multicast address a - * the all routers group-id - */ -#define uip_is_mcast_group_id_all_routers(a) \ - ((((a)->u16[1]) == 0) && \ - (((a)->u16[2]) == 0) && \ - (((a)->u16[3]) == 0) && \ - (((a)->u16[4]) == 0) && \ - (((a)->u16[5]) == 0) && \ - (((a)->u16[6]) == 0) && \ - (((a)->u8[14]) == 0) && \ - (((a)->u8[15]) == 2)) - - -/** - * \brief are last three bytes of both addresses equal? - * This is used to compare solicited node multicast addresses - */ -#define uip_are_solicited_bytes_equal(a, b) \ - ((((a)->u8[13]) == ((b)->u8[13])) && \ - (((a)->u8[14]) == ((b)->u8[14])) && \ - (((a)->u8[15]) == ((b)->u8[15]))) - -/** - * A non-error message that indicates that a packet should be - * processed locally. - * - * \hideinitializer - */ -#define UIP_FW_LOCAL 0 - -/** - * A non-error message that indicates that something went OK. - * - * \hideinitializer - */ -#define UIP_FW_OK 0 - -/** - * A non-error message that indicates that a packet was forwarded. - * - * \hideinitializer - */ -#define UIP_FW_FORWARDED 1 - -/** - * A non-error message that indicates that a zero-length packet - * transmission was attempted, and that no packet was sent. - * - * \hideinitializer - */ -#define UIP_FW_ZEROLEN 2 - -/** - * An error message that indicates that a packet that was too large - * for the outbound network interface was detected. - * - * \hideinitializer - */ -#define UIP_FW_TOOLARGE 3 - -/** - * An error message that indicates that no suitable interface could be - * found for an outbound packet. - * - * \hideinitializer - */ -#define UIP_FW_NOROUTE 4 - -/** - * An error message that indicates that a packet that should be - * forwarded or output was dropped. - * - * \hideinitializer - */ -#define UIP_FW_DROPPED 5 - -/** - * Calculate the Internet checksum over a buffer. - * - * The Internet checksum is the one's complement of the one's - * complement sum of all 16-bit words in the buffer. - * - * See RFC1071. - * - * \param data A pointer to the buffer over which the checksum is to be - * computed. - * - * \param len The length of the buffer over which the checksum is to - * be computed. - * - * \return The Internet checksum of the buffer. - */ -uint16_t uip_chksum(uint16_t *data, uint16_t len); - -/** - * Calculate the IP header checksum of the packet header in uip_buf. - * - * The IP header checksum is the Internet checksum of the 20 bytes of - * the IP header. - * - * \return The IP header checksum of the IP header in the uip_buf - * buffer. - */ -uint16_t uip_ipchksum(void); - -/** - * Calculate the TCP checksum of the packet in uip_buf and uip_appdata. - * - * The TCP checksum is the Internet checksum of data contents of the - * TCP segment, and a pseudo-header as defined in RFC793. - * - * \return The TCP checksum of the TCP segment in uip_buf and pointed - * to by uip_appdata. - */ -uint16_t uip_tcpchksum(void); - -/** - * Calculate the UDP checksum of the packet in uip_buf and uip_appdata. - * - * The UDP checksum is the Internet checksum of data contents of the - * UDP segment, and a pseudo-header as defined in RFC768. - * - * \return The UDP checksum of the UDP segment in uip_buf and pointed - * to by uip_appdata. - */ -uint16_t uip_udpchksum(void); - -/** - * Calculate the ICMP checksum of the packet in uip_buf. - * - * \return The ICMP checksum of the ICMP packet in uip_buf - */ -uint16_t uip_icmp6chksum(void); - -/** - * Removes all IPv6 extension headers from uip_buf, updates length fields - * (uip_len and uip_ext_len) - */ -void uip_remove_ext_hdr(void); - -#endif /* UIP_H_ */ - - -/** @} */ diff --git a/os/net/ipv6/uip6.c b/os/net/ipv6/uip6.c deleted file mode 100644 index 24274a306..000000000 --- a/os/net/ipv6/uip6.c +++ /dev/null @@ -1,2341 +0,0 @@ -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * The uIP TCP/IPv6 stack code. - * - * \author Adam Dunkels - * \author Julien Abeille (IPv6 related code) - * \author Mathilde Durvy (IPv6 related code) - */ - -/* - * uIP is a small implementation of the IP, UDP and TCP protocols (as - * well as some basic ICMP stuff). The implementation couples the IP, - * UDP, TCP and the application layers very tightly. To keep the size - * of the compiled code down, this code frequently uses the goto - * statement. While it would be possible to break the uip_process() - * function into many smaller functions, this would increase the code - * size because of the overhead of parameter passing and the fact that - * the optimizer would not be as efficient. - * - * The principle is that we have a small buffer, called the uip_buf, - * in which the device driver puts an incoming packet. The TCP/IP - * stack parses the headers in the packet, and calls the - * application. If the remote host has sent data to the application, - * this data is present in the uip_buf and the application read the - * data from there. It is up to the application to put this data into - * a byte stream if needed. The application will not be fed with data - * that is out of sequence. - * - * If the application wishes to send data to the peer, it should put - * its data into the uip_buf. The uip_appdata pointer points to the - * first available byte. The TCP/IP stack will calculate the - * checksums, and fill in the necessary header fields and finally send - * the packet back to the peer. - */ - -#include "sys/cc.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-arch.h" -#include "net/ipv6/uipopt.h" -#include "net/ipv6/uip-icmp6.h" -#include "net/ipv6/uip-nd6.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/multicast/uip-mcast6.h" -#include "net/routing/routing.h" - -#if UIP_ND6_SEND_NS -#include "net/ipv6/uip-ds6-nbr.h" -#endif /* UIP_ND6_SEND_NS */ - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "IPv6" -#define LOG_LEVEL LOG_LEVEL_IPV6 - -#if UIP_STATISTICS == 1 -struct uip_stats uip_stat; -#endif /* UIP_STATISTICS == 1 */ - -/*---------------------------------------------------------------------------*/ -/** - * \name Layer 2 variables - * @{ - */ -/*---------------------------------------------------------------------------*/ -/** Host L2 address */ -#if UIP_CONF_LL_802154 -uip_lladdr_t uip_lladdr; -#else /*UIP_CONF_LL_802154*/ -uip_lladdr_t uip_lladdr = {{0x00,0x06,0x98,0x00,0x02,0x32}}; -#endif /*UIP_CONF_LL_802154*/ -/** @} */ - -/*---------------------------------------------------------------------------*/ -/** - * \name Layer 3 variables - * @{ - */ -/*---------------------------------------------------------------------------*/ -/** \brief bitmap we use to record which IPv6 headers we have already seen */ -uint8_t uip_ext_bitmap = 0; -/** - * \brief Total length of all IPv6 extension headers - */ -uint8_t uip_ext_len = 0; -/** \brief The final protocol after IPv6 extension headers: - * UIP_PROTO_TCP, UIP_PROTO_UDP or UIP_PROTO_ICMP6 */ -uint8_t uip_last_proto = 0; -/** @} */ - -/*---------------------------------------------------------------------------*/ -/* Buffers */ -/*---------------------------------------------------------------------------*/ -/** - * \name Reassembly buffer definition - * @{ - */ -#define FBUF ((struct uip_ip_hdr *)&uip_reassbuf[0]) - -/** @} */ -/** - * \name Buffer variables - * @{ - */ -/** Packet buffer for incoming and outgoing packets */ -#ifndef UIP_CONF_EXTERNAL_BUFFER -uip_buf_t uip_aligned_buf; -#endif /* UIP_CONF_EXTERNAL_BUFFER */ - -/* The uip_appdata pointer points to application data. */ -void *uip_appdata; -/* The uip_appdata pointer points to the application data which is to be sent*/ -void *uip_sappdata; - -#if UIP_URGDATA > 0 -/* The uip_urgdata pointer points to urgent data (out-of-band data), if present */ -void *uip_urgdata; -uint16_t uip_urglen, uip_surglen; -#endif /* UIP_URGDATA > 0 */ - -/* The uip_len is either 8 or 16 bits, depending on the maximum packet size.*/ -uint16_t uip_len, uip_slen; -/** @} */ - -/*---------------------------------------------------------------------------*/ -/** - * \name General variables - * @{ - */ -/*---------------------------------------------------------------------------*/ - -/* The uip_flags variable is used for communication between the TCP/IP stack -and the application program. */ -uint8_t uip_flags; - -/* uip_conn always points to the current connection (set to NULL for UDP). */ -struct uip_conn *uip_conn; - -#if UIP_ACTIVE_OPEN || UIP_UDP -/* Keeps track of the last port used for a new connection. */ -static uint16_t lastport; -#endif /* UIP_ACTIVE_OPEN || UIP_UDP */ -/** @} */ - -/*---------------------------------------------------------------------------*/ -/* TCP */ -/*---------------------------------------------------------------------------*/ -/** - * \name TCP defines - *@{ - */ -/* Structures and definitions. */ -#define TCP_FIN 0x01 -#define TCP_SYN 0x02 -#define TCP_RST 0x04 -#define TCP_PSH 0x08 -#define TCP_ACK 0x10 -#define TCP_URG 0x20 -#define TCP_CTL 0x3f - -#define TCP_OPT_END 0 /* End of TCP options list */ -#define TCP_OPT_NOOP 1 /* "No-operation" TCP option */ -#define TCP_OPT_MSS 2 /* Maximum segment size TCP option */ - -#define TCP_OPT_MSS_LEN 4 /* Length of TCP MSS option. */ -/** @} */ -/** - * \name TCP variables - *@{ - */ -#if UIP_TCP -/* The uip_conns array holds all TCP connections. */ -struct uip_conn uip_conns[UIP_TCP_CONNS]; - -/* The uip_listenports list all currently listning ports. */ -uint16_t uip_listenports[UIP_LISTENPORTS]; - -/* The iss variable is used for the TCP initial sequence number. */ -static uint8_t iss[4]; - -/* Temporary variables. */ -uint8_t uip_acc32[4]; -#endif /* UIP_TCP */ -/** @} */ - -/*---------------------------------------------------------------------------*/ -/** - * \name UDP variables - * @{ - */ -/*---------------------------------------------------------------------------*/ -#if UIP_UDP -struct uip_udp_conn *uip_udp_conn; -struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; -#endif /* UIP_UDP */ -/** @} */ - -/*---------------------------------------------------------------------------*/ -/** - * \name ICMPv6 variables - * @{ - */ -/*---------------------------------------------------------------------------*/ -#if UIP_CONF_ICMP6 -/** single possible icmpv6 "connection" */ -struct uip_icmp6_conn uip_icmp6_conns; -#endif /*UIP_CONF_ICMP6*/ -/** @} */ - -/*---------------------------------------------------------------------------*/ -/* Functions */ -/*---------------------------------------------------------------------------*/ -#if UIP_TCP -void -uip_add32(uint8_t *op32, uint16_t op16) -{ - uip_acc32[3] = op32[3] + (op16 & 0xff); - uip_acc32[2] = op32[2] + (op16 >> 8); - uip_acc32[1] = op32[1]; - uip_acc32[0] = op32[0]; - - if(uip_acc32[2] < (op16 >> 8)) { - ++uip_acc32[1]; - if(uip_acc32[1] == 0) { - ++uip_acc32[0]; - } - } - - - if(uip_acc32[3] < (op16 & 0xff)) { - ++uip_acc32[2]; - if(uip_acc32[2] == 0) { - ++uip_acc32[1]; - if(uip_acc32[1] == 0) { - ++uip_acc32[0]; - } - } - } -} -#endif /* UIP_TCP */ - -#if ! UIP_ARCH_CHKSUM -/*---------------------------------------------------------------------------*/ -static uint16_t -chksum(uint16_t sum, const uint8_t *data, uint16_t len) -{ - uint16_t t; - const uint8_t *dataptr; - const uint8_t *last_byte; - - dataptr = data; - last_byte = data + len - 1; - - while(dataptr < last_byte) { /* At least two more bytes */ - t = (dataptr[0] << 8) + dataptr[1]; - sum += t; - if(sum < t) { - sum++; /* carry */ - } - dataptr += 2; - } - - if(dataptr == last_byte) { - t = (dataptr[0] << 8) + 0; - sum += t; - if(sum < t) { - sum++; /* carry */ - } - } - - /* Return sum in host byte order. */ - return sum; -} -/*---------------------------------------------------------------------------*/ -uint16_t -uip_chksum(uint16_t *data, uint16_t len) -{ - return uip_htons(chksum(0, (uint8_t *)data, len)); -} -/*---------------------------------------------------------------------------*/ -#ifndef UIP_ARCH_IPCHKSUM -uint16_t -uip_ipchksum(void) -{ - uint16_t sum; - - sum = chksum(0, uip_buf, UIP_IPH_LEN); - LOG_DBG("uip_ipchksum: sum 0x%04x\n", sum); - return (sum == 0) ? 0xffff : uip_htons(sum); -} -#endif -/*---------------------------------------------------------------------------*/ -static uint16_t -upper_layer_chksum(uint8_t proto) -{ -/* gcc 4.4.0 - 4.6.1 (maybe 4.3...) with -Os on 8 bit CPUS incorrectly compiles: - * int bar (int); - * int foo (unsigned char a, unsigned char b) { - * int len = (a << 8) + b; //len becomes 0xff00&+b - * return len + bar (len); - * } - * upper_layer_len triggers this bug unless it is declared volatile. - * See https://sourceforge.net/apps/mantisbt/contiki/view.php?id=3 - */ - volatile uint16_t upper_layer_len; - uint16_t sum; - - upper_layer_len = uipbuf_get_len_field(UIP_IP_BUF) - uip_ext_len; - - LOG_DBG("Upper layer checksum len: %d from: %d\n", upper_layer_len, - (int)(UIP_IP_PAYLOAD(uip_ext_len) - uip_buf)); - - /* First sum pseudoheader. */ - /* IP protocol and length fields. This addition cannot carry. */ - sum = upper_layer_len + proto; - /* Sum IP source and destination addresses. */ - sum = chksum(sum, (uint8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); - - /* Sum upper-layer header and data. */ - sum = chksum(sum, UIP_IP_PAYLOAD(uip_ext_len), upper_layer_len); - - return (sum == 0) ? 0xffff : uip_htons(sum); -} -/*---------------------------------------------------------------------------*/ -uint16_t -uip_icmp6chksum(void) -{ - return upper_layer_chksum(UIP_PROTO_ICMP6); - -} -/*---------------------------------------------------------------------------*/ -#if UIP_TCP -uint16_t -uip_tcpchksum(void) -{ - return upper_layer_chksum(UIP_PROTO_TCP); -} -#endif /* UIP_TCP */ -/*---------------------------------------------------------------------------*/ -#if UIP_UDP && UIP_UDP_CHECKSUMS -uint16_t -uip_udpchksum(void) -{ - return upper_layer_chksum(UIP_PROTO_UDP); -} -#endif /* UIP_UDP && UIP_UDP_CHECKSUMS */ -#endif /* UIP_ARCH_CHKSUM */ -/*---------------------------------------------------------------------------*/ -void -uip_init(void) -{ - int c; - - uipbuf_init(); - uip_ds6_init(); - uip_icmp6_init(); - uip_nd6_init(); - -#if UIP_TCP - for(c = 0; c < UIP_LISTENPORTS; ++c) { - uip_listenports[c] = 0; - } - for(c = 0; c < UIP_TCP_CONNS; ++c) { - uip_conns[c].tcpstateflags = UIP_CLOSED; - } -#endif /* UIP_TCP */ - -#if UIP_ACTIVE_OPEN || UIP_UDP - lastport = 1024; -#endif /* UIP_ACTIVE_OPEN || UIP_UDP */ - -#if UIP_UDP - for(c = 0; c < UIP_UDP_CONNS; ++c) { - uip_udp_conns[c].lport = 0; - } -#endif /* UIP_UDP */ - -#if UIP_IPV6_MULTICAST - UIP_MCAST6.init(); -#endif -} -/*---------------------------------------------------------------------------*/ -#if UIP_TCP && UIP_ACTIVE_OPEN -struct uip_conn * -uip_connect(const uip_ipaddr_t *ripaddr, uint16_t rport) -{ - register struct uip_conn *conn, *cconn; - int c; - - /* Find an unused local port. */ - again: - ++lastport; - - if(lastport >= 32000) { - lastport = 4096; - } - - /* Check if this port is already in use, and if so try to find - another one. */ - for(c = 0; c < UIP_TCP_CONNS; ++c) { - conn = &uip_conns[c]; - if(conn->tcpstateflags != UIP_CLOSED && - conn->lport == uip_htons(lastport)) { - goto again; - } - } - - conn = 0; - for(c = 0; c < UIP_TCP_CONNS; ++c) { - cconn = &uip_conns[c]; - if(cconn->tcpstateflags == UIP_CLOSED) { - conn = cconn; - break; - } - if(cconn->tcpstateflags == UIP_TIME_WAIT) { - if(conn == 0 || - cconn->timer > conn->timer) { - conn = cconn; - } - } - } - - if(conn == 0) { - return 0; - } - - conn->tcpstateflags = UIP_SYN_SENT; - - conn->snd_nxt[0] = iss[0]; - conn->snd_nxt[1] = iss[1]; - conn->snd_nxt[2] = iss[2]; - conn->snd_nxt[3] = iss[3]; - - conn->rcv_nxt[0] = 0; - conn->rcv_nxt[1] = 0; - conn->rcv_nxt[2] = 0; - conn->rcv_nxt[3] = 0; - - conn->initialmss = conn->mss = UIP_TCP_MSS; - - conn->len = 1; /* TCP length of the SYN is one. */ - conn->nrtx = 0; - conn->timer = 1; /* Send the SYN next time around. */ - conn->rto = UIP_RTO; - conn->sa = 0; - conn->sv = 16; /* Initial value of the RTT variance. */ - conn->lport = uip_htons(lastport); - conn->rport = rport; - uip_ipaddr_copy(&conn->ripaddr, ripaddr); - - return conn; -} -#endif /* UIP_TCP && UIP_ACTIVE_OPEN */ -/*---------------------------------------------------------------------------*/ -void -uip_remove_ext_hdr(void) -{ - /* Remove ext header before TCP/UDP processing. */ - if(uip_ext_len > 0) { - LOG_DBG("Removing IPv6 extension headers (extlen: %d, uiplen: %d)\n", - uip_ext_len, uip_len); - if(uip_len < UIP_IPH_LEN + uip_ext_len) { - LOG_ERR("uip_len too short compared to ext len\n"); - uipbuf_clear(); - return; - } - - /* Set proto */ - UIP_IP_BUF->proto = uip_last_proto; - /* Move IP payload to the "left"*/ - memmove(UIP_IP_PAYLOAD(0), UIP_IP_PAYLOAD(uip_ext_len), - uip_len - UIP_IPH_LEN - uip_ext_len); - - /* Update the IP length. */ - uipbuf_add_ext_hdr(-uip_ext_len); - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - } -} -/*---------------------------------------------------------------------------*/ -#if UIP_UDP -struct uip_udp_conn * -uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport) -{ - int c; - register struct uip_udp_conn *conn; - - /* Find an unused local port. */ - again: - ++lastport; - - if(lastport >= 32000) { - lastport = 4096; - } - - for(c = 0; c < UIP_UDP_CONNS; ++c) { - if(uip_udp_conns[c].lport == uip_htons(lastport)) { - goto again; - } - } - - conn = 0; - for(c = 0; c < UIP_UDP_CONNS; ++c) { - if(uip_udp_conns[c].lport == 0) { - conn = &uip_udp_conns[c]; - break; - } - } - - if(conn == 0) { - return 0; - } - - conn->lport = UIP_HTONS(lastport); - conn->rport = rport; - if(ripaddr == NULL) { - memset(&conn->ripaddr, 0, sizeof(uip_ipaddr_t)); - } else { - uip_ipaddr_copy(&conn->ripaddr, ripaddr); - } - conn->ttl = uip_ds6_if.cur_hop_limit; - - return conn; -} -#endif /* UIP_UDP */ -/*---------------------------------------------------------------------------*/ -#if UIP_TCP -void -uip_unlisten(uint16_t port) -{ - int c; - for(c = 0; c < UIP_LISTENPORTS; ++c) { - if(uip_listenports[c] == port) { - uip_listenports[c] = 0; - return; - } - } -} -/*---------------------------------------------------------------------------*/ -void -uip_listen(uint16_t port) -{ - int c; - for(c = 0; c < UIP_LISTENPORTS; ++c) { - if(uip_listenports[c] == 0) { - uip_listenports[c] = port; - return; - } - } -} -#endif -/*---------------------------------------------------------------------------*/ - -#if UIP_CONF_IPV6_REASSEMBLY -#define UIP_REASS_BUFSIZE (UIP_BUFSIZE) - -static uint8_t uip_reassbuf[UIP_REASS_BUFSIZE]; - -static uint8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; -/*the first byte of an IP fragment is aligned on an 8-byte boundary */ - -static const uint8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, - 0x0f, 0x07, 0x03, 0x01}; -static uint16_t uip_reasslen; -static uint8_t uip_reassflags; - -#define UIP_REASS_FLAG_LASTFRAG 0x01 -#define UIP_REASS_FLAG_FIRSTFRAG 0x02 -#define UIP_REASS_FLAG_ERROR_MSG 0x04 - - -/* - * See RFC 2460 for a description of fragmentation in IPv6 - * A typical Ipv6 fragment - * +------------------+--------+--------------+ - * | Unfragmentable |Fragment| first | - * | Part | Header | fragment | - * +------------------+--------+--------------+ - */ - - -struct etimer uip_reass_timer; /**< Timer for reassembly */ -uint8_t uip_reass_on; /* equal to 1 if we are currently reassembling a packet */ - -static uint32_t uip_id; /* For every packet that is to be fragmented, the source - node generates an Identification value that is present - in all the fragments */ -#define IP_MF 0x0001 - -static uint16_t -uip_reass(uint8_t *prev_proto_ptr) -{ - uint16_t offset=0; - uint16_t len; - uint16_t i; - struct uip_frag_hdr *frag_buf = (struct uip_frag_hdr *)UIP_IP_PAYLOAD(uip_ext_len); - - /* If ip_reasstmr is zero, no packet is present in the buffer */ - /* We first write the unfragmentable part of IP header into the reassembly - buffer. The reset the other reassembly variables. */ - if(uip_reass_on == 0) { - LOG_INFO("Starting reassembly\n"); - memcpy(FBUF, UIP_IP_BUF, uip_ext_len + UIP_IPH_LEN); - /* temporary in case we do not receive the fragment with offset 0 first */ - etimer_set(&uip_reass_timer, UIP_REASS_MAXAGE*CLOCK_SECOND); - uip_reass_on = 1; - uip_reassflags = 0; - uip_id = frag_buf->id; - /* Clear the bitmap. */ - memset(uip_reassbitmap, 0, sizeof(uip_reassbitmap)); - } - /* - * Check if the incoming fragment matches the one currently present - * in the reasembly buffer. If so, we proceed with copying the fragment - * into the buffer. - */ - if(uip_ipaddr_cmp(&FBUF->srcipaddr, &UIP_IP_BUF->srcipaddr) && - uip_ipaddr_cmp(&FBUF->destipaddr, &UIP_IP_BUF->destipaddr) && - frag_buf->id == uip_id) { - len = uip_len - uip_ext_len - UIP_IPH_LEN - UIP_FRAGH_LEN; - offset = (uip_ntohs(frag_buf->offsetresmore) & 0xfff8); - /* in byte, originaly in multiple of 8 bytes*/ - LOG_INFO("len %d\n", len); - LOG_INFO("offset %d\n", offset); - if(offset == 0){ - uip_reassflags |= UIP_REASS_FLAG_FIRSTFRAG; - /* - * The Next Header field of the last header of the Unfragmentable - * Part is obtained from the Next Header field of the first - * fragment's Fragment header. - */ - *prev_proto_ptr = frag_buf->next; - memcpy(FBUF, UIP_IP_BUF, uip_ext_len + UIP_IPH_LEN); - LOG_INFO("src "); - LOG_INFO_6ADDR(&FBUF->srcipaddr); - LOG_INFO_("dest "); - LOG_INFO_6ADDR(&FBUF->destipaddr); - LOG_INFO_("next %d\n", UIP_IP_BUF->proto); - - } - - /* If the offset or the offset + fragment length overflows the - reassembly buffer, we discard the entire packet. */ - if(offset > UIP_REASS_BUFSIZE || - offset + len > UIP_REASS_BUFSIZE) { - uip_reass_on = 0; - etimer_stop(&uip_reass_timer); - return 0; - } - - /* If this fragment has the More Fragments flag set to zero, it is the - last fragment*/ - if((uip_ntohs(frag_buf->offsetresmore) & IP_MF) == 0) { - uip_reassflags |= UIP_REASS_FLAG_LASTFRAG; - /*calculate the size of the entire packet*/ - uip_reasslen = offset + len; - LOG_INFO("last fragment reasslen %d\n", uip_reasslen); - } else { - /* If len is not a multiple of 8 octets and the M flag of that fragment - is 1, then that fragment must be discarded and an ICMP Parameter - Problem, Code 0, message should be sent to the source of the fragment, - pointing to the Payload Length field of the fragment packet. */ - if(len % 8 != 0){ - uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, 4); - uip_reassflags |= UIP_REASS_FLAG_ERROR_MSG; - /* not clear if we should interrupt reassembly, but it seems so from - the conformance tests */ - uip_reass_on = 0; - etimer_stop(&uip_reass_timer); - return uip_len; - } - } - - /* Copy the fragment into the reassembly buffer, at the right - offset. */ - memcpy((uint8_t *)FBUF + UIP_IPH_LEN + uip_ext_len + offset, - (uint8_t *)frag_buf + UIP_FRAGH_LEN, len); - - /* Update the bitmap. */ - if(offset >> 6 == (offset + len) >> 6) { - uip_reassbitmap[offset >> 6] |= - bitmap_bits[(offset >> 3) & 7] & - ~bitmap_bits[((offset + len) >> 3) & 7]; - } else { - /* If the two endpoints are in different bytes, we update the - bytes in the endpoints and fill the stuff inbetween with - 0xff. */ - uip_reassbitmap[offset >> 6] |= bitmap_bits[(offset >> 3) & 7]; - - for(i = (1 + (offset >> 6)); i < ((offset + len) >> 6); ++i) { - uip_reassbitmap[i] = 0xff; - } - uip_reassbitmap[(offset + len) >> 6] |= - ~bitmap_bits[((offset + len) >> 3) & 7]; - } - - /* Finally, we check if we have a full packet in the buffer. We do - this by checking if we have the last fragment and if all bits - in the bitmap are set. */ - - if(uip_reassflags & UIP_REASS_FLAG_LASTFRAG) { - /* Check all bytes up to and including all but the last byte in - the bitmap. */ - for(i = 0; i < (uip_reasslen >> 6); ++i) { - if(uip_reassbitmap[i] != 0xff) { - return 0; - } - } - /* Check the last byte in the bitmap. It should contain just the - right amount of bits. */ - if(uip_reassbitmap[uip_reasslen >> 6] != - (uint8_t)~bitmap_bits[(uip_reasslen >> 3) & 7]) { - return 0; - } - - /* If we have come this far, we have a full packet in the - buffer, so we copy it to uip_buf. We also reset the timer. */ - uip_reass_on = 0; - etimer_stop(&uip_reass_timer); - - uip_reasslen += UIP_IPH_LEN + uip_ext_len; - memcpy(UIP_IP_BUF, FBUF, uip_reasslen); - uipbuf_set_len_field(UIP_IP_BUF, uip_reasslen - UIP_IPH_LEN); - LOG_INFO("reassembled packet %d (%d)\n", uip_reasslen, uipbuf_get_len_field(UIP_IP_BUF)); - - return uip_reasslen; - - } - } else { - LOG_WARN("Already reassembling another paquet\n"); - } - return 0; -} - -void -uip_reass_over(void) -{ - /* to late, we abandon the reassembly of the packet */ - - uip_reass_on = 0; - etimer_stop(&uip_reass_timer); - - if(uip_reassflags & UIP_REASS_FLAG_FIRSTFRAG){ - LOG_ERR("fragmentation timeout\n"); - /* If the first fragment has been received, an ICMP Time Exceeded - -- Fragment Reassembly Time Exceeded message should be sent to the - source of that fragment. */ - /** \note - * We don't have a complete packet to put in the error message. - * We could include the first fragment but since its not mandated by - * any RFC, we decided not to include it as it reduces the size of - * the packet. - */ - uipbuf_clear(); - memcpy(UIP_IP_BUF, FBUF, UIP_IPH_LEN); /* copy the header for src - and dest address*/ - uip_icmp6_error_output(ICMP6_TIME_EXCEEDED, ICMP6_TIME_EXCEED_REASSEMBLY, 0); - - UIP_STAT(++uip_stat.ip.sent); - uip_flags = 0; - } -} - -#endif /* UIP_CONF_IPV6_REASSEMBLY */ - -/*---------------------------------------------------------------------------*/ -#if UIP_TCP -static void -uip_add_rcv_nxt(uint16_t n) -{ - uip_add32(uip_conn->rcv_nxt, n); - uip_conn->rcv_nxt[0] = uip_acc32[0]; - uip_conn->rcv_nxt[1] = uip_acc32[1]; - uip_conn->rcv_nxt[2] = uip_acc32[2]; - uip_conn->rcv_nxt[3] = uip_acc32[3]; -} -#endif -/*---------------------------------------------------------------------------*/ - -/** - * \brief Process the options in Destination and Hop By Hop extension headers - */ -static uint8_t -ext_hdr_options_process(uint8_t *ext_buf) -{ - /* - * Length field in the extension header: length of the header in units of - * 8 bytes, excluding the first 8 bytes - * length field in an option : the length of data in the option - */ - uint16_t opt_offset = 2; /* 2 first bytes in ext header */ - struct uip_hbho_hdr *ext_hdr = (struct uip_hbho_hdr *)ext_buf; - uint16_t ext_hdr_len = (ext_hdr->len << 3) + 8; - - while(opt_offset + 2 <= ext_hdr_len) { /* + 2 for opt header */ - struct uip_ext_hdr_opt *opt_hdr = (struct uip_ext_hdr_opt *)(ext_buf + opt_offset); - uint16_t opt_len = opt_hdr->len + 2; - - if(opt_offset + opt_len > ext_hdr_len) { - LOG_ERR("RPL Option too long: Dropping Packet\n"); - uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, - (ext_buf + opt_offset) - uip_buf); - return 2; - } - - switch(opt_hdr->type) { - /* - * for now we do not support any options except padding ones - * PAD1 does not make sense as the header must be 8bytes aligned, - * hence we can only have - */ - case UIP_EXT_HDR_OPT_PAD1: - LOG_DBG("Processing PAD1 option\n"); - opt_offset += 1; - break; - case UIP_EXT_HDR_OPT_PADN: - LOG_DBG("Processing PADN option\n"); - opt_offset += opt_len; - break; - case UIP_EXT_HDR_OPT_RPL: - /* Fixes situation when a node that is not using RPL - * joins a network which does. The received packages will include the - * RPL header and processed by the "default" case of the switch - * (0x63 & 0xC0 = 0x40). Hence, the packet is discarded as the header - * is considered invalid. - * Using this fix, the header is ignored, and the next header (if - * present) is processed. - */ - LOG_DBG("Processing RPL option\n"); - if(!NETSTACK_ROUTING.ext_header_hbh_update(ext_buf, opt_offset)) { - LOG_ERR("RPL Option Error: Dropping Packet\n"); - return 1; - } - opt_offset += opt_len; - break; - default: - /* - * check the two highest order bits of the option - * - 00 skip over this option and continue processing the header. - * - 01 discard the packet. - * - 10 discard the packet and, regardless of whether or not the - * packet's Destination Address was a multicast address, send an - * ICMP Parameter Problem, Code 2, message to the packet's - * Source Address, pointing to the unrecognized Option Type. - * - 11 discard the packet and, only if the packet's Destination - * Address was not a multicast address, send an ICMP Parameter - * Problem, Code 2, message to the packet's Source Address, - * pointing to the unrecognized Option Type. - */ - LOG_DBG("Unrecognized option, MSB 0x%x\n", opt_hdr->type); - switch(opt_hdr->type & 0xC0) { - case 0: - break; - case 0x40: - return 1; - case 0xC0: - if(uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) { - return 1; - } - case 0x80: - uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, - (ext_buf + opt_offset) - uip_buf); - return 2; - } - /* in the cases were we did not discard, update ext_opt* */ - opt_offset += opt_len; - break; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static bool -uip_check_mtu(void) -{ - if(uip_len > UIP_LINK_MTU) { - uip_icmp6_error_output(ICMP6_PACKET_TOO_BIG, 0, UIP_LINK_MTU); - UIP_STAT(++uip_stat.ip.drop); - return false; - } else { - return true; - } -} -/*---------------------------------------------------------------------------*/ -static bool -uip_update_ttl(void) -{ - if(UIP_IP_BUF->ttl <= 1) { - uip_icmp6_error_output(ICMP6_TIME_EXCEEDED, ICMP6_TIME_EXCEED_TRANSIT, 0); - UIP_STAT(++uip_stat.ip.drop); - return false; - } else { - UIP_IP_BUF->ttl = UIP_IP_BUF->ttl - 1; - return true; - } -} -/*---------------------------------------------------------------------------*/ -void -uip_process(uint8_t flag) -{ - uint8_t *last_header; - uint8_t protocol; - uint8_t *next_header; - struct uip_ext_hdr *ext_ptr; -#if UIP_TCP - int c; - uint16_t tmp16; - uint8_t opt; - register struct uip_conn *uip_connr = uip_conn; -#endif /* UIP_TCP */ -#if UIP_UDP - if(flag == UIP_UDP_SEND_CONN) { - goto udp_send; - } -#endif /* UIP_UDP */ - uip_sappdata = uip_appdata = &uip_buf[UIP_IPTCPH_LEN]; - - /* Check if we were invoked because of a poll request for a - particular connection. */ - if(flag == UIP_POLL_REQUEST) { -#if UIP_TCP - if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED && - !uip_outstanding(uip_connr)) { - uip_flags = UIP_POLL; - UIP_APPCALL(); - goto appsend; -#if UIP_ACTIVE_OPEN - } else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_SENT) { - /* In the SYN_SENT state, we retransmit out SYN. */ - UIP_TCP_BUF->flags = 0; - goto tcp_send_syn; -#endif /* UIP_ACTIVE_OPEN */ - } - goto drop; -#endif /* UIP_TCP */ - /* Check if we were invoked because of the perodic timer fireing. */ - } else if(flag == UIP_TIMER) { - /* Reset the length variables. */ -#if UIP_TCP - uipbuf_clear(); - uip_slen = 0; - - /* Increase the initial sequence number. */ - if(++iss[3] == 0) { - if(++iss[2] == 0) { - if(++iss[1] == 0) { - ++iss[0]; - } - } - } - - /* - * Check if the connection is in a state in which we simply wait - * for the connection to time out. If so, we increase the - * connection's timer and remove the connection if it times - * out. - */ - if(uip_connr->tcpstateflags == UIP_TIME_WAIT || - uip_connr->tcpstateflags == UIP_FIN_WAIT_2) { - ++(uip_connr->timer); - if(uip_connr->timer == UIP_TIME_WAIT_TIMEOUT) { - uip_connr->tcpstateflags = UIP_CLOSED; - } - } else if(uip_connr->tcpstateflags != UIP_CLOSED) { - /* - * If the connection has outstanding data, we increase the - * connection's timer and see if it has reached the RTO value - * in which case we retransmit. - */ - if(uip_outstanding(uip_connr)) { - if(uip_connr->timer-- == 0) { - if(uip_connr->nrtx == UIP_MAXRTX || - ((uip_connr->tcpstateflags == UIP_SYN_SENT || - uip_connr->tcpstateflags == UIP_SYN_RCVD) && - uip_connr->nrtx == UIP_MAXSYNRTX)) { - uip_connr->tcpstateflags = UIP_CLOSED; - - /* - * We call UIP_APPCALL() with uip_flags set to - * UIP_TIMEDOUT to inform the application that the - * connection has timed out. - */ - uip_flags = UIP_TIMEDOUT; - UIP_APPCALL(); - - /* We also send a reset packet to the remote host. */ - UIP_TCP_BUF->flags = TCP_RST | TCP_ACK; - goto tcp_send_nodata; - } - - /* Exponential backoff. */ - uip_connr->timer = UIP_RTO << (uip_connr->nrtx > 4? - 4: - uip_connr->nrtx); - ++(uip_connr->nrtx); - - /* - * Ok, so we need to retransmit. We do this differently - * depending on which state we are in. In ESTABLISHED, we - * call upon the application so that it may prepare the - * data for the retransmit. In SYN_RCVD, we resend the - * SYNACK that we sent earlier and in LAST_ACK we have to - * retransmit our FINACK. - */ - UIP_STAT(++uip_stat.tcp.rexmit); - switch(uip_connr->tcpstateflags & UIP_TS_MASK) { - case UIP_SYN_RCVD: - /* In the SYN_RCVD state, we should retransmit our SYNACK. */ - goto tcp_send_synack; - -#if UIP_ACTIVE_OPEN - case UIP_SYN_SENT: - /* In the SYN_SENT state, we retransmit out SYN. */ - UIP_TCP_BUF->flags = 0; - goto tcp_send_syn; -#endif /* UIP_ACTIVE_OPEN */ - - case UIP_ESTABLISHED: - /* - * In the ESTABLISHED state, we call upon the application - * to do the actual retransmit after which we jump into - * the code for sending out the packet (the apprexmit - * label). - */ - uip_flags = UIP_REXMIT; - UIP_APPCALL(); - goto apprexmit; - - case UIP_FIN_WAIT_1: - case UIP_CLOSING: - case UIP_LAST_ACK: - /* In all these states we should retransmit a FINACK. */ - goto tcp_send_finack; - } - } - } else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) { - /* - * If there was no need for a retransmission, we poll the - * application for new data. - */ - uip_flags = UIP_POLL; - UIP_APPCALL(); - goto appsend; - } - } - goto drop; -#endif /* UIP_TCP */ - } -#if UIP_UDP - if(flag == UIP_UDP_TIMER) { - if(uip_udp_conn->lport != 0) { - uip_conn = NULL; - uip_sappdata = uip_appdata = &uip_buf[UIP_IPUDPH_LEN]; - uip_len = uip_slen = 0; - uip_flags = UIP_POLL; - UIP_UDP_APPCALL(); - goto udp_send; - } else { - goto drop; - } - } -#endif /* UIP_UDP */ - - - /* This is where the input processing starts. */ - UIP_STAT(++uip_stat.ip.recv); - - /* Start of IP input header processing code. */ - - /* Check validity of the IP header. */ - if((UIP_IP_BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */ - UIP_STAT(++uip_stat.ip.drop); - UIP_STAT(++uip_stat.ip.vhlerr); - LOG_ERR("invalid version\n"); - goto drop; - } - /* - * Check the size of the packet. If the size reported to us in - * uip_len is smaller the size reported in the IP header, we assume - * that the packet has been corrupted in transit. If the size of - * uip_len is larger than the size reported in the IP packet header, - * the packet has been padded and we set uip_len to the correct - * value.. - */ - - if(uipbuf_get_len_field(UIP_IP_BUF) <= uip_len) { - uip_len = uipbuf_get_len_field(UIP_IP_BUF) + UIP_IPH_LEN; - /* - * The length reported in the IPv6 header is the - * length of the payload that follows the - * header. However, uIP uses the uip_len variable - * for holding the size of the entire packet, - * including the IP header. For IPv4 this is not a - * problem as the length field in the IPv4 header - * contains the length of the entire packet. But - * for IPv6 we need to add the size of the IPv6 - * header (40 bytes). - */ - } else { - LOG_ERR("packet shorter than reported in IP header\n"); - goto drop; - } - - /* Check sanity of extension headers, and compute the total extension header - * length (uip_ext_len) as well as the final protocol (uip_last_proto) */ - uip_last_proto = 0; - last_header = uipbuf_get_last_header(uip_buf, uip_len, &uip_last_proto); - if(last_header == NULL) { - LOG_ERR("invalid extension header chain\n"); - goto drop; - } - /* Set uip_ext_len */ - uip_ext_len = last_header - UIP_IP_PAYLOAD(0); - - LOG_INFO("packet received from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - - if(uip_is_addr_mcast(&UIP_IP_BUF->srcipaddr)){ - UIP_STAT(++uip_stat.ip.drop); - LOG_ERR("Dropping packet, src is mcast\n"); - goto drop; - } - - /* Refresh neighbor state after receiving a unicast message */ -#if UIP_ND6_SEND_NS - if(!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) { - uip_ds6_nbr_refresh_reachable_state(&UIP_IP_BUF->srcipaddr); - } -#endif /* UIP_ND6_SEND_NS */ - -#if UIP_CONF_ROUTER - /* - * If present, the Hop-by-Hop Option must be processed before forwarding - * the packet. - */ - - next_header = uipbuf_get_next_header(uip_buf, uip_len, &protocol, true); - if(next_header != NULL && protocol == UIP_PROTO_HBHO) { - switch(ext_hdr_options_process(next_header)) { - case 0: - break; /* done */ - case 1: - goto drop; /* silently discard */ - case 2: - goto send; /* send icmp error message (created in - ext_hdr_options_process) and discard */ - } - } - - /* - * Process Packets with a routable multicast destination: - * - We invoke the multicast engine and let it do its thing - * (cache, forward etc). - * - We never execute the datagram forwarding logic in this file here. When - * the engine returns, forwarding has been handled if and as required. - * - Depending on the return value, we either discard or deliver up the stack - * - * All multicast engines must hook in here. After this function returns, we - * expect UIP_BUF to be unmodified - */ -#if UIP_IPV6_MULTICAST - if(uip_is_addr_mcast_routable(&UIP_IP_BUF->destipaddr)) { - if(UIP_MCAST6.in() == UIP_MCAST6_ACCEPT) { - /* Deliver up the stack */ - goto process; - } else { - /* Don't deliver up the stack */ - goto drop; - } - } -#endif /* UIP_IPV6_MULTICAST */ - - /* TBD Some Parameter problem messages */ - if(!uip_ds6_is_my_addr(&UIP_IP_BUF->destipaddr) && - !uip_ds6_is_my_maddr(&UIP_IP_BUF->destipaddr)) { - if(!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr) && - !uip_is_addr_linklocal(&UIP_IP_BUF->destipaddr) && - !uip_is_addr_linklocal(&UIP_IP_BUF->srcipaddr) && - !uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr) && - !uip_is_addr_loopback(&UIP_IP_BUF->destipaddr)) { - - if(!uip_check_mtu() || !uip_update_ttl()) { - /* Send ICMPv6 error, prepared by the function that just returned false */ - goto send; - } - - LOG_INFO("Forwarding packet to next hop "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - UIP_STAT(++uip_stat.ip.forwarded); - goto send; - } else { - if((uip_is_addr_linklocal(&UIP_IP_BUF->srcipaddr)) && - (!uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) && - (!uip_is_addr_loopback(&UIP_IP_BUF->destipaddr)) && - (!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) && - (!uip_ds6_is_addr_onlink((&UIP_IP_BUF->destipaddr)))) { - LOG_ERR("LL source address with off link destination, dropping\n"); - uip_icmp6_error_output(ICMP6_DST_UNREACH, - ICMP6_DST_UNREACH_NOTNEIGHBOR, 0); - goto send; - } - LOG_ERR("Dropping packet, not for me and link local or multicast\n"); - UIP_STAT(++uip_stat.ip.drop); - goto drop; - } - } -#else /* UIP_CONF_ROUTER */ - if(!uip_ds6_is_my_addr(&UIP_IP_BUF->destipaddr) && - !uip_ds6_is_my_maddr(&UIP_IP_BUF->destipaddr) && - !uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) { - LOG_ERR("Dropping packet, not for me\n"); - UIP_STAT(++uip_stat.ip.drop); - goto drop; - } -#endif /* UIP_CONF_ROUTER */ - -#if UIP_IPV6_MULTICAST && UIP_CONF_ROUTER - process: -#endif /* UIP_IPV6_MULTICAST && UIP_CONF_ROUTER */ - - /* IPv6 extension header processing: loop until reaching upper-layer protocol */ - uip_ext_bitmap = 0; - for(next_header = uipbuf_get_next_header(uip_buf, uip_len, &protocol, true); - next_header != NULL && uip_is_proto_ext_hdr(protocol); - next_header = uipbuf_get_next_header(next_header, uip_len - (next_header - uip_buf), &protocol, false)) { - - ext_ptr = (struct uip_ext_hdr *)next_header; - switch(protocol) { - case UIP_PROTO_HBHO: - LOG_DBG("Processing hbh header\n"); - /* Hop by hop option header */ -#if UIP_CONF_IPV6_CHECKS - /* Hop by hop option header. If we saw one HBH already, drop */ - if(uip_ext_bitmap & UIP_EXT_HDR_BITMAP_HBHO) { - goto bad_hdr; - } else { - uip_ext_bitmap |= UIP_EXT_HDR_BITMAP_HBHO; - } -#endif /*UIP_CONF_IPV6_CHECKS*/ - switch(ext_hdr_options_process(next_header)) { - case 0: - break; /* done */ - case 1: - goto drop; /* silently discard */ - case 2: - goto send; /* send icmp error message (created in - ext_hdr_options_process) and discard */ - } - break; - case UIP_PROTO_DESTO: -#if UIP_CONF_IPV6_CHECKS - /* Destination option header. if we saw two already, drop */ - LOG_DBG("Processing desto header\n"); - if(uip_ext_bitmap & UIP_EXT_HDR_BITMAP_DESTO1) { - if(uip_ext_bitmap & UIP_EXT_HDR_BITMAP_DESTO2) { - goto bad_hdr; - } else{ - uip_ext_bitmap |= UIP_EXT_HDR_BITMAP_DESTO2; - } - } else { - uip_ext_bitmap |= UIP_EXT_HDR_BITMAP_DESTO1; - } -#endif /*UIP_CONF_IPV6_CHECKS*/ - switch(ext_hdr_options_process(next_header)) { - case 0: - break; /* done */ - case 1: - goto drop; /* silently discard */ - case 2: - goto send; /* send icmp error message (created in - ext_hdr_options_process) and discard */ - } - break; - case UIP_PROTO_ROUTING: -#if UIP_CONF_IPV6_CHECKS - /* Routing header. If we saw one already, drop */ - if(uip_ext_bitmap & UIP_EXT_HDR_BITMAP_ROUTING) { - goto bad_hdr; - } else { - uip_ext_bitmap |= UIP_EXT_HDR_BITMAP_ROUTING; - } -#endif /*UIP_CONF_IPV6_CHECKS*/ - /* - * Routing Header length field is in units of 8 bytes, excluding - * As per RFC2460 section 4.4, if routing type is unrecognized: - * if segments left = 0, ignore the header - * if segments left > 0, discard packet and send icmp error pointing - * to the routing type - */ - - LOG_DBG("Processing Routing header\n"); - if(((struct uip_routing_hdr *)ext_ptr)->seg_left > 0) { - /* Process source routing header */ - if(NETSTACK_ROUTING.ext_header_srh_update()) { - - /* The MTU and TTL were not checked and updated yet, because with - * a routing header, the IPv6 destination address was set to us - * even though we act only as forwarder. Check MTU and TTL now */ - if(!uip_check_mtu() || !uip_update_ttl()) { - /* Send ICMPv6 error, prepared by the function that just returned false */ - goto send; - } - - LOG_INFO("Forwarding packet to next hop "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - UIP_STAT(++uip_stat.ip.forwarded); - - goto send; /* Proceed to forwarding */ - } else { - LOG_ERR("Unrecognized routing type\n"); - goto bad_hdr; - } - } - break; - case UIP_PROTO_FRAG: - /* Fragmentation header:call the reassembly function, then leave */ -#if UIP_CONF_IPV6_REASSEMBLY - LOG_INFO("Processing fragmentation header\n"); - uip_len = uip_reass(&ext_ptr->next); - if(uip_len == 0) { - goto drop; - } - if(uip_reassflags & UIP_REASS_FLAG_ERROR_MSG) { - /* we are not done with reassembly, this is an error message */ - goto send; - } - /* packet is reassembled. Restart the parsing of the reassembled pkt */ - LOG_INFO("Processing reassembled packet\n"); - uip_ext_bitmap = 0; - next_header = uipbuf_get_next_header(uip_buf, uip_len, &protocol, true); - break; -#else /* UIP_CONF_IPV6_REASSEMBLY */ - UIP_STAT(++uip_stat.ip.drop); - UIP_STAT(++uip_stat.ip.fragerr); - LOG_ERR("fragment dropped."); - goto drop; -#endif /* UIP_CONF_IPV6_REASSEMBLY */ - case UIP_PROTO_NONE: - goto drop; - default: - goto bad_hdr; - } - } - - /* Process upper-layer input */ - if(next_header != NULL) { - switch(protocol) { -#if UIP_TCP - case UIP_PROTO_TCP: - /* TCP, for both IPv4 and IPv6 */ - goto tcp_input; -#endif -#if UIP_UDP - case UIP_PROTO_UDP: - /* UDP, for both IPv4 and IPv6 */ - goto udp_input; -#endif - case UIP_PROTO_ICMP6: - /* ICMPv6 */ - goto icmp6_input; - } - } - - bad_hdr: - /* - * RFC 2460 send error message parameterr problem, code unrecognized - * next header, pointing to the next header field - */ - uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_NEXTHEADER, (uint32_t)(next_header - uip_buf)); - UIP_STAT(++uip_stat.ip.drop); - UIP_STAT(++uip_stat.ip.protoerr); - LOG_ERR("unrecognized header\n"); - goto send; - /* End of headers processing */ - - icmp6_input: - /* This is IPv6 ICMPv6 processing code. */ - LOG_INFO("icmpv6 input length %d type: %d \n", uip_len, UIP_ICMP_BUF->type); - -#if UIP_CONF_IPV6_CHECKS - /* Compute and check the ICMP header checksum */ - if(uip_icmp6chksum() != 0xffff) { - UIP_STAT(++uip_stat.icmp.drop); - UIP_STAT(++uip_stat.icmp.chkerr); - LOG_ERR("icmpv6 bad checksum\n"); - goto drop; - } -#endif /*UIP_CONF_IPV6_CHECKS*/ - - UIP_STAT(++uip_stat.icmp.recv); - /* - * Here we process incoming ICMPv6 packets - * For echo request, we send echo reply - * For ND pkts, we call the appropriate function in uip-nd6.c - * We do not treat Error messages for now - * If no pkt is to be sent as an answer to the incoming one, we - * "goto drop". Else we just break; then at the after the "switch" - * we "goto send" - */ -#if UIP_CONF_ICMP6 - UIP_ICMP6_APPCALL(UIP_ICMP_BUF->type); -#endif /*UIP_CONF_ICMP6*/ - - /* - * Search generic input handlers. - * The handler is in charge of setting uip_len to 0 - */ - if(uip_icmp6_input(UIP_ICMP_BUF->type, - UIP_ICMP_BUF->icode) == UIP_ICMP6_INPUT_ERROR) { - LOG_ERR("Unknown ICMPv6 message type/code %d\n", UIP_ICMP_BUF->type); - UIP_STAT(++uip_stat.icmp.drop); - UIP_STAT(++uip_stat.icmp.typeerr); - uipbuf_clear(); - } - - if(uip_len > 0) { - goto send; - } else { - goto drop; - } - /* End of IPv6 ICMP processing. */ - - -#if UIP_UDP - /* UDP input processing. */ - udp_input: - - uip_remove_ext_hdr(); - - LOG_INFO("Receiving UDP packet\n"); - - /* UDP processing is really just a hack. We don't do anything to the - UDP/IP headers, but let the UDP application do all the hard - work. If the application sets uip_slen, it has a packet to - send. */ -#if UIP_UDP_CHECKSUMS - /* XXX hack: UDP/IPv6 receivers should drop packets with UDP - checksum 0. Here, we explicitly receive UDP packets with checksum - 0. This is to be able to debug code that for one reason or - another miscomputes UDP checksums. The reception of zero UDP - checksums should be turned into a configration option. */ - if(UIP_UDP_BUF->udpchksum != 0 && uip_udpchksum() != 0xffff) { - UIP_STAT(++uip_stat.udp.drop); - UIP_STAT(++uip_stat.udp.chkerr); - LOG_ERR("udp: bad checksum 0x%04x 0x%04x\n", UIP_UDP_BUF->udpchksum, - uip_udpchksum()); - goto drop; - } -#endif /* UIP_UDP_CHECKSUMS */ - - /* Make sure that the UDP destination port number is not zero. */ - if(UIP_UDP_BUF->destport == 0) { - LOG_ERR("udp: zero port.\n"); - goto drop; - } - - /* Demultiplex this UDP packet between the UDP "connections". */ - for(uip_udp_conn = &uip_udp_conns[0]; - uip_udp_conn < &uip_udp_conns[UIP_UDP_CONNS]; - ++uip_udp_conn) { - /* If the local UDP port is non-zero, the connection is considered - to be used. If so, the local port number is checked against the - destination port number in the received packet. If the two port - numbers match, the remote port number is checked if the - connection is bound to a remote port. Finally, if the - connection is bound to a remote IP address, the source IP - address of the packet is checked. */ - if(uip_udp_conn->lport != 0 && - UIP_UDP_BUF->destport == uip_udp_conn->lport && - (uip_udp_conn->rport == 0 || - UIP_UDP_BUF->srcport == uip_udp_conn->rport) && - (uip_is_addr_unspecified(&uip_udp_conn->ripaddr) || - uip_ipaddr_cmp(&UIP_IP_BUF->srcipaddr, &uip_udp_conn->ripaddr))) { - goto udp_found; - } - } - LOG_ERR("udp: no matching connection found\n"); - UIP_STAT(++uip_stat.udp.drop); - - uip_icmp6_error_output(ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0); - goto send; - - udp_found: - LOG_DBG("In udp_found\n"); - UIP_STAT(++uip_stat.udp.recv); - - uip_len = uip_len - UIP_IPUDPH_LEN; - uip_appdata = &uip_buf[UIP_IPUDPH_LEN]; - uip_conn = NULL; - uip_flags = UIP_NEWDATA; - uip_sappdata = uip_appdata = &uip_buf[UIP_IPUDPH_LEN]; - uip_slen = 0; - UIP_UDP_APPCALL(); - - udp_send: - LOG_DBG("In udp_send\n"); - - if(uip_slen == 0) { - goto drop; - } - uip_len = uip_slen + UIP_IPUDPH_LEN; - - /* For IPv6, the IP length field does not include the IPv6 IP header - length. */ - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - - UIP_IP_BUF->vtc = 0x60; - UIP_IP_BUF->tcflow = 0x00; - UIP_IP_BUF->ttl = uip_udp_conn->ttl; - UIP_IP_BUF->proto = UIP_PROTO_UDP; - - UIP_UDP_BUF->udplen = UIP_HTONS(uip_slen + UIP_UDPH_LEN); - UIP_UDP_BUF->udpchksum = 0; - - UIP_UDP_BUF->srcport = uip_udp_conn->lport; - UIP_UDP_BUF->destport = uip_udp_conn->rport; - - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &uip_udp_conn->ripaddr); - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - - uip_appdata = &uip_buf[UIP_IPTCPH_LEN]; - -#if UIP_UDP_CHECKSUMS - /* Calculate UDP checksum. */ - UIP_UDP_BUF->udpchksum = ~(uip_udpchksum()); - if(UIP_UDP_BUF->udpchksum == 0) { - UIP_UDP_BUF->udpchksum = 0xffff; - } -#endif /* UIP_UDP_CHECKSUMS */ - - UIP_STAT(++uip_stat.udp.sent); - goto ip_send_nolen; -#endif /* UIP_UDP */ - -#if UIP_TCP - /* TCP input processing. */ - tcp_input: - - uip_remove_ext_hdr(); - - UIP_STAT(++uip_stat.tcp.recv); - LOG_INFO("Receiving TCP packet\n"); - /* Start of TCP input header processing code. */ - - if(uip_tcpchksum() != 0xffff) { /* Compute and check the TCP - checksum. */ - UIP_STAT(++uip_stat.tcp.drop); - UIP_STAT(++uip_stat.tcp.chkerr); - LOG_ERR("tcp: bad checksum 0x%04x 0x%04x\n", UIP_TCP_BUF->tcpchksum, - uip_tcpchksum()); - goto drop; - } - - /* Make sure that the TCP port number is not zero. */ - if(UIP_TCP_BUF->destport == 0 || UIP_TCP_BUF->srcport == 0) { - LOG_ERR("tcp: zero port\n"); - goto drop; - } - - /* Demultiplex this segment. */ - /* First check any active connections. */ - for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_TCP_CONNS - 1]; - ++uip_connr) { - if(uip_connr->tcpstateflags != UIP_CLOSED && - UIP_TCP_BUF->destport == uip_connr->lport && - UIP_TCP_BUF->srcport == uip_connr->rport && - uip_ipaddr_cmp(&UIP_IP_BUF->srcipaddr, &uip_connr->ripaddr)) { - goto found; - } - } - - /* If we didn't find and active connection that expected the packet, - either this packet is an old duplicate, or this is a SYN packet - destined for a connection in LISTEN. If the SYN flag isn't set, - it is an old packet and we send a RST. */ - if((UIP_TCP_BUF->flags & TCP_CTL) != TCP_SYN) { - goto reset; - } - - tmp16 = UIP_TCP_BUF->destport; - /* Next, check listening connections. */ - for(c = 0; c < UIP_LISTENPORTS; ++c) { - if(tmp16 == uip_listenports[c]) { - goto found_listen; - } - } - - /* No matching connection found, so we send a RST packet. */ - UIP_STAT(++uip_stat.tcp.synrst); - - reset: - LOG_WARN("In reset\n"); - /* We do not send resets in response to resets. */ - if(UIP_TCP_BUF->flags & TCP_RST) { - goto drop; - } - - UIP_STAT(++uip_stat.tcp.rst); - - UIP_TCP_BUF->flags = TCP_RST | TCP_ACK; - uip_len = UIP_IPTCPH_LEN; - UIP_TCP_BUF->tcpoffset = 5 << 4; - - /* Flip the seqno and ackno fields in the TCP header. */ - c = UIP_TCP_BUF->seqno[3]; - UIP_TCP_BUF->seqno[3] = UIP_TCP_BUF->ackno[3]; - UIP_TCP_BUF->ackno[3] = c; - - c = UIP_TCP_BUF->seqno[2]; - UIP_TCP_BUF->seqno[2] = UIP_TCP_BUF->ackno[2]; - UIP_TCP_BUF->ackno[2] = c; - - c = UIP_TCP_BUF->seqno[1]; - UIP_TCP_BUF->seqno[1] = UIP_TCP_BUF->ackno[1]; - UIP_TCP_BUF->ackno[1] = c; - - c = UIP_TCP_BUF->seqno[0]; - UIP_TCP_BUF->seqno[0] = UIP_TCP_BUF->ackno[0]; - UIP_TCP_BUF->ackno[0] = c; - - /* We also have to increase the sequence number we are - acknowledging. If the least significant byte overflowed, we need - to propagate the carry to the other bytes as well. */ - if(++UIP_TCP_BUF->ackno[3] == 0) { - if(++UIP_TCP_BUF->ackno[2] == 0) { - if(++UIP_TCP_BUF->ackno[1] == 0) { - ++UIP_TCP_BUF->ackno[0]; - } - } - } - - /* Swap port numbers. */ - tmp16 = UIP_TCP_BUF->srcport; - UIP_TCP_BUF->srcport = UIP_TCP_BUF->destport; - UIP_TCP_BUF->destport = tmp16; - - /* Swap IP addresses. */ - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &UIP_IP_BUF->srcipaddr); - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - /* And send out the RST packet! */ - goto tcp_send_noconn; - - /* This label will be jumped to if we matched the incoming packet - with a connection in LISTEN. In that case, we should create a new - connection and send a SYNACK in return. */ - found_listen: - LOG_DBG("In found listen\n"); - /* First we check if there are any connections avaliable. Unused - connections are kept in the same table as used connections, but - unused ones have the tcpstate set to CLOSED. Also, connections in - TIME_WAIT are kept track of and we'll use the oldest one if no - CLOSED connections are found. Thanks to Eddie C. Dost for a very - nice algorithm for the TIME_WAIT search. */ - uip_connr = 0; - for(c = 0; c < UIP_TCP_CONNS; ++c) { - if(uip_conns[c].tcpstateflags == UIP_CLOSED) { - uip_connr = &uip_conns[c]; - break; - } - if(uip_conns[c].tcpstateflags == UIP_TIME_WAIT) { - if(uip_connr == 0 || - uip_conns[c].timer > uip_connr->timer) { - uip_connr = &uip_conns[c]; - } - } - } - - if(uip_connr == 0) { - /* All connections are used already, we drop packet and hope that - the remote end will retransmit the packet at a time when we - have more spare connections. */ - UIP_STAT(++uip_stat.tcp.syndrop); - LOG_ERR("tcp: found no unused connections\n"); - goto drop; - } - uip_conn = uip_connr; - - /* Fill in the necessary fields for the new connection. */ - uip_connr->rto = uip_connr->timer = UIP_RTO; - uip_connr->sa = 0; - uip_connr->sv = 4; - uip_connr->nrtx = 0; - uip_connr->lport = UIP_TCP_BUF->destport; - uip_connr->rport = UIP_TCP_BUF->srcport; - uip_ipaddr_copy(&uip_connr->ripaddr, &UIP_IP_BUF->srcipaddr); - uip_connr->tcpstateflags = UIP_SYN_RCVD; - - uip_connr->snd_nxt[0] = iss[0]; - uip_connr->snd_nxt[1] = iss[1]; - uip_connr->snd_nxt[2] = iss[2]; - uip_connr->snd_nxt[3] = iss[3]; - uip_connr->len = 1; - - /* rcv_nxt should be the seqno from the incoming packet + 1. */ - uip_connr->rcv_nxt[0] = UIP_TCP_BUF->seqno[0]; - uip_connr->rcv_nxt[1] = UIP_TCP_BUF->seqno[1]; - uip_connr->rcv_nxt[2] = UIP_TCP_BUF->seqno[2]; - uip_connr->rcv_nxt[3] = UIP_TCP_BUF->seqno[3]; - uip_add_rcv_nxt(1); - - /* Parse the TCP MSS option, if present. */ - if((UIP_TCP_BUF->tcpoffset & 0xf0) > 0x50) { - for(c = 0; c < ((UIP_TCP_BUF->tcpoffset >> 4) - 5) << 2 ;) { - opt = uip_buf[UIP_IPTCPH_LEN + c]; - if(opt == TCP_OPT_END) { - /* End of options. */ - break; - } else if(opt == TCP_OPT_NOOP) { - ++c; - /* NOP option. */ - } else if(opt == TCP_OPT_MSS && - uip_buf[UIP_IPTCPH_LEN + 1 + c] == TCP_OPT_MSS_LEN) { - /* An MSS option with the right option length. */ - tmp16 = ((uint16_t)uip_buf[UIP_IPTCPH_LEN + 2 + c] << 8) | - (uint16_t)uip_buf[UIP_IPTCPH_LEN + 3 + c]; - uip_connr->initialmss = uip_connr->mss = - tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; - - /* And we are done processing options. */ - break; - } else { - /* All other options have a length field, so that we easily - can skip past them. */ - if(uip_buf[UIP_IPTCPH_LEN + 1 + c] == 0) { - /* If the length field is zero, the options are malformed - and we don't process them further. */ - break; - } - c += uip_buf[UIP_IPTCPH_LEN + 1 + c]; - } - } - } - - /* Our response will be a SYNACK. */ -#if UIP_ACTIVE_OPEN - tcp_send_synack: - UIP_TCP_BUF->flags = TCP_ACK; - - tcp_send_syn: - UIP_TCP_BUF->flags |= TCP_SYN; -#else /* UIP_ACTIVE_OPEN */ - tcp_send_synack: - UIP_TCP_BUF->flags = TCP_SYN | TCP_ACK; -#endif /* UIP_ACTIVE_OPEN */ - - /* We send out the TCP Maximum Segment Size option with our - SYNACK. */ - UIP_TCP_BUF->optdata[0] = TCP_OPT_MSS; - UIP_TCP_BUF->optdata[1] = TCP_OPT_MSS_LEN; - UIP_TCP_BUF->optdata[2] = (UIP_TCP_MSS) / 256; - UIP_TCP_BUF->optdata[3] = (UIP_TCP_MSS) & 255; - uip_len = UIP_IPTCPH_LEN + TCP_OPT_MSS_LEN; - UIP_TCP_BUF->tcpoffset = ((UIP_TCPH_LEN + TCP_OPT_MSS_LEN) / 4) << 4; - goto tcp_send; - - /* This label will be jumped to if we found an active connection. */ - found: - LOG_DBG("In found\n"); - uip_conn = uip_connr; - uip_flags = 0; - /* We do a very naive form of TCP reset processing; we just accept - any RST and kill our connection. We should in fact check if the - sequence number of this reset is wihtin our advertised window - before we accept the reset. */ - if(UIP_TCP_BUF->flags & TCP_RST) { - uip_connr->tcpstateflags = UIP_CLOSED; - LOG_WARN("tcp: got reset, aborting connection."); - uip_flags = UIP_ABORT; - UIP_APPCALL(); - goto drop; - } - /* Calculate the length of the data, if the application has sent - any data to us. */ - c = (UIP_TCP_BUF->tcpoffset >> 4) << 2; - /* uip_len will contain the length of the actual TCP data. This is - calculated by subtracing the length of the TCP header (in - c) and the length of the IP header (20 bytes). */ - uip_len = uip_len - c - UIP_IPH_LEN; - - /* First, check if the sequence number of the incoming packet is - what we're expecting next. If not, we send out an ACK with the - correct numbers in, unless we are in the SYN_RCVD state and - receive a SYN, in which case we should retransmit our SYNACK - (which is done futher down). */ - if(!((((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_SENT) && - ((UIP_TCP_BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK))) || - (((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_RCVD) && - ((UIP_TCP_BUF->flags & TCP_CTL) == TCP_SYN)))) { - if((uip_len > 0 || ((UIP_TCP_BUF->flags & (TCP_SYN | TCP_FIN)) != 0)) && - (UIP_TCP_BUF->seqno[0] != uip_connr->rcv_nxt[0] || - UIP_TCP_BUF->seqno[1] != uip_connr->rcv_nxt[1] || - UIP_TCP_BUF->seqno[2] != uip_connr->rcv_nxt[2] || - UIP_TCP_BUF->seqno[3] != uip_connr->rcv_nxt[3])) { - - if((UIP_TCP_BUF->flags & TCP_SYN)) { - if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_RCVD) { - goto tcp_send_synack; -#if UIP_ACTIVE_OPEN - } else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_SENT) { - goto tcp_send_syn; -#endif - } - } - goto tcp_send_ack; - } - } - - /* Next, check if the incoming segment acknowledges any outstanding - data. If so, we update the sequence number, reset the length of - the outstanding data, calculate RTT estimations, and reset the - retransmission timer. */ - if((UIP_TCP_BUF->flags & TCP_ACK) && uip_outstanding(uip_connr)) { - uip_add32(uip_connr->snd_nxt, uip_connr->len); - - if(UIP_TCP_BUF->ackno[0] == uip_acc32[0] && - UIP_TCP_BUF->ackno[1] == uip_acc32[1] && - UIP_TCP_BUF->ackno[2] == uip_acc32[2] && - UIP_TCP_BUF->ackno[3] == uip_acc32[3]) { - /* Update sequence number. */ - uip_connr->snd_nxt[0] = uip_acc32[0]; - uip_connr->snd_nxt[1] = uip_acc32[1]; - uip_connr->snd_nxt[2] = uip_acc32[2]; - uip_connr->snd_nxt[3] = uip_acc32[3]; - - /* Do RTT estimation, unless we have done retransmissions. */ - if(uip_connr->nrtx == 0) { - signed char m; - m = uip_connr->rto - uip_connr->timer; - /* This is taken directly from VJs original code in his paper */ - m = m - (uip_connr->sa >> 3); - uip_connr->sa += m; - if(m < 0) { - m = -m; - } - m = m - (uip_connr->sv >> 2); - uip_connr->sv += m; - uip_connr->rto = (uip_connr->sa >> 3) + uip_connr->sv; - - } - /* Set the acknowledged flag. */ - uip_flags = UIP_ACKDATA; - /* Reset the retransmission timer. */ - uip_connr->timer = uip_connr->rto; - - /* Reset length of outstanding data. */ - uip_connr->len = 0; - } - - } - - /* Do different things depending on in what state the connection is. */ - switch(uip_connr->tcpstateflags & UIP_TS_MASK) { - /* CLOSED and LISTEN are not handled here. CLOSE_WAIT is not - implemented, since we force the application to close when the - peer sends a FIN (hence the application goes directly from - ESTABLISHED to LAST_ACK). */ - case UIP_SYN_RCVD: - /* In SYN_RCVD we have sent out a SYNACK in response to a SYN, and - we are waiting for an ACK that acknowledges the data we sent - out the last time. Therefore, we want to have the UIP_ACKDATA - flag set. If so, we enter the ESTABLISHED state. */ - if(uip_flags & UIP_ACKDATA) { - uip_connr->tcpstateflags = UIP_ESTABLISHED; - uip_flags = UIP_CONNECTED; - uip_connr->len = 0; - if(uip_len > 0) { - uip_flags |= UIP_NEWDATA; - uip_add_rcv_nxt(uip_len); - } - uip_slen = 0; - UIP_APPCALL(); - goto appsend; - } - /* We need to retransmit the SYNACK */ - if((UIP_TCP_BUF->flags & TCP_CTL) == TCP_SYN) { - goto tcp_send_synack; - } - goto drop; -#if UIP_ACTIVE_OPEN - case UIP_SYN_SENT: - /* In SYN_SENT, we wait for a SYNACK that is sent in response to - our SYN. The rcv_nxt is set to sequence number in the SYNACK - plus one, and we send an ACK. We move into the ESTABLISHED - state. */ - if((uip_flags & UIP_ACKDATA) && - (UIP_TCP_BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)) { - - /* Parse the TCP MSS option, if present. */ - if((UIP_TCP_BUF->tcpoffset & 0xf0) > 0x50) { - for(c = 0; c < ((UIP_TCP_BUF->tcpoffset >> 4) - 5) << 2 ;) { - opt = uip_buf[UIP_IPTCPH_LEN + c]; - if(opt == TCP_OPT_END) { - /* End of options. */ - break; - } else if(opt == TCP_OPT_NOOP) { - ++c; - /* NOP option. */ - } else if(opt == TCP_OPT_MSS && - uip_buf[UIP_IPTCPH_LEN + 1 + c] == TCP_OPT_MSS_LEN) { - /* An MSS option with the right option length. */ - tmp16 = (uip_buf[UIP_IPTCPH_LEN + 2 + c] << 8) | - uip_buf[UIP_IPTCPH_LEN + 3 + c]; - uip_connr->initialmss = - uip_connr->mss = tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; - - /* And we are done processing options. */ - break; - } else { - /* All other options have a length field, so that we easily - can skip past them. */ - if(uip_buf[UIP_IPTCPH_LEN + 1 + c] == 0) { - /* If the length field is zero, the options are malformed - and we don't process them further. */ - break; - } - c += uip_buf[UIP_IPTCPH_LEN + 1 + c]; - } - } - } - uip_connr->tcpstateflags = UIP_ESTABLISHED; - uip_connr->rcv_nxt[0] = UIP_TCP_BUF->seqno[0]; - uip_connr->rcv_nxt[1] = UIP_TCP_BUF->seqno[1]; - uip_connr->rcv_nxt[2] = UIP_TCP_BUF->seqno[2]; - uip_connr->rcv_nxt[3] = UIP_TCP_BUF->seqno[3]; - uip_add_rcv_nxt(1); - uip_flags = UIP_CONNECTED | UIP_NEWDATA; - uip_connr->len = 0; - uipbuf_clear(); - uip_slen = 0; - UIP_APPCALL(); - goto appsend; - } - /* Inform the application that the connection failed */ - uip_flags = UIP_ABORT; - UIP_APPCALL(); - /* The connection is closed after we send the RST */ - uip_conn->tcpstateflags = UIP_CLOSED; - goto reset; -#endif /* UIP_ACTIVE_OPEN */ - - case UIP_ESTABLISHED: - /* In the ESTABLISHED state, we call upon the application to feed - data into the uip_buf. If the UIP_ACKDATA flag is set, the - application should put new data into the buffer, otherwise we are - retransmitting an old segment, and the application should put that - data into the buffer. - - If the incoming packet is a FIN, we should close the connection on - this side as well, and we send out a FIN and enter the LAST_ACK - state. We require that there is no outstanding data; otherwise the - sequence numbers will be screwed up. */ - - if(UIP_TCP_BUF->flags & TCP_FIN && !(uip_connr->tcpstateflags & UIP_STOPPED)) { - if(uip_outstanding(uip_connr)) { - goto drop; - } - uip_add_rcv_nxt(1 + uip_len); - uip_flags |= UIP_CLOSE; - if(uip_len > 0) { - uip_flags |= UIP_NEWDATA; - } - UIP_APPCALL(); - uip_connr->len = 1; - uip_connr->tcpstateflags = UIP_LAST_ACK; - uip_connr->nrtx = 0; - tcp_send_finack: - UIP_TCP_BUF->flags = TCP_FIN | TCP_ACK; - goto tcp_send_nodata; - } - - /* Check the URG flag. If this is set, the segment carries urgent - data that we must pass to the application. */ - if((UIP_TCP_BUF->flags & TCP_URG) != 0) { -#if UIP_URGDATA > 0 - uip_urglen = (UIP_TCP_BUF->urgp[0] << 8) | UIP_TCP_BUF->urgp[1]; - if(uip_urglen > uip_len) { - /* There is more urgent data in the next segment to come. */ - uip_urglen = uip_len; - } - uip_add_rcv_nxt(uip_urglen); - uip_len -= uip_urglen; - uip_urgdata = uip_appdata; - uip_appdata += uip_urglen; - } else { - uip_urglen = 0; -#else /* UIP_URGDATA > 0 */ - uip_appdata = ((char *)uip_appdata) + ((UIP_TCP_BUF->urgp[0] << 8) | UIP_TCP_BUF->urgp[1]); - uip_len -= (UIP_TCP_BUF->urgp[0] << 8) | UIP_TCP_BUF->urgp[1]; -#endif /* UIP_URGDATA > 0 */ - } - - /* If uip_len > 0 we have TCP data in the packet, and we flag this - by setting the UIP_NEWDATA flag and update the sequence number - we acknowledge. If the application has stopped the dataflow - using uip_stop(), we must not accept any data packets from the - remote host. */ - if(uip_len > 0 && !(uip_connr->tcpstateflags & UIP_STOPPED)) { - uip_flags |= UIP_NEWDATA; - uip_add_rcv_nxt(uip_len); - } - - /* Check if the available buffer space advertised by the other end - is smaller than the initial MSS for this connection. If so, we - set the current MSS to the window size to ensure that the - application does not send more data than the other end can - handle. - - If the remote host advertises a zero window, we set the MSS to - the initial MSS so that the application will send an entire MSS - of data. This data will not be acknowledged by the receiver, - and the application will retransmit it. This is called the - "persistent timer" and uses the retransmission mechanim. - */ - tmp16 = ((uint16_t)UIP_TCP_BUF->wnd[0] << 8) + (uint16_t)UIP_TCP_BUF->wnd[1]; - if(tmp16 > uip_connr->initialmss || - tmp16 == 0) { - tmp16 = uip_connr->initialmss; - } - uip_connr->mss = tmp16; - - /* If this packet constitutes an ACK for outstanding data (flagged - by the UIP_ACKDATA flag, we should call the application since it - might want to send more data. If the incoming packet had data - from the peer (as flagged by the UIP_NEWDATA flag), the - application must also be notified. - - When the application is called, the global variable uip_len - contains the length of the incoming data. The application can - access the incoming data through the global pointer - uip_appdata, which usually points UIP_IPTCPH_LEN - bytes into the uip_buf array. - - If the application wishes to send any data, this data should be - put into the uip_appdata and the length of the data should be - put into uip_len. If the application don't have any data to - send, uip_len must be set to 0. */ - if(uip_flags & (UIP_NEWDATA | UIP_ACKDATA)) { - uip_slen = 0; - UIP_APPCALL(); - - appsend: - - if(uip_flags & UIP_ABORT) { - uip_slen = 0; - uip_connr->tcpstateflags = UIP_CLOSED; - UIP_TCP_BUF->flags = TCP_RST | TCP_ACK; - goto tcp_send_nodata; - } - - if(uip_flags & UIP_CLOSE) { - uip_slen = 0; - uip_connr->len = 1; - uip_connr->tcpstateflags = UIP_FIN_WAIT_1; - uip_connr->nrtx = 0; - UIP_TCP_BUF->flags = TCP_FIN | TCP_ACK; - goto tcp_send_nodata; - } - - /* If uip_slen > 0, the application has data to be sent. */ - if(uip_slen > 0) { - - /* If the connection has acknowledged data, the contents of - the ->len variable should be discarded. */ - if((uip_flags & UIP_ACKDATA) != 0) { - uip_connr->len = 0; - } - - /* If the ->len variable is non-zero the connection has - already data in transit and cannot send anymore right - now. */ - if(uip_connr->len == 0) { - - /* The application cannot send more than what is allowed by - the mss (the minumum of the MSS and the available - window). */ - if(uip_slen > uip_connr->mss) { - uip_slen = uip_connr->mss; - } - - /* Remember how much data we send out now so that we know - when everything has been acknowledged. */ - uip_connr->len = uip_slen; - } else { - - /* If the application already had unacknowledged data, we - make sure that the application does not send (i.e., - retransmit) out more than it previously sent out. */ - uip_slen = uip_connr->len; - } - } - uip_connr->nrtx = 0; - apprexmit: - uip_appdata = uip_sappdata; - - /* If the application has data to be sent, or if the incoming - packet had new data in it, we must send out a packet. */ - if(uip_slen > 0 && uip_connr->len > 0) { - /* Add the length of the IP and TCP headers. */ - uip_len = uip_connr->len + UIP_IPTCPH_LEN; - /* We always set the ACK flag in response packets. */ - UIP_TCP_BUF->flags = TCP_ACK | TCP_PSH; - /* Send the packet. */ - goto tcp_send_noopts; - } - /* If there is no data to send, just send out a pure ACK if - there is newdata. */ - if(uip_flags & UIP_NEWDATA) { - uip_len = UIP_IPTCPH_LEN; - UIP_TCP_BUF->flags = TCP_ACK; - goto tcp_send_noopts; - } - } - goto drop; - case UIP_LAST_ACK: - /* We can close this connection if the peer has acknowledged our - FIN. This is indicated by the UIP_ACKDATA flag. */ - if(uip_flags & UIP_ACKDATA) { - uip_connr->tcpstateflags = UIP_CLOSED; - uip_flags = UIP_CLOSE; - UIP_APPCALL(); - } - break; - - case UIP_FIN_WAIT_1: - /* The application has closed the connection, but the remote host - hasn't closed its end yet. Thus we do nothing but wait for a - FIN from the other side. */ - if(uip_len > 0) { - uip_add_rcv_nxt(uip_len); - } - if(UIP_TCP_BUF->flags & TCP_FIN) { - if(uip_flags & UIP_ACKDATA) { - uip_connr->tcpstateflags = UIP_TIME_WAIT; - uip_connr->timer = 0; - uip_connr->len = 0; - } else { - uip_connr->tcpstateflags = UIP_CLOSING; - } - uip_add_rcv_nxt(1); - uip_flags = UIP_CLOSE; - UIP_APPCALL(); - goto tcp_send_ack; - } else if(uip_flags & UIP_ACKDATA) { - uip_connr->tcpstateflags = UIP_FIN_WAIT_2; - uip_connr->len = 0; - goto drop; - } - if(uip_len > 0) { - goto tcp_send_ack; - } - goto drop; - - case UIP_FIN_WAIT_2: - if(uip_len > 0) { - uip_add_rcv_nxt(uip_len); - } - if(UIP_TCP_BUF->flags & TCP_FIN) { - uip_connr->tcpstateflags = UIP_TIME_WAIT; - uip_connr->timer = 0; - uip_add_rcv_nxt(1); - uip_flags = UIP_CLOSE; - UIP_APPCALL(); - goto tcp_send_ack; - } - if(uip_len > 0) { - goto tcp_send_ack; - } - goto drop; - - case UIP_TIME_WAIT: - goto tcp_send_ack; - - case UIP_CLOSING: - if(uip_flags & UIP_ACKDATA) { - uip_connr->tcpstateflags = UIP_TIME_WAIT; - uip_connr->timer = 0; - } - } - goto drop; - - /* We jump here when we are ready to send the packet, and just want - to set the appropriate TCP sequence numbers in the TCP header. */ - tcp_send_ack: - UIP_TCP_BUF->flags = TCP_ACK; - - tcp_send_nodata: - uip_len = UIP_IPTCPH_LEN; - - tcp_send_noopts: - UIP_TCP_BUF->tcpoffset = (UIP_TCPH_LEN / 4) << 4; - - /* We're done with the input processing. We are now ready to send a - reply. Our job is to fill in all the fields of the TCP and IP - headers before calculating the checksum and finally send the - packet. */ - tcp_send: - LOG_DBG("In tcp_send\n"); - - UIP_TCP_BUF->ackno[0] = uip_connr->rcv_nxt[0]; - UIP_TCP_BUF->ackno[1] = uip_connr->rcv_nxt[1]; - UIP_TCP_BUF->ackno[2] = uip_connr->rcv_nxt[2]; - UIP_TCP_BUF->ackno[3] = uip_connr->rcv_nxt[3]; - - UIP_TCP_BUF->seqno[0] = uip_connr->snd_nxt[0]; - UIP_TCP_BUF->seqno[1] = uip_connr->snd_nxt[1]; - UIP_TCP_BUF->seqno[2] = uip_connr->snd_nxt[2]; - UIP_TCP_BUF->seqno[3] = uip_connr->snd_nxt[3]; - - UIP_TCP_BUF->srcport = uip_connr->lport; - UIP_TCP_BUF->destport = uip_connr->rport; - - UIP_IP_BUF->vtc = 0x60; - UIP_IP_BUF->tcflow = 0x00; - - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &uip_connr->ripaddr); - uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); - LOG_INFO("Sending TCP packet to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(" from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - - if(uip_connr->tcpstateflags & UIP_STOPPED) { - /* If the connection has issued uip_stop(), we advertise a zero - window so that the remote host will stop sending data. */ - UIP_TCP_BUF->wnd[0] = UIP_TCP_BUF->wnd[1] = 0; - } else { - UIP_TCP_BUF->wnd[0] = ((UIP_RECEIVE_WINDOW) >> 8); - UIP_TCP_BUF->wnd[1] = ((UIP_RECEIVE_WINDOW) & 0xff); - } - - tcp_send_noconn: - UIP_IP_BUF->proto = UIP_PROTO_TCP; - - UIP_IP_BUF->ttl = uip_ds6_if.cur_hop_limit; - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - - UIP_TCP_BUF->urgp[0] = UIP_TCP_BUF->urgp[1] = 0; - - /* Calculate TCP checksum. */ - UIP_TCP_BUF->tcpchksum = 0; - UIP_TCP_BUF->tcpchksum = ~(uip_tcpchksum()); - UIP_STAT(++uip_stat.tcp.sent); - -#endif /* UIP_TCP */ -#if UIP_UDP - ip_send_nolen: -#endif - UIP_IP_BUF->flow = 0x00; - send: - LOG_INFO("Sending packet with length %d (%d)\n", uip_len, uipbuf_get_len_field(UIP_IP_BUF)); - - UIP_STAT(++uip_stat.ip.sent); - /* Return and let the caller do the actual transmission. */ - uip_flags = 0; - return; - - drop: - uipbuf_clear(); - uip_ext_bitmap = 0; - uip_flags = 0; - return; -} -/*---------------------------------------------------------------------------*/ -uint16_t -uip_htons(uint16_t val) -{ - return UIP_HTONS(val); -} - -uint32_t -uip_htonl(uint32_t val) -{ - return UIP_HTONL(val); -} -/*---------------------------------------------------------------------------*/ -void -uip_send(const void *data, int len) -{ - int copylen; - - if(uip_sappdata != NULL) { - copylen = MIN(len, UIP_BUFSIZE - UIP_IPTCPH_LEN - - (int)((char *)uip_sappdata - (char *)UIP_TCP_PAYLOAD)); - } else { - copylen = MIN(len, UIP_BUFSIZE - UIP_IPTCPH_LEN); - } - if(copylen > 0) { - uip_slen = copylen; - if(data != uip_sappdata) { - if(uip_sappdata == NULL) { - memcpy(UIP_TCP_PAYLOAD, (data), uip_slen); - } else { - memcpy(uip_sappdata, (data), uip_slen); - } - } - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/ipv6/uipbuf.c b/os/net/ipv6/uipbuf.c deleted file mode 100644 index f7e8f4b06..000000000 --- a/os/net/ipv6/uipbuf.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS, Yanzi Networks - * 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. The name of the authors may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHOR 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 "contiki.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uipbuf.h" -#include - -/*---------------------------------------------------------------------------*/ - -static uint16_t uipbuf_attrs[UIPBUF_ATTR_MAX]; -static uint16_t uipbuf_default_attrs[UIPBUF_ATTR_MAX]; - -/*---------------------------------------------------------------------------*/ -void -uipbuf_clear(void) -{ - uip_len = 0; - uip_ext_len = 0; - uip_last_proto = 0; - uipbuf_clear_attr(); -} -/*---------------------------------------------------------------------------*/ -bool -uipbuf_add_ext_hdr(int16_t len) -{ - if(len + uip_len <= UIP_LINK_MTU && len + uip_len >= 0) { - uip_ext_len += len; - uip_len += len; - return true; - } else { - return false; - } -} -/*---------------------------------------------------------------------------*/ -bool -uipbuf_set_len(uint16_t len) -{ - if(len <= UIP_LINK_MTU) { - uip_len = len; - return true; - } else { - return false; - } -} -/*---------------------------------------------------------------------------*/ -void -uipbuf_set_len_field(struct uip_ip_hdr *hdr, uint16_t len) -{ - hdr->len[0] = (len >> 8); - hdr->len[1] = (len & 0xff); -} -/*---------------------------------------------------------------------------*/ -uint16_t -uipbuf_get_len_field(struct uip_ip_hdr *hdr) -{ - return ((uint16_t)(hdr->len[0]) << 8) + hdr->len[1]; -} -/*---------------------------------------------------------------------------*/ -/* Get the next header given the buffer - start indicates that this is - start of the IPv6 header - needs to be set to 0 when in an ext hdr */ -uint8_t * -uipbuf_get_next_header(uint8_t *buffer, uint16_t size, uint8_t *protocol, bool start) -{ - int curr_hdr_len = 0; - int next_hdr_len = 0; - uint8_t *next_header = NULL; - struct uip_ip_hdr *ipbuf = NULL; - struct uip_ext_hdr *curr_ext = NULL; - struct uip_ext_hdr *next_ext = NULL; - - if(start) { - /* protocol in the IP buffer */ - ipbuf = (struct uip_ip_hdr *)buffer; - *protocol = ipbuf->proto; - curr_hdr_len = UIP_IPH_LEN; - } else { - /* protocol in the Ext hdr */ - curr_ext = (struct uip_ext_hdr *)buffer; - *protocol = curr_ext->next; - /* This is just an ext header */ - curr_hdr_len = (curr_ext->len << 3) + 8; - } - - /* Check first if enough space for current header */ - if(curr_hdr_len > size) { - return NULL; - } - next_header = buffer + curr_hdr_len; - - /* Check if the buffer is large enough for the next header */ - if(uip_is_proto_ext_hdr(*protocol)) { - next_ext = (struct uip_ext_hdr *)next_header; - next_hdr_len = (next_ext->len << 3) + 8; - } else { - if(*protocol == UIP_PROTO_TCP) { - next_hdr_len = UIP_TCPH_LEN; - } else if(*protocol == UIP_PROTO_UDP) { - next_hdr_len = UIP_UDPH_LEN; - } else if(*protocol == UIP_PROTO_ICMP6) { - next_hdr_len = UIP_ICMPH_LEN; - } - } - - /* Size must be enough to hold both the current and next header */ - if(next_hdr_len == 0 || curr_hdr_len + next_hdr_len > size) { - return NULL; - } - - return next_header; -} -/*---------------------------------------------------------------------------*/ -/* Get the final header given the buffer - that is assumed to be at start - of an IPv6 header */ -uint8_t * -uipbuf_get_last_header(uint8_t *buffer, uint16_t size, uint8_t *protocol) -{ - uint8_t *nbuf; - - nbuf = uipbuf_get_next_header(buffer, size, protocol, true); - while(nbuf != NULL && uip_is_proto_ext_hdr(*protocol)) { - /* move to the ext hdr */ - nbuf = uipbuf_get_next_header(nbuf, size - (nbuf - buffer), protocol, false); - } - - /* In case the buffer wasn't large enough for all headers, return NULL */ - return nbuf; -} -/*---------------------------------------------------------------------------*/ -uint8_t * -uipbuf_search_header(uint8_t *buffer, uint16_t size, uint8_t protocol) -{ - uint8_t *nbuf; - uint8_t next_proto; - - nbuf = uipbuf_get_next_header(buffer, size, &next_proto, true); - while(nbuf != NULL && next_proto != protocol && uip_is_proto_ext_hdr(next_proto)) { - /* move to the ext hdr */ - nbuf = uipbuf_get_next_header(nbuf, size - (nbuf - buffer), &next_proto, false); - } - - if(next_proto == protocol) { - return nbuf; - } else { - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -/** - * Common functions for uipbuf (attributes, etc). - * - */ -/*---------------------------------------------------------------------------*/ -uint16_t -uipbuf_get_attr(uint8_t type) -{ - if(type < UIPBUF_ATTR_MAX) { - return uipbuf_attrs[type]; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -uipbuf_set_attr(uint8_t type, uint16_t value) -{ - if(type < UIPBUF_ATTR_MAX) { - uipbuf_attrs[type] = value; - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -uipbuf_set_default_attr(uint8_t type, uint16_t value) -{ - if(type < UIPBUF_ATTR_MAX) { - uipbuf_default_attrs[type] = value; - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -uipbuf_clear_attr(void) -{ - /* set everything to "defaults" */ - memcpy(uipbuf_attrs, uipbuf_default_attrs, sizeof(uipbuf_attrs)); -} -/*---------------------------------------------------------------------------*/ -void -uipbuf_set_attr_flag(uint16_t flag) -{ - /* Assume only 16-bits for flags now */ - uipbuf_attrs[UIPBUF_ATTR_FLAGS] |= flag; -} -/*---------------------------------------------------------------------------*/ -void -uipbuf_clr_attr_flag(uint16_t flag) -{ - uipbuf_attrs[UIPBUF_ATTR_FLAGS] &= ~flag; -} -/*---------------------------------------------------------------------------*/ -uint16_t -uipbuf_is_attr_flag(uint16_t flag) -{ - return (uipbuf_attrs[UIPBUF_ATTR_FLAGS] & flag) == flag; -} -/*---------------------------------------------------------------------------*/ -void -uipbuf_init(void) -{ - memset(uipbuf_default_attrs, 0, sizeof(uipbuf_default_attrs)); - /* And initialize anything that should be initialized */ - uipbuf_set_default_attr(UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS, - UIP_MAX_MAC_TRANSMISSIONS_UNDEFINED); - /* set the not-set default value - this will cause the MAC layer to - configure its default */ - uipbuf_set_default_attr(UIPBUF_ATTR_LLSEC_LEVEL, - UIPBUF_ATTR_LLSEC_LEVEL_MAC_DEFAULT); -} - -/*---------------------------------------------------------------------------*/ diff --git a/os/net/ipv6/uipbuf.h b/os/net/ipv6/uipbuf.h deleted file mode 100644 index fdea60b28..000000000 --- a/os/net/ipv6/uipbuf.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS, Yanzi Networks - * 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. The name of the authors may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHOR 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 UIPBUF_H_ -#define UIPBUF_H_ - -#include "contiki.h" -struct uip_ip_hdr; - -/** - * \brief Resets uIP buffer - */ -void uipbuf_clear(void); - -/** - * \brief Update uip buffer length for addition of an extension header - * \param len The length of the new extension header - * \retval true if the length fields were successfully set, false otherwise - */ -bool uipbuf_add_ext_hdr(int16_t len); - -/** - * \brief Set the length of the uIP buffer - * \param len The new length - * \retval true if the len was successfully set, false otherwise - */ -bool uipbuf_set_len(uint16_t len); - -/** - * \brief Updates the length field in the uIP buffer - * \param buffer The IPv6 header - * \param len The new length value - */ -void uipbuf_set_len_field(struct uip_ip_hdr *hdr, uint16_t len); - -/** - * \brief Returns the value of the length field in the uIP buffer - * \param buffer The IPv6 header - * \retvel The length value - */ -uint16_t uipbuf_get_len_field(struct uip_ip_hdr *hdr); - -/** - * \brief Get the next IPv6 header. - * \param buffer A pointer to the buffer holding the IPv6 packet - * \param size The size of the data in the buffer - * \param protocol A pointer to a variable where the protocol of the header will be stored - * \param start A flag that indicates if this is expected to be the IPv6 packet header or a later header (Extension header) - * \retval returns address of the next header, or NULL in case of insufficient buffer space - * - * This function moves to the next header in a IPv6 packet. - */ -uint8_t *uipbuf_get_next_header(uint8_t *buffer, uint16_t size, uint8_t *protocol, bool start); - - -/** - * \brief Get the last IPv6 header. - * \param buffer A pointer to the buffer holding the IPv6 packet - * \param size The size of the data in the buffer - * \param protocol A pointer to a variable where the protocol of the header will be stored - * \retval returns address of the last header, or NULL in case of insufficient buffer space - * - * This function moves to the last header of the IPv6 packet. - */ -uint8_t *uipbuf_get_last_header(uint8_t *buffer, uint16_t size, uint8_t *protocol); - -/** - * \brief Get an IPv6 header with a given protocol field. - * \param buffer A pointer to the buffer holding the IPv6 packet - * \param size The size of the data in the buffer - * \param protocol The protocol we are looking for - * \retval returns address of the header if found, else NULL - * - * This function moves to the last header of the IPv6 packet. - */ -uint8_t *uipbuf_search_header(uint8_t *buffer, uint16_t size, uint8_t protocol); - -/** - * \brief Get the value of the attribute - * \param type The attribute to get the value of - * \retval the value of the attribute - * - * This function gets the value of a specific uipbuf attribute. - */ -uint16_t uipbuf_get_attr(uint8_t type); - - -/** - * \brief Set the value of the attribute - * \param type The attribute to set the value of - * \param value The value to set - * \retval 0 - indicates failure of setting the value - * \retval 1 - indicates success of setting the value - * - * This function sets the value of a specific uipbuf attribute. - */ -int uipbuf_set_attr(uint8_t type, uint16_t value); - -/** - * \brief Set the default value of the attribute - * \param type The attribute to set the default value of - * \param value The value to set - * \retval 0 - indicates failure of setting the value - * \retval 1 - indicates success of setting the value - * - * This function sets the default value of a uipbuf attribute. - */ -int uipbuf_set_default_attr(uint8_t type, uint16_t value); - -/** - * \brief Set bits in the uipbuf attribute flags. - * \param flag_bits The bits to set in the flag. - * - * This function sets the uipbuf attributes flag of specified bits. - */ -void uipbuf_set_attr_flag(uint16_t flag_bits); - -/** - * \brief Clear bits in the uipbuf attribute flags. - * \param flag_bits The bits to clear in the flag. - * - * This function clears the uipbuf attributes flag of specified bits. - */ -void uipbuf_clr_attr_flag(uint16_t flag_bits); - -/** - * \brief Check if bits in the uipbuf attribute flag are set. - * \param flag_bits The bits to check in the flag. - * - * This function checks if the specified bits are set in the - * uipbuf attributes flag. - */ -uint16_t uipbuf_is_attr_flag(uint16_t flag_bits); - - -/** - * \brief Clear all attributes. - * - * This function clear all attributes in the uipbuf attributes - * including all flags. - */ -void uipbuf_clear_attr(void); - -/** - * \brief Initialize uipbuf attributes. - * - * This function initialize all attributes in the uipbuf - * attributes including all flags. - */ -void uipbuf_init(void); - -/** - * \brief The bits defined for uipbuf attributes flag. - * - */ -/* Avoid using NHC compression on the packet (6LoWPAN) */ -#define UIPBUF_ATTR_FLAGS_6LOWPAN_NO_NHC_COMPRESSION 0x01 -/* Avoid using prefix compression on the packet (6LoWPAN) */ -#define UIPBUF_ATTR_FLAGS_6LOWPAN_NO_PREFIX_COMPRESSION 0x02 - -/* MAC will set the default for this packet */ -#define UIPBUF_ATTR_LLSEC_LEVEL_MAC_DEFAULT 0xffff - -/** - * \brief The attributes defined for uipbuf attributes function. - * - */ -enum { - UIPBUF_ATTR_LLSEC_LEVEL, /**< Control link layer security level. */ - UIPBUF_ATTR_LLSEC_KEY_ID, /**< Control link layer security key ID. */ - UIPBUF_ATTR_INTERFACE_ID, /**< The interface to output packet on */ - UIPBUF_ATTR_PHYSICAL_NETWORK_ID, /**< Physical network ID (mapped to PAN ID)*/ - UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS, /**< MAX transmissions of the packet MAC */ - UIPBUF_ATTR_FLAGS, /**< Flags that can control lower layers. see above. */ - UIPBUF_ATTR_MAX -}; - -#endif /* UIPBUF_H_ */ diff --git a/os/net/ipv6/uiplib.c b/os/net/ipv6/uiplib.c deleted file mode 100644 index e4a7a49b7..000000000 --- a/os/net/ipv6/uiplib.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels and the Swedish Institute of - * Computer Science. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack and the Contiki operating system. - * - * - */ - -/** - * \addtogroup uip-addr-lib - * @{ - * - * \file - * Implementation of the IP address manipulation library - * \author - * Nicolas Tsiftes - * Niclas Finne - * Joakim Eriksson - */ - -#include "net/ipv6/uip.h" -#include "net/ipv6/uiplib.h" -#include "net/ipv6/ip64-addr.h" -#include -#include - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "uiplib" -#define LOG_LEVEL LOG_LEVEL_NONE - -/*---------------------------------------------------------------------------*/ -int -uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *ipaddr) -{ - uint16_t value; - int tmp, zero; - unsigned int len; - char c = 0; //gcc warning if not initialized - - value = 0; - zero = -1; - if(*addrstr == '[') addrstr++; - - for(len = 0; len < sizeof(uip_ip6addr_t) - 1; addrstr++) { - c = *addrstr; - if(c == ':' || c == '\0' || c == ']' || c == '/') { - ipaddr->u8[len] = (value >> 8) & 0xff; - ipaddr->u8[len + 1] = value & 0xff; - len += 2; - value = 0; - - if(c == '\0' || c == ']' || c == '/') { - break; - } - - if(*(addrstr + 1) == ':') { - /* Zero compression */ - if(zero < 0) { - zero = len; - } - addrstr++; - } - } else { - if(c >= '0' && c <= '9') { - tmp = c - '0'; - } else if(c >= 'a' && c <= 'f') { - tmp = c - 'a' + 10; - } else if(c >= 'A' && c <= 'F') { - tmp = c - 'A' + 10; - } else { - LOG_ERR("illegal char: '%c'\n", c); - return 0; - } - value = (value << 4) + (tmp & 0xf); - } - } - if(c != '\0' && c != ']' && c != '/') { - LOG_ERR("too large address\n"); - return 0; - } - if(len < sizeof(uip_ip6addr_t)) { - if(zero < 0) { - LOG_ERR("too short address\n"); - return 0; - } - memmove(&ipaddr->u8[zero + sizeof(uip_ip6addr_t) - len], - &ipaddr->u8[zero], len - zero); - memset(&ipaddr->u8[zero], 0, sizeof(uip_ip6addr_t) - len); - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -/* Parse a IPv4-address from a string. Returns the number of characters read - * for the address. */ -int -uiplib_ip4addrconv(const char *addrstr, uip_ip4addr_t *ipaddr) -{ - unsigned char tmp; - char c; - unsigned char i, j; - uint8_t charsread = 0; - - tmp = 0; - - for(i = 0; i < 4; ++i) { - j = 0; - do { - c = *addrstr; - ++j; - if(j > 4) { - return 0; - } - if(c == '.' || c == 0 || c == ' ') { - ipaddr->u8[i] = tmp; - tmp = 0; - } else if(c >= '0' && c <= '9') { - tmp = (tmp * 10) + (c - '0'); - } else { - return 0; - } - ++addrstr; - ++charsread; - } while(c != '.' && c != 0 && c != ' '); - - } - return charsread - 1; -} -/*---------------------------------------------------------------------------*/ -void -uiplib_ipaddr_print(const uip_ipaddr_t *addr) -{ - char buf[UIPLIB_IPV6_MAX_STR_LEN]; - uiplib_ipaddr_snprint(buf, sizeof(buf), addr); - printf("%s", buf); -} -/*---------------------------------------------------------------------------*/ -int -uiplib_ipaddr_snprint(char *buf, size_t size, const uip_ipaddr_t *addr) -{ - uint16_t a; - unsigned int i; - int f; - int n = 0; - - if(size == 0) { - return 0; - } - - if(addr == NULL) { - n = snprintf(buf, size, "(NULL IP addr)"); - return n; - } else if(ip64_addr_is_ipv4_mapped_addr(addr)) { - /* - * Printing IPv4-mapped addresses is done according to RFC 4291 [1] - * - * "An alternative form that is sometimes more - * convenient when dealing with a mixed environment - * of IPv4 and IPv6 nodes is x:x:x:x:x:x:d.d.d.d, - * where the 'x's are the hexadecimal values of the - * six high-order 16-bit pieces of the address, and - * the 'd's are the decimal values of the four - * low-order 8-bit pieces of the address (standard - * IPv4 representation)." - * - * [1] https://tools.ietf.org/html/rfc4291#page-4 - */ - n = snprintf(buf, size, "::FFFF:%u.%u.%u.%u", addr->u8[12], - addr->u8[13], addr->u8[14], addr->u8[15]); - return n; - } else { - for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) { - a = (addr->u8[i] << 8) + addr->u8[i + 1]; - if(a == 0 && f >= 0) { - if(f++ == 0) { - n += snprintf(buf+n, size-n, "::"); - if(n >= size) { - return n; - } - } - } else { - if(f > 0) { - f = -1; - } else if(i > 0) { - n += snprintf(buf+n, size-n, ":"); - if(n >= size) { - return n; - } - } - n += snprintf(buf+n, size-n, "%x", a); - if(n >= size) { - return n; - } - } - } - } - return n; -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/os/net/ipv6/uiplib.h b/os/net/ipv6/uiplib.h deleted file mode 100644 index aaf91282f..000000000 --- a/os/net/ipv6/uiplib.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment for the C64. - * - * - */ -#ifndef UIPLIB_H_ -#define UIPLIB_H_ - -#include "net/ipv6/uip.h" - -/** - * \addtogroup uip - * @{ - * - * \defgroup uip-addr-lib uIP address manipulation library - * - * A library with various IP address manipulation functions - * @{ - * - * \file - * Header file for the IP address manipulation library - * \author - * Adam Dunkels - */ - -/** - * Convert a textual representation of an IP address to a numerical representation. - * - * This function takes a textual representation of an IP address in - * the form a.b.c.d for IPv4 or a:b:c:d:e:f:g:h for IPv6 and converts - * it into a numeric IP address representation that can be used by - * other uIP functions. - * - * \param addrstr A pointer to a string containing the IP address in - * textual form. - * - * \param addr A pointer to a uip_ip4addr_t that will be filled in with - * the numerical representation of the address. - * - * \retval 0 If the IP address could not be parsed. - * \retval Non-zero If the IP address was parsed. - */ -#define uiplib_ipaddrconv uiplib_ip6addrconv - -int uiplib_ip4addrconv(const char *addrstr, uip_ip4addr_t *addr); -int uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *addr); -/** @} */ - - -/* The maxium length of an IPv6 string, including terminating null bytes - * fd01:0002:0003:0004:0005:0006:0007:0008 => 39 + 1 bytes */ -#define UIPLIB_IPV6_MAX_STR_LEN 40 - -/** - * Print an IP address using printf(). - * - * \param addr A pointer to a uip_ipaddr_t that will be printed with printf(). - */ -void uiplib_ipaddr_print(const uip_ipaddr_t *addr); - -/** - * Write at most size - 1 characters of the IP address to the output string. - * The output is always null-terminated, unless size is 0. - * - * \param buffer A pointer to an output string with at least size bytes. - * \param size The max number of characters to write to the output string. - * \param addr A pointer to a uip_ipaddr_t that will be printed with printf(). - */ -int uiplib_ipaddr_snprint(char *buffer, size_t size, const uip_ipaddr_t *addr); - -#endif /* UIPLIB_H_ */ -/** - * @} - * @} - */ diff --git a/os/net/ipv6/uipopt.h b/os/net/ipv6/uipopt.h deleted file mode 100644 index a75c59ea0..000000000 --- a/os/net/ipv6/uipopt.h +++ /dev/null @@ -1,652 +0,0 @@ -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * - */ - -/** - * \file - * Configuration options for uIP. - * \author Adam Dunkels - * - * This file is used for tweaking various configuration options for - * uIP. You should make a copy of this file into one of your project's - * directories instead of editing this example "uipopt.h" file that - * comes with the uIP distribution. - */ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \defgroup uipopt Configuration options for uIP - * @{ - * - * uIP is configured using the per-project configuration file - * "uipopt.h". This file contains all compile-time options for uIP and - * should be tweaked to match each specific project. The uIP - * distribution contains a documented example "uipopt.h" that can be - * copied and modified for each project. - * - * \note Contiki does not use the uipopt.h file to configure uIP, but - * uses a per-port uip-conf.h file that should be edited instead. - */ - -#ifndef UIPOPT_H_ -#define UIPOPT_H_ - -#ifndef UIP_LITTLE_ENDIAN -#define UIP_LITTLE_ENDIAN 3412 -#endif /* UIP_LITTLE_ENDIAN */ -#ifndef UIP_BIG_ENDIAN -#define UIP_BIG_ENDIAN 1234 -#endif /* UIP_BIG_ENDIAN */ - -#include "contiki.h" - -/*------------------------------------------------------------------------------*/ - -/** - * \defgroup uipoptstaticconf Static configuration options - * @{ - * - * These configuration options can be used for setting the IP address - * settings statically, but only if UIP_FIXEDADDR is set to 1. The - * configuration options for a specific node includes IP address, - * netmask and default router as well as the Ethernet address. The - * netmask, default router and Ethernet address are applicable only - * if uIP should be run over Ethernet. - * - * This options are meaningful only for the IPv4 code. - * - * All of these should be changed to suit your project. - */ - -/** - * Determines if uIP should use a fixed IP address or not. - * - * If uIP should use a fixed IP address, the settings are set in the - * uipopt.h file. If not, the macros uip_sethostaddr(), - * uip_setdraddr() and uip_setnetmask() should be used instead. - * - * \hideinitializer - */ -#define UIP_FIXEDADDR 0 - -/** - * Specifies if the uIP ARP module should be compiled with a fixed - * Ethernet MAC address or not. - * - * If this configuration option is 0, the macro uip_setethaddr() can - * be used to specify the Ethernet address at run-time. - * - * \hideinitializer - */ -#define UIP_FIXEDETHADDR 0 - -/** @} */ -/*------------------------------------------------------------------------------*/ - -/** - * \defgroup uipoptgeneral General configuration options - * @{ - */ - -/** - * The size of the uIP packet buffer. - * - * The uIP packet buffer should not be smaller than 60 bytes, and does - * not need to be larger than 1514 bytes. Lower size results in lower - * TCP throughput, larger size results in higher TCP throughput. - * - * \hideinitializer - */ -#ifndef UIP_CONF_BUFFER_SIZE -#define UIP_BUFSIZE (UIP_LINK_MTU) -#else /* UIP_CONF_BUFFER_SIZE */ -#define UIP_BUFSIZE (UIP_CONF_BUFFER_SIZE) -#endif /* UIP_CONF_BUFFER_SIZE */ - -/** - * Determines if statistics support should be compiled in. - * - * The statistics is useful for debugging and to show the user. - * - * \hideinitializer - */ -#ifndef UIP_CONF_STATISTICS -#define UIP_STATISTICS 0 -#else /* UIP_CONF_STATISTICS */ -#define UIP_STATISTICS (UIP_CONF_STATISTICS) -#endif /* UIP_CONF_STATISTICS */ - -/** - * Broadcast support. - * - * This flag configures IP broadcast support. This is useful only - * together with UDP. - * - * \hideinitializer - * - */ -#ifndef UIP_CONF_BROADCAST -#define UIP_BROADCAST 1 -#else /* UIP_CONF_BROADCAST */ -#define UIP_BROADCAST (UIP_CONF_BROADCAST) -#endif /* UIP_CONF_BROADCAST */ - -/** - * Print out a uIP log message. - * - * This function must be implemented by the module that uses uIP, and - * is called by uIP whenever a log message is generated. - */ -void uip_log(char *msg); - -/** @} */ -/*------------------------------------------------------------------------------*/ -/** - * \defgroup uipoptip IP configuration options - * @{ - * - */ -/** - * The IP TTL (time to live) of IP packets sent by uIP. - * - * This should normally not be changed. - */ -#ifdef UIP_CONF_TTL -#define UIP_TTL UIP_CONF_TTL -#else /* UIP_CONF_TTL */ -#define UIP_TTL 64 -#endif /* UIP_CONF_TTL */ - -/** - * The maximum time an IP fragment should wait in the reassembly - * buffer before it is dropped. - * - */ -#define UIP_REASS_MAXAGE 60 /*60s*/ - -/** - * Turn on support for IP packet reassembly. - * - * uIP supports reassembly of fragmented IP packets. This features - * requires an additional amount of RAM to hold the reassembly buffer - * and the reassembly code size is approximately 700 bytes. The - * reassembly buffer is of the same size as the uip_buf buffer - * (configured by UIP_BUFSIZE). - * - * \note IP packet reassembly is not heavily tested. - * - * \hideinitializer - */ -#ifdef UIP_CONF_REASSEMBLY -#define UIP_REASSEMBLY (UIP_CONF_REASSEMBLY) -#else /* UIP_CONF_REASSEMBLY */ -#define UIP_REASSEMBLY 0 -#endif /* UIP_CONF_REASSEMBLY */ -/** @} */ - -/*------------------------------------------------------------------------------*/ -/** - * \defgroup uipoptipv6 IPv6 configuration options - * @{ - * - */ - -/** The maximum transmission unit at the IP Layer*/ -#define UIP_LINK_MTU 1280 - -#ifndef UIP_CONF_IPV6_QUEUE_PKT -/** Do we do per %neighbor queuing during address resolution (default: no) */ -#define UIP_CONF_IPV6_QUEUE_PKT 0 -#endif - -#ifndef UIP_CONF_IPV6_CHECKS -/** Do we do IPv6 consistency checks (highly recommended, default: yes) */ -#define UIP_CONF_IPV6_CHECKS 1 -#endif - -#ifndef UIP_CONF_IPV6_REASSEMBLY -/** Do we do IPv6 fragmentation (default: no) */ -#define UIP_CONF_IPV6_REASSEMBLY 0 -#endif - -#ifndef UIP_CONF_NETIF_MAX_ADDRESSES -/** Default number of IPv6 addresses associated to the node's interface */ -#define UIP_CONF_NETIF_MAX_ADDRESSES 3 -#endif - -#ifndef UIP_CONF_DS6_PREFIX_NBU -/** Default number of IPv6 prefixes associated to the node's interface */ -#define UIP_CONF_DS6_PREFIX_NBU 2 -#endif - -#ifndef UIP_CONF_DS6_DEFRT_NBU -/** Minimum number of default routers */ -#define UIP_CONF_DS6_DEFRT_NBU 2 -#endif -/** @} */ - -/*------------------------------------------------------------------------------*/ -/** - * \defgroup uipoptudp UDP configuration options - * @{ - * - * \note The UDP support in uIP is still not entirely complete; there - * is no support for sending or receiving broadcast or multicast - * packets, but it works well enough to support a number of vital - * applications such as DNS queries, though - */ - -/** - * Toggles whether UDP support should be compiled in or not. - * - * \hideinitializer - */ -#ifdef UIP_CONF_UDP -#define UIP_UDP UIP_CONF_UDP -#else /* UIP_CONF_UDP */ -#define UIP_UDP 1 -#endif /* UIP_CONF_UDP */ - -/** - * Toggles if UDP checksums should be used or not. - * - * \note Support for UDP checksums is currently not included in uIP, - * so this option has no function. - * - * \hideinitializer - */ -#ifdef UIP_CONF_UDP_CHECKSUMS -#define UIP_UDP_CHECKSUMS (UIP_CONF_UDP_CHECKSUMS) -#else -#define UIP_UDP_CHECKSUMS 1 -#endif - -/** - * The maximum amount of concurrent UDP connections. - * - * \hideinitializer - */ -#ifdef UIP_CONF_UDP_CONNS -#define UIP_UDP_CONNS (UIP_CONF_UDP_CONNS) -#else /* UIP_CONF_UDP_CONNS */ -#define UIP_UDP_CONNS 10 -#endif /* UIP_CONF_UDP_CONNS */ - -/** - * The name of the function that should be called when UDP datagrams arrive. - * - * \hideinitializer - */ - - -/** @} */ -/*------------------------------------------------------------------------------*/ -/** - * \defgroup uipopttcp TCP configuration options - * @{ - */ - -/** - * Toggles whether TCP support should be compiled in or not. - * - * \hideinitializer - */ -#ifdef UIP_CONF_TCP -#define UIP_TCP (UIP_CONF_TCP) -#else /* UIP_CONF_TCP */ -#define UIP_TCP 1 -#endif /* UIP_CONF_TCP */ - -/** - * Determines if support for opening connections from uIP should be - * compiled in. - * - * If the applications that are running on top of uIP for this project - * do not need to open outgoing TCP connections, this configuration - * option can be turned off to reduce the code size of uIP. - * - * \hideinitializer - */ -#ifndef UIP_CONF_ACTIVE_OPEN -#define UIP_ACTIVE_OPEN 1 -#else /* UIP_CONF_ACTIVE_OPEN */ -#define UIP_ACTIVE_OPEN (UIP_CONF_ACTIVE_OPEN) -#endif /* UIP_CONF_ACTIVE_OPEN */ - -/** - * The maximum number of simultaneously open TCP connections. - * - * Since the TCP connections are statically allocated, turning this - * configuration knob down results in less RAM used. Each TCP - * connection requires approximately 30 bytes of memory. - * - * \hideinitializer - */ -#ifndef UIP_CONF_TCP_CONNS -#define UIP_TCP_CONNS 10 -#else /* UIP_CONF_TCP_CONNS */ -#define UIP_TCP_CONNS (UIP_CONF_TCP_CONNS) -#endif /* UIP_CONF_TCP_CONNS */ - - -/** - * The maximum number of simultaneously listening TCP ports. - * - * Each listening TCP port requires 2 bytes of memory. - * - * \hideinitializer - */ -#ifndef UIP_CONF_MAX_LISTENPORTS -#define UIP_LISTENPORTS 20 -#else /* UIP_CONF_MAX_LISTENPORTS */ -#define UIP_LISTENPORTS (UIP_CONF_MAX_LISTENPORTS) -#endif /* UIP_CONF_MAX_LISTENPORTS */ - -/** - * Determines if support for TCP urgent data notification should be - * compiled in. - * - * Urgent data (out-of-band data) is a rarely used TCP feature that - * very seldom would be required. - * - * \hideinitializer - */ -#define UIP_URGDATA 0 - -/** - * The initial retransmission timeout counted in timer pulses. - * - * This should not be changed. - */ -#define UIP_RTO 3 - -/** - * The maximum number of times a segment should be retransmitted - * before the connection should be aborted. - * - * This should not be changed. - */ -#define UIP_MAXRTX 8 - -/** - * The maximum number of times a SYN segment should be retransmitted - * before a connection request should be deemed to have been - * unsuccessful. - * - * This should not need to be changed. - */ -#define UIP_MAXSYNRTX 5 - -/** - * The TCP maximum segment size. - * - * This is should not be to set to more than - * UIP_BUFSIZE - UIP_IPTCPH_LEN. - */ -#ifdef UIP_CONF_TCP_MSS -#if UIP_CONF_TCP_MSS > (UIP_BUFSIZE - UIP_IPTCPH_LEN) -#error UIP_CONF_TCP_MSS is too large for the current UIP_BUFSIZE -#endif /* UIP_CONF_TCP_MSS > (UIP_BUFSIZE - UIP_IPTCPH_LEN) */ -#define UIP_TCP_MSS (UIP_CONF_TCP_MSS) -#else /* UIP_CONF_TCP_MSS */ -#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_IPTCPH_LEN) -#endif /* UIP_CONF_TCP_MSS */ - -/** - * The size of the advertised receiver's window. - * - * Should be set low (i.e., to the size of the uip_buf buffer) if the - * application is slow to process incoming data, or high (32768 bytes) - * if the application processes data quickly. - * - * \hideinitializer - */ -#ifndef UIP_CONF_RECEIVE_WINDOW -#define UIP_RECEIVE_WINDOW (UIP_TCP_MSS) -#else -#define UIP_RECEIVE_WINDOW (UIP_CONF_RECEIVE_WINDOW) -#endif - -/** - * How long a connection should stay in the TIME_WAIT state. - * - * This can be reduced for faster entry into power saving modes. - */ -#ifndef UIP_CONF_WAIT_TIMEOUT -#define UIP_TIME_WAIT_TIMEOUT 120 -#else -#define UIP_TIME_WAIT_TIMEOUT UIP_CONF_WAIT_TIMEOUT -#endif - -/** @} */ -/*------------------------------------------------------------------------------*/ -/** - * \defgroup uipoptarp ARP configuration options - * @{ - */ - -/** - * The size of the ARP table. - * - * This option should be set to a larger value if this uIP node will - * have many connections from the local network. - * - * \hideinitializer - */ -#ifdef UIP_CONF_ARPTAB_SIZE -#define UIP_ARPTAB_SIZE (UIP_CONF_ARPTAB_SIZE) -#else -#define UIP_ARPTAB_SIZE 8 -#endif - -/** - * The maximum age of ARP table entries measured in 10ths of seconds. - * - * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD - * default). - */ -#define UIP_ARP_MAXAGE 120 - - -/** @} */ - -/*------------------------------------------------------------------------------*/ - -/** - * \defgroup uipoptmac layer 2 options (for ipv6) - * @{ - */ - -#define UIP_DEFAULT_PREFIX_LEN 64 - -/** - * The MAC-layer transmissons limit is encapslated in "Traffic Class" field - * - * In Contiki, if the Traffic Class field in the IPv6 header has this bit set, - * the low-order bits are used as the MAC-layer transmissons limit. - */ -#define UIP_TC_MAC_TRANSMISSION_COUNTER_BIT 0x40 - -/** - * The bits in the "Traffic Class" field that describe the MAC transmission limit - */ -#define UIP_TC_MAC_TRANSMISSION_COUNTER_MASK 0x3F - -#ifdef UIP_CONF_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS -#define UIP_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS UIP_CONF_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS -#else -#define UIP_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS 0 -#endif - -/** - * This is the default value of MAC-layer transmissons for uIPv6 - * - * It means that the limit is selected by the MAC protocol instead of uIPv6. - */ -#define UIP_MAX_MAC_TRANSMISSIONS_UNDEFINED 0 - -/** @} */ - -/*------------------------------------------------------------------------------*/ - -/** - * \defgroup uipoptsics 6lowpan options (for ipv6) - * @{ - */ -/** - * Timeout for packet reassembly at the 6lowpan layer - * (should be < 60s) - */ -#ifdef SICSLOWPAN_CONF_MAXAGE -#define SICSLOWPAN_REASS_MAXAGE (SICSLOWPAN_CONF_MAXAGE) -#else -#define SICSLOWPAN_REASS_MAXAGE 8 -#endif - -/** - * Do we compress the IP header or not - */ -#ifndef SICSLOWPAN_CONF_COMPRESSION -#define SICSLOWPAN_COMPRESSION SICSLOWPAN_COMPRESSION_IPHC -#else -#define SICSLOWPAN_COMPRESSION SICSLOWPAN_CONF_COMPRESSION -#endif /* SICSLOWPAN_CONF_COMPRESSION */ - -/** - * If we use IPHC compression, how many address contexts do we support - */ -#ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS -#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1 -#endif - -/** - * Do we support 6lowpan fragmentation - */ -#ifndef SICSLOWPAN_CONF_FRAG -#define SICSLOWPAN_CONF_FRAG 1 -#endif - -/** @} */ - -/*------------------------------------------------------------------------------*/ -/** - * \defgroup uipoptcpu CPU architecture configuration - * @{ - * - * The CPU architecture configuration is where the endianess of the - * CPU on which uIP is to be run is specified. Most CPUs today are - * little endian, and the most notable exception are the Motorolas - * which are big endian. The BYTE_ORDER macro should be changed to - * reflect the CPU architecture on which uIP is to be run. - */ - -/** - * The byte order of the CPU architecture on which uIP is to be run. - * - * This option can be either UIP_BIG_ENDIAN (Motorola byte order) or - * UIP_LITTLE_ENDIAN (Intel byte order). - * - * \hideinitializer - */ -#ifdef UIP_CONF_BYTE_ORDER -#define UIP_BYTE_ORDER (UIP_CONF_BYTE_ORDER) -#else /* UIP_CONF_BYTE_ORDER */ -#define UIP_BYTE_ORDER (UIP_LITTLE_ENDIAN) -#endif /* UIP_CONF_BYTE_ORDER */ - -/** @} */ -/*------------------------------------------------------------------------------*/ - -/** - * \defgroup uipoptapp Application specific configurations - * @{ - * - * An uIP application is implemented using a single application - * function that is called by uIP whenever a TCP/IP event occurs. The - * name of this function must be registered with uIP at compile time - * using the UIP_APPCALL definition. - * - * uIP applications can store the application state within the - * uip_conn structure by specifying the type of the application - * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t. - * - * The file containing the definitions must be included in the - * uipopt.h file. - * - * The following example illustrates how this can look. - \code - - void httpd_appcall(void); - #define UIP_APPCALL httpd_appcall - - struct httpd_state { - uint8_t state; - uint16_t count; - char *dataptr; - char *script; - }; - typedef struct httpd_state uip_tcp_appstate_t - \endcode -*/ - -/** - * \var #define UIP_APPCALL - * - * The name of the application function that uIP should call in - * response to TCP/IP events. - * - */ - -/** - * \var typedef uip_tcp_appstate_t - * - * The type of the application state that is to be stored in the - * uip_conn structure. This usually is typedef:ed to a struct holding - * application state information. - */ - -/** - * \var typedef uip_udp_appstate_t - * - * The type of the application state that is to be stored in the - * uip_conn structure. This usually is typedef:ed to a struct holding - * application state information. - */ -/** @} */ - -#endif /* UIPOPT_H_ */ -/** @} */ -/** @} */ diff --git a/os/net/link-stats.c b/os/net/link-stats.c deleted file mode 100644 index c11365b9a..000000000 --- a/os/net/link-stats.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * Authors: Simon Duquennoy - */ - -#include "contiki.h" -#include "sys/clock.h" -#include "net/packetbuf.h" -#include "net/nbr-table.h" -#include "net/link-stats.h" -#include - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Link Stats" -#define LOG_LEVEL LOG_LEVEL_MAC - -/* Maximum value for the Tx count counter */ -#define TX_COUNT_MAX 32 - -/* Statistics with no update in FRESHNESS_EXPIRATION_TIMEOUT is not fresh */ -#define FRESHNESS_EXPIRATION_TIME (10 * 60 * (clock_time_t)CLOCK_SECOND) -/* Half time for the freshness counter */ -#define FRESHNESS_HALF_LIFE (15 * 60 * (clock_time_t)CLOCK_SECOND) -/* Statistics are fresh if the freshness counter is FRESHNESS_TARGET or more */ -#define FRESHNESS_TARGET 4 -/* Maximum value for the freshness counter */ -#define FRESHNESS_MAX 16 - -/* EWMA (exponential moving average) used to maintain statistics over time */ -#define EWMA_SCALE 100 -#define EWMA_ALPHA 10 -#define EWMA_BOOTSTRAP_ALPHA 25 - -/* ETX fixed point divisor. 128 is the value used by RPL (RFC 6551 and RFC 6719) */ -#define ETX_DIVISOR LINK_STATS_ETX_DIVISOR -/* In case of no-ACK, add ETX_NOACK_PENALTY to the real Tx count, as a penalty */ -#define ETX_NOACK_PENALTY 12 -/* Initial ETX value */ -#define ETX_DEFAULT 2 - -/* Per-neighbor link statistics table */ -NBR_TABLE(struct link_stats, link_stats); - -/* Called at a period of FRESHNESS_HALF_LIFE */ -struct ctimer periodic_timer; - -/*---------------------------------------------------------------------------*/ -/* Returns the neighbor's link stats */ -const struct link_stats * -link_stats_from_lladdr(const linkaddr_t *lladdr) -{ - return nbr_table_get_from_lladdr(link_stats, lladdr); -} -/*---------------------------------------------------------------------------*/ -/* Returns the neighbor's address given a link stats item */ -const linkaddr_t * -link_stats_get_lladdr(const struct link_stats *stat) -{ - return nbr_table_get_lladdr(link_stats, stat); -} -/*---------------------------------------------------------------------------*/ -/* Are the statistics fresh? */ -int -link_stats_is_fresh(const struct link_stats *stats) -{ - return (stats != NULL) - && clock_time() - stats->last_tx_time < FRESHNESS_EXPIRATION_TIME - && stats->freshness >= FRESHNESS_TARGET; -} -/*---------------------------------------------------------------------------*/ -#if LINK_STATS_INIT_ETX_FROM_RSSI -uint16_t -guess_etx_from_rssi(const struct link_stats *stats) -{ - if(stats != NULL) { - if(stats->rssi == 0) { - return ETX_DEFAULT * ETX_DIVISOR; - } else { - /* A rough estimate of PRR from RSSI, as a linear function where: - * RSSI >= -60 results in PRR of 1 - * RSSI <= -90 results in PRR of 0 - * prr = (bounded_rssi - RSSI_LOW) / (RSSI_DIFF) - * etx = ETX_DIVOSOR / ((bounded_rssi - RSSI_LOW) / RSSI_DIFF) - * etx = (RSSI_DIFF * ETX_DIVOSOR) / (bounded_rssi - RSSI_LOW) - * */ -#define ETX_INIT_MAX 3 -#define RSSI_HIGH -60 -#define RSSI_LOW -90 -#define RSSI_DIFF (RSSI_HIGH - RSSI_LOW) - uint16_t etx; - int16_t bounded_rssi = stats->rssi; - bounded_rssi = MIN(bounded_rssi, RSSI_HIGH); - bounded_rssi = MAX(bounded_rssi, RSSI_LOW + 1); - etx = RSSI_DIFF * ETX_DIVISOR / (bounded_rssi - RSSI_LOW); - return MIN(etx, ETX_INIT_MAX * ETX_DIVISOR); - } - } - return 0xffff; -} -#endif /* LINK_STATS_INIT_ETX_FROM_RSSI */ -/*---------------------------------------------------------------------------*/ -/* Packet sent callback. Updates stats for transmissions to lladdr */ -void -link_stats_packet_sent(const linkaddr_t *lladdr, int status, int numtx) -{ - struct link_stats *stats; -#if !LINK_STATS_ETX_FROM_PACKET_COUNT - uint16_t packet_etx; - uint8_t ewma_alpha; -#endif /* !LINK_STATS_ETX_FROM_PACKET_COUNT */ - - if(status != MAC_TX_OK && status != MAC_TX_NOACK) { - /* Do not penalize the ETX when collisions or transmission errors occur. */ - return; - } - - stats = nbr_table_get_from_lladdr(link_stats, lladdr); - if(stats == NULL) { - /* Add the neighbor */ - stats = nbr_table_add_lladdr(link_stats, lladdr, NBR_TABLE_REASON_LINK_STATS, NULL); - if(stats != NULL) { -#if LINK_STATS_INIT_ETX_FROM_RSSI - stats->etx = guess_etx_from_rssi(stats); -#else /* LINK_STATS_INIT_ETX_FROM_RSSI */ - stats->etx = ETX_DEFAULT * ETX_DIVISOR; -#endif /* LINK_STATS_INIT_ETX_FROM_RSSI */ - } else { - return; /* No space left, return */ - } - } - - /* Update last timestamp and freshness */ - stats->last_tx_time = clock_time(); - stats->freshness = MIN(stats->freshness + numtx, FRESHNESS_MAX); - -#if LINK_STATS_PACKET_COUNTERS - /* Update paket counters */ - stats->cnt_current.num_packets_tx += numtx; - if(status == MAC_TX_OK) { - stats->cnt_current.num_packets_acked++; - } -#endif - - /* Add penalty in case of no-ACK */ - if(status == MAC_TX_NOACK) { - numtx += ETX_NOACK_PENALTY; - } - -#if LINK_STATS_ETX_FROM_PACKET_COUNT - /* Compute ETX from packet and ACK count */ - /* Halve both counter after TX_COUNT_MAX */ - if(stats->tx_count + numtx > TX_COUNT_MAX) { - stats->tx_count /= 2; - stats->ack_count /= 2; - } - /* Update tx_count and ack_count */ - stats->tx_count += numtx; - if(status == MAC_TX_OK) { - stats->ack_count++; - } - /* Compute ETX */ - if(stats->ack_count > 0) { - stats->etx = ((uint16_t)stats->tx_count * ETX_DIVISOR) / stats->ack_count; - } else { - stats->etx = (uint16_t)MAX(ETX_NOACK_PENALTY, stats->tx_count) * ETX_DIVISOR; - } -#else /* LINK_STATS_ETX_FROM_PACKET_COUNT */ - /* Compute ETX using an EWMA */ - - /* ETX used for this update */ - packet_etx = numtx * ETX_DIVISOR; - /* ETX alpha used for this update */ - ewma_alpha = link_stats_is_fresh(stats) ? EWMA_ALPHA : EWMA_BOOTSTRAP_ALPHA; - - /* Compute EWMA and update ETX */ - stats->etx = ((uint32_t)stats->etx * (EWMA_SCALE - ewma_alpha) + - (uint32_t)packet_etx * ewma_alpha) / EWMA_SCALE; -#endif /* LINK_STATS_ETX_FROM_PACKET_COUNT */ -} -/*---------------------------------------------------------------------------*/ -/* Packet input callback. Updates statistics for receptions on a given link */ -void -link_stats_input_callback(const linkaddr_t *lladdr) -{ - struct link_stats *stats; - int16_t packet_rssi = packetbuf_attr(PACKETBUF_ATTR_RSSI); - - stats = nbr_table_get_from_lladdr(link_stats, lladdr); - if(stats == NULL) { - /* Add the neighbor */ - stats = nbr_table_add_lladdr(link_stats, lladdr, NBR_TABLE_REASON_LINK_STATS, NULL); - if(stats != NULL) { - /* Initialize */ - stats->rssi = packet_rssi; -#if LINK_STATS_INIT_ETX_FROM_RSSI - stats->etx = guess_etx_from_rssi(stats); -#else /* LINK_STATS_INIT_ETX_FROM_RSSI */ - stats->etx = ETX_DEFAULT * ETX_DIVISOR; -#endif /* LINK_STATS_INIT_ETX_FROM_RSSI */ - } - return; - } - - /* Update RSSI EWMA */ - stats->rssi = ((int32_t)stats->rssi * (EWMA_SCALE - EWMA_ALPHA) + - (int32_t)packet_rssi * EWMA_ALPHA) / EWMA_SCALE; - -#if LINK_STATS_PACKET_COUNTERS - stats->cnt_current.num_packets_rx++; -#endif -} -/*---------------------------------------------------------------------------*/ -#if LINK_STATS_PACKET_COUNTERS -/*---------------------------------------------------------------------------*/ -static void -print_and_update_counters(void) -{ - struct link_stats *stats; - - for(stats = nbr_table_head(link_stats); stats != NULL; - stats = nbr_table_next(link_stats, stats)) { - - struct link_packet_counter *c = &stats->cnt_current; - - LOG_INFO("num packets: tx=%u ack=%u rx=%u to=", - c->num_packets_tx, c->num_packets_acked, c->num_packets_rx); - LOG_INFO_LLADDR(link_stats_get_lladdr(stats)); - LOG_INFO_("\n"); - - stats->cnt_total.num_packets_tx += stats->cnt_current.num_packets_tx; - stats->cnt_total.num_packets_acked += stats->cnt_current.num_packets_acked; - stats->cnt_total.num_packets_rx += stats->cnt_current.num_packets_rx; - memset(&stats->cnt_current, 0, sizeof(stats->cnt_current)); - } -} -/*---------------------------------------------------------------------------*/ -#endif /* LINK_STATS_PACKET_COUNTERS */ -/*---------------------------------------------------------------------------*/ -/* Periodic timer called at a period of FRESHNESS_HALF_LIFE */ -static void -periodic(void *ptr) -{ - /* Age (by halving) freshness counter of all neighbors */ - struct link_stats *stats; - ctimer_reset(&periodic_timer); - for(stats = nbr_table_head(link_stats); stats != NULL; stats = nbr_table_next(link_stats, stats)) { - stats->freshness >>= 1; - } - -#if LINK_STATS_PACKET_COUNTERS - print_and_update_counters(); -#endif -} -/*---------------------------------------------------------------------------*/ -/* Resets link-stats module */ -void -link_stats_reset(void) -{ - struct link_stats *stats; - stats = nbr_table_head(link_stats); - while(stats != NULL) { - nbr_table_remove(link_stats, stats); - stats = nbr_table_next(link_stats, stats); - } -} -/*---------------------------------------------------------------------------*/ -/* Initializes link-stats module */ -void -link_stats_init(void) -{ - nbr_table_register(link_stats, NULL); - ctimer_set(&periodic_timer, FRESHNESS_HALF_LIFE, periodic, NULL); -} diff --git a/os/net/link-stats.h b/os/net/link-stats.h deleted file mode 100644 index 51f1d285b..000000000 --- a/os/net/link-stats.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * Authors: Simon Duquennoy - */ - -#ifndef LINK_STATS_H_ -#define LINK_STATS_H_ - -#include "net/linkaddr.h" - -/* ETX fixed point divisor. 128 is the value used by RPL (RFC 6551 and RFC 6719) */ -#ifdef LINK_STATS_CONF_ETX_DIVISOR -#define LINK_STATS_ETX_DIVISOR LINK_STATS_CONF_ETX_DIVISOR -#else /* LINK_STATS_CONF_ETX_DIVISOR */ -#define LINK_STATS_ETX_DIVISOR 128 -#endif /* LINK_STATS_CONF_ETX_DIVISOR */ - -/* Option to infer the initial ETX from the RSSI of previously received packets. */ -#ifdef LINK_STATS_CONF_INIT_ETX_FROM_RSSI -#define LINK_STATS_INIT_ETX_FROM_RSSI LINK_STATS_CONF_INIT_ETX_FROM_RSSI -#else /* LINK_STATS_CONF_INIT_ETX_FROM_RSSI */ -#define LINK_STATS_INIT_ETX_FROM_RSSI 1 -#endif /* LINK_STATS_CONF_INIT_ETX_FROM_RSSI */ - -/* Option to use packet and ACK count for ETX estimation, instead of EWMA */ -#ifdef LINK_STATS_CONF_ETX_FROM_PACKET_COUNT -#define LINK_STATS_ETX_FROM_PACKET_COUNT LINK_STATS_CONF_ETX_FROM_PACKET_COUNT -#else /* LINK_STATS_CONF_ETX_FROM_PACKET_COUNT */ -#define LINK_STATS_ETX_FROM_PACKET_COUNT 0 -#endif /* LINK_STATS_ETX_FROM_PACKET_COUNT */ - -/* Store and periodically print packet counters? */ -#ifdef LINK_STATS_CONF_PACKET_COUNTERS -#define LINK_STATS_PACKET_COUNTERS LINK_STATS_CONF_PACKET_COUNTERS -#else /* LINK_STATS_CONF_PACKET_COUNTERS */ -#define LINK_STATS_PACKET_COUNTERS 0 -#endif /* LINK_STATS_PACKET_COUNTERS */ - -typedef uint16_t link_packet_stat_t; - -struct link_packet_counter { - /* total attempts to transmit unicast packets */ - link_packet_stat_t num_packets_tx; - /* total ACKs for unicast packets */ - link_packet_stat_t num_packets_acked; - /* total number of unicast and broadcast packets received */ - link_packet_stat_t num_packets_rx; -}; - - -/* All statistics of a given link */ -struct link_stats { - clock_time_t last_tx_time; /* Last Tx timestamp */ - uint16_t etx; /* ETX using ETX_DIVISOR as fixed point divisor */ - int16_t rssi; /* RSSI (received signal strength) */ - uint8_t freshness; /* Freshness of the statistics */ -#if LINK_STATS_ETX_FROM_PACKET_COUNT - uint8_t tx_count; /* Tx count, used for ETX calculation */ - uint8_t ack_count; /* ACK count, used for ETX calculation */ -#endif /* LINK_STATS_ETX_FROM_PACKET_COUNT */ - -#if LINK_STATS_PACKET_COUNTERS - struct link_packet_counter cnt_current; /* packets in the current period */ - struct link_packet_counter cnt_total; /* packets in total */ -#endif -}; - -/* Returns the neighbor's link statistics */ -const struct link_stats *link_stats_from_lladdr(const linkaddr_t *lladdr); -/* Returns the address of the neighbor */ -const linkaddr_t *link_stats_get_lladdr(const struct link_stats *); -/* Are the statistics fresh? */ -int link_stats_is_fresh(const struct link_stats *stats); -/* Resets link-stats module */ -void link_stats_reset(void); -/* Initializes link-stats module */ -void link_stats_init(void); -/* Packet sent callback. Updates statistics for transmissions on a given link */ -void link_stats_packet_sent(const linkaddr_t *lladdr, int status, int numtx); -/* Packet input callback. Updates statistics for receptions on a given link */ -void link_stats_input_callback(const linkaddr_t *lladdr); - -#endif /* LINK_STATS_H_ */ diff --git a/os/net/linkaddr.c b/os/net/linkaddr.c deleted file mode 100644 index c63f08135..000000000 --- a/os/net/linkaddr.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Functions for manipulating link-layer addresses - * \author - * Adam Dunkels - */ - -/** - * \addtogroup linkaddr - * @{ - */ - -#include "net/linkaddr.h" -#include - -linkaddr_t linkaddr_node_addr; -#if LINKADDR_SIZE == 2 -const linkaddr_t linkaddr_null = { { 0, 0 } }; -#else /*LINKADDR_SIZE == 2*/ -#if LINKADDR_SIZE == 8 -const linkaddr_t linkaddr_null = { { 0, 0, 0, 0, 0, 0, 0, 0 } }; -#endif /*LINKADDR_SIZE == 8*/ -#if LINKADDR_SIZE == 6 -const linkaddr_t linkaddr_null = { { 0, 0, 0, 0, 0, 0 } }; -#endif /*LINKADDR_SIZE == 6*/ -#endif /*LINKADDR_SIZE == 2*/ - - -/*---------------------------------------------------------------------------*/ -void -linkaddr_copy(linkaddr_t *dest, const linkaddr_t *src) -{ - memcpy(dest, src, LINKADDR_SIZE); -} -/*---------------------------------------------------------------------------*/ -int -linkaddr_cmp(const linkaddr_t *addr1, const linkaddr_t *addr2) -{ - return (memcmp(addr1, addr2, LINKADDR_SIZE) == 0); -} -/*---------------------------------------------------------------------------*/ -void -linkaddr_set_node_addr(linkaddr_t *t) -{ - linkaddr_copy(&linkaddr_node_addr, t); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/linkaddr.h b/os/net/linkaddr.h deleted file mode 100644 index 7926550b1..000000000 --- a/os/net/linkaddr.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the link-layer address representation - * \author - * Adam Dunkels - */ - -/** - * \addtogroup link-layer - * @{ - */ - -/** - * \defgroup linkaddr Link-layer addresses - * @{ - * - * The linkaddr module handles link-layer addresses. - * - */ - -#ifndef LINKADDR_H_ -#define LINKADDR_H_ - -#include "contiki.h" - -#ifdef LINKADDR_CONF_SIZE -#define LINKADDR_SIZE LINKADDR_CONF_SIZE -#else /* LINKADDR_SIZE */ -#define LINKADDR_SIZE 8 -#endif /* LINKADDR_SIZE */ - -typedef union { - unsigned char u8[LINKADDR_SIZE]; -#if LINKADDR_SIZE == 2 - uint16_t u16; -#else - uint16_t u16[LINKADDR_SIZE/2]; -#endif /* LINKADDR_SIZE == 2 */ -} linkaddr_t; - -/** - * \brief Copy a link-layer address - * \param dest The destination - * \param from The source - * - * This function copies a link-layer address from one location - * to another. - * - */ -void linkaddr_copy(linkaddr_t *dest, const linkaddr_t *from); - -/** - * \brief Compare two link-layer addresses - * \param addr1 The first address - * \param addr2 The second address - * \return Non-zero if the addresses are the same, zero if they are different - * - * This function compares two link-layer addresses and returns - * the result of the comparison. The function acts like - * the '==' operator and returns non-zero if the addresses - * are the same, and zero if the addresses are different. - * - */ -int linkaddr_cmp(const linkaddr_t *addr1, const linkaddr_t *addr2); - - -/** - * \brief Set the address of the current node - * \param addr The address - * - * This function sets the link-layer address of the node. - * - */ -void linkaddr_set_node_addr(linkaddr_t *addr); - -/** - * \brief The link-layer address of the node - * - * This variable contains the link-layer address of the - * node. This variable should not be changed directly; - * rather, the linkaddr_set_node_addr() function should be - * used. - * - */ -extern linkaddr_t linkaddr_node_addr; - -/** - * \brief The null link-layer address - * - * This variable contains the null link-layer address. The null - * address is used in route tables to indicate that the - * table entry is unused. Nodes with no configured address - * has the null address. Nodes with their node address set - * to the null address will have problems communicating - * with other nodes. - * - */ -extern const linkaddr_t linkaddr_null; - -#endif /* LINKADDR_H_ */ -/** @} */ -/** @} */ diff --git a/os/net/mac/ble/ble-l2cap.c b/os/net/mac/ble/ble-l2cap.c deleted file mode 100644 index fb755cc85..000000000 --- a/os/net/mac/ble/ble-l2cap.c +++ /dev/null @@ -1,596 +0,0 @@ -/* - * Copyright (c) 2017, Graz University of Technology - * 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 - * MAC layer that implements BLE L2CAP credit-based flow control - * channels to support IPv6 over BLE (RFC 7668) - * - * \author - * Michael Spoerk - */ -/*---------------------------------------------------------------------------*/ - -#include "net/mac/ble/ble-l2cap.h" - -#include "net/packetbuf.h" -#include "net/netstack.h" -#include "lib/memb.h" -#include "lib/list.h" - -#include - -#include "../../../dev/ble-hal.h" -/*---------------------------------------------------------------------------*/ -#include "sys/log.h" -#define LOG_MODULE "L2CAP" -#define LOG_LEVEL LOG_LEVEL_MAC -/*---------------------------------------------------------------------------*/ -#define MS_TO_CLOCK_SECONDS(X) ((int)(((double)((X)*CLOCK_SECOND)) / 1000.0)) -/*---------------------------------------------------------------------------*/ -/* BLE controller */ -/* public device address of BLE controller */ -static uint8_t ble_addr[BLE_ADDR_SIZE]; -/*---------------------------------------------------------------------------*/ -/* L2CAP fragmentation buffers and utilities */ -typedef struct { - /* L2CAP Service Data Unit (SDU) (= packet data)*/ - uint8_t sdu[BLE_L2CAP_NODE_MTU]; - /* length of the L2CAP SDU */ - uint16_t sdu_length; - /* index of the first byte not sent yet */ - uint16_t current_index; -} l2cap_buffer_t; -/*---------------------------------------------------------------------------*/ -typedef struct { - uint16_t cid; - uint16_t mtu; - uint16_t mps; - uint16_t credits; -} ble_mac_l2cap_channel_t; -/*---------------------------------------------------------------------------*/ -typedef struct { - ble_mac_l2cap_channel_t channel_own; - ble_mac_l2cap_channel_t channel_peer; - l2cap_buffer_t tx_buffer; - l2cap_buffer_t rx_buffer; - linkaddr_t peer_addr; -} l2cap_channel_t; - -static uint8_t l2cap_channel_count; -static l2cap_channel_t l2cap_channels[L2CAP_CHANNELS]; -static process_event_t l2cap_tx_event; -/*---------------------------------------------------------------------------*/ -static l2cap_channel_t * -get_channel_for_addr(const linkaddr_t *peer_addr) -{ - uint8_t i; - l2cap_channel_t *channel; - for(i = 0; i < l2cap_channel_count; i++) { - channel = &l2cap_channels[i]; - if(linkaddr_cmp(peer_addr, &channel->peer_addr) != 0) { - return channel; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static l2cap_channel_t * -get_channel_for_cid(uint16_t own_cid) -{ - uint8_t i = own_cid - L2CAP_FLOW_CHANNEL; - if(i >= 0 && i < l2cap_channel_count) { - return &l2cap_channels[own_cid - L2CAP_FLOW_CHANNEL]; - } else { - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -PROCESS(ble_l2cap_tx_process, "BLE L2CAP TX process"); -/*---------------------------------------------------------------------------*/ -static uint8_t -init_adv_data(char *adv_data) -{ - uint8_t adv_data_len = 0; - memset(adv_data, 0x00, BLE_ADV_DATA_LEN); - /* BLE flags */ - adv_data[adv_data_len++] = 2; - adv_data[adv_data_len++] = 0x01; - adv_data[adv_data_len++] = 0x05; /* LE limited (no BR/EDR support) */ - /* TX power level */ - adv_data[adv_data_len++] = 2; - adv_data[adv_data_len++] = 0x0A; - adv_data[adv_data_len++] = 0; /* 0 dBm */ - /* service UUIDs (16-bit identifiers) */ - adv_data[adv_data_len++] = 3; - adv_data[adv_data_len++] = 0x03; - adv_data[adv_data_len++] = 0x20; - adv_data[adv_data_len++] = 0x18; /* only IP support service exposed */ - /* service UUIDs (32-bit identifiers) */ - adv_data[adv_data_len++] = 1; - adv_data[adv_data_len++] = 0x05; /* empty list */ - /* service UUIDs (128-bit identifiers) */ - adv_data[adv_data_len++] = 1; - adv_data[adv_data_len++] = 0x07; /* empty list */ - return adv_data_len; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -init_scan_resp_data(char *scan_resp_data) -{ - uint8_t scan_resp_data_len = 0; - memset(scan_resp_data, 0x00, BLE_SCAN_RESP_DATA_LEN); - /* complete device name */ - scan_resp_data[scan_resp_data_len++] = 1 + strlen(BLE_DEVICE_NAME); - scan_resp_data[scan_resp_data_len++] = 0x09; - memcpy(&scan_resp_data[scan_resp_data_len], - BLE_DEVICE_NAME, strlen(BLE_DEVICE_NAME)); - scan_resp_data_len += strlen(BLE_DEVICE_NAME); - /* slave connection interval range */ - scan_resp_data[scan_resp_data_len++] = 5; - scan_resp_data[scan_resp_data_len++] = 0x12; - scan_resp_data[scan_resp_data_len++] = (BLE_SLAVE_CONN_INTERVAL_MIN & 0xFF); - scan_resp_data[scan_resp_data_len++] = ((BLE_SLAVE_CONN_INTERVAL_MIN >> 8) & 0xFF); - scan_resp_data[scan_resp_data_len++] = (BLE_SLAVE_CONN_INTERVAL_MAX & 0xFF); - scan_resp_data[scan_resp_data_len++] = ((BLE_SLAVE_CONN_INTERVAL_MAX >> 8) & 0xFF); - - return scan_resp_data_len; -} -/*---------------------------------------------------------------------------*/ -void -input_l2cap_conn_req(uint8_t *data) -{ - uint8_t identifier = data[0]; - uint16_t len; - uint16_t le_psm; - uint8_t resp_data[18]; - l2cap_channel_t *channel; - - memcpy(&len, &data[1], 2); - - if(len != 10) { - LOG_WARN("l2cap_conn_req: invalid len: %d\n", len); - return; - } - - /* create a new L2CAP connection because of this request */ - if(l2cap_channel_count >= L2CAP_CHANNELS) { - LOG_WARN("l2cap_conn_req: maximum supported L2CAP channels reached\n"); - return; - } - - channel = &l2cap_channels[l2cap_channel_count]; - /* parse L2CAP connection data */ - memcpy(&le_psm, &data[3], 2); - memset(&channel->channel_peer, 0x00, sizeof(ble_mac_l2cap_channel_t)); - memcpy(&channel->channel_peer.cid, &data[5], 2); - memcpy(&channel->channel_peer.mtu, &data[7], 2); - memcpy(&channel->channel_peer.mps, &data[9], 2); - memcpy(&channel->channel_peer.credits, &data[11], 2); - linkaddr_copy(&channel->peer_addr, packetbuf_addr(PACKETBUF_ADDR_SENDER)); - - LOG_INFO("recv CONN_REQ (MTU: %4d, MPS: %4d, credits: %4d)\n", - channel->channel_peer.mtu, channel->channel_peer.mps, channel->channel_peer.credits); - - l2cap_channel_count++; - - /* create L2CAP connection response */ - /* length */ - resp_data[0] = 0x0E; - resp_data[1] = 0x00; - /* channel ID */ - resp_data[2] = 0x05; - resp_data[3] = 0x00; - /* code */ - resp_data[4] = L2CAP_CODE_CONN_RSP; - /* identifier */ - resp_data[5] = identifier; - /* cmd length */ - resp_data[6] = 0x0A; - resp_data[7] = 0x00; - /* node channel information */ - memcpy(&resp_data[8], &channel->channel_own.cid, 2); - memcpy(&resp_data[10], &channel->channel_own.mtu, 2); - memcpy(&resp_data[12], &channel->channel_own.mps, 2); - memcpy(&resp_data[14], &channel->channel_own.credits, 2); - /* result */ - memset(&resp_data[16], 0x00, 2); - - packetbuf_copyfrom((void *)resp_data, 18); - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &channel->peer_addr); - NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen()); -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - uint8_t i; - l2cap_tx_event = process_alloc_event(); - LOG_DBG("init()\n"); - /* initialize the L2CAP connection parameter */ - for(i = 0; i < L2CAP_CHANNELS; i++) { - l2cap_channels[i].channel_own.cid = L2CAP_FLOW_CHANNEL + i; - l2cap_channels[i].channel_own.credits = L2CAP_CREDIT_NEW; - l2cap_channels[i].channel_own.mps = (BLE_L2CAP_NODE_FRAG_LEN - L2CAP_SUBSEQ_HEADER_SIZE); - l2cap_channels[i].channel_own.mtu = BLE_L2CAP_NODE_MTU; - } - - /* Initialize the BLE controller */ - NETSTACK_RADIO.init(); - NETSTACK_RADIO.get_object(RADIO_CONST_BLE_BD_ADDR, &ble_addr, BLE_ADDR_SIZE); - - uint8_t adv_data_len, scan_resp_data_len; - char adv_data[BLE_ADV_DATA_LEN]; - char scan_resp_data[BLE_SCAN_RESP_DATA_LEN]; - /* set the advertisement parameter */ - NETSTACK_RADIO.set_value(RADIO_PARAM_BLE_ADV_INTERVAL, BLE_ADV_INTERVAL); - NETSTACK_RADIO.set_value(RADIO_PARAM_BLE_ADV_TYPE, BLE_ADV_DIR_IND_LDC); - NETSTACK_RADIO.set_value(RADIO_PARAM_BLE_ADV_OWN_ADDR_TYPE, BLE_ADDR_TYPE_PUBLIC); - NETSTACK_RADIO.set_value(RADIO_PARAM_BLE_ADV_CHANNEL_MAP, 0x01); - - adv_data_len = init_adv_data(adv_data); - scan_resp_data_len = init_scan_resp_data(scan_resp_data); - - /* set advertisement payload & scan response */ - NETSTACK_RADIO.set_object(RADIO_PARAM_BLE_ADV_PAYLOAD, adv_data, adv_data_len); - NETSTACK_RADIO.set_object(RADIO_PARAM_BLE_ADV_SCAN_RESPONSE, scan_resp_data, scan_resp_data_len); - - /* enable advertisement */ - NETSTACK_RADIO.set_value(RADIO_PARAM_BLE_ADV_ENABLE, 1); - - NETSTACK_MAC.on(); -} -/*---------------------------------------------------------------------------*/ -static uint16_t -check_own_l2cap_credits(l2cap_channel_t *channel) -{ - uint16_t credits_new = 0; - uint16_t credits_current; - - credits_current = channel->channel_own.credits; - if(credits_current < L2CAP_CREDIT_THRESHOLD) { - credits_new = L2CAP_CREDIT_NEW; - } - LOG_DBG("check for new credits: current credits: %2d, new credits: %2d\n", credits_current, credits_new); - return credits_new; -} -/*---------------------------------------------------------------------------*/ -static void -send_l2cap_credit(l2cap_channel_t *channel, uint16_t credits) -{ - uint8_t len = 4; - uint8_t data[12]; - /* create L2CAP credit */ - /* length */ - data[0] = len + 4; - data[1] = 0x00; - /* channel ID */ - data[2] = 0x05; - data[3] = 0x00; - /* code */ - data[4] = L2CAP_CODE_CREDIT; - /* identifier */ - data[5] = 0xFF; - /* cmd length */ - data[6] = len; - data[7] = 0x00; - - memcpy(&data[8], &channel->channel_own.cid, 2); - data[10] = credits & 0xFF; - data[11] = credits >> 8; - - channel->channel_own.credits += credits; - - packetbuf_copyfrom((void *)data, len + 8); - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &channel->peer_addr); - NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen()); -} -/*---------------------------------------------------------------------------*/ -static void -send(mac_callback_t sent_callback, void *ptr) -{ - uint8_t i; - l2cap_channel_t *channel; - uint16_t data_len = packetbuf_datalen(); - LOG_DBG("send %d\n", data_len); - - /* packet is too long */ - if(data_len > BLE_L2CAP_NODE_MTU) { - LOG_WARN("send message is too long\n"); - mac_call_sent_callback(sent_callback, ptr, MAC_TX_ERR, 0); - return; - } - - for(i = 0; i < l2cap_channel_count; i++) { - channel = &l2cap_channels[i]; - if((linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null) != 0) - || (linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &channel->peer_addr) != 0)) { - if(channel->tx_buffer.sdu_length > 0) { - LOG_WARN("send() another L2CAP message active (trying to send %4d bytes)\n", data_len); - mac_call_sent_callback(sent_callback, ptr, MAC_TX_COLLISION, 0); - return; - } - LOG_DBG("send() adding to L2CAP CID: %2d\n", channel->channel_own.cid); - channel->tx_buffer.sdu_length = data_len; - if(channel->tx_buffer.sdu_length > 0) { - memcpy(&channel->tx_buffer.sdu, packetbuf_dataptr(), data_len); - mac_call_sent_callback(sent_callback, ptr, MAC_TX_DEFERRED, 1); - process_post(&ble_l2cap_tx_process, l2cap_tx_event, (void *)channel); - } - } - } -} -/*---------------------------------------------------------------------------*/ -void -input_l2cap_connection_udate_resp(uint8_t *data) -{ - uint16_t len; - uint16_t result; - - memcpy(&len, &data[1], 2); - - if(len != 2) { - LOG_WARN("input_l2cap_connection_update_resp: invalid len: %d\n", len); - return; - } - - memcpy(&result, &data[3], 2); - if(result != 0x0000) { - LOG_WARN("input_l2cap_connection_update_resp: result: 0x%04X\n", result); - return; - } -} -/*---------------------------------------------------------------------------*/ -void -input_l2cap_credit(uint8_t *data) -{ - uint16_t len; - uint16_t cid; - uint16_t credits; - l2cap_channel_t *channel = get_channel_for_addr(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - -/* uint8_t identifier = data[0]; */ - memcpy(&len, &data[1], 2); - - if(len != 4) { - LOG_WARN("process_l2cap_credit: invalid len: %d\n", len); - return; - } - - /* parse L2CAP credit data */ - memcpy(&cid, &data[3], 2); - memcpy(&credits, &data[5], 2); - - channel->channel_peer.credits += credits; -} -/*---------------------------------------------------------------------------*/ -static void -input_l2cap_frame_signal_channel(uint8_t *data, uint8_t data_len) -{ - if(data[4] == L2CAP_CODE_CREDIT) { - input_l2cap_credit(&data[5]); - } else if(data[4] == L2CAP_CODE_CONN_REQ) { - input_l2cap_conn_req(&data[5]); - } else if(data[4] == L2CAP_CODE_CONN_UPDATE_RSP) { - input_l2cap_connection_udate_resp(&data[5]); - } else { - LOG_WARN("l2cap_frame_signal_channel: unknown signal channel code: %d\n", data[4]); - } -} -/*---------------------------------------------------------------------------*/ -static void -input_l2cap_frame_flow_channel(l2cap_channel_t *channel, uint8_t *data, uint16_t data_len) -{ - uint16_t frame_len; - uint16_t payload_len; - - if(data_len < 4) { - LOG_WARN("l2cap_frame: illegal L2CAP frame data_len: %d\n", data_len); - /* a L2CAP frame has a minimum length of 4 */ - return; - } - - if(channel->rx_buffer.sdu_length == 0) { - /* handle first fragment */ - memcpy(&frame_len, &data[0], 2); - memcpy(&channel->rx_buffer.sdu_length, &data[4], 2); - payload_len = frame_len - 2; - - memcpy(channel->rx_buffer.sdu, &data[6], payload_len); - channel->rx_buffer.current_index = payload_len; - } else { - /* subsequent fragment */ - memcpy(&frame_len, &data[0], 2); - payload_len = frame_len; - - memcpy(&channel->rx_buffer.sdu[channel->rx_buffer.current_index], &data[4], payload_len); - channel->rx_buffer.current_index += payload_len; - } - - if((channel->rx_buffer.sdu_length > 0) && - (channel->rx_buffer.sdu_length == channel->rx_buffer.current_index)) { - /* do not use packetbuf_copyfrom here because the packetbuf_attr - * must not be cleared */ - memcpy(packetbuf_dataptr(), channel->rx_buffer.sdu, channel->rx_buffer.sdu_length); - packetbuf_set_datalen(channel->rx_buffer.sdu_length); - NETSTACK_NETWORK.input(); - - /* reset counters */ - channel->rx_buffer.sdu_length = 0; - channel->rx_buffer.current_index = 0; - } -} -/*---------------------------------------------------------------------------*/ -static void -input(void) -{ - uint8_t *data = (uint8_t *)packetbuf_dataptr(); - uint16_t len = packetbuf_datalen(); - uint8_t frame_type = packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE); - uint16_t channel_id; - l2cap_channel_t *channel; - uint16_t credits; - - if(frame_type == FRAME_BLE_RX_EVENT) { - memcpy(&channel_id, &data[2], 2); - channel = get_channel_for_cid(channel_id); - LOG_DBG("input %d bytes\n", len); - if(channel_id == L2CAP_SIGNAL_CHANNEL) { - input_l2cap_frame_signal_channel(data, len); - } else if(channel == NULL) { - LOG_WARN("input (RX_EVENT): no channel found for CID: %d\n", channel_id); - return; - } else { - input_l2cap_frame_flow_channel(channel, data, len); - channel->channel_own.credits--; - credits = check_own_l2cap_credits(channel); - if(credits > 0) { - send_l2cap_credit(channel, credits); - } - } - } - /* check if there are still fragments left to be transmitted */ - if(frame_type == FRAME_BLE_TX_EVENT) { - channel = get_channel_for_addr(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - if(channel == NULL) { - LOG_WARN("input (TX_EVENT): no channel found for CID: %d\n", channel_id); - } else if(channel->tx_buffer.sdu_length > 0) { - process_post(&ble_l2cap_tx_process, l2cap_tx_event, (void *)channel); - } - } -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - LOG_DBG("on()\n"); - process_start(&ble_l2cap_tx_process, NULL); - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - LOG_DBG("off()\n"); - process_exit(&ble_l2cap_tx_process); - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -max_payload(void) -{ - return BLE_L2CAP_NODE_MTU; -} -/*---------------------------------------------------------------------------*/ -const struct mac_driver ble_l2cap_driver = { - "ble-l2cap", - init, - send, - input, - on, - off, - max_payload, -}; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ble_l2cap_tx_process, ev, data) -{ - uint16_t data_len; - uint16_t frame_len; - uint16_t num_buffer; - l2cap_channel_t *channel = (l2cap_channel_t *)data; - uint8_t first_fragment; - uint16_t used_mps; - uint16_t credits; - - PROCESS_BEGIN(); - LOG_DBG("starting ble_mac_tx_process\n"); - - while(1) { - PROCESS_YIELD_UNTIL(ev == l2cap_tx_event); - if(channel != NULL) { - NETSTACK_RADIO.get_value(RADIO_CONST_BLE_BUFFER_AMOUNT, (radio_value_t *)&num_buffer); - first_fragment = (channel->tx_buffer.current_index == 0); - used_mps = MIN(channel->channel_own.mps, channel->channel_peer.mps); - credits = channel->channel_peer.credits; - - LOG_DBG("process: sending - first: %d, used_mps: %3d, num_buffers: %2d, credits: %2d\n", - first_fragment, used_mps, num_buffer, credits); - if((channel->tx_buffer.sdu_length > 0) && (num_buffer > 0) && (credits > 0)) { - packetbuf_clear(); - if(first_fragment) { - packetbuf_hdralloc(L2CAP_FIRST_HEADER_SIZE); - used_mps -= L2CAP_FIRST_HEADER_SIZE; - data_len = MIN(channel->tx_buffer.sdu_length, used_mps); - frame_len = data_len + 2; - - /* set L2CAP header fields */ - memcpy(packetbuf_hdrptr(), &frame_len, 2); /* fragment size */ - memcpy(packetbuf_hdrptr() + 2, &channel->channel_peer.cid, 2); /* L2CAP channel id*/ - memcpy(packetbuf_hdrptr() + 4, &channel->tx_buffer.sdu_length, 2); /* overall packet size */ - } else { - packetbuf_hdralloc(L2CAP_SUBSEQ_HEADER_SIZE); - used_mps -= L2CAP_SUBSEQ_HEADER_SIZE; - data_len = MIN((channel->tx_buffer.sdu_length - channel->tx_buffer.current_index), used_mps); - frame_len = data_len; - - /* set L2CAP header fields */ - memcpy(packetbuf_hdrptr(), &frame_len, 2); /* fragment size */ - memcpy(packetbuf_hdrptr() + 2, &channel->channel_peer.cid, 2); /* L2CAP channel id*/ - } - - /* copy payload */ - memcpy(packetbuf_dataptr(), - &channel->tx_buffer.sdu[channel->tx_buffer.current_index], - data_len); - packetbuf_set_datalen(data_len); - channel->tx_buffer.current_index += data_len; - - /* send the fragment */ - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &channel->peer_addr); - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); - NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen()); - channel->channel_peer.credits--; - - /* reset the L2CAP TX buffer if packet is finished */ - if(channel->tx_buffer.current_index == channel->tx_buffer.sdu_length) { - channel->tx_buffer.current_index = 0; - channel->tx_buffer.sdu_length = 0; - } - } - } else { - LOG_WARN("process. channel is NULL\n"); - } - } - - PROCESS_END(); - LOG_DBG("stopped ble_mac_tx_process\n"); -} diff --git a/os/net/mac/ble/ble-l2cap.h b/os/net/mac/ble/ble-l2cap.h deleted file mode 100644 index 73dfa18a5..000000000 --- a/os/net/mac/ble/ble-l2cap.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2017, Graz University of Technology - * 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 - * MAC layer that implements BLE L2CAP credit-based flow control - * channels to support IPv6 over BLE (RFC 7668) - * - * \author - * Michael Spoerk - */ -/*---------------------------------------------------------------------------*/ -#ifndef BLE_L2CAP_H_ -#define BLE_L2CAP_H_ - -#include "contiki.h" -#include "net/mac/mac.h" -#include "dev/radio.h" -/*---------------------------------------------------------------------------*/ -/* device name used for BLE advertisement */ -#ifdef BLE_CONF_DEVICE_NAME -#define BLE_DEVICE_NAME BLE_CONF_DEVICE_NAME -#else -#define BLE_DEVICE_NAME "BLE device name" -#endif - -/* BLE advertisement in milliseconds */ -#ifdef BLE_CONF_ADV_INTERVAL -#define BLE_ADV_INTERVAL BLE_CONF_ADV_INTERVAL -#else -#define BLE_ADV_INTERVAL 50 -#endif - -#define BLE_SLAVE_CONN_INTERVAL_MIN 0x0150 -#define BLE_SLAVE_CONN_INTERVAL_MAX 0x01F0 -#define L2CAP_SIGNAL_CHANNEL 0x0005 -#define L2CAP_FLOW_CHANNEL 0x0041 -#define L2CAP_CODE_CONN_UPDATE_REQ 0x12 -#define L2CAP_CODE_CONN_UPDATE_RSP 0x13 -#define L2CAP_CODE_CONN_REQ 0x14 -#define L2CAP_CODE_CONN_RSP 0x15 -#define L2CAP_CODE_CREDIT 0x16 -#define L2CAP_IPSP_PSM 0x0023 - -/* the maximum MTU size of the L2CAP channel */ -#ifdef BLE_L2CAP_CONF_NODE_MTU -#define BLE_L2CAP_NODE_MTU BLE_L2CAP_CONF_NODE_MTU -#else -#define BLE_L2CAP_NODE_MTU 1280 -#endif - -/* the max. supported L2CAP fragment length */ -#ifdef BLE_L2CAP_CONF_NODE_FRAG_LEN -#define BLE_L2CAP_NODE_FRAG_LEN BLE_L2CAP_CONF_NODE_FRAG_LEN -#else -#ifdef BLE_MODE_CONF_CONN_MAX_PACKET_SIZE -#define BLE_L2CAP_NODE_FRAG_LEN BLE_MODE_CONF_CONN_MAX_PACKET_SIZE -#else -#define BLE_L2CAP_NODE_FRAG_LEN 256 -#endif -#endif - -#define L2CAP_CREDIT_NEW (BLE_L2CAP_NODE_MTU / BLE_L2CAP_NODE_FRAG_LEN) -#define L2CAP_CREDIT_THRESHOLD 2 - -#define L2CAP_INIT_INTERVAL (2 * CLOCK_SECOND) - -/* BLE connection interval in milliseconds */ -#ifdef BLE_CONF_CONNECTION_INTERVAL -#define CONNECTION_INTERVAL_MS BLE_CONF_CONNECTION_INTERVAL -#else -#define CONNECTION_INTERVAL_MS 125 -#endif - -/* BLE slave latency */ -#ifdef BLE_CONF_CONNECTION_SLAVE_LATENCY -#define CONNECTION_SLAVE_LATENCY BLE_CONF_CONNECTION_SLAVE_LATENCY -#else -#define CONNECTION_SLAVE_LATENCY 0 -#endif - -/* BLE supervision timeout */ -#define CONNECTION_TIMEOUT 42 - -#define L2CAP_FIRST_HEADER_SIZE 6 -#define L2CAP_SUBSEQ_HEADER_SIZE 4 - -#if UIP_CONF_ROUTER -#ifdef BLE_MODE_CONF_MAX_CONNECTIONS -#define L2CAP_CHANNELS BLE_MODE_CONF_MAX_CONNECTIONS -#else -#define L2CAP_CHANNELS 1 -#endif -#else -#define L2CAP_CHANNELS 1 -#endif - -extern const struct mac_driver ble_l2cap_driver; - -#endif /* BLE_L2CAP_H_ */ diff --git a/os/net/mac/csma/anti-replay.c b/os/net/mac/csma/anti-replay.c deleted file mode 100644 index 347674184..000000000 --- a/os/net/mac/csma/anti-replay.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2014, Hasso-Plattner-Institut. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Protects against replay attacks by comparing with the last - * unicast or broadcast frame counter of the sender. - * \author - * Konrad Krentz - */ - -/** - * \addtogroup csma - * @{ - */ - -#include "net/mac/csma/anti-replay.h" -#include "net/packetbuf.h" -#include "net/mac/llsec802154.h" - -#if LLSEC802154_USES_FRAME_COUNTER - -/* This node's current frame counter value */ -static uint32_t counter; - -/*---------------------------------------------------------------------------*/ -void -anti_replay_set_counter(void) -{ - frame802154_frame_counter_t reordered_counter; - - ++counter; - reordered_counter.u32 = LLSEC802154_HTONL(counter); - - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_0_1, reordered_counter.u16[0]); - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_2_3, reordered_counter.u16[1]); -} -/*---------------------------------------------------------------------------*/ -uint32_t -anti_replay_get_counter(void) -{ - frame802154_frame_counter_t disordered_counter; - - disordered_counter.u16[0] = packetbuf_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_0_1); - disordered_counter.u16[1] = packetbuf_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_2_3); - - return LLSEC802154_HTONL(disordered_counter.u32); -} -/*---------------------------------------------------------------------------*/ -void -anti_replay_init_info(struct anti_replay_info *info) -{ - info->last_broadcast_counter - = info->last_unicast_counter - = anti_replay_get_counter(); -} -/*---------------------------------------------------------------------------*/ -int -anti_replay_was_replayed(struct anti_replay_info *info) -{ - uint32_t received_counter; - - received_counter = anti_replay_get_counter(); - - if(packetbuf_holds_broadcast()) { - /* broadcast */ - if(received_counter <= info->last_broadcast_counter) { - return 1; - } else { - info->last_broadcast_counter = received_counter; - return 0; - } - } else { - /* unicast */ - if(received_counter <= info->last_unicast_counter) { - return 1; - } else { - info->last_unicast_counter = received_counter; - return 0; - } - } -} -/*---------------------------------------------------------------------------*/ -#endif /* LLSEC802154_USES_FRAME_COUNTER */ - -/** @} */ diff --git a/os/net/mac/csma/anti-replay.h b/os/net/mac/csma/anti-replay.h deleted file mode 100644 index 9211a6e7a..000000000 --- a/os/net/mac/csma/anti-replay.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2014, Hasso-Plattner-Institut. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Interface to anti-replay mechanisms. - * \author - * Konrad Krentz - */ - -/** - * \addtogroup llsec802154 - * @{ - */ - -#ifndef ANTI_REPLAY_H -#define ANTI_REPLAY_H - -#include "contiki.h" - -struct anti_replay_info { - uint32_t last_broadcast_counter; - uint32_t last_unicast_counter; -}; - -/** - * \brief Sets the frame counter packetbuf attributes. - */ -void anti_replay_set_counter(void); - -/** - * \brief Gets the frame counter from packetbuf. - */ -uint32_t anti_replay_get_counter(void); - -/** - * \brief Initializes the anti-replay information about the sender - * \param info Anti-replay information about the sender - */ -void anti_replay_init_info(struct anti_replay_info *info); - -/** - * \brief Checks if received frame was replayed - * \param info Anti-replay information about the sender - * \retval 0 <-> received frame was not replayed - */ -int anti_replay_was_replayed(struct anti_replay_info *info); - -#endif /* ANTI_REPLAY_H */ - -/** @} */ diff --git a/os/net/mac/csma/ccm-star-packetbuf.c b/os/net/mac/csma/ccm-star-packetbuf.c deleted file mode 100644 index 17b9befdc..000000000 --- a/os/net/mac/csma/ccm-star-packetbuf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013, Hasso-Plattner-Institut. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * CCM* convenience functions for LLSEC use - * \author - * Justin King-Lacroix - * Konrad Krentz - */ - -#include "net/linkaddr.h" -#include "net/packetbuf.h" -#include "net/mac/llsec802154.h" -#include - -#if LLSEC802154_USES_AUX_HEADER && LLSEC802154_USES_FRAME_COUNTER - -/*---------------------------------------------------------------------------*/ -static const uint8_t * -get_extended_address(const linkaddr_t *addr) -#if LINKADDR_SIZE == 2 -{ - /* workaround for short addresses: derive EUI64 as in RFC 6282 */ - static linkaddr_extended_t template = { { 0x00 , 0x00 , 0x00 , - 0xFF , 0xFE , 0x00 , 0x00 , 0x00 } }; - template.u16[3] = LLSEC802154_HTONS(addr->u16); - - return template.u8; -} -#else /* LINKADDR_SIZE == 2 */ -{ - return addr->u8; -} -#endif /* LINKADDR_SIZE == 2 */ -/*---------------------------------------------------------------------------*/ -void -ccm_star_packetbuf_set_nonce(uint8_t *nonce, int forward) -{ - const linkaddr_t *source_addr; - - source_addr = forward ? &linkaddr_node_addr : packetbuf_addr(PACKETBUF_ADDR_SENDER); - memcpy(nonce, get_extended_address(source_addr), 8); - nonce[8] = packetbuf_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_2_3) >> 8; - nonce[9] = packetbuf_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_2_3) & 0xff; - nonce[10] = packetbuf_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_0_1) >> 8; - nonce[11] = packetbuf_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_0_1) & 0xff; - nonce[12] = packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL); -} -/*---------------------------------------------------------------------------*/ -#endif /* LLSEC802154_USES_AUX_HEADER && LLSEC802154_USES_FRAME_COUNTER */ diff --git a/os/net/mac/csma/ccm-star-packetbuf.h b/os/net/mac/csma/ccm-star-packetbuf.h deleted file mode 100644 index 578bdef96..000000000 --- a/os/net/mac/csma/ccm-star-packetbuf.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2013, Hasso-Plattner-Institut. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#ifndef CCM_STAR_PACKETBUF_H_ -#define CCM_STAR_PACKETBUF_H_ - -/*---------------------------------------------------------------------------*/ -void ccm_star_packetbuf_set_nonce(uint8_t *nonce, int forward); - -#endif /* CCM_STAR_PACKETBUF_H_ */ diff --git a/os/net/mac/csma/csma-output.c b/os/net/mac/csma/csma-output.c deleted file mode 100644 index 653743967..000000000 --- a/os/net/mac/csma/csma-output.c +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * The 802.15.4 standard CSMA protocol (nonbeacon-enabled). - * Output functions. - * \author - * Adam Dunkels - * Simon Duquennoy - */ - -#include "net/mac/csma/csma.h" -#include "net/mac/csma/csma-security.h" -#include "net/packetbuf.h" -#include "net/queuebuf.h" -#include "dev/watchdog.h" -#include "sys/ctimer.h" -#include "sys/clock.h" -#include "lib/random.h" -#include "net/netstack.h" -#include "lib/list.h" -#include "lib/memb.h" -#include "lib/assert.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "CSMA" -#define LOG_LEVEL LOG_LEVEL_MAC - -/* Constants of the IEEE 802.15.4 standard */ - -/* macMinBE: Initial backoff exponent. Range 0--CSMA_MAX_BE */ -#ifdef CSMA_CONF_MIN_BE -#define CSMA_MIN_BE CSMA_CONF_MIN_BE -#else -#define CSMA_MIN_BE 3 -#endif - -/* macMaxBE: Maximum backoff exponent. Range 3--8 */ -#ifdef CSMA_CONF_MAX_BE -#define CSMA_MAX_BE CSMA_CONF_MAX_BE -#else -#define CSMA_MAX_BE 5 -#endif - -/* macMaxCSMABackoffs: Maximum number of backoffs in case of channel busy/collision. Range 0--5 */ -#ifdef CSMA_CONF_MAX_BACKOFF -#define CSMA_MAX_BACKOFF CSMA_CONF_MAX_BACKOFF -#else -#define CSMA_MAX_BACKOFF 5 -#endif - -/* macMaxFrameRetries: Maximum number of re-transmissions attampts. Range 0--7 */ -#ifdef CSMA_CONF_MAX_FRAME_RETRIES -#define CSMA_MAX_FRAME_RETRIES CSMA_CONF_MAX_FRAME_RETRIES -#else -#define CSMA_MAX_FRAME_RETRIES 7 -#endif - -/* Packet metadata */ -struct qbuf_metadata { - mac_callback_t sent; - void *cptr; - uint8_t max_transmissions; -}; - -/* Every neighbor has its own packet queue */ -struct neighbor_queue { - struct neighbor_queue *next; - linkaddr_t addr; - struct ctimer transmit_timer; - uint8_t transmissions; - uint8_t collisions; - LIST_STRUCT(packet_queue); -}; - -/* The maximum number of co-existing neighbor queues */ -#ifdef CSMA_CONF_MAX_NEIGHBOR_QUEUES -#define CSMA_MAX_NEIGHBOR_QUEUES CSMA_CONF_MAX_NEIGHBOR_QUEUES -#else -#define CSMA_MAX_NEIGHBOR_QUEUES 2 -#endif /* CSMA_CONF_MAX_NEIGHBOR_QUEUES */ - -/* The maximum number of pending packet per neighbor */ -#ifdef CSMA_CONF_MAX_PACKET_PER_NEIGHBOR -#define CSMA_MAX_PACKET_PER_NEIGHBOR CSMA_CONF_MAX_PACKET_PER_NEIGHBOR -#else -#define CSMA_MAX_PACKET_PER_NEIGHBOR MAX_QUEUED_PACKETS -#endif /* CSMA_CONF_MAX_PACKET_PER_NEIGHBOR */ - -#define MAX_QUEUED_PACKETS QUEUEBUF_NUM - -/* Neighbor packet queue */ -struct packet_queue { - struct packet_queue *next; - struct queuebuf *buf; - void *ptr; -}; - -MEMB(neighbor_memb, struct neighbor_queue, CSMA_MAX_NEIGHBOR_QUEUES); -MEMB(packet_memb, struct packet_queue, MAX_QUEUED_PACKETS); -MEMB(metadata_memb, struct qbuf_metadata, MAX_QUEUED_PACKETS); -LIST(neighbor_list); - -static void packet_sent(struct neighbor_queue *n, - struct packet_queue *q, - int status, - int num_transmissions); -static void transmit_from_queue(void *ptr); -/*---------------------------------------------------------------------------*/ -static struct neighbor_queue * -neighbor_queue_from_addr(const linkaddr_t *addr) -{ - struct neighbor_queue *n = list_head(neighbor_list); - while(n != NULL) { - if(linkaddr_cmp(&n->addr, addr)) { - return n; - } - n = list_item_next(n); - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static clock_time_t -backoff_period(void) -{ -#if CONTIKI_TARGET_COOJA - /* Increase normal value by 20 to compensate for the coarse-grained - radio medium with Cooja motes */ - return MAX(20 * CLOCK_SECOND / 3125, 1); -#else /* CONTIKI_TARGET_COOJA */ - /* Use the default in IEEE 802.15.4: aUnitBackoffPeriod which is - * 20 symbols i.e. 320 usec. That is, 1/3125 second. */ - return MAX(CLOCK_SECOND / 3125, 1); -#endif /* CONTIKI_TARGET_COOJA */ -} -/*---------------------------------------------------------------------------*/ -static int -send_one_packet(struct neighbor_queue *n, struct packet_queue *q) -{ - int ret; - int last_sent_ok = 0; - - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); - packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1); - -#if LLSEC802154_ENABLED -#if LLSEC802154_USES_EXPLICIT_KEYS - /* This should possibly be taken from upper layers in the future */ - packetbuf_set_attr(PACKETBUF_ATTR_KEY_ID_MODE, CSMA_LLSEC_KEY_ID_MODE); -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ -#endif /* LLSEC802154_ENABLED */ - - if(csma_security_create_frame() < 0) { - /* Failed to allocate space for headers */ - LOG_ERR("failed to create packet, seqno: %d\n", packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO)); - ret = MAC_TX_ERR_FATAL; - } else { - int is_broadcast; - uint8_t dsn; - dsn = ((uint8_t *)packetbuf_hdrptr())[2] & 0xff; - - NETSTACK_RADIO.prepare(packetbuf_hdrptr(), packetbuf_totlen()); - - is_broadcast = packetbuf_holds_broadcast(); - - if(NETSTACK_RADIO.receiving_packet() || - (!is_broadcast && NETSTACK_RADIO.pending_packet())) { - - /* Currently receiving a packet over air or the radio has - already received a packet that needs to be read before - sending with auto ack. */ - ret = MAC_TX_COLLISION; - } else { - - switch(NETSTACK_RADIO.transmit(packetbuf_totlen())) { - case RADIO_TX_OK: - if(is_broadcast) { - ret = MAC_TX_OK; - } else { - /* Check for ack */ - - /* Wait for max CSMA_ACK_WAIT_TIME */ - RTIMER_BUSYWAIT_UNTIL(NETSTACK_RADIO.pending_packet(), CSMA_ACK_WAIT_TIME); - - ret = MAC_TX_NOACK; - if(NETSTACK_RADIO.receiving_packet() || - NETSTACK_RADIO.pending_packet() || - NETSTACK_RADIO.channel_clear() == 0) { - int len; - uint8_t ackbuf[CSMA_ACK_LEN]; - - /* Wait an additional CSMA_AFTER_ACK_DETECTED_WAIT_TIME to complete reception */ - RTIMER_BUSYWAIT_UNTIL(NETSTACK_RADIO.pending_packet(), CSMA_AFTER_ACK_DETECTED_WAIT_TIME); - - if(NETSTACK_RADIO.pending_packet()) { - len = NETSTACK_RADIO.read(ackbuf, CSMA_ACK_LEN); - if(len == CSMA_ACK_LEN && ackbuf[2] == dsn) { - /* Ack received */ - ret = MAC_TX_OK; - } else { - /* Not an ack or ack not for us: collision */ - ret = MAC_TX_COLLISION; - } - } - } - } - break; - case RADIO_TX_COLLISION: - ret = MAC_TX_COLLISION; - break; - default: - ret = MAC_TX_ERR; - break; - } - } - } - if(ret == MAC_TX_OK) { - last_sent_ok = 1; - } - - packet_sent(n, q, ret, 1); - return last_sent_ok; -} -/*---------------------------------------------------------------------------*/ -static void -transmit_from_queue(void *ptr) -{ - struct neighbor_queue *n = ptr; - if(n) { - struct packet_queue *q = list_head(n->packet_queue); - if(q != NULL) { - LOG_INFO("preparing packet for "); - LOG_INFO_LLADDR(&n->addr); - LOG_INFO_(", seqno %u, tx %u, queue %d\n", - queuebuf_attr(q->buf, PACKETBUF_ATTR_MAC_SEQNO), - n->transmissions, list_length(n->packet_queue)); - /* Send first packet in the neighbor queue */ - queuebuf_to_packetbuf(q->buf); - send_one_packet(n, q); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -schedule_transmission(struct neighbor_queue *n) -{ - clock_time_t delay; - int backoff_exponent; /* BE in IEEE 802.15.4 */ - - backoff_exponent = MIN(n->collisions + CSMA_MIN_BE, CSMA_MAX_BE); - - /* Compute max delay as per IEEE 802.15.4: 2^BE-1 backoff periods */ - delay = ((1 << backoff_exponent) - 1) * backoff_period(); - if(delay > 0) { - /* Pick a time for next transmission */ - delay = random_rand() % delay; - } - - LOG_DBG("scheduling transmission in %u ticks, NB=%u, BE=%u\n", - (unsigned)delay, n->collisions, backoff_exponent); - ctimer_set(&n->transmit_timer, delay, transmit_from_queue, n); -} -/*---------------------------------------------------------------------------*/ -static void -free_packet(struct neighbor_queue *n, struct packet_queue *p, int status) -{ - if(p != NULL) { - /* Remove packet from queue and deallocate */ - list_remove(n->packet_queue, p); - - queuebuf_free(p->buf); - memb_free(&metadata_memb, p->ptr); - memb_free(&packet_memb, p); - LOG_DBG("free_queued_packet, queue length %d, free packets %d\n", - list_length(n->packet_queue), memb_numfree(&packet_memb)); - if(list_head(n->packet_queue) != NULL) { - /* There is a next packet. We reset current tx information */ - n->transmissions = 0; - n->collisions = 0; - /* Schedule next transmissions */ - schedule_transmission(n); - } else { - /* This was the last packet in the queue, we free the neighbor */ - ctimer_stop(&n->transmit_timer); - list_remove(neighbor_list, n); - memb_free(&neighbor_memb, n); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -tx_done(int status, struct packet_queue *q, struct neighbor_queue *n) -{ - mac_callback_t sent; - struct qbuf_metadata *metadata; - void *cptr; - uint8_t ntx; - - metadata = (struct qbuf_metadata *)q->ptr; - sent = metadata->sent; - cptr = metadata->cptr; - ntx = n->transmissions; - - LOG_INFO("packet sent to "); - LOG_INFO_LLADDR(&n->addr); - LOG_INFO_(", seqno %u, status %u, tx %u, coll %u\n", - packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO), - status, n->transmissions, n->collisions); - - free_packet(n, q, status); - mac_call_sent_callback(sent, cptr, status, ntx); -} -/*---------------------------------------------------------------------------*/ -static void -rexmit(struct packet_queue *q, struct neighbor_queue *n) -{ - schedule_transmission(n); - /* This is needed to correctly attribute energy that we spent - transmitting this packet. */ - queuebuf_update_attr_from_packetbuf(q->buf); -} -/*---------------------------------------------------------------------------*/ -static void -collision(struct packet_queue *q, struct neighbor_queue *n, - int num_transmissions) -{ - struct qbuf_metadata *metadata; - - metadata = (struct qbuf_metadata *)q->ptr; - - n->collisions += num_transmissions; - - if(n->collisions > CSMA_MAX_BACKOFF) { - n->collisions = 0; - /* Increment to indicate a next retry */ - n->transmissions++; - } - - if(n->transmissions >= metadata->max_transmissions) { - tx_done(MAC_TX_COLLISION, q, n); - } else { - rexmit(q, n); - } -} -/*---------------------------------------------------------------------------*/ -static void -noack(struct packet_queue *q, struct neighbor_queue *n, int num_transmissions) -{ - struct qbuf_metadata *metadata; - - metadata = (struct qbuf_metadata *)q->ptr; - - n->collisions = 0; - n->transmissions += num_transmissions; - - if(n->transmissions >= metadata->max_transmissions) { - tx_done(MAC_TX_NOACK, q, n); - } else { - rexmit(q, n); - } -} -/*---------------------------------------------------------------------------*/ -static void -tx_ok(struct packet_queue *q, struct neighbor_queue *n, int num_transmissions) -{ - n->collisions = 0; - n->transmissions += num_transmissions; - tx_done(MAC_TX_OK, q, n); -} -/*---------------------------------------------------------------------------*/ -static void -packet_sent(struct neighbor_queue *n, - struct packet_queue *q, - int status, - int num_transmissions) -{ - assert(n != NULL); - assert(q != NULL); - - if(q->ptr == NULL) { - LOG_WARN("packet sent: no metadata\n"); - return; - } - - LOG_INFO("tx to "); - LOG_INFO_LLADDR(&n->addr); - LOG_INFO_(", seqno %u, status %u, tx %u, coll %u\n", - packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO), - status, n->transmissions, n->collisions); - - switch(status) { - case MAC_TX_OK: - tx_ok(q, n, num_transmissions); - break; - case MAC_TX_NOACK: - noack(q, n, num_transmissions); - break; - case MAC_TX_COLLISION: - collision(q, n, num_transmissions); - break; - case MAC_TX_DEFERRED: - break; - default: - tx_done(status, q, n); - break; - } -} -/*---------------------------------------------------------------------------*/ -void -csma_output_packet(mac_callback_t sent, void *ptr) -{ - struct packet_queue *q; - struct neighbor_queue *n; - static uint8_t initialized = 0; - static uint8_t seqno; - const linkaddr_t *addr = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); - - if(!initialized) { - initialized = 1; - /* Initialize the sequence number to a random value as per 802.15.4. */ - seqno = random_rand(); - } - - if(seqno == 0) { - /* PACKETBUF_ATTR_MAC_SEQNO cannot be zero, due to a pecuilarity - in framer-802154.c. */ - seqno++; - } - packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, seqno++); - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME); - - /* Look for the neighbor entry */ - n = neighbor_queue_from_addr(addr); - if(n == NULL) { - /* Allocate a new neighbor entry */ - n = memb_alloc(&neighbor_memb); - if(n != NULL) { - /* Init neighbor entry */ - linkaddr_copy(&n->addr, addr); - n->transmissions = 0; - n->collisions = 0; - /* Init packet queue for this neighbor */ - LIST_STRUCT_INIT(n, packet_queue); - /* Add neighbor to the neighbor list */ - list_add(neighbor_list, n); - } - } - - if(n != NULL) { - /* Add packet to the neighbor's queue */ - if(list_length(n->packet_queue) < CSMA_MAX_PACKET_PER_NEIGHBOR) { - q = memb_alloc(&packet_memb); - if(q != NULL) { - q->ptr = memb_alloc(&metadata_memb); - if(q->ptr != NULL) { - q->buf = queuebuf_new_from_packetbuf(); - if(q->buf != NULL) { - struct qbuf_metadata *metadata = (struct qbuf_metadata *)q->ptr; - /* Neighbor and packet successfully allocated */ - metadata->max_transmissions = packetbuf_attr(PACKETBUF_ATTR_MAX_MAC_TRANSMISSIONS); - if(metadata->max_transmissions == 0) { - /* If not set by the application, use the default CSMA value */ - metadata->max_transmissions = CSMA_MAX_FRAME_RETRIES + 1; - } - metadata->sent = sent; - metadata->cptr = ptr; - list_add(n->packet_queue, q); - - LOG_INFO("sending to "); - LOG_INFO_LLADDR(addr); - LOG_INFO_(", len %u, seqno %u, queue length %d, free packets %d\n", - packetbuf_datalen(), - packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO), - list_length(n->packet_queue), memb_numfree(&packet_memb)); - /* If q is the first packet in the neighbor's queue, send asap */ - if(list_head(n->packet_queue) == q) { - schedule_transmission(n); - } - return; - } - memb_free(&metadata_memb, q->ptr); - LOG_WARN("could not allocate queuebuf, dropping packet\n"); - } - memb_free(&packet_memb, q); - LOG_WARN("could not allocate queuebuf, dropping packet\n"); - } - /* The packet allocation failed. Remove and free neighbor entry if empty. */ - if(list_length(n->packet_queue) == 0) { - list_remove(neighbor_list, n); - memb_free(&neighbor_memb, n); - } - } else { - LOG_WARN("Neighbor queue full\n"); - } - LOG_WARN("could not allocate packet, dropping packet\n"); - } else { - LOG_WARN("could not allocate neighbor, dropping packet\n"); - } - mac_call_sent_callback(sent, ptr, MAC_TX_ERR, 1); -} -/*---------------------------------------------------------------------------*/ -void -csma_output_init(void) -{ - memb_init(&packet_memb); - memb_init(&metadata_memb); - memb_init(&neighbor_memb); -} diff --git a/os/net/mac/csma/csma-output.h b/os/net/mac/csma/csma-output.h deleted file mode 100644 index c67ba1903..000000000 --- a/os/net/mac/csma/csma-output.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * The 802.15.4 standard CSMA protocol (nonbeacon-enabled). - * Output functions. - * \author - - * Simon Duquennoy - */ - -#ifndef CSMA_OUTPUT_H_ -#define CSMA_OUTPUT_H_ - -#include "contiki.h" -#include "net/mac/mac.h" - -void csma_output_packet(mac_callback_t sent, void *ptr); -void csma_output_init(void); - -#endif /* CSMA_OUTPUT_H_ */ diff --git a/os/net/mac/csma/csma-security.c b/os/net/mac/csma/csma-security.c deleted file mode 100644 index 0b44fa348..000000000 --- a/os/net/mac/csma/csma-security.c +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * CSMA security - * \author - * Joakim Eriksson - */ - -/** - * \addtogroup csma - * @{ -*/ - -#include "contiki.h" -#include "net/mac/csma/csma.h" -#include "net/mac/csma/anti-replay.h" -#include "net/mac/csma/csma-security.h" -#include "net/mac/framer/frame802154.h" -#include "net/mac/framer/framer-802154.h" -#include "net/mac/llsec802154.h" -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "lib/ccm-star.h" -#include "lib/aes-128.h" -#include -#include -#include "ccm-star-packetbuf.h" -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "CSMA" -#define LOG_LEVEL LOG_LEVEL_MAC - -#if LOG_LEVEL == LOG_LEVEL_DBG -static const char * HEX = "0123456789ABCDEF"; -#endif - -#if LLSEC802154_USES_AUX_HEADER && LLSEC802154_USES_FRAME_COUNTER - -#define MIC_LEN(level) LLSEC802154_MIC_LEN(level) - -#if LLSEC802154_USES_EXPLICIT_KEYS -#define LLSEC_KEY_INDEX (FRAME802154_IMPLICIT_KEY == packetbuf_attr(PACKETBUF_ATTR_KEY_ID_MODE) \ - ? 0 \ - : packetbuf_attr(PACKETBUF_ATTR_KEY_INDEX)) -#define LLSEC_KEY_MODE (packetbuf_attr(PACKETBUF_ATTR_KEY_ID_MODE)) -#else -#define LLSEC_KEY_INDEX (0) -#define LLSEC_KEY_MODE (FRAME802154_IMPLICIT_KEY) -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ - -/** - * The keys for LLSEC for CSMA - */ -typedef struct { - uint8_t u8[16]; -} aes_key_t; -static aes_key_t keys[CSMA_LLSEC_MAXKEYS]; - -/* assumed to be 16 bytes */ -int -csma_security_set_key(uint8_t index, const uint8_t *key) -{ - if(key != NULL && index < CSMA_LLSEC_MAXKEYS) { - memcpy(keys[index].u8, key, 16); - return 1; - } - return 0; -} - -#define N_KEYS (sizeof(keys) / sizeof(aes_key)) -/*---------------------------------------------------------------------------*/ -static int -aead(uint8_t hdrlen, int forward) -{ - uint8_t totlen; - uint8_t nonce[CCM_STAR_NONCE_LENGTH]; - uint8_t *m; - uint8_t m_len; - uint8_t *a; - uint8_t a_len; - uint8_t *result; - /* Allocate for MAX level */ - uint8_t generated_mic[MIC_LEN(7)]; - uint8_t *mic; - uint8_t key_index; - aes_key_t *key; - uint8_t with_encryption; - - key_index = LLSEC_KEY_INDEX; - if(key_index >= CSMA_LLSEC_MAXKEYS) { - LOG_ERR("Key not available: %u\n", key_index); - return 0; - } - - key = &keys[key_index]; - - ccm_star_packetbuf_set_nonce(nonce, forward); - totlen = packetbuf_totlen(); - a = packetbuf_hdrptr(); - - with_encryption = - (packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) & 0x4) ? 1 : 0; - - if(with_encryption) { - a_len = hdrlen; - m = a + a_len; - m_len = totlen - hdrlen; - } else { - a_len = totlen; - m = NULL; - m_len = 0; - } - - mic = a + totlen; - result = forward ? mic : generated_mic; - - CCM_STAR.set_key(key->u8); - CCM_STAR.aead(nonce, - m, m_len, - a, a_len, - result, MIC_LEN(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) & 0x07), - forward); - - if(forward) { - packetbuf_set_datalen(packetbuf_datalen() + MIC_LEN(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) & 0x07)); - return 1; - } else { - return (memcmp(generated_mic, mic, MIC_LEN(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) & 0x07)) == 0); - } -} - -/*---------------------------------------------------------------------------*/ -int -csma_security_create_frame(void) -{ - int hdr_len; - - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME); - if(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) > 0 && - LLSEC_KEY_INDEX != 0xffff) { - anti_replay_set_counter(); - } - - hdr_len = NETSTACK_FRAMER.create(); - if(hdr_len < 0) { - return hdr_len; - } - - if(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) > 0) { -#if LOG_LEVEL == LOG_LEVEL_DBG - int i = 0; - uint8_t *p; - LOG_DBG(" Payload before (%d):", packetbuf_totlen()); - p = packetbuf_hdrptr(); - for(i = 0; i < packetbuf_totlen(); i++) { - LOG_DBG_("%c%c", HEX[(p[i] >> 4) & 0x0f], HEX[p[i] & 0x0f]); - } - LOG_DBG("\n"); -#endif - - if(!aead(hdr_len, 1)) { - LOG_ERR("failed to encrypt packet to "); - LOG_ERR_LLADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - LOG_ERR_("\n"); - return FRAMER_FAILED; - } - LOG_INFO("LLSEC-OUT:"); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_INFO_(" "); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - LOG_INFO_(" %u (%u) LV:%d, KEY:0x%02x\n", packetbuf_datalen(), packetbuf_totlen(), - packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL), LLSEC_KEY_INDEX); - -#if LOG_LEVEL == LOG_LEVEL_DBG - LOG_DBG(" Payload after: (%d)", packetbuf_totlen()); - p = packetbuf_hdrptr(); - for(i = 0; i < packetbuf_totlen(); i++) { - LOG_DBG_("%c%c", HEX[(p[i] >> 4) & 0x0f], HEX[p[i] & 0x0f]); - } - LOG_DBG_("\n"); -#endif - - } - return hdr_len; -} - -/*---------------------------------------------------------------------------*/ -int -csma_security_frame_len(void) -{ - if(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) > 0 && - LLSEC_KEY_INDEX != 0xffff) { - return NETSTACK_FRAMER.length() + - MIC_LEN(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) & 0x07); - } - return NETSTACK_FRAMER.length(); -} -/*---------------------------------------------------------------------------*/ -int -csma_security_parse_frame(void) -{ - int hdr_len; - - hdr_len = NETSTACK_FRAMER.parse(); - if(hdr_len < 0) { - return hdr_len; - } - - if(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) == 0) { - /* No security - no more processing required */ - return hdr_len; - } - - LOG_INFO("LLSEC-IN: "); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_INFO_(" "); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - LOG_INFO_(" %d %u (%u) LV:%d KM:%d KEY:0x%02x\n", hdr_len, packetbuf_datalen(), - packetbuf_totlen(), packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL), - LLSEC_KEY_MODE, - LLSEC_KEY_INDEX); - - if(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) != CSMA_LLSEC_SECURITY_LEVEL) { - LOG_INFO("received frame with wrong security level (%u) from ", - packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL)); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_INFO_("\n"); - return FRAMER_FAILED; - } - - if(LLSEC_KEY_MODE != CSMA_LLSEC_KEY_ID_MODE) { - LOG_INFO("received frame with wrong key id mode (%u) from ", LLSEC_KEY_MODE); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_INFO("\n"); - return FRAMER_FAILED; - } - - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER), &linkaddr_node_addr)) { - LOG_INFO("frame from ourselves\n"); - return FRAMER_FAILED; - } - - if(packetbuf_datalen() <= MIC_LEN(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) & 0x07)) { - LOG_ERR("MIC error - too little data in frame!\n"); - return FRAMER_FAILED; - } - - packetbuf_set_datalen(packetbuf_datalen() - MIC_LEN(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) & 0x07)); - if(!aead(hdr_len, 0)) { - LOG_INFO("received unauthentic frame %u from ", - (unsigned int) anti_replay_get_counter()); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_INFO_("\n"); - return FRAMER_FAILED; - } - - /* TODO anti-reply protection */ - return hdr_len; -} -/*---------------------------------------------------------------------------*/ -#else -/* The "unsecure" version of the create frame / parse frame */ -int -csma_security_create_frame(void) -{ - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME); - return NETSTACK_FRAMER.create(); -} -int -csma_security_parse_frame(void) -{ - return NETSTACK_FRAMER.parse(); -} - -#endif /* LLSEC802154_USES_AUX_HEADER && LLSEC802154_USES_FRAME_COUNTER */ - -/** @} */ diff --git a/os/net/mac/csma/csma-security.h b/os/net/mac/csma/csma-security.h deleted file mode 100644 index 97092b84d..000000000 --- a/os/net/mac/csma/csma-security.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2018, Tiny Mesh AS - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * LLSEC802154 Security related configuration - * \author - * Olav Frengstad - */ - -#ifndef CSMA_SECURITY_H_ -#define CSMA_SECURITY_H_ - - -#ifdef CSMA_CONF_LLSEC_DEFAULT_KEY0 -#define CSMA_LLSEC_DEFAULT_KEY0 CSMA_CONF_LLSEC_DEFAULT_KEY0 -#else -#define CSMA_LLSEC_DEFAULT_KEY0 {0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f} -#endif - -#ifdef CSMA_CONF_LLSEC_SECURITY_LEVEL -#define CSMA_LLSEC_SECURITY_LEVEL CSMA_CONF_LLSEC_SECURITY_LEVEL -#else -#define CSMA_LLSEC_SECURITY_LEVEL 5 -#endif /* CSMA_CONF_LLSEC_SECURITY_LEVEL */ - -#ifdef CSMA_CONF_LLSEC_KEY_ID_MODE -#define CSMA_LLSEC_KEY_ID_MODE CSMA_CONF_LLSEC_KEY_ID_MODE -#else -#define CSMA_LLSEC_KEY_ID_MODE FRAME802154_IMPLICIT_KEY -#endif /* CSMA_CONF_LLSEC_KEY_ID_MODE */ - -#ifdef CSMA_CONF_LLSEC_KEY_INDEX -#define CSMA_LLSEC_KEY_INDEX CSMA_CONF_LLSEC_KEY_INDEX -#else -#define CSMA_LLSEC_KEY_INDEX 0 -#endif /* CSMA_CONF_LLSEC_KEY_INDEX */ - -#ifdef CSMA_CONF_LLSEC_MAXKEYS -#define CSMA_LLSEC_MAXKEYS CSMA_CONF_LLSEC_MAXKEYS -#else -#define CSMA_LLSEC_MAXKEYS 1 -#endif - -#endif /* CSMA_SECURITY_H_ */ diff --git a/os/net/mac/csma/csma.c b/os/net/mac/csma/csma.c deleted file mode 100644 index 87aa6a1af..000000000 --- a/os/net/mac/csma/csma.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file -* The 802.15.4 standard CSMA protocol (nonbeacon-enabled) - * \author - * Adam Dunkels - * Simon Duquennoy - */ - -#include "net/mac/csma/csma.h" -#include "net/mac/csma/csma-output.h" -#include "net/mac/mac-sequence.h" -#include "net/packetbuf.h" -#include "net/netstack.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "CSMA" -#define LOG_LEVEL LOG_LEVEL_MAC - - -static void -init_sec(void) -{ -#if LLSEC802154_USES_AUX_HEADER - if(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) == - PACKETBUF_ATTR_SECURITY_LEVEL_DEFAULT) { - packetbuf_set_attr(PACKETBUF_ATTR_SECURITY_LEVEL, - CSMA_LLSEC_SECURITY_LEVEL); - } -#endif -} -/*---------------------------------------------------------------------------*/ -static void -send_packet(mac_callback_t sent, void *ptr) -{ - - init_sec(); - - csma_output_packet(sent, ptr); -} -/*---------------------------------------------------------------------------*/ -static void -input_packet(void) -{ -#if CSMA_SEND_SOFT_ACK - uint8_t ackdata[CSMA_ACK_LEN]; -#endif - - if(packetbuf_datalen() == CSMA_ACK_LEN) { - /* Ignore ack packets */ - LOG_DBG("ignored ack\n"); - } else if(csma_security_parse_frame() < 0) { - LOG_ERR("failed to parse %u\n", packetbuf_datalen()); - } else if(!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), - &linkaddr_node_addr) && - !packetbuf_holds_broadcast()) { - LOG_WARN("not for us\n"); - } else if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER), &linkaddr_node_addr)) { - LOG_WARN("frame from ourselves\n"); - } else { - int duplicate = 0; - - /* Check for duplicate packet. */ - duplicate = mac_sequence_is_duplicate(); - if(duplicate) { - /* Drop the packet. */ - LOG_WARN("drop duplicate link layer packet from "); - LOG_WARN_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_WARN_(", seqno %u\n", packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO)); - } else { - mac_sequence_register_seqno(); - } - -#if CSMA_SEND_SOFT_ACK - if(packetbuf_attr(PACKETBUF_ATTR_MAC_ACK)) { - ackdata[0] = FRAME802154_ACKFRAME; - ackdata[1] = 0; - ackdata[2] = ((uint8_t *)packetbuf_hdrptr())[2]; - NETSTACK_RADIO.send(ackdata, CSMA_ACK_LEN); - } -#endif /* CSMA_SEND_SOFT_ACK */ - if(!duplicate) { - LOG_INFO("received packet from "); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_INFO_(", seqno %u, len %u\n", packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO), packetbuf_datalen()); - NETSTACK_NETWORK.input(); - } - } -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - return NETSTACK_RADIO.on(); -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - return NETSTACK_RADIO.off(); -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - -#if LLSEC802154_USES_AUX_HEADER -#ifdef CSMA_LLSEC_DEFAULT_KEY0 - uint8_t key[16] = CSMA_LLSEC_DEFAULT_KEY0; - csma_security_set_key(0, key); -#endif -#endif /* LLSEC802154_USES_AUX_HEADER */ - csma_output_init(); - on(); -} -/*---------------------------------------------------------------------------*/ -static int -max_payload(void) -{ - int framer_hdrlen; - - init_sec(); - - framer_hdrlen = NETSTACK_FRAMER.length(); - - if(framer_hdrlen < 0) { - /* Framing failed, we assume the maximum header length */ - framer_hdrlen = CSMA_MAC_MAX_HEADER; - } - - return CSMA_MAC_LEN - framer_hdrlen; -} -/*---------------------------------------------------------------------------*/ -const struct mac_driver csma_driver = { - "CSMA", - init, - send_packet, - input_packet, - on, - off, - max_payload, -}; -/*---------------------------------------------------------------------------*/ diff --git a/os/net/mac/csma/csma.h b/os/net/mac/csma/csma.h deleted file mode 100644 index 88396db0b..000000000 --- a/os/net/mac/csma/csma.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * The 802.15.4 standard CSMA protocol (nonbeacon-enabled) - * \author - * Adam Dunkels - * Simon Duquennoy - */ - -#ifndef CSMA_H_ -#define CSMA_H_ - -#include "contiki.h" -#include "net/mac/mac.h" -#include "dev/radio.h" - -#ifdef CSMA_CONF_SEND_SOFT_ACK -#define CSMA_SEND_SOFT_ACK CSMA_CONF_SEND_SOFT_ACK -#else /* CSMA_CONF_SEND_SOFT_ACK */ -#define CSMA_SEND_SOFT_ACK 0 -#endif /* CSMA_CONF_SEND_SOFT_ACK */ - -#ifdef CSMA_CONF_ACK_WAIT_TIME -#define CSMA_ACK_WAIT_TIME CSMA_CONF_ACK_WAIT_TIME -#else /* CSMA_CONF_ACK_WAIT_TIME */ -#define CSMA_ACK_WAIT_TIME RTIMER_SECOND / 2500 -#endif /* CSMA_CONF_ACK_WAIT_TIME */ - -#ifdef CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME -#define CSMA_AFTER_ACK_DETECTED_WAIT_TIME CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME -#else /* CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME */ -#define CSMA_AFTER_ACK_DETECTED_WAIT_TIME RTIMER_SECOND / 1500 -#endif /* CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME */ - -#define CSMA_ACK_LEN 3 - -/* Default MAC len for 802.15.4 classic */ -#ifdef CSMA_MAC_CONF_LEN -#define CSMA_MAC_LEN CSMA_MAC_CONF_LEN -#else -#define CSMA_MAC_LEN 127 - 2 -#endif - -/* just a default - with LLSEC, etc */ -#define CSMA_MAC_MAX_HEADER 21 - - -extern const struct mac_driver csma_driver; - -/* CSMA security framer functions */ -int csma_security_create_frame(void); -int csma_security_parse_frame(void); - -/* key management for CSMA */ -int csma_security_set_key(uint8_t index, const uint8_t *key); - - -#endif /* CSMA_H_ */ diff --git a/os/net/mac/framer/frame802154.c b/os/net/mac/framer/frame802154.c deleted file mode 100644 index 90a4ae9a1..000000000 --- a/os/net/mac/framer/frame802154.c +++ /dev/null @@ -1,637 +0,0 @@ -/* - * - * Copyright (c) 2008, Swedish Institute of Computer Science - * All rights reserved. - * - * Additional fixes for AVR contributed by: - * - * Colin O'Flynn coflynn@newae.com - * Eric Gnoske egnoske@gmail.com - * Blake Leverett bleverett@gmail.com - * Mike Vidales mavida404@gmail.com - * Kevin Brown kbrown3@uccs.edu - * Nate Bohlmann nate@elfwerks.com - * - * Additional fixes for MSP430 contributed by: - * Joakim Eriksson - * Niclas Finne - * Nicolas Tsiftes - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * 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. - * * Neither the name of the copyright holders nor the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ -/* - * \brief This file is where the main functions that relate to frame - * manipulation will reside. - */ - -/** - * \file - * \brief 802.15.4 frame creation and parsing functions - * - * This file converts to and from a structure to a packed 802.15.4 - * frame. - */ - -/** - * \addtogroup frame802154 - * @{ - */ - -#include "sys/cc.h" -#include "net/mac/framer/frame802154.h" -#include "net/mac/llsec802154.h" -#include "net/linkaddr.h" -#include - -/** \brief The 16-bit identifier of the PAN on which the device is - * operating. If this value is 0xffff, the device is not - * associated. - */ -static uint16_t mac_pan_id = IEEE802154_PANID; - -/** - * \brief Structure that contains the lengths of the various addressing and security fields - * in the 802.15.4 header. This structure is used in \ref frame802154_create() - */ -typedef struct { - uint8_t seqno_len; /**< Length (in bytes) of sequence number field */ - uint8_t dest_pid_len; /**< Length (in bytes) of destination PAN ID field */ - uint8_t dest_addr_len; /**< Length (in bytes) of destination address field */ - uint8_t src_pid_len; /**< Length (in bytes) of source PAN ID field */ - uint8_t src_addr_len; /**< Length (in bytes) of source address field */ - uint8_t aux_sec_len; /**< Length (in bytes) of aux security header field */ -} field_length_t; - -/*----------------------------------------------------------------------------*/ -CC_INLINE static uint8_t -addr_len(uint8_t mode) -{ - switch(mode) { - case FRAME802154_SHORTADDRMODE: /* 16-bit address */ - return 2; - case FRAME802154_LONGADDRMODE: /* 64-bit address */ - return 8; - default: - return 0; - } -} -/*----------------------------------------------------------------------------*/ -#if LLSEC802154_USES_AUX_HEADER && LLSEC802154_USES_EXPLICIT_KEYS -static uint8_t -get_key_id_len(uint8_t key_id_mode) -{ - switch(key_id_mode) { - case FRAME802154_1_BYTE_KEY_ID_MODE: - return 1; - case FRAME802154_5_BYTE_KEY_ID_MODE: - return 5; - case FRAME802154_9_BYTE_KEY_ID_MODE: - return 9; - default: - return 0; - } -} -#endif /* LLSEC802154_USES_AUX_HEADER && LLSEC802154_USES_EXPLICIT_KEYS */ -/*---------------------------------------------------------------------------*/ -/* Get current PAN ID */ -uint16_t -frame802154_get_pan_id(void) -{ - return mac_pan_id; -} -/*---------------------------------------------------------------------------*/ -/* Set current PAN ID */ -void -frame802154_set_pan_id(uint16_t pan_id) -{ - mac_pan_id = pan_id; -} -/*----------------------------------------------------------------------------*/ -/* Tells whether a given Frame Control Field indicates a frame with - * source PANID and/or destination PANID */ -void -frame802154_has_panid(frame802154_fcf_t *fcf, int *has_src_pan_id, int *has_dest_pan_id) -{ - int src_pan_id = 0; - int dest_pan_id = 0; - - if(fcf == NULL) { - return; - } - - if(fcf->frame_version == FRAME802154_IEEE802154_2015) { - /* - * IEEE 802.15.4-2015 - * Table 7-2, PAN ID Compression value for frame version 0b10 - */ - if((fcf->dest_addr_mode == FRAME802154_NOADDR && - fcf->src_addr_mode == FRAME802154_NOADDR && - fcf->panid_compression == 1) || - (fcf->dest_addr_mode != FRAME802154_NOADDR && - fcf->src_addr_mode == FRAME802154_NOADDR && - fcf->panid_compression == 0) || - (fcf->dest_addr_mode == FRAME802154_LONGADDRMODE && - fcf->src_addr_mode == FRAME802154_LONGADDRMODE && - fcf->panid_compression == 0) || - ((fcf->dest_addr_mode == FRAME802154_SHORTADDRMODE && - fcf->src_addr_mode != FRAME802154_NOADDR) || - (fcf->dest_addr_mode != FRAME802154_NOADDR && - fcf->src_addr_mode == FRAME802154_SHORTADDRMODE)) ){ - dest_pan_id = 1; - } - - if(fcf->panid_compression == 0 && - ((fcf->dest_addr_mode == FRAME802154_NOADDR && - fcf->src_addr_mode == FRAME802154_LONGADDRMODE) || - (fcf->dest_addr_mode == FRAME802154_NOADDR && - fcf->src_addr_mode == FRAME802154_SHORTADDRMODE) || - (fcf->dest_addr_mode == FRAME802154_SHORTADDRMODE && - fcf->src_addr_mode == FRAME802154_SHORTADDRMODE) || - (fcf->dest_addr_mode == FRAME802154_SHORTADDRMODE && - fcf->src_addr_mode == FRAME802154_LONGADDRMODE) || - (fcf->dest_addr_mode == FRAME802154_LONGADDRMODE && - fcf->src_addr_mode == FRAME802154_SHORTADDRMODE))) { - src_pan_id = 1; - } - - } else { - /* No PAN ID in ACK */ - if(fcf->frame_type != FRAME802154_ACKFRAME) { - if(!fcf->panid_compression && (fcf->src_addr_mode & 3)) { - /* If compressed, don't include source PAN ID */ - src_pan_id = 1; - } - if(fcf->dest_addr_mode & 3) { - dest_pan_id = 1; - } - } - } - - if(has_src_pan_id != NULL) { - *has_src_pan_id = src_pan_id; - } - if(has_dest_pan_id != NULL) { - *has_dest_pan_id = dest_pan_id; - } -} -/*---------------------------------------------------------------------------*/ -/* Check if the destination PAN ID, if any, matches ours */ -int -frame802154_check_dest_panid(frame802154_t *frame) -{ - int has_dest_panid = 0; - - if(frame == NULL) { - return 0; - } - frame802154_has_panid(&frame->fcf, NULL, &has_dest_panid); - if(!has_dest_panid || - (frame->dest_pid != frame802154_get_pan_id() - && frame->dest_pid != FRAME802154_BROADCASTPANDID)) { - /* Packet to another PAN */ - return 0; - } - return 1; -} -/*---------------------------------------------------------------------------*/ -/* Check is the address is a broadcast address, whatever its size */ -int -frame802154_is_broadcast_addr(uint8_t mode, uint8_t *addr) -{ - int i = mode == FRAME802154_SHORTADDRMODE ? 2 : 8; - while(i-- > 0) { - if(addr[i] != 0xff) { - return 0; - } - } - return 1; -} -/*---------------------------------------------------------------------------*/ -/* Check and extract source and destination linkaddr from frame */ -int -frame802154_extract_linkaddr(frame802154_t *frame, - linkaddr_t *source_address, linkaddr_t *dest_address) -{ - int src_addr_len; - int dest_addr_len; - - if(frame == NULL) { - return 0; - } - /* Check and extract source address */ - src_addr_len = frame->fcf.src_addr_mode ? - ((frame->fcf.src_addr_mode == FRAME802154_SHORTADDRMODE) ? 2 : 8) : 0; - if(src_addr_len == 0 || frame802154_is_broadcast_addr(frame->fcf.src_addr_mode, frame->src_addr)) { - /* Broadcast address */ - if(source_address != NULL) { - linkaddr_copy(source_address, &linkaddr_null); - } - } else { - /* Unicast address */ - if(src_addr_len != LINKADDR_SIZE) { - /* Destination address has a size we can not handle */ - return 0; - } - if(source_address != NULL) { - linkaddr_copy(source_address, (linkaddr_t *)frame->src_addr); - } - } - - /* Check and extract destination address */ - dest_addr_len = frame->fcf.dest_addr_mode ? - ((frame->fcf.dest_addr_mode == FRAME802154_SHORTADDRMODE) ? 2 : 8) : 0; - if(dest_addr_len == 0 || frame802154_is_broadcast_addr(frame->fcf.dest_addr_mode, frame->dest_addr)) { - /* Broadcast address */ - if(dest_address != NULL) { - linkaddr_copy(dest_address, &linkaddr_null); - } - } else { - /* Unicast address */ - if(dest_addr_len != LINKADDR_SIZE) { - /* Destination address has a size we can not handle */ - return 0; - } - if(dest_address != NULL) { - linkaddr_copy(dest_address, (linkaddr_t *)frame->dest_addr); - } - } - - return 1; -} -/*----------------------------------------------------------------------------*/ -static void -field_len(frame802154_t *p, field_length_t *flen) -{ - int has_src_panid; - int has_dest_panid; - - /* init flen to zeros */ - memset(flen, 0, sizeof(field_length_t)); - - /* Determine lengths of each field based on fcf and other args */ - if((p->fcf.sequence_number_suppression & 1) == 0) { - flen->seqno_len = 1; - } - - /* IEEE802.15.4e changes the meaning of PAN ID Compression (see Table 2a). - * In this case, we leave the decision whether to compress PAN ID or not - * up to the caller. */ - if(p->fcf.frame_version < FRAME802154_IEEE802154_2015) { - /* Set PAN ID compression bit if src pan id matches dest pan id. */ - if((p->fcf.dest_addr_mode & 3) && (p->fcf.src_addr_mode & 3) && - p->src_pid == p->dest_pid) { - p->fcf.panid_compression = 1; - } else { - p->fcf.panid_compression = 0; - } - } - - frame802154_has_panid(&p->fcf, &has_src_panid, &has_dest_panid); - - if(has_src_panid) { - flen->src_pid_len = 2; - } - - if(has_dest_panid) { - flen->dest_pid_len = 2; - } - - /* determine address lengths */ - flen->dest_addr_len = addr_len(p->fcf.dest_addr_mode & 3); - flen->src_addr_len = addr_len(p->fcf.src_addr_mode & 3); - -#if LLSEC802154_USES_AUX_HEADER - /* Aux security header */ - if(p->fcf.security_enabled & 1) { - flen->aux_sec_len = 1; /* FCF + possibly frame counter and key ID */ - if(p->aux_hdr.security_control.frame_counter_suppression == 0) { - if(p->aux_hdr.security_control.frame_counter_size == 1) { - flen->aux_sec_len += 5; - } else { - flen->aux_sec_len += 4; - } - } -#if LLSEC802154_USES_EXPLICIT_KEYS - flen->aux_sec_len += get_key_id_len(p->aux_hdr.security_control.key_id_mode); -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ - ; - } -#endif /* LLSEC802154_USES_AUX_HEADER */ -} -/*----------------------------------------------------------------------------*/ -/** - * \brief Calculates the length of the frame header. This function is - * meant to be called by a higher level function, that interfaces to a MAC. - * - * \param p Pointer to frame802154_t_t struct, which specifies the - * frame to send. - * - * \return The length of the frame header. - */ -int -frame802154_hdrlen(frame802154_t *p) -{ - field_length_t flen; - field_len(p, &flen); - return 2 + flen.seqno_len + flen.dest_pid_len + flen.dest_addr_len + - flen.src_pid_len + flen.src_addr_len + flen.aux_sec_len; -} -void -frame802154_create_fcf(frame802154_fcf_t *fcf, uint8_t *buf) -{ - buf[0] = (fcf->frame_type & 7) | - ((fcf->security_enabled & 1) << 3) | - ((fcf->frame_pending & 1) << 4) | - ((fcf->ack_required & 1) << 5) | - ((fcf->panid_compression & 1) << 6); - buf[1] = ((fcf->sequence_number_suppression & 1)) | - ((fcf->ie_list_present & 1)) << 1 | - ((fcf->dest_addr_mode & 3) << 2) | - ((fcf->frame_version & 3) << 4) | - ((fcf->src_addr_mode & 3) << 6); -} -/*----------------------------------------------------------------------------*/ -/** - * \brief Creates a frame for transmission over the air. This function is - * meant to be called by a higher level function, that interfaces to a MAC. - * - * \param p Pointer to frame802154_t struct, which specifies the - * frame to send. - * - * \param buf Pointer to the buffer to use for the frame. - * - * \return The length of the frame header - */ -int -frame802154_create(frame802154_t *p, uint8_t *buf) -{ - int c; - field_length_t flen; - uint8_t pos; -#if LLSEC802154_USES_EXPLICIT_KEYS - uint8_t key_id_mode; -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ - - field_len(p, &flen); - - /* OK, now we have field lengths. Time to actually construct */ - /* the outgoing frame, and store it in buf */ - frame802154_create_fcf(&p->fcf, buf); - pos = 2; - - /* Sequence number */ - if(flen.seqno_len == 1) { - buf[pos++] = p->seq; - } - - /* Destination PAN ID */ - if(flen.dest_pid_len == 2) { - buf[pos++] = p->dest_pid & 0xff; - buf[pos++] = (p->dest_pid >> 8) & 0xff; - } - - /* Destination address */ - for(c = flen.dest_addr_len; c > 0; c--) { - buf[pos++] = p->dest_addr[c - 1]; - } - - /* Source PAN ID */ - if(flen.src_pid_len == 2) { - buf[pos++] = p->src_pid & 0xff; - buf[pos++] = (p->src_pid >> 8) & 0xff; - } - - /* Source address */ - for(c = flen.src_addr_len; c > 0; c--) { - buf[pos++] = p->src_addr[c - 1]; - } -#if LLSEC802154_USES_AUX_HEADER - /* Aux header */ - if(flen.aux_sec_len) { - buf[pos++] = p->aux_hdr.security_control.security_level -#if LLSEC802154_USES_EXPLICIT_KEYS - | (p->aux_hdr.security_control.key_id_mode << 3) -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ - | (p->aux_hdr.security_control.frame_counter_suppression << 5) - | (p->aux_hdr.security_control.frame_counter_size << 6) - ; - if(p->aux_hdr.security_control.frame_counter_suppression == 0) { - /* We support only 4-byte counters */ - memcpy(buf + pos, p->aux_hdr.frame_counter.u8, 4); - pos += 4; - if(p->aux_hdr.security_control.frame_counter_size == 1) { - pos++; - } - } - -#if LLSEC802154_USES_EXPLICIT_KEYS - key_id_mode = p->aux_hdr.security_control.key_id_mode; - if(key_id_mode) { - c = (key_id_mode - 1) * 4; - memcpy(buf + pos, p->aux_hdr.key_source.u8, c); - pos += c; - buf[pos++] = p->aux_hdr.key_index; - } -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ - } -#endif /* LLSEC802154_USES_AUX_HEADER */ - - return (int)pos; -} - -void -frame802154_parse_fcf(uint8_t *data, frame802154_fcf_t *pfcf) -{ - frame802154_fcf_t fcf; - - /* decode the FCF */ - fcf.frame_type = data[0] & 7; - fcf.security_enabled = (data[0] >> 3) & 1; - fcf.frame_pending = (data[0] >> 4) & 1; - fcf.ack_required = (data[0] >> 5) & 1; - fcf.panid_compression = (data[0] >> 6) & 1; - - fcf.sequence_number_suppression = data[1] & 1; - fcf.ie_list_present = (data[1] >> 1) & 1; - fcf.dest_addr_mode = (data[1] >> 2) & 3; - fcf.frame_version = (data[1] >> 4) & 3; - fcf.src_addr_mode = (data[1] >> 6) & 3; - - /* copy fcf */ - memcpy(pfcf, &fcf, sizeof(frame802154_fcf_t)); -} -/*----------------------------------------------------------------------------*/ -/** - * \brief Parses an input frame. Scans the input frame to find each - * section, and stores the information of each section in a - * frame802154_t structure. - * - * \param data The input data from the radio chip. - * \param len The size of the input data - * \param pf The frame802154_t struct to store the parsed frame information. - */ -int -frame802154_parse(uint8_t *data, int len, frame802154_t *pf) -{ - uint8_t *p; - frame802154_fcf_t fcf; - int c; - int has_src_panid; - int has_dest_panid; -#if LLSEC802154_USES_EXPLICIT_KEYS - uint8_t key_id_mode; -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ - - if(len < 2) { - return 0; - } - - p = data; - - /* decode the FCF */ - frame802154_parse_fcf(p, &fcf); - memcpy(&pf->fcf, &fcf, sizeof(frame802154_fcf_t)); - p += 2; /* Skip first two bytes */ - - if(fcf.sequence_number_suppression == 0) { - pf->seq = p[0]; - p++; - } - - frame802154_has_panid(&fcf, &has_src_panid, &has_dest_panid); - - /* Destination address, if any */ - if(fcf.dest_addr_mode) { - if(has_dest_panid) { - /* Destination PAN */ - pf->dest_pid = p[0] + (p[1] << 8); - p += 2; - } else { - pf->dest_pid = 0; - } - - /* Destination address */ -/* l = addr_len(fcf.dest_addr_mode); */ -/* for(c = 0; c < l; c++) { */ -/* pf->dest_addr.u8[c] = p[l - c - 1]; */ -/* } */ -/* p += l; */ - if(fcf.dest_addr_mode == FRAME802154_SHORTADDRMODE) { - linkaddr_copy((linkaddr_t *)&(pf->dest_addr), &linkaddr_null); - pf->dest_addr[0] = p[1]; - pf->dest_addr[1] = p[0]; - p += 2; - } else if(fcf.dest_addr_mode == FRAME802154_LONGADDRMODE) { - for(c = 0; c < 8; c++) { - pf->dest_addr[c] = p[7 - c]; - } - p += 8; - } - } else { - linkaddr_copy((linkaddr_t *)&(pf->dest_addr), &linkaddr_null); - pf->dest_pid = 0; - } - - /* Source address, if any */ - if(fcf.src_addr_mode) { - /* Source PAN */ - if(has_src_panid) { - pf->src_pid = p[0] + (p[1] << 8); - p += 2; - if(!has_dest_panid) { - pf->dest_pid = pf->src_pid; - } - } else { - pf->src_pid = pf->dest_pid; - } - - /* Source address */ -/* l = addr_len(fcf.src_addr_mode); */ -/* for(c = 0; c < l; c++) { */ -/* pf->src_addr.u8[c] = p[l - c - 1]; */ -/* } */ -/* p += l; */ - if(fcf.src_addr_mode == FRAME802154_SHORTADDRMODE) { - linkaddr_copy((linkaddr_t *)&(pf->src_addr), &linkaddr_null); - pf->src_addr[0] = p[1]; - pf->src_addr[1] = p[0]; - p += 2; - } else if(fcf.src_addr_mode == FRAME802154_LONGADDRMODE) { - for(c = 0; c < 8; c++) { - pf->src_addr[c] = p[7 - c]; - } - p += 8; - } - } else { - linkaddr_copy((linkaddr_t *)&(pf->src_addr), &linkaddr_null); - pf->src_pid = 0; - } - -#if LLSEC802154_USES_AUX_HEADER - if(fcf.security_enabled) { - pf->aux_hdr.security_control.security_level = p[0] & 7; -#if LLSEC802154_USES_EXPLICIT_KEYS - pf->aux_hdr.security_control.key_id_mode = (p[0] >> 3) & 3; -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ - pf->aux_hdr.security_control.frame_counter_suppression = p[0] >> 5; - pf->aux_hdr.security_control.frame_counter_size = p[0] >> 6; - p += 1; - - if(pf->aux_hdr.security_control.frame_counter_suppression == 0) { - memcpy(pf->aux_hdr.frame_counter.u8, p, 4); - p += 4; - if(pf->aux_hdr.security_control.frame_counter_size == 1) { - p ++; - } - } - -#if LLSEC802154_USES_EXPLICIT_KEYS - key_id_mode = pf->aux_hdr.security_control.key_id_mode; - if(key_id_mode) { - c = (key_id_mode - 1) * 4; - memcpy(pf->aux_hdr.key_source.u8, p, c); - p += c; - pf->aux_hdr.key_index = p[0]; - p += 1; - } -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ - } -#endif /* LLSEC802154_USES_AUX_HEADER */ - - /* header length */ - c = p - data; - /* payload length */ - pf->payload_len = (len - c); - /* payload */ - pf->payload = p; - - /* return header length if successful */ - return c > len ? 0 : c; -} -/** \} */ diff --git a/os/net/mac/framer/frame802154.h b/os/net/mac/framer/frame802154.h deleted file mode 100644 index 4c3c2f967..000000000 --- a/os/net/mac/framer/frame802154.h +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science - * All rights reserved. - * - * Additional fixes for AVR contributed by: - * Colin O'Flynn coflynn@newae.com - * Eric Gnoske egnoske@gmail.com - * Blake Leverett bleverett@gmail.com - * Mike Vidales mavida404@gmail.com - * Kevin Brown kbrown3@uccs.edu - * Nate Bohlmann nate@elfwerks.com - * - * Additional fixes for MSP430 contributed by: - * Joakim Eriksson - * Niclas Finne - * Nicolas Tsiftes - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * 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. - * * Neither the name of the copyright holders nor the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * \addtogroup link-layer - * @{ - */ - -/** - * \defgroup frame802154 802.15.4 frame creation and parsing - * @{ - */ -/** - * \file - * \brief 802.15.4 frame creation and parsing functions - * - * This file converts to and from a structure to a packed 802.15.4 - * frame. - * - */ - -/* Includes */ -#ifndef FRAME_802154_H -#define FRAME_802154_H - -#include "contiki.h" -#include "net/linkaddr.h" - -#ifdef IEEE802154_CONF_PANID -#define IEEE802154_PANID IEEE802154_CONF_PANID -#else /* IEEE802154_CONF_PANID */ -#define IEEE802154_PANID 0xABCD -#endif /* IEEE802154_CONF_PANID */ - -#ifdef FRAME802154_CONF_VERSION -#define FRAME802154_VERSION FRAME802154_CONF_VERSION -#else /* FRAME802154_CONF_VERSION */ -/* Use frame v2 if TSCH is used, otherwise stick to v1 (more -frame-filtering-friendly on some platforms) */ -#if MAC_CONF_WITH_TSCH -#define FRAME802154_VERSION FRAME802154_IEEE802154_2015 -#else /* MAC_CONF_WITH_TSCH */ -#define FRAME802154_VERSION FRAME802154_IEEE802154_2006 -#endif /* MAC_CONF_WITH_TSCH */ -#endif /* FRAME802154_CONF_VERSION */ - -#ifdef FRAME802154_CONF_SUPPR_SEQNO -#define FRAME802154_SUPPR_SEQNO FRAME802154_CONF_SUPPR_SEQNO -#else /* FRAME802154_CONF_SUPPR_SEQNO */ -#define FRAME802154_SUPPR_SEQNO 0 -#endif /* FRAME802154_CONF_SUPPR_SEQNO */ - -/* Macros & Defines */ - -/** \brief These are some definitions of values used in the FCF. See the 802.15.4 spec for details. - * \name FCF element values definitions - * @{ - */ -#define FRAME802154_BEACONFRAME (0x00) -#define FRAME802154_DATAFRAME (0x01) -#define FRAME802154_ACKFRAME (0x02) -#define FRAME802154_CMDFRAME (0x03) - -#define FRAME802154_BEACONREQ (0x07) - -#define FRAME802154_IEEERESERVED (0x00) -#define FRAME802154_NOADDR (0x00) /**< Only valid for ACK or Beacon frames. */ -#define FRAME802154_SHORTADDRMODE (0x02) -#define FRAME802154_LONGADDRMODE (0x03) - -#define FRAME802154_NOBEACONS (0x0F) - -#define FRAME802154_BROADCASTADDR (0xFFFF) -#define FRAME802154_BROADCASTPANDID (0xFFFF) - -#define FRAME802154_IEEE802154_2003 (0x00) -#define FRAME802154_IEEE802154_2006 (0x01) -#define FRAME802154_IEEE802154_2015 (0x02) - -#define FRAME802154_SECURITY_LEVEL_NONE (0) -#define FRAME802154_SECURITY_LEVEL_MIC_32 (1) -#define FRAME802154_SECURITY_LEVEL_MIC_64 (2) -#define FRAME802154_SECURITY_LEVEL_MIC_128 (3) -#define FRAME802154_SECURITY_LEVEL_ENC (4) -#define FRAME802154_SECURITY_LEVEL_ENC_MIC_32 (5) -#define FRAME802154_SECURITY_LEVEL_ENC_MIC_64 (6) -#define FRAME802154_SECURITY_LEVEL_ENC_MIC_128 (7) - -#define FRAME802154_IMPLICIT_KEY (0) -#define FRAME802154_1_BYTE_KEY_ID_MODE (1) -#define FRAME802154_5_BYTE_KEY_ID_MODE (2) -#define FRAME802154_9_BYTE_KEY_ID_MODE (3) - -/** - * @brief The IEEE 802.15.4 frame has a number of constant/fixed fields that - * can be counted to make frame construction and max payload - * calculations easier. - * - * These include: - * 1. FCF - 2 bytes - Fixed - * 2. Sequence number - 1 byte - Fixed - * 3. Addressing fields - 4 - 20 bytes - Variable - * 4. Aux security header - 0 - 14 bytes - Variable - * 5. CRC - 2 bytes - Fixed - */ - -/** - * \brief Defines the bitfields of the frame control field (FCF). - */ -typedef struct { - uint8_t frame_type; /**< 3 bit. Frame type field, see 802.15.4 */ - uint8_t security_enabled; /**< 1 bit. True if security is used in this frame */ - uint8_t frame_pending; /**< 1 bit. True if sender has more data to send */ - uint8_t ack_required; /**< 1 bit. Is an ack frame required? */ - uint8_t panid_compression; /**< 1 bit. Is this a compressed header? */ - /* uint8_t reserved; */ /**< 1 bit. Unused bit */ - uint8_t sequence_number_suppression; /**< 1 bit. Does the header omit sequence number?, see 802.15.4e */ - uint8_t ie_list_present; /**< 1 bit. Does the header contain Information Elements?, see 802.15.4e */ - uint8_t dest_addr_mode; /**< 2 bit. Destination address mode, see 802.15.4 */ - uint8_t frame_version; /**< 2 bit. 802.15.4 frame version */ - uint8_t src_addr_mode; /**< 2 bit. Source address mode, see 802.15.4 */ -} frame802154_fcf_t; - -/** \brief 802.15.4 security control bitfield. See section 7.6.2.2.1 in 802.15.4 specification */ -typedef struct { - uint8_t security_level; /**< 3 bit. security level */ - uint8_t key_id_mode; /**< 2 bit. Key identifier mode */ - uint8_t frame_counter_suppression; /**< 1 bit. Frame counter suppression */ - uint8_t frame_counter_size; /**< 1 bit. Frame counter size (0: 4 bytes, 1: 5 bytes) */ - uint8_t reserved; /**< 3 bit. Reserved bits */ -} frame802154_scf_t; - -typedef union { - uint32_t u32; - uint16_t u16[2]; - uint8_t u8[4]; -} frame802154_frame_counter_t; - -typedef union { - uint16_t u16[4]; - uint8_t u8[8]; -} frame802154_key_source_t; - -/** \brief 802.15.4 Aux security header */ -typedef struct { - frame802154_scf_t security_control; /**< Security control bitfield */ - frame802154_frame_counter_t frame_counter; /**< Frame counter, used for security */ - frame802154_key_source_t key_source; /**< Key Source subfield */ - uint8_t key_index; /**< Key Index subfield */ -} frame802154_aux_hdr_t; - -/** \brief Parameters used by the frame802154_create() function. These - * parameters are used in the 802.15.4 frame header. See the 802.15.4 - * specification for details. - */ -typedef struct { - /* The fields dest_addr and src_addr must come first to ensure they are aligned to the - * CPU word size. Needed as they are accessed directly as linkaddr_t*. Note we cannot use - * the type linkaddr_t directly here, as we always need 8 bytes, not LINKADDR_SIZE bytes. */ - uint8_t dest_addr[8]; /**< Destination address */ - uint8_t src_addr[8]; /**< Source address */ - frame802154_fcf_t fcf; /**< Frame control field */ - uint8_t seq; /**< Sequence number */ - uint16_t dest_pid; /**< Destination PAN ID */ - uint16_t src_pid; /**< Source PAN ID */ - frame802154_aux_hdr_t aux_hdr; /**< Aux security header */ - uint8_t *payload; /**< Pointer to 802.15.4 payload */ - int payload_len; /**< Length of payload field */ -} frame802154_t; - -/* Prototypes */ - -int frame802154_hdrlen(frame802154_t *p); -void frame802154_create_fcf(frame802154_fcf_t *fcf, uint8_t *buf); -int frame802154_create(frame802154_t *p, uint8_t *buf); -int frame802154_parse(uint8_t *data, int length, frame802154_t *pf); -void frame802154_parse_fcf(uint8_t *data, frame802154_fcf_t *pfcf); - -/* Get current PAN ID */ -uint16_t frame802154_get_pan_id(void); -/* Set current PAN ID */ -void frame802154_set_pan_id(uint16_t pan_id); -/* Tells whether a given Frame Control Field indicates a frame with - * source PANID and/or destination PANID */ -void frame802154_has_panid(frame802154_fcf_t *fcf, int *has_src_pan_id, int *has_dest_pan_id); -/* Check if the destination PAN ID, if any, matches ours */ -int frame802154_check_dest_panid(frame802154_t *frame); -/* Check is the address is a broadcast address, whatever its size */ -int frame802154_is_broadcast_addr(uint8_t mode, uint8_t *addr); -/* Check and extract source and destination linkaddr from frame */ -int frame802154_extract_linkaddr(frame802154_t *frame, linkaddr_t *source_address, linkaddr_t *dest_address); - -/** @} */ -#endif /* FRAME_802154_H */ -/** @} */ -/** @} */ diff --git a/os/net/mac/framer/frame802154e-ie.c b/os/net/mac/framer/frame802154e-ie.c deleted file mode 100644 index 7e7f67d86..000000000 --- a/os/net/mac/framer/frame802154e-ie.c +++ /dev/null @@ -1,631 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * IEEE 802.15.4e Information Element (IE) creation and parsing. - * \author - * Simon Duquennoy - */ - -#include -#include "net/mac/framer/frame802154e-ie.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Frame 15.4" -#define LOG_LEVEL LOG_LEVEL_FRAMER - -/* c.f. IEEE 802.15.4e Table 4b */ -enum ieee802154e_header_ie_id { - HEADER_IE_LE_CSL = 0x1a, - HEADER_IE_LE_RIT, - HEADER_IE_DSME_PAN_DESCRIPTOR, - HEADER_IE_RZ_TIME, - HEADER_IE_ACK_NACK_TIME_CORRECTION, - HEADER_IE_GACK, - HEADER_IE_LOW_LATENCY_NETWORK_INFO, - HEADER_IE_LIST_TERMINATION_1 = 0x7e, - HEADER_IE_LIST_TERMINATION_2 = 0x7f, -}; - -/* c.f. IEEE 802.15.4e Table 4c */ -enum ieee802154e_payload_ie_id { - PAYLOAD_IE_ESDU = 0, - PAYLOAD_IE_MLME, - PAYLOAD_IE_IETF = 0x5, - PAYLOAD_IE_LIST_TERMINATION = 0xf, -}; - -/* c.f. IEEE 802.15.4e Table 4d */ -enum ieee802154e_mlme_short_subie_id { - MLME_SHORT_IE_TSCH_SYNCHRONIZATION = 0x1a, - MLME_SHORT_IE_TSCH_SLOFTRAME_AND_LINK, - MLME_SHORT_IE_TSCH_TIMESLOT, - MLME_SHORT_IE_TSCH_HOPPING_TIMING, - MLME_SHORT_IE_TSCH_EB_FILTER, - MLME_SHORT_IE_TSCH_MAC_METRICS_1, - MLME_SHORT_IE_TSCH_MAC_METRICS_2, -}; - -/* c.f. IEEE 802.15.4e Table 4e */ -enum ieee802154e_mlme_long_subie_id { - MLME_LONG_IE_TSCH_CHANNEL_HOPPING_SEQUENCE = 0x9, -}; - -#include -enum ieee802154e_ietf_subie_id { - IETF_IE_6TOP = SIXTOP_SUBIE_ID, -}; - -#define WRITE16(buf, val) \ - do { ((uint8_t *)(buf))[0] = (val) & 0xff; \ - ((uint8_t *)(buf))[1] = ((val) >> 8) & 0xff; } while(0); - -#define READ16(buf, var) \ - (var) = ((uint8_t *)(buf))[0] | ((uint8_t *)(buf))[1] << 8 - -/* Create a header IE 2-byte descriptor */ -static void -create_header_ie_descriptor(uint8_t *buf, uint8_t element_id, int ie_len) -{ - uint16_t ie_desc; - /* Header IE descriptor: b0-6: len, b7-14: element id:, b15: type: 0 */ - ie_desc = (ie_len & 0x7f) + ((element_id & 0xff) << 7); - WRITE16(buf, ie_desc); -} - -/* Create a payload IE 2-byte descriptor */ -static void -create_payload_ie_descriptor(uint8_t *buf, uint8_t group_id, int ie_len) -{ - uint16_t ie_desc; - /* MLME Long IE descriptor: b0-10: len, b11-14: group id:, b15: type: 1 */ - ie_desc = (ie_len & 0x07ff) + ((group_id & 0x0f) << 11) + (1 << 15); - WRITE16(buf, ie_desc); -} - -/* Create a MLME short IE 2-byte descriptor */ -static void -create_mlme_short_ie_descriptor(uint8_t *buf, uint8_t sub_id, int ie_len) -{ - uint16_t ie_desc; - /* MLME Short IE descriptor: b0-7: len, b8-14: sub id:, b15: type: 0 */ - ie_desc = (ie_len & 0xff) + ((sub_id & 0x7f) << 8); - WRITE16(buf, ie_desc); -} - -/* Create a MLME long IE 2-byte descriptor */ -static void -create_mlme_long_ie_descriptor(uint8_t *buf, uint8_t sub_id, int ie_len) -{ - uint16_t ie_desc; - /* MLME Long IE descriptor: b0-10: len, b11-14: sub id:, b15: type: 1 */ - ie_desc = (ie_len & 0x07ff) + ((sub_id & 0x0f) << 11) + (1 << 15); - WRITE16(buf, ie_desc); -} - -/* Header IE. ACK/NACK time correction. Used in enhanced ACKs */ -int -frame80215e_create_ie_header_ack_nack_time_correction(uint8_t *buf, int len, - struct ieee802154_ies *ies) -{ - int ie_len = 2; - if(len >= 2 + ie_len && ies != NULL) { - int16_t drift_us; - uint16_t time_sync_field; - drift_us = ies->ie_time_correction; - time_sync_field = drift_us & 0x0fff; - if(ies->ie_is_nack) { - time_sync_field |= 0x8000; - } - WRITE16(buf+2, time_sync_field); - create_header_ie_descriptor(buf, HEADER_IE_ACK_NACK_TIME_CORRECTION, ie_len); - return 2 + ie_len; - } else { - return -1; - } -} - -/* Header IE. List termination 1 (Signals the end of the Header IEs when - * followed by payload IEs) */ -int -frame80215e_create_ie_header_list_termination_1(uint8_t *buf, int len, - struct ieee802154_ies *ies) -{ - int ie_len = 0; - if(len >= 2 + ie_len && ies != NULL) { - create_header_ie_descriptor(buf, HEADER_IE_LIST_TERMINATION_1, 0); - return 2 + ie_len; - } else { - return -1; - } -} - -/* Header IE. List termination 2 (Signals the end of the Header IEs when - * followed by an unformatted payload) */ -int -frame80215e_create_ie_header_list_termination_2(uint8_t *buf, int len, - struct ieee802154_ies *ies) -{ - int ie_len = 0; - if(len >= 2 + ie_len && ies != NULL) { - create_header_ie_descriptor(buf, HEADER_IE_LIST_TERMINATION_2, 0); - return 2 + ie_len; - } else { - return -1; - } -} - -/* Payload IE. List termination */ -int -frame80215e_create_ie_payload_list_termination(uint8_t *buf, int len, - struct ieee802154_ies *ies) -{ - int ie_len = 0; - if(len >= 2 + ie_len && ies != NULL) { - create_payload_ie_descriptor(buf, PAYLOAD_IE_LIST_TERMINATION, 0); - return 2 + ie_len; - } else { - return -1; - } -} - -#if TSCH_WITH_SIXTOP -/* Payload IE. 6top. Used to nest sub-IEs */ -int -frame80215e_create_ie_ietf(uint8_t *buf, int len, struct ieee802154_ies *ies) -{ - if(len >= 2 && ies != NULL) { - create_payload_ie_descriptor(buf, - PAYLOAD_IE_IETF, - ies->sixtop_ie_content_len); - return 2 + ies->sixtop_ie_content_len; - } - return -1; -} -#endif /* TSCH_WITH_SIXTOP */ - -/* Payload IE. MLME. Used to nest sub-IEs */ -int -frame80215e_create_ie_mlme(uint8_t *buf, int len, - struct ieee802154_ies *ies) -{ - int ie_len = 0; - if(len >= 2 + ie_len && ies != NULL) { - /* The length of the outer MLME IE is the total length of sub-IEs */ - create_payload_ie_descriptor(buf, PAYLOAD_IE_MLME, ies->ie_mlme_len); - return 2 + ie_len; - } else { - return -1; - } -} - -/* MLME sub-IE. TSCH synchronization. Used in EBs: ASN and join priority */ -int -frame80215e_create_ie_tsch_synchronization(uint8_t *buf, int len, - struct ieee802154_ies *ies) -{ - int ie_len = 6; - if(len >= 2 + ie_len && ies != NULL) { - buf[2] = ies->ie_asn.ls4b; - buf[3] = ies->ie_asn.ls4b >> 8; - buf[4] = ies->ie_asn.ls4b >> 16; - buf[5] = ies->ie_asn.ls4b >> 24; - buf[6] = ies->ie_asn.ms1b; - buf[7] = ies->ie_join_priority; - create_mlme_short_ie_descriptor(buf, MLME_SHORT_IE_TSCH_SYNCHRONIZATION, ie_len); - return 2 + ie_len; - } else { - return -1; - } -} - -/* MLME sub-IE. TSCH slotframe and link. Used in EBs: initial schedule */ -int -frame80215e_create_ie_tsch_slotframe_and_link(uint8_t *buf, int len, - struct ieee802154_ies *ies) -{ - if(ies != NULL) { - int i; - int num_slotframes = ies->ie_tsch_slotframe_and_link.num_slotframes; - int num_links = ies->ie_tsch_slotframe_and_link.num_links; - int ie_len = 1 + num_slotframes * (4 + 5 * num_links); - if(num_slotframes > 1 || num_links > FRAME802154E_IE_MAX_LINKS - || len < 2 + ie_len) { - /* We support only 0 or 1 slotframe in this IE and a predefined maximum number of links */ - return -1; - } - /* Insert IE */ - buf[2] = num_slotframes; - /* Insert slotframe */ - if(num_slotframes == 1) { - buf[2 + 1] = ies->ie_tsch_slotframe_and_link.slotframe_handle; - WRITE16(buf + 2 + 2, ies->ie_tsch_slotframe_and_link.slotframe_size); - buf[2 + 4] = num_links; - /* Loop over links */ - for(i = 0; i < num_links; i++) { - /* Insert links */ - WRITE16(buf + 2 + 5 + i * 5, ies->ie_tsch_slotframe_and_link.links[i].timeslot); - WRITE16(buf + 2 + 5 + i * 5 + 2, ies->ie_tsch_slotframe_and_link.links[i].channel_offset); - buf[2 + 5 + i * 5 + 4] = ies->ie_tsch_slotframe_and_link.links[i].link_options; - } - } - create_mlme_short_ie_descriptor(buf, MLME_SHORT_IE_TSCH_SLOFTRAME_AND_LINK, ie_len); - return 2 + ie_len; - } else { - return -1; - } -} - -/* MLME sub-IE. TSCH timeslot. Used in EBs: timeslot template (timing) */ -int -frame80215e_create_ie_tsch_timeslot(uint8_t *buf, int len, - struct ieee802154_ies *ies) -{ - int ie_len; - if(ies == NULL) { - return -1; - } - /* Only ID if ID == 0, else full timing description */ - ie_len = ies->ie_tsch_timeslot_id == 0 ? 1 : 25; - if(len >= 2 + ie_len) { - buf[2] = ies->ie_tsch_timeslot_id; - if(ies->ie_tsch_timeslot_id != 0) { - int i; - for(i = 0; i < tsch_ts_elements_count; i++) { - WRITE16(buf + 3 + 2 * i, ies->ie_tsch_timeslot[i]); - } - } - create_mlme_short_ie_descriptor(buf, MLME_SHORT_IE_TSCH_TIMESLOT, ie_len); - return 2 + ie_len; - } else { - return -1; - } -} - -/* MLME sub-IE. TSCH channel hopping sequence. Used in EBs: hopping sequence */ -int -frame80215e_create_ie_tsch_channel_hopping_sequence(uint8_t *buf, int len, - struct ieee802154_ies *ies) -{ - int ie_len; - if(ies == NULL || ies->ie_hopping_sequence_len > sizeof(ies->ie_hopping_sequence_list)) { - return -1; - } - ie_len = ies->ie_channel_hopping_sequence_id == 0 ? 1 : 12 + ies->ie_hopping_sequence_len; - if(len >= 2 + ie_len && ies != NULL) { - buf[2] = ies->ie_channel_hopping_sequence_id; - buf[3] = 0; /* channel page */ - WRITE16(buf + 4, 0); /* number of channels */ - WRITE16(buf + 6, 0); /* phy configuration */ - WRITE16(buf + 8, 0); - /* Extended bitmap. Size: 0 */ - WRITE16(buf + 10, ies->ie_hopping_sequence_len); /* sequence len */ - memcpy(buf + 12, ies->ie_hopping_sequence_list, ies->ie_hopping_sequence_len); /* sequence list */ - WRITE16(buf + 12 + ies->ie_hopping_sequence_len, 0); /* current hop */ - create_mlme_long_ie_descriptor(buf, MLME_LONG_IE_TSCH_CHANNEL_HOPPING_SEQUENCE, ie_len); - return 2 + ie_len; - } else { - return -1; - } -} - -/* Parse a header IE */ -static int -frame802154e_parse_header_ie(const uint8_t *buf, int len, - uint8_t element_id, struct ieee802154_ies *ies) -{ - switch(element_id) { - case HEADER_IE_ACK_NACK_TIME_CORRECTION: - if(len == 2) { - if(ies != NULL) { - /* If the originator was a time source neighbor, the receiver adjust - * its own clock by incorporating the received drift correction */ - uint16_t time_sync_field = 0; - int16_t drift_us = 0; - /* Extract drift correction from Sync-IE, cast from 12 to 16-bit, - * and convert it to RTIMER ticks. - * See page 88 in IEEE Std 802.15.4e-2012. */ - READ16(buf, time_sync_field); - /* First extract NACK */ - ies->ie_is_nack = (time_sync_field & (uint16_t)0x8000) ? 1 : 0; - /* Then cast from 12 to 16 bit signed */ - if(time_sync_field & 0x0800) { /* Negative integer */ - drift_us = time_sync_field | 0xf000; - } else { /* Positive integer */ - drift_us = time_sync_field & 0x0fff; - } - /* Convert to RTIMER ticks */ - ies->ie_time_correction = drift_us; - } - return len; - } - break; - } - return -1; -} - -/* Parse a MLME short IE */ -static int -frame802154e_parse_mlme_short_ie(const uint8_t *buf, int len, - uint8_t sub_id, struct ieee802154_ies *ies) -{ - switch(sub_id) { - case MLME_SHORT_IE_TSCH_SLOFTRAME_AND_LINK: - if(len >= 1) { - int i; - int num_slotframes = buf[0]; - int num_links = buf[4]; - if(num_slotframes == 0) { - return len; - } - if(num_slotframes <= 1 && num_links <= FRAME802154E_IE_MAX_LINKS - && len == 1 + num_slotframes * (4 + 5 * num_links)) { - if(ies != NULL) { - /* We support only 0 or 1 slotframe in this IE and a predefined maximum number of links */ - ies->ie_tsch_slotframe_and_link.num_slotframes = buf[0]; - ies->ie_tsch_slotframe_and_link.slotframe_handle = buf[1]; - READ16(buf + 2, ies->ie_tsch_slotframe_and_link.slotframe_size); - ies->ie_tsch_slotframe_and_link.num_links = buf[4]; - for(i = 0; i < num_links; i++) { - READ16(buf + 5 + i * 5, ies->ie_tsch_slotframe_and_link.links[i].timeslot); - READ16(buf + 5 + i * 5 + 2, ies->ie_tsch_slotframe_and_link.links[i].channel_offset); - ies->ie_tsch_slotframe_and_link.links[i].link_options = buf[5 + i * 5 + 4]; - } - } - return len; - } - } - break; - case MLME_SHORT_IE_TSCH_SYNCHRONIZATION: - if(len == 6) { - if(ies != NULL) { - ies->ie_asn.ls4b = (uint32_t)buf[0]; - ies->ie_asn.ls4b |= (uint32_t)buf[1] << 8; - ies->ie_asn.ls4b |= (uint32_t)buf[2] << 16; - ies->ie_asn.ls4b |= (uint32_t)buf[3] << 24; - ies->ie_asn.ms1b = (uint8_t)buf[4]; - ies->ie_join_priority = (uint8_t)buf[5]; - } - return len; - } - break; - case MLME_SHORT_IE_TSCH_TIMESLOT: - if(len == 1 || len == 25) { - if(ies != NULL) { - ies->ie_tsch_timeslot_id = buf[0]; - if(len == 25) { - int i; - for(i = 0; i < tsch_ts_elements_count; i++) { - READ16(buf+1+2*i, ies->ie_tsch_timeslot[i]); - } - } - } - return len; - } - break; - } - return -1; -} - -/* Parse a MLME long IE */ -static int -frame802154e_parse_mlme_long_ie(const uint8_t *buf, int len, - uint8_t sub_id, struct ieee802154_ies *ies) -{ - switch(sub_id) { - case MLME_LONG_IE_TSCH_CHANNEL_HOPPING_SEQUENCE: - if(len > 0) { - if(ies != NULL) { - ies->ie_channel_hopping_sequence_id = buf[0]; - if(len > 1) { - READ16(buf+8, ies->ie_hopping_sequence_len); /* sequence len */ - if(ies->ie_hopping_sequence_len <= sizeof(ies->ie_hopping_sequence_list) - && len == 12 + ies->ie_hopping_sequence_len) { - memcpy(ies->ie_hopping_sequence_list, buf+10, ies->ie_hopping_sequence_len); /* sequence list */ - } - } - } - return len; - } - break; - } - return -1; -} - -/* Parse all IEEE 802.15.4e Information Elements (IE) from a frame */ -int -frame802154e_parse_information_elements(const uint8_t *buf, uint8_t buf_size, - struct ieee802154_ies *ies) -{ - const uint8_t *start = buf; - uint16_t ie_desc; - uint8_t type; - uint8_t id; - uint16_t len = 0; - int nested_mlme_len = 0; - enum {PARSING_HEADER_IE, PARSING_PAYLOAD_IE, PARSING_MLME_SUBIE} parsing_state; - - if(ies == NULL) { - return -1; - } - - /* Always look for a header IE first (at least "list termination 1") */ - parsing_state = PARSING_HEADER_IE; - ies->ie_payload_ie_offset = 0; - - /* Loop over all IEs */ - while(buf_size > 0) { - if(buf_size < 2) { /* Not enough space for IE descriptor */ - return -1; - } - READ16(buf, ie_desc); - buf_size -= 2; - buf += 2; - type = ie_desc & 0x8000 ? 1 : 0; /* b15 */ - LOG_DBG("ie type %u, current state %u\n", type, parsing_state); - - switch(parsing_state) { - case PARSING_HEADER_IE: - if(type != 0) { - LOG_ERR("header ie: wrong type %04x\n", ie_desc); - return -1; - } - /* Header IE: 2 bytes descriptor, c.f. fig 48n in IEEE 802.15.4e */ - len = ie_desc & 0x007f; /* b0-b6 */ - id = (ie_desc & 0x7f80) >> 7; /* b7-b14 */ - LOG_DBG("header ie: len %u id %x\n", len, id); - switch(id) { - case HEADER_IE_LIST_TERMINATION_1: - if(len == 0) { - /* End of payload IE list, now expect payload IEs */ - parsing_state = PARSING_PAYLOAD_IE; - ies->ie_payload_ie_offset = buf - start; /* Save IE header len */ - LOG_DBG("list termination 1, look for payload IEs\n"); - } else { - LOG_ERR("list termination 1, wrong len %u\n", len); - return -1; - } - break; - case HEADER_IE_LIST_TERMINATION_2: - /* End of IE parsing */ - if(len == 0) { - ies->ie_payload_ie_offset = buf - start; /* Save IE header len */ - LOG_DBG("list termination 2\n"); - return buf + len - start; - } else { - LOG_ERR("list termination 2, wrong len %u\n", len); - return -1; - } - default: - if(len > buf_size || frame802154e_parse_header_ie(buf, len, id, ies) == -1) { - LOG_ERR("failed to parse\n"); - return -1; - } - break; - } - break; - case PARSING_PAYLOAD_IE: - if(type != 1) { - LOG_ERR("payload ie: wrong type %04x\n", ie_desc); - return -1; - } - /* Payload IE: 2 bytes descriptor, c.f. fig 48o in IEEE 802.15.4e */ - len = ie_desc & 0x7ff; /* b0-b10 */ - id = (ie_desc & 0x7800) >> 11; /* b11-b14 */ - LOG_DBG("payload ie: len %u id %x\n", len, id); - switch(id) { - case PAYLOAD_IE_MLME: - /* Now expect 'len' bytes of MLME sub-IEs */ - parsing_state = PARSING_MLME_SUBIE; - nested_mlme_len = len; - len = 0; /* Reset len as we want to read subIEs and not jump over them */ - LOG_DBG("entering MLME ie with len %u\n", nested_mlme_len); - break; -#if TSCH_WITH_SIXTOP - case PAYLOAD_IE_IETF: - switch(*buf) { - case IETF_IE_6TOP: - /* - * buf points to the Sub-ID field, a one-octet field, now; - * advance it by one and use the result as the head pointer of - * 6top IE Content. - */ - ies->sixtop_ie_content_ptr = buf + 1; - /* - * Similarly as above, subtract 1 (one octet) from len, which - * includes the length of Sub-ID field, and use the result as - * the length of 6top IE Content. - */ - ies->sixtop_ie_content_len = len - 1; - break; - default: - LOG_ERR("frame802154e: unsupported IETF sub-IE %u\n", *buf); - break; - } - break; -#endif /* TSCH_WITH_SIXTOP */ - case PAYLOAD_IE_LIST_TERMINATION: - LOG_DBG("payload ie list termination %u\n", len); - return (len == 0) ? buf + len - start : -1; - default: - LOG_ERR("non-supported payload ie\n"); - return -1; - } - break; - case PARSING_MLME_SUBIE: - /* MLME sub-IE: 2 bytes descriptor, c.f. fig 48q in IEEE 802.15.4e */ - /* type == 0 means short sub-IE, type == 1 means long sub-IE */ - if(type == 0) { - /* Short sub-IE, c.f. fig 48r in IEEE 802.15.4e */ - len = ie_desc & 0x00ff; /* b0-b7 */ - id = (ie_desc & 0x7f00) >> 8; /* b8-b14 */ - LOG_DBG("short mlme ie len %u id %x\n", len, id); - if(len > buf_size || frame802154e_parse_mlme_short_ie(buf, len, id, ies) == -1) { - LOG_ERR("failed to parse ie\n"); - return -1; - } - } else { - /* Long sub-IE, c.f. fig 48s in IEEE 802.15.4e */ - len = ie_desc & 0x7ff; /* b0-b10 */ - id = (ie_desc & 0x7800) >> 11; /* b11-b14 */ - LOG_DBG("long mlme ie len %u id %x\n", len, id); - if(len > buf_size || frame802154e_parse_mlme_long_ie(buf, len, id, ies) == -1) { - LOG_ERR("failed to parse ie\n"); - return -1; - } - } - /* Update remaining nested MLME len */ - nested_mlme_len -= 2 + len; - if(nested_mlme_len < 0) { - LOG_ERR("found more sub-IEs than initially advertised\n"); - /* We found more sub-IEs than initially advertised */ - return -1; - } - if(nested_mlme_len == 0) { - LOG_DBG("end of MLME IE parsing\n"); - /* End of IE parsing, look for another payload IE */ - parsing_state = PARSING_PAYLOAD_IE; - } - break; - } - buf += len; - buf_size -= len; - } - - if(parsing_state == PARSING_HEADER_IE) { - ies->ie_payload_ie_offset = buf - start; /* Save IE header len */ - } - - return buf - start; -} diff --git a/os/net/mac/framer/frame802154e-ie.h b/os/net/mac/framer/frame802154e-ie.h deleted file mode 100644 index 2df163d7d..000000000 --- a/os/net/mac/framer/frame802154e-ie.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * IEEE 802.15.4e Information Element (IE) creation and parsing. - * \author - * Simon Duquennoy - */ - -#ifndef FRAME_802154E_H -#define FRAME_802154E_H - -#include "contiki.h" -#include "net/mac/mac.h" -#include "net/linkaddr.h" -/* We need definitions from tsch.h for TSCH-specific information elements */ -#include "net/mac/tsch/tsch-conf.h" -#include "net/mac/tsch/tsch-const.h" -#include "net/mac/tsch/tsch-types.h" -#include "net/mac/tsch/tsch-asn.h" - -#define FRAME802154E_IE_MAX_LINKS 4 - -/* Structures used for the Slotframe and Links information element */ -struct tsch_slotframe_and_links_link { - uint16_t timeslot; - uint16_t channel_offset; - uint8_t link_options; -}; -struct tsch_slotframe_and_links { - uint8_t num_slotframes; /* We support only 0 or 1 slotframe in this IE */ - uint8_t slotframe_handle; - uint16_t slotframe_size; - uint8_t num_links; - struct tsch_slotframe_and_links_link links[FRAME802154E_IE_MAX_LINKS]; -}; - -/* The information elements that we currently support */ -struct ieee802154_ies { - /* Header IEs */ - int16_t ie_time_correction; - uint8_t ie_is_nack; - /* Payload MLME */ - uint8_t ie_payload_ie_offset; - uint16_t ie_mlme_len; - /* Payload Short MLME IEs */ - uint8_t ie_tsch_synchronization_offset; - struct tsch_asn_t ie_asn; - uint8_t ie_join_priority; - uint8_t ie_tsch_timeslot_id; - uint16_t ie_tsch_timeslot[tsch_ts_elements_count]; - struct tsch_slotframe_and_links ie_tsch_slotframe_and_link; - /* Payload Long MLME IEs */ - uint8_t ie_channel_hopping_sequence_id; - /* We include and parse only the sequence len and list and omit unused fields */ - uint16_t ie_hopping_sequence_len; - uint8_t ie_hopping_sequence_list[TSCH_HOPPING_SEQUENCE_MAX_LEN]; -#if TSCH_WITH_SIXTOP - /* Payload Sixtop IE */ - const uint8_t *sixtop_ie_content_ptr; - uint16_t sixtop_ie_content_len; -#endif /* TSCH_WITH_SIXTOP */ -}; - -/** Insert various Information Elements **/ -/* Header IE. ACK/NACK time correction. Used in enhanced ACKs */ -int frame80215e_create_ie_header_ack_nack_time_correction(uint8_t *buf, int len, - struct ieee802154_ies *ies); -/* Header IE. List termination 1 (Signals the end of the Header IEs when - * followed by payload IEs) */ -int frame80215e_create_ie_header_list_termination_1(uint8_t *buf, int len, - struct ieee802154_ies *ies); -/* Header IE. List termination 2 (Signals the end of the Header IEs when - * followed by an unformatted payload) */ -int frame80215e_create_ie_header_list_termination_2(uint8_t *buf, int len, - struct ieee802154_ies *ies); -/* Payload IE. List termination */ -int frame80215e_create_ie_payload_list_termination(uint8_t *buf, int len, - struct ieee802154_ies *ies); -#if TSCH_WITH_SIXTOP -/* Payload IE. 6top. Used to nest sub-IEs */ -int frame80215e_create_ie_ietf(uint8_t *buf, int len, - struct ieee802154_ies *ies); -#endif /* TSCH_WITH_SIXTOP */ -/* Payload IE. MLME. Used to nest sub-IEs */ -int frame80215e_create_ie_mlme(uint8_t *buf, int len, - struct ieee802154_ies *ies); -/* MLME sub-IE. TSCH synchronization. Used in EBs: ASN and join priority */ -int frame80215e_create_ie_tsch_synchronization(uint8_t *buf, int len, - struct ieee802154_ies *ies); -/* MLME sub-IE. TSCH slotframe and link. Used in EBs: initial schedule */ -int frame80215e_create_ie_tsch_slotframe_and_link(uint8_t *buf, int len, - struct ieee802154_ies *ies); -/* MLME sub-IE. TSCH timeslot. Used in EBs: timeslot template (timing) */ -int frame80215e_create_ie_tsch_timeslot(uint8_t *buf, int len, - struct ieee802154_ies *ies); -/* MLME sub-IE. TSCH channel hopping sequence. Used in EBs: hopping sequence */ -int frame80215e_create_ie_tsch_channel_hopping_sequence(uint8_t *buf, int len, - struct ieee802154_ies *ies); - -/* Parse all Information Elements of a frame */ -int frame802154e_parse_information_elements(const uint8_t *buf, uint8_t buf_size, - struct ieee802154_ies *ies); - -#endif /* FRAME_802154E_H */ diff --git a/os/net/mac/framer/framer-802154.c b/os/net/mac/framer/framer-802154.c deleted file mode 100644 index 8e92b9b2d..000000000 --- a/os/net/mac/framer/framer-802154.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * MAC framer for IEEE 802.15.4 - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "net/mac/framer/framer-802154.h" -#include "net/mac/framer/frame802154.h" -#include "net/mac/llsec802154.h" -#include "net/packetbuf.h" -#include "lib/random.h" -#include - -#include "sys/log.h" -#define LOG_MODULE "Frame 15.4" -#define LOG_LEVEL LOG_LEVEL_FRAMER - -/** \brief The sequence number (0x00 - 0xff) added to the transmitted - * data or MAC command frame. The default is a random value within - * the range. - */ -static uint8_t mac_dsn; - -static uint8_t initialized = 0; - -/*---------------------------------------------------------------------------*/ -static int -create_frame(int do_create) -{ - frame802154_t params; - int hdr_len; - - if(frame802154_get_pan_id() == 0xffff) { - return -1; - } - - /* init to zeros */ - memset(¶ms, 0, sizeof(params)); - - if(!initialized) { - initialized = 1; - mac_dsn = random_rand() & 0xff; - } - - /* - * Before setting up "params", make sure we won't use 0 as the sequence number - * of a newly created frame. - * - * The case when do_create is 0 is ignored since it's for only length - * calculation. No sequence number is needed and should not be consumed. - */ - if(do_create != 0 && packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO) == 0) { - if(mac_dsn == 0) { - mac_dsn++; - } - packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, mac_dsn); - mac_dsn++; - } - - framer_802154_setup_params(packetbuf_attr, packetbuf_holds_broadcast(), - ¶ms); - - if(packetbuf_holds_broadcast()) { - params.dest_addr[0] = 0xFF; - params.dest_addr[1] = 0xFF; - } else { - linkaddr_copy((linkaddr_t *)¶ms.dest_addr, - packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - } - - linkaddr_copy((linkaddr_t *)¶ms.src_addr, - packetbuf_addr(PACKETBUF_ADDR_SENDER)); - - params.payload = packetbuf_dataptr(); - params.payload_len = packetbuf_datalen(); - hdr_len = frame802154_hdrlen(¶ms); - if(!do_create) { - /* Only calculate header length */ - return hdr_len; - } else if(packetbuf_hdralloc(hdr_len)) { - frame802154_create(¶ms, packetbuf_hdrptr()); - - LOG_INFO("Out: %2X ", params.fcf.frame_type); - LOG_INFO_LLADDR((const linkaddr_t *)params.dest_addr); - LOG_INFO_(" %d %u (%u)\n", hdr_len, packetbuf_datalen(), packetbuf_totlen()); - - return hdr_len; - } else { - LOG_ERR("Out: too large header: %u\n", hdr_len); - return FRAMER_FAILED; - } -} -/*---------------------------------------------------------------------------*/ -void -framer_802154_setup_params(packetbuf_attr_t (*get_attr)(uint8_t type), - uint8_t dest_is_broadcast, frame802154_t *params) -{ - if(get_attr == NULL || params == NULL) { - LOG_INFO("framer-802154: cannot setup params because of invalid argument\n"); - return; - } - - /* - * Don't initialize params with 0 because a caller may have already set - * something to it - */ - - /* Build the FCF. */ - params->fcf.frame_type = get_attr(PACKETBUF_ATTR_FRAME_TYPE); - params->fcf.frame_pending = 0; - if(dest_is_broadcast) { - params->fcf.ack_required = 0; - /* Suppress seqno on broadcast if supported (frame v2 or more) */ - params->fcf.sequence_number_suppression = FRAME802154_VERSION >= FRAME802154_IEEE802154_2015; - } else { - params->fcf.ack_required = get_attr(PACKETBUF_ATTR_MAC_ACK); - params->fcf.sequence_number_suppression = FRAME802154_SUPPR_SEQNO; - } - - /* Set IE Present bit */ - params->fcf.ie_list_present = get_attr(PACKETBUF_ATTR_MAC_METADATA); - - /* Insert IEEE 802.15.4 version bits. */ - params->fcf.frame_version = FRAME802154_VERSION; - -#if LLSEC802154_USES_AUX_HEADER - if(get_attr(PACKETBUF_ATTR_SECURITY_LEVEL)) { - params->fcf.security_enabled = 1; - } - /* Setting security-related attributes */ - params->aux_hdr.security_control.security_level = get_attr(PACKETBUF_ATTR_SECURITY_LEVEL); -#if LLSEC802154_USES_FRAME_COUNTER - params->aux_hdr.frame_counter.u16[0] = get_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_0_1); - params->aux_hdr.frame_counter.u16[1] = get_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_2_3); -#else /* LLSEC802154_USES_FRAME_COUNTER */ - params->aux_hdr.security_control.frame_counter_suppression = 1; - params->aux_hdr.security_control.frame_counter_size = 1; -#endif /* LLSEC802154_USES_FRAME_COUNTER */ -#if LLSEC802154_USES_EXPLICIT_KEYS - params->aux_hdr.security_control.key_id_mode = get_attr(PACKETBUF_ATTR_KEY_ID_MODE); - params->aux_hdr.key_index = get_attr(PACKETBUF_ATTR_KEY_INDEX); -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ -#else - params->fcf.security_enabled = 0; -#endif /* LLSEC802154_USES_AUX_HEADER */ - - params->seq = get_attr(PACKETBUF_ATTR_MAC_SEQNO); - - /* Set the source PAN ID to the global variable. */ - params->src_pid = frame802154_get_pan_id(); - - /* Source address itself should be set outside this function. */ - if(get_attr(PACKETBUF_ATTR_MAC_NO_SRC_ADDR) == 1) { - params->fcf.src_addr_mode = FRAME802154_NOADDR; - } else { - if(LINKADDR_SIZE == 2) { - /* Use short address mode if linkaddr size is short. */ - params->fcf.src_addr_mode = FRAME802154_SHORTADDRMODE; - } else { - params->fcf.src_addr_mode = FRAME802154_LONGADDRMODE; - } - } - - params->dest_pid = frame802154_get_pan_id(); - - /* Destination address itself should be set outside this function. */ - if(get_attr(PACKETBUF_ATTR_MAC_NO_DEST_ADDR) == 1) { - params->fcf.dest_addr_mode = FRAME802154_NOADDR; - } else if(dest_is_broadcast) { - /* Broadcast requires short address mode. */ - params->fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE; - } else { - if(LINKADDR_SIZE == 2) { - params->fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE; - } else { - params->fcf.dest_addr_mode = FRAME802154_LONGADDRMODE; - } - } - - /* Suppress Source PAN ID and put Destination PAN ID by default */ - if(params->fcf.src_addr_mode == FRAME802154_SHORTADDRMODE || - params->fcf.dest_addr_mode == FRAME802154_SHORTADDRMODE) { - params->fcf.panid_compression = 1; - } else { - params->fcf.panid_compression = 0; - } -} -/*---------------------------------------------------------------------------*/ -static int -hdr_length(void) -{ - return create_frame(0); -} -/*---------------------------------------------------------------------------*/ -static int -create(void) -{ - return create_frame(1); -} -/*---------------------------------------------------------------------------*/ -static int -parse(void) -{ - frame802154_t frame; - int hdr_len; - - hdr_len = frame802154_parse(packetbuf_dataptr(), packetbuf_datalen(), &frame); - - if(hdr_len && packetbuf_hdrreduce(hdr_len)) { - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, frame.fcf.frame_type); - packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, frame.fcf.ack_required); - - if(frame.fcf.dest_addr_mode) { - if(frame.dest_pid != frame802154_get_pan_id() && - frame.dest_pid != FRAME802154_BROADCASTPANDID) { - /* Packet to another PAN */ - LOG_WARN("15.4: for another pan %u\n", frame.dest_pid); - return FRAMER_FAILED; - } - if(!frame802154_is_broadcast_addr(frame.fcf.dest_addr_mode, frame.dest_addr)) { - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (linkaddr_t *)&frame.dest_addr); - } - } - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr); - if(frame.fcf.sequence_number_suppression == 0) { - packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq); - } else { - packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, 0xffff); - } -#if NETSTACK_CONF_WITH_RIME - packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, frame.seq); -#endif - -#if LLSEC802154_USES_AUX_HEADER - if(frame.fcf.security_enabled) { - packetbuf_set_attr(PACKETBUF_ATTR_SECURITY_LEVEL, frame.aux_hdr.security_control.security_level); -#if LLSEC802154_USES_FRAME_COUNTER - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_0_1, frame.aux_hdr.frame_counter.u16[0]); - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_2_3, frame.aux_hdr.frame_counter.u16[1]); -#endif /* LLSEC802154_USES_FRAME_COUNTER */ -#if LLSEC802154_USES_EXPLICIT_KEYS - packetbuf_set_attr(PACKETBUF_ATTR_KEY_ID_MODE, frame.aux_hdr.security_control.key_id_mode); - packetbuf_set_attr(PACKETBUF_ATTR_KEY_INDEX, frame.aux_hdr.key_index); -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ - } -#endif /* LLSEC802154_USES_AUX_HEADER */ - - LOG_INFO("In: %2X ", frame.fcf.frame_type); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_INFO_(" "); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - LOG_INFO_(" %d %u (%u)\n", hdr_len, packetbuf_datalen(), packetbuf_totlen()); - - return hdr_len; - } - return FRAMER_FAILED; -} -/*---------------------------------------------------------------------------*/ -const struct framer framer_802154 = { - hdr_length, - create, - parse -}; -/*---------------------------------------------------------------------------*/ diff --git a/os/net/mac/framer/framer-802154.h b/os/net/mac/framer/framer-802154.h deleted file mode 100644 index ea87c94fc..000000000 --- a/os/net/mac/framer/framer-802154.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A MAC framer for IEEE 802.15.4 - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef FRAMER_802154_H_ -#define FRAMER_802154_H_ - -#include "net/packetbuf.h" -#include "net/mac/framer/framer.h" - -/* Setup frame802154_t with use of a specified get_attr */ -void framer_802154_setup_params(packetbuf_attr_t (*get_attr)(uint8_t type), - uint8_t dest_is_broadcast, - frame802154_t *params); - -extern const struct framer framer_802154; - -#endif /* FRAMER_802154_H_ */ diff --git a/os/net/mac/framer/framer.h b/os/net/mac/framer/framer.h deleted file mode 100644 index 5ed419292..000000000 --- a/os/net/mac/framer/framer.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A MAC framer is responsible for constructing and parsing - * the header in MAC frames. At least the sender and receiver - * are required to be encoded in the MAC frame headers. - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef FRAMER_H_ -#define FRAMER_H_ - -#define FRAMER_FAILED -1 - -struct framer { - - int (* length)(void); - int (* create)(void); - int (* parse)(void); - -}; - -#endif /* FRAMER_H_ */ diff --git a/os/net/mac/framer/nullframer.c b/os/net/mac/framer/nullframer.c deleted file mode 100644 index ae7bc925d..000000000 --- a/os/net/mac/framer/nullframer.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * MAC framer that does nothing... - * \author - * Niclas Finne - * Joakim Eriksson - */ -#include "net/mac/framer/framer.h" -#include "net/packetbuf.h" - -#ifdef NULLFRAMER_CONF_PARSE_802154 -#define NULLFRAMER_PARSE_802154 NULLFRAMER_CONF_PARSE_802154 -#else -/* defaults to parsing of the 802154 header as that is used for Slip-Radio */ -#define NULLFRAMER_PARSE_802154 1 -#endif - -/*---------------------------------------------------------------------------*/ -static int -is_broadcast_addr(uint8_t mode, uint8_t *addr) -{ - int i = mode == FRAME802154_SHORTADDRMODE ? 2 : 8; - while(i-- > 0) { - if(addr[i] != 0xff) { - return 0; - } - } - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -hdr_length(void) -{ - /* never adds any header */ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -create(void) -{ - /* nothing extra... */ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -parse(void) -{ -#if NULLFRAMER_PARSE_802154 - frame802154_t frame; - int len; - len = packetbuf_datalen(); - if(frame802154_parse(packetbuf_dataptr(), len, &frame)) { - if(frame.fcf.dest_addr_mode) { - if(!is_broadcast_addr(frame.fcf.dest_addr_mode, frame.dest_addr)) { - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (linkaddr_t *)&frame.dest_addr); - } - } - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr); - packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq); - packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, frame.fcf.ack_required); - return 0; - } -#endif - return 0; -} -/*---------------------------------------------------------------------------*/ -const struct framer no_framer = { - hdr_length, - create, - parse -}; diff --git a/os/net/mac/llsec802154.h b/os/net/mac/llsec802154.h deleted file mode 100644 index e808fef7a..000000000 --- a/os/net/mac/llsec802154.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013, Hasso-Plattner-Institut. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - - /** - * \addtogroup link-layer - * @{ - * - * \defgroup llsec802154 Link-layer security common functionality - * - * Macros related to 802.15.4 link-layer security. - * - * @{ - */ - -/** - * \file - * Common functionality of 802.15.4-compliant llsec_drivers. - * \author - * Konrad Krentz - */ - -#ifndef LLSEC802154_H_ -#define LLSEC802154_H_ - -#include "net/mac/framer/frame802154.h" -#include "net/ipv6/uip.h" - -#ifdef LLSEC802154_CONF_ENABLED -#define LLSEC802154_ENABLED LLSEC802154_CONF_ENABLED -#else /* LLSEC802154_CONF_ENABLED */ -#define LLSEC802154_ENABLED 0 -#endif /* LLSEC802154_CONF_ENABLED */ - -#define LLSEC802154_MIC_LEN(sec_lvl) (2 << (sec_lvl & 3)) - -#ifdef LLSEC802154_CONF_USES_EXPLICIT_KEYS -#define LLSEC802154_USES_EXPLICIT_KEYS LLSEC802154_CONF_USES_EXPLICIT_KEYS -#else /* LLSEC802154_CONF_USES_EXPLICIT_KEYS */ -#define LLSEC802154_USES_EXPLICIT_KEYS LLSEC802154_ENABLED -#endif /* LLSEC802154_CONF_USES_EXPLICIT_KEYS */ - -#ifdef LLSEC802154_CONF_USES_AUX_HEADER -#define LLSEC802154_USES_AUX_HEADER LLSEC802154_CONF_USES_AUX_HEADER -#else /* LLSEC802154_CONF_USES_AUX_HEADER */ -#define LLSEC802154_USES_AUX_HEADER LLSEC802154_ENABLED -#endif /* LLSEC802154_CONF_USES_AUX_HEADER */ - -#ifdef LLSEC802154_CONF_USES_FRAME_COUNTER -#define LLSEC802154_USES_FRAME_COUNTER LLSEC802154_CONF_USES_FRAME_COUNTER -#else -#define LLSEC802154_USES_FRAME_COUNTER LLSEC802154_ENABLED -#endif /* LLSEC802154_CONF_USES_FRAME_COUNTER */ - -#if UIP_BYTE_ORDER == UIP_LITTLE_ENDIAN -#define LLSEC802154_HTONS(n) (n) -#define LLSEC802154_HTONL(n) (n) -#else /* UIP_CONF_BYTE_ORDER == UIP_LITTLE_ENDIAN */ -#define LLSEC802154_HTONS(n) (uint16_t)((((uint16_t) (n)) << 8) | (((uint16_t) (n)) >> 8)) -#define LLSEC802154_HTONL(n) (((uint32_t)UIP_HTONS(n) << 16) | UIP_HTONS((uint32_t)(n) >> 16)) -#endif /* UIP_CONF_BYTE_ORDER == UIP_LITTLE_ENDIAN */ - -#endif /* LLSEC802154_H_ */ - -/** @} */ -/** @} */ diff --git a/os/net/mac/mac-sequence.c b/os/net/mac/mac-sequence.c deleted file mode 100644 index 8481d2aa7..000000000 --- a/os/net/mac/mac-sequence.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * All rights reserved. - * - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * Benoît Thébaudeau - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * MAC sequence numbers management - * \author - * Adam Dunkels - * Benoît Thébaudeau - */ - -#include - -#include "contiki-net.h" -#include "net/mac/mac-sequence.h" -#include "net/packetbuf.h" - -struct seqno { - linkaddr_t sender; - clock_time_t timestamp; - uint8_t seqno; -}; - -#ifdef NETSTACK_CONF_MAC_SEQNO_MAX_AGE -#define SEQNO_MAX_AGE NETSTACK_CONF_MAC_SEQNO_MAX_AGE -#else /* NETSTACK_CONF_MAC_SEQNO_MAX_AGE */ -#define SEQNO_MAX_AGE (20 * CLOCK_SECOND) -#endif /* NETSTACK_CONF_MAC_SEQNO_MAX_AGE */ - -#ifdef NETSTACK_CONF_MAC_SEQNO_HISTORY -#define MAX_SEQNOS NETSTACK_CONF_MAC_SEQNO_HISTORY -#else /* NETSTACK_CONF_MAC_SEQNO_HISTORY */ -#define MAX_SEQNOS 16 -#endif /* NETSTACK_CONF_MAC_SEQNO_HISTORY */ -static struct seqno received_seqnos[MAX_SEQNOS]; - -/*---------------------------------------------------------------------------*/ -int -mac_sequence_is_duplicate(void) -{ - int i; - clock_time_t now = clock_time(); - - /* - * Check for duplicate packet by comparing the sequence number of the incoming - * packet with the last few ones we saw. - */ - for(i = 0; i < MAX_SEQNOS; ++i) { - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER), - &received_seqnos[i].sender)) { - if(packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO) == received_seqnos[i].seqno) { -#if SEQNO_MAX_AGE > 0 - if(now - received_seqnos[i].timestamp <= SEQNO_MAX_AGE) { - /* Duplicate packet. */ - return 1; - } -#else /* SEQNO_MAX_AGE > 0 */ - return 1; -#endif /* SEQNO_MAX_AGE > 0 */ - } - break; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -mac_sequence_register_seqno(void) -{ - int i, j; - - /* Locate possible previous sequence number for this address. */ - for(i = 0; i < MAX_SEQNOS; ++i) { - if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER), - &received_seqnos[i].sender)) { - i++; - break; - } - } - - /* Keep the last sequence number for each address as per 802.15.4e. */ - for(j = i - 1; j > 0; --j) { - memcpy(&received_seqnos[j], &received_seqnos[j - 1], sizeof(struct seqno)); - } - received_seqnos[0].seqno = packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO); - received_seqnos[0].timestamp = clock_time(); - linkaddr_copy(&received_seqnos[0].sender, - packetbuf_addr(PACKETBUF_ADDR_SENDER)); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/mac/mac-sequence.h b/os/net/mac/mac-sequence.h deleted file mode 100644 index e3f2e9f92..000000000 --- a/os/net/mac/mac-sequence.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * All rights reserved. - * - * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ - * Benoît Thébaudeau - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for MAC sequence numbers management - * \author - * Adam Dunkels - * Benoît Thébaudeau - */ - -#ifndef MAC_SEQUENCE_H -#define MAC_SEQUENCE_H - -/** - * \brief Tell whether the packetbuf is a duplicate packet - * \return Non-zero if the packetbuf is a duplicate packet, zero otherwise - * - * This function is used to check for duplicate packet by comparing - * the sequence number of the incoming packet with the last few ones - * we saw, filtering with the link-layer address. - */ -int mac_sequence_is_duplicate(void); - -/** - * \brief Register the sequence number of the packetbuf - * - * This function is used to add the sequence number of the incoming - * packet to the history. - */ -void mac_sequence_register_seqno(void); - -#endif /* MAC_SEQUENCE_H */ diff --git a/os/net/mac/mac.c b/os/net/mac/mac.c deleted file mode 100644 index c8f8eb87b..000000000 --- a/os/net/mac/mac.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "net/mac/mac.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "MAC" -#define LOG_LEVEL LOG_LEVEL_MAC - -/*---------------------------------------------------------------------------*/ -void -mac_call_sent_callback(mac_callback_t sent, void *ptr, int status, int num_tx) -{ - if(sent) { - sent(ptr, status, num_tx); - } -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/mac/mac.h b/os/net/mac/mac.h deleted file mode 100644 index f64838b4c..000000000 --- a/os/net/mac/mac.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * MAC driver header file - * \author - * Adam Dunkels - */ - -#ifndef MAC_H_ -#define MAC_H_ - -#include "contiki.h" -#include "dev/radio.h" - -/** - *\brief The default channel for IEEE 802.15.4 networks. - */ -#ifdef IEEE802154_CONF_DEFAULT_CHANNEL -#define IEEE802154_DEFAULT_CHANNEL IEEE802154_CONF_DEFAULT_CHANNEL -#else /* IEEE802154_CONF_DEFAULT_CHANNEL */ -#define IEEE802154_DEFAULT_CHANNEL 26 -#endif /* IEEE802154_CONF_DEFAULT_CHANNEL */ - -typedef void (* mac_callback_t)(void *ptr, int status, int transmissions); - -void mac_call_sent_callback(mac_callback_t sent, void *ptr, int status, int num_tx); - -/** - * The structure of a MAC protocol driver in Contiki. - */ -struct mac_driver { - char *name; - - /** Initialize the MAC driver */ - void (* init)(void); - - /** Send a packet from the packetbuf */ - void (* send)(mac_callback_t sent_callback, void *ptr); - - /** Callback for getting notified of incoming packet. */ - void (* input)(void); - - /** Turn the MAC layer on. */ - int (* on)(void); - - /** Turn the MAC layer off. */ - int (* off)(void); - - /** Read out estimated max payload size based on payload in packetbuf */ - int (* max_payload)(void); -}; - -/* Generic MAC return values. */ -enum { - /**< The MAC layer transmission was OK. */ - MAC_TX_OK, - - /**< The MAC layer transmission could not be performed due to a - collision. */ - MAC_TX_COLLISION, - - /**< The MAC layer did not get an acknowledgement for the packet. */ - MAC_TX_NOACK, - - /**< The MAC layer deferred the transmission for a later time. */ - MAC_TX_DEFERRED, - - /**< The MAC layer transmission could not be performed because of an - error. The upper layer may try again later. */ - MAC_TX_ERR, - - /**< The MAC layer transmission could not be performed because of a - fatal error. The upper layer does not need to try again, as the - error will be fatal then as well. */ - MAC_TX_ERR_FATAL, -}; - -#endif /* MAC_H_ */ diff --git a/os/net/mac/nullmac/nullmac.c b/os/net/mac/nullmac/nullmac.c deleted file mode 100644 index de92ee5d8..000000000 --- a/os/net/mac/nullmac/nullmac.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A MAC protocol that does not do anything. - * \author - * Adam Dunkels - */ - -#include "net/mac/nullmac/nullmac.h" -#include "net/netstack.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/tcpip.h" -#include "net/packetbuf.h" -#include "net/netstack.h" - -/*---------------------------------------------------------------------------*/ -static void -send_packet(mac_callback_t sent, void *ptr) -{ -} -/*---------------------------------------------------------------------------*/ -static void -packet_input(void) -{ -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -off(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -max_payload(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ -} -/*---------------------------------------------------------------------------*/ -const struct mac_driver nullmac_driver = { - "nullmac", - init, - send_packet, - packet_input, - on, - off, - max_payload, -}; -/*---------------------------------------------------------------------------*/ diff --git a/os/net/mac/nullmac/nullmac.h b/os/net/mac/nullmac/nullmac.h deleted file mode 100644 index 6767bfc38..000000000 --- a/os/net/mac/nullmac/nullmac.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A MAC protocol implementation that does not do anything. - * \author - * Adam Dunkels - */ - -#ifndef NULLMAC_H_ -#define NULLMAC_H_ - -#include "net/mac/mac.h" -#include "dev/radio.h" - -extern const struct mac_driver nullmac_driver; - - -#endif /* NULLMAC_H_ */ diff --git a/os/net/mac/tsch/sixtop/sixp-nbr.c b/os/net/mac/tsch/sixtop/sixp-nbr.c deleted file mode 100644 index 7ab0bea90..000000000 --- a/os/net/mac/tsch/sixtop/sixp-nbr.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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. - */ -/** - * \addtogroup sixtop - * @{ - */ -/** - * \file - * Neighbor Management for 6top Protocol (6P) - * \author - * Yasuyuki Tanaka - */ - -#include "contiki-lib.h" - -#include "lib/assert.h" -#include "net/nbr-table.h" - -#include "sixp.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "6top" -#define LOG_LEVEL LOG_LEVEL_6TOP - -/** - * \brief 6P Neighbor Data Structure (for internal use) - * - * XXX: for now, we have one nbr object per neighbor, which is shared with - * multiple SFs. It's unclear whether we should use a different generation - * counter for each SFs. - */ -typedef struct sixp_nbr { - struct sixp_nbr *next; - linkaddr_t addr; - uint8_t next_seqno; -} sixp_nbr_t; - -NBR_TABLE(sixp_nbr_t, sixp_nbrs); - -/*---------------------------------------------------------------------------*/ -sixp_nbr_t * -sixp_nbr_find(const linkaddr_t *addr) -{ - assert(addr != NULL); - if(addr == NULL) { - return NULL; - } - return (sixp_nbr_t *)nbr_table_get_from_lladdr(sixp_nbrs, addr); -} -/*---------------------------------------------------------------------------*/ -sixp_nbr_t * -sixp_nbr_alloc(const linkaddr_t *addr) -{ - sixp_nbr_t *nbr; - - assert(addr != NULL); - if(addr == NULL) { - LOG_ERR("6P-nbr: sixp_nbr_alloc() fails because of invalid argument\n"); - return NULL; - } - - if(sixp_nbr_find(addr) != NULL) { - LOG_ERR("6P-nbr: sixp_nbr_alloc() fails because of duplication [peer_addr:"); - LOG_ERR_LLADDR((const linkaddr_t *)addr); - LOG_ERR_("]\n"); - return NULL; - } - - if((nbr = (sixp_nbr_t *)nbr_table_add_lladdr(sixp_nbrs, - addr, - NBR_TABLE_REASON_SIXTOP, - NULL)) == NULL) { - LOG_ERR("6P-nbr: sixp_nbr_alloc() fails to add nbr because of no memory\n"); - return NULL; - } - - linkaddr_copy(&nbr->addr, addr); - nbr->next_seqno = SIXP_INITIAL_SEQUENCE_NUMBER; - - return nbr; -} -/*---------------------------------------------------------------------------*/ -void -sixp_nbr_free(sixp_nbr_t *nbr) -{ - assert(nbr != NULL); - if(nbr != NULL) { - (void)nbr_table_remove(sixp_nbrs, nbr); - } -} -/*---------------------------------------------------------------------------*/ -int -sixp_nbr_get_next_seqno(sixp_nbr_t *nbr) -{ - assert(nbr != NULL); - if(nbr == NULL) { - LOG_ERR("6P-nbr: sixp_nbr_get_next_seqno() fails because of invalid arg\n"); - return -1; - } - return nbr->next_seqno; -} -/*---------------------------------------------------------------------------*/ -int -sixp_nbr_set_next_seqno(sixp_nbr_t *nbr, uint16_t seqno) -{ - assert(nbr != NULL); - if(nbr == NULL) { - LOG_ERR("6P-nbr: sixp_nbr_set_next_seqno() fails because of invalid arg\n"); - return -1; - } - nbr->next_seqno = seqno; - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_nbr_reset_next_seqno(sixp_nbr_t *nbr) -{ - assert(nbr != NULL); - if(nbr == NULL) { - LOG_ERR("6P-nbr: sixp_nbr_clear_next_seqno() fails; invalid arg\n"); - return -1; - } - nbr->next_seqno = 0; - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_nbr_increment_next_seqno(sixp_nbr_t *nbr) -{ - assert(nbr != NULL); - if(nbr == NULL) { - LOG_ERR("6P-nbr: sixp_nbr_increment_next_seqno() fails; invalid arg\n"); - return -1; - } - nbr->next_seqno++; - if(nbr->next_seqno == 0) { - /* - * next_seqno can be 0 only by initialization of nbr or by a CLEAR - * transaction. - */ - nbr->next_seqno = 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_nbr_init(void) -{ - sixp_nbr_t *nbr, *next_nbr; - if(nbr_table_is_registered(sixp_nbrs) == 0) { - nbr_table_register(sixp_nbrs, NULL); - } else { - /* remove all the existing nbrs */ - nbr = (sixp_nbr_t *)nbr_table_head(sixp_nbrs); - while(nbr != NULL) { - next_nbr = (sixp_nbr_t *)nbr_table_next(sixp_nbrs, nbr); - sixp_nbr_free(nbr); - nbr = next_nbr; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/sixtop/sixp-nbr.h b/os/net/mac/tsch/sixtop/sixp-nbr.h deleted file mode 100644 index 817408028..000000000 --- a/os/net/mac/tsch/sixtop/sixp-nbr.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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. - */ -/** - * \addtogroup sixtop - * @{ - */ -/** - * \file - * Neighbor Management APIs for 6top Protocol (6P) - * \author - * Yasuyuki Tanaka - */ - -#include "sixp-pkt.h" - -typedef struct sixp_nbr sixp_nbr_t; - -/** - * \brief Find a neighbor - * \param addr The MAC address of a neighbor - * \return The pointer to a neighbor, NULL on failure - */ -sixp_nbr_t *sixp_nbr_find(const linkaddr_t *addr); - -/** - * \brief Allocate a neighbor - * \param addr The MAC address of a neighbor - * \return The pointer to a allocated neighbor, NULL on failure - */ -sixp_nbr_t *sixp_nbr_alloc(const linkaddr_t *addr); - -/** - * \brief Free a neighbor - * \param nbr The pointer to a neighbor to free - */ -void sixp_nbr_free(sixp_nbr_t *nbr); - -/** - * \brief Get the next sequence number of a neighbor - * \param nbr The pointer to a neighbor - * \return A sequence number to use for a next request, -1 on failure - */ -int16_t sixp_nbr_get_next_seqno(sixp_nbr_t *nbr); - -/** - * \brief Set the specified value to the next sequence number of a neighbor - * \param nbr The pointer to a neighbor - * \param seqno Value to be set - * \return 0 on success, -1 on failure - */ -int sixp_nbr_set_next_seqno(sixp_nbr_t *nbr, uint16_t seqno); - -/** - * \brief Reset the next sequence number of a neighbor to zero - * \param nbr The pointer to a neighbor - * \return 0 on success, -1 on failure - */ -int sixp_nbr_reset_next_seqno(sixp_nbr_t *nbr); - -/** - * \brief Increment the next sequence number of a neighbor - * \param nbr The pointer to a neighbor - * \return 0 on success, -1 on failure - */ -int sixp_nbr_increment_next_seqno(sixp_nbr_t *nbr); - -/** - * \brief Initialize 6p Neighbor Table - */ -int sixp_nbr_init(void); - -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/sixtop/sixp-pkt.c b/os/net/mac/tsch/sixtop/sixp-pkt.c deleted file mode 100644 index 3cd5abd6c..000000000 --- a/os/net/mac/tsch/sixtop/sixp-pkt.c +++ /dev/null @@ -1,1135 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka. - * Copyright (c) 2016, Centre for Development of Advanced Computing (C-DAC). - * 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. - */ -/** - * \addtogroup sixtop - * @{ - */ -/** - * \file - * 6top Protocol (6P) Packet Manipulation - * \author - * Shalu R - * Lijo Thomas - * Yasuyuki Tanaka - */ -#include "contiki.h" -#include "contiki-lib.h" -#include "lib/assert.h" -#include "net/packetbuf.h" -#include "net/mac/tsch/tsch.h" - -#include "sixp.h" -#include "sixp-pkt.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "6top" -#define LOG_LEVEL LOG_LEVEL_6TOP - -static int32_t get_metadata_offset(sixp_pkt_type_t type, sixp_pkt_code_t code); -static int32_t get_cell_options_offset(sixp_pkt_type_t type, - sixp_pkt_code_t code); -static int32_t get_num_cells_offset(sixp_pkt_type_t type, sixp_pkt_code_t code); -static int32_t get_reserved_offset(sixp_pkt_type_t type, sixp_pkt_code_t code); -static int32_t get_offset_offset(sixp_pkt_type_t type, sixp_pkt_code_t code); -static int32_t get_max_num_cells_offset(sixp_pkt_type_t type, - sixp_pkt_code_t code); -static int32_t get_cell_list_offset(sixp_pkt_type_t type, sixp_pkt_code_t code); -static int32_t get_rel_cell_list_offset(sixp_pkt_type_t type, - sixp_pkt_code_t code); -static int32_t get_total_num_cells_offset(sixp_pkt_type_t type, - sixp_pkt_code_t code); -static int32_t get_payload_offset(sixp_pkt_type_t type, - sixp_pkt_code_t code); - -/*---------------------------------------------------------------------------*/ -static int32_t -get_metadata_offset(sixp_pkt_type_t type, sixp_pkt_code_t code) -{ - if(type == SIXP_PKT_TYPE_REQUEST) { - return 0; /* offset */ - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static int32_t -get_cell_options_offset(sixp_pkt_type_t type, sixp_pkt_code_t code) -{ - if(type == SIXP_PKT_TYPE_REQUEST && - (code.cmd == SIXP_PKT_CMD_ADD || - code.cmd == SIXP_PKT_CMD_DELETE || - code.cmd == SIXP_PKT_CMD_RELOCATE || - code.cmd == SIXP_PKT_CMD_COUNT || - code.cmd == SIXP_PKT_CMD_LIST)) { - return sizeof(sixp_pkt_metadata_t); - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static int32_t -get_num_cells_offset(sixp_pkt_type_t type, sixp_pkt_code_t code) -{ - if(type == SIXP_PKT_TYPE_REQUEST && - (code.value == SIXP_PKT_CMD_ADD || - code.value == SIXP_PKT_CMD_DELETE || - code.value == SIXP_PKT_CMD_RELOCATE)) { - return sizeof(sixp_pkt_metadata_t) + sizeof(sixp_pkt_cell_options_t); - } - - return -1; -} -/*---------------------------------------------------------------------------*/ -static int32_t -get_reserved_offset(sixp_pkt_type_t type, sixp_pkt_code_t code) -{ - if(type == SIXP_PKT_TYPE_REQUEST && - code.value == SIXP_PKT_CMD_LIST) { - return sizeof(sixp_pkt_metadata_t) + sizeof(sixp_pkt_cell_options_t); - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static int32_t -get_offset_offset(sixp_pkt_type_t type, sixp_pkt_code_t code) -{ - if(type == SIXP_PKT_TYPE_REQUEST && - code.value == SIXP_PKT_CMD_LIST) { - return (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_reserved_t)); - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static int32_t -get_max_num_cells_offset(sixp_pkt_type_t type, sixp_pkt_code_t code) -{ - if(type == SIXP_PKT_TYPE_REQUEST && - code.value == SIXP_PKT_CMD_LIST) { - return (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_reserved_t) + - sizeof(sixp_pkt_offset_t)); - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static int32_t -get_cell_list_offset(sixp_pkt_type_t type, sixp_pkt_code_t code) -{ - if(type == SIXP_PKT_TYPE_REQUEST && (code.value == SIXP_PKT_CMD_ADD || - code.value == SIXP_PKT_CMD_DELETE)) { - return (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t)); - } else if((type == SIXP_PKT_TYPE_RESPONSE || - type == SIXP_PKT_TYPE_CONFIRMATION) && - (code.value == SIXP_PKT_RC_SUCCESS || - code.value == SIXP_PKT_RC_EOL)) { - return 0; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static int32_t -get_rel_cell_list_offset(sixp_pkt_type_t type, sixp_pkt_code_t code) -{ - if(type == SIXP_PKT_TYPE_REQUEST && code.value == SIXP_PKT_CMD_RELOCATE) { - return (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t)); - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static int32_t -get_total_num_cells_offset(sixp_pkt_type_t type, sixp_pkt_code_t code) -{ - if(type == SIXP_PKT_TYPE_RESPONSE && code.value == SIXP_PKT_RC_SUCCESS) { - return 0; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static int32_t -get_payload_offset(sixp_pkt_type_t type, sixp_pkt_code_t code) -{ - if(type == SIXP_PKT_TYPE_REQUEST && code.value == SIXP_PKT_CMD_SIGNAL) { - return sizeof(sixp_pkt_metadata_t); - } else if((type == SIXP_PKT_TYPE_RESPONSE || - type == SIXP_PKT_TYPE_CONFIRMATION) && - code.value == SIXP_PKT_RC_SUCCESS) { - return 0; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_metadata(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_metadata_t metadata, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(body == NULL) { - LOG_ERR("6P-pkt: cannot set metadata; body is null\n"); - return -1; - } - - if((offset = get_metadata_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set metadata [type=%u, code=%u], invalid type\n", - type, code.value); - return -1; - } - - if(body_len < (offset + sizeof(metadata))) { - LOG_ERR("6P-pkt: cannot set metadata, body is too short [body_len=%u]\n", - body_len); - return -1; - } - - /* - * Copy the content into the Metadata field as it is since 6P has no idea - * about the internal structure of the field. - */ - memcpy(body + offset, &metadata, sizeof(metadata)); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_metadata(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_metadata_t *metadata, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(metadata == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get metadata; invalid argument\n"); - return -1; - } - - if((offset = get_metadata_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get metadata [type=%u, code=%u], invalid type\n", - type, code.value); - return -1; - } - - if(body_len < offset + sizeof(*metadata)) { - LOG_ERR("6P-pkt: cannot get metadata [type=%u, code=%u], ", - type, code.value); - LOG_ERR_("body is too short\n"); - return -1; - } - - /* - * Copy the content in the Metadata field as it is since 6P has no idea about - * the internal structure of the field. - */ - memcpy(metadata, body + offset, sizeof(*metadata)); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_cell_options(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_cell_options_t cell_options, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(body == NULL) { - LOG_ERR("6P-pkt: cannot set cell_options; body is null\n"); - return -1; - } - - if((offset = get_cell_options_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set cell_options [type=%u, code=%u], ", - type, code.value); - LOG_ERR_("invalid type\n"); - return -1; - } - - if(body_len < (offset + sizeof(cell_options))) { - LOG_ERR("6P-pkt: cannot set cell_options, "); - LOG_ERR_("body is too short [body_len=%u]\n", body_len); - return -1; - } - - /* The CellOption field is an 8-bit bitfield */ - memcpy(body + offset, &cell_options, sizeof(uint8_t)); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_cell_options(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_cell_options_t *cell_options, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(cell_options == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get cell_options; invalid argument\n"); - return -1; - } - - if((offset = get_cell_options_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get cell_options [type=%u, code=%u]", - type, code.value); - LOG_ERR_("invalid type\n"); - return -1; - } - - if(body_len < (offset + sizeof(*cell_options))) { - LOG_ERR("6P-pkt: cannot get cell_options, "); - LOG_ERR_("body is too short [body_len=%u]\n", body_len); - return -1; - } - - /* The CellOption field is an 8-bit bitfield */ - memcpy(cell_options, body + offset, sizeof(uint8_t)); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_num_cells(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_num_cells_t num_cells, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(body == NULL) { - LOG_ERR("6P-pkt: cannot set num_cells; body is null\n"); - return -1; - } - - if((offset = get_num_cells_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set num_cells; "); - LOG_ERR_("packet [type=%u, code=%u] won't have NumCells\n", - type, code.value); - return -1; - } - - memcpy(body + offset, &num_cells, sizeof(uint8_t)); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_num_cells(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_num_cells_t *num_cells, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(num_cells == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get num_cells; invalid argument\n"); - return -1; - } - - if((offset = get_num_cells_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get num_cells; "); - LOG_ERR_("packet [type=%u, code=%u] won't have NumCells\n", - type, code.value); - return -1; - } - - if(body_len < (offset + sizeof(*num_cells))) { - LOG_ERR("6P-pkt: cannot get num_cells; body is too short\n"); - return -1; - } - - /* NumCells is an 8-bit unsigned integer */ - memcpy(num_cells, body + offset, sizeof(uint8_t)); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_reserved(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_reserved_t reserved, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(body == NULL) { - LOG_ERR("6P-pkt: cannot set reserved; body is null\n"); - return -1; - } - - if((offset = get_reserved_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set reserved; "); - LOG_ERR_("packet [type=%u, code=%u] won't have Reserved\n", - type, code.value); - return -1; - } - - if(body_len < (offset + sizeof(reserved))) { - LOG_ERR("6P-pkt: cannot set reserved; body is too short\n"); - return -1; - } - - /* The Reserved field is an 8-bit field */ - memcpy(body + offset, &reserved, sizeof(uint8_t)); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_reserved(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_reserved_t *reserved, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(reserved == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get reserved; invalid argument\n"); - return -1; - } - - if((offset = get_reserved_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get reserved; "); - LOG_ERR_("packet [type=%u, code=%u] won't have Reserved\n", - type, code.value); - return -1; - } - - /* The Reserved field is an 8-bit field */ - memcpy(reserved, body + offset, sizeof(uint8_t)); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_offset(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_offset_t cell_offset, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(body == NULL) { - LOG_ERR("6P-pkt: cannot set offset; invalid argument\n"); - return -1; - } - - if((offset = get_offset_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set offset; "); - LOG_ERR_("packet [type=%u, code=%u] won't have Offset\n", - type, code.value); - return -1; - } - - if(body_len < (offset + sizeof(cell_offset))) { - LOG_ERR("6P-pkt: cannot set offset; body is too short\n"); - return -1; - } - - /* - * The (Cell)Offset field is 16-bit long; treat it as a little-endian value of - * unsigned integer following IEEE 802.15.4-2015. - */ - (body + offset)[0] = *((uint16_t *)&cell_offset) & 0xff; - (body + offset)[1] = (*((uint16_t *)&cell_offset) >> 8) & 0xff; - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_offset(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_offset_t *cell_offset, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - const uint8_t *p; - - if(cell_offset == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get offset; invalid argument\n"); - return -1; - } - - if((offset = get_offset_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get offset; "); - LOG_ERR_("packet [type=%u, code=%u] won't have Offset\n", - type, code.value); - return -1; - } - - if(body_len < (offset + sizeof(*cell_offset))) { - LOG_ERR("6P-pkt: cannot get offset; body is too short\n"); - return -1; - } - - /* - * The (Cell)Offset field is 16-bit long; treat it as a little-endian value of - * unsigned integer following IEEE 802.15.4-2015. - */ - p = body + offset; - *((uint16_t *)cell_offset) = p[0] + (p[1] << 8); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_max_num_cells(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_max_num_cells_t max_num_cells, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(body == NULL) { - LOG_ERR("6P-pkt: cannot set max_num_cells; invalid argument\n"); - return -1; - } - - if((offset = get_max_num_cells_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set max_num_cells; "); - LOG_ERR_("packet [type=%u, code=%u] won't have MaxNumCells\n", - type, code.value); - return -1; - } - - if(body_len < (offset + sizeof(max_num_cells))) { - LOG_ERR("6P-pkt: cannot set max_num_cells; body is too short\n"); - return -1; - } - - /* - * The MaxNumCells field is 16-bit long; treat it as a little-endian value of - * unsigned integer following IEEE 802.15.4-2015. - */ - (body + offset)[0] = *((uint16_t *)&max_num_cells) & 0xff; - (body + offset)[1] = (*((uint16_t *)&max_num_cells) >> 8) & 0xff; - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_max_num_cells(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_max_num_cells_t *max_num_cells, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - const uint8_t *p; - - if(max_num_cells == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get max_num_cells; invalid argument\n"); - return -1; - } - - if((offset = get_max_num_cells_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get max_num_cells; "); - LOG_ERR_("packet [type=%u, code=%u] won't have MaxNumCells\n", - type, code.value); - return -1; - } - - if(body_len < (offset + sizeof(*max_num_cells))) { - LOG_ERR("6P-pkt: cannot get max_num_cells; body is too short\n"); - return -1; - } - - /* - * The MaxNumCells field is 16-bit long; treat it as a little-endian value of - * unsigned integer following IEEE 802.15.4-2015. - */ - p = body + offset; - *((uint16_t *)max_num_cells) = p[0] + (p[1] << 8); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *cell_list, - uint16_t cell_list_len, - uint16_t cell_offset, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(cell_list == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot set cell_list; invalid argument\n"); - return -1; - } - - if((offset = get_cell_list_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set cell_list; "); - LOG_ERR_("packet [type=%u, code=%u] won't have CellList\n", - type, code.value); - return -1; - } - - offset += cell_offset; - - if(body_len < (offset + cell_list_len)) { - LOG_ERR("6P-pkt: cannot set cell_list; body is too short\n"); - return -1; - } else if((cell_list_len % sizeof(sixp_pkt_cell_t)) != 0) { - LOG_ERR("6P-pkt: cannot set cell_list; invalid {body, cell_list}_len\n"); - return -1; - } - - memcpy(body + offset, cell_list, cell_list_len); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t **cell_list, - sixp_pkt_offset_t *cell_list_len, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(cell_list_len == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get cell_list\n"); - return -1; - } - - if((offset = get_cell_list_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get cell_list; "); - LOG_ERR_("packet [type=%u, code=%u] won't have CellList\n", - type, code.value); - return -1; - } - - if(body_len < offset) { - LOG_ERR("6P-pkt: cannot set cell_list; body is too short\n"); - return -1; - } else if(((body_len - offset) % sizeof(sixp_pkt_cell_t)) != 0) { - LOG_ERR("6P-pkt: cannot set cell_list; invalid {body, cell_list}_len\n"); - return -1; - } - - if(cell_list != NULL) { - *cell_list = body + offset; - } - - *cell_list_len = body_len - offset; - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_rel_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *rel_cell_list, - uint16_t rel_cell_list_len, - uint16_t cell_offset, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - sixp_pkt_num_cells_t num_cells; - - if(rel_cell_list == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot set rel_cell_list; invalid argument\n"); - return -1; - } - - if(sixp_pkt_get_num_cells(type, code, &num_cells, body, body_len) < 0) { - LOG_ERR("6P-pkt: cannot set rel_cell_list; no NumCells field\n"); - return -1; - } - - if((offset = get_rel_cell_list_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set rel_cell_list; "); - LOG_ERR_("packet [type=%u, code=%u] won't have RelCellList\n", - type, code.value); - return -1; - } - - offset += cell_offset; - - if(body_len < (offset + rel_cell_list_len)) { - LOG_ERR("6P-pkt: cannot set rel_cell_list; body is too short\n"); - return -1; - } else if((offset + rel_cell_list_len) > - (offset + num_cells * sizeof(sixp_pkt_cell_t))) { - LOG_ERR("6P-pkt: cannot set rel_cell_list; RelCellList is too long\n"); - return -1; - } else if((rel_cell_list_len % sizeof(sixp_pkt_cell_t)) != 0) { - LOG_ERR("6P-pkt: cannot set rel_cell_list; invalid body_len\n"); - return -1; - } - - memcpy(body + offset, rel_cell_list, rel_cell_list_len); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_rel_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t **rel_cell_list, - sixp_pkt_offset_t *rel_cell_list_len, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - sixp_pkt_num_cells_t num_cells; - - if(rel_cell_list_len == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get rel_cell_list; invalid argument\n"); - return -1; - } - - if(sixp_pkt_get_num_cells(type, code, &num_cells, body, body_len) < 0) { - LOG_ERR("6P-pkt: cannot get rel_cell_list; no NumCells field\n"); - return -1; - } - - if((offset = get_rel_cell_list_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get rel_cell_list; "); - LOG_ERR_("packet [type=%u, code=%u] won't have RelCellList\n", - type, code.value); - return -1; - } - - if(body_len < (offset + (num_cells * sizeof(sixp_pkt_cell_t)))) { - LOG_ERR("6P-pkt: cannot set rel_cell_list; body is too short\n"); - return -1; - } else if(((body_len - offset) % sizeof(sixp_pkt_cell_t)) != 0) { - LOG_ERR("6P-pkt: cannot set rel_cell_list; invalid body_len\n"); - return -1; - } - - if(rel_cell_list != NULL) { - *rel_cell_list = body + offset; - } - - *rel_cell_list_len = num_cells * sizeof(sixp_pkt_cell_t); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_cand_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *cand_cell_list, - uint16_t cand_cell_list_len, - uint16_t cell_offset, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - sixp_pkt_num_cells_t num_cells; - - if(cand_cell_list == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot set cand_cell_list; invalid argument\n"); - return -1; - } - - if(sixp_pkt_get_num_cells(type, code, &num_cells, body, body_len) < 0) { - LOG_ERR("6P-pkt: cannot set cand_cell_list; no NumCells field\n"); - return -1; - } - - if((offset = get_rel_cell_list_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set cand_cell_list; "); - LOG_ERR_("packet [type=%u, code=%u] won't have RelCellList\n", - type, code.value); - return -1; - } - - offset += cell_offset + num_cells * sizeof(sixp_pkt_cell_t); - - if(body_len < (offset + cand_cell_list_len)) { - LOG_ERR("6P-pkt: cannot set cand_cell_list; body is too short\n"); - return -1; - } else if((cand_cell_list_len % sizeof(sixp_pkt_cell_t)) != 0) { - LOG_ERR("6P-pkt: cannot set cand_cell_list; invalid body_len\n"); - return -1; - } - - memcpy(body + offset, cand_cell_list, cand_cell_list_len); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_cand_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t **cand_cell_list, - sixp_pkt_offset_t *cand_cell_list_len, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - sixp_pkt_num_cells_t num_cells; - - if(cand_cell_list_len == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get cand_cell_list; invalid argument\n"); - return -1; - } - - if(sixp_pkt_get_num_cells(type, code, &num_cells, body, body_len) < 0) { - LOG_ERR("6P-pkt: cannot get cand_cell_list; no NumCells field\n"); - return -1; - } - - if((offset = get_rel_cell_list_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get cand_cell_list; "); - LOG_ERR_("packet [type=%u, code=%u] won't have RelCellList\n", - type, code.value); - return -1; - } - - offset += num_cells * sizeof(sixp_pkt_cell_t); - - if(body_len < offset) { - LOG_ERR("6P-pkt: cannot set cand_cell_list; body is too short\n"); - return -1; - } else if(((body_len - offset) % sizeof(sixp_pkt_cell_t)) != 0) { - LOG_ERR("6P-pkt: cannot set cand_cell_list; invalid body_len\n"); - return -1; - } - - if(cand_cell_list != NULL) { - *cand_cell_list = body + offset; - } - - *cand_cell_list_len = body_len - offset; - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_total_num_cells(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_total_num_cells_t total_num_cells, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(body == NULL) { - LOG_ERR("6P-pkt: cannot set num_cells; body is null\n"); - return -1; - } - - if((offset = get_total_num_cells_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set total_num_cells; "); - LOG_ERR_("packet [type=%u, code=%u] won't have TotalNumCells\n", - type, code.value); - return -1; - } - - /* - * TotalNumCells for 6P Response is a 16-bit unsigned integer, little-endian. - */ - body[offset] = (uint8_t)(total_num_cells & 0xff); - body[offset + 1] = (uint8_t)(total_num_cells >> 8); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_total_num_cells(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_total_num_cells_t *total_num_cells, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(total_num_cells == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get num_cells; invalid argument\n"); - return -1; - } - - if((offset = get_total_num_cells_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get num_cells; "); - LOG_ERR_("packet [type=%u, code=%u] won't have TotalNumCells\n", - type, code.value); - return -1; - } - - if(body_len < (offset + sizeof(sixp_pkt_total_num_cells_t))) { - LOG_ERR("6P-pkt: cannot get num_cells; body is too short\n"); - return -1; - } - - /* TotalNumCells is a 16-bit unsigned integer, little-endian. */ - *total_num_cells = body[0]; - *total_num_cells += ((uint16_t)body[1]) << 8; - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_set_payload(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *payload, uint16_t payload_len, - uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(body == NULL) { - LOG_ERR("6P-pkt: cannot set metadata; body is null\n"); - return -1; - } - - if((offset = get_payload_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot set payload [type=%u, code=%u], invalid type\n", - type, code.value); - return -1; - } - - if(body_len < (offset + payload_len)) { - LOG_ERR("6P-pkt: cannot set payload, body is too short [body_len=%u]\n", - body_len); - return -1; - } - - /* - * Copy the content into the Payload field as it is since 6P has no idea - * about the internal structure of the field. - */ - memcpy(body + offset, payload, payload_len); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_get_payload(sixp_pkt_type_t type, sixp_pkt_code_t code, - uint8_t *buf, uint16_t buf_len, - const uint8_t *body, uint16_t body_len) -{ - int32_t offset; - - if(buf == NULL || body == NULL) { - LOG_ERR("6P-pkt: cannot get payload; invalid argument\n"); - return -1; - } - - if((offset = get_payload_offset(type, code)) < 0) { - LOG_ERR("6P-pkt: cannot get payload [type=%u, code=%u], invalid type\n", - type, code.value); - return -1; - } - - if((body_len - offset) > buf_len) { - LOG_ERR("6P-pkt: cannot get payload [type=%u, code=%u], ", - type, code.value); - LOG_ERR_("buf_len is too short\n"); - return -1; - } - - /* - * Copy the content in the Payload field as it is since 6P has no idea about - * the internal structure of the field. - */ - memcpy(buf, body + offset, buf_len); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_parse(const uint8_t *buf, uint16_t len, - sixp_pkt_t *pkt) -{ - assert(buf != NULL && pkt != NULL); - if(buf == NULL || pkt == NULL) { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of invalid argument\n"); - return -1; - } - - memset(pkt, 0, sizeof(sixp_pkt_t)); - - /* read the first 4 octets */ - if(len < 4) { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because it's a too short packet\n"); - return -1; - } - - /* parse the header as it's version 0 6P packet */ - pkt->version = buf[0] & 0x0f; - pkt->type = (buf[0] & 0x30) >> 4; - pkt->code.value = buf[1]; - pkt->sfid = buf[2]; - pkt->seqno = buf[3]; - - buf += 4; - len -= 4; - - LOG_INFO("6P-pkt: sixp_pkt_parse() is processing [type:%u, code:%u, len:%u]\n", - pkt->type, pkt->code.value, len); - - /* the rest is message body called "Other Fields" */ - if(pkt->type == SIXP_PKT_TYPE_REQUEST) { - switch(pkt->code.cmd) { - case SIXP_PKT_CMD_ADD: - case SIXP_PKT_CMD_DELETE: - /* Add and Delete has the same request format */ - if(len < (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t)) || - (len % sizeof(uint32_t)) != 0) { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of invalid length\n"); - return -1; - } - break; - case SIXP_PKT_CMD_RELOCATE: - if(len < (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_num_cells_t)) || - (len % sizeof(uint32_t)) != 0) { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of invalid length\n"); - return -1; - } - break; - case SIXP_PKT_CMD_COUNT: - if(len != (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t))) { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of invalid length\n"); - return -1; - } - break; - case SIXP_PKT_CMD_LIST: - if(len != (sizeof(sixp_pkt_metadata_t) + - sizeof(sixp_pkt_cell_options_t) + - sizeof(sixp_pkt_reserved_t) + - sizeof(sixp_pkt_offset_t) + - sizeof(sixp_pkt_max_num_cells_t))) { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of invalid length\n"); - return -1; - } - break; - case SIXP_PKT_CMD_SIGNAL: - if(len < sizeof(sixp_pkt_metadata_t)) { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of invalid length\n"); - return -1; - } - break; - case SIXP_PKT_CMD_CLEAR: - if(len != sizeof(sixp_pkt_metadata_t)) { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of invalid length\n"); - return -1; - } - break; - default: - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of unsupported cmd\n"); - return -1; - } - } else if(pkt->type == SIXP_PKT_TYPE_RESPONSE || - pkt->type == SIXP_PKT_TYPE_CONFIRMATION) { - switch(pkt->code.rc) { - case SIXP_PKT_RC_SUCCESS: - /* - * The "Other Field" contains - * - Res to CLEAR: Empty (length 0) - * - Res to STATUS: "Num. Cells" (total_num_cells) - * - Res to ADD, DELETE, LIST: 0, 1, or multiple 6P cells - * - Res to SIGNAL: Payload (arbitrary length) - */ - /* we accept any length because of SIGNAL */ - break; - case SIXP_PKT_RC_EOL: - if((len % sizeof(uint32_t)) != 0) { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of invalid length\n"); - return -1; - } - break; - case SIXP_PKT_RC_ERR: - case SIXP_PKT_RC_RESET: - case SIXP_PKT_RC_ERR_VERSION: - case SIXP_PKT_RC_ERR_SFID: - case SIXP_PKT_RC_ERR_SEQNUM: - case SIXP_PKT_RC_ERR_CELLLIST: - case SIXP_PKT_RC_ERR_BUSY: - case SIXP_PKT_RC_ERR_LOCKED: - if(len != 0) { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of invalid length\n"); - return -1; - } - break; - default: - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of unsupported code\n"); - return -1; - } - } else { - LOG_ERR("6P-pkt: sixp_pkt_parse() fails because of unsupported type\n"); - return -1; - } - - pkt->body = buf; - pkt->body_len = len; - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -sixp_pkt_create(sixp_pkt_type_t type, sixp_pkt_code_t code, - uint8_t sfid, uint8_t seqno, - const uint8_t *body, uint16_t body_len, sixp_pkt_t *pkt) -{ - uint8_t *hdr; - - assert((body == NULL && body_len == 0) || (body != NULL && body_len > 0)); - if((body == NULL && body_len > 0) || (body != NULL && body_len == 0)) { - LOG_ERR("6P-pkt: sixp_pkt_create() fails because of invalid argument\n"); - return -1; - } - - packetbuf_clear(); - - /* - * We're going to create a packet having 6top IE header (4 octets) and body - * (body_len octets). - */ - if(PACKETBUF_SIZE < (packetbuf_totlen() + body_len)) { - LOG_ERR("6P-pkt: sixp_pkt_create() fails because body is too long\n"); - return -1; - } - - if(packetbuf_hdralloc(4) != 1) { - LOG_ERR("6P-pkt: sixp_pkt_create fails to allocate header space\n"); - return -1; - } - hdr = packetbuf_hdrptr(); - /* header: write the 6top IE header, 4 octets */ - hdr[0] = (type << 4) | SIXP_PKT_VERSION; - hdr[1] = code.value; - hdr[2] = sfid; - hdr[3] = seqno; - - /* data: write body */ - if(body_len > 0 && body != NULL) { - memcpy(packetbuf_dataptr(), body, body_len); - packetbuf_set_datalen(body_len); - } - - /* copy information of a sending packet into pkt if necessary */ - if(pkt != NULL) { - pkt->type = type; - pkt->code = code; - pkt->sfid = sfid; - pkt->seqno = seqno; - pkt->body = body; - pkt->body_len = body_len; - } - - /* packetbuf is ready to be sent */ - return 0; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/sixtop/sixp-pkt.h b/os/net/mac/tsch/sixtop/sixp-pkt.h deleted file mode 100644 index 37bd91eae..000000000 --- a/os/net/mac/tsch/sixtop/sixp-pkt.h +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * Copyright (c) 2016, Centre for Development of Advanced Computing (C-DAC). - * 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. - */ -/** - * \addtogroup sixtop - * @{ - */ -/** - * \file - * 6top Protocol (6P) Packet Manipulation APIs - * \author - * Shalu R - * Lijo Thomas - * Yasuyuki Tanaka - */ -#ifndef _SIXTOP_6P_PACKET_H_ -#define _SIXTOP_6P_PACKET_H_ - -#define SIXP_PKT_VERSION 0x00 - -/* typedefs for code readability */ -typedef uint8_t sixp_pkt_version_t; -typedef uint8_t sixp_pkt_cell_options_t; -typedef uint8_t sixp_pkt_num_cells_t; -typedef uint8_t sixp_pkt_reserved_t; -typedef uint16_t sixp_pkt_metadata_t; -typedef uint16_t sixp_pkt_max_num_cells_t; -typedef uint16_t sixp_pkt_offset_t; -typedef uint32_t sixp_pkt_cell_t; -typedef uint16_t sixp_pkt_total_num_cells_t; - -/** - * \brief 6P Message Types - */ -typedef enum { - SIXP_PKT_TYPE_REQUEST = 0x00, /**< 6P Request */ - SIXP_PKT_TYPE_RESPONSE = 0x01, /**< 6P Response */ - SIXP_PKT_TYPE_CONFIRMATION = 0x02, /**< 6P Confirmation */ - SIXP_PKT_TYPE_RESERVED = 0x03, /**< Reserved */ -} sixp_pkt_type_t; - -/** - * \brief 6P Command Identifiers - */ -typedef enum { - SIXP_PKT_CMD_ADD = 0x01, /**< CMD_ADD */ - SIXP_PKT_CMD_DELETE = 0x02, /**< CMD_DELETE */ - SIXP_PKT_CMD_RELOCATE = 0x03, /**< CMD_STATUS */ - SIXP_PKT_CMD_COUNT = 0x04, /**< CMD_STATUS */ - SIXP_PKT_CMD_LIST = 0x05, /**< CMD_LIST */ - SIXP_PKT_CMD_SIGNAL = 0x06, /**< CMD_SIGNAL */ - SIXP_PKT_CMD_CLEAR = 0x07, /**< CMD_CLEAR */ - SIXP_PKT_CMD_UNAVAILABLE = 0xff, /**< for internal use */ -} sixp_pkt_cmd_t; - -/** - * \brief 6P Return Codes - */ -typedef enum { - SIXP_PKT_RC_SUCCESS = 0x00, /**< RC_SUCCESS */ - SIXP_PKT_RC_EOL = 0x01, /**< RC_EOL */ - SIXP_PKT_RC_ERR = 0x02, /**< RC_ERR */ - SIXP_PKT_RC_RESET = 0x03, /**< RC_RESET */ - SIXP_PKT_RC_ERR_VERSION = 0x04, /**< RC_ERR_VERSION */ - SIXP_PKT_RC_ERR_SFID = 0x05, /**< RC_ERR_SFID */ - SIXP_PKT_RC_ERR_SEQNUM = 0x06, /**< RC_ERR_SEQNUM */ - SIXP_PKT_RC_ERR_CELLLIST = 0x07, /**< RC_ERR_CELLLIST */ - SIXP_PKT_RC_ERR_BUSY = 0x08, /**< RC_ERR_BUSY */ - SIXP_PKT_RC_ERR_LOCKED = 0x09, /**< RC_ERR_LOCKED */ - -} sixp_pkt_rc_t; - -/** - * \brief 6P Codes integrating Command IDs and Return Codes - */ -typedef union { - sixp_pkt_cmd_t cmd; /**< 6P Command Identifier */ - sixp_pkt_rc_t rc; /**< 6P Return Code */ - uint8_t value; /**< 8-bit unsigned integer value */ -} sixp_pkt_code_t; - -/** - * \brief 6P Cell Options - */ -typedef enum { - SIXP_PKT_CELL_OPTION_TX = 0x01, /**< TX Cell */ - SIXP_PKT_CELL_OPTION_RX = 0x02, /**< RX Cell */ - SIXP_PKT_CELL_OPTION_SHARED = 0x04 /**< SHARED Cell */ -} sixp_pkt_cell_option_t; - -/** - * \brief 6top IE Structure - */ -typedef struct { - sixp_pkt_version_t version; /**< Version */ - sixp_pkt_type_t type; /**< Type */ - sixp_pkt_code_t code; /**< Code */ - uint8_t sfid; /**< SFID */ - uint8_t seqno; /**< SeqNum */ - const uint8_t *body; /**< Other Fields... */ - uint16_t body_len; /**< The length of Other Fields */ -} sixp_pkt_t; - -/** - * \brief Write Metadata into "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param metadata Metadata to write - * \param body The pointer to "Other Fields" in a buffer - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_metadata(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_metadata_t metadata, - uint8_t *body, uint16_t body_len); - -/** - * \brief Read Metadata stored in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param metadata The pointer to a buffer to store Metadata in - * \param body The pointer to the buffer having "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_metadata(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_metadata_t *metadata, - const uint8_t *body, uint16_t body_len); - -/** - * \brief Write CellOptions in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param cell_options "CellOptions" to write - * \param body The pointer to buffer having "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_cell_options(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_cell_options_t cell_options, - uint8_t *body, uint16_t body_len); - -/** - * \brief Read CellOptions in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param cell_options The pointer to buffer to store CellOptions in - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_cell_options(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_cell_options_t *cell_options, - const uint8_t *body, uint16_t body_len); - -/** - * \brief Write NumCells in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param num_cells "NumCells" to write - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_num_cells(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_num_cells_t num_cells, - uint8_t *body, uint16_t body_len); - -/** - * \brief Read NumCells in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param num_cells The pointer to buffer to store NumCells in - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_num_cells(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_num_cells_t *num_cells, - const uint8_t *body, uint16_t body_len); -/** - * \brief Write Reserved in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param reserved "Reserved" to write - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_reserved(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_reserved_t reserved, - uint8_t *body, uint16_t body_len); - -/** - * \brief Read Reserved in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param reserved The pointer to buffer to store Reserved in - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_reserved(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_reserved_t *reserved, - const uint8_t *body, uint16_t body_len); - -/** - * \brief Write Offset in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param offset "Offset" to write - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_offset(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_offset_t offset, - uint8_t *body, uint16_t body_len); -/** - * \brief Read Offset in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param offset The pointer to buffer to store Offset in - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_offset(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_offset_t *offset, - const uint8_t *body, uint16_t body_len); - -/** - * \brief Write MaxNumCells in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param max_num_cells "MaxNumCells" to write - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_max_num_cells(sixp_pkt_type_t type, - sixp_pkt_code_t code, - sixp_pkt_max_num_cells_t max_num_cells, - uint8_t *body, uint16_t body_len); - -/** - * \brief Read MaxNumCells in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param max_num_cells The pointer to buffer to store MaxNumCells in - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_max_num_cells(sixp_pkt_type_t type, - sixp_pkt_code_t code, - sixp_pkt_max_num_cells_t *max_num_cells, - const uint8_t *body, uint16_t body_len); - -/** - * \brief Write CellList in "Other Fields" of 6P packet - * \note "offset" is specified by index in CellList - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param cell_list The pointer to "CellList" to write - * \param cell_list_len Length to write - * \param offset Offset in the "CellList" field to start writing - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *cell_list, - uint16_t cell_list_len, - uint16_t offset, - uint8_t *body, uint16_t body_len); -/** - * \brief Read CellList in "Other Fields" of 6P packet - * \note If you want only the length of CellList, you can set null to cell_list. - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param cell_list The double pointer to store the starting address of CellList - * \param cell_list_len Pointer to store the length of CellList - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t **cell_list, - sixp_pkt_offset_t *cell_list_len, - const uint8_t *body, uint16_t body_len); - -/** - * \brief Write RelCellList in "Other Fields" of 6P packet - * \note "offset" is specified by index in RelCellList - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param rel_cell_list The pointer to "RelCellList" to write - * \param rel_cell_list_len Length to write - * \param offset Offset in the "RelCellList" field to start writing - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_rel_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *rel_cell_list, - uint16_t rel_cell_list_len, - uint16_t offset, - uint8_t *body, uint16_t body_len); - -/** - * \brief Read RelCellList in "Other Fields" of 6P packet - * \note If you want only the length of RelCellList, you can set null to - * rel_cell_list. - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param rel_cell_list The double pointer to store the starting address of - * RelCellList - * \param rel_cell_list_len Pointer to store the length of a returned - * RelCellList - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_rel_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t **rel_cell_list, - sixp_pkt_offset_t *rel_cell_list_len, - const uint8_t *body, uint16_t body_len); - -/** - * \brief Write CandCellList in "Other Fields" of 6P packet - * \note "offset" is specified by index in CandCellList - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param cand_cell_list The pointer to "CandCellList" to write - * \param cand_cell_list_len Length to write - * \param offset Offset in the "CandCellList" field to start writing - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_cand_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *cand_cell_list, - uint16_t cand_cell_list_len, - uint16_t offset, - uint8_t *body, uint16_t body_len); - -/** - * \brief Read CandCellList in "Other Fields" of 6P packet - * \note If you want only the length of CandCellList, you can set null to - * cell_list. - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param cand_cell_list The double pointer to store the starting address of - * CandCellList - * \param cand_cell_list_len Pointer to store the length of CandCellList - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_cand_cell_list(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t **cand_cell_list, - sixp_pkt_offset_t *cand_cell_list_len, - const uint8_t *body, uint16_t body_len); - -/** - * \brief Write TotalNumCells in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param total_num_cells "TotalNumCells" to write - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_total_num_cells(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_total_num_cells_t total_num_cells, - uint8_t *body, uint16_t body_len); - -/** - * \brief Read TotalNumCells in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param total_num_cells The pointer to buffer to store TotalNumCells in - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_total_num_cells(sixp_pkt_type_t type, sixp_pkt_code_t code, - sixp_pkt_total_num_cells_t *total_num_cells, - const uint8_t *body, uint16_t body_len); - -/** - * \brief Write Payload in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param payload "Payload" to write - * \param payload_len The length of "Payload" to write - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_set_payload(sixp_pkt_type_t type, sixp_pkt_code_t code, - const uint8_t *payload, uint16_t payload_len, - uint8_t *body, uint16_t body_len); - -/** - * \brief Read Payload in "Other Fields" of 6P packet - * \param type 6P Message Type - * \param code 6P Command Identifier or Return Code - * \param buf The pointer to buffer to store "Payload" in - * \param buf_len The length of buf - * \param body The pointer to buffer pointing to "Other Fields" - * \param body_len The length of body, typically "Other Fields" length - * \return 0 on success, -1 on failure - */ -int sixp_pkt_get_payload(sixp_pkt_type_t type, sixp_pkt_code_t code, - uint8_t *buf, uint16_t buf_len, - const uint8_t *body, uint16_t body_len); - -/** - * \brief Parse a 6P packet - * \param buf The pointer to a buffer pointing 6top IE Content - * \param len The length of the buffer - * \param pkt The pointer to a sixp_pkt_t structure to store packet info - * \return 0 on success, -1 on failure - */ -int sixp_pkt_parse(const uint8_t *buf, uint16_t len, - sixp_pkt_t *pkt); - -/** - * \brief Create a 6P packet - * \param type 6P Message Type - * \param code 6P Message Code, Command Identifier or Return Code - * \param sfid Scheduling Function Identifier - * \param seqno Sequence Number - * \param body The pointer to "Other Fields" in a buffer - * \param body_len The length of body, typically "Other Fields" length - * \param pkt The pointer to a sixp_pkt_t structure to store packet info - * (option) - * \return 0 on success, -1 on failure - */ -int sixp_pkt_create(sixp_pkt_type_t type, sixp_pkt_code_t code, - uint8_t sfid, uint8_t seqno, - const uint8_t *body, uint16_t body_len, - sixp_pkt_t *pkt); - -#endif /* !_SIXP_PKT_H_ */ -/** @} */ diff --git a/os/net/mac/tsch/sixtop/sixp-trans.c b/os/net/mac/tsch/sixtop/sixp-trans.c deleted file mode 100644 index cd15a00d7..000000000 --- a/os/net/mac/tsch/sixtop/sixp-trans.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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. - */ -/** - * \addtogroup sixtop - * @{ - */ -/** - * \file - * Transaction Management for 6top Protocol (6P) - * \author - * Yasuyuki Tanaka - */ - -#include "contiki-lib.h" -#include "lib/assert.h" - -#include "sixtop.h" -#include "sixtop-conf.h" -#include "sixp-nbr.h" -#include "sixp-trans.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "6top" -#define LOG_LEVEL LOG_LEVEL_6TOP - -/** - * \brief 6P Transaction Data Structure (for internal use) - */ -typedef struct sixp_trans { - struct sixp_trans *next; - const sixtop_sf_t *sf; - linkaddr_t peer_addr; - uint8_t seqno; - sixp_pkt_cmd_t cmd; - sixp_trans_state_t state; - sixp_trans_mode_t mode; - struct { - sixp_sent_callback_t func; - void *arg; - uint16_t arg_len; - } callback; - struct ctimer timer; -} sixp_trans_t; - -static void handle_trans_timeout(void *ptr); -static void process_trans(void *ptr); -static void schedule_trans_process(sixp_trans_t *trans); -static void free_trans(sixp_trans_t *trans); -static sixp_trans_mode_t determine_trans_mode(const sixp_pkt_t *req); - -MEMB(trans_memb, sixp_trans_t, SIXTOP_MAX_TRANSACTIONS); -LIST(trans_list); - -/*---------------------------------------------------------------------------*/ -static void -handle_trans_timeout(void *ptr) -{ - sixp_trans_t *trans = (sixp_trans_t *)ptr; - - assert(trans != NULL); - if(trans == NULL) { - return; - } - - if(trans->sf->timeout != NULL) { - trans->sf->timeout(trans->cmd, - (const linkaddr_t *)&trans->peer_addr); - } - - (void)sixp_trans_transit_state(trans, SIXP_TRANS_STATE_TERMINATING); -} -/*---------------------------------------------------------------------------*/ -static void -start_trans_timer(sixp_trans_t *trans) -{ - ctimer_set(&trans->timer, trans->sf->timeout_interval, - handle_trans_timeout, trans); -} -/*---------------------------------------------------------------------------*/ -static void -process_trans(void *ptr) -{ - sixp_trans_t *trans = (sixp_trans_t *)ptr; - - assert(trans != NULL); - if(trans == NULL) { - return; - } - - /* make sure that the timer is stopped */ - ctimer_stop(&trans->timer); - - /* state-specific operation */ - if(trans->state == SIXP_TRANS_STATE_TERMINATING) { - /* handle the terminating state first */ - LOG_INFO("6P-trans: trans [peer_addr:"); - LOG_INFO_LLADDR((const linkaddr_t *)&trans->peer_addr); - LOG_INFO_(", seqno:%u] is going to be freed\n", trans->seqno); - free_trans(trans); - return; - } - - switch(trans->state) { - /* do for others */ - case SIXP_TRANS_STATE_RESPONSE_SENT: - case SIXP_TRANS_STATE_RESPONSE_RECEIVED: - if(trans->mode == SIXP_TRANS_MODE_2_STEP) { - (void)sixp_trans_transit_state(trans, SIXP_TRANS_STATE_TERMINATING); - } - break; - case SIXP_TRANS_STATE_CONFIRMATION_SENT: - case SIXP_TRANS_STATE_CONFIRMATION_RECEIVED: - (void)sixp_trans_transit_state(trans, SIXP_TRANS_STATE_TERMINATING); - break; - case SIXP_TRANS_STATE_TERMINATING: - default: - break; - } - - if(trans->state != SIXP_TRANS_STATE_TERMINATING) { - /* set the timer with a timeout values defined by the SF */ - start_trans_timer(trans); - } -} -/*---------------------------------------------------------------------------*/ -static void -schedule_trans_process(sixp_trans_t *trans) -{ - assert(trans != NULL); - if(trans == NULL) { - return; - } - - ctimer_stop(&trans->timer); - ctimer_set(&trans->timer, 0, process_trans, trans); /* expires immediately */ -} -/*---------------------------------------------------------------------------*/ -static void -free_trans(sixp_trans_t *trans) -{ - assert(trans != NULL); - if(trans == NULL) { - return; - } - - list_remove(trans_list, trans); - memb_free(&trans_memb, trans); -} -/*---------------------------------------------------------------------------*/ -static sixp_trans_mode_t -determine_trans_mode(const sixp_pkt_t *req) -{ - uint16_t cell_list_len; - - assert(req != NULL); - if(req == NULL) { - return SIXP_TRANS_MODE_UNAVAILABLE; - } - - /* - * We consider a transaction as 3-step if and only if its request command is - * either Add or Delete AND its cell_list is empty. Otherwise, 2-step. - */ - if(req->type == SIXP_PKT_TYPE_REQUEST && - (req->code.cmd == SIXP_PKT_CMD_ADD || - req->code.cmd == SIXP_PKT_CMD_DELETE) && - sixp_pkt_get_cell_list(req->type, (sixp_pkt_code_t)req->code.value, - NULL, &cell_list_len, - req->body, req->body_len) == 0 && - cell_list_len == 0) { - return SIXP_TRANS_MODE_3_STEP; - } - - return SIXP_TRANS_MODE_2_STEP; -} -/*---------------------------------------------------------------------------*/ -int -sixp_trans_transit_state(sixp_trans_t *trans, sixp_trans_state_t new_state) -{ - sixp_nbr_t *nbr; - - assert(trans != NULL); - if(trans == NULL) { - LOG_ERR("6top: invalid argument, trans is NULL\n"); - return -1; - } - - /* enforce state transition rules */ - if(new_state == SIXP_TRANS_STATE_TERMINATING || - (new_state == SIXP_TRANS_STATE_REQUEST_SENT && - trans->state == SIXP_TRANS_STATE_INIT) || - (new_state == SIXP_TRANS_STATE_REQUEST_RECEIVED && - trans->state == SIXP_TRANS_STATE_INIT) || - (new_state == SIXP_TRANS_STATE_RESPONSE_SENT && - trans->state == SIXP_TRANS_STATE_REQUEST_RECEIVED) || - (new_state == SIXP_TRANS_STATE_RESPONSE_RECEIVED && - trans->state == SIXP_TRANS_STATE_REQUEST_SENT) || - (new_state == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED && - trans->state == SIXP_TRANS_STATE_RESPONSE_SENT && - trans->mode == SIXP_TRANS_MODE_3_STEP) || - (new_state == SIXP_TRANS_STATE_CONFIRMATION_SENT && - trans->state == SIXP_TRANS_STATE_RESPONSE_RECEIVED && - trans->mode == SIXP_TRANS_MODE_3_STEP)) { - LOG_INFO("6P-trans: trans %p state changes from %u to %u\n", - trans, trans->state, new_state); - - if(new_state == SIXP_TRANS_STATE_REQUEST_SENT) { - /* - * that is, the request is acknowledged by the peer; increment - * next_seqno - */ - if((nbr = sixp_nbr_find(&trans->peer_addr)) == NULL) { - LOG_ERR("6top: cannot increment next_seqno\n"); - } else { - if(trans->cmd == SIXP_PKT_CMD_CLEAR) { - /* next_seqno must have been reset to 0 already. */ - assert(sixp_nbr_get_next_seqno(nbr) == 0); - } else { - sixp_nbr_increment_next_seqno(nbr); - } - } - } else if(new_state == SIXP_TRANS_STATE_RESPONSE_SENT) { - if((nbr = sixp_nbr_find(&trans->peer_addr)) == NULL) { - LOG_ERR("6top: cannot update next_seqno\n"); - } else { - /* override next_seqno with the received one unless it's zero */ - if(trans->seqno != 0) { - sixp_nbr_set_next_seqno(nbr, trans->seqno); - } - sixp_nbr_increment_next_seqno(nbr); - } - } - - trans->state = new_state; - schedule_trans_process(trans); - return 0; - } - - /* invalid transition */ - LOG_ERR("6P-trans: invalid transaction, from %u to %u, detected on trans %p\n", - trans->state, new_state, trans); - return -1; -} -/*---------------------------------------------------------------------------*/ -sixp_pkt_cmd_t -sixp_trans_get_cmd(sixp_trans_t *trans) -{ - assert(trans != NULL); - if(trans == NULL) { - return SIXP_PKT_CMD_UNAVAILABLE; - } - return trans->cmd; -} -/*---------------------------------------------------------------------------*/ -sixp_trans_state_t -sixp_trans_get_state(sixp_trans_t *trans) -{ - assert(trans != NULL); - if(trans == NULL) { - return SIXP_TRANS_STATE_UNAVAILABLE; - } - return trans->state; -} -/*---------------------------------------------------------------------------*/ -int16_t -sixp_trans_get_seqno(sixp_trans_t *trans) -{ - assert(trans != NULL); - if(trans == NULL) { - LOG_ERR("6P-trans: sixp_trans_get_seqno() fails because trans is NULL\n"); - return -1; - } - return trans->seqno; -} -/*---------------------------------------------------------------------------*/ -sixp_trans_mode_t -sixp_trans_get_mode(sixp_trans_t *trans) -{ - assert(trans != NULL); - if(trans == NULL) { - LOG_ERR("6P-trans: sixp_trans_get_mode() fails because trans is NULL\n"); - return SIXP_TRANS_STATE_UNAVAILABLE; - } - return trans->mode; -} -/*---------------------------------------------------------------------------*/ -void -sixp_trans_invoke_callback(sixp_trans_t *trans, sixp_output_status_t status) -{ - assert(trans != NULL); - - if(trans == NULL || trans->callback.func == NULL) { - return; - } - trans->callback.func(trans->callback.arg, trans->callback.arg_len, - &trans->peer_addr, status); -} -/*---------------------------------------------------------------------------*/ -void -sixp_trans_set_callback(sixp_trans_t *trans, - sixp_sent_callback_t func, void *arg, uint16_t arg_len) -{ - assert(trans != NULL); - if(trans == NULL) { - return; - } - trans->callback.func = func; - trans->callback.arg = arg; - trans->callback.arg_len = arg_len; -} -/*---------------------------------------------------------------------------*/ -sixp_trans_t * -sixp_trans_alloc(const sixp_pkt_t *pkt, const linkaddr_t *peer_addr) -{ - const sixtop_sf_t *sf; - sixp_trans_t *trans; - - assert(pkt != NULL && peer_addr != NULL); - if(pkt == NULL || peer_addr == NULL) { - LOG_ERR("6P-trans: sixp_trans_alloc() fails because of invalid argument\n"); - return NULL; - } - - if((sf = sixtop_find_sf(pkt->sfid)) == NULL) { - LOG_ERR("6P-trans: sixp_trans_alloc() fails; no suitable SF [sfid:%u]\n", - pkt->sfid); - return NULL; - } - - if(sixp_trans_find(peer_addr) != NULL) { - LOG_ERR("6P-trans: sixp_trans_alloc() fails because another trans with "); - LOG_ERR_LLADDR((const linkaddr_t *)peer_addr); - LOG_ERR_("is in process\n"); - return NULL; - } - - if((trans = memb_alloc(&trans_memb)) == NULL) { - LOG_ERR("6P-trans: sixp_trans_alloc() fails because of lack of memory\n"); - return NULL; - } - - memset(trans, 0, sizeof(sixp_trans_t)); - trans->sf = sf; - trans->peer_addr = *peer_addr; - trans->seqno = pkt->seqno; - trans->cmd = pkt->code.value; - trans->state = SIXP_TRANS_STATE_INIT; - trans->mode = determine_trans_mode(pkt); - list_add(trans_list, trans); - start_trans_timer(trans); - - return trans; -} -/*---------------------------------------------------------------------------*/ -sixp_trans_t * -sixp_trans_find(const linkaddr_t *peer_addr) -{ - sixp_trans_t *trans; - - assert(peer_addr != NULL); - if(peer_addr == NULL) { - return NULL; - } - - /* - * XXX: we don't support concurrent 6P transactions which is mentioned in - * Section 4.3.3, draft-ietf-6tisch-6top-protocol-03. - * - * The assumption here is that there is one transactions for a single peer at - * most. - */ - for(trans = list_head(trans_list); - trans != NULL; trans = trans->next) { - if(memcmp(peer_addr, &trans->peer_addr, sizeof(linkaddr_t)) == 0) { - return trans; - } - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -int -sixp_trans_init(void) -{ - sixp_trans_t *trans, *next_trans; - - /* make sure there's no timer task left before the initialization */ - for(trans = list_head(trans_list); - trans != NULL; trans = next_trans) { - next_trans = trans->next; - ctimer_stop(&trans->timer); - free_trans(trans); - } - - list_init(trans_list); - memb_init(&trans_memb); - return 0; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/sixtop/sixp-trans.h b/os/net/mac/tsch/sixtop/sixp-trans.h deleted file mode 100644 index e5c53cda0..000000000 --- a/os/net/mac/tsch/sixtop/sixp-trans.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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. - */ -/** - * \addtogroup sixtop - * @{ - */ -/** - * \file - * Transaction Management APIs for 6top Protocol (6P) - * \author - * Yasuyuki Tanaka - */ - -#include "sixp.h" -#include "sixp-pkt.h" - -/** - * \brief 6P Transaction States (for internal use) - */ -typedef enum { - SIXP_TRANS_STATE_UNAVAILABLE = 0, - SIXP_TRANS_STATE_INIT, - SIXP_TRANS_STATE_REQUEST_SENT, - SIXP_TRANS_STATE_REQUEST_RECEIVED, - SIXP_TRANS_STATE_RESPONSE_SENT, - SIXP_TRANS_STATE_RESPONSE_RECEIVED, - SIXP_TRANS_STATE_CONFIRMATION_SENT, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED, - SIXP_TRANS_STATE_TERMINATING, -} sixp_trans_state_t; - -/** - * \brief 6P Transaction Modes (for internal use) - */ -typedef enum { - SIXP_TRANS_MODE_UNAVAILABLE = 0, - SIXP_TRANS_MODE_2_STEP, - SIXP_TRANS_MODE_3_STEP -} sixp_trans_mode_t; - -typedef struct sixp_trans sixp_trans_t; - -/** - * \brief Change the state of a specified transaction - * \param trans The pointer to a transaction - * \param new_state New state to move the transaction to - * \return 0 on success, -1 on failure - */ -int sixp_trans_transit_state(sixp_trans_t *trans, - sixp_trans_state_t new_state); - -/** - * \brief Return the command associated with a specified transaction - * \param trans The pointer to a transaction - * \return Command identifier; SIXP_PKT_CMD_UNAVAILABLE on failure - */ -sixp_pkt_cmd_t sixp_trans_get_cmd(sixp_trans_t *trans); - -/** - * \brief Return the state of a specified transaction - * \param trans The pointer to a transaction - * \return a state of the transaction; SIXP_TRANS_STATE_UNAVAILABLE if the - * transaction is not found in the system. - */ -sixp_trans_state_t sixp_trans_get_state(sixp_trans_t *trans); - -/** - * \brief Return the sequence number associated with a specified transaction - * \param trans The pointer of a transaction - * \return 0 or larger than 0 on success, -1 on failure - */ -int16_t sixp_trans_get_seqno(sixp_trans_t *trans); - -/** - * \brief Return the mode, 2-step or 3-step, of a specified transaction - * \param trans The pointer to a transaction - * \return The mode of the transaction, SIXP_TRANS_MODE_UNAVAILABLE on failure - */ -sixp_trans_mode_t sixp_trans_get_mode(sixp_trans_t *trans); - -/** - * \brief Invoke the output callback of a specified transaction - * \param trans The pointer to a transaction - * \param status An output result value - */ -void sixp_trans_invoke_callback(sixp_trans_t *trans, - sixp_output_status_t status); - -/** - * \brief Set an output callback to a specified transaction - * \param trans The pointer to a transaction - * \param func The pointer to a callback function - * \param arg The pointer to an argument which will be passed to func - * \param arg_len The length of the argument - */ -void sixp_trans_set_callback(sixp_trans_t *trans, - sixp_sent_callback_t func, - void *arg, - uint16_t arg_len); - -/** - * \brief Allocate a transaction - * \param pkt The pointer to a packet which triggers the allocation - * \param peer_addr The peer address which will be associated - * \return A pointer to an newly allocated transaction, NULL on failure - */ -sixp_trans_t *sixp_trans_alloc(const sixp_pkt_t *pkt, - const linkaddr_t *peer_addr); - -/** - * \brief Find a transaction - * \param peer_addr The peer address - * \return The pointer to a transaction; NULL on failure - */ -sixp_trans_t *sixp_trans_find(const linkaddr_t *peer_addr); - -/** - * \brief Initialize Memory and List for 6P transactions - * This function removes and frees existing transactions. - */ -int sixp_trans_init(void); - -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/sixtop/sixp.c b/os/net/mac/tsch/sixtop/sixp.c deleted file mode 100644 index e8c8c49b0..000000000 --- a/os/net/mac/tsch/sixtop/sixp.c +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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. - */ -/** - * \addtogroup sixtop - * @{ - */ -/** - * \file - * 6top Protocol (6P) - * \author - * Yasuyuki Tanaka - */ - -#include "contiki-lib.h" -#include "lib/assert.h" - -#include "sixtop.h" -#include "sixp-nbr.h" -#include "sixp-pkt.h" -#include "sixp-trans.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "6top" -#define LOG_LEVEL LOG_LEVEL_6TOP - -static void mac_callback(void *ptr, int status, int transmissions); -static int send_back_error(sixp_pkt_type_t type, sixp_pkt_code_t code, - uint8_t sfid, uint8_t seqno, - const linkaddr_t *dest_addr); -/*---------------------------------------------------------------------------*/ -static void -mac_callback(void *ptr, int status, int transmissions) -{ - sixp_trans_t *trans = (sixp_trans_t *)ptr; - sixp_trans_state_t new_state, current_state; - - assert(trans != NULL); - if(trans == NULL) { - LOG_ERR("6P: mac_callback() fails because trans is NULL\n"); - return; - } - - current_state = sixp_trans_get_state(trans); - if(status == MAC_TX_OK) { - switch(current_state) { - case SIXP_TRANS_STATE_INIT: - new_state = SIXP_TRANS_STATE_REQUEST_SENT; - break; - case SIXP_TRANS_STATE_REQUEST_RECEIVED: - new_state = SIXP_TRANS_STATE_RESPONSE_SENT; - break; - case SIXP_TRANS_STATE_RESPONSE_RECEIVED: - new_state = SIXP_TRANS_STATE_CONFIRMATION_SENT; - break; - default: - LOG_ERR("6P: mac_callback() fails because of an unexpected state (%u)\n", - current_state); - return; - } - } else { - /* - * In a case of transmission failure of a request, a corresponding SF would - * retransmit the request with a new transaction. For a response or a - * confirmation, the same transaction will be used for retransmission as - * long as it doesn't have timeout. - */ - if(current_state == SIXP_TRANS_STATE_INIT) { - /* request case */ - new_state = SIXP_TRANS_STATE_TERMINATING; - } else { - /* response or confirmation case: stay the same state */ - new_state = current_state; - } - } - - if(new_state != current_state && - sixp_trans_transit_state(trans, new_state) != 0) { - LOG_ERR("6P: mac_callback() fails because of state transition failure\n"); - LOG_ERR("6P: something wrong; we're terminating the trans %p\n", trans); - (void)sixp_trans_transit_state(trans, SIXP_TRANS_STATE_TERMINATING); - return; - } - - sixp_trans_invoke_callback(trans, - status == MAC_TX_OK ? - SIXP_OUTPUT_STATUS_SUCCESS : - SIXP_OUTPUT_STATUS_FAILURE); - sixp_trans_set_callback(trans, NULL, NULL, 0); -} -/*---------------------------------------------------------------------------*/ -static int -send_back_error(sixp_pkt_type_t type, sixp_pkt_code_t code, - uint8_t sfid, uint8_t seqno, - const linkaddr_t *dest_addr) -{ - /* create a 6P packet within packetbuf */ - if(sixp_pkt_create(type, code, sfid, seqno, NULL, 0, NULL) < 0) { - LOG_ERR("6P: failed to create a 6P packet to return an error [rc:%u]\n", - code.value); - return -1; - } - /* we don't care about how the transmission goes; no need to set callback */ - sixtop_output(dest_addr, NULL, NULL); - return 0; -} -/*---------------------------------------------------------------------------*/ -void -sixp_input(const uint8_t *buf, uint16_t len, const linkaddr_t *src_addr) -{ - sixp_pkt_t pkt; - sixp_trans_t *trans; - sixp_nbr_t *nbr; - const sixtop_sf_t *sf; - int16_t seqno; - int ret; - - assert(buf != NULL && src_addr != NULL); - if(buf == NULL || src_addr == NULL) { - return; - } - - if(sixp_pkt_parse(buf, len, &pkt) < 0) { - if(pkt.version != SIXP_PKT_VERSION) { - LOG_ERR("6P: sixp_input() unsupported version %u\n", pkt.version); - if(send_back_error(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR_VERSION, - pkt.sfid, pkt.seqno, - src_addr) < 0) { - LOG_ERR("6P: sixp_input() fails to send RC_ERR_VERSION\n"); - return; - } - } - LOG_ERR("6P: sixp_input() fails because of a malformed 6P packet\n"); - return; - } - - if(pkt.type != SIXP_PKT_TYPE_REQUEST && - pkt.type != SIXP_PKT_TYPE_RESPONSE && - pkt.type != SIXP_PKT_TYPE_CONFIRMATION) { - LOG_ERR("6P: sixp_input() fails because of unsupported type [type:%u]\n", - pkt.type); - return; - } - - if((sf = sixtop_find_sf(pkt.sfid)) == NULL) { - LOG_ERR("6P: sixp_input() fails because SF [sfid:%u] is unavailable\n", - pkt.sfid); - /* - * XXX: what if the incoming packet is a response? confirmation should be - * sent back? - */ - if(send_back_error(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR_SFID, - pkt.sfid, pkt.seqno, src_addr) < 0) { - LOG_ERR("6P: sixp_input() fails to return an error response\n"); - }; - return; - } - - /* Transaction Management */ - trans = sixp_trans_find(src_addr); - - if(pkt.type == SIXP_PKT_TYPE_REQUEST) { - if(trans != NULL) { - /* Error: not supposed to have another transaction with the peer. */ - LOG_ERR("6P: sixp_input() fails because another request [peer_addr:"); - LOG_ERR_LLADDR((const linkaddr_t *)src_addr); - LOG_ERR_(" seqno:%u] is in process\n", sixp_trans_get_seqno(trans)); - if(send_back_error(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR_BUSY, - pkt.sfid, pkt.seqno, src_addr) < 0) { - LOG_ERR("6P: sixp_input() fails to return an error response"); - } - return; - } - - if((pkt.code.cmd == SIXP_PKT_CMD_CLEAR) && - (nbr = sixp_nbr_find(src_addr)) != NULL) { - LOG_INFO("6P: sixp_input() reset nbr's next_seqno by CLEAR Request\n"); - sixp_nbr_reset_next_seqno(nbr); - } - - if((trans = sixp_trans_alloc(&pkt, src_addr)) == NULL) { - LOG_ERR("6P: sixp_input() fails because of lack of memory\n"); - if(send_back_error(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR_BUSY, - pkt.sfid, pkt.seqno, src_addr) < 0) { - LOG_ERR("6P: sixp_input() fails to return an error response\n"); - } - return; - } - - /* Inconsistency Management */ - if(pkt.code.cmd != SIXP_PKT_CMD_CLEAR && - (((nbr = sixp_nbr_find(src_addr)) == NULL && - (pkt.seqno != 0)) || - ((nbr != NULL) && - (sixp_nbr_get_next_seqno(nbr) != 0) && - pkt.seqno == 0))) { - if(trans != NULL) { - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_RECEIVED); - - } - if(send_back_error(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR_SEQNUM, - pkt.sfid, - nbr == NULL ? 0 : sixp_nbr_get_next_seqno(nbr), - src_addr) < 0) { - LOG_ERR("6P: sixp_input() fails to return an error response\n"); - } - return; - } - - } else if(pkt.type == SIXP_PKT_TYPE_RESPONSE || - pkt.type == SIXP_PKT_TYPE_CONFIRMATION) { - if(trans == NULL) { - /* Error: should have a transaction for incoming packet */ - LOG_ERR("6P: sixp_input() fails because of no trans [peer_addr:"); - LOG_ERR_LLADDR((const linkaddr_t *)src_addr); - LOG_ERR_("]\n"); - return; - } else if((seqno = sixp_trans_get_seqno(trans)) < 0 || - seqno != pkt.seqno) { - LOG_ERR("6P: sixp_input() fails because of invalid seqno [seqno:%u, %u]\n", - seqno, pkt.seqno); - return; - } - } - - /* state transition */ - assert(trans != NULL); - switch(pkt.type) { - case SIXP_PKT_TYPE_REQUEST: - ret = sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_RECEIVED); - break; - case SIXP_PKT_TYPE_RESPONSE: - ret = sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_RECEIVED); - break; - case SIXP_PKT_TYPE_CONFIRMATION: - ret = sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - break; - default: - LOG_ERR("6P: sixp_input() fails because of unsupported type [type:%u]\n", - pkt.type); - return; - } - if(ret < 0) { - LOG_ERR("6P: sixp_input() fails because of state transition failure\n"); - LOG_ERR("6P: something wrong; we're terminating the trans %p\n", trans); - (void)sixp_trans_transit_state(trans, SIXP_TRANS_STATE_TERMINATING); - return; - } - - if(sf->input != NULL) { - sf->input(pkt.type, pkt.code, pkt.body, pkt.body_len, src_addr); - } - - return; -} -/*---------------------------------------------------------------------------*/ -int -sixp_output(sixp_pkt_type_t type, sixp_pkt_code_t code, uint8_t sfid, - const uint8_t *body, uint16_t body_len, - const linkaddr_t *dest_addr, - sixp_sent_callback_t func, void *arg, uint16_t arg_len) -{ - sixp_trans_t *trans; - sixp_nbr_t *nbr; - sixp_pkt_cmd_t cmd; - int16_t seqno; - sixp_pkt_t pkt; - - assert(dest_addr != NULL); - - /* validate the state of a transaction with a specified peer */ - trans = sixp_trans_find(dest_addr); - if(type == SIXP_PKT_TYPE_REQUEST) { - if(trans != NULL) { - LOG_ERR("6P: sixp_output() fails because another trans for [peer_addr:"); - LOG_ERR_LLADDR((const linkaddr_t *)dest_addr); - LOG_ERR_("] is in process\n"); - return -1; - } else { - /* ready to send a request */ - /* we're going to allocate a new transaction later */ - } - } else if(type == SIXP_PKT_TYPE_RESPONSE) { - if(trans == NULL) { - LOG_ERR("6P: sixp_output() fails because of no transaction [peer_addr:"); - LOG_ERR_LLADDR((const linkaddr_t *)dest_addr); - LOG_ERR_("]\n"); - return -1; - } else if(sixp_trans_get_state(trans) != - SIXP_TRANS_STATE_REQUEST_RECEIVED) { - LOG_ERR("6P: sixp_output() fails because of invalid transaction state\n"); - return -1; - } else { - /* ready to send a response */ - } - } else if(type == SIXP_PKT_TYPE_CONFIRMATION) { - if(trans == NULL) { - LOG_ERR("6P: sixp_output() fails because of no transaction [peer_addr:"); - LOG_ERR_LLADDR((const linkaddr_t *)dest_addr); - LOG_ERR_("]\n"); - return -1; - } else if(sixp_trans_get_state(trans) != - SIXP_TRANS_STATE_RESPONSE_RECEIVED) { - LOG_ERR("6P: sixp_output() fails because of invalid transaction state\n"); - return -1; - } else { - /* ready to send a confirmation */ - } - } else { - LOG_ERR("6P: sixp_output() fails because of unsupported type [type:%u]\n", - type); - return -1; - } - - nbr = sixp_nbr_find(dest_addr); - - /* - * Make sure we have a nbr for the peer if the packet is a response with - * success so that we can manage the schedule generation. - */ - if(nbr == NULL && - type == SIXP_PKT_TYPE_RESPONSE && code.value == SIXP_PKT_RC_SUCCESS && - ((cmd = sixp_trans_get_cmd(trans)) == SIXP_PKT_CMD_ADD || - cmd == SIXP_PKT_CMD_DELETE) && - (nbr = sixp_nbr_alloc(dest_addr)) == NULL) { - LOG_ERR("6P: sixp_output() fails because of no memory for another nbr\n"); - return -1; - } - - /* set SeqNum */ - if(type == SIXP_PKT_TYPE_REQUEST) { - if(nbr == NULL && - (nbr = sixp_nbr_alloc(dest_addr)) == NULL) { - LOG_ERR("6P: sixp_output() fails because it fails to allocate a nbr\n"); - return -1; - } - if((seqno = sixp_nbr_get_next_seqno(nbr)) < 0){ - LOG_ERR("6P: sixp_output() fails to get the next sequence number\n"); - return -1; - } - if(code.cmd == SIXP_PKT_CMD_CLEAR) { - LOG_INFO("6P: sixp_output() reset nbr's next_seqno by CLEAR Request\n"); - sixp_nbr_reset_next_seqno(nbr); - } - } else { - assert(trans != NULL); - if((seqno = sixp_trans_get_seqno(trans)) < 0) { - LOG_ERR("6P: sixp_output() fails because it fails to get seqno\n"); - return -1; - } - } - - /* create a 6P packet within packetbuf */ - if(sixp_pkt_create(type, code, sfid, - (uint8_t)seqno, - body, body_len, - type == SIXP_PKT_TYPE_REQUEST ? &pkt : NULL) < 0) { - LOG_ERR("6P: sixp_output() fails to create a 6P packet\n"); - return -1; - } - - /* allocate a transaction for a sending request */ - if(type == SIXP_PKT_TYPE_REQUEST) { - assert(trans == NULL); - if((trans = sixp_trans_alloc(&pkt, dest_addr)) == NULL) { - LOG_ERR("6P: sixp_output() is aborted because of no memory\n"); - return -1; - } else { - /* ready for proceed */ - } - } - - assert(trans != NULL); - sixp_trans_set_callback(trans, func, arg, arg_len); - sixtop_output(dest_addr, mac_callback, trans); - - return 0; -} -/*---------------------------------------------------------------------------*/ -void -sixp_init(void) -{ - sixp_nbr_init(); - sixp_trans_init(); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/sixtop/sixp.h b/os/net/mac/tsch/sixtop/sixp.h deleted file mode 100644 index 3c03402d3..000000000 --- a/os/net/mac/tsch/sixtop/sixp.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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. - */ -/** - * \addtogroup sixtop - * @{ - */ -/** - * \file - * 6top Protocol (6P) APIs - * \author - * Yasuyuki Tanaka - */ - -#ifndef _SIXP_H_ -#define _SIXP_H_ - -#include "net/linkaddr.h" -#include "sys/clock.h" - -#include "sixp-pkt.h" - -#define SIXP_SUBIE_ID 0x00 - -#ifdef SIXP_CONF_WITH_PAYLOAD_TERMINATION_IE -#define SIXP_WITH_PAYLOAD_TERMINATION_IE SIXP_CONF_WITH_PAYLOAD_TERMINATION_IE -#else -#define SIXP_WITH_PAYLOAD_TERMINATION_IE 0 -#endif /* SIXP_CONF_WITH_PAYLOAD_TERMINATION_IE */ - -/** - * \brief The initial sequence number used for 6P request - */ -#define SIXP_INITIAL_SEQUENCE_NUMBER 0 - -/** - * \brief 6P Send Status, which represents sixp_output() result. - */ -typedef enum { - SIXP_OUTPUT_STATUS_SUCCESS, /**< SUCCESS */ - SIXP_OUTPUT_STATUS_FAILURE /**< FAILURE */ -} sixp_output_status_t; - -/** - * \brief 6P Packet Sent Handler - */ -typedef void (*sixp_sent_callback_t)(void *arg, uint16_t arg_len, - const linkaddr_t *dest_addr, - sixp_output_status_t status); - -/** - * \brief Input a 6P packet - * \param buf The pointer to a buffer pointing the head of 6top IE Content - * \param len The lengh of 6top IE Content - * \param src_addr The Source address of an incoming packet - * \return 0 if , -1 on failure - */ -void sixp_input(const uint8_t *buf, uint16_t len, - const linkaddr_t *src_addr); - -/** - * \brief Output a 6P packet - * \param type Message Type - * \param code Message Code; Command ID or Return Code - * \param sfid Scheduling Function Identifier - * \param body 6top IE Content - * \param body_len The length of 6top IE Content - * \param dest_addr The destination Address - * \param func callback function invoked after the transmission process - * \param arg The pointer to an argument to be passed with the callback - * \param arg_len The length of the argument - * \return 0 on success, -1 on failure - */ -int sixp_output(sixp_pkt_type_t type, sixp_pkt_code_t code, uint8_t sfid, - const uint8_t *body, uint16_t body_len, - const linkaddr_t *dest_addr, - sixp_sent_callback_t func, void *arg, uint16_t arg_len); - -/** - * \brief Initialize 6P Module - * It invokes sixp_nbr_init() and sixp_trans_init(). - */ -void sixp_init(void); -#endif /* ! _SIXP_H_ */ -/** @} */ diff --git a/os/net/mac/tsch/sixtop/sixtop-conf.h b/os/net/mac/tsch/sixtop/sixtop-conf.h deleted file mode 100644 index 0cd6db980..000000000 --- a/os/net/mac/tsch/sixtop/sixtop-conf.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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. - */ -/** - * \addtogroup sixtop - * @{ - */ -/** - * \file - * 6top Configuration - * \author - * Yasuyuki Tanaka - */ - -#ifndef __SIXTOP_CONF_H__ -#define __SIXTOP_CONF_H__ - -/** - * \brief The maximum number of Scheduling Functions in the system. - */ -#ifdef SIXTOP_CONF_MAX_SCHEDULING_FUNCTIONS -#define SIXTOP_MAX_SCHEDULING_FUNCTIONS SIXTOP_CONF_MAX_SCHEDULING_FUNCTIONS -#else -#define SIXTOP_MAX_SCHEDULING_FUNCTIONS 1 -#endif - -/** - * \brief The maximum number of transactions which the sixtop module can handle - * at the same time. - */ -#ifdef SIXTOP_CONF_MAX_TRANSACTIONS -#define SIXTOP_MAX_TRANSACTIONS SIXTOP_CONF_MAX_TRANSACTIONS -#else -#define SIXTOP_MAX_TRANSACTIONS 1 -#endif - -#endif /* !__SIXTOP_CONF_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/sixtop/sixtop.c b/os/net/mac/tsch/sixtop/sixtop.c deleted file mode 100644 index 2df009769..000000000 --- a/os/net/mac/tsch/sixtop/sixtop.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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. - */ -/** - * \addtogroup sixtop - * @{ - */ -/** - * \file - * 6TiSCH Operation Sublayer (6top) - * - * \author - * Yasuyuki Tanaka - */ - -#include "lib/assert.h" - -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "net/mac/framer/frame802154.h" -#include "net/mac/framer/frame802154e-ie.h" - -#include "sixtop.h" -#include "sixtop-conf.h" -#include "sixp.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "6top" -#define LOG_LEVEL LOG_LEVEL_6TOP - -const sixtop_sf_t *scheduling_functions[SIXTOP_MAX_SCHEDULING_FUNCTIONS]; - -const sixtop_sf_t *sixtop_find_sf(uint8_t sfid); - -/*---------------------------------------------------------------------------*/ -void -strip_payload_termination_ie(void) -{ - uint8_t *ptr = packetbuf_dataptr(); - if(ptr[0] == 0x00 && ptr[1] == 0xf8) { - /* Payload Termination IE is 2 octets long */ - packetbuf_hdrreduce(2); - } -} -/*---------------------------------------------------------------------------*/ -int -sixtop_add_sf(const sixtop_sf_t *sf) -{ - int i; - - assert(sf != NULL); - - LOG_INFO("6top: sixtop_add_sf() is adding a SF [SFID:%u]\n", sf->sfid); - - if(sixtop_find_sf(sf->sfid) != NULL) { - LOG_ERR("6top: sixtop_add_sf() fails because of duplicate SF\n"); - return -1; - } - - for(i = 0; i < SIXTOP_MAX_SCHEDULING_FUNCTIONS; i++) { - if(scheduling_functions[i] == NULL) { - scheduling_functions[i] = sf; - if(sf->init != NULL) { - sf->init(); - } - break; - } - } - - if(i == SIXTOP_MAX_SCHEDULING_FUNCTIONS) { - LOG_ERR("6top: sixtop_add_sf() fails because of no memory\n"); - return -1; - } - - if(sf->init != NULL) { - sf->init(); - } - LOG_INFO("6top: SF [SFID:%u] has been added and initialized\n", sf->sfid); - return 0; -} -/*---------------------------------------------------------------------------*/ -const sixtop_sf_t * -sixtop_find_sf(uint8_t sfid) -{ - int i; - - for(i = 0; i < SIXTOP_MAX_SCHEDULING_FUNCTIONS; i++) { - if(scheduling_functions[i] != NULL && - scheduling_functions[i]->sfid == sfid) { - return (const sixtop_sf_t *)scheduling_functions[i]; - } - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -void -sixtop_output(const linkaddr_t *dest_addr, mac_callback_t callback, void *arg) -{ - uint8_t *p; - struct ieee802154_ies ies; - int len; - - assert(dest_addr != NULL); - if(dest_addr == NULL) { - LOG_ERR("6top: sixtop_output() fails because dest_addr is NULL\n"); - if(callback != NULL) { - callback(arg, MAC_TX_ERR_FATAL, 0); - } - return; - } - - /* prepend 6top Sub-IE ID */ - if(packetbuf_hdralloc(1) != 1) { - LOG_ERR("6top: sixtop_output() fails because of no room for Sub-IE ID\n"); - return; - } - p = packetbuf_hdrptr(); - p[0] = SIXTOP_SUBIE_ID; - - /* - * prepend Payload IE header; 2 octets - * only sixtop_ie_content_len matters in frame80215e_create_ie_ietf(). - */ - memset(&ies, 0, sizeof(ies)); - ies.sixtop_ie_content_len = packetbuf_totlen(); - if(packetbuf_hdralloc(2) != 1 || - (len = frame80215e_create_ie_ietf(packetbuf_hdrptr(), - 2, - &ies)) < 0) { - LOG_ERR("6top: sixtop_output() fails because of Payload IE Header\n"); - if(callback != NULL) { - callback(arg, MAC_TX_ERR_FATAL, 0); - } - return; - } - -#if SIXP_WITH_PAYLOAD_TERMINATION_IE - /* append Payload Termination IE to the data field; 2 octets */ - memset(&ies, 0, sizeof(ies)); - if((len = frame80215e_create_ie_payload_list_termination( - (uint8_t *)packetbuf_dataptr() + packetbuf_datalen(), - PACKETBUF_SIZE - packetbuf_totlen(), - &ies)) < 0) { - LOG_ERR("6top: sixtop_output() fails because of Payload Termination IE\n"); - callback(arg, MAC_TX_ERR_FATAL, 0); - return; - } - packetbuf_set_datalen(packetbuf_datalen() + len); -#endif /* SIXP_WITH_PAYLOAD_TERMINATION_IE */ - - /* prepend Termination 1 IE to the header field; 2 octets */ - memset(&ies, 0, sizeof(ies)); - if(packetbuf_hdralloc(2) && - frame80215e_create_ie_header_list_termination_1(packetbuf_hdrptr(), - 2, - &ies) < 0) { - LOG_ERR("6top: sixtop_output() fails because of Header Termination 1 IE\n"); - callback(arg, MAC_TX_ERR_FATAL, 0); - return; - } - - /* specify with PACKETBUF_ATTR_METADATA that packetbuf has IEs */ - packetbuf_set_attr(PACKETBUF_ATTR_MAC_METADATA, 1); - - /* 6P packet is data frame */ - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME); - - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, dest_addr); - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); - - NETSTACK_MAC.send(callback, arg); -} -/*---------------------------------------------------------------------------*/ -void -sixtop_input(void) -{ - uint8_t *hdr_ptr, *payload_ptr; - uint16_t hdr_len, payload_len; - - frame802154_t frame; - struct ieee802154_ies ies; - linkaddr_t src_addr; - - /* - * A received *DATA* frame is supposed to be stored in packetbuf by - * framer_802154.parse(). packetbuf_dataptr() points at the starting address - * of the IE field or Frame Payload field if it's available. FCS should not be - * in packetbuf, which is expected to be stripped at a radio. - */ - - payload_ptr = packetbuf_dataptr(); - payload_len = packetbuf_datalen(); - hdr_len = packetbuf_hdrlen(); - hdr_ptr = payload_ptr - hdr_len; - - memcpy(&src_addr, packetbuf_addr(PACKETBUF_ADDR_SENDER), sizeof(src_addr)); - - if(frame802154_parse(hdr_ptr, hdr_len, &frame) == 0) { - /* parse error; should not occur, anyway */ - LOG_ERR("6top: frame802154_parse error\n"); - return; - } - - /* - * We don't need to check the frame version nor frame type. The frame version - * is turned out to be 0b10 automatically if the frame has a IE list. The - * frame type is supposed to be DATA as mentioned above. - */ - assert(frame.fcf.frame_version == FRAME802154_IEEE802154_2015); - assert(frame.fcf.frame_type == FRAME802154_DATAFRAME); - memset(&ies, 0, sizeof(ies)); - if(frame.fcf.ie_list_present && - frame802154e_parse_information_elements(payload_ptr, - payload_len, &ies) >= 0 && - ies.sixtop_ie_content_ptr != NULL && - ies.sixtop_ie_content_len > 0) { - - sixp_input(ies.sixtop_ie_content_ptr, ies.sixtop_ie_content_len, - &src_addr); - - /* - * move payloadbuf_dataptr() to the beginning of the next layer for further - * processing - */ - packetbuf_hdrreduce(ies.sixtop_ie_content_ptr - payload_ptr + - ies.sixtop_ie_content_len); - strip_payload_termination_ie(); - } -} -/*---------------------------------------------------------------------------*/ -void -sixtop_init(void) -{ - int i; - - sixp_init(); - - for(i = 0; i < SIXTOP_MAX_SCHEDULING_FUNCTIONS; i++) { - scheduling_functions[i] = NULL; - } - - sixtop_init_sf(); -} -/*---------------------------------------------------------------------------*/ -void -sixtop_init_sf(void) -{ - int i; - - for(i = 0; i < SIXTOP_MAX_SCHEDULING_FUNCTIONS; i++) { - if(scheduling_functions[i] != NULL && - scheduling_functions[i]->init != NULL) { - scheduling_functions[i]->init(); - } - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/sixtop/sixtop.h b/os/net/mac/tsch/sixtop/sixtop.h deleted file mode 100644 index 05377907b..000000000 --- a/os/net/mac/tsch/sixtop/sixtop.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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. - */ -/** - * \addtogroup link-layer - * @{ - */ -/** - * \defgroup sixtop 6TiSCH Operation Sublayer (6top) - * @{ - */ -/** - * \file - * 6TiSCH Operation Sublayer (6top) APIs - * \author - * Yasuyuki Tanaka - */ - -#ifndef _SIXTOP_H_ -#define _SIXTOP_H_ - -#include "net/mac/mac.h" -#include "net/linkaddr.h" - -#include "sixp-pkt.h" - -#define SIXTOP_SUBIE_ID 0xc9 - -/** - * \brief Input Handler of Scheduling Function - * \param type 6P Message Type of an input packet - * \param code Code, 6P Command Identifier or Return Code, of an input packet - * \param body Body, "Other Fields", of an input packet - * \param body_len The length of body - * \param body src_addr Source address of an input packet - */ -typedef void (* sixtop_sf_input)(sixp_pkt_type_t type, - sixp_pkt_code_t code, - const uint8_t *body, - uint16_t body_len, - const linkaddr_t *src_addr); - -/** - * \brief Timeout Handler of Scheduling Function - * \param cmd 6P Command (Identifier) in process under the transaction - * \param peer_addr The peer address of the transaction - */ -typedef void (* sixtop_sf_timeout)(sixp_pkt_cmd_t cmd, - const linkaddr_t *peer_addr); -/** - * /brief Scheduling Function Driver - */ -typedef struct { - uint8_t sfid; /**< SFID */ - clock_time_t timeout_interval; /**< Timeout Value */ - void (*init)(void); /**< Init Function */ - sixtop_sf_input input; /**< Input Handler */ - sixtop_sf_timeout timeout; /**< Transaction Timeout Handler */ -} sixtop_sf_t; -/** - * \var sixtop_sf_t::sfid - * managed: 0x00-0xfe - * unmanaged: 0xf0-0xfe - * reserved: 0xff - */ - - -/** - * \brief Add a Scheduling Function (SF) to 6top Sublayer - * \param sf The pointer to a Scheduling Function Driver - * \return 0 on success, -1 on failure - * - * If there is a SF whose SF is identical to one of a SF specified to this API, - * the addition will fail and -1 will be returned. If there is no room to - * another SF, -1 will be returned as well. You can specify how many SFs can be - * added with SIXTOP_CONF_MAX_SCHEDULING_FUNCTIONS. - */ -int sixtop_add_sf(const sixtop_sf_t *sf); - -/** - * \brief Find a SF which has been added by SFID - * \param sfid Scheduling Function Identifier of a SF - * \return The pointer to a SF driver having the specified SFID on success, NULL - * on failure (not found) - */ -const sixtop_sf_t *sixtop_find_sf(uint8_t sfid); - -/** - * \brief Output a 6P packet which is supposestored in packetbuf - * \param dest_addr Destination address of the outgoing packet - * \param callback MAC callback function to get a TX result - * \param arg The pointer to an argument which is returned with the MAC callback - */ -void sixtop_output(const linkaddr_t *dest_addr, - mac_callback_t callback, void *arg); - -/** - * \brief Input a packet stored in packetbuf - */ -void sixtop_input(void); - -/** - * \brief Initialize 6top module - * This initialization function removes all the SFs which has been installed - * into the 6top sub-layer. In addition, it invokes sixp_init(). - */ -void sixtop_init(void); - -/** - * \brief Initialize installed SFs which has been added in the system - * This function is supposed to be invoked every time the node gets associated. - */ -void sixtop_init_sf(void); - -#endif /* !_SIXTOP_H_ */ -/** @} */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-adaptive-timesync.c b/os/net/mac/tsch/tsch-adaptive-timesync.c deleted file mode 100644 index 2745abca2..000000000 --- a/os/net/mac/tsch/tsch-adaptive-timesync.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * TSCH adaptive time synchronization - * \author - * Atis Elsts - * - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#include "net/mac/tsch/tsch.h" -#include -#include - -#if TSCH_ADAPTIVE_TIMESYNC - -/* Estimated drift of the time-source neighbor. Can be negative. - * Units used: ppm multiplied by 256. */ -static int32_t drift_ppm; -/* Ticks compensated locally since the last timesync time */ -static int32_t compensated_ticks; -/* Number of already recorded timesync history entries */ -static uint8_t timesync_entry_count; -/* Since last learning of the drift; may be more than time since last timesync */ -static uint32_t asn_since_last_learning; - -/* Units in which drift is stored: ppm * 256 */ -#define TSCH_DRIFT_UNIT (1000L * 1000 * 256) - -/*---------------------------------------------------------------------------*/ -long int -tsch_adaptive_timesync_get_drift_ppm(void) -{ - return (long int)drift_ppm / 256; -} -/*---------------------------------------------------------------------------*/ -/* Add a value to a moving average estimator */ -static int32_t -timesync_entry_add(int32_t val) -{ -#define NUM_TIMESYNC_ENTRIES 8 - static int32_t buffer[NUM_TIMESYNC_ENTRIES]; - static uint8_t pos; - int i; - if(timesync_entry_count == 0) { - pos = 0; - } - buffer[pos] = val; - if(timesync_entry_count < NUM_TIMESYNC_ENTRIES) { - timesync_entry_count++; - } else { - /* We now have accurate drift compensation. - * Increase keep-alive timeout. */ - tsch_set_ka_timeout(TSCH_MAX_KEEPALIVE_TIMEOUT); - } - pos = (pos + 1) % NUM_TIMESYNC_ENTRIES; - - val = 0; - for(i = 0; i < timesync_entry_count; ++i) { - val += buffer[i]; - } - return val / timesync_entry_count; -} -/*---------------------------------------------------------------------------*/ -/* Learn the neighbor drift rate at ppm */ -static void -timesync_learn_drift_ticks(uint32_t time_delta_asn, int32_t drift_ticks) -{ - /* should fit in a 32-bit integer */ - int32_t time_delta_ticks = time_delta_asn * tsch_timing[tsch_ts_timeslot_length]; - int32_t real_drift_ticks = drift_ticks + compensated_ticks; - int32_t last_drift_ppm = (int32_t)(((int64_t)real_drift_ticks * TSCH_DRIFT_UNIT) / time_delta_ticks); - - drift_ppm = timesync_entry_add(last_drift_ppm); - - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "drift %ld ppm (min/max delta seen: %"PRId32"/%"PRId32")", - tsch_adaptive_timesync_get_drift_ppm(), - min_drift_seen, max_drift_seen)); -} -/*---------------------------------------------------------------------------*/ -/* Either reset or update the neighbor's drift */ -void -tsch_timesync_update(struct tsch_neighbor *n, uint16_t time_delta_asn, int32_t drift_correction) -{ - /* Account the drift if either this is a new timesource, - * or the timedelta is not too small, as smaller timedelta - * means proportionally larger measurement error. */ - if(last_timesource_neighbor != n) { - last_timesource_neighbor = n; - drift_ppm = 0; - timesync_entry_count = 0; - compensated_ticks = 0; - asn_since_last_learning = 0; - } else { - asn_since_last_learning += time_delta_asn; - if(asn_since_last_learning >= 4 * TSCH_SLOTS_PER_SECOND) { - timesync_learn_drift_ticks(asn_since_last_learning, drift_correction); - compensated_ticks = 0; - asn_since_last_learning = 0; - } else { - /* Too small timedelta, do not recalculate the drift to avoid introducing error. instead account for the corrected ticks */ - compensated_ticks += drift_correction; - } - } - min_drift_seen = MIN(drift_correction, min_drift_seen); - max_drift_seen = MAX(drift_correction, max_drift_seen); -} -/*---------------------------------------------------------------------------*/ -/* Error-accumulation free compensation algorithm */ -static int32_t -compensate_internal(uint32_t time_delta_usec, int32_t drift_ppm, int32_t *remainder, int16_t *tick_conversion_error) -{ - int64_t d = (int64_t)time_delta_usec * drift_ppm + *remainder; - int32_t amount = d / TSCH_DRIFT_UNIT; - int32_t amount_ticks; - - *remainder = (int32_t)(d - amount * TSCH_DRIFT_UNIT); - - amount += *tick_conversion_error; - amount_ticks = US_TO_RTIMERTICKS(amount); - *tick_conversion_error = amount - RTIMERTICKS_TO_US(amount_ticks); - - if(ABS(amount_ticks) > RTIMER_ARCH_SECOND / 128) { - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!too big compensation %ld delta %ld", (long int)amount_ticks, (long int)time_delta_usec)); - amount_ticks = (amount_ticks > 0 ? RTIMER_ARCH_SECOND : -RTIMER_ARCH_SECOND) / 128; - } - - return amount_ticks; -} -/*---------------------------------------------------------------------------*/ -/* Do the compensation step before scheduling a new timeslot */ -int32_t -tsch_timesync_adaptive_compensate(rtimer_clock_t time_delta_ticks) -{ - int32_t result = 0; - uint32_t time_delta_usec = RTIMERTICKS_TO_US_64(time_delta_ticks); - - /* compensate, but not if the neighbor is not known */ - if(drift_ppm && last_timesource_neighbor != NULL) { - static int32_t remainder; - static int16_t tick_conversion_error; - result = compensate_internal(time_delta_usec, drift_ppm, - &remainder, &tick_conversion_error); - compensated_ticks += result; - } - - if(TSCH_BASE_DRIFT_PPM) { - static int32_t base_drift_remainder; - static int16_t base_drift_tick_conversion_error; - result += compensate_internal(time_delta_usec, 256L * TSCH_BASE_DRIFT_PPM, - &base_drift_remainder, &base_drift_tick_conversion_error); - } - - return result; -} -/*---------------------------------------------------------------------------*/ -#else /* TSCH_ADAPTIVE_TIMESYNC */ -/*---------------------------------------------------------------------------*/ -void -tsch_timesync_update(struct tsch_neighbor *n, uint16_t time_delta_asn, int32_t drift_correction) -{ -} -/*---------------------------------------------------------------------------*/ -int32_t -tsch_timesync_adaptive_compensate(rtimer_clock_t delta_ticks) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -#endif /* TSCH_ADAPTIVE_TIMESYNC */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-adaptive-timesync.h b/os/net/mac/tsch/tsch-adaptive-timesync.h deleted file mode 100644 index c4ca20b7b..000000000 --- a/os/net/mac/tsch/tsch-adaptive-timesync.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup tsch - * @{ - * \file - * TSCH adaptive time synchronization -*/ - -#ifndef __TSCH_ADAPTIVE_TIMESYNC_H__ -#define __TSCH_ADAPTIVE_TIMESYNC_H__ - -/********** Includes **********/ - -#include "contiki.h" - -/***** External Variables *****/ - -/** \brief The neighbor last used as our time source */ -extern struct tsch_neighbor *last_timesource_neighbor; - -/********** Functions *********/ - -/** - * \brief Updates timesync information for a given neighbor - * \param n The neighbor - * \param time_delta_asn ASN time delta since last synchronization, i.e. number of slots elapsed - * \param drift_correction The measured drift in ticks since last synchronization - */ -void tsch_timesync_update(struct tsch_neighbor *n, uint16_t time_delta_asn, int32_t drift_correction); - -/** - * \brief Computes time compensation for a given point in the future - * \param delta_ticks The number of ticks in the future we want to calculate compensation for - * \return The time compensation - */ -int32_t tsch_timesync_adaptive_compensate(rtimer_clock_t delta_ticks); - -/** - * \brief Gives the estimated clock drift w.r.t. the time source in PPM (parts per million) - * \return The time drift in PPM - */ -long int tsch_adaptive_timesync_get_drift_ppm(void); - -#endif /* __TSCH_ADAPTIVE_TIMESYNC_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-asn.h b/os/net/mac/tsch/tsch-asn.h deleted file mode 100644 index 1db99b432..000000000 --- a/os/net/mac/tsch/tsch-asn.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup tsch - * @{ - * \file - * TSCH 5-Byte Absolute Slot Number (ASN) management - * \author - * Simon Duquennoy -*/ - -#ifndef __TSCH_ASN_H__ -#define __TSCH_ASN_H__ - -/************ Types ***********/ - -/** \brief The ASN is an absolute slot number over 5 bytes. */ -struct tsch_asn_t { - uint32_t ls4b; /* least significant 4 bytes */ - uint8_t ms1b; /* most significant 1 byte */ -}; - -/** \brief For quick modulo operation on ASN */ -struct tsch_asn_divisor_t { - uint16_t val; /* Divisor value */ - uint16_t asn_ms1b_remainder; /* Remainder of the operation 0x100000000 / val */ -}; - -/************ Macros **********/ - -/** \brief Initialize ASN */ -#define TSCH_ASN_INIT(asn, ms1b_, ls4b_) do { \ - (asn).ms1b = (ms1b_); \ - (asn).ls4b = (ls4b_); \ -} while(0); - -/** \brief Increment an ASN by inc (32 bits) */ -#define TSCH_ASN_INC(asn, inc) do { \ - uint32_t new_ls4b = (asn).ls4b + (inc); \ - if(new_ls4b < (asn).ls4b) { (asn).ms1b++; } \ - (asn).ls4b = new_ls4b; \ -} while(0); - -/** \brief Decrement an ASN by inc (32 bits) */ -#define TSCH_ASN_DEC(asn, dec) do { \ - uint32_t new_ls4b = (asn).ls4b - (dec); \ - if(new_ls4b > (asn).ls4b) { (asn).ms1b--; } \ - (asn).ls4b = new_ls4b; \ -} while(0); - -/** \brief Returns the 32-bit diff between asn1 and asn2 */ -#define TSCH_ASN_DIFF(asn1, asn2) \ - ((asn1).ls4b - (asn2).ls4b) - -/** \brief Initialize a struct asn_divisor_t */ -#define TSCH_ASN_DIVISOR_INIT(div, val_) do { \ - (div).val = (val_); \ - (div).asn_ms1b_remainder = ((0xffffffff % (val_)) + 1) % (val_); \ -} while(0); - -/** \brief Returns the result (16 bits) of a modulo operation on ASN, - * with divisor being a struct asn_divisor_t */ -#define TSCH_ASN_MOD(asn, div) \ - ((uint16_t)((asn).ls4b % (div).val) \ - + (uint16_t)((asn).ms1b * (div).asn_ms1b_remainder % (div).val)) \ - % (div).val - -#endif /* __TSCH_ASN_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-conf.h b/os/net/mac/tsch/tsch-conf.h deleted file mode 100644 index 76e463a0c..000000000 --- a/os/net/mac/tsch/tsch-conf.h +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** -* \addtogroup tsch -* @{ - * \file - * TSCH configuration - * \author - * Simon Duquennoy - */ - -#ifndef __TSCH_CONF_H__ -#define __TSCH_CONF_H__ - -/********** Includes **********/ - -#include "contiki.h" - -/******** Configuration: synchronization *******/ - -/* Max time before sending a unicast keep-alive message to the time source */ -#ifdef TSCH_CONF_KEEPALIVE_TIMEOUT -#define TSCH_KEEPALIVE_TIMEOUT TSCH_CONF_KEEPALIVE_TIMEOUT -#else -/* Time to desynch assuming a drift of 40 PPM (80 PPM between two nodes) and guard time of +/-1ms: 12.5s. */ -#define TSCH_KEEPALIVE_TIMEOUT (12 * CLOCK_SECOND) -#endif - -/* With TSCH_ADAPTIVE_TIMESYNC enabled: keep-alive timeout used after reaching - * accurate drift compensation. */ -#ifdef TSCH_CONF_MAX_KEEPALIVE_TIMEOUT -#define TSCH_MAX_KEEPALIVE_TIMEOUT TSCH_CONF_MAX_KEEPALIVE_TIMEOUT -#else -#define TSCH_MAX_KEEPALIVE_TIMEOUT (60 * CLOCK_SECOND) -#endif - -/* Max time without synchronization before leaving the PAN */ -#ifdef TSCH_CONF_DESYNC_THRESHOLD -#define TSCH_DESYNC_THRESHOLD TSCH_CONF_DESYNC_THRESHOLD -#else -#define TSCH_DESYNC_THRESHOLD (2 * TSCH_MAX_KEEPALIVE_TIMEOUT) -#endif - -/* Period between two consecutive EBs */ -#ifdef TSCH_CONF_EB_PERIOD -#define TSCH_EB_PERIOD TSCH_CONF_EB_PERIOD -#else -#define TSCH_EB_PERIOD (16 * CLOCK_SECOND) -#endif - -/* Max Period between two consecutive EBs */ -#ifdef TSCH_CONF_MAX_EB_PERIOD -#define TSCH_MAX_EB_PERIOD TSCH_CONF_MAX_EB_PERIOD -#else -#define TSCH_MAX_EB_PERIOD (16 * CLOCK_SECOND) -#endif - -/* Use SFD timestamp for synchronization? By default we merely rely on rtimer and busy wait - * until SFD is high, which we found to provide greater accuracy on JN516x and CC2420. - * Note: for association, however, we always use SFD timestamp to know the time of arrival - * of the EB (because we do not busy-wait for the whole scanning process) - * */ -#ifdef TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS -#define TSCH_RESYNC_WITH_SFD_TIMESTAMPS TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS -#else -#define TSCH_RESYNC_WITH_SFD_TIMESTAMPS 0 -#endif - -/* If enabled, remove jitter due to measurement errors */ -#ifdef TSCH_CONF_TIMESYNC_REMOVE_JITTER -#define TSCH_TIMESYNC_REMOVE_JITTER TSCH_CONF_TIMESYNC_REMOVE_JITTER -#else -#define TSCH_TIMESYNC_REMOVE_JITTER TSCH_RESYNC_WITH_SFD_TIMESTAMPS -#endif - -/* Base drift value. - * Used to compensate locally know inaccuracies, such as - * the effect of having a binary 32.768 kHz timer as the TSCH time base. */ -#ifdef TSCH_CONF_BASE_DRIFT_PPM -#define TSCH_BASE_DRIFT_PPM TSCH_CONF_BASE_DRIFT_PPM -#else -#define TSCH_BASE_DRIFT_PPM 0 -#endif - -/* Estimate the drift of the time-source neighbor and compensate for it? */ -#ifdef TSCH_CONF_ADAPTIVE_TIMESYNC -#define TSCH_ADAPTIVE_TIMESYNC TSCH_CONF_ADAPTIVE_TIMESYNC -#else -#define TSCH_ADAPTIVE_TIMESYNC 1 -#endif - -/* An ad-hoc mechanism to have TSCH select its time source without the - * help of an upper-layer, simply by collecting statistics on received - * EBs and their join priority. Disabled by default as we recomment - * mapping the time source on the RPL preferred parent - * (via tsch_rpl_callback_parent_switch) */ -#ifdef TSCH_CONF_AUTOSELECT_TIME_SOURCE -#define TSCH_AUTOSELECT_TIME_SOURCE TSCH_CONF_AUTOSELECT_TIME_SOURCE -#else -#define TSCH_AUTOSELECT_TIME_SOURCE 0 -#endif /* TSCH_CONF_EB_AUTOSELECT */ - -/******** Configuration: channel hopping *******/ - -/* Default hopping sequence, used in case hopping sequence ID == 0 */ -#ifdef TSCH_CONF_DEFAULT_HOPPING_SEQUENCE -#define TSCH_DEFAULT_HOPPING_SEQUENCE TSCH_CONF_DEFAULT_HOPPING_SEQUENCE -#else -#define TSCH_DEFAULT_HOPPING_SEQUENCE TSCH_HOPPING_SEQUENCE_4_4 -#endif - -/* Hopping sequence used for joining (scan channels) */ -#ifdef TSCH_CONF_JOIN_HOPPING_SEQUENCE -#define TSCH_JOIN_HOPPING_SEQUENCE TSCH_CONF_JOIN_HOPPING_SEQUENCE -#else -#define TSCH_JOIN_HOPPING_SEQUENCE TSCH_DEFAULT_HOPPING_SEQUENCE -#endif - -/* Maximum length of the TSCH channel hopping sequence. Must be greater or - * equal to the length of TSCH_DEFAULT_HOPPING_SEQUENCE. */ -#ifdef TSCH_CONF_HOPPING_SEQUENCE_MAX_LEN -#define TSCH_HOPPING_SEQUENCE_MAX_LEN TSCH_CONF_HOPPING_SEQUENCE_MAX_LEN -#else -#define TSCH_HOPPING_SEQUENCE_MAX_LEN sizeof(TSCH_DEFAULT_HOPPING_SEQUENCE) -#endif - -/******** Configuration: association *******/ - -/* Start TSCH automatically after init? If not, the upper layers - * must call NETSTACK_MAC.on() to start it. Useful when the - * application needs to control when the nodes are to start - * scanning or advertising.*/ -#ifdef TSCH_CONF_AUTOSTART -#define TSCH_AUTOSTART TSCH_CONF_AUTOSTART -#else -#define TSCH_AUTOSTART 1 -#endif - -/* Max acceptable join priority */ -#ifdef TSCH_CONF_MAX_JOIN_PRIORITY -#define TSCH_MAX_JOIN_PRIORITY TSCH_CONF_MAX_JOIN_PRIORITY -#else -#define TSCH_MAX_JOIN_PRIORITY 32 -#endif - -/* Join only secured networks? (discard EBs with security disabled) */ -#ifdef TSCH_CONF_JOIN_SECURED_ONLY -#define TSCH_JOIN_SECURED_ONLY TSCH_CONF_JOIN_SECURED_ONLY -#else -/* By default, set if LLSEC802154_ENABLED is also non-zero */ -#define TSCH_JOIN_SECURED_ONLY LLSEC802154_ENABLED -#endif - -/* By default, join any PAN ID. Otherwise, wait for an EB from IEEE802154_PANID */ -#ifdef TSCH_CONF_JOIN_MY_PANID_ONLY -#define TSCH_JOIN_MY_PANID_ONLY TSCH_CONF_JOIN_MY_PANID_ONLY -#else -#define TSCH_JOIN_MY_PANID_ONLY 1 -#endif - -/* The radio polling frequency (in Hz) during association process */ -#ifdef TSCH_CONF_ASSOCIATION_POLL_FREQUENCY -#define TSCH_ASSOCIATION_POLL_FREQUENCY TSCH_CONF_ASSOCIATION_POLL_FREQUENCY -#else -#define TSCH_ASSOCIATION_POLL_FREQUENCY 100 -#endif - -/* When associating, check ASN against our own uptime (time in minutes).. - * Useful to force joining only with nodes started roughly at the same time. - * Set to the max number of minutes acceptable. */ -#ifdef TSCH_CONF_CHECK_TIME_AT_ASSOCIATION -#define TSCH_CHECK_TIME_AT_ASSOCIATION TSCH_CONF_CHECK_TIME_AT_ASSOCIATION -#else -#define TSCH_CHECK_TIME_AT_ASSOCIATION 0 -#endif - -/* By default: initialize schedule from EB when associating, using the - * slotframe and links Information Element */ -#ifdef TSCH_CONF_INIT_SCHEDULE_FROM_EB -#define TSCH_INIT_SCHEDULE_FROM_EB TSCH_CONF_INIT_SCHEDULE_FROM_EB -#else -#define TSCH_INIT_SCHEDULE_FROM_EB 1 -#endif - -/* How long to scan each channel in the scanning phase */ -#ifdef TSCH_CONF_CHANNEL_SCAN_DURATION -#define TSCH_CHANNEL_SCAN_DURATION TSCH_CONF_CHANNEL_SCAN_DURATION -#else -#define TSCH_CHANNEL_SCAN_DURATION CLOCK_SECOND -#endif - -/* TSCH EB: include timeslot timing Information Element? */ -#ifdef TSCH_PACKET_CONF_EB_WITH_TIMESLOT_TIMING -#define TSCH_PACKET_EB_WITH_TIMESLOT_TIMING TSCH_PACKET_CONF_EB_WITH_TIMESLOT_TIMING -#else -#define TSCH_PACKET_EB_WITH_TIMESLOT_TIMING 0 -#endif - -/* TSCH EB: include hopping sequence Information Element? */ -#ifdef TSCH_PACKET_CONF_EB_WITH_HOPPING_SEQUENCE -#define TSCH_PACKET_EB_WITH_HOPPING_SEQUENCE TSCH_PACKET_CONF_EB_WITH_HOPPING_SEQUENCE -#else -#define TSCH_PACKET_EB_WITH_HOPPING_SEQUENCE 0 -#endif - -/* TSCH EB: include slotframe and link Information Element? */ -#ifdef TSCH_PACKET_CONF_EB_WITH_SLOTFRAME_AND_LINK -#define TSCH_PACKET_EB_WITH_SLOTFRAME_AND_LINK TSCH_PACKET_CONF_EB_WITH_SLOTFRAME_AND_LINK -#else -#define TSCH_PACKET_EB_WITH_SLOTFRAME_AND_LINK 0 -#endif - -/******** Configuration: queues *******/ - -/* Size of the ring buffer storing dequeued outgoing packets (only an array of pointers). - * Must be power of two, and greater or equal to QUEUEBUF_NUM */ -#ifdef TSCH_CONF_DEQUEUED_ARRAY_SIZE -#define TSCH_DEQUEUED_ARRAY_SIZE TSCH_CONF_DEQUEUED_ARRAY_SIZE -#else -/* By default, round QUEUEBUF_CONF_NUM to next power of two - * (in the range [4;256]) */ -#if QUEUEBUF_CONF_NUM <= 4 -#define TSCH_DEQUEUED_ARRAY_SIZE 4 -#elif QUEUEBUF_CONF_NUM <= 8 -#define TSCH_DEQUEUED_ARRAY_SIZE 8 -#elif QUEUEBUF_CONF_NUM <= 16 -#define TSCH_DEQUEUED_ARRAY_SIZE 16 -#elif QUEUEBUF_CONF_NUM <= 32 -#define TSCH_DEQUEUED_ARRAY_SIZE 32 -#elif QUEUEBUF_CONF_NUM <= 64 -#define TSCH_DEQUEUED_ARRAY_SIZE 64 -#elif QUEUEBUF_CONF_NUM <= 128 -#define TSCH_DEQUEUED_ARRAY_SIZE 128 -#else -#define TSCH_DEQUEUED_ARRAY_SIZE 256 -#endif -#endif - -/* Size of the ring buffer storing incoming packets. - * Must be power of two */ -#ifdef TSCH_CONF_MAX_INCOMING_PACKETS -#define TSCH_MAX_INCOMING_PACKETS TSCH_CONF_MAX_INCOMING_PACKETS -#else -#define TSCH_MAX_INCOMING_PACKETS 4 -#endif - -/* The maximum number of outgoing packets towards each neighbor - * Must be power of two to enable atomic ringbuf operations. - * Note: the total number of outgoing packets in the system (for - * all neighbors) is defined via QUEUEBUF_CONF_NUM */ -#ifdef TSCH_QUEUE_CONF_NUM_PER_NEIGHBOR -#define TSCH_QUEUE_NUM_PER_NEIGHBOR TSCH_QUEUE_CONF_NUM_PER_NEIGHBOR -#else -/* By default, round QUEUEBUF_CONF_NUM to next power of two - * (in the range [4;256]) */ -#if QUEUEBUF_CONF_NUM <= 4 -#define TSCH_QUEUE_NUM_PER_NEIGHBOR 4 -#elif QUEUEBUF_CONF_NUM <= 8 -#define TSCH_QUEUE_NUM_PER_NEIGHBOR 8 -#elif QUEUEBUF_CONF_NUM <= 16 -#define TSCH_QUEUE_NUM_PER_NEIGHBOR 16 -#elif QUEUEBUF_CONF_NUM <= 32 -#define TSCH_QUEUE_NUM_PER_NEIGHBOR 32 -#elif QUEUEBUF_CONF_NUM <= 64 -#define TSCH_QUEUE_NUM_PER_NEIGHBOR 64 -#elif QUEUEBUF_CONF_NUM <= 128 -#define TSCH_QUEUE_NUM_PER_NEIGHBOR 128 -#else -#define TSCH_QUEUE_NUM_PER_NEIGHBOR 256 -#endif -#endif - -/* The number of neighbor queues. There are two queues allocated at all times: - * one for EBs, one for broadcasts. Other queues are for unicast to neighbors */ -#ifdef TSCH_QUEUE_CONF_MAX_NEIGHBOR_QUEUES -#define TSCH_QUEUE_MAX_NEIGHBOR_QUEUES TSCH_QUEUE_CONF_MAX_NEIGHBOR_QUEUES -#else -#define TSCH_QUEUE_MAX_NEIGHBOR_QUEUES ((NBR_TABLE_CONF_MAX_NEIGHBORS) + 2) -#endif - -/******** Configuration: scheduling *******/ - -/* Initializes TSCH with a 6TiSCH minimal schedule */ -#ifdef TSCH_SCHEDULE_CONF_WITH_6TISCH_MINIMAL -#define TSCH_SCHEDULE_WITH_6TISCH_MINIMAL TSCH_SCHEDULE_CONF_WITH_6TISCH_MINIMAL -#else -#define TSCH_SCHEDULE_WITH_6TISCH_MINIMAL (!(BUILD_WITH_ORCHESTRA)) -#endif - -/* Set an upper bound on burst length. Set to 0 to never set the frame pending - * bit, i.e., never trigger a burst. Note that receiver-side support for burst - * is always enabled, as it is part of IEEE 802.1.5.4-2015 (Section 7.2.1.3)*/ -#ifdef TSCH_CONF_BURST_MAX_LEN -#define TSCH_BURST_MAX_LEN TSCH_CONF_BURST_MAX_LEN -#else -#define TSCH_BURST_MAX_LEN 32 -#endif - -/* 6TiSCH Minimal schedule slotframe length */ -#ifdef TSCH_SCHEDULE_CONF_DEFAULT_LENGTH -#define TSCH_SCHEDULE_DEFAULT_LENGTH TSCH_SCHEDULE_CONF_DEFAULT_LENGTH -#else -#define TSCH_SCHEDULE_DEFAULT_LENGTH 7 -#endif - -/* Max number of TSCH slotframes */ -#ifdef TSCH_SCHEDULE_CONF_MAX_SLOTFRAMES -#define TSCH_SCHEDULE_MAX_SLOTFRAMES TSCH_SCHEDULE_CONF_MAX_SLOTFRAMES -#else -#define TSCH_SCHEDULE_MAX_SLOTFRAMES 4 -#endif - -/* Max number of links */ -#ifdef TSCH_SCHEDULE_CONF_MAX_LINKS -#define TSCH_SCHEDULE_MAX_LINKS TSCH_SCHEDULE_CONF_MAX_LINKS -#else -#define TSCH_SCHEDULE_MAX_LINKS 32 -#endif - -/* To include Sixtop Implementation */ -#ifdef TSCH_CONF_WITH_SIXTOP -#define TSCH_WITH_SIXTOP TSCH_CONF_WITH_SIXTOP -#else -#define TSCH_WITH_SIXTOP 0 -#endif - -/* A custom feature allowing upper layers to assign packets to - * a specific slotframe and link */ -#ifdef TSCH_CONF_WITH_LINK_SELECTOR -#define TSCH_WITH_LINK_SELECTOR TSCH_CONF_WITH_LINK_SELECTOR -#else /* TSCH_CONF_WITH_LINK_SELECTOR */ -#define TSCH_WITH_LINK_SELECTOR (BUILD_WITH_ORCHESTRA) -#endif /* TSCH_CONF_WITH_LINK_SELECTOR */ - -/******** Configuration: CSMA *******/ - -/* TSCH CSMA-CA parameters, see IEEE 802.15.4e-2012 */ - -/* Min backoff exponent */ -#ifdef TSCH_CONF_MAC_MIN_BE -#define TSCH_MAC_MIN_BE TSCH_CONF_MAC_MIN_BE -#else -#define TSCH_MAC_MIN_BE 1 -#endif - -/* Max backoff exponent */ -#ifdef TSCH_CONF_MAC_MAX_BE -#define TSCH_MAC_MAX_BE TSCH_CONF_MAC_MAX_BE -#else -#define TSCH_MAC_MAX_BE 5 -#endif - -/* Max number of re-transmissions */ -#ifdef TSCH_CONF_MAC_MAX_FRAME_RETRIES -#define TSCH_MAC_MAX_FRAME_RETRIES TSCH_CONF_MAC_MAX_FRAME_RETRIES -#else -#define TSCH_MAC_MAX_FRAME_RETRIES 7 -#endif - -/* Include source address in ACK? */ -#ifdef TSCH_PACKET_CONF_EACK_WITH_SRC_ADDR -#define TSCH_PACKET_EACK_WITH_SRC_ADDR TSCH_PACKET_CONF_EACK_WITH_SRC_ADDR -#else -#define TSCH_PACKET_EACK_WITH_SRC_ADDR 0 -#endif - -/* Perform CCA before sending? */ -#ifdef TSCH_CONF_CCA_ENABLED -#define TSCH_CCA_ENABLED TSCH_CONF_CCA_ENABLED -#else -#define TSCH_CCA_ENABLED 0 -#endif - -/* Include destination address in ACK? */ -#ifdef TSCH_PACKET_CONF_EACK_WITH_DEST_ADDR -#define TSCH_PACKET_EACK_WITH_DEST_ADDR TSCH_PACKET_CONF_EACK_WITH_DEST_ADDR -#else -#define TSCH_PACKET_EACK_WITH_DEST_ADDR 1 /* Include destination address -by default, useful in case of duplicate seqno */ -#endif - -/******** Configuration: hardware-specific settings *******/ - -/* HW frame filtering enabled */ -#ifdef TSCH_CONF_HW_FRAME_FILTERING -#define TSCH_HW_FRAME_FILTERING TSCH_CONF_HW_FRAME_FILTERING -#else /* TSCH_CONF_HW_FRAME_FILTERING */ -#define TSCH_HW_FRAME_FILTERING 1 -#endif /* TSCH_CONF_HW_FRAME_FILTERING */ - -/* Keep radio always on within TSCH timeslot (1) or turn it off between packet and ACK? (0) */ -#ifdef TSCH_CONF_RADIO_ON_DURING_TIMESLOT -#define TSCH_RADIO_ON_DURING_TIMESLOT TSCH_CONF_RADIO_ON_DURING_TIMESLOT -#else -#define TSCH_RADIO_ON_DURING_TIMESLOT 0 -#endif - -/* TSCH timeslot timing template */ -#ifdef TSCH_CONF_DEFAULT_TIMESLOT_TIMING -#define TSCH_DEFAULT_TIMESLOT_TIMING TSCH_CONF_DEFAULT_TIMESLOT_TIMING -#else -#define TSCH_DEFAULT_TIMESLOT_TIMING tsch_timeslot_timing_us_10000 -#endif - -/* Configurable Rx guard time is micro-seconds */ -#ifndef TSCH_CONF_RX_WAIT -#define TSCH_CONF_RX_WAIT 2200 -#endif /* TSCH_CONF_RX_WAIT */ - -#endif /* __TSCH_CONF_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-const.h b/os/net/mac/tsch/tsch-const.h deleted file mode 100644 index c4712ce2d..000000000 --- a/os/net/mac/tsch/tsch-const.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** -* \addtogroup tsch -* @{ - * \file - * TSCH constants - * \author - * Simon Duquennoy - */ - -#ifndef __TSCH_CONST_H__ -#define __TSCH_CONST_H__ - -/********** Includes **********/ -#include "net/packetbuf.h" -#include "net/mac/tsch/tsch-conf.h" /* Required for timestlot timing consts */ - -/********** Constants **********/ - -/* Link options */ -#define LINK_OPTION_TX 1 -#define LINK_OPTION_RX 2 -#define LINK_OPTION_SHARED 4 -#define LINK_OPTION_TIME_KEEPING 8 - -/* Default IEEE 802.15.4e hopping sequences, obtained from https://gist.github.com/twatteyne/2e22ee3c1a802b685695 */ -/* 16 channels, sequence length 16 */ -#define TSCH_HOPPING_SEQUENCE_16_16 (uint8_t[]){ 16, 17, 23, 18, 26, 15, 25, 22, 19, 11, 12, 13, 24, 14, 20, 21 } -/* 4 channels, sequence length 16 */ -#define TSCH_HOPPING_SEQUENCE_4_16 (uint8_t[]){ 20, 26, 25, 26, 15, 15, 25, 20, 26, 15, 26, 25, 20, 15, 20, 25 } -/* 4 channels, sequence length 4 */ -#define TSCH_HOPPING_SEQUENCE_4_4 (uint8_t[]){ 15, 25, 26, 20 } -/* 2 channels, sequence length 2 */ -#define TSCH_HOPPING_SEQUENCE_2_2 (uint8_t[]){ 20, 25 } -/* 1 channel, sequence length 1 */ -#define TSCH_HOPPING_SEQUENCE_1_1 (uint8_t[]){ 20 } - -/* Max TSCH packet lenght - last bytes are CRC in default 802.15.4 packets */ -#define TSCH_PACKET_MAX_LEN MIN(127 - 2, PACKETBUF_SIZE) - -/* The jitter to remove in ticks. - * This should be the sum of measurement errors on Tx and Rx nodes. - * */ -#define TSCH_TIMESYNC_MEASUREMENT_ERROR US_TO_RTIMERTICKS(32) - -/* The approximate number of slots per second */ -#define TSCH_SLOTS_PER_SECOND (1000000 / tsch_timing_us[tsch_ts_timeslot_length]) - -/* Calculate packet tx/rx duration in rtimer ticks based on packet length in bytes. */ -#define TSCH_PACKET_DURATION(len) US_TO_RTIMERTICKS(RADIO_BYTE_AIR_TIME * ((len) + RADIO_PHY_OVERHEAD)) - -/* Convert rtimer ticks to clock and vice versa */ -#define TSCH_CLOCK_TO_TICKS(c) (((c) * RTIMER_SECOND) / CLOCK_SECOND) -#define TSCH_CLOCK_TO_SLOTS(c, timeslot_length) (TSCH_CLOCK_TO_TICKS(c) / timeslot_length) - -#endif /* __TSCH_CONST_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-log.c b/os/net/mac/tsch/tsch-log.c deleted file mode 100644 index e705f50ab..000000000 --- a/os/net/mac/tsch/tsch-log.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Log functions for TSCH, meant for logging from interrupt - * during a timeslot operation. Saves ASN, slot and link information - * and adds the log to a ringbuf for later printout. - * \author - * Simon Duquennoy - * - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#include "contiki.h" -#include -#include "net/mac/tsch/tsch.h" -#include "lib/ringbufindex.h" -#include "sys/log.h" - -#if TSCH_LOG_PER_SLOT - -PROCESS_NAME(tsch_pending_events_process); - -/* Check if TSCH_LOG_QUEUE_LEN is a power of two */ -#if (TSCH_LOG_QUEUE_LEN & (TSCH_LOG_QUEUE_LEN - 1)) != 0 -#error TSCH_LOG_QUEUE_LEN must be power of two -#endif -static struct ringbufindex log_ringbuf; -static struct tsch_log_t log_array[TSCH_LOG_QUEUE_LEN]; -static int log_dropped = 0; -static int log_active = 0; - -/*---------------------------------------------------------------------------*/ -/* Process pending log messages */ -void -tsch_log_process_pending(void) -{ - static int last_log_dropped = 0; - int16_t log_index; - /* Loop on accessing (without removing) a pending input packet */ - if(log_dropped != last_log_dropped) { - printf("[WARN: TSCH-LOG ] logs dropped %u\n", log_dropped); - last_log_dropped = log_dropped; - } - while((log_index = ringbufindex_peek_get(&log_ringbuf)) != -1) { - struct tsch_log_t *log = &log_array[log_index]; - if(log->link == NULL) { - printf("[INFO: TSCH-LOG ] {asn %02x.%08lx link-NULL} ", log->asn.ms1b, log->asn.ls4b); - } else { - struct tsch_slotframe *sf = tsch_schedule_get_slotframe_by_handle(log->link->slotframe_handle); - printf("[INFO: TSCH-LOG ] {asn %02x.%08lx link %2u %3u %3u %2u %2u ch %2u} ", - log->asn.ms1b, log->asn.ls4b, - log->link->slotframe_handle, sf ? sf->size.val : 0, - log->burst_count, log->link->timeslot + log->burst_count, log->link->channel_offset, - log->channel); - } - switch(log->type) { - case tsch_log_tx: - printf("%s-%u-%u tx ", - linkaddr_cmp(&log->tx.dest, &linkaddr_null) ? "bc" : "uc", log->tx.is_data, log->tx.sec_level); - log_lladdr_compact(&linkaddr_node_addr); - printf("->"); - log_lladdr_compact(&log->tx.dest); - printf(", len %3u, seq %3u, st %d %2d", - log->tx.datalen, log->tx.seqno, log->tx.mac_tx_status, log->tx.num_tx); - if(log->tx.drift_used) { - printf(", dr %3d", log->tx.drift); - } - printf("\n"); - break; - case tsch_log_rx: - printf("%s-%u-%u rx ", - log->rx.is_unicast == 0 ? "bc" : "uc", log->rx.is_data, log->rx.sec_level); - log_lladdr_compact(&log->rx.src); - printf("->"); - log_lladdr_compact(log->rx.is_unicast ? &linkaddr_node_addr : NULL); - printf(", len %3u, seq %3u", - log->rx.datalen, log->rx.seqno); - printf(", edr %3d", (int)log->rx.estimated_drift); - if(log->rx.drift_used) { - printf(", dr %3d\n", log->rx.drift); - } else { - printf("\n"); - } - break; - case tsch_log_message: - printf("%s\n", log->message); - break; - } - /* Remove input from ringbuf */ - ringbufindex_get(&log_ringbuf); - } -} -/*---------------------------------------------------------------------------*/ -/* Prepare addition of a new log. - * Returns pointer to log structure if success, NULL otherwise */ -struct tsch_log_t * -tsch_log_prepare_add(void) -{ - int log_index = ringbufindex_peek_put(&log_ringbuf); - if(log_index != -1) { - struct tsch_log_t *log = &log_array[log_index]; - log->asn = tsch_current_asn; - log->link = current_link; - log->burst_count = tsch_current_burst_count; - log->channel = tsch_current_channel; - return log; - } else { - log_dropped++; - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -/* Actually add the previously prepared log */ -void -tsch_log_commit(void) -{ - if(log_active == 1) { - ringbufindex_put(&log_ringbuf); - process_poll(&tsch_pending_events_process); - } -} -/*---------------------------------------------------------------------------*/ -/* Initialize log module */ -void -tsch_log_init(void) -{ - if(log_active == 0) { - ringbufindex_init(&log_ringbuf, TSCH_LOG_QUEUE_LEN); - log_active = 1; - } -} -/*---------------------------------------------------------------------------*/ -/* Stop log module */ -void -tsch_log_stop(void) -{ - if(log_active == 1) { - tsch_log_process_pending(); - log_active = 0; - } -} - -#endif /* TSCH_LOG_PER_SLOT */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-log.h b/os/net/mac/tsch/tsch-log.h deleted file mode 100644 index 186cda120..000000000 --- a/os/net/mac/tsch/tsch-log.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup tsch - * @{ - * \file - * TSCH per-slot logging -*/ - -#ifndef __TSCH_LOG_H__ -#define __TSCH_LOG_H__ - -/********** Includes **********/ - -#include "contiki.h" -#include "sys/rtimer.h" - -/******** Configuration *******/ - -/* TSCH per-slot logging. Enabled by default if DBG is enabled */ -#ifdef TSCH_LOG_CONF_PER_SLOT -#define TSCH_LOG_PER_SLOT TSCH_LOG_CONF_PER_SLOT -#else /* TSCH_LOG_CONF_PER_SLOT */ -#include "sys/log.h" -#define TSCH_LOG_PER_SLOT (LOG_CONF_LEVEL_MAC >= LOG_LEVEL_DBG) -#endif /* TSCH_LOG_CONF_PER_SLOT */ - -/* The length of the log queue, i.e. maximum number postponed log messages */ -#ifdef TSCH_LOG_CONF_QUEUE_LEN -#define TSCH_LOG_QUEUE_LEN TSCH_LOG_CONF_QUEUE_LEN -#else /* TSCH_LOG_CONF_QUEUE_LEN */ -#define TSCH_LOG_QUEUE_LEN 8 -#endif /* TSCH_LOG_CONF_QUEUE_LEN */ - -#if (TSCH_LOG_PER_SLOT == 0) - -#define tsch_log_init() -#define tsch_log_process_pending() -#define TSCH_LOG_ADD(log_type, init_code) - -#else /* (TSCH_LOG_PER_SLOT == 0) */ - -/************ Types ***********/ - -/** \brief Structure for a log. Union of different types of logs */ -struct tsch_log_t { - enum { tsch_log_tx, - tsch_log_rx, - tsch_log_message - } type; - struct tsch_asn_t asn; - struct tsch_link *link; - uint8_t burst_count; - uint8_t channel; - union { - char message[48]; - struct { - int mac_tx_status; - linkaddr_t dest; - int drift; - uint8_t num_tx; - uint8_t datalen; - uint8_t is_data; - uint8_t sec_level; - uint8_t drift_used; - uint8_t seqno; - } tx; - struct { - linkaddr_t src; - int drift; - int estimated_drift; - uint8_t datalen; - uint8_t is_unicast; - uint8_t is_data; - uint8_t sec_level; - uint8_t drift_used; - uint8_t seqno; - } rx; - }; -}; - -/********** Functions *********/ - -/** - * \brief Prepare addition of a new log. - * \return A pointer to log structure if success, NULL otherwise - */ -struct tsch_log_t *tsch_log_prepare_add(void); -/** - * \brief Actually add the previously prepared log - */ -void tsch_log_commit(void); -/** - * \brief Initialize log module - */ -void tsch_log_init(void); -/** - * \brief Process pending log messages - */ -void tsch_log_process_pending(void); -/** - * \brief Stop logging module - */ -void tsch_log_stop(void); - -/************ Macros **********/ - -/** \brief Use this macro to add a log to the queue (will be printed out - * later, after leaving interrupt context) */ -#define TSCH_LOG_ADD(log_type, init_code) do { \ - struct tsch_log_t *log = tsch_log_prepare_add(); \ - if(log != NULL) { \ - log->type = (log_type); \ - init_code; \ - tsch_log_commit(); \ - } \ -} while(0); - -#endif /* (TSCH_LOG_PER_SLOT == 0) */ - -#endif /* __TSCH_LOG_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-packet.c b/os/net/mac/tsch/tsch-packet.c deleted file mode 100644 index 133e9a668..000000000 --- a/os/net/mac/tsch/tsch-packet.c +++ /dev/null @@ -1,479 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * TSCH packet format management - * \author - * Simon Duquennoy - * Beshr Al Nahas - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#include "contiki.h" -#include "net/packetbuf.h" -#include "net/mac/tsch/tsch.h" -#include "net/mac/framer/frame802154.h" -#include "net/mac/framer/framer-802154.h" -#include "net/netstack.h" -#include "lib/ccm-star.h" -#include "lib/aes-128.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "TSCH Pkt" -#define LOG_LEVEL LOG_LEVEL_MAC - -/* - * We use a local packetbuf_attr array to collect necessary frame settings to - * create an EACK because EACK is generated in the interrupt context where - * packetbuf and packetbuf_attrs[] may be in use for another purpose. - * - * We have accessors of eackbuf_attrs: tsch_packet_eackbuf_set_attr() and - * tsch_packet_eackbuf_attr(). For some platform, they might need to be - * implemented as inline functions. However, for now, we don't provide the - * inline option. Such an optimization is left to the compiler for a target - * platform. - */ -static struct packetbuf_attr eackbuf_attrs[PACKETBUF_NUM_ATTRS]; - -/* The offset of the frame pending bit flag within the first byte of FCF */ -#define IEEE802154_FRAME_PENDING_BIT_OFFSET 4 - -/*---------------------------------------------------------------------------*/ -static int -tsch_packet_eackbuf_set_attr(uint8_t type, const packetbuf_attr_t val) -{ - eackbuf_attrs[type].val = val; - return 1; -} -/*---------------------------------------------------------------------------*/ -/* Return the value of a specified attribute */ -packetbuf_attr_t -tsch_packet_eackbuf_attr(uint8_t type) -{ - return eackbuf_attrs[type].val; -} -/*---------------------------------------------------------------------------*/ -/* Construct enhanced ACK packet and return ACK length */ -int -tsch_packet_create_eack(uint8_t *buf, uint16_t buf_len, - const linkaddr_t *dest_addr, uint8_t seqno, - int16_t drift, int nack) -{ - frame802154_t params; - struct ieee802154_ies ies; - int hdr_len; - int ack_len; - - if(buf == NULL) { - return -1; - } - - memset(eackbuf_attrs, 0, sizeof(eackbuf_attrs)); - - tsch_packet_eackbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_ACKFRAME); - tsch_packet_eackbuf_set_attr(PACKETBUF_ATTR_MAC_METADATA, 1); - tsch_packet_eackbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, seqno); - - tsch_packet_eackbuf_set_attr(PACKETBUF_ATTR_MAC_NO_DEST_ADDR, 1); -#if TSCH_PACKET_EACK_WITH_DEST_ADDR - if(dest_addr != NULL) { - tsch_packet_eackbuf_set_attr(PACKETBUF_ATTR_MAC_NO_DEST_ADDR, 0); - linkaddr_copy((linkaddr_t *)¶ms.dest_addr, dest_addr); - } -#endif - - tsch_packet_eackbuf_set_attr(PACKETBUF_ATTR_MAC_NO_SRC_ADDR, 1); -#if TSCH_PACKET_EACK_WITH_SRC_ADDR - tsch_packet_eackbuf_set_attr(PACKETBUF_ATTR_MAC_NO_SRC_ADDR, 0); - linkaddr_copy((linkaddr_t *)¶ms.src_addr, &linkaddr_node_addr); -#endif - -#if LLSEC802154_ENABLED - if(tsch_is_pan_secured) { - tsch_packet_eackbuf_set_attr(PACKETBUF_ATTR_SECURITY_LEVEL, - TSCH_SECURITY_KEY_SEC_LEVEL_ACK); - tsch_packet_eackbuf_set_attr(PACKETBUF_ATTR_KEY_ID_MODE, - FRAME802154_1_BYTE_KEY_ID_MODE); - tsch_packet_eackbuf_set_attr(PACKETBUF_ATTR_KEY_INDEX, - TSCH_SECURITY_KEY_INDEX_ACK); - } -#endif /* LLSEC802154_ENABLED */ - - framer_802154_setup_params(tsch_packet_eackbuf_attr, 0, ¶ms); - hdr_len = frame802154_hdrlen(¶ms); - - memset(buf, 0, buf_len); - - /* Setup IE timesync */ - memset(&ies, 0, sizeof(ies)); - ies.ie_time_correction = drift; - ies.ie_is_nack = nack; - - ack_len = - frame80215e_create_ie_header_ack_nack_time_correction(buf + hdr_len, - buf_len - hdr_len, &ies); - if(ack_len < 0) { - return -1; - } - ack_len += hdr_len; - - frame802154_create(¶ms, buf); - - return ack_len; -} -/*---------------------------------------------------------------------------*/ -/* Parse enhanced ACK packet, extract drift and nack */ -int -tsch_packet_parse_eack(const uint8_t *buf, int buf_size, - uint8_t seqno, frame802154_t *frame, struct ieee802154_ies *ies, uint8_t *hdr_len) -{ - uint8_t curr_len = 0; - int ret; - linkaddr_t dest; - - if(frame == NULL || buf_size < 0) { - return 0; - } - /* Parse 802.15.4-2006 frame, i.e. all fields before Information Elements */ - if((ret = frame802154_parse((uint8_t *)buf, buf_size, frame)) < 3) { - return 0; - } - if(hdr_len != NULL) { - *hdr_len = ret; - } - curr_len += ret; - - /* Check seqno */ - if(seqno != frame->seq) { - return 0; - } - - /* Check destination PAN ID */ - if(frame802154_check_dest_panid(frame) == 0) { - return 0; - } - - /* Check destination address (if any) */ - if(frame802154_extract_linkaddr(frame, NULL, &dest) == 0 || - (!linkaddr_cmp(&dest, &linkaddr_node_addr) - && !linkaddr_cmp(&dest, &linkaddr_null))) { - return 0; - } - - if(ies != NULL) { - memset(ies, 0, sizeof(struct ieee802154_ies)); - } - - if(frame->fcf.ie_list_present) { - int mic_len = 0; -#if LLSEC802154_ENABLED - /* Check if there is space for the security MIC (if any) */ - mic_len = tsch_security_mic_len(frame); - if(buf_size < curr_len + mic_len) { - return 0; - } -#endif /* LLSEC802154_ENABLED */ - /* Parse information elements. We need to substract the MIC length, as the exact payload len is needed while parsing */ - if((ret = frame802154e_parse_information_elements(buf + curr_len, buf_size - curr_len - mic_len, ies)) == -1) { - return 0; - } - curr_len += ret; - } - - if(hdr_len != NULL) { - *hdr_len += ies->ie_payload_ie_offset; - } - - return curr_len; -} -/*---------------------------------------------------------------------------*/ -/* Create an EB packet */ -int -tsch_packet_create_eb(uint8_t *hdr_len, uint8_t *tsch_sync_ie_offset) -{ - struct ieee802154_ies ies; - uint8_t *p; - int ie_len; - const uint16_t payload_ie_hdr_len = 2; - - packetbuf_clear(); - - /* Prepare Information Elements for inclusion in the EB */ - memset(&ies, 0, sizeof(ies)); - - /* Add TSCH timeslot timing IE. */ -#if TSCH_PACKET_EB_WITH_TIMESLOT_TIMING - { - int i; - ies.ie_tsch_timeslot_id = 1; - for(i = 0; i < tsch_ts_elements_count; i++) { - ies.ie_tsch_timeslot[i] = RTIMERTICKS_TO_US(tsch_timing[i]); - } - } -#endif /* TSCH_PACKET_EB_WITH_TIMESLOT_TIMING */ - - /* Add TSCH hopping sequence IE */ -#if TSCH_PACKET_EB_WITH_HOPPING_SEQUENCE - if(tsch_hopping_sequence_length.val <= sizeof(ies.ie_hopping_sequence_list)) { - ies.ie_channel_hopping_sequence_id = 1; - ies.ie_hopping_sequence_len = tsch_hopping_sequence_length.val; - memcpy(ies.ie_hopping_sequence_list, tsch_hopping_sequence, - ies.ie_hopping_sequence_len); - } -#endif /* TSCH_PACKET_EB_WITH_HOPPING_SEQUENCE */ - - /* Add Slotframe and Link IE */ -#if TSCH_PACKET_EB_WITH_SLOTFRAME_AND_LINK - { - /* Send slotframe 0 with link at timeslot 0 */ - struct tsch_slotframe *sf0 = tsch_schedule_get_slotframe_by_handle(0); - struct tsch_link *link0 = tsch_schedule_get_link_by_timeslot(sf0, 0); - if(sf0 && link0) { - ies.ie_tsch_slotframe_and_link.num_slotframes = 1; - ies.ie_tsch_slotframe_and_link.slotframe_handle = sf0->handle; - ies.ie_tsch_slotframe_and_link.slotframe_size = sf0->size.val; - ies.ie_tsch_slotframe_and_link.num_links = 1; - ies.ie_tsch_slotframe_and_link.links[0].timeslot = link0->timeslot; - ies.ie_tsch_slotframe_and_link.links[0].channel_offset = - link0->channel_offset; - ies.ie_tsch_slotframe_and_link.links[0].link_options = - link0->link_options; - } - } -#endif /* TSCH_PACKET_EB_WITH_SLOTFRAME_AND_LINK */ - - p = packetbuf_dataptr(); - - ie_len = frame80215e_create_ie_tsch_synchronization(p, - packetbuf_remaininglen(), - &ies); - if(ie_len < 0) { - return -1; - } - p += ie_len; - packetbuf_set_datalen(packetbuf_datalen() + ie_len); - - ie_len = frame80215e_create_ie_tsch_timeslot(p, - packetbuf_remaininglen(), - &ies); - if(ie_len < 0) { - return -1; - } - p += ie_len; - packetbuf_set_datalen(packetbuf_datalen() + ie_len); - - ie_len = frame80215e_create_ie_tsch_channel_hopping_sequence(p, - packetbuf_remaininglen(), - &ies); - if(ie_len < 0) { - return -1; - } - p += ie_len; - packetbuf_set_datalen(packetbuf_datalen() + ie_len); - - ie_len = frame80215e_create_ie_tsch_slotframe_and_link(p, - packetbuf_remaininglen(), - &ies); - if(ie_len < 0) { - return -1; - } - p += ie_len; - packetbuf_set_datalen(packetbuf_datalen() + ie_len); - -#if 0 - /* Payload IE list termination: optional */ - ie_len = frame80215e_create_ie_payload_list_termination(p, - packetbuf_remaininglen(), - &ies); - if(ie_len < 0) { - return -1; - } - p += ie_len; - packetbuf_set_datalen(packetbuf_datalen() + ie_len); -#endif - - ies.ie_mlme_len = packetbuf_datalen(); - - /* make room for Payload IE header */ - memmove((uint8_t *)packetbuf_dataptr() + payload_ie_hdr_len, - packetbuf_dataptr(), packetbuf_datalen()); - packetbuf_set_datalen(packetbuf_datalen() + payload_ie_hdr_len); - ie_len = frame80215e_create_ie_mlme(packetbuf_dataptr(), - packetbuf_remaininglen(), - &ies); - if(ie_len < 0) { - return -1; - } - - /* allocate space for Header Termination IE, the size of which is 2 octets */ - packetbuf_hdralloc(2); - ie_len = frame80215e_create_ie_header_list_termination_1(packetbuf_hdrptr(), - packetbuf_remaininglen(), - &ies); - if(ie_len < 0) { - return -1; - } - - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_BEACONFRAME); - packetbuf_set_attr(PACKETBUF_ATTR_MAC_METADATA, 1); - - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &tsch_eb_address); - -#if LLSEC802154_ENABLED - if(tsch_is_pan_secured) { - packetbuf_set_attr(PACKETBUF_ATTR_SECURITY_LEVEL, - TSCH_SECURITY_KEY_SEC_LEVEL_EB); - packetbuf_set_attr(PACKETBUF_ATTR_KEY_ID_MODE, - FRAME802154_1_BYTE_KEY_ID_MODE); - packetbuf_set_attr(PACKETBUF_ATTR_KEY_INDEX, - TSCH_SECURITY_KEY_INDEX_EB); - } -#endif /* LLSEC802154_ENABLED */ - - if(NETSTACK_FRAMER.create() < 0) { - return -1; - } - - if(hdr_len != NULL) { - *hdr_len = packetbuf_hdrlen(); - } - - /* - * Save the offset of the TSCH Synchronization IE, which is expected to be - * located just after the Payload IE header, needed to update ASN and join - * priority before sending. - */ - if(tsch_sync_ie_offset != NULL) { - *tsch_sync_ie_offset = packetbuf_hdrlen() + payload_ie_hdr_len; - } - - return packetbuf_totlen(); -} -/*---------------------------------------------------------------------------*/ -/* Update ASN in EB packet */ -int -tsch_packet_update_eb(uint8_t *buf, int buf_size, uint8_t tsch_sync_ie_offset) -{ - struct ieee802154_ies ies; - ies.ie_asn = tsch_current_asn; - ies.ie_join_priority = tsch_join_priority; - return frame80215e_create_ie_tsch_synchronization(buf+tsch_sync_ie_offset, buf_size-tsch_sync_ie_offset, &ies) != -1; -} -/*---------------------------------------------------------------------------*/ -/* Parse a IEEE 802.15.4e TSCH Enhanced Beacon (EB) */ -int -tsch_packet_parse_eb(const uint8_t *buf, int buf_size, - frame802154_t *frame, struct ieee802154_ies *ies, uint8_t *hdr_len, int frame_without_mic) -{ - uint8_t curr_len = 0; - int ret; - - if(frame == NULL || buf_size < 0) { - return 0; - } - - /* Parse 802.15.4-2006 frame, i.e. all fields before Information Elements */ - if((ret = frame802154_parse((uint8_t *)buf, buf_size, frame)) == 0) { - LOG_ERR("! parse_eb: failed to parse frame\n"); - return 0; - } - - if(frame->fcf.frame_version < FRAME802154_IEEE802154_2015 - || frame->fcf.frame_type != FRAME802154_BEACONFRAME) { - LOG_INFO("! parse_eb: frame is not a valid TSCH beacon. Frame version %u, type %u, FCF %02x %02x\n", - frame->fcf.frame_version, frame->fcf.frame_type, buf[0], buf[1]); - LOG_INFO("! parse_eb: frame was from 0x%x/", frame->src_pid); - LOG_INFO_LLADDR((const linkaddr_t *)&frame->src_addr); - LOG_INFO_(" to 0x%x/", frame->dest_pid); - LOG_INFO_LLADDR((const linkaddr_t *)&frame->dest_addr); - LOG_INFO_("\n"); - return 0; - } - - if(hdr_len != NULL) { - *hdr_len = ret; - } - curr_len += ret; - - if(ies != NULL) { - memset(ies, 0, sizeof(struct ieee802154_ies)); - ies->ie_join_priority = 0xff; /* Use max value in case the Beacon does not include a join priority */ - } - if(frame->fcf.ie_list_present) { - /* Calculate space needed for the security MIC, if any, before attempting to parse IEs */ - int mic_len = 0; -#if LLSEC802154_ENABLED - if(!frame_without_mic) { - mic_len = tsch_security_mic_len(frame); - if(buf_size < curr_len + mic_len) { - return 0; - } - } -#endif /* LLSEC802154_ENABLED */ - - /* Parse information elements. We need to substract the MIC length, as the exact payload len is needed while parsing */ - if((ret = frame802154e_parse_information_elements(buf + curr_len, buf_size - curr_len - mic_len, ies)) == -1) { - LOG_ERR("! parse_eb: failed to parse IEs\n"); - return 0; - } - curr_len += ret; - } - - if(hdr_len != NULL) { - *hdr_len += ies->ie_payload_ie_offset; - } - - return curr_len; -} -/*---------------------------------------------------------------------------*/ -/* Set frame pending bit in a packet (whose header was already build) */ -void -tsch_packet_set_frame_pending(uint8_t *buf, int buf_size) -{ - buf[0] |= (1 << IEEE802154_FRAME_PENDING_BIT_OFFSET); -} -/*---------------------------------------------------------------------------*/ -/* Get frame pending bit from a packet */ -int -tsch_packet_get_frame_pending(uint8_t *buf, int buf_size) -{ - return (buf[0] >> IEEE802154_FRAME_PENDING_BIT_OFFSET) & 1; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/tsch-packet.h b/os/net/mac/tsch/tsch-packet.h deleted file mode 100644 index cdf7c7bed..000000000 --- a/os/net/mac/tsch/tsch-packet.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup tsch - * @{ - * \file - * TSCH packet parsing and creation. EBs and EACKs. -*/ - -#ifndef __TSCH_PACKET_H__ -#define __TSCH_PACKET_H__ - -/********** Includes **********/ - -#include "contiki.h" -#include "net/mac/framer/frame802154.h" -#include "net/mac/framer/frame802154e-ie.h" - -/********** Functions *********/ - -/** - * \brief Construct Enhanced ACK packet - * \param buf The buffer where to build the EACK - * \param buf_size The buffer size - * \param dest_addr The link-layer address of the neighbor we are ACKing - * \param seqno The sequence number we are ACKing - * \param drift The time offset in usec measured at Rx of the packer we are ACKing - * \param nack Value of the NACK bit - * \return The length of the packet that was created. -1 if failure. - */ -int tsch_packet_create_eack(uint8_t *buf, uint16_t buf_size, - const linkaddr_t *dest_addr, uint8_t seqno, - int16_t drift, int nack); -/** - * \brief Parse enhanced ACK packet - * \param buf The buffer where to parse the EACK from - * \param buf_size The buffer size - * \param seqno The sequence number we are expecting - * \param frame The frame structure where to store parsed fields - * \param ies The IE structure where to store parsed IEs - * \param hdr_len A pointer where to store the length of the parsed header - * \return 1 if the EACK is correct and acknowledges the specified frame, 0 otherwise - */ -int tsch_packet_parse_eack(const uint8_t *buf, int buf_size, - uint8_t seqno, frame802154_t *frame, struct ieee802154_ies *ies, uint8_t *hdr_len); -/** - * \brief Create an EB packet directly in packetbuf - * \param hdr_len A pointer where to store the length of the created header - * \param tsch_sync_ie_ptr A pointer where to store the address of the TSCH synchronization IE - * \return The total length of the EB - */ -int tsch_packet_create_eb(uint8_t *hdr_len, uint8_t *tsch_sync_ie_ptr); -/** - * \brief Update ASN in EB packet - * \param buf The buffer that contains the EB - * \param buf_size The buffer size - * \param tsch_sync_ie_offset The offset of the TSCH synchronization IE, in which the ASN is to be written - * \return 1 if success, 0 otherwise - */ -int tsch_packet_update_eb(uint8_t *buf, int buf_size, uint8_t tsch_sync_ie_offset); -/** - * \brief Parse EB - * \param buf The buffer where to parse the EB from - * \param buf_size The buffer sizecting - * \param frame The frame structure where to store parsed fields - * \param ies The IE structure where to store parsed IEs - * \param hdrlen A pointer where to store the length of the parsed header - * \param frame_without_mic When set, the security MIC will not be parsed - * \return The length of the parsed EB - */ -int tsch_packet_parse_eb(const uint8_t *buf, int buf_size, - frame802154_t *frame, struct ieee802154_ies *ies, - uint8_t *hdrlen, int frame_without_mic); -/** - * \brief Set frame pending bit in a packet (whose header was already build) - * \param buf The buffer where the packet resides - * \param buf_size The buffer size - */ -void tsch_packet_set_frame_pending(uint8_t *buf, int buf_size); -/** - * \brief Get frame pending bit from a packet - * \param buf The buffer where the packet resides - * \param buf_size The buffer size - * \return The value of the frame pending bit, 1 or 0 - */ -int tsch_packet_get_frame_pending(uint8_t *buf, int buf_size); - -#endif /* __TSCH_PACKET_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-queue.c b/os/net/mac/tsch/tsch-queue.c deleted file mode 100644 index f586ac90e..000000000 --- a/os/net/mac/tsch/tsch-queue.c +++ /dev/null @@ -1,531 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Per-neighbor packet queues for TSCH MAC. - * The list of neighbors uses the TSCH lock, but per-neighbor packet array are lock-free. - * Read-only operation on neighbor and packets are allowed from interrupts and outside of them. - * *Other operations are allowed outside of interrupt only.* - * \author - * Simon Duquennoy - * Beshr Al Nahas - * Domenico De Guglielmo - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#include "contiki.h" -#include "lib/list.h" -#include "lib/memb.h" -#include "lib/random.h" -#include "net/queuebuf.h" -#include "net/mac/tsch/tsch.h" -#include - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "TSCH Queue" -#define LOG_LEVEL LOG_LEVEL_MAC - -/* Check if TSCH_QUEUE_NUM_PER_NEIGHBOR is power of two */ -#if (TSCH_QUEUE_NUM_PER_NEIGHBOR & (TSCH_QUEUE_NUM_PER_NEIGHBOR - 1)) != 0 -#error TSCH_QUEUE_NUM_PER_NEIGHBOR must be power of two -#endif - -/* We have as many packets are there are queuebuf in the system */ -MEMB(packet_memb, struct tsch_packet, QUEUEBUF_NUM); -MEMB(neighbor_memb, struct tsch_neighbor, TSCH_QUEUE_MAX_NEIGHBOR_QUEUES); -LIST(neighbor_list); - -/* Broadcast and EB virtual neighbors */ -struct tsch_neighbor *n_broadcast; -struct tsch_neighbor *n_eb; - -/*---------------------------------------------------------------------------*/ -/* Add a TSCH neighbor */ -struct tsch_neighbor * -tsch_queue_add_nbr(const linkaddr_t *addr) -{ - struct tsch_neighbor *n = NULL; - /* If we have an entry for this neighbor already, we simply update it */ - n = tsch_queue_get_nbr(addr); - if(n == NULL) { - if(tsch_get_lock()) { - /* Allocate a neighbor */ - n = memb_alloc(&neighbor_memb); - if(n != NULL) { - /* Initialize neighbor entry */ - memset(n, 0, sizeof(struct tsch_neighbor)); - ringbufindex_init(&n->tx_ringbuf, TSCH_QUEUE_NUM_PER_NEIGHBOR); - linkaddr_copy(&n->addr, addr); - n->is_broadcast = linkaddr_cmp(addr, &tsch_eb_address) - || linkaddr_cmp(addr, &tsch_broadcast_address); - tsch_queue_backoff_reset(n); - /* Add neighbor to the list */ - list_add(neighbor_list, n); - } - tsch_release_lock(); - } - } - return n; -} -/*---------------------------------------------------------------------------*/ -/* Get a TSCH neighbor */ -struct tsch_neighbor * -tsch_queue_get_nbr(const linkaddr_t *addr) -{ - if(!tsch_is_locked()) { - struct tsch_neighbor *n = list_head(neighbor_list); - while(n != NULL) { - if(linkaddr_cmp(&n->addr, addr)) { - return n; - } - n = list_item_next(n); - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/* Get a TSCH time source (we currently assume there is only one) */ -struct tsch_neighbor * -tsch_queue_get_time_source(void) -{ - if(!tsch_is_locked()) { - struct tsch_neighbor *curr_nbr = list_head(neighbor_list); - while(curr_nbr != NULL) { - if(curr_nbr->is_time_source) { - return curr_nbr; - } - curr_nbr = list_item_next(curr_nbr); - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/* Update TSCH time source */ -int -tsch_queue_update_time_source(const linkaddr_t *new_addr) -{ - if(!tsch_is_locked()) { - if(!tsch_is_coordinator) { - struct tsch_neighbor *old_time_src = tsch_queue_get_time_source(); - struct tsch_neighbor *new_time_src = NULL; - - if(new_addr != NULL) { - /* Get/add neighbor, return 0 in case of failure */ - new_time_src = tsch_queue_add_nbr(new_addr); - if(new_time_src == NULL) { - return 0; - } - } - - if(new_time_src != old_time_src) { - LOG_INFO("update time source: "); - LOG_INFO_LLADDR(old_time_src ? &old_time_src->addr : NULL); - LOG_INFO_(" -> "); - LOG_INFO_LLADDR(new_time_src ? &new_time_src->addr : NULL); - LOG_INFO_("\n"); - - /* Update time source */ - if(new_time_src != NULL) { - new_time_src->is_time_source = 1; - /* (Re)set keep-alive timeout */ - tsch_set_ka_timeout(TSCH_KEEPALIVE_TIMEOUT); - } else { - /* Stop sending keepalives */ - tsch_set_ka_timeout(0); - } - - if(old_time_src != NULL) { - old_time_src->is_time_source = 0; - } - - tsch_stats_reset_neighbor_stats(); - -#ifdef TSCH_CALLBACK_NEW_TIME_SOURCE - TSCH_CALLBACK_NEW_TIME_SOURCE(old_time_src, new_time_src); -#endif - } - - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/* Flush a neighbor queue */ -static void -tsch_queue_flush_nbr_queue(struct tsch_neighbor *n) -{ - while(!tsch_queue_is_empty(n)) { - struct tsch_packet *p = tsch_queue_remove_packet_from_queue(n); - if(p != NULL) { - /* Set return status for packet_sent callback */ - p->ret = MAC_TX_ERR; - LOG_WARN("! flushing packet\n"); - /* Call packet_sent callback */ - mac_call_sent_callback(p->sent, p->ptr, p->ret, p->transmissions); - /* Free packet queuebuf */ - tsch_queue_free_packet(p); - } - } -} -/*---------------------------------------------------------------------------*/ -/* Remove TSCH neighbor queue */ -static void -tsch_queue_remove_nbr(struct tsch_neighbor *n) -{ - if(n != NULL) { - if(tsch_get_lock()) { - - /* Remove neighbor from list */ - list_remove(neighbor_list, n); - - tsch_release_lock(); - - /* Flush queue */ - tsch_queue_flush_nbr_queue(n); - - /* Free neighbor */ - memb_free(&neighbor_memb, n); - } - } -} -/*---------------------------------------------------------------------------*/ -/* Add packet to neighbor queue. Use same lockfree implementation as ringbuf.c (put is atomic) */ -struct tsch_packet * -tsch_queue_add_packet(const linkaddr_t *addr, uint8_t max_transmissions, - mac_callback_t sent, void *ptr) -{ - struct tsch_neighbor *n = NULL; - int16_t put_index = -1; - struct tsch_packet *p = NULL; - if(!tsch_is_locked()) { - n = tsch_queue_add_nbr(addr); - if(n != NULL) { - put_index = ringbufindex_peek_put(&n->tx_ringbuf); - if(put_index != -1) { - p = memb_alloc(&packet_memb); - if(p != NULL) { - /* Enqueue packet */ -#ifdef TSCH_CALLBACK_PACKET_READY - TSCH_CALLBACK_PACKET_READY(); -#endif - p->qb = queuebuf_new_from_packetbuf(); - if(p->qb != NULL) { - p->sent = sent; - p->ptr = ptr; - p->ret = MAC_TX_DEFERRED; - p->transmissions = 0; - p->max_transmissions = max_transmissions; - /* Add to ringbuf (actual add committed through atomic operation) */ - n->tx_array[put_index] = p; - ringbufindex_put(&n->tx_ringbuf); - LOG_DBG("packet is added put_index %u, packet %p\n", - put_index, p); - return p; - } else { - memb_free(&packet_memb, p); - } - } - } - } - } - LOG_ERR("! add packet failed: %u %p %d %p %p\n", tsch_is_locked(), n, put_index, p, p ? p->qb : NULL); - return 0; -} -/*---------------------------------------------------------------------------*/ -/* Returns the number of packets currently in any TSCH queue */ -int -tsch_queue_global_packet_count(void) -{ - return QUEUEBUF_NUM - memb_numfree(&packet_memb); -} -/*---------------------------------------------------------------------------*/ -/* Returns the number of packets currently in the queue */ -int -tsch_queue_packet_count(const linkaddr_t *addr) -{ - struct tsch_neighbor *n = NULL; - if(!tsch_is_locked()) { - n = tsch_queue_add_nbr(addr); - if(n != NULL) { - return ringbufindex_elements(&n->tx_ringbuf); - } - } - return -1; -} -/*---------------------------------------------------------------------------*/ -/* Remove first packet from a neighbor queue */ -struct tsch_packet * -tsch_queue_remove_packet_from_queue(struct tsch_neighbor *n) -{ - if(!tsch_is_locked()) { - if(n != NULL) { - /* Get and remove packet from ringbuf (remove committed through an atomic operation */ - int16_t get_index = ringbufindex_get(&n->tx_ringbuf); - if(get_index != -1) { - return n->tx_array[get_index]; - } else { - return NULL; - } - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/* Free a packet */ -void -tsch_queue_free_packet(struct tsch_packet *p) -{ - if(p != NULL) { - queuebuf_free(p->qb); - memb_free(&packet_memb, p); - } -} -/*---------------------------------------------------------------------------*/ -/* Updates neighbor queue state after a transmission */ -int -tsch_queue_packet_sent(struct tsch_neighbor *n, struct tsch_packet *p, - struct tsch_link *link, uint8_t mac_tx_status) -{ - int in_queue = 1; - int is_shared_link = link->link_options & LINK_OPTION_SHARED; - int is_unicast = !n->is_broadcast; - - if(mac_tx_status == MAC_TX_OK) { - /* Successful transmission */ - tsch_queue_remove_packet_from_queue(n); - in_queue = 0; - - /* Update CSMA state in the unicast case */ - if(is_unicast) { - if(is_shared_link || tsch_queue_is_empty(n)) { - /* If this is a shared link, reset backoff on success. - * Otherwise, do so only is the queue is empty */ - tsch_queue_backoff_reset(n); - } - } - } else { - /* Failed transmission */ - if(p->transmissions >= p->max_transmissions) { - /* Drop packet */ - tsch_queue_remove_packet_from_queue(n); - in_queue = 0; - } - /* Update CSMA state in the unicast case */ - if(is_unicast) { - /* Failures on dedicated (== non-shared) leave the backoff - * window nor exponent unchanged */ - if(is_shared_link) { - /* Shared link: increment backoff exponent, pick a new window */ - tsch_queue_backoff_inc(n); - } - } - } - - return in_queue; -} -/*---------------------------------------------------------------------------*/ -/* Flush all neighbor queues */ -void -tsch_queue_reset(void) -{ - /* Deallocate unneeded neighbors */ - if(!tsch_is_locked()) { - struct tsch_neighbor *n = list_head(neighbor_list); - while(n != NULL) { - struct tsch_neighbor *next_n = list_item_next(n); - /* Flush queue */ - tsch_queue_flush_nbr_queue(n); - /* Reset backoff exponent */ - tsch_queue_backoff_reset(n); - n = next_n; - } - } -} -/*---------------------------------------------------------------------------*/ -/* Deallocate neighbors with empty queue */ -void -tsch_queue_free_unused_neighbors(void) -{ - /* Deallocate unneeded neighbors */ - if(!tsch_is_locked()) { - struct tsch_neighbor *n = list_head(neighbor_list); - while(n != NULL) { - struct tsch_neighbor *next_n = list_item_next(n); - /* Queue is empty, no tx link to this neighbor: deallocate. - * Always keep time source and virtual broadcast neighbors. */ - if(!n->is_broadcast && !n->is_time_source && !n->tx_links_count - && tsch_queue_is_empty(n)) { - tsch_queue_remove_nbr(n); - } - n = next_n; - } - } -} -/*---------------------------------------------------------------------------*/ -/* Is the neighbor queue empty? */ -int -tsch_queue_is_empty(const struct tsch_neighbor *n) -{ - return !tsch_is_locked() && n != NULL && ringbufindex_empty(&n->tx_ringbuf); -} -/*---------------------------------------------------------------------------*/ -/* Returns the first packet from a neighbor queue */ -struct tsch_packet * -tsch_queue_get_packet_for_nbr(const struct tsch_neighbor *n, struct tsch_link *link) -{ - if(!tsch_is_locked()) { - int is_shared_link = link != NULL && link->link_options & LINK_OPTION_SHARED; - if(n != NULL) { - int16_t get_index = ringbufindex_peek_get(&n->tx_ringbuf); - if(get_index != -1 && - !(is_shared_link && !tsch_queue_backoff_expired(n))) { /* If this is a shared link, - make sure the backoff has expired */ -#if TSCH_WITH_LINK_SELECTOR - int packet_attr_slotframe = queuebuf_attr(n->tx_array[get_index]->qb, PACKETBUF_ATTR_TSCH_SLOTFRAME); - int packet_attr_timeslot = queuebuf_attr(n->tx_array[get_index]->qb, PACKETBUF_ATTR_TSCH_TIMESLOT); - if(packet_attr_slotframe != 0xffff && packet_attr_slotframe != link->slotframe_handle) { - return NULL; - } - if(packet_attr_timeslot != 0xffff && packet_attr_timeslot != link->timeslot) { - return NULL; - } -#endif - return n->tx_array[get_index]; - } - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/* Returns the head packet from a neighbor queue (from neighbor address) */ -struct tsch_packet * -tsch_queue_get_packet_for_dest_addr(const linkaddr_t *addr, struct tsch_link *link) -{ - if(!tsch_is_locked()) { - return tsch_queue_get_packet_for_nbr(tsch_queue_get_nbr(addr), link); - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/* Returns the head packet of any neighbor queue with zero backoff counter. - * Writes pointer to the neighbor in *n */ -struct tsch_packet * -tsch_queue_get_unicast_packet_for_any(struct tsch_neighbor **n, struct tsch_link *link) -{ - if(!tsch_is_locked()) { - struct tsch_neighbor *curr_nbr = list_head(neighbor_list); - struct tsch_packet *p = NULL; - while(curr_nbr != NULL) { - if(!curr_nbr->is_broadcast && curr_nbr->tx_links_count == 0) { - /* Only look up for non-broadcast neighbors we do not have a tx link to */ - p = tsch_queue_get_packet_for_nbr(curr_nbr, link); - if(p != NULL) { - if(n != NULL) { - *n = curr_nbr; - } - return p; - } - } - curr_nbr = list_item_next(curr_nbr); - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/* May the neighbor transmit over a shared link? */ -int -tsch_queue_backoff_expired(const struct tsch_neighbor *n) -{ - return n->backoff_window == 0; -} -/*---------------------------------------------------------------------------*/ -/* Reset neighbor backoff */ -void -tsch_queue_backoff_reset(struct tsch_neighbor *n) -{ - n->backoff_window = 0; - n->backoff_exponent = TSCH_MAC_MIN_BE; -} -/*---------------------------------------------------------------------------*/ -/* Increment backoff exponent, pick a new window */ -void -tsch_queue_backoff_inc(struct tsch_neighbor *n) -{ - /* Increment exponent */ - n->backoff_exponent = MIN(n->backoff_exponent + 1, TSCH_MAC_MAX_BE); - /* Pick a window (number of shared slots to skip). Ignore least significant - * few bits, which, on some embedded implementations of rand (e.g. msp430-libc), - * are known to have poor pseudo-random properties. */ - n->backoff_window = (random_rand() >> 6) % (1 << n->backoff_exponent); - /* Add one to the window as we will decrement it at the end of the current slot - * through tsch_queue_update_all_backoff_windows */ - n->backoff_window++; -} -/*---------------------------------------------------------------------------*/ -/* Decrement backoff window for all queues directed at dest_addr */ -void -tsch_queue_update_all_backoff_windows(const linkaddr_t *dest_addr) -{ - if(!tsch_is_locked()) { - int is_broadcast = linkaddr_cmp(dest_addr, &tsch_broadcast_address); - struct tsch_neighbor *n = list_head(neighbor_list); - while(n != NULL) { - if(n->backoff_window != 0 /* Is the queue in backoff state? */ - && ((n->tx_links_count == 0 && is_broadcast) - || (n->tx_links_count > 0 && linkaddr_cmp(dest_addr, &n->addr)))) { - n->backoff_window--; - } - n = list_item_next(n); - } - } -} -/*---------------------------------------------------------------------------*/ -/* Initialize TSCH queue module */ -void -tsch_queue_init(void) -{ - list_init(neighbor_list); - memb_init(&neighbor_memb); - memb_init(&packet_memb); - /* Add virtual EB and the broadcast neighbors */ - n_eb = tsch_queue_add_nbr(&tsch_eb_address); - n_broadcast = tsch_queue_add_nbr(&tsch_broadcast_address); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/tsch-queue.h b/os/net/mac/tsch/tsch-queue.h deleted file mode 100644 index b7edcf300..000000000 --- a/os/net/mac/tsch/tsch-queue.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup tsch - * @{ - * \file - * TSCH queues -*/ - -#ifndef __TSCH_QUEUE_H__ -#define __TSCH_QUEUE_H__ - -/********** Includes **********/ - -#include "contiki.h" -#include "lib/ringbufindex.h" -#include "net/linkaddr.h" -#include "net/mac/mac.h" - -/***** External Variables *****/ - -/* Broadcast and EB virtual neighbors */ -extern struct tsch_neighbor *n_broadcast; -extern struct tsch_neighbor *n_eb; - -/********** Functions *********/ - -/** - * \brief Add a TSCH neighbor queue - * \param addr The link-layer address of the neighbor to be added - */ -struct tsch_neighbor *tsch_queue_add_nbr(const linkaddr_t *addr); -/** - * \brief Get a TSCH neighbor - * \param addr The link-layer address of the neighbor we are looking for - * \return A pointer to the neighbor queue, NULL if not found - */ -struct tsch_neighbor *tsch_queue_get_nbr(const linkaddr_t *addr); -/** - * \brief Get the TSCH time source (we currently assume there is only one) - * \return The neighbor queue associated to the time source - */ -struct tsch_neighbor *tsch_queue_get_time_source(void); -/** - * \brief Update TSCH time source - * \param new_addr The address of the new TSCH time source - */ -int tsch_queue_update_time_source(const linkaddr_t *new_addr); -/** - * \brief Add packet to neighbor queue. Use same lockfree implementation as ringbuf.c (put is atomic) - * \param addr The address of the targetted neighbor, &tsch_broadcast_address for broadcast - * \param max_transmissions The number of MAC retries - * \param sent The MAC packet sent callback - * \param ptr The MAC packet send callback parameter - * \return The newly created packet if any, NULL otherwise - */ -struct tsch_packet *tsch_queue_add_packet(const linkaddr_t *addr, uint8_t max_transmissions, - mac_callback_t sent, void *ptr); -/** - * \brief Returns the number of packets currently in all TSCH queues - * \return The number of packets currently in all TSCH queues - */ -int tsch_queue_global_packet_count(void); -/** - * \brief Returns the number of packets currently a given neighbor queue - * \param addr The link-layer address of the neighbor we are interested in - * \return The number of packets in the neighbor's queue - */ -int tsch_queue_packet_count(const linkaddr_t *addr); -/** - * \brief Remove first packet from a neighbor queue. The packet is stored in a separate - * dequeued packet list, for later processing. - * \param n The neighbor queue - * \return The packet that was removed if any, NULL otherwise - */ -struct tsch_packet *tsch_queue_remove_packet_from_queue(struct tsch_neighbor *n); -/** - * \brief Free a packet - * \param p The packet to be freed - */ -void tsch_queue_free_packet(struct tsch_packet *p); -/** - * \brief Updates neighbor queue state after a transmission - * \param n The neighbor queue we just sent from - * \param p The packet that was just sent - * \param link The TSCH link used for Tx - * \param mac_tx_status The MAC status (see mac.h) - * \return 1 if the packet remains in queue after the call, 0 if it was removed - */ -int tsch_queue_packet_sent(struct tsch_neighbor *n, struct tsch_packet *p, struct tsch_link *link, uint8_t mac_tx_status); -/** - * \brief Reset neighbor queues module - */ -void tsch_queue_reset(void); -/** - * \brief Deallocate all neighbors with empty queue - */ -void tsch_queue_free_unused_neighbors(void); -/** - * \brief Is the neighbor queue empty? - * \param n The neighbor queue - * \return 1 if empty, 0 otherwise - */ -int tsch_queue_is_empty(const struct tsch_neighbor *n); -/** - * \brief Returns the first packet that can be sent from a queue on a given link - * \param n The neighbor queue - * \param link The link - * \return The next packet to be sent for the neighbor on the given link, if any, else NULL - */ -struct tsch_packet *tsch_queue_get_packet_for_nbr(const struct tsch_neighbor *n, struct tsch_link *link); -/** - * \brief Returns the first packet that can be sent to a given address on a given link - * \param addr The target link-layer address - * \param link The link - * \return The next packet to be sent for to the given address on the given link, if any, else NULL - */ -struct tsch_packet *tsch_queue_get_packet_for_dest_addr(const linkaddr_t *addr, struct tsch_link *link); -/** - * \brief Gets the head packet of any neighbor queue with zero backoff counter. - * \param n A pointer where to store the neighbor queue to be used for Tx - * \param link The link to be used for Tx - * \return The packet if any, else NULL - */ -struct tsch_packet *tsch_queue_get_unicast_packet_for_any(struct tsch_neighbor **n, struct tsch_link *link); -/** - * \brief Is the neighbor backoff timer expired? - * \param n The neighbor queue - * \return 1 if the backoff has expired (neighbor ready to transmit on a shared link), 0 otherwise - */ -int tsch_queue_backoff_expired(const struct tsch_neighbor *n); -/** - * \brief Reset neighbor backoff - * \param n The neighbor queue - */ -void tsch_queue_backoff_reset(struct tsch_neighbor *n); -/** - * \brief Increment backoff exponent of a given neighbor queue, pick a new window - * \param n The neighbor queue - */ -void tsch_queue_backoff_inc(struct tsch_neighbor *n); -/** - * \brief Decrement backoff window for the queue(s) able to Tx to a given address - * \param dest_addr The target address, &tsch_broadcast_address for broadcast - */ -void tsch_queue_update_all_backoff_windows(const linkaddr_t *dest_addr); -/** - * \brief Initialize TSCH queue module - */ -void tsch_queue_init(void); - -#endif /* __TSCH_QUEUE_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-rpl.c b/os/net/mac/tsch/tsch-rpl.c deleted file mode 100644 index e8db94b57..000000000 --- a/os/net/mac/tsch/tsch-rpl.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Interaction between TSCH and RPL - * - * \author Simon Duquennoy - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#include "contiki.h" - -#if UIP_CONF_IPV6_RPL - -#include "net/routing/routing.h" -#include "net/mac/tsch/tsch.h" -#include "net/link-stats.h" - -#if ROUTING_CONF_RPL_LITE -#include "net/routing/rpl-lite/rpl.h" -#elif ROUTING_CONF_RPL_CLASSIC -#include "net/routing/rpl-classic/rpl.h" -#include "net/routing/rpl-classic/rpl-private.h" -#endif - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "TSCH RPL" -#define LOG_LEVEL LOG_LEVEL_MAC - -/*---------------------------------------------------------------------------*/ -/* To use, set #define TSCH_CALLBACK_KA_SENT tsch_rpl_callback_ka_sent */ -void -tsch_rpl_callback_ka_sent(int status, int transmissions) -{ - NETSTACK_ROUTING.link_callback(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), status, transmissions); -} -/*---------------------------------------------------------------------------*/ -/* To use, set #define TSCH_CALLBACK_JOINING_NETWORK tsch_rpl_callback_joining_network */ -void -tsch_rpl_callback_joining_network(void) -{ -} -/*---------------------------------------------------------------------------*/ -/* Upon leaving a TSCH network, perform a local repair - * (cleanup neighbor state, reset Trickle timer etc) - * To use, set #define TSCH_CALLBACK_LEAVING_NETWORK tsch_rpl_callback_leaving_network */ -void -tsch_rpl_callback_leaving_network(void) -{ - /* Forget past link statistics. If we are leaving a TSCH - network, there are changes we've been out of sync in the recent past, and - as a result have irrelevant link statistices. */ - link_stats_reset(); - /* RPL local repair */ - NETSTACK_ROUTING.local_repair("TSCH leaving"); -} -/*---------------------------------------------------------------------------*/ -/* Set TSCH EB period based on current RPL DIO period. - * To use, set #define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval */ -void -tsch_rpl_callback_new_dio_interval(clock_time_t dio_interval) -{ - /* Transmit EBs only if we have a valid rank as per 6TiSCH minimal */ - rpl_dag_t *dag; - rpl_rank_t root_rank; - rpl_rank_t dag_rank; -#if ROUTING_CONF_RPL_LITE - dag = &curr_instance.dag; - root_rank = ROOT_RANK; - dag_rank = DAG_RANK(dag->rank); -#else - rpl_instance_t *instance; - dag = rpl_get_any_dag(); - instance = dag != NULL ? dag->instance : NULL; - root_rank = ROOT_RANK(instance); - dag_rank = DAG_RANK(dag->rank, instance); -#endif - - if(dag != NULL && dag->rank != RPL_INFINITE_RANK) { - /* If we are root set TSCH as coordinator */ - if(dag->rank == root_rank) { - tsch_set_coordinator(1); - } - /* Set EB period */ - tsch_set_eb_period(dio_interval); - /* Set join priority based on RPL rank */ - tsch_set_join_priority(dag_rank - 1); - } else { - tsch_set_eb_period(TSCH_EB_PERIOD); - } -} -/*---------------------------------------------------------------------------*/ -/* Set TSCH time source based on current RPL preferred parent. - * To use, set #define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch */ -void -tsch_rpl_callback_parent_switch(rpl_parent_t *old, rpl_parent_t *new) -{ - /* Map the TSCH time source on the RPL preferred parent (but stick to the - * current time source if there is no preferred aarent) */ - if(tsch_is_associated == 1 && new != NULL) { - tsch_queue_update_time_source( - (const linkaddr_t *)uip_ds6_nbr_lladdr_from_ipaddr( - rpl_parent_get_ipaddr(new))); - } -} -/*---------------------------------------------------------------------------*/ -/* Check RPL has joined DODAG. - * To use, set #define TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined */ -int -tsch_rpl_check_dodag_joined(void) -{ - return NETSTACK_ROUTING.node_has_joined(); -} -#endif /* UIP_CONF_IPV6_RPL */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-rpl.h b/os/net/mac/tsch/tsch-rpl.h deleted file mode 100644 index 95412e3d2..000000000 --- a/os/net/mac/tsch/tsch-rpl.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \addtogroup tsch - * @{ - * \file - * TSCH-RPL interaction -*/ - -#ifndef __TSCH_RPL_H__ -#define __TSCH_RPL_H__ - -/********** Includes **********/ - -#include "net/routing/routing.h" -#if ROUTING_CONF_RPL_LITE -#include "net/routing/rpl-lite/rpl.h" -#elif ROUTING_CONF_RPL_CLASSIC -#include "net/routing/rpl-classic/rpl.h" -#endif - -/********** Functions *********/ - -/** -* \brief Report statiscs from KA packet sent in RPL. -* To use, set TSCH_CALLBACK_KA_SENT to tsch_rpl_callback_ka_sent -* \param status The packet sent status -* \param transmissions The total number of transmissions -*/ -void tsch_rpl_callback_ka_sent(int status, int transmissions); -/** - * \brief Let RPL know that TSCH joined a new network. - * To use, set TSCH_CALLBACK_JOINING_NETWORK to tsch_rpl_callback_joining_network - */ -void tsch_rpl_callback_joining_network(void); -/** - * \brief Let RPL know that TSCH joined a new network. Triggers a local repair. - * To use, set TSCH_CALLBACK_LEAVING_NETWORK to tsch_rpl_callback_leaving_network - */ -void tsch_rpl_callback_leaving_network(void); -/** - * \brief Set TSCH EB period based on current RPL DIO period. - * To use, set RPL_CALLBACK_NEW_DIO_INTERVAL to tsch_rpl_callback_new_dio_interval - * \param dio_interval The new DIO interval in clock ticks - */ -void tsch_rpl_callback_new_dio_interval(clock_time_t dio_interval); -/** - * \brief Set TSCH time source based on current RPL preferred parent. - * To use, set RPL_CALLBACK_PARENT_SWITCH to tsch_rpl_callback_parent_switch - * \param old The old RPL parent - * \param new The new RPL parent - */ -void tsch_rpl_callback_parent_switch(rpl_parent_t *old, rpl_parent_t *new); -/** - * \brief Check RPL has joined DODAG. - * To use, set TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined - * \return 1 if joined, 0 otherwise - */ -int tsch_rpl_check_dodag_joined(void); - -#endif /* __TSCH_RPL_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-schedule.c b/os/net/mac/tsch/tsch-schedule.c deleted file mode 100644 index 3785cacb2..000000000 --- a/os/net/mac/tsch/tsch-schedule.c +++ /dev/null @@ -1,513 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * IEEE 802.15.4 TSCH MAC schedule manager. - * \author - * Simon Duquennoy - * Beshr Al Nahas - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#include "contiki.h" -#include "dev/leds.h" -#include "lib/memb.h" -#include "net/nbr-table.h" -#include "net/packetbuf.h" -#include "net/queuebuf.h" -#include "net/mac/tsch/tsch.h" -#include "net/mac/framer/frame802154.h" -#include "sys/process.h" -#include "sys/rtimer.h" -#include - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "TSCH Sched" -#define LOG_LEVEL LOG_LEVEL_MAC - -/* Pre-allocated space for links */ -MEMB(link_memb, struct tsch_link, TSCH_SCHEDULE_MAX_LINKS); -/* Pre-allocated space for slotframes */ -MEMB(slotframe_memb, struct tsch_slotframe, TSCH_SCHEDULE_MAX_SLOTFRAMES); -/* List of slotframes (each slotframe holds its own list of links) */ -LIST(slotframe_list); - -/* Adds and returns a slotframe (NULL if failure) */ -struct tsch_slotframe * -tsch_schedule_add_slotframe(uint16_t handle, uint16_t size) -{ - if(size == 0) { - return NULL; - } - - if(tsch_schedule_get_slotframe_by_handle(handle)) { - /* A slotframe with this handle already exists */ - return NULL; - } - - if(tsch_get_lock()) { - struct tsch_slotframe *sf = memb_alloc(&slotframe_memb); - if(sf != NULL) { - /* Initialize the slotframe */ - sf->handle = handle; - TSCH_ASN_DIVISOR_INIT(sf->size, size); - LIST_STRUCT_INIT(sf, links_list); - /* Add the slotframe to the global list */ - list_add(slotframe_list, sf); - } - LOG_INFO("add_slotframe %u %u\n", - handle, size); - tsch_release_lock(); - return sf; - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/* Removes all slotframes, resulting in an empty schedule */ -int -tsch_schedule_remove_all_slotframes(void) -{ - struct tsch_slotframe *sf; - while((sf = list_head(slotframe_list))) { - if(tsch_schedule_remove_slotframe(sf) == 0) { - return 0; - } - } - return 1; -} -/*---------------------------------------------------------------------------*/ -/* Removes a slotframe Return 1 if success, 0 if failure */ -int -tsch_schedule_remove_slotframe(struct tsch_slotframe *slotframe) -{ - if(slotframe != NULL) { - /* Remove all links belonging to this slotframe */ - struct tsch_link *l; - while((l = list_head(slotframe->links_list))) { - tsch_schedule_remove_link(slotframe, l); - } - - /* Now that the slotframe has no links, remove it. */ - if(tsch_get_lock()) { - LOG_INFO("remove slotframe %u %u\n", slotframe->handle, slotframe->size.val); - memb_free(&slotframe_memb, slotframe); - list_remove(slotframe_list, slotframe); - tsch_release_lock(); - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/* Looks for a slotframe from a handle */ -struct tsch_slotframe * -tsch_schedule_get_slotframe_by_handle(uint16_t handle) -{ - if(!tsch_is_locked()) { - struct tsch_slotframe *sf = list_head(slotframe_list); - while(sf != NULL) { - if(sf->handle == handle) { - return sf; - } - sf = list_item_next(sf); - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/* Looks for a link from a handle */ -struct tsch_link * -tsch_schedule_get_link_by_handle(uint16_t handle) -{ - if(!tsch_is_locked()) { - struct tsch_slotframe *sf = list_head(slotframe_list); - while(sf != NULL) { - struct tsch_link *l = list_head(sf->links_list); - /* Loop over all items. Assume there is max one link per timeslot */ - while(l != NULL) { - if(l->handle == handle) { - return l; - } - l = list_item_next(l); - } - sf = list_item_next(sf); - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static const char * -print_link_options(uint16_t link_options) -{ - static char buffer[20]; - unsigned length; - - buffer[0] = '\0'; - if(link_options & LINK_OPTION_TX) { - strcat(buffer, "Tx|"); - } - if(link_options & LINK_OPTION_RX) { - strcat(buffer, "Rx|"); - } - if(link_options & LINK_OPTION_SHARED) { - strcat(buffer, "Sh|"); - } - length = strlen(buffer); - if(length > 0) { - buffer[length - 1] = '\0'; - } - - return buffer; -} -/*---------------------------------------------------------------------------*/ -static const char * -print_link_type(uint16_t link_type) -{ - switch(link_type) { - case LINK_TYPE_NORMAL: - return "NORMAL"; - case LINK_TYPE_ADVERTISING: - return "ADV"; - case LINK_TYPE_ADVERTISING_ONLY: - return "ADV_ONLY"; - default: - return "?"; - } -} -/*---------------------------------------------------------------------------*/ -/* Adds a link to a slotframe, return a pointer to it (NULL if failure) */ -struct tsch_link * -tsch_schedule_add_link(struct tsch_slotframe *slotframe, - uint8_t link_options, enum link_type link_type, const linkaddr_t *address, - uint16_t timeslot, uint16_t channel_offset) -{ - struct tsch_link *l = NULL; - if(slotframe != NULL) { - /* We currently support only one link per timeslot in a given slotframe. */ - - /* Validation of specified timeslot and channel_offset */ - if(timeslot > (slotframe->size.val - 1)) { - LOG_ERR("! add_link invalid timeslot: %u\n", timeslot); - return NULL; - } else if(channel_offset > 15) { - LOG_ERR("! add_link invalid channel_offset: %u\n", channel_offset); - return NULL; - } - - /* Start with removing the link currently installed at this timeslot (needed - * to keep neighbor state in sync with link options etc.) */ - tsch_schedule_remove_link_by_timeslot(slotframe, timeslot); - if(!tsch_get_lock()) { - LOG_ERR("! add_link memb_alloc couldn't take lock\n"); - } else { - l = memb_alloc(&link_memb); - if(l == NULL) { - LOG_ERR("! add_link memb_alloc failed\n"); - tsch_release_lock(); - } else { - static int current_link_handle = 0; - struct tsch_neighbor *n; - /* Add the link to the slotframe */ - list_add(slotframe->links_list, l); - /* Initialize link */ - l->handle = current_link_handle++; - l->link_options = link_options; - l->link_type = link_type; - l->slotframe_handle = slotframe->handle; - l->timeslot = timeslot; - l->channel_offset = channel_offset; - l->data = NULL; - if(address == NULL) { - address = &linkaddr_null; - } - linkaddr_copy(&l->addr, address); - - LOG_INFO("add_link sf=%u opt=%s type=%s ts=%u ch=%u addr=", - slotframe->handle, - print_link_options(link_options), - print_link_type(link_type), timeslot, channel_offset); - LOG_INFO_LLADDR(address); - LOG_INFO_("\n"); - /* Release the lock before we update the neighbor (will take the lock) */ - tsch_release_lock(); - - if(l->link_options & LINK_OPTION_TX) { - n = tsch_queue_add_nbr(&l->addr); - /* We have a tx link to this neighbor, update counters */ - if(n != NULL) { - n->tx_links_count++; - if(!(l->link_options & LINK_OPTION_SHARED)) { - n->dedicated_tx_links_count++; - } - } - } - } - } - } - return l; -} -/*---------------------------------------------------------------------------*/ -/* Removes a link from slotframe. Return 1 if success, 0 if failure */ -int -tsch_schedule_remove_link(struct tsch_slotframe *slotframe, struct tsch_link *l) -{ - if(slotframe != NULL && l != NULL && l->slotframe_handle == slotframe->handle) { - if(tsch_get_lock()) { - uint8_t link_options; - linkaddr_t addr; - - /* Save link option and addr in local variables as we need them - * after freeing the link */ - link_options = l->link_options; - linkaddr_copy(&addr, &l->addr); - - /* The link to be removed is scheduled as next, set it to NULL - * to abort the next link operation */ - if(l == current_link) { - current_link = NULL; - } - LOG_INFO("remove_link sf=%u opt=%s type=%s ts=%u ch=%u addr=", - slotframe->handle, - print_link_options(l->link_options), - print_link_type(l->link_type), l->timeslot, l->channel_offset); - LOG_INFO_LLADDR(&l->addr); - LOG_INFO_("\n"); - - list_remove(slotframe->links_list, l); - memb_free(&link_memb, l); - - /* Release the lock before we update the neighbor (will take the lock) */ - tsch_release_lock(); - - /* This was a tx link to this neighbor, update counters */ - if(link_options & LINK_OPTION_TX) { - struct tsch_neighbor *n = tsch_queue_add_nbr(&addr); - if(n != NULL) { - n->tx_links_count--; - if(!(link_options & LINK_OPTION_SHARED)) { - n->dedicated_tx_links_count--; - } - } - } - - return 1; - } else { - LOG_ERR("! remove_link memb_alloc couldn't take lock\n"); - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/* Removes a link from slotframe and timeslot. Return a 1 if success, 0 if failure */ -int -tsch_schedule_remove_link_by_timeslot(struct tsch_slotframe *slotframe, uint16_t timeslot) -{ - return slotframe != NULL && - tsch_schedule_remove_link(slotframe, tsch_schedule_get_link_by_timeslot(slotframe, timeslot)); -} -/*---------------------------------------------------------------------------*/ -/* Looks within a slotframe for a link with a given timeslot */ -struct tsch_link * -tsch_schedule_get_link_by_timeslot(struct tsch_slotframe *slotframe, uint16_t timeslot) -{ - if(!tsch_is_locked()) { - if(slotframe != NULL) { - struct tsch_link *l = list_head(slotframe->links_list); - /* Loop over all items. Assume there is max one link per timeslot */ - while(l != NULL) { - if(l->timeslot == timeslot) { - return l; - } - l = list_item_next(l); - } - return l; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/* Returns the next active link after a given ASN, and a backup link (for the same ASN, with Rx flag) */ -struct tsch_link * -tsch_schedule_get_next_active_link(struct tsch_asn_t *asn, uint16_t *time_offset, - struct tsch_link **backup_link) -{ - uint16_t time_to_curr_best = 0; - struct tsch_link *curr_best = NULL; - struct tsch_link *curr_backup = NULL; /* Keep a back link in case the current link - turns out useless when the time comes. For instance, for a Tx-only link, if there is - no outgoing packet in queue. In that case, run the backup link instead. The backup link - must have Rx flag set. */ - if(!tsch_is_locked()) { - struct tsch_slotframe *sf = list_head(slotframe_list); - /* For each slotframe, look for the earliest occurring link */ - while(sf != NULL) { - /* Get timeslot from ASN, given the slotframe length */ - uint16_t timeslot = TSCH_ASN_MOD(*asn, sf->size); - struct tsch_link *l = list_head(sf->links_list); - while(l != NULL) { - uint16_t time_to_timeslot = - l->timeslot > timeslot ? - l->timeslot - timeslot : - sf->size.val + l->timeslot - timeslot; - if(curr_best == NULL || time_to_timeslot < time_to_curr_best) { - time_to_curr_best = time_to_timeslot; - curr_best = l; - curr_backup = NULL; - } else if(time_to_timeslot == time_to_curr_best) { - struct tsch_link *new_best = NULL; - /* Two links are overlapping, we need to select one of them. - * By standard: prioritize Tx links first, second by lowest handle */ - if((curr_best->link_options & LINK_OPTION_TX) == (l->link_options & LINK_OPTION_TX)) { - /* Both or neither links have Tx, select the one with lowest handle */ - if(l->slotframe_handle < curr_best->slotframe_handle) { - new_best = l; - } - } else { - /* Select the link that has the Tx option */ - if(l->link_options & LINK_OPTION_TX) { - new_best = l; - } - } - - /* Maintain backup_link */ - if(curr_backup == NULL) { - /* Check if 'l' best can be used as backup */ - if(new_best != l && (l->link_options & LINK_OPTION_RX)) { /* Does 'l' have Rx flag? */ - curr_backup = l; - } - /* Check if curr_best can be used as backup */ - if(new_best != curr_best && (curr_best->link_options & LINK_OPTION_RX)) { /* Does curr_best have Rx flag? */ - curr_backup = curr_best; - } - } - - /* Maintain curr_best */ - if(new_best != NULL) { - curr_best = new_best; - } - } - - l = list_item_next(l); - } - sf = list_item_next(sf); - } - if(time_offset != NULL) { - *time_offset = time_to_curr_best; - } - } - if(backup_link != NULL) { - *backup_link = curr_backup; - } - return curr_best; -} -/*---------------------------------------------------------------------------*/ -/* Module initialization, call only once at startup. Returns 1 is success, 0 if failure. */ -int -tsch_schedule_init(void) -{ - if(tsch_get_lock()) { - memb_init(&link_memb); - memb_init(&slotframe_memb); - list_init(slotframe_list); - tsch_release_lock(); - return 1; - } else { - return 0; - } -} -/*---------------------------------------------------------------------------*/ -/* Create a 6TiSCH minimal schedule */ -void -tsch_schedule_create_minimal(void) -{ - struct tsch_slotframe *sf_min; - /* First, empty current schedule */ - tsch_schedule_remove_all_slotframes(); - /* Build 6TiSCH minimal schedule. - * We pick a slotframe length of TSCH_SCHEDULE_DEFAULT_LENGTH */ - sf_min = tsch_schedule_add_slotframe(0, TSCH_SCHEDULE_DEFAULT_LENGTH); - /* Add a single Tx|Rx|Shared slot using broadcast address (i.e. usable for unicast and broadcast). - * We set the link type to advertising, which is not compliant with 6TiSCH minimal schedule - * but is required according to 802.15.4e if also used for EB transmission. - * Timeslot: 0, channel offset: 0. */ - tsch_schedule_add_link(sf_min, - (LINK_OPTION_RX | LINK_OPTION_TX | LINK_OPTION_SHARED | LINK_OPTION_TIME_KEEPING), - LINK_TYPE_ADVERTISING, &tsch_broadcast_address, - 0, 0); -} -/*---------------------------------------------------------------------------*/ -struct tsch_slotframe * -tsch_schedule_slotframe_head(void) -{ - return list_head(slotframe_list); -} -/*---------------------------------------------------------------------------*/ -struct tsch_slotframe * -tsch_schedule_slotframe_next(struct tsch_slotframe *sf) -{ - return list_item_next(sf); -} -/*---------------------------------------------------------------------------*/ -/* Prints out the current schedule (all slotframes and links) */ -void -tsch_schedule_print(void) -{ - if(!tsch_is_locked()) { - struct tsch_slotframe *sf = list_head(slotframe_list); - - LOG_PRINT("----- start slotframe list -----\n"); - - while(sf != NULL) { - struct tsch_link *l = list_head(sf->links_list); - - LOG_PRINT("Slotframe Handle %u, size %u\n", sf->handle, sf->size.val); - - while(l != NULL) { - LOG_PRINT("* Link Options %02x, type %u, timeslot %u, channel offset %u, address %u\n", - l->link_options, l->link_type, l->timeslot, l->channel_offset, l->addr.u8[7]); - l = list_item_next(l); - } - - sf = list_item_next(sf); - } - - LOG_PRINT("----- end slotframe list -----\n"); - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/tsch-schedule.h b/os/net/mac/tsch/tsch-schedule.h deleted file mode 100644 index d98a744f3..000000000 --- a/os/net/mac/tsch/tsch-schedule.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup tsch - * @{ - * \file - * TSCH scheduling engine -*/ - -#ifndef __TSCH_SCHEDULE_H__ -#define __TSCH_SCHEDULE_H__ - -/********** Includes **********/ - -#include "contiki.h" -#include "net/linkaddr.h" - -/********** Functions *********/ - -/** - * \brief Module initialization, call only once at init - * \return 1 if success, 0 if failure - */ -int tsch_schedule_init(void); -/** - * \brief Create a 6tisch minimal schedule with length TSCH_SCHEDULE_DEFAULT_LENGTH - */ -void tsch_schedule_create_minimal(void); -/** - * \brief Prints out the current schedule (all slotframes and links) - */ -void tsch_schedule_print(void); - - -/** - * \brief Creates and adds a new slotframe - * \param handle the slotframe handle - * \param size the slotframe size - * \return the new slotframe, NULL if failure - */ -struct tsch_slotframe *tsch_schedule_add_slotframe(uint16_t handle, uint16_t size); - -/** - * \brief Looks up a slotframe by handle - * \param handle the slotframe handle - * \return the slotframe with required handle, if any. NULL otherwise. - */ -struct tsch_slotframe *tsch_schedule_get_slotframe_by_handle(uint16_t handle); - -/** - * \brief Removes a slotframe - * \param slotframe The slotframe to be removed - * \return 1 if success, 0 if failure - */ -int tsch_schedule_remove_slotframe(struct tsch_slotframe *slotframe); - -/** - * \brief Removes all slotframes, resulting in an empty schedule - * \return 1 if success, 0 if failure - */ -int tsch_schedule_remove_all_slotframes(void); - -/** - * \brief Adds a link to a slotframe - * \param slotframe The slotframe that will contain the new link - * \param link_options The link options, as a bitfield (LINK_OPTION_* flags) - * \param link_type The link type (advertising, normal) - * \param address The link address of the intended destination. Use &tsch_broadcast_address for a slot towards any neighbor - * \param timeslot The link timeslot within the slotframe - * \param channel_offset The link channel offset - * \return A pointer to the new link, NULL if failure - */ -struct tsch_link *tsch_schedule_add_link(struct tsch_slotframe *slotframe, - uint8_t link_options, enum link_type link_type, const linkaddr_t *address, - uint16_t timeslot, uint16_t channel_offset); -/** -* \brief Looks for a link from a handle -* \param handle The target handle -* \return The link with required handle, if any. Otherwise, NULL -*/ -struct tsch_link *tsch_schedule_get_link_by_handle(uint16_t handle); - -/** - * \brief Looks within a slotframe for a link with a given timeslot - * \param slotframe The desired slotframe - * \param timeslot The desired timeslot - * \return The link if found, NULL otherwise - */ -struct tsch_link *tsch_schedule_get_link_by_timeslot(struct tsch_slotframe *slotframe, uint16_t timeslot); - -/** - * \brief Removes a link - * \param slotframe The slotframe the link belongs to - * \param l The link to be removed - * \return 1 if success, 0 if failure - */ -int tsch_schedule_remove_link(struct tsch_slotframe *slotframe, struct tsch_link *l); - -/** - * \brief Removes a link from a slotframe and timeslot - * \param slotframe The slotframe where to look for the link - * \param timeslot The timeslot where to look for the link within the target slotframe - * \return 1 if success, 0 if failure - */ -int tsch_schedule_remove_link_by_timeslot(struct tsch_slotframe *slotframe, uint16_t timeslot); - - -/** - * \brief Returns the next active link after a given ASN, and a backup link (for the same ASN, with Rx flag) - * \param asn The base ASN, from which we look for the next active link - * \param time_offset A pointer to uint16_t where to store the time offset between base ASN and link found - * \param backup_link A pointer where to write the address of a backup link, to be executed should the original be no longer active at wakeup - * \return The next active link if any, NULL otherwise - */ -struct tsch_link * tsch_schedule_get_next_active_link(struct tsch_asn_t *asn, uint16_t *time_offset, - struct tsch_link **backup_link); - -/** - * \brief Access the first item in the list of slotframes - * \return The first slotframe in the schedule if any, NULL otherwise - */ -struct tsch_slotframe *tsch_schedule_slotframe_head(void); - -/** - * \brief Access the next item in the list of slotframes - * \param sf The current slotframe (item in the list) - * \return The next slotframe if any, NULL otherwise - */ -struct tsch_slotframe *tsch_schedule_slotframe_next(struct tsch_slotframe *sf); - -#endif /* __TSCH_SCHEDULE_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-security.c b/os/net/mac/tsch/tsch-security.c deleted file mode 100644 index 12f0de6d5..000000000 --- a/os/net/mac/tsch/tsch-security.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * TSCH security - * \author - * Simon Duquennoy - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#include "contiki.h" -#include "net/mac/tsch/tsch.h" -#include "net/mac/framer/frame802154.h" -#include "net/mac/framer/framer-802154.h" -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "lib/ccm-star.h" -#include "lib/aes-128.h" -#include -#include - -#if LLSEC802154_ENABLED && !LLSEC802154_USES_EXPLICIT_KEYS -#error LLSEC802154_ENABLED set but LLSEC802154_USES_EXPLICIT_KEYS unset -#endif /* LLSEC802154_ENABLED */ - -/* The two keys K1 and K2 from 6TiSCH minimal configuration - * K1: well-known, used for EBs - * K2: secret, used for data and ACK - * */ -static aes_key keys[] = { - TSCH_SECURITY_K1, - TSCH_SECURITY_K2 -}; -#define N_KEYS (sizeof(keys) / sizeof(aes_key)) - -/*---------------------------------------------------------------------------*/ -static void -tsch_security_init_nonce(uint8_t *nonce, - const linkaddr_t *sender, struct tsch_asn_t *asn) -{ - memcpy(nonce, sender, 8); - nonce[8] = asn->ms1b; - nonce[9] = (asn->ls4b >> 24) & 0xff; - nonce[10] = (asn->ls4b >> 16) & 0xff; - nonce[11] = (asn->ls4b >> 8) & 0xff; - nonce[12] = (asn->ls4b) & 0xff; -} -/*---------------------------------------------------------------------------*/ -static int -tsch_security_check_level(const frame802154_t *frame) -{ - uint8_t required_security_level; - uint8_t required_key_index; - - /* Sanity check */ - if(frame == NULL) { - return 0; - } - - /* Non-secured frame, ok iff we are not in a secured PAN - * (i.e. scanning or associated to a non-secured PAN) */ - if(frame->fcf.security_enabled == 0) { - return !(tsch_is_associated == 1 && tsch_is_pan_secured == 1); - } - - /* The frame is secured, that we are not in an unsecured PAN */ - if(tsch_is_associated == 1 && tsch_is_pan_secured == 0) { - return 0; - } - - /* The frame is secured, check its security level */ - switch(frame->fcf.frame_type) { - case FRAME802154_BEACONFRAME: - required_security_level = TSCH_SECURITY_KEY_SEC_LEVEL_EB; - required_key_index = TSCH_SECURITY_KEY_INDEX_EB; - break; - case FRAME802154_ACKFRAME: - required_security_level = TSCH_SECURITY_KEY_SEC_LEVEL_ACK; - required_key_index = TSCH_SECURITY_KEY_INDEX_ACK; - break; - default: - required_security_level = TSCH_SECURITY_KEY_SEC_LEVEL_OTHER; - required_key_index = TSCH_SECURITY_KEY_INDEX_OTHER; - break; - } - return ((frame->aux_hdr.security_control.security_level == - required_security_level) && - frame->aux_hdr.key_index == required_key_index); -} -/*---------------------------------------------------------------------------*/ -unsigned int -tsch_security_mic_len(const frame802154_t *frame) -{ - if(frame != NULL && frame->fcf.security_enabled) { - return 2 << (frame->aux_hdr.security_control.security_level & 0x03); - } else { - return 0; - } -} -/*---------------------------------------------------------------------------*/ -unsigned int -tsch_security_secure_frame(uint8_t *hdr, uint8_t *outbuf, - int hdrlen, int datalen, struct tsch_asn_t *asn) -{ - frame802154_t frame; - uint8_t key_index = 0; - uint8_t security_level = 0; - uint8_t with_encryption; - uint8_t mic_len; - uint8_t nonce[16]; - struct ieee802154_ies ies; - - uint8_t a_len; - uint8_t m_len; - - if(hdr == NULL || outbuf == NULL || hdrlen < 0 || datalen < 0) { - return 0; - } - - /* Parse the frame header to extract security settings */ - if(frame802154_parse(hdr, hdrlen + datalen, &frame) < 3) { - return 0; - } - - memset(&ies, 0, sizeof(ies)); - if(frame802154e_parse_information_elements(hdr + hdrlen, datalen, &ies) > 0) { - /* put Header IEs into the header part which is not encrypted */ - hdrlen += ies.ie_payload_ie_offset; - datalen -= ies.ie_payload_ie_offset; - } - - if(!frame.fcf.security_enabled) { - /* Security is not enabled for this frame, we're done */ - return 0; - } - - /* Read security key index */ - key_index = frame.aux_hdr.key_index; - security_level = frame.aux_hdr.security_control.security_level; - with_encryption = (security_level & 0x4) ? 1 : 0; - mic_len = tsch_security_mic_len(&frame); - - if(key_index == 0 || key_index > N_KEYS) { - return 0; - } - - tsch_security_init_nonce(nonce, &linkaddr_node_addr, asn); - - if(with_encryption) { - a_len = hdrlen; - m_len = datalen; - } else { - a_len = hdrlen + datalen; - m_len = 0; - } - - /* Copy source data to output */ - if(hdr != outbuf) { - memcpy(outbuf, hdr, a_len + m_len); - } - - CCM_STAR.set_key(keys[key_index - 1]); - - CCM_STAR.aead(nonce, - outbuf + a_len, m_len, - outbuf, a_len, - outbuf + hdrlen + datalen, mic_len, 1); - - return mic_len; -} -/*---------------------------------------------------------------------------*/ -unsigned int -tsch_security_parse_frame(const uint8_t *hdr, int hdrlen, int datalen, - const frame802154_t *frame, const linkaddr_t *sender, - struct tsch_asn_t *asn) -{ - uint8_t generated_mic[16]; - uint8_t key_index = 0; - uint8_t security_level = 0; - uint8_t with_encryption; - uint8_t mic_len; - uint8_t nonce[16]; - uint8_t a_len; - uint8_t m_len; - struct ieee802154_ies ies; - - if(frame == NULL || hdr == NULL || hdrlen < 0 || datalen < 0) { - return 0; - } - - if(!tsch_security_check_level(frame)) { - /* Wrong security level */ - return 0; - } - - /* No security: nothing more to check */ - if(!frame->fcf.security_enabled) { - return 1; - } - - key_index = frame->aux_hdr.key_index; - security_level = frame->aux_hdr.security_control.security_level; - with_encryption = (security_level & 0x4) ? 1 : 0; - mic_len = tsch_security_mic_len(frame); - - /* Check if key_index is in supported range */ - if(key_index == 0 || key_index > N_KEYS) { - return 0; - } - - memset(&ies, 0, sizeof(ies)); - (void)frame802154e_parse_information_elements(hdr + hdrlen, datalen, &ies); - /* put Header IEs into the header part which is not encrypted */ - hdrlen += ies.ie_payload_ie_offset; - datalen -= ies.ie_payload_ie_offset; - - tsch_security_init_nonce(nonce, sender, asn); - - if(with_encryption) { - a_len = hdrlen; - m_len = datalen; - } else { - a_len = hdrlen + datalen; - m_len = 0; - } - - CCM_STAR.set_key(keys[key_index - 1]); - - CCM_STAR.aead(nonce, - (uint8_t *)hdr + a_len, m_len, - (uint8_t *)hdr, a_len, - generated_mic, mic_len, 0); - - if(mic_len > 0 && memcmp(generated_mic, hdr + hdrlen + datalen, mic_len) != 0) { - return 0; - } else { - return 1; - } -} -/** @} */ diff --git a/os/net/mac/tsch/tsch-security.h b/os/net/mac/tsch/tsch-security.h deleted file mode 100644 index 4320d3a70..000000000 --- a/os/net/mac/tsch/tsch-security.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2014, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup tsch - * @{ - * \file - * TSCH security -*/ - -#ifndef __TSCH_SECURITY_H__ -#define __TSCH_SECURITY_H__ - -/********** Includes **********/ - -#include "contiki.h" -#include "net/mac/framer/frame802154.h" -#include "net/mac/framer/frame802154e-ie.h" -#include "net/mac/llsec802154.h" - -/********** Configurarion *********/ - -/* To enable TSCH security: -* - set LLSEC802154_CONF_ENABLED -* - set LLSEC802154_CONF_USES_EXPLICIT_KEYS -* */ - -/* K1, defined in 6TiSCH minimal, is well-known (offers no security) and used for EBs only */ -#ifdef TSCH_SECURITY_CONF_K1 -#define TSCH_SECURITY_K1 TSCH_SECURITY_CONF_K1 -#else /* TSCH_SECURITY_CONF_K1 */ -#define TSCH_SECURITY_K1 { 0x36, 0x54, 0x69, 0x53, 0x43, 0x48, 0x20, 0x6D, 0x69, 0x6E, 0x69, 0x6D, 0x61, 0x6C, 0x31, 0x35 } -#endif /* TSCH_SECURITY_CONF_K1 */ - -/* K2, defined in 6TiSCH minimal, is used for all but EB traffic */ -#ifdef TSCH_SECURITY_CONF_K2 -#define TSCH_SECURITY_K2 TSCH_SECURITY_CONF_K2 -#else /* TSCH_SECURITY_CONF_K2 */ -#define TSCH_SECURITY_K2 { 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xca, 0xfe, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xca, 0xfe } -#endif /* TSCH_SECURITY_CONF_K2 */ - -/* Key used for EBs */ -#ifdef TSCH_SECURITY_CONF_KEY_INDEX_EB -#define TSCH_SECURITY_KEY_INDEX_EB TSCH_SECURITY_CONF_KEY_INDEX_EB -#else -#define TSCH_SECURITY_KEY_INDEX_EB 1 /* Use K1 as per 6TiSCH minimal */ -#endif - -/* Security level for EBs */ -#ifdef TSCH_SECURITY_CONF_SEC_LEVEL_EB -#define TSCH_SECURITY_KEY_SEC_LEVEL_EB TSCH_SECURITY_CONF_SEC_LEVEL_EB -#else -#define TSCH_SECURITY_KEY_SEC_LEVEL_EB 1 /* MIC-32, as per 6TiSCH minimal */ -#endif - -/* Key used for ACK */ -#ifdef TSCH_SECURITY_CONF_KEY_INDEX_ACK -#define TSCH_SECURITY_KEY_INDEX_ACK TSCH_SECURITY_CONF_KEY_INDEX_ACK -#else -#define TSCH_SECURITY_KEY_INDEX_ACK 2 /* Use K2 as per 6TiSCH minimal */ -#endif - -/* Security level for ACKs */ -#ifdef TSCH_SECURITY_CONF_SEC_LEVEL_ACK -#define TSCH_SECURITY_KEY_SEC_LEVEL_ACK TSCH_SECURITY_CONF_SEC_LEVEL_ACK -#else -#define TSCH_SECURITY_KEY_SEC_LEVEL_ACK 5 /* Encryption + MIC-32, as per 6TiSCH minimal */ -#endif - -/* Key used for Other (Data, Cmd) */ -#ifdef TSCH_SECURITY_CONF_KEY_INDEX_OTHER -#define TSCH_SECURITY_KEY_INDEX_OTHER TSCH_SECURITY_CONF_KEY_INDEX_OTHER -#else -#define TSCH_SECURITY_KEY_INDEX_OTHER 2 /* Use K2 as per 6TiSCH minimal */ -#endif - -/* Security level for Other (Data, Cmd) */ -#ifdef TSCH_SECURITY_CONF_SEC_LEVEL_OTHER -#define TSCH_SECURITY_KEY_SEC_LEVEL_OTHER TSCH_SECURITY_CONF_SEC_LEVEL_OTHER -#else -#define TSCH_SECURITY_KEY_SEC_LEVEL_OTHER 5 /* Encryption + MIC-32, as per 6TiSCH minimal */ -#endif - -/********** Data types *********/ - -/* AES-128 key */ -typedef uint8_t aes_key[16]; - -/********** Functions *********/ -/** - * \brief Return MIC length - * \return The length of MIC (>= 0) - */ -unsigned int tsch_security_mic_len(const frame802154_t *frame); - -/** - * \brief Protect a frame with encryption and/or MIC - * \return The length of a generated MIC (>= 0) - */ -unsigned int tsch_security_secure_frame(uint8_t *hdr, uint8_t *outbuf, - int hdrlen, int datalen, - struct tsch_asn_t *asn); - -/** - * \brief Parse and check a frame protected with encryption and/or MIC - * \retval 0 On error or security check failure (insecure frame) - * \retval 1 On success or no need for security check (good frame) - */ -unsigned int tsch_security_parse_frame(const uint8_t *hdr, int hdrlen, - int datalen, const frame802154_t *frame, - const linkaddr_t *sender, - struct tsch_asn_t *asn); - -#endif /* __TSCH_SECURITY_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-slot-operation.c b/os/net/mac/tsch/tsch-slot-operation.c deleted file mode 100644 index 3f5d329a8..000000000 --- a/os/net/mac/tsch/tsch-slot-operation.c +++ /dev/null @@ -1,1169 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * TSCH slot operation implementation, running from interrupt. - * \author - * Simon Duquennoy - * Beshr Al Nahas - * Atis Elsts - * - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#include "dev/radio.h" -#include "contiki.h" -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "net/queuebuf.h" -#include "net/mac/framer/framer-802154.h" -#include "net/mac/tsch/tsch.h" -#include "sys/critical.h" - -#include "sys/log.h" -/* TSCH debug macros, i.e. to set LEDs or GPIOs on various TSCH - * timeslot events */ -#ifndef TSCH_DEBUG_INIT -#define TSCH_DEBUG_INIT() -#endif -#ifndef TSCH_DEBUG_INTERRUPT -#define TSCH_DEBUG_INTERRUPT() -#endif -#ifndef TSCH_DEBUG_RX_EVENT -#define TSCH_DEBUG_RX_EVENT() -#endif -#ifndef TSCH_DEBUG_TX_EVENT -#define TSCH_DEBUG_TX_EVENT() -#endif -#ifndef TSCH_DEBUG_SLOT_START -#define TSCH_DEBUG_SLOT_START() -#endif -#ifndef TSCH_DEBUG_SLOT_END -#define TSCH_DEBUG_SLOT_END() -#endif - -/* Check if TSCH_MAX_INCOMING_PACKETS is power of two */ -#if (TSCH_MAX_INCOMING_PACKETS & (TSCH_MAX_INCOMING_PACKETS - 1)) != 0 -#error TSCH_MAX_INCOMING_PACKETS must be power of two -#endif - -/* Check if TSCH_DEQUEUED_ARRAY_SIZE is power of two and greater or equal to QUEUEBUF_NUM */ -#if TSCH_DEQUEUED_ARRAY_SIZE < QUEUEBUF_NUM -#error TSCH_DEQUEUED_ARRAY_SIZE must be greater or equal to QUEUEBUF_NUM -#endif -#if (TSCH_DEQUEUED_ARRAY_SIZE & (TSCH_DEQUEUED_ARRAY_SIZE - 1)) != 0 -#error TSCH_DEQUEUED_ARRAY_SIZE must be power of two -#endif - -/* Truncate received drift correction information to maximum half - * of the guard time (one fourth of TSCH_DEFAULT_TS_RX_WAIT) */ -#define SYNC_IE_BOUND ((int32_t)US_TO_RTIMERTICKS(tsch_timing_us[tsch_ts_rx_wait] / 4)) - -/* By default: check that rtimer runs at >=32kHz and use a guard time of 10us */ -#if RTIMER_SECOND < (32 * 1024) -#error "TSCH: RTIMER_SECOND < (32 * 1024)" -#endif -#if CONTIKI_TARGET_COOJA -/* Use 0 usec guard time for Cooja Mote with a 1 MHz Rtimer*/ -#define RTIMER_GUARD 0u -#elif RTIMER_SECOND >= 200000 -#define RTIMER_GUARD (RTIMER_SECOND / 100000) -#else -#define RTIMER_GUARD 2u -#endif - -enum tsch_radio_state_on_cmd { - TSCH_RADIO_CMD_ON_START_OF_TIMESLOT, - TSCH_RADIO_CMD_ON_WITHIN_TIMESLOT, - TSCH_RADIO_CMD_ON_FORCE, -}; - -enum tsch_radio_state_off_cmd { - TSCH_RADIO_CMD_OFF_END_OF_TIMESLOT, - TSCH_RADIO_CMD_OFF_WITHIN_TIMESLOT, - TSCH_RADIO_CMD_OFF_FORCE, -}; - -/* A ringbuf storing outgoing packets after they were dequeued. - * Will be processed layer by tsch_tx_process_pending */ -struct ringbufindex dequeued_ringbuf; -struct tsch_packet *dequeued_array[TSCH_DEQUEUED_ARRAY_SIZE]; -/* A ringbuf storing incoming packets. - * Will be processed layer by tsch_rx_process_pending */ -struct ringbufindex input_ringbuf; -struct input_packet input_array[TSCH_MAX_INCOMING_PACKETS]; - -/* Updates and reads of the next two variables must be atomic (i.e. both together) */ -/* Last time we received Sync-IE (ACK or data packet from a time source) */ -static struct tsch_asn_t last_sync_asn; -clock_time_t tsch_last_sync_time; /* Same info, in clock_time_t units */ - -/* A global lock for manipulating data structures safely from outside of interrupt */ -static volatile int tsch_locked = 0; -/* As long as this is set, skip all slot operation */ -static volatile int tsch_lock_requested = 0; - -/* Last estimated drift in RTIMER ticks - * (Sky: 1 tick = 30.517578125 usec exactly) */ -static int32_t drift_correction = 0; -/* Is drift correction used? (Can be true even if drift_correction == 0) */ -static uint8_t is_drift_correction_used; - -/* The neighbor last used as our time source */ -struct tsch_neighbor *last_timesource_neighbor = NULL; - -/* Used from tsch_slot_operation and sub-protothreads */ -static rtimer_clock_t volatile current_slot_start; - -/* Are we currently inside a slot? */ -static volatile int tsch_in_slot_operation = 0; - -/* If we are inside a slot, this tells the current channel */ -uint8_t tsch_current_channel; - -/* Info about the link, packet and neighbor of - * the current (or next) slot */ -struct tsch_link *current_link = NULL; -/* A backup link with Rx flag, overlapping with current_link. - * If the current link is Tx-only and the Tx queue - * is empty while executing the link, fallback to the backup link. */ -static struct tsch_link *backup_link = NULL; -static struct tsch_packet *current_packet = NULL; -static struct tsch_neighbor *current_neighbor = NULL; - -/* Indicates whether an extra link is needed to handle the current burst */ -static int burst_link_scheduled = 0; -/* Counts the length of the current burst */ -int tsch_current_burst_count = 0; - -/* Protothread for association */ -PT_THREAD(tsch_scan(struct pt *pt)); -/* Protothread for slot operation, called from rtimer interrupt - * and scheduled from tsch_schedule_slot_operation */ -static PT_THREAD(tsch_slot_operation(struct rtimer *t, void *ptr)); -static struct pt slot_operation_pt; -/* Sub-protothreads of tsch_slot_operation */ -static PT_THREAD(tsch_tx_slot(struct pt *pt, struct rtimer *t)); -static PT_THREAD(tsch_rx_slot(struct pt *pt, struct rtimer *t)); - -/*---------------------------------------------------------------------------*/ -/* TSCH locking system. TSCH is locked during slot operations */ - -/* Is TSCH locked? */ -int -tsch_is_locked(void) -{ - return tsch_locked; -} - -/* Lock TSCH (no slot operation) */ -int -tsch_get_lock(void) -{ - if(!tsch_locked) { - rtimer_clock_t busy_wait_time; - int busy_wait = 0; /* Flag used for logging purposes */ - /* Make sure no new slot operation will start */ - tsch_lock_requested = 1; - /* Wait for the end of current slot operation. */ - if(tsch_in_slot_operation) { - busy_wait = 1; - busy_wait_time = RTIMER_NOW(); - while(tsch_in_slot_operation) { - watchdog_periodic(); - } - busy_wait_time = RTIMER_NOW() - busy_wait_time; - } - if(!tsch_locked) { - /* Take the lock if it is free */ - tsch_locked = 1; - tsch_lock_requested = 0; - if(busy_wait) { - /* Issue a log whenever we had to busy wait until getting the lock */ - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!get lock delay %u", (unsigned)busy_wait_time); - ); - } - return 1; - } - } - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!failed to lock"); - ); - return 0; -} - -/* Release TSCH lock */ -void -tsch_release_lock(void) -{ - tsch_locked = 0; -} - -/*---------------------------------------------------------------------------*/ -/* Channel hopping utility functions */ - -/* Return channel from ASN and channel offset */ -uint8_t -tsch_calculate_channel(struct tsch_asn_t *asn, uint8_t channel_offset) -{ - uint16_t index_of_0 = TSCH_ASN_MOD(*asn, tsch_hopping_sequence_length); - uint16_t index_of_offset = (index_of_0 + channel_offset) % tsch_hopping_sequence_length.val; - return tsch_hopping_sequence[index_of_offset]; -} - -/*---------------------------------------------------------------------------*/ -/* Timing utility functions */ - -/* Checks if the current time has passed a ref time + offset. Assumes - * a single overflow and ref time prior to now. */ -static uint8_t -check_timer_miss(rtimer_clock_t ref_time, rtimer_clock_t offset, rtimer_clock_t now) -{ - rtimer_clock_t target = ref_time + offset; - int now_has_overflowed = now < ref_time; - int target_has_overflowed = target < ref_time; - - if(now_has_overflowed == target_has_overflowed) { - /* Both or none have overflowed, just compare now to the target */ - return target <= now; - } else { - /* Either now or target of overflowed. - * If it is now, then it has passed the target. - * If it is target, then we haven't reached it yet. - * */ - return now_has_overflowed; - } -} -/*---------------------------------------------------------------------------*/ -/* Schedule a wakeup at a specified offset from a reference time. - * Provides basic protection against missed deadlines and timer overflows - * A return value of zero signals a missed deadline: no rtimer was scheduled. */ -static uint8_t -tsch_schedule_slot_operation(struct rtimer *tm, rtimer_clock_t ref_time, rtimer_clock_t offset, const char *str) -{ - rtimer_clock_t now = RTIMER_NOW(); - int r; - /* Subtract RTIMER_GUARD before checking for deadline miss - * because we can not schedule rtimer less than RTIMER_GUARD in the future */ - int missed = check_timer_miss(ref_time, offset - RTIMER_GUARD, now); - - if(missed) { - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!dl-miss %s %d %d", - str, (int)(now-ref_time), (int)offset); - ); - } else { - r = rtimer_set(tm, ref_time + offset, 1, (void (*)(struct rtimer *, void *))tsch_slot_operation, NULL); - if(r == RTIMER_OK) { - return 1; - } - } - - /* block until the time to schedule comes */ - RTIMER_BUSYWAIT_UNTIL_ABS(0, ref_time, offset); - return 0; -} -/*---------------------------------------------------------------------------*/ -/* Schedule slot operation conditionally, and YIELD if success only. - * Always attempt to schedule RTIMER_GUARD before the target to make sure to wake up - * ahead of time and then busy wait to exactly hit the target. */ -#define TSCH_SCHEDULE_AND_YIELD(pt, tm, ref_time, offset, str) \ - do { \ - if(tsch_schedule_slot_operation(tm, ref_time, offset - RTIMER_GUARD, str)) { \ - PT_YIELD(pt); \ - RTIMER_BUSYWAIT_UNTIL_ABS(0, ref_time, offset); \ - } \ - } while(0); -/*---------------------------------------------------------------------------*/ -/* Get EB, broadcast or unicast packet to be sent, and target neighbor. */ -static struct tsch_packet * -get_packet_and_neighbor_for_link(struct tsch_link *link, struct tsch_neighbor **target_neighbor) -{ - struct tsch_packet *p = NULL; - struct tsch_neighbor *n = NULL; - - /* Is this a Tx link? */ - if(link->link_options & LINK_OPTION_TX) { - /* is it for advertisement of EB? */ - if(link->link_type == LINK_TYPE_ADVERTISING || link->link_type == LINK_TYPE_ADVERTISING_ONLY) { - /* fetch EB packets */ - n = n_eb; - p = tsch_queue_get_packet_for_nbr(n, link); - } - if(link->link_type != LINK_TYPE_ADVERTISING_ONLY) { - /* NORMAL link or no EB to send, pick a data packet */ - if(p == NULL) { - /* Get neighbor queue associated to the link and get packet from it */ - n = tsch_queue_get_nbr(&link->addr); - p = tsch_queue_get_packet_for_nbr(n, link); - /* if it is a broadcast slot and there were no broadcast packets, pick any unicast packet */ - if(p == NULL && n == n_broadcast) { - p = tsch_queue_get_unicast_packet_for_any(&n, link); - } - } - } - } - /* return nbr (by reference) */ - if(target_neighbor != NULL) { - *target_neighbor = n; - } - - return p; -} -/*---------------------------------------------------------------------------*/ -uint64_t -tsch_get_network_uptime_ticks(void) -{ - uint64_t uptime_asn; - uint64_t uptime_ticks; - int_master_status_t status; - - if(!tsch_is_associated) { - /* not associated, network uptime is not known */ - return (uint64_t)-1; - } - - status = critical_enter(); - - uptime_asn = last_sync_asn.ls4b + ((uint64_t)last_sync_asn.ms1b << 32); - /* first calculate the at the uptime at the last sync in rtimer ticks */ - uptime_ticks = uptime_asn * tsch_timing[tsch_ts_timeslot_length]; - /* then convert to clock ticks (assume that CLOCK_SECOND divides RTIMER_ARCH_SECOND) */ - uptime_ticks /= (RTIMER_ARCH_SECOND / CLOCK_SECOND); - /* then add the ticks passed since the last timesync */ - uptime_ticks += (clock_time() - tsch_last_sync_time); - - critical_exit(status); - - return uptime_ticks; -} -/*---------------------------------------------------------------------------*/ -/** - * This function turns on the radio. Its semantics is dependent on - * the value of TSCH_RADIO_ON_DURING_TIMESLOT constant: - * - if enabled, the radio is turned on at the start of the slot - * - if disabled, the radio is turned on within the slot, - * directly before the packet Rx guard time and ACK Rx guard time. - */ -static void -tsch_radio_on(enum tsch_radio_state_on_cmd command) -{ - int do_it = 0; - switch(command) { - case TSCH_RADIO_CMD_ON_START_OF_TIMESLOT: - if(TSCH_RADIO_ON_DURING_TIMESLOT) { - do_it = 1; - } - break; - case TSCH_RADIO_CMD_ON_WITHIN_TIMESLOT: - if(!TSCH_RADIO_ON_DURING_TIMESLOT) { - do_it = 1; - } - break; - case TSCH_RADIO_CMD_ON_FORCE: - do_it = 1; - break; - } - if(do_it) { - NETSTACK_RADIO.on(); - } -} -/*---------------------------------------------------------------------------*/ -/** - * This function turns off the radio. In the same way as for tsch_radio_on(), - * it depends on the value of TSCH_RADIO_ON_DURING_TIMESLOT constant: - * - if enabled, the radio is turned off at the end of the slot - * - if disabled, the radio is turned off within the slot, - * directly after Tx'ing or Rx'ing a packet or Tx'ing an ACK. - */ -static void -tsch_radio_off(enum tsch_radio_state_off_cmd command) -{ - int do_it = 0; - switch(command) { - case TSCH_RADIO_CMD_OFF_END_OF_TIMESLOT: - if(TSCH_RADIO_ON_DURING_TIMESLOT) { - do_it = 1; - } - break; - case TSCH_RADIO_CMD_OFF_WITHIN_TIMESLOT: - if(!TSCH_RADIO_ON_DURING_TIMESLOT) { - do_it = 1; - } - break; - case TSCH_RADIO_CMD_OFF_FORCE: - do_it = 1; - break; - } - if(do_it) { - NETSTACK_RADIO.off(); - } -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(tsch_tx_slot(struct pt *pt, struct rtimer *t)) -{ - /** - * TX slot: - * 1. Copy packet to radio buffer - * 2. Perform CCA if enabled - * 3. Sleep until it is time to transmit - * 4. Wait for ACK if it is a unicast packet - * 5. Extract drift if we received an E-ACK from a time source neighbor - * 6. Update CSMA parameters according to TX status - * 7. Schedule mac_call_sent_callback - **/ - - /* tx status */ - static uint8_t mac_tx_status; - /* is the packet in its neighbor's queue? */ - uint8_t in_queue; - static int dequeued_index; - static int packet_ready = 1; - - PT_BEGIN(pt); - - TSCH_DEBUG_TX_EVENT(); - - /* First check if we have space to store a newly dequeued packet (in case of - * successful Tx or Drop) */ - dequeued_index = ringbufindex_peek_put(&dequeued_ringbuf); - if(dequeued_index != -1) { - if(current_packet == NULL || current_packet->qb == NULL) { - mac_tx_status = MAC_TX_ERR_FATAL; - } else { - /* packet payload */ - static void *packet; -#if LLSEC802154_ENABLED - /* encrypted payload */ - static uint8_t encrypted_packet[TSCH_PACKET_MAX_LEN]; -#endif /* LLSEC802154_ENABLED */ - /* packet payload length */ - static uint8_t packet_len; - /* packet seqno */ - static uint8_t seqno; - /* is this a broadcast packet? (wait for ack?) */ - static uint8_t is_broadcast; - static rtimer_clock_t tx_start_time; - /* Did we set the frame pending bit to request an extra burst link? */ - static int burst_link_requested; - -#if TSCH_CCA_ENABLED - static uint8_t cca_status; -#endif /* TSCH_CCA_ENABLED */ - - /* get payload */ - packet = queuebuf_dataptr(current_packet->qb); - packet_len = queuebuf_datalen(current_packet->qb); - /* is this a broadcast packet? (wait for ack?) */ - is_broadcast = current_neighbor->is_broadcast; - /* Unicast. More packets in queue for the neighbor? */ - burst_link_requested = 0; - if(!is_broadcast - && tsch_current_burst_count + 1 < TSCH_BURST_MAX_LEN - && tsch_queue_packet_count(¤t_neighbor->addr) > 1) { - burst_link_requested = 1; - tsch_packet_set_frame_pending(packet, packet_len); - } - /* read seqno from payload */ - seqno = ((uint8_t *)(packet))[2]; - /* if this is an EB, then update its Sync-IE */ - if(current_neighbor == n_eb) { - packet_ready = tsch_packet_update_eb(packet, packet_len, current_packet->tsch_sync_ie_offset); - } else { - packet_ready = 1; - } - -#if LLSEC802154_ENABLED - if(tsch_is_pan_secured) { - /* If we are going to encrypt, we need to generate the output in a separate buffer and keep - * the original untouched. This is to allow for future retransmissions. */ - int with_encryption = queuebuf_attr(current_packet->qb, PACKETBUF_ATTR_SECURITY_LEVEL) & 0x4; - packet_len += tsch_security_secure_frame(packet, with_encryption ? encrypted_packet : packet, current_packet->header_len, - packet_len - current_packet->header_len, &tsch_current_asn); - if(with_encryption) { - packet = encrypted_packet; - } - } -#endif /* LLSEC802154_ENABLED */ - - /* prepare packet to send: copy to radio buffer */ - if(packet_ready && NETSTACK_RADIO.prepare(packet, packet_len) == 0) { /* 0 means success */ - static rtimer_clock_t tx_duration; - -#if TSCH_CCA_ENABLED - cca_status = 1; - /* delay before CCA */ - TSCH_SCHEDULE_AND_YIELD(pt, t, current_slot_start, tsch_timing[tsch_ts_cca_offset], "cca"); - TSCH_DEBUG_TX_EVENT(); - tsch_radio_on(TSCH_RADIO_CMD_ON_WITHIN_TIMESLOT); - /* CCA */ - RTIMER_BUSYWAIT_UNTIL_ABS(!(cca_status &= NETSTACK_RADIO.channel_clear()), - current_slot_start, tsch_timing[tsch_ts_cca_offset] + tsch_timing[tsch_ts_cca]); - TSCH_DEBUG_TX_EVENT(); - /* there is not enough time to turn radio off */ - /* NETSTACK_RADIO.off(); */ - if(cca_status == 0) { - mac_tx_status = MAC_TX_COLLISION; - } else -#endif /* TSCH_CCA_ENABLED */ - { - /* delay before TX */ - TSCH_SCHEDULE_AND_YIELD(pt, t, current_slot_start, tsch_timing[tsch_ts_tx_offset] - RADIO_DELAY_BEFORE_TX, "TxBeforeTx"); - TSCH_DEBUG_TX_EVENT(); - /* send packet already in radio tx buffer */ - mac_tx_status = NETSTACK_RADIO.transmit(packet_len); - tx_count++; - /* Save tx timestamp */ - tx_start_time = current_slot_start + tsch_timing[tsch_ts_tx_offset]; - /* calculate TX duration based on sent packet len */ - tx_duration = TSCH_PACKET_DURATION(packet_len); - /* limit tx_time to its max value */ - tx_duration = MIN(tx_duration, tsch_timing[tsch_ts_max_tx]); - /* turn tadio off -- will turn on again to wait for ACK if needed */ - tsch_radio_off(TSCH_RADIO_CMD_OFF_WITHIN_TIMESLOT); - - if(mac_tx_status == RADIO_TX_OK) { - if(!is_broadcast) { - uint8_t ackbuf[TSCH_PACKET_MAX_LEN]; - int ack_len; - rtimer_clock_t ack_start_time; - int is_time_source; - struct ieee802154_ies ack_ies; - uint8_t ack_hdrlen; - frame802154_t frame; - -#if TSCH_HW_FRAME_FILTERING - radio_value_t radio_rx_mode; - /* Entering promiscuous mode so that the radio accepts the enhanced ACK */ - NETSTACK_RADIO.get_value(RADIO_PARAM_RX_MODE, &radio_rx_mode); - NETSTACK_RADIO.set_value(RADIO_PARAM_RX_MODE, radio_rx_mode & (~RADIO_RX_MODE_ADDRESS_FILTER)); -#endif /* TSCH_HW_FRAME_FILTERING */ - /* Unicast: wait for ack after tx: sleep until ack time */ - TSCH_SCHEDULE_AND_YIELD(pt, t, current_slot_start, - tsch_timing[tsch_ts_tx_offset] + tx_duration + tsch_timing[tsch_ts_rx_ack_delay] - RADIO_DELAY_BEFORE_RX, "TxBeforeAck"); - TSCH_DEBUG_TX_EVENT(); - tsch_radio_on(TSCH_RADIO_CMD_ON_WITHIN_TIMESLOT); - /* Wait for ACK to come */ - RTIMER_BUSYWAIT_UNTIL_ABS(NETSTACK_RADIO.receiving_packet(), - tx_start_time, tx_duration + tsch_timing[tsch_ts_rx_ack_delay] + tsch_timing[tsch_ts_ack_wait] + RADIO_DELAY_BEFORE_DETECT); - TSCH_DEBUG_TX_EVENT(); - - ack_start_time = RTIMER_NOW() - RADIO_DELAY_BEFORE_DETECT; - - /* Wait for ACK to finish */ - RTIMER_BUSYWAIT_UNTIL_ABS(!NETSTACK_RADIO.receiving_packet(), - ack_start_time, tsch_timing[tsch_ts_max_ack]); - TSCH_DEBUG_TX_EVENT(); - tsch_radio_off(TSCH_RADIO_CMD_OFF_WITHIN_TIMESLOT); - -#if TSCH_HW_FRAME_FILTERING - /* Leaving promiscuous mode */ - NETSTACK_RADIO.get_value(RADIO_PARAM_RX_MODE, &radio_rx_mode); - NETSTACK_RADIO.set_value(RADIO_PARAM_RX_MODE, radio_rx_mode | RADIO_RX_MODE_ADDRESS_FILTER); -#endif /* TSCH_HW_FRAME_FILTERING */ - - /* Read ack frame */ - ack_len = NETSTACK_RADIO.read((void *)ackbuf, sizeof(ackbuf)); - - is_time_source = 0; - /* The radio driver should return 0 if no valid packets are in the rx buffer */ - if(ack_len > 0) { - is_time_source = current_neighbor != NULL && current_neighbor->is_time_source; - if(tsch_packet_parse_eack(ackbuf, ack_len, seqno, - &frame, &ack_ies, &ack_hdrlen) == 0) { - ack_len = 0; - } - -#if LLSEC802154_ENABLED - if(ack_len != 0) { - if(!tsch_security_parse_frame(ackbuf, ack_hdrlen, ack_len - ack_hdrlen - tsch_security_mic_len(&frame), - &frame, ¤t_neighbor->addr, &tsch_current_asn)) { - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!failed to authenticate ACK")); - ack_len = 0; - } - } else { - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!failed to parse ACK")); - } -#endif /* LLSEC802154_ENABLED */ - } - - if(ack_len != 0) { - if(is_time_source) { - int32_t eack_time_correction = US_TO_RTIMERTICKS(ack_ies.ie_time_correction); - int32_t since_last_timesync = TSCH_ASN_DIFF(tsch_current_asn, last_sync_asn); - if(eack_time_correction > SYNC_IE_BOUND) { - drift_correction = SYNC_IE_BOUND; - } else if(eack_time_correction < -SYNC_IE_BOUND) { - drift_correction = -SYNC_IE_BOUND; - } else { - drift_correction = eack_time_correction; - } - if(drift_correction != eack_time_correction) { - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!truncated dr %d %d", (int)eack_time_correction, (int)drift_correction); - ); - } - tsch_stats_on_time_synchronization(eack_time_correction); - is_drift_correction_used = 1; - tsch_timesync_update(current_neighbor, since_last_timesync, drift_correction); - /* Keep track of sync time */ - last_sync_asn = tsch_current_asn; - tsch_last_sync_time = clock_time(); - tsch_schedule_keepalive(); - } - mac_tx_status = MAC_TX_OK; - - /* We requested an extra slot and got an ack. This means - the extra slot will be scheduled at the received */ - if(burst_link_requested) { - burst_link_scheduled = 1; - } - } else { - mac_tx_status = MAC_TX_NOACK; - } - } else { - mac_tx_status = MAC_TX_OK; - } - } else { - mac_tx_status = MAC_TX_ERR; - } - } - } else { - mac_tx_status = MAC_TX_ERR; - } - } - - tsch_radio_off(TSCH_RADIO_CMD_OFF_END_OF_TIMESLOT); - - current_packet->transmissions++; - current_packet->ret = mac_tx_status; - - /* Post TX: Update neighbor queue state */ - in_queue = tsch_queue_packet_sent(current_neighbor, current_packet, current_link, mac_tx_status); - - /* The packet was dequeued, add it to dequeued_ringbuf for later processing */ - if(in_queue == 0) { - dequeued_array[dequeued_index] = current_packet; - ringbufindex_put(&dequeued_ringbuf); - } - - /* If this is an unicast packet to timesource, update stats */ - if(current_neighbor != NULL && current_neighbor->is_time_source) { - tsch_stats_tx_packet(current_neighbor, mac_tx_status, tsch_current_channel); - } - - /* Log every tx attempt */ - TSCH_LOG_ADD(tsch_log_tx, - log->tx.mac_tx_status = mac_tx_status; - log->tx.num_tx = current_packet->transmissions; - log->tx.datalen = queuebuf_datalen(current_packet->qb); - log->tx.drift = drift_correction; - log->tx.drift_used = is_drift_correction_used; - log->tx.is_data = ((((uint8_t *)(queuebuf_dataptr(current_packet->qb)))[0]) & 7) == FRAME802154_DATAFRAME; -#if LLSEC802154_ENABLED - log->tx.sec_level = queuebuf_attr(current_packet->qb, PACKETBUF_ATTR_SECURITY_LEVEL); -#else /* LLSEC802154_ENABLED */ - log->tx.sec_level = 0; -#endif /* LLSEC802154_ENABLED */ - linkaddr_copy(&log->tx.dest, queuebuf_addr(current_packet->qb, PACKETBUF_ADDR_RECEIVER)); - log->tx.seqno = queuebuf_attr(current_packet->qb, PACKETBUF_ATTR_MAC_SEQNO); - ); - - /* Poll process for later processing of packet sent events and logs */ - process_poll(&tsch_pending_events_process); - } - - TSCH_DEBUG_TX_EVENT(); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(tsch_rx_slot(struct pt *pt, struct rtimer *t)) -{ - /** - * RX slot: - * 1. Check if it is used for TIME_KEEPING - * 2. Sleep and wake up just before expected RX time (with a guard time: TS_LONG_GT) - * 3. Check for radio activity for the guard time: TS_LONG_GT - * 4. Prepare and send ACK if needed - * 5. Drift calculated in the ACK callback registered with the radio driver. Use it if receiving from a time source neighbor. - **/ - - struct tsch_neighbor *n; - static linkaddr_t source_address; - static linkaddr_t destination_address; - static int16_t input_index; - static int input_queue_drop = 0; - - PT_BEGIN(pt); - - TSCH_DEBUG_RX_EVENT(); - - input_index = ringbufindex_peek_put(&input_ringbuf); - if(input_index == -1) { - input_queue_drop++; - } else { - static struct input_packet *current_input; - /* Estimated drift based on RX time */ - static int32_t estimated_drift; - /* Rx timestamps */ - static rtimer_clock_t rx_start_time; - static rtimer_clock_t expected_rx_time; - static rtimer_clock_t packet_duration; - uint8_t packet_seen; - - expected_rx_time = current_slot_start + tsch_timing[tsch_ts_tx_offset]; - /* Default start time: expected Rx time */ - rx_start_time = expected_rx_time; - - current_input = &input_array[input_index]; - - /* Wait before starting to listen */ - TSCH_SCHEDULE_AND_YIELD(pt, t, current_slot_start, tsch_timing[tsch_ts_rx_offset] - RADIO_DELAY_BEFORE_RX, "RxBeforeListen"); - TSCH_DEBUG_RX_EVENT(); - - /* Start radio for at least guard time */ - tsch_radio_on(TSCH_RADIO_CMD_ON_WITHIN_TIMESLOT); - packet_seen = NETSTACK_RADIO.receiving_packet() || NETSTACK_RADIO.pending_packet(); - if(!packet_seen) { - /* Check if receiving within guard time */ - RTIMER_BUSYWAIT_UNTIL_ABS((packet_seen = NETSTACK_RADIO.receiving_packet()), - current_slot_start, tsch_timing[tsch_ts_rx_offset] + tsch_timing[tsch_ts_rx_wait] + RADIO_DELAY_BEFORE_DETECT); - } - if(!packet_seen) { - /* no packets on air */ - tsch_radio_off(TSCH_RADIO_CMD_OFF_FORCE); - } else { - TSCH_DEBUG_RX_EVENT(); - /* Save packet timestamp */ - rx_start_time = RTIMER_NOW() - RADIO_DELAY_BEFORE_DETECT; - - /* Wait until packet is received, turn radio off */ - RTIMER_BUSYWAIT_UNTIL_ABS(!NETSTACK_RADIO.receiving_packet(), - current_slot_start, tsch_timing[tsch_ts_rx_offset] + tsch_timing[tsch_ts_rx_wait] + tsch_timing[tsch_ts_max_tx]); - TSCH_DEBUG_RX_EVENT(); - tsch_radio_off(TSCH_RADIO_CMD_OFF_WITHIN_TIMESLOT); - - if(NETSTACK_RADIO.pending_packet()) { - static int frame_valid; - static int header_len; - static frame802154_t frame; - radio_value_t radio_last_rssi; - radio_value_t radio_last_lqi; - - /* Read packet */ - current_input->len = NETSTACK_RADIO.read((void *)current_input->payload, TSCH_PACKET_MAX_LEN); - NETSTACK_RADIO.get_value(RADIO_PARAM_LAST_RSSI, &radio_last_rssi); - current_input->rx_asn = tsch_current_asn; - current_input->rssi = (signed)radio_last_rssi; - current_input->channel = tsch_current_channel; - header_len = frame802154_parse((uint8_t *)current_input->payload, current_input->len, &frame); - frame_valid = header_len > 0 && - frame802154_check_dest_panid(&frame) && - frame802154_extract_linkaddr(&frame, &source_address, &destination_address); - -#if TSCH_RESYNC_WITH_SFD_TIMESTAMPS - /* At the end of the reception, get an more accurate estimate of SFD arrival time */ - NETSTACK_RADIO.get_object(RADIO_PARAM_LAST_PACKET_TIMESTAMP, &rx_start_time, sizeof(rtimer_clock_t)); -#endif - - packet_duration = TSCH_PACKET_DURATION(current_input->len); - /* limit packet_duration to its max value */ - packet_duration = MIN(packet_duration, tsch_timing[tsch_ts_max_tx]); - - if(!frame_valid) { - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!failed to parse frame %u %u", header_len, current_input->len)); - } - - if(frame_valid) { - if(frame.fcf.frame_type != FRAME802154_DATAFRAME - && frame.fcf.frame_type != FRAME802154_BEACONFRAME) { - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!discarding frame with type %u, len %u", frame.fcf.frame_type, current_input->len)); - frame_valid = 0; - } - } - -#if LLSEC802154_ENABLED - /* Decrypt and verify incoming frame */ - if(frame_valid) { - if(tsch_security_parse_frame( - current_input->payload, header_len, current_input->len - header_len - tsch_security_mic_len(&frame), - &frame, &source_address, &tsch_current_asn)) { - current_input->len -= tsch_security_mic_len(&frame); - } else { - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!failed to authenticate frame %u", current_input->len)); - frame_valid = 0; - } - } -#endif /* LLSEC802154_ENABLED */ - - if(frame_valid) { - /* Check that frome is for us or broadcast, AND that it is not from - * ourselves. This is for consistency with CSMA and to avoid adding - * ourselves to neighbor tables in case frames are being replayed. */ - if((linkaddr_cmp(&destination_address, &linkaddr_node_addr) - || linkaddr_cmp(&destination_address, &linkaddr_null)) - && !linkaddr_cmp(&source_address, &linkaddr_node_addr)) { - int do_nack = 0; - rx_count++; - estimated_drift = RTIMER_CLOCK_DIFF(expected_rx_time, rx_start_time); - tsch_stats_on_time_synchronization(estimated_drift); - -#if TSCH_TIMESYNC_REMOVE_JITTER - /* remove jitter due to measurement errors */ - if(ABS(estimated_drift) <= TSCH_TIMESYNC_MEASUREMENT_ERROR) { - estimated_drift = 0; - } else if(estimated_drift > 0) { - estimated_drift -= TSCH_TIMESYNC_MEASUREMENT_ERROR; - } else { - estimated_drift += TSCH_TIMESYNC_MEASUREMENT_ERROR; - } -#endif - -#ifdef TSCH_CALLBACK_DO_NACK - if(frame.fcf.ack_required) { - do_nack = TSCH_CALLBACK_DO_NACK(current_link, - &source_address, &destination_address); - } -#endif - - if(frame.fcf.ack_required) { - static uint8_t ack_buf[TSCH_PACKET_MAX_LEN]; - static int ack_len; - - /* Build ACK frame */ - ack_len = tsch_packet_create_eack(ack_buf, sizeof(ack_buf), - &source_address, frame.seq, (int16_t)RTIMERTICKS_TO_US(estimated_drift), do_nack); - - if(ack_len > 0) { -#if LLSEC802154_ENABLED - if(tsch_is_pan_secured) { - /* Secure ACK frame. There is only header and header IEs, therefore data len == 0. */ - ack_len += tsch_security_secure_frame(ack_buf, ack_buf, ack_len, 0, &tsch_current_asn); - } -#endif /* LLSEC802154_ENABLED */ - - /* Copy to radio buffer */ - NETSTACK_RADIO.prepare((const void *)ack_buf, ack_len); - - /* Wait for time to ACK and transmit ACK */ - TSCH_SCHEDULE_AND_YIELD(pt, t, rx_start_time, - packet_duration + tsch_timing[tsch_ts_tx_ack_delay] - RADIO_DELAY_BEFORE_TX, "RxBeforeAck"); - TSCH_DEBUG_RX_EVENT(); - NETSTACK_RADIO.transmit(ack_len); - tsch_radio_off(TSCH_RADIO_CMD_OFF_WITHIN_TIMESLOT); - - /* Schedule a burst link iff the frame pending bit was set */ - burst_link_scheduled = tsch_packet_get_frame_pending(current_input->payload, current_input->len); - } - } - - /* If the sender is a time source, proceed to clock drift compensation */ - n = tsch_queue_get_nbr(&source_address); - if(n != NULL && n->is_time_source) { - int32_t since_last_timesync = TSCH_ASN_DIFF(tsch_current_asn, last_sync_asn); - /* Keep track of last sync time */ - last_sync_asn = tsch_current_asn; - tsch_last_sync_time = clock_time(); - /* Save estimated drift */ - drift_correction = -estimated_drift; - is_drift_correction_used = 1; - sync_count++; - tsch_timesync_update(n, since_last_timesync, -estimated_drift); - tsch_schedule_keepalive(); - } - - /* Add current input to ringbuf */ - ringbufindex_put(&input_ringbuf); - - /* If the neighbor is known, update its stats */ - if(n != NULL) { - NETSTACK_RADIO.get_value(RADIO_PARAM_LAST_LINK_QUALITY, &radio_last_lqi); - tsch_stats_rx_packet(n, current_input->rssi, radio_last_lqi, tsch_current_channel); - } - - /* Log every reception */ - TSCH_LOG_ADD(tsch_log_rx, - linkaddr_copy(&log->rx.src, (linkaddr_t *)&frame.src_addr); - log->rx.is_unicast = frame.fcf.ack_required; - log->rx.datalen = current_input->len; - log->rx.drift = drift_correction; - log->rx.drift_used = is_drift_correction_used; - log->rx.is_data = frame.fcf.frame_type == FRAME802154_DATAFRAME; - log->rx.sec_level = frame.aux_hdr.security_control.security_level; - log->rx.estimated_drift = estimated_drift; - log->rx.seqno = frame.seq; - ); - } - - /* Poll process for processing of pending input and logs */ - process_poll(&tsch_pending_events_process); - } - } - - tsch_radio_off(TSCH_RADIO_CMD_OFF_END_OF_TIMESLOT); - } - - if(input_queue_drop != 0) { - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!queue full skipped %u", input_queue_drop); - ); - input_queue_drop = 0; - } - } - - TSCH_DEBUG_RX_EVENT(); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -/* Protothread for slot operation, called from rtimer interrupt - * and scheduled from tsch_schedule_slot_operation */ -static -PT_THREAD(tsch_slot_operation(struct rtimer *t, void *ptr)) -{ - TSCH_DEBUG_INTERRUPT(); - PT_BEGIN(&slot_operation_pt); - - /* Loop over all active slots */ - while(tsch_is_associated) { - - if(current_link == NULL || tsch_lock_requested) { /* Skip slot operation if there is no link - or if there is a pending request for getting the lock */ - /* Issue a log whenever skipping a slot */ - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "!skipped slot %u %u %u", - tsch_locked, - tsch_lock_requested, - current_link == NULL); - ); - - } else { - int is_active_slot; - TSCH_DEBUG_SLOT_START(); - tsch_in_slot_operation = 1; - /* Measure on-air noise level while TSCH is idle */ - tsch_stats_sample_rssi(); - /* Reset drift correction */ - drift_correction = 0; - is_drift_correction_used = 0; - /* Get a packet ready to be sent */ - current_packet = get_packet_and_neighbor_for_link(current_link, ¤t_neighbor); - /* There is no packet to send, and this link does not have Rx flag. Instead of doing - * nothing, switch to the backup link (has Rx flag) if any. */ - if(current_packet == NULL && !(current_link->link_options & LINK_OPTION_RX) && backup_link != NULL) { - current_link = backup_link; - current_packet = get_packet_and_neighbor_for_link(current_link, ¤t_neighbor); - } - is_active_slot = current_packet != NULL || (current_link->link_options & LINK_OPTION_RX); - if(is_active_slot) { - /* If we are in a burst, we stick to current channel instead of - * doing channel hopping, as per IEEE 802.15.4-2015 */ - if(burst_link_scheduled) { - /* Reset burst_link_scheduled flag. Will be set again if burst continue. */ - burst_link_scheduled = 0; - } else { - /* Hop channel */ - tsch_current_channel = tsch_calculate_channel(&tsch_current_asn, current_link->channel_offset); - } - NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, tsch_current_channel); - /* Turn the radio on already here if configured so; necessary for radios with slow startup */ - tsch_radio_on(TSCH_RADIO_CMD_ON_START_OF_TIMESLOT); - /* Decide whether it is a TX/RX/IDLE or OFF slot */ - /* Actual slot operation */ - if(current_packet != NULL) { - /* We have something to transmit, do the following: - * 1. send - * 2. update_backoff_state(current_neighbor) - * 3. post tx callback - **/ - static struct pt slot_tx_pt; - PT_SPAWN(&slot_operation_pt, &slot_tx_pt, tsch_tx_slot(&slot_tx_pt, t)); - } else { - /* Listen */ - static struct pt slot_rx_pt; - PT_SPAWN(&slot_operation_pt, &slot_rx_pt, tsch_rx_slot(&slot_rx_pt, t)); - } - } else { - /* Make sure to end the burst in cast, for some reason, we were - * in a burst but now without any more packet to send. */ - burst_link_scheduled = 0; - } - TSCH_DEBUG_SLOT_END(); - } - - /* End of slot operation, schedule next slot or resynchronize */ - - if(tsch_is_coordinator) { - /* Update the `last_sync_*` variables to avoid large errors - * in the application-level time synchronization */ - last_sync_asn = tsch_current_asn; - tsch_last_sync_time = clock_time(); - } - - /* Do we need to resynchronize? i.e., wait for EB again */ - if(!tsch_is_coordinator && (TSCH_ASN_DIFF(tsch_current_asn, last_sync_asn) > - (100 * TSCH_CLOCK_TO_SLOTS(TSCH_DESYNC_THRESHOLD / 100, tsch_timing[tsch_ts_timeslot_length])))) { - TSCH_LOG_ADD(tsch_log_message, - snprintf(log->message, sizeof(log->message), - "! leaving the network, last sync %u", - (unsigned)TSCH_ASN_DIFF(tsch_current_asn, last_sync_asn)); - ); - last_timesource_neighbor = NULL; - tsch_disassociate(); - } else { - /* backup of drift correction for printing debug messages */ - /* int32_t drift_correction_backup = drift_correction; */ - uint16_t timeslot_diff = 0; - rtimer_clock_t prev_slot_start; - /* Time to next wake up */ - rtimer_clock_t time_to_next_active_slot; - /* Schedule next wakeup skipping slots if missed deadline */ - do { - if(current_link != NULL - && current_link->link_options & LINK_OPTION_TX - && current_link->link_options & LINK_OPTION_SHARED) { - /* Decrement the backoff window for all neighbors able to transmit over - * this Tx, Shared link. */ - tsch_queue_update_all_backoff_windows(¤t_link->addr); - } - - /* A burst link was scheduled. Replay the current link at the - next time offset */ - if(burst_link_scheduled) { - timeslot_diff = 1; - backup_link = NULL; - /* Keep track of the number of repetitions */ - tsch_current_burst_count++; - } else { - /* Get next active link */ - current_link = tsch_schedule_get_next_active_link(&tsch_current_asn, ×lot_diff, &backup_link); - if(current_link == NULL) { - /* There is no next link. Fall back to default - * behavior: wake up at the next slot. */ - timeslot_diff = 1; - } else { - /* Reset burst index now that the link was scheduled from - normal schedule (as opposed to from ongoing burst) */ - tsch_current_burst_count = 0; - } - } - - /* Update ASN */ - TSCH_ASN_INC(tsch_current_asn, timeslot_diff); - /* Time to next wake up */ - time_to_next_active_slot = timeslot_diff * tsch_timing[tsch_ts_timeslot_length] + drift_correction; - time_to_next_active_slot += tsch_timesync_adaptive_compensate(time_to_next_active_slot); - drift_correction = 0; - is_drift_correction_used = 0; - /* Update current slot start */ - prev_slot_start = current_slot_start; - current_slot_start += time_to_next_active_slot; - } while(!tsch_schedule_slot_operation(t, prev_slot_start, time_to_next_active_slot, "main")); - } - - tsch_in_slot_operation = 0; - PT_YIELD(&slot_operation_pt); - } - - PT_END(&slot_operation_pt); -} -/*---------------------------------------------------------------------------*/ -/* Set global time before starting slot operation, - * with a rtimer time and an ASN */ -void -tsch_slot_operation_start(void) -{ - static struct rtimer slot_operation_timer; - rtimer_clock_t time_to_next_active_slot; - rtimer_clock_t prev_slot_start; - TSCH_DEBUG_INIT(); - do { - uint16_t timeslot_diff; - /* Get next active link */ - current_link = tsch_schedule_get_next_active_link(&tsch_current_asn, ×lot_diff, &backup_link); - if(current_link == NULL) { - /* There is no next link. Fall back to default - * behavior: wake up at the next slot. */ - timeslot_diff = 1; - } - /* Update ASN */ - TSCH_ASN_INC(tsch_current_asn, timeslot_diff); - /* Time to next wake up */ - time_to_next_active_slot = timeslot_diff * tsch_timing[tsch_ts_timeslot_length]; - /* Update current slot start */ - prev_slot_start = current_slot_start; - current_slot_start += time_to_next_active_slot; - } while(!tsch_schedule_slot_operation(&slot_operation_timer, prev_slot_start, time_to_next_active_slot, "assoc")); -} -/*---------------------------------------------------------------------------*/ -/* Start actual slot operation */ -void -tsch_slot_operation_sync(rtimer_clock_t next_slot_start, - struct tsch_asn_t *next_slot_asn) -{ - int_master_status_t status; - - current_slot_start = next_slot_start; - tsch_current_asn = *next_slot_asn; - status = critical_enter(); - last_sync_asn = tsch_current_asn; - tsch_last_sync_time = clock_time(); - critical_exit(status); - current_link = NULL; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/tsch-slot-operation.h b/os/net/mac/tsch/tsch-slot-operation.h deleted file mode 100644 index 22547a2c9..000000000 --- a/os/net/mac/tsch/tsch-slot-operation.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup tsch - * @{ - * \file - * TSCH runtime operation within timeslots -*/ - -#ifndef __TSCH_SLOT_OPERATION_H__ -#define __TSCH_SLOT_OPERATION_H__ - -/********** Includes **********/ - -#include "contiki.h" -#include "lib/ringbufindex.h" - -/***** External Variables *****/ - -/* A ringbuf storing outgoing packets after they were dequeued. - * Will be processed layer by tsch_tx_process_pending */ -extern struct ringbufindex dequeued_ringbuf; -extern struct tsch_packet *dequeued_array[TSCH_DEQUEUED_ARRAY_SIZE]; -/* A ringbuf storing incoming packets. - * Will be processed layer by tsch_rx_process_pending */ -extern struct ringbufindex input_ringbuf; -extern struct input_packet input_array[TSCH_MAX_INCOMING_PACKETS]; -/* Last clock_time_t where synchronization happened */ -extern clock_time_t tsch_last_sync_time; -/* Counts the length of the current burst */ -extern int tsch_current_burst_count; - -/********** Functions *********/ - -/** - * Returns a 802.15.4 channel from an ASN and channel offset. Basically adds - * The offset to the ASN and performs a hopping sequence lookup. - * - * \param asn A given ASN - * \param channel_offset A given channel offset - * \return The resulting channel - */ -uint8_t tsch_calculate_channel(struct tsch_asn_t *asn, uint8_t channel_offset); -/** - * Checks if the TSCH lock is set. Accesses to global structures outside of - * interrupts must be done through the lock, unless the sturcutre has - * atomic read/write - * - * \return 1 if the lock is taken, 0 otherwise - */ -int tsch_is_locked(void); -/** - * Takes the TSCH lock. When the lock is taken, slot operation will be skipped - * until release. - * - * \return 1 if the lock was successfully taken, 0 otherwise - */ -int tsch_get_lock(void); -/** - * Releases the TSCH lock. - */ -void tsch_release_lock(void); -/** - * Set global time before starting slot operation, with a rtimer time and an ASN - * - * \param next_slot_start the time to the start of the next slot, in rtimer ticks - * \param next_slot_asn the ASN of the next slot - */ -void tsch_slot_operation_sync(rtimer_clock_t next_slot_start, - struct tsch_asn_t *next_slot_asn); -/** - * Start actual slot operation - */ -void tsch_slot_operation_start(void); - -#endif /* __TSCH_SLOT_OPERATION_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-stats.c b/os/net/mac/tsch/tsch-stats.c deleted file mode 100644 index 474728e6d..000000000 --- a/os/net/mac/tsch/tsch-stats.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (c) 2016-2017, University of Bristol - http://www.bristol.ac.uk - * - * 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 INSTITUTE 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 INSTITUTE 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 - * Source file for TSCH statistics - * \author - * Atis Elsts - */ - -#include "contiki.h" -#include "net/mac/tsch/tsch.h" -#include "net/netstack.h" -#include "dev/radio.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "TSCH Stats" -#define LOG_LEVEL LOG_LEVEL_MAC - -/*---------------------------------------------------------------------------*/ -#if TSCH_STATS_ON -/*---------------------------------------------------------------------------*/ - -struct tsch_global_stats tsch_stats; -struct tsch_neighbor_stats tsch_neighbor_stats; - -/* Called every TSCH_STATS_DECAY_INTERVAL ticks */ -static struct ctimer periodic_timer; - -static void periodic(void *); - -/*---------------------------------------------------------------------------*/ -void -tsch_stats_init(void) -{ -#if TSCH_STATS_SAMPLE_NOISE_RSSI - int i; - - for(i = 0; i < TSCH_STATS_NUM_CHANNELS; ++i) { - tsch_stats.noise_rssi[i] = TSCH_STATS_DEFAULT_RSSI; - tsch_stats.channel_free_ewma[i] = TSCH_STATS_DEFAULT_CHANNEL_FREE; - } -#endif - - tsch_stats_reset_neighbor_stats(); - - /* Start the periodic processing soonish */ - ctimer_set(&periodic_timer, TSCH_STATS_DECAY_INTERVAL / 10, periodic, NULL); -} -/*---------------------------------------------------------------------------*/ -void -tsch_stats_reset_neighbor_stats(void) -{ - int i; - struct tsch_channel_stats *ch_stats; - - ch_stats = tsch_neighbor_stats.channel_stats; - for(i = 0; i < TSCH_STATS_NUM_CHANNELS; ++i) { - ch_stats[i].rssi = TSCH_STATS_DEFAULT_RSSI; - ch_stats[i].lqi = TSCH_STATS_DEFAULT_LQI; - ch_stats[i].p_tx_success = TSCH_STATS_DEFAULT_P_TX; - } -} -/*---------------------------------------------------------------------------*/ -struct tsch_neighbor_stats * -tsch_stats_get_from_neighbor(struct tsch_neighbor *n) -{ - /* Due to RAM limitations, this module only collects neighbor stats about the time source */ - if(n != NULL && n->is_time_source) { - return &tsch_neighbor_stats; - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -void -tsch_stats_tx_packet(struct tsch_neighbor *n, uint8_t mac_status, uint8_t channel) -{ - struct tsch_neighbor_stats *stats; - - stats = tsch_stats_get_from_neighbor(n); - if(stats != NULL) { - uint8_t index = tsch_stats_channel_to_index(channel); - uint16_t new_tx_value = (mac_status == MAC_TX_OK ? 1 : 0); - new_tx_value *= TSCH_STATS_BINARY_SCALING_FACTOR; - TSCH_STATS_EWMA_UPDATE(stats->channel_stats[index].p_tx_success, new_tx_value); - } -} -/*---------------------------------------------------------------------------*/ -void -tsch_stats_rx_packet(struct tsch_neighbor *n, int8_t rssi, uint8_t lqi, uint8_t channel) -{ - struct tsch_neighbor_stats *stats; - - stats = tsch_stats_get_from_neighbor(n); - if(stats != NULL) { - uint8_t index = tsch_stats_channel_to_index(channel); - - TSCH_STATS_EWMA_UPDATE(stats->channel_stats[index].rssi, - TSCH_STATS_TRANSFORM(rssi, TSCH_STATS_RSSI_SCALING_FACTOR)); - TSCH_STATS_EWMA_UPDATE(stats->channel_stats[index].lqi, - TSCH_STATS_TRANSFORM(lqi, TSCH_STATS_LQI_SCALING_FACTOR)); - } -} -/*---------------------------------------------------------------------------*/ -void -tsch_stats_on_time_synchronization(int32_t sync_error) -{ - /* Update the maximal error so far if the absolute value of the new one is larger */ - tsch_stats.max_sync_error = MAX(tsch_stats.max_sync_error, ABS(sync_error)); -} -/*---------------------------------------------------------------------------*/ -void -tsch_stats_sample_rssi(void) -{ -#if TSCH_STATS_SAMPLE_NOISE_RSSI - uint8_t index; - radio_value_t value; - radio_result_t rv; - - static uint8_t measurement_channel = TSCH_STATS_FIRST_CHANNEL; - - index = tsch_stats_channel_to_index(measurement_channel); - - /* Select the measurement channel */ - NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, measurement_channel); - - /* Need to explicitly turn on for Coojamotes */ - NETSTACK_RADIO.on(); - - /* Measure the background noise RSSI and act on it */ - rv = NETSTACK_RADIO.get_value(RADIO_PARAM_RSSI, &value); - if(rv == RADIO_RESULT_OK) { - tsch_stat_t prev_busyness_metric; - uint16_t is_free; - - is_free = (((int)value <= TSCH_STATS_BUSY_CHANNEL_RSSI) ? 1 : 0) * TSCH_STATS_BINARY_SCALING_FACTOR; - - /* LOG_DBG("noise RSSI on %u: %d\n", measurement_channel, (int)value); */ - - TSCH_STATS_EWMA_UPDATE(tsch_stats.noise_rssi[index], - TSCH_STATS_TRANSFORM((int)value, TSCH_STATS_RSSI_SCALING_FACTOR)); - - prev_busyness_metric = tsch_stats.channel_free_ewma[index]; - (void)prev_busyness_metric; - TSCH_STATS_EWMA_UPDATE(tsch_stats.channel_free_ewma[index], is_free); - - /* potentially select a new TSCH hopping sequence */ -#ifdef TSCH_CALLBACK_CHANNEL_STATS_UPDATED - TSCH_CALLBACK_CHANNEL_STATS_UPDATED(measurement_channel, prev_busyness_metric); -#endif - } else { - LOG_ERR("! sampling RSSI failed: %d\n", (int)rv); - } - - /* Increment the channel index for the next time */ - measurement_channel++; - if(measurement_channel >= TSCH_STATS_FIRST_CHANNEL + TSCH_STATS_NUM_CHANNELS) { - measurement_channel = TSCH_STATS_FIRST_CHANNEL; - } -#endif /* TSCH_STATS_SAMPLE_NOISE_RSSI */ -} -/*---------------------------------------------------------------------------*/ -/* Periodic timer called every TSCH_STATS_DECAY_INTERVAL ticks */ -static void -periodic(void *ptr) -{ - int i; - struct tsch_neighbor *timesource; - struct tsch_channel_stats *stats = tsch_neighbor_stats.channel_stats; - -#if TSCH_STATS_SAMPLE_NOISE_RSSI - LOG_DBG("Noise RSSI:\n"); - for(i = 0; i < TSCH_STATS_NUM_CHANNELS; ++i) { - LOG_DBG(" channel %u: %d rssi, %u/%u free\n", - TSCH_STATS_FIRST_CHANNEL + i, - tsch_stats.noise_rssi[i] / TSCH_STATS_RSSI_SCALING_FACTOR, - tsch_stats.channel_free_ewma[i], - TSCH_STATS_BINARY_SCALING_FACTOR); - } -#endif - - timesource = tsch_queue_get_time_source(); - if(timesource != NULL) { - LOG_DBG("Time source neighbor:\n"); - - for(i = 0; i < TSCH_STATS_NUM_CHANNELS; ++i) { - LOG_DBG(" channel %u: %d rssi, %u lqi, %u/%u P(tx)\n", - TSCH_STATS_FIRST_CHANNEL + i, - stats[i].rssi / TSCH_STATS_RSSI_SCALING_FACTOR, - stats[i].lqi / TSCH_STATS_LQI_SCALING_FACTOR, - stats[i].p_tx_success, - TSCH_STATS_BINARY_SCALING_FACTOR); - } - } - - /* Do not decay the periodic global stats, as they are updated independely of packet rate */ - for(i = 0; i < TSCH_STATS_NUM_CHANNELS; ++i) { - /* decay Rx stats */ - TSCH_STATS_EWMA_UPDATE(stats[i].rssi, TSCH_STATS_DEFAULT_RSSI); - TSCH_STATS_EWMA_UPDATE(stats[i].lqi, TSCH_STATS_DEFAULT_LQI); - /* decay Tx stats */ - TSCH_STATS_EWMA_UPDATE(stats[i].p_tx_success, TSCH_STATS_DEFAULT_P_TX); - } - - ctimer_set(&periodic_timer, TSCH_STATS_DECAY_INTERVAL, periodic, NULL); -} -/*---------------------------------------------------------------------------*/ -#endif /* TSCH_STATS_ON */ -/*---------------------------------------------------------------------------*/ diff --git a/os/net/mac/tsch/tsch-stats.h b/os/net/mac/tsch/tsch-stats.h deleted file mode 100644 index 794cf1df1..000000000 --- a/os/net/mac/tsch/tsch-stats.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2016-2017, University of Bristol - http://www.bristol.ac.uk - * - * 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 INSTITUTE 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 INSTITUTE 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 - * Header file for TSCH statistics - * \author - * Atis Elsts - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#ifndef __TSCH_STATS_H__ -#define __TSCH_STATS_H__ - -/********** Includes **********/ - -#include "contiki.h" -#include "net/linkaddr.h" -#include "net/mac/tsch/tsch-conf.h" -#include "net/mac/tsch/tsch-queue.h" - -/************ Constants ***********/ - -/* Enable the collection of TSCH statistics? */ -#ifdef TSCH_STATS_CONF_ON -#define TSCH_STATS_ON TSCH_STATS_CONF_ON -#else -#define TSCH_STATS_ON 0 -#endif - -/* Enable the collection background noise RSSI? */ -#ifdef TSCH_STATS_CONF_SAMPLE_NOISE_RSSI -#define TSCH_STATS_SAMPLE_NOISE_RSSI TSCH_STATS_CONF_SAMPLE_NOISE_RSSI -#else -#define TSCH_STATS_SAMPLE_NOISE_RSSI 0 -#endif - -/* - * How to update a TSCH statistic. - * Uses a hardcoded EWMA alpha value equal to 0.125 by default. - */ -#ifdef TSCH_STATS_CONF_EWMA_UPDATE -#define TSCH_STATS_EWMA_UPDATE TSCH_STATS_CONF_EWMA_UPDATE -#else -#define TSCH_STATS_EWMA_UPDATE(x, v) (x) = (((x) * 7 / 8) + (v) / 8) -#endif - -/* - * A channel is considered busy if at the sampling instant - * it has RSSI higher or equal to this limit. - */ -#ifdef TSCH_STATS_CONF_BUSY_CHANNEL_RSSI -#define TSCH_STATS_BUSY_CHANNEL_RSSI TSCH_STATS_CONF_BUSY_CHANNEL_RSSI -#else -#define TSCH_STATS_BUSY_CHANNEL_RSSI -85 -#endif - -/* The period after which stat values are decayed towards the default values */ -#ifdef TSCH_STATS_CONF_DECAY_INTERVAL -#define TSCH_STATS_DECAY_INTERVAL TSCH_STATS_CONF_DECAY_INTERVAL -#else -#define TSCH_STATS_DECAY_INTERVAL (20ul * 60 * CLOCK_SECOND) -#endif - -/* - * The total number of MAC-layer channels. - * Sixteen for the IEEE802.15.4 2.4 GHz band. - */ -#ifdef TSCH_STATS_CONF_NUM_CHANNELS -#define TSCH_STATS_NUM_CHANNELS TSCH_STATS_CONF_NUM_CHANNELS -#else -#define TSCH_STATS_NUM_CHANNELS 16 -#endif - -/* The number of the first MAC-layer channel. */ -#ifdef TSCH_STATS_CONF_FIRST_CHANNEL -#define TSCH_STATS_FIRST_CHANNEL TSCH_STATS_CONF_FIRST_CHANNEL -#else -#define TSCH_STATS_FIRST_CHANNEL 11 -#endif - -/* Internal: the scaling of the various stats */ -#define TSCH_STATS_RSSI_SCALING_FACTOR -16 -#define TSCH_STATS_LQI_SCALING_FACTOR 16 -#define TSCH_STATS_BINARY_SCALING_FACTOR 4096 - -/* - * Transform a statistic from external form to the internal representation. - * To transform back, simply divide by the factor. - */ -#define TSCH_STATS_TRANSFORM(x, factor) ((int16_t)(x) * factor) - -/* The default value for RSSI statistics: -90 dBm */ -#define TSCH_STATS_DEFAULT_RSSI TSCH_STATS_TRANSFORM(-90, TSCH_STATS_RSSI_SCALING_FACTOR) -/* The default value for LQI statistics: 100 */ -#define TSCH_STATS_DEFAULT_LQI TSCH_STATS_TRANSFORM(100, TSCH_STATS_LQI_SCALING_FACTOR) -/* The default value for P_tx (packet transmission probability) statistics: 50% */ -#define TSCH_STATS_DEFAULT_P_TX (TSCH_STATS_BINARY_SCALING_FACTOR / 2) -/* The default value for channel free status: 100% */ -#define TSCH_STATS_DEFAULT_CHANNEL_FREE TSCH_STATS_BINARY_SCALING_FACTOR - -/* #define these callbacks to do the adaptive channel selection based on RSSI */ -/* TSCH_CALLBACK_CHANNEL_STATS_UPDATED(channel, previous_metric); */ -/* TSCH_CALLBACK_SELECT_CHANNELS(); */ - - -/************ Types ***********/ - -typedef uint16_t tsch_stat_t; - -struct tsch_global_stats { - /* the maximum synchronization error */ - uint32_t max_sync_error; - /* number of disassociations */ - uint16_t num_disassociations; -#if TSCH_STATS_SAMPLE_NOISE_RSSI - /* per-channel noise estimates */ - tsch_stat_t noise_rssi[TSCH_STATS_NUM_CHANNELS]; - /* derived from `noise_rssi` and BUSY_CHANNEL_RSSI */ - tsch_stat_t channel_free_ewma[TSCH_STATS_NUM_CHANNELS]; -#endif /* TSCH_STATS_SAMPLE_NOISE_RSSI */ -}; - -struct tsch_channel_stats { - /* EWMA, from receptions */ - tsch_stat_t rssi; - /* EWMA, from receptions */ - tsch_stat_t lqi; - /* EWMA of probability, for unicast transmissions only */ - tsch_stat_t p_tx_success; -}; - -struct tsch_neighbor_stats { - struct tsch_channel_stats channel_stats[TSCH_STATS_NUM_CHANNELS]; -}; - -struct tsch_neighbor; /* Forward declaration */ - - -/************ External variables ***********/ - -#if TSCH_STATS_ON - -/* Statistics for the local node */ -extern struct tsch_global_stats tsch_stats; - -/* For the timesource neighbor */ -extern struct tsch_neighbor_stats tsch_neighbor_stats; - - -/************ Functions ***********/ - -void tsch_stats_init(void); - -void tsch_stats_tx_packet(struct tsch_neighbor *, uint8_t mac_status, uint8_t channel); - -void tsch_stats_rx_packet(struct tsch_neighbor *, int8_t rssi, uint8_t lqi, uint8_t channel); - -void tsch_stats_on_time_synchronization(int32_t sync_error); - -void tsch_stats_sample_rssi(void); - -struct tsch_neighbor_stats *tsch_stats_get_from_neighbor(struct tsch_neighbor *); - -void tsch_stats_reset_neighbor_stats(void); - -#else /* TSCH_STATS_ON */ - -#define tsch_stats_init() -#define tsch_stats_tx_packet(n, mac_status, channel) -#define tsch_stats_rx_packet(n, rssi, lqi, channel) -#define tsch_stats_on_time_synchronization(sync_error) -#define tsch_stats_sample_rssi() -#define tsch_stats_get_from_neighbor(neighbor) NULL -#define tsch_stats_reset_neighbor_stats() - -#endif /* TSCH_STATS_ON */ - -static inline uint8_t -tsch_stats_channel_to_index(uint8_t channel) -{ - return channel - TSCH_STATS_FIRST_CHANNEL; -} - -static inline uint8_t -tsch_stats_index_to_channel(uint8_t channel_index) -{ - return channel_index + TSCH_STATS_FIRST_CHANNEL; -} - - -#endif /* __TSCH_STATS_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch-timeslot-timing.c b/os/net/mac/tsch/tsch-timeslot-timing.c deleted file mode 100644 index 1d598a4ae..000000000 --- a/os/net/mac/tsch/tsch-timeslot-timing.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * IEEE 802.15.4 TSCH timeslot timings - * \author - * Simon Duquennoy - * - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#include "contiki.h" -#include "net/mac/tsch/tsch.h" - -/** - * \brief The default timeslot timing in the standard is a guard time of - * 2200 us, a Tx offset of 2120 us and a Rx offset of 1120 us. - * As a result, the listening device has a guard time not centered - * on the expected Tx time. This is to be fixed in the next iteration - * of the standard. This can be enabled with: - * TxOffset: 2120 - * RxOffset: 1120 - * RxWait: 2200 - * - * Instead, we align the Rx guard time on expected Tx time. The Rx - * guard time is user-configurable with TSCH_CONF_RX_WAIT. - * (TxOffset - (RxWait / 2)) instead - */ - -const tsch_timeslot_timing_usec tsch_timeslot_timing_us_10000 = { - 1800, /* CCAOffset */ - 128, /* CCA */ - 2120, /* TxOffset */ - (2120 - (TSCH_CONF_RX_WAIT / 2)), /* RxOffset */ - 800, /* RxAckDelay */ - 1000, /* TxAckDelay */ - TSCH_CONF_RX_WAIT, /* RxWait */ - 400, /* AckWait */ - 192, /* RxTx */ - 2400, /* MaxAck */ - 4256, /* MaxTx */ - 10000, /* TimeslotLength */ -}; - -/** @} */ diff --git a/os/net/mac/tsch/tsch-types.h b/os/net/mac/tsch/tsch-types.h deleted file mode 100644 index 1c2cdb13a..000000000 --- a/os/net/mac/tsch/tsch-types.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** -* \addtogroup tsch -* @{ - * \file - * TSCH types - * \author - * Simon Duquennoy - */ - -#ifndef __TSCH_TYPES_H__ -#define __TSCH_TYPES_H__ - -/********** Includes **********/ - -#include "net/mac/tsch/tsch-asn.h" -#include "lib/list.h" -#include "lib/ringbufindex.h" - -/********** Data types **********/ - -/** \brief 802.15.4e link types. LINK_TYPE_ADVERTISING_ONLY is an extra one: for EB-only links. */ -enum link_type { LINK_TYPE_NORMAL, LINK_TYPE_ADVERTISING, LINK_TYPE_ADVERTISING_ONLY }; - -/** \brief An IEEE 802.15.4-2015 TSCH link (also called cell or slot) */ -struct tsch_link { - /* Links are stored as a list: "next" must be the first field */ - struct tsch_link *next; - /* Unique identifier */ - uint16_t handle; - /* MAC address of neighbor */ - linkaddr_t addr; - /* Slotframe identifier */ - uint16_t slotframe_handle; - /* Identifier of Slotframe to which this link belongs - * Unused. */ - /* uint8_t handle; */ - /* Timeslot for this link */ - uint16_t timeslot; - /* Channel offset for this link */ - uint16_t channel_offset; - /* A bit string that defines - * b0 = Transmit, b1 = Receive, b2 = Shared, b3 = Timekeeping, b4 = reserved */ - uint8_t link_options; - /* Type of link. NORMAL = 0. ADVERTISING = 1, and indicates - the link may be used to send an Enhanced beacon. */ - enum link_type link_type; - /* Any other data for upper layers */ - void *data; -}; - -/** \brief 802.15.4e slotframe (contains links) */ -struct tsch_slotframe { - /* Slotframes are stored as a list: "next" must be the first field */ - struct tsch_slotframe *next; - /* Unique identifier */ - uint16_t handle; - /* Number of timeslots in the slotframe. - * Stored as struct asn_divisor_t because we often need ASN%size */ - struct tsch_asn_divisor_t size; - /* List of links belonging to this slotframe */ - LIST_STRUCT(links_list); -}; - -/** \brief TSCH packet information */ -struct tsch_packet { - struct queuebuf *qb; /* pointer to the queuebuf to be sent */ - mac_callback_t sent; /* callback for this packet */ - void *ptr; /* MAC callback parameter */ - uint8_t transmissions; /* #transmissions performed for this packet */ - uint8_t max_transmissions; /* maximal number of Tx before dropping the packet */ - uint8_t ret; /* status -- MAC return code */ - uint8_t header_len; /* length of header and header IEs (needed for link-layer security) */ - uint8_t tsch_sync_ie_offset; /* Offset within the frame used for quick update of EB ASN and join priority */ -}; - -/** \brief TSCH neighbor information */ -struct tsch_neighbor { - /* Neighbors are stored as a list: "next" must be the first field */ - struct tsch_neighbor *next; - linkaddr_t addr; /* MAC address of the neighbor */ - uint8_t is_broadcast; /* is this neighbor a virtual neighbor used for broadcast (of data packets or EBs) */ - uint8_t is_time_source; /* is this neighbor a time source? */ - uint8_t backoff_exponent; /* CSMA backoff exponent */ - uint8_t backoff_window; /* CSMA backoff window (number of slots to skip) */ - uint8_t last_backoff_window; /* Last CSMA backoff window */ - uint8_t tx_links_count; /* How many links do we have to this neighbor? */ - uint8_t dedicated_tx_links_count; /* How many dedicated links do we have to this neighbor? */ - /* Array for the ringbuf. Contains pointers to packets. - * Its size must be a power of two to allow for atomic put */ - struct tsch_packet *tx_array[TSCH_QUEUE_NUM_PER_NEIGHBOR]; - /* Circular buffer of pointers to packet. */ - struct ringbufindex tx_ringbuf; -}; - -/** \brief TSCH timeslot timing elements. Used to index timeslot timing - * of different units, such as rtimer tick or micro-second */ -enum tsch_timeslot_timing_elements { - tsch_ts_cca_offset, - tsch_ts_cca, - tsch_ts_tx_offset, - tsch_ts_rx_offset, - tsch_ts_rx_ack_delay, - tsch_ts_tx_ack_delay, - tsch_ts_rx_wait, - tsch_ts_ack_wait, - tsch_ts_rx_tx, - tsch_ts_max_ack, - tsch_ts_max_tx, - tsch_ts_timeslot_length, - tsch_ts_elements_count, /* Not a timing element */ -}; - -/** \brief TSCH timeslot timing elements in rtimer ticks */ -typedef rtimer_clock_t tsch_timeslot_timing_ticks[tsch_ts_elements_count]; - -/** \brief TSCH timeslot timing elements in micro-seconds */ -typedef uint16_t tsch_timeslot_timing_usec[tsch_ts_elements_count]; - -/** \brief Stores data about an incoming packet */ -struct input_packet { - uint8_t payload[TSCH_PACKET_MAX_LEN]; /* Packet payload */ - struct tsch_asn_t rx_asn; /* ASN when the packet was received */ - int len; /* Packet len */ - int16_t rssi; /* RSSI for this packet */ - uint8_t channel; /* Channel we received the packet on */ -}; - -#endif /* __TSCH_CONF_H__ */ -/** @} */ diff --git a/os/net/mac/tsch/tsch.c b/os/net/mac/tsch/tsch.c deleted file mode 100644 index 6278ce0dc..000000000 --- a/os/net/mac/tsch/tsch.c +++ /dev/null @@ -1,1176 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * IEEE 802.15.4 TSCH MAC implementation. - * Does not use any RDC layer. Should be used with nordc. - * \author - * Simon Duquennoy - * Beshr Al Nahas - * - */ - -/** - * \addtogroup tsch - * @{ -*/ - -#include "contiki.h" -#include "dev/radio.h" -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "net/queuebuf.h" -#include "net/nbr-table.h" -#include "net/link-stats.h" -#include "net/mac/framer/framer-802154.h" -#include "net/mac/tsch/tsch.h" -#include "net/mac/mac-sequence.h" -#include "lib/random.h" -#include "net/routing/routing.h" - -#if TSCH_WITH_SIXTOP -#include "net/mac/tsch/sixtop/sixtop.h" -#endif - -#if FRAME802154_VERSION < FRAME802154_IEEE802154_2015 -#error TSCH: FRAME802154_VERSION must be at least FRAME802154_IEEE802154_2015 -#endif - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "TSCH" -#define LOG_LEVEL LOG_LEVEL_MAC - -/* Use to collect link statistics even on Keep-Alive, even though they were - * not sent from an upper layer and don't have a valid packet_sent callback */ -#ifndef TSCH_LINK_NEIGHBOR_CALLBACK -#if NETSTACK_CONF_WITH_IPV6 -void uip_ds6_link_neighbor_callback(int status, int numtx); -#define TSCH_LINK_NEIGHBOR_CALLBACK(dest, status, num) uip_ds6_link_neighbor_callback(status, num) -#endif /* NETSTACK_CONF_WITH_IPV6 */ -#endif /* TSCH_LINK_NEIGHBOR_CALLBACK */ - -/* The address of the last node we received an EB from (other than our time source). - * Used for recovery */ -static linkaddr_t last_eb_nbr_addr; -/* The join priority advertised by last_eb_nbr_addr */ -static uint8_t last_eb_nbr_jp; - -/* Let TSCH select a time source with no help of an upper layer. - * We do so using statistics from incoming EBs */ -#if TSCH_AUTOSELECT_TIME_SOURCE -int best_neighbor_eb_count; -struct eb_stat { - int rx_count; - int jp; -}; -NBR_TABLE(struct eb_stat, eb_stats); -#endif /* TSCH_AUTOSELECT_TIME_SOURCE */ - -/* TSCH channel hopping sequence */ -uint8_t tsch_hopping_sequence[TSCH_HOPPING_SEQUENCE_MAX_LEN]; -struct tsch_asn_divisor_t tsch_hopping_sequence_length; - -/* Default TSCH timeslot timing (in micro-second) */ -static const uint16_t *tsch_default_timing_us; -/* TSCH timeslot timing (in micro-second) */ -uint16_t tsch_timing_us[tsch_ts_elements_count]; -/* TSCH timeslot timing (in rtimer ticks) */ -rtimer_clock_t tsch_timing[tsch_ts_elements_count]; - -#if LINKADDR_SIZE == 8 -/* 802.15.4 broadcast MAC address */ -const linkaddr_t tsch_broadcast_address = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; -/* Address used for the EB virtual neighbor queue */ -const linkaddr_t tsch_eb_address = { { 0, 0, 0, 0, 0, 0, 0, 0 } }; -#else /* LINKADDR_SIZE == 8 */ -const linkaddr_t tsch_broadcast_address = { { 0xff, 0xff } }; -const linkaddr_t tsch_eb_address = { { 0, 0 } }; -#endif /* LINKADDR_SIZE == 8 */ - -/* Is TSCH started? */ -int tsch_is_started = 0; -/* Has TSCH initialization failed? */ -int tsch_is_initialized = 0; -/* Are we coordinator of the TSCH network? */ -int tsch_is_coordinator = 0; -/* Are we associated to a TSCH network? */ -int tsch_is_associated = 0; -/* Total number of associations since boot */ -int tsch_association_count = 0; -/* Is the PAN running link-layer security? */ -int tsch_is_pan_secured = LLSEC802154_ENABLED; -/* The current Absolute Slot Number (ASN) */ -struct tsch_asn_t tsch_current_asn; -/* Device rank or join priority: - * For PAN coordinator: 0 -- lower is better */ -uint8_t tsch_join_priority; -/* The current TSCH sequence number, used for unicast data frames only */ -static uint8_t tsch_packet_seqno; -/* Current period for EB output */ -static clock_time_t tsch_current_eb_period; -/* Current period for keepalive output */ -static clock_time_t tsch_current_ka_timeout; - -/* timer for sending keepalive messages */ -static struct ctimer keepalive_timer; - -/* Statistics on the current session */ -unsigned long tx_count; -unsigned long rx_count; -unsigned long sync_count; -int32_t min_drift_seen; -int32_t max_drift_seen; - -/* TSCH processes and protothreads */ -PT_THREAD(tsch_scan(struct pt *pt)); -PROCESS(tsch_process, "main process"); -PROCESS(tsch_send_eb_process, "send EB process"); -PROCESS(tsch_pending_events_process, "pending events process"); - -/* Other function prototypes */ -static void packet_input(void); - -/* Getters and setters */ - -/*---------------------------------------------------------------------------*/ -void -tsch_set_coordinator(int enable) -{ - if(tsch_is_coordinator != enable) { - tsch_is_associated = 0; - } - tsch_is_coordinator = enable; - tsch_set_eb_period(TSCH_EB_PERIOD); -} -/*---------------------------------------------------------------------------*/ -void -tsch_set_pan_secured(int enable) -{ - tsch_is_pan_secured = LLSEC802154_ENABLED && enable; -} -/*---------------------------------------------------------------------------*/ -void -tsch_set_join_priority(uint8_t jp) -{ - tsch_join_priority = jp; -} -/*---------------------------------------------------------------------------*/ -void -tsch_set_ka_timeout(uint32_t timeout) -{ - tsch_current_ka_timeout = timeout; - if(timeout == 0) { - ctimer_stop(&keepalive_timer); - } else { - tsch_schedule_keepalive(); - } -} -/*---------------------------------------------------------------------------*/ -void -tsch_set_eb_period(uint32_t period) -{ - tsch_current_eb_period = MIN(period, TSCH_MAX_EB_PERIOD); -} -/*---------------------------------------------------------------------------*/ -static void -tsch_reset(void) -{ - int i; - frame802154_set_pan_id(0xffff); - /* First make sure pending packet callbacks are sent etc */ - process_post_synch(&tsch_pending_events_process, PROCESS_EVENT_POLL, NULL); - /* Reset neighbor queues */ - tsch_queue_reset(); - /* Remove unused neighbors */ - tsch_queue_free_unused_neighbors(); - tsch_queue_update_time_source(NULL); - /* Initialize global variables */ - tsch_join_priority = 0xff; - TSCH_ASN_INIT(tsch_current_asn, 0, 0); - current_link = NULL; - /* Reset timeslot timing to defaults */ - tsch_default_timing_us = TSCH_DEFAULT_TIMESLOT_TIMING; - for(i = 0; i < tsch_ts_elements_count; i++) { - tsch_timing_us[i] = tsch_default_timing_us[i]; - tsch_timing[i] = US_TO_RTIMERTICKS(tsch_timing_us[i]); - } -#ifdef TSCH_CALLBACK_LEAVING_NETWORK - TSCH_CALLBACK_LEAVING_NETWORK(); -#endif - linkaddr_copy(&last_eb_nbr_addr, &linkaddr_null); -#if TSCH_AUTOSELECT_TIME_SOURCE - struct nbr_sync_stat *stat; - best_neighbor_eb_count = 0; - /* Remove all nbr stats */ - stat = nbr_table_head(sync_stats); - while(stat != NULL) { - nbr_table_remove(sync_stats, stat); - stat = nbr_table_next(sync_stats, stat); - } -#endif /* TSCH_AUTOSELECT_TIME_SOURCE */ - tsch_set_eb_period(TSCH_EB_PERIOD); -} -/* TSCH keep-alive functions */ - -/*---------------------------------------------------------------------------*/ -/* Resynchronize to last_eb_nbr. - * Return non-zero if this function schedules the next keepalive. - * Return zero otherwise. - */ -static int -resynchronize(const linkaddr_t *original_time_source_addr) -{ - const struct tsch_neighbor *current_time_source = tsch_queue_get_time_source(); - if(current_time_source && !linkaddr_cmp(¤t_time_source->addr, original_time_source_addr)) { - /* Time source has already been changed (e.g. by RPL). Let's see if it works. */ - LOG_INFO("time source has been changed to "); - LOG_INFO_LLADDR(¤t_time_source->addr); - LOG_INFO_("\n"); - return 0; - } - /* Switch time source to the last neighbor we received an EB from */ - if(linkaddr_cmp(&last_eb_nbr_addr, &linkaddr_null)) { - LOG_WARN("not able to re-synchronize, received no EB from other neighbors\n"); - if(sync_count == 0) { - /* We got no synchronization at all in this session, leave the network */ - tsch_disassociate(); - } - return 0; - } else { - LOG_WARN("re-synchronizing on "); - LOG_WARN_LLADDR(&last_eb_nbr_addr); - LOG_WARN_("\n"); - /* We simply pick the last neighbor we receiver sync information from */ - tsch_queue_update_time_source(&last_eb_nbr_addr); - tsch_join_priority = last_eb_nbr_jp + 1; - /* Try to get in sync ASAP */ - tsch_schedule_keepalive_immediately(); - return 1; - } -} - -/*---------------------------------------------------------------------------*/ -/* Tx callback for keepalive messages */ -static void -keepalive_packet_sent(void *ptr, int status, int transmissions) -{ - int schedule_next_keepalive = 1; - /* Update neighbor link statistics */ - link_stats_packet_sent(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), status, transmissions); - /* Call RPL callback if RPL is enabled */ -#ifdef TSCH_CALLBACK_KA_SENT - TSCH_CALLBACK_KA_SENT(status, transmissions); -#endif /* TSCH_CALLBACK_KA_SENT */ - LOG_INFO("KA sent to "); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - LOG_INFO_(", st %d-%d\n", status, transmissions); - - /* We got no ack, try to resynchronize */ - if(status == MAC_TX_NOACK) { - schedule_next_keepalive = !resynchronize(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - } - - if(schedule_next_keepalive) { - tsch_schedule_keepalive(); - } -} -/*---------------------------------------------------------------------------*/ -/* Prepare and send a keepalive message */ -static void -keepalive_send(void *ptr) -{ - if(tsch_is_associated) { - struct tsch_neighbor *n = tsch_queue_get_time_source(); - if(n != NULL) { - /* Simply send an empty packet */ - packetbuf_clear(); - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &n->addr); - NETSTACK_MAC.send(keepalive_packet_sent, NULL); - LOG_INFO("sending KA to "); - LOG_INFO_LLADDR(&n->addr); - LOG_INFO_("\n"); - } else { - LOG_ERR("no timesource - KA not sent\n"); - } - } -} -/*---------------------------------------------------------------------------*/ -/* Set ctimer to send a keepalive message after expiration of TSCH_KEEPALIVE_TIMEOUT */ -void -tsch_schedule_keepalive(void) -{ - /* Pick a delay in the range [tsch_current_ka_timeout*0.9, tsch_current_ka_timeout[ */ - if(!tsch_is_coordinator && tsch_is_associated && tsch_current_ka_timeout > 0) { - unsigned long delay = (tsch_current_ka_timeout - tsch_current_ka_timeout / 10) - + random_rand() % (tsch_current_ka_timeout / 10); - ctimer_set(&keepalive_timer, delay, keepalive_send, NULL); - } -} -/*---------------------------------------------------------------------------*/ -/* Set ctimer to send a keepalive message immediately */ -void -tsch_schedule_keepalive_immediately(void) -{ - /* Pick a delay in the range [tsch_current_ka_timeout*0.9, tsch_current_ka_timeout[ */ - if(!tsch_is_coordinator && tsch_is_associated) { - ctimer_set(&keepalive_timer, 0, keepalive_send, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -eb_input(struct input_packet *current_input) -{ - /* LOG_INFO("EB received\n"); */ - frame802154_t frame; - /* Verify incoming EB (does its ASN match our Rx time?), - * and update our join priority. */ - struct ieee802154_ies eb_ies; - - if(tsch_packet_parse_eb(current_input->payload, current_input->len, - &frame, &eb_ies, NULL, 1)) { - /* PAN ID check and authentication done at rx time */ - - /* Got an EB from a different neighbor than our time source, keep enough data - * to switch to it in case we lose the link to our time source */ - struct tsch_neighbor *ts = tsch_queue_get_time_source(); - if(ts == NULL || !linkaddr_cmp(&last_eb_nbr_addr, &ts->addr)) { - linkaddr_copy(&last_eb_nbr_addr, (linkaddr_t *)&frame.src_addr); - last_eb_nbr_jp = eb_ies.ie_join_priority; - } - -#if TSCH_AUTOSELECT_TIME_SOURCE - if(!tsch_is_coordinator) { - /* Maintain EB received counter for every neighbor */ - struct eb_stat *stat = (struct eb_stat *)nbr_table_get_from_lladdr(eb_stats, (linkaddr_t *)&frame.src_addr); - if(stat == NULL) { - stat = (struct eb_stat *)nbr_table_add_lladdr(eb_stats, (linkaddr_t *)&frame.src_addr, NBR_TABLE_REASON_MAC, NULL); - } - if(stat != NULL) { - stat->rx_count++; - stat->jp = eb_ies.ie_join_priority; - best_neighbor_eb_count = MAX(best_neighbor_eb_count, stat->rx_count); - } - /* Select best time source */ - struct eb_stat *best_stat = NULL; - stat = nbr_table_head(eb_stats); - while(stat != NULL) { - /* Is neighbor eligible as a time source? */ - if(stat->rx_count > best_neighbor_eb_count / 2) { - if(best_stat == NULL || - stat->jp < best_stat->jp) { - best_stat = stat; - } - } - stat = nbr_table_next(eb_stats, stat); - } - /* Update time source */ - if(best_stat != NULL) { - tsch_queue_update_time_source(nbr_table_get_lladdr(eb_stats, best_stat)); - tsch_join_priority = best_stat->jp + 1; - } - } -#endif /* TSCH_AUTOSELECT_TIME_SOURCE */ - - /* Did the EB come from our time source? */ - if(ts != NULL && linkaddr_cmp((linkaddr_t *)&frame.src_addr, &ts->addr)) { - /* Check for ASN drift */ - int32_t asn_diff = TSCH_ASN_DIFF(current_input->rx_asn, eb_ies.ie_asn); - if(asn_diff != 0) { - /* We disagree with our time source's ASN -- leave the network */ - LOG_WARN("! ASN drifted by %ld, leaving the network\n", asn_diff); - tsch_disassociate(); - } - - if(eb_ies.ie_join_priority >= TSCH_MAX_JOIN_PRIORITY) { - /* Join priority unacceptable. Leave network. */ - LOG_WARN("! EB JP too high %u, leaving the network\n", - eb_ies.ie_join_priority); - tsch_disassociate(); - } else { -#if TSCH_AUTOSELECT_TIME_SOURCE - /* Update join priority */ - if(tsch_join_priority != eb_ies.ie_join_priority + 1) { - LOG_INFO("update JP from EB %u -> %u\n", - tsch_join_priority, eb_ies.ie_join_priority + 1); - tsch_join_priority = eb_ies.ie_join_priority + 1; - } -#endif /* TSCH_AUTOSELECT_TIME_SOURCE */ - } - - /* TSCH hopping sequence */ - if(eb_ies.ie_channel_hopping_sequence_id != 0) { - if(eb_ies.ie_hopping_sequence_len != tsch_hopping_sequence_length.val - || memcmp((uint8_t *)tsch_hopping_sequence, eb_ies.ie_hopping_sequence_list, tsch_hopping_sequence_length.val)) { - if(eb_ies.ie_hopping_sequence_len <= sizeof(tsch_hopping_sequence)) { - memcpy((uint8_t *)tsch_hopping_sequence, eb_ies.ie_hopping_sequence_list, - eb_ies.ie_hopping_sequence_len); - TSCH_ASN_DIVISOR_INIT(tsch_hopping_sequence_length, eb_ies.ie_hopping_sequence_len); - - LOG_WARN("Updating TSCH hopping sequence from EB\n"); - } else { - LOG_WARN("TSCH:! parse_eb: hopping sequence too long (%u)\n", eb_ies.ie_hopping_sequence_len); - } - } - } - } - } -} -/*---------------------------------------------------------------------------*/ -/* Process pending input packet(s) */ -static void -tsch_rx_process_pending() -{ - int16_t input_index; - /* Loop on accessing (without removing) a pending input packet */ - while((input_index = ringbufindex_peek_get(&input_ringbuf)) != -1) { - struct input_packet *current_input = &input_array[input_index]; - frame802154_t frame; - uint8_t ret = frame802154_parse(current_input->payload, current_input->len, &frame); - int is_data = ret && frame.fcf.frame_type == FRAME802154_DATAFRAME; - int is_eb = ret - && frame.fcf.frame_version == FRAME802154_IEEE802154_2015 - && frame.fcf.frame_type == FRAME802154_BEACONFRAME; - - if(is_data) { - /* Skip EBs and other control messages */ - /* Copy to packetbuf for processing */ - packetbuf_copyfrom(current_input->payload, current_input->len); - packetbuf_set_attr(PACKETBUF_ATTR_RSSI, current_input->rssi); - packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, current_input->channel); - } - - if(is_data) { - /* Pass to upper layers */ - packet_input(); - } else if(is_eb) { - eb_input(current_input); - } - - /* Remove input from ringbuf */ - ringbufindex_get(&input_ringbuf); - } -} -/*---------------------------------------------------------------------------*/ -/* Pass sent packets to upper layer */ -static void -tsch_tx_process_pending(void) -{ - int16_t dequeued_index; - /* Loop on accessing (without removing) a pending input packet */ - while((dequeued_index = ringbufindex_peek_get(&dequeued_ringbuf)) != -1) { - struct tsch_packet *p = dequeued_array[dequeued_index]; - /* Put packet into packetbuf for packet_sent callback */ - queuebuf_to_packetbuf(p->qb); - LOG_INFO("packet sent to "); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - LOG_INFO_(", seqno %u, status %d, tx %d\n", - packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO), p->ret, p->transmissions); - /* Call packet_sent callback */ - mac_call_sent_callback(p->sent, p->ptr, p->ret, p->transmissions); - /* Free packet queuebuf */ - tsch_queue_free_packet(p); - /* Free all unused neighbors */ - tsch_queue_free_unused_neighbors(); - /* Remove dequeued packet from ringbuf */ - ringbufindex_get(&dequeued_ringbuf); - } -} -/*---------------------------------------------------------------------------*/ -/* Setup TSCH as a coordinator */ -static void -tsch_start_coordinator(void) -{ - frame802154_set_pan_id(IEEE802154_PANID); - /* Initialize hopping sequence as default */ - memcpy(tsch_hopping_sequence, TSCH_DEFAULT_HOPPING_SEQUENCE, sizeof(TSCH_DEFAULT_HOPPING_SEQUENCE)); - TSCH_ASN_DIVISOR_INIT(tsch_hopping_sequence_length, sizeof(TSCH_DEFAULT_HOPPING_SEQUENCE)); -#if TSCH_SCHEDULE_WITH_6TISCH_MINIMAL - tsch_schedule_create_minimal(); -#endif - - tsch_is_associated = 1; - tsch_join_priority = 0; - - LOG_INFO("starting as coordinator, PAN ID %x, asn-%x.%lx\n", - frame802154_get_pan_id(), tsch_current_asn.ms1b, tsch_current_asn.ls4b); - - /* Start slot operation */ - tsch_slot_operation_sync(RTIMER_NOW(), &tsch_current_asn); -} -/*---------------------------------------------------------------------------*/ -/* Leave the TSCH network */ -void -tsch_disassociate(void) -{ - if(tsch_is_associated == 1) { - tsch_is_associated = 0; - process_post(&tsch_process, PROCESS_EVENT_POLL, NULL); - } -} -/*---------------------------------------------------------------------------*/ -/* Attempt to associate to a network form an incoming EB */ -static int -tsch_associate(const struct input_packet *input_eb, rtimer_clock_t timestamp) -{ - frame802154_t frame; - struct ieee802154_ies ies; - uint8_t hdrlen; - int i; - - if(input_eb == NULL || tsch_packet_parse_eb(input_eb->payload, input_eb->len, - &frame, &ies, &hdrlen, 0) == 0) { - LOG_ERR("! failed to parse EB (len %u)\n", input_eb->len); - return 0; - } - - tsch_current_asn = ies.ie_asn; - tsch_join_priority = ies.ie_join_priority + 1; - -#if TSCH_JOIN_SECURED_ONLY - if(frame.fcf.security_enabled == 0) { - LOG_ERR("! parse_eb: EB is not secured\n"); - return 0; - } -#endif /* TSCH_JOIN_SECURED_ONLY */ -#if LLSEC802154_ENABLED - if(!tsch_security_parse_frame(input_eb->payload, hdrlen, - input_eb->len - hdrlen - tsch_security_mic_len(&frame), - &frame, (linkaddr_t*)&frame.src_addr, &tsch_current_asn)) { - LOG_ERR("! parse_eb: failed to authenticate\n"); - return 0; - } -#endif /* LLSEC802154_ENABLED */ - -#if !LLSEC802154_ENABLED - if(frame.fcf.security_enabled == 1) { - LOG_ERR("! parse_eb: we do not support security, but EB is secured\n"); - return 0; - } -#endif /* !LLSEC802154_ENABLED */ - -#if TSCH_JOIN_MY_PANID_ONLY - /* Check if the EB comes from the PAN ID we expect */ - if(frame.src_pid != IEEE802154_PANID) { - LOG_ERR("! parse_eb: PAN ID %x != %x\n", frame.src_pid, IEEE802154_PANID); - return 0; - } -#endif /* TSCH_JOIN_MY_PANID_ONLY */ - - /* There was no join priority (or 0xff) in the EB, do not join */ - if(ies.ie_join_priority == 0xff) { - LOG_ERR("! parse_eb: no join priority\n"); - return 0; - } - - /* TSCH timeslot timing */ - for(i = 0; i < tsch_ts_elements_count; i++) { - if(ies.ie_tsch_timeslot_id == 0) { - tsch_timing_us[i] = tsch_default_timing_us[i]; - } else { - tsch_timing_us[i] = ies.ie_tsch_timeslot[i]; - } - tsch_timing[i] = US_TO_RTIMERTICKS(tsch_timing_us[i]); - } - - /* TSCH hopping sequence */ - if(ies.ie_channel_hopping_sequence_id == 0) { - memcpy(tsch_hopping_sequence, TSCH_DEFAULT_HOPPING_SEQUENCE, sizeof(TSCH_DEFAULT_HOPPING_SEQUENCE)); - TSCH_ASN_DIVISOR_INIT(tsch_hopping_sequence_length, sizeof(TSCH_DEFAULT_HOPPING_SEQUENCE)); - } else { - if(ies.ie_hopping_sequence_len <= sizeof(tsch_hopping_sequence)) { - memcpy(tsch_hopping_sequence, ies.ie_hopping_sequence_list, ies.ie_hopping_sequence_len); - TSCH_ASN_DIVISOR_INIT(tsch_hopping_sequence_length, ies.ie_hopping_sequence_len); - } else { - LOG_ERR("! parse_eb: hopping sequence too long (%u)\n", ies.ie_hopping_sequence_len); - return 0; - } - } - -#if TSCH_CHECK_TIME_AT_ASSOCIATION > 0 - /* Divide by 4k and multiply again to avoid integer overflow */ - uint32_t expected_asn = 4096 * TSCH_CLOCK_TO_SLOTS(clock_time() / 4096, tsch_timing_timeslot_length); /* Expected ASN based on our current time*/ - int32_t asn_threshold = TSCH_CHECK_TIME_AT_ASSOCIATION * 60ul * TSCH_CLOCK_TO_SLOTS(CLOCK_SECOND, tsch_timing_timeslot_length); - int32_t asn_diff = (int32_t)tsch_current_asn.ls4b - expected_asn; - if(asn_diff > asn_threshold) { - LOG_ERR("! EB ASN rejected %lx %lx %ld\n", - tsch_current_asn.ls4b, expected_asn, asn_diff); - return 0; - } -#endif - -#if TSCH_INIT_SCHEDULE_FROM_EB - /* Create schedule */ - if(ies.ie_tsch_slotframe_and_link.num_slotframes == 0) { -#if TSCH_SCHEDULE_WITH_6TISCH_MINIMAL - LOG_INFO("parse_eb: no schedule, setting up minimal schedule\n"); - tsch_schedule_create_minimal(); -#else - LOG_INFO("parse_eb: no schedule\n"); -#endif - } else { - /* First, empty current schedule */ - tsch_schedule_remove_all_slotframes(); - /* We support only 0 or 1 slotframe in this IE */ - int num_links = ies.ie_tsch_slotframe_and_link.num_links; - if(num_links <= FRAME802154E_IE_MAX_LINKS) { - int i; - struct tsch_slotframe *sf = tsch_schedule_add_slotframe( - ies.ie_tsch_slotframe_and_link.slotframe_handle, - ies.ie_tsch_slotframe_and_link.slotframe_size); - for(i = 0; i < num_links; i++) { - tsch_schedule_add_link(sf, - ies.ie_tsch_slotframe_and_link.links[i].link_options, - LINK_TYPE_ADVERTISING, &tsch_broadcast_address, - ies.ie_tsch_slotframe_and_link.links[i].timeslot, ies.ie_tsch_slotframe_and_link.links[i].channel_offset); - } - } else { - LOG_ERR("! parse_eb: too many links in schedule (%u)\n", num_links); - return 0; - } - } -#endif /* TSCH_INIT_SCHEDULE_FROM_EB */ - - if(tsch_join_priority < TSCH_MAX_JOIN_PRIORITY) { - struct tsch_neighbor *n; - - /* Add coordinator to list of neighbors, lock the entry */ - n = tsch_queue_add_nbr((linkaddr_t *)&frame.src_addr); - - if(n != NULL) { - tsch_queue_update_time_source((linkaddr_t *)&frame.src_addr); - - /* Set PANID */ - frame802154_set_pan_id(frame.src_pid); - - /* Synchronize on EB */ - tsch_slot_operation_sync(timestamp - tsch_timing[tsch_ts_tx_offset], &tsch_current_asn); - - /* Update global flags */ - tsch_is_associated = 1; - tsch_is_pan_secured = frame.fcf.security_enabled; - tx_count = 0; - rx_count = 0; - sync_count = 0; - min_drift_seen = 0; - max_drift_seen = 0; - - /* Start sending keep-alives now that tsch_is_associated is set */ - tsch_schedule_keepalive(); - -#ifdef TSCH_CALLBACK_JOINING_NETWORK - TSCH_CALLBACK_JOINING_NETWORK(); -#endif - - tsch_association_count++; - LOG_INFO("association done (%u), sec %u, PAN ID %x, asn-%x.%lx, jp %u, timeslot id %u, hopping id %u, slotframe len %u with %u links, from ", - tsch_association_count, - tsch_is_pan_secured, - frame.src_pid, - tsch_current_asn.ms1b, tsch_current_asn.ls4b, tsch_join_priority, - ies.ie_tsch_timeslot_id, - ies.ie_channel_hopping_sequence_id, - ies.ie_tsch_slotframe_and_link.slotframe_size, - ies.ie_tsch_slotframe_and_link.num_links); - LOG_INFO_LLADDR((const linkaddr_t *)&frame.src_addr); - LOG_INFO_("\n"); - - return 1; - } - } - LOG_ERR("! did not associate.\n"); - return 0; -} -/* Processes and protothreads used by TSCH */ - -/*---------------------------------------------------------------------------*/ -/* Scanning protothread, called by tsch_process: - * Listen to different channels, and when receiving an EB, - * attempt to associate. - */ -PT_THREAD(tsch_scan(struct pt *pt)) -{ - PT_BEGIN(pt); - - static struct input_packet input_eb; - static struct etimer scan_timer; - /* Time when we started scanning on current_channel */ - static clock_time_t current_channel_since; - - TSCH_ASN_INIT(tsch_current_asn, 0, 0); - - etimer_set(&scan_timer, CLOCK_SECOND / TSCH_ASSOCIATION_POLL_FREQUENCY); - current_channel_since = clock_time(); - - while(!tsch_is_associated && !tsch_is_coordinator) { - /* Hop to any channel offset */ - static uint8_t current_channel = 0; - - /* We are not coordinator, try to associate */ - rtimer_clock_t t0; - int is_packet_pending = 0; - clock_time_t now_time = clock_time(); - - /* Switch to a (new) channel for scanning */ - if(current_channel == 0 || now_time - current_channel_since > TSCH_CHANNEL_SCAN_DURATION) { - /* Pick a channel at random in TSCH_JOIN_HOPPING_SEQUENCE */ - uint8_t scan_channel = TSCH_JOIN_HOPPING_SEQUENCE[ - random_rand() % sizeof(TSCH_JOIN_HOPPING_SEQUENCE)]; - - NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, scan_channel); - current_channel = scan_channel; - LOG_INFO("scanning on channel %u\n", scan_channel); - - current_channel_since = now_time; - } - - /* Turn radio on and wait for EB */ - NETSTACK_RADIO.on(); - - is_packet_pending = NETSTACK_RADIO.pending_packet(); - if(!is_packet_pending && NETSTACK_RADIO.receiving_packet()) { - /* If we are currently receiving a packet, wait until end of reception */ - t0 = RTIMER_NOW(); - RTIMER_BUSYWAIT_UNTIL_ABS((is_packet_pending = NETSTACK_RADIO.pending_packet()), t0, RTIMER_SECOND / 100); - } - - if(is_packet_pending) { - rtimer_clock_t t1; - /* Read packet */ - input_eb.len = NETSTACK_RADIO.read(input_eb.payload, TSCH_PACKET_MAX_LEN); - - /* Save packet timestamp */ - NETSTACK_RADIO.get_object(RADIO_PARAM_LAST_PACKET_TIMESTAMP, &t0, sizeof(rtimer_clock_t)); - t1 = RTIMER_NOW(); - - /* Parse EB and attempt to associate */ - LOG_INFO("scan: received packet (%u bytes) on channel %u\n", input_eb.len, current_channel); - - /* Sanity-check the timestamp */ - if(ABS(RTIMER_CLOCK_DIFF(t0, t1)) < tsch_timing[tsch_ts_timeslot_length]) { - tsch_associate(&input_eb, t0); - } else { - LOG_WARN("scan: dropping packet, timestamp too far from current time %u %u\n", - (unsigned)t0, - (unsigned)t1 - ); - } - } - - if(tsch_is_associated) { - /* End of association, turn the radio off */ - NETSTACK_RADIO.off(); - } else if(!tsch_is_coordinator) { - /* Go back to scanning */ - etimer_reset(&scan_timer); - PT_WAIT_UNTIL(pt, etimer_expired(&scan_timer)); - } - } - - PT_END(pt); -} - -/*---------------------------------------------------------------------------*/ -/* The main TSCH process */ -PROCESS_THREAD(tsch_process, ev, data) -{ - static struct pt scan_pt; - - PROCESS_BEGIN(); - - while(1) { - - while(!tsch_is_associated) { - if(tsch_is_coordinator) { - /* We are coordinator, start operating now */ - tsch_start_coordinator(); - } else { - /* Start scanning, will attempt to join when receiving an EB */ - PROCESS_PT_SPAWN(&scan_pt, tsch_scan(&scan_pt)); - } - } - - /* We are part of a TSCH network, start slot operation */ - tsch_slot_operation_start(); - - /* Yield our main process. Slot operation will re-schedule itself - * as long as we are associated */ - PROCESS_YIELD_UNTIL(!tsch_is_associated); - - LOG_WARN("leaving the network, stats: tx %lu, rx %lu, sync %lu\n", - tx_count, rx_count, sync_count); - - /* Will need to re-synchronize */ - tsch_reset(); - } - - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ -/* A periodic process to send TSCH Enhanced Beacons (EB) */ -PROCESS_THREAD(tsch_send_eb_process, ev, data) -{ - static struct etimer eb_timer; - - PROCESS_BEGIN(); - - /* Wait until association */ - etimer_set(&eb_timer, CLOCK_SECOND / 10); - while(!tsch_is_associated) { - PROCESS_WAIT_UNTIL(etimer_expired(&eb_timer)); - etimer_reset(&eb_timer); - } - - /* Set an initial delay except for coordinator, which should send an EB asap */ - if(!tsch_is_coordinator) { - etimer_set(&eb_timer, random_rand() % TSCH_EB_PERIOD); - PROCESS_WAIT_UNTIL(etimer_expired(&eb_timer)); - } - - while(1) { - unsigned long delay; - - if(tsch_is_associated && tsch_current_eb_period > 0 -#ifdef TSCH_RPL_CHECK_DODAG_JOINED - /* Implementation section 6.3 of RFC 8180 */ - && TSCH_RPL_CHECK_DODAG_JOINED() -#endif /* TSCH_RPL_CHECK_DODAG_JOINED */ - ) { - /* Enqueue EB only if there isn't already one in queue */ - if(tsch_queue_packet_count(&tsch_eb_address) == 0) { - uint8_t hdr_len = 0; - uint8_t tsch_sync_ie_offset; - /* Prepare the EB packet and schedule it to be sent */ - if(tsch_packet_create_eb(&hdr_len, &tsch_sync_ie_offset) > 0) { - struct tsch_packet *p; - /* Enqueue EB packet, for a single transmission only */ - if(!(p = tsch_queue_add_packet(&tsch_eb_address, 1, NULL, NULL))) { - LOG_ERR("! could not enqueue EB packet\n"); - } else { - LOG_INFO("TSCH: enqueue EB packet %u %u\n", - packetbuf_totlen(), packetbuf_hdrlen()); - p->tsch_sync_ie_offset = tsch_sync_ie_offset; - p->header_len = hdr_len; - } - } - } - } - if(tsch_current_eb_period > 0) { - /* Next EB transmission with a random delay - * within [tsch_current_eb_period*0.75, tsch_current_eb_period[ */ - delay = (tsch_current_eb_period - tsch_current_eb_period / 4) - + random_rand() % (tsch_current_eb_period / 4); - } else { - delay = TSCH_EB_PERIOD; - } - etimer_set(&eb_timer, delay); - PROCESS_WAIT_UNTIL(etimer_expired(&eb_timer)); - } - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ -/* A process that is polled from interrupt and calls tx/rx input - * callbacks, outputs pending logs. */ -PROCESS_THREAD(tsch_pending_events_process, ev, data) -{ - PROCESS_BEGIN(); - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - tsch_rx_process_pending(); - tsch_tx_process_pending(); - tsch_log_process_pending(); -#ifdef TSCH_CALLBACK_SELECT_CHANNELS - TSCH_CALLBACK_SELECT_CHANNELS(); -#endif - } - PROCESS_END(); -} - -/* Functions from the Contiki MAC layer driver interface */ - -/*---------------------------------------------------------------------------*/ -static void -tsch_init(void) -{ - radio_value_t radio_rx_mode; - radio_value_t radio_tx_mode; - rtimer_clock_t t; - - /* Check that the platform provides a TSCH timeslot timing template */ - if(TSCH_DEFAULT_TIMESLOT_TIMING == NULL) { - LOG_ERR("! platform does not provide a timeslot timing template.\n"); - return; - } - - /* Radio Rx mode */ - if(NETSTACK_RADIO.get_value(RADIO_PARAM_RX_MODE, &radio_rx_mode) != RADIO_RESULT_OK) { - LOG_ERR("! radio does not support getting RADIO_PARAM_RX_MODE. Abort init.\n"); - return; - } - /* Disable radio in frame filtering */ - radio_rx_mode &= ~RADIO_RX_MODE_ADDRESS_FILTER; - /* Unset autoack */ - radio_rx_mode &= ~RADIO_RX_MODE_AUTOACK; - /* Set radio in poll mode */ - radio_rx_mode |= RADIO_RX_MODE_POLL_MODE; - if(NETSTACK_RADIO.set_value(RADIO_PARAM_RX_MODE, radio_rx_mode) != RADIO_RESULT_OK) { - LOG_ERR("! radio does not support setting required RADIO_PARAM_RX_MODE. Abort init.\n"); - return; - } - - /* Radio Tx mode */ - if(NETSTACK_RADIO.get_value(RADIO_PARAM_TX_MODE, &radio_tx_mode) != RADIO_RESULT_OK) { - LOG_ERR("! radio does not support getting RADIO_PARAM_TX_MODE. Abort init.\n"); - return; - } - /* Unset CCA */ - radio_tx_mode &= ~RADIO_TX_MODE_SEND_ON_CCA; - if(NETSTACK_RADIO.set_value(RADIO_PARAM_TX_MODE, radio_tx_mode) != RADIO_RESULT_OK) { - LOG_ERR("! radio does not support setting required RADIO_PARAM_TX_MODE. Abort init.\n"); - return; - } - /* Test setting channel */ - if(NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, TSCH_DEFAULT_HOPPING_SEQUENCE[0]) != RADIO_RESULT_OK) { - LOG_ERR("! radio does not support setting channel. Abort init.\n"); - return; - } - /* Test getting timestamp */ - if(NETSTACK_RADIO.get_object(RADIO_PARAM_LAST_PACKET_TIMESTAMP, &t, sizeof(rtimer_clock_t)) != RADIO_RESULT_OK) { - LOG_ERR("! radio does not support getting last packet timestamp. Abort init.\n"); - return; - } - /* Check max hopping sequence length vs default sequence length */ - if(TSCH_HOPPING_SEQUENCE_MAX_LEN < sizeof(TSCH_DEFAULT_HOPPING_SEQUENCE)) { - LOG_ERR("! TSCH_HOPPING_SEQUENCE_MAX_LEN < sizeof(TSCH_DEFAULT_HOPPING_SEQUENCE). Abort init.\n"); - return; - } - - /* Init TSCH sub-modules */ - tsch_reset(); - tsch_queue_init(); - tsch_schedule_init(); - tsch_log_init(); - ringbufindex_init(&input_ringbuf, TSCH_MAX_INCOMING_PACKETS); - ringbufindex_init(&dequeued_ringbuf, TSCH_DEQUEUED_ARRAY_SIZE); -#if TSCH_AUTOSELECT_TIME_SOURCE - nbr_table_register(sync_stats, NULL); -#endif /* TSCH_AUTOSELECT_TIME_SOURCE */ - - tsch_packet_seqno = random_rand(); - tsch_is_initialized = 1; - -#if TSCH_AUTOSTART - /* Start TSCH operation. - * If TSCH_AUTOSTART is not set, one needs to call NETSTACK_MAC.on() to start TSCH. */ - NETSTACK_MAC.on(); -#endif /* TSCH_AUTOSTART */ - -#if TSCH_WITH_SIXTOP - sixtop_init(); -#endif - - tsch_stats_init(); -} -/*---------------------------------------------------------------------------*/ -/* Function send for TSCH-MAC, puts the packet in packetbuf in the MAC queue */ -static void -send_packet(mac_callback_t sent, void *ptr) -{ - int ret = MAC_TX_DEFERRED; - int hdr_len = 0; - const linkaddr_t *addr = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); - uint8_t max_transmissions = 0; - - if(!tsch_is_associated) { - if(!tsch_is_initialized) { - LOG_WARN("! not initialized (see earlier logs), drop outgoing packet\n"); - } else { - LOG_WARN("! not associated, drop outgoing packet\n"); - } - ret = MAC_TX_ERR; - mac_call_sent_callback(sent, ptr, ret, 1); - return; - } - - /* Ask for ACK if we are sending anything other than broadcast */ - if(!linkaddr_cmp(addr, &linkaddr_null)) { - /* PACKETBUF_ATTR_MAC_SEQNO cannot be zero, due to a pecuilarity - in framer-802154.c. */ - if(++tsch_packet_seqno == 0) { - tsch_packet_seqno++; - } - packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, tsch_packet_seqno); - packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1); - } else { - /* Broadcast packets shall be added to broadcast queue - * The broadcast address in Contiki is linkaddr_null which is equal - * to tsch_eb_address */ - addr = &tsch_broadcast_address; - } - - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME); - -#if LLSEC802154_ENABLED - if(tsch_is_pan_secured) { - /* Set security level, key id and index */ - packetbuf_set_attr(PACKETBUF_ATTR_SECURITY_LEVEL, TSCH_SECURITY_KEY_SEC_LEVEL_OTHER); - packetbuf_set_attr(PACKETBUF_ATTR_KEY_ID_MODE, FRAME802154_1_BYTE_KEY_ID_MODE); /* Use 1-byte key index */ - packetbuf_set_attr(PACKETBUF_ATTR_KEY_INDEX, TSCH_SECURITY_KEY_INDEX_OTHER); - } -#endif /* LLSEC802154_ENABLED */ - -#if !NETSTACK_CONF_BRIDGE_MODE - /* - * In the Contiki stack, the source address of a frame is set at the RDC - * layer. Since TSCH doesn't use any RDC protocol and bypasses the layer to - * transmit a frame, it should set the source address by itself. - */ - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); -#endif - - max_transmissions = packetbuf_attr(PACKETBUF_ATTR_MAX_MAC_TRANSMISSIONS); - if(max_transmissions == 0) { - /* If not set by the application, use the default TSCH value */ - max_transmissions = TSCH_MAC_MAX_FRAME_RETRIES + 1; - } - - if((hdr_len = NETSTACK_FRAMER.create()) < 0) { - LOG_ERR("! can't send packet due to framer error\n"); - ret = MAC_TX_ERR; - } else { - struct tsch_packet *p; - /* Enqueue packet */ - p = tsch_queue_add_packet(addr, max_transmissions, sent, ptr); - if(p == NULL) { - LOG_ERR("! can't send packet to "); - LOG_ERR_LLADDR(addr); - LOG_ERR_(" with seqno %u, queue %u %u\n", - tsch_packet_seqno, tsch_queue_packet_count(addr), tsch_queue_global_packet_count()); - ret = MAC_TX_ERR; - } else { - p->header_len = hdr_len; - LOG_INFO("send packet to "); - LOG_INFO_LLADDR(addr); - LOG_INFO_(" with seqno %u, queue %u %u, len %u %u\n", - tsch_packet_seqno, - tsch_queue_packet_count(addr), tsch_queue_global_packet_count(), - p->header_len, queuebuf_datalen(p->qb)); - } - } - if(ret != MAC_TX_DEFERRED) { - mac_call_sent_callback(sent, ptr, ret, 1); - } -} -/*---------------------------------------------------------------------------*/ -static void -packet_input(void) -{ - int frame_parsed = 1; - - frame_parsed = NETSTACK_FRAMER.parse(); - - if(frame_parsed < 0) { - LOG_ERR("! failed to parse %u\n", packetbuf_datalen()); - } else { - int duplicate = 0; - - /* Seqno of 0xffff means no seqno */ - if(packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO) != 0xffff) { - /* Check for duplicates */ - duplicate = mac_sequence_is_duplicate(); - if(duplicate) { - /* Drop the packet. */ - LOG_WARN("! drop dup ll from "); - LOG_WARN_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_WARN_(" seqno %u\n", packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO)); - } else { - mac_sequence_register_seqno(); - } - } - - if(!duplicate) { - LOG_INFO("received from "); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_INFO_(" with seqno %u\n", packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO)); -#if TSCH_WITH_SIXTOP - sixtop_input(); -#endif /* TSCH_WITH_SIXTOP */ - NETSTACK_NETWORK.input(); - } - } -} -/*---------------------------------------------------------------------------*/ -static int -turn_on(void) -{ - if(tsch_is_initialized == 1 && tsch_is_started == 0) { - tsch_is_started = 1; - /* Process tx/rx callback and log messages whenever polled */ - process_start(&tsch_pending_events_process, NULL); - /* periodically send TSCH EBs */ - process_start(&tsch_send_eb_process, NULL); - /* try to associate to a network or start one if setup as coordinator */ - process_start(&tsch_process, NULL); - LOG_INFO("starting as %s\n", tsch_is_coordinator ? "coordinator": "node"); - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -turn_off(void) -{ - NETSTACK_RADIO.off(); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -max_payload(void) -{ - /* Setup security... before. */ - return TSCH_PACKET_MAX_LEN - NETSTACK_FRAMER.length(); -} -/*---------------------------------------------------------------------------*/ -const struct mac_driver tschmac_driver = { - "TSCH", - tsch_init, - send_packet, - packet_input, - turn_on, - turn_off, - max_payload, -}; -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/mac/tsch/tsch.h b/os/net/mac/tsch/tsch.h deleted file mode 100644 index 6991c08c4..000000000 --- a/os/net/mac/tsch/tsch.h +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2015, SICS Swedish ICT. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** -* \ingroup link-layer -* \defgroup tsch 802.15.4 TSCH -The IEEE 802.15.4-2015 TimeSlotted Channel Hopping (TSCH) protocol. Provides -scheduled communication on top of a globally-synchronized network. Performs -frequency hopping for enhanced reliability. -* @{ -* \file -* Main API declarations for TSCH. -*/ - -#ifndef __TSCH_H__ -#define __TSCH_H__ - -/********** Includes **********/ - -#include "contiki.h" -#include "net/mac/mac.h" -#include "net/linkaddr.h" - -#include "net/mac/tsch/tsch-conf.h" -#include "net/mac/tsch/tsch-const.h" -#include "net/mac/tsch/tsch-types.h" -#include "net/mac/tsch/tsch-adaptive-timesync.h" -#include "net/mac/tsch/tsch-slot-operation.h" -#include "net/mac/tsch/tsch-queue.h" -#include "net/mac/tsch/tsch-log.h" -#include "net/mac/tsch/tsch-packet.h" -#include "net/mac/tsch/tsch-security.h" -#include "net/mac/tsch/tsch-schedule.h" -#include "net/mac/tsch/tsch-stats.h" -#if UIP_CONF_IPV6_RPL -#include "net/mac/tsch/tsch-rpl.h" -#endif /* UIP_CONF_IPV6_RPL */ - - -/* Include Arch-Specific conf */ -#ifdef TSCH_CONF_ARCH_HDR_PATH -#include TSCH_CONF_ARCH_HDR_PATH -#endif /* TSCH_CONF_ARCH_HDR_PATH */ - -/*********** Callbacks *********/ - -/* Link callbacks to RPL in case RPL is enabled */ -#if UIP_CONF_IPV6_RPL - -#ifndef TSCH_CALLBACK_JOINING_NETWORK -#define TSCH_CALLBACK_JOINING_NETWORK tsch_rpl_callback_joining_network -#endif /* TSCH_CALLBACK_JOINING_NETWORK */ - -#ifndef TSCH_CALLBACK_LEAVING_NETWORK -#define TSCH_CALLBACK_LEAVING_NETWORK tsch_rpl_callback_leaving_network -#endif /* TSCH_CALLBACK_LEAVING_NETWORK */ - -#ifndef TSCH_CALLBACK_KA_SENT -#define TSCH_CALLBACK_KA_SENT tsch_rpl_callback_ka_sent -#endif /* TSCH_CALLBACK_KA_SENT */ - -#ifndef TSCH_RPL_CHECK_DODAG_JOINED -#define TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined -#endif /* TSCH_RPL_CHECK_DODAG_JOINED */ - -#endif /* UIP_CONF_IPV6_RPL */ - -#if BUILD_WITH_ORCHESTRA - -#ifndef TSCH_CALLBACK_NEW_TIME_SOURCE -#define TSCH_CALLBACK_NEW_TIME_SOURCE orchestra_callback_new_time_source -#endif /* TSCH_CALLBACK_NEW_TIME_SOURCE */ - -#ifndef TSCH_CALLBACK_PACKET_READY -#define TSCH_CALLBACK_PACKET_READY orchestra_callback_packet_ready -#endif /* TSCH_CALLBACK_PACKET_READY */ - -#endif /* BUILD_WITH_ORCHESTRA */ - -/* Called by TSCH when joining a network */ -#ifdef TSCH_CALLBACK_JOINING_NETWORK -void TSCH_CALLBACK_JOINING_NETWORK(); -#endif - -/* Called by TSCH when leaving a network */ -#ifdef TSCH_CALLBACK_LEAVING_NETWORK -void TSCH_CALLBACK_LEAVING_NETWORK(); -#endif - -/* Called by TSCH after sending a keep-alive */ -#ifdef TSCH_CALLBACK_KA_SENT -void TSCH_CALLBACK_KA_SENT(); -#endif - -/* Called by TSCH before sending a EB */ -#ifdef TSCH_RPL_CHECK_DODAG_JOINED -int TSCH_RPL_CHECK_DODAG_JOINED(); -#endif - -/* Called by TSCH form interrupt after receiving a frame, enabled upper-layer to decide - * whether to ACK or NACK */ -#ifdef TSCH_CALLBACK_DO_NACK -int TSCH_CALLBACK_DO_NACK(struct tsch_link *link, linkaddr_t *src, linkaddr_t *dst); -#endif - -/* Called by TSCH when switching time source */ -#ifdef TSCH_CALLBACK_NEW_TIME_SOURCE -struct tsch_neighbor; -void TSCH_CALLBACK_NEW_TIME_SOURCE(const struct tsch_neighbor *old, const struct tsch_neighbor *new); -#endif - -/* Called by TSCH every time a packet is ready to be added to the send queue */ -#ifdef TSCH_CALLBACK_PACKET_READY -void TSCH_CALLBACK_PACKET_READY(void); -#endif - -/***** External Variables *****/ - -/* Are we coordinator of the TSCH network? */ -extern int tsch_is_coordinator; -/* Are we associated to a TSCH network? */ -extern int tsch_is_associated; -/* Is the PAN running link-layer security? */ -extern int tsch_is_pan_secured; -/* The TSCH MAC driver */ -extern const struct mac_driver tschmac_driver; -/* 802.15.4 broadcast MAC address */ -extern const linkaddr_t tsch_broadcast_address; -/* The address we use to identify EB queue */ -extern const linkaddr_t tsch_eb_address; -/* The current Absolute Slot Number (ASN) */ -extern struct tsch_asn_t tsch_current_asn; -extern uint8_t tsch_join_priority; -extern struct tsch_link *current_link; -/* If we are inside a slot, this tells the current channel */ -extern uint8_t tsch_current_channel; -/* TSCH channel hopping sequence */ -extern uint8_t tsch_hopping_sequence[TSCH_HOPPING_SEQUENCE_MAX_LEN]; -extern struct tsch_asn_divisor_t tsch_hopping_sequence_length; -/* TSCH timeslot timing (in micro-second) */ -extern tsch_timeslot_timing_usec tsch_timing_us; -/* TSCH timeslot timing (in rtimer ticks) */ -extern tsch_timeslot_timing_ticks tsch_timing; -/* Statistics on the current session */ -extern unsigned long tx_count; -extern unsigned long rx_count; -extern unsigned long sync_count; -extern int32_t min_drift_seen; -extern int32_t max_drift_seen; -/* The TSCH standard 10ms timeslot timing */ -extern const tsch_timeslot_timing_usec tsch_timeslot_timing_us_10000; - -/* TSCH processes */ -PROCESS_NAME(tsch_process); -PROCESS_NAME(tsch_send_eb_process); -PROCESS_NAME(tsch_pending_events_process); - - -/********** Functions *********/ - -/** - * Set the TSCH join priority (JP) - * - * \param jp the new join priority - */ -void tsch_set_join_priority(uint8_t jp); -/** - * Set the period at wich TSCH enhanced beacons (EBs) are sent. The period can - * not be set to exceed TSCH_MAX_EB_PERIOD. Set to 0 to stop sending EBs. - * Actual transmissions are jittered, spaced by a random number within - * [period*0.75, period[ - * - * \param period The period in Clock ticks. - */ -void tsch_set_eb_period(uint32_t period); -/** - * Set the desynchronization timeout after which a node sends a unicasst - * keep-alive (KA) to its time source. Set to 0 to stop sending KAs. The - * actual timeout is a random number within - * [timeout*0.9, timeout[ - * - * \param timeout The timeout in Clock ticks. - */ -void tsch_set_ka_timeout(uint32_t timeout); -/** - * Set the node as PAN coordinator - * - * \param enable 1 to be coordinator, 0 to be a node - */ -void tsch_set_coordinator(int enable); -/** - * Enable/disable security. If done at the coordinator, the Information - * will be included in EBs, and all nodes will adopt the same security level. - * Enabling requires compilation with LLSEC802154_ENABLED set. - * Note: when LLSEC802154_ENABLED is set, nodes boot with security enabled. - * - * \param enable 1 to enable security, 0 to disable it - */ -void tsch_set_pan_secured(int enable); -/** - * Schedule a keep-alive transmission within [timeout*0.9, timeout[ - * @see tsch_set_ka_timeout - */ -void tsch_schedule_keepalive(void); -/** - * Schedule a keep-alive immediately - */ -void tsch_schedule_keepalive_immediately(void); -/** - * Get the time, in clock ticks, since the TSCH network was started. - * - * \return The network uptime, or -1 if the node is not part of a TSCH network. - */ -uint64_t tsch_get_network_uptime_ticks(void); -/** - * Leave the TSCH network we are currently in - */ -void tsch_disassociate(void); - -#endif /* __TSCH_H__ */ -/** @} */ diff --git a/os/net/nbr-table.c b/os/net/nbr-table.c deleted file mode 100644 index 588315e58..000000000 --- a/os/net/nbr-table.c +++ /dev/null @@ -1,471 +0,0 @@ -/* - * Copyright (c) 2013, Swedish Institute of Computer Science - * Copyright (c) 2010, Vrije Universiteit Brussel - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * Authors: Simon Duquennoy - * Joris Borms - */ - -#include "contiki.h" - -#include -#include -#include "lib/memb.h" -#include "lib/list.h" -#include "net/nbr-table.h" - -#define DEBUG 0 -#if DEBUG -#include -#include "sys/ctimer.h" -static void handle_periodic_timer(void *ptr); -static struct ctimer periodic_timer; -static uint8_t initialized = 0; -static void print_table(); -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/* This is the callback function that will be called when there is a - * nbr-policy active - **/ -#ifdef NBR_TABLE_FIND_REMOVABLE -const linkaddr_t *NBR_TABLE_FIND_REMOVABLE(nbr_table_reason_t reason, void *data); -#endif /* NBR_TABLE_FIND_REMOVABLE */ - - -/* List of link-layer addresses of the neighbors, used as key in the tables */ -typedef struct nbr_table_key { - struct nbr_table_key *next; - linkaddr_t lladdr; -} nbr_table_key_t; - -/* For each neighbor, a map of the tables that use the neighbor. - * As we are using uint8_t, we have a maximum of 8 tables in the system */ -static uint8_t used_map[NBR_TABLE_MAX_NEIGHBORS]; -/* For each neighbor, a map of the tables that lock the neighbor */ -static uint8_t locked_map[NBR_TABLE_MAX_NEIGHBORS]; -/* The maximum number of tables */ -#define MAX_NUM_TABLES 8 -/* A list of pointers to tables in use */ -static struct nbr_table *all_tables[MAX_NUM_TABLES]; -/* The current number of tables */ -static unsigned num_tables; - -/* The neighbor address table */ -MEMB(neighbor_addr_mem, nbr_table_key_t, NBR_TABLE_MAX_NEIGHBORS); -LIST(nbr_table_keys); - -/*---------------------------------------------------------------------------*/ -/* Get a key from a neighbor index */ -static nbr_table_key_t * -key_from_index(int index) -{ - return index != -1 ? &((nbr_table_key_t *)neighbor_addr_mem.mem)[index] : NULL; -} -/*---------------------------------------------------------------------------*/ -/* Get an item from its neighbor index */ -static nbr_table_item_t * -item_from_index(nbr_table_t *table, int index) -{ - return table != NULL && index != -1 ? (char *)table->data + index * table->item_size : NULL; -} -/*---------------------------------------------------------------------------*/ -/* Get the neighbor index of an item */ -static int -index_from_key(nbr_table_key_t *key) -{ - return key != NULL ? key - (nbr_table_key_t *)neighbor_addr_mem.mem : -1; -} -/*---------------------------------------------------------------------------*/ -/* Get the neighbor index of an item */ -static int -index_from_item(nbr_table_t *table, const nbr_table_item_t *item) -{ - return table != NULL && item != NULL ? ((int)((char *)item - (char *)table->data)) / table->item_size : -1; -} -/*---------------------------------------------------------------------------*/ -/* Get an item from its key */ -static nbr_table_item_t * -item_from_key(nbr_table_t *table, nbr_table_key_t *key) -{ - return item_from_index(table, index_from_key(key)); -} -/*---------------------------------------------------------------------------*/ -/* Get the key af an item */ -static nbr_table_key_t * -key_from_item(nbr_table_t *table, const nbr_table_item_t *item) -{ - return key_from_index(index_from_item(table, item)); -} -/*---------------------------------------------------------------------------*/ -/* Get the index of a neighbor from its link-layer address */ -static int -index_from_lladdr(const linkaddr_t *lladdr) -{ - nbr_table_key_t *key; - /* Allow lladdr-free insertion, useful e.g. for IPv6 ND. - * Only one such entry is possible at a time, indexed by linkaddr_null. */ - if(lladdr == NULL) { - lladdr = &linkaddr_null; - } - key = list_head(nbr_table_keys); - while(key != NULL) { - if(lladdr && linkaddr_cmp(lladdr, &key->lladdr)) { - return index_from_key(key); - } - key = list_item_next(key); - } - return -1; -} -/*---------------------------------------------------------------------------*/ -/* Get bit from "used" or "locked" bitmap */ -static int -nbr_get_bit(uint8_t *bitmap, nbr_table_t *table, nbr_table_item_t *item) -{ - int item_index = index_from_item(table, item); - if(table != NULL && item_index != -1) { - return (bitmap[item_index] & (1 << table->index)) != 0; - } else { - return 0; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/* Set bit in "used" or "locked" bitmap */ -static int -nbr_set_bit(uint8_t *bitmap, nbr_table_t *table, nbr_table_item_t *item, int value) -{ - int item_index = index_from_item(table, item); - - if(table != NULL && item_index != -1) { - if(value) { - bitmap[item_index] |= 1 << table->index; - } else { - bitmap[item_index] &= ~(1 << table->index); - } - return 1; - } else { - return 0; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -remove_key(nbr_table_key_t *least_used_key) -{ - int i; - for(i = 0; i < MAX_NUM_TABLES; i++) { - if(all_tables[i] != NULL && all_tables[i]->callback != NULL) { - /* Call table callback for each table that uses this item */ - nbr_table_item_t *removed_item = item_from_key(all_tables[i], least_used_key); - if(nbr_get_bit(used_map, all_tables[i], removed_item) == 1) { - all_tables[i]->callback(removed_item); - } - } - } - /* Empty used map */ - used_map[index_from_key(least_used_key)] = 0; - /* Remove neighbor from list */ - list_remove(nbr_table_keys, least_used_key); -} -/*---------------------------------------------------------------------------*/ -static nbr_table_key_t * -nbr_table_allocate(nbr_table_reason_t reason, void *data) -{ - nbr_table_key_t *key; - int least_used_count = 0; - nbr_table_key_t *least_used_key = NULL; - - key = memb_alloc(&neighbor_addr_mem); - if(key != NULL) { - return key; - } else { -#ifdef NBR_TABLE_FIND_REMOVABLE - const linkaddr_t *lladdr; - lladdr = NBR_TABLE_FIND_REMOVABLE(reason, data); - if(lladdr == NULL) { - /* Nothing found that can be deleted - return NULL to indicate failure */ - PRINTF("*** Not removing entry to allocate new\n"); - return NULL; - } else { - /* used least_used_key to indicate what is the least useful entry */ - int index; - int locked = 0; - if((index = index_from_lladdr(lladdr)) != -1) { - least_used_key = key_from_index(index); - locked = locked_map[index]; - } - /* Allow delete of locked item? */ - if(least_used_key != NULL && locked) { - PRINTF("Deleting locked item!\n"); - locked_map[index] = 0; - } - } -#endif /* NBR_TABLE_FIND_REMOVABLE */ - - if(least_used_key == NULL) { - /* No more space, try to free a neighbor. - * The replacement policy is the following: remove neighbor that is: - * (1) not locked - * (2) used by fewest tables - * (3) oldest (the list is ordered by insertion time) - * */ - /* Get item from first key */ - key = list_head(nbr_table_keys); - while(key != NULL) { - int item_index = index_from_key(key); - int locked = locked_map[item_index]; - /* Never delete a locked item */ - if(!locked) { - int used = used_map[item_index]; - int used_count = 0; - /* Count how many tables are using this item */ - while(used != 0) { - if((used & 1) == 1) { - used_count++; - } - used >>= 1; - } - /* Find least used item */ - if(least_used_key == NULL || used_count < least_used_count) { - least_used_key = key; - least_used_count = used_count; - if(used_count == 0) { /* We won't find any least used item */ - break; - } - } - } - key = list_item_next(key); - } - } - - if(least_used_key == NULL) { - /* We haven't found any unlocked item, allocation fails */ - return NULL; - } else { - /* Reuse least used item */ - remove_key(least_used_key); - return least_used_key; - } - } -} -/*---------------------------------------------------------------------------*/ -/* Register a new neighbor table. To be used at initialization by modules - * using a neighbor table */ -int -nbr_table_register(nbr_table_t *table, nbr_table_callback *callback) -{ -#if DEBUG - if(!initialized) { - initialized = 1; - /* schedule a debug printout per minute */ - ctimer_set(&periodic_timer, CLOCK_SECOND * 60, handle_periodic_timer, NULL); - } -#endif - - if(nbr_table_is_registered(table)) { - /* Table already registered, just update callback */ - table->callback = callback; - return 1; - } - - if(num_tables < MAX_NUM_TABLES) { - table->index = num_tables++; - table->callback = callback; - all_tables[table->index] = table; - return 1; - } else { - /* Maximum number of tables exceeded */ - return 0; - } -} -/*---------------------------------------------------------------------------*/ -/* Test whether a specified table has been registered or not */ -int -nbr_table_is_registered(nbr_table_t *table) -{ - if(table != NULL && table->index >= 0 && table->index < MAX_NUM_TABLES - && all_tables[table->index] == table) { - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/* Returns the first item of the current table */ -nbr_table_item_t * -nbr_table_head(nbr_table_t *table) -{ - /* Get item from first key */ - nbr_table_item_t *item = item_from_key(table, list_head(nbr_table_keys)); - /* Item is the first neighbor, now check is it is in the current table */ - if(nbr_get_bit(used_map, table, item)) { - return item; - } else { - return nbr_table_next(table, item); - } -} -/*---------------------------------------------------------------------------*/ -/* Iterates over the current table */ -nbr_table_item_t * -nbr_table_next(nbr_table_t *table, nbr_table_item_t *item) -{ - do { - void *key = key_from_item(table, item); - key = list_item_next(key); - /* Loop until the next item is in the current table */ - item = item_from_key(table, key); - } while(item && !nbr_get_bit(used_map, table, item)); - return item; -} -/*---------------------------------------------------------------------------*/ -/* Add a neighbor indexed with its link-layer address */ -nbr_table_item_t * -nbr_table_add_lladdr(nbr_table_t *table, const linkaddr_t *lladdr, nbr_table_reason_t reason, void *data) -{ - int index; - nbr_table_item_t *item; - nbr_table_key_t *key; - - if(table == NULL) { - return NULL; - } - - /* Allow lladdr-free insertion, useful e.g. for IPv6 ND. - * Only one such entry is possible at a time, indexed by linkaddr_null. */ - if(lladdr == NULL) { - lladdr = &linkaddr_null; - } - - if((index = index_from_lladdr(lladdr)) == -1) { - /* Neighbor not yet in table, let's try to allocate one */ - key = nbr_table_allocate(reason, data); - - /* No space available for new entry */ - if(key == NULL) { - return NULL; - } - - /* Add neighbor to list */ - list_add(nbr_table_keys, key); - - /* Get index from newly allocated neighbor */ - index = index_from_key(key); - - /* Set link-layer address */ - linkaddr_copy(&key->lladdr, lladdr); - } - - /* Get item in the current table */ - item = item_from_index(table, index); - - /* Initialize item data and set "used" bit */ - memset(item, 0, table->item_size); - nbr_set_bit(used_map, table, item, 1); - -#if DEBUG - print_table(); -#endif - return item; -} -/*---------------------------------------------------------------------------*/ -/* Get an item from its link-layer address */ -void * -nbr_table_get_from_lladdr(nbr_table_t *table, const linkaddr_t *lladdr) -{ - void *item = item_from_index(table, index_from_lladdr(lladdr)); - return nbr_get_bit(used_map, table, item) ? item : NULL; -} -/*---------------------------------------------------------------------------*/ -/* Removes a neighbor from the current table (unset "used" bit) */ -int -nbr_table_remove(nbr_table_t *table, void *item) -{ - int ret = nbr_set_bit(used_map, table, item, 0); - nbr_set_bit(locked_map, table, item, 0); - return ret; -} -/*---------------------------------------------------------------------------*/ -/* Lock a neighbor for the current table (set "locked" bit) */ -int -nbr_table_lock(nbr_table_t *table, void *item) -{ -#if DEBUG - int i = index_from_item(table, item); - PRINTF("*** Lock %d\n", i); -#endif - return nbr_set_bit(locked_map, table, item, 1); -} -/*---------------------------------------------------------------------------*/ -/* Release the lock on a neighbor for the current table (unset "locked" bit) */ -int -nbr_table_unlock(nbr_table_t *table, void *item) -{ -#if DEBUG - int i = index_from_item(table, item); - PRINTF("*** Unlock %d\n", i); -#endif - return nbr_set_bit(locked_map, table, item, 0); -} -/*---------------------------------------------------------------------------*/ -/* Get link-layer address of an item */ -linkaddr_t * -nbr_table_get_lladdr(nbr_table_t *table, const void *item) -{ - nbr_table_key_t *key = key_from_item(table, item); - return key != NULL ? &key->lladdr : NULL; -} -/*---------------------------------------------------------------------------*/ -#if DEBUG -static void -print_table() -{ - int i, j; - /* Printout all neighbors and which tables they are used in */ - PRINTF("NBR TABLE:\n"); - for(i = 0; i < NBR_TABLE_MAX_NEIGHBORS; i++) { - if(used_map[i] > 0) { - PRINTF(" %02d %02d",i , key_from_index(i)->lladdr.u8[LINKADDR_SIZE - 1]); - for(j = 0; j < num_tables; j++) { - PRINTF(" [%d:%d]", (used_map[i] & (1 << j)) != 0, - (locked_map[i] & (1 << j)) != 0); - } - PRINTF("\n"); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -handle_periodic_timer(void *ptr) -{ - print_table(); - ctimer_reset(&periodic_timer); -} -#endif diff --git a/os/net/nbr-table.h b/os/net/nbr-table.h deleted file mode 100644 index 0dccd1092..000000000 --- a/os/net/nbr-table.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2013, Swedish Institute of Computer Science - * Copyright (c) 2010, Vrije Universiteit Brussel - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * Authors: Simon Duquennoy - * Joris Borms - */ - -#ifndef NBR_TABLE_H_ -#define NBR_TABLE_H_ - -#include "contiki.h" -#include "net/linkaddr.h" -#include "net/netstack.h" - -/* Neighbor table size */ -#ifdef NBR_TABLE_CONF_MAX_NEIGHBORS -#define NBR_TABLE_MAX_NEIGHBORS NBR_TABLE_CONF_MAX_NEIGHBORS -#else /* NBR_TABLE_CONF_MAX_NEIGHBORS */ -#define NBR_TABLE_MAX_NEIGHBORS 8 -#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ - -/* An item in a neighbor table */ -typedef void nbr_table_item_t; - -/* Callback function, called when removing an item from a table */ -typedef void(nbr_table_callback)(nbr_table_item_t *item); - -/* A neighbor table */ -typedef struct nbr_table { - int index; - int item_size; - nbr_table_callback *callback; - nbr_table_item_t *data; -} nbr_table_t; - -/** \brief A static neighbor table. To be initialized through nbr_table_register(name) */ -#define NBR_TABLE(type, name) \ - static type _##name##_mem[NBR_TABLE_MAX_NEIGHBORS]; \ - static nbr_table_t name##_struct = { 0, sizeof(type), NULL, (nbr_table_item_t *)_##name##_mem }; \ - static nbr_table_t *name = &name##_struct \ - -/** \brief A non-static neighbor table. To be initialized through nbr_table_register(name) */ -#define NBR_TABLE_GLOBAL(type, name) \ - static type _##name##_mem[NBR_TABLE_MAX_NEIGHBORS]; \ - static nbr_table_t name##_struct = { 0, sizeof(type), NULL, (nbr_table_item_t *)_##name##_mem }; \ - nbr_table_t *name = &name##_struct \ - -/** \brief Declaration of non-static neighbor tables */ -#define NBR_TABLE_DECLARE(name) extern nbr_table_t *name - -typedef enum { - NBR_TABLE_REASON_UNDEFINED, - NBR_TABLE_REASON_RPL_DIO, - NBR_TABLE_REASON_RPL_DAO, - NBR_TABLE_REASON_RPL_DIS, - NBR_TABLE_REASON_ROUTE, - NBR_TABLE_REASON_IPV6_ND, - NBR_TABLE_REASON_IPV6_ND_AUTOFILL, - NBR_TABLE_REASON_MAC, - NBR_TABLE_REASON_LLSEC, - NBR_TABLE_REASON_LINK_STATS, - NBR_TABLE_REASON_SIXTOP, -} nbr_table_reason_t; - -/** \name Neighbor tables: register and loop through table elements */ -/** @{ */ -int nbr_table_register(nbr_table_t *table, nbr_table_callback *callback); -int nbr_table_is_registered(nbr_table_t *table); -nbr_table_item_t *nbr_table_head(nbr_table_t *table); -nbr_table_item_t *nbr_table_next(nbr_table_t *table, nbr_table_item_t *item); -/** @} */ - -/** \name Neighbor tables: add and get data */ -/** @{ */ -nbr_table_item_t *nbr_table_add_lladdr(nbr_table_t *table, const linkaddr_t *lladdr, nbr_table_reason_t reason, void *data); -nbr_table_item_t *nbr_table_get_from_lladdr(nbr_table_t *table, const linkaddr_t *lladdr); -/** @} */ - -/** \name Neighbor tables: set flags (unused, locked, unlocked) */ -/** @{ */ -int nbr_table_remove(nbr_table_t *table, nbr_table_item_t *item); -int nbr_table_lock(nbr_table_t *table, nbr_table_item_t *item); -int nbr_table_unlock(nbr_table_t *table, nbr_table_item_t *item); -/** @} */ - -/** \name Neighbor tables: address manipulation */ -/** @{ */ -linkaddr_t *nbr_table_get_lladdr(nbr_table_t *table, const nbr_table_item_t *item); -/** @} */ - -#endif /* NBR_TABLE_H_ */ diff --git a/os/net/net-debug.c b/os/net/net-debug.c deleted file mode 100644 index deec18cb2..000000000 --- a/os/net/net-debug.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A set of debugging tools for the IP stack - * \author - * Nicolas Tsiftes - * Niclas Finne - * Joakim Eriksson - * Simon Duquennoy - */ - -#include "net/net-debug.h" - -/*---------------------------------------------------------------------------*/ -void -net_debug_lladdr_print(const uip_lladdr_t *addr) -{ - if(addr == NULL) { - PRINTA("(NULL LL addr)"); - return; - } else { - unsigned int i; - for(i = 0; i < LINKADDR_SIZE; i++) { - if(i > 0 && i % 2 == 0) { - PRINTA("."); - } - PRINTA("%02x", addr->addr[i]); - } - } -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/net-debug.h b/os/net/net-debug.h deleted file mode 100644 index e724df195..000000000 --- a/os/net/net-debug.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * A set of debugging macros for the netstack - * - * \author Nicolas Tsiftes - * Niclas Finne - * Joakim Eriksson - * Simon Duquennoy - */ - -#ifndef NET_DEBUG_H -#define NET_DEBUG_H - -#include "net/ipv6/uip.h" -#include "net/linkaddr.h" -#include - -void net_debug_lladdr_print(const uip_lladdr_t *addr); - -#define DEBUG_NONE 0 -#define DEBUG_PRINT 1 -#define DEBUG_ANNOTATE 2 -#define DEBUG_FULL DEBUG_ANNOTATE | DEBUG_PRINT - -/* PRINTA will always print if the debug routines are called directly */ -#define PRINTA(...) printf(__VA_ARGS__) - -#if (DEBUG) & DEBUG_ANNOTATE -#define ANNOTATE(...) printf(__VA_ARGS__) -#else -#define ANNOTATE(...) -#endif /* (DEBUG) & DEBUG_ANNOTATE */ - -#if (DEBUG) & DEBUG_PRINT -#define PRINTF(...) printf(__VA_ARGS__) -#define PRINTLLADDR(lladdr) net_debug_lladdr_print(lladdr) -#else -#define PRINTF(...) -#define PRINTLLADDR(lladdr) -#endif /* (DEBUG) & DEBUG_PRINT */ - -#endif /* NET_DEBUG_H */ diff --git a/os/net/netstack.c b/os/net/netstack.c deleted file mode 100644 index 34b32c9b7..000000000 --- a/os/net/netstack.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Initialiation file for the Contiki low-layer network stack (NETSTACK) - * \author - * Adam Dunkels - */ - -#include "net/netstack.h" -#include "lib/list.h" - -/* The list of IP processors that will process IP packets before uip or after */ -LIST(ip_processor_list); - -/* Note: localdest is only used for the output callback */ -enum netstack_ip_action -netstack_process_ip_callback(uint8_t type, const linkaddr_t *localdest) -{ - enum netstack_ip_action action = NETSTACK_IP_PROCESS; - struct netstack_ip_packet_processor *p; - for(p = list_head(ip_processor_list); - p != NULL; - p = list_item_next(p)) { - if(type == NETSTACK_IP_OUTPUT) { - if(p->process_output != NULL) { - action = p->process_output(localdest); - } - } else if(type == NETSTACK_IP_INPUT) { - if(p->process_input != NULL) { - action = p->process_input(); - } - } - /* if not NETSTACK_IP_PROCESS - quit and return the desired action */ - if(action != NETSTACK_IP_PROCESS) - return action; - } - return action; -} -/*---------------------------------------------------------------------------*/ -void -netstack_ip_packet_processor_add(struct netstack_ip_packet_processor *p) -{ - if(p != NULL) { - list_add(ip_processor_list, p); - } -} -/*---------------------------------------------------------------------------*/ -void -uip_ds6_ip_packet_processor_rm(struct netstack_ip_packet_processor *p) - { - list_remove(ip_processor_list, p); -} - -/*---------------------------------------------------------------------------*/ -void -netstack_init(void) -{ - NETSTACK_RADIO.init(); - NETSTACK_MAC.init(); - NETSTACK_NETWORK.init(); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/netstack.h b/os/net/netstack.h deleted file mode 100644 index 941bbfeb2..000000000 --- a/os/net/netstack.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * $Id: netstack.h,v 1.6 2010/10/03 20:37:32 adamdunkels Exp $ - */ - -/** - * \file - * Include file for the Contiki low-layer network stack (NETSTACK) - * \author - * Adam Dunkels - */ - -#ifndef NETSTACK_H -#define NETSTACK_H - -#include "contiki.h" - -/* Routing protocol configuration. The Routing protocol is configured through the Makefile, - via the flag MAKE_ROUTING */ -#ifdef NETSTACK_CONF_ROUTING -#define NETSTACK_ROUTING NETSTACK_CONF_ROUTING -#else /* NETSTACK_CONF_ROUTING */ -#if ROUTING_CONF_RPL_LITE -#define NETSTACK_ROUTING rpl_lite_driver -#elif ROUTING_CONF_RPL_CLASSIC -#define NETSTACK_ROUTING rpl_classic_driver -#elif ROUTING_CONF_NULLROUTING -#define NETSTACK_ROUTING nullrouting_driver -#else -#error Unknown ROUTING configuration -#endif -#endif /* NETSTACK_CONF_ROUTING */ - -/* Network layer configuration. The NET layer is configured through the Makefile, - via the flag MAKE_NET */ -#ifdef NETSTACK_CONF_NETWORK -#define NETSTACK_NETWORK NETSTACK_CONF_NETWORK -#else /* NETSTACK_CONF_NETWORK */ -#if NETSTACK_CONF_WITH_IPV6 -#define NETSTACK_NETWORK sicslowpan_driver -#elif NETSTACK_CONF_WITH_NULLNET -#define NETSTACK_NETWORK nullnet_driver -#else -#error Unknown NET configuration -#endif -#endif /* NETSTACK_CONF_NETWORK */ - -/* MAC layer configuration. The MAC layer is configured through the Makefile, - via the flag MAKE_MAC */ -#ifdef NETSTACK_CONF_MAC -#define NETSTACK_MAC NETSTACK_CONF_MAC -#else /* NETSTACK_CONF_MAC */ -#if MAC_CONF_WITH_NULLMAC -#define NETSTACK_MAC nullmac_driver -#elif MAC_CONF_WITH_CSMA -#define NETSTACK_MAC csma_driver -#elif MAC_CONF_WITH_TSCH -#define NETSTACK_MAC tschmac_driver -#elif MAC_CONF_WITH_BLE -#define NETSTACK_MAC ble_l2cap_driver -#else -#error Unknown MAC configuration -#endif -#endif /* NETSTACK_CONF_MAC */ - -/* Radio driver configuration. Most often set by the platform. */ -#ifdef NETSTACK_CONF_RADIO -#define NETSTACK_RADIO NETSTACK_CONF_RADIO -#else /* NETSTACK_CONF_RADIO */ -#define NETSTACK_RADIO nullradio_driver -#endif /* NETSTACK_CONF_RADIO */ - -/* Framer selection. The framer is used by the MAC implementation - to build and parse frames. */ -#ifdef NETSTACK_CONF_FRAMER -#define NETSTACK_FRAMER NETSTACK_CONF_FRAMER -#else /* NETSTACK_CONF_FRAMER */ -#define NETSTACK_FRAMER framer_802154 -#endif /* NETSTACK_CONF_FRAMER */ - -#include "net/mac/mac.h" -#include "net/mac/framer/framer.h" -#include "dev/radio.h" -#include "net/linkaddr.h" - -/** - * The structure of a network driver in Contiki. - */ -struct network_driver { - char *name; - - /** Initialize the network driver */ - void (*init)(void); - - /** Callback for getting notified of incoming packet in packetbuf. */ - void (*input)(void); - - /** Output funtion, sends from uipbuf. */ - uint8_t (*output)(const linkaddr_t *localdest); -}; - -extern const struct routing_driver NETSTACK_ROUTING; -extern const struct network_driver NETSTACK_NETWORK; -extern const struct mac_driver NETSTACK_MAC; -extern const struct radio_driver NETSTACK_RADIO; -extern const struct framer NETSTACK_FRAMER; - -void netstack_init(void); - -/* Netstack ip_packet_processor - for implementing packet filters, firewalls, - debuggin info, etc */ - -enum netstack_ip_action { - NETSTACK_IP_PROCESS = 0, /* Default behaviour - nothing else */ - NETSTACK_IP_DROP = 1, /* Drop this packet before processing/sending anymore */ -}; - -enum netstack_ip_callback_type { - NETSTACK_IP_INPUT = 0, - NETSTACK_IP_OUTPUT = 1, -}; - -struct netstack_ip_packet_processor { - struct netstack_ip_packet_processor *next; - enum netstack_ip_action (*process_input)(void); - enum netstack_ip_action (*process_output)(const linkaddr_t * localdest); -}; - -/* This function is intended for the IP stack to call whenever input/output - callback needs to be called */ -enum netstack_ip_action netstack_process_ip_callback(uint8_t type, const linkaddr_t *localdest); - -void netstack_ip_packet_processor_add(struct netstack_ip_packet_processor *p); -void netstack_ip_packet_processor_remove(struct netstack_ip_packet_processor *p); - -/* Netstack sniffer - this will soon be deprecated... */ - -struct netstack_sniffer { - struct netstack_sniffer *next; - void (*input_callback)(void); - void (*output_callback)(int mac_status); -}; - -#define NETSTACK_SNIFFER(name, input_callback, output_callback) \ - static struct netstack_sniffer name = { NULL, input_callback, output_callback } - -void netstack_sniffer_add(struct netstack_sniffer *s); -void netstack_sniffer_remove(struct netstack_sniffer *s); - -#endif /* NETSTACK_H */ diff --git a/os/net/nullnet/nullnet.c b/os/net/nullnet/nullnet.c deleted file mode 100644 index 298b2e9cd..000000000 --- a/os/net/nullnet/nullnet.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * NullNet, a minimal network layer. - * \author - * Simon Duquennoy - * - */ - -/** - * \addtogroup nullnet - * @{ - */ - -#include "contiki.h" -#include "net/packetbuf.h" -#include "net/netstack.h" -#include "net/nullnet/nullnet.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "NullNet" -#define LOG_LEVEL LOG_LEVEL_NULLNET - -uint8_t *nullnet_buf; -uint16_t nullnet_len; -static nullnet_input_callback current_callback = NULL; -/*--------------------------------------------------------------------*/ -static void -init(void) -{ - LOG_INFO("init\n"); - current_callback = NULL; -} -/*--------------------------------------------------------------------*/ -static void -input(void) -{ - if(current_callback != NULL) { - LOG_INFO("received %u bytes from ", packetbuf_datalen()); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_INFO_("\n"); - current_callback(packetbuf_dataptr(), packetbuf_datalen(), - packetbuf_addr(PACKETBUF_ADDR_SENDER), packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - } -} -/*--------------------------------------------------------------------*/ -void -nullnet_set_input_callback(nullnet_input_callback callback) -{ - current_callback = callback; -} -/*--------------------------------------------------------------------*/ -static uint8_t -output(const linkaddr_t *dest) -{ - packetbuf_clear(); - packetbuf_copyfrom(nullnet_buf, nullnet_len); - if(dest != NULL) { - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, dest); - } else { - packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &linkaddr_null); - } - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); - LOG_INFO("sending %u bytes to ", packetbuf_datalen()); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); - LOG_INFO_("\n"); - NETSTACK_MAC.send(NULL, NULL); - return 1; -} -/*--------------------------------------------------------------------*/ -const struct network_driver nullnet_driver = { - "nullnet", - init, - input, - output -}; -/*--------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/nullnet/nullnet.h b/os/net/nullnet/nullnet.h deleted file mode 100644 index 35b58effe..000000000 --- a/os/net/nullnet/nullnet.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * NullNet, a minimal network layer. - * \author - * Simon Duquennoy - * - */ - -/** - * \ingroup net-layer - * \addtogroup nullnet -A network layer that does nothing. Useful for lower-layer testing and -for non-IPv6 scenarios. - * @{ - */ - -#ifndef NULLNET_H_ -#define NULLNET_H_ - -#include "contiki.h" -#include "net/linkaddr.h" - -/** - * Buffer used by the output function -*/ -extern uint8_t *nullnet_buf; -extern uint16_t nullnet_len; - -/** - * Function prototype for NullNet input callback -*/ -typedef void (* nullnet_input_callback)(const void *data, uint16_t len, - const linkaddr_t *src, const linkaddr_t *dest); - -/** - * Set input callback for NullNet - * - * \param callback The input callback -*/ -void nullnet_set_input_callback(nullnet_input_callback callback); - -#endif /* NULLNET_H_ */ -/** @} */ diff --git a/os/net/packetbuf.c b/os/net/packetbuf.c deleted file mode 100644 index 26260847e..000000000 --- a/os/net/packetbuf.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Packet buffer (packetbuf) management - * \author - * Adam Dunkels - */ - -/** - * \addtogroup packetbuf - * @{ - */ - -#include - -#include "contiki-net.h" -#include "net/packetbuf.h" -#include "sys/cc.h" - -struct packetbuf_attr packetbuf_attrs[PACKETBUF_NUM_ATTRS]; -struct packetbuf_addr packetbuf_addrs[PACKETBUF_NUM_ADDRS]; - - -static uint16_t buflen, bufptr; -static uint8_t hdrlen; - -/* The declarations below ensure that the packet buffer is aligned on - an even 32-bit boundary. On some platforms (most notably the - msp430 or OpenRISC), having a potentially misaligned packet buffer may lead to - problems when accessing words. */ -static uint32_t packetbuf_aligned[(PACKETBUF_SIZE + 3) / 4]; -static uint8_t *packetbuf = (uint8_t *)packetbuf_aligned; - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/*---------------------------------------------------------------------------*/ -void -packetbuf_clear(void) -{ - buflen = bufptr = 0; - hdrlen = 0; - - packetbuf_attr_clear(); -} -/*---------------------------------------------------------------------------*/ -int -packetbuf_copyfrom(const void *from, uint16_t len) -{ - uint16_t l; - - packetbuf_clear(); - l = MIN(PACKETBUF_SIZE, len); - memcpy(packetbuf, from, l); - buflen = l; - return l; -} -/*---------------------------------------------------------------------------*/ -int -packetbuf_copyto(void *to) -{ - if(hdrlen + buflen > PACKETBUF_SIZE) { - return 0; - } - memcpy(to, packetbuf_hdrptr(), hdrlen); - memcpy((uint8_t *)to + hdrlen, packetbuf_dataptr(), buflen); - return hdrlen + buflen; -} -/*---------------------------------------------------------------------------*/ -int -packetbuf_hdralloc(int size) -{ - int16_t i; - - if(size + packetbuf_totlen() > PACKETBUF_SIZE) { - return 0; - } - - /* shift data to the right */ - for(i = packetbuf_totlen() - 1; i >= 0; i--) { - packetbuf[i + size] = packetbuf[i]; - } - hdrlen += size; - return 1; -} -/*---------------------------------------------------------------------------*/ -int -packetbuf_hdrreduce(int size) -{ - if(buflen < size) { - return 0; - } - - bufptr += size; - buflen -= size; - return 1; -} -/*---------------------------------------------------------------------------*/ -void -packetbuf_set_datalen(uint16_t len) -{ - PRINTF("packetbuf_set_len: len %d\n", len); - buflen = len; -} -/*---------------------------------------------------------------------------*/ -void * -packetbuf_dataptr(void) -{ - return packetbuf + packetbuf_hdrlen(); -} -/*---------------------------------------------------------------------------*/ -void * -packetbuf_hdrptr(void) -{ - return packetbuf; -} -/*---------------------------------------------------------------------------*/ -uint16_t -packetbuf_datalen(void) -{ - return buflen; -} -/*---------------------------------------------------------------------------*/ -uint8_t -packetbuf_hdrlen(void) -{ - return bufptr + hdrlen; -} -/*---------------------------------------------------------------------------*/ -uint16_t -packetbuf_totlen(void) -{ - return packetbuf_hdrlen() + packetbuf_datalen(); -} -/*---------------------------------------------------------------------------*/ -uint16_t -packetbuf_remaininglen(void) -{ - return PACKETBUF_SIZE - packetbuf_totlen(); -} -/*---------------------------------------------------------------------------*/ -void -packetbuf_attr_clear(void) -{ - int i; - memset(packetbuf_attrs, 0, sizeof(packetbuf_attrs)); - for(i = 0; i < PACKETBUF_NUM_ADDRS; ++i) { - linkaddr_copy(&packetbuf_addrs[i].addr, &linkaddr_null); - } -} -/*---------------------------------------------------------------------------*/ -void -packetbuf_attr_copyto(struct packetbuf_attr *attrs, - struct packetbuf_addr *addrs) -{ - memcpy(attrs, packetbuf_attrs, sizeof(packetbuf_attrs)); - memcpy(addrs, packetbuf_addrs, sizeof(packetbuf_addrs)); -} -/*---------------------------------------------------------------------------*/ -void -packetbuf_attr_copyfrom(struct packetbuf_attr *attrs, - struct packetbuf_addr *addrs) -{ - memcpy(packetbuf_attrs, attrs, sizeof(packetbuf_attrs)); - memcpy(packetbuf_addrs, addrs, sizeof(packetbuf_addrs)); -} -/*---------------------------------------------------------------------------*/ -int -packetbuf_set_attr(uint8_t type, const packetbuf_attr_t val) -{ - packetbuf_attrs[type].val = val; - return 1; -} -/*---------------------------------------------------------------------------*/ -packetbuf_attr_t -packetbuf_attr(uint8_t type) -{ - return packetbuf_attrs[type].val; -} -/*---------------------------------------------------------------------------*/ -int -packetbuf_set_addr(uint8_t type, const linkaddr_t *addr) -{ - linkaddr_copy(&packetbuf_addrs[type - PACKETBUF_ADDR_FIRST].addr, addr); - return 1; -} -/*---------------------------------------------------------------------------*/ -const linkaddr_t * -packetbuf_addr(uint8_t type) -{ - return &packetbuf_addrs[type - PACKETBUF_ADDR_FIRST].addr; -} -/*---------------------------------------------------------------------------*/ -int -packetbuf_holds_broadcast(void) -{ - return linkaddr_cmp(&packetbuf_addrs[PACKETBUF_ADDR_RECEIVER - PACKETBUF_ADDR_FIRST].addr, &linkaddr_null); -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/os/net/packetbuf.h b/os/net/packetbuf.h deleted file mode 100644 index c077ae940..000000000 --- a/os/net/packetbuf.h +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the Packet buffer (packetbuf) management - * \author - * Adam Dunkels - */ - -/** - * \addtogroup net - * @{ - */ - -/** - * \defgroup packetbuf Packet buffer - * @{ - * - * The packetbuf module does Contiki's buffer management. - */ - -#ifndef PACKETBUF_H_ -#define PACKETBUF_H_ - -#include "contiki.h" -#include "net/linkaddr.h" -#include "net/mac/llsec802154.h" -#include "net/mac/csma/csma-security.h" -#include "net/mac/tsch/tsch-conf.h" - -/** - * \brief The size of the packetbuf, in bytes - */ -#ifdef PACKETBUF_CONF_SIZE -#define PACKETBUF_SIZE PACKETBUF_CONF_SIZE -#else -#define PACKETBUF_SIZE 128 -#endif - -/** - * \brief Clear and reset the packetbuf - * - * This function clears the packetbuf and resets all - * internal state pointers (header size, header pointer, - * external data pointer). It is used before preparing a - * packet in the packetbuf. - * - */ -void packetbuf_clear(void); - -/** - * \brief Get a pointer to the data in the packetbuf - * \return Pointer to the packetbuf data - * - * This function is used to get a pointer to the data in - * the packetbuf. The data is either stored in the packetbuf, - * or referenced to an external location. - * - */ -void *packetbuf_dataptr(void); - -/** - * \brief Get a pointer to the header in the packetbuf, for outbound packets - * \return Pointer to the packetbuf header - * - */ -void *packetbuf_hdrptr(void); - -/** - * \brief Get the length of the header in the packetbuf - * \return Length of the header in the packetbuf - * - */ -uint8_t packetbuf_hdrlen(void); - - -/** - * \brief Get the length of the data in the packetbuf - * \return Length of the data in the packetbuf - * - */ -uint16_t packetbuf_datalen(void); - -/** - * \brief Get the total length of the header and data in the packetbuf - * \return Length of data and header in the packetbuf - * - */ -uint16_t packetbuf_totlen(void); - -/** - * \brief Get the total length of the remaining space in the packetbuf - * \return Length of the remaining space in the packetbuf - * - */ -uint16_t packetbuf_remaininglen(void); - -/** - * \brief Set the length of the data in the packetbuf - * \param len The length of the data - */ -void packetbuf_set_datalen(uint16_t len); - -/** - * \brief Copy from external data into the packetbuf - * \param from A pointer to the data from which to copy - * \param len The size of the data to copy - * \retval The number of bytes that was copied into the packetbuf - * - * This function copies data from a pointer into the - * packetbuf. If the data that is to be copied is larger - * than the packetbuf, only the data that fits in the - * packetbuf is copied. The number of bytes that could be - * copied into the rimbuf is returned. - * - */ -int packetbuf_copyfrom(const void *from, uint16_t len); - -/** - * \brief Copy the entire packetbuf to an external buffer - * \param to A pointer to the buffer to which the data is to be copied - * \retval The number of bytes that was copied to the external buffer - * - * This function copies the packetbuf to an external - * buffer. Both the data portion and the header portion of - * the packetbuf is copied. - * - * The external buffer to which the packetbuf is to be - * copied must be able to accomodate at least - * PACKETBUF_SIZE bytes. The number of - * bytes that was copied to the external buffer is - * returned. - * - */ -int packetbuf_copyto(void *to); - -/** - * \brief Extend the header of the packetbuf, for outbound packets - * \param size The number of bytes the header should be extended - * \retval Non-zero if the header could be extended, zero otherwise - * - * This function is used to allocate extra space in the - * header portion in the packetbuf, when preparing outbound - * packets for transmission. If the function is unable to - * allocate sufficient header space, the function returns - * zero and does not allocate anything. - * - */ -int packetbuf_hdralloc(int size); - -/** - * \brief Reduce the header in the packetbuf, for incoming packets - * \param size The number of bytes the header should be reduced - * \retval Non-zero if the header could be reduced, zero otherwise - * - * This function is used to remove the first part of the - * header in the packetbuf, when processing incoming - * packets. If the function is unable to remove the - * requested amount of header space, the function returns - * zero and does not allocate anything. - * - */ -int packetbuf_hdrreduce(int size); - -/* Packet attributes stuff below: */ - -typedef uint16_t packetbuf_attr_t; - -struct packetbuf_attr { - packetbuf_attr_t val; -}; -struct packetbuf_addr { - linkaddr_t addr; -}; - -#define PACKETBUF_ATTR_PACKET_TYPE_DATA 0 -#define PACKETBUF_ATTR_PACKET_TYPE_ACK 1 -#define PACKETBUF_ATTR_PACKET_TYPE_STREAM 2 -#define PACKETBUF_ATTR_PACKET_TYPE_STREAM_END 3 -#define PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP 4 - -enum { - PACKETBUF_ATTR_NONE, - - /* Scope 0 attributes: used only on the local node. */ - PACKETBUF_ATTR_CHANNEL, - PACKETBUF_ATTR_NETWORK_ID, - PACKETBUF_ATTR_LINK_QUALITY, - PACKETBUF_ATTR_RSSI, - PACKETBUF_ATTR_TIMESTAMP, - PACKETBUF_ATTR_MAX_MAC_TRANSMISSIONS, - PACKETBUF_ATTR_MAC_SEQNO, - PACKETBUF_ATTR_MAC_ACK, - PACKETBUF_ATTR_MAC_METADATA, - PACKETBUF_ATTR_MAC_NO_SRC_ADDR, - PACKETBUF_ATTR_MAC_NO_DEST_ADDR, -#if TSCH_WITH_LINK_SELECTOR - PACKETBUF_ATTR_TSCH_SLOTFRAME, - PACKETBUF_ATTR_TSCH_TIMESLOT, -#endif /* TSCH_WITH_LINK_SELECTOR */ - - /* Scope 1 attributes: used between two neighbors only. */ - PACKETBUF_ATTR_FRAME_TYPE, -#if LLSEC802154_USES_AUX_HEADER - PACKETBUF_ATTR_SECURITY_LEVEL, -#endif /* LLSEC802154_USES_AUX_HEADER */ -#if LLSEC802154_USES_EXPLICIT_KEYS - PACKETBUF_ATTR_KEY_ID_MODE, - PACKETBUF_ATTR_KEY_INDEX, -#endif /* LLSEC802154_USES_EXPLICIT_KEYS */ - -#if LLSEC802154_USES_FRAME_COUNTER - PACKETBUF_ATTR_FRAME_COUNTER_BYTES_0_1, - PACKETBUF_ATTR_FRAME_COUNTER_BYTES_2_3, -#endif /* LLSEC802154_USES_FRAME_COUNTER */ - - /* Scope 2 attributes: used between end-to-end nodes. */ - /* These must be last */ - PACKETBUF_ADDR_SENDER, - PACKETBUF_ADDR_RECEIVER, - - PACKETBUF_ATTR_MAX -}; - -#define PACKETBUF_NUM_ADDRS 2 -#define PACKETBUF_NUM_ATTRS (PACKETBUF_ATTR_MAX - PACKETBUF_NUM_ADDRS) -#define PACKETBUF_ADDR_FIRST PACKETBUF_ADDR_SENDER - -#define PACKETBUF_IS_ADDR(type) ((type) >= PACKETBUF_ADDR_FIRST) - -int packetbuf_set_attr(uint8_t type, const packetbuf_attr_t val); -packetbuf_attr_t packetbuf_attr(uint8_t type); -int packetbuf_set_addr(uint8_t type, const linkaddr_t *addr); -const linkaddr_t *packetbuf_addr(uint8_t type); - -/** - * \brief Checks whether the current packet is a broadcast. - * \retval 0 iff current packet is not a broadcast - */ -int packetbuf_holds_broadcast(void); - -void packetbuf_attr_clear(void); - -void packetbuf_attr_copyto(struct packetbuf_attr *attrs, - struct packetbuf_addr *addrs); -void packetbuf_attr_copyfrom(struct packetbuf_attr *attrs, - struct packetbuf_addr *addrs); - -#define PACKETBUF_ATTRIBUTES(...) { __VA_ARGS__ PACKETBUF_ATTR_LAST } -#define PACKETBUF_ATTR_LAST { PACKETBUF_ATTR_NONE, 0 } - -#define PACKETBUF_ATTR_BIT 1 -#define PACKETBUF_ATTR_BYTE 8 -#define PACKETBUF_ADDRSIZE (LINKADDR_SIZE * PACKETBUF_ATTR_BYTE) - -#define PACKETBUF_ATTR_SECURITY_LEVEL_DEFAULT 0xffff - -struct packetbuf_attrlist { - uint8_t type; - uint8_t len; -}; - -#endif /* PACKETBUF_H_ */ -/** @} */ -/** @} */ diff --git a/os/net/queuebuf.c b/os/net/queuebuf.c deleted file mode 100644 index 91eeb88d7..000000000 --- a/os/net/queuebuf.c +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Implementation of the Packet queue buffers - * \author - * Adam Dunkels - */ - -/** - * \addtogroup queuebuf - * @{ - */ - -#include "contiki-net.h" -#include "net/queuebuf.h" - -#if WITH_SWAP -#include "cfs/cfs.h" -#endif - -#include /* for memcpy() */ - -/* Structure pointing to a buffer either stored - in RAM or swapped in CFS */ -struct queuebuf { -#if QUEUEBUF_DEBUG - struct queuebuf *next; - const char *file; - int line; - clock_time_t time; -#endif /* QUEUEBUF_DEBUG */ -#if WITH_SWAP - enum {IN_RAM, IN_CFS} location; - union { -#endif - struct queuebuf_data *ram_ptr; -#if WITH_SWAP - int swap_id; - }; -#endif -}; - -/* The actual queuebuf data */ -struct queuebuf_data { - uint8_t data[PACKETBUF_SIZE]; - uint16_t len; - struct packetbuf_attr attrs[PACKETBUF_NUM_ATTRS]; - struct packetbuf_addr addrs[PACKETBUF_NUM_ADDRS]; -}; - -MEMB(bufmem, struct queuebuf, QUEUEBUF_NUM); -MEMB(buframmem, struct queuebuf_data, QUEUEBUFRAM_NUM); - -#if WITH_SWAP - -/* Swapping allows to store up to QUEUEBUF_NUM - QUEUEBUFRAM_NUM - queuebufs in CFS. The swap is made of several large CFS files. - Every buffer stored in CFS has a swap id, referring to a specific - offset in one of these files. */ -#define NQBUF_FILES 4 -#define NQBUF_PER_FILE 256 -#define QBUF_FILE_SIZE (NQBUF_PER_FILE*sizeof(struct queuebuf_data)) -#define NQBUF_ID (NQBUF_PER_FILE * NQBUF_FILES) - -struct qbuf_file { - int fd; - int usage; - int renewable; -}; - -/* A statically allocated queuebuf used as a cache for swapped qbufs */ -static struct queuebuf_data tmpdata; -/* A pointer to the qbuf associated to the data in tmpdata */ -static struct queuebuf *tmpdata_qbuf = NULL; -/* The swap id counter */ -static int next_swap_id = 0; -/* The swap files */ -static struct qbuf_file qbuf_files[NQBUF_FILES]; -/* The timer used to renew files during inactivity periods */ -static struct ctimer renew_timer; - -#endif - -#if QUEUEBUF_DEBUG -#include "lib/list.h" -LIST(queuebuf_list); -#endif /* QUEUEBUF_DEBUG */ - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#ifdef QUEUEBUF_CONF_STATS -#define QUEUEBUF_STATS QUEUEBUF_CONF_STATS -#else -#define QUEUEBUF_STATS 0 -#endif /* QUEUEBUF_CONF_STATS */ - -#if QUEUEBUF_STATS -uint8_t queuebuf_len, queuebuf_max_len; -#endif /* QUEUEBUF_STATS */ - -#if WITH_SWAP -/*---------------------------------------------------------------------------*/ -static void -qbuf_renew_file(int file) -{ - int ret; - char name[2]; - name[0] = 'a' + file; - name[1] = '\0'; - if(qbuf_files[file].renewable == 1) { - PRINTF("qbuf_renew_file: removing file %d\n", file); - cfs_remove(name); - } - ret = cfs_open(name, CFS_READ | CFS_WRITE); - if(ret == -1) { - PRINTF("qbuf_renew_file: cfs open error\n"); - } - qbuf_files[file].fd = ret; - qbuf_files[file].usage = 0; - qbuf_files[file].renewable = 0; -} -/*---------------------------------------------------------------------------*/ -/* Renews every file with renewable flag set */ -static void -qbuf_renew_all(void *unused) -{ - int i; - for(i=0; iswap_id == swap_id) { - tmpdata_qbuf->swap_id = -1; - } - } -} -/*---------------------------------------------------------------------------*/ -static int -get_new_swap_id(void) -{ - int fileid; - int swap_id = next_swap_id; - fileid = swap_id / NQBUF_PER_FILE; - if(swap_id % NQBUF_PER_FILE == 0) { /* This is the first id in the file */ - if(qbuf_files[fileid].renewable) { - qbuf_renew_file(fileid); - } - if(qbuf_files[fileid].usage>0) { - return -1; - } - } - qbuf_files[fileid].usage++; - next_swap_id = (next_swap_id+1) % NQBUF_ID; - return swap_id; -} -/*---------------------------------------------------------------------------*/ -/* Flush tmpdata to CFS */ -static int -queuebuf_flush_tmpdata(void) -{ - int fileid, fd, ret; - cfs_offset_t offset; - if(tmpdata_qbuf) { - queuebuf_remove_from_file(tmpdata_qbuf->swap_id); - tmpdata_qbuf->swap_id = get_new_swap_id(); - if(tmpdata_qbuf->swap_id == -1) { - return -1; - } - fileid = tmpdata_qbuf->swap_id / NQBUF_PER_FILE; - offset = (tmpdata_qbuf->swap_id % NQBUF_PER_FILE) * sizeof(struct queuebuf_data); - fd = qbuf_files[fileid].fd; - ret = cfs_seek(fd, offset, CFS_SEEK_SET); - if(ret == -1) { - PRINTF("queuebuf_flush_tmpdata: cfs seek error\n"); - return -1; - } - ret = cfs_write(fd, &tmpdata, sizeof(struct queuebuf_data)); - if(ret == -1) { - PRINTF("queuebuf_flush_tmpdata: cfs write error\n"); - return -1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/* If the queuebuf is in CFS, load it to tmpdata */ -static struct queuebuf_data * -queuebuf_load_to_ram(struct queuebuf *b) -{ - int fileid, fd, ret; - cfs_offset_t offset; - if(b->location == IN_RAM) { /* the qbuf is loacted in RAM */ - return b->ram_ptr; - } else { /* the qbuf is located in CFS */ - if(tmpdata_qbuf && tmpdata_qbuf->swap_id == b->swap_id) { /* the qbuf is already in tmpdata */ - return &tmpdata; - } else { /* the qbuf needs to be loaded from CFS */ - tmpdata_qbuf = b; - /* read the qbuf from CFS */ - fileid = b->swap_id / NQBUF_PER_FILE; - offset = (b->swap_id % NQBUF_PER_FILE) * sizeof(struct queuebuf_data); - fd = qbuf_files[fileid].fd; - ret = cfs_seek(fd, offset, CFS_SEEK_SET); - if(ret == -1) { - PRINTF("queuebuf_load_to_ram: cfs seek error\n"); - } - ret = cfs_read(fd, &tmpdata, sizeof(struct queuebuf_data)); - if(ret == -1) { - PRINTF("queuebuf_load_to_ram: cfs read error\n"); - } - return &tmpdata; - } - } -} -#else /* WITH_SWAP */ -/*---------------------------------------------------------------------------*/ -static struct queuebuf_data * -queuebuf_load_to_ram(struct queuebuf *b) -{ - return b->ram_ptr; -} -#endif /* WITH_SWAP */ -/*---------------------------------------------------------------------------*/ -void -queuebuf_init(void) -{ -#if WITH_SWAP - int i; - for(i=0; ifile = file; - buf->line = line; - buf->time = clock_time(); -#endif /* QUEUEBUF_DEBUG */ - buf->ram_ptr = memb_alloc(&buframmem); -#if WITH_SWAP - /* If the allocation failed, store the qbuf in swap files */ - if(buf->ram_ptr != NULL) { - buf->location = IN_RAM; - buframptr = buf->ram_ptr; - } else { - buf->location = IN_CFS; - buf->swap_id = -1; - tmpdata_qbuf = buf; - buframptr = &tmpdata; - } -#else - if(buf->ram_ptr == NULL) { - PRINTF("queuebuf_new_from_packetbuf: could not queuebuf data\n"); - memb_free(&bufmem, buf); - return NULL; - } - buframptr = buf->ram_ptr; -#endif - - buframptr->len = packetbuf_copyto(buframptr->data); - packetbuf_attr_copyto(buframptr->attrs, buframptr->addrs); - -#if WITH_SWAP - if(buf->location == IN_CFS) { - if(queuebuf_flush_tmpdata() == -1) { - /* We were unable to write the data in the swap */ - memb_free(&bufmem, buf); - return NULL; - } - } -#endif - -#if QUEUEBUF_STATS - ++queuebuf_len; - PRINTF("#A q=%d\n", queuebuf_len); - if(queuebuf_len > queuebuf_max_len) { - queuebuf_max_len = queuebuf_len; - } -#endif /* QUEUEBUF_STATS */ - - } else { - PRINTF("queuebuf_new_from_packetbuf: could not allocate a queuebuf\n"); - } - return buf; -} -/*---------------------------------------------------------------------------*/ -void -queuebuf_update_attr_from_packetbuf(struct queuebuf *buf) -{ - struct queuebuf_data *buframptr = queuebuf_load_to_ram(buf); - packetbuf_attr_copyto(buframptr->attrs, buframptr->addrs); -#if WITH_SWAP - if(buf->location == IN_CFS) { - queuebuf_flush_tmpdata(); - } -#endif -} -/*---------------------------------------------------------------------------*/ -void -queuebuf_update_from_packetbuf(struct queuebuf *buf) -{ - struct queuebuf_data *buframptr = queuebuf_load_to_ram(buf); - packetbuf_attr_copyto(buframptr->attrs, buframptr->addrs); - buframptr->len = packetbuf_copyto(buframptr->data); -#if WITH_SWAP - if(buf->location == IN_CFS) { - queuebuf_flush_tmpdata(); - } -#endif -} -/*---------------------------------------------------------------------------*/ -void -queuebuf_free(struct queuebuf *buf) -{ - if(memb_inmemb(&bufmem, buf)) { -#if WITH_SWAP - if(buf->location == IN_RAM) { - memb_free(&buframmem, buf->ram_ptr); - } else { - queuebuf_remove_from_file(buf->swap_id); - } -#else - memb_free(&buframmem, buf->ram_ptr); -#endif - memb_free(&bufmem, buf); -#if QUEUEBUF_STATS - --queuebuf_len; - PRINTF("#A q=%d\n", queuebuf_len); -#endif /* QUEUEBUF_STATS */ -#if QUEUEBUF_DEBUG - list_remove(queuebuf_list, buf); -#endif /* QUEUEBUF_DEBUG */ - } -} -/*---------------------------------------------------------------------------*/ -void -queuebuf_to_packetbuf(struct queuebuf *b) -{ - if(memb_inmemb(&bufmem, b)) { - struct queuebuf_data *buframptr = queuebuf_load_to_ram(b); - packetbuf_copyfrom(buframptr->data, buframptr->len); - packetbuf_attr_copyfrom(buframptr->attrs, buframptr->addrs); - } -} -/*---------------------------------------------------------------------------*/ -void * -queuebuf_dataptr(struct queuebuf *b) -{ - if(memb_inmemb(&bufmem, b)) { - struct queuebuf_data *buframptr = queuebuf_load_to_ram(b); - return buframptr->data; - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -int -queuebuf_datalen(struct queuebuf *b) -{ - struct queuebuf_data *buframptr = queuebuf_load_to_ram(b); - return buframptr->len; -} -/*---------------------------------------------------------------------------*/ -linkaddr_t * -queuebuf_addr(struct queuebuf *b, uint8_t type) -{ - struct queuebuf_data *buframptr = queuebuf_load_to_ram(b); - return &buframptr->addrs[type - PACKETBUF_ADDR_FIRST].addr; -} -/*---------------------------------------------------------------------------*/ -packetbuf_attr_t -queuebuf_attr(struct queuebuf *b, uint8_t type) -{ - struct queuebuf_data *buframptr = queuebuf_load_to_ram(b); - return buframptr->attrs[type].val; -} -/*---------------------------------------------------------------------------*/ -void -queuebuf_debug_print(void) -{ -#if QUEUEBUF_DEBUG - struct queuebuf *q; - printf("queuebuf_list: "); - for(q = list_head(queuebuf_list); q != NULL; - q = list_item_next(q)) { - printf("%s,%d,%lu ", q->file, q->line, q->time); - } - printf("\n"); -#endif /* QUEUEBUF_DEBUG */ -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/queuebuf.h b/os/net/queuebuf.h deleted file mode 100644 index ef66da780..000000000 --- a/os/net/queuebuf.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the Packet queue buffer management - * \author - * Adam Dunkels - */ - -/** - * \addtogroup net - * @{ - */ - -/** - * \defgroup queuebuf Packet buffer queue - * @{ - * - * The queuebuf module handles buffers that are queued. - * - */ - -#ifndef QUEUEBUF_H_ -#define QUEUEBUF_H_ - -#include "net/packetbuf.h" - -#ifdef QUEUEBUF_CONF_ENABLED -#define QUEUEBUF_ENABLED QUEUEBUF_CONF_ENABLED -#else /* QUEUEBUF_CONF_ENABLED */ -#define QUEUEBUF_ENABLED 1 -#endif /* QUEUEBUF_CONF_ENABLED */ - -/* QUEUEBUF_NUM is the total number of queuebuf */ -#ifdef QUEUEBUF_CONF_NUM -#define QUEUEBUF_NUM QUEUEBUF_CONF_NUM -#else -#define QUEUEBUF_NUM 8 -#endif - -/* QUEUEBUFRAM_NUM is the number of queuebufs stored in RAM. - If QUEUEBUFRAM_CONF_NUM is set lower than QUEUEBUF_NUM, - swapping is enabled and queuebufs are stored either in RAM of CFS. - If QUEUEBUFRAM_CONF_NUM is unset or >= to QUEUEBUF_NUM, all - queuebufs are in RAM and swapping is disabled. */ -#ifdef QUEUEBUFRAM_CONF_NUM - #if QUEUEBUFRAM_CONF_NUM>QUEUEBUF_NUM - #error "QUEUEBUFRAM_CONF_NUM cannot be greater than QUEUEBUF_NUM" - #else - #define QUEUEBUFRAM_NUM QUEUEBUFRAM_CONF_NUM - #define WITH_SWAP (QUEUEBUFRAM_NUM < QUEUEBUF_NUM) - #endif -#else /* QUEUEBUFRAM_CONF_NUM */ - #define QUEUEBUFRAM_NUM QUEUEBUF_NUM - #define WITH_SWAP 0 -#endif /* QUEUEBUFRAM_CONF_NUM */ - -#ifdef QUEUEBUF_CONF_DEBUG -#define QUEUEBUF_DEBUG QUEUEBUF_CONF_DEBUG -#else /* QUEUEBUF_CONF_DEBUG */ -#define QUEUEBUF_DEBUG 0 -#endif /* QUEUEBUF_CONF_DEBUG */ - -struct queuebuf; - -void queuebuf_init(void); - -#if QUEUEBUF_DEBUG -struct queuebuf *queuebuf_new_from_packetbuf_debug(const char *file, int line); -#define queuebuf_new_from_packetbuf() queuebuf_new_from_packetbuf_debug(__FILE__, __LINE__) -#else /* QUEUEBUF_DEBUG */ -struct queuebuf *queuebuf_new_from_packetbuf(void); -#endif /* QUEUEBUF_DEBUG */ -void queuebuf_update_attr_from_packetbuf(struct queuebuf *b); -void queuebuf_update_from_packetbuf(struct queuebuf *b); - -void queuebuf_to_packetbuf(struct queuebuf *b); -void queuebuf_free(struct queuebuf *b); - -void *queuebuf_dataptr(struct queuebuf *b); -int queuebuf_datalen(struct queuebuf *b); - -linkaddr_t *queuebuf_addr(struct queuebuf *b, uint8_t type); -packetbuf_attr_t queuebuf_attr(struct queuebuf *b, uint8_t type); - -void queuebuf_debug_print(void); - -int queuebuf_numfree(void); - -#endif /* __QUEUEBUF_H__ */ - -/** @} */ -/** @} */ diff --git a/os/net/routing/nullrouting/nullrouting.c b/os/net/routing/nullrouting/nullrouting.c deleted file mode 100644 index 318cd1baa..000000000 --- a/os/net/routing/nullrouting/nullrouting.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup null-routing - * @{ - * - * \file - * A routing protocol that does nothing - * - * \author Simon Duquennoy - */ - -#include "net/routing/routing.h" - -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ -} -/*---------------------------------------------------------------------------*/ -static void -root_set_prefix(uip_ipaddr_t *prefix, uip_ipaddr_t *iid) -{ -} -/*---------------------------------------------------------------------------*/ -static int -root_start(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -node_is_root(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -get_root_ipaddr(uip_ipaddr_t *ipaddr) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -get_sr_node_ipaddr(uip_ipaddr_t *addr, const uip_sr_node_t *node) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -leave_network(void) -{ -} -/*---------------------------------------------------------------------------*/ -static int -node_has_joined(void) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -node_is_reachable(void) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -global_repair(const char *str) -{ -} -/*---------------------------------------------------------------------------*/ -static void -local_repair(const char *str) -{ -} -/*---------------------------------------------------------------------------*/ -static void -ext_header_remove(void) -{ -#if NETSTACK_CONF_WITH_IPV6 - uip_remove_ext_hdr(); -#endif /* NETSTACK_CONF_WITH_IPV6 */ -} -/*---------------------------------------------------------------------------*/ -static int -ext_header_update(void) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -ext_header_hbh_update(uint8_t *ext_buf, int opt_offset) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -ext_header_srh_update(void) -{ - return 0; /* Means SRH not found */ -} -/*---------------------------------------------------------------------------*/ -static int -ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -link_callback(const linkaddr_t *addr, int status, int numtx) -{ -} -/*---------------------------------------------------------------------------*/ -static void -neighbor_state_changed(uip_ds6_nbr_t *nbr) -{ -} -/*---------------------------------------------------------------------------*/ -static void -drop_route(uip_ds6_route_t *route) -{ -} -/*---------------------------------------------------------------------------*/ -const struct routing_driver nullrouting_driver = { - "nullrouting", - init, - root_set_prefix, - root_start, - node_is_root, - get_root_ipaddr, - get_sr_node_ipaddr, - leave_network, - node_has_joined, - node_is_reachable, - global_repair, - local_repair, - ext_header_remove, - ext_header_update, - ext_header_hbh_update, - ext_header_srh_update, - ext_header_srh_get_next_hop, - link_callback, - neighbor_state_changed, - drop_route, -}; -/*---------------------------------------------------------------------------*/ - -/** @}*/ diff --git a/os/net/routing/routing.h b/os/net/routing/routing.h deleted file mode 100644 index 3cee3d9b2..000000000 --- a/os/net/routing/routing.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Routing driver header file - * \author - * Simon Duquennoy - */ - -#ifndef ROUTING_H_ -#define ROUTING_H_ - -#include "contiki.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/ipv6/uip-sr.h" -#include "net/linkaddr.h" - -/** - * The structure of a routing protocol driver. - */ -struct routing_driver { - char *name; - /** Initialize the routing protocol */ - void (* init)(void); - /** - * Set the prefix, for nodes that will operate as root - * - * \param prefix The prefix. If NULL, uip_ds6_default_prefix() is used instead - * \param iid The IID. If NULL, it will be built from uip_ds6_set_addr_iid. - */ - void (* root_set_prefix)(uip_ipaddr_t *prefix, uip_ipaddr_t *iid); - /** - * Set the node as root and start a network - * - * \return 0 in case of success, -1 otherwise - */ - int (* root_start)(void); - /** - * Tells whether the node is a network root or not - * - * \return 1 if we are root, 0 otherwise - */ - int (* node_is_root)(void); - /** - * Returns the IPv6 address of the network root, if any - * - * \param ipaddr A pointer where to copy the IP address of the root - * \return 1 if the root address was copied, 0 otherwise - */ - int (* get_root_ipaddr)(uip_ipaddr_t *ipaddr); - /** - * Returns the global IPv6 address of a source routing node - * - * \param ipaddr A pointer where to copy the IP address of the node - * \param node The source routing node - * \return 1 if the global node address was copied, 0 otherwise - */ - int (* get_sr_node_ipaddr)(uip_ipaddr_t *addr, const uip_sr_node_t *node); - /** - * Leave the network the node is part of - * - */ - void (* leave_network)(void); - /** - * Tells whether the node is currently part of a network - * - * \return 1 if we have joined a network, 0 otherwise. - */ - int (* node_has_joined)(void); - /** - * Tells whether the node is currently reachable as part of the network - * - * \return 1 if we are reachable, 0 otherwise. - */ - int (* node_is_reachable)(void); - /** - * Triggers a global topology repair - * - * \param str A textual description of the cause for triggering a repair - */ - void (* global_repair)(const char *str); - /** - * Triggers a RPL local topology repair - * - * \param str A textual description of the cause for triggering a repair - */ - void (* local_repair)(const char *str); - /** - * Removes all extension headers that pertain to the routing protocol. - */ - void (* ext_header_remove)(void); - /** - * Adds/updates routing protocol extension headers to current uIP packet. - * - * \return 1 in case of success, 0 otherwise - */ - int (* ext_header_update)(void); - /** - * Process and update the routing protocol hob-by-hop - * extention headers of the current uIP packet. - * - * \param ext_buf A pointer to the ext header buffer - * \param opt_offset The offset within the extension header where - * the option starts - * \return 1 in case the packet is valid and to be processed further, - * 0 in case the packet must be dropped. - */ - int (* ext_header_hbh_update)(uint8_t *ext_buf, int opt_offset); - /** - * Process and update SRH in-place, - * i.e. internal address swapping as per RFC6554 - * \return 1 if SRH found, 0 otherwise - */ - int (* ext_header_srh_update)(void); - /** - * Look for next hop from SRH of current uIP packet. - * - * \param ipaddr A pointer to the address where to store the next hop. - * \return 1 if a next hop was found, 0 otherwise - */ - int (* ext_header_srh_get_next_hop)(uip_ipaddr_t *ipaddr); - /** - * Called by lower layers after every packet transmission - * - * \param addr The link-layer addrress of the packet destination - * \param status The transmission status (see os/net/mac/mac.h) - * \param numtx The total number of transmission attempts - */ - void (* link_callback)(const linkaddr_t *addr, int status, int numtx); - /** - * Called by uIP to notify addition/removal of IPv6 neighbor entries - * - * \param addr The link-layer addrress of the packet destination - * \param status The transmission status (see os/net/mac/mac.h) - * \param numtx The total number of transmission attempts - */ - void (* neighbor_state_changed)(uip_ds6_nbr_t *nbr); - /** - * Called by uIP if it has decided to drop a route because - * - * \param route The route that will be dropped after this function returns - */ - void (* drop_route)(uip_ds6_route_t *route); -}; - -#endif /* ROUTING_H_ */ diff --git a/os/net/routing/rpl-classic/rpl-conf.h b/os/net/routing/rpl-classic/rpl-conf.h deleted file mode 100644 index 76fda2271..000000000 --- a/os/net/routing/rpl-classic/rpl-conf.h +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * \file - * Public configuration and API declarations for ContikiRPL. - * \author - * Joakim Eriksson & Nicolas Tsiftes - * - */ - -#ifndef RPL_CONF_H -#define RPL_CONF_H - -#include "contiki.h" -#include "net/ipv6/multicast/uip-mcast6.h" - -/* DAG Mode of Operation */ -#define RPL_MOP_NO_DOWNWARD_ROUTES 0 -#define RPL_MOP_NON_STORING 1 -#define RPL_MOP_STORING_NO_MULTICAST 2 -#define RPL_MOP_STORING_MULTICAST 3 - -/* RPL Mode of operation */ -#ifdef RPL_CONF_MOP -#define RPL_MOP_DEFAULT RPL_CONF_MOP -#else /* RPL_CONF_MOP */ -#if RPL_WITH_MULTICAST -#define RPL_MOP_DEFAULT RPL_MOP_STORING_MULTICAST -#else -#define RPL_MOP_DEFAULT RPL_MOP_STORING_NO_MULTICAST -#endif /* RPL_WITH_MULTICAST */ -#endif /* RPL_CONF_MOP */ - -/* - * Embed support for storing mode - */ -#ifdef RPL_CONF_WITH_STORING -#define RPL_WITH_STORING RPL_CONF_WITH_STORING -#else /* RPL_CONF_WITH_STORING */ -/* By default: embed support for non-storing if and only if the configured MOP is not non-storing */ -#define RPL_WITH_STORING (RPL_MOP_DEFAULT != RPL_MOP_NON_STORING) -#endif /* RPL_CONF_WITH_STORING */ - -/* - * Embed support for non-storing mode - */ -#ifdef RPL_CONF_WITH_NON_STORING -#define RPL_WITH_NON_STORING RPL_CONF_WITH_NON_STORING -#else /* RPL_CONF_WITH_NON_STORING */ -/* By default: embed support for non-storing if and only if the configured MOP is non-storing */ -#define RPL_WITH_NON_STORING (RPL_MOP_DEFAULT == RPL_MOP_NON_STORING) -#endif /* RPL_CONF_WITH_NON_STORING */ - -#define RPL_IS_STORING(instance) (RPL_WITH_STORING && ((instance) != NULL) && ((instance)->mop > RPL_MOP_NON_STORING)) -#define RPL_IS_NON_STORING(instance) (RPL_WITH_NON_STORING && ((instance) != NULL) && ((instance)->mop == RPL_MOP_NON_STORING)) - -/* Emit a pre-processor error if the user configured multicast with bad MOP */ -#if RPL_WITH_MULTICAST && (RPL_MOP_DEFAULT != RPL_MOP_STORING_MULTICAST) -#error "RPL Multicast requires RPL_MOP_DEFAULT==3. Check contiki-conf.h" -#endif - -/* Set to 1 to enable RPL statistics */ -#ifndef RPL_CONF_STATS -#define RPL_CONF_STATS 0 -#endif /* RPL_CONF_STATS */ - -/* Set to 1 to drop packets when a forwarding loop is detected - * on a packet that already had an error signaled, as per RFC6550 - 11.2.2.2. - * Disabled by default for more reliability: even in the event of a loop, - * packets get a chance to eventually find their way to the destination. */ -#ifdef RPL_CONF_LOOP_ERROR_DROP -#define RPL_LOOP_ERROR_DROP RPL_CONF_LOOP_ERROR_DROP -#else /* RPL_CONF_LOOP_ERROR_DROP */ -#define RPL_LOOP_ERROR_DROP 0 -#endif /* RPL_CONF_LOOP_ERROR_DROP */ - - -/* - * The objective function (OF) used by a RPL root is configurable through - * the RPL_CONF_OF_OCP parameter. This is defined as the objective code - * point (OCP) of the OF, RPL_OCP_OF0 or RPL_OCP_MRHOF. This flag is of - * no relevance to non-root nodes, which run the OF advertised in the - * instance they join. - * Make sure the selected of is inRPL_SUPPORTED_OFS. - */ -#ifdef RPL_CONF_OF_OCP -#define RPL_OF_OCP RPL_CONF_OF_OCP -#else /* RPL_CONF_OF_OCP */ -#define RPL_OF_OCP RPL_OCP_MRHOF -#endif /* RPL_CONF_OF_OCP */ - -/* - * The set of objective functions supported at runtime. Nodes are only - * able to join instances that advertise an OF in this set. To include - * both OF0 and MRHOF, use {&rpl_of0, &rpl_mrhof}. - */ -#ifdef RPL_CONF_SUPPORTED_OFS -#define RPL_SUPPORTED_OFS RPL_CONF_SUPPORTED_OFS -#else /* RPL_CONF_SUPPORTED_OFS */ -#define RPL_SUPPORTED_OFS {&rpl_mrhof} -#endif /* RPL_CONF_SUPPORTED_OFS */ - -/* - * Enable/disable RPL Metric Containers (MC). The actual MC in use - * for a given DODAG is decided at runtime, when joining. Note that - * OF0 (RFC6552) operates without MC, and so does MRHOF (RFC6719) when - * used with ETX as a metric (the rank is the metric). We disable MC - * by default, but note it must be enabled to support joining a DODAG - * that requires MC (e.g., MRHOF with a metric other than ETX). - */ -#ifdef RPL_CONF_WITH_MC -#define RPL_WITH_MC RPL_CONF_WITH_MC -#else /* RPL_CONF_WITH_MC */ -#define RPL_WITH_MC 0 -#endif /* RPL_CONF_WITH_MC */ - -/* The MC advertised in DIOs and propagating from the root */ -#ifdef RPL_CONF_DAG_MC -#define RPL_DAG_MC RPL_CONF_DAG_MC -#else -#define RPL_DAG_MC RPL_DAG_MC_NONE -#endif /* RPL_CONF_DAG_MC */ - -/* This value decides which DAG instance we should participate in by default. */ -#ifdef RPL_CONF_DEFAULT_INSTANCE -#define RPL_DEFAULT_INSTANCE RPL_CONF_DEFAULT_INSTANCE -#else -#define RPL_DEFAULT_INSTANCE 0x1e -#endif /* RPL_CONF_DEFAULT_INSTANCE */ - -/* - * This value decides if this node must stay as a leaf or not - * as allowed by draft-ietf-roll-rpl-19#section-8.5 - */ -#ifdef RPL_CONF_LEAF_ONLY -#define RPL_LEAF_ONLY RPL_CONF_LEAF_ONLY -#else -#define RPL_LEAF_ONLY 0 -#endif - -/* - * Maximum of concurent RPL instances. - */ -#ifdef RPL_CONF_MAX_INSTANCES -#define RPL_MAX_INSTANCES RPL_CONF_MAX_INSTANCES -#else -#define RPL_MAX_INSTANCES 1 -#endif /* RPL_CONF_MAX_INSTANCES */ - -/* - * Maximum number of DAGs within an instance. - */ -#ifdef RPL_CONF_MAX_DAG_PER_INSTANCE -#define RPL_MAX_DAG_PER_INSTANCE RPL_CONF_MAX_DAG_PER_INSTANCE -#else -#define RPL_MAX_DAG_PER_INSTANCE 2 -#endif /* RPL_CONF_MAX_DAG_PER_INSTANCE */ - -/* - * RPL Default route lifetime - * The RPL route lifetime is used for the downward routes and for the default - * route. In a high density network with DIO suppression activated it may happen - * that a node will never send a DIO once the DIO interval becomes high as it - * has heard DIO from many neighbors already. As the default route to the - * preferred parent has a lifetime reset by receiving DIO from the parent, it - * means that the default route can be destroyed after a while. Setting the - * default route with infinite lifetime secures the upstream route. - */ -#ifdef RPL_CONF_DEFAULT_ROUTE_INFINITE_LIFETIME -#define RPL_DEFAULT_ROUTE_INFINITE_LIFETIME RPL_CONF_DEFAULT_ROUTE_INFINITE_LIFETIME -#else -#define RPL_DEFAULT_ROUTE_INFINITE_LIFETIME 1 -#endif /* RPL_CONF_DEFAULT_ROUTE_INFINITE_LIFETIME */ - -/* - * Maximum lifetime of a DAG - * When a DODAG is not updated since RPL_CONF_DAG_LIFETIME times the DODAG - * maximum DIO interval the DODAG is removed from the list of DODAGS of the - * related instance, except if it is the currently joined DODAG. - */ -#ifdef RPL_CONF_DAG_LIFETIME -#define RPL_DAG_LIFETIME RPL_CONF_DAG_LIFETIME -#else -#define RPL_DAG_LIFETIME 3 -#endif /* RPL_CONF_DAG_LIFETIME */ - -/* - * - */ -#ifndef RPL_CONF_DAO_SPECIFY_DAG - #if RPL_MAX_DAG_PER_INSTANCE > 1 - #define RPL_DAO_SPECIFY_DAG 1 - #else - #define RPL_DAO_SPECIFY_DAG 0 - #endif /* RPL_MAX_DAG_PER_INSTANCE > 1 */ -#else - #define RPL_DAO_SPECIFY_DAG RPL_CONF_DAO_SPECIFY_DAG -#endif /* RPL_CONF_DAO_SPECIFY_DAG */ - -/* - * The DIO interval (n) represents 2^n ms. - * - * According to the specification, the default value is 3 which - * means 8 milliseconds. That is far too low when using duty cycling - * with wake-up intervals that are typically hundreds of milliseconds. - * ContikiRPL thus sets the default to 2^12 ms = 4.096 s. - */ -#ifdef RPL_CONF_DIO_INTERVAL_MIN -#define RPL_DIO_INTERVAL_MIN RPL_CONF_DIO_INTERVAL_MIN -#else -#define RPL_DIO_INTERVAL_MIN 12 -#endif - -/* - * Maximum amount of timer doublings. - * - * The maximum interval will by default be 2^(12+8) ms = 1048.576 s. - * RFC 6550 suggests a default value of 20, which of course would be - * unsuitable when we start with a minimum interval of 2^12. - */ -#ifdef RPL_CONF_DIO_INTERVAL_DOUBLINGS -#define RPL_DIO_INTERVAL_DOUBLINGS RPL_CONF_DIO_INTERVAL_DOUBLINGS -#else -#define RPL_DIO_INTERVAL_DOUBLINGS 8 -#endif - -/* - * DIO redundancy. To learn more about this, see RFC 6206. - * - * RFC 6550 suggests a default value of 10. It is unclear what the basis - * of this suggestion is. Network operators might attain more efficient - * operation by tuning this parameter for specific deployments. - */ -#ifdef RPL_CONF_DIO_REDUNDANCY -#define RPL_DIO_REDUNDANCY RPL_CONF_DIO_REDUNDANCY -#else -#define RPL_DIO_REDUNDANCY 10 -#endif - -/* - * Default route lifetime unit. This is the granularity of time - * used in RPL lifetime values, in seconds. - */ -#ifndef RPL_CONF_DEFAULT_LIFETIME_UNIT -#define RPL_DEFAULT_LIFETIME_UNIT 60 -#else -#define RPL_DEFAULT_LIFETIME_UNIT RPL_CONF_DEFAULT_LIFETIME_UNIT -#endif - -/* - * Default route lifetime as a multiple of the lifetime unit. - */ -#ifndef RPL_CONF_DEFAULT_LIFETIME -#define RPL_DEFAULT_LIFETIME 30 -#else -#define RPL_DEFAULT_LIFETIME RPL_CONF_DEFAULT_LIFETIME -#endif - -/* - * DAG preference field - */ -#ifdef RPL_CONF_PREFERENCE -#define RPL_PREFERENCE RPL_CONF_PREFERENCE -#else -#define RPL_PREFERENCE 0 -#endif - -/* - * RPL DAO-ACK support. When enabled, DAO-ACK will be sent and requested. - * This will also enable retransmission of DAO when no ack is received. - * */ -#ifdef RPL_CONF_WITH_DAO_ACK -#define RPL_WITH_DAO_ACK RPL_CONF_WITH_DAO_ACK -#else -#define RPL_WITH_DAO_ACK 0 -#endif /* RPL_CONF_WITH_DAO_ACK */ - -/* - * RPL REPAIR ON DAO NACK. When enabled, DAO NACK will trigger a local - * repair in order to quickly find a new parent to send DAO's to. - * NOTE: this is too agressive in some cases so use with care. - * */ -#ifdef RPL_CONF_RPL_REPAIR_ON_DAO_NACK -#define RPL_REPAIR_ON_DAO_NACK RPL_CONF_RPL_REPAIR_ON_DAO_NACK -#else -#define RPL_REPAIR_ON_DAO_NACK 0 -#endif /* RPL_CONF_RPL_REPAIR_ON_DAO_NACK */ - -/* - * Setting the DIO_REFRESH_DAO_ROUTES will make the RPL root always - * increase the DTSN (Destination Advertisement Trigger Sequence Number) - * when sending multicast DIO. This is to get all children to re-register - * their DAO route. This is needed when DAO-ACK is not enabled to add - * reliability to route maintenance. - * */ -#ifdef RPL_CONF_DIO_REFRESH_DAO_ROUTES -#define RPL_DIO_REFRESH_DAO_ROUTES RPL_CONF_DIO_REFRESH_DAO_ROUTES -#else -#define RPL_DIO_REFRESH_DAO_ROUTES 1 -#endif /* RPL_CONF_DIO_REFRESH_DAO_ROUTES */ - -/* - * RPL probing. When enabled, probes will be sent periodically to keep - * parent link estimates up to date. - */ -#ifdef RPL_CONF_WITH_PROBING -#define RPL_WITH_PROBING RPL_CONF_WITH_PROBING -#else -#define RPL_WITH_PROBING 1 -#endif - -/* - * RPL probing interval. - */ -#ifdef RPL_CONF_PROBING_INTERVAL -#define RPL_PROBING_INTERVAL RPL_CONF_PROBING_INTERVAL -#else -#define RPL_PROBING_INTERVAL (60 * CLOCK_SECOND) -#endif - -/* - * Function used to select the next parent to be probed. - */ -#ifdef RPL_CONF_PROBING_SELECT_FUNC -#define RPL_PROBING_SELECT_FUNC RPL_CONF_PROBING_SELECT_FUNC -#else -#define RPL_PROBING_SELECT_FUNC get_probing_target -#endif - -/* - * Function used to send RPL probes. - * To probe with DIO, use: - * #define RPL_CONF_PROBING_SEND_FUNC(instance, addr) dio_output((instance), (addr)) - * To probe with DIS, use: - * #define RPL_CONF_PROBING_SEND_FUNC(instance, addr) dis_output((addr)) - * Any other custom probing function is also acceptable. - */ -#ifdef RPL_CONF_PROBING_SEND_FUNC -#define RPL_PROBING_SEND_FUNC RPL_CONF_PROBING_SEND_FUNC -#else -#define RPL_PROBING_SEND_FUNC(instance, addr) dio_output((instance), (addr)) -#endif - -/* - * Function used to calculate next RPL probing interval - */ -#ifdef RPL_CONF_PROBING_DELAY_FUNC -#define RPL_PROBING_DELAY_FUNC RPL_CONF_PROBING_DELAY_FUNC -#else -#define RPL_PROBING_DELAY_FUNC get_probing_delay -#endif - -/* - * Interval of DIS transmission - */ -#ifdef RPL_CONF_DIS_INTERVAL -#define RPL_DIS_INTERVAL RPL_CONF_DIS_INTERVAL -#else -#define RPL_DIS_INTERVAL 60 -#endif - -/* - * Added delay of first DIS transmission after boot - */ -#ifdef RPL_CONF_DIS_START_DELAY -#define RPL_DIS_START_DELAY RPL_CONF_DIS_START_DELAY -#else -#define RPL_DIS_START_DELAY 5 -#endif - -#endif /* RPL_CONF_H */ diff --git a/os/net/routing/rpl-classic/rpl-dag-root.c b/os/net/routing/rpl-classic/rpl-dag-root.c deleted file mode 100644 index f45c2d317..000000000 --- a/os/net/routing/rpl-classic/rpl-dag-root.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2012-2014, Thingsquare, http://www.thingsquare.com/. - * 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 "contiki.h" -#include "contiki-net.h" - -#include "net/routing/rpl-classic/rpl.h" -#include "net/routing/rpl-classic/rpl-private.h" -#include "net/ipv6/uip-ds6-route.h" - -#include "sys/log.h" - -#include - -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/*---------------------------------------------------------------------------*/ -static void -set_global_address(uip_ipaddr_t *prefix, uip_ipaddr_t *iid) -{ - static uip_ipaddr_t root_ipaddr; - const uip_ipaddr_t *default_prefix; - int i; - - default_prefix = uip_ds6_default_prefix(); - - /* Assign a unique local address (RFC4193, - http://tools.ietf.org/html/rfc4193). */ - if(prefix == NULL) { - uip_ip6addr_copy(&root_ipaddr, default_prefix); - } else { - memcpy(&root_ipaddr, prefix, 8); - } - if(iid == NULL) { - uip_ds6_set_addr_iid(&root_ipaddr, &uip_lladdr); - } else { - memcpy(((uint8_t*)&root_ipaddr) + 8, ((uint8_t*)iid) + 8, 8); - } - - uip_ds6_addr_add(&root_ipaddr, 0, ADDR_AUTOCONF); - - if(LOG_DBG_ENABLED) { - uint8_t state; - - LOG_DBG("IPv6 addresses: "); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - LOG_DBG_6ADDR(&uip_ds6_if.addr_list[i].ipaddr); - LOG_DBG_("\n"); - } - } - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_dag_root_set_prefix(uip_ipaddr_t *prefix, uip_ipaddr_t *iid) -{ - static uint8_t initialized = 0; - - if(!initialized) { - set_global_address(prefix, iid); - initialized = 1; - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_dag_root_start(void) -{ - struct uip_ds6_addr *root_if; - int i; - uint8_t state; - uip_ipaddr_t *ipaddr = NULL; - - rpl_dag_root_set_prefix(NULL, NULL); - - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - state == ADDR_PREFERRED && - !uip_is_addr_linklocal(&uip_ds6_if.addr_list[i].ipaddr)) { - ipaddr = &uip_ds6_if.addr_list[i].ipaddr; - } - } - - if(ipaddr != NULL) { - root_if = uip_ds6_addr_lookup(ipaddr); - if(root_if != NULL) { - rpl_dag_t *dag; - uip_ipaddr_t prefix; - const uip_ipaddr_t *default_prefix; - - rpl_set_root(RPL_DEFAULT_INSTANCE, ipaddr); - dag = rpl_get_any_dag(); - default_prefix = uip_ds6_default_prefix(); - - /* If there are routes in this dag, we remove them all as we are - from now on the new dag root and the old routes are wrong */ - if(RPL_IS_STORING(dag->instance)) { - rpl_remove_routes(dag); - } - if(dag->instance != NULL && dag->instance->def_route != NULL) { - uip_ds6_defrt_rm(dag->instance->def_route); - dag->instance->def_route = NULL; - } - - uip_ip6addr_copy(&prefix, default_prefix); - rpl_set_prefix(dag, &prefix, 64); - LOG_INFO("root_set_prefix: created a new RPL dag\n"); - return 0; - } else { - LOG_ERR("root_set_prefix: failed to create a new RPL DAG\n"); - return -1; - } - } else { - LOG_ERR("root_set_prefix_dag: failed to create a new RPL DAG, no preferred IP address found\n"); - return -2; - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_dag_root_is_root(void) -{ - rpl_instance_t *instance; - - instance = rpl_get_default_instance(); - - if(instance == NULL) { - return 0; - } - - if(instance->current_dag && - instance->current_dag->rank == ROOT_RANK(instance)) { - return 1; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/net/routing/rpl-classic/rpl-dag-root.h b/os/net/routing/rpl-classic/rpl-dag-root.h deleted file mode 100644 index 9d2d09b02..000000000 --- a/os/net/routing/rpl-classic/rpl-dag-root.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2012-2014, Thingsquare, http://www.thingsquare.com/. - * 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 RPL_DAG_ROOT_H_ -#define RPL_DAG_ROOT_H_ - -void rpl_dag_root_set_prefix(uip_ipaddr_t *prefix, uip_ipaddr_t *iid); -int rpl_dag_root_start(void); - -int rpl_dag_root_is_root(void); - -#endif /* RPL_DAG_ROOT_H_ */ diff --git a/os/net/routing/rpl-classic/rpl-dag.c b/os/net/routing/rpl-classic/rpl-dag.c deleted file mode 100644 index 83a85792b..000000000 --- a/os/net/routing/rpl-classic/rpl-dag.c +++ /dev/null @@ -1,1649 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Logic for Directed Acyclic Graphs in RPL. - * - * \author Joakim Eriksson , Nicolas Tsiftes - * Contributors: George Oikonomou (multicast) - */ - -/** - * \addtogroup uip - * @{ - */ - -#include "contiki.h" -#include "net/link-stats.h" -#include "net/routing/rpl-classic/rpl.h" -#include "net/routing/rpl-classic/rpl-private.h" -#include "net/routing/rpl-classic/rpl-dag-root.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-nd6.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/nbr-table.h" -#include "net/ipv6/multicast/uip-mcast6.h" -#include "lib/list.h" -#include "lib/memb.h" -#include "sys/ctimer.h" -#include "sys/log.h" - -#include -#include - -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/* A configurable function called after every RPL parent switch */ -#ifdef RPL_CALLBACK_PARENT_SWITCH -void RPL_CALLBACK_PARENT_SWITCH(rpl_parent_t *old, rpl_parent_t *new); -#endif /* RPL_CALLBACK_PARENT_SWITCH */ - -/*---------------------------------------------------------------------------*/ -extern rpl_of_t rpl_of0, rpl_mrhof; -static rpl_of_t * const objective_functions[] = RPL_SUPPORTED_OFS; - -/*---------------------------------------------------------------------------*/ -/* RPL definitions. */ - -#ifndef RPL_CONF_GROUNDED -#define RPL_GROUNDED 0 -#else -#define RPL_GROUNDED RPL_CONF_GROUNDED -#endif /* !RPL_CONF_GROUNDED */ - -/*---------------------------------------------------------------------------*/ -/* Per-parent RPL information */ -NBR_TABLE_GLOBAL(rpl_parent_t, rpl_parents); -/*---------------------------------------------------------------------------*/ -/* Allocate instance table. */ -rpl_instance_t instance_table[RPL_MAX_INSTANCES]; -rpl_instance_t *default_instance; - -/*---------------------------------------------------------------------------*/ -void -rpl_print_neighbor_list(void) -{ - if(default_instance != NULL && default_instance->current_dag != NULL && - default_instance->of != NULL) { - int curr_dio_interval = default_instance->dio_intcurrent; - int curr_rank = default_instance->current_dag->rank; - rpl_parent_t *p = nbr_table_head(rpl_parents); - clock_time_t clock_now = clock_time(); - - printf("RPL: MOP %u OCP %u rank %u dioint %u, nbr count %u\n", - default_instance->mop, default_instance->of->ocp, curr_rank, curr_dio_interval, uip_ds6_nbr_num()); - while(p != NULL) { - const struct link_stats *stats = rpl_get_parent_link_stats(p); - printf("RPL: nbr %3u %5u, %5u => %5u -- %2u %c%c (last tx %u min ago)\n", - rpl_parent_get_ipaddr(p)->u8[15], - p->rank, - rpl_get_parent_link_metric(p), - rpl_rank_via_parent(p), - stats != NULL ? stats->freshness : 0, - link_stats_is_fresh(stats) ? 'f' : ' ', - p == default_instance->current_dag->preferred_parent ? 'p' : ' ', - (unsigned)((clock_now - stats->last_tx_time) / (60 * CLOCK_SECOND)) - ); - p = nbr_table_next(rpl_parents, p); - } - printf("RPL: end of list\n"); - } -} -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -rpl_get_nbr(rpl_parent_t *parent) -{ - const linkaddr_t *lladdr = rpl_get_parent_lladdr(parent); - if(lladdr != NULL) { - return uip_ds6_nbr_ll_lookup((const uip_lladdr_t *)lladdr); - } else { - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -static void -nbr_callback(void *ptr) -{ - rpl_remove_parent(ptr); -} - -void -rpl_dag_init(void) -{ - nbr_table_register(rpl_parents, (nbr_table_callback *)nbr_callback); -} -/*---------------------------------------------------------------------------*/ -rpl_parent_t * -rpl_get_parent(const uip_lladdr_t *addr) -{ - rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (const linkaddr_t *)addr); - return p; -} -/*---------------------------------------------------------------------------*/ -rpl_rank_t -rpl_get_parent_rank(uip_lladdr_t *addr) -{ - rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (linkaddr_t *)addr); - if(p != NULL) { - return p->rank; - } else { - return RPL_INFINITE_RANK; - } -} -/*---------------------------------------------------------------------------*/ -uint16_t -rpl_get_parent_link_metric(rpl_parent_t *p) -{ - if(p != NULL && p->dag != NULL) { - rpl_instance_t *instance = p->dag->instance; - if(instance != NULL && instance->of != NULL && instance->of->parent_link_metric != NULL) { - return instance->of->parent_link_metric(p); - } - } - return 0xffff; -} -/*---------------------------------------------------------------------------*/ -rpl_rank_t -rpl_rank_via_parent(rpl_parent_t *p) -{ - if(p != NULL && p->dag != NULL) { - rpl_instance_t *instance = p->dag->instance; - if(instance != NULL && instance->of != NULL && instance->of->rank_via_parent != NULL) { - return instance->of->rank_via_parent(p); - } - } - return RPL_INFINITE_RANK; -} -/*---------------------------------------------------------------------------*/ -const linkaddr_t * -rpl_get_parent_lladdr(rpl_parent_t *p) -{ - return nbr_table_get_lladdr(rpl_parents, p); -} -/*---------------------------------------------------------------------------*/ -uip_ipaddr_t * -rpl_parent_get_ipaddr(rpl_parent_t *p) -{ - const linkaddr_t *lladdr = rpl_get_parent_lladdr(p); - return uip_ds6_nbr_ipaddr_from_lladdr((uip_lladdr_t *)lladdr); -} -/*---------------------------------------------------------------------------*/ -const struct link_stats * -rpl_get_parent_link_stats(rpl_parent_t *p) -{ - const linkaddr_t *lladdr = rpl_get_parent_lladdr(p); - return link_stats_from_lladdr(lladdr); -} -/*---------------------------------------------------------------------------*/ -int -rpl_parent_is_fresh(rpl_parent_t *p) -{ - const struct link_stats *stats = rpl_get_parent_link_stats(p); - return link_stats_is_fresh(stats); -} -/*---------------------------------------------------------------------------*/ -int -rpl_parent_is_reachable(rpl_parent_t *p) { - if(p == NULL || p->dag == NULL || p->dag->instance == NULL || p->dag->instance->of == NULL) { - return 0; - } else { -#if UIP_ND6_SEND_NS - uip_ds6_nbr_t *nbr = rpl_get_nbr(p); - /* Exclude links to a neighbor that is not reachable at a NUD level */ - if(nbr == NULL || nbr->state != NBR_REACHABLE) { - return 0; - } -#endif /* UIP_ND6_SEND_NS */ - /* If we don't have fresh link information, assume the parent is reachable. */ - return !rpl_parent_is_fresh(p) || p->dag->instance->of->parent_has_usable_link(p); - } -} -/*---------------------------------------------------------------------------*/ -static void -rpl_set_preferred_parent(rpl_dag_t *dag, rpl_parent_t *p) -{ - if(dag != NULL && dag->preferred_parent != p) { - LOG_INFO("rpl_set_preferred_parent "); - if(p != NULL) { - LOG_INFO_6ADDR(rpl_parent_get_ipaddr(p)); - } else { - LOG_INFO_("NULL"); - } - LOG_INFO_(" used to be "); - if(dag->preferred_parent != NULL) { - LOG_INFO_6ADDR(rpl_parent_get_ipaddr(dag->preferred_parent)); - } else { - LOG_INFO_("NULL"); - } - LOG_INFO_("\n"); - -#ifdef RPL_CALLBACK_PARENT_SWITCH - RPL_CALLBACK_PARENT_SWITCH(dag->preferred_parent, p); -#endif /* RPL_CALLBACK_PARENT_SWITCH */ - - /* Always keep the preferred parent locked, so it remains in the - * neighbor table. */ - nbr_table_unlock(rpl_parents, dag->preferred_parent); - nbr_table_lock(rpl_parents, p); - dag->preferred_parent = p; - } -} -/*---------------------------------------------------------------------------*/ -/* Greater-than function for the lollipop counter. */ -/*---------------------------------------------------------------------------*/ -static int -lollipop_greater_than(int a, int b) -{ - /* Check if we are comparing an initial value with an old value */ - if(a > RPL_LOLLIPOP_CIRCULAR_REGION && b <= RPL_LOLLIPOP_CIRCULAR_REGION) { - return (RPL_LOLLIPOP_MAX_VALUE + 1 + b - a) > RPL_LOLLIPOP_SEQUENCE_WINDOWS; - } - /* Otherwise check if a > b and comparable => ok, or - if they have wrapped and are still comparable */ - return (a > b && (a - b) < RPL_LOLLIPOP_SEQUENCE_WINDOWS) || - (a < b && (b - a) > (RPL_LOLLIPOP_CIRCULAR_REGION + 1- - RPL_LOLLIPOP_SEQUENCE_WINDOWS)); -} -/*---------------------------------------------------------------------------*/ -/* Remove DAG parents with a rank that is at least the same as minimum_rank. */ -static void -remove_parents(rpl_dag_t *dag, rpl_rank_t minimum_rank) -{ - rpl_parent_t *p; - - LOG_INFO("Removing parents (minimum rank %u)\n", minimum_rank); - - p = nbr_table_head(rpl_parents); - while(p != NULL) { - if(dag == p->dag && p->rank >= minimum_rank) { - rpl_remove_parent(p); - } - p = nbr_table_next(rpl_parents, p); - } -} -/*---------------------------------------------------------------------------*/ -static void -nullify_parents(rpl_dag_t *dag, rpl_rank_t minimum_rank) -{ - rpl_parent_t *p; - - LOG_INFO("Nullifying parents (minimum rank %u)\n", minimum_rank); - - p = nbr_table_head(rpl_parents); - while(p != NULL) { - if(dag == p->dag && p->rank >= minimum_rank) { - rpl_nullify_parent(p); - } - p = nbr_table_next(rpl_parents, p); - } -} -/*---------------------------------------------------------------------------*/ -static int -should_refresh_routes(rpl_instance_t *instance, rpl_dio_t *dio, rpl_parent_t *p) -{ - /* if MOP is set to no downward routes no DAO should be sent */ - if(instance->mop == RPL_MOP_NO_DOWNWARD_ROUTES) { - return 0; - } - /* check if the new DTSN is more recent */ - return p == instance->current_dag->preferred_parent && - (lollipop_greater_than(dio->dtsn, p->dtsn)); -} -/*---------------------------------------------------------------------------*/ -static int -acceptable_rank(rpl_dag_t *dag, rpl_rank_t rank) -{ - return rank != RPL_INFINITE_RANK && - ((dag->instance->max_rankinc == 0) || - DAG_RANK(rank, dag->instance) <= DAG_RANK(dag->min_rank + dag->instance->max_rankinc, dag->instance)); -} -/*---------------------------------------------------------------------------*/ -static rpl_dag_t * -get_dag(uint8_t instance_id, uip_ipaddr_t *dag_id) -{ - rpl_instance_t *instance; - rpl_dag_t *dag; - int i; - - instance = rpl_get_instance(instance_id); - if(instance == NULL) { - return NULL; - } - - for(i = 0; i < RPL_MAX_DAG_PER_INSTANCE; ++i) { - dag = &instance->dag_table[i]; - if(dag->used && uip_ipaddr_cmp(&dag->dag_id, dag_id)) { - return dag; - } - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -rpl_dag_t * -rpl_set_root(uint8_t instance_id, uip_ipaddr_t *dag_id) -{ - rpl_dag_t *dag; - rpl_instance_t *instance; - uint8_t version; - int i; - - version = RPL_LOLLIPOP_INIT; - instance = rpl_get_instance(instance_id); - if(instance != NULL) { - for(i = 0; i < RPL_MAX_DAG_PER_INSTANCE; ++i) { - dag = &instance->dag_table[i]; - if(dag->used) { - if(uip_ipaddr_cmp(&dag->dag_id, dag_id)) { - version = dag->version; - RPL_LOLLIPOP_INCREMENT(version); - } else { - if(dag == dag->instance->current_dag) { - LOG_INFO("Dropping a joined DAG when setting this node as root\n"); - rpl_set_default_route(instance, NULL); - dag->instance->current_dag = NULL; - } else { - LOG_INFO("Dropping a DAG when setting this node as root\n"); - } - rpl_free_dag(dag); - } - } - } - } - - dag = rpl_alloc_dag(instance_id, dag_id); - if(dag == NULL) { - LOG_ERR("Failed to allocate a DAG\n"); - return NULL; - } - - instance = dag->instance; - - dag->version = version; - dag->joined = 1; - dag->grounded = RPL_GROUNDED; - dag->preference = RPL_PREFERENCE; - instance->mop = RPL_MOP_DEFAULT; - instance->of = rpl_find_of(RPL_OF_OCP); - if(instance->of == NULL) { - LOG_WARN("OF with OCP %u not supported\n", RPL_OF_OCP); - return NULL; - } - - rpl_set_preferred_parent(dag, NULL); - - memcpy(&dag->dag_id, dag_id, sizeof(dag->dag_id)); - - instance->dio_intdoubl = RPL_DIO_INTERVAL_DOUBLINGS; - instance->dio_intmin = RPL_DIO_INTERVAL_MIN; - /* The current interval must differ from the minimum interval in order to - trigger a DIO timer reset. */ - instance->dio_intcurrent = RPL_DIO_INTERVAL_MIN + - RPL_DIO_INTERVAL_DOUBLINGS; - instance->dio_redundancy = RPL_DIO_REDUNDANCY; - instance->max_rankinc = RPL_MAX_RANKINC; - instance->min_hoprankinc = RPL_MIN_HOPRANKINC; - instance->default_lifetime = RPL_DEFAULT_LIFETIME; - instance->lifetime_unit = RPL_DEFAULT_LIFETIME_UNIT; - - dag->rank = ROOT_RANK(instance); - - if(instance->current_dag != dag && instance->current_dag != NULL) { - /* Remove routes installed by DAOs. */ - if(RPL_IS_STORING(instance)) { - rpl_remove_routes(instance->current_dag); - } - - instance->current_dag->joined = 0; - } - - instance->current_dag = dag; - instance->dtsn_out = RPL_LOLLIPOP_INIT; - instance->of->update_metric_container(instance); - default_instance = instance; - - LOG_INFO("Node set to be a DAG root with DAG ID "); - LOG_INFO_6ADDR(&dag->dag_id); - LOG_INFO_("\n"); - - LOG_ANNOTATE("#A root=%u\n", dag->dag_id.u8[sizeof(dag->dag_id) - 1]); - - rpl_reset_dio_timer(instance); - - return dag; -} -/*---------------------------------------------------------------------------*/ -int -rpl_repair_root(uint8_t instance_id) -{ - rpl_instance_t *instance; - - instance = rpl_get_instance(instance_id); - if(instance == NULL || - instance->current_dag->rank != ROOT_RANK(instance)) { - LOG_WARN("rpl_repair_root triggered but not root\n"); - return 0; - } - RPL_STAT(rpl_stats.root_repairs++); - - RPL_LOLLIPOP_INCREMENT(instance->current_dag->version); - RPL_LOLLIPOP_INCREMENT(instance->dtsn_out); - LOG_INFO("rpl_repair_root initiating global repair with version %d\n", instance->current_dag->version); - rpl_reset_dio_timer(instance); - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -set_ip_from_prefix(uip_ipaddr_t *ipaddr, rpl_prefix_t *prefix) -{ - memset(ipaddr, 0, sizeof(uip_ipaddr_t)); - memcpy(ipaddr, &prefix->prefix, (prefix->length + 7) / 8); - uip_ds6_set_addr_iid(ipaddr, &uip_lladdr); -} -/*---------------------------------------------------------------------------*/ -static void -check_prefix(rpl_prefix_t *last_prefix, rpl_prefix_t *new_prefix) -{ - uip_ipaddr_t ipaddr; - uip_ds6_addr_t *rep; - - if(last_prefix != NULL && new_prefix != NULL && - last_prefix->length == new_prefix->length && - uip_ipaddr_prefixcmp(&last_prefix->prefix, &new_prefix->prefix, new_prefix->length) && - last_prefix->flags == new_prefix->flags) { - /* Nothing has changed. */ - return; - } - - if(last_prefix != NULL) { - set_ip_from_prefix(&ipaddr, last_prefix); - rep = uip_ds6_addr_lookup(&ipaddr); - if(rep != NULL) { - LOG_DBG("removing global IP address "); - LOG_DBG_6ADDR(&ipaddr); - LOG_DBG_("\n"); - uip_ds6_addr_rm(rep); - } - } - - if(new_prefix != NULL) { - set_ip_from_prefix(&ipaddr, new_prefix); - if(uip_ds6_addr_lookup(&ipaddr) == NULL) { - LOG_DBG("adding global IP address "); - LOG_DBG_6ADDR(&ipaddr); - LOG_DBG_("\n"); - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - } - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_set_prefix(rpl_dag_t *dag, uip_ipaddr_t *prefix, unsigned len) -{ - rpl_prefix_t last_prefix; - uint8_t last_len = dag->prefix_info.length; - - if(len > 128) { - return 0; - } - if(dag->prefix_info.length != 0) { - memcpy(&last_prefix, &dag->prefix_info, sizeof(rpl_prefix_t)); - } - memset(&dag->prefix_info.prefix, 0, sizeof(dag->prefix_info.prefix)); - memcpy(&dag->prefix_info.prefix, prefix, (len + 7) / 8); - dag->prefix_info.length = len; - dag->prefix_info.flags = UIP_ND6_RA_FLAG_AUTONOMOUS; - LOG_INFO("Prefix set - will announce this in DIOs\n"); - if(dag->rank != ROOT_RANK(dag->instance)) { - /* Autoconfigure an address if this node does not already have an address - with this prefix. Otherwise, update the prefix */ - if(last_len == 0) { - LOG_INFO("rpl_set_prefix - prefix NULL\n"); - check_prefix(NULL, &dag->prefix_info); - } else { - LOG_INFO("rpl_set_prefix - prefix NON-NULL\n"); - check_prefix(&last_prefix, &dag->prefix_info); - } - } - return 1; -} -/*---------------------------------------------------------------------------*/ -int -rpl_set_default_route(rpl_instance_t *instance, uip_ipaddr_t *from) -{ - if(instance->def_route != NULL) { - LOG_DBG("Removing default route through "); - LOG_DBG_6ADDR(&instance->def_route->ipaddr); - LOG_DBG_("\n"); - uip_ds6_defrt_rm(instance->def_route); - instance->def_route = NULL; - } - - if(from != NULL) { - LOG_DBG("Adding default route through "); - LOG_DBG_6ADDR(from); - LOG_DBG("\n"); - instance->def_route = uip_ds6_defrt_add(from, - RPL_DEFAULT_ROUTE_INFINITE_LIFETIME ? 0 : RPL_LIFETIME(instance, instance->default_lifetime)); - if(instance->def_route == NULL) { - return 0; - } - } - return 1; -} -/*---------------------------------------------------------------------------*/ -rpl_instance_t * -rpl_alloc_instance(uint8_t instance_id) -{ - rpl_instance_t *instance, *end; - - for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; - instance < end; ++instance) { - if(instance->used == 0) { - memset(instance, 0, sizeof(*instance)); - instance->instance_id = instance_id; - instance->def_route = NULL; - instance->used = 1; -#if RPL_WITH_PROBING - rpl_schedule_probing(instance); -#endif /* RPL_WITH_PROBING */ - return instance; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -rpl_dag_t * -rpl_alloc_dag(uint8_t instance_id, uip_ipaddr_t *dag_id) -{ - rpl_dag_t *dag, *end; - rpl_instance_t *instance; - - instance = rpl_get_instance(instance_id); - if(instance == NULL) { - instance = rpl_alloc_instance(instance_id); - if(instance == NULL) { - RPL_STAT(rpl_stats.mem_overflows++); - return NULL; - } - } - - for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DAG_PER_INSTANCE; dag < end; ++dag) { - if(!dag->used) { - memset(dag, 0, sizeof(*dag)); - dag->used = 1; - dag->rank = RPL_INFINITE_RANK; - dag->min_rank = RPL_INFINITE_RANK; - dag->instance = instance; - return dag; - } - } - - RPL_STAT(rpl_stats.mem_overflows++); - return NULL; -} -/*---------------------------------------------------------------------------*/ -void -rpl_set_default_instance(rpl_instance_t *instance) -{ - default_instance = instance; -} -/*---------------------------------------------------------------------------*/ -rpl_instance_t * -rpl_get_default_instance(void) -{ - return default_instance; -} -/*---------------------------------------------------------------------------*/ -void -rpl_free_instance(rpl_instance_t *instance) -{ - rpl_dag_t *dag; - rpl_dag_t *end; - - LOG_INFO("Leaving the instance %u\n", instance->instance_id); - - /* Remove any DAG inside this instance */ - for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DAG_PER_INSTANCE; dag < end; ++dag) { - if(dag->used) { - rpl_free_dag(dag); - } - } - - rpl_set_default_route(instance, NULL); - -#if RPL_WITH_PROBING - ctimer_stop(&instance->probing_timer); -#endif /* RPL_WITH_PROBING */ - ctimer_stop(&instance->dio_timer); - ctimer_stop(&instance->dao_timer); - ctimer_stop(&instance->dao_lifetime_timer); - - if(default_instance == instance) { - default_instance = NULL; - } - - instance->used = 0; -} -/*---------------------------------------------------------------------------*/ -void -rpl_free_dag(rpl_dag_t *dag) -{ - if(dag->joined) { - LOG_INFO("Leaving the DAG "); - LOG_INFO_6ADDR(&dag->dag_id); - LOG_INFO_("\n"); - dag->joined = 0; - - /* Remove routes installed by DAOs. */ - if(RPL_IS_STORING(dag->instance)) { - rpl_remove_routes(dag); - } - /* Stop the DAO retransmit timer */ -#if RPL_WITH_DAO_ACK - ctimer_stop(&dag->instance->dao_retransmit_timer); -#endif /* RPL_WITH_DAO_ACK */ - - /* Remove autoconfigured address */ - if((dag->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS)) { - check_prefix(&dag->prefix_info, NULL); - } - - remove_parents(dag, 0); - } - dag->used = 0; -} -/*---------------------------------------------------------------------------*/ -rpl_parent_t * -rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr) -{ - rpl_parent_t *p = NULL; - /* Is the parent known by ds6? Drop this request if not. - * Typically, the parent is added upon receiving a DIO. */ - const uip_lladdr_t *lladdr = uip_ds6_nbr_lladdr_from_ipaddr(addr); - - LOG_DBG("rpl_add_parent lladdr %p ", lladdr); - LOG_DBG_6ADDR(addr); - LOG_DBG_("\n"); - if(lladdr != NULL) { - /* Add parent in rpl_parents - again this is due to DIO */ - p = nbr_table_add_lladdr(rpl_parents, (linkaddr_t *)lladdr, - NBR_TABLE_REASON_RPL_DIO, dio); - if(p == NULL) { - LOG_DBG("rpl_add_parent p NULL\n"); - } else { - p->dag = dag; - p->rank = dio->rank; - p->dtsn = dio->dtsn; -#if RPL_WITH_MC - memcpy(&p->mc, &dio->mc, sizeof(p->mc)); -#endif /* RPL_WITH_MC */ - } - } - - return p; -} -/*---------------------------------------------------------------------------*/ -static rpl_parent_t * -find_parent_any_dag_any_instance(uip_ipaddr_t *addr) -{ - uip_ds6_nbr_t *ds6_nbr = uip_ds6_nbr_lookup(addr); - const uip_lladdr_t *lladdr = uip_ds6_nbr_get_ll(ds6_nbr); - return nbr_table_get_from_lladdr(rpl_parents, (linkaddr_t *)lladdr); -} -/*---------------------------------------------------------------------------*/ -rpl_parent_t * -rpl_find_parent(rpl_dag_t *dag, uip_ipaddr_t *addr) -{ - rpl_parent_t *p = find_parent_any_dag_any_instance(addr); - if(p != NULL && p->dag == dag) { - return p; - } else { - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -static rpl_dag_t * -find_parent_dag(rpl_instance_t *instance, uip_ipaddr_t *addr) -{ - rpl_parent_t *p = find_parent_any_dag_any_instance(addr); - if(p != NULL) { - return p->dag; - } else { - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -rpl_parent_t * -rpl_find_parent_any_dag(rpl_instance_t *instance, uip_ipaddr_t *addr) -{ - rpl_parent_t *p = find_parent_any_dag_any_instance(addr); - if(p && p->dag && p->dag->instance == instance) { - return p; - } else { - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -rpl_dag_t * -rpl_select_dag(rpl_instance_t *instance, rpl_parent_t *p) -{ - rpl_parent_t *last_parent; - rpl_dag_t *dag, *end, *best_dag; - rpl_rank_t old_rank; - - old_rank = instance->current_dag->rank; - last_parent = instance->current_dag->preferred_parent; - - if(instance->current_dag->rank != ROOT_RANK(instance)) { - rpl_select_parent(p->dag); - } - - best_dag = NULL; - for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DAG_PER_INSTANCE; dag < end; ++dag) { - if(dag->used && dag->preferred_parent != NULL && dag->preferred_parent->rank != RPL_INFINITE_RANK) { - if(best_dag == NULL) { - best_dag = dag; - } else { - best_dag = instance->of->best_dag(best_dag, dag); - } - } - } - - if(best_dag == NULL) { - /* No parent found: the calling function handle this problem. */ - return NULL; - } - - if(instance->current_dag != best_dag) { - /* Remove routes installed by DAOs. */ - if(RPL_IS_STORING(instance)) { - rpl_remove_routes(instance->current_dag); - } - - LOG_INFO("New preferred DAG: "); - LOG_INFO_6ADDR(&best_dag->dag_id); - LOG_INFO_("\n"); - - if(best_dag->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS) { - check_prefix(&instance->current_dag->prefix_info, &best_dag->prefix_info); - } else if(instance->current_dag->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS) { - check_prefix(&instance->current_dag->prefix_info, NULL); - } - - best_dag->joined = 1; - instance->current_dag->joined = 0; - instance->current_dag = best_dag; - } - - instance->of->update_metric_container(instance); - /* Update the DAG rank. */ - best_dag->rank = rpl_rank_via_parent(best_dag->preferred_parent); - if(last_parent == NULL || best_dag->rank < best_dag->min_rank) { - /* This is a slight departure from RFC6550: if we had no preferred parent before, - * reset min_rank. This helps recovering from temporary bad link conditions. */ - best_dag->min_rank = best_dag->rank; - } - - if(!acceptable_rank(best_dag, best_dag->rank)) { - LOG_WARN("New rank unacceptable!\n"); - rpl_set_preferred_parent(instance->current_dag, NULL); - if(RPL_IS_STORING(instance) && last_parent != NULL) { - /* Send a No-Path DAO to the removed preferred parent. */ - dao_output(last_parent, RPL_ZERO_LIFETIME); - } - return NULL; - } - - if(best_dag->preferred_parent != last_parent) { - rpl_set_default_route(instance, rpl_parent_get_ipaddr(best_dag->preferred_parent)); - LOG_INFO("Changed preferred parent, rank changed from %u to %u\n", - (unsigned)old_rank, best_dag->rank); - RPL_STAT(rpl_stats.parent_switch++); - if(RPL_IS_STORING(instance)) { - if(last_parent != NULL) { - /* Send a No-Path DAO to the removed preferred parent. */ - dao_output(last_parent, RPL_ZERO_LIFETIME); - } - /* Trigger DAO transmission from immediate children. - * Only for storing mode, see RFC6550 section 9.6. */ - RPL_LOLLIPOP_INCREMENT(instance->dtsn_out); - } - /* The DAO parent set changed - schedule a DAO transmission. */ - rpl_schedule_dao(instance); - rpl_reset_dio_timer(instance); - if(LOG_DBG_ENABLED) { - rpl_print_neighbor_list(); - } - } else if(best_dag->rank != old_rank) { - LOG_DBG("RPL: Preferred parent update, rank changed from %u to %u\n", - (unsigned)old_rank, best_dag->rank); - } - return best_dag; -} -/*---------------------------------------------------------------------------*/ -static rpl_parent_t * -best_parent(rpl_dag_t *dag, int fresh_only) -{ - rpl_parent_t *p; - rpl_of_t *of; - rpl_parent_t *best = NULL; - - if(dag == NULL || dag->instance == NULL || dag->instance->of == NULL) { - return NULL; - } - - of = dag->instance->of; - /* Search for the best parent according to the OF */ - for(p = nbr_table_head(rpl_parents); p != NULL; p = nbr_table_next(rpl_parents, p)) { - - /* Exclude parents from other DAGs or announcing an infinite rank */ - if(p->dag != dag || p->rank == RPL_INFINITE_RANK || p->rank < ROOT_RANK(dag->instance)) { - if(p->rank < ROOT_RANK(dag->instance)) { - LOG_WARN("Parent has invalid rank\n"); - } - continue; - } - - if(fresh_only && !rpl_parent_is_fresh(p)) { - /* Filter out non-fresh parents if fresh_only is set */ - continue; - } - -#if UIP_ND6_SEND_NS - { - uip_ds6_nbr_t *nbr = rpl_get_nbr(p); - /* Exclude links to a neighbor that is not reachable at a NUD level */ - if(nbr == NULL || nbr->state != NBR_REACHABLE) { - continue; - } - } -#endif /* UIP_ND6_SEND_NS */ - - /* Now we have an acceptable parent, check if it is the new best */ - best = of->best_parent(best, p); - } - - return best; -} -/*---------------------------------------------------------------------------*/ -rpl_parent_t * -rpl_select_parent(rpl_dag_t *dag) -{ - /* Look for best parent (regardless of freshness) */ - rpl_parent_t *best = best_parent(dag, 0); - - if(best != NULL) { -#if RPL_WITH_PROBING - if(rpl_parent_is_fresh(best)) { - rpl_set_preferred_parent(dag, best); - /* Unschedule any already scheduled urgent probing */ - dag->instance->urgent_probing_target = NULL; - } else { - /* The best is not fresh. Look for the best fresh now. */ - rpl_parent_t *best_fresh = best_parent(dag, 1); - if(best_fresh == NULL) { - /* No fresh parent around, use best (non-fresh) */ - rpl_set_preferred_parent(dag, best); - } else { - /* Use best fresh */ - rpl_set_preferred_parent(dag, best_fresh); - } - /* Probe the best parent shortly in order to get a fresh estimate */ - dag->instance->urgent_probing_target = best; - rpl_schedule_probing_now(dag->instance); - } -#else /* RPL_WITH_PROBING */ - rpl_set_preferred_parent(dag, best); - dag->rank = rpl_rank_via_parent(dag->preferred_parent); -#endif /* RPL_WITH_PROBING */ - } else { - rpl_set_preferred_parent(dag, NULL); - } - - dag->rank = rpl_rank_via_parent(dag->preferred_parent); - return dag->preferred_parent; -} -/*---------------------------------------------------------------------------*/ -void -rpl_remove_parent(rpl_parent_t *parent) -{ - LOG_INFO("Removing parent "); - LOG_INFO_6ADDR(rpl_parent_get_ipaddr(parent)); - LOG_INFO_("\n"); - - rpl_nullify_parent(parent); - - nbr_table_remove(rpl_parents, parent); -} -/*---------------------------------------------------------------------------*/ -void -rpl_nullify_parent(rpl_parent_t *parent) -{ - rpl_dag_t *dag = parent->dag; - /* This function can be called when the preferred parent is NULL, so we - need to handle this condition in order to trigger uip_ds6_defrt_rm. */ - if(parent == dag->preferred_parent || dag->preferred_parent == NULL) { - dag->rank = RPL_INFINITE_RANK; - if(dag->joined) { - if(dag->instance->def_route != NULL) { - LOG_DBG("Removing default route "); - LOG_DBG_6ADDR(rpl_parent_get_ipaddr(parent)); - LOG_DBG_("\n"); - uip_ds6_defrt_rm(dag->instance->def_route); - dag->instance->def_route = NULL; - } - /* Send No-Path DAO only when nullifying preferred parent */ - if(parent == dag->preferred_parent) { - if(RPL_IS_STORING(dag->instance)) { - dao_output(parent, RPL_ZERO_LIFETIME); - } - rpl_set_preferred_parent(dag, NULL); - } - } - } - - LOG_INFO("Nullifying parent "); - LOG_INFO_6ADDR(rpl_parent_get_ipaddr(parent)); - LOG_INFO_("\n"); -} -/*---------------------------------------------------------------------------*/ -void -rpl_move_parent(rpl_dag_t *dag_src, rpl_dag_t *dag_dst, rpl_parent_t *parent) -{ - if(parent == dag_src->preferred_parent) { - rpl_set_preferred_parent(dag_src, NULL); - dag_src->rank = RPL_INFINITE_RANK; - if(dag_src->joined && dag_src->instance->def_route != NULL) { - LOG_DBG("Removing default route "); - LOG_DBG_6ADDR(rpl_parent_get_ipaddr(parent)); - LOG_DBG_("\n"); - LOG_DBG("rpl_move_parent\n"); - uip_ds6_defrt_rm(dag_src->instance->def_route); - dag_src->instance->def_route = NULL; - } - } else if(dag_src->joined) { - if(RPL_IS_STORING(dag_src->instance)) { - /* Remove uIPv6 routes that have this parent as the next hop. */ - rpl_remove_routes_by_nexthop(rpl_parent_get_ipaddr(parent), dag_src); - } - } - - LOG_INFO("Moving parent "); - LOG_INFO_6ADDR(rpl_parent_get_ipaddr(parent)); - LOG_INFO_("\n"); - - parent->dag = dag_dst; -} -/*---------------------------------------------------------------------------*/ -int -rpl_has_joined(void) -{ - return rpl_get_any_dag() != NULL; -} -/*---------------------------------------------------------------------------*/ -int -rpl_has_downward_route(void) -{ - int i; - if(rpl_dag_root_is_root()) { - return 1; /* We are the root, and know the route to ourself */ - } - for(i = 0; i < RPL_MAX_INSTANCES; ++i) { - if(instance_table[i].used && instance_table[i].has_downward_route) { - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -rpl_dag_t * -rpl_get_dag(const uip_ipaddr_t *addr) -{ - int i, j; - - for(i = 0; i < RPL_MAX_INSTANCES; ++i) { - if(instance_table[i].used) { - for(j = 0; j < RPL_MAX_DAG_PER_INSTANCE; ++j) { - if(instance_table[i].dag_table[j].joined - && uip_ipaddr_prefixcmp(&instance_table[i].dag_table[j].dag_id, addr, - instance_table[i].dag_table[j].prefix_info.length)) { - return &instance_table[i].dag_table[j]; - } - } - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -rpl_dag_t * -rpl_get_any_dag(void) -{ - int i; - - for(i = 0; i < RPL_MAX_INSTANCES; ++i) { - if(instance_table[i].used && instance_table[i].current_dag->joined) { - return instance_table[i].current_dag; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -rpl_instance_t * -rpl_get_instance(uint8_t instance_id) -{ - int i; - - for(i = 0; i < RPL_MAX_INSTANCES; ++i) { - if(instance_table[i].used && instance_table[i].instance_id == instance_id) { - return &instance_table[i]; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -rpl_of_t * -rpl_find_of(rpl_ocp_t ocp) -{ - unsigned int i; - - for(i = 0; - i < sizeof(objective_functions) / sizeof(objective_functions[0]); - i++) { - if(objective_functions[i]->ocp == ocp) { - return objective_functions[i]; - } - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -void -rpl_join_instance(uip_ipaddr_t *from, rpl_dio_t *dio) -{ - rpl_instance_t *instance; - rpl_dag_t *dag; - rpl_parent_t *p; - rpl_of_t *of; - - if((!RPL_WITH_NON_STORING && dio->mop == RPL_MOP_NON_STORING) - || (!RPL_WITH_STORING && (dio->mop == RPL_MOP_STORING_NO_MULTICAST - || dio->mop == RPL_MOP_STORING_MULTICAST))) { - LOG_WARN("DIO advertising a non-supported MOP %u\n", dio->mop); - return; - } - - /* Determine the objective function by using the - objective code point of the DIO. */ - of = rpl_find_of(dio->ocp); - if(of == NULL) { - LOG_WARN("DIO for DAG instance %u does not specify a supported OF: %u\n", - dio->instance_id, dio->ocp); - return; - } - - dag = rpl_alloc_dag(dio->instance_id, &dio->dag_id); - if(dag == NULL) { - LOG_ERR("Failed to allocate a DAG object!\n"); - return; - } - - instance = dag->instance; - - p = rpl_add_parent(dag, dio, from); - LOG_DBG("Adding "); - LOG_DBG_6ADDR(from); - LOG_DBG_(" as a parent: "); - if(p == NULL) { - LOG_DBG_("failed\n"); - instance->used = 0; - return; - } - p->dtsn = dio->dtsn; - LOG_DBG_("succeeded\n"); - - /* Autoconfigure an address if this node does not already have an address - with this prefix. */ - if(dio->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS) { - check_prefix(NULL, &dio->prefix_info); - } - - dag->joined = 1; - dag->preference = dio->preference; - dag->grounded = dio->grounded; - dag->version = dio->version; - - instance->of = of; - instance->mop = dio->mop; - instance->mc.type = dio->mc.type; - instance->mc.flags = dio->mc.flags; - instance->mc.aggr = dio->mc.aggr; - instance->mc.prec = dio->mc.prec; - instance->current_dag = dag; - instance->dtsn_out = RPL_LOLLIPOP_INIT; - - instance->max_rankinc = dio->dag_max_rankinc; - instance->min_hoprankinc = dio->dag_min_hoprankinc; - instance->dio_intdoubl = dio->dag_intdoubl; - instance->dio_intmin = dio->dag_intmin; - instance->dio_intcurrent = instance->dio_intmin + instance->dio_intdoubl; - instance->dio_redundancy = dio->dag_redund; - instance->default_lifetime = dio->default_lifetime; - instance->lifetime_unit = dio->lifetime_unit; - - memcpy(&dag->dag_id, &dio->dag_id, sizeof(dio->dag_id)); - - /* Copy prefix information from the DIO into the DAG object. */ - memcpy(&dag->prefix_info, &dio->prefix_info, sizeof(rpl_prefix_t)); - - rpl_set_preferred_parent(dag, p); - instance->of->update_metric_container(instance); - dag->rank = rpl_rank_via_parent(p); - /* So far this is the lowest rank we are aware of. */ - dag->min_rank = dag->rank; - - if(default_instance == NULL) { - default_instance = instance; - } - - LOG_INFO("Joined DAG with instance ID %u, rank %hu, DAG ID ", - dio->instance_id, dag->rank); - LOG_INFO_6ADDR(&dag->dag_id); - LOG_INFO_("\n"); - - LOG_ANNOTATE("#A join=%u\n", dag->dag_id.u8[sizeof(dag->dag_id) - 1]); - - rpl_reset_dio_timer(instance); - rpl_set_default_route(instance, from); - - if(instance->mop != RPL_MOP_NO_DOWNWARD_ROUTES) { - rpl_schedule_dao(instance); - } else { - LOG_WARN("The DIO does not meet the prerequisites for sending a DAO\n"); - } - - instance->of->reset(dag); -} - -#if RPL_MAX_DAG_PER_INSTANCE > 1 -/*---------------------------------------------------------------------------*/ -rpl_dag_t * -rpl_add_dag(uip_ipaddr_t *from, rpl_dio_t *dio) -{ - rpl_instance_t *instance; - rpl_dag_t *dag, *previous_dag; - rpl_parent_t *p; - rpl_of_t *of; - - dag = rpl_alloc_dag(dio->instance_id, &dio->dag_id); - if(dag == NULL) { - LOG_ERR("Failed to allocate a DAG object!\n"); - return NULL; - } - - instance = dag->instance; - - previous_dag = find_parent_dag(instance, from); - if(previous_dag == NULL) { - LOG_DBG("Adding "); - LOG_DBG_6ADDR(from); - LOG_DBG_(" as a parent: "); - p = rpl_add_parent(dag, dio, from); - if(p == NULL) { - LOG_DBG_("failed\n"); - dag->used = 0; - return NULL; - } - LOG_DBG_("succeeded\n"); - } else { - p = rpl_find_parent(previous_dag, from); - if(p != NULL) { - rpl_move_parent(previous_dag, dag, p); - } - } - p->rank = dio->rank; - - /* Determine the objective function by using the - objective code point of the DIO. */ - of = rpl_find_of(dio->ocp); - if(of != instance->of || - instance->mop != dio->mop || - instance->max_rankinc != dio->dag_max_rankinc || - instance->min_hoprankinc != dio->dag_min_hoprankinc || - instance->dio_intdoubl != dio->dag_intdoubl || - instance->dio_intmin != dio->dag_intmin || - instance->dio_redundancy != dio->dag_redund || - instance->default_lifetime != dio->default_lifetime || - instance->lifetime_unit != dio->lifetime_unit) { - LOG_WARN("DIO for DAG instance %u incompatible with previous DIO\n", - dio->instance_id); - rpl_remove_parent(p); - dag->used = 0; - return NULL; - } - - dag->used = 1; - dag->grounded = dio->grounded; - dag->preference = dio->preference; - dag->version = dio->version; - - memcpy(&dag->dag_id, &dio->dag_id, sizeof(dio->dag_id)); - - /* copy prefix information into the dag */ - memcpy(&dag->prefix_info, &dio->prefix_info, sizeof(rpl_prefix_t)); - - rpl_set_preferred_parent(dag, p); - dag->rank = rpl_rank_via_parent(p); - dag->min_rank = dag->rank; /* So far this is the lowest rank we know of. */ - - LOG_INFO("Joined DAG with instance ID %u, rank %hu, DAG ID ", - dio->instance_id, dag->rank); - LOG_INFO_6ADDR(&dag->dag_id); - LOG_INFO_("\n"); - - LOG_ANNOTATE("#A join=%u\n", dag->dag_id.u8[sizeof(dag->dag_id) - 1]); - - rpl_process_parent_event(instance, p); - p->dtsn = dio->dtsn; - - return dag; -} -#endif /* RPL_MAX_DAG_PER_INSTANCE > 1 */ - -/*---------------------------------------------------------------------------*/ -static void -global_repair(uip_ipaddr_t *from, rpl_dag_t *dag, rpl_dio_t *dio) -{ - rpl_parent_t *p; - - remove_parents(dag, 0); - dag->version = dio->version; - - /* copy parts of the configuration so that it propagates in the network */ - dag->instance->dio_intdoubl = dio->dag_intdoubl; - dag->instance->dio_intmin = dio->dag_intmin; - dag->instance->dio_redundancy = dio->dag_redund; - dag->instance->default_lifetime = dio->default_lifetime; - dag->instance->lifetime_unit = dio->lifetime_unit; - - dag->instance->of->reset(dag); - dag->min_rank = RPL_INFINITE_RANK; - RPL_LOLLIPOP_INCREMENT(dag->instance->dtsn_out); - - p = rpl_add_parent(dag, dio, from); - if(p == NULL) { - LOG_ERR("Failed to add a parent during the global repair\n"); - dag->rank = RPL_INFINITE_RANK; - } else { - dag->rank = rpl_rank_via_parent(p); - dag->min_rank = dag->rank; - LOG_DBG("rpl_process_parent_event global repair\n"); - rpl_process_parent_event(dag->instance, p); - } - - LOG_DBG("Participating in a global repair (version=%u, rank=%hu)\n", - dag->version, dag->rank); - - RPL_STAT(rpl_stats.global_repairs++); -} - -/*---------------------------------------------------------------------------*/ -void -rpl_local_repair(rpl_instance_t *instance) -{ - int i; - - if(instance == NULL) { - LOG_WARN("local repair requested for instance NULL\n"); - return; - } - LOG_INFO("Starting a local instance repair\n"); - for(i = 0; i < RPL_MAX_DAG_PER_INSTANCE; i++) { - if(instance->dag_table[i].used) { - instance->dag_table[i].rank = RPL_INFINITE_RANK; - nullify_parents(&instance->dag_table[i], 0); - } - } - - /* no downward route anymore */ - instance->has_downward_route = 0; -#if RPL_WITH_DAO_ACK - ctimer_stop(&instance->dao_retransmit_timer); -#endif /* RPL_WITH_DAO_ACK */ - - rpl_reset_dio_timer(instance); - if(RPL_IS_STORING(instance)) { - /* Request refresh of DAO registrations next DIO. Only for storing mode. In - * non-storing mode, non-root nodes increment DTSN only on when their parent do, - * or on global repair (see RFC6550 section 9.6.) */ - RPL_LOLLIPOP_INCREMENT(instance->dtsn_out); - } - - RPL_STAT(rpl_stats.local_repairs++); -} -/*---------------------------------------------------------------------------*/ -void -rpl_recalculate_ranks(void) -{ - rpl_parent_t *p; - - /* - * We recalculate ranks when we receive feedback from the system rather - * than RPL protocol messages. This periodical recalculation is called - * from a timer in order to keep the stack depth reasonably low. - */ - p = nbr_table_head(rpl_parents); - while(p != NULL) { - if(p->dag != NULL && p->dag->instance && (p->flags & RPL_PARENT_FLAG_UPDATED)) { - p->flags &= ~RPL_PARENT_FLAG_UPDATED; - LOG_DBG("rpl_process_parent_event recalculate_ranks\n"); - if(!rpl_process_parent_event(p->dag->instance, p)) { - LOG_DBG("A parent was dropped\n"); - } - } - p = nbr_table_next(rpl_parents, p); - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_process_parent_event(rpl_instance_t *instance, rpl_parent_t *p) -{ - int return_value; - rpl_parent_t *last_parent = instance->current_dag->preferred_parent; - -#if LOG_DBG_ENABLED - rpl_rank_t old_rank; - old_rank = instance->current_dag->rank; -#endif /* LOG_DBG_ENABLED */ - - return_value = 1; - - if(RPL_IS_STORING(instance) - && uip_ds6_route_is_nexthop(rpl_parent_get_ipaddr(p)) - && !rpl_parent_is_reachable(p) && instance->mop > RPL_MOP_NON_STORING) { - LOG_WARN("Unacceptable link %u, removing routes via: ", rpl_get_parent_link_metric(p)); - LOG_WARN_6ADDR(rpl_parent_get_ipaddr(p)); - LOG_WARN_("\n"); - rpl_remove_routes_by_nexthop(rpl_parent_get_ipaddr(p), p->dag); - } - - if(!acceptable_rank(p->dag, p->rank)) { - /* The candidate parent is no longer valid: the rank increase resulting - from the choice of it as a parent would be too high. */ - LOG_WARN("Unacceptable rank %u (Current min %u, MaxRankInc %u)\n", (unsigned)p->rank, - p->dag->min_rank, p->dag->instance->max_rankinc); - rpl_nullify_parent(p); - if(p != instance->current_dag->preferred_parent) { - return 0; - } else { - return_value = 0; - } - } - - if(rpl_select_dag(instance, p) == NULL) { - if(last_parent != NULL) { - /* No suitable parent anymore; trigger a local repair. */ - LOG_ERR("No parents found in any DAG\n"); - rpl_local_repair(instance); - return 0; - } - } - -#if LOG_DBG_ENABLED - if(DAG_RANK(old_rank, instance) != DAG_RANK(instance->current_dag->rank, instance)) { - LOG_INFO("Moving in the instance from rank %hu to %hu\n", - DAG_RANK(old_rank, instance), DAG_RANK(instance->current_dag->rank, instance)); - if(instance->current_dag->rank != RPL_INFINITE_RANK) { - LOG_DBG("The preferred parent is "); - LOG_DBG_6ADDR(rpl_parent_get_ipaddr(instance->current_dag->preferred_parent)); - LOG_DBG_(" (rank %u)\n", - (unsigned)DAG_RANK(instance->current_dag->preferred_parent->rank, instance)); - } else { - LOG_WARN("We don't have any parent"); - } - } -#endif /* LOG_DBG_ENABLED */ - - return return_value; -} -/*---------------------------------------------------------------------------*/ -static int -add_nbr_from_dio(uip_ipaddr_t *from, rpl_dio_t *dio) -{ - /* add this to the neighbor cache if not already there */ - if(rpl_icmp6_update_nbr_table(from, NBR_TABLE_REASON_RPL_DIO, dio) == NULL) { - LOG_ERR("Out of memory, dropping DIO from "); - LOG_ERR_6ADDR(from); - LOG_ERR_("\n"); - return 0; - } - return 1; -} -/*---------------------------------------------------------------------------*/ -void -rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio) -{ - rpl_instance_t *instance; - rpl_dag_t *dag, *previous_dag; - rpl_parent_t *p; - -#if RPL_WITH_MULTICAST - /* If the root is advertising MOP 2 but we support MOP 3 we can still join - * In that scenario, we suppress DAOs for multicast targets */ - if(dio->mop < RPL_MOP_STORING_NO_MULTICAST) { -#else - if(dio->mop != RPL_MOP_DEFAULT) { -#endif - LOG_ERR("Ignoring a DIO with an unsupported MOP: %d\n", dio->mop); - return; - } - - dag = get_dag(dio->instance_id, &dio->dag_id); - instance = rpl_get_instance(dio->instance_id); - - if(dag != NULL && instance != NULL) { - if(lollipop_greater_than(dio->version, dag->version)) { - if(dag->rank == ROOT_RANK(instance)) { - LOG_WARN("Root received inconsistent DIO version number (current: %u, received: %u)\n", dag->version, dio->version); - dag->version = dio->version; - RPL_LOLLIPOP_INCREMENT(dag->version); - rpl_reset_dio_timer(instance); - } else { - LOG_DBG("Global repair\n"); - if(dio->prefix_info.length != 0) { - if(dio->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS) { - LOG_DBG("Prefix announced in DIO\n"); - rpl_set_prefix(dag, &dio->prefix_info.prefix, dio->prefix_info.length); - } - } - global_repair(from, dag, dio); - } - return; - } - - if(lollipop_greater_than(dag->version, dio->version)) { - /* The DIO sender is on an older version of the DAG. */ - LOG_WARN("old version received => inconsistency detected\n"); - if(dag->joined) { - rpl_reset_dio_timer(instance); - return; - } - } - } - - if(instance == NULL) { - LOG_INFO("New instance detected (ID=%u): Joining...\n", dio->instance_id); - if(add_nbr_from_dio(from, dio)) { - rpl_join_instance(from, dio); - } else { - LOG_WARN("Not joining since could not add parent\n"); - } - return; - } - - if(instance->current_dag->rank == ROOT_RANK(instance) && instance->current_dag != dag) { - LOG_WARN("Root ignored DIO for different DAG\n"); - return; - } - - if(dag == NULL) { -#if RPL_MAX_DAG_PER_INSTANCE > 1 - LOG_INFO("Adding new DAG to known instance.\n"); - if(!add_nbr_from_dio(from, dio)) { - LOG_WARN("Could not add new DAG, could not add parent\n"); - return; - } - dag = rpl_add_dag(from, dio); - if(dag == NULL) { - LOG_WARN("Failed to add DAG.\n"); - return; - } -#else /* RPL_MAX_DAG_PER_INSTANCE > 1 */ - LOG_WARN("Only one instance supported.\n"); - return; -#endif /* RPL_MAX_DAG_PER_INSTANCE > 1 */ - } - - - if(dio->rank < ROOT_RANK(instance)) { - LOG_INFO("Ignoring DIO with too low rank: %u\n", - (unsigned)dio->rank); - return; - } - - /* Prefix Information Option treated to add new prefix */ - if(dio->prefix_info.length != 0) { - if(dio->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS) { - LOG_DBG("Prefix announced in DIO\n"); - rpl_set_prefix(dag, &dio->prefix_info.prefix, dio->prefix_info.length); - } - } - - if(!add_nbr_from_dio(from, dio)) { - LOG_WARN("Could not add parent based on DIO\n"); - return; - } - - if(dag->rank == ROOT_RANK(instance)) { - if(dio->rank != RPL_INFINITE_RANK) { - instance->dio_counter++; - } - return; - } - - /* The DIO comes from a valid DAG, we can refresh its lifetime */ - dag->lifetime = (1UL << (instance->dio_intmin + instance->dio_intdoubl)) * RPL_DAG_LIFETIME / 1000; - LOG_INFO("Set dag "); - LOG_INFO_6ADDR(&dag->dag_id); - LOG_INFO_(" lifetime to %ld\n", (long int) dag->lifetime); - - /* - * At this point, we know that this DIO pertains to a DAG that - * we are already part of. We consider the sender of the DIO to be - * a candidate parent, and let rpl_process_parent_event decide - * whether to keep it in the set. - */ - - p = rpl_find_parent(dag, from); - if(p == NULL) { - previous_dag = find_parent_dag(instance, from); - if(previous_dag == NULL) { - /* Add the DIO sender as a candidate parent. */ - p = rpl_add_parent(dag, dio, from); - if(p == NULL) { - LOG_WARN("Failed to add a new parent ("); - LOG_WARN_6ADDR(from); - LOG_WARN_(")\n"); - return; - } - LOG_INFO("New candidate parent with rank %u: ", (unsigned)p->rank); - LOG_INFO_6ADDR(from); - LOG_INFO_("\n"); - } else { - p = rpl_find_parent(previous_dag, from); - if(p != NULL) { - rpl_move_parent(previous_dag, dag, p); - } - } - } else { - if(p->rank == dio->rank) { - LOG_WARN("Received consistent DIO\n"); - if(dag->joined) { - instance->dio_counter++; - } - } - } - p->rank = dio->rank; - - if(dio->rank == RPL_INFINITE_RANK && p == dag->preferred_parent) { - /* Our preferred parent advertised an infinite rank, reset DIO timer */ - rpl_reset_dio_timer(instance); - } - - /* Parent info has been updated, trigger rank recalculation */ - p->flags |= RPL_PARENT_FLAG_UPDATED; - - LOG_INFO("preferred DAG "); - LOG_INFO_6ADDR(&instance->current_dag->dag_id); - LOG_INFO_(", rank %u, min_rank %u, ", - instance->current_dag->rank, instance->current_dag->min_rank); - LOG_INFO_("parent rank %u, link metric %u\n", - p->rank, rpl_get_parent_link_metric(p)); - - /* We have allocated a candidate parent; process the DIO further. */ - -#if RPL_WITH_MC - memcpy(&p->mc, &dio->mc, sizeof(p->mc)); -#endif /* RPL_WITH_MC */ - if(rpl_process_parent_event(instance, p) == 0) { - LOG_WARN("The candidate parent is rejected\n"); - return; - } - - /* We don't use route control, so we can have only one official parent. */ - if(dag->joined && p == dag->preferred_parent) { - if(should_refresh_routes(instance, dio, p)) { - /* Our parent is requesting a new DAO. Increment DTSN in turn, - * in both storing and non-storing mode (see RFC6550 section 9.6.) */ - RPL_LOLLIPOP_INCREMENT(instance->dtsn_out); - rpl_schedule_dao(instance); - } - /* We received a new DIO from our preferred parent. - * Call uip_ds6_defrt_add to set a fresh value for the lifetime counter */ - uip_ds6_defrt_add(from, RPL_DEFAULT_ROUTE_INFINITE_LIFETIME ? 0 : RPL_LIFETIME(instance, instance->default_lifetime)); - } - p->dtsn = dio->dtsn; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/routing/rpl-classic/rpl-ext-header.c b/os/net/routing/rpl-classic/rpl-ext-header.c deleted file mode 100644 index 34d9b4907..000000000 --- a/os/net/routing/rpl-classic/rpl-ext-header.c +++ /dev/null @@ -1,588 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Management of extension headers for ContikiRPL. - * - * \author Vincent Brillault , - * Joakim Eriksson , - * Niclas Finne , - * Nicolas Tsiftes . - */ - -/** - * \addtogroup uip - * @{ - */ - -#include "net/routing/routing.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/tcpip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-sr.h" -#include "net/routing/rpl-classic/rpl-private.h" -#include "net/packetbuf.h" - -#include "sys/log.h" - -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -#include -#include - -/*---------------------------------------------------------------------------*/ -int -rpl_ext_header_hbh_update(uint8_t *ext_buf, int opt_offset) -{ - rpl_instance_t *instance; - int down; - uint16_t sender_rank; - uint8_t sender_closer; - uip_ds6_route_t *route; - rpl_parent_t *sender; - struct uip_hbho_hdr *hbh_hdr = (struct uip_hbho_hdr *)ext_buf; - struct uip_ext_hdr_opt_rpl *rpl_opt = (struct uip_ext_hdr_opt_rpl *)(ext_buf + opt_offset); - - if(hbh_hdr->len != ((RPL_HOP_BY_HOP_LEN - 8) / 8) - || rpl_opt->opt_type != UIP_EXT_HDR_OPT_RPL - || rpl_opt->opt_len != RPL_HDR_OPT_LEN) { - - LOG_ERR("Hop-by-hop extension header has wrong size or type (%u %u %u)\n", - hbh_hdr->len, rpl_opt->opt_type, rpl_opt->opt_len); - return 0; /* Drop */ - } - - instance = rpl_get_instance(rpl_opt->instance); - if(instance == NULL) { - LOG_ERR("Unknown instance: %u\n", rpl_opt->instance); - return 0; - } - - if(rpl_opt->flags & RPL_HDR_OPT_FWD_ERR) { - LOG_ERR("Forward error!\n"); - /* We should try to repair it by removing the neighbor that caused - the packet to be forwareded in the first place. We drop any - routes that go through the neighbor that sent the packet to - us. */ - if(RPL_IS_STORING(instance)) { - route = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr); - if(route != NULL) { - uip_ds6_route_rm(route); - } - } - RPL_STAT(rpl_stats.forward_errors++); - /* Trigger DAO retransmission */ - rpl_reset_dio_timer(instance); - /* drop the packet as it is not routable */ - return 0; - } - - if(!instance->current_dag->joined) { - LOG_ERR("No DAG in the instance\n"); - return 0; - } - down = 0; - if(rpl_opt->flags & RPL_HDR_OPT_DOWN) { - down = 1; - } - - sender_rank = UIP_HTONS(rpl_opt->senderrank); - sender = nbr_table_get_from_lladdr(rpl_parents, packetbuf_addr(PACKETBUF_ADDR_SENDER)); - - if(sender != NULL && (rpl_opt->flags & RPL_HDR_OPT_RANK_ERR)) { - /* A rank error was signalled, attempt to repair it by updating - * the sender's rank from ext header */ - sender->rank = sender_rank; - if(RPL_IS_NON_STORING(instance)) { - /* Select DAG and preferred parent only in non-storing mode. In storing mode, - * a parent switch would result in an immediate No-path DAO transmission, dropping - * current incoming packet. */ - rpl_select_dag(instance, sender); - } - } - - sender_closer = sender_rank < instance->current_dag->rank; - - LOG_DBG("Packet going %s, sender closer %d (%d < %d)\n", down == 1 ? "down" : "up", - sender_closer, - sender_rank, - instance->current_dag->rank - ); - - if((down && !sender_closer) || (!down && sender_closer)) { - LOG_WARN("Loop detected - senderrank: %d my-rank: %d sender_closer: %d\n", - sender_rank, instance->current_dag->rank, - sender_closer); - /* Attempt to repair the loop by sending a unicast DIO back to the sender - * so that it gets a fresh update of our rank. */ - if(sender != NULL) { - instance->unicast_dio_target = sender; - rpl_schedule_unicast_dio_immediately(instance); - } - if(rpl_opt->flags & RPL_HDR_OPT_RANK_ERR) { - RPL_STAT(rpl_stats.loop_errors++); - LOG_ERR(" Rank error signalled in RPL option!\n"); - /* Packet must be dropped and dio trickle timer reset, see RFC6550 - 11.2.2.2 */ - rpl_reset_dio_timer(instance); - return 0; - } - LOG_WARN("Single error tolerated\n"); - RPL_STAT(rpl_stats.loop_warnings++); - rpl_opt->flags |= RPL_HDR_OPT_RANK_ERR; - return 1; - } - - LOG_DBG("Rank OK\n"); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr) -{ -#if RPL_WITH_NON_STORING - struct uip_routing_hdr *rh_header; - rpl_dag_t *dag; - uip_sr_node_t *dest_node; - uip_sr_node_t *root_node; - - /* Look for routing ext header */ - rh_header = (struct uip_routing_hdr *)uipbuf_search_header(uip_buf, uip_len, UIP_PROTO_ROUTING); - - dag = rpl_get_dag(&UIP_IP_BUF->destipaddr); - root_node = uip_sr_get_node(dag, &dag->dag_id); - dest_node = uip_sr_get_node(dag, &UIP_IP_BUF->destipaddr); - - if((rh_header != NULL && rh_header->routing_type == RPL_RH_TYPE_SRH) || - (dest_node != NULL && root_node != NULL && - dest_node->parent == root_node)) { - /* Routing header found or the packet destined for a direct child of the root. - * The next hop should be already copied as the IPv6 destination - * address, via rpl_ext_header_srh_update. We turn this address into a link-local to enable - * forwarding to next hop */ - uip_ipaddr_copy(ipaddr, &UIP_IP_BUF->destipaddr); - uip_create_linklocal_prefix(ipaddr); - return 1; - } - - return 0; -#else /* RPL_WITH_NON_STORING */ - return 0; /* SRH not found */ -#endif /* RPL_WITH_NON_STORING */ -} -/*---------------------------------------------------------------------------*/ -int -rpl_ext_header_srh_update(void) -{ -#if RPL_WITH_NON_STORING - struct uip_routing_hdr *rh_header; - struct uip_rpl_srh_hdr *srh_header; - - /* Look for routing ext header */ - rh_header = (struct uip_routing_hdr *)uipbuf_search_header(uip_buf, uip_len, UIP_PROTO_ROUTING); - - if(rh_header != NULL && rh_header->routing_type == RPL_RH_TYPE_SRH) { - /* SRH found, now look for next hop */ - uint8_t cmpri, cmpre; - uint8_t ext_len; - uint8_t padding; - uint8_t path_len; - uint8_t segments_left; - uip_ipaddr_t current_dest_addr; - - srh_header = (struct uip_rpl_srh_hdr *)(((uint8_t *)rh_header) + RPL_RH_LEN); - segments_left = rh_header->seg_left; - ext_len = rh_header->len * 8 + 8; - cmpri = srh_header->cmpr >> 4; - cmpre = srh_header->cmpr & 0x0f; - padding = srh_header->pad >> 4; - path_len = ((ext_len - padding - RPL_RH_LEN - RPL_SRH_LEN - (16 - cmpre)) / (16 - cmpri)) + 1; - (void)path_len; - - LOG_DBG("read SRH, path len %u, segments left %u, Cmpri %u, Cmpre %u, ext len %u (padding %u)\n", - path_len, segments_left, cmpri, cmpre, ext_len, padding); - - if(segments_left == 0) { - /* We are the final destination, do nothing */ - } else { - uint8_t i = path_len - segments_left; /* The index of the next address to be visited */ - uint8_t *addr_ptr = ((uint8_t *)rh_header) + RPL_RH_LEN + RPL_SRH_LEN + (i * (16 - cmpri)); - uint8_t cmpr = segments_left == 1 ? cmpre : cmpri; - - /* As per RFC6554: swap the IPv6 destination address and address[i] */ - - /* First, copy the current IPv6 destination address */ - uip_ipaddr_copy(¤t_dest_addr, &UIP_IP_BUF->destipaddr); - /* Second, update the IPv6 destination address with addresses[i] */ - memcpy(((uint8_t *)&UIP_IP_BUF->destipaddr) + cmpr, addr_ptr, 16 - cmpr); - /* Third, write current_dest_addr to addresses[i] */ - memcpy(addr_ptr, ((uint8_t *)¤t_dest_addr) + cmpr, 16 - cmpr); - - /* Update segments left field */ - rh_header->seg_left--; - - LOG_INFO("SRH next hop "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - } - return 1; - } - - return 0; -#else /* RPL_WITH_NON_STORING */ - return 0; /* SRH not found */ -#endif /* RPL_WITH_NON_STORING */ -} -/*---------------------------------------------------------------------------*/ -static int -count_matching_bytes(const void *p1, const void *p2, size_t n) -{ - int i = 0; - for(i = 0; i < n; i++) { - if(((uint8_t *)p1)[i] != ((uint8_t *)p2)[i]) { - return i; - } - } - return n; -} -/*---------------------------------------------------------------------------*/ -static int -insert_srh_header(void) -{ - /* Implementation of RFC6554 */ - uint8_t path_len; - uint8_t ext_len; - uint8_t cmpri, cmpre; /* ComprI and ComprE fields of the RPL Source Routing Header */ - uint8_t *hop_ptr; - uint8_t padding; - uip_sr_node_t *dest_node; - uip_sr_node_t *root_node; - uip_sr_node_t *node; - rpl_dag_t *dag; - uip_ipaddr_t node_addr; - - /* Always insest SRH as first extension header */ - struct uip_routing_hdr *rh_hdr = (struct uip_routing_hdr *)UIP_IP_PAYLOAD(0); - struct uip_rpl_srh_hdr *srh_hdr = (struct uip_rpl_srh_hdr *)(UIP_IP_PAYLOAD(0) + RPL_RH_LEN); - - LOG_INFO("SRH creating source routing header with destination "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - - /* Construct source route. We do not do this recursively to keep the runtime stack usage constant. */ - - /* Get link of the destination and root */ - dag = rpl_get_dag(&UIP_IP_BUF->destipaddr); - - if(dag == NULL) { - LOG_ERR("SRH DAG not found\n"); - return 0; - } - - dest_node = uip_sr_get_node(dag, &UIP_IP_BUF->destipaddr); - if(dest_node == NULL) { - /* The destination is not found, skip SRH insertion */ - return 1; - } - - root_node = uip_sr_get_node(dag, &dag->dag_id); - if(root_node == NULL) { - LOG_ERR("SRH root node not found\n"); - return 0; - } - - if(!uip_sr_is_addr_reachable(dag, &UIP_IP_BUF->destipaddr)) { - LOG_ERR("SRH no path found to destination\n"); - return 0; - } - - /* Compute path length and compression factors (we use cmpri == cmpre) */ - path_len = 0; - node = dest_node->parent; - /* For simplicity, we use cmpri = cmpre */ - cmpri = 15; - cmpre = 15; - - if(node == root_node) { - LOG_DBG("SRH no need to insert SRH\n"); - return 1; - } - - while(node != NULL && node != root_node) { - - NETSTACK_ROUTING.get_sr_node_ipaddr(&node_addr, node); - - /* How many bytes in common between all nodes in the path? */ - cmpri = MIN(cmpri, count_matching_bytes(&node_addr, &UIP_IP_BUF->destipaddr, 16)); - cmpre = cmpri; - - LOG_DBG("SRH Hop "); - LOG_DBG_6ADDR(&node_addr); - LOG_DBG_("\n"); - node = node->parent; - path_len++; - } - - /* Extension header length: fixed headers + (n-1) * (16-ComprI) + (16-ComprE)*/ - ext_len = RPL_RH_LEN + RPL_SRH_LEN - + (path_len - 1) * (16 - cmpre) - + (16 - cmpri); - - padding = ext_len % 8 == 0 ? 0 : (8 - (ext_len % 8)); - ext_len += padding; - - LOG_DBG("SRH Path len: %u, ComprI %u, ComprE %u, ext len %u (padding %u)\n", - path_len, cmpri, cmpre, ext_len, padding); - - /* Check if there is enough space to store the extension header */ - if(uip_len + ext_len > UIP_LINK_MTU) { - LOG_ERR("Packet too long: impossible to add source routing header (%u bytes)\n", ext_len); - return 0; - } - - /* Move existing ext headers and payload ext_len further */ - memmove(uip_buf + UIP_IPH_LEN + uip_ext_len + ext_len, - uip_buf + UIP_IPH_LEN + uip_ext_len, uip_len - UIP_IPH_LEN); - memset(uip_buf + UIP_IPH_LEN + uip_ext_len, 0, ext_len); - - /* Insert source routing header (as first ext header) */ - rh_hdr->next = UIP_IP_BUF->proto; - UIP_IP_BUF->proto = UIP_PROTO_ROUTING; - - /* Initialize IPv6 Routing Header */ - rh_hdr->len = (ext_len - 8) / 8; - rh_hdr->routing_type = RPL_RH_TYPE_SRH; - rh_hdr->seg_left = path_len; - - /* Initialize RPL Source Routing Header */ - srh_hdr->cmpr = (cmpri << 4) + cmpre; - srh_hdr->pad = padding << 4; - - /* Initialize addresses field (the actual source route). - * From last to first. */ - node = dest_node; - hop_ptr = ((uint8_t *)rh_hdr) + ext_len - padding; /* Pointer where to write the next hop compressed address */ - - while(node != NULL && node->parent != root_node) { - NETSTACK_ROUTING.get_sr_node_ipaddr(&node_addr, node); - - hop_ptr -= (16 - cmpri); - memcpy(hop_ptr, ((uint8_t*)&node_addr) + cmpri, 16 - cmpri); - - node = node->parent; - } - - /* The next hop (i.e. node whose parent is the root) is placed as the current IPv6 destination */ - NETSTACK_ROUTING.get_sr_node_ipaddr(&node_addr, node); - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &node_addr); - - /* Update the IPv6 length field */ - uipbuf_add_ext_hdr(ext_len); - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -update_hbh_header(void) -{ - rpl_instance_t *instance; - rpl_parent_t *parent; - struct uip_hbho_hdr *hbh_hdr = (struct uip_hbho_hdr *)UIP_IP_PAYLOAD(0); - struct uip_ext_hdr_opt_rpl *rpl_opt = (struct uip_ext_hdr_opt_rpl *)(UIP_IP_PAYLOAD(0) + 2); - - if(UIP_IP_BUF->proto == UIP_PROTO_HBHO && rpl_opt->opt_type == UIP_EXT_HDR_OPT_RPL) { - if(hbh_hdr->len != ((RPL_HOP_BY_HOP_LEN - 8) / 8) - || rpl_opt->opt_len != RPL_HDR_OPT_LEN) { - - LOG_ERR("Hop-by-hop extension header has wrong size (%u)\n", rpl_opt->opt_len); - return 0; /* Drop */ - } - - instance = rpl_get_instance(rpl_opt->instance); - if(instance == NULL || !instance->used || !instance->current_dag->joined) { - LOG_ERR("Unable to add/update hop-by-hop extension header: incorrect instance\n"); - return 0; /* Drop */ - } - - LOG_INFO("Updating RPL option\n"); - /* Update sender rank and instance, will update flags next */ - rpl_opt->senderrank = UIP_HTONS(instance->current_dag->rank); - rpl_opt->instance = instance->instance_id; - - if(RPL_IS_STORING(instance)) { /* In non-storing mode, downwards traffic does not have the HBH option */ - /* Check the direction of the down flag, as per Section 11.2.2.3, - which states that if a packet is going down it should in - general not go back up again. If this happens, a - RPL_HDR_OPT_FWD_ERR should be flagged. */ - if((rpl_opt->flags & RPL_HDR_OPT_DOWN)) { - if(uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr) == NULL) { - rpl_opt->flags |= RPL_HDR_OPT_FWD_ERR; - LOG_WARN("RPL forwarding error\n"); - /* We should send back the packet to the originating parent, - but it is not feasible yet, so we send a No-Path DAO instead */ - LOG_WARN("RPL generate No-Path DAO\n"); - parent = rpl_get_parent((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); - if(parent != NULL) { - dao_output_target(parent, &UIP_IP_BUF->destipaddr, RPL_ZERO_LIFETIME); - } - /* Drop packet */ - return 0; - } - } else { - /* Set the down extension flag correctly as described in Section - 11.2 of RFC6550. If the packet progresses along a DAO route, - the down flag should be set. */ - if(uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr) == NULL) { - /* No route was found, so this packet will go towards the RPL - root. If so, we should not set the down flag. */ - rpl_opt->flags &= ~RPL_HDR_OPT_DOWN; - LOG_DBG("RPL option going up\n"); - } else { - /* A DAO route was found so we set the down flag. */ - rpl_opt->flags |= RPL_HDR_OPT_DOWN; - LOG_DBG("RPL option going down\n"); - } - } - } - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -insert_hbh_header(const rpl_instance_t *instance) -{ - struct uip_hbho_hdr *hbh_hdr = (struct uip_hbho_hdr *)UIP_IP_PAYLOAD(0); - struct uip_ext_hdr_opt_rpl *rpl_opt = (struct uip_ext_hdr_opt_rpl *)(UIP_IP_PAYLOAD(2)); - - /* Insert hop-by-hop header */ - LOG_DBG("Creating hop-by-hop option\n"); - if(uip_len + RPL_HOP_BY_HOP_LEN > UIP_LINK_MTU) { - LOG_ERR("Packet too long: impossible to add hop-by-hop option\n"); - return 0; - } - - /* Move existing ext headers and payload RPL_HOP_BY_HOP_LEN further */ - memmove(UIP_IP_PAYLOAD(RPL_HOP_BY_HOP_LEN), UIP_IP_PAYLOAD(0), uip_len - UIP_IPH_LEN); - memset(UIP_IP_PAYLOAD(0), 0, RPL_HOP_BY_HOP_LEN); - - /* Insert HBH header (as first ext header) */ - hbh_hdr->next = UIP_IP_BUF->proto; - UIP_IP_BUF->proto = UIP_PROTO_HBHO; - - /* Initialize HBH option */ - hbh_hdr->len = (RPL_HOP_BY_HOP_LEN - 8) / 8; - rpl_opt->opt_type = UIP_EXT_HDR_OPT_RPL; - rpl_opt->opt_len = RPL_HDR_OPT_LEN; - rpl_opt->flags = 0; - rpl_opt->senderrank = UIP_HTONS(instance->current_dag->rank); - rpl_opt->instance = instance->instance_id; - - uipbuf_add_ext_hdr(RPL_HOP_BY_HOP_LEN); - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - - /* Update header before returning */ - return update_hbh_header(); -} -/*---------------------------------------------------------------------------*/ -void -rpl_ext_header_remove(void) -{ - uint8_t *prev_proto_ptr; - uint8_t protocol; - uint8_t ext_len; - uint8_t *next_header; - struct uip_ext_hdr *ext_ptr; - struct uip_ext_hdr_opt *opt_ptr; - - next_header = uipbuf_get_next_header(uip_buf, uip_len, &protocol, true); - ext_ptr = (struct uip_ext_hdr *)next_header; - prev_proto_ptr = &UIP_IP_BUF->proto; - while(next_header != NULL && uip_is_proto_ext_hdr(protocol)) { - opt_ptr = (struct uip_ext_hdr_opt *)(next_header + 2); - if(protocol == UIP_PROTO_ROUTING || (protocol == UIP_PROTO_HBHO && opt_ptr->type == UIP_EXT_HDR_OPT_RPL)) { - /* Remove ext header */ - *prev_proto_ptr = ext_ptr->next; - ext_len = ext_ptr->len * 8 + 8; - uipbuf_add_ext_hdr(-ext_len); - /* Update length field and rest of packer to the "left" */ - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - memmove(next_header, next_header + ext_len, uip_len - (next_header - uip_buf)); - /* Update loop variables */ - protocol = *prev_proto_ptr; - } else { - /* move to the ext hdr */ - next_header = uipbuf_get_next_header(next_header, uip_len - (next_header - uip_buf), &protocol, false); - ext_ptr = (struct uip_ext_hdr *)next_header; - prev_proto_ptr = &ext_ptr->next; - } - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_ext_header_update(void) -{ - if(default_instance == NULL || default_instance->current_dag == NULL - || uip_is_addr_linklocal(&UIP_IP_BUF->destipaddr) || uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) { - return 1; - } - - if(default_instance->current_dag->rank == ROOT_RANK(default_instance)) { - /* At the root, remove headers if any, and insert SRH or HBH - * (SRH is inserted only if the destination is in the DODAG) */ - rpl_ext_header_remove(); - if(rpl_get_dag(&UIP_IP_BUF->destipaddr) != NULL) { - /* dest is in a DODAG; the packet is going down. */ - if(RPL_IS_NON_STORING(default_instance)) { - return insert_srh_header(); - } else { - return insert_hbh_header(default_instance); - } - } else { - /* dest is outside of DODAGs; no ext header is needed. */ - return 1; - } - } else { - if(uip_ds6_is_my_addr(&UIP_IP_BUF->srcipaddr) - && UIP_IP_BUF->ttl == uip_ds6_if.cur_hop_limit) { - /* Insert HBH option at source. Checking the address is not sufficient because - * in non-storing mode, a packet may go up and then down the same path again */ - return insert_hbh_header(default_instance); - } else { - /* Update HBH option at forwarders */ - return update_hbh_header(); - } - } -} - -/** @}*/ diff --git a/os/net/routing/rpl-classic/rpl-icmp6.c b/os/net/routing/rpl-classic/rpl-icmp6.c deleted file mode 100644 index baa6b08a7..000000000 --- a/os/net/routing/rpl-classic/rpl-icmp6.c +++ /dev/null @@ -1,1398 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * ICMP6 I/O for RPL control messages. - * - * \author Joakim Eriksson , Nicolas Tsiftes - * Contributors: Niclas Finne , Joel Hoglund , - * Mathieu Pouillot - * George Oikonomou (multicast) - */ - -/** - * \addtogroup uip - * @{ - */ - -#include "net/ipv6/tcpip.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-nd6.h" -#include "net/ipv6/uip-sr.h" -#include "net/ipv6/uip-icmp6.h" -#include "net/routing/rpl-classic/rpl-private.h" -#include "net/packetbuf.h" -#include "net/ipv6/multicast/uip-mcast6.h" -#include "random.h" - -#include "sys/log.h" - -#include -#include - -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/*---------------------------------------------------------------------------*/ -#define RPL_DIO_GROUNDED 0x80 -#define RPL_DIO_MOP_SHIFT 3 -#define RPL_DIO_MOP_MASK 0x38 -#define RPL_DIO_PREFERENCE_MASK 0x07 - -/*---------------------------------------------------------------------------*/ -static void dis_input(void); -static void dio_input(void); -static void dao_input(void); -static void dao_ack_input(void); - -static void dao_output_target_seq(rpl_parent_t *parent, uip_ipaddr_t *prefix, - uint8_t lifetime, uint8_t seq_no); - -/* some debug callbacks useful when debugging RPL networks */ -#ifdef RPL_DEBUG_DIO_INPUT -void RPL_DEBUG_DIO_INPUT(uip_ipaddr_t *, rpl_dio_t *); -#endif - -#ifdef RPL_DEBUG_DAO_OUTPUT -void RPL_DEBUG_DAO_OUTPUT(rpl_parent_t *); -#endif - -static uint8_t dao_sequence = RPL_LOLLIPOP_INIT; - -#if RPL_WITH_MULTICAST -static uip_mcast6_route_t *mcast_group; -#endif -/*---------------------------------------------------------------------------*/ -/* Initialise RPL ICMPv6 message handlers */ -UIP_ICMP6_HANDLER(dis_handler, ICMP6_RPL, RPL_CODE_DIS, dis_input); -UIP_ICMP6_HANDLER(dio_handler, ICMP6_RPL, RPL_CODE_DIO, dio_input); -UIP_ICMP6_HANDLER(dao_handler, ICMP6_RPL, RPL_CODE_DAO, dao_input); -UIP_ICMP6_HANDLER(dao_ack_handler, ICMP6_RPL, RPL_CODE_DAO_ACK, dao_ack_input); -/*---------------------------------------------------------------------------*/ - -#if RPL_WITH_DAO_ACK -static uip_ds6_route_t * -find_route_entry_by_dao_ack(uint8_t seq) -{ - uip_ds6_route_t *re; - re = uip_ds6_route_head(); - while(re != NULL) { - if(re->state.dao_seqno_out == seq && RPL_ROUTE_IS_DAO_PENDING(re)) { - /* found it! */ - return re; - } - re = uip_ds6_route_next(re); - } - return NULL; -} -#endif /* RPL_WITH_DAO_ACK */ - -#if RPL_WITH_STORING -/* prepare for forwarding of DAO */ -static uint8_t -prepare_for_dao_fwd(uint8_t sequence, uip_ds6_route_t *rep) -{ - /* not pending - or pending but not a retransmission */ - RPL_LOLLIPOP_INCREMENT(dao_sequence); - - /* set DAO pending and sequence numbers */ - rep->state.dao_seqno_in = sequence; - rep->state.dao_seqno_out = dao_sequence; - RPL_ROUTE_SET_DAO_PENDING(rep); - return dao_sequence; -} -#endif /* RPL_WITH_STORING */ -/*---------------------------------------------------------------------------*/ -static int -get_global_addr(uip_ipaddr_t *addr) -{ - int i; - int state; - uip_ipaddr_t *prefix = NULL; - uint8_t prefix_length = 0; - rpl_dag_t *dag = rpl_get_any_dag(); - - if(dag != NULL && dag->prefix_info.length != 0) { - prefix = &dag->prefix_info.prefix; - prefix_length = dag->prefix_info.length; - } - - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - state == ADDR_PREFERRED && - !uip_is_addr_linklocal(&uip_ds6_if.addr_list[i].ipaddr) && - (prefix == NULL || uip_ipaddr_prefixcmp(prefix, &uip_ds6_if.addr_list[i].ipaddr, prefix_length))) { - memcpy(addr, &uip_ds6_if.addr_list[i].ipaddr, sizeof(uip_ipaddr_t)); - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static uint32_t -get32(uint8_t *buffer, int pos) -{ - return ((uint32_t)buffer[pos] << 24 | (uint32_t)buffer[pos + 1] << 16 | - (uint32_t)buffer[pos + 2] << 8 | buffer[pos + 3]); -} -/*---------------------------------------------------------------------------*/ -static void -set32(uint8_t *buffer, int pos, uint32_t value) -{ - buffer[pos++] = value >> 24; - buffer[pos++] = (value >> 16) & 0xff; - buffer[pos++] = (value >> 8) & 0xff; - buffer[pos++] = value & 0xff; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -get16(uint8_t *buffer, int pos) -{ - return (uint16_t)buffer[pos] << 8 | buffer[pos + 1]; -} -/*---------------------------------------------------------------------------*/ -static void -set16(uint8_t *buffer, int pos, uint16_t value) -{ - buffer[pos++] = value >> 8; - buffer[pos++] = value & 0xff; -} -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -rpl_icmp6_update_nbr_table(uip_ipaddr_t *from, nbr_table_reason_t reason, void *data) -{ - uip_ds6_nbr_t *nbr; - - if((nbr = uip_ds6_nbr_lookup(from)) == NULL) { - if((nbr = uip_ds6_nbr_add(from, (uip_lladdr_t *) - packetbuf_addr(PACKETBUF_ADDR_SENDER), - 0, NBR_REACHABLE, reason, data)) != NULL) { - LOG_INFO("Neighbor added to neighbor cache "); - LOG_INFO_6ADDR(from); - LOG_INFO_(", "); - LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_INFO_("\n"); - } - } - - return nbr; -} -/*---------------------------------------------------------------------------*/ -static void -dis_input(void) -{ - rpl_instance_t *instance; - rpl_instance_t *end; - - /* DAG Information Solicitation */ - LOG_INFO("Received a DIS from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - - for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; - instance < end; ++instance) { - if(instance->used == 1) { - if(uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) { -#if RPL_LEAF_ONLY - LOG_INFO("LEAF ONLY Multicast DIS will NOT reset DIO timer\n"); -#else /* !RPL_LEAF_ONLY */ - LOG_DBG("Multicast DIS => reset DIO timer\n"); - rpl_reset_dio_timer(instance); -#endif /* !RPL_LEAF_ONLY */ - } else { - /* Check if this neighbor should be added according to the policy. */ - if(rpl_icmp6_update_nbr_table(&UIP_IP_BUF->srcipaddr, - NBR_TABLE_REASON_RPL_DIS, NULL) == NULL) { - LOG_ERR("Out of Memory, not sending unicast DIO, DIS from "); - LOG_ERR_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_ERR_(", "); - LOG_ERR_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_ERR_("\n"); - } else { - LOG_DBG("Unicast DIS, reply to sender\n"); - dio_output(instance, &UIP_IP_BUF->srcipaddr); - } - /* } */ - } - } - } - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -void -dis_output(uip_ipaddr_t *addr) -{ - unsigned char *buffer; - uip_ipaddr_t tmpaddr; - - /* - * DAG Information Solicitation - 2 bytes reserved - * 0 1 2 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Flags | Reserved | Option(s)... - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - - buffer = UIP_ICMP_PAYLOAD; - buffer[0] = buffer[1] = 0; - - if(addr == NULL) { - uip_create_linklocal_rplnodes_mcast(&tmpaddr); - addr = &tmpaddr; - } - - LOG_INFO("Sending a DIS to "); - LOG_INFO_6ADDR(addr); - LOG_INFO_("\n"); - - uip_icmp6_send(addr, ICMP6_RPL, RPL_CODE_DIS, 2); -} -/*---------------------------------------------------------------------------*/ -static void -dio_input(void) -{ - unsigned char *buffer; - uint8_t buffer_length; - rpl_dio_t dio; - uint8_t subopt_type; - int i; - int len; - uip_ipaddr_t from; - - memset(&dio, 0, sizeof(dio)); - - /* Set default values in case the DIO configuration option is missing. */ - dio.dag_intdoubl = RPL_DIO_INTERVAL_DOUBLINGS; - dio.dag_intmin = RPL_DIO_INTERVAL_MIN; - dio.dag_redund = RPL_DIO_REDUNDANCY; - dio.dag_min_hoprankinc = RPL_MIN_HOPRANKINC; - dio.dag_max_rankinc = RPL_MAX_RANKINC; - dio.ocp = RPL_OF_OCP; - dio.default_lifetime = RPL_DEFAULT_LIFETIME; - dio.lifetime_unit = RPL_DEFAULT_LIFETIME_UNIT; - - uip_ipaddr_copy(&from, &UIP_IP_BUF->srcipaddr); - - /* DAG Information Object */ - LOG_INFO("Received a DIO from "); - LOG_INFO_6ADDR(&from); - LOG_INFO_("\n"); - - buffer_length = uip_len - uip_l3_icmp_hdr_len; - - /* Process the DIO base option. */ - i = 0; - buffer = UIP_ICMP_PAYLOAD; - - dio.instance_id = buffer[i++]; - dio.version = buffer[i++]; - dio.rank = get16(buffer, i); - i += 2; - - LOG_DBG("Incoming DIO (id, ver, rank) = (%u,%u,%u)\n", - (unsigned)dio.instance_id, - (unsigned)dio.version, - (unsigned)dio.rank); - - dio.grounded = buffer[i] & RPL_DIO_GROUNDED; - dio.mop = (buffer[i]& RPL_DIO_MOP_MASK) >> RPL_DIO_MOP_SHIFT; - dio.preference = buffer[i++] & RPL_DIO_PREFERENCE_MASK; - - dio.dtsn = buffer[i++]; - /* two reserved bytes */ - i += 2; - - memcpy(&dio.dag_id, buffer + i, sizeof(dio.dag_id)); - i += sizeof(dio.dag_id); - - LOG_DBG("Incoming DIO (dag_id, pref) = ("); - LOG_DBG_6ADDR(&dio.dag_id); - LOG_DBG_(", %u)\n", dio.preference); - - /* Check if there are any DIO suboptions. */ - for(; i < buffer_length; i += len) { - subopt_type = buffer[i]; - if(subopt_type == RPL_OPTION_PAD1) { - len = 1; - } else { - /* Suboption with a two-byte header + payload */ - len = 2 + buffer[i + 1]; - } - - if(len + i > buffer_length) { - LOG_WARN("Invalid DIO packet\n"); - RPL_STAT(rpl_stats.malformed_msgs++); - goto discard; - } - - LOG_DBG("Incoming DIO (option, length) = (%u, %u)\n", subopt_type, len - 2); - - switch(subopt_type) { - case RPL_OPTION_DAG_METRIC_CONTAINER: - if(len < 6) { - LOG_WARN("Invalid DAG MC, len = %d\n", len); - RPL_STAT(rpl_stats.malformed_msgs++); - goto discard; - } - dio.mc.type = buffer[i + 2]; - dio.mc.flags = buffer[i + 3] << 1; - dio.mc.flags |= buffer[i + 4] >> 7; - dio.mc.aggr = (buffer[i + 4] >> 4) & 0x3; - dio.mc.prec = buffer[i + 4] & 0xf; - dio.mc.length = buffer[i + 5]; - - if(dio.mc.type == RPL_DAG_MC_NONE) { - /* No metric container: do nothing */ - } else if(dio.mc.type == RPL_DAG_MC_ETX) { - dio.mc.obj.etx = get16(buffer, i + 6); - - LOG_DBG("DAG MC: type %u, flags %u, aggr %u, prec %u, length %u, ETX %u\n", - (unsigned)dio.mc.type, - (unsigned)dio.mc.flags, - (unsigned)dio.mc.aggr, - (unsigned)dio.mc.prec, - (unsigned)dio.mc.length, - (unsigned)dio.mc.obj.etx); - } else if(dio.mc.type == RPL_DAG_MC_ENERGY) { - dio.mc.obj.energy.flags = buffer[i + 6]; - dio.mc.obj.energy.energy_est = buffer[i + 7]; - } else { - LOG_WARN("Unhandled DAG MC type: %u\n", (unsigned)dio.mc.type); - goto discard; - } - break; - case RPL_OPTION_ROUTE_INFO: - if(len < 9) { - LOG_WARN("Invalid destination prefix option, len = %d\n", len); - RPL_STAT(rpl_stats.malformed_msgs++); - goto discard; - } - - /* The flags field includes the preference value. */ - dio.destination_prefix.length = buffer[i + 2]; - dio.destination_prefix.flags = buffer[i + 3]; - dio.destination_prefix.lifetime = get32(buffer, i + 4); - - if(((dio.destination_prefix.length + 7) / 8) + 8 <= len && - dio.destination_prefix.length <= 128) { - LOG_INFO("Copying destination prefix\n"); - memcpy(&dio.destination_prefix.prefix, &buffer[i + 8], - (dio.destination_prefix.length + 7) / 8); - } else { - LOG_WARN("Invalid route info option, len = %d\n", len); - RPL_STAT(rpl_stats.malformed_msgs++); - goto discard; - } - - break; - case RPL_OPTION_DAG_CONF: - if(len != 16) { - LOG_WARN("Invalid DAG configuration option, len = %d\n", len); - RPL_STAT(rpl_stats.malformed_msgs++); - goto discard; - } - - /* Path control field not yet implemented - at i + 2 */ - dio.dag_intdoubl = buffer[i + 3]; - dio.dag_intmin = buffer[i + 4]; - dio.dag_redund = buffer[i + 5]; - dio.dag_max_rankinc = get16(buffer, i + 6); - dio.dag_min_hoprankinc = get16(buffer, i + 8); - dio.ocp = get16(buffer, i + 10); - /* buffer + 12 is reserved */ - dio.default_lifetime = buffer[i + 13]; - dio.lifetime_unit = get16(buffer, i + 14); - LOG_INFO("DAG conf:dbl=%d, min=%d red=%d maxinc=%d mininc=%d ocp=%d d_l=%u l_u=%u\n", - dio.dag_intdoubl, dio.dag_intmin, dio.dag_redund, - dio.dag_max_rankinc, dio.dag_min_hoprankinc, dio.ocp, - dio.default_lifetime, dio.lifetime_unit); - break; - case RPL_OPTION_PREFIX_INFO: - if(len != 32) { - LOG_WARN("Invalid DAG prefix info, len != 32\n"); - RPL_STAT(rpl_stats.malformed_msgs++); - goto discard; - } - dio.prefix_info.length = buffer[i + 2]; - dio.prefix_info.flags = buffer[i + 3]; - /* valid lifetime is ingnored for now - at i + 4 */ - /* preferred lifetime stored in lifetime */ - dio.prefix_info.lifetime = get32(buffer, i + 8); - /* 32-bit reserved at i + 12 */ - LOG_INFO("Copying prefix information\n"); - memcpy(&dio.prefix_info.prefix, &buffer[i + 16], 16); - break; - default: - LOG_WARN("Unsupported suboption type in DIO: %u\n", - (unsigned)subopt_type); - } - } - -#ifdef RPL_DEBUG_DIO_INPUT - RPL_DEBUG_DIO_INPUT(&from, &dio); -#endif - - rpl_process_dio(&from, &dio); - -discard: - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -void -dio_output(rpl_instance_t *instance, uip_ipaddr_t *uc_addr) -{ - unsigned char *buffer; - int pos; - int is_root; - rpl_dag_t *dag = instance->current_dag; -#if !RPL_LEAF_ONLY - uip_ipaddr_t addr; -#endif /* !RPL_LEAF_ONLY */ - -#if RPL_LEAF_ONLY - /* In leaf mode, we only send DIO messages as unicasts in response to - unicast DIS messages. */ - if(uc_addr == NULL) { - LOG_DBG("LEAF ONLY have multicast addr: skip dio_output\n"); - return; - } -#endif /* RPL_LEAF_ONLY */ - - /* DAG Information Object */ - pos = 0; - - buffer = UIP_ICMP_PAYLOAD; - buffer[pos++] = instance->instance_id; - buffer[pos++] = dag->version; - is_root = (dag->rank == ROOT_RANK(instance)); - -#if RPL_LEAF_ONLY - LOG_DBG("LEAF ONLY DIO rank set to RPL_INFINITE_RANK\n"); - set16(buffer, pos, RPL_INFINITE_RANK); -#else /* RPL_LEAF_ONLY */ - set16(buffer, pos, dag->rank); -#endif /* RPL_LEAF_ONLY */ - pos += 2; - - buffer[pos] = 0; - if(dag->grounded) { - buffer[pos] |= RPL_DIO_GROUNDED; - } - - buffer[pos] |= instance->mop << RPL_DIO_MOP_SHIFT; - buffer[pos] |= dag->preference & RPL_DIO_PREFERENCE_MASK; - pos++; - - buffer[pos++] = instance->dtsn_out; - - if(RPL_DIO_REFRESH_DAO_ROUTES && is_root && uc_addr == NULL) { - /* Request new DAO to refresh route. We do not do this for unicast DIO - * in order to avoid DAO messages after a DIS-DIO update, - * or upon unicast DIO probing. */ - RPL_LOLLIPOP_INCREMENT(instance->dtsn_out); - } - - /* reserved 2 bytes */ - buffer[pos++] = 0; /* flags */ - buffer[pos++] = 0; /* reserved */ - - memcpy(buffer + pos, &dag->dag_id, sizeof(dag->dag_id)); - pos += 16; - -#if !RPL_LEAF_ONLY - if(instance->mc.type != RPL_DAG_MC_NONE) { - instance->of->update_metric_container(instance); - - buffer[pos++] = RPL_OPTION_DAG_METRIC_CONTAINER; - buffer[pos++] = 6; - buffer[pos++] = instance->mc.type; - buffer[pos++] = instance->mc.flags >> 1; - buffer[pos] = (instance->mc.flags & 1) << 7; - buffer[pos++] |= (instance->mc.aggr << 4) | instance->mc.prec; - if(instance->mc.type == RPL_DAG_MC_ETX) { - buffer[pos++] = 2; - set16(buffer, pos, instance->mc.obj.etx); - pos += 2; - } else if(instance->mc.type == RPL_DAG_MC_ENERGY) { - buffer[pos++] = 2; - buffer[pos++] = instance->mc.obj.energy.flags; - buffer[pos++] = instance->mc.obj.energy.energy_est; - } else { - LOG_ERR("Unable to send DIO because of unhandled DAG MC type %u\n", - (unsigned)instance->mc.type); - return; - } - } -#endif /* !RPL_LEAF_ONLY */ - - /* Always add a DAG configuration option. */ - buffer[pos++] = RPL_OPTION_DAG_CONF; - buffer[pos++] = 14; - buffer[pos++] = 0; /* No Auth, PCS = 0 */ - buffer[pos++] = instance->dio_intdoubl; - buffer[pos++] = instance->dio_intmin; - buffer[pos++] = instance->dio_redundancy; - set16(buffer, pos, instance->max_rankinc); - pos += 2; - set16(buffer, pos, instance->min_hoprankinc); - pos += 2; - /* OCP is in the DAG_CONF option */ - set16(buffer, pos, instance->of->ocp); - pos += 2; - buffer[pos++] = 0; /* reserved */ - buffer[pos++] = instance->default_lifetime; - set16(buffer, pos, instance->lifetime_unit); - pos += 2; - - /* Check if we have a prefix to send also. */ - if(dag->prefix_info.length > 0) { - buffer[pos++] = RPL_OPTION_PREFIX_INFO; - buffer[pos++] = 30; /* always 30 bytes + 2 long */ - buffer[pos++] = dag->prefix_info.length; - buffer[pos++] = dag->prefix_info.flags; - set32(buffer, pos, dag->prefix_info.lifetime); - pos += 4; - set32(buffer, pos, dag->prefix_info.lifetime); - pos += 4; - memset(&buffer[pos], 0, 4); - pos += 4; - memcpy(&buffer[pos], &dag->prefix_info.prefix, 16); - pos += 16; - LOG_DBG("Sending prefix info in DIO for "); - LOG_DBG_6ADDR(&dag->prefix_info.prefix); - LOG_DBG_("\n"); - } else { - LOG_DBG("No prefix to announce (len %d)\n", - dag->prefix_info.length); - } - -#if RPL_LEAF_ONLY - if(LOG_DBG_ENABLED) { - if(uc_addr == NULL) { - LOG_DBG("LEAF ONLY sending unicast-DIO from multicast-DIO\n"); - } - } - - LOG_INFO("Sending unicast-DIO with rank %u to ", - (unsigned)dag->rank); - LOG_INFO_6ADDR(uc_addr); - LOG_INFO_("\n"); - uip_icmp6_send(uc_addr, ICMP6_RPL, RPL_CODE_DIO, pos); -#else /* RPL_LEAF_ONLY */ - /* Unicast requests get unicast replies! */ - if(uc_addr == NULL) { - LOG_INFO("Sending a multicast-DIO with rank %u\n", - (unsigned)instance->current_dag->rank); - uip_create_linklocal_rplnodes_mcast(&addr); - uip_icmp6_send(&addr, ICMP6_RPL, RPL_CODE_DIO, pos); - } else { - LOG_INFO("Sending unicast-DIO with rank %u to ", - (unsigned)instance->current_dag->rank); - LOG_INFO_6ADDR(uc_addr); - LOG_INFO_("\n"); - uip_icmp6_send(uc_addr, ICMP6_RPL, RPL_CODE_DIO, pos); - } -#endif /* RPL_LEAF_ONLY */ -} -/*---------------------------------------------------------------------------*/ -static void -dao_input_storing(void) -{ -#if RPL_WITH_STORING - uip_ipaddr_t dao_sender_addr; - rpl_dag_t *dag; - rpl_instance_t *instance; - unsigned char *buffer; - uint16_t sequence; - uint8_t instance_id; - uint8_t lifetime; - uint8_t prefixlen; - uint8_t flags; - uint8_t subopt_type; - /* - uint8_t pathcontrol; - uint8_t pathsequence; - */ - uip_ipaddr_t prefix; - uip_ds6_route_t *rep; - uint8_t buffer_length; - int pos; - int len; - int i; - int learned_from; - rpl_parent_t *parent; - uip_ds6_nbr_t *nbr; - int is_root; - - prefixlen = 0; - parent = NULL; - memset(&prefix, 0, sizeof(prefix)); - - uip_ipaddr_copy(&dao_sender_addr, &UIP_IP_BUF->srcipaddr); - - buffer = UIP_ICMP_PAYLOAD; - buffer_length = uip_len - uip_l3_icmp_hdr_len; - - pos = 0; - instance_id = buffer[pos++]; - - instance = rpl_get_instance(instance_id); - - lifetime = instance->default_lifetime; - - flags = buffer[pos++]; - /* reserved */ - pos++; - sequence = buffer[pos++]; - - dag = instance->current_dag; - is_root = (dag->rank == ROOT_RANK(instance)); - - /* Is the DAG ID present? */ - if(flags & RPL_DAO_D_FLAG) { - if(memcmp(&dag->dag_id, &buffer[pos], sizeof(dag->dag_id))) { - LOG_INFO("Ignoring a DAO for a DAG different from ours\n"); - return; - } - pos += 16; - } - - learned_from = uip_is_addr_mcast(&dao_sender_addr) ? - RPL_ROUTE_FROM_MULTICAST_DAO : RPL_ROUTE_FROM_UNICAST_DAO; - - /* Destination Advertisement Object */ - LOG_DBG("Received a (%s) DAO with sequence number %u from ", - learned_from == RPL_ROUTE_FROM_UNICAST_DAO? "unicast": "multicast", sequence); - LOG_DBG_6ADDR(&dao_sender_addr); - LOG_DBG_("\n"); - - if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) { - /* Check whether this is a DAO forwarding loop. */ - parent = rpl_find_parent(dag, &dao_sender_addr); - /* check if this is a new DAO registration with an "illegal" rank */ - /* if we already route to this node it is likely */ - if(parent != NULL && - DAG_RANK(parent->rank, instance) < DAG_RANK(dag->rank, instance)) { - LOG_WARN("Loop detected when receiving a unicast DAO from a node with a lower rank! (%u < %u)\n", - DAG_RANK(parent->rank, instance), DAG_RANK(dag->rank, instance)); - parent->rank = RPL_INFINITE_RANK; - parent->flags |= RPL_PARENT_FLAG_UPDATED; - return; - } - - /* If we get the DAO from our parent, we also have a loop. */ - if(parent != NULL && parent == dag->preferred_parent) { - LOG_WARN("Loop detected when receiving a unicast DAO from our parent\n"); - parent->rank = RPL_INFINITE_RANK; - parent->flags |= RPL_PARENT_FLAG_UPDATED; - return; - } - } - - /* Check if there are any RPL options present. */ - for(i = pos; i < buffer_length; i += len) { - subopt_type = buffer[i]; - if(subopt_type == RPL_OPTION_PAD1) { - len = 1; - } else { - /* The option consists of a two-byte header and a payload. */ - len = 2 + buffer[i + 1]; - } - - switch(subopt_type) { - case RPL_OPTION_TARGET: - /* Handle the target option. */ - prefixlen = buffer[i + 3]; - memset(&prefix, 0, sizeof(prefix)); - memcpy(&prefix, buffer + i + 4, (prefixlen + 7) / CHAR_BIT); - break; - case RPL_OPTION_TRANSIT: - /* The path sequence and control are ignored. */ - /* pathcontrol = buffer[i + 3]; - pathsequence = buffer[i + 4];*/ - lifetime = buffer[i + 5]; - /* The parent address is also ignored. */ - break; - } - } - - LOG_INFO("DAO lifetime: %u, prefix length: %u prefix: ", - (unsigned)lifetime, (unsigned)prefixlen); - LOG_INFO_6ADDR(&prefix); - LOG_INFO_("\n"); - -#if RPL_WITH_MULTICAST - if(uip_is_addr_mcast_global(&prefix)) { - /* - * "rep" is used for a unicast route which we don't need now; so set NULL so - * that operations on "rep" will be skipped. - */ - rep = NULL; - mcast_group = uip_mcast6_route_add(&prefix); - if(mcast_group) { - mcast_group->dag = dag; - mcast_group->lifetime = RPL_LIFETIME(instance, lifetime); - } - goto fwd_dao; - } -#endif - - rep = uip_ds6_route_lookup(&prefix); - - if(lifetime == RPL_ZERO_LIFETIME) { - LOG_INFO("No-Path DAO received\n"); - /* No-Path DAO received; invoke the route purging routine. */ - if(rep != NULL && - !RPL_ROUTE_IS_NOPATH_RECEIVED(rep) && - rep->length == prefixlen && - uip_ds6_route_nexthop(rep) != NULL && - uip_ipaddr_cmp(uip_ds6_route_nexthop(rep), &dao_sender_addr)) { - LOG_DBG("Setting expiration timer for prefix "); - LOG_DBG_6ADDR(&prefix); - LOG_DBG_("\n"); - RPL_ROUTE_SET_NOPATH_RECEIVED(rep); - rep->state.lifetime = RPL_NOPATH_REMOVAL_DELAY; - - /* We forward the incoming No-Path DAO to our parent, if we have - one. */ - if(dag->preferred_parent != NULL && - rpl_parent_get_ipaddr(dag->preferred_parent) != NULL) { - uint8_t out_seq; - out_seq = prepare_for_dao_fwd(sequence, rep); - - LOG_DBG("Forwarding No-path DAO to parent - out_seq:%d", - out_seq); - LOG_DBG_6ADDR(rpl_parent_get_ipaddr(dag->preferred_parent)); - LOG_DBG_("\n"); - - buffer = UIP_ICMP_PAYLOAD; - buffer[3] = out_seq; /* add an outgoing seq no before fwd */ - uip_icmp6_send(rpl_parent_get_ipaddr(dag->preferred_parent), - ICMP6_RPL, RPL_CODE_DAO, buffer_length); - } - } - /* independent if we remove or not - ACK the request */ - if(flags & RPL_DAO_K_FLAG) { - /* indicate that we accepted the no-path DAO */ - uipbuf_clear(); - dao_ack_output(instance, &dao_sender_addr, sequence, - RPL_DAO_ACK_UNCONDITIONAL_ACCEPT); - } - return; - } - - LOG_INFO("Adding DAO route\n"); - - /* Update and add neighbor - if no room - fail. */ - if((nbr = rpl_icmp6_update_nbr_table(&dao_sender_addr, NBR_TABLE_REASON_RPL_DAO, instance)) == NULL) { - LOG_ERR("Out of Memory, dropping DAO from "); - LOG_ERR_6ADDR(&dao_sender_addr); - LOG_ERR_(", "); - LOG_ERR_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_ERR_("\n"); - if(flags & RPL_DAO_K_FLAG) { - /* signal the failure to add the node */ - dao_ack_output(instance, &dao_sender_addr, sequence, - is_root ? RPL_DAO_ACK_UNABLE_TO_ADD_ROUTE_AT_ROOT : - RPL_DAO_ACK_UNABLE_TO_ACCEPT); - } - return; - } - - rep = rpl_add_route(dag, &prefix, prefixlen, &dao_sender_addr); - if(rep == NULL) { - RPL_STAT(rpl_stats.mem_overflows++); - LOG_ERR("Could not add a route after receiving a DAO\n"); - if(flags & RPL_DAO_K_FLAG) { - /* signal the failure to add the node */ - dao_ack_output(instance, &dao_sender_addr, sequence, - is_root ? RPL_DAO_ACK_UNABLE_TO_ADD_ROUTE_AT_ROOT : - RPL_DAO_ACK_UNABLE_TO_ACCEPT); - } - return; - } - - /* set lifetime and clear NOPATH bit */ - rep->state.lifetime = RPL_LIFETIME(instance, lifetime); - RPL_ROUTE_CLEAR_NOPATH_RECEIVED(rep); - -#if RPL_WITH_MULTICAST -fwd_dao: -#endif - - if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) { - int should_ack = 0; - - if(flags & RPL_DAO_K_FLAG) { - if(rep != NULL) { - /* - * check if this route is already installed and we can ack now! - * not pending - and same seq-no means that we can ack. - * (e.g. the route is installed already so it will not take any - * more room that it already takes - so should be ok!) - */ - if((!RPL_ROUTE_IS_DAO_PENDING(rep) && - rep->state.dao_seqno_in == sequence) || - dag->rank == ROOT_RANK(instance)) { - should_ack = 1; - } - } - } - - if(dag->preferred_parent != NULL && - rpl_parent_get_ipaddr(dag->preferred_parent) != NULL) { - uint8_t out_seq = 0; - if(rep != NULL) { - /* if this is pending and we get the same seq no it is a retrans */ - if(RPL_ROUTE_IS_DAO_PENDING(rep) && - rep->state.dao_seqno_in == sequence) { - /* keep the same seq-no as before for parent also */ - out_seq = rep->state.dao_seqno_out; - } else { - out_seq = prepare_for_dao_fwd(sequence, rep); - } - } - - LOG_DBG("Forwarding DAO to parent "); - LOG_DBG_6ADDR(rpl_parent_get_ipaddr(dag->preferred_parent)); - LOG_DBG_(" in seq: %d out seq: %d\n", sequence, out_seq); - - buffer = UIP_ICMP_PAYLOAD; - buffer[3] = out_seq; /* add an outgoing seq no before fwd */ - uip_icmp6_send(rpl_parent_get_ipaddr(dag->preferred_parent), - ICMP6_RPL, RPL_CODE_DAO, buffer_length); - } - if(should_ack) { - LOG_DBG("Sending DAO ACK\n"); - uipbuf_clear(); - dao_ack_output(instance, &dao_sender_addr, sequence, - RPL_DAO_ACK_UNCONDITIONAL_ACCEPT); - } - } -#endif /* RPL_WITH_STORING */ -} -/*---------------------------------------------------------------------------*/ -static void -dao_input_nonstoring(void) -{ -#if RPL_WITH_NON_STORING - uip_ipaddr_t dao_sender_addr; - uip_ipaddr_t dao_parent_addr; - rpl_dag_t *dag; - rpl_instance_t *instance; - unsigned char *buffer; - uint16_t sequence; - uint8_t instance_id; - uint8_t lifetime; - uint8_t prefixlen; - uint8_t flags; - uint8_t subopt_type; - uip_ipaddr_t prefix; - uint8_t buffer_length; - int pos; - int len; - int i; - - /* Destination Advertisement Object */ - LOG_INFO("Received a DAO from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - - prefixlen = 0; - - uip_ipaddr_copy(&dao_sender_addr, &UIP_IP_BUF->srcipaddr); - memset(&dao_parent_addr, 0, 16); - - buffer = UIP_ICMP_PAYLOAD; - buffer_length = uip_len - uip_l3_icmp_hdr_len; - - pos = 0; - instance_id = buffer[pos++]; - instance = rpl_get_instance(instance_id); - lifetime = instance->default_lifetime; - - flags = buffer[pos++]; - /* reserved */ - pos++; - sequence = buffer[pos++]; - - dag = instance->current_dag; - /* Is the DAG ID present? */ - if(flags & RPL_DAO_D_FLAG) { - if(memcmp(&dag->dag_id, &buffer[pos], sizeof(dag->dag_id))) { - LOG_INFO("Ignoring a DAO for a DAG different from ours\n"); - return; - } - pos += 16; - } - - /* Check if there are any RPL options present. */ - for(i = pos; i < buffer_length; i += len) { - subopt_type = buffer[i]; - if(subopt_type == RPL_OPTION_PAD1) { - len = 1; - } else { - /* The option consists of a two-byte header and a payload. */ - len = 2 + buffer[i + 1]; - } - - switch(subopt_type) { - case RPL_OPTION_TARGET: - /* Handle the target option. */ - prefixlen = buffer[i + 3]; - memset(&prefix, 0, sizeof(prefix)); - memcpy(&prefix, buffer + i + 4, (prefixlen + 7) / CHAR_BIT); - break; - case RPL_OPTION_TRANSIT: - /* The path sequence and control are ignored. */ - /* pathcontrol = buffer[i + 3]; - pathsequence = buffer[i + 4];*/ - lifetime = buffer[i + 5]; - if(len >= 20) { - memcpy(&dao_parent_addr, buffer + i + 6, 16); - } - break; - } - } - - LOG_INFO("DAO lifetime: %u, prefix length: %u prefix: ", - (unsigned)lifetime, (unsigned)prefixlen); - LOG_INFO_6ADDR(&prefix); - LOG_INFO_(", parent: "); - LOG_INFO_6ADDR(&dao_parent_addr); - LOG_INFO_("\n"); - - if(lifetime == RPL_ZERO_LIFETIME) { - LOG_DBG("No-Path DAO received\n"); - uip_sr_expire_parent(dag, &prefix, &dao_parent_addr); - } else { - if(uip_sr_update_node(dag, &prefix, &dao_parent_addr, RPL_LIFETIME(instance, lifetime)) == NULL) { - LOG_WARN("DAO failed to add link prefix: "); - LOG_WARN_6ADDR(&prefix); - LOG_WARN_(", parent: "); - LOG_WARN_6ADDR(&dao_parent_addr); - LOG_WARN_("\n"); - return; - } - } - - if(flags & RPL_DAO_K_FLAG) { - LOG_DBG("Sending DAO ACK\n"); - uipbuf_clear(); - dao_ack_output(instance, &dao_sender_addr, sequence, - RPL_DAO_ACK_UNCONDITIONAL_ACCEPT); - } -#endif /* RPL_WITH_NON_STORING */ -} -/*---------------------------------------------------------------------------*/ -static void -dao_input(void) -{ - rpl_instance_t *instance; - uint8_t instance_id; - - /* Destination Advertisement Object */ - LOG_INFO("Received a DAO from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - - instance_id = UIP_ICMP_PAYLOAD[0]; - instance = rpl_get_instance(instance_id); - if(instance == NULL) { - LOG_INFO("Ignoring a DAO for an unknown RPL instance(%u)\n", - instance_id); - goto discard; - } - - if(RPL_IS_STORING(instance)) { - dao_input_storing(); - } else if(RPL_IS_NON_STORING(instance)) { - dao_input_nonstoring(); - } - -discard: - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -#if RPL_WITH_DAO_ACK -static void -handle_dao_retransmission(void *ptr) -{ - rpl_parent_t *parent; - uip_ipaddr_t prefix; - rpl_instance_t *instance; - - parent = ptr; - if(parent == NULL || parent->dag == NULL || parent->dag->instance == NULL) { - return; - } - instance = parent->dag->instance; - - if(instance->my_dao_transmissions >= RPL_DAO_MAX_RETRANSMISSIONS) { - /* No more retransmissions - give up. */ - if(instance->lifetime_unit == 0xffff && instance->default_lifetime == 0xff) { - /* - * ContikiRPL was previously using infinite lifetime for routes - * and no DAO_ACK configured. This probably means that the root - * and possibly other nodes might be running an old version that - * does not support DAO ack. Assume that everything is ok for - * now and let the normal repair mechanisms detect any problems. - */ - return; - } - - if(RPL_IS_STORING(instance) && instance->of->dao_ack_callback) { - /* Inform the objective function about the timeout. */ - instance->of->dao_ack_callback(parent, RPL_DAO_ACK_TIMEOUT); - } - - /* Perform local repair and hope to find another parent. */ - rpl_local_repair(instance); - return; - } - - LOG_INFO("will retransmit DAO - seq:%d trans:%d\n", instance->my_dao_seqno, - instance->my_dao_transmissions); - - if(get_global_addr(&prefix) == 0) { - return; - } - - ctimer_set(&instance->dao_retransmit_timer, - RPL_DAO_RETRANSMISSION_TIMEOUT / 2 + - (random_rand() % (RPL_DAO_RETRANSMISSION_TIMEOUT / 2)), - handle_dao_retransmission, parent); - - instance->my_dao_transmissions++; - dao_output_target_seq(parent, &prefix, - instance->default_lifetime, instance->my_dao_seqno); -} -#endif /* RPL_WITH_DAO_ACK */ -/*---------------------------------------------------------------------------*/ -void -dao_output(rpl_parent_t *parent, uint8_t lifetime) -{ - /* Destination Advertisement Object */ - uip_ipaddr_t prefix; - - if(get_global_addr(&prefix) == 0) { - LOG_ERR("No global address set for this node - suppressing DAO\n"); - return; - } - - if(parent == NULL || parent->dag == NULL || parent->dag->instance == NULL) { - return; - } - - RPL_LOLLIPOP_INCREMENT(dao_sequence); -#if RPL_WITH_DAO_ACK - /* set up the state since this will be the first transmission of DAO */ - /* retransmissions will call directly to dao_output_target_seq */ - /* keep track of my own sending of DAO for handling ack and loss of ack */ - if(lifetime != RPL_ZERO_LIFETIME) { - rpl_instance_t *instance; - instance = parent->dag->instance; - - instance->my_dao_seqno = dao_sequence; - instance->my_dao_transmissions = 1; - ctimer_set(&instance->dao_retransmit_timer, RPL_DAO_RETRANSMISSION_TIMEOUT, - handle_dao_retransmission, parent); - } -#else - /* We know that we have tried to register so now we are assuming - that we have a down-link - unless this is a zero lifetime one */ - parent->dag->instance->has_downward_route = lifetime != RPL_ZERO_LIFETIME; -#endif /* RPL_WITH_DAO_ACK */ - - /* Sending a DAO with own prefix as target */ - dao_output_target(parent, &prefix, lifetime); -} -/*---------------------------------------------------------------------------*/ -void -dao_output_target(rpl_parent_t *parent, uip_ipaddr_t *prefix, uint8_t lifetime) -{ - dao_output_target_seq(parent, prefix, lifetime, dao_sequence); -} -/*---------------------------------------------------------------------------*/ -static void -dao_output_target_seq(rpl_parent_t *parent, uip_ipaddr_t *prefix, - uint8_t lifetime, uint8_t seq_no) -{ - rpl_dag_t *dag; - rpl_instance_t *instance; - unsigned char *buffer; - uint8_t prefixlen; - int pos; - uip_ipaddr_t *parent_ipaddr = NULL; - uip_ipaddr_t *dest_ipaddr = NULL; - - /* Destination Advertisement Object */ - - /* If we are in feather mode, we should not send any DAOs */ - if(rpl_get_mode() == RPL_MODE_FEATHER) { - return; - } - - if(parent == NULL) { - LOG_ERR("dao_output_target error parent NULL\n"); - return; - } - - parent_ipaddr = rpl_parent_get_ipaddr(parent); - if(parent_ipaddr == NULL) { - LOG_ERR("dao_output_target error parent IP address NULL\n"); - return; - } - - dag = parent->dag; - if(dag == NULL) { - LOG_ERR("dao_output_target error dag NULL\n"); - return; - } - - instance = dag->instance; - - if(instance == NULL) { - LOG_ERR("dao_output_target error instance NULL\n"); - return; - } - if(prefix == NULL) { - LOG_ERR("dao_output_target error prefix NULL\n"); - return; - } -#ifdef RPL_DEBUG_DAO_OUTPUT - RPL_DEBUG_DAO_OUTPUT(parent); -#endif - - buffer = UIP_ICMP_PAYLOAD; - pos = 0; - - buffer[pos++] = instance->instance_id; - buffer[pos] = 0; -#if RPL_DAO_SPECIFY_DAG - buffer[pos] |= RPL_DAO_D_FLAG; -#endif /* RPL_DAO_SPECIFY_DAG */ -#if RPL_WITH_DAO_ACK - if(lifetime != RPL_ZERO_LIFETIME) { - buffer[pos] |= RPL_DAO_K_FLAG; - } -#endif /* RPL_WITH_DAO_ACK */ - ++pos; - buffer[pos++] = 0; /* reserved */ - buffer[pos++] = seq_no; -#if RPL_DAO_SPECIFY_DAG - memcpy(buffer + pos, &dag->dag_id, sizeof(dag->dag_id)); - pos+=sizeof(dag->dag_id); -#endif /* RPL_DAO_SPECIFY_DAG */ - - /* create target subopt */ - prefixlen = sizeof(*prefix) * CHAR_BIT; - buffer[pos++] = RPL_OPTION_TARGET; - buffer[pos++] = 2 + ((prefixlen + 7) / CHAR_BIT); - buffer[pos++] = 0; /* reserved */ - buffer[pos++] = prefixlen; - memcpy(buffer + pos, prefix, (prefixlen + 7) / CHAR_BIT); - pos += ((prefixlen + 7) / CHAR_BIT); - - /* Create a transit information sub-option. */ - buffer[pos++] = RPL_OPTION_TRANSIT; - buffer[pos++] = (instance->mop != RPL_MOP_NON_STORING) ? 4 : 20; - buffer[pos++] = 0; /* flags - ignored */ - buffer[pos++] = 0; /* path control - ignored */ - buffer[pos++] = 0; /* path seq - ignored */ - buffer[pos++] = lifetime; - - if(instance->mop != RPL_MOP_NON_STORING) { - /* Send DAO to parent */ - dest_ipaddr = parent_ipaddr; - } else { - /* Include parent global IP address */ - memcpy(buffer + pos, &parent->dag->dag_id, 8); /* Prefix */ - pos += 8; - memcpy(buffer + pos, ((const unsigned char *)parent_ipaddr) + 8, 8); /* Interface identifier */ - pos += 8; - /* Send DAO to root */ - dest_ipaddr = &parent->dag->dag_id; - } - - LOG_INFO("Sending a %sDAO with sequence number %u, lifetime %u, prefix ", - lifetime == RPL_ZERO_LIFETIME ? "No-Path " : "", seq_no, lifetime); - - LOG_INFO_6ADDR(prefix); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(dest_ipaddr); - LOG_INFO_(" , parent "); - LOG_INFO_6ADDR(parent_ipaddr); - LOG_INFO_("\n"); - - if(dest_ipaddr != NULL) { - uip_icmp6_send(dest_ipaddr, ICMP6_RPL, RPL_CODE_DAO, pos); - } -} -/*---------------------------------------------------------------------------*/ -static void -dao_ack_input(void) -{ -#if RPL_WITH_DAO_ACK - - uint8_t *buffer; - uint8_t instance_id; - uint8_t sequence; - uint8_t status; - rpl_instance_t *instance; - rpl_parent_t *parent; - - buffer = UIP_ICMP_PAYLOAD; - - instance_id = buffer[0]; - sequence = buffer[2]; - status = buffer[3]; - - instance = rpl_get_instance(instance_id); - if(instance == NULL) { - uipbuf_clear(); - return; - } - - if(RPL_IS_STORING(instance)) { - parent = rpl_find_parent(instance->current_dag, &UIP_IP_BUF->srcipaddr); - if(parent == NULL) { - /* not a known instance - drop the packet and ignore */ - uipbuf_clear(); - return; - } - } else { - parent = NULL; - } - - if(instance->current_dag->rank == ROOT_RANK(instance)) { - LOG_DBG("DODAG root received a DAO ACK, ignoring it\n"); - uipbuf_clear(); - return; - } - - LOG_INFO("Received a DAO %s with sequence number %d (%d) and status %d from ", - status < 128 ? "ACK" : "NACK", - sequence, instance->my_dao_seqno, status); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - - if(sequence == instance->my_dao_seqno) { - instance->has_downward_route = status < 128; - - /* always stop the retransmit timer when the ACK arrived */ - ctimer_stop(&instance->dao_retransmit_timer); - - /* Inform objective function on status of the DAO ACK */ - if(RPL_IS_STORING(instance) && instance->of->dao_ack_callback) { - instance->of->dao_ack_callback(parent, status); - } - -#if RPL_REPAIR_ON_DAO_NACK - if(status >= RPL_DAO_ACK_UNABLE_TO_ACCEPT) { - /* - * Failed the DAO transmission - need to remove the default route. - * Trigger a local repair since we can not get our DAO in. - */ - rpl_local_repair(instance); - } -#endif - - } else if(RPL_IS_STORING(instance)) { - /* this DAO ACK should be forwarded to another recently registered route */ - uip_ds6_route_t *re; - uip_ipaddr_t *nexthop; - if((re = find_route_entry_by_dao_ack(sequence)) != NULL) { - /* pick the recorded seq no from that node and forward DAO ACK - and - clear the pending flag*/ - RPL_ROUTE_CLEAR_DAO_PENDING(re); - - nexthop = uip_ds6_route_nexthop(re); - if(nexthop == NULL) { - LOG_WARN("No next hop to fwd DAO ACK to\n"); - } else { - LOG_INFO("Fwd DAO ACK to:"); - LOG_INFO_6ADDR(nexthop); - LOG_INFO_("\n"); - buffer[2] = re->state.dao_seqno_in; - uip_icmp6_send(nexthop, ICMP6_RPL, RPL_CODE_DAO_ACK, 4); - } - - if(status >= RPL_DAO_ACK_UNABLE_TO_ACCEPT) { - /* this node did not get in to the routing tables above... - remove */ - uip_ds6_route_rm(re); - } - } else { - LOG_WARN("No route entry found to forward DAO ACK (seqno %u)\n", sequence); - } - } -#endif /* RPL_WITH_DAO_ACK */ - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -void -dao_ack_output(rpl_instance_t *instance, uip_ipaddr_t *dest, uint8_t sequence, - uint8_t status) -{ -#if RPL_WITH_DAO_ACK - unsigned char *buffer; - - LOG_INFO("Sending a DAO %s with sequence number %d to ", status < 128 ? "ACK" : "NACK", sequence); - LOG_INFO_6ADDR(dest); - LOG_INFO_(" with status %d\n", status); - - buffer = UIP_ICMP_PAYLOAD; - - buffer[0] = instance->instance_id; - buffer[1] = 0; - buffer[2] = sequence; - buffer[3] = status; - - uip_icmp6_send(dest, ICMP6_RPL, RPL_CODE_DAO_ACK, 4); -#endif /* RPL_WITH_DAO_ACK */ -} -/*---------------------------------------------------------------------------*/ -void -rpl_icmp6_register_handlers() -{ - uip_icmp6_register_input_handler(&dis_handler); - uip_icmp6_register_input_handler(&dio_handler); - uip_icmp6_register_input_handler(&dao_handler); - uip_icmp6_register_input_handler(&dao_ack_handler); -} -/*---------------------------------------------------------------------------*/ - -/** @}*/ diff --git a/os/net/routing/rpl-classic/rpl-mrhof.c b/os/net/routing/rpl-classic/rpl-mrhof.c deleted file mode 100644 index 988991b19..000000000 --- a/os/net/routing/rpl-classic/rpl-mrhof.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * The Minimum Rank with Hysteresis Objective Function (MRHOF), RFC6719 - * - * This implementation uses the estimated number of - * transmissions (ETX) as the additive routing metric, - * and also provides stubs for the energy metric. - * - * \author Joakim Eriksson , Nicolas Tsiftes - */ - -/** - * \addtogroup uip - * @{ - */ - -#include "net/routing/rpl-classic/rpl.h" -#include "net/routing/rpl-classic/rpl-private.h" -#include "net/nbr-table.h" -#include "net/link-stats.h" - -#include "sys/log.h" - -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/* RFC6551 and RFC6719 do not mandate the use of a specific formula to - * compute the ETX value. This MRHOF implementation relies on the value - * computed by the link-stats module.It has an optional feature, - * RPL_MRHOF_CONF_SQUARED_ETX, that consists in squaring this value. - * - * Squaring basically penalizes bad links while preserving the semantics of ETX - * (1 = perfect link, more = worse link). As a result, MRHOF will favor - * good links over short paths. Without this feature, a hop with 50% PRR (ETX=2) - * is equivalent to two perfect hops with 100% PRR (ETX=1+1=2). With this - * feature, the former path obtains ETX=2*2=4 and the former ETX=1*1+1*1=2. - * - * While this feature helps achieve extra relaibility, it also results in - * added churn. In networks with high congestion or poor links, this can lead - * to poor connectivity due to more parent switches, loops, Trickle resets, etc. - */ -#ifdef RPL_MRHOF_CONF_SQUARED_ETX -#define RPL_MRHOF_SQUARED_ETX RPL_MRHOF_CONF_SQUARED_ETX -#else /* RPL_MRHOF_CONF_SQUARED_ETX */ -#define RPL_MRHOF_SQUARED_ETX 0 -#endif /* RPL_MRHOF_CONF_SQUARED_ETX */ - -#if !RPL_MRHOF_SQUARED_ETX -/* Configuration parameters of RFC6719. Reject parents that have a higher - * link metric than the following. The default value is 512 but we use 1024. */ -#define MAX_LINK_METRIC 1024 /* Eq ETX of 8 */ -/* Hysteresis of MRHOF: the rank must differ more than PARENT_SWITCH_THRESHOLD_DIV - * in order to switch preferred parent. Default in RFC6719: 192, eq ETX of 1.5. - * We use a more aggressive setting: 96, eq ETX of 0.75. - */ -#define PARENT_SWITCH_THRESHOLD 96 /* Eq ETX of 0.75 */ -#else /* !RPL_MRHOF_SQUARED_ETX */ -#define MAX_LINK_METRIC 2048 /* Eq ETX of 4 */ -#define PARENT_SWITCH_THRESHOLD 160 /* Eq ETX of 1.25 (results in a churn comparable -to the threshold of 96 in the non-squared case) */ -#endif /* !RPL_MRHOF_SQUARED_ETX */ - -/* Reject parents that have a higher path cost than the following. */ -#define MAX_PATH_COST 32768 /* Eq path ETX of 256 */ - -/*---------------------------------------------------------------------------*/ -static void -reset(rpl_dag_t *dag) -{ - LOG_INFO("Reset MRHOF\n"); -} -/*---------------------------------------------------------------------------*/ -#if RPL_WITH_DAO_ACK -static void -dao_ack_callback(rpl_parent_t *p, int status) -{ - if(status == RPL_DAO_ACK_UNABLE_TO_ADD_ROUTE_AT_ROOT) { - return; - } - /* here we need to handle failed DAO's and other stuff */ - LOG_DBG("MRHOF - DAO ACK received with status: %d\n", status); - if(status >= RPL_DAO_ACK_UNABLE_TO_ACCEPT) { - /* punish the ETX as if this was 10 packets lost */ - link_stats_packet_sent(rpl_get_parent_lladdr(p), MAC_TX_OK, 10); - } else if(status == RPL_DAO_ACK_TIMEOUT) { /* timeout = no ack */ - /* punish the total lack of ACK with a similar punishment */ - link_stats_packet_sent(rpl_get_parent_lladdr(p), MAC_TX_OK, 10); - } -} -#endif /* RPL_WITH_DAO_ACK */ -/*---------------------------------------------------------------------------*/ -static uint16_t -parent_link_metric(rpl_parent_t *p) -{ - const struct link_stats *stats = rpl_get_parent_link_stats(p); - if(stats != NULL) { -#if RPL_MRHOF_SQUARED_ETX - uint32_t squared_etx = ((uint32_t)stats->etx * stats->etx) / LINK_STATS_ETX_DIVISOR; - return (uint16_t)MIN(squared_etx, 0xffff); -#else /* RPL_MRHOF_SQUARED_ETX */ - return stats->etx; -#endif /* RPL_MRHOF_SQUARED_ETX */ - } - return 0xffff; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -parent_path_cost(rpl_parent_t *p) -{ - uint16_t base; - - if(p == NULL || p->dag == NULL || p->dag->instance == NULL) { - return 0xffff; - } - -#if RPL_WITH_MC - /* Handle the different MC types */ - switch(p->dag->instance->mc.type) { - case RPL_DAG_MC_ETX: - base = p->mc.obj.etx; - break; - case RPL_DAG_MC_ENERGY: - base = p->mc.obj.energy.energy_est << 8; - break; - default: - base = p->rank; - break; - } -#else /* RPL_WITH_MC */ - base = p->rank; -#endif /* RPL_WITH_MC */ - - /* path cost upper bound: 0xffff */ - return MIN((uint32_t)base + parent_link_metric(p), 0xffff); -} -/*---------------------------------------------------------------------------*/ -static rpl_rank_t -rank_via_parent(rpl_parent_t *p) -{ - uint16_t min_hoprankinc; - uint16_t path_cost; - - if(p == NULL || p->dag == NULL || p->dag->instance == NULL) { - return RPL_INFINITE_RANK; - } - - min_hoprankinc = p->dag->instance->min_hoprankinc; - path_cost = parent_path_cost(p); - - /* Rank lower-bound: parent rank + min_hoprankinc */ - return MAX(MIN((uint32_t)p->rank + min_hoprankinc, 0xffff), path_cost); -} -/*---------------------------------------------------------------------------*/ -static int -parent_is_acceptable(rpl_parent_t *p) -{ - uint16_t link_metric = parent_link_metric(p); - uint16_t path_cost = parent_path_cost(p); - /* Exclude links with too high link metrics or path cost (RFC6719, 3.2.2) */ - return link_metric <= MAX_LINK_METRIC && path_cost <= MAX_PATH_COST; -} -/*---------------------------------------------------------------------------*/ -static int -parent_has_usable_link(rpl_parent_t *p) -{ - uint16_t link_metric = parent_link_metric(p); - /* Exclude links with too high link metrics */ - return link_metric <= MAX_LINK_METRIC; -} -/*---------------------------------------------------------------------------*/ -static rpl_parent_t * -best_parent(rpl_parent_t *p1, rpl_parent_t *p2) -{ - rpl_dag_t *dag; - uint16_t p1_cost; - uint16_t p2_cost; - int p1_is_acceptable; - int p2_is_acceptable; - - p1_is_acceptable = p1 != NULL && parent_is_acceptable(p1); - p2_is_acceptable = p2 != NULL && parent_is_acceptable(p2); - - if(!p1_is_acceptable) { - return p2_is_acceptable ? p2 : NULL; - } - if(!p2_is_acceptable) { - return p1_is_acceptable ? p1 : NULL; - } - - dag = p1->dag; /* Both parents are in the same DAG. */ - p1_cost = parent_path_cost(p1); - p2_cost = parent_path_cost(p2); - - /* Maintain stability of the preferred parent in case of similar ranks. */ - if(p1 == dag->preferred_parent || p2 == dag->preferred_parent) { - if(p1_cost < p2_cost + PARENT_SWITCH_THRESHOLD && - p1_cost > p2_cost - PARENT_SWITCH_THRESHOLD) { - return dag->preferred_parent; - } - } - - return p1_cost < p2_cost ? p1 : p2; -} -/*---------------------------------------------------------------------------*/ -static rpl_dag_t * -best_dag(rpl_dag_t *d1, rpl_dag_t *d2) -{ - if(d1->grounded != d2->grounded) { - return d1->grounded ? d1 : d2; - } - - if(d1->preference != d2->preference) { - return d1->preference > d2->preference ? d1 : d2; - } - - return d1->rank < d2->rank ? d1 : d2; -} -/*---------------------------------------------------------------------------*/ -#if !RPL_WITH_MC -static void -update_metric_container(rpl_instance_t *instance) -{ - instance->mc.type = RPL_DAG_MC_NONE; -} -#else /* RPL_WITH_MC */ -static void -update_metric_container(rpl_instance_t *instance) -{ - rpl_dag_t *dag; - uint16_t path_cost; - uint8_t type; - - dag = instance->current_dag; - if(dag == NULL || !dag->joined) { - LOG_WARN("Cannot update the metric container when not joined\n"); - return; - } - - if(dag->rank == ROOT_RANK(instance)) { - /* Configure MC at root only, other nodes are auto-configured when joining */ - instance->mc.type = RPL_DAG_MC; - instance->mc.flags = 0; - instance->mc.aggr = RPL_DAG_MC_AGGR_ADDITIVE; - instance->mc.prec = 0; - path_cost = dag->rank; - } else { - path_cost = parent_path_cost(dag->preferred_parent); - } - - /* Handle the different MC types */ - switch(instance->mc.type) { - case RPL_DAG_MC_NONE: - break; - case RPL_DAG_MC_ETX: - instance->mc.length = sizeof(instance->mc.obj.etx); - instance->mc.obj.etx = path_cost; - break; - case RPL_DAG_MC_ENERGY: - instance->mc.length = sizeof(instance->mc.obj.energy); - if(dag->rank == ROOT_RANK(instance)) { - type = RPL_DAG_MC_ENERGY_TYPE_MAINS; - } else { - type = RPL_DAG_MC_ENERGY_TYPE_BATTERY; - } - instance->mc.obj.energy.flags = type << RPL_DAG_MC_ENERGY_TYPE; - /* Energy_est is only one byte, use the least significant byte of the path metric. */ - instance->mc.obj.energy.energy_est = path_cost >> 8; - break; - default: - LOG_WARN("MRHOF, non-supported MC %u\n", instance->mc.type); - break; - } -} -#endif /* RPL_WITH_MC */ -/*---------------------------------------------------------------------------*/ -rpl_of_t rpl_mrhof = { - reset, -#if RPL_WITH_DAO_ACK - dao_ack_callback, -#endif - parent_link_metric, - parent_has_usable_link, - parent_path_cost, - rank_via_parent, - best_parent, - best_dag, - update_metric_container, - RPL_OCP_MRHOF -}; - -/** @}*/ diff --git a/os/net/routing/rpl-classic/rpl-nbr-policy.c b/os/net/routing/rpl-classic/rpl-nbr-policy.c deleted file mode 100644 index d23111e46..000000000 --- a/os/net/routing/rpl-classic/rpl-nbr-policy.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2014-2015, Yanzi Networks AB. - * 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 holders 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 HOLDERS 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. - * - */ -/** - * \addtogroup uip - * @{ - */ - - -/** - * \file - * - * Default RPL NBR policy - * decides when to add a new discovered node to the nbr table from RPL. - * - * \author Joakim Eriksson - * Contributors: Niclas Finne , Oriol Piñol , - * - */ - -#include "net/routing/rpl-classic/rpl-private.h" -#include "net/nbr-table.h" -#include "net/ipv6/uip-ds6-nbr.h" -#include "net/ipv6/uip-ds6-route.h" - -#include "sys/log.h" - -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/* - * Policy for neighbor adds - * - one node is locked (default route) - * - max X children (nexthops) - * - max Y "best parents" - * => at least MAX_NBRS - (Y + X + 1) free slots for other. - * - * NOTE: this policy assumes that all neighbors end up being IPv6 - * neighbors and are not only MAC neighbors. - */ -#define MAX_CHILDREN (NBR_TABLE_MAX_NEIGHBORS - 2) - -static int num_parents; /* any node that are possible parents */ -static int num_children; /* all children that we have as nexthop */ -static int num_free; -static const linkaddr_t *worst_rank_nbr; /* the parent that has the worst rank */ -static rpl_rank_t worst_rank; -/*---------------------------------------------------------------------------*/ -#if LOG_DBG_ENABLED -/* - * This create a periodic call of the update_nbr function that will print - * useful debugging information when in DEBUG_FULL mode - */ -static void update_nbr(void); -static struct ctimer periodic_timer; -static int timer_init = 0; -static void -handle_periodic_timer(void *ptr) -{ - update_nbr(); - ctimer_restart(&periodic_timer); -} -#endif /* LOG_DBG_ENABLED */ -/*---------------------------------------------------------------------------*/ -static void -update_nbr(void) -{ - uip_ds6_nbr_t *nbr; - rpl_parent_t *parent; - int num_used; - int is_used; - rpl_rank_t rank; - -#if LOG_DBG_ENABLED - if(!timer_init) { - timer_init = 1; - ctimer_set(&periodic_timer, 60 * CLOCK_SECOND, - &handle_periodic_timer, NULL); - } -#endif /* LOG_DBG_ENABLED */ - - worst_rank = 0; - worst_rank_nbr = NULL; - num_used = 0; - num_parents = 0; - num_children = 0; - - nbr = uip_ds6_nbr_head(); - while(nbr != NULL) { - const linkaddr_t *lladdr = (const linkaddr_t *)uip_ds6_nbr_get_ll(nbr); - is_used = 0; - - /* - * Check if this neighbor is used as nexthop and therefor being a - * RPL child. - */ - - if(uip_ds6_route_is_nexthop(&nbr->ipaddr) != 0) { - is_used++; - num_children++; - } - - parent = rpl_get_parent((const uip_lladdr_t *)lladdr); - if(parent != NULL) { - num_parents++; - - if(parent->dag != NULL && parent->dag->preferred_parent == parent) { - /* - * This is the preferred parent for the DAG and must not be removed - * Note: this assumes that only RPL adds default routes. - */ - } else if(is_used == 0 && worst_rank < RPL_INFINITE_RANK && - parent->rank > 0 && - parent->dag != NULL && - parent->dag->instance != NULL && - (rank = parent->dag->instance->of->rank_via_parent(parent)) > worst_rank) { - /* This is the worst-rank neighbor - this is a good candidate for removal */ - worst_rank = rank; - worst_rank_nbr = lladdr; - } - /* add to is_used after evaluation of is_used above */ - is_used++; - } - - if(is_used == 0) { - /* This neighbor is neither parent or child and can be safely removed */ - worst_rank_nbr = lladdr; - worst_rank = RPL_INFINITE_RANK; - } else if(is_used > 1) { - LOG_DBG("nbr-policy: *** neighbor is both child and candidate parent: "); - LOG_DBG_LLADDR(lladdr); - LOG_DBG_("\n"); - } - - nbr = uip_ds6_nbr_next(nbr); - num_used++; - } - /* how many more IP neighbors can be have? */ - num_free = NBR_TABLE_MAX_NEIGHBORS - num_used; - - LOG_DBG("nbr-policy: free: %d, children: %d, parents: %d routes: %d\n", - num_free, num_children, num_parents, uip_ds6_route_num_routes()); -} -/*---------------------------------------------------------------------------*/ -/* Called whenever we get a unicast DIS - e.g. someone that already - have this node in its table - since it is a unicast */ -const linkaddr_t * -find_removable_dis(uip_ipaddr_t *from) -{ - - update_nbr(); - if(num_free > 0) { - /* there are free entries (e.g. unsused by RPL and ND6) but since it is - used by other modules we can not pick these entries for removal. */ - LOG_DBG("nbr-policy: num-free > 0 = %d - Other for RPL/ND6 unused NBR entry exists.\n", - num_free); - } - if(num_children < MAX_CHILDREN) { - return worst_rank_nbr; - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -const linkaddr_t * -find_removable_dio(uip_ipaddr_t *from, rpl_dio_t *dio) -{ - rpl_instance_t *instance; - - update_nbr(); - - instance = rpl_get_instance(dio->instance_id); - if(instance == NULL || instance->current_dag == NULL) { - LOG_WARN("nbr-policy: did not find instance id: %d\n", dio->instance_id); - return NULL; - } - - /* Add the new neighbor only if it is better than the worst parent. */ - if(dio->rank + instance->min_hoprankinc < worst_rank - instance->min_hoprankinc / 2) { - /* Found *great* neighbor - add! */ - LOG_DBG("nbr-policy: DIO rank %u, worst_rank %u -- add to cache\n", - dio->rank, worst_rank); - - return worst_rank_nbr; - } - - LOG_DBG("nbr-policy: DIO rank %u, worst_rank %u -- do not add to cache\n", - dio->rank, worst_rank); - return NULL; -} -/*---------------------------------------------------------------------------*/ -const linkaddr_t * -find_removable_dao(uip_ipaddr_t *from, rpl_instance_t *instance) -{ - int max = MAX_CHILDREN; - update_nbr(); - - if(instance != NULL) { - /* No need to reserve space for parents for RPL ROOT */ - if(instance->current_dag->rank == ROOT_RANK(instance)) { - max = NBR_TABLE_MAX_NEIGHBORS; - } - } - - /* Check if this DAO sender is not yet neighbor and there is already too - many children. */ - if(num_children >= max) { - LOG_ERR("nbr-policy: can not add another child - already at max.\n"); - return NULL; - } - /* remove the worst ranked nbr */ - return worst_rank_nbr; -} -/*---------------------------------------------------------------------------*/ -const linkaddr_t * -rpl_nbr_policy_find_removable(nbr_table_reason_t reason,void * data) -{ - /* When we get the DIO/DAO/DIS we know that UIP contains the - incoming packet */ - switch(reason) { - case NBR_TABLE_REASON_RPL_DIO: - return find_removable_dio(&UIP_IP_BUF->srcipaddr, data); - case NBR_TABLE_REASON_RPL_DAO: - return find_removable_dao(&UIP_IP_BUF->srcipaddr, data); - case NBR_TABLE_REASON_RPL_DIS: - return find_removable_dis(&UIP_IP_BUF->srcipaddr); - default: - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -/** @}*/ diff --git a/os/net/routing/rpl-classic/rpl-of0.c b/os/net/routing/rpl-classic/rpl-of0.c deleted file mode 100644 index 602b8934d..000000000 --- a/os/net/routing/rpl-classic/rpl-of0.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * An implementation of RPL's objective function 0, RFC6552 - * - * \author Joakim Eriksson , Nicolas Tsiftes - */ - -/** - * \addtogroup uip - * @{ - */ - -#include "net/routing/rpl-classic/rpl.h" -#include "net/routing/rpl-classic/rpl-private.h" -#include "net/nbr-table.h" -#include "net/link-stats.h" - -#include "sys/log.h" - -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/* Constants from RFC6552. We use the default values. */ -#define RANK_STRETCH 0 /* Must be in the range [0;5] */ -#define RANK_FACTOR 1 /* Must be in the range [1;4] */ - -#define MIN_STEP_OF_RANK 1 -#define MAX_STEP_OF_RANK 9 - -/* OF0 computes rank increase as follows: - * rank_increase = (RANK_FACTOR * STEP_OF_RANK + RANK_STRETCH) * min_hop_rank_increase - * STEP_OF_RANK is an implementation-specific scalar value in the range [1;9]. - * RFC6552 provides a default value of 3 but recommends to use a dynamic link metric - * such as ETX. - * */ - -#define RPL_OF0_FIXED_SR 0 -#define RPL_OF0_ETX_BASED_SR 1 -/* Select RPL_OF0_FIXED_SR or RPL_OF0_ETX_BASED_SR */ -#ifdef RPL_OF0_CONF_SR -#define RPL_OF0_SR RPL_OF0_CONF_SR -#else /* RPL_OF0_CONF_SR */ -#define RPL_OF0_SR RPL_OF0_ETX_BASED_SR -#endif /* RPL_OF0_CONF_SR */ - -#if RPL_OF0_FIXED_SR -#define STEP_OF_RANK(p) (3) -#endif /* RPL_OF0_FIXED_SR */ - -#if RPL_OF0_ETX_BASED_SR -/* Numbers suggested by P. Thubert for in the 6TiSCH WG. Anything that maps ETX to - * a step between 1 and 9 works. */ -#define STEP_OF_RANK(p) (((3 * parent_link_metric(p)) / LINK_STATS_ETX_DIVISOR) - 2) -#endif /* RPL_OF0_ETX_BASED_SR */ - -/*---------------------------------------------------------------------------*/ -static void -reset(rpl_dag_t *dag) -{ - LOG_INFO("Reset OF0\n"); -} -/*---------------------------------------------------------------------------*/ -#if RPL_WITH_DAO_ACK -static void -dao_ack_callback(rpl_parent_t *p, int status) -{ - if(status == RPL_DAO_ACK_UNABLE_TO_ADD_ROUTE_AT_ROOT) { - return; - } - /* here we need to handle failed DAO's and other stuff */ - LOG_DBG("OF0 - DAO ACK received with status: %d\n", status); - if(status >= RPL_DAO_ACK_UNABLE_TO_ACCEPT) { - /* punish the ETX as if this was 10 packets lost */ - link_stats_packet_sent(rpl_get_parent_lladdr(p), MAC_TX_OK, 10); - } else if(status == RPL_DAO_ACK_TIMEOUT) { /* timeout = no ack */ - /* punish the total lack of ACK with a similar punishment */ - link_stats_packet_sent(rpl_get_parent_lladdr(p), MAC_TX_OK, 10); - } -} -#endif /* RPL_WITH_DAO_ACK */ -/*---------------------------------------------------------------------------*/ -static uint16_t -parent_link_metric(rpl_parent_t *p) -{ - /* OF0 operates without metric container; the only metric we have is ETX */ - const struct link_stats *stats = rpl_get_parent_link_stats(p); - return stats != NULL ? stats->etx : 0xffff; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -parent_rank_increase(rpl_parent_t *p) -{ - uint16_t min_hoprankinc; - if(p == NULL || p->dag == NULL || p->dag->instance == NULL) { - return RPL_INFINITE_RANK; - } - min_hoprankinc = p->dag->instance->min_hoprankinc; - return (RANK_FACTOR * STEP_OF_RANK(p) + RANK_STRETCH) * min_hoprankinc; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -parent_path_cost(rpl_parent_t *p) -{ - if(p == NULL) { - return 0xffff; - } - /* path cost upper bound: 0xffff */ - return MIN((uint32_t)p->rank + parent_link_metric(p), 0xffff); -} -/*---------------------------------------------------------------------------*/ -static rpl_rank_t -rank_via_parent(rpl_parent_t *p) -{ - if(p == NULL) { - return RPL_INFINITE_RANK; - } else { - return MIN((uint32_t)p->rank + parent_rank_increase(p), RPL_INFINITE_RANK); - } -} -/*---------------------------------------------------------------------------*/ -static int -parent_is_acceptable(rpl_parent_t *p) -{ - return STEP_OF_RANK(p) >= MIN_STEP_OF_RANK - && STEP_OF_RANK(p) <= MAX_STEP_OF_RANK; -} -/*---------------------------------------------------------------------------*/ -static int -parent_has_usable_link(rpl_parent_t *p) -{ - return parent_is_acceptable(p); -} -/*---------------------------------------------------------------------------*/ -static rpl_parent_t * -best_parent(rpl_parent_t *p1, rpl_parent_t *p2) -{ - rpl_dag_t *dag; - uint16_t p1_cost; - uint16_t p2_cost; - int p1_is_acceptable; - int p2_is_acceptable; - - p1_is_acceptable = p1 != NULL && parent_is_acceptable(p1); - p2_is_acceptable = p2 != NULL && parent_is_acceptable(p2); - - if(!p1_is_acceptable) { - return p2_is_acceptable ? p2 : NULL; - } - if(!p2_is_acceptable) { - return p1_is_acceptable ? p1 : NULL; - } - - dag = p1->dag; /* Both parents are in the same DAG. */ - p1_cost = parent_path_cost(p1); - p2_cost = parent_path_cost(p2); - - /* Paths costs coarse-grained (multiple of min_hoprankinc), we operate without hysteresis */ - if(p1_cost != p2_cost) { - /* Pick parent with lowest path cost */ - return p1_cost < p2_cost ? p1 : p2; - } else { - /* We have a tie! */ - /* Stik to current preferred parent if possible */ - if(p1 == dag->preferred_parent || p2 == dag->preferred_parent) { - return dag->preferred_parent; - } - /* None of the nodes is the current preferred parent, - * choose parent with best link metric */ - return parent_link_metric(p1) < parent_link_metric(p2) ? p1 : p2; - } -} -/*---------------------------------------------------------------------------*/ -static rpl_dag_t * -best_dag(rpl_dag_t *d1, rpl_dag_t *d2) -{ - if(d1->grounded != d2->grounded) { - return d1->grounded ? d1 : d2; - } - - if(d1->preference != d2->preference) { - return d1->preference > d2->preference ? d1 : d2; - } - - return d1->rank < d2->rank ? d1 : d2; -} -/*---------------------------------------------------------------------------*/ -static void -update_metric_container(rpl_instance_t *instance) -{ - instance->mc.type = RPL_DAG_MC_NONE; -} -/*---------------------------------------------------------------------------*/ -rpl_of_t rpl_of0 = { - reset, -#if RPL_WITH_DAO_ACK - dao_ack_callback, -#endif - parent_link_metric, - parent_has_usable_link, - parent_path_cost, - rank_via_parent, - best_parent, - best_dag, - update_metric_container, - RPL_OCP_OF0 -}; - -/** @}*/ diff --git a/os/net/routing/rpl-classic/rpl-private.h b/os/net/routing/rpl-classic/rpl-private.h deleted file mode 100644 index 5a01c538a..000000000 --- a/os/net/routing/rpl-classic/rpl-private.h +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * \file - * Private declarations for ContikiRPL. - * \author - * Joakim Eriksson , Nicolas Tsiftes - */ - -#ifndef RPL_PRIVATE_H -#define RPL_PRIVATE_H - -#include "net/routing/rpl-classic/rpl.h" - -#include "lib/list.h" -#include "net/ipv6/uip.h" -#include "sys/clock.h" -#include "sys/ctimer.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/ipv6/multicast/uip-mcast6.h" - -/*---------------------------------------------------------------------------*/ -/** \brief Is IPv6 address addr the link-local, all-RPL-nodes - multicast address? */ -#define uip_is_addr_linklocal_rplnodes_mcast(addr) \ - ((addr)->u8[0] == 0xff) && \ - ((addr)->u8[1] == 0x02) && \ - ((addr)->u16[1] == 0) && \ - ((addr)->u16[2] == 0) && \ - ((addr)->u16[3] == 0) && \ - ((addr)->u16[4] == 0) && \ - ((addr)->u16[5] == 0) && \ - ((addr)->u16[6] == 0) && \ - ((addr)->u8[14] == 0) && \ - ((addr)->u8[15] == 0x1a)) - -/** \brief Set IP address addr to the link-local, all-rpl-nodes - multicast address. */ -#define uip_create_linklocal_rplnodes_mcast(addr) \ - uip_ip6addr((addr), 0xff02, 0, 0, 0, 0, 0, 0, 0x001a) -/*---------------------------------------------------------------------------*/ -/* RPL message types */ -#define RPL_CODE_DIS 0x00 /* DAG Information Solicitation */ -#define RPL_CODE_DIO 0x01 /* DAG Information Option */ -#define RPL_CODE_DAO 0x02 /* Destination Advertisement Option */ -#define RPL_CODE_DAO_ACK 0x03 /* DAO acknowledgment */ -#define RPL_CODE_SEC_DIS 0x80 /* Secure DIS */ -#define RPL_CODE_SEC_DIO 0x81 /* Secure DIO */ -#define RPL_CODE_SEC_DAO 0x82 /* Secure DAO */ -#define RPL_CODE_SEC_DAO_ACK 0x83 /* Secure DAO ACK */ - -/* RPL control message options. */ -#define RPL_OPTION_PAD1 0 -#define RPL_OPTION_PADN 1 -#define RPL_OPTION_DAG_METRIC_CONTAINER 2 -#define RPL_OPTION_ROUTE_INFO 3 -#define RPL_OPTION_DAG_CONF 4 -#define RPL_OPTION_TARGET 5 -#define RPL_OPTION_TRANSIT 6 -#define RPL_OPTION_SOLICITED_INFO 7 -#define RPL_OPTION_PREFIX_INFO 8 -#define RPL_OPTION_TARGET_DESC 9 - -#define RPL_DAO_K_FLAG 0x80 /* DAO ACK requested */ -#define RPL_DAO_D_FLAG 0x40 /* DODAG ID present */ - -#define RPL_DAO_ACK_UNCONDITIONAL_ACCEPT 0 -#define RPL_DAO_ACK_ACCEPT 1 /* 1 - 127 is OK but not good */ -#define RPL_DAO_ACK_UNABLE_TO_ACCEPT 128 /* >127 is fail */ -#define RPL_DAO_ACK_UNABLE_TO_ADD_ROUTE_AT_ROOT 255 /* root can not accept */ - -#define RPL_DAO_ACK_TIMEOUT -1 - -/*---------------------------------------------------------------------------*/ -/* RPL IPv6 extension header option. */ -#define RPL_HDR_OPT_LEN 4 -#define RPL_HOP_BY_HOP_LEN (RPL_HDR_OPT_LEN + 2 + 2) -#define RPL_RH_LEN 4 -#define RPL_SRH_LEN 4 -#define RPL_RH_TYPE_SRH 3 -#define RPL_HDR_OPT_DOWN 0x80 -#define RPL_HDR_OPT_DOWN_SHIFT 7 -#define RPL_HDR_OPT_RANK_ERR 0x40 -#define RPL_HDR_OPT_RANK_ERR_SHIFT 6 -#define RPL_HDR_OPT_FWD_ERR 0x20 -#define RPL_HDR_OPT_FWD_ERR_SHIFT 5 -/*---------------------------------------------------------------------------*/ -/* Default values for RPL constants and variables. */ - -/* DAO transmissions are always delayed by RPL_DAO_DELAY +/- RPL_DAO_DELAY/2 */ -#ifdef RPL_CONF_DAO_DELAY -#define RPL_DAO_DELAY RPL_CONF_DAO_DELAY -#else /* RPL_CONF_DAO_DELAY */ -#define RPL_DAO_DELAY (CLOCK_SECOND * 4) -#endif /* RPL_CONF_DAO_DELAY */ - -/* Delay between reception of a no-path DAO and actual route removal */ -#ifdef RPL_CONF_NOPATH_REMOVAL_DELAY -#define RPL_NOPATH_REMOVAL_DELAY RPL_CONF_NOPATH_REMOVAL_DELAY -#else /* RPL_CONF_NOPATH_REMOVAL_DELAY */ -#define RPL_NOPATH_REMOVAL_DELAY 60 -#endif /* RPL_CONF_NOPATH_REMOVAL_DELAY */ - -#ifdef RPL_CONF_DAO_MAX_RETRANSMISSIONS -#define RPL_DAO_MAX_RETRANSMISSIONS RPL_CONF_DAO_MAX_RETRANSMISSIONS -#else -#define RPL_DAO_MAX_RETRANSMISSIONS 5 -#endif /* RPL_CONF_DAO_MAX_RETRANSMISSIONS */ - -#ifdef RPL_CONF_DAO_RETRANSMISSION_TIMEOUT -#define RPL_DAO_RETRANSMISSION_TIMEOUT RPL_CONF_DAO_RETRANSMISSION_TIMEOUT -#else -#define RPL_DAO_RETRANSMISSION_TIMEOUT (5 * CLOCK_SECOND) -#endif /* RPL_CONF_DAO_RETRANSMISSION_TIMEOUT */ - -/* Special value indicating immediate removal. */ -#define RPL_ZERO_LIFETIME 0 - -/* Special value indicating infinite lifetime. */ -#define RPL_INFINITE_LIFETIME 0xFF - -#define RPL_ROUTE_INFINITE_LIFETIME 0xFFFFFFFF - -#define RPL_LIFETIME(instance, lifetime) \ - (((lifetime) == RPL_INFINITE_LIFETIME) ? RPL_ROUTE_INFINITE_LIFETIME : (unsigned long)(instance)->lifetime_unit * (lifetime)) - - -#ifndef RPL_CONF_MIN_HOPRANKINC -/* RFC6550 defines the default MIN_HOPRANKINC as 256. - * However, we use MRHOF as a default Objective Function (RFC6719), - * which recommends setting MIN_HOPRANKINC with care, in particular - * when used with ETX as a metric. ETX is computed as a fixed point - * real with a divisor of 128 (RFC6719, RFC6551). We choose to also - * use 128 for RPL_MIN_HOPRANKINC, resulting in a rank equal to the - * ETX path cost. Larger values may also be desirable, as discussed - * in section 6.1 of RFC6719. */ -#if RPL_OF_OCP == RPL_OCP_MRHOF -#define RPL_MIN_HOPRANKINC 128 -#else /* RPL_OF_OCP == RPL_OCP_MRHOF */ -#define RPL_MIN_HOPRANKINC 256 -#endif /* RPL_OF_OCP == RPL_OCP_MRHOF */ -#else /* RPL_CONF_MIN_HOPRANKINC */ -#define RPL_MIN_HOPRANKINC RPL_CONF_MIN_HOPRANKINC -#endif /* RPL_CONF_MIN_HOPRANKINC */ - -#ifndef RPL_CONF_MAX_RANKINC -#define RPL_MAX_RANKINC (7 * RPL_MIN_HOPRANKINC) -#else /* RPL_CONF_MAX_RANKINC */ -#define RPL_MAX_RANKINC RPL_CONF_MAX_RANKINC -#endif /* RPL_CONF_MAX_RANKINC */ - -#define DAG_RANK(fixpt_rank, instance) \ - ((fixpt_rank) / (instance)->min_hoprankinc) - -/* Rank of a virtual root node that coordinates DAG root nodes. */ -#define BASE_RANK 0 - -/* Rank of a root node. */ -#define ROOT_RANK(instance) (instance)->min_hoprankinc - -#define RPL_INFINITE_RANK 0xffff - -/*---------------------------------------------------------------------------*/ -#define RPL_INSTANCE_LOCAL_FLAG 0x80 -#define RPL_INSTANCE_D_FLAG 0x40 - -/* Values that tell where a route came from. */ -#define RPL_ROUTE_FROM_INTERNAL 0 -#define RPL_ROUTE_FROM_UNICAST_DAO 1 -#define RPL_ROUTE_FROM_MULTICAST_DAO 2 -#define RPL_ROUTE_FROM_DIO 3 - -/* DIS related */ -#define RPL_DIS_SEND 1 - -/*---------------------------------------------------------------------------*/ -/* Lollipop counters */ - -#define RPL_LOLLIPOP_MAX_VALUE 255 -#define RPL_LOLLIPOP_CIRCULAR_REGION 127 -#define RPL_LOLLIPOP_SEQUENCE_WINDOWS 16 -#define RPL_LOLLIPOP_INIT (RPL_LOLLIPOP_MAX_VALUE - RPL_LOLLIPOP_SEQUENCE_WINDOWS + 1) -#define RPL_LOLLIPOP_INCREMENT(counter) \ - do { \ - if((counter) > RPL_LOLLIPOP_CIRCULAR_REGION) { \ - (counter) = ((counter) + 1) & RPL_LOLLIPOP_MAX_VALUE; \ - } else { \ - (counter) = ((counter) + 1) & RPL_LOLLIPOP_CIRCULAR_REGION; \ - } \ - } while(0) - -#define RPL_LOLLIPOP_IS_INIT(counter) \ - ((counter) > RPL_LOLLIPOP_CIRCULAR_REGION) -/*---------------------------------------------------------------------------*/ -/* Logical representation of a DAG Information Object (DIO.) */ -struct rpl_dio { - uip_ipaddr_t dag_id; - rpl_ocp_t ocp; - rpl_rank_t rank; - uint8_t grounded; - uint8_t mop; - uint8_t preference; - uint8_t version; - uint8_t instance_id; - uint8_t dtsn; - uint8_t dag_intdoubl; - uint8_t dag_intmin; - uint8_t dag_redund; - uint8_t default_lifetime; - uint16_t lifetime_unit; - rpl_rank_t dag_max_rankinc; - rpl_rank_t dag_min_hoprankinc; - rpl_prefix_t destination_prefix; - rpl_prefix_t prefix_info; - struct rpl_metric_container mc; -}; -typedef struct rpl_dio rpl_dio_t; - -#if RPL_CONF_STATS -/* Statistics for fault management. */ -struct rpl_stats { - uint16_t mem_overflows; - uint16_t local_repairs; - uint16_t global_repairs; - uint16_t malformed_msgs; - uint16_t resets; - uint16_t parent_switch; - uint16_t forward_errors; - uint16_t loop_errors; - uint16_t loop_warnings; - uint16_t root_repairs; -}; -typedef struct rpl_stats rpl_stats_t; - -extern rpl_stats_t rpl_stats; -#endif - -/* RPL callbacks when TSCH is enabled */ -#if MAC_CONF_WITH_TSCH - -#ifndef RPL_CALLBACK_PARENT_SWITCH -#define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch -#endif /* RPL_CALLBACK_PARENT_SWITCH */ - -#ifndef RPL_CALLBACK_NEW_DIO_INTERVAL -#define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval -#endif /* RPL_CALLBACK_NEW_DIO_INTERVAL */ - -#endif /* MAC_CONF_WITH_TSCH */ - -/*---------------------------------------------------------------------------*/ -/* RPL macros. */ - -#if RPL_CONF_STATS -#define RPL_STAT(code) (code) -#else -#define RPL_STAT(code) -#endif /* RPL_CONF_STATS */ - -/*---------------------------------------------------------------------------*/ -/* Instances */ -extern rpl_instance_t instance_table[]; -extern rpl_instance_t *default_instance; - -/* ICMPv6 functions for RPL. */ -void dis_output(uip_ipaddr_t *addr); -void dio_output(rpl_instance_t *, uip_ipaddr_t *uc_addr); -void dao_output(rpl_parent_t *, uint8_t lifetime); -void dao_output_target(rpl_parent_t *, uip_ipaddr_t *, uint8_t lifetime); -void dao_ack_output(rpl_instance_t *, uip_ipaddr_t *, uint8_t, uint8_t); -void rpl_icmp6_register_handlers(void); -uip_ds6_nbr_t *rpl_icmp6_update_nbr_table(uip_ipaddr_t *from, - nbr_table_reason_t r, void *data); - -/* RPL logic functions. */ -void rpl_join_dag(uip_ipaddr_t *from, rpl_dio_t *dio); -void rpl_join_instance(uip_ipaddr_t *from, rpl_dio_t *dio); -void rpl_local_repair(rpl_instance_t *instance); -void rpl_process_dio(uip_ipaddr_t *, rpl_dio_t *); -int rpl_process_parent_event(rpl_instance_t *, rpl_parent_t *); - -/* DAG object management. */ -rpl_dag_t *rpl_alloc_dag(uint8_t, uip_ipaddr_t *); -rpl_instance_t *rpl_alloc_instance(uint8_t); -void rpl_free_dag(rpl_dag_t *); -void rpl_free_instance(rpl_instance_t *); -void rpl_purge_dags(void); - -/* DAG parent management function. */ -rpl_parent_t *rpl_add_parent(rpl_dag_t *, rpl_dio_t *dio, uip_ipaddr_t *); -rpl_parent_t *rpl_find_parent(rpl_dag_t *, uip_ipaddr_t *); -rpl_parent_t *rpl_find_parent_any_dag(rpl_instance_t *instance, uip_ipaddr_t *addr); -void rpl_nullify_parent(rpl_parent_t *); -void rpl_remove_parent(rpl_parent_t *); -void rpl_move_parent(rpl_dag_t *dag_src, rpl_dag_t *dag_dst, rpl_parent_t *parent); -rpl_parent_t *rpl_select_parent(rpl_dag_t *dag); -rpl_dag_t *rpl_select_dag(rpl_instance_t *instance,rpl_parent_t *parent); -void rpl_recalculate_ranks(void); - -/* RPL routing table functions. */ -void rpl_remove_routes(rpl_dag_t *dag); -void rpl_remove_routes_by_nexthop(uip_ipaddr_t *nexthop, rpl_dag_t *dag); -uip_ds6_route_t *rpl_add_route(rpl_dag_t *dag, uip_ipaddr_t *prefix, - int prefix_len, uip_ipaddr_t *next_hop); -void rpl_purge_routes(void); - -/* Objective function. */ -rpl_of_t *rpl_find_of(rpl_ocp_t); - -/* Timer functions. */ -void rpl_schedule_dao(rpl_instance_t *); -void rpl_schedule_dao_immediately(rpl_instance_t *); -void rpl_schedule_unicast_dio_immediately(rpl_instance_t *instance); -void rpl_cancel_dao(rpl_instance_t *instance); -void rpl_schedule_probing(rpl_instance_t *instance); -void rpl_schedule_probing_now(rpl_instance_t *instance); - -void rpl_reset_dio_timer(rpl_instance_t *); -void rpl_reset_periodic_timer(void); - -/* Route poisoning. */ -void rpl_poison_routes(rpl_dag_t *, rpl_parent_t *); - - -rpl_instance_t *rpl_get_default_instance(void); - -#endif /* RPL_PRIVATE_H */ diff --git a/os/net/routing/rpl-classic/rpl-timers.c b/os/net/routing/rpl-classic/rpl-timers.c deleted file mode 100644 index 0bcfc57dd..000000000 --- a/os/net/routing/rpl-classic/rpl-timers.c +++ /dev/null @@ -1,515 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * RPL timer management. - * - * \author Joakim Eriksson , Nicolas Tsiftes - */ - -/** - * \addtogroup uip - * @{ - */ - -#include "contiki.h" -#include "net/routing/rpl-classic/rpl-private.h" -#include "net/link-stats.h" -#include "net/ipv6/multicast/uip-mcast6.h" -#include "net/ipv6/uip-sr.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/log.h" - -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/* A configurable function called after update of the RPL DIO interval */ -#ifdef RPL_CALLBACK_NEW_DIO_INTERVAL -void RPL_CALLBACK_NEW_DIO_INTERVAL(clock_time_t dio_interval); -#endif /* RPL_CALLBACK_NEW_DIO_INTERVAL */ - -#ifdef RPL_PROBING_SELECT_FUNC -rpl_parent_t *RPL_PROBING_SELECT_FUNC(rpl_dag_t *dag); -#endif /* RPL_PROBING_SELECT_FUNC */ - -#ifdef RPL_PROBING_DELAY_FUNC -clock_time_t RPL_PROBING_DELAY_FUNC(rpl_dag_t *dag); -#endif /* RPL_PROBING_DELAY_FUNC */ - -/*---------------------------------------------------------------------------*/ -static struct ctimer periodic_timer; - -static void handle_periodic_timer(void *ptr); -static void new_dio_interval(rpl_instance_t *instance); -static void handle_dio_timer(void *ptr); - -static uint16_t next_dis; - -/* dio_send_ok is true if the node is ready to send DIOs */ -static uint8_t dio_send_ok; - -/*---------------------------------------------------------------------------*/ -static void -handle_periodic_timer(void *ptr) -{ - rpl_dag_t *dag = rpl_get_any_dag(); - - rpl_purge_dags(); - if(dag != NULL) { - if(RPL_IS_STORING(dag->instance)) { - rpl_purge_routes(); - } - if(RPL_IS_NON_STORING(dag->instance)) { - uip_sr_periodic(1); - } - } - rpl_recalculate_ranks(); - - /* handle DIS */ -#if RPL_DIS_SEND - next_dis++; - if(dag == NULL && next_dis >= RPL_DIS_INTERVAL) { - next_dis = 0; - dis_output(NULL); - } -#endif - ctimer_reset(&periodic_timer); -} -/*---------------------------------------------------------------------------*/ -static void -new_dio_interval(rpl_instance_t *instance) -{ - uint32_t time; - clock_time_t ticks; - - /* TODO: too small timer intervals for many cases */ - time = 1UL << instance->dio_intcurrent; - - /* Convert from milliseconds to CLOCK_TICKS. */ - ticks = (time * CLOCK_SECOND) / 1000; - instance->dio_next_delay = ticks; - - /* random number between I/2 and I */ - ticks = ticks / 2 + (ticks / 2 * (uint32_t)random_rand()) / RANDOM_RAND_MAX; - - /* - * The intervals must be equally long among the nodes for Trickle to - * operate efficiently. Therefore we need to calculate the delay between - * the randomized time and the start time of the next interval. - */ - instance->dio_next_delay -= ticks; - instance->dio_send = 1; - -#if RPL_CONF_STATS - /* keep some stats */ - instance->dio_totint++; - instance->dio_totrecv += instance->dio_counter; - LOG_ANNOTATE("#A rank=%u.%u(%u),stats=%d %d %d %d,color=%s\n", - DAG_RANK(instance->current_dag->rank, instance), - (10 * (instance->current_dag->rank % instance->min_hoprankinc)) / instance->min_hoprankinc, - instance->current_dag->version, - instance->dio_totint, instance->dio_totsend, - instance->dio_totrecv,instance->dio_intcurrent, - instance->current_dag->rank == ROOT_RANK(instance) ? "BLUE" : "ORANGE"); -#endif /* RPL_CONF_STATS */ - - /* reset the redundancy counter */ - instance->dio_counter = 0; - - /* schedule the timer */ - LOG_INFO("Scheduling DIO timer %lu ticks in future (Interval)\n", ticks); - ctimer_set(&instance->dio_timer, ticks, &handle_dio_timer, instance); - -#ifdef RPL_CALLBACK_NEW_DIO_INTERVAL - RPL_CALLBACK_NEW_DIO_INTERVAL((CLOCK_SECOND * 1UL << instance->dio_intcurrent) / 1000); -#endif /* RPL_CALLBACK_NEW_DIO_INTERVAL */ -} -/*---------------------------------------------------------------------------*/ -static void -handle_dio_timer(void *ptr) -{ - rpl_instance_t *instance; - - instance = (rpl_instance_t *)ptr; - - LOG_DBG("DIO Timer triggered\n"); - if(!dio_send_ok) { - if(uip_ds6_get_link_local(ADDR_PREFERRED) != NULL) { - dio_send_ok = 1; - } else { - LOG_WARN("Postponing DIO transmission since link local address is not ok\n"); - ctimer_set(&instance->dio_timer, CLOCK_SECOND, &handle_dio_timer, instance); - return; - } - } - - if(instance->dio_send) { - /* send DIO if counter is less than desired redundancy */ - if(instance->dio_redundancy == 0 || instance->dio_counter < instance->dio_redundancy) { -#if RPL_CONF_STATS - instance->dio_totsend++; -#endif /* RPL_CONF_STATS */ - dio_output(instance, NULL); - } else { - LOG_DBG("Suppressing DIO transmission (%d >= %d)\n", - instance->dio_counter, instance->dio_redundancy); - } - instance->dio_send = 0; - LOG_DBG("Scheduling DIO timer %lu ticks in future (sent)\n", - instance->dio_next_delay); - ctimer_set(&instance->dio_timer, instance->dio_next_delay, handle_dio_timer, instance); - } else { - /* check if we need to double interval */ - if(instance->dio_intcurrent < instance->dio_intmin + instance->dio_intdoubl) { - instance->dio_intcurrent++; - LOG_DBG("DIO Timer interval doubled %d\n", instance->dio_intcurrent); - } - new_dio_interval(instance); - } - - if(LOG_DBG_ENABLED) { - rpl_print_neighbor_list(); - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_reset_periodic_timer(void) -{ - next_dis = RPL_DIS_INTERVAL / 2 + - ((uint32_t)RPL_DIS_INTERVAL * (uint32_t)random_rand()) / RANDOM_RAND_MAX - - RPL_DIS_START_DELAY; - ctimer_set(&periodic_timer, CLOCK_SECOND, handle_periodic_timer, NULL); -} -/*---------------------------------------------------------------------------*/ -/* Resets the DIO timer in the instance to its minimal interval. */ -void -rpl_reset_dio_timer(rpl_instance_t *instance) -{ -#if !RPL_LEAF_ONLY - /* Do not reset if we are already on the minimum interval, - unless forced to do so. */ - if(instance->dio_intcurrent > instance->dio_intmin) { - instance->dio_counter = 0; - instance->dio_intcurrent = instance->dio_intmin; - new_dio_interval(instance); - } -#if RPL_CONF_STATS - rpl_stats.resets++; -#endif /* RPL_CONF_STATS */ -#endif /* RPL_LEAF_ONLY */ -} -/*---------------------------------------------------------------------------*/ -static void handle_dao_timer(void *ptr); -static void -set_dao_lifetime_timer(rpl_instance_t *instance) -{ - if(rpl_get_mode() == RPL_MODE_FEATHER) { - return; - } - - /* Set up another DAO within half the expiration time, if such a - time has been configured */ - if(instance->default_lifetime != RPL_INFINITE_LIFETIME) { - clock_time_t expiration_time; - expiration_time = (clock_time_t)instance->default_lifetime * - (clock_time_t)instance->lifetime_unit * - CLOCK_SECOND / 2; - /* make the time for the re registration be betwen 1/2 - 3/4 of lifetime */ - expiration_time = expiration_time + (random_rand() % (expiration_time / 2)); - LOG_DBG("Scheduling DAO lifetime timer %u ticks in the future\n", - (unsigned)expiration_time); - ctimer_set(&instance->dao_lifetime_timer, expiration_time, - handle_dao_timer, instance); - } -} -/*---------------------------------------------------------------------------*/ -static void -handle_dao_timer(void *ptr) -{ - rpl_instance_t *instance; -#if RPL_WITH_MULTICAST - uip_mcast6_route_t *mcast_route; - uint8_t i; -#endif - - instance = (rpl_instance_t *)ptr; - - if(!dio_send_ok && uip_ds6_get_link_local(ADDR_PREFERRED) == NULL) { - LOG_INFO("Postpone DAO transmission\n"); - ctimer_set(&instance->dao_timer, CLOCK_SECOND, handle_dao_timer, instance); - return; - } - - /* Send the DAO to the DAO parent set -- the preferred parent in our case. */ - if(instance->current_dag->preferred_parent != NULL) { - LOG_INFO("handle_dao_timer - sending DAO\n"); - /* Set the route lifetime to the default value. */ - dao_output(instance->current_dag->preferred_parent, instance->default_lifetime); - -#if RPL_WITH_MULTICAST - /* Send DAOs for multicast prefixes only if the instance is in MOP 3 */ - if(instance->mop == RPL_MOP_STORING_MULTICAST) { - /* Send a DAO for own multicast addresses */ - for(i = 0; i < UIP_DS6_MADDR_NB; i++) { - if(uip_ds6_if.maddr_list[i].isused - && uip_is_addr_mcast_global(&uip_ds6_if.maddr_list[i].ipaddr)) { - dao_output_target(instance->current_dag->preferred_parent, - &uip_ds6_if.maddr_list[i].ipaddr, instance->default_lifetime); - } - } - - /* Iterate over multicast routes and send DAOs */ - mcast_route = uip_mcast6_route_list_head(); - while(mcast_route != NULL) { - /* Don't send if it's also our own address, done that already */ - if(uip_ds6_maddr_lookup(&mcast_route->group) == NULL) { - dao_output_target(instance->current_dag->preferred_parent, - &mcast_route->group, instance->default_lifetime); - } - mcast_route = list_item_next(mcast_route); - } - } -#endif - } else { - LOG_INFO("No suitable DAO parent\n"); - } - - ctimer_stop(&instance->dao_timer); - - if(etimer_expired(&instance->dao_lifetime_timer.etimer)) { - set_dao_lifetime_timer(instance); - } -} -/*---------------------------------------------------------------------------*/ -static void -schedule_dao(rpl_instance_t *instance, clock_time_t latency) -{ - clock_time_t expiration_time; - - if(rpl_get_mode() == RPL_MODE_FEATHER) { - return; - } - - expiration_time = etimer_expiration_time(&instance->dao_timer.etimer); - - if(!etimer_expired(&instance->dao_timer.etimer)) { - LOG_DBG("DAO timer already scheduled\n"); - } else { - if(latency != 0) { - expiration_time = latency / 2 + - (random_rand() % (latency)); - } else { - expiration_time = 0; - } - LOG_DBG("Scheduling DAO timer %u ticks in the future\n", - (unsigned)expiration_time); - ctimer_set(&instance->dao_timer, expiration_time, - handle_dao_timer, instance); - - set_dao_lifetime_timer(instance); - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_schedule_dao(rpl_instance_t *instance) -{ - schedule_dao(instance, RPL_DAO_DELAY); -} -/*---------------------------------------------------------------------------*/ -void -rpl_schedule_dao_immediately(rpl_instance_t *instance) -{ - schedule_dao(instance, 0); -} -/*---------------------------------------------------------------------------*/ -void -rpl_cancel_dao(rpl_instance_t *instance) -{ - ctimer_stop(&instance->dao_timer); - ctimer_stop(&instance->dao_lifetime_timer); -} -/*---------------------------------------------------------------------------*/ -static void -handle_unicast_dio_timer(void *ptr) -{ - rpl_instance_t *instance = (rpl_instance_t *)ptr; - uip_ipaddr_t *target_ipaddr = rpl_parent_get_ipaddr(instance->unicast_dio_target); - - if(target_ipaddr != NULL) { - dio_output(instance, target_ipaddr); - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_schedule_unicast_dio_immediately(rpl_instance_t *instance) -{ - ctimer_set(&instance->unicast_dio_timer, 0, - handle_unicast_dio_timer, instance); -} -/*---------------------------------------------------------------------------*/ -#if RPL_WITH_PROBING -clock_time_t -get_probing_delay(rpl_dag_t *dag) -{ - return ((RPL_PROBING_INTERVAL) / 2) + random_rand() % (RPL_PROBING_INTERVAL); -} -/*---------------------------------------------------------------------------*/ -rpl_parent_t * -get_probing_target(rpl_dag_t *dag) -{ - /* Returns the next probing target. The current implementation probes the urgent - * probing target if any, or the preferred parent if its link statistics need refresh. - * Otherwise, it picks at random between: - * (1) selecting the best parent with non-fresh link statistics - * (2) selecting the least recently updated parent - */ - - rpl_parent_t *p; - rpl_parent_t *probing_target = NULL; - rpl_rank_t probing_target_rank = RPL_INFINITE_RANK; - clock_time_t probing_target_age = 0; - clock_time_t clock_now = clock_time(); - - if(dag == NULL || - dag->instance == NULL) { - return NULL; - } - - /* There is an urgent probing target */ - if(dag->instance->urgent_probing_target != NULL) { - return dag->instance->urgent_probing_target; - } - - /* The preferred parent needs probing */ - if(dag->preferred_parent != NULL && !rpl_parent_is_fresh(dag->preferred_parent)) { - return dag->preferred_parent; - } - - /* With 50% probability: probe best non-fresh parent */ - if(random_rand() % 2 == 0) { - p = nbr_table_head(rpl_parents); - while(p != NULL) { - if(p->dag == dag && !rpl_parent_is_fresh(p)) { - /* p is in our dag and needs probing */ - rpl_rank_t p_rank = rpl_rank_via_parent(p); - if(probing_target == NULL - || p_rank < probing_target_rank) { - probing_target = p; - probing_target_rank = p_rank; - } - } - p = nbr_table_next(rpl_parents, p); - } - } - - /* If we still do not have a probing target: pick the least recently updated parent */ - if(probing_target == NULL) { - p = nbr_table_head(rpl_parents); - while(p != NULL) { - const struct link_stats *stats =rpl_get_parent_link_stats(p); - if(p->dag == dag && stats != NULL) { - if(probing_target == NULL - || clock_now - stats->last_tx_time > probing_target_age) { - probing_target = p; - probing_target_age = clock_now - stats->last_tx_time; - } - } - p = nbr_table_next(rpl_parents, p); - } - } - - return probing_target; -} -/*---------------------------------------------------------------------------*/ -static rpl_dag_t * -get_next_dag(rpl_instance_t *instance) -{ - rpl_dag_t *dag = NULL; - int new_dag = instance->last_dag; - do { - new_dag++; - if(new_dag >= RPL_MAX_DAG_PER_INSTANCE) { - new_dag = 0; - } - if(instance->dag_table[new_dag].used) { - dag = &instance->dag_table[new_dag]; - } - } while(new_dag != instance->last_dag && dag == NULL); - instance->last_dag = new_dag; - return dag; -} -/*---------------------------------------------------------------------------*/ -static void -handle_probing_timer(void *ptr) -{ - rpl_instance_t *instance = (rpl_instance_t *)ptr; - rpl_parent_t *probing_target = RPL_PROBING_SELECT_FUNC(get_next_dag(instance)); - uip_ipaddr_t *target_ipaddr = rpl_parent_get_ipaddr(probing_target); - - /* Perform probing */ - if(target_ipaddr != NULL) { - const struct link_stats *stats = rpl_get_parent_link_stats(probing_target); - (void)stats; - LOG_INFO("probing %u %s last tx %u min ago\n", - rpl_get_parent_lladdr(probing_target)->u8[7], - instance->urgent_probing_target != NULL ? "(urgent)" : "", - probing_target != NULL ? - (unsigned)((clock_time() - stats->last_tx_time) / (60 * CLOCK_SECOND)) : 0 - ); - /* Send probe, e.g. unicast DIO or DIS */ - RPL_PROBING_SEND_FUNC(instance, target_ipaddr); - } - - /* Schedule next probing */ - rpl_schedule_probing(instance); - - if(LOG_DBG_ENABLED) { - rpl_print_neighbor_list(); - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_schedule_probing(rpl_instance_t *instance) -{ - ctimer_set(&instance->probing_timer, RPL_PROBING_DELAY_FUNC(instance->current_dag), - handle_probing_timer, instance); -} -/*---------------------------------------------------------------------------*/ -void -rpl_schedule_probing_now(rpl_instance_t *instance) -{ - ctimer_set(&instance->probing_timer, random_rand() % (CLOCK_SECOND * 4), - handle_probing_timer, instance); -} -#endif /* RPL_WITH_PROBING */ -/** @}*/ diff --git a/os/net/routing/rpl-classic/rpl.c b/os/net/routing/rpl-classic/rpl.c deleted file mode 100644 index 1778329b9..000000000 --- a/os/net/routing/rpl-classic/rpl.c +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * ContikiRPL, an implementation of RPL: IPv6 Routing Protocol - * for Low-Power and Lossy Networks (IETF RFC 6550) - * - * \author Joakim Eriksson , Nicolas Tsiftes - */ - -/** - * \addtogroup uip - * @{ - */ - -#include "net/ipv6/uip.h" -#include "net/ipv6/tcpip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-sr.h" -#include "net/ipv6/uip-icmp6.h" -#include "net/routing/routing.h" -#include "net/routing/rpl-classic/rpl-private.h" -#include "net/routing/rpl-classic/rpl-dag-root.h" -#include "net/ipv6/multicast/uip-mcast6.h" - -#include "sys/log.h" - -#include -#include - -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -#if RPL_CONF_STATS -rpl_stats_t rpl_stats; -#endif - -static enum rpl_mode mode = RPL_MODE_MESH; -/*---------------------------------------------------------------------------*/ -enum rpl_mode -rpl_get_mode(void) -{ - return mode; -} -/*---------------------------------------------------------------------------*/ -enum rpl_mode -rpl_set_mode(enum rpl_mode m) -{ - enum rpl_mode oldmode = mode; - - /* We need to do different things depending on what mode we are - switching to. */ - if(m == RPL_MODE_MESH) { - - /* If we switch to mesh mode, we should send out a DAO message to - inform our parent that we now are reachable. Before we do this, - we must set the mode variable, since DAOs will not be sent if - we are in feather mode. */ - LOG_DBG("rpl_set_mode: switching to mesh mode\n"); - mode = m; - - if(default_instance != NULL) { - rpl_schedule_dao_immediately(default_instance); - } - } else if(m == RPL_MODE_FEATHER) { - - LOG_INFO("rpl_set_mode: switching to feather mode\n"); - if(default_instance != NULL) { - LOG_INFO("rpl_set_mode: RPL sending DAO with zero lifetime\n"); - if(default_instance->current_dag != NULL) { - dao_output(default_instance->current_dag->preferred_parent, RPL_ZERO_LIFETIME); - } - rpl_cancel_dao(default_instance); - } else { - LOG_INFO("rpl_set_mode: no default instance\n"); - } - - mode = m; - } else { - mode = m; - } - - return oldmode; -} -/*---------------------------------------------------------------------------*/ -void -rpl_purge_routes(void) -{ - uip_ds6_route_t *r; - uip_ipaddr_t prefix; - rpl_dag_t *dag; -#if RPL_WITH_MULTICAST - uip_mcast6_route_t *mcast_route; -#endif - - /* First pass, decrement lifetime */ - r = uip_ds6_route_head(); - - while(r != NULL) { - if(r->state.lifetime >= 1 && r->state.lifetime != RPL_ROUTE_INFINITE_LIFETIME) { - /* - * If a route is at lifetime == 1, set it to 0, scheduling it for - * immediate removal below. This achieves the same as the original code, - * which would delete lifetime <= 1 - */ - r->state.lifetime--; - } - r = uip_ds6_route_next(r); - } - - /* Second pass, remove dead routes */ - r = uip_ds6_route_head(); - - while(r != NULL) { - if(r->state.lifetime < 1) { - /* Routes with lifetime == 1 have only just been decremented from 2 to 1, - * thus we want to keep them. Hence < and not <= */ - uip_ipaddr_copy(&prefix, &r->ipaddr); - uip_ds6_route_rm(r); - r = uip_ds6_route_head(); - LOG_INFO("No more routes to "); - LOG_INFO_6ADDR(&prefix); - dag = default_instance->current_dag; - /* Propagate this information with a No-Path DAO to preferred parent if we are not a RPL Root */ - if(dag->rank != ROOT_RANK(default_instance)) { - LOG_INFO_(" -> generate No-Path DAO\n"); - dao_output_target(dag->preferred_parent, &prefix, RPL_ZERO_LIFETIME); - /* Don't schedule more than 1 No-Path DAO, let next iteration handle that */ - return; - } - LOG_INFO_("\n"); - } else { - r = uip_ds6_route_next(r); - } - } - -#if RPL_WITH_MULTICAST - mcast_route = uip_mcast6_route_list_head(); - - while(mcast_route != NULL) { - if(mcast_route->lifetime <= 1) { - uip_mcast6_route_rm(mcast_route); - mcast_route = uip_mcast6_route_list_head(); - } else { - mcast_route->lifetime--; - mcast_route = list_item_next(mcast_route); - } - } -#endif -} -/*---------------------------------------------------------------------------*/ -void -rpl_remove_routes(rpl_dag_t *dag) -{ - uip_ds6_route_t *r; -#if RPL_WITH_MULTICAST - uip_mcast6_route_t *mcast_route; -#endif - - r = uip_ds6_route_head(); - - while(r != NULL) { - if(r->state.dag == dag) { - uip_ds6_route_rm(r); - r = uip_ds6_route_head(); - } else { - r = uip_ds6_route_next(r); - } - } - -#if RPL_WITH_MULTICAST - mcast_route = uip_mcast6_route_list_head(); - - while(mcast_route != NULL) { - if(mcast_route->dag == dag) { - uip_mcast6_route_rm(mcast_route); - mcast_route = uip_mcast6_route_list_head(); - } else { - mcast_route = list_item_next(mcast_route); - } - } -#endif -} -/*---------------------------------------------------------------------------*/ -void -rpl_remove_routes_by_nexthop(uip_ipaddr_t *nexthop, rpl_dag_t *dag) -{ - uip_ds6_route_t *r; - - r = uip_ds6_route_head(); - - while(r != NULL) { - if(uip_ipaddr_cmp(uip_ds6_route_nexthop(r), nexthop) && - r->state.dag == dag) { - r->state.lifetime = 0; - } - r = uip_ds6_route_next(r); - } - LOG_ANNOTATE("#L %u 0\n", nexthop->u8[sizeof(uip_ipaddr_t) - 1]); -} -/*---------------------------------------------------------------------------*/ -uip_ds6_route_t * -rpl_add_route(rpl_dag_t *dag, uip_ipaddr_t *prefix, int prefix_len, - uip_ipaddr_t *next_hop) -{ - uip_ds6_route_t *rep; - - if((rep = uip_ds6_route_add(prefix, prefix_len, next_hop)) == NULL) { - LOG_ERR("No space for more route entries\n"); - return NULL; - } - - rep->state.dag = dag; - rep->state.lifetime = RPL_LIFETIME(dag->instance, dag->instance->default_lifetime); - /* always clear state flags for the no-path received when adding/refreshing */ - RPL_ROUTE_CLEAR_NOPATH_RECEIVED(rep); - - LOG_INFO("Added a route to "); - LOG_INFO_6ADDR(prefix); - LOG_INFO_("/%d via ", prefix_len); - LOG_INFO_6ADDR(next_hop); - LOG_INFO_("\n"); - - return rep; -} -/*---------------------------------------------------------------------------*/ -void -rpl_link_callback(const linkaddr_t *addr, int status, int numtx) -{ - uip_ipaddr_t ipaddr; - rpl_parent_t *parent; - rpl_instance_t *instance; - rpl_instance_t *end; - - uip_ip6addr(&ipaddr, 0xfe80, 0, 0, 0, 0, 0, 0, 0); - uip_ds6_set_addr_iid(&ipaddr, (uip_lladdr_t *)addr); - - for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; instance < end; ++instance) { - if(instance->used == 1 ) { - parent = rpl_find_parent_any_dag(instance, &ipaddr); - if(parent != NULL) { - /* If this is the neighbor we were probing urgently, mark urgent - probing as done */ -#if RPL_WITH_PROBING - if(instance->urgent_probing_target == parent) { - instance->urgent_probing_target = NULL; - } -#endif /* RPL_WITH_PROBING */ - /* Trigger DAG rank recalculation. */ - LOG_DBG("rpl_link_callback triggering update\n"); - parent->flags |= RPL_PARENT_FLAG_UPDATED; - } - } - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_ipv6_neighbor_callback(uip_ds6_nbr_t *nbr) -{ - rpl_parent_t *p; - rpl_instance_t *instance; - rpl_instance_t *end; - - LOG_DBG("Neighbor state changed for "); - LOG_DBG_6ADDR(&nbr->ipaddr); -#if UIP_ND6_SEND_NS || UIP_ND6_SEND_RA - LOG_DBG_(", nscount=%u, state=%u\n", nbr->nscount, nbr->state); -#else /* UIP_ND6_SEND_NS || UIP_ND6_SEND_RA */ - LOG_DBG_(", state=%u\n", nbr->state); -#endif /* UIP_ND6_SEND_NS || UIP_ND6_SEND_RA */ - for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; instance < end; ++instance) { - if(instance->used == 1 ) { - p = rpl_find_parent_any_dag(instance, &nbr->ipaddr); - if(p != NULL) { - p->rank = RPL_INFINITE_RANK; - /* Trigger DAG rank recalculation. */ - LOG_DBG("rpl_ipv6_neighbor_callback infinite rank\n"); - p->flags |= RPL_PARENT_FLAG_UPDATED; - } - } - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_purge_dags(void) -{ - rpl_instance_t *instance; - rpl_instance_t *end; - int i; - - for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; - instance < end; ++instance) { - if(instance->used) { - for(i = 0; i < RPL_MAX_DAG_PER_INSTANCE; i++) { - if(instance->dag_table[i].used) { - if(instance->dag_table[i].lifetime == 0) { - if(!instance->dag_table[i].joined) { - LOG_INFO("Removing dag "); - LOG_INFO_6ADDR(&instance->dag_table[i].dag_id); - LOG_INFO_("\n"); - rpl_free_dag(&instance->dag_table[i]); - } - } else { - instance->dag_table[i].lifetime--; - } - } - } - } - } -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - uip_ipaddr_t rplmaddr; - LOG_INFO("rpl-classic started\n"); - default_instance = NULL; - - rpl_dag_init(); - rpl_reset_periodic_timer(); - rpl_icmp6_register_handlers(); - - /* add rpl multicast address */ - uip_create_linklocal_rplnodes_mcast(&rplmaddr); - uip_ds6_maddr_add(&rplmaddr); - -#if RPL_CONF_STATS - memset(&rpl_stats, 0, sizeof(rpl_stats)); -#endif - -#if RPL_WITH_NON_STORING - uip_sr_init(); -#endif /* RPL_WITH_NON_STORING */ -} -/*---------------------------------------------------------------------------*/ -static int -get_sr_node_ipaddr(uip_ipaddr_t *addr, const uip_sr_node_t *node) -{ - if(addr != NULL && node != NULL) { - memcpy(addr, &((rpl_dag_t *)node->graph)->dag_id, 8); - memcpy(((unsigned char *)addr) + 8, &node->link_identifier, 8); - return 1; - } else { - return 0; - } -} -/*---------------------------------------------------------------------------*/ -static void -global_repair(const char *str) -{ - rpl_dag_t *dag = rpl_get_any_dag(); - if(dag != NULL && dag->instance != NULL) { - rpl_repair_root(dag->instance->instance_id); - } -} -/*---------------------------------------------------------------------------*/ -static void -local_repair(const char *str) -{ - rpl_dag_t *dag = rpl_get_any_dag(); - if(dag != NULL) { - rpl_local_repair(dag->instance); - } -} -/*---------------------------------------------------------------------------*/ -static void -drop_route(uip_ds6_route_t *route) -{ - /* If we are the root of the network, trigger a global repair before - the route gets removed */ - rpl_dag_t *dag; - dag = (rpl_dag_t *)route->state.dag; - if(dag != NULL && dag->instance != NULL) { - rpl_repair_root(dag->instance->instance_id); - } -} -/*---------------------------------------------------------------------------*/ -static void -leave_network(void) -{ - LOG_ERR("leave_network not supported in RPL Classic\n"); -} -/*---------------------------------------------------------------------------*/ -static int -get_root_ipaddr(uip_ipaddr_t *ipaddr) -{ - rpl_dag_t *dag; - /* Use the DAG id as server address if no other has been specified */ - dag = rpl_get_any_dag(); - if(dag != NULL && ipaddr != NULL) { - uip_ipaddr_copy(ipaddr, &dag->dag_id); - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -const struct routing_driver rpl_classic_driver = { - "RPL Classic", - init, - rpl_dag_root_set_prefix, - rpl_dag_root_start, - rpl_dag_root_is_root, - get_root_ipaddr, - get_sr_node_ipaddr, - leave_network, - rpl_has_joined, - rpl_has_downward_route, - global_repair, - local_repair, - rpl_ext_header_remove, - rpl_ext_header_update, - rpl_ext_header_hbh_update, - rpl_ext_header_srh_update, - rpl_ext_header_srh_get_next_hop, - rpl_link_callback, - rpl_ipv6_neighbor_callback, - drop_route, -}; -/*---------------------------------------------------------------------------*/ - -/** @}*/ diff --git a/os/net/routing/rpl-classic/rpl.h b/os/net/routing/rpl-classic/rpl.h deleted file mode 100644 index e690abeae..000000000 --- a/os/net/routing/rpl-classic/rpl.h +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * \file - * Public API declarations for ContikiRPL. - * \author - * Joakim Eriksson & Nicolas Tsiftes - * - */ - -#ifndef RPL_H -#define RPL_H - -#include "net/routing/rpl-classic/rpl-conf.h" - -#include "lib/list.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "sys/ctimer.h" - -/*---------------------------------------------------------------------------*/ -typedef uint16_t rpl_rank_t; -typedef uint16_t rpl_ocp_t; -/*---------------------------------------------------------------------------*/ -/* IANA Routing Metric/Constraint Type as defined in RFC6551 */ -#define RPL_DAG_MC_NONE 0 /* Local identifier for empty MC */ -#define RPL_DAG_MC_NSA 1 /* Node State and Attributes */ -#define RPL_DAG_MC_ENERGY 2 /* Node Energy */ -#define RPL_DAG_MC_HOPCOUNT 3 /* Hop Count */ -#define RPL_DAG_MC_THROUGHPUT 4 /* Throughput */ -#define RPL_DAG_MC_LATENCY 5 /* Latency */ -#define RPL_DAG_MC_LQL 6 /* Link Quality Level */ -#define RPL_DAG_MC_ETX 7 /* Expected Transmission Count */ -#define RPL_DAG_MC_LC 8 /* Link Color */ - -/* IANA Routing Metric/Constraint Common Header Flag field as defined in RFC6551 (bit indexes) */ -#define RPL_DAG_MC_FLAG_P 5 -#define RPL_DAG_MC_FLAG_C 6 -#define RPL_DAG_MC_FLAG_O 7 -#define RPL_DAG_MC_FLAG_R 8 - -/* IANA Routing Metric/Constraint Common Header A Field as defined in RFC6551 */ -#define RPL_DAG_MC_AGGR_ADDITIVE 0 -#define RPL_DAG_MC_AGGR_MAXIMUM 1 -#define RPL_DAG_MC_AGGR_MINIMUM 2 -#define RPL_DAG_MC_AGGR_MULTIPLICATIVE 3 - -/* The bit index within the flags field of the rpl_metric_object_energy structure. */ -#define RPL_DAG_MC_ENERGY_INCLUDED 3 -#define RPL_DAG_MC_ENERGY_TYPE 1 -#define RPL_DAG_MC_ENERGY_ESTIMATION 0 - -/* IANA Node Type Field as defined in RFC6551 */ -#define RPL_DAG_MC_ENERGY_TYPE_MAINS 0 -#define RPL_DAG_MC_ENERGY_TYPE_BATTERY 1 -#define RPL_DAG_MC_ENERGY_TYPE_SCAVENGING 2 - -/* IANA Objective Code Point as defined in RFC6550 */ -#define RPL_OCP_OF0 0 -#define RPL_OCP_MRHOF 1 - -struct rpl_metric_object_energy { - uint8_t flags; - uint8_t energy_est; -}; - -/* Logical representation of a DAG Metric Container. */ -struct rpl_metric_container { - uint8_t type; - uint8_t flags; - uint8_t aggr; - uint8_t prec; - uint8_t length; - union metric_object { - struct rpl_metric_object_energy energy; - uint16_t etx; - } obj; -}; -typedef struct rpl_metric_container rpl_metric_container_t; -/*---------------------------------------------------------------------------*/ -struct rpl_instance; -struct rpl_dag; -/*---------------------------------------------------------------------------*/ -#define RPL_PARENT_FLAG_UPDATED 0x1 -#define RPL_PARENT_FLAG_LINK_METRIC_VALID 0x2 - -struct rpl_parent { - struct rpl_dag *dag; -#if RPL_WITH_MC - rpl_metric_container_t mc; -#endif /* RPL_WITH_MC */ - rpl_rank_t rank; - uint8_t dtsn; - uint8_t flags; -}; -typedef struct rpl_parent rpl_parent_t; -/*---------------------------------------------------------------------------*/ -/* RPL DIO prefix suboption */ -struct rpl_prefix { - uip_ipaddr_t prefix; - uint32_t lifetime; - uint8_t length; - uint8_t flags; -}; -typedef struct rpl_prefix rpl_prefix_t; -/*---------------------------------------------------------------------------*/ -/* Directed Acyclic Graph */ -struct rpl_dag { - uip_ipaddr_t dag_id; - rpl_rank_t min_rank; /* should be reset per DAG iteration! */ - uint8_t version; - uint8_t grounded; - uint8_t preference; - uint8_t used; - /* live data for the DAG */ - uint8_t joined; - rpl_parent_t *preferred_parent; - rpl_rank_t rank; - struct rpl_instance *instance; - rpl_prefix_t prefix_info; - uint32_t lifetime; -}; -typedef struct rpl_dag rpl_dag_t; -typedef struct rpl_instance rpl_instance_t; -/*---------------------------------------------------------------------------*/ -/* - * API for RPL objective functions (OF) - * - * reset(dag) - * - * Resets the objective function state for a specific DAG. This function is - * called when doing a global repair on the DAG. - * - * parent_link_metric(parent) - * - * Returns the link metric of a parent - * - * parent_has_usable_link(parent) - * - * Returns 1 iff we have a usable link to this parent - * - * parent_path_cost(parent) - * - * Returns the path cost of a parent - * - * rank_via_parent(parent) - * - * Returns our rank if we select a given parent as preferred parent - * - * parent_is_acceptable - * - * Returns 1 if a parent is usable as preferred parent, 0 otherwise - * - * best_parent(parent1, parent2) - * - * Compares two parents and returns the best one, according to the OF. - * - * best_dag(dag1, dag2) - * - * Compares two DAGs and returns the best one, according to the OF. - * - * update_metric_container(dag) - * - * Updates the metric container for outgoing DIOs in a certain DAG. - * If the objective function of the DAG does not use metric containers, - * the function should set the object type to RPL_DAG_MC_NONE. - * - * dao_ack_callback(parent, status) - * - * A callback on the result of the DAO ACK. Similar to the neighbor link - * callback. A failed DAO_ACK (NACK) can be used for switching to another - * parent via changed link metric or other mechanisms. - */ -struct rpl_of { - void (*reset)(struct rpl_dag *); -#if RPL_WITH_DAO_ACK - void (*dao_ack_callback)(rpl_parent_t *, int status); -#endif - uint16_t (*parent_link_metric)(rpl_parent_t *); - int (*parent_has_usable_link)(rpl_parent_t *); - uint16_t (*parent_path_cost)(rpl_parent_t *); - rpl_rank_t (*rank_via_parent)(rpl_parent_t *); - rpl_parent_t *(*best_parent)(rpl_parent_t *, rpl_parent_t *); - rpl_dag_t *(*best_dag)(rpl_dag_t *, rpl_dag_t *); - void (*update_metric_container)( rpl_instance_t *); - rpl_ocp_t ocp; -}; -typedef struct rpl_of rpl_of_t; - -/*---------------------------------------------------------------------------*/ -/* Instance */ -struct rpl_instance { - /* DAG configuration */ - rpl_metric_container_t mc; - rpl_of_t *of; - rpl_dag_t *current_dag; - rpl_dag_t dag_table[RPL_MAX_DAG_PER_INSTANCE]; - /* The current default router - used for routing "upwards" */ - uip_ds6_defrt_t *def_route; - uint8_t instance_id; - uint8_t used; - uint8_t dtsn_out; - uint8_t mop; - uint8_t dio_intdoubl; - uint8_t dio_intmin; - uint8_t dio_redundancy; - uint8_t default_lifetime; - uint8_t dio_intcurrent; - uint8_t dio_send; /* for keeping track of which mode the timer is in */ - uint8_t dio_counter; - /* my last registered DAO that I might be waiting for ACK on */ - uint8_t my_dao_seqno; - uint8_t my_dao_transmissions; - /* this is intended to keep track if this instance have a route downward */ - uint8_t has_downward_route; - rpl_rank_t max_rankinc; - rpl_rank_t min_hoprankinc; - uint16_t lifetime_unit; /* lifetime in seconds = l_u * d_l */ -#if RPL_CONF_STATS - uint16_t dio_totint; - uint16_t dio_totsend; - uint16_t dio_totrecv; -#endif /* RPL_CONF_STATS */ - clock_time_t dio_next_delay; /* delay for completion of dio interval */ -#if RPL_WITH_PROBING - struct ctimer probing_timer; - rpl_parent_t *urgent_probing_target; - int last_dag; -#endif /* RPL_WITH_PROBING */ - struct ctimer dio_timer; - struct ctimer dao_timer; - struct ctimer dao_lifetime_timer; - struct ctimer unicast_dio_timer; - rpl_parent_t *unicast_dio_target; -#if RPL_WITH_DAO_ACK - struct ctimer dao_retransmit_timer; -#endif /* RPL_WITH_DAO_ACK */ -}; - -/*---------------------------------------------------------------------------*/ -/* Public RPL functions. */ -void uip_rpl_input(void); -rpl_dag_t *rpl_set_root(uint8_t instance_id, uip_ipaddr_t *dag_id); -int rpl_set_prefix(rpl_dag_t *dag, uip_ipaddr_t *prefix, unsigned len); -int rpl_repair_root(uint8_t instance_id); -int rpl_set_default_route(rpl_instance_t *instance, uip_ipaddr_t *from); -rpl_dag_t *rpl_get_dag(const uip_ipaddr_t *addr); -rpl_dag_t *rpl_get_any_dag(void); -rpl_instance_t *rpl_get_instance(uint8_t instance_id); -int rpl_ext_header_update(void); -int rpl_ext_header_hbh_update(uint8_t *, int); -void rpl_insert_header(void); -void rpl_ext_header_remove(void); -const struct link_stats *rpl_get_parent_link_stats(rpl_parent_t *p); -int rpl_parent_is_fresh(rpl_parent_t *p); -int rpl_parent_is_reachable(rpl_parent_t *p); -uint16_t rpl_get_parent_link_metric(rpl_parent_t *p); -rpl_rank_t rpl_rank_via_parent(rpl_parent_t *p); -const linkaddr_t *rpl_get_parent_lladdr(rpl_parent_t *p); -uip_ipaddr_t *rpl_parent_get_ipaddr(rpl_parent_t *nbr); -rpl_parent_t *rpl_get_parent(const uip_lladdr_t *addr); -rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr); -void rpl_dag_init(void); -uip_ds6_nbr_t *rpl_get_nbr(rpl_parent_t *parent); -void rpl_print_neighbor_list(void); -int rpl_ext_header_srh_update(void); -int rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr); -void rpl_link_callback(const linkaddr_t *addr, int status, int numtx); -/* Per-parent RPL information */ -NBR_TABLE_DECLARE(rpl_parents); - -/** - * RPL modes - * - * The RPL module can be in either of three modes: mesh mode - * (RPL_MODE_MESH), feater mode (RPL_MODE_FEATHER), and leaf mode - * (RPL_MODE_LEAF). In mesh mode, nodes forward data for other nodes, - * and are reachable by others. In feather mode, nodes can forward - * data for other nodes, but are not reachable themselves. In leaf - * mode, nodes do not forward data for others, but are reachable by - * others. */ -enum rpl_mode { - RPL_MODE_MESH = 0, - RPL_MODE_FEATHER = 1, - RPL_MODE_LEAF = 2, -}; - -/** - * Set the RPL mode - * - * \param mode The new RPL mode - * \retval The previous RPL mode - */ -enum rpl_mode rpl_set_mode(enum rpl_mode mode); - -/** - * Get the RPL mode - * - * \retval The RPL mode - */ -enum rpl_mode rpl_get_mode(void); - -/** - * Tells whether the node has joined a network or not - * - * \retval 1 if we have joined a network, 0 if not. - */ -int rpl_has_joined(void); - -/** - * Get the RPL's best guess on if we have downward route or not. - * - * \retval 1 if we have a downward route from RPL Root, 0 if not. - */ -int rpl_has_downward_route(void); - -/*---------------------------------------------------------------------------*/ -#endif /* RPL_H */ diff --git a/os/net/routing/rpl-lite/rpl-conf.h b/os/net/routing/rpl-lite/rpl-conf.h deleted file mode 100644 index 5d674fa96..000000000 --- a/os/net/routing/rpl-lite/rpl-conf.h +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * Public configuration and API declarations for ContikiRPL. - * \author - * Joakim Eriksson , Nicolas Tsiftes , - * Simon DUquennoy - * - */ - -#ifndef RPL_CONF_H -#define RPL_CONF_H - -#include "contiki.h" - -/******************************************************************************/ -/*********************** Enabling/disabling features **************************/ -/******************************************************************************/ - -/* RPL Mode of operation */ -#ifdef RPL_CONF_MOP -#define RPL_MOP_DEFAULT RPL_CONF_MOP -#else /* RPL_CONF_MOP */ -#define RPL_MOP_DEFAULT RPL_MOP_NON_STORING -#endif /* RPL_CONF_MOP */ - -/* - * We only support non-storing mode - */ -#define RPL_WITH_STORING 0 - -/* - * Embed support for non-storing mode - */ -#ifdef RPL_CONF_WITH_NON_STORING -#define RPL_WITH_NON_STORING RPL_CONF_WITH_NON_STORING -#else /* RPL_CONF_WITH_NON_STORING */ -/* By default: embed support for non-storing if and only if the configured MOP is non-storing */ -#define RPL_WITH_NON_STORING (RPL_MOP_DEFAULT == RPL_MOP_NON_STORING) -#endif /* RPL_CONF_WITH_NON_STORING */ - -/* - * The objective function (OF) used by a RPL root is configurable through - * the RPL_CONF_OF_OCP parameter. This is defined as the objective code - * point (OCP) of the OF, RPL_OCP_OF0 or RPL_OCP_MRHOF. This flag is of - * no relevance to non-root nodes, which run the OF advertised in the - * instance they join. - * Make sure the selected of is inRPL_SUPPORTED_OFS. - */ -#ifdef RPL_CONF_OF_OCP -#define RPL_OF_OCP RPL_CONF_OF_OCP -#else /* RPL_CONF_OF_OCP */ -#define RPL_OF_OCP RPL_OCP_MRHOF -#endif /* RPL_CONF_OF_OCP */ - -/* - * The set of objective functions supported at runtime. Nodes are only - * able to join instances that advertise an OF in this set. To include - * both OF0 and MRHOF, use {&rpl_of0, &rpl_mrhof}. - */ -#ifdef RPL_CONF_SUPPORTED_OFS -#define RPL_SUPPORTED_OFS RPL_CONF_SUPPORTED_OFS -#else /* RPL_CONF_SUPPORTED_OFS */ -#define RPL_SUPPORTED_OFS {&rpl_mrhof} -#endif /* RPL_CONF_SUPPORTED_OFS */ - -/* - * Enable/disable RPL Metric Containers (MC). The actual MC in use - * for a given DODAG is decided at runtime, when joining. Note that - * OF0 (RFC6552) operates without MC, and so does MRHOF (RFC6719) when - * used with ETX as a metric (the rank is the metric). We disable MC - * by default, but note it must be enabled to support joining a DODAG - * that requires MC (e.g., MRHOF with a metric other than ETX). - */ -#ifdef RPL_CONF_WITH_MC -#define RPL_WITH_MC RPL_CONF_WITH_MC -#else /* RPL_CONF_WITH_MC */ -#define RPL_WITH_MC 0 -#endif /* RPL_CONF_WITH_MC */ - -/* The MC advertised in DIOs and propagating from the root */ -#ifdef RPL_CONF_DAG_MC -#define RPL_DAG_MC RPL_CONF_DAG_MC -#else -#define RPL_DAG_MC RPL_DAG_MC_NONE -#endif /* RPL_CONF_DAG_MC */ - -/* - * RPL DAO-ACK support. When enabled, DAO-ACK will be sent and requested. - * This will also enable retransmission of DAO when no ack is received. - * */ -#ifdef RPL_CONF_WITH_DAO_ACK -#define RPL_WITH_DAO_ACK RPL_CONF_WITH_DAO_ACK -#else -#define RPL_WITH_DAO_ACK 1 -#endif /* RPL_CONF_WITH_DAO_ACK */ - -/* - * Setting the RPL_TRICKLE_REFRESH_DAO_ROUTES will make the RPL root - * increase the DTSN (Destination Advertisement Trigger Sequence Number) - * from the DIO trickle timer. If set to 4, DTSN will be increased every 4th - * iteration. This is to get all children to re-register their DAO route. - * This is needed when DAO-ACK is not enabled to - * add reliability to route maintenance. - * */ -#ifdef RPL_CONF_TRICKLE_REFRESH_DAO_ROUTES -#define RPL_TRICKLE_REFRESH_DAO_ROUTES RPL_CONF_TRICKLE_REFRESH_DAO_ROUTES -#else -#if RPL_WITH_DAO_ACK -#define RPL_TRICKLE_REFRESH_DAO_ROUTES 0 -#else -#define RPL_TRICKLE_REFRESH_DAO_ROUTES 4 -#endif -#endif /* RPL_CONF_TRICKLE_REFRESH_DAO_ROUTES */ - -/* - * RPL probing. When enabled, probes will be sent periodically to keep - * neighbor link estimates up to date. Further configurable - * via RPL_CONF_PROBING_* flags - */ -#ifdef RPL_CONF_WITH_PROBING -#define RPL_WITH_PROBING RPL_CONF_WITH_PROBING -#else -#define RPL_WITH_PROBING 1 -#endif - -/* - * Function used to select the next neighbor to be probed. - */ -#ifdef RPL_CONF_PROBING_SELECT_FUNC -#define RPL_PROBING_SELECT_FUNC RPL_CONF_PROBING_SELECT_FUNC -#else -#define RPL_PROBING_SELECT_FUNC get_probing_target -#endif - -/* - * Function used to send RPL probes. - * To probe with DIO, use: - * #define RPL_CONF_PROBING_SEND_FUNC(addr) rpl_icmp6_dio_output((addr)) - * To probe with DIS, use: - * #define RPL_CONF_PROBING_SEND_FUNC(addr) rpl_icmp6_dis_output((addr)) - * Any other custom probing function is also acceptable. - */ -#ifdef RPL_CONF_PROBING_SEND_FUNC -#define RPL_PROBING_SEND_FUNC RPL_CONF_PROBING_SEND_FUNC -#else -#define RPL_PROBING_SEND_FUNC(addr) rpl_icmp6_dio_output((addr)) -#endif - -/* - * This value decides if this node must stay as a leaf or not - * as allowed by draft-ietf-roll-rpl-19#section-8.5 - */ -#ifdef RPL_CONF_DEFAULT_LEAF_ONLY -#define RPL_DEFAULT_LEAF_ONLY RPL_CONF_DEFAULT_LEAF_ONLY -#else -#define RPL_DEFAULT_LEAF_ONLY 0 -#endif - -/* - * Function used to validate dio before using it to init dag - */ -#ifdef RPL_CONF_VALIDATE_DIO_FUNC -#define RPL_VALIDATE_DIO_FUNC RPL_CONF_VALIDATE_DIO_FUNC -#endif - -/******************************************************************************/ -/********************************** Timing ************************************/ -/******************************************************************************/ - -/* - * The DIO interval (n) represents 2^n ms. - * - * According to the specification, the default value is 3 which - * means 8 milliseconds. That is far too low when using duty cycling - * with wake-up intervals that are typically hundreds of milliseconds. - * ContikiRPL thus sets the default to 2^12 ms = 4.096 s. - */ -#ifdef RPL_CONF_DIO_INTERVAL_MIN -#define RPL_DIO_INTERVAL_MIN RPL_CONF_DIO_INTERVAL_MIN -#else -#define RPL_DIO_INTERVAL_MIN 12 -#endif - -/* - * Maximum amount of timer doublings. - * - * The maximum interval will by default be 2^(12+8) ms = 1048.576 s. - * RFC 6550 suggests a default value of 20, which of course would be - * unsuitable when we start with a minimum interval of 2^12. - */ -#ifdef RPL_CONF_DIO_INTERVAL_DOUBLINGS -#define RPL_DIO_INTERVAL_DOUBLINGS RPL_CONF_DIO_INTERVAL_DOUBLINGS -#else -#define RPL_DIO_INTERVAL_DOUBLINGS 8 -#endif - -/* - * DIO redundancy. To learn more about this, see RFC 6206. - * - * RFC 6550 suggests a default value of 10. We disable this mechanism by - * default, using a value of 0. This is to enable reliable DTSN increment - * propagation, and periodic rank dissemination without the need to increment - * version. Note that Trickle was originally designed for CTP, aiming to - * reduce broadcast traffic, which was particularly expensive done over an - * LPL MAC. In MAC layers such as non-beacon enabled or TSCH, broadcast is no - * more costly than unicast. Further, in this RPL implementation, DIOs are - * responsible for only a portion of the control traffic, compared to Link - * probing which is done at a period of minutes (RPL_PROBING_INTERVAL) - * for reliable parent selection. - */ -#ifdef RPL_CONF_DIO_REDUNDANCY -#define RPL_DIO_REDUNDANCY RPL_CONF_DIO_REDUNDANCY -#else -#define RPL_DIO_REDUNDANCY 0 -#endif - -/* - * Default route lifetime unit. This is the granularity of time - * used in RPL lifetime values, in seconds. - */ -#ifndef RPL_CONF_DEFAULT_LIFETIME_UNIT -#define RPL_DEFAULT_LIFETIME_UNIT 60 -#else -#define RPL_DEFAULT_LIFETIME_UNIT RPL_CONF_DEFAULT_LIFETIME_UNIT -#endif - -/* - * Default route lifetime as a multiple of the lifetime unit. - */ -#ifndef RPL_CONF_DEFAULT_LIFETIME -#define RPL_DEFAULT_LIFETIME 30 -#else -#define RPL_DEFAULT_LIFETIME RPL_CONF_DEFAULT_LIFETIME -#endif - -/* Maximum lifetime of a DAG as a multiple of the lifetime unit. */ -#ifdef RPL_CONF_DAG_LIFETIME -#define RPL_DAG_LIFETIME RPL_CONF_DAG_LIFETIME -#else -#define RPL_DAG_LIFETIME (8 * 60) /* 8 hours */ -#endif /* RPL_CONF_DAG_LIFETIME */ - -/* - * RPL probing interval. - */ -#ifdef RPL_CONF_PROBING_INTERVAL -#define RPL_PROBING_INTERVAL RPL_CONF_PROBING_INTERVAL -#else -#define RPL_PROBING_INTERVAL (90 * CLOCK_SECOND) -#endif - -/* - * Function used to calculate next RPL probing interval - */ -#ifdef RPL_CONF_PROBING_DELAY_FUNC -#define RPL_PROBING_DELAY_FUNC RPL_CONF_PROBING_DELAY_FUNC -#else -#define RPL_PROBING_DELAY_FUNC get_probing_delay -#endif - -/* Poisoining duration, before leaving the DAG */ -#ifdef RPL_CONF_DELAY_BEFORE_LEAVING -#define RPL_DELAY_BEFORE_LEAVING RPL_CONF_DELAY_BEFORE_LEAVING -#else -#define RPL_DELAY_BEFORE_LEAVING (5 * 60 * CLOCK_SECOND) -#endif - -/* Interval of DIS transmission */ -#ifdef RPL_CONF_DIS_INTERVAL -#define RPL_DIS_INTERVAL RPL_CONF_DIS_INTERVAL -#else -#define RPL_DIS_INTERVAL (30 * CLOCK_SECOND) -#endif - -/* DAO transmissions are always delayed by RPL_DAO_DELAY +/- RPL_DAO_DELAY/2 */ -#ifdef RPL_CONF_DAO_DELAY -#define RPL_DAO_DELAY RPL_CONF_DAO_DELAY -#else /* RPL_CONF_DAO_DELAY */ -#define RPL_DAO_DELAY (CLOCK_SECOND * 4) -#endif /* RPL_CONF_DAO_DELAY */ - -#ifdef RPL_CONF_DAO_MAX_RETRANSMISSIONS -#define RPL_DAO_MAX_RETRANSMISSIONS RPL_CONF_DAO_MAX_RETRANSMISSIONS -#else -#define RPL_DAO_MAX_RETRANSMISSIONS 5 -#endif /* RPL_CONF_DAO_MAX_RETRANSMISSIONS */ - -#ifdef RPL_CONF_DAO_RETRANSMISSION_TIMEOUT -#define RPL_DAO_RETRANSMISSION_TIMEOUT RPL_CONF_DAO_RETRANSMISSION_TIMEOUT -#else -#define RPL_DAO_RETRANSMISSION_TIMEOUT (5 * CLOCK_SECOND) -#endif /* RPL_CONF_DAO_RETRANSMISSION_TIMEOUT */ - -/******************************************************************************/ -/************************** More parameterization *****************************/ -/******************************************************************************/ - -#ifndef RPL_CONF_MIN_HOPRANKINC -/* RFC6550 defines the default MIN_HOPRANKINC as 256. - * However, we use MRHOF as a default Objective Function (RFC6719), - * which recommends setting MIN_HOPRANKINC with care, in particular - * when used with ETX as a metric. ETX is computed as a fixed point - * real with a divisor of 128 (RFC6719, RFC6551). We choose to also - * use 128 for RPL_MIN_HOPRANKINC, resulting in a rank equal to the - * ETX path cost. Larger values may also be desirable, as discussed - * in section 6.1 of RFC6719. */ -#if RPL_OF_OCP == RPL_OCP_MRHOF -#define RPL_MIN_HOPRANKINC 128 -#else /* RPL_OF_OCP == RPL_OCP_MRHOF */ -#define RPL_MIN_HOPRANKINC 256 -#endif /* RPL_OF_OCP == RPL_OCP_MRHOF */ -#else /* RPL_CONF_MIN_HOPRANKINC */ -#define RPL_MIN_HOPRANKINC RPL_CONF_MIN_HOPRANKINC -#endif /* RPL_CONF_MIN_HOPRANKINC */ - -#ifndef RPL_CONF_MAX_RANKINC -#define RPL_MAX_RANKINC (8 * RPL_MIN_HOPRANKINC) -#else /* RPL_CONF_MAX_RANKINC */ -#define RPL_MAX_RANKINC RPL_CONF_MAX_RANKINC -#endif /* RPL_CONF_MAX_RANKINC */ - -#ifndef RPL_CONF_SIGNIFICANT_CHANGE_THRESHOLD -#define RPL_SIGNIFICANT_CHANGE_THRESHOLD (4 * RPL_MIN_HOPRANKINC) -#else /* RPL_CONF_SIGNIFICANT_CHANGE_THRESHOLD */ -#define RPL_SIGNIFICANT_CHANGE_THRESHOLD RPL_CONF_SIGNIFICANT_CHANGE_THRESHOLD -#endif /* RPL_CONF_SIGNIFICANT_CHANGE_THRESHOLD */ - -/* This value decides which DAG instance we should participate in by default. */ -#ifdef RPL_CONF_DEFAULT_INSTANCE -#define RPL_DEFAULT_INSTANCE RPL_CONF_DEFAULT_INSTANCE -#else -#define RPL_DEFAULT_INSTANCE 0 /* Default of 0 for compression */ -#endif /* RPL_CONF_DEFAULT_INSTANCE */ - -/* Set to have the root advertise a grounded DAG */ -#ifndef RPL_CONF_GROUNDED -#define RPL_GROUNDED 0 -#else -#define RPL_GROUNDED RPL_CONF_GROUNDED -#endif /* !RPL_CONF_GROUNDED */ - -/* - * DAG preference field - */ -#ifdef RPL_CONF_PREFERENCE -#define RPL_PREFERENCE RPL_CONF_PREFERENCE -#else -#define RPL_PREFERENCE 0 -#endif - -/* RPL callbacks when TSCH is enabled */ -#if MAC_CONF_WITH_TSCH - -#ifndef RPL_CALLBACK_PARENT_SWITCH -#define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch -#endif /* RPL_CALLBACK_PARENT_SWITCH */ - -#ifndef RPL_CALLBACK_NEW_DIO_INTERVAL -#define RPL_CALLBACK_NEW_DIO_INTERVAL tsch_rpl_callback_new_dio_interval -#endif /* RPL_CALLBACK_NEW_DIO_INTERVAL */ - -#endif /* MAC_CONF_WITH_TSCH */ - -/** @} */ - -#endif /* RPL_CONF_H */ diff --git a/os/net/routing/rpl-lite/rpl-const.h b/os/net/routing/rpl-lite/rpl-const.h deleted file mode 100644 index efeabd1f1..000000000 --- a/os/net/routing/rpl-lite/rpl-const.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * Constants for RPL - * \author - * Joakim Eriksson & Nicolas Tsiftes , - * Simon Duquennoy - * - */ - -#ifndef RPL_CONST_H -#define RPL_CONST_H - -/********** Constants **********/ - -/* Special value indicating infinite lifetime. */ -#define RPL_INFINITE_LIFETIME 0xFF -#define RPL_ROUTE_INFINITE_LIFETIME 0xFFFFFFFF -#define RPL_INFINITE_RANK 0xFFFF - -/*---------------------------------------------------------------------------*/ -/* IANA Routing Metric/Constraint Type as defined in RFC6551 */ -#define RPL_DAG_MC_NONE 0 /* Local identifier for empty MC */ -#define RPL_DAG_MC_NSA 1 /* Node State and Attributes */ -#define RPL_DAG_MC_ENERGY 2 /* Node Energy */ -#define RPL_DAG_MC_HOPCOUNT 3 /* Hop Count */ -#define RPL_DAG_MC_THROUGHPUT 4 /* Throughput */ -#define RPL_DAG_MC_LATENCY 5 /* Latency */ -#define RPL_DAG_MC_LQL 6 /* Link Quality Level */ -#define RPL_DAG_MC_ETX 7 /* Expected Transmission Count */ -#define RPL_DAG_MC_LC 8 /* Link Color */ - -/* IANA Routing Metric/Constraint Common Header Flag field as defined in RFC6551 (bit indexes) */ -#define RPL_DAG_MC_FLAG_P 5 -#define RPL_DAG_MC_FLAG_C 6 -#define RPL_DAG_MC_FLAG_O 7 -#define RPL_DAG_MC_FLAG_R 8 - -/* IANA Routing Metric/Constraint Common Header A Field as defined in RFC6551 */ -#define RPL_DAG_MC_AGGR_ADDITIVE 0 -#define RPL_DAG_MC_AGGR_MAXIMUM 1 -#define RPL_DAG_MC_AGGR_MINIMUM 2 -#define RPL_DAG_MC_AGGR_MULTIPLICATIVE 3 - -/* The bit index within the flags field of the rpl_metric_object_energy structure. */ -#define RPL_DAG_MC_ENERGY_INCLUDED 3 -#define RPL_DAG_MC_ENERGY_TYPE 1 -#define RPL_DAG_MC_ENERGY_ESTIMATION 0 - -/* IANA Node Type Field as defined in RFC6551 */ -#define RPL_DAG_MC_ENERGY_TYPE_MAINS 0 -#define RPL_DAG_MC_ENERGY_TYPE_BATTERY 1 -#define RPL_DAG_MC_ENERGY_TYPE_SCAVENGING 2 - -/* IANA Objective Code Point as defined in RFC6550 */ -#define RPL_OCP_OF0 0 -#define RPL_OCP_MRHOF 1 - -/*---------------------------------------------------------------------------*/ -/* RPL message types */ -#define RPL_CODE_DIS 0x00 /* DAG Information Solicitation */ -#define RPL_CODE_DIO 0x01 /* DAG Information Option */ -#define RPL_CODE_DAO 0x02 /* Destination Advertisement Option */ -#define RPL_CODE_DAO_ACK 0x03 /* DAO acknowledgment */ -#define RPL_CODE_SEC_DIS 0x80 /* Secure DIS */ -#define RPL_CODE_SEC_DIO 0x81 /* Secure DIO */ -#define RPL_CODE_SEC_DAO 0x82 /* Secure DAO */ -#define RPL_CODE_SEC_DAO_ACK 0x83 /* Secure DAO-ACK */ - -/* RPL control message options. */ -#define RPL_OPTION_PAD1 0 -#define RPL_OPTION_PADN 1 -#define RPL_OPTION_DAG_METRIC_CONTAINER 2 -#define RPL_OPTION_ROUTE_INFO 3 -#define RPL_OPTION_DAG_CONF 4 -#define RPL_OPTION_TARGET 5 -#define RPL_OPTION_TRANSIT 6 -#define RPL_OPTION_SOLICITED_INFO 7 -#define RPL_OPTION_PREFIX_INFO 8 -#define RPL_OPTION_TARGET_DESC 9 - -#define RPL_DAO_K_FLAG 0x80 /* DAO-ACK requested */ -#define RPL_DAO_D_FLAG 0x40 /* DODAG ID present */ - -#define RPL_DAO_ACK_UNCONDITIONAL_ACCEPT 0 -#define RPL_DAO_ACK_ACCEPT 1 /* 1 - 127 is OK but not good */ -#define RPL_DAO_ACK_UNABLE_TO_ACCEPT 128 /* >127 is fail */ -#define RPL_DAO_ACK_UNABLE_TO_ADD_ROUTE_AT_ROOT 255 /* root can not accept */ -#define RPL_DAO_ACK_TIMEOUT -1 - -/*---------------------------------------------------------------------------*/ -/* RPL IPv6 extension header option. */ -#define RPL_HDR_OPT_LEN 4 -#define RPL_HOP_BY_HOP_LEN (RPL_HDR_OPT_LEN + 2 + 2) -#define RPL_RH_LEN 4 -#define RPL_SRH_LEN 4 -#define RPL_RH_TYPE_SRH 3 -#define RPL_HDR_OPT_DOWN 0x80 -#define RPL_HDR_OPT_DOWN_SHIFT 7 -#define RPL_HDR_OPT_RANK_ERR 0x40 -#define RPL_HDR_OPT_RANK_ERR_SHIFT 6 -#define RPL_HDR_OPT_FWD_ERR 0x20 -#define RPL_HDR_OPT_FWD_ERR_SHIFT 5 - -/*---------------------------------------------------------------------------*/ -#define RPL_INSTANCE_LOCAL_FLAG 0x80 -#define RPL_INSTANCE_D_FLAG 0x40 - -/* Values that tell where a route came from. */ -#define RPL_ROUTE_FROM_INTERNAL 0 -#define RPL_ROUTE_FROM_UNICAST_DAO 1 -#define RPL_ROUTE_FROM_MULTICAST_DAO 2 -#define RPL_ROUTE_FROM_DIO 3 - -/* DAG Mode of Operation */ -#define RPL_MOP_NO_DOWNWARD_ROUTES 0 -#define RPL_MOP_NON_STORING 1 -#define RPL_MOP_STORING_NO_MULTICAST 2 -#define RPL_MOP_STORING_MULTICAST 3 - - /** @} */ - -#endif /* RPL_CONST_H */ diff --git a/os/net/routing/rpl-lite/rpl-dag-root.c b/os/net/routing/rpl-lite/rpl-dag-root.c deleted file mode 100644 index 38f5697e7..000000000 --- a/os/net/routing/rpl-lite/rpl-dag-root.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2012-2014, Thingsquare, http://www.thingsquare.com/. - * 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. - * - */ - -/** -* \addtogroup rpl-lite -* @{ -* -* \file -* DAG root utility functions for RPL. -*/ - -#include "contiki.h" -#include "contiki-net.h" - -#include "net/routing/rpl-lite/rpl.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/ipv6/uip-sr.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/*---------------------------------------------------------------------------*/ -void -rpl_dag_root_print_links(const char *str) -{ - if(rpl_dag_root_is_root()) { - if(uip_sr_num_nodes() > 0) { - uip_sr_node_t *link; - /* Our routing links */ - LOG_INFO("links: %u routing links in total (%s)\n", uip_sr_num_nodes(), str); - link = uip_sr_node_head(); - while(link != NULL) { - char buf[100]; - uip_sr_link_snprint(buf, sizeof(buf), link); - LOG_INFO("links: %s\n", buf); - link = uip_sr_node_next(link); - } - LOG_INFO("links: end of list\n"); - } else { - LOG_INFO("No routing links\n"); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -set_global_address(uip_ipaddr_t *prefix, uip_ipaddr_t *iid) -{ - static uip_ipaddr_t root_ipaddr; - const uip_ipaddr_t *default_prefix; - int i; - uint8_t state; - - default_prefix = uip_ds6_default_prefix(); - - /* Assign a unique local address (RFC4193, - http://tools.ietf.org/html/rfc4193). */ - if(prefix == NULL) { - uip_ip6addr_copy(&root_ipaddr, default_prefix); - } else { - memcpy(&root_ipaddr, prefix, 8); - } - if(iid == NULL) { - uip_ds6_set_addr_iid(&root_ipaddr, &uip_lladdr); - } else { - memcpy(((uint8_t*)&root_ipaddr) + 8, ((uint8_t*)iid) + 8, 8); - } - - uip_ds6_addr_add(&root_ipaddr, 0, ADDR_AUTOCONF); - - LOG_INFO("IPv6 addresses:\n"); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - LOG_INFO("-- "); - LOG_INFO_6ADDR(&uip_ds6_if.addr_list[i].ipaddr); - LOG_INFO_("\n"); - } - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_dag_root_set_prefix(uip_ipaddr_t *prefix, uip_ipaddr_t *iid) -{ - static uint8_t initialized = 0; - - if(!initialized) { - set_global_address(prefix, iid); - initialized = 1; - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_dag_root_start(void) -{ - struct uip_ds6_addr *root_if; - int i; - uint8_t state; - uip_ipaddr_t *ipaddr = NULL; - - rpl_dag_root_set_prefix(NULL, NULL); - - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - state == ADDR_PREFERRED && - !uip_is_addr_linklocal(&uip_ds6_if.addr_list[i].ipaddr)) { - ipaddr = &uip_ds6_if.addr_list[i].ipaddr; - } - } - - root_if = uip_ds6_addr_lookup(ipaddr); - if(ipaddr != NULL || root_if != NULL) { - - rpl_dag_init_root(RPL_DEFAULT_INSTANCE, ipaddr, - (uip_ipaddr_t *)rpl_get_global_address(), 64, UIP_ND6_RA_FLAG_AUTONOMOUS); - rpl_dag_update_state(); - - LOG_INFO("created a new RPL DAG\n"); - return 0; - } else { - LOG_ERR("failed to create a new RPL DAG\n"); - return -1; - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_dag_root_is_root(void) -{ - return curr_instance.used && curr_instance.dag.rank == ROOT_RANK; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/routing/rpl-lite/rpl-dag-root.h b/os/net/routing/rpl-lite/rpl-dag-root.h deleted file mode 100644 index f035e8595..000000000 --- a/os/net/routing/rpl-lite/rpl-dag-root.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2012-2014, Thingsquare, http://www.thingsquare.com/. - * 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 RPL_DAG_ROOT_H_ -#define RPL_DAG_ROOT_H_ - -/** -* \addtogroup rpl-lite -* @{ -* -* \file -* DAG root utility functions for RPL. -*/ - -/********** Public functions **********/ - -/** - * Set a prefix in case the node is later set as dag root. - * - * \param prefix The prefix. If NULL, uip_ds6_default_prefix() is used instead - * \param iid The IID. If NULL, it will be built from uip_ds6_set_addr_iid. -*/ -void rpl_dag_root_set_prefix(uip_ipaddr_t *prefix, uip_ipaddr_t *iid); - -/** - * Set the node as root and start a DAG - * - * \return 0 in case of success, -1 otherwise -*/ -int rpl_dag_root_start(void); - -/** - * Tells whether we are DAG root or not - * - * \return 1 if we are dag root, 0 otherwise -*/ -int rpl_dag_root_is_root(void); -/** - * Prints a summary of all routing links - * - * \param str A descriptive text on the caller -*/ -void rpl_dag_root_print_links(const char *str); - - /** @} */ - -#endif /* RPL_DAG_ROOT_H_ */ diff --git a/os/net/routing/rpl-lite/rpl-dag.c b/os/net/routing/rpl-lite/rpl-dag.c deleted file mode 100644 index 5ec080c15..000000000 --- a/os/net/routing/rpl-lite/rpl-dag.c +++ /dev/null @@ -1,760 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * Logic for Directed Acyclic Graphs in RPL. - * - * \author Joakim Eriksson , Nicolas Tsiftes , - * Simon Duquennoy - * Contributors: George Oikonomou (multicast) - */ - -#include "net/routing/rpl-lite/rpl.h" -#include "net/ipv6/uip-sr.h" -#include "net/nbr-table.h" -#include "net/link-stats.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/*---------------------------------------------------------------------------*/ -extern rpl_of_t rpl_of0, rpl_mrhof; -static rpl_of_t * const objective_functions[] = RPL_SUPPORTED_OFS; -static int init_dag_from_dio(rpl_dio_t *dio); - -/*---------------------------------------------------------------------------*/ -/* Allocate instance table. */ -rpl_instance_t curr_instance; - -/*---------------------------------------------------------------------------*/ - -#ifdef RPL_VALIDATE_DIO_FUNC -int RPL_VALIDATE_DIO_FUNC(rpl_dio_t *dio); -#endif /* RPL_PROBING_SELECT_FUNC */ - -/*---------------------------------------------------------------------------*/ -const char * -rpl_dag_state_to_str(enum rpl_dag_state state) -{ - switch(state) { - case DAG_INITIALIZED: - return "initialized"; - case DAG_JOINED: - return "joined"; - case DAG_REACHABLE: - return "reachable"; - case DAG_POISONING: - return "poisoning"; - default: - return "unknown"; - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_dag_get_root_ipaddr(uip_ipaddr_t *ipaddr) -{ - if(curr_instance.used && ipaddr != NULL) { - uip_ipaddr_copy(ipaddr, &curr_instance.dag.dag_id); - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -rpl_dag_leave(void) -{ - LOG_INFO("leaving DAG "); - LOG_INFO_6ADDR(&curr_instance.dag.dag_id); - LOG_INFO_(", instance %u\n", curr_instance.instance_id); - - /* Issue a no-path DAO */ - if(!rpl_dag_root_is_root()) { - RPL_LOLLIPOP_INCREMENT(curr_instance.dag.dao_last_seqno); - rpl_icmp6_dao_output(0); - } - - /* Forget past link statistics */ - link_stats_reset(); - - /* Remove all neighbors and lnks */ - rpl_neighbor_remove_all(); - uip_sr_free_all(); - - /* Stop all timers */ - rpl_timers_stop_dag_timers(); - - /* Remove autoconfigured address */ - if((curr_instance.dag.prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS)) { - rpl_reset_prefix(&curr_instance.dag.prefix_info); - } - - /* Mark instance as unused */ - curr_instance.used = 0; -} -/*---------------------------------------------------------------------------*/ -void -rpl_dag_poison_and_leave(void) -{ - curr_instance.dag.state = DAG_POISONING; - rpl_timers_schedule_state_update(); -} -/*---------------------------------------------------------------------------*/ -void -rpl_dag_periodic(unsigned seconds) -{ - if(curr_instance.used) { - if(curr_instance.dag.lifetime != RPL_LIFETIME(RPL_INFINITE_LIFETIME)) { - curr_instance.dag.lifetime = - curr_instance.dag.lifetime > seconds ? curr_instance.dag.lifetime - seconds : 0; - if(curr_instance.dag.lifetime == 0) { - LOG_WARN("DAG expired, poison and leave\n"); - curr_instance.dag.state = DAG_POISONING; - rpl_timers_schedule_state_update(); - } else if(curr_instance.dag.lifetime < 300 && curr_instance.dag.preferred_parent != NULL) { - /* Five minutes before expiring, start sending unicast DIS to get an update */ - LOG_WARN("DAG expiring in %u seconds, send DIS to preferred parent\n", (unsigned)curr_instance.dag.lifetime); - rpl_icmp6_dis_output(rpl_neighbor_get_ipaddr(curr_instance.dag.preferred_parent)); - } - } - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_is_addr_in_our_dag(const uip_ipaddr_t *addr) -{ - return curr_instance.used - && uip_ipaddr_prefixcmp(&curr_instance.dag.dag_id, addr, curr_instance.dag.prefix_info.length); -} -/*---------------------------------------------------------------------------*/ -rpl_instance_t * -rpl_get_default_instance(void) -{ - return curr_instance.used ? &curr_instance : NULL; -} -/*---------------------------------------------------------------------------*/ -rpl_dag_t * -rpl_get_any_dag(void) -{ - return curr_instance.used ? &curr_instance.dag : NULL; -} -/*---------------------------------------------------------------------------*/ -static rpl_of_t * -find_objective_function(rpl_ocp_t ocp) -{ - unsigned int i; - for(i = 0; i < sizeof(objective_functions) / sizeof(objective_functions[0]); i++) { - if(objective_functions[i]->ocp == ocp) { - return objective_functions[i]; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -void -rpl_refresh_routes(const char *str) -{ - if(rpl_dag_root_is_root()) { - /* Increment DTSN */ - RPL_LOLLIPOP_INCREMENT(curr_instance.dtsn_out); - - LOG_WARN("incremented DTSN (%s), current %u\n", - str, curr_instance.dtsn_out); - if(LOG_INFO_ENABLED) { - rpl_neighbor_print_list("Refresh routes (before)"); - } - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_global_repair(const char *str) -{ - if(rpl_dag_root_is_root()) { - RPL_LOLLIPOP_INCREMENT(curr_instance.dag.version); /* New DAG version */ - curr_instance.dtsn_out = RPL_LOLLIPOP_INIT; /* Re-initialize DTSN */ - - LOG_WARN("initiating global repair (%s), version %u, rank %u\n", - str, curr_instance.dag.version, curr_instance.dag.rank); - if(LOG_INFO_ENABLED) { - rpl_neighbor_print_list("Global repair (before)"); - } - - /* Now do a local repair to disseminate the new version */ - rpl_local_repair("Global repair"); - } -} -/*---------------------------------------------------------------------------*/ -static void -global_repair_non_root(rpl_dio_t *dio) -{ - if(!rpl_dag_root_is_root()) { - LOG_WARN("participating in global repair, version %u, rank %u\n", - dio->version, curr_instance.dag.rank); - if(LOG_INFO_ENABLED) { - rpl_neighbor_print_list("Global repair (before)"); - } - /* Re-initialize configuration from DIO */ - rpl_timers_stop_dag_timers(); - init_dag_from_dio(dio); - rpl_local_repair("Global repair"); - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_local_repair(const char *str) -{ - if(curr_instance.used) { /* Check needed because this is a public function */ - LOG_WARN("local repair (%s)\n", str); - if(!rpl_dag_root_is_root()) { - curr_instance.dag.state = DAG_INITIALIZED; /* Reset DAG state */ - } - curr_instance.of->reset(); /* Reset OF */ - rpl_neighbor_remove_all(); /* Remove all neighbors */ - rpl_timers_dio_reset("Local repair"); /* Reset Trickle timer */ - rpl_timers_schedule_state_update(); - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_dag_ready_to_advertise(void) -{ - if(curr_instance.mop == RPL_MOP_NO_DOWNWARD_ROUTES) { - return curr_instance.used && curr_instance.dag.state >= DAG_INITIALIZED; - } else { - return curr_instance.used && curr_instance.dag.state >= DAG_REACHABLE; - } -} -/*---------------------------------------------------------------------------*/ -/* Updates rank and parent */ -void -rpl_dag_update_state(void) -{ - rpl_rank_t old_rank; - - if(!curr_instance.used) { - return; - } - - old_rank = curr_instance.dag.rank; - /* Any scheduled state update is no longer needed */ - rpl_timers_unschedule_state_update(); - - if(curr_instance.dag.state == DAG_POISONING) { - rpl_neighbor_set_preferred_parent(NULL); - curr_instance.dag.rank = RPL_INFINITE_RANK; - if(old_rank != RPL_INFINITE_RANK) { - /* Advertise that we are leaving, and leave after a delay */ - LOG_WARN("poisoning and leaving after a delay\n"); - rpl_timers_dio_reset("Poison routes"); - rpl_timers_schedule_leaving(); - } - } else if(!rpl_dag_root_is_root()) { - rpl_nbr_t *old_parent = curr_instance.dag.preferred_parent; - rpl_nbr_t *nbr; - - /* Select and set preferred parent */ - rpl_neighbor_set_preferred_parent(rpl_neighbor_select_best()); - /* Update rank */ - curr_instance.dag.rank = rpl_neighbor_rank_via_nbr(curr_instance.dag.preferred_parent); - - /* Update better_parent_since flag for each neighbor */ - nbr = nbr_table_head(rpl_neighbors); - while(nbr != NULL) { - if(rpl_neighbor_rank_via_nbr(nbr) < curr_instance.dag.rank) { - /* This neighbor would be a better parent than our current. - Set 'better_parent_since' if not already set. */ - if(nbr->better_parent_since == 0) { - nbr->better_parent_since = clock_time(); /* Initialize */ - } - } else { - nbr->better_parent_since = 0; /* Not a better parent */ - } - nbr = nbr_table_next(rpl_neighbors, nbr); - } - - if(old_parent == NULL || curr_instance.dag.rank < curr_instance.dag.lowest_rank) { - /* This is a slight departure from RFC6550: if we had no preferred parent before, - * reset lowest_rank. This helps recovering from temporary bad link conditions. */ - curr_instance.dag.lowest_rank = curr_instance.dag.rank; - } - - /* Reset DIO timer in case of significant rank update */ - if(curr_instance.dag.last_advertised_rank != RPL_INFINITE_RANK - && curr_instance.dag.rank != RPL_INFINITE_RANK - && ABS((int32_t)curr_instance.dag.rank - curr_instance.dag.last_advertised_rank) > RPL_SIGNIFICANT_CHANGE_THRESHOLD) { - LOG_WARN("significant rank update %u->%u\n", - curr_instance.dag.last_advertised_rank, curr_instance.dag.rank); - /* Update already here to avoid multiple resets in a row */ - curr_instance.dag.last_advertised_rank = curr_instance.dag.rank; - rpl_timers_dio_reset("Significant rank update"); - } - - /* Parent switch */ - if(curr_instance.dag.preferred_parent != old_parent) { - /* We just got a parent (was NULL), reset trickle timer to advertise this */ - if(old_parent == NULL) { - curr_instance.dag.state = DAG_JOINED; - rpl_timers_dio_reset("Got parent"); - LOG_WARN("found parent: "); - LOG_WARN_6ADDR(rpl_neighbor_get_ipaddr(curr_instance.dag.preferred_parent)); - LOG_WARN_(", staying in DAG\n"); - rpl_timers_unschedule_leaving(); - } - - /* Schedule a DAO */ - if(curr_instance.dag.preferred_parent != NULL) { - rpl_timers_schedule_dao(); - } else { - /* We have no more parent, schedule DIS to get a chance to hear updated state */ - curr_instance.dag.state = DAG_INITIALIZED; - LOG_WARN("no parent, scheduling periodic DIS, will leave if no parent is found\n"); - rpl_timers_dio_reset("Poison routes"); - rpl_timers_schedule_periodic_dis(); - rpl_timers_schedule_leaving(); - } - - if(LOG_INFO_ENABLED) { - rpl_neighbor_print_list("Parent switch"); - } - } - } - - /* Finally, update metric container */ - curr_instance.of->update_metric_container(); -} -/*---------------------------------------------------------------------------*/ -static rpl_nbr_t * -update_nbr_from_dio(uip_ipaddr_t *from, rpl_dio_t *dio) -{ - rpl_nbr_t *nbr = NULL; - const uip_lladdr_t *lladdr; - - nbr = rpl_neighbor_get_from_ipaddr(from); - /* Neighbor not in RPL neighbor table, add it */ - if(nbr == NULL) { - /* Is the neighbor known by ds6? Drop this request if not. - * Typically, the neighbor is added upon receiving a DIO. */ - lladdr = uip_ds6_nbr_lladdr_from_ipaddr(from); - if(lladdr == NULL) { - return NULL; - } - - /* Add neighbor to RPL table */ - nbr = nbr_table_add_lladdr(rpl_neighbors, (linkaddr_t *)lladdr, - NBR_TABLE_REASON_RPL_DIO, dio); - if(nbr == NULL) { - LOG_ERR("failed to add neighbor\n"); - return NULL; - } - } - - /* Update neighbor info from DIO */ - nbr->rank = dio->rank; - nbr->dtsn = dio->dtsn; -#if RPL_WITH_MC - memcpy(&nbr->mc, &dio->mc, sizeof(nbr->mc)); -#endif /* RPL_WITH_MC */ - - return nbr; -} -/*---------------------------------------------------------------------------*/ -static void -process_dio_from_current_dag(uip_ipaddr_t *from, rpl_dio_t *dio) -{ - rpl_nbr_t *nbr; - uint8_t last_dtsn; - - /* Does the rank make sense at all? */ - if(dio->rank < ROOT_RANK) { - return; - } - - /* If the DIO sender is on an older version of the DAG, do not process it - * further. The sender will eventually hear the global repair and catch up. */ - if(rpl_lollipop_greater_than(curr_instance.dag.version, dio->version)) { - if(dio->rank == ROOT_RANK) { - /* Before returning, if the DIO was from the root, an old DAG versions - * likely incidates a root reboot. Reset our DIO timer to make sure the - * root hears our version ASAP, and in turn triggers a global repair. */ - rpl_timers_dio_reset("Heard old version from root"); - } - return; - } - - /* The DIO is valid, proceed further */ - - /* Update DIO counter for redundancy mngt */ - if(dio->rank != RPL_INFINITE_RANK) { - curr_instance.dag.dio_counter++; - } - - /* The DIO has a newer version: global repair. - * Must come first, as it might remove all neighbors, and we then need - * to re-add this source of the DIO to the neighbor table */ - if(rpl_lollipop_greater_than(dio->version, curr_instance.dag.version)) { - if(curr_instance.dag.rank == ROOT_RANK) { - /* The root should not hear newer versions unless it just rebooted */ - LOG_ERR("inconsistent DIO version (current: %u, received: %u), initiate global repair\n", - curr_instance.dag.version, dio->version); - /* Update version and trigger global repair */ - curr_instance.dag.version = dio->version; - rpl_global_repair("Inconsistent DIO version"); - } else { - LOG_WARN("new DIO version (current: %u, received: %u), apply global repair\n", - curr_instance.dag.version, dio->version); - global_repair_non_root(dio); - } - } - - /* Update IPv6 neighbor cache */ - if(!rpl_icmp6_update_nbr_table(from, NBR_TABLE_REASON_RPL_DIO, dio)) { - LOG_ERR("IPv6 cache full, dropping DIO\n"); - return; - } - - /* Add neighbor to RPL neighbor table */ - nbr = rpl_neighbor_get_from_ipaddr(from); - last_dtsn = nbr != NULL ? nbr->dtsn : RPL_LOLLIPOP_INIT; - - if(!update_nbr_from_dio(from, dio)) { - LOG_ERR("neighbor table full, dropping DIO\n"); - return; - } - - /* Init lifetime if not set yet. Refresh it at every DIO from preferred parent. */ - if(curr_instance.dag.lifetime == 0 || - (nbr != NULL && nbr == curr_instance.dag.preferred_parent)) { - LOG_INFO("refreshing lifetime\n"); - curr_instance.dag.lifetime = RPL_LIFETIME(RPL_DAG_LIFETIME); - } - - /* If the source is our preferred parent and it increased DTSN, we increment - * our DTSN in turn and schedule a DAO (see RFC6550 section 9.6.) */ - if(curr_instance.mop != RPL_MOP_NO_DOWNWARD_ROUTES) { - if(nbr != NULL && nbr == curr_instance.dag.preferred_parent && rpl_lollipop_greater_than(dio->dtsn, last_dtsn)) { - RPL_LOLLIPOP_INCREMENT(curr_instance.dtsn_out); - LOG_WARN("DTSN increment %u->%u, schedule new DAO with DTSN %u\n", - last_dtsn, dio->dtsn, curr_instance.dtsn_out); - rpl_timers_schedule_dao(); - } - } -} -/*---------------------------------------------------------------------------*/ -static int -init_dag(uint8_t instance_id, uip_ipaddr_t *dag_id, rpl_ocp_t ocp, - uip_ipaddr_t *prefix, unsigned prefix_len, uint8_t prefix_flags) -{ - rpl_of_t *of; - - memset(&curr_instance, 0, sizeof(curr_instance)); - - /* OF */ - of = find_objective_function(ocp); - if(of == NULL) { - LOG_ERR("ignoring DIO with an unsupported OF: %u\n", ocp); - return 0; - } - - /* Prefix */ - if(!rpl_set_prefix_from_addr(prefix, prefix_len, prefix_flags)) { - LOG_ERR("failed to set prefix\n"); - return 0; - } - - /* Instnace */ - curr_instance.instance_id = instance_id; - curr_instance.of = of; - curr_instance.dtsn_out = RPL_LOLLIPOP_INIT; - curr_instance.used = 1; - - /* DAG */ - curr_instance.dag.rank = RPL_INFINITE_RANK; - curr_instance.dag.last_advertised_rank = RPL_INFINITE_RANK; - curr_instance.dag.lowest_rank = RPL_INFINITE_RANK; - curr_instance.dag.dao_last_seqno = RPL_LOLLIPOP_INIT; - curr_instance.dag.dao_last_acked_seqno = RPL_LOLLIPOP_INIT; - curr_instance.dag.dao_last_seqno = RPL_LOLLIPOP_INIT; - memcpy(&curr_instance.dag.dag_id, dag_id, sizeof(curr_instance.dag.dag_id)); - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -init_dag_from_dio(rpl_dio_t *dio) -{ - if(!init_dag(dio->instance_id, &dio->dag_id, dio->ocp, - &dio->prefix_info.prefix, dio->prefix_info.length, dio->prefix_info.flags)) { - return 0; - } - - /* Instnace */ - curr_instance.mop = dio->mop; - curr_instance.mc.type = dio->mc.type; - curr_instance.mc.flags = dio->mc.flags; - curr_instance.mc.aggr = dio->mc.aggr; - curr_instance.mc.prec = dio->mc.prec; - curr_instance.max_rankinc = dio->dag_max_rankinc; - curr_instance.min_hoprankinc = dio->dag_min_hoprankinc; - curr_instance.dio_intdoubl = dio->dag_intdoubl; - curr_instance.dio_intmin = dio->dag_intmin; - curr_instance.dio_redundancy = dio->dag_redund; - curr_instance.default_lifetime = dio->default_lifetime; - curr_instance.lifetime_unit = dio->lifetime_unit; - - /* DAG */ - curr_instance.dag.state = DAG_INITIALIZED; - curr_instance.dag.preference = dio->preference; - curr_instance.dag.grounded = dio->grounded; - curr_instance.dag.version = dio->version; - curr_instance.dag.dio_intcurrent = dio->dag_intmin; - - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -process_dio_init_dag(uip_ipaddr_t *from, rpl_dio_t *dio) -{ -#ifdef RPL_VALIDATE_DIO_FUNC - if(!RPL_VALIDATE_DIO_FUNC(dio)) { - LOG_WARN("DIO validation failed\n"); - return 0; - } -#endif - - /* Check MOP */ - if(dio->mop != RPL_MOP_NO_DOWNWARD_ROUTES && dio->mop != RPL_MOP_NON_STORING) { - LOG_WARN("ignoring DIO with an unsupported MOP: %d\n", dio->mop); - return 0; - } - - /* Initialize instance and DAG data structures */ - if(!init_dag_from_dio(dio)) { - LOG_WARN("failed to initialize DAG\n"); - return 0; - } - - /* Init OF and timers */ - curr_instance.of->reset(); - rpl_timers_dio_reset("Join"); -#if RPL_WITH_PROBING - rpl_schedule_probing(); -#endif /* RPL_WITH_PROBING */ - /* Leave the network after RPL_DELAY_BEFORE_LEAVING in case we do not - find a parent */ - LOG_INFO("initialized DAG with instance ID %u, DAG ID ", - curr_instance.instance_id); - LOG_INFO_6ADDR(&curr_instance.dag.dag_id); - LOG_INFO_(", prexix "); - LOG_INFO_6ADDR(&dio->prefix_info.prefix); - LOG_INFO_("/%u, rank %u\n", dio->prefix_info.length, curr_instance.dag.rank); - - LOG_ANNOTATE("#A init=%u\n", curr_instance.dag.dag_id.u8[sizeof(curr_instance.dag.dag_id) - 1]); - - LOG_WARN("just joined, no parent yet, setting timer for leaving\n"); - rpl_timers_schedule_leaving(); - - return 1; -} -/*---------------------------------------------------------------------------*/ -void -rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio) -{ - if(!curr_instance.used && !rpl_dag_root_is_root()) { - /* Attempt to init our DAG from this DIO */ - if(!process_dio_init_dag(from, dio)) { - LOG_WARN("failed to init DAG\n"); - return; - } - } - - if(curr_instance.used - && curr_instance.instance_id == dio->instance_id - && uip_ipaddr_cmp(&curr_instance.dag.dag_id, &dio->dag_id)) { - process_dio_from_current_dag(from, dio); - rpl_dag_update_state(); - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_process_dis(uip_ipaddr_t *from, int is_multicast) -{ - if(is_multicast) { - rpl_timers_dio_reset("Multicast DIS"); - } else { - /* Add neighbor to cache and reply to the unicast DIS with a unicast DIO*/ - if(rpl_icmp6_update_nbr_table(from, NBR_TABLE_REASON_RPL_DIS, NULL) != NULL) { - LOG_INFO("unicast DIS, reply to sender\n"); - rpl_icmp6_dio_output(from); - } - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_process_dao(uip_ipaddr_t *from, rpl_dao_t *dao) -{ - if(dao->lifetime == 0) { - uip_sr_expire_parent(NULL, from, &dao->parent_addr); - } else { - if(!uip_sr_update_node(NULL, from, &dao->parent_addr, RPL_LIFETIME(dao->lifetime))) { - LOG_ERR("failed to add link on incoming DAO\n"); - return; - } - } - -#if RPL_WITH_DAO_ACK - if(dao->flags & RPL_DAO_K_FLAG) { - rpl_timers_schedule_dao_ack(from, dao->sequence); - } -#endif /* RPL_WITH_DAO_ACK */ -} -/*---------------------------------------------------------------------------*/ -#if RPL_WITH_DAO_ACK -void -rpl_process_dao_ack(uint8_t sequence, uint8_t status) -{ - /* Update dao_last_acked_seqno */ - if(rpl_lollipop_greater_than(sequence, curr_instance.dag.dao_last_acked_seqno)) { - curr_instance.dag.dao_last_acked_seqno = sequence; - } - /* Is this an ACK for our last DAO? */ - if(sequence == curr_instance.dag.dao_last_seqno) { - int status_ok = status < RPL_DAO_ACK_UNABLE_TO_ACCEPT; - if(curr_instance.dag.state == DAG_JOINED && status_ok) { - curr_instance.dag.state = DAG_REACHABLE; - rpl_timers_dio_reset("Reachable"); - } - /* Let the rpl-timers module know that we got an ACK for the last DAO */ - rpl_timers_notify_dao_ack(); - - if(!status_ok) { - /* We got a NACK, start poisoning and leave */ - LOG_WARN("DAO-NACK received with seqno %u, status %u, poison and leave\n", - sequence, status); - curr_instance.dag.state = DAG_POISONING; - } - } -} -#endif /* RPL_WITH_DAO_ACK */ -/*---------------------------------------------------------------------------*/ -int -rpl_process_hbh(rpl_nbr_t *sender, uint16_t sender_rank, int loop_detected, int rank_error_signaled) -{ - int drop = 0; - - if(loop_detected) { - if(rank_error_signaled) { -#if RPL_LOOP_ERROR_DROP - /* Drop packet and reset trickle timer, as per RFC6550 - 11.2.2.2 */ - rpl_timers_dio_reset("HBH error"); - LOG_WARN("rank error and loop detected, dropping\n"); - drop = 1; -#endif /* RPL_LOOP_ERROR_DROP */ - } - /* Attempt to repair the loop by sending a unicast DIO back to the sender - * so that it gets a fresh update of our rank. */ - rpl_timers_schedule_unicast_dio(sender); - } - - if(rank_error_signaled) { - /* A rank error was signalled, attempt to repair it by updating - * the sender's rank from ext header */ - if(sender != NULL) { - sender->rank = sender_rank; - /* Select DAG and preferred parent. In case of a parent switch, - the new parent will be used to forward the current packet. */ - rpl_dag_update_state(); - } - } - - return !drop; -} -/*---------------------------------------------------------------------------*/ -void -rpl_dag_init_root(uint8_t instance_id, uip_ipaddr_t *dag_id, - uip_ipaddr_t *prefix, unsigned prefix_len, uint8_t prefix_flags) -{ - uint8_t version = RPL_LOLLIPOP_INIT; - - /* If we're in an instance, first leave it */ - if(curr_instance.used) { - /* We were already root. Increment version */ - if(uip_ipaddr_cmp(&curr_instance.dag.dag_id, dag_id)) { - version = curr_instance.dag.version; - RPL_LOLLIPOP_INCREMENT(version); - } - rpl_dag_leave(); - } - - /* Init DAG and instance */ - init_dag(instance_id, dag_id, RPL_OF_OCP, prefix, prefix_len, prefix_flags); - - /* Instance */ - curr_instance.mop = RPL_MOP_DEFAULT; - curr_instance.max_rankinc = RPL_MAX_RANKINC; - curr_instance.min_hoprankinc = RPL_MIN_HOPRANKINC; - curr_instance.dio_intdoubl = RPL_DIO_INTERVAL_DOUBLINGS; - curr_instance.dio_intmin = RPL_DIO_INTERVAL_MIN; - curr_instance.dio_redundancy = RPL_DIO_REDUNDANCY; - curr_instance.default_lifetime = RPL_DEFAULT_LIFETIME; - curr_instance.lifetime_unit = RPL_DEFAULT_LIFETIME_UNIT; - - /* DAG */ - curr_instance.dag.preference = RPL_PREFERENCE; - curr_instance.dag.grounded = RPL_GROUNDED; - curr_instance.dag.version = version; - curr_instance.dag.rank = ROOT_RANK; - curr_instance.dag.lifetime = RPL_LIFETIME(RPL_INFINITE_LIFETIME); - curr_instance.dag.dio_intcurrent = RPL_DIO_INTERVAL_MIN; - curr_instance.dag.state = DAG_REACHABLE; - - rpl_timers_dio_reset("Init root"); - - LOG_INFO("created DAG with instance ID %u, DAG ID ", - curr_instance.instance_id); - LOG_INFO_6ADDR(&curr_instance.dag.dag_id); - LOG_INFO_(", rank %u\n", curr_instance.dag.rank); - - LOG_ANNOTATE("#A root=%u\n", curr_instance.dag.dag_id.u8[sizeof(curr_instance.dag.dag_id) - 1]); -} -/*---------------------------------------------------------------------------*/ -void -rpl_dag_init(void) -{ - memset(&curr_instance, 0, sizeof(curr_instance)); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/net/routing/rpl-lite/rpl-dag.h b/os/net/routing/rpl-lite/rpl-dag.h deleted file mode 100644 index f9ae66f5f..000000000 --- a/os/net/routing/rpl-lite/rpl-dag.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * Header file for rpl-dag module - * \author - * Joakim Eriksson , Nicolas Tsiftes , - * Simon DUquennoy - * - */ - -#ifndef RPL_DAG_H -#define RPL_DAG_H - -/********** Includes **********/ - -#include "uip.h" - -/********** Public functions **********/ - -/** - * Returns a textual description of the current DAG state - * - * \param state The DAG state - * \return The description string -*/ -const char *rpl_dag_state_to_str(enum rpl_dag_state state); -/** - * Returns the IPv6 address of the RPL DAG root, if any - * - * \param ipaddr A pointer where to copy the IP address of the DAG root - * \return 1 if the root address was copied, 0 otherwise -*/ -int rpl_dag_get_root_ipaddr(uip_ipaddr_t *ipaddr); -/** - * Start poisoning and leave the DAG after a delay - * -*/ -void rpl_dag_poison_and_leave(void); -/** - * Leaves the current DAG - * -*/ -void rpl_dag_leave(void); -/** - * A function called periodically. Used to age the DAG (decrease lifetime - * and expire DAG accordingly) - * - * \param seconds The number of seconds elapsted since last call -*/ -void rpl_dag_periodic(unsigned seconds); - -/** - * Triggers a RPL global repair - * - * \param str A textual description of the cause for triggering a repair -*/ -void rpl_global_repair(const char *str); - -/** - * Triggers a RPL local repair - * - * \param str A textual description of the cause for triggering a repair -*/ -void rpl_local_repair(const char *str); - -/** - * Tells whether a given global IPv6 address is in our current DAG - * - * \param addr The global IPv6 address to be tested - * \return 1 if addr is in our current DAG, 0 otherwise -*/ -int rpl_is_addr_in_our_dag(const uip_ipaddr_t *addr); - -/** - * Initializes DAG internal structure for a root node - * - * \param instance_id The instance ID - * \param dag_id The DAG ID - * \param prefix The prefix - * \param prefix_len The prefix length - * \param flags The prefix flags (from DIO) -*/ -void rpl_dag_init_root(uint8_t instance_id, uip_ipaddr_t *dag_id, - uip_ipaddr_t *prefix, unsigned prefix_len, uint8_t flags); - -/** - * Returns pointer to the default instance (for compatibility with legagy RPL code) - * - * \return A pointer to the only supported instance -*/ -rpl_instance_t *rpl_get_default_instance(void); - -/** - * Returns pointer to any DAG (for compatibility with legagy RPL code) - * - * \return A pointer to the only supported DAG -*/ -rpl_dag_t *rpl_get_any_dag(void); - -/** - * Processes Hop-by-Hop (HBH) Extension Header of a packet currently being forwrded. - * - * \param sender The IPv6 address of the originator - * \param sender_rank The rank advertised by the sender in the HBH header - * \param loop_detected 1 if we could detect a loop while forwarding, 0 otherwise - * \param rank_error_signaled 1 if the HBH header advertises a rank error, 0 otherwise - * \return 1 if the packet is to be forwarded, 0 if it is to be dropped -*/ -int rpl_process_hbh(rpl_nbr_t *sender, uint16_t sender_rank, int loop_detected, int rank_error_signaled); - -/** - * Processes incoming DIS - * - * \param from The IPv6 address of the originator - * \param is_multicast Set to 1 for multicast DIS, 0 for unicast DIS -*/ -void rpl_process_dis(uip_ipaddr_t *from, int is_multicast); - -/** - * Processes incoming DIO - * - * \param from The IPv6 address of the originator - * \param dio A pointer to a parsed DIO -*/ -void rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio); - -/** - * Processes incoming DAO - * - * \param from The IPv6 address of the originator - * \param dao A pointer to a parsed DAO -*/ -void rpl_process_dao(uip_ipaddr_t *from, rpl_dao_t *dao); - -/** - * Processes incoming DAO-ACK - * - * \param sequence The DAO-ACK sequence number - * \param status The DAO-ACK status (see RPL_DAO_ACK_* defines) -*/ -void rpl_process_dao_ack(uint8_t sequence, uint8_t status); - -/** - * Tells whether RPL is ready to advertise the DAG - * - * \return 1 is ready, 0 otherwise -*/ -int rpl_dag_ready_to_advertise(void); - -/** - * Updates RPL internal state: selects preferred parent, updates rank & metreic - * container, triggers control traffic accordingly and updates uIP6 internal state. -*/ -void rpl_dag_update_state(void); - -/** - * Initializes rpl-dag module -*/ -void rpl_dag_init(void); - - /** @} */ - -#endif /* RPL_DAG_H */ diff --git a/os/net/routing/rpl-lite/rpl-ext-header.c b/os/net/routing/rpl-lite/rpl-ext-header.c deleted file mode 100644 index cb8dcc190..000000000 --- a/os/net/routing/rpl-lite/rpl-ext-header.c +++ /dev/null @@ -1,489 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * Management of extension headers for ContikiRPL. - * - * \author Vincent Brillault , - * Joakim Eriksson , - * Niclas Finne , - * Nicolas Tsiftes , - * Simon Duquennoy - */ - -#include "net/routing/routing.h" -#include "net/routing/rpl-lite/rpl.h" -#include "net/ipv6/uip-sr.h" -#include "net/packetbuf.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/*---------------------------------------------------------------------------*/ -int -rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr) -{ - struct uip_routing_hdr *rh_header; - uip_sr_node_t *dest_node; - uip_sr_node_t *root_node; - - /* Look for routing ext header */ - rh_header = (struct uip_routing_hdr *)uipbuf_search_header(uip_buf, uip_len, UIP_PROTO_ROUTING); - - if(!rpl_is_addr_in_our_dag(&UIP_IP_BUF->destipaddr)) { - return 0; - } - - root_node = uip_sr_get_node(NULL, &curr_instance.dag.dag_id); - dest_node = uip_sr_get_node(NULL, &UIP_IP_BUF->destipaddr); - - if((rh_header != NULL && rh_header->routing_type == RPL_RH_TYPE_SRH) || - (dest_node != NULL && root_node != NULL && - dest_node->parent == root_node)) { - /* Routing header found or the packet destined for a direct child of the root. - * The next hop should be already copied as the IPv6 destination - * address, via rpl_ext_header_srh_update. We turn this address into a link-local to enable - * forwarding to next hop */ - uip_ipaddr_copy(ipaddr, &UIP_IP_BUF->destipaddr); - uip_create_linklocal_prefix(ipaddr); - return 1; - } - - LOG_DBG("no SRH found\n"); - return 0; -} -/*---------------------------------------------------------------------------*/ -int -rpl_ext_header_srh_update(void) -{ - struct uip_routing_hdr *rh_header; - struct uip_rpl_srh_hdr *srh_header; - uint8_t cmpri, cmpre; - uint8_t ext_len; - uint8_t padding; - uint8_t path_len; - uint8_t segments_left; - uip_ipaddr_t current_dest_addr; - - /* Look for routing ext header */ - rh_header = (struct uip_routing_hdr *)uipbuf_search_header(uip_buf, uip_len, UIP_PROTO_ROUTING); - - if(rh_header == NULL || rh_header->routing_type != RPL_RH_TYPE_SRH) { - LOG_INFO("SRH not found\n"); - return 0; - } - - /* Parse SRH */ - srh_header = (struct uip_rpl_srh_hdr *)(((uint8_t *)rh_header) + RPL_RH_LEN); - segments_left = rh_header->seg_left; - ext_len = rh_header->len * 8 + 8; - cmpri = srh_header->cmpr >> 4; - cmpre = srh_header->cmpr & 0x0f; - padding = srh_header->pad >> 4; - path_len = ((ext_len - padding - RPL_RH_LEN - RPL_SRH_LEN - (16 - cmpre)) / (16 - cmpri)) + 1; - (void)path_len; - - LOG_INFO("read SRH, path len %u, segments left %u, Cmpri %u, Cmpre %u, ext len %u (padding %u)\n", - path_len, segments_left, cmpri, cmpre, ext_len, padding); - - /* Update SRH in-place */ - if(segments_left == 0) { - /* We are the final destination, do nothing */ - } else { - uint8_t i = path_len - segments_left; /* The index of the next address to be visited */ - uint8_t *addr_ptr = ((uint8_t *)rh_header) + RPL_RH_LEN + RPL_SRH_LEN + (i * (16 - cmpri)); - uint8_t cmpr = segments_left == 1 ? cmpre : cmpri; - - /* As per RFC6554: swap the IPv6 destination address with address[i] */ - - /* First, copy the current IPv6 destination address */ - uip_ipaddr_copy(¤t_dest_addr, &UIP_IP_BUF->destipaddr); - /* Second, update the IPv6 destination address with addresses[i] */ - memcpy(((uint8_t *)&UIP_IP_BUF->destipaddr) + cmpr, addr_ptr, 16 - cmpr); - /* Third, write current_dest_addr to addresses[i] */ - memcpy(addr_ptr, ((uint8_t *)¤t_dest_addr) + cmpr, 16 - cmpr); - - /* Update segments left field */ - rh_header->seg_left--; - - LOG_INFO("SRH next hop "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_("\n"); - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -/* Utility function for SRH. Counts the number of bytes in common between - * two addresses at p1 and p2. */ -static int -count_matching_bytes(const void *p1, const void *p2, size_t n) -{ - int i = 0; - for(i = 0; i < n; i++) { - if(((uint8_t *)p1)[i] != ((uint8_t *)p2)[i]) { - return i; - } - } - return n; -} -/*---------------------------------------------------------------------------*/ -/* Used by rpl_ext_header_update to insert a RPL SRH extension header. This - * is used at the root, to initiate downward routing. Returns 1 on success, - * 0 on failure. -*/ -static int -insert_srh_header(void) -{ - /* Implementation of RFC6554 */ - uint8_t path_len; - uint8_t ext_len; - uint8_t cmpri, cmpre; /* ComprI and ComprE fields of the RPL Source Routing Header */ - uint8_t *hop_ptr; - uint8_t padding; - uip_sr_node_t *dest_node; - uip_sr_node_t *root_node; - uip_sr_node_t *node; - uip_ipaddr_t node_addr; - - /* Always insest SRH as first extension header */ - struct uip_routing_hdr *rh_hdr = (struct uip_routing_hdr *)UIP_IP_PAYLOAD(0); - struct uip_rpl_srh_hdr *srh_hdr = (struct uip_rpl_srh_hdr *)(UIP_IP_PAYLOAD(0) + RPL_RH_LEN); - - LOG_INFO("SRH creating source routing header with destination "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(" \n"); - - /* Construct source route. We do not do this recursively to keep the runtime stack usage constant. */ - - /* Get link of the destination and root */ - - if(!rpl_is_addr_in_our_dag(&UIP_IP_BUF->destipaddr)) { - /* The destination is not in our DAG, skip SRH insertion */ - LOG_INFO("SRH destination not in our DAG, skip SRH insertion\n"); - return 1; - } - - dest_node = uip_sr_get_node(NULL, &UIP_IP_BUF->destipaddr); - if(dest_node == NULL) { - /* The destination is not found, skip SRH insertion */ - LOG_INFO("SRH node not found, skip SRH insertion\n"); - return 1; - } - - root_node = uip_sr_get_node(NULL, &curr_instance.dag.dag_id); - if(root_node == NULL) { - LOG_ERR("SRH root node not found\n"); - return 0; - } - - if(!uip_sr_is_addr_reachable(NULL, &UIP_IP_BUF->destipaddr)) { - LOG_ERR("SRH no path found to destination\n"); - return 0; - } - - /* Compute path length and compression factors (we use cmpri == cmpre) */ - path_len = 0; - node = dest_node->parent; - /* For simplicity, we use cmpri = cmpre */ - cmpri = 15; - cmpre = 15; - - /* Note that in case of a direct child (node == root_node), we insert - SRH anyway, as RFC 6553 mandates that routed datagrams must include - SRH or the RPL option (or both) */ - - while(node != NULL && node != root_node) { - - NETSTACK_ROUTING.get_sr_node_ipaddr(&node_addr, node); - - /* How many bytes in common between all nodes in the path? */ - cmpri = MIN(cmpri, count_matching_bytes(&node_addr, &UIP_IP_BUF->destipaddr, 16)); - cmpre = cmpri; - - LOG_INFO("SRH Hop "); - LOG_INFO_6ADDR(&node_addr); - LOG_INFO_("\n"); - node = node->parent; - path_len++; - } - - /* Extension header length: fixed headers + (n-1) * (16-ComprI) + (16-ComprE)*/ - ext_len = RPL_RH_LEN + RPL_SRH_LEN - + (path_len - 1) * (16 - cmpre) - + (16 - cmpri); - - padding = ext_len % 8 == 0 ? 0 : (8 - (ext_len % 8)); - ext_len += padding; - - LOG_INFO("SRH path len: %u, ComprI %u, ComprE %u, ext len %u (padding %u)\n", - path_len, cmpri, cmpre, ext_len, padding); - - /* Check if there is enough space to store the extension header */ - if(uip_len + ext_len > UIP_LINK_MTU) { - LOG_ERR("packet too long: impossible to add source routing header (%u bytes)\n", ext_len); - return 0; - } - - /* Move existing ext headers and payload ext_len further */ - memmove(uip_buf + UIP_IPH_LEN + uip_ext_len + ext_len, - uip_buf + UIP_IPH_LEN + uip_ext_len, uip_len - UIP_IPH_LEN); - memset(uip_buf + UIP_IPH_LEN + uip_ext_len, 0, ext_len); - - /* Insert source routing header (as first ext header) */ - rh_hdr->next = UIP_IP_BUF->proto; - UIP_IP_BUF->proto = UIP_PROTO_ROUTING; - - /* Initialize IPv6 Routing Header */ - rh_hdr->len = (ext_len - 8) / 8; - rh_hdr->routing_type = RPL_RH_TYPE_SRH; - rh_hdr->seg_left = path_len; - - /* Initialize RPL Source Routing Header */ - srh_hdr->cmpr = (cmpri << 4) + cmpre; - srh_hdr->pad = padding << 4; - - /* Initialize addresses field (the actual source route). - * From last to first. */ - node = dest_node; - hop_ptr = ((uint8_t *)rh_hdr) + ext_len - padding; /* Pointer where to write the next hop compressed address */ - - while(node != NULL && node->parent != root_node) { - NETSTACK_ROUTING.get_sr_node_ipaddr(&node_addr, node); - - hop_ptr -= (16 - cmpri); - memcpy(hop_ptr, ((uint8_t*)&node_addr) + cmpri, 16 - cmpri); - - node = node->parent; - } - - /* The next hop (i.e. node whose parent is the root) is placed as the current IPv6 destination */ - NETSTACK_ROUTING.get_sr_node_ipaddr(&node_addr, node); - uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &node_addr); - - /* Update the IPv6 length field */ - uipbuf_add_ext_hdr(ext_len); - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - - return 1; -} -/*---------------------------------------------------------------------------*/ -int -rpl_ext_header_hbh_update(uint8_t *ext_buf, int opt_offset) -{ - int down; - int rank_error_signaled; - int loop_detected; - uint16_t sender_rank; - uint8_t sender_closer; - rpl_nbr_t *sender; - struct uip_hbho_hdr *hbh_hdr = (struct uip_hbho_hdr *)ext_buf; - struct uip_ext_hdr_opt_rpl *rpl_opt = (struct uip_ext_hdr_opt_rpl *)(ext_buf + opt_offset); - - if(hbh_hdr->len != ((RPL_HOP_BY_HOP_LEN - 8) / 8) - || rpl_opt->opt_type != UIP_EXT_HDR_OPT_RPL - || rpl_opt->opt_len != RPL_HDR_OPT_LEN) { - LOG_ERR("hop-by-hop extension header has wrong size or type (%u %u %u)\n", - hbh_hdr->len, rpl_opt->opt_type, rpl_opt->opt_len); - return 0; /* Drop */ - } - - if(!curr_instance.used || curr_instance.instance_id != rpl_opt->instance) { - LOG_ERR("unknown instance: %u\n", rpl_opt->instance); - return 0; /* Drop */ - } - - if(rpl_opt->flags & RPL_HDR_OPT_FWD_ERR) { - LOG_ERR("forward error!\n"); - return 0; /* Drop */ - } - - down = (rpl_opt->flags & RPL_HDR_OPT_DOWN) ? 1 : 0; - sender_rank = UIP_HTONS(rpl_opt->senderrank); - sender = nbr_table_get_from_lladdr(rpl_neighbors, packetbuf_addr(PACKETBUF_ADDR_SENDER)); - rank_error_signaled = (rpl_opt->flags & RPL_HDR_OPT_RANK_ERR) ? 1 : 0; - sender_closer = sender_rank < curr_instance.dag.rank; - loop_detected = (down && !sender_closer) || (!down && sender_closer); - - LOG_INFO("ext hdr: packet from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_INFO_(" going %s, sender closer %d (%d < %d), rank error %u, loop detected %u\n", - down == 1 ? "down" : "up", sender_closer, sender_rank, - curr_instance.dag.rank, rank_error_signaled, loop_detected); - - if(loop_detected) { - /* Set forward error flag */ - rpl_opt->flags |= RPL_HDR_OPT_RANK_ERR; - } - - return rpl_process_hbh(sender, sender_rank, loop_detected, rank_error_signaled); -} -/*---------------------------------------------------------------------------*/ -/* In-place update of the RPL HBH extension header, when already present - * in the uIP packet. Used by insert_hbh_header and rpl_ext_header_update. - * Returns 1 on success, 0 on failure. */ -static int -update_hbh_header(void) -{ - struct uip_hbho_hdr *hbh_hdr = (struct uip_hbho_hdr *)UIP_IP_PAYLOAD(0); - struct uip_ext_hdr_opt_rpl *rpl_opt = (struct uip_ext_hdr_opt_rpl *)(UIP_IP_PAYLOAD(2)); - - if(UIP_IP_BUF->proto == UIP_PROTO_HBHO && rpl_opt->opt_type == UIP_EXT_HDR_OPT_RPL) { - if(hbh_hdr->len != ((RPL_HOP_BY_HOP_LEN - 8) / 8) - || rpl_opt->opt_len != RPL_HDR_OPT_LEN) { - - LOG_ERR("hop-by-hop extension header has wrong size (%u)\n", rpl_opt->opt_len); - return 0; /* Drop */ - } - - if(!curr_instance.used || curr_instance.instance_id != rpl_opt->instance) { - LOG_ERR("unable to add/update hop-by-hop extension header: incorrect instance\n"); - return 0; /* Drop */ - } - - /* Update sender rank and instance, will update flags next */ - rpl_opt->senderrank = UIP_HTONS(curr_instance.dag.rank); - rpl_opt->instance = curr_instance.instance_id; - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -/* Used by rpl_ext_header_update on packets without an HBH extension header, - * for packets initated by non-root nodes. - * Inserts and initalizes (via update_hbh_header) a RPL HBH ext header. - * Returns 1 on success, 0 on failure. */ -static int -insert_hbh_header(void) -{ - struct uip_hbho_hdr *hbh_hdr = (struct uip_hbho_hdr *)UIP_IP_PAYLOAD(0); - struct uip_ext_hdr_opt_rpl *rpl_opt = (struct uip_ext_hdr_opt_rpl *)(UIP_IP_PAYLOAD(2)); - - /* Insert hop-by-hop header */ - LOG_INFO("creating hop-by-hop option\n"); - if(uip_len + RPL_HOP_BY_HOP_LEN > UIP_LINK_MTU) { - LOG_ERR("packet too long: impossible to add hop-by-hop option\n"); - return 0; - } - - /* Move existing ext headers and payload RPL_HOP_BY_HOP_LEN further */ - memmove(UIP_IP_PAYLOAD(RPL_HOP_BY_HOP_LEN), UIP_IP_PAYLOAD(0), uip_len - UIP_IPH_LEN); - memset(UIP_IP_PAYLOAD(0), 0, RPL_HOP_BY_HOP_LEN); - - /* Insert HBH header (as first ext header) */ - hbh_hdr->next = UIP_IP_BUF->proto; - UIP_IP_BUF->proto = UIP_PROTO_HBHO; - - /* Initialize HBH option */ - hbh_hdr->len = (RPL_HOP_BY_HOP_LEN - 8) / 8; - rpl_opt->opt_type = UIP_EXT_HDR_OPT_RPL; - rpl_opt->opt_len = RPL_HDR_OPT_LEN; - rpl_opt->flags = 0; - rpl_opt->senderrank = UIP_HTONS(curr_instance.dag.rank); - rpl_opt->instance = curr_instance.instance_id; - - uipbuf_add_ext_hdr(RPL_HOP_BY_HOP_LEN); - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - - /* Update header before returning */ - return update_hbh_header(); -} -/*---------------------------------------------------------------------------*/ -int -rpl_ext_header_update(void) -{ - if(!curr_instance.used - || uip_is_addr_linklocal(&UIP_IP_BUF->destipaddr) - || uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) { - return 1; - } - - if(rpl_dag_root_is_root()) { - /* At the root, remove headers if any, and insert SRH or HBH - * (SRH is inserted only if the destination is down the DODAG) */ - rpl_ext_header_remove(); - /* Insert SRH (if needed) */ - return insert_srh_header(); - } else { - if(uip_ds6_is_my_addr(&UIP_IP_BUF->srcipaddr) - && UIP_IP_BUF->ttl == uip_ds6_if.cur_hop_limit) { - /* Insert HBH option at source. Checking the address is not sufficient because - * in non-storing mode, a packet may go up and then down the same path again */ - return insert_hbh_header(); - } else { - /* Update HBH option at forwarders */ - return update_hbh_header(); - } - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_ext_header_remove(void) -{ - uint8_t *prev_proto_ptr; - uint8_t protocol; - uint8_t ext_len; - uint8_t *next_header; - struct uip_ext_hdr *ext_ptr; - struct uip_ext_hdr_opt *opt_ptr; - - next_header = uipbuf_get_next_header(uip_buf, uip_len, &protocol, true); - ext_ptr = (struct uip_ext_hdr *)next_header; - prev_proto_ptr = &UIP_IP_BUF->proto; - while(next_header != NULL && uip_is_proto_ext_hdr(protocol)) { - opt_ptr = (struct uip_ext_hdr_opt *)(next_header + 2); - if(protocol == UIP_PROTO_ROUTING || (protocol == UIP_PROTO_HBHO && opt_ptr->type == UIP_EXT_HDR_OPT_RPL)) { - /* Remove ext header */ - *prev_proto_ptr = ext_ptr->next; - ext_len = ext_ptr->len * 8 + 8; - uipbuf_add_ext_hdr(-ext_len); - /* Update length field and move rest of packet to the "left" */ - uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN); - memmove(next_header, next_header + ext_len, uip_len - (next_header - uip_buf)); - /* Update loop variables */ - protocol = *prev_proto_ptr; - } else { - /* move to the ext hdr */ - next_header = uipbuf_get_next_header(next_header, uip_len - (next_header - uip_buf), &protocol, false); - ext_ptr = (struct uip_ext_hdr *)next_header; - prev_proto_ptr = &ext_ptr->next; - } - } -} -/** @}*/ diff --git a/os/net/routing/rpl-lite/rpl-ext-header.h b/os/net/routing/rpl-lite/rpl-ext-header.h deleted file mode 100644 index c2d0db5bc..000000000 --- a/os/net/routing/rpl-lite/rpl-ext-header.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2017, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * Header file for rpl-ext-header - * - * \author Simon Duquennoy - */ - - #ifndef RPL_EXT_HEADER_H_ - #define RPL_EXT_HEADER_H_ - -/********** Public functions **********/ - -/** -* Look for next hop from SRH of current uIP packet. -* -* \param ipaddr A pointer to the address where to store the next hop. -* \return 1 if a next hop was found, 0 otherwise -*/ -int rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr); - -/** -* Process and update SRH in-place, -* i.e. internal address swapping as per RFC6554 -* \return 1 if SRH found, 0 otherwise -*/ -int rpl_ext_header_srh_update(void); - -/** -* Process and update the RPL hop-by-hop extension headers of -* the current uIP packet. -* -* \param ext_buf A pointer to the ext header buffer -* \param opt_offset The offset within the extension header where -* the option starts -* \return 1 in case the packet is valid and to be processed further, -* 0 in case the packet must be dropped. -*/ -int rpl_ext_header_hbh_update(uint8_t *ext_buf, int opt_offset); - -/** - * Adds/updates all RPL extension headers to current uIP packet. - * - * \return 1 in case of success, 0 otherwise -*/ -int rpl_ext_header_update(void); - -/** - * Removes all RPL extension headers. -*/ -void rpl_ext_header_remove(void); - - /** @} */ - -#endif /* RPL_EXT_HEADER_H_ */ diff --git a/os/net/routing/rpl-lite/rpl-icmp6.c b/os/net/routing/rpl-lite/rpl-icmp6.c deleted file mode 100644 index 335c640d9..000000000 --- a/os/net/routing/rpl-lite/rpl-icmp6.c +++ /dev/null @@ -1,688 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * ICMP6 I/O for RPL control messages. - * - * \author Joakim Eriksson , Nicolas Tsiftes , - * Simon Duquennoy - * Contributors: Niclas Finne , Joel Hoglund , - * Mathieu Pouillot , - * George Oikonomou (multicast) - */ - -#include "net/routing/rpl-lite/rpl.h" -#include "net/ipv6/uip-icmp6.h" -#include "net/packetbuf.h" -#include "lib/random.h" - -#include - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/*---------------------------------------------------------------------------*/ -#define RPL_DIO_GROUNDED 0x80 -#define RPL_DIO_MOP_SHIFT 3 -#define RPL_DIO_MOP_MASK 0x38 -#define RPL_DIO_PREFERENCE_MASK 0x07 - -/*---------------------------------------------------------------------------*/ -static void dis_input(void); -static void dio_input(void); -static void dao_input(void); - -/*---------------------------------------------------------------------------*/ -/* Initialize RPL ICMPv6 message handlers */ -UIP_ICMP6_HANDLER(dis_handler, ICMP6_RPL, RPL_CODE_DIS, dis_input); -UIP_ICMP6_HANDLER(dio_handler, ICMP6_RPL, RPL_CODE_DIO, dio_input); -UIP_ICMP6_HANDLER(dao_handler, ICMP6_RPL, RPL_CODE_DAO, dao_input); - -#if RPL_WITH_DAO_ACK -static void dao_ack_input(void); -UIP_ICMP6_HANDLER(dao_ack_handler, ICMP6_RPL, RPL_CODE_DAO_ACK, dao_ack_input); -#endif /* RPL_WITH_DAO_ACK */ - -/*---------------------------------------------------------------------------*/ -static uint32_t -get32(uint8_t *buffer, int pos) -{ - return ((uint32_t)buffer[pos] << 24 | (uint32_t)buffer[pos + 1] << 16 | - (uint32_t)buffer[pos + 2] << 8 | buffer[pos + 3]); -} -/*---------------------------------------------------------------------------*/ -static void -set32(uint8_t *buffer, int pos, uint32_t value) -{ - buffer[pos++] = value >> 24; - buffer[pos++] = (value >> 16) & 0xff; - buffer[pos++] = (value >> 8) & 0xff; - buffer[pos++] = value & 0xff; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -get16(uint8_t *buffer, int pos) -{ - return (uint16_t)buffer[pos] << 8 | buffer[pos + 1]; -} -/*---------------------------------------------------------------------------*/ -static void -set16(uint8_t *buffer, int pos, uint16_t value) -{ - buffer[pos++] = value >> 8; - buffer[pos++] = value & 0xff; -} -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -rpl_icmp6_update_nbr_table(uip_ipaddr_t *from, nbr_table_reason_t reason, void *data) -{ - uip_ds6_nbr_t *nbr; - - if((nbr = uip_ds6_nbr_lookup(from)) == NULL) { - if((nbr = uip_ds6_nbr_add(from, (uip_lladdr_t *) - packetbuf_addr(PACKETBUF_ADDR_SENDER), - 0, NBR_REACHABLE, reason, data)) == NULL) { - LOG_ERR("could not add neighbor to cache "); - LOG_ERR_6ADDR(from); - LOG_ERR_(", "); - LOG_ERR_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); - LOG_ERR_("\n"); - } - } - - return nbr; -} -/*---------------------------------------------------------------------------*/ -static void -dis_input(void) -{ - if(!curr_instance.used) { - LOG_WARN("dis_input: not in an instance yet, discard\n"); - goto discard; - } - - LOG_INFO("received a DIS from "); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - - rpl_process_dis(&UIP_IP_BUF->srcipaddr, uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)); - - discard: - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -void -rpl_icmp6_dis_output(uip_ipaddr_t *addr) -{ - unsigned char *buffer; - - /* Make sure we're up-to-date before sending data out */ - rpl_dag_update_state(); - - buffer = UIP_ICMP_PAYLOAD; - buffer[0] = buffer[1] = 0; - - if(addr == NULL) { - addr = &rpl_multicast_addr; - } - - LOG_INFO("sending a DIS to "); - LOG_INFO_6ADDR(addr); - LOG_INFO_("\n"); - - uip_icmp6_send(addr, ICMP6_RPL, RPL_CODE_DIS, 2); -} -/*---------------------------------------------------------------------------*/ -static void -dio_input(void) -{ - unsigned char *buffer; - uint8_t buffer_length; - rpl_dio_t dio; - uint8_t subopt_type; - int i; - int len; - uip_ipaddr_t from; - - memset(&dio, 0, sizeof(dio)); - - /* Set default values in case the DIO configuration option is missing. */ - dio.dag_intdoubl = RPL_DIO_INTERVAL_DOUBLINGS; - dio.dag_intmin = RPL_DIO_INTERVAL_MIN; - dio.dag_redund = RPL_DIO_REDUNDANCY; - dio.dag_min_hoprankinc = RPL_MIN_HOPRANKINC; - dio.dag_max_rankinc = RPL_MAX_RANKINC; - dio.ocp = RPL_OF_OCP; - dio.default_lifetime = RPL_DEFAULT_LIFETIME; - dio.lifetime_unit = RPL_DEFAULT_LIFETIME_UNIT; - - uip_ipaddr_copy(&from, &UIP_IP_BUF->srcipaddr); - - buffer_length = uip_len - uip_l3_icmp_hdr_len; - - /* Process the DIO base option. */ - i = 0; - buffer = UIP_ICMP_PAYLOAD; - - dio.instance_id = buffer[i++]; - dio.version = buffer[i++]; - dio.rank = get16(buffer, i); - i += 2; - - dio.grounded = buffer[i] & RPL_DIO_GROUNDED; - dio.mop = (buffer[i]& RPL_DIO_MOP_MASK) >> RPL_DIO_MOP_SHIFT; - dio.preference = buffer[i++] & RPL_DIO_PREFERENCE_MASK; - - dio.dtsn = buffer[i++]; - /* two reserved bytes */ - i += 2; - - memcpy(&dio.dag_id, buffer + i, sizeof(dio.dag_id)); - i += sizeof(dio.dag_id); - - /* Check if there are any DIO suboptions. */ - for(; i < buffer_length; i += len) { - subopt_type = buffer[i]; - if(subopt_type == RPL_OPTION_PAD1) { - len = 1; - } else { - /* Suboption with a two-byte header + payload */ - len = 2 + buffer[i + 1]; - } - - if(len + i > buffer_length) { - LOG_ERR("dio_input: malformed packet, discard\n"); - goto discard; - } - - switch(subopt_type) { - case RPL_OPTION_DAG_METRIC_CONTAINER: - if(len < 6) { - LOG_WARN("dio_input: invalid DAG MC, len %u, discard\n", len); - goto discard; - } - dio.mc.type = buffer[i + 2]; - dio.mc.flags = buffer[i + 3] << 1; - dio.mc.flags |= buffer[i + 4] >> 7; - dio.mc.aggr = (buffer[i + 4] >> 4) & 0x3; - dio.mc.prec = buffer[i + 4] & 0xf; - dio.mc.length = buffer[i + 5]; - - if(dio.mc.type == RPL_DAG_MC_NONE) { - /* No metric container: do nothing */ - } else if(dio.mc.type == RPL_DAG_MC_ETX) { - dio.mc.obj.etx = get16(buffer, i + 6); - } else if(dio.mc.type == RPL_DAG_MC_ENERGY) { - dio.mc.obj.energy.flags = buffer[i + 6]; - dio.mc.obj.energy.energy_est = buffer[i + 7]; - } else { - LOG_WARN("dio_input: unsupported DAG MC type %u, discard\n", (unsigned)dio.mc.type); - goto discard; - } - break; - case RPL_OPTION_ROUTE_INFO: - if(len < 9) { - LOG_WARN("dio_input: invalid destination prefix option, len %u, discard\n", len); - goto discard; - } - - /* The flags field includes the preference value. */ - dio.destination_prefix.length = buffer[i + 2]; - dio.destination_prefix.flags = buffer[i + 3]; - dio.destination_prefix.lifetime = get32(buffer, i + 4); - - if(((dio.destination_prefix.length + 7) / 8) + 8 <= len && - dio.destination_prefix.length <= 128) { - memcpy(&dio.destination_prefix.prefix, &buffer[i + 8], - (dio.destination_prefix.length + 7) / 8); - } else { - LOG_WARN("dio_input: invalid route info option, len %u, discard\n", len); - goto discard; - } - - break; - case RPL_OPTION_DAG_CONF: - if(len != 16) { - LOG_WARN("dio_input: invalid DAG configuration option, len %u, discard\n", len); - goto discard; - } - - /* Path control field not yet implemented - at i + 2 */ - dio.dag_intdoubl = buffer[i + 3]; - dio.dag_intmin = buffer[i + 4]; - dio.dag_redund = buffer[i + 5]; - dio.dag_max_rankinc = get16(buffer, i + 6); - dio.dag_min_hoprankinc = get16(buffer, i + 8); - dio.ocp = get16(buffer, i + 10); - /* buffer + 12 is reserved */ - dio.default_lifetime = buffer[i + 13]; - dio.lifetime_unit = get16(buffer, i + 14); - break; - case RPL_OPTION_PREFIX_INFO: - if(len != 32) { - LOG_WARN("dio_input: invalid DAG prefix info, len %u, discard\n", len); - goto discard; - } - dio.prefix_info.length = buffer[i + 2]; - dio.prefix_info.flags = buffer[i + 3]; - /* valid lifetime is ingnored for now - at i + 4 */ - /* preferred lifetime stored in lifetime */ - dio.prefix_info.lifetime = get32(buffer, i + 8); - /* 32-bit reserved at i + 12 */ - memcpy(&dio.prefix_info.prefix, &buffer[i + 16], 16); - break; - default: - LOG_WARN("dio_input: unsupported suboption type in DIO: %u, discard\n", (unsigned)subopt_type); - goto discard; - } - } - - LOG_INFO("received a %s-DIO from ", - uip_is_addr_mcast(&UIP_IP_BUF->destipaddr) ? "multicast" : "unicast"); - LOG_INFO_6ADDR(&from); - LOG_INFO_(", instance_id %u, DAG ID ", (unsigned)dio.instance_id); - LOG_INFO_6ADDR(&dio.dag_id); - LOG_INFO_(", version %u, dtsn %u, rank %u\n", - (unsigned)dio.version, - (unsigned)dio.dtsn, - (unsigned)dio.rank); - - rpl_process_dio(&from, &dio); - -discard: - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -void -rpl_icmp6_dio_output(uip_ipaddr_t *uc_addr) -{ - unsigned char *buffer; - int pos; - uip_ipaddr_t *addr = uc_addr; - - /* Make sure we're up-to-date before sending data out */ - rpl_dag_update_state(); - - if(rpl_get_leaf_only()) { - /* In leaf mode, we only send DIO messages as unicasts in response to - unicast DIS messages. */ - if(uc_addr == NULL) { - /* Do not send multicast DIO in leaf mode */ - return; - } - } - - /* DAG Information Object */ - pos = 0; - - buffer = UIP_ICMP_PAYLOAD; - buffer[pos++] = curr_instance.instance_id; - buffer[pos++] = curr_instance.dag.version; - - if(rpl_get_leaf_only()) { - set16(buffer, pos, RPL_INFINITE_RANK); - } else { - set16(buffer, pos, curr_instance.dag.rank); - } - pos += 2; - - buffer[pos] = 0; - if(curr_instance.dag.grounded) { - buffer[pos] |= RPL_DIO_GROUNDED; - } - - buffer[pos] |= curr_instance.mop << RPL_DIO_MOP_SHIFT; - buffer[pos] |= curr_instance.dag.preference & RPL_DIO_PREFERENCE_MASK; - pos++; - - buffer[pos++] = curr_instance.dtsn_out; - - /* reserved 2 bytes */ - buffer[pos++] = 0; /* flags */ - buffer[pos++] = 0; /* reserved */ - - memcpy(buffer + pos, &curr_instance.dag.dag_id, sizeof(curr_instance.dag.dag_id)); - pos += 16; - - if(!rpl_get_leaf_only()) { - if(curr_instance.mc.type != RPL_DAG_MC_NONE) { - buffer[pos++] = RPL_OPTION_DAG_METRIC_CONTAINER; - buffer[pos++] = 6; - buffer[pos++] = curr_instance.mc.type; - buffer[pos++] = curr_instance.mc.flags >> 1; - buffer[pos] = (curr_instance.mc.flags & 1) << 7; - buffer[pos++] |= (curr_instance.mc.aggr << 4) | curr_instance.mc.prec; - if(curr_instance.mc.type == RPL_DAG_MC_ETX) { - buffer[pos++] = 2; - set16(buffer, pos, curr_instance.mc.obj.etx); - pos += 2; - } else if(curr_instance.mc.type == RPL_DAG_MC_ENERGY) { - buffer[pos++] = 2; - buffer[pos++] = curr_instance.mc.obj.energy.flags; - buffer[pos++] = curr_instance.mc.obj.energy.energy_est; - } else { - LOG_ERR("unable to send DIO because of unsupported DAG MC type %u\n", - (unsigned)curr_instance.mc.type); - return; - } - } - } - - /* Always add a DAG configuration option. */ - buffer[pos++] = RPL_OPTION_DAG_CONF; - buffer[pos++] = 14; - buffer[pos++] = 0; /* No Auth, PCS = 0 */ - buffer[pos++] = curr_instance.dio_intdoubl; - buffer[pos++] = curr_instance.dio_intmin; - buffer[pos++] = curr_instance.dio_redundancy; - set16(buffer, pos, curr_instance.max_rankinc); - pos += 2; - set16(buffer, pos, curr_instance.min_hoprankinc); - pos += 2; - /* OCP is in the DAG_CONF option */ - set16(buffer, pos, curr_instance.of->ocp); - pos += 2; - buffer[pos++] = 0; /* reserved */ - buffer[pos++] = curr_instance.default_lifetime; - set16(buffer, pos, curr_instance.lifetime_unit); - pos += 2; - - /* Check if we have a prefix to send also. */ - if(curr_instance.dag.prefix_info.length > 0) { - buffer[pos++] = RPL_OPTION_PREFIX_INFO; - buffer[pos++] = 30; /* always 30 bytes + 2 long */ - buffer[pos++] = curr_instance.dag.prefix_info.length; - buffer[pos++] = curr_instance.dag.prefix_info.flags; - set32(buffer, pos, curr_instance.dag.prefix_info.lifetime); - pos += 4; - set32(buffer, pos, curr_instance.dag.prefix_info.lifetime); - pos += 4; - memset(&buffer[pos], 0, 4); - pos += 4; - memcpy(&buffer[pos], &curr_instance.dag.prefix_info.prefix, 16); - pos += 16; - } - - if(!rpl_get_leaf_only()) { - addr = addr != NULL ? addr : &rpl_multicast_addr; - } - - LOG_INFO("sending a %s-DIO with rank %u to ", - uc_addr != NULL ? "unicast" : "multicast", - (unsigned)curr_instance.dag.rank); - LOG_INFO_6ADDR(addr); - LOG_INFO_("\n"); - - uip_icmp6_send(addr, ICMP6_RPL, RPL_CODE_DIO, pos); -} -/*---------------------------------------------------------------------------*/ -static void -dao_input(void) -{ - struct rpl_dao dao; - uint8_t subopt_type; - unsigned char *buffer; - uint8_t buffer_length; - int pos; - int len; - int i; - uip_ipaddr_t from; - - memset(&dao, 0, sizeof(dao)); - - dao.instance_id = UIP_ICMP_PAYLOAD[0]; - if(!curr_instance.used || curr_instance.instance_id != dao.instance_id) { - LOG_ERR("dao_input: unknown RPL instance %u, discard\n", dao.instance_id); - goto discard; - } - - uip_ipaddr_copy(&from, &UIP_IP_BUF->srcipaddr); - memset(&dao.parent_addr, 0, 16); - - buffer = UIP_ICMP_PAYLOAD; - buffer_length = uip_len - uip_l3_icmp_hdr_len; - - pos = 0; - pos++; /* instance ID */ - dao.lifetime = curr_instance.default_lifetime; - dao.flags = buffer[pos++]; - pos++; /* reserved */ - dao.sequence = buffer[pos++]; - - /* Is the DAG ID present? */ - if(dao.flags & RPL_DAO_D_FLAG) { - if(memcmp(&curr_instance.dag.dag_id, &buffer[pos], sizeof(curr_instance.dag.dag_id))) { - LOG_ERR("dao_input: different DAG ID "); - LOG_ERR_6ADDR((uip_ipaddr_t *)&buffer[pos]); - LOG_ERR_(", discard\n"); - goto discard; - } - pos += 16; - } - - /* Check if there are any RPL options present. */ - for(i = pos; i < buffer_length; i += len) { - subopt_type = buffer[i]; - if(subopt_type == RPL_OPTION_PAD1) { - len = 1; - } else { - /* The option consists of a two-byte header and a payload. */ - len = 2 + buffer[i + 1]; - } - - switch(subopt_type) { - case RPL_OPTION_TARGET: - /* Handle the target option. */ - dao.prefixlen = buffer[i + 3]; - memset(&dao.prefix, 0, sizeof(dao.prefix)); - memcpy(&dao.prefix, buffer + i + 4, (dao.prefixlen + 7) / CHAR_BIT); - break; - case RPL_OPTION_TRANSIT: - /* The path sequence and control are ignored. */ - /* pathcontrol = buffer[i + 3]; - pathsequence = buffer[i + 4];*/ - dao.lifetime = buffer[i + 5]; - if(len >= 20) { - memcpy(&dao.parent_addr, buffer + i + 6, 16); - } - break; - } - } - - /* Destination Advertisement Object */ - LOG_INFO("received a %sDAO from ", dao.lifetime == 0 ? "No-path " : ""); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_(", seqno %u, lifetime %u, prefix ", dao.sequence, dao.lifetime); - LOG_INFO_6ADDR(&dao.prefix); - LOG_INFO_(", prefix length %u, parent ", dao.prefixlen); - LOG_INFO_6ADDR(&dao.parent_addr); - LOG_INFO_(" \n"); - - rpl_process_dao(&from, &dao); - - discard: - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -void -rpl_icmp6_dao_output(uint8_t lifetime) -{ - unsigned char *buffer; - uint8_t prefixlen; - int pos; - const uip_ipaddr_t *prefix = rpl_get_global_address(); - uip_ipaddr_t *parent_ipaddr = rpl_neighbor_get_ipaddr(curr_instance.dag.preferred_parent); - - /* Make sure we're up-to-date before sending data out */ - rpl_dag_update_state(); - - if(!curr_instance.used) { - LOG_WARN("rpl_icmp6_dao_output: not in an instance, skip sending DAO\n"); - return; - } - - if(curr_instance.dag.preferred_parent == NULL) { - LOG_WARN("rpl_icmp6_dao_output: no preferred parent, skip sending DAO\n"); - return; - } - - if(prefix == NULL || parent_ipaddr == NULL || curr_instance.mop == RPL_MOP_NO_DOWNWARD_ROUTES) { - LOG_WARN("rpl_icmp6_dao_output: node not ready to send a DAO (prefix %p, parent addr %p, mop %u)\n", - prefix, parent_ipaddr, curr_instance.mop); - return; - } - - buffer = UIP_ICMP_PAYLOAD; - pos = 0; - - buffer[pos++] = curr_instance.instance_id; - buffer[pos] = 0; -#if RPL_WITH_DAO_ACK - if(lifetime != 0) { - buffer[pos] |= RPL_DAO_K_FLAG; - } -#endif /* RPL_WITH_DAO_ACK */ - ++pos; - buffer[pos++] = 0; /* reserved */ - buffer[pos++] = curr_instance.dag.dao_last_seqno; - - /* create target subopt */ - prefixlen = sizeof(*prefix) * CHAR_BIT; - buffer[pos++] = RPL_OPTION_TARGET; - buffer[pos++] = 2 + ((prefixlen + 7) / CHAR_BIT); - buffer[pos++] = 0; /* reserved */ - buffer[pos++] = prefixlen; - memcpy(buffer + pos, prefix, (prefixlen + 7) / CHAR_BIT); - pos += ((prefixlen + 7) / CHAR_BIT); - - /* Create a transit information sub-option. */ - buffer[pos++] = RPL_OPTION_TRANSIT; - buffer[pos++] = 20; - buffer[pos++] = 0; /* flags - ignored */ - buffer[pos++] = 0; /* path control - ignored */ - buffer[pos++] = 0; /* path seq - ignored */ - buffer[pos++] = lifetime; - - /* Include parent global IP address */ - memcpy(buffer + pos, &curr_instance.dag.dag_id, 8); /* Prefix */ - pos += 8; - memcpy(buffer + pos, ((const unsigned char *)parent_ipaddr) + 8, 8); /* Interface identifier */ - pos += 8; - - LOG_INFO("sending a %sDAO seqno %u, tx count %u, lifetime %u, prefix ", - lifetime == 0 ? "No-path " : "", - curr_instance.dag.dao_last_seqno, curr_instance.dag.dao_transmissions, lifetime); - LOG_INFO_6ADDR(prefix); - LOG_INFO_(" to "); - LOG_INFO_6ADDR(&curr_instance.dag.dag_id); - LOG_INFO_(", parent "); - LOG_INFO_6ADDR(parent_ipaddr); - LOG_INFO_("\n"); - - /* Send DAO to root (IPv6 address is DAG ID) */ - uip_icmp6_send(&curr_instance.dag.dag_id, ICMP6_RPL, RPL_CODE_DAO, pos); -} -#if RPL_WITH_DAO_ACK -/*---------------------------------------------------------------------------*/ -static void -dao_ack_input(void) -{ - uint8_t *buffer; - uint8_t instance_id; - uint8_t sequence; - uint8_t status; - - buffer = UIP_ICMP_PAYLOAD; - - instance_id = buffer[0]; - sequence = buffer[2]; - status = buffer[3]; - - if(!curr_instance.used || curr_instance.instance_id != instance_id) { - LOG_ERR("dao_ack_input: unknown instance, discard\n"); - goto discard; - } - - LOG_INFO("received a DAO-%s with seqno %d (%d %d) and status %d from ", - status < RPL_DAO_ACK_UNABLE_TO_ACCEPT ? "ACK" : "NACK", sequence, - curr_instance.dag.dao_last_seqno, curr_instance.dag.dao_last_seqno, status); - LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_INFO_("\n"); - - rpl_process_dao_ack(sequence, status); - - discard: - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -void -rpl_icmp6_dao_ack_output(uip_ipaddr_t *dest, uint8_t sequence, uint8_t status) -{ - unsigned char *buffer; - - /* Make sure we're up-to-date before sending data out */ - rpl_dag_update_state(); - - buffer = UIP_ICMP_PAYLOAD; - buffer[0] = curr_instance.instance_id; - buffer[1] = 0; - buffer[2] = sequence; - buffer[3] = status; - - LOG_INFO("sending a DAO-%s seqno %d to ", - status < RPL_DAO_ACK_UNABLE_TO_ACCEPT ? "ACK" : "NACK", sequence); - LOG_INFO_6ADDR(dest); - LOG_INFO_(" with status %d\n", status); - - uip_icmp6_send(dest, ICMP6_RPL, RPL_CODE_DAO_ACK, 4); -} -#endif /* RPL_WITH_DAO_ACK */ -/*---------------------------------------------------------------------------*/ -void -rpl_icmp6_init() -{ - uip_icmp6_register_input_handler(&dis_handler); - uip_icmp6_register_input_handler(&dio_handler); - uip_icmp6_register_input_handler(&dao_handler); -#if RPL_WITH_DAO_ACK - uip_icmp6_register_input_handler(&dao_ack_handler); -#endif /* RPL_WITH_DAO_ACK */ -} -/*---------------------------------------------------------------------------*/ - -/** @}*/ diff --git a/os/net/routing/rpl-lite/rpl-icmp6.h b/os/net/routing/rpl-lite/rpl-icmp6.h deleted file mode 100644 index fc877b948..000000000 --- a/os/net/routing/rpl-lite/rpl-icmp6.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2017, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * Header file for rpl-ext-header - * - * \author Simon Duquennoy - */ - - #ifndef RPL_ICMP6_H_ - #define RPL_ICMP6_H_ - -#include "uip.h" -#include "uip-ds6.h" -#include "uip-ds6-nbr.h" - -/********** Data structures **********/ - -/* Logical representation of a DAG Information Object (DIO.) */ -struct rpl_dio { - uip_ipaddr_t dag_id; - rpl_ocp_t ocp; - rpl_rank_t rank; - uint8_t grounded; - uint8_t mop; - uint8_t preference; - uint8_t version; - uint8_t instance_id; - uint8_t dtsn; - uint8_t dag_intdoubl; - uint8_t dag_intmin; - uint8_t dag_redund; - uint8_t default_lifetime; - uint16_t lifetime_unit; - rpl_rank_t dag_max_rankinc; - rpl_rank_t dag_min_hoprankinc; - rpl_prefix_t destination_prefix; - rpl_prefix_t prefix_info; - struct rpl_metric_container mc; -}; -typedef struct rpl_dio rpl_dio_t; - -/* Logical representation of a Destination Advertisement Object (DAO.) */ -struct rpl_dao { - uip_ipaddr_t parent_addr; - uip_ipaddr_t prefix; - uint16_t sequence; - uint8_t instance_id; - uint8_t lifetime; - uint8_t prefixlen; - uint8_t flags; -}; -typedef struct rpl_dao rpl_dao_t; - -/********** Public functions **********/ - -/** - * Updates IPv6 neighbor cache on incoming link-local RPL ICMPv6 messages. - * - * \param from The source link-local IPv6 address - * \param reason What triggered the update (maps to RPL packet types) - * \param data Generic pointer, used for instance to store parsed DIO data - * \return A pointer to the new neighbor cache entry, NULL if there was no space left. -*/ -uip_ds6_nbr_t *rpl_icmp6_update_nbr_table(uip_ipaddr_t *from, nbr_table_reason_t reason, void *data); - -/** - * Creates an ICMPv6 DIS packet and sends it. Can be unicast or multicast. - * - * \param addr The link-local address of the target host, if any. - * Else, a multicast DIS will be sent. -*/ -void rpl_icmp6_dis_output(uip_ipaddr_t *addr); - -/** - * Creates an ICMPv6 DIO packet and sends it. Can be unicast or multicast - * - * \param uc_addr The link-local address of the target host, if any. - * Else, a multicast DIO will be sent. -*/ -void rpl_icmp6_dio_output(uip_ipaddr_t *uc_addr); - -/** - * Creates an ICMPv6 DAO packet and sends it to the root, advertising the - * current preferred parent, and with our global address as prefix. - * - * \param lifetime The DAO lifetime. Use 0 to send a No-path DAO -*/ -void rpl_icmp6_dao_output(uint8_t lifetime); - -/** - * Creates an ICMPv6 DAO-ACK packet and sends it to the originator - * of the ACK. - * - * \param dest The DAO-ACK destination (was source of the DAO) - * \param sequence The sequence number of the DAO being ACKed - * \param status The status of the DAO-ACK (see RPL_DAO_ACK_* defines) -*/ -void rpl_icmp6_dao_ack_output(uip_ipaddr_t *dest, uint8_t sequence, uint8_t status); - -/** - * Initializes rpl-icmp6 module, registers ICMPv6 handlers for all - * RPL ICMPv6 messages: DIO, DIS, DAO and DAO-ACK -*/ -void rpl_icmp6_init(void); - - /** @} */ - -#endif /* RPL_ICMP6_H_ */ diff --git a/os/net/routing/rpl-lite/rpl-mrhof.c b/os/net/routing/rpl-lite/rpl-mrhof.c deleted file mode 100644 index 79c06d496..000000000 --- a/os/net/routing/rpl-lite/rpl-mrhof.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * The Minimum Rank with Hysteresis Objective Function (MRHOF), RFC6719 - * - * This implementation uses the estimated number of - * transmissions (ETX) as the additive routing metric, - * and also provides stubs for the energy metric. - * - * \author Joakim Eriksson , Nicolas Tsiftes - * Simon Duquennoy - */ - -#include "net/routing/rpl-lite/rpl.h" -#include "net/nbr-table.h" -#include "net/link-stats.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/* RFC6551 and RFC6719 do not mandate the use of a specific formula to - * compute the ETX value. This MRHOF implementation relies on the value - * computed by the link-stats module.It has an optional feature, - * RPL_MRHOF_CONF_SQUARED_ETX, that consists in squaring this value. - * - * Squaring basically penalizes bad links while preserving the semantics of ETX - * (1 = perfect link, more = worse link). As a result, MRHOF will favor - * good links over short paths. Without this feature, a hop with 50% PRR (ETX=2) - * is equivalent to two perfect hops with 100% PRR (ETX=1+1=2). With this - * feature, the former path obtains ETX=2*2=4 and the former ETX=1*1+1*1=2. - * - * While this feature helps achieve extra relaibility, it also results in - * added churn. In networks with high congestion or poor links, this can lead - * to poor connectivity due to more parent switches, loops, Trickle resets, etc. - */ -#ifdef RPL_MRHOF_CONF_SQUARED_ETX -#define RPL_MRHOF_SQUARED_ETX RPL_MRHOF_CONF_SQUARED_ETX -#else /* RPL_MRHOF_CONF_SQUARED_ETX */ -#define RPL_MRHOF_SQUARED_ETX 0 -#endif /* RPL_MRHOF_CONF_SQUARED_ETX */ - -/* Configuration parameters of RFC6719. Reject parents that have a higher - * link metric than the following. The default value is 512. */ -#ifdef RPL_MRHOF_CONF_MAX_LINK_METRIC -#define MAX_LINK_METRIC RPL_MRHOF_CONF_MAX_LINK_METRIC -#else /* RPL_MRHOF_CONF_MAX_LINK_METRIC */ -#define MAX_LINK_METRIC 512 /* Eq ETX of 4 */ -#endif /* RPL_MRHOF_CONF_MAX_LINK_METRIC */ - -/* Reject parents that have a higher path cost than the following. */ -#ifdef RPL_MRHOF_CONF_MAX_PATH_COST -#define MAX_PATH_COST RPL_MRHOF_CONF_MAX_PATH_COST -#else /* RPL_MRHOF_CONF_MAX_PATH_COST */ -#define MAX_PATH_COST 32768 /* Eq path ETX of 256 */ -#endif /* RPL_MRHOF_CONF_MAX_PATH_COST */ - -#if !RPL_MRHOF_SQUARED_ETX -/* Hysteresis of MRHOF: the rank must differ more than PARENT_SWITCH_THRESHOLD_DIV - * in order to switch preferred parent. Default in RFC6719: 192, eq ETX of 1.5. */ -#define RANK_THRESHOLD 192 /* Eq ETX of 1.5 */ -#else /* !RPL_MRHOF_SQUARED_ETX */ -#define RANK_THRESHOLD 384 /* Eq ETX of sqrt(3) */ -#endif /* !RPL_MRHOF_SQUARED_ETX */ - -/* Additional, custom hysteresis based on time. If a neighbor was consistently - * better than our preferred parent for at least TIME_THRESHOLD, switch to - * this neighbor regardless of RANK_THRESHOLD. */ -#define TIME_THRESHOLD (10 * 60 * CLOCK_SECOND) - -/*---------------------------------------------------------------------------*/ -static void -reset(void) -{ - LOG_INFO("reset MRHOF\n"); -} -/*---------------------------------------------------------------------------*/ -static uint16_t -nbr_link_metric(rpl_nbr_t *nbr) -{ - const struct link_stats *stats = rpl_neighbor_get_link_stats(nbr); - return stats != NULL ? stats->etx : 0xffff; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -link_metric_to_rank(uint16_t etx) -{ -#if RPL_MRHOF_SQUARED_ETX - uint32_t squared_etx = ((uint32_t)etx * etx) / LINK_STATS_ETX_DIVISOR; - return (uint16_t)MIN(squared_etx, 0xffff); -#else /* RPL_MRHOF_SQUARED_ETX */ - return etx; -#endif /* RPL_MRHOF_SQUARED_ETX */ -} -/*---------------------------------------------------------------------------*/ -static uint16_t -nbr_path_cost(rpl_nbr_t *nbr) -{ - uint16_t base; - - if(nbr == NULL) { - return 0xffff; - } - -#if RPL_WITH_MC - /* Handle the different MC types */ - switch(curr_instance.mc.type) { - case RPL_DAG_MC_ETX: - base = nbr->mc.obj.etx; - break; - case RPL_DAG_MC_ENERGY: - base = nbr->mc.obj.energy.energy_est << 8; - break; - default: - base = nbr->rank; - break; - } -#else /* RPL_WITH_MC */ - base = nbr->rank; -#endif /* RPL_WITH_MC */ - - /* path cost upper bound: 0xffff */ - return MIN((uint32_t)base + link_metric_to_rank(nbr_link_metric(nbr)), 0xffff); -} -/*---------------------------------------------------------------------------*/ -static rpl_rank_t -rank_via_nbr(rpl_nbr_t *nbr) -{ - uint16_t min_hoprankinc; - uint16_t path_cost; - - if(nbr == NULL) { - return RPL_INFINITE_RANK; - } - - min_hoprankinc = curr_instance.min_hoprankinc; - path_cost = nbr_path_cost(nbr); - - /* Rank lower-bound: nbr rank + min_hoprankinc */ - return MAX(MIN((uint32_t)nbr->rank + min_hoprankinc, RPL_INFINITE_RANK), path_cost); -} -/*---------------------------------------------------------------------------*/ -static int -nbr_has_usable_link(rpl_nbr_t *nbr) -{ - uint16_t link_metric = nbr_link_metric(nbr); - /* Exclude links with too high link metrics */ - return link_metric <= MAX_LINK_METRIC; -} -/*---------------------------------------------------------------------------*/ -static int -nbr_is_acceptable_parent(rpl_nbr_t *nbr) -{ - uint16_t path_cost = nbr_path_cost(nbr); - /* Exclude links with too high link metrics or path cost (RFC6719, 3.2.2) */ - return nbr_has_usable_link(nbr) && path_cost <= MAX_PATH_COST; -} -/*---------------------------------------------------------------------------*/ -static int -within_hysteresis(rpl_nbr_t *nbr) -{ - uint16_t path_cost = nbr_path_cost(nbr); - uint16_t parent_path_cost = nbr_path_cost(curr_instance.dag.preferred_parent); - - int within_rank_hysteresis = path_cost + RANK_THRESHOLD > parent_path_cost; - int within_time_hysteresis = nbr->better_parent_since == 0 - || (clock_time() - nbr->better_parent_since) <= TIME_THRESHOLD; - - /* As we want to consider neighbors that are either beyond the rank or time - hystereses, return 1 here iff the neighbor is within both hystereses. */ - return within_rank_hysteresis && within_time_hysteresis; -} -/*---------------------------------------------------------------------------*/ -static rpl_nbr_t * -best_parent(rpl_nbr_t *nbr1, rpl_nbr_t *nbr2) -{ - int nbr1_is_acceptable; - int nbr2_is_acceptable; - - nbr1_is_acceptable = nbr1 != NULL && nbr_is_acceptable_parent(nbr1); - nbr2_is_acceptable = nbr2 != NULL && nbr_is_acceptable_parent(nbr2); - - if(!nbr1_is_acceptable) { - return nbr2_is_acceptable ? nbr2 : NULL; - } - if(!nbr2_is_acceptable) { - return nbr1_is_acceptable ? nbr1 : NULL; - } - - /* Maintain stability of the preferred parent. Switch only if the gain - is greater than RANK_THRESHOLD, or if the neighbor has been better than the - current parent for at more than TIME_THRESHOLD. */ - if(nbr1 == curr_instance.dag.preferred_parent && within_hysteresis(nbr2)) { - return nbr1; - } - if(nbr2 == curr_instance.dag.preferred_parent && within_hysteresis(nbr1)) { - return nbr2; - } - - return nbr_path_cost(nbr1) < nbr_path_cost(nbr2) ? nbr1 : nbr2; -} -/*---------------------------------------------------------------------------*/ -#if !RPL_WITH_MC -static void -update_metric_container(void) -{ - curr_instance.mc.type = RPL_DAG_MC_NONE; -} -#else /* RPL_WITH_MC */ -static void -update_metric_container(void) -{ - uint16_t path_cost; - uint8_t type; - - if(!curr_instance.used) { - LOG_WARN("cannot update the metric container when not joined\n"); - return; - } - - if(curr_instance.dag.rank == ROOT_RANK) { - /* Configure MC at root only, other nodes are auto-configured when joining */ - curr_instance.mc.type = RPL_DAG_MC; - curr_instance.mc.flags = 0; - curr_instance.mc.aggr = RPL_DAG_MC_AGGR_ADDITIVE; - curr_instance.mc.prec = 0; - path_cost = curr_instance.dag.rank; - } else { - path_cost = nbr_path_cost(curr_instance.dag.preferred_parent); - } - - /* Handle the different MC types */ - switch(curr_instance.mc.type) { - case RPL_DAG_MC_NONE: - break; - case RPL_DAG_MC_ETX: - curr_instance.mc.length = sizeof(curr_instance.mc.obj.etx); - curr_instance.mc.obj.etx = path_cost; - break; - case RPL_DAG_MC_ENERGY: - curr_instance.mc.length = sizeof(curr_instance.mc.obj.energy); - if(curr_instance.dag.rank == ROOT_RANK) { - type = RPL_DAG_MC_ENERGY_TYPE_MAINS; - } else { - type = RPL_DAG_MC_ENERGY_TYPE_BATTERY; - } - curr_instance.mc.obj.energy.flags = type << RPL_DAG_MC_ENERGY_TYPE; - /* Energy_est is only one byte, use the least significant byte of the path metric. */ - curr_instance.mc.obj.energy.energy_est = path_cost >> 8; - break; - default: - LOG_WARN("MRHOF, non-supported MC %u\n", curr_instance.mc.type); - break; - } -} -#endif /* RPL_WITH_MC */ -/*---------------------------------------------------------------------------*/ -rpl_of_t rpl_mrhof = { - reset, - nbr_link_metric, - nbr_has_usable_link, - nbr_is_acceptable_parent, - nbr_path_cost, - rank_via_nbr, - best_parent, - update_metric_container, - RPL_OCP_MRHOF -}; - -/** @}*/ diff --git a/os/net/routing/rpl-lite/rpl-nbr-policy.c b/os/net/routing/rpl-lite/rpl-nbr-policy.c deleted file mode 100644 index 188ceb648..000000000 --- a/os/net/routing/rpl-lite/rpl-nbr-policy.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2014-2015, Yanzi Networks AB. - * 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 holders 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 HOLDERS 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. - * - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * - * Default RPL NBR policy - * decides when to add a new discovered node to the nbr table from RPL. - * - * \author Joakim Eriksson - * Contributors: Niclas Finne , Oriol Piñol , - * - */ - -#include "net/routing/rpl-lite/rpl.h" -#include "net/nbr-table.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/* - * Policy for neighbor addition - * - one node is locked (default route) - * - max X "best parents" - * => at least MAX_NBRS - (X + 1) free slots for other. - * - * NOTE: this policy assumes that all neighbors end up being IPv6 - * neighbors and are not only MAC neighbors. - */ - -static int num_parents; /* all nodes that are possible parents */ -static int num_free; -static const linkaddr_t *worst_rank_nbr_lladdr; /* lladdr of the the neighbor with the worst rank */ -static rpl_rank_t worst_rank; - -/*---------------------------------------------------------------------------*/ -static void -update_state(void) -{ - uip_ds6_nbr_t *ds6_nbr; - rpl_nbr_t *rpl_nbr; - rpl_rank_t nbr_rank; - int num_used = 0; - - worst_rank = 0; - worst_rank_nbr_lladdr = NULL; - num_parents = 0; - - ds6_nbr = uip_ds6_nbr_head(); - while(ds6_nbr != NULL) { - - const linkaddr_t *nbr_lladdr = (const linkaddr_t *)uip_ds6_nbr_get_ll(ds6_nbr); - rpl_nbr = rpl_neighbor_get_from_lladdr((uip_lladdr_t *)nbr_lladdr); - - if(rpl_nbr != NULL && rpl_neighbor_is_parent(rpl_nbr)) { - num_parents++; - } - - nbr_rank = rpl_neighbor_rank_via_nbr(rpl_nbr); - /* Select worst-rank neighbor */ - if(rpl_nbr != curr_instance.dag.preferred_parent - && nbr_rank > worst_rank) { - /* This is the worst-rank neighbor - this is a good candidate for removal */ - worst_rank = nbr_rank; - worst_rank_nbr_lladdr = nbr_lladdr; - } - - ds6_nbr = uip_ds6_nbr_next(ds6_nbr); - num_used++; - } - /* how many more IP neighbors can be have? */ - num_free = NBR_TABLE_MAX_NEIGHBORS - num_used; - - LOG_DBG("nbr-policy: free: %d, parents: %d\n", num_free, num_parents); -} -/*---------------------------------------------------------------------------*/ -static const linkaddr_t * -find_worst_rank_nbr_lladdr(void) -{ - update_state(); - return worst_rank_nbr_lladdr; -} -/*---------------------------------------------------------------------------*/ -static const linkaddr_t * -find_removable_dio(uip_ipaddr_t *from, rpl_dio_t *dio) -{ - update_state(); - - if(!curr_instance.used || curr_instance.instance_id != dio->instance_id) { - LOG_WARN("nbr-policy: did not find instance id: %d\n", dio->instance_id); - return NULL; - } - - /* Add the new neighbor only if it is better than the current worst. */ - if(dio->rank + curr_instance.min_hoprankinc < worst_rank - curr_instance.min_hoprankinc / 2) { - /* Found *great* neighbor - add! */ - LOG_DBG("nbr-policy: DIO rank %u, worst_rank %u -- add to cache\n", - dio->rank, worst_rank); - return worst_rank_nbr_lladdr; - } - - LOG_DBG("nbr-policy: DIO rank %u, worst_rank %u -- do not add to cache\n", - dio->rank, worst_rank); - return NULL; -} -/*---------------------------------------------------------------------------*/ -const linkaddr_t * -rpl_nbr_policy_find_removable(nbr_table_reason_t reason, void *data) -{ - /* When we get the DIO/DAO/DIS we know that UIP contains the - incoming packet */ - switch(reason) { - case NBR_TABLE_REASON_RPL_DIO: - return find_removable_dio(&UIP_IP_BUF->srcipaddr, data); - case NBR_TABLE_REASON_RPL_DIS: - return find_worst_rank_nbr_lladdr(); - case NBR_TABLE_REASON_IPV6_ND_AUTOFILL: - return find_worst_rank_nbr_lladdr(); - default: - return NULL; - } -} -/*---------------------------------------------------------------------------*/ -/** @}*/ diff --git a/os/net/routing/rpl-lite/rpl-neighbor.c b/os/net/routing/rpl-lite/rpl-neighbor.c deleted file mode 100644 index 94a26fe75..000000000 --- a/os/net/routing/rpl-lite/rpl-neighbor.c +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * Logic for DAG neighbors in RPL. - * - * \author Joakim Eriksson , Nicolas Tsiftes , - * Simon Duquennoy - * Contributors: George Oikonomou (multicast) - */ - -#include "contiki.h" -#include "net/routing/rpl-lite/rpl.h" -#include "net/link-stats.h" -#include "net/nbr-table.h" -#include "net/ipv6/uiplib.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/* A configurable function called after every RPL parent switch */ -#ifdef RPL_CALLBACK_PARENT_SWITCH -void RPL_CALLBACK_PARENT_SWITCH(rpl_nbr_t *old, rpl_nbr_t *new); -#endif /* RPL_CALLBACK_PARENT_SWITCH */ - -static rpl_nbr_t * best_parent(int fresh_only); - -/*---------------------------------------------------------------------------*/ -/* Per-neighbor RPL information */ -NBR_TABLE_GLOBAL(rpl_nbr_t, rpl_neighbors); - -/*---------------------------------------------------------------------------*/ -static int -max_acceptable_rank(void) -{ - if(curr_instance.max_rankinc == 0) { - /* There is no max rank increment */ - return RPL_INFINITE_RANK; - } else { - /* Make sure not to exceed RPL_INFINITE_RANK */ - return MIN((uint32_t)curr_instance.dag.lowest_rank + curr_instance.max_rankinc, RPL_INFINITE_RANK); - } -} -/*---------------------------------------------------------------------------*/ -/* As per RFC 6550, section 8.2.2.4 */ -static int -acceptable_rank(rpl_rank_t rank) -{ - return rank != RPL_INFINITE_RANK - && rank >= ROOT_RANK - && rank <= max_acceptable_rank(); -} -/*---------------------------------------------------------------------------*/ -int -rpl_neighbor_snprint(char *buf, int buflen, rpl_nbr_t *nbr) -{ - int index = 0; - rpl_nbr_t *best = best_parent(0); - const struct link_stats *stats = rpl_neighbor_get_link_stats(nbr); - clock_time_t clock_now = clock_time(); - - if(LOG_WITH_COMPACT_ADDR) { - index += log_6addr_compact_snprint(buf+index, buflen-index, rpl_neighbor_get_ipaddr(nbr)); - } else { - index += uiplib_ipaddr_snprint(buf+index, buflen-index, rpl_neighbor_get_ipaddr(nbr)); - } - if(index >= buflen) { - return index; - } - index += snprintf(buf+index, buflen-index, - "%5u, %5u => %5u -- %2u %c%c%c%c%c", - nbr->rank, - rpl_neighbor_get_link_metric(nbr), - rpl_neighbor_rank_via_nbr(nbr), - stats != NULL ? stats->freshness : 0, - (nbr->rank == ROOT_RANK) ? 'r' : ' ', - nbr == best ? 'b' : ' ', - (acceptable_rank(rpl_neighbor_rank_via_nbr(nbr)) && rpl_neighbor_is_acceptable_parent(nbr)) ? 'a' : ' ', - link_stats_is_fresh(stats) ? 'f' : ' ', - nbr == curr_instance.dag.preferred_parent ? 'p' : ' ' - ); - if(index >= buflen) { - return index; - } - if(stats->last_tx_time > 0) { - index += snprintf(buf+index, buflen-index, - " (last tx %u min ago", - (unsigned)((clock_now - stats->last_tx_time) / (60 * CLOCK_SECOND))); - } else { - index += snprintf(buf+index, buflen-index, - " (no tx"); - } - if(index >= buflen) { - return index; - } - if(nbr->better_parent_since > 0) { - index += snprintf(buf+index, buflen-index, - ", better since %u min)", - (unsigned)((clock_now - nbr->better_parent_since) / (60 * CLOCK_SECOND))); - } else { - index += snprintf(buf+index, buflen-index, - ")"); - } - return index; -} -/*---------------------------------------------------------------------------*/ -void -rpl_neighbor_print_list(const char *str) -{ - if(curr_instance.used) { - int curr_dio_interval = curr_instance.dag.dio_intcurrent; - int curr_rank = curr_instance.dag.rank; - rpl_nbr_t *nbr = nbr_table_head(rpl_neighbors); - - LOG_INFO("nbr: own state, addr "); - LOG_INFO_6ADDR(rpl_get_global_address()); - LOG_INFO_(", DAG state: %s, MOP %u OCP %u rank %u max-rank %u, dioint %u, nbr count %u (%s)\n", - rpl_dag_state_to_str(curr_instance.dag.state), - curr_instance.mop, curr_instance.of->ocp, curr_rank, - max_acceptable_rank(), - curr_dio_interval, rpl_neighbor_count(), str); - while(nbr != NULL) { - char buf[120]; - rpl_neighbor_snprint(buf, sizeof(buf), nbr); - LOG_INFO("nbr: %s\n", buf); - nbr = nbr_table_next(rpl_neighbors, nbr); - } - LOG_INFO("nbr: end of list\n"); - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_neighbor_count(void) -{ - int count = 0; - rpl_nbr_t *nbr = nbr_table_head(rpl_neighbors); - for(nbr = nbr_table_head(rpl_neighbors); - nbr != NULL; - nbr = nbr_table_next(rpl_neighbors, nbr)) { - count++; - } - return count; -} -/*---------------------------------------------------------------------------*/ -#if UIP_ND6_SEND_NS -static uip_ds6_nbr_t * -rpl_get_ds6_nbr(rpl_nbr_t *nbr) -{ - const uip_lladdr_t *lladdr = (const uip_lladdr_t *)rpl_neighbor_get_lladdr(nbr); - if(lladdr != NULL) { - return uip_ds6_nbr_ll_lookup(lladdr); - } else { - return NULL; - } -} -#endif /* UIP_ND6_SEND_NS */ -/*---------------------------------------------------------------------------*/ -static void -remove_neighbor(rpl_nbr_t *nbr) -{ - /* Make sure we don't point to a removed neighbor. Note that we do not need - to worry about preferred_parent here, as it is locked in the the table - and will never be removed by external modules. */ - if(nbr == curr_instance.dag.urgent_probing_target) { - curr_instance.dag.urgent_probing_target = NULL; - } - if(nbr == curr_instance.dag.unicast_dio_target) { - curr_instance.dag.unicast_dio_target = NULL; - } - nbr_table_remove(rpl_neighbors, nbr); - rpl_timers_schedule_state_update(); /* Updating from here is unsafe; postpone */ -} -/*---------------------------------------------------------------------------*/ -rpl_nbr_t * -rpl_neighbor_get_from_lladdr(uip_lladdr_t *addr) -{ - return nbr_table_get_from_lladdr(rpl_neighbors, (linkaddr_t *)addr); -} -/*---------------------------------------------------------------------------*/ -int -rpl_neighbor_is_acceptable_parent(rpl_nbr_t *nbr) -{ - if(nbr != NULL && curr_instance.of->nbr_is_acceptable_parent != NULL) { - return curr_instance.of->nbr_is_acceptable_parent(nbr); - } - return 0xffff; -} -/*---------------------------------------------------------------------------*/ -uint16_t -rpl_neighbor_get_link_metric(rpl_nbr_t *nbr) -{ - if(nbr != NULL && curr_instance.of->nbr_link_metric != NULL) { - return curr_instance.of->nbr_link_metric(nbr); - } - return 0xffff; -} -/*---------------------------------------------------------------------------*/ -rpl_rank_t -rpl_neighbor_rank_via_nbr(rpl_nbr_t *nbr) -{ - if(nbr != NULL && curr_instance.of->rank_via_nbr != NULL) { - return curr_instance.of->rank_via_nbr(nbr); - } - return RPL_INFINITE_RANK; -} -/*---------------------------------------------------------------------------*/ -const linkaddr_t * -rpl_neighbor_get_lladdr(rpl_nbr_t *nbr) -{ - return nbr_table_get_lladdr(rpl_neighbors, nbr); -} -/*---------------------------------------------------------------------------*/ -uip_ipaddr_t * -rpl_neighbor_get_ipaddr(rpl_nbr_t *nbr) -{ - const linkaddr_t *lladdr = rpl_neighbor_get_lladdr(nbr); - return uip_ds6_nbr_ipaddr_from_lladdr((uip_lladdr_t *)lladdr); -} -/*---------------------------------------------------------------------------*/ -const struct link_stats * -rpl_neighbor_get_link_stats(rpl_nbr_t *nbr) -{ - const linkaddr_t *lladdr = rpl_neighbor_get_lladdr(nbr); - return link_stats_from_lladdr(lladdr); -} -/*---------------------------------------------------------------------------*/ -int -rpl_neighbor_is_fresh(rpl_nbr_t *nbr) -{ - const struct link_stats *stats = rpl_neighbor_get_link_stats(nbr); - return link_stats_is_fresh(stats); -} -/*---------------------------------------------------------------------------*/ -int -rpl_neighbor_is_reachable(rpl_nbr_t *nbr) { - if(nbr == NULL) { - return 0; - } else { -#if UIP_ND6_SEND_NS - uip_ds6_nbr_t *ds6_nbr = rpl_get_ds6_nbr(nbr); - /* Exclude links to a neighbor that is not reachable at a NUD level */ - if(ds6_nbr == NULL || ds6_nbr->state != NBR_REACHABLE) { - return 0; - } -#endif /* UIP_ND6_SEND_NS */ - /* If we don't have fresh link information, assume the nbr is reachable. */ - return !rpl_neighbor_is_fresh(nbr) || curr_instance.of->nbr_has_usable_link(nbr); - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_neighbor_is_parent(rpl_nbr_t *nbr) -{ - return nbr != NULL && nbr->rank < curr_instance.dag.rank; -} -/*---------------------------------------------------------------------------*/ -void -rpl_neighbor_set_preferred_parent(rpl_nbr_t *nbr) -{ - if(curr_instance.dag.preferred_parent != nbr) { - LOG_INFO("parent switch: "); - LOG_INFO_6ADDR(rpl_neighbor_get_ipaddr(curr_instance.dag.preferred_parent)); - LOG_INFO_(" -> "); - LOG_INFO_6ADDR(rpl_neighbor_get_ipaddr(nbr)); - LOG_INFO_("\n"); - -#ifdef RPL_CALLBACK_PARENT_SWITCH - RPL_CALLBACK_PARENT_SWITCH(curr_instance.dag.preferred_parent, nbr); -#endif /* RPL_CALLBACK_PARENT_SWITCH */ - - /* Always keep the preferred parent locked, so it remains in the - * neighbor table. */ - nbr_table_unlock(rpl_neighbors, curr_instance.dag.preferred_parent); - nbr_table_lock(rpl_neighbors, nbr); - - /* Update DS6 default route. Use an infinite lifetime */ - uip_ds6_defrt_rm(uip_ds6_defrt_lookup( - rpl_neighbor_get_ipaddr(curr_instance.dag.preferred_parent))); - uip_ds6_defrt_add(rpl_neighbor_get_ipaddr(nbr), 0); - - curr_instance.dag.preferred_parent = nbr; - } -} -/*---------------------------------------------------------------------------*/ -/* Remove DAG neighbors with a rank that is at least the same as minimum_rank. */ -void -rpl_neighbor_remove_all(void) -{ - rpl_nbr_t *nbr; - - LOG_INFO("removing all neighbors\n"); - - nbr = nbr_table_head(rpl_neighbors); - while(nbr != NULL) { - remove_neighbor(nbr); - nbr = nbr_table_next(rpl_neighbors, nbr); - } - - /* Update needed immediately so as to ensure preferred_parent becomes NULL, - * and no longer points to a de-allocated neighbor. */ - rpl_dag_update_state(); -} -/*---------------------------------------------------------------------------*/ -rpl_nbr_t * -rpl_neighbor_get_from_ipaddr(uip_ipaddr_t *addr) -{ - uip_ds6_nbr_t *ds6_nbr = uip_ds6_nbr_lookup(addr); - const uip_lladdr_t *lladdr = uip_ds6_nbr_get_ll(ds6_nbr); - return nbr_table_get_from_lladdr(rpl_neighbors, (linkaddr_t *)lladdr); -} -/*---------------------------------------------------------------------------*/ -static rpl_nbr_t * -best_parent(int fresh_only) -{ - rpl_nbr_t *nbr; - rpl_nbr_t *best = NULL; - - if(curr_instance.used == 0) { - return NULL; - } - - /* Search for the best parent according to the OF */ - for(nbr = nbr_table_head(rpl_neighbors); nbr != NULL; nbr = nbr_table_next(rpl_neighbors, nbr)) { - - if(!acceptable_rank(nbr->rank) || !curr_instance.of->nbr_is_acceptable_parent(nbr)) { - /* Exclude neighbors with a rank that is not acceptable) */ - continue; - } - - if(fresh_only && !rpl_neighbor_is_fresh(nbr)) { - /* Filter out non-fresh nerighbors if fresh_only is set */ - continue; - } - -#if UIP_ND6_SEND_NS - { - uip_ds6_nbr_t *ds6_nbr = rpl_get_ds6_nbr(nbr); - /* Exclude links to a neighbor that is not reachable at a NUD level */ - if(ds6_nbr == NULL || ds6_nbr->state != NBR_REACHABLE) { - continue; - } - } -#endif /* UIP_ND6_SEND_NS */ - - /* Now we have an acceptable parent, check if it is the new best */ - best = curr_instance.of->best_parent(best, nbr); - } - - return best; -} -/*---------------------------------------------------------------------------*/ -rpl_nbr_t * -rpl_neighbor_select_best(void) -{ - rpl_nbr_t *best; - - if(rpl_dag_root_is_root()) { - return NULL; /* The root has no parent */ - } - - /* Look for best parent (regardless of freshness) */ - best = best_parent(0); - -#if RPL_WITH_PROBING - if(best != NULL) { - if(rpl_neighbor_is_fresh(best)) { - /* Unschedule any already scheduled urgent probing */ - curr_instance.dag.urgent_probing_target = NULL; - /* Return best if it is fresh */ - return best; - } else { - rpl_nbr_t *best_fresh; - - /* The best is not fresh. Probe it (unless there is already an urgent - probing target). We will be called back after the probing anyway. */ - if(curr_instance.dag.urgent_probing_target == NULL) { - LOG_INFO("best parent is not fresh, schedule urgent probing to "); - LOG_INFO_6ADDR(rpl_neighbor_get_ipaddr(best)); - LOG_INFO_("\n"); - curr_instance.dag.urgent_probing_target = best; - rpl_schedule_probing_now(); - } - - /* The best is our preferred parent. It is not fresh but used to be, - else we would not have selected it in the first place. Stick to it - for a little while and rely on urgent probing to make a call. */ - if(best == curr_instance.dag.preferred_parent) { - return best; - } - - /* Look for the best fresh parent. */ - best_fresh = best_parent(1); - if(best_fresh == NULL) { - if(curr_instance.dag.preferred_parent == NULL) { - /* We will wait to find a fresh node before selecting our first parent */ - return NULL; - } else { - /* We already have a parent, now stick to the best and count on - urgent probing to get a fresh parent soon */ - return best; - } - } else { - /* Select best fresh */ - return best_fresh; - } - } - } else { - /* No acceptable parent */ - return NULL; - } -#else /* RPL_WITH_PROBING */ - return best; -#endif /* RPL_WITH_PROBING */ -} -/*---------------------------------------------------------------------------*/ -void -rpl_neighbor_init(void) -{ - nbr_table_register(rpl_neighbors, (nbr_table_callback *)remove_neighbor); -} -/** @} */ diff --git a/os/net/routing/rpl-lite/rpl-neighbor.h b/os/net/routing/rpl-lite/rpl-neighbor.h deleted file mode 100644 index 31ed02cd2..000000000 --- a/os/net/routing/rpl-lite/rpl-neighbor.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - - /** - * \addtogroup rpl-lite - * @{ - * - * \file - * Header file for rpl-neighbor module - * \author - * Joakim Eriksson , Nicolas Tsiftes , - * Simon DUquennoy - * - */ - -#ifndef RPL_NEIGHBOR_H -#define RPL_NEIGHBOR_H - -/********** Includes **********/ - -#include "net/routing/rpl-lite/rpl.h" -#include "lib/list.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "sys/ctimer.h" - -/********** Public symbols **********/ - -/* Per-neighbor RPL information. According to RFC 6550, there exist three - * types of neighbors: - * - Candidate neighbor set: any neighbor, selected in an implementation - * and OF-specific way. The nodes in rpl_neighbors constitute the candidate neighbor set. - * - Parent set: the subset of the candidate neighbor set with rank below our rank - * - Preferred parent: one node of the parent set - */ -NBR_TABLE_DECLARE(rpl_neighbors); - -/********** Public functions **********/ - -/** - * Initialize rpl-dag-neighbor module -*/ -void rpl_neighbor_init(void); - -/** - * Tells whether a neighbor is in the parent set. - * - * \param nbr The neighbor to be tested - * \return 1 if nbr is in the parent set, 0 otherwise - */ -int rpl_neighbor_is_parent(rpl_nbr_t *nbr); - -/** - * Set current RPL preferred parent and update DS6 default route accordingly - * - * \param nbr The new preferred parent -*/ -void rpl_neighbor_set_preferred_parent(rpl_nbr_t *nbr); - -/** - * Tells wether we have fresh link information towards a given neighbor - * - * \param nbr The neighbor - * \return 1 if we have fresh link information, 0 otherwise -*/ -int rpl_neighbor_is_fresh(rpl_nbr_t *nbr); - -/** - * Tells wether we a given neighbor is reachable - * - * \param nbr The neighbor - * \return 1 if the parent is reachable, 0 otherwise -*/ -int rpl_neighbor_is_reachable(rpl_nbr_t *nbr); - -/** - * Tells whether a nbr is acceptable as per the OF's definition - * - * \param nbr The neighbor - * \return 1 if acceptable, 0 otherwise -*/ -int rpl_neighbor_is_acceptable_parent(rpl_nbr_t *nbr); - -/** - * Returns a neighbor's link metric - * - * \param nbr The neighbor - * \return The link metric if any, 0xffff otherwise -*/ -uint16_t rpl_neighbor_get_link_metric(rpl_nbr_t *nbr); - -/** - * Returns our rank if selecting a given parent as preferred parent - * - * \param nbr The neighbor - * \return The resulting rank if any, RPL_INFINITE_RANK otherwise -*/ -rpl_rank_t rpl_neighbor_rank_via_nbr(rpl_nbr_t *nbr); - -/** - * Returns a neighbors's link-layer address - * - * \param nbr The neighbor - * \return The link-layer address if any, NULL otherwise -*/ -const linkaddr_t *rpl_neighbor_get_lladdr(rpl_nbr_t *nbr); - -/** - * Returns a neighbor's link statistics - * - * \param nbr The neighbor - * \return The link_stats structure address if any, NULL otherwise -*/ -const struct link_stats *rpl_neighbor_get_link_stats(rpl_nbr_t *nbr); - -/** - * Returns a neighbor's (link-local) IPv6 address - * - * \param nbr The neighbor - * \return The link-local IPv6 address if any, NULL otherwise -*/ -uip_ipaddr_t *rpl_neighbor_get_ipaddr(rpl_nbr_t *nbr); - -/** - * Returns a neighbor from its link-layer address - * - * \param addr The link-layer address - * \return The neighbor if found, NULL otherwise -*/ -rpl_nbr_t *rpl_neighbor_get_from_lladdr(uip_lladdr_t *addr); - -/** - * Returns a neighbor from its link-local IPv6 address - * - * \param addr The link-local IPv6 address - * \return The neighbor if found, NULL otherwise -*/ -rpl_nbr_t *rpl_neighbor_get_from_ipaddr(uip_ipaddr_t *addr); - -/** - * Returns the number of nodes in the RPL neighbor table - * - * \return the neighbor count -*/ -int rpl_neighbor_count(void); - -/** - * Prints a summary of all RPL neighbors and their properties - * - * \param str A descriptive text on the caller -*/ -void rpl_neighbor_print_list(const char *str); - -/** - * Empty the RPL neighbor table -*/ -void rpl_neighbor_remove_all(void); - -/** - * Returns the best candidate for preferred parent - * - * \return The best candidate, NULL if no usable parent is found -*/ -rpl_nbr_t *rpl_neighbor_select_best(void); - -/** -* Print a textual description of RPL neighbor into a string -* -* \param buf The buffer where to write content -* \param buflen The buffer len -* \param nbr A pointer to a RPL neighbor that will be written to the buffer -* \return Identical to snprintf: number of bytes written excluding ending null -* byte. A value >= buflen if the buffer was too small. -*/ -int rpl_neighbor_snprint(char *buf, int buflen, rpl_nbr_t *nbr); - -typedef rpl_nbr_t rpl_parent_t; -#define rpl_parent_get_from_ipaddr(addr) rpl_neighbor_get_from_ipaddr(addr) -#define rpl_parent_get_ipaddr(nbr) rpl_neighbor_get_ipaddr(nbr) - /** @} */ - -#endif /* RPL_NEIGHBOR_H */ diff --git a/os/net/routing/rpl-lite/rpl-of0.c b/os/net/routing/rpl-lite/rpl-of0.c deleted file mode 100644 index c6f820157..000000000 --- a/os/net/routing/rpl-lite/rpl-of0.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * An implementation of RPL's objective function 0, RFC6552 - * - * \author Joakim Eriksson , Nicolas Tsiftes - * Simon Duquennoy - */ - -#include "net/routing/rpl-lite/rpl.h" -#include "net/nbr-table.h" -#include "net/link-stats.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/* Constants from RFC6552. We use the default values. */ -#define RANK_STRETCH 0 /* Must be in the range [0;5] */ -#define RANK_FACTOR 1 /* Must be in the range [1;4] */ - -#define MIN_STEP_OF_RANK 1 -#define MAX_STEP_OF_RANK 9 - -/* OF0 computes rank increase as follows: - * rank_increase = (RANK_FACTOR * STEP_OF_RANK + RANK_STRETCH) * min_hop_rank_increase - * STEP_OF_RANK is an implementation-specific scalar value in the range [1;9]. - * RFC6552 provides a default value of 3 but recommends to use a dynamic link metric - * such as ETX. - * */ - -#define RPL_OF0_FIXED_SR 0 -#define RPL_OF0_ETX_BASED_SR 1 -/* Select RPL_OF0_FIXED_SR or RPL_OF0_ETX_BASED_SR */ -#ifdef RPL_OF0_CONF_SR -#define RPL_OF0_SR RPL_OF0_CONF_SR -#else /* RPL_OF0_CONF_SR */ -#define RPL_OF0_SR RPL_OF0_ETX_BASED_SR -#endif /* RPL_OF0_CONF_SR */ - -#if RPL_OF0_FIXED_SR -#define STEP_OF_RANK(nbr) (3) -#endif /* RPL_OF0_FIXED_SR */ - -#if RPL_OF0_ETX_BASED_SR -/* Numbers suggested by P. Thubert for in the 6TiSCH WG. Anything that maps ETX to - * a step between 1 and 9 works. */ -#define STEP_OF_RANK(nbr) (((3 * nbr_link_metric(nbr)) / LINK_STATS_ETX_DIVISOR) - 2) -#endif /* RPL_OF0_ETX_BASED_SR */ - -/*---------------------------------------------------------------------------*/ -static void -reset(void) -{ - LOG_INFO("reset OF0\n"); -} -/*---------------------------------------------------------------------------*/ -static uint16_t -nbr_link_metric(rpl_nbr_t *nbr) -{ - /* OF0 operates without metric container; the only metric we have is ETX */ - const struct link_stats *stats = rpl_neighbor_get_link_stats(nbr); - return stats != NULL ? stats->etx : 0xffff; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -nbr_rank_increase(rpl_nbr_t *nbr) -{ - uint16_t min_hoprankinc; - if(nbr == NULL) { - return RPL_INFINITE_RANK; - } - min_hoprankinc = curr_instance.min_hoprankinc; - return (RANK_FACTOR * STEP_OF_RANK(nbr) + RANK_STRETCH) * min_hoprankinc; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -nbr_path_cost(rpl_nbr_t *nbr) -{ - if(nbr == NULL) { - return 0xffff; - } - /* path cost upper bound: 0xffff */ - return MIN((uint32_t)nbr->rank + nbr_link_metric(nbr), 0xffff); -} -/*---------------------------------------------------------------------------*/ -static rpl_rank_t -rank_via_nbr(rpl_nbr_t *nbr) -{ - if(nbr == NULL) { - return RPL_INFINITE_RANK; - } else { - return MIN((uint32_t)nbr->rank + nbr_rank_increase(nbr), RPL_INFINITE_RANK); - } -} -/*---------------------------------------------------------------------------*/ -static int -nbr_has_usable_link(rpl_nbr_t *nbr) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -nbr_is_acceptable_parent(rpl_nbr_t *nbr) -{ - return STEP_OF_RANK(nbr) >= MIN_STEP_OF_RANK - && STEP_OF_RANK(nbr) <= MAX_STEP_OF_RANK; -} -/*---------------------------------------------------------------------------*/ -static rpl_nbr_t * -best_parent(rpl_nbr_t *nbr1, rpl_nbr_t *nbr2) -{ - uint16_t nbr1_cost; - uint16_t nbr2_cost; - int nbr1_is_acceptable; - int nbr2_is_acceptable; - - nbr1_is_acceptable = nbr1 != NULL && nbr_is_acceptable_parent(nbr1); - nbr2_is_acceptable = nbr2 != NULL && nbr_is_acceptable_parent(nbr2); - - if(!nbr1_is_acceptable) { - return nbr2_is_acceptable ? nbr2 : NULL; - } - if(!nbr2_is_acceptable) { - return nbr1_is_acceptable ? nbr1 : NULL; - } - - nbr1_cost = nbr_path_cost(nbr1); - nbr2_cost = nbr_path_cost(nbr2); - - /* Paths costs coarse-grained (multiple of min_hoprankinc), we operate without hysteresis */ - if(nbr1_cost != nbr2_cost) { - /* Pick nbr with lowest path cost */ - return nbr1_cost < nbr2_cost ? nbr1 : nbr2; - } else { - /* We have a tie! */ - /* Stik to current preferred parent if possible */ - if(nbr1 == curr_instance.dag.preferred_parent || nbr2 == curr_instance.dag.preferred_parent) { - return curr_instance.dag.preferred_parent; - } - /* None of the nodes is the current preferred parent, - * choose nbr with best link metric */ - return nbr_link_metric(nbr1) < nbr_link_metric(nbr2) ? nbr1 : nbr2; - } -} -/*---------------------------------------------------------------------------*/ -static void -update_metric_container(void) -{ - curr_instance.mc.type = RPL_DAG_MC_NONE; -} -/*---------------------------------------------------------------------------*/ -rpl_of_t rpl_of0 = { - reset, - nbr_link_metric, - nbr_has_usable_link, - nbr_is_acceptable_parent, - nbr_path_cost, - rank_via_nbr, - best_parent, - update_metric_container, - RPL_OCP_OF0 -}; - -/** @}*/ diff --git a/os/net/routing/rpl-lite/rpl-timers.c b/os/net/routing/rpl-lite/rpl-timers.c deleted file mode 100644 index 169226fd5..000000000 --- a/os/net/routing/rpl-lite/rpl-timers.c +++ /dev/null @@ -1,570 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * RPL timer management. - * - * \author Joakim Eriksson , Nicolas Tsiftes , - * Simon Duquennoy - */ - -#include "contiki.h" -#include "net/routing/rpl-lite/rpl.h" -#include "net/ipv6/uip-sr.h" -#include "net/link-stats.h" -#include "lib/random.h" -#include "sys/ctimer.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -/* A configurable function called after update of the RPL DIO interval */ -#ifdef RPL_CALLBACK_NEW_DIO_INTERVAL -void RPL_CALLBACK_NEW_DIO_INTERVAL(clock_time_t dio_interval); -#endif /* RPL_CALLBACK_NEW_DIO_INTERVAL */ - -#ifdef RPL_PROBING_SELECT_FUNC -rpl_nbr_t *RPL_PROBING_SELECT_FUNC(void); -#endif /* RPL_PROBING_SELECT_FUNC */ - -#ifdef RPL_PROBING_DELAY_FUNC -clock_time_t RPL_PROBING_DELAY_FUNC(void); -#endif /* RPL_PROBING_DELAY_FUNC */ - -#define PERIODIC_DELAY_SECONDS 60 -#define PERIODIC_DELAY ((PERIODIC_DELAY_SECONDS) * CLOCK_SECOND) - -static void handle_dis_timer(void *ptr); -static void handle_dio_timer(void *ptr); -static void handle_unicast_dio_timer(void *ptr); -static void send_new_dao(void *ptr); -#if RPL_WITH_DAO_ACK -static void resend_dao(void *ptr); -static void handle_dao_ack_timer(void *ptr); -#endif /* RPL_WITH_DAO_ACK */ -#if RPL_WITH_PROBING -static void handle_probing_timer(void *ptr); -#endif /* RPL_WITH_PROBING */ -static void handle_periodic_timer(void *ptr); -static void handle_state_update(void *ptr); - -/*---------------------------------------------------------------------------*/ -static struct ctimer dis_timer; /* Not part of a DAG because when not joined */ -static struct ctimer periodic_timer; /* Not part of a DAG because used for general state maintenance */ - -/*---------------------------------------------------------------------------*/ -/*------------------------------- DIS -------------------------------------- */ -/*---------------------------------------------------------------------------*/ -void -rpl_timers_schedule_periodic_dis(void) -{ - if(ctimer_expired(&dis_timer)) { - clock_time_t expiration_time = RPL_DIS_INTERVAL / 2 + (random_rand() % (RPL_DIS_INTERVAL)); - ctimer_set(&dis_timer, expiration_time, handle_dis_timer, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -handle_dis_timer(void *ptr) -{ - if(!rpl_dag_root_is_root() && - (!curr_instance.used || - curr_instance.dag.preferred_parent == NULL || - curr_instance.dag.rank == RPL_INFINITE_RANK)) { - /* Send DIS and schedule next */ - rpl_icmp6_dis_output(NULL); - rpl_timers_schedule_periodic_dis(); - } -} -/*---------------------------------------------------------------------------*/ -/*------------------------------- DIO -------------------------------------- */ -/*---------------------------------------------------------------------------*/ -static void -new_dio_interval(void) -{ - uint32_t time; - clock_time_t ticks; - - time = 1UL << curr_instance.dag.dio_intcurrent; - - /* Convert from milliseconds to CLOCK_TICKS. */ - ticks = (time * CLOCK_SECOND) / 1000; - curr_instance.dag.dio_next_delay = ticks; - - /* random number between I/2 and I */ - ticks = ticks / 2 + (ticks / 2 * (uint32_t)random_rand()) / RANDOM_RAND_MAX; - - /* - * The intervals must be equally long among the nodes for Trickle to - * operate efficiently. Therefore we need to calculate the delay between - * the randomized time and the start time of the next interval. - */ - curr_instance.dag.dio_next_delay -= ticks; - curr_instance.dag.dio_send = 1; - /* reset the redundancy counter */ - curr_instance.dag.dio_counter = 0; - - /* schedule the timer */ - ctimer_set(&curr_instance.dag.dio_timer, ticks, &handle_dio_timer, NULL); - -#ifdef RPL_CALLBACK_NEW_DIO_INTERVAL - RPL_CALLBACK_NEW_DIO_INTERVAL((CLOCK_SECOND * 1UL << curr_instance.dag.dio_intcurrent) / 1000); -#endif /* RPL_CALLBACK_NEW_DIO_INTERVAL */ -} -/*---------------------------------------------------------------------------*/ -void -rpl_timers_dio_reset(const char *str) -{ - if(rpl_dag_ready_to_advertise()) { - LOG_INFO("reset DIO timer (%s)\n", str); - if(!rpl_get_leaf_only()) { - curr_instance.dag.dio_counter = 0; - curr_instance.dag.dio_intcurrent = curr_instance.dio_intmin; - new_dio_interval(); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -handle_dio_timer(void *ptr) -{ - if(!rpl_dag_ready_to_advertise()) { - return; /* We will be scheduled again later */ - } - - if(curr_instance.dag.dio_send) { - /* send DIO if counter is less than desired redundancy, or if dio_redundancy - is set to 0, or if we are the root */ - if(rpl_dag_root_is_root() || curr_instance.dio_redundancy == 0 || - curr_instance.dag.dio_counter < curr_instance.dio_redundancy) { -#if RPL_TRICKLE_REFRESH_DAO_ROUTES - if(rpl_dag_root_is_root()) { - static int count = 0; - if((count++ % RPL_TRICKLE_REFRESH_DAO_ROUTES) == 0) { - /* Request new DAO to refresh route. */ - RPL_LOLLIPOP_INCREMENT(curr_instance.dtsn_out); - LOG_INFO("trigger DAO updates with a DTSN increment (%u)\n", curr_instance.dtsn_out); - } - } -#endif /* RPL_TRICKLE_REFRESH_DAO_ROUTES */ - curr_instance.dag.last_advertised_rank = curr_instance.dag.rank; - rpl_icmp6_dio_output(NULL); - } - curr_instance.dag.dio_send = 0; - ctimer_set(&curr_instance.dag.dio_timer, curr_instance.dag.dio_next_delay, handle_dio_timer, NULL); - } else { - /* check if we need to double interval */ - if(curr_instance.dag.dio_intcurrent < curr_instance.dio_intmin + curr_instance.dio_intdoubl) { - curr_instance.dag.dio_intcurrent++; - } - new_dio_interval(); - } -} -/*---------------------------------------------------------------------------*/ -/*------------------------------- Unicast DIO ------------------------------ */ -/*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -void -rpl_timers_schedule_unicast_dio(rpl_nbr_t *target) -{ - if(curr_instance.used) { - curr_instance.dag.unicast_dio_target = target; - ctimer_set(&curr_instance.dag.unicast_dio_timer, 0, - handle_unicast_dio_timer, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -handle_unicast_dio_timer(void *ptr) -{ - uip_ipaddr_t *target_ipaddr = rpl_neighbor_get_ipaddr(curr_instance.dag.unicast_dio_target); - if(target_ipaddr != NULL) { - rpl_icmp6_dio_output(target_ipaddr); - } -} -/*---------------------------------------------------------------------------*/ -/*------------------------------- DAO -------------------------------------- */ -/*---------------------------------------------------------------------------*/ -#if RPL_WITH_DAO_ACK -/*---------------------------------------------------------------------------*/ -static void -schedule_dao_retransmission(void) -{ - clock_time_t expiration_time = RPL_DAO_RETRANSMISSION_TIMEOUT / 2 + (random_rand() % (RPL_DAO_RETRANSMISSION_TIMEOUT)); - ctimer_set(&curr_instance.dag.dao_timer, expiration_time, resend_dao, NULL); -} -#endif /* RPL_WITH_DAO_ACK */ -/*---------------------------------------------------------------------------*/ -static void -schedule_dao_refresh(void) -{ - if(curr_instance.used && curr_instance.default_lifetime != RPL_INFINITE_LIFETIME) { -#if RPL_WITH_DAO_ACK - /* DAO-ACK enabled: the last DAO was ACKed, wait until expiration before refresh */ - clock_time_t target_refresh = CLOCK_SECOND * RPL_LIFETIME(curr_instance.default_lifetime); -#else /* RPL_WITH_DAO_ACK */ - /* DAO-ACK disabled: use half the expiration time to get two chances to refresh per lifetime */ - clock_time_t target_refresh = (CLOCK_SECOND * RPL_LIFETIME(curr_instance.default_lifetime) / 2); -#endif /* RPL_WITH_DAO_ACK */ - - /* Send between 60 and 120 seconds before target refresh */ - clock_time_t safety_margin = (60 * CLOCK_SECOND) + (random_rand() % (60 * CLOCK_SECOND)); - - if(target_refresh > safety_margin) { - target_refresh -= safety_margin; - } - - /* Schedule transmission */ - ctimer_set(&curr_instance.dag.dao_timer, target_refresh, send_new_dao, NULL); - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_timers_schedule_dao(void) -{ - if(curr_instance.used && curr_instance.mop != RPL_MOP_NO_DOWNWARD_ROUTES) { - /* No need for DAO aggregation delay as per RFC 6550 section 9.5, as this - * only serves storing mode. Use simple delay instead, with the only purpose - * to reduce congestion. */ - clock_time_t expiration_time = RPL_DAO_DELAY / 2 + (random_rand() % (RPL_DAO_DELAY)); - ctimer_set(&curr_instance.dag.dao_timer, expiration_time, send_new_dao, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -send_new_dao(void *ptr) -{ -#if RPL_WITH_DAO_ACK - /* We are sending a new DAO here. Prepare retransmissions */ - curr_instance.dag.dao_transmissions = 1; - /* Schedule next retransmission */ - schedule_dao_retransmission(); -#else /* RPL_WITH_DAO_ACK */ - /* No DAO-ACK: assume we are reachable as soon as we send a DAO */ - if(curr_instance.dag.state == DAG_JOINED) { - curr_instance.dag.state = DAG_REACHABLE; - } - rpl_timers_dio_reset("Reachable"); - /* There is no DAO-ACK, schedule a refresh. */ - schedule_dao_refresh(); -#endif /* !RPL_WITH_DAO_ACK */ - - /* Increment seqno */ - RPL_LOLLIPOP_INCREMENT(curr_instance.dag.dao_last_seqno); - /* Send a DAO with own prefix as target and default lifetime */ - rpl_icmp6_dao_output(curr_instance.default_lifetime); -} -#if RPL_WITH_DAO_ACK -/*---------------------------------------------------------------------------*/ -/*------------------------------- DAO-ACK ---------------------------------- */ -/*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -void -rpl_timers_schedule_dao_ack(uip_ipaddr_t *target, uint16_t sequence) -{ - if(curr_instance.used) { - uip_ipaddr_copy(&curr_instance.dag.dao_ack_target, target); - curr_instance.dag.dao_ack_sequence = sequence; - ctimer_set(&curr_instance.dag.dao_ack_timer, 0, handle_dao_ack_timer, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -handle_dao_ack_timer(void *ptr) -{ - rpl_icmp6_dao_ack_output(&curr_instance.dag.dao_ack_target, - curr_instance.dag.dao_ack_sequence, RPL_DAO_ACK_UNCONDITIONAL_ACCEPT); -} -/*---------------------------------------------------------------------------*/ -void -rpl_timers_notify_dao_ack(void) -{ - /* The last DAO was ACKed. Schedule refresh to avoid route expiration. This - implicitly de-schedules resend_dao, as both share curr_instance.dag.dao_timer */ - schedule_dao_refresh(); -} -/*---------------------------------------------------------------------------*/ -static void -resend_dao(void *ptr) -{ - /* Increment transmission counter before sending */ - curr_instance.dag.dao_transmissions++; - /* Send a DAO with own prefix as target and default lifetime */ - rpl_icmp6_dao_output(curr_instance.default_lifetime); - - /* Schedule next retransmission, or abort */ - if(curr_instance.dag.dao_transmissions < RPL_DAO_MAX_RETRANSMISSIONS) { - schedule_dao_retransmission(); - } else { - /* No more retransmissions. Perform local repair. */ - rpl_local_repair("DAO max rtx"); - return; - } -} -#endif /* RPL_WITH_DAO_ACK */ -/*---------------------------------------------------------------------------*/ -/*------------------------------- Probing----------------------------------- */ -/*---------------------------------------------------------------------------*/ -#if RPL_WITH_PROBING -clock_time_t -get_probing_delay(void) -{ - return ((RPL_PROBING_INTERVAL) / 2) + random_rand() % (RPL_PROBING_INTERVAL); -} -/*---------------------------------------------------------------------------*/ -rpl_nbr_t * -get_probing_target(void) -{ - /* Returns the next probing target. The current implementation probes the urgent - * probing target if any, or the preferred parent if its link statistics need refresh. - * Otherwise, it picks at random between: - * (1) selecting the best neighbor with non-fresh link statistics - * (2) selecting the least recently updated neighbor - */ - - rpl_nbr_t *nbr; - rpl_nbr_t *probing_target = NULL; - rpl_rank_t probing_target_rank = RPL_INFINITE_RANK; - clock_time_t probing_target_age = 0; - clock_time_t clock_now = clock_time(); - - if(curr_instance.used == 0) { - return NULL; - } - - /* There is an urgent probing target */ - if(curr_instance.dag.urgent_probing_target != NULL) { - return curr_instance.dag.urgent_probing_target; - } - - /* The preferred parent needs probing */ - if(curr_instance.dag.preferred_parent != NULL && !rpl_neighbor_is_fresh(curr_instance.dag.preferred_parent)) { - return curr_instance.dag.preferred_parent; - } - - /* Now consider probing other non-fresh neighbors. With 2/3 proabability, - pick the best non-fresh. Otherwise, pick the lest recently updated non-fresh. */ - - if(random_rand() % 3 != 0) { - /* Look for best non-fresh */ - nbr = nbr_table_head(rpl_neighbors); - while(nbr != NULL) { - if(!rpl_neighbor_is_fresh(nbr)) { - /* nbr needs probing */ - rpl_rank_t nbr_rank = rpl_neighbor_rank_via_nbr(nbr); - if(probing_target == NULL - || nbr_rank < probing_target_rank) { - probing_target = nbr; - probing_target_rank = nbr_rank; - } - } - nbr = nbr_table_next(rpl_neighbors, nbr); - } - } else { - /* Look for least recently updated non-fresh */ - nbr = nbr_table_head(rpl_neighbors); - while(nbr != NULL) { - if(!rpl_neighbor_is_fresh(nbr)) { - /* nbr needs probing */ - const struct link_stats *stats = rpl_neighbor_get_link_stats(nbr); - if(stats != NULL) { - if(probing_target == NULL - || clock_now - stats->last_tx_time > probing_target_age) { - probing_target = nbr; - probing_target_age = clock_now - stats->last_tx_time; - } - } - } - nbr = nbr_table_next(rpl_neighbors, nbr); - } - } - - return probing_target; -} -/*---------------------------------------------------------------------------*/ -static void -handle_probing_timer(void *ptr) -{ - rpl_nbr_t *probing_target = RPL_PROBING_SELECT_FUNC(); - uip_ipaddr_t *target_ipaddr = rpl_neighbor_get_ipaddr(probing_target); - - /* Perform probing */ - if(target_ipaddr != NULL) { - const struct link_stats *stats = rpl_neighbor_get_link_stats(probing_target); - (void)stats; - LOG_INFO("probing "); - LOG_INFO_6ADDR(target_ipaddr); - LOG_INFO_(" %s last tx %u min ago\n", - curr_instance.dag.urgent_probing_target != NULL ? "(urgent)" : "", - stats != NULL ? - (unsigned)((clock_time() - stats->last_tx_time) / (60 * CLOCK_SECOND)) : 0 - ); - /* Send probe, e.g. unicast DIO or DIS */ - RPL_PROBING_SEND_FUNC(target_ipaddr); - /* urgent_probing_target will be NULLed in the packet_sent callback */ - } else { - LOG_INFO("no neighbor needs probing\n"); - } - - /* Schedule next probing */ - rpl_schedule_probing(); -} -/*---------------------------------------------------------------------------*/ -void -rpl_schedule_probing(void) -{ - if(curr_instance.used) { - ctimer_set(&curr_instance.dag.probing_timer, RPL_PROBING_DELAY_FUNC(), - handle_probing_timer, NULL); - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_schedule_probing_now(void) -{ - if(curr_instance.used) { - ctimer_set(&curr_instance.dag.probing_timer, - random_rand() % (CLOCK_SECOND * 4), handle_probing_timer, NULL); - } -} -#endif /* RPL_WITH_PROBING */ -/*---------------------------------------------------------------------------*/ -/*------------------------------- Leaving-- -------------------------------- */ -/*---------------------------------------------------------------------------*/ -static void -handle_leaving_timer(void *ptr) -{ - if(curr_instance.used) { - rpl_dag_leave(); - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_timers_unschedule_leaving(void) -{ - if(curr_instance.used) { - if(!ctimer_expired(&curr_instance.dag.leave)) { - ctimer_stop(&curr_instance.dag.leave); - } - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_timers_schedule_leaving(void) -{ - if(curr_instance.used) { - if(ctimer_expired(&curr_instance.dag.leave)) { - ctimer_set(&curr_instance.dag.leave, RPL_DELAY_BEFORE_LEAVING, handle_leaving_timer, NULL); - } - } -} -/*---------------------------------------------------------------------------*/ -/*------------------------------- Periodic---------------------------------- */ -/*---------------------------------------------------------------------------*/ -void -rpl_timers_init(void) -{ - ctimer_set(&periodic_timer, PERIODIC_DELAY, handle_periodic_timer, NULL); - rpl_timers_schedule_periodic_dis(); -} -/*---------------------------------------------------------------------------*/ -static void -handle_periodic_timer(void *ptr) -{ - if(curr_instance.used) { - rpl_dag_periodic(PERIODIC_DELAY_SECONDS); - uip_sr_periodic(PERIODIC_DELAY_SECONDS); - } - - if(!curr_instance.used || - curr_instance.dag.preferred_parent == NULL || - curr_instance.dag.rank == RPL_INFINITE_RANK) { - rpl_timers_schedule_periodic_dis(); /* Schedule DIS if needed */ - } - - /* Useful because part of the state update is time-dependent, e.g., - the meaning of last_advertised_rank changes with time */ - rpl_dag_update_state(); - - if(LOG_INFO_ENABLED) { - rpl_neighbor_print_list("Periodic"); - rpl_dag_root_print_links("Periodic"); - } - - ctimer_reset(&periodic_timer); -} -/*---------------------------------------------------------------------------*/ -void -rpl_timers_stop_dag_timers(void) -{ - /* Stop all timers related to the DAG */ - ctimer_stop(&curr_instance.dag.state_update); - ctimer_stop(&curr_instance.dag.leave); - ctimer_stop(&curr_instance.dag.dio_timer); - ctimer_stop(&curr_instance.dag.unicast_dio_timer); - ctimer_stop(&curr_instance.dag.dao_timer); -#if RPL_WITH_PROBING - ctimer_stop(&curr_instance.dag.probing_timer); -#endif /* RPL_WITH_PROBING */ -#if RPL_WITH_DAO_ACK - ctimer_stop(&curr_instance.dag.dao_ack_timer); -#endif /* RPL_WITH_DAO_ACK */ -} -/*---------------------------------------------------------------------------*/ -void -rpl_timers_unschedule_state_update(void) -{ - if(curr_instance.used) { - ctimer_stop(&curr_instance.dag.state_update); - } -} -/*---------------------------------------------------------------------------*/ -void -rpl_timers_schedule_state_update(void) -{ - if(curr_instance.used) { - ctimer_set(&curr_instance.dag.state_update, 0, handle_state_update, NULL); - } -} -/*---------------------------------------------------------------------------*/ -static void -handle_state_update(void *ptr) -{ - rpl_dag_update_state(); -} - -/** @}*/ diff --git a/os/net/routing/rpl-lite/rpl-timers.h b/os/net/routing/rpl-lite/rpl-timers.h deleted file mode 100644 index 5d9498b97..000000000 --- a/os/net/routing/rpl-lite/rpl-timers.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - - /** - * \addtogroup rpl-lite - * @{ - * - * \file - * Header file for rpl-timers module - * \author - * Joakim Eriksson , Nicolas Tsiftes , - * Simon DUquennoy - * - */ - -#ifndef RPL_TIMERS_H -#define RPL_TIMERS_H - -/********** Includes **********/ - -#include "net/routing/rpl-lite/rpl.h" - -/********** Public functions **********/ - -/** - * Schedule periodic DIS with a random delay based on RPL_DIS_INTERVAL, until - * we join a DAG. -*/ -void rpl_timers_schedule_periodic_dis(void); - -/** - * Cancel scheduled leaving if any -*/ -void rpl_timers_unschedule_leaving(void); - -/** - * Schedule leaving after RPL_DELAY_BEFORE_LEAVING -*/ -void rpl_timers_schedule_leaving(void); - -/** - * Initialize rpl-timers module -*/ -void rpl_timers_init(void); - -/** - * Stop all timers related to the DAG -*/ -void rpl_timers_stop_dag_timers(void); - -/** - * Reset DIO Trickle timer - * - * \param str A textual description of caused the DIO timer reset -*/ -void rpl_timers_dio_reset(const char *str); - -/** - * Schedule unicast DIO with no delay -*/ -void rpl_timers_schedule_unicast_dio(rpl_nbr_t *target); - -/** - * Schedule a DAO with random delay based on RPL_DAO_DELAY -*/ -void rpl_timers_schedule_dao(void); - -/** - * Schedule a DAO-ACK with no delay -*/ -void rpl_timers_schedule_dao_ack(uip_ipaddr_t *target, uint16_t sequence); - -/** - * Let the rpl-timers module know that the last DAO was ACKed -*/ -void rpl_timers_notify_dao_ack(void); - -/** - * Schedule probing with delay RPL_PROBING_DELAY_FUNC() -*/ -void rpl_schedule_probing(void); - -/** - * Schedule probing within a few seconds -*/ -void rpl_schedule_probing_now(void); - -/** - * Schedule a state update ASAP. Useful to force an update from a context - * where updating directly would be unsafe. -*/ -void rpl_timers_schedule_state_update(void); - -/** - * Cancelled any scheduled state update. -*/ -void rpl_timers_unschedule_state_update(void); - - /** @} */ - -#endif /* RPL_TIMERS_H */ diff --git a/os/net/routing/rpl-lite/rpl-types.h b/os/net/routing/rpl-lite/rpl-types.h deleted file mode 100644 index 2c57bf664..000000000 --- a/os/net/routing/rpl-lite/rpl-types.h +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - - /** - * \addtogroup rpl-lite - * @{ - * - * \file - * RPL types and macros - * \author - * Joakim Eriksson & Nicolas Tsiftes - * Simon Duquennoy - * - */ - -#ifndef RPL_TYPES_H -#define RPL_TYPES_H - - /********** Macros **********/ - -/* Multicast address: create and compare */ - -/** \brief Set IP address addr to the link-local, all-rpl-nodes - multicast address. */ -#define uip_create_linklocal_rplnodes_mcast(addr) \ - uip_ip6addr((addr), 0xff02, 0, 0, 0, 0, 0, 0, 0x001a) - -/** \brief Is IPv6 address addr the link-local, all-RPL-nodes - multicast address? */ -#define uip_is_addr_linklocal_rplnodes_mcast(addr) \ - ((addr)->u8[0] == 0xff) && \ - ((addr)->u8[1] == 0x02) && \ - ((addr)->u16[1] == 0) && \ - ((addr)->u16[2] == 0) && \ - ((addr)->u16[3] == 0) && \ - ((addr)->u16[4] == 0) && \ - ((addr)->u16[5] == 0) && \ - ((addr)->u16[6] == 0) && \ - ((addr)->u8[14] == 0) && \ - ((addr)->u8[15] == 0x1a)) - -/** \brief Compute lifetime, accounting for the lifetime unit */ -#define RPL_LIFETIME(lifetime) \ - (((lifetime) == RPL_INFINITE_LIFETIME) ? \ - RPL_ROUTE_INFINITE_LIFETIME : \ - (unsigned long)curr_instance.lifetime_unit * (lifetime)) - -/** \brief Rank of a root node. */ -#define ROOT_RANK curr_instance.min_hoprankinc - -/** \brief Return DAG RANK as per RFC 6550 (rank divided by min_hoprankinc) */ -#define DAG_RANK(fixpt_rank) ((fixpt_rank) / curr_instance.min_hoprankinc) - -#define RPL_LOLLIPOP_MAX_VALUE 255 -#define RPL_LOLLIPOP_CIRCULAR_REGION 127 -#define RPL_LOLLIPOP_SEQUENCE_WINDOWS 16 -#define RPL_LOLLIPOP_INIT (RPL_LOLLIPOP_MAX_VALUE - RPL_LOLLIPOP_SEQUENCE_WINDOWS + 1) -#define RPL_LOLLIPOP_INCREMENT(counter) \ - do { \ - if((counter) > RPL_LOLLIPOP_CIRCULAR_REGION) { \ - (counter) = ((counter) + 1) & RPL_LOLLIPOP_MAX_VALUE; \ - } else { \ - (counter) = ((counter) + 1) & RPL_LOLLIPOP_CIRCULAR_REGION; \ - } \ - } while(0) - -#define RPL_LOLLIPOP_IS_INIT(counter) \ - ((counter) > RPL_LOLLIPOP_CIRCULAR_REGION) - - -/********** Data structures and types **********/ - -typedef uint16_t rpl_rank_t; -typedef uint16_t rpl_ocp_t; - -/*---------------------------------------------------------------------------*/ -/** \brief Structure for RPL energy metric. */ -struct rpl_metric_object_energy { - uint8_t flags; - uint8_t energy_est; -}; - -/** \brief Logical representation of a DAG Metric Container. */ -struct rpl_metric_container { - uint8_t type; - uint8_t flags; - uint8_t aggr; - uint8_t prec; - uint8_t length; - union metric_object { - struct rpl_metric_object_energy energy; - uint16_t etx; - } obj; -}; -typedef struct rpl_metric_container rpl_metric_container_t; - -/** \brief RPL prefix information */ -struct rpl_prefix { - uip_ipaddr_t prefix; - uint32_t lifetime; - uint8_t length; - uint8_t flags; - }; -typedef struct rpl_prefix rpl_prefix_t; - -/** \brief All information related to a RPL neighbor */ -struct rpl_nbr { - clock_time_t better_parent_since; /* The neighbor has been a possible - replacement for our preferred parent consistently since 'parent_since'. - Currently used by MRHOF only. */ -#if RPL_WITH_MC - rpl_metric_container_t mc; -#endif /* RPL_WITH_MC */ - rpl_rank_t rank; - uint8_t dtsn; -}; -typedef struct rpl_nbr rpl_nbr_t; - -/*---------------------------------------------------------------------------*/ - /** - * \brief API for RPL objective functions (OF) - * - * - reset(dag) Resets the objective function state for a specific DAG. This function is - * called when doing a global repair on the DAG. - * - nbr_link_metric(n) Returns the link metric of a neighbor - * - nbr_has_usable_link(n) Returns 1 iff the neighbor has a usable link as defined by the OF - * - nbr_is_acceptable_parent(n) Returns 1 iff the neighbor has a usable rank/link as defined by the OF - * - nbr_path_cost(n) Returns the path cost of a neighbor - * - rank_via_nbr(n) Returns our rank if we select a given neighbor as preferred parent - * - best_parent(n1, n2) Compares two neighbors and returns the best one, according to the OF. - * - update_metric_container() Updated the DAG metric container from the current OF state - */ - struct rpl_of { - void (*reset)(void); - uint16_t (*nbr_link_metric)(rpl_nbr_t *); - int (*nbr_has_usable_link)(rpl_nbr_t *); - int (*nbr_is_acceptable_parent)(rpl_nbr_t *); - uint16_t (*nbr_path_cost)(rpl_nbr_t *); - rpl_rank_t (*rank_via_nbr)(rpl_nbr_t *); - rpl_nbr_t *(*best_parent)(rpl_nbr_t *, rpl_nbr_t *); - void (*update_metric_container)(void); - rpl_ocp_t ocp; - }; - typedef struct rpl_of rpl_of_t; - -/*---------------------------------------------------------------------------*/ -/** \brief RPL DAG states*/ -enum rpl_dag_state { - DAG_INITIALIZED, - DAG_JOINED, - DAG_REACHABLE, - DAG_POISONING -}; - -/** \brief RPL DAG structure */ -struct rpl_dag { - uip_ipaddr_t dag_id; - rpl_prefix_t prefix_info; - rpl_nbr_t *preferred_parent; - rpl_rank_t lowest_rank; /* The lowest rank seen in the current version */ - rpl_rank_t rank; /* The current rank */ - rpl_rank_t last_advertised_rank; /* The last rank advertised in a multicast-DIO */ - uint32_t lifetime; - uint8_t version; - uint8_t grounded; - uint8_t preference; - uint8_t dio_intcurrent; /* Current DIO interval */ - uint8_t dio_send; /* internal trickle timer state: do we need to send a DIO at the next wakeup? */ - uint8_t dio_counter; /* internal trickle timer state: redundancy counter */ - uint8_t dao_last_seqno; /* the node's last sent DAO seqno */ - uint8_t dao_last_acked_seqno; /* the last seqno we got an ACK for */ - uint8_t dao_transmissions; /* the number of transmissions for the current DAO */ - enum rpl_dag_state state; - - /* Timers */ - clock_time_t dio_next_delay; /* delay for completion of dio interval */ - struct ctimer state_update; - struct ctimer leave; - struct ctimer dio_timer; - struct ctimer unicast_dio_timer; - struct ctimer dao_timer; - rpl_nbr_t *unicast_dio_target; -#if RPL_WITH_PROBING - struct ctimer probing_timer; - rpl_nbr_t *urgent_probing_target; -#endif /* RPL_WITH_PROBING */ -#if RPL_WITH_DAO_ACK - uip_ipaddr_t dao_ack_target; - uint16_t dao_ack_sequence; - struct ctimer dao_ack_timer; -#endif /* RPL_WITH_DAO_ACK */ -}; -typedef struct rpl_dag rpl_dag_t; - -/*---------------------------------------------------------------------------*/ -/** \brief RPL instance structure */ -struct rpl_instance { - rpl_metric_container_t mc; /* Metric container. Set to MC_NONE when no mc is used */ - rpl_of_t *of; /* The objective function */ - uint8_t used; - uint8_t instance_id; - uint8_t mop; /* Mode of operation */ - uint8_t dtsn_out; - uint8_t dio_intdoubl; - uint8_t dio_intmin; - uint8_t dio_redundancy; - rpl_rank_t max_rankinc; - rpl_rank_t min_hoprankinc; - uint8_t default_lifetime; - uint16_t lifetime_unit; /* lifetime in seconds = lifetime_unit * default_lifetime */ - rpl_dag_t dag; /* We support only one dag */ -}; -typedef struct rpl_instance rpl_instance_t; - - /** @} */ - -#endif /* RPL_TYPES_H */ diff --git a/os/net/routing/rpl-lite/rpl.c b/os/net/routing/rpl-lite/rpl.c deleted file mode 100644 index 47ffc5387..000000000 --- a/os/net/routing/rpl-lite/rpl.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \addtogroup rpl-lite - * @{ - * - * \file - * ContikiRPL, an implementation of RPL: IPv6 Routing Protocol - * for Low-Power and Lossy Networks (IETF RFC 6550) - * - * \author Joakim Eriksson , Nicolas Tsiftes - * Simon Duquennoy - */ - -#include "net/routing/rpl-lite/rpl.h" -#include "net/routing/routing.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "RPL" -#define LOG_LEVEL LOG_LEVEL_RPL - -uip_ipaddr_t rpl_multicast_addr; -static uint8_t rpl_leaf_only = RPL_DEFAULT_LEAF_ONLY; - -/*---------------------------------------------------------------------------*/ -int -rpl_lollipop_greater_than(int a, int b) -{ - /* Check if we are comparing an initial value with an old value */ - if(a > RPL_LOLLIPOP_CIRCULAR_REGION && b <= RPL_LOLLIPOP_CIRCULAR_REGION) { - return (RPL_LOLLIPOP_MAX_VALUE + 1 + b - a) > RPL_LOLLIPOP_SEQUENCE_WINDOWS; - } - /* Otherwise check if a > b and comparable => ok, or - if they have wrapped and are still comparable */ - return (a > b && (a - b) < RPL_LOLLIPOP_SEQUENCE_WINDOWS) || - (a < b && (b - a) > (RPL_LOLLIPOP_CIRCULAR_REGION + 1- - RPL_LOLLIPOP_SEQUENCE_WINDOWS)); -} -/*---------------------------------------------------------------------------*/ -const uip_ipaddr_t * -rpl_get_global_address(void) -{ - int i; - uint8_t state; - uip_ipaddr_t *ipaddr = NULL; - uip_ipaddr_t *prefix = NULL; - uint8_t prefix_length = 0; - - if(curr_instance.used && curr_instance.dag.prefix_info.length != 0) { - prefix = &curr_instance.dag.prefix_info.prefix; - prefix_length = curr_instance.dag.prefix_info.length; - } - - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - state == ADDR_PREFERRED && - !uip_is_addr_linklocal(&uip_ds6_if.addr_list[i].ipaddr) && - (prefix == NULL || uip_ipaddr_prefixcmp(prefix, &uip_ds6_if.addr_list[i].ipaddr, prefix_length))) { - ipaddr = &uip_ds6_if.addr_list[i].ipaddr; - } - } - return ipaddr; -} -/*---------------------------------------------------------------------------*/ -void -rpl_link_callback(const linkaddr_t *addr, int status, int numtx) -{ - if(curr_instance.used == 1 ) { - rpl_nbr_t *nbr = rpl_neighbor_get_from_lladdr((uip_lladdr_t *)addr); - if(nbr != NULL) { - /* If this is the neighbor we were probing urgently, mark urgent - probing as done */ - if(curr_instance.dag.urgent_probing_target == nbr) { - curr_instance.dag.urgent_probing_target = NULL; - } - /* Link stats were updated, and we need to update our internal state. - Updating from here is unsafe; postpone */ - LOG_INFO("packet sent to "); - LOG_INFO_LLADDR(addr); - LOG_INFO_(", status %u, tx %u, new link metric %u\n", status, numtx, rpl_neighbor_get_link_metric(nbr)); - rpl_timers_schedule_state_update(); - } - } -} -/*---------------------------------------------------------------------------*/ -int -rpl_has_joined(void) -{ - return curr_instance.used && curr_instance.dag.state >= DAG_JOINED; -} -/*---------------------------------------------------------------------------*/ -int -rpl_is_reachable(void) -{ - return curr_instance.used && curr_instance.dag.state == DAG_REACHABLE; -} -/*---------------------------------------------------------------------------*/ -static void -set_ip_from_prefix(uip_ipaddr_t *ipaddr, rpl_prefix_t *prefix) -{ - memset(ipaddr, 0, sizeof(uip_ipaddr_t)); - memcpy(ipaddr, &prefix->prefix, (prefix->length + 7) / 8); - uip_ds6_set_addr_iid(ipaddr, &uip_lladdr); -} -/*---------------------------------------------------------------------------*/ -void -rpl_reset_prefix(rpl_prefix_t *last_prefix) -{ - uip_ipaddr_t ipaddr; - uip_ds6_addr_t *rep; - set_ip_from_prefix(&ipaddr, last_prefix); - rep = uip_ds6_addr_lookup(&ipaddr); - if(rep != NULL) { - LOG_INFO("removing global IP address "); - LOG_INFO_6ADDR(&ipaddr); - LOG_INFO_("\n"); - uip_ds6_addr_rm(rep); - } - curr_instance.dag.prefix_info.length = 0; -} -/*---------------------------------------------------------------------------*/ -int -rpl_set_prefix_from_addr(uip_ipaddr_t *addr, unsigned len, uint8_t flags) -{ - uip_ipaddr_t ipaddr; - - if(addr == NULL || len == 0 || len > 128 || !(flags & UIP_ND6_RA_FLAG_AUTONOMOUS)) { - LOG_WARN("prefix not included, not-supported or invalid\n"); - return 0; - } - - /* Try and initialize prefix */ - memset(&curr_instance.dag.prefix_info.prefix, 0, sizeof(rpl_prefix_t)); - memcpy(&curr_instance.dag.prefix_info.prefix, addr, (len + 7) / 8); - curr_instance.dag.prefix_info.length = len; - curr_instance.dag.prefix_info.lifetime = RPL_ROUTE_INFINITE_LIFETIME; - curr_instance.dag.prefix_info.flags = flags; - - /* Add global address if not already there */ - set_ip_from_prefix(&ipaddr, &curr_instance.dag.prefix_info); - if(uip_ds6_addr_lookup(&ipaddr) == NULL) { - LOG_INFO("adding global IP address "); - LOG_INFO_6ADDR(&ipaddr); - LOG_INFO_("\n"); - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - } - return 1; -} -/*---------------------------------------------------------------------------*/ -int -rpl_set_prefix(rpl_prefix_t *prefix) -{ - if(prefix != NULL && rpl_set_prefix_from_addr(&prefix->prefix, prefix->length, prefix->flags)) { - curr_instance.dag.prefix_info.lifetime = prefix->lifetime; - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - LOG_INFO("initializing\n"); - - /* Initialize multicast address and register it */ - uip_create_linklocal_rplnodes_mcast(&rpl_multicast_addr); - uip_ds6_maddr_add(&rpl_multicast_addr); - - rpl_dag_init(); - rpl_neighbor_init(); - rpl_timers_init(); - rpl_icmp6_init(); - - uip_sr_init(); -} -/*---------------------------------------------------------------------------*/ -static int -get_sr_node_ipaddr(uip_ipaddr_t *addr, const uip_sr_node_t *node) -{ - if(addr != NULL && node != NULL) { - memcpy(addr, &curr_instance.dag.dag_id, 8); - memcpy(((unsigned char *)addr) + 8, &node->link_identifier, 8); - return 1; - } else { - return 0; - } -} -/*---------------------------------------------------------------------------*/ -static void -neighbor_state_changed(uip_ds6_nbr_t *nbr) -{ - /* Nothing needs be done in non-storing mode */ -} -/*---------------------------------------------------------------------------*/ -static void -drop_route(uip_ds6_route_t *route) -{ - /* Do nothing. RPL-lite only supports non-storing mode, i.e. no routes */ -} -/*---------------------------------------------------------------------------*/ -void -rpl_set_leaf_only(uint8_t value) -{ - rpl_leaf_only = value; -} -/*---------------------------------------------------------------------------*/ -uint8_t -rpl_get_leaf_only(void) -{ - return rpl_leaf_only; -} -/*---------------------------------------------------------------------------*/ -const struct routing_driver rpl_lite_driver = { - "RPL Lite", - init, - rpl_dag_root_set_prefix, - rpl_dag_root_start, - rpl_dag_root_is_root, - rpl_dag_get_root_ipaddr, - get_sr_node_ipaddr, - rpl_dag_poison_and_leave, - rpl_has_joined, - rpl_is_reachable, - rpl_global_repair, - rpl_local_repair, - rpl_ext_header_remove, - rpl_ext_header_update, - rpl_ext_header_hbh_update, - rpl_ext_header_srh_update, - rpl_ext_header_srh_get_next_hop, - rpl_link_callback, - neighbor_state_changed, - drop_route, -}; -/*---------------------------------------------------------------------------*/ - -/** @}*/ diff --git a/os/net/routing/rpl-lite/rpl.h b/os/net/routing/rpl-lite/rpl.h deleted file mode 100644 index e39c825c4..000000000 --- a/os/net/routing/rpl-lite/rpl.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * \ingroup net-layer - * \addtogroup rpl-lite - RPL-lite is a lightweight implementation of RPL tailored for reliability. - Supports only non-storing mode, one instance and one DAG. - * @{ - * - * \file - * Public API declarations for RPL. - * \author - * Joakim Eriksson & Nicolas Tsiftes - * Simon Duquennoy - * - */ - -#ifndef RPL_H -#define RPL_H - -/********** Includes **********/ - -#include "net/ipv6/uip.h" -#include "net/routing/rpl-lite/rpl-const.h" -#include "net/routing/rpl-lite/rpl-conf.h" -#include "net/routing/rpl-lite/rpl-types.h" -#include "net/routing/rpl-lite/rpl-icmp6.h" -#include "net/routing/rpl-lite/rpl-dag.h" -#include "net/routing/rpl-lite/rpl-dag-root.h" -#include "net/routing/rpl-lite/rpl-neighbor.h" -#include "net/routing/rpl-lite/rpl-ext-header.h" -#include "net/routing/rpl-lite/rpl-timers.h" - -/********** Public symbols **********/ - -/* The only instance */ -extern rpl_instance_t curr_instance; -/* The RPL multicast address (used for DIS and DIO) */ -extern uip_ipaddr_t rpl_multicast_addr; - -/********** Public functions **********/ - -/** - * Called by lower layers after every packet transmission - * - * \param addr The link-layer addrress of the packet destination - * \param status The transmission status (see os/net/mac/mac.h) - * \param numtx The total number of transmission attempts - */ -void rpl_link_callback(const linkaddr_t *addr, int status, int numtx); - -/** - * Set prefix from an prefix data structure (from DIO) - * - * \param prefix The prefix - * \return 1 if success, 0 otherwise - */ -int rpl_set_prefix(rpl_prefix_t *prefix); -/** -* Set prefix from an IPv6 address -* -* \param addr The prefix -* \param len The prefix length -* \param flags The DIO prefix flags -* \return 1 if success, 0 otherwise -*/ - -int rpl_set_prefix_from_addr(uip_ipaddr_t *addr, unsigned len, uint8_t flags); - -/** - * Removes current prefx - * - * \param last_prefix The last prefix (which is to be removed) - */ -void rpl_reset_prefix(rpl_prefix_t *last_prefix); - -/** - * Get one of the node's global addresses - * - * \return A (constant) pointer to the global IPv6 address found. - * The pointer directs to the internals of DS6, should only be used - * in the current function's local scope - */ -const uip_ipaddr_t *rpl_get_global_address(void); - -/** - * Get the RPL's best guess on if we are reachable via have downward route or not. - * - * \return 1 if we are reachable, 0 otherwise. - */ -int rpl_is_reachable(void); - -/** - * Greater-than function for a lollipop counter - * - * \param a The first counter - * \param b The second counter - * \return 1 is a>b else 0 - */ -int rpl_lollipop_greater_than(int a, int b); - -/** - * Triggers a route fresh via DTSN increment - * - * \param str a textual description of the cause for refresh - */ -void rpl_refresh_routes(const char *str); - -/** - * Changes the value of the rpl_leaf_only flag, which determines if a node acts - * only as a leaf in the network - * - * \param value the value to set: 0-disable, 1-enable - */ -void rpl_set_leaf_only(uint8_t value); - -/** - * Get the value of the rpl_leaf_only flag - * - * \return The value of the rpl_leaf_only flag - */ -uint8_t rpl_get_leaf_only(void); - /** @} */ - -#endif /* RPL_H */ diff --git a/os/net/security/tinydtls b/os/net/security/tinydtls deleted file mode 160000 index 53a0d97da..000000000 --- a/os/net/security/tinydtls +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 53a0d97da748a67093c49cb38744650c71d58c4d diff --git a/os/services/at-master/at-master.c b/os/services/at-master/at-master.c deleted file mode 100644 index c9e0597b6..000000000 --- a/os/services/at-master/at-master.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "contiki-lib.h" -#include "at-master.h" -#include "cpu.h" -#include "dev/uart.h" -#include "dev/serial-line.h" -#include "dev/sys-ctrl.h" -#include "lib/list.h" -#include "sys/cc.h" - -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ -LIST(at_cmd_list); -process_event_t at_cmd_received_event; -/*---------------------------------------------------------------------------*/ -static uint8_t at_uart = 0; -/*---------------------------------------------------------------------------*/ -PROCESS(at_process, "AT process"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(at_process, ev, data) -{ - uint8_t plen; - char *pch, *buf; - struct at_cmd *a; - PROCESS_BEGIN(); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message && data != NULL); - buf = (char *)data; - plen = strlen(buf); - for(a = list_head(at_cmd_list); a != NULL; a = list_item_next(a)) { - pch = strstr(buf, a->cmd_header); - if((plen <= a->cmd_max_len) && (pch != NULL)) { - if(strncmp(a->cmd_header, pch, a->cmd_hdr_len) == 0) { - if((a->cmd_hdr_len == plen) || (a->cmd_max_len > a->cmd_hdr_len)) { - a->event_callback(a, plen, (char *)pch); - process_post(a->app_process, at_cmd_received_event, NULL); - break; - } - } - } - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -struct at_cmd * -at_list(void) -{ - return list_head(at_cmd_list); -} -/*---------------------------------------------------------------------------*/ -uint8_t -at_send(char *s, uint8_t len) -{ - uint8_t i = 0; - while(s && *s != 0) { - if(i >= len) { - break; - } - uart_write_byte(at_uart, *s++); - i++; - } - return i; -} -/*---------------------------------------------------------------------------*/ -void -at_init(uint8_t uart_sel) -{ - static uint8_t inited = 0; - if(!inited) { - list_init(at_cmd_list); - at_cmd_received_event = process_alloc_event(); - inited = 1; - - at_uart = uart_sel; - uart_init(at_uart); - uart_set_input(at_uart, serial_line_input_byte); - serial_line_init(); - - process_start(&at_process, NULL); - PRINTF("AT: Started (%u)\n", at_uart); - } -} -/*---------------------------------------------------------------------------*/ -at_status_t -at_register(struct at_cmd *cmd, struct process *app_process, - const char *cmd_hdr, const uint8_t hdr_len, - const uint8_t cmd_max_len, at_event_callback_t event_callback) -{ - if((hdr_len < 1) || (cmd_max_len < 1) || (!strncmp(cmd_hdr, "AT", 2) == 0) || - (event_callback == NULL)) { - PRINTF("AT: Invalid argument\n"); - return AT_STATUS_INVALID_ARGS_ERROR; - } - - memset(cmd, 0, sizeof(struct at_cmd)); - cmd->event_callback = event_callback; - cmd->cmd_header = cmd_hdr; - cmd->cmd_hdr_len = hdr_len; - cmd->cmd_max_len = cmd_max_len; - cmd->app_process = app_process; - list_add(at_cmd_list, cmd); - PRINTF("AT: registered HDR %s LEN %u MAX %u\n", cmd->cmd_header, - cmd->cmd_hdr_len, - cmd->cmd_max_len); - return AT_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/at-master/at-master.h b/os/services/at-master/at-master.h deleted file mode 100644 index ad625c0dc..000000000 --- a/os/services/at-master/at-master.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 AT_MASTER_H_ -#define AT_MASTER_H_ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#define AT_DEFAULT_RESPONSE_OK "\r\nOK\r\n" -#define AT_DEFAULT_RESPONSE_ERROR "\r\nERROR\r\n" -/*---------------------------------------------------------------------------*/ -#define AT_RESPONSE(x) at_send((x), (strlen(x))) -/*---------------------------------------------------------------------------*/ -extern process_event_t at_cmd_received_event; -struct at_cmd; -/*---------------------------------------------------------------------------*/ -typedef enum { - AT_STATUS_OK, - AT_STATUS_ERROR, - AT_STATUS_INVALID_ARGS_ERROR, -} at_status_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief AT initialization - * \param uart selects which UART to use - * - * The AT driver invokes this function upon registering a command, this will - * wait for the serial_line_event_message event - */ -void at_init(uint8_t uart); -/*---------------------------------------------------------------------------*/ -/** - * \brief AT initialization - * \param uart selects which UART to use - * - * The AT driver invokes this function upon registering a command, this will - * wait for the serial_line_event_message event - */ -uint8_t at_send(char *s, uint8_t len); -/*---------------------------------------------------------------------------*/ -/** - * \brief AT event callback - * \param cmd A pointer to the AT command placeholder - * \param len Lenght of the received data (including the AT command header) - * \param data A user-defined pointer - * - * The AT event callback function gets called whenever there is an - * event on an incoming AT command - */ -typedef void (*at_event_callback_t)(struct at_cmd *cmd, - uint8_t len, - char *data); -/*---------------------------------------------------------------------------*/ -struct at_cmd { - struct at_cmd *next; - const char *cmd_header; - uint8_t cmd_hdr_len; - uint8_t cmd_max_len; - at_event_callback_t event_callback; - struct process *app_process; -}; -/*---------------------------------------------------------------------------*/ -/** - * \brief Registers the callback to return an AT command - * \param cmd A pointer to the CMD placeholder - * \param cmd_hdr String to compare when an AT command is received - * \param cmd_len Lenght of cmd_hdr - * \param event_callback Callback function to handle the AT command - * \return AT_STATUS_OK or AT_STATUS_INVALID_ARGS_ERROR - * - * Register the commands to search for when a valid AT frame has been received - */ -at_status_t at_register(struct at_cmd *cmd, - struct process *app_process, - const char *cmd_hdr, - const uint8_t cmd_hdr_len, - const uint8_t cmd_max_len, - at_event_callback_t event_callback); -/*---------------------------------------------------------------------------*/ -struct at_cmd *at_list(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Registers the callback to return an AT command - * \param cmd A pointer to the CMD placeholder - * \param cmd_hdr String to compare when an AT command is received - * \param cmd_len Lenght of cmd_hdr - * \param event_callback Callback function to handle the AT command - * \return AT_STATUS_OK or AT_STATUS_INVALID_ARGS_ERROR - * - * Register the commands to search for when a valid AT frame has been received - */ -at_status_t at_register(struct at_cmd *cmd, - struct process *app_process, - const char *cmd_hdr, - const uint8_t cmd_hdr_len, - const uint8_t cmd_max_len, - at_event_callback_t event_callback); -#endif /* AT_MASTER_H_ */ diff --git a/os/services/deployment/deployment.c b/os/services/deployment/deployment.c deleted file mode 100644 index 087d9766d..000000000 --- a/os/services/deployment/deployment.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** -* \addtogroup deployment -* @{ -*/ - -/** - * \file - * Code managing id<->mac address<->IPv6 address mapping, and doing this - * for different deployment scenarios: Cooja, Nodes, Indriya or Twist testbeds - * - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "deployment.h" -#include "sys/node-id.h" -#include -#include - -/** - * \brief List of ID<->MAC mapping used for different deployments - */ -extern const struct id_mac DEPLOYMENT_MAPPING[]; -/** - * \brief The number of nodes in the deployment - */ -static int node_count = 0; - -/*---------------------------------------------------------------------------*/ -void -deployment_init(void) -{ - const struct id_mac *curr = DEPLOYMENT_MAPPING; - /* Initialize node_id */ - node_id = deployment_id_from_lladdr((const linkaddr_t *)&linkaddr_node_addr); - /* Count nodes */ - node_count = 0; - while(curr->id != 0) { - node_count++; - curr++; - } -} -/*---------------------------------------------------------------------------*/ -int -deployment_node_count(void) -{ - return node_count; -} -/*---------------------------------------------------------------------------*/ -uint16_t -deployment_id_from_lladdr(const linkaddr_t *lladdr) -{ - const struct id_mac *curr = DEPLOYMENT_MAPPING; - if(lladdr == NULL) { - return 0; - } - while(curr->id != 0) { - /* Assume network-wide unique 16-bit MAC addresses */ - if(linkaddr_cmp(lladdr, &curr->mac)) { - return curr->id; - } - curr++; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -deployment_lladdr_from_id(linkaddr_t *lladdr, uint16_t id) -{ - const struct id_mac *curr = DEPLOYMENT_MAPPING; - if(id == 0 || lladdr == NULL) { - return; - } - while(curr->id != 0) { - if(curr->id == id) { - linkaddr_copy(lladdr, &curr->mac); - return; - } - curr++; - } -} -/*---------------------------------------------------------------------------*/ -uint16_t -deployment_id_from_iid(const uip_ipaddr_t *ipaddr) -{ - const linkaddr_t lladdr; - uip_ds6_set_lladdr_from_iid((uip_lladdr_t *)&lladdr, ipaddr); - return deployment_id_from_lladdr(&lladdr); -} -/*---------------------------------------------------------------------------*/ -void -deployment_iid_from_id(uip_ipaddr_t *ipaddr, uint16_t id) -{ - linkaddr_t lladdr; - deployment_lladdr_from_id(&lladdr, id); - uip_ds6_set_addr_iid(ipaddr, (uip_lladdr_t *)&lladdr); -} -/*---------------------------------------------------------------------------*/ -uint16_t -deployment_id_from_index(uint16_t index) -{ - if(index < deployment_node_count()) { - return DEPLOYMENT_MAPPING[index].id; - } else { - return 0; - } -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/os/services/deployment/deployment.h b/os/services/deployment/deployment.h deleted file mode 100644 index 29cd5214b..000000000 --- a/os/services/deployment/deployment.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** -* \addtogroup deployment -* @{ -* -* \file - Per-deployment MAC <-> nodeid mapping -* \author Simon Duquennoy -* -*/ - -#ifndef DEPLOYMENT_H_ -#define DEPLOYMENT_H_ - -#include "contiki-conf.h" -#include "sys/node-id.h" -#include "net/ipv6/uip.h" -#include "net/linkaddr.h" - -/** - * \brief ID<->MAC address mapping structure - */ -struct id_mac { - uint16_t id; - linkaddr_t mac; -}; - -/** - * DEPLOYMENT_MAPPING: - * A table of struct id_mac that provides ID-MAC mapping for a deployment. - * Example with four nodes: - * In configuration file: - * \#define DEPLOYMENT_MAPPING custom_array - * In a .c file: - * const struct id_mac custom_array[] = { - { 1, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb6,0x14}}}, - { 2, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0xe7}}}, - { 3, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb4,0x35}}}, - { 4, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0xcf}}}, - { 0, {{0}}} - }; - */ - -/** - * Initialize the deployment module - */ -void deployment_init(void); - -/** - * Get the number of nodes for the deployment (length of mapping table) - * - * \return The number of nodes in the deployment - */ -int deployment_node_count(void); - -/** - * Get node ID from a link-layer address, from the deployment mapping table - * - * \param lladdr The link-layer address to look up for - * \return Node ID from a corresponding link-layer address - */ -uint16_t deployment_id_from_lladdr(const linkaddr_t *lladdr); - -/** - * Get node link-layer address from a node ID, from the deployment mapping table - * - * \param lladdr A pointer where to write the link-layer address - * \param id The node ID to look up for - */ -void deployment_lladdr_from_id(linkaddr_t *lladdr, uint16_t id); - -/** - * Get node ID from the IID of an IPv6 address - * - * \param ipaddr The IPv6 (global or link-local) address that contains the IID - * \return Node ID from a corresponding IID - */ -uint16_t deployment_id_from_iid(const uip_ipaddr_t *ipaddr); - -/** - * Get IPv6 IID from node IDs - * - * \param ipaddr The IPv6 where to write the IID - * \param id The node ID - */ -void deployment_iid_from_id(uip_ipaddr_t *ipaddr, uint16_t id); - -/** - * Get node ID from index in mapping table - * - * \param index The index in the deployment mapping table - * \return Node ID at the corresponding index - */ -uint16_t deployment_id_from_index(uint16_t index); - -#endif /* DEPLOYMENT_H_ */ -/** @} */ diff --git a/os/services/deployment/module-macros.h b/os/services/deployment/module-macros.h deleted file mode 100644 index ed2d639ef..000000000 --- a/os/services/deployment/module-macros.h +++ /dev/null @@ -1 +0,0 @@ -#define BUILD_WITH_DEPLOYMENT 1 diff --git a/os/services/ip64/ip64-addrmap.c b/os/services/ip64/ip64-addrmap.c deleted file mode 100644 index d806c8ab1..000000000 --- a/os/services/ip64/ip64-addrmap.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 "ip64/ip64-addrmap.h" - -#include "lib/memb.h" -#include "lib/list.h" - -#include "ip64-conf.h" - -#include "lib/random.h" - -#include - -#ifdef IP64_ADDRMAP_CONF_ENTRIES -#define NUM_ENTRIES IP64_ADDRMAP_CONF_ENTRIES -#else /* IP64_ADDRMAP_CONF_ENTRIES */ -#define NUM_ENTRIES 32 -#endif /* IP64_ADDRMAP_CONF_ENTRIES */ - -MEMB(entrymemb, struct ip64_addrmap_entry, NUM_ENTRIES); -LIST(entrylist); - -#define FIRST_MAPPED_PORT 10000 -#define LAST_MAPPED_PORT 20000 -static uint16_t mapped_port = FIRST_MAPPED_PORT; - -#define printf(...) - -/*---------------------------------------------------------------------------*/ -struct ip64_addrmap_entry * -ip64_addrmap_list(void) -{ - return list_head(entrylist); -} -/*---------------------------------------------------------------------------*/ -void -ip64_addrmap_init(void) -{ - memb_init(&entrymemb); - list_init(entrylist); - mapped_port = FIRST_MAPPED_PORT; -} -/*---------------------------------------------------------------------------*/ -static void -check_age(void) -{ - struct ip64_addrmap_entry *m; - - /* Walk through the list of address mappings, throw away the ones - that are too old. */ - m = list_head(entrylist); - while(m != NULL) { - if(timer_expired(&m->timer)) { - list_remove(entrylist, m); - memb_free(&entrymemb, m); - m = list_head(entrylist); - } else { - m = list_item_next(m); - } - } -} -/*---------------------------------------------------------------------------*/ -static int -recycle(void) -{ - /* Find the oldest recyclable mapping and remove it. */ - struct ip64_addrmap_entry *m, *oldest; - - /* Walk through the list of address mappings, throw away the ones - that are too old. */ - - oldest = NULL; - for(m = list_head(entrylist); - m != NULL; - m = list_item_next(m)) { - if(m->flags & FLAGS_RECYCLABLE) { - if(oldest == NULL) { - oldest = m; - } else { - if(timer_remaining(&m->timer) < - timer_remaining(&oldest->timer)) { - oldest = m; - } - } - } - } - - /* If we found an oldest recyclable entry, remove it and return - non-zero. */ - if(oldest != NULL) { - list_remove(entrylist, oldest); - memb_free(&entrymemb, oldest); - return 1; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -struct ip64_addrmap_entry * -ip64_addrmap_lookup(const uip_ip6addr_t *ip6addr, - uint16_t ip6port, - const uip_ip4addr_t *ip4addr, - uint16_t ip4port, - uint8_t protocol) -{ - struct ip64_addrmap_entry *m; - - printf("lookup ip4port %d ip6port %d\n", uip_htons(ip4port), - uip_htons(ip6port)); - check_age(); - for(m = list_head(entrylist); m != NULL; m = list_item_next(m)) { - printf("protocol %d %d, ip4port %d %d, ip6port %d %d, ip4 %d ip6 %d\n", - m->protocol, protocol, - m->ip4port, ip4port, - m->ip6port, ip6port, - uip_ip4addr_cmp(&m->ip4addr, ip4addr), - uip_ip6addr_cmp(&m->ip6addr, ip6addr)); - if(m->protocol == protocol && - m->ip4port == ip4port && - m->ip6port == ip6port && - uip_ip4addr_cmp(&m->ip4addr, ip4addr) && - uip_ip6addr_cmp(&m->ip6addr, ip6addr)) { - m->ip6to4++; - return m; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -struct ip64_addrmap_entry * -ip64_addrmap_lookup_port(uint16_t mapped_port, uint8_t protocol) -{ - struct ip64_addrmap_entry *m; - - check_age(); - for(m = list_head(entrylist); m != NULL; m = list_item_next(m)) { - printf("mapped port %d %d, protocol %d %d\n", - m->mapped_port, mapped_port, - m->protocol, protocol); - if(m->mapped_port == mapped_port && - m->protocol == protocol) { - m->ip4to6++; - return m; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static void -increase_mapped_port(void) -{ - mapped_port = (random_rand() % (LAST_MAPPED_PORT - FIRST_MAPPED_PORT)) + - FIRST_MAPPED_PORT; -} -/*---------------------------------------------------------------------------*/ -struct ip64_addrmap_entry * -ip64_addrmap_create(const uip_ip6addr_t *ip6addr, - uint16_t ip6port, - const uip_ip4addr_t *ip4addr, - uint16_t ip4port, - uint8_t protocol) -{ - struct ip64_addrmap_entry *m; - - check_age(); - m = memb_alloc(&entrymemb); - if(m == NULL) { - /* We could not allocate an entry, try to recycle one and try to - allocate again. */ - if(recycle()) { - m = memb_alloc(&entrymemb); - } - } - if(m != NULL) { - uip_ip4addr_copy(&m->ip4addr, ip4addr); - m->ip4port = ip4port; - uip_ip6addr_copy(&m->ip6addr, ip6addr); - m->ip6port = ip6port; - m->protocol = protocol; - m->flags = FLAGS_NONE; - m->ip6to4 = 1; - m->ip4to6 = 0; - timer_set(&m->timer, 0); - - /* Pick a new, unused local port. First make sure that the - mapped_port number does not belong to any active connection. If - so, we keep increasing the mapped_port until we're free. */ - { - struct ip64_addrmap_entry *n; - n = list_head(entrylist); - while(n != NULL) { - if(n->mapped_port == mapped_port) { - increase_mapped_port(); - n = list_head(entrylist); - } else { - n = list_item_next(m); - } - } - } - m->mapped_port = mapped_port; - increase_mapped_port(); - - list_add(entrylist, m); - return m; - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -void -ip64_addrmap_set_lifetime(struct ip64_addrmap_entry *e, - clock_time_t time) -{ - if(e != NULL) { - timer_set(&e->timer, time); - } -} -/*---------------------------------------------------------------------------*/ -void -ip64_addrmap_set_recycleble(struct ip64_addrmap_entry *e) -{ - if(e != NULL) { - e->flags |= FLAGS_RECYCLABLE; - } -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/ip64/ip64-addrmap.h b/os/services/ip64/ip64-addrmap.h deleted file mode 100644 index 8a2ae1eeb..000000000 --- a/os/services/ip64/ip64-addrmap.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_ADDRMAP_H -#define IP64_ADDRMAP_H - -#include "contiki.h" -#include "sys/timer.h" -#include "net/ipv6/uip.h" - -struct ip64_addrmap_entry { - struct ip64_addrmap_entry *next; - struct timer timer; - uip_ip6addr_t ip6addr; - uip_ip4addr_t ip4addr; - uint32_t ip6to4, ip4to6; - uint16_t mapped_port; - uint16_t ip6port; - uint16_t ip4port; - uint8_t protocol; - uint8_t flags; -}; - -#define FLAGS_NONE 0 -#define FLAGS_RECYCLABLE 1 - -/** - * Initialize the ip64_addrmap module. - */ -void ip64_addrmap_init(void); - - -/** - * Look up an address mapping from inside the IPv6 network, given the - * IPv6 address/port, the IPv4 address/port, and the protocol. - */ -struct ip64_addrmap_entry *ip64_addrmap_lookup(const uip_ip6addr_t *ip6addr, - uint16_t ip6port, - const uip_ip4addr_t *ip4addr, - uint16_t ip4port, - uint8_t protocol); - -/** - * Look up an address mapping from the outside IPv4 network, given the - * mapped port number and protocol. - */ -struct ip64_addrmap_entry *ip64_addrmap_lookup_port(uint16_t mappedport, - uint8_t protocol); - -/** - * Create a new address mapping from an IPv6 address/port, an IPv4 - * address/port, and a protocol number. - */ -struct ip64_addrmap_entry *ip64_addrmap_create(const uip_ip6addr_t *ip6addr, - uint16_t ip6port, - const uip_ip4addr_t *ip4addr, - uint16_t ip4port, - uint8_t protocol); - -/** - * Set the lifetime of an address mapping. - */ -void ip64_addrmap_set_lifetime(struct ip64_addrmap_entry *e, - clock_time_t lifetime); - -/** - * Mark an address mapping to be recyclable. - */ -void ip64_addrmap_set_recycleble(struct ip64_addrmap_entry *e); - -/** - * Obtain the list of all address mappings. - */ -struct ip64_addrmap_entry *ip64_addrmap_list(void); -#endif /* IP64_ADDRMAP_H */ diff --git a/os/services/ip64/ip64-arp.c b/os/services/ip64/ip64-arp.c deleted file mode 100644 index 6fd996920..000000000 --- a/os/services/ip64/ip64-arp.c +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: uip_arp.c,v 1.8 2010/12/14 22:45:22 dak664 Exp $ - * - */ - -#include "ip64/ip64.h" -#include "ip64/ip64-eth.h" -#include "ip64/ip64-arp.h" - -#include -#include - -#define printf(...) - -struct arp_hdr { - struct ip64_eth_hdr ethhdr; - uint16_t hwtype; - uint16_t protocol; - uint8_t hwlen; - uint8_t protolen; - uint16_t opcode; - struct uip_eth_addr shwaddr; - uip_ip4addr_t sipaddr; - struct uip_eth_addr dhwaddr; - uip_ip4addr_t dipaddr; -}; - -struct ethip_hdr { - struct ip64_eth_hdr ethhdr; - /* IP header. */ - uint8_t vhl, - tos, - len[2], - ipid[2], - ipoffset[2], - ttl, - proto; - uint16_t ipchksum; - uip_ip4addr_t srcipaddr, destipaddr; -}; - -struct ipv4_hdr { - /* IP header. */ - uint8_t vhl, - tos, - len[2], - ipid[2], - ipoffset[2], - ttl, - proto; - uint16_t ipchksum; - uip_ip4addr_t srcipaddr, destipaddr; -}; - -#define ARP_REQUEST 1 -#define ARP_REPLY 2 - -#define ARP_HWTYPE_ETH 1 - -struct arp_entry { - uip_ip4addr_t ipaddr; - struct uip_eth_addr ethaddr; - uint8_t time; -}; - -static const struct ip64_eth_addr broadcast_ethaddr = - {{0xff,0xff,0xff,0xff,0xff,0xff}}; - -static struct arp_entry arp_table[UIP_ARPTAB_SIZE]; - -static uint8_t arptime; -static uint8_t tmpage; - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -const uip_ipaddr_t uip_all_zeroes_addr; - -/*---------------------------------------------------------------------------*/ -/** - * Initialize the ARP module. - * - */ -/*---------------------------------------------------------------------------*/ -void -ip64_arp_init(void) -{ - int i; - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - memset(&arp_table[i].ipaddr, 0, 4); - } -} -/*---------------------------------------------------------------------------*/ -/** - * Periodic ARP processing function. - * - * This function performs periodic timer processing in the ARP module - * and should be called at regular intervals. The recommended interval - * is 10 seconds between the calls. - * - */ -/*---------------------------------------------------------------------------*/ -void -ip64_arp_timer(void) -{ - struct arp_entry *tabptr; - int i; - - ++arptime; - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - tabptr = &arp_table[i]; - if(uip_ip4addr_cmp(&tabptr->ipaddr, &uip_all_zeroes_addr) && - arptime - tabptr->time >= UIP_ARP_MAXAGE) { - memset(&tabptr->ipaddr, 0, 4); - } - } - -} - -/*---------------------------------------------------------------------------*/ -static void -arp_update(uip_ip4addr_t *ipaddr, struct uip_eth_addr *ethaddr) -{ - register struct arp_entry *tabptr = arp_table; - int i, c; - - /* Walk through the ARP mapping table and try to find an entry to - update. If none is found, the IP -> MAC address mapping is - inserted in the ARP table. */ - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - tabptr = &arp_table[i]; - - /* Only check those entries that are actually in use. */ - if(!uip_ip4addr_cmp(&tabptr->ipaddr, &uip_all_zeroes_addr)) { - - /* Check if the source IP address of the incoming packet matches - the IP address in this ARP table entry. */ - if(uip_ip4addr_cmp(ipaddr, &tabptr->ipaddr)) { - - /* An old entry found, update this and return. */ - memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6); - tabptr->time = arptime; - - return; - } - } - tabptr++; - } - - /* If we get here, no existing ARP table entry was found, so we - create one. */ - - /* First, we try to find an unused entry in the ARP table. */ - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - tabptr = &arp_table[i]; - if(uip_ip4addr_cmp(&tabptr->ipaddr, &uip_all_zeroes_addr)) { - break; - } - } - - /* If no unused entry is found, we try to find the oldest entry and - throw it away. */ - if(i == UIP_ARPTAB_SIZE) { - tmpage = 0; - c = 0; - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - tabptr = &arp_table[i]; - if(arptime - tabptr->time > tmpage) { - tmpage = arptime - tabptr->time; - c = i; - } - } - i = c; - tabptr = &arp_table[i]; - } - - /* Now, i is the ARP table entry which we will fill with the new - information. */ - uip_ip4addr_copy(&tabptr->ipaddr, ipaddr); - memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6); - tabptr->time = arptime; -} -/*---------------------------------------------------------------------------*/ -uint16_t -ip64_arp_arp_input(const uint8_t *packet, uint16_t packet_len) -{ - struct arp_hdr *arphdr = (struct arp_hdr *)packet; - - if(packet_len < sizeof(struct arp_hdr)) { - printf("ip64_arp_arp_input: len too small %d\n", packet_len); - return 0; - } - - switch(arphdr->opcode) { - case UIP_HTONS(ARP_REQUEST): - /* ARP request. If it asked for our address, we send out a - reply. */ - printf("ip64_arp_arp_input: request for %d.%d.%d.%d (we are %d.%d.%d.%d)\n", - arphdr->dipaddr.u8[0], arphdr->dipaddr.u8[1], - arphdr->dipaddr.u8[2], arphdr->dipaddr.u8[3], - ip64_get_hostaddr()->u8[0], ip64_get_hostaddr()->u8[1], - ip64_get_hostaddr()->u8[2], ip64_get_hostaddr()->u8[3]); - if(uip_ip4addr_cmp(&arphdr->dipaddr, ip64_get_hostaddr())) { - /* First, we register the one who made the request in our ARP - table, since it is likely that we will do more communication - with this host in the future. */ - arp_update(&arphdr->sipaddr, &arphdr->shwaddr); - - arphdr->opcode = UIP_HTONS(ARP_REPLY); - - memcpy(arphdr->dhwaddr.addr, arphdr->shwaddr.addr, 6); - memcpy(arphdr->shwaddr.addr, ip64_eth_addr.addr, 6); - memcpy(arphdr->ethhdr.src.addr, ip64_eth_addr.addr, 6); - memcpy(arphdr->ethhdr.dest.addr, arphdr->dhwaddr.addr, 6); - - uip_ip4addr_copy(&arphdr->dipaddr, &arphdr->sipaddr); - uip_ip4addr_copy(&arphdr->sipaddr, ip64_get_hostaddr()); - - arphdr->ethhdr.type = UIP_HTONS(IP64_ETH_TYPE_ARP); - return sizeof(struct arp_hdr); - } - break; - case UIP_HTONS(ARP_REPLY): - /* ARP reply. We insert or update the ARP table if it was meant - for us. */ - if(uip_ip4addr_cmp(&arphdr->dipaddr, ip64_get_hostaddr())) { - arp_update(&arphdr->sipaddr, &arphdr->shwaddr); - } - break; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -ip64_arp_check_cache(const uint8_t *nlhdr) -{ - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)nlhdr; - uip_ip4addr_t broadcast_addr; - struct arp_entry *tabptr = arp_table; - - printf("check cache %d.%d.%d.%d\n", - uip_ipaddr_to_quad(&ipv4_hdr->destipaddr)); - - /* First check if destination is a local broadcast. */ - uip_ipaddr(&broadcast_addr, 255,255,255,255); - if(uip_ip4addr_cmp(&ipv4_hdr->destipaddr, &broadcast_addr)) { - printf("Return 1\n"); - return 1; - } else if(ipv4_hdr->destipaddr.u8[0] == 224) { - /* Multicast. */ - return 1; - } else { - uip_ip4addr_t ipaddr; - int i; - /* Check if the destination address is on the local network. */ - if(!uip_ipaddr_maskcmp(&ipv4_hdr->destipaddr, - ip64_get_hostaddr(), - ip64_get_netmask())) { - /* Destination address was not on the local network, so we need to - use the default router's IP address instead of the destination - address when determining the MAC address. */ - uip_ip4addr_copy(&ipaddr, ip64_get_draddr()); - } else { - /* Else, we use the destination IP address. */ - uip_ip4addr_copy(&ipaddr, &ipv4_hdr->destipaddr); - } - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - if(uip_ip4addr_cmp(&ipaddr, &tabptr->ipaddr)) { - break; - } - tabptr++; - } - - if(i == UIP_ARPTAB_SIZE) { - return 0; - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -ip64_arp_create_ethhdr(uint8_t *llhdr, const uint8_t *nlhdr) -{ - struct arp_entry *tabptr = arp_table; - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)nlhdr; - struct ip64_eth_hdr *ethhdr = (struct ip64_eth_hdr *)llhdr; - uip_ip4addr_t broadcast_addr; - - /* Find the destination IP address in the ARP table and construct - the Ethernet header. If the destination IP addres isn't on the - local network, we use the default router's IP address instead. - - If not ARP table entry is found, we overwrite the original IP - packet with an ARP request for the IP address. */ - - /* First check if destination is a local broadcast. */ - uip_ipaddr(&broadcast_addr, 255,255,255,255); - if(uip_ip4addr_cmp(&ipv4_hdr->destipaddr, &broadcast_addr)) { - memcpy(ðhdr->dest.addr, &broadcast_ethaddr.addr, 6); - } else if(ipv4_hdr->destipaddr.u8[0] == 224) { - /* Multicast. */ - ethhdr->dest.addr[0] = 0x01; - ethhdr->dest.addr[1] = 0x00; - ethhdr->dest.addr[2] = 0x5e; - ethhdr->dest.addr[3] = ipv4_hdr->destipaddr.u8[1]; - ethhdr->dest.addr[4] = ipv4_hdr->destipaddr.u8[2]; - ethhdr->dest.addr[5] = ipv4_hdr->destipaddr.u8[3]; - } else { - uip_ip4addr_t ipaddr; - int i; - /* Check if the destination address is on the local network. */ - if(!uip_ipaddr_maskcmp(&ipv4_hdr->destipaddr, - ip64_get_hostaddr(), - ip64_get_netmask())) { - /* Destination address was not on the local network, so we need to - use the default router's IP address instead of the destination - address when determining the MAC address. */ - uip_ip4addr_copy(&ipaddr, ip64_get_draddr()); - } else { - /* Else, we use the destination IP address. */ - uip_ip4addr_copy(&ipaddr, &ipv4_hdr->destipaddr); - } - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - if(uip_ip4addr_cmp(&ipaddr, &tabptr->ipaddr)) { - break; - } - tabptr++; - } - - if(i == UIP_ARPTAB_SIZE) { - return 0; - } - - memcpy(ethhdr->dest.addr, tabptr->ethaddr.addr, 6); - - } - memcpy(ethhdr->src.addr, ip64_eth_addr.addr, 6); - - ethhdr->type = UIP_HTONS(IP64_ETH_TYPE_IP); - return sizeof(struct ip64_eth_hdr); -} -/*---------------------------------------------------------------------------*/ -int -ip64_arp_create_arp_request(uint8_t *llhdr, const uint8_t *nlhdr) -{ - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)nlhdr; - struct arp_hdr *arp_hdr = (struct arp_hdr *)llhdr; - uip_ip4addr_t ipaddr; - - if(!uip_ipaddr_maskcmp(&ipv4_hdr->destipaddr, - ip64_get_hostaddr(), - ip64_get_netmask())) { - /* Destination address was not on the local network, so we need to - use the default router's IP address instead of the destination - address when determining the MAC address. */ - uip_ip4addr_copy(&ipaddr, ip64_get_draddr()); - } else { - /* Else, we use the destination IP address. */ - uip_ip4addr_copy(&ipaddr, &ipv4_hdr->destipaddr); - } - - memset(arp_hdr->ethhdr.dest.addr, 0xff, 6); - memset(arp_hdr->dhwaddr.addr, 0x00, 6); - memcpy(arp_hdr->ethhdr.src.addr, ip64_eth_addr.addr, 6); - memcpy(arp_hdr->shwaddr.addr, ip64_eth_addr.addr, 6); - - uip_ip4addr_copy(&arp_hdr->dipaddr, &ipaddr); - uip_ip4addr_copy(&arp_hdr->sipaddr, ip64_get_hostaddr()); - arp_hdr->opcode = UIP_HTONS(ARP_REQUEST); - arp_hdr->hwtype = UIP_HTONS(ARP_HWTYPE_ETH); - arp_hdr->protocol = UIP_HTONS(IP64_ETH_TYPE_IP); - arp_hdr->hwlen = 6; - arp_hdr->protolen = 4; - arp_hdr->ethhdr.type = UIP_HTONS(IP64_ETH_TYPE_ARP); - - uip_appdata = &uip_buf[UIP_IPTCPH_LEN]; - - return sizeof(struct arp_hdr); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/ip64/ip64-arp.h b/os/services/ip64/ip64-arp.h deleted file mode 100644 index f45faeb45..000000000 --- a/os/services/ip64/ip64-arp.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: uip_arp.h,v 1.2 2006/08/26 23:58:45 oliverschmidt Exp $ - * - */ - -#ifndef IP64_ARP_H -#define IP64_ARP_H - -#include "net/ipv6/uip.h" - -#include "ip64/ip64-eth.h" - - -/* The uip_arp_init() function must be called before any of the other - ARP functions. */ -void ip64_arp_init(void); - -/* The uip_arp_ipin() function should be called whenever an IP packet - arrives from the Ethernet. This function refreshes the ARP table or - inserts a new mapping if none exists. The function assumes that an - IP packet with an Ethernet header is present in the uip_buf buffer - and that the length of the packet is in the uip_len variable. */ -void ip64_arp_ip_input(const uint8_t *packet, uint16_t packet_len); - -/* The uip_arp_arpin() should be called when an ARP packet is received - by the Ethernet driver. This function also assumes that the - Ethernet frame is present in the uip_buf buffer. When the - uip_arp_arpin() function returns, the contents of the uip_buf - buffer should be sent out on the Ethernet if the uip_len variable - is > 0. */ -uint16_t ip64_arp_arp_input(const uint8_t *packet, uint16_t packet_len); - -/* The uip_arp_out() function should be called when an IP packet - should be sent out on the Ethernet. This function creates an - Ethernet header before the IP header in the uip_buf buffer. The - Ethernet header will have the correct Ethernet MAC destination - address filled in if an ARP table entry for the destination IP - address (or the IP address of the default router) is present. If no - such table entry is found, the IP packet is overwritten with an ARP - request and we rely on TCP to retransmit the packet that was - overwritten. In any case, the uip_len variable holds the length of - the Ethernet frame that should be transmitted. */ -void ip64_arp_ip_output(uint8_t *packet, uint16_t packet_len); - - -int ip64_arp_create_ethhdr(uint8_t *link_header, - const uint8_t *network_header); - -int ip64_arp_create_arp_request(uint8_t *link_header, - const uint8_t *network_header); - -int ip64_arp_check_cache(const uint8_t *nlhdr); - - -#endif /* IP64_ARP_H */ diff --git a/os/services/ip64/ip64-conf-example.h b/os/services/ip64/ip64-conf-example.h deleted file mode 100644 index 1168fae7a..000000000 --- a/os/services/ip64/ip64-conf-example.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_CONF_H -#define IP64_CONF_H - -#include "ip64/ip64-tap-driver.h" -#include "ip64/ip64-eth-interface.h" - -#define IP64_CONF_UIP_FALLBACK_INTERFACE ip64_eth_interface -#define IP64_CONF_INPUT ip64_eth_interface_input - -#define IP64_CONF_ETH_DRIVER ip64_tap_driver - -/* - * In contrast to the mandatory parameters above, IP64_CONF_DHCP is an - * optional configuration parameter. The default value is set in ip64.h - */ -/* #define IP64_CONF_DHCP 1 */ -#endif /* IP64_CONF_H */ diff --git a/os/services/ip64/ip64-dhcpc.c b/os/services/ip64/ip64-dhcpc.c deleted file mode 100644 index 10a5184e3..000000000 --- a/os/services/ip64/ip64-dhcpc.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: dhcpc.c,v 1.9 2010/10/19 18:29:04 adamdunkels Exp $ - */ - -#include -#include - -#include "contiki.h" -#include "contiki-net.h" -#include "ip64/ip64-dhcpc.h" - -#include "ipv6/ip64-addr.h" - -#define STATE_INITIAL 0 -#define STATE_SENDING 1 -#define STATE_OFFER_RECEIVED 2 -#define STATE_CONFIG_RECEIVED 3 - -static struct ip64_dhcpc_state s; - -struct dhcp_msg { - uint8_t op, htype, hlen, hops; - uint8_t xid[4]; - uint16_t secs, flags; - uint8_t ciaddr[4]; - uint8_t yiaddr[4]; - uint8_t siaddr[4]; - uint8_t giaddr[4]; - uint8_t chaddr[16]; - uint8_t sname[64]; - uint8_t file[128]; - uint8_t options[312]; -}; - -#if (UIP_BUFSIZE - UIP_UDPIP_HLEN) < 548 -#error UIP_CONF_BUFFER_SIZE may be too small to accomodate DHCPv4 packets -#error Increase UIP_CONF_BUFFER_SIZE in your project-conf.h, or contiki-conf.h -#error A good size is 600 bytes -#endif - -#define BOOTP_BROADCAST 0x8000 - -#define DHCP_REQUEST 1 -#define DHCP_REPLY 2 -#define DHCP_HTYPE_ETHERNET 1 -#define DHCP_HLEN_ETHERNET 6 -#define DHCP_MSG_LEN 236 - -#define IP64_DHCPC_SERVER_PORT 67 -#define IP64_DHCPC_CLIENT_PORT 68 - -#define DHCPDISCOVER 1 -#define DHCPOFFER 2 -#define DHCPREQUEST 3 -#define DHCPDECLINE 4 -#define DHCPACK 5 -#define DHCPNAK 6 -#define DHCPRELEASE 7 - -#define DHCP_OPTION_SUBNET_MASK 1 -#define DHCP_OPTION_ROUTER 3 -#define DHCP_OPTION_DNS_SERVER 6 -#define DHCP_OPTION_REQ_IPADDR 50 -#define DHCP_OPTION_LEASE_TIME 51 -#define DHCP_OPTION_MSG_TYPE 53 -#define DHCP_OPTION_SERVER_ID 54 -#define DHCP_OPTION_REQ_LIST 55 -#define DHCP_OPTION_END 255 - -static uint32_t xid; -static const uint8_t magic_cookie[4] = {99, 130, 83, 99}; -/*---------------------------------------------------------------------------*/ -static uint8_t * -add_msg_type(uint8_t *optptr, uint8_t type) -{ - *optptr++ = DHCP_OPTION_MSG_TYPE; - *optptr++ = 1; - *optptr++ = type; - return optptr; -} -/*---------------------------------------------------------------------------*/ -static uint8_t * -add_server_id(uint8_t *optptr) -{ - *optptr++ = DHCP_OPTION_SERVER_ID; - *optptr++ = 4; - memcpy(optptr, s.serverid, 4); - return optptr + 4; -} -/*---------------------------------------------------------------------------*/ -static uint8_t * -add_req_ipaddr(uint8_t *optptr) -{ - *optptr++ = DHCP_OPTION_REQ_IPADDR; - *optptr++ = 4; - memcpy(optptr, s.ipaddr.u16, 4); - return optptr + 4; -} -/*---------------------------------------------------------------------------*/ -static uint8_t * -add_req_options(uint8_t *optptr) -{ - *optptr++ = DHCP_OPTION_REQ_LIST; - *optptr++ = 3; - *optptr++ = DHCP_OPTION_SUBNET_MASK; - *optptr++ = DHCP_OPTION_ROUTER; - *optptr++ = DHCP_OPTION_DNS_SERVER; - return optptr; -} -/*---------------------------------------------------------------------------*/ -static uint8_t * -add_end(uint8_t *optptr) -{ - *optptr++ = DHCP_OPTION_END; - return optptr; -} -/*---------------------------------------------------------------------------*/ -static void -create_msg(CC_REGISTER_ARG struct dhcp_msg *m) -{ - m->op = DHCP_REQUEST; - m->htype = DHCP_HTYPE_ETHERNET; - m->hlen = s.mac_len; - m->hops = 0; - memcpy(m->xid, &xid, sizeof(m->xid)); - m->secs = 0; - m->flags = UIP_HTONS(BOOTP_BROADCAST); /* Broadcast bit. */ - /* uip_ipaddr_copy(m->ciaddr, uip_hostaddr);*/ - memcpy(m->ciaddr, uip_hostaddr.u16, sizeof(m->ciaddr)); - memset(m->yiaddr, 0, sizeof(m->yiaddr)); - memset(m->siaddr, 0, sizeof(m->siaddr)); - memset(m->giaddr, 0, sizeof(m->giaddr)); - memcpy(m->chaddr, s.mac_addr, s.mac_len); - memset(&m->chaddr[s.mac_len], 0, sizeof(m->chaddr) - s.mac_len); - - memset(m->sname, 0, sizeof(m->sname)); - memset(m->file, 0, sizeof(m->file)); - - - memcpy(m->options, magic_cookie, sizeof(magic_cookie)); -} -/*---------------------------------------------------------------------------*/ -static void -send_discover(void) -{ - uint8_t *end; - struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; - - create_msg(m); - - end = add_msg_type(&m->options[4], DHCPDISCOVER); - end = add_req_options(end); - end = add_end(end); - - uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata)); -} -/*---------------------------------------------------------------------------*/ -static void -send_request(void) -{ - uint8_t *end; - struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; - - create_msg(m); - - end = add_msg_type(&m->options[4], DHCPREQUEST); - end = add_server_id(end); - end = add_req_ipaddr(end); - end = add_end(end); - - uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata)); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -parse_options(uint8_t *optptr, int len) -{ - uint8_t *end = optptr + len; - uint8_t type = 0; - - while(optptr < end) { - switch(*optptr) { - case DHCP_OPTION_SUBNET_MASK: - memcpy(s.netmask.u16, optptr + 2, 4); - break; - case DHCP_OPTION_ROUTER: - memcpy(s.default_router.u16, optptr + 2, 4); - break; - case DHCP_OPTION_DNS_SERVER: - memcpy(s.dnsaddr.u16, optptr + 2, 4); - break; - case DHCP_OPTION_MSG_TYPE: - type = *(optptr + 2); - break; - case DHCP_OPTION_SERVER_ID: - memcpy(s.serverid, optptr + 2, 4); - break; - case DHCP_OPTION_LEASE_TIME: - memcpy(s.lease_time, optptr + 2, 4); - break; - case DHCP_OPTION_END: - return type; - } - - optptr += optptr[1] + 2; - } - return type; -} -/*---------------------------------------------------------------------------*/ -static uint8_t -parse_msg(void) -{ - struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; - - if(m->op == DHCP_REPLY && - memcmp(m->xid, &xid, sizeof(xid)) == 0 && - memcmp(m->chaddr, s.mac_addr, s.mac_len) == 0) { - memcpy(s.ipaddr.u16, m->yiaddr, 4); - return parse_options(&m->options[4], uip_datalen()); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/* - * Is this a "fresh" reply for me? If it is, return the type. - */ -static int -msg_for_me(void) -{ - struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; - uint8_t *optptr = &m->options[4]; - uint8_t *end = (uint8_t*)uip_appdata + uip_datalen(); - - if(m->op == DHCP_REPLY && - memcmp(m->xid, &xid, sizeof(xid)) == 0 && - memcmp(m->chaddr, s.mac_addr, s.mac_len) == 0) { - while(optptr < end) { - if(*optptr == DHCP_OPTION_MSG_TYPE) { - return *(optptr + 2); - } else if (*optptr == DHCP_OPTION_END) { - return -1; - } - optptr += optptr[1] + 2; - } - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_dhcp(process_event_t ev, void *data)) -{ - clock_time_t ticks; - - PT_BEGIN(&s.pt); - - init: - xid++; - s.state = STATE_SENDING; - s.ticks = CLOCK_SECOND * 4; - while(1) { - while(ev != tcpip_event) { - tcpip_poll_udp(s.conn); - PT_YIELD(&s.pt); - } - send_discover(); - etimer_set(&s.etimer, s.ticks); - do { - PT_YIELD(&s.pt); - if(ev == tcpip_event && uip_newdata() && msg_for_me() == DHCPOFFER) { - parse_msg(); - s.state = STATE_OFFER_RECEIVED; - goto selecting; - } - } while(!etimer_expired(&s.etimer)); - - if(s.ticks < CLOCK_SECOND * 60) { - s.ticks *= 2; - } - } - - selecting: - s.ticks = CLOCK_SECOND; - do { - while(ev != tcpip_event) { - tcpip_poll_udp(s.conn); - PT_YIELD(&s.pt); - } - send_request(); - etimer_set(&s.etimer, s.ticks); - do { - PT_YIELD(&s.pt); - if(ev == tcpip_event && uip_newdata() && msg_for_me() == DHCPACK) { - parse_msg(); - s.state = STATE_CONFIG_RECEIVED; - goto bound; - } - } while (!etimer_expired(&s.etimer)); - - if(s.ticks <= CLOCK_SECOND * 10) { - s.ticks += CLOCK_SECOND; - } else { - goto init; - } - } while(s.state != STATE_CONFIG_RECEIVED); - - bound: -#if 0 - printf("Got IP address %d.%d.%d.%d\n", uip_ipaddr_to_quad(&s.ipaddr)); - printf("Got netmask %d.%d.%d.%d\n", uip_ipaddr_to_quad(&s.netmask)); - printf("Got DNS server %d.%d.%d.%d\n", uip_ipaddr_to_quad(&s.dnsaddr)); - printf("Got default router %d.%d.%d.%d\n", - uip_ipaddr_to_quad(&s.default_router)); - printf("Lease expires in %ld seconds\n", - uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1])); -#endif - - ip64_dhcpc_configured(&s); - -#define MAX_TICKS (~((clock_time_t)0) / 2) -#define MAX_TICKS32 (~((uint32_t)0)) -#define IMIN(a, b) ((a) < (b) ? (a) : (b)) - - if((uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]))*CLOCK_SECOND/2 - <= MAX_TICKS32) { - s.ticks = (uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]) - )*CLOCK_SECOND/2; - } else { - s.ticks = MAX_TICKS32; - } - - while(s.ticks > 0) { - ticks = IMIN(s.ticks, MAX_TICKS); - s.ticks -= ticks; - etimer_set(&s.etimer, ticks); - PT_YIELD_UNTIL(&s.pt, etimer_expired(&s.etimer)); - } - - if((uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]))*CLOCK_SECOND/2 - <= MAX_TICKS32) { - s.ticks = (uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]) - )*CLOCK_SECOND/2; - } else { - s.ticks = MAX_TICKS32; - } - - /* renewing: */ - do { - while(ev != tcpip_event) { - tcpip_poll_udp(s.conn); - PT_YIELD(&s.pt); - } - send_request(); - ticks = IMIN(s.ticks / 2, MAX_TICKS); - s.ticks -= ticks; - etimer_set(&s.etimer, ticks); - do { - PT_YIELD(&s.pt); - if(ev == tcpip_event && uip_newdata() && msg_for_me() == DHCPACK) { - parse_msg(); - goto bound; - } - } while(!etimer_expired(&s.etimer)); - } while(s.ticks >= CLOCK_SECOND*3); - - /* rebinding: */ - - /* lease_expired: */ - ip64_dhcpc_unconfigured(&s); - goto init; - - PT_END(&s.pt); -} -/*---------------------------------------------------------------------------*/ -void -ip64_dhcpc_init(const void *mac_addr, int mac_len) -{ - /* Although this is DHCPv4, we explicitly bind the socket to an IPv6 - address so that it can operate over the ip64 bridge. */ - uip_ip6addr_t v6addr; - uip_ip4addr_t v4addr; - struct uip_udp_conn *conn2; - - s.mac_addr = mac_addr; - s.mac_len = mac_len; - - s.state = STATE_INITIAL; - uip_ipaddr(&v4addr, 255,255,255,255); - ip64_addr_4to6(&v4addr, &v6addr); - s.conn = udp_new(&v6addr, UIP_HTONS(IP64_DHCPC_SERVER_PORT), NULL); - conn2 = udp_new(NULL, UIP_HTONS(IP64_DHCPC_SERVER_PORT), NULL); - if(s.conn != NULL) { - udp_bind(s.conn, UIP_HTONS(IP64_DHCPC_CLIENT_PORT)); - } - if(conn2 != NULL) { - udp_bind(conn2, UIP_HTONS(IP64_DHCPC_CLIENT_PORT)); - } - PT_INIT(&s.pt); -} -/*---------------------------------------------------------------------------*/ -void -ip64_dhcpc_appcall(process_event_t ev, void *data) -{ - if(ev == tcpip_event || ev == PROCESS_EVENT_TIMER) { - handle_dhcp(ev, data); - } -} -/*---------------------------------------------------------------------------*/ -void -ip64_dhcpc_request(void) -{ - uip_ipaddr_t ipaddr; - - if(s.state == STATE_INITIAL) { - uip_ipaddr(&ipaddr, 0,0,0,0); - uip_sethostaddr(&ipaddr); - handle_dhcp(PROCESS_EVENT_NONE, NULL); - } -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/ip64/ip64-dhcpc.h b/os/services/ip64/ip64-dhcpc.h deleted file mode 100644 index 1bc88daf6..000000000 --- a/os/services/ip64/ip64-dhcpc.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -#ifndef __IP64_DHCPC_H__ -#define __IP64_DHCPC_H__ - -struct ip64_dhcpc_state { - struct pt pt; - char state; - struct uip_udp_conn *conn; - struct etimer etimer; - uint32_t ticks; - const void *mac_addr; - int mac_len; - - uint8_t serverid[4]; - - uint16_t lease_time[2]; - uip_ipaddr_t ipaddr; - uip_ipaddr_t netmask; - uip_ipaddr_t dnsaddr; - uip_ipaddr_t default_router; -}; - -void ip64_dhcpc_init(const void *mac_addr, int mac_len); -void ip64_dhcpc_request(void); - -void ip64_dhcpc_appcall(process_event_t ev, void *data); - -/* Mandatory callbacks provided by the user. */ -void ip64_dhcpc_configured(const struct ip64_dhcpc_state *s); -void ip64_dhcpc_unconfigured(const struct ip64_dhcpc_state *s); - -#endif /* __IP64_DHCPC_H__ */ diff --git a/os/services/ip64/ip64-dns64.c b/os/services/ip64/ip64-dns64.c deleted file mode 100644 index 64d413dde..000000000 --- a/os/services/ip64/ip64-dns64.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2014, Thingsquare, http://www.thingsquare.com/. - * 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 "ip64/ip64.h" -#include "ipv6/ip64-addr.h" -#include "ip64/ip64-dns64.h" - -#include - -#define DEBUG 0 - -#if DEBUG -#undef PRINTF -#define PRINTF(...) printf(__VA_ARGS__) -#else /* DEBUG */ -#define PRINTF(...) -#endif /* DEBUG */ - -struct dns_hdr { - uint8_t id[2]; - uint8_t flags1, flags2; -#define DNS_FLAG1_RESPONSE 0x80 -#define DNS_FLAG1_OPCODE_STATUS 0x10 -#define DNS_FLAG1_OPCODE_INVERSE 0x08 -#define DNS_FLAG1_OPCODE_STANDARD 0x00 -#define DNS_FLAG1_AUTHORATIVE 0x04 -#define DNS_FLAG1_TRUNC 0x02 -#define DNS_FLAG1_RD 0x01 -#define DNS_FLAG2_RA 0x80 -#define DNS_FLAG2_ERR_MASK 0x0f -#define DNS_FLAG2_ERR_NONE 0x00 -#define DNS_FLAG2_ERR_NAME 0x03 - uint8_t numquestions[2]; - uint8_t numanswers[2]; - uint8_t numauthrr[2]; - uint8_t numextrarr[2]; -}; - -#define DNS_QUESTION_TYPE0 0 -#define DNS_QUESTION_TYPE1 1 -#define DNS_QUESTION_CLASS0 2 -#define DNS_QUESTION_CLASS1 3 -#define DNS_QUESTION_SIZE 4 - -struct dns_answer { - /* DNS answer record starts with either a domain name or a pointer - * to a name already present somewhere in the packet. */ - uint8_t type[2]; - uint8_t class[2]; - uint8_t ttl[4]; - uint8_t len[2]; - union { - uint8_t ip6[16]; - uint8_t ip4[4]; - } addr; -}; - -#define DNS_TYPE_A 1 -#define DNS_TYPE_AAAA 28 - -#define DNS_CLASS_IN 1 -#define DNS_CLASS_ANY 255 - -/*---------------------------------------------------------------------------*/ -void -ip64_dns64_6to4(const uint8_t *ipv6data, int ipv6datalen, - uint8_t *ipv4data, int ipv4datalen) -{ - int i, j; - int qlen; - uint8_t *qdata; - uint8_t *q; - struct dns_hdr *hdr; - - hdr = (struct dns_hdr *)ipv4data; - PRINTF("ip64_dns64_6to4 id: %02x%02x\n", hdr->id[0], hdr->id[1]); - PRINTF("ip64_dns64_6to4 flags1: 0x%02x\n", hdr->flags1); - PRINTF("ip64_dns64_6to4 flags2: 0x%02x\n", hdr->flags2); - PRINTF("ip64_dns64_6to4 numquestions: 0x%02x\n", ((hdr->numquestions[0] << 8) + hdr->numquestions[1])); - PRINTF("ip64_dns64_6to4 numanswers: 0x%02x\n", ((hdr->numanswers[0] << 8) + hdr->numanswers[1])); - PRINTF("ip64_dns64_6to4 numauthrr: 0x%02x\n", ((hdr->numauthrr[0] << 8) + hdr->numauthrr[1])); - PRINTF("ip64_dns64_6to4 numextrarr: 0x%02x\n", ((hdr->numextrarr[0] << 8) + hdr->numextrarr[1])); - - /* Find the DNS question header by scanning through the question - labels. */ - qdata = ipv4data + sizeof(struct dns_hdr); - for(i = 0; i < ((hdr->numquestions[0] << 8) + hdr->numquestions[1]); i++) { - do { - qlen = *qdata; - qdata++; - for(j = 0; j < qlen; j++) { - qdata++; - if(qdata > ipv4data + ipv4datalen) { - PRINTF("ip64_dns64_6to4: packet ended while parsing\n"); - return; - } - } - } while(qlen != 0); - q = qdata; - if(q[DNS_QUESTION_CLASS0] == 0 && q[DNS_QUESTION_CLASS1] == DNS_CLASS_IN && - q[DNS_QUESTION_TYPE0] == 0 && q[DNS_QUESTION_TYPE1] == DNS_TYPE_AAAA) { - q[DNS_QUESTION_TYPE1] = DNS_TYPE_A; - } - - qdata += DNS_QUESTION_SIZE; - } -} -/*---------------------------------------------------------------------------*/ -int -ip64_dns64_4to6(const uint8_t *ipv4data, int ipv4datalen, - uint8_t *ipv6data, int ipv6datalen) -{ - uint8_t n; - int i, j; - int qlen, len; - const uint8_t *qdata, *adata; - uint8_t *qcopy, *acopy, *lenptr; - uint8_t *q; - struct dns_hdr *hdr; - - hdr = (struct dns_hdr *)ipv4data; - PRINTF("ip64_dns64_4to6 id: %02x%02x\n", hdr->id[0], hdr->id[1]); - PRINTF("ip64_dns64_4to6 flags1: 0x%02x\n", hdr->flags1); - PRINTF("ip64_dns64_4to6 flags2: 0x%02x\n", hdr->flags2); - PRINTF("ip64_dns64_4to6 numquestions: 0x%02x\n", ((hdr->numquestions[0] << 8) + hdr->numquestions[1])); - PRINTF("ip64_dns64_4to6 numanswers: 0x%02x\n", ((hdr->numanswers[0] << 8) + hdr->numanswers[1])); - PRINTF("ip64_dns64_4to6 numauthrr: 0x%02x\n", ((hdr->numauthrr[0] << 8) + hdr->numauthrr[1])); - PRINTF("ip64_dns64_4to6 numextrarr: 0x%02x\n", ((hdr->numextrarr[0] << 8) + hdr->numextrarr[1])); - - /* Find the DNS answer header by scanning through the question - labels. */ - qdata = ipv4data + sizeof(struct dns_hdr); - qcopy = ipv6data + sizeof(struct dns_hdr); - for(i = 0; i < ((hdr->numquestions[0] << 8) + hdr->numquestions[1]); i++) { - do { - qlen = *qdata; - qdata++; - qcopy++; - for(j = 0; j < qlen; j++) { - qdata++; - qcopy++; - if(qdata > ipv4data + ipv4datalen) { - PRINTF("ip64_dns64_4to6: packet ended while parsing\n"); - return ipv6datalen; - } - } - } while(qlen != 0); - q = qcopy; - if(q[DNS_QUESTION_CLASS0] == 0 && q[DNS_QUESTION_CLASS1] == DNS_CLASS_IN && - q[DNS_QUESTION_TYPE0] == 0 && q[DNS_QUESTION_TYPE1] == DNS_TYPE_AAAA) { - q[DNS_QUESTION_TYPE1] = DNS_TYPE_AAAA; - } - - qdata += DNS_QUESTION_SIZE; - qcopy += DNS_QUESTION_SIZE; - } - - adata = qdata; - acopy = qcopy; - - /* Go through the answers section and update the answers. */ - for(i = 0; i < ((hdr->numanswers[0] << 8) + hdr->numanswers[1]); i++) { - - n = *adata; - if(n & 0xc0) { - /* Short-hand name format: 2 bytes */ - *acopy++ = *adata++; - *acopy++ = *adata++; - } else { - /* Name spelled out */ - do { - n = *adata; - adata++; - acopy++; - for(j = 0; j < n; j++) { - *acopy++ = *adata++; - } - } while(n != 0); - } - - if(adata[0] == 0 && adata[1] == DNS_TYPE_A) { - /* Update the type field from A to AAAA */ - *acopy = *adata; - acopy++; - adata++; - *acopy = DNS_TYPE_AAAA; - acopy++; - adata++; - - /* Get the length of the address record. Should be 4. */ - lenptr = &acopy[6]; - len = (adata[6] << 8) + adata[7]; - - /* Copy the class, the TTL, and the data length */ - memcpy(acopy, adata, 2 + 4 + 2); - acopy += 8; - adata += 8; - - if(len == 4) { - uip_ip4addr_t addr; - uip_ipaddr(&addr, adata[0], adata[1], adata[2], adata[3]); - ip64_addr_4to6(&addr, (uip_ip6addr_t *)acopy); - - adata += len; - acopy += 16; - lenptr[0] = 0; - lenptr[1] = 16; - ipv6datalen += 12; - - } else { - memcpy(acopy, adata, len); - acopy += len; - adata += len; - } - } else { - len = (adata[8] << 8) + adata[9]; - - /* Copy the type, class, the TTL, and the data length */ - memcpy(acopy, adata, 2 + 2 + 4 + 2); - acopy += 10; - adata += 10; - - /* Copy the data */ - memcpy(acopy, adata, len); - acopy += len; - adata += len; - } - } - return ipv6datalen; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/ip64/ip64-dns64.h b/os/services/ip64/ip64-dns64.h deleted file mode 100644 index 27eb73127..000000000 --- a/os/services/ip64/ip64-dns64.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2014, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_DNS64_H_ -#define IP64_DNS64_H_ - -void ip64_dns64_6to4(const uint8_t *ipv6data, int ipv6datalen, - uint8_t *ipv4data, int ipv4datalen); -int ip64_dns64_4to6(const uint8_t *ipv4data, int ipv4datalen, - uint8_t *ipv6data, int ipv6datalen); - -#endif /* IP64_DNS64_H_ */ diff --git a/os/services/ip64/ip64-driver.h b/os/services/ip64/ip64-driver.h deleted file mode 100644 index 50b00cfd9..000000000 --- a/os/services/ip64/ip64-driver.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_DRIVER_H -#define IP64_DRIVER_H - -struct ip64_driver { - void (* init)(void); - int (* output)(uint8_t *packet, uint16_t packet_len); -}; - - -#endif /* IP64_DRIVER_H */ diff --git a/os/services/ip64/ip64-eth-interface.c b/os/services/ip64/ip64-eth-interface.c deleted file mode 100644 index dc89610e5..000000000 --- a/os/services/ip64/ip64-eth-interface.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "dev/slip.h" - -#include "ip64/ip64.h" -#include "ip64/ip64-arp.h" -#include "ip64/ip64-eth-interface.h" - -#include - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" -#define printf(...) -/*---------------------------------------------------------------------------*/ -void -ip64_eth_interface_input(uint8_t *packet, uint16_t len) -{ - struct ip64_eth_hdr *ethhdr; - ethhdr = (struct ip64_eth_hdr *)packet; - - if(ethhdr->type == UIP_HTONS(IP64_ETH_TYPE_ARP)) { - len = ip64_arp_arp_input(packet, len); - - if(len > 0) { - IP64_ETH_DRIVER.output(packet, len); - } - } else if(ethhdr->type == UIP_HTONS(IP64_ETH_TYPE_IP) && - len > sizeof(struct ip64_eth_hdr)) { - printf("-------------->\n"); - uip_len = ip64_4to6(&packet[sizeof(struct ip64_eth_hdr)], - len - sizeof(struct ip64_eth_hdr), - uip_buf); - if(uip_len > 0) { - printf("ip64_interface_process: converted %d bytes\n", uip_len); - - printf("ip64-interface: input source "); - PRINT6ADDR(&UIP_IP_BUF->srcipaddr); - PRINTF(" destination "); - PRINT6ADDR(&UIP_IP_BUF->destipaddr); - PRINTF("\n"); - - tcpip_input(); - printf("Done\n"); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - printf("ip64-eth-interface: init\n"); -} -/*---------------------------------------------------------------------------*/ -static int -output(void) -{ - int len, ret; - - printf("ip64-interface: output source "); - PRINT6ADDR(&UIP_IP_BUF->srcipaddr); - PRINTF(" destination "); - PRINT6ADDR(&UIP_IP_BUF->destipaddr); - PRINTF("\n"); - - printf("<--------------\n"); - len = ip64_6to4(uip_buf, uip_len, - &ip64_packet_buffer[sizeof(struct ip64_eth_hdr)]); - - printf("ip64-interface: output len %d\n", len); - if(len > 0) { - if(ip64_arp_check_cache(&ip64_packet_buffer[sizeof(struct ip64_eth_hdr)])) { - printf("Create header\n"); - ret = ip64_arp_create_ethhdr(ip64_packet_buffer, - &ip64_packet_buffer[sizeof(struct ip64_eth_hdr)]); - if(ret > 0) { - len += ret; - IP64_ETH_DRIVER.output(ip64_packet_buffer, len); - } - } else { - printf("Create request\n"); - len = ip64_arp_create_arp_request(ip64_packet_buffer, - &ip64_packet_buffer[sizeof(struct ip64_eth_hdr)]); - return IP64_ETH_DRIVER.output(ip64_packet_buffer, len); - } - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -const struct uip_fallback_interface ip64_eth_interface = { - init, - output -}; -/*---------------------------------------------------------------------------*/ diff --git a/os/services/ip64/ip64-eth-interface.h b/os/services/ip64/ip64-eth-interface.h deleted file mode 100644 index 1471b5d18..000000000 --- a/os/services/ip64/ip64-eth-interface.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_ETH_INTERFACE_H -#define IP64_ETH_INTERFACE_H - -#include "net/ipv6/uip.h" - -void ip64_eth_interface_input(uint8_t *packet, uint16_t len); - -extern const struct uip_fallback_interface ip64_eth_interface; - -#endif /* IP64_ETH_INTERFACE_H */ diff --git a/os/services/ip64/ip64-eth.c b/os/services/ip64/ip64-eth.c deleted file mode 100644 index 945d8886c..000000000 --- a/os/services/ip64/ip64-eth.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 "ip64/ip64-eth.h" - -#include - -struct ip64_eth_addr ip64_eth_addr; - -/*---------------------------------------------------------------------------*/ -void -ip64_eth_addr_set(struct ip64_eth_addr *addr) -{ - memcpy(&ip64_eth_addr, addr, sizeof(struct ip64_eth_addr)); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/ip64/ip64-eth.h b/os/services/ip64/ip64-eth.h deleted file mode 100644 index a96d304ef..000000000 --- a/os/services/ip64/ip64-eth.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_ETH_H -#define IP64_ETH_H - -#include "contiki.h" - -/** - * The Ethernet address. - */ -struct ip64_eth_addr { - uint8_t addr[6]; -}; - -extern struct ip64_eth_addr ip64_eth_addr; - -void ip64_eth_addr_set(struct ip64_eth_addr *addr); - -/** - * The Ethernet header. - */ -struct ip64_eth_hdr { - struct ip64_eth_addr dest; - struct ip64_eth_addr src; - uint16_t type; -}; - -#define IP64_ETH_TYPE_ARP 0x0806 -#define IP64_ETH_TYPE_IP 0x0800 -#define IP64_ETH_TYPE_IPV6 0x86dd - - -#endif /* IP64_ETH_H */ diff --git a/os/services/ip64/ip64-interface.h b/os/services/ip64/ip64-interface.h deleted file mode 100644 index 574ae1c7f..000000000 --- a/os/services/ip64/ip64-interface.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_INTERFACE_H -#define IP64_INTERFACE_H - -struct ip64_interface { - void (* init)(void); - int (* input)(uint8_t *packet, uint16_t packet_len); - int (* output)(uint8_t *packet, uint16_t packet_len); -}; - - -#endif /* IP64_INTERFACE_H */ diff --git a/os/services/ip64/ip64-ipv4-dhcp.c b/os/services/ip64/ip64-ipv4-dhcp.c deleted file mode 100644 index 99d7c3e65..000000000 --- a/os/services/ip64/ip64-ipv4-dhcp.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 "contiki.h" -#include "contiki-net.h" -#include "ip64/ip64-dhcpc.h" - -#include "ip64/ip64.h" -#include "ip64/ip64-eth.h" -#include "ipv6/ip64-addr.h" - -#include - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -PROCESS(ip64_ipv4_dhcp_process, "IPv4 DHCP"); - -uip_ipaddr_t uip_hostaddr; /* Needed because it is referenced by dhcpc.c */ - - -/*---------------------------------------------------------------------------*/ -void -ip64_ipv4_dhcp_init(void) -{ - printf("IP64: Starting DHCPv4\n"); - process_start(&ip64_ipv4_dhcp_process, NULL); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ip64_ipv4_dhcp_process, ev, data) -{ - PROCESS_BEGIN(); - - ip64_dhcpc_init(&ip64_eth_addr, sizeof(ip64_eth_addr)); - - PRINTF("IP64: Inited\n"); - - ip64_dhcpc_request(); - PRINTF("IP64: Requested\n"); - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == tcpip_event || - ev == PROCESS_EVENT_TIMER) { - ip64_dhcpc_appcall(ev, data); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -ip64_dhcpc_configured(const struct ip64_dhcpc_state *s) -{ - uip_ip6addr_t ip6dnsaddr; - PRINTF("IP64: DHCP Configured with %d.%d.%d.%d\n", - s->ipaddr.u8[0], s->ipaddr.u8[1], - s->ipaddr.u8[2], s->ipaddr.u8[3]); - - ip64_set_hostaddr((uip_ip4addr_t *)&s->ipaddr); - ip64_set_netmask((uip_ip4addr_t *)&s->netmask); - ip64_set_draddr((uip_ip4addr_t *)&s->default_router); - if(!uip_ip4addr_cmp((uip_ip4addr_t *)&s->dnsaddr, &uip_all_zeroes_addr)) { - /* Note: Currently we assume only one DNS server */ - uip_ipaddr_t * dns = uip_nameserver_get(0); - /* Only update DNS entry if it is empty or already IPv4 */ - if(uip_is_addr_unspecified(dns) || ip64_addr_is_ip64(dns)) { - ip64_addr_4to6((uip_ip4addr_t *)&s->dnsaddr, &ip6dnsaddr); - uip_nameserver_update(&ip6dnsaddr, uip_ntohs(s->lease_time[0])*65536ul + uip_ntohs(s->lease_time[1])); - } - } -} -/*---------------------------------------------------------------------------*/ -void -ip64_dhcpc_unconfigured(const struct ip64_dhcpc_state *s) -{ -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/ip64/ip64-ipv4-dhcp.h b/os/services/ip64/ip64-ipv4-dhcp.h deleted file mode 100644 index 295af6854..000000000 --- a/os/services/ip64/ip64-ipv4-dhcp.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_IPV4_DHCP_H -#define IP64_IPV4_DHCP_H - -void ip64_ipv4_dhcp_init(void); - -#endif /* IP64_IPV4_DHCP_H */ diff --git a/os/services/ip64/ip64-null-driver.c b/os/services/ip64/ip64-null-driver.c deleted file mode 100644 index 97dd0505b..000000000 --- a/os/services/ip64/ip64-null-driver.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 "contiki-net.h" - -#include "ip64/ip64-driver.h" -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ -} -/*---------------------------------------------------------------------------*/ -static int -output(uint8_t *packet, uint16_t len) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -const struct ip64_driver ip64_null_driver = { - init, - output -}; diff --git a/os/services/ip64/ip64-null-driver.h b/os/services/ip64/ip64-null-driver.h deleted file mode 100644 index fc77273b8..000000000 --- a/os/services/ip64/ip64-null-driver.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_NULL_DRIVER_H -#define IP64_NULL_DRIVER_H - -#include "ip64/ip64-driver.h" - -extern const struct ip64_driver ip64_null_driver; - -#endif /* IP64_NULL_DRIVER_H */ diff --git a/os/services/ip64/ip64-slip-interface.c b/os/services/ip64/ip64-slip-interface.c deleted file mode 100644 index fb4f69627..000000000 --- a/os/services/ip64/ip64-slip-interface.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "dev/slip.h" - -#include "ip64/ip64.h" - -#include -#include - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -static uip_ipaddr_t last_sender; - -/*---------------------------------------------------------------------------*/ -void -ip64_slip_interface_input(uint8_t *packet, uint16_t len) -{ - /* Dummy definition: this function is not actually called, but must - be here to conform to the ip65-interface.h structure. */ -} -/*---------------------------------------------------------------------------*/ -static void -input_callback(void) -{ - /*PRINTF("SIN: %u\n", uip_len);*/ - if(uip_buf[0] == '!') { - PRINTF("Got configuration message of type %c\n", uip_buf[1]); - uipbuf_clear(); -#if 0 - if(uip_buf[1] == 'P') { - uip_ipaddr_t prefix; - /* Here we set a prefix !!! */ - memset(&prefix, 0, 16); - memcpy(&prefix, &uip_buf[2], 8); - PRINTF("Setting prefix "); - PRINT6ADDR(&prefix); - PRINTF("\n"); - set_prefix_64(&prefix); - } -#endif - } else if(uip_buf[0] == '?') { - PRINTF("Got request message of type %c\n", uip_buf[1]); - if(uip_buf[1] == 'M') { - const char *hexchar = "0123456789abcdef"; - int j; - /* this is just a test so far... just to see if it works */ - uip_buf[0] = '!'; - for(j = 0; j < 8; j++) { - uip_buf[2 + j * 2] = hexchar[uip_lladdr.addr[j] >> 4]; - uip_buf[3 + j * 2] = hexchar[uip_lladdr.addr[j] & 15]; - } - uip_len = 18; - slip_write(uip_buf, uip_len); - } - uipbuf_clear(); - } else { - - /* Save the last sender received over SLIP to avoid bouncing the - packet back if no route is found */ - uip_ipaddr_copy(&last_sender, &UIP_IP_BUF->srcipaddr); - - uint16_t len = ip64_4to6(uip_buf, uip_len, - ip64_packet_buffer); - if(len > 0) { - memcpy(uip_buf, ip64_packet_buffer, len); - uip_len = len; - /* PRINTF("send len %d\n", len); */ - } else { - uipbuf_clear(); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - PRINTF("ip64-slip-interface: init\n"); - process_start(&slip_process, NULL); - slip_set_input_callback(input_callback); -} -/*---------------------------------------------------------------------------*/ -static int -output(void) -{ - int len; - - PRINTF("ip64-slip-interface: output source "); - - /* - PRINT6ADDR(&UIP_IP_BUF->srcipaddr); - PRINTF(" destination "); - PRINT6ADDR(&UIP_IP_BUF->destipaddr); - PRINTF("\n"); - */ - if(uip_ipaddr_cmp(&last_sender, &UIP_IP_BUF->srcipaddr)) { - PRINTF("ip64-interface: output, not sending bounced message\n"); - } else { - len = ip64_6to4(uip_buf, uip_len, - ip64_packet_buffer); - PRINTF("ip64-interface: output len %d\n", len); - if(len > 0) { - memcpy(uip_buf, ip64_packet_buffer, len); - uip_len = len; - slip_send(); - return len; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -const struct uip_fallback_interface ip64_slip_interface = { - init, output -}; -/*---------------------------------------------------------------------------*/ diff --git a/os/services/ip64/ip64-slip-interface.h b/os/services/ip64/ip64-slip-interface.h deleted file mode 100644 index c3cf26a2f..000000000 --- a/os/services/ip64/ip64-slip-interface.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_SLIP_INTERFACE_H -#define IP64_SLIP_INTERFACE_H - -void ip64_slip_interface_input(uint8_t *packet, uint16_t len); - -extern const struct uip_fallback_interface ip64_slip_interface; - -#endif /* IP64_SLIP_INTERFACE_H */ diff --git a/os/services/ip64/ip64-special-ports.c b/os/services/ip64/ip64-special-ports.c deleted file mode 100644 index bb88797ff..000000000 --- a/os/services/ip64/ip64-special-ports.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 "ip64/ip64.h" -#include "ip64/ip64-special-ports.h" - -#ifndef IP64_SPECIAL_PORTS_CONF_ENABLE -#define EMPTY_DEFINITIONS 1 -#else -#if IP64_SPECIAL_PORTS_CONF_ENABLE == 0 -#define EMPTY_DEFINITIONS 1 -#endif /* IP64_SPECIAL_PORTS_CONF_ENABLE */ -#endif /* IP64_SPECIAL_PORTS_CONF_ENABLE */ - - - -#if EMPTY_DEFINITIONS -/*---------------------------------------------------------------------------*/ -int -ip64_special_ports_translate_incoming(uint16_t incoming_port, - uip_ip6addr_t *newaddr, - uint16_t *newport) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -int -ip64_special_ports_translate_outgoing(uint16_t incoming_port, - const uip_ip6addr_t *ip6addr, - uint16_t *newport) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -int -ip64_special_ports_incoming_is_special(uint16_t port) -{ - /* Default is to have no special ports. */ - return 0; -} -/*---------------------------------------------------------------------------*/ -int -ip64_special_ports_outgoing_is_special(uint16_t port) -{ - /* Default is to have no special ports. */ - return 0; -} -/*---------------------------------------------------------------------------*/ -#endif /* EMPTY_DEFINITIONS */ diff --git a/os/services/ip64/ip64-special-ports.h b/os/services/ip64/ip64-special-ports.h deleted file mode 100644 index 312a24366..000000000 --- a/os/services/ip64/ip64-special-ports.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_SPECIAL_PORTS_H -#define IP64_SPECIAL_PORTS_H - -/* The IP64 special ports module allows specific ports on the IP64 - translator to be mapped to specific address in the IPv6 - network. The module provides three function prototypes that must be - implemented by the user. - - The IP64 special ports module must be enabled by - -#define IP64_SPECIAL_PORTS_CONF_ENABLE 1 - - Otherwise, the functions are replaced by empty default definitions - in the ip64-special-ports.c module. - - Port numbers are always in network byte order. */ - - -/* Translate the special port to an IPv6 address for inbound - packets. */ -int ip64_special_ports_translate_incoming(uint16_t incoming_port, - uip_ip6addr_t *newaddr, - uint16_t *newport); -int ip64_special_ports_translate_outgoing(uint16_t incoming_port, - const uip_ip6addr_t *ip6addr, - uint16_t *newport); -/* Check if an incoming (destination) port is special. */ -int ip64_special_ports_incoming_is_special(uint16_t port); - -/* Check if an outgoing (source) port is special. */ -int ip64_special_ports_outgoing_is_special(uint16_t port); - - -#endif /* IP64_SPECIAL_PORTS_H */ diff --git a/os/services/ip64/ip64.c b/os/services/ip64/ip64.c deleted file mode 100644 index f2bc06d25..000000000 --- a/os/services/ip64/ip64.c +++ /dev/null @@ -1,914 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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. - * - */ - -/* The ip64 module is a translator between IPv6 and IPv4 packets. The - IPv6 packets come from an IPv6 network and are translated into a - single IPv4 host, as shown in the ASCII graphics below. The IPv6 - network typically is a low-power RF network and the IPv4 network - typically is an Ethernet. - - +----------------+ - | | - | | +------+ - | IPv6 network |---| ip64 |-- IPv4 network - | | +------+ - | | - +----------------+ - - ip64 maps all IPv6 addresses from inside the IPv6 network to its - own IPv4 address. This IPv4 address would typically have been - obtained with DHCP from the IPv4 network, but the exact way this - has been obtained is outside the scope of the ip64 module. The IPv4 - address is given to the ip64 module through the - ip64_set_ipv4_address() function. -*/ - -#include "ip64/ip64.h" -#include "ipv6/ip64-addr.h" -#include "ip64/ip64-addrmap.h" -#include "ip64-conf.h" -#include "ip64/ip64-special-ports.h" -#include "ip64/ip64-eth-interface.h" -#include "ip64/ip64-slip-interface.h" -#include "ip64/ip64-dns64.h" -#include "net/ipv6/uip-ds6.h" -#include "ip64/ip64-ipv4-dhcp.h" -#include "contiki-net.h" - -#include "net/ipv6/uip-debug.h" - -#include /* for memcpy() */ -#include /* for printf() */ - -#define DEBUG 0 - -#if DEBUG -#undef PRINTF -#define PRINTF(...) printf(__VA_ARGS__) -#else /* DEBUG */ -#define PRINTF(...) -#endif /* DEBUG */ - -struct ipv6_hdr { - uint8_t vtc; - uint8_t tcflow; - uint16_t flow; - uint8_t len[2]; - uint8_t nxthdr, hoplim; - uip_ip6addr_t srcipaddr, destipaddr; -}; - -struct ipv4_hdr { - uint8_t vhl, - tos, - len[2], - ipid[2], - ipoffset[2], - ttl, - proto; - uint16_t ipchksum; - uip_ip4addr_t srcipaddr, destipaddr; -}; - -#define EPHEMERAL_PORTRANGE 1024 - -#define IPV6_HDRLEN 40 -#define IPV4_HDRLEN 20 - -#define IP_PROTO_ICMPV4 1 -#define IP_PROTO_TCP 6 -#define IP_PROTO_UDP 17 -#define IP_PROTO_ICMPV6 58 - -#define ICMP_ECHO_REPLY 0 -#define ICMP_ECHO 8 -#define ICMP6_ECHO_REPLY 129 -#define ICMP6_ECHO 128 - -struct tcp_hdr { - uint16_t srcport; - uint16_t destport; - uint8_t seqno[4]; - uint8_t ackno[4]; - uint8_t tcpoffset; - uint8_t flags; - uint8_t wnd[2]; - uint16_t tcpchksum; - uint8_t urgp[2]; - uint8_t optdata[4]; -}; - -struct udp_hdr { - uint16_t srcport; - uint16_t destport; - uint16_t udplen; - uint16_t udpchksum; -}; - -struct icmpv4_hdr { - uint8_t type, icode; - uint16_t icmpchksum; -}; - -struct icmpv6_hdr { - uint8_t type, icode; - uint16_t icmpchksum; - uint16_t id, seqno; -}; - -#define BUFSIZE UIP_BUFSIZE - -uip_buf_t ip64_packet_buffer_aligned; -uint8_t *ip64_packet_buffer = ip64_packet_buffer_aligned.u8; - -uint16_t ip64_packet_buffer_maxlen = BUFSIZE; - -static uip_ip4addr_t ip64_hostaddr; -static uip_ip4addr_t ip64_netmask; -static uip_ip4addr_t ip64_draddr; - -static uint16_t ipid; -static uint8_t ip64_hostaddr_configured = 0; - -static uip_ip6addr_t ipv6_local_address; -static uint8_t ipv6_local_address_configured = 0; - -static uip_ip4addr_t ipv4_broadcast_addr; - -/* Lifetimes for address mappings. */ -#define SYN_LIFETIME (CLOCK_SECOND * 20) -#define RST_LIFETIME (CLOCK_SECOND * 30) -#define DEFAULT_LIFETIME (CLOCK_SECOND * 60 * 5) - -/* TCP flag defines */ -#define TCP_FIN 0x01 -#define TCP_SYN 0x02 -#define TCP_RST 0x04 - -#define DNS_PORT 53 - -/*---------------------------------------------------------------------------*/ -void -ip64_init(void) -{ - int i; - uint8_t state; - - uip_ipaddr(&ipv4_broadcast_addr, 255,255,255,255); - ip64_hostaddr_configured = 0; - - PRINTF("ip64_init\n"); - IP64_ETH_DRIVER.init(); -#if IP64_DHCP - ip64_ipv4_dhcp_init(); -#endif /* IP64_CONF_DHCP */ - - /* Specify an IPv6 address for local communication to the - host. We'll just pick the first one we find in our list. */ - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - PRINTF("i %d used %d\n", i, uip_ds6_if.addr_list[i].isused); - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - ip64_set_ipv6_address(&uip_ds6_if.addr_list[i].ipaddr); - break; - } - } - -} -/*---------------------------------------------------------------------------*/ -void -ip64_set_hostaddr(const uip_ip4addr_t *hostaddr) -{ - ip64_hostaddr_configured = 1; - ip64_addr_copy4(&ip64_hostaddr, hostaddr); -} -/*---------------------------------------------------------------------------*/ -void -ip64_set_netmask(const uip_ip4addr_t *netmask) -{ - ip64_addr_copy4(&ip64_netmask, netmask); -} -/*---------------------------------------------------------------------------*/ -void -ip64_set_draddr(const uip_ip4addr_t *draddr) -{ - ip64_addr_copy4(&ip64_draddr, draddr); -} -/*---------------------------------------------------------------------------*/ -const uip_ip4addr_t * -ip64_get_hostaddr(void) -{ - return &ip64_hostaddr; -} -/*---------------------------------------------------------------------------*/ -const uip_ip4addr_t * -ip64_get_netmask(void) -{ - return &ip64_netmask; -} -/*---------------------------------------------------------------------------*/ -const uip_ip4addr_t * -ip64_get_draddr(void) -{ - return &ip64_draddr; -} -/*---------------------------------------------------------------------------*/ -void -ip64_set_ipv4_address(const uip_ip4addr_t *addr, const uip_ip4addr_t *netmask) -{ - ip64_set_hostaddr(addr); - ip64_set_netmask(netmask); - - PRINTF("ip64_set_ipv4_address: configuring address %d.%d.%d.%d/%d.%d.%d.%d\n", - ip64_hostaddr.u8[0], ip64_hostaddr.u8[1], - ip64_hostaddr.u8[2], ip64_hostaddr.u8[3], - ip64_netmask.u8[0], ip64_netmask.u8[1], - ip64_netmask.u8[2], ip64_netmask.u8[3]); -} -/*---------------------------------------------------------------------------*/ -void -ip64_set_ipv6_address(const uip_ip6addr_t *addr) -{ - ip64_addr_copy6(&ipv6_local_address, (const uip_ip6addr_t *)addr); - ipv6_local_address_configured = 1; -#if DEBUG - PRINTF("ip64_set_ipv6_address: configuring address "); - uip_debug_ipaddr_print(addr); - PRINTF("\n"); -#endif /* DEBUG */ -} -/*---------------------------------------------------------------------------*/ -static uint16_t -chksum(uint16_t sum, const uint8_t *data, uint16_t len) -{ - uint16_t t; - const uint8_t *dataptr; - const uint8_t *last_byte; - - dataptr = data; - last_byte = data + len - 1; - - while(dataptr < last_byte) { /* At least two more bytes */ - t = (dataptr[0] << 8) + dataptr[1]; - sum += t; - if(sum < t) { - sum++; /* carry */ - } - dataptr += 2; - } - - if(dataptr == last_byte) { - t = (dataptr[0] << 8) + 0; - sum += t; - if(sum < t) { - sum++; /* carry */ - } - } - - /* Return sum in host byte order. */ - return sum; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -ipv4_checksum(struct ipv4_hdr *hdr) -{ - uint16_t sum; - - sum = chksum(0, (uint8_t *)hdr, IPV4_HDRLEN); - return (sum == 0) ? 0xffff : uip_htons(sum); -} -/*---------------------------------------------------------------------------*/ -static uint16_t -ipv4_transport_checksum(const uint8_t *packet, uint16_t len, uint8_t proto) -{ - uint16_t transport_layer_len; - uint16_t sum; - struct ipv4_hdr *v4hdr = (struct ipv4_hdr *)packet; - - transport_layer_len = len - IPV4_HDRLEN; - - /* First sum pseudoheader. */ - - if(proto != IP_PROTO_ICMPV4) { - /* IP protocol and length fields. This addition cannot carry. */ - sum = transport_layer_len + proto; - /* Sum IP source and destination addresses. */ - sum = chksum(sum, (uint8_t *)&v4hdr->srcipaddr, 2 * sizeof(uip_ip4addr_t)); - } else { - /* ping replies' checksums are calculated over the icmp-part only */ - sum = 0; - } - - /* Sum transport layer header and data. */ - sum = chksum(sum, &packet[IPV4_HDRLEN], transport_layer_len); - - return (sum == 0) ? 0xffff : uip_htons(sum); -} -/*---------------------------------------------------------------------------*/ -static uint16_t -ipv6_transport_checksum(const uint8_t *packet, uint16_t len, uint8_t proto) -{ - uint16_t transport_layer_len; - uint16_t sum; - struct ipv6_hdr *v6hdr = (struct ipv6_hdr *)packet; - - transport_layer_len = len - IPV6_HDRLEN; - - /* First sum pseudoheader. */ - - /* IP protocol and length fields. This addition cannot carry. */ - sum = transport_layer_len + proto; - /* Sum IP source and destination addresses. */ - sum = chksum(sum, (uint8_t *)&v6hdr->srcipaddr, sizeof(uip_ip6addr_t)); - sum = chksum(sum, (uint8_t *)&v6hdr->destipaddr, sizeof(uip_ip6addr_t)); - - /* Sum transport layer header and data. */ - sum = chksum(sum, &packet[IPV6_HDRLEN], transport_layer_len); - - return (sum == 0) ? 0xffff : uip_htons(sum); -} -/*---------------------------------------------------------------------------*/ -int -ip64_6to4(const uint8_t *ipv6packet, const uint16_t ipv6packet_len, - uint8_t *resultpacket) -{ - struct ipv4_hdr *v4hdr; - struct ipv6_hdr *v6hdr; - struct udp_hdr *udphdr; - struct tcp_hdr *tcphdr; - struct icmpv4_hdr *icmpv4hdr; - struct icmpv6_hdr *icmpv6hdr; - uint16_t ipv6len, ipv4len; - struct ip64_addrmap_entry *m; - - v6hdr = (struct ipv6_hdr *)ipv6packet; - v4hdr = (struct ipv4_hdr *)resultpacket; - - if((v6hdr->len[0] << 8) + v6hdr->len[1] <= ipv6packet_len) { - ipv6len = (v6hdr->len[0] << 8) + v6hdr->len[1] + IPV6_HDRLEN; - } else { - PRINTF("ip64_6to4: packet smaller than reported in IPv6 header, dropping\n"); - return 0; - } - - /* We copy the data from the IPv6 packet into the IPv4 packet. We do - not modify the data in any way. */ - memcpy(&resultpacket[IPV4_HDRLEN], - &ipv6packet[IPV6_HDRLEN], - ipv6len - IPV6_HDRLEN); - - udphdr = (struct udp_hdr *)&resultpacket[IPV4_HDRLEN]; - tcphdr = (struct tcp_hdr *)&resultpacket[IPV4_HDRLEN]; - icmpv4hdr = (struct icmpv4_hdr *)&resultpacket[IPV4_HDRLEN]; - icmpv6hdr = (struct icmpv6_hdr *)&ipv6packet[IPV6_HDRLEN]; - - /* Translate the IPv6 header into an IPv4 header. */ - - /* First the basics: the IPv4 version, header length, type of - service, and offset fields. Those are the same for all IPv4 - packets we send, regardless of the values found in the IPv6 - packet. */ - v4hdr->vhl = 0x45; - v4hdr->tos = 0; - v4hdr->ipoffset[0] = v4hdr->ipoffset[1] = 0; - - /* We assume that the IPv6 packet has a fixed size header with no - extension headers, and compute the length of the IPv4 packet and - place the resulting value in the IPv4 packet header. */ - ipv4len = ipv6len - IPV6_HDRLEN + IPV4_HDRLEN; - v4hdr->len[0] = ipv4len >> 8; - v4hdr->len[1] = ipv4len & 0xff; - - /* For simplicity, we set a unique IP id for each outgoing IPv4 - packet. */ - ipid++; - v4hdr->ipid[0] = ipid >> 8; - v4hdr->ipid[1] = ipid & 0xff; - - /* Set the IPv4 protocol. We only support TCP, UDP, and ICMP at this - point. While the IPv4 header protocol numbers are the same as the - IPv6 next header numbers, the ICMPv4 and ICMPv6 numbers are - different so we cannot simply copy the contents of the IPv6 next - header field. */ - switch(v6hdr->nxthdr) { - case IP_PROTO_TCP: - PRINTF("ip64_6to4: TCP header\n"); - v4hdr->proto = IP_PROTO_TCP; - - /* Compute and check the TCP checksum - since we're going to - recompute it ourselves, we must ensure that it was correct in - the first place. */ - if(ipv6_transport_checksum(ipv6packet, ipv6len, - IP_PROTO_TCP) != 0xffff) { - PRINTF("Bad TCP checksum, dropping packet\n"); - } - - break; - - case IP_PROTO_UDP: - PRINTF("ip64_6to4: UDP header\n"); - v4hdr->proto = IP_PROTO_UDP; - - /* Check if this is a DNS request. If so, we should rewrite it - with the DNS64 module. */ - if(udphdr->destport == UIP_HTONS(DNS_PORT)) { - ip64_dns64_6to4((uint8_t *)v6hdr + IPV6_HDRLEN + sizeof(struct udp_hdr), - ipv6len - IPV6_HDRLEN - sizeof(struct udp_hdr), - (uint8_t *)udphdr + sizeof(struct udp_hdr), - BUFSIZE - IPV4_HDRLEN - sizeof(struct udp_hdr)); - } - /* Compute and check the UDP checksum - since we're going to - recompute it ourselves, we must ensure that it was correct in - the first place. */ - if(ipv6_transport_checksum(ipv6packet, ipv6len, - IP_PROTO_UDP) != 0xffff) { - PRINTF("Bad UDP checksum, dropping packet\n"); - } - break; - - case IP_PROTO_ICMPV6: - PRINTF("ip64_6to4: ICMPv6 header\n"); - v4hdr->proto = IP_PROTO_ICMPV4; - /* Translate only ECHO_REPLY messages. */ - if(icmpv6hdr->type == ICMP6_ECHO_REPLY) { - icmpv4hdr->type = ICMP_ECHO_REPLY; - } else { - PRINTF("ip64_6to4: ICMPv6 mapping for type %d not implemented.\n", - icmpv6hdr->type); - return 0; - } - break; - - default: - /* We did not recognize the next header, and we do not attempt to - translate something we do not understand, so we return 0 to - indicate that no successful translation could be made. */ - PRINTF("ip64_6to4: Could not convert IPv6 next hop %d to an IPv4 protocol number.\n", - v6hdr->nxthdr); - return 0; - } - - /* We set the IPv4 ttl value to the hoplim number from the IPv6 - header. This means that information about the IPv6 topology is - transported into to the IPv4 network. */ - v4hdr->ttl = v6hdr->hoplim; - - /* We next convert the destination address. We make this conversion - with the ip64_addr_6to4() function. If the conversion - fails, ip64_addr_6to4() returns 0. If so, we also return 0 to - indicate failure. */ - if(ip64_addr_6to4(&v6hdr->destipaddr, - &v4hdr->destipaddr) == 0) { -#if DEBUG - PRINTF("ip64_6to4: Could not convert IPv6 destination address.\n"); - uip_debug_ipaddr_print(&v6hdr->destipaddr); - PRINTF("\n"); -#endif /* DEBUG */ - return 0; - } - - /* We set the source address in the IPv4 packet to be the IPv4 - address that we have been configured with through the - ip64_set_ipv4_address() function. Only let broadcasts through. */ - if(!ip64_hostaddr_configured && - !uip_ip4addr_cmp(&v4hdr->destipaddr, &ipv4_broadcast_addr)) { - PRINTF("ip64_6to4: no IPv4 address configured.\n"); - return 0; - } - ip64_addr_copy4(&v4hdr->srcipaddr, &ip64_hostaddr); - - - /* Next we update the transport layer header. This must be updated - in two ways: the source port number is changed and the transport - layer checksum must be recomputed. The reason why we change the - source port number is so that we can remember what IPv6 address - this packet came from, in case the packet will result in a reply - from the host on the IPv4 network. If a reply would be sent, it - would be sent to the port number that we chose, and we will be - able to map this back to the IPv6 address of the original sender - of the packet. - */ - - /* We check to see if we already have an existing IP address mapping - for this connection. If not, we create a new one. */ - if((v4hdr->proto == IP_PROTO_UDP || v4hdr->proto == IP_PROTO_TCP)) { - - if(ip64_special_ports_outgoing_is_special(uip_ntohs(udphdr->srcport))) { - uint16_t newport; - if(ip64_special_ports_translate_outgoing(uip_ntohs(udphdr->srcport), - &v6hdr->srcipaddr, - &newport)) { - udphdr->srcport = uip_htons(newport); - } - } else if(uip_ntohs(udphdr->srcport) >= EPHEMERAL_PORTRANGE) { - m = ip64_addrmap_lookup(&v6hdr->srcipaddr, - uip_ntohs(udphdr->srcport), - &v4hdr->destipaddr, - uip_ntohs(udphdr->destport), - v4hdr->proto); - if(m == NULL) { - PRINTF("Lookup failed\n"); - m = ip64_addrmap_create(&v6hdr->srcipaddr, - uip_ntohs(udphdr->srcport), - &v4hdr->destipaddr, - uip_ntohs(udphdr->destport), - v4hdr->proto); - if(m == NULL) { - PRINTF("Could not create new map\n"); - return 0; - } else { - PRINTF("Could create new local port %d\n", m->mapped_port); - } - } else { - PRINTF("Lookup: found local port %d (%d)\n", m->mapped_port, - uip_htons(m->mapped_port)); - } - - /* Update the lifetime of the address mapping. We need to be - frugal with address mapping table entries, so we assign - different lifetimes depending on the type of packet we see. - - For TCP connections, we don't want to have a lot of failed - connection attmpts lingering around, so we assign mappings - with TCP SYN segments a short lifetime. If we see a RST - segment, this indicates that the connection might be dead, - and we'll assign a shorter lifetime. - - For UDP packets and for non-SYN/non-RST segments, we assign - the default lifetime. */ - if(v4hdr->proto == IP_PROTO_TCP) { - if((tcphdr->flags & TCP_SYN)) { - ip64_addrmap_set_lifetime(m, SYN_LIFETIME); - } else if((tcphdr->flags & TCP_RST)) { - ip64_addrmap_set_lifetime(m, RST_LIFETIME); - } else { - ip64_addrmap_set_lifetime(m, DEFAULT_LIFETIME); - } - - /* Also check if we see a FIN segment. If so, we'll mark the - address mapping as being candidate for recycling. Same for - RST segments. */ - if((tcphdr->flags & TCP_FIN) || - (tcphdr->flags & TCP_RST)) { - ip64_addrmap_set_recycleble(m); - } - } else { - ip64_addrmap_set_lifetime(m, DEFAULT_LIFETIME); - - /* Treat UDP packets from the IPv6 network to a multicast - address on the IPv4 network differently: since there is - no way for packets from the IPv4 network to go back to - the IPv6 network on these mappings, we'll mark them as - recyclable. */ - if(v4hdr->destipaddr.u8[0] == 224) { - ip64_addrmap_set_recycleble(m); - } - - /* Treat DNS requests differently: since the are one-shot, we - mark them as recyclable. */ - if(udphdr->destport == UIP_HTONS(DNS_PORT)) { - ip64_addrmap_set_recycleble(m); - } - } - - /* Set the source port of the packet to be the mapped port - number. */ - udphdr->srcport = uip_htons(m->mapped_port); - } - } - - /* The IPv4 header is now complete, so we can compute the IPv4 - header checksum. */ - v4hdr->ipchksum = 0; - v4hdr->ipchksum = ~(ipv4_checksum(v4hdr)); - - - - /* The checksum is in different places in the different protocol - headers, so we need to be sure that we update the correct - field. */ - switch(v4hdr->proto) { - case IP_PROTO_TCP: - tcphdr->tcpchksum = 0; - tcphdr->tcpchksum = ~(ipv4_transport_checksum(resultpacket, ipv4len, - IP_PROTO_TCP)); - break; - case IP_PROTO_UDP: - udphdr->udpchksum = 0; - udphdr->udpchksum = ~(ipv4_transport_checksum(resultpacket, ipv4len, - IP_PROTO_UDP)); - if(udphdr->udpchksum == 0) { - udphdr->udpchksum = 0xffff; - } - break; - case IP_PROTO_ICMPV4: - icmpv4hdr->icmpchksum = 0; - icmpv4hdr->icmpchksum = ~(ipv4_transport_checksum(resultpacket, ipv4len, - IP_PROTO_ICMPV4)); - break; - - default: - PRINTF("ip64_6to4: transport protocol %d not implemented\n", v4hdr->proto); - return 0; - } - - /* Finally, we return the length of the resulting IPv4 packet. */ - PRINTF("ip64_6to4: ipv4len %d\n", ipv4len); - return ipv4len; -} -/*---------------------------------------------------------------------------*/ -int -ip64_4to6(const uint8_t *ipv4packet, const uint16_t ipv4packet_len, - uint8_t *resultpacket) -{ - struct ipv4_hdr *v4hdr; - struct ipv6_hdr *v6hdr; - struct udp_hdr *udphdr; - struct tcp_hdr *tcphdr; - struct icmpv4_hdr *icmpv4hdr; - struct icmpv6_hdr *icmpv6hdr; - uint16_t ipv4len, ipv6len, ipv6_packet_len; - struct ip64_addrmap_entry *m; - - v6hdr = (struct ipv6_hdr *)resultpacket; - v4hdr = (struct ipv4_hdr *)ipv4packet; - - if((v4hdr->len[0] << 8) + v4hdr->len[1] <= ipv4packet_len) { - ipv4len = (v4hdr->len[0] << 8) + v4hdr->len[1]; - } else { - PRINTF("ip64_4to6: packet smaller than reported in IPv4 header, dropping\n"); - return 0; - } - - if(ipv4len <= IPV4_HDRLEN) { - return 0; - } - - /* Make sure that the resulting packet fits in the ip64 packet - buffer. If not, we drop it. */ - if(ipv4len - IPV4_HDRLEN + IPV6_HDRLEN > BUFSIZE) { - PRINTF("ip64_4to6: packet too big to fit in buffer, dropping\n"); - return 0; - } - /* We copy the data from the IPv4 packet into the IPv6 packet. */ - memcpy(&resultpacket[IPV6_HDRLEN], - &ipv4packet[IPV4_HDRLEN], - ipv4len - IPV4_HDRLEN); - - udphdr = (struct udp_hdr *)&resultpacket[IPV6_HDRLEN]; - tcphdr = (struct tcp_hdr *)&resultpacket[IPV6_HDRLEN]; - icmpv4hdr = (struct icmpv4_hdr *)&ipv4packet[IPV4_HDRLEN]; - icmpv6hdr = (struct icmpv6_hdr *)&resultpacket[IPV6_HDRLEN]; - - ipv6len = ipv4len - IPV4_HDRLEN + IPV6_HDRLEN; - ipv6_packet_len = ipv6len - IPV6_HDRLEN; - - /* Translate the IPv4 header into an IPv6 header. */ - - /* We first fill in the simple fields: IP header version, traffic - class and flow label, and length fields. */ - v6hdr->vtc = 0x60; - v6hdr->tcflow = 0; - v6hdr->flow = 0; - v6hdr->len[0] = ipv6_packet_len >> 8; - v6hdr->len[1] = ipv6_packet_len & 0xff; - - /* We use the IPv4 TTL field as the IPv6 hop limit field. */ - v6hdr->hoplim = v4hdr->ttl; - - - /* We now translate the IPv4 source and destination addresses to - IPv6 source and destination addresses. We translate the IPv4 - source address into an IPv6-encoded IPv4 address. The IPv4 - destination address will be the address with which we have - previously been configured, through the ip64_set_ipv4_address() - function. We use the mapping table to look up the new IPv6 - destination address. As we assume that the IPv4 packet is a - response to a previously sent IPv6 packet, we should have a - mapping between the (protocol, destport, srcport, srcaddress) - tuple. If not, we'll return 0 to indicate that we failed to - translate the packet. */ - if(ip64_addr_4to6(&v4hdr->srcipaddr, &v6hdr->srcipaddr) == 0) { - PRINTF("ip64_packet_4to6: failed to convert source IP address\n"); - return 0; - } - - /* For the next header field, we simply use the IPv4 protocol - field. We only support UDP and TCP packets. */ - switch(v4hdr->proto) { - case IP_PROTO_UDP: - v6hdr->nxthdr = IP_PROTO_UDP; - /* Check if this is a DNS request. If so, we should rewrite it - with the DNS64 module. */ - if(udphdr->srcport == UIP_HTONS(DNS_PORT)) { - int len; - - len = ip64_dns64_4to6((uint8_t *)v4hdr + IPV4_HDRLEN + sizeof(struct udp_hdr), - ipv4len - IPV4_HDRLEN - sizeof(struct udp_hdr), - (uint8_t *)v6hdr + IPV6_HDRLEN + sizeof(struct udp_hdr), - ipv6_packet_len - sizeof(struct udp_hdr)); - ipv6_packet_len = len + sizeof(struct udp_hdr); - v6hdr->len[0] = ipv6_packet_len >> 8; - v6hdr->len[1] = ipv6_packet_len & 0xff; - ipv6len = ipv6_packet_len + IPV6_HDRLEN; - - } - break; - - case IP_PROTO_TCP: - v6hdr->nxthdr = IP_PROTO_TCP; - break; - - case IP_PROTO_ICMPV4: - /* Allow only ICMPv4 ECHO_REQUESTS (ping packets) through to the - local IPv6 host. */ - if(icmpv4hdr->type == ICMP_ECHO) { - PRINTF("ip64_4to6: translating ICMPv4 ECHO packet\n"); - v6hdr->nxthdr = IP_PROTO_ICMPV6; - icmpv6hdr->type = ICMP6_ECHO; - ip64_addr_copy6(&v6hdr->destipaddr, &ipv6_local_address); - } else { - PRINTF("ip64_packet_4to6: ICMPv4 packet type %d not supported\n", - icmpv4hdr->type); - return 0; - } - break; - - default: - /* For protocol types that we do not support, we return 0 to - indicate that we failed to translate the packet to an IPv6 - packet. */ - PRINTF("ip64_packet_4to6: protocol type %d not supported\n", - v4hdr->proto); - return 0; - } - - /* Translate IPv4 broadcasts to IPv6 all-nodes multicasts. */ - if(uip_ip4addr_cmp(&v4hdr->destipaddr, &ipv4_broadcast_addr) || - (uip_ipaddr_maskcmp(&v4hdr->destipaddr, &ip64_hostaddr, - &ip64_netmask) && - ((v4hdr->destipaddr.u16[0] & (~ip64_netmask.u16[0])) == - (ipv4_broadcast_addr.u16[0] & (~ip64_netmask.u16[0]))) && - ((v4hdr->destipaddr.u16[1] & (~ip64_netmask.u16[1])) == - (ipv4_broadcast_addr.u16[1] & (~ip64_netmask.u16[1]))))) { - uip_create_linklocal_allnodes_mcast(&v6hdr->destipaddr); - } else { - - if(!ip64_hostaddr_configured) { - PRINTF("ip64_packet_4to6: no local IPv4 address configured, dropping incoming packet.\n"); - return 0; - } - - if(!uip_ip4addr_cmp(&v4hdr->destipaddr, &ip64_hostaddr)) { - PRINTF("ip64_packet_4to6: the IPv4 destination address %d.%d.%d.%d did not match our IPv4 address %d.%d.%d.%d\n", - uip_ipaddr_to_quad(&v4hdr->destipaddr), - uip_ipaddr_to_quad(&ip64_hostaddr)); - return 0; - } - - - /* Now we translate the transport layer port numbers. We assume that - the IPv4 packet is a response to a packet that has previously - been translated from IPv6 to IPv4. If this is the case, the tuple - (protocol, destport, srcport, srcaddress) corresponds to an address/port - pair in our mapping table. If we do not find a mapping, we return - 0 to indicate that we could not translate the IPv4 packet to an - IPv6 packet. */ - - /* XXX treat a few ports differently: those ports should be let - through to the local host. For those ports, we set up an address - mapping that ensures that the local port number is retained. */ - - if((v4hdr->proto == IP_PROTO_TCP || v4hdr->proto == IP_PROTO_UDP)) { - if(uip_htons(tcphdr->destport) < EPHEMERAL_PORTRANGE) { - /* This packet should go to the local host. */ - PRINTF("Port is in the non-ephemeral port range %d (%d)\n", - tcphdr->destport, uip_htons(tcphdr->destport)); - ip64_addr_copy6(&v6hdr->destipaddr, &ipv6_local_address); - } else if(ip64_special_ports_incoming_is_special(uip_htons(tcphdr->destport))) { - uip_ip6addr_t newip6addr; - uint16_t newport; - PRINTF("ip64 port %d (%d) is special, treating it differently\n", - tcphdr->destport, uip_htons(tcphdr->destport)); - if(ip64_special_ports_translate_incoming(uip_htons(tcphdr->destport), - &newip6addr, &newport)) { - ip64_addr_copy6(&v6hdr->destipaddr, &newip6addr); - tcphdr->destport = uip_htons(newport); - PRINTF("New port %d (%d)\n", - tcphdr->destport, uip_htons(tcphdr->destport)); - } else { - ip64_addr_copy6(&v6hdr->destipaddr, &ipv6_local_address); - PRINTF("No new port\n"); - } - } else { - /* The TCP or UDP port numbers were not non-ephemeral and not - special, so we map the port number according to the address - mapping table. */ - - m = ip64_addrmap_lookup_port(uip_ntohs(udphdr->destport), - v4hdr->proto); - if(m == NULL) { - PRINTF("Inbound lookup failed\n"); - return 0; - } else { - PRINTF("Inbound lookup did not fail\n"); - } - ip64_addr_copy6(&v6hdr->destipaddr, &m->ip6addr); - udphdr->destport = uip_htons(m->ip6port); - } - } - } - - /* The checksum is in different places in the different protocol - headers, so we need to be sure that we update the correct - field. */ - switch(v6hdr->nxthdr) { - case IP_PROTO_TCP: - tcphdr->tcpchksum = 0; - tcphdr->tcpchksum = ~(ipv6_transport_checksum(resultpacket, - ipv6len, - IP_PROTO_TCP)); - break; - case IP_PROTO_UDP: - udphdr->udpchksum = 0; - /* As the udplen might have changed (DNS) we need to update it also */ - udphdr->udplen = uip_htons(ipv6_packet_len); - udphdr->udpchksum = ~(ipv6_transport_checksum(resultpacket, - ipv6len, - IP_PROTO_UDP)); - if(udphdr->udpchksum == 0) { - udphdr->udpchksum = 0xffff; - } - break; - - case IP_PROTO_ICMPV6: - icmpv6hdr->icmpchksum = 0; - icmpv6hdr->icmpchksum = ~(ipv6_transport_checksum(resultpacket, - ipv6len, - IP_PROTO_ICMPV6)); - break; - default: - PRINTF("ip64_4to6: transport protocol %d not implemented\n", v4hdr->proto); - return 0; - } - - /* Finally, we return the length of the resulting IPv6 packet. */ - PRINTF("ip64_4to6: ipv6len %d\n", ipv6len); - return ipv6len; -} -/*---------------------------------------------------------------------------*/ -int -ip64_hostaddr_is_configured(void) -{ - return ip64_hostaddr_configured; -} -/*---------------------------------------------------------------------------*/ -static void -interface_init(void) -{ - IP64_UIP_FALLBACK_INTERFACE.init(); -} -/*---------------------------------------------------------------------------*/ -static int -interface_output(void) -{ - PRINTF("ip64: interface_output len %d\n", uip_len); - IP64_UIP_FALLBACK_INTERFACE.output(); - - return 0; -} -/*---------------------------------------------------------------------------*/ -const struct uip_fallback_interface ip64_uip_fallback_interface = { - interface_init, interface_output -}; - diff --git a/os/services/ip64/ip64.h b/os/services/ip64/ip64.h deleted file mode 100644 index 3f6efe1a4..000000000 --- a/os/services/ip64/ip64.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, http://www.thingsquare.com/. - * 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 IP64_H -#define IP64_H - -#include "net/ipv6/uip.h" - -void ip64_init(void); -int ip64_6to4(const uint8_t *ipv6packet, const uint16_t ipv6len, - uint8_t *resultpacket); -int ip64_4to6(const uint8_t *ipv4packet, const uint16_t ipv4len, - uint8_t *resultpacket); - -void ip64_set_ipv4_address(const uip_ip4addr_t *ipv4addr, - const uip_ip4addr_t *netmask); -void ip64_set_ipv6_address(const uip_ip6addr_t *ipv6addr); - -const uip_ip4addr_t *ip64_get_hostaddr(void); -const uip_ip4addr_t *ip64_get_netmask(void); -const uip_ip4addr_t *ip64_get_draddr(void); - -void ip64_set_hostaddr(const uip_ip4addr_t *hostaddr); -void ip64_set_netmask(const uip_ip4addr_t *netmask); -void ip64_set_draddr(const uip_ip4addr_t *draddr); - -int ip64_hostaddr_is_configured(void); - -extern uint8_t *ip64_packet_buffer; -extern uint16_t ip64_packet_buffer_maxlen; - -#include "ip64-conf.h" - -#ifndef IP64_CONF_ETH_DRIVER -#error IP64_CONF_ETH_DRIVER must be #defined in ip64-conf.h -#else /* IP64_CONF_ETH_DRIVER */ -#define IP64_ETH_DRIVER IP64_CONF_ETH_DRIVER -#endif /* IP64_CONF_ETH_DRIVER */ - -#ifndef IP64_CONF_INPUT -#error IP64_CONF_INPUT must be #defined in ip64-conf.h -#else /* IP64_CONF_INPUT */ -#define IP64_INPUT IP64_CONF_INPUT -#endif /* IP64_CONF_INPUT */ - -#ifndef IP64_CONF_UIP_FALLBACK_INTERFACE -#error IP64_CONF_UIP_FALLBACK_INTERFACE must be #defined in ip64-conf.h -#else /* IP64_CONF_UIP_FALLBACK_INTERFACE */ -#define IP64_UIP_FALLBACK_INTERFACE IP64_CONF_UIP_FALLBACK_INTERFACE -#endif /* IP64_CONF_UIP_FALLBACK_INTERFACE */ - -#ifdef IP64_CONF_DHCP -#define IP64_DHCP IP64_CONF_DHCP -#else /* IP64_CONF_DHCP */ -/* Enable DHCP per default */ -#define IP64_DHCP 1 -#endif /* IP64_CONF_DHCP */ - -#endif /* IP64_H */ - diff --git a/os/services/ipso-objects/ipso-blockwise-test.c b/os/services/ipso-objects/ipso-blockwise-test.c deleted file mode 100644 index 3a557de2b..000000000 --- a/os/services/ipso-objects/ipso-blockwise-test.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2016, SICS Swedish ICT AB - * 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 HOLDER 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. - */ - -/** - * \addtogroup ipso-objects - * @{ - * - * Code to test blockwise transfer together with the LWM2M-engine. - * This object tests get with BLOCK2 and put with BLOCK1. - * - */ - -#include "lwm2m-engine.h" -#include "coap.h" -#include - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -static lwm2m_object_instance_t reg_object; -static char junk[64]; - -static const lwm2m_resource_id_t resources[] = - { - RO(10000), - RO(11000), - RW(11001) - }; - -#define LEN 900 - -static lwm2m_status_t -opaque_callback(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx, int num_to_write) -{ - int i; - PRINTF("opaque-stream callback num_to_write: %d off: %d outlen: %d\n", - num_to_write, ctx->offset, ctx->outbuf->len); - for(i = 0; i < num_to_write; i++) { - ctx->outbuf->buffer[i + ctx->outbuf->len] = '0' + (i & 31); - if(i + ctx->offset == LEN) break; - } - ctx->outbuf->len += i; - if(ctx->offset + i < LEN) { - ctx->writer_flags |= WRITER_HAS_MORE; - } - return LWM2M_STATUS_OK; -} - -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -lwm2m_callback(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx) -{ - uint32_t num; - uint8_t more; - uint16_t size; - uint32_t offset; - - char *str = "just a string"; - - PRINTF("Got request at: %d/%d/%d lv:%d\n", ctx->object_id, ctx->object_instance_id, ctx->resource_id, ctx->level); - - if(ctx->level == 1) { - /* Should not happen */ - return LWM2M_STATUS_ERROR; - } - if(ctx->level == 2) { - /* This is a get whole object - or write whole object */ - return LWM2M_STATUS_ERROR; - } - - if(ctx->operation == LWM2M_OP_READ) { -#if DEBUG - if(coap_get_header_block2(ctx->request, &num, &more, &size, &offset)) { - PRINTF("CoAP BLOCK2: %d/%d/%d offset:%d\n", num, more, size, offset); - } -#endif - - switch(ctx->resource_id) { - case 10000: - lwm2m_object_write_string(ctx, str, strlen(str)); - break; - case 11000: - case 11001: - PRINTF("Preparing object write\n"); - lwm2m_object_write_opaque_stream(ctx, LEN, opaque_callback); - break; - default: - return LWM2M_STATUS_NOT_FOUND; - } - } else if(ctx->operation == LWM2M_OP_WRITE) { - if(coap_get_header_block1(ctx->request, &num, &more, &size, &offset)) { - PRINTF("CoAP BLOCK1: %d/%d/%d offset:%d\n", num, more, size, offset); - coap_set_header_block1(ctx->response, num, 0, size); - } - } - return LWM2M_STATUS_OK; -} - -void -ipso_blockwise_test_init(void) -{ - int i; - PRINTF("Starting blockwise\n"); - reg_object.object_id = 4711; - reg_object.instance_id = 0; - reg_object.resource_ids = resources; - reg_object.resource_count = - sizeof(resources) / sizeof(lwm2m_resource_id_t); - reg_object.callback = lwm2m_callback; - - for(i = 0; i < sizeof(junk); i++) { - junk[i] = '0' + i; - } - junk[i - 1] = 0; - - lwm2m_engine_add_object(®_object); -} -/** @} */ diff --git a/os/services/ipso-objects/ipso-button.c b/os/services/ipso-objects/ipso-button.c deleted file mode 100644 index 7993cbbb3..000000000 --- a/os/services/ipso-objects/ipso-button.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup ipso-objects - * @{ - */ - -/** - * \file - * Implementation of OMA LWM2M / IPSO button as a digital input - * NOTE: only works with a Contiki Button Sensor (not for Standalone) - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include "contiki.h" -#include "lwm2m-object.h" -#include "lwm2m-engine.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define IPSO_INPUT_STATE 5500 -#define IPSO_INPUT_COUNTER 5501 -#define IPSO_INPUT_DEBOUNCE 5503 -#define IPSO_INPUT_EDGE_SEL 5504 -#define IPSO_INPUT_CTR_RESET 5505 -#define IPSO_INPUT_SENSOR_TYPE 5751 - -#if PLATFORM_HAS_BUTTON -#if PLATFORM_SUPPORTS_BUTTON_HAL -#include "dev/button-hal.h" -#else -#include "dev/button-sensor.h" -#define IPSO_BUTTON_SENSOR button_sensor -static struct etimer timer; -#endif - -PROCESS(ipso_button_process, "ipso-button"); -#endif /* PLATFORM_HAS_BUTTON */ - - -static lwm2m_status_t lwm2m_callback(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx); - -static int input_state = 0; -static int32_t counter = 0; -static int32_t edge_selection = 3; /* both */ -static int32_t debounce_time = 10; - -static const lwm2m_resource_id_t resources[] = { - RO(IPSO_INPUT_STATE), RO(IPSO_INPUT_COUNTER), - RW(IPSO_INPUT_DEBOUNCE), RW(IPSO_INPUT_EDGE_SEL), EX(IPSO_INPUT_CTR_RESET), - RO(IPSO_INPUT_SENSOR_TYPE) -}; - -/* Only support for one button for now */ -static lwm2m_object_instance_t reg_object = { - .object_id = 3200, - .instance_id = 0, - .resource_ids = resources, - .resource_count = sizeof(resources) / sizeof(lwm2m_resource_id_t), - .callback = lwm2m_callback, -}; - -/*---------------------------------------------------------------------------*/ -static int -read_state(void) -{ - PRINTF("Read button state: %d\n", input_state); - return input_state; -} -/*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -lwm2m_callback(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx) -{ - if(ctx->operation == LWM2M_OP_READ) { - switch(ctx->resource_id) { - case IPSO_INPUT_STATE: - lwm2m_object_write_int(ctx, read_state()); - break; - case IPSO_INPUT_COUNTER: - lwm2m_object_write_int(ctx, counter); - break; - case IPSO_INPUT_DEBOUNCE: - lwm2m_object_write_int(ctx, debounce_time); - break; - case IPSO_INPUT_EDGE_SEL: - lwm2m_object_write_int(ctx, edge_selection); - break; - case IPSO_INPUT_SENSOR_TYPE: - lwm2m_object_write_string(ctx, "button", strlen("button")); - break; - default: - return LWM2M_STATUS_ERROR; - } - } else if(ctx->operation == LWM2M_OP_EXECUTE) { - if(ctx->resource_id == IPSO_INPUT_CTR_RESET) { - counter = 0; - } else { - return LWM2M_STATUS_ERROR; - } - } - return LWM2M_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -void -ipso_button_init(void) -{ - /* register this device and its handlers - the handlers automatically - sends in the object to handle */ - lwm2m_engine_add_object(®_object); - -#if PLATFORM_HAS_BUTTON - process_start(&ipso_button_process, NULL); -#endif /* PLATFORM_HAS_BUTTON */ -} -/*---------------------------------------------------------------------------*/ -#if PLATFORM_HAS_BUTTON -PROCESS_THREAD(ipso_button_process, ev, data) -{ - PROCESS_BEGIN(); - -#if !PLATFORM_SUPPORTS_BUTTON_HAL - SENSORS_ACTIVATE(IPSO_BUTTON_SENSOR); -#endif - - while(1) { - PROCESS_WAIT_EVENT(); - -#if PLATFORM_SUPPORTS_BUTTON_HAL - if(ev == button_hal_press_event) { - input_state = 1; - counter++; - if((edge_selection & 2) != 0) { - lwm2m_notify_object_observers(®_object, IPSO_INPUT_STATE); - } - lwm2m_notify_object_observers(®_object, IPSO_INPUT_COUNTER); - } else if(ev == button_hal_release_event) { - input_state = 0; - if((edge_selection & 1) != 0) { - lwm2m_notify_object_observers(®_object, IPSO_INPUT_STATE); - } - } -#else /* PLATFORM_SUPPORTS_BUTTON_HAL */ - if(ev == sensors_event && data == &IPSO_BUTTON_SENSOR) { - if(!input_state) { - int32_t time; - input_state = 1; - counter++; - if((edge_selection & 2) != 0) { - lwm2m_notify_object_observers(®_object, IPSO_INPUT_STATE); - } - lwm2m_notify_object_observers(®_object, IPSO_INPUT_COUNTER); - - time = (debounce_time * CLOCK_SECOND / 1000); - if(time < 1) { - time = 1; - } - etimer_set(&timer, (clock_time_t)time); - } - } else if(ev == PROCESS_EVENT_TIMER && data == &timer) { - if(!input_state) { - /* Button is not in pressed state */ - } else if(IPSO_BUTTON_SENSOR.value(0) != 0) { - /* Button is still pressed */ - etimer_reset(&timer); - } else { - input_state = 0; - if((edge_selection & 1) != 0) { - lwm2m_notify_object_observers(®_object, IPSO_INPUT_STATE); - } - } - } -#endif /* PLATFORM_SUPPORTS_BUTTON_HAL */ - } - - PROCESS_END(); -} -#endif /* PLATFORM_HAS_BUTTON */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/ipso-objects/ipso-control-template.c b/os/services/ipso-objects/ipso-control-template.c deleted file mode 100644 index 23b53ef06..000000000 --- a/os/services/ipso-objects/ipso-control-template.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2016, SICS Swedish ICT AB - * 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 HOLDER 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. - */ - -/** - * \addtogroup ipso-objects - * @{ - * - */ - -/** - * \file - * Implementation of OMA LWM2M / IPSO control template. - * Useful for implementing controllable objects - * \author - * Joakim Eriksson - * Niclas Finne - */ -#include "ipso-control-template.h" -#include "lwm2m-engine.h" -#include "coap-timer.h" -#include -#include - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define IPSO_ONOFF 5850 -#define IPSO_DIMMER 5851 -#define IPSO_ON_TIME 5852 - -static const lwm2m_resource_id_t resources[] = - { - RW(IPSO_ONOFF), - RW(IPSO_DIMMER), - RW(IPSO_ON_TIME) - }; -/*---------------------------------------------------------------------------*/ -lwm2m_status_t -ipso_control_set_on(ipso_control_t *control, uint8_t onoroff) -{ - uint8_t v; - - if(onoroff) { - v = control->value & 0x7f; - if(v == 0) { - v = 100; - } - } else { - v = 0; - } - - return ipso_control_set_value(control, v); -} -/*---------------------------------------------------------------------------*/ -lwm2m_status_t -ipso_control_set_value(ipso_control_t *control, uint8_t value) -{ - lwm2m_status_t status = LWM2M_STATUS_OK; - int was_on; - - was_on = ipso_control_is_on(control); - - if(value == 0) { - if(was_on) { - /* Turn off */ - status = control->set_value(control, 0); - if(status == LWM2M_STATUS_OK) { - control->value &= 0x7f; - control->on_time += - (coap_timer_uptime() - control->last_on_time) / 1000; - } - } - } else { - /* Restrict value between 0 - 100 */ - if(value > 100) { - value = 100; - } - value |= 0x80; - - if(value != control->value) { - status = control->set_value(control, value & 0x7f); - if(status == LWM2M_STATUS_OK) { - control->value = value; - if(! was_on) { - control->last_on_time = coap_timer_uptime(); - } - } - } - } - return status; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -lwm2m_callback(lwm2m_object_instance_t *object, lwm2m_context_t *ctx) -{ - ipso_control_t *control; - int32_t v; - - /* Here we cast to our sensor-template struct */ - control = (ipso_control_t *)object; - - if(ctx->operation == LWM2M_OP_READ) { - switch(ctx->resource_id) { - case IPSO_ONOFF: - v = ipso_control_is_on(control) ? 1 : 0; - break; - case IPSO_DIMMER: - v = ipso_control_get_value(control); - break; - case IPSO_ON_TIME: - v = control->on_time; - if(ipso_control_is_on(control)) { - v += (coap_timer_uptime() - control->last_on_time) / 1000; - } - PRINTF("ON-TIME: %"PRId32" (last on: %"PRIu32"\n", v, control->on_time); - break; - default: - return LWM2M_STATUS_ERROR; - } - lwm2m_object_write_int(ctx, v); - return LWM2M_STATUS_OK; - - } else if(ctx->operation == LWM2M_OP_WRITE) { - switch(ctx->resource_id) { - case IPSO_ONOFF: - if(lwm2m_object_read_int(ctx, ctx->inbuf->buffer, ctx->inbuf->size, &v) == 0) { - return LWM2M_STATUS_ERROR; - } - return ipso_control_set_on(control, v > 0); - case IPSO_DIMMER: - if(lwm2m_object_read_int(ctx, ctx->inbuf->buffer, ctx->inbuf->size, &v) == 0) { - return LWM2M_STATUS_ERROR; - } - if(v < 0) { - v = 0; - } else if(v > 100) { - v = 100; - } - return ipso_control_set_value(control, v & 0xff); - case IPSO_ON_TIME: - if(lwm2m_object_read_int(ctx, ctx->inbuf->buffer, ctx->inbuf->size, &v) == 0) { - return LWM2M_STATUS_ERROR; - } - - if(v == 0) { - control->on_time = 0; - control->last_on_time = coap_timer_uptime(); - return LWM2M_STATUS_OK; - } else { - /* Only allowed to write 0 to reset ontime */ - return LWM2M_STATUS_FORBIDDEN; - } - break; - default: - return LWM2M_STATUS_ERROR; - } - } else { - return LWM2M_STATUS_OPERATION_NOT_ALLOWED; - } -} -/*---------------------------------------------------------------------------*/ -int -ipso_control_add(ipso_control_t *control) -{ - control->reg_object.resource_ids = resources; - control->reg_object.resource_count = - sizeof(resources) / sizeof(lwm2m_resource_id_t); - - control->reg_object.callback = lwm2m_callback; - return lwm2m_engine_add_object(&control->reg_object); -} -/*---------------------------------------------------------------------------*/ -int -ipso_control_remove(ipso_control_t *control) -{ - lwm2m_engine_remove_object(&control->reg_object); - return 1; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/ipso-objects/ipso-control-template.h b/os/services/ipso-objects/ipso-control-template.h deleted file mode 100644 index dfbd7076b..000000000 --- a/os/services/ipso-objects/ipso-control-template.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2016, SICS Swedish ICT AB - * 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 HOLDER 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. - */ - -/** - * \addtogroup ipso-objects - * @{ - * - */ - -/** - * \file - * Implementation of OMA LWM2M / IPSO sensor template. - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef IPSO_CONTROL_TEMPLATE_H_ -#define IPSO_CONTROL_TEMPLATE_H_ - -#include "lwm2m-engine.h" - -typedef struct ipso_control ipso_control_t; - -#define IPSO_CONTROL_USE_DIMMER 0x01 - -typedef lwm2m_status_t (*ipso_control_set_value_t)(ipso_control_t *control, - uint8_t v); - -/* Values of the IPSO control object */ -struct ipso_control { - lwm2m_object_instance_t reg_object; - uint8_t flags; - uint8_t value; /* used to emulate on/off and dim-value */ - uint32_t on_time; /* on-time in seconds */ - uint64_t last_on_time; - ipso_control_set_value_t set_value; -}; - -#define IPSO_CONTROL(name, oid, iid, setv) \ - static ipso_control_t name = { \ - .reg_object.object_id = oid, \ - .reg_object.instance_id = iid, \ - .set_value = setv \ - } - -int ipso_control_add(ipso_control_t *control); -int ipso_control_remove(ipso_control_t *control); - -static inline uint16_t -ipso_control_get_object_id(const ipso_control_t *control) -{ - return control->reg_object.object_id; -} - -static inline uint16_t -ipso_control_get_instance_id(const ipso_control_t *control) -{ - return control->reg_object.instance_id; -} - -static inline uint8_t -ipso_control_is_on(const ipso_control_t *control) -{ - return (control->value & 0x80) != 0; -} - -static inline uint8_t -ipso_control_get_value(const ipso_control_t *control) -{ - return (control->value & 0x80) != 0 ? (control->value & 0x7f) : 0; -} - -lwm2m_status_t ipso_control_set_on(ipso_control_t *control, uint8_t onoroff); - -lwm2m_status_t ipso_control_set_value(ipso_control_t *control, uint8_t dimm_value); - -#endif /* IPSO_CONTROL_TEMPLATE_H_ */ -/** @} */ diff --git a/os/services/ipso-objects/ipso-leds-control.c b/os/services/ipso-objects/ipso-leds-control.c deleted file mode 100644 index 2c64da328..000000000 --- a/os/services/ipso-objects/ipso-leds-control.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup ipso-objects - * @{ - * - */ - -/** - * \file - * Implementation of OMA LWM2M / IPSO Light Control for LEDs - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include "lwm2m-object.h" -#include "lwm2m-engine.h" -#include "ipso-control-template.h" -#include "dev/leds.h" -#include - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#if LEDS_LEGACY_API -#if LEDS_ALL & LEDS_BLUE || LEDS_ALL & LEDS_RED || LEDS_ALL & LEDS_BLUE -#define LEDS_CONTROL_NUMBER (((LEDS_ALL & LEDS_BLUE) ? 1 : 0) + ((LEDS_ALL & LEDS_RED) ? 1 : 0) + ((LEDS_ALL & LEDS_GREEN) ? 1 : 0)) -#else -#define LEDS_CONTROL_NUMBER 1 -#endif -#else /* LEDS_LEGACY_API */ -#define LEDS_CONTROL_NUMBER LEDS_COUNT -#endif /* LEDS_LEGACY_API */ - -typedef struct led_state { - ipso_control_t control; - uint8_t led_value; -} led_state_t; - -static led_state_t leds_controls[LEDS_CONTROL_NUMBER]; -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -set_value(ipso_control_t *control, uint8_t value) -{ -#if PLATFORM_HAS_LEDS || LEDS_COUNT - led_state_t *state; - - state = (led_state_t *)control; - - if(value) { - leds_on(state->led_value); - } else { - leds_off(state->led_value); - } -#endif /* PLATFORM_HAS_LEDS */ - - return LWM2M_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -static int -bit_no(int bit) -{ - int i; - for(i = 0; i < 8; i++) { - if(LEDS_ALL & (1 << i)) { - if(bit == 0) { - /* matching bit */ - return 1 << i; - } else { - /* matching but used */ - bit--; - } - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -ipso_leds_control_init(void) -{ - ipso_control_t *c; - int i; - - /* Initialize the instances */ - for(i = 0; i < LEDS_CONTROL_NUMBER; i++) { - c = &leds_controls[i].control; - c->reg_object.object_id = 3311; - c->reg_object.instance_id = i; - c->set_value = set_value; - leds_controls[i].led_value = bit_no(i); - ipso_control_add(c); - } - - PRINTF("IPSO leds control initialized with %u instances\n", - LEDS_CONTROL_NUMBER); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/ipso-objects/ipso-light-control.c b/os/services/ipso-objects/ipso-light-control.c deleted file mode 100644 index 97733b629..000000000 --- a/os/services/ipso-objects/ipso-light-control.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup ipso-objects - * @{ - * - */ - -/** - * \file - * Implementation of OMA LWM2M / IPSO Light Control - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include "ipso-objects.h" -#include "lwm2m-object.h" -#include "lwm2m-engine.h" -#include "ipso-control-template.h" - -#ifdef IPSO_LIGHT_CONTROL -extern const struct ipso_objects_actuator IPSO_LIGHT_CONTROL; -#endif /* IPSO_LIGHT_CONTROL */ - -static lwm2m_status_t set_value(ipso_control_t *control, uint8_t value); - -IPSO_CONTROL(light_control, 3311, 0, set_value); -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -set_value(ipso_control_t *control, uint8_t value) -{ -#ifdef IPSO_LIGHT_CONTROL - if(IPSO_LIGHT_CONTROL.set_dim_level) { - IPSO_LIGHT_CONTROL.set_dim_level(value); - } else if(IPSO_LIGHT_CONTROL.set_on) { - IPSO_LIGHT_CONTROL.set_on(value); - } -#endif /* IPSO_LIGHT_CONTROL */ - return LWM2M_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -void -ipso_light_control_init(void) -{ -#ifdef IPSO_LIGHT_CONTROL - if(IPSO_LIGHT_CONTROL.init) { - IPSO_LIGHT_CONTROL.init(); - } - if(IPSO_LIGHT_CONTROL.get_dim_level) { - ipso_control_set_value(&light_control, - IPSO_LIGHT_CONTROL.get_dim_level()); - } else if(IPSO_LIGHT_CONTROL.is_on) { - ipso_control_set_on(&light_control, IPSO_LIGHT_CONTROL.is_on()); - } -#endif /* IPSO_LIGHT_CONTROL */ - - ipso_control_add(&light_control); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/ipso-objects/ipso-objects.c b/os/services/ipso-objects/ipso-objects.c deleted file mode 100644 index f8538ee43..000000000 --- a/os/services/ipso-objects/ipso-objects.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup ipso-objects - * @{ - */ - -/** - * \file - * Implementation of the IPSO Objects - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include "contiki.h" -#include "dev/leds.h" -#include "ipso-objects.h" -/*---------------------------------------------------------------------------*/ -void -ipso_objects_init(void) -{ - /* initialize any relevant object for the IPSO Objects */ -#ifdef IPSO_TEMPERATURE - ipso_temperature_init(); -#endif - -#if PLATFORM_HAS_BUTTON - ipso_button_init(); -#endif - -#ifdef IPSO_LIGHT_CONTROL - ipso_light_control_init(); -#elif PLATFORM_HAS_LEDS || LEDS_COUNT - ipso_leds_control_init(); -#endif -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/ipso-objects/ipso-objects.h b/os/services/ipso-objects/ipso-objects.h deleted file mode 100644 index 92bdfd8de..000000000 --- a/os/services/ipso-objects/ipso-objects.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup apps - * @{ - */ - -/** - * \defgroup ipso-objects An implementation of IPSO Objects - * @{ - * - * This is an implementation of IPSO Objects for OMA LWM2M. - */ - -/** - * \file - * Header file for the Contiki IPSO Objects for OMA LWM2M - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef IPSO_OBJECTS_H_ -#define IPSO_OBJECTS_H_ - -#include "contiki.h" - -void ipso_temperature_init(void); -void ipso_button_init(void); -void ipso_light_control_init(void); -void ipso_leds_control_init(void); - -/* the init function to register the IPSO objects */ -void ipso_objects_init(void); - -struct ipso_objects_actuator { - /** - * \brief Initialize the driver. - */ - void (* init)(void); - - /** - * \brief Check if the actuator is on or off. - * - * \return Zero if the actuator is off and non-zero otherwise. - */ - int (* is_on)(void); - - /** - * \brief Set the actuator to on or off. - * - * \param onoroff Zero to set the actuator to off and non-zero otherwise. - * \return Zero if ok and a non-zero error code otherwise. - */ - int (* set_on)(int onoroff); - - /** - * \brief Set the actuator to on or off. - * - * \param onoroff Zero to set the actuator to off and non-zero otherwise. - * \return Zero if ok and a non-zero error code otherwise. - */ - int (* get_dim_level)(void); - - /** - * \brief Set the dim level of the actuator. - * - * \param level The dim level between 0% and 100%. - * \return Zero if ok and a non-zero error code otherwise. - */ - int (* set_dim_level)(int level); -}; - -struct ipso_objects_sensor { - /** - * \brief Initialize the driver. - */ - void (* init)(void); - - /** - * \brief Read the sensor value in 1/1000 units. - * - * \param value A pointer to the variable to hold the sensor value. - * \return Zero if ok and a non-zero error code otherwise. - */ - int (* read_value)(int32_t *value); -}; - -#endif /* IPSO_OBJECTS_H_ */ -/** - * @} - * @} - */ diff --git a/os/services/ipso-objects/ipso-sensor-template.c b/os/services/ipso-objects/ipso-sensor-template.c deleted file mode 100644 index bf46ed5ae..000000000 --- a/os/services/ipso-objects/ipso-sensor-template.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (c) 2016, SICS Swedish ICT AB - * 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 HOLDER 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. - */ - -/** - * \addtogroup ipso-objects - * @{ - * - */ - -/** - * \file - * Implementation of OMA LWM2M / IPSO sensor template. - * \author - * Joakim Eriksson - * Niclas Finne - */ -#include "ipso-sensor-template.h" -#include "lwm2m-engine.h" -#include -#include - -#define IPSO_SENSOR_VALUE 5700 -#define IPSO_SENSOR_UNIT 5701 -#define IPSO_SENSOR_MIN_VALUE 5601 -#define IPSO_SENSOR_MAX_VALUE 5602 -#define IPSO_SENSOR_MIN_RANGE 5603 -#define IPSO_SENSOR_MAX_RANGE 5604 - -#define IPSO_SENSOR_RESET_MINMAX 5605 - -static const lwm2m_resource_id_t resources[] = - { - RO(IPSO_SENSOR_VALUE), RO(IPSO_SENSOR_UNIT), - RO(IPSO_SENSOR_MIN_VALUE), RO(IPSO_SENSOR_MAX_VALUE), - RO(IPSO_SENSOR_MIN_RANGE), RO(IPSO_SENSOR_MAX_RANGE), - EX(IPSO_SENSOR_RESET_MINMAX) - }; - -/*---------------------------------------------------------------------------*/ -static void update_last_value(ipso_sensor_value_t *sval, int32_t value, - uint8_t notify); -/*---------------------------------------------------------------------------*/ -static int init = 0; -static coap_timer_t nt; - -/* Currently support max 4 periodic sensors */ -#define MAX_PERIODIC 4 -struct periodic_sensor { - ipso_sensor_value_t *value; - uint16_t ticks_left; -} periodics[MAX_PERIODIC]; - -static void -timer_callback(coap_timer_t *timer) -{ - int i; - coap_timer_reset(timer, 1000); - - for(i = 0; i < MAX_PERIODIC; i++) { - if(periodics[i].value != NULL) { - if(periodics[i].ticks_left > 0) { - periodics[i].ticks_left--; - } else { - int32_t value; - periodics[i].ticks_left = periodics[i].value->sensor->update_interval; - if(periodics[i].value->sensor->get_value_in_millis(periodics[i].value->sensor, &value) == LWM2M_STATUS_OK) { - update_last_value(periodics[i].value, value, 1); - } - } - } - } -} - -static void -add_periodic(const ipso_sensor_t *sensor) -{ - int i; - for(i = 0; i < MAX_PERIODIC; i++) { - if(periodics[i].value == NULL) { - periodics[i].value = sensor->sensor_value; - periodics[i].ticks_left = sensor->update_interval; - return; - } - } -} -/*---------------------------------------------------------------------------*/ -static void -update_last_value(ipso_sensor_value_t *sval, int32_t value, uint8_t notify) -{ - /* No notification if this a regular read that cause the update */ - if(sval->last_value != value && notify) { - lwm2m_notify_object_observers(&sval->reg_object, IPSO_SENSOR_VALUE); - } - sval->last_value = value; - if(sval->min_value > value) { - sval->min_value = value; - lwm2m_notify_object_observers(&sval->reg_object, IPSO_SENSOR_MIN_VALUE); - } - if(sval->max_value < value) { - sval->max_value = value; - lwm2m_notify_object_observers(&sval->reg_object, IPSO_SENSOR_MAX_VALUE); - } -} -/*---------------------------------------------------------------------------*/ -static inline size_t -write_float32fix(lwm2m_context_t *ctx, int32_t value) -{ - int64_t tmp = value; - tmp = (tmp * 1024) / 1000; - return lwm2m_object_write_float32fix(ctx, (int32_t)tmp, 10); -} -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -lwm2m_callback(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx) -{ - /* Here we cast to our sensor-template struct */ - const ipso_sensor_t *sensor; - ipso_sensor_value_t *value; - value = (ipso_sensor_value_t *) object; - sensor = value->sensor; - - /* Do the stuff */ - if(ctx->level == 1) { - /* Should not happen 3303 */ - return LWM2M_STATUS_ERROR; - } - if(ctx->level == 2) { - /* This is a get whole object - or write whole object 3303/0 */ - return LWM2M_STATUS_ERROR; - } - if(ctx->level == 3) { - /* This is a get request on 3303/0/3700 */ - /* NOW we assume a get.... which might be wrong... */ - if(ctx->operation == LWM2M_OP_READ) { - switch(ctx->resource_id) { - case IPSO_SENSOR_UNIT: - if(sensor->unit != NULL) { - lwm2m_object_write_string(ctx, sensor->unit, strlen(sensor->unit)); - } - break; - case IPSO_SENSOR_MAX_RANGE: - write_float32fix(ctx, sensor->max_range); - break; - case IPSO_SENSOR_MIN_RANGE: - write_float32fix(ctx, sensor->min_range); - break; - case IPSO_SENSOR_MAX_VALUE: - write_float32fix(ctx, value->max_value); - break; - case IPSO_SENSOR_MIN_VALUE: - write_float32fix(ctx, value->min_value); - break; - case IPSO_SENSOR_VALUE: - if(sensor->get_value_in_millis != NULL) { - int32_t v; - if(sensor->get_value_in_millis(sensor, &v) == LWM2M_STATUS_OK) { - update_last_value(value, v, 0); - write_float32fix(ctx, value->last_value); - } - } - break; - default: - return LWM2M_STATUS_ERROR; - } - } else if(ctx->operation == LWM2M_OP_EXECUTE) { - if(ctx->resource_id == IPSO_SENSOR_RESET_MINMAX) { - value->min_value = value->last_value; - value->max_value = value->last_value; - } - } - } - return LWM2M_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -int -ipso_sensor_add(const ipso_sensor_t *sensor) -{ - if(sensor->update_interval > 0) { - if(init == 0) { - coap_timer_set_callback(&nt, timer_callback); - coap_timer_set(&nt, 1000); - init = 1; - } - add_periodic(sensor); - } - - if(sensor->sensor_value == NULL) { - return 0; - } - sensor->sensor_value->reg_object.object_id = sensor->object_id; - sensor->sensor_value->sensor = sensor; - if(sensor->instance_id == 0) { - sensor->sensor_value->reg_object.instance_id = LWM2M_OBJECT_INSTANCE_NONE; - } else { - sensor->sensor_value->reg_object.instance_id = sensor->instance_id; - } - sensor->sensor_value->reg_object.callback = lwm2m_callback; - sensor->sensor_value->reg_object.resource_ids = resources; - sensor->sensor_value->reg_object.resource_count = - sizeof(resources) / sizeof(lwm2m_resource_id_t); - return lwm2m_engine_add_object(&sensor->sensor_value->reg_object); -} -/*---------------------------------------------------------------------------*/ -int -ipso_sensor_remove(const ipso_sensor_t *sensor) -{ - lwm2m_engine_remove_object(&sensor->sensor_value->reg_object); - return 1; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/ipso-objects/ipso-sensor-template.h b/os/services/ipso-objects/ipso-sensor-template.h deleted file mode 100644 index 375dbad7c..000000000 --- a/os/services/ipso-objects/ipso-sensor-template.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2016, SICS Swedish ICT AB - * 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 HOLDER 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. - */ - -/** - * \addtogroup ipso-objects - * @{ - * - */ - -/** - * \file - * Implementation of OMA LWM2M / IPSO sensor template. - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef IPSO_SENSOR_TEMPLATE_H_ -#define IPSO_SENSOR_TEMPLATE_H_ - -#include "lwm2m-engine.h" - -typedef struct ipso_sensor ipso_sensor_t; - -typedef lwm2m_status_t (*ipso_sensor_get_value_millis_t)(const ipso_sensor_t *sensor, int32_t *v); - -/* Values of the IPSO object */ -typedef struct ipso_sensor_value { - lwm2m_object_instance_t reg_object; - const ipso_sensor_t *sensor; - uint8_t flags; - int32_t last_value; - int32_t min_value; - int32_t max_value; -} ipso_sensor_value_t; - -/* Meta data about an IPSO sensor object */ -struct ipso_sensor { - /* LWM2M object type */ - uint16_t object_id; - uint16_t instance_id; - /* When we read out the value we send in a context to write to */ - ipso_sensor_get_value_millis_t get_value_in_millis; - int32_t min_range; - int32_t max_range; - char *unit; - /* update interval in seconds */ - uint16_t update_interval; - ipso_sensor_value_t *sensor_value; -}; - -#define IPSO_SENSOR(name, oid, get_value, ...) \ - static ipso_sensor_value_t name##_value; \ - static const ipso_sensor_t name = { \ - .object_id = oid, \ - .sensor_value = &name##_value, \ - .get_value_in_millis = get_value, \ - __VA_ARGS__ \ - } - -int ipso_sensor_add(const ipso_sensor_t *sensor); -int ipso_sensor_remove(const ipso_sensor_t *sensor); - -#endif /* IPSO_SENSOR_TEMPLATE_H_ */ -/** @} */ diff --git a/os/services/ipso-objects/ipso-temperature.c b/os/services/ipso-objects/ipso-temperature.c deleted file mode 100644 index db550a5c5..000000000 --- a/os/services/ipso-objects/ipso-temperature.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup ipso-objects - * @{ - */ - -/** - * \file - * Implementation of OMA LWM2M / IPSO Temperature - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include -#include "ipso-sensor-template.h" -#include "ipso-objects.h" -#include "lwm2m-object.h" -#include "lwm2m-engine.h" - -#ifdef IPSO_TEMPERATURE -extern const struct ipso_objects_sensor IPSO_TEMPERATURE; -#endif /* IPSO_TEMPERATURE */ - -#ifndef IPSO_TEMPERATURE_MIN -#define IPSO_TEMPERATURE_MIN -50000 -#endif - -#ifndef IPSO_TEMPERATURE_MAX -#define IPSO_TEMPERATURE_MAX 80000 -#endif - -static lwm2m_status_t get_temp_value(const ipso_sensor_t *sensor, - int32_t *value); - -IPSO_SENSOR(temp_sensor, 3303, get_temp_value, - .max_range = IPSO_TEMPERATURE_MAX, /* milli celcius */ - .min_range = IPSO_TEMPERATURE_MIN, /* milli celcius */ - .unit = "Cel", - .update_interval = 10 - ); - -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -get_temp_value(const ipso_sensor_t *s, int32_t *value) -{ -#ifdef IPSO_TEMPERATURE - if(IPSO_TEMPERATURE.read_value != NULL && - IPSO_TEMPERATURE.read_value(value) == 0) { - return LWM2M_STATUS_OK; - } -#endif /* IPSO_TEMPERATURE */ - return LWM2M_STATUS_ERROR; -} -/*---------------------------------------------------------------------------*/ -void -ipso_temperature_init(void) -{ -#ifdef IPSO_TEMPERATURE - if(IPSO_TEMPERATURE.init) { - IPSO_TEMPERATURE.init(); - } -#endif /* IPSO_TEMPERATURE */ - - ipso_sensor_add(&temp_sensor); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-device.c b/os/services/lwm2m/lwm2m-device.c deleted file mode 100644 index 4183c59ca..000000000 --- a/os/services/lwm2m/lwm2m-device.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M device - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include "lwm2m-object.h" -#include "lwm2m-device.h" -#include "lwm2m-engine.h" -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-dev" -#define LOG_LEVEL LOG_LEVEL_LWM2M - -static const lwm2m_resource_id_t resources[] = - { RO(LWM2M_DEVICE_MANUFACTURER_ID), - RO(LWM2M_DEVICE_MODEL_NUMBER_ID), - RO(LWM2M_DEVICE_SERIAL_NUMBER_ID), - RO(LWM2M_DEVICE_FIRMWARE_VERSION_ID), - RO(LWM2M_DEVICE_AVAILABLE_POWER_SOURCES), /* Multi-resource-instance */ - RO(LWM2M_DEVICE_POWER_SOURCE_VOLTAGE), /* Multi-resource-instance */ - RO(LWM2M_DEVICE_POWER_SOURCE_CURRENT), /* Multi-resource-instance */ - RO(LWM2M_DEVICE_TYPE_ID), - EX(LWM2M_DEVICE_REBOOT_ID), - RW(LWM2M_DEVICE_TIME_ID), - EX(LWM2M_DEVICE_FACTORY_DEFAULT_ID), - }; - -#ifndef LWM2M_DEVICE_MANUFACTURER -#define LWM2M_DEVICE_MANUFACTURER "RISE SICS" -#endif -#ifndef LWM2M_DEVICE_MODEL_NUMBER -#define LWM2M_DEVICE_MODEL_NUMBER "1" -#endif -#ifndef LWM2M_DEVICE_SERIAL_NUMBER -#define LWM2M_DEVICE_SERIAL_NUMBER "1" -#endif -#ifndef LWM2M_DEVICE_FIRMWARE_VERSION -#define LWM2M_DEVICE_FIRMWARE_VERSION CONTIKI_VERSION -#endif -#ifndef LWM2M_DEVICE_TYPE -#define LWM2M_DEVICE_TYPE "Contiki-NG LWM2M" -#endif - -/* All three must be defined */ -#ifndef LWM2M_DEVICE_POWER_AVAILABLE -#define LWM2M_DEVICE_POWER_AVAILABLE {1,5} -#define LWM2M_DEVICE_POWER_VOLTAGE {2500,5000} -#define LWM2M_DEVICE_POWER_CURRENT {500,1000} -#endif - -static int32_t time_offset = 0; - -/* Internal battery and USB - just for test...*/ -static uint16_t power_avail[] = LWM2M_DEVICE_POWER_AVAILABLE; -static uint16_t power_voltage[] = LWM2M_DEVICE_POWER_VOLTAGE; -static uint16_t power_current[] = LWM2M_DEVICE_POWER_CURRENT; -/*---------------------------------------------------------------------------*/ -int32_t -lwm2m_device_get_time(void) -{ - return coap_timer_seconds() + time_offset; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_device_set_time(int32_t time) -{ - time_offset = time - coap_timer_seconds(); -} -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -write_string(lwm2m_context_t *ctx, const char *text) -{ - lwm2m_object_write_string(ctx, text, strlen(text)); - return LWM2M_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -static int -output_multi_i16(lwm2m_context_t *ctx, const uint16_t *data, int count) -{ - int i; - size_t len; - len = lwm2m_object_write_enter_ri(ctx); - for(i = 0; i < count; i++) { - len += lwm2m_object_write_int_ri(ctx, i, data[i]); - } - len += lwm2m_object_write_exit_ri(ctx); - return len; -} - -/*---------------------------------------------------------------------------*/ -static int -lwm2m_dim_callback(lwm2m_object_instance_t *object, uint16_t resource_id) -{ - switch(resource_id) { - case LWM2M_DEVICE_AVAILABLE_POWER_SOURCES: - case LWM2M_DEVICE_POWER_SOURCE_VOLTAGE: - case LWM2M_DEVICE_POWER_SOURCE_CURRENT: - return sizeof(power_avail) / sizeof(uint16_t); - break; - } - /* zero means that it is no dim parameter to send?? */ - return 0; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -lwm2m_callback(lwm2m_object_instance_t *object, lwm2m_context_t *ctx) -{ - if(ctx->operation == LWM2M_OP_READ) { - switch(ctx->resource_id) { - case LWM2M_DEVICE_MANUFACTURER_ID: - return write_string(ctx, LWM2M_DEVICE_MANUFACTURER); - case LWM2M_DEVICE_MODEL_NUMBER_ID: - return write_string(ctx, LWM2M_DEVICE_MODEL_NUMBER); - case LWM2M_DEVICE_SERIAL_NUMBER_ID: - return write_string(ctx, LWM2M_DEVICE_SERIAL_NUMBER); - case LWM2M_DEVICE_FIRMWARE_VERSION_ID: - return write_string(ctx, LWM2M_DEVICE_FIRMWARE_VERSION); - case LWM2M_DEVICE_TYPE_ID: - return write_string(ctx, LWM2M_DEVICE_TYPE); - case LWM2M_DEVICE_TIME_ID: - LOG_DBG("Reading time: %u\n", (unsigned int)lwm2m_device_get_time()); - lwm2m_object_write_int(ctx, lwm2m_device_get_time()); - return LWM2M_STATUS_OK; - case LWM2M_DEVICE_AVAILABLE_POWER_SOURCES: - /* Power Multi-resource case - just use array index as ID */ - output_multi_i16(ctx, power_avail, - sizeof(power_avail)/sizeof(uint16_t)); - return LWM2M_STATUS_OK; - case LWM2M_DEVICE_POWER_SOURCE_VOLTAGE: - output_multi_i16(ctx, power_voltage, - sizeof(power_voltage)/sizeof(uint16_t)); - return LWM2M_STATUS_OK; - case LWM2M_DEVICE_POWER_SOURCE_CURRENT: - output_multi_i16(ctx, power_current, - sizeof(power_current)/sizeof(uint16_t)); - return LWM2M_STATUS_OK; - default: - LOG_WARN("Not found: %u\n", ctx->resource_id); - return LWM2M_STATUS_NOT_FOUND; - } - - } else if(ctx->operation == LWM2M_OP_EXECUTE) { - if(ctx->resource_id == LWM2M_DEVICE_REBOOT_ID) { - /* Do THE REBOOT */ - LOG_INFO("REBOOT\n"); - return LWM2M_STATUS_OK; - } - - } else if(ctx->operation == LWM2M_OP_WRITE) { - if(ctx->resource_id == LWM2M_DEVICE_TIME_ID) { - int32_t lw_time; - size_t len; - len = lwm2m_object_read_int(ctx, ctx->inbuf->buffer, ctx->inbuf->size, - &lw_time); - if(len == 0) { - LOG_WARN("FAIL: could not write time\n"); - return LWM2M_STATUS_WRITE_ERROR; - } else { - lwm2m_device_set_time(lw_time); - LOG_DBG("Write time %lu sec => offset = %ld\n", - (unsigned long)lw_time, (long)time_offset); - return LWM2M_STATUS_OK; - } - } - } - - return LWM2M_STATUS_OPERATION_NOT_ALLOWED; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t device = { - .object_id = LWM2M_OBJECT_DEVICE_ID, - .instance_id = 0, - .resource_ids = resources, - .resource_count = sizeof(resources) / sizeof(lwm2m_resource_id_t), - .resource_dim_callback = lwm2m_dim_callback, - .callback = lwm2m_callback, -}; -/*---------------------------------------------------------------------------*/ -void -lwm2m_device_init(void) -{ - lwm2m_engine_add_object(&device); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-device.h b/os/services/lwm2m/lwm2m-device.h deleted file mode 100644 index d7389153c..000000000 --- a/os/services/lwm2m/lwm2m-device.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Header file for the Contiki OMA LWM2M device - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef LWM2M_DEVICE_H_ -#define LWM2M_DEVICE_H_ - -#include "contiki.h" - -#define LWM2M_DEVICE_MANUFACTURER_ID 0 -#define LWM2M_DEVICE_MODEL_NUMBER_ID 1 -#define LWM2M_DEVICE_SERIAL_NUMBER_ID 2 -#define LWM2M_DEVICE_FIRMWARE_VERSION_ID 3 -#define LWM2M_DEVICE_REBOOT_ID 4 -#define LWM2M_DEVICE_FACTORY_DEFAULT_ID 5 -#define LWM2M_DEVICE_AVAILABLE_POWER_SOURCES 6 -/* These do have multiple instances */ -#define LWM2M_DEVICE_POWER_SOURCE_VOLTAGE 7 -#define LWM2M_DEVICE_POWER_SOURCE_CURRENT 8 -#define LWM2M_DEVICE_BATTERY_LEVEL 9 - -#define LWM2M_DEVICE_ERROR_CODE 11 -#define LWM2M_DEVICE_TIME_ID 13 -#define LWM2M_DEVICE_TYPE_ID 17 - -#ifndef LWM2M_DEVICE_MODEL_NUMBER -#ifdef BOARD_STRING -#define LWM2M_DEVICE_MODEL_NUMBER BOARD_STRING -#endif /* BOARD_STRING */ -#endif /* LWM2M_DEVICE_MODEL_NUMBER */ - -#ifndef LWM2M_DEVICE_FIRMWARE_VERSION -#ifdef CONTIKI_VERSION_STRING -#define LWM2M_DEVICE_FIRMWARE_VERSION CONTIKI_VERSION_STRING -#endif /* CONTIKI_VERSION_STRING */ -#endif /* LWM2M_DEVICE_FIRMWARE_VERSION */ - -int32_t lwm2m_device_get_time(void); -void lwm2m_device_set_time(int32_t time); - -void lwm2m_device_init(void); - -#endif /* LWM2M_DEVICE_H_ */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-engine.c b/os/services/lwm2m/lwm2m-engine.c deleted file mode 100644 index 1d6032bd2..000000000 --- a/os/services/lwm2m/lwm2m-engine.c +++ /dev/null @@ -1,1698 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M engine - * \author - * Joakim Eriksson - * Niclas Finne - * Carlos Gonzalo Peces - */ - -#include "lwm2m-engine.h" -#include "lwm2m-object.h" -#include "lwm2m-device.h" -#include "lwm2m-plain-text.h" -#include "lwm2m-json.h" -#include "coap-constants.h" -#include "coap-engine.h" -#include "lwm2m-tlv.h" -#include "lwm2m-tlv-reader.h" -#include "lwm2m-tlv-writer.h" -#include "lib/list.h" -#include "sys/cc.h" -#include -#include -#include -#ifndef LWM2M_ENGINE_CLIENT_ENDPOINT_NAME -#include "net/ipv6/uip-ds6.h" -#endif /* LWM2M_ENGINE_CLIENT_ENDPOINT_NAME */ - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-eng" -#define LOG_LEVEL LOG_LEVEL_LWM2M - -#ifndef LWM2M_ENGINE_CLIENT_ENDPOINT_PREFIX -#ifdef LWM2M_DEVICE_MODEL_NUMBER -#define LWM2M_ENGINE_CLIENT_ENDPOINT_PREFIX "Contiki-NG-"LWM2M_DEVICE_MODEL_NUMBER -#else /* LWM2M_DEVICE_MODEL_NUMBER */ -#define LWM2M_ENGINE_CLIENT_ENDPOINT_PREFIX "Contiki-NG" -#endif /* LWM2M_DEVICE_MODEL_NUMBER */ -#endif /* LWM2M_ENGINE_CLIENT_ENDPOINT_PREFIX */ - -#ifdef LWM2M_ENGINE_CONF_USE_RD_CLIENT -#define USE_RD_CLIENT LWM2M_ENGINE_CONF_USE_RD_CLIENT -#else -#define USE_RD_CLIENT 1 -#endif /* LWM2M_ENGINE_CONF_USE_RD_CLIENT */ - - -#if LWM2M_QUEUE_MODE_ENABLED - /* Queue Mode is handled using the RD Client and the Q-Mode object */ -#define USE_RD_CLIENT 1 -#endif - -#if USE_RD_CLIENT -#include "lwm2m-rd-client.h" -#endif - -#if LWM2M_QUEUE_MODE_ENABLED -#include "lwm2m-queue-mode.h" -#include "lwm2m-notification-queue.h" -#if LWM2M_QUEUE_MODE_OBJECT_ENABLED -#include "lwm2m-queue-mode-object.h" -#endif /* LWM2M_QUEUE_MODE_OBJECT_ENABLED */ -#endif /* LWM2M_QUEUE_MODE_ENABLED */ - -/* MACRO for getting out resource ID from resource array ID + flags */ -#define RSC_ID(x) ((uint16_t)(x & 0xffff)) -#define RSC_READABLE(x) ((x & LWM2M_RESOURCE_READ) > 0) -#define RSC_WRITABLE(x) ((x & LWM2M_RESOURCE_WRITE) > 0) -#define RSC_UNSPECIFIED(x) ((x & LWM2M_RESOURCE_OP_MASK) == 0) - -/* invalid instance ID - ffff object ID */ -#define NO_INSTANCE 0xffffffff - -/* This is a double-buffer for generating BLOCKs in CoAP - the idea - is that typical LWM2M resources will fit 1 block unless they themselves - handle BLOCK transfer - having a double sized buffer makes it possible - to allow writing more than one block before sending the full block. - The RFC seems to indicate that all blocks execept the last one should - be full. -*/ -static uint8_t d_buf[COAP_MAX_BLOCK_SIZE * 2]; -static lwm2m_buffer_t lwm2m_buf = { - .len = 0, .size = COAP_MAX_BLOCK_SIZE * 2, .buffer = d_buf -}; -static lwm2m_object_instance_t instance_buffer; - -/* obj-id / ... */ -static uint16_t lwm2m_buf_lock[4]; -static uint64_t lwm2m_buf_lock_timeout = 0; - -static lwm2m_write_opaque_callback current_opaque_callback; -static int current_opaque_offset = 0; - -static coap_handler_status_t lwm2m_handler_callback(coap_message_t *request, - coap_message_t *response, - uint8_t *buffer, - uint16_t buffer_size, - int32_t *offset); -static lwm2m_object_instance_t * -next_object_instance(const lwm2m_context_t *context, lwm2m_object_t *object, lwm2m_object_instance_t *last); - -static struct { - uint16_t object_id; - uint16_t instance_id; - uint16_t token_len; - uint8_t token[COAP_TOKEN_LEN]; - /* in the future also a timeout */ -} created; - -COAP_HANDLER(lwm2m_handler, lwm2m_handler_callback); -LIST(object_list); -LIST(generic_object_list); - -/*---------------------------------------------------------------------------*/ -static lwm2m_object_t * -get_object(uint16_t object_id) -{ - lwm2m_object_t *object; - for(object = list_head(generic_object_list); - object != NULL; - object = object->next) { - if(object->impl && object->impl->object_id == object_id) { - return object; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static int -has_non_generic_object(uint16_t object_id) -{ - lwm2m_object_instance_t *instance; - for(instance = list_head(object_list); - instance != NULL; - instance = instance->next) { - if(instance->object_id == object_id) { - return 1; - } - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -get_instance(uint16_t object_id, uint16_t instance_id, lwm2m_object_t **o) -{ - lwm2m_object_instance_t *instance; - lwm2m_object_t *object; - - if(o) { - *o = NULL; - } - - for(instance = list_head(object_list); - instance != NULL; - instance = instance->next) { - if(instance->object_id == object_id) { - if(instance->instance_id == instance_id || - instance_id == LWM2M_OBJECT_INSTANCE_NONE) { - return instance; - } - } - } - - object = get_object(object_id); - if(object != NULL) { - if(o) { - *o = object; - } - if(instance_id == LWM2M_OBJECT_INSTANCE_NONE) { - return object->impl->get_first(NULL); - } - return object->impl->get_by_id(instance_id, NULL); - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -get_instance_by_context(const lwm2m_context_t *context, lwm2m_object_t **o) -{ - if(context->level < 2) { - return get_instance(context->object_id, LWM2M_OBJECT_INSTANCE_NONE, o); - } - return get_instance(context->object_id, context->object_instance_id, o); -} -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -call_instance(lwm2m_object_instance_t *instance, lwm2m_context_t *context) -{ - if(context->level < 3) { - return LWM2M_STATUS_OPERATION_NOT_ALLOWED; - } - - if(instance == NULL) { - /* No instance */ - return LWM2M_STATUS_NOT_FOUND; - } - - if(instance->callback == NULL) { - return LWM2M_STATUS_ERROR; - } - - return instance->callback(instance, context); -} -/*---------------------------------------------------------------------------*/ -/* This is intended to switch out a block2 transfer buffer - * It assumes that ctx containts the double buffer and that the outbuf is to - * be the new buffer in ctx. - */ -static int -double_buffer_flush(lwm2m_buffer_t *ctxbuf, lwm2m_buffer_t *outbuf, int size) -{ - /* Copy the data from the double buffer in ctx to the outbuf and move data */ - /* If the buffer is less than size - we will output all and get remaining down - to zero */ - if(ctxbuf->len < size) { - size = ctxbuf->len; - } - if(ctxbuf->len >= size && outbuf->size >= size) { - LOG_DBG("Double buffer - copying out %d bytes remaining: %d\n", - size, ctxbuf->len - size); - memcpy(outbuf->buffer, ctxbuf->buffer, size); - memcpy(ctxbuf->buffer, &ctxbuf->buffer[size], - ctxbuf->len - size); - ctxbuf->len -= size; - outbuf->len = size; - return outbuf->len; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static inline const char * -get_method_as_string(coap_resource_flags_t method) -{ - if(method == METHOD_GET) { - return "GET"; - } else if(method == METHOD_POST) { - return "POST"; - } else if(method == METHOD_PUT) { - return "PUT"; - } else if(method == METHOD_DELETE) { - return "DELETE"; - } else { - return "UNKNOWN"; - } -} -/*--------------------------------------------------------------------------*/ -static const char * -get_status_as_string(lwm2m_status_t status) -{ - static char buffer[8]; - switch(status) { - case LWM2M_STATUS_OK: - return "OK"; - case LWM2M_STATUS_ERROR: - return "ERROR"; - case LWM2M_STATUS_WRITE_ERROR: - return "WRITE ERROR"; - case LWM2M_STATUS_READ_ERROR: - return "READ ERROR"; - case LWM2M_STATUS_BAD_REQUEST: - return "BAD REQUEST"; - case LWM2M_STATUS_UNAUTHORIZED: - return "UNAUTHORIZED"; - case LWM2M_STATUS_FORBIDDEN: - return "FORBIDDEN"; - case LWM2M_STATUS_NOT_FOUND: - return "NOT FOUND"; - case LWM2M_STATUS_OPERATION_NOT_ALLOWED: - return "OPERATION NOT ALLOWED"; - case LWM2M_STATUS_NOT_ACCEPTABLE: - return "NOT ACCEPTABLE"; - case LWM2M_STATUS_UNSUPPORTED_CONTENT_FORMAT: - return "UNSUPPORTED CONTENT FORMAT"; - case LWM2M_STATUS_NOT_IMPLEMENTED: - return "NOT IMPLEMENTED"; - case LWM2M_STATUS_SERVICE_UNAVAILABLE: - return "SERVICE UNAVAILABLE"; - default: - snprintf(buffer, sizeof(buffer) - 1, "<%u>", status); - return buffer; - } -} -/*--------------------------------------------------------------------------*/ -static int -parse_path(const char *path, int path_len, - uint16_t *oid, uint16_t *iid, uint16_t *rid) -{ - int ret; - int pos; - uint16_t val; - char c = 0; - - /* get object id */ - LOG_DBG("parse PATH: \""); - LOG_DBG_COAP_STRING(path, path_len); - LOG_DBG_("\"\n"); - - ret = 0; - pos = 0; - do { - val = 0; - /* we should get a value first - consume all numbers */ - while(pos < path_len && (c = path[pos]) >= '0' && c <= '9') { - val = val * 10 + (c - '0'); - pos++; - } - /* Slash will mote thing forward - and the end will be when pos == pl */ - if(c == '/' || pos == path_len) { - /* PRINTF("Setting %u = %u\n", ret, val); */ - if(ret == 0) *oid = val; - if(ret == 1) *iid = val; - if(ret == 2) *rid = val; - ret++; - pos++; - } else { - /* PRINTF("Error: illegal char '%c' at pos:%d\n", c, pos); */ - return -1; - } - } while(pos < path_len); - return ret; -} -/*--------------------------------------------------------------------------*/ -static int -lwm2m_engine_parse_context(const char *path, int path_len, - coap_message_t *request, coap_message_t *response, - uint8_t *outbuf, size_t outsize, - lwm2m_context_t *context) -{ - int ret; - if(context == NULL || path == NULL) { - return 0; - } - - ret = parse_path(path, path_len, &context->object_id, - &context->object_instance_id, &context->resource_id); - - if(ret > 0) { - context->level = ret; - } - - return ret; -} - -/*---------------------------------------------------------------------------*/ -void lwm2m_engine_set_opaque_callback(lwm2m_context_t *ctx, lwm2m_write_opaque_callback cb) -{ - /* Here we should set the callback for the opaque that we are currently generating... */ - /* And we should in the future associate the callback with the CoAP message info - MID */ - LOG_DBG("Setting opaque handler - offset: %"PRIu32",%d\n", - ctx->offset, ctx->outbuf->len); - - current_opaque_offset = 0; - current_opaque_callback = cb; -} -/*---------------------------------------------------------------------------*/ -int -lwm2m_engine_set_rd_data(lwm2m_buffer_t *outbuf, int block) -{ - /* remember things here - need to lock lwm2m buffer also!!! */ - static lwm2m_object_t *object; - static lwm2m_object_instance_t *instance; - int len; - /* pick size from outbuf */ - int maxsize = outbuf->size; - - if(lwm2m_buf_lock[0] != 0 && (lwm2m_buf_lock_timeout > coap_timer_uptime()) && - ((lwm2m_buf_lock[1] != 0xffff) || - (lwm2m_buf_lock[2] != 0xffff))) { - LOG_DBG("Set-RD: already exporting resource: %d/%d/%d\n", - lwm2m_buf_lock[1], lwm2m_buf_lock[2], lwm2m_buf_lock[3]); - /* fail - what should we return here? */ - return 0; - } - - if(block == 0) { - LOG_DBG("Starting RD generation\n"); - /* start with simple object instances */ - instance = list_head(object_list); - object = NULL; - - if(instance == NULL) { - /* No simple object instances available */ - object = list_head(generic_object_list); - if(object == NULL) { - /* No objects of any kind available */ - return 0; - } - if(object->impl != NULL) { - instance = object->impl->get_first(NULL); - } - } - - lwm2m_buf_lock[0] = 1; /* lock "flag" */ - lwm2m_buf_lock[1] = 0xffff; - lwm2m_buf_lock[2] = 0xffff; - lwm2m_buf_lock[3] = 0xffff; - } else { - /* object and instance was static... */ - } - - lwm2m_buf_lock_timeout = coap_timer_uptime() + 1000; - - LOG_DBG("Generating RD list:"); - while(instance != NULL || object != NULL) { - int pos = lwm2m_buf.len; - if(instance != NULL) { - len = snprintf((char *) &lwm2m_buf.buffer[pos], - lwm2m_buf.size - pos, (pos > 0 || block > 0) ? "," : "", - instance->object_id, instance->instance_id); - LOG_DBG_((pos > 0 || block > 0) ? "," : "", - instance->object_id, instance->instance_id); - } else if(object->impl != NULL) { - len = snprintf((char *) &lwm2m_buf.buffer[pos], - lwm2m_buf.size - pos, - (pos > 0 || block > 0) ? "," : "", - object->impl->object_id); - LOG_DBG_((pos > 0 || block > 0) ? "," : "", - object->impl->object_id); - } else { - len = 0; - } - lwm2m_buf.len += len; - if(instance != NULL) { - instance = next_object_instance(NULL, object, instance); - } - - if(instance == NULL) { - if(object == NULL) { - /* - * No object and no instance - we are done with simple object instances. - */ - object = list_head(generic_object_list); - } else { - /* - * Object exists but not an instance - instances for this object are - * done - go to next. - */ - object = object->next; - } - - if(object != NULL && object->impl != NULL) { - instance = object->impl->get_first(NULL); - } - - if(instance == NULL && object == NULL && lwm2m_buf.len <= maxsize) { - /* Data generation is done. No more messages are needed after this. */ - break; - } - } - - if(lwm2m_buf.len >= maxsize) { - LOG_DBG_("\n"); - LOG_DBG("**** CoAP MAX BLOCK Reached!!! **** SEND\n"); - /* If the produced data is larger than a CoAP block we need to send - this now */ - double_buffer_flush(&lwm2m_buf, outbuf, maxsize); - /* there will be more - keep lock! */ - return 1; - } - } - LOG_DBG_("\n"); - double_buffer_flush(&lwm2m_buf, outbuf, maxsize); - /* unlock the buffer */ - lwm2m_buf_lock[0] = 0; - return 0; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_engine_init(void) -{ - list_init(object_list); - list_init(generic_object_list); - -#ifdef LWM2M_ENGINE_CLIENT_ENDPOINT_NAME - const char *endpoint = LWM2M_ENGINE_CLIENT_ENDPOINT_NAME; - -#else /* LWM2M_ENGINE_CLIENT_ENDPOINT_NAME */ - static char endpoint[32]; - int len, i; - uint8_t state; - uip_ipaddr_t *ipaddr; - - len = strlen(LWM2M_ENGINE_CLIENT_ENDPOINT_PREFIX); - /* ensure that this fits with the hex-nums */ - if(len > sizeof(endpoint) - 13) { - len = sizeof(endpoint) - 13; - } - - for(i = 0; i < len; i++) { - if(LWM2M_ENGINE_CLIENT_ENDPOINT_PREFIX[i] == ' ') { - endpoint[i] = '-'; - } else { - endpoint[i] = LWM2M_ENGINE_CLIENT_ENDPOINT_PREFIX[i]; - } - } - /* pick an IP address that is PREFERRED or TENTATIVE */ - ipaddr = NULL; - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - ipaddr = &(uip_ds6_if.addr_list[i]).ipaddr; - break; - } - } - - if(ipaddr != NULL) { - for(i = 0; i < 6; i++) { - /* assume IPv6 for now */ - uint8_t b = ipaddr->u8[10 + i]; - endpoint[len++] = (b >> 4) > 9 ? 'A' - 10 + (b >> 4) : '0' + (b >> 4); - endpoint[len++] = (b & 0xf) > 9 ? 'A' - 10 + (b & 0xf) : '0' + (b & 0xf); - } - } - - /* a zero at end of string */ - endpoint[len] = 0; - -#endif /* LWM2M_ENGINE_CLIENT_ENDPOINT_NAME */ - - /* Initialize CoAP engine. Contiki-NG already does that from the main, - * but for standalone use of lwm2m, this is required here. coap_engine_init() - * checks for double-initialization and can be called twice safely. */ - coap_engine_init(); - - /* Register the CoAP handler for lightweight object handling */ - coap_add_handler(&lwm2m_handler); - -#if USE_RD_CLIENT - lwm2m_rd_client_init(endpoint); -#endif - -#if LWM2M_QUEUE_MODE_ENABLED && LWM2M_QUEUE_MODE_OBJECT_ENABLED - lwm2m_queue_mode_object_init(); -#endif -} -/*---------------------------------------------------------------------------*/ -/* - * Set the writer pointer to the proper writer based on the Accept: header - * - * param[in] context LWM2M context to operate on - * param[in] accept Accept type number from CoAP headers - * - * return The content type of the response if the selected writer is used - */ -static unsigned int -lwm2m_engine_select_writer(lwm2m_context_t *context, unsigned int accept) -{ - switch(accept) { - case LWM2M_TLV: - case LWM2M_OLD_TLV: - context->writer = &lwm2m_tlv_writer; - break; - case LWM2M_TEXT_PLAIN: - case TEXT_PLAIN: - context->writer = &lwm2m_plain_text_writer; - break; - case LWM2M_JSON: - case LWM2M_OLD_JSON: - case APPLICATION_JSON: - context->writer = &lwm2m_json_writer; - break; - default: - LOG_WARN("Unknown Accept type %u, using LWM2M plain text\n", accept); - context->writer = &lwm2m_plain_text_writer; - /* Set the response type to plain text */ - accept = LWM2M_TEXT_PLAIN; - break; - } - context->content_type = accept; - return accept; -} -/*---------------------------------------------------------------------------*/ -/* - * Set the reader pointer to the proper reader based on the Content-format: header - * - * param[in] context LWM2M context to operate on - * param[in] content_format Content-type type number from CoAP headers - */ -static void -lwm2m_engine_select_reader(lwm2m_context_t *context, unsigned int content_format) -{ - switch(content_format) { - case LWM2M_TLV: - case LWM2M_OLD_TLV: - context->reader = &lwm2m_tlv_reader; - break; - case LWM2M_JSON: - case LWM2M_OLD_JSON: - context->reader = &lwm2m_plain_text_reader; - break; - case LWM2M_TEXT_PLAIN: - case TEXT_PLAIN: - context->reader = &lwm2m_plain_text_reader; - break; - default: - LOG_WARN("Unknown content type %u, using LWM2M plain text\n", - content_format); - context->reader = &lwm2m_plain_text_reader; - break; - } -} - -/*---------------------------------------------------------------------------*/ -/* Lightweight object instances */ -/*---------------------------------------------------------------------------*/ -static uint32_t last_instance_id = NO_INSTANCE; -static int last_rsc_pos; - -/* Multi read will handle read of JSON / TLV or Discovery (Link Format) */ -static lwm2m_status_t -perform_multi_resource_read_op(lwm2m_object_t *object, - lwm2m_object_instance_t *instance, - lwm2m_context_t *ctx) -{ - int size = ctx->outbuf->size; - int len = 0; - uint8_t initialized = 0; /* used for commas, etc */ - uint8_t num_read = 0; - lwm2m_buffer_t *outbuf; - - if(instance == NULL) { - /* No existing instance */ - return LWM2M_STATUS_NOT_FOUND; - } - - if(ctx->level < 3 && - (ctx->content_type == LWM2M_TEXT_PLAIN || - ctx->content_type == TEXT_PLAIN || - ctx->content_type == LWM2M_OLD_OPAQUE)) { - return LWM2M_STATUS_OPERATION_NOT_ALLOWED; - } - - /* copy out the out-buffer as read will use its own - will be same for disoc when - read is fixed */ - outbuf = ctx->outbuf; - - /* Currently we only handle one incoming read request at a time - so we return - BUZY or service unavailable */ - if(lwm2m_buf_lock[0] != 0 && (lwm2m_buf_lock_timeout > coap_timer_uptime()) && - ((lwm2m_buf_lock[1] != ctx->object_id) || - (lwm2m_buf_lock[2] != ctx->object_instance_id) || - (lwm2m_buf_lock[3] != ctx->resource_id))) { - LOG_DBG("Multi-read: already exporting resource: %d/%d/%d\n", - lwm2m_buf_lock[1], lwm2m_buf_lock[2], lwm2m_buf_lock[3]); - return LWM2M_STATUS_SERVICE_UNAVAILABLE; - } - - LOG_DBG("MultiRead: %d/%d/%d lv:%d offset:%"PRIu32"\n", - ctx->object_id, ctx->object_instance_id, ctx->resource_id, - ctx->level, ctx->offset); - - /* Make use of the double buffer */ - ctx->outbuf = &lwm2m_buf; - - if(ctx->offset == 0) { - /* First GET request - need to setup all buffers and reset things here */ - last_instance_id = - ((uint32_t)instance->object_id << 16) | instance->instance_id; - last_rsc_pos = 0; - /* reset any callback */ - current_opaque_callback = NULL; - /* reset lwm2m_buf_len - so that we can use the double-size buffer */ - lwm2m_buf_lock[0] = 1; /* lock "flag" */ - lwm2m_buf_lock[1] = ctx->object_id; - lwm2m_buf_lock[2] = ctx->object_instance_id; - lwm2m_buf_lock[3] = ctx->resource_id; - lwm2m_buf.len = 0; - /* Here we should print top node */ - } else { - /* offset > 0 - assume that we are already in a disco or multi get*/ - instance = get_instance(last_instance_id >> 16, last_instance_id & 0xffff, - &object); - - /* we assume that this was initialized */ - initialized = 1; - ctx->writer_flags |= WRITER_OUTPUT_VALUE; - if(instance == NULL) { - ctx->offset = -1; - ctx->outbuf->buffer[0] = ' '; - } - } - lwm2m_buf_lock_timeout = coap_timer_uptime() + 1000; - - while(instance != NULL) { - /* Do the discovery or read */ - if(instance->resource_ids != NULL && instance->resource_count > 0) { - /* show all the available resources (or read all) */ - while(last_rsc_pos < instance->resource_count) { - LOG_DBG("READ: 0x%"PRIx32" 0x%x 0x%x lv:%d\n", - instance->resource_ids[last_rsc_pos], - RSC_ID(instance->resource_ids[last_rsc_pos]), - ctx->resource_id, ctx->level); - - /* Check if this is a object read or if it is the correct resource */ - if(ctx->level < 3 || ctx->resource_id == RSC_ID(instance->resource_ids[last_rsc_pos])) { - /* ---------- Discovery operation ------------- */ - /* If this is a discovery all the object, instance, and resource triples should be - generted */ - if(ctx->operation == LWM2M_OP_DISCOVER) { - int dim = 0; - len = snprintf((char *) &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, - (ctx->outbuf->len == 0 && ctx->offset == 0) ? "":",", - instance->object_id, instance->instance_id, - RSC_ID(instance->resource_ids[last_rsc_pos])); - if(instance->resource_dim_callback != NULL && - (dim = instance->resource_dim_callback(instance, - RSC_ID(instance->resource_ids[last_rsc_pos]))) > 0) { - len += snprintf((char *) &ctx->outbuf->buffer[ctx->outbuf->len + len], - ctx->outbuf->size - ctx->outbuf->len - len, ";dim=%d", dim); - } - /* here we have "read" out something */ - num_read++; - ctx->outbuf->len += len; - if(len < 0 || ctx->outbuf->len >= size) { - double_buffer_flush(ctx->outbuf, outbuf, size); - - LOG_DBG("Copied lwm2m buf - remaining: %d\n", lwm2m_buf.len); - /* switch buffer */ - ctx->outbuf = outbuf; - ctx->writer_flags |= WRITER_HAS_MORE; - ctx->offset += size; - return LWM2M_STATUS_OK; - } - /* ---------- Read operation ------------- */ - } else if(ctx->operation == LWM2M_OP_READ) { - lwm2m_status_t success = 0; - uint8_t lv; - - lv = ctx->level; - - /* Do not allow a read on a non-readable */ - if(lv == 3 && !RSC_READABLE(instance->resource_ids[last_rsc_pos])) { - lwm2m_buf_lock[0] = 0; - return LWM2M_STATUS_OPERATION_NOT_ALLOWED; - } - /* Set the resource ID is ctx->level < 3 */ - if(lv < 3) { - ctx->resource_id = RSC_ID(instance->resource_ids[last_rsc_pos]); - } - if(lv < 2) { - ctx->object_instance_id = instance->instance_id; - } - - if(RSC_READABLE(instance->resource_ids[last_rsc_pos])) { - ctx->level = 3; - if(!initialized) { - /* Now we need to initialize the object writing for this new object */ - len = ctx->writer->init_write(ctx); - ctx->outbuf->len += len; - LOG_DBG("INIT WRITE len:%d size:%"PRIu16"\n", len, ctx->outbuf->size); - initialized = 1; - } - - if(current_opaque_callback == NULL) { - LOG_DBG("Doing the callback to the resource %d\n", ctx->outbuf->len); - /* No special opaque callback to handle - use regular callback */ - success = instance->callback(instance, ctx); - LOG_DBG("After the callback to the resource %d: %s\n", - ctx->outbuf->len, get_status_as_string(success)); - - if(success != LWM2M_STATUS_OK) { - /* What to do here? */ - LOG_DBG("Callback failed: %s\n", get_status_as_string(success)); - if(lv < 3) { - if(success == LWM2M_STATUS_NOT_FOUND) { - /* ok with a not found during a multi read - what more - is ok? */ - } else { - lwm2m_buf_lock[0] = 0; - return success; - } - } else { - lwm2m_buf_lock[0] = 0; - return success; - } - } - } - if(current_opaque_callback != NULL) { - uint32_t old_offset = ctx->offset; - int num_write = COAP_MAX_BLOCK_SIZE - ctx->outbuf->len; - /* Check if the callback did set a opaque callback function - then - we should produce data via that callback until the opaque has fully - been handled */ - ctx->offset = current_opaque_offset; - /* LOG_DBG("Calling the opaque handler %x\n", ctx->writer_flags); */ - success = current_opaque_callback(instance, ctx, num_write); - if((ctx->writer_flags & WRITER_HAS_MORE) == 0) { - /* This opaque stream is now done! */ - /* LOG_DBG("Setting opaque callback to null - it is done!\n"); */ - current_opaque_callback = NULL; - } else if(ctx->outbuf->len < COAP_MAX_BLOCK_SIZE) { - lwm2m_buf_lock[0] = 0; - return LWM2M_STATUS_ERROR; - } - current_opaque_offset += num_write; - ctx->offset = old_offset; - /* LOG_DBG("Setting back offset to: %d\n", ctx->offset); */ - } - - /* here we have "read" out something */ - num_read++; - /* We will need to handle no-success and other things */ - LOG_DBG("Called %u/%u/%u outlen:%u %s\n", - ctx->object_id, ctx->object_instance_id, ctx->resource_id, - ctx->outbuf->len, get_status_as_string(success)); - - /* we need to handle full buffer, etc here also! */ - ctx->level = lv; - } else { - LOG_DBG("Resource %u not readable\n", - RSC_ID(instance->resource_ids[last_rsc_pos])); - } - } - } - if(current_opaque_callback == NULL) { - /* This resource is now done - (only when the opaque is also done) */ - last_rsc_pos++; - } else { - LOG_DBG("Opaque is set - continue with that.\n"); - } - - if(ctx->outbuf->len >= COAP_MAX_BLOCK_SIZE) { - LOG_DBG("**** CoAP MAX BLOCK Reached!!! **** SEND\n"); - /* If the produced data is larger than a CoAP block we need to send - this now */ - if(ctx->outbuf->len < 2 * COAP_MAX_BLOCK_SIZE) { - /* We assume that size is equal to COAP_MAX_BLOCK_SIZE here */ - double_buffer_flush(ctx->outbuf, outbuf, size); - - LOG_DBG("Copied lwm2m buf - remaining: %d\n", lwm2m_buf.len); - /* switch buffer */ - ctx->outbuf = outbuf; - ctx->writer_flags |= WRITER_HAS_MORE; - ctx->offset += size; - /* OK - everything went well... but we have more. - keep the lock here! */ - return LWM2M_STATUS_OK; - } else { - LOG_WARN("*** ERROR Overflow?\n"); - return LWM2M_STATUS_ERROR; - } - } - } - } - instance = next_object_instance(ctx, object, instance); - if(instance != NULL) { - last_instance_id = - ((uint32_t)instance->object_id << 16) | instance->instance_id; - } else { - last_instance_id = NO_INSTANCE; - } - if(ctx->operation == LWM2M_OP_READ) { - LOG_DBG("END Writer %d ->", ctx->outbuf->len); - len = ctx->writer->end_write(ctx); - ctx->outbuf->len += len; - LOG_DBG("%d\n", ctx->outbuf->len); - } - - initialized = 0; - last_rsc_pos = 0; - } - - /* did not read anything even if we should have - on single item */ - if(num_read == 0 && ctx->level == 3) { - lwm2m_buf_lock[0] = 0; - return LWM2M_STATUS_NOT_FOUND; - } - - /* seems like we are done! - flush buffer */ - len = double_buffer_flush(ctx->outbuf, outbuf, size); - ctx->outbuf = outbuf; - ctx->offset += len; - - /* If there is still data in the double-buffer - indicate that so that we get another - callback */ - if(lwm2m_buf.len > 0) { - ctx->writer_flags |= WRITER_HAS_MORE; - } else { - /* OK - everything went well we are done, unlock and return */ - lwm2m_buf_lock[0] = 0; - } - - LOG_DBG("At END: Copied lwm2m buf %d\n", len); - - return LWM2M_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -create_instance(lwm2m_context_t *context, lwm2m_object_t *object) -{ - lwm2m_object_instance_t *instance; - if(object == NULL || object->impl == NULL || - object->impl->create_instance == NULL) { - return NULL; - } - - /* NOTE: context->object_instance_id needs to be set before calling */ - instance = object->impl->create_instance(context->object_instance_id, NULL); - if(instance != NULL) { - LOG_DBG("Created instance: %u/%u\n", context->object_id, context->object_instance_id); - coap_set_status_code(context->response, CREATED_2_01); -#if USE_RD_CLIENT - lwm2m_rd_client_set_update_rd(); -#endif - } - return instance; -} -/*---------------------------------------------------------------------------*/ -#define MODE_NONE 0 -#define MODE_INSTANCE 1 -#define MODE_VALUE 2 -#define MODE_READY 3 - -static lwm2m_object_instance_t * -get_or_create_instance(lwm2m_context_t *ctx, lwm2m_object_t *object, - uint16_t *c) -{ - lwm2m_object_instance_t *instance; - - instance = get_instance_by_context(ctx, NULL); - LOG_DBG("Instance: %u/%u/%u = %p\n", ctx->object_id, - ctx->object_instance_id, ctx->resource_id, instance); - /* by default we assume that the instance is not created... so we set flag to zero */ - if(c != NULL) { - *c = LWM2M_OBJECT_INSTANCE_NONE; - } - if(instance == NULL) { - instance = create_instance(ctx, object); - if(instance != NULL) { - if(c != NULL) { - *c = instance->instance_id; - } - created.instance_id = instance->instance_id; - created.object_id = instance->object_id; - created.token_len = MIN(COAP_TOKEN_LEN, ctx->request->token_len); - memcpy(&created.token, ctx->request->token, created.token_len); - } - } - return instance; -} -/*---------------------------------------------------------------------------*/ -static int -check_write(lwm2m_context_t *ctx, lwm2m_object_instance_t *instance, int rid) -{ - int i; - if(instance->resource_ids != NULL && instance->resource_count > 0) { - int count = instance->resource_count; - for(i = 0; i < count; i++) { - if(RSC_ID(instance->resource_ids[i]) == rid) { - if(RSC_WRITABLE(instance->resource_ids[i])) { - /* yes - writable */ - return 1; - } - if(RSC_UNSPECIFIED(instance->resource_ids[i]) && - created.instance_id == instance->instance_id && - created.object_id == instance->object_id && - created.token_len == ctx->request->token_len && - memcmp(&created.token, ctx->request->token, - created.token_len) == 0) { - /* yes - writeable at create - never otherwise - sec / srv */ - return 1; - } - break; - } - } - } - /* Resource did not exist... - Ignore to avoid problems. */ - if(created.instance_id == instance->instance_id && - created.object_id == instance->object_id && - created.token_len == ctx->request->token_len && - memcmp(&created.token, ctx->request->token, - created.token_len) == 0) { - LOG_DBG("Ignoring resource %u/%u/%d in newly created instance\n", - created.object_id, created.instance_id, rid); - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -process_tlv_write(lwm2m_context_t *ctx, lwm2m_object_t *object, - int rid, uint8_t *data, int len) -{ - lwm2m_object_instance_t *instance; - uint16_t created = LWM2M_OBJECT_INSTANCE_NONE; - ctx->inbuf->buffer = data; - ctx->inbuf->pos = 0; - ctx->inbuf->size = len; - ctx->level = 3; - ctx->resource_id = rid; - LOG_DBG(" Doing callback to %u/%u/%u\n", ctx->object_id, - ctx->object_instance_id, ctx->resource_id); - instance = get_or_create_instance(ctx, object, &created); - if(instance != NULL && instance->callback != NULL) { - if(check_write(ctx, instance, rid)) { - return instance->callback(instance, ctx); - } else { - return LWM2M_STATUS_OPERATION_NOT_ALLOWED; - } - } - return LWM2M_STATUS_ERROR; -} -/*---------------------------------------------------------------------------*/ -static int last_tlv_id = 0; - -static lwm2m_status_t -perform_multi_resource_write_op(lwm2m_object_t *object, - lwm2m_object_instance_t *instance, - lwm2m_context_t *ctx, int format) -{ - /* Only for JSON and TLV formats */ - uint16_t oid = 0, iid = 0, rid = 0; - uint8_t olv = 0; - uint8_t mode = 0; - uint8_t *inbuf; - int inpos; - size_t insize; - int i; - uint16_t created = LWM2M_OBJECT_INSTANCE_NONE; - - olv = ctx->level; - inbuf = ctx->inbuf->buffer; - inpos = ctx->inbuf->pos; - insize = ctx->inbuf->size; - - if(format == LWM2M_JSON || format == LWM2M_OLD_JSON) { - struct json_data json; - - while(lwm2m_json_next_token(ctx, &json)) { - LOG_DBG("JSON: '"); - for(i = 0; i < json.name_len; i++) { - LOG_DBG_("%c", json.name[i]); - } - LOG_DBG_("':'"); - for(i = 0; i < json.value_len; i++) { - LOG_DBG_("%c", json.value[i]); - } - LOG_DBG_("'\n"); - - if(json.name[0] == 'n') { - i = parse_path((const char *) json.value, json.value_len, &oid, &iid, &rid); - if(i > 0) { - if(ctx->level == 1) { - ctx->level = 3; - ctx->object_instance_id = oid; - ctx->resource_id = iid; - - instance = get_or_create_instance(ctx, object, &created); - } - if(instance != NULL && instance->callback != NULL) { - mode |= MODE_INSTANCE; - } else { - /* Failure... */ - return LWM2M_STATUS_ERROR; - } - } - } else { - /* HACK - assume value node - can it be anything else? */ - mode |= MODE_VALUE; - /* update values */ - inbuf = ctx->inbuf->buffer; - inpos = ctx->inbuf->pos; - - ctx->inbuf->buffer = json.value; - ctx->inbuf->pos = 0; - ctx->inbuf->size = json.value_len; - } - - if(mode == MODE_READY) { - /* allow write if just created - otherwise not */ - if(!check_write(ctx, instance, ctx->resource_id)) { - return LWM2M_STATUS_OPERATION_NOT_ALLOWED; - } - if(instance->callback(instance, ctx) != LWM2M_STATUS_OK) { - /* TODO what to do here */ - } - mode = MODE_NONE; - ctx->inbuf->buffer = inbuf; - ctx->inbuf->pos = inpos; - ctx->inbuf->size = insize; - ctx->level = olv; - } - } - } else if(format == LWM2M_TLV || format == LWM2M_OLD_TLV) { - size_t len; - lwm2m_tlv_t tlv; - int tlvpos = 0; - lwm2m_status_t status; - - /* For handling blockwise (BLOCK1) write */ - uint32_t num; - uint8_t more; - uint16_t size; - uint32_t offset; - - /* NOTE: this assumes that a BLOCK1 non-first block is not a part of a - small TLV but rather a large opaque - this needs to be fixed in the - future */ - - if(coap_get_header_block1(ctx->request, &num, &more, &size, &offset)) { - LOG_DBG("CoAP BLOCK1: %"PRIu32"/%d/%d offset:%"PRIu32 - " LWM2M CTX->offset=%"PRIu32"\n", - num, more, size, offset, ctx->offset); - LOG_DBG("Last TLV ID:%d final:%d\n", last_tlv_id, - lwm2m_object_is_final_incoming(ctx)); - if(offset > 0) { - status = process_tlv_write(ctx, object, last_tlv_id, - inbuf, size); - return status; - } - } - - while(tlvpos < insize) { - len = lwm2m_tlv_read(&tlv, &inbuf[tlvpos], insize - tlvpos); - LOG_DBG("Got TLV format First is: type:%d id:%d len:%d (p:%d len:%d/%d)\n", - tlv.type, tlv.id, (int) tlv.length, - (int) tlvpos, (int) len, (int) insize); - if(tlv.type == LWM2M_TLV_TYPE_OBJECT_INSTANCE) { - lwm2m_tlv_t tlv2; - int len2; - int pos = 0; - ctx->object_instance_id = tlv.id; - if(tlv.length == 0) { - /* Create only - no data */ - if((instance = create_instance(ctx, object)) == NULL) { - return LWM2M_STATUS_ERROR; - } - } - while(pos < tlv.length && (len2 = lwm2m_tlv_read(&tlv2, &tlv.value[pos], - tlv.length - pos))) { - LOG_DBG(" TLV type:%d id:%d len:%d (len:%d/%d)\n", - tlv2.type, tlv2.id, (int)tlv2.length, - (int)len2, (int)insize); - if(tlv2.type == LWM2M_TLV_TYPE_RESOURCE) { - last_tlv_id = tlv2.id; - status = process_tlv_write(ctx, object, tlv2.id, - (uint8_t *)&tlv.value[pos], len2); - if(status != LWM2M_STATUS_OK) { - return status; - } - } - pos += len2; - } - } else if(tlv.type == LWM2M_TLV_TYPE_RESOURCE) { - status = process_tlv_write(ctx, object, tlv.id, &inbuf[tlvpos], len); - if(status != LWM2M_STATUS_OK) { - return status; - } - coap_set_status_code(ctx->response, CHANGED_2_04); - } - tlvpos += len; - } - } else if(format == LWM2M_TEXT_PLAIN || - format == TEXT_PLAIN || - format == LWM2M_OLD_OPAQUE) { - return call_instance(instance, ctx); - - } else { - /* Unsupported format */ - return LWM2M_STATUS_UNSUPPORTED_CONTENT_FORMAT; - } - - /* Here we have a success! */ - return LWM2M_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -lwm2m_object_instance_t * -lwm2m_engine_get_instance_buffer(void) -{ - return &instance_buffer; -} -/*---------------------------------------------------------------------------*/ -int -lwm2m_engine_has_instance(uint16_t object_id, uint16_t instance_id) -{ - return get_instance(object_id, instance_id, NULL) != NULL; -} -/*---------------------------------------------------------------------------*/ -int -lwm2m_engine_add_object(lwm2m_object_instance_t *object) -{ - lwm2m_object_instance_t *instance; - uint16_t min_id = 0xffff; - uint16_t max_id = 0; - int found = 0; - - if(object == NULL || object->callback == NULL) { - /* Insufficient object configuration */ - LOG_DBG("failed to register NULL object\n"); - return 0; - } - if(get_object(object->object_id) != NULL) { - /* A generic object with this id has already been registered */ - LOG_DBG("object with id %u already registered\n", object->object_id); - return 0; - } - - for(instance = list_head(object_list); - instance != NULL; - instance = instance->next) { - if(object->object_id == instance->object_id) { - if(object->instance_id == instance->instance_id) { - LOG_DBG("object with id %u/%u already registered\n", - instance->object_id, instance->instance_id); - return 0; - } - - found++; - if(instance->instance_id > max_id) { - max_id = instance->instance_id; - } - if(instance->instance_id < min_id) { - min_id = instance->instance_id; - } - } - } - - if(object->instance_id == LWM2M_OBJECT_INSTANCE_NONE) { - /* No instance id has been assigned yet */ - if(found == 0) { - /* First object with this id */ - object->instance_id = 0; - } else if(min_id > 0) { - object->instance_id = min_id - 1; - } else { - object->instance_id = max_id + 1; - } - } - list_add(object_list, object); -#if USE_RD_CLIENT - lwm2m_rd_client_set_update_rd(); -#endif - return 1; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_engine_remove_object(lwm2m_object_instance_t *object) -{ - list_remove(object_list, object); -#if USE_RD_CLIENT - lwm2m_rd_client_set_update_rd(); -#endif -} -/*---------------------------------------------------------------------------*/ -int -lwm2m_engine_add_generic_object(lwm2m_object_t *object) -{ - if(object == NULL || object->impl == NULL - || object->impl->get_first == NULL - || object->impl->get_next == NULL - || object->impl->get_by_id == NULL) { - LOG_WARN("failed to register NULL object\n"); - return 0; - } - if(get_object(object->impl->object_id) != NULL) { - /* A generic object with this id has already been registered */ - LOG_WARN("object with id %u already registered\n", - object->impl->object_id); - return 0; - } - if(has_non_generic_object(object->impl->object_id)) { - /* An object with this id has already been registered */ - LOG_WARN("object with id %u already registered\n", - object->impl->object_id); - return 0; - } - list_add(generic_object_list, object); - -#if USE_RD_CLIENT - lwm2m_rd_client_set_update_rd(); -#endif - - return 1; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_engine_remove_generic_object(lwm2m_object_t *object) -{ - list_remove(generic_object_list, object); -#if USE_RD_CLIENT - lwm2m_rd_client_set_update_rd(); -#endif -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -next_object_instance(const lwm2m_context_t *context, lwm2m_object_t *object, - lwm2m_object_instance_t *last) -{ - if(context != NULL && context->level >= 2) { - /* Only single instance */ - return NULL; - } - - /* There has to be a last to get a next */ - if(last == NULL) { - return NULL; - } - - if(object == NULL) { - for(last = last->next; last != NULL; last = last->next) { - /* if no context is given - this will just give the next object */ - if(context == NULL || last->object_id == context->object_id) { - return last; - } - } - return NULL; - } - return object->impl->get_next(last, NULL); -} -/*---------------------------------------------------------------------------*/ -static coap_handler_status_t -lwm2m_handler_callback(coap_message_t *request, coap_message_t *response, - uint8_t *buffer, uint16_t buffer_size, int32_t *offset) -{ - const char *url; - int url_len; - unsigned int format; - unsigned int accept; - int depth; - lwm2m_context_t context; - lwm2m_object_t *object; - lwm2m_object_instance_t *instance; - uint32_t bnum; - uint8_t bmore; - uint16_t bsize; - uint32_t boffset; - lwm2m_status_t success; - lwm2m_buffer_t inbuf; - lwm2m_buffer_t outbuf; - - /* Initialize the context */ - memset(&context, 0, sizeof(context)); - memset(&outbuf, 0, sizeof(outbuf)); - memset(&inbuf, 0, sizeof(inbuf)); - - context.outbuf = &outbuf; - context.inbuf = &inbuf; - - /* Set CoAP request/response for now */ - context.request = request; - context.response = response; - - /* Set out buffer */ - context.outbuf->buffer = buffer; - context.outbuf->size = buffer_size; - - /* Set input buffer */ - if(offset != NULL) { - context.offset = *offset; - } - context.inbuf->size = coap_get_payload(request, (const uint8_t **)&context.inbuf->buffer); - context.inbuf->pos = 0; - -#if LWM2M_QUEUE_MODE_ENABLED -lwm2m_queue_mode_request_received(); -#endif /* LWM2M_QUEUE_MODE_ENABLED */ - - /* Maybe this should be part of CoAP itself - this seems not to be working - with the leshan server */ -#define LWM2M_CONF_ENTITY_TOO_LARGE_BLOCK1 0 -#if LWM2M_CONF_ENTITY_TOO_LARGE_BLOCK1 - if(coap_is_option(request, COAP_OPTION_BLOCK1)) { - uint16_t bsize; - coap_get_header_block1(request, NULL, NULL, &bsize, NULL); - - LOG_DBG("Block1 size:%d\n", bsize); - if(bsize > COAP_MAX_BLOCK_SIZE) { - LOG_WARN("Entity too large: %u...\n", bsize); - coap_set_status_code(response, REQUEST_ENTITY_TOO_LARGE_4_13); - coap_set_header_size1(response, COAP_MAX_BLOCK_SIZE); - return COAP_HANDLER_STATUS_PROCESSED; - } - } -#endif - - /* Set default reader/writer */ - context.reader = &lwm2m_plain_text_reader; - context.writer = &lwm2m_tlv_writer; - - - url_len = coap_get_header_uri_path(request, &url); - - if(url_len == 2 && strncmp("bs", url, 2) == 0) { - LOG_INFO("BOOTSTRAPPED!!!\n"); - coap_set_status_code(response, CHANGED_2_04); - return COAP_HANDLER_STATUS_PROCESSED; - } - - depth = lwm2m_engine_parse_context(url, url_len, request, response, - buffer, buffer_size, &context); - if(depth < 0) { - /* Not a LWM2M context */ - return COAP_HANDLER_STATUS_CONTINUE; - } - - LOG_DBG("%s URL:'", get_method_as_string(coap_get_method_type(request))); - LOG_DBG_COAP_STRING(url, url_len); - LOG_DBG_("' CTX:%u/%u/%u dp:%u bs:%d\n", context.object_id, context.object_instance_id, - context.resource_id, depth, buffer_size); - /* Get format and accept */ - if(!coap_get_header_content_format(request, &format)) { - LOG_DBG("No format given. Assume text plain...\n"); - format = TEXT_PLAIN; - } else if(format == LWM2M_TEXT_PLAIN) { - /* CoAP content format text plain - assume LWM2M text plain */ - format = TEXT_PLAIN; - } - if(!coap_get_header_accept(request, &accept)) { - if(format == TEXT_PLAIN && depth < 3) { - LOG_DBG("No Accept header, assume JSON\n"); - accept = LWM2M_JSON; - } else { - LOG_DBG("No Accept header, using same as content-format: %d\n", format); - accept = format; - } - } - - /* - * 1 => Object only - * 2 => Object and Instance - * 3 => Object and Instance and Resource - */ - if(depth < 1) { - /* No possible object id found in URL - ignore request unless delete all */ - if(coap_get_method_type(request) == METHOD_DELETE) { - LOG_DBG("This is a delete all - for bootstrap...\n"); - context.operation = LWM2M_OP_DELETE; - coap_set_status_code(response, DELETED_2_02); - - /* Delete all dynamic objects that can be deleted */ - for(object = list_head(generic_object_list); - object != NULL; - object = object->next) { - if(object->impl != NULL && object->impl->delete_instance != NULL) { - object->impl->delete_instance(LWM2M_OBJECT_INSTANCE_NONE, NULL); - } - } -#if USE_RD_CLIENT - lwm2m_rd_client_set_update_rd(); -#endif - return COAP_HANDLER_STATUS_PROCESSED; - } - return COAP_HANDLER_STATUS_CONTINUE; - } - - instance = get_instance_by_context(&context, &object); - - /* - * Check if we found either instance or object. Instance means we found an - * existing instance and generic objects means we might create an instance. - */ - if(instance == NULL && object == NULL) { - /* No matching object/instance found - ignore request */ - return COAP_HANDLER_STATUS_CONTINUE; - } - - LOG_INFO("Context: %u/%u/%u found: %d\n", - context.object_id, context.object_instance_id, - context.resource_id, depth); - - /* - * Select reader and writer based on provided Content type and - * Accept headers. - */ - lwm2m_engine_select_reader(&context, format); - lwm2m_engine_select_writer(&context, accept); - - switch(coap_get_method_type(request)) { - case METHOD_PUT: - /* can also be write atts */ - context.operation = LWM2M_OP_WRITE; - coap_set_status_code(response, CHANGED_2_04); - break; - case METHOD_POST: - if(context.level < 2) { - /* write to a instance */ - context.operation = LWM2M_OP_WRITE; - coap_set_status_code(response, CHANGED_2_04); - } else if(context.level == 3) { - context.operation = LWM2M_OP_EXECUTE; - coap_set_status_code(response, CHANGED_2_04); - } - break; - case METHOD_GET: - if(accept == APPLICATION_LINK_FORMAT) { - context.operation = LWM2M_OP_DISCOVER; - } else { - context.operation = LWM2M_OP_READ; - } - coap_set_status_code(response, CONTENT_2_05); - break; - case METHOD_DELETE: - context.operation = LWM2M_OP_DELETE; - coap_set_status_code(response, DELETED_2_02); - break; - default: - break; - } - - if(LOG_DBG_ENABLED) { - /* for debugging */ - LOG_DBG("["); - LOG_DBG_COAP_STRING(url, url_len); - LOG_DBG_("] %s Format:%d ID:%d bsize:%u offset:%"PRId32"\n", - get_method_as_string(coap_get_method_type(request)), - format, context.object_id, buffer_size, - offset != NULL ? *offset : 0); - if(format == TEXT_PLAIN) { - /* a string */ - const uint8_t *data; - int plen = coap_get_payload(request, &data); - if(plen > 0) { - LOG_DBG("Data: '"); - LOG_DBG_COAP_STRING((const char *)data, plen); - LOG_DBG_("'\n"); - } - } - } - - /* PUT/POST - e.g. write will not send in offset here - Maybe in the future? */ - if((offset != NULL && *offset == 0) && - coap_is_option(request, COAP_OPTION_BLOCK1)) { - coap_get_header_block1(request, &bnum, &bmore, &bsize, &boffset); - context.offset = boffset; - } - - /* This is a discovery operation */ - switch(context.operation) { - case LWM2M_OP_DISCOVER: - /* Assume only one disco at a time... */ - success = perform_multi_resource_read_op(object, instance, &context); - break; - case LWM2M_OP_READ: - success = perform_multi_resource_read_op(object, instance, &context); - break; - case LWM2M_OP_WRITE: - success = perform_multi_resource_write_op(object, instance, &context, format); - break; - case LWM2M_OP_EXECUTE: - success = call_instance(instance, &context); - break; - case LWM2M_OP_DELETE: - if(object != NULL && object->impl != NULL && - object->impl->delete_instance != NULL) { - object->impl->delete_instance(context.object_instance_id, &success); -#if USE_RD_CLIENT - lwm2m_rd_client_set_update_rd(); -#endif - } else { - success = LWM2M_STATUS_OPERATION_NOT_ALLOWED; - } - break; - default: - success = LWM2M_STATUS_OPERATION_NOT_ALLOWED; - break; - } - - if(success == LWM2M_STATUS_OK) { - /* Handle blockwise 1 */ - if(coap_is_option(request, COAP_OPTION_BLOCK1)) { - LOG_DBG("Setting BLOCK 1 num:%"PRIu32" o2:%"PRIu32" o:%"PRId32"\n", bnum, boffset, - (offset != NULL ? *offset : 0)); - coap_set_header_block1(response, bnum, 0, bsize); - } - - if(context.outbuf->len > 0) { - LOG_DBG("["); - LOG_DBG_COAP_STRING(url, url_len); - LOG_DBG_("] replying with %u bytes\n", context.outbuf->len); - coap_set_payload(response, context.outbuf->buffer, context.outbuf->len); - coap_set_header_content_format(response, context.content_type); - - if(offset != NULL) { - LOG_DBG("Setting new offset: oo %"PRIu32 - ", no: %"PRIu32"\n", *offset, context.offset); - if(context.writer_flags & WRITER_HAS_MORE) { - *offset = context.offset; - } else { - /* this signals to CoAP that there is no more CoAP messages to expect */ - *offset = -1; - } - } - } else { - LOG_DBG("["); - LOG_DBG_COAP_STRING(url, url_len); - LOG_DBG_("] no data in reply\n"); - } - } else { - switch(success) { - case LWM2M_STATUS_FORBIDDEN: - coap_set_status_code(response, FORBIDDEN_4_03); - break; - case LWM2M_STATUS_NOT_FOUND: - coap_set_status_code(response, NOT_FOUND_4_04); - break; - case LWM2M_STATUS_OPERATION_NOT_ALLOWED: - coap_set_status_code(response, METHOD_NOT_ALLOWED_4_05); - break; - case LWM2M_STATUS_NOT_ACCEPTABLE: - coap_set_status_code(response, NOT_ACCEPTABLE_4_06); - break; - case LWM2M_STATUS_UNSUPPORTED_CONTENT_FORMAT: - coap_set_status_code(response, UNSUPPORTED_MEDIA_TYPE_4_15); - break; - default: - /* Failed to handle the request */ - coap_set_status_code(response, INTERNAL_SERVER_ERROR_5_00); - break; - } - LOG_WARN("["); - LOG_WARN_COAP_STRING(url, url_len); - LOG_WARN("] resource failed: %s\n", get_status_as_string(success)); - } - return COAP_HANDLER_STATUS_PROCESSED; -} -/*---------------------------------------------------------------------------*/ -static void -lwm2m_send_notification(char* path) -{ -#if LWM2M_QUEUE_MODE_ENABLED && LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION - if(lwm2m_queue_mode_get_dynamic_adaptation_flag()) { - lwm2m_queue_mode_set_handler_from_notification(); - } -#endif - coap_notify_observers_sub(NULL, path); -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_notify_object_observers(lwm2m_object_instance_t *obj, - uint16_t resource) -{ - char path[20]; /* 60000/60000/60000 */ - if(obj != NULL) { - snprintf(path, 20, "%d/%d/%d", obj->object_id, obj->instance_id, resource); - } - -#if LWM2M_QUEUE_MODE_ENABLED - - if(coap_has_observers(path)) { - /* Client is sleeping -> add the notification to the list */ - if(!lwm2m_rd_client_is_client_awake()) { - lwm2m_notification_queue_add_notification_path(obj->object_id, obj->instance_id, resource); - - /* if it is the first notification -> wake up and send update */ - if(!lwm2m_queue_mode_is_waked_up_by_notification()) { - lwm2m_queue_mode_set_waked_up_by_notification(); - lwm2m_rd_client_fsm_execute_queue_mode_update(); - } - /* Client is awake -> send the notification */ - } else { - lwm2m_send_notification(path); - } - } -#else - lwm2m_send_notification(path); -#endif -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-engine.h b/os/services/lwm2m/lwm2m-engine.h deleted file mode 100644 index 0ca24fb90..000000000 --- a/os/services/lwm2m/lwm2m-engine.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Header file for the Contiki OMA LWM2M engine - * \author - * Joakim Eriksson - * Niclas Finne - * Carlos Gonzalo Peces - */ - -#ifndef LWM2M_ENGINE_H -#define LWM2M_ENGINE_H - -#include "lwm2m-object.h" -#include "lwm2m-queue-mode-conf.h" - -#define LWM2M_FLOAT32_BITS 10 -#define LWM2M_FLOAT32_FRAC (1L << LWM2M_FLOAT32_BITS) - -/* LWM2M / CoAP Content-Formats */ -typedef enum { - LWM2M_TEXT_PLAIN = 1541, - LWM2M_TLV = 11542, - LWM2M_JSON = 11543, - LWM2M_OLD_TLV = 1542, - LWM2M_OLD_JSON = 1543, - LWM2M_OLD_OPAQUE = 1544 -} lwm2m_content_format_t; - -void lwm2m_engine_init(void); - -int lwm2m_engine_set_rd_data(lwm2m_buffer_t *outbuf, int block); - -typedef lwm2m_status_t -(* lwm2m_object_instance_callback_t)(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx); -typedef int -(* lwm2m_resource_dim_callback_t)(lwm2m_object_instance_t *object, - uint16_t resource_id); - -#define LWM2M_OBJECT_INSTANCE_NONE 0xffff - -struct lwm2m_object_instance { - lwm2m_object_instance_t *next; - uint16_t object_id; - uint16_t instance_id; - /* an array of resource IDs for discovery, etc */ - const lwm2m_resource_id_t *resource_ids; - uint16_t resource_count; - /* the callback for requests */ - lwm2m_object_instance_callback_t callback; - lwm2m_resource_dim_callback_t resource_dim_callback; -}; - -typedef struct { - uint16_t object_id; - lwm2m_object_instance_t *(* create_instance)(uint16_t instance_id, - lwm2m_status_t *status); - int (* delete_instance)(uint16_t instance_id, lwm2m_status_t *status); - lwm2m_object_instance_t *(* get_first)(lwm2m_status_t *status); - lwm2m_object_instance_t *(* get_next)(lwm2m_object_instance_t *instance, - lwm2m_status_t *status); - lwm2m_object_instance_t *(* get_by_id)(uint16_t instance_id, - lwm2m_status_t *status); -} lwm2m_object_impl_t; - -typedef struct lwm2m_object lwm2m_object_t; -struct lwm2m_object { - lwm2m_object_t *next; - const lwm2m_object_impl_t *impl; -}; - -lwm2m_object_instance_t *lwm2m_engine_get_instance_buffer(void); - -int lwm2m_engine_has_instance(uint16_t object_id, uint16_t instance_id); -int lwm2m_engine_add_object(lwm2m_object_instance_t *object); -void lwm2m_engine_remove_object(lwm2m_object_instance_t *object); -int lwm2m_engine_add_generic_object(lwm2m_object_t *object); -void lwm2m_engine_remove_generic_object(lwm2m_object_t *object); -void lwm2m_notify_object_observers(lwm2m_object_instance_t *obj, - uint16_t resource); - -void lwm2m_engine_set_opaque_callback(lwm2m_context_t *ctx, lwm2m_write_opaque_callback cb); - -#endif /* LWM2M_ENGINE_H */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-firmware.c b/os/services/lwm2m/lwm2m-firmware.c deleted file mode 100644 index 87815d684..000000000 --- a/os/services/lwm2m/lwm2m-firmware.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2016, SICS Swedish ICT AB - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - * - * Code for firmware object of lwm2m - * - */ - -#include "lwm2m-engine.h" -#include "lwm2m-firmware.h" -#include "coap.h" -#include -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-fw" -#define LOG_LEVEL LOG_LEVEL_LWM2M - -#define UPDATE_PACKAGE 0 -#define UPDATE_PACKAGE_URI 1 -#define UPDATE_UPDATE 2 -#define UPDATE_STATE 3 -#define UPDATE_RESULT 5 - -#define STATE_IDLE 1 -#define STATE_DOWNLOADING 2 -#define STATE_DOWNLOADED 3 - -#define RESULT_DEFAULT 0 -#define RESULT_SUCCESS 1 -#define RESULT_NO_STORAGE 2 -#define RESULT_OUT_OF_MEM 3 -#define RESULT_CONNECTION_LOST 4 -#define RESULT_CRC_FAILED 5 -#define RESULT_UNSUPPORTED_FW 6 -#define RESULT_INVALID_URI 7 - - -static uint8_t state = STATE_IDLE; -static uint8_t result = RESULT_DEFAULT; - -static lwm2m_object_instance_t reg_object; - -static const lwm2m_resource_id_t resources[] = - { WO(UPDATE_PACKAGE), - WO(UPDATE_PACKAGE_URI), - RO(UPDATE_STATE), - RO(UPDATE_RESULT), - EX(UPDATE_UPDATE) - }; - -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -lwm2m_callback(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx) -{ - uint32_t num; - uint8_t more; - uint16_t size; - uint32_t offset; - - LOG_DBG("Got request at: %d/%d/%d lv:%d\n", ctx->object_id, - ctx->object_instance_id, ctx->resource_id, ctx->level); - - if(ctx->level == 1 || ctx->level == 2) { - /* Should not happen - as it will be taken care of by the lwm2m engine itself. */ - return LWM2M_STATUS_ERROR; - } - - if(ctx->operation == LWM2M_OP_READ) { - switch(ctx->resource_id) { - case UPDATE_STATE: - lwm2m_object_write_int(ctx, state); /* 1 means idle */ - return LWM2M_STATUS_OK; - case UPDATE_RESULT: - lwm2m_object_write_int(ctx, result); /* 0 means default */ - return LWM2M_STATUS_OK; - } - } else if(ctx->operation == LWM2M_OP_WRITE) { - - if(LOG_DBG_ENABLED) { - if(coap_get_header_block1(ctx->request, &num, &more, &size, &offset)) { - LOG_DBG("CoAP BLOCK1: %"PRIu32"/%u/%u offset:%"PRIu32 - " LWM2M CTX->offset=%"PRIu32"\n", - num, more, size, offset, ctx->offset); - } - } - - switch(ctx->resource_id) { - case UPDATE_PACKAGE: - /* The firmware is written */ - LOG_DBG("Firmware received: %"PRIu32" %d fin:%d\n", ctx->offset, - (int)ctx->inbuf->size, lwm2m_object_is_final_incoming(ctx)); - if(lwm2m_object_is_final_incoming(ctx)) { - state = STATE_DOWNLOADED; - } else { - state = STATE_DOWNLOADING; - } - return LWM2M_STATUS_OK; - case UPDATE_PACKAGE_URI: - /* The firmware URI is written */ - LOG_DBG("Firmware URI received: %"PRIu32" %d fin:%d\n", ctx->offset, - (int)ctx->inbuf->size, lwm2m_object_is_final_incoming(ctx)); - if(LOG_DBG_ENABLED) { - int i; - LOG_DBG("Data: '"); - for(i = 0; i < ctx->inbuf->size; i++) { - LOG_DBG_("%c", ctx->inbuf->buffer[i]); - } - LOG_DBG_("'\n"); - } - return LWM2M_STATUS_OK; - } - } else if(ctx->operation == LWM2M_OP_EXECUTE && ctx->resource_id == UPDATE_UPDATE) { - /* Perform the update operation */ - if(state == STATE_DOWNLOADED) { - return LWM2M_STATUS_OK; - } - /* Failure... */ - } - return LWM2M_STATUS_ERROR; -} - -/*---------------------------------------------------------------------------*/ -void -lwm2m_firmware_init(void) -{ - reg_object.object_id = 5; - reg_object.instance_id = 0; - reg_object.callback = lwm2m_callback; - reg_object.resource_ids = resources; - reg_object.resource_count = sizeof(resources) / sizeof(lwm2m_resource_id_t); - - lwm2m_engine_add_object(®_object); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-firmware.h b/os/services/lwm2m/lwm2m-firmware.h deleted file mode 100644 index 2b83922cd..000000000 --- a/os/services/lwm2m/lwm2m-firmware.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, SICS Swedish ICT AB - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - * - * Code for firmware object of lwm2m - * - */ - -#ifndef LWM2M_FIRMWARE_H_ -#define LWM2M_FIRMWARE_H_ - -void lwm2m_firmware_init(void); - -#endif /* LWM2M_FIRMWARE_H_ */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-json.c b/os/services/lwm2m/lwm2m-json.c deleted file mode 100644 index 8ad8be9c4..000000000 --- a/os/services/lwm2m/lwm2m-json.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright (c) 2016, Eistec AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M JSON writer - * \author - * Joakim NohlgÃ¥rd - * Joakim Eriksson added JSON reader parts - */ - -#include "lwm2m-object.h" -#include "lwm2m-json.h" -#include "lwm2m-plain-text.h" -#include -#include -#include -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-json" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ - -/* {"e":[{"n":"111/1","v":123},{"n":"111/2","v":42}]} */ - -/* Begin String */ -#define T_NONE 0 -#define T_STRING_B 1 -#define T_STRING 2 -#define T_NAME 4 -#define T_VNUM 5 -#define T_OBJ 6 -#define T_VAL 7 - -/* Simlified JSON style reader for reading in values from a LWM2M JSON - string */ -int -lwm2m_json_next_token(lwm2m_context_t *ctx, struct json_data *json) -{ - int pos = ctx->inbuf->pos; - uint8_t type = T_NONE; - uint8_t vpos_start = 0; - uint8_t vpos_end = 0; - uint8_t cont; - uint8_t wscount = 0; - - json->name_len = 0; - json->value_len = 0; - - cont = 1; - /* We will be either at start, or at a specific position */ - while(pos < ctx->inbuf->size && cont) { - uint8_t c = ctx->inbuf->buffer[pos++]; - switch(c) { - case '{': type = T_OBJ; break; - case '}': - case ',': - if(type == T_VAL || type == T_STRING) { - json->value = &ctx->inbuf->buffer[vpos_start]; - json->value_len = vpos_end - vpos_start - wscount; - type = T_NONE; - cont = 0; - } - wscount = 0; - break; - case '\\': - /* stuffing */ - if(pos < ctx->inbuf->size) { - pos++; - vpos_end = pos; - } - break; - case '"': - if(type == T_STRING_B) { - type = T_STRING; - vpos_end = pos - 1; - wscount = 0; - } else { - type = T_STRING_B; - vpos_start = pos; - } - break; - case ':': - if(type == T_STRING) { - json->name = &ctx->inbuf->buffer[vpos_start]; - json->name_len = vpos_end - vpos_start; - vpos_start = vpos_end = pos; - type = T_VAL; - } else { - /* Could be in string or at illegal pos */ - if(type != T_STRING_B) { - LOG_DBG("ERROR - illegal ':'\n"); - } - } - break; - /* ignore whitespace */ - case ' ': - case '\n': - case '\t': - if(type != T_STRING_B) { - if(vpos_start == pos - 1) { - vpos_start = pos; - } else { - wscount++; - } - } - default: - vpos_end = pos; - } - } - - if(cont == 0 && pos < ctx->inbuf->size) { - ctx->inbuf->pos = pos; - } - /* OK if cont == 0 othewise we failed */ - return cont == 0 && pos < ctx->inbuf->size; -} -/*---------------------------------------------------------------------------*/ -static size_t -init_write(lwm2m_context_t *ctx) -{ - int len = snprintf((char *)&ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, "{\"bn\":\"/%u/%u/\",\"e\":[", - ctx->object_id, ctx->object_instance_id); - ctx->writer_flags = 0; /* set flags to zero */ - if((len < 0) || (len >= ctx->outbuf->size)) { - return 0; - } - return len; -} -/*---------------------------------------------------------------------------*/ -static size_t -end_write(lwm2m_context_t *ctx) -{ - int len = snprintf((char *)&ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, "]}"); - if((len < 0) || (len >= ctx->outbuf->size - ctx->outbuf->len)) { - return 0; - } - return len; -} -/*---------------------------------------------------------------------------*/ -static size_t -enter_sub(lwm2m_context_t *ctx) -{ - /* set some flags in state */ - LOG_DBG("Enter sub-resource rsc=%d\n", ctx->resource_id); - ctx->writer_flags |= WRITER_RESOURCE_INSTANCE; - return 0; -} -/*---------------------------------------------------------------------------*/ -static size_t -exit_sub(lwm2m_context_t *ctx) -{ - /* clear out state info */ - LOG_DBG("Exit sub-resource rsc=%d\n", ctx->resource_id); - ctx->writer_flags &= ~WRITER_RESOURCE_INSTANCE; - return 0; -} -/*---------------------------------------------------------------------------*/ -static size_t -write_boolean(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - int value) -{ - char *sep = (ctx->writer_flags & WRITER_OUTPUT_VALUE) ? "," : ""; - int len; - if(ctx->writer_flags & WRITER_RESOURCE_INSTANCE) { - len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u/%u\",\"bv\":%s}", sep, ctx->resource_id, ctx->resource_instance_id, value ? "true" : "false"); - } else { - len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u\",\"bv\":%s}", sep, ctx->resource_id, value ? "true" : "false"); - } - if((len < 0) || (len >= outlen)) { - return 0; - } - LOG_DBG("JSON: Write bool:%s\n", outbuf); - - ctx->writer_flags |= WRITER_OUTPUT_VALUE; - return len; -} -/*---------------------------------------------------------------------------*/ -static size_t -write_int(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - int32_t value) -{ - char *sep = (ctx->writer_flags & WRITER_OUTPUT_VALUE) ? "," : ""; - int len; - if(ctx->writer_flags & WRITER_RESOURCE_INSTANCE) { - len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u/%u\",\"v\":%"PRId32"}", sep, ctx->resource_id, ctx->resource_instance_id, value); - } else { - len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u\",\"v\":%"PRId32"}", sep, ctx->resource_id, value); - } - if((len < 0) || (len >= outlen)) { - return 0; - } - LOG_DBG("Write int:%s\n", outbuf); - - ctx->writer_flags |= WRITER_OUTPUT_VALUE; - return len; -} -/*---------------------------------------------------------------------------*/ -static size_t -write_float32fix(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - int32_t value, int bits) -{ - char *sep = (ctx->writer_flags & WRITER_OUTPUT_VALUE) ? "," : ""; - size_t len = 0; - int res; - if(ctx->writer_flags & WRITER_RESOURCE_INSTANCE) { - res = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u/%u\",\"v\":", sep, ctx->resource_id, ctx->resource_instance_id); - } else { - res = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u\",\"v\":", sep, ctx->resource_id); - } - if(res <= 0 || res >= outlen) { - return 0; - } - len += res; - outlen -= res; - res = lwm2m_plain_text_write_float32fix(&outbuf[len], outlen, value, bits); - if((res <= 0) || (res >= outlen)) { - return 0; - } - len += res; - outlen -= res; - res = snprintf((char *)&outbuf[len], outlen, "}"); - if((res <= 0) || (res >= outlen)) { - return 0; - } - len += res; - ctx->writer_flags |= WRITER_OUTPUT_VALUE; - return len; -} -/*---------------------------------------------------------------------------*/ -static size_t -write_string(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - const char *value, size_t stringlen) -{ - char *sep = (ctx->writer_flags & WRITER_OUTPUT_VALUE) ? "," : ""; - size_t i; - size_t len = 0; - int res; - LOG_DBG("{\"n\":\"%u\",\"sv\":\"", ctx->resource_id); - if(ctx->writer_flags & WRITER_RESOURCE_INSTANCE) { - res = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u/%u\",\"sv\":\"", sep, - ctx->resource_id, ctx->resource_instance_id); - } else { - res = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u\",\"sv\":\"", sep, - ctx->resource_id); - } - if(res < 0 || res >= outlen) { - return 0; - } - len += res; - for (i = 0; i < stringlen && len < outlen; ++i) { - /* Escape special characters */ - /* TODO: Handle UTF-8 strings */ - if(value[i] < '\x20') { - LOG_DBG_("\\x%x", value[i]); - res = snprintf((char *)&outbuf[len], outlen - len, "\\x%x", value[i]); - if((res < 0) || (res >= (outlen - len))) { - return 0; - } - len += res; - continue; - } else if(value[i] == '"' || value[i] == '\\') { - LOG_DBG_("\\"); - outbuf[len] = '\\'; - ++len; - if(len >= outlen) { - return 0; - } - } - LOG_DBG_("%c", value[i]); - outbuf[len] = value[i]; - ++len; - if(len >= outlen) { - return 0; - } - } - LOG_DBG_("\"}\n"); - res = snprintf((char *)&outbuf[len], outlen - len, "\"}"); - if((res < 0) || (res >= (outlen - len))) { - return 0; - } - - LOG_DBG("JSON: Write string:%s\n", outbuf); - - len += res; - ctx->writer_flags |= WRITER_OUTPUT_VALUE; - return len; -} -/*---------------------------------------------------------------------------*/ -const lwm2m_writer_t lwm2m_json_writer = { - init_write, - end_write, - enter_sub, - exit_sub, - write_int, - write_string, - write_float32fix, - write_boolean -}; -/*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-json.h b/os/services/lwm2m/lwm2m-json.h deleted file mode 100644 index 8267d0246..000000000 --- a/os/services/lwm2m/lwm2m-json.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2016, Eistec AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Header file for the Contiki OMA LWM2M JSON writer - * \author - * Joakim NohlgÃ¥rd - */ - -#ifndef LWM2M_JSON_H_ -#define LWM2M_JSON_H_ - -#include "lwm2m-object.h" - -struct json_data { - uint8_t type; /* S,B,V */ - uint8_t *name; - uint8_t *value; - uint8_t name_len; - uint8_t value_len; -}; - -extern const lwm2m_writer_t lwm2m_json_writer; - -int lwm2m_json_next_token(lwm2m_context_t *ctx, struct json_data *json); - -#endif /* LWM2M_JSON_H_ */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-notification-queue.c b/os/services/lwm2m/lwm2m-notification-queue.c deleted file mode 100644 index c901bef82..000000000 --- a/os/services/lwm2m/lwm2m-notification-queue.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Implementation of functions to manage the queue to store notifications - when waiting for the response to the update message in Queue Mode. - * \author - * Carlos Gonzalo Peces - */ -/*---------------------------------------------------------------------------*/ -#include "lwm2m-notification-queue.h" - -#if LWM2M_QUEUE_MODE_ENABLED - -#include "lwm2m-queue-mode.h" -#include "lwm2m-engine.h" -#include "coap-engine.h" -#include "lib/memb.h" -#include "lib/list.h" -#include -#include -#include -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-notification-queue" -#define LOG_LEVEL LOG_LEVEL_LWM2M - -#ifdef LWM2M_NOTIFICATION_QUEUE_CONF_LENGTH -#define LWM2M_NOTIFICATION_QUEUE_LENGTH LWM2M_NOTIFICATION_QUEUE_CONF_LENGTH -#else -#define LWM2M_NOTIFICATION_QUEUE_LENGTH COAP_MAX_OBSERVERS -#endif - -/*---------------------------------------------------------------------------*/ -/* Queue to store the notifications in the period when the client has woken up, sent the update and it's waiting for the server response*/ -MEMB(notification_memb, notification_path_t, LWM2M_NOTIFICATION_QUEUE_LENGTH); /* Length + 1 to allocate the new path to add */ -LIST(notification_paths_queue); -/*---------------------------------------------------------------------------*/ -void -lwm2m_notification_queue_init(void) -{ - list_init(notification_paths_queue); -} -/*---------------------------------------------------------------------------*/ -static void -extend_path(notification_path_t *path_object, char *path, int path_size) -{ - switch(path_object->level) { - case 1: - snprintf(path, path_size, "%u", path_object->reduced_path[0]); - break; - case 2: - snprintf(path, path_size, "%u/%u", path_object->reduced_path[0], path_object->reduced_path[1]); - break; - case 3: - snprintf(path, path_size, "%u/%u/%u", path_object->reduced_path[0], path_object->reduced_path[1], path_object->reduced_path[2]); - break; - } -} -/*---------------------------------------------------------------------------*/ -static int -is_notification_path_present(uint16_t object_id, uint16_t instance_id, uint16_t resource_id) -{ - notification_path_t *iteration_path = (notification_path_t *)list_head(notification_paths_queue); - while(iteration_path != NULL) { - if(iteration_path->reduced_path[0] == object_id && iteration_path->reduced_path[1] == instance_id - && iteration_path->reduced_path[2] == resource_id) { - return 1; - } - iteration_path = iteration_path->next; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -remove_notification_path(notification_path_t *path) -{ - list_remove(notification_paths_queue, path); - memb_free(¬ification_memb, path); -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_notification_queue_add_notification_path(uint16_t object_id, uint16_t instance_id, uint16_t resource_id) -{ - if(is_notification_path_present(object_id, instance_id, resource_id)) { - LOG_DBG("Notification path already present, not queueing it\n"); - return; - } - notification_path_t *path_object = memb_alloc(¬ification_memb); - if(path_object == NULL) { - LOG_DBG("Queue is full, could not allocate new notification\n"); - return; - } - path_object->reduced_path[0] = object_id; - path_object->reduced_path[1] = instance_id; - path_object->reduced_path[2] = resource_id; - path_object->level = 3; - list_add(notification_paths_queue, path_object); - LOG_DBG("Notification path added to the list: %u/%u/%u\n", object_id, instance_id, resource_id); -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_notification_queue_send_notifications() -{ - char path[20]; - notification_path_t *iteration_path = (notification_path_t *)list_head(notification_paths_queue); - notification_path_t *aux = iteration_path; - - while(iteration_path != NULL) { - extend_path(iteration_path, path, sizeof(path)); -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION - if(lwm2m_queue_mode_get_dynamic_adaptation_flag()) { - lwm2m_queue_mode_set_handler_from_notification(); - } -#endif - LOG_DBG("Sending stored notification with path: %s\n", path); - coap_notify_observers_sub(NULL, path); - aux = iteration_path; - iteration_path = iteration_path->next; - remove_notification_path(aux); - } -} -#endif /* LWM2M_QUEUE_MODE_ENABLED */ -/** @} */ \ No newline at end of file diff --git a/os/services/lwm2m/lwm2m-notification-queue.h b/os/services/lwm2m/lwm2m-notification-queue.h deleted file mode 100644 index e3f4719ac..000000000 --- a/os/services/lwm2m/lwm2m-notification-queue.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Header file for functions to manage the queue to store notifications - when waiting for the response to the update message in Queue Mode. - * \author - * Carlos Gonzalo Peces - */ - -#ifndef LWM2M_NOTIFICATION_QUEUE_H -#define LWM2M_NOTIFICATION_QUEUE_H - -#include "contiki.h" -#include "lwm2m-queue-mode-conf.h" - -#include - -typedef struct notification_path { - struct notification_path *next; - uint16_t reduced_path[3]; - uint8_t level; /* The depth level of the path: 1. object, 2. object/instance, 3. object/instance/resource */ -} notification_path_t; - -void lwm2m_notification_queue_init(void); - -void lwm2m_notification_queue_add_notification_path(uint16_t object_id, uint16_t instance_id, uint16_t resource_id); - -void lwm2m_notification_queue_send_notifications(); - -#endif /* LWM2M_NOTIFICATION_QUEUE_H */ -/** @} */ \ No newline at end of file diff --git a/os/services/lwm2m/lwm2m-object.h b/os/services/lwm2m/lwm2m-object.h deleted file mode 100644 index c6c582a35..000000000 --- a/os/services/lwm2m/lwm2m-object.h +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup apps - * @{ - */ - -/** - * \defgroup lwm2m An implementation of LWM2M - * @{ - * - * This is an implementation of OMA Lightweight M2M (LWM2M). - */ - -/** - * \file - * Header file for the LWM2M object API - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef LWM2M_OBJECT_H_ -#define LWM2M_OBJECT_H_ - -#include "coap.h" -#include "coap-observe.h" - -/* Operation permissions on the resources - read/write/execute */ -#define LWM2M_RESOURCE_READ 0x10000 -#define LWM2M_RESOURCE_WRITE 0x20000 -#define LWM2M_RESOURCE_EXECUTE 0x40000 -#define LWM2M_RESOURCE_OP_MASK 0x70000 - -/* The resource id type of lwm2m objects - 16 bits for the ID - the rest - is flags */ -typedef uint32_t lwm2m_resource_id_t; - -/* Defines for the resource definition array */ -#define RO(x) (x | LWM2M_RESOURCE_READ) -#define WO(x) (x | LWM2M_RESOURCE_WRITE) -#define RW(x) (x | LWM2M_RESOURCE_READ | LWM2M_RESOURCE_WRITE) -#define EX(x) (x | LWM2M_RESOURCE_EXECUTE) - -#define LWM2M_OBJECT_SECURITY_ID 0 -#define LWM2M_OBJECT_SERVER_ID 1 -#define LWM2M_OBJECT_ACCESS_CONTROL_ID 2 -#define LWM2M_OBJECT_DEVICE_ID 3 -#define LWM2M_OBJECT_CONNECTIVITY_MONITORING_ID 4 -#define LWM2M_OBJECT_FIRMWARE_ID 5 -#define LWM2M_OBJECT_LOCATION_ID 6 -#define LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID 7 - -typedef enum { - LWM2M_OP_NONE, - LWM2M_OP_READ, - LWM2M_OP_DISCOVER, - LWM2M_OP_WRITE, - LWM2M_OP_WRITE_ATTR, - LWM2M_OP_EXECUTE, - LWM2M_OP_CREATE, - LWM2M_OP_DELETE -} lwm2m_operation_t; - -typedef enum { - LWM2M_STATUS_OK, - - /* Internal server error */ - LWM2M_STATUS_ERROR, - /* Error from writer */ - LWM2M_STATUS_WRITE_ERROR, - /* Error from reader */ - LWM2M_STATUS_READ_ERROR, - - LWM2M_STATUS_BAD_REQUEST, - LWM2M_STATUS_UNAUTHORIZED, - LWM2M_STATUS_FORBIDDEN, - LWM2M_STATUS_NOT_FOUND, - LWM2M_STATUS_OPERATION_NOT_ALLOWED, - LWM2M_STATUS_NOT_ACCEPTABLE, - LWM2M_STATUS_UNSUPPORTED_CONTENT_FORMAT, - - LWM2M_STATUS_NOT_IMPLEMENTED, - LWM2M_STATUS_SERVICE_UNAVAILABLE, -} lwm2m_status_t; - -/* remember that we have already output a value - can be between two block's */ -#define WRITER_OUTPUT_VALUE 1 -#define WRITER_RESOURCE_INSTANCE 2 -#define WRITER_HAS_MORE 4 - -typedef struct lwm2m_reader lwm2m_reader_t; -typedef struct lwm2m_writer lwm2m_writer_t; - -typedef struct lwm2m_object_instance lwm2m_object_instance_t; - -typedef struct { - uint16_t len; /* used for current length of the data in the buffer */ - uint16_t pos; /* position in the buffer - typically write position or similar */ - uint16_t size; - uint8_t *buffer; -} lwm2m_buffer_t; - -/* Data model for OMA LWM2M objects */ -typedef struct lwm2m_context { - uint16_t object_id; - uint16_t object_instance_id; - uint16_t resource_id; - uint16_t resource_instance_id; - - uint8_t resource_index; - uint8_t resource_instance_index; /* for use when stepping to next sub-resource if having multiple */ - uint8_t level; /* 0/1/2/3 = 3 = resource */ - lwm2m_operation_t operation; - - coap_message_t *request; - coap_message_t *response; - - unsigned int content_type; - lwm2m_buffer_t *outbuf; - lwm2m_buffer_t *inbuf; - - uint8_t out_mark_pos_oi; /* mark pos for last object instance */ - uint8_t out_mark_pos_ri; /* mark pos for last resource instance */ - - uint32_t offset; /* If we do blockwise - this needs to change */ - - /* Info on last_instance read/write */ - uint16_t last_instance; - uint16_t last_value_len; - - uint8_t writer_flags; /* flags for reader/writer */ - const lwm2m_reader_t *reader; - const lwm2m_writer_t *writer; -} lwm2m_context_t; - -/* LWM2M format writer for the various formats supported */ -struct lwm2m_writer { - size_t (* init_write)(lwm2m_context_t *ctx); - size_t (* end_write)(lwm2m_context_t *ctx); - /* For sub-resources */ - size_t (* enter_resource_instance)(lwm2m_context_t *ctx); - size_t (* exit_resource_instance)(lwm2m_context_t *ctx); - size_t (* write_int)(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, int32_t value); - size_t (* write_string)(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, const char *value, size_t strlen); - size_t (* write_float32fix)(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, int32_t value, int bits); - size_t (* write_boolean)(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, int value); - size_t (* write_opaque_header)(lwm2m_context_t *ctx, size_t total_size); -}; - -struct lwm2m_reader { - size_t (* read_int)(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, int32_t *value); - size_t (* read_string)(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, uint8_t *value, size_t strlen); - size_t (* read_float32fix)(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, int32_t *value, int bits); - size_t (* read_boolean)(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, int *value); -}; - -typedef lwm2m_status_t -(* lwm2m_write_opaque_callback)(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx, int num_to_write); - -void lwm2m_engine_set_opaque_callback(lwm2m_context_t *ctx, lwm2m_write_opaque_callback cb); - -static inline void -lwm2m_notify_observers(char *path) -{ - coap_notify_observers_sub(NULL, path); -} - -static inline size_t -lwm2m_object_read_int(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, int32_t *value) -{ - return ctx->reader->read_int(ctx, inbuf, len, value); -} - -static inline size_t -lwm2m_object_read_string(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, uint8_t *value, size_t strlen) -{ - return ctx->reader->read_string(ctx, inbuf, len, value, strlen); -} - -static inline size_t -lwm2m_object_read_float32fix(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, int32_t *value, int bits) -{ - return ctx->reader->read_float32fix(ctx, inbuf, len, value, bits); -} - -static inline size_t -lwm2m_object_read_boolean(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, int *value) -{ - return ctx->reader->read_boolean(ctx, inbuf, len, value); -} - -static inline size_t -lwm2m_object_write_int(lwm2m_context_t *ctx, int32_t value) -{ - size_t s; - s = ctx->writer->write_int(ctx, &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, value); - ctx->outbuf->len += s; - return s; -} - -static inline size_t -lwm2m_object_write_string(lwm2m_context_t *ctx, const char *value, size_t strlen) -{ - size_t s; - s = ctx->writer->write_string(ctx, &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, value, strlen); - ctx->outbuf->len += s; - return s; -} - -static inline size_t -lwm2m_object_write_float32fix(lwm2m_context_t *ctx, int32_t value, int bits) -{ - size_t s; - s = ctx->writer->write_float32fix(ctx, &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, value, bits); - ctx->outbuf->len += s; - return s; -} - -static inline size_t -lwm2m_object_write_boolean(lwm2m_context_t *ctx, int value) -{ - size_t s; - s = ctx->writer->write_boolean(ctx, &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, value); - ctx->outbuf->len += s; - return s; -} - -static inline int -lwm2m_object_write_opaque_stream(lwm2m_context_t *ctx, int size, lwm2m_write_opaque_callback cb) -{ - /* 1. - create a header of either OPAQUE (nothing) or TLV if the format is TLV */ - size_t s; - if(ctx->writer->write_opaque_header != NULL) { - s = ctx->writer->write_opaque_header(ctx, size); - ctx->outbuf->len += s; - } else { - return 0; - } - /* 2. - set the callback so that future data will be grabbed from the callback */ - lwm2m_engine_set_opaque_callback(ctx, cb); - return 1; -} - -/* Resource instance functions (_ri)*/ - -static inline size_t -lwm2m_object_write_enter_ri(lwm2m_context_t *ctx) -{ - if(ctx->writer->enter_resource_instance != NULL) { - size_t s; - s = ctx->writer->enter_resource_instance(ctx); - ctx->outbuf->len += s; - return s; - } - return 0; -} - -static inline size_t -lwm2m_object_write_exit_ri(lwm2m_context_t *ctx) -{ - if(ctx->writer->exit_resource_instance != NULL) { - size_t s; - s = ctx->writer->exit_resource_instance(ctx); - ctx->outbuf->len += s; - return s; - } - return 0; -} - -static inline size_t -lwm2m_object_write_int_ri(lwm2m_context_t *ctx, uint16_t id, int32_t value) -{ - size_t s; - ctx->resource_instance_id = id; - s = ctx->writer->write_int(ctx, &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, value); - ctx->outbuf->len += s; - return s; -} - -static inline size_t -lwm2m_object_write_string_ri(lwm2m_context_t *ctx, uint16_t id, const char *value, size_t strlen) -{ - size_t s; - ctx->resource_instance_id = id; - s = ctx->writer->write_string(ctx, &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, value, strlen); - ctx->outbuf->len += s; - return s; -} - -static inline size_t -lwm2m_object_write_float32fix_ri(lwm2m_context_t *ctx, uint16_t id, int32_t value, int bits) -{ - size_t s; - ctx->resource_instance_id = id; - s = ctx->writer->write_float32fix(ctx, &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, value, bits); - ctx->outbuf->len += s; - return s; -} - -static inline size_t -lwm2m_object_write_boolean_ri(lwm2m_context_t *ctx, uint16_t id, int value) -{ - size_t s; - ctx->resource_instance_id = id; - s = ctx->writer->write_boolean(ctx, &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len, value); - ctx->outbuf->len += s; - return s; -} - -static inline int -lwm2m_object_is_final_incoming(lwm2m_context_t *ctx) -{ - uint8_t more; - if(coap_get_header_block1(ctx->request, NULL, &more, NULL, NULL)) { - return !more; - } - /* If we do not know this is final... it might not be... */ - return 0; -} - -#include "lwm2m-engine.h" - -#endif /* LWM2M_OBJECT_H_ */ -/** - * @} - * @} - */ diff --git a/os/services/lwm2m/lwm2m-plain-text.c b/os/services/lwm2m/lwm2m-plain-text.c deleted file mode 100644 index 3dc816ddc..000000000 --- a/os/services/lwm2m/lwm2m-plain-text.c +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M plain text reader / writer - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include "lwm2m-object.h" -#include "lwm2m-plain-text.h" -#include -#include -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-text" -#define LOG_LEVEL LOG_LEVEL_NONE - -/*---------------------------------------------------------------------------*/ -static size_t -init_write(lwm2m_context_t *ctx) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static size_t -end_write(lwm2m_context_t *ctx) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -size_t -lwm2m_plain_text_read_int(const uint8_t *inbuf, size_t len, int32_t *value) -{ - int i, neg = 0; - *value = 0; - for(i = 0; i < len; i++) { - if(inbuf[i] >= '0' && inbuf[i] <= '9') { - *value = *value * 10 + (inbuf[i] - '0'); - } else if(inbuf[i] == '-' && i == 0) { - neg = 1; - } else { - break; - } - } - if(neg) { - *value = -*value; - } - return i; -} -/*---------------------------------------------------------------------------*/ -size_t -lwm2m_plain_text_read_float32fix(const uint8_t *inbuf, size_t len, - int32_t *value, int bits) -{ - int i, dot = 0, neg = 0; - int32_t counter, integerpart, frac; - - integerpart = 0; - counter = 0; - frac = 0; - for(i = 0; i < len; i++) { - if(inbuf[i] >= '0' && inbuf[i] <= '9') { - counter = counter * 10 + (inbuf[i] - '0'); - frac = frac * 10; - } else if(inbuf[i] == '.' && dot == 0) { - integerpart = counter; - counter = 0; - frac = 1; - dot = 1; - } else if(inbuf[i] == '-' && i == 0) { - neg = 1; - } else { - break; - } - } - if(dot == 0) { - integerpart = counter; - counter = 0; - frac = 1; - } - *value = integerpart << bits; - if(frac > 1) { - *value += ((counter << bits) / frac); - } - LOG_DBG("READ FLOATFIX: \"%.*s\" => int(%ld) frac(%ld) f=%ld Value=%ld\n", - (int)len, (char *)inbuf, - (long)integerpart, - (long)counter, - (long)frac, - (long)*value); - if(neg) { - *value = -*value; - } - - return i; -} -/*---------------------------------------------------------------------------*/ -size_t -lwm2m_plain_text_write_float32fix(uint8_t *outbuf, size_t outlen, - int32_t value, int bits) -{ - int64_t v; - unsigned long integer_part; - unsigned long frac_part; - int n, o = 0; - - if(outlen == 0) { - return 0; - } - if(value < 0) { - *outbuf++ = '-'; - outlen--; - o = 1; - value = -value; - } - - integer_part = (unsigned long)(value >> bits); - v = value - (integer_part << bits); - v = (v * 100) >> bits; - frac_part = (unsigned long)v; - - n = snprintf((char *)outbuf, outlen, "%lu.%02lu", integer_part, frac_part); - if(n < 0 || n >= outlen) { - return 0; - } - return n + o; -} -/*---------------------------------------------------------------------------*/ -static size_t -write_boolean(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - int value) -{ - if(outlen > 0) { - if(value) { - *outbuf = '1'; - } else { - *outbuf = '0'; - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static size_t -write_int(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - int32_t value) -{ - int n = snprintf((char *)outbuf, outlen, "%ld", (long)value); - if(n < 0 || n >= outlen) { - return 0; - } - return n; -} -/*---------------------------------------------------------------------------*/ -static size_t -write_float32fix(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - int32_t value, int bits) -{ - return lwm2m_plain_text_write_float32fix(outbuf, outlen, value, bits); -} -/*---------------------------------------------------------------------------*/ -static size_t -write_string(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - const char *value, size_t stringlen) -{ - int totlen = stringlen; - if(stringlen >= outlen) { - return 0; - } - memmove(outbuf, value, totlen); - outbuf[totlen] = 0; - return totlen; -} -/*---------------------------------------------------------------------------*/ -const lwm2m_writer_t lwm2m_plain_text_writer = { - init_write, - end_write, - NULL, /* No support for sub resources here! */ - NULL, - write_int, - write_string, - write_float32fix, - write_boolean -}; -/*---------------------------------------------------------------------------*/ -static size_t -read_int(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, - int32_t *value) -{ - int size = lwm2m_plain_text_read_int(inbuf, len, value); - ctx->last_value_len = size; - return size; -} -/*---------------------------------------------------------------------------*/ -static size_t -read_string(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, - uint8_t *value, size_t stringlen) -{ - if(stringlen <= len) { - /* The outbuffer can not contain the full string including ending zero */ - return 0; - } - memcpy(value, inbuf, len); - value[len] = '\0'; - ctx->last_value_len = len; - return len; -} -/*---------------------------------------------------------------------------*/ -static size_t -read_float32fix(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, - int32_t *value, int bits) -{ - int size; - size = lwm2m_plain_text_read_float32fix(inbuf, len, value, bits); - ctx->last_value_len = size; - return size; -} -/*---------------------------------------------------------------------------*/ -static size_t -read_boolean(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, - int *value) -{ - if(len > 0) { - if(*inbuf == '1' || *inbuf == '0') { - *value = *inbuf == '1' ? 1 : 0; - ctx->last_value_len = 1; - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -const lwm2m_reader_t lwm2m_plain_text_reader = { - read_int, - read_string, - read_float32fix, - read_boolean -}; -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-plain-text.h b/os/services/lwm2m/lwm2m-plain-text.h deleted file mode 100644 index 7922a8ce8..000000000 --- a/os/services/lwm2m/lwm2m-plain-text.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2015, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Header file for the Contiki OMA LWM2M plain text reader / writer - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef LWM2M_PLAIN_TEXT_H_ -#define LWM2M_PLAIN_TEXT_H_ - -#include "lwm2m-object.h" - -extern const lwm2m_reader_t lwm2m_plain_text_reader; -extern const lwm2m_writer_t lwm2m_plain_text_writer; - -size_t lwm2m_plain_text_read_int(const uint8_t *inbuf, size_t len, - int32_t *value); - -size_t lwm2m_plain_text_read_float32fix(const uint8_t *inbuf, size_t len, - int32_t *value, int bits); - -size_t lwm2m_plain_text_write_float32fix(uint8_t *outbuf, size_t outlen, - int32_t value, int bits); - -#endif /* LWM2M_PLAIN_TEXT_H_ */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-queue-mode-conf.h b/os/services/lwm2m/lwm2m-queue-mode-conf.h deleted file mode 100644 index 3432c112a..000000000 --- a/os/services/lwm2m/lwm2m-queue-mode-conf.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Queue Mode Configuration Parameters - * \author - * Carlos Gonzalo Peces - */ - -#ifndef LWM2M_QUEUE_MODE_CONF_H -#define LWM2M_QUEUE_MODE_CONF_H - -#include "contiki.h" - -/* Enable the Queue Mode */ -#ifdef LWM2M_QUEUE_MODE_CONF_ENABLED -#define LWM2M_QUEUE_MODE_ENABLED LWM2M_QUEUE_MODE_CONF_ENABLED -#else -#define LWM2M_QUEUE_MODE_ENABLED 0 -#endif /* LWM2M_QUEUE_MODE_CONF_ENABLED */ - -/* Default Sleeping Time */ -#ifdef LWM2M_QUEUE_MODE_CONF_DEFAULT_CLIENT_SLEEP_TIME -#define LWM2M_QUEUE_MODE_DEFAULT_CLIENT_SLEEP_TIME LWM2M_QUEUE_MODE_CONF_DEFAULT_CLIENT_SLEEP_TIME -#else -#define LWM2M_QUEUE_MODE_DEFAULT_CLIENT_SLEEP_TIME 10000 /* msec */ -#endif /* LWM2M_QUEUE_MODE_DEFAULT_CLIENT_SLEEPING_TIME */ - -/* Default Awake Time */ -#ifdef LWM2M_QUEUE_MODE_CONF_DEFAULT_CLIENT_AWAKE_TIME -#define LWM2M_QUEUE_MODE_DEFAULT_CLIENT_AWAKE_TIME LWM2M_QUEUE_MODE_CONF_DEFAULT_CLIENT_AWAKE_TIME -#else -#define LWM2M_QUEUE_MODE_DEFAULT_CLIENT_AWAKE_TIME 5000 /* msec */ -#endif /* LWM2M_QUEUE_MODE_DEFAULT_CLIENT_AWAKE_TIME */ - -/* Include the possibility to do the dynamic adaptation of the client awake time */ -#ifdef LWM2M_QUEUE_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION -#define LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION LWM2M_QUEUE_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION -#else -#define LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION 0 /* not included */ -#endif /* LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION */ - -/* Default value for the dynamic adaptation flag */ -#ifdef LWM2M_QUEUE_MODE_CONF_DEFAULT_DYNAMIC_ADAPTATION_FLAG -#define LWM2M_QUEUE_MODE_DEFAULT_DYNAMIC_ADAPTATION_FLAG LWM2M_QUEUE_MODE_CONF_DEFAULT_DYNAMIC_ADAPTATION_FLAG -#else -#define LWM2M_QUEUE_MODE_DEFAULT_DYNAMIC_ADAPTATION_FLAG 0 /* disabled */ -#endif /* LWM2M_QUEUE_MODE_DEFAULT_DYNAMIC_ADAPTATION_FLAG */ - -/* Length of the list of times for the dynamic adaptation */ -#define LWM2M_QUEUE_MODE_DYNAMIC_ADAPTATION_WINDOW_LENGTH 10 - -/* Enable and disable the Queue Mode Object */ -#ifdef LWM2M_QUEUE_MODE_OBJECT_CONF_ENABLED -#define LWM2M_QUEUE_MODE_OBJECT_ENABLED LWM2M_QUEUE_MODE_OBJECT_CONF_ENABLED -#else -#define LWM2M_QUEUE_MODE_OBJECT_ENABLED 0 /* not included */ -#endif /* LWM2M_QUEUE_MODE_OBJECT_ENABLED */ - - - -#endif /* LWM2M_QUEUE_MODE_CONF_H */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-queue-mode-object.c b/os/services/lwm2m/lwm2m-queue-mode-object.c deleted file mode 100644 index a3c000d69..000000000 --- a/os/services/lwm2m/lwm2m-queue-mode-object.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M Queue Mode object - to manage the parameters from the server side - * \author - * Carlos Gonzalo Peces - */ - -#include "lwm2m-object.h" -#include "lwm2m-queue-mode.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-qmode-object" -#define LOG_LEVEL LOG_LEVEL_LWM2M - -#if LWM2M_QUEUE_MODE_ENABLED && LWM2M_QUEUE_MODE_OBJECT_ENABLED - -#define LWM2M_QUEUE_MODE_OBJECT_ID 30000 -#define LWM2M_AWAKE_TIME_ID 30000 -#define LWM2M_SLEEP_TIME_ID 30001 - -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION -#define LWM2M_DYNAMIC_ADAPTATION_FLAG_ID 30002 -#define UPDATE_WITH_MEAN 0 /* 1-mean time 0-maximum time */ -#endif - -static const lwm2m_resource_id_t resources[] = -{ RW(LWM2M_AWAKE_TIME_ID), - RW(LWM2M_SLEEP_TIME_ID), -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION - RW(LWM2M_DYNAMIC_ADAPTATION_FLAG_ID), -#endif -}; - -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -lwm2m_callback(lwm2m_object_instance_t *object, lwm2m_context_t *ctx) -{ - if(ctx->operation == LWM2M_OP_READ) { - switch(ctx->resource_id) { - case LWM2M_AWAKE_TIME_ID: - lwm2m_object_write_int(ctx, (int32_t)lwm2m_queue_mode_get_awake_time()); - return LWM2M_STATUS_OK; - case LWM2M_SLEEP_TIME_ID: - lwm2m_object_write_int(ctx, (int32_t)lwm2m_queue_mode_get_sleep_time()); - return LWM2M_STATUS_OK; -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION - case LWM2M_DYNAMIC_ADAPTATION_FLAG_ID: - lwm2m_object_write_int(ctx, (int32_t)lwm2m_queue_mode_get_dynamic_adaptation_flag()); - return LWM2M_STATUS_OK; -#endif - } - } else if(ctx->operation == LWM2M_OP_WRITE) { - switch(ctx->resource_id) { - int32_t value_read; - size_t len; - - case LWM2M_AWAKE_TIME_ID: - - len = lwm2m_object_read_int(ctx, ctx->inbuf->buffer, ctx->inbuf->size, - &value_read); - LOG_DBG("Client Awake Time write request value: %d\n", (int)value_read); - if(len == 0) { - LOG_WARN("FAIL: could not write awake time\n"); - return LWM2M_STATUS_WRITE_ERROR; - } else { - lwm2m_queue_mode_set_awake_time(value_read); - return LWM2M_STATUS_OK; - } - - case LWM2M_SLEEP_TIME_ID: - len = lwm2m_object_read_int(ctx, ctx->inbuf->buffer, ctx->inbuf->size, - &value_read); - LOG_DBG("Client Sleep Time write request value: %d\n", (int)value_read); - if(len == 0) { - LOG_WARN("FAIL: could not write sleep time\n"); - return LWM2M_STATUS_WRITE_ERROR; - } else { - lwm2m_queue_mode_set_sleep_time(value_read); - return LWM2M_STATUS_OK; - } -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION - case LWM2M_DYNAMIC_ADAPTATION_FLAG_ID: - len = lwm2m_object_read_int(ctx, ctx->inbuf->buffer, ctx->inbuf->size, - &value_read); - LOG_DBG("Dynamic Adaptation Flag request value: %d\n", (int)value_read); - if(len == 0) { - LOG_WARN("FAIL: could not write dynamic flag\n"); - return LWM2M_STATUS_WRITE_ERROR; - } else { - lwm2m_queue_mode_set_dynamic_adaptation_flag(value_read); - return LWM2M_STATUS_OK; - } -#endif - } - } - - return LWM2M_STATUS_OPERATION_NOT_ALLOWED; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t queue_object = { - .object_id = LWM2M_QUEUE_MODE_OBJECT_ID, - .instance_id = 0, - .resource_ids = resources, - .resource_count = sizeof(resources) / sizeof(lwm2m_resource_id_t), - .resource_dim_callback = NULL, - .callback = lwm2m_callback, -}; -/*---------------------------------------------------------------------------*/ -void -lwm2m_queue_mode_object_init(void) -{ - lwm2m_engine_add_object(&queue_object); -} -#endif /* LWM2M_QUEUE_MODE_ENABLED && LWM2M_QUEUE_MODE_OBJECT_ENABLED */ -/** @} */ \ No newline at end of file diff --git a/os/services/lwm2m/lwm2m-queue-mode-object.h b/os/services/lwm2m/lwm2m-queue-mode-object.h deleted file mode 100644 index 017b797fc..000000000 --- a/os/services/lwm2m/lwm2m-queue-mode-object.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup oma-lwm2m - * @{ - */ - -/** - * \file - * Header file for the Contiki OMA LWM2M Queue Mode object - to manage the parameters from the server side - * \author - * Carlos Gonzalo Peces - */ - -#ifndef LWM2M_QUEUE_MODE_OBJECT_H_ -#define LWM2M_QUEUE_MODE_OBJECT_H_ - -#include "lwm2m-queue-mode-conf.h" - -void lwm2m_queue_mode_object_init(void); - -#endif /* LWM2M_Q_OBJECT_H_ */ -/** @} */ \ No newline at end of file diff --git a/os/services/lwm2m/lwm2m-queue-mode.c b/os/services/lwm2m/lwm2m-queue-mode.c deleted file mode 100644 index aad80ce3e..000000000 --- a/os/services/lwm2m/lwm2m-queue-mode.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M Queue Mode for managing the parameters - * \author - * Carlos Gonzalo Peces - */ - -#include "lwm2m-queue-mode.h" - -#if LWM2M_QUEUE_MODE_ENABLED - -#include "lwm2m-engine.h" -#include "lwm2m-rd-client.h" -#include "lib/memb.h" -#include "lib/list.h" -#include - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-queue-mode" -#define LOG_LEVEL LOG_LEVEL_LWM2M - -/* Queue Mode dynamic adaptation masks */ -#define FIRST_REQUEST_MASK 0x01 -#define HANDLER_FROM_NOTIFICATION_MASK 0x02 - -static uint16_t queue_mode_awake_time = LWM2M_QUEUE_MODE_DEFAULT_CLIENT_AWAKE_TIME; -static uint32_t queue_mode_sleep_time = LWM2M_QUEUE_MODE_DEFAULT_CLIENT_SLEEP_TIME; - -/* Flag for notifications */ -static uint8_t waked_up_by_notification; - -/* For the dynamic adaptation of the awake time */ -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION -static uint8_t queue_mode_dynamic_adaptation_flag = LWM2M_QUEUE_MODE_DEFAULT_DYNAMIC_ADAPTATION_FLAG; - -/* Window to save the times and do the dynamic adaptation of the awake time*/ -uint16_t times_window[LWM2M_QUEUE_MODE_DYNAMIC_ADAPTATION_WINDOW_LENGTH] = { 0 }; -uint8_t times_window_index = 0; -static uint8_t dynamic_adaptation_params = 0x00; /* bit0: first_request, bit1: handler from notification */ -static uint64_t previous_request_time; -static inline void clear_first_request(); -static inline uint8_t is_first_request(); -static inline void clear_handler_from_notification(); -static inline uint8_t get_handler_from_notification(); -#endif /* LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION */ -/*---------------------------------------------------------------------------*/ -uint16_t -lwm2m_queue_mode_get_awake_time() -{ - LOG_DBG("Client Awake Time: %d ms\n", (int)queue_mode_awake_time); - return queue_mode_awake_time; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_queue_mode_set_awake_time(uint16_t time) -{ - queue_mode_awake_time = time; -} -/*---------------------------------------------------------------------------*/ -uint32_t -lwm2m_queue_mode_get_sleep_time() -{ - LOG_DBG("Client Sleep Time: %d ms\n", (int)queue_mode_sleep_time); - return queue_mode_sleep_time; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_queue_mode_set_sleep_time(uint32_t time) -{ - queue_mode_sleep_time = time; -} -/*---------------------------------------------------------------------------*/ -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION -uint8_t -lwm2m_queue_mode_get_dynamic_adaptation_flag() -{ - LOG_DBG("Dynamic Adaptation Flag: %d ms\n", (int)queue_mode_dynamic_adaptation_flag); - return queue_mode_dynamic_adaptation_flag; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_queue_mode_set_dynamic_adaptation_flag(uint8_t flag) -{ - queue_mode_dynamic_adaptation_flag = flag; -} -#endif -/*---------------------------------------------------------------------------*/ -#if !UPDATE_WITH_MEAN -static uint16_t -get_maximum_time() -{ - uint16_t max_time = 0; - uint8_t i; - for(i = 0; i < LWM2M_QUEUE_MODE_DYNAMIC_ADAPTATION_WINDOW_LENGTH; i++) { - if(times_window[i] > max_time) { - max_time = times_window[i]; - } - } - return max_time; -} -#endif -/*---------------------------------------------------------------------------*/ -#if UPDATE_WITH_MEAN -static uint16_t -get_mean_time() -{ - uint16_t mean_time = 0; - uint8_t i; - for(i = 0; i < LWM2M_QUEUE_MODE_DYNAMIC_ADAPTATION_WINDOW_LENGTH; i++) { - if(mean_time == 0) { - mean_time = times_window[i]; - } else { - if(times_window[i] != 0) { - mean_time = (mean_time + times_window[i]) / 2; - } - } - } - return mean_time; -} -#endif -/*---------------------------------------------------------------------------*/ -static void -update_awake_time() -{ -#if UPDATE_WITH_MEAN - uint16_t mean_time = get_mean_time(); - LOG_DBG("Dynamic Adaptation: updated awake time: %d ms\n", (int)mean_time); - lwm2m_queue_mode_set_awake_time(mean_time + (mean_time >> 1)); /* 50% margin */ - return; -#else - uint16_t max_time = get_maximum_time(); - LOG_DBG("Dynamic Adaptation: updated awake time: %d ms\n", (int)max_time); - lwm2m_queue_mode_set_awake_time(max_time + (max_time >> 1)); /* 50% margin */ - return; -#endif -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_queue_mode_add_time_to_window(uint16_t time) -{ - if(times_window_index == LWM2M_QUEUE_MODE_DYNAMIC_ADAPTATION_WINDOW_LENGTH) { - times_window_index = 0; - } - times_window[times_window_index] = time; - times_window_index++; - update_awake_time(); -} -/*---------------------------------------------------------------------------*/ -uint8_t -lwm2m_queue_mode_is_waked_up_by_notification() -{ - return waked_up_by_notification; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_queue_mode_clear_waked_up_by_notification() -{ - waked_up_by_notification = 0; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_queue_mode_set_waked_up_by_notification() -{ - waked_up_by_notification = 1; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_queue_mode_request_received() -{ - if(lwm2m_rd_client_is_client_awake()) { - lwm2m_rd_client_restart_client_awake_timer(); - } -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION - if(lwm2m_queue_mode_get_dynamic_adaptation_flag() && !get_handler_from_notification()) { - if(is_first_request()) { - previous_request_time = coap_timer_uptime(); - clear_first_request(); - } else { - if(coap_timer_uptime() - previous_request_time >= 0) { - if(coap_timer_uptime() - previous_request_time > 0xffff) { - lwm2m_queue_mode_add_time_to_window(0xffff); - } else { - lwm2m_queue_mode_add_time_to_window(coap_timer_uptime() - previous_request_time); - } - } - previous_request_time = coap_timer_uptime(); - } - } - if(get_handler_from_notification()) { - clear_handler_from_notification(); - } -#endif /* LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION */ -} -/*---------------------------------------------------------------------------*/ -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION -void -lwm2m_queue_mode_set_first_request() -{ - dynamic_adaptation_params |= FIRST_REQUEST_MASK; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_queue_mode_set_handler_from_notification() -{ - dynamic_adaptation_params |= HANDLER_FROM_NOTIFICATION_MASK; -} -/*---------------------------------------------------------------------------*/ -static inline uint8_t -is_first_request() -{ - return dynamic_adaptation_params & FIRST_REQUEST_MASK; -} -/*---------------------------------------------------------------------------*/ -static inline uint8_t -get_handler_from_notification() -{ - return (dynamic_adaptation_params & HANDLER_FROM_NOTIFICATION_MASK) != 0; -} -/*---------------------------------------------------------------------------*/ -static inline void -clear_first_request() -{ - dynamic_adaptation_params &= ~FIRST_REQUEST_MASK; -} -/*---------------------------------------------------------------------------*/ -static inline void -clear_handler_from_notification() -{ - dynamic_adaptation_params &= ~HANDLER_FROM_NOTIFICATION_MASK; -} -#endif /* LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION */ -#endif /* LWM2M_QUEUE_MODE_ENABLED */ -/** @} */ - diff --git a/os/services/lwm2m/lwm2m-queue-mode.h b/os/services/lwm2m/lwm2m-queue-mode.h deleted file mode 100644 index 5c65face5..000000000 --- a/os/services/lwm2m/lwm2m-queue-mode.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup oma-lwm2m - * @{ - */ - -/** - * \file - * Header file for the Contiki OMA LWM2M Queue Mode implementation - to manage the parameters - * \author - * Carlos Gonzalo Peces - */ - -#ifndef LWM2M_QUEUE_MODE_H_ -#define LWM2M_QUEUE_MODE_H_ - -#include "lwm2m-queue-mode-conf.h" -#include - -uint16_t lwm2m_queue_mode_get_awake_time(); -void lwm2m_queue_mode_set_awake_time(uint16_t time); -uint32_t lwm2m_queue_mode_get_sleep_time(); -void lwm2m_queue_mode_set_sleep_time(uint32_t time); - -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION -uint8_t lwm2m_queue_mode_get_dynamic_adaptation_flag(); -void lwm2m_queue_mode_set_dynamic_adaptation_flag(uint8_t flag); -void lwm2m_queue_mode_add_time_to_window(uint16_t time); -#endif - -uint8_t lwm2m_queue_mode_is_waked_up_by_notification(); -void lwm2m_queue_mode_clear_waked_up_by_notification(); -void lwm2m_queue_mode_set_waked_up_by_notification(); - -void lwm2m_queue_mode_set_first_request(); -void lwm2m_queue_mode_set_handler_from_notification(); - -void lwm2m_queue_mode_request_received(); - -#endif /* LWM2M_QUEUE_MODE_H_ */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-rd-client.c b/os/services/lwm2m/lwm2m-rd-client.c deleted file mode 100644 index 6bb58f91a..000000000 --- a/os/services/lwm2m/lwm2m-rd-client.c +++ /dev/null @@ -1,905 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M engine - * Registration and bootstrap client - * \author - * Joakim Eriksson - * Niclas Finne - * Joel Hoglund - * Carlos Gonzalo Peces - */ -#include "lwm2m-engine.h" -#include "lwm2m-object.h" -#include "lwm2m-device.h" -#include "lwm2m-plain-text.h" -#include "lwm2m-json.h" -#include "lwm2m-rd-client.h" -#include "coap.h" -#include "coap-engine.h" -#include "coap-endpoint.h" -#include "coap-callback-api.h" -#include "lwm2m-security.h" -#include "lib/list.h" -#include -#include -#include - -#if UIP_CONF_IPV6_RPL -#include "rpl.h" -#endif /* UIP_CONF_IPV6_RPL */ - -#if LWM2M_QUEUE_MODE_ENABLED -#include "lwm2m-queue-mode.h" -#include "lwm2m-notification-queue.h" -#endif /* LWM2M_QUEUE_MODE_ENABLED */ - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-rd" -#define LOG_LEVEL LOG_LEVEL_LWM2M - -#ifndef LWM2M_DEFAULT_CLIENT_LIFETIME -#define LWM2M_DEFAULT_CLIENT_LIFETIME 30 /* sec */ -#endif - -#define REMOTE_PORT UIP_HTONS(COAP_DEFAULT_PORT) -#define BS_REMOTE_PORT UIP_HTONS(5685) - -#define STATE_MACHINE_UPDATE_INTERVAL 500 - -/* The states for the RD client state machine */ -/* When node is unregistered it ends up in UNREGISTERED - and this is going to be there until use X or Y kicks it - back into INIT again */ -#define INIT 0 -#define WAIT_NETWORK 1 -#define DO_BOOTSTRAP 3 -#define BOOTSTRAP_SENT 4 -#define BOOTSTRAP_DONE 5 -#define DO_REGISTRATION 6 -#define REGISTRATION_SENT 7 -#define REGISTRATION_DONE 8 -#define UPDATE_SENT 9 -#define DEREGISTER 10 -#define DEREGISTER_SENT 11 -#define DEREGISTER_FAILED 12 -#define DEREGISTERED 13 -#if LWM2M_QUEUE_MODE_ENABLED -#define QUEUE_MODE_AWAKE 14 -#define QUEUE_MODE_SEND_UPDATE 15 -#endif - -#define FLAG_RD_DATA_DIRTY 0x01 -#define FLAG_RD_DATA_UPDATE_TRIGGERED 0x02 -#define FLAG_RD_DATA_UPDATE_ON_DIRTY 0x10 - -LIST(session_info_list); - -/* Shared by all sessions, used by only one at a time in the FSM */ -static char query_data[64]; /* allocate some data for queries and updates */ -static uint8_t rd_data[128]; /* allocate some data for the RD */ - -static coap_timer_t rd_timer; /* Timer to tick the FSM periodically */ -static char default_ep[20]; - -#if LWM2M_QUEUE_MODE_ENABLED -static coap_timer_t queue_mode_client_awake_timer; /* Timer to control the client's - * awake time - */ -static uint8_t queue_mode_client_awake; /* 1 - client is awake, - * 0 - client is sleeping - */ -static uint16_t queue_mode_client_awake_time; /* The time to be awake */ -/* Callback for the client awake timer */ -static void queue_mode_awake_timer_callback(coap_timer_t *timer); -#endif - -static void check_periodic_observations(); -static void update_callback(coap_callback_request_state_t *callback_state); -/*---------------------------------------------------------------------------*/ -static int -set_rd_data(lwm2m_session_info_t *session_info) -{ - lwm2m_buffer_t outbuf; - - /* setup the output buffer */ - outbuf.buffer = rd_data; - outbuf.size = sizeof(rd_data); - outbuf.len = 0; - - /* this will also set the request payload */ - session_info->rd_more = lwm2m_engine_set_rd_data(&outbuf, 0); - coap_set_payload(session_info->request, rd_data, outbuf.len); - - if(session_info->rd_more) { - /* set the first block here */ - LOG_DBG("Setting block1 in request\n"); - coap_set_header_block1(session_info->request, 0, 1, sizeof(rd_data)); - } - return outbuf.len; -} -/*---------------------------------------------------------------------------*/ -static void -prepare_update(lwm2m_session_info_t *session_info, int triggered) -{ - coap_init_message(session_info->request, COAP_TYPE_CON, COAP_POST, 0); - coap_set_header_uri_path(session_info->request, session_info->assigned_ep); - - snprintf(query_data, sizeof(query_data) - 1, "?lt=%d&b=%s", session_info->lifetime, session_info->binding); - LOG_DBG("UPDATE:%s %s\n", session_info->assigned_ep, query_data); - coap_set_header_uri_query(session_info->request, query_data); - - if((triggered || session_info->rd_flags & FLAG_RD_DATA_UPDATE_ON_DIRTY) && (session_info->rd_flags & FLAG_RD_DATA_DIRTY)) { - session_info->rd_flags &= ~FLAG_RD_DATA_DIRTY; - set_rd_data(session_info); - session_info->rd_callback = update_callback; - } -} -/*---------------------------------------------------------------------------*/ -static int -has_network_access(void) -{ -#if UIP_CONF_IPV6_RPL -/* NATIVE PLATFORM is not really running RPL */ -#ifndef CONTIKI_TARGET_NATIVE - if(rpl_get_any_dag() == NULL) { - return 0; - } -#endif -#endif /* UIP_CONF_IPV6_RPL */ - return 1; -} -/*---------------------------------------------------------------------------*/ -int -lwm2m_rd_client_is_registered(lwm2m_session_info_t *session_info) -{ - return session_info->rd_state == REGISTRATION_DONE || session_info->rd_state == UPDATE_SENT; -} -/*---------------------------------------------------------------------------*/ -/* will take another argument when we support multiple sessions */ -void -lwm2m_rd_client_set_session_callback(lwm2m_session_info_t *session_info, session_callback_t cb) -{ - session_info->callback = cb; -} -/*---------------------------------------------------------------------------*/ -static void -perform_session_callback(lwm2m_session_info_t *session_info, int state) -{ - if(session_info->callback != NULL) { - LOG_DBG("Performing session callback: %d cb:%p\n", - state, session_info->callback); - session_info->callback(session_info, state); - } -} -/*---------------------------------------------------------------------------*/ -uint16_t -lwm2m_rd_client_get_lifetime(lwm2m_session_info_t *session_info) -{ - return session_info->lifetime; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_set_lifetime(lwm2m_session_info_t *session_info, uint16_t lifetime) -{ - if(lifetime > 0) { - session_info->lifetime = lifetime; - } else { - session_info->lifetime = LWM2M_DEFAULT_CLIENT_LIFETIME; - } -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_set_endpoint_name(lwm2m_session_info_t *session_info, const char *endpoint) -{ - if(endpoint != NULL) { - session_info->ep = endpoint; - } -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_set_default_endpoint_name(const char *endpoint) -{ - strncpy(default_ep, endpoint, sizeof(default_ep) - 1); - default_ep[sizeof(default_ep) - 1] = '\0'; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_set_update_rd(void) -{ - lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); - while(session_info != NULL) { - session_info->rd_flags |= FLAG_RD_DATA_DIRTY; - session_info = session_info->next; - } -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_set_automatic_update(lwm2m_session_info_t *session_info, int update) -{ - session_info->rd_flags = (session_info->rd_flags & ~FLAG_RD_DATA_UPDATE_ON_DIRTY) | - (update != 0 ? FLAG_RD_DATA_UPDATE_ON_DIRTY : 0); -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_register_with_server(lwm2m_session_info_t *session_info, - const coap_endpoint_t *server, - lwm2m_rd_client_server_type_t server_type) -{ - if(session_info->ep == NULL) { - session_info->ep = default_ep; - } - /* default binding U = UDP, UQ = UDP Q-mode*/ -#if LWM2M_QUEUE_MODE_CONF_ENABLED - session_info->binding = "UQ"; - /* Enough margin to ensure that the client is not unregistered (we - * do not know the time it can stay awake) - */ - session_info->lifetime = (LWM2M_QUEUE_MODE_DEFAULT_CLIENT_SLEEP_TIME / 1000) * 2; -#else - session_info->binding = "U"; - if(session_info->lifetime == 0) { - session_info->lifetime = LWM2M_DEFAULT_CLIENT_LIFETIME; - } -#endif /* LWM2M_QUEUE_MODE_CONF_ENABLED */ - - session_info->rd_flags = FLAG_RD_DATA_UPDATE_ON_DIRTY; - session_info->has_bs_server_info = 0; - session_info->has_registration_server_info = 0; - session_info->wait_until_network_check = 0; - session_info->last_update = 0; - session_info->last_rd_progress = 0; - session_info->bootstrapped = 0; - session_info->rd_state = INIT; - - if(server_type == LWM2M_RD_CLIENT_BOOTSTRAP_SERVER) { - coap_endpoint_copy(&session_info->bs_server_ep, server); - session_info->has_bs_server_info = 1; - session_info->use_server_type = LWM2M_RD_CLIENT_BOOTSTRAP_SERVER; - } else { - coap_endpoint_copy(&session_info->server_ep, server); - session_info->use_server_type = LWM2M_RD_CLIENT_LWM2M_SERVER; - session_info->has_registration_server_info = 1; - } - - list_add(session_info_list, session_info); /* Add to the list of sessions */ -} -/*---------------------------------------------------------------------------*/ -int -lwm2m_rd_client_deregister(lwm2m_session_info_t *session_info) -{ - if(lwm2m_rd_client_is_registered(session_info)) { - session_info->rd_state = DEREGISTER; - return 1; - } - /* Not registered */ - return 0; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_session_info_t * -get_session_info_from_server_ep(const coap_endpoint_t *server_ep) -{ - lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); - while(session_info != NULL) { - if(coap_endpoint_cmp(&session_info->server_ep, server_ep)) { - return session_info; - } - session_info = session_info->next; - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_update_triggered(const coap_endpoint_t *server_ep) -{ - lwm2m_session_info_t *session_info = get_session_info_from_server_ep(server_ep); - if(session_info) { - session_info->rd_flags |= FLAG_RD_DATA_UPDATE_TRIGGERED; - } - /* Here we need to do an CoAP timer poll - to get a quick request transmission! */ -} -/*---------------------------------------------------------------------------*/ -/* - * A client initiated bootstrap starts with a POST to /bs?ep={session_info.ep}, - * on the bootstrap server. The server should reply with 2.04. - * The server will thereafter do DELETE and or PUT to write new client objects. - * The bootstrap finishes with the server doing POST to /bs on the client. - * - * Page 64 in 07 April 2016 spec. - * - * TODO - */ -static void -bootstrap_callback(coap_callback_request_state_t *callback_state) -{ - coap_request_state_t *state = &callback_state->state; - LOG_DBG("Bootstrap callback Response: %d, ", state->response != NULL); - - lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)state->user_data; - - if(state->status == COAP_REQUEST_STATUS_RESPONSE) { - if(CHANGED_2_04 == state->response->code) { - LOG_DBG_("Considered done!\n"); - session_info->rd_state = BOOTSTRAP_DONE; - return; - } - /* Possible error response codes are 4.00 Bad request & 4.15 Unsupported content format */ - LOG_DBG_("Failed with code %d. Retrying\n", state->response->code); - /* TODO Application callback? */ - session_info->rd_state = INIT; - } else if(state->status == COAP_REQUEST_STATUS_TIMEOUT) { - LOG_DBG_("Server not responding! Retry?"); - session_info->rd_state = DO_BOOTSTRAP; - } else if(state->status == COAP_REQUEST_STATUS_FINISHED) { - LOG_DBG_("Request finished. Ignore\n"); - } else { - LOG_DBG_("Unexpected error! Retry?"); - session_info->rd_state = DO_BOOTSTRAP; - } -} -/*---------------------------------------------------------------------------*/ -static void -produce_more_rd(lwm2m_session_info_t *session_info) -{ - lwm2m_buffer_t outbuf; - - LOG_DBG("GOT Continue!\n"); - - /* setup the output buffer */ - outbuf.buffer = rd_data; - outbuf.size = sizeof(rd_data); - outbuf.len = 0; - - session_info->rd_block1++; - - /* this will also set the request payload */ - session_info->rd_more = lwm2m_engine_set_rd_data(&outbuf, session_info->rd_block1); - coap_set_payload(session_info->request, rd_data, outbuf.len); - - LOG_DBG("Setting block1 in request - block: %d more: %d\n", - (int)session_info->rd_block1, (int)session_info->rd_more); - coap_set_header_block1(session_info->request, session_info->rd_block1, session_info->rd_more, sizeof(rd_data)); - - coap_send_request(&session_info->rd_request_state, &session_info->server_ep, session_info->request, session_info->rd_callback); -} -/*---------------------------------------------------------------------------*/ -static void -block1_rd_callback(coap_timer_t *timer) -{ - produce_more_rd((lwm2m_session_info_t *)timer->user_data); -} -/*---------------------------------------------------------------------------*/ -/* - * Page 65-66 in 07 April 2016 spec. - */ -static void -registration_callback(coap_callback_request_state_t *callback_state) -{ - coap_request_state_t *state = &callback_state->state; - LOG_DBG("Registration callback. Status: %d. Response: %d, ", state->status, state->response != NULL); - lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)state->user_data; - - if(state->status == COAP_REQUEST_STATUS_RESPONSE) { - /* check state and possibly set registration to done */ - /* If we get a continue - we need to call the rd generator one more time */ - - if(CONTINUE_2_31 == state->response->code) { - /* We assume that size never change?! */ - coap_get_header_block1(state->response, &session_info->rd_block1, NULL, NULL, NULL); - coap_timer_set_user_data(&session_info->block1_timer, (void *)session_info); - coap_timer_set_callback(&session_info->block1_timer, block1_rd_callback); - coap_timer_set(&session_info->block1_timer, 1); /* delay 1 ms */ - LOG_DBG_("Continue\n"); - } else if(CREATED_2_01 == state->response->code) { - if(state->response->location_path_len < LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN) { - memcpy(session_info->assigned_ep, state->response->location_path, - state->response->location_path_len); - session_info->assigned_ep[state->response->location_path_len] = 0; - /* if we decide to not pass the lt-argument on registration, we should force an initial "update" to register lifetime with server */ -#if LWM2M_QUEUE_MODE_ENABLED -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION - if(lwm2m_queue_mode_get_dynamic_adaptation_flag()) { - lwm2m_queue_mode_set_first_request(); - } -#endif - lwm2m_rd_client_fsm_execute_queue_mode_awake(session_info); /* Avoid 500 ms delay and move directly to the state*/ -#else - session_info->rd_state = REGISTRATION_DONE; -#endif - /* remember the last reg time */ - session_info->last_update = coap_timer_uptime(); - LOG_DBG_("Done (assigned EP='%s')!\n", session_info->assigned_ep); - perform_session_callback(session_info, LWM2M_RD_CLIENT_REGISTERED); - return; - } - - LOG_DBG_("failed to handle assigned EP: '"); - LOG_DBG_COAP_STRING(state->response->location_path, - state->response->location_path_len); - LOG_DBG_("'. Re-init network.\n"); - } else { - /* Possible error response codes are 4.00 Bad request & 4.03 Forbidden */ - LOG_DBG_("failed with code %d. Re-init network\n", state->response->code); - } - /* TODO Application callback? */ - session_info->rd_state = INIT; - } else if(state->status == COAP_REQUEST_STATUS_TIMEOUT) { - LOG_DBG_("Server not responding, trying to reconnect\n"); - session_info->rd_state = INIT; - } else if(state->status == COAP_REQUEST_STATUS_FINISHED) { - LOG_DBG_("Request finished. Ignore\n"); - } else { - LOG_DBG_("Unexpected error, trying to reconnect\n"); - session_info->rd_state = INIT; - } -} -/*---------------------------------------------------------------------------*/ -/* - * Page 65-66 in 07 April 2016 spec. - */ -static void -update_callback(coap_callback_request_state_t *callback_state) -{ - coap_request_state_t *state = &callback_state->state; - LOG_DBG("Update callback. Status: %d. Response: %d, ", state->status, state->response != NULL); - - lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)state->user_data; - - if(state->status == COAP_REQUEST_STATUS_RESPONSE) { - /* If we get a continue - we need to call the rd generator one more time */ - if(CONTINUE_2_31 == state->response->code) { - /* We assume that size never change?! */ - LOG_DBG_("Continue\n"); - coap_get_header_block1(state->response, &session_info->rd_block1, NULL, NULL, NULL); - coap_timer_set_callback(&session_info->block1_timer, block1_rd_callback); - coap_timer_set(&session_info->block1_timer, 1); /* delay 1 ms */ - } else if(CHANGED_2_04 == state->response->code) { - LOG_DBG_("Done!\n"); - /* remember the last reg time */ - session_info->last_update = coap_timer_uptime(); -#if LWM2M_QUEUE_MODE_ENABLED - /* If it has been waked up by a notification, send the stored notifications in queue */ - if(lwm2m_queue_mode_is_waked_up_by_notification()) { - - lwm2m_queue_mode_clear_waked_up_by_notification(); - lwm2m_notification_queue_send_notifications(); - } -#if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION - if(lwm2m_queue_mode_get_dynamic_adaptation_flag()) { - lwm2m_queue_mode_set_first_request(); - } -#endif /* LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION */ - lwm2m_rd_client_fsm_execute_queue_mode_awake(session_info); /* Avoid 500 ms delay and move directly to the state*/ -#else - - session_info->rd_state = REGISTRATION_DONE; - session_info->rd_flags &= ~FLAG_RD_DATA_UPDATE_TRIGGERED; -#endif /* LWM2M_QUEUE_MODE_DEFAULT_CLIENT_SLEEP_TIME */ - } else { - /* Possible error response codes are 4.00 Bad request & 4.04 Not Found */ - LOG_DBG_("Failed with code %d. Retrying registration\n", - state->response->code); - session_info->rd_state = DO_REGISTRATION; - } - } else if(state->status == COAP_REQUEST_STATUS_TIMEOUT) { - LOG_DBG_("Server not responding, trying to reconnect\n"); - session_info->rd_state = INIT; - } else if(state->status == COAP_REQUEST_STATUS_FINISHED) { - LOG_DBG_("Request finished. Ignore\n"); - } else { - LOG_DBG_("Unexpected error, trying to reconnect\n"); - session_info->rd_state = INIT; - } -} -/*---------------------------------------------------------------------------*/ -static void -deregister_callback(coap_callback_request_state_t *callback_state) -{ - coap_request_state_t *state = &callback_state->state; - LOG_DBG("Deregister callback. Status: %d. Response Code: %d\n", - state->status, - state->response != NULL ? state->response->code : 0); - - lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)state->user_data; - - if(state->status == COAP_REQUEST_STATUS_RESPONSE && (DELETED_2_02 == state->response->code)) { - LOG_DBG("Deregistration success\n"); - session_info->rd_state = DEREGISTERED; - perform_session_callback(session_info, LWM2M_RD_CLIENT_DEREGISTERED); - } else { - LOG_DBG("Deregistration failed\n"); - if(session_info->rd_state == DEREGISTER_SENT) { - session_info->rd_state = DEREGISTER_FAILED; - perform_session_callback(session_info, LWM2M_RD_CLIENT_DEREGISTER_FAILED); - } - } -} -/*---------------------------------------------------------------------------*/ -#if LWM2M_QUEUE_MODE_ENABLED -static int -all_sessions_in_queue_mode_state(void) -{ - lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); - while(session_info != NULL) { - if(((session_info->rd_state & 0xF) != 0xE)) { - return 0; - } - session_info = session_info->next; - } - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -all_sessions_in_queue_mode_awake(void) -{ - lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); - while(session_info != NULL) { - if(session_info->rd_state != QUEUE_MODE_AWAKE) { - return 0; - } - session_info = session_info->next; - } - return 1; -} -#endif /* LWM2M_QUEUE_MODE_ENABLED */ -/*---------------------------------------------------------------------------*/ -/* CoAP timer callback */ -static void -periodic_process(coap_timer_t *timer) -{ - uint64_t now; - - /* reschedule the CoAP timer */ -#if LWM2M_QUEUE_MODE_ENABLED - /* In Queue Mode, the machine is not executed periodically, but with the awake/sleeping times */ - if(!all_sessions_in_queue_mode_state()) { - coap_timer_reset(&rd_timer, STATE_MACHINE_UPDATE_INTERVAL); - } -#else - coap_timer_reset(&rd_timer, STATE_MACHINE_UPDATE_INTERVAL); -#endif - - now = coap_timer_uptime(); - - lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); - while(session_info != NULL) { - - LOG_DBG("RD Client with assigned ep: %s - state: %d, ms: %lu\n", session_info->assigned_ep, session_info->rd_state, - (unsigned long)coap_timer_uptime()); - - switch(session_info->rd_state) { - case INIT: - LOG_DBG("RD Client started with endpoint '%s' and client lifetime %d\n", session_info->ep, session_info->lifetime); - session_info->rd_state = WAIT_NETWORK; - break; - case WAIT_NETWORK: - if(now > session_info->wait_until_network_check) { - /* check each 10 seconds before next check */ - LOG_DBG("Checking for network... %lu\n", - (unsigned long)session_info->wait_until_network_check); - session_info->wait_until_network_check = now + 10000; - if(has_network_access()) { - /* Either do bootstrap then registration */ - if(session_info->use_server_type == LWM2M_RD_CLIENT_BOOTSTRAP_SERVER) { - session_info->rd_state = DO_BOOTSTRAP; - } else { - session_info->rd_state = DO_REGISTRATION; - } - } - /* Otherwise wait until for a network to join */ - } - break; - case DO_BOOTSTRAP: - if(session_info->use_server_type == LWM2M_RD_CLIENT_BOOTSTRAP_SERVER && - session_info->bootstrapped == 0 && - session_info->has_bs_server_info) { - - /* prepare request, TID is set by COAP_BLOCKING_REQUEST() */ - coap_init_message(session_info->request, COAP_TYPE_CON, COAP_POST, 0); - coap_set_header_uri_path(session_info->request, "/bs"); - - snprintf(query_data, sizeof(query_data) - 1, "?ep=%s", session_info->ep); - coap_set_header_uri_query(session_info->request, query_data); - LOG_INFO("Registering ID with bootstrap server ["); - LOG_INFO_COAP_EP(&session_info->bs_server_ep); - LOG_INFO_("] as '%s'\n", query_data); - /* Add session info as user data to use it in the callbacks */ - session_info->rd_request_state.state.user_data = (void *)session_info; - if(coap_send_request(&session_info->rd_request_state, &session_info->bs_server_ep, - session_info->request, bootstrap_callback)) { - session_info->rd_state = BOOTSTRAP_SENT; - } - } - break; - case BOOTSTRAP_SENT: - /* Just wait for bootstrap to be done... */ - break; - case BOOTSTRAP_DONE: - /* check that we should still use bootstrap */ - if(session_info->use_server_type == LWM2M_RD_CLIENT_BOOTSTRAP_SERVER) { - lwm2m_security_server_t *security; - LOG_DBG("*** Bootstrap - checking for server info...\n"); - /* get the security object - ignore bootstrap servers */ - for(security = lwm2m_security_get_first(); - security != NULL; - security = lwm2m_security_get_next(security)) { - if(security->bootstrap == 0) { - break; - } - } - - if(security != NULL) { - /* get the server URI */ - if(security->server_uri_len > 0) { - uint8_t secure = 0; - - LOG_DBG("**** Found security instance using: "); - LOG_DBG_COAP_STRING((const char *)security->server_uri, - security->server_uri_len); - LOG_DBG_(" (len %d) \n", security->server_uri_len); - /* TODO Should verify it is a URI */ - /* Check if secure */ - secure = strncmp((const char *)security->server_uri, - "coaps:", 6) == 0; - - if(!coap_endpoint_parse((const char *)security->server_uri, - security->server_uri_len, - &session_info->server_ep)) { - LOG_DBG("Failed to parse server URI!\n"); - } else { - LOG_DBG("Server address:"); - LOG_DBG_COAP_EP(&session_info->server_ep); - LOG_DBG_("\n"); - if(secure) { - LOG_DBG("Secure CoAP requested but not supported - can not bootstrap\n"); - } else { - lwm2m_rd_client_register_with_server(session_info, &session_info->server_ep, LWM2M_RD_CLIENT_LWM2M_SERVER); - session_info->bootstrapped++; - } - } - } else { - LOG_DBG("** failed to parse URI "); - LOG_DBG_COAP_STRING((const char *)security->server_uri, - security->server_uri_len); - LOG_DBG_("\n"); - } - } - - /* if we did not register above - then fail this and restart... */ - if(session_info->bootstrapped == 0) { - /* Not ready. Lets retry with the bootstrap server again */ - session_info->rd_state = DO_BOOTSTRAP; - } else { - session_info->rd_state = DO_REGISTRATION; - } - } - break; - case DO_REGISTRATION: - if(!coap_endpoint_is_connected(&session_info->server_ep)) { - /* Not connected... wait a bit... and retry connection */ - coap_endpoint_connect(&session_info->server_ep); - LOG_DBG("Wait until connected... \n"); - return; - } - - if(session_info->use_server_type == LWM2M_RD_CLIENT_LWM2M_SERVER && - !lwm2m_rd_client_is_registered(session_info) && - session_info->has_registration_server_info) { - int len; - - /* prepare request, TID was set by COAP_BLOCKING_REQUEST() */ - coap_init_message(session_info->request, COAP_TYPE_CON, COAP_POST, 0); - coap_set_header_uri_path(session_info->request, "/rd"); - - snprintf(query_data, sizeof(query_data) - 1, "?ep=%s<=%d&b=%s", session_info->ep, session_info->lifetime, session_info->binding); - coap_set_header_uri_query(session_info->request, query_data); - - len = set_rd_data(session_info); - session_info->rd_callback = registration_callback; - - LOG_INFO("Registering with ["); - LOG_INFO_COAP_EP(&session_info->server_ep); - LOG_INFO_("] lwm2m endpoint '%s': '", query_data); - if(len) { - LOG_INFO_COAP_STRING((const char *)rd_data, len); - } - LOG_INFO_("' More:%d\n", session_info->rd_more); - - /* Add session info as user data to use it in the callbacks */ - session_info->rd_request_state.state.user_data = (void *)session_info; - if(coap_send_request(&session_info->rd_request_state, &session_info->server_ep, - session_info->request, registration_callback)) { - - session_info->rd_state = REGISTRATION_SENT; - } - session_info->last_rd_progress = coap_timer_uptime(); - } - break; - case REGISTRATION_SENT: - /* just wait until the callback kicks us to the next state... */ - break; - case REGISTRATION_DONE: - /* All is done! */ - - check_periodic_observations(); /* TODO: manage periodic observations */ - - /* check if it is time for the next update */ - if((session_info->rd_flags & FLAG_RD_DATA_UPDATE_TRIGGERED) || - ((uint32_t)session_info->lifetime * 500) <= now - session_info->last_update) { - /* triggered or time to send an update to the server, at half-time! sec vs ms */ - prepare_update(session_info, session_info->rd_flags & FLAG_RD_DATA_UPDATE_TRIGGERED); - - /* Add session info as user data to use it in the callbacks */ - session_info->rd_request_state.state.user_data = (void *)session_info; - if(coap_send_request(&session_info->rd_request_state, &session_info->server_ep, session_info->request, - update_callback)) { - session_info->rd_state = UPDATE_SENT; - } - session_info->last_rd_progress = coap_timer_uptime(); - } - break; - -#if LWM2M_QUEUE_MODE_ENABLED - case QUEUE_MODE_AWAKE: - LOG_DBG("Queue Mode: Client is AWAKE at %lu\n", (unsigned long)coap_timer_uptime()); - if((queue_mode_client_awake = all_sessions_in_queue_mode_awake())) { - queue_mode_client_awake_time = lwm2m_queue_mode_get_awake_time(); - coap_timer_set(&queue_mode_client_awake_timer, queue_mode_client_awake_time); - } - break; - case QUEUE_MODE_SEND_UPDATE: - /* Define this macro to make the necessary actions for waking up, - * depending on the platform - */ -#ifdef LWM2M_QUEUE_MODE_WAKE_UP - LWM2M_QUEUE_MODE_WAKE_UP(); -#endif /* LWM2M_QUEUE_MODE_WAKE_UP */ - prepare_update(session_info, session_info->rd_flags & FLAG_RD_DATA_UPDATE_TRIGGERED); - /* Add session info as user data to use it in the callbacks */ - session_info->rd_request_state.state.user_data = (void *)session_info; - if(coap_send_request(&session_info->rd_request_state, &session_info->server_ep, session_info->request, - update_callback)) { - session_info->rd_state = UPDATE_SENT; - } - session_info->last_rd_progress = coap_timer_uptime(); - break; -#endif /* LWM2M_QUEUE_MODE_ENABLED */ - - case UPDATE_SENT: - /* just wait until the callback kicks us to the next state... */ - break; - case DEREGISTER: - LOG_INFO("DEREGISTER %s\n", session_info->assigned_ep); - coap_init_message(session_info->request, COAP_TYPE_CON, COAP_DELETE, 0); - coap_set_header_uri_path(session_info->request, session_info->assigned_ep); - - /* Add session info as user data to use it in the callbacks */ - session_info->rd_request_state.state.user_data = (void *)session_info; - if(coap_send_request(&session_info->rd_request_state, &session_info->server_ep, session_info->request, - deregister_callback)) { - session_info->rd_state = DEREGISTER_SENT; - } - break; - case DEREGISTER_SENT: - break; - case DEREGISTER_FAILED: - break; - case DEREGISTERED: - break; - - default: - LOG_WARN("Unhandled state: %d\n", session_info->rd_state); - } - session_info = session_info->next; - } -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_init(const char *ep) -{ - lwm2m_rd_client_set_default_endpoint_name(ep); - - /* call the RD client periodically */ - coap_timer_set_callback(&rd_timer, periodic_process); - coap_timer_set(&rd_timer, STATE_MACHINE_UPDATE_INTERVAL); -#if LWM2M_QUEUE_MODE_ENABLED - coap_timer_set_callback(&queue_mode_client_awake_timer, queue_mode_awake_timer_callback); -#endif -} -/*---------------------------------------------------------------------------*/ -static void -check_periodic_observations(void) -{ -/* TODO */ -} -/*---------------------------------------------------------------------------*/ -/* - * Queue Mode Support - */ -#if LWM2M_QUEUE_MODE_ENABLED -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_restart_client_awake_timer(void) -{ - coap_timer_set(&queue_mode_client_awake_timer, queue_mode_client_awake_time); -} -/*---------------------------------------------------------------------------*/ -uint8_t -lwm2m_rd_client_is_client_awake(void) -{ - return queue_mode_client_awake; -} -/*---------------------------------------------------------------------------*/ -static void -queue_mode_awake_timer_callback(coap_timer_t *timer) -{ - /* Timer has expired, no requests has been received, client can go to sleep */ - LOG_DBG("Queue Mode: Client is SLEEPING at %lu\n", (unsigned long)coap_timer_uptime()); - queue_mode_client_awake = 0; - - lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); - while(session_info != NULL) { - session_info->rd_state = QUEUE_MODE_SEND_UPDATE; - session_info = session_info->next; - } - coap_timer_set(&rd_timer, lwm2m_queue_mode_get_sleep_time()); - /* Define this macro to enter sleep mode depending on the platform */ -#ifdef LWM2M_QUEUE_MODE_SLEEP_MS - LWM2M_QUEUE_MODE_SLEEP_MS(lwm2m_queue_mode_get_sleep_time()); -#endif /* LWM2M_QUEUE_MODE_SLEEP_MS */ -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_fsm_execute_queue_mode_awake(lwm2m_session_info_t *session_info) -{ - coap_timer_stop(&rd_timer); - session_info->rd_state = QUEUE_MODE_AWAKE; - periodic_process(&rd_timer); -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_fsm_execute_queue_mode_update(lwm2m_session_info_t *session_info) -{ - coap_timer_stop(&rd_timer); - session_info->rd_state = QUEUE_MODE_SEND_UPDATE; - periodic_process(&rd_timer); -} -/*---------------------------------------------------------------------------*/ -#endif /* LWM2M_QUEUE_MODE_ENABLED */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-rd-client.h b/os/services/lwm2m/lwm2m-rd-client.h deleted file mode 100644 index 58fa0a8c2..000000000 --- a/os/services/lwm2m/lwm2m-rd-client.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2016-2018, SICS Swedish ICT AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - */ - -/** - * \file - * Header file for the Contiki OMA LWM2M Registration and Bootstrap - * Client. - * \author - * Joakim Eriksson - * Niclas Finne - * Carlos Gonzalo Peces - */ - -#ifndef LWM2M_RD_CLIENT_H_ -#define LWM2M_RD_CLIENT_H_ - -/* The type of server to use for registration: bootstrap or LWM2M */ -typedef enum { - LWM2M_RD_CLIENT_BOOTSTRAP_SERVER, - LWM2M_RD_CLIENT_LWM2M_SERVER -} lwm2m_rd_client_server_type_t; - -/* Session callback states */ -#define LWM2M_RD_CLIENT_BOOTSTRAPPED 1 -#define LWM2M_RD_CLIENT_REGISTERED 2 -#define LWM2M_RD_CLIENT_DEREGISTERED 3 -#define LWM2M_RD_CLIENT_DEREGISTER_FAILED 4 -#define LWM2M_RD_CLIENT_DISCONNECTED 5 - -#include "lwm2m-object.h" -#include "lwm2m-queue-mode-conf.h" -#include "coap-endpoint.h" -#include "coap-callback-api.h" - -struct lwm2m_session_info; -typedef void (*session_callback_t)(struct lwm2m_session_info *session, int status); - -#ifndef LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN -#define LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN 15 -#endif /* LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN */ -/*---------------------------------------------------------------------------*/ -/*- Server session----------------------------*/ -/*---------------------------------------------------------------------------*/ -typedef struct lwm2m_session_info { - - struct lwm2m_session_info *next; - /* Information */ - const char *ep; - const char *binding; - char assigned_ep[LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN]; - uint16_t lifetime; - coap_endpoint_t bs_server_ep; - coap_endpoint_t server_ep; - lwm2m_rd_client_server_type_t use_server_type; - uint8_t has_bs_server_info; - uint8_t has_registration_server_info; - uint8_t bootstrapped; /* bootstrap done */ - session_callback_t callback; - - /* CoAP Request */ - coap_callback_request_state_t rd_request_state; - coap_message_t request[1]; /* This way the message can be treated as pointer as usual. */ - - /* RD parameters */ - uint8_t rd_state; - uint8_t rd_flags; - uint64_t wait_until_network_check; - uint64_t last_update; - uint64_t last_rd_progress; - - /* Blosk Transfer */ - uint32_t rd_block1; - uint8_t rd_more; - void (*rd_callback)(coap_callback_request_state_t *state); - coap_timer_t block1_timer; -} lwm2m_session_info_t; - -int lwm2m_rd_client_is_registered(lwm2m_session_info_t *session_info); -void lwm2m_rd_client_register_with_server(lwm2m_session_info_t *session_info, const coap_endpoint_t *server, lwm2m_rd_client_server_type_t server_type); -uint16_t lwm2m_rd_client_get_lifetime(lwm2m_session_info_t *session_info); -void lwm2m_rd_client_set_lifetime(lwm2m_session_info_t *session_info, uint16_t lifetime); -void lwm2m_rd_client_set_endpoint_name(lwm2m_session_info_t *session_info, const char *endpoint); -void lwm2m_rd_client_set_default_endpoint_name(const char *endpoint); - -/* Indicate that something in the object list have changed */ -void lwm2m_rd_client_set_update_rd(void); -/* Control if the object list should be automatically updated at updates of lifetime */ -void lwm2m_rd_client_set_automatic_update(lwm2m_session_info_t *session_info, int update); -/* trigger an immediate update */ -void lwm2m_rd_client_update_triggered(const coap_endpoint_t *server_ep); - -int lwm2m_rd_client_deregister(lwm2m_session_info_t *session_info); -void lwm2m_rd_client_init(const char *ep); - -void lwm2m_rd_client_set_session_callback(lwm2m_session_info_t *session_info, session_callback_t cb); - -#if LWM2M_QUEUE_MODE_ENABLED -uint8_t lwm2m_rd_client_is_client_awake(void); -void lwm2m_rd_client_restart_client_awake_timer(void); -void lwm2m_rd_client_fsm_execute_queue_mode_awake(); -void lwm2m_rd_client_fsm_execute_queue_mode_update(); -#endif - -#endif /* LWM2M_RD_CLIENT_H_ */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-security.c b/os/services/lwm2m/lwm2m-security.c deleted file mode 100644 index e4275f280..000000000 --- a/os/services/lwm2m/lwm2m-security.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - * - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M security - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include -#include -#include -#include "lwm2m-object.h" -#include "lwm2m-engine.h" -#include "lwm2m-server.h" -#include "lwm2m-security.h" -#include "coap-keystore.h" -#include "lib/list.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-sec" -#define LOG_LEVEL LOG_LEVEL_LWM2M - -#define MAX_COUNT LWM2M_SERVER_MAX_COUNT - -static lwm2m_status_t lwm2m_callback(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx); - -static lwm2m_object_instance_t *get_by_id(uint16_t instance_id, - lwm2m_status_t *status); - -static const lwm2m_resource_id_t resources[] = { - LWM2M_SECURITY_SERVER_URI_ID, LWM2M_SECURITY_BOOTSTRAP_SERVER_ID, - LWM2M_SECURITY_MODE_ID, LWM2M_SECURITY_CLIENT_PKI_ID, - LWM2M_SECURITY_SERVER_PKI_ID, LWM2M_SECURITY_KEY_ID, - LWM2M_SECURITY_SHORT_SERVER_ID -}; - -LIST(instances_list); -static lwm2m_security_server_t instances[MAX_COUNT]; -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -create_instance(uint16_t instance_id, lwm2m_status_t *status) -{ - lwm2m_object_instance_t *instance; - int i; - - instance = get_by_id(instance_id, NULL); - if(instance != NULL) { - /* An instance with this id is already registered */ - if(status) { - *status = LWM2M_STATUS_OPERATION_NOT_ALLOWED; - } - return NULL; - } - - for(i = 0; i < MAX_COUNT; i++) { - if(instances[i].instance.instance_id == LWM2M_OBJECT_INSTANCE_NONE) { - memset(&instances[i], 0, sizeof(instances[i])); - instances[i].instance.callback = lwm2m_callback; - instances[i].instance.object_id = LWM2M_OBJECT_SECURITY_ID; - instances[i].instance.instance_id = instance_id; - instances[i].instance.resource_ids = resources; - instances[i].instance.resource_count = - sizeof(resources) / sizeof(lwm2m_resource_id_t); - list_add(instances_list, &instances[i].instance); - - LOG_DBG("Create new security instance %u\n", instance_id); - return &instances[i].instance; - } - } - - if(status) { - *status = LWM2M_STATUS_SERVICE_UNAVAILABLE; - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -static int -delete_instance(uint16_t instance_id, lwm2m_status_t *status) -{ - lwm2m_object_instance_t *instance; - - if(instance_id == LWM2M_OBJECT_INSTANCE_NONE) { - /* Remove all instances */ - while((instance = list_pop(instances_list)) != NULL) { - instance->instance_id = LWM2M_OBJECT_INSTANCE_NONE; - } - return 1; - } - - instance = get_by_id(instance_id, NULL); - if(instance != NULL) { - instance->instance_id = LWM2M_OBJECT_INSTANCE_NONE; - list_remove(instances_list, instance); - return 1; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -get_first(lwm2m_status_t *status) -{ - return list_head(instances_list); -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -get_next(lwm2m_object_instance_t *instance, lwm2m_status_t *status) -{ - return instance == NULL ? NULL : instance->next; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -get_by_id(uint16_t instance_id, lwm2m_status_t *status) -{ - lwm2m_object_instance_t *instance; - for(instance = list_head(instances_list); - instance != NULL; - instance = instance->next) { - if(instance->instance_id == instance_id) { - return instance; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -lwm2m_callback(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx) -{ - /* NOTE: the create operation will only create an instance and should - avoid reading out data */ - int32_t value; - int iv; - lwm2m_security_server_t *security; - security = (lwm2m_security_server_t *) object; - - if(ctx->operation == LWM2M_OP_WRITE) { - /* Handle the writes */ - switch(ctx->resource_id) { - case LWM2M_SECURITY_SERVER_URI_ID: - LOG_DBG("Writing security URI value: len: %"PRId16"\n", ctx->inbuf->size); - value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->server_uri, LWM2M_SECURITY_URI_SIZE); - /* This is string... */ - security->server_uri_len = ctx->last_value_len; - break; - case LWM2M_SECURITY_BOOTSTRAP_SERVER_ID: - value = lwm2m_object_read_boolean(ctx, ctx->inbuf->buffer, ctx->inbuf->size, &iv); - if(value > 0) { - LOG_DBG("Set Bootstrap: %d\n", iv); - security->bootstrap = (uint8_t) iv; - } else { - LOG_WARN("Failed to set bootstrap\n"); - } - break; - case LWM2M_SECURITY_MODE_ID: - { - int32_t v2; - value = lwm2m_object_read_int(ctx, ctx->inbuf->buffer, ctx->inbuf->size, &v2); - LOG_DBG("Writing security MODE value: %"PRId32" len: %d\n", v2, - (int)ctx->inbuf->size); - security->security_mode = v2; - } - break; - case LWM2M_SECURITY_CLIENT_PKI_ID: - value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->public_key, LWM2M_SECURITY_KEY_SIZE); - security->public_key_len = ctx->last_value_len; - - LOG_DBG("Writing client PKI: len: %"PRIu16" '", ctx->last_value_len); - LOG_DBG_COAP_STRING((const char *)security->public_key, - ctx->last_value_len); - LOG_DBG_("'\n"); - break; - case LWM2M_SECURITY_KEY_ID: - value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->secret_key, LWM2M_SECURITY_KEY_SIZE); - security->secret_key_len = ctx->last_value_len; - - LOG_DBG("Writing secret key: len: %"PRIu16" '", ctx->last_value_len); - LOG_DBG_COAP_STRING((const char *)security->secret_key, - ctx->last_value_len); - LOG_DBG_("'\n"); - - break; - } - } else if(ctx->operation == LWM2M_OP_READ) { - switch(ctx->resource_id) { - case LWM2M_SECURITY_SERVER_URI_ID: - lwm2m_object_write_string(ctx, (const char *) security->server_uri, - security->server_uri_len); - break; - default: - return LWM2M_STATUS_ERROR; - } - } - return LWM2M_STATUS_OK; -} - -/*---------------------------------------------------------------------------*/ -lwm2m_security_server_t * -lwm2m_security_get_first(void) -{ - return list_head(instances_list); -} -/*---------------------------------------------------------------------------*/ -lwm2m_security_server_t * -lwm2m_security_get_next(lwm2m_security_server_t *last) -{ - return last == NULL ? NULL : (lwm2m_security_server_t *)last->instance.next; -} -/*---------------------------------------------------------------------------*/ -lwm2m_security_server_t * -lwm2m_security_add_server(uint16_t instance_id, - uint16_t server_id, - const uint8_t *server_uri, - uint8_t server_uri_len) -{ - lwm2m_security_server_t *server; - int i; - - if(server_uri_len > LWM2M_SECURITY_URI_SIZE) { - LOG_WARN("too long server URI: %u\n", server_uri_len); - return NULL; - } - - for(server = lwm2m_security_get_first(); - server != NULL; - server = lwm2m_security_get_next(server)) { - if(server->server_id == server_id) { - if(server->instance.instance_id != instance_id) { - LOG_WARN("wrong instance id\n"); - return NULL; - } - /* Correct server id and instance id */ - break; - } else if(server->instance.instance_id == instance_id) { - LOG_WARN("wrong server id\n"); - return NULL; - } - } - - if(server == NULL) { - for(i = 0; i < MAX_COUNT; i++) { - if(instances[i].instance.instance_id == LWM2M_OBJECT_INSTANCE_NONE) { - memset(&instances[i], 0, sizeof(instances[i])); - instances[i].instance.callback = lwm2m_callback; - instances[i].instance.object_id = LWM2M_OBJECT_SECURITY_ID; - instances[i].instance.instance_id = instance_id; - instances[i].instance.resource_ids = resources; - instances[i].instance.resource_count = - sizeof(resources) / sizeof(lwm2m_resource_id_t); - list_add(instances_list, &instances[i].instance); - server = &instances[i]; - } - } - if(server == NULL) { - LOG_WARN("no space for more servers\n"); - return NULL; - } - } - - memcpy(server->server_uri, server_uri, server_uri_len); - server->server_uri_len = server_uri_len; - - return server; -} -/*---------------------------------------------------------------------------*/ -int -lwm2m_security_set_server_psk(lwm2m_security_server_t *server, - const uint8_t *identity, - uint8_t identity_len, - const uint8_t *key, - uint8_t key_len) -{ - if(server == NULL || identity == NULL || key == NULL) { - return 0; - } - if(identity_len > LWM2M_SECURITY_KEY_SIZE) { - LOG_WARN("too large identity: %u\n", identity_len); - return 0; - } - if(key_len > LWM2M_SECURITY_KEY_SIZE) { - LOG_WARN("too large identity: %u\n", key_len); - return 0; - } - memcpy(server->public_key, identity, identity_len); - server->public_key_len = identity_len; - memcpy(server->secret_key, key, key_len); - server->secret_key_len = key_len; - - server->security_mode = LWM2M_SECURITY_MODE_PSK; - - return 1; -} -/*---------------------------------------------------------------------------*/ -static const lwm2m_object_impl_t impl = { - .object_id = LWM2M_OBJECT_SECURITY_ID, - .get_first = get_first, - .get_next = get_next, - .get_by_id = get_by_id, - .create_instance = create_instance, - .delete_instance = delete_instance, -}; -static lwm2m_object_t reg_object = { - .impl = &impl, -}; -/*---------------------------------------------------------------------------*/ -#ifdef WITH_DTLS -#if COAP_DTLS_KEYSTORE_CONF_WITH_LWM2M -static int -get_psk_info(const coap_endpoint_t *address_info, - coap_keystore_psk_entry_t *info) -{ - /* Find matching security object based on address */ - lwm2m_security_server_t *e; - coap_endpoint_t ep; - - if(info == NULL || address_info == NULL) { - return 0; - } - - for(e = lwm2m_security_get_first(); - e != NULL; - e = lwm2m_security_get_next(e)) { - if(e->server_uri_len == 0) { - continue; - } - if(e->security_mode != LWM2M_SECURITY_MODE_PSK) { - /* Only PSK supported for now */ - continue; - } - if(!coap_endpoint_parse((char *)e->server_uri, e->server_uri_len, &ep)) { - /* Failed to parse URI to endpoint */ - LOG_DBG("failed to parse server URI "); - LOG_DBG_COAP_STRING((char *)e->server_uri, e->server_uri_len); - LOG_DBG_("\n"); - continue; - } - if(!coap_endpoint_cmp(address_info, &ep)) { - /* Wrong server */ - LOG_DBG("wrong server "); - LOG_DBG_COAP_EP(address_info); - LOG_DBG_(" != "); - LOG_DBG_COAP_EP(&ep); - LOG_DBG_("\n"); - continue; - } - if(info->identity_len > 0 && info->identity != NULL) { - /* Searching for a specific identity */ - if(info->identity_len != e->public_key_len || - memcmp(info->identity, e->public_key, info->identity_len)) { - /* Identity not matching */ - LOG_DBG("identity not matching\n"); - continue; - } - } - /* Found security information for this server */ - LOG_DBG("found security match!\n"); - break; - } - - if(e == NULL) { - /* No matching security object found */ - return 0; - } - - if(info->identity == NULL || info->identity_len == 0) { - /* Identity requested */ - info->identity = e->public_key; - info->identity_len = e->public_key_len; - return 1; - } - - if(e->secret_key_len == 0) { - /* No secret key / password */ - return 0; - } - - info->key = e->secret_key; - info->key_len = e->secret_key_len; - return 1; -} -static const coap_keystore_t key_store = { - .coap_get_psk_info = get_psk_info -}; -#endif /* COAP_DTLS_KEYSTORE_CONF_WITH_LWM2M */ -#endif /* WITH_DTLS */ -/*---------------------------------------------------------------------------*/ -void -lwm2m_security_init(void) -{ - int i; - - LOG_INFO("init\n"); - - list_init(instances_list); - - for(i = 0; i < MAX_COUNT; i++) { - instances[i].instance.instance_id = LWM2M_OBJECT_INSTANCE_NONE; - } - if(lwm2m_engine_add_generic_object(®_object)) { - -#ifdef WITH_DTLS -#if COAP_DTLS_KEYSTORE_CONF_WITH_LWM2M - /* Security object handler added - register keystore */ - coap_set_keystore(&key_store); - LOG_DBG("registered keystore\n"); -#endif /* COAP_DTLS_KEYSTORE_CONF_WITH_LWM2M */ -#endif /* WITH_DTLS */ - - } else { - LOG_WARN("failed to register\n"); - } -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-security.h b/os/services/lwm2m/lwm2m-security.h deleted file mode 100644 index 9fb3df78f..000000000 --- a/os/services/lwm2m/lwm2m-security.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2017, SICS Swedish ICT - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - * - */ -#ifndef LWM2M_SECURITY_H -#define LWM2M_SECURITY_H - -#define LWM2M_SECURITY_SERVER_URI_ID 0 -#define LWM2M_SECURITY_BOOTSTRAP_SERVER_ID 1 -#define LWM2M_SECURITY_MODE_ID 2 -#define LWM2M_SECURITY_CLIENT_PKI_ID 3 -#define LWM2M_SECURITY_SERVER_PKI_ID 4 -#define LWM2M_SECURITY_KEY_ID 5 -#define LWM2M_SECURITY_SHORT_SERVER_ID 10 - -/* Pre-shared key mode */ -#define LWM2M_SECURITY_MODE_PSK 0 -/* Raw Public Key mode */ -#define LWM2M_SECURITY_MODE_RPK 1 -/* Certificate mode */ -#define LWM2M_SECURITY_MODE_CERTIFICATE 2 -/* NoSec mode */ -#define LWM2M_SECURITY_MODE_NOSEC 3 - -#ifdef LWM2M_SECURITY_CONF_URI_SIZE -#define LWM2M_SECURITY_URI_SIZE LWM2M_SECURITY_CONF_URI_SIZE -#else /* LWM2M_SECURITY_CONF_URI_SIZE */ -#define LWM2M_SECURITY_URI_SIZE 64 -#endif /* LWM2M_SECURITY_CONF_URI_SIZE */ - -#ifdef LWM2M_SECURITY_CONF_KEY_SIZE -#define LWM2M_SECURITY_KEY_SIZE LWM2M_SECURITY_CONF_KEY_SIZE -#else /* LWM2M_SECURITY_CONF_KEY_SIZE */ -#define LWM2M_SECURITY_KEY_SIZE 32 -#endif /* LWM2M_SECURITY_CONF_KEY_SIZE */ - -typedef struct { - lwm2m_object_instance_t instance; - uint16_t server_id; - uint8_t bootstrap; - uint8_t security_mode; - uint8_t server_uri[LWM2M_SECURITY_URI_SIZE]; - uint8_t server_uri_len; - uint8_t public_key[LWM2M_SECURITY_KEY_SIZE]; - uint8_t public_key_len; - uint8_t secret_key[LWM2M_SECURITY_KEY_SIZE]; - uint8_t secret_key_len; - uint8_t server_public_key[LWM2M_SECURITY_KEY_SIZE]; - uint8_t server_public_key_len; -} lwm2m_security_server_t; - -lwm2m_security_server_t *lwm2m_security_get_first(void); -lwm2m_security_server_t *lwm2m_security_get_next(lwm2m_security_server_t *last); - -lwm2m_security_server_t *lwm2m_security_add_server(uint16_t instance_id, - uint16_t server_id, - const uint8_t *server_uri, - uint8_t server_uri_len); - -int lwm2m_security_set_server_psk(lwm2m_security_server_t *server, - const uint8_t *identity, - uint8_t identity_len, - const uint8_t *key, - uint8_t key_len); - -void lwm2m_security_init(void); - -#endif /* LWM2M_SECURITY_H */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-server.c b/os/services/lwm2m/lwm2m-server.c deleted file mode 100644 index b777d72d6..000000000 --- a/os/services/lwm2m/lwm2m-server.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - * - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M server - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include -#include "lib/list.h" -#include "lwm2m-object.h" -#include "lwm2m-engine.h" -#include "lwm2m-server.h" -#include "lwm2m-rd-client.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-srv" -#define LOG_LEVEL LOG_LEVEL_LWM2M - -#define MAX_COUNT LWM2M_SERVER_MAX_COUNT - -static lwm2m_status_t lwm2m_callback(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx); - -static lwm2m_object_instance_t *create_instance(uint16_t instance_id, - lwm2m_status_t *status); -static int delete_instance(uint16_t instance_id, lwm2m_status_t *status); -static lwm2m_object_instance_t *get_first(lwm2m_status_t *status); -static lwm2m_object_instance_t *get_next(lwm2m_object_instance_t *instance, - lwm2m_status_t *status); -static lwm2m_object_instance_t *get_by_id(uint16_t instance_id, - lwm2m_status_t *status); - -static const lwm2m_resource_id_t resources[] = { - RO(LWM2M_SERVER_SHORT_SERVER_ID), - RW(LWM2M_SERVER_LIFETIME_ID), - EX(LWM2M_SERVER_REG_UPDATE_TRIGGER_ID) -}; - -static const lwm2m_object_impl_t impl = { - .object_id = LWM2M_OBJECT_SERVER_ID, - .get_first = get_first, - .get_next = get_next, - .get_by_id = get_by_id, - .create_instance = create_instance, - .delete_instance = delete_instance, -}; -static lwm2m_object_t server_object = { - .impl = &impl, -}; - -LIST(server_list); -static lwm2m_server_t server_instances[MAX_COUNT]; -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -create_instance(uint16_t instance_id, lwm2m_status_t *status) -{ - lwm2m_object_instance_t *instance; - int i; - - instance = get_by_id(instance_id, NULL); - if(instance != NULL) { - /* An instance with this id is already registered */ - if(status) { - *status = LWM2M_STATUS_OPERATION_NOT_ALLOWED; - } - return NULL; - } - - for(i = 0; i < MAX_COUNT; i++) { - if(server_instances[i].instance.instance_id == LWM2M_OBJECT_INSTANCE_NONE) { - server_instances[i].instance.callback = lwm2m_callback; - server_instances[i].instance.object_id = LWM2M_OBJECT_SERVER_ID; - server_instances[i].instance.instance_id = instance_id; - server_instances[i].instance.resource_ids = resources; - server_instances[i].instance.resource_count = - sizeof(resources) / sizeof(lwm2m_resource_id_t); - server_instances[i].server_id = 0; - server_instances[i].lifetime = 0; - list_add(server_list, &server_instances[i].instance); - - if(status) { - *status = LWM2M_STATUS_OK; - } - - return &server_instances[i].instance; - } - } - - if(status) { - *status = LWM2M_STATUS_SERVICE_UNAVAILABLE; - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -static int -delete_instance(uint16_t instance_id, lwm2m_status_t *status) -{ - lwm2m_object_instance_t *instance; - - if(status) { - *status = LWM2M_STATUS_OK; - } - - if(instance_id == LWM2M_OBJECT_INSTANCE_NONE) { - /* Remove all instances */ - while((instance = list_pop(server_list)) != NULL) { - instance->instance_id = LWM2M_OBJECT_INSTANCE_NONE; - } - return 1; - } - - instance = get_by_id(instance_id, NULL); - if(instance != NULL) { - instance->instance_id = LWM2M_OBJECT_INSTANCE_NONE; - list_remove(server_list, instance); - return 1; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -get_first(lwm2m_status_t *status) -{ - if(status) { - *status = LWM2M_STATUS_OK; - } - return list_head(server_list); -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -get_next(lwm2m_object_instance_t *instance, lwm2m_status_t *status) -{ - if(status) { - *status = LWM2M_STATUS_OK; - } - return instance == NULL ? NULL : instance->next; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_object_instance_t * -get_by_id(uint16_t instance_id, lwm2m_status_t *status) -{ - lwm2m_object_instance_t *instance; - if(status) { - *status = LWM2M_STATUS_OK; - } - for(instance = list_head(server_list); - instance != NULL; - instance = instance->next) { - if(instance->instance_id == instance_id) { - return instance; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -static lwm2m_status_t -lwm2m_callback(lwm2m_object_instance_t *object, - lwm2m_context_t *ctx) -{ - int32_t value; - lwm2m_server_t *server; - server = (lwm2m_server_t *) object; - - if(ctx->operation == LWM2M_OP_WRITE) { - LOG_DBG("Write to: %d\n", ctx->resource_id); - switch(ctx->resource_id) { - case LWM2M_SERVER_LIFETIME_ID: - lwm2m_object_read_int(ctx, ctx->inbuf->buffer, ctx->inbuf->size, &value); - server->lifetime = value; - break; - } - } else if(ctx->operation == LWM2M_OP_READ) { - switch(ctx->resource_id) { - case LWM2M_SERVER_SHORT_SERVER_ID: - lwm2m_object_write_int(ctx, server->server_id); - break; - case LWM2M_SERVER_LIFETIME_ID: - lwm2m_object_write_int(ctx, server->lifetime); - break; - } - } else if(ctx->operation == LWM2M_OP_EXECUTE) { - switch(ctx->resource_id) { - case LWM2M_SERVER_REG_UPDATE_TRIGGER_ID: - lwm2m_rd_client_update_triggered(ctx->request->src_ep); - break; - } - } else { - return LWM2M_STATUS_NOT_IMPLEMENTED; - } - - return LWM2M_STATUS_OK; -} -/*---------------------------------------------------------------------------*/ -lwm2m_server_t * -lwm2m_server_add(uint16_t instance_id, uint16_t server_id, uint32_t lifetime) -{ - lwm2m_server_t *server; - int i; - - for(server = list_head(server_list); - server; - server = (lwm2m_server_t *)server->instance.next) { - if(server->server_id == server_id) { - /* Found a matching server */ - if(server->instance.instance_id != instance_id) { - /* Non-matching instance id */ - LOG_DBG("non-matching instance id for server %u\n", server_id); - return NULL; - } - server->lifetime = lifetime; - return server; - } else if(server->instance.instance_id == instance_id) { - /* Right instance but wrong server id */ - LOG_DBG("non-matching server id for instance %u\n", instance_id); - return NULL; - } - } - - for(i = 0; i < MAX_COUNT; i++) { - if(server_instances[i].instance.instance_id == LWM2M_OBJECT_INSTANCE_NONE) { - server_instances[i].instance.callback = lwm2m_callback; - server_instances[i].instance.object_id = LWM2M_OBJECT_SERVER_ID; - server_instances[i].instance.instance_id = instance_id; - server_instances[i].instance.resource_ids = resources; - server_instances[i].instance.resource_count = - sizeof(resources) / sizeof(lwm2m_resource_id_t); - server_instances[i].server_id = server_id; - server_instances[i].lifetime = lifetime; - list_add(server_list, &server_instances[i].instance); - - return &server_instances[i]; - } - } - - LOG_WARN("no space for more servers\n"); - - return NULL; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_server_init(void) -{ - int i; - - LOG_INFO("init\n"); - - list_init(server_list); - - for(i = 0; i < MAX_COUNT; i++) { - server_instances[i].instance.instance_id = LWM2M_OBJECT_INSTANCE_NONE; - } - lwm2m_engine_add_generic_object(&server_object); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-server.h b/os/services/lwm2m/lwm2m-server.h deleted file mode 100644 index 733b0889d..000000000 --- a/os/services/lwm2m/lwm2m-server.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2017, SICS Swedish ICT - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - * - */ -#ifndef LWM2M_SERVER_H -#define LWM2M_SERVER_H - -#include "contiki.h" - -#define LWM2M_SERVER_SHORT_SERVER_ID 0 -#define LWM2M_SERVER_LIFETIME_ID 1 -#define LWM2M_SERVER_BINDING_ID 7 -#define LWM2M_SERVER_REG_UPDATE_TRIGGER_ID 8 - -#ifdef LWM2M_SERVER_CONF_MAX_COUNT -#define LWM2M_SERVER_MAX_COUNT LWM2M_SERVER_CONF_MAX_COUNT -#else -#define LWM2M_SERVER_MAX_COUNT 2 -#endif - -typedef struct { - lwm2m_object_instance_t instance; - uint16_t server_id; - uint32_t lifetime; -} lwm2m_server_t; - -lwm2m_server_t *lwm2m_server_add(uint16_t instance_id, - uint16_t server_id, - uint32_t lifetime); - -void lwm2m_server_init(void); - -#endif /* LWM2M_SERVER_H */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-tlv-reader.c b/os/services/lwm2m/lwm2m-tlv-reader.c deleted file mode 100644 index cbeed6bd2..000000000 --- a/os/services/lwm2m/lwm2m-tlv-reader.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - * - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M TLV reader - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include "lwm2m-object.h" -#include "lwm2m-tlv-reader.h" -#include "lwm2m-tlv.h" -#include - -/*---------------------------------------------------------------------------*/ -static size_t -read_int(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, - int32_t *value) -{ - lwm2m_tlv_t tlv; - size_t size; - size = lwm2m_tlv_read(&tlv, inbuf, len); - if(size > 0) { - *value = lwm2m_tlv_get_int32(&tlv); - ctx->last_value_len = tlv.length; - } - return size; -} -/*---------------------------------------------------------------------------*/ -static size_t -read_string(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, - uint8_t *value, size_t stringlen) -{ - lwm2m_tlv_t tlv; - size_t size; - size = lwm2m_tlv_read(&tlv, inbuf, len); - if(size > 0) { - if(stringlen <= tlv.length) { - /* The outbuffer can not contain the full string including ending zero */ - return 0; - } - memcpy(value, tlv.value, tlv.length); - value[tlv.length] = '\0'; - ctx->last_value_len = tlv.length; - } - return size; -} -/*---------------------------------------------------------------------------*/ -static size_t -read_float32fix(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, - int32_t *value, int bits) -{ - lwm2m_tlv_t tlv; - size_t size; - size = lwm2m_tlv_read(&tlv, inbuf, len); - if(size > 0) { - lwm2m_tlv_float32_to_fix(&tlv, value, bits); - ctx->last_value_len = tlv.length; - } - return size; -} -/*---------------------------------------------------------------------------*/ -static size_t -read_boolean(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t len, - int *value) -{ - lwm2m_tlv_t tlv; - size_t size; - size = lwm2m_tlv_read(&tlv, inbuf, len); - if(size > 0) { - *value = lwm2m_tlv_get_int32(&tlv) != 0; - ctx->last_value_len = tlv.length; - } - return size; -} -/*---------------------------------------------------------------------------*/ -const lwm2m_reader_t lwm2m_tlv_reader = { - read_int, - read_string, - read_float32fix, - read_boolean -}; -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-tlv-reader.h b/os/services/lwm2m/lwm2m-tlv-reader.h deleted file mode 100644 index 15db7024d..000000000 --- a/os/services/lwm2m/lwm2m-tlv-reader.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** \addtogroup lwm2m - * @{ */ - -/** - * \file - * Header file for the Contiki OMA LWM2M TLV reader - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef LWM2M_TLV_READER_H_ -#define LWM2M_TLV_READER_H_ - -#include "lwm2m-object.h" - -extern const lwm2m_reader_t lwm2m_tlv_reader; - -#endif /* LWM2M_TLV_READER_H_ */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-tlv-writer.c b/os/services/lwm2m/lwm2m-tlv-writer.c deleted file mode 100644 index 41bdc2f6c..000000000 --- a/os/services/lwm2m/lwm2m-tlv-writer.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - * - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M TLV writer - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include "lwm2m-object.h" -#include "lwm2m-tlv.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-tlv" -#define LOG_LEVEL LOG_LEVEL_NONE - -/*---------------------------------------------------------------------------*/ -static size_t -init_write(lwm2m_context_t *ctx) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static size_t -end_write(lwm2m_context_t *ctx) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static size_t -write_int_tlv(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - int32_t value) -{ - uint8_t type = ctx->writer_flags & WRITER_RESOURCE_INSTANCE ? - LWM2M_TLV_TYPE_RESOURCE_INSTANCE : LWM2M_TLV_TYPE_RESOURCE; - uint16_t id = ctx->writer_flags & WRITER_RESOURCE_INSTANCE ? - ctx->resource_instance_id : ctx->resource_id; - return lwm2m_tlv_write_int32(type, id, value, outbuf, outlen); -} -/*---------------------------------------------------------------------------*/ -static size_t -write_boolean_tlv(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - int value) -{ - return write_int_tlv(ctx, outbuf, outlen, value != 0 ? 1 : 0); -} -/*---------------------------------------------------------------------------*/ -static size_t -write_float32fix_tlv(lwm2m_context_t *ctx, uint8_t *outbuf, - size_t outlen, int32_t value, int bits) -{ - uint8_t type = ctx->writer_flags & WRITER_RESOURCE_INSTANCE ? - LWM2M_TLV_TYPE_RESOURCE_INSTANCE : LWM2M_TLV_TYPE_RESOURCE; - uint16_t id = ctx->writer_flags & WRITER_RESOURCE_INSTANCE ? - ctx->resource_instance_id : ctx->resource_id; - return lwm2m_tlv_write_float32(type, id, value, bits, outbuf, outlen); -} -/*---------------------------------------------------------------------------*/ -static size_t -write_string_tlv(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen, - const char *value, size_t stringlen) -{ - lwm2m_tlv_t tlv; - tlv.type = ctx->writer_flags & WRITER_RESOURCE_INSTANCE ? - LWM2M_TLV_TYPE_RESOURCE_INSTANCE : LWM2M_TLV_TYPE_RESOURCE; - tlv.value = (uint8_t *) value; - tlv.length = (uint32_t) stringlen; - tlv.id = ctx->resource_id; - return lwm2m_tlv_write(&tlv, outbuf, outlen); -} -/*---------------------------------------------------------------------------*/ -static size_t -write_opaque_header(lwm2m_context_t *ctx, size_t payloadsize) -{ - lwm2m_tlv_t tlv; - tlv.type = LWM2M_TLV_TYPE_RESOURCE; - tlv.value = (uint8_t *) NULL; - tlv.length = (uint32_t) payloadsize; - tlv.id = ctx->resource_id; - return lwm2m_tlv_write(&tlv, &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len); -} -/*---------------------------------------------------------------------------*/ -static size_t -enter_sub(lwm2m_context_t *ctx) -{ - /* set some flags in state */ - lwm2m_tlv_t tlv; - int len = 0; - LOG_DBG("Enter sub-resource rsc=%d mark:%d\n", ctx->resource_id, ctx->outbuf->len); - ctx->writer_flags |= WRITER_RESOURCE_INSTANCE; - tlv.type = LWM2M_TLV_TYPE_MULTI_RESOURCE; - tlv.length = 8; /* create an 8-bit TLV */ - tlv.value = NULL; - tlv.id = ctx->resource_id; - len = lwm2m_tlv_write(&tlv, &ctx->outbuf->buffer[ctx->outbuf->len], - ctx->outbuf->size - ctx->outbuf->len); - /* store position for deciding where to re-write the TLV when we - know the length - NOTE: either this or memmov of buffer later... */ - ctx->out_mark_pos_ri = ctx->outbuf->len; - return len; -} -/*---------------------------------------------------------------------------*/ -static size_t -exit_sub(lwm2m_context_t *ctx) -{ - /* clear out state info */ - int pos = 2; /* this is the lenght pos */ - int len; - ctx->writer_flags &= ~WRITER_RESOURCE_INSTANCE; - - if(ctx->resource_id > 0xff) { - pos++; - } - len = ctx->outbuf->len - ctx->out_mark_pos_ri; - - LOG_DBG("Exit sub-resource rsc=%d mark:%d len=%d\n", ctx->resource_id, - ctx->out_mark_pos_ri, len); - - /* update the lenght byte... Assume TLV header is pos + 1 bytes. */ - ctx->outbuf->buffer[pos + ctx->out_mark_pos_ri] = len - (pos + 1); - return 0; -} -/*---------------------------------------------------------------------------*/ -const lwm2m_writer_t lwm2m_tlv_writer = { - init_write, - end_write, - enter_sub, - exit_sub, - write_int_tlv, - write_string_tlv, - write_float32fix_tlv, - write_boolean_tlv, - write_opaque_header -}; -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-tlv-writer.h b/os/services/lwm2m/lwm2m-tlv-writer.h deleted file mode 100644 index 681ccf280..000000000 --- a/os/services/lwm2m/lwm2m-tlv-writer.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** \addtogroup lwm2m - * @{ */ - -/** - * \file - * Header file for the Contiki OMA LWM2M TLV writer - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef LWM2M_TLV_WRITER_H_ -#define LWM2M_TLV_WRITER_H_ - -#include "lwm2m-object.h" - -extern const lwm2m_writer_t lwm2m_tlv_writer; - -#endif /* LWM2M_TLV_WRITER_H_ */ -/** @} */ diff --git a/os/services/lwm2m/lwm2m-tlv.c b/os/services/lwm2m/lwm2m-tlv.c deleted file mode 100644 index cdadee9f6..000000000 --- a/os/services/lwm2m/lwm2m-tlv.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** - * \addtogroup lwm2m - * @{ - * - */ - -/** - * \file - * Implementation of the Contiki OMA LWM2M TLV - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#include -#include -#include -#include "lwm2m-tlv.h" - -/* Log configuration */ -#include "coap-log.h" -#define LOG_MODULE "lwm2m-tlv" -#define LOG_LEVEL LOG_LEVEL_NONE - -/*---------------------------------------------------------------------------*/ -static inline uint8_t -get_len_type(const lwm2m_tlv_t *tlv) -{ - if(tlv->length < 8) { - return 0; - } else if(tlv->length < 256) { - return 1; - } else if(tlv->length < 0x10000) { - return 2; - } else { - return 3; - } -} -/*---------------------------------------------------------------------------*/ -size_t -lwm2m_tlv_read(lwm2m_tlv_t *tlv, const uint8_t *buffer, size_t len) -{ - uint8_t len_type; - uint8_t len_pos = 1; - size_t tlv_len; - - tlv->type = (buffer[0] >> 6) & 3; - len_type = (buffer[0] >> 3) & 3; - len_pos = 1 + (((buffer[0] & (1 << 5)) != 0) ? 2 : 1); - - tlv->id = buffer[1]; - /* if len_pos is larger than two it means that there is more ID to read */ - if(len_pos > 2) { - tlv->id = (tlv->id << 8) + buffer[2]; - } - - if(len_type == 0) { - tlv_len = buffer[0] & 7; - } else { - /* read the length */ - tlv_len = 0; - while(len_type > 0) { - tlv_len = tlv_len << 8 | buffer[len_pos++]; - len_type--; - } - } - /* and read out the data??? */ - tlv->length = tlv_len; - tlv->value = &buffer[len_pos]; - - return len_pos + tlv_len; -} -/*---------------------------------------------------------------------------*/ -size_t -lwm2m_tlv_get_size(const lwm2m_tlv_t *tlv) -{ - size_t size; - /* first hdr + len size */ - size = 1 + get_len_type(tlv); - /* id size */ - size += (tlv->id > 255) ? 2 : 1; - - /* and the length */ - size += tlv->length; - return size; -} -/*---------------------------------------------------------------------------*/ -/* If the tlv->value is NULL - only the header will be generated - useful for - * large strings or opaque streaming (block transfer) - */ -size_t -lwm2m_tlv_write(const lwm2m_tlv_t *tlv, uint8_t *buffer, size_t buffersize) -{ - int pos; - uint8_t len_type; - - /* len type is the same as number of bytes required for length */ - len_type = get_len_type(tlv); - pos = 1 + len_type; - /* ensure that we do not write too much */ - if(tlv->value != NULL && buffersize < tlv->length + pos) { - LOG_WARN("Could not write the TLV - buffer overflow.\n"); - return 0; - } - - if(buffersize < pos + 2) { - return 0; - } - - /* first type byte in TLV header */ - buffer[0] = (tlv->type << 6) | - (tlv->id > 255 ? (1 << 5) : 0) | - (len_type << 3) | - (len_type == 0 ? tlv->length : 0); - - pos = 1; - /* The ID */ - if(tlv->id > 255) { - buffer[pos++] = (tlv->id >> 8) & 0xff; - } - buffer[pos++] = tlv->id & 0xff; - /* Add length if needed - unrolled loop ? */ - if(len_type > 2) { - buffer[pos++] = (tlv->length >> 16) & 0xff; - } - if(len_type > 1) { - buffer[pos++] = (tlv->length >> 8) & 0xff; - } - if(len_type > 0) { - buffer[pos++] = tlv->length & 0xff; - } - - /* finally add the value */ - if(tlv->value != NULL && tlv->length > 0) { - memcpy(&buffer[pos], tlv->value, tlv->length); - } - - if(LOG_DBG_ENABLED) { - int i; - LOG_DBG("TLV: "); - for(i = 0; i < pos + ((tlv->value != NULL) ? tlv->length : 0); i++) { - LOG_DBG_("%02x", buffer[i]); - } - LOG_DBG_("\n"); - } - - return pos + ((tlv->value != NULL) ? tlv->length : 0); -} -/*---------------------------------------------------------------------------*/ -int32_t -lwm2m_tlv_get_int32(const lwm2m_tlv_t *tlv) -{ - int i; - int32_t value = 0; - - for(i = 0; i < tlv->length; i++) { - value = (value << 8) | tlv->value[i]; - } - - /* Ensure that we set all the bits above what we read in */ - if(tlv->value[0] & 0x80) { - while(i < 4) { - value = value | (0xff << (i * 8)); - i++; - } - } - - return value; -} -/*---------------------------------------------------------------------------*/ -size_t -lwm2m_tlv_write_int32(uint8_t type, int16_t id, int32_t value, uint8_t *buffer, size_t len) -{ - lwm2m_tlv_t tlv; - uint8_t buf[4]; - int i; - int v; - int last_bit; - LOG_DBG("Exporting int32 %d %"PRId32" ", id, value); - - v = value < 0 ? -1 : 0; - i = 0; - do { - buf[3 - i] = value & 0xff; - /* check if the last MSB indicates that we need another byte */ - last_bit = (v == 0 && (value & 0x80) > 0) || (v == -1 && (value & 0x80) == 0); - value = value >> 8; - i++; - } while((value != v || last_bit) && i < 4); - - /* export INT as TLV */ - LOG_DBG("len: %d\n", i); - tlv.type = type; - tlv.length = i; - tlv.value = &buf[3 - (i - 1)]; - tlv.id = id; - return lwm2m_tlv_write(&tlv, buffer, len); -} -/*---------------------------------------------------------------------------*/ -/* convert fixpoint 32-bit to a IEEE Float in the byte array*/ -size_t -lwm2m_tlv_write_float32(uint8_t type, int16_t id, int32_t value, int bits, - uint8_t *buffer, size_t len) -{ - int i; - int e = 0; - int32_t val = 0; - int32_t v; - uint8_t b[4]; - lwm2m_tlv_t tlv; - - v = value; - if(v < 0) { - v = -v; - } - - while(v > 1) { - val = (val >> 1); - if (v & 1) { - val = val | (1L << 22); - } - v = (v >> 1); - e++; - } - - LOG_DBG("Sign: %d, Fraction: %06"PRIx32" 0b", value < 0, val); - for(i = 0; i < 23; i++) { - LOG_DBG_("%"PRId32"", ((val >> (22 - i)) & 1)); - } - LOG_DBG_("\nExp:%d\n", e); - - /* convert to the thing we should have */ - e = e - bits + 127; - - if(value == 0) { - e = 0; - } - - /* is this the right byte order? */ - b[0] = (value < 0 ? 0x80 : 0) | (e >> 1); - b[1] = ((e & 1) << 7) | ((val >> 16) & 0x7f); - b[2] = (val >> 8) & 0xff; - b[3] = val & 0xff; - - LOG_DBG("B=%02x%02x%02x%02x\n", b[0], b[1], b[2], b[3]); - /* construct the TLV */ - tlv.type = type; - tlv.length = 4; - tlv.value = b; - tlv.id = id; - - return lwm2m_tlv_write(&tlv, buffer, len); -} -/*---------------------------------------------------------------------------*/ -/* convert float to fixpoint */ -size_t -lwm2m_tlv_float32_to_fix(const lwm2m_tlv_t *tlv, int32_t *value, int bits) -{ - /* TLV needs to be 4 bytes */ - int e, i; - int32_t val; - int sign = (tlv->value[0] & 0x80) != 0; - e = ((tlv->value[0] << 1) & 0xff) | (tlv->value[1] >> 7); - val = (((long)tlv->value[1] & 0x7f) << 16) | (tlv->value[2] << 8) | tlv->value[3]; - - LOG_DBG("Sign: %d, Fraction: %06"PRIx32" 0b", val < 0, val); - for(i = 0; i < 23; i++) { - LOG_DBG_("%"PRId32"", ((val >> (22 - i)) & 1)); - } - LOG_DBG("\nExp:%d => %d\n", e, e - 127); - - e = e - 127 + bits; - - /* e corresponds to the number of times we need to roll the number */ - - LOG_DBG("Actual e=%d\n", e); - e = e - 23; - LOG_DBG("E after sub %d\n", e); - val = val | 1L << 23; - if(e > 0) { - val = val << e; - } else { - val = val >> -e; - } - - *value = sign ? -val : val; - return 4; -} -/*---------------------------------------------------------------------------*/ -/** @} */ - -#if 0 -int main(int argc, char *argv[]) -{ - lwm2m_tlv_t tlv; - uint8_t data[24]; - /* Make -1 */ - tlv.length = 2; - tlv.value = data; - data[0] = 0x00; - data[1] = 0x80, - - printf("TLV:%d\n", lwm2m_tlv_get_int32(&tlv)); - - printf("Len: %d\n", lwm2m_tlv_write_int32(0, 1, -0x88987f, data, 24)); -} -#endif diff --git a/os/services/lwm2m/lwm2m-tlv.h b/os/services/lwm2m/lwm2m-tlv.h deleted file mode 100644 index 2766263fa..000000000 --- a/os/services/lwm2m/lwm2m-tlv.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2015-2018, Yanzi Networks AB. - * 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 HOLDER 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. - */ - -/** \addtogroup lwm2m - * @{ */ - -/** - * \file - * Header file for the Contiki OMA LWM2M TLV - * \author - * Joakim Eriksson - * Niclas Finne - */ - -#ifndef LWM2M_TLV_H_ -#define LWM2M_TLV_H_ - -#include -#include - -enum { - LWM2M_TLV_TYPE_OBJECT_INSTANCE = 0, - LWM2M_TLV_TYPE_RESOURCE_INSTANCE = 1, - LWM2M_TLV_TYPE_MULTI_RESOURCE = 2, - LWM2M_TLV_TYPE_RESOURCE = 3 -}; -typedef uint8_t lwm2m_tlv_type_t; - -typedef enum { - LWM2M_TLV_LEN_TYPE_NO_LEN = 0, - LWM2M_TLV_LEN_TYPE_8BIT_LEN = 1, - LWM2M_TLV_LEN_TYPE_16BIT_LEN = 2, - LWM2M_TLV_LEN_TYPE_24BIT_LEN = 3 -} lwm2m_tlv_len_type_t; - -typedef struct { - lwm2m_tlv_type_t type; - uint16_t id; /* can be 8-bit or 16-bit when serialized */ - uint32_t length; - const uint8_t *value; -} lwm2m_tlv_t; - -size_t lwm2m_tlv_get_size(const lwm2m_tlv_t *tlv); - -/* read a TLV from the buffer */ -size_t lwm2m_tlv_read(lwm2m_tlv_t *tlv, const uint8_t *buffer, size_t len); - -/* write a TLV to the buffer */ -size_t lwm2m_tlv_write(const lwm2m_tlv_t *tlv, uint8_t *buffer, size_t len); - -int32_t lwm2m_tlv_get_int32(const lwm2m_tlv_t *tlv); - -/* write a int as a TLV to the buffer */ -size_t lwm2m_tlv_write_int32(uint8_t type, int16_t id, int32_t value, uint8_t *buffer, size_t len); - -/* write a float converted from fixpoint as a TLV to the buffer */ -size_t lwm2m_tlv_write_float32(uint8_t type, int16_t id, int32_t value, int bits, uint8_t *buffer, size_t len); - -/* convert TLV with float32 to fixpoint */ -size_t lwm2m_tlv_float32_to_fix(const lwm2m_tlv_t *tlv, int32_t *value, int bits); - -#endif /* LWM2M_TLV_H_ */ -/** @} */ diff --git a/os/services/orchestra/Makefile.orchestra b/os/services/orchestra/Makefile.orchestra deleted file mode 100644 index 0cdff2688..000000000 --- a/os/services/orchestra/Makefile.orchestra +++ /dev/null @@ -1 +0,0 @@ -CFLAGS += -DBUILD_WITH_ORCHESTRA=1 diff --git a/os/services/orchestra/orchestra-conf.h b/os/services/orchestra/orchestra-conf.h deleted file mode 100644 index a23b31f9b..000000000 --- a/os/services/orchestra/orchestra-conf.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2015, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Orchestra configuration - * - * \author Simon Duquennoy - */ - -#ifndef __ORCHESTRA_CONF_H__ -#define __ORCHESTRA_CONF_H__ - -#ifdef ORCHESTRA_CONF_RULES -#define ORCHESTRA_RULES ORCHESTRA_CONF_RULES -#else /* ORCHESTRA_CONF_RULES */ -/* A default configuration with: - * - a sender-based slotframe for EB transmission - * - a sender-based or receiver-based slotframe for unicast to RPL parents and children - * - a common shared slotframe for any other traffic (mostly broadcast) - * */ -#define ORCHESTRA_RULES { &eb_per_time_source, &unicast_per_neighbor_rpl_ns, &default_common } -/* Example configuration for RPL non-storing mode: */ -/* #define ORCHESTRA_RULES { &eb_per_time_source, &unicast_per_neighbor_rpl_ns, &default_common } */ - -#endif /* ORCHESTRA_CONF_RULES */ - -/* Length of the various slotframes. Tune to balance network capacity, - * contention, energy, latency. */ -#ifdef ORCHESTRA_CONF_EBSF_PERIOD -#define ORCHESTRA_EBSF_PERIOD ORCHESTRA_CONF_EBSF_PERIOD -#else /* ORCHESTRA_CONF_EBSF_PERIOD */ -#define ORCHESTRA_EBSF_PERIOD 397 -#endif /* ORCHESTRA_CONF_EBSF_PERIOD */ - -#ifdef ORCHESTRA_CONF_COMMON_SHARED_PERIOD -#define ORCHESTRA_COMMON_SHARED_PERIOD ORCHESTRA_CONF_COMMON_SHARED_PERIOD -#else /* ORCHESTRA_CONF_COMMON_SHARED_PERIOD */ -#define ORCHESTRA_COMMON_SHARED_PERIOD 31 -#endif /* ORCHESTRA_CONF_COMMON_SHARED_PERIOD */ - -#ifdef ORCHESTRA_CONF_UNICAST_PERIOD -#define ORCHESTRA_UNICAST_PERIOD ORCHESTRA_CONF_UNICAST_PERIOD -#else /* ORCHESTRA_CONF_UNICAST_PERIOD */ -#define ORCHESTRA_UNICAST_PERIOD 17 -#endif /* ORCHESTRA_CONF_UNICAST_PERIOD */ - -/* Is the per-neighbor unicast slotframe sender-based (if not, it is receiver-based). - * Note: sender-based works only with RPL storing mode as it relies on DAO and - * routing entries to keep track of children and parents. */ -#ifdef ORCHESTRA_CONF_UNICAST_SENDER_BASED -#define ORCHESTRA_UNICAST_SENDER_BASED ORCHESTRA_CONF_UNICAST_SENDER_BASED -#else /* ORCHESTRA_CONF_UNICAST_SENDER_BASED */ -#define ORCHESTRA_UNICAST_SENDER_BASED 0 -#endif /* ORCHESTRA_CONF_UNICAST_SENDER_BASED */ - -/* The hash function used to assign timeslot to a given node (based on its link-layer address) */ -#ifdef ORCHESTRA_CONF_LINKADDR_HASH -#define ORCHESTRA_LINKADDR_HASH ORCHESTRA_CONF_LINKADDR_HASH -#else /* ORCHESTRA_CONF_LINKADDR_HASH */ -#define ORCHESTRA_LINKADDR_HASH(addr) ((addr != NULL) ? (addr)->u8[LINKADDR_SIZE - 1] : -1) -#endif /* ORCHESTRA_CONF_LINKADDR_HASH */ - -/* The maximum hash */ -#ifdef ORCHESTRA_CONF_MAX_HASH -#define ORCHESTRA_MAX_HASH ORCHESTRA_CONF_MAX_HASH -#else /* ORCHESTRA_CONF_MAX_HASH */ -#define ORCHESTRA_MAX_HASH 0x7fff -#endif /* ORCHESTRA_CONF_MAX_HASH */ - -/* Is the "hash" function collision-free? (e.g. it maps to unique node-ids) */ -#ifdef ORCHESTRA_CONF_COLLISION_FREE_HASH -#define ORCHESTRA_COLLISION_FREE_HASH ORCHESTRA_CONF_COLLISION_FREE_HASH -#else /* ORCHESTRA_CONF_COLLISION_FREE_HASH */ -#define ORCHESTRA_COLLISION_FREE_HASH 0 /* Set to 1 if ORCHESTRA_LINKADDR_HASH returns unique hashes */ -#endif /* ORCHESTRA_CONF_COLLISION_FREE_HASH */ - -#endif /* __ORCHESTRA_CONF_H__ */ diff --git a/os/services/orchestra/orchestra-rule-default-common.c b/os/services/orchestra/orchestra-rule-default-common.c deleted file mode 100644 index 49ac3b496..000000000 --- a/os/services/orchestra/orchestra-rule-default-common.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2015, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Orchestra: a slotframe with a single shared link, common to all nodes - * in the network, used for unicast and broadcast. - * - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "orchestra.h" - -static uint16_t slotframe_handle = 0; -static uint16_t channel_offset = 0; - -#if ORCHESTRA_EBSF_PERIOD > 0 -/* There is a slotframe for EBs, use this slotframe for non-EB traffic only */ -#define ORCHESTRA_COMMON_SHARED_TYPE LINK_TYPE_NORMAL -#else -/* There is no slotframe for EBs, use this slotframe both EB and non-EB traffic */ -#define ORCHESTRA_COMMON_SHARED_TYPE LINK_TYPE_ADVERTISING -#endif - -/*---------------------------------------------------------------------------*/ -static int -select_packet(uint16_t *slotframe, uint16_t *timeslot) -{ - /* We are the default slotframe, select anything */ - if(slotframe != NULL) { - *slotframe = slotframe_handle; - } - if(timeslot != NULL) { - *timeslot = 0; - } - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -init(uint16_t sf_handle) -{ - slotframe_handle = sf_handle; - channel_offset = slotframe_handle; - /* Default slotframe: for broadcast or unicast to neighbors we - * do not have a link to */ - struct tsch_slotframe *sf_common = tsch_schedule_add_slotframe(slotframe_handle, ORCHESTRA_COMMON_SHARED_PERIOD); - tsch_schedule_add_link(sf_common, - LINK_OPTION_RX | LINK_OPTION_TX | LINK_OPTION_SHARED, - ORCHESTRA_COMMON_SHARED_TYPE, &tsch_broadcast_address, - 0, channel_offset); -} -/*---------------------------------------------------------------------------*/ -struct orchestra_rule default_common = { - init, - NULL, - select_packet, - NULL, - NULL, -}; diff --git a/os/services/orchestra/orchestra-rule-eb-per-time-source.c b/os/services/orchestra/orchestra-rule-eb-per-time-source.c deleted file mode 100644 index ed037291b..000000000 --- a/os/services/orchestra/orchestra-rule-eb-per-time-source.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2015, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - - * Orchestra: a slotframe dedicated to transmission of EBs. - * Nodes transmit at a timeslot defined as hash(MAC) % ORCHESTRA_EBSF_PERIOD - * Nodes listen at a timeslot defined as hash(time_source.MAC) % ORCHESTRA_EBSF_PERIOD - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "orchestra.h" -#include "net/packetbuf.h" - -static uint16_t slotframe_handle = 0; -static uint16_t channel_offset = 0; -static struct tsch_slotframe *sf_eb; - -/*---------------------------------------------------------------------------*/ -static uint16_t -get_node_timeslot(const linkaddr_t *addr) -{ -#if ORCHESTRA_EBSF_PERIOD > 0 - return ORCHESTRA_LINKADDR_HASH(addr) % ORCHESTRA_EBSF_PERIOD; -#else - return 0xffff; -#endif -} -/*---------------------------------------------------------------------------*/ -static int -select_packet(uint16_t *slotframe, uint16_t *timeslot) -{ - /* Select EBs only */ - if(packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE) == FRAME802154_BEACONFRAME) { - if(slotframe != NULL) { - *slotframe = slotframe_handle; - } - if(timeslot != NULL) { - *timeslot = get_node_timeslot(&linkaddr_node_addr); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -new_time_source(const struct tsch_neighbor *old, const struct tsch_neighbor *new) -{ - uint16_t old_ts = old != NULL ? get_node_timeslot(&old->addr) : 0xffff; - uint16_t new_ts = new != NULL ? get_node_timeslot(&new->addr) : 0xffff; - - if(new_ts == old_ts) { - return; - } - - if(old_ts != 0xffff) { - /* Stop listening to the old time source's EBs */ - if(old_ts == get_node_timeslot(&linkaddr_node_addr)) { - /* This was the same timeslot as slot. Reset original link options */ - tsch_schedule_add_link(sf_eb, LINK_OPTION_TX, LINK_TYPE_ADVERTISING_ONLY, - &tsch_broadcast_address, old_ts, 0); - } else { - /* Remove slot */ - tsch_schedule_remove_link_by_timeslot(sf_eb, old_ts); - } - } - if(new_ts != 0xffff) { - uint8_t link_options = LINK_OPTION_RX; - if(new_ts == get_node_timeslot(&linkaddr_node_addr)) { - /* This is also our timeslot, add necessary flags */ - link_options |= LINK_OPTION_TX; - } - /* Listen to the time source's EBs */ - tsch_schedule_add_link(sf_eb, link_options, LINK_TYPE_ADVERTISING_ONLY, - &tsch_broadcast_address, new_ts, 0); - } -} -/*---------------------------------------------------------------------------*/ -static void -init(uint16_t sf_handle) -{ - slotframe_handle = sf_handle; - channel_offset = sf_handle; - sf_eb = tsch_schedule_add_slotframe(slotframe_handle, ORCHESTRA_EBSF_PERIOD); - /* EB link: every neighbor uses its own to avoid contention */ - tsch_schedule_add_link(sf_eb, - LINK_OPTION_TX, - LINK_TYPE_ADVERTISING_ONLY, &tsch_broadcast_address, - get_node_timeslot(&linkaddr_node_addr), 0); -} -/*---------------------------------------------------------------------------*/ -struct orchestra_rule eb_per_time_source = { - init, - new_time_source, - select_packet, - NULL, - NULL, -}; diff --git a/os/services/orchestra/orchestra-rule-unicast-per-neighbor-rpl-ns.c b/os/services/orchestra/orchestra-rule-unicast-per-neighbor-rpl-ns.c deleted file mode 100644 index d72646e1d..000000000 --- a/os/services/orchestra/orchestra-rule-unicast-per-neighbor-rpl-ns.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2016, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Orchestra: a slotframe dedicated to unicast data transmission. Designed primarily - * for RPL non-storing mode but would work with any mode-of-operation. Does not require - * any knowledge of the children. Works only as received-base, and as follows: - * Nodes listen at a timeslot defined as hash(MAC) % ORCHESTRA_SB_UNICAST_PERIOD - * Nodes transmit at: for any neighbor, hash(nbr.MAC) % ORCHESTRA_SB_UNICAST_PERIOD - * - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "orchestra.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/packetbuf.h" - -static uint16_t slotframe_handle = 0; -static uint16_t channel_offset = 0; -static struct tsch_slotframe *sf_unicast; - -/*---------------------------------------------------------------------------*/ -static uint16_t -get_node_timeslot(const linkaddr_t *addr) -{ - if(addr != NULL && ORCHESTRA_UNICAST_PERIOD > 0) { - return ORCHESTRA_LINKADDR_HASH(addr) % ORCHESTRA_UNICAST_PERIOD; - } else { - return 0xffff; - } -} -/*---------------------------------------------------------------------------*/ -static void -child_added(const linkaddr_t *linkaddr) -{ -} -/*---------------------------------------------------------------------------*/ -static void -child_removed(const linkaddr_t *linkaddr) -{ -} -/*---------------------------------------------------------------------------*/ -static int -select_packet(uint16_t *slotframe, uint16_t *timeslot) -{ - /* Select data packets we have a unicast link to */ - const linkaddr_t *dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); - if(packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE) == FRAME802154_DATAFRAME - && !linkaddr_cmp(dest, &linkaddr_null)) { - if(slotframe != NULL) { - *slotframe = slotframe_handle; - } - if(timeslot != NULL) { - *timeslot = get_node_timeslot(dest); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -new_time_source(const struct tsch_neighbor *old, const struct tsch_neighbor *new) -{ -} -/*---------------------------------------------------------------------------*/ -static void -init(uint16_t sf_handle) -{ - int i; - uint16_t rx_timeslot; - slotframe_handle = sf_handle; - channel_offset = sf_handle; - /* Slotframe for unicast transmissions */ - sf_unicast = tsch_schedule_add_slotframe(slotframe_handle, ORCHESTRA_UNICAST_PERIOD); - rx_timeslot = get_node_timeslot(&linkaddr_node_addr); - /* Add a Tx link at each available timeslot. Make the link Rx at our own timeslot. */ - for(i = 0; i < ORCHESTRA_UNICAST_PERIOD; i++) { - tsch_schedule_add_link(sf_unicast, - LINK_OPTION_SHARED | LINK_OPTION_TX | ( i == rx_timeslot ? LINK_OPTION_RX : 0 ), - LINK_TYPE_NORMAL, &tsch_broadcast_address, - i, channel_offset); - } -} -/*---------------------------------------------------------------------------*/ -struct orchestra_rule unicast_per_neighbor_rpl_ns = { - init, - new_time_source, - select_packet, - child_added, - child_removed, -}; diff --git a/os/services/orchestra/orchestra-rule-unicast-per-neighbor-rpl-storing.c b/os/services/orchestra/orchestra-rule-unicast-per-neighbor-rpl-storing.c deleted file mode 100644 index 723b9e847..000000000 --- a/os/services/orchestra/orchestra-rule-unicast-per-neighbor-rpl-storing.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2015, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Orchestra: a slotframe dedicated to unicast data transmission. Designed for - * RPL storing mode only, as this is based on the knowledge of the children (and parent). - * If receiver-based: - * Nodes listen at a timeslot defined as hash(MAC) % ORCHESTRA_SB_UNICAST_PERIOD - * Nodes transmit at: for each nbr in RPL children and RPL preferred parent, - * hash(nbr.MAC) % ORCHESTRA_SB_UNICAST_PERIOD - * If sender-based: the opposite - * - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "orchestra.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/packetbuf.h" -#include "net/routing/routing.h" - -/* - * The body of this rule should be compiled only when "nbr_routes" is available, - * otherwise a link error causes build failure. "nbr_routes" is compiled if - * UIP_MAX_ROUTES != 0. See uip-ds6-route.c. - */ -#if UIP_MAX_ROUTES != 0 - -#if ORCHESTRA_UNICAST_SENDER_BASED && ORCHESTRA_COLLISION_FREE_HASH -#define UNICAST_SLOT_SHARED_FLAG ((ORCHESTRA_UNICAST_PERIOD < (ORCHESTRA_MAX_HASH + 1)) ? LINK_OPTION_SHARED : 0) -#else -#define UNICAST_SLOT_SHARED_FLAG LINK_OPTION_SHARED -#endif - -static uint16_t slotframe_handle = 0; -static uint16_t channel_offset = 0; -static struct tsch_slotframe *sf_unicast; - -/*---------------------------------------------------------------------------*/ -static uint16_t -get_node_timeslot(const linkaddr_t *addr) -{ - if(addr != NULL && ORCHESTRA_UNICAST_PERIOD > 0) { - return ORCHESTRA_LINKADDR_HASH(addr) % ORCHESTRA_UNICAST_PERIOD; - } else { - return 0xffff; - } -} -/*---------------------------------------------------------------------------*/ -static int -neighbor_has_uc_link(const linkaddr_t *linkaddr) -{ - if(linkaddr != NULL && !linkaddr_cmp(linkaddr, &linkaddr_null)) { - if((orchestra_parent_knows_us || !ORCHESTRA_UNICAST_SENDER_BASED) - && linkaddr_cmp(&orchestra_parent_linkaddr, linkaddr)) { - return 1; - } - if(nbr_table_get_from_lladdr(nbr_routes, (linkaddr_t *)linkaddr) != NULL) { - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -add_uc_link(const linkaddr_t *linkaddr) -{ - if(linkaddr != NULL) { - uint16_t timeslot = get_node_timeslot(linkaddr); - uint8_t link_options = ORCHESTRA_UNICAST_SENDER_BASED ? LINK_OPTION_RX : LINK_OPTION_TX | UNICAST_SLOT_SHARED_FLAG; - - if(timeslot == get_node_timeslot(&linkaddr_node_addr)) { - /* This is also our timeslot, add necessary flags */ - link_options |= ORCHESTRA_UNICAST_SENDER_BASED ? LINK_OPTION_TX | UNICAST_SLOT_SHARED_FLAG: LINK_OPTION_RX; - } - - /* Add/update link */ - tsch_schedule_add_link(sf_unicast, link_options, LINK_TYPE_NORMAL, &tsch_broadcast_address, - timeslot, channel_offset); - } -} -/*---------------------------------------------------------------------------*/ -static void -remove_uc_link(const linkaddr_t *linkaddr) -{ - uint16_t timeslot; - struct tsch_link *l; - - if(linkaddr == NULL) { - return; - } - - timeslot = get_node_timeslot(linkaddr); - l = tsch_schedule_get_link_by_timeslot(sf_unicast, timeslot); - if(l == NULL) { - return; - } - /* Does our current parent need this timeslot? */ - if(timeslot == get_node_timeslot(&orchestra_parent_linkaddr)) { - /* Yes, this timeslot is being used, return */ - return; - } - /* Does any other child need this timeslot? - * (lookup all route next hops) */ - nbr_table_item_t *item = nbr_table_head(nbr_routes); - while(item != NULL) { - linkaddr_t *addr = nbr_table_get_lladdr(nbr_routes, item); - if(timeslot == get_node_timeslot(addr)) { - /* Yes, this timeslot is being used, return */ - return; - } - item = nbr_table_next(nbr_routes, item); - } - - /* Do we need this timeslot? */ - if(timeslot == get_node_timeslot(&linkaddr_node_addr)) { - /* This is our link, keep it but update the link options */ - uint8_t link_options = ORCHESTRA_UNICAST_SENDER_BASED ? LINK_OPTION_TX | UNICAST_SLOT_SHARED_FLAG: LINK_OPTION_RX; - tsch_schedule_add_link(sf_unicast, link_options, LINK_TYPE_NORMAL, &tsch_broadcast_address, - timeslot, channel_offset); - } else { - /* Remove link */ - tsch_schedule_remove_link(sf_unicast, l); - } -} -/*---------------------------------------------------------------------------*/ -static void -child_added(const linkaddr_t *linkaddr) -{ - add_uc_link(linkaddr); -} -/*---------------------------------------------------------------------------*/ -static void -child_removed(const linkaddr_t *linkaddr) -{ - remove_uc_link(linkaddr); -} -/*---------------------------------------------------------------------------*/ -static int -select_packet(uint16_t *slotframe, uint16_t *timeslot) -{ - /* Select data packets we have a unicast link to */ - const linkaddr_t *dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); - if(packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE) == FRAME802154_DATAFRAME - && neighbor_has_uc_link(dest)) { - if(slotframe != NULL) { - *slotframe = slotframe_handle; - } - if(timeslot != NULL) { - *timeslot = ORCHESTRA_UNICAST_SENDER_BASED ? get_node_timeslot(&linkaddr_node_addr) : get_node_timeslot(dest); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -new_time_source(const struct tsch_neighbor *old, const struct tsch_neighbor *new) -{ - if(new != old) { - const linkaddr_t *old_addr = old != NULL ? &old->addr : NULL; - const linkaddr_t *new_addr = new != NULL ? &new->addr : NULL; - if(new_addr != NULL) { - linkaddr_copy(&orchestra_parent_linkaddr, new_addr); - } else { - linkaddr_copy(&orchestra_parent_linkaddr, &linkaddr_null); - } - remove_uc_link(old_addr); - add_uc_link(new_addr); - } -} -/*---------------------------------------------------------------------------*/ -static void -init(uint16_t sf_handle) -{ - slotframe_handle = sf_handle; - channel_offset = sf_handle; - /* Slotframe for unicast transmissions */ - sf_unicast = tsch_schedule_add_slotframe(slotframe_handle, ORCHESTRA_UNICAST_PERIOD); - uint16_t timeslot = get_node_timeslot(&linkaddr_node_addr); - tsch_schedule_add_link(sf_unicast, - ORCHESTRA_UNICAST_SENDER_BASED ? LINK_OPTION_TX | UNICAST_SLOT_SHARED_FLAG: LINK_OPTION_RX, - LINK_TYPE_NORMAL, &tsch_broadcast_address, - timeslot, channel_offset); -} -/*---------------------------------------------------------------------------*/ -struct orchestra_rule unicast_per_neighbor_rpl_storing = { - init, - new_time_source, - select_packet, - child_added, - child_removed, -}; - -#endif /* UIP_MAX_ROUTES */ diff --git a/os/services/orchestra/orchestra.c b/os/services/orchestra/orchestra.c deleted file mode 100644 index 8b9929c03..000000000 --- a/os/services/orchestra/orchestra.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2015, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Orchestra: an autonomous scheduler for TSCH exploiting RPL state. - * See "Orchestra: Robust Mesh Networks Through Autonomously Scheduled TSCH", ACM SenSys'15 - * - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "orchestra.h" -#include "net/packetbuf.h" -#include "net/ipv6/uip-icmp6.h" -#include "net/routing/routing.h" -#if ROUTING_CONF_RPL_LITE -#include "net/routing/rpl-lite/rpl.h" -#elif ROUTING_CONF_RPL_CLASSIC -#include "net/routing/rpl-classic/rpl.h" -#endif - -#define DEBUG DEBUG_PRINT -#include "net/ipv6/uip-debug.h" - -/* A net-layer sniffer for packets sent and received */ -static void orchestra_packet_received(void); -static void orchestra_packet_sent(int mac_status); -NETSTACK_SNIFFER(orchestra_sniffer, orchestra_packet_received, orchestra_packet_sent); - -/* The current RPL preferred parent's link-layer address */ -linkaddr_t orchestra_parent_linkaddr; -/* Set to one only after getting an ACK for a DAO sent to our preferred parent */ -int orchestra_parent_knows_us = 0; - -/* The set of Orchestra rules in use */ -const struct orchestra_rule *all_rules[] = ORCHESTRA_RULES; -#define NUM_RULES (sizeof(all_rules) / sizeof(struct orchestra_rule *)) - -/*---------------------------------------------------------------------------*/ -static void -orchestra_packet_received(void) -{ -} -/*---------------------------------------------------------------------------*/ -static void -orchestra_packet_sent(int mac_status) -{ - /* Check if our parent just ACKed a DAO */ - if(orchestra_parent_knows_us == 0 - && mac_status == MAC_TX_OK - && packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID) == UIP_PROTO_ICMP6 - && packetbuf_attr(PACKETBUF_ATTR_CHANNEL) == (ICMP6_RPL << 8 | RPL_CODE_DAO)) { - if(!linkaddr_cmp(&orchestra_parent_linkaddr, &linkaddr_null) - && linkaddr_cmp(&orchestra_parent_linkaddr, packetbuf_addr(PACKETBUF_ADDR_RECEIVER))) { - orchestra_parent_knows_us = 1; - } - } -} -/*---------------------------------------------------------------------------*/ -void -orchestra_callback_child_added(const linkaddr_t *addr) -{ - /* Notify all Orchestra rules that a child was added */ - int i; - for(i = 0; i < NUM_RULES; i++) { - if(all_rules[i]->child_added != NULL) { - all_rules[i]->child_added(addr); - } - } -} -/*---------------------------------------------------------------------------*/ -void -orchestra_callback_child_removed(const linkaddr_t *addr) -{ - /* Notify all Orchestra rules that a child was removed */ - int i; - for(i = 0; i < NUM_RULES; i++) { - if(all_rules[i]->child_removed != NULL) { - all_rules[i]->child_removed(addr); - } - } -} -/*---------------------------------------------------------------------------*/ -void -orchestra_callback_packet_ready(void) -{ - int i; - /* By default, use any slotframe, any timeslot */ - uint16_t slotframe = 9; - uint16_t timeslot = 0xffff; - - /* Loop over all rules until finding one able to handle the packet */ - for(i = 0; i < NUM_RULES; i++) { - if(all_rules[i]->select_packet != NULL) { - if(all_rules[i]->select_packet(&slotframe, ×lot)) { - break; - } - } - } - -#if TSCH_WITH_LINK_SELECTOR - packetbuf_set_attr(PACKETBUF_ATTR_TSCH_SLOTFRAME, slotframe); - packetbuf_set_attr(PACKETBUF_ATTR_TSCH_TIMESLOT, timeslot); -#endif -} -/*---------------------------------------------------------------------------*/ -void -orchestra_callback_new_time_source(const struct tsch_neighbor *old, const struct tsch_neighbor *new) -{ - /* Orchestra assumes that the time source is also the RPL parent. - * This is the case if the following is set: - * #define RPL_CALLBACK_PARENT_SWITCH tsch_rpl_callback_parent_switch - * */ - - int i; - if(new != old) { - orchestra_parent_knows_us = 0; - } - for(i = 0; i < NUM_RULES; i++) { - if(all_rules[i]->new_time_source != NULL) { - all_rules[i]->new_time_source(old, new); - } - } -} -/*---------------------------------------------------------------------------*/ -void -orchestra_init(void) -{ - int i; - /* Snoop on packet transmission to know if our parent knows about us - * (i.e. has ACKed at one of our DAOs since we decided to use it as a parent) */ - netstack_sniffer_add(&orchestra_sniffer); - linkaddr_copy(&orchestra_parent_linkaddr, &linkaddr_null); - /* Initialize all Orchestra rules */ - for(i = 0; i < NUM_RULES; i++) { - if(all_rules[i]->init != NULL) { - PRINTF("Orchestra: initializing rule %u\n", i); - all_rules[i]->init(i); - } - } - PRINTF("Orchestra: initialization done\n"); -} diff --git a/os/services/orchestra/orchestra.h b/os/services/orchestra/orchestra.h deleted file mode 100644 index 32450466d..000000000 --- a/os/services/orchestra/orchestra.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2015, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Orchestra header file - * - * \author Simon Duquennoy - */ - -#ifndef __ORCHESTRA_H__ -#define __ORCHESTRA_H__ - -#include "net/mac/tsch/tsch.h" -#include "orchestra-conf.h" - -/* The structure of an Orchestra rule */ -struct orchestra_rule { - void (* init)(uint16_t slotframe_handle); - void (* new_time_source)(const struct tsch_neighbor *old, const struct tsch_neighbor *new); - int (* select_packet)(uint16_t *slotframe, uint16_t *timeslot); - void (* child_added)(const linkaddr_t *addr); - void (* child_removed)(const linkaddr_t *addr); -}; - -struct orchestra_rule eb_per_time_source; -struct orchestra_rule unicast_per_neighbor_rpl_storing; -struct orchestra_rule unicast_per_neighbor_rpl_ns; -struct orchestra_rule default_common; - -extern linkaddr_t orchestra_parent_linkaddr; -extern int orchestra_parent_knows_us; - -/* Call from application to start Orchestra */ -void orchestra_init(void); -/* Callbacks requied for Orchestra to operate */ -/* Set with #define TSCH_CALLBACK_PACKET_READY orchestra_callback_packet_ready */ -void orchestra_callback_packet_ready(void); -/* Set with #define TSCH_CALLBACK_NEW_TIME_SOURCE orchestra_callback_new_time_source */ -void orchestra_callback_new_time_source(const struct tsch_neighbor *old, const struct tsch_neighbor *new); -/* Set with #define NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK orchestra_callback_child_added */ -void orchestra_callback_child_added(const linkaddr_t *addr); -/* Set with #define NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK orchestra_callback_child_removed */ -void orchestra_callback_child_removed(const linkaddr_t *addr); - -#endif /* __ORCHESTRA_H__ */ diff --git a/os/services/rpl-border-router/Makefile.rpl-border-router b/os/services/rpl-border-router/Makefile.rpl-border-router deleted file mode 100644 index 61ba5fa59..000000000 --- a/os/services/rpl-border-router/Makefile.rpl-border-router +++ /dev/null @@ -1,8 +0,0 @@ -include $(CONTIKI)/Makefile.identify-target - -# Include either native or embedded BR -ifeq ($(TARGET),native) - MODULES += os/services/rpl-border-router/native -else - MODULES += os/services/rpl-border-router/embedded -endif diff --git a/os/services/rpl-border-router/embedded/Makefile.embedded b/os/services/rpl-border-router/embedded/Makefile.embedded deleted file mode 100644 index 8324722fc..000000000 --- a/os/services/rpl-border-router/embedded/Makefile.embedded +++ /dev/null @@ -1,7 +0,0 @@ -PREFIX ?= fd00::1/64 - -connect-router: $(TUNSLIP6) - sudo $(TUNSLIP6) $(PREFIX) - -connect-router-cooja: $(TUNSLIP6) - sudo $(TUNSLIP6) -a 127.0.0.1 $(PREFIX) diff --git a/os/services/rpl-border-router/embedded/README.md b/os/services/rpl-border-router/embedded/README.md deleted file mode 100644 index 66ae6c4c8..000000000 --- a/os/services/rpl-border-router/embedded/README.md +++ /dev/null @@ -1,5 +0,0 @@ -This is a border router that runs embedded in a node. The node runs a full -6LoWPAN stack, and acts as a DAG root. It interfaces to the outside world -via a serial line. On the host Operating System, `tunslip6` is used to create -a tun interface and bridge it to the RPL border router. This is achieved with -makefile targets `connect-router` and `connect-router-cooja`. diff --git a/os/services/rpl-border-router/embedded/border-router-embedded.c b/os/services/rpl-border-router/embedded/border-router-embedded.c deleted file mode 100644 index 6b565a7ff..000000000 --- a/os/services/rpl-border-router/embedded/border-router-embedded.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * border-router - * \author - * Niclas Finne - * Joakim Eriksson - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "net/routing/routing.h" -#if PLATFORM_SUPPORTS_BUTTON_HAL -#include "dev/button-hal.h" -#else -#include "dev/button-sensor.h" -#endif -#include "dev/slip.h" -#include "rpl-border-router.h" - -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "BR" -#define LOG_LEVEL LOG_LEVEL_INFO - -void request_prefix(void); - -/*---------------------------------------------------------------------------*/ -PROCESS(border_router_process, "Border router process"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(border_router_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - -/* While waiting for the prefix to be sent through the SLIP connection, the future - * border router can join an existing DAG as a parent or child, or acquire a default - * router that will later take precedence over the SLIP fallback interface. - * Prevent that by turning the radio off until we are initialized as a DAG root. - */ - prefix_set = 0; - NETSTACK_MAC.off(); - - PROCESS_PAUSE(); - -#if !PLATFORM_SUPPORTS_BUTTON_HAL - SENSORS_ACTIVATE(button_sensor); -#endif - - LOG_INFO("RPL-Border router started\n"); - - /* Request prefix until it has been received */ - while(!prefix_set) { - etimer_set(&et, CLOCK_SECOND); - request_prefix(); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - LOG_INFO("Waiting for prefix\n"); - } - - NETSTACK_MAC.on(); - - print_local_addresses(); - - while(1) { - PROCESS_YIELD(); -#if PLATFORM_SUPPORTS_BUTTON_HAL - if(ev == button_hal_release_event) { -#else - if(ev == sensors_event && data == &button_sensor) { -#endif - LOG_INFO("Initiating global repair\n"); - NETSTACK_ROUTING.global_repair("Button press"); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/rpl-border-router/embedded/slip-bridge.c b/os/services/rpl-border-router/embedded/slip-bridge.c deleted file mode 100644 index b1349ac0a..000000000 --- a/os/services/rpl-border-router/embedded/slip-bridge.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Slip fallback interface - * \author - * Niclas Finne - * Joakim Eriksson - * Joel Hoglund - * Nicolas Tsiftes - */ -/*---------------------------------------------------------------------------*/ -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "dev/slip.h" -#include -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "SLIP" -#define LOG_LEVEL LOG_LEVEL_NONE -/*---------------------------------------------------------------------------*/ -void set_prefix_64(uip_ipaddr_t *); - -static uip_ipaddr_t last_sender; - -/*---------------------------------------------------------------------------*/ -void -request_prefix(void) -{ - /* mess up uip_buf with a dirty request... */ - uip_buf[0] = '?'; - uip_buf[1] = 'P'; - uip_len = 2; - slip_write(uip_buf, uip_len); - uipbuf_clear(); -} -/*---------------------------------------------------------------------------*/ -static void -slip_input_callback(void) -{ - LOG_DBG("SIN: %u\n", uip_len); - if(uip_buf[0] == '!') { - LOG_INFO("Got configuration message of type %c\n", - uip_buf[1]); - if(uip_buf[1] == 'P') { - uip_ipaddr_t prefix; - /* Here we set a prefix !!! */ - memset(&prefix, 0, 16); - memcpy(&prefix, &uip_buf[2], 8); - - uipbuf_clear(); - - LOG_INFO("Setting prefix "); - LOG_INFO_6ADDR(&prefix); - LOG_INFO_("\n"); - set_prefix_64(&prefix); - } - uipbuf_clear(); - - } else if(uip_buf[0] == '?') { - LOG_INFO("Got request message of type %c\n", uip_buf[1]); - if(uip_buf[1] == 'M') { - char *hexchar = "0123456789abcdef"; - int j; - /* this is just a test so far... just to see if it works */ - uip_buf[0] = '!'; - for(j = 0; j < UIP_LLADDR_LEN; j++) { - uip_buf[2 + j * 2] = hexchar[uip_lladdr.addr[j] >> 4]; - uip_buf[3 + j * 2] = hexchar[uip_lladdr.addr[j] & 15]; - } - uip_len = 18; - slip_write(uip_buf, uip_len); - } - uipbuf_clear(); - } else { - /* Save the last sender received over SLIP to avoid bouncing the - packet back if no route is found */ - uip_ipaddr_copy(&last_sender, &UIP_IP_BUF->srcipaddr); - } -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - slip_arch_init(); - process_start(&slip_process, NULL); - slip_set_input_callback(slip_input_callback); -} -/*---------------------------------------------------------------------------*/ -static int -output(void) -{ - if(uip_ipaddr_cmp(&last_sender, &UIP_IP_BUF->srcipaddr)) { - /* Do not bounce packets back over SLIP if the packet was received - over SLIP */ - LOG_ERR("slip-bridge: Destination off-link but no route src="); - LOG_ERR_6ADDR(&UIP_IP_BUF->srcipaddr); - LOG_ERR_(" dst="); - LOG_ERR_6ADDR(&UIP_IP_BUF->destipaddr); - LOG_ERR_("\n"); - } else { - LOG_DBG("SUT: %u\n", uip_len); - slip_send(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -const struct uip_fallback_interface rpl_interface = { - init, output -}; -/*---------------------------------------------------------------------------*/ diff --git a/os/services/rpl-border-router/module-macros.h b/os/services/rpl-border-router/module-macros.h deleted file mode 100644 index f3fad0b9b..000000000 --- a/os/services/rpl-border-router/module-macros.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 BUILD_WITH_RPL_BORDER_ROUTER 1 -#define UIP_FALLBACK_INTERFACE rpl_interface diff --git a/os/services/rpl-border-router/native/Makefile.native b/os/services/rpl-border-router/native/Makefile.native deleted file mode 100644 index 3f758c1be..000000000 --- a/os/services/rpl-border-router/native/Makefile.native +++ /dev/null @@ -1,13 +0,0 @@ -MODULES += os/services/slip-cmd -MODULES += os/services/shell - -MAKE_MAC = MAKE_MAC_OTHER -MAKE_NET = MAKE_NET_IPV6 - - -PREFIX ?= fd00::1/64 -connect-router: border-router.native - sudo rlwrap ./border-router.native $(PREFIX) - -connect-router-cooja: border-router.native - sudo rlwrap ./border-router.native -a localhost $(PREFIX) diff --git a/os/services/rpl-border-router/native/README.md b/os/services/rpl-border-router/native/README.md deleted file mode 100644 index 6d8ac38e1..000000000 --- a/os/services/rpl-border-router/native/README.md +++ /dev/null @@ -1,27 +0,0 @@ -This code connects a 802.15.4 radio over TTY with the full uIPv6 stack of -Contiki-NG including 6LoWPAN and 802.15.4 framing / parsing. The native border -router also acts as a RPL Root and handles the routing and maintains the RPL -network. Finally the native border router connects the full 6LoWPAN/RPL -network to the host (linux/os-x) network stack making it possible for -applications on the host to transparently reach all the nodes in the -6LoWPAN/RPL network. - -This is designed to interact with the a ../slip-radio example running on a -mote that is either directly USB/TTY connected, or is remote via a TCP -connect. What's on the SLIP interface is really not Serial Line IP, but SLIP -framed 15.4 packets. - -The native border router supports a number of commands on its stdin. -Each are prefixed by !: -* !G - global RPL repair root -* !M - set MAC address (if coming from RADIO, i.e. SLIP link) -* !C - show channel (if coming from RADIO, i.e. SLIP link) -* !D - sensor data received -* !Q - exit - -Queries are prefixed by ?: -* ?M is used for requesting the MAC address from the radio in order to use it for uIP6 and its stateless address auto configuration of its IPv6 address. This will make the native border router have the address that correspond to the MAC address of the slip-radio. (response is !M from the slip-radio) - -* ?C is used for requesting the currently used channel for the slip-radio. The response is !C with a channel number (from the slip-radio). - -* !C is used for setting the channel of the slip-radio (useful if the motes are using another channel than the one used in the slip-radio). diff --git a/os/services/rpl-border-router/native/border-router-cmds.c b/os/services/rpl-border-router/native/border-router-cmds.c deleted file mode 100644 index aa0d44710..000000000 --- a/os/services/rpl-border-router/native/border-router-cmds.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Sets up some commands for the border router - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "contiki.h" -#include "cmd.h" -#include "border-router.h" -#include "border-router-cmds.h" -#include "dev/serial-line.h" -#include "net/routing/routing.h" -#include "net/ipv6/uiplib.h" -#include -#include "shell.h" -#include - -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "BR" -#define LOG_LEVEL LOG_LEVEL_NONE - -uint8_t command_context; - -void packet_sent(uint8_t sessionid, uint8_t status, uint8_t tx); -void nbr_print_stat(void); - -/*---------------------------------------------------------------------------*/ -PROCESS(border_router_cmd_process, "Border router cmd process"); -/*---------------------------------------------------------------------------*/ -static const uint8_t * -hextoi(const uint8_t *buf, int len, int *v) -{ - *v = 0; - for(; len > 0; len--, buf++) { - if(*buf >= '0' && *buf <= '9') { - *v = (*v << 4) + ((*buf - '0') & 0xf); - } else if(*buf >= 'a' && *buf <= 'f') { - *v = (*v << 4) + ((*buf - 'a' + 10) & 0xf); - } else if(*buf >= 'A' && *buf <= 'F') { - *v = (*v << 4) + ((*buf - 'A' + 10) & 0xf); - } else { - break; - } - } - return buf; -} -/*---------------------------------------------------------------------------*/ -static const uint8_t * -dectoi(const uint8_t *buf, int len, int *v) -{ - int negative = 0; - *v = 0; - if(len <= 0) { - return buf; - } - if(*buf == '$') { - return hextoi(buf + 1, len - 1, v); - } - if(*buf == '0' && *(buf + 1) == 'x' && len > 2) { - return hextoi(buf + 2, len - 2, v); - } - if(*buf == '-') { - negative = 1; - buf++; - } - for(; len > 0; len--, buf++) { - if(*buf < '0' || *buf > '9') { - break; - } - *v = (*v * 10) + ((*buf - '0') & 0xf); - } - if(negative) { - *v = - *v; - } - return buf; -} -/*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------*/ -/* TODO: the below code needs some way of identifying from where the command */ -/* comes. In this case it can be from stdin or from SLIP. */ -/*---------------------------------------------------------------------------*/ -int -border_router_cmd_handler(const uint8_t *data, int len) -{ - /* handle global repair, etc here */ - if(data[0] == '!') { - LOG_DBG("Got configuration message of type %c\n", data[1]); - if(command_context == CMD_CONTEXT_STDIO) { - switch(data[1]) { - case 'G': - /* This is supposed to be from stdin */ - printf("Performing Global Repair...\n"); - NETSTACK_ROUTING.global_repair("Command"); - return 1; - case 'C': { - /* send on a set-param thing! */ - uint8_t set_param[] = {'!', 'V', 0, RADIO_PARAM_CHANNEL, 0, 0 }; - int channel = -1; - dectoi(&data[2], len - 2, &channel); - if(channel >= 0) { - set_param[5] = channel & 0xff; - write_to_slip(set_param, sizeof(set_param)); - } - return 1; - } - case 'P': { - /* send on a set-param thing! */ - uint8_t set_param[] = {'!', 'V', 0, RADIO_PARAM_PAN_ID, 0, 0 }; - int pan_id; - dectoi(&data[2], len - 2, &pan_id); - set_param[4] = (pan_id >> 8) & 0xff; - set_param[5] = pan_id & 0xff; - write_to_slip(set_param, sizeof(set_param)); - return 1; - } - default: - return 0; - } - } else if(command_context == CMD_CONTEXT_RADIO) { - /* We need to know that this is from the slip-radio here. */ - switch(data[1]) { - case 'M': - LOG_DBG("Setting MAC address\n"); - border_router_set_mac(&data[2]); - return 1; - case 'V': - if(data[3] == RADIO_PARAM_CHANNEL) { - printf("Channel is %d\n", data[5]); - } - if(data[3] == RADIO_PARAM_PAN_ID) { - printf("PAN_ID is 0x%04x\n", (data[4] << 8) + data[5]); - } - return 1; - case 'R': - LOG_DBG("Packet data report for sid:%d st:%d tx:%d\n", - data[2], data[3], data[4]); - packet_sent(data[2], data[3], data[4]); - return 1; - default: - return 0; - } - } - } else if(data[0] == '?') { - LOG_DBG("Got request message of type %c\n", data[1]); - if(data[1] == 'M' && command_context == CMD_CONTEXT_STDIO) { - uint8_t buf[20]; - char *hexchar = "0123456789abcdef"; - int j; - /* this is just a test so far... just to see if it works */ - buf[0] = '!'; - buf[1] = 'M'; - for(j = 0; j < UIP_LLADDR_LEN; j++) { - buf[2 + j * 2] = hexchar[uip_lladdr.addr[j] >> 4]; - buf[3 + j * 2] = hexchar[uip_lladdr.addr[j] & 15]; - } - cmd_send(buf, 18); - return 1; - } else if(data[1] == 'C' && command_context == CMD_CONTEXT_STDIO) { - /* send on a set-param thing! */ - uint8_t set_param[] = {'?', 'V', 0, RADIO_PARAM_CHANNEL}; - write_to_slip(set_param, sizeof(set_param)); - return 1; - } else if(data[1] == 'P' && command_context == CMD_CONTEXT_STDIO) { - /* send on a set-param thing! */ - uint8_t set_param[] = {'?', 'V', 0, RADIO_PARAM_PAN_ID}; - write_to_slip(set_param, sizeof(set_param)); - return 1; - } else if(data[1] == 'S') { - border_router_print_stat(); - return 1; - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -border_router_cmd_output(const uint8_t *data, int data_len) -{ - int i; - printf("CMD output: "); - for(i = 0; i < data_len; i++) { - printf("%c", data[i]); - } - printf("\n"); -} -/*---------------------------------------------------------------------------*/ -static void -serial_shell_output(const char *str) -{ - printf("%s", str); -} -/*---------------------------------------------------------------------------*/ - -PROCESS_THREAD(border_router_cmd_process, ev, data) -{ - static struct pt shell_input_pt; - PROCESS_BEGIN(); - - shell_init(); - - while(1) { - PROCESS_YIELD(); - if(ev == serial_line_event_message && data != NULL) { - LOG_DBG("Got serial data!!! %s of len: %u\n", - (char *)data, (unsigned)strlen((char *)data)); - command_context = CMD_CONTEXT_STDIO; - if(cmd_input(data, strlen((char *)data))) { - /* Commnand executed - all is fine */ - } else { - /* did not find command - run shell and see if ... */ - PROCESS_PT_SPAWN(&shell_input_pt, shell_input(&shell_input_pt, serial_shell_output, data)); - } - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/rpl-border-router/native/border-router-cmds.h b/os/services/rpl-border-router/native/border-router-cmds.h deleted file mode 100644 index 6dcef36a0..000000000 --- a/os/services/rpl-border-router/native/border-router-cmds.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Sets up some commands for the border router - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef BORDER_ROUTER_CMDS_H_ -#define BORDER_ROUTER_CMDS_H_ - -#define CMD_CONTEXT_RADIO 0 -#define CMD_CONTEXT_STDIO 1 - -extern uint8_t command_context; - -PROCESS_NAME(border_router_cmd_process); - -#endif /* BORDER_ROUTER_CMDS_H_ */ diff --git a/os/services/rpl-border-router/native/border-router-mac.c b/os/services/rpl-border-router/native/border-router-mac.c deleted file mode 100644 index 7fe4fc6ed..000000000 --- a/os/services/rpl-border-router/native/border-router-mac.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A null RDC implementation that uses framer for headers and sends - * the packets over slip instead of radio. - * \author - * Adam Dunkels - * Joakim Eriksson - * Niclas Finne - */ - -#include "net/packetbuf.h" -#include "net/queuebuf.h" -#include "net/netstack.h" -#include "packetutils.h" -#include "border-router.h" -#include - -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "BR-MAC" -#define LOG_LEVEL LOG_LEVEL_NONE - -#define MAX_CALLBACKS 16 -static int callback_pos; - -/* a structure for calling back when packet data is coming back - from radio... */ -struct tx_callback { - mac_callback_t cback; - void *ptr; - struct packetbuf_attr attrs[PACKETBUF_NUM_ATTRS]; - struct packetbuf_addr addrs[PACKETBUF_NUM_ADDRS]; -}; -/*---------------------------------------------------------------------------*/ -static struct tx_callback callbacks[MAX_CALLBACKS]; -/*---------------------------------------------------------------------------*/ -void -init_sec(void) -{ - /* use the CSMA LLSEC config parameter */ -#if LLSEC802154_USES_AUX_HEADER - if(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) == - PACKETBUF_ATTR_SECURITY_LEVEL_DEFAULT) { - packetbuf_set_attr(PACKETBUF_ATTR_SECURITY_LEVEL, - CSMA_LLSEC_SECURITY_LEVEL); - } -#endif -} -/*---------------------------------------------------------------------------*/ - -void -packet_sent(uint8_t sessionid, uint8_t status, uint8_t tx) -{ - if(sessionid < MAX_CALLBACKS) { - struct tx_callback *callback; - callback = &callbacks[sessionid]; - packetbuf_clear(); - packetbuf_attr_copyfrom(callback->attrs, callback->addrs); - mac_call_sent_callback(callback->cback, callback->ptr, status, tx); - } else { - LOG_ERR("Session id to high (%d)\n", sessionid); - } -} -/*---------------------------------------------------------------------------*/ -static int -setup_callback(mac_callback_t sent, void *ptr) -{ - struct tx_callback *callback; - int tmp = callback_pos; - callback = &callbacks[callback_pos]; - callback->cback = sent; - callback->ptr = ptr; - packetbuf_attr_copyto(callback->attrs, callback->addrs); - - callback_pos++; - if(callback_pos >= MAX_CALLBACKS) { - callback_pos = 0; - } - - return tmp; -} -/*---------------------------------------------------------------------------*/ -static void -send_packet(mac_callback_t sent, void *ptr) -{ - int size; - /* 3 bytes per packet attribute is required for serialization */ - uint8_t buf[PACKETBUF_NUM_ATTRS * 3 + PACKETBUF_SIZE + 3]; - uint8_t sid; - - packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); - - /* ack or not ? */ - packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1); - - /* Will make it send only DATA packets... for now */ - packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME); - - LOG_INFO("sending packet (%u bytes)\n", packetbuf_datalen()); - - if(NETSTACK_FRAMER.create() < 0) { - /* Failed to allocate space for headers */ - LOG_WARN("send failed, too large header\n"); - mac_call_sent_callback(sent, ptr, MAC_TX_ERR_FATAL, 1); - } else { - /* here we send the data over SLIP to the radio-chip */ - size = 0; -#if SERIALIZE_ATTRIBUTES - size = packetutils_serialize_atts(&buf[3], sizeof(buf) - 3); -#endif - if(size < 0 || size + packetbuf_totlen() + 3 > sizeof(buf)) { - LOG_WARN("send failed, too large header\n"); - mac_call_sent_callback(sent, ptr, MAC_TX_ERR_FATAL, 1); - } else { - sid = setup_callback(sent, ptr); - - buf[0] = '!'; - buf[1] = 'S'; - buf[2] = sid; /* sequence or session number for this packet */ - - /* Copy packet data */ - memcpy(&buf[3 + size], packetbuf_hdrptr(), packetbuf_totlen()); - - write_to_slip(buf, packetbuf_totlen() + size + 3); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -packet_input(void) -{ - if(NETSTACK_FRAMER.parse() < 0) { - LOG_DBG("failed to parse %u\n", packetbuf_datalen()); - } else { - NETSTACK_NETWORK.input(); - } -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -off() -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -max_payload() -{ - init_sec(); - return 127 - NETSTACK_FRAMER.length(); -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - callback_pos = 0; -} -/*---------------------------------------------------------------------------*/ -const struct mac_driver border_router_mac_driver = { - "br-mac", - init, - send_packet, - packet_input, - on, - off, - max_payload, -}; -/*---------------------------------------------------------------------------*/ diff --git a/os/services/rpl-border-router/native/border-router-native.c b/os/services/rpl-border-router/native/border-router-native.c deleted file mode 100644 index 2adebe121..000000000 --- a/os/services/rpl-border-router/native/border-router-native.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * border-router - * \author - * Niclas Finne - * Joakim Eriksson - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "contiki-net.h" - -#include "net/routing/routing.h" -#include "rpl-border-router.h" -#include "cmd.h" -#include "border-router.h" -#include "border-router-cmds.h" - -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "BR" -#define LOG_LEVEL LOG_LEVEL_INFO - -#include - -extern long slip_sent; -extern long slip_received; - -static uint8_t mac_set; - -extern int contiki_argc; -extern char **contiki_argv; -extern const char *slip_config_ipaddr; - -CMD_HANDLERS(border_router_cmd_handler); - -PROCESS(border_router_process, "Border router process"); - -/*---------------------------------------------------------------------------*/ -static void -request_mac(void) -{ - write_to_slip((uint8_t *)"?M", 2); -} -/*---------------------------------------------------------------------------*/ -void -border_router_set_mac(const uint8_t *data) -{ - memcpy(uip_lladdr.addr, data, sizeof(uip_lladdr.addr)); - linkaddr_set_node_addr((linkaddr_t *)uip_lladdr.addr); - - /* is this ok - should instead remove all addresses and - add them back again - a bit messy... ?*/ - PROCESS_CONTEXT_BEGIN(&tcpip_process); - uip_ds6_init(); - NETSTACK_ROUTING.init(); - PROCESS_CONTEXT_END(&tcpip_process); - - mac_set = 1; -} -/*---------------------------------------------------------------------------*/ -void -border_router_print_stat() -{ - printf("bytes received over SLIP: %ld\n", slip_received); - printf("bytes sent over SLIP: %ld\n", slip_sent); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(border_router_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - prefix_set = 0; - - PROCESS_PAUSE(); - - process_start(&border_router_cmd_process, NULL); - - LOG_INFO("RPL-Border router started\n"); - - slip_config_handle_arguments(contiki_argc, contiki_argv); - - /* tun init is also responsible for setting up the SLIP connection */ - tun_init(); - - while(!mac_set) { - etimer_set(&et, CLOCK_SECOND); - request_mac(); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - } - - if(slip_config_ipaddr != NULL) { - uip_ipaddr_t prefix; - - if(uiplib_ipaddrconv((const char *)slip_config_ipaddr, &prefix)) { - LOG_INFO("Setting prefix "); - LOG_INFO_6ADDR(&prefix); - LOG_INFO_("\n"); - set_prefix_64(&prefix); - } else { - LOG_ERR("Parse error: %s\n", slip_config_ipaddr); - exit(0); - } - } - - print_local_addresses(); - - while(1) { - etimer_set(&et, CLOCK_SECOND * 2); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - /* do anything here??? */ - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/rpl-border-router/native/border-router.h b/os/services/rpl-border-router/native/border-router.h deleted file mode 100644 index 91c405315..000000000 --- a/os/services/rpl-border-router/native/border-router.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Border router header file - * \author - * Joakim Eriksson - */ - -#ifndef BORDER_ROUTER_H_ -#define BORDER_ROUTER_H_ - -#include "contiki.h" -#include "net/ipv6/uip.h" -#include - -int border_router_cmd_handler(const uint8_t *data, int len); -int slip_config_handle_arguments(int argc, char **argv); -void write_to_slip(const uint8_t *buf, int len); - -void border_router_set_prefix_64(const uip_ipaddr_t *prefix_64); -void border_router_set_mac(const uint8_t *data); -void border_router_set_sensors(const char *data, int len); -void border_router_print_stat(void); - -void tun_init(void); - -int slip_init(void); -int slip_set_fd(int maxfd, fd_set *rset, fd_set *wset); -void slip_handle_fd(fd_set *rset, fd_set *wset); - -#endif /* BORDER_ROUTER_H_ */ diff --git a/os/services/rpl-border-router/native/module-macros.h b/os/services/rpl-border-router/native/module-macros.h deleted file mode 100644 index 6527738ad..000000000 --- a/os/services/rpl-border-router/native/module-macros.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ - -/* use a non-default network driver */ -#define NETSTACK_CONF_NETWORK sicslowpan_driver - -/* use a non-default MAC driver */ -#define NETSTACK_CONF_MAC border_router_mac_driver - -#define SLIP_DEV_CONF_SEND_DELAY (CLOCK_SECOND / 32) - -#define SERIALIZE_ATTRIBUTES 1 - -#define CMD_CONF_OUTPUT border_router_cmd_output - -/* used by wpcap (see /cpu/native/net/wpcap-drv.c) */ -#define SELECT_CALLBACK 1 diff --git a/os/services/rpl-border-router/native/slip-config.c b/os/services/rpl-border-router/native/slip-config.c deleted file mode 100644 index 7797a129f..000000000 --- a/os/services/rpl-border-router/native/slip-config.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Slip configuration - * \author - * Niclas Finne - * Joakim Eriksson - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "contiki.h" - -int slip_config_verbose = 0; -const char *slip_config_ipaddr; -int slip_config_flowcontrol = 0; -int slip_config_timestamp = 0; -const char *slip_config_siodev = NULL; -const char *slip_config_host = NULL; -const char *slip_config_port = NULL; -char slip_config_tundev[32] = { "" }; -uint16_t slip_config_basedelay = 0; - -#ifndef BAUDRATE -#define BAUDRATE B115200 -#endif -speed_t slip_config_b_rate = BAUDRATE; - -/*---------------------------------------------------------------------------*/ -int -slip_config_handle_arguments(int argc, char **argv) -{ - const char *prog; - int c; - int baudrate = 115200; - - slip_config_verbose = 0; - - prog = argv[0]; - while((c = getopt(argc, argv, "B:H:D:Lhs:t:v::d::a:p:T")) != -1) { - switch(c) { - case 'B': - baudrate = atoi(optarg); - break; - - case 'H': - slip_config_flowcontrol = 1; - break; - - case 'L': - slip_config_timestamp = 1; - break; - - case 's': - if(strncmp("/dev/", optarg, 5) == 0) { - slip_config_siodev = optarg + 5; - } else { - slip_config_siodev = optarg; - } - break; - - case 't': - if(strncmp("/dev/", optarg, 5) == 0) { - strncpy(slip_config_tundev, optarg + 5, sizeof(slip_config_tundev)); - } else { - strncpy(slip_config_tundev, optarg, sizeof(slip_config_tundev)); - } - break; - - case 'a': - slip_config_host = optarg; - break; - - case 'p': - slip_config_port = optarg; - break; - - case 'd': - slip_config_basedelay = 10; - if(optarg) { - slip_config_basedelay = atoi(optarg); - } - break; - - case 'v': - slip_config_verbose = 2; - if(optarg) { - slip_config_verbose = atoi(optarg); - } - break; - - case '?': - case 'h': - default: - fprintf(stderr, "usage: %s [options] ipaddress\n", prog); - fprintf(stderr, "example: border-router.native -L -v2 -s ttyUSB1 fd00::1/64\n"); - fprintf(stderr, "Options are:\n"); -#ifdef linux - fprintf(stderr, " -B baudrate 9600,19200,38400,57600,115200,921600 (default 115200)\n"); -#else - fprintf(stderr, " -B baudrate 9600,19200,38400,57600,115200 (default 115200)\n"); -#endif - fprintf(stderr, " -H Hardware CTS/RTS flow control (default disabled)\n"); - fprintf(stderr, " -L Log output format (adds time stamps)\n"); - fprintf(stderr, " -s siodev Serial device (default /dev/ttyUSB0)\n"); - fprintf(stderr, " -a host Connect via TCP to server at \n"); - fprintf(stderr, " -p port Connect via TCP to server at :\n"); - fprintf(stderr, " -t tundev Name of interface (default tun0)\n"); -#ifdef __APPLE__ - fprintf(stderr, " -v level Verbosity level\n"); -#else - fprintf(stderr, " -v[level] Verbosity level\n"); -#endif - fprintf(stderr, " -v0 No messages\n"); - fprintf(stderr, " -v1 Encapsulated SLIP debug messages (default)\n"); - fprintf(stderr, " -v2 Printable strings after they are received\n"); - fprintf(stderr, " -v3 Printable strings and SLIP packet notifications\n"); - fprintf(stderr, " -v4 All printable characters as they are received\n"); - fprintf(stderr, " -v5 All SLIP packets in hex\n"); -#ifndef __APPLE__ - fprintf(stderr, " -v Equivalent to -v3\n"); -#endif - fprintf(stderr, " -d[basedelay] Minimum delay between outgoing SLIP packets.\n"); - fprintf(stderr, " Actual delay is basedelay*(#6LowPAN fragments) milliseconds.\n"); - fprintf(stderr, " -d is equivalent to -d10.\n"); - exit(1); - break; - } - } - argc -= optind - 1; - argv += optind - 1; - - if(argc != 2 && argc != 3) { - err(1, "usage: %s [-B baudrate] [-H] [-L] [-s siodev] [-t tundev] [-T] [-v verbosity] [-d delay] [-a serveraddress] [-p serverport] ipaddress", prog); - } - slip_config_ipaddr = argv[1]; - - switch(baudrate) { - case -2: - break; /* Use default. */ - case 9600: - slip_config_b_rate = B9600; - break; - case 19200: - slip_config_b_rate = B19200; - break; - case 38400: - slip_config_b_rate = B38400; - break; - case 57600: - slip_config_b_rate = B57600; - break; - case 115200: - slip_config_b_rate = B115200; - break; -#ifdef linux - case 921600: - slip_config_b_rate = B921600; - break; -#endif - default: - err(1, "unknown baudrate %d", baudrate); - break; - } - - if(*slip_config_tundev == '\0') { - /* Use default. */ - strcpy(slip_config_tundev, "tun0"); - } - return 1; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/rpl-border-router/native/slip-dev.c b/os/services/rpl-border-router/native/slip-dev.c deleted file mode 100644 index 3ccd1db4b..000000000 --- a/os/services/rpl-border-router/native/slip-dev.c +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * Copyright (c) 2009, 2010 Joakim Eriksson, Niclas Finne, Dogan Yazar. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - * - */ - - /* Below define allows importing saved output into Wireshark as "Raw IP" packet type */ -#define WIRESHARK_IMPORT_FORMAT 1 -#include "contiki.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "cmd.h" -#include "border-router-cmds.h" - -extern int slip_config_verbose; -extern int slip_config_flowcontrol; -extern const char *slip_config_siodev; -extern const char *slip_config_host; -extern const char *slip_config_port; -extern uint16_t slip_config_basedelay; -extern speed_t slip_config_b_rate; - -#ifdef SLIP_DEV_CONF_SEND_DELAY -#define SEND_DELAY SLIP_DEV_CONF_SEND_DELAY -#else -#define SEND_DELAY 0 -#endif - -int devopen(const char *dev, int flags); - -static FILE *inslip; - -/* for statistics */ -long slip_sent = 0; -long slip_received = 0; - -int slipfd = 0; - -#define PROGRESS(s) do { } while(0) - -#define SLIP_END 0300 -#define SLIP_ESC 0333 -#define SLIP_ESC_END 0334 -#define SLIP_ESC_ESC 0335 - -/*---------------------------------------------------------------------------*/ -static void * -get_in_addr(struct sockaddr *sa) -{ - if(sa->sa_family == AF_INET) { - return &(((struct sockaddr_in *)sa)->sin_addr); - } - return &(((struct sockaddr_in6 *)sa)->sin6_addr); -} -/*---------------------------------------------------------------------------*/ -static int -connect_to_server(const char *host, const char *port) -{ - /* Setup TCP connection */ - struct addrinfo hints, *servinfo, *p; - char s[INET6_ADDRSTRLEN]; - int rv, fd; - - memset(&hints, 0, sizeof hints); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - if((rv = getaddrinfo(host, port, &hints, &servinfo)) != 0) { - err(1, "getaddrinfo: %s", gai_strerror(rv)); - return -1; - } - - /* loop through all the results and connect to the first we can */ - for(p = servinfo; p != NULL; p = p->ai_next) { - if((fd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) { - perror("client: socket"); - continue; - } - - if(connect(fd, p->ai_addr, p->ai_addrlen) == -1) { - close(fd); - perror("client: connect"); - continue; - } - break; - } - - if(p == NULL) { - err(1, "can't connect to ``%s:%s''", host, port); - return -1; - } - - fcntl(fd, F_SETFL, O_NONBLOCK); - - inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), - s, sizeof(s)); - - /* all done with this structure */ - freeaddrinfo(servinfo); - return fd; -} -/*---------------------------------------------------------------------------*/ -int -is_sensible_string(const unsigned char *s, int len) -{ - int i; - for(i = 1; i < len; i++) { - if(s[i] == 0 || s[i] == '\r' || s[i] == '\n' || s[i] == '\t') { - continue; - } else if(s[i] < ' ' || '~' < s[i]) { - return 0; - } - } - return 1; -} -/*---------------------------------------------------------------------------*/ -void -slip_packet_input(unsigned char *data, int len) -{ - packetbuf_copyfrom(data, len); - if(slip_config_verbose > 0) { - printf("Packet input over SLIP: %d\n", len); - } - NETSTACK_MAC.input(); -} -/*---------------------------------------------------------------------------*/ -/* - * Read from serial, when we have a packet call slip_packet_input. No output - * buffering, input buffered by stdio. - */ -void -serial_input(FILE *inslip) -{ - static unsigned char inbuf[2048]; - static int inbufptr = 0; - int ret, i; - unsigned char c; - -#ifdef linux - ret = fread(&c, 1, 1, inslip); - if(ret == -1 || ret == 0) { - err(1, "serial_input: read"); - } - goto after_fread; -#endif - -read_more: - if(inbufptr >= sizeof(inbuf)) { - fprintf(stderr, "*** dropping large %d byte packet\n", inbufptr); - inbufptr = 0; - } - ret = fread(&c, 1, 1, inslip); -#ifdef linux -after_fread: -#endif - if(ret == -1) { - err(1, "serial_input: read"); - } - if(ret == 0) { - clearerr(inslip); - return; - } - slip_received++; - switch(c) { - case SLIP_END: - if(inbufptr > 0) { - if(inbuf[0] == '!') { - command_context = CMD_CONTEXT_RADIO; - cmd_input(inbuf, inbufptr); - } else if(inbuf[0] == '?') { -#define DEBUG_LINE_MARKER '\r' - } else if(inbuf[0] == DEBUG_LINE_MARKER) { - fwrite(inbuf + 1, inbufptr - 1, 1, stdout); - } else if(is_sensible_string(inbuf, inbufptr)) { - if(slip_config_verbose == 1) { /* strings already echoed below for verbose>1 */ - fwrite(inbuf, inbufptr, 1, stdout); - } - } else { - if(slip_config_verbose > 2) { - printf("Packet from SLIP of length %d - write TUN\n", inbufptr); - if(slip_config_verbose > 4) { -#if WIRESHARK_IMPORT_FORMAT - printf("0000"); - for(i = 0; i < inbufptr; i++) { - printf(" %02x", inbuf[i]); - } -#else - printf(" "); - for(i = 0; i < inbufptr; i++) { - printf("%02x", inbuf[i]); - if((i & 3) == 3) { - printf(" "); - } - if((i & 15) == 15) { - printf("\n "); - } - } -#endif - printf("\n"); - } - } - slip_packet_input(inbuf, inbufptr); - } - inbufptr = 0; - } - break; - - case SLIP_ESC: - if(fread(&c, 1, 1, inslip) != 1) { - clearerr(inslip); - /* Put ESC back and give up! */ - ungetc(SLIP_ESC, inslip); - return; - } - - switch(c) { - case SLIP_ESC_END: - c = SLIP_END; - break; - case SLIP_ESC_ESC: - c = SLIP_ESC; - break; - } - /* FALLTHROUGH */ - default: - inbuf[inbufptr++] = c; - - /* Echo lines as they are received for verbose=2,3,5+ */ - /* Echo all printable characters for verbose==4 */ - if(slip_config_verbose == 4) { - if(c == 0 || c == '\r' || c == '\n' || c == '\t' || (c >= ' ' && c <= '~')) { - fwrite(&c, 1, 1, stdout); - } - } else if(slip_config_verbose >= 2) { - if(c == '\n' && is_sensible_string(inbuf, inbufptr)) { - fwrite(inbuf, inbufptr, 1, stdout); - inbufptr = 0; - } - } - break; - } - - goto read_more; -} -unsigned char slip_buf[2048]; -int slip_end, slip_begin, slip_packet_end, slip_packet_count; -static struct timer send_delay_timer; -/* delay between slip packets */ -static clock_time_t send_delay = SEND_DELAY; -/*---------------------------------------------------------------------------*/ -static void -slip_send(int fd, unsigned char c) -{ - if(slip_end >= sizeof(slip_buf)) { - err(1, "slip_send overflow"); - } - slip_buf[slip_end] = c; - slip_end++; - slip_sent++; - if(c == SLIP_END) { - /* Full packet received. */ - slip_packet_count++; - if(slip_packet_end == 0) { - slip_packet_end = slip_end; - } - } -} -/*---------------------------------------------------------------------------*/ -int -slip_empty() -{ - return slip_packet_end == 0; -} -/*---------------------------------------------------------------------------*/ -void -slip_flushbuf(int fd) -{ - int n; - - if(slip_empty()) { - return; - } - - n = write(fd, slip_buf + slip_begin, slip_packet_end - slip_begin); - - if(n == -1 && errno != EAGAIN) { - err(1, "slip_flushbuf write failed"); - } else if(n == -1) { - PROGRESS("Q"); /* Outqueue is full! */ - } else { - slip_begin += n; - if(slip_begin == slip_packet_end) { - slip_packet_count--; - if(slip_end > slip_packet_end) { - memmove(slip_buf, slip_buf + slip_packet_end, - slip_end - slip_packet_end); - } - slip_end -= slip_packet_end; - slip_begin = slip_packet_end = 0; - if(slip_end > 0) { - /* Find end of next slip packet */ - for(n = 1; n < slip_end; n++) { - if(slip_buf[n] == SLIP_END) { - slip_packet_end = n + 1; - break; - } - } - /* a delay between slip packets to avoid losing data */ - if(send_delay > 0) { - timer_set(&send_delay_timer, send_delay); - } - } - } - } -} -/*---------------------------------------------------------------------------*/ -static void -write_to_serial(int outfd, const uint8_t *inbuf, int len) -{ - const uint8_t *p = inbuf; - int i; - - if(slip_config_verbose > 2) { -#ifdef __CYGWIN__ - printf("Packet from WPCAP of length %d - write SLIP\n", len); -#else - printf("Packet from TUN of length %d - write SLIP\n", len); -#endif - if(slip_config_verbose > 4) { -#if WIRESHARK_IMPORT_FORMAT - printf("0000"); - for(i = 0; i < len; i++) { - printf(" %02x", p[i]); - } -#else - printf(" "); - for(i = 0; i < len; i++) { - printf("%02x", p[i]); - if((i & 3) == 3) { - printf(" "); - } - if((i & 15) == 15) { - printf("\n "); - } - } -#endif - printf("\n"); - } - } - - /* It would be ``nice'' to send a SLIP_END here but it's not - * really necessary. - */ - /* slip_send(outfd, SLIP_END); */ - - for(i = 0; i < len; i++) { - switch(p[i]) { - case SLIP_END: - slip_send(outfd, SLIP_ESC); - slip_send(outfd, SLIP_ESC_END); - break; - case SLIP_ESC: - slip_send(outfd, SLIP_ESC); - slip_send(outfd, SLIP_ESC_ESC); - break; - default: - slip_send(outfd, p[i]); - break; - } - } - slip_send(outfd, SLIP_END); - PROGRESS("t"); -} -/*---------------------------------------------------------------------------*/ -/* writes an 802.15.4 packet to slip-radio */ -void -write_to_slip(const uint8_t *buf, int len) -{ - if(slipfd > 0) { - write_to_serial(slipfd, buf, len); - } -} -/*---------------------------------------------------------------------------*/ -static void -stty_telos(int fd) -{ - struct termios tty; - speed_t speed = slip_config_b_rate; - int i; - - if(tcflush(fd, TCIOFLUSH) == -1) { - err(1, "tcflush"); - } - - if(tcgetattr(fd, &tty) == -1) { - err(1, "tcgetattr"); - } - - cfmakeraw(&tty); - - /* Nonblocking read. */ - tty.c_cc[VTIME] = 0; - tty.c_cc[VMIN] = 0; - if(slip_config_flowcontrol) { - tty.c_cflag |= CRTSCTS; - } else { - tty.c_cflag &= ~CRTSCTS; - } - tty.c_cflag &= ~HUPCL; - tty.c_cflag &= ~CLOCAL; - - cfsetispeed(&tty, speed); - cfsetospeed(&tty, speed); - - if(tcsetattr(fd, TCSAFLUSH, &tty) == -1) { - err(1, "tcsetattr"); - } - -#if 1 - /* Nonblocking read and write. */ - /* if(fcntl(fd, F_SETFL, O_NONBLOCK) == -1) err(1, "fcntl"); */ - - tty.c_cflag |= CLOCAL; - if(tcsetattr(fd, TCSAFLUSH, &tty) == -1) { - err(1, "tcsetattr"); - } - - i = TIOCM_DTR; - if(ioctl(fd, TIOCMBIS, &i) == -1) { - err(1, "ioctl"); - } -#endif - - usleep(10 * 1000); /* Wait for hardware 10ms. */ - - /* Flush input and output buffers. */ - if(tcflush(fd, TCIOFLUSH) == -1) { - err(1, "tcflush"); - } -} -/*---------------------------------------------------------------------------*/ -static int -set_fd(fd_set *rset, fd_set *wset) -{ - /* Anything to flush? */ - if(!slip_empty() && (send_delay == 0 || timer_expired(&send_delay_timer))) { - FD_SET(slipfd, wset); - } - - FD_SET(slipfd, rset); /* Read from slip ASAP! */ - return 1; -} -/*---------------------------------------------------------------------------*/ -static void -handle_fd(fd_set *rset, fd_set *wset) -{ - if(FD_ISSET(slipfd, rset)) { - serial_input(inslip); - } - - if(FD_ISSET(slipfd, wset)) { - slip_flushbuf(slipfd); - } -} -/*---------------------------------------------------------------------------*/ -static const struct select_callback slip_callback = { set_fd, handle_fd }; -/*---------------------------------------------------------------------------*/ -void -slip_init(void) -{ - setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */ - - if(slip_config_host != NULL) { - if(slip_config_port == NULL) { - slip_config_port = "60001"; - } - slipfd = connect_to_server(slip_config_host, slip_config_port); - if(slipfd == -1) { - err(1, "can't connect to ``%s:%s''", slip_config_host, slip_config_port); - } - } else if(slip_config_siodev != NULL) { - if(strcmp(slip_config_siodev, "null") == 0) { - /* Disable slip */ - return; - } - slipfd = devopen(slip_config_siodev, O_RDWR | O_NONBLOCK); - if(slipfd == -1) { - err(1, "can't open siodev ``/dev/%s''", slip_config_siodev); - } - } else { - static const char *siodevs[] = { - "ttyUSB0", "cuaU0", "ucom0" /* linux, fbsd6, fbsd5 */ - }; - int i; - for(i = 0; i < 3; i++) { - slip_config_siodev = siodevs[i]; - slipfd = devopen(slip_config_siodev, O_RDWR | O_NONBLOCK); - if(slipfd != -1) { - break; - } - } - if(slipfd == -1) { - err(1, "can't open siodev"); - } - } - - select_set_callback(slipfd, &slip_callback); - - if(slip_config_host != NULL) { - fprintf(stderr, "********SLIP opened to ``%s:%s''\n", slip_config_host, - slip_config_port); - } else { - fprintf(stderr, "********SLIP started on ``/dev/%s''\n", slip_config_siodev); - stty_telos(slipfd); - } - - timer_set(&send_delay_timer, 0); - slip_send(slipfd, SLIP_END); - inslip = fdopen(slipfd, "r"); - if(inslip == NULL) { - err(1, "slip_init: fdopen"); - } -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/rpl-border-router/native/tun-bridge.c b/os/services/rpl-border-router/native/tun-bridge.c deleted file mode 100644 index 26bc80bd7..000000000 --- a/os/services/rpl-border-router/native/tun-bridge.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - */ - -/** - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/*---------------------------------------------------------------------------*/ -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "BR" -#define LOG_LEVEL LOG_LEVEL_NONE - -#ifdef linux -#include -#include -#endif - -#include -#include "net/netstack.h" -#include "net/packetbuf.h" -#include "cmd.h" -#include "border-router.h" - -extern const char *slip_config_ipaddr; -extern char slip_config_tundev[32]; -extern uint16_t slip_config_basedelay; - -#ifndef __CYGWIN__ -static int tunfd; - -static int set_fd(fd_set *rset, fd_set *wset); -static void handle_fd(fd_set *rset, fd_set *wset); -static const struct select_callback tun_select_callback = { - set_fd, - handle_fd -}; -#endif /* __CYGWIN__ */ - -int ssystem(const char *fmt, ...) - __attribute__((__format__ (__printf__, 1, 2))); -int -ssystem(const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2))); - -int -ssystem(const char *fmt, ...) -{ - char cmd[128]; - va_list ap; - va_start(ap, fmt); - vsnprintf(cmd, sizeof(cmd), fmt, ap); - va_end(ap); - printf("%s\n", cmd); - fflush(stdout); - return system(cmd); -} -/*---------------------------------------------------------------------------*/ -void -cleanup(void) -{ - ssystem("ifconfig %s down", slip_config_tundev); -#ifndef linux - ssystem("sysctl -w net.ipv6.conf.all.forwarding=1"); -#endif - ssystem("netstat -nr" - " | awk '{ if ($2 == \"%s\") print \"route delete -net \"$1; }'" - " | sh", - slip_config_tundev); -} -/*---------------------------------------------------------------------------*/ -void -sigcleanup(int signo) -{ - fprintf(stderr, "signal %d\n", signo); - exit(0); /* exit(0) will call cleanup() */ -} -/*---------------------------------------------------------------------------*/ -void -ifconf(const char *tundev, const char *ipaddr) -{ -#ifdef linux - ssystem("ifconfig %s inet `hostname` up", tundev); - ssystem("ifconfig %s add %s", tundev, ipaddr); -#elif defined(__APPLE__) - ssystem("ifconfig %s inet6 %s up", tundev, ipaddr); - ssystem("sysctl -w net.inet.ip.forwarding=1"); -#else - ssystem("ifconfig %s inet `hostname` %s up", tundev, ipaddr); - ssystem("sysctl -w net.inet.ip.forwarding=1"); -#endif /* !linux */ - - /* Print the configuration to the console. */ - ssystem("ifconfig %s\n", tundev); -} -/*---------------------------------------------------------------------------*/ -int -devopen(const char *dev, int flags) -{ - char t[32]; - strcpy(t, "/dev/"); - strncat(t, dev, sizeof(t) - 5); - return open(t, flags); -} -/*---------------------------------------------------------------------------*/ -#ifdef linux -int -tun_alloc(char *dev) -{ - struct ifreq ifr; - int fd, err; - - if((fd = open("/dev/net/tun", O_RDWR)) < 0) { - return -1; - } - - memset(&ifr, 0, sizeof(ifr)); - - /* Flags: IFF_TUN - TUN device (no Ethernet headers) - * IFF_NO_PI - Do not provide packet information - */ - ifr.ifr_flags = IFF_TUN | IFF_NO_PI; - if(*dev != 0) { - strncpy(ifr.ifr_name, dev, IFNAMSIZ); - } - - if((err = ioctl(fd, TUNSETIFF, (void *)&ifr)) < 0) { - close(fd); - return err; - } - strcpy(dev, ifr.ifr_name); - return fd; -} -#else -int -tun_alloc(char *dev) -{ - return devopen(dev, O_RDWR); -} -#endif - -#ifdef __CYGWIN__ -/*wpcap process is used to connect to host interface */ -void -tun_init() -{ - setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */ - - slip_init(); -} -#else - -static uint16_t delaymsec = 0; -static uint32_t delaystartsec, delaystartmsec; - -/*---------------------------------------------------------------------------*/ -void -tun_init() -{ - setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */ - - slip_init(); - - LOG_INFO("Opening tun interface:%s\n", slip_config_tundev); - - tunfd = tun_alloc(slip_config_tundev); - - if(tunfd == -1) { - err(1, "tun_init: open"); - } - - select_set_callback(tunfd, &tun_select_callback); - - fprintf(stderr, "opened %s device ``/dev/%s''\n", - "tun", slip_config_tundev); - - atexit(cleanup); - signal(SIGHUP, sigcleanup); - signal(SIGTERM, sigcleanup); - signal(SIGINT, sigcleanup); - ifconf(slip_config_tundev, slip_config_ipaddr); -} -/*---------------------------------------------------------------------------*/ -static int -tun_output(uint8_t *data, int len) -{ - /* fprintf(stderr, "*** Writing to tun...%d\n", len); */ - if(write(tunfd, data, len) != len) { - err(1, "serial_to_tun: write"); - return -1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -int -tun_input(unsigned char *data, int maxlen) -{ - int size; - if((size = read(tunfd, data, maxlen)) == -1) { - err(1, "tun_input: read"); - } - return size; -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ -} -/*---------------------------------------------------------------------------*/ -static int -output(void) -{ - LOG_DBG("SUT: %u\n", uip_len); - if(uip_len > 0) { - return tun_output(uip_buf, uip_len); - } - return 0; -} -const struct uip_fallback_interface rpl_interface = { - init, output -}; - -/*---------------------------------------------------------------------------*/ -/* tun and slip select callback */ -/*---------------------------------------------------------------------------*/ -static int -set_fd(fd_set *rset, fd_set *wset) -{ - FD_SET(tunfd, rset); - return 1; -} -/*---------------------------------------------------------------------------*/ - -static void -handle_fd(fd_set *rset, fd_set *wset) -{ - /* Optional delay between outgoing packets */ - /* Base delay times number of 6lowpan fragments to be sent */ - /* delaymsec = 10; */ - if(delaymsec) { - struct timeval tv; - int dmsec; - gettimeofday(&tv, NULL); - dmsec = (tv.tv_sec - delaystartsec) * 1000 + tv.tv_usec / 1000 - delaystartmsec; - if(dmsec < 0) { - delaymsec = 0; - } - if(dmsec > delaymsec) { - delaymsec = 0; - } - } - - if(delaymsec == 0) { - int size; - - if(FD_ISSET(tunfd, rset)) { - size = tun_input(uip_buf, sizeof(uip_buf)); - /* printf("TUN data incoming read:%d\n", size); */ - uip_len = size; - tcpip_input(); - - if(slip_config_basedelay) { - struct timeval tv; - gettimeofday(&tv, NULL); - delaymsec = slip_config_basedelay; - delaystartsec = tv.tv_sec; - delaystartmsec = tv.tv_usec / 1000; - } - } - } -} -#endif /* __CYGWIN_ */ - -/*---------------------------------------------------------------------------*/ diff --git a/os/services/rpl-border-router/rpl-border-router.c b/os/services/rpl-border-router/rpl-border-router.c deleted file mode 100644 index f07a41fdd..000000000 --- a/os/services/rpl-border-router/rpl-border-router.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "net/routing/routing.h" -#include "rpl-border-router.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "BR" -#define LOG_LEVEL LOG_LEVEL_INFO - -uint8_t prefix_set; - -/*---------------------------------------------------------------------------*/ -void -print_local_addresses(void) -{ - int i; - uint8_t state; - - LOG_INFO("Server IPv6 addresses:\n"); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - LOG_INFO(" "); - LOG_INFO_6ADDR(&uip_ds6_if.addr_list[i].ipaddr); - LOG_INFO_("\n"); - } - } -} -/*---------------------------------------------------------------------------*/ -void -set_prefix_64(uip_ipaddr_t *prefix_64) -{ - prefix_set = 1; - NETSTACK_ROUTING.root_set_prefix(prefix_64, NULL); - NETSTACK_ROUTING.root_start(); -} -/*---------------------------------------------------------------------------*/ -void -rpl_border_router_init(void) -{ - PROCESS_NAME(border_router_process); - process_start(&border_router_process, NULL); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/rpl-border-router/rpl-border-router.h b/os/services/rpl-border-router/rpl-border-router.h deleted file mode 100644 index 50d66ad05..000000000 --- a/os/services/rpl-border-router/rpl-border-router.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" - -extern uint8_t prefix_set; - -void rpl_border_router_init(void); -void print_local_addresses(void); -void set_prefix_64(uip_ipaddr_t *prefix_64); diff --git a/os/services/shell/Makefile.shell b/os/services/shell/Makefile.shell deleted file mode 100644 index 9b9549018..000000000 --- a/os/services/shell/Makefile.shell +++ /dev/null @@ -1 +0,0 @@ -CFLAGS += -DBUILD_WITH_SHELL=1 diff --git a/os/services/shell/serial-shell.c b/os/services/shell/serial-shell.c deleted file mode 100644 index c2f389515..000000000 --- a/os/services/shell/serial-shell.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * A shell back-end for the serial port - * \author - * Adam Dunkels - * Simon Duquennoy - */ - -/** - * \addtogroup shell - * @{ - */ - -#include "contiki.h" -#include "dev/serial-line.h" -#include "sys/log.h" -#include "shell.h" -#include "serial-shell.h" - -/*---------------------------------------------------------------------------*/ -PROCESS(serial_shell_process, "Contiki serial shell"); - -/*---------------------------------------------------------------------------*/ -static void -serial_shell_output(const char *str) { - printf("%s", str); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(serial_shell_process, ev, data) -{ - PROCESS_BEGIN(); - - shell_init(); - - while(1) { - static struct pt shell_input_pt; - PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message && data != NULL); - PROCESS_PT_SPAWN(&shell_input_pt, shell_input(&shell_input_pt, serial_shell_output, data)); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -serial_shell_init(void) -{ - process_start(&serial_shell_process, NULL); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/services/shell/serial-shell.h b/os/services/shell/serial-shell.h deleted file mode 100644 index 2c364922c..000000000 --- a/os/services/shell/serial-shell.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A shell back-end for the serial port - * \author - * Adam Dunkels - * Simon Duquennoy - */ - -#ifndef SERIAL_SHELL_H_ -#define SERIAL_SHELL_H_ - -/** - * Initializes Serial Shell module - */ -void serial_shell_init(void); - -#endif /* SERIAL_SHELL_H_ */ diff --git a/os/services/shell/shell-commands.c b/os/services/shell/shell-commands.c deleted file mode 100644 index 0a48f7ce9..000000000 --- a/os/services/shell/shell-commands.c +++ /dev/null @@ -1,911 +0,0 @@ -/* - * Copyright (c) 2017, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * The Contiki shell commands - * \author - * Simon Duquennoy - */ - -/** - * \addtogroup shell - * @{ - */ - -#include "contiki.h" -#include "shell.h" -#include "shell-commands.h" -#include "lib/list.h" -#include "sys/log.h" -#include "dev/watchdog.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uiplib.h" -#include "net/ipv6/uip-icmp6.h" -#include "net/ipv6/uip-ds6.h" -#if MAC_CONF_WITH_TSCH -#include "net/mac/tsch/tsch.h" -#endif /* MAC_CONF_WITH_TSCH */ -#if MAC_CONF_WITH_CSMA -#include "net/mac/csma/csma.h" -#endif -#include "net/routing/routing.h" -#include "net/mac/llsec802154.h" - -/* For RPL-specific commands */ -#if ROUTING_CONF_RPL_LITE -#include "net/routing/rpl-lite/rpl.h" -#elif ROUTING_CONF_RPL_CLASSIC -#include "net/routing/rpl-classic/rpl.h" -#endif - -#include - -#define PING_TIMEOUT (5 * CLOCK_SECOND) - -#if NETSTACK_CONF_WITH_IPV6 -static struct uip_icmp6_echo_reply_notification echo_reply_notification; -static shell_output_func *curr_ping_output_func = NULL; -static struct process *curr_ping_process; -static uint8_t curr_ping_ttl; -static uint16_t curr_ping_datalen; -#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if TSCH_WITH_SIXTOP -static shell_command_6top_sub_cmd_t sixtop_sub_cmd = NULL; -#endif /* TSCH_WITH_SIXTOP */ -static struct shell_command_set_t builtin_shell_command_set; -LIST(shell_command_sets); -#if NETSTACK_CONF_WITH_IPV6 -/*---------------------------------------------------------------------------*/ -static const char * -ds6_nbr_state_to_str(uint8_t state) -{ - switch(state) { - case NBR_INCOMPLETE: - return "Incomplete"; - case NBR_REACHABLE: - return "Reachable"; - case NBR_STALE: - return "Stale"; - case NBR_DELAY: - return "Delay"; - case NBR_PROBE: - return "Probe"; - default: - return "Unknown"; - } -} -/*---------------------------------------------------------------------------*/ -static void -echo_reply_handler(uip_ipaddr_t *source, uint8_t ttl, uint8_t *data, uint16_t datalen) -{ - if(curr_ping_output_func != NULL) { - curr_ping_output_func = NULL; - curr_ping_ttl = ttl; - curr_ping_datalen = datalen; - process_poll(curr_ping_process); - } -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_ping(struct pt *pt, shell_output_func output, char *args)) -{ - static uip_ipaddr_t remote_addr; - static struct etimer timeout_timer; - char *next_args; - - PT_BEGIN(pt); - - SHELL_ARGS_INIT(args, next_args); - - /* Get argument (remote IPv6) */ - SHELL_ARGS_NEXT(args, next_args); - if(args == NULL) { - SHELL_OUTPUT(output, "Destination IPv6 address is not specified\n"); - PT_EXIT(pt); - } else if(uiplib_ipaddrconv(args, &remote_addr) == 0) { - SHELL_OUTPUT(output, "Invalid IPv6 address: %s\n", args); - PT_EXIT(pt); - } - - SHELL_OUTPUT(output, "Pinging "); - shell_output_6addr(output, &remote_addr); - SHELL_OUTPUT(output, "\n"); - - /* Send ping request */ - curr_ping_process = PROCESS_CURRENT(); - curr_ping_output_func = output; - etimer_set(&timeout_timer, PING_TIMEOUT); - uip_icmp6_send(&remote_addr, ICMP6_ECHO_REQUEST, 0, 4); - PT_WAIT_UNTIL(pt, curr_ping_output_func == NULL || etimer_expired(&timeout_timer)); - - if(curr_ping_output_func != NULL) { - SHELL_OUTPUT(output, "Timeout\n"); - curr_ping_output_func = NULL; - } else { - SHELL_OUTPUT(output, "Received ping reply from "); - shell_output_6addr(output, &remote_addr); - SHELL_OUTPUT(output, ", len %u, ttl %u, delay %lu ms\n", - curr_ping_datalen, curr_ping_ttl, (1000*(clock_time() - timeout_timer.timer.start))/CLOCK_SECOND); - } - - PT_END(pt); -} -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -#if ROUTING_CONF_RPL_LITE -/*---------------------------------------------------------------------------*/ -static const char * -rpl_state_to_str(enum rpl_dag_state state) -{ - switch(state) { - case DAG_INITIALIZED: - return "Initialized"; - case DAG_JOINED: - return "Joined"; - case DAG_REACHABLE: - return "Reachable"; - case DAG_POISONING: - return "Poisoning"; - default: - return "Unknown"; - } -} -/*---------------------------------------------------------------------------*/ -static const char * -rpl_mop_to_str(int mop) -{ - switch(mop) { - case RPL_MOP_NO_DOWNWARD_ROUTES: - return "No downward routes"; - case RPL_MOP_NON_STORING: - return "Non-storing"; - case RPL_MOP_STORING_NO_MULTICAST: - return "Storing"; - case RPL_MOP_STORING_MULTICAST: - return "Storing+multicast"; - default: - return "Unknown"; - } -} -/*---------------------------------------------------------------------------*/ -static const char * -rpl_ocp_to_str(int ocp) -{ - switch(ocp) { - case RPL_OCP_OF0: - return "OF0"; - case RPL_OCP_MRHOF: - return "MRHOF"; - default: - return "Unknown"; - } -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_rpl_nbr(struct pt *pt, shell_output_func output, char *args)) -{ - PT_BEGIN(pt); - - if(!curr_instance.used || rpl_neighbor_count() == 0) { - SHELL_OUTPUT(output, "RPL neighbors: none\n"); - } else { - rpl_nbr_t *nbr = nbr_table_head(rpl_neighbors); - SHELL_OUTPUT(output, "RPL neighbors:\n"); - while(nbr != NULL) { - char buf[120]; - rpl_neighbor_snprint(buf, sizeof(buf), nbr); - SHELL_OUTPUT(output, "%s\n", buf); - nbr = nbr_table_next(rpl_neighbors, nbr); - } - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_rpl_status(struct pt *pt, shell_output_func output, char *args)) -{ - PT_BEGIN(pt); - - SHELL_OUTPUT(output, "RPL status:\n"); - if(!curr_instance.used) { - SHELL_OUTPUT(output, "-- Instance: None\n"); - } else { - SHELL_OUTPUT(output, "-- Instance: %u\n", curr_instance.instance_id); - if(NETSTACK_ROUTING.node_is_root()) { - SHELL_OUTPUT(output, "-- DAG root\n"); - } else { - SHELL_OUTPUT(output, "-- DAG node\n"); - } - SHELL_OUTPUT(output, "-- DAG: "); - shell_output_6addr(output, &curr_instance.dag.dag_id); - SHELL_OUTPUT(output, ", version %u\n", curr_instance.dag.version); - SHELL_OUTPUT(output, "-- Prefix: "); - shell_output_6addr(output, &curr_instance.dag.prefix_info.prefix); - SHELL_OUTPUT(output, "/%u\n", curr_instance.dag.prefix_info.length); - SHELL_OUTPUT(output, "-- MOP: %s\n", rpl_mop_to_str(curr_instance.mop)); - SHELL_OUTPUT(output, "-- OF: %s\n", rpl_ocp_to_str(curr_instance.of->ocp)); - SHELL_OUTPUT(output, "-- Hop rank increment: %u\n", curr_instance.min_hoprankinc); - SHELL_OUTPUT(output, "-- Default lifetime: %lu seconds\n", RPL_LIFETIME(curr_instance.default_lifetime)); - - SHELL_OUTPUT(output, "-- State: %s\n", rpl_state_to_str(curr_instance.dag.state)); - SHELL_OUTPUT(output, "-- Preferred parent: "); - if(curr_instance.dag.preferred_parent) { - shell_output_6addr(output, rpl_neighbor_get_ipaddr(curr_instance.dag.preferred_parent)); - SHELL_OUTPUT(output, " (last DTSN: %u)\n", curr_instance.dag.preferred_parent->dtsn); - } else { - SHELL_OUTPUT(output, "None\n"); - } - SHELL_OUTPUT(output, "-- Rank: %u\n", curr_instance.dag.rank); - SHELL_OUTPUT(output, "-- Lowest rank: %u (%u)\n", curr_instance.dag.lowest_rank, curr_instance.max_rankinc); - SHELL_OUTPUT(output, "-- DTSN out: %u\n", curr_instance.dtsn_out); - SHELL_OUTPUT(output, "-- DAO sequence: last sent %u, last acked %u\n", - curr_instance.dag.dao_last_seqno, curr_instance.dag.dao_last_acked_seqno); - SHELL_OUTPUT(output, "-- Trickle timer: current %u, min %u, max %u, redundancy %u\n", - curr_instance.dag.dio_intcurrent, curr_instance.dio_intmin, - curr_instance.dio_intmin + curr_instance.dio_intdoubl, curr_instance.dio_redundancy); - - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_rpl_refresh_routes(struct pt *pt, shell_output_func output, char *args)) -{ - PT_BEGIN(pt); - - SHELL_OUTPUT(output, "Triggering routes refresh\n"); - rpl_refresh_routes("Shell"); - - PT_END(pt); -} -#endif /* ROUTING_CONF_RPL_LITE */ -/*---------------------------------------------------------------------------*/ -static void -shell_output_log_levels(shell_output_func output) -{ - int i = 0; - SHELL_OUTPUT(output, "Log levels:\n"); - while(all_modules[i].name != NULL) { - SHELL_OUTPUT(output, "-- %-10s: %u (%s)\n", - all_modules[i].name, - *all_modules[i].curr_log_level, - log_level_to_str(*all_modules[i].curr_log_level)); - i++; - } -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_log(struct pt *pt, shell_output_func output, char *args)) -{ - static int prev_level; - static int level; - char *next_args; - char *ptr; - char *module; - - PT_BEGIN(pt); - - SHELL_ARGS_INIT(args, next_args); - - /* Get and parse argument: module name */ - SHELL_ARGS_NEXT(args, next_args); - module = args; - prev_level = log_get_level(module); - if(module == NULL || (strcmp("all", module) && prev_level == -1)) { - SHELL_OUTPUT(output, "Invalid first argument: %s\n", module) - shell_output_log_levels(output); - PT_EXIT(pt); - } - - /* Get and parse argument: log level */ - SHELL_ARGS_NEXT(args, next_args); - if(args == NULL) { - level = -1; - } else { - level = (int)strtol(args, &ptr, 10); - } - if((level == 0 && args == ptr) - || level < LOG_LEVEL_NONE || level > LOG_LEVEL_DBG) { - SHELL_OUTPUT(output, "Invalid second argument: %s\n", args); - PT_EXIT(pt); - } - - /* Set log level */ - if(level != prev_level) { - log_set_level(module, level); -#if MAC_CONF_WITH_TSCH && TSCH_LOG_PER_SLOT - if(!strcmp(module, "mac") || !strcmp(module, "all")) { - if(level >= LOG_LEVEL_DBG) { - tsch_log_init(); - SHELL_OUTPUT(output, "TSCH logging started\n"); - } else { - tsch_log_stop(); - SHELL_OUTPUT(output, "TSCH logging stopped\n"); - } - } -#endif /* MAC_CONF_WITH_TSCH && TSCH_LOG_PER_SLOT */ - } - - shell_output_log_levels(output); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_help(struct pt *pt, shell_output_func output, char *args)) -{ - struct shell_command_set_t *set; - const struct shell_command_t *cmd; - PT_BEGIN(pt); - - SHELL_OUTPUT(output, "Available commands:\n"); - /* Note: we explicitly don't expend any code space to deal with shadowing */ - for(set = list_head(shell_command_sets); set != NULL; set = list_item_next(set)) { - for(cmd = set->commands; cmd->name != NULL; ++cmd) { - SHELL_OUTPUT(output, "%s\n", cmd->help); - } - } - - PT_END(pt); -} -#if UIP_CONF_IPV6_RPL -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_rpl_set_root(struct pt *pt, shell_output_func output, char *args)) -{ - static int is_on; - static uip_ipaddr_t prefix; - char *next_args; - - PT_BEGIN(pt); - - SHELL_ARGS_INIT(args, next_args); - - /* Get first arg (0/1) */ - SHELL_ARGS_NEXT(args, next_args); - - if(!strcmp(args, "1")) { - is_on = 1; - } else if(!strcmp(args, "0")) { - is_on = 0; - } else { - SHELL_OUTPUT(output, "Invalid argument: %s\n", args); - PT_EXIT(pt); - } - - /* Get first second arg (prefix) */ - SHELL_ARGS_NEXT(args, next_args); - if(args != NULL) { - if(uiplib_ipaddrconv(args, &prefix) == 0) { - SHELL_OUTPUT(output, "Invalid Prefix: %s\n", args); - PT_EXIT(pt); - } - } else { - const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix(); - uip_ip6addr_copy(&prefix, default_prefix); - } - - if(is_on) { - if(!NETSTACK_ROUTING.node_is_root()) { - SHELL_OUTPUT(output, "Setting as DAG root with prefix "); - shell_output_6addr(output, &prefix); - SHELL_OUTPUT(output, "/64\n"); - NETSTACK_ROUTING.root_set_prefix(&prefix, NULL); - NETSTACK_ROUTING.root_start(); - } else { - SHELL_OUTPUT(output, "Node is already a DAG root\n"); - } - } else { - if(NETSTACK_ROUTING.node_is_root()) { - SHELL_OUTPUT(output, "Setting as non-root node: leaving DAG\n"); - NETSTACK_ROUTING.leave_network(); - } else { - SHELL_OUTPUT(output, "Node is not a DAG root\n"); - } - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_rpl_global_repair(struct pt *pt, shell_output_func output, char *args)) -{ - PT_BEGIN(pt); - - SHELL_OUTPUT(output, "Triggering routing global repair\n"); - NETSTACK_ROUTING.global_repair("Shell"); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_rpl_local_repair(struct pt *pt, shell_output_func output, char *args)) -{ - PT_BEGIN(pt); - - SHELL_OUTPUT(output, "Triggering routing local repair\n"); - NETSTACK_ROUTING.local_repair("Shell"); - - PT_END(pt); -} -#endif /* UIP_CONF_IPV6_RPL */ -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_macaddr(struct pt *pt, shell_output_func output, char *args)) -{ - PT_BEGIN(pt); - - SHELL_OUTPUT(output, "Node MAC address: "); - shell_output_lladdr(output, &linkaddr_node_addr); - SHELL_OUTPUT(output, "\n"); - - PT_END(pt); -} -#if NETSTACK_CONF_WITH_IPV6 -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_ipaddr(struct pt *pt, shell_output_func output, char *args)) -{ - int i; - uint8_t state; - - PT_BEGIN(pt); - - SHELL_OUTPUT(output, "Node IPv6 addresses:\n"); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - SHELL_OUTPUT(output, "-- "); - shell_output_6addr(output, &uip_ds6_if.addr_list[i].ipaddr); - SHELL_OUTPUT(output, "\n"); - } - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_ip_neighbors(struct pt *pt, shell_output_func output, char *args)) -{ - uip_ds6_nbr_t *nbr; - - PT_BEGIN(pt); - - nbr = uip_ds6_nbr_head(); - if(nbr == NULL) { - SHELL_OUTPUT(output, "Node IPv6 neighbors: none\n"); - PT_EXIT(pt); - } - - SHELL_OUTPUT(output, "Node IPv6 neighbors:\n"); - while(nbr != NULL) { - SHELL_OUTPUT(output, "-- "); - shell_output_6addr(output, uip_ds6_nbr_get_ipaddr(nbr)); - SHELL_OUTPUT(output, " <-> "); - shell_output_lladdr(output, (linkaddr_t *)uip_ds6_nbr_get_ll(nbr)); - SHELL_OUTPUT(output, ", router %u, state %s ", - nbr->isrouter, ds6_nbr_state_to_str(nbr->state)); - SHELL_OUTPUT(output, "\n"); - nbr = uip_ds6_nbr_next(nbr); - } - - PT_END(pt); - -} -#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if MAC_CONF_WITH_TSCH -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_tsch_set_coordinator(struct pt *pt, shell_output_func output, char *args)) -{ - static int is_on; - static int is_secured; - char *next_args; - - PT_BEGIN(pt); - - SHELL_ARGS_INIT(args, next_args); - - /* Get first arg (0/1) */ - SHELL_ARGS_NEXT(args, next_args); - - if(!strcmp(args, "1")) { - is_on = 1; - } else if(!strcmp(args, "0")) { - is_on = 0; - } else { - SHELL_OUTPUT(output, "Invalid first argument: %s\n", args); - PT_EXIT(pt); - } - - /* Get first second arg (prefix) */ - SHELL_ARGS_NEXT(args, next_args); - if(args != NULL) { - if(!strcmp(args, "1")) { -#if LLSEC802154_ENABLED - is_secured = 1; -#else /* LLSEC802154_ENABLED */ - SHELL_OUTPUT(output, "Security is not compiled in.\n"); - is_secured = 0; -#endif /* LLSEC802154_ENABLED */ - } else if(!strcmp(args, "0")) { - is_secured = 0; - } else { - SHELL_OUTPUT(output, "Invalid second argument: %s\n", args); - PT_EXIT(pt); - } - } else { - is_secured = 0; - } - - SHELL_OUTPUT(output, "Setting as TSCH %s (%s)\n", - is_on ? "coordinator" : "non-coordinator", is_secured ? "secured" : "non-secured"); - - tsch_set_pan_secured(is_secured); - tsch_set_coordinator(is_on); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_tsch_status(struct pt *pt, shell_output_func output, char *args)) -{ - PT_BEGIN(pt); - - SHELL_OUTPUT(output, "TSCH status:\n"); - - SHELL_OUTPUT(output, "-- Is coordinator: %u\n", tsch_is_coordinator); - SHELL_OUTPUT(output, "-- Is associated: %u\n", tsch_is_associated); - if(tsch_is_associated) { - struct tsch_neighbor *n = tsch_queue_get_time_source(); - SHELL_OUTPUT(output, "-- PAN ID: 0x%x\n", frame802154_get_pan_id()); - SHELL_OUTPUT(output, "-- Is PAN secured: %u\n", tsch_is_pan_secured); - SHELL_OUTPUT(output, "-- Join priority: %u\n", tsch_join_priority); - SHELL_OUTPUT(output, "-- Time source: "); - if(n != NULL) { - shell_output_lladdr(output, &n->addr); - SHELL_OUTPUT(output, "\n"); - } else { - SHELL_OUTPUT(output, "none\n"); - } - SHELL_OUTPUT(output, "-- Last synchronized: %lu seconds ago\n", - (clock_time() - tsch_last_sync_time) / CLOCK_SECOND); - SHELL_OUTPUT(output, "-- Drift w.r.t. coordinator: %ld ppm\n", - tsch_adaptive_timesync_get_drift_ppm()); - SHELL_OUTPUT(output, "-- Network uptime: %lu seconds\n", - (unsigned long)(tsch_get_network_uptime_ticks() / CLOCK_SECOND)); - } - - PT_END(pt); -} -#endif /* MAC_CONF_WITH_TSCH */ -#if NETSTACK_CONF_WITH_IPV6 -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_routes(struct pt *pt, shell_output_func output, char *args)) -{ - uip_ds6_defrt_t *default_route; - - PT_BEGIN(pt); - - /* Our default route */ - SHELL_OUTPUT(output, "Default route:\n"); - default_route = uip_ds6_defrt_lookup(uip_ds6_defrt_choose()); - if(default_route != NULL) { - SHELL_OUTPUT(output, "-- "); - shell_output_6addr(output, &default_route->ipaddr); - if(default_route->lifetime.interval != 0) { - SHELL_OUTPUT(output, " (lifetime: %lu seconds)\n", (unsigned long)default_route->lifetime.interval); - } else { - SHELL_OUTPUT(output, " (lifetime: infinite)\n"); - } - } else { - SHELL_OUTPUT(output, "-- None\n"); - } - -#if UIP_CONF_IPV6_RPL - if(uip_sr_num_nodes() > 0) { - uip_sr_node_t *link; - /* Our routing links */ - SHELL_OUTPUT(output, "Routing links (%u in total):\n", uip_sr_num_nodes()); - link = uip_sr_node_head(); - while(link != NULL) { - char buf[100]; - uip_sr_link_snprint(buf, sizeof(buf), link); - SHELL_OUTPUT(output, "-- %s\n", buf); - link = uip_sr_node_next(link); - } - } else { - SHELL_OUTPUT(output, "No routing links\n"); - } -#endif /* UIP_CONF_IPV6_RPL */ - -#if (UIP_MAX_ROUTES != 0) - if(uip_ds6_route_num_routes() > 0) { - uip_ds6_route_t *route; - /* Our routing entries */ - SHELL_OUTPUT(output, "Routing entries (%u in total):\n", uip_ds6_route_num_routes()); - route = uip_ds6_route_head(); - while(route != NULL) { - SHELL_OUTPUT(output, "-- "); - shell_output_6addr(output, &route->ipaddr); - SHELL_OUTPUT(output, " via "); - shell_output_6addr(output, uip_ds6_route_nexthop(route)); - if((unsigned long)route->state.lifetime != 0xFFFFFFFF) { - SHELL_OUTPUT(output, " (lifetime: %lu seconds)\n", (unsigned long)route->state.lifetime); - } else { - SHELL_OUTPUT(output, " (lifetime: infinite)\n"); - } - route = uip_ds6_route_next(route); - } - } else { - SHELL_OUTPUT(output, "No routing entries\n"); - } -#endif /* (UIP_MAX_ROUTES != 0) */ - - PT_END(pt); -} -#endif /* NETSTACK_CONF_WITH_IPV6 */ -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_reboot(struct pt *pt, shell_output_func output, char *args)) -{ - PT_BEGIN(pt); - SHELL_OUTPUT(output, "rebooting\n"); - watchdog_reboot(); - PT_END(pt); -} -#if MAC_CONF_WITH_TSCH -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_tsch_schedule(struct pt *pt, shell_output_func output, char *args)) -{ - struct tsch_slotframe *sf; - - PT_BEGIN(pt); - - if(tsch_is_locked()) { - PT_EXIT(pt); - } - - sf = tsch_schedule_slotframe_head(); - - if(sf == NULL) { - SHELL_OUTPUT(output, "TSCH schedule: no slotframe\n"); - } else { - SHELL_OUTPUT(output, "TSCH schedule:\n"); - while(sf != NULL) { - struct tsch_link *l = list_head(sf->links_list); - - SHELL_OUTPUT(output, "-- Slotframe: handle %u, size %u, links:\n", sf->handle, sf->size.val); - - while(l != NULL) { - SHELL_OUTPUT(output, "---- Options %02x, type %u, timeslot %u, channel offset %u, address ", - l->link_options, l->link_type, l->timeslot, l->channel_offset); - shell_output_lladdr(output, &l->addr); - SHELL_OUTPUT(output, "\n"); - l = list_item_next(l); - } - - sf = tsch_schedule_slotframe_next(sf); - } - } - PT_END(pt); -} -#endif /* MAC_CONF_WITH_TSCH */ -/*---------------------------------------------------------------------------*/ -#if TSCH_WITH_SIXTOP -void -shell_commands_set_6top_sub_cmd(shell_command_6top_sub_cmd_t sub_cmd) -{ - sixtop_sub_cmd = sub_cmd; -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_6top(struct pt *pt, shell_output_func output, char *args)) -{ - char *next_args; - - PT_BEGIN(pt); - - SHELL_ARGS_INIT(args, next_args); - - if(sixtop_sub_cmd == NULL) { - SHELL_OUTPUT(output, "6top command is unavailable:\n"); - } else { - SHELL_OUTPUT(output, "6top: "); - sixtop_sub_cmd(output, args); - } - SHELL_ARGS_NEXT(args, next_args); - - PT_END(pt); -} -#endif /* TSCH_WITH_SIXTOP */ -/*---------------------------------------------------------------------------*/ -#if LLSEC802154_ENABLED -static -PT_THREAD(cmd_llsec_setlv(struct pt *pt, shell_output_func output, char *args)) -{ - - PT_BEGIN(pt); - - if(args == NULL) { - SHELL_OUTPUT(output, "Default LLSEC level is %d\n", - uipbuf_get_attr(UIPBUF_ATTR_LLSEC_LEVEL)); - PT_EXIT(pt); - } else { - int lv = atoi(args); - if(lv < 0 || lv > 7) { - SHELL_OUTPUT(output, "Illegal LLSEC Level %d\n", lv); - PT_EXIT(pt); - } else { - uipbuf_set_default_attr(UIPBUF_ATTR_LLSEC_LEVEL, lv); - uipbuf_clear_attr(); - SHELL_OUTPUT(output, "LLSEC default level set %d\n", lv); - } - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(cmd_llsec_setkey(struct pt *pt, shell_output_func output, char *args)) -{ - char *next_args; - - PT_BEGIN(pt); - - SHELL_ARGS_INIT(args, next_args); - - if(args == NULL) { - SHELL_OUTPUT(output, "Provide an index and a 16-char string for the key\n"); - PT_EXIT(pt); - } else { - int key; - SHELL_ARGS_NEXT(args, next_args); - key = atoi(args); - if(key < 0) { - SHELL_OUTPUT(output, "Illegal LLSEC Key index %d\n", key); - PT_EXIT(pt); - } else { -#if MAC_CONF_WITH_CSMA - /* Get next arg (key-string) */ - SHELL_ARGS_NEXT(args, next_args); - if(args == NULL) { - SHELL_OUTPUT(output, "Provide both an index and a key\n"); - } else if(strlen(args) == 16) { - csma_security_set_key(key, (const uint8_t *) args); - SHELL_OUTPUT(output, "Set key for index %d\n", key); - } else { - SHELL_OUTPUT(output, "Wrong length of key: '%s' (%d)\n", args, strlen(args)); - } -#else - SHELL_OUTPUT(output, "Set key not supported.\n"); - PT_EXIT(pt); -#endif - } - } - PT_END(pt); -} -#endif /* LLSEC802154_ENABLED */ -/*---------------------------------------------------------------------------*/ -void -shell_commands_init(void) -{ - list_init(shell_command_sets); - list_add(shell_command_sets, &builtin_shell_command_set); -#if NETSTACK_CONF_WITH_IPV6 - /* Set up Ping Reply callback */ - uip_icmp6_echo_reply_callback_add(&echo_reply_notification, - echo_reply_handler); -#endif /* NETSTACK_CONF_WITH_IPV6 */ -} -/*---------------------------------------------------------------------------*/ -void -shell_command_set_register(struct shell_command_set_t *set) -{ - list_push(shell_command_sets, set); -} -/*---------------------------------------------------------------------------*/ -int -shell_command_set_deregister(struct shell_command_set_t *set) -{ - if(!list_contains(shell_command_sets, set)) { - return !0; - } - list_remove(shell_command_sets, set); - return 0; -} -/*---------------------------------------------------------------------------*/ -const struct shell_command_t * -shell_command_lookup(const char *name) -{ - struct shell_command_set_t *set; - const struct shell_command_t *cmd; - - for(set = list_head(shell_command_sets); - set != NULL; - set = list_item_next(set)) { - for(cmd = set->commands; cmd->name != NULL; ++cmd) { - if(!strcmp(cmd->name, name)) { - return cmd; - } - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -const struct shell_command_t builtin_shell_commands[] = { - { "help", cmd_help, "'> help': Shows this help" }, - { "reboot", cmd_reboot, "'> reboot': Reboot the board by watchdog_reboot()" }, - { "log", cmd_log, "'> log module level': Sets log level (0--4) for a given module (or \"all\"). For module \"mac\", level 4 also enables per-slot logging." }, - { "mac-addr", cmd_macaddr, "'> mac-addr': Shows the node's MAC address" }, -#if NETSTACK_CONF_WITH_IPV6 - { "ip-addr", cmd_ipaddr, "'> ip-addr': Shows all IPv6 addresses" }, - { "ip-nbr", cmd_ip_neighbors, "'> ip-nbr': Shows all IPv6 neighbors" }, - { "ping", cmd_ping, "'> ping addr': Pings the IPv6 address 'addr'" }, - { "routes", cmd_routes, "'> routes': Shows the route entries" }, -#endif /* NETSTACK_CONF_WITH_IPV6 */ -#if UIP_CONF_IPV6_RPL - { "rpl-set-root", cmd_rpl_set_root, "'> rpl-set-root 0/1 [prefix]': Sets node as root (1) or not (0). A /64 prefix can be optionally specified." }, - { "rpl-local-repair", cmd_rpl_local_repair, "'> rpl-local-repair': Triggers a RPL local repair" }, -#if ROUTING_CONF_RPL_LITE - { "rpl-refresh-routes", cmd_rpl_refresh_routes, "'> rpl-refresh-routes': Refreshes all routes through a DTSN increment" }, - { "rpl-status", cmd_rpl_status, "'> rpl-status': Shows a summary of the current RPL state" }, - { "rpl-nbr", cmd_rpl_nbr, "'> rpl-nbr': Shows the RPL neighbor table" }, -#endif /* ROUTING_CONF_RPL_LITE */ - { "rpl-global-repair", cmd_rpl_global_repair, "'> rpl-global-repair': Triggers a RPL global repair" }, -#endif /* UIP_CONF_IPV6_RPL */ -#if MAC_CONF_WITH_TSCH - { "tsch-set-coordinator", cmd_tsch_set_coordinator, "'> tsch-set-coordinator 0/1 [0/1]': Sets node as coordinator (1) or not (0). Second, optional parameter: enable (1) or disable (0) security." }, - { "tsch-schedule", cmd_tsch_schedule, "'> tsch-schedule': Shows the current TSCH schedule" }, - { "tsch-status", cmd_tsch_status, "'> tsch-status': Shows a summary of the current TSCH state" }, -#endif /* MAC_CONF_WITH_TSCH */ -#if TSCH_WITH_SIXTOP - { "6top", cmd_6top, "'> 6top help': Shows 6top command usage" }, -#endif /* TSCH_WITH_SIXTOP */ -#if LLSEC802154_ENABLED - { "llsec-set-level", cmd_llsec_setlv, "'> llsec-set-level ': Set the level of link layer security (show if no lv argument)"}, - { "llsec-set-key", cmd_llsec_setkey, "'> llsec-set-key ': Set the key of link layer security"}, -#endif /* LLSEC802154_ENABLED */ - { NULL, NULL, NULL }, -}; - -static struct shell_command_set_t builtin_shell_command_set = { - .next = NULL, - .commands = builtin_shell_commands, -}; -/** @} */ diff --git a/os/services/shell/shell-commands.h b/os/services/shell/shell-commands.h deleted file mode 100644 index f510e861d..000000000 --- a/os/services/shell/shell-commands.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2017, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Main header file for the Contiki shell - * \author - * Simon Duquennoy - */ - -/** \addtogroup apps - * @{ */ - -#ifndef _SHELL_COMMANDS_H_ -#define _SHELL_COMMANDS_H_ - -/* Command handling function type */ -typedef char (shell_commands_func)(struct pt *pt, shell_output_func output, char *args); - -/* Command structure */ -struct shell_command_t { - const char *name; - shell_commands_func *func; - const char *help; -}; - -struct shell_command_set_t { - struct shell_command_set_t *next; - const struct shell_command_t *const commands; -}; - -void shell_command_set_register(struct shell_command_set_t *); -int shell_command_set_deregister(struct shell_command_set_t *); -const struct shell_command_t *shell_command_lookup(const char *); - -/** - * Initializes Shell-commands module - */ -void shell_commands_init(void); - -#include "net/mac/tsch/tsch.h" -#if TSCH_WITH_SIXTOP -typedef void (*shell_command_6top_sub_cmd_t)(shell_output_func output, - char *args); -void shell_commands_set_6top_sub_cmd(shell_command_6top_sub_cmd_t sub_cmd); -#endif /* TSCH_WITH_SIXTOP */ - -#endif /* _SHELL_COMMANDS_H_ */ - -/** @} */ diff --git a/os/services/shell/shell.c b/os/services/shell/shell.c deleted file mode 100644 index f5383ee5f..000000000 --- a/os/services/shell/shell.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2018, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * The shell application - * \author - * Simon Duquennoy - */ - -/** - * \addtogroup shell Shell - The shell enables to inspect and manage the network layer and provides - other system functionalities - * \ingroup lib - * @{ - */ - -#include "contiki.h" -#include "shell.h" -#include "shell-commands.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/ip64-addr.h" -#include "net/ipv6/uiplib.h" - -#if NETSTACK_CONF_WITH_IPV6 -/*---------------------------------------------------------------------------*/ -void -shell_output_6addr(shell_output_func output, const uip_ipaddr_t *ipaddr) -{ - char buf[UIPLIB_IPV6_MAX_STR_LEN]; - uiplib_ipaddr_snprint(buf, sizeof(buf), ipaddr); - SHELL_OUTPUT(output, "%s", buf); -} -#endif /* NETSTACK_CONF_WITH_IPV6 */ -/*---------------------------------------------------------------------------*/ -void -shell_output_lladdr(shell_output_func output, const linkaddr_t *lladdr) -{ - if(lladdr == NULL) { - SHELL_OUTPUT(output, "(NULL LL addr)"); - return; - } else { - unsigned int i; - for(i = 0; i < LINKADDR_SIZE; i++) { - if(i > 0 && i % 2 == 0) { - SHELL_OUTPUT(output, "."); - } - SHELL_OUTPUT(output, "%02x", lladdr->u8[i]); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -output_prompt(shell_output_func output) -{ - SHELL_OUTPUT(output, "#"); - shell_output_lladdr(output, &linkaddr_node_addr); - SHELL_OUTPUT(output, "> "); -} -/*---------------------------------------------------------------------------*/ -PT_THREAD(shell_input(struct pt *pt, shell_output_func output, const char *cmd)) -{ - static char *args; - static const struct shell_command_t *cmd_descr = NULL; - - PT_BEGIN(pt); - - /* Shave off any leading spaces. */ - while(*cmd == ' ') { - cmd++; - } - - /* Skip empty lines */ - if(*cmd != '\0') { - /* Look for arguments */ - args = strchr(cmd, ' '); - if(args != NULL) { - *args = '\0'; - args++; - } - - cmd_descr = shell_command_lookup(cmd); - if(cmd_descr != NULL) { - static struct pt cmd_pt; - PT_SPAWN(pt, &cmd_pt, cmd_descr->func(&cmd_pt, output, args)); - } else { - SHELL_OUTPUT(output, "Command not found. Type 'help' for a list of commands\n"); - } - } - - output_prompt(output); - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -void -shell_init(void) -{ - shell_commands_init(); -} -/** @} */ diff --git a/os/services/shell/shell.h b/os/services/shell/shell.h deleted file mode 100644 index 4f1b4186c..000000000 --- a/os/services/shell/shell.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2017, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Main header file for the Contiki shell - * \author - * Simon Duquennoy - */ - -/** \addtogroup apps - * @{ */ - -#ifndef SHELL_H_ -#define SHELL_H_ - -#include "net/ipv6/uip.h" -#include "net/linkaddr.h" -#include "sys/process.h" -#include - -/* Helper macros to parse arguments */ -#define SHELL_ARGS_INIT(args, next_args) (next_args) = (args); - -#define SHELL_ARGS_NEXT(args, next_args) do { \ - (args) = (next_args); \ - if((args) != NULL) { \ - if(*(args) == '\0') { \ - (args) = NULL; \ - } else { \ - (next_args) = strchr((args), ' '); \ - if((next_args) != NULL) { \ - *(next_args) = '\0'; \ - (next_args)++; \ - } \ - } \ - } else { \ - (next_args) = NULL; \ - } \ - } while(0) - -/* Printf-formatted output via a given output function */ -#define SHELL_OUTPUT(output_func, format, ...) do { \ - char buffer[192]; \ - snprintf(buffer, sizeof(buffer), format, ##__VA_ARGS__); \ - (output_func)(buffer); \ - } while(0); - -typedef void (shell_output_func)(const char *str); - -/** - * Initializes Shell module - */ -void shell_init(void); - -/** - * \brief A protothread that is spawned by a Shell driver when receiving a new line. - */ -PT_THREAD(shell_input(struct pt *pt, shell_output_func output, const char *cmd)); - -/** - * Prints an IPv6 address - * - * \param output The output function - * \param ipaddr The IPv6 to printed - */ -void shell_output_6addr(shell_output_func output, const uip_ipaddr_t *ipaddr); - -/** - * Prints a link-layer address - * - * \param output The output function - * \param lladdr The link-layer to be printed - */ -void shell_output_lladdr(shell_output_func output, const linkaddr_t *lladdr); - -#endif /* SHELL_H_ */ - -/** @} */ diff --git a/os/services/simple-energest/module-macros.h b/os/services/simple-energest/module-macros.h deleted file mode 100644 index f5ae1e890..000000000 --- a/os/services/simple-energest/module-macros.h +++ /dev/null @@ -1,2 +0,0 @@ -#define BUILD_WITH_SIMPLE_ENERGEST 1 -#define ENERGEST_CONF_ON 1 diff --git a/os/services/simple-energest/simple-energest.c b/os/services/simple-energest/simple-energest.c deleted file mode 100644 index fc7393bc6..000000000 --- a/os/services/simple-energest/simple-energest.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** -* \addtogroup simple-energest -* @{ -*/ - -/** - * \file - * A process that periodically prints out the time spent in - * radio tx, radio rx, total time and duty cycle. - * - * \author Simon Duquennoy - */ - -#include "contiki.h" -#include "sys/energest.h" -#include "simple-energest.h" -#include -#include - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "Energest" -#define LOG_LEVEL LOG_LEVEL_INFO - -static unsigned long last_tx, last_rx, last_time, last_cpu, last_lpm, last_deep_lpm; -static unsigned long delta_tx, delta_rx, delta_time, delta_cpu, delta_lpm, delta_deep_lpm; -static unsigned long curr_tx, curr_rx, curr_time, curr_cpu, curr_lpm, curr_deep_lpm; - -PROCESS(simple_energest_process, "Simple Energest"); -/*---------------------------------------------------------------------------*/ -static unsigned long -to_permil(unsigned long delta_metric, unsigned long delta_time) -{ - return (1000ul * (delta_metric)) / delta_time; -} -/*---------------------------------------------------------------------------*/ -static void -simple_energest_step(void) -{ - static unsigned count = 0; - - energest_flush(); - - curr_time = ENERGEST_GET_TOTAL_TIME(); - curr_cpu = energest_type_time(ENERGEST_TYPE_CPU); - curr_lpm = energest_type_time(ENERGEST_TYPE_LPM); - curr_deep_lpm = energest_type_time(ENERGEST_TYPE_DEEP_LPM); - curr_tx = energest_type_time(ENERGEST_TYPE_TRANSMIT); - curr_rx = energest_type_time(ENERGEST_TYPE_LISTEN); - - delta_time = curr_time - last_time; - delta_cpu = curr_cpu - last_cpu; - delta_lpm = curr_lpm - last_lpm; - delta_deep_lpm = curr_deep_lpm - last_deep_lpm; - delta_tx = curr_tx - last_tx; - delta_rx = curr_rx - last_rx; - - last_time = curr_time; - last_cpu = curr_cpu; - last_lpm = curr_lpm; - last_deep_lpm = curr_deep_lpm; - last_tx = curr_tx; - last_rx = curr_rx; - - LOG_INFO("--- Period summary #%u (%lu seconds)\n", count++, delta_time/ENERGEST_SECOND); - LOG_INFO("Total time : %10lu\n", delta_time); - LOG_INFO("CPU : %10lu/%10lu (%lu permil)\n", delta_cpu, delta_time, to_permil(delta_cpu, delta_time)); - LOG_INFO("LPM : %10lu/%10lu (%lu permil)\n", delta_lpm, delta_time, to_permil(delta_lpm, delta_time)); - LOG_INFO("Deep LPM : %10lu/%10lu (%lu permil)\n", delta_deep_lpm, delta_time, to_permil(delta_deep_lpm, delta_time)); - LOG_INFO("Radio Tx : %10lu/%10lu (%lu permil)\n", delta_tx, delta_time, to_permil(delta_tx, delta_time)); - LOG_INFO("Radio Rx : %10lu/%10lu (%lu permil)\n", delta_rx, delta_time, to_permil(delta_rx, delta_time)); - LOG_INFO("Radio total : %10lu/%10lu (%lu permil)\n", delta_tx+delta_rx, delta_time, to_permil(delta_tx+delta_rx, delta_time)); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(simple_energest_process, ev, data) -{ - static struct etimer periodic_timer; - PROCESS_BEGIN(); - - etimer_set(&periodic_timer, SIMPLE_ENERGEST_PERIOD); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_reset(&periodic_timer); - simple_energest_step(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -simple_energest_init(void) -{ - energest_flush(); - last_time = ENERGEST_GET_TOTAL_TIME(); - last_cpu = energest_type_time(ENERGEST_TYPE_CPU); - last_lpm = energest_type_time(ENERGEST_TYPE_LPM); - curr_tx = energest_type_time(ENERGEST_TYPE_TRANSMIT); - last_deep_lpm = energest_type_time(ENERGEST_TYPE_DEEP_LPM); - last_rx = energest_type_time(ENERGEST_TYPE_LISTEN); - process_start(&simple_energest_process, NULL); -} - -/** @} */ diff --git a/os/services/simple-energest/simple-energest.h b/os/services/simple-energest/simple-energest.h deleted file mode 100644 index 4f7281e9c..000000000 --- a/os/services/simple-energest/simple-energest.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - - /** - * \addtogroup simple-energest - * @{ - */ - - /** - * \file - * A process that periodically prints out the time spent in - * radio tx, radio rx, total time and duty cycle. - * - * \author Simon Duquennoy - */ - -#ifndef SIMPLE_ENERGEST_H_ -#define SIMPLE_ENERGEST_H_ - -/** \brief The period at which Energest statistics will be logged */ -#ifdef SIMPLE_ENERGEST_CONF_PERIOD -#define SIMPLE_ENERGEST_PERIOD SIMPLE_ENERGEST_CONF_PERIOD -#else /* SIMPLE_ENERGEST_CONF_PERIOD */ -#define SIMPLE_ENERGEST_PERIOD (CLOCK_SECOND * 60) -#endif /* SIMPLE_ENERGEST_CONF_PERIOD */ - -/** - * Initialize the deployment module - */ -void simple_energest_init(void); - -#endif /* SIMPLE_ENERGEST_H_ */ -/** @} */ diff --git a/os/services/slip-cmd/cmd.c b/os/services/slip-cmd/cmd.c deleted file mode 100644 index c821fe77c..000000000 --- a/os/services/slip-cmd/cmd.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A brief description of what this file is - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "cmd.h" - -#ifndef CMD_CONF_OUTPUT -#define CMD_OUTPUT slip_cmd_input -#else -#define CMD_OUTPUT CMD_CONF_OUTPUT -#endif /* CMD_CONF_OUTPUT */ - -void CMD_OUTPUT(const uint8_t *data, int data_len); - -extern const cmd_handler_t cmd_handlers[]; - -/*---------------------------------------------------------------------------*/ -int -cmd_input(const uint8_t *data, int data_len) -{ - int i; - for(i = 0; cmd_handlers[i] != NULL; i++) { - if(cmd_handlers[i](data, data_len)) { - /* Command has been handled */ - return 1; - } - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -void -cmd_send(const uint8_t *data, int data_len) -{ - CMD_OUTPUT(data, data_len); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/slip-cmd/cmd.h b/os/services/slip-cmd/cmd.h deleted file mode 100644 index c3282b536..000000000 --- a/os/services/slip-cmd/cmd.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Simple command handler - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef CMD_H_ -#define CMD_H_ - -#include "contiki.h" - -#define CMD_TYPE_ERR 'E' - -typedef int (* cmd_handler_t)(const uint8_t *data, int len); - -#define CMD_HANDLERS(...) \ -const cmd_handler_t cmd_handlers[] = {__VA_ARGS__, NULL} - -int cmd_input(const uint8_t *data, int data_len); -void cmd_send(const uint8_t *data, int data_len); - -#endif /* CMD_H_ */ diff --git a/os/services/slip-cmd/packetutils.c b/os/services/slip-cmd/packetutils.c deleted file mode 100644 index b7d8c75f3..000000000 --- a/os/services/slip-cmd/packetutils.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "net/packetbuf.h" -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -/*---------------------------------------------------------------------------*/ -int -packetutils_serialize_atts(uint8_t *data, int size) -{ - int i; - /* set the length first later */ - int pos = 1; - int cnt = 0; - /* assume that values are 16-bit */ - uint16_t val; - PRINTF("packetutils: serializing packet atts"); - for(i = 0; i < PACKETBUF_NUM_ATTRS; i++) { - val = packetbuf_attr(i); - if(val != 0) { - if(pos + 3 > size) { - return -1; - } - data[pos++] = i; - data[pos++] = val >> 8; - data[pos++] = val & 255; - cnt++; - PRINTF(" %d=%d", i, val); - } - } - PRINTF(" (%d)\n", cnt); - - data[0] = cnt; - return pos; -} -/*---------------------------------------------------------------------------*/ -int -packetutils_deserialize_atts(const uint8_t *data, int size) -{ - int i, cnt, pos; - - pos = 0; - cnt = data[pos++]; - PRINTF("packetutils: deserializing %d packet atts:", cnt); - if(cnt > PACKETBUF_NUM_ATTRS) { - PRINTF(" *** too many: %u!\n", PACKETBUF_NUM_ATTRS); - return -1; - } - for(i = 0; i < cnt; i++) { - if(data[pos] >= PACKETBUF_NUM_ATTRS) { - /* illegal attribute identifier */ - PRINTF(" *** unknown attribute %u\n", data[pos]); - return -1; - } - PRINTF(" %d=%d", data[pos], (data[pos + 1] << 8) | data[pos + 2]); - packetbuf_set_attr(data[pos], (data[pos + 1] << 8) | data[pos + 2]); - pos += 3; - } - PRINTF("\n"); - return pos; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/slip-cmd/packetutils.h b/os/services/slip-cmd/packetutils.h deleted file mode 100644 index 09ae4ed15..000000000 --- a/os/services/slip-cmd/packetutils.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2011, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 PACKETUTILS_H_ -#define PACKETUTILS_H_ - -int packetutils_serialize_atts(uint8_t *data, int size); - -int packetutils_deserialize_atts(const uint8_t *data, int size); - -#endif /* PACKETUTILS_H_ */ diff --git a/os/services/tsch-cs/Makefile b/os/services/tsch-cs/Makefile deleted file mode 100644 index 23e2acb3d..000000000 --- a/os/services/tsch-cs/Makefile +++ /dev/null @@ -1 +0,0 @@ -CFLAGS += -DBUILD_WITH_TSCH_CS=1 diff --git a/os/services/tsch-cs/tsch-cs.c b/os/services/tsch-cs/tsch-cs.c deleted file mode 100644 index 801f74b77..000000000 --- a/os/services/tsch-cs/tsch-cs.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 2016-2018, University of Bristol - http://www.bristol.ac.uk - * - * 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 INSTITUTE 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 INSTITUTE 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 - * Source file for TSCH adaptive channel selection - * \author - * Atis Elsts - */ - -#include "tsch.h" -#include "tsch-stats.h" -#include "tsch-cs.h" - -/* Log configuration */ -#include "sys/log.h" -#define LOG_MODULE "TSCH CS" -#define LOG_LEVEL LOG_LEVEL_MAC - -/*---------------------------------------------------------------------------*/ - -/* Allow to change only 1 channel at once */ -#define TSCH_CS_MAX_CHANNELS_CHANGED 1 - -/* Do not up change channels more frequently than this */ -#define TSCH_CS_MIN_UPDATE_INTERVAL_SEC 60 - -/* Do not change channels if the difference in qualities is below this */ -#define TSCH_CS_HYSTERESIS (TSCH_STATS_BINARY_SCALING_FACTOR / 10) - -/* After removing a channel from the sequence, do not add it back at least this time */ -#define TSCH_CS_BLACKLIST_DURATION_SEC (5 * 60) - -/* A potential for change detected? */ -static bool recaculation_requested; - -/* Time (in seconds) when channels were marked as busy; 0 if they are not busy */ -static uint32_t tsch_cs_busy_since[TSCH_STATS_NUM_CHANNELS]; - -/* - * The following variables are kept in order to avoid completely migrating away - * from the initial hopping sequence (as then new nodes would not be able to join). - * The invariant is: tsch_cs_initial_bitmap & tsch_cs_current_bitmap != 0 - */ -/* The bitmap with the initial channels */ -static tsch_cs_bitmap_t tsch_cs_initial_bitmap; -/* The bitmap with the current channels */ -static tsch_cs_bitmap_t tsch_cs_current_bitmap; - -/* structure for sorting */ -struct tsch_cs_quality { - /* channel number */ - uint8_t channel; - /* the higher, the better */ - tsch_stat_t metric; -}; -/*---------------------------------------------------------------------------*/ -static inline bool -tsch_cs_bitmap_contains(tsch_cs_bitmap_t bitmap, uint8_t channel) -{ - return (1 << (channel - TSCH_STATS_FIRST_CHANNEL)) & bitmap; -} -/*---------------------------------------------------------------------------*/ -static inline tsch_cs_bitmap_t -tsch_cs_bitmap_set(tsch_cs_bitmap_t bitmap, uint8_t channel) -{ - return (1 << (channel - TSCH_STATS_FIRST_CHANNEL)) | bitmap; -} -/*---------------------------------------------------------------------------*/ -static tsch_cs_bitmap_t -tsch_cs_bitmap_calc(void) -{ - tsch_cs_bitmap_t result = 0; - int i; - for(i = 0; i < tsch_hopping_sequence_length.val; ++i) { - result = tsch_cs_bitmap_set(result, tsch_hopping_sequence[i]); - } - return result; -} -/*---------------------------------------------------------------------------*/ -void -tsch_cs_adaptations_init(void) -{ - tsch_cs_initial_bitmap = tsch_cs_bitmap_calc(); - tsch_cs_current_bitmap = tsch_cs_initial_bitmap; -} -/*---------------------------------------------------------------------------*/ -/* Sort the elements to that the channels with the best metrics are in the front */ -static void -tsch_cs_bubble_sort(struct tsch_cs_quality *qualities) -{ - int i, j; - struct tsch_cs_quality tmp; - - for(i = 0; i < TSCH_STATS_NUM_CHANNELS; ++i) { - for(j = 0; j + 1 < TSCH_STATS_NUM_CHANNELS; ++j) { - if(qualities[j].metric < qualities[j+1].metric){ - tmp = qualities[j]; - qualities[j] = qualities[j+1]; - qualities[j+1] = tmp; - } - } - } -} -/*---------------------------------------------------------------------------*/ -/* Select a single, currently unused, good enough channel. Returns 0xff on failure. */ -static uint8_t -tsch_cs_select_replacement(uint8_t old_channel, tsch_stat_t old_ewma, - struct tsch_cs_quality *qualities, uint8_t is_in_sequence[]) -{ - int i; - uint32_t now = clock_seconds(); - tsch_cs_bitmap_t bitmap = tsch_cs_bitmap_set(0, old_channel); - - /* Don't want to replace a channel if the improvement is miniscule (< 10%) */ - old_ewma += TSCH_CS_HYSTERESIS; - - /* iterate up to -1 because we know that at least one of the channels is bad */ - for(i = 0; i < TSCH_STATS_NUM_CHANNELS - 1; ++i) { - /* select a replacement candidate */ - uint8_t candidate = qualities[i].channel; - - if(qualities[i].metric < TSCH_CS_FREE_THRESHOLD) { - /* This channel is not good enough. - * since we know that the other channels in the sorted list are even worse, - * it makes sense to return immediately rather than to continue t - */ - LOG_DBG("ch %u: busy\n", candidate); - return 0xff; - } - - if(qualities[i].metric < old_ewma) { - /* not good enough to replace */ - LOG_DBG("ch %u: hysteresis check failed\n", candidate); - return 0xff; - } - - /* already in the current TSCH hopping sequence? */ - if(is_in_sequence[candidate - TSCH_STATS_FIRST_CHANNEL] != 0xff) { - LOG_DBG("ch %u: in seq\n", candidate); - continue; - } - - /* ignore this candidate if too recently blacklisted */ - if(tsch_cs_busy_since[candidate - TSCH_STATS_FIRST_CHANNEL] != 0 - && tsch_cs_busy_since[candidate - TSCH_STATS_FIRST_CHANNEL] + TSCH_CS_BLACKLIST_DURATION_SEC > now) { - LOG_DBG("ch %u: recent bl\n", candidate); - continue; - } - - /* check if removing the old channel would break our hopping sequence invariant */ - if(bitmap == (tsch_cs_initial_bitmap & tsch_cs_current_bitmap)) { - /* the channel is the only one that belongs to both */ - if(!tsch_cs_bitmap_contains(tsch_cs_initial_bitmap, candidate)) { - /* the candidate is not in the initial sequence; not acceptable */ - continue; - } - } - - return candidate; - } - - return 0xff; -} -/*---------------------------------------------------------------------------*/ -bool -tsch_cs_process(void) -{ - int i; - bool try_replace; - bool has_replaced; - struct tsch_cs_quality qualities[TSCH_STATS_NUM_CHANNELS]; - uint8_t is_channel_busy[TSCH_STATS_NUM_CHANNELS]; - uint8_t is_in_sequence[TSCH_STATS_NUM_CHANNELS]; - static uint32_t last_time_changed; - - if(!recaculation_requested) { - /* nothing to do */ - return false; - } - - if(last_time_changed != 0 && last_time_changed + TSCH_CS_MIN_UPDATE_INTERVAL_SEC > clock_seconds()) { - /* too soon */ - return false; - } - - /* reset the flag */ - recaculation_requested = false; - - for(i = 0; i < TSCH_STATS_NUM_CHANNELS; ++i) { - qualities[i].channel = i + TSCH_STATS_FIRST_CHANNEL; - qualities[i].metric = tsch_stats.channel_free_ewma[i]; - } - - /* bubble sort the channels */ - tsch_cs_bubble_sort(qualities); - - /* start with the threshold values */ - for(i = 0; i < TSCH_STATS_NUM_CHANNELS; ++i) { - is_channel_busy[i] = (tsch_stats.channel_free_ewma[i] < TSCH_CS_FREE_THRESHOLD); - } - memset(is_in_sequence, 0xff, sizeof(is_in_sequence)); - for(i = 0; i < tsch_hopping_sequence_length.val; ++i) { - uint8_t channel = tsch_hopping_sequence[i]; - is_in_sequence[channel - TSCH_STATS_FIRST_CHANNEL] = i; - } - - /* mark the first N channels as "good" - there is nothing better to select */ - for(i = 0; i < tsch_hopping_sequence_length.val; ++i) { - is_channel_busy[qualities[i].channel - TSCH_STATS_FIRST_CHANNEL] = 0; - } - - for(i = 0; i < TSCH_STATS_NUM_CHANNELS; ++i) { - uint8_t ci = qualities[i].channel - TSCH_STATS_FIRST_CHANNEL; - (void)ci; - LOG_DBG("ch %u q %u busy %u in seq %u\n", - qualities[i].channel, - qualities[i].metric, - is_channel_busy[ci], - is_in_sequence[ci] == 0xff ? 0 : 1); - } - - try_replace = false; - for(i = 0; i < tsch_hopping_sequence_length.val; ++i) { - uint8_t channel = tsch_hopping_sequence[i]; - if(is_channel_busy[channel - TSCH_STATS_FIRST_CHANNEL]) { - try_replace = true; - } - } - if(!try_replace) { - LOG_DBG("cs: not replacing\n"); - return false; - } - - has_replaced = false; - for(i = TSCH_STATS_NUM_CHANNELS - 1; i >= tsch_hopping_sequence_length.val; --i) { - if(is_in_sequence[qualities[i].channel - TSCH_STATS_FIRST_CHANNEL] != 0xff) { - /* found the worst channel; it must be busy */ - uint8_t channel = qualities[i].channel; - tsch_stat_t ewma_metric = qualities[i].metric; - uint8_t replacement = tsch_cs_select_replacement(channel, ewma_metric, - qualities, is_in_sequence); - uint8_t position = is_in_sequence[channel - TSCH_STATS_FIRST_CHANNEL]; - - if(replacement != 0xff) { - printf("\ncs: replacing channel %u %u (%u) with %u\n", - channel, tsch_hopping_sequence[position], position, replacement); - /* mark the old channel as busy */ - tsch_cs_busy_since[channel - TSCH_STATS_FIRST_CHANNEL] = clock_seconds(); - /* do the actual replacement in the global TSCH HS variable */ - tsch_hopping_sequence[position] = replacement; - has_replaced = true; - /* recalculate the hopping sequence bitmap */ - tsch_cs_current_bitmap = tsch_cs_bitmap_calc(); - } - break; /* replace just one at once */ - } - } - - if(has_replaced) { - last_time_changed = clock_seconds(); - return true; - } - - LOG_DBG("cs: no changes\n"); - return false; -} -/*---------------------------------------------------------------------------*/ -void -tsch_cs_channel_stats_updated(uint8_t updated_channel, uint16_t old_busyness_metric) -{ - uint8_t index; - bool old_is_busy; - bool new_is_busy; - - /* Enable this only on the coordinator node */ - if(!tsch_is_coordinator) { - return; - } - - /* Do not try to adapt before enough information has been learned */ - if(clock_seconds() < TSCH_CS_LEARNING_PERIOD_SEC) { - return; - } - - index = tsch_stats_channel_to_index(updated_channel); - - old_is_busy = (old_busyness_metric < TSCH_CS_FREE_THRESHOLD); - new_is_busy = (tsch_stats.channel_free_ewma[index] < TSCH_CS_FREE_THRESHOLD); - - if(old_is_busy != new_is_busy) { - /* the status of the channel has changed*/ - recaculation_requested = true; - - } else if(new_is_busy) { - /* run the reselection algorithm iff the channel is both (1) bad and (2) in use */ - if(tsch_cs_bitmap_contains(tsch_cs_current_bitmap, updated_channel)) { - /* the channel is in use and is busy */ - recaculation_requested = true; - } - } -} diff --git a/os/services/tsch-cs/tsch-cs.h b/os/services/tsch-cs/tsch-cs.h deleted file mode 100644 index 900e77339..000000000 --- a/os/services/tsch-cs/tsch-cs.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2016-2018, University of Bristol - http://www.bristol.ac.uk - * - * 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 INSTITUTE 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 INSTITUTE 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 - * Header file for TSCH adaptive channel selection - * \author - * Atis Elsts - */ - -#ifndef __TSCH_CS_H__ -#define __TSCH_CS_H__ - -#include "contiki.h" -#include - -/* If `channel_free_ewma` value is less than this, the channel is considered busy */ -#ifdef TSCH_CS_CONF_FREE_THRESHOLD -#define TSCH_CS_FREE_THRESHOLD TSCH_CS_CONF_FREE_THRESHOLD -#else -/* < 85% free */ -#define TSCH_CS_FREE_THRESHOLD ((tsch_stat_t)(85ul * TSCH_STATS_BINARY_SCALING_FACTOR / 100)) -#endif - -#define TSCH_CS_LEARNING_PERIOD_SEC 30 - -/** - * \brief Initializes the TSCH hopping sequence selection module. - */ -void tsch_cs_adaptations_init(void); - -/** - * \brief Signal the need to potentially update the TSCH hopping sequence. - * \param updated_channel The channel with the updated RSSI measurement - * \param old_busyness_metric The EWMA value of the "channel busy" status before the last RSSI measurement - */ -void tsch_cs_channel_stats_updated(uint8_t updated_channel, uint16_t old_busyness_metric); - -/** - * \brief Potentially update the TSCH hopping sequence - * \return true if the hopping sequence was updated, false otherwise - */ -bool tsch_cs_process(void); - - -/* A bit corresponds to a channel; `uint16_t` value is OK for up to 16 channels. */ -typedef uint16_t tsch_cs_bitmap_t; - - -#endif /* __TSCH_CS_H__ */ diff --git a/os/services/unit-test/example-test.c b/os/services/unit-test/example-test.c deleted file mode 100644 index 04192642f..000000000 --- a/os/services/unit-test/example-test.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A test program for the unit test library. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "unit-test.h" - -/* Register two unit tests that will be executed by using - the UNIT_TEST_RUN macro. */ -UNIT_TEST_REGISTER(arithmetic, "Arith ops"); -UNIT_TEST_REGISTER(string, "String ops"); - -/* arithmetic: Demonstrates a test that succeeds. The exit point will be - the line where UNIT_TEST_END is called. */ -UNIT_TEST(arithmetic) -{ - int a, b; - - UNIT_TEST_BEGIN(); - - a = 1; - b = 2; - - UNIT_TEST_ASSERT(a + b == 3); - - UNIT_TEST_END(); -} - -/* string: Demonstrates a test that fails. The exit point will be - the line where the call to UNIT_TEST_ASSERT fails. */ -UNIT_TEST(string) -{ - char str1[] = "A"; - - UNIT_TEST_BEGIN(); - - UNIT_TEST_ASSERT(str1[0] == 'B'); - - UNIT_TEST_END(); -} - -PROCESS(test_process, "Unit testing"); - -PROCESS_THREAD(test_process, ev, data) -{ - PROCESS_BEGIN(); - - UNIT_TEST_RUN(arithmetic); - UNIT_TEST_RUN(string); - - PROCESS_END(); -} diff --git a/os/services/unit-test/unit-test.c b/os/services/unit-test/unit-test.c deleted file mode 100644 index 3dbee32fc..000000000 --- a/os/services/unit-test/unit-test.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A tool for unit testing Contiki software. - * \author - * Nicolas Tsiftes - */ - -#include - -#include "unit-test.h" - -/*---------------------------------------------------------------------------*/ -/** - * Print the results of a unit test. - * - * \param utp The unit test descriptor. - */ -void -unit_test_print_report(const unit_test_t *utp) -{ - printf("\nUnit test: %s\n", utp->descr); - printf("Result: %s\n", utp->result == unit_test_failure ? - "failure" : "success"); - printf("Exit point: %s:%u\n", utp->test_file, (unsigned)utp->exit_line); - printf("Start: %u\n", (unsigned)utp->start); - printf("End: %u\n", (unsigned)utp->end); - printf("Duration: %u\n", (unsigned)(utp->end - utp->start)); - printf("Ticks per second: %u\n", (unsigned)RTIMER_SECOND); -} -/*---------------------------------------------------------------------------*/ diff --git a/os/services/unit-test/unit-test.h b/os/services/unit-test/unit-test.h deleted file mode 100644 index 576f2469d..000000000 --- a/os/services/unit-test/unit-test.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A tool for unit testing Contiki software. - * \author - * Nicolas Tsiftes - */ - -#ifndef UNIT_TEST_H -#define UNIT_TEST_H - -#include "sys/rtimer.h" - -typedef enum unit_test_result { - unit_test_failure = 0, - unit_test_success = 1 -} unit_test_result_t; - -/** - * The unit_test structure describes the results of a unit test. Each - * registered unit test statically allocates an object of this type. - */ -typedef struct unit_test { - const char * const descr; - const char * const test_file; - unit_test_result_t result; - unsigned exit_line; - rtimer_clock_t start; - rtimer_clock_t end; -} unit_test_t; - -/** - * Register a unit test. - * - * This macro allocates unit test descriptor, which is a structure of - * type unit_test_t. The descriptor contains information about a unit - * test, and the results from the last execution of the test. - * - * \param name The name of the unit test. - * \param descr A string that briefly describes the unit test. - */ -#define UNIT_TEST_REGISTER(name, descr) static unit_test_t unit_test_##name = {descr, __FILE__, unit_test_success, 0, 0, 0} - -/** - * Define a unit test. - * - * This macro defines the function that will be executed when conducting - * a unit test. The name that is passed as a parameter must have been - * registered with the UNIT_TEST_REGISTER() macro. - * - * The function defined by this macro must start with a call to the - * UNIT_TEST_BEGIN() macro, and end with a call to the UNIT_TEST_END() - * macro. - * - * The standard test function template produced by this macro will - * ensure that the unit test keeps track of the result, the time taken to - * execute (in rtimer ticks), and the exit point of the test. The - * latter corresponds to the line number at which the test was - * determined to be a success or failure. - * - * \param name The name of the unit test. - */ -#define UNIT_TEST(name) static void unit_test_function_##name(unit_test_t *utp) - -/** - * Mark the starting point of the unit test function. - */ -#define UNIT_TEST_BEGIN() do { \ - utp->start = RTIMER_NOW(); \ - utp->result = unit_test_success; \ - } while(0) - -/** - * Mark the ending point of the unit test function. - */ -#define UNIT_TEST_END() UNIT_TEST_SUCCEED(); \ - unit_test_end: \ - utp->end = RTIMER_NOW() - -/* - * The test result is printed with a function that is selected by - * defining UNIT_TEST_PRINT_FUNCTION, which must be of the type - * "void (*)(const unit_test_t *)". The default selection is - * unit_test_print_report, which is available in unit-test.c. - */ -#ifndef UNIT_TEST_PRINT_FUNCTION -#define UNIT_TEST_PRINT_FUNCTION unit_test_print_report -#endif /* !UNIT_TEST_PRINT_FUNCTION */ - -/** - * Print a report of the execution of a unit test. - * - * \param name The name of the unit test. - */ -#define UNIT_TEST_PRINT_REPORT(name) UNIT_TEST_PRINT_FUNCTION(&unit_test_##name) - -/** - * Execute a unit test and print a report on the results. - * - * \param name The name of the unit test. - */ -#define UNIT_TEST_RUN(name) do { \ - unit_test_function_##name(&unit_test_##name); \ - UNIT_TEST_PRINT_REPORT(name); \ - } while(0) - -/** - * Report that a unit test succeeded. - * - * This macro is useful for writing tests that can succeed earlier than - * the last execution point of the test, which is specified by a call to - * the UNIT_TEST_END() macro. - * - * Tests can usually be written without calls to UNIT_TEST_SUCCEED(), - * since it is implicitly called at the end of the test---unless - * UNIT_TEST_FAIL() has been called. - * - */ -#define UNIT_TEST_SUCCEED() do { \ - utp->exit_line = __LINE__; \ - goto unit_test_end; \ - } while(0) - -/** - * Report that a unit test failed. - * - * This macro is used to signal that a unit test failed to execute. The - * line number at which this macro was called is stored in the unit test - * descriptor. - */ -#define UNIT_TEST_FAIL() do { \ - utp->exit_line = __LINE__; \ - utp->result = unit_test_failure; \ - goto unit_test_end; \ - } while(0) - -/** - * Report failure if an expression is false. - * - * \param expr The expression to evaluate. - */ -#define UNIT_TEST_ASSERT(expr) do { \ - if(!(expr)) { \ - UNIT_TEST_FAIL(); \ - } \ - } while(0) - -/** - * Obtain the result of a certain unit test. - * - * If the unit test has not yet been executed, this macro returns - * unit_test_failed. Otherwise it returns the result of the last - * execution of the unit test. - * - * \param name The name of the unit test. - */ -#define UNIT_TEST_RESULT(name) (unit_test_##name.result) - -/* The print function. */ -void UNIT_TEST_PRINT_FUNCTION(const unit_test_t *utp); - -#endif /* !UNIT_TEST_H */ diff --git a/os/storage/antelope/antelope.c b/os/storage/antelope/antelope.c deleted file mode 100644 index cf8e667d7..000000000 --- a/os/storage/antelope/antelope.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Main functions for Antelope, a DBMS for sensor devices. - * - * Antelope is described and evaluated in the paper A Database in - * Every Sensor, N. Tsiftes and A. Dunkels, in Proceedings of - * ACM SenSys 2011. - * \author - * Nicolas Tsiftes - */ - -#include - -#include "antelope.h" - -static db_output_function_t output = printf; - -void -db_init(void) -{ - relation_init(); - index_init(); -} - -void -db_set_output_function(db_output_function_t f) -{ - output = f; -} - -const char * -db_get_result_message(db_result_t code) -{ - switch(code) { - case DB_FINISHED: - return "Iteration finished"; - case DB_OK: - return "Operation succeeded"; - case DB_LIMIT_ERROR: - return "Limit reached"; - case DB_ALLOCATION_ERROR: - return "Allocation error"; - case DB_STORAGE_ERROR: - return "Storage error"; - case DB_PARSING_ERROR: - return "Parsing error"; - case DB_NAME_ERROR: - return "Invalid name"; - case DB_RELATIONAL_ERROR: - return "Semantic error"; - case DB_TYPE_ERROR: - return "Type error"; - case DB_IMPLEMENTATION_ERROR: - return "Implementation error"; - case DB_INDEX_ERROR: - return "Index error"; - case DB_BUSY_ERROR: - return "Busy with processing"; - case DB_INCONSISTENCY_ERROR: - return "Inconsistent handle"; - case DB_ARGUMENT_ERROR: - return "Invalid argument"; - default: - return "Unknown result code"; - }; -} - -db_result_t -db_print_header(db_handle_t *handle) -{ - int column; - attribute_t *attr; - - output("[relation = %s, attributes = (", handle->result_rel->name); - attr = list_head(handle->result_rel->attributes); - for(column = 0; column < handle->ncolumns; column++) { - if(attr == NULL) { - return DB_IMPLEMENTATION_ERROR; - } else if(attr->flags & ATTRIBUTE_FLAG_NO_STORE) { - continue; - } - output("%s%s", column > 0 ? ", " : "", attr->name); - attr = attr->next; - } - output(")]\n"); - return DB_OK; -} - -db_result_t -db_print_tuple(db_handle_t *handle) -{ - int column; - attribute_value_t value; - db_result_t result; - - output("Row %lu:\t", (unsigned long)handle->current_row); - - for(column = 0; column < handle->ncolumns; column++) { - result = db_get_value(&value, handle, column); - if(DB_ERROR(result)) { - output("Unable to get the value for row %lu, column %u: %s\n", - (unsigned long)handle->current_row, column, - db_get_result_message(result)); - return result; - } - - switch(value.domain) { - case DOMAIN_STRING: - output("\"%s\"\t", VALUE_STRING(&value)); - break; - case DOMAIN_INT: - output("%d\t", (int)VALUE_INT(&value)); - break; - case DOMAIN_LONG: - output("%ld\t", (long)VALUE_LONG(&value)); - break; - default: - output("\nUnrecognized domain: %d\n", value.domain); - return DB_IMPLEMENTATION_ERROR; - } - } - output("\n"); - - return DB_OK; -} - -int -db_processing(db_handle_t *handle) -{ - return handle->flags & DB_HANDLE_FLAG_PROCESSING; -} diff --git a/os/storage/antelope/antelope.h b/os/storage/antelope/antelope.h deleted file mode 100644 index 40f63303b..000000000 --- a/os/storage/antelope/antelope.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Declarations of the main Antelope functions. - * \author - * Nicolas Tsiftes - */ - -#ifndef DB_H -#define DB_H - -#include "db-types.h" -#include "result.h" -#include "aql.h" - -typedef int (*db_output_function_t)(const char *, ...); - -void db_init(void); -void db_set_output_function(db_output_function_t f); -const char *db_get_result_message(db_result_t code); -db_result_t db_print_header(db_handle_t *handle); -db_result_t db_print_tuple(db_handle_t *handle); -int db_processing(db_handle_t *handle); - -#endif /* DB_H */ diff --git a/os/storage/antelope/aql-adt.c b/os/storage/antelope/aql-adt.c deleted file mode 100644 index e07bffd7a..000000000 --- a/os/storage/antelope/aql-adt.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Utilities for building the internal representation of an AQL command. - * \author - * Nicolas Tsiftes - */ - -#include - -#include "aql.h" - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -static unsigned char char_buf[DB_MAX_CHAR_SIZE_PER_ROW]; -static uint8_t next_free_offset; - -static aql_attribute_t * -get_attribute(aql_adt_t *adt, char *name) -{ - int i; - - for(i = 0; i < AQL_ATTRIBUTE_COUNT(adt); i++) { - if(strcmp(adt->attributes[i].name, name) == 0) { - return &adt->attributes[i]; - } - } - return NULL; -} - -static unsigned char * -save_char(unsigned char *ptr, size_t length) -{ - unsigned char *start_ptr; - - if(length + next_free_offset > DB_MAX_CHAR_SIZE_PER_ROW) { - return NULL; - } - - start_ptr = char_buf + next_free_offset; - memcpy(start_ptr, ptr, length); - next_free_offset += length; - - return start_ptr; -} - -void -aql_clear(aql_adt_t *adt) -{ - char_buf[0] = 0; - next_free_offset = 0; - - adt->optype = AQL_TYPE_NONE; - adt->relation_count = 0; - adt->attribute_count = 0; - adt->value_count = 0; - adt->flags = 0; - memset(adt->aggregators, 0, sizeof(adt->aggregators)); -} - -db_result_t -aql_add_relation(aql_adt_t *adt, const char *name) -{ - if(adt->relation_count >= AQL_RELATION_LIMIT) { - return DB_LIMIT_ERROR; - } - - strncpy(adt->relations[adt->relation_count], name, - sizeof(adt->relations[0]) - 1); - adt->relations[adt->relation_count][sizeof(adt->relations[0]) - 1] = '\0'; - adt->relation_count++; - - return DB_OK; -} - -db_result_t -aql_add_attribute(aql_adt_t *adt, char *name, domain_t domain, - unsigned element_size, int processed_only) -{ - aql_attribute_t *attr; - - if(adt->attribute_count == AQL_ATTRIBUTE_LIMIT) { - return DB_LIMIT_ERROR; - } - - if(processed_only && get_attribute(adt, name)) { - /* No need to have multiple instances of attributes that are only - used for processing in the PLE. */ - return DB_OK; - } - - attr = &adt->attributes[adt->attribute_count++]; - - if(strlen(name) + 1 > sizeof(attr->name)) { - return DB_LIMIT_ERROR; - } - - strcpy(attr->name, name); - attr->domain = domain; - attr->element_size = element_size; - attr->flags = processed_only ? ATTRIBUTE_FLAG_NO_STORE : 0; - - return DB_OK; -} - -db_result_t -aql_add_value(aql_adt_t *adt, domain_t domain, void *value_ptr) -{ - attribute_value_t *value; - - if(adt->value_count == AQL_ATTRIBUTE_LIMIT) { - return DB_LIMIT_ERROR; - } - - value = &adt->values[adt->value_count++]; - value->domain = domain; - - switch(domain) { - case DOMAIN_INT: - VALUE_LONG(value) = *(long *)value_ptr; - break; - case DOMAIN_STRING: - VALUE_STRING(value) = save_char(value_ptr, strlen(value_ptr) + 1); - if(VALUE_STRING(value) != NULL) { - break; - } - default: - return DB_TYPE_ERROR; - } - - return DB_OK; -} diff --git a/os/storage/antelope/aql-exec.c b/os/storage/antelope/aql-exec.c deleted file mode 100644 index 084b9aad0..000000000 --- a/os/storage/antelope/aql-exec.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Query execution functions for AQL. - * \author - * Nicolas Tsiftes - */ - -#include -#include -#include - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -#include "index.h" -#include "relation.h" -#include "result.h" -#include "aql.h" - -static aql_adt_t adt; - -static void -clear_handle(db_handle_t *handle) -{ - memset(handle, 0, sizeof(*handle)); - - handle->result_rel = NULL; - handle->left_rel = NULL; - handle->right_rel = NULL; - handle->join_rel = NULL; -} - -static db_result_t -aql_execute(db_handle_t *handle, aql_adt_t *adt) -{ - uint8_t optype; - int first_rel_arg; - db_result_t result; - relation_t *rel; - aql_attribute_t *attr; - attribute_t *relattr; - - optype = AQL_GET_TYPE(adt); - if(optype == AQL_TYPE_NONE) { - /* No-ops always succeed. These can be generated by - empty lines or comments in the query language. */ - return DB_OK; - } - - /* If the ASSIGN flag is set, the first relation in the array is - the desired result relation. */ - first_rel_arg = !!(adt->flags & AQL_FLAG_ASSIGN); - - if(optype != AQL_TYPE_CREATE_RELATION && - optype != AQL_TYPE_REMOVE_RELATION && - optype != AQL_TYPE_JOIN) { - rel = relation_load(adt->relations[first_rel_arg]); - if(rel == NULL) { - return DB_NAME_ERROR; - } - } else { - rel = NULL; - } - - result = DB_RELATIONAL_ERROR; - switch(optype) { - case AQL_TYPE_CREATE_ATTRIBUTE: - attr = &adt->attributes[0]; - if(relation_attribute_add(rel, DB_STORAGE, attr->name, attr->domain, - attr->element_size) != NULL) { - result = DB_OK; - } - break; - case AQL_TYPE_CREATE_INDEX: - relattr = relation_attribute_get(rel, adt->attributes[0].name); - if(relattr == NULL) { - result = DB_NAME_ERROR; - break; - } - result = index_create(AQL_GET_INDEX_TYPE(adt), rel, relattr); - break; - case AQL_TYPE_CREATE_RELATION: - if(relation_create(adt->relations[0], DB_STORAGE) != NULL) { - result = DB_OK; - } - break; - case AQL_TYPE_REMOVE_ATTRIBUTE: - result = relation_attribute_remove(rel, adt->attributes[0].name); - break; - case AQL_TYPE_REMOVE_INDEX: - relattr = relation_attribute_get(rel, adt->attributes[0].name); - if(relattr != NULL) { - if(relattr->index != NULL) { - result = index_destroy(relattr->index); - } else { - result = DB_OK; - } - } else { - result = DB_NAME_ERROR; - } - break; - case AQL_TYPE_REMOVE_RELATION: - result = relation_remove(adt->relations[0], 1); - break; -#if DB_FEATURE_REMOVE - case AQL_TYPE_REMOVE_TUPLES: - /* Overwrite the attribute array with a full copy of the original - relation's attributes. */ - adt->attribute_count = 0; - for(relattr = list_head(rel->attributes); - relattr != NULL; - relattr = relattr->next) { - AQL_ADD_ATTRIBUTE(adt, relattr->name, DOMAIN_UNSPECIFIED, 0); - } - AQL_SET_FLAG(adt, AQL_FLAG_INVERSE_LOGIC); -#endif /* DB_FEATURE_REMOVE */ - case AQL_TYPE_SELECT: - if(handle == NULL) { - result = DB_ARGUMENT_ERROR; - break; - } - result = relation_select(handle, rel, adt); - break; - case AQL_TYPE_INSERT: - result = relation_insert(rel, adt->values); - break; -#if DB_FEATURE_JOIN - case AQL_TYPE_JOIN: - if(handle == NULL) { - result = DB_ARGUMENT_ERROR; - break; - } - handle->left_rel = relation_load(adt->relations[first_rel_arg]); - if(handle->left_rel == NULL) { - break; - } - handle->right_rel = relation_load(adt->relations[first_rel_arg + 1]); - if(handle->right_rel == NULL) { - relation_release(handle->left_rel); - break; - } - result = relation_join(handle, adt); - break; -#endif /* DB_FEATURE_JOIN */ - default: - break; - } - - if(rel != NULL) { - if(handle == NULL || !(handle->flags & DB_HANDLE_FLAG_PROCESSING)) { - relation_release(rel); - } - } - - return result; -} - -db_result_t -db_query(db_handle_t *handle, const char *format, ...) -{ - va_list ap; - char query_string[AQL_MAX_QUERY_LENGTH]; - - va_start(ap, format); - vsnprintf(query_string, sizeof(query_string), format, ap); - va_end(ap); - - if(handle != NULL) { - clear_handle(handle); - } - - if(AQL_ERROR(aql_parse(&adt, query_string))) { - return DB_PARSING_ERROR; - } - - /*aql_optimize(&adt);*/ - - return aql_execute(handle, &adt); -} - -db_result_t -db_process(db_handle_t *handle) -{ - uint8_t optype; - - optype = ((aql_adt_t *)handle->adt)->optype; - - switch(optype) { -#if DB_FEATURE_REMOVE - case AQL_TYPE_REMOVE_TUPLES: - return relation_process_remove(handle); - break; -#endif - case AQL_TYPE_SELECT: - return relation_process_select(handle); - break; -#if DB_FEATURE_JOIN - case AQL_TYPE_JOIN: - return relation_process_join(handle); -#endif /* DB_FEATURE_JOIN */ - default: - break; - } - - PRINTF("DB: Invalid operation type: %d\n", optype); - - return DB_INCONSISTENCY_ERROR; -} diff --git a/os/storage/antelope/aql-lexer.c b/os/storage/antelope/aql-lexer.c deleted file mode 100644 index 0510385b5..000000000 --- a/os/storage/antelope/aql-lexer.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Lexical analyzer for AQL, the Antelope Query Language. - * \author - * Nicolas Tsiftes - */ - -#include "aql.h" - -#include -#include -#include -#include -#include -#include -#include - -struct keyword { - char *string; - token_t token; -}; - -/* The keywords are arranged primarily by length and - secondarily by expected lookup frequency. */ -static const struct keyword keywords[] = { - {";", END}, - {"(", LEFT_PAREN}, - {")", RIGHT_PAREN}, - {",", COMMA}, - {"=", EQUAL}, - {">", GT}, - {"<", LT}, - {".", DOT}, - {"+", ADD}, - {"-", SUB}, - {"*", MUL}, - {"/", DIV}, - {"#", COMMENT}, - - {">=", GEQ}, - {"<=", LEQ}, - {"<>", NOT_EQUAL}, - {"<-", ASSIGN}, - {"OR", OR}, - {"IS", IS}, - {"ON", ON}, - {"IN", IN}, - - {"AND", AND}, - {"NOT", NOT}, - {"SUM", SUM}, - {"MAX", MAX}, - {"MIN", MIN}, - {"INT", INT}, - - {"INTO", INTO}, - {"FROM", FROM}, - {"MEAN", MEAN}, - {"JOIN", JOIN}, - {"LONG", LONG}, - {"TYPE", TYPE}, - - {"WHERE", WHERE}, - {"COUNT", COUNT}, - {"INDEX", INDEX}, - - {"INSERT", INSERT}, - {"SELECT", SELECT}, - {"REMOVE", REMOVE}, - {"CREATE", CREATE}, - {"MEDIAN", MEDIAN}, - {"DOMAIN", DOMAIN}, - {"STRING", STRING}, - {"INLINE", INLINE}, - - {"PROJECT", PROJECT}, - {"MAXHEAP", MAXHEAP}, - {"MEMHASH", MEMHASH}, - - {"RELATION", RELATION}, - - {"ATTRIBUTE", ATTRIBUTE} -}; - -/* Provides a pointer to the first keyword of a specific length. */ -static const int8_t skip_hint[] = {0, 13, 21, 27, 33, 36, 44, 47, 48}; - -static char separators[] = "#.;,() \t\n"; - -int -lexer_start(lexer_t *lexer, char *input, token_t *token, value_t *value) -{ - lexer->input = input; - lexer->prev_pos = input; - lexer->token = token; - lexer->value = value; - - return 0; -} - -static token_t -get_token_id(const char *string, const size_t length) -{ - int start, end; - int i; - - if(sizeof(skip_hint) < length || length < 1) { - return NONE; - } - - - start = skip_hint[length - 1]; - if(sizeof(skip_hint) == length) { - end = sizeof(keywords) / sizeof(keywords[0]); - } else { - end = skip_hint[length]; - } - - for(i = start; i < end; i++) { - if(strncasecmp(keywords[i].string, string, length) == 0) { - return keywords[i].token; - } - } - - return NONE; -} - -static int -next_real(lexer_t *lexer, const char *s) -{ - char *end; - long long_value; -#if DB_FEATURE_FLOATS - float float_value; -#endif /* DB_FEATURE_FLOATS */ - - errno = 0; - long_value = strtol(s, &end, 10); - -#if DB_FEATURE_FLOATS - if(*end == '.') { - /* Process a float value. */ - float_value = strtof(s, &end); - if(float_value == 0 && s == end) { - return -1; - } - memcpy(lexer->value, &float_value, sizeof(float_value)); - *lexer->token = FLOAT_VALUE; - lexer->input = end; - - return 1; - } -#endif /* DB_FEATURE_FLOATS */ - - /* Process an integer value. */ - if(long_value == 0 && errno != 0) { - return -1; - } - memcpy(lexer->value, &long_value, sizeof(long_value)); - *lexer->token = INTEGER_VALUE; - lexer->input = end; - - return 1; -} - -static int -next_string(lexer_t *lexer, const char *s) -{ - char *end; - size_t length; - - end = strchr(s, '\''); - if(end == NULL) { - return -1; - } - - length = end - s; - *lexer->token = STRING_VALUE; - lexer->input = end + 1; /* Skip the closing delimiter. */ - - if(length > DB_MAX_ELEMENT_SIZE - 1) { - length = DB_MAX_ELEMENT_SIZE - 1; - } - - memcpy(lexer->value, s, length); - (*lexer->value)[length] = '\0'; - - return 1; -} - -static int -next_token(lexer_t *lexer, const char *s) -{ - size_t length; - - length = strcspn(s, separators); - if(length == 0) { - /* We encountered a separator, so we try to get a token of - precisely 1 byte. */ - length = 1; - } - - *lexer->token = get_token_id(s, length); - lexer->input = s + length; - if(*lexer->token != NONE) { - return 1; - } - - /* The input did not constitute a valid token, - so we regard it as an identifier. */ - - *lexer->token = IDENTIFIER; - - if(length > DB_MAX_ELEMENT_SIZE - 1) { - length = DB_MAX_ELEMENT_SIZE - 1; - } - - memcpy(lexer->value, s, length); - (*lexer->value)[length] = '\0'; - - return 1; -} - -int -lexer_next(lexer_t *lexer) -{ - const char *s; - - *lexer->token = NONE; - s = lexer->input; - s += strspn(s, " \t\n"); - lexer->prev_pos = s; - - switch(*s) { - case '\'': - /* Process the string that follows the delimiter. */ - return next_string(lexer, s + 1); - case '\0': - return 0; - default: - if(isdigit((int)*s) || (*s == '-' && isdigit((int)s[1]))) { - return next_real(lexer, s); - } - - /* Process a token. */ - return next_token(lexer, s); - } -} - -void -lexer_rewind(lexer_t *lexer) -{ - lexer->input = lexer->prev_pos; -} diff --git a/os/storage/antelope/aql-parser.c b/os/storage/antelope/aql-parser.c deleted file mode 100644 index f65a8a6ce..000000000 --- a/os/storage/antelope/aql-parser.c +++ /dev/null @@ -1,866 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A recursive parser for AQL, the Antelope Query Language. - * \author - * Nicolas Tsiftes - */ - -#include "attribute.h" -#include "db-options.h" -#include "index.h" -#include "aql.h" -#include "lvm.h" - -#include -#include -#include -#include -#include - -#define DEBUG DEBUG_NONE -#include "debug.h" - -#if DEBUG -static char error_message[DB_ERROR_BUF_SIZE]; -static int error_line; -static const char *error_function; -#define RETURN(value) \ - do { \ - if(error_message[0] == '\0') { \ - strncpy(error_message, lexer->input, sizeof(error_message) - 1); \ - error_line = __LINE__; \ - error_function = __func__; \ - } \ - } while(0); \ - return (value) -#define RESET_ERROR() \ - do { \ - error_message[0] = '\0'; \ - error_line = 0; \ - error_function = NULL; \ - } while(0) -#else -#define RETURN(value) return (value) -#define RESET_ERROR() -#endif -#define PARSER(name) \ - static aql_status_t \ - parse_##name(lexer_t *lexer) -#define PARSER_ARG(name, arg) \ - static aql_status_t \ - parse_##name(lexer_t *lexer, arg) -#define PARSER_TOKEN(name) \ - static token_t \ - parse_##name(lexer_t *lexer) -#define PARSE(name) \ - !AQL_ERROR(parse_##name(lexer)) -#define PARSE_TOKEN(name) \ - parse_##name(lexer) - -#define NEXT lexer_next(lexer) -#define REWIND lexer_rewind(lexer); RESET_ERROR() -#define TOKEN *lexer->token -#define VALUE *lexer->value - -#define CONSUME(token) \ - do { \ - NEXT; \ - if(TOKEN != (token)) { \ - RETURN(SYNTAX_ERROR); \ - } \ - } while(0) - -/* The parsing of AQL results in this aql_adt_t object. */ -static aql_adt_t *adt; - -/* Conditional statements are compiled into VM bytecode, which is stored in - an instance of the LogicVM. */ -static lvm_instance_t p; -static unsigned char vmcode[DB_VM_BYTECODE_SIZE]; - -/* Parsing functions for AQL. */ -PARSER_TOKEN(cmp) -{ - NEXT; - switch(TOKEN) { - case EQUAL: - case NOT_EQUAL: - case GT: - case LT: - case GEQ: - case LEQ: - return TOKEN; - default: - return NONE; - } -} - -PARSER_TOKEN(op) -{ - NEXT; - switch(TOKEN) { - case ADD: - case SUB: - case MUL: - case DIV: - case RIGHT_PAREN: - return TOKEN; - default: - return NONE; - } -} - -PARSER_TOKEN(aggregator) -{ - NEXT; - switch(TOKEN) { - case COUNT: - case SUM: - case MEAN: - case MEDIAN: - case MAX: - case MIN: - return TOKEN; - default: - return NONE; - } -} - -PARSER(attributes) -{ - token_t token; - aql_aggregator_t function; - - token = PARSE_TOKEN(aggregator); - if(token != NONE) { - switch(TOKEN) { - case COUNT: - function = AQL_COUNT; - break; - case SUM: - function = AQL_SUM; - break; - case MEAN: - function = AQL_MEAN; - break; - case MEDIAN: - function = AQL_MEDIAN; - break; - case MAX: - function = AQL_MAX; - break; - case MIN: - function = AQL_MIN; - break; - default: - RETURN(SYNTAX_ERROR); - } - - AQL_SET_FLAG(adt, AQL_FLAG_AGGREGATE); - - PRINTF("aggregator: %d\n", TOKEN); - - /* Parse the attribute to aggregate. */ - CONSUME(LEFT_PAREN); - CONSUME(IDENTIFIER); - - AQL_ADD_AGGREGATE(adt, function, VALUE); - PRINTF("aggregated attribute: %s\n", VALUE); - - CONSUME(RIGHT_PAREN); - goto check_more_attributes; - } else { - REWIND; - } - - /* Plain identifier. */ - - CONSUME(IDENTIFIER); - - AQL_ADD_ATTRIBUTE(adt, VALUE, DOMAIN_UNSPECIFIED, 0); - -check_more_attributes: - NEXT; - if(TOKEN == COMMA) { - if(!PARSE(attributes)) { - RETURN(SYNTAX_ERROR); - } - } else { - REWIND; - } - - RETURN(OK); -} - -PARSER(relations) -{ - /* Parse comma-separated identifiers for relations. */ - CONSUME(IDENTIFIER); - - AQL_ADD_RELATION(adt, VALUE); - NEXT; - if(TOKEN == COMMA) { - if(!PARSE(relations)) { - RETURN(SYNTAX_ERROR); - } - } else { - REWIND; - } - - RETURN(OK); -} - -PARSER(values) -{ - /* Parse comma-separated attribute values. */ - NEXT; - switch(TOKEN) { - case STRING_VALUE: - AQL_ADD_VALUE(adt, DOMAIN_STRING, VALUE); - break; - case INTEGER_VALUE: - AQL_ADD_VALUE(adt, DOMAIN_INT, VALUE); - break; - default: - RETURN(SYNTAX_ERROR); - } - - NEXT; - if(TOKEN == COMMA) { - return PARSE(values); - } else { - REWIND; - } - - RETURN(OK); -} - -PARSER(operand) -{ - NEXT; - switch(TOKEN) { - case IDENTIFIER: - if(LVM_ERROR(lvm_register_variable(VALUE, LVM_LONG)) || - LVM_ERROR(lvm_set_variable(&p, VALUE))) { - RETURN(SYNTAX_ERROR); - } - AQL_ADD_PROCESSING_ATTRIBUTE(adt, VALUE); - break; - case STRING_VALUE: - break; - case FLOAT_VALUE: - break; - case INTEGER_VALUE: - if(LVM_ERROR(lvm_set_long(&p, *(long *)lexer->value))) { - RETURN(SYNTAX_ERROR); - } - break; - default: - RETURN(SYNTAX_ERROR); - } - - RETURN(OK); -} - -PARSER(expr) -{ - token_t token; - size_t saved_end; - operator_t op; - - saved_end = lvm_get_end(&p); - - NEXT; - if(TOKEN == LEFT_PAREN) { - if(!PARSE(expr)) { - RETURN(SYNTAX_ERROR); - } - CONSUME(RIGHT_PAREN); - } else { - REWIND; - if(!PARSE(operand)) { - RETURN(SYNTAX_ERROR); - } - } - - while(1) { - token = PARSE_TOKEN(op); - if(token == NONE) { - saved_end = lvm_get_end(&p); - REWIND; - break; - } else if (token == RIGHT_PAREN) { - break; - } - - if(!PARSE(operand) && !PARSE(expr)) { - RETURN(SYNTAX_ERROR); - } - - saved_end = lvm_shift_for_operator(&p, saved_end); - - switch(token) { - case ADD: - op = LVM_ADD; - break; - case SUB: - op = LVM_SUB; - break; - case MUL: - op = LVM_MUL; - break; - case DIV: - op = LVM_DIV; - break; - default: - RETURN(SYNTAX_ERROR); - } - if(LVM_ERROR(lvm_set_op(&p, op))) { - RETURN(SYNTAX_ERROR); - } - lvm_set_end(&p, saved_end); - } - - return OK; -} - -PARSER(comparison) -{ - token_t token; - size_t saved_end; - operator_t rel; - - saved_end = lvm_jump_to_operand(&p); - - if(!PARSE(expr)) { - RETURN(SYNTAX_ERROR); - } - - saved_end = lvm_set_end(&p, saved_end); - - token = PARSE_TOKEN(cmp); - if(token == NONE) { - RETURN(SYNTAX_ERROR); - } - - switch(token) { - case GT: - rel = LVM_GE; - break; - case GEQ: - rel = LVM_GEQ; - break; - case LT: - rel = LVM_LE; - break; - case LEQ: - rel = LVM_LEQ; - break; - case EQUAL: - rel = LVM_EQ; - break; - case NOT_EQUAL: - rel = LVM_NEQ; - break; - default: - RETURN(SYNTAX_ERROR); - } - - if(LVM_ERROR(lvm_set_relation(&p, rel))) { - RETURN(SYNTAX_ERROR); - } - lvm_set_end(&p, saved_end); - - if(!PARSE(expr)) { - RETURN(SYNTAX_ERROR); - } - - RETURN(OK); -} - -PARSER(where) -{ - int r; - operator_t connective; - size_t saved_end; - - if(!PARSE(comparison)) { - RETURN(SYNTAX_ERROR); - } - - saved_end = 0; - - /* The WHERE clause can consist of multiple prepositions. */ - for(;;) { - NEXT; - if(TOKEN != AND && TOKEN != OR) { - REWIND; - break; - } - - connective = TOKEN == AND ? LVM_AND : LVM_OR; - - saved_end = lvm_shift_for_operator(&p, saved_end); - if(LVM_ERROR(lvm_set_relation(&p, connective))) { - RETURN(SYNTAX_ERROR); - } - lvm_set_end(&p, saved_end); - - NEXT; - if(TOKEN == LEFT_PAREN) { - r = PARSE(where); - if(!r) { - RETURN(SYNTAX_ERROR); - } - CONSUME(RIGHT_PAREN); - } else { - REWIND; - r = PARSE(comparison); - if(!r) { - RETURN(r); - } - } - } - - lvm_print_code(&p); - - return OK; -} - -PARSER(join) -{ - AQL_SET_TYPE(adt, AQL_TYPE_JOIN); - - CONSUME(IDENTIFIER); - - PRINTF("Left relation: %s\n", VALUE); - AQL_ADD_RELATION(adt, VALUE); - - CONSUME(COMMA); - CONSUME(IDENTIFIER); - - PRINTF("Right relation: %s\n", VALUE); - AQL_ADD_RELATION(adt, VALUE); - - CONSUME(ON); - CONSUME(IDENTIFIER); - - PRINTF("Join on attribute %s\n", VALUE); - AQL_ADD_ATTRIBUTE(adt, VALUE, DOMAIN_UNSPECIFIED, 0); - - CONSUME(PROJECT); - - /* projection attributes... */ - if(!PARSE(attributes)) { - RETURN(SYNTAX_ERROR); - } - - CONSUME(END); - - RETURN(OK); -} - -PARSER(select) -{ - AQL_SET_TYPE(adt, AQL_TYPE_SELECT); - - /* projection attributes... */ - if(!PARSE(attributes)) { - RETURN(SYNTAX_ERROR); - } - - CONSUME(FROM); - if(!PARSE(relations)) { - RETURN(SYNTAX_ERROR); - } - - NEXT; - if(TOKEN == WHERE) { - lvm_reset(&p, vmcode, sizeof(vmcode)); - - if(!PARSE(where)) { - RETURN(SYNTAX_ERROR); - } - - AQL_SET_CONDITION(adt, &p); - } else { - REWIND; - RETURN(OK); - } - - CONSUME(END); - - return OK; -} - -PARSER(insert) -{ - AQL_SET_TYPE(adt, AQL_TYPE_INSERT); - - CONSUME(LEFT_PAREN); - - if(!PARSE(values)) { - RETURN(SYNTAX_ERROR); - } - - CONSUME(RIGHT_PAREN); - CONSUME(INTO); - - if(!PARSE(relations)) { - RETURN(SYNTAX_ERROR); - } - - RETURN(OK); -} - -PARSER(remove_attribute) -{ - AQL_SET_TYPE(adt, AQL_TYPE_REMOVE_ATTRIBUTE); - - CONSUME(IDENTIFIER); - AQL_ADD_RELATION(adt, VALUE); - - CONSUME(DOT); - CONSUME(IDENTIFIER); - - PRINTF("Removing the index for the attribute %s\n", VALUE); - AQL_ADD_ATTRIBUTE(adt, VALUE, DOMAIN_UNSPECIFIED, 0); - - RETURN(OK); -} - -#if DB_FEATURE_REMOVE -PARSER(remove_from) -{ - AQL_SET_TYPE(adt, AQL_TYPE_REMOVE_TUPLES); - - /* Use a temporary persistent relation to assign the query result to. */ - AQL_SET_FLAG(adt, AQL_FLAG_ASSIGN); - AQL_ADD_RELATION(adt, REMOVE_RELATION); - - CONSUME(IDENTIFIER); - AQL_ADD_RELATION(adt, VALUE); - - CONSUME(WHERE); - - lvm_reset(&p, vmcode, sizeof(vmcode)); - AQL_SET_CONDITION(adt, &p); - - return PARSE(where); - -} -#endif /* DB_FEATURE_REMOVE */ - -PARSER(remove_index) -{ - AQL_SET_TYPE(adt, AQL_TYPE_REMOVE_INDEX); - - CONSUME(IDENTIFIER); - AQL_ADD_RELATION(adt, VALUE); - - CONSUME(DOT); - CONSUME(IDENTIFIER); - - PRINTF("remove index: %s\n", VALUE); - AQL_ADD_ATTRIBUTE(adt, VALUE, DOMAIN_UNSPECIFIED, 0); - - RETURN(OK); -} - -PARSER(remove_relation) -{ - AQL_SET_TYPE(adt, AQL_TYPE_REMOVE_RELATION); - - CONSUME(IDENTIFIER); - PRINTF("remove relation: %s\n", VALUE); - AQL_ADD_RELATION(adt, VALUE); - - RETURN(OK); -} - -PARSER(remove) -{ - aql_status_t r; - - NEXT; - switch(TOKEN) { - case ATTRIBUTE: - r = PARSE(remove_attribute); - break; -#if DB_FEATURE_REMOVE - case FROM: - r = PARSE(remove_from); - break; -#endif - case INDEX: - r = PARSE(remove_index); - break; - case RELATION: - r = PARSE(remove_relation); - break; - default: - RETURN(SYNTAX_ERROR); - } - - if(!r) { - RETURN(SYNTAX_ERROR); - } - - CONSUME(END); - - RETURN(OK); -} - -PARSER_TOKEN(index_type) -{ - index_type_t type; - - NEXT; - switch(TOKEN) { - case INLINE: - type = INDEX_INLINE; - break; - case MAXHEAP: - type = INDEX_MAXHEAP; - break; - case MEMHASH: - type = INDEX_MEMHASH; - break; - default: - return NONE; - }; - - AQL_SET_INDEX_TYPE(adt, type); - return TOKEN; -} - -PARSER(create_index) -{ - AQL_SET_TYPE(adt, AQL_TYPE_CREATE_INDEX); - - CONSUME(IDENTIFIER); - AQL_ADD_RELATION(adt, VALUE); - - CONSUME(DOT); - CONSUME(IDENTIFIER); - - PRINTF("Creating an index for the attribute %s\n", VALUE); - AQL_ADD_ATTRIBUTE(adt, VALUE, DOMAIN_UNSPECIFIED, 0); - - CONSUME(TYPE); - - if(PARSE_TOKEN(index_type) == NONE) { - RETURN(SYNTAX_ERROR); - } - - RETURN(OK); -} - -PARSER(create_relation) -{ - CONSUME(IDENTIFIER); - - AQL_SET_TYPE(adt, AQL_TYPE_CREATE_RELATION); - AQL_ADD_RELATION(adt, VALUE); - - RETURN(OK); -} - -PARSER_ARG(domain, char *name) -{ - domain_t domain; - unsigned element_size; - - NEXT; - switch(TOKEN) { - case STRING: - domain = DOMAIN_STRING; - - /* Parse the amount of characters for this domain. */ - CONSUME(LEFT_PAREN); - CONSUME(INTEGER_VALUE); - element_size = *(long *)lexer->value; - CONSUME(RIGHT_PAREN); - - break; - case LONG: - domain = DOMAIN_LONG; - element_size = 4; - break; - case INT: - domain = DOMAIN_INT; - element_size = 2; - break; - default: - return NONE; - } - - AQL_ADD_ATTRIBUTE(adt, name, domain, element_size); - - return OK; -} - -PARSER(create_attributes) -{ - aql_status_t r; - char name[ATTRIBUTE_NAME_LENGTH]; - - AQL_SET_TYPE(adt, AQL_TYPE_CREATE_ATTRIBUTE); - - CONSUME(IDENTIFIER); - - strncpy(name, VALUE, sizeof(name) - 1); - name[sizeof(name) - 1] = '\0'; - - CONSUME(DOMAIN); - - r = parse_domain(lexer, name); - if(AQL_ERROR(r)) { - RETURN(r); - } - - CONSUME(IN); - CONSUME(IDENTIFIER); - - AQL_ADD_RELATION(adt, VALUE); - - RETURN(OK); -} - -PARSER(create) -{ - aql_status_t r; - - NEXT; - switch(TOKEN) { - case ATTRIBUTE: - r = PARSE(create_attributes); - break; - case INDEX: - r = PARSE(create_index); - break; - case RELATION: - r = PARSE(create_relation); - break; - default: - RETURN(SYNTAX_ERROR); - } - - if(!r) { - RETURN(SYNTAX_ERROR); - } - - CONSUME(END); - - RETURN(OK); -} - -aql_status_t -aql_parse(aql_adt_t *external_adt, char *input_string) -{ - lexer_t lex; - token_t token = NONE; - value_t value; - aql_status_t result; - - RESET_ERROR(); - - PRINTF("Parsing \"%s\"\n", input_string); - - adt = external_adt; - AQL_CLEAR(adt); - AQL_SET_CONDITION(adt, NULL); - - lexer_start(&lex, input_string, &token, &value); - - result = lexer_next(&lex); - if(!AQL_ERROR(result)) { - switch(token) { - case IDENTIFIER: - PRINTF("Assign the result to relation %s\n", *lex.value); - AQL_ADD_RELATION(adt, *lex.value); - AQL_SET_FLAG(adt, AQL_FLAG_ASSIGN); - if(AQL_ERROR(lexer_next(&lex))) { - result = SYNTAX_ERROR; - break; - } - if(*lex.token != ASSIGN) { - result = SYNTAX_ERROR; - break; - } - if(AQL_ERROR(lexer_next(&lex))) { - result = SYNTAX_ERROR; - break; - } - switch(*lex.token) { - case SELECT: - result = parse_select(&lex); - break; - case JOIN: - result = parse_join(&lex); - break; - default: - result = SYNTAX_ERROR; - } - break; - case JOIN: - result = parse_join(&lex); - break; - case CREATE: - result = parse_create(&lex); - break; - case REMOVE: - result = parse_remove(&lex); - break; - case INSERT: - result = parse_insert(&lex); - break; - case SELECT: - result = parse_select(&lex); - break; - case NONE: - case COMMENT: - result = OK; - case END: - break; - default: - result = SYNTAX_ERROR; - } - } - - if(AQL_ERROR(result)) { - PRINTF("Error in function %s, line %d: input \"%s\"\n", - error_function, error_line, error_message); - } - - return result; -} diff --git a/os/storage/antelope/aql.h b/os/storage/antelope/aql.h deleted file mode 100644 index 4b898c4ac..000000000 --- a/os/storage/antelope/aql.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Definitions and declarations for AQL, the Antelope Query Language. - * \author - * Nicolas Tsiftes - */ - -#ifndef AQL_H -#define AQL_H - -#include "db-options.h" -#include "index.h" -#include "relation.h" -#include "result.h" - -enum aql_status { - OK = 2, - SYNTAX_ERROR = 3, - INVALID_TOKEN = 9, - PLE_ERROR = 12 -}; -typedef enum aql_status aql_status_t; -#define AQL_ERROR(x) ((x) >= 3) - -enum token { - END = 0, - LEFT_PAREN = 1, - RIGHT_PAREN = 2, - COMMA = 3, - EQUAL = 4, - GT = 5, - LT = 6, - DOT = 7, - ADD = 8, - SUB = 9, - MUL = 10, - DIV = 11, - COMMENT = 12, - GEQ = 13, - LEQ = 14, - NOT_EQUAL = 15, - ASSIGN = 16, - OR = 17, - IS = 18, - ON = 19, - IN = 20, - AND = 21, - NOT = 22, - SUM = 23, - MAX = 24, - MIN = 25, - INT = 26, - INTO = 27, - FROM = 28, - MEAN = 29, - JOIN = 30, - LONG = 31, - TYPE = 32, - WHERE = 33, - COUNT = 34, - INDEX = 35, - INSERT = 36, - SELECT = 37, - REMOVE = 38, - CREATE = 39, - MEDIAN = 40, - DOMAIN = 41, - STRING = 42, - INLINE = 43, - PROJECT = 44, - MAXHEAP = 45, - MEMHASH = 46, - RELATION = 47, - ATTRIBUTE = 48, - - INTEGER_VALUE = 251, - FLOAT_VALUE = 252, - STRING_VALUE = 253, - IDENTIFIER = 254, - NONE = 255 -}; - -typedef enum token token_t; - -typedef char value_t[DB_MAX_ELEMENT_SIZE]; - -struct lexer { - const char *input; - const char *prev_pos; - token_t *token; - value_t *value; -}; - -typedef struct lexer lexer_t; - -enum aql_aggregator { - AQL_NONE = 0, - AQL_COUNT = 1, - AQL_SUM = 2, - AQL_MIN = 3, - AQL_MAX = 4, - AQL_MEAN = 5, - AQL_MEDIAN = 6 -}; - -typedef enum aql_aggregator aql_aggregator_t; - -struct aql_attribute { - domain_t domain; - uint8_t element_size; - uint8_t flags; - char name[ATTRIBUTE_NAME_LENGTH + 1]; -}; -typedef struct aql_attribute aql_attribute_t; - -struct aql_adt { - char relations[AQL_RELATION_LIMIT][RELATION_NAME_LENGTH + 1]; - aql_attribute_t attributes[AQL_ATTRIBUTE_LIMIT]; - aql_aggregator_t aggregators[AQL_ATTRIBUTE_LIMIT]; - attribute_value_t values[AQL_ATTRIBUTE_LIMIT]; - index_type_t index_type; - uint8_t relation_count; - uint8_t attribute_count; - uint8_t value_count; - uint8_t optype; - uint8_t flags; - void *lvm_instance; -}; -typedef struct aql_adt aql_adt_t; - -#define AQL_TYPE_NONE 0 -#define AQL_TYPE_SELECT 1 -#define AQL_TYPE_INSERT 2 -#define AQL_TYPE_UPDATE 3 -#define AQL_TYPE_DROP 4 -#define AQL_TYPE_DELETE 5 -#define AQL_TYPE_RENAME 6 -#define AQL_TYPE_CREATE_ATTRIBUTE 7 -#define AQL_TYPE_CREATE_INDEX 8 -#define AQL_TYPE_CREATE_RELATION 9 -#define AQL_TYPE_REMOVE_ATTRIBUTE 10 -#define AQL_TYPE_REMOVE_INDEX 11 -#define AQL_TYPE_REMOVE_RELATION 12 -#define AQL_TYPE_REMOVE_TUPLES 13 -#define AQL_TYPE_JOIN 14 - -#define AQL_FLAG_AGGREGATE 1 -#define AQL_FLAG_ASSIGN 2 -#define AQL_FLAG_INVERSE_LOGIC 4 - -#define AQL_CLEAR(adt) aql_clear(adt) -#define AQL_SET_TYPE(adt, type) (((adt))->optype = (type)) -#define AQL_GET_TYPE(adt) ((adt)->optype) -#define AQL_SET_INDEX_TYPE(adt, type) ((adt)->index_type = (type)) -#define AQL_GET_INDEX_TYPE(adt) ((adt)->index_type) - -#define AQL_SET_FLAG(adt, flag) (((adt)->flags) |= (flag)) -#define AQL_GET_FLAGS(adt) ((adt)->flags) -#define AQL_RELATION_COUNT(adt) ((adt)->relation_count) -#define AQL_ADD_RELATION(adt, name) \ - aql_add_relation(adt, name) -#define AQL_ADD_ATTRIBUTE(adt, attr, dom, size) \ - aql_add_attribute(adt, attr, dom, size, 0) -#define AQL_ADD_PROCESSING_ATTRIBUTE(adt, attr) \ - aql_add_attribute((adt), (attr), DOMAIN_UNSPECIFIED, 0, 1) -#define AQL_ADD_AGGREGATE(adt, function, attr) \ - do { \ - (adt)->aggregators[(adt)->attribute_count] = (function); \ - aql_add_attribute((adt), (attr), DOMAIN_UNSPECIFIED, 0, 0); \ - } while(0) -#define AQL_ATTRIBUTE_COUNT(adt) ((adt)->attribute_count) -#define AQL_SET_CONDITION(adt, cond) ((adt)->lvm_instance = (cond)) -#define AQL_ADD_VALUE(adt, domain, value) \ - aql_add_value((adt), (domain), (value)) - -int lexer_start(lexer_t *, char *, token_t *, value_t *); -int lexer_next(lexer_t *); -void lexer_rewind(lexer_t *); - -void aql_clear(aql_adt_t *adt); -aql_status_t aql_parse(aql_adt_t *adt, char *query_string); -db_result_t aql_add_relation(aql_adt_t *adt, const char *name); -db_result_t aql_add_attribute(aql_adt_t *adt, char *name, - domain_t domain, unsigned element_size, - int processed_only); -db_result_t aql_add_value(aql_adt_t *adt, domain_t domain, void *value); -db_result_t db_query(db_handle_t *handle, const char *format, ...); -db_result_t db_process(db_handle_t *handle); - -#endif /* !AQL_H */ diff --git a/os/storage/antelope/attribute.h b/os/storage/antelope/attribute.h deleted file mode 100644 index 03278919e..000000000 --- a/os/storage/antelope/attribute.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Definitions for attributes. - * \author - * Nicolas Tsiftes - */ - -#ifndef ATTRIBUTE_H -#define ATTRIBUTE_H - -#include -#include - -#include "lib/list.h" - -#include "db-options.h" - -typedef enum { - DOMAIN_UNSPECIFIED = 0, - DOMAIN_INT = 1, - DOMAIN_LONG = 2, - DOMAIN_STRING = 3, - DOMAIN_FLOAT = 4 -} domain_t; - -#define ATTRIBUTE_FLAG_NO_STORE 0x1 -#define ATTRIBUTE_FLAG_INVALID 0x2 -#define ATTRIBUTE_FLAG_PRIMARY_KEY 0x4 -#define ATTRIBUTE_FLAG_UNIQUE 0x8 - -struct attribute { - struct attribute *next; - void *index; - long aggregation_value; - uint8_t aggregator; - uint8_t domain; - uint8_t element_size; - uint8_t flags; - char name[ATTRIBUTE_NAME_LENGTH + 1]; -}; - -typedef struct attribute attribute_t; -typedef uint8_t attribute_id_t; - -struct attribute_value { - union { - int int_value; - long long_value; - unsigned char *string_value; - } u; - domain_t domain; -}; - -typedef struct attribute_value attribute_value_t; - -#define VALUE_LONG(value) (value)->u.long_value -#define VALUE_INT(value) (value)->u.int_value -#define VALUE_STRING(value) (value)->u.string_value - -#endif /* ATTRIBUTES_H */ diff --git a/os/storage/antelope/db-options.h b/os/storage/antelope/db-options.h deleted file mode 100644 index ca8587071..000000000 --- a/os/storage/antelope/db-options.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Database configuration options. - * \author - * Nicolas Tsiftes - */ - -#ifndef DB_OPTIONS_H -#define DB_OPTIONS_H - -#include "contiki.h" -#include "cfs-coffee-arch.h" - -/*----------------------------------------------------------------------------*/ - -/* Optional Antelope features. Include only what is needed - in order to save space. */ - -/* Support join operations on relations. */ -#ifndef DB_FEATURE_JOIN -#define DB_FEATURE_JOIN 1 -#endif /* DB_FEATURE_JOIN */ - -/* Support tuple removals. */ -#ifndef DB_FEATURE_REMOVE -#define DB_FEATURE_REMOVE 1 -#endif /* DB_FEATURE_REMOVE */ - -/* Support floating-point values in attributes. */ -#ifndef DB_FEATURE_FLOATS -#define DB_FEATURE_FLOATS 0 -#endif /* DB_FEATURE_FLOATS */ - -/* Optimize storage access for the Coffee file system. */ -#ifndef DB_FEATURE_COFFEE -#define DB_FEATURE_COFFEE 1 -#endif /* DB_FEATURE_COFFEE */ - -/* Enable basic data integrity checks. */ -#ifndef DB_FEATURE_INTEGRITY -#define DB_FEATURE_INTEGRITY 0 -#endif /* DB_FEATURE_INTEGRITY */ - -/*----------------------------------------------------------------------------*/ - -/* Configuration parameters that may be trimmed to save space. */ - -/* The size of the error message buffer used by the parser. */ -#ifndef DB_ERROR_BUF_SIZE -#define DB_ERROR_BUF_SIZE 50 -#endif /* DB_ERROR_BUF_SIZE */ - -/* The maximum number of indexes in use by all relations loaded in memory. */ -#ifndef DB_INDEX_POOL_SIZE -#define DB_INDEX_POOL_SIZE 3 -#endif /* DB_INDEX_POOL_SIZE */ - -/* The maximum number of relations loaded in memory. */ -#ifndef DB_RELATION_POOL_SIZE -#define DB_RELATION_POOL_SIZE 5 -#endif /* DB_RELATION_POOL_SIZE */ - -/* The maximum number of attributes loaded in memory. */ -#ifndef DB_ATTRIBUTE_POOL_SIZE -#define DB_ATTRIBUTE_POOL_SIZE 16 -#endif /* DB_ATTRIBUTE_POOL_SIZE */ - -/* The maximum number of attributes in a relation. */ -#ifndef DB_MAX_ATTRIBUTES_PER_RELATION -#define DB_MAX_ATTRIBUTES_PER_RELATION 6 -#endif /* DB_MAX_ATTRIBUTES_PER_RELATION */ - -/* The maximum physical storage size on an attribute value. */ -#ifndef DB_MAX_ELEMENT_SIZE -#define DB_MAX_ELEMENT_SIZE 16 -#endif /* DB_MAX_ELEMENT_SIZE */ - - -/* The maximum size of the LVM bytecode compiled from a - single database query. */ -#ifndef DB_VM_BYTECODE_SIZE -#define DB_VM_BYTECODE_SIZE 256 -#endif /* DB_VM_BYTECODE_SIZE */ - -/*----------------------------------------------------------------------------*/ - -/* Language options. */ - -/* The maximum length of a database query in AQL text format. */ -#ifndef AQL_MAX_QUERY_LENGTH -#define AQL_MAX_QUERY_LENGTH 128 -#endif /* AQL_MAX_QUERY_LENGTH */ - -#ifndef AQL_MAX_VALUE_LENGTH -#define AQL_MAX_VALUE_LENGTH DB_MAX_ELEMENT_SIZE -#endif /* AQL_MAX_VALUE_LENGTH */ - -/* The maximum number of relations used in a single query. */ -#ifndef AQL_RELATION_LIMIT -#define AQL_RELATION_LIMIT 3 -#endif /* AQL_RELATION_LIMIT */ - -/* The maximum number of attributes used in a single query. */ -#ifndef AQL_ATTRIBUTE_LIMIT -#define AQL_ATTRIBUTE_LIMIT 5 -#endif /* AQL_ATTRIBUTE_LIMIT */ - -/*----------------------------------------------------------------------------*/ - -/* - * Physical storage options. Changing these options might cause - * compatibility problems if the database files are moved between - * different installations of Antelope. - */ - -/* The default relation file size to reserve when using Coffee. */ -#ifndef DB_COFFEE_RESERVE_SIZE -#define DB_COFFEE_RESERVE_SIZE (COFFEE_SIZE / 8) -#endif /* DB_COFFEE_RESERVE_SIZE */ - -/* - * Ensure that the default size of Coffee file reservations is suitable - * for the file system size. - */ -#if DB_COFFEE_RESERVE_SIZE > (COFFEE_SIZE / 2) -#error DB_COFFEE_RESERVE_SIZE is too large for the file system. -#endif - -/* The maximum size of the physical storage of a tuple (labelled a "row" - in Antelope's terminology. */ -#ifndef DB_MAX_CHAR_SIZE_PER_ROW -#define DB_MAX_CHAR_SIZE_PER_ROW 64 -#endif /* DB_MAX_CHAR_SIZE_PER_ROW */ - -/* The maximum file name length to use for creating various database file. */ -#ifndef DB_MAX_FILENAME_LENGTH -#define DB_MAX_FILENAME_LENGTH 16 -#endif /* DB_MAX_FILENAME_LENGTH */ - -/* The maximum length of an attribute name. */ -#ifndef ATTRIBUTE_NAME_LENGTH -#define ATTRIBUTE_NAME_LENGTH 12 -#endif /* ATTRIBUTE_NAME_LENGTH */ - -/* The maximum length on a relation name. */ -#ifndef RELATION_NAME_LENGTH -#define RELATION_NAME_LENGTH 10 -#endif /* RELATION_NAME_LENGTH */ - -/* The name of the intermediate "result" relation file, which is used - for presenting the result of a query to a user. */ -#ifndef RESULT_RELATION -#define RESULT_RELATION "db-result" -#endif /* RESULT_RELATION */ - -/* The name of the relation used for processing a REMOVE query. */ -#ifndef REMOVE_RELATION -#define REMOVE_RELATION "db-remove" -#endif /* REMOVE_RELATION */ - -/*----------------------------------------------------------------------------*/ - -/* Index options. */ - -#ifndef DB_INDEX_COST -#define DB_INDEX_COST 64 -#endif /* DB_INDEX_COST */ - -/* The maximum number of hash table indexes. */ -#ifndef DB_MEMHASH_INDEX_LIMIT -#define DB_MEMHASH_INDEX_LIMIT 1 -#endif /* DB_MEMHASH_INDEX_LIMIT */ - -/* The default hash table index size. */ -#ifndef DB_MEMHASH_TABLE_SIZE -#define DB_MEMHASH_TABLE_SIZE 61 -#endif /* DB_MEMHASH_TABLE_SIZE */ - -/* The maximum number of Maxheap indexes. */ -#ifndef DB_HEAP_INDEX_LIMIT -#define DB_HEAP_INDEX_LIMIT 1 -#endif /* DB_HEAP_INDEX_LIMIT */ - -/* The maximum number of buckets cached in the MaxHeap index. */ -#ifndef DB_HEAP_CACHE_LIMIT -#define DB_HEAP_CACHE_LIMIT 1 -#endif /* DB_HEAP_CACHE_LIMIT */ - -/*----------------------------------------------------------------------------*/ - -/* LVM options. */ - -/* The maximum length of a variable in LVM. This value should preferably - be identical to the maximum attribute name length. */ -#ifndef LVM_MAX_NAME_LENGTH -#define LVM_MAX_NAME_LENGTH ATTRIBUTE_NAME_LENGTH -#endif /* LVM_MAX_NAME_LENGTH */ - -/* The maximum variable identifier number in the LVM. The default - value corresponds to the highest attribute ID. */ -#ifndef LVM_MAX_VARIABLE_ID -#define LVM_MAX_VARIABLE_ID AQL_ATTRIBUTE_LIMIT - 1 -#endif /* LVM_MAX_VARIABLE_ID */ - -/* Specify whether floats should be used or not inside the LVM. */ -#ifndef LVM_USE_FLOATS -#define LVM_USE_FLOATS DB_FEATURE_FLOATS -#endif /* LVM_USE_FLOATS */ - - -#endif /* !DB_OPTIONS_H */ diff --git a/os/storage/antelope/db-types.h b/os/storage/antelope/db-types.h deleted file mode 100644 index bf2ad97ce..000000000 --- a/os/storage/antelope/db-types.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * . - * \author - * Nicolas Tsiftes - */ - -#ifndef DB_TYPES_H -#define DB_TYPES_H - -enum db_result { - DB_FINISHED = 3, - DB_GOT_ROW = 2, - DB_OK = 1, - DB_LIMIT_ERROR = -1, - DB_ALLOCATION_ERROR = -2, - DB_STORAGE_ERROR = -3, - DB_PARSING_ERROR = -4, - DB_NAME_ERROR = -5, - DB_RELATIONAL_ERROR = -6, - DB_TYPE_ERROR = -7, - DB_IMPLEMENTATION_ERROR = -8, - DB_INDEX_ERROR = -9, - DB_BUSY_ERROR = -10, - DB_INCONSISTENCY_ERROR = -11, - DB_ARGUMENT_ERROR = -12 -}; - -typedef enum db_result db_result_t; -typedef int db_storage_id_t; - -#define DB_ERROR(result_code) ((result_code) < DB_OK) -#define DB_SUCCESS(result_code) !DB_ERROR(result_code) - -#endif /* !DB_TYPES_H */ diff --git a/os/storage/antelope/debug.h b/os/storage/antelope/debug.h deleted file mode 100644 index e9d9ecf71..000000000 --- a/os/storage/antelope/debug.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * A set of debugging macros. - * - * \author Nicolas Tsiftes - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef UIP_DEBUG_H -#define UIP_DEBUG_H - -#define DEBUG_NONE 0 -#define DEBUG_PRINT 1 -#define DEBUG_ANNOTATE 2 -#define DEBUG_FULL DEBUG_ANNOTATE | DEBUG_PRINT - -#if (DEBUG) & DEBUG_ANNOTATE -#include -#define ANNOTATE(...) printf(__VA_ARGS__) -#else -#define ANNOTATE(...) -#endif /* (DEBUG) & DEBUG_ANNOTATE */ - -#if (DEBUG) & DEBUG_PRINT -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif /* (DEBUG) & DEBUG_PRINT */ - -#endif diff --git a/os/storage/antelope/index-inline.c b/os/storage/antelope/index-inline.c deleted file mode 100644 index da97e50b4..000000000 --- a/os/storage/antelope/index-inline.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A binary search index for attributes that are constrained to be - * monotonically increasing, which is a rather common pattern for - * time series or keys. Since this index has no storage overhead, - * it does not wear out the flash memory nor does it occupy any - * space. Furthermore, unlike B+-trees, it has a O(1) memory - * footprint in relation to the number of data items. - * \author - * Nicolas Tsiftes - */ - -#include -#include - -#include "index.h" -#include "relation.h" -#include "result.h" -#include "storage.h" - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -struct search_handle { - index_t *index; - tuple_id_t start_row; - tuple_id_t end_row; -}; - -struct search_handle handle; - -static db_result_t null_op(index_t *); -static db_result_t insert(index_t *, attribute_value_t *, tuple_id_t); -static db_result_t delete(index_t *, attribute_value_t *); -static tuple_id_t get_next(index_iterator_t *); - -/* - * The create, destroy, load, release, insert, and delete operations - * of the index API always succeed because the index does not store - * items separately from the row file. The four former operations share - * the same signature, and are thus implemented by the null_op function - * to save space. - */ -index_api_t index_inline = { - INDEX_INLINE, - INDEX_API_EXTERNAL | INDEX_API_COMPLETE | INDEX_API_RANGE_QUERIES, - null_op, - null_op, - null_op, - null_op, - insert, - delete, - get_next -}; - -static attribute_value_t * -get_value(tuple_id_t *index, relation_t *rel, attribute_t *attr) -{ - unsigned char row[rel->row_length]; - static attribute_value_t value; - - if(DB_ERROR(storage_get_row(rel, index, row))) { - return NULL; - } - - if(DB_ERROR(relation_get_value(rel, attr, row, &value))) { - PRINTF("DB: Unable to retrieve a value from tuple %ld\n", (long)(*index)); - return NULL; - } - - return &value; -} - -static tuple_id_t -binary_search(index_iterator_t *index_iterator, - attribute_value_t *target_value, - int exact_match) -{ - relation_t *rel; - attribute_t *attr; - attribute_value_t *cmp_value; - tuple_id_t min; - tuple_id_t max; - tuple_id_t center; - - rel = index_iterator->index->rel; - attr = index_iterator->index->attr; - - max = relation_cardinality(rel); - if(max == INVALID_TUPLE) { - return INVALID_TUPLE; - } - max--; - min = 0; - - do { - center = min + ((max - min) / 2); - - cmp_value = get_value(¢er, rel, attr); - if(cmp_value == NULL) { - PRINTF("DB: Failed to get the center value, index = %ld\n", - (long)center); - return INVALID_TUPLE; - } - - if(db_value_to_long(target_value) > db_value_to_long(cmp_value)) { - min = center + 1; - } else { - max = center - 1; - } - } while(min <= max && - db_value_to_long(target_value) != db_value_to_long(cmp_value)); - - if(exact_match && - db_value_to_long(target_value) != db_value_to_long(cmp_value)) { - PRINTF("DB: Could not find value %ld in the inline index\n", - db_value_to_long(target_value)); - return INVALID_TUPLE; - } - - return center; -} - -static tuple_id_t -range_search(index_iterator_t *index_iterator, - tuple_id_t *start, tuple_id_t *end) -{ - attribute_value_t *low_target; - attribute_value_t *high_target; - int exact_match; - - low_target = &index_iterator->min_value; - high_target = &index_iterator->max_value; - - PRINTF("DB: Search index for value range (%ld, %ld)\n", - db_value_to_long(low_target), db_value_to_long(high_target)); - - exact_match = db_value_to_long(low_target) == db_value_to_long(high_target); - - /* Optimize later so that the other search uses the result - from the first one. */ - *start = binary_search(index_iterator, low_target, exact_match); - if(*start == INVALID_TUPLE) { - return DB_INDEX_ERROR; - } - - *end = binary_search(index_iterator, high_target, exact_match); - if(*end == INVALID_TUPLE) { - return DB_INDEX_ERROR; - } - return DB_OK; -} - -static db_result_t -null_op(index_t *index) -{ - return DB_OK; -} - -static db_result_t -insert(index_t *index, attribute_value_t *value, tuple_id_t tuple_id) -{ - return DB_OK; -} - -static db_result_t -delete(index_t *index, attribute_value_t *value) -{ - return DB_OK; -} - -static tuple_id_t -get_next(index_iterator_t *iterator) -{ - static tuple_id_t cached_start; - static tuple_id_t cached_end; - - if(iterator->next_item_no == 0) { - /* - * We conduct the actual index search when the caller attempts to - * access the first item in the iteration. The first and last tuple - * id:s of the result get cached for subsequent iterations. - */ - if(DB_ERROR(range_search(iterator, &cached_start, &cached_end))) { - cached_start = 0; - cached_end = 0; - return INVALID_TUPLE; - } - PRINTF("DB: Cached the tuple range (%ld,%ld)\n", - (long)cached_start, (long)cached_end); - ++iterator->next_item_no; - return cached_start; - } else if(cached_start + iterator->next_item_no <= cached_end) { - return cached_start + iterator->next_item_no++; - } - - return INVALID_TUPLE; -} diff --git a/os/storage/antelope/index-maxheap.c b/os/storage/antelope/index-maxheap.c deleted file mode 100644 index 7c479f936..000000000 --- a/os/storage/antelope/index-maxheap.c +++ /dev/null @@ -1,750 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * MaxHeap - A binary maximum heap index for flash memory. - * - * The idea behind the MaxHeap index is to write entries sequentially - * into small buckets, which are indexed in a binary maximum heap. - * Although sequential writes make the entries unsorted within a - * bucket, the time to load and scan a single bucket is small. The - * sequential write is important for flash memories, which are - * unable to handle multiple rewrites of the same page without doing - * an expensive erase operation between the rewrites. - * - * Each bucket specifies a range (a,b) of values that it accepts. - * Once a bucket fills up, two buckets are created with the ranges - * (a,mean) and (mean+1, b), respectively. The entries from the - * original bucket are then copied into the appropriate new bucket - * before the old bucket gets deleted. - * \author - * Nicolas Tsiftes - */ - -#include -#include -#include -#include - -#include "cfs/cfs.h" -#include "cfs/cfs-coffee.h" -#include "lib/memb.h" -#include "lib/random.h" - -#include "db-options.h" -#include "index.h" -#include "result.h" -#include "storage.h" - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -#define BRANCH_FACTOR 2 -#define BUCKET_SIZE 128 -#define NODE_LIMIT 511 -#define NODE_DEPTH 9 - -#if (1 << NODE_DEPTH) != (NODE_LIMIT + 1) -#error "NODE_DEPTH is set incorrectly." -#endif - -#define EMPTY_NODE(node) ((node)->min == 0 && (node)->max == 0) -#define EMPTY_PAIR(pair) ((pair)->key == 0 && (pair)->value == 0) - -typedef uint16_t maxheap_key_t; -typedef uint16_t maxheap_value_t; - -#define KEY_MIN 0 -#define KEY_MAX 65535 - -struct heap_node { - maxheap_key_t min; - maxheap_key_t max; -}; -typedef struct heap_node heap_node_t; - -struct key_value_pair { - maxheap_key_t key; - maxheap_value_t value; -}; - -struct bucket { - struct key_value_pair pairs[BUCKET_SIZE]; -}; -typedef struct bucket bucket_t; - -struct heap { - db_storage_id_t heap_storage; - db_storage_id_t bucket_storage; - /* Remember where the next free slot for each bucket is located. */ - uint8_t next_free_slot[NODE_LIMIT]; -}; -typedef struct heap heap_t; - -struct bucket_cache { - heap_t *heap; - uint16_t bucket_id; - bucket_t bucket; -}; - -/* Keep a cache of buckets read from storage. */ -static struct bucket_cache bucket_cache[DB_HEAP_CACHE_LIMIT]; -MEMB(heaps, heap_t, DB_HEAP_INDEX_LIMIT); - -static struct bucket_cache *get_cache(heap_t *, int); -static struct bucket_cache *get_cache_free(void); -static void invalidate_cache(void); -static maxheap_key_t transform_key(maxheap_key_t); -static int heap_read(heap_t *, int, heap_node_t *); -static int heap_write(heap_t *, int, heap_node_t *); -static int heap_insert(heap_t *, maxheap_key_t, maxheap_key_t); -static int heap_find(heap_t *, maxheap_key_t key, int *iterator); -#if HEAP_DEBUG -static void heap_print(heap_t *); -#endif -static int bucket_read(heap_t *, int, bucket_t *); -static struct bucket_cache *bucket_load(heap_t *, int); -static int bucket_append(heap_t *, int, struct key_value_pair *); -static int bucket_split(heap_t *, int); - -static db_result_t create(index_t *); -static db_result_t destroy(index_t *); -static db_result_t load(index_t *); -static db_result_t release(index_t *); -static db_result_t insert(index_t *, attribute_value_t *, tuple_id_t); -static db_result_t delete(index_t *, attribute_value_t *); -static tuple_id_t get_next(index_iterator_t *); - -index_api_t index_maxheap = { - INDEX_MAXHEAP, - INDEX_API_EXTERNAL, - create, - destroy, - load, - release, - insert, - delete, - get_next -}; - -static struct bucket_cache * -get_cache(heap_t *heap, int bucket_id) -{ - int i; - - for(i = 0; i < DB_HEAP_CACHE_LIMIT; i++) { - if(bucket_cache[i].heap == heap && bucket_cache[i].bucket_id == bucket_id) { - return &bucket_cache[i]; - } - } - return NULL; -} - -static struct bucket_cache * -get_cache_free(void) -{ - int i; - - for(i = 0; i < DB_HEAP_CACHE_LIMIT; i++) { - if(bucket_cache[i].heap == NULL) { - return &bucket_cache[i]; - } - } - return NULL; -} - -static void -invalidate_cache(void) -{ - int i; - - for(i = 0; i < DB_HEAP_CACHE_LIMIT; i++) { - if(bucket_cache[i].heap != NULL) { - bucket_cache[i].heap = NULL; - break; - } - } -} - -static maxheap_key_t -transform_key(maxheap_key_t key) -{ - random_init(key); - return random_rand(); -} - -static int -heap_read(heap_t *heap, int bucket_id, heap_node_t *node) -{ - if(DB_ERROR(storage_read(heap->heap_storage, node, - DB_MAX_FILENAME_LENGTH + (unsigned long)bucket_id * sizeof(*node), sizeof(*node)))) { - return 0; - } - - return 1; -} - -static int -heap_write(heap_t *heap, int bucket_id, heap_node_t *node) -{ - if(DB_ERROR(storage_write(heap->heap_storage, node, - DB_MAX_FILENAME_LENGTH + (unsigned long)bucket_id * sizeof(*node), sizeof(*node)))) { - return 0; - } - - return 1; -} - -static int -heap_insert(heap_t *heap, maxheap_key_t min, maxheap_key_t max) -{ - int i; - heap_node_t node; - - PRINTF("DB: Insert node (%ld,%ld) into the heap\n", (long)min, (long)max); - - if(min > max) { - return -1; - } - - for(i = 0; i < NODE_LIMIT;) { - if(heap_read(heap, i, &node) == 0) { - PRINTF("DB: Failed to read heap node %d\n", i); - return -1; - } - - if(EMPTY_NODE(&node)) { - node.min = min; - node.max = max; - if(heap_write(heap, i, &node) == 0) { - PRINTF("DB: Failed to write heap node %d\n", i); - return -1; - } - return i; - } else if(node.min <= min && max <= node.max) { - i = BRANCH_FACTOR * i + 1; - } else { - i++; - } - } - - PRINTF("DB: No more nodes available\n"); - return -1; -} - -static int -heap_find(heap_t *heap, maxheap_key_t key, int *iterator) -{ - maxheap_key_t hashed_key; - int i; - int first_child; - static heap_node_t node; - - hashed_key = transform_key(key); - - for(i = *iterator; i < NODE_LIMIT;) { - if(heap_read(heap, i, &node) == 0) { - break; - } - if(EMPTY_NODE(&node)) { - break; - } else if(node.min <= hashed_key && hashed_key <= node.max) { - first_child = BRANCH_FACTOR * i + 1; - - if(first_child >= NODE_LIMIT) { - break; - } - *iterator = first_child; - return i; - } else { - i++; - } - } - - return -1; -} - -#if HEAP_DEBUG -static void -heap_print(heap_t *heap) -{ - int level_count; - int branch_count; - int branch_amount; - int i, j; - heap_node_t node; - - level_count = 0; - branch_count = 0; - branch_amount = BRANCH_FACTOR; - - for(i = 0;; i++) { - if(heap_read(heap, i, &node) == 0 || EMPTY_NODE(&node)) { - break; - } - - for(j = 0; j < level_count; j++) { - PRINTF("\t"); - } - PRINTF("(%ld,%ld)\n", (long)node.min, (long)node.max); - if(level_count == 0) { - level_count++; - } else if(branch_count + 1 == branch_amount) { - level_count++; - branch_count = 0; - branch_amount = branch_amount * BRANCH_FACTOR; - } else { - branch_count++; - } - } -} -#endif /* HEAP_DEBUG */ - -static int -bucket_read(heap_t *heap, int bucket_id, bucket_t *bucket) -{ - size_t size; - - if(heap->next_free_slot[bucket_id] == 0) { - size = BUCKET_SIZE; - } else { - size = heap->next_free_slot[bucket_id]; - } - - size *= sizeof(struct key_value_pair); - - if(DB_ERROR(storage_read(heap->bucket_storage, bucket, - (unsigned long)bucket_id * sizeof(*bucket), size))) { - return 0; - } - - return 1; -} - -static struct bucket_cache * -bucket_load(heap_t *heap, int bucket_id) -{ - int i; - struct bucket_cache *cache; - - cache = get_cache(heap, bucket_id); - if(cache != NULL) { - return cache; - } - - cache = get_cache_free(); - if(cache == NULL) { - invalidate_cache(); - cache = get_cache_free(); - if(cache == NULL) { - return NULL; - } - } - - if(bucket_read(heap, bucket_id, &cache->bucket) == 0) { - return NULL; - } - - cache->heap = heap; - cache->bucket_id = bucket_id; - - if(heap->next_free_slot[bucket_id] == 0) { - for(i = 0; i < BUCKET_SIZE; i++) { - if(EMPTY_PAIR(&cache->bucket.pairs[i])) { - break; - } - } - - heap->next_free_slot[bucket_id] = i; - } - - PRINTF("DB: Loaded bucket %d, the next free slot is %u\n", bucket_id, - (unsigned)heap->next_free_slot[bucket_id]); - - return cache; -} - -static int -bucket_append(heap_t *heap, int bucket_id, struct key_value_pair *pair) -{ - unsigned long offset; - - if(heap->next_free_slot[bucket_id] >= BUCKET_SIZE) { - PRINTF("DB: Invalid write attempt to the full bucket %d\n", bucket_id); - return 0; - } - - offset = (unsigned long)bucket_id * sizeof(bucket_t); - offset += heap->next_free_slot[bucket_id] * sizeof(struct key_value_pair); - - if(DB_ERROR(storage_write(heap->bucket_storage, pair, offset, sizeof(*pair)))) { - return 0; - } - - heap->next_free_slot[bucket_id]++; - - return 1; -} - -static int -bucket_split(heap_t *heap, int bucket_id) -{ - heap_node_t node; - maxheap_key_t mean; - int small_bucket_index; - int large_bucket_index; - - if(heap_read(heap, bucket_id, &node) == 0) { - return 0; - } - - mean = node.min + ((node.max - node.min) / 2); - - PRINTF("DB: Split bucket %d (%ld, %ld) at mean value %ld\n", bucket_id, - (long)node.min, (long)node.max, (long)mean); - - small_bucket_index = heap_insert(heap, node.min, mean); - if(small_bucket_index < 0) { - return 0; - } - - large_bucket_index = heap_insert(heap, mean + 1, node.max); - if(large_bucket_index < 0) { - /*heap_remove(small_bucket);*/ - return 0; - } - - return 1; -} - -int -insert_item(heap_t *heap, maxheap_key_t key, maxheap_value_t value) -{ - int heap_iterator; - int bucket_id, last_good_bucket_id; - struct key_value_pair pair; - - for(heap_iterator = 0, last_good_bucket_id = -1;;) { - bucket_id = heap_find(heap, key, &heap_iterator); - if(bucket_id < 0) { - break; - } - last_good_bucket_id = bucket_id; - } - bucket_id = last_good_bucket_id; - - if(bucket_id < 0) { - PRINTF("DB: No bucket for key %ld\n", (long)key); - return 0; - } - - pair.key = key; - pair.value = value; - - if(heap->next_free_slot[bucket_id] == BUCKET_SIZE) { - PRINTF("DB: Bucket %d is full\n", bucket_id); - if(bucket_split(heap, bucket_id) == 0) { - return 0; - } - - /* Select one of the newly created buckets. */ - bucket_id = heap_find(heap, key, &heap_iterator); - if(bucket_id < 0) { - return 0; - } - } - - if(bucket_append(heap, bucket_id, &pair) == 0) { - return 0; - } - - PRINTF("DB: Inserted key %ld (hash %ld) into the heap at bucket_id %d\n", - (long)key, (long)transform_key(key), bucket_id); - - return 1; -} - -static db_result_t -create(index_t *index) -{ - char heap_filename[DB_MAX_FILENAME_LENGTH]; - char bucket_filename[DB_MAX_FILENAME_LENGTH]; - char *filename; - db_result_t result; - heap_t *heap; - - heap = NULL; - filename = NULL; - bucket_filename[0] = '\0'; - - /* Generate the heap file, which is the main index file that is - referenced from the metadata of the relation. */ - filename = storage_generate_file("heap", - (unsigned long)NODE_LIMIT * sizeof(heap_node_t)); - if(filename == NULL) { - PRINTF("DB: Failed to generate a heap file\n"); - return DB_INDEX_ERROR; - } - - memcpy(index->descriptor_file, filename, - sizeof(index->descriptor_file)); - - PRINTF("DB: Generated the heap file \"%s\" using %lu bytes of space\n", - index->descriptor_file, (unsigned long)NODE_LIMIT * sizeof(heap_node_t)); - - index->opaque_data = heap = memb_alloc(&heaps); - if(heap == NULL) { - PRINTF("DB: Failed to allocate a heap\n"); - result = DB_ALLOCATION_ERROR; - goto end; - } - heap->heap_storage = -1; - heap->bucket_storage = -1; - - /* Generate the bucket file, which stores the (key, value) pairs. */ - filename = storage_generate_file("bucket", - (unsigned long)NODE_LIMIT * sizeof(bucket_t)); - if(filename == NULL) { - PRINTF("DB: Failed to generate a bucket file\n"); - result = DB_INDEX_ERROR; - goto end; - } - memcpy(bucket_filename, filename, sizeof(bucket_filename)); - - PRINTF("DB: Generated the bucket file \"%s\" using %lu bytes of space\n", - bucket_filename, (unsigned long)NODE_LIMIT * sizeof(bucket_t)); - - /* Initialize the heap. */ - memset(&heap->next_free_slot, 0, sizeof(heap->next_free_slot)); - - heap->heap_storage = storage_open(index->descriptor_file); - heap->bucket_storage = storage_open(bucket_filename); - if(heap->heap_storage < 0 || heap->bucket_storage < 0) { - result = DB_STORAGE_ERROR; - goto end; - } - - if(DB_ERROR(storage_write(heap->heap_storage, &bucket_filename, 0, - sizeof(bucket_filename)))) { - result = DB_STORAGE_ERROR; - goto end; - } - - if(heap_insert(heap, KEY_MIN, KEY_MAX) < 0) { - PRINTF("DB: Heap insertion error\n"); - result = DB_INDEX_ERROR; - goto end; - } - - PRINTF("DB: Created a heap index\n"); - result = DB_OK; - - end: - if(result != DB_OK) { - if(heap != NULL) { - storage_close(heap->bucket_storage); - storage_close(heap->heap_storage); - memb_free(&heaps, heap); - } - if(index->descriptor_file[0] != '\0') { - cfs_remove(heap_filename); - index->descriptor_file[0] = '\0'; - } - if(bucket_filename[0] != '\0') { - cfs_remove(bucket_filename); - } - } - return result; -} - -static db_result_t -destroy(index_t *index) -{ - release(index); - return DB_INDEX_ERROR; -} - -static db_result_t -load(index_t *index) -{ - heap_t *heap; - db_storage_id_t fd; - char bucket_file[DB_MAX_FILENAME_LENGTH]; - - index->opaque_data = heap = memb_alloc(&heaps); - if(heap == NULL) { - PRINTF("DB: Failed to allocate a heap\n"); - return DB_ALLOCATION_ERROR; - } - - fd = storage_open(index->descriptor_file); - if(fd < 0) { - return DB_STORAGE_ERROR; - } - - if(storage_read(fd, bucket_file, 0, sizeof(bucket_file)) != - sizeof(bucket_file)) { - storage_close(fd); - return DB_STORAGE_ERROR; - } - - storage_close(fd); - - heap->heap_storage = storage_open(index->descriptor_file); - heap->bucket_storage = storage_open(bucket_file); - - memset(&heap->next_free_slot, 0, sizeof(heap->next_free_slot)); - - PRINTF("DB: Loaded max-heap index from file %s and bucket file %s\n", - index->descriptor_file, bucket_file); - - return DB_OK; -} - -static db_result_t -release(index_t *index) -{ - heap_t *heap; - - heap = index->opaque_data; - - storage_close(heap->bucket_storage); - storage_close(heap->heap_storage); - memb_free(&heaps, index->opaque_data); - return DB_INDEX_ERROR; -} - -static db_result_t -insert(index_t *index, attribute_value_t *key, tuple_id_t value) -{ - heap_t *heap; - long long_key; - - heap = (heap_t *)index->opaque_data; - - long_key = db_value_to_long(key); - - if(insert_item(heap, (maxheap_key_t)long_key, - (maxheap_value_t)value) == 0) { - PRINTF("DB: Failed to insert key %ld into a max-heap index\n", long_key); - return DB_INDEX_ERROR; - } - return DB_OK; -} - -static db_result_t -delete(index_t *index, attribute_value_t *value) -{ - return DB_INDEX_ERROR; -} - -static tuple_id_t -get_next(index_iterator_t *iterator) -{ - struct iteration_cache { - index_iterator_t *index_iterator; - int heap_iterator; - tuple_id_t found_items; - uint8_t start; - int visited_buckets[NODE_DEPTH]; - int end; - }; - static struct iteration_cache cache; - heap_t *heap; - maxheap_key_t key; - int bucket_id; - int tmp_heap_iterator; - int i; - struct bucket_cache *bcache; - uint8_t next_free_slot; - - heap = (heap_t *)iterator->index->opaque_data; - key = *(maxheap_key_t *)&iterator->min_value; - - if(cache.index_iterator != iterator || iterator->next_item_no == 0) { - /* Initialize the cache for a new search. */ - cache.end = NODE_DEPTH - 1; - cache.found_items = cache.start = 0; - cache.index_iterator = iterator; - - /* Find the downward path through the heap consisting of all nodes - that could possibly contain the key. */ - for(i = tmp_heap_iterator = 0; i < NODE_DEPTH; i++) { - cache.visited_buckets[i] = heap_find(heap, key, &tmp_heap_iterator); - if(cache.visited_buckets[i] < 0) { - cache.end = i - 1; - break; - } - } - cache.heap_iterator = cache.end; - } - - /* - * Search for the key in each heap node, starting from the bottom - * of the heap. Because the bottom nodes contain are very narrow - * range of keys, there is a much higher chance that the key will be - * there rather than at the top. - */ - for(; cache.heap_iterator >= 0; cache.heap_iterator--) { - bucket_id = cache.visited_buckets[cache.heap_iterator]; - - PRINTF("DB: Find key %lu in bucket %d\n", (unsigned long)key, bucket_id); - - if((bcache = bucket_load(heap, bucket_id)) == NULL) { - PRINTF("DB: Failed to load bucket %d\n", bucket_id); - return INVALID_TUPLE; - } - - /* Because keys are stored in an unsorted order in the bucket, we - * need to search the bucket sequentially. */ - next_free_slot = heap->next_free_slot[bucket_id]; - for(i = cache.start; i < next_free_slot; i++) { - if(bcache->bucket.pairs[i].key == key) { - if(cache.found_items++ == iterator->next_item_no) { - iterator->next_item_no++; - cache.start = i + 1; - PRINTF("DB: Found key %ld with value %lu\n", (long)key, - (unsigned long)bcache->bucket.pairs[i].value); - return (tuple_id_t)bcache->bucket.pairs[i].value; - } - } - } - } - - if(VALUE_INT(&iterator->min_value) == VALUE_INT(&iterator->max_value)) { - PRINTF("DB: Could not find key %ld in the index\n", (long)key); - return INVALID_TUPLE; - } - - iterator->next_item_no = 0; - VALUE_INT(&iterator->min_value)++; - - return get_next(iterator); -} diff --git a/os/storage/antelope/index-memhash.c b/os/storage/antelope/index-memhash.c deleted file mode 100644 index 56b338802..000000000 --- a/os/storage/antelope/index-memhash.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * A memory-resident hash map used as a DB index. - * \author - * Nicolas Tsiftes - */ - -#include - -#include "lib/memb.h" - -#include "db-options.h" -#include "index.h" - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -static db_result_t create(index_t *); -static db_result_t destroy(index_t *); -static db_result_t load(index_t *); -static db_result_t release(index_t *); -static db_result_t insert(index_t *, attribute_value_t *, tuple_id_t); -static db_result_t delete(index_t *, attribute_value_t *); -static tuple_id_t get_next(index_iterator_t *); - -index_api_t index_memhash = { - INDEX_MEMHASH, - INDEX_API_INTERNAL, - create, - destroy, - load, - release, - insert, - delete, - get_next -}; - -struct hash_item { - tuple_id_t tuple_id; - attribute_value_t value; -}; -typedef struct hash_item hash_item_t; - -typedef hash_item_t hash_map_t[DB_MEMHASH_TABLE_SIZE]; - -MEMB(hash_map_memb, hash_map_t, DB_MEMHASH_INDEX_LIMIT); - -static unsigned -calculate_hash(attribute_value_t *value) -{ - unsigned char *cp, *end; - unsigned hash_value; - - cp = (unsigned char *)value; - end = cp + sizeof(*value); - hash_value = 0; - - while(cp < end) { - hash_value = hash_value * 33 + *cp++; - } - - return hash_value % DB_MEMHASH_TABLE_SIZE; -} - -static db_result_t -create(index_t *index) -{ - int i; - hash_map_t *hash_map; - - PRINTF("Creating a memory-resident hash map index\n"); - - hash_map = memb_alloc(&hash_map_memb); - if(hash_map == NULL) { - return DB_ALLOCATION_ERROR; - } - - for(i = 0; i < DB_MEMHASH_TABLE_SIZE; i++) { - hash_map[i]->tuple_id = INVALID_TUPLE; - } - - index->opaque_data = hash_map; - - return DB_OK; -} - -static db_result_t -destroy(index_t *index) -{ - memb_free(&hash_map_memb, index->opaque_data); - - return DB_OK; -} - -static db_result_t -load(index_t *index) -{ - return create(index); -} - -static db_result_t -release(index_t *index) -{ - return destroy(index); -} - -static db_result_t -insert(index_t *index, attribute_value_t *value, tuple_id_t tuple_id) -{ - hash_map_t *hash_map; - uint16_t hash_value; - - hash_map = index->opaque_data; - - hash_value = calculate_hash(value); - hash_map[hash_value]->tuple_id = tuple_id; - hash_map[hash_value]->value = *value; - - PRINTF("DB: Inserted value %ld into the hash table\n", VALUE_LONG(value)); - - return DB_OK; -} - -static db_result_t -delete(index_t *index, attribute_value_t *value) -{ - hash_map_t *hash_map; - uint16_t hash_value; - - hash_map = index->opaque_data; - - hash_value = calculate_hash(value); - if(memcmp(&hash_map[hash_value]->value, value, sizeof(*value)) != 0) { - return DB_INDEX_ERROR; - } - - hash_map[hash_value]->tuple_id = INVALID_TUPLE; - return DB_OK; -} - -static tuple_id_t -get_next(index_iterator_t *iterator) -{ - hash_map_t *hash_map; - uint16_t hash_value; - - if(iterator->next_item_no == 1) { - /* The memhash supports only unique values at the moment. */ - return INVALID_TUPLE; - } - - hash_map = iterator->index->opaque_data; - - hash_value = calculate_hash(&iterator->min_value); - if(memcmp(&hash_map[hash_value]->value, &iterator->min_value, sizeof(iterator->min_value)) != 0) { - return INVALID_TUPLE; - } - - iterator->next_item_no++; - - PRINTF("DB: Found value %ld in the hash table\n", - VALUE_LONG(&iterator->min_value)); - - return hash_map[hash_value]->tuple_id; -} diff --git a/os/storage/antelope/index.c b/os/storage/antelope/index.c deleted file mode 100644 index 7e05d0738..000000000 --- a/os/storage/antelope/index.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 component forwards index calls using the generic index - * API to specific implementations. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "lib/memb.h" -#include "lib/list.h" - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -#include "antelope.h" -#include "attribute.h" -#include "db-options.h" -#include "index.h" -#include "storage.h" - -static index_api_t *index_components[] = {&index_inline, - &index_maxheap}; - -LIST(indices); -MEMB(index_memb, index_t, DB_INDEX_POOL_SIZE); - -static process_event_t load_request_event; -PROCESS(db_indexer, "DB Indexer"); - -static index_api_t * -find_index_api(index_type_t index_type) -{ - int i; - - for(i = 0; i < sizeof(index_components) / sizeof(index_components[0]); i++) { - if(index_components[i]->type == index_type) { - return index_components[i]; - } - } - - return NULL; -} - -void -index_init(void) -{ - list_init(indices); - memb_init(&index_memb); - process_start(&db_indexer, NULL); -} - -db_result_t -index_create(index_type_t index_type, relation_t *rel, attribute_t *attr) -{ - tuple_id_t cardinality; - index_t *index; - index_api_t *api; - - cardinality = relation_cardinality(rel); - if(cardinality == INVALID_TUPLE) { - return DB_STORAGE_ERROR; - } - - if(attr->domain != DOMAIN_INT && attr->domain != DOMAIN_LONG) { - PRINTF("DB: Cannot create an index for a non-number attribute!\n"); - return DB_INDEX_ERROR; - } - - api = find_index_api(index_type); - if(api == NULL) { - PRINTF("DB: No API for index type %d\n", (int)index_type); - return DB_INDEX_ERROR; - } - - if(attr->index != NULL) { - /* Refuse to overwrite the old index. */ - PRINTF("DB: The attribute %s is already indexed\n", attr->name); - return DB_INDEX_ERROR; - } - - index = memb_alloc(&index_memb); - if(index == NULL) { - PRINTF("DB: Failed to allocate an index\n"); - return DB_ALLOCATION_ERROR; - } - - index->rel = rel; - index->attr = attr; - index->api = api; - index->flags = 0; - index->opaque_data = NULL; - index->descriptor_file[0] = '\0'; - index->type = index_type; - - if(DB_ERROR(api->create(index))) { - memb_free(&index_memb, index); - PRINTF("DB: Index-specific creation failed for attribute %s\n", attr->name); - return DB_INDEX_ERROR; - } - - attr->index = index; - list_push(indices, index); - - if(index->descriptor_file[0] != '\0' && - DB_ERROR(storage_put_index(index))) { - api->destroy(index); - memb_free(&index_memb, index); - PRINTF("DB: Failed to store index data in file \"%s\"\n", - index->descriptor_file); - return DB_INDEX_ERROR; - } - - if(!(api->flags & INDEX_API_INLINE) && cardinality > 0) { - PRINTF("DB: Created an index for an old relation; issuing a load request\n"); - index->flags = INDEX_LOAD_NEEDED; - process_post(&db_indexer, load_request_event, NULL); - } else { - /* Inline indexes (i.e., those using the existing storage of the relation) - do not need to be reloaded after restarting the system. */ - PRINTF("DB: Index created for attribute %s\n", attr->name); - index->flags |= INDEX_READY; - } - - return DB_OK; -} - -db_result_t -index_destroy(index_t *index) -{ - if(DB_ERROR(index_release(index)) || - DB_ERROR(index->api->destroy(index))) { - return DB_INDEX_ERROR; - } - - return DB_OK; -} - -db_result_t -index_load(relation_t *rel, attribute_t *attr) -{ - index_t *index; - index_api_t *api; - - PRINTF("DB: Attempting to load an index over %s.%s\n", rel->name, attr->name); - - index = memb_alloc(&index_memb); - if(index == NULL) { - PRINTF("DB: No more index objects available\n"); - return DB_ALLOCATION_ERROR; - } - - if(DB_ERROR(storage_get_index(index, rel, attr))) { - PRINTF("DB: Failed load an index descriptor from storage\n"); - memb_free(&index_memb, index); - return DB_INDEX_ERROR; - } - - index->rel = rel; - index->attr = attr; - index->opaque_data = NULL; - - api = find_index_api(index->type); - if(api == NULL) { - PRINTF("DB: No API for index type %d\n", index->type); - return DB_INDEX_ERROR; - } - - index->api = api; - - if(DB_ERROR(api->load(index))) { - PRINTF("DB: Index-specific load failed\n"); - return DB_INDEX_ERROR; - } - - list_push(indices, index); - attr->index = index; - index->flags = INDEX_READY; - - return DB_OK; -} - -db_result_t -index_release(index_t *index) -{ - if(DB_ERROR(index->api->release(index))) { - return DB_INDEX_ERROR; - } - - index->attr->index = NULL; - list_remove(indices, index); - memb_free(&index_memb, index); - - return DB_OK; -} - -db_result_t -index_insert(index_t *index, attribute_value_t *value, - tuple_id_t tuple_id) -{ - return index->api->insert(index, value, tuple_id); -} - -db_result_t -index_delete(index_t *index, attribute_value_t *value) -{ - if(index->flags != INDEX_READY) { - return DB_INDEX_ERROR; - } - - return index->api->delete(index, value); -} - -db_result_t -index_get_iterator(index_iterator_t *iterator, index_t *index, - attribute_value_t *min_value, - attribute_value_t *max_value) -{ - tuple_id_t cardinality; - unsigned long range; - unsigned long max_range; - long max; - long min; - - cardinality = relation_cardinality(index->rel); - if(cardinality == INVALID_TUPLE) { - return DB_STORAGE_ERROR; - } - - if(index->flags != INDEX_READY) { - return DB_INDEX_ERROR; - } - - min = db_value_to_long(min_value); - max = db_value_to_long(max_value); - - range = (unsigned long)max - min; - if(range > 0) { - /* - * Index structures that do not have a natural ability to handle - * range queries (e.g., a hash index) can nevertheless emulate them. - * - * The range query emulation attempts to look up the key for each - * value in the search range. If the search range is sparse, this - * iteration will incur a considerable overhead per found key. - * - * Hence, the emulation is preferable when an external module wants - * to iterate over a narrow range of keys, for which the total - * search cost is smaller than that of an iteration over all tuples - * in the relation. - */ - if(!(index->api->flags & INDEX_API_RANGE_QUERIES)) { - PRINTF("DB: Range query requested for an index that does not support it\n"); - max_range = cardinality / DB_INDEX_COST; - if(range > max_range) { - return DB_INDEX_ERROR; - } - PRINTF("DB: Using the index anyway because the range is small enough (%lu <= %lu)\n", - range, max_range); - } - } - - iterator->index = index; - iterator->min_value = *min_value; - iterator->max_value = *max_value; - iterator->next_item_no = 0; - - PRINTF("DB: Acquired an index iterator for %s.%s over the range (%ld,%ld)\n", - index->rel->name, index->attr->name, - min_value->u.long_value, max_value->u.long_value); - - return DB_OK; -} - -tuple_id_t -index_get_next(index_iterator_t *iterator) -{ - long min; - long max; - - if(iterator->index == NULL) { - /* This attribute is not indexed. */ - return INVALID_TUPLE; - } - - if((iterator->index->attr->flags & ATTRIBUTE_FLAG_UNIQUE) && - iterator->next_item_no == 1) { - min = db_value_to_long(&iterator->min_value); - max = db_value_to_long(&iterator->max_value); - if(min == max) { - /* - * We stop if this is an equivalence search on an attribute - * whose values are unique, and we already found one item. - */ - PRINTF("DB: Equivalence search finished\n"); - return INVALID_TUPLE; - } - } - - return iterator->index->api->get_next(iterator); -} - -int -index_exists(attribute_t *attr) -{ - index_t *index; - - index = (index_t *)attr->index; - if(index == NULL || index->flags != INDEX_READY) { - return 0; - } - - return 1; -} - -static index_t * -get_next_index_to_load(void) -{ - index_t *index; - - for(index = list_head(indices); index != NULL; index = index->next) { - if(index->flags & INDEX_LOAD_NEEDED) { - return index; - } - } - - return NULL; -} - -PROCESS_THREAD(db_indexer, ev, data) -{ - static index_t *index; - static db_handle_t handle; - static tuple_id_t row; - db_result_t result; - attribute_value_t value; - int column; - - PROCESS_BEGIN(); - load_request_event = process_alloc_event(); - - for(;;) { - PROCESS_WAIT_EVENT_UNTIL(ev == load_request_event); - - index = get_next_index_to_load(); - if(index == NULL) { - PRINTF("DB: Request to load an index, but no index is set to be loaded\n"); - continue; - } - - PRINTF("DB: Loading the index for %s.%s...\n", - index->rel->name, index->attr->name); - - /* Project the values of the indexed attribute from all tuples in - the relation, and insert them into the index again. */ - if(DB_ERROR(db_query(&handle, "SELECT %s FROM %s;", index->attr->name, index->rel->name))) { - index->flags |= INDEX_LOAD_ERROR; - index->flags &= ~INDEX_LOAD_NEEDED; - continue; - } - - for(;; row++) { - PROCESS_PAUSE(); - - result = db_process(&handle); - if(DB_ERROR(result)) { - PRINTF("DB: Index loading failed while processing: %s\n", - db_get_result_message(result)); - index->flags |= INDEX_LOAD_ERROR; - goto cleanup; - } - if(result == DB_FINISHED) { - break; - } - - for(column = 0; column < handle.ncolumns; column++) { - if(DB_ERROR(db_get_value(&value, &handle, column))) { - index->flags |= INDEX_LOAD_ERROR; - goto cleanup; - } - - if(DB_ERROR(index_insert(index, &value, row))) { - index->flags |= INDEX_LOAD_ERROR; - goto cleanup; - } - } - } - - PRINTF("DB: Loaded %lu rows into the index\n", - (unsigned long)handle.current_row); - -cleanup: - if(index->flags & INDEX_LOAD_ERROR) { - PRINTF("DB: Failed to load the index for %s.%s\n", - index->rel->name, index->attr->name); - } - index->flags &= ~INDEX_LOAD_NEEDED; - index->flags |= INDEX_READY; - db_free(&handle); - } - - - PROCESS_END(); -} diff --git a/os/storage/antelope/index.h b/os/storage/antelope/index.h deleted file mode 100644 index 6c9863e8f..000000000 --- a/os/storage/antelope/index.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * . - * \author - * Nicolas Tsiftes - */ - -#ifndef INDEX_H -#define INDEX_H - -#include "relation.h" - -typedef enum { - INDEX_NONE = 0, - INDEX_INLINE = 1, - INDEX_MEMHASH = 2, - INDEX_MAXHEAP = 3 -} index_type_t; - -#define INDEX_READY 0x00 -#define INDEX_LOAD_NEEDED 0x01 -#define INDEX_LOAD_ERROR 0x02 - -#define INDEX_API_INTERNAL 0x01 -#define INDEX_API_EXTERNAL 0x02 -#define INDEX_API_INLINE 0x04 -#define INDEX_API_COMPLETE 0x08 -#define INDEX_API_RANGE_QUERIES 0x10 - -struct index_api; - -struct index { - struct index *next; - char descriptor_file[DB_MAX_FILENAME_LENGTH]; - relation_t *rel; - attribute_t *attr; - struct index_api *api; - void *opaque_data; - index_type_t type; - uint8_t flags; -}; - -typedef struct index index_t; - -struct index_iterator { - index_t *index; - attribute_value_t min_value; - attribute_value_t max_value; - tuple_id_t next_item_no; - tuple_id_t found_items; -}; -typedef struct index_iterator index_iterator_t; - -struct index_api { - index_type_t type; - uint8_t flags; - db_result_t (*create)(index_t *); - db_result_t (*destroy)(index_t *); - db_result_t (*load)(index_t *); - db_result_t (*release)(index_t *); - db_result_t (*insert)(index_t *, attribute_value_t *, tuple_id_t); - db_result_t (*delete)(index_t *, attribute_value_t *); - tuple_id_t (*get_next)(index_iterator_t *); -}; - -typedef struct index_api index_api_t; - -extern index_api_t index_inline; -extern index_api_t index_maxheap; -extern index_api_t index_memhash; - -void index_init(void); -db_result_t index_create(index_type_t, relation_t *, attribute_t *); -db_result_t index_destroy(index_t *); -db_result_t index_load(relation_t *, attribute_t *); -db_result_t index_release(index_t *); -db_result_t index_insert(index_t *, attribute_value_t *, tuple_id_t); -db_result_t index_delete(index_t *, attribute_value_t *); -db_result_t index_get_iterator(index_iterator_t *, index_t *, - attribute_value_t *, attribute_value_t *); -tuple_id_t index_get_next(index_iterator_t *); -int index_exists(attribute_t *); - -#endif /* !INDEX_H */ diff --git a/os/storage/antelope/lvm.c b/os/storage/antelope/lvm.c deleted file mode 100644 index 7abed8d27..000000000 --- a/os/storage/antelope/lvm.c +++ /dev/null @@ -1,1020 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Logic engine used for quickly evaluating data constraints in relations. - * \author - * Nicolas Tsiftes - */ - -#include -#include -#include -#include - -#include "aql.h" -#include "lvm.h" - -#define DEBUG DEBUG_NONE -#include "debug.h" - -/* - * The logic engine determines whether a logical predicate is true for - * each tuple in a relation. It uses a stack-based execution model of - * operations that are arranged in prefix (Polish) notation. - */ - -/* Default option values. */ -#ifndef LVM_MAX_NAME_LENGTH -#define LVM_MAX_NAME_LENGTH 16 -#endif - -#ifndef LVM_MAX_VARIABLE_ID -#define LVM_MAX_VARIABLE_ID 8 -#endif - -#ifndef LVM_USE_FLOATS -#define LVM_USE_FLOATS 0 -#endif - -#define IS_CONNECTIVE(op) ((op) & LVM_CONNECTIVE) - -struct variable { - operand_type_t type; - operand_value_t value; - char name[LVM_MAX_NAME_LENGTH + 1]; -}; -typedef struct variable variable_t; - -struct derivation { - operand_value_t max; - operand_value_t min; - uint8_t derived; -}; -typedef struct derivation derivation_t; - -/* Registered variables for a LVM expression. Their values may be - changed between executions of the expression. */ -static variable_t variables[LVM_MAX_VARIABLE_ID]; - -/* Range derivations of variables that are used for index searches. */ -static derivation_t derivations[LVM_MAX_VARIABLE_ID]; - -#if DEBUG -static void -print_derivations(derivation_t *d) -{ - int i; - - for(i = 0; i < LVM_MAX_VARIABLE_ID; i++) { - if(d[i].derived) { - printf("%s is constrained to (%ld,%ld)\n", variables[i].name, - d[i].min.l, d[i].max.l); - } - } -} -#endif /* DEBUG */ - -static variable_id_t -lookup(char *name) -{ - variable_t *var; - - for(var = variables; var <= &variables[LVM_MAX_VARIABLE_ID - 1] && var->name[0] != '\0'; var++) { - if(strcmp(var->name, name) == 0) { - break; - } - } - - return (variable_id_t)(var - &variables[0]); -} - -static operator_t * -get_operator(lvm_instance_t *p) -{ - operator_t *operator; - - operator = (operator_t *)&p->code[p->ip]; - p->ip += sizeof(operator_t); - return operator; -} - -static void -get_operand(lvm_instance_t *p, operand_t *operand) -{ - memcpy(operand, &p->code[p->ip], sizeof(*operand)); - p->ip += sizeof(*operand); -} - -static node_type_t -get_type(lvm_instance_t *p) -{ - node_type_t node_type; - - node_type = *(node_type_t *)(p->code + p->ip); - p->ip += sizeof(node_type); - - return node_type; -} - -static long -operand_to_long(operand_t *operand) -{ - switch(operand->type) { - case LVM_LONG: - return operand->value.l; -#if LVM_USE_FLOATS - case LVM_FLOAT: - return (long)operand->value.f; - break; -#endif /* LVM_USE_FLOATS */ - case LVM_VARIABLE: - return variables[operand->value.id].value.l; - default: - return 0; - } -} - -static lvm_status_t -eval_expr(lvm_instance_t *p, operator_t op, operand_t *result) -{ - int i; - node_type_t type; - operator_t *operator; - operand_t operand[2]; - long value[2]; - long result_value; - lvm_status_t r; - - for(i = 0; i < 2; i++) { - type = get_type(p); - switch(type) { - case LVM_ARITH_OP: - operator = get_operator(p); - r = eval_expr(p, *operator, &operand[i]); - if(LVM_ERROR(r)) { - return r; - } - break; - case LVM_OPERAND: - get_operand(p, &operand[i]); - break; - default: - return LVM_SEMANTIC_ERROR; - } - value[i] = operand_to_long(&operand[i]); - } - - switch(op) { - case LVM_ADD: - result_value = value[0] + value[1]; - break; - case LVM_SUB: - result_value = value[0] - value[1]; - break; - case LVM_MUL: - result_value = value[0] * value[1]; - break; - case LVM_DIV: - if(value[1] == 0) { - return LVM_MATH_ERROR; - } - result_value = value[0] / value[1]; - break; - default: - return LVM_EXECUTION_ERROR; - } - - result->type = LVM_LONG; - result->value.l = result_value; - - return LVM_TRUE; -} - -static int -eval_logic(lvm_instance_t *p, operator_t *op) -{ - int i; - int r; - operand_t operand; - long result[2]; - node_type_t type; - operator_t *operator; - long l1, l2; - int logic_result[2]; - unsigned arguments; - - if(IS_CONNECTIVE(*op)) { - arguments = *op == LVM_NOT ? 1 : 2; - for(i = 0; i < arguments; i++) { - type = get_type(p); - if(type != LVM_CMP_OP) { - return LVM_SEMANTIC_ERROR; - } - operator = get_operator(p); - logic_result[i] = eval_logic(p, operator); - if(LVM_ERROR(logic_result[i])) { - return logic_result[i]; - } - } - - if(*op == LVM_NOT) { - return !logic_result[0]; - } else if(*op == LVM_AND) { - return logic_result[0] == LVM_TRUE && logic_result[1] == LVM_TRUE; - } else { - return logic_result[0] == LVM_TRUE || logic_result[1] == LVM_TRUE; - } - } - - for(i = 0; i < 2; i++) { - type = get_type(p); - switch(type) { - case LVM_ARITH_OP: - operator = get_operator(p); - r = eval_expr(p, *operator, &operand); - if(LVM_ERROR(r)) { - return r; - } - break; - case LVM_OPERAND: - get_operand(p, &operand); - break; - default: - return LVM_SEMANTIC_ERROR; - } - result[i] = operand_to_long(&operand); - } - - l1 = result[0]; - l2 = result[1]; - PRINTF("Result1: %ld\nResult2: %ld\n", l1, l2); - - switch(*op) { - case LVM_EQ: - return l1 == l2; - case LVM_NEQ: - return l1 != l2; - case LVM_GE: - return l1 > l2; - case LVM_GEQ: - return l1 >= l2; - case LVM_LE: - return l1 < l2; - case LVM_LEQ: - return l1 <= l2; - default: - break; - } - - return LVM_EXECUTION_ERROR; -} - -void -lvm_reset(lvm_instance_t *p, unsigned char *code, lvm_ip_t size) -{ - memset(code, 0, size); - p->code = code; - p->size = size; - p->end = 0; - p->ip = 0; - p->error = 0; - - memset(variables, 0, sizeof(variables)); - memset(derivations, 0, sizeof(derivations)); -} - -lvm_ip_t -lvm_jump_to_operand(lvm_instance_t *p) -{ - lvm_ip_t old_end; - - old_end = p->end; - p->end += sizeof(operator_t) + sizeof(node_type_t); - if(p->end >= p->size) { - p->error = __LINE__; - p->end = old_end; - } - - return old_end; -} - -lvm_ip_t -lvm_shift_for_operator(lvm_instance_t *p, lvm_ip_t end) -{ - unsigned char *ptr; - lvm_ip_t old_end; - - old_end = p->end; - - if(p->end + sizeof(operator_t) + sizeof(node_type_t) > p->size || - end >= old_end) { - p->error = __LINE__; - return 0; - } - - ptr = p->code + end; - - memmove(ptr + sizeof(operator_t) + sizeof(node_type_t), ptr, old_end - end); - p->end = end; - - return old_end + sizeof(operator_t) + sizeof(node_type_t); -} - -lvm_ip_t -lvm_get_end(lvm_instance_t *p) -{ - return p->end; -} - -lvm_ip_t -lvm_set_end(lvm_instance_t *p, lvm_ip_t end) -{ - lvm_ip_t old_end; - - if(end >= p->size) { - p->error = __LINE__; - return p->end; - } - - old_end = p->end; - p->end = end; - - return old_end; -} - -lvm_status_t -lvm_execute(lvm_instance_t *p) -{ - node_type_t type; - operator_t *operator; - lvm_status_t status; - - p->ip = 0; - status = LVM_EXECUTION_ERROR; - type = get_type(p); - switch(type) { - case LVM_CMP_OP: - operator = get_operator(p); - status = eval_logic(p, operator); - if(!LVM_ERROR(status)) { - PRINTF("The statement is %s\n", status == LVM_TRUE ? "true" : "false"); - } else { - PRINTF("Execution error: %d\n", (int)status); - } - break; - default: - PRINTF("Error: The code must start with a relational operator\n"); - } - - return status; -} - -lvm_status_t -lvm_set_type(lvm_instance_t *p, node_type_t type) -{ - if(p->end + sizeof(node_type_t) >= DB_VM_BYTECODE_SIZE) { - PRINTF("Error: overflow in lvm_set_type\n"); - return LVM_STACK_OVERFLOW; - } - - *(node_type_t *)(p->code + p->end) = type; - p->end += sizeof(type); - return LVM_TRUE; -} - -lvm_status_t -lvm_set_op(lvm_instance_t *p, operator_t op) -{ - lvm_status_t status; - - status = lvm_set_type(p, LVM_ARITH_OP); - if(status != LVM_TRUE) { - return status; - } - - if(p->end + sizeof(op) >= DB_VM_BYTECODE_SIZE) { - PRINTF("Error: overflow in lvm_set_op\n"); - return LVM_STACK_OVERFLOW; - } - - memcpy(&p->code[p->end], &op, sizeof(op)); - p->end += sizeof(op); - return LVM_TRUE; -} - -lvm_status_t -lvm_set_relation(lvm_instance_t *p, operator_t op) -{ - lvm_status_t status; - - status = lvm_set_type(p, LVM_CMP_OP); - if(status != LVM_TRUE) { - return status; - } - - if(p->end + sizeof(op) >= DB_VM_BYTECODE_SIZE) { - PRINTF("Error: overflow in lvm_set_relation\n"); - return LVM_STACK_OVERFLOW; - } - - memcpy(&p->code[p->end], &op, sizeof(op)); - p->end += sizeof(op); - return LVM_TRUE; -} - -lvm_status_t -lvm_set_operand(lvm_instance_t *p, operand_t *op) -{ - lvm_status_t status; - - status = lvm_set_type(p, LVM_OPERAND); - if(status != LVM_TRUE) { - return status; - } - - if(p->end + sizeof(*op) >= DB_VM_BYTECODE_SIZE) { - PRINTF("Error: overflow in lvm_set_operand\n"); - return LVM_STACK_OVERFLOW; - } - - memcpy(&p->code[p->end], op, sizeof(*op)); - p->end += sizeof(*op); - return LVM_TRUE; -} - -lvm_status_t -lvm_set_long(lvm_instance_t *p, long l) -{ - operand_t op; - - op.type = LVM_LONG; - op.value.l = l; - - return lvm_set_operand(p, &op); -} - -lvm_status_t -lvm_register_variable(char *name, operand_type_t type) -{ - variable_id_t id; - variable_t *var; - - id = lookup(name); - if(id == LVM_MAX_VARIABLE_ID) { - return LVM_VARIABLE_LIMIT_REACHED; - } - - var = &variables[id]; - if(var->name[0] == '\0') { - strncpy(var->name, name, sizeof(var->name) - 1); - var->name[sizeof(var->name) - 1] = '\0'; - var->type = type; - } - - return LVM_TRUE; -} - -lvm_status_t -lvm_set_variable_value(char *name, operand_value_t value) -{ - variable_id_t id; - - id = lookup(name); - if(id == LVM_MAX_VARIABLE_ID) { - return LVM_INVALID_IDENTIFIER; - } - - variables[id].value = value; - return LVM_TRUE; -} - -lvm_status_t -lvm_set_variable(lvm_instance_t *p, char *name) -{ - operand_t op; - variable_id_t id; - - id = lookup(name); - if(id == LVM_MAX_VARIABLE_ID) { - return LVM_INVALID_IDENTIFIER; - } - - PRINTF("var id = %d\n", id); - op.type = LVM_VARIABLE; - op.value.id = id; - return lvm_set_operand(p, &op); -} - -void -lvm_clone(lvm_instance_t *dst, lvm_instance_t *src) -{ - memcpy(dst, src, sizeof(*dst)); -} - -static void -create_intersection(derivation_t *result, derivation_t *d1, derivation_t *d2) -{ - int i; - - for(i = 0; i < LVM_MAX_VARIABLE_ID; i++) { - if(!d1[i].derived && !d2[i].derived) { - continue; - } else if(d1[i].derived && !d2[i].derived) { - result[i].min.l = d1[i].min.l; - result[i].max.l = d1[i].max.l; - } else if(!d1[i].derived && d2[i].derived) { - result[i].min.l = d2[i].min.l; - result[i].max.l = d2[i].max.l; - } else { - /* Both derivations have been made; create an - intersection of the ranges. */ - if(d1[i].min.l > d2[i].min.l) { - result[i].min.l = d1[i].min.l; - } else { - result[i].min.l = d2[i].min.l; - } - - if(d1[i].max.l < d2[i].max.l) { - result[i].max.l = d1[i].max.l; - } else { - result[i].max.l = d2[i].max.l; - } - } - result[i].derived = 1; - } - -#if DEBUG - PRINTF("Created an intersection of D1 and D2\n"); - PRINTF("D1: \n"); - print_derivations(d1); - PRINTF("D2: \n"); - print_derivations(d2); - PRINTF("Result: \n"); - print_derivations(result); -#endif /* DEBUG */ -} - -static void -create_union(derivation_t *result, derivation_t *d1, derivation_t *d2) -{ - int i; - - for(i = 0; i < LVM_MAX_VARIABLE_ID; i++) { - if(!d1[i].derived && !d2[i].derived) { - continue; - } else if(d1[i].derived && !d2[i].derived) { - result[i].min.l = d1[i].min.l; - result[i].max.l = d1[i].max.l; - } else if(!d1[i].derived && d2[i].derived) { - result[i].min.l = d2[i].min.l; - result[i].max.l = d2[i].max.l; - } else { - /* Both derivations have been made; create a - union of the ranges. */ - if(d1[i].min.l > d2[i].min.l) { - result[i].min.l = d2[i].min.l; - } else { - result[i].min.l = d1[i].min.l; - } - - if(d1[i].max.l < d2[i].max.l) { - result[i].max.l = d2[i].max.l; - } else { - result[i].max.l = d1[i].max.l; - } - } - result[i].derived = 1; - } - -#if DEBUG - PRINTF("Created a union of D1 and D2\n"); - PRINTF("D1: \n"); - print_derivations(d1); - PRINTF("D2: \n"); - print_derivations(d2); - PRINTF("Result: \n"); - print_derivations(result); -#endif /* DEBUG */ -} - -static int -derive_relation(lvm_instance_t *p, derivation_t *local_derivations) -{ - operator_t *operator; - node_type_t type; - operand_t operand[2]; - int i; - int variable_id; - operand_value_t *value; - derivation_t *derivation; - - type = get_type(p); - operator = get_operator(p); - - if(IS_CONNECTIVE(*operator)) { - derivation_t d1[LVM_MAX_VARIABLE_ID]; - derivation_t d2[LVM_MAX_VARIABLE_ID]; - - if(*operator != LVM_AND && *operator != LVM_OR) { - return LVM_DERIVATION_ERROR; - } - - PRINTF("Attempting to infer ranges from a logical connective\n"); - - memset(d1, 0, sizeof(d1)); - memset(d2, 0, sizeof(d2)); - - if(LVM_ERROR(derive_relation(p, d1)) || - LVM_ERROR(derive_relation(p, d2))) { - return LVM_DERIVATION_ERROR; - } - - if(*operator == LVM_AND) { - create_intersection(local_derivations, d1, d2); - } else if(*operator == LVM_OR) { - create_union(local_derivations, d1, d2); - } - return LVM_TRUE; - } - - for(i = 0; i < 2; i++) { - type = get_type(p); - switch(type) { - case LVM_OPERAND: - get_operand(p, &operand[i]); - break; - default: - return LVM_DERIVATION_ERROR; - } - } - - if(operand[0].type == LVM_VARIABLE && operand[1].type == LVM_VARIABLE) { - return LVM_DERIVATION_ERROR; - } - - /* Determine which of the operands that is the variable. */ - if(operand[0].type == LVM_VARIABLE) { - if(operand[1].type == LVM_VARIABLE) { - return LVM_DERIVATION_ERROR; - } - variable_id = operand[0].value.id; - value = &operand[1].value; - } else { - variable_id = operand[1].value.id; - value = &operand[0].value; - } - - if(variable_id >= LVM_MAX_VARIABLE_ID) { - return LVM_DERIVATION_ERROR; - } - - PRINTF("variable id %d, value %ld\n", variable_id, *(long *)value); - - derivation = local_derivations + variable_id; - /* Default values. */ - derivation->max.l = LONG_MAX; - derivation->min.l = LONG_MIN; - - switch(*operator) { - case LVM_EQ: - derivation->max = *value; - derivation->min = *value; - break; - case LVM_GE: - derivation->min.l = value->l + 1; - break; - case LVM_GEQ: - derivation->min.l = value->l; - break; - case LVM_LE: - derivation->max.l = value->l - 1; - break; - case LVM_LEQ: - derivation->max.l = value->l; - break; - default: - return LVM_DERIVATION_ERROR; - } - - derivation->derived = 1; - - return LVM_TRUE; -} - -lvm_status_t -lvm_derive(lvm_instance_t *p) -{ - return derive_relation(p, derivations); -} - -lvm_status_t -lvm_get_derived_range(lvm_instance_t *p, char *name, - operand_value_t *min, operand_value_t *max) -{ - int i; - - for(i = 0; i < LVM_MAX_VARIABLE_ID; i++) { - if(strcmp(name, variables[i].name) == 0) { - if(derivations[i].derived) { - *min = derivations[i].min; - *max = derivations[i].max; - return LVM_TRUE; - } - return LVM_DERIVATION_ERROR; - } - } - return LVM_INVALID_IDENTIFIER; -} - -#if DEBUG -static lvm_ip_t -print_operator(lvm_instance_t *p, lvm_ip_t index) -{ - operator_t operator; - struct operator_map { - operator_t op; - char *representation; - }; - struct operator_map operator_map[] = { - {LVM_ADD, "+"}, - {LVM_SUB, "-"}, - {LVM_MUL, "*"}, - {LVM_DIV, "/"}, - {LVM_GE, ">"}, - {LVM_GEQ, ">="}, - {LVM_LE, "<"}, - {LVM_LEQ, "<="}, - {LVM_EQ, "="}, - {LVM_NEQ, "<>"}, - {LVM_AND, "/\\"}, - {LVM_OR, "\\/"}, - {LVM_NOT, "!"} - }; - int i; - - memcpy(&operator, p->code + index, sizeof(operator)); - - for(i = 0; i < sizeof(operator_map) / sizeof(operator_map[0]); i++) { - if(operator_map[i].op == operator) { - PRINTF("%s ", operator_map[i].representation); - break; - } - } - - return index + sizeof(operator_t); -} - -static lvm_ip_t -print_operand(lvm_instance_t *p, lvm_ip_t index) -{ - operand_t operand; - - memcpy(&operand, p->code + index, sizeof(operand)); - - switch(operand.type) { - case LVM_VARIABLE: - if(operand.value.id >= LVM_MAX_VARIABLE_ID || - variables[operand.value.id].name == NULL) { - PRINTF("var(id:%d):?? ", operand.value.id); - } else { - PRINTF("var(%s):%ld ", variables[operand.value.id].name, - variables[operand.value.id].value.l); - } - break; - case LVM_LONG: - PRINTF("long:%ld ", operand.value.l); - break; - default: - PRINTF("?? "); - break; - } - - return index + sizeof(operand_t); -} - -static lvm_ip_t -print_relation(lvm_instance_t *p, lvm_ip_t index) -{ - /* Relational operators are stored as ordinary operators. */ - return print_operator(p, index); -} -#endif /* DEBUG */ - -void -lvm_print_code(lvm_instance_t *p) -{ -#if DEBUG - lvm_ip_t ip; - - PRINTF("Code: "); - - for(ip = 0; ip < p->end;) { - switch(*(node_type_t *)(p->code + ip)) { - case LVM_CMP_OP: - ip = print_relation(p, ip + sizeof(node_type_t)); - break; - case LVM_ARITH_OP: - ip = print_operator(p, ip + sizeof(node_type_t)); - break; - case LVM_OPERAND: - ip = print_operand(p, ip + sizeof(node_type_t)); - break; - default: - PRINTF("Invalid opcode: 0x%x ", p->code[ip]); - ip = p->end; - break; - } - } - putchar('\n'); -#endif -} - -void -lvm_print_derivations(lvm_instance_t *p) -{ -#if DEBUG - print_derivations(derivations); -#endif /* DEBUG */ -} - -#ifdef TEST -int -main(void) -{ - lvm_instance_t p; - unsigned char code[256]; - - lvm_reset(&p, code, sizeof(code)); - - lvm_register_variable("z", LVM_LONG); - lvm_set_variable_value("z", (operand_value_t)15L); - - lvm_register_variable("y", LVM_LONG); - lvm_set_variable_value("y", (operand_value_t)109L); - - /* Infix: 109 = y /\ 20 > 70 - (6 + z * 3) => 109 = 109 /\ 20 > 19 => true */ - lvm_set_relation(&p, LVM_AND); - lvm_set_relation(&p, LVM_EQ); - lvm_set_long(&p, 109); - lvm_set_variable(&p, "y"); - lvm_set_relation(&p, LVM_GE); - lvm_set_long(&p, 20); - lvm_set_op(&p, LVM_SUB); - lvm_set_long(&p, 70); - lvm_set_op(&p, LVM_ADD); - lvm_set_long(&p, 6); - lvm_set_op(&p, LVM_MUL); - lvm_set_variable(&p, "z"); - lvm_set_long(&p, 3); - - lvm_print_code(&p); - - lvm_execute(&p); - - /* Infix: !(9999 + 1 < -1 + 10001) => !(10000 < 10000) => true */ - lvm_reset(&p, code, sizeof(code)); - lvm_set_relation(&p, LVM_NOT); - lvm_set_relation(&p, LVM_LE); - lvm_set_op(&p, LVM_ADD); - lvm_set_long(&p, 9999); - lvm_set_long(&p, 1); - lvm_set_op(&p, LVM_ADD); - lvm_set_long(&p, -1); - lvm_set_long(&p, 10001); - - lvm_print_code(&p); - - lvm_execute(&p); - - /* Derivation tests */ - - /* Infix: a = 5 => a:(5,5) */ - lvm_reset(&p, code, sizeof(code)); - lvm_register_variable("a", LVM_LONG); - lvm_set_relation(&p, LVM_EQ); - lvm_set_variable(&p, "a"); - lvm_set_long(&p, 5); - - lvm_derive(&p); - lvm_print_derivations(&p); - - /* Infix: a < 10 => a:(-oo,9) */ - lvm_reset(&p, code, sizeof(code)); - lvm_register_variable("a", LVM_LONG); - lvm_set_relation(&p, LVM_LE); - lvm_set_variable(&p, "a"); - lvm_set_long(&p, 10); - - lvm_derive(&p); - lvm_print_derivations(&p); - - /* Infix: a < 100 /\ 10 < a => a:(11,99) */ - lvm_reset(&p, code, sizeof(code)); - lvm_register_variable("a", LVM_LONG); - lvm_set_relation(&p, LVM_AND); - lvm_set_relation(&p, LVM_LE); - lvm_set_variable(&p, "a"); - lvm_set_long(&p, 100); - lvm_set_relation(&p, LVM_GE); - lvm_set_long(&p, 10); - lvm_set_variable(&p, "a"); - - lvm_derive(&p); - lvm_print_derivations(&p); - - /* Infix: a < 100 /\ b > 100 => a:(-oo,99), b:(101,oo) */ - lvm_reset(&p, code, sizeof(code)); - lvm_register_variable("a", LVM_LONG); - lvm_register_variable("b", LVM_LONG); - lvm_set_relation(&p, LVM_AND); - lvm_set_relation(&p, LVM_LE); - lvm_set_variable(&p, "a"); - lvm_set_long(&p, 100); - lvm_set_relation(&p, LVM_GE); - lvm_set_variable(&p, "b"); - lvm_set_long(&p, 100); - - lvm_derive(&p); - lvm_print_derivations(&p); - - /* Infix: a < 100 \/ a < 1000 \/ a < 1902 => a:(-oo,1901) */ - lvm_reset(&p, code, sizeof(code)); - lvm_register_variable("a", LVM_LONG); - lvm_set_relation(&p, LVM_OR); - lvm_set_relation(&p, LVM_LE); - lvm_set_variable(&p, "a"); - lvm_set_long(&p, 100); - lvm_set_relation(&p, LVM_OR); - lvm_set_relation(&p, LVM_LE); - lvm_set_long(&p, 1000); - lvm_set_variable(&p, "a"); - lvm_set_relation(&p, LVM_LE); - lvm_set_variable(&p, "a"); - lvm_set_long(&p, 1902); - - lvm_derive(&p); - lvm_print_derivations(&p); - - /* Infix: (a < 100 /\ a < 90 /\ a > 80 /\ a < 105) \/ b > 10000 => - a:(81,89), b:(10001:oo) */ - lvm_reset(&p, code, sizeof(code)); - lvm_register_variable("a", LVM_LONG); - lvm_register_variable("b", LVM_LONG); - - lvm_set_relation(&p, LVM_OR); - lvm_set_relation(&p, LVM_GE); - lvm_set_variable(&p, "b"); - lvm_set_long(&p, 10000); - - lvm_set_relation(&p, LVM_AND); - lvm_set_relation(&p, LVM_LE); - lvm_set_variable(&p, "a"); - lvm_set_long(&p, 100); - lvm_set_relation(&p, LVM_AND); - lvm_set_relation(&p, LVM_LE); - lvm_set_variable(&p, "a"); - lvm_set_long(&p, 90); - lvm_set_relation(&p, LVM_AND); - lvm_set_relation(&p, LVM_GE); - lvm_set_variable(&p, "a"); - lvm_set_long(&p, 80); - lvm_set_relation(&p, LVM_LE); - lvm_set_variable(&p, "a"); - lvm_set_long(&p, 105); - - lvm_derive(&p); - lvm_print_derivations(&p); - - printf("Done\n"); - - return 0; -} -#endif diff --git a/os/storage/antelope/lvm.h b/os/storage/antelope/lvm.h deleted file mode 100644 index 6b56d6bd1..000000000 --- a/os/storage/antelope/lvm.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Definitions and declarations for the Propositional Logic Engine. - * \author - * Nicolas Tsiftes - */ - -#ifndef LVM_H -#define LVM_H - -#include - -#include "db-options.h" - -enum lvm_status { - LVM_FALSE = 0, - LVM_TRUE = 1, - LVM_INVALID_IDENTIFIER = 2, - LVM_SEMANTIC_ERROR = 3, - LVM_MATH_ERROR = 4, - LVM_STACK_OVERFLOW = 5, - LVM_TYPE_ERROR = 6, - LVM_VARIABLE_LIMIT_REACHED = 7, - LVM_EXECUTION_ERROR = 8, - LVM_DERIVATION_ERROR = 9 -}; - -typedef enum lvm_status lvm_status_t; - -#define LVM_ERROR(x) (x >= 2) - -typedef int lvm_ip_t; - -struct lvm_instance { - unsigned char *code; - lvm_ip_t size; - lvm_ip_t end; - lvm_ip_t ip; - unsigned error; -}; -typedef struct lvm_instance lvm_instance_t; - -enum node_type { - LVM_ARITH_OP = 0x10, - LVM_OPERAND = 0x20, - LVM_CMP_OP = 0x40, - LVM_CONNECTIVE = 0x80 -}; -typedef enum node_type node_type_t; - -enum operator { - LVM_ADD = LVM_ARITH_OP | 1, - LVM_SUB = LVM_ARITH_OP | 2, - LVM_MUL = LVM_ARITH_OP | 3, - LVM_DIV = LVM_ARITH_OP | 4, - LVM_EQ = LVM_CMP_OP | 1, - LVM_NEQ = LVM_CMP_OP | 2, - LVM_GE = LVM_CMP_OP | 3, - LVM_GEQ = LVM_CMP_OP | 4, - LVM_LE = LVM_CMP_OP | 5, - LVM_LEQ = LVM_CMP_OP | 6, - LVM_AND = LVM_CONNECTIVE | 1, - LVM_OR = LVM_CONNECTIVE | 2, - LVM_NOT = LVM_CONNECTIVE | 3 -}; -typedef enum operator operator_t; - -enum operand_type { - LVM_VARIABLE, - LVM_FLOAT, - LVM_LONG -}; -typedef enum operand_type operand_type_t; - -typedef unsigned char variable_id_t; - -typedef union { - long l; -#if LVM_USE_FLOATS - float f; -#endif - variable_id_t id; -} operand_value_t; - -struct operand { - operand_type_t type; - operand_value_t value; -}; -typedef struct operand operand_t; - -void lvm_reset(lvm_instance_t *p, unsigned char *code, lvm_ip_t size); -void lvm_clone(lvm_instance_t *dst, lvm_instance_t *src); -lvm_status_t lvm_derive(lvm_instance_t *p); -lvm_status_t lvm_get_derived_range(lvm_instance_t *p, char *name, - operand_value_t *min, - operand_value_t *max); -void lvm_print_derivations(lvm_instance_t *p); -lvm_status_t lvm_execute(lvm_instance_t *p); -lvm_status_t lvm_register_variable(char *name, operand_type_t type); -lvm_status_t lvm_set_variable_value(char *name, operand_value_t value); -void lvm_print_code(lvm_instance_t *p); -lvm_ip_t lvm_jump_to_operand(lvm_instance_t *p); -lvm_ip_t lvm_shift_for_operator(lvm_instance_t *p, lvm_ip_t end); -lvm_ip_t lvm_get_end(lvm_instance_t *p); -lvm_ip_t lvm_set_end(lvm_instance_t *p, lvm_ip_t end); -lvm_status_t lvm_set_op(lvm_instance_t *p, operator_t op); -lvm_status_t lvm_set_relation(lvm_instance_t *p, operator_t op); -lvm_status_t lvm_set_operand(lvm_instance_t *p, operand_t *op); -lvm_status_t lvm_set_long(lvm_instance_t *p, long l); -lvm_status_t lvm_set_variable(lvm_instance_t *p, char *name); - -#endif /* LVM_H */ diff --git a/os/storage/antelope/relation.c b/os/storage/antelope/relation.c deleted file mode 100644 index 0e939a068..000000000 --- a/os/storage/antelope/relation.c +++ /dev/null @@ -1,1220 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Logic for relational databases. - * \author - * Nicolas Tsiftes - */ - -#include -#include - -#include "lib/crc16.h" -#include "lib/list.h" -#include "lib/memb.h" - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -#include "db-options.h" -#include "index.h" -#include "lvm.h" -#include "relation.h" -#include "result.h" -#include "storage.h" -#include "aql.h" - -/* - * The source_dest_map structure is used for mapping the pointers to - * data in a source row and in the corresponding destination row. The - * structure is calculated just before processing a relational - * selection, and then used to improve the performance when processing - * each row. -*/ -struct source_dest_map { - attribute_t *from_attr; - attribute_t *to_attr; - unsigned from_offset; - unsigned to_offset; -}; - -static struct source_dest_map attr_map[AQL_ATTRIBUTE_LIMIT]; - -#if DB_FEATURE_JOIN -/* - * The source_map structure is used for mapping attributes to - * their offsets in rows. - */ -struct source_map { - attribute_t *attr; - unsigned char *from_ptr; -}; - -static struct source_map source_map[AQL_ATTRIBUTE_LIMIT]; -#endif /* DB_FEATURE_JOIN */ - -static unsigned char row[DB_MAX_ATTRIBUTES_PER_RELATION * DB_MAX_ELEMENT_SIZE]; -static unsigned char extra_row[DB_MAX_ATTRIBUTES_PER_RELATION * DB_MAX_ELEMENT_SIZE]; -static unsigned char result_row[AQL_ATTRIBUTE_LIMIT * DB_MAX_ELEMENT_SIZE]; -static unsigned char * const left_row = row; -static unsigned char * const right_row = extra_row; -static unsigned char * const join_row = result_row; - -LIST(relations); -MEMB(relations_memb, relation_t, DB_RELATION_POOL_SIZE); -MEMB(attributes_memb, attribute_t, DB_ATTRIBUTE_POOL_SIZE); - -static relation_t *relation_find(char *); -static attribute_t *attribute_find(relation_t *, char *); -static int get_attribute_value_offset(relation_t *, attribute_t *); -static void attribute_free(relation_t *, attribute_t *); -static void purge_relations(void); -static void relation_clear(relation_t *); -static relation_t *relation_allocate(void); -static void relation_free(relation_t *); - -static relation_t * -relation_find(char *name) -{ - relation_t *rel; - - for(rel = list_head(relations); rel != NULL; rel = rel->next) { - if(strcmp(rel->name, name) == 0) { - return rel; - } - } - - return NULL; -} - -static attribute_t * -attribute_find(relation_t *rel, char *name) -{ - attribute_t *attr; - - for(attr = list_head(rel->attributes); attr != NULL; attr = attr->next) { - if(strcmp(attr->name, name) == 0) { - return attr; - } - } - return NULL; -} - -static int -get_attribute_value_offset(relation_t *rel, attribute_t *attr) -{ - attribute_t *ptr; - int offset; - - for(offset = 0, ptr = list_head(rel->attributes); - ptr != NULL; - ptr = ptr->next) { - if(ptr == attr) { - return offset; - } - offset += ptr->element_size; - } - - return -1; -} - -static void -attribute_free(relation_t *rel, attribute_t *attr) -{ - if(attr->index != NULL) { - index_release(attr->index); - } - memb_free(&attributes_memb, attr); - rel->attribute_count--; -} - -static void -purge_relations(void) -{ - relation_t *rel; - relation_t *next; - - for(rel = list_head(relations); rel != NULL;) { - next = rel->next; - if(rel->references == 0) { - relation_free(rel); - } - rel = next; - } -} - -static void -relation_clear(relation_t *rel) -{ - memset(rel, 0, sizeof(*rel)); - rel->tuple_storage = -1; - rel->cardinality = INVALID_TUPLE; - rel->dir = DB_STORAGE; - LIST_STRUCT_INIT(rel, attributes); -} - -static relation_t * -relation_allocate(void) -{ - relation_t *rel; - - rel = memb_alloc(&relations_memb); - if(rel == NULL) { - purge_relations(); - rel = memb_alloc(&relations_memb); - if(rel == NULL) { - PRINTF("DB: Failed to allocate a relation\n"); - return NULL; - } - } - - relation_clear(rel); - return rel; -} - -static void -relation_free(relation_t *rel) -{ - attribute_t *attr; - - while((attr = list_pop(rel->attributes)) != NULL) { - attribute_free(rel, attr); - } - - list_remove(relations, rel); - memb_free(&relations_memb, rel); -} - -db_result_t -relation_init(void) -{ - list_init(relations); - memb_init(&relations_memb); - memb_init(&attributes_memb); - - return DB_OK; -} - -relation_t * -relation_load(char *name) -{ - relation_t *rel; - - rel = relation_find(name); - if(rel != NULL) { - rel->references++; - goto end; - } - - rel = relation_allocate(); - if(rel == NULL) { - return NULL; - } - - if(DB_ERROR(storage_get_relation(rel, name))) { - memb_free(&relations_memb, rel); - return NULL; - } - - memcpy(rel->name, name, sizeof(rel->name)); - rel->name[sizeof(rel->name) - 1] = '\0'; - rel->references = 1; - list_add(relations, rel); - -end: - if(rel->dir == DB_STORAGE && DB_ERROR(storage_load(rel))) { - relation_release(rel); - return NULL; - } - - return rel; -} - -db_result_t -relation_release(relation_t *rel) -{ - if(rel->references > 0) { - rel->references--; - } - - if(rel->references == 0) { - storage_unload(rel); - } - - return DB_OK; -} - -relation_t * -relation_create(char *name, db_direction_t dir) -{ - relation_t old_rel; - relation_t *rel; - - if(*name != '\0') { - relation_clear(&old_rel); - - if(storage_get_relation(&old_rel, name) == DB_OK) { - /* Reject a creation request if the relation already exists. */ - PRINTF("DB: Attempted to create a relation that already exists (%s)\n", - name); - return NULL; - } - - rel = relation_allocate(); - if(rel == NULL) { - return NULL; - } - - rel->cardinality = 0; - - strncpy(rel->name, name, sizeof(rel->name) - 1); - rel->name[sizeof(rel->name) - 1] = '\0'; - rel->dir = dir; - - if(dir == DB_STORAGE) { - storage_drop_relation(rel, 1); - - if(storage_put_relation(rel) == DB_OK) { - list_add(relations, rel); - return rel; - } - memb_free(&relations_memb, rel); - } else { - list_add(relations, rel); - return rel; - } - } - - return NULL; -} - -#if DB_FEATURE_REMOVE -db_result_t -relation_rename(char *old_name, char *new_name) -{ - if(DB_ERROR(relation_remove(new_name, 0)) || - DB_ERROR(storage_rename_relation(old_name, new_name))) { - return DB_STORAGE_ERROR; - } - - return DB_OK; -} -#endif /* DB_FEATURE_REMOVE */ - -attribute_t * -relation_attribute_add(relation_t *rel, db_direction_t dir, char *name, - domain_t domain, size_t element_size) -{ - attribute_t *attribute; - tuple_id_t cardinality; - - cardinality = relation_cardinality(rel); - if(cardinality != INVALID_TUPLE && cardinality > 0) { - PRINTF("DB: Attempt to create an attribute in a non-empty relation\n"); - return NULL; - } - - if(element_size == 0 || element_size > DB_MAX_ELEMENT_SIZE) { - PRINTF("DB: Unacceptable element size: %u\n", element_size); - return NULL; - } - - attribute = memb_alloc(&attributes_memb); - if(attribute == NULL) { - PRINTF("DB: Failed to allocate attribute \"%s\"!\n", name); - return NULL; - } - - strncpy(attribute->name, name, sizeof(attribute->name) - 1); - attribute->name[sizeof(attribute->name) - 1] = '\0'; - attribute->domain = domain; - attribute->element_size = element_size; - attribute->aggregator = 0; - attribute->index = NULL; - attribute->flags = 0 /*ATTRIBUTE_FLAG_UNIQUE*/; - - rel->row_length += element_size; - - list_add(rel->attributes, attribute); - rel->attribute_count++; - - if(dir == DB_STORAGE) { - if(DB_ERROR(storage_put_attribute(rel, attribute))) { - PRINTF("DB: Failed to store attribute %s\n", attribute->name); - memb_free(&attributes_memb, attribute); - return NULL; - } - } else { - index_load(rel, attribute); - } - - return attribute; -} - -attribute_t * -relation_attribute_get(relation_t *rel, char *name) -{ - attribute_t *attr; - - attr = attribute_find(rel, name); - if(attr != NULL && !(attr->flags & ATTRIBUTE_FLAG_INVALID)) { - return attr; - } - - return NULL; -} - -db_result_t -relation_attribute_remove(relation_t *rel, char *name) -{ - /* Not implemented completely. */ - return DB_IMPLEMENTATION_ERROR; -#if 0 - attribute_t *attr; - - if(rel->references > 1) { - return DB_BUSY_ERROR; - } - - attr = relation_attribute_get(rel, name); - if(attr == NULL) { - return DB_NAME_ERROR; - } - - list_remove(rel->attributes, attr); - attribute_free(rel, attr); - return DB_OK; -#endif -} - -db_result_t -relation_get_value(relation_t *rel, attribute_t *attr, - unsigned char *row_ptr, attribute_value_t *value) -{ - int offset; - unsigned char *from_ptr; - - offset = get_attribute_value_offset(rel, attr); - if(offset < 0) { - return DB_IMPLEMENTATION_ERROR; - } - from_ptr = row_ptr + offset; - - return db_phy_to_value(value, attr, from_ptr); -} - -db_result_t -relation_set_primary_key(relation_t *rel, char *name) -{ - attribute_t *attribute; - - attribute = relation_attribute_get(rel, name); - if(attribute == NULL) { - return DB_NAME_ERROR; - } - - attribute->flags = ATTRIBUTE_FLAG_PRIMARY_KEY; - PRINTF("DB: New primary key: %s\n", attribute->name); - - return DB_OK; -} - -db_result_t -relation_remove(char *name, int remove_tuples) -{ - relation_t *rel; - db_result_t result; - - rel = relation_load(name); - if(rel == NULL) { - /* - * Attempt to remove an inexistent relation. To allow for this - * operation to be used for setting up repeatable tests and - * experiments, we do not signal an error. - */ - return DB_OK; - } - - if(rel->references > 1) { - return DB_BUSY_ERROR; - } - - result = storage_drop_relation(rel, remove_tuples); - relation_free(rel); - return result; -} - -db_result_t -relation_insert(relation_t *rel, attribute_value_t *values) -{ - attribute_t *attr; - unsigned char record[rel->row_length]; - unsigned char *ptr; - attribute_value_t *value; - db_result_t result; - - value = values; - - PRINTF("DB: Relation %s has a record size of %u bytes\n", - rel->name, (unsigned)rel->row_length); - ptr = record; - - PRINTF("DB: Insert ("); - - for(attr = list_head(rel->attributes); attr != NULL; attr = attr->next, value++) { - /* Verify that the value is in the expected domain. An exception - to this rule is that INT may be promoted to LONG. */ - if(attr->domain != value->domain && - !(attr->domain == DOMAIN_LONG && value->domain == DOMAIN_INT)) { - PRINTF("DB: The value domain %d does not match the domain %d of attribute %s\n", - value->domain, attr->domain, attr->name); - return DB_RELATIONAL_ERROR; - } - - /* Set the data area for removed attributes to 0. */ - if(attr->flags & ATTRIBUTE_FLAG_INVALID) { - memset(ptr, 0, attr->element_size); - ptr += attr->element_size; - continue; - } - - result = db_value_to_phy((unsigned char *)ptr, attr, value); - if(DB_ERROR(result)) { - return result; - } - -#if DEBUG - switch(attr->domain) { - case DOMAIN_INT: - PRINTF("%s=%d", attr->name, VALUE_INT(value)); - break; - case DOMAIN_LONG: - PRINTF("%s=%ld", attr->name, VALUE_LONG(value)); - break; - case DOMAIN_STRING: - PRINTF("%s='%s", attr->name, VALUE_STRING(value)); - break; - default: - PRINTF(")\nDB: Unhandled attribute domain: %d\n", attr->domain); - return DB_TYPE_ERROR; - } - - if(attr->next != NULL) { - PRINTF(", "); - } -#endif /* DEBUG */ - - ptr += attr->element_size; - if(attr->index != NULL) { - if(DB_ERROR(index_insert(attr->index, value, rel->next_row))) { - return DB_INDEX_ERROR; - } - } - } - - PRINTF(")\n"); - - rel->cardinality++; - rel->next_row++; - return storage_put_row(rel, record); -} - -static void -aggregate(attribute_t *attr, attribute_value_t *value) -{ - long long_value; - - switch(value->domain) { - case DOMAIN_INT: - long_value = VALUE_INT(value); - break; - case DOMAIN_LONG: - long_value = VALUE_LONG(value); - break; - default: - return; - } - - switch(attr->aggregator) { - case AQL_COUNT: - attr->aggregation_value++; - break; - case AQL_SUM: - attr->aggregation_value += long_value; - break; - case AQL_MEAN: - break; - case AQL_MEDIAN: - break; - case AQL_MAX: - if(long_value > attr->aggregation_value) { - attr->aggregation_value = long_value; - } - break; - case AQL_MIN: - if(long_value < attr->aggregation_value) { - attr->aggregation_value = long_value; - } - break; - default: - break; - } -} - -static db_result_t -generate_attribute_map(struct source_dest_map *attr_map, unsigned attribute_count, - relation_t *from_rel, relation_t *to_rel, - unsigned char *from_row, unsigned char *to_row) -{ - attribute_t *from_attr; - attribute_t *to_attr; - unsigned size_sum; - struct source_dest_map *attr_map_ptr; - int offset; - - attr_map_ptr = attr_map; - for(size_sum = 0, to_attr = list_head(to_rel->attributes); - to_attr != NULL; - to_attr = to_attr->next) { - from_attr = attribute_find(from_rel, to_attr->name); - if(from_attr == NULL) { - PRINTF("DB: Invalid attribute in the result relation: %s\n", - to_attr->name); - return DB_NAME_ERROR; - } - - attr_map_ptr->from_attr = from_attr; - attr_map_ptr->to_attr = to_attr; - offset = get_attribute_value_offset(from_rel, from_attr); - if(offset < 0) { - return DB_IMPLEMENTATION_ERROR; - } - attr_map_ptr->from_offset = offset; - attr_map_ptr->to_offset = size_sum; - - size_sum += to_attr->element_size; - attr_map_ptr++; - } - - return DB_OK; -} - -static void -select_index(db_handle_t *handle, lvm_instance_t *lvm_instance) -{ - index_t *index; - attribute_t *attr; - operand_value_t min; - operand_value_t max; - attribute_value_t av_min; - attribute_value_t av_max; - long range; - unsigned long min_range; - - index = NULL; - min_range = ULONG_MAX; - - /* Find all indexed and derived attributes, and select the index of - the attribute with the smallest range. */ - for(attr = list_head(handle->rel->attributes); - attr != NULL; - attr = attr->next) { - if(attr->index != NULL && - !LVM_ERROR(lvm_get_derived_range(lvm_instance, attr->name, &min, &max))) { - range = (unsigned long)max.l - (unsigned long)min.l; - PRINTF("DB: The search range for attribute \"%s\" comprises %ld values\n", - attr->name, range + 1); - - if(range <= min_range) { - index = attr->index; - av_min.domain = av_max.domain = DOMAIN_INT; - VALUE_LONG(&av_min) = min.l; - VALUE_LONG(&av_max) = max.l; - } - } - } - - if(index != NULL) { - /* We found a suitable index; get an iterator for it. */ - if(index_get_iterator(&handle->index_iterator, index, - &av_min, &av_max) == DB_OK) { - handle->flags |= DB_HANDLE_FLAG_SEARCH_INDEX; - } - } -} - -static db_result_t -generate_selection_result(db_handle_t *handle, relation_t *rel, aql_adt_t *adt) -{ - relation_t *result_rel; - unsigned attribute_count; - attribute_t *attr; - - result_rel = handle->result_rel; - - handle->current_row = 0; - handle->ncolumns = 0; - handle->tuple_id = 0; - for(attr = list_head(result_rel->attributes); attr != NULL; attr = attr->next) { - if(attr->flags & ATTRIBUTE_FLAG_NO_STORE) { - continue; - } - handle->ncolumns++; - } - handle->tuple = (tuple_t)result_row; - - attribute_count = result_rel->attribute_count; - if(DB_ERROR(generate_attribute_map(attr_map, attribute_count, rel, result_rel, row, result_row))) { - return DB_IMPLEMENTATION_ERROR; - } - - if(adt->lvm_instance != NULL) { - /* Try to establish acceptable ranges for the attribute values. */ - if(!LVM_ERROR(lvm_derive(adt->lvm_instance))) { - select_index(handle, adt->lvm_instance); - } - } - - handle->flags |= DB_HANDLE_FLAG_PROCESSING; - - return DB_OK; -} - -#if DB_FEATURE_REMOVE -db_result_t -relation_process_remove(void *handle_ptr) -{ - db_handle_t *handle; - aql_adt_t *adt; - db_result_t result; - - handle = (db_handle_t *)handle_ptr; - adt = handle->adt; - - result = relation_process_select(handle_ptr); - if(result == DB_FINISHED) { - PRINTF("DB: Finished removing tuples. Overwriting relation %s with the result\n", - adt->relations[1]); - relation_release(handle->rel); - relation_rename(adt->relations[0], adt->relations[1]); - } - - return result; -} -#endif - -db_result_t -relation_process_select(void *handle_ptr) -{ - db_handle_t *handle; - aql_adt_t *adt; - db_result_t result; - unsigned attribute_count; - struct source_dest_map *attr_map_ptr, *attr_map_end; - attribute_t *result_attr; - unsigned char *from_ptr; - unsigned char *to_ptr; - operand_value_t operand_value; - uint8_t intbuf[2]; - attribute_value_t value; - lvm_status_t wanted_result; - - handle = (db_handle_t *)handle_ptr; - adt = (aql_adt_t *)handle->adt; - - attribute_count = handle->result_rel->attribute_count; - attr_map_end = attr_map + attribute_count; - - if(handle->flags & DB_HANDLE_FLAG_SEARCH_INDEX) { - handle->tuple_id = index_get_next(&handle->index_iterator); - if(handle->tuple_id == INVALID_TUPLE) { - PRINTF("DB: An attribute value could not be found in the index\n"); - if(handle->index_iterator.next_item_no == 0) { - return DB_INDEX_ERROR; - } - - if(adt->flags & AQL_FLAG_AGGREGATE) { - goto end_aggregation; - } - - return DB_FINISHED; - } - } - - /* Put the tuples fulfilling the given condition into a new relation. - The tuples may be projected. */ - result = storage_get_row(handle->rel, &handle->tuple_id, row); - handle->tuple_id++; - if(DB_ERROR(result)) { - PRINTF("DB: Failed to get a row in relation %s!\n", handle->rel->name); - return result; - } else if(result == DB_FINISHED) { - if(AQL_GET_FLAGS(adt) & AQL_FLAG_AGGREGATE) { - goto end_aggregation; - } - return DB_FINISHED; - } - - /* Process the attributes in the result relation. */ - for(attr_map_ptr = attr_map; attr_map_ptr < attr_map_end; attr_map_ptr++) { - from_ptr = row + attr_map_ptr->from_offset; - result_attr = attr_map_ptr->to_attr; - - /* Update the internal state of the PLE. */ - if(result_attr->domain == DOMAIN_INT) { - operand_value.l = from_ptr[0] << 8 | from_ptr[1]; - lvm_set_variable_value(result_attr->name, operand_value); - } else if(result_attr->domain == DOMAIN_LONG) { - operand_value.l = (uint32_t)from_ptr[0] << 24 | - (uint32_t)from_ptr[1] << 16 | - (uint32_t)from_ptr[2] << 8 | - from_ptr[3]; - lvm_set_variable_value(result_attr->name, operand_value); - } - - if(result_attr->flags & ATTRIBUTE_FLAG_NO_STORE) { - /* The attribute is used just for the predicate, - so do not copy the current value into the result. */ - continue; - } - - if(!(AQL_GET_FLAGS(adt) & AQL_FLAG_AGGREGATE)) { - /* No aggregators. Copy the original value into the resulting tuple. */ - memcpy(result_row + attr_map_ptr->to_offset, from_ptr, - result_attr->element_size); - } - } - - wanted_result = LVM_TRUE; - if(AQL_GET_FLAGS(adt) & AQL_FLAG_INVERSE_LOGIC) { - wanted_result = LVM_FALSE; - } - - /* Check whether the given predicate is true for this tuple. */ - if(adt->lvm_instance == NULL || - lvm_execute(adt->lvm_instance) == wanted_result) { - if(AQL_GET_FLAGS(adt) & AQL_FLAG_AGGREGATE) { - for(attr_map_ptr = attr_map; attr_map_ptr < attr_map_end; attr_map_ptr++) { - from_ptr = row + attr_map_ptr->from_offset; - result = db_phy_to_value(&value, attr_map_ptr->to_attr, from_ptr); - if(DB_ERROR(result)) { - return result; - } - aggregate(attr_map_ptr->to_attr, &value); - } - } else { - if(AQL_GET_FLAGS(adt) & AQL_FLAG_ASSIGN) { - if(DB_ERROR(storage_put_row(handle->result_rel, result_row))) { - PRINTF("DB: Failed to store a row in the result relation!\n"); - return DB_STORAGE_ERROR; - } - } - handle->current_row++; - return DB_GOT_ROW; - } - } - - return DB_OK; - -end_aggregation: - /* Generate aggregated result if requested. */ - for(attr_map_ptr = attr_map; attr_map_ptr < attr_map_end; attr_map_ptr++) { - result_attr = attr_map_ptr->to_attr; - to_ptr = result_row + attr_map_ptr->to_offset; - - intbuf[0] = result_attr->aggregation_value >> 8; - intbuf[1] = result_attr->aggregation_value & 0xff; - from_ptr = intbuf; - memcpy(to_ptr, from_ptr, result_attr->element_size); - } - - if(AQL_GET_FLAGS(adt) & AQL_FLAG_ASSIGN) { - if(DB_ERROR(storage_put_row(handle->result_rel, result_row))) { - PRINTF("DB: Failed to store a row in the result relation!\n"); - return DB_STORAGE_ERROR; - } - } - - handle->current_row = 1; - AQL_GET_FLAGS(adt) &= ~AQL_FLAG_AGGREGATE; /* Stop the aggregation. */ - - return DB_GOT_ROW; -} - -db_result_t -relation_select(void *handle_ptr, relation_t *rel, void *adt_ptr) -{ - aql_adt_t *adt; - db_handle_t *handle; - char *name; - db_direction_t dir; - char *attribute_name; - attribute_t *attr; - int i; - int normal_attributes; - - adt = (aql_adt_t *)adt_ptr; - - handle = (db_handle_t *)handle_ptr; - handle->rel = rel; - handle->adt = adt; - - if(AQL_GET_FLAGS(adt) & AQL_FLAG_ASSIGN) { - name = adt->relations[0]; - dir = DB_STORAGE; - } else { - name = RESULT_RELATION; - dir = DB_MEMORY; - } - relation_remove(name, 1); - relation_create(name, dir); - handle->result_rel = relation_load(name); - - if(handle->result_rel == NULL) { - PRINTF("DB: Failed to load a relation for the query result\n"); - return DB_ALLOCATION_ERROR; - } - - for(i = normal_attributes = 0; i < AQL_ATTRIBUTE_COUNT(adt); i++) { - attribute_name = adt->attributes[i].name; - - attr = relation_attribute_get(rel, attribute_name); - if(attr == NULL) { - PRINTF("DB: Select for invalid attribute %s in relation %s!\n", - attribute_name, rel->name); - return DB_NAME_ERROR; - } - - PRINTF("DB: Found attribute %s in relation %s\n", - attribute_name, rel->name); - - attr = relation_attribute_add(handle->result_rel, dir, - attribute_name, - adt->aggregators[i] ? DOMAIN_INT : attr->domain, - attr->element_size); - if(attr == NULL) { - PRINTF("DB: Failed to add a result attribute\n"); - relation_release(handle->result_rel); - return DB_ALLOCATION_ERROR; - } - - attr->aggregator = adt->aggregators[i]; - switch(attr->aggregator) { - case AQL_NONE: - if(!(adt->attributes[i].flags & ATTRIBUTE_FLAG_NO_STORE)) { - /* Only count attributes projected into the result set. */ - normal_attributes++; - } - break; - case AQL_MAX: - attr->aggregation_value = LONG_MIN; - break; - case AQL_MIN: - attr->aggregation_value = LONG_MAX; - break; - default: - attr->aggregation_value = 0; - break; - } - - attr->flags = adt->attributes[i].flags; - } - - /* Preclude mixes of normal attributes and aggregated ones in - selection results. */ - if(normal_attributes > 0 && - handle->result_rel->attribute_count > normal_attributes) { - return DB_RELATIONAL_ERROR; - } - - return generate_selection_result(handle, rel, adt); -} - -#if DB_FEATURE_JOIN -db_result_t -relation_process_join(void *handle_ptr) -{ - db_handle_t *handle; - db_result_t result; - relation_t *left_rel; - relation_t *right_rel; - relation_t *join_rel; - unsigned char *join_next_attribute_ptr; - size_t element_size; - tuple_id_t right_tuple_id; - attribute_value_t value; - int i; - - handle = (db_handle_t *)handle_ptr; - left_rel = handle->left_rel; - right_rel = handle->right_rel; - join_rel = handle->join_rel; - - if(!(handle->flags & DB_HANDLE_FLAG_INDEX_STEP)) { - goto inner_loop; - } - - /* Equi-join for indexed attributes only. In the outer loop, we iterate over - each tuple in the left relation. */ - for(handle->tuple_id = 0;; handle->tuple_id++) { - result = storage_get_row(left_rel, &handle->tuple_id, left_row); - if(DB_ERROR(result)) { - PRINTF("DB: Failed to get a row in left relation %s!\n", left_rel->name); - return result; - } else if(result == DB_FINISHED) { - return DB_FINISHED; - } - - if(DB_ERROR(relation_get_value(left_rel, handle->left_join_attr, left_row, &value))) { - PRINTF("DB: Failed to get a value of the attribute \"%s\" to join on\n", - handle->left_join_attr->name); - return DB_IMPLEMENTATION_ERROR; - } - - if(DB_ERROR(index_get_iterator(&handle->index_iterator, - handle->right_join_attr->index, - &value, &value))) { - PRINTF("DB: Failed to get an index iterator\n"); - return DB_INDEX_ERROR; - } - handle->flags &= ~DB_HANDLE_FLAG_INDEX_STEP; - - /* In the inner loop, we iterate over all rows with a matching value for the - join attribute. The index component provides an iterator for this purpose. */ -inner_loop: - for(;;) { - /* Get all rows matching the attribute value in the right relation. */ - right_tuple_id = index_get_next(&handle->index_iterator); - if(right_tuple_id == INVALID_TUPLE) { - /* Exclude this row from the left relation in the result, - and step to the next value in the index iteration. */ - handle->flags |= DB_HANDLE_FLAG_INDEX_STEP; - break; - } - - result = storage_get_row(right_rel, &right_tuple_id, right_row); - if(DB_ERROR(result)) { - PRINTF("DB: Failed to get a row in right relation %s!\n", right_rel->name); - return result; - } else if(result == DB_FINISHED) { - PRINTF("DB: The index refers to an invalid row: %lu\n", - (unsigned long)right_tuple_id); - return DB_IMPLEMENTATION_ERROR; - } - - /* Use the source attribute map to fill in the physical representation - of the resulting tuple. */ - join_next_attribute_ptr = join_row; - - for(i = 0; i < join_rel->attribute_count; i++) { - element_size = source_map[i].attr->element_size; - - memcpy(join_next_attribute_ptr, source_map[i].from_ptr, element_size); - join_next_attribute_ptr += element_size; - } - - if(((aql_adt_t *)handle->adt)->flags & AQL_FLAG_ASSIGN) { - if(DB_ERROR(storage_put_row(join_rel, join_row))) { - return DB_STORAGE_ERROR; - } - } - - handle->current_row++; - return DB_GOT_ROW; - } - } - - return DB_OK; -} - -static db_result_t -generate_join_result(db_handle_t *handle) -{ - relation_t *left_rel; - relation_t *right_rel; - relation_t *join_rel; - attribute_t *attr; - attribute_t *result_attr; - struct source_map *source_pair; - int i; - int offset; - unsigned char *from_ptr; - - handle->tuple = (tuple_t)join_row; - handle->tuple_id = 0; - - left_rel = handle->left_rel; - right_rel = handle->right_rel; - join_rel = handle->join_rel; - - /* Generate a map over the source attributes for each - attribute in the join relation. */ - for(i = 0, result_attr = list_head(join_rel->attributes); - result_attr != NULL; - result_attr = result_attr->next, i++) { - source_pair = &source_map[i]; - attr = attribute_find(left_rel, result_attr->name); - if(attr != NULL) { - offset = get_attribute_value_offset(left_rel, attr); - from_ptr = left_row + offset; - } else if((attr = attribute_find(right_rel, result_attr->name)) != NULL) { - offset = get_attribute_value_offset(right_rel, attr); - from_ptr = right_row + offset; - } else { - PRINTF("DB: The attribute %s could not be found\n", result_attr->name); - return DB_NAME_ERROR; - } - - if(offset < 0) { - PRINTF("DB: Unable to retrieve attribute values for the JOIN result\n"); - return DB_IMPLEMENTATION_ERROR; - } - - source_pair->attr = attr; - source_pair->from_ptr = from_ptr; - } - - handle->flags |= DB_HANDLE_FLAG_PROCESSING; - - return DB_OK; -} - -db_result_t -relation_join(void *query_result, void *adt_ptr) -{ - aql_adt_t *adt; - db_handle_t *handle; - relation_t *left_rel; - relation_t *right_rel; - relation_t *join_rel; - char *name; - db_direction_t dir; - int i; - char *attribute_name; - attribute_t *attr; - - adt = (aql_adt_t *)adt_ptr; - - handle = (db_handle_t *)query_result; - handle->current_row = 0; - handle->ncolumns = 0; - handle->adt = adt; - handle->flags = DB_HANDLE_FLAG_INDEX_STEP; - - if(AQL_GET_FLAGS(adt) & AQL_FLAG_ASSIGN) { - name = adt->relations[0]; - dir = DB_STORAGE; - } else { - name = RESULT_RELATION; - dir = DB_MEMORY; - } - relation_remove(name, 1); - relation_create(name, dir); - join_rel = relation_load(name); - handle->result_rel = join_rel; - - if(join_rel == NULL) { - PRINTF("DB: Failed to create a join relation!\n"); - return DB_ALLOCATION_ERROR; - } - - handle->join_rel = handle->result_rel = join_rel; - left_rel = handle->left_rel; - right_rel = handle->right_rel; - - handle->left_join_attr = relation_attribute_get(left_rel, adt->attributes[0].name); - handle->right_join_attr = relation_attribute_get(right_rel, adt->attributes[0].name); - if(handle->left_join_attr == NULL || handle->right_join_attr == NULL) { - PRINTF("DB: The attribute (\"%s\") to join on does not exist in both relations\n", - adt->attributes[0].name); - return DB_RELATIONAL_ERROR; - } - - if(!index_exists(handle->right_join_attr)) { - PRINTF("DB: The attribute to join on is not indexed\n"); - return DB_INDEX_ERROR; - } - - /* - * Define the resulting relation. We start from 1 when counting attributes - * because the first attribute is only the one to join, and is not included - * by default in the projected attributes. - */ - for(i = 1; i < AQL_ATTRIBUTE_COUNT(adt); i++) { - attribute_name = adt->attributes[i].name; - attr = relation_attribute_get(left_rel, attribute_name); - if(attr == NULL) { - attr = relation_attribute_get(right_rel, attribute_name); - if(attr == NULL) { - PRINTF("DB: The projection attribute \"%s\" does not exist in any of the relations to join\n", - attribute_name); - return DB_RELATIONAL_ERROR; - } - } - - if(relation_attribute_add(join_rel, dir, attr->name, attr->domain, - attr->element_size) == NULL) { - PRINTF("DB: Failed to add an attribute to the join relation\n"); - return DB_ALLOCATION_ERROR; - } - - handle->ncolumns++; - } - - return generate_join_result(handle); -} -#endif /* DB_FEATURE_JOIN */ - -tuple_id_t -relation_cardinality(relation_t *rel) -{ - tuple_id_t tuple_id; - - - if(rel->cardinality != INVALID_TUPLE) { - return rel->cardinality; - } - - if(!RELATION_HAS_TUPLES(rel)) { - return 0; - } - - if(DB_ERROR(storage_get_row_amount(rel, &tuple_id))) { - return INVALID_TUPLE; - } - - rel->cardinality = tuple_id; - - PRINTF("DB: Relation %s has cardinality %lu\n", rel->name, - (unsigned long)tuple_id); - - return tuple_id; -} diff --git a/os/storage/antelope/relation.h b/os/storage/antelope/relation.h deleted file mode 100644 index a881e6e07..000000000 --- a/os/storage/antelope/relation.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * . - * \author - * Nicolas Tsiftes - */ - -#ifndef RELATION_H -#define RELATION_H - -#include -#include - -#include "lib/list.h" - -#include "attribute.h" -#include "db-options.h" -#include "db-types.h" - -typedef uint32_t tuple_id_t; -#define INVALID_TUPLE (tuple_id_t)-1 - -typedef enum db_direction { - DB_MEMORY = 0, - DB_STORAGE = 1 -} db_direction_t; - -#define RELATION_HAS_TUPLES(rel) ((rel)->tuple_storage >= 0) - -/* - * A relation consists of a name, a set of domains, a set of indexes, - * and a set of keys. Each relation must have a primary key. - */ -struct relation { - struct relation *next; - LIST_STRUCT(attributes); - attribute_t *primary_key; - size_t row_length; - attribute_id_t attribute_count; - tuple_id_t cardinality; - tuple_id_t next_row; - db_storage_id_t tuple_storage; - db_direction_t dir; - uint8_t references; - char name[RELATION_NAME_LENGTH + 1]; - char tuple_filename[RELATION_NAME_LENGTH + 1]; -}; - -typedef struct relation relation_t; - -/* API for relations. */ -db_result_t relation_init(void); -db_result_t relation_process_remove(void *); -db_result_t relation_process_select(void *); -db_result_t relation_process_join(void *); -relation_t *relation_load(char *); -db_result_t relation_release(relation_t *); -relation_t *relation_create(char *, db_direction_t); -db_result_t relation_rename(char *, char *); -attribute_t *relation_attribute_add(relation_t *, db_direction_t, char *, - domain_t, size_t); -attribute_t *relation_attribute_get(relation_t *, char *); -db_result_t relation_get_value(relation_t *, attribute_t *, - unsigned char *, attribute_value_t *); -db_result_t relation_attribute_remove(relation_t *, char *); -db_result_t relation_set_primary_key(relation_t *, char *); -db_result_t relation_remove(char *, int); -db_result_t relation_insert(relation_t *, attribute_value_t *); -db_result_t relation_select(void *, relation_t *, void *); -db_result_t relation_join(void *, void *); -tuple_id_t relation_cardinality(relation_t *); - -#endif /* RELATION_H */ diff --git a/os/storage/antelope/result.c b/os/storage/antelope/result.c deleted file mode 100644 index 68c998ea6..000000000 --- a/os/storage/antelope/result.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Result acquisition interface for AQL queries. - * \author - * Nicolas Tsiftes - */ - -#include - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -#include "result.h" -#include "storage.h" - -/* db_get_value: Retrieve the value of the specified attribute in - the current tuple. */ -db_result_t -db_get_value(attribute_value_t *value, db_handle_t *handle, unsigned col) -{ - attribute_t *attr; - unsigned char *buf; - - if(col >= handle->ncolumns) { - PRINTF("DB: Requested value (%d) is out of bounds; max = (%d)\n", - col, handle->ncolumns); - return DB_LIMIT_ERROR; - } - - buf = handle->tuple; - - for(attr = list_head(handle->result_rel->attributes); attr != NULL; attr = attr->next) { - if(attr->flags & ATTRIBUTE_FLAG_NO_STORE) { - /* This attribute was used for processing only. */ - continue; - } - PRINTF("Found attribute %s in the result. The element size is %d\n", - attr->name, attr->element_size); - if(col == 0) { - break; - } - --col; - buf += attr->element_size; - } - - if(attr == NULL) { - return DB_NAME_ERROR; - } - - return db_phy_to_value(value, attr, buf); -} - -/* db_phy_to_value: Convert a value from the physical storage - representation to the internal RAM representation. */ -db_result_t -db_phy_to_value(attribute_value_t *value, attribute_t *attr, - unsigned char *ptr) -{ - int int_value; - long long_value; - - value->domain = attr->domain; - - switch(attr->domain) { - case DOMAIN_STRING: - ptr[attr->element_size - 1] = '\0'; - VALUE_STRING(value) = ptr; - PRINTF("DB: %s = %s\n", attr->name, ptr); - break; - case DOMAIN_INT: - int_value = (ptr[0] << 8) | ((unsigned)ptr[1] & 0xff); - VALUE_INT(value) = int_value; - PRINTF("DB: %s = %d\n", attr->name, int_value); - break; - case DOMAIN_LONG: - long_value = (long)ptr[0] << 24 | (long)ptr[1] << 16 | - (long)ptr[2] << 8 | (long)ptr[3]; - VALUE_LONG(value) = long_value; - PRINTF("DB: %s = %ld\n", attr->name, long_value); - break; - default: - return DB_TYPE_ERROR; - } - - return DB_OK; -} - -/* db_value_to_phy: Convert a value from the internal RAM representation - to the physical storage representation. */ -db_result_t -db_value_to_phy(unsigned char *ptr, attribute_t *attr, - attribute_value_t *value) -{ - int int_value; - long long_value; - - switch(attr->domain) { - case DOMAIN_STRING: - memcpy(ptr, VALUE_STRING(value), attr->element_size); - ptr[attr->element_size - 1] = '\0'; - break; - case DOMAIN_INT: - int_value = VALUE_INT(value); - ptr[0] = int_value >> 8; - ptr[1] = int_value & 0xff; - break; - case DOMAIN_LONG: - long_value = VALUE_LONG(value); - ptr[0] = long_value >> 24; - ptr[1] = long_value >> 16; - ptr[2] = long_value >> 8; - ptr[3] = long_value & 0xff; - break; - default: - return DB_TYPE_ERROR; - } - - return DB_OK; -} - -/* db_value_to_long: Convert an attribute value - to a value of the C long type. */ -long -db_value_to_long(attribute_value_t *value) -{ - switch(value->domain) { - case DOMAIN_INT: - return (long)VALUE_INT(value); - case DOMAIN_LONG: - return (long)VALUE_LONG(value); - default: - return 0; - } -} - -/* db_free: Free all the resources that are referenced in a DB handle. */ -db_result_t -db_free(db_handle_t *handle) -{ - if(handle->rel != NULL) { - relation_release(handle->rel); - } - if(handle->result_rel != NULL) { - relation_release(handle->result_rel); - } - if(handle->left_rel != NULL) { - relation_release(handle->left_rel); - } - if(handle->right_rel != NULL) { - relation_release(handle->right_rel); - } - - handle->flags = 0; - - return DB_OK; -} diff --git a/os/storage/antelope/result.h b/os/storage/antelope/result.h deleted file mode 100644 index 0788b77f6..000000000 --- a/os/storage/antelope/result.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Declarations for the result acquisition API. - * \author - * Nicolas Tsiftes - */ - -#ifndef RESULT_H -#define RESULT_H - -#include "index.h" -#include "relation.h" -#include "storage.h" - -#define RESULT_TUPLE_INVALID(tuple) ((tuple) == NULL) -#define RESULT_TUPLE_SIZE(handle) (handle).rel->row_length - -typedef unsigned char *tuple_t; - -#define DB_HANDLE_FLAG_INDEX_STEP 0x01 -#define DB_HANDLE_FLAG_SEARCH_INDEX 0x02 -#define DB_HANDLE_FLAG_PROCESSING 0x04 - -struct db_handle { - index_iterator_t index_iterator; - tuple_id_t tuple_id; - tuple_id_t current_row; - relation_t *rel; - relation_t *left_rel; - relation_t *join_rel; - relation_t *right_rel; - relation_t *result_rel; - attribute_t *left_join_attr; - attribute_t *right_join_attr; - tuple_t tuple; - uint8_t flags; - uint8_t ncolumns; - void *adt; -}; -typedef struct db_handle db_handle_t; - -db_result_t db_get_value(attribute_value_t *value, - db_handle_t *handle, unsigned col); -db_result_t db_phy_to_value(attribute_value_t *value, - attribute_t *attr, unsigned char *ptr); -db_result_t db_value_to_phy(unsigned char *ptr, - attribute_t *attr, attribute_value_t *value); -long db_value_to_long(attribute_value_t *value); -db_result_t db_free(db_handle_t *handle); - -#endif /* !RESULT_H */ diff --git a/os/storage/antelope/storage-cfs.c b/os/storage/antelope/storage-cfs.c deleted file mode 100644 index f14cb95e5..000000000 --- a/os/storage/antelope/storage-cfs.c +++ /dev/null @@ -1,583 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Contiki File System (CFS) backend for the storage abstraction - * used by the database. - * \author - * Nicolas Tsiftes - */ - -#include -#include - -#include "cfs/cfs.h" -#include "cfs/cfs-coffee.h" -#include "lib/random.h" - -#define DEBUG DEBUG_NONE -#include "net/ipv6/uip-debug.h" - -#include "db-options.h" -#include "storage.h" - -struct attribute_record { - char name[ATTRIBUTE_NAME_LENGTH]; - uint8_t domain; - uint8_t element_size; -}; - -struct index_record { - char attribute_name[ATTRIBUTE_NAME_LENGTH]; - char file_name[DB_MAX_FILENAME_LENGTH]; - uint8_t type; -}; - -#if DB_FEATURE_COFFEE -#define DB_COFFEE_CATALOG_SIZE RELATION_NAME_LENGTH + \ - (DB_MAX_ATTRIBUTES_PER_RELATION * \ - sizeof(struct attribute_record)) -#endif - -#define ROW_XOR 0xf6U - -static void -merge_strings(char *dest, char *prefix, char *suffix) -{ - strcpy(dest, prefix); - strcat(dest, suffix); -} - -char * -storage_generate_file(char *prefix, unsigned long size) -{ - static char filename[ATTRIBUTE_NAME_LENGTH + sizeof(".ffff")]; -#if !DB_FEATURE_COFFEE - int fd; -#endif - - snprintf(filename, sizeof(filename), "%s.%x", prefix, - (unsigned)(random_rand() & 0xffff)); - -#if DB_FEATURE_COFFEE - PRINTF("DB: Reserving %lu bytes in %s\n", size, filename); - if(cfs_coffee_reserve(filename, size) < 0) { - PRINTF("DB: Failed to reserve\n"); - return NULL; - } - return filename; -#else - fd = cfs_open(filename, CFS_WRITE); - cfs_close(fd); - return fd < 0 ? NULL : filename; -#endif /* DB_FEATURE_COFFEE */ -} - -db_result_t -storage_load(relation_t *rel) -{ - PRINTF("DB: Opening the tuple file %s\n", rel->tuple_filename); - rel->tuple_storage = cfs_open(rel->tuple_filename, - CFS_READ | CFS_WRITE | CFS_APPEND); - if(rel->tuple_storage < 0) { - PRINTF("DB: Failed to open the tuple file\n"); - return DB_STORAGE_ERROR; - } - - return DB_OK; -} - -void -storage_unload(relation_t *rel) -{ - if(RELATION_HAS_TUPLES(rel)) { - PRINTF("DB: Unload tuple file %s\n", rel->tuple_filename); - - cfs_close(rel->tuple_storage); - rel->tuple_storage = -1; - } -} - -db_result_t -storage_get_relation(relation_t *rel, char *name) -{ - int fd; - int r; - int i; - struct attribute_record record; - db_result_t result; - - fd = cfs_open(name, CFS_READ); - if(fd < 0) { - return DB_STORAGE_ERROR; - } - - r = cfs_read(fd, rel->name, sizeof(rel->name)); - if(r != sizeof(rel->name)) { - cfs_close(fd); - PRINTF("DB: Failed to read name, got %d of %d bytes\n", - r, sizeof(rel->name)); - return DB_STORAGE_ERROR; - } - - r = cfs_read(fd, rel->tuple_filename, sizeof(rel->tuple_filename)); - if(r != sizeof(rel->name)) { - cfs_close(fd); - PRINTF("DB: Failed to read tuple filename\n"); - return DB_STORAGE_ERROR; - } - - rel->tuple_filename[sizeof(rel->tuple_filename) - 1] ^= ROW_XOR; - - /* Read attribute records. */ - result = DB_OK; - for(i = 0;; i++) { - r = cfs_read(fd, &record, sizeof(record)); - if(r == 0) { - break; - } - if(r != sizeof(record)) { - PRINTF("DB: Failed to read attribute record %d (r = %d)\n", i, r); - result = DB_STORAGE_ERROR; - break; - } - - if(relation_attribute_add(rel, DB_MEMORY, record.name, - record.domain, record.element_size) == NULL) { - PRINTF("DB: Failed to add the attribute %s\n", record.name); - result = DB_STORAGE_ERROR; - break; - } - } - - PRINTF("DB: Read %d attributes\n", i); - - cfs_close(fd); - return result; -} - -db_result_t -storage_put_relation(relation_t *rel) -{ - int fd; - int r; - char *str; - unsigned char *last_byte; - - PRINTF("DB: put_relation(%s)\n", rel->name); - - cfs_remove(rel->name); - -#if DB_FEATURE_COFFEE - cfs_coffee_reserve(rel->name, DB_COFFEE_CATALOG_SIZE); -#endif - - fd = cfs_open(rel->name, CFS_WRITE | CFS_READ); - if(fd < 0) { - return DB_STORAGE_ERROR; - } - - r = cfs_write(fd, rel->name, sizeof(rel->name)); - if(r != sizeof(rel->name)) { - cfs_close(fd); - cfs_remove(rel->name); - return DB_STORAGE_ERROR; - } - - if(rel->tuple_filename[0] == '\0') { - str = storage_generate_file("tuple", DB_COFFEE_RESERVE_SIZE); - if(str == NULL) { - cfs_close(fd); - cfs_remove(rel->name); - return DB_STORAGE_ERROR; - } - - strncpy(rel->tuple_filename, str, sizeof(rel->tuple_filename) - 1); - rel->tuple_filename[sizeof(rel->tuple_filename) - 1] = '\0'; - } - - /* - * Encode the last byte to ensure that the filename is not - * null-terminated. This will make the Coffee FS determine - * the correct length when re-opening the file. - */ - last_byte = (unsigned char *)&rel->tuple_filename[sizeof(rel->tuple_filename) - 1]; - *last_byte ^= ROW_XOR; - - r = cfs_write(fd, rel->tuple_filename, sizeof(rel->tuple_filename)); - - *last_byte ^= ROW_XOR; - - if(r != sizeof(rel->tuple_filename)) { - cfs_close(fd); - cfs_remove(rel->tuple_filename); - return DB_STORAGE_ERROR; - } - - PRINTF("DB: Saved relation %s\n", rel->name); - - cfs_close(fd); - return DB_OK; -} - -db_result_t -storage_put_attribute(relation_t *rel, attribute_t *attr) -{ - int fd; - struct attribute_record record; - int r; - - PRINTF("DB: put_attribute(%s, %s)\n", rel->name, attr->name); - - fd = cfs_open(rel->name, CFS_WRITE | CFS_APPEND); - if(fd < 0) { - return DB_STORAGE_ERROR; - } - - memset(&record.name, 0, sizeof(record.name)); - memcpy(record.name, attr->name, sizeof(record.name)); - record.domain = attr->domain; - record.element_size = attr->element_size; - r = cfs_write(fd, &record, sizeof(record)); - if(r != sizeof(record)) { - cfs_close(fd); - cfs_remove(rel->name); - return DB_STORAGE_ERROR; - } - - cfs_close(fd); - return DB_OK; -} - -db_result_t -storage_drop_relation(relation_t *rel, int remove_tuples) -{ - if(remove_tuples && RELATION_HAS_TUPLES(rel)) { - cfs_remove(rel->tuple_filename); - } - return cfs_remove(rel->name) < 0 ? DB_STORAGE_ERROR : DB_OK; -} - -#if DB_FEATURE_REMOVE -db_result_t -storage_rename_relation(char *old_name, char *new_name) -{ - db_result_t result; - int old_fd; - int new_fd; - int r; - char buf[64]; - - result = DB_STORAGE_ERROR; - old_fd = new_fd = -1; - - old_fd = cfs_open(old_name, CFS_READ); - new_fd = cfs_open(new_name, CFS_WRITE); - if(old_fd < 0 || new_fd < 0) { - goto error; - } - - for(;;) { - r = cfs_read(old_fd, buf, sizeof(buf)); - if(r < 0) { - goto error; - } else if(r == 0) { - break; - } - if(cfs_write(new_fd, buf, r) != r) { - goto error; - } - }; - - cfs_remove(old_name); - result = DB_OK; - -error: - cfs_close(old_fd); - cfs_close(new_fd); - - if(result != DB_OK) { - cfs_remove(new_name); - } - return result; -} -#endif /* DB_FEATURE_REMOVE */ - -db_result_t -storage_get_index(index_t *index, relation_t *rel, attribute_t *attr) -{ - char filename[INDEX_NAME_LENGTH]; - int fd; - int r; - struct index_record record; - db_result_t result; - - merge_strings(filename, rel->name, INDEX_NAME_SUFFIX); - - fd = cfs_open(filename, CFS_READ); - if(fd < 0) { - return DB_STORAGE_ERROR; - } - - for(result = DB_STORAGE_ERROR;;) { - r = cfs_read(fd, &record, sizeof(record)); - if(r < sizeof(record)) { - break; - } - if(strcmp(attr->name, record.attribute_name) == 0) { - PRINTF("DB: Found the index record for %s.%s: type %d, filename %s\n", - rel->name, attr->name, record.type, record.file_name); - index->type = record.type; - memcpy(index->descriptor_file, record.file_name, - sizeof(index->descriptor_file)); - result = DB_OK; - } - } - - cfs_close(fd); - - return result; -} - -db_result_t -storage_put_index(index_t *index) -{ - char filename[INDEX_NAME_LENGTH]; - int fd; - int r; - struct index_record record; - db_result_t result; - - merge_strings(filename, index->rel->name, INDEX_NAME_SUFFIX); - - fd = cfs_open(filename, CFS_WRITE | CFS_APPEND); - if(fd < 0) { - return DB_STORAGE_ERROR; - } - - strcpy(record.attribute_name, index->attr->name); - memcpy(record.file_name, index->descriptor_file, sizeof(record.file_name)); - record.type = index->type; - - result = DB_OK; - r = cfs_write(fd, &record, sizeof(record)); - if(r < sizeof(record)) { - result = DB_STORAGE_ERROR; - } else { - PRINTF("DB: Wrote an index record for %s.%s, type %d\n", - index->rel->name, index->attr->name, record.type); - } - - cfs_close(fd); - - return result; -} - -db_result_t -storage_get_row(relation_t *rel, tuple_id_t *tuple_id, storage_row_t row) -{ - int r; - tuple_id_t nrows; - - if(DB_ERROR(storage_get_row_amount(rel, &nrows))) { - return DB_STORAGE_ERROR; - } - - if(*tuple_id >= nrows) { - return DB_FINISHED; - } - - if(cfs_seek(rel->tuple_storage, *tuple_id * rel->row_length, CFS_SEEK_SET) == - (cfs_offset_t)-1) { - return DB_STORAGE_ERROR; - } - - r = cfs_read(rel->tuple_storage, row, rel->row_length); - if(r < 0) { - PRINTF("DB: Reading failed on fd %d\n", rel->tuple_storage); - return DB_STORAGE_ERROR; - } else if(r == 0) { - return DB_FINISHED; - } else if(r < rel->row_length) { - PRINTF("DB: Incomplete record: %d < %d\n", r, rel->row_length); - return DB_STORAGE_ERROR; - } - - row[rel->row_length - 1] ^= ROW_XOR; - - PRINTF("DB: Read %d bytes from relation %s\n", rel->row_length, rel->name); - - return DB_OK; -} - -db_result_t -storage_put_row(relation_t *rel, storage_row_t row) -{ - cfs_offset_t end; - unsigned remaining; - int r; - unsigned char *last_byte; -#if DB_FEATURE_INTEGRITY - int missing_bytes; - char buf[rel->row_length]; -#endif - - end = cfs_seek(rel->tuple_storage, 0, CFS_SEEK_END); - if(end == (cfs_offset_t)-1) { - return DB_STORAGE_ERROR; - } - -#if DB_FEATURE_INTEGRITY - missing_bytes = end % rel->row_length; - if(missing_bytes > 0) { - memset(buf, 0xff, sizeof(buf)); - r = cfs_write(rel->tuple_storage, buf, sizeof(buf)); - if(r != missing_bytes) { - return DB_STORAGE_ERROR; - } - } -#endif - - /* Ensure that last written byte is separated from 0, to make file - lengths correct in Coffee. */ - last_byte = row + rel->row_length - 1; - *last_byte ^= ROW_XOR; - - remaining = rel->row_length; - do { - r = cfs_write(rel->tuple_storage, row, remaining); - if(r < 0) { - PRINTF("DB: Failed to store %u bytes\n", remaining); - *last_byte ^= ROW_XOR; - return DB_STORAGE_ERROR; - } - row += r; - remaining -= r; - } while(remaining > 0); - - PRINTF("DB: Stored a of %d bytes\n", rel->row_length); - - *last_byte ^= ROW_XOR; - - return DB_OK; -} - -db_result_t -storage_get_row_amount(relation_t *rel, tuple_id_t *amount) -{ - cfs_offset_t offset; - - if(rel->row_length == 0) { - *amount = 0; - } else { - offset = cfs_seek(rel->tuple_storage, 0, CFS_SEEK_END); - if(offset == (cfs_offset_t)-1) { - return DB_STORAGE_ERROR; - } - - *amount = (tuple_id_t)(offset / rel->row_length); - } - - return DB_OK; -} - -db_storage_id_t -storage_open(const char *filename) -{ - int fd; - - fd = cfs_open(filename, CFS_WRITE | CFS_READ); -#if DB_FEATURE_COFFEE - if(fd >= 0) { - cfs_coffee_set_io_semantics(fd, CFS_COFFEE_IO_FLASH_AWARE); - } -#endif - return fd; -} - -void -storage_close(db_storage_id_t fd) -{ - cfs_close(fd); -} - -db_result_t -storage_read(db_storage_id_t fd, - void *buffer, unsigned long offset, unsigned length) -{ - char *ptr; - int r; - - /* Extend the file if necessary, so that previously unwritten bytes - will be read in as zeroes. */ - if(cfs_seek(fd, offset + length, CFS_SEEK_SET) == (cfs_offset_t)-1) { - return DB_STORAGE_ERROR; - } - - if(cfs_seek(fd, offset, CFS_SEEK_SET) == (cfs_offset_t)-1) { - return DB_STORAGE_ERROR; - } - - ptr = buffer; - while(length > 0) { - r = cfs_read(fd, ptr, length); - if(r <= 0) { - return DB_STORAGE_ERROR; - } - ptr += r; - length -= r; - } - - return DB_OK; -} - -db_result_t -storage_write(db_storage_id_t fd, - void *buffer, unsigned long offset, unsigned length) -{ - char *ptr; - int r; - - if(cfs_seek(fd, offset, CFS_SEEK_SET) == (cfs_offset_t)-1) { - return DB_STORAGE_ERROR; - } - - ptr = buffer; - while(length > 0) { - r = cfs_write(fd, ptr, length); - if(r <= 0) { - return DB_STORAGE_ERROR; - } - ptr += r; - length -= r; - } - - return DB_OK; -} diff --git a/os/storage/antelope/storage.h b/os/storage/antelope/storage.h deleted file mode 100644 index b40496c8e..000000000 --- a/os/storage/antelope/storage.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * The storage interface used by the database. - * \author - * Nicolas Tsiftes - */ - -#ifndef STORAGE_H -#define STORAGE_H - -#include "index.h" -#include "relation.h" - -#define TABLE_NAME_SUFFIX ".row" -#define TABLE_NAME_LENGTH (RELATION_NAME_LENGTH + \ - sizeof(TABLE_NAME_SUFFIX) - 1) - -#define INDEX_NAME_SUFFIX ".idx" -#define INDEX_NAME_LENGTH (RELATION_NAME_LENGTH + \ - sizeof(INDEX_NAME_SUFFIX) - 1) - -typedef unsigned char * storage_row_t; - -char *storage_generate_file(char *, unsigned long); - -db_result_t storage_load(relation_t *); -void storage_unload(relation_t *); - -db_result_t storage_get_relation(relation_t *, char *); -db_result_t storage_put_relation(relation_t *); -db_result_t storage_drop_relation(relation_t *, int); -db_result_t storage_rename_relation(char *, char *); - -db_result_t storage_put_attribute(relation_t *, attribute_t *); -db_result_t storage_get_index(index_t *, relation_t *, attribute_t *); -db_result_t storage_put_index(index_t *); - -db_result_t storage_get_row(relation_t *, tuple_id_t *, storage_row_t); -db_result_t storage_put_row(relation_t *, storage_row_t); -db_result_t storage_get_row_amount(relation_t *, tuple_id_t *); - -db_storage_id_t storage_open(const char *); -void storage_close(db_storage_id_t); -db_result_t storage_read(db_storage_id_t, void *, unsigned long, unsigned); -db_result_t storage_write(db_storage_id_t, void *, unsigned long, unsigned); - -#endif /* STORAGE_H */ diff --git a/os/storage/cfs/cfs-coffee.c b/os/storage/cfs/cfs-coffee.c deleted file mode 100644 index 53c7eca53..000000000 --- a/os/storage/cfs/cfs-coffee.c +++ /dev/null @@ -1,1346 +0,0 @@ -/* - * Copyright (c) 2008, 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Coffee: A file system for a variety of storage types in - * memory-constrained devices. - * - * For further information, see "Enabling Large-Scale Storage in - * Sensor Networks with the Coffee File System" in the proceedings - * of ACM/IEEE IPSN 2009. - * - * \author - * Nicolas Tsiftes - */ - -#include -#include - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#include "contiki.h" -#include "cfs/cfs.h" -#include "cfs-coffee-arch.h" -#include "cfs/cfs-coffee.h" - -/* Micro logs enable modifications on storage types that do not support - in-place updates. This applies primarily to flash memories. */ -#ifndef COFFEE_MICRO_LOGS -#define COFFEE_MICRO_LOGS 1 -#endif - -/* If the files are expected to be appended to only, this parameter - can be set to save some code space. */ -#ifndef COFFEE_APPEND_ONLY -#define COFFEE_APPEND_ONLY 0 -#endif - -#if COFFEE_MICRO_LOGS && COFFEE_APPEND_ONLY -#error "Cannot have COFFEE_APPEND_ONLY set when COFFEE_MICRO_LOGS is set." -#endif - -/* - * Prevent sectors from being erased directly after file removal. - * This will level the wear across sectors better, but may lead - * to longer garbage collection procedures. - */ -#ifndef COFFEE_EXTENDED_WEAR_LEVELLING -#define COFFEE_EXTENDED_WEAR_LEVELLING 1 -#endif - -#if COFFEE_START & (COFFEE_SECTOR_SIZE - 1) -#error COFFEE_START must point to the first byte in a sector. -#endif - -/* File descriptor flags. */ -#define COFFEE_FD_FREE 0x0 -#define COFFEE_FD_READ 0x1 -#define COFFEE_FD_WRITE 0x2 -#define COFFEE_FD_APPEND 0x4 - -/* File object flags. */ -#define COFFEE_FILE_MODIFIED 0x1 - -/* Internal Coffee markers. */ -#define INVALID_PAGE ((coffee_page_t)-1) -#define UNKNOWN_OFFSET ((cfs_offset_t)-1) - -/* File removal actions. They can have the same values because - they are passed as separate parameters. */ -#define REMOVE_LOG 1 -#define CLOSE_FDS 1 -#define ALLOW_GC 1 - -/* "Greedy" garbage collection erases as many sectors as possible. */ -#define GC_GREEDY 0 -/* "Reluctant" garbage collection stops after erasing one sector. */ -#define GC_RELUCTANT 1 - -/* File descriptor macros. */ -#define FD_VALID(fd) ((fd) >= 0 && (fd) < COFFEE_FD_SET_SIZE && \ - coffee_fd_set[(fd)].flags != COFFEE_FD_FREE) -#define FD_READABLE(fd) (coffee_fd_set[(fd)].flags & CFS_READ) -#define FD_WRITABLE(fd) (coffee_fd_set[(fd)].flags & CFS_WRITE) -#define FD_APPENDABLE(fd) (coffee_fd_set[(fd)].flags & CFS_APPEND) - -/* File object macros. */ -#define FILE_MODIFIED(file) ((file)->flags & COFFEE_FILE_MODIFIED) -#define FILE_FREE(file) ((file)->max_pages == 0) -#define FILE_UNREFERENCED(file) ((file)->references == 0) - -/* File header flags. */ -#define HDR_FLAG_VALID 0x01 /* Completely written header. */ -#define HDR_FLAG_ALLOCATED 0x02 /* Allocated file. */ -#define HDR_FLAG_OBSOLETE 0x04 /* File marked for GC. */ -#define HDR_FLAG_MODIFIED 0x08 /* Modified file, log exists. */ -#define HDR_FLAG_LOG 0x10 /* Log file. */ -#define HDR_FLAG_ISOLATED 0x20 /* Isolated page. */ - -/* File header macros. */ -#define CHECK_FLAG(hdr, flag) ((hdr).flags & (flag)) -#define HDR_VALID(hdr) CHECK_FLAG(hdr, HDR_FLAG_VALID) -#define HDR_ALLOCATED(hdr) CHECK_FLAG(hdr, HDR_FLAG_ALLOCATED) -#define HDR_FREE(hdr) !HDR_ALLOCATED(hdr) -#define HDR_LOG(hdr) CHECK_FLAG(hdr, HDR_FLAG_LOG) -#define HDR_MODIFIED(hdr) CHECK_FLAG(hdr, HDR_FLAG_MODIFIED) -#define HDR_ISOLATED(hdr) CHECK_FLAG(hdr, HDR_FLAG_ISOLATED) -#define HDR_OBSOLETE(hdr) CHECK_FLAG(hdr, HDR_FLAG_OBSOLETE) -#define HDR_ACTIVE(hdr) (HDR_ALLOCATED(hdr) && \ - !HDR_OBSOLETE(hdr) && \ - !HDR_ISOLATED(hdr)) - -/* Shortcuts derived from the hardware-dependent configuration of Coffee. */ -#define COFFEE_SECTOR_COUNT \ - (coffee_page_t)(COFFEE_SIZE / COFFEE_SECTOR_SIZE) -#define COFFEE_PAGE_COUNT \ - ((coffee_page_t)(COFFEE_SIZE / COFFEE_PAGE_SIZE)) -#define COFFEE_PAGES_PER_SECTOR \ - ((coffee_page_t)(COFFEE_SECTOR_SIZE / COFFEE_PAGE_SIZE)) - -/* This structure is used for garbage collection statistics. */ -struct sector_status { - coffee_page_t active; - coffee_page_t obsolete; - coffee_page_t free; -}; - -/* The structure of cached file objects. */ -struct file { - cfs_offset_t end; - coffee_page_t page; - coffee_page_t max_pages; - int16_t record_count; - uint8_t references; - uint8_t flags; -}; - -/* The file descriptor structure. */ -struct file_desc { - cfs_offset_t offset; - struct file *file; - uint8_t flags; - uint8_t io_flags; -}; - -/* The file header structure mimics the representation of file headers - in the physical storage medium. */ -struct file_header { - coffee_page_t log_page; - uint16_t log_records; - uint16_t log_record_size; - coffee_page_t max_pages; - uint8_t deprecated_eof_hint; - uint8_t flags; - char name[COFFEE_NAME_LENGTH]; -}; - -/* This is needed because of a buggy compiler. */ -struct log_param { - cfs_offset_t offset; - char *buf; - uint16_t size; -}; - -/* - * Variables that keep track of opened files and internal - * optimization information for Coffee. - */ -static struct file coffee_files[COFFEE_MAX_OPEN_FILES]; -static struct file_desc coffee_fd_set[COFFEE_FD_SET_SIZE]; -static coffee_page_t next_free; -static char gc_wait; - -/*---------------------------------------------------------------------------*/ -static void -write_header(struct file_header *hdr, coffee_page_t page) -{ - hdr->flags |= HDR_FLAG_VALID; - COFFEE_WRITE(hdr, sizeof(*hdr), page * COFFEE_PAGE_SIZE); -} -/*---------------------------------------------------------------------------*/ -static void -read_header(struct file_header *hdr, coffee_page_t page) -{ - COFFEE_READ(hdr, sizeof(*hdr), page * COFFEE_PAGE_SIZE); - if(DEBUG && HDR_ACTIVE(*hdr) && !HDR_VALID(*hdr)) { - PRINTF("Coffee: Invalid header at page %u!\n", (unsigned)page); - } -} -/*---------------------------------------------------------------------------*/ -static cfs_offset_t -absolute_offset(coffee_page_t page, cfs_offset_t offset) -{ - return page * COFFEE_PAGE_SIZE + sizeof(struct file_header) + offset; -} -/*---------------------------------------------------------------------------*/ -static coffee_page_t -get_sector_status(coffee_page_t sector, struct sector_status *stats) -{ - static coffee_page_t skip_pages; - static char last_pages_are_active; - struct file_header hdr; - coffee_page_t active, obsolete, free; - coffee_page_t sector_start, sector_end; - coffee_page_t page; - - memset(stats, 0, sizeof(*stats)); - active = obsolete = free = 0; - - /* - * get_sector_status() is an iterative function using local static - * state. It therefore requires that the caller starts iterating from - * sector 0 in order to reset the internal state. - */ - if(sector == 0) { - skip_pages = 0; - last_pages_are_active = 0; - } - - sector_start = sector * COFFEE_PAGES_PER_SECTOR; - sector_end = sector_start + COFFEE_PAGES_PER_SECTOR; - - /* - * Account for pages belonging to a file starting in a previous - * segment that extends into this segment. If the whole segment is - * covered, we do not need to continue counting pages in this iteration. - */ - if(last_pages_are_active) { - if(skip_pages >= COFFEE_PAGES_PER_SECTOR) { - stats->active = COFFEE_PAGES_PER_SECTOR; - skip_pages -= COFFEE_PAGES_PER_SECTOR; - return 0; - } - active = skip_pages; - } else { - if(skip_pages >= COFFEE_PAGES_PER_SECTOR) { - stats->obsolete = COFFEE_PAGES_PER_SECTOR; - skip_pages -= COFFEE_PAGES_PER_SECTOR; - return skip_pages >= COFFEE_PAGES_PER_SECTOR ? 0 : skip_pages; - } - obsolete = skip_pages; - } - - /* Determine the amount of pages of each type that have not been - accounted for yet in the current sector. */ - for(page = sector_start + skip_pages; page < sector_end;) { - read_header(&hdr, page); - last_pages_are_active = 0; - if(HDR_ACTIVE(hdr)) { - last_pages_are_active = 1; - page += hdr.max_pages; - active += hdr.max_pages; - } else if(HDR_ISOLATED(hdr)) { - page++; - obsolete++; - } else if(HDR_OBSOLETE(hdr)) { - page += hdr.max_pages; - obsolete += hdr.max_pages; - } else { - free = sector_end - page; - break; - } - } - - /* - * Determine the amount of pages in the following sectors that - * should be remembered for the next iteration. This is necessary - * because no file page except the first contains information - * about what type of page it is. A side effect of remembering this - * amount is that there is no need to read in the headers of each - * of these pages from the storage. - */ - skip_pages = active + obsolete + free - COFFEE_PAGES_PER_SECTOR; - if(skip_pages > 0) { - if(last_pages_are_active) { - active = COFFEE_PAGES_PER_SECTOR - obsolete; - } else { - obsolete = COFFEE_PAGES_PER_SECTOR - active; - } - } - - stats->active = active; - stats->obsolete = obsolete; - stats->free = free; - - /* - * To avoid unnecessary page isolation, we notify the caller that - * "skip_pages" pages should be isolated only if the current file extent - * ends in the next sector. If the file extent ends in a more distant - * sector, however, the garbage collection can free the next sector - * immediately without requiring page isolation. - */ - return (last_pages_are_active || (skip_pages >= COFFEE_PAGES_PER_SECTOR)) ? - 0 : skip_pages; -} -/*---------------------------------------------------------------------------*/ -static void -isolate_pages(coffee_page_t start, coffee_page_t skip_pages) -{ - struct file_header hdr; - coffee_page_t page; - - /* Split an obsolete file starting in the previous sector and mark - the following pages as isolated. */ - memset(&hdr, 0, sizeof(hdr)); - hdr.flags = HDR_FLAG_ALLOCATED | HDR_FLAG_ISOLATED; - - /* Isolation starts from the next sector. */ - for(page = 0; page < skip_pages; page++) { - write_header(&hdr, start + page); - } - PRINTF("Coffee: Isolated %u pages starting in sector %d\n", - (unsigned)skip_pages, (int)start / COFFEE_PAGES_PER_SECTOR); -} -/*---------------------------------------------------------------------------*/ -static void -collect_garbage(int mode) -{ - coffee_page_t sector; - struct sector_status stats; - coffee_page_t first_page, isolation_count; - - PRINTF("Coffee: Running the garbage collector in %s mode\n", - mode == GC_RELUCTANT ? "reluctant" : "greedy"); - /* - * The garbage collector erases as many sectors as possible. A sector is - * erasable if there are only free or obsolete pages in it. - */ - for(sector = 0; sector < COFFEE_SECTOR_COUNT; sector++) { - isolation_count = get_sector_status(sector, &stats); - PRINTF("Coffee: Sector %u has %u active, %u obsolete, and %u free pages.\n", - (unsigned)sector, (unsigned)stats.active, - (unsigned)stats.obsolete, (unsigned)stats.free); - - if(stats.active > 0) { - continue; - } - - if((mode == GC_RELUCTANT && stats.free == 0) || - (mode == GC_GREEDY && stats.obsolete > 0)) { - first_page = sector * COFFEE_PAGES_PER_SECTOR; - if(first_page < next_free) { - next_free = first_page; - } - - if(isolation_count > 0) { - isolate_pages(first_page + COFFEE_PAGES_PER_SECTOR, isolation_count); - } - - COFFEE_ERASE(sector); - PRINTF("Coffee: Erased sector %d!\n", sector); - - if(mode == GC_RELUCTANT && isolation_count > 0) { - break; - } - } - } -} -/*---------------------------------------------------------------------------*/ -static coffee_page_t -next_file(coffee_page_t page, struct file_header *hdr) -{ - /* - * The quick-skip algorithm for finding file extents is the most - * essential part of Coffee. The file allocation rules enable this - * algorithm to quickly jump over free areas and allocated extents - * after reading single headers and determining their status. - * - * The worst-case performance occurs when we encounter multiple long - * sequences of isolated pages, but such sequences are uncommon and - * always shorter than a sector. - */ - if(HDR_FREE(*hdr)) { - return (page + COFFEE_PAGES_PER_SECTOR) & ~(COFFEE_PAGES_PER_SECTOR - 1); - } else if(HDR_ISOLATED(*hdr)) { - return page + 1; - } - return page + hdr->max_pages; -} -/*---------------------------------------------------------------------------*/ -static struct file * -load_file(coffee_page_t start, struct file_header *hdr) -{ - int i, unreferenced, free; - struct file *file; - - /* - * We prefer to overwrite a free slot since unreferenced ones - * contain usable data. Free slots are designated by the page - * value INVALID_PAGE. - */ - for(i = 0, unreferenced = free = -1; i < COFFEE_MAX_OPEN_FILES; i++) { - if(FILE_FREE(&coffee_files[i])) { - free = i; - break; - } else if(FILE_UNREFERENCED(&coffee_files[i])) { - unreferenced = i; - } - } - - if(free == -1) { - if(unreferenced != -1) { - i = unreferenced; - } else { - return NULL; - } - } - - file = &coffee_files[i]; - file->page = start; - file->end = UNKNOWN_OFFSET; - file->max_pages = hdr->max_pages; - file->flags = HDR_MODIFIED(*hdr) ? COFFEE_FILE_MODIFIED : 0; - /* We don't know the amount of records yet. */ - file->record_count = -1; - - return file; -} -/*---------------------------------------------------------------------------*/ -static struct file * -find_file(const char *name) -{ - int i; - struct file_header hdr; - coffee_page_t page; - - /* First check if the file metadata is cached. */ - for(i = 0; i < COFFEE_MAX_OPEN_FILES; i++) { - if(FILE_FREE(&coffee_files[i])) { - continue; - } - - read_header(&hdr, coffee_files[i].page); - if(HDR_ACTIVE(hdr) && !HDR_LOG(hdr) && strcmp(name, hdr.name) == 0) { - return &coffee_files[i]; - } - } - - /* Scan the flash memory sequentially otherwise. */ - for(page = 0; page < COFFEE_PAGE_COUNT; page = next_file(page, &hdr)) { - read_header(&hdr, page); - if(HDR_ACTIVE(hdr) && !HDR_LOG(hdr) && strcmp(name, hdr.name) == 0) { - return load_file(page, &hdr); - } - } - - return NULL; -} -/*---------------------------------------------------------------------------*/ -static cfs_offset_t -file_end(coffee_page_t start) -{ - struct file_header hdr; - unsigned char buf[COFFEE_PAGE_SIZE]; - coffee_page_t page; - int i; - - read_header(&hdr, start); - - /* - * Move from the end of the range towards the beginning and look for - * a byte that has been modified. - * - * An important implication of this is that if the last written bytes - * are zeroes, then these are skipped from the calculation. - */ - - for(page = hdr.max_pages - 1; page >= 0; page--) { - COFFEE_READ(buf, sizeof(buf), (start + page) * COFFEE_PAGE_SIZE); - for(i = COFFEE_PAGE_SIZE - 1; i >= 0; i--) { - if(buf[i] != 0) { - if(page == 0 && i < sizeof(hdr)) { - return 0; - } - return 1 + i + (page * COFFEE_PAGE_SIZE) - sizeof(hdr); - } - } - } - - /* All bytes are writable. */ - return 0; -} -/*---------------------------------------------------------------------------*/ -static coffee_page_t -find_contiguous_pages(coffee_page_t amount) -{ - coffee_page_t page, start; - struct file_header hdr; - - start = INVALID_PAGE; - for(page = next_free; page < COFFEE_PAGE_COUNT;) { - read_header(&hdr, page); - if(HDR_FREE(hdr)) { - if(start == INVALID_PAGE) { - start = page; - if(start + amount >= COFFEE_PAGE_COUNT) { - /* We can stop immediately if the remaining pages are not enough. */ - break; - } - } - - /* All remaining pages in this sector are free -- - jump to the next sector. */ - page = next_file(page, &hdr); - - if(start + amount <= page) { - if(start == next_free) { - next_free = start + amount; - } - return start; - } - } else { - start = INVALID_PAGE; - page = next_file(page, &hdr); - } - } - return INVALID_PAGE; -} -/*---------------------------------------------------------------------------*/ -static int -remove_by_page(coffee_page_t page, int remove_log, - int close_fds, int gc_allowed) -{ - struct file_header hdr; - int i; - - read_header(&hdr, page); - if(!HDR_ACTIVE(hdr)) { - return -1; - } - - if(remove_log && HDR_MODIFIED(hdr)) { - if(remove_by_page(hdr.log_page, !REMOVE_LOG, !CLOSE_FDS, !ALLOW_GC) < 0) { - return -1; - } - } - - hdr.flags |= HDR_FLAG_OBSOLETE; - write_header(&hdr, page); - - gc_wait = 0; - - /* Close all file descriptors that reference the removed file. */ - if(close_fds) { - for(i = 0; i < COFFEE_FD_SET_SIZE; i++) { - if(coffee_fd_set[i].file != NULL && coffee_fd_set[i].file->page == page) { - coffee_fd_set[i].flags = COFFEE_FD_FREE; - } - } - } - - for(i = 0; i < COFFEE_MAX_OPEN_FILES; i++) { - if(coffee_files[i].page == page) { - coffee_files[i].page = INVALID_PAGE; - coffee_files[i].references = 0; - coffee_files[i].max_pages = 0; - } - } - - if(!COFFEE_EXTENDED_WEAR_LEVELLING && gc_allowed) { - collect_garbage(GC_RELUCTANT); - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -static coffee_page_t -page_count(cfs_offset_t size) -{ - return (size + sizeof(struct file_header) + COFFEE_PAGE_SIZE - 1) / - COFFEE_PAGE_SIZE; -} -/*---------------------------------------------------------------------------*/ -static struct file * -reserve(const char *name, coffee_page_t pages, - int allow_duplicates, unsigned flags) -{ - struct file_header hdr; - coffee_page_t page; - struct file *file; - - if(!allow_duplicates && find_file(name) != NULL) { - return NULL; - } - - page = find_contiguous_pages(pages); - if(page == INVALID_PAGE) { - if(gc_wait) { - return NULL; - } - collect_garbage(GC_GREEDY); - page = find_contiguous_pages(pages); - if(page == INVALID_PAGE) { - gc_wait = 1; - return NULL; - } - } - - memset(&hdr, 0, sizeof(hdr)); - strncpy(hdr.name, name, sizeof(hdr.name) - 1); - hdr.max_pages = pages; - hdr.flags = HDR_FLAG_ALLOCATED | flags; - write_header(&hdr, page); - - PRINTF("Coffee: Reserved %u pages starting from %u for file %s\n", - (unsigned)pages, (unsigned)page, name); - - file = load_file(page, &hdr); - if(file != NULL) { - file->end = 0; - } - - return file; -} -/*---------------------------------------------------------------------------*/ -#if COFFEE_MICRO_LOGS -static void -adjust_log_config(struct file_header *hdr, - uint16_t *log_record_size, uint16_t *log_records) -{ - *log_record_size = hdr->log_record_size == 0 ? - COFFEE_PAGE_SIZE : hdr->log_record_size; - *log_records = hdr->log_records == 0 ? - COFFEE_LOG_SIZE / *log_record_size : hdr->log_records; -} -#endif /* COFFEE_MICRO_LOGS */ -/*---------------------------------------------------------------------------*/ -#if COFFEE_MICRO_LOGS -static uint16_t -modify_log_buffer(uint16_t log_record_size, - cfs_offset_t *offset, uint16_t *size) -{ - uint16_t region; - - region = *offset / log_record_size; - *offset %= log_record_size; - - if(*size > log_record_size - *offset) { - *size = log_record_size - *offset; - } - - return region; -} -#endif /* COFFEE_MICRO_LOGS */ -/*---------------------------------------------------------------------------*/ -#if COFFEE_MICRO_LOGS -static int -get_record_index(coffee_page_t log_page, uint16_t search_records, - uint16_t region) -{ - cfs_offset_t base; - uint16_t processed; - uint16_t batch_size; - int16_t match_index, i; - - base = absolute_offset(log_page, sizeof(uint16_t) * search_records); - batch_size = search_records > COFFEE_LOG_TABLE_LIMIT ? - COFFEE_LOG_TABLE_LIMIT : search_records; - processed = 0; - match_index = -1; - - { - uint16_t indices[batch_size]; - - while(processed < search_records && match_index < 0) { - if(batch_size + processed > search_records) { - batch_size = search_records - processed; - } - - base -= batch_size * sizeof(indices[0]); - COFFEE_READ(&indices, sizeof(indices[0]) * batch_size, base); - - for(i = batch_size - 1; i >= 0; i--) { - if(indices[i] - 1 == region) { - match_index = search_records - processed - (batch_size - i); - break; - } - } - - processed += batch_size; - } - } - - return match_index; -} -#endif /* COFFEE_MICRO_LOGS */ -/*---------------------------------------------------------------------------*/ -#if COFFEE_MICRO_LOGS -static int -read_log_page(struct file_header *hdr, int16_t record_count, - struct log_param *lp) -{ - uint16_t region; - int16_t match_index; - uint16_t log_record_size; - uint16_t log_records; - cfs_offset_t base; - uint16_t search_records; - - adjust_log_config(hdr, &log_record_size, &log_records); - region = modify_log_buffer(log_record_size, &lp->offset, &lp->size); - - search_records = record_count < 0 ? log_records : record_count; - match_index = get_record_index(hdr->log_page, search_records, region); - if(match_index < 0) { - return -1; - } - - base = absolute_offset(hdr->log_page, log_records * sizeof(region)); - base += (cfs_offset_t)match_index * log_record_size; - base += lp->offset; - COFFEE_READ(lp->buf, lp->size, base); - - return lp->size; -} -#endif /* COFFEE_MICRO_LOGS */ -/*---------------------------------------------------------------------------*/ -#if COFFEE_MICRO_LOGS -static coffee_page_t -create_log(struct file *file, struct file_header *hdr) -{ - uint16_t log_record_size, log_records; - cfs_offset_t size; - struct file *log_file; - - adjust_log_config(hdr, &log_record_size, &log_records); - - /* Log index size + log data size. */ - size = log_records * (sizeof(uint16_t) + log_record_size); - - log_file = reserve(hdr->name, page_count(size), 1, HDR_FLAG_LOG); - if(log_file == NULL) { - return INVALID_PAGE; - } - - hdr->flags |= HDR_FLAG_MODIFIED; - hdr->log_page = log_file->page; - write_header(hdr, file->page); - - file->flags |= COFFEE_FILE_MODIFIED; - return log_file->page; -} -#endif /* COFFEE_MICRO_LOGS */ -/*---------------------------------------------------------------------------*/ -static int -merge_log(coffee_page_t file_page, int extend) -{ - struct file_header hdr, hdr2; - int fd, n; - cfs_offset_t offset; - coffee_page_t max_pages; - struct file *new_file; - int i; - - read_header(&hdr, file_page); - - fd = cfs_open(hdr.name, CFS_READ); - if(fd < 0) { - return -1; - } - - /* - * The reservation function adds extra space for the header, which has - * already been accounted for in the previous reservation. - */ - max_pages = hdr.max_pages << extend; - new_file = reserve(hdr.name, max_pages, 1, 0); - if(new_file == NULL) { - cfs_close(fd); - return -1; - } - - offset = 0; - do { - char buf[hdr.log_record_size == 0 ? COFFEE_PAGE_SIZE : hdr.log_record_size]; - n = cfs_read(fd, buf, sizeof(buf)); - if(n < 0) { - remove_by_page(new_file->page, !REMOVE_LOG, !CLOSE_FDS, ALLOW_GC); - cfs_close(fd); - return -1; - } else if(n > 0) { - COFFEE_WRITE(buf, n, absolute_offset(new_file->page, offset)); - offset += n; - } - } while(n != 0); - - for(i = 0; i < COFFEE_FD_SET_SIZE; i++) { - if(coffee_fd_set[i].flags != COFFEE_FD_FREE && - coffee_fd_set[i].file->page == file_page) { - coffee_fd_set[i].file = new_file; - new_file->references++; - } - } - - if(remove_by_page(file_page, REMOVE_LOG, !CLOSE_FDS, !ALLOW_GC) < 0) { - remove_by_page(new_file->page, !REMOVE_LOG, !CLOSE_FDS, !ALLOW_GC); - cfs_close(fd); - return -1; - } - - /* Copy the log configuration. */ - read_header(&hdr2, new_file->page); - hdr2.log_record_size = hdr.log_record_size; - hdr2.log_records = hdr.log_records; - write_header(&hdr2, new_file->page); - - new_file->flags &= ~COFFEE_FILE_MODIFIED; - new_file->end = offset; - - cfs_close(fd); - - return 0; -} -/*---------------------------------------------------------------------------*/ -#if COFFEE_MICRO_LOGS -static int -find_next_record(struct file *file, coffee_page_t log_page, - int log_records) -{ - int log_record, preferred_batch_size; - - if(file->record_count >= 0) { - return file->record_count; - } - - preferred_batch_size = log_records > COFFEE_LOG_TABLE_LIMIT ? - COFFEE_LOG_TABLE_LIMIT : log_records; - { - /* The next log record is unknown at this point; search for it. */ - uint16_t indices[preferred_batch_size]; - uint16_t processed; - uint16_t batch_size; - - log_record = log_records; - for(processed = 0; processed < log_records; processed += batch_size) { - batch_size = log_records - processed >= preferred_batch_size ? - preferred_batch_size : log_records - processed; - - COFFEE_READ(&indices, batch_size * sizeof(indices[0]), - absolute_offset(log_page, processed * sizeof(indices[0]))); - for(log_record = 0; log_record < batch_size; log_record++) { - if(indices[log_record] == 0) { - log_record += processed; - break; - } - } - } - } - - return log_record; -} -#endif /* COFFEE_MICRO_LOGS */ -/*---------------------------------------------------------------------------*/ -#if COFFEE_MICRO_LOGS -static int -write_log_page(struct file *file, struct log_param *lp) -{ - struct file_header hdr; - uint16_t region; - coffee_page_t log_page; - int16_t log_record; - uint16_t log_record_size; - uint16_t log_records; - cfs_offset_t offset; - struct log_param lp_out; - - read_header(&hdr, file->page); - - adjust_log_config(&hdr, &log_record_size, &log_records); - region = modify_log_buffer(log_record_size, &lp->offset, &lp->size); - - log_page = 0; - if(HDR_MODIFIED(hdr)) { - /* A log structure has already been created. */ - log_page = hdr.log_page; - log_record = find_next_record(file, log_page, log_records); - if(log_record >= log_records) { - /* The log is full; merge the log. */ - PRINTF("Coffee: Merging the file %s with its log\n", hdr.name); - return merge_log(file->page, 0); - } - } else { - /* Create a log structure. */ - log_page = create_log(file, &hdr); - if(log_page == INVALID_PAGE) { - return -1; - } - PRINTF("Coffee: Created a log structure for file %s at page %u\n", - hdr.name, (unsigned)log_page); - hdr.log_page = log_page; - log_record = 0; - } - - { - char copy_buf[log_record_size]; - - lp_out.offset = offset = region * log_record_size; - lp_out.buf = copy_buf; - lp_out.size = log_record_size; - - if((lp->offset > 0 || lp->size != log_record_size) && - read_log_page(&hdr, log_record, &lp_out) < 0) { - COFFEE_READ(copy_buf, sizeof(copy_buf), - absolute_offset(file->page, offset)); - } - - memcpy(©_buf[lp->offset], lp->buf, lp->size); - - /* - * Write the region number in the region index table. - * The region number is incremented to avoid values of zero. - */ - offset = absolute_offset(log_page, 0); - ++region; - COFFEE_WRITE(®ion, sizeof(region), - offset + log_record * sizeof(region)); - - offset += log_records * sizeof(region); - COFFEE_WRITE(copy_buf, sizeof(copy_buf), - offset + log_record * log_record_size); - file->record_count = log_record + 1; - } - - return lp->size; -} -#endif /* COFFEE_MICRO_LOGS */ -/*---------------------------------------------------------------------------*/ -static int -get_available_fd(void) -{ - int i; - - for(i = 0; i < COFFEE_FD_SET_SIZE; i++) { - if(coffee_fd_set[i].flags == COFFEE_FD_FREE) { - return i; - } - } - return -1; -} -/*---------------------------------------------------------------------------*/ -int -cfs_open(const char *name, int flags) -{ - int fd; - struct file_desc *fdp; - - fd = get_available_fd(); - if(fd < 0) { - PRINTF("Coffee: Failed to allocate a new file descriptor!\n"); - return -1; - } - - fdp = &coffee_fd_set[fd]; - fdp->flags = 0; - fdp->io_flags = 0; - - fdp->file = find_file(name); - if(fdp->file == NULL) { - if((flags & (CFS_READ | CFS_WRITE)) == CFS_READ) { - return -1; - } - fdp->file = reserve(name, page_count(COFFEE_DYN_SIZE), 1, 0); - if(fdp->file == NULL) { - return -1; - } - fdp->file->end = 0; - } else if(fdp->file->end == UNKNOWN_OFFSET) { - fdp->file->end = file_end(fdp->file->page); - } - - fdp->flags |= flags; - fdp->offset = flags & CFS_APPEND ? fdp->file->end : 0; - fdp->file->references++; - - return fd; -} -/*---------------------------------------------------------------------------*/ -void -cfs_close(int fd) -{ - if(FD_VALID(fd)) { - coffee_fd_set[fd].flags = COFFEE_FD_FREE; - coffee_fd_set[fd].file->references--; - coffee_fd_set[fd].file = NULL; - } -} -/*---------------------------------------------------------------------------*/ -cfs_offset_t -cfs_seek(int fd, cfs_offset_t offset, int whence) -{ - struct file_desc *fdp; - cfs_offset_t new_offset; - - if(!FD_VALID(fd)) { - return -1; - } - fdp = &coffee_fd_set[fd]; - - if(whence == CFS_SEEK_SET) { - new_offset = offset; - } else if(whence == CFS_SEEK_END) { - new_offset = fdp->file->end + offset; - } else if(whence == CFS_SEEK_CUR) { - new_offset = fdp->offset + offset; - } else { - return (cfs_offset_t)-1; - } - - if(new_offset < 0 || new_offset > fdp->file->max_pages * COFFEE_PAGE_SIZE) { - return -1; - } - - if(fdp->file->end < new_offset) { - if(FD_WRITABLE(fd)) { - fdp->file->end = new_offset; - } else { - /* Disallow seeking past the end of the file for read only FDs */ - return (cfs_offset_t)-1; - } - } - - return fdp->offset = new_offset; -} -/*---------------------------------------------------------------------------*/ -int -cfs_remove(const char *name) -{ - struct file *file; - - /* - * Coffee removes files by marking them as obsolete. The space - * is not guaranteed to be reclaimed immediately, but must be - * sweeped by the garbage collector. The garbage collector is - * called once a file reservation request cannot be granted. - */ - file = find_file(name); - if(file == NULL) { - return -1; - } - - return remove_by_page(file->page, REMOVE_LOG, CLOSE_FDS, ALLOW_GC); -} -/*---------------------------------------------------------------------------*/ -int -cfs_read(int fd, void *buf, unsigned size) -{ - struct file_desc *fdp; - struct file *file; -#if COFFEE_MICRO_LOGS - struct file_header hdr; - struct log_param lp; - unsigned bytes_left; - int r; -#endif - - if(!(FD_VALID(fd) && FD_READABLE(fd))) { - return -1; - } - - fdp = &coffee_fd_set[fd]; - file = fdp->file; - - if(fdp->io_flags & CFS_COFFEE_IO_ENSURE_READ_LENGTH) { - while(fdp->offset + size > file->end) { - ((char *)buf)[--size] = '\0'; - } - } else if(fdp->offset + size > file->end) { - size = file->end - fdp->offset; - } - - /* If the file is not modified, read directly from the file extent. */ - if(!FILE_MODIFIED(file)) { - COFFEE_READ(buf, size, absolute_offset(file->page, fdp->offset)); - fdp->offset += size; - return size; - } - -#if COFFEE_MICRO_LOGS - read_header(&hdr, file->page); - - /* - * Copy the contents of the most recent log record. If there is - * no log record for the file area to read from, we simply read - * from the original file extent. - */ - for(bytes_left = size; bytes_left > 0; bytes_left -= r) { - lp.offset = fdp->offset; - lp.buf = buf; - lp.size = bytes_left; - r = read_log_page(&hdr, file->record_count, &lp); - - /* Read from the original file if we cannot find the data in the log. */ - if(r < 0) { - COFFEE_READ(buf, lp.size, absolute_offset(file->page, fdp->offset)); - r = lp.size; - } - fdp->offset += r; - buf = (char *)buf + r; - } -#endif /* COFFEE_MICRO_LOGS */ - - return size; -} -/*---------------------------------------------------------------------------*/ -int -cfs_write(int fd, const void *buf, unsigned size) -{ - struct file_desc *fdp; - struct file *file; -#if COFFEE_MICRO_LOGS - int i; - struct log_param lp; - cfs_offset_t bytes_left; - int8_t need_dummy_write; - const char dummy[1] = { 0xff }; -#endif - - if(!(FD_VALID(fd) && FD_WRITABLE(fd))) { - return -1; - } - - fdp = &coffee_fd_set[fd]; - file = fdp->file; - - /* Attempt to extend the file if we try to write past the end. */ - if(!(fdp->io_flags & CFS_COFFEE_IO_FIRM_SIZE)) { - while(size + fdp->offset + sizeof(struct file_header) > - (file->max_pages * COFFEE_PAGE_SIZE)) { - if(merge_log(file->page, 1) < 0) { - return -1; - } - file = fdp->file; - PRINTF("Extended the file at page %u\n", (unsigned)file->page); - } - } - -#if COFFEE_MICRO_LOGS - if(!(fdp->io_flags & CFS_COFFEE_IO_FLASH_AWARE) && - (FILE_MODIFIED(file) || fdp->offset < file->end)) { - need_dummy_write = 0; - for(bytes_left = size; bytes_left > 0;) { - lp.offset = fdp->offset; - lp.buf = (void *)buf; - lp.size = bytes_left; - i = write_log_page(file, &lp); - if(i < 0) { - /* Return -1 if we wrote nothing because the log write failed. */ - if(size == bytes_left) { - return -1; - } - break; - } else if(i == 0) { - /* The file was merged with the log. */ - file = fdp->file; - } else { - /* A log record was written. */ - bytes_left -= i; - fdp->offset += i; - buf = (char *)buf + i; - - /* Update the file end for a potential log merge that might - occur while writing log records. */ - if(fdp->offset > file->end) { - file->end = fdp->offset; - need_dummy_write = 1; - } - } - } - - if(need_dummy_write) { - /* - * A log record has been written at an offset beyond the original - * extent's end. Consequently, we need to write a dummy value at the - * corresponding end offset in the original extent to ensure that - * the correct file size is calculated when opening the file again. - */ - COFFEE_WRITE(dummy, 1, absolute_offset(file->page, fdp->offset - 1)); - } - } else { -#endif /* COFFEE_MICRO_LOGS */ - if(COFFEE_APPEND_ONLY && fdp->offset < file->end) { - return -1; - } - - COFFEE_WRITE(buf, size, absolute_offset(file->page, fdp->offset)); - fdp->offset += size; -#if COFFEE_MICRO_LOGS - } -#endif /* COFFEE_MICRO_LOGS */ - - if(fdp->offset > file->end) { - file->end = fdp->offset; - } - - return size; -} -/*---------------------------------------------------------------------------*/ -int -cfs_opendir(struct cfs_dir *dir, const char *name) -{ - /* - * Coffee is only guaranteed to support the directory names "/" and ".", - * but it does not enforce this currently. - */ - memset(dir->state, 0, sizeof(coffee_page_t)); - return 0; -} -/*---------------------------------------------------------------------------*/ -int -cfs_readdir(struct cfs_dir *dir, struct cfs_dirent *record) -{ - struct file_header hdr; - coffee_page_t page; - coffee_page_t next_page; - - memcpy(&page, dir->state, sizeof(coffee_page_t)); - - while(page < COFFEE_PAGE_COUNT) { - read_header(&hdr, page); - if(HDR_ACTIVE(hdr) && !HDR_LOG(hdr)) { - memcpy(record->name, hdr.name, sizeof(record->name)); - record->name[sizeof(record->name) - 1] = '\0'; - record->size = file_end(page); - - next_page = next_file(page, &hdr); - memcpy(dir->state, &next_page, sizeof(coffee_page_t)); - return 0; - } - page = next_file(page, &hdr); - } - - return -1; -} -/*---------------------------------------------------------------------------*/ -void -cfs_closedir(struct cfs_dir *dir) -{ - return; -} -/*---------------------------------------------------------------------------*/ -int -cfs_coffee_reserve(const char *name, cfs_offset_t size) -{ - return reserve(name, page_count(size), 0, 0) == NULL ? -1 : 0; -} -/*---------------------------------------------------------------------------*/ -int -cfs_coffee_configure_log(const char *filename, unsigned log_size, - unsigned log_record_size) -{ - struct file *file; - struct file_header hdr; - - if(log_record_size == 0 || log_record_size > COFFEE_PAGE_SIZE || - log_size < log_record_size) { - return -1; - } - - file = find_file(filename); - if(file == NULL) { - return -1; - } - - read_header(&hdr, file->page); - if(HDR_MODIFIED(hdr)) { - /* Too late to customize the log. */ - return -1; - } - - hdr.log_records = log_size / log_record_size; - hdr.log_record_size = log_record_size; - write_header(&hdr, file->page); - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -cfs_coffee_set_io_semantics(int fd, unsigned flags) -{ - if(!FD_VALID(fd)) { - return -1; - } - - coffee_fd_set[fd].io_flags |= flags; - - return 0; -} -/*---------------------------------------------------------------------------*/ -int -cfs_coffee_format(void) -{ - coffee_page_t i; - - PRINTF("Coffee: Formatting %u sectors", (unsigned)COFFEE_SECTOR_COUNT); - - for(i = 0; i < COFFEE_SECTOR_COUNT; i++) { - COFFEE_ERASE(i); - PRINTF("."); - } - - /* Formatting invalidates the file information. */ - memset(&coffee_files, 0, sizeof(coffee_files)); - memset(&coffee_fd_set, 0, sizeof(coffee_fd_set)); - next_free = 0; - gc_wait = 1; - - PRINTF(" done!\n"); - - return 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/os/storage/cfs/cfs-coffee.h b/os/storage/cfs/cfs-coffee.h deleted file mode 100644 index 96d382980..000000000 --- a/os/storage/cfs/cfs-coffee.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup cfs - * @{ - */ - -#ifndef CFS_COFFEE_H -#define CFS_COFFEE_H - -#include "cfs.h" - -/** - * Instruct Coffee that the access pattern to this file is adapted to - * flash I/O semantics by design, and Coffee should therefore not - * invoke its own micro logs when file modifications occur. - * - * This semantical I/O setting is useful when implementing flash storage - * algorithms such as database indices on top of Coffee. - * - * \sa cfs_coffee_set_io_semantics() - */ -#define CFS_COFFEE_IO_FLASH_AWARE 0x1 - -/** - * Instruct Coffee not to attempt to extend the file upon a request - * to write past the reserved file size. - * - * A case when this is necessary is when the file has a firm size limit, - * and a safeguard is needed to protect against writes beyond this limit. - * - * \sa cfs_coffee_set_io_semantics() - */ -#define CFS_COFFEE_IO_FIRM_SIZE 0x2 - -/** - * Instruct Coffee to set unused bytes in the destination buffer to zero. - * Trailing zeros may cause a wrong file size, this option ensures that - * the corresponding bytes get set, so Coffee does not read unexpected data. - * - * \sa cfs_coffee_set_io_semantics() - */ -#define CFS_COFFEE_IO_ENSURE_READ_LENGTH 0x4 - -/** - * \file - * Header for the Coffee file system. - * \author - * Nicolas Tsiftes - * - * \name Functions called from application programs - * @{ - */ - -/** - * \brief Reserve space for a file. - * \param name The file name. - * \param size The initial size to be reserved for the file. - * \return 0 on success, -1 on failure. - * - * Coffee uses sequential page structures for files. The sequential - * structure can be reserved with a certain size. If a file has not - * been reserved when it is opened for the first time, it will be - * allocated with a default size. - */ -int cfs_coffee_reserve(const char *name, cfs_offset_t size); - -/** - * \brief Configure the on-demand log file. - * \param file The file name. - * \param log_size The total log file size. - * \param log_entry_size The log entry size. - * \return 0 on success, -1 on failure. - * - * When file data is first modified, Coffee creates a micro log for the - * file. The micro log stores a table of modifications whose parameters -- - * the log size and the log entry size -- can be modified through the - * cfs_coffee_configure_log function. - */ -int cfs_coffee_configure_log(const char *file, unsigned log_size, - unsigned log_entry_size); - -/** - * \brief Set the I/O semantics for accessing a file. - * - * \param fd The file descriptor through which the file is accessed. - * \param flags A bit vector of flags. - * - * Coffee is used on a wide range of storage types, and the default - * I/O file semantics may not be optimal for the access pattern - * of a certain file. Hence, this function allows programmers to - * switch the I/O semantics on a file that is accessed through a - * particular file descriptor. - * - */ -int cfs_coffee_set_io_semantics(int fd, unsigned flags); - -/** - * \brief Format the storage area assigned to Coffee. - * \return 0 on success, -1 on failure. - * - * Coffee formats the underlying storage by setting all bits to zero. - * Formatting must be done before using Coffee for the first time in - * a mote. - * - * Notice that the erased bits may be set to 1 on the physical storage - * when using flash memory. In this case, Coffee requires that the - * COFFEE_READ and COFFEE_WRITE functions used to access the flash memory - * invert all bits. - */ -int cfs_coffee_format(void); - -/** @} */ -/** @} */ - -#endif /* !COFFEE_H */ diff --git a/os/storage/cfs/cfs.h b/os/storage/cfs/cfs.h deleted file mode 100644 index 4851f562a..000000000 --- a/os/storage/cfs/cfs.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \file - * CFS header file. - * \author - * Adam Dunkels - * - */ - -/** - * \addtogroup sys - * @{ - */ - -/** - * \defgroup cfs The Contiki file system interface - * - * The Contiki file system interface (CFS) defines an abstract API for - * reading directories and for reading and writing files. The CFS API - * is intentionally simple. The CFS API is modeled after the POSIX - * file API, and slightly simplified. - * - * @{ - */ - -#ifndef CFS_H_ -#define CFS_H_ - -#include "contiki.h" - -#ifndef CFS_CONF_OFFSET_TYPE -typedef int cfs_offset_t; -#else -typedef CFS_CONF_OFFSET_TYPE cfs_offset_t; -#endif - -struct cfs_dir { - /* Iteration state, which is implementation-defined and should not be - accessed externally. */ - char state[32]; -}; - -struct cfs_dirent { - char name[32]; - cfs_offset_t size; -}; - -/** - * Specify that cfs_open() should open a file for reading. - * - * This constant indicates to cfs_open() that a file should be opened - * for reading. CFS_WRITE should be used if the file is opened for - * writing, and CFS_READ + CFS_WRITE indicates that the file is opened - * for both reading and writing. - * - * \sa cfs_open() - */ -#ifndef CFS_READ -#define CFS_READ 1 -#endif - -/** - * Specify that cfs_open() should open a file for writing. - * - * This constant indicates to cfs_open() that a file should be opened - * for writing. CFS_READ should be used if the file is opened for - * reading, and CFS_READ + CFS_WRITE indicates that the file is opened - * for both reading and writing. - * - * \sa cfs_open() - */ -#ifndef CFS_WRITE -#define CFS_WRITE 2 -#endif - -/** - * Specify that cfs_open() should append written data to the file rather than overwriting it. - * - * This constant indicates to cfs_open() that a file that should be - * opened for writing gets written data appended to the end of the - * file. The default behaviour (without CFS_APPEND) is that the file - * is overwritten with the new data. - * - * \sa cfs_open() - */ -#ifndef CFS_APPEND -#define CFS_APPEND 4 -#endif - -/** - * Specify that cfs_seek() should compute the offset from the beginning of the file. - * - * \sa cfs_seek() - */ -#ifndef CFS_SEEK_SET -#define CFS_SEEK_SET 0 -#endif - -/** - * Specify that cfs_seek() should compute the offset from the current position of the file pointer. - * - * \sa cfs_seek() - */ -#ifndef CFS_SEEK_CUR -#define CFS_SEEK_CUR 1 -#endif - -/** - * Specify that cfs_seek() should compute the offset from the end of the file. - * - * \sa cfs_seek() - */ -#ifndef CFS_SEEK_END -#define CFS_SEEK_END 2 -#endif - -/** - * \brief Open a file. - * \param name The name of the file. - * \param flags CFS_READ, or CFS_WRITE/CFS_APPEND, or both. - * \return A file descriptor, if the file could be opened, or -1 if - * the file could not be opened. - * - * This function opens a file and returns a file - * descriptor for the opened file. If the file could not - * be opened, the function returns -1. The function can - * open a file for reading or writing, or both. - * - * An opened file must be closed with cfs_close(). - * - * \sa CFS_READ - * \sa CFS_WRITE - * \sa cfs_close() - */ -#ifndef cfs_open -int cfs_open(const char *name, int flags); -#endif - -/** - * \brief Close an open file. - * \param fd The file descriptor of the open file. - * - * This function closes a file that has previously been - * opened with cfs_open(). - */ -#ifndef cfs_close -void cfs_close(int fd); -#endif - -/** - * \brief Read data from an open file. - * \param fd The file descriptor of the open file. - * \param buf The buffer in which data should be read from the file. - * \param len The number of bytes that should be read. - * \return The number of bytes that was actually read from the file. - * - * This function reads data from an open file into a - * buffer. The file must have first been opened with - * cfs_open() and the CFS_READ flag. - */ -#ifndef cfs_read -int cfs_read(int fd, void *buf, unsigned int len); -#endif - -/** - * \brief Write data to an open file. - * \param fd The file descriptor of the open file. - * \param buf The buffer from which data should be written to the file. - * \param len The number of bytes that should be written. - * \return The number of bytes that was actually written to the file. - * - * This function reads writes data from a memory buffer to - * an open file. The file must have been opened with - * cfs_open() and the CFS_WRITE flag. - */ -#ifndef cfs_write -int cfs_write(int fd, const void *buf, unsigned int len); -#endif - -/** - * \brief Seek to a specified position in an open file. - * \param fd The file descriptor of the open file. - * \param offset A position, either relative or absolute, in the file. - * \param whence Determines how to interpret the offset parameter. - * \return The new position in the file, or (cfs_offset_t)-1 if the seek failed. - * - * This function moves the file position to the specified - * position in the file. The next byte that is read from - * or written to the file will be at the position given - * determined by the combination of the offset parameter - * and the whence parameter. - * - * \sa CFS_SEEK_CUR - * \sa CFS_SEEK_END - * \sa CFS_SEEK_SET - */ -#ifndef cfs_seek -cfs_offset_t cfs_seek(int fd, cfs_offset_t offset, int whence); -#endif - -/** - * \brief Remove a file. - * \param name The name of the file. - * \retval 0 If the file was removed. - * \return -1 If the file could not be removed or if it doesn't exist. - */ -#ifndef cfs_remove -int cfs_remove(const char *name); -#endif - -/** - * \brief Open a directory for reading directory entries. - * \param dirp A pointer to a struct cfs_dir that is filled in by the function. - * \param name The name of the directory. - * \return 0 or -1 if the directory could not be opened. - * - * \sa cfs_readdir() - * \sa cfs_closedir() - */ -#ifndef cfs_opendir -int cfs_opendir(struct cfs_dir *dirp, const char *name); -#endif - -/** - * \brief Read a directory entry - * \param dirp A pointer to a struct cfs_dir that has been opened with cfs_opendir(). - * \param dirent A pointer to a struct cfs_dirent that is filled in by cfs_readdir() - * \retval 0 If a directory entry was read. - * \retval -1 If no more directory entries can be read. - * - * \sa cfs_opendir() - * \sa cfs_closedir() - */ -#ifndef cfs_readdir -int cfs_readdir(struct cfs_dir *dirp, struct cfs_dirent *dirent); -#endif - -/** - * \brief Close a directory opened with cfs_opendir(). - * \param dirp A pointer to a struct cfs_dir that has been opened with cfs_opendir(). - * - * \sa cfs_opendir() - * \sa cfs_readdir() - */ -#ifndef cfs_closedir -void cfs_closedir(struct cfs_dir *dirp); -#endif - -#endif /* CFS_H_ */ - -/** @} */ -/** @} */ diff --git a/os/sys/autostart.c b/os/sys/autostart.c deleted file mode 100644 index f2dc8f1f5..000000000 --- a/os/sys/autostart.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Implementation of module for automatically starting and exiting a list of processes. - * \author - * Adam Dunkels - */ - -#include "sys/autostart.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/*---------------------------------------------------------------------------*/ -void -autostart_start(struct process * const processes[]) -{ - int i; - - for(i = 0; processes[i] != NULL; ++i) { - process_start(processes[i], NULL); - PRINTF("autostart_start: starting process '%s'\n", processes[i]->name); - } -} -/*---------------------------------------------------------------------------*/ -void -autostart_exit(struct process * const processes[]) -{ - int i; - - for(i = 0; processes[i] != NULL; ++i) { - process_exit(processes[i]); - PRINTF("autostart_exit: stopping process '%s'\n", processes[i]->name); - } -} -/*---------------------------------------------------------------------------*/ diff --git a/os/sys/autostart.h b/os/sys/autostart.h deleted file mode 100644 index dcf91c4ef..000000000 --- a/os/sys/autostart.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for module for automatically starting and exiting a list of processes. - * \author - * Adam Dunkels - */ - -#ifndef AUTOSTART_H_ -#define AUTOSTART_H_ - -#include "contiki.h" -#include "sys/process.h" - -#if ! CC_NO_VA_ARGS -#define AUTOSTART_PROCESSES(...) \ -struct process * const autostart_processes[] = {__VA_ARGS__, NULL} -#else -#error "C compiler must support __VA_ARGS__ macro" -#endif - -extern struct process * const autostart_processes[]; - -void autostart_start(struct process * const processes[]); -void autostart_exit(struct process * const processes[]); - -#endif /* AUTOSTART_H_ */ diff --git a/os/sys/cc-gcc.h b/os/sys/cc-gcc.h deleted file mode 100644 index e96716327..000000000 --- a/os/sys/cc-gcc.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015, Scanimetrics - http://www.scanimetrics.com - * 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 _CC_GCC_H_ -#define _CC_GCC_H_ -#ifdef __GNUC__ - -#ifndef CC_CONF_INLINE -/* use __inline__ in case "inline" is not available for any reason */ -#define CC_CONF_INLINE __inline__ -#endif - -#define CC_CONF_ALIGN(n) __attribute__((__aligned__(n))) - -#endif /* __GNUC__ */ -#endif /* _CC_GCC_H_ */ diff --git a/os/sys/cc.h b/os/sys/cc.h deleted file mode 100644 index 6670eca46..000000000 --- a/os/sys/cc.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS - * - * - */ - -/** - * \file - * Default definitions of C compiler quirk work-arounds. - * \author Adam Dunkels - * - * This file is used for making use of extra functionality of some C - * compilers used for Contiki, and defining work-arounds for various - * quirks and problems with some other C compilers. - */ - -#ifndef CC_H_ -#define CC_H_ - -#include "contiki.h" -#include "sys/cc-gcc.h" - -/** - * Configure if the C compiler supports the "register" keyword for - * function arguments. - */ -#if CC_CONF_REGISTER_ARGS -#define CC_REGISTER_ARG register -#else /* CC_CONF_REGISTER_ARGS */ -#define CC_REGISTER_ARG -#endif /* CC_CONF_REGISTER_ARGS */ - -/** - * Configure if the C compiler supports the arguments for function - * pointers. - */ -#if CC_CONF_FUNCTION_POINTER_ARGS -#define CC_FUNCTION_POINTER_ARGS 1 -#else /* CC_CONF_FUNCTION_POINTER_ARGS */ -#define CC_FUNCTION_POINTER_ARGS 0 -#endif /* CC_CONF_FUNCTION_POINTER_ARGS */ - -/** - * Configure if the C compiler have problems with const function pointers - */ -#ifdef CC_CONF_CONST_FUNCTION_BUG -#define CC_CONST_FUNCTION -#else /* CC_CONF_CONST_FUNCTION_BUG */ -#define CC_CONST_FUNCTION const -#endif /* CC_CONF_CONST_FUNCTION_BUG */ - -/** - * Configure work-around for unsigned char bugs with sdcc. - */ -#if CC_CONF_UNSIGNED_CHAR_BUGS -#define CC_UNSIGNED_CHAR_BUGS 1 -#else /* CC_CONF_UNSIGNED_CHAR_BUGS */ -#define CC_UNSIGNED_CHAR_BUGS 0 -#endif /* CC_CONF_UNSIGNED_CHAR_BUGS */ - -/** - * Configure if C compiler supports double hash marks in C macros. - */ -#if CC_CONF_DOUBLE_HASH -#define CC_DOUBLE_HASH 1 -#else /* CC_CONF_DOUBLE_HASH */ -#define CC_DOUBLE_HASH 0 -#endif /* CC_CONF_DOUBLE_HASH */ - -#ifdef CC_CONF_INLINE -#define CC_INLINE CC_CONF_INLINE -#else /* CC_CONF_INLINE */ -#define CC_INLINE -#endif /* CC_CONF_INLINE */ - -#ifdef CC_CONF_ALIGN -#define CC_ALIGN(n) CC_CONF_ALIGN(n) -#endif /* CC_CONF_INLINE */ - -/** - * Configure if the C compiler supports the assignment of struct value. - */ -#ifdef CC_CONF_ASSIGN_AGGREGATE -#define CC_ASSIGN_AGGREGATE(dest, src) CC_CONF_ASSIGN_AGGREGATE(dest, src) -#else /* CC_CONF_ASSIGN_AGGREGATE */ -#define CC_ASSIGN_AGGREGATE(dest, src) *dest = *src -#endif /* CC_CONF_ASSIGN_AGGREGATE */ - -#if CC_CONF_NO_VA_ARGS -#define CC_NO_VA_ARGS CC_CONF_VA_ARGS -#endif - -/** \def CC_ACCESS_NOW(x) - * This macro ensures that the access to a non-volatile variable can - * not be reordered or optimized by the compiler. - * See also https://lwn.net/Articles/508991/ - In Linux the macro is - * called ACCESS_ONCE - * The type must be passed, because the typeof-operator is a gcc - * extension - */ - -#define CC_ACCESS_NOW(type, variable) (*(volatile type *)&(variable)) - -#ifndef NULL -#define NULL 0 -#endif /* NULL */ - -#ifndef MAX -#define MAX(n, m) (((n) < (m)) ? (m) : (n)) -#endif - -#ifndef MIN -#define MIN(n, m) (((n) < (m)) ? (n) : (m)) -#endif - -#ifndef ABS -#define ABS(n) (((n) < 0) ? -(n) : (n)) -#endif - - -#define CC_CONCAT2(s1, s2) s1##s2 -/** - * A C preprocessing macro for concatenating two preprocessor tokens. - * - * We need use two macros (CC_CONCAT and CC_CONCAT2) in order to allow - * concatenation of two \#defined macros. - */ -#define CC_CONCAT(s1, s2) CC_CONCAT2(s1, s2) -#define CC_CONCAT_EXT_2(s1, s2) CC_CONCAT2(s1, s2) - -/** - * A C preprocessing macro for concatenating three preprocessor tokens. - */ -#define CC_CONCAT3(s1, s2, s3) s1##s2##s3 -#define CC_CONCAT_EXT_3(s1, s2, s3) CC_CONCAT3(s1, s2, s3) - -#endif /* CC_H_ */ diff --git a/os/sys/clock.h b/os/sys/clock.h deleted file mode 100644 index 161527d47..000000000 --- a/os/sys/clock.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** \addtogroup timers - * @{ - */ - -/** - * \defgroup clock Clock library - * - * The clock library is the interface between Contiki and the platform - * specific clock functionality. The clock library defines a macro, - * CLOCK_SECOND, to convert seconds into the tick resolution of the platform. - * Typically this is 1-10 milliseconds, e.g. 4*CLOCK_SECOND could be 512. - * A 16 bit counter would thus overflow every 1-10 minutes. - * Platforms use the tick interrupt to maintain a long term count - * of seconds since startup. - * - * Platforms may also implement rtimers for greater time resolution - * and for real-time interrupts, These use a corresponding RTIMER_SECOND. - * - * \note These timers do not necessarily have a common divisor or are phase locked. - * One may be crystal controlled and the other may not. Low power operation - * or sleep will often use one for wake and disable the other, then give - * it a tick correction after wakeup. - * - * \note The clock library need in many cases not be used - * directly. Rather, the \ref timer "timer library", \ref etimer - * "event timers", or \ref rtimer "rtimer library" should be used. - * - * \sa \ref timer "Timer library" - * \sa \ref etimer "Event timers" - * \sa \ref rtimer "Realtime library" - * - * @{ - */ - -#ifndef CLOCK_H_ -#define CLOCK_H_ - -#include "contiki.h" - -/** - * A second, measured in system clock time. - * - * \hideinitializer - */ -#ifdef CLOCK_CONF_SECOND -#define CLOCK_SECOND CLOCK_CONF_SECOND -#else -#define CLOCK_SECOND (clock_time_t)32 -#endif - -/** - * Initialize the clock library. - * - * This function initializes the clock library and should be called - * from the main() function of the system. - * - */ -void clock_init(void); - -/** - * Get the current clock time. - * - * This function returns the current system clock time. - * - * \return The current clock time, measured in system ticks. - */ -clock_time_t clock_time(void); - -/** - * Get the current value of the platform seconds. - * - * This could be the number of seconds since startup, or - * since a standard epoch. - * - * \return The value. - */ -unsigned long clock_seconds(void); - -/** - * Set the value of the platform seconds. - * \param sec The value to set. - * - */ -void clock_set_seconds(unsigned long sec); - -/** - * Wait for a given number of ticks. - * \param t How many ticks. - * - */ -void clock_wait(clock_time_t t); - -/** - * Delay a given number of microseconds. - * \param dt How many microseconds to delay. - * - * \note Interrupts could increase the delay by a variable amount. - */ -void clock_delay_usec(uint16_t dt); - -/** - * Deprecated platform-specific routines. - * - */ -int clock_fine_max(void); -unsigned short clock_fine(void); -void clock_delay(unsigned int delay); - -#endif /* CLOCK_H_ */ - -/** @} */ -/** @} */ diff --git a/os/sys/compower.c b/os/sys/compower.c deleted file mode 100644 index 7c13881ee..000000000 --- a/os/sys/compower.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Communication power accounting module - * \author - * Adam Dunkels - */ - -/** - * \addtogroup compower - * @{ - */ - -#include "contiki.h" -#include "sys/energest.h" -#include "sys/compower.h" -#include "net/packetbuf.h" - -struct compower_activity compower_idle_activity; - -/*---------------------------------------------------------------------------*/ -void -compower_init(void) -{ - compower_clear(&compower_idle_activity); -} -/*---------------------------------------------------------------------------*/ -void -compower_accumulate(struct compower_activity *e) -{ - static uint64_t last_listen, last_transmit; - uint64_t listen, transmit; - - energest_flush(); - - listen = energest_type_time(ENERGEST_TYPE_LISTEN); - e->listen += listen - last_listen; - last_listen = listen; - - transmit = energest_type_time(ENERGEST_TYPE_TRANSMIT); - e->transmit += transmit - last_transmit; - last_transmit = transmit; -} -/*---------------------------------------------------------------------------*/ -void -compower_clear(struct compower_activity *e) -{ - e->listen = e->transmit = 0; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/sys/compower.h b/os/sys/compower.h deleted file mode 100644 index 407e8b57e..000000000 --- a/os/sys/compower.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the communication power accounting module - * \author - * Adam Dunkels - */ - -/** \addtogroup sys - * @{ */ - -/** - * \defgroup compower Communication power accounting - * @{ - * - * The compower module accumulates power consumption information and - * attributes it to communication activities. Examples of - * communication activities are packet transmission, packet reception, - * and idle listening. - * - */ - -#ifndef COMPOWER_H_ -#define COMPOWER_H_ - -/** - * \brief An activity record that contains power consumption information for a specific communication activity. - * - * This is a structure that holds power information about - * a communication activity. It is an opaque structure - * with no user-visible elements. - */ -struct compower_activity { - uint64_t listen, transmit; -}; - -/** - * \brief The default idle communication activity. - * - * This is the idle communication activity, to which all - * energy that is not possible to attribute to individual - * packets, is attributed. Examples include idle listening - * for incoming packets and MAC-level beacon - * transmissions. - */ -extern struct compower_activity compower_idle_activity; - -/** - * \brief Initialize the communication power accounting module. - * - * This function initializes the communication power - * accounting module. The function is called by the system - * during boot-up. - */ -void compower_init(void); - -/** - * \brief Accumulate power contumption for a communication activity - * \param a A pointer to an activity structure. - * - * This function accumulates power consumption information - * for a communication activity. The function typically is - * called by a power-saving MAC protocol when the radio is - * switched off, or when a packet is received or - * transmitted. - * - */ -void compower_accumulate(struct compower_activity *a); - -/** - * \brief Clear power consumption information for a communication activity - * \param a A pointer to an activity structure. - * - * This function clears any power contumption information - * that has previously been accumulated in an activity - * structure. - * - */ -void compower_clear(struct compower_activity *a); - -#endif /* COMPOWER_H_ */ - -/** @} */ -/** @} */ diff --git a/os/sys/critical.h b/os/sys/critical.h deleted file mode 100644 index 8fb2cde82..000000000 --- a/os/sys/critical.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sys - * @{ - * - * \defgroup critical Critical sections - * @{ - * - * Platform-independent functions for critical section entry and exit - */ -/*---------------------------------------------------------------------------*/ -#ifndef CRITICAL_H_ -#define CRITICAL_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/memory-barrier.h" -#include "sys/int-master.h" - -#include -/*---------------------------------------------------------------------------*/ -/** - * \brief Enter a critical section - * \return The status of the master interrupt before entering the critical - * - * This function will return the status of the master interrupt as it was - * before entering the critical section. - * - * The semantics of the return value are entirely platform-specific. The - * calling code should not try to determine whether the master interrupt was - * previously enabled/disabled by interpreting the return value of this - * function. The return value should only be used as an argument to - * critical_exit(). - */ -static inline int_master_status_t -critical_enter() -{ - int_master_status_t status = int_master_read_and_disable(); - memory_barrier(); - return status; -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Exit a critical section and restore the master interrupt - * \param status The new status of the master interrupt - * - * The semantics of \e status are platform-dependent. Normally, the argument - * provided to this function will be a value previously retrieved through a - * call to critical_enter(). - */ -static inline void -critical_exit(int_master_status_t status) -{ - memory_barrier(); - int_master_status_set(status); -} -/*---------------------------------------------------------------------------*/ -#endif /* CRITICAL_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/sys/ctimer.c b/os/sys/ctimer.c deleted file mode 100644 index 1d628677b..000000000 --- a/os/sys/ctimer.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Callback timer implementation - * \author - * Adam Dunkels - */ - -/** - * \addtogroup ctimer - * @{ - */ - -#include "sys/ctimer.h" -#include "contiki.h" -#include "lib/list.h" - -LIST(ctimer_list); - -static char initialized; - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/*---------------------------------------------------------------------------*/ -PROCESS(ctimer_process, "Ctimer process"); -PROCESS_THREAD(ctimer_process, ev, data) -{ - struct ctimer *c; - PROCESS_BEGIN(); - - for(c = list_head(ctimer_list); c != NULL; c = c->next) { - etimer_set(&c->etimer, c->etimer.timer.interval); - } - initialized = 1; - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_TIMER); - for(c = list_head(ctimer_list); c != NULL; c = c->next) { - if(&c->etimer == data) { - list_remove(ctimer_list, c); - PROCESS_CONTEXT_BEGIN(c->p); - if(c->f != NULL) { - c->f(c->ptr); - } - PROCESS_CONTEXT_END(c->p); - break; - } - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -ctimer_init(void) -{ - initialized = 0; - list_init(ctimer_list); - process_start(&ctimer_process, NULL); -} -/*---------------------------------------------------------------------------*/ -void -ctimer_set(struct ctimer *c, clock_time_t t, - void (*f)(void *), void *ptr) -{ - ctimer_set_with_process(c, t, f, ptr, PROCESS_CURRENT()); -} -/*---------------------------------------------------------------------------*/ -void -ctimer_set_with_process(struct ctimer *c, clock_time_t t, - void (*f)(void *), void *ptr, struct process *p) -{ - PRINTF("ctimer_set %p %lu\n", c, (unsigned long)t); - c->p = p; - c->f = f; - c->ptr = ptr; - if(initialized) { - PROCESS_CONTEXT_BEGIN(&ctimer_process); - etimer_set(&c->etimer, t); - PROCESS_CONTEXT_END(&ctimer_process); - } else { - c->etimer.timer.interval = t; - } - - list_add(ctimer_list, c); -} -/*---------------------------------------------------------------------------*/ -void -ctimer_reset(struct ctimer *c) -{ - if(initialized) { - PROCESS_CONTEXT_BEGIN(&ctimer_process); - etimer_reset(&c->etimer); - PROCESS_CONTEXT_END(&ctimer_process); - } - - list_add(ctimer_list, c); -} -/*---------------------------------------------------------------------------*/ -void -ctimer_restart(struct ctimer *c) -{ - if(initialized) { - PROCESS_CONTEXT_BEGIN(&ctimer_process); - etimer_restart(&c->etimer); - PROCESS_CONTEXT_END(&ctimer_process); - } - - list_add(ctimer_list, c); -} -/*---------------------------------------------------------------------------*/ -void -ctimer_stop(struct ctimer *c) -{ - if(initialized) { - etimer_stop(&c->etimer); - } else { - c->etimer.next = NULL; - c->etimer.p = PROCESS_NONE; - } - list_remove(ctimer_list, c); -} -/*---------------------------------------------------------------------------*/ -int -ctimer_expired(struct ctimer *c) -{ - struct ctimer *t; - if(initialized) { - return etimer_expired(&c->etimer); - } - for(t = list_head(ctimer_list); t != NULL; t = t->next) { - if(t == c) { - return 0; - } - } - return 1; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/sys/ctimer.h b/os/sys/ctimer.h deleted file mode 100644 index e7e463ac4..000000000 --- a/os/sys/ctimer.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the callback timer - * \author - * Adam Dunkels - */ - -/** - * \addtogroup timers - * @{ - */ - -/** - * \defgroup ctimer Callback timer - * @{ - * - * The ctimer module provides a timer mechanism that calls a specified - * C function when a ctimer expires. - * - */ - -#ifndef CTIMER_H_ -#define CTIMER_H_ - -#include "contiki.h" -#include "sys/etimer.h" - -struct ctimer { - struct ctimer *next; - struct etimer etimer; - struct process *p; - void (*f)(void *); - void *ptr; -}; - -/** - * \brief Reset a callback timer with the same interval as was - * previously set. - * \param c A pointer to the callback timer. - * - * This function resets the callback timer with the same - * interval that was given to the callback timer with the - * ctimer_set() function. The start point of the interval - * is the exact time that the callback timer last - * expired. Therefore, this function will cause the timer - * to be stable over time, unlike the ctimer_restart() - * function. If this is executed before the timer expired, - * this function has no effect. - * - * \sa ctimer_restart() - */ -void ctimer_reset(struct ctimer *c); - -/** - * \brief Restart a callback timer from the current point in time - * \param c A pointer to the callback timer. - * - * This function restarts the callback timer with the same - * interval that was given to the ctimer_set() - * function. The callback timer will start at the current - * time. - * - * \note A periodic timer will drift if this function is - * used to reset it. For periodic timers, use the - * ctimer_reset() function instead. - * - * \sa ctimer_reset() - */ -void ctimer_restart(struct ctimer *c); - -/** - * \brief Set a callback timer. - * \param c A pointer to the callback timer. - * \param t The interval before the timer expires. - * \param f A function to be called when the timer expires. - * \param ptr An opaque pointer that will be supplied as an argument to the callback function. - * - * This function is used to set a callback timer for a time - * sometime in the future. When the callback timer expires, - * the callback function f will be called with ptr as argument. - * - * This essentially does ctimer_set_process(c, t, f, ptr, PROCESS_CURRENT()); - * - */ -void ctimer_set(struct ctimer *c, clock_time_t t, - void (*f)(void *), void *ptr); - -/** - * \brief Set a callback timer. - * \param c A pointer to the callback timer. - * \param t The interval before the timer expires. - * \param f A function to be called when the timer expires. - * \param ptr An opaque pointer that will be supplied as an argument to the callback function. - * \param p A pointer to the process the timer belongs to - * - * This function is used to set a callback timer for a time - * sometime in the future. When the callback timer expires, - * the callback function f will be called with ptr as argument. - * - */ -void ctimer_set_with_process(struct ctimer *c, clock_time_t t, - void (*f)(void *), void *ptr, struct process *p); - -/** - * \brief Stop a pending callback timer. - * \param c A pointer to the pending callback timer. - * - * This function stops a callback timer that has previously - * been set with ctimer_set(), ctimer_reset(), or ctimer_restart(). - * After this function has been called, the callback timer will be - * expired and will not call the callback function. - * - */ -void ctimer_stop(struct ctimer *c); - -/** - * \brief Check if a callback timer has expired. - * \param c A pointer to the callback timer - * \return Non-zero if the timer has expired, zero otherwise. - * - * This function tests if a callback timer has expired and - * returns true or false depending on its status. - */ -int ctimer_expired(struct ctimer *c); - -/** - * \brief Initialize the callback timer library. - * - * This function initializes the callback timer library and - * should be called from the system boot up code. - */ -void ctimer_init(void); - -#endif /* CTIMER_H_ */ -/** @} */ -/** @} */ diff --git a/os/sys/energest.c b/os/sys/energest.c deleted file mode 100644 index beaf411bc..000000000 --- a/os/sys/energest.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Implementation of the energy estimation module - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "sys/energest.h" - -#if ENERGEST_CONF_ON - -uint64_t energest_total_time[ENERGEST_TYPE_MAX]; -ENERGEST_TIME_T energest_current_time[ENERGEST_TYPE_MAX]; -unsigned char energest_current_mode[ENERGEST_TYPE_MAX]; - -/*---------------------------------------------------------------------------*/ -void -energest_init(void) -{ - int i; - for(i = 0; i < ENERGEST_TYPE_MAX; ++i) { - energest_total_time[i] = energest_current_time[i] = 0; - energest_current_mode[i] = 0; - } - ENERGEST_ON(ENERGEST_TYPE_CPU); -} -/*---------------------------------------------------------------------------*/ -void -energest_flush(void) -{ - uint64_t now; - int i; - for(i = 0; i < ENERGEST_TYPE_MAX; i++) { - if(energest_current_mode[i]) { - now = ENERGEST_CURRENT_TIME(); - energest_total_time[i] += - (ENERGEST_TIME_T)(now - energest_current_time[i]); - energest_current_time[i] = now; - } - } -} -/*---------------------------------------------------------------------------*/ -uint64_t -energest_get_total_time(void) -{ - return energest_type_time(ENERGEST_TYPE_CPU) + - energest_type_time(ENERGEST_TYPE_LPM) + - energest_type_time(ENERGEST_TYPE_DEEP_LPM); -} -/*---------------------------------------------------------------------------*/ -#else /* ENERGEST_CONF_ON */ - -void -energest_init(void) -{ -} - -void -energest_flush(void) -{ -} - -uint64_t -energest_get_total_time(void) -{ - return 0; -} - -#endif /* ENERGEST_CONF_ON */ diff --git a/os/sys/energest.h b/os/sys/energest.h deleted file mode 100644 index 0875eaba7..000000000 --- a/os/sys/energest.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the energy estimation mechanism - * \author - * Adam Dunkels - */ - -#ifndef ENERGEST_H_ -#define ENERGEST_H_ - -#include "contiki.h" - -#ifndef ENERGEST_CONF_ON -/* Energest is disabled by default */ -#define ENERGEST_CONF_ON 0 -#endif /* ENERGEST_CONF_ON */ - -#ifndef ENERGEST_CURRENT_TIME -#ifdef ENERGEST_CONF_CURRENT_TIME -#define ENERGEST_CURRENT_TIME ENERGEST_CONF_CURRENT_TIME -#else -#define ENERGEST_CURRENT_TIME RTIMER_NOW -#define ENERGEST_SECOND RTIMER_SECOND -#define ENERGEST_TIME_T rtimer_clock_t -#endif /* ENERGEST_CONF_TIME */ -#endif /* ENERGEST_TIME */ - -#ifndef ENERGEST_TIME_T -#ifdef ENERGEST_CONF_TIME_T -#define ENERGEST_TIME_T ENERGEST_CONF_TIME_T -#else -#define ENERGEST_TIME_T rtimer_clock_t -#endif /* ENERGEST_CONF_TIME_T */ -#endif /* ENERGEST_TIME_T */ - -#ifndef ENERGEST_SECOND -#ifdef ENERGEST_CONF_SECOND -#define ENERGEST_SECOND ENERGEST_CONF_SECOND -#else /* ENERGEST_CONF_SECOND */ -#define ENERGEST_SECOND RTIMER_SECOND -#endif /* ENERGEST_CONF_SECOND */ -#endif /* ENERGEST_SECOND */ - -#ifndef ENERGEST_GET_TOTAL_TIME -#ifdef ENERGEST_CONF_GET_TOTAL_TIME -#define ENERGEST_GET_TOTAL_TIME ENERGEST_CONF_GET_TOTAL_TIME -#else /* ENERGEST_CONF_GET_TOTAL_TIME */ -#define ENERGEST_GET_TOTAL_TIME energest_get_total_time -#endif /* ENERGEST_CONF_GET_TOTAL_TIME */ -#endif /* ENERGEST_GET_TOTAL_TIME */ - -/* - * Optional support for more energest types. - * - * #define ENERGEST_CONF_PLATFORM_ADDITIONS TYPE_NAME1, TYPE_NAME2 - * - * #define ENERGEST_CONF_ADDITIONS TYPE_NAME3, TYPE_NAME4 - */ -typedef enum energest_type { - ENERGEST_TYPE_CPU, - ENERGEST_TYPE_LPM, - ENERGEST_TYPE_DEEP_LPM, - ENERGEST_TYPE_TRANSMIT, - ENERGEST_TYPE_LISTEN, - -#ifdef ENERGEST_CONF_PLATFORM_ADDITIONS - ENERGEST_CONF_PLATFORM_ADDITIONS, -#endif /* ENERGEST_CONF_PLATFORM_ADDITIONS */ - -#ifdef ENERGEST_CONF_ADDITIONS - ENERGEST_CONF_ADDITIONS, -#endif /* ENERGEST_CONF_ADDITIONS */ - - ENERGEST_TYPE_MAX -} energest_type_t; - -void energest_init(void); -void energest_flush(void); - -uint64_t ENERGEST_GET_TOTAL_TIME(void); - -#if ENERGEST_CONF_ON - -extern uint64_t energest_total_time[ENERGEST_TYPE_MAX]; -extern ENERGEST_TIME_T energest_current_time[ENERGEST_TYPE_MAX]; -extern unsigned char energest_current_mode[ENERGEST_TYPE_MAX]; - -static inline uint64_t -energest_type_time(energest_type_t type) -{ - return energest_total_time[type]; -} - -static inline void -energest_type_set(energest_type_t type, uint64_t value) -{ - energest_total_time[type] = value; -} - -static inline void -energest_on(energest_type_t type) -{ - if(energest_current_mode[type] == 0) { - energest_current_time[type] = ENERGEST_CURRENT_TIME(); - energest_current_mode[type] = 1; - } -} -#define ENERGEST_ON(type) energest_on(type) - -static inline void -energest_off(energest_type_t type) -{ - if(energest_current_mode[type] != 0) { - energest_total_time[type] += - (ENERGEST_TIME_T)(ENERGEST_CURRENT_TIME() - energest_current_time[type]); - energest_current_mode[type] = 0; - } -} -#define ENERGEST_OFF(type) energest_off(type) - -static inline void -energest_switch(energest_type_t type_off, energest_type_t type_on) -{ - ENERGEST_TIME_T energest_local_variable_now = ENERGEST_CURRENT_TIME(); - if(energest_current_mode[type_off] != 0) { - energest_total_time[type_off] += (ENERGEST_TIME_T) - (energest_local_variable_now - energest_current_time[type_off]); - energest_current_mode[type_off] = 0; - } - if(energest_current_mode[type_on] == 0) { - energest_current_time[type_on] = energest_local_variable_now; - energest_current_mode[type_on] = 1; - } -} -#define ENERGEST_SWITCH(type_off, type_on) energest_switch(type_off, type_on) - -#else /* ENERGEST_CONF_ON */ - -static inline uint64_t energest_type_time(energest_type_t type) { return 0; } - -static inline void energest_type_set(energest_type_t type, uint64_t time) { } - -static inline void energest_on(energest_type_t type) { } - -static inline void energest_off(energest_type_t type) { } - -static inline void energest_switch(energest_type_t type_off, - energest_type_t type_on) -{ -} - -#define ENERGEST_ON(type) do { } while(0) -#define ENERGEST_OFF(type) do { } while(0) -#define ENERGEST_SWITCH(type_off, type_on) do { } while(0) - -#endif /* ENERGEST_CONF_ON */ - -#endif /* ENERGEST_H_ */ diff --git a/os/sys/etimer.c b/os/sys/etimer.c deleted file mode 100644 index 19657813d..000000000 --- a/os/sys/etimer.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \addtogroup etimer - * @{ - */ - -/** - * \file - * Event timer library implementation. - * \author - * Adam Dunkels - */ - -#include "contiki.h" - -#include "sys/etimer.h" -#include "sys/process.h" - -static struct etimer *timerlist; -static clock_time_t next_expiration; - -PROCESS(etimer_process, "Event timer"); -/*---------------------------------------------------------------------------*/ -static void -update_time(void) -{ - clock_time_t tdist; - clock_time_t now; - struct etimer *t; - - if (timerlist == NULL) { - next_expiration = 0; - } else { - now = clock_time(); - t = timerlist; - /* Must calculate distance to next time into account due to wraps */ - tdist = t->timer.start + t->timer.interval - now; - for(t = t->next; t != NULL; t = t->next) { - if(t->timer.start + t->timer.interval - now < tdist) { - tdist = t->timer.start + t->timer.interval - now; - } - } - next_expiration = now + tdist; - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(etimer_process, ev, data) -{ - struct etimer *t, *u; - - PROCESS_BEGIN(); - - timerlist = NULL; - - while(1) { - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_EXITED) { - struct process *p = data; - - while(timerlist != NULL && timerlist->p == p) { - timerlist = timerlist->next; - } - - if(timerlist != NULL) { - t = timerlist; - while(t->next != NULL) { - if(t->next->p == p) { - t->next = t->next->next; - } else - t = t->next; - } - } - continue; - } else if(ev != PROCESS_EVENT_POLL) { - continue; - } - - again: - - u = NULL; - - for(t = timerlist; t != NULL; t = t->next) { - if(timer_expired(&t->timer)) { - if(process_post(t->p, PROCESS_EVENT_TIMER, t) == PROCESS_ERR_OK) { - - /* Reset the process ID of the event timer, to signal that the - etimer has expired. This is later checked in the - etimer_expired() function. */ - t->p = PROCESS_NONE; - if(u != NULL) { - u->next = t->next; - } else { - timerlist = t->next; - } - t->next = NULL; - update_time(); - goto again; - } else { - etimer_request_poll(); - } - } - u = t; - } - - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -etimer_request_poll(void) -{ - process_poll(&etimer_process); -} -/*---------------------------------------------------------------------------*/ -static void -add_timer(struct etimer *timer) -{ - struct etimer *t; - - etimer_request_poll(); - - if(timer->p != PROCESS_NONE) { - for(t = timerlist; t != NULL; t = t->next) { - if(t == timer) { - /* Timer already on list, bail out. */ - timer->p = PROCESS_CURRENT(); - update_time(); - return; - } - } - } - - /* Timer not on list. */ - timer->p = PROCESS_CURRENT(); - timer->next = timerlist; - timerlist = timer; - - update_time(); -} -/*---------------------------------------------------------------------------*/ -void -etimer_set(struct etimer *et, clock_time_t interval) -{ - timer_set(&et->timer, interval); - add_timer(et); -} -/*---------------------------------------------------------------------------*/ -void -etimer_reset_with_new_interval(struct etimer *et, clock_time_t interval) -{ - timer_reset(&et->timer); - et->timer.interval = interval; - add_timer(et); -} -/*---------------------------------------------------------------------------*/ -void -etimer_reset(struct etimer *et) -{ - timer_reset(&et->timer); - add_timer(et); -} -/*---------------------------------------------------------------------------*/ -void -etimer_restart(struct etimer *et) -{ - timer_restart(&et->timer); - add_timer(et); -} -/*---------------------------------------------------------------------------*/ -void -etimer_adjust(struct etimer *et, int timediff) -{ - et->timer.start += timediff; - update_time(); -} -/*---------------------------------------------------------------------------*/ -int -etimer_expired(struct etimer *et) -{ - return et->p == PROCESS_NONE; -} -/*---------------------------------------------------------------------------*/ -clock_time_t -etimer_expiration_time(struct etimer *et) -{ - return et->timer.start + et->timer.interval; -} -/*---------------------------------------------------------------------------*/ -clock_time_t -etimer_start_time(struct etimer *et) -{ - return et->timer.start; -} -/*---------------------------------------------------------------------------*/ -int -etimer_pending(void) -{ - return timerlist != NULL; -} -/*---------------------------------------------------------------------------*/ -clock_time_t -etimer_next_expiration_time(void) -{ - return etimer_pending() ? next_expiration : 0; -} -/*---------------------------------------------------------------------------*/ -void -etimer_stop(struct etimer *et) -{ - struct etimer *t; - - /* First check if et is the first event timer on the list. */ - if(et == timerlist) { - timerlist = timerlist->next; - update_time(); - } else { - /* Else walk through the list and try to find the item before the - et timer. */ - for(t = timerlist; t != NULL && t->next != et; t = t->next); - - if(t != NULL) { - /* We've found the item before the event timer that we are about - to remove. We point the items next pointer to the event after - the removed item. */ - t->next = et->next; - - update_time(); - } - } - - /* Remove the next pointer from the item to be removed. */ - et->next = NULL; - /* Set the timer as expired */ - et->p = PROCESS_NONE; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/sys/etimer.h b/os/sys/etimer.h deleted file mode 100644 index 2922b9aa2..000000000 --- a/os/sys/etimer.h +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \file - * Event timer header file. - * \author - * Adam Dunkels - */ - -/** \addtogroup timers - * @{ */ - -/** - * \defgroup etimer Event timers - * - * Event timers provides a way to generate timed events. An event - * timer will post an event to the process that set the timer when the - * event timer expires. - * - * An event timer is declared as a \c struct \c etimer and all access - * to the event timer is made by a pointer to the declared event - * timer. - * - * \sa \ref timer "Simple timer library" - * \sa \ref clock "Clock library" (used by the timer library) - * - * @{ - */ - -#ifndef ETIMER_H_ -#define ETIMER_H_ - -#include "contiki.h" - -/** - * A timer. - * - * This structure is used for declaring a timer. The timer must be set - * with etimer_set() before it can be used. - * - * \hideinitializer - */ -struct etimer { - struct timer timer; - struct etimer *next; - struct process *p; -}; - -/** - * \name Functions called from application programs - * @{ - */ - -/** - * \brief Set an event timer. - * \param et A pointer to the event timer - * \param interval The interval before the timer expires. - * - * This function is used to set an event timer for a time - * sometime in the future. When the event timer expires, - * the event PROCESS_EVENT_TIMER will be posted to the - * process that called the etimer_set() function. - * - */ -void etimer_set(struct etimer *et, clock_time_t interval); - -/** - * \brief Reset an event timer with the same interval as was - * previously set. - * \param et A pointer to the event timer. - * - * This function resets the event timer with the same - * interval that was given to the event timer with the - * etimer_set() function. The start point of the interval - * is the exact time that the event timer last - * expired. Therefore, this function will cause the timer - * to be stable over time, unlike the etimer_restart() - * function. If this is executed before the timer expired, - * this function has no effect. - * - * \sa etimer_restart() - */ -void etimer_reset(struct etimer *et); - -/** - * \brief Reset an event timer with a new interval. - * \param et A pointer to the event timer. - * \param interval The interval before the timer expires. - * - * This function very similar to etimer_reset. Opposed to - * etimer_reset it is possible to change the timout. - * This allows accurate, non-periodic timers without drift. - * - * \sa etimer_reset() - */ -void etimer_reset_with_new_interval(struct etimer *et, clock_time_t interval); - -/** - * \brief Restart an event timer from the current point in time - * \param et A pointer to the event timer. - * - * This function restarts the event timer with the same - * interval that was given to the etimer_set() - * function. The event timer will start at the current - * time. - * - * \note A periodic timer will drift if this function is - * used to reset it. For periodic timers, use the - * etimer_reset() function instead. - * - * \sa etimer_reset() - */ -void etimer_restart(struct etimer *et); - -/** - * \brief Adjust the expiration time for an event timer - * \param et A pointer to the event timer. - * \param td The time difference to adjust the expiration time with. - * - * This function is used to adjust the time the event - * timer will expire. It can be used to synchronize - * periodic timers without the need to restart the timer - * or change the timer interval. - * - * \note This function should only be used for small - * adjustments. For large adjustments use etimer_set() - * instead. - * - * \note A periodic timer will drift unless the - * etimer_reset() function is used. - * - * \sa etimer_set() - * \sa etimer_reset() - */ -void etimer_adjust(struct etimer *et, int td); - -/** - * \brief Get the expiration time for the event timer. - * \param et A pointer to the event timer - * \return The expiration time for the event timer. - * - * This function returns the expiration time for an event timer. - */ -clock_time_t etimer_expiration_time(struct etimer *et); - -/** - * \brief Get the start time for the event timer. - * \param et A pointer to the event timer - * \return The start time for the event timer. - * - * This function returns the start time (when the timer - * was last set) for an event timer. - */ -clock_time_t etimer_start_time(struct etimer *et); - -/** - * \brief Check if an event timer has expired. - * \param et A pointer to the event timer - * \return Non-zero if the timer has expired, zero otherwise. - * - * This function tests if an event timer has expired and - * returns true or false depending on its status. - */ -int etimer_expired(struct etimer *et); - -/** - * \brief Stop a pending event timer. - * \param et A pointer to the pending event timer. - * - * This function stops an event timer that has previously - * been set with etimer_set() or etimer_reset(). After - * this function has been called, the event timer will not - * emit any event when it expires. - * - */ -void etimer_stop(struct etimer *et); - -/** @} */ - -/** - * \name Functions called from timer interrupts, by the system - * @{ - */ - -/** - * \brief Make the event timer aware that the clock has changed - * - * This function is used to inform the event timer module - * that the system clock has been updated. Typically, this - * function would be called from the timer interrupt - * handler when the clock has ticked. - */ -void etimer_request_poll(void); - -/** - * \brief Check if there are any non-expired event timers. - * \return True if there are active event timers, false if there are - * no active timers. - * - * This function checks if there are any active event - * timers that have not expired. - */ -int etimer_pending(void); - -/** - * \brief Get next event timer expiration time. - * \return Next expiration time of all pending event timers. - * If there are no pending event timers this function - * returns 0. - * - * This functions returns next expiration time of all - * pending event timers. - */ -clock_time_t etimer_next_expiration_time(void); - - -/** @} */ - -PROCESS_NAME(etimer_process); -#endif /* ETIMER_H_ */ -/** @} */ -/** @} */ diff --git a/os/sys/int-master.h b/os/sys/int-master.h deleted file mode 100644 index 1334abb1f..000000000 --- a/os/sys/int-master.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** \addtogroup sys - * @{ - * - * \defgroup interrupts Master interrupt manipulation - * @{ - * - * These functions can be used to manipulate the master interrupt in a - * platform-independent fashion - */ -/*---------------------------------------------------------------------------*/ -#ifndef INT_MASTER_H_ -#define INT_MASTER_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#ifdef INT_MASTER_CONF_STATUS_DATATYPE -#define INT_MASTER_STATUS_DATATYPE INT_MASTER_CONF_STATUS_DATATYPE -#else -#define INT_MASTER_STATUS_DATATYPE uint32_t -#endif - -/** - * \brief Master interrupt state representation data type - * - * It is possible for the platform code to change this datatype by defining - * INT_MASTER_CONF_STATUS_DATATYPE - */ -typedef INT_MASTER_STATUS_DATATYPE int_master_status_t; -/*---------------------------------------------------------------------------*/ -/** - * \brief Enable the master interrupt - * - * The platform developer must provide this function - */ -void int_master_enable(void); - -/** - * \brief Disable the master interrupt - * \return The status of the master interrupt before disabling it - * - * This function will return the status of the master interrupt as it was - * before it got disabled. - * - * The semantics of the return value are entirely platform-specific. The - * calling code should not try to determine whether the master interrupt was - * previously enabled/disabled by interpreting the return value of this - * function. The return value should only be used as an argument to - * int_master_status_set() - * - * To determine the status of the master interrupt in a platform-independent - * fashion you should use int_master_is_enabled(). - * - * The platform developer must provide this function - */ -int_master_status_t int_master_read_and_disable(void); - -/** - * \brief Set the status of the master interrupt - * \param status The new status - * - * The semantics of \e status are platform-dependent. Normally, the argument - * provided to this function will be a value previously retrieved through a - * call to int_master_read_and_disable() - * - * The platform developer must provide this function - */ -void int_master_status_set(int_master_status_t status); - -/** - * \brief Retrieve the status of the master interrupt - * \retval false Interrupts are disabled - * \retval true Interrupts are enabled - * - * This function can be used to retrieve the status of the master interrupt - * in a platform-independent fashion. - * - * The platform developer must provide this function - */ -bool int_master_is_enabled(void); -/*---------------------------------------------------------------------------*/ -#endif /* INT_MASTER_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/sys/lc-addrlabels.h b/os/sys/lc-addrlabels.h deleted file mode 100644 index fc86f92ce..000000000 --- a/os/sys/lc-addrlabels.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2004-2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \addtogroup lc - * @{ - */ - -/** - * \file - * Implementation of local continuations based on the "Labels as - * values" feature of gcc - * \author - * Adam Dunkels - * - * This implementation of local continuations is based on a special - * feature of the GCC C compiler called "labels as values". This - * feature allows assigning pointers with the address of the code - * corresponding to a particular C label. - * - * For more information, see the GCC documentation: - * http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html - * - * Thanks to dividuum for finding the nice local scope label - * implementation. - */ - -#ifndef LC_ADDRLABELS_H_ -#define LC_ADDRLABELS_H_ - -/** \hideinitializer */ -typedef void * lc_t; - -#define LC_INIT(s) s = NULL - - -#define LC_RESUME(s) \ - do { \ - if(s != NULL) { \ - goto *s; \ - } \ - } while(0) - -#define LC_SET(s) \ - do { ({ __label__ resume; resume: (s) = &&resume; }); }while(0) - -#define LC_END(s) - -#endif /* LC_ADDRLABELS_H_ */ -/** @} */ diff --git a/os/sys/lc-switch.h b/os/sys/lc-switch.h deleted file mode 100644 index 8fcef3449..000000000 --- a/os/sys/lc-switch.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2004-2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \addtogroup lc - * @{ - */ - -/** - * \file - * Implementation of local continuations based on switch() statement - * \author Adam Dunkels - * - * This implementation of local continuations uses the C switch() - * statement to resume execution of a function somewhere inside the - * function's body. The implementation is based on the fact that - * switch() statements are able to jump directly into the bodies of - * control structures such as if() or while() statements. - * - * This implementation borrows heavily from Simon Tatham's coroutines - * implementation in C: - * http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html - */ - -#ifndef LC_SWITCH_H_ -#define LC_SWITCH_H_ - -/* WARNING! lc implementation using switch() does not work if an - LC_SET() is done within another switch() statement! */ - -/** \hideinitializer */ -typedef unsigned short lc_t; - -#define LC_INIT(s) s = 0; - -#define LC_RESUME(s) switch(s) { case 0: - -#define LC_SET(s) s = __LINE__; case __LINE__: - -#define LC_END(s) } - -#endif /* LC_SWITCH_H_ */ - -/** @} */ diff --git a/os/sys/lc.h b/os/sys/lc.h deleted file mode 100644 index e174008e5..000000000 --- a/os/sys/lc.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2004-2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \addtogroup pt - * @{ - */ - -/** - * \defgroup lc Local continuations - * @{ - * - * Local continuations form the basis for implementing protothreads. A - * local continuation can be set in a specific function to - * capture the state of the function. After a local continuation has - * been set can be resumed in order to restore the state of the - * function at the point where the local continuation was set. - * - * - */ - -/** - * \file os/sys/lc.h - * Local continuations - * \author - * Adam Dunkels - * - */ - -#ifdef DOXYGEN -/** - * Initialize a local continuation. - * - * This operation initializes the local continuation, thereby - * unsetting any previously set continuation state. - * - * \hideinitializer - */ -#define LC_INIT(lc) - -/** - * Set a local continuation. - * - * The set operation saves the state of the function at the point - * where the operation is executed. As far as the set operation is - * concerned, the state of the function does not include the - * call-stack or local (automatic) variables, but only the program - * counter and such CPU registers that needs to be saved. - * - * \hideinitializer - */ -#define LC_SET(lc) - -/** - * Resume a local continuation. - * - * The resume operation resumes a previously set local continuation, thus - * restoring the state in which the function was when the local - * continuation was set. If the local continuation has not been - * previously set, the resume operation does nothing. - * - * \hideinitializer - */ -#define LC_RESUME(lc) - -/** - * Mark the end of local continuation usage. - * - * The end operation signifies that local continuations should not be - * used any more in the function. This operation is not needed for - * most implementations of local continuation, but is required by a - * few implementations. - * - * \hideinitializer - */ -#define LC_END(lc) - -/** - * \var typedef lc_t; - * - * The local continuation type. - * - * \hideinitializer - */ -#endif /* DOXYGEN */ - -#ifndef LC_H_ -#define LC_H_ - -#ifdef LC_CONF_INCLUDE -#include LC_CONF_INCLUDE -#else /* LC_CONF_INCLUDE */ -#include "sys/lc-switch.h" -#endif /* LC_CONF_INCLUDE */ - -#endif /* LC_H_ */ - -/** @} */ -/** @} */ diff --git a/os/sys/log-conf.h b/os/sys/log-conf.h deleted file mode 100644 index 17d8562cc..000000000 --- a/os/sys/log-conf.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -* Copyright (c) 2017, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Default log levels for a number of modules - * \author - * Simon Duquennoy - */ - -/** \addtogroup sys - * @{ */ - -/** \addtogroup log -* @{ */ - -#ifndef __LOG_CONF_H__ -#define __LOG_CONF_H__ - -/* Log only the last 16 bytes of link-layer and IPv6 addresses (or, if) - * the deployment module is enabled, the node IDs */ -#ifdef LOG_CONF_WITH_COMPACT_ADDR -#define LOG_WITH_COMPACT_ADDR LOG_CONF_WITH_COMPACT_ADDR -#else /* LOG_CONF_WITH_COMPACT_ADDR */ -#define LOG_WITH_COMPACT_ADDR 0 -#endif /* LOG_CONF_WITH_COMPACT_ADDR */ - -/* Prefix all logs with file name and line-of-code */ -#ifdef LOG_CONF_WITH_LOC -#define LOG_WITH_LOC LOG_CONF_WITH_LOC -#else /* LOG_CONF_WITH_LOC */ -#define LOG_WITH_LOC 0 -#endif /* LOG_CONF_WITH_LOC */ - -/* Prefix all logs with Module name and logging level */ -#ifdef LOG_CONF_WITH_MODULE_PREFIX -#define LOG_WITH_MODULE_PREFIX LOG_CONF_WITH_MODULE_PREFIX -#else /* LOG_CONF_WITH_MODULE_PREFIX */ -#define LOG_WITH_MODULE_PREFIX 1 -#endif /* LOG_CONF_WITH_MODULE_PREFIX */ - -/* Cooja annotations */ -#ifdef LOG_CONF_WITH_ANNOTATE -#define LOG_WITH_ANNOTATE LOG_CONF_WITH_ANNOTATE -#else /* LOG_CONF_WITH_ANNOTATE */ -#define LOG_WITH_ANNOTATE 0 -#endif /* LOG_CONF_WITH_ANNOTATE */ - -/* Custom output function -- default is printf */ -#ifdef LOG_CONF_OUTPUT -#define LOG_OUTPUT(...) LOG_CONF_OUTPUT(__VA_ARGS__) -#else /* LOG_CONF_OUTPUT */ -#define LOG_OUTPUT(...) printf(__VA_ARGS__) -#endif /* LOG_CONF_OUTPUT */ - -/* - * Custom output function to prefix logs with level and module. - * - * This will only be called when LOG_CONF_WITH_MODULE_PREFIX is enabled and - * all implementations should be based on LOG_OUTPUT. - * - * \param level The log level - * \param levelstr The log level as string - * \param module The module string descriptor - */ -#ifdef LOG_CONF_OUTPUT_PREFIX -#define LOG_OUTPUT_PREFIX(level, levelstr, module) LOG_CONF_OUTPUT_PREFIX(level, levelstr, module) -#else /* LOG_CONF_OUTPUT_PREFIX */ -#define LOG_OUTPUT_PREFIX(level, levelstr, module) LOG_OUTPUT("[%-4s: %-10s] ", levelstr, module) -#endif /* LOG_CONF_OUTPUT_PREFIX */ - -/******************************************************************************/ -/********************* A list of currently supported modules ******************/ -/******************************************************************************/ - -#ifndef LOG_CONF_LEVEL_RPL -#define LOG_CONF_LEVEL_RPL LOG_LEVEL_NONE /* Only for rpl-lite */ -#endif /* LOG_CONF_LEVEL_RPL */ - -#ifndef LOG_CONF_LEVEL_TCPIP -#define LOG_CONF_LEVEL_TCPIP LOG_LEVEL_NONE -#endif /* LOG_CONF_LEVEL_TCPIP */ - -#ifndef LOG_CONF_LEVEL_IPV6 -#define LOG_CONF_LEVEL_IPV6 LOG_LEVEL_NONE -#endif /* LOG_CONF_LEVEL_IPV6 */ - -#ifndef LOG_CONF_LEVEL_6LOWPAN -#define LOG_CONF_LEVEL_6LOWPAN LOG_LEVEL_NONE -#endif /* LOG_CONF_LEVEL_6LOWPAN */ - -#ifndef LOG_CONF_LEVEL_NULLNET -#define LOG_CONF_LEVEL_NULLNET LOG_LEVEL_NONE -#endif /* LOG_CONF_LEVEL_NULLNET */ - -#ifndef LOG_CONF_LEVEL_MAC -#define LOG_CONF_LEVEL_MAC LOG_LEVEL_NONE -#endif /* LOG_CONF_LEVEL_MAC */ - -#ifndef LOG_CONF_LEVEL_FRAMER -#define LOG_CONF_LEVEL_FRAMER LOG_LEVEL_NONE -#endif /* LOG_CONF_LEVEL_FRAMER */ - -#ifndef LOG_CONF_LEVEL_6TOP -#define LOG_CONF_LEVEL_6TOP LOG_LEVEL_NONE -#endif /* LOG_CONF_LEVEL_6TOP */ - -#ifndef LOG_CONF_LEVEL_COAP -#define LOG_CONF_LEVEL_COAP LOG_LEVEL_NONE -#endif /* LOG_CONF_LEVEL_COAP */ - -#ifndef LOG_CONF_LEVEL_LWM2M -#define LOG_CONF_LEVEL_LWM2M LOG_LEVEL_NONE -#endif /* LOG_CONF_LEVEL_LWM2M */ - -#ifndef LOG_CONF_LEVEL_MAIN -#define LOG_CONF_LEVEL_MAIN LOG_LEVEL_INFO -#endif /* LOG_CONF_LEVEL_MAIN */ - -#endif /* __LOG_CONF_H__ */ - -/** @} */ -/** @} */ diff --git a/os/sys/log.c b/os/sys/log.c deleted file mode 100644 index abb960b98..000000000 --- a/os/sys/log.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2017, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the logging system - * \author - * Simon Duquennoy - */ - -/** \addtogroup sys - * @{ */ - -/** - * \defgroup log Per-module, per-level logging - * @{ - * - * The log module performs per-module, per-level logging - * - */ - -#include "sys/log.h" -#include "net/ipv6/ip64-addr.h" -#include "net/ipv6/uiplib.h" -#include "deployment/deployment.h" - -int curr_log_level_rpl = LOG_CONF_LEVEL_RPL; -int curr_log_level_tcpip = LOG_CONF_LEVEL_TCPIP; -int curr_log_level_ipv6 = LOG_CONF_LEVEL_IPV6; -int curr_log_level_6lowpan = LOG_CONF_LEVEL_6LOWPAN; -int curr_log_level_nullnet = LOG_CONF_LEVEL_NULLNET; -int curr_log_level_mac = LOG_CONF_LEVEL_MAC; -int curr_log_level_framer = LOG_CONF_LEVEL_FRAMER; -int curr_log_level_6top = LOG_CONF_LEVEL_6TOP; -int curr_log_level_coap = LOG_CONF_LEVEL_COAP; -int curr_log_level_lwm2m = LOG_CONF_LEVEL_LWM2M; -int curr_log_level_main = LOG_CONF_LEVEL_MAIN; - -struct log_module all_modules[] = { - {"rpl", &curr_log_level_rpl, LOG_CONF_LEVEL_RPL}, - {"tcpip", &curr_log_level_tcpip, LOG_CONF_LEVEL_TCPIP}, - {"ipv6", &curr_log_level_ipv6, LOG_CONF_LEVEL_IPV6}, - {"6lowpan", &curr_log_level_6lowpan, LOG_CONF_LEVEL_6LOWPAN}, - {"nullnet", &curr_log_level_nullnet, LOG_CONF_LEVEL_NULLNET}, - {"mac", &curr_log_level_mac, LOG_CONF_LEVEL_MAC}, - {"framer", &curr_log_level_framer, LOG_CONF_LEVEL_FRAMER}, - {"6top", &curr_log_level_6top, LOG_CONF_LEVEL_6TOP}, - {"coap", &curr_log_level_coap, LOG_CONF_LEVEL_COAP}, - {"lwm2m", &curr_log_level_lwm2m, LOG_CONF_LEVEL_LWM2M}, - {"main", &curr_log_level_main, LOG_CONF_LEVEL_MAIN}, - {NULL, NULL, 0}, -}; - -#if NETSTACK_CONF_WITH_IPV6 - -/*---------------------------------------------------------------------------*/ -void -log_6addr(const uip_ipaddr_t *ipaddr) -{ - char buf[UIPLIB_IPV6_MAX_STR_LEN]; - uiplib_ipaddr_snprint(buf, sizeof(buf), ipaddr); - LOG_OUTPUT("%s", buf); -} -/*---------------------------------------------------------------------------*/ -int -log_6addr_compact_snprint(char *buf, size_t size, const uip_ipaddr_t *ipaddr) -{ - if(ipaddr == NULL) { - return snprintf(buf, size, "6A-NULL"); - } else { - char *prefix = NULL; - if(uip_is_addr_mcast(ipaddr)) { - prefix = "6M"; - } else if(uip_is_addr_linklocal(ipaddr)) { - prefix = "6L"; - } else { - prefix = "6G"; - } -#if BUILD_WITH_DEPLOYMENT - return snprintf(buf, size, "%s-%03u", prefix, deployment_id_from_iid(ipaddr)); -#else /* BUILD_WITH_DEPLOYMENT */ - return snprintf(buf, size, "%s-%04x", prefix, UIP_HTONS(ipaddr->u16[sizeof(uip_ipaddr_t)/2-1])); -#endif /* BUILD_WITH_DEPLOYMENT */ - } -} -/*---------------------------------------------------------------------------*/ -void -log_6addr_compact(const uip_ipaddr_t *ipaddr) -{ - char buf[8]; - log_6addr_compact_snprint(buf, sizeof(buf), ipaddr); - LOG_OUTPUT("%s", buf); -} -#endif /* NETSTACK_CONF_WITH_IPV6 */ -/*---------------------------------------------------------------------------*/ -void -log_lladdr(const linkaddr_t *lladdr) -{ - if(lladdr == NULL) { - LOG_OUTPUT("(NULL LL addr)"); - return; - } else { - unsigned int i; - for(i = 0; i < LINKADDR_SIZE; i++) { - if(i > 0 && i % 2 == 0) { - LOG_OUTPUT("."); - } - LOG_OUTPUT("%02x", lladdr->u8[i]); - } - } -} -/*---------------------------------------------------------------------------*/ -void -log_lladdr_compact(const linkaddr_t *lladdr) -{ - if(lladdr == NULL || linkaddr_cmp(lladdr, &linkaddr_null)) { - LOG_OUTPUT("LL-NULL"); - } else { -#if BUILD_WITH_DEPLOYMENT - LOG_OUTPUT("LL-%04u", deployment_id_from_lladdr(lladdr)); -#else /* BUILD_WITH_DEPLOYMENT */ -#if LINKADDR_SIZE == 8 - LOG_OUTPUT("LL-%04x", UIP_HTONS(lladdr->u16[LINKADDR_SIZE/2-1])); -#elif LINKADDR_SIZE == 2 - LOG_OUTPUT("LL-%04x", UIP_HTONS(lladdr->u16)); -#endif -#endif /* BUILD_WITH_DEPLOYMENT */ - } -} -/*---------------------------------------------------------------------------*/ -void -log_set_level(const char *module, int level) -{ - if(level >= LOG_LEVEL_NONE && level <= LOG_LEVEL_DBG) { - int i = 0; - int module_all = !strcmp("all", module); - while(all_modules[i].name != NULL) { - if(module_all || !strcmp(module, all_modules[i].name)) { - *all_modules[i].curr_log_level = MIN(level, all_modules[i].max_log_level); - } - i++; - } - } -} -/*---------------------------------------------------------------------------*/ -int -log_get_level(const char *module) -{ - int i = 0; - if(module == NULL) { - return -1; - } - while(all_modules[i].name != NULL) { - if(!strcmp(module, all_modules[i].name)) { - return *all_modules[i].curr_log_level; - } - i++; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -const char * -log_level_to_str(int level) -{ - switch(level) { - case LOG_LEVEL_NONE: - return "None"; - case LOG_LEVEL_ERR: - return "Errors"; - case LOG_LEVEL_WARN: - return "Warnings"; - case LOG_LEVEL_INFO: - return "Info"; - case LOG_LEVEL_DBG: - return "Debug"; - default: - return "N/A"; - } -} -/** @} */ -/** @} */ diff --git a/os/sys/log.h b/os/sys/log.h deleted file mode 100644 index 0f5f840d2..000000000 --- a/os/sys/log.h +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2017, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the logging system - * \author - * Simon Duquennoy - */ - -/** \addtogroup sys - * @{ */ - -/** - * \defgroup log Per-module, per-level logging - * @{ - * - * The log module performs per-module, per-level logging - * - */ - -#ifndef __LOG_H__ -#define __LOG_H__ - -#include -#include "net/linkaddr.h" -#include "sys/log-conf.h" -#if NETSTACK_CONF_WITH_IPV6 -#include "net/ipv6/uip.h" -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -/* The different log levels available */ -#define LOG_LEVEL_NONE 0 /* No log */ -#define LOG_LEVEL_ERR 1 /* Errors */ -#define LOG_LEVEL_WARN 2 /* Warnings */ -#define LOG_LEVEL_INFO 3 /* Basic info */ -#define LOG_LEVEL_DBG 4 /* Detailled debug */ - -/* Per-module log level */ - -struct log_module { - const char *name; - int *curr_log_level; - int max_log_level; -}; - -extern int curr_log_level_rpl; -extern int curr_log_level_tcpip; -extern int curr_log_level_ipv6; -extern int curr_log_level_6lowpan; -extern int curr_log_level_nullnet; -extern int curr_log_level_mac; -extern int curr_log_level_framer; -extern int curr_log_level_6top; -extern int curr_log_level_coap; -extern int curr_log_level_lwm2m; -extern int curr_log_level_main; - -extern struct log_module all_modules[]; - -#define LOG_LEVEL_RPL MIN((LOG_CONF_LEVEL_RPL), curr_log_level_rpl) -#define LOG_LEVEL_TCPIP MIN((LOG_CONF_LEVEL_TCPIP), curr_log_level_tcpip) -#define LOG_LEVEL_IPV6 MIN((LOG_CONF_LEVEL_IPV6), curr_log_level_ipv6) -#define LOG_LEVEL_6LOWPAN MIN((LOG_CONF_LEVEL_6LOWPAN), curr_log_level_6lowpan) -#define LOG_LEVEL_NULLNET MIN((LOG_CONF_LEVEL_NULLNET), curr_log_level_nullnet) -#define LOG_LEVEL_MAC MIN((LOG_CONF_LEVEL_MAC), curr_log_level_mac) -#define LOG_LEVEL_FRAMER MIN((LOG_CONF_LEVEL_FRAMER), curr_log_level_framer) -#define LOG_LEVEL_6TOP MIN((LOG_CONF_LEVEL_6TOP), curr_log_level_6top) -#define LOG_LEVEL_COAP MIN((LOG_CONF_LEVEL_COAP), curr_log_level_coap) -#define LOG_LEVEL_LWM2M MIN((LOG_CONF_LEVEL_LWM2M), curr_log_level_lwm2m) -#define LOG_LEVEL_MAIN MIN((LOG_CONF_LEVEL_MAIN), curr_log_level_main) - -/* Main log function */ - -#define LOG(newline, level, levelstr, ...) do { \ - if(level <= (LOG_LEVEL)) { \ - if(newline) { \ - if(LOG_WITH_MODULE_PREFIX) { \ - LOG_OUTPUT_PREFIX(level, levelstr, LOG_MODULE); \ - } \ - if(LOG_WITH_LOC) { \ - LOG_OUTPUT("[%s: %d] ", __FILE__, __LINE__); \ - } \ - } \ - LOG_OUTPUT(__VA_ARGS__); \ - } \ - } while (0) - -/* For Cooja annotations */ -#define LOG_ANNOTATE(...) do { \ - if(LOG_WITH_ANNOTATE) { \ - LOG_OUTPUT(__VA_ARGS__); \ - } \ - } while (0) - -/* Link-layer address */ -#define LOG_LLADDR(level, lladdr) do { \ - if(level <= (LOG_LEVEL)) { \ - if(LOG_WITH_COMPACT_ADDR) { \ - log_lladdr_compact(lladdr); \ - } else { \ - log_lladdr(lladdr); \ - } \ - } \ - } while (0) - -/* IPv6 address */ -#define LOG_6ADDR(level, ipaddr) do { \ - if(level <= (LOG_LEVEL)) { \ - if(LOG_WITH_COMPACT_ADDR) { \ - log_6addr_compact(ipaddr); \ - } else { \ - log_6addr(ipaddr); \ - } \ - } \ - } while (0) - -/* More compact versions of LOG macros */ -#define LOG_PRINT(...) LOG(1, 0, "PRI", __VA_ARGS__) -#define LOG_ERR(...) LOG(1, LOG_LEVEL_ERR, "ERR", __VA_ARGS__) -#define LOG_WARN(...) LOG(1, LOG_LEVEL_WARN, "WARN", __VA_ARGS__) -#define LOG_INFO(...) LOG(1, LOG_LEVEL_INFO, "INFO", __VA_ARGS__) -#define LOG_DBG(...) LOG(1, LOG_LEVEL_DBG, "DBG", __VA_ARGS__) - -#define LOG_PRINT_(...) LOG(0, 0, "PRI", __VA_ARGS__) -#define LOG_ERR_(...) LOG(0, LOG_LEVEL_ERR, "ERR", __VA_ARGS__) -#define LOG_WARN_(...) LOG(0, LOG_LEVEL_WARN, "WARN", __VA_ARGS__) -#define LOG_INFO_(...) LOG(0, LOG_LEVEL_INFO, "INFO", __VA_ARGS__) -#define LOG_DBG_(...) LOG(0, LOG_LEVEL_DBG, "DBG", __VA_ARGS__) - -#define LOG_PRINT_LLADDR(...) LOG_LLADDR(0, __VA_ARGS__) -#define LOG_ERR_LLADDR(...) LOG_LLADDR(LOG_LEVEL_ERR, __VA_ARGS__) -#define LOG_WARN_LLADDR(...) LOG_LLADDR(LOG_LEVEL_WARN, __VA_ARGS__) -#define LOG_INFO_LLADDR(...) LOG_LLADDR(LOG_LEVEL_INFO, __VA_ARGS__) -#define LOG_DBG_LLADDR(...) LOG_LLADDR(LOG_LEVEL_DBG, __VA_ARGS__) - -#define LOG_PRINT_6ADDR(...) LOG_6ADDR(0, __VA_ARGS__) -#define LOG_ERR_6ADDR(...) LOG_6ADDR(LOG_LEVEL_ERR, __VA_ARGS__) -#define LOG_WARN_6ADDR(...) LOG_6ADDR(LOG_LEVEL_WARN, __VA_ARGS__) -#define LOG_INFO_6ADDR(...) LOG_6ADDR(LOG_LEVEL_INFO, __VA_ARGS__) -#define LOG_DBG_6ADDR(...) LOG_6ADDR(LOG_LEVEL_DBG, __VA_ARGS__) - -/* For checking log level. - As this builds on curr_log_level variables, this should not be used - in pre-processor macros. Use in a C 'if' statement instead, e.g.: - if(LOG_INFO_ENABLED) { ... } - Note that most compilers will still be able to strip the code out - for low enough log levels configurations. */ -#define LOG_ERR_ENABLED ((LOG_LEVEL) >= LOG_LEVEL_ERR) -#define LOG_WARN_ENABLED ((LOG_LEVEL) >= LOG_LEVEL_WARN) -#define LOG_INFO_ENABLED ((LOG_LEVEL) >= LOG_LEVEL_INFO) -#define LOG_DBG_ENABLED ((LOG_LEVEL) >= LOG_LEVEL_DBG) - -#if NETSTACK_CONF_WITH_IPV6 - -/** - * Logs an IPv6 address - * \param ipaddr The IPv6 address -*/ -void log_6addr(const uip_ipaddr_t *ipaddr); - -/** - * Logs an IPv6 address with a compact format - * \param ipaddr The IPv6 address -*/ -void log_6addr_compact(const uip_ipaddr_t *ipaddr); - -/** - * Write at most size - 1 characters of the IP address to the output string, - * in a compact representation. The output is always null-terminated, unless - * size is 0. - * - * \param buf A pointer to an output string with at least size bytes. - * \param size The max number of characters to write to the output string. - * \param ipaddr A pointer to a uip_ipaddr_t that will be printed with printf(). - */ -int log_6addr_compact_snprint(char *buf, size_t size, const uip_ipaddr_t *ipaddr); - -#endif /* NETSTACK_CONF_WITH_IPV6 */ - -/** - * Logs a link-layer address - * \param lladdr The link-layer address -*/ -void log_lladdr(const linkaddr_t *lladdr); - -/** - * Logs a link-layer address with a compact format - * \param lladdr The link-layer address -*/ -void log_lladdr_compact(const linkaddr_t *lladdr); - -/** - * Sets a log level at run-time. Logs are included in the firmware via - * the compile-time flags in log-conf.h, but this allows to force lower log - * levels, system-wide. - * \param module The target module string descriptor - * \param level The log level -*/ -void log_set_level(const char *module, int level); - -/** - * Returns the current log level. - * \param module The target module string descriptor - * \return The current log level -*/ -int log_get_level(const char *module); - -/** - * Returns a textual description of a log level - * \param level log level - * \return The textual description -*/ -const char *log_level_to_str(int level); - -#endif /* __LOG_H__ */ - -/** @} */ -/** @} */ diff --git a/os/sys/memory-barrier.h b/os/sys/memory-barrier.h deleted file mode 100644 index a89b4384b..000000000 --- a/os/sys/memory-barrier.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sys - * @{ - * - * \defgroup memory-barrier CPU/Compiler memory barriers - * @{ - * - * API for CPU/Compiler memory barriers - */ -/*---------------------------------------------------------------------------*/ -#ifndef MEMORY_BARRIER_H_ -#define MEMORY_BARRIER_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -/*---------------------------------------------------------------------------*/ -#ifdef MEMORY_BARRIER_CONF_ARCH_HEADER_PATH -#include MEMORY_BARRIER_CONF_ARCH_HEADER_PATH -#endif /* MEMORY_BARRIER_CONF_ARCH_HEADER_PATH */ -/*---------------------------------------------------------------------------*/ -#ifndef memory_barrier -/** - * \brief Insert a memory barrier - * - * It is the platform/CPU developer's responsibility to expand this macro to - * a function that creates a memory barrier. Calling this macro will otherwise - * not generate any code. - */ -#define memory_barrier() -#endif -/*---------------------------------------------------------------------------*/ -#endif /* MEMORY_BARRIER_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/sys/mutex.c b/os/sys/mutex.c deleted file mode 100644 index 54321f8e3..000000000 --- a/os/sys/mutex.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup mutex - * @{ - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "sys/mutex.h" -#include "sys/critical.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -bool -mutex_generic_try_lock(volatile mutex_t *mutex) -{ - bool success = false; - int_master_status_t status = critical_enter(); - - if(*mutex == MUTEX_STATUS_UNLOCKED) { - *mutex = MUTEX_STATUS_LOCKED; - success = true; - } - - critical_exit(status); - - return success; -} -/*---------------------------------------------------------------------------*/ -void -mutex_generic_unlock(volatile mutex_t *mutex) -{ - int_master_status_t status = critical_enter(); - - *mutex = MUTEX_STATUS_UNLOCKED; - - critical_exit(status); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/sys/mutex.h b/os/sys/mutex.h deleted file mode 100644 index 6695acaa9..000000000 --- a/os/sys/mutex.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sys - * @{ - * - * \defgroup mutex Mutexes - * @{ - * - * This library provides an API and generic implementation of mutexes. - * - * Calling code should manipulate mutexes through the mutex_try_lock() and - * mutex_unlock() macros. By default, those macros will expand to the generic - * mutex manipulation implementations provided here. While these will work, - * they do reply on disabling the master interrupt in order to perform the - * lock/unlock operation. - * - * It is possible to override those generic implementation with CPU-specific - * implementations that exploit synchronisation instructions. To do so, - * create a CPU-specific header file. In this file, define mutex_try_lock() - * and mutex_unlock() to expand to the respective CPU function names. These - * can (but do not have to) be inlined. Then define MUTEX_CONF_ARCH_HEADER_PATH - * as this header's filename. - */ -/*---------------------------------------------------------------------------*/ -#ifndef MUTEX_H_ -#define MUTEX_H_ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define MUTEX_STATUS_LOCKED 1 /** The mutex is locked */ -#define MUTEX_STATUS_UNLOCKED 0 /** The mutex is not locked */ -/*---------------------------------------------------------------------------*/ -#ifdef MUTEX_CONF_ARCH_HEADER_PATH -#include MUTEX_CONF_ARCH_HEADER_PATH -#endif /* MUTEX_CONF_ARCH_HEADER_PATH */ -/*---------------------------------------------------------------------------*/ -#if !MUTEX_CONF_HAS_MUTEX_T -/** - * \brief Mutex data type - * - * It is possible for the platform to override this with its own typedef. In - * this scenario, make sure to also define MUTEX_CONF_HAS_MUTEX_T as 1. - */ -typedef uint_fast8_t mutex_t; -#endif -/*---------------------------------------------------------------------------*/ -#ifndef mutex_try_lock -/** - * \brief Try to lock a mutex - * \param m A pointer to the mutex to be locked - * \retval true Locking succeeded - * \retval false Locking failed (the mutex is already locked) - * - * This macro will expand to mutex_generic_try_lock() or to a CPU-provided - * implementation. Platform-independent code should use this macro instead - * of mutex_generic_try_lock(). - */ -#define mutex_try_lock(m) mutex_generic_try_lock(m) -#endif - -#ifndef mutex_unlock -/** - * \brief Unlock a previously acquired mutex - * \param m A pointer to the mutex to be unlocked - * - * This macro will expand to mutex_generic_unlock() or to a CPU-provided - * implementation. Platform-independent code should use this macro instead - * of mutex_generic_unlock(). - */ -#define mutex_unlock(m) mutex_generic_unlock(m) -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief Try to lock a mutex - * \param mutex A pointer to the mutex to be locked - * \retval true Locking succeeded - * \retval false Locking failed (the mutex is already locked) - * - * Do not call this function directly. Use the mutex_try_lock() macro instead. - */ -bool mutex_generic_try_lock(volatile mutex_t *mutex); - -/** - * \brief Unlock a previously acquired mutex - * \param mutex A pointer to the mutex to be unlocked - * - * Do not call this function directly. Use the mutex_unlock() macro instead. - */ -void mutex_generic_unlock(volatile mutex_t *mutex); -/*---------------------------------------------------------------------------*/ -#endif /* MUTEX_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/sys/node-id.c b/os/sys/node-id.c deleted file mode 100644 index 2fd52f8dc..000000000 --- a/os/sys/node-id.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Node-id management - * \author - * Simon Duquennoy - */ - -#include "contiki.h" -#include "sys/node-id.h" -#include "net/linkaddr.h" -#include "services/deployment/deployment.h" - -uint16_t node_id = 0; - -void -node_id_init(void) { -#if BUILD_WITH_DEPLOYMENT - deployment_init(); -#else /* BUILD_WITH_DEPLOYMENT */ - /* Initialize with a default value derived from linkaddr */ - node_id = linkaddr_node_addr.u8[LINKADDR_SIZE - 1] - + (linkaddr_node_addr.u8[LINKADDR_SIZE - 2] << 8); -#endif /* BUILD_WITH_DEPLOYMENT */ -} diff --git a/os/sys/node-id.h b/os/sys/node-id.h deleted file mode 100644 index 58909ddaa..000000000 --- a/os/sys/node-id.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, RISE SICS. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - - /** - * \addtogroup node-id - * @{ - * - * \file - * Node-id (simple 16-bit identifiers) handling - * \author Simon Duquennoy - * - */ - -#ifndef NODE_ID_H_ -#define NODE_ID_H_ - -/* A global variable that hosts the node ID */ -extern uint16_t node_id; -/** - * Initialize the node ID. Must be called after initialized of linkaddr - */ -void node_id_init(void); - -#endif /* NODE_ID_H_ */ - /** @} */ - diff --git a/os/sys/platform.h b/os/sys/platform.h deleted file mode 100644 index e6edf2488..000000000 --- a/os/sys/platform.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup sys - * @{ - */ -/*---------------------------------------------------------------------------*/ -/** - * \defgroup main The \os main function - * - * A platform-independent main function. - * - * \os provides a modular, platform-independent main function that aims to - * support all hardware ports. - * - * In a nutshell, the main routine has the following steps below: - * - * - Calls a platform-provided function to initialise basic hardware drivers - * - Initialises core \os modules, such as the process scheduler and timers - * - Calls a platform-provided function to initialise more hardware drivers - * - Initialises the network stack and TCP/IP - * - Calls a platform-provided function to initialise any remaining drivers - * - Enters the main loop - * - * The main loop will service all pending events and will then call a - * platform-dependent function to put the hardware in a low-power state. - * - * For more detail of which hardware driver should be implemented in which - * stage of the boot process, see the documentation of - * \e platform_init_stage_one(), \e platform_init_stage_two() and - * \e platform_init_stage_three() - * - * @{ - */ -/*---------------------------------------------------------------------------*/ -/** - * \file - * - * Header file for the \os main routine - */ -/*---------------------------------------------------------------------------*/ -#ifndef PLATFORM_H_ -#define PLATFORM_H_ -/*---------------------------------------------------------------------------*/ -/** - * Controls whether the platform provides a custom main loop - * - * By default we will use the main loop provided here. This however does not - * work for some platforms, so we allow them to override it. - */ -#ifdef PLATFORM_CONF_PROVIDES_MAIN_LOOP -#define PLATFORM_PROVIDES_MAIN_LOOP PLATFORM_CONF_PROVIDES_MAIN_LOOP -#else -#define PLATFORM_PROVIDES_MAIN_LOOP 0 -#endif -/*---------------------------------------------------------------------------*/ -/** - * Controls whether the main function accepts arguments - * - * By default our main does not accept arguments. However, when running on - * native targets, command line arguments to main are required. - */ -#ifdef PLATFORM_CONF_MAIN_ACCEPTS_ARGS -#define PLATFORM_MAIN_ACCEPTS_ARGS PLATFORM_CONF_MAIN_ACCEPTS_ARGS -#else -#define PLATFORM_MAIN_ACCEPTS_ARGS 0 -#endif -/*---------------------------------------------------------------------------*/ -/** - * \brief Basic (Stage 1) platform driver initialisation. - * - * This function will get called early on in the \os boot sequence. - * - * In this function, the platform should initialise all core device drivers. - * For example, this is where you will normally want to initialise hardware - * timers/clocks, GPIO, LEDS. Normally this function will also enable the - * MCU's global interrupt. - * - * The \os process scheduler, software clocks and timers will not be - * running yet, so any platform drivers that rely on it should not be - * initialised here. Instead, they should be initialised in - * \e platform_init_stage_two() or in \e platform_init_stage_three() - * - * It is the port developer's responsibility to implement this function. - * - * \sa platform_init_stage_two() - * \sa platform_init_stage_three() - */ -void platform_init_stage_one(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Stage 2 of platform driver initialisation. - * - * This function will be called by the \os boot sequence after parts of the - * core have been initialised. More specifically, when this function gets - * called, the following modules will be running: - * - * - Software clock - * - Process scheduler - * - Event timer (etimer) - * - Callback timer (ctimer) - * - rtimer - * - Energest (if enabled) - * - * Therefore, any platform driver that relies on any of the above modules - * should be initialised here or in \e platform_init_stage_three(), - * but not in \e platform_init_stage_one() - * - * The \os network stack will not be running yet, so any platform drivers - * that rely on networking should not be initialised here. - * - * When this function returns, the main routine will assume that the - * platform has enabled character I/O and can print to console. When - * this function returns, main() will attempt to initialise the network - * stack. For this to work properly, this function should also populate - * linkaddr_node_addr. - * - * It is the port developer's responsibility to implement this function. - * - * \sa platform_init_stage_one() - * \sa platform_init_stage_three() - */ -void platform_init_stage_two(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Final stage of platform driver initialisation. - * - * Initialisation of platform-specific drivers that require networking to be - * running. This is also a good place to initialise sensor drivers. - * - * When this function returns, the main routine will assume that the - * hardware is fully initialised. - * - * It is the port developer's responsibility to implement this function. - * - * \sa platform_init_stage_one() - * \sa platform_init_stage_two() - */ -void platform_init_stage_three(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief The platform's idle/sleep function - * - * This function will be called as part of the main loop after all events - * have been serviced. This is where you will normally put the device in a - * low-power state. Waking up from this state and tidying up the hardware - * is the port's responsibility. - * - * It is the port developer's responsibility to implement this function. - */ -void platform_idle(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief The platform's main loop, if provided - * - * If the platform developer wishes to do so, it is possible to override the - * main loop provided by \os's core. To do so, define - * PLATFORM_CONF_PROVIDES_MAIN_LOOP as 1. - * - * It is the port developer's responsibility to implement this function. - */ -void platform_main_loop(void); -/*---------------------------------------------------------------------------*/ -/** - * \brief Allow the platform to process main's command line arguments - * - * If the platform wishes main() to accept arguments, then the \os main will - * call this function here so that the platform can process/store those - * arguments. - * - * This function will only get called if PLATFORM_MAIN_ACCEPTS_ARGS - * is non-zero. - * - * It is the port developer's responsibility to implement this function. - */ -void platform_process_args(int argc, char**argv); -/*---------------------------------------------------------------------------*/ -#endif /* PLATFORM_H_ */ -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/os/sys/process.c b/os/sys/process.c deleted file mode 100644 index 83e2b6b5d..000000000 --- a/os/sys/process.c +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup process - * @{ - */ - -/** - * \file - * Implementation of the Contiki process kernel. - * \author - * Adam Dunkels - * - */ - -#include - -#include "contiki.h" -#include "sys/process.h" - -/* - * Pointer to the currently running process structure. - */ -struct process *process_list = NULL; -struct process *process_current = NULL; - -static process_event_t lastevent; - -/* - * Structure used for keeping the queue of active events. - */ -struct event_data { - process_event_t ev; - process_data_t data; - struct process *p; -}; - -static process_num_events_t nevents, fevent; -static struct event_data events[PROCESS_CONF_NUMEVENTS]; - -#if PROCESS_CONF_STATS -process_num_events_t process_maxevents; -#endif - -static volatile unsigned char poll_requested; - -#define PROCESS_STATE_NONE 0 -#define PROCESS_STATE_RUNNING 1 -#define PROCESS_STATE_CALLED 2 - -static void call_process(struct process *p, process_event_t ev, process_data_t data); - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -/*---------------------------------------------------------------------------*/ -process_event_t -process_alloc_event(void) -{ - return lastevent++; -} -/*---------------------------------------------------------------------------*/ -void -process_start(struct process *p, process_data_t data) -{ - struct process *q; - - /* First make sure that we don't try to start a process that is - already running. */ - for(q = process_list; q != p && q != NULL; q = q->next); - - /* If we found the process on the process list, we bail out. */ - if(q == p) { - return; - } - /* Put on the procs list.*/ - p->next = process_list; - process_list = p; - p->state = PROCESS_STATE_RUNNING; - PT_INIT(&p->pt); - - PRINTF("process: starting '%s'\n", PROCESS_NAME_STRING(p)); - - /* Post a synchronous initialization event to the process. */ - process_post_synch(p, PROCESS_EVENT_INIT, data); -} -/*---------------------------------------------------------------------------*/ -static void -exit_process(struct process *p, struct process *fromprocess) -{ - register struct process *q; - struct process *old_current = process_current; - - PRINTF("process: exit_process '%s'\n", PROCESS_NAME_STRING(p)); - - /* Make sure the process is in the process list before we try to - exit it. */ - for(q = process_list; q != p && q != NULL; q = q->next); - if(q == NULL) { - return; - } - - if(process_is_running(p)) { - /* Process was running */ - p->state = PROCESS_STATE_NONE; - - /* - * Post a synchronous event to all processes to inform them that - * this process is about to exit. This will allow services to - * deallocate state associated with this process. - */ - for(q = process_list; q != NULL; q = q->next) { - if(p != q) { - call_process(q, PROCESS_EVENT_EXITED, (process_data_t)p); - } - } - - if(p->thread != NULL && p != fromprocess) { - /* Post the exit event to the process that is about to exit. */ - process_current = p; - p->thread(&p->pt, PROCESS_EVENT_EXIT, NULL); - } - } - - if(p == process_list) { - process_list = process_list->next; - } else { - for(q = process_list; q != NULL; q = q->next) { - if(q->next == p) { - q->next = p->next; - break; - } - } - } - - process_current = old_current; -} -/*---------------------------------------------------------------------------*/ -static void -call_process(struct process *p, process_event_t ev, process_data_t data) -{ - int ret; - -#if DEBUG - if(p->state == PROCESS_STATE_CALLED) { - printf("process: process '%s' called again with event %d\n", PROCESS_NAME_STRING(p), ev); - } -#endif /* DEBUG */ - - if((p->state & PROCESS_STATE_RUNNING) && - p->thread != NULL) { - PRINTF("process: calling process '%s' with event %d\n", PROCESS_NAME_STRING(p), ev); - process_current = p; - p->state = PROCESS_STATE_CALLED; - ret = p->thread(&p->pt, ev, data); - if(ret == PT_EXITED || - ret == PT_ENDED || - ev == PROCESS_EVENT_EXIT) { - exit_process(p, p); - } else { - p->state = PROCESS_STATE_RUNNING; - } - } -} -/*---------------------------------------------------------------------------*/ -void -process_exit(struct process *p) -{ - exit_process(p, PROCESS_CURRENT()); -} -/*---------------------------------------------------------------------------*/ -void -process_init(void) -{ - lastevent = PROCESS_EVENT_MAX; - - nevents = fevent = 0; -#if PROCESS_CONF_STATS - process_maxevents = 0; -#endif /* PROCESS_CONF_STATS */ - - process_current = process_list = NULL; -} -/*---------------------------------------------------------------------------*/ -/* - * Call each process' poll handler. - */ -/*---------------------------------------------------------------------------*/ -static void -do_poll(void) -{ - struct process *p; - - poll_requested = 0; - /* Call the processes that needs to be polled. */ - for(p = process_list; p != NULL; p = p->next) { - if(p->needspoll) { - p->state = PROCESS_STATE_RUNNING; - p->needspoll = 0; - call_process(p, PROCESS_EVENT_POLL, NULL); - } - } -} -/*---------------------------------------------------------------------------*/ -/* - * Process the next event in the event queue and deliver it to - * listening processes. - */ -/*---------------------------------------------------------------------------*/ -static void -do_event(void) -{ - process_event_t ev; - process_data_t data; - struct process *receiver; - struct process *p; - - /* - * If there are any events in the queue, take the first one and walk - * through the list of processes to see if the event should be - * delivered to any of them. If so, we call the event handler - * function for the process. We only process one event at a time and - * call the poll handlers inbetween. - */ - - if(nevents > 0) { - - /* There are events that we should deliver. */ - ev = events[fevent].ev; - - data = events[fevent].data; - receiver = events[fevent].p; - - /* Since we have seen the new event, we move pointer upwards - and decrease the number of events. */ - fevent = (fevent + 1) % PROCESS_CONF_NUMEVENTS; - --nevents; - - /* If this is a broadcast event, we deliver it to all events, in - order of their priority. */ - if(receiver == PROCESS_BROADCAST) { - for(p = process_list; p != NULL; p = p->next) { - - /* If we have been requested to poll a process, we do this in - between processing the broadcast event. */ - if(poll_requested) { - do_poll(); - } - call_process(p, ev, data); - } - } else { - /* This is not a broadcast event, so we deliver it to the - specified process. */ - /* If the event was an INIT event, we should also update the - state of the process. */ - if(ev == PROCESS_EVENT_INIT) { - receiver->state = PROCESS_STATE_RUNNING; - } - - /* Make sure that the process actually is running. */ - call_process(receiver, ev, data); - } - } -} -/*---------------------------------------------------------------------------*/ -int -process_run(void) -{ - /* Process poll events. */ - if(poll_requested) { - do_poll(); - } - - /* Process one event from the queue */ - do_event(); - - return nevents + poll_requested; -} -/*---------------------------------------------------------------------------*/ -int -process_nevents(void) -{ - return nevents + poll_requested; -} -/*---------------------------------------------------------------------------*/ -int -process_post(struct process *p, process_event_t ev, process_data_t data) -{ - process_num_events_t snum; - - if(PROCESS_CURRENT() == NULL) { - PRINTF("process_post: NULL process posts event %d to process '%s', nevents %d\n", - ev,PROCESS_NAME_STRING(p), nevents); - } else { - PRINTF("process_post: Process '%s' posts event %d to process '%s', nevents %d\n", - PROCESS_NAME_STRING(PROCESS_CURRENT()), ev, - p == PROCESS_BROADCAST? "": PROCESS_NAME_STRING(p), nevents); - } - - if(nevents == PROCESS_CONF_NUMEVENTS) { -#if DEBUG - if(p == PROCESS_BROADCAST) { - printf("soft panic: event queue is full when broadcast event %d was posted from %s\n", ev, PROCESS_NAME_STRING(process_current)); - } else { - printf("soft panic: event queue is full when event %d was posted to %s from %s\n", ev, PROCESS_NAME_STRING(p), PROCESS_NAME_STRING(process_current)); - } -#endif /* DEBUG */ - return PROCESS_ERR_FULL; - } - - snum = (process_num_events_t)(fevent + nevents) % PROCESS_CONF_NUMEVENTS; - events[snum].ev = ev; - events[snum].data = data; - events[snum].p = p; - ++nevents; - -#if PROCESS_CONF_STATS - if(nevents > process_maxevents) { - process_maxevents = nevents; - } -#endif /* PROCESS_CONF_STATS */ - - return PROCESS_ERR_OK; -} -/*---------------------------------------------------------------------------*/ -void -process_post_synch(struct process *p, process_event_t ev, process_data_t data) -{ - struct process *caller = process_current; - - call_process(p, ev, data); - process_current = caller; -} -/*---------------------------------------------------------------------------*/ -void -process_poll(struct process *p) -{ - if(p != NULL) { - if(p->state == PROCESS_STATE_RUNNING || - p->state == PROCESS_STATE_CALLED) { - p->needspoll = 1; - poll_requested = 1; - } - } -} -/*---------------------------------------------------------------------------*/ -int -process_is_running(struct process *p) -{ - return p->state != PROCESS_STATE_NONE; -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/sys/process.h b/os/sys/process.h deleted file mode 100644 index 5cffdb526..000000000 --- a/os/sys/process.h +++ /dev/null @@ -1,531 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup threads - * @{ - */ - -/** - * \defgroup process Contiki processes - * - * A process in Contiki consists of a single protothread. - * - * @{ - */ - -/** - * \file - * Header file for the Contiki process interface. - * \author - * Adam Dunkels - * - */ -#ifndef PROCESS_H_ -#define PROCESS_H_ - -#include "sys/pt.h" -#include "sys/cc.h" - -typedef unsigned char process_event_t; -typedef void * process_data_t; -typedef unsigned char process_num_events_t; - -/** - * \name Return values - * @{ - */ - -/** - * \brief Return value indicating that an operation was successful. - * - * This value is returned to indicate that an operation - * was successful. - */ -#define PROCESS_ERR_OK 0 -/** - * \brief Return value indicating that the event queue was full. - * - * This value is returned from process_post() to indicate - * that the event queue was full and that an event could - * not be posted. - */ -#define PROCESS_ERR_FULL 1 -/* @} */ - -#define PROCESS_NONE NULL - -#ifndef PROCESS_CONF_NUMEVENTS -#define PROCESS_CONF_NUMEVENTS 32 -#endif /* PROCESS_CONF_NUMEVENTS */ - -#define PROCESS_EVENT_NONE 0x80 -#define PROCESS_EVENT_INIT 0x81 -#define PROCESS_EVENT_POLL 0x82 -#define PROCESS_EVENT_EXIT 0x83 -#define PROCESS_EVENT_SERVICE_REMOVED 0x84 -#define PROCESS_EVENT_CONTINUE 0x85 -#define PROCESS_EVENT_MSG 0x86 -#define PROCESS_EVENT_EXITED 0x87 -#define PROCESS_EVENT_TIMER 0x88 -#define PROCESS_EVENT_COM 0x89 -#define PROCESS_EVENT_MAX 0x8a - -#define PROCESS_BROADCAST NULL -#define PROCESS_ZOMBIE ((struct process *)0x1) - -/** - * \name Process protothread functions - * @{ - */ - -/** - * Define the beginning of a process. - * - * This macro defines the beginning of a process, and must always - * appear in a PROCESS_THREAD() definition. The PROCESS_END() macro - * must come at the end of the process. - * - * \hideinitializer - */ -#define PROCESS_BEGIN() PT_BEGIN(process_pt) - -/** - * Define the end of a process. - * - * This macro defines the end of a process. It must appear in a - * PROCESS_THREAD() definition and must always be included. The - * process exits when the PROCESS_END() macro is reached. - * - * \hideinitializer - */ -#define PROCESS_END() PT_END(process_pt) - -/** - * Wait for an event to be posted to the process. - * - * This macro blocks the currently running process until the process - * receives an event. - * - * \hideinitializer - */ -#define PROCESS_WAIT_EVENT() PROCESS_YIELD() - -/** - * Wait for an event to be posted to the process, with an extra - * condition. - * - * This macro is similar to PROCESS_WAIT_EVENT() in that it blocks the - * currently running process until the process receives an event. But - * PROCESS_WAIT_EVENT_UNTIL() takes an extra condition which must be - * true for the process to continue. - * - * \param c The condition that must be true for the process to continue. - * \sa PT_WAIT_UNTIL() - * - * \hideinitializer - */ -#define PROCESS_WAIT_EVENT_UNTIL(c) PROCESS_YIELD_UNTIL(c) - -/** - * Yield the currently running process. - * - * \hideinitializer - */ -#define PROCESS_YIELD() PT_YIELD(process_pt) - -/** - * Yield the currently running process until a condition occurs. - * - * This macro is different from PROCESS_WAIT_UNTIL() in that - * PROCESS_YIELD_UNTIL() is guaranteed to always yield at least - * once. This ensures that the process does not end up in an infinite - * loop and monopolizing the CPU. - * - * \param c The condition to wait for. - * - * \hideinitializer - */ -#define PROCESS_YIELD_UNTIL(c) PT_YIELD_UNTIL(process_pt, c) - -/** - * Wait for a condition to occur. - * - * This macro does not guarantee that the process yields, and should - * therefore be used with care. In most cases, PROCESS_WAIT_EVENT(), - * PROCESS_WAIT_EVENT_UNTIL(), PROCESS_YIELD() or - * PROCESS_YIELD_UNTIL() should be used instead. - * - * \param c The condition to wait for. - * - * \hideinitializer - */ -#define PROCESS_WAIT_UNTIL(c) PT_WAIT_UNTIL(process_pt, c) -#define PROCESS_WAIT_WHILE(c) PT_WAIT_WHILE(process_pt, c) - -/** - * Exit the currently running process. - * - * \hideinitializer - */ -#define PROCESS_EXIT() PT_EXIT(process_pt) - -/** - * Spawn a protothread from the process. - * - * \param pt The protothread state (struct pt) for the new protothread - * \param thread The call to the protothread function. - * \sa PT_SPAWN() - * - * \hideinitializer - */ -#define PROCESS_PT_SPAWN(pt, thread) PT_SPAWN(process_pt, pt, thread) - -/** - * Yield the process for a short while. - * - * This macro yields the currently running process for a short while, - * thus letting other processes run before the process continues. - * - * \hideinitializer - */ -#define PROCESS_PAUSE() do { \ - process_post(PROCESS_CURRENT(), PROCESS_EVENT_CONTINUE, NULL); \ - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_CONTINUE); \ -} while(0) - -/** @} end of protothread functions */ - -/** - * \name Poll and exit handlers - * @{ - */ -/** - * Specify an action when a process is polled. - * - * \note This declaration must come immediately before the - * PROCESS_BEGIN() macro. - * - * \param handler The action to be performed. - * - * \hideinitializer - */ -#define PROCESS_POLLHANDLER(handler) if(ev == PROCESS_EVENT_POLL) { handler; } - -/** - * Specify an action when a process exits. - * - * \note This declaration must come immediately before the - * PROCESS_BEGIN() macro. - * - * \param handler The action to be performed. - * - * \hideinitializer - */ -#define PROCESS_EXITHANDLER(handler) if(ev == PROCESS_EVENT_EXIT) { handler; } - -/** @} */ - -/** - * \name Process declaration and definition - * @{ - */ - -/** - * Define the body of a process. - * - * This macro is used to define the body (protothread) of a - * process. The process is called whenever an event occurs in the - * system, A process always start with the PROCESS_BEGIN() macro and - * end with the PROCESS_END() macro. - * - * \hideinitializer - */ -#define PROCESS_THREAD(name, ev, data) \ -static PT_THREAD(process_thread_##name(struct pt *process_pt, \ - process_event_t ev, \ - process_data_t data)) - -/** - * Declare the name of a process. - * - * This macro is typically used in header files to declare the name of - * a process that is implemented in the C file. - * - * \hideinitializer - */ -#define PROCESS_NAME(name) extern struct process name - -/** - * Declare a process. - * - * This macro declares a process. The process has two names: the - * variable of the process structure, which is used by the C program, - * and a human readable string name, which is used when debugging. - * A configuration option allows removal of the readable name to save RAM. - * - * \param name The variable name of the process structure. - * \param strname The string representation of the process' name. - * - * \hideinitializer - */ -#if PROCESS_CONF_NO_PROCESS_NAMES -#define PROCESS(name, strname) \ - PROCESS_THREAD(name, ev, data); \ - struct process name = { NULL, \ - process_thread_##name } -#else -#define PROCESS(name, strname) \ - PROCESS_THREAD(name, ev, data); \ - struct process name = { NULL, strname, \ - process_thread_##name } -#endif - -/** @} */ - -struct process { - struct process *next; -#if PROCESS_CONF_NO_PROCESS_NAMES -#define PROCESS_NAME_STRING(process) "" -#else - const char *name; -#define PROCESS_NAME_STRING(process) (process)->name -#endif - PT_THREAD((* thread)(struct pt *, process_event_t, process_data_t)); - struct pt pt; - unsigned char state, needspoll; -}; - -/** - * \name Functions called from application programs - * @{ - */ - -/** - * Start a process. - * - * \param p A pointer to a process structure. - * - * \param data An argument pointer that can be passed to the new - * process - * - */ -void process_start(struct process *p, process_data_t data); - -/** - * Post an asynchronous event. - * - * This function posts an asynchronous event to one or more - * processes. The handing of the event is deferred until the target - * process is scheduled by the kernel. An event can be broadcast to - * all processes, in which case all processes in the system will be - * scheduled to handle the event. - * - * \param ev The event to be posted. - * - * \param data The auxiliary data to be sent with the event - * - * \param p The process to which the event should be posted, or - * PROCESS_BROADCAST if the event should be posted to all processes. - * - * \retval PROCESS_ERR_OK The event could be posted. - * - * \retval PROCESS_ERR_FULL The event queue was full and the event could - * not be posted. - */ -int process_post(struct process *p, process_event_t ev, process_data_t data); - -/** - * Post a synchronous event to a process. - * - * \param p A pointer to the process' process structure. - * - * \param ev The event to be posted. - * - * \param data A pointer to additional data that is posted together - * with the event. - */ -void process_post_synch(struct process *p, - process_event_t ev, process_data_t data); - -/** - * \brief Cause a process to exit - * \param p The process that is to be exited - * - * This function causes a process to exit. The process can - * either be the currently executing process, or another - * process that is currently running. - * - * \sa PROCESS_CURRENT() - */ -void process_exit(struct process *p); - - -/** - * Get a pointer to the currently running process. - * - * This macro get a pointer to the currently running - * process. Typically, this macro is used to post an event to the - * current process with process_post(). - * - * \hideinitializer - */ -#define PROCESS_CURRENT() process_current -extern struct process *process_current; - -/** - * Switch context to another process - * - * This function switch context to the specified process and executes - * the code as if run by that process. Typical use of this function is - * to switch context in services, called by other processes. Each - * PROCESS_CONTEXT_BEGIN() must be followed by the - * PROCESS_CONTEXT_END() macro to end the context switch. - * - * Example: - \code - PROCESS_CONTEXT_BEGIN(&test_process); - etimer_set(&timer, CLOCK_SECOND); - PROCESS_CONTEXT_END(&test_process); - \endcode - * - * \param p The process to use as context - * - * \sa PROCESS_CONTEXT_END() - * \sa PROCESS_CURRENT() - */ -#define PROCESS_CONTEXT_BEGIN(p) {\ -struct process *tmp_current = PROCESS_CURRENT();\ -process_current = p - -/** - * End a context switch - * - * This function ends a context switch and changes back to the - * previous process. - * - * \param p The process used in the context switch - * - * \sa PROCESS_CONTEXT_START() - */ -#define PROCESS_CONTEXT_END(p) process_current = tmp_current; } - -/** - * \brief Allocate a global event number. - * \return The allocated event number - * - * In Contiki, event numbers above 128 are global and may - * be posted from one process to another. This function - * allocates one such event number. - * - * \note There currently is no way to deallocate an allocated event - * number. - */ -process_event_t process_alloc_event(void); - -/** @} */ - -/** - * \name Functions called from device drivers - * @{ - */ - -/** - * Request a process to be polled. - * - * This function typically is called from an interrupt handler to - * cause a process to be polled. - * - * \param p A pointer to the process' process structure. - */ -void process_poll(struct process *p); - -/** @} */ - -/** - * \name Functions called by the system and boot-up code - * @{ - */ - -/** - * \brief Initialize the process module. - * - * This function initializes the process module and should - * be called by the system boot-up code. - */ -void process_init(void); - -/** - * Run the system once - call poll handlers and process one event. - * - * This function should be called repeatedly from the main() program - * to actually run the Contiki system. It calls the necessary poll - * handlers, and processes one event. The function returns the number - * of events that are waiting in the event queue so that the caller - * may choose to put the CPU to sleep when there are no pending - * events. - * - * \return The number of events that are currently waiting in the - * event queue. - */ -int process_run(void); - - -/** - * Check if a process is running. - * - * This function checks if a specific process is running. - * - * \param p The process. - * \retval Non-zero if the process is running. - * \retval Zero if the process is not running. - */ -int process_is_running(struct process *p); - -/** - * Number of events waiting to be processed. - * - * \return The number of events that are currently waiting to be - * processed. - */ -int process_nevents(void); - -/** @} */ - -extern struct process *process_list; - -#define PROCESS_LIST() process_list - -#endif /* PROCESS_H_ */ - -/** @} */ -/** @} */ diff --git a/os/sys/pt-sem.h b/os/sys/pt-sem.h deleted file mode 100644 index 27effa57a..000000000 --- a/os/sys/pt-sem.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \addtogroup pt - * @{ - */ - -/** - * \defgroup ptsem Protothread semaphores - * @{ - * - * This module implements counting semaphores on top of - * protothreads. Semaphores are a synchronization primitive that - * provide two operations: "wait" and "signal". The "wait" operation - * checks the semaphore counter and blocks the thread if the counter - * is zero. The "signal" operation increases the semaphore counter but - * does not block. If another thread has blocked waiting for the - * semaphore that is signaled, the blocked thread will become - * runnable again. - * - * Semaphores can be used to implement other, more structured, - * synchronization primitives such as monitors and message - * queues/bounded buffers (see below). - * - * The following example shows how the producer-consumer problem, also - * known as the bounded buffer problem, can be solved using - * protothreads and semaphores. Notes on the program follow after the - * example. - * - \code -#include "pt-sem.h" - -#define NUM_ITEMS 32 -#define BUFSIZE 8 - -static struct pt_sem mutex, full, empty; - -PT_THREAD(producer(struct pt *pt)) -{ - static int produced; - - PT_BEGIN(pt); - - for(produced = 0; produced < NUM_ITEMS; ++produced) { - - PT_SEM_WAIT(pt, &full); - - PT_SEM_WAIT(pt, &mutex); - add_to_buffer(produce_item()); - PT_SEM_SIGNAL(pt, &mutex); - - PT_SEM_SIGNAL(pt, &empty); - } - - PT_END(pt); -} - -PT_THREAD(consumer(struct pt *pt)) -{ - static int consumed; - - PT_BEGIN(pt); - - for(consumed = 0; consumed < NUM_ITEMS; ++consumed) { - - PT_SEM_WAIT(pt, &empty); - - PT_SEM_WAIT(pt, &mutex); - consume_item(get_from_buffer()); - PT_SEM_SIGNAL(pt, &mutex); - - PT_SEM_SIGNAL(pt, &full); - } - - PT_END(pt); -} - -PT_THREAD(driver_thread(struct pt *pt)) -{ - static struct pt pt_producer, pt_consumer; - - PT_BEGIN(pt); - - PT_SEM_INIT(&empty, 0); - PT_SEM_INIT(&full, BUFSIZE); - PT_SEM_INIT(&mutex, 1); - - PT_INIT(&pt_producer); - PT_INIT(&pt_consumer); - - PT_WAIT_THREAD(pt, producer(&pt_producer) & - consumer(&pt_consumer)); - - PT_END(pt); -} - \endcode - * - * The program uses three protothreads: one protothread that - * implements the consumer, one thread that implements the producer, - * and one protothread that drives the two other protothreads. The - * program uses three semaphores: "full", "empty" and "mutex". The - * "mutex" semaphore is used to provide mutual exclusion for the - * buffer, the "empty" semaphore is used to block the consumer is the - * buffer is empty, and the "full" semaphore is used to block the - * producer is the buffer is full. - * - * The "driver_thread" holds two protothread state variables, - * "pt_producer" and "pt_consumer". It is important to note that both - * these variables are declared as static. If the static - * keyword is not used, both variables are stored on the stack. Since - * protothreads do not store the stack, these variables may be - * overwritten during a protothread wait operation. Similarly, both - * the "consumer" and "producer" protothreads declare their local - * variables as static, to avoid them being stored on the stack. - * - * - */ - -/** - * \file - * Counting semaphores implemented on protothreads - * \author - * Adam Dunkels - * - */ - -#ifndef PT_SEM_H_ -#define PT_SEM_H_ - -#include "sys/pt.h" - -struct pt_sem { - unsigned int head, tail; -}; - -#define PT_SEM_COUNT(s) ((s)->head - (s)->tail) - -/** - * Initialize a semaphore - * - * This macro initializes a semaphore with a value for the - * counter. Internally, the semaphores use an "unsigned int" to - * represent the counter, and therefore the "count" argument should be - * within range of an unsigned int. - * - * \param s (struct pt_sem *) A pointer to the pt_sem struct - * representing the semaphore - * - * \param c (unsigned int) The initial count of the semaphore. - * \hideinitializer - */ -#define PT_SEM_INIT(s, c) \ - do { \ - (s)->tail = 0; \ - (s)->head = (c); \ - } while(0) - -/** - * Wait for a semaphore - * - * This macro carries out the "wait" operation on the semaphore. The - * wait operation causes the protothread to block while the counter is - * zero. When the counter reaches a value larger than zero, the - * protothread will continue. - * - * \param pt (struct pt *) A pointer to the protothread (struct pt) in - * which the operation is executed. - * - * \param s (struct pt_sem *) A pointer to the pt_sem struct - * representing the semaphore - * - * \hideinitializer - */ -#define PT_SEM_WAIT(pt, s) \ - do { \ - PT_WAIT_UNTIL(pt, PT_SEM_COUNT(s) > 0); \ - ++(s)->tail; \ - } while(0) - -/** - * Signal a semaphore - * - * This macro carries out the "signal" operation on the semaphore. The - * signal operation increments the counter inside the semaphore, which - * eventually will cause waiting protothreads to continue executing. - * - * \param pt (struct pt *) A pointer to the protothread (struct pt) in - * which the operation is executed. - * - * \param s (struct pt_sem *) A pointer to the pt_sem struct - * representing the semaphore - * - * \hideinitializer - */ -#define PT_SEM_SIGNAL(pt, s) (++(s)->head) - -#endif /* PT_SEM_H_ */ - -/** @} */ -/** @} */ - diff --git a/os/sys/pt.h b/os/sys/pt.h deleted file mode 100644 index c9549119e..000000000 --- a/os/sys/pt.h +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 2004-2005, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \addtogroup pt - * @{ - */ - -/** - * \file - * Protothreads implementation. - * \author - * Adam Dunkels - * - */ - -#ifndef PT_H_ -#define PT_H_ - -#include "sys/lc.h" - -struct pt { - lc_t lc; -}; - -#define PT_WAITING 0 -#define PT_YIELDED 1 -#define PT_EXITED 2 -#define PT_ENDED 3 - -/** - * \name Initialization - * @{ - */ - -/** - * Initialize a protothread. - * - * Initializes a protothread. Initialization must be done prior to - * starting to execute the protothread. - * - * \param pt A pointer to the protothread control structure. - * - * \sa PT_SPAWN() - * - * \hideinitializer - */ -#define PT_INIT(pt) LC_INIT((pt)->lc) - -/** @} */ - -/** - * \name Declaration and definition - * @{ - */ - -/** - * Declaration of a protothread. - * - * This macro is used to declare a protothread. All protothreads must - * be declared with this macro. - * - * \param name_args The name and arguments of the C function - * implementing the protothread. - * - * \hideinitializer - */ -#define PT_THREAD(name_args) char name_args - -/** - * Declare the start of a protothread inside the C function - * implementing the protothread. - * - * This macro is used to declare the starting point of a - * protothread. It should be placed at the start of the function in - * which the protothread runs. All C statements above the PT_BEGIN() - * invokation will be executed each time the protothread is scheduled. - * - * \param pt A pointer to the protothread control structure. - * - * \hideinitializer - */ -#define PT_BEGIN(pt) { char PT_YIELD_FLAG = 1; if (PT_YIELD_FLAG) {;} LC_RESUME((pt)->lc) - -/** - * Declare the end of a protothread. - * - * This macro is used for declaring that a protothread ends. It must - * always be used together with a matching PT_BEGIN() macro. - * - * \param pt A pointer to the protothread control structure. - * - * \hideinitializer - */ -#define PT_END(pt) LC_END((pt)->lc); PT_YIELD_FLAG = 0; \ - PT_INIT(pt); return PT_ENDED; } - -/** @} */ - -/** - * \name Blocked wait - * @{ - */ - -/** - * Block and wait until condition is true. - * - * This macro blocks the protothread until the specified condition is - * true. - * - * \param pt A pointer to the protothread control structure. - * \param condition The condition. - * - * \hideinitializer - */ -#define PT_WAIT_UNTIL(pt, condition) \ - do { \ - LC_SET((pt)->lc); \ - if(!(condition)) { \ - return PT_WAITING; \ - } \ - } while(0) - -/** - * Block and wait while condition is true. - * - * This function blocks and waits while condition is true. See - * PT_WAIT_UNTIL(). - * - * \param pt A pointer to the protothread control structure. - * \param cond The condition. - * - * \hideinitializer - */ -#define PT_WAIT_WHILE(pt, cond) PT_WAIT_UNTIL((pt), !(cond)) - -/** @} */ - -/** - * \name Hierarchical protothreads - * @{ - */ - -/** - * Block and wait until a child protothread completes. - * - * This macro schedules a child protothread. The current protothread - * will block until the child protothread completes. - * - * \note The child protothread must be manually initialized with the - * PT_INIT() function before this function is used. - * - * \param pt A pointer to the protothread control structure. - * \param thread The child protothread with arguments - * - * \sa PT_SPAWN() - * - * \hideinitializer - */ -#define PT_WAIT_THREAD(pt, thread) PT_WAIT_WHILE((pt), PT_SCHEDULE(thread)) - -/** - * Spawn a child protothread and wait until it exits. - * - * This macro spawns a child protothread and waits until it exits. The - * macro can only be used within a protothread. - * - * \param pt A pointer to the protothread control structure. - * \param child A pointer to the child protothread's control structure. - * \param thread The child protothread with arguments - * - * \hideinitializer - */ -#define PT_SPAWN(pt, child, thread) \ - do { \ - PT_INIT((child)); \ - PT_WAIT_THREAD((pt), (thread)); \ - } while(0) - -/** @} */ - -/** - * \name Exiting and restarting - * @{ - */ - -/** - * Restart the protothread. - * - * This macro will block and cause the running protothread to restart - * its execution at the place of the PT_BEGIN() call. - * - * \param pt A pointer to the protothread control structure. - * - * \hideinitializer - */ -#define PT_RESTART(pt) \ - do { \ - PT_INIT(pt); \ - return PT_WAITING; \ - } while(0) - -/** - * Exit the protothread. - * - * This macro causes the protothread to exit. If the protothread was - * spawned by another protothread, the parent protothread will become - * unblocked and can continue to run. - * - * \param pt A pointer to the protothread control structure. - * - * \hideinitializer - */ -#define PT_EXIT(pt) \ - do { \ - PT_INIT(pt); \ - return PT_EXITED; \ - } while(0) - -/** @} */ - -/** - * \name Calling a protothread - * @{ - */ - -/** - * Schedule a protothread. - * - * This function schedules a protothread. The return value of the - * function is non-zero if the protothread is running or zero if the - * protothread has exited. - * - * \param f The call to the C function implementing the protothread to - * be scheduled - * - * \hideinitializer - */ -#define PT_SCHEDULE(f) ((f) < PT_EXITED) - -/** @} */ - -/** - * \name Yielding from a protothread - * @{ - */ - -/** - * Yield from the current protothread. - * - * This function will yield the protothread, thereby allowing other - * processing to take place in the system. - * - * \param pt A pointer to the protothread control structure. - * - * \hideinitializer - */ -#define PT_YIELD(pt) \ - do { \ - PT_YIELD_FLAG = 0; \ - LC_SET((pt)->lc); \ - if(PT_YIELD_FLAG == 0) { \ - return PT_YIELDED; \ - } \ - } while(0) - -/** - * \brief Yield from the protothread until a condition occurs. - * \param pt A pointer to the protothread control structure. - * \param cond The condition. - * - * This function will yield the protothread, until the - * specified condition evaluates to true. - * - * - * \hideinitializer - */ -#define PT_YIELD_UNTIL(pt, cond) \ - do { \ - PT_YIELD_FLAG = 0; \ - LC_SET((pt)->lc); \ - if((PT_YIELD_FLAG == 0) || !(cond)) { \ - return PT_YIELDED; \ - } \ - } while(0) - -/** @} */ - -#endif /* PT_H_ */ - -/** @} */ diff --git a/os/sys/rtimer.c b/os/sys/rtimer.c deleted file mode 100644 index cf96a17bf..000000000 --- a/os/sys/rtimer.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Implementation of the architecture-agnostic parts of the real-time timer module. - * \author - * Adam Dunkels - * - */ - -/** - * \addtogroup rt - * @{ - */ - -#include "sys/rtimer.h" -#include "contiki.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -static struct rtimer *next_rtimer; - -/*---------------------------------------------------------------------------*/ -void -rtimer_init(void) -{ - rtimer_arch_init(); -} -/*---------------------------------------------------------------------------*/ -int -rtimer_set(struct rtimer *rtimer, rtimer_clock_t time, - rtimer_clock_t duration, - rtimer_callback_t func, void *ptr) -{ - int first = 0; - - PRINTF("rtimer_set time %d\n", time); - - if(next_rtimer == NULL) { - first = 1; - } - - rtimer->func = func; - rtimer->ptr = ptr; - - rtimer->time = time; - next_rtimer = rtimer; - - if(first == 1) { - rtimer_arch_schedule(time); - } - return RTIMER_OK; -} -/*---------------------------------------------------------------------------*/ -void -rtimer_run_next(void) -{ - struct rtimer *t; - if(next_rtimer == NULL) { - return; - } - t = next_rtimer; - next_rtimer = NULL; - t->func(t, t->ptr); - if(next_rtimer != NULL) { - rtimer_arch_schedule(next_rtimer->time); - } - return; -} -/*---------------------------------------------------------------------------*/ - -/** @}*/ diff --git a/os/sys/rtimer.h b/os/sys/rtimer.h deleted file mode 100644 index 783e1569b..000000000 --- a/os/sys/rtimer.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the real-time timer module. - * \author - * Adam Dunkels - * - */ - -/** \addtogroup threads - * @{ */ - -/** - * \defgroup rt Real-time task scheduling - * - * The real-time module handles the scheduling and execution of - * real-time tasks (with predictable execution times). - * - * @{ - */ - -#ifndef RTIMER_H_ -#define RTIMER_H_ - -#include "contiki.h" -#include "dev/watchdog.h" -#include - -/** \brief The rtimer size (in bytes) */ -#ifdef RTIMER_CONF_CLOCK_SIZE -#define RTIMER_CLOCK_SIZE RTIMER_CONF_CLOCK_SIZE -#else /* RTIMER_CONF_CLOCK_SIZE */ -/* Default: 32bit rtimer*/ -#define RTIMER_CLOCK_SIZE 4 -#endif /* RTIMER_CONF_CLOCK_SIZE */ - -#if RTIMER_CLOCK_SIZE == 2 -/* 16-bit rtimer */ -typedef uint16_t rtimer_clock_t; -#define RTIMER_CLOCK_DIFF(a,b) ((int16_t)((a)-(b))) - -#elif RTIMER_CLOCK_SIZE == 4 -/* 32-bit rtimer */ -typedef uint32_t rtimer_clock_t; -#define RTIMER_CLOCK_DIFF(a, b) ((int32_t)((a) - (b))) - -#elif RTIMER_CLOCK_SIZE == 8 -/* 64-bit rtimer */ -typedef uint64_t rtimer_clock_t; -#define RTIMER_CLOCK_DIFF(a,b) ((int64_t)((a)-(b))) - -#else -#error Unsupported rtimer size (check RTIMER_CLOCK_SIZE) -#endif - -#define RTIMER_CLOCK_MAX ((rtimer_clock_t)-1) -#define RTIMER_CLOCK_LT(a, b) (RTIMER_CLOCK_DIFF((a),(b)) < 0) - -#include "rtimer-arch.h" - -/** - * \brief Initialize the real-time scheduler. - * - * This function initializes the real-time scheduler and - * must be called at boot-up, before any other functions - * from the real-time scheduler is called. - */ -void rtimer_init(void); - -struct rtimer; -typedef void (* rtimer_callback_t)(struct rtimer *t, void *ptr); - -/** - * \brief Representation of a real-time task - * - * This structure represents a real-time task and is used - * by the real-time module and the architecture specific - * support module for the real-time module. - */ -struct rtimer { - rtimer_clock_t time; - rtimer_callback_t func; - void *ptr; -}; - -enum { - RTIMER_OK, - RTIMER_ERR_FULL, - RTIMER_ERR_TIME, - RTIMER_ERR_ALREADY_SCHEDULED, -}; - -/** - * \brief Post a real-time task. - * \param task A pointer to the task variable previously declared with RTIMER_TASK(). - * \param time The time when the task is to be executed. - * \param duration Unused argument. - * \param func A function to be called when the task is executed. - * \param ptr An opaque pointer that will be supplied as an argument to the callback function. - * \return Non-zero (true) if the task could be scheduled, zero - * (false) if the task could not be scheduled. - * - * This function schedules a real-time task at a specified - * time in the future. - * - */ -int rtimer_set(struct rtimer *task, rtimer_clock_t time, - rtimer_clock_t duration, rtimer_callback_t func, void *ptr); - -/** - * \brief Execute the next real-time task and schedule the next task, if any - * - * This function is called by the architecture dependent - * code to execute and schedule the next real-time task. - * - */ -void rtimer_run_next(void); - -/** - * \brief Get the current clock time - * \return The current time - * - * This function returns what the real-time module thinks - * is the current time. The current time is used to set - * the timeouts for real-time tasks. - * - * \hideinitializer - */ -#define RTIMER_NOW() rtimer_arch_now() - -/** - * \brief Get the time that a task last was executed - * \param task The task - * \return The time that a task last was executed - * - * This function returns the time that the task was last - * executed. This typically is used to get a periodic - * execution of a task without clock drift. - * - * \hideinitializer - */ -#define RTIMER_TIME(task) ((task)->time) - -void rtimer_arch_init(void); -void rtimer_arch_schedule(rtimer_clock_t t); -/*rtimer_clock_t rtimer_arch_now(void);*/ - -#define RTIMER_SECOND RTIMER_ARCH_SECOND - -/* RTIMER_GUARD_TIME is the minimum amount of rtimer ticks between - the current time and the future time when a rtimer is scheduled. - Necessary to avoid accidentally scheduling a rtimer in the past - on platforms with fast rtimer ticks. Should be >= 2. */ -#ifdef RTIMER_CONF_GUARD_TIME -#define RTIMER_GUARD_TIME RTIMER_CONF_GUARD_TIME -#else /* RTIMER_CONF_GUARD_TIME */ -#define RTIMER_GUARD_TIME (RTIMER_ARCH_SECOND >> 14) -#endif /* RTIMER_CONF_GUARD_TIME */ - -/** \brief Busy-wait until a condition. Start time is t0, max wait time is max_time */ -#ifndef RTIMER_BUSYWAIT_UNTIL_ABS -#define RTIMER_BUSYWAIT_UNTIL_ABS(cond, t0, max_time) \ - ({ \ - bool c; \ - while(!(c = cond) && RTIMER_CLOCK_LT(RTIMER_NOW(), (t0) + (max_time))); \ - c; \ - }) -#endif /* RTIMER_BUSYWAIT_UNTIL_ABS */ - -/** \brief Busy-wait until a condition for at most max_time */ -#define RTIMER_BUSYWAIT_UNTIL(cond, max_time) \ - ({ \ - rtimer_clock_t t0 = RTIMER_NOW(); \ - RTIMER_BUSYWAIT_UNTIL_ABS(cond, t0, max_time); \ - }) - -/** \brief Busy-wait for a fixed duration */ -#define RTIMER_BUSYWAIT(duration) RTIMER_BUSYWAIT_UNTIL(0, duration) - -#endif /* RTIMER_H_ */ - -/** @} */ -/** @} */ diff --git a/os/sys/stack-check.c b/os/sys/stack-check.c deleted file mode 100644 index 61f8d98ab..000000000 --- a/os/sys/stack-check.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2017, University of Bristol - http://www.bris.ac.uk/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - */ - -/** - * \addtogroup stack - * @{ - */ - -/** - * \file - * Implementation of the stack checker library. - * \author - * Atis Elsts - */ - -#include "contiki.h" -#include "sys/stack-check.h" -#include "dev/watchdog.h" -#include - -#include "sys/log.h" -#define LOG_MODULE "Stack" -#define LOG_LEVEL LOG_LEVEL_MAIN - -/*---------------------------------------------------------------------------*/ -/* linker will provide a symbol for the end of the .bss segment */ -extern uint8_t _stack; - -#if STACK_CHECK_PERIODIC_CHECKS -PROCESS(stack_check_process, "Stack check"); -#endif -/*---------------------------------------------------------------------------*/ -/* The symbol with which the stack memory is initially filled */ -#define STACK_FILL 0xcd -/*---------------------------------------------------------------------------*/ -#ifdef STACK_ORIGIN -/* use the #defined value */ -#define GET_STACK_ORIGIN() STACK_ORIGIN -#else -/* use the value provided by the linker script */ -extern int _stack_origin; -#define GET_STACK_ORIGIN() (&_stack_origin) -#endif -/*---------------------------------------------------------------------------*/ -void -stack_check_init(void) -{ - uint8_t *p; - - /* Make this static to avoid destroying it in the while loop */ - static void *stack_top; - /* Use address of this local variable as a boundary */ - stack_top = &p; - - /* Note: this is expected to be called before the WDT is started! */ - p = &_stack; - while(p < (uint8_t *)stack_top) { - *p++ = STACK_FILL; - } - -#if STACK_CHECK_PERIODIC_CHECKS - /* Start the periodic checker process */ - process_start(&stack_check_process, NULL); -#endif -} -/*---------------------------------------------------------------------------*/ -uint16_t -stack_check_get_usage(void) -{ - uint8_t *p = &_stack; - - /* Make sure WDT is not triggered */ - watchdog_periodic(); - - /* Skip the bytes used after heap; it's 1 byte by default for _stack, - * more than that means dynamic memory allocation is used somewhere. - */ - while(*p != STACK_FILL && p < (uint8_t *)GET_STACK_ORIGIN()) { - p++; - } - - /* Skip the region of the memory reserved for the stack not used yet by the program */ - while(*p == STACK_FILL && p < (uint8_t *)GET_STACK_ORIGIN()) { - p++; - } - - /* Make sure WDT is not triggered */ - watchdog_periodic(); - - if(p >= (uint8_t*)GET_STACK_ORIGIN()) { - /* This means the stack is screwed. */ - return 0xffff; - } - - return (uint8_t *)GET_STACK_ORIGIN() - p; -} -/*---------------------------------------------------------------------------*/ -uint16_t -stack_check_get_reserved_size(void) -{ - return (uint8_t *)GET_STACK_ORIGIN() - &_stack; -} -/*---------------------------------------------------------------------------*/ -#if STACK_CHECK_PERIODIC_CHECKS -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(stack_check_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - - etimer_set(&et, STACK_CHECK_PERIOD); - - while(1) { - uint16_t actual, allowed; - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - actual = stack_check_get_usage(); - allowed = stack_check_get_reserved_size(); - if(actual > allowed) { - LOG_ERR("Check failed: %u vs. %u\n", actual, allowed); - } else { - LOG_DBG("Check ok: %u vs. %u\n", actual, allowed); - } - - etimer_reset(&et); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -#endif /* STACK_CHECK_PERIODIC_CHECKS */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/os/sys/stack-check.h b/os/sys/stack-check.h deleted file mode 100644 index 805c4b7da..000000000 --- a/os/sys/stack-check.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2017, University of Bristol - http://www.bris.ac.uk/ - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 - * Stack checker library header file. - * \author - * Atis Elsts - */ - -/** \addtogroup sys - * @{ */ - -/** - * \defgroup stack Stack checker library - * - * Basic support for stack guards and stack overflow detection. - * On startup, fills the area between the stack and the heap with a known pattern. - * During execution, the fill can be checked in order to find out - * the extent to which the stack has been used. - * - * @{ - */ - -#ifndef STACK_CHECK_H_ -#define STACK_CHECK_H_ - -#include "contiki-conf.h" - -/* Determine whether stack checking is supported depending on the plaform. */ -#ifdef PLATFORM_CONF_SUPPORTS_STACK_CHECK -#if !PLATFORM_CONF_SUPPORTS_STACK_CHECK -/* Stack checker cannot be enabled, since the platform does not support it */ -#undef STACK_CHECK_CONF_ENABLED -#define STACK_CHECK_CONF_ENABLED 0 -#endif /* !PLATFORM_CONF_SUPPORTS_STACK_CHECK */ -#endif /* ifdef PLATFORM_CONF_SUPPORTS_STACK_CHECK */ - -/* If this is disabled, the functions are no-ops */ -#ifdef STACK_CHECK_CONF_ENABLED -#define STACK_CHECK_ENABLED STACK_CHECK_CONF_ENABLED -#else -#define STACK_CHECK_ENABLED 1 /* Enable by default */ -#endif - -/* Perform periodic stack integrity checks? */ -#ifdef STACK_CHECK_CONF_PERIODIC_CHECKS -#define STACK_CHECK_PERIODIC_CHECKS STACK_CHECK_CONF_PERIODIC_CHECKS -#else -#define STACK_CHECK_PERIODIC_CHECKS 1 /* Enable by default */ -#endif - -/* How often to do the periodic integrity checks, if enabled? */ -#ifdef STACK_CHECK_CONF_PERIOD -#define STACK_CHECK_PERIOD STACK_CHECK_CONF_PERIOD -#else -#define STACK_CHECK_PERIOD (10 * CLOCK_SECOND) -#endif - -/** - * \brief Initialize the stack area with a known pattern - * - * This function initializes the memory between the stack and heap - * areas. The function should be called by the system - * during boot-up. - */ -void stack_check_init(void); - -/** - * \brief Calculate the maximal stack usage so far. - * - * This function relies on the assumption that the stack memory - * that has been reserved by functions and local variables - * is actually overwritten with new contents. If the stack is - * just reserved, but not used, the function will fail to detect - * that usage. - * In addition, this function can warn if the stack memory range - * has been completely used, but it cannot detect - * and warn if stack overflow has already taken place. - */ -uint16_t stack_check_get_usage(void); - -/** - * \brief Calculate the maximal permitted stack usage. - * - * This function returns the number of bytes between the origin - * of the stack and the end of heap. - */ -uint16_t stack_check_get_reserved_size(void); - -/** - * \brief The origin point from which the stack grows (an optional #define) - * - */ -#ifdef STACK_CONF_ORIGIN -#define STACK_ORIGIN STACK_CONF_ORIGIN -#endif - -#endif /* STACK_CHECK_H_ */ - -/** @} */ -/** @} */ diff --git a/os/sys/stimer.c b/os/sys/stimer.c deleted file mode 100644 index 007587e83..000000000 --- a/os/sys/stimer.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2004, 2008, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels , Nicolas Tsiftes - * - */ - -/** - * \file - * Timer of seconds library implementation. - * \author - * Adam Dunkels , Nicolas Tsiftes - */ - -/** - * \addtogroup stimer - * @{ - */ - -#include "contiki.h" -#include "sys/clock.h" -#include "sys/stimer.h" - -#define SCLOCK_GEQ(a, b) ((unsigned long)((a) - (b)) < \ - ((unsigned long)(~((unsigned long)0)) >> 1)) - -/*---------------------------------------------------------------------------*/ -/** - * Set a timer. - * - * This function is used to set a timer for a time sometime in the - * future. The function stimer_expired() will evaluate to true after - * the timer has expired. - * - * \param t A pointer to the timer - * \param interval The interval before the timer expires. - * - */ -void -stimer_set(struct stimer *t, unsigned long interval) -{ - t->interval = interval; - t->start = clock_seconds(); -} -/*---------------------------------------------------------------------------*/ -/** - * Reset the timer with the same interval. - * - * This function resets the timer with the same interval that was - * given to the stimer_set() function. The start point of the interval - * is the exact time that the timer last expired. Therefore, this - * function will cause the timer to be stable over time, unlike the - * stimer_restart() function. If this is executed before the - * timer expired, this function has no effect. - * - * \param t A pointer to the timer. - * - * \sa stimer_restart() - */ -void -stimer_reset(struct stimer *t) -{ - if(stimer_expired(t)) { - t->start += t->interval; - } -} -/*---------------------------------------------------------------------------*/ -/** - * Restart the timer from the current point in time - * - * This function restarts a timer with the same interval that was - * given to the stimer_set() function. The timer will start at the - * current time. - * - * \note A periodic timer will drift if this function is used to reset - * it. For preioric timers, use the stimer_reset() function instead. - * - * \param t A pointer to the timer. - * - * \sa stimer_reset() - */ -void -stimer_restart(struct stimer *t) -{ - t->start = clock_seconds(); -} -/*---------------------------------------------------------------------------*/ -/** - * Check if a timer has expired. - * - * This function tests if a timer has expired and returns true or - * false depending on its status. - * - * \param t A pointer to the timer - * - * \return Non-zero if the timer has expired, zero otherwise. - * - */ -int -stimer_expired(struct stimer *t) -{ - return SCLOCK_GEQ(clock_seconds(), t->start + t->interval); -} -/*---------------------------------------------------------------------------*/ -/** - * The time until the timer expires - * - * This function returns the time until the timer expires. - * - * \param t A pointer to the timer - * - * \return The time until the timer expires - * - */ -unsigned long -stimer_remaining(struct stimer *t) -{ - return t->start + t->interval - clock_seconds(); -} -/*---------------------------------------------------------------------------*/ -/** - * The time elapsed since the timer started - * - * This function returns the time elapsed. - * - * \param t A pointer to the timer - * - * \return The time elapsed since the last start of the timer - * - */ -unsigned long -stimer_elapsed(struct stimer *t) -{ - return clock_seconds() - t->start; -} - -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/os/sys/stimer.h b/os/sys/stimer.h deleted file mode 100644 index bf238987f..000000000 --- a/os/sys/stimer.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2004, 2008, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels , Nicolas Tsiftes - * - */ - -/** - * \file - * Second timer library header file. - * \author - * Adam Dunkels , Nicolas Tsiftes - */ - -/** \addtogroup timers - * @{ */ - -/** - * \defgroup stimer Seconds timer library - * - * The stimer library provides functions for setting, resetting and - * restarting timers, and for checking if a timer has expired. An - * application must "manually" check if its timers have expired; this - * is not done automatically. - * - * A timer is declared as a \c struct \c stimer and all access to the - * timer is made by a pointer to the declared timer. - * - * \note The stimer library is not able to post events when a timer - * expires. The \ref etimer "Event timers" should be used for this - * purpose. - * - * \note The stimer library uses the \ref clock "Clock library" to - * measure time. Intervals should be specified in the seconds. - * - * \sa \ref etimer "Event timers" - * - * @{ - */ - -#ifndef STIMER_H_ -#define STIMER_H_ - -#include "sys/clock.h" - -/** - * A timer. - * - * This structure is used for declaring a timer. The timer must be set - * with stimer_set() before it can be used. - * - * \hideinitializer - */ -struct stimer { - unsigned long start; - unsigned long interval; -}; - -void stimer_set(struct stimer *t, unsigned long interval); -void stimer_reset(struct stimer *t); -void stimer_restart(struct stimer *t); -int stimer_expired(struct stimer *t); -unsigned long stimer_remaining(struct stimer *t); -unsigned long stimer_elapsed(struct stimer *t); - - -#endif /* STIMER_H_ */ - -/** @} */ -/** @} */ diff --git a/os/sys/subprocess.h b/os/sys/subprocess.h deleted file mode 100644 index 0031dcebd..000000000 --- a/os/sys/subprocess.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \addtogroup threads - * @{ - */ - -/** - * \defgroup subprocess Contiki subprocesses - * @{ - * - * A Contiki subprocess is a "process-in-a-process". - */ - -/** - * \file - * Subprocesses for Contiki - * \author - * Adam Dunkels - */ - -#ifndef SUBPROCESS_H_ -#define SUBPROCESS_H_ - -#define SUBPROCESS_BEGIN(strname) \ -{ \ - static struct process subprocess_subprocess = {NULL, strname}; \ - subprocess_subprocess.thread = PROCESS_CURRENT()->thread; \ - process_start(&subprocess_subprocess, NULL); \ - PT_INIT(&subprocess_subprocess.pt); \ - LC_SET(subprocess_subprocess.pt.lc); \ - if(PROCESS_CURRENT() == &subprocess_subprocess) { - -#define SUBPROCESS_END() \ - PROCESS_EXIT(); \ - } \ -} - -#endif /* SUBPROCESS_H_ */ - -/** @}*/ -/** @}*/ diff --git a/os/sys/timer.c b/os/sys/timer.c deleted file mode 100644 index b99aa4127..000000000 --- a/os/sys/timer.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \file - * Timer library implementation. - * \author - * Adam Dunkels - */ - -/** - * \addtogroup timer - * @{ - */ - -#include "contiki.h" -#include "sys/clock.h" -#include "sys/timer.h" - -/*---------------------------------------------------------------------------*/ -/** - * Set a timer. - * - * This function is used to set a timer for a time sometime in the - * future. The function timer_expired() will evaluate to true after - * the timer has expired. - * - * \param t A pointer to the timer - * \param interval The interval before the timer expires. - * - */ -void -timer_set(struct timer *t, clock_time_t interval) -{ - t->interval = interval; - t->start = clock_time(); -} -/*---------------------------------------------------------------------------*/ -/** - * Reset the timer with the same interval. - * - * This function resets the timer with the same interval that was - * given to the timer_set() function. The start point of the interval - * is the exact time that the timer last expired. Therefore, this - * function will cause the timer to be stable over time, unlike the - * timer_restart() function. If this is executed before the - * timer expired, this function has no effect. - * - * \param t A pointer to the timer. - * \sa timer_restart() - */ -void -timer_reset(struct timer *t) -{ - if(timer_expired(t)) { - t->start += t->interval; - } -} -/*---------------------------------------------------------------------------*/ -/** - * Restart the timer from the current point in time - * - * This function restarts a timer with the same interval that was - * given to the timer_set() function. The timer will start at the - * current time. - * - * \note A periodic timer will drift if this function is used to reset - * it. For preioric timers, use the timer_reset() function instead. - * - * \param t A pointer to the timer. - * - * \sa timer_reset() - */ -void -timer_restart(struct timer *t) -{ - t->start = clock_time(); -} -/*---------------------------------------------------------------------------*/ -/** - * Check if a timer has expired. - * - * This function tests if a timer has expired and returns true or - * false depending on its status. - * - * \param t A pointer to the timer - * - * \return Non-zero if the timer has expired, zero otherwise. - * - */ -int -timer_expired(struct timer *t) -{ - /* Note: Can not return diff >= t->interval so we add 1 to diff and return - t->interval < diff - required to avoid an internal error in mspgcc. */ - clock_time_t diff = (clock_time() - t->start) + 1; - return t->interval < diff; - -} -/*---------------------------------------------------------------------------*/ -/** - * The time until the timer expires - * - * This function returns the time until the timer expires. - * - * \param t A pointer to the timer - * - * \return The time until the timer expires - * - */ -clock_time_t -timer_remaining(struct timer *t) -{ - return t->start + t->interval - clock_time(); -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/os/sys/timer.h b/os/sys/timer.h deleted file mode 100644 index 54abcb3c2..000000000 --- a/os/sys/timer.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -/** - * \file - * Timer library header file. - * \author - * Adam Dunkels - */ - -/** \addtogroup timers - * @{ */ - -/** - * \defgroup timer Timer library - * - * The timer library provides functions for setting, resetting and - * restarting timers, and for checking if a timer has expired. An - * application must "manually" check if its timers have expired; this - * is not done automatically. - * - * A timer is declared as a \c struct \c timer and all access to the - * timer is made by a pointer to the declared timer. - * - * \note The timer library is not able to post events when a timer - * expires. The \ref etimer "Event timers" should be used for this - * purpose. - * - * \note The timer library uses the \ref clock "Clock library" to - * measure time. Intervals should be specified in the format used by - * the clock library. - * - * \sa \ref etimer "Event timers" - * - * @{ - */ - -#ifndef TIMER_H_ -#define TIMER_H_ - -#include "sys/clock.h" - -/** - * A timer. - * - * This structure is used for declaring a timer. The timer must be set - * with timer_set() before it can be used. - * - * \hideinitializer - */ -struct timer { - clock_time_t start; - clock_time_t interval; -}; - -void timer_set(struct timer *t, clock_time_t interval); -void timer_reset(struct timer *t); -void timer_restart(struct timer *t); -int timer_expired(struct timer *t); -clock_time_t timer_remaining(struct timer *t); - - -#endif /* TIMER_H_ */ - -/** @} */ -/** @} */ diff --git a/project/product/Makefile b/product/Makefile similarity index 100% rename from project/product/Makefile rename to product/Makefile diff --git a/project/product/product.c b/product/product.c similarity index 100% rename from project/product/product.c rename to product/product.c diff --git a/project/product/project-conf.h b/product/project-conf.h similarity index 100% rename from project/product/project-conf.h rename to product/project-conf.h diff --git a/project/.gitignore b/project/.gitignore deleted file mode 100644 index 1377554eb..000000000 --- a/project/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/project/assigner/project-conf.h b/project/assigner/project-conf.h deleted file mode 100644 index 3cbc0da86..000000000 --- a/project/assigner/project-conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 25 -#define RF_BLE_CONF_ENABLED 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/project/cashreg/project-conf.h b/project/cashreg/project-conf.h deleted file mode 100644 index 3cbc0da86..000000000 --- a/project/cashreg/project-conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -/* Enable the ROM bootloader */ -#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 -/*---------------------------------------------------------------------------*/ -/* Change to match your configuration */ -#define IEEE802154_CONF_PANID 0xABCD -#define IEEE802154_CONF_DEFAULT_CHANNEL 25 -#define RF_BLE_CONF_ENABLED 1 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ diff --git a/tests/00-documentation/Makefile b/tests/00-documentation/Makefile deleted file mode 100644 index ea0aa85b4..000000000 --- a/tests/00-documentation/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright (c) 2014, Friedrich-Alexander University Erlangen-Nuremberg -# 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 University 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 UNIVERSITY 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 INSTITUTE 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. -TOOLS_DIR = ../../tools - -DOXYGEN = doxygen -DOXYGEN_DIR = $(TOOLS_DIR)/doxygen -DOXYGEN_LOG = $(DOXYGEN).log -DOXYGEN_ERR = $(DOXYGEN).err - -RAEDTHEDOCS = readthedocs -READTHEDOCS_DIR = $(TOOLS_DIR)/readthedocs -READTHEDOCS_LOG = $(RAEDTHEDOCS).log -READTHEDOCS_ERR = $(RAEDTHEDOCS).err - -CLEAN_TARGETS += $(DOXYGEN_LOG) $(DOXYGEN_ERR) -CLEAN_TARGETS += $(READTHEDOCS_LOG) $(READTHEDOCS_ERR) - -all: clean summary - -doxygen: - -@$(MAKE) -C $(DOXYGEN_DIR) 2> $(DOXYGEN_ERR) > /dev/null - -readthedocs: - -@$(MAKE) -C $(READTHEDOCS_DIR) 2> $(READTHEDOCS_ERR) > /dev/null - -summary: doxygen readthedocs - @( \ - 1> summary; \ - if [ -s $(DOXYGEN_ERR) ] ; then \ - echo "Doxygen: TEST FAIL" | tee -a summary; \ - echo "Errors:"; \ - cat $(DOXYGEN_ERR); \ - fi ; \ - if [ -s $(DOXYGEN_DIR)/doxygen.log ] ; then \ - echo "Doxygen: TEST FAIL" | tee -a summary; \ - echo "Warnings:"; \ - cat $(DOXYGEN_DIR)/doxygen.log; \ - fi ; \ - if [ -s $(READTHEDOCS_ERR) ] ; then \ - echo "Readthedocs: TEST FAIL" | tee -a summary; \ - echo "Errors:"; \ - cat $(READTHEDOCS_ERR); \ - fi ; \ - if [ ! -s summary ] ; then \ - echo "Documentation: TEST OK (no warning nor error)" | tee summary; \ - fi ; \ - ) - @rm -f $(CLEAN_TARGETS) - @echo "========== Summary ==========" - @cat summary - -clean: - @rm -f summary $(CLEAN_TARGETS) - @$(MAKE) -C $(DOXYGEN_DIR) clean - @$(MAKE) -C $(READTHEDOCS_DIR) clean diff --git a/tests/01-compile-base/Makefile b/tests/01-compile-base/Makefile deleted file mode 100644 index 51e68f9a2..000000000 --- a/tests/01-compile-base/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -EXAMPLESDIR=../../examples -TOOLSDIR=../../tools - -EXAMPLES = \ -hello-world/native \ -hello-world/native:MAKE_NET=MAKE_NET_NULLNET \ -hello-world/native:MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC \ -hello-world/sky \ -hello-world/z1 \ -storage/eeprom-test/native \ -libs/logging/native \ -libs/energest/native \ -libs/energest/sky \ -libs/data-structures/native \ -libs/data-structures/sky \ -libs/stack-check/sky \ -lwm2m-ipso-objects/native \ -lwm2m-ipso-objects/native:MAKE_WITH_DTLS=1 \ -lwm2m-ipso-objects/native:DEFINES=LWM2M_Q_MODE_CONF_ENABLED=1 \ -lwm2m-ipso-objects/native:DEFINES=LWM2M_Q_MODE_CONF_ENABLED=1,LWM2M_Q_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION=1 \ -rpl-udp/sky \ -rpl-border-router/native \ -rpl-border-router/native:MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC \ -rpl-border-router/sky \ -slip-radio/sky \ -libs/ipv6-hooks/sky \ -nullnet/native \ -nullnet/sky \ -nullnet/sky:MAKE_MAC=MAKE_MAC_TSCH \ -mqtt-client/native \ -coap/coap-example-client/native \ -coap/coap-example-server/native \ -coap/coap-plugtest-server/native \ -sensniff/z1 \ - -TOOLS= - -include ../Makefile.compile-test diff --git a/tests/02-compile-arm-ports-01/Makefile b/tests/02-compile-arm-ports-01/Makefile deleted file mode 100644 index 43e008c8e..000000000 --- a/tests/02-compile-arm-ports-01/Makefile +++ /dev/null @@ -1,105 +0,0 @@ -EXAMPLESDIR=../../examples -TOOLSDIR=../../tools - -EXAMPLES = \ -platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-cc13x0 \ -platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-cc13x0:MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC \ -platform-specific/cc26x0-cc13x0/very-sleepy-demo/cc26x0-cc13x0:BOARD=sensortag/cc2650 \ -platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-cc13x0:BOARD=sensortag/cc2650 \ -platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-cc13x0:BOARD=sensortag/cc1350 \ -platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-cc13x0:BOARD=srf06/cc13x0 \ -platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-cc13x0:BOARD=launchpad/cc2650 \ -platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-cc13x0:BOARD=launchpad/cc1310 \ -platform-specific/cc26x0-cc13x0/cc26x0-web-demo/cc26x0-cc13x0:BOARD=launchpad/cc1350 \ -platform-specific/cc26x0-cc13x0/very-sleepy-demo/cc26x0-cc13x0 \ -platform-specific/cc26x0-cc13x0/ble-ipv6/cc26x0-cc13x0:BOARD=sensortag/cc2650 \ -nullnet/cc26x0-cc13x0:BOARD=sensortag/cc2650 \ -rpl-border-router/cc26x0-cc13x0:BOARD=launchpad/cc2650 \ -sensniff/cc26x0-cc13x0 \ -sensniff/cc26x0-cc13x0:BOARD=launchpad/cc1310 \ -dev/gpio-hal/cc26x0-cc13x0:BOARD=srf06/cc13x0 \ -dev/gpio-hal/cc26x0-cc13x0:BOARD=srf06/cc26x0 \ -dev/gpio-hal/cc26x0-cc13x0:BOARD=sensortag/cc1350 \ -dev/gpio-hal/cc26x0-cc13x0:BOARD=sensortag/cc2650 \ -dev/gpio-hal/cc26x0-cc13x0:BOARD=launchpad/cc1310 \ -dev/gpio-hal/cc26x0-cc13x0:BOARD=launchpad/cc1350 \ -dev/gpio-hal/cc26x0-cc13x0:BOARD=launchpad/cc2650 \ -dev/gpio-hal/cc26x0-cc13x0:BOARD=launchpad/cc2640r2 \ -dev/leds/cc26x0-cc13x0:BOARD=srf06/cc13x0 \ -dev/leds/cc26x0-cc13x0:BOARD=srf06/cc26x0 \ -dev/leds/cc26x0-cc13x0:BOARD=sensortag/cc1350 \ -dev/leds/cc26x0-cc13x0:BOARD=sensortag/cc2650 \ -dev/leds/cc26x0-cc13x0:BOARD=launchpad/cc1310 \ -dev/leds/cc26x0-cc13x0:BOARD=launchpad/cc1350 \ -dev/leds/cc26x0-cc13x0:BOARD=launchpad/cc2650 \ -dev/leds/cc26x0-cc13x0:BOARD=launchpad/cc2640r2 \ -6tisch/etsi-plugtest-2017/cc26x0-cc13x0:BOARD=launchpad/cc2650 \ -mqtt-client/cc26x0-cc13x0:BOARD=srf06/cc26x0 \ -mqtt-client/cc26x0-cc13x0:BOARD=launchpad/cc2650 \ -mqtt-client/cc26x0-cc13x0:BOARD=sensortag/cc2650 \ -hello-world/simplelink:BOARD=launchpad/cc26x2r1 \ -hello-world/simplelink:BOARD=sensortag/cc2650 \ -nullnet/simplelink:BOARD=sensortag/cc2650 \ -rpl-border-router/simplelink:BOARD=launchpad/cc26x2r1 \ -sensniff/simplelink:BOARD=launchpad/cc26x2r1 \ -dev/gpio-hal/simplelink:BOARD=launchpad/cc1310 \ -dev/gpio-hal/simplelink:BOARD=launchpad/cc1312r1 \ -dev/gpio-hal/simplelink:BOARD=launchpad/cc1350 \ -dev/gpio-hal/simplelink:BOARD=launchpad/cc1350-4 \ -dev/gpio-hal/simplelink:BOARD=launchpad/cc1352p1 \ -dev/gpio-hal/simplelink:BOARD=launchpad/cc1352p-2 \ -dev/gpio-hal/simplelink:BOARD=launchpad/cc1352p-4 \ -dev/gpio-hal/simplelink:BOARD=launchpad/cc1352r1 \ -dev/gpio-hal/simplelink:BOARD=launchpad/cc26x2r1 \ -dev/gpio-hal/simplelink:BOARD=sensortag/cc1350 \ -dev/gpio-hal/simplelink:BOARD=sensortag/cc2650 \ -dev/gpio-hal/simplelink:BOARD=srf06/cc13x0 \ -dev/gpio-hal/simplelink:BOARD=srf06/cc26x0 \ -dev/leds/simplelink:BOARD=launchpad/cc1310 \ -dev/leds/simplelink:BOARD=launchpad/cc1312r1 \ -dev/leds/simplelink:BOARD=launchpad/cc1350 \ -dev/leds/simplelink:BOARD=launchpad/cc1350-4 \ -dev/leds/simplelink:BOARD=launchpad/cc1352p1 \ -dev/leds/simplelink:BOARD=launchpad/cc1352p-2 \ -dev/leds/simplelink:BOARD=launchpad/cc1352p-4 \ -dev/leds/simplelink:BOARD=launchpad/cc1352r1 \ -dev/leds/simplelink:BOARD=launchpad/cc26x2r1 \ -dev/leds/simplelink:BOARD=sensortag/cc1350 \ -dev/leds/simplelink:BOARD=sensortag/cc2650 \ -dev/leds/simplelink:BOARD=srf06/cc13x0 \ -dev/leds/simplelink:BOARD=srf06/cc26x0 \ -mqtt-client/simplelink:BOARD=launchpad/cc26x2r1 \ -mqtt-client/simplelink:BOARD=sensortag/cc2650:DEFINES=BOARD_CONF_SENSORS_DISABLE=1,TI_SPI_CONF_ENABLE=0 \ -mqtt-client/simplelink:BOARD=srf06/cc26x0:DEFINES=BOARD_CONF_SENSORS_DISABLE=1,TI_SPI_CONF_ENABLE=0 \ -mqtt-client/cc2538dk \ -storage/cfs-coffee/cc2538dk \ -sensniff/cc2538dk \ -rpl-udp/cc2538dk \ -coap/coap-example-client/cc2538dk \ -coap/coap-example-server/cc2538dk \ -slip-radio/cc2538dk \ -lwm2m-ipso-objects/cc2538dk \ -lwm2m-ipso-objects/cc2538dk:DEFINES=LWM2M_Q_MODE_CONF_ENABLED=1 \ -multicast/cc2538dk \ -dev/gpio-hal/cc2538dk \ -dev/leds/cc2538dk \ -platform-specific/cc2538-common/cc2538dk \ -platform-specific/cc2538-common/crypto/cc2538dk \ -platform-specific/cc2538-common/pka/cc2538dk \ -hello-world/cc2538dk \ -rpl-border-router/cc2538dk \ -rpl-border-router/cc2538dk:MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC \ -6tisch/simple-node/cc2538dk \ -6tisch/simple-node/cc2538dk:MAKE_WITH_SECURITY=1,MAKE_WITH_ORCHESTRA=1 \ -hello-world/nrf52dk \ -platform-specific/nrf52dk/coap-demo/coap-server/nrf52dk \ -platform-specific/nrf52dk/coap-demo/coap-client/nrf52dk:SERVER_IPV6_EP=ffff \ -platform-specific/nrf52dk/mqtt-demo/nrf52dk \ -platform-specific/nrf52dk/blink-hello/nrf52dk \ -platform-specific/nrf52dk/timer-test/nrf52dk \ -libs/data-structures/nrf52dk \ -libs/logging/nrf52dk - -TOOLS= - -include ../Makefile.compile-test diff --git a/tests/03-compile-arm-ports-02/Makefile b/tests/03-compile-arm-ports-02/Makefile deleted file mode 100644 index 655967e1b..000000000 --- a/tests/03-compile-arm-ports-02/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -EXAMPLESDIR=../../examples -TOOLSDIR=../../tools - -EXAMPLES = \ -rpl-border-router/zoul \ -platform-specific/cc2538-common/zoul \ -platform-specific/cc2538-common/crypto/zoul \ -platform-specific/cc2538-common/pka/zoul \ -platform-specific/zoul/orion/ip64-router/zoul:BOARD=orion \ -platform-specific/zoul/orion/client/zoul:BOARD=orion \ -platform-specific/zoul/rev-b/zoul:BOARD=remote-revb \ -platform-specific/zoul/at-test/zoul \ -platform-specific/zoul/rtcc/zoul \ -platform-specific/zoul/zoul \ -coap/coap-example-client/zoul \ -coap/coap-example-server/zoul \ -multicast/zoul \ -lwm2m-ipso-objects/zoul \ -lwm2m-ipso-objects/zoul:MAKE_WITH_DTLS=1 \ -lwm2m-ipso-objects/zoul:DEFINES=LWM2M_Q_MODE_CONF_ENABLED=1 \ -lwm2m-ipso-objects/zoul:DEFINES=LWM2M_Q_MODE_CONF_ENABLED=1,LWM2M_Q_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION=1\ -hello-world/zoul \ -sensniff/zoul \ -sensniff/zoul:ZOUL_CONF_SUB_GHZ_SNIFFER=1 \ -storage/cfs-coffee/zoul \ -storage/antelope-shell/zoul \ -6tisch/simple-node/zoul \ -6tisch/simple-node/zoul:MAKE_WITH_ORCHESTRA=1 \ -6tisch/simple-node/zoul:MAKE_WITH_SECURITY=1 \ -libs/logging/zoul \ -libs/logging/zoul:MAKE_MAC=MAKE_MAC_TSCH \ -6tisch/etsi-plugtest-2017/zoul:BOARD=remote \ -6tisch/6p-packet/zoul \ -6tisch/sixtop/zoul \ -websocket/zoul \ -libs/timers/zoul \ -libs/energest/zoul \ -libs/trickle-library/zoul \ -libs/data-structures/zoul \ -libs/ipv6-uipbuf/zoul \ -nullnet/zoul \ -slip-radio/zoul \ -benchmarks/rpl-req-resp/zoul \ -dev/gpio-hal/zoul:BOARD=remote-reva \ -dev/gpio-hal/zoul:BOARD=remote-revb \ -dev/gpio-hal/zoul:BOARD=firefly-reva \ -dev/gpio-hal/zoul:BOARD=firefly \ -dev/gpio-hal/zoul:BOARD=orion \ -dev/leds/zoul:BOARD=remote-reva \ -dev/leds/zoul:BOARD=remote-revb \ -dev/leds/zoul:BOARD=firefly-reva \ -dev/leds/zoul:BOARD=firefly \ -dev/leds/zoul:BOARD=orion \ -dev/rgb-led/zoul:BOARD=remote-reva \ -dev/rgb-led/zoul:BOARD=remote-revb \ -dev/rgb-led/zoul:BOARD=firefly-reva \ -dev/rgb-led/zoul:BOARD=firefly \ -dev/rgb-led/zoul:BOARD=orion \ -mqtt-client/zoul:BOARD=firefly \ -mqtt-client/openmote-cc2538 \ -storage/cfs-coffee/openmote-cc2538 \ -sensniff/openmote-cc2538 \ -hello-world/openmote-cc2538 \ -rpl-udp/openmote-cc2538 \ -dev/gpio-hal/openmote-cc2538 \ -dev/leds/openmote-cc2538 \ -rpl-border-router/openmote-cc2538 \ -libs/ipv6-hooks/openmote-cc2538 \ -libs/shell/openmote-cc2538 \ -libs/simple-energest/openmote-cc2538 \ -libs/deployment/openmote-cc2538 \ -6tisch/simple-node/openmote-cc2538 \ -6tisch/simple-node/openmote-cc2538:MAKE_WITH_SECURITY=1,MAKE_WITH_ORCHESTRA=1 \ - -TOOLS= - -include ../Makefile.compile-test diff --git a/tests/04-compile-nxp-ports/Makefile b/tests/04-compile-nxp-ports/Makefile deleted file mode 100644 index 214bced26..000000000 --- a/tests/04-compile-nxp-ports/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -EXAMPLESDIR=../../examples -TOOLSDIR=../../tools - -# build jn516x examples, covering IPv6, RPL, CoAP -EXAMPLES = \ -hello-world/jn516x \ -platform-specific/jn516x/dr1175-sensors/jn516x \ -platform-specific/jn516x/rpl/node/jn516x \ -platform-specific/jn516x/rpl/coap-dongle-node/jn516x \ -platform-specific/jn516x/rpl/coap-dr1175-node/jn516x \ -platform-specific/jn516x/rpl/coap-dr1199-node/jn516x \ -platform-specific/jn516x/tsch/simple-sensor-network/node/jn516x \ -platform-specific/jn516x/tsch/tx-power-verification/node/jn516x \ -platform-specific/jn516x/tsch/uart1-test-node/jn516x \ -coap/coap-example-client/jn516x \ -coap/coap-example-server/jn516x \ -sensniff/jn516x \ -rpl-border-router/jn516x \ -6tisch/simple-node/jn516x \ -6tisch/simple-node/jn516x:MAKE_WITH_ORCHESTRA=1 \ -6tisch/simple-node/jn516x:MAKE_WITH_SECURITY=1 \ -libs/logging/jn516x \ -6tisch/etsi-plugtest-2017/jn516x - -TOOLS= - -include ../Makefile.compile-test diff --git a/tests/05-compile-tools/Makefile b/tests/05-compile-tools/Makefile deleted file mode 100644 index 6377d6674..000000000 --- a/tests/05-compile-tools/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2014, Friedrich-Alexander University Erlangen-Nuremberg -# 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 University 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 UNIVERSITY 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 INSTITUTE 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. - -TOOLS=tools/serial-io -BASEDIR=../../ -TESTLOGS=$(subst /,__,$(patsubst %,%.testlog, $(TOOLS))) - -all: clean summary - -%.testlog: - @echo -n Building tool: $(basename $@) - @printf "%-32s" "$@" > $@ - @$(MAKE) -C $(BASEDIR)/$(basename $(subst __,/,$@)) clean > /dev/null && \ - $(MAKE) -C $(BASEDIR)/$(basename $(subst __,/,$@)) > /dev/null && \ - (echo " -> OK" && echo "TEST OK" >> $@) || \ - (echo " -> FAIL" && echo "TEST FAIL" >> $@) - -summary: $(TESTLOGS) - @cat *.testlog > summary - @echo "========== Summary ==========" - @cat summary - -clean: - @rm -f *.testlog summary diff --git a/tests/07-simulation-base/01-hello-world-sky.csc b/tests/07-simulation-base/01-hello-world-sky.csc deleted file mode 100644 index 050631b70..000000000 --- a/tests/07-simulation-base/01-hello-world-sky.csc +++ /dev/null @@ -1,81 +0,0 @@ - - - - Hello World test (Sky) - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #1 - [CONTIKI_DIR]/examples/hello-world/hello-world.c - make -j hello-world.sky TARGET=sky - [CONTIKI_DIR]/examples/hello-world/hello-world.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - - - - - org.contikios.cooja.interfaces.Position - 64.11203103628397 - 93.06735634828134 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/hello-world.js - true - - 541 - 0 - 448 - 299 - 7 - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 7 - 10 - - - org.contikios.cooja.plugins.LogListener - - - - 680 - 1 - 240 - 51 - 288 - - diff --git a/tests/07-simulation-base/02-ringbufindex.csc b/tests/07-simulation-base/02-ringbufindex.csc deleted file mode 100644 index 5b236bc5a..000000000 --- a/tests/07-simulation-base/02-ringbufindex.csc +++ /dev/null @@ -1,146 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - [APPS_DIR]/radiologger-headless - - Test ringbufindex - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype297 - ringbufindex testee - [CONFIG_DIR]/code-ringbufindex/test-ringbufindex.c - make test-ringbufindex.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype297 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 194.0 173.0 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1320 - 3 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - - - - 500.0 - - 1720 - 2 - 166 - 0 - 957 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1040 - 5 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/04-ringbufindex.js - true - - 495 - 0 - 525 - 663 - 105 - - diff --git a/tests/07-simulation-base/03-nullnet-broadcast.csc b/tests/07-simulation-base/03-nullnet-broadcast.csc deleted file mode 100644 index 302a04b9b..000000000 --- a/tests/07-simulation-base/03-nullnet-broadcast.csc +++ /dev/null @@ -1,204 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - NullNet Broadcast Example - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype613 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/nullnet/nullnet-broadcast.c - make TARGET=cooja clean -make -j nullnet-broadcast.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 41.086521947449974 - 65.60589922041163 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype613 - - - - org.contikios.cooja.interfaces.Position - 28.458497515673685 - 52.43866085432446 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype613 - - - - org.contikios.cooja.interfaces.Position - 6.830522087791668 - 77.15936959931379 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype613 - - - - org.contikios.cooja.plugins.SimControl - 280 - 5 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 6.180735450568881 0.0 0.0 6.180735450568881 49.41871362245591 -238.19717905203652 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1179 - 0 - 704 - 679 - 0 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - - - - 1.7067792216977151 - - 1858 - 3 - 166 - 9 - 723 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - 500 - 2 - 300 - 19 - 409 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 823 - 1 - 700 - 997 - 162 - - diff --git a/tests/07-simulation-base/04-nullnet-broadcast-tsch.csc b/tests/07-simulation-base/04-nullnet-broadcast-tsch.csc deleted file mode 100644 index 498c7fcbe..000000000 --- a/tests/07-simulation-base/04-nullnet-broadcast-tsch.csc +++ /dev/null @@ -1,204 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - NullNet Broadcast Example - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype613 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/nullnet/nullnet-broadcast.c - make TARGET=cooja clean -make -j nullnet-broadcast.cooja MAKE_MAC=MAKE_MAC_TSCH TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 41.086521947449974 - 65.60589922041163 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype613 - - - - org.contikios.cooja.interfaces.Position - 28.458497515673685 - 52.43866085432446 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype613 - - - - org.contikios.cooja.interfaces.Position - 6.830522087791668 - 77.15936959931379 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype613 - - - - org.contikios.cooja.plugins.SimControl - 280 - 5 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 6.180735450568881 0.0 0.0 6.180735450568881 49.41871362245591 -238.19717905203652 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1179 - 0 - 704 - 679 - 0 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - - - - 1.7067792216977151 - - 1858 - 3 - 166 - 9 - 723 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - 500 - 2 - 300 - 19 - 409 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 823 - 1 - 700 - 997 - 162 - - diff --git a/tests/07-simulation-base/05-nullnet-unicast.csc b/tests/07-simulation-base/05-nullnet-unicast.csc deleted file mode 100644 index 12b600317..000000000 --- a/tests/07-simulation-base/05-nullnet-unicast.csc +++ /dev/null @@ -1,202 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - NullNet Broadcast Example - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype634 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/nullnet/nullnet-broadcast.c - make TARGET=cooja clean -make -j nullnet-broadcast.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 41.086521947449974 - 65.60589922041163 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype634 - - - - org.contikios.cooja.interfaces.Position - 28.458497515673685 - 52.43866085432446 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype634 - - - - org.contikios.cooja.interfaces.Position - 6.830522087791668 - 77.15936959931379 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype634 - - - - org.contikios.cooja.plugins.SimControl - 280 - 5 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 6.180735450568881 0.0 0.0 6.180735450568881 49.41871362245591 -238.19717905203652 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1179 - 1 - 704 - 679 - 0 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - - - - 1.7067792216977151 - - 1858 - 4 - 166 - 9 - 723 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - 500 - 3 - 300 - 109 - 408 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 902 - 108 - - diff --git a/tests/07-simulation-base/06-nullnet-unicast-tsch.csc b/tests/07-simulation-base/06-nullnet-unicast-tsch.csc deleted file mode 100644 index e64247095..000000000 --- a/tests/07-simulation-base/06-nullnet-unicast-tsch.csc +++ /dev/null @@ -1,202 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - NullNet Broadcast Example - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype634 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/nullnet/nullnet-broadcast.c - make TARGET=cooja clean -make -j nullnet-broadcast.cooja MAKE_MAC=MAKE_MAC_TSCH TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 41.086521947449974 - 65.60589922041163 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype634 - - - - org.contikios.cooja.interfaces.Position - 28.458497515673685 - 52.43866085432446 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype634 - - - - org.contikios.cooja.interfaces.Position - 6.830522087791668 - 77.15936959931379 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype634 - - - - org.contikios.cooja.plugins.SimControl - 280 - 5 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 6.180735450568881 0.0 0.0 6.180735450568881 49.41871362245591 -238.19717905203652 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1179 - 1 - 704 - 679 - 0 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - - - - 1.7067792216977151 - - 1858 - 4 - 166 - 9 - 723 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - 500 - 3 - 300 - 109 - 408 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 902 - 108 - - diff --git a/tests/07-simulation-base/07-hello-world-z1.csc b/tests/07-simulation-base/07-hello-world-z1.csc deleted file mode 100644 index 33963c36c..000000000 --- a/tests/07-simulation-base/07-hello-world-z1.csc +++ /dev/null @@ -1,83 +0,0 @@ - - - - Hello World (Z1) - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.Z1MoteType - z11 - Z1 Mote Type #z11 - [CONTIKI_DIR]/examples/hello-world/hello-world.c - make hello-world.z1 TARGET=z1 - [CONTIKI_DIR]/examples/hello-world/hello-world.z1 - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspDefaultSerial - org.contikios.cooja.mspmote.interfaces.MspLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - - - - - org.contikios.cooja.interfaces.Position - 94.96401380574989 - 21.247662337471553 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - z11 - - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 38 - 13 - - - org.contikios.cooja.plugins.LogListener - - - - 680 - 1 - 240 - 109 - 377 - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/hello-world.js - true - - 600 - 0 - 700 - 330 - 24 - - - diff --git a/tests/07-simulation-base/15-cooja-multicast-11-hops-rollt-tm.csc b/tests/07-simulation-base/15-cooja-multicast-11-hops-rollt-tm.csc deleted file mode 100644 index 473df16dd..000000000 --- a/tests/07-simulation-base/15-cooja-multicast-11-hops-rollt-tm.csc +++ /dev/null @@ -1,365 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - Multicast regression test - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 15.0 - 0.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype612 - Root/sender - [CONTIKI_DIR]/examples/multicast/root.c - make -j root.cooja TARGET=cooja DEFINES=UIP_MCAST6_CONF_ENGINE=UIP_MCAST6_ENGINE_ROLL_TM - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype890 - Intermediate - [CONTIKI_DIR]/examples/multicast/intermediate.c - make -j intermediate.cooja TARGET=cooja DEFINES=UIP_MCAST6_CONF_ENGINE=UIP_MCAST6_ENGINE_ROLL_TM - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype956 - Receiver - [CONTIKI_DIR]/examples/multicast/sink.c - make sink.cooja TARGET=cooja DEFINES=UIP_MCAST6_CONF_ENGINE=UIP_MCAST6_ENGINE_ROLL_TM - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.983976888750106 - 0.37523218201044733 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype612 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 10.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 20.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 30.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 40.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 50.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 60.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 70.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 79.93950307524713 - -0.043451055913349 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 10 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 90.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 11 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 99.61761525766555 - 0.37523218201044733 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 12 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype956 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.388440494916608 0.0 0.0 2.388440494916608 109.06925371156906 149.10378026149033 - - 400 - 3 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1200 - 2 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 920 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 843 - 77 - - diff --git a/tests/07-simulation-base/16-cooja-multicast-11-hops-smrf.csc b/tests/07-simulation-base/16-cooja-multicast-11-hops-smrf.csc deleted file mode 100644 index e20a30cb6..000000000 --- a/tests/07-simulation-base/16-cooja-multicast-11-hops-smrf.csc +++ /dev/null @@ -1,365 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - Multicast regression test - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 15.0 - 0.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype612 - Root/sender - [CONTIKI_DIR]/examples/multicast/root.c - make -j root.cooja TARGET=cooja DEFINES=UIP_MCAST6_CONF_ENGINE=UIP_MCAST6_ENGINE_SMRF - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype890 - Intermediate - [CONTIKI_DIR]/examples/multicast/intermediate.c - make -j intermediate.cooja TARGET=cooja DEFINES=UIP_MCAST6_CONF_ENGINE=UIP_MCAST6_ENGINE_SMRF - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype956 - Receiver - [CONTIKI_DIR]/examples/multicast/sink.c - make -j sink.cooja TARGET=cooja DEFINES=UIP_MCAST6_CONF_ENGINE=UIP_MCAST6_ENGINE_SMRF - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.983976888750106 - 0.37523218201044733 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype612 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 10.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 20.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 30.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 40.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 50.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 60.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 70.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 79.93950307524713 - -0.043451055913349 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 10 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 90.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 11 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 99.61761525766555 - 0.37523218201044733 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 12 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype956 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.388440494916608 0.0 0.0 2.388440494916608 109.06925371156906 149.10378026149033 - - 400 - 3 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1200 - 2 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 920 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 843 - 77 - - diff --git a/tests/07-simulation-base/17-cooja-multicast-11-hops-esmrf.csc b/tests/07-simulation-base/17-cooja-multicast-11-hops-esmrf.csc deleted file mode 100644 index 14b74b41e..000000000 --- a/tests/07-simulation-base/17-cooja-multicast-11-hops-esmrf.csc +++ /dev/null @@ -1,365 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - Multicast regression test - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 15.0 - 0.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype612 - Root/sender - [CONTIKI_DIR]/examples/multicast/root.c - make -j root.cooja TARGET=cooja DEFINES=UIP_MCAST6_CONF_ENGINE=UIP_MCAST6_ENGINE_ESMRF - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype890 - Intermediate - [CONTIKI_DIR]/examples/multicast/intermediate.c - make -j intermediate.cooja TARGET=cooja DEFINES=UIP_MCAST6_CONF_ENGINE=UIP_MCAST6_ENGINE_ESMRF - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype956 - Receiver - [CONTIKI_DIR]/examples/multicast/sink.c - make sink.cooja TARGET=cooja DEFINES=UIP_MCAST6_CONF_ENGINE=UIP_MCAST6_ENGINE_ESMRF - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.983976888750106 - 0.37523218201044733 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype612 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 10.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 20.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 30.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 40.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 50.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 60.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 70.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 79.93950307524713 - -0.043451055913349 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 10 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 90.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 11 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype890 - - - - org.contikios.cooja.interfaces.Position - 99.61761525766555 - 0.37523218201044733 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 12 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype956 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.388440494916608 0.0 0.0 2.388440494916608 109.06925371156906 149.10378026149033 - - 400 - 3 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1200 - 2 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 920 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 843 - 77 - - diff --git a/tests/07-simulation-base/18-cooja-multicast-31-hops.csc b/tests/07-simulation-base/18-cooja-multicast-31-hops.csc deleted file mode 100644 index 86ae6916f..000000000 --- a/tests/07-simulation-base/18-cooja-multicast-31-hops.csc +++ /dev/null @@ -1,705 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - Multicast regression test - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 15.0 - 0.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype816 - Root/sender - [CONTIKI_DIR]/examples/multicast/root.c - make -j root.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype53 - Intermediate - [CONTIKI_DIR]/examples/multicast/intermediate.c - make -j intermediate.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype191 - Receiver - [CONTIKI_DIR]/examples/multicast/sink.c - make -j sink.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.983976888750106 - 0.37523218201044733 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype816 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 10.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 20.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 30.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 40.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 50.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 60.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 70.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 79.93950307524713 - -0.043451055913349 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 10 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 90.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 11 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 299.830399237567 - 0.21169609213234786 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 12 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype191 - - - - org.contikios.cooja.interfaces.Position - 100.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 13 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 110.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 14 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 120.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 15 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 130.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 16 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 140.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 17 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 150.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 18 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 160.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 19 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 170.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 20 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 180.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 21 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 190.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 22 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 200.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 23 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 210.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 24 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 220.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 25 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 230.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 26 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 240.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 27 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 250.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 28 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 260.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 29 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 270.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 30 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 280.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 31 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.interfaces.Position - 290.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 32 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype53 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 1.1837122130192945 0.0 0.0 1.1837122130192945 27.087094588040927 150.74941275029448 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1200 - 3 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 920 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 843 - 77 - - diff --git a/tests/07-simulation-base/19-cooja-rpl-tsch.csc b/tests/07-simulation-base/19-cooja-rpl-tsch.csc deleted file mode 100644 index 99e11d63d..000000000 --- a/tests/07-simulation-base/19-cooja-rpl-tsch.csc +++ /dev/null @@ -1,293 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - RPL+TSCH - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype1 - Cooja Mote Type #mtype1 - [CONTIKI_DIR]/examples/6tisch/simple-node/node.c - make TARGET=cooja clean -make -j node.cooja TARGET=cooja MAKE_WITH_ORCHESTRA=0 MAKE_WITH_SECURITY=0 MAKE_WITH_PERIODIC_ROUTES_PRINT=1 - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - - org.contikios.cooja.interfaces.Position - -1.285769821276336 - 38.58045647334346 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype1 - - - - - org.contikios.cooja.interfaces.Position - -19.324109516886306 - 76.23135780254927 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype1 - - - - - org.contikios.cooja.interfaces.Position - 5.815501305791592 - 76.77463755494317 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype1 - - - - - org.contikios.cooja.interfaces.Position - 31.920697784030082 - 50.5212265977149 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype1 - - - - - org.contikios.cooja.interfaces.Position - 47.21747673247198 - 30.217765340599726 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype1 - - - - - org.contikios.cooja.interfaces.Position - 10.622284947035123 - 109.81862399725188 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype1 - - - - - org.contikios.cooja.interfaces.Position - 52.41150716335335 - 109.93228340481916 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype1 - - - - - org.contikios.cooja.interfaces.Position - 70.18727461718498 - 70.06861701541145 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype1 - - - - - org.contikios.cooja.interfaces.Position - 80.29870484201041 - 99.37351603835938 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype1 - - - - org.contikios.cooja.plugins.SimControl - 242 - 4 - 160 - 11 - 241 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 1.7405603810040515 0.0 0.0 1.7405603810040515 47.95980153208088 -42.576134155447555 - - 236 - 3 - 230 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - ID:1 - - - - 1031 - 0 - 394 - 273 - 6 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - - - - 16529.88882215865 - - 1304 - 2 - 311 - 0 - 412 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 764 - 1 - 995 - 963 - 111 - - diff --git a/tests/07-simulation-base/20-cooja-rpl-tsch-orchestra.csc b/tests/07-simulation-base/20-cooja-rpl-tsch-orchestra.csc deleted file mode 100644 index 5ce2c8121..000000000 --- a/tests/07-simulation-base/20-cooja-rpl-tsch-orchestra.csc +++ /dev/null @@ -1,295 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - RPL+TSCH+Orchestrsa - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype11 - Cooja Mote Type #mtype11 - [CONTIKI_DIR]/examples/6tisch/simple-node/node.c - make TARGET=cooja clean -make -j node.cooja TARGET=cooja MAKE_WITH_ORCHESTRA=1 MAKE_WITH_SECURITY=0 MAKE_WITH_PERIODIC_ROUTES_PRINT=1 - [CONTIKI_DIR]/examples/6tisch/simple-node/node.mtype1 - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - - org.contikios.cooja.interfaces.Position - -1.285769821276336 - 38.58045647334346 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - -19.324109516886306 - 76.23135780254927 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 5.815501305791592 - 76.77463755494317 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 31.920697784030082 - 50.5212265977149 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 47.21747673247198 - 30.217765340599726 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 10.622284947035123 - 109.81862399725188 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 52.41150716335335 - 109.93228340481916 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 70.18727461718498 - 70.06861701541145 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 80.29870484201041 - 99.37351603835938 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - org.contikios.cooja.plugins.SimControl - 242 - 4 - 160 - 11 - 241 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 1.7405603810040515 0.0 0.0 1.7405603810040515 47.95980153208088 -42.576134155447555 - - 236 - 3 - 230 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - ID:1 - - - - 1031 - 0 - 394 - 273 - 6 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - - - - 16529.88882215865 - - 1304 - 2 - 311 - 0 - 412 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 764 - 1 - 995 - 963 - 111 - - diff --git a/tests/07-simulation-base/21-cooja-rpl-tsch-security.csc b/tests/07-simulation-base/21-cooja-rpl-tsch-security.csc deleted file mode 100644 index c34e6c4cf..000000000 --- a/tests/07-simulation-base/21-cooja-rpl-tsch-security.csc +++ /dev/null @@ -1,293 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - RPL+TSCH+Security - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype11 - Cooja Mote Type #mtype11 - [CONTIKI_DIR]/examples/6tisch/simple-node/node.c - make TARGET=cooja clean -make -j node.cooja TARGET=cooja MAKE_WITH_ORCHESTRA=0 MAKE_WITH_SECURITY=1 MAKE_WITH_PERIODIC_ROUTES_PRINT=1 - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - - org.contikios.cooja.interfaces.Position - -1.285769821276336 - 38.58045647334346 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - -19.324109516886306 - 76.23135780254927 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 5.815501305791592 - 76.77463755494317 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 31.920697784030082 - 50.5212265977149 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 47.21747673247198 - 30.217765340599726 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 10.622284947035123 - 109.81862399725188 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 52.41150716335335 - 109.93228340481916 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 70.18727461718498 - 70.06861701541145 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - - org.contikios.cooja.interfaces.Position - 80.29870484201041 - 99.37351603835938 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype11 - - - - org.contikios.cooja.plugins.SimControl - 242 - 4 - 160 - 11 - 241 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 1.7405603810040515 0.0 0.0 1.7405603810040515 47.95980153208088 -42.576134155447555 - - 236 - 3 - 230 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - ID:1 - - - - 1031 - 0 - 394 - 273 - 6 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - - - - 16529.88882215865 - - 1304 - 2 - 311 - 0 - 412 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 764 - 1 - 995 - 963 - 111 - - diff --git a/tests/07-simulation-base/22-stack-guard-sky.csc b/tests/07-simulation-base/22-stack-guard-sky.csc deleted file mode 100644 index 5d57eb148..000000000 --- a/tests/07-simulation-base/22-stack-guard-sky.csc +++ /dev/null @@ -1,81 +0,0 @@ - - - - Stack guard test (Sky) - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #1 - [CONTIKI_DIR]/examples/libs/stack-check/example-stack-check.c - make -j example-stack-check.sky TARGET=sky - [CONTIKI_DIR]/examples/libs/stack-check/example-stack-check.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - - - - - org.contikios.cooja.interfaces.Position - 64.11203103628397 - 93.06735634828134 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/22-stack-check.js - true - - 541 - 0 - 448 - 299 - 7 - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 7 - 10 - - - org.contikios.cooja.plugins.LogListener - - - - 680 - 1 - 240 - 51 - 288 - - diff --git a/tests/07-simulation-base/23-rpl-tsch-z1.csc b/tests/07-simulation-base/23-rpl-tsch-z1.csc deleted file mode 100644 index 170300f55..000000000 --- a/tests/07-simulation-base/23-rpl-tsch-z1.csc +++ /dev/null @@ -1,191 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - RPL+TSCH (Z1) - 1 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.Z1MoteType - z11 - Z1 Mote Type #z11 - [CONTIKI_DIR]/examples/6tisch/simple-node/node.c - make TARGET=z1 clean - make -j node.z1 TARGET=z1 MAKE_WITH_ORCHESTRA=0 MAKE_WITH_SECURITY=0 MAKE_WITH_PERIODIC_ROUTES_PRINT=1 - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspDefaultSerial - org.contikios.cooja.mspmote.interfaces.MspLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - - - - - org.contikios.cooja.interfaces.Position - -1.285769821276336 - 38.58045647334346 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - z11 - - - - - org.contikios.cooja.interfaces.Position - -19.324109516886306 - 76.23135780254927 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - z11 - - - - - org.contikios.cooja.interfaces.Position - 5.815501305791592 - 76.77463755494317 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - z11 - - - - - org.contikios.cooja.interfaces.Position - 31.920697784030082 - 50.5212265977149 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - z11 - - - - - org.contikios.cooja.interfaces.Position - 47.21747673247198 - 30.217765340599726 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - z11 - - - - org.contikios.cooja.plugins.SimControl - 242 - 4 - 160 - 11 - 241 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 1.7405603810040515 0.0 0.0 1.7405603810040515 47.95980153208088 -42.576134155447555 - - 236 - 3 - 230 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - ID:1 - - - - 1031 - 0 - 394 - 273 - 6 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - - - - 16529.88882215865 - - 1304 - 2 - 311 - 0 - 412 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 764 - 1 - 995 - 963 - 111 - - diff --git a/tests/07-simulation-base/31-data-structures-sky.csc b/tests/07-simulation-base/31-data-structures-sky.csc deleted file mode 100644 index 0e4e81069..000000000 --- a/tests/07-simulation-base/31-data-structures-sky.csc +++ /dev/null @@ -1,97 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - data-structures-sky - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #sky1 - [CONTIKI_DIR]/tests/07-simulation-base/code-data-structures/test-data-structures.c - make test-data-structures.sky TARGET=sky - [CONTIKI_DIR]/tests/07-simulation-base/code-data-structures/test-data-structures.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 3.086692968239446 - 5.726233183606267 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.LogListener - - - - - - 586 - 1 - 666 - 400 - 160 - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/data-structures.js - true - - 600 - 0 - 700 - 5 - 1 - - diff --git a/tests/07-simulation-base/Makefile b/tests/07-simulation-base/Makefile deleted file mode 100644 index 272bc7da1..000000000 --- a/tests/07-simulation-base/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../Makefile.simulation-test diff --git a/tests/07-simulation-base/code-data-structures/Makefile b/tests/07-simulation-base/code-data-structures/Makefile deleted file mode 100644 index d88177bbe..000000000 --- a/tests/07-simulation-base/code-data-structures/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -all: test-data-structures - -MODULES += os/services/unit-test - -MAKE_MAC = MAKE_MAC_NULLMAC -MAKE_NET = MAKE_NET_NULLNET - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/tests/07-simulation-base/code-data-structures/project-conf.h b/tests/07-simulation-base/code-data-structures/project-conf.h deleted file mode 100644 index 1e6d48809..000000000 --- a/tests/07-simulation-base/code-data-structures/project-conf.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UNIT_TEST_PRINT_FUNCTION print_test_report - -#endif /* PROJECT_CONF_H_ */ diff --git a/tests/07-simulation-base/code-data-structures/test-data-structures.c b/tests/07-simulation-base/code-data-structures/test-data-structures.c deleted file mode 100644 index da3833dc3..000000000 --- a/tests/07-simulation-base/code-data-structures/test-data-structures.c +++ /dev/null @@ -1,1047 +0,0 @@ -/* - * Copyright (c) 2017, George Oikonomou - http://www.spd.gr - * 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 "contiki.h" -#include "lib/list.h" -#include "lib/stack.h" -#include "lib/queue.h" -#include "lib/circular-list.h" -#include "lib/dbl-list.h" -#include "lib/dbl-circ-list.h" -#include "lib/random.h" -#include "services/unit-test/unit-test.h" - -#include -#include -#include -#include -/*---------------------------------------------------------------------------*/ -PROCESS(data_structure_test_process, "Data structure process"); -AUTOSTART_PROCESSES(&data_structure_test_process); -/*---------------------------------------------------------------------------*/ -typedef struct demo_struct_s { - struct demo_struct_s *next; - struct demo_struct_s *previous; -} demo_struct_t; -/*---------------------------------------------------------------------------*/ -#define ELEMENT_COUNT 10 -static demo_struct_t elements[ELEMENT_COUNT]; -/*---------------------------------------------------------------------------*/ -void -print_test_report(const unit_test_t *utp) -{ - printf("=check-me= "); - if(utp->result == unit_test_failure) { - printf("FAILED - %s: exit at L%u\n", utp->descr, utp->exit_line); - } else { - printf("SUCCEEDED - %s\n", utp->descr); - } -} -/*---------------------------------------------------------------------------*/ -UNIT_TEST_REGISTER(test_list, "Singly-linked list"); -UNIT_TEST(test_list) -{ - demo_struct_t *head, *tail; - - LIST(lst); - - UNIT_TEST_BEGIN(); - - memset(elements, 0, sizeof(elements)); - list_init(lst); - - /* Starts from empty */ - UNIT_TEST_ASSERT(list_head(lst) == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 0); - - /* - * Add an item. Should be head and tail - * 0 --> NULL - */ - list_add(lst, &elements[0]); - UNIT_TEST_ASSERT(list_head(lst) == &elements[0]); - UNIT_TEST_ASSERT(list_tail(lst) == &elements[0]); - UNIT_TEST_ASSERT(elements[0].next == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 1); - - /* - * Add an item. Should become the new tail - * 0 --> 1 --> NULL - */ - list_add(lst, &elements[1]); - head = list_head(lst); - tail = list_tail(lst); - UNIT_TEST_ASSERT(list_head(lst) == &elements[0]); - UNIT_TEST_ASSERT(list_tail(lst) == &elements[1]); - UNIT_TEST_ASSERT(head->next == tail); - UNIT_TEST_ASSERT(tail->next == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 2); - - /* - * Add after existing head - * 0 --> 2 --> 1 --> NULL - */ - head = list_head(lst); - list_insert(lst, head, &elements[2]); - head = list_head(lst); - tail = list_tail(lst); - UNIT_TEST_ASSERT(list_head(lst) == &elements[0]); - UNIT_TEST_ASSERT(list_tail(lst) == &elements[1]); - UNIT_TEST_ASSERT(head->next == &elements[2]); - UNIT_TEST_ASSERT(elements[2].next == tail); - UNIT_TEST_ASSERT(tail->next == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 3); - - /* - * Add after existing head - * 0 --> 2 --> 1 --> 3 --> NULL - */ - tail = list_tail(lst); - list_insert(lst, tail, &elements[3]); - tail = list_tail(lst); - UNIT_TEST_ASSERT(list_head(lst) == &elements[0]); - UNIT_TEST_ASSERT(list_tail(lst) == &elements[3]); - UNIT_TEST_ASSERT(tail->next == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 4); - - /* - * Re-add item 2 using list_add - * 0 --> 1 --> 3 --> 2 --> NULL - */ - list_add(lst, &elements[2]); - tail = list_tail(lst); - UNIT_TEST_ASSERT(list_head(lst) == &elements[0]); - UNIT_TEST_ASSERT(list_tail(lst) == &elements[2]); - UNIT_TEST_ASSERT(tail->next == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 4); - - /* - * Re-add item 3 using list_insert - * 0 --> 1 --> 2 --> 3 --> NULL - */ - tail = list_tail(lst); - list_insert(lst, tail, &elements[3]); - tail = list_tail(lst); - UNIT_TEST_ASSERT(list_head(lst) == &elements[0]); - UNIT_TEST_ASSERT(list_tail(lst) == &elements[3]); - UNIT_TEST_ASSERT(elements[2].next == tail); - UNIT_TEST_ASSERT(tail->next == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 4); - - /* - * Check that list contains elements 0, 1, 2, 3 - * and not others - * 0 --> 1 --> 2 --> 3 --> NULL - */ - UNIT_TEST_ASSERT(list_contains(lst, &elements[0])); - UNIT_TEST_ASSERT(list_contains(lst, &elements[1])); - UNIT_TEST_ASSERT(list_contains(lst, &elements[2])); - UNIT_TEST_ASSERT(list_contains(lst, &elements[3])); - int i; - for(i=4; i 1 --> 2 --> NULL - */ - tail = list_tail(lst); - UNIT_TEST_ASSERT(list_chop(lst) == tail); - head = list_head(lst); - tail = list_tail(lst); - UNIT_TEST_ASSERT(tail == &elements[2]); - UNIT_TEST_ASSERT(tail->next == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 3); - - /* - * Remove an item in the middle - * 0 --> 2 --> NULL - */ - head = list_head(lst); - list_remove(lst, head->next); - head = list_head(lst); - tail = list_tail(lst); - UNIT_TEST_ASSERT(head->next == tail); - UNIT_TEST_ASSERT(list_head(lst) == &elements[0]); - UNIT_TEST_ASSERT(list_tail(lst) == &elements[2]); - UNIT_TEST_ASSERT(tail->next == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 2); - - /* - * Remove the head - * 2 --> NULL - */ - list_remove(lst, list_head(lst)); - tail = list_tail(lst); - UNIT_TEST_ASSERT(list_head(lst) == &elements[2]); - UNIT_TEST_ASSERT(list_tail(lst) == &elements[2]); - UNIT_TEST_ASSERT(tail->next == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 1); - - /* Ends empty */ - list_remove(lst, list_tail(lst)); - UNIT_TEST_ASSERT(list_head(lst) == NULL); - UNIT_TEST_ASSERT(list_length(lst) == 0); - - UNIT_TEST_END(); -} -/*---------------------------------------------------------------------------*/ -UNIT_TEST_REGISTER(test_stack, "Stack Push/Pop"); -UNIT_TEST(test_stack) -{ - STACK(stack); - - UNIT_TEST_BEGIN(); - - memset(elements, 0, sizeof(elements)); - stack_init(stack); - - /* Starts from empty */ - UNIT_TEST_ASSERT(stack_is_empty(stack) == true); - UNIT_TEST_ASSERT(stack_peek(stack) == NULL); - UNIT_TEST_ASSERT(stack_pop(stack) == NULL); - - /* - * Push two elements. Peek and pop should be the last one. Stack should be - * non-empty after the pop - */ - stack_push(stack, &elements[0]); - stack_push(stack, &elements[1]); - - UNIT_TEST_ASSERT(stack_peek(stack) == &elements[1]); - UNIT_TEST_ASSERT(stack_pop(stack) == &elements[1]); - UNIT_TEST_ASSERT(stack_peek(stack) == &elements[0]); - UNIT_TEST_ASSERT(stack_is_empty(stack) == false); - UNIT_TEST_ASSERT(stack_pop(stack) == &elements[0]); - - /* Ends empty */ - UNIT_TEST_ASSERT(stack_is_empty(stack) == true); - UNIT_TEST_ASSERT(stack_peek(stack) == NULL); - UNIT_TEST_ASSERT(stack_pop(stack) == NULL); - - UNIT_TEST_END(); -} -/*---------------------------------------------------------------------------*/ -UNIT_TEST_REGISTER(test_queue, "Queue Enqueue/Dequeue"); -UNIT_TEST(test_queue) -{ - QUEUE(queue); - - UNIT_TEST_BEGIN(); - - memset(elements, 0, sizeof(elements)); - queue_init(queue); - - /* Starts from empty */ - UNIT_TEST_ASSERT(queue_is_empty(queue) == true); - UNIT_TEST_ASSERT(queue_peek(queue) == NULL); - UNIT_TEST_ASSERT(queue_dequeue(queue) == NULL); - - /* Enqueue three elements. They should come out in the same order */ - queue_enqueue(queue, &elements[0]); - queue_enqueue(queue, &elements[1]); - queue_enqueue(queue, &elements[2]); - - UNIT_TEST_ASSERT(queue_dequeue(queue) == &elements[0]); - UNIT_TEST_ASSERT(queue_dequeue(queue) == &elements[1]); - UNIT_TEST_ASSERT(queue_dequeue(queue) == &elements[2]); - - /* Should be empty */ - UNIT_TEST_ASSERT(queue_is_empty(queue) == true); - UNIT_TEST_ASSERT(queue_peek(queue) == NULL); - UNIT_TEST_ASSERT(queue_dequeue(queue) == NULL); - - UNIT_TEST_END(); -} -/*---------------------------------------------------------------------------*/ -UNIT_TEST_REGISTER(test_csll, "Circular, singly-linked list"); -UNIT_TEST(test_csll) -{ - demo_struct_t *head, *tail; - - CIRCULAR_LIST(csll); - - UNIT_TEST_BEGIN(); - - memset(elements, 0, sizeof(elements)); - circular_list_init(csll); - - /* Starts from empty */ - UNIT_TEST_ASSERT(circular_list_is_empty(csll) == true); - UNIT_TEST_ASSERT(circular_list_length(csll) == 0); - UNIT_TEST_ASSERT(circular_list_head(csll) == NULL); - UNIT_TEST_ASSERT(circular_list_tail(csll) == NULL); - - /* Add one element. Should point to itself and act as head and tail */ - circular_list_add(csll, &elements[0]); - - UNIT_TEST_ASSERT(circular_list_is_empty(csll) == false); - UNIT_TEST_ASSERT(circular_list_length(csll) == 1); - UNIT_TEST_ASSERT(circular_list_head(csll) == &elements[0]); - UNIT_TEST_ASSERT(circular_list_tail(csll) == &elements[0]); - UNIT_TEST_ASSERT(elements[0].next == &elements[0]); - - /* Add a second element. The two should point to each-other */ - circular_list_add(csll, &elements[1]); - UNIT_TEST_ASSERT(elements[0].next == &elements[1]); - UNIT_TEST_ASSERT(elements[1].next == &elements[0]); - - /* - * Add a third element and check that head->next->next points to tail. - * Check that tail->next points to the head - */ - circular_list_add(csll, &elements[2]); - head = circular_list_head(csll); - tail = circular_list_tail(csll); - - UNIT_TEST_ASSERT(head->next->next == circular_list_tail(csll)); - UNIT_TEST_ASSERT(tail->next == circular_list_head(csll)); - - /* Re-add an existing element. Check the list's integrity */ - circular_list_add(csll, &elements[1]); - head = circular_list_head(csll); - tail = circular_list_tail(csll); - - UNIT_TEST_ASSERT(circular_list_is_empty(csll) == false); - UNIT_TEST_ASSERT(circular_list_length(csll) == 3); - UNIT_TEST_ASSERT(head->next->next->next == circular_list_head(csll)); - UNIT_TEST_ASSERT(head->next->next == circular_list_tail(csll)); - UNIT_TEST_ASSERT(tail->next == circular_list_head(csll)); - - /* Add another two elements, then start testing removal */ - circular_list_add(csll, &elements[3]); - circular_list_add(csll, &elements[4]); - - /* Remove an item in the middle and test list integrity */ - head = circular_list_head(csll); - circular_list_remove(csll, head->next->next); - head = circular_list_head(csll); - tail = circular_list_tail(csll); - - UNIT_TEST_ASSERT(circular_list_length(csll) == 4); - UNIT_TEST_ASSERT(head->next->next->next->next == circular_list_head(csll)); - UNIT_TEST_ASSERT(head->next->next->next == circular_list_tail(csll)); - UNIT_TEST_ASSERT(tail->next == circular_list_head(csll)); - - /* Remove the head and test list integrity */ - circular_list_remove(csll, circular_list_head(csll)); - head = circular_list_head(csll); - tail = circular_list_tail(csll); - - UNIT_TEST_ASSERT(circular_list_length(csll) == 3); - UNIT_TEST_ASSERT(head->next->next->next == circular_list_head(csll)); - UNIT_TEST_ASSERT(head->next->next == circular_list_tail(csll)); - UNIT_TEST_ASSERT(tail->next == circular_list_head(csll)); - - /* Remove the tail and test list integrity */ - circular_list_remove(csll, circular_list_tail(csll)); - head = circular_list_head(csll); - tail = circular_list_tail(csll); - - UNIT_TEST_ASSERT(circular_list_length(csll) == 2); - UNIT_TEST_ASSERT(head->next->next == circular_list_head(csll)); - UNIT_TEST_ASSERT(head->next == circular_list_tail(csll)); - UNIT_TEST_ASSERT(tail->next == circular_list_head(csll)); - - /* - * Remove the tail - * Only one item left: Make sure the head and tail are the same and point to - * each other - */ - circular_list_remove(csll, circular_list_tail(csll)); - head = circular_list_head(csll); - tail = circular_list_tail(csll); - - UNIT_TEST_ASSERT(circular_list_length(csll) == 1); - UNIT_TEST_ASSERT(head == tail); - UNIT_TEST_ASSERT(head->next->next == circular_list_head(csll)); - UNIT_TEST_ASSERT(head->next == circular_list_head(csll)); - UNIT_TEST_ASSERT(head->next == circular_list_tail(csll)); - UNIT_TEST_ASSERT(tail->next == circular_list_head(csll)); - UNIT_TEST_ASSERT(tail->next == circular_list_tail(csll)); - - /* Remove the last element by removing the head */ - circular_list_remove(csll, circular_list_head(csll)); - UNIT_TEST_ASSERT(circular_list_is_empty(csll) == true); - UNIT_TEST_ASSERT(circular_list_length(csll) == 0); - UNIT_TEST_ASSERT(circular_list_head(csll) == NULL); - UNIT_TEST_ASSERT(circular_list_tail(csll) == NULL); - - /* Remove the last element by removing the tail */ - circular_list_add(csll, &elements[0]); - circular_list_remove(csll, circular_list_tail(csll)); - UNIT_TEST_ASSERT(circular_list_is_empty(csll) == true); - UNIT_TEST_ASSERT(circular_list_length(csll) == 0); - UNIT_TEST_ASSERT(circular_list_head(csll) == NULL); - UNIT_TEST_ASSERT(circular_list_tail(csll) == NULL); - - UNIT_TEST_END(); -} -/*---------------------------------------------------------------------------*/ -UNIT_TEST_REGISTER(test_dll, "Doubly-linked list"); -UNIT_TEST(test_dll) -{ - demo_struct_t *head, *tail; - - CIRCULAR_LIST(dll); - - UNIT_TEST_BEGIN(); - - memset(elements, 0, sizeof(elements)); - - /* Starts from empty */ - dbl_list_init(dll); - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == true); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 0); - UNIT_TEST_ASSERT(dbl_list_head(dll) == NULL); - UNIT_TEST_ASSERT(dbl_list_tail(dll) == NULL); - - /* - * Add an item by adding to the head. - * Head and tail should point to NULL in both directions - */ - dbl_list_add_head(dll, &elements[0]); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 1); - UNIT_TEST_ASSERT(head == &elements[0]); - UNIT_TEST_ASSERT(tail == &elements[0]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == NULL); - UNIT_TEST_ASSERT(tail->previous == NULL); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Add an item by adding to the tail. - * Head and tail should point to NULL in both directions - */ - dbl_list_remove(dll, dbl_list_head(dll)); - dbl_list_add_tail(dll, &elements[1]); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 1); - UNIT_TEST_ASSERT(head == &elements[1]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == NULL); - UNIT_TEST_ASSERT(tail->previous == NULL); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Add a second item to head. Head points forward to tail. - * Tail points backwards to head. - */ - dbl_list_add_head(dll, &elements[2]); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 2); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == tail); - UNIT_TEST_ASSERT(tail->previous == head); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Add before head. - * NULL <-- 3 --> 2 --> 1 --> NULL - */ - dbl_list_add_before(dll, dbl_list_head(dll), &elements[3]); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 3); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == &elements[2]); - UNIT_TEST_ASSERT(head->next->next == tail); - UNIT_TEST_ASSERT(head->next->next->next == NULL); - UNIT_TEST_ASSERT(tail->previous == &elements[2]); - UNIT_TEST_ASSERT(tail->previous->previous == &elements[3]); - UNIT_TEST_ASSERT(tail->previous->previous->previous == NULL); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Add after head. - * NULL <-- 3 --> 4 --> 2 --> 1 --> NULL - */ - dbl_list_add_after(dll, dbl_list_head(dll), &elements[4]); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 4); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == &elements[4]); - UNIT_TEST_ASSERT(head->next->next == &elements[2]); - UNIT_TEST_ASSERT(head->next->next->next == tail); - UNIT_TEST_ASSERT(head->next->next->next->next == NULL); - UNIT_TEST_ASSERT(tail->previous == &elements[2]); - UNIT_TEST_ASSERT(tail->previous->previous == &elements[4]); - UNIT_TEST_ASSERT(tail->previous->previous->previous == &elements[3]); - UNIT_TEST_ASSERT(tail->previous->previous->previous->previous == NULL); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Add at 3rd position by adding after 2nd - * NULL <-- 3 --> 4 --> 5 --> 2 --> 1 --> NULL - */ - dbl_list_add_after(dll, &elements[4], &elements[5]); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 5); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == &elements[4]); - UNIT_TEST_ASSERT(head->next->next == &elements[5]); - UNIT_TEST_ASSERT(tail->previous->previous == &elements[5]); - UNIT_TEST_ASSERT(tail->previous == &elements[2]); - UNIT_TEST_ASSERT(elements[5].next == &elements[2]); - UNIT_TEST_ASSERT(elements[5].previous == &elements[4]); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Add at 3rd position by adding before 3rd - * NULL <-- 3 --> 4 --> 6 --> 5 --> 2 --> 1 --> NULL - */ - dbl_list_add_before(dll, &elements[5], &elements[6]); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 6); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == &elements[4]); - UNIT_TEST_ASSERT(head->next->next == &elements[6]); - UNIT_TEST_ASSERT(tail->previous->previous == &elements[5]); - UNIT_TEST_ASSERT(elements[6].next == &elements[5]); - UNIT_TEST_ASSERT(elements[6].previous == &elements[4]); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Add before tail - * NULL <-- 3 --> 4 --> 6 --> 5 --> 2 --> 7 --> 1 --> NULL - */ - dbl_list_add_before(dll, dbl_list_tail(dll), &elements[7]); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 7); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(tail->previous == &elements[7]); - UNIT_TEST_ASSERT(elements[7].next == &elements[1]); - UNIT_TEST_ASSERT(elements[7].previous == &elements[2]); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Add after tail - * NULL <-- 3 --> 4 --> 6 --> 5 --> 2 --> 7 --> 1 --> 8 --> NULL - */ - dbl_list_add_after(dll, dbl_list_tail(dll), &elements[8]); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 8); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[8]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(tail->previous == &elements[1]); - UNIT_TEST_ASSERT(elements[8].next == NULL); - UNIT_TEST_ASSERT(elements[8].previous == &elements[1]); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Find and remove element 5 - * NULL <-- 3 --> 4 --> 6 --> 2 --> 7 --> 1 --> 8 --> NULL - */ - dbl_list_remove(dll, &elements[5]); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 7); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[8]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(elements[6].next == &elements[2]); - UNIT_TEST_ASSERT(elements[2].previous == &elements[6]); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Remove before tail - * NULL <-- 3 --> 4 --> 6 --> 2 --> 7 --> 8 --> NULL - */ - dbl_list_remove(dll, ((demo_struct_t *)dbl_list_tail(dll))->previous); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 6); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[8]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(elements[7].next == tail); - UNIT_TEST_ASSERT(tail->previous == &elements[7]); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Remove after head - * NULL <-- 3 --> 6 --> 2 --> 7 --> 8 --> NULL - */ - dbl_list_remove(dll, ((demo_struct_t *)dbl_list_head(dll))->next); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 5); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[8]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == &elements[6]); - UNIT_TEST_ASSERT(elements[6].previous == head); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Find element 2 and remove whatever is after it - * NULL <-- 3 --> 6 --> 2 --> 8 --> NULL - */ - dbl_list_remove(dll, elements[2].next); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 4); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[8]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(elements[2].next == tail); - UNIT_TEST_ASSERT(tail->previous == &elements[2]); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Find element 2 and remove whatever is before it - * NULL <-- 3 --> 2 --> 8 --> NULL - */ - dbl_list_remove(dll, elements[2].previous); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 3); - UNIT_TEST_ASSERT(head == &elements[3]); - UNIT_TEST_ASSERT(tail == &elements[8]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == &elements[2]); - UNIT_TEST_ASSERT(elements[2].previous == head); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Remove head - * NULL <-- 2 --> 8 --> NULL - */ - dbl_list_remove(dll, dbl_list_head(dll)); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 2); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[8]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == tail); - UNIT_TEST_ASSERT(tail->previous == head); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* - * Remove tail - * NULL <-- 8 --> NULL - */ - dbl_list_remove(dll, dbl_list_head(dll)); - head = dbl_list_head(dll); - tail = dbl_list_tail(dll); - - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == false); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 1); - UNIT_TEST_ASSERT(head == &elements[8]); - UNIT_TEST_ASSERT(tail == &elements[8]); - UNIT_TEST_ASSERT(head->previous == NULL); - UNIT_TEST_ASSERT(head->next == NULL); - UNIT_TEST_ASSERT(tail->previous == NULL); - UNIT_TEST_ASSERT(tail->next == NULL); - - /* Remove the last element */ - dbl_list_remove(dll, dbl_list_head(dll)); - UNIT_TEST_ASSERT(dbl_list_is_empty(dll) == true); - UNIT_TEST_ASSERT(dbl_list_length(dll) == 0); - UNIT_TEST_ASSERT(dbl_list_head(dll) == NULL); - UNIT_TEST_ASSERT(dbl_list_tail(dll) == NULL); - - UNIT_TEST_END(); -} -/*---------------------------------------------------------------------------*/ -UNIT_TEST_REGISTER(test_cdll, "Circular, doubly-linked list"); -UNIT_TEST(test_cdll) -{ - demo_struct_t *head, *tail; - - CIRCULAR_LIST(cdll); - - UNIT_TEST_BEGIN(); - - memset(elements, 0, sizeof(elements)); - - /* Starts from empty */ - dbl_circ_list_init(cdll); - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == true); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 0); - UNIT_TEST_ASSERT(dbl_circ_list_head(cdll) == NULL); - UNIT_TEST_ASSERT(dbl_circ_list_tail(cdll) == NULL); - - /* - * Add an item by adding to the head. - * Head and tail should be the same element and should point to itself in - * both directions - */ - dbl_circ_list_add_head(cdll, &elements[0]); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 1); - UNIT_TEST_ASSERT(head == &elements[0]); - UNIT_TEST_ASSERT(tail == &elements[0]); - UNIT_TEST_ASSERT(head->previous == head); - UNIT_TEST_ASSERT(head->next == head); - UNIT_TEST_ASSERT(tail->previous == tail); - UNIT_TEST_ASSERT(tail->next == tail); - - /* - * Add an item by adding to the tail. - * (tail) <--> 0 <--> 1 <--> (head) - * Head should point to tail in both directions - */ - dbl_circ_list_add_tail(cdll, &elements[1]); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 2); - UNIT_TEST_ASSERT(head == &elements[0]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->next == tail); - UNIT_TEST_ASSERT(tail->previous == head); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - - /* - * Add before head. - * (tail) <--> 2 <--> 0 <--> 1 <--> (head) - */ - dbl_circ_list_add_before(cdll, dbl_circ_list_head(cdll), &elements[2]); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 3); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[2].previous == tail); - UNIT_TEST_ASSERT(elements[2].next == &elements[0]); - UNIT_TEST_ASSERT(elements[0].previous == head); - - /* - * Add after head. - * (tail) <--> 2 <--> 3 <--> 0 <--> 1 <--> (head) - */ - dbl_circ_list_add_after(cdll, dbl_circ_list_head(cdll), &elements[3]); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 4); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[3].previous == head); - UNIT_TEST_ASSERT(elements[3].next == &elements[0]); - UNIT_TEST_ASSERT(elements[0].previous == &elements[3]); - - /* - * Add at 3rd position by adding after 2nd - * (tail) <--> 2 <--> 3 <--> 4 <--> 0 <--> 1 <--> (head) - */ - dbl_circ_list_add_after(cdll, &elements[3], &elements[4]); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 5); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[3].next == &elements[4]); - UNIT_TEST_ASSERT(elements[4].previous == &elements[3]); - UNIT_TEST_ASSERT(elements[4].next == &elements[0]); - UNIT_TEST_ASSERT(elements[0].previous == &elements[4]); - - /* - * Add at 3rd position by adding before 3rd - * (tail) <--> 2 <--> 3 <--> 5 <--> 4 <--> 0 <--> 1 <--> (head) - */ - dbl_circ_list_add_before(cdll, &elements[4], &elements[5]); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 6); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[3].next == &elements[5]); - UNIT_TEST_ASSERT(elements[5].previous == &elements[3]); - UNIT_TEST_ASSERT(elements[5].next == &elements[4]); - UNIT_TEST_ASSERT(elements[4].previous == &elements[5]); - - /* - * Add before tail - * (tail) <--> 2 <--> 3 <--> 5 <--> 4 <--> 0 <--> 6 <--> 1 <--> (head) - */ - dbl_circ_list_add_before(cdll, dbl_circ_list_tail(cdll), &elements[6]); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 7); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[1]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[0].next == &elements[6]); - UNIT_TEST_ASSERT(elements[6].previous == &elements[0]); - UNIT_TEST_ASSERT(elements[6].next == &elements[1]); - UNIT_TEST_ASSERT(elements[1].previous == &elements[6]); - - /* - * Add after tail - * (tail) <--> 2 <--> 3 <--> 5 <--> 4 <--> 0 <--> 6 <--> 1 <--> 7 <--> (head) - */ - dbl_circ_list_add_after(cdll, dbl_circ_list_tail(cdll), &elements[7]); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 8); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[7]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[1].next == &elements[7]); - UNIT_TEST_ASSERT(elements[7].previous == &elements[1]); - UNIT_TEST_ASSERT(elements[7].next == &elements[2]); - UNIT_TEST_ASSERT(elements[2].previous == &elements[7]); - - /* - * Find and remove element 5 - * (tail) <--> 2 <--> 3 <--> 4 <--> 0 <--> 6 <--> 1 <--> 7 <--> (head) - */ - dbl_circ_list_remove(cdll, &elements[5]); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 7); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[7]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[3].next == &elements[4]); - UNIT_TEST_ASSERT(elements[4].previous == &elements[3]); - - /* - * Find element 4 and remove what's after it - * (tail) <--> 2 <--> 3 <--> 4 <--> 6 <--> 1 <--> 7 <--> (head) - */ - dbl_circ_list_remove(cdll, elements[4].next); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 6); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[7]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[4].next == &elements[6]); - UNIT_TEST_ASSERT(elements[6].previous == &elements[4]); - - /* - * Find element 4 and remove what's before it - * (tail) <--> 2 <--> 4 <--> 6 <--> 1 <--> 7 <--> (head) - */ - dbl_circ_list_remove(cdll, elements[4].previous); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 5); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[7]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[2].next == &elements[4]); - UNIT_TEST_ASSERT(elements[4].previous == &elements[2]); - - /* - * Remove before tail - * (tail) <--> 2 <--> 4 <--> 6 <--> 7 <--> (head) - */ - dbl_circ_list_remove(cdll, - ((demo_struct_t *)dbl_circ_list_tail(cdll))->previous); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 4); - UNIT_TEST_ASSERT(head == &elements[2]); - UNIT_TEST_ASSERT(tail == &elements[7]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[6].next == &elements[7]); - UNIT_TEST_ASSERT(elements[7].previous == &elements[6]); - - /* - * Remove after tail - * (tail) <--> 4 <--> 6 <--> 7 <--> (head) - */ - dbl_circ_list_remove(cdll, - ((demo_struct_t *)dbl_circ_list_tail(cdll))->next); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 3); - UNIT_TEST_ASSERT(head == &elements[4]); - UNIT_TEST_ASSERT(tail == &elements[7]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(tail->next == head); - UNIT_TEST_ASSERT(elements[7].next == &elements[4]); - UNIT_TEST_ASSERT(elements[4].previous == &elements[7]); - - /* - * Remove after head - * (tail) <--> 4 <--> 7 <--> (head) - */ - dbl_circ_list_remove(cdll, - ((demo_struct_t *)dbl_circ_list_head(cdll))->next); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 2); - UNIT_TEST_ASSERT(head == &elements[4]); - UNIT_TEST_ASSERT(tail == &elements[7]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(head->next == tail); - UNIT_TEST_ASSERT(tail->previous == head); - UNIT_TEST_ASSERT(tail->next == head); - - /* - * Remove before head - * (tail) <--> 4 <--> (head) - */ - dbl_circ_list_remove(cdll, - ((demo_struct_t *)dbl_circ_list_head(cdll))->previous); - head = dbl_circ_list_head(cdll); - tail = dbl_circ_list_tail(cdll); - - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == false); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 1); - UNIT_TEST_ASSERT(head == &elements[4]); - UNIT_TEST_ASSERT(tail == &elements[4]); - UNIT_TEST_ASSERT(head->previous == tail); - UNIT_TEST_ASSERT(head->next == tail); - - /* Remove head */ - dbl_circ_list_remove(cdll, dbl_circ_list_head(cdll)); - dbl_circ_list_remove(cdll, dbl_circ_list_head(cdll)); - UNIT_TEST_ASSERT(dbl_circ_list_is_empty(cdll) == true); - UNIT_TEST_ASSERT(dbl_circ_list_length(cdll) == 0); - UNIT_TEST_ASSERT(dbl_circ_list_head(cdll) == NULL); - UNIT_TEST_ASSERT(dbl_circ_list_tail(cdll) == NULL); - - UNIT_TEST_END(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(data_structure_test_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("Run unit-test\n"); - printf("---\n"); - - memset(elements, 0, sizeof(elements)); - - UNIT_TEST_RUN(test_list); - UNIT_TEST_RUN(test_stack); - UNIT_TEST_RUN(test_queue); - UNIT_TEST_RUN(test_csll); - UNIT_TEST_RUN(test_dll); - UNIT_TEST_RUN(test_cdll); - - printf("=check-me= DONE\n"); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/07-simulation-base/code-ipv6/receiver/Makefile b/tests/07-simulation-base/code-ipv6/receiver/Makefile deleted file mode 100644 index 052d00889..000000000 --- a/tests/07-simulation-base/code-ipv6/receiver/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -CONTIKI=../../../.. - -include $(CONTIKI)/Makefile.include diff --git a/tests/07-simulation-base/code-ipv6/receiver/project-conf.h b/tests/07-simulation-base/code-ipv6/receiver/project-conf.h deleted file mode 100644 index 3ac43a91c..000000000 --- a/tests/07-simulation-base/code-ipv6/receiver/project-conf.h +++ /dev/null @@ -1,5 +0,0 @@ -#define UIP_CONF_ND6_SEND_NS 1 - -#ifdef BUFSIZE -#define UIP_CONF_BUFFER_SIZE BUFSIZE -#endif /* BUFSIZE */ diff --git a/tests/07-simulation-base/code-ipv6/receiver/udp-receiver.c b/tests/07-simulation-base/code-ipv6/receiver/udp-receiver.c deleted file mode 100644 index 0a3b16b15..000000000 --- a/tests/07-simulation-base/code-ipv6/receiver/udp-receiver.c +++ /dev/null @@ -1,69 +0,0 @@ -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" - -#include - -#define UDP_PORT 61618 - -#define SEND_INTERVAL (4 * CLOCK_SECOND) - -static struct simple_udp_connection broadcast_connection; - -/*---------------------------------------------------------------------------*/ -PROCESS(udp_process, "UDP broadcast process"); -AUTOSTART_PROCESSES(&udp_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - static int msg; - - msg++; - printf("Data %d received length %d\n", - msg, datalen); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(udp_process, ev, data) -{ - static struct etimer periodic_timer; - static struct etimer send_timer; - uip_ipaddr_t addr; - static int alive; - const uip_ipaddr_t *default_prefix; - - PROCESS_BEGIN(); - - default_prefix = uip_ds6_default_prefix(); - uip_ip6addr_copy(&addr, default_prefix); - addr.u16[7] = UIP_HTONS(2); - uip_ds6_addr_add(&addr, 0, ADDR_AUTOCONF); - - simple_udp_register(&broadcast_connection, UDP_PORT, - NULL, UDP_PORT, - receiver); - - etimer_set(&periodic_timer, 20 * CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_set(&periodic_timer, SEND_INTERVAL); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_reset(&periodic_timer); - alive++; - printf("Alive %d\n", alive); - - /*printf("Sending broadcast\n"); - uip_create_linklocal_allnodes_mcast(&addr); - simple_udp_sendto(&broadcast_connection, "Test", 4, &addr);*/ - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/07-simulation-base/code-ipv6/sender/Makefile b/tests/07-simulation-base/code-ipv6/sender/Makefile deleted file mode 100644 index 052d00889..000000000 --- a/tests/07-simulation-base/code-ipv6/sender/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -CONTIKI=../../../.. - -include $(CONTIKI)/Makefile.include diff --git a/tests/07-simulation-base/code-ipv6/sender/project-conf.h b/tests/07-simulation-base/code-ipv6/sender/project-conf.h deleted file mode 100644 index 3ac43a91c..000000000 --- a/tests/07-simulation-base/code-ipv6/sender/project-conf.h +++ /dev/null @@ -1,5 +0,0 @@ -#define UIP_CONF_ND6_SEND_NS 1 - -#ifdef BUFSIZE -#define UIP_CONF_BUFFER_SIZE BUFSIZE -#endif /* BUFSIZE */ diff --git a/tests/07-simulation-base/code-ipv6/sender/udp-sender.c b/tests/07-simulation-base/code-ipv6/sender/udp-sender.c deleted file mode 100644 index b2d4dde6a..000000000 --- a/tests/07-simulation-base/code-ipv6/sender/udp-sender.c +++ /dev/null @@ -1,61 +0,0 @@ -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" - -#include - -#define UDP_PORT 61618 - -#define SEND_INTERVAL (4 * CLOCK_SECOND) - -static struct simple_udp_connection broadcast_connection; - -#ifndef SIZE -#define SIZE 100 -#endif - -/*---------------------------------------------------------------------------*/ -PROCESS(udp_process, "UDP broadcast process"); -AUTOSTART_PROCESSES(&udp_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Data received on port %d from port %d with length %d\n", - receiver_port, sender_port, datalen); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(udp_process, ev, data) -{ - static struct etimer periodic_timer; - static struct etimer send_timer; - uip_ipaddr_t addr; - - PROCESS_BEGIN(); - - simple_udp_register(&broadcast_connection, UDP_PORT, - NULL, UDP_PORT, - receiver); - - etimer_set(&periodic_timer, 20 * CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_set(&periodic_timer, SEND_INTERVAL); - while(1) { - uint8_t buf[SIZE]; - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_reset(&periodic_timer); - - printf("Sending broadcast\n"); - uip_create_linklocal_allnodes_mcast(&addr); - simple_udp_sendto(&broadcast_connection, buf, sizeof(buf), &addr); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/07-simulation-base/code-ipv6/sender/unicast-sender.c b/tests/07-simulation-base/code-ipv6/sender/unicast-sender.c deleted file mode 100644 index e56daa342..000000000 --- a/tests/07-simulation-base/code-ipv6/sender/unicast-sender.c +++ /dev/null @@ -1,68 +0,0 @@ -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" -#include "net/routing/routing.h" - -#include - -#define UDP_PORT 61618 - -#define SEND_INTERVAL (4 * CLOCK_SECOND) - -static struct simple_udp_connection broadcast_connection; - -#ifndef SIZE -#define SIZE 100 -#endif - -/*---------------------------------------------------------------------------*/ -PROCESS(udp_process, "UDP broadcast process"); -AUTOSTART_PROCESSES(&udp_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Data received on port %d from port %d with length %d\n", - receiver_port, sender_port, datalen); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(udp_process, ev, data) -{ - static struct etimer periodic_timer; - static struct etimer send_timer; - uip_ipaddr_t addr; - - PROCESS_BEGIN(); - - NETSTACK_ROUTING.root_start(); - - simple_udp_register(&broadcast_connection, UDP_PORT, - NULL, UDP_PORT, - receiver); - - etimer_set(&periodic_timer, 20 * CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_set(&periodic_timer, SEND_INTERVAL); - - while(1) { - const uip_ipaddr_t *default_prefix; - uint8_t buf[SIZE]; - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_reset(&periodic_timer); - - printf("Sending unicast\n"); - default_prefix = uip_ds6_default_prefix(); - uip_ip6addr_copy(&addr, default_prefix); - addr.u16[7] = UIP_HTONS(2); - simple_udp_sendto(&broadcast_connection, buf, sizeof(buf), &addr); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/07-simulation-base/code-ringbufindex/Makefile b/tests/07-simulation-base/code-ringbufindex/Makefile deleted file mode 100644 index 1f86b08aa..000000000 --- a/tests/07-simulation-base/code-ringbufindex/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -all: test-ringbufindex - -MODULES += os/services/unit-test - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/tests/07-simulation-base/code-ringbufindex/project-conf.h b/tests/07-simulation-base/code-ringbufindex/project-conf.h deleted file mode 100644 index e745536d9..000000000 --- a/tests/07-simulation-base/code-ringbufindex/project-conf.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UNIT_TEST_PRINT_FUNCTION test_print_report - -#endif /* !PROJECT_CONF_H_ */ diff --git a/tests/07-simulation-base/code-ringbufindex/test-ringbufindex.c b/tests/07-simulation-base/code-ringbufindex/test-ringbufindex.c deleted file mode 100644 index f365cbfa9..000000000 --- a/tests/07-simulation-base/code-ringbufindex/test-ringbufindex.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 - -#include "contiki.h" -#include "unit-test/unit-test.h" - -#include "lib/ringbufindex.h" - -PROCESS(test_process, "ringbuf-index.c test"); -AUTOSTART_PROCESSES(&test_process); - -static struct ringbufindex ri; -static const uint8_t ri_size = 2; - -void -test_print_report(const unit_test_t *utp) -{ - printf("=check-me= "); - if(utp->result == unit_test_failure) { - printf("FAILED - %s: exit at L%u\n", utp->descr, utp->exit_line); - } else { - printf("SUCCEEDED - %s\n", utp->descr); - } -} - -UNIT_TEST_REGISTER(test_ringbufindex_init, "Init"); -UNIT_TEST(test_ringbufindex_init) -{ - UNIT_TEST_BEGIN(); - - ringbufindex_init(&ri, ri_size); - - UNIT_TEST_ASSERT(ri.mask == ri_size - 1 && - ri.put_ptr == 0 && - ri.get_ptr == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_ringbufindex_put, "Put"); -UNIT_TEST(test_ringbufindex_put) -{ - int ret; - - UNIT_TEST_BEGIN(); - - ringbufindex_init(&ri, ri_size); - - /* Put the first item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* - * This one must fail because the ringbuf is full. The ringbuf can have one - * item (size - 1) at most. - */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 1 && ri.get_ptr == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_ringbufindex_peek_put, "PeekPut"); -UNIT_TEST(test_ringbufindex_peek_put) -{ - int ret; - - UNIT_TEST_BEGIN(); - - ringbufindex_init(&ri, ri_size); - - /* Get index for the first item */ - ret = ringbufindex_peek_put(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 0 && ri.get_ptr == 0); - - /* Put the first item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* Get index for the second item; should be -1 because it's full */ - ret = ringbufindex_peek_put(&ri); - UNIT_TEST_ASSERT(ret == -1 && ri.put_ptr == 1 && ri.get_ptr == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_ringbufindex_get, "Get"); -UNIT_TEST(test_ringbufindex_get) -{ - int ret; - - UNIT_TEST_BEGIN(); - - ringbufindex_init(&ri, ri_size); - - /* Get the first item; it's been not put yet. */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == -1 && ri.put_ptr == 0 && ri.get_ptr == 0); - - /* Put the first item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* Get the first item */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 1 && ri.get_ptr == 1); - - /* Put the second item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 1); - - /* Get the second item */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_ringbufindex_peek_get, "PeekGet"); -UNIT_TEST(test_ringbufindex_peek_get) -{ - int ret; - - UNIT_TEST_BEGIN(); - - ringbufindex_init(&ri, ri_size); - - /* Get the index of the first item; it's been not put yet. */ - ret = ringbufindex_peek_get(&ri); - UNIT_TEST_ASSERT(ret == -1 && ri.put_ptr == 0 && ri.get_ptr == 0); - - /* Put the first item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* Get the index of the first item */ - ret = ringbufindex_peek_get(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* Get and remove the first item */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 1 && ri.get_ptr == 1); - - /* Put the second item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 1); - - /* Get the index of the second item */ - ret = ringbufindex_peek_get(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 1); - - /* Get and remove the second item */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_ringbufindex_size, "Size"); -UNIT_TEST(test_ringbufindex_size) -{ - int ret; - - UNIT_TEST_BEGIN(); - - ringbufindex_init(&ri, ri_size); - - ret = ringbufindex_size(&ri); - UNIT_TEST_ASSERT(ret == ri_size); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_ringbufindex_elements, "Elements"); -UNIT_TEST(test_ringbufindex_elements) -{ - int ret; - - UNIT_TEST_BEGIN(); - - ringbufindex_init(&ri, ri_size); - - /* Nothing in ringbuf */ - ret = ringbufindex_elements(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 0 && ri.get_ptr == 0); - - /* Put the first item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* One item in ringbuf */ - ret = ringbufindex_elements(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* Get the first item */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 1 && ri.get_ptr == 1); - - /* Nothing in ringbuf */ - ret = ringbufindex_elements(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 1 && ri.get_ptr == 1); - - /* Put the second item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 1); - - /* One item in ringbuf */ - ret = ringbufindex_elements(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 1); - - /* Get the second item */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 0); - - /* Nothing in ringbuf */ - ret = ringbufindex_elements(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 0 && ri.get_ptr == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_ringbufindex_full, "Full"); -UNIT_TEST(test_ringbufindex_full) -{ - int ret; - - UNIT_TEST_BEGIN(); - - ringbufindex_init(&ri, ri_size); - - /* Nothing in ringbuf; not full */ - ret = ringbufindex_full(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 0 && ri.get_ptr == 0); - - /* Put the first item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* One item in ringbuf; full */ - ret = ringbufindex_full(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* Get the first item */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 1 && ri.get_ptr == 1); - - /* Nothing in ringbuf; not full */ - ret = ringbufindex_full(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 1 && ri.get_ptr == 1); - - /* Put the second item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 1); - - /* One item in ringbuf; full */ - ret = ringbufindex_full(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 1); - - /* Get the second item */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 0); - - /* Nothing in ringbuf; not full */ - ret = ringbufindex_full(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 0 && ri.get_ptr == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_ringbufindex_empty, "Empty"); -UNIT_TEST(test_ringbufindex_empty) -{ - int ret; - - UNIT_TEST_BEGIN(); - - ringbufindex_init(&ri, ri_size); - - /* Nothing in ringbuf; empty */ - ret = ringbufindex_empty(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 0); - - /* Put the first item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* One item in ringbuf; not empty */ - ret = ringbufindex_empty(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 1 && ri.get_ptr == 0); - - /* Get the first item */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 1 && ri.get_ptr == 1); - - /* Nothing in ringbuf; empty */ - ret = ringbufindex_empty(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 1 && ri.get_ptr == 1); - - /* Put the second item */ - ret = ringbufindex_put(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 1); - - /* One item in ringbuf; not empty */ - ret = ringbufindex_empty(&ri); - UNIT_TEST_ASSERT(ret == 0 && ri.put_ptr == 0 && ri.get_ptr == 1); - - /* Get the second item */ - ret = ringbufindex_get(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 0); - - /* Nothing in ringbuf; empty */ - ret = ringbufindex_empty(&ri); - UNIT_TEST_ASSERT(ret == 1 && ri.put_ptr == 0 && ri.get_ptr == 0); - - UNIT_TEST_END(); -} - -PROCESS_THREAD(test_process, ev, data) -{ - PROCESS_BEGIN(); - printf("Run unit-test\n"); - printf("---\n"); - - UNIT_TEST_RUN(test_ringbufindex_init); - UNIT_TEST_RUN(test_ringbufindex_put); - UNIT_TEST_RUN(test_ringbufindex_peek_put); - UNIT_TEST_RUN(test_ringbufindex_get); - UNIT_TEST_RUN(test_ringbufindex_peek_get); - UNIT_TEST_RUN(test_ringbufindex_size); - UNIT_TEST_RUN(test_ringbufindex_elements); - UNIT_TEST_RUN(test_ringbufindex_full); - UNIT_TEST_RUN(test_ringbufindex_empty); - - printf("=check-me= DONE\n"); - PROCESS_END(); -} diff --git a/tests/07-simulation-base/code-slip-radio/Makefile b/tests/07-simulation-base/code-slip-radio/Makefile deleted file mode 100644 index aa22fc8aa..000000000 --- a/tests/07-simulation-base/code-slip-radio/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -all: wait-dag -CONTIKI=../../.. - -include $(CONTIKI)/Makefile.include diff --git a/tests/07-simulation-base/code-slip-radio/project-conf.h b/tests/07-simulation-base/code-slip-radio/project-conf.h deleted file mode 100644 index e8af03208..000000000 --- a/tests/07-simulation-base/code-slip-radio/project-conf.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define RPL_CONF_DAO_ACK 1 - -#endif /* PROJECT_CONF_H_ */ diff --git a/tests/07-simulation-base/code-slip-radio/wait-dag.c b/tests/07-simulation-base/code-slip-radio/wait-dag.c deleted file mode 100644 index a059661b4..000000000 --- a/tests/07-simulation-base/code-slip-radio/wait-dag.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2013, CETIC, www.cetic.be. - * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" -#include "net/routing/routing.h" -#include "net/ipv6/uip.h" -#include - -#define DEBUG DEBUG_FULL -#include "net/ipv6/uip-debug.h" - -#define INTERVAL 5 * CLOCK_SECOND - -/*---------------------------------------------------------------------------*/ -PROCESS(wait_for_dag, "Wait for DAG process"); -AUTOSTART_PROCESSES(&wait_for_dag); -/*---------------------------------------------------------------------------*/ -static void -timeout_handler(void) -{ - if(NETSTACK_ROUTING.node_has_joined()) { - PRINTF("DAG Found\n"); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(wait_for_dag, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - PRINTF("Wait for DAG process started\n"); - etimer_set(&et, INTERVAL); - while(1) { - PROCESS_YIELD(); - if(etimer_expired(&et)) { - timeout_handler(); - etimer_restart(&et); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/07-simulation-base/hello-world.js b/tests/07-simulation-base/hello-world.js deleted file mode 100644 index 5afaabe18..000000000 --- a/tests/07-simulation-base/hello-world.js +++ /dev/null @@ -1,9 +0,0 @@ -TIMEOUT(5000); - -while(true) { - log.log("> " + msg + "\n"); - if (msg.equals('Hello, world')) { - log.testOK(); - } - YIELD(); -} diff --git a/tests/07-simulation-base/js/04-ringbufindex.js b/tests/07-simulation-base/js/04-ringbufindex.js deleted file mode 100644 index 5acb27f11..000000000 --- a/tests/07-simulation-base/js/04-ringbufindex.js +++ /dev/null @@ -1,25 +0,0 @@ -TIMEOUT(10000, log.testFailed()); - -var failed = false; - -while(true) { - YIELD(); - - log.log(time + " " + "node-" + id + " "+ msg + "\n"); - - if(msg.contains("=check-me=") == false) { - continue; - } - - if(msg.contains("FAILED")) { - failed = true; - } - - if(msg.contains("DONE")) { - break; - } -} -if(failed) { - log.testFailed(); -} -log.testOK(); diff --git a/tests/07-simulation-base/js/22-stack-check.js b/tests/07-simulation-base/js/22-stack-check.js deleted file mode 100644 index 3dd0b381c..000000000 --- a/tests/07-simulation-base/js/22-stack-check.js +++ /dev/null @@ -1,25 +0,0 @@ -TIMEOUT(100000); - -/* This script checks that the stack usage is dynamically changing */ - -var re = /stack usage: (\d+)/i; - -var minusage = 10000; -var maxusage = 0; - -while(true) { - log.log("> " + msg + "\n"); - - var found = msg.match(re); - - if(found) { - var n = parseInt(found[1]); - minusage = minusage < n ? minusage : n; - maxusage = maxusage > n ? maxusage : n; - - if(minusage < 800 && maxusage >= 1000) { - log.testOK(); - } - } - YIELD(); -} diff --git a/tests/07-simulation-base/js/data-structures.js b/tests/07-simulation-base/js/data-structures.js deleted file mode 100644 index 5acb27f11..000000000 --- a/tests/07-simulation-base/js/data-structures.js +++ /dev/null @@ -1,25 +0,0 @@ -TIMEOUT(10000, log.testFailed()); - -var failed = false; - -while(true) { - YIELD(); - - log.log(time + " " + "node-" + id + " "+ msg + "\n"); - - if(msg.contains("=check-me=") == false) { - continue; - } - - if(msg.contains("FAILED")) { - failed = true; - } - - if(msg.contains("DONE")) { - break; - } -} -if(failed) { - log.testFailed(); -} -log.testOK(); diff --git a/tests/07-simulation-base/js/hello-world.js b/tests/07-simulation-base/js/hello-world.js deleted file mode 100644 index 5afaabe18..000000000 --- a/tests/07-simulation-base/js/hello-world.js +++ /dev/null @@ -1,9 +0,0 @@ -TIMEOUT(5000); - -while(true) { - log.log("> " + msg + "\n"); - if (msg.equals('Hello, world')) { - log.testOK(); - } - YIELD(); -} diff --git a/tests/08-native-runs/01-test-data-structures.sh b/tests/08-native-runs/01-test-data-structures.sh deleted file mode 100755 index 2343756fe..000000000 --- a/tests/08-native-runs/01-test-data-structures.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -source ../utils.sh - -# Contiki directory -CONTIKI=$1 - -# Example code directory -CODE_DIR=$CONTIKI/tests/07-simulation-base/code-data-structures/ -CODE=test-data-structures - -# Starting Contiki-NG native node -echo "Starting native node" -make -C $CODE_DIR TARGET=native > make.log 2> make.err -$CODE_DIR/$CODE.native > $CODE.log 2> $CODE.err & -CPID=$! -sleep 2 - -echo "Closing native node" -sleep 2 -kill_bg $CPID - -if grep -q "=check-me= FAILED" $CODE.log ; then - echo "==== make.log ====" ; cat make.log; - echo "==== make.err ====" ; cat make.err; - echo "==== $CODE.log ====" ; cat $CODE.log; - echo "==== $CODE.err ====" ; cat $CODE.err; - - printf "%-32s TEST FAIL\n" "$CODE" | tee $CODE.testlog; -else - cp $CODE.log $CODE.testlog - printf "%-32s TEST OK\n" "$CODE" | tee $CODE.testlog; -fi - -rm make.log -rm make.err -rm $CODE.log -rm $CODE.err - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end -exit 0 diff --git a/tests/08-native-runs/02-mqtt-client.sh b/tests/08-native-runs/02-mqtt-client.sh deleted file mode 100755 index cb1ee937a..000000000 --- a/tests/08-native-runs/02-mqtt-client.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -source ../utils.sh - -# Contiki directory -CONTIKI=$1 - -# Example code directory -CODE_DIR=$CONTIKI/examples/mqtt-client/ -CODE=mqtt-client - -CLIENT_LOG=$CODE.log -CLIENT_TESTLOG=$CODE.testlog -CLIENT_ERR=$CODE.err -MOSQ_SUB_LOG=mosquitto_sub.log -MOSQ_SUB_ERR=mosquitto_sub.err - -# Start mosquitto server -echo "Starting mosquitto daemon" -mosquitto &> /dev/null & -MOSQID=$! -sleep 2 - -# Start mosquitto_sub client. Subscribe -echo "Starting mosquitto subscriber" -mosquitto_sub -t iot-2/evt/status/fmt/json > $MOSQ_SUB_LOG 2> $MOSQ_SUB_ERR & -MSUBID=$! -sleep 2 - -# Starting Contiki-NG native node -echo "Starting native node" -make -C $CODE_DIR TARGET=native \ - DEFINES=MQTT_CLIENT_CONF_ORG_ID=\\\"travis-test\\\",MQTT_CLIENT_CONF_LOG_LEVEL=LOG_LEVEL_DBG \ - > make.log 2> make.err -sudo $CODE_DIR/$CODE.native > $CLIENT_LOG 2> $CLIENT_ERR & -CPID=$! - -# The mqtt-client will publish every 30 secs. Wait for 45 -sleep 45 - -# Send a publish to the mqtt client -mosquitto_pub -m "1" -t iot-2/cmd/leds/fmt/json - -echo "Closing native node" -sleep 2 -kill_bg $CPID - -echo "Stopping mosquitto daemon" -kill_bg $MOSQID - -echo "Stopping mosquitto subscriber" -kill_bg $MSUBID - -# Success criteria: -# * mosquitto_sub output not empty -# * mqtt-client.native output contains "MQTT SUB" -SUB_RCV=`grep "MQTT SUB" $CLIENT_LOG` -if [ -s "$MOSQ_SUB_LOG" -a -n "$SUB_RCV" ] -then - cp $CLIENT_LOG $CODE.testlog - printf "%-32s TEST OK\n" "$CODE" | tee $CODE.testlog; -else - echo "==== make.log ====" ; cat make.log; - echo "==== make.err ====" ; cat make.err; - echo "==== $CLIENT_LOG ====" ; cat $CLIENT_LOG; - echo "==== $CLIENT_ERR ====" ; cat $CLIENT_ERR; - echo "==== $MOSQ_SUB_LOG ====" ; cat $MOSQ_SUB_LOG; - echo "==== $MOSQ_SUB_ERR ====" ; cat $MOSQ_SUB_ERR; - - printf "%-32s TEST FAIL\n" "$CODE" | tee $CODE.testlog; -fi - -rm make.log -rm make.err -rm $CLIENT_LOG $CLIENT_ERR -rm $MOSQ_SUB_LOG $MOSQ_SUB_ERR - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end -exit 0 diff --git a/tests/08-native-runs/Makefile b/tests/08-native-runs/Makefile deleted file mode 100644 index c46e5271d..000000000 --- a/tests/08-native-runs/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../Makefile.script-test diff --git a/tests/09-ipv6/01-ping-lla-csma-w-rpl.csc b/tests/09-ipv6/01-ping-lla-csma-w-rpl.csc deleted file mode 100644 index 0a6e3a376..000000000 --- a/tests/09-ipv6/01-ping-lla-csma-w-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_CSMA=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/02-ping-ula-csma-w-rpl.csc b/tests/09-ipv6/02-ping-ula-csma-w-rpl.csc deleted file mode 100644 index 802f068cc..000000000 --- a/tests/09-ipv6/02-ping-ula-csma-w-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_ULA=1 WITH_CSMA=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-ula.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/03-ping-lla-tsch-w-rpl.csc b/tests/09-ipv6/03-ping-lla-tsch-w-rpl.csc deleted file mode 100644 index 2642f363d..000000000 --- a/tests/09-ipv6/03-ping-lla-tsch-w-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_TSCH=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/04-ping-ula-tsch-w-rpl.csc b/tests/09-ipv6/04-ping-ula-tsch-w-rpl.csc deleted file mode 100644 index c18f8ac0b..000000000 --- a/tests/09-ipv6/04-ping-ula-tsch-w-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_ULA=1 WITH_TSCH=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-ula.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/05-ping-lla-csma-wo-rpl.csc b/tests/09-ipv6/05-ping-lla-csma-wo-rpl.csc deleted file mode 100644 index 9b3d1c50f..000000000 --- a/tests/09-ipv6/05-ping-lla-csma-wo-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_CSMA=1 WITHOUT_RPL=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/06-ping-ula-csma-wo-rpl.csc b/tests/09-ipv6/06-ping-ula-csma-wo-rpl.csc deleted file mode 100644 index 3640cbb1f..000000000 --- a/tests/09-ipv6/06-ping-ula-csma-wo-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_ULA=1 WITH_CSMA=1 WITHOUT_RPL=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-ula.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/07-ping-lla-tsch-wo-rpl.csc b/tests/09-ipv6/07-ping-lla-tsch-wo-rpl.csc deleted file mode 100644 index 2960bacaf..000000000 --- a/tests/09-ipv6/07-ping-lla-tsch-wo-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_TSCH=1 WITHOUT_RPL=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/08-ping-ula-tsch-wo-rpl.csc b/tests/09-ipv6/08-ping-ula-tsch-wo-rpl.csc deleted file mode 100644 index 73953b0b3..000000000 --- a/tests/09-ipv6/08-ping-ula-tsch-wo-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_ULA=1 WITH_TSCH=1 WITHOUT_RPL=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-ula.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/09-ping-lla-ula-csma-w-rpl.csc b/tests/09-ipv6/09-ping-lla-ula-csma-w-rpl.csc deleted file mode 100644 index 66e2a8c9a..000000000 --- a/tests/09-ipv6/09-ping-lla-ula-csma-w-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_ULA=1 WITH_CSMA=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla-ula.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/10-ping-lla-ula-tsch-w-rpl.csc b/tests/09-ipv6/10-ping-lla-ula-tsch-w-rpl.csc deleted file mode 100644 index e6957af28..000000000 --- a/tests/09-ipv6/10-ping-lla-ula-tsch-w-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_ULA=1 WITH_TSCH=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla-ula.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/11-ping-lla-ula-csma-wo-rpl.csc b/tests/09-ipv6/11-ping-lla-ula-csma-wo-rpl.csc deleted file mode 100644 index b95a1ff4b..000000000 --- a/tests/09-ipv6/11-ping-lla-ula-csma-wo-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_NBR_MULTI_IPV6_ADDRS=1 WITH_ULA=1 WITH_CSMA=1 WITHOUT_RPL=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla-ula.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/12-ping-lla-ula-tsch-wo-rpl.csc b/tests/09-ipv6/12-ping-lla-ula-tsch-wo-rpl.csc deleted file mode 100644 index 20f8a12ae..000000000 --- a/tests/09-ipv6/12-ping-lla-ula-tsch-wo-rpl.csc +++ /dev/null @@ -1,108 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype787 - Cooja Mote Type #1 - [CONTIKI_DIR]/tests/09-ipv6/code/node.c - make clean - make WITH_NBR_MULTI_IPV6_ADDRS=1 WITH_ULA=1 WITH_TSCH=1 WITHOUT_RPL=1 node.cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 14.03051207883138 - 82.02801380504546 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.interfaces.Position - 28.22612889898729 - 43.60027658221718 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype787 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla-ula.js - true - - 495 - 0 - 525 - 190 - 18 - - diff --git a/tests/09-ipv6/Makefile b/tests/09-ipv6/Makefile deleted file mode 100644 index 272bc7da1..000000000 --- a/tests/09-ipv6/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../Makefile.simulation-test diff --git a/tests/09-ipv6/code/Makefile b/tests/09-ipv6/code/Makefile deleted file mode 100644 index d8f4cab55..000000000 --- a/tests/09-ipv6/code/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -CONTIKI_PRJECT = node -all: $(CONTIKI_PROJECT) - -MODULES += os/services/shell -CFLAGS += -DLOG_CONF_LEVEL_RPL=LOG_LEVEL_INFO -CFLAGS += -DLOG_CONF_LEVEL_TCPIP=LOG_LEVEL_INFO -CFLAGS += -DLOG_CONF_LEVEL_IPV6=LOG_LEVEL_DBG -CFLAGS += -DLOG_CONF_LEVEL_MAC=LOG_LEVEL_INFO - -ifeq ($(WITH_ULA),1) - CFLAGS += -DWITH_ULA=1 -endif - -ifeq ($(WITHOUT_RPL),1) - MAKE_ROUTING = MAKE_ROUTING_NULLROUTING -else - CFLAGS += -DRPL_CONF_DAO_DELAY=1 -endif - -ifeq ($WITH_CSMA),1) - MAKE_MAC = MAKE_MAC_CSMA -endif - -ifeq ($(WITH_TSCH),1) - MAKE_MAC = MAKE_MAC_TSCH - CFLAGS += -DWITH_TSCH=1 - CFLAGS += -DTSCH_CONF_AUTOSTART=1 - CFLAGS += -DTSCH_CONF_DEFAULT_HOPPING_SEQUENCE=TSCH_HOPPING_SEQUENCE_1_1 -endif - -ifeq ($(WITH_NBR_MULTI_IPV6_ADDRS),1) - CFLAGS += -DUIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS=1 -endif - -PLATFORM_ONLY = cooja -TARGET = cooja - -CONTIKI = ../../../ -include $(CONTIKI)/Makefile.include diff --git a/tests/09-ipv6/code/node.c b/tests/09-ipv6/code/node.c deleted file mode 100644 index a99261865..000000000 --- a/tests/09-ipv6/code/node.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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 -#include -#include -#include -#include - -#include - -PROCESS(node_process, "Node"); -AUTOSTART_PROCESSES(&node_process); - -PROCESS_THREAD(node_process, ev, data) -{ - static struct etimer et; -#if WITH_ULA - static uip_ipaddr_t ipaddr; - const uip_ipaddr_t *default_prefix; -#endif /* WITH_ULA */ - -#if WITH_TSCH - static linkaddr_t coordinator_addr = {{0x00, 0x01, 0x00, 0x01, - 0x00, 0x01, 0x00, 0x01}}; -#endif /* WITH_TSCH */ - - PROCESS_BEGIN(); - -#if WITH_TSCH - if(linkaddr_cmp(&coordinator_addr, &linkaddr_node_addr)) { - tsch_set_coordinator(1); - } -#endif /* WITH_TSCH */ - -#if WITH_ULA - default_prefix = uip_ds6_default_prefix(); - uip_ip6addr_copy(&ipaddr, default_prefix); - uip_ds6_prefix_add(&ipaddr, UIP_DEFAULT_PREFIX_LEN, 0, 0, 0, 0); - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); -#endif /* WITH_ULA */ - - serial_shell_init(); - - etimer_set(&et, CLOCK_SECOND); - while(1) { - /* - * keep doing something so that simulation runs until its timeout - */ - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - printf(".\n"); - etimer_reset(&et); - } - - PROCESS_END(); -} diff --git a/tests/09-ipv6/js/ping-test-lla-ula.js b/tests/09-ipv6/js/ping-test-lla-ula.js deleted file mode 100644 index c15dcbf15..000000000 --- a/tests/09-ipv6/js/ping-test-lla-ula.js +++ /dev/null @@ -1,72 +0,0 @@ -TIMEOUT(20000, log.testFailed()); - -dst_lla = "fe80::202:2:2:2"; -dst_ula = "fd00::202:2:2:2"; -dst_mac = "0002.0002.0002.0002"; -step = 0; -rpl_is_enabled = false; - -while(1) { - YIELD(); - log.log(time + " " + id + " "+ msg + "\n"); - - if(msg.contains("Node ID: ")) { - if(id == 1) { - write(sim.getMoteWithID(1), "rpl-set-root 1"); - } - step += 1; - } - - if(msg.contains("Setting as DAG root")) { - rpl_is_enabled = true; - } - - if(step == 2 && time > 15000000) { - write(sim.getMoteWithID(1), "ping " + dst_lla); - step += 1; - } - - if(step == 4 && time > 15000000) { - write(sim.getMoteWithID(1), "ping " + dst_ula); - step += 1; - } - - if(msg.contains("Received ping reply")) { - if(step == 3) { - step += 1; - } else { - step += 1; - write(sim.getMoteWithID(1), "ip-nbr"); - } - } - - if(step == 6 && rpl_is_enabled) { - /* when RPL is enabled, we skip examining ip-nbr results */ - log.testOK(); - } - - if(msg.contains("<->")) { - re = /-- | <-> |, router|, state /; - nc = msg.split(re); - ip_addr = nc[1]; - ll_addr = nc[2]; - is_router = nc[3]; - state = nc[4].trim(); - if(ll_addr == dst_mac && - state == "Reachable") { - if(step == 6 && ip_addr == dst_lla) { - step += 1; - } else if(step == 7 && ip_addr == dst_ula) { - log.testOK(); - } else { - /* unexpected case */ - log.testFailed(); - } - } else { - log.log(ip_addr + "\n"); - log.log(ll_addr + "\n"); - log.log(state + "\n"); - log.testFailed(); - } - } -} diff --git a/tests/09-ipv6/js/ping-test-lla.js b/tests/09-ipv6/js/ping-test-lla.js deleted file mode 100644 index d9beedf8b..000000000 --- a/tests/09-ipv6/js/ping-test-lla.js +++ /dev/null @@ -1,45 +0,0 @@ -TIMEOUT(20000, log.testFailed()); - -dst_lla = "fe80::202:2:2:2"; -dst_mac = "0002.0002.0002.0002"; -step = 0; - -while(1) { - YIELD(); - log.log(time + " " + id + " "+ msg + "\n"); - - if(msg.contains("Node ID: ")) { - if(id == 1) { - write(sim.getMoteWithID(1), "rpl-set-root 1"); - } - step += 1; - } - - if(step == 2 && time > 15000000) { - write(sim.getMoteWithID(1), "ping " + dst_lla); - step += 1; - } - - if(msg.contains("Received ping reply")) { - write(sim.getMoteWithID(1), "ip-nbr"); - } - - if(msg.contains("<->")) { - re = /-- | <-> |, router|, state /; - nc = msg.split(re); - ip_addr = nc[1]; - ll_addr = nc[2]; - is_router = nc[3]; - state = nc[4].trim(); - if(ip_addr == dst_lla && - ll_addr == dst_mac && - state == "Reachable") { - log.testOK(); - } else { - log.log(ip_addr + "\n"); - log.log(ll_addr + "\n"); - log.log(state + "\n"); - log.testFailed(); - } - } -} diff --git a/tests/09-ipv6/js/ping-test-ula.js b/tests/09-ipv6/js/ping-test-ula.js deleted file mode 100644 index adbd22ccf..000000000 --- a/tests/09-ipv6/js/ping-test-ula.js +++ /dev/null @@ -1,47 +0,0 @@ -;TIMEOUT(20000, log.testFailed()); - -dst_lla = "fe80::202:2:2:2"; -dst_ula = "fd00::202:2:2:2"; -dst_mac = "0002.0002.0002.0002"; -step = 0; - -while(1) { - YIELD(); - log.log(time + " " + id + " "+ msg + "\n"); - - if(msg.contains("Node ID: ")) { - if(id == 1) { - write(sim.getMoteWithID(1), "rpl-set-root 1"); - } - step += 1; - } - - if(step == 2 && time > 15000000) { - write(sim.getMoteWithID(1), "ping " + dst_ula); - step += 1; - } - - if(msg.contains("Received ping reply")) { - write(sim.getMoteWithID(1), "ip-nbr"); - } - - if(msg.contains("<->")) { - re = /-- | <-> |, router|, state /; - nc = msg.split(re); - ip_addr = nc[1]; - ll_addr = nc[2]; - is_router = nc[3]; - state = nc[4].trim(); - /* in RPL case, nbr doesn't have ula. */ - if((ip_addr == dst_lla || ip_addr == dst_ula) && - ll_addr == dst_mac && - state == "Reachable") { - log.testOK(); - } else { - log.log(ip_addr + "\n"); - log.log(ll_addr + "\n"); - log.log(state + "\n"); - log.testFailed(); - } - } -} diff --git a/tests/10-ipv6-nbr/01-test-nbr-multi-addrs.sh b/tests/10-ipv6-nbr/01-test-nbr-multi-addrs.sh deleted file mode 100755 index 8f73ee237..000000000 --- a/tests/10-ipv6-nbr/01-test-nbr-multi-addrs.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -TEST_NAME=01-test-nbr-multi-addrs - -if [ $# -eq 1 ]; then - # a (relative) path to CONTIKI_DIR is supposed to be given as $1 - TEST_DIR=$1/tests/10-ipv6-nbr -else - TEST_DIR=.//tests/10-ipv6-nbr -fi -SRC_DIR=${TEST_DIR}/nbr-multi-addrs -EXEC_FILE_NAME=test.native - -make -C ${SRC_DIR} clean - -echo "build the test program"... -make -C ${SRC_DIR} > ${TEST_NAME}.log - -echo "run the test..." -${TEST_DIR}/${SRC_DIR}/${EXEC_FILE_NAME} | tee ${TEST_NAME}.log | \ - grep -vE '^\[' >> ${TEST_NAME}.testlog diff --git a/tests/10-ipv6-nbr/Makefile b/tests/10-ipv6-nbr/Makefile deleted file mode 100644 index c46e5271d..000000000 --- a/tests/10-ipv6-nbr/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../Makefile.script-test diff --git a/tests/10-ipv6-nbr/nbr-multi-addrs/Makefile b/tests/10-ipv6-nbr/nbr-multi-addrs/Makefile deleted file mode 100644 index 711bf0987..000000000 --- a/tests/10-ipv6-nbr/nbr-multi-addrs/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CONTIKI_PROJECT = test -all: $(CONTIKI_PROJECT) - -CFLAGS += -DUNIT_TEST_PRINT_FUNCTION=my_test_print -CFLAGS += -DLOG_CONF_LEVEL_IPV6=LOG_LEVEL_DBG -CFLAGS += -DNBR_TABLE_FIND_REMOVABLE=my_always_return_null -CFLAGS += -DUIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS=1 - -PLATFORM_ONLY = native -TARGET = native -MODULES += os/sys/log os/services/unit-test - -CONTIKI = ../../../ -include $(CONTIKI)/Makefile.include diff --git a/tests/10-ipv6-nbr/nbr-multi-addrs/test.c b/tests/10-ipv6-nbr/nbr-multi-addrs/test.c deleted file mode 100644 index 2cefd7cca..000000000 --- a/tests/10-ipv6-nbr/nbr-multi-addrs/test.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2018, Yasuyuki Tanaka - * 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 -#include -#include -#include -#include -#include - -#include - -#define LOG_MODULE "test" -#define LOG_LEVEL LOG_LEVEL_DBG - -/* report function defined in unit-test.c */ -void unit_test_print_report(const unit_test_t *utp); - -static const uint8_t is_router = 1; -static const uint8_t state = NBR_INCOMPLETE; -static const nbr_table_reason_t reason = NBR_TABLE_REASON_UNDEFINED; - -static void remove_all_entries_in_neighbor_cache(void); - -PROCESS(node_process, "Node"); -AUTOSTART_PROCESSES(&node_process); - -void -my_test_print(const unit_test_t *utp) -{ - unit_test_print_report(utp); - if(utp->result == unit_test_failure) { - printf("\nTEST FAILED\n"); - exit(1); /* exit by failure */ - } -} - -/* my_always_return_null() is set to NBR_TABLE_FIND_REMOVABLE */ -const linkaddr_t * -my_always_return_null(nbr_table_reason_t reason, void *data) -{ - return NULL; -} - -void -remove_all_entries_in_neighbor_cache(void) -{ - uip_ds6_nbr_t *nbr, *next_nbr; - for(nbr = uip_ds6_nbr_head(); nbr != NULL; nbr = next_nbr) { - next_nbr = uip_ds6_nbr_next(nbr); - uip_ds6_nbr_rm(nbr); - } - /* - * uip_ds6_nbr_rm() cannot free the memory for an entry in nbr-table. There is - * no API to free or deallocate unused nbr-table entry. Because of that, - * nbr-table has some link-layer addresses even though this function removes - * all the neighbor cache entries. - */ -} - -UNIT_TEST_REGISTER(add_v6addrs_to_neighbor, - "add IPv6 addresses to a single neighbor"); -UNIT_TEST(add_v6addrs_to_neighbor) -{ - uip_ipaddr_t ipaddr; - uip_lladdr_t lladdr; - uip_ds6_nbr_t *nbr; - const uip_lladdr_t *ret_lladdr; - - memset(&ipaddr, 0, sizeof(ipaddr)); - memset(&lladdr, 0, sizeof(lladdr)); - - UNIT_TEST_BEGIN(); - - /* make sure the neighbor cache table is empty */ - remove_all_entries_in_neighbor_cache(); - UNIT_TEST_ASSERT(uip_ds6_nbr_head() == NULL); - UNIT_TEST_ASSERT(uip_ds6_nbr_num() == 0); - - /* prepare a link-layer address */ - LOG_DBG("link-layer addr: "); - LOG_DBG_LLADDR((const linkaddr_t *)&lladdr); - LOG_DBG_("\n"); - - for(int i = 0; i <= UIP_DS6_NBR_MAX_6ADDRS_PER_NBR; i++) { - ipaddr.u8[0] = i; - LOG_DBG("adding ipv6 addr ("); - LOG_DBG_6ADDR(&ipaddr); - LOG_DBG_("[i=%u])\n", i); - - /* add a binding of the IPv6 address and the MAC address */ - nbr = uip_ds6_nbr_add(&ipaddr, &lladdr, is_router, state, reason, NULL); - if(i < UIP_DS6_NBR_MAX_6ADDRS_PER_NBR) { - UNIT_TEST_ASSERT(nbr != NULL); - UNIT_TEST_ASSERT(memcmp(&nbr->ipaddr, &ipaddr, sizeof(ipaddr)) == 0); - UNIT_TEST_ASSERT(nbr->state == state); - UNIT_TEST_ASSERT(uip_ds6_nbr_num() == (i + 1)); - /* - * for some reason, nbr->isrouter is not set if both UIP_ND6_SEND_RA and - * !UIP_CONF_ROUTER is 0 (see uip-ds6-nbr.c) - */ - // UNIT_TEST_ASSERT(nbr->isrouter == is_router); - ret_lladdr = uip_ds6_nbr_lladdr_from_ipaddr((const uip_ipaddr_t *)&ipaddr); - UNIT_TEST_ASSERT(ret_lladdr != NULL); - UNIT_TEST_ASSERT(memcmp(ret_lladdr, &lladdr, sizeof(lladdr)) == 0); - - } else { - /* i == UIP_DS6_NBR_MAX_6ADDRS_PER_NBR; the address shouldn't be added */ - UNIT_TEST_ASSERT(nbr == NULL); - } - } - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(remove_v6addrs_of_neighbor, - "remove IPv6 addresses associated with a single neighbor"); -UNIT_TEST(remove_v6addrs_of_neighbor) -{ - uip_ipaddr_t ipaddr; - uip_lladdr_t lladdr; - uip_ds6_nbr_t *nbr, *next_nbr; - - memset(&ipaddr, 0, sizeof(ipaddr)); - memset(&lladdr, 0, sizeof(lladdr)); - - UNIT_TEST_BEGIN(); - - /* make sure the neighbor cache table is empty */ - remove_all_entries_in_neighbor_cache(); - UNIT_TEST_ASSERT(uip_ds6_nbr_head() == NULL); - UNIT_TEST_ASSERT(uip_ds6_nbr_num() == 0); - - /* prepare a link-layer address */ - LOG_DBG("link-layer addr: "); - LOG_DBG_LLADDR((const linkaddr_t *)&lladdr); - LOG_DBG_("\n"); - - /* fill the neighbor entry associated with the link-layer address */ - for(int i = 0; i < UIP_DS6_NBR_MAX_6ADDRS_PER_NBR; i++) { - ipaddr.u8[0] = i; - nbr = uip_ds6_nbr_add(&ipaddr, &lladdr, is_router, state, reason, NULL); - UNIT_TEST_ASSERT(nbr != NULL); - UNIT_TEST_ASSERT(uip_ds6_nbr_num() == (i + 1)); - } - - /* remove IPv6 addresses for the link-layer address one by one */ - for(nbr = uip_ds6_nbr_head(); nbr != NULL; nbr = next_nbr) { - LOG_DBG("removing nbr:%p\n", nbr); - next_nbr = uip_ds6_nbr_next(nbr); - UNIT_TEST_ASSERT(uip_ds6_nbr_rm(nbr) == 1); - } - UNIT_TEST_ASSERT(uip_ds6_nbr_num() == 0); - UNIT_TEST_ASSERT(uip_ds6_nbr_head() == NULL); - - UNIT_TEST_END(); - -} - -UNIT_TEST_REGISTER(fill_neighbor_cache_table, - "fill the neighbor cache table"); -UNIT_TEST(fill_neighbor_cache_table) -{ - /* - * We should be able to add the same number of link-layer addresses as - * NBR_TABLE_MAX_NEIGHBORS. In addition, we should be add the same number of - * IPv6 addresses per link-layer address as - * UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR. - */ - uip_ipaddr_t ipaddr; - uip_lladdr_t lladdr; - uip_ds6_nbr_t *nbr; - - memset(&ipaddr, 0, sizeof(ipaddr)); - memset(&lladdr, 0, sizeof(lladdr)); - - UNIT_TEST_BEGIN(); - - /* make sure the neighbor cache table is empty */ - remove_all_entries_in_neighbor_cache(); - UNIT_TEST_ASSERT(uip_ds6_nbr_head() == NULL); - UNIT_TEST_ASSERT(uip_ds6_nbr_num() == 0); - - for(int i = 0; i <= NBR_TABLE_MAX_NEIGHBORS; i++) { - lladdr.addr[0] = i & 0xFF; - lladdr.addr[1] = i >> 8; - for(int j = 0; j <= UIP_DS6_NBR_MAX_6ADDRS_PER_NBR; j++) { - ipaddr.u8[0] = i & 0xFF; - ipaddr.u8[1] = i >> 8; - ipaddr.u8[2] = j; - LOG_DBG("adding ipv6 addr ("); - LOG_DBG_6ADDR(&ipaddr); - LOG_DBG_(") to link-layer addr ("); - LOG_DBG_LLADDR((const linkaddr_t *)&lladdr); - LOG_DBG_(") [i=%u,j=%u]\n", i, j); - - nbr = uip_ds6_nbr_add(&ipaddr, &lladdr, is_router, state, reason, NULL); - if((i < NBR_TABLE_MAX_NEIGHBORS) && - (j < UIP_DS6_NBR_MAX_6ADDRS_PER_NBR)) { - UNIT_TEST_ASSERT(nbr != NULL); - } else if(i == NBR_TABLE_MAX_NEIGHBORS) { - /* we should not be able to add a link-layer address any more */ - UNIT_TEST_ASSERT(j == 0); - UNIT_TEST_ASSERT(nbr == NULL); - break; - } else if(j == UIP_DS6_NBR_MAX_6ADDRS_PER_NBR) { - /* we should not be able to add an IPv6 address any more */ - UNIT_TEST_ASSERT(i < NBR_TABLE_MAX_NEIGHBORS); - UNIT_TEST_ASSERT(nbr == NULL); - break; - } else { - /* shouldn't come here */ - UNIT_TEST_ASSERT(false); - } - } - } - - UNIT_TEST_END(); -} - -PROCESS_THREAD(node_process, ev, data) -{ - PROCESS_BEGIN(); - - UNIT_TEST_RUN(add_v6addrs_to_neighbor); - UNIT_TEST_RUN(remove_v6addrs_of_neighbor); - UNIT_TEST_RUN(fill_neighbor_cache_table); - - printf("\nTEST SUCCEEDED\n"); - exit(0); /* success: all the test passed */ - - PROCESS_END(); -} diff --git a/tests/13-ieee802154/01-panid-handling.csc b/tests/13-ieee802154/01-panid-handling.csc deleted file mode 100644 index 71ec85818..000000000 --- a/tests/13-ieee802154/01-panid-handling.csc +++ /dev/null @@ -1,90 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - [APPS_DIR]/radiologger-headless - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype740 - Cooja Mote Type #1 - [CONFIG_DIR]/code-panid-handling/test-panid-handling.c - make -j test-panid-handling.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 57.636765279141336 - 56.661654369889035 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype740 - - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/01-panid-handling.js - true - - 495 - 0 - 525 - 279 - 2 - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - -2 - 0 - - diff --git a/tests/13-ieee802154/02-tsch-flush-nbr-queue.csc b/tests/13-ieee802154/02-tsch-flush-nbr-queue.csc deleted file mode 100644 index 879b31345..000000000 --- a/tests/13-ieee802154/02-tsch-flush-nbr-queue.csc +++ /dev/null @@ -1,145 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype476 - Cooja Mote Type #1 - [CONFIG_DIR]/code-flush-nbr-queue/test-flush-nbr-queue.c - make -j test-flush-nbr-queue.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 38.79981729133275 - 97.05367953429746 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype476 - - - - org.contikios.cooja.plugins.SimControl - 280 - 4 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 158.72743882606113 84.76938224154777 - - 400 - 3 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1320 - 2 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - - - - 500.0 - - 1720 - 1 - 166 - 0 - 957 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1040 - 0 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/02-tsch-flush-nbr-queue.js - true - - 495 - 0 - 525 - 663 - 105 - - diff --git a/tests/13-ieee802154/03-cooja-test-sixtop.csc b/tests/13-ieee802154/03-cooja-test-sixtop.csc deleted file mode 100644 index 9d5be006c..000000000 --- a/tests/13-ieee802154/03-cooja-test-sixtop.csc +++ /dev/null @@ -1,161 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype382 - Cooja Mote Type #1 - [CONFIG_DIR]/code-6tisch/test-sixtop.c - make clean TARGET=cooja - make -j test-sixtop.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 47.60131881808453 - 20.028921031789082 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype382 - - - - org.contikios.cooja.plugins.SimControl - 280 - 5 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 150.72607380174134 154.79188997110083 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1320 - 3 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - - - - 500.0 - - 1720 - 2 - 166 - 0 - 957 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1040 - 1 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - - 500 - 0 - 300 - 290 - 422 - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/sixtop-test.js - true - - 495 - 0 - 525 - 663 - 105 - - diff --git a/tests/13-ieee802154/04-cooja-test-sixp-pkt.csc b/tests/13-ieee802154/04-cooja-test-sixp-pkt.csc deleted file mode 100644 index 5d5cf7016..000000000 --- a/tests/13-ieee802154/04-cooja-test-sixp-pkt.csc +++ /dev/null @@ -1,161 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype382 - Cooja Mote Type #1 - [CONFIG_DIR]/code-6tisch/test-sixp-pkt.c - make clean TARGET=cooja - make -j test-sixp-pkt.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 47.60131881808453 - 20.028921031789082 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype382 - - - - org.contikios.cooja.plugins.SimControl - 280 - 5 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 150.72607380174134 154.79188997110083 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1320 - 3 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - - - - 500.0 - - 1720 - 2 - 166 - 0 - 957 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1040 - 1 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - - 500 - 0 - 300 - 290 - 422 - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/sixtop-test.js - true - - 495 - 0 - 525 - 663 - 105 - - diff --git a/tests/13-ieee802154/05-cooja-test-sixp-trans.csc b/tests/13-ieee802154/05-cooja-test-sixp-trans.csc deleted file mode 100644 index 837fcc321..000000000 --- a/tests/13-ieee802154/05-cooja-test-sixp-trans.csc +++ /dev/null @@ -1,161 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype382 - Cooja Mote Type #1 - [CONFIG_DIR]/code-6tisch/test-sixp-trans.c - make clean TARGET=cooja - make -j test-sixp-trans.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 47.60131881808453 - 20.028921031789082 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype382 - - - - org.contikios.cooja.plugins.SimControl - 280 - 5 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 150.72607380174134 154.79188997110083 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1320 - 3 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - - - - 500.0 - - 1720 - 2 - 166 - 0 - 957 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1040 - 1 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - - 500 - 0 - 300 - 290 - 422 - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/sixtop-test.js - true - - 495 - 0 - 525 - 663 - 105 - - diff --git a/tests/13-ieee802154/06-cooja-test-sixp-nbr.csc b/tests/13-ieee802154/06-cooja-test-sixp-nbr.csc deleted file mode 100644 index bbffc18a8..000000000 --- a/tests/13-ieee802154/06-cooja-test-sixp-nbr.csc +++ /dev/null @@ -1,161 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype382 - Cooja Mote Type #1 - [CONFIG_DIR]/code-6tisch/test-sixp-nbr.c - make clean TARGET=cooja - make -j test-sixp-nbr.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 47.60131881808453 - 20.028921031789082 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype382 - - - - org.contikios.cooja.plugins.SimControl - 280 - 5 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 150.72607380174134 154.79188997110083 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1320 - 3 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - - - - 500.0 - - 1720 - 2 - 166 - 0 - 957 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1040 - 1 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - - 500 - 0 - 300 - 290 - 422 - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/sixtop-test.js - true - - 495 - 0 - 525 - 663 - 105 - - diff --git a/tests/13-ieee802154/07-cooja-test-sixp.csc b/tests/13-ieee802154/07-cooja-test-sixp.csc deleted file mode 100644 index 3e884e4b2..000000000 --- a/tests/13-ieee802154/07-cooja-test-sixp.csc +++ /dev/null @@ -1,161 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype382 - Cooja Mote Type #1 - [CONFIG_DIR]/code-6tisch/test-sixp.c - make clean TARGET=cooja - make -j test-sixp.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 47.60131881808453 - 20.028921031789082 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype382 - - - - org.contikios.cooja.plugins.SimControl - 280 - 5 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 150.72607380174134 154.79188997110083 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1320 - 3 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - - - - 500.0 - - 1720 - 2 - 166 - 0 - 957 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1040 - 1 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - false - false - - - 500 - 0 - 300 - 290 - 422 - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/js/sixtop-test.js - true - - 495 - 0 - 525 - 663 - 105 - - diff --git a/tests/13-ieee802154/Makefile b/tests/13-ieee802154/Makefile deleted file mode 100644 index 272bc7da1..000000000 --- a/tests/13-ieee802154/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../Makefile.simulation-test diff --git a/tests/13-ieee802154/README.md b/tests/13-ieee802154/README.md deleted file mode 100644 index 1073b2cdb..000000000 --- a/tests/13-ieee802154/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Regression Tests of IEEE 802.15.4 Fundamentals - -## 01-panid-handling - -Test return values by `frame802154_has_panid()` in -[frame802154.c](../../os/net/mac/frame802154.c). - -### Test Code - -A test vector is implemented in -[test-panid-handling.c](./code/test-panid-handling.c) according to Section -7.2.1.5, IEEE 802.15.4-2015. The testee mote outputs a test result to the -console with the prefix, `"=check-me="`. - -[01-panid-handling.js](./js/01-panid-handling.js) examines each console output -containing `"=check-me="`. If it finds `"DONE"` without having had any -`"FAILED"`, the test is considered SUCCESS, `log.testOK()` is called. Otherwise, -FAILED. - -### References - -* https://standards.ieee.org/findstds/standard/802.15.4-2015.html -* https://github.com/contiki-os/contiki/pull/1914 diff --git a/tests/13-ieee802154/code-6tisch/Makefile b/tests/13-ieee802154/code-6tisch/Makefile deleted file mode 100644 index 00be98183..000000000 --- a/tests/13-ieee802154/code-6tisch/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -all: - -APPS += unit-test -MODULES += os/net/mac/tsch/sixtop - -PROJECT_SOURCEFILES += common.c - -ifeq ($(TEST_04),1) -CFLAGS += -DSIXP_MSG_API_TEST=1 -endif - -CONTIKI = ../../.. -# MAC layer set as TSCH even though we actually use test_mac_driver -MAKE_MAC = MAKE_MAC_TSCH -include $(CONTIKI)/Makefile.include diff --git a/tests/13-ieee802154/code-6tisch/common.c b/tests/13-ieee802154/code-6tisch/common.c deleted file mode 100644 index 8572b4a19..000000000 --- a/tests/13-ieee802154/code-6tisch/common.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 - -#include "net/mac/tsch/sixtop/sixtop.h" - -#include "unit-test/unit-test.h" -#include "common.h" - -#include "lib/simEnvChange.h" -#include "sys/cooja_mt.h" - -static uint8_t send_is_called; - -void -test_print_report(const unit_test_t *utp) -{ - printf("=check-me= "); - if(utp->result == unit_test_failure) { - printf("FAILED - %s: exit at L%u\n", utp->descr, utp->exit_line); - } else { - printf("SUCCEEDED - %s\n", utp->descr); - } - - /* give up the CPU so that the mote can output messages in the serial buffer */ - simProcessRunValue = 1; - cooja_mt_yield(); -} - -uint8_t -test_mac_send_function_is_called(void) -{ - return send_is_called; -} - -static void -init(void) -{ - send_is_called = 0; -} - -static void -send(mac_callback_t sent_callback, void *ptr) -{ - send_is_called = 1; -} - -const struct mac_driver test_mac_driver = { - "Test MAC", - init, - send, - NULL, - NULL, - NULL -}; diff --git a/tests/13-ieee802154/code-6tisch/common.h b/tests/13-ieee802154/code-6tisch/common.h deleted file mode 100644 index 63e885b68..000000000 --- a/tests/13-ieee802154/code-6tisch/common.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 _COMMON_H -#define _COMMON_H - -#include "unit-test/unit-test.h" - -void test_print_report(const unit_test_t *utp); -uint8_t test_mac_send_function_is_called(void); -extern const struct mac_driver test_mac_driver; - -#endif /* !_COMMON_H */ diff --git a/tests/13-ieee802154/code-6tisch/project-conf.h b/tests/13-ieee802154/code-6tisch/project-conf.h deleted file mode 100644 index acf60cbab..000000000 --- a/tests/13-ieee802154/code-6tisch/project-conf.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define SIXTOP_CONF_MAX_SCHEDULING_FUNCTIONS 2 - -#define SIXTOP_CONF_MAX_TRANSACTIONS 2 - -#define SIXP_CONF_WITH_PAYLOAD_TERMINATION_IE 1 - -#define NBR_TABLE_CONF_MAX_NEIGHBORS 2 - -#define UNIT_TEST_PRINT_FUNCTION test_print_report - -#define TSCH_CONF_WITH_SIXTOP 1 - -#define LOG_CONF_LEVEL_6TOP LOG_LEVEL_DBG - -#define TSCH_CONF_AUTOSTART 0 - -#define IEEE802154_CONF_PANID 0xabcd - -/* Custom MAC layer */ -#define NETSTACK_CONF_MAC test_mac_driver - -#endif /* PROJECT_CONF_H_ */ diff --git a/tests/13-ieee802154/code-6tisch/test-sixp-nbr.c b/tests/13-ieee802154/code-6tisch/test-sixp-nbr.c deleted file mode 100644 index f3c3aaab4..000000000 --- a/tests/13-ieee802154/code-6tisch/test-sixp-nbr.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 STEP OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" -#include "lib/assert.h" - -#include "net/mac/tsch/sixtop/sixp-nbr.h" - -#include "unit-test/unit-test.h" -#include "common.h" - -static linkaddr_t peer_addr_1; -static linkaddr_t peer_addr_2; -static linkaddr_t peer_addr_3; - -PROCESS(test_process, "6P neighbor APIs test"); -AUTOSTART_PROCESSES(&test_process); - -static void -test_setup(void) -{ - sixp_nbr_init(); - - memset(&peer_addr_1, 0, sizeof(peer_addr_1)); - peer_addr_1.u8[0] = 1; - - memset(&peer_addr_2, 0, sizeof(peer_addr_2)); - peer_addr_2.u8[0] = 2; - - memset(&peer_addr_3, 0, sizeof(peer_addr_3)); - peer_addr_3.u8[0] = 3; -} - -UNIT_TEST_REGISTER(test_alloc_and_free, - "test sixp_nbr_{alloc,free}"); -UNIT_TEST(test_alloc_and_free) -{ - sixp_nbr_t *nbr; - - UNIT_TEST_BEGIN(); - test_setup(); - - UNIT_TEST_ASSERT(sixp_nbr_find(&peer_addr_1) == NULL); - UNIT_TEST_ASSERT(sixp_nbr_find(&peer_addr_2) == NULL); - - /* a valid allocation */ - UNIT_TEST_ASSERT((nbr = sixp_nbr_alloc(&peer_addr_1)) != NULL); - UNIT_TEST_ASSERT(sixp_nbr_find(&peer_addr_1) == nbr); - - /* another allocation */ - UNIT_TEST_ASSERT((nbr = sixp_nbr_alloc(&peer_addr_2)) != NULL); - UNIT_TEST_ASSERT(sixp_nbr_find(&peer_addr_2) == nbr); - - /* no available memory because NBR_TABLE_CONF_MAX_NEIGHBORS == 2 */ - UNIT_TEST_ASSERT(sixp_nbr_find(&peer_addr_3) == NULL); - UNIT_TEST_ASSERT(sixp_nbr_alloc(&peer_addr_3) == NULL); - UNIT_TEST_ASSERT(sixp_nbr_find(&peer_addr_3) == NULL); - - /* cannot allocate a duplicate nbr */ - UNIT_TEST_ASSERT((nbr = sixp_nbr_alloc(&peer_addr_1)) == NULL); - UNIT_TEST_ASSERT((nbr = sixp_nbr_alloc(&peer_addr_2)) == NULL); - - /* remove allocated nbrs */ - UNIT_TEST_ASSERT(sixp_nbr_find(&peer_addr_1) != NULL); - sixp_nbr_free(sixp_nbr_find(&peer_addr_1)); - UNIT_TEST_ASSERT(sixp_nbr_find(&peer_addr_1) == NULL); - - UNIT_TEST_ASSERT(sixp_nbr_find(&peer_addr_2) != NULL); - sixp_nbr_free(sixp_nbr_find(&peer_addr_2)); - UNIT_TEST_ASSERT(sixp_nbr_find(&peer_addr_2) == NULL); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_next_seqno, - "test next_seqno operation"); -UNIT_TEST(test_next_seqno) -{ - sixp_nbr_t *nbr; - UNIT_TEST_BEGIN(); - - test_setup(); - UNIT_TEST_ASSERT((nbr = sixp_nbr_alloc(&peer_addr_1)) != NULL); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 0); - - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 1); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 2); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 3); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 4); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 5); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 6); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 7); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 8); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 9); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 10); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 11); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 12); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 13); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 14); - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 15); - - UNIT_TEST_ASSERT(sixp_nbr_set_next_seqno(nbr, 255) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 255); - - /* next_seqno must be 1 after 255. */ - UNIT_TEST_ASSERT(sixp_nbr_increment_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 1); - - /* next_seqno is reset to 0 by sixp_nbr_reset_next_seqno() */ - UNIT_TEST_ASSERT(sixp_nbr_reset_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 0); - - UNIT_TEST_END(); -} - - -PROCESS_THREAD(test_process, ev, data) -{ - PROCESS_BEGIN(); - printf("Run unit-test\n"); - printf("---\n"); - - /* alloc / free */ - UNIT_TEST_RUN(test_alloc_and_free); - - /* next sequence number */ - UNIT_TEST_RUN(test_next_seqno); - - printf("=check-me= DONE\n"); - PROCESS_END(); -} diff --git a/tests/13-ieee802154/code-6tisch/test-sixp-pkt.c b/tests/13-ieee802154/code-6tisch/test-sixp-pkt.c deleted file mode 100644 index e49eed840..000000000 --- a/tests/13-ieee802154/code-6tisch/test-sixp-pkt.c +++ /dev/null @@ -1,4637 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 - -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" -#include "lib/assert.h" - -#include "net/mac/tsch/tsch.h" -#include "net/mac/tsch/sixtop/sixp-pkt.h" - -#include "unit-test/unit-test.h" -#include "common.h" - -static uint8_t buf[TSCH_PACKET_MAX_LEN]; -static uint8_t ref_data[TSCH_PACKET_MAX_LEN]; - -PROCESS(test_process, "6P packet APIs test"); -AUTOSTART_PROCESSES(&test_process); - -UNIT_TEST_REGISTER(test_set_get_metadata_add_req, - "test sixp_pkt_{set,get}_metadata(add_req)"); -UNIT_TEST(test_set_get_metadata_add_req) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, - buf, sizeof(buf)) == 0); - ref_data[0] = 0xAB; - ref_data[1] = 0xCD; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0xAB); - UNIT_TEST_ASSERT(p_result[1] == 0xCD); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_metadata_delete_req, - "test sixp_pkt_{set,get}_metadata(delete_req)"); -UNIT_TEST(test_set_get_metadata_delete_req) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, - buf, sizeof(buf)) == 0); - ref_data[0] = 0xAB; - ref_data[1] = 0xCD; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0xAB); - UNIT_TEST_ASSERT(p_result[1] == 0xCD); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_metadata_relocate_req, - "test sixp_pkt_{set,get}_metadata(relocate_req)"); -UNIT_TEST(test_set_get_metadata_relocate_req) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, - buf, sizeof(buf)) == 0); - ref_data[0] = 0xAB; - ref_data[1] = 0xCD; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0xAB); - UNIT_TEST_ASSERT(p_result[1] == 0xCD); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_metadata_count_req, - "test sixp_pkt_{set,get}_metadata(count_req)"); -UNIT_TEST(test_set_get_metadata_count_req) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, - buf, sizeof(buf)) == 0); - ref_data[0] = 0xAB; - ref_data[1] = 0xCD; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0xAB); - UNIT_TEST_ASSERT(p_result[1] == 0xCD); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_metadata_list_req, - "test sixp_pkt_{set,get}_metadata(list_req)"); -UNIT_TEST(test_set_get_metadata_list_req) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, - buf, sizeof(buf)) == 0); - ref_data[0] = 0xAB; - ref_data[1] = 0xCD; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0xAB); - UNIT_TEST_ASSERT(p_result[1] == 0xCD); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_metadata_signal_req, - "test sixp_pkt_{set,get}_metadata(signal_req)"); -UNIT_TEST(test_set_get_metadata_signal_req) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, - buf, sizeof(buf)) == 0); - ref_data[0] = 0xAB; - ref_data[1] = 0xCD; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0xAB); - UNIT_TEST_ASSERT(p_result[1] == 0xCD); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_metadata_clear_req, - "test sixp_pkt_{set,get}_metadata(clear_req)"); -UNIT_TEST(test_set_get_metadata_clear_req) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, - buf, sizeof(buf)) == 0); - ref_data[0] = 0xAB; - ref_data[1] = 0xCD; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0xAB); - UNIT_TEST_ASSERT(p_result[1] == 0xCD); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_metadata_success_res, - "test sixp_pkt_{set,get}_metadata(success_res)"); -UNIT_TEST(test_set_get_metadata_success_res) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Success Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_metadata_success_conf, - "test sixp_pkt_{set,get}_metadata(success_conf)"); -UNIT_TEST(test_set_get_metadata_success_conf) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Success Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_metadata_error_res, - "test sixp_pkt_{set,get}_metadata(err_res)"); -UNIT_TEST(test_set_get_metadata_error_res) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Error Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_metadata_error_conf, - "test sixp_pkt_{set,get}_metadata(err_conf)"); -UNIT_TEST(test_set_get_metadata_error_conf) -{ - sixp_pkt_metadata_t testdata, result; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Error Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_metadata(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_metadata(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_add_req, - "test sixp_pkt_{set,get}_cell_options(add_req)"); -UNIT_TEST(test_set_get_cell_options_add_req) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, - buf, sizeof(buf)) == 0); - ref_data[2] = 0x07; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == testdata); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_delete_req, - "test sixp_pkt_{set,get}_cell_options(delete_req)"); -UNIT_TEST(test_set_get_cell_options_delete_req) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, - buf, sizeof(buf)) == 0); - ref_data[2] = 0x07; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == testdata); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_relocate_req, - "test sixp_pkt_{set,get}_cell_options(relocate_req)"); -UNIT_TEST(test_set_get_cell_options_relocate_req) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, - buf, sizeof(buf)) == 0); - ref_data[2] = 0x07; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == testdata); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_count_req, - "test sixp_pkt_{set,get}_cell_options(count_req)"); -UNIT_TEST(test_set_get_cell_options_count_req) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, - buf, sizeof(buf)) == 0); - ref_data[2] = 0x07; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == testdata); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_list_req, - "test sixp_pkt_{set,get}_cell_options(list_req)"); -UNIT_TEST(test_set_get_cell_options_list_req) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, - buf, sizeof(buf)) == 0); - ref_data[2] = 0x07; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == testdata); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_signal_req, - "test sixp_pkt_{set,get}_cell_options(signal_req)"); -UNIT_TEST(test_set_get_cell_options_signal_req) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_clear_req, - "test sixp_pkt_{set,get}_cell_options(clear_req)"); -UNIT_TEST(test_set_get_cell_options_clear_req) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_success_res, - "test sixp_pkt_{set,get}_cell_options(success_res)"); -UNIT_TEST(test_set_get_cell_options_success_res) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Success Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_success_conf, - "test sixp_pkt_{set,get}_cell_options(success_conf)"); -UNIT_TEST(test_set_get_cell_options_success_conf) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Success Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_error_res, - "test sixp_pkt_{set,get}_cell_options(err_res)"); -UNIT_TEST(test_set_get_cell_options_error_res) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Error Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_options_error_conf, - "test sixp_pkt_{set,get}_cell_options(err_conf)"); -UNIT_TEST(test_set_get_cell_options_error_conf) -{ - sixp_pkt_cell_options_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Error Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_options(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_options(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_add_req, - "test sixp_pkt_{set,get}_num_cells(add_req)"); -UNIT_TEST(test_set_get_num_cells_add_req) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, - buf, sizeof(buf)) == 0); - ref_data[3] = 0x07; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == testdata); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_delete_req, - "test sixp_pkt_{set,get}_num_cells(delete_req)"); -UNIT_TEST(test_set_get_num_cells_delete_req) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, - buf, sizeof(buf)) == 0); - ref_data[3] = 0x07; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == testdata); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_relocate_req, - "test sixp_pkt_{set,get}_num_cells(relocate_req)"); -UNIT_TEST(test_set_get_num_cells_relocate_req) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, - buf, sizeof(buf)) == 0); - ref_data[3] = 0x07; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == testdata); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_count_req, - "test sixp_pkt_{set,get}_num_cells(count_req)"); -UNIT_TEST(test_set_get_num_cells_count_req) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_list_req, - "test sixp_pkt_{set,get}_num_cells(list_req)"); -UNIT_TEST(test_set_get_num_cells_list_req) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_signal_req, - "test sixp_pkt_{set,get}_num_cells(signal_req)"); -UNIT_TEST(test_set_get_num_cells_signal_req) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_clear_req, - "test sixp_pkt_{set,get}_num_cells(clear_req)"); -UNIT_TEST(test_set_get_num_cells_clear_req) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_success_res, - "test sixp_pkt_{set,get}_num_cells(success_res)"); -UNIT_TEST(test_set_get_num_cells_success_res) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0xfe; - - UNIT_TEST_BEGIN(); - - /* Success Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_success_conf, - "test sixp_pkt_{set,get}_num_cells(success_conf)"); -UNIT_TEST(test_set_get_num_cells_success_conf) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Success Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_error_res, - "test sixp_pkt_{set,get}_num_cells(err_res)"); -UNIT_TEST(test_set_get_num_cells_error_res) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Error Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_num_cells_error_conf, - "test sixp_pkt_{set,get}_num_cells(err_conf)"); -UNIT_TEST(test_set_get_num_cells_error_conf) -{ - sixp_pkt_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Error Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_add_req, - "test sixp_pkt_{set,get}_reserved(add_req)"); -UNIT_TEST(test_set_get_reserved_add_req) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_delete_req, - "test sixp_pkt_{set,get}_reserved(delete_req)"); -UNIT_TEST(test_set_get_reserved_delete_req) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_relocate_req, - "test sixp_pkt_{set,get}_reserved(relocate_req)"); -UNIT_TEST(test_set_get_reserved_relocate_req) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_count_req, - "test sixp_pkt_{set,get}_reserved(count_req)"); -UNIT_TEST(test_set_get_reserved_count_req) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_list_req, - "test sixp_pkt_{set,get}_reserved(list_req)"); -UNIT_TEST(test_set_get_reserved_list_req) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, - buf, sizeof(buf)) == 0); - ref_data[3] = 0x07; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == testdata); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_signal_req, - "test sixp_pkt_{set,get}_reserved(signal_req)"); -UNIT_TEST(test_set_get_reserved_signal_req) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_clear_req, - "test sixp_pkt_{set,get}_reserved(clear_req)"); -UNIT_TEST(test_set_get_reserved_clear_req) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_success_res, - "test sixp_pkt_{set,get}_reserved(success_res)"); -UNIT_TEST(test_set_get_reserved_success_res) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Success Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_success_conf, - "test sixp_pkt_{set,get}_reserved(success_conf)"); -UNIT_TEST(test_set_get_reserved_success_conf) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Success Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_error_res, - "test sixp_pkt_{set,get}_reserved(err_res)"); -UNIT_TEST(test_set_get_reserved_error_res) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Success Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_reserved_error_conf, - "test sixp_pkt_{set,get}_reserved(err_conf)"); -UNIT_TEST(test_set_get_reserved_error_conf) -{ - sixp_pkt_reserved_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Success Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_reserved(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_reserved(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_add_req, - "test sixp_pkt_{set,get}_offset(add_req)"); -UNIT_TEST(test_set_get_offset_add_req) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_delete_req, - "test sixp_pkt_{set,get}_offset(delete_req)"); -UNIT_TEST(test_set_get_offset_delete_req) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_relocate_req, - "test sixp_pkt_{set,get}_offset(relocate_req)"); -UNIT_TEST(test_set_get_offset_relocate_req) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_count_req, - "test sixp_pkt_{set,get}_offset(count_req)"); -UNIT_TEST(test_set_get_offset_count_req) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_list_req, - "test sixp_pkt_{set,get}_offset(list_req)"); -UNIT_TEST(test_set_get_offset_list_req) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0xabcd; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, - buf, sizeof(buf)) == 0); - ref_data[4] = 0xcd; - ref_data[5] = 0xab; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0xabcd); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_signal_req, - "test sixp_pkt_{set,get}_offset(signal_req)"); -UNIT_TEST(test_set_get_offset_signal_req) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0xabcd; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_clear_req, - "test sixp_pkt_{set,get}_offset(clear_req)"); -UNIT_TEST(test_set_get_offset_clear_req) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_success_res, - "test sixp_pkt_{set,get}_offset(success_res)"); -UNIT_TEST(test_set_get_offset_success_res) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_success_conf, - "test sixp_pkt_{set,get}_offset(success_conf)"); -UNIT_TEST(test_set_get_offset_success_conf) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_error_res, - "test sixp_pkt_{set,get}_offset(err_res)"); -UNIT_TEST(test_set_get_offset_error_res) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_offset_error_conf, - "test sixp_pkt_{set,get}_offset(err_conf)"); -UNIT_TEST(test_set_get_offset_error_conf) -{ - sixp_pkt_offset_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_offset(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_offset(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_add_req, - "test sixp_pkt_{set,get}_max_num_cells(add_req)"); -UNIT_TEST(test_set_get_max_num_cells_add_req) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_delete_req, - "test sixp_pkt_{set,get}_max_num_cells(delete_req)"); -UNIT_TEST(test_set_get_max_num_cells_delete_req) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_relocate_req, - "test sixp_pkt_{set,get}_max_num_cells(relocate_req)"); -UNIT_TEST(test_set_get_max_num_cells_relocate_req) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_count_req, - "test sixp_pkt_{set,get}_max_num_cells(count_req)"); -UNIT_TEST(test_set_get_max_num_cells_count_req) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_list_req, - "test sixp_pkt_{set,get}_max_num_cells(list_req)"); -UNIT_TEST(test_set_get_max_num_cells_list_req) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x1234; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, - buf, sizeof(buf)) == 0); - ref_data[6] = 0x34; - ref_data[7] = 0x12; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x1234); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_signal_req, - "test sixp_pkt_{set,get}_max_num_cells(signal_req)"); -UNIT_TEST(test_set_get_max_num_cells_signal_req) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x1234; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_clear_req, - "test sixp_pkt_{set,get}_max_num_cells(clear_req)"); -UNIT_TEST(test_set_get_max_num_cells_clear_req) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_success_res, - "test sixp_pkt_{set,get}_max_num_cells(success_res)"); -UNIT_TEST(test_set_get_max_num_cells_success_res) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_success_conf, - "test sixp_pkt_{set,get}_max_num_cells(success_conf)"); -UNIT_TEST(test_set_get_max_num_cells_success_conf) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_error_res, - "test sixp_pkt_{set,get}_max_num_cells(err_res)"); -UNIT_TEST(test_set_get_max_num_cells_error_res) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_max_num_cells_error_conf, - "test sixp_pkt_{set,get}_max_num_cells(error_conf)"); -UNIT_TEST(test_set_get_max_num_cells_error_conf) -{ - sixp_pkt_max_num_cells_t testdata, result; - testdata = 0x07; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_max_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_max_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0x00); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_add_req, - "test sixp_pkt_{set,get}_cell_list(add_req)"); -UNIT_TEST(test_set_get_cell_list_add_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, sizeof(testdata), 0, // offset 0 - buf, sizeof(buf)) == 0); - memcpy(ref_data + 4, testdata, sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, sizeof(testdata), sizeof(testdata), - buf, sizeof(buf)) == 0); - /* 4 of cell_offset means 16-octet offset */ - memcpy(ref_data + 4 + 16, testdata, sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &result, &result_len, - buf, sizeof(testdata) * 2 + 4) == 0); - UNIT_TEST_ASSERT(result_len == sizeof(testdata) * 2); - UNIT_TEST_ASSERT(memcmp(result, testdata, sizeof(testdata)) == 0); - UNIT_TEST_ASSERT(memcmp(result + 16, testdata, sizeof(testdata)) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_delete_req, - "test sixp_pkt_{set,get}_cell_list(delete_req)"); -UNIT_TEST(test_set_get_cell_list_delete_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == 0); - memcpy(ref_data + 4, testdata, sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, sizeof(testdata), sizeof(testdata), - buf, sizeof(buf)) == 0); - /* 4 of cell_offset means 16-octet offset */ - memcpy(ref_data + 4 + 16, testdata, sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &result, &result_len, - buf, sizeof(testdata) + 4) == 0); - UNIT_TEST_ASSERT(result_len == sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - UNIT_TEST_ASSERT(memcmp(result + 16, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_relocate_req, - "test sixp_pkt_{set,get}_cell_list(relocate_req)"); -UNIT_TEST(test_set_get_cell_list_relocate_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, sizeof(testdata), 0, // offset 0 - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result_len == 0); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_count_req, - "test sixp_pkt_{set,get}_cell_list(count_req)"); -UNIT_TEST(test_set_get_cell_list_count_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result_len == 0); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_list_req, - "test sixp_pkt_{set,get}_cell_list(list_req)"); -UNIT_TEST(test_set_get_cell_list_list_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result_len == 0); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_signal_req, - "test sixp_pkt_{set,get}_cell_list(signal_req)"); -UNIT_TEST(test_set_get_cell_list_signal_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result_len == 0); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_clear_req, - "test sixp_pkt_{set,get}_cell_list(clear_req)"); -UNIT_TEST(test_set_get_cell_list_clear_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result_len == 0); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_success_res, - "test sixp_pkt_{set,get}_cell_list(success_res)"); -UNIT_TEST(test_set_get_cell_list_success_res) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Success Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == 0); - memcpy(ref_data, testdata, sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, &result_len, - buf, sizeof(testdata)) == 0); - UNIT_TEST_ASSERT(result_len == sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_success_conf, - "test sixp_pkt_{set,get}_cell_list(success_conf)"); -UNIT_TEST(test_set_get_cell_list_success_conf) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Success Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == 0); - memcpy(ref_data, testdata, sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, &result_len, - buf, sizeof(testdata)) == 0); - UNIT_TEST_ASSERT(result_len == sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_error_res, - "test sixp_pkt_{set,get}_cell_list(error_res)"); -UNIT_TEST(test_set_get_cell_list_error_res) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Error Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result_len == 0); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cell_list_error_conf, - "test sixp_pkt_{set,get}_cell_list(error_conf)"); -UNIT_TEST(test_set_get_cell_list_error_conf) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Error Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, &result_len, - buf, sizeof(testdata)) == -1); - UNIT_TEST_ASSERT(result_len == 0); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_add_req, - "test sixp_pkt_{set,get}_rel_cell_list(add_req)"); -UNIT_TEST(test_set_get_rel_cell_list_add_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - 4, buf, sizeof(buf)) == 0); // NumCells == 4 - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, sizeof(testdata), 0, // offset 0 - buf, sizeof(buf)) == -1); - ref_data[3] = 4; // NumCells == 4 - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - result_len = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &result, &result_len, - buf, sizeof(testdata) + 4) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_delete_req, - "test sixp_pkt_{set,get}_rel_cell_list(delete_req)"); -UNIT_TEST(test_set_get_rel_cell_list_delete_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - 4, buf, sizeof(buf)) == 0); // NumCells == 4 - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, sizeof(testdata), 0, // offset 0 - buf, sizeof(buf)) == -1); - ref_data[3] = 4; // NumCells == 4 - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - result_len = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &result, &result_len, - buf, sizeof(testdata) + 4) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_relocate_req, - "test sixp_pkt_{set,get}_rel_cell_list(relocate_req)"); -UNIT_TEST(test_set_get_rel_cell_list_relocate_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - 4, buf, sizeof(buf)) == 0); // NumCells == 4 - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, sizeof(testdata), 0, // offset 0 - buf, sizeof(buf)) == 0); - ref_data[3] = 4; // NumCells == 4 - memcpy(ref_data + 4, testdata, sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - result_len = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - &result, &result_len, - buf, sizeof(testdata) + 4) == 0); - UNIT_TEST_ASSERT(result == &buf[4]); - UNIT_TEST_ASSERT(result_len == sizeof(testdata)); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_count_req, - "test sixp_pkt_{set,get}_rel_cell_list(count_req)"); -UNIT_TEST(test_set_get_rel_cell_list_count_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_list_req, - "test sixp_pkt_{set,get}_rel_cell_list(list_req)"); -UNIT_TEST(test_set_get_rel_cell_list_list_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_signal_req, - "test sixp_pkt_{set,get}_rel_cell_list(signal_req)"); -UNIT_TEST(test_set_get_rel_cell_list_signal_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_clear_req, - "test sixp_pkt_{set,get}_rel_cell_list(clear_req)"); -UNIT_TEST(test_set_get_rel_cell_list_clear_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_success_res, - "test sixp_pkt_{set,get}_rel_cell_list(success_res)"); -UNIT_TEST(test_set_get_rel_cell_list_success_res) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Success Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, &result_len, - buf, sizeof(testdata)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_success_conf, - "test sixp_pkt_{set,get}_rel_cell_list(success_conf)"); -UNIT_TEST(test_set_get_rel_cell_list_success_conf) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Success Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, &result_len, - buf, sizeof(testdata)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_error_res, - "test sixp_pkt_{set,get}_rel_cell_list(error_res)"); -UNIT_TEST(test_set_get_rel_cell_list_error_res) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Error Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, &result_len, - buf, sizeof(testdata)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_rel_cell_list_error_conf, - "test sixp_pkt_{set,get}_rel_cell_list(error_conf)"); -UNIT_TEST(test_set_get_rel_cell_list_error_conf) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Error Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_rel_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_rel_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, &result_len, - buf, sizeof(testdata)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_add_req, - "test sixp_pkt_{set,get}_cand_cell_list(add_req)"); -UNIT_TEST(test_set_get_cand_cell_list_add_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - 4, buf, sizeof(buf)) == 0); // NumCells == 4 - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, sizeof(testdata), 0, // offset 0 - buf, sizeof(buf)) == -1); - ref_data[3] = 4; // NumCells == 4 - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - result_len = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &result, &result_len, - buf, sizeof(testdata) + 4) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_delete_req, - "test sixp_pkt_{set,get}_cand_cell_list(delete_req)"); -UNIT_TEST(test_set_get_cand_cell_list_delete_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - 4, buf, sizeof(buf)) == 0); // NumCells == 4 - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, sizeof(testdata), 0, // offset 0 - buf, sizeof(buf)) == -1); - ref_data[3] = 4; // NumCells == 4 - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - result_len = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &result, &result_len, - buf, sizeof(testdata) + 4) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_relocate_req, - "test sixp_pkt_{set,get}_cand_cell_list(relocate_req)"); -UNIT_TEST(test_set_get_cand_cell_list_relocate_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - 4, buf, sizeof(buf)) == 0); // NumCells == 4 - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, sizeof(testdata), 0, // offset 0 - buf, sizeof(buf)) == 0); - ref_data[3] = 4; // NumCells == 4 - memcpy(ref_data + 20, testdata, sizeof(testdata)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - result_len = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - &result, &result_len, - buf, 20 + sizeof(testdata)) == 0); - UNIT_TEST_ASSERT(result == &buf[20]); - UNIT_TEST_ASSERT(result_len == sizeof(testdata)); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_count_req, - "test sixp_pkt_{set,get}_cand_cell_list(count_req)"); -UNIT_TEST(test_set_get_cand_cell_list_count_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_list_req, - "test sixp_pkt_{set,get}_cand_cell_list(list_req)"); -UNIT_TEST(test_set_get_cand_cell_list_list_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_signal_req, - "test sixp_pkt_{set,get}_cand_cell_list(signal_req)"); -UNIT_TEST(test_set_get_cand_cell_list_signal_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_clear_req, - "test sixp_pkt_{set,get}_cand_cell_list(clear_req)"); -UNIT_TEST(test_set_get_cand_cell_list_clear_req) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - &result, &result_len, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result_len == 0); - UNIT_TEST_ASSERT(memcmp(result, testdata, result_len) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_success_res, - "test sixp_pkt_{set,get}_cand_cell_list(success_res)"); -UNIT_TEST(test_set_get_cand_cell_list_success_res) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Success Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, &result_len, - buf, sizeof(testdata)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_success_conf, - "test sixp_pkt_{set,get}_cand_cell_list(success_conf)"); -UNIT_TEST(test_set_get_cand_cell_list_success_conf) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Success Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, &result_len, - buf, sizeof(testdata)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_error_res, - "test sixp_pkt_{set,get}_cand_cell_list(error_res)"); -UNIT_TEST(test_set_get_cand_cell_list_error_res) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Error Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, &result_len, - buf, sizeof(testdata)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_cand_cell_list_error_conf, - "test sixp_pkt_{set,get}_cand_cell_list(error_conf)"); -UNIT_TEST(test_set_get_cand_cell_list_error_conf) -{ - /* make a cell list having four cells as test data */ - const uint8_t testdata[] = {0x01, 0x23, 0x45, 0x67, - 0x89, 0xab, 0xcd, 0xef, - 0xde, 0xad, 0xbe, 0xef, - 0xca, 0xfe, 0xca, 0xfe}; - const uint8_t *result; - sixp_pkt_offset_t result_len = 0; - - UNIT_TEST_BEGIN(); - - /* Error Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_cand_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, sizeof(testdata), 0, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - result = NULL; - UNIT_TEST_ASSERT( - sixp_pkt_get_cand_cell_list(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, &result_len, - buf, sizeof(testdata)) == -1); - UNIT_TEST_ASSERT(result == NULL); - UNIT_TEST_ASSERT(result_len == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_parse_valid_version, - "test sixp_pkt_parse(valid_version)"); -UNIT_TEST(test_parse_valid_version) -{ - /* - * - Version (4-bit) : 0 (valid version) - * - Type (2-bit) : 0 (request) - * - Reserved (2-bit): 0 - * - Code (8-bit) : 2 (delete) - * - SFID (8-bit) : 0xfe - * - SeqNum (8-bit) : 0x6a - * - Other Field : (4-octet payload) - */ - const uint8_t test_buf[] = {0x00, 0x02, 0xfe, 0x6a, - 0xde, 0xad, 0xbe, 0xef}; - sixp_pkt_t pkt; - - UNIT_TEST_BEGIN(); - - UNIT_TEST_ASSERT(sixp_pkt_parse(test_buf, sizeof(test_buf), &pkt) == 0); - UNIT_TEST_ASSERT(pkt.type == SIXP_PKT_TYPE_REQUEST); - UNIT_TEST_ASSERT(pkt.code.cmd == SIXP_PKT_CMD_DELETE); - UNIT_TEST_ASSERT(pkt.sfid == 0xfe); - UNIT_TEST_ASSERT(pkt.seqno == 0x6a); - UNIT_TEST_ASSERT(pkt.body == &test_buf[4]); - UNIT_TEST_ASSERT(pkt.body_len == 4); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_parse_invalid_version, - "test sixp_pkt_parse(invalid_version)"); -UNIT_TEST(test_parse_invalid_version) -{ - /* - * - Version (4-bit) : 2 (invalid version) - * - Type (2-bit) : 0 (request) - * - Reserved (2-bit): 0 - * - Code (8-bit) : 2 (delete) - * - SFID (8-bit) : 0xfe - * - SeqNum (8-bit) : 0x6a - * - Other Field : (4-octet payload) - */ - const uint8_t test_buf[] = {0x02, 0x08, 0xfe, 0x6a, - 0xde, 0xad, 0xbe, 0xef}; - sixp_pkt_t pkt; - - UNIT_TEST_BEGIN(); - - UNIT_TEST_ASSERT(sixp_pkt_parse(test_buf, sizeof(test_buf), &pkt) < 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_parse_invalid_length, - "test sixp_pkt_parse(invalid_length)"); -UNIT_TEST(test_parse_invalid_length) -{ - /* - * - Version (4-bit) : 1 (valid version) - * - Type (2-bit) : 0 (request) - * - Reserved (2-bit): 0 - * - Code (8-bit) : 2 (delete) - * - SFID (8-bit) : 0xfe - */ - const uint8_t test_buf[] = {0x02, 0x08, 0xfe}; - sixp_pkt_t pkt; - - UNIT_TEST_BEGIN(); - - UNIT_TEST_ASSERT(sixp_pkt_parse(test_buf, sizeof(test_buf), &pkt) < 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_parse_invalid_cmd, - "test sixp_pkt_parse(invalid_cmd)"); -UNIT_TEST(test_parse_invalid_cmd) -{ - /* - * - Version (4-bit) : 1 (valid version) - * - Type (2-bit) : 0 (request) - * - Reserved (2-bit): 0 - * - Code (8-bit) : 10 (undefined) - * - SFID (8-bit) : 0xfe - * - SeqNum (8-bit) : 0x6a - * - Other Field : (4-octet payload) - */ - const uint8_t test_buf[] = {0x01, 0x0a, 0xfe, 0x6a, - 0xde, 0xad, 0xbe, 0xef}; - sixp_pkt_t pkt; - - UNIT_TEST_BEGIN(); - - UNIT_TEST_ASSERT(sixp_pkt_parse(test_buf, sizeof(test_buf), &pkt) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_parse_invalid_rc, - "test sixp_pkt_parse(invalid_rc)"); -UNIT_TEST(test_parse_invalid_rc) -{ - /* - * - Version (4-bit) : 1 (valid version) - * - Type (2-bit) : 1 (response) - * - Reserved (2-bit): 0 - * - Code (8-bit) : 15 (undefined) - * - SFID (8-bit) : 0xfe - * - SeqNum (8-bit) : 0x6a - * - Other Field : (4-octet payload) - */ - const uint8_t test_buf[] = {0x11, 0x0f, 0xfe, 0x6a}; - sixp_pkt_t pkt; - - UNIT_TEST_BEGIN(); - - UNIT_TEST_ASSERT(sixp_pkt_parse(test_buf, sizeof(test_buf), &pkt) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_parse_invalid_type, - "test sixp_pkt_parse(invalid_type)"); -UNIT_TEST(test_parse_invalid_type) -{ - /* - * - Version (4-bit) : 1 (valid version) - * - Type (2-bit) : 3 (undefined) - * - Reserved (2-bit): 0 - * - Code (8-bit) : 0 (undefined) - * - SFID (8-bit) : 0xfe - * - SeqNum (8-bit) : 0x6a - * - Other Field : (4-octet payload) - */ - const uint8_t test_buf[] = {0x31, 0x00, 0xfe, 0x6a}; - sixp_pkt_t pkt; - - UNIT_TEST_BEGIN(); - - UNIT_TEST_ASSERT(sixp_pkt_parse(test_buf, sizeof(test_buf), &pkt) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_create_valid_packet, - "test sixp_pkt_create(valid_packet)"); -UNIT_TEST(test_create_valid_packet) -{ - /* - * - Version (4-bit) : 1 (valid version) - * - Type (2-bit) : 0 (request) - * - Reserved (2-bit): 0 - * - Code (8-bit) : 2 (delete) - * - SFID (8-bit) : 0xfe - * - SeqNum (8-bit) : 0x6a - * - Other Field : (4-octet payload) - */ - const uint8_t test_body[] = {0xde, 0xad, 0xbe, 0xef}; - uint8_t *data_ptr, *hdr_ptr; - sixp_pkt_t pkt; - - UNIT_TEST_BEGIN(); - - packetbuf_clear(); - memset(&pkt, 0, sizeof(pkt)); - UNIT_TEST_ASSERT( - sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - 0xfe, 0x6a, - test_body, sizeof(test_body), &pkt) == 0); - - hdr_ptr = packetbuf_hdrptr(); - data_ptr = packetbuf_dataptr(); - - /* Test lengths */ - UNIT_TEST_ASSERT(packetbuf_hdrlen() == 4); - UNIT_TEST_ASSERT(packetbuf_datalen() == 4); - UNIT_TEST_ASSERT(packetbuf_totlen() == 8); - - /* 6top IE Content */ - UNIT_TEST_ASSERT(hdr_ptr[0] == 0x00); - UNIT_TEST_ASSERT(hdr_ptr[1] == 0x02); - UNIT_TEST_ASSERT(hdr_ptr[2] == 0xfe); - UNIT_TEST_ASSERT(hdr_ptr[3] == 0x6a); - UNIT_TEST_ASSERT(data_ptr[0] == 0xde); - UNIT_TEST_ASSERT(data_ptr[1] == 0xad); - UNIT_TEST_ASSERT(data_ptr[2] == 0xbe); - UNIT_TEST_ASSERT(data_ptr[3] == 0xef); - - /* Test returned pkt */ - UNIT_TEST_ASSERT(pkt.type == SIXP_PKT_TYPE_REQUEST); - UNIT_TEST_ASSERT(pkt.code.cmd == SIXP_PKT_CMD_DELETE); - UNIT_TEST_ASSERT(pkt.sfid == 0xfe); - UNIT_TEST_ASSERT(pkt.seqno == 0x6a); - UNIT_TEST_ASSERT(memcmp(pkt.body, test_body, pkt.body_len) == 0); - UNIT_TEST_ASSERT(pkt.body_len == 4); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_create_valid_packet_with_null_pkt, - "test sixp_pkt_create(valid_packet_with_null_pkt)"); -UNIT_TEST(test_create_valid_packet_with_null_pkt) -{ - /* - * - Version (4-bit) : 1 (valid version) - * - Type (2-bit) : 0 (request) - * - Reserved (2-bit): 0 - * - Code (8-bit) : 2 (delete) - * - SFID (8-bit) : 0xfe - * - SeqNum (8-bit) : 0x6a - * - Other Field : (4-octet payload) - */ - const uint8_t test_body[] = {0xde, 0xad, 0xbe, 0xef}; - uint8_t *data_ptr, *hdr_ptr; - - UNIT_TEST_BEGIN(); - - packetbuf_clear(); - UNIT_TEST_ASSERT( - sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - 0xfe, 0x6a, - test_body, sizeof(test_body), NULL) == 0); - - hdr_ptr = packetbuf_hdrptr(); - data_ptr = packetbuf_dataptr(); - - /* Test lengths */ - UNIT_TEST_ASSERT(packetbuf_hdrlen() == 4); - UNIT_TEST_ASSERT(packetbuf_datalen() == 4); - UNIT_TEST_ASSERT(packetbuf_totlen() == 8); - - /* 6top IE Content */ - UNIT_TEST_ASSERT(hdr_ptr[0] == 0x00); - UNIT_TEST_ASSERT(hdr_ptr[1] == 0x02); - UNIT_TEST_ASSERT(hdr_ptr[2] == 0xfe); - UNIT_TEST_ASSERT(hdr_ptr[3] == 0x6a); - UNIT_TEST_ASSERT(data_ptr[0] == 0xde); - UNIT_TEST_ASSERT(data_ptr[1] == 0xad); - UNIT_TEST_ASSERT(data_ptr[2] == 0xbe); - UNIT_TEST_ASSERT(data_ptr[3] == 0xef); - - /* No need to test returned because pkt is NULL */ - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_create_too_long_body, - "test sixp_pkt_create(too_long_body)"); -UNIT_TEST(test_create_too_long_body) -{ - /* - * - Version (4-bit) : 1 (valid version) - * - Type (2-bit) : 0 (request) - * - Reserved (2-bit): 0 - * - Code (8-bit) : 2 (delete) - * - SFID (8-bit) : 0xfe - * - SeqNum (8-bit) : 0x6a - * - Other Field : (4-octet payload) - */ - const uint8_t test_body[PACKETBUF_SIZE + 1]; - - UNIT_TEST_BEGIN(); - - packetbuf_clear(); - UNIT_TEST_ASSERT( - sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - 0xfe, 0x6a, - test_body, sizeof(test_body), NULL) == -1); - UNIT_TEST_ASSERT(packetbuf_hdrlen() == 0); - UNIT_TEST_ASSERT(packetbuf_datalen() == 0); - UNIT_TEST_ASSERT(packetbuf_totlen() == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_add_req, - "test sixp_pkt_{set,get}_total_num_cells(add_req)"); -UNIT_TEST(test_set_get_total_num_cells_add_req) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_delete_req, - "test sixp_pkt_{set,get}_total_num_cells(delete_req)"); -UNIT_TEST(test_set_get_total_num_cells_delete_req) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_relocate_req, - "test sixp_pkt_{set,get}_total_num_cells(relocate_req)"); -UNIT_TEST(test_set_get_total_num_cells_relocate_req) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, - buf, sizeof(buf)) == -1); - result = 0; - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_count_req, - "test sixp_pkt_{set,get}_total_num_cells(count_req)"); -UNIT_TEST(test_set_get_total_num_cells_count_req) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_list_req, - "test sixp_pkt_{set,get}_total_num_cells(list_req)"); -UNIT_TEST(test_set_get_total_num_cells_list_req) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_signal_req, - "test sixp_pkt_{set,get}_total_num_cells(signal_req)"); -UNIT_TEST(test_set_get_total_num_cells_signal_req) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_clear_req, - "test sixp_pkt_{set,get}_total_num_cells(clear_req)"); -UNIT_TEST(test_set_get_total_num_cells_clear_req) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_success_res, - "test sixp_pkt_{set,get}_total_num_cells(success_res)"); -UNIT_TEST(test_set_get_total_num_cells_success_res) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* Success Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == 0); - /* little endian */ - ref_data[0] = 0xfe; - ref_data[1] = 0xca; - printf("%x, %x\n", buf[0], buf[1]); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(result == testdata); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_success_conf, - "test sixp_pkt_{set,get}_total_num_cells(success_conf)"); -UNIT_TEST(test_set_get_total_num_cells_success_conf) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* Success Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_error_res, - "test sixp_pkt_{set,get}_total_num_cells(err_res)"); -UNIT_TEST(test_set_get_total_num_cells_error_res) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* Error Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_total_num_cells_error_conf, - "test sixp_pkt_{set,get}_total_num_cells(err_conf)"); -UNIT_TEST(test_set_get_total_num_cells_error_conf) -{ - sixp_pkt_total_num_cells_t testdata, result; - testdata = 0xcafe; - - UNIT_TEST_BEGIN(); - - /* Error Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_total_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - - result = 0; - UNIT_TEST_ASSERT( - sixp_pkt_get_total_num_cells(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - &result, - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(result == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_add_req, - "test sixp_pkt_{set,get}_payload(add_req)"); -UNIT_TEST(test_set_get_payload_add_req) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Add Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - testdata, sizeof(testdata), - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - result, sizeof(result), - buf, sizeof(buf)) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_delete_req, - "test sixp_pkt_{set,get}_payload(delete_req)"); -UNIT_TEST(test_set_get_payload_delete_req) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Delete Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - testdata, sizeof(testdata), - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE, - result, sizeof(result), - buf, sizeof(buf)) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_relocate_req, - "test sixp_pkt_{set,get}_payload(relocate_req)"); -UNIT_TEST(test_set_get_payload_relocate_req) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Relocate Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - testdata, sizeof(testdata), - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_RELOCATE, - result, sizeof(result), - buf, sizeof(buf)) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_count_req, - "test sixp_pkt_{set,get}_payload(count_req)"); -UNIT_TEST(test_set_get_payload_count_req) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Count Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - testdata, sizeof(testdata), - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_COUNT, - result, sizeof(result), - buf, sizeof(buf)) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_list_req, - "test sixp_pkt_{set,get}_payload(list_req)"); -UNIT_TEST(test_set_get_payload_list_req) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* List Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - testdata, sizeof(testdata), - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_LIST, - result, sizeof(result), - buf, sizeof(buf)) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_signal_req, - "test sixp_pkt_{set,get}_payload(signal_req)"); -UNIT_TEST(test_set_get_payload_signal_req) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Signal Request */ - memset(buf, 0, sizeof(buf)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - testdata, sizeof(testdata), - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(buf[2] == 0xAB); - UNIT_TEST_ASSERT(buf[3] == 0xCD); - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_SIGNAL, - result, sizeof(result), - buf, sizeof(sixp_pkt_metadata_t) + 2) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0xAB); - UNIT_TEST_ASSERT(p_result[1] == 0xCD); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_clear_req, - "test sixp_pkt_{set,get}_payload(clear_req)"); -UNIT_TEST(test_set_get_payload_clear_req) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Clear Request */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - testdata, sizeof(testdata), - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - result, sizeof(result), - buf, sizeof(buf)) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_success_res, - "test sixp_pkt_{set,get}_payload(success_res)"); -UNIT_TEST(test_set_get_payload_success_res) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Success Response */ - memset(buf, 0, sizeof(buf)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, sizeof(testdata), - buf, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(buf[0] == 0xAB); - UNIT_TEST_ASSERT(buf[1] == 0xCD); - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - result, sizeof(result), - buf, 2) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0xAB); - UNIT_TEST_ASSERT(p_result[1] == 0xCD); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_success_conf, - "test sixp_pkt_{set,get}_payload(success_conf)"); -UNIT_TEST(test_set_get_payload_success_conf) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Success Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - testdata, sizeof(testdata), - buf, sizeof(buf)) == 0); - ref_data[2] = 0xAB; - ref_data[3] = 0xCD; - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - result, sizeof(result), - buf, 2) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0xAB); - UNIT_TEST_ASSERT(p_result[1] == 0xCD); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_error_res, - "test sixp_pkt_{set,get}_payload(err_res)"); -UNIT_TEST(test_set_get_payload_error_res) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Error Response */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, sizeof(testdata), - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - result, sizeof(result), - buf, sizeof(buf)) == -1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_set_get_payload_error_conf, - "test sixp_pkt_{set,get}_payload(err_conf)"); -UNIT_TEST(test_set_get_payload_error_conf) -{ - uint8_t testdata[2], result[2]; - uint8_t *ptr = (uint8_t *)&testdata; - uint8_t *p_result = (uint8_t *)&result; - - ptr[0] = 0xAB; - ptr[1] = 0xCD; - - UNIT_TEST_BEGIN(); - - /* Error Confirmation */ - memset(buf, 0, sizeof(buf)); - memset(ref_data, 0, sizeof(ref_data)); - memset(&result, 0, sizeof(result)); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT(p_result[0] == 0x00); - UNIT_TEST_ASSERT(p_result[1] == 0x00); - UNIT_TEST_ASSERT( - sixp_pkt_set_payload(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - testdata, sizeof(testdata), - buf, sizeof(buf)) == -1); - UNIT_TEST_ASSERT(memcmp(buf, ref_data, sizeof(buf)) == 0); - UNIT_TEST_ASSERT( - sixp_pkt_get_payload(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_ERR, - result, sizeof(result), - buf, sizeof(buf)) == -1); - - UNIT_TEST_END(); -} - -PROCESS_THREAD(test_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("reference: draft-ietf-6tisch-6top-protocol-03"); - printf("Run unit-test\n"); - printf("---\n"); - - /* metadata */ - UNIT_TEST_RUN(test_set_get_metadata_add_req); - UNIT_TEST_RUN(test_set_get_metadata_delete_req); - UNIT_TEST_RUN(test_set_get_metadata_relocate_req); - UNIT_TEST_RUN(test_set_get_metadata_count_req); - UNIT_TEST_RUN(test_set_get_metadata_list_req); - UNIT_TEST_RUN(test_set_get_metadata_signal_req); - UNIT_TEST_RUN(test_set_get_metadata_clear_req); - UNIT_TEST_RUN(test_set_get_metadata_success_res); - UNIT_TEST_RUN(test_set_get_metadata_success_conf); - UNIT_TEST_RUN(test_set_get_metadata_error_res); - UNIT_TEST_RUN(test_set_get_metadata_error_conf); - - /* cell_options */ - UNIT_TEST_RUN(test_set_get_cell_options_add_req); - UNIT_TEST_RUN(test_set_get_cell_options_delete_req); - UNIT_TEST_RUN(test_set_get_cell_options_relocate_req); - UNIT_TEST_RUN(test_set_get_cell_options_count_req); - UNIT_TEST_RUN(test_set_get_cell_options_list_req); - UNIT_TEST_RUN(test_set_get_cell_options_signal_req); - UNIT_TEST_RUN(test_set_get_cell_options_clear_req); - UNIT_TEST_RUN(test_set_get_cell_options_success_res); - UNIT_TEST_RUN(test_set_get_cell_options_success_conf); - UNIT_TEST_RUN(test_set_get_cell_options_error_res); - UNIT_TEST_RUN(test_set_get_cell_options_error_conf); - - /* num_cells */ - UNIT_TEST_RUN(test_set_get_num_cells_add_req); - UNIT_TEST_RUN(test_set_get_num_cells_delete_req); - UNIT_TEST_RUN(test_set_get_num_cells_relocate_req); - UNIT_TEST_RUN(test_set_get_num_cells_count_req); - UNIT_TEST_RUN(test_set_get_num_cells_list_req); - UNIT_TEST_RUN(test_set_get_num_cells_signal_req); - UNIT_TEST_RUN(test_set_get_num_cells_clear_req); - UNIT_TEST_RUN(test_set_get_num_cells_success_res); - UNIT_TEST_RUN(test_set_get_num_cells_success_conf); - UNIT_TEST_RUN(test_set_get_num_cells_error_res); - UNIT_TEST_RUN(test_set_get_num_cells_error_conf); - - /* reserved */ - UNIT_TEST_RUN(test_set_get_reserved_add_req); - UNIT_TEST_RUN(test_set_get_reserved_delete_req); - UNIT_TEST_RUN(test_set_get_reserved_relocate_req); - UNIT_TEST_RUN(test_set_get_reserved_count_req); - UNIT_TEST_RUN(test_set_get_reserved_list_req); - UNIT_TEST_RUN(test_set_get_reserved_signal_req); - UNIT_TEST_RUN(test_set_get_reserved_clear_req); - UNIT_TEST_RUN(test_set_get_reserved_success_res); - UNIT_TEST_RUN(test_set_get_reserved_success_conf); - UNIT_TEST_RUN(test_set_get_reserved_error_res); - UNIT_TEST_RUN(test_set_get_reserved_error_conf); - - /* offset */ - UNIT_TEST_RUN(test_set_get_offset_add_req); - UNIT_TEST_RUN(test_set_get_offset_delete_req); - UNIT_TEST_RUN(test_set_get_offset_relocate_req); - UNIT_TEST_RUN(test_set_get_offset_count_req); - UNIT_TEST_RUN(test_set_get_offset_list_req); - UNIT_TEST_RUN(test_set_get_offset_signal_req); - UNIT_TEST_RUN(test_set_get_offset_clear_req); - UNIT_TEST_RUN(test_set_get_offset_success_res); - UNIT_TEST_RUN(test_set_get_offset_success_conf); - UNIT_TEST_RUN(test_set_get_offset_error_res); - UNIT_TEST_RUN(test_set_get_offset_error_conf); - - /* offset */ - UNIT_TEST_RUN(test_set_get_max_num_cells_add_req); - UNIT_TEST_RUN(test_set_get_max_num_cells_delete_req); - UNIT_TEST_RUN(test_set_get_max_num_cells_relocate_req); - UNIT_TEST_RUN(test_set_get_max_num_cells_count_req); - UNIT_TEST_RUN(test_set_get_max_num_cells_list_req); - UNIT_TEST_RUN(test_set_get_max_num_cells_signal_req); - UNIT_TEST_RUN(test_set_get_max_num_cells_clear_req); - UNIT_TEST_RUN(test_set_get_max_num_cells_success_res); - UNIT_TEST_RUN(test_set_get_max_num_cells_success_conf); - UNIT_TEST_RUN(test_set_get_max_num_cells_error_res); - UNIT_TEST_RUN(test_set_get_max_num_cells_error_conf); - - /* cell_list */ - UNIT_TEST_RUN(test_set_get_cell_list_add_req); - UNIT_TEST_RUN(test_set_get_cell_list_delete_req); - UNIT_TEST_RUN(test_set_get_cell_list_relocate_req); - UNIT_TEST_RUN(test_set_get_cell_list_count_req); - UNIT_TEST_RUN(test_set_get_cell_list_list_req); - UNIT_TEST_RUN(test_set_get_cell_list_signal_req); - UNIT_TEST_RUN(test_set_get_cell_list_clear_req); - UNIT_TEST_RUN(test_set_get_cell_list_success_res); - UNIT_TEST_RUN(test_set_get_cell_list_success_conf); - UNIT_TEST_RUN(test_set_get_cell_list_error_res); - UNIT_TEST_RUN(test_set_get_cell_list_error_conf); - - /* rel_cell_list */ - UNIT_TEST_RUN(test_set_get_rel_cell_list_add_req); - UNIT_TEST_RUN(test_set_get_rel_cell_list_delete_req); - UNIT_TEST_RUN(test_set_get_rel_cell_list_relocate_req); - UNIT_TEST_RUN(test_set_get_rel_cell_list_count_req); - UNIT_TEST_RUN(test_set_get_rel_cell_list_list_req); - UNIT_TEST_RUN(test_set_get_rel_cell_list_signal_req); - UNIT_TEST_RUN(test_set_get_rel_cell_list_clear_req); - UNIT_TEST_RUN(test_set_get_rel_cell_list_success_res); - UNIT_TEST_RUN(test_set_get_rel_cell_list_success_conf); - UNIT_TEST_RUN(test_set_get_rel_cell_list_error_res); - UNIT_TEST_RUN(test_set_get_rel_cell_list_error_conf); - - /* cand_cell_list */ - UNIT_TEST_RUN(test_set_get_cand_cell_list_add_req); - UNIT_TEST_RUN(test_set_get_cand_cell_list_delete_req); - UNIT_TEST_RUN(test_set_get_cand_cell_list_relocate_req); - UNIT_TEST_RUN(test_set_get_cand_cell_list_count_req); - UNIT_TEST_RUN(test_set_get_cand_cell_list_list_req); - UNIT_TEST_RUN(test_set_get_cand_cell_list_signal_req); - UNIT_TEST_RUN(test_set_get_cand_cell_list_clear_req); - UNIT_TEST_RUN(test_set_get_cand_cell_list_success_res); - UNIT_TEST_RUN(test_set_get_cand_cell_list_success_conf); - UNIT_TEST_RUN(test_set_get_cand_cell_list_error_res); - UNIT_TEST_RUN(test_set_get_cand_cell_list_error_conf); - - /* total_num_cells */ - UNIT_TEST_RUN(test_set_get_total_num_cells_add_req); - UNIT_TEST_RUN(test_set_get_total_num_cells_delete_req); - UNIT_TEST_RUN(test_set_get_total_num_cells_relocate_req); - UNIT_TEST_RUN(test_set_get_total_num_cells_count_req); - UNIT_TEST_RUN(test_set_get_total_num_cells_list_req); - UNIT_TEST_RUN(test_set_get_total_num_cells_signal_req); - UNIT_TEST_RUN(test_set_get_total_num_cells_clear_req); - UNIT_TEST_RUN(test_set_get_total_num_cells_success_res); - UNIT_TEST_RUN(test_set_get_total_num_cells_success_conf); - UNIT_TEST_RUN(test_set_get_total_num_cells_error_res); - UNIT_TEST_RUN(test_set_get_total_num_cells_error_conf); - - /* payload */ - UNIT_TEST_RUN(test_set_get_payload_add_req); - UNIT_TEST_RUN(test_set_get_payload_delete_req); - UNIT_TEST_RUN(test_set_get_payload_relocate_req); - UNIT_TEST_RUN(test_set_get_payload_count_req); - UNIT_TEST_RUN(test_set_get_payload_list_req); - UNIT_TEST_RUN(test_set_get_payload_signal_req); - UNIT_TEST_RUN(test_set_get_payload_clear_req); - UNIT_TEST_RUN(test_set_get_payload_success_res); - UNIT_TEST_RUN(test_set_get_payload_success_conf); - UNIT_TEST_RUN(test_set_get_payload_error_res); - UNIT_TEST_RUN(test_set_get_payload_error_conf); - - /* parse */ - UNIT_TEST_RUN(test_parse_valid_version); - UNIT_TEST_RUN(test_parse_invalid_version); - UNIT_TEST_RUN(test_parse_invalid_length); - UNIT_TEST_RUN(test_parse_invalid_cmd); - UNIT_TEST_RUN(test_parse_invalid_rc); - UNIT_TEST_RUN(test_parse_invalid_type); - - /* create */ - UNIT_TEST_RUN(test_create_valid_packet); - UNIT_TEST_RUN(test_create_valid_packet_with_null_pkt); - UNIT_TEST_RUN(test_create_too_long_body); - - printf("=check-me= DONE\n"); - PROCESS_END(); -} diff --git a/tests/13-ieee802154/code-6tisch/test-sixp-trans.c b/tests/13-ieee802154/code-6tisch/test-sixp-trans.c deleted file mode 100644 index 76afd3b7e..000000000 --- a/tests/13-ieee802154/code-6tisch/test-sixp-trans.c +++ /dev/null @@ -1,1205 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 STEP OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" -#include "lib/assert.h" - -#include "net/packetbuf.h" -#include "net/mac/tsch/tsch.h" -#include "net/mac/tsch/sixtop/sixtop.h" -#include "net/mac/tsch/sixtop/sixp-nbr.h" -#include "net/mac/tsch/sixtop/sixp-trans.h" - -#include "unit-test/unit-test.h" -#include "common.h" - -#define TEST_SF_SFID 0xfe -#define TEST_SF_TIMEOUT_VALUE (5 * CLOCK_SECOND) - -static void test_setup(void); -static void timeout_handler(sixp_pkt_cmd_t cmd, const linkaddr_t *peer_addr); -static void sent_callback(void *arg, uint16_t arg_len, - const linkaddr_t *dest_addr, - sixp_output_status_t status); -static uint8_t timeout_handler_is_called; -static uint8_t sent_callback_is_called; - - -PROCESS(test_process, "6P transaction APIs test"); -AUTOSTART_PROCESSES(&test_process); - -static const sixtop_sf_t test_sf = { - TEST_SF_SFID, - TEST_SF_TIMEOUT_VALUE, - NULL, - NULL, - timeout_handler -}; - -static void -test_setup(void) -{ - sixtop_init(); - assert(sixtop_add_sf(&test_sf) == 0); - timeout_handler_is_called = 0; - sent_callback_is_called = 0; -} - -static void -timeout_handler(sixp_pkt_cmd_t cmd, const linkaddr_t *peer_addr) -{ - timeout_handler_is_called = 1; -} - -static void -sent_callback(void *arg, uint16_t arg_len, const linkaddr_t *dest_addr, - sixp_output_status_t status) -{ - sent_callback_is_called = 1; -} - -UNIT_TEST_REGISTER(test_alloc_2_step_trans, - "test sixp_trans_alloc(2_step_transaction)"); -UNIT_TEST(test_alloc_2_step_trans) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 10; - pkt.body = req_body; - pkt.body_len = 8; /* Metadata, CellOptions, NumCells, and CellList */ - peer_addr.u8[0] = 0; - - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_trans_get_cmd(trans) == SIXP_PKT_CMD_ADD); - UNIT_TEST_ASSERT(sixp_trans_get_seqno(trans) == 10); - UNIT_TEST_ASSERT(sixp_trans_get_mode(trans) == SIXP_TRANS_MODE_2_STEP); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - /* allocate a transaction for the clear request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR; - pkt.seqno = 0; - pkt.body = req_body; - pkt.body_len = 2; /* only Metadata */ - peer_addr.u8[0] = 1; - - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_trans_get_seqno(trans) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_cmd(trans) == SIXP_PKT_CMD_CLEAR); - UNIT_TEST_ASSERT(sixp_trans_get_mode(trans) == SIXP_TRANS_MODE_2_STEP); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_alloc_3_step_trans, - "test sixp_trans_alloc(3_step_transaction)"); -UNIT_TEST(test_alloc_3_step_trans) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 7; - pkt.body = req_body; - pkt.body_len = 4; /* Metadata, CellOptions, NumCells */ - peer_addr.u8[0] = 0; - - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_trans_get_seqno(trans) == 7); - UNIT_TEST_ASSERT(sixp_trans_get_cmd(trans) == SIXP_PKT_CMD_ADD); - UNIT_TEST_ASSERT(sixp_trans_get_mode(trans) == SIXP_TRANS_MODE_3_STEP); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE; - pkt.seqno = 5; - pkt.body = req_body; - pkt.body_len = 4; /* Metadata, CellOptions, NumCells */ - peer_addr.u8[0] = 1; - - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_trans_get_seqno(trans) == 5); - UNIT_TEST_ASSERT(sixp_trans_get_cmd(trans) == SIXP_PKT_CMD_DELETE); - UNIT_TEST_ASSERT(sixp_trans_get_mode(trans) == SIXP_TRANS_MODE_3_STEP); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_alloc_duplicate_peer, - "test sixp_trans_alloc(duplicate_peer)"); -UNIT_TEST(test_alloc_duplicate_peer) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 7; - pkt.body = req_body; - pkt.body_len = 4; /* Metadata, CellOptions, NumCells */ - peer_addr.u8[0] = 0; - - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_trans_get_seqno(trans) == 7); - UNIT_TEST_ASSERT(sixp_trans_get_cmd(trans) == SIXP_PKT_CMD_ADD); - UNIT_TEST_ASSERT(sixp_trans_get_mode(trans) == SIXP_TRANS_MODE_3_STEP); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_DELETE; - pkt.seqno = 5; - pkt.body = req_body; - pkt.body_len = 4; /* Metadata, CellOptions, NumCells */ - peer_addr.u8[0] = 0; /* the same address used above to allocate a trans */ - - /* a new transaction should not be allocated */ - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) == NULL); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_alloc_lack_of_memory, - "test sixp_trans_alloc(lack_of_memory)"); -UNIT_TEST(test_alloc_lack_of_memory) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - uint8_t req_body[8]; - - /* SIXTOP_CONF_MAX_TRANSACTIONS is set with 2; see project-conf.h */ - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 7; - pkt.body = req_body; - pkt.body_len = 4; /* Metadata, CellOptions, NumCells */ - - peer_addr.u8[0] = 0; - UNIT_TEST_ASSERT(sixp_trans_alloc(&pkt, &peer_addr) != NULL); - - peer_addr.u8[0] = 1; - UNIT_TEST_ASSERT(sixp_trans_alloc(&pkt, &peer_addr) != NULL); - - /* allocation should fail because of lack of memory */ - peer_addr.u8[0] = 2; - UNIT_TEST_ASSERT(sixp_trans_alloc(&pkt, &peer_addr) == NULL); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_alloc_null_pkt, - "test sixp_trans_alloc(null_pkt)"); -UNIT_TEST(test_alloc_null_pkt) -{ - linkaddr_t peer_addr; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - peer_addr.u8[0] = 0; - /* allocation should fail because of NULL specified as the 1st arg */ - UNIT_TEST_ASSERT(sixp_trans_alloc(NULL, &peer_addr) == NULL); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_alloc_null_peer_addr, - "test sixp_trans_alloc(null_peer_addr)"); -UNIT_TEST(test_alloc_null_peer_addr) -{ - sixp_pkt_t pkt; - uint8_t req_body[8]; - - /* SIXTOP_CONF_6P_MAX_TRANSACTIONS is set with 2; see project-conf.h */ - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 7; - pkt.body = req_body; - pkt.body_len = 4; /* Metadata, CellOptions, NumCells */ - - /* allocation should fail because of NULL specified as the 2nd arg */ - UNIT_TEST_ASSERT(sixp_trans_alloc(&pkt, NULL) == NULL); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_find, - "test sixp_trans_find()"); -UNIT_TEST(test_find) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans, *returned_trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR; - pkt.seqno = 7; - pkt.body = req_body; - pkt.body_len = 2; /* Metadata */ - peer_addr.u8[0] = 0; - - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - - /* find the trans */ - UNIT_TEST_ASSERT((returned_trans = sixp_trans_find(&peer_addr)) == trans); - - /* no trans by another peer_addr */ - peer_addr.u8[0] = 1; - UNIT_TEST_ASSERT(sixp_trans_find(&peer_addr) == NULL); - - /* no trans by null peer_addr */ - UNIT_TEST_ASSERT(sixp_trans_find(NULL) == NULL); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_callback, - "test sixp_trans_{set,invoke}_callback()"); -UNIT_TEST(test_callback) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR; - pkt.seqno = 7; - pkt.body = req_body; - pkt.body_len = 2; /* Metadata */ - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - - UNIT_TEST_ASSERT(sent_callback_is_called == 0); - sixp_trans_invoke_callback(trans, SIXP_OUTPUT_STATUS_SUCCESS); - UNIT_TEST_ASSERT(sent_callback_is_called == 0); - - sixp_trans_set_callback(trans, sent_callback, NULL, 0); - sixp_trans_invoke_callback(trans, SIXP_OUTPUT_STATUS_SUCCESS); - UNIT_TEST_ASSERT(sent_callback_is_called == 1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_state_transition_2_step_initiator, - "test sixp_trans_{transit,get}_state(2-step-initiator)"); -UNIT_TEST(test_state_transition_2_step_initiator) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 10; - pkt.body = req_body; - pkt.body_len = 8; /* Metadata, CellOptions, NumCells, and CellList */ - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_REQUEST_SENT) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_REQUEST_SENT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_RESPONSE_RECEIVED) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_RESPONSE_RECEIVED); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_TERMINATING) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_TERMINATING); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_state_transition_2_step_responder, - "test sixp_trans_{transit,get}_state(2-step-responder)"); -UNIT_TEST(test_state_transition_2_step_responder) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 10; - pkt.body = req_body; - pkt.body_len = 8; /* Metadata, CellOptions, NumCells, and CellList */ - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_REQUEST_RECEIVED) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_REQUEST_RECEIVED); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_RESPONSE_SENT) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_RESPONSE_SENT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_TERMINATING) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_TERMINATING); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_state_transition_3_step_initiator, - "test sixp_trans_{transit,get}_state(3-step-initiator)"); -UNIT_TEST(test_state_transition_3_step_initiator) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 10; - pkt.body = req_body; - pkt.body_len = 4; /* Metadata, CellOptions, and NumCells */ - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - UNIT_TEST_ASSERT(sixp_trans_get_mode(trans) == SIXP_TRANS_MODE_3_STEP); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_REQUEST_SENT) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_REQUEST_SENT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_RESPONSE_RECEIVED) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_RESPONSE_RECEIVED); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_CONFIRMATION_SENT) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_CONFIRMATION_SENT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_TERMINATING) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_TERMINATING); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_state_transition_3_step_responder, - "test sixp_trans_{transit,get}_state(3-step-responder)"); -UNIT_TEST(test_state_transition_3_step_responder) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 10; - pkt.body = req_body; - pkt.body_len = 4; /* Metadata, CellOptions, and NumCells */ - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - UNIT_TEST_ASSERT(sixp_trans_get_mode(trans) == SIXP_TRANS_MODE_3_STEP); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_REQUEST_RECEIVED) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_REQUEST_RECEIVED); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_RESPONSE_SENT) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_RESPONSE_SENT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_TERMINATING) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_TERMINATING); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_state_transition_invalid_transition_initiator, - "test sixp_trans_{transit,get}_state(invalid_transition_i)"); -UNIT_TEST(test_state_transition_invalid_transition_initiator) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 10; - pkt.body = req_body; - pkt.body_len = 4; /* Metadata, CellOptions, and NumCells */ - /* 3-step */ - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - - /* from INIT */ - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_UNAVAILABLE) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_INIT) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_RECEIVED) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_SENT) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - /* from REQUEST_SENT */ - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_SENT) == 0); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_UNAVAILABLE) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_INIT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_SENT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_SENT); - - /* from RESPONSE_RECEIVE */ - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_RECEIVED) == 0); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_UNAVAILABLE) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_INIT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_RECEIVED); - - /* from CONFIRMATION_SENT */ - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_SENT) == 0); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_UNAVAILABLE) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_INIT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_SENT); - - pkt.body_len = 8; /* Metadata, CellOptions, and NumCells CellList */ - peer_addr.u8[0] = 1; - /* 2-step */ - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_SENT) == 0); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_RECEIVED) == 0); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_TERMINATING) == 0); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_TERMINATING); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_state_transition_invalid_transition_responder, - "test sixp_trans_{transit,get}_state(invalid_transition_r)"); -UNIT_TEST(test_state_transition_invalid_transition_responder) -{ - sixp_pkt_t pkt; - linkaddr_t peer_addr; - sixp_trans_t *trans; - uint8_t req_body[8]; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* allocate a transaction for the add request */ - memset(&pkt, 0, sizeof(pkt)); - memset(&peer_addr, 0, sizeof(peer_addr)); - memset(req_body, 0, sizeof(req_body)); - - pkt.sfid = TEST_SF_SFID; - pkt.type = SIXP_PKT_TYPE_REQUEST; - pkt.code = (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD; - pkt.seqno = 10; - pkt.body = req_body; - pkt.body_len = 4; /* Metadata, CellOptions, and NumCells CellList */ - /* 3-step */ - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - - /* from INIT */ - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_UNAVAILABLE) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_INIT) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_RECEIVED) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_SENT) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - /* from REQUEST_RECEIVED */ - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_RECEIVED) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_REQUEST_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_UNAVAILABLE) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_REQUEST_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_INIT) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_REQUEST_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_RECEIVED); - - /* from RESPONSE_SENT */ - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) == 0); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_RESPONSE_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_UNAVAILABLE) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_RESPONSE_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_INIT) == -1); - UNIT_TEST_ASSERT(sixp_trans_get_state(trans) == - SIXP_TRANS_STATE_RESPONSE_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_SENT); - - /* from CONFIRMATION_RECEIVED */ - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) == 0); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_UNAVAILABLE) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_INIT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_SENT) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_CONFIRMATION_RECEIVED); - - pkt.body_len = 8; /* Metadata, CellOptions, and NumCells CellList */ - peer_addr.u8[0] = 1; - /* 2-step */ - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_INIT); - - UNIT_TEST_ASSERT(sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_RECEIVED) == 0); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_REQUEST_RECEIVED); - - UNIT_TEST_ASSERT(sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) == 0); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_RECEIVED) == -1); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_RESPONSE_SENT); - - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_TERMINATING) == 0); - UNIT_TEST_ASSERT( - sixp_trans_get_state(trans) == SIXP_TRANS_STATE_TERMINATING); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_next_seqno_increment_on_request_sent, - "test next_seqno is incremented on request_sent"); -UNIT_TEST(test_next_seqno_increment_on_request_sent) -{ - linkaddr_t peer_addr; - sixp_nbr_t *nbr; - sixp_trans_t *trans; - - UNIT_TEST_BEGIN(); - - test_setup(); - - peer_addr.u8[0] = 1; - - UNIT_TEST_ASSERT((nbr = sixp_nbr_alloc(&peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_nbr_set_next_seqno(nbr, 10) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 10); - - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, NULL, 0, &peer_addr, - NULL, NULL, 0) == 0); - /* next_seqno must not be changed by sixp_output() */ - UNIT_TEST_ASSERT((trans = sixp_trans_find(&peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 10); - UNIT_TEST_ASSERT(sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_SENT) - == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 11); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_next_seqno_increment_on_response_sent, - "test next_seqno is incremented on response_sent"); -UNIT_TEST(test_next_seqno_increment_on_response_sent) -{ - linkaddr_t peer_addr; - sixp_nbr_t *nbr; - sixp_trans_t *trans; - uint32_t body; - - UNIT_TEST_BEGIN(); - - test_setup(); - - peer_addr.u8[0] = 1; - UNIT_TEST_ASSERT((nbr = sixp_nbr_alloc(&peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_nbr_set_next_seqno(nbr, 100) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 100); - - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), NULL) - == 0); - - UNIT_TEST_ASSERT((trans = sixp_trans_find(&peer_addr)) == NULL); - sixp_input(packetbuf_hdrptr(), packetbuf_totlen(), &peer_addr); - UNIT_TEST_ASSERT((trans = sixp_trans_find(&peer_addr)) != NULL); - /* next_seqno must not be changed yet */ - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 100); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, NULL, 0, &peer_addr, - NULL, NULL, 0) == 0); - UNIT_TEST_ASSERT(sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) - == 0); - /* - * next_seqno is overridden by the seqno of the request and - * incremented by 1 - */ - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 11); - - UNIT_TEST_END(); -} - -PROCESS_THREAD(test_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - - /* wait until the sixtop module gets ready */ - etimer_set(&et, CLOCK_SECOND); - tschmac_driver.init(); - tschmac_driver.on(); - tsch_set_coordinator(1); - while(tsch_is_associated == 0) { - PROCESS_YIELD_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - } - - printf("Run unit-test\n"); - printf("---\n"); - - /* sixp_trans_alloc() */ - UNIT_TEST_RUN(test_alloc_2_step_trans); - UNIT_TEST_RUN(test_alloc_3_step_trans); - UNIT_TEST_RUN(test_alloc_duplicate_peer); - UNIT_TEST_RUN(test_alloc_lack_of_memory); - UNIT_TEST_RUN(test_alloc_null_pkt); - UNIT_TEST_RUN(test_alloc_null_peer_addr); - - /* sixp_trans_find() */ - UNIT_TEST_RUN(test_find); - - /* sixp_set_callback() & sixp_invoke_callback() */ - UNIT_TEST_RUN(test_callback); - - /* sixp_trans_transit_state() and sixp_trans_get_state() */ - UNIT_TEST_RUN(test_state_transition_2_step_initiator); - UNIT_TEST_RUN(test_state_transition_2_step_responder); - UNIT_TEST_RUN(test_state_transition_3_step_initiator); - UNIT_TEST_RUN(test_state_transition_3_step_responder); - UNIT_TEST_RUN(test_state_transition_invalid_transition_initiator); - UNIT_TEST_RUN(test_state_transition_invalid_transition_responder); - - /* seqno management*/ - UNIT_TEST_RUN(test_next_seqno_increment_on_request_sent); - UNIT_TEST_RUN(test_next_seqno_increment_on_response_sent); - - printf("=check-me= DONE\n"); - PROCESS_END(); -} diff --git a/tests/13-ieee802154/code-6tisch/test-sixp.c b/tests/13-ieee802154/code-6tisch/test-sixp.c deleted file mode 100644 index 91ad3283f..000000000 --- a/tests/13-ieee802154/code-6tisch/test-sixp.c +++ /dev/null @@ -1,761 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 - -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" -#include "lib/assert.h" - -#include "net/packetbuf.h" -#include "net/mac/tsch/tsch.h" -#include "net/mac/tsch/sixtop/sixtop.h" -#include "net/mac/tsch/sixtop/sixp.h" -#include "net/mac/tsch/sixtop/sixp-nbr.h" -#include "net/mac/tsch/sixtop/sixp-trans.h" - -#include "unit-test/unit-test.h" -#include "common.h" - -#define UNKNOWN_SF_SFID 0 -#define TEST_SF_SFID 0xf1 - -static linkaddr_t peer_addr; -static uint8_t test_sf_input_is_called = 0; - -static void -input(sixp_pkt_type_t type,sixp_pkt_code_t code, const uint8_t *body, - uint16_t body_len, const linkaddr_t *peer_addr) -{ - test_sf_input_is_called = 1; -} - -static const sixtop_sf_t test_sf = { - TEST_SF_SFID, - 0, - NULL, - input, - NULL -}; - -PROCESS(test_process, "6top protocol APIs test"); -AUTOSTART_PROCESSES(&test_process); - -static void -test_setup(void) -{ - test_mac_driver.init(); - sixtop_init(); - packetbuf_clear(); - memset(&peer_addr, 0, sizeof(peer_addr)); - sixtop_add_sf(&test_sf); - test_sf_input_is_called = 0; -} - -UNIT_TEST_REGISTER(test_input_no_sf, - "sixp_input(no_sf)"); -UNIT_TEST(test_input_no_sf) -{ - uint32_t body; - uint8_t *p; - - UNIT_TEST_BEGIN(); - test_setup(); - - memset(&body, 0, sizeof(body)); - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - UNKNOWN_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), - NULL) == 0); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - sixp_input(packetbuf_hdrptr(), packetbuf_totlen(), &peer_addr); - - p = packetbuf_hdrptr(); - - /* length */ - UNIT_TEST_ASSERT(packetbuf_totlen() == 11); - - /* Termination 1 IE */ - UNIT_TEST_ASSERT(p[0] == 0x00); - UNIT_TEST_ASSERT(p[1] == 0x3f); - - /* IETF IE */ - UNIT_TEST_ASSERT(p[2] == 0x05); - UNIT_TEST_ASSERT(p[3] == 0xa8); - - /* 6top IE */ - UNIT_TEST_ASSERT(p[4] == 0xc9); - UNIT_TEST_ASSERT(p[5] == 0x10); - UNIT_TEST_ASSERT(p[6] == 0x05); - UNIT_TEST_ASSERT(p[7] == UNKNOWN_SF_SFID); - UNIT_TEST_ASSERT(p[8] == 0x0a); - - /* Payload Termination IE */ - UNIT_TEST_ASSERT(p[9] == 0x00); - UNIT_TEST_ASSERT(p[10] == 0xf8); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 1); - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_input_busy, - "sixp_input(busy)"); -UNIT_TEST(test_input_busy) -{ - uint8_t *p; - uint32_t body; - - UNIT_TEST_BEGIN(); - test_setup(); - - /* send a request to the peer first */ - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_trans_find(&peer_addr) == NULL); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - TEST_SF_SFID, NULL, 0, &peer_addr, - NULL, NULL, 0) == 0); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 1); - UNIT_TEST_ASSERT(sixp_trans_find(&peer_addr) != NULL); - - test_mac_driver.init(); /* clear test_mac_send_is_called status */ - - memset(&body, 0, sizeof(body)); - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), - NULL) == 0); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - sixp_input(packetbuf_hdrptr(), packetbuf_totlen(), &peer_addr); - - p = packetbuf_hdrptr(); - - /* length */ - UNIT_TEST_ASSERT(packetbuf_totlen() == 11); - - /* Termination 1 IE */ - UNIT_TEST_ASSERT(p[0] == 0x00); - UNIT_TEST_ASSERT(p[1] == 0x3f); - - /* IETF IE */ - UNIT_TEST_ASSERT(p[2] == 0x05); - UNIT_TEST_ASSERT(p[3] == 0xa8); - - /* 6top IE */ - UNIT_TEST_ASSERT(p[4] == 0xc9); - UNIT_TEST_ASSERT(p[5] == 0x10); - UNIT_TEST_ASSERT(p[6] == 0x08); - UNIT_TEST_ASSERT(p[7] == TEST_SF_SFID); - UNIT_TEST_ASSERT(p[8] == 0x0a); - - /* Payload Termination IE */ - UNIT_TEST_ASSERT(p[9] == 0x00); - UNIT_TEST_ASSERT(p[10] == 0xf8); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 1); - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_input_no_memory, - "sixp_input(no_memory)"); -UNIT_TEST(test_input_no_memory) -{ - uint32_t body; - sixp_pkt_t pkt; - uint8_t *p; - linkaddr_t addr; - - UNIT_TEST_BEGIN(); - test_setup(); - - memset(&body, 0, sizeof(body)); - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), - &pkt) == 0); - memset(&addr, 0, sizeof(addr)); - addr.u8[0] = 1; - UNIT_TEST_ASSERT(sixp_trans_alloc(&pkt, &addr) != NULL); - addr.u8[0] = 2; - UNIT_TEST_ASSERT(sixp_trans_alloc(&pkt, &addr) != NULL); - addr.u8[0] = 3; - /* no memory left for another transaction */ - UNIT_TEST_ASSERT(sixp_trans_alloc(&pkt, &addr) == NULL); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - sixp_input(packetbuf_hdrptr(), packetbuf_totlen(), &peer_addr); - - p = packetbuf_hdrptr(); - - /* length */ - UNIT_TEST_ASSERT(packetbuf_totlen() == 11); - - /* Termination 1 IE */ - UNIT_TEST_ASSERT(p[0] == 0x00); - UNIT_TEST_ASSERT(p[1] == 0x3f); - - /* IETF IE */ - UNIT_TEST_ASSERT(p[2] == 0x05); - UNIT_TEST_ASSERT(p[3] == 0xa8); - - /* 6top IE */ - UNIT_TEST_ASSERT(p[4] == 0xc9); - UNIT_TEST_ASSERT(p[5] == 0x10); - UNIT_TEST_ASSERT(p[6] == 0x08); - UNIT_TEST_ASSERT(p[7] == TEST_SF_SFID); - UNIT_TEST_ASSERT(p[8] == 0x0a); - - /* Payload Termination IE */ - UNIT_TEST_ASSERT(p[9] == 0x00); - UNIT_TEST_ASSERT(p[10] == 0xf8); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 1); - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output_request_1, - "sixp_output(request_1)"); -UNIT_TEST(test_output_request_1) -{ - sixp_pkt_t pkt; - sixp_trans_t *trans; - uint32_t body; - - UNIT_TEST_BEGIN(); - - test_setup(); - memset(&body, 0, sizeof(body)); - - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), - &pkt) == 0); - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - memset(&body, 0, sizeof(body)); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, (uint8_t *)&body, sizeof(body), - &peer_addr, NULL, NULL, 0) == -1); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output_request_2, - "sixp_output(request_2)"); -UNIT_TEST(test_output_request_2) -{ - uint32_t body; - UNIT_TEST_BEGIN(); - - test_setup(); - memset(&body, 0, sizeof(body)); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, (uint8_t *)&body, sizeof(body), - &peer_addr, NULL, NULL, 0) == 0); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output_response_1, - "sixp_output(response_1)"); -UNIT_TEST(test_output_response_1) -{ - UNIT_TEST_BEGIN(); - test_setup(); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, NULL, 0, - &peer_addr, NULL, NULL, 0) == -1); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output_response_2, - "sixp_output(response_2)"); -UNIT_TEST(test_output_response_2) -{ - sixp_pkt_t pkt; - sixp_trans_t *trans; - uint32_t body; - - UNIT_TEST_BEGIN(); - test_setup(); - - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), - &pkt) == 0); - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, NULL, 0, - &peer_addr, NULL, NULL, 0) == -1); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output_response_3, - "sixp_output(response_3)"); -UNIT_TEST(test_output_response_3) -{ - sixp_pkt_t pkt; - sixp_trans_t *trans; - uint32_t body; - - UNIT_TEST_BEGIN(); - test_setup(); - - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), - &pkt) == 0); - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_REQUEST_RECEIVED) == 0); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, NULL, 0, - &peer_addr, NULL, NULL, 0) == 0); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output_response_4, - "sixp_output(response_4)"); -UNIT_TEST(test_output_response_4) -{ - sixp_pkt_t pkt; - sixp_trans_t *trans; - uint32_t body; - - UNIT_TEST_BEGIN(); - test_setup(); - - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), - &pkt) == 0); - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_REQUEST_SENT) == 0); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_RESPONSE_RECEIVED) == 0); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_RESPONSE, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, NULL, 0, - &peer_addr, NULL, NULL, 0) == -1); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output_confirmation_1, - "sixp_output(confirmation_1)"); -UNIT_TEST(test_output_confirmation_1) -{ - UNIT_TEST_BEGIN(); - test_setup(); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, NULL, 0, - &peer_addr, NULL, NULL, 0) == -1); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output_confirmation_2, - "sixp_output(confirmation_2)"); -UNIT_TEST(test_output_confirmation_2) -{ - sixp_pkt_t pkt; - sixp_trans_t *trans; - uint32_t body; - - UNIT_TEST_BEGIN(); - test_setup(); - - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), - &pkt) == 0); - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, NULL, 0, - &peer_addr, NULL, NULL, 0) == -1); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output_confirmation_3, - "sixp_output(confirmation_3)"); -UNIT_TEST(test_output_confirmation_3) -{ - sixp_pkt_t pkt; - sixp_trans_t *trans; - uint32_t body; - - UNIT_TEST_BEGIN(); - test_setup(); - - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), - &pkt) == 0); - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_REQUEST_SENT) == 0); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_RESPONSE_RECEIVED) == 0); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, NULL, 0, - &peer_addr, NULL, NULL, 0) == 0); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 1); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output_confirmation_4, - "sixp_output(confirmation_4)"); -UNIT_TEST(test_output_confirmation_4) -{ - sixp_pkt_t pkt; - sixp_trans_t *trans; - uint32_t body; - - UNIT_TEST_BEGIN(); - test_setup(); - - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, sizeof(body), - &pkt) == 0); - UNIT_TEST_ASSERT((trans = sixp_trans_alloc(&pkt, &peer_addr)) != NULL); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_REQUEST_SENT) == 0); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, SIXP_TRANS_STATE_RESPONSE_RECEIVED) == 0); - UNIT_TEST_ASSERT( - sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_CONFIRMATION_SENT) == 0); - - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_CONFIRMATION, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_RC_SUCCESS, - TEST_SF_SFID, NULL, 0, - &peer_addr, NULL, NULL, 0) == -1); - UNIT_TEST_ASSERT(test_mac_send_function_is_called() == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_next_seqno_reset_by_clear_request_1, - "test if next_seqno is reset by sending CLEAR"); -UNIT_TEST(test_next_seqno_reset_by_clear_request_1) -{ - linkaddr_t peer_addr; - sixp_nbr_t *nbr; - sixp_trans_t *trans; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* - * When the node is the initiator of CLEAR, nbr->next_seqno must be - * reset to 0 regardless of the presence or absent of L2 ACK to the - * CLEAR Request. - */ - /* set next_seqno to 3 as the initial state for this sub-test */ - memset(&peer_addr, 0, sizeof(peer_addr)); - peer_addr.u8[0] = 1; - UNIT_TEST_ASSERT((nbr = sixp_nbr_alloc(&peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_nbr_set_next_seqno(nbr, 3) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 3); - UNIT_TEST_ASSERT(sixp_output(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - TEST_SF_SFID, NULL, 0, &peer_addr, - NULL, NULL, 0) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT((trans = sixp_trans_find(&peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_REQUEST_SENT) - == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 0); - UNIT_TEST_ASSERT(sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_TERMINATING) - == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 0); - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_next_seqno_reset_by_clear_request_2, - "test if next_seqno is reset by receiving CLEAR"); -UNIT_TEST(test_next_seqno_reset_by_clear_request_2) -{ - linkaddr_t peer_addr; - sixp_nbr_t *nbr; - sixp_pkt_metadata_t metadata; - - UNIT_TEST_BEGIN(); - - test_setup(); - - /* - * When the node is the responder of CLEAR, nbr->next_seqno must be - * reset to 0 regardless of the presence or absent of L2 ACK to the - * CLEAR Response. - */ - /* set next_seqno to 3 as the initial state for this sub-test */ - memset(&peer_addr, 0, sizeof(peer_addr)); - peer_addr.u8[0] = 1; - UNIT_TEST_ASSERT((nbr = sixp_nbr_alloc(&peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_nbr_set_next_seqno(nbr, 3) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 3); - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - TEST_SF_SFID, 10, - (const uint8_t *)&metadata, - sizeof(metadata), NULL) == 0); - sixp_input(packetbuf_hdrptr(), packetbuf_totlen(), &peer_addr); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 0); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_detect_seqno_error_1, - "test if seqno error is handled correctly (1)"); -UNIT_TEST(test_detect_seqno_error_1) -{ - linkaddr_t peer_addr; - uint32_t body; - uint8_t *p; - - UNIT_TEST_BEGIN(); - - test_setup(); - - memset(&peer_addr, 0, sizeof(peer_addr)); - peer_addr.u8[0] = 1; - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 10, - (const uint8_t *)&body, - sizeof(body), NULL) == 0); - - /* return RC_ERR_RSEQNUM on receiving non-zero seqno when nbr doesn't exist */ - sixp_input(packetbuf_hdrptr(), packetbuf_totlen(), &peer_addr); - /* - * 2 octets for Termination 1 IE, one octet for 6top Sub-IE ID, and - * 2 octets for Payload IE Header. - */ - p = packetbuf_hdrptr() + 5; - /* now, p pointes to the 6P header */ - UNIT_TEST_ASSERT(packetbuf_totlen() == 11); - UNIT_TEST_ASSERT(p[0] == ((SIXP_PKT_TYPE_RESPONSE << 4) | SIXP_PKT_VERSION)); - UNIT_TEST_ASSERT(p[1] == SIXP_PKT_RC_ERR_SEQNUM); - UNIT_TEST_ASSERT(p[2] == TEST_SF_SFID); - UNIT_TEST_ASSERT(p[3] == 0); /* we don't have a relevant nbr; 0 is returned */ - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_detect_seqno_error_2, - "test if seqno error is handled correctly (2)"); -UNIT_TEST(test_detect_seqno_error_2) -{ - sixp_nbr_t *nbr; - sixp_trans_t *trans; - linkaddr_t peer_addr; - uint32_t body; - uint8_t *p; - - UNIT_TEST_BEGIN(); - - test_setup(); - - memset(&peer_addr, 0, sizeof(peer_addr)); - peer_addr.u8[0] = 1; - UNIT_TEST_ASSERT((nbr = sixp_nbr_alloc(&peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_nbr_set_next_seqno(nbr, 3) == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 3); - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_ADD, - TEST_SF_SFID, 0, - (const uint8_t *)&body, - sizeof(body), NULL) == 0); - - /* return RC_ERR_RSEQNUM on receiving zero when nbr->seqno is non-zero */ - sixp_input(packetbuf_hdrptr(), packetbuf_totlen(), &peer_addr); - /* - * 2 octets for Termination 1 IE, one octet for 6top Sub-IE ID, and - * 2 octets for Payload IE Header. - */ - p = packetbuf_hdrptr() + 5; - /* now, p pointes to the 6P header */ - UNIT_TEST_ASSERT(packetbuf_totlen() == 11); - UNIT_TEST_ASSERT(p[0] == ((SIXP_PKT_TYPE_RESPONSE << 4) | SIXP_PKT_VERSION)); - UNIT_TEST_ASSERT(p[1] == SIXP_PKT_RC_ERR_SEQNUM); - UNIT_TEST_ASSERT(p[2] == TEST_SF_SFID); - UNIT_TEST_ASSERT(p[3] == 3); - - UNIT_TEST_ASSERT((trans = sixp_trans_find(&peer_addr)) != NULL); - UNIT_TEST_ASSERT(sixp_trans_transit_state(trans, - SIXP_TRANS_STATE_RESPONSE_SENT) - == 0); - UNIT_TEST_ASSERT(sixp_nbr_get_next_seqno(nbr) == 4); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_invalid_version, - "test invalid version"); -UNIT_TEST(test_invalid_version) -{ - linkaddr_t peer_addr; - uint8_t *p; - sixp_pkt_t pkt; - - UNIT_TEST_BEGIN(); - - test_setup(); - - memset(&peer_addr, 0, sizeof(peer_addr)); - peer_addr.u8[0] = 1; - UNIT_TEST_ASSERT(sixp_pkt_create(SIXP_PKT_TYPE_REQUEST, - (sixp_pkt_code_t)(uint8_t)SIXP_PKT_CMD_CLEAR, - TEST_SF_SFID, 0, - NULL, 0, NULL) == 0); - p = packetbuf_hdrptr(); - p[0] |= 10; /* set version 10 which we doesn't support */ - /* this 6P packet shouldn't be parsed */ - UNIT_TEST_ASSERT(sixp_pkt_parse(packetbuf_hdrptr(), packetbuf_totlen(), - &pkt) == -1); - - /* return RC_ERR_VERSION on receiving zero when nbr->seqno is non-zero */ - sixp_input(packetbuf_hdrptr(), packetbuf_totlen(), &peer_addr); - /* - * 2 octets for Termination 1 IE, one octet for 6top Sub-IE ID, and - * 2 octets for Payload IE Header. - */ - p = packetbuf_hdrptr() + 5; - /* now, p pointes to the 6P header */ - UNIT_TEST_ASSERT(packetbuf_totlen() == 11); - UNIT_TEST_ASSERT(p[0] == ((SIXP_PKT_TYPE_RESPONSE << 4) | SIXP_PKT_VERSION)); - UNIT_TEST_ASSERT(p[1] == SIXP_PKT_RC_ERR_VERSION); - UNIT_TEST_ASSERT(p[2] == TEST_SF_SFID); - UNIT_TEST_ASSERT(p[3] == 0); - - UNIT_TEST_END(); -} - -PROCESS_THREAD(test_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - - /* wait until the sixtop module gets ready */ - etimer_set(&et, CLOCK_SECOND); - tschmac_driver.init(); - tschmac_driver.on(); - tsch_set_coordinator(1); - while(tsch_is_associated == 0) { - PROCESS_YIELD_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - } - - printf("Run unit-test\n"); - printf("---\n"); - - UNIT_TEST_RUN(test_input_no_sf); - UNIT_TEST_RUN(test_input_busy); - UNIT_TEST_RUN(test_input_no_memory); - - UNIT_TEST_RUN(test_output_request_1); - UNIT_TEST_RUN(test_output_request_2); - UNIT_TEST_RUN(test_output_response_1); - UNIT_TEST_RUN(test_output_response_2); - UNIT_TEST_RUN(test_output_response_3); - UNIT_TEST_RUN(test_output_response_4); - UNIT_TEST_RUN(test_output_confirmation_1); - UNIT_TEST_RUN(test_output_confirmation_2); - UNIT_TEST_RUN(test_output_confirmation_3); - UNIT_TEST_RUN(test_output_confirmation_4); - - /* testing for SeqNum Management */ - UNIT_TEST_RUN(test_next_seqno_reset_by_clear_request_1); - UNIT_TEST_RUN(test_next_seqno_reset_by_clear_request_2); - UNIT_TEST_RUN(test_detect_seqno_error_1); - UNIT_TEST_RUN(test_detect_seqno_error_2); - - UNIT_TEST_RUN(test_invalid_version); - - printf("=check-me= DONE\n"); - PROCESS_END(); -} diff --git a/tests/13-ieee802154/code-6tisch/test-sixtop.c b/tests/13-ieee802154/code-6tisch/test-sixtop.c deleted file mode 100644 index 686581212..000000000 --- a/tests/13-ieee802154/code-6tisch/test-sixtop.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 - -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" -#include "lib/assert.h" - -#include "net/packetbuf.h" -#include "net/mac/tsch/sixtop/sixtop.h" -#include "net/mac/tsch/sixtop/sixtop-conf.h" - -#include "unit-test/unit-test.h" -#include "common.h" - -#if SIXTOP_MAX_SCHEDULING_FUNCTIONS != 2 -#error SIXTOP_CONF_MAX_SCHEDULING_FUNCTIONS must be set with 2 for this test -#endif - -#define TEST_SF1_SFID 0xf1 -#define TEST_SF2_SFID 0xf2 -#define TEST_SF3_SFID 0xf3 - -static uint8_t sf_init_vector; -static void test_sf1_init(void); -static void test_sf2_init(void); -static void test_sf3_init(void); -static void reset_sf_init_vector(void); - -static const sixtop_sf_t test_sf1 = { - TEST_SF1_SFID, - 0, - test_sf1_init, - NULL, - NULL -}; - -static const sixtop_sf_t test_sf2 = { - TEST_SF2_SFID, - 0, - test_sf2_init, - NULL, - NULL -}; - -static const sixtop_sf_t test_sf3 = { - TEST_SF3_SFID, - 0, - test_sf3_init, - NULL, - NULL -}; - -static void -test_sf1_init(void) -{ - sf_init_vector |= TEST_SF1_SFID; -} - -static void -test_sf2_init(void) -{ - sf_init_vector |= TEST_SF2_SFID; -} - -static void -test_sf3_init(void) -{ - sf_init_vector |= TEST_SF3_SFID; -} - -void -reset_sf_init_vector(void) -{ - sf_init_vector = 0; -} - -PROCESS(test_process, "6top module APIs test"); -AUTOSTART_PROCESSES(&test_process); - -UNIT_TEST_REGISTER(test_add_sf, - "sixtop_add_sf() should add a SF"); -UNIT_TEST(test_add_sf) -{ - UNIT_TEST_BEGIN(); - - /* confirm any of test_sf{1,2,3} is not added yet. */ - UNIT_TEST_ASSERT(sixtop_find_sf(TEST_SF1_SFID) == NULL); - UNIT_TEST_ASSERT(sixtop_find_sf(TEST_SF2_SFID) == NULL); - - /* add test_sf1 */ - UNIT_TEST_ASSERT(sixtop_add_sf(&test_sf1) == 0); - UNIT_TEST_ASSERT(sixtop_find_sf(TEST_SF1_SFID) == &test_sf1); - - /* add test_sf2 */ - UNIT_TEST_ASSERT(sixtop_add_sf(&test_sf2) == 0); - UNIT_TEST_ASSERT(sixtop_find_sf(TEST_SF2_SFID) == &test_sf2); - - /* - * add test_sf3; should fail because of lack of memory. - * SIXTOP_MAX_SCHEDULING_FUNCTIONS is set with two. - */ - UNIT_TEST_ASSERT(sixtop_add_sf(&test_sf3) == -1); - UNIT_TEST_ASSERT(sixtop_find_sf(TEST_SF3_SFID) == NULL); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_find_sf, - "sixtop_find_sf() should find a SF which has been added"); -UNIT_TEST(test_find_sf) -{ - UNIT_TEST_BEGIN(); - - /* - * See test_add_sf(); sixtop_find_sf() is tested together with sixtop_add_sf() - * in it. - */ - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_init, - "sixtop_init() should remove all SFs in the 6top module"); -UNIT_TEST(test_init) -{ - UNIT_TEST_BEGIN(); - - /* set up a precondition where some SFs has been added */ - if(sixtop_find_sf(TEST_SF1_SFID) == NULL) { - UNIT_TEST_ASSERT(sixtop_add_sf(&test_sf1) == 0); - UNIT_TEST_ASSERT(sixtop_find_sf(TEST_SF1_SFID) != NULL); - } - - if(sixtop_find_sf(TEST_SF2_SFID) == NULL) { - UNIT_TEST_ASSERT(sixtop_add_sf(&test_sf2) == 0); - UNIT_TEST_ASSERT(sixtop_find_sf(TEST_SF2_SFID) != NULL); - } - - /* call sixtop_init() which removes all the SFs in the module */ - sixtop_init(); - UNIT_TEST_ASSERT(sixtop_find_sf(TEST_SF1_SFID) == NULL); - UNIT_TEST_ASSERT(sixtop_find_sf(TEST_SF2_SFID) == NULL); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_output, - "test sixtop_output()"); -UNIT_TEST(test_output) -{ - linkaddr_t peer_addr; - uint8_t *p; - UNIT_TEST_BEGIN(); - - packetbuf_clear(); - UNIT_TEST_ASSERT(packetbuf_hdralloc(1) > 0); - p = packetbuf_hdrptr(); - p[0] = 0xca; // header - p = packetbuf_dataptr(); - p[0] = 0xfe; // data - packetbuf_set_datalen(1); - - sixtop_output(&peer_addr, NULL, NULL); - - p = packetbuf_hdrptr(); - - /* Length */ - UNIT_TEST_ASSERT(packetbuf_totlen() == 9); - - /* Termination 1 IE */ - UNIT_TEST_ASSERT(p[0] == 0x00); - UNIT_TEST_ASSERT(p[1] == 0x3f); - - /* IETF IE */ - UNIT_TEST_ASSERT(p[2] == 0x03); - UNIT_TEST_ASSERT(p[3] == 0xa8); - - /* 6top IE Sub-ID */ - UNIT_TEST_ASSERT(p[4] == 0xc9); - /* test data set above */ - UNIT_TEST_ASSERT(p[5] == 0xca); - UNIT_TEST_ASSERT(p[6] == 0xfe); - - /* Payload Termination IE */ - UNIT_TEST_ASSERT(p[7] == 0x00); - UNIT_TEST_ASSERT(p[8] == 0xf8); - - UNIT_TEST_END(); -} - -UNIT_TEST_REGISTER(test_init_sf, - "sixtop_init_sf() should invoke every SF->init()"); -UNIT_TEST(test_init_sf) -{ - UNIT_TEST_BEGIN(); - - /* remove all the SFs in the 6top module */ - sixtop_init(); - - /* add test_sf1 */ - UNIT_TEST_ASSERT(sixtop_add_sf(&test_sf1) == 0); - reset_sf_init_vector(); - sixtop_init_sf(); - UNIT_TEST_ASSERT(sf_init_vector == TEST_SF1_SFID); - - /* add test_sf2 */ - UNIT_TEST_ASSERT(sixtop_add_sf(&test_sf2) == 0); - reset_sf_init_vector(); - sixtop_init_sf(); - UNIT_TEST_ASSERT(sf_init_vector == (TEST_SF1_SFID | TEST_SF2_SFID)); - - UNIT_TEST_END(); -} - -PROCESS_THREAD(test_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("Run unit-test\n"); - printf("---\n"); - - UNIT_TEST_RUN(test_add_sf); - UNIT_TEST_RUN(test_find_sf); - UNIT_TEST_RUN(test_init); - UNIT_TEST_RUN(test_init_sf); - UNIT_TEST_RUN(test_output); - - printf("=check-me= DONE\n"); - PROCESS_END(); -} diff --git a/tests/13-ieee802154/code-flush-nbr-queue/Makefile b/tests/13-ieee802154/code-flush-nbr-queue/Makefile deleted file mode 100644 index 973ae668d..000000000 --- a/tests/13-ieee802154/code-flush-nbr-queue/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -all: - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/net/mac/tsch/sixtop os/services/unit-test - -PROJECT_SOURCEFILES += common.c - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/tests/13-ieee802154/code-flush-nbr-queue/common.c b/tests/13-ieee802154/code-flush-nbr-queue/common.c deleted file mode 100644 index 4baf17451..000000000 --- a/tests/13-ieee802154/code-flush-nbr-queue/common.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 -#include - -#include "unit-test/unit-test.h" -#include "common.h" - -#include "lib/simEnvChange.h" -#include "sys/cooja_mt.h" - -void -test_print_report(const unit_test_t *utp) -{ - printf("=check-me= "); - if(utp->result == unit_test_failure) { - printf("FAILED - %s: exit at L%u\n", utp->descr, utp->exit_line); - } else { - printf("SUCCEEDED - %s\n", utp->descr); - } - - /* give up the CPU so that the mote can output messages in the serial buffer */ - simProcessRunValue = 1; - cooja_mt_yield(); -} diff --git a/tests/13-ieee802154/code-flush-nbr-queue/common.h b/tests/13-ieee802154/code-flush-nbr-queue/common.h deleted file mode 100644 index 5b7f1f645..000000000 --- a/tests/13-ieee802154/code-flush-nbr-queue/common.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 _COMMON_H -#define _COMMON_H - -#include "unit-test.h" - -void test_print_report(const unit_test_t *utp); - -#endif /* !_COMMON_H */ diff --git a/tests/13-ieee802154/code-flush-nbr-queue/project-conf.h b/tests/13-ieee802154/code-flush-nbr-queue/project-conf.h deleted file mode 100644 index 039bc7c49..000000000 --- a/tests/13-ieee802154/code-flush-nbr-queue/project-conf.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UNIT_TEST_PRINT_FUNCTION test_print_report - -/* Set the minimum value of QUEUEBUF_CONF_NUM for the flush_nbr_queue test */ -#define QUEUEBUF_CONF_NUM 1 - -#define TSCH_CONF_AUTOSTART 1 - -#define TSCH_CONF_WITH_SIXTOP 1 - -#endif /* PROJECT_CONF_H_ */ diff --git a/tests/13-ieee802154/code-flush-nbr-queue/test-flush-nbr-queue.c b/tests/13-ieee802154/code-flush-nbr-queue/test-flush-nbr-queue.c deleted file mode 100644 index 57324f26f..000000000 --- a/tests/13-ieee802154/code-flush-nbr-queue/test-flush-nbr-queue.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2017, Yasuyuki Tanaka - * 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 - -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" -#include "lib/assert.h" - -#include "net/linkaddr.h" -#include "net/mac/tsch/tsch.h" - -#include "unit-test/unit-test.h" -#include "common.h" - -PROCESS(test_process, "tsch_queue_flush_nbr_queue() test"); -AUTOSTART_PROCESSES(&test_process); - -static linkaddr_t test_nbr_addr = {{ 0x01 }}; -#define TEST_PEER_ADDR &test_nbr_addr - -UNIT_TEST_REGISTER(test, - "flush_nbr_queue() should delete all the packet in the queue"); -UNIT_TEST(test) -{ - struct tsch_packet *packet; - struct tsch_neighbor *nbr; - - UNIT_TEST_BEGIN(); - - packet = tsch_queue_add_packet(TEST_PEER_ADDR, 1, NULL, NULL); - UNIT_TEST_ASSERT(packet != NULL); - - nbr = tsch_queue_get_nbr(TEST_PEER_ADDR); - UNIT_TEST_ASSERT(nbr != NULL); - - /* - * QUEUEBUF_CONF_NUM is set with 1; so another addition should fail due to - * lack of memory. - */ - packet = tsch_queue_add_packet(TEST_PEER_ADDR, 1, NULL, NULL); - UNIT_TEST_ASSERT(packet == NULL); - - /* tsch_queue_flush_nbr_queue() is called inside of tsch_queue_reset(). */ - tsch_queue_reset(); - - /* After flushing the nbr queue, we should be able to add a new packet */ - packet = tsch_queue_add_packet(TEST_PEER_ADDR, 1, NULL, NULL); - UNIT_TEST_ASSERT(packet != NULL); - - UNIT_TEST_END(); -} - -PROCESS_THREAD(test_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - - tsch_set_coordinator(1); - - etimer_set(&et, CLOCK_SECOND); - while(tsch_is_associated == 0) { - PROCESS_YIELD_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - } - - printf("Run unit-test\n"); - printf("---\n"); - - UNIT_TEST_RUN(test); - - printf("=check-me= DONE\n"); - PROCESS_END(); -} diff --git a/tests/13-ieee802154/code-panid-handling/Makefile b/tests/13-ieee802154/code-panid-handling/Makefile deleted file mode 100644 index 9045f1929..000000000 --- a/tests/13-ieee802154/code-panid-handling/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -all: test-panid-handling test-tcsh-create-packet - -MAKE_MAC = MAKE_MAC_TSCH -MODULES += os/services/unit-test - -TEST_CONFIG_TYPE ?= DEFAULT - -ifeq ($(TEST_CONFIG_TYPE), SECURITY_ON) -CFLAGS += -D WITH_SECURITY_ON=1 -endif - -ifeq ($(TEST_CONFIG_TYPE), ALL_ENABLED) -CFLAGS += -D WITH_ALL_ENABLED=1 -endif - -CONTIKI = ../../.. -include $(CONTIKI)/Makefile.include diff --git a/tests/13-ieee802154/code-panid-handling/project-conf.h b/tests/13-ieee802154/code-panid-handling/project-conf.h deleted file mode 100644 index 89b2c289e..000000000 --- a/tests/13-ieee802154/code-panid-handling/project-conf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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 PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define UNIT_TEST_PRINT_FUNCTION test_print_report - -#if MAC_CONF_WITH_TSCH -#include "project-tsch-conf.h" -#endif /* MAC_CONF_WITH_TSCH */ - -#endif /* !PROJECT_CONF_H_ */ diff --git a/tests/13-ieee802154/code-panid-handling/project-tsch-conf.h b/tests/13-ieee802154/code-panid-handling/project-tsch-conf.h deleted file mode 100644 index 868af4675..000000000 --- a/tests/13-ieee802154/code-panid-handling/project-tsch-conf.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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 _PROJECT_TSCH_CONF_H -#define _PROJECT_TSCH_CONF_H - -#if WITH_SECURITY_ON -#define TEST_CONFIG_TYPE SECURITY_ON - -#define LLSEC802154_CONF_ENABLED 1 - -#elif WITH_ALL_ENABLED -#define TEST_CONFIG_TYPE ALL_ENABLED - -#define TSCH_PACKET_CONF_EACK_WITH_DEST_ADDR 1 -#define TSCH_PACKET_CONF_EACK_WITH_SRC_ADDR 1 -#define TSCH_PACKET_CONF_EB_WITH_TIMESLOT_TIMING 1 -#define TSCH_PACKET_CONF_EB_WITH_HOPPING_SEQUENCE 1 -#define TSCH_PACKET_CONF_EB_WITH_SLOTFRAME_AND_LINK 1 - -#endif - - -#endif /* !_PROJECT_TSCH_CONF_H */ diff --git a/tests/13-ieee802154/code-panid-handling/test-panid-handling.c b/tests/13-ieee802154/code-panid-handling/test-panid-handling.c deleted file mode 100644 index da14fd0c6..000000000 --- a/tests/13-ieee802154/code-panid-handling/test-panid-handling.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 2016, Yasuyuki Tanaka - * 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 "contiki.h" -#include "unit-test/unit-test.h" -#include "net/mac/framer/frame802154.h" - -#include - -#define VERBOSE 0 - -PROCESS(test_process, "frame802154.c test"); -AUTOSTART_PROCESSES(&test_process); - -typedef enum {SUCCESS, FAILURE} result_t; -typedef enum {NO_ADDR, SHORT, LONG} addr_mode_t; -typedef enum {NOT_PRESENT, PRESENT} panid_mode_t; -typedef enum {OFF, ON} panid_cmpr_mode_t; - -typedef struct { - addr_mode_t dest_addr_mode; - addr_mode_t src_addr_mode; - panid_mode_t dest_panid_mode; - panid_mode_t src_panid_mode; - panid_cmpr_mode_t panid_cmpr_mode; -} panid_test_def; - -/* IEEE 802.15.4-2015, the itemization in Section 7.2.1.5 */ -/* This is applied to frames but Acknowledge */ -static panid_test_def panid_table_0b00_0b01[] = { - /* dest_addr, src_addr, dest_panid, src_panid, panid_cmp */ - //{ NO_ADDR, NO_ADDR, UNDEFINED, UNDEFINED, OFF}, - //{ NO_ADDR, NO_ADDR, UNDEFINED, UNDEFINED, ON}, - { SHORT, SHORT, PRESENT, NOT_PRESENT, ON}, - { LONG, SHORT, PRESENT, NOT_PRESENT, ON}, - { SHORT, LONG, PRESENT, NOT_PRESENT, ON}, - { LONG, LONG, PRESENT, NOT_PRESENT, ON}, - { SHORT, SHORT, PRESENT, PRESENT, OFF}, - { LONG, SHORT, PRESENT, PRESENT, OFF}, - { SHORT, LONG, PRESENT, PRESENT, OFF}, - { LONG, LONG, PRESENT, PRESENT, OFF}, - { SHORT, NO_ADDR, PRESENT, NOT_PRESENT, OFF}, - { LONG, NO_ADDR, PRESENT, NOT_PRESENT, OFF}, - { NO_ADDR, SHORT, NOT_PRESENT, PRESENT, OFF}, - { NO_ADDR, LONG, NOT_PRESENT, PRESENT, OFF}, - //{ SHORT, NO_ADDR, UNDEFINED, UNDEFINED, ON}, - //{ LONG, NO_ADDR, UNDEFINED, UNDEFINED, ON}, - //{ NO_ADDR, SHORT, UNDEFINED, UNDEFINED, ON}, - //{ NO_ADDR, LONG, UNDEFINED, UNDEFINED, ON}, -}; - - -/* IEEE 802.15.4-2015, Table 7-2 in Section 7.2.1.5 */ -static panid_test_def panid_table_0b10[] = { - /* dest_addr, src_addr, dest_panid, src_panid, panid_cmp */ - { NO_ADDR, NO_ADDR, NOT_PRESENT, NOT_PRESENT, OFF}, // index 0, row-1 - { NO_ADDR, NO_ADDR, PRESENT, NOT_PRESENT, ON}, // index 1, row-2 - { SHORT, NO_ADDR, PRESENT, NOT_PRESENT, OFF}, // index 2, row-3-1 - { SHORT, NO_ADDR, NOT_PRESENT, NOT_PRESENT, ON}, // index 3, row-4-1 - { NO_ADDR, SHORT, NOT_PRESENT, PRESENT, OFF}, // index 4, row-5-1 - { NO_ADDR, SHORT, NOT_PRESENT, NOT_PRESENT, ON}, // index 5 row-6-1 - { LONG, LONG, PRESENT, NOT_PRESENT, OFF}, // index 6, row-7 - { LONG, LONG, NOT_PRESENT, NOT_PRESENT, ON}, // index 7, row-8 - { SHORT, SHORT, PRESENT, PRESENT, OFF}, // index 8, row-9, *1 - { SHORT, LONG, PRESENT, PRESENT, OFF}, // index 9, row-10, *1 - { LONG, SHORT, PRESENT, PRESENT, OFF}, // index 10, row-11, *1 - { SHORT, LONG, PRESENT, NOT_PRESENT, ON}, // index 11, row-12, *2 - { LONG, SHORT, PRESENT, NOT_PRESENT, ON}, // index 12, row-13, *2 - { SHORT, SHORT, PRESENT, NOT_PRESENT, ON}, // index 13, row-14, *2 - { LONG, NO_ADDR, PRESENT, NOT_PRESENT, OFF}, // index 14, row-3-2 - { LONG, NO_ADDR, NOT_PRESENT, NOT_PRESENT, ON}, // index 15, row-4-2 - { NO_ADDR, LONG, NOT_PRESENT, PRESENT, OFF}, // index 16, row-5-2 - { NO_ADDR, LONG, NOT_PRESENT, NOT_PRESENT, ON}, // index 17, row-6-2 - /* *1: contradict row-12 in Table 2a of IEEE 802.15.4e-2012 */ - /* *2: contradict row-13 in Table 2a of IEEE 802.15.4e-2012 */ -}; - -typedef void (*setup_fcf_p)(const panid_test_def *, frame802154_fcf_t *); - - -UNIT_TEST_REGISTER(panid_frame_ver_0b00, "PAN ID Cmpr Handing (frame-ver: 0b00)"); -UNIT_TEST_REGISTER(panid_frame_ver_0b01, "PAN ID Cmpr Handing (frame-ver: 0b01)"); -UNIT_TEST_REGISTER(panid_frame_ver_0b10, "PAN ID Cmpr Handing (frame-ver: 0b10)"); - - -void -test_print_report(const unit_test_t *utp) -{ - printf("=check-me= "); - if(utp->result == unit_test_failure) { - printf("FAILED - %s: at test index %d\n", utp->descr, utp->exit_line); - } else { - printf("SUCEEDED - %s\n", utp->descr); - } -} - -static void -setup_addr_mode(addr_mode_t mode, uint8_t *addr_mode) -{ - switch(mode) { - case NO_ADDR: - *addr_mode = FRAME802154_NOADDR; - break; - case SHORT: - *addr_mode = FRAME802154_SHORTADDRMODE; - break; - case LONG: - *addr_mode = FRAME802154_LONGADDRMODE; - break; - default: - break; - } -} - -static void -setup_panid_cmpr_mode(panid_cmpr_mode_t panid_cmpr_mode, frame802154_fcf_t *fcf) -{ - switch(panid_cmpr_mode) { - case OFF: - fcf->panid_compression = 0; - break; - case ON: - fcf->panid_compression = 1; - break; - default: - break; - } -} - -static void -setup_frame802154_2003_fcf(const panid_test_def *t, frame802154_fcf_t *fcf) -{ - fcf->frame_version = FRAME802154_IEEE802154_2003; - fcf->frame_type = FRAME802154_DATAFRAME; - - setup_addr_mode(t->dest_addr_mode, &fcf->dest_addr_mode); - setup_addr_mode(t->src_addr_mode, &fcf->src_addr_mode); - setup_panid_cmpr_mode(t->panid_cmpr_mode, fcf); -} - -static void -setup_frame802154_2006_fcf(const panid_test_def *t, frame802154_fcf_t *fcf) -{ - fcf->frame_version = FRAME802154_IEEE802154_2006; - fcf->frame_type = FRAME802154_DATAFRAME; - - setup_addr_mode(t->dest_addr_mode, &fcf->dest_addr_mode); - setup_addr_mode(t->src_addr_mode, &fcf->src_addr_mode); - setup_panid_cmpr_mode(t->panid_cmpr_mode, fcf); -} - - -static void -setup_frame802154_2015_fcf(const panid_test_def *t, frame802154_fcf_t *fcf) -{ - fcf->frame_version = FRAME802154_IEEE802154_2015; - - setup_addr_mode(t->dest_addr_mode, &fcf->dest_addr_mode); - setup_addr_mode(t->src_addr_mode, &fcf->src_addr_mode); - setup_panid_cmpr_mode(t->panid_cmpr_mode, fcf); -} - -static int -panid_run_test(const panid_test_def table[], size_t table_size, - setup_fcf_p setup_fcf) -{ - int i; - int num_of_tests = table_size / sizeof(panid_test_def); - frame802154_fcf_t fcf; - int has_src_pan_id, has_dest_pan_id; - const panid_test_def *test; - result_t result; - - for(i = 0; i < num_of_tests; i++) { - test = &table[i]; - setup_fcf(test, &fcf); - has_src_pan_id = 0; - has_dest_pan_id = 0; - - frame802154_has_panid(&fcf, &has_src_pan_id, &has_dest_pan_id); - - result = FAILURE; - switch(test->dest_panid_mode) { - case NOT_PRESENT: - if(has_dest_pan_id == 0) { - result = SUCCESS; - } - break; - case PRESENT: - if(has_dest_pan_id == 1) { - result = SUCCESS; - } - break; - } - - if(result == SUCCESS) { - result = FAILURE; - switch(test->src_panid_mode) { - case NOT_PRESENT: - if(has_src_pan_id == 0) { - result = SUCCESS; - } - break; - case PRESENT: - if(has_src_pan_id == 1) { - result = SUCCESS; - } - break; - } - } - -#if VERBOSE == 1 - printf("%d, %d, %d, %d, %d\n", - test->dest_addr_mode, - test->src_addr_mode, - has_dest_pan_id, - has_src_pan_id, - test->panid_cmpr_mode); -#else - printf("%s", result == SUCCESS ? "." : "E"); -#endif - if(result == FAILURE) { - break; - } - } - printf("\n"); - return i; -} - -UNIT_TEST(panid_frame_ver_0b00) -{ - int index; - int num_of_tests = sizeof(panid_table_0b00_0b01) / sizeof(panid_test_def); - - UNIT_TEST_BEGIN(); - - UNIT_TEST_ASSERT((index = panid_run_test(panid_table_0b00_0b01, - sizeof(panid_table_0b00_0b01), - setup_frame802154_2003_fcf)) == - num_of_tests); - - UNIT_TEST_END(); - utp->exit_line = index; -} - -UNIT_TEST(panid_frame_ver_0b01) -{ - int index; - int num_of_tests = sizeof(panid_table_0b00_0b01) / sizeof(panid_test_def); - - UNIT_TEST_BEGIN(); - - UNIT_TEST_ASSERT((index = panid_run_test(panid_table_0b00_0b01, - sizeof(panid_table_0b00_0b01), - setup_frame802154_2006_fcf)) == - num_of_tests); - - UNIT_TEST_END(); - utp->exit_line = index; -} - -UNIT_TEST(panid_frame_ver_0b10) -{ - int index; - int num_of_tests = sizeof(panid_table_0b10) / sizeof(panid_test_def); - - UNIT_TEST_BEGIN(); - - UNIT_TEST_ASSERT((index = panid_run_test(panid_table_0b10, - sizeof(panid_table_0b10), - setup_frame802154_2015_fcf)) == - num_of_tests); - - UNIT_TEST_END(); - utp->exit_line = index; -} - -PROCESS_THREAD(test_process, ev, data) -{ - PROCESS_BEGIN(); - - printf("Run unit-test\n"); - printf("---\n"); - - UNIT_TEST_RUN(panid_frame_ver_0b00); - UNIT_TEST_RUN(panid_frame_ver_0b01); - UNIT_TEST_RUN(panid_frame_ver_0b10); - - printf("=check-me= DONE\n"); - PROCESS_END(); -} diff --git a/tests/13-ieee802154/js/01-panid-handling.js b/tests/13-ieee802154/js/01-panid-handling.js deleted file mode 100644 index 1bef49f69..000000000 --- a/tests/13-ieee802154/js/01-panid-handling.js +++ /dev/null @@ -1,21 +0,0 @@ -TIMEOUT(10000, log.testFailed()); - -while(true) { - YIELD(); - - log.log(time + " " + id + " "+ msg + "\n"); - - if(msg.contains("=check-me=") == false) { - continue; - } - - if(msg.contains("FAILED")) { - log.testFailed(); - } - - if(msg.contains("DONE")) { - log.testOK(); - break; - } - -} diff --git a/tests/13-ieee802154/js/02-tsch-flush-nbr-queue.js b/tests/13-ieee802154/js/02-tsch-flush-nbr-queue.js deleted file mode 100644 index 015d3b63b..000000000 --- a/tests/13-ieee802154/js/02-tsch-flush-nbr-queue.js +++ /dev/null @@ -1,27 +0,0 @@ -TIMEOUT(10000, log.testFailed()); - -var failed = false; -var done = 0; - -while(done < sim.getMotes().length) { - YIELD(); - - log.log(time + " " + "node-" + id + " "+ msg + "\n"); - - if(msg.contains("=check-me=") == false) { - continue; - } - - if(msg.contains("FAILED")) { - failed = true; - } - - if(msg.contains("DONE")) { - done++; - } -} -if(failed) { - log.testFailed(); -} -log.testOK(); - diff --git a/tests/13-ieee802154/js/sixtop-test.js b/tests/13-ieee802154/js/sixtop-test.js deleted file mode 100644 index c410644ec..000000000 --- a/tests/13-ieee802154/js/sixtop-test.js +++ /dev/null @@ -1,26 +0,0 @@ -TIMEOUT(10000, log.testFailed()); - -var failed = false; -var done = 0; - -while(done < sim.getMotes().length) { - YIELD(); - - log.log(time + " " + "node-" + id + " "+ msg + "\n"); - - if(msg.contains("=check-me=") == false) { - continue; - } - - if(msg.contains("FAILED")) { - failed = true; - } - - if(msg.contains("DONE")) { - done++; - } -} -if(failed) { - log.testFailed(); -} -log.testOK(); diff --git a/tests/14-rpl-lite/01-rpl-up-route.csc b/tests/14-rpl-lite/01-rpl-up-route.csc deleted file mode 100644 index 899b58bf7..000000000 --- a/tests/14-rpl-lite/01-rpl-up-route.csc +++ /dev/null @@ -1,342 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype488 - Sender - [CONFIG_DIR]/code/sender-node.c - make TARGET=cooja clean -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype32 - RPL root - [CONFIG_DIR]/code/root-node.c - make TARGET=cooja clean -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype352 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make TARGET=cooja clean -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 6.9596575829049145 - -25.866060090958513 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 132.8019872469463 - 146.1533406452311 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype488 - - - - org.contikios.cooja.interfaces.Position - 0.026556260457749753 - 39.54055615854325 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 95.52021598473031 - 148.11553913271615 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 62.81690785997944 - 127.1854219328756 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 32.07579822271361 - 102.33090775806494 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 5.913151722912886 - 73.55199660828417 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype32 - - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 0.9555608221893928 0.0 0.0 0.9555608221893928 177.34962387792274 139.71659364731656 - - 400 - 1 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 3 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 0 - 596 - 603 - 43 - - diff --git a/tests/14-rpl-lite/02-rpl-root-reboot-2.csc b/tests/14-rpl-lite/02-rpl-root-reboot-2.csc deleted file mode 100644 index 50b3153dd..000000000 --- a/tests/14-rpl-lite/02-rpl-root-reboot-2.csc +++ /dev/null @@ -1,294 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 10.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype34 - mote - [CONTIKI_DIR]/examples/libs/shell/example.c - make example.cooja TARGET=cooja MAKE_ROUTING=MAKE_ROUTING_RPL_LITE -j - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 50.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype34 - - - - org.contikios.cooja.interfaces.Position - 100.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype34 - - - - org.contikios.cooja.interfaces.Position - 150.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-addr~;routes~;routing~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype34 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype34 - - - - org.contikios.cooja.plugins.SimControl - 280 - 0 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 125.81818181818181 173.0 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 604 - 3 - 784 - 400 - 160 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 944 - 1 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 617 - 2 - 785 - 1007 - 160 - - - diff --git a/tests/14-rpl-lite/03-rpl-28-hours.csc b/tests/14-rpl-lite/03-rpl-28-hours.csc deleted file mode 100644 index a4c25cc08..000000000 --- a/tests/14-rpl-lite/03-rpl-28-hours.csc +++ /dev/null @@ -1,291 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype110 - Sender - [CONFIG_DIR]/code/sender-node.c - make TARGET=cooja clean -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype792 - RPL root - [CONFIG_DIR]/code/root-node.c - make TARGET=cooja clean -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype964 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make TARGET=cooja clean -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 7.772906112657773 - 86.396910401861 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype964 - - - - org.contikios.cooja.interfaces.Position - 75.54361692539452 - 14.292026223193414 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype110 - - - - org.contikios.cooja.interfaces.Position - 47.962513687652844 - 7.199742533488408 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype964 - - - - org.contikios.cooja.interfaces.Position - 1.8626697045702818 - 47.783365869022624 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype964 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype792 - - - - org.contikios.cooja.plugins.SimControl - 280 - 0 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 78.27260101976275 40.72727272727276 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 3 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 1 - 596 - 603 - 43 - - diff --git a/tests/14-rpl-lite/05-rpl-up-and-down-routes.csc b/tests/14-rpl-lite/05-rpl-up-and-down-routes.csc deleted file mode 100644 index 49e793691..000000000 --- a/tests/14-rpl-lite/05-rpl-up-and-down-routes.csc +++ /dev/null @@ -1,340 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype743 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype452 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype782 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -22.5728586847096 - 123.9358664968653 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype743 - - - - org.contikios.cooja.interfaces.Position - -1.39303771455413 - 100.21446701029119 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 10.931583432822638 - 69.848248459216 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype452 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - 1184 - 3 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 0 - 596 - 603 - 43 - - diff --git a/tests/14-rpl-lite/06-rpl-temporary-root-loss.csc b/tests/14-rpl-lite/06-rpl-temporary-root-loss.csc deleted file mode 100644 index 6d8283d3e..000000000 --- a/tests/14-rpl-lite/06-rpl-temporary-root-loss.csc +++ /dev/null @@ -1,346 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype951 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype170 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype767 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -22.5728586847096 - 123.9358664968653 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype951 - - - - org.contikios.cooja.interfaces.Position - -1.39303771455413 - 100.21446701029119 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 10.931583432822638 - 69.848248459216 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype170 - - - - org.contikios.cooja.plugins.SimControl - 280 - 0 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - 1184 - 3 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 1 - 596 - 603 - 43 - - diff --git a/tests/14-rpl-lite/07-rpl-random-rearrangement.csc b/tests/14-rpl-lite/07-rpl-random-rearrangement.csc deleted file mode 100644 index 6119c6829..000000000 --- a/tests/14-rpl-lite/07-rpl-random-rearrangement.csc +++ /dev/null @@ -1,646 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype419 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype484 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype718 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -0.4799968467515439 - 98.79087181374759 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 99.56423154395364 - 50.06466731257512 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype419 - - - - org.contikios.cooja.interfaces.Position - -0.4799968467515439 - 0.30173505605854883 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype484 - - - - org.contikios.cooja.interfaces.Position - 12.779318616702257 - 8.464865358169643 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 9.391922400291703 - 49.22878206790311 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 48.16367625505583 - 33.27520746599595 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 16.582742473429345 - 24.932911331640646 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 8.445564421140666 - 6.770205395698742 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 87.04968129458189 - 34.46536562612724 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 94.47123252519145 - 18.275940194868184 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 10 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 95.28044254364556 - 17.683438211793558 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 11 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 56.124622439456076 - 33.88966252832571 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 12 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 98.33149749474546 - 37.448034626592744 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 13 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 58.75337436025891 - 68.64082018992522 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 14 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 66.83816496627988 - 68.38008376830592 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 15 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 90.88648665466316 - 50.942053906416575 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 16 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 68.80089833632896 - 84.17294684073734 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 17 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 73.6760846183129 - 81.76699743886633 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 18 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 0.2960103456537466 - 98.5587829617092 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 19 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 8.130479493904208 - 57.642099520821645 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 20 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 30.550120982984865 - 85.58346736403402 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 21 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 29.65300377698182 - 63.50257213104861 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 22 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 34.92110687576687 - 70.71381297232249 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 23 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 1.92914676942954 0.0 0.0 1.92914676942954 75.9259843662471 55.41790879138101 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 3 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 0 - 726 - 953 - 43 - - diff --git a/tests/14-rpl-lite/08-rpl-dao-route-loss-0.csc b/tests/14-rpl-lite/08-rpl-dao-route-loss-0.csc deleted file mode 100644 index bd1114c50..000000000 --- a/tests/14-rpl-lite/08-rpl-dao-route-loss-0.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype921 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype873 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype812 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype921 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - -40.352178879596096 - 102.66976131212861 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype873 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 1.6480321712565114 0.0 0.0 1.6480321712565114 98.5016889738719 55.796930342384904 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 1 - 726 - 953 - 43 - - diff --git a/tests/14-rpl-lite/08-rpl-dao-route-loss-1.csc b/tests/14-rpl-lite/08-rpl-dao-route-loss-1.csc deleted file mode 100644 index cc1fd3970..000000000 --- a/tests/14-rpl-lite/08-rpl-dao-route-loss-1.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype672 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype780 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype36 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype672 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - -25.71843353317142 - 43.05517674255262 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype780 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 1 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 0 - 726 - 953 - 43 - - diff --git a/tests/14-rpl-lite/08-rpl-dao-route-loss-2.csc b/tests/14-rpl-lite/08-rpl-dao-route-loss-2.csc deleted file mode 100644 index f659b4e04..000000000 --- a/tests/14-rpl-lite/08-rpl-dao-route-loss-2.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype672 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype780 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype36 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype672 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 16.0472370839803 - 6.017695251870905 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype780 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 1 - 726 - 953 - 43 - - diff --git a/tests/14-rpl-lite/08-rpl-dao-route-loss-3.csc b/tests/14-rpl-lite/08-rpl-dao-route-loss-3.csc deleted file mode 100644 index a3e38edac..000000000 --- a/tests/14-rpl-lite/08-rpl-dao-route-loss-3.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype672 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype780 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype36 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype672 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 79.48377453078622 - 4.835647970253402 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype780 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 70.27260101976269 60.72727272727276 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 1 - 726 - 953 - 43 - - diff --git a/tests/14-rpl-lite/08-rpl-dao-route-loss-4.csc b/tests/14-rpl-lite/08-rpl-dao-route-loss-4.csc deleted file mode 100644 index 11a0f3168..000000000 --- a/tests/14-rpl-lite/08-rpl-dao-route-loss-4.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype192 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype575 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype912 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype192 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 122.82550819009461 - 29.658640884220933 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype575 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 70.27260101976269 60.72727272727276 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 1 - 726 - 953 - 43 - - diff --git a/tests/14-rpl-lite/08-rpl-dao-route-loss-5.csc b/tests/14-rpl-lite/08-rpl-dao-route-loss-5.csc deleted file mode 100644 index 0a0308e22..000000000 --- a/tests/14-rpl-lite/08-rpl-dao-route-loss-5.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype372 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype229 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype424 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype372 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 145.93059238811136 - 111.16474110935306 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype229 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 1.6480321712565114 0.0 0.0 1.6480321712565114 98.5016889738719 55.796930342384904 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 1 - 726 - 953 - 43 - - diff --git a/tests/14-rpl-lite/09-rpl-probing.csc b/tests/14-rpl-lite/09-rpl-probing.csc deleted file mode 100644 index d79ec7be4..000000000 --- a/tests/14-rpl-lite/09-rpl-probing.csc +++ /dev/null @@ -1,254 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype190 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype481 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype692 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 8.0 - 2.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype481 - - - - org.contikios.cooja.interfaces.Position - -7.19071602882406 - 34.96668248624779 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype190 - - - - org.contikios.cooja.interfaces.Position - -17.870288882812428 - 4.581754854333804 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype692 - - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.494541140753371 0.0 0.0 2.494541140753371 168.25302383129448 116.2254386098645 - - 400 - 3 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 597 - 0 - 428 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 605 - 1 - 684 - 604 - 14 - - diff --git a/tests/14-rpl-lite/Makefile b/tests/14-rpl-lite/Makefile deleted file mode 100644 index 272bc7da1..000000000 --- a/tests/14-rpl-lite/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../Makefile.simulation-test diff --git a/tests/14-rpl-lite/code/Makefile b/tests/14-rpl-lite/code/Makefile deleted file mode 100644 index 7e2883eff..000000000 --- a/tests/14-rpl-lite/code/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -all: sender-node receiver-node root-node -CONTIKI=../../.. - -include $(CONTIKI)/Makefile.include diff --git a/tests/14-rpl-lite/code/project-conf.h b/tests/14-rpl-lite/code/project-conf.h deleted file mode 100644 index d6cd59471..000000000 --- a/tests/14-rpl-lite/code/project-conf.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 TCPIP_CONF_ANNOTATE_TRANSMISSIONS 1 diff --git a/tests/14-rpl-lite/code/receiver-node.c b/tests/14-rpl-lite/code/receiver-node.c deleted file mode 100644 index b5cd26a15..000000000 --- a/tests/14-rpl-lite/code/receiver-node.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, www.thingsquare.com. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/ipv6/uip-debug.h" - -#include "simple-udp.h" - -#include "net/routing/routing.h" -#include "dev/leds.h" - -#include -#include - -#define UDP_PORT 1234 - -static struct simple_udp_connection unicast_connection; - -/*---------------------------------------------------------------------------*/ -PROCESS(receiver_node_process, "Receiver node"); -AUTOSTART_PROCESSES(&receiver_node_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Data received from "); - uip_debug_ipaddr_print(sender_addr); - printf(" on port %d from port %d with length %d: '%s'\n", - receiver_port, sender_port, datalen, data); -} -/*---------------------------------------------------------------------------*/ -static uip_ipaddr_t * -set_global_address(void) -{ - static uip_ipaddr_t ipaddr; - int i; - uint8_t state; - const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix(); - - uip_ip6addr_copy(&ipaddr, default_prefix); - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - - printf("IPv6 addresses: "); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr); - printf("\n"); - } - } - - return &ipaddr; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(receiver_node_process, ev, data) -{ - static struct etimer et; - - PROCESS_BEGIN(); - - set_global_address(); - - simple_udp_register(&unicast_connection, UDP_PORT, - NULL, UDP_PORT, receiver); - - etimer_set(&et, CLOCK_SECOND); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/14-rpl-lite/code/root-node.c b/tests/14-rpl-lite/code/root-node.c deleted file mode 100644 index 7c9fc8c99..000000000 --- a/tests/14-rpl-lite/code/root-node.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, www.thingsquare.com. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-debug.h" - -#include "simple-udp.h" - -#include "net/routing/routing.h" - -#include -#include - -#define UDP_PORT 1234 -#define SERVICE_ID 190 - -#define SEND_INTERVAL (10 * CLOCK_SECOND) -#define SEND_TIME (random_rand() % (SEND_INTERVAL)) - -static struct simple_udp_connection unicast_connection; - -/*---------------------------------------------------------------------------*/ -PROCESS(unicast_receiver_process, "Unicast receiver example process"); -AUTOSTART_PROCESSES(&unicast_receiver_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Data received from "); - uip_debug_ipaddr_print(sender_addr); - printf(" on port %d from port %d with length %d: '%s'\n", - receiver_port, sender_port, datalen, data); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(unicast_receiver_process, ev, data) -{ - PROCESS_BEGIN(); - - NETSTACK_ROUTING.root_start(); - - simple_udp_register(&unicast_connection, UDP_PORT, - NULL, UDP_PORT, receiver); - - while(1) { - PROCESS_WAIT_EVENT(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/14-rpl-lite/code/sender-node.c b/tests/14-rpl-lite/code/sender-node.c deleted file mode 100644 index 00bd6d5c5..000000000 --- a/tests/14-rpl-lite/code/sender-node.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, www.thingsquare.com. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-debug.h" - -#include "simple-udp.h" - -#include -#include - -#define UDP_PORT 1234 - -#define SEND_INTERVAL (60 * CLOCK_SECOND) -#define SEND_TIME (random_rand() % (SEND_INTERVAL)) - -static struct simple_udp_connection unicast_connection; - -/*---------------------------------------------------------------------------*/ -PROCESS(sender_node_process, "Sender node process"); -AUTOSTART_PROCESSES(&sender_node_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Sender received data on port %d from port %d with length %d\n", - receiver_port, sender_port, datalen); -} -/*---------------------------------------------------------------------------*/ -static void -set_global_address(void) -{ - uip_ipaddr_t ipaddr; - int i; - uint8_t state; - const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix(); - - uip_ip6addr_copy(&ipaddr, default_prefix); - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - - printf("IPv6 addresses: "); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr); - printf("\n"); - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sender_node_process, ev, data) -{ - static struct etimer periodic_timer; - static struct etimer send_timer; - uip_ipaddr_t addr; - const uip_ipaddr_t *default_prefix; - - PROCESS_BEGIN(); - - set_global_address(); - - simple_udp_register(&unicast_connection, UDP_PORT, - NULL, UDP_PORT, receiver); - - etimer_set(&periodic_timer, SEND_INTERVAL); - while(1) { - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_reset(&periodic_timer); - etimer_set(&send_timer, SEND_TIME); - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&send_timer)); - - default_prefix = uip_ds6_default_prefix(); - uip_ip6addr_copy(&addr, default_prefix); - - addr.u16[4] = UIP_HTONS(0x0201); - addr.u16[5] = UIP_HTONS(0x0001); - addr.u16[6] = UIP_HTONS(0x0001); - addr.u16[7] = UIP_HTONS(0x0001); - - { - static unsigned int message_number; - char buf[20]; - - printf("Sending unicast to "); - uip_debug_ipaddr_print(&addr); - printf("\n"); - sprintf(buf, "Message %d", message_number); - message_number++; - simple_udp_sendto(&unicast_connection, buf, strlen(buf) + 1, &addr); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/15-rpl-classic/01-rpl-up-route.csc b/tests/15-rpl-classic/01-rpl-up-route.csc deleted file mode 100644 index 899b58bf7..000000000 --- a/tests/15-rpl-classic/01-rpl-up-route.csc +++ /dev/null @@ -1,342 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype488 - Sender - [CONFIG_DIR]/code/sender-node.c - make TARGET=cooja clean -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype32 - RPL root - [CONFIG_DIR]/code/root-node.c - make TARGET=cooja clean -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype352 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make TARGET=cooja clean -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 6.9596575829049145 - -25.866060090958513 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 132.8019872469463 - 146.1533406452311 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype488 - - - - org.contikios.cooja.interfaces.Position - 0.026556260457749753 - 39.54055615854325 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 95.52021598473031 - 148.11553913271615 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 62.81690785997944 - 127.1854219328756 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 32.07579822271361 - 102.33090775806494 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 5.913151722912886 - 73.55199660828417 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype352 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype32 - - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 0.9555608221893928 0.0 0.0 0.9555608221893928 177.34962387792274 139.71659364731656 - - 400 - 1 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 3 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 0 - 596 - 603 - 43 - - diff --git a/tests/15-rpl-classic/02-rpl-root-reboot-2.csc b/tests/15-rpl-classic/02-rpl-root-reboot-2.csc deleted file mode 100644 index 6de8e9583..000000000 --- a/tests/15-rpl-classic/02-rpl-root-reboot-2.csc +++ /dev/null @@ -1,294 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 10.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype512 - mote - [CONTIKI_DIR]/examples/libs/shell/example.c - make example.cooja TARGET=cooja MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC -j - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 50.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype512 - - - - org.contikios.cooja.interfaces.Position - 100.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype512 - - - - org.contikios.cooja.interfaces.Position - 150.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - ip-addr~;routes~;routing~; - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype512 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype512 - - - - org.contikios.cooja.plugins.SimControl - 280 - 0 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 0.9090909090909091 0.0 0.0 0.9090909090909091 125.81818181818181 173.0 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 604 - 3 - 784 - 400 - 160 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 944 - 1 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 617 - 2 - 785 - 1007 - 160 - - - diff --git a/tests/15-rpl-classic/02-rpl-root-reboot.csc b/tests/15-rpl-classic/02-rpl-root-reboot.csc deleted file mode 100644 index 2c89a499e..000000000 --- a/tests/15-rpl-classic/02-rpl-root-reboot.csc +++ /dev/null @@ -1,342 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype958 - Sender - [CONFIG_DIR]/code/sender-node.c - make TARGET=cooja clean -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype837 - RPL root - [CONFIG_DIR]/code/root-node.c - make TARGET=cooja clean -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype358 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make TARGET=cooja clean -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -22.5728586847096 - 123.9358664968653 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype358 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype958 - - - - org.contikios.cooja.interfaces.Position - -1.39303771455413 - 100.21446701029119 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype358 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype358 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype358 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype358 - - - - org.contikios.cooja.interfaces.Position - 10.931583432822638 - 69.848248459216 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype358 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype837 - - - - org.contikios.cooja.plugins.SimControl - 280 - 0 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 3 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 1 - 596 - 603 - 43 - - diff --git a/tests/15-rpl-classic/03-rpl-28-hours.csc b/tests/15-rpl-classic/03-rpl-28-hours.csc deleted file mode 100644 index a4c25cc08..000000000 --- a/tests/15-rpl-classic/03-rpl-28-hours.csc +++ /dev/null @@ -1,291 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype110 - Sender - [CONFIG_DIR]/code/sender-node.c - make TARGET=cooja clean -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype792 - RPL root - [CONFIG_DIR]/code/root-node.c - make TARGET=cooja clean -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype964 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make TARGET=cooja clean -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 7.772906112657773 - 86.396910401861 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype964 - - - - org.contikios.cooja.interfaces.Position - 75.54361692539452 - 14.292026223193414 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype110 - - - - org.contikios.cooja.interfaces.Position - 47.962513687652844 - 7.199742533488408 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype964 - - - - org.contikios.cooja.interfaces.Position - 1.8626697045702818 - 47.783365869022624 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype964 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype792 - - - - org.contikios.cooja.plugins.SimControl - 280 - 0 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 78.27260101976275 40.72727272727276 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 3 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 1 - 596 - 603 - 43 - - diff --git a/tests/15-rpl-classic/05-rpl-up-and-down-routes-non-storing.csc b/tests/15-rpl-classic/05-rpl-up-and-down-routes-non-storing.csc deleted file mode 100644 index aa412586b..000000000 --- a/tests/15-rpl-classic/05-rpl-up-and-down-routes-non-storing.csc +++ /dev/null @@ -1,341 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/collect-view - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype743 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja DEFINES=RPL_CONF_MOP=RPL_MOP_NON_STORING - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype452 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja DEFINES=RPL_CONF_MOP=RPL_MOP_NON_STORING - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype782 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja DEFINES=RPL_CONF_MOP=RPL_MOP_NON_STORING - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -22.5728586847096 - 123.9358664968653 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype743 - - - - org.contikios.cooja.interfaces.Position - -1.39303771455413 - 100.21446701029119 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 10.931583432822638 - 69.848248459216 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype452 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - 1184 - 3 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 0 - 596 - 603 - 43 - - diff --git a/tests/15-rpl-classic/05-rpl-up-and-down-routes.csc b/tests/15-rpl-classic/05-rpl-up-and-down-routes.csc deleted file mode 100644 index 49e793691..000000000 --- a/tests/15-rpl-classic/05-rpl-up-and-down-routes.csc +++ /dev/null @@ -1,340 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype743 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype452 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype782 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -22.5728586847096 - 123.9358664968653 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype743 - - - - org.contikios.cooja.interfaces.Position - -1.39303771455413 - 100.21446701029119 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 10.931583432822638 - 69.848248459216 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype782 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype452 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - 1184 - 3 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 0 - 596 - 603 - 43 - - diff --git a/tests/15-rpl-classic/06-rpl-temporary-root-loss.csc b/tests/15-rpl-classic/06-rpl-temporary-root-loss.csc deleted file mode 100644 index 9bbf552d5..000000000 --- a/tests/15-rpl-classic/06-rpl-temporary-root-loss.csc +++ /dev/null @@ -1,346 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype951 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype170 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype767 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -22.5728586847096 - 123.9358664968653 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype951 - - - - org.contikios.cooja.interfaces.Position - -1.39303771455413 - 100.21446701029119 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 10.931583432822638 - 69.848248459216 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype767 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype170 - - - - org.contikios.cooja.plugins.SimControl - 280 - 0 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - 1184 - 3 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 1 - 596 - 603 - 43 - - diff --git a/tests/15-rpl-classic/07-rpl-random-rearrangement.csc b/tests/15-rpl-classic/07-rpl-random-rearrangement.csc deleted file mode 100644 index 6119c6829..000000000 --- a/tests/15-rpl-classic/07-rpl-random-rearrangement.csc +++ /dev/null @@ -1,646 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype419 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype484 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype718 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -0.4799968467515439 - 98.79087181374759 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 99.56423154395364 - 50.06466731257512 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype419 - - - - org.contikios.cooja.interfaces.Position - -0.4799968467515439 - 0.30173505605854883 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype484 - - - - org.contikios.cooja.interfaces.Position - 12.779318616702257 - 8.464865358169643 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 9.391922400291703 - 49.22878206790311 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 48.16367625505583 - 33.27520746599595 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 16.582742473429345 - 24.932911331640646 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 8.445564421140666 - 6.770205395698742 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 87.04968129458189 - 34.46536562612724 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 9 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 94.47123252519145 - 18.275940194868184 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 10 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 95.28044254364556 - 17.683438211793558 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 11 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 56.124622439456076 - 33.88966252832571 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 12 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 98.33149749474546 - 37.448034626592744 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 13 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 58.75337436025891 - 68.64082018992522 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 14 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 66.83816496627988 - 68.38008376830592 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 15 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 90.88648665466316 - 50.942053906416575 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 16 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 68.80089833632896 - 84.17294684073734 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 17 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 73.6760846183129 - 81.76699743886633 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 18 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 0.2960103456537466 - 98.5587829617092 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 19 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 8.130479493904208 - 57.642099520821645 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 20 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 30.550120982984865 - 85.58346736403402 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 21 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 29.65300377698182 - 63.50257213104861 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 22 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.interfaces.Position - 34.92110687576687 - 70.71381297232249 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 23 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype718 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 1.92914676942954 0.0 0.0 1.92914676942954 75.9259843662471 55.41790879138101 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 3 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 0 - 726 - 953 - 43 - - diff --git a/tests/15-rpl-classic/08-rpl-dao-route-loss-0.csc b/tests/15-rpl-classic/08-rpl-dao-route-loss-0.csc deleted file mode 100644 index bd1114c50..000000000 --- a/tests/15-rpl-classic/08-rpl-dao-route-loss-0.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype921 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype873 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype812 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype921 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype812 - - - - org.contikios.cooja.interfaces.Position - -40.352178879596096 - 102.66976131212861 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype873 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 1.6480321712565114 0.0 0.0 1.6480321712565114 98.5016889738719 55.796930342384904 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 1 - 726 - 953 - 43 - - diff --git a/tests/15-rpl-classic/08-rpl-dao-route-loss-1.csc b/tests/15-rpl-classic/08-rpl-dao-route-loss-1.csc deleted file mode 100644 index cc1fd3970..000000000 --- a/tests/15-rpl-classic/08-rpl-dao-route-loss-1.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype672 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype780 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype36 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype672 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - -25.71843353317142 - 43.05517674255262 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype780 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 - - 400 - 2 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 1 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 0 - 726 - 953 - 43 - - diff --git a/tests/15-rpl-classic/08-rpl-dao-route-loss-2.csc b/tests/15-rpl-classic/08-rpl-dao-route-loss-2.csc deleted file mode 100644 index f659b4e04..000000000 --- a/tests/15-rpl-classic/08-rpl-dao-route-loss-2.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype672 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype780 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype36 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype672 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 16.0472370839803 - 6.017695251870905 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype780 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 1 - 726 - 953 - 43 - - diff --git a/tests/15-rpl-classic/08-rpl-dao-route-loss-3.csc b/tests/15-rpl-classic/08-rpl-dao-route-loss-3.csc deleted file mode 100644 index a3e38edac..000000000 --- a/tests/15-rpl-classic/08-rpl-dao-route-loss-3.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype672 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype780 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype36 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype672 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype36 - - - - org.contikios.cooja.interfaces.Position - 79.48377453078622 - 4.835647970253402 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype780 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 70.27260101976269 60.72727272727276 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 1 - 726 - 953 - 43 - - diff --git a/tests/15-rpl-classic/08-rpl-dao-route-loss-4.csc b/tests/15-rpl-classic/08-rpl-dao-route-loss-4.csc deleted file mode 100644 index 11a0f3168..000000000 --- a/tests/15-rpl-classic/08-rpl-dao-route-loss-4.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype192 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype575 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype912 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype192 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype912 - - - - org.contikios.cooja.interfaces.Position - 122.82550819009461 - 29.658640884220933 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype575 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.5379695437350276 0.0 0.0 2.5379695437350276 70.27260101976269 60.72727272727276 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 1 - 726 - 953 - 43 - - diff --git a/tests/15-rpl-classic/08-rpl-dao-route-loss-5.csc b/tests/15-rpl-classic/08-rpl-dao-route-loss-5.csc deleted file mode 100644 index 0a0308e22..000000000 --- a/tests/15-rpl-classic/08-rpl-dao-route-loss-5.csc +++ /dev/null @@ -1,358 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype372 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype229 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype424 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - -7.199692787830563 - 98.21738321803603 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 116.13379149678028 - 88.36698920455684 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype372 - - - - org.contikios.cooja.interfaces.Position - 12.0 - 68.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 95.25095618820441 - 63.14998053005015 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 66.09378990830604 - 38.32698761608261 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 29.05630841762433 - 30.840688165838436 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 58.0 - 108.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype424 - - - - org.contikios.cooja.interfaces.Position - 145.93059238811136 - 111.16474110935306 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype229 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 1.6480321712565114 0.0 0.0 1.6480321712565114 98.5016889738719 55.796930342384904 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 500 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 612 - 1 - 726 - 953 - 43 - - diff --git a/tests/15-rpl-classic/09-rpl-probing.csc b/tests/15-rpl-classic/09-rpl-probing.csc deleted file mode 100644 index d79ec7be4..000000000 --- a/tests/15-rpl-classic/09-rpl-probing.csc +++ /dev/null @@ -1,254 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype190 - Sender - [CONFIG_DIR]/code/sender-node.c - make clean TARGET=cooja -make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype481 - RPL root - [CONFIG_DIR]/code/root-node.c - make clean TARGET=cooja -make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype692 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make clean TARGET=cooja -make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 8.0 - 2.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype481 - - - - org.contikios.cooja.interfaces.Position - -7.19071602882406 - 34.96668248624779 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype190 - - - - org.contikios.cooja.interfaces.Position - -17.870288882812428 - 4.581754854333804 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype692 - - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 2.494541140753371 0.0 0.0 2.494541140753371 168.25302383129448 116.2254386098645 - - 400 - 3 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 597 - 0 - 428 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 605 - 1 - 684 - 604 - 14 - - diff --git a/tests/15-rpl-classic/10-rpl-multi-dodag.csc b/tests/15-rpl-classic/10-rpl-multi-dodag.csc deleted file mode 100644 index 7d48ae7b4..000000000 --- a/tests/15-rpl-classic/10-rpl-multi-dodag.csc +++ /dev/null @@ -1,387 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - [APPS_DIR]/serial2pty - [APPS_DIR]/radiologger-headless - - My simulation - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype301 - Sender - [CONFIG_DIR]/code/sender-node.c - make -j sender-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype820 - RPL root - [CONFIG_DIR]/code/root-node.c - make -j root-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype306 - Receiver - [CONFIG_DIR]/code/receiver-node.c - make -j receiver-node.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 9.767954940345236 - 88.75813939592845 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype306 - - - - org.contikios.cooja.interfaces.Position - 63.36720084537501 - 75.88456991067605 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype301 - - - - org.contikios.cooja.interfaces.Position - -20.684049350551753 - 60.49767834794315 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 6 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype306 - - - - org.contikios.cooja.interfaces.Position - 64.61229064867878 - 39.88729002781773 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype306 - - - - org.contikios.cooja.interfaces.Position - 37.157272454309606 - 19.60335867526139 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype306 - - - - org.contikios.cooja.interfaces.Position - -21.976612887408603 - 30.69884249204435 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 5 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype306 - - - - org.contikios.cooja.interfaces.Position - 43 - 98 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 7 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype820 - - - - org.contikios.cooja.interfaces.Position - 0.0 - 0.0 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 8 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - mtype820 - - - - org.contikios.cooja.plugins.SimControl - 280 - 3 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 1.7624788498159916 0.0 0.0 1.7624788498159916 97.6893062637241 8.72727272727273 - - 400 - 0 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1184 - 2 - 240 - 402 - 162 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 904 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 962 - 1 - 596 - 603 - 43 - - diff --git a/tests/15-rpl-classic/Makefile b/tests/15-rpl-classic/Makefile deleted file mode 100644 index 272bc7da1..000000000 --- a/tests/15-rpl-classic/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../Makefile.simulation-test diff --git a/tests/15-rpl-classic/code/Makefile b/tests/15-rpl-classic/code/Makefile deleted file mode 100644 index 40155b343..000000000 --- a/tests/15-rpl-classic/code/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -all: sender-node receiver-node root-node -CONTIKI=../../.. - -MAKE_ROUTING = MAKE_ROUTING_RPL_CLASSIC -include $(CONTIKI)/Makefile.include diff --git a/tests/15-rpl-classic/code/project-conf.h b/tests/15-rpl-classic/code/project-conf.h deleted file mode 100644 index d6cd59471..000000000 --- a/tests/15-rpl-classic/code/project-conf.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, Inria. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 TCPIP_CONF_ANNOTATE_TRANSMISSIONS 1 diff --git a/tests/15-rpl-classic/code/receiver-node.c b/tests/15-rpl-classic/code/receiver-node.c deleted file mode 100644 index 3854784d0..000000000 --- a/tests/15-rpl-classic/code/receiver-node.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, www.thingsquare.com. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-ds6-route.h" -#include "net/ipv6/uip-debug.h" - -#include "simple-udp.h" - -#include "net/routing/routing.h" -#include "dev/leds.h" - -#include -#include - -#define UDP_PORT 1234 - -static struct simple_udp_connection unicast_connection; - -/*---------------------------------------------------------------------------*/ -PROCESS(receiver_node_process, "Receiver node"); -AUTOSTART_PROCESSES(&receiver_node_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Data received from "); - uip_debug_ipaddr_print(sender_addr); - printf(" on port %d from port %d with length %d: '%s'\n", - receiver_port, sender_port, datalen, data); -} -/*---------------------------------------------------------------------------*/ -static uip_ipaddr_t * -set_global_address(void) -{ - static uip_ipaddr_t ipaddr; - int i; - uint8_t state; - const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix(); - - uip_ip6addr_copy(&ipaddr, default_prefix); - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - - printf("IPv6 addresses: "); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr); - printf("\n"); - } - } - - return &ipaddr; -} -/*---------------------------------------------------------------------------*/ -#if RPL_WITH_STORING -uint8_t should_blink = 1; -static void -route_callback(int event, const uip_ipaddr_t *route, const uip_ipaddr_t *ipaddr, int num_routes) -{ - if(event == UIP_DS6_NOTIFICATION_DEFRT_ADD) { - should_blink = 0; - } else if(event == UIP_DS6_NOTIFICATION_DEFRT_RM) { - should_blink = 1; - } -} -#endif /* #if RPL_WITH_STORING */ -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(receiver_node_process, ev, data) -{ - static struct etimer et; -#if RPL_WITH_STORING - static struct uip_ds6_notification n; -#endif /* #if RPL_WITH_STORING */ - - PROCESS_BEGIN(); - - set_global_address(); - -#if RPL_WITH_STORING - uip_ds6_notification_add(&n, route_callback); -#endif /* #if RPL_WITH_STORING */ - - simple_udp_register(&unicast_connection, UDP_PORT, - NULL, UDP_PORT, receiver); - - etimer_set(&et, CLOCK_SECOND); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - etimer_reset(&et); -#if RPL_WITH_STORING - if(should_blink) { - leds_on(LEDS_ALL); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - leds_off(LEDS_ALL); - } -#endif /* #if RPL_WITH_STORING */ - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/15-rpl-classic/code/root-node.c b/tests/15-rpl-classic/code/root-node.c deleted file mode 100644 index e25b2872f..000000000 --- a/tests/15-rpl-classic/code/root-node.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, www.thingsquare.com. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-debug.h" -#include "net/routing/routing.h" -#include "simple-udp.h" - -#include -#include - -#define UDP_PORT 1234 -#define SERVICE_ID 190 - -#define SEND_INTERVAL (10 * CLOCK_SECOND) -#define SEND_TIME (random_rand() % (SEND_INTERVAL)) - -static struct simple_udp_connection unicast_connection; - -/*---------------------------------------------------------------------------*/ -PROCESS(unicast_receiver_process, "Unicast receiver example process"); -AUTOSTART_PROCESSES(&unicast_receiver_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Data received from "); - uip_debug_ipaddr_print(sender_addr); - printf(" on port %d from port %d with length %d: '%s'\n", - receiver_port, sender_port, datalen, data); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(unicast_receiver_process, ev, data) -{ - PROCESS_BEGIN(); - - NETSTACK_ROUTING.root_start(); - - simple_udp_register(&unicast_connection, UDP_PORT, - NULL, UDP_PORT, receiver); - - while(1) { - PROCESS_WAIT_EVENT(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/15-rpl-classic/code/sender-node.c b/tests/15-rpl-classic/code/sender-node.c deleted file mode 100644 index 00bd6d5c5..000000000 --- a/tests/15-rpl-classic/code/sender-node.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2012, Thingsquare, www.thingsquare.com. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 "contiki.h" -#include "lib/random.h" -#include "sys/ctimer.h" -#include "sys/etimer.h" -#include "net/ipv6/uip.h" -#include "net/ipv6/uip-ds6.h" -#include "net/ipv6/uip-debug.h" - -#include "simple-udp.h" - -#include -#include - -#define UDP_PORT 1234 - -#define SEND_INTERVAL (60 * CLOCK_SECOND) -#define SEND_TIME (random_rand() % (SEND_INTERVAL)) - -static struct simple_udp_connection unicast_connection; - -/*---------------------------------------------------------------------------*/ -PROCESS(sender_node_process, "Sender node process"); -AUTOSTART_PROCESSES(&sender_node_process); -/*---------------------------------------------------------------------------*/ -static void -receiver(struct simple_udp_connection *c, - const uip_ipaddr_t *sender_addr, - uint16_t sender_port, - const uip_ipaddr_t *receiver_addr, - uint16_t receiver_port, - const uint8_t *data, - uint16_t datalen) -{ - printf("Sender received data on port %d from port %d with length %d\n", - receiver_port, sender_port, datalen); -} -/*---------------------------------------------------------------------------*/ -static void -set_global_address(void) -{ - uip_ipaddr_t ipaddr; - int i; - uint8_t state; - const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix(); - - uip_ip6addr_copy(&ipaddr, default_prefix); - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - - printf("IPv6 addresses: "); - for(i = 0; i < UIP_DS6_ADDR_NB; i++) { - state = uip_ds6_if.addr_list[i].state; - if(uip_ds6_if.addr_list[i].isused && - (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { - uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr); - printf("\n"); - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sender_node_process, ev, data) -{ - static struct etimer periodic_timer; - static struct etimer send_timer; - uip_ipaddr_t addr; - const uip_ipaddr_t *default_prefix; - - PROCESS_BEGIN(); - - set_global_address(); - - simple_udp_register(&unicast_connection, UDP_PORT, - NULL, UDP_PORT, receiver); - - etimer_set(&periodic_timer, SEND_INTERVAL); - while(1) { - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer)); - etimer_reset(&periodic_timer); - etimer_set(&send_timer, SEND_TIME); - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&send_timer)); - - default_prefix = uip_ds6_default_prefix(); - uip_ip6addr_copy(&addr, default_prefix); - - addr.u16[4] = UIP_HTONS(0x0201); - addr.u16[5] = UIP_HTONS(0x0001); - addr.u16[6] = UIP_HTONS(0x0001); - addr.u16[7] = UIP_HTONS(0x0001); - - { - static unsigned int message_number; - char buf[20]; - - printf("Sending unicast to "); - uip_debug_ipaddr_print(&addr); - printf("\n"); - sprintf(buf, "Message %d", message_number); - message_number++; - simple_udp_sendto(&unicast_connection, buf, strlen(buf) + 1, &addr); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/tests/17-tun-rpl-br/01-border-router-cooja.csc b/tests/17-tun-rpl-br/01-border-router-cooja.csc deleted file mode 100644 index b0d95600a..000000000 --- a/tests/17-tun-rpl-br/01-border-router-cooja.csc +++ /dev/null @@ -1,252 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype295 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/rpl-border-router/border-router.c - make TARGET=cooja clean -make -j border-router.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype686 - Cooja Mote Type #2 - [CONTIKI_DIR]/examples/hello-world/hello-world.c - make TARGET=cooja clean -make -j hello-world.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 54.36775767371176 - 24.409055040864118 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype295 - - - - org.contikios.cooja.interfaces.Position - 83.54989222799365 - 52.63050856506214 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 108.91767775240822 - 78.59778809170032 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 139.91021061864723 - 98.34190023350419 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.IDVisualizerSkin - 1.9798610460263038 0.0 0.0 1.9798610460263038 -61.112037797038525 -1.2848438586294648 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - ID:4 - - - - 1404 - 2 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - - - - 500.0 - - 1804 - 6 - 166 - 0 - 753 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1124 - 5 - 160 - 680 - 0 - - - org.contikios.cooja.serialsocket.SerialSocketServer - 0 - - 60001 - true - - 362 - 3 - 116 - 13 - 414 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 1037 - 40 - - diff --git a/tests/17-tun-rpl-br/01-border-router-cooja.sh b/tests/17-tun-rpl-br/01-border-router-cooja.sh deleted file mode 100755 index a91e5905b..000000000 --- a/tests/17-tun-rpl-br/01-border-router-cooja.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Contiki directory -CONTIKI=$1 - -# Simulation file -BASENAME=$(basename $0 .sh) - -bash test-border-router.sh $CONTIKI $BASENAME fd00::204:4:4:4 60 diff --git a/tests/17-tun-rpl-br/02-border-router-cooja-tsch.csc b/tests/17-tun-rpl-br/02-border-router-cooja-tsch.csc deleted file mode 100644 index 61a6c96ce..000000000 --- a/tests/17-tun-rpl-br/02-border-router-cooja-tsch.csc +++ /dev/null @@ -1,252 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype295 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/rpl-border-router/border-router.c - make TARGET=cooja clean -make -j border-router.cooja TARGET=cooja MAKE_MAC=MAKE_MAC_TSCH - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype686 - Cooja Mote Type #2 - [CONTIKI_DIR]/examples/hello-world/hello-world.c - make TARGET=cooja clean -make -j hello-world.cooja TARGET=cooja MAKE_MAC=MAKE_MAC_TSCH - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 54.36775767371176 - 24.409055040864118 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype295 - - - - org.contikios.cooja.interfaces.Position - 83.54989222799365 - 52.63050856506214 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 108.91767775240822 - 78.59778809170032 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 139.91021061864723 - 98.34190023350419 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.IDVisualizerSkin - 1.9798610460263038 0.0 0.0 1.9798610460263038 -61.112037797038525 -1.2848438586294648 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - ID:4 - - - - 1404 - 2 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - - - - 500.0 - - 1804 - 6 - 166 - 0 - 753 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1124 - 5 - 160 - 680 - 0 - - - org.contikios.cooja.serialsocket.SerialSocketServer - 0 - - 60001 - true - - 362 - 3 - 116 - 13 - 414 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 1037 - 40 - - diff --git a/tests/17-tun-rpl-br/02-border-router-cooja-tsch.sh b/tests/17-tun-rpl-br/02-border-router-cooja-tsch.sh deleted file mode 100755 index 760432c10..000000000 --- a/tests/17-tun-rpl-br/02-border-router-cooja-tsch.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Contiki directory -CONTIKI=$1 - -# Simulation file -BASENAME=$(basename $0 .sh) - -# Add a little extra initial time to account for TSCH association time -bash test-border-router.sh $CONTIKI $BASENAME fd00::204:4:4:4 120 diff --git a/tests/17-tun-rpl-br/03-border-router-sky.csc b/tests/17-tun-rpl-br/03-border-router-sky.csc deleted file mode 100644 index e19573d8d..000000000 --- a/tests/17-tun-rpl-br/03-border-router-sky.csc +++ /dev/null @@ -1,236 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #sky1 - [CONTIKI_DIR]/examples/rpl-border-router/border-router.c - make clean TARGET=sky -make -j border-router.sky TARGET=sky - [CONTIKI_DIR]/examples/rpl-border-router/border-router.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - org.contikios.cooja.mspmote.SkyMoteType - sky2 - Sky Mote Type #sky2 - [CONTIKI_DIR]/examples/hello-world/hello-world.c - make clean TARGET=sky -make -j hello-world.sky TARGET=sky - [CONTIKI_DIR]/examples/hello-world/hello-world.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.Msp802154Radio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - -24.750327773354453 - 17.688901393447438 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 1.091493067677618 - 40.943504236660225 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 22.647678967805337 - 61.6365018442491 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 44.02005813888037 - 93.02398317771755 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspClock - 1.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - sky2 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 2.3610941331949244 0.0 0.0 2.3610941331949244 119.38219749746548 -4.52452305190821 - - 400 - 3 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - - 1404 - 6 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - - - - 500.0 - - 1804 - 5 - 166 - 0 - 742 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1124 - 4 - 160 - 680 - 0 - - - org.contikios.cooja.serialsocket.SerialSocketServer - 0 - - 60001 - true - - 362 - 2 - 116 - 30 - 403 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 850 - 13 - - diff --git a/tests/17-tun-rpl-br/03-border-router-sky.sh b/tests/17-tun-rpl-br/03-border-router-sky.sh deleted file mode 100755 index 9bdd86111..000000000 --- a/tests/17-tun-rpl-br/03-border-router-sky.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Contiki directory -CONTIKI=$1 - -# Simulation file -BASENAME=$(basename $0 .sh) - -bash test-border-router.sh $CONTIKI $BASENAME fd00::0212:7404:0004:0404 60 diff --git a/tests/17-tun-rpl-br/04-border-router-traceroute.csc b/tests/17-tun-rpl-br/04-border-router-traceroute.csc deleted file mode 100644 index b0d95600a..000000000 --- a/tests/17-tun-rpl-br/04-border-router-traceroute.csc +++ /dev/null @@ -1,252 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype295 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/rpl-border-router/border-router.c - make TARGET=cooja clean -make -j border-router.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype686 - Cooja Mote Type #2 - [CONTIKI_DIR]/examples/hello-world/hello-world.c - make TARGET=cooja clean -make -j hello-world.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 54.36775767371176 - 24.409055040864118 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype295 - - - - org.contikios.cooja.interfaces.Position - 83.54989222799365 - 52.63050856506214 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 108.91767775240822 - 78.59778809170032 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 139.91021061864723 - 98.34190023350419 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.IDVisualizerSkin - 1.9798610460263038 0.0 0.0 1.9798610460263038 -61.112037797038525 -1.2848438586294648 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - ID:4 - - - - 1404 - 2 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - - - - 500.0 - - 1804 - 6 - 166 - 0 - 753 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1124 - 5 - 160 - 680 - 0 - - - org.contikios.cooja.serialsocket.SerialSocketServer - 0 - - 60001 - true - - 362 - 3 - 116 - 13 - 414 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 1037 - 40 - - diff --git a/tests/17-tun-rpl-br/04-border-router-traceroute.sh b/tests/17-tun-rpl-br/04-border-router-traceroute.sh deleted file mode 100755 index 611140248..000000000 --- a/tests/17-tun-rpl-br/04-border-router-traceroute.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -source ../utils.sh - -# Contiki directory -CONTIKI=$1 - -# Simulation file -BASENAME=$(basename $0 .sh) - -# Destination IPv6 -IPADDR=fd00::204:4:4:4 - -# Time allocated for toplogy formation -WAIT_TIME=60 - -# The expected hop count -TARGETHOPS=4 - -# Start simulation -echo "Starting Cooja simulation $BASENAME.csc" -java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$BASENAME.csc -contiki=$CONTIKI > $BASENAME.coojalog & -JPID=$! -sleep 20 - -# Connect to the simulation -echo "Starting tunslip6" -make -C $CONTIKI/examples/rpl-border-router/ connect-router-cooja TARGET=zoul >> $BASENAME.tunslip6.log 2>&1 & -MPID=$! -printf "Waiting for network formation (%d seconds)\n" "$WAIT_TIME" -sleep $WAIT_TIME - -# Do ping -echo "Running Traceroute" -traceroute6 $IPADDR -m 5 | tee $BASENAME.scriptlog -# Fetch traceroute6 status code (not $? because this is piped) -STATUS=${PIPESTATUS[0]} -HOPS=`wc $BASENAME.scriptlog -l | cut -f 1 -d ' '` - -echo "Closing simulation and tunslip6" -sleep 1 -kill_bg $JPID -kill_bg $MPID -sleep 1 -rm COOJA.testlog -rm COOJA.log - -if [ $STATUS -eq 0 ] && [ $HOPS -eq $TARGETHOPS ] ; then - printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog; -else - echo "==== $BASENAME.coojalog ====" ; cat $BASENAME.coojalog; - echo "==== $BASENAME.tunslip6.log ====" ; cat $BASENAME.tunslip6.log; - echo "==== $BASENAME.scriptlog ====" ; cat $BASENAME.scriptlog; - - printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog; -fi - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end - -exit 0 diff --git a/tests/17-tun-rpl-br/05-native-ping.sh b/tests/17-tun-rpl-br/05-native-ping.sh deleted file mode 100755 index 6bb53ccd8..000000000 --- a/tests/17-tun-rpl-br/05-native-ping.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -source ../utils.sh - -# Contiki directory -CONTIKI=$1 -# Test basename -BASENAME=$(basename $0 .sh) - -IPADDR=fd00::302:304:506:708 - -# Starting Contiki-NG native node -echo "Starting native node" -make -C $CONTIKI/examples/hello-world > make.log 2> make.err -sudo $CONTIKI/examples/hello-world/hello-world.native > node.log 2> node.err & -CPID=$! -sleep 2 - -# Do ping -echo "Pinging" -ping6 $IPADDR -c 5 | tee $BASENAME.log -# Fetch ping6 status code (not $? because this is piped) -STATUS=${PIPESTATUS[0]} - -echo "Closing native node" -sleep 2 -kill_bg $CPID - -if [ $STATUS -eq 0 ] ; then - cp $BASENAME.log $BASENAME.testlog - printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog; -else - echo "==== make.log ====" ; cat make.log; - echo "==== make.err ====" ; cat make.err; - echo "==== node.log ====" ; cat node.log; - echo "==== node.err ====" ; cat node.err; - echo "==== $BASENAME.log ====" ; cat $BASENAME.log; - - printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog; -fi - -rm make.log -rm make.err -rm node.log -rm node.err - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end -exit 0 diff --git a/tests/17-tun-rpl-br/06-native-coap.sh b/tests/17-tun-rpl-br/06-native-coap.sh deleted file mode 100755 index 4c1925699..000000000 --- a/tests/17-tun-rpl-br/06-native-coap.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -source ../utils.sh - -# Contiki directory -CONTIKI=$1 -# Test basename -BASENAME=$(basename $0 .sh) - -IPADDR=fd00::302:304:506:708 - -declare -i OKCOUNT=0 -declare -i TESTCOUNT=0 - -# Starting Contiki-NG native node -echo "Starting native CoAP server" -make -C $CONTIKI/examples/coap/coap-example-server > make.log 2> make.err -sudo $CONTIKI/examples/coap/coap-example-server/coap-example-server.native > node.log 2> node.err & -CPID=$! -sleep 2 - -# Send CoAP requests -echo "Sending CoAP requests" - -rm -f $BASENAME.log -for TARGET in .well-known/core test/push; do - echo "Get $TARGET" | tee -a $BASENAME.log - coap get coap://[$IPADDR]/$TARGET 2>&1 | tee coap.log - cat coap.log >> $BASENAME.log - # Fetch coap status code (not $? because this is piped) - SUCCESS=`grep -c '(2.05)' coap.log` - if [ $SUCCESS == 1 ]; then - printf "> OK\n" - OKCOUNT+=1 - else - printf "> FAIL\n" - fi - TESTCOUNT+=1 -done - -echo "Closing native node" -sleep 2 -kill_bg $CPID - -if [ $TESTCOUNT -eq $OKCOUNT ] ; then - printf "%-32s TEST OK %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" | tee $BASENAME.testlog; -else - echo "==== make.log ====" ; cat make.log; - echo "==== make.err ====" ; cat make.err; - echo "==== node.log ====" ; cat node.log; - echo "==== node.err ====" ; cat node.err; - echo "==== $BASENAME.log ====" ; cat $BASENAME.log; - - printf "%-32s TEST FAIL %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" | tee $BASENAME.testlog; -fi - -rm -f make.log make.err node.log node.err coap.log - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end -exit 0 diff --git a/tests/17-tun-rpl-br/07-native-border-router-cooja.csc b/tests/17-tun-rpl-br/07-native-border-router-cooja.csc deleted file mode 100644 index 7140d183c..000000000 --- a/tests/17-tun-rpl-br/07-native-border-router-cooja.csc +++ /dev/null @@ -1,254 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype295 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/slip-radio/slip-radio.c - make TARGET=cooja clean -make -j slip-radio.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype686 - Cooja Mote Type #2 - [CONTIKI_DIR]/examples/hello-world/hello-world.c - make TARGET=cooja clean -make -j hello-world.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 54.36775767371176 - 24.409055040864118 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype295 - - - - org.contikios.cooja.interfaces.Position - 83.54989222799365 - 52.63050856506214 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 108.91767775240822 - 78.59778809170032 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 139.91021061864723 - 98.34190023350419 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.IDVisualizerSkin - 1.9798610460263038 0.0 0.0 1.9798610460263038 -61.112037797038525 -1.2848438586294648 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - ID:4 - - - - 1404 - 2 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - - - - 500.0 - - 1804 - 6 - 166 - 0 - 753 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1124 - 5 - 160 - 680 - 0 - - - org.contikios.cooja.serialsocket.SerialSocketServer - 0 - - 60001 - true - - 362 - 3 - 116 - 13 - 414 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 1037 - 40 - - diff --git a/tests/17-tun-rpl-br/07-native-border-router-cooja.sh b/tests/17-tun-rpl-br/07-native-border-router-cooja.sh deleted file mode 100755 index c239e4e98..000000000 --- a/tests/17-tun-rpl-br/07-native-border-router-cooja.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Contiki directory -CONTIKI=$1 - -# Simulation file -BASENAME=$(basename $0 .sh) - -bash test-native-border-router.sh $CONTIKI $BASENAME fd00::204:4:4:4 60 diff --git a/tests/17-tun-rpl-br/08-border-router-cooja-frag.csc b/tests/17-tun-rpl-br/08-border-router-cooja-frag.csc deleted file mode 100644 index b0d95600a..000000000 --- a/tests/17-tun-rpl-br/08-border-router-cooja-frag.csc +++ /dev/null @@ -1,252 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype295 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/rpl-border-router/border-router.c - make TARGET=cooja clean -make -j border-router.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype686 - Cooja Mote Type #2 - [CONTIKI_DIR]/examples/hello-world/hello-world.c - make TARGET=cooja clean -make -j hello-world.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 54.36775767371176 - 24.409055040864118 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype295 - - - - org.contikios.cooja.interfaces.Position - 83.54989222799365 - 52.63050856506214 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 108.91767775240822 - 78.59778809170032 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 139.91021061864723 - 98.34190023350419 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.IDVisualizerSkin - 1.9798610460263038 0.0 0.0 1.9798610460263038 -61.112037797038525 -1.2848438586294648 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - ID:4 - - - - 1404 - 2 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - - - - 500.0 - - 1804 - 6 - 166 - 0 - 753 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1124 - 5 - 160 - 680 - 0 - - - org.contikios.cooja.serialsocket.SerialSocketServer - 0 - - 60001 - true - - 362 - 3 - 116 - 13 - 414 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 1037 - 40 - - diff --git a/tests/17-tun-rpl-br/08-border-router-cooja-frag.sh b/tests/17-tun-rpl-br/08-border-router-cooja-frag.sh deleted file mode 100755 index 0d308acb6..000000000 --- a/tests/17-tun-rpl-br/08-border-router-cooja-frag.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Contiki directory -CONTIKI=$1 - -# Simulation file -BASENAME=$(basename $0 .sh) - -bash test-border-router.sh $CONTIKI $BASENAME fd00::204:4:4:4 60 1200 4 diff --git a/tests/17-tun-rpl-br/09-native-border-router-cooja-frag.csc b/tests/17-tun-rpl-br/09-native-border-router-cooja-frag.csc deleted file mode 100644 index 7140d183c..000000000 --- a/tests/17-tun-rpl-br/09-native-border-router-cooja-frag.csc +++ /dev/null @@ -1,254 +0,0 @@ - - - [APPS_DIR]/mrm - [APPS_DIR]/mspsim - [APPS_DIR]/avrora - [APPS_DIR]/serial_socket - [APPS_DIR]/powertracker - - My simulation - 1.0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype295 - Cooja Mote Type #1 - [CONTIKI_DIR]/examples/slip-radio/slip-radio.c - make TARGET=cooja clean -make -j slip-radio.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype686 - Cooja Mote Type #2 - [CONTIKI_DIR]/examples/hello-world/hello-world.c - make TARGET=cooja clean -make -j hello-world.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 54.36775767371176 - 24.409055040864118 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype295 - - - - org.contikios.cooja.interfaces.Position - 83.54989222799365 - 52.63050856506214 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 108.91767775240822 - 78.59778809170032 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 3 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.interfaces.Position - 139.91021061864723 - 98.34190023350419 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 4 - - - org.contikios.cooja.contikimote.interfaces.ContikiRadio - 250.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiEEPROM - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - mtype686 - - - - org.contikios.cooja.plugins.SimControl - 280 - 1 - 160 - 400 - 0 - - - org.contikios.cooja.plugins.Visualizer - - true - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.IDVisualizerSkin - 1.9798610460263038 0.0 0.0 1.9798610460263038 -61.112037797038525 -1.2848438586294648 - - 400 - 4 - 400 - 1 - 1 - - - org.contikios.cooja.plugins.LogListener - - ID:4 - - - - 1404 - 2 - 240 - 400 - 160 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - - - - 500.0 - - 1804 - 6 - 166 - 0 - 753 - - - org.contikios.cooja.plugins.Notes - - Enter notes here - true - - 1124 - 5 - 160 - 680 - 0 - - - org.contikios.cooja.serialsocket.SerialSocketServer - 0 - - 60001 - true - - 362 - 3 - 116 - 13 - 414 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 1037 - 40 - - diff --git a/tests/17-tun-rpl-br/09-native-border-router-cooja-frag.sh b/tests/17-tun-rpl-br/09-native-border-router-cooja-frag.sh deleted file mode 100755 index 5b893ffc7..000000000 --- a/tests/17-tun-rpl-br/09-native-border-router-cooja-frag.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Contiki directory -CONTIKI=$1 - -# Simulation file -BASENAME=$(basename $0 .sh) - -bash test-native-border-router.sh $CONTIKI $BASENAME fd00::204:4:4:4 60 1200 4 diff --git a/tests/17-tun-rpl-br/Makefile b/tests/17-tun-rpl-br/Makefile deleted file mode 100644 index c46e5271d..000000000 --- a/tests/17-tun-rpl-br/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../Makefile.script-test diff --git a/tests/17-tun-rpl-br/test-border-router.sh b/tests/17-tun-rpl-br/test-border-router.sh deleted file mode 100755 index a69446254..000000000 --- a/tests/17-tun-rpl-br/test-border-router.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -source ../utils.sh - -# Contiki directory -CONTIKI=$1 - -# Simulation file -BASENAME=$2 - -# Destination IPv6 -IPADDR=$3 - -# Time allocated for convergence -WAIT_TIME=$4 - -# Payload len. Default is ping6's default, 56. -PING_SIZE=${5:-56} - -# Inter-ping delay. Default is ping6's default, 1s. -PING_DELAY=${6:-1} - -# ICMP request-reply count -COUNT=5 - -# Start simulation -echo "Starting Cooja simulation $BASENAME.csc" -java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$BASENAME.csc -contiki=$CONTIKI > $BASENAME.coojalog & -JPID=$! -sleep 20 - -# Connect to the simulation -echo "Starting tunslip6" -make -C $CONTIKI/examples/rpl-border-router/ connect-router-cooja TARGET=zoul >> $BASENAME.tunslip6.log 2>&1 & -MPID=$! -printf "Waiting for network formation (%d seconds)\n" "$WAIT_TIME" -sleep $WAIT_TIME - -# Do ping -echo "Pinging" -ping6 $IPADDR -c $COUNT -s $PING_SIZE -i $PING_DELAY | tee $BASENAME.scriptlog -# Fetch ping6 status code (not $? because this is piped) -STATUS=${PIPESTATUS[0]} -REPLIES=`grep -c 'icmp_seq=' $BASENAME.scriptlog` - -echo "Closing simulation and tunslip6" -sleep 1 -kill_bg $JPID -kill_bg $MPID -sleep 1 -rm COOJA.testlog -rm COOJA.log - -if [ $STATUS -eq 0 ] && [ $REPLIES -eq $COUNT ] ; then - printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog; -else - echo "==== $BASENAME.coojalog ====" ; cat $BASENAME.coojalog; - echo "==== $BASENAME.tunslip6.log ====" ; cat $BASENAME.tunslip6.log; - echo "==== $BASENAME.scriptlog ====" ; cat $BASENAME.scriptlog; - - printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog; -fi - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end - -exit 0 diff --git a/tests/17-tun-rpl-br/test-native-border-router.sh b/tests/17-tun-rpl-br/test-native-border-router.sh deleted file mode 100755 index e2e205f20..000000000 --- a/tests/17-tun-rpl-br/test-native-border-router.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -source ../utils.sh - -# Contiki directory -CONTIKI=$1 - -# Simulation file -BASENAME=$2 - -# Destination IPv6 -IPADDR=$3 - -# Time allocated for convergence -WAIT_TIME=$4 - -# Payload len. Default is ping6's default, 56. -PING_SIZE=${5:-56} - -# Inter-ping delay. Default is ping6's default, 1s. -PING_DELAY=${6:-1} - -# ICMP request-reply count -COUNT=5 - -# Start simulation -echo "Starting Cooja simulation $BASENAME.csc" -java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$BASENAME.csc -contiki=$CONTIKI > $BASENAME.coojalog & -JPID=$! -sleep 20 - -# Connect to the simulation -echo "Starting native border-router" -nohup make -C $CONTIKI/examples/rpl-border-router/ connect-router-cooja TARGET=native >> $BASENAME.nbr.log 2>&1 & -MPID=$! -printf "Waiting for network formation (%d seconds)\n" "$WAIT_TIME" -sleep $WAIT_TIME - -# Do ping -echo "Pinging" -ping6 $IPADDR -c $COUNT -s $PING_SIZE -i $PING_DELAY | tee $BASENAME.scriptlog -# Fetch ping6 status code (not $? because this is piped) -STATUS=${PIPESTATUS[0]} -REPLIES=`grep -c 'icmp_seq=' $BASENAME.scriptlog` - -echo "Closing simulation and nbr" -sleep 1 -kill_bg $JPID -kill_bg $MPID -sleep 1 -rm COOJA.testlog -rm COOJA.log - -if [ $STATUS -eq 0 ] && [ $REPLIES -eq $COUNT ] ; then - printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog; -else - echo "==== $BASENAME.coojalog ====" ; cat $BASENAME.coojalog; - echo "==== $BASENAME.nbr.log ====" ; cat $BASENAME.nbr.log; - echo "==== $BASENAME.scriptlog ====" ; cat $BASENAME.scriptlog; - - printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog; -fi - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end - -exit 0 diff --git a/tests/18-coap-lwm2m/06-lwm2m-ipso-test.sh b/tests/18-coap-lwm2m/06-lwm2m-ipso-test.sh deleted file mode 100755 index f596206a9..000000000 --- a/tests/18-coap-lwm2m/06-lwm2m-ipso-test.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -source ../utils.sh - -# Contiki directory -CONTIKI=$1 -# Test basename -BASENAME=06-lwm2m-ipso-test - -IPADDR=fd00::302:304:506:708 - -# Starting Contiki-NG native node -echo "Starting native node - lwm2m/ipso objects" -make -C $CONTIKI/examples/lwm2m-ipso-objects clean >/dev/null -make -C $CONTIKI/examples/lwm2m-ipso-objects > make.log 2> make.err -sudo $CONTIKI/examples/lwm2m-ipso-objects/example-ipso-objects.native > node.log 2> node.err & -CPID=$! -sleep 10 - -echo "Downloading leshan" -LESHAN_JAR=leshan-server-demo-1.0.0-SNAPSHOT-jar-with-dependencies.jar -wget -nc https://joakimeriksson.github.io/resources/$LESHAN_JAR -echo "Starting leshan server" -java -jar $LESHAN_JAR >leshan.log 2>leshan.err & -LESHID=$! - -COUNTER=10 -while [ $COUNTER -gt 0 ]; do - sleep 5 - if grep -q 'OK' leshan.err ; then - break - fi - let COUNTER-=1 -done - -echo "Closing native node" -sleep 1 -kill_bg $CPID - -echo "Closing leshan" -sleep 1 -kill_bg $LESHID - - -if grep -q 'OK' leshan.err ; then - cp leshan.err $BASENAME.testlog; - printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog; -else - echo "==== make.log ====" ; cat make.log; - echo "==== make.err ====" ; cat make.err; - echo "==== node.log ====" ; cat node.log; - echo "==== node.err ====" ; cat node.err; - echo "==== leshan.log ====" ; cat leshan.log; - echo "==== leshan.err ====" ; cat leshan.err; - echo "==== $BASENAME.log ====" ; cat $BASENAME.log; - - printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog; -fi - -rm make.log -rm make.err -rm node.log -rm node.err -rm leshan.log -rm leshan.err - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end -exit 0 diff --git a/tests/18-coap-lwm2m/07-lwm2m-standalone-test.sh b/tests/18-coap-lwm2m/07-lwm2m-standalone-test.sh deleted file mode 100755 index 2e6371896..000000000 --- a/tests/18-coap-lwm2m/07-lwm2m-standalone-test.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -source ../utils.sh - -# Contiki directory -CONTIKI=$1 -# Test basename -BASENAME=07-lwm2m-standalone-test - -# Building standalone posix example -echo "Compiling standalone posix example" -make CONTIKI_NG=../../$CONTIKI -C example-lwm2m-standalone/lwm2m clean >/dev/null -make CONTIKI_NG=../../$CONTIKI -C example-lwm2m-standalone/lwm2m >make.log 2>make.err - -echo "Downloading leshan" -LESHAN_JAR=leshan-server-demo-1.0.0-SNAPSHOT-jar-with-dependencies.jar -wget -nc https://joakimeriksson.github.io/resources/$LESHAN_JAR -echo "Starting leshan server" -java -jar $LESHAN_JAR -lp 5686 -slp 5687 >leshan.log 2>leshan.err & -LESHID=$! - -echo "Starting lwm2m standalone example" -example-lwm2m-standalone/lwm2m/lwm2m-example coap://127.0.0.1:5686 > node.log 2> node.err & - -CPID=$! - -COUNTER=10 -while [ $COUNTER -gt 0 ]; do - sleep 5 - if grep -q 'OK' leshan.err ; then - echo OK with $COUNTER - break - fi - let COUNTER-=1 -done - -echo "Closing standalone example" -sleep 1 -kill_bg $CPID - -echo "Closing leshan" -sleep 1 -kill_bg $LESHID - - -if grep -q 'OK' leshan.err ; then - cp leshan.err $BASENAME.testlog; - printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog; -else - echo "==== make.log ====" ; cat make.log; - echo "==== make.err ====" ; cat make.err; - echo "==== node.log ====" ; cat node.log; - echo "==== node.err ====" ; cat node.err; - echo "==== leshan.log ====" ; cat leshan.log; - echo "==== leshan.err ====" ; cat leshan.err; - echo "==== $BASENAME.log ====" ; cat $BASENAME.log; - - printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog; -fi - -rm make.log -rm make.err -rm node.log -rm node.err -rm leshan.log -rm leshan.err - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end -exit 0 diff --git a/tests/18-coap-lwm2m/08-lwm2m-qmode-ipso-test.sh b/tests/18-coap-lwm2m/08-lwm2m-qmode-ipso-test.sh deleted file mode 100755 index b5ce6aa3f..000000000 --- a/tests/18-coap-lwm2m/08-lwm2m-qmode-ipso-test.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -# Contiki directory -CONTIKI=$1 -# Test basename -BASENAME=08-lwm2m-qmode-ipso-test - -IPADDR=fd00::302:304:506:708 - -# Starting Contiki-NG native node -echo "Starting native node - lwm2m/ipso objects with Q-Mode" -make -C $CONTIKI/examples/lwm2m-ipso-objects clean >/dev/null -make -C $CONTIKI/examples/lwm2m-ipso-objects DEFINES=LWM2M_QUEUE_MODE_CONF_ENABLED=1,LWM2M_QUEUE_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION=1,LWM2M_QUEUE_MODE_OBJECT_CONF_ENABLED=1 > make.log 2> make.err -sudo $CONTIKI/examples/lwm2m-ipso-objects/example-ipso-objects.native > node.log 2> node.err & -CPID=$! -sleep 10 - -echo "Downloading leshan with Q-Mode support" -LESHAN_JAR=leshan-server-demo-qmode-support1.0.0-SNAPSHOT-jar-with-dependencies.jar -wget -nc https://carlosgp143.github.io/resources/$LESHAN_JAR -echo "Starting leshan server with Q-Mode enabled" -java -jar $LESHAN_JAR >leshan.log 2>leshan.err & -LESHID=$! - -COUNTER=10 -while [ $COUNTER -gt 0 ]; do - sleep 5 - aux=$(grep -c 'OK' leshan.err) - if [ $aux -eq 2 ] ; then - break - fi - let COUNTER-=1 -done - -echo "Closing native node" -sleep 1 -pgrep ipso | sudo xargs kill -9 - -echo "Closing leshan" -sleep 1 -pgrep java | sudo xargs kill -9 - -#Two OKs needed: awake and sleeping -aux=$(grep -c 'OK' leshan.err) -if [ $aux -eq 2 ] -then - cp leshan.err $BASENAME.testlog; - printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog; -else - echo "==== make.log ====" ; cat make.log; - echo "==== make.err ====" ; cat make.err; - echo "==== node.log ====" ; cat node.log; - echo "==== node.err ====" ; cat node.err; - echo "==== leshan.log ====" ; cat leshan.log; - echo "==== leshan.err ====" ; cat leshan.err; - echo "==== $BASENAME.log ====" ; cat $BASENAME.log; - - printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog; -fi - -rm make.log -rm make.err -rm node.log -rm node.err -rm leshan.log -rm leshan.err - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end -exit 0 diff --git a/tests/18-coap-lwm2m/09-lwm2m-qmode-standalone-test.sh b/tests/18-coap-lwm2m/09-lwm2m-qmode-standalone-test.sh deleted file mode 100755 index d84d3cd93..000000000 --- a/tests/18-coap-lwm2m/09-lwm2m-qmode-standalone-test.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -# Contiki directory -CONTIKI=$1 -# Test basename -BASENAME=09-lwm2m-qmode-standalone-test - -# Building standalone posix example -echo "Compiling standalone posix example" -make CONTIKI_NG=../../$CONTIKI -C example-lwm2m-standalone/lwm2m clean >/dev/null -make CONTIKI_NG=../../$CONTIKI -C example-lwm2m-standalone/lwm2m DEFINES=LWM2M_QUEUE_MODE_CONF_ENABLED=1,LWM2M_QUEUE_MODE_CONF_INCLUDE_DYNAMIC_ADAPTATION=1,LWM2M_QUEUE_MODE_OBJECT_CONF_ENABLED=1 >make.log 2>make.err - -echo "Downloading leshan with Q-Mode support" -LESHAN_JAR=leshan-server-demo-qmode-support1.0.0-SNAPSHOT-jar-with-dependencies.jar -wget -nc https://carlosgp143.github.io/resources/$LESHAN_JAR -echo "Starting leshan server with Q-Mode enabled" -java -jar $LESHAN_JAR -lp 5686 -slp 5687 >leshan.log 2>leshan.err & -LESHID=$! - -echo "Starting lwm2m standalone example" -example-lwm2m-standalone/lwm2m/lwm2m-example coap://127.0.0.1:5686 > node.log 2> node.err & - -CPID=$! - -COUNTER=10 -while [ $COUNTER -gt 0 ]; do - sleep 5 - aux=$(grep -c 'OK' leshan.err) - if [ $aux -eq 2 ] ; then - break - fi - let COUNTER-=1 -done - -echo "Closing standalone example" -sleep 1 -pgrep lwm2m-example | sudo xargs kill -9 - -echo "Closing leshan" -sleep 1 -pgrep java | sudo xargs kill -9 - -aux=$(grep -c 'OK' leshan.err) -if [ $aux -eq 2 ] -then - cp leshan.err $BASENAME.testlog; - printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog; -else - echo "==== make.log ====" ; cat make.log; - echo "==== make.err ====" ; cat make.err; - echo "==== node.log ====" ; cat node.log; - echo "==== node.err ====" ; cat node.err; - echo "==== leshan.log ====" ; cat leshan.log; - echo "==== leshan.err ====" ; cat leshan.err; - echo "==== $BASENAME.log ====" ; cat $BASENAME.log; - - printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog; -fi - -rm make.log -rm make.err -rm node.log -rm node.err -rm leshan.log -rm leshan.err - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end -exit 0 diff --git a/tests/18-coap-lwm2m/Makefile b/tests/18-coap-lwm2m/Makefile deleted file mode 100644 index c46e5271d..000000000 --- a/tests/18-coap-lwm2m/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../Makefile.script-test diff --git a/tests/18-coap-lwm2m/example-lwm2m-standalone b/tests/18-coap-lwm2m/example-lwm2m-standalone deleted file mode 160000 index 3b23ca8d6..000000000 --- a/tests/18-coap-lwm2m/example-lwm2m-standalone +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3b23ca8d6a19d281b6330d3f24afc2e1bb14ddb7 diff --git a/tests/18-coap-lwm2m/pytests/test-device.py b/tests/18-coap-lwm2m/pytests/test-device.py deleted file mode 100644 index 9c441e4a0..000000000 --- a/tests/18-coap-lwm2m/pytests/test-device.py +++ /dev/null @@ -1,69 +0,0 @@ -import unittest, array, time - -class TestDevice(unittest.TestCase): - global client - - def test_available_power_sources(self): - r = client.readTLV("3/0/6") - self.assertEqual(r.getCode().getName(), "CONTENT") - - def test_device_read_JSON(self): - r = client.readJSON("3/0/1") - self.assertEqual(r.getCode().getName(), "CONTENT") - - def test_manufacturer_read(self): - r = client.read("3/0/0") - self.assertEqual(r.getCode().getName(), "CONTENT") - - def test_manufacturer_readJSON(self): - r = client.readJSON("3/0/0") - self.assertEqual(r.getCode().getName(), "CONTENT") - - def test_manufacturer_write(self): - r = client.write(3, 0, 0, "abc"); - self.assertEqual(r.getCode().getName(), "METHOD_NOT_ALLOWED") - - def test_manufacturer_execute(self): - r = client.execute("3/0/0") - self.assertEqual(r.getCode().getName(), "METHOD_NOT_ALLOWED") - - def test_reboot_read(self): - r = client.read("3/0/4") - self.assertEqual(r.getCode().getName(), "METHOD_NOT_ALLOWED") - -# def test_opaque_read(self): -# r = client.readTLV("4711/0/11000") -# v = r.getContent().getValue(); - #print "Result:", v - #print "Type: ", type(v) - #print "Type code: ", v.typecode - #print "Data size: ", len(v) -# self.assertEqual(len(v), 900) - -# def test_object_with_opaque_read(self): -# r = client.readTLV("4711/0/") -# self.assertEqual(r.getCode().getName(), "CONTENT") - - def test_device_time_write(self): - r = client.write(3,0,13,1000) - self.assertEqual(r.getCode().getName(), "CHANGED") - time.sleep(4.9) - r = client.read("3/0/13") - v = r.getContent().getValue().getTime() - self.assertTrue(v > 1000) - print "Time: ", v - - - -print "----------------------------------------" -print "LWM2M Tester - name of client: ", client.endpoint -print "----------------------------------------" - -r = client.read("3/0/0"); -print "Code:", r.getCode(), r.getCode().getName() == "CONTENT" -print "Objects: ", client.links -print "Read Manufacturer => ", client.read("3/0/0") -print "Read Device => ", client.readTLV("3/0/") - -suite = unittest.TestLoader().loadTestsFromTestCase(TestDevice) -unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/tests/18-coap-lwm2m/pytests/test-qmode-awake.py b/tests/18-coap-lwm2m/pytests/test-qmode-awake.py deleted file mode 100644 index 775e1cff0..000000000 --- a/tests/18-coap-lwm2m/pytests/test-qmode-awake.py +++ /dev/null @@ -1,20 +0,0 @@ -import unittest, array, time - -class TestQueueModeAwake(unittest.TestCase): - global respAwakeTime - global respSleepTime - - def test_read_awake_time(self): - self.assertEqual(respAwakeTime.getCode().getName(), "CONTENT") - - def test_read_sleep_time(self): - self.assertEqual(respSleepTime.getCode().getName(), "CONTENT") - - -print "----------------------------------------" -print "LWM2M Queue Mode Awake State Tester" -print "----------------------------------------" - - -suite = unittest.TestLoader().loadTestsFromTestCase(TestQueueModeAwake) -unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/tests/18-coap-lwm2m/pytests/test-qmode-sleep.py b/tests/18-coap-lwm2m/pytests/test-qmode-sleep.py deleted file mode 100644 index 66dc061ff..000000000 --- a/tests/18-coap-lwm2m/pytests/test-qmode-sleep.py +++ /dev/null @@ -1,19 +0,0 @@ -from __future__ import with_statement -import unittest, array, time - -class TestQueueModeSleep(unittest.TestCase): - global client - - def test_read_awake_time(self): - self.assertIsNone(client.read("30000/0/30000")) - - def test_read_sleep_time(self): - self.assertIsNone(client.read("30000/0/30001")) - - -print "----------------------------------------" -print "LWM2M Queue Mode Sleep State Tester - name of client: ", client.endpoint -print "----------------------------------------" - -suite = unittest.TestLoader().loadTestsFromTestCase(TestQueueModeSleep) -unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/tests/19-out-of-tree-build/Makefile b/tests/19-out-of-tree-build/Makefile deleted file mode 100644 index 30d7e2302..000000000 --- a/tests/19-out-of-tree-build/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -EXAMPLESDIR=$(HOME)/out-of-tree-tests -TOOLSDIR=$(HOME)/contiki-ng/tools - -EXAMPLES = \ -hello-world/native \ -hello-world/native:MAKE_NET=MAKE_NET_NULLNET \ -hello-world/native:MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC \ -hello-world/sky \ -hello-world/nrf52dk \ -hello-world/cc2538dk \ -hello-world/zoul \ -hello-world/openmote-cc2538 \ -hello-world/cc26x0-cc13x0 \ -hello-world/jn516x \ -hello-world/simplelink:BOARD=launchpad/cc26x2r1 \ -hello-world/simplelink:BOARD=sensortag/cc2650 \ - -TOOLS= - -include ../Makefile.compile-test diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index ddee606f2..000000000 --- a/tests/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) 2012, Thingsquare, www.thingsquare.com. -# 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - -TESTS=$(wildcard ??-*) -SUMMARIES=$(foreach test,$(TESTS),$(test)/summary) - -CONTIKI=.. - -run: clean summary - -summary: $(SUMMARIES) - @cat $(SUMMARIES) > $@ - -%/summary: - @$(MAKE) -C $* summary || true - -clean: - rm -f $(SUMMARIES) summary - -scan-build: - cd scan_build && scan-build $(MAKE) diff --git a/tests/Makefile.compile-test b/tests/Makefile.compile-test deleted file mode 100644 index e30f9da36..000000000 --- a/tests/Makefile.compile-test +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (c) 2012, Thingsquare, www.thingsquare.com. -# 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - -all: clean summary - -# The stuff below is some GNU make magic to automatically make make -# give each compile test a number, prefixed with a 0 if the number is -# < 10, to match the way the simulation tests output works. -nine := x x x x x x x x x -max = $(subst xx,x,$(join ${1},${2})) -gt = $(filter-out $(words ${1}),$(words $(call max,${1},${2}))) -addzero = $(if $(call gt,${nine},$(1)),$(words ${1}),0$(words ${1})) -get_target = $(firstword $(subst :, ,$1)) -get_target_vars = $(wordlist 2,15,$(subst :, ,$1)) - -define dooneexample -@echo -n Building example $(3): $(1) $(4) for target $(2) -@((cd $(EXAMPLESDIR)/$(1); \ - $(MAKE) $(4) TARGET=$(2) clean && make -j $(4) TARGET=$(2) WERROR=1) > \ - /dev/null 2>make.err && \ - (echo " -> OK" && printf "%-75s %-40s %-20s TEST OK\n" "$(1)" "$(4)" "$(2)" > $(3)-$(subst /,-,$(1))$(2).testlog) || \ - (echo " -> FAIL" && printf "%-75s %-40s %-20s TEST FAIL\n" "$(1)" "$(4)" "$(2)" > $(3)-$(subst /,-,$(1))$(2).testlog ; cat make.err)) -@rm -f make.err -endef - -define doexample -$(eval i+=x) -$(call dooneexample,$(dir $(call get_target,${1})),$(notdir $(call get_target,${1})),$(call addzero,${i}),$(call get_target_vars,${1})) -endef -#end of GNU make magic - -examples: - $(foreach ex, $(EXAMPLES), $(call doexample, ${ex})) - -summary: examples - @cat *.testlog > summary - @echo "========== Summary ==========" - @cat summary - -clean: - @rm -f *.testlog summary - @$(foreach example, $(EXAMPLES), \ - $(foreach target, $(EXAMPLESTARGETS), \ - (cd $(EXAMPLESDIR)/$(example); $(MAKE) TARGET=$(target) clean);)) diff --git a/tests/Makefile.script-test b/tests/Makefile.script-test deleted file mode 100644 index e58acec80..000000000 --- a/tests/Makefile.script-test +++ /dev/null @@ -1,18 +0,0 @@ -TESTS=$(wildcard ??-*.sh) -TESTLOGS=$(sort $(patsubst %.sh,%.testlog,$(TESTS))) - -CONTIKI=../.. - -all: clean summary - -summary: $(TESTLOGS) - @cat *.testlog > summary - @echo "========== Summary ==========" - @cat summary - -%.testlog: %.sh - @echo "========== Running script test $(basename $@).sh ==========" - @bash "$(basename $@).sh" "$(CONTIKI)" - -clean: - @rm -f *.*log report summary diff --git a/tests/Makefile.simulation-test b/tests/Makefile.simulation-test deleted file mode 100644 index 618419dc6..000000000 --- a/tests/Makefile.simulation-test +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (c) 2012, Thingsquare, www.thingsquare.com. -# 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - -all: cooja summary - -TESTS=$(wildcard ??-*.csc) -TESTLOGS=$(sort $(patsubst %.csc,%.testlog,$(TESTS))) - -# The random seed to start from -BASESEED ?= 1 -# The number of runs (with different random seeds) -RUNCOUNT ?= 1 - -CONTIKI=../.. - -tests: $(TESTLOGS) - -summary: clean tests -ifeq ($(TESTS),) - @echo No tests > summary -else - @cat $(TESTLOGS) > summary -endif - @echo "========== Summary ==========" - @cat summary - -%.testlog: %.csc cooja - @$(CONTIKI)/tests/simexec.sh "$<" "$(CONTIKI)" "$(basename $@)" $(BASESEED) $(RUNCOUNT) - -clean: - @rm -f *.*log report summary - -cooja: $(CONTIKI)/tools/cooja/dist/cooja.jar -$(CONTIKI)/tools/cooja/dist/cooja.jar: - (cd $(CONTIKI)/tools/cooja; ant jar) diff --git a/tests/check-test.sh b/tests/check-test.sh deleted file mode 100755 index c59ee873b..000000000 --- a/tests/check-test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -FAILS=`grep -c 'TEST FAIL' $1/summary` -echo "======== Test outcome =======" -if [ -f "$1/summary" ] && [ $FAILS == 0 ]; then - printf "Test %s OK\n" "$1" - exit 0 -else - printf "Test %s FAIL\n" "$1" - exit 1 -fi diff --git a/tests/compile-all/Makefile b/tests/compile-all/Makefile deleted file mode 100644 index 1bd79315c..000000000 --- a/tests/compile-all/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -all: - ./build.sh all - -clean: - ./build.sh clean diff --git a/tests/compile-all/build.sh b/tests/compile-all/build.sh deleted file mode 100755 index 81441816e..000000000 --- a/tests/compile-all/build.sh +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2018, University of Bristol -# 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 University 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 UNIVERSITY 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 INSTITUTE 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. -# -# Author: Atis Elsts - -# -# This file builds all examples for all platforms, excluding just those -# example and platform combinations that are marked as impossible in the Makefiles -# by using PLATFORMS_EXCLUDE and PLATFORMS_ONLY variables. -# -# This script can also clean all targets. To do that, run: -# ./build.sh clean -# -# To invoke the building for a specific platform, run: -# $ PLATFORMS=zoul ./build.sh -# -CONTIKI_NG_TOP_DIR="../.." -EXAMPLES_DIR=$CONTIKI_NG_TOP_DIR/examples - -if [[ "$PLATFORMS" == "" ]] -then - PLATFORMS=`ls $CONTIKI_NG_TOP_DIR/arch/platform` -fi - -if [[ "$MAKEFILES" == "" ]] -then - MAKEFILES=`find $EXAMPLES_DIR -name Makefile` -fi - -HELLO_WORLD=$EXAMPLES_DIR/hello-world - -# Set the make goal the first argument of the script or to "all" if called w/o arguments -if [[ $# -gt 0 ]] -then - GOAL=$1 -else - GOAL="all" -fi - -# Logging level: -# 0 - quiet -# 1 - normal; prints compilation and link messages only on errors -# 2 - print all compilation and link messages -LOG_LEVEL=1 - -if [[ $LOG_LEVEL -ge 1 ]] -then - LOG_INFO=echo - CAT_INFO=cat -else - LOG_INFO=true - CAT_INFO=true -fi - -if [[ $LOG_LEVEL -ge 2 ]] -then - LOG_DEBUG=echo - CAT_DEBUG=cat -else - LOG_DEBUG=true - CAT_DEBUG=true -fi - -NUM_SUCCESS=0 -NUM_FAILED=0 - -FAILED= - -for platform in $PLATFORMS -do - # Cooja is not very friendly for command line builds at the moment - if [[ "$platform" == "cooja" ]] - then - $LOG_INFO "Skipping the Cooja platform" - continue - fi - - # Detect all boards for the current platform by calling - # make TARGET=$platform boards - # in the hello-world dir. - BOARDS=`make -s -C $HELLO_WORLD TARGET=$platform boards \ - | grep -v "no boards" | rev | cut -f3- -d" " | rev` - - if [[ -z $BOARDS ]] - then - BOARDS="default" - fi - - $LOG_INFO "=====================================================" - $LOG_INFO "Going through all examples for platform \"$platform\"" - $LOG_INFO "=====================================================" - for example in $MAKEFILES - do - - for board in $BOARDS - do - example_dir=`dirname "$example"` - - # Clean it before building - make -C "$example_dir" TARGET=$platform BOARD=$board clean 2>&1 >/dev/null - if [[ "$GOAL" == "clean" ]] - then - # do this just for the first board - break - fi - - # Build the goal - $LOG_INFO "make -C \"$example_dir\" -j TARGET=$platform BOARD=$board $GOAL" - if make -C "$example_dir" -j TARGET=$platform BOARD=$board $GOAL 2>&1 >build.log - then - $LOG_INFO "..done" - $CAT_DEBUG build.log - NUM_SUCCESS=$(($NUM_SUCCESS + 1)) - else - $LOG_INFO "Failed to build $example_dir for $platform ($board)" - $CAT_DEBUG build.log - NUM_FAILED=$(($NUM_FAILED + 1)) - FAILED="$FAILED; $example_dir for $platform ($board)" - fi - - # Clean it after building - make -C "$example_dir" TARGET=$platform BOARD=$board clean 2>&1 >/dev/null - done - done -done - -# If building, not cleaning, print so statistics -if [[ "$GOAL" == "all" ]] -then - $LOG_INFO "Number of examples skipped or built successfully: $NUM_SUCCESS" - $LOG_INFO "Number of examples that failed to build: $NUM_FAILED" - $LOG_INFO "Failed examples: $FAILED" -fi diff --git a/tests/scan_build/Makefile b/tests/scan_build/Makefile deleted file mode 100644 index 4add781f1..000000000 --- a/tests/scan_build/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -EXAMPLESDIR=../../examples -TOOLSDIR=../../tools - -EXAMPLES = \ -hello-world/native \ -storage/eeprom-test/native \ - -TOOLS= - -include ../Makefile.compile-test diff --git a/tests/simexec.sh b/tests/simexec.sh deleted file mode 100755 index 31b8bcdf8..000000000 --- a/tests/simexec.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# The simulation to run -CSC=$1 -shift -#Contiki directory -CONTIKI=$1 -shift -#The basename of the experiment -BASENAME=$1 -shift -#The random seed to start from -BASESEED=$1 -shift -#The number of runs (with different seeds) -RUNCOUNT=$1 -shift - -# Counts all tests run -declare -i TESTCOUNT=0 - -# Counts successfull tests -declare -i OKCOUNT=0 - -# A list of seeds the resulted in failure -FAILSEEDS= - -for (( SEED=$BASESEED; SEED<$(($BASESEED+$RUNCOUNT)); SEED++ )); do - echo -n "Running test $BASENAME with random Seed $SEED" - - # run simulation - java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$CSC -contiki=$CONTIKI -random-seed=$SEED > $BASENAME.$SEED.coojalog & - JPID=$! - - # Copy the log and only print "." if it changed - touch progress.log - while kill -0 $JPID 2> /dev/null - do - sleep 1 - diff $BASENAME.$SEED.coojalog progress.log > /dev/null - if [ $? -ne 0 ] - then - echo -n "." - cp $BASENAME.$SEED.coojalog progress.log - fi - done - rm progress.log - - # wait for end of simulation - wait $JPID - JRV=$? - - # Save testlog - touch COOJA.testlog; - mv COOJA.testlog $BASENAME.$SEED.scriptlog - rm COOJA.log - - TESTCOUNT+=1 - if [ $JRV -eq 0 ] ; then - OKCOUNT+=1 - echo " OK" - else - FAILSEEDS+=" $BASESEED" - echo " FAIL" - echo "==== $BASENAME.$SEED.coojalog ====" ; cat $BASENAME.$SEED.coojalog; - echo "==== $BASENAME.$SEED.scriptlog ====" ; cat $BASENAME.$SEED.scriptlog; - fi -done - -if [ $TESTCOUNT -ne $OKCOUNT ] ; then - # At least one test failed - printf "%-40s TEST FAIL %3d/%d -- failed seeds:%s\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" "$FAILSEEDS" > $BASENAME.testlog; -else - printf "%-40s TEST OK %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" > $BASENAME.testlog; -fi - -# We do not want Make to stop -> Return 0 -# The Makefile will check if a log contains FAIL at the end -exit 0 diff --git a/tests/utils.sh b/tests/utils.sh deleted file mode 100755 index bd00ca539..000000000 --- a/tests/utils.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -function echo_run( ) -{ - echo $@ - $@ -} - -function kill_bg( ) -{ - PID=$1 - CMD=$(ps -p $PID -o cmd=) - SUDO= - TOKILL=$PID - if [[ ${CMD:0:5} == "sudo " ]] ; then - SUDO="sudo " - TOKILL=$(ps --ppid $PID -o pid=) - fi - echo_run ${SUDO}kill -9 $TOKILL -} diff --git a/tools/cc2538-bsl b/tools/cc2538-bsl deleted file mode 160000 index 59fd804b8..000000000 --- a/tools/cc2538-bsl +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 59fd804b80aec868d74ce37c6195086b817981ea diff --git a/tools/code-style/uncrustify-changed.sh b/tools/code-style/uncrustify-changed.sh deleted file mode 100755 index a0bfa49e1..000000000 --- a/tools/code-style/uncrustify-changed.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# This file checks your git index and runs uncrustify on every changed *.c and *.h -# file. -# -# Author: Valentin Sawadski - -# Exit if any called command exits nonzero -set -e - -# Determine the repository root as the path returned by porcelain always -# start there -GIT_REPOSITORY_ROOT=$(git rev-parse --show-toplevel) - -# This is the format command that will be run. -FORMAT_COMMAND=$GIT_REPOSITORY_ROOT/tools/code-style/uncrustify-fix-style.sh - -# Parse all the files we get from git. -RAW_FILES=$(git status --porcelain) -# Set \n to be the field separator -IFS=$'\n' -# This splits the input by newline -GIT_FILES_BY_LINE=( $RAW_FILES ) - -# Now go throug them once more and remove the GIT status logs. -# Count the amount of C and H files we have to format. -IFS=$' ' -for i in "${!GIT_FILES_BY_LINE[@]}"; do - LINE_BY_SPACE=( ${GIT_FILES_BY_LINE[i]} ) - FILE=${LINE_BY_SPACE[1]} - - if [[ ${FILE: -2} = ".c" || ${FILE: -2} = ".h" ]]; then - # echo Formatting File: $FILE - $FORMAT_COMMAND $GIT_REPOSITORY_ROOT/$FILE - fi -done - diff --git a/tools/code-style/uncrustify-check-style.sh b/tools/code-style/uncrustify-check-style.sh deleted file mode 100755 index fffebb338..000000000 --- a/tools/code-style/uncrustify-check-style.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -uncrustify -q -c `dirname $0`/uncrustify.cfg -f $1 | diff -u $1 --to-file=/dev/stdin diff --git a/tools/code-style/uncrustify-fix-style.sh b/tools/code-style/uncrustify-fix-style.sh deleted file mode 100755 index 388dfeb17..000000000 --- a/tools/code-style/uncrustify-fix-style.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -uncrustify --no-backup --replace -c `dirname $0`/uncrustify.cfg $* diff --git a/tools/code-style/uncrustify.cfg b/tools/code-style/uncrustify.cfg deleted file mode 100644 index 7b2b353ec..000000000 --- a/tools/code-style/uncrustify.cfg +++ /dev/null @@ -1,205 +0,0 @@ -tok_split_gte=false -utf8_byte=false -utf8_force=false -indent_cmt_with_tabs=false -indent_align_string=true -indent_braces=false -indent_braces_no_func=false -indent_braces_no_class=false -indent_braces_no_struct=false -indent_brace_parent=false -indent_namespace=false -indent_extern=false -indent_class=false -indent_class_colon=false -indent_else_if=false -indent_var_def_cont=false -indent_func_call_param=false -indent_func_def_param=false -indent_func_proto_param=false -indent_func_class_param=false -indent_func_ctor_var_param=false -indent_template_param=false -indent_func_param_double=false -indent_relative_single_line_comments=false -indent_col1_comment=false -indent_access_spec_body=false -indent_paren_nl=false -indent_comma_paren=false -indent_bool_paren=false -indent_first_bool_expr=false -indent_square_nl=false -indent_preserve_sql=false -indent_align_assign=false -sp_balance_nested_parens=false -align_keep_tabs=false -align_with_tabs=false -align_on_tabstop=false -align_number_right=false -align_func_params=false -align_same_func_call_params=false -align_var_def_colon=false -align_var_def_attribute=false -align_var_def_inline=false -align_right_cmt_mix=false -align_on_operator=false -align_mix_var_proto=false -align_single_line_func=false -align_single_line_brace=false -align_nl_cont=false -align_left_shift=false -align_oc_decl_colon=false -nl_collapse_empty_body=false -nl_assign_leave_one_liners=false -nl_class_leave_one_liners=false -nl_enum_leave_one_liners=false -nl_getset_leave_one_liners=false -nl_func_leave_one_liners=false -nl_if_leave_one_liners=false -nl_multi_line_cond=false -nl_multi_line_define=false -nl_before_case=false -nl_after_case=false -nl_after_return=false -nl_after_semicolon=true -nl_after_brace_open=false -nl_after_brace_open_cmt=false -nl_after_vbrace_open=false -nl_after_vbrace_open_empty=false -nl_after_brace_close=false -nl_after_vbrace_close=false -nl_define_macro=false -nl_squeeze_ifdef=false -nl_ds_struct_enum_cmt=false -nl_ds_struct_enum_close_brace=false -nl_create_if_one_liner=false -nl_create_for_one_liner=false -nl_create_while_one_liner=false -ls_for_split_full=false -ls_func_split_full=false -nl_after_multiline_comment=false -eat_blanks_after_open_brace=false -eat_blanks_before_close_brace=true -mod_full_brace_if_chain=false -mod_pawn_semicolon=false -mod_full_paren_if_bool=false -mod_remove_extra_semicolon=true -mod_sort_import=false -mod_sort_using=false -mod_sort_include=false -mod_move_case_break=false -mod_remove_empty_return=false -cmt_indent_multi=true -cmt_c_group=false -cmt_c_nl_start=false -cmt_c_nl_end=false -cmt_cpp_group=false -cmt_cpp_nl_start=false -cmt_cpp_nl_end=false -cmt_cpp_to_c=true -cmt_star_cont=false -cmt_multi_check_last=false -cmt_insert_before_preproc=false -pp_indent_at_level=false -pp_region_indent_code=false -pp_if_indent_code=false -pp_define_at_level=false -input_tab_size=2 -output_tab_size=2 -indent_columns=2 -nl_max=2 -nl_after_func_body=1 -newlines=lf -utf8_bom=remove -indent_with_tabs=0 -sp_arith=force -sp_assign=force -sp_enum_before_assign=add -sp_enum_after_assign=force -sp_pp_concat=ignore -sp_bool=force -sp_compare=force -sp_inside_paren=remove -sp_paren_paren=remove -sp_paren_brace=remove -sp_before_ptr_star=force -sp_before_unnamed_ptr_star=force -sp_between_ptr_star=remove -sp_after_ptr_star=remove -sp_before_sparen=remove -sp_inside_sparen=remove -sp_inside_sparen_close=remove -sp_sparen_brace=force -sp_special_semi=remove -sp_before_semi=remove -sp_before_semi_for=remove -sp_before_semi_for_empty=remove -sp_after_semi_for=force -sp_after_semi_for_empty=remove -sp_before_square=remove -sp_before_squares=remove -sp_inside_square=remove -sp_after_comma=force -sp_before_comma=remove -sp_before_case_colon=remove -sp_after_cast=remove -sp_inside_paren_cast=remove -sp_sizeof_paren=remove -sp_inside_braces=force -sp_inside_braces_empty=remove -sp_func_proto_paren=remove -sp_func_def_paren=remove -sp_inside_fparens=remove -sp_inside_fparen=remove -sp_square_fparen=remove -sp_func_call_paren=remove -sp_func_call_paren_empty=remove -sp_return_paren=force -sp_defined_paren=remove -sp_else_brace=force -sp_brace_else=force -sp_not=remove -sp_inv=remove -sp_addr=remove -sp_member=remove -sp_deref=remove -sp_sign=remove -sp_incdec=remove -sp_before_nl_cont=force -sp_cond_colon=force -sp_cond_question=force -sp_case_label=remove -sp_endif_cmt=force -nl_enum_brace=remove -nl_struct_brace=remove -nl_union_brace=remove -nl_if_brace=remove -nl_brace_else=remove -nl_elseif_brace=remove -nl_else_brace=remove -nl_else_if=remove -nl_for_brace=remove -nl_while_brace=remove -nl_do_brace=remove -nl_brace_while=remove -nl_switch_brace=remove -nl_func_type_name=force -nl_func_paren=remove -nl_func_def_paren=remove -nl_func_decl_start=remove -nl_func_def_start=remove -nl_func_decl_end=remove -nl_func_def_end=remove -nl_func_decl_empty=remove -nl_func_def_empty=remove -nl_fdef_brace=force -nl_return_expr=remove -pos_arith=ignore -pos_comma=trail -mod_full_brace_do=force -mod_full_brace_for=force -mod_full_brace_if=force -mod_full_brace_while=ignore -mod_paren_on_return=remove -pp_indent=remove -pp_space=remove diff --git a/tools/coffee-manager/LICENSE b/tools/coffee-manager/LICENSE deleted file mode 100644 index 0112b2155..000000000 --- a/tools/coffee-manager/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2009, Swedish Institute of Computer Science -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 Institute 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 INSTITUTE 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 INSTITUTE 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. diff --git a/tools/coffee-manager/MANIFEST.MF b/tools/coffee-manager/MANIFEST.MF deleted file mode 100644 index 6865e6e9a..000000000 --- a/tools/coffee-manager/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: org.contikios.coffee.CoffeeManager diff --git a/tools/coffee-manager/README.md b/tools/coffee-manager/README.md deleted file mode 100644 index 6b4a8e3b1..000000000 --- a/tools/coffee-manager/README.md +++ /dev/null @@ -1,28 +0,0 @@ -org.contikios.coffee is a library for the Coffee File System. It is able to generate -file system images and to extract information from existing images. - -Building: ---------- - - ./build.sh - -Usage: ------- - - java -jar coffee.jar [-p ] [-i|e|r ] [-l|s] - -Options: --------- - --p Selects the platform configuration of Coffee to use. - Valid choices: sky (default), esb. --i Inserts a new file into the file system. --e Extracts a file from the file system and saves it locally. --r Removes a file from the file system. --l Lists all files. --s Prints file system statistics. - -Author: -------- - -Nicolas Tsiftes diff --git a/tools/coffee-manager/build.sh b/tools/coffee-manager/build.sh deleted file mode 100755 index d89c75ff2..000000000 --- a/tools/coffee-manager/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -(cd org/contikios/coffee && javac *.java) && \ -jar cvfm coffee.jar MANIFEST.MF org/contikios/coffee/*.class *.properties diff --git a/tools/coffee-manager/build.xml b/tools/coffee-manager/build.xml deleted file mode 100644 index 3cb1399eb..000000000 --- a/tools/coffee-manager/build.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/coffee-manager/esb.properties b/tools/coffee-manager/esb.properties deleted file mode 100644 index a05d09989..000000000 --- a/tools/coffee-manager/esb.properties +++ /dev/null @@ -1,9 +0,0 @@ -name_length 16 -fs_size 32704 -sector_size 64 -page_size 64 -start_offset 64 -default_file_size 1024 -default_log_size 256 -use_micro_logs true -page_type_size 2 diff --git a/tools/coffee-manager/org/contikios/coffee/CoffeeConfiguration.java b/tools/coffee-manager/org/contikios/coffee/CoffeeConfiguration.java deleted file mode 100644 index 563365ffc..000000000 --- a/tools/coffee-manager/org/contikios/coffee/CoffeeConfiguration.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * @author Nicolas Tsiftes - * - */ - -package org.contikios.coffee; - -import java.io.*; -import java.util.Properties; - -import org.contikios.coffee.CoffeeFS.CoffeeException; - -public class CoffeeConfiguration { - public static final int FD_SET_SIZE = 256; - public static final int MAX_OPEN_FILES = 256; - public static final int LOG_TABLE_LIMIT = 256; - public final int nameLength; - public final int fsSize, sectorSize, pageSize; - public final int startOffset, pageTypeSize; - public final int defaultFileSize, defaultLogSize; - public final int pagesPerSector; - public final boolean useMicroLogs; - - public CoffeeConfiguration(String filename) - throws CoffeeException, IOException { - String[] requiredParameters = {"name_length", "use_micro_logs", "fs_size", - "page_size", "sector_size", - "start_offset", "default_file_size", - "default_log_size", "page_type_size"}; - Properties prop = new Properties(); - InputStream stream = CoffeeConfiguration.class.getResourceAsStream("/" + filename); - if (stream == null) { - throw new CoffeeException("failed to load the configuration file " + filename); - } - - prop.load(stream); - for (int i = 0; i < requiredParameters.length; i++) { - if (prop.getProperty(requiredParameters[i]) == null) { - throw new CoffeeException("missing the parameter \"" + requiredParameters[i] + "\" in the configuration file " + filename); - } - } - - nameLength = Integer.parseInt(prop.getProperty("name_length")); - useMicroLogs = new Boolean(prop.getProperty("use_micro_logs")).booleanValue(); - fsSize = Integer.parseInt(prop.getProperty("fs_size")); - sectorSize = Integer.parseInt(prop.getProperty("sector_size")); - pageSize = Integer.parseInt(prop.getProperty("page_size")); - defaultFileSize = Integer.parseInt(prop.getProperty("default_file_size")); - defaultLogSize = Integer.parseInt(prop.getProperty("default_log_size")); - startOffset = Integer.parseInt(prop.getProperty("start_offset")); - pageTypeSize = Integer.parseInt(prop.getProperty("page_type_size")); - - pagesPerSector = sectorSize / pageSize; - } -} diff --git a/tools/coffee-manager/org/contikios/coffee/CoffeeFS.java b/tools/coffee-manager/org/contikios/coffee/CoffeeFS.java deleted file mode 100644 index 23518a9c3..000000000 --- a/tools/coffee-manager/org/contikios/coffee/CoffeeFS.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * @author Nicolas Tsiftes - * - */ - -package org.contikios.coffee; - -import java.io.*; -import java.util.Map; -import java.util.TreeMap; - -public class CoffeeFS { - private final CoffeeImage image; - private final CoffeeConfiguration conf; - private int currentPage; - private Map files; - private static final int INVALID_PAGE = -1; - - public CoffeeFS(CoffeeImage image) throws IOException { - this.image = image; - conf = image.getConfiguration(); - currentPage = 0; - files = new TreeMap(); - - while(currentPage < (conf.fsSize / conf.pageSize)) { - CoffeeHeader header = readHeader(currentPage); - if (header.isActive() && !header.isLog()) { - CoffeeFile file = new CoffeeFile(this, header); - files.put(file.getName(), file); - } - currentPage = nextFile(header, currentPage); - } - } - - private int pageCount(long size) { - int headerSize = conf.nameLength + conf.pageTypeSize * 2 + 6; - return (int)(size + headerSize + conf.pageSize - 1) / conf.pageSize; - } - - private int findFreeExtent(int pages) throws IOException { - CoffeeHeader header; - int currentPage = 0; - int start = INVALID_PAGE; - - while(currentPage < (conf.fsSize / conf.pageSize)) { - header = readHeader(currentPage); - if (header.isFree()) { - if (start == INVALID_PAGE) { - start = currentPage; - } - currentPage = nextFile(header, currentPage); - if (start + pages <= currentPage) { - return start; - } - } else { - start = INVALID_PAGE; - currentPage = nextFile(header, currentPage); - } - } - return INVALID_PAGE; - } - - public CoffeeImage getImage() { - return image; - } - - public CoffeeConfiguration getConfiguration() { - return conf; - } - - public CoffeeHeader readHeader(int page) throws IOException { - byte[] bytes = new byte[conf.nameLength + conf.pageTypeSize * 2 + 6]; - - image.read(bytes, bytes.length, page * conf.pageSize); - CoffeeHeader header = new CoffeeHeader(this, page, bytes); - - return header; - } - - public void writeHeader(CoffeeHeader header) throws IOException { - byte[] bytes = header.toRawHeader(); - - image.write(bytes, bytes.length, header.getPage() * conf.pageSize); - } - - private int nextFile(CoffeeHeader header, int page) { - if (header.isFree()) { - return page + conf.pagesPerSector & ~(conf.pagesPerSector - 1); - } else if (header.isIsolated()) { - return page + 1; - } - - return page + header.maxPages; - } - - public final Map getFiles() { - return files; - } - - public CoffeeFile insertFile(String filename) throws IOException { - return insertFile(new File(filename)); - } - - public CoffeeFile insertFile(File file) throws IOException { - CoffeeFile coffeeFile; - FileInputStream input = new FileInputStream(file); - int allocatePages = pageCount(file.length()); - int start = findFreeExtent(allocatePages); - - if (start == INVALID_PAGE) { - input.close(); - return null; - } - CoffeeHeader header = new CoffeeHeader(this, start); - header.setName(file.getName()); - header.setReservedSize(allocatePages); - header.allocate(); - coffeeFile = new CoffeeFile(this, header); - writeHeader(header); - coffeeFile.insertContents(input); - input.close(); - return coffeeFile; - } - - public void removeFile(String filename) - throws CoffeeFileException, IOException { - CoffeeFile file = files.get(filename); - if (file == null) { - throw new CoffeeFileException("Coffee: attempt to remove inexistent file"); - } - - file.remove(); - writeHeader(file.getHeader()); - files.remove(file.getName()); - } - - public boolean extractFile(String filename) throws IOException { - return extractFile(filename, new File(filename)); - } - - public boolean extractFile(String fileInCoffee, File fileOnDisk) throws IOException { - CoffeeFile file = files.get(fileInCoffee); - - if (file == null) { - return false; - } - - file.saveContents(fileOnDisk); - return true; - } - - public static class CoffeeException extends RuntimeException { - private static final long serialVersionUID = 1146474084441011154L; - - public CoffeeException(String message) { - super("Coffee error: " + message); - } - } - - public static class CoffeeFileException extends RuntimeException { - - private static final long serialVersionUID = -2954553141887245203L; - - public CoffeeFileException(String message) { - super("Coffee file error: " + message); - } - } - - -} diff --git a/tools/coffee-manager/org/contikios/coffee/CoffeeFile.java b/tools/coffee-manager/org/contikios/coffee/CoffeeFile.java deleted file mode 100644 index 659c4eef2..000000000 --- a/tools/coffee-manager/org/contikios/coffee/CoffeeFile.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * @author Nicolas Tsiftes - * - */ - -package org.contikios.coffee; - -import java.io.*; - -public class CoffeeFile { - protected CoffeeFS coffeeFS; - protected CoffeeHeader header; - private String name; - private int length; - private int reservedSize; - private CoffeeMicroLog microLog; - private boolean knownLength; - - public CoffeeFile(CoffeeFS coffeeFS, CoffeeHeader header) throws IOException { - this.coffeeFS = coffeeFS; - this.header = header; - name = header.name; - reservedSize = header.maxPages * coffeeFS.getConfiguration().pageSize; - if (header.isModified() && - coffeeFS.getConfiguration().useMicroLogs == true) { - microLog = new CoffeeMicroLog(coffeeFS, coffeeFS.readHeader(header.logPage)); - } else { - microLog = null; - } - } - - private int calculateLength() throws IOException { - byte[] bytes = new byte[1]; - int i; - - for (i = reservedSize; i >= header.rawLength(); i--) { - coffeeFS.getImage().read(bytes, 1, header.getPage() * coffeeFS.getConfiguration().pageSize + i); - if (bytes[0] != 0) { - return i - header.rawLength() + 1; - } - } - return 0; - } - - public void insertContents(FileInputStream input) throws IOException { - byte[] bytes = new byte[1]; - int ch; - int startOffset = header.getPage() * - coffeeFS.getConfiguration().pageSize + - header.rawLength(); - - length = 0; - knownLength = true; - - while((ch = input.read()) != -1) { - bytes[0] = (byte) ch; - - coffeeFS.getImage().write(bytes, 1, - startOffset + length); - length++; - } - } - - public void saveContents(File file) throws IOException { - int startOffset = header.getPage() * - coffeeFS.getConfiguration().pageSize + - header.rawLength(); - int i; - byte[] bytes; - - FileOutputStream fOut = new FileOutputStream(file); - - if (microLog != null) { - for (i = 0; i < microLog.getLogRecords(); i++) { - bytes = microLog.getRegion(i); - if (bytes == null) { - bytes = new byte[microLog.getLogRecordSize()]; - coffeeFS.getImage().read(bytes, bytes.length, i * microLog.getLogRecordSize()); - } - fOut.write(bytes); - } - } else { - bytes = new byte[1]; - for (i = 0; i < getLength(); i++) { - coffeeFS.getImage().read(bytes, 1, startOffset + i); - fOut.write(bytes); - } - } - - fOut.close(); - } - - public void remove() { - header.makeObsolete(); - } - - public CoffeeHeader getHeader() { - return header; - } - - public int getLength() throws IOException { - if (!knownLength) { - length = calculateLength(); - knownLength = true; - } - return length; - } - - public String getName() { - return name; - } - - public int getReservedSize() { - return reservedSize; - } -} diff --git a/tools/coffee-manager/org/contikios/coffee/CoffeeHeader.java b/tools/coffee-manager/org/contikios/coffee/CoffeeHeader.java deleted file mode 100644 index 7537fa99a..000000000 --- a/tools/coffee-manager/org/contikios/coffee/CoffeeHeader.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * @author Nicolas Tsiftes - * - */ - -package org.contikios.coffee; - -class CoffeeHeader { - private final CoffeeConfiguration conf; - private final int page; - - private static final int HDR_FLAG_VALID = 0x1; - private static final int HDR_FLAG_ALLOCATED = 0x2; - private static final int HDR_FLAG_OBSOLETE = 0x4; - private static final int HDR_FLAG_MODIFIED = 0x8; - private static final int HDR_FLAG_LOG = 0x10; - private static final int HDR_FLAG_ISOLATED = 0x20; - - int logPage; - int logRecords; - int logRecordSize; - int maxPages; - String name; - - private int flags; - - public CoffeeHeader(CoffeeFS coffeeFS, int page) { - this.page = page; - conf = coffeeFS.getConfiguration(); - } - - public CoffeeHeader(CoffeeFS coffeeFS, int page, byte[] bytes) { - this(coffeeFS, page); - - processRawHeader(bytes); - } - - private int getInt(byte[] bytes, int index) { - return (bytes[index] & 0xff) + ((bytes[index + 1] & 0xff) << 8); - } - - private void processRawHeader(byte[] bytes) { - int index = 0; - - logPage = getPageValue(bytes, 0); - index += conf.pageTypeSize; - - logRecords = getInt(bytes, index); - index += 2; - - logRecordSize = getInt(bytes, index); - index += 2; - - maxPages = getPageValue(bytes, index); - index += conf.pageTypeSize; - - index++; // Skip deprecated EOF hint field. - - flags = bytes[index] & 0xff; - index++; - - name = new String(bytes).substring(index, - index + conf.nameLength); - int nullCharOffset = name.indexOf(0); - if (nullCharOffset >= 0) { - name = name.substring(0, nullCharOffset); - } - } - - private byte[] setPageValue(int page) { - byte[] bytes = new byte[conf.pageTypeSize]; - - for (int i = conf.pageTypeSize - 1; i >= 0; i--) { - bytes[i] = (byte) (page >> (8 * i)); - } - return bytes; - } - - private int getPageValue(byte[] bytes, int offset) { - int page = 0; - for (int i = 0; i < conf.pageTypeSize; i++) { - page |= (bytes[offset + i] & 0xff) << (8 * i); - } - return page; - } - - public byte[] toRawHeader() { - byte[] bytes = new byte[2 * conf.pageTypeSize + - conf.nameLength + 6]; - int index = 0; - - System.arraycopy(setPageValue(logPage), 0, bytes, 0, - conf.pageTypeSize); - index += conf.pageTypeSize; - - bytes[index++] = (byte) (logRecords >> 8); - bytes[index++] = (byte) logRecords; - - bytes[index++] = (byte) (logRecordSize >> 8); - bytes[index++] = (byte) logRecordSize; - - System.arraycopy(setPageValue(maxPages), 0, bytes, index, - conf.pageTypeSize); - index += conf.pageTypeSize; - - bytes[index++] = 0; // Deprecated EOF hint field. - bytes[index++] = (byte) flags; - - byte[] nameBytes = name.getBytes(); - int copyLength = nameBytes.length > conf.nameLength ? - conf.nameLength : nameBytes.length; - System.arraycopy(nameBytes, 0, bytes, index, copyLength); - - return bytes; - } - - public int rawLength() { - return 2 * conf.pageTypeSize + conf.nameLength + 6; - } - - public int getPage() { - return page; - } - - public boolean isValid() { - return (flags & HDR_FLAG_VALID) != 0; - } - - public boolean isAllocated() { - return (flags & HDR_FLAG_ALLOCATED) != 0; - } - - public boolean isObsolete() { - return (flags & HDR_FLAG_OBSOLETE) != 0; - } - - public boolean isModified() { - return (flags & HDR_FLAG_MODIFIED) != 0; - } - - public boolean isIsolated() { - return (flags & HDR_FLAG_ISOLATED) != 0; - } - - public boolean isLog() { - return (flags & HDR_FLAG_LOG) != 0; - } - - public boolean isFree() { - return !isAllocated(); - } - - public boolean isActive() { - return isAllocated() && !isObsolete() && !isIsolated(); - } - - public void allocate() { - flags |= HDR_FLAG_ALLOCATED; - } - - public void makeObsolete() { - flags |= HDR_FLAG_OBSOLETE; - } - - public void setName(String name) { - this.name = name; - } - - public void setReservedSize(int pages) { - maxPages = pages; - } - - public int getReservedSize() { - return maxPages; - } -} diff --git a/tools/coffee-manager/org/contikios/coffee/CoffeeImage.java b/tools/coffee-manager/org/contikios/coffee/CoffeeImage.java deleted file mode 100644 index 355312171..000000000 --- a/tools/coffee-manager/org/contikios/coffee/CoffeeImage.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * @author Nicolas Tsiftes - * - */ - -package org.contikios.coffee; - -import java.io.IOException; - -public interface CoffeeImage { - CoffeeConfiguration getConfiguration(); - void read(byte[] bytes, int size, int offset) throws IOException; - void write(byte[] bytes, int size, int offset) throws IOException; - void erase(int size, int offset) throws IOException; -} diff --git a/tools/coffee-manager/org/contikios/coffee/CoffeeImageFile.java b/tools/coffee-manager/org/contikios/coffee/CoffeeImageFile.java deleted file mode 100644 index 9db22a5c2..000000000 --- a/tools/coffee-manager/org/contikios/coffee/CoffeeImageFile.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * @author Nicolas Tsiftes - * - */ - -package org.contikios.coffee; - -import java.io.IOException; -import java.io.RandomAccessFile; - -public class CoffeeImageFile implements CoffeeImage { - private final RandomAccessFile imageFile; - private final CoffeeConfiguration conf; - - public CoffeeImageFile(String filename, CoffeeConfiguration conf) throws IOException { - this.conf = conf; - imageFile = new RandomAccessFile(filename, "rw"); - if (imageFile.length() == 0) { - // Allocate a full file system image. - imageFile.setLength(conf.startOffset + conf.fsSize); - } - } - - @Override - public CoffeeConfiguration getConfiguration() { - return conf; - } - - @Override - public void read(byte[] bytes, int size, int offset) throws IOException { - imageFile.seek(conf.startOffset + offset); - imageFile.read(bytes, 0, size); - } - - @Override - public void write(byte[] bytes, int size, int offset) throws IOException { - imageFile.seek(conf.startOffset + offset); - imageFile.write(bytes, 0, size); - } - - @Override - public void erase(int size, int offset) throws IOException { - byte[] bytes = new byte[256]; - int chunkSize; - - while(size > 0) { - chunkSize = size > bytes.length ? bytes.length : size; - imageFile.seek(conf.startOffset + offset); - imageFile.write(bytes, 0, chunkSize); - size -= chunkSize; - offset += chunkSize; - } - } - -} diff --git a/tools/coffee-manager/org/contikios/coffee/CoffeeManager.java b/tools/coffee-manager/org/contikios/coffee/CoffeeManager.java deleted file mode 100644 index 1bcedfbe0..000000000 --- a/tools/coffee-manager/org/contikios/coffee/CoffeeManager.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * @author Nicolas Tsiftes - * - */ - -package org.contikios.coffee; - -import java.io.IOException; -import java.util.Iterator; -import java.util.Map; -import java.util.regex.Pattern; -import org.contikios.coffee.CoffeeFS.CoffeeException; -import org.contikios.coffee.CoffeeFS.CoffeeFileException; - -public class CoffeeManager { - public enum Command { INSERT, EXTRACT, REMOVE, LIST, STATS }; - - public static void main(String args[]) { - String platform = "sky"; - Command command = Command.STATS; - String filename = ""; - String fsImage = ""; - String usage = "Usage: java -jar coffee.jar " + - "[-p ] " + - "[-i|e|r ] " + - "[-l|s] " + - ""; - - if (args.length < 2) { - System.err.println(usage); - System.exit(1); - } - - Pattern optionArg = Pattern.compile("-(p|i|e|r)"); - - for(int i = 0; i < args.length - 1; i++) { - if (optionArg.matcher(args[i]).matches()) { - if(i >= args.length - 2) { - System.err.println(usage); - System.exit(1); - } - } - - if(args[i].equals("-p")) { - platform = args[i + 1]; - i++; - } else if (args[i].equals("-i")) { - command = Command.INSERT; - filename = args[i + 1]; - i++; - } else if (args[i].equals("-r")) { - command = Command.REMOVE; - filename = args[i + 1]; - i++; - } else if (args[i].equals("-e")) { - command = Command.EXTRACT; - filename = args[i + 1]; - i++; - } else if (args[i].equals("-l")) { - command = Command.LIST; - } else if (args[i].equals("-s")) { - command = Command.STATS; - } else { - System.err.println(usage); - System.exit(1); - } - } - fsImage = args[args.length - 1]; - - try { - CoffeeConfiguration conf = new CoffeeConfiguration(platform + ".properties"); - CoffeeFS coffeeFS = new CoffeeFS(new CoffeeImageFile(fsImage, conf)); - switch (command) { - case INSERT: - if (coffeeFS.getFiles().get(filename) != null) { - System.err.println("error: file \"" + - filename + "\" already exists"); - break; - } - if (coffeeFS.insertFile(filename) != null) { - System.out.println("Inserted the local file \"" + - filename + - "\" into the file system image"); - } - break; - case EXTRACT: - if (coffeeFS.extractFile(filename) == false) { - System.err.println("Inexistent file: " + - filename); - System.exit(1); - } - System.out.println("Saved the file \"" + - filename + "\""); - break; - case REMOVE: - coffeeFS.removeFile(filename); - System.out.println("Removed the file \"" + - filename + - "\" from the Coffee file system image"); - break; - case LIST: - printFiles(coffeeFS.getFiles()); - break; - case STATS: - printStatistics(coffeeFS); - break; - default: - System.err.println("Unknown command!"); - System.exit(1); - } - } catch (IOException e) { - System.err.println(e.getMessage()); - } catch (CoffeeException e) { - System.err.println(e.getMessage()); - } catch (CoffeeFileException e) { - System.err.println(e.getMessage()); - } - } - - public static void printStatistics(CoffeeFS coffeeFS) { - int bytesWritten = 0; - int bytesReserved = 0; - int fileCount = 0; - CoffeeConfiguration conf = coffeeFS.getConfiguration(); - - try { - Iterator> iterator = - coffeeFS.getFiles().entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry pair = iterator.next(); - CoffeeFile file = pair.getValue(); - bytesWritten += file.getLength(); - bytesReserved += file.getHeader().getReservedSize(); - fileCount++; - } - bytesReserved *= conf.pageSize; - System.out.println("File system size: " + - conf.fsSize / 1024 + "kb"); - System.out.println("Allocated files: " + fileCount); - System.out.println("Reserved bytes: " + bytesReserved + " (" + - (100 * ((float) bytesReserved / conf.fsSize)) + - "%)"); - System.out.println("Written bytes: " + bytesWritten + - " (" + - (100 * ((float) bytesWritten / conf.fsSize)) + - "%)"); - } catch (IOException e) { - System.err.println("failed to determine the file length"); - } - } - - public static void printFiles(Map files) { - try { - Iterator> iterator = files.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry pair = iterator.next(); - CoffeeFile file = pair.getValue(); - System.out.println(file.getName() + " " + file.getLength()); - } - } catch (IOException e) { - System.err.println("failed to determine the file length"); - } - } -} diff --git a/tools/coffee-manager/org/contikios/coffee/CoffeeMicroLog.java b/tools/coffee-manager/org/contikios/coffee/CoffeeMicroLog.java deleted file mode 100644 index 2ba1e9d17..000000000 --- a/tools/coffee-manager/org/contikios/coffee/CoffeeMicroLog.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * @author Nicolas Tsiftes - * - */ - -package org.contikios.coffee; - -import java.io.IOException; - -public class CoffeeMicroLog extends CoffeeFile { - private int logRecords; - private int logRecordSize; - private int indexStart; - private int indexSize; - private int recordStart; - private int[] index; - - public CoffeeMicroLog(CoffeeFS fs, CoffeeHeader header) - throws IOException { - super(fs, header); - - CoffeeConfiguration conf = fs.getConfiguration(); - if (header.logRecordSize == 0) { - logRecordSize = conf.pageSize; - } - if (header.logRecords == 0) { - logRecords = conf.defaultLogSize / logRecordSize; - } else { - logRecords = header.logRecords; - } - - indexStart = header.getPage() * conf.pageSize + - header.rawLength(); - /* An index entry uses two bytes. */ - indexSize = logRecords * 2; - recordStart = indexStart + indexSize; - - index = new int[logRecords]; - byte[] bytes = new byte[2]; - - for (int i = 0; i < logRecords; i++) { - coffeeFS.getImage().read(bytes, bytes.length, - indexStart + i * 2); - index[i] = bytes[1] << 8 | bytes[0]; - } - } - - public byte[] getRegion(int region) throws IOException { - for (int i = logRecords - 1; i >= 0; i--) { - if (index[i] - 1 == region) { - byte[] bytes = new byte[logRecordSize]; - coffeeFS.getImage().read(bytes, bytes.length, - recordStart + i * logRecordSize); - return bytes; - } - } - - return null; - } - - public int getLogRecords() { - return logRecords; - } - - public int getLogRecordSize() { - return logRecordSize; - } -} diff --git a/tools/coffee-manager/sky.properties b/tools/coffee-manager/sky.properties deleted file mode 100644 index c6b5d6497..000000000 --- a/tools/coffee-manager/sky.properties +++ /dev/null @@ -1,9 +0,0 @@ -name_length 16 -fs_size 983040 -sector_size 65536 -page_size 256 -start_offset 65536 -default_file_size 4096 -default_log_size 1024 -use_micro_logs true -page_type_size 2 diff --git a/tools/cooja b/tools/cooja deleted file mode 160000 index 63538bbb8..000000000 --- a/tools/cooja +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 63538bbb882ba06a7b8cf97c11ce2fe4d22e4f88 diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile deleted file mode 100644 index 6eb9dbb17..000000000 --- a/tools/docker/Dockerfile +++ /dev/null @@ -1,126 +0,0 @@ -FROM 32bit/ubuntu:16.04 - -ENV DEBIAN_FRONTEND noninteractive - -# Tools -RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ - echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list && \ - apt-get -qq update && \ - apt-get -qq -y --no-install-recommends install \ - ant \ - build-essential \ - default-jdk \ - doxygen \ - gdb \ - git \ - gksu \ - gtk-sharp2 \ - iputils-tracepath \ - libcanberra-gtk-module:i386 \ - libgtk2.0-0 \ - mono-complete \ - mosquitto \ - mosquitto-clients \ - npm \ - python-pip \ - python-serial \ - rlwrap \ - screen \ - srecord \ - uml-utilities \ - unzip \ - wget \ - > /dev/null \ - && apt-get -qq clean - -# Install coap-cli -RUN npm -q install coap-cli -g \ - && sudo ln -s /usr/bin/nodejs /usr/bin/node - -# Install ARM toolchain -RUN wget -nv https://launchpad.net/gcc-arm-embedded/5.0/5-2015-q4-major/+download/gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2 && \ - tar xjf gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2 -C /tmp/ && \ - cp -f -r /tmp/gcc-arm-none-eabi-5_2-2015q4/* /usr/local/ && \ - rm -rf /tmp/gcc-arm-none-eabi-* gcc-arm-none-eabi-*-linux.tar.bz2 - -# Install msp430 toolchain -RUN wget -nv http://simonduq.github.io/resources/mspgcc-4.7.2-compiled.tar.bz2 && \ - tar xjf mspgcc*.tar.bz2 -C /tmp/ && \ - cp -f -r /tmp/msp430/* /usr/local/ && \ - rm -rf /tmp/msp430 mspgcc*.tar.bz2 - -# Install NXP toolchain (partial, with binaries excluded. Download from nxp.com) -RUN wget -nv http://simonduq.github.io/resources/ba-elf-gcc-4.7.4-part1.tar.bz2 && \ - wget -nv http://simonduq.github.io/resources/ba-elf-gcc-4.7.4-part2.tar.bz2 && \ - wget -nv http://simonduq.github.io/resources/jn516x-sdk-4163-1416.tar.bz2 && \ - mkdir /tmp/jn516x-sdk /tmp/ba-elf-gcc && \ - tar xjf jn516x-sdk-*.tar.bz2 -C /tmp/jn516x-sdk && \ - tar xjf ba-elf-gcc-*part1.tar.bz2 -C /tmp/ba-elf-gcc && \ - tar xjf ba-elf-gcc-*part2.tar.bz2 -C /tmp/ba-elf-gcc && \ - cp -f -r /tmp/jn516x-sdk /usr/ && \ - cp -f -r /tmp/ba-elf-gcc /usr/ && \ - rm -rf jn516x*.bz2 ba-elf-gcc*.bz2 /tmp/ba-elf-gcc* /tmp/jn516x-sdk* - -ENV PATH="/usr/ba-elf-gcc/bin:${PATH}" - -## Install nRF52 SDK -RUN wget -nv https://developer.nordicsemi.com/nRF5_IoT_SDK/nRF5_IoT_SDK_v0.9.x/nrf5_iot_sdk_3288530.zip && \ - mkdir /usr/nrf52-sdk && \ - unzip -q nrf5_iot_sdk_3288530.zip -d /usr/nrf52-sdk && \ - rm nrf5_iot_sdk_3288530.zip - -ENV NRF52_SDK_ROOT /usr/nrf52-sdk - -# Install sphinx and sphinx_rtd_theme, required for building and testing the -# readthedocs API documentation -RUN pip -q install --upgrade pip -RUN pip -q install setuptools && pip -q install sphinx_rtd_theme sphinx - -# Create user, enable X forwarding, add to group dialout -# -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -RUN export uid=1000 gid=1000 && \ - mkdir -p /home/user && \ - echo "user:x:${uid}:${gid}:user,,,:/home/user:/bin/bash" >> /etc/passwd && \ - echo "user:x:${uid}:" >> /etc/group && \ - echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers && \ - chmod 0440 /etc/sudoers && \ - chown ${uid}:${gid} -R /home/user && \ - usermod -aG dialout user - -# Set user for what comes next -USER user - -# Environment variables -ENV JAVA_HOME /usr/lib/jvm/default-java -ENV HOME /home/user -ENV CONTIKI_NG ${HOME}/contiki-ng -ENV COOJA ${CONTIKI_NG}/tools/cooja -ENV PATH="${HOME}:${PATH}" -WORKDIR ${HOME} - -# Create Cooja shortcut -RUN echo "#!/bin/bash\nant -Dbasedir=${COOJA} -f ${COOJA}/build.xml run" > ${HOME}/cooja && \ - chmod +x ${HOME}/cooja - -# Download, build and install Renode -RUN git clone --quiet https://github.com/renode/renode.git \ - && cd ${HOME}/renode \ - && git checkout v1.3 \ - && ./build.sh -ENV PATH="${HOME}/renode:${PATH}" - -# By default, we use a Docker bind mount to share the repo with the host, -# with Docker run option: -# -v :/home/user/contiki-ng -# Alternatively, uncomment the next two lines to download Contiki-NG and pre-compile Cooja. -#RUN git clone --recursive https://github.com/contiki-ng/contiki-ng.git ${CONTIKI_NG} -#RUN ant -q -f ${CONTIKI_NG}/tools/cooja/build.xml jar - -# Working directory -WORKDIR ${CONTIKI_NG} - -# Enable IPv6 -- must be done at runtime, hence added to .profile -RUN echo "sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 > /dev/null" >> ${HOME}/.profile - -# Start a bash -CMD bash --login diff --git a/tools/doxygen/Doxyfile b/tools/doxygen/Doxyfile deleted file mode 100644 index 2cd7dba72..000000000 --- a/tools/doxygen/Doxyfile +++ /dev/null @@ -1,2342 +0,0 @@ -# Doxyfile 1.8.8 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "Contiki-NG" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify an logo or icon that is included in -# the documentation. The maximum height of the logo should not exceed 55 pixels -# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo -# to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = . - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = $(docroot) - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = $(docroot) - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a -# new page for each member. If set to NO, the documentation of a member will be -# part of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = "os=Contiki-NG" - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by by putting a % sign in front of the word -# or globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = NO - -# This flag is only useful for Objective-C code. When set to YES local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO these classes will be included in the various overviews. This option has -# no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = YES - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = YES - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the -# todo list. This list is created by putting \todo commands in the -# documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the -# test list. This list is created by putting \test commands in the -# documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = NO - -# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= NO - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES the list -# will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = NO - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO doxygen will only warn about wrong or incomplete parameter -# documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = doxygen.log - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. -# Note: If this tag is empty the current directory is searched. - -INPUT = $(docsrc) - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. - -FILE_PATTERNS = *.h \ - *.c \ - *.doc.html \ - *.txt - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = */cpu/cc26x0-cc13x0/lib/* \ - */cpu/cc26x0-cc13x0/rf-core/api/* \ - */cpu/simplelink-cc13xx-cc26xx/lib/* \ - */cpu/simplelink-cc13xx-cc26xx/rf-settings/* \ - */cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/driverlib/* \ - */cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/rf_patches/* \ - */platform/stm32nucleo-spirit1/stm32cube-lib/* \ - */os/net/security/tinydtls/* - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = . \ - ../../examples/hello-world - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -# IMAGE_PATH = pics - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER ) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = NO - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES, then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefor more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra stylesheet files is of importance (e.g. the last -# stylesheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = doc-style.css - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the stylesheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = YES - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = YES - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler ( hhc.exe). If non-empty -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = YES - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated ( -# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = YES - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = YES - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /